unframer 3.1.0 → 3.2.1

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.
Files changed (80) hide show
  1. package/dist/cli.d.ts.map +1 -1
  2. package/dist/cli.js +3 -0
  3. package/dist/cli.js.map +1 -1
  4. package/dist/exporter.d.ts +2 -1
  5. package/dist/exporter.d.ts.map +1 -1
  6. package/dist/exporter.js +76 -31
  7. package/dist/exporter.js.map +1 -1
  8. package/dist/framer-chunks/fontshare-2X4LZ75B-D2V5BX73.d.ts +634 -0
  9. package/dist/framer-chunks/fontshare-2X4LZ75B-D2V5BX73.d.ts.map +1 -0
  10. package/dist/framer-chunks/fontshare-2X4LZ75B-D2V5BX73.js +8 -0
  11. package/dist/framer-chunks/fontshare-2X4LZ75B-D2V5BX73.js.map +1 -0
  12. package/dist/framer-chunks/fontshare-EOIRPPWV-VDFFNW4K.d.ts +115 -0
  13. package/dist/framer-chunks/fontshare-EOIRPPWV-VDFFNW4K.d.ts.map +1 -0
  14. package/dist/framer-chunks/fontshare-EOIRPPWV-VDFFNW4K.js +8 -0
  15. package/dist/framer-chunks/fontshare-EOIRPPWV-VDFFNW4K.js.map +1 -0
  16. package/dist/framer-chunks/fontshare-Y53BJZLK-EUQIV252.d.ts +781 -0
  17. package/dist/framer-chunks/fontshare-Y53BJZLK-EUQIV252.d.ts.map +1 -0
  18. package/dist/framer-chunks/fontshare-Y53BJZLK-EUQIV252.js +8 -0
  19. package/dist/framer-chunks/fontshare-Y53BJZLK-EUQIV252.js.map +1 -0
  20. package/dist/framer-chunks/google-2KFYDWCN-PJC2DDXK.d.ts +1566 -0
  21. package/dist/framer-chunks/google-2KFYDWCN-PJC2DDXK.d.ts.map +1 -0
  22. package/dist/framer-chunks/google-2KFYDWCN-PJC2DDXK.js +8 -0
  23. package/dist/framer-chunks/google-2KFYDWCN-PJC2DDXK.js.map +1 -0
  24. package/dist/framer-chunks/google-HSMCYMMG-DWNQGSHN.d.ts +10293 -0
  25. package/dist/framer-chunks/google-HSMCYMMG-DWNQGSHN.d.ts.map +1 -0
  26. package/dist/framer-chunks/google-HSMCYMMG-DWNQGSHN.js +8 -0
  27. package/dist/framer-chunks/google-HSMCYMMG-DWNQGSHN.js.map +1 -0
  28. package/dist/framer-chunks/google-S367OFIE-AWJEPMSF.d.ts +3588 -0
  29. package/dist/framer-chunks/google-S367OFIE-AWJEPMSF.d.ts.map +1 -0
  30. package/dist/framer-chunks/google-S367OFIE-AWJEPMSF.js +8 -0
  31. package/dist/framer-chunks/google-S367OFIE-AWJEPMSF.js.map +1 -0
  32. package/dist/framer.js +199 -107
  33. package/dist/version.d.ts +1 -1
  34. package/dist/version.js +1 -1
  35. package/esm/cli.d.ts.map +1 -1
  36. package/esm/cli.js +3 -0
  37. package/esm/cli.js.map +1 -1
  38. package/esm/exporter.d.ts +2 -1
  39. package/esm/exporter.d.ts.map +1 -1
  40. package/esm/exporter.js +77 -32
  41. package/esm/exporter.js.map +1 -1
  42. package/esm/framer-chunks/fontshare-2X4LZ75B-D2V5BX73.d.ts +634 -0
  43. package/esm/framer-chunks/fontshare-2X4LZ75B-D2V5BX73.d.ts.map +1 -0
  44. package/esm/framer-chunks/fontshare-2X4LZ75B-D2V5BX73.js +5 -0
  45. package/esm/framer-chunks/fontshare-2X4LZ75B-D2V5BX73.js.map +1 -0
  46. package/esm/framer-chunks/fontshare-EOIRPPWV-VDFFNW4K.d.ts +115 -0
  47. package/esm/framer-chunks/fontshare-EOIRPPWV-VDFFNW4K.d.ts.map +1 -0
  48. package/esm/framer-chunks/fontshare-EOIRPPWV-VDFFNW4K.js +5 -0
  49. package/esm/framer-chunks/fontshare-EOIRPPWV-VDFFNW4K.js.map +1 -0
  50. package/esm/framer-chunks/fontshare-Y53BJZLK-EUQIV252.d.ts +781 -0
  51. package/esm/framer-chunks/fontshare-Y53BJZLK-EUQIV252.d.ts.map +1 -0
  52. package/esm/framer-chunks/fontshare-Y53BJZLK-EUQIV252.js +5 -0
  53. package/esm/framer-chunks/fontshare-Y53BJZLK-EUQIV252.js.map +1 -0
  54. package/esm/framer-chunks/google-2KFYDWCN-PJC2DDXK.d.ts +1566 -0
  55. package/esm/framer-chunks/google-2KFYDWCN-PJC2DDXK.d.ts.map +1 -0
  56. package/esm/framer-chunks/google-2KFYDWCN-PJC2DDXK.js +5 -0
  57. package/esm/framer-chunks/google-2KFYDWCN-PJC2DDXK.js.map +1 -0
  58. package/esm/framer-chunks/google-HSMCYMMG-DWNQGSHN.d.ts +10293 -0
  59. package/esm/framer-chunks/google-HSMCYMMG-DWNQGSHN.d.ts.map +1 -0
  60. package/esm/framer-chunks/google-HSMCYMMG-DWNQGSHN.js +5 -0
  61. package/esm/framer-chunks/google-HSMCYMMG-DWNQGSHN.js.map +1 -0
  62. package/esm/framer-chunks/google-S367OFIE-AWJEPMSF.d.ts +3588 -0
  63. package/esm/framer-chunks/google-S367OFIE-AWJEPMSF.d.ts.map +1 -0
  64. package/esm/framer-chunks/google-S367OFIE-AWJEPMSF.js +5 -0
  65. package/esm/framer-chunks/google-S367OFIE-AWJEPMSF.js.map +1 -0
  66. package/esm/framer.js +199 -107
  67. package/esm/version.d.ts +1 -1
  68. package/esm/version.js +1 -1
  69. package/package.json +2 -2
  70. package/src/cli.ts +3 -0
  71. package/src/exporter.ts +101 -33
  72. package/src/framer-chunks/fontshare-2X4LZ75B-D2V5BX73.js +7 -0
  73. package/src/framer-chunks/fontshare-EOIRPPWV-VDFFNW4K.js +7 -0
  74. package/src/framer-chunks/fontshare-Y53BJZLK-EUQIV252.js +7 -0
  75. package/src/framer-chunks/google-2KFYDWCN-PJC2DDXK.js +7 -0
  76. package/src/framer-chunks/google-HSMCYMMG-DWNQGSHN.js +7 -0
  77. package/src/framer-chunks/google-S367OFIE-AWJEPMSF.js +7 -0
  78. package/src/framer.js +198 -111
  79. package/src/styles/framer.css +13 -12
  80. package/src/version.ts +1 -1
package/esm/framer.js CHANGED
@@ -10499,7 +10499,7 @@ function stagger(duration = 0.1, { startDelay = 0, from = 0, ease: ease2, } = {}
10499
10499
  return startDelay + delay2;
10500
10500
  };
10501
10501
  }
10502
- // /:https://app.framerstatic.com/framer.O23R7WUO.mjs
10502
+ // /:https://app.framerstatic.com/framer.ZNMFLOLI.mjs
10503
10503
  import { lazy as ReactLazy, } from 'react';
10504
10504
  import React4 from 'react';
10505
10505
  import { startTransition as startTransition2, } from 'react';
@@ -11971,33 +11971,10 @@ function useRouteHandler(routeId, preload = false, elementId) {
11971
11971
  const handler = React4.useCallback(() => navigate == null ? void 0 : navigate(routeId, elementId), [navigate, elementId, routeId,]);
11972
11972
  return handler;
11973
11973
  }
11974
- var timezone;
11975
- var visitorLocale;
11976
- function setTimezoneAndLocaleForTracking() {
11977
- const resolvedDateTimeOptions = Intl.DateTimeFormat().resolvedOptions();
11978
- timezone = resolvedDateTimeOptions.timeZone;
11979
- visitorLocale = resolvedDateTimeOptions.locale;
11980
- }
11981
- requestIdleCallback(setTimezoneAndLocaleForTracking);
11974
+ var pageviewEventVersion = 2;
11982
11975
  function sendTrackingEvent(eventType, eventData, sendOn = 'lazy') {
11983
- if (!safeWindow.__framer_events)
11984
- return;
11985
- if (!timezone || !visitorLocale)
11986
- setTimezoneAndLocaleForTracking();
11987
- safeWindow.__framer_events.push([eventType, {
11988
- // Base properties common to all events
11989
- referrer: null,
11990
- // The first pageview event will always be sent before hydration, in a script in `exportToHTML.ts`.
11991
- url: safeWindow.location.href,
11992
- hostname: safeWindow.location.hostname || null,
11993
- pathname: safeWindow.location.pathname || null,
11994
- hash: safeWindow.location.hash || null,
11995
- search: safeWindow.location.search || null,
11996
- timezone,
11997
- locale: visitorLocale,
11998
- // Additional properties specific to custom events
11999
- ...eventData,
12000
- }, sendOn,]);
11976
+ var _a;
11977
+ (_a = safeWindow.__framer_events) == null ? void 0 : _a.push([eventType, eventData, sendOn,]);
12001
11978
  switch (eventType) {
12002
11979
  case 'published_site_click': {
12003
11980
  const { trackingId, href, } = eventData;
@@ -12901,7 +12878,7 @@ function usePopStateHandler(currentRouteId, setCurrentRouteId) {
12901
12878
  const stopMonitoringINPRelatedInputs = monitorINPRelatedInputs();
12902
12879
  void nextRender.promise.finally(stopMonitoringINPRelatedInputs);
12903
12880
  const changeRoute = () => {
12904
- setCurrentRouteId(routeId, isString(localeId) ? localeId : void 0, isString(hash2) ? hash2 : void 0, isObject2(pathVariables) ? pathVariables : void 0, true, nextRender, false);
12881
+ setCurrentRouteId(routeId, isString(localeId) ? localeId : void 0, isString(hash2) ? hash2 : void 0, window.location.pathname + window.location.search + window.location.hash, isObject2(pathVariables) ? pathVariables : void 0, true, nextRender, false);
12905
12882
  };
12906
12883
  const viewTransition = await startViewTransition2(currentRouteId.current, routeId, changeRoute);
12907
12884
  const navigationTransition = (_d = window.navigation) == null ? void 0 : _d.transition;
@@ -18375,8 +18352,14 @@ var DimensionType = /* @__PURE__ */ ((DimensionType2) => {
18375
18352
  DimensionType2[DimensionType2['Auto'] = 2] = 'Auto';
18376
18353
  DimensionType2[DimensionType2['FractionOfFreeSpace'] = 3] = 'FractionOfFreeSpace';
18377
18354
  DimensionType2[DimensionType2['Viewport'] = 4] = 'Viewport';
18355
+ DimensionType2[DimensionType2['FitImage'] = 5] = 'FitImage';
18378
18356
  return DimensionType2;
18379
18357
  })(DimensionType || {});
18358
+ function isAutoDimensionType(dimensionType) {
18359
+ if (isUndefined(dimensionType))
18360
+ return false;
18361
+ return dimensionType === 2 || dimensionType === 5;
18362
+ }
18380
18363
  function isConstraintSupportingChild(child) {
18381
18364
  if (!isReactChild(child) || !isReactElement(child)) {
18382
18365
  return false;
@@ -18387,7 +18370,7 @@ var ConstraintMask = {
18387
18370
  // Modifies the constraint mask to remove invalid (mutually exclusive) options and returns the original.
18388
18371
  // TODO: this removes major inconsistencies but probably needs to be merged with ConstraintSolver.
18389
18372
  quickfix: (constraints) => {
18390
- if (constraints.widthType === 2 || constraints.heightType === 2) {
18373
+ if (isAutoDimensionType(constraints.widthType) || isAutoDimensionType(constraints.heightType)) {
18391
18374
  constraints.aspectRatio = null;
18392
18375
  }
18393
18376
  if (isFiniteNumber(constraints.aspectRatio)) {
@@ -18405,13 +18388,13 @@ var ConstraintMask = {
18405
18388
  }
18406
18389
  }
18407
18390
  if (constraints.left && constraints.right) {
18408
- if (constraints.fixedSize || constraints.widthType === 2 || isFiniteNumber(constraints.maxWidth)) {
18391
+ if (constraints.fixedSize || isAutoDimensionType(constraints.widthType) || isFiniteNumber(constraints.maxWidth)) {
18409
18392
  constraints.right = false;
18410
18393
  }
18411
18394
  constraints.widthType = 0;
18412
18395
  }
18413
18396
  if (constraints.top && constraints.bottom) {
18414
- if (constraints.fixedSize || constraints.heightType === 2 || isFiniteNumber(constraints.maxHeight)) {
18397
+ if (constraints.fixedSize || isAutoDimensionType(constraints.heightType) || isFiniteNumber(constraints.maxHeight)) {
18415
18398
  constraints.bottom = false;
18416
18399
  }
18417
18400
  constraints.heightType = 0;
@@ -18520,7 +18503,7 @@ var ConstraintValues = {
18520
18503
  if (parentWidth && isFiniteNumber(hOpposingPinsOffset)) {
18521
18504
  width = parentWidth - hOpposingPinsOffset;
18522
18505
  }
18523
- else if (autoSize && values.widthType === 2) {
18506
+ else if (autoSize && isAutoDimensionType(values.widthType)) {
18524
18507
  width = autoSize.width;
18525
18508
  }
18526
18509
  else if (isFiniteNumber(values.width)) {
@@ -18538,6 +18521,7 @@ var ConstraintValues = {
18538
18521
  }
18539
18522
  break;
18540
18523
  case 2:
18524
+ case 5:
18541
18525
  break;
18542
18526
  default:
18543
18527
  assertNever(values.widthType);
@@ -18547,7 +18531,7 @@ var ConstraintValues = {
18547
18531
  if (parentHeight && isFiniteNumber(vOpposingPinsOffset)) {
18548
18532
  height = parentHeight - vOpposingPinsOffset;
18549
18533
  }
18550
- else if (autoSize && values.heightType === 2) {
18534
+ else if (autoSize && isAutoDimensionType(values.heightType)) {
18551
18535
  height = autoSize.height;
18552
18536
  }
18553
18537
  else if (isFiniteNumber(values.height)) {
@@ -18565,6 +18549,7 @@ var ConstraintValues = {
18565
18549
  }
18566
18550
  break;
18567
18551
  case 2:
18552
+ case 5:
18568
18553
  break;
18569
18554
  default:
18570
18555
  assertNever(values.heightType);
@@ -19624,9 +19609,10 @@ var richTextCSSRules = /* @__PURE__ */ (() => [
19624
19609
  text-transform: var(--framer-blockquote-text-transform, var(--framer-link-text-transform, var(--framer-text-transform, none)));
19625
19610
  /* Cursor inherit to overwrite the user agent stylesheet on rich text links. */
19626
19611
  cursor: var(--framer-custom-cursors, pointer);
19627
- background-color: var(--framer-link-text-background-color, var(--framer-text-background-color, initial));
19628
- border-radius: var(--framer-link-text-background-radius, var(--framer-text-background-radius, initial));
19629
- padding: var(--framer-link-text-background-padding, var(--framer-text-background-padding, initial));
19612
+ /* Don't inherit background styles from any parent text style. */
19613
+ background-color: var(--framer-link-text-background-color, initial);
19614
+ border-radius: var(--framer-link-text-background-radius, initial);
19615
+ padding: var(--framer-link-text-background-padding, initial);
19630
19616
  }
19631
19617
  `,
19632
19618
  // Text decoration can't be applied to the nested spans of links because it breaks animations
@@ -19649,7 +19635,7 @@ var richTextCSSRules = /* @__PURE__ */ (() => [
19649
19635
  span.framer-text[data-nested-link],
19650
19636
  span.framer-text[data-nested-link] span.framer-text:not([data-text-fill]) {
19651
19637
  color: ${createRGBVariableFallbacks(['--framer-blockquote-text-color', '--framer-link-text-color', '--framer-text-color',], '#000')};
19652
- background-color: ${createRGBVariableFallbacks(['--framer-link-text-background-color', '--framer-text-background-color',], 'initial')};
19638
+ background-color: ${createRGBVariableFallbacks(['--framer-link-text-background-color',], 'initial')};
19653
19639
  }
19654
19640
  }
19655
19641
  `, /* css */
@@ -19765,9 +19751,9 @@ var richTextCSSRules = /* @__PURE__ */ (() => [
19765
19751
  color: var(--framer-link-current-text-color, var(--framer-link-text-color, var(--framer-text-color, #000)));
19766
19752
  font-size: calc(var(--framer-link-current-font-size, var(--framer-link-font-size, var(--framer-font-size, 16px))) * var(--framer-font-size-scale, 1));
19767
19753
  text-transform: var(--framer-link-current-text-transform, var(--framer-link-text-transform, var(--framer-text-transform, none)));
19768
- background-color: var(--framer-link-current-text-background-color, var(--framer-link-text-background-color, var(--framer-text-background-color, initial)));
19769
- border-radius: var(--framer-link-current-text-background-radius, var(--framer-link-text-background-radius, var(--framer-text-background-radius, initial)));
19770
- padding: var(--framer-link-current-text-background-padding, var(--framer-link-text-background-padding, var(--framer-text-background-padding, initial)));
19754
+ background-color: var(--framer-link-current-text-background-color, var(--framer-link-text-background-color, initial));
19755
+ border-radius: var(--framer-link-current-text-background-radius, var(--framer-link-text-background-radius, initial));
19756
+ padding: var(--framer-link-current-text-background-padding, var(--framer-link-text-background-padding, initial));
19771
19757
  }
19772
19758
  `, /* css */
19773
19759
  `
@@ -19839,9 +19825,9 @@ var richTextCSSRules = /* @__PURE__ */ (() => [
19839
19825
  color: var(--framer-link-hover-text-color, var(--framer-link-current-text-color, var(--framer-link-text-color, var(--framer-text-color, #000))));
19840
19826
  font-size: calc(var(--framer-link-hover-font-size, var(--framer-link-current-font-size, var(--framer-link-font-size, var(--framer-font-size, 16px)))) * var(--framer-font-size-scale, 1));
19841
19827
  text-transform: var(--framer-link-hover-text-transform, var(--framer-link-current-text-transform, var(--framer-link-text-transform, var(--framer-text-transform, none))));
19842
- background-color: var(--framer-link-hover-text-background-color, var(--framer-link-current-text-background-color, var(--framer-link-text-background-color, var(--framer-text-background-color, initial))));
19843
- border-radius: var(--framer-link-hover-text-background-radius, var(--framer-link-current-text-background-radius, var(--framer-link-text-background-radius, var(--framer-text-background-radius, initial))));
19844
- padding: var(--framer-link-hover-text-background-padding, var(--framer-link-current-text-background-padding, var(--framer-link-text-background-padding, var(--framer-text-background-padding, initial))));
19828
+ background-color: var(--framer-link-hover-text-background-color, var(--framer-link-current-text-background-color, var(--framer-link-text-background-color, initial)));
19829
+ border-radius: var(--framer-link-hover-text-background-radius, var(--framer-link-current-text-background-radius, var(--framer-link-text-background-radius, initial)));
19830
+ padding: var(--framer-link-hover-text-background-padding, var(--framer-link-current-text-background-padding, var(--framer-link-text-background-padding, initial)));
19845
19831
  }
19846
19832
  `, /* css */
19847
19833
  `
@@ -19872,7 +19858,6 @@ var richTextCSSRules = /* @__PURE__ */ (() => [
19872
19858
  '--framer-link-hover-text-background-color',
19873
19859
  '--framer-link-current-text-background-color',
19874
19860
  '--framer-link-text-background-color',
19875
- '--framer-text-background-color',
19876
19861
  ], 'initial')};
19877
19862
  }
19878
19863
  }
@@ -19909,7 +19894,6 @@ var richTextCSSRules = /* @__PURE__ */ (() => [
19909
19894
  '--framer-link-hover-text-background-color',
19910
19895
  '--framer-link-current-text-background-color',
19911
19896
  '--framer-link-text-background-color',
19912
- '--framer-text-background-color',
19913
19897
  ], 'initial')};
19914
19898
  }
19915
19899
  }
@@ -22430,7 +22414,7 @@ var BackgroundImage = {
22430
22414
  isImageObject: function (image) {
22431
22415
  if (!image || typeof image === 'string')
22432
22416
  return false;
22433
- return key in image;
22417
+ return typeof image === 'object' && key in image;
22434
22418
  },
22435
22419
  };
22436
22420
  function applyForwardOverrides(background, props) {
@@ -22465,6 +22449,37 @@ function backgroundImageFromProps(props) {
22465
22449
  }
22466
22450
  return applyForwardOverrides(backgroundImage, props);
22467
22451
  }
22452
+ function getIntrinsicSizeForBackgroundImage(background) {
22453
+ if (!background)
22454
+ return void 0;
22455
+ if (background.pixelHeight && background.pixelWidth) {
22456
+ return {
22457
+ width: background.pixelWidth,
22458
+ height: background.pixelHeight,
22459
+ };
22460
+ }
22461
+ return parseImageSizeFromSrc(background.src);
22462
+ }
22463
+ function parseImageSizeFromSrc(src) {
22464
+ if (!src)
22465
+ return void 0;
22466
+ let url;
22467
+ try {
22468
+ url = new URL(src);
22469
+ }
22470
+ catch {
22471
+ return void 0;
22472
+ }
22473
+ const width = url.searchParams.get('width');
22474
+ const height = url.searchParams.get('height');
22475
+ if (width && height) {
22476
+ return {
22477
+ width: parseInt(width),
22478
+ height: parseInt(height),
22479
+ };
22480
+ }
22481
+ return void 0;
22482
+ }
22468
22483
  function htmlElementAsMotionComponent(asElem) {
22469
22484
  return asElem && asElem !== 'search' && asElem !== 'slot' && asElem !== 'template' ? motion[asElem] : motion['div'];
22470
22485
  }
@@ -23572,6 +23587,11 @@ var VisibleFrame = /* @__PURE__ */ forwardRef(function VisibleFrame2(props, forw
23572
23587
  ],
23573
23588
  }), parentSize);
23574
23589
  const MotionComponent = htmlElementAsMotionComponent(props.as);
23590
+ const intrinsicSize = getIntrinsicSizeForBackgroundImage(backgroundImage);
23591
+ if (props.fitImageDimension && intrinsicSize) {
23592
+ currentStyle[props.fitImageDimension] = 'auto';
23593
+ currentStyle.aspectRatio = intrinsicSize.width / intrinsicSize.height;
23594
+ }
23575
23595
  return /* @__PURE__ */ jsxs(MotionComponent, {
23576
23596
  ...dataProps,
23577
23597
  ...motionProps,
@@ -32879,15 +32899,15 @@ function domWriteCreateUpdateSafeArea(safeAreaRef) {
32879
32899
  Object.assign(safeAreaRef.current.style, floatingPositionSafeAreaStyle(x, y, placement, anchorRect, calculatedRect));
32880
32900
  };
32881
32901
  }
32882
- function domWriteUpdatePosition(floatingPositionRef, position, rect) {
32902
+ function domWriteUpdatePosition(floatingPositionRef, position, rect, scrollX, scrollY) {
32883
32903
  if (!floatingPositionRef.current)
32884
32904
  return;
32885
32905
  Object.assign(floatingPositionRef.current.style, {
32886
32906
  position,
32887
32907
  visibility: 'visible',
32888
32908
  // Append "px" because we are assigning this object straight to style.
32889
- left: ((rect == null ? void 0 : rect.x) ?? 0) + (position === 'fixed' ? 0 : safeWindow.scrollX) + 'px',
32890
- top: ((rect == null ? void 0 : rect.y) ?? 0) + (position === 'fixed' ? 0 : safeWindow.scrollY) + 'px',
32909
+ left: ((rect == null ? void 0 : rect.x) ?? 0) + scrollX + 'px',
32910
+ top: ((rect == null ? void 0 : rect.y) ?? 0) + scrollY + 'px',
32891
32911
  });
32892
32912
  }
32893
32913
  var FloatingStackingContext = /* @__PURE__ */ (() => {
@@ -33014,13 +33034,14 @@ function Floating({ alignment, placement, safeArea, offsetX, offsetY, anchorRef,
33014
33034
  let elementRect;
33015
33035
  let safePlacement;
33016
33036
  let calculatedRect;
33017
- let scrolls;
33018
33037
  let latestEvent;
33019
33038
  let updateSafeArea;
33039
+ let scrollX = 0;
33040
+ let scrollY = 0;
33020
33041
  const onRender = () => {
33021
33042
  if (cleanupHasRun)
33022
33043
  return;
33023
- domWriteUpdatePosition(floatingPositionRef, position, calculatedRect);
33044
+ domWriteUpdatePosition(floatingPositionRef, position, calculatedRect, scrollX, scrollY);
33024
33045
  if (safeArea)
33025
33046
  updateSafeArea(anchorRect, calculatedRect, safePlacement, latestEvent);
33026
33047
  latestEvent = void 0;
@@ -33031,7 +33052,7 @@ function Floating({ alignment, placement, safeArea, offsetX, offsetY, anchorRef,
33031
33052
  onRender();
33032
33053
  }
33033
33054
  else {
33034
- domWriteUpdatePosition(floatingPositionRef, position, calculatedRect);
33055
+ domWriteUpdatePosition(floatingPositionRef, position, calculatedRect, scrollX, scrollY);
33035
33056
  }
33036
33057
  initialUpdateHasRun = true;
33037
33058
  };
@@ -33043,6 +33064,14 @@ function Floating({ alignment, placement, safeArea, offsetX, offsetY, anchorRef,
33043
33064
  const domReadUpdateSafePlacementAndRect = () => {
33044
33065
  if (!getSafePlacementRect || cleanupHasRun)
33045
33066
  return;
33067
+ if (position === 'fixed') {
33068
+ scrollX = 0;
33069
+ scrollY = 0;
33070
+ }
33071
+ else {
33072
+ scrollX = safeWindow.scrollX;
33073
+ scrollY = safeWindow.scrollY;
33074
+ }
33046
33075
  anchorRect = anchorRef.current.getBoundingClientRect();
33047
33076
  const safePlacementAndRect = getSafePlacementRect(anchorRect, elementRect);
33048
33077
  safePlacement = safePlacementAndRect[0];
@@ -34605,57 +34634,79 @@ function isSamePage(a, b) {
34605
34634
  return aPathVariables.length === bPathVariables.length &&
34606
34635
  Object.keys(aPathVariables).every((key7) => aPathVariables[key7] === bPathVariables[key7]);
34607
34636
  }
34608
- function getPageviewEventData({ abTestId, framerSiteId, routeId, routePath, collectionItemId, localeCode, }) {
34609
- return {
34610
- abTestId,
34611
- framerSiteId,
34612
- routePath: routePath || '/',
34613
- collectionItemId,
34614
- framerLocale: localeCode,
34615
- webPageId: routeId,
34616
- };
34637
+ var timezone = null;
34638
+ var visitorLocale = null;
34639
+ function setTimezoneAndLocaleForTracking() {
34640
+ const resolvedDateTimeOptions = Intl.DateTimeFormat().resolvedOptions();
34641
+ timezone = resolvedDateTimeOptions.timeZone;
34642
+ visitorLocale = resolvedDateTimeOptions.locale;
34617
34643
  }
34618
- var useSendPageView = (currentRoute, currentRouteId, currentPathVariables, collectionUtils, activeLocale) => {
34644
+ requestIdleCallback(setTimezoneAndLocaleForTracking);
34645
+ var useSendPageView = (currentRoute, currentRouteId, currentPathnameWithHash, currentPathVariables, collectionUtils, activeLocale) => {
34619
34646
  const framerSiteId = useContext(FormContext);
34620
34647
  const pageviewEventData = useRef3();
34621
34648
  const skipFirstPageView = useRef3(true);
34622
34649
  useEffect(() => {
34623
- const getFullPageviewEventData = async () => {
34624
- var _a;
34625
- let collectionItemId = null;
34626
- if ((currentRoute == null ? void 0 : currentRoute.collectionId) && collectionUtils && currentPathVariables) {
34627
- const utils = await ((_a = collectionUtils[currentRoute.collectionId]) == null ? void 0 : _a.call(collectionUtils));
34628
- const [slug,] = Object.values(currentPathVariables);
34629
- if (utils && typeof slug === 'string') {
34630
- collectionItemId = (await utils.getRecordIdBySlug(slug, activeLocale || void 0)) ?? null;
34631
- }
34632
- }
34633
- return getPageviewEventData({
34650
+ function getFullPageviewEventData() {
34651
+ if (!timezone || !visitorLocale)
34652
+ setTimezoneAndLocaleForTracking();
34653
+ const currentLocation = currentPathnameWithHash
34654
+ ? new URL(safeWindow.location.origin + currentPathnameWithHash)
34655
+ : safeWindow.location;
34656
+ const eventData = {
34657
+ version: pageviewEventVersion,
34634
34658
  abTestId: currentRoute == null ? void 0 : currentRoute.abTestId,
34635
34659
  framerSiteId: framerSiteId ?? null,
34636
34660
  // If we are in a variant route, let's use the variant ID as the route ID instead, so that the analytics panel will be able to show the correct tracking data.
34637
- routeId: (currentRoute == null ? void 0 : currentRoute.abTestingVariantId) ?? currentRouteId,
34638
- routePath: currentRoute == null ? void 0 : currentRoute.path,
34639
- collectionItemId,
34640
- localeCode: (activeLocale == null ? void 0 : activeLocale.code) || null,
34641
- });
34642
- };
34661
+ webPageId: (currentRoute == null ? void 0 : currentRoute.abTestingVariantId) ?? currentRouteId,
34662
+ routePath: (currentRoute == null ? void 0 : currentRoute.path) || '/',
34663
+ collectionItemId: null,
34664
+ framerLocale: (activeLocale == null ? void 0 : activeLocale.code) || null,
34665
+ referrer: null,
34666
+ // The first pageview event will always be sent before hydration, in a script in `exportToHTML.ts`.
34667
+ url: currentLocation.href,
34668
+ hostname: currentLocation.hostname,
34669
+ // Capture the current location before the user moves to a new page to prevent
34670
+ // tracking wrong pathnames due to a race condition caused by async operations
34671
+ // when resolving the collection item ID below
34672
+ pathname: currentLocation.pathname,
34673
+ search: currentLocation.search || null,
34674
+ hash: currentLocation.hash || null,
34675
+ timezone,
34676
+ locale: visitorLocale,
34677
+ };
34678
+ return (currentRoute == null ? void 0 : currentRoute.collectionId) && collectionUtils && currentPathVariables
34679
+ ? (async () => {
34680
+ var _a;
34681
+ let collectionItemId = null;
34682
+ const utils = currentRoute.collectionId &&
34683
+ (await ((_a = collectionUtils[currentRoute.collectionId]) == null ? void 0 : _a.call(collectionUtils)));
34684
+ const [slug,] = Object.values(currentPathVariables);
34685
+ if (utils && typeof slug === 'string') {
34686
+ collectionItemId = (await utils.getRecordIdBySlug(slug, activeLocale || void 0)) ?? null;
34687
+ }
34688
+ return {
34689
+ ...eventData,
34690
+ collectionItemId,
34691
+ };
34692
+ })()
34693
+ : eventData;
34694
+ }
34643
34695
  void (async () => {
34644
- const pageviewEventDataPromise = getFullPageviewEventData();
34645
- pageviewEventData.current = pageviewEventDataPromise;
34696
+ const eventDataOrPromise = pageviewEventData.current = getFullPageviewEventData();
34697
+ const eventData = eventDataOrPromise instanceof Promise ? await eventDataOrPromise : eventDataOrPromise;
34698
+ pageviewEventData.current = eventData;
34646
34699
  if (skipFirstPageView.current) {
34647
34700
  skipFirstPageView.current = false;
34648
- return;
34649
34701
  }
34650
- const eventData = await pageviewEventDataPromise;
34651
- pageviewEventData.current = eventData;
34652
- sendTrackingEvent('published_site_pageview', eventData, 'eager');
34702
+ else {
34703
+ sendTrackingEvent('published_site_pageview', eventData, 'eager');
34704
+ }
34653
34705
  })();
34654
34706
  const listener = async (event) => {
34655
34707
  if (event.persisted) {
34656
- const pageviewEventDataPromise = getFullPageviewEventData();
34657
- pageviewEventData.current = pageviewEventDataPromise;
34658
- const eventData = await getFullPageviewEventData();
34708
+ const eventDataOrPromise = pageviewEventData.current = getFullPageviewEventData();
34709
+ const eventData = eventDataOrPromise instanceof Promise ? await eventDataOrPromise : eventDataOrPromise;
34659
34710
  pageviewEventData.current = eventData;
34660
34711
  sendTrackingEvent('published_site_pageview', eventData, 'eager');
34661
34712
  }
@@ -34664,7 +34715,7 @@ var useSendPageView = (currentRoute, currentRouteId, currentPathVariables, colle
34664
34715
  return () => {
34665
34716
  window.removeEventListener('pageshow', listener);
34666
34717
  };
34667
- }, [currentRoute, currentRouteId, currentPathVariables, collectionUtils, activeLocale, framerSiteId,]);
34718
+ }, [currentRoute, currentRouteId, currentPathnameWithHash, currentPathVariables, collectionUtils, activeLocale, framerSiteId,]);
34668
34719
  return pageviewEventData;
34669
34720
  };
34670
34721
  var defaultLocaleId = 'default';
@@ -34767,6 +34818,7 @@ function Router({ defaultPageStyle, disableHistory, initialPathVariables, initia
34767
34818
  return (fn) => fn();
34768
34819
  }, [synchronousNavigationOnDesktop,]);
34769
34820
  const isInitialNavigationRef = useRef3(true);
34821
+ const currentPathnameWithHashRef = useRef3();
34770
34822
  const currentRouteRef = useRef3(initialRoute);
34771
34823
  const currentPathVariablesRef = useRef3(initialPathVariables);
34772
34824
  const currentLocaleIdRef = useRef3(initialLocaleId);
@@ -34852,12 +34904,13 @@ function Router({ defaultPageStyle, disableHistory, initialPathVariables, initia
34852
34904
  monitorNextPaintAfterRender,
34853
34905
  transitionFn,
34854
34906
  ]);
34855
- const setCurrentRouteId = useCallback((routeId, localeId, hash2, pathVariables, isHistoryTransition, nextRender, smoothScroll = false, updateURL) => {
34907
+ const setCurrentRouteId = useCallback((routeId, localeId, hash2, pathnameWithHash, pathVariables, isHistoryTransition, nextRender, smoothScroll = false, updateURL) => {
34856
34908
  isInitialNavigationRef.current = false;
34857
34909
  const currentRouteId2 = currentRouteRef.current;
34858
34910
  currentRouteRef.current = routeId;
34859
34911
  currentPathVariablesRef.current = pathVariables;
34860
34912
  currentLocaleIdRef.current = localeId;
34913
+ currentPathnameWithHashRef.current = pathnameWithHash;
34861
34914
  scheduleSideEffect(() => {
34862
34915
  updateScrollPosition(hash2, smoothScroll, isHistoryTransition);
34863
34916
  });
@@ -34943,14 +34996,26 @@ function Router({ defaultPageStyle, disableHistory, initialPathVariables, initia
34943
34996
  siteCanonicalURL,
34944
34997
  }, ignorePushStateWrapper);
34945
34998
  };
34946
- setCurrentRouteId(routeId, currentRouteLocaleId, routeElementId, pathVariables, false, nextRender, smoothScroll, disableHistory ? void 0 : updateURL);
34999
+ const pathnameWithHash = getSitePrefix(siteCanonicalURL) + getPathForRoute(newRoute, {
35000
+ currentRoutePath: currentRoute2 == null ? void 0 : currentRoute2.path,
35001
+ currentPathVariables: currentPathVariables2,
35002
+ hash: hash2,
35003
+ pathVariables,
35004
+ localeId: currentRouteLocaleId,
35005
+ preserveQueryParams,
35006
+ siteCanonicalURL,
35007
+ relative: false,
35008
+ // We need an absolute path for the hash
35009
+ });
35010
+ setCurrentRouteId(routeId, currentRouteLocaleId, routeElementId, pathnameWithHash, pathVariables, false, nextRender, smoothScroll, disableHistory ? void 0 : updateURL);
34947
35011
  }, [routes, setCurrentRouteId, disableHistory, preserveQueryParams, siteCanonicalURL, monitorNextPaintAfterRender,]);
34948
35012
  const getRoute = useGetRouteCallback(routes);
34949
35013
  const currentRouteId = currentRouteRef.current;
35014
+ const currentPathnameWithHash = currentPathnameWithHashRef.current;
34950
35015
  const currentPathVariables = currentPathVariablesRef.current;
34951
35016
  const currentRoute = routes[currentRouteId];
34952
35017
  const currentRoutePath = currentRoute == null ? void 0 : currentRoute.path;
34953
- const pageviewEventData = useSendPageView(currentRoute, currentRouteId, currentPathVariables, collectionUtils, activeLocale);
35018
+ const pageviewEventData = useSendPageView(currentRoute, currentRouteId, currentPathnameWithHash, currentPathVariables, collectionUtils, activeLocale);
34954
35019
  const isInitialNavigation = isInitialNavigationRef.current;
34955
35020
  const api = useMemo2(() => ({
34956
35021
  navigate,
@@ -35003,7 +35068,7 @@ function Router({ defaultPageStyle, disableHistory, initialPathVariables, initia
35003
35068
  /* @__PURE__ */ jsx3(MarkSuspenseEffects.Start, {}),
35004
35069
  /* @__PURE__ */ jsx3(WithLayoutTemplate, {
35005
35070
  LayoutTemplate,
35006
- routeId: currentRouteId,
35071
+ routeId: (currentRoute == null ? void 0 : currentRoute.abTestingVariantId) ?? currentRouteId,
35007
35072
  style: defaultPageStyle,
35008
35073
  children: (inLayoutTemplate) => {
35009
35074
  return /* @__PURE__ */ jsx3(Fragment, {
@@ -42715,7 +42780,9 @@ try {
42715
42780
  catch { }
42716
42781
  var postLogEntry;
42717
42782
  try {
42718
- if (typeof window !== 'undefined' && !!window.postMessage && window.top !== window) {
42783
+ if (typeof window !== 'undefined' && !!window.postMessage && window.parent !== window &&
42784
+ // Don't post messages to the top-level site from the Editor Bar
42785
+ !window.location.pathname.startsWith('/edit')) {
42719
42786
  postLogEntry = (entry) => {
42720
42787
  var _a;
42721
42788
  try {
@@ -42729,7 +42796,7 @@ try {
42729
42796
  parts,
42730
42797
  printed,
42731
42798
  };
42732
- (_a = window.top) == null ? void 0 : _a.postMessage(data2, getServiceMap().app);
42799
+ (_a = window.parent) == null ? void 0 : _a.postMessage(data2, getServiceMap().app);
42733
42800
  }
42734
42801
  catch { }
42735
42802
  };
@@ -43811,11 +43878,11 @@ function getAssetOwnerType(asset) {
43811
43878
  async function loadFontsWithOpenType(source) {
43812
43879
  switch (source) {
43813
43880
  case 'google': {
43814
- const supportedFonts = await import('./framer-chunks/google-3ASCFEEO-3R47BR2A.js');
43881
+ const supportedFonts = await import('./framer-chunks/google-2KFYDWCN-PJC2DDXK.js');
43815
43882
  return supportedFonts == null ? void 0 : supportedFonts.default;
43816
43883
  }
43817
43884
  case 'fontshare': {
43818
- const supportedFonts = await import('./framer-chunks/fontshare-4J2ZFRBB-H5VQLZTM.js');
43885
+ const supportedFonts = await import('./framer-chunks/fontshare-EOIRPPWV-VDFFNW4K.js');
43819
43886
  return supportedFonts == null ? void 0 : supportedFonts.default;
43820
43887
  }
43821
43888
  default:
@@ -43825,11 +43892,11 @@ async function loadFontsWithOpenType(source) {
43825
43892
  async function loadFontToOpenTypeFeatures(source) {
43826
43893
  switch (source) {
43827
43894
  case 'google': {
43828
- const features = await import('./framer-chunks/google-FDB6LUFQ-PFSUZGKF.js');
43895
+ const features = await import('./framer-chunks/google-HSMCYMMG-DWNQGSHN.js');
43829
43896
  return features == null ? void 0 : features.default;
43830
43897
  }
43831
43898
  case 'fontshare': {
43832
- const features = await import('./framer-chunks/fontshare-622CVMZZ-HFPH543A.js');
43899
+ const features = await import('./framer-chunks/fontshare-Y53BJZLK-EUQIV252.js');
43833
43900
  return features == null ? void 0 : features.default;
43834
43901
  }
43835
43902
  case 'framer': {
@@ -44353,10 +44420,10 @@ function loadVariationAxes(source) {
44353
44420
  const axes = (async () => {
44354
44421
  switch (source) {
44355
44422
  case 'google': {
44356
- return (await import('./framer-chunks/google-C62SNV32-LCI4F7VO.js')).default;
44423
+ return (await import('./framer-chunks/google-S367OFIE-AWJEPMSF.js')).default;
44357
44424
  }
44358
44425
  case 'fontshare': {
44359
- return (await import('./framer-chunks/fontshare-JGEKH7YN-QOX3MC3K.js')).default;
44426
+ return (await import('./framer-chunks/fontshare-2X4LZ75B-D2V5BX73.js')).default;
44360
44427
  }
44361
44428
  default:
44362
44429
  assertNever(source);
@@ -45288,10 +45355,35 @@ var styles3 = /* @__PURE__ */ (() => [
45288
45355
  ])();
45289
45356
  var FormSelect = /* @__PURE__ */ withCSS(Select, styles3, 'framer-lib-form-select');
45290
45357
  var Image2 = /* @__PURE__ */ React4.forwardRef(function Image3(props, ref) {
45291
- const { background, children, alt, draggable, style: styleFromProps, ...rest } = props;
45358
+ const { background, children, alt, draggable, fitImageDimension, style: styleFromProps, ...rest } = props;
45292
45359
  const style2 = {
45293
45360
  ...styleFromProps,
45294
45361
  };
45362
+ const intrinsicSize = useMemo2(() => getIntrinsicSizeForBackgroundImage(background), [background,]);
45363
+ const [fallbackIntrinsicSize, setFallbackIntrinsicSize,] = useState();
45364
+ React4.useLayoutEffect(() => {
45365
+ if (!(background == null ? void 0 : background.src))
45366
+ return;
45367
+ if (!fitImageDimension)
45368
+ return;
45369
+ if (intrinsicSize)
45370
+ return;
45371
+ const img = document.createElement('img');
45372
+ img.onload = () => {
45373
+ if (img.naturalWidth && img.naturalHeight) {
45374
+ setFallbackIntrinsicSize({
45375
+ width: img.naturalWidth,
45376
+ height: img.naturalHeight,
45377
+ });
45378
+ }
45379
+ };
45380
+ img.src = background.src;
45381
+ }, [background == null ? void 0 : background.src, fitImageDimension, intrinsicSize,]);
45382
+ const size = intrinsicSize ?? fallbackIntrinsicSize;
45383
+ if (fitImageDimension && size) {
45384
+ style2[fitImageDimension] = 'auto';
45385
+ style2.aspectRatio = size.width / size.height;
45386
+ }
45295
45387
  if (background) {
45296
45388
  delete style2.background;
45297
45389
  }
@@ -47408,7 +47500,7 @@ var TextComponent = /* @__PURE__ */ (() => {
47408
47500
  if (this.props.transformTemplate)
47409
47501
  return this.props.transformTemplate;
47410
47502
  const frame2 = this.frame;
47411
- const isDOMLayoutAutoSized = _usesDOMRect && (widthType === 2 || heightType === 2);
47503
+ const isDOMLayoutAutoSized = _usesDOMRect && (isAutoDimensionType(widthType) || isAutoDimensionType(heightType));
47412
47504
  const hasTransformTemplate = !frame2 || !RenderTarget.hasRestrictions() || __fromCanvasComponent || isDOMLayoutAutoSized;
47413
47505
  if (hasTransformTemplate)
47414
47506
  return transformTemplate(this.props.center);
@@ -48559,12 +48651,12 @@ var package_default = {
48559
48651
  '@types/dom-navigation': '^1.0.5',
48560
48652
  '@types/fontfaceobserver': '2.1',
48561
48653
  '@types/google.fonts': '1.0',
48562
- '@types/node': '22.16',
48654
+ '@types/node': '22.17',
48563
48655
  '@types/react': '18.2',
48564
48656
  '@types/react-dom': '18.2',
48565
48657
  '@types/yargs': '^17.0.33',
48566
- '@typescript-eslint/eslint-plugin': '^8.36.0',
48567
- '@typescript-eslint/parser': '^8.36.0',
48658
+ '@typescript-eslint/eslint-plugin': '^8.40.0',
48659
+ '@typescript-eslint/parser': '^8.40.0',
48568
48660
  chalk: '^4.1.2',
48569
48661
  eslint: '^8.57.1',
48570
48662
  'eslint-plugin-framer-studio': 'workspace:*',
@@ -48577,7 +48669,7 @@ var package_default = {
48577
48669
  react: '^18.2.0',
48578
48670
  'react-dom': '^18.2.0',
48579
48671
  semver: '^7.7.1',
48580
- typescript: '^5.8.3',
48672
+ typescript: '^5.9.2',
48581
48673
  yargs: '^17.7.2',
48582
48674
  },
48583
48675
  peerDependencies: {
package/esm/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const version = "3.1.0";
1
+ export declare const version = "3.2.1";
2
2
  //# sourceMappingURL=version.d.ts.map
package/esm/version.js CHANGED
@@ -1,2 +1,2 @@
1
- export const version = '3.1.0';
1
+ export const version = '3.2.1';
2
2
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unframer",
3
- "version": "3.1.0",
3
+ "version": "3.2.1",
4
4
  "description": "Import Framer components directly in your React app, type safe and customizable",
5
5
  "sideEffects": false,
6
6
  "repository": "https://github.com/remorses/unframer",
@@ -76,7 +76,7 @@
76
76
  "@types/node": "^22.15.21",
77
77
  "@types/react": "^19.1.8",
78
78
  "@types/react-dom": "^19.1.5",
79
- "@xmorse/deployment-utils": "^0.4.3",
79
+ "@xmorse/deployment-utils": "^0.6.2",
80
80
  "concurrently": "^9.1.2",
81
81
  "dprint-node": "^1.0.8",
82
82
  "openai": "^4.80.1",