@asante-org/atlascopco-vt-litesitegenerator 3.6.8 → 3.6.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -3937,6 +3937,7 @@ var LsgHeroController = /** @class */function () {
3937
3937
  this.embla = null;
3938
3938
  this.autoplayTimer = null;
3939
3939
  this.contentObserver = null;
3940
+ this.rafId = null;
3940
3941
  this.scrollPrev = function () {
3941
3942
  var _a;
3942
3943
  (_a = _this.embla) === null || _a === void 0 ? void 0 : _a.scrollPrev();
@@ -3974,33 +3975,53 @@ var LsgHeroController = /** @class */function () {
3974
3975
  this.mount(viewport);
3975
3976
  }
3976
3977
  LsgHeroController.prototype.mount = function (viewport) {
3978
+ var _this = this;
3977
3979
  var _a, _b, _c;
3978
- var plugins = this.opts.transition === "fade" ? [Fade()] : [];
3979
- this.embla = EmblaCarousel(viewport, {
3980
- loop: true
3981
- }, plugins);
3982
- if (this.opts.autoplay) {
3983
- this.startAutoplay();
3984
- this.embla.on("pointerDown", this.stopAutoplay);
3985
- this.embla.on("pointerUp", this.startAutoplay);
3986
- }
3987
3980
  (_a = this.els.prevBtn) === null || _a === void 0 ? void 0 : _a.addEventListener("click", this.scrollPrev);
3988
3981
  (_b = this.els.nextBtn) === null || _b === void 0 ? void 0 : _b.addEventListener("click", this.scrollNext);
3989
3982
  (_c = this.els.scrollDownBtn) === null || _c === void 0 ? void 0 : _c.addEventListener("click", this.handleScrollDown);
3990
- // Sync the first slide's content-wrapper height to a CSS custom property
3991
- // on the section root so the controls column can match it dynamically.
3992
- var section = viewport.closest("[data-lsg-is='hero']");
3993
- var contentWrapper = section === null || section === void 0 ? void 0 : section.querySelector(".lsg-hero-card__content-wrapper");
3994
- if (section && contentWrapper && typeof ResizeObserver !== "undefined") {
3995
- var setHeight_1 = function (el) {
3996
- section.style.setProperty("--lsg-hero-content-height", "".concat(el.offsetHeight, "px"));
3997
- };
3998
- setHeight_1(contentWrapper);
3999
- this.contentObserver = new ResizeObserver(function (entries) {
4000
- setHeight_1(entries[0].target);
3983
+ // First frame lets React's initial paint settle; second guarantees that
3984
+ // async-injected stylesheets (e.g. --lsg-hero-axis) have been computed.
3985
+ this.rafId = requestAnimationFrame(function () {
3986
+ _this.rafId = requestAnimationFrame(function () {
3987
+ _this.rafId = null;
3988
+ if (!viewport.isConnected) return;
3989
+ var section = viewport.closest("[data-lsg-is='hero']");
3990
+ var axis = section && getComputedStyle(section).getPropertyValue("--lsg-hero-axis").trim() === "y" ? "y" : "x";
3991
+ var plugins = _this.opts.transition === "fade" ? [Fade()] : [];
3992
+ _this.embla = EmblaCarousel(viewport, {
3993
+ loop: true,
3994
+ axis: axis
3995
+ }, plugins);
3996
+ if (_this.opts.autoplay) {
3997
+ _this.startAutoplay();
3998
+ _this.embla.on("pointerDown", _this.stopAutoplay);
3999
+ _this.embla.on("pointerUp", _this.startAutoplay);
4000
+ }
4001
+ // Sync the first slide's content-wrapper height to a CSS custom property
4002
+ // on the section root so the controls column can match it dynamically.
4003
+ var contentWrapper = section === null || section === void 0 ? void 0 : section.querySelector(".lsg-hero-card__content-wrapper");
4004
+ if (section && contentWrapper && typeof ResizeObserver !== "undefined") {
4005
+ var setHeight_1 = function (el) {
4006
+ section.style.setProperty("--lsg-hero-content-height", "".concat(el.offsetHeight, "px"));
4007
+ };
4008
+ setHeight_1(contentWrapper);
4009
+ _this.contentObserver = new ResizeObserver(function (entries) {
4010
+ setHeight_1(entries[0].target);
4011
+ });
4012
+ _this.contentObserver.observe(contentWrapper);
4013
+ }
4014
+ // For vertical carousels the section height (100svh) cascades from a
4015
+ // useEffect-set data-lsg-theme attribute, which may land one frame after
4016
+ // this RAF. Re-measure so Embla has the correct slide dimensions.
4017
+ if (axis === "y") {
4018
+ requestAnimationFrame(function () {
4019
+ var _a;
4020
+ if (viewport.isConnected) (_a = _this.embla) === null || _a === void 0 ? void 0 : _a.reInit();
4021
+ });
4022
+ }
4001
4023
  });
4002
- this.contentObserver.observe(contentWrapper);
4003
- }
4024
+ });
4004
4025
  };
4005
4026
  Object.defineProperty(LsgHeroController.prototype, "emblaApi", {
4006
4027
  /** Direct access to the underlying Embla instance for advanced usage. */
@@ -4013,6 +4034,10 @@ var LsgHeroController = /** @class */function () {
4013
4034
  /** Tear down event listeners, autoplay, and the Embla instance. */
4014
4035
  LsgHeroController.prototype.destroy = function () {
4015
4036
  var _a, _b, _c, _d;
4037
+ if (this.rafId !== null) {
4038
+ cancelAnimationFrame(this.rafId);
4039
+ this.rafId = null;
4040
+ }
4016
4041
  this.stopAutoplay();
4017
4042
  (_a = this.contentObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
4018
4043
  this.contentObserver = null;