@gemx-dev/heatmap-react 3.5.90 → 3.5.92-dev.0
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/esm/index.js +76 -66
- package/dist/esm/index.mjs +76 -66
- package/dist/esm/libs/iframe-processor/processors/viewport/global-fixes/global-fixes/index.d.ts +2 -0
- package/dist/esm/libs/iframe-processor/processors/viewport/global-fixes/global-fixes/index.d.ts.map +1 -0
- package/dist/{umd/libs/iframe-processor/processors/viewport/global-fixes/fixes → esm/libs/iframe-processor/processors/viewport/global-fixes/global-fixes}/viewport-unit-replacer/fixes.d.ts +1 -1
- package/dist/esm/libs/iframe-processor/processors/viewport/global-fixes/global-fixes/viewport-unit-replacer/fixes.d.ts.map +1 -0
- package/dist/esm/libs/iframe-processor/processors/viewport/global-fixes/{fixes → global-fixes}/viewport-unit-replacer/index.d.ts.map +1 -1
- package/dist/esm/libs/iframe-processor/processors/viewport/global-fixes/gp-v7-fixes/gem-slider-item/fixes.d.ts +3 -0
- package/dist/esm/libs/iframe-processor/processors/viewport/global-fixes/gp-v7-fixes/gem-slider-item/fixes.d.ts.map +1 -0
- package/dist/esm/libs/iframe-processor/processors/viewport/global-fixes/{fixes/gp-v7-slider → gp-v7-fixes/gem-slider-item}/index.d.ts.map +1 -1
- package/dist/esm/libs/iframe-processor/processors/viewport/global-fixes/gp-v7-fixes/index.d.ts +2 -0
- package/dist/esm/libs/iframe-processor/processors/viewport/global-fixes/gp-v7-fixes/index.d.ts.map +1 -0
- package/dist/esm/libs/iframe-processor/processors/viewport/global-fixes/index.d.ts +4 -4
- package/dist/esm/libs/iframe-processor/processors/viewport/global-fixes/index.d.ts.map +1 -1
- package/dist/esm/libs/iframe-processor/processors/viewport/global-fixes/shopify-fixes/index.d.ts +2 -0
- package/dist/esm/libs/iframe-processor/processors/viewport/global-fixes/shopify-fixes/index.d.ts.map +1 -0
- package/dist/esm/libs/iframe-processor/processors/viewport/global-fixes/shopify-fixes/theme-dawn/hero-banner.d.ts +14 -0
- package/dist/esm/libs/iframe-processor/processors/viewport/global-fixes/shopify-fixes/theme-dawn/hero-banner.d.ts.map +1 -0
- package/dist/{umd/libs/iframe-processor/processors/viewport/global-fixes/fixes/gempages-swiper → esm/libs/iframe-processor/processors/viewport/global-fixes/shopify-fixes/theme-dawn}/index.d.ts.map +1 -1
- package/dist/esm/libs/iframe-processor/processors/viewport/pipeline.d.ts.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/libs/iframe-processor/processors/viewport/global-fixes/global-fixes/index.d.ts +2 -0
- package/dist/umd/libs/iframe-processor/processors/viewport/global-fixes/global-fixes/index.d.ts.map +1 -0
- package/dist/{esm/libs/iframe-processor/processors/viewport/global-fixes/fixes → umd/libs/iframe-processor/processors/viewport/global-fixes/global-fixes}/viewport-unit-replacer/fixes.d.ts +1 -1
- package/dist/umd/libs/iframe-processor/processors/viewport/global-fixes/global-fixes/viewport-unit-replacer/fixes.d.ts.map +1 -0
- package/dist/umd/libs/iframe-processor/processors/viewport/global-fixes/global-fixes/viewport-unit-replacer/index.d.ts.map +1 -0
- package/dist/umd/libs/iframe-processor/processors/viewport/global-fixes/gp-v7-fixes/gem-slider-item/fixes.d.ts +3 -0
- package/dist/umd/libs/iframe-processor/processors/viewport/global-fixes/gp-v7-fixes/gem-slider-item/fixes.d.ts.map +1 -0
- package/dist/{esm/libs/iframe-processor/processors/viewport/global-fixes/fixes/gempages-swiper → umd/libs/iframe-processor/processors/viewport/global-fixes/gp-v7-fixes/gem-slider-item}/index.d.ts.map +1 -1
- package/dist/umd/libs/iframe-processor/processors/viewport/global-fixes/gp-v7-fixes/index.d.ts +2 -0
- package/dist/umd/libs/iframe-processor/processors/viewport/global-fixes/gp-v7-fixes/index.d.ts.map +1 -0
- package/dist/umd/libs/iframe-processor/processors/viewport/global-fixes/index.d.ts +4 -4
- package/dist/umd/libs/iframe-processor/processors/viewport/global-fixes/index.d.ts.map +1 -1
- package/dist/umd/libs/iframe-processor/processors/viewport/global-fixes/shopify-fixes/index.d.ts +2 -0
- package/dist/umd/libs/iframe-processor/processors/viewport/global-fixes/shopify-fixes/index.d.ts.map +1 -0
- package/dist/umd/libs/iframe-processor/processors/viewport/global-fixes/shopify-fixes/theme-dawn/hero-banner.d.ts +14 -0
- package/dist/umd/libs/iframe-processor/processors/viewport/global-fixes/shopify-fixes/theme-dawn/hero-banner.d.ts.map +1 -0
- package/dist/umd/libs/iframe-processor/processors/viewport/global-fixes/{fixes/gp-v7-slider → shopify-fixes/theme-dawn}/index.d.ts.map +1 -1
- package/dist/umd/libs/iframe-processor/processors/viewport/pipeline.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/esm/libs/iframe-processor/processors/viewport/global-fixes/fixes/gempages-swiper/fixes.d.ts +0 -4
- package/dist/esm/libs/iframe-processor/processors/viewport/global-fixes/fixes/gempages-swiper/fixes.d.ts.map +0 -1
- package/dist/esm/libs/iframe-processor/processors/viewport/global-fixes/fixes/gp-v7-slider/fixes.d.ts +0 -3
- package/dist/esm/libs/iframe-processor/processors/viewport/global-fixes/fixes/gp-v7-slider/fixes.d.ts.map +0 -1
- package/dist/esm/libs/iframe-processor/processors/viewport/global-fixes/fixes/viewport-unit-replacer/fixes.d.ts.map +0 -1
- package/dist/umd/libs/iframe-processor/processors/viewport/global-fixes/fixes/gempages-swiper/fixes.d.ts +0 -4
- package/dist/umd/libs/iframe-processor/processors/viewport/global-fixes/fixes/gempages-swiper/fixes.d.ts.map +0 -1
- package/dist/umd/libs/iframe-processor/processors/viewport/global-fixes/fixes/gp-v7-slider/fixes.d.ts +0 -3
- package/dist/umd/libs/iframe-processor/processors/viewport/global-fixes/fixes/gp-v7-slider/fixes.d.ts.map +0 -1
- package/dist/umd/libs/iframe-processor/processors/viewport/global-fixes/fixes/viewport-unit-replacer/fixes.d.ts.map +0 -1
- package/dist/umd/libs/iframe-processor/processors/viewport/global-fixes/fixes/viewport-unit-replacer/index.d.ts.map +0 -1
- /package/dist/esm/libs/iframe-processor/processors/viewport/global-fixes/{fixes/gempages-swiper → global-fixes/viewport-unit-replacer}/index.d.ts +0 -0
- /package/dist/esm/libs/iframe-processor/processors/viewport/global-fixes/{fixes/gp-v7-slider → gp-v7-fixes/gem-slider-item}/index.d.ts +0 -0
- /package/dist/esm/libs/iframe-processor/processors/viewport/global-fixes/{fixes/viewport-unit-replacer → shopify-fixes/theme-dawn}/index.d.ts +0 -0
- /package/dist/umd/libs/iframe-processor/processors/viewport/global-fixes/{fixes/gempages-swiper → global-fixes/viewport-unit-replacer}/index.d.ts +0 -0
- /package/dist/umd/libs/iframe-processor/processors/viewport/global-fixes/{fixes/gp-v7-slider → gp-v7-fixes/gem-slider-item}/index.d.ts +0 -0
- /package/dist/umd/libs/iframe-processor/processors/viewport/global-fixes/{fixes/viewport-unit-replacer → shopify-fixes/theme-dawn}/index.d.ts +0 -0
package/dist/esm/index.js
CHANGED
|
@@ -4604,7 +4604,7 @@ async function processLinkedStylesheets(ctx) {
|
|
|
4604
4604
|
return count;
|
|
4605
4605
|
}
|
|
4606
4606
|
// ─── Public entry point ───────────────────────────────────────────────────────
|
|
4607
|
-
async function
|
|
4607
|
+
async function process$1(ctx) {
|
|
4608
4608
|
logger$4.configure({ enabled: !!ctx.debug });
|
|
4609
4609
|
// Reset tracking state from any previous run
|
|
4610
4610
|
elementsWithViewportUnits = new Set();
|
|
@@ -4627,68 +4627,7 @@ async function processViewportUnits(ctx) {
|
|
|
4627
4627
|
register$1({
|
|
4628
4628
|
name: 'viewport-unit-replacer',
|
|
4629
4629
|
description: 'Core: convert vh/vw/svh/dvh/% to px values across all iframe CSS',
|
|
4630
|
-
process:
|
|
4631
|
-
});
|
|
4632
|
-
|
|
4633
|
-
/**
|
|
4634
|
-
* GemPages Swiper Fix
|
|
4635
|
-
*
|
|
4636
|
-
* Issue: GemPages Swiper slides use `height: 100vh` internally. After viewport
|
|
4637
|
-
* unit conversion, inactive slides retain their converted height but are not
|
|
4638
|
-
* positioned correctly, causing the page height to be over-calculated.
|
|
4639
|
-
*
|
|
4640
|
-
* Fix:
|
|
4641
|
-
* - beforeProcess: lock swiper containers to a fixed height so conversion
|
|
4642
|
-
* doesn't affect their layout.
|
|
4643
|
-
* - afterProcess: ensure only the active slide is visible and the swiper
|
|
4644
|
-
* wrapper height matches the container.
|
|
4645
|
-
*/
|
|
4646
|
-
const SWIPER_CONTAINER_SELECTOR = '.gp-swiper, [data-gp-element="slider"]';
|
|
4647
|
-
const SWIPER_WRAPPER_SELECTOR = '.swiper-wrapper';
|
|
4648
|
-
const SWIPER_SLIDE_SELECTOR = '.swiper-slide';
|
|
4649
|
-
const SWIPER_SLIDE_ACTIVE_SELECTOR = '.swiper-slide-active';
|
|
4650
|
-
const lockedSwipers = [];
|
|
4651
|
-
function lockSwiperHeights({ doc, targetHeight }) {
|
|
4652
|
-
lockedSwipers.length = 0;
|
|
4653
|
-
doc.querySelectorAll(SWIPER_CONTAINER_SELECTOR).forEach((container) => {
|
|
4654
|
-
lockedSwipers.push({ container, originalHeight: container.style.height });
|
|
4655
|
-
container.style.setProperty('height', `${targetHeight}px`, 'important');
|
|
4656
|
-
});
|
|
4657
|
-
}
|
|
4658
|
-
function restoreSwiperAndFixLayout({ doc }) {
|
|
4659
|
-
// Restore original heights
|
|
4660
|
-
lockedSwipers.forEach(({ container, originalHeight }) => {
|
|
4661
|
-
container.style.removeProperty('height');
|
|
4662
|
-
if (originalHeight)
|
|
4663
|
-
container.style.height = originalHeight;
|
|
4664
|
-
});
|
|
4665
|
-
lockedSwipers.length = 0;
|
|
4666
|
-
// Ensure inactive slides don't bleed into layout
|
|
4667
|
-
doc.querySelectorAll(SWIPER_CONTAINER_SELECTOR).forEach((container) => {
|
|
4668
|
-
const wrapper = container.querySelector(SWIPER_WRAPPER_SELECTOR);
|
|
4669
|
-
const activeSlide = container.querySelector(SWIPER_SLIDE_ACTIVE_SELECTOR);
|
|
4670
|
-
const allSlides = container.querySelectorAll(SWIPER_SLIDE_SELECTOR);
|
|
4671
|
-
// Hide all inactive slides from layout flow
|
|
4672
|
-
allSlides.forEach((slide) => {
|
|
4673
|
-
if (slide !== activeSlide) {
|
|
4674
|
-
slide.style.setProperty('visibility', 'hidden', 'important');
|
|
4675
|
-
slide.style.setProperty('position', 'absolute', 'important');
|
|
4676
|
-
}
|
|
4677
|
-
});
|
|
4678
|
-
// Sync wrapper height to active slide
|
|
4679
|
-
if (wrapper && activeSlide) {
|
|
4680
|
-
wrapper.style.setProperty('height', `${activeSlide.offsetHeight}px`, 'important');
|
|
4681
|
-
}
|
|
4682
|
-
});
|
|
4683
|
-
}
|
|
4684
|
-
|
|
4685
|
-
register$1({
|
|
4686
|
-
name: 'gempages-swiper',
|
|
4687
|
-
description: 'GemPages Swiper slides use 100vh causing layout height inflation',
|
|
4688
|
-
shouldApply: ({ doc }) => !!doc.querySelector('.gp-swiper, [data-gp-element="slider"]'),
|
|
4689
|
-
extraIgnoreSelectors: ['.swiper-slide:not(.swiper-slide-active)'],
|
|
4690
|
-
beforeProcess: lockSwiperHeights,
|
|
4691
|
-
afterProcess: restoreSwiperAndFixLayout,
|
|
4630
|
+
process: process$1,
|
|
4692
4631
|
});
|
|
4693
4632
|
|
|
4694
4633
|
/**
|
|
@@ -4772,7 +4711,7 @@ function getMaxWByDeviceType(deviceType) {
|
|
|
4772
4711
|
return `--maxw${getDeviceType(deviceType)}`;
|
|
4773
4712
|
}
|
|
4774
4713
|
// ─── Main fix ─────────────────────────────────────────────────────────────────
|
|
4775
|
-
function
|
|
4714
|
+
function afterProcess$1({ doc, targetWidth, deviceType }) {
|
|
4776
4715
|
doc.querySelectorAll(SLIDER_ITEM_SELECTOR).forEach((item) => {
|
|
4777
4716
|
const originalWidth = parseFloat(item.style.minWidth) || parseFloat(item.style.maxWidth) || 0;
|
|
4778
4717
|
if (!originalWidth)
|
|
@@ -4799,7 +4738,79 @@ register$1({
|
|
|
4799
4738
|
name: 'gp-v7-slider',
|
|
4800
4739
|
description: 'GemPages v7 slider: rescale .gem-slider-item min/max-width and translate3d X to match targetWidth',
|
|
4801
4740
|
shouldApply: ({ doc }) => !!doc.querySelector('.gem-slider-item'),
|
|
4802
|
-
afterProcess:
|
|
4741
|
+
afterProcess: afterProcess$1,
|
|
4742
|
+
});
|
|
4743
|
+
|
|
4744
|
+
const HERO_BANNER_SELECTOR = '#MainContent .hero-wrapper .hero';
|
|
4745
|
+
const shouldApply = ({ doc }) => !!doc.querySelector(HERO_BANNER_SELECTOR);
|
|
4746
|
+
// ─── Helpers ──────────────────────────────────────────────────────────────────
|
|
4747
|
+
/** Parse a raw CSS value like "65svh" → 65. Returns null if not svh. */
|
|
4748
|
+
function parseSvhPct(value) {
|
|
4749
|
+
const match = value.trim().match(/^([\d.]+)svh$/i);
|
|
4750
|
+
return match ? parseFloat(match[1]) : null;
|
|
4751
|
+
}
|
|
4752
|
+
/**
|
|
4753
|
+
* Get an svh percentage from a CSS property on an element.
|
|
4754
|
+
* If the inline value is a `var(--xxx)` reference, resolve it via getComputedStyle.
|
|
4755
|
+
*/
|
|
4756
|
+
function resolveSvhPct(hero, cssProp, win) {
|
|
4757
|
+
let value = hero.style.getPropertyValue(cssProp).trim();
|
|
4758
|
+
// Inline value is a var() reference → resolve via computed style
|
|
4759
|
+
if (value.startsWith('var(')) {
|
|
4760
|
+
const varName = value.match(/var\(\s*(--[\w-]+)/)?.[1];
|
|
4761
|
+
if (varName) {
|
|
4762
|
+
value = win.getComputedStyle(hero).getPropertyValue(varName).trim();
|
|
4763
|
+
}
|
|
4764
|
+
}
|
|
4765
|
+
return parseSvhPct(value);
|
|
4766
|
+
}
|
|
4767
|
+
function applyHeight(hero, px) {
|
|
4768
|
+
// hero.style.setProperty('height', px, 'important');
|
|
4769
|
+
hero.style.setProperty('min-height', px, 'important');
|
|
4770
|
+
}
|
|
4771
|
+
// ─── Main fix ─────────────────────────────────────────────────────────────────
|
|
4772
|
+
/**
|
|
4773
|
+
* Hero banners that use `svh` for height are sized against the browser viewport
|
|
4774
|
+
* (`win.innerHeight`), not against our `targetHeight`. This fix converts the svh
|
|
4775
|
+
* value to the correct pixel value based on `targetHeight`.
|
|
4776
|
+
*
|
|
4777
|
+
* Two cases:
|
|
4778
|
+
* 1. Inline style still contains a raw `svh` value → direct conversion.
|
|
4779
|
+
* 2. Cross-origin CSS (not processable by viewport-unit-replacer); the browser
|
|
4780
|
+
* has already resolved `svh` to px using `win.innerHeight` → rescale by ratio.
|
|
4781
|
+
*/
|
|
4782
|
+
function afterProcess({ doc, win, targetHeight }) {
|
|
4783
|
+
const browserViewportHeight = win.innerHeight || doc.documentElement.clientHeight;
|
|
4784
|
+
try {
|
|
4785
|
+
const heroBanners = doc.querySelectorAll(HERO_BANNER_SELECTOR);
|
|
4786
|
+
const listHero = Array.from(heroBanners);
|
|
4787
|
+
listHero.forEach((hero) => {
|
|
4788
|
+
// Case 1: inline style has a raw svh value or a var() reference resolving to svh
|
|
4789
|
+
const svhPct = resolveSvhPct(hero, '--hero-min-height', win);
|
|
4790
|
+
if (svhPct !== null) {
|
|
4791
|
+
const newHeight = `${((svhPct / 100) * targetHeight).toFixed(2)}px`;
|
|
4792
|
+
applyHeight(hero, newHeight);
|
|
4793
|
+
return;
|
|
4794
|
+
}
|
|
4795
|
+
// Case 2: browser already resolved svh → px via win.innerHeight, rescale
|
|
4796
|
+
if (!browserViewportHeight || browserViewportHeight === targetHeight)
|
|
4797
|
+
return;
|
|
4798
|
+
const browserMinHeight = parseFloat(win.getComputedStyle(hero).minHeight);
|
|
4799
|
+
if (!browserMinHeight || isNaN(browserMinHeight))
|
|
4800
|
+
return;
|
|
4801
|
+
applyHeight(hero, `${((browserMinHeight / browserViewportHeight) * targetHeight).toFixed(2)}px`);
|
|
4802
|
+
});
|
|
4803
|
+
}
|
|
4804
|
+
catch (error) {
|
|
4805
|
+
console.error(`Hero banner: afterProcess:`, error);
|
|
4806
|
+
}
|
|
4807
|
+
}
|
|
4808
|
+
|
|
4809
|
+
register$1({
|
|
4810
|
+
name: 'theme-dawn-hero-banner',
|
|
4811
|
+
description: 'Shopify hero banner: height image is svh',
|
|
4812
|
+
shouldApply,
|
|
4813
|
+
afterProcess,
|
|
4803
4814
|
});
|
|
4804
4815
|
|
|
4805
4816
|
const logger$3 = createLogger({ enabled: false, prefix: 'ViewportReplacer' });
|
|
@@ -4847,7 +4858,6 @@ function configure(debug) {
|
|
|
4847
4858
|
logger$2.configure({ enabled: debug });
|
|
4848
4859
|
}
|
|
4849
4860
|
async function run$1(ctx, activeGlobal, shopFix) {
|
|
4850
|
-
console.log(`🚀 🐥 ~ run ~ ctx:`, ctx);
|
|
4851
4861
|
// ── Phase 1: beforeProcess ────────────────────────────────────────────────
|
|
4852
4862
|
for (const fix of activeGlobal) {
|
|
4853
4863
|
if (fix.beforeProcess) {
|
package/dist/esm/index.mjs
CHANGED
|
@@ -4604,7 +4604,7 @@ async function processLinkedStylesheets(ctx) {
|
|
|
4604
4604
|
return count;
|
|
4605
4605
|
}
|
|
4606
4606
|
// ─── Public entry point ───────────────────────────────────────────────────────
|
|
4607
|
-
async function
|
|
4607
|
+
async function process$1(ctx) {
|
|
4608
4608
|
logger$4.configure({ enabled: !!ctx.debug });
|
|
4609
4609
|
// Reset tracking state from any previous run
|
|
4610
4610
|
elementsWithViewportUnits = new Set();
|
|
@@ -4627,68 +4627,7 @@ async function processViewportUnits(ctx) {
|
|
|
4627
4627
|
register$1({
|
|
4628
4628
|
name: 'viewport-unit-replacer',
|
|
4629
4629
|
description: 'Core: convert vh/vw/svh/dvh/% to px values across all iframe CSS',
|
|
4630
|
-
process:
|
|
4631
|
-
});
|
|
4632
|
-
|
|
4633
|
-
/**
|
|
4634
|
-
* GemPages Swiper Fix
|
|
4635
|
-
*
|
|
4636
|
-
* Issue: GemPages Swiper slides use `height: 100vh` internally. After viewport
|
|
4637
|
-
* unit conversion, inactive slides retain their converted height but are not
|
|
4638
|
-
* positioned correctly, causing the page height to be over-calculated.
|
|
4639
|
-
*
|
|
4640
|
-
* Fix:
|
|
4641
|
-
* - beforeProcess: lock swiper containers to a fixed height so conversion
|
|
4642
|
-
* doesn't affect their layout.
|
|
4643
|
-
* - afterProcess: ensure only the active slide is visible and the swiper
|
|
4644
|
-
* wrapper height matches the container.
|
|
4645
|
-
*/
|
|
4646
|
-
const SWIPER_CONTAINER_SELECTOR = '.gp-swiper, [data-gp-element="slider"]';
|
|
4647
|
-
const SWIPER_WRAPPER_SELECTOR = '.swiper-wrapper';
|
|
4648
|
-
const SWIPER_SLIDE_SELECTOR = '.swiper-slide';
|
|
4649
|
-
const SWIPER_SLIDE_ACTIVE_SELECTOR = '.swiper-slide-active';
|
|
4650
|
-
const lockedSwipers = [];
|
|
4651
|
-
function lockSwiperHeights({ doc, targetHeight }) {
|
|
4652
|
-
lockedSwipers.length = 0;
|
|
4653
|
-
doc.querySelectorAll(SWIPER_CONTAINER_SELECTOR).forEach((container) => {
|
|
4654
|
-
lockedSwipers.push({ container, originalHeight: container.style.height });
|
|
4655
|
-
container.style.setProperty('height', `${targetHeight}px`, 'important');
|
|
4656
|
-
});
|
|
4657
|
-
}
|
|
4658
|
-
function restoreSwiperAndFixLayout({ doc }) {
|
|
4659
|
-
// Restore original heights
|
|
4660
|
-
lockedSwipers.forEach(({ container, originalHeight }) => {
|
|
4661
|
-
container.style.removeProperty('height');
|
|
4662
|
-
if (originalHeight)
|
|
4663
|
-
container.style.height = originalHeight;
|
|
4664
|
-
});
|
|
4665
|
-
lockedSwipers.length = 0;
|
|
4666
|
-
// Ensure inactive slides don't bleed into layout
|
|
4667
|
-
doc.querySelectorAll(SWIPER_CONTAINER_SELECTOR).forEach((container) => {
|
|
4668
|
-
const wrapper = container.querySelector(SWIPER_WRAPPER_SELECTOR);
|
|
4669
|
-
const activeSlide = container.querySelector(SWIPER_SLIDE_ACTIVE_SELECTOR);
|
|
4670
|
-
const allSlides = container.querySelectorAll(SWIPER_SLIDE_SELECTOR);
|
|
4671
|
-
// Hide all inactive slides from layout flow
|
|
4672
|
-
allSlides.forEach((slide) => {
|
|
4673
|
-
if (slide !== activeSlide) {
|
|
4674
|
-
slide.style.setProperty('visibility', 'hidden', 'important');
|
|
4675
|
-
slide.style.setProperty('position', 'absolute', 'important');
|
|
4676
|
-
}
|
|
4677
|
-
});
|
|
4678
|
-
// Sync wrapper height to active slide
|
|
4679
|
-
if (wrapper && activeSlide) {
|
|
4680
|
-
wrapper.style.setProperty('height', `${activeSlide.offsetHeight}px`, 'important');
|
|
4681
|
-
}
|
|
4682
|
-
});
|
|
4683
|
-
}
|
|
4684
|
-
|
|
4685
|
-
register$1({
|
|
4686
|
-
name: 'gempages-swiper',
|
|
4687
|
-
description: 'GemPages Swiper slides use 100vh causing layout height inflation',
|
|
4688
|
-
shouldApply: ({ doc }) => !!doc.querySelector('.gp-swiper, [data-gp-element="slider"]'),
|
|
4689
|
-
extraIgnoreSelectors: ['.swiper-slide:not(.swiper-slide-active)'],
|
|
4690
|
-
beforeProcess: lockSwiperHeights,
|
|
4691
|
-
afterProcess: restoreSwiperAndFixLayout,
|
|
4630
|
+
process: process$1,
|
|
4692
4631
|
});
|
|
4693
4632
|
|
|
4694
4633
|
/**
|
|
@@ -4772,7 +4711,7 @@ function getMaxWByDeviceType(deviceType) {
|
|
|
4772
4711
|
return `--maxw${getDeviceType(deviceType)}`;
|
|
4773
4712
|
}
|
|
4774
4713
|
// ─── Main fix ─────────────────────────────────────────────────────────────────
|
|
4775
|
-
function
|
|
4714
|
+
function afterProcess$1({ doc, targetWidth, deviceType }) {
|
|
4776
4715
|
doc.querySelectorAll(SLIDER_ITEM_SELECTOR).forEach((item) => {
|
|
4777
4716
|
const originalWidth = parseFloat(item.style.minWidth) || parseFloat(item.style.maxWidth) || 0;
|
|
4778
4717
|
if (!originalWidth)
|
|
@@ -4799,7 +4738,79 @@ register$1({
|
|
|
4799
4738
|
name: 'gp-v7-slider',
|
|
4800
4739
|
description: 'GemPages v7 slider: rescale .gem-slider-item min/max-width and translate3d X to match targetWidth',
|
|
4801
4740
|
shouldApply: ({ doc }) => !!doc.querySelector('.gem-slider-item'),
|
|
4802
|
-
afterProcess:
|
|
4741
|
+
afterProcess: afterProcess$1,
|
|
4742
|
+
});
|
|
4743
|
+
|
|
4744
|
+
const HERO_BANNER_SELECTOR = '#MainContent .hero-wrapper .hero';
|
|
4745
|
+
const shouldApply = ({ doc }) => !!doc.querySelector(HERO_BANNER_SELECTOR);
|
|
4746
|
+
// ─── Helpers ──────────────────────────────────────────────────────────────────
|
|
4747
|
+
/** Parse a raw CSS value like "65svh" → 65. Returns null if not svh. */
|
|
4748
|
+
function parseSvhPct(value) {
|
|
4749
|
+
const match = value.trim().match(/^([\d.]+)svh$/i);
|
|
4750
|
+
return match ? parseFloat(match[1]) : null;
|
|
4751
|
+
}
|
|
4752
|
+
/**
|
|
4753
|
+
* Get an svh percentage from a CSS property on an element.
|
|
4754
|
+
* If the inline value is a `var(--xxx)` reference, resolve it via getComputedStyle.
|
|
4755
|
+
*/
|
|
4756
|
+
function resolveSvhPct(hero, cssProp, win) {
|
|
4757
|
+
let value = hero.style.getPropertyValue(cssProp).trim();
|
|
4758
|
+
// Inline value is a var() reference → resolve via computed style
|
|
4759
|
+
if (value.startsWith('var(')) {
|
|
4760
|
+
const varName = value.match(/var\(\s*(--[\w-]+)/)?.[1];
|
|
4761
|
+
if (varName) {
|
|
4762
|
+
value = win.getComputedStyle(hero).getPropertyValue(varName).trim();
|
|
4763
|
+
}
|
|
4764
|
+
}
|
|
4765
|
+
return parseSvhPct(value);
|
|
4766
|
+
}
|
|
4767
|
+
function applyHeight(hero, px) {
|
|
4768
|
+
// hero.style.setProperty('height', px, 'important');
|
|
4769
|
+
hero.style.setProperty('min-height', px, 'important');
|
|
4770
|
+
}
|
|
4771
|
+
// ─── Main fix ─────────────────────────────────────────────────────────────────
|
|
4772
|
+
/**
|
|
4773
|
+
* Hero banners that use `svh` for height are sized against the browser viewport
|
|
4774
|
+
* (`win.innerHeight`), not against our `targetHeight`. This fix converts the svh
|
|
4775
|
+
* value to the correct pixel value based on `targetHeight`.
|
|
4776
|
+
*
|
|
4777
|
+
* Two cases:
|
|
4778
|
+
* 1. Inline style still contains a raw `svh` value → direct conversion.
|
|
4779
|
+
* 2. Cross-origin CSS (not processable by viewport-unit-replacer); the browser
|
|
4780
|
+
* has already resolved `svh` to px using `win.innerHeight` → rescale by ratio.
|
|
4781
|
+
*/
|
|
4782
|
+
function afterProcess({ doc, win, targetHeight }) {
|
|
4783
|
+
const browserViewportHeight = win.innerHeight || doc.documentElement.clientHeight;
|
|
4784
|
+
try {
|
|
4785
|
+
const heroBanners = doc.querySelectorAll(HERO_BANNER_SELECTOR);
|
|
4786
|
+
const listHero = Array.from(heroBanners);
|
|
4787
|
+
listHero.forEach((hero) => {
|
|
4788
|
+
// Case 1: inline style has a raw svh value or a var() reference resolving to svh
|
|
4789
|
+
const svhPct = resolveSvhPct(hero, '--hero-min-height', win);
|
|
4790
|
+
if (svhPct !== null) {
|
|
4791
|
+
const newHeight = `${((svhPct / 100) * targetHeight).toFixed(2)}px`;
|
|
4792
|
+
applyHeight(hero, newHeight);
|
|
4793
|
+
return;
|
|
4794
|
+
}
|
|
4795
|
+
// Case 2: browser already resolved svh → px via win.innerHeight, rescale
|
|
4796
|
+
if (!browserViewportHeight || browserViewportHeight === targetHeight)
|
|
4797
|
+
return;
|
|
4798
|
+
const browserMinHeight = parseFloat(win.getComputedStyle(hero).minHeight);
|
|
4799
|
+
if (!browserMinHeight || isNaN(browserMinHeight))
|
|
4800
|
+
return;
|
|
4801
|
+
applyHeight(hero, `${((browserMinHeight / browserViewportHeight) * targetHeight).toFixed(2)}px`);
|
|
4802
|
+
});
|
|
4803
|
+
}
|
|
4804
|
+
catch (error) {
|
|
4805
|
+
console.error(`Hero banner: afterProcess:`, error);
|
|
4806
|
+
}
|
|
4807
|
+
}
|
|
4808
|
+
|
|
4809
|
+
register$1({
|
|
4810
|
+
name: 'theme-dawn-hero-banner',
|
|
4811
|
+
description: 'Shopify hero banner: height image is svh',
|
|
4812
|
+
shouldApply,
|
|
4813
|
+
afterProcess,
|
|
4803
4814
|
});
|
|
4804
4815
|
|
|
4805
4816
|
const logger$3 = createLogger({ enabled: false, prefix: 'ViewportReplacer' });
|
|
@@ -4847,7 +4858,6 @@ function configure(debug) {
|
|
|
4847
4858
|
logger$2.configure({ enabled: debug });
|
|
4848
4859
|
}
|
|
4849
4860
|
async function run$1(ctx, activeGlobal, shopFix) {
|
|
4850
|
-
console.log(`🚀 🐥 ~ run ~ ctx:`, ctx);
|
|
4851
4861
|
// ── Phase 1: beforeProcess ────────────────────────────────────────────────
|
|
4852
4862
|
for (const fix of activeGlobal) {
|
|
4853
4863
|
if (fix.beforeProcess) {
|
package/dist/esm/libs/iframe-processor/processors/viewport/global-fixes/global-fixes/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/libs/iframe-processor/processors/viewport/global-fixes/global-fixes/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* Converts vh/vw/svh/dvh/% to pixel values across all CSS in the iframe.
|
|
4
4
|
*/
|
|
5
5
|
import type { ViewportFixContext } from '../../types';
|
|
6
|
-
export declare function
|
|
6
|
+
export declare function process(ctx: ViewportFixContext): Promise<void>;
|
|
7
7
|
//# sourceMappingURL=fixes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixes.d.ts","sourceRoot":"","sources":["../../../../../../../../src/libs/iframe-processor/processors/viewport/global-fixes/global-fixes/viewport-unit-replacer/fixes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAmNtD,wBAAsB,OAAO,CAAC,GAAG,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBpE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/libs/iframe-processor/processors/viewport/global-fixes/fixes/viewport-unit-replacer/index.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/libs/iframe-processor/processors/viewport/global-fixes/global-fixes/viewport-unit-replacer/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixes.d.ts","sourceRoot":"","sources":["../../../../../../../../src/libs/iframe-processor/processors/viewport/global-fixes/gp-v7-fixes/gem-slider-item/fixes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AA0FtD,wBAAgB,YAAY,CAAC,EAAE,GAAG,EAAE,WAAW,EAAE,UAAU,EAAE,EAAE,kBAAkB,GAAG,IAAI,CAyBvF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/libs/iframe-processor/processors/viewport/global-fixes/
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/libs/iframe-processor/processors/viewport/global-fixes/gp-v7-fixes/gem-slider-item/index.ts"],"names":[],"mappings":""}
|
package/dist/esm/libs/iframe-processor/processors/viewport/global-fixes/gp-v7-fixes/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/libs/iframe-processor/processors/viewport/global-fixes/gp-v7-fixes/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
* 2. Create fixes/{name}/index.ts and call register()
|
|
9
9
|
* 3. Import it here (one line below)
|
|
10
10
|
*/
|
|
11
|
-
import './fixes
|
|
12
|
-
import './fixes
|
|
13
|
-
import './fixes
|
|
14
|
-
export * from './types';
|
|
11
|
+
import './global-fixes';
|
|
12
|
+
import './gp-v7-fixes';
|
|
13
|
+
import './shopify-fixes';
|
|
15
14
|
export * from './registry';
|
|
15
|
+
export * from './types';
|
|
16
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/iframe-processor/processors/viewport/global-fixes/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/iframe-processor/processors/viewport/global-fixes/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,gBAAgB,CAAC;AAGxB,OAAO,eAAe,CAAC;AAGvB,OAAO,iBAAiB,CAAC;AAGzB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
|
package/dist/esm/libs/iframe-processor/processors/viewport/global-fixes/shopify-fixes/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/libs/iframe-processor/processors/viewport/global-fixes/shopify-fixes/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ViewportFixContext } from '../../types';
|
|
2
|
+
export declare const shouldApply: ({ doc }: ViewportFixContext) => boolean;
|
|
3
|
+
/**
|
|
4
|
+
* Hero banners that use `svh` for height are sized against the browser viewport
|
|
5
|
+
* (`win.innerHeight`), not against our `targetHeight`. This fix converts the svh
|
|
6
|
+
* value to the correct pixel value based on `targetHeight`.
|
|
7
|
+
*
|
|
8
|
+
* Two cases:
|
|
9
|
+
* 1. Inline style still contains a raw `svh` value → direct conversion.
|
|
10
|
+
* 2. Cross-origin CSS (not processable by viewport-unit-replacer); the browser
|
|
11
|
+
* has already resolved `svh` to px using `win.innerHeight` → rescale by ratio.
|
|
12
|
+
*/
|
|
13
|
+
export declare function afterProcess({ doc, win, targetHeight }: ViewportFixContext): void;
|
|
14
|
+
//# sourceMappingURL=hero-banner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hero-banner.d.ts","sourceRoot":"","sources":["../../../../../../../../src/libs/iframe-processor/processors/viewport/global-fixes/shopify-fixes/theme-dawn/hero-banner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAItD,eAAO,MAAM,WAAW,GAAI,SAAS,kBAAkB,KAAG,OAAoD,CAAC;AAmC/G;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,YAAY,EAAE,EAAE,kBAAkB,GAAG,IAAI,CA0BjF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/libs/iframe-processor/processors/viewport/global-fixes/fixes/
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/libs/iframe-processor/processors/viewport/global-fixes/shopify-fixes/theme-dawn/index.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../../../../src/libs/iframe-processor/processors/viewport/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAOxD,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAE9C;AAED,wBAAsB,GAAG,CACvB,GAAG,EAAE,kBAAkB,EACvB,YAAY,EAAE,SAAS,SAAS,EAAE,EAClC,OAAO,EAAE,eAAe,GAAG,IAAI,GAC9B,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../../../../src/libs/iframe-processor/processors/viewport/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAOxD,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAE9C;AAED,wBAAsB,GAAG,CACvB,GAAG,EAAE,kBAAkB,EACvB,YAAY,EAAE,SAAS,SAAS,EAAE,EAClC,OAAO,EAAE,eAAe,GAAG,IAAI,GAC9B,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CA8D5C"}
|