MCPcopy
hub / github.com/shipshapecode/shepherd / _show

Method _show

shepherd.js/src/step.ts:722–768  ·  view source on GitHub ↗

* Triggers `before-show`, generates the tooltip DOM content, * sets up a FloatingUI instance for the tooltip, then triggers `show`. * @private

()

Source from the content-addressed store, hash-verified

720 * @private
721 */
722 _show() {
723 this.trigger('before-show');
724
725 // Force resolve to make sure the options are updated on subsequent shows.
726 this._resolveAttachToOptions();
727 this._resolveExtraHiglightElements();
728 this._setupElements();
729
730 if (!this.tour.modal) {
731 this.tour.setupModal();
732 }
733
734 this.tour.modal?.setupForStep(this);
735 this._styleTargetElementForStep(this);
736
737 if (this.el) {
738 this.el.hidden = false;
739 }
740
741 // start scrolling to target before showing the step
742 if (this.options.scrollTo) {
743 setTimeout(() => {
744 this._scrollTo(
745 this.options.scrollTo as boolean | ScrollIntoViewOptions
746 );
747 });
748 }
749
750 if (this.el) {
751 this.el.hidden = false;
752 }
753
754 const content = this.shepherdElementComponent!.element;
755 const target = this.target || document.body;
756 const extraHighlightElements = this._resolvedExtraHighlightElements;
757
758 target.classList.add(`${this.classPrefix}shepherd-enabled`);
759 target.classList.add(`${this.classPrefix}shepherd-target`);
760 content.classList.add('shepherd-enabled');
761
762 extraHighlightElements?.forEach((el) => {
763 el.classList.add(`${this.classPrefix}shepherd-enabled`);
764 el.classList.add(`${this.classPrefix}shepherd-target`);
765 });
766
767 this.trigger('show');
768 }
769
770 /**
771 * Modulates the styles of the passed step's target element, based on the step's options and

Callers 1

showMethod · 0.95

Calls 7

_setupElementsMethod · 0.95
_scrollToMethod · 0.95
triggerMethod · 0.80
setupModalMethod · 0.80

Tested by

no test coverage detected