unframer 3.1.0 → 3.2.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.
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 +39 -28
  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 +189 -103
  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 +40 -29
  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 +189 -103
  67. package/esm/version.d.ts +1 -1
  68. package/esm/version.js +1 -1
  69. package/package.json +1 -1
  70. package/src/cli.ts +3 -0
  71. package/src/exporter.ts +58 -31
  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 +189 -107
  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.UWLYDHV3.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,31 @@ 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
+ const url = new URL(src);
22467
+ const width = url.searchParams.get('width');
22468
+ const height = url.searchParams.get('height');
22469
+ if (width && height) {
22470
+ return {
22471
+ width: parseInt(width),
22472
+ height: parseInt(height),
22473
+ };
22474
+ }
22475
+ return void 0;
22476
+ }
22468
22477
  function htmlElementAsMotionComponent(asElem) {
22469
22478
  return asElem && asElem !== 'search' && asElem !== 'slot' && asElem !== 'template' ? motion[asElem] : motion['div'];
22470
22479
  }
@@ -23572,6 +23581,11 @@ var VisibleFrame = /* @__PURE__ */ forwardRef(function VisibleFrame2(props, forw
23572
23581
  ],
23573
23582
  }), parentSize);
23574
23583
  const MotionComponent = htmlElementAsMotionComponent(props.as);
23584
+ const intrinsicSize = getIntrinsicSizeForBackgroundImage(backgroundImage);
23585
+ if (props.fitImageDimension && intrinsicSize) {
23586
+ currentStyle[props.fitImageDimension] = 'auto';
23587
+ currentStyle.aspectRatio = intrinsicSize.width / intrinsicSize.height;
23588
+ }
23575
23589
  return /* @__PURE__ */ jsxs(MotionComponent, {
23576
23590
  ...dataProps,
23577
23591
  ...motionProps,
@@ -32879,15 +32893,15 @@ function domWriteCreateUpdateSafeArea(safeAreaRef) {
32879
32893
  Object.assign(safeAreaRef.current.style, floatingPositionSafeAreaStyle(x, y, placement, anchorRect, calculatedRect));
32880
32894
  };
32881
32895
  }
32882
- function domWriteUpdatePosition(floatingPositionRef, position, rect) {
32896
+ function domWriteUpdatePosition(floatingPositionRef, position, rect, scrollX, scrollY) {
32883
32897
  if (!floatingPositionRef.current)
32884
32898
  return;
32885
32899
  Object.assign(floatingPositionRef.current.style, {
32886
32900
  position,
32887
32901
  visibility: 'visible',
32888
32902
  // 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',
32903
+ left: ((rect == null ? void 0 : rect.x) ?? 0) + scrollX + 'px',
32904
+ top: ((rect == null ? void 0 : rect.y) ?? 0) + scrollY + 'px',
32891
32905
  });
32892
32906
  }
32893
32907
  var FloatingStackingContext = /* @__PURE__ */ (() => {
@@ -33014,13 +33028,14 @@ function Floating({ alignment, placement, safeArea, offsetX, offsetY, anchorRef,
33014
33028
  let elementRect;
33015
33029
  let safePlacement;
33016
33030
  let calculatedRect;
33017
- let scrolls;
33018
33031
  let latestEvent;
33019
33032
  let updateSafeArea;
33033
+ let scrollX = 0;
33034
+ let scrollY = 0;
33020
33035
  const onRender = () => {
33021
33036
  if (cleanupHasRun)
33022
33037
  return;
33023
- domWriteUpdatePosition(floatingPositionRef, position, calculatedRect);
33038
+ domWriteUpdatePosition(floatingPositionRef, position, calculatedRect, scrollX, scrollY);
33024
33039
  if (safeArea)
33025
33040
  updateSafeArea(anchorRect, calculatedRect, safePlacement, latestEvent);
33026
33041
  latestEvent = void 0;
@@ -33031,7 +33046,7 @@ function Floating({ alignment, placement, safeArea, offsetX, offsetY, anchorRef,
33031
33046
  onRender();
33032
33047
  }
33033
33048
  else {
33034
- domWriteUpdatePosition(floatingPositionRef, position, calculatedRect);
33049
+ domWriteUpdatePosition(floatingPositionRef, position, calculatedRect, scrollX, scrollY);
33035
33050
  }
33036
33051
  initialUpdateHasRun = true;
33037
33052
  };
@@ -33043,6 +33058,14 @@ function Floating({ alignment, placement, safeArea, offsetX, offsetY, anchorRef,
33043
33058
  const domReadUpdateSafePlacementAndRect = () => {
33044
33059
  if (!getSafePlacementRect || cleanupHasRun)
33045
33060
  return;
33061
+ if (position === 'fixed') {
33062
+ scrollX = 0;
33063
+ scrollY = 0;
33064
+ }
33065
+ else {
33066
+ scrollX = safeWindow.scrollX;
33067
+ scrollY = safeWindow.scrollY;
33068
+ }
33046
33069
  anchorRect = anchorRef.current.getBoundingClientRect();
33047
33070
  const safePlacementAndRect = getSafePlacementRect(anchorRect, elementRect);
33048
33071
  safePlacement = safePlacementAndRect[0];
@@ -34605,57 +34628,79 @@ function isSamePage(a, b) {
34605
34628
  return aPathVariables.length === bPathVariables.length &&
34606
34629
  Object.keys(aPathVariables).every((key7) => aPathVariables[key7] === bPathVariables[key7]);
34607
34630
  }
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
- };
34631
+ var timezone = null;
34632
+ var visitorLocale = null;
34633
+ function setTimezoneAndLocaleForTracking() {
34634
+ const resolvedDateTimeOptions = Intl.DateTimeFormat().resolvedOptions();
34635
+ timezone = resolvedDateTimeOptions.timeZone;
34636
+ visitorLocale = resolvedDateTimeOptions.locale;
34617
34637
  }
34618
- var useSendPageView = (currentRoute, currentRouteId, currentPathVariables, collectionUtils, activeLocale) => {
34638
+ requestIdleCallback(setTimezoneAndLocaleForTracking);
34639
+ var useSendPageView = (currentRoute, currentRouteId, currentPathnameWithHash, currentPathVariables, collectionUtils, activeLocale) => {
34619
34640
  const framerSiteId = useContext(FormContext);
34620
34641
  const pageviewEventData = useRef3();
34621
34642
  const skipFirstPageView = useRef3(true);
34622
34643
  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({
34644
+ function getFullPageviewEventData() {
34645
+ if (!timezone || !visitorLocale)
34646
+ setTimezoneAndLocaleForTracking();
34647
+ const currentLocation = currentPathnameWithHash
34648
+ ? new URL(safeWindow.location.origin + currentPathnameWithHash)
34649
+ : safeWindow.location;
34650
+ const eventData = {
34651
+ version: pageviewEventVersion,
34634
34652
  abTestId: currentRoute == null ? void 0 : currentRoute.abTestId,
34635
34653
  framerSiteId: framerSiteId ?? null,
34636
34654
  // 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
- };
34655
+ webPageId: (currentRoute == null ? void 0 : currentRoute.abTestingVariantId) ?? currentRouteId,
34656
+ routePath: (currentRoute == null ? void 0 : currentRoute.path) || '/',
34657
+ collectionItemId: null,
34658
+ framerLocale: (activeLocale == null ? void 0 : activeLocale.code) || null,
34659
+ referrer: null,
34660
+ // The first pageview event will always be sent before hydration, in a script in `exportToHTML.ts`.
34661
+ url: currentLocation.href,
34662
+ hostname: currentLocation.hostname,
34663
+ // Capture the current location before the user moves to a new page to prevent
34664
+ // tracking wrong pathnames due to a race condition caused by async operations
34665
+ // when resolving the collection item ID below
34666
+ pathname: currentLocation.pathname,
34667
+ search: currentLocation.search || null,
34668
+ hash: currentLocation.hash || null,
34669
+ timezone,
34670
+ locale: visitorLocale,
34671
+ };
34672
+ return (currentRoute == null ? void 0 : currentRoute.collectionId) && collectionUtils && currentPathVariables
34673
+ ? (async () => {
34674
+ var _a;
34675
+ let collectionItemId = null;
34676
+ const utils = currentRoute.collectionId &&
34677
+ (await ((_a = collectionUtils[currentRoute.collectionId]) == null ? void 0 : _a.call(collectionUtils)));
34678
+ const [slug,] = Object.values(currentPathVariables);
34679
+ if (utils && typeof slug === 'string') {
34680
+ collectionItemId = (await utils.getRecordIdBySlug(slug, activeLocale || void 0)) ?? null;
34681
+ }
34682
+ return {
34683
+ ...eventData,
34684
+ collectionItemId,
34685
+ };
34686
+ })()
34687
+ : eventData;
34688
+ }
34643
34689
  void (async () => {
34644
- const pageviewEventDataPromise = getFullPageviewEventData();
34645
- pageviewEventData.current = pageviewEventDataPromise;
34690
+ const eventDataOrPromise = pageviewEventData.current = getFullPageviewEventData();
34691
+ const eventData = eventDataOrPromise instanceof Promise ? await eventDataOrPromise : eventDataOrPromise;
34692
+ pageviewEventData.current = eventData;
34646
34693
  if (skipFirstPageView.current) {
34647
34694
  skipFirstPageView.current = false;
34648
- return;
34649
34695
  }
34650
- const eventData = await pageviewEventDataPromise;
34651
- pageviewEventData.current = eventData;
34652
- sendTrackingEvent('published_site_pageview', eventData, 'eager');
34696
+ else {
34697
+ sendTrackingEvent('published_site_pageview', eventData, 'eager');
34698
+ }
34653
34699
  })();
34654
34700
  const listener = async (event) => {
34655
34701
  if (event.persisted) {
34656
- const pageviewEventDataPromise = getFullPageviewEventData();
34657
- pageviewEventData.current = pageviewEventDataPromise;
34658
- const eventData = await getFullPageviewEventData();
34702
+ const eventDataOrPromise = pageviewEventData.current = getFullPageviewEventData();
34703
+ const eventData = eventDataOrPromise instanceof Promise ? await eventDataOrPromise : eventDataOrPromise;
34659
34704
  pageviewEventData.current = eventData;
34660
34705
  sendTrackingEvent('published_site_pageview', eventData, 'eager');
34661
34706
  }
@@ -34664,7 +34709,7 @@ var useSendPageView = (currentRoute, currentRouteId, currentPathVariables, colle
34664
34709
  return () => {
34665
34710
  window.removeEventListener('pageshow', listener);
34666
34711
  };
34667
- }, [currentRoute, currentRouteId, currentPathVariables, collectionUtils, activeLocale, framerSiteId,]);
34712
+ }, [currentRoute, currentRouteId, currentPathnameWithHash, currentPathVariables, collectionUtils, activeLocale, framerSiteId,]);
34668
34713
  return pageviewEventData;
34669
34714
  };
34670
34715
  var defaultLocaleId = 'default';
@@ -34767,6 +34812,7 @@ function Router({ defaultPageStyle, disableHistory, initialPathVariables, initia
34767
34812
  return (fn) => fn();
34768
34813
  }, [synchronousNavigationOnDesktop,]);
34769
34814
  const isInitialNavigationRef = useRef3(true);
34815
+ const currentPathnameWithHashRef = useRef3();
34770
34816
  const currentRouteRef = useRef3(initialRoute);
34771
34817
  const currentPathVariablesRef = useRef3(initialPathVariables);
34772
34818
  const currentLocaleIdRef = useRef3(initialLocaleId);
@@ -34852,12 +34898,13 @@ function Router({ defaultPageStyle, disableHistory, initialPathVariables, initia
34852
34898
  monitorNextPaintAfterRender,
34853
34899
  transitionFn,
34854
34900
  ]);
34855
- const setCurrentRouteId = useCallback((routeId, localeId, hash2, pathVariables, isHistoryTransition, nextRender, smoothScroll = false, updateURL) => {
34901
+ const setCurrentRouteId = useCallback((routeId, localeId, hash2, pathnameWithHash, pathVariables, isHistoryTransition, nextRender, smoothScroll = false, updateURL) => {
34856
34902
  isInitialNavigationRef.current = false;
34857
34903
  const currentRouteId2 = currentRouteRef.current;
34858
34904
  currentRouteRef.current = routeId;
34859
34905
  currentPathVariablesRef.current = pathVariables;
34860
34906
  currentLocaleIdRef.current = localeId;
34907
+ currentPathnameWithHashRef.current = pathnameWithHash;
34861
34908
  scheduleSideEffect(() => {
34862
34909
  updateScrollPosition(hash2, smoothScroll, isHistoryTransition);
34863
34910
  });
@@ -34943,14 +34990,26 @@ function Router({ defaultPageStyle, disableHistory, initialPathVariables, initia
34943
34990
  siteCanonicalURL,
34944
34991
  }, ignorePushStateWrapper);
34945
34992
  };
34946
- setCurrentRouteId(routeId, currentRouteLocaleId, routeElementId, pathVariables, false, nextRender, smoothScroll, disableHistory ? void 0 : updateURL);
34993
+ const pathnameWithHash = getSitePrefix(siteCanonicalURL) + getPathForRoute(newRoute, {
34994
+ currentRoutePath: currentRoute2 == null ? void 0 : currentRoute2.path,
34995
+ currentPathVariables: currentPathVariables2,
34996
+ hash: hash2,
34997
+ pathVariables,
34998
+ localeId: currentRouteLocaleId,
34999
+ preserveQueryParams,
35000
+ siteCanonicalURL,
35001
+ relative: false,
35002
+ // We need an absolute path for the hash
35003
+ });
35004
+ setCurrentRouteId(routeId, currentRouteLocaleId, routeElementId, pathnameWithHash, pathVariables, false, nextRender, smoothScroll, disableHistory ? void 0 : updateURL);
34947
35005
  }, [routes, setCurrentRouteId, disableHistory, preserveQueryParams, siteCanonicalURL, monitorNextPaintAfterRender,]);
34948
35006
  const getRoute = useGetRouteCallback(routes);
34949
35007
  const currentRouteId = currentRouteRef.current;
35008
+ const currentPathnameWithHash = currentPathnameWithHashRef.current;
34950
35009
  const currentPathVariables = currentPathVariablesRef.current;
34951
35010
  const currentRoute = routes[currentRouteId];
34952
35011
  const currentRoutePath = currentRoute == null ? void 0 : currentRoute.path;
34953
- const pageviewEventData = useSendPageView(currentRoute, currentRouteId, currentPathVariables, collectionUtils, activeLocale);
35012
+ const pageviewEventData = useSendPageView(currentRoute, currentRouteId, currentPathnameWithHash, currentPathVariables, collectionUtils, activeLocale);
34954
35013
  const isInitialNavigation = isInitialNavigationRef.current;
34955
35014
  const api = useMemo2(() => ({
34956
35015
  navigate,
@@ -35003,7 +35062,7 @@ function Router({ defaultPageStyle, disableHistory, initialPathVariables, initia
35003
35062
  /* @__PURE__ */ jsx3(MarkSuspenseEffects.Start, {}),
35004
35063
  /* @__PURE__ */ jsx3(WithLayoutTemplate, {
35005
35064
  LayoutTemplate,
35006
- routeId: currentRouteId,
35065
+ routeId: (currentRoute == null ? void 0 : currentRoute.abTestingVariantId) ?? currentRouteId,
35007
35066
  style: defaultPageStyle,
35008
35067
  children: (inLayoutTemplate) => {
35009
35068
  return /* @__PURE__ */ jsx3(Fragment, {
@@ -42715,7 +42774,9 @@ try {
42715
42774
  catch { }
42716
42775
  var postLogEntry;
42717
42776
  try {
42718
- if (typeof window !== 'undefined' && !!window.postMessage && window.top !== window) {
42777
+ if (typeof window !== 'undefined' && !!window.postMessage && window.parent !== window &&
42778
+ // Don't post messages to the top-level site from the Editor Bar
42779
+ !window.location.pathname.startsWith('/edit')) {
42719
42780
  postLogEntry = (entry) => {
42720
42781
  var _a;
42721
42782
  try {
@@ -42729,7 +42790,7 @@ try {
42729
42790
  parts,
42730
42791
  printed,
42731
42792
  };
42732
- (_a = window.top) == null ? void 0 : _a.postMessage(data2, getServiceMap().app);
42793
+ (_a = window.parent) == null ? void 0 : _a.postMessage(data2, getServiceMap().app);
42733
42794
  }
42734
42795
  catch { }
42735
42796
  };
@@ -43811,11 +43872,11 @@ function getAssetOwnerType(asset) {
43811
43872
  async function loadFontsWithOpenType(source) {
43812
43873
  switch (source) {
43813
43874
  case 'google': {
43814
- const supportedFonts = await import('./framer-chunks/google-3ASCFEEO-3R47BR2A.js');
43875
+ const supportedFonts = await import('./framer-chunks/google-2KFYDWCN-PJC2DDXK.js');
43815
43876
  return supportedFonts == null ? void 0 : supportedFonts.default;
43816
43877
  }
43817
43878
  case 'fontshare': {
43818
- const supportedFonts = await import('./framer-chunks/fontshare-4J2ZFRBB-H5VQLZTM.js');
43879
+ const supportedFonts = await import('./framer-chunks/fontshare-EOIRPPWV-VDFFNW4K.js');
43819
43880
  return supportedFonts == null ? void 0 : supportedFonts.default;
43820
43881
  }
43821
43882
  default:
@@ -43825,11 +43886,11 @@ async function loadFontsWithOpenType(source) {
43825
43886
  async function loadFontToOpenTypeFeatures(source) {
43826
43887
  switch (source) {
43827
43888
  case 'google': {
43828
- const features = await import('./framer-chunks/google-FDB6LUFQ-PFSUZGKF.js');
43889
+ const features = await import('./framer-chunks/google-HSMCYMMG-DWNQGSHN.js');
43829
43890
  return features == null ? void 0 : features.default;
43830
43891
  }
43831
43892
  case 'fontshare': {
43832
- const features = await import('./framer-chunks/fontshare-622CVMZZ-HFPH543A.js');
43893
+ const features = await import('./framer-chunks/fontshare-Y53BJZLK-EUQIV252.js');
43833
43894
  return features == null ? void 0 : features.default;
43834
43895
  }
43835
43896
  case 'framer': {
@@ -44353,10 +44414,10 @@ function loadVariationAxes(source) {
44353
44414
  const axes = (async () => {
44354
44415
  switch (source) {
44355
44416
  case 'google': {
44356
- return (await import('./framer-chunks/google-C62SNV32-LCI4F7VO.js')).default;
44417
+ return (await import('./framer-chunks/google-S367OFIE-AWJEPMSF.js')).default;
44357
44418
  }
44358
44419
  case 'fontshare': {
44359
- return (await import('./framer-chunks/fontshare-JGEKH7YN-QOX3MC3K.js')).default;
44420
+ return (await import('./framer-chunks/fontshare-2X4LZ75B-D2V5BX73.js')).default;
44360
44421
  }
44361
44422
  default:
44362
44423
  assertNever(source);
@@ -45288,10 +45349,35 @@ var styles3 = /* @__PURE__ */ (() => [
45288
45349
  ])();
45289
45350
  var FormSelect = /* @__PURE__ */ withCSS(Select, styles3, 'framer-lib-form-select');
45290
45351
  var Image2 = /* @__PURE__ */ React4.forwardRef(function Image3(props, ref) {
45291
- const { background, children, alt, draggable, style: styleFromProps, ...rest } = props;
45352
+ const { background, children, alt, draggable, fitImageDimension, style: styleFromProps, ...rest } = props;
45292
45353
  const style2 = {
45293
45354
  ...styleFromProps,
45294
45355
  };
45356
+ const intrinsicSize = useMemo2(() => getIntrinsicSizeForBackgroundImage(background), [background,]);
45357
+ const [fallbackIntrinsicSize, setFallbackIntrinsicSize,] = useState();
45358
+ React4.useLayoutEffect(() => {
45359
+ if (!(background == null ? void 0 : background.src))
45360
+ return;
45361
+ if (!fitImageDimension)
45362
+ return;
45363
+ if (intrinsicSize)
45364
+ return;
45365
+ const img = document.createElement('img');
45366
+ img.onload = () => {
45367
+ if (img.naturalWidth && img.naturalHeight) {
45368
+ setFallbackIntrinsicSize({
45369
+ width: img.naturalWidth,
45370
+ height: img.naturalHeight,
45371
+ });
45372
+ }
45373
+ };
45374
+ img.src = background.src;
45375
+ }, [background == null ? void 0 : background.src, fitImageDimension, intrinsicSize,]);
45376
+ const size = intrinsicSize ?? fallbackIntrinsicSize;
45377
+ if (fitImageDimension && size) {
45378
+ style2[fitImageDimension] = 'auto';
45379
+ style2.aspectRatio = size.width / size.height;
45380
+ }
45295
45381
  if (background) {
45296
45382
  delete style2.background;
45297
45383
  }
@@ -47408,7 +47494,7 @@ var TextComponent = /* @__PURE__ */ (() => {
47408
47494
  if (this.props.transformTemplate)
47409
47495
  return this.props.transformTemplate;
47410
47496
  const frame2 = this.frame;
47411
- const isDOMLayoutAutoSized = _usesDOMRect && (widthType === 2 || heightType === 2);
47497
+ const isDOMLayoutAutoSized = _usesDOMRect && (isAutoDimensionType(widthType) || isAutoDimensionType(heightType));
47412
47498
  const hasTransformTemplate = !frame2 || !RenderTarget.hasRestrictions() || __fromCanvasComponent || isDOMLayoutAutoSized;
47413
47499
  if (hasTransformTemplate)
47414
47500
  return transformTemplate(this.props.center);
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.0";
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.0';
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.0",
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",
package/src/cli.ts CHANGED
@@ -39,6 +39,7 @@ cli.command('[projectId]', 'Run unframer with optional project ID')
39
39
  default: true,
40
40
  })
41
41
  .option('--debug', 'Enable debug logging', { default: false })
42
+ .option('--metafile', 'Generate meta.json file with build metadata', { default: false })
42
43
  .action(async function main(projectId, options) {
43
44
  const external_ = options.external
44
45
  const allExternal = external_ === true
@@ -71,6 +72,7 @@ cli.command('[projectId]', 'Run unframer with optional project ID')
71
72
  watch,
72
73
  cwd,
73
74
  signal,
75
+ metafile: options.metafile,
74
76
  })
75
77
  // console.log('buildContext', buildContext)
76
78
  if (!websiteUrl || !options.watch) {
@@ -140,6 +142,7 @@ cli.command('[projectId]', 'Run unframer with optional project ID')
140
142
  watch,
141
143
  signal: controller.signal,
142
144
  cwd: path.resolve(process.cwd(), config.outDir || 'framer'),
145
+ metafile: options.metafile,
143
146
  })
144
147
  await buildContext.dispose?.()
145
148
  } catch (error) {