unframer 2.18.0 → 2.18.2

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/src/framer.js CHANGED
@@ -506965,6 +506965,7 @@ import { createElement, Fragment, } from 'react';
506965
506965
  import { useState, } from 'react';
506966
506966
  import * as React2 from 'react';
506967
506967
  import { Children, isValidElement, } from 'react';
506968
+ var __unframerNavigator = typeof window !== 'undefined' ? navigator : void 0;
506968
506969
  var require_memoize_browser_cjs = __commonJS({
506969
506970
  '../../../node_modules/@emotion/memoize/dist/memoize.browser.cjs.js'(exports,) {
506970
506971
  'use strict';
@@ -514127,7 +514128,8 @@ var defaultLayoutTransition = {
514127
514128
  ease: [0.4, 0, 0.1, 1,],
514128
514129
  };
514129
514130
  var userAgentContains = (string) =>
514130
- typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().includes(string,);
514131
+ typeof __unframerNavigator !== 'undefined' && __unframerNavigator.userAgent &&
514132
+ __unframerNavigator.userAgent.toLowerCase().includes(string,);
514131
514133
  var roundPoint = userAgentContains('applewebkit/',) && !userAgentContains('chrome/',) ? Math.round : noop;
514132
514134
  function roundAxis(axis,) {
514133
514135
  axis.min = roundPoint(axis.min,);
@@ -517370,7 +517372,7 @@ function steps(numSteps, direction = 'end',) {
517370
517372
  };
517371
517373
  }
517372
517374
 
517373
- // /:https://app.framerstatic.com/framer.43KQGWBL.mjs
517375
+ // /:https://app.framerstatic.com/framer.3KX2OI4Q.mjs
517374
517376
  init_chunk_QLPHEVXG();
517375
517377
  import React4 from 'react';
517376
517378
  import { Suspense as Suspense3, } from 'react';
@@ -517378,6 +517380,7 @@ import { memo as memo2, startTransition as startTransition2, } from 'react';
517378
517380
  import ReactDOM from 'react-dom';
517379
517381
  import { createRef, } from 'react';
517380
517382
  import { cloneElement as cloneElement32, } from 'react';
517383
+ var __unframerNavigator2 = typeof window !== 'undefined' ? navigator : void 0;
517381
517384
  var require_hsluv = __commonJS({
517382
517385
  '../../../node_modules/hsluv/dist/hsluv.cjs'(exports,) {
517383
517386
  'use strict';
@@ -519209,7 +519212,7 @@ function isGenerator2(value,) {
519209
519212
  function isBot(userAgent,) {
519210
519213
  return /bot|-google|google-|yandex|ia_archiver/iu.test(userAgent,);
519211
519214
  }
519212
- var shouldPreloadBasedOnUA = /* @__PURE__ */ (() => typeof window !== 'undefined' && !isBot(navigator.userAgent,))();
519215
+ var shouldPreloadBasedOnUA = /* @__PURE__ */ (() => typeof window !== 'undefined' && !isBot(__unframerNavigator2.userAgent,))();
519213
519216
  function useRoutePreloader(routeIds, enabled = true,) {
519214
519217
  const {
519215
519218
  getRoute,
@@ -520009,8 +520012,8 @@ function replaceHistoryState(data2, url, ignoreReplaceStateWrapper = false,) {
520009
520012
  }
520010
520013
  var maybeHasPopstateBug = true;
520011
520014
  var isImpactedPopstateBugChromiumVersion = /* @__PURE__ */ (() => {
520012
- if (typeof navigator === 'undefined') return false;
520013
- const userAgent = navigator.userAgent;
520015
+ if (typeof __unframerNavigator2 === 'undefined') return false;
520016
+ const userAgent = __unframerNavigator2.userAgent;
520014
520017
  const chromePos = userAgent.indexOf('Chrome/',);
520015
520018
  const chromiumVersion = +userAgent.slice(chromePos + 7, userAgent.indexOf('.', chromePos,),);
520016
520019
  return chromiumVersion > 101 && chromiumVersion < 128;
@@ -520038,7 +520041,7 @@ async function pushHistoryState(data2, url, awaitPaintBeforeUpdate = false, isNa
520038
520041
  console.error(msg,);
520039
520042
  (_a = window.__framer_events) == null ? void 0 : _a.push(['published_site_load_recoverable_error', {
520040
520043
  message: msg,
520041
- userAgent: navigator.userAgent,
520044
+ userAgent: __unframerNavigator2.userAgent,
520042
520045
  },],);
520043
520046
  };
520044
520047
  window.addEventListener('popstate', popstateListener, {
@@ -520541,10 +520544,11 @@ var MarkSuspenseEffects = {
520541
520544
  End: MarkSuspenseEffectsEnd,
520542
520545
  };
520543
520546
  function renderPage(Page4, defaultPageStyle,) {
520544
- const style = {
520547
+ const props = {
520545
520548
  style: defaultPageStyle,
520549
+ 'data-framer-root': true,
520546
520550
  };
520547
- return React4.isValidElement(Page4,) ? React4.cloneElement(Page4, style,) : React4.createElement(Page4, style,);
520551
+ return React4.isValidElement(Page4,) ? React4.cloneElement(Page4, props,) : React4.createElement(Page4, props,);
520548
520552
  }
520549
520553
  var NotFoundError = class extends Error {};
520550
520554
  var NotFoundErrorBoundaryCaughtError = class extends Error {
@@ -525489,10 +525493,7 @@ var ProvideParentSize = (props) => {
525489
525493
  } = props;
525490
525494
  const value = React4.useMemo(() => ({
525491
525495
  parentSize,
525492
- }), // We are generating the memoKeys in runtime and react doesn't like it,
525493
- // but it should be safe to ignore.
525494
- // eslint-disable-next-line react-hooks/exhaustive-deps
525495
- [getParentWidth(parentSize,), getParentHeight(parentSize,),],);
525496
+ }), [getParentWidth(parentSize,), getParentHeight(parentSize,),],);
525496
525497
  if (currentParentSize === 1) {
525497
525498
  return children
525498
525499
  ? /* @__PURE__ */ jsx(Fragment, {
@@ -528158,6 +528159,10 @@ function supportsThemes(presetId, skin,) {
528158
528159
  }
528159
528160
  return false;
528160
528161
  }
528162
+ function useIsStaticRenderer() {
528163
+ const currentTarget = RenderTarget.current();
528164
+ return currentTarget === RenderTarget.canvas || currentTarget === RenderTarget.export;
528165
+ }
528161
528166
  var asRecord = (object) => object;
528162
528167
  function memoize(fn,) {
528163
528168
  const cache2 = Object.create(Object.prototype,);
@@ -528500,7 +528505,7 @@ function htmlElementAsMotionComponent(asElem,) {
528500
528505
  return asElem && asElem !== 'search' && asElem !== 'slot' && asElem !== 'template' ? motion[asElem] : motion['div'];
528501
528506
  }
528502
528507
  var import_process = __toESM(require_browser(), 1,);
528503
- var safeNavigator = typeof navigator !== 'undefined' ? navigator : void 0;
528508
+ var safeNavigator = typeof __unframerNavigator2 !== 'undefined' ? __unframerNavigator2 : void 0;
528504
528509
  var isBrowser2 = () => typeof document === 'object';
528505
528510
  var isWebKit = () => {
528506
528511
  var _a;
@@ -529583,9 +529588,9 @@ function useStyleAndRect(props,) {
529583
529588
  ...defaultStyle,
529584
529589
  };
529585
529590
  }
529586
- const onCanvas = RenderTarget.current() === RenderTarget.canvas;
529591
+ const isRenderingStaticContent = useIsStaticRenderer();
529587
529592
  if (props.positionSticky) {
529588
- if (!onCanvas || inCodeComponent) {
529593
+ if (!isRenderingStaticContent || inCodeComponent) {
529589
529594
  resultStyle.position = 'sticky';
529590
529595
  resultStyle.willChange = 'transform';
529591
529596
  resultStyle.zIndex = 1;
@@ -529594,7 +529599,7 @@ function useStyleAndRect(props,) {
529594
529599
  resultStyle.bottom = props.positionStickyBottom;
529595
529600
  resultStyle.left = props.positionStickyLeft;
529596
529601
  }
529597
- } else if (onCanvas && (props.positionFixed || props.positionAbsolute)) {
529602
+ } else if (isRenderingStaticContent && (props.positionFixed || props.positionAbsolute)) {
529598
529603
  resultStyle.position = 'absolute';
529599
529604
  }
529600
529605
  if ('rotate' in resultStyle && resultStyle.rotate === void 0) {
@@ -530081,7 +530086,6 @@ var SharedIntersectionObserver = class {
530081
530086
  };
530082
530087
  var SharedIntersectionObserverContext = /* @__PURE__ */ createContext(/* @__PURE__ */ new Map(),);
530083
530088
  function useSharedIntersectionObserver(ref, callback, options,) {
530084
- if (typeof IntersectionObserver === 'undefined') return;
530085
530089
  const key7 = useConstant2(() => `${options.rootMargin}`);
530086
530090
  const observers2 = useContext(SharedIntersectionObserverContext,);
530087
530091
  const {
@@ -536355,9 +536359,7 @@ function useUpdateScrollOffset(ref, side, offset, cancelEmulatedTouchScrollAnima
536355
536359
  cancelEmulatedTouchScrollAnimation == null ? void 0 : cancelEmulatedTouchScrollAnimation();
536356
536360
  element[side] = Math.abs(offset,);
536357
536361
  }
536358
- }, // We only want to update on contentOffset changes
536359
- // eslint-disable-next-line react-hooks/exhaustive-deps
536360
- [offset,],);
536362
+ }, [offset,],);
536361
536363
  }
536362
536364
  var NativeScroll = /* @__PURE__ */ React4.forwardRef(function NativeScroll2(props, forwardedRef,) {
536363
536365
  const {
@@ -536827,10 +536829,6 @@ function useFXValues(values, enabled,) {
536827
536829
  }, [effect, enabled,],);
536828
536830
  return effect;
536829
536831
  }
536830
- function useIsStaticRenderer() {
536831
- const currentTarget = RenderTarget.current();
536832
- return currentTarget === RenderTarget.canvas || currentTarget === RenderTarget.export;
536833
- }
536834
536832
  var loopOptionsKeys = /* @__PURE__ */ new Set(['loopEffectEnabled', 'loopTransition', 'loop', 'loopRepeatType', 'loopRepeatDelay',],);
536835
536833
  var useDelay = () => {
536836
536834
  const timeoutRef = useRef();
@@ -537268,7 +537266,8 @@ function useAnimationVariants({
537268
537266
  opacity: targetOpacity,
537269
537267
  },),
537270
537268
  exit: exit ?? makeStyle(),
537271
- }), [animateVariant2, defaultStyles, enter, exit, opacity, targetOpacity, transformPerspective,],);
537269
+ }), // biome-ignore lint/correctness/useExhaustiveDependencies: `defaultStyles` makes this memo re-run on every render, but that appears to be fine.
537270
+ [animateVariant2, defaultStyles, enter, exit, opacity, targetOpacity, transformPerspective,],);
537272
537271
  }
537273
537272
  function useStyleAppearEffect(options, ref,) {
537274
537273
  const shouldReduceMotion = useReducedMotionConfig();
@@ -537310,9 +537309,7 @@ function useStyleAppearEffect(options, ref,) {
537310
537309
  }
537311
537310
  },);
537312
537311
  },),);
537313
- }, // All dependencies are object values or stable.
537314
- // eslint-disable-next-line react-hooks/exhaustive-deps
537315
- [],);
537312
+ }, [],);
537316
537313
  const hasAnimatedOnce = options.animateOnce && playState.current.lastAppearState === true;
537317
537314
  const animateWithIntersectionObserver = !options.targets && options.styleAppearEffectEnabled && !options.scrollDirection &&
537318
537315
  !hasAnimatedOnce;
@@ -537917,7 +537914,14 @@ var SuspenseErrorBoundary = class extends Component {
537917
537914
  };
537918
537915
  var suspendPromise = /* @__PURE__ */ (() => typeof window !== 'undefined' ? new Promise(() => {},) : null)();
537919
537916
  function Suspend() {
537920
- if (typeof window === 'undefined' || window.__framer_STPD_OPT_OUT__) return null;
537917
+ if (typeof window === 'undefined' || window.__framer_STPD_OPT_OUT__) {
537918
+ return /* @__PURE__ */ jsx('div', {
537919
+ hidden: true,
537920
+ dangerouslySetInnerHTML: {
537921
+ __html: '<!-- SuspenseThatPreservesDOM fallback rendered -->',
537922
+ },
537923
+ },);
537924
+ }
537921
537925
  throw suspendPromise;
537922
537926
  }
537923
537927
  function SuspenseThatPreservesDom({
@@ -538047,16 +538051,25 @@ var DeprecatedContainerErrorBoundary = class extends Component {
538047
538051
  return hasError ? null : children;
538048
538052
  }
538049
538053
  };
538050
- var IsInExternalComponentContext = /* @__PURE__ */ (() => React4.createContext(0,))();
538051
- function useExternalComponentNestingLevel() {
538052
- return React4.useContext(IsInExternalComponentContext,);
538054
+ var ExternalComponentContext = /* @__PURE__ */ (() =>
538055
+ React4.createContext({
538056
+ level: 0,
538057
+ scopeId: void 0,
538058
+ },))();
538059
+ function useNearestExternalComponent() {
538060
+ return React4.useContext(ExternalComponentContext,);
538053
538061
  }
538054
538062
  function IsExternalComponent({
538055
538063
  children,
538064
+ scopeId,
538056
538065
  },) {
538057
- const count = React4.useContext(IsInExternalComponentContext,);
538058
- return /* @__PURE__ */ jsx(IsInExternalComponentContext.Provider, {
538059
- value: count + 1,
538066
+ const level = React4.useContext(ExternalComponentContext,).level;
538067
+ const newValue = React4.useMemo(() => ({
538068
+ level: level + 1,
538069
+ scopeId,
538070
+ }), [level, scopeId,],);
538071
+ return /* @__PURE__ */ jsx(ExternalComponentContext.Provider, {
538072
+ value: newValue,
538060
538073
  children,
538061
538074
  },);
538062
538075
  }
@@ -538075,27 +538088,50 @@ function getErrorMessageFor(element, scopeId, nodeId,) {
538075
538088
  formatCodeCrashLocationFromSourceNode(scopeId, nodeId,)
538076
538089
  } \u2192 click \u201CShow Layer\u201D.`;
538077
538090
  }
538078
- function shouldWrapComponentWithBoundary(externalModuleNestingLevel, isAuthoredByUser, isExternalComponent, inComponentSlot,) {
538079
- const isLocalComponentInstance =
538080
- // We know a component instance is local when it’s not nested inside any external component...
538081
- externalModuleNestingLevel === 0 ||
538082
- // ...or – “Ticker edge case” – when it’s nested inside an external component during React rendering,
538083
- // but is actually defined in a slot that’s passed into the component. (This is the “Ticker edge case”:
538084
- // if a site has a Ticker (or any other component with slots), and something in a Ticker’s slot crashes,
538085
- // we want to disable that something, not the whole ticker.)
538086
- externalModuleNestingLevel === 1 && inComponentSlot;
538087
- return (isAuthoredByUser || isExternalComponent) && isLocalComponentInstance;
538088
- }
538089
- function shouldWrapOverrideWithBoundary(externalModuleNestingLevel, inComponentSlot,) {
538090
- const isWrappingFrameLocalToProject =
538091
- // We know a frame is local when it’s not nested inside any external component...
538092
- externalModuleNestingLevel === 0 ||
538093
- // ...or – “Ticker edge case when it’s nested inside an external component during React rendering,
538094
- // but is actually defined in a slot that’s passed into the component. (This is the “Ticker edge case”:
538095
- // if a site has a Ticker (or any other component with slots), and an override in a Ticker’s slot crashes,
538096
- // we want to disable that override, not the whole ticker.)
538097
- externalModuleNestingLevel === 1 && inComponentSlot;
538098
- return isWrappingFrameLocalToProject;
538091
+ function shouldWrapComponentWithBoundary(
538092
+ scopeIdOfThisComponent,
538093
+ scopeIdOfNearestExternalComponent,
538094
+ externalComponentLevel,
538095
+ isAuthoredByUser,
538096
+ isExternalComponent,
538097
+ inComponentSlot,
538098
+ ) {
538099
+ const isLocalComponentInstance = isNodeLocalToProject(
538100
+ scopeIdOfThisComponent,
538101
+ scopeIdOfNearestExternalComponent,
538102
+ externalComponentLevel,
538103
+ inComponentSlot,
538104
+ );
538105
+ return (
538106
+ // case 1: all (local instances) of (local) (code components)
538107
+ isLocalComponentInstance && !isExternalComponent && isAuthoredByUser ||
538108
+ // case 2: all (local instances) of (external components)
538109
+ isLocalComponentInstance && isExternalComponent
538110
+ );
538111
+ }
538112
+ function shouldWrapOverrideWithBoundary(
538113
+ scopeIdOfNodeWithOverride,
538114
+ scopeIdOfNearestExternalComponent,
538115
+ externalComponentLevel,
538116
+ inComponentSlot,
538117
+ ) {
538118
+ return isNodeLocalToProject(scopeIdOfNodeWithOverride, scopeIdOfNearestExternalComponent, externalComponentLevel, inComponentSlot,);
538119
+ }
538120
+ function isNodeLocalToProject(scopeIdOfThisNode, scopeIdOfNearestExternalComponent, externalComponentLevel, inComponentSlot,) {
538121
+ if (externalComponentLevel === 0) return true;
538122
+ const nodeIsDefinedInSameScopeAsExternalComponent = scopeIdOfThisNode === scopeIdOfNearestExternalComponent;
538123
+ if (
538124
+ // We know a component instance is local when it’s nested inside one external component,
538125
+ externalComponentLevel === 1 &&
538126
+ // and it lives in a slot,
538127
+ inComponentSlot &&
538128
+ // and it’s a slot of *that sole external component* (and not some other local component
538129
+ // with slots that lives inside the external component).
538130
+ nodeIsDefinedInSameScopeAsExternalComponent
538131
+ ) {
538132
+ return true;
538133
+ }
538134
+ return false;
538099
538135
  }
538100
538136
  var ContainerInner = /* @__PURE__ */ React4.forwardRef(({
538101
538137
  children,
@@ -538178,7 +538214,7 @@ var SmartComponentScopedContainer = /* @__PURE__ */ React4.forwardRef((props, re
538178
538214
  }
538179
538215
  },);
538180
538216
  function useWrapWithCodeBoundary(children, scopeId, nodeId, isAuthoredByUser, isExternalComponent, inComponentSlot,) {
538181
- const externalModuleNestingLevel = useExternalComponentNestingLevel();
538217
+ const nearestExternalComponent = useNearestExternalComponent();
538182
538218
  if (
538183
538219
  // Those props will either be all undefined, which means the Container wasn’t codegenned yet,
538184
538220
  // and we should use the old ContainerErrorBoundary –
@@ -538190,7 +538226,9 @@ function useWrapWithCodeBoundary(children, scopeId, nodeId, isAuthoredByUser, is
538190
538226
  },);
538191
538227
  }
538192
538228
  const shouldWrapWithBoundary = shouldWrapComponentWithBoundary(
538193
- externalModuleNestingLevel,
538229
+ scopeId,
538230
+ nearestExternalComponent.scopeId,
538231
+ nearestExternalComponent.level,
538194
538232
  isAuthoredByUser ?? false,
538195
538233
  isExternalComponent ?? false,
538196
538234
  inComponentSlot ?? false,
@@ -538204,6 +538242,7 @@ function useWrapWithCodeBoundary(children, scopeId, nodeId, isAuthoredByUser, is
538204
538242
  }
538205
538243
  if (isExternalComponent) {
538206
538244
  children = /* @__PURE__ */ jsx(IsExternalComponent, {
538245
+ scopeId,
538207
538246
  children,
538208
538247
  },);
538209
538248
  }
@@ -539179,6 +539218,8 @@ var GracefullyDegradingErrorBoundary = class extends Component {
539179
539218
  error: void 0,
539180
539219
  },);
539181
539220
  __publicField(this, 'message', 'Made UI non-interactive due to an error',);
539221
+ __publicField(this, 'messageFatal', 'Fatal error',);
539222
+ __publicField(this, 'messageUser', 'Please check any custom code or code overrides',);
539182
539223
  __publicField(
539183
539224
  this,
539184
539225
  'messageReport',
@@ -539191,17 +539232,21 @@ var GracefullyDegradingErrorBoundary = class extends Component {
539191
539232
  };
539192
539233
  }
539193
539234
  componentDidCatch(error,) {
539194
- var _a, _b;
539235
+ var _a, _b, _c;
539195
539236
  window.__framer_hadFatalError = true;
539196
539237
  if ('cause' in error) {
539197
539238
  error = error.cause;
539198
539239
  }
539199
- console.error(`${this.message} (see above). ${this.messageReport}.`,);
539240
+ console.error(
539241
+ `${isBot(__unframerNavigator2.userAgent,) ? this.message : this.messageFatal} (see above). ${
539242
+ ((_a = this.context) == null ? void 0 : _a.codeBoundaries) ? this.messageUser : this.messageReport
539243
+ }.`,
539244
+ );
539200
539245
  const sampleRate = Math.random();
539201
- if (!((_a = this.context) == null ? void 0 : _a.codeBoundaries) && sampleRate > 0.01) return;
539246
+ if (!((_b = this.context) == null ? void 0 : _b.codeBoundaries) && sampleRate > 0.01) return;
539202
539247
  if (sampleRate > 0.25) return;
539203
539248
  const stack = error instanceof Error && typeof error.stack === 'string' ? error.stack : null;
539204
- (_b = window.__framer_events) == null ? void 0 : _b.push(['published_site_load_error', {
539249
+ (_c = window.__framer_events) == null ? void 0 : _c.push(['published_site_load_error', {
539205
539250
  message: String(error,),
539206
539251
  stack,
539207
539252
  },],);
@@ -539213,7 +539258,7 @@ var GracefullyDegradingErrorBoundary = class extends Component {
539213
539258
  const unwrappedError = 'cause' in error ? error.cause : error;
539214
539259
  const closingHTMLComment = /-->/gu;
539215
539260
  const closingHTMLCommentReplacement = '--!>';
539216
- const dom = isBot(navigator.userAgent,) ? ((_a = document.getElementById('main',)) == null ? void 0 : _a.innerHTML) || '' : // @FIXME: We should have a UI for fatal error recovery.
539261
+ const dom = isBot(__unframerNavigator2.userAgent,) ? ((_a = document.getElementById('main',)) == null ? void 0 : _a.innerHTML) || '' : // @FIXME: We should have a UI for fatal error recovery.
539217
539262
  // We don't have a UI for fatal error recovery currently, so we just render nothing for regular users. If we were to throw, React would unmount too.
539218
539263
  // We do render instead of throwing, so that:
539219
539264
  // - `componentDidCatch` runs (if we throw here, it does not)
@@ -539443,8 +539488,8 @@ var preloadedRoutes = /* @__PURE__ */ new Set();
539443
539488
  var routeToNodesInViewport = /* @__PURE__ */ new Map();
539444
539489
  function getObserveRouteForPreloadingFn() {
539445
539490
  var _a;
539446
- const connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection || {};
539447
- const lowDeviceMemory = navigator.deviceMemory && navigator.deviceMemory > LOW_MEMORY_THRESHOLD;
539491
+ const connection = __unframerNavigator2.connection || __unframerNavigator2.mozConnection || __unframerNavigator2.webkitConnection || {};
539492
+ const lowDeviceMemory = __unframerNavigator2.deviceMemory && __unframerNavigator2.deviceMemory > LOW_MEMORY_THRESHOLD;
539448
539493
  let effectiveType, preloadDisabled, maxPreloadAmount;
539449
539494
  function updateConnection() {
539450
539495
  effectiveType = connection.effectiveType || '';
@@ -539959,7 +540004,7 @@ function useReplaceNestedLinks(nodeId, href, propsAddedByLink,) {
539959
540004
  if (!propsAddedByLink.href) return;
539960
540005
  event.preventDefault();
539961
540006
  event.stopPropagation();
539962
- const isAppleDevice = /Mac|iPod|iPhone|iPad/u.test(navigator.userAgent,);
540007
+ const isAppleDevice = /Mac|iPod|iPhone|iPad/u.test(__unframerNavigator2.userAgent,);
539963
540008
  if (isAppleDevice ? event.metaKey : event.ctrlKey) {
539964
540009
  openExternalLink(propsAddedByLink.href, '', '_blank',);
539965
540010
  return;
@@ -546397,11 +546442,11 @@ function useHydratedBreakpointVariants(initial, mediaQueries, hydratedWithInitia
546397
546442
  },);
546398
546443
  }
546399
546444
  }
546400
- }, [instantTransition, forceUpdate, onCanvas,],);
546445
+ }, [instantTransition, forceUpdate,],);
546401
546446
  useIsomorphicLayoutEffect2(() => {
546402
546447
  if (!onCanvas) return;
546403
546448
  setActiveVariantInstant(initial,);
546404
- }, [onCanvas, initial, setActiveVariantInstant,],);
546449
+ }, [initial, setActiveVariantInstant,],);
546405
546450
  useIsomorphicLayoutEffect2(() => {
546406
546451
  if (!hydratedWithInitial || isInitialNavigation !== true) return;
546407
546452
  setActiveVariantInstant(baseVariant.current,);
@@ -546615,7 +546660,7 @@ var gamepadPoller = /* @__PURE__ */ createGamepadPoller();
546615
546660
  var GamepadContext = /* @__PURE__ */ React4.createContext(gamepadPoller,);
546616
546661
  function getGamepadInputs() {
546617
546662
  let firstConnectedGamepad = null;
546618
- const gamepads = navigator.getGamepads();
546663
+ const gamepads = __unframerNavigator2.getGamepads();
546619
546664
  for (const gamepad of gamepads) {
546620
546665
  if (!gamepad) continue;
546621
546666
  if (!firstConnectedGamepad) firstConnectedGamepad = gamepad;
@@ -547384,8 +547429,13 @@ function withCodeBoundaryForOverrides(Component18, {
547384
547429
  const appliedOverride = tryToApplyOverride(Component18, override,);
547385
547430
  let hasErrorBeenLogged = false;
547386
547431
  function CodeBoundaryForOverrides(props, ref,) {
547387
- const externalComponentNestingLevel = useExternalComponentNestingLevel();
547388
- const shouldWrapWithBoundary = shouldWrapOverrideWithBoundary(externalComponentNestingLevel, inComponentSlot ?? false,);
547432
+ const nearestExternalComponent = useNearestExternalComponent();
547433
+ const shouldWrapWithBoundary = shouldWrapOverrideWithBoundary(
547434
+ scopeId,
547435
+ nearestExternalComponent.scopeId,
547436
+ nearestExternalComponent.level,
547437
+ inComponentSlot ?? false,
547438
+ );
547389
547439
  if (shouldWrapWithBoundary) {
547390
547440
  if (appliedOverride.status === 'success') {
547391
547441
  return /* @__PURE__ */ jsx(CodeComponentBoundary, {
@@ -548393,7 +548443,8 @@ function getCustomFontName(fileName, properties,) {
548393
548443
  const fontFamily = font.preferredFamily || font.fontFamily;
548394
548444
  const isAssetVariableFont = Array.isArray(font.variationAxes,);
548395
548445
  if (isAssetVariableFont && fontFamily.toLowerCase().includes('variable',)) return fontFamily;
548396
- const variant = isAssetVariableFont ? 'Variable' : font.preferredSubFamily || font.fontSubFamily;
548446
+ const variant = isAssetVariableFont ? 'Variable' : (font.preferredSubFamily || font.fontSubFamily).trim();
548447
+ if (variant === '') return fontFamily;
548397
548448
  return `${fontFamily} ${variant}`;
548398
548449
  }
548399
548450
  var CustomFontSource = class {
@@ -550057,15 +550108,17 @@ var styles = /* @__PURE__ */ (() => [
550057
550108
  backgroundColor: 'transparent',
550058
550109
  outline: 'none',
550059
550110
  },),
550111
+ css(`.${textInputWrapperClassName} .${inputClassName}::-webkit-datetime-edit`, {
550112
+ // Prevent browsers from improvising the date/time placeholder height.
550113
+ height: css.variable('--framer-input-font-line-height',/* FontLineHeight */
550114
+ ),
550115
+ },),
550060
550116
  css(`.${textInputWrapperClassName} .${inputClassName}.${emptyValueClassName}::-webkit-datetime-edit`, {
550061
550117
  color: css.variable('--framer-input-placeholder-color',/* PlaceholderColor */
550062
550118
  ),
550063
550119
  // This tells safari to use the color for the shadow dom elements.
550064
550120
  '-webkit-text-fill-color': css.variable('--framer-input-placeholder-color',/* PlaceholderColor */
550065
550121
  ),
550066
- // Prevent browsers from improvising the date/time placeholder height.
550067
- height: css.variable('--framer-input-font-line-height',/* FontLineHeight */
550068
- ),
550069
550122
  overflow: 'visible',
550070
550123
  },),
550071
550124
  css(
@@ -553892,19 +553945,11 @@ function useInitialRouteComponent(routes, homeNodeId,) {
553892
553945
  var package_default = {
553893
553946
  name: 'framer',
553894
553947
  version: '2.4.1',
553895
- main: 'build/index.js',
553948
+ private: true,
553896
553949
  type: 'module',
553897
- exports: {
553898
- '.': './build/index.js',
553899
- './package.json': './package.json',
553900
- './*': './build/*',
553901
- },
553902
- files: ['build', 'CHANGELOG.md', 'README.md', 'LICENSE.md', 'postinstall.cjs',],
553903
- types: './build/index.d.ts',
553904
553950
  author: 'Framer',
553905
553951
  license: 'MIT',
553906
553952
  scripts: {
553907
- prepublishOnly: 'make build',
553908
553953
  coverage: 'yarn :jest --coverage',
553909
553954
  lint: 'yarn :eslint ./src --ext .ts,.tsx --format codeframe --quiet --cache',
553910
553955
  'lint:ci': 'yarn :eslint ./src --ext .ts,.tsx --format codeframe --quiet --cache --cache-strategy content',
@@ -553956,20 +554001,6 @@ var package_default = {
553956
554001
  tsdoc: {
553957
554002
  tsdocFlavor: 'AEDoc',
553958
554003
  },
553959
- framer: {
553960
- components: [{
553961
- name: 'Scroll',
553962
- children: true,
553963
- properties: [{
553964
- key: 'direction',
553965
- title: 'Direction',
553966
- kind: 'enum',
553967
- options: ['horizontal', 'vertical', 'both',],
553968
- },],
553969
- }, {
553970
- name: 'Page',
553971
- },],
553972
- },
553973
554004
  browserslist: ['extends @framer/browserslist-config/sites',],
553974
554005
  };
553975
554006
  var version = /* @__PURE__ */ (() => package_default.version)();
package/src/index.ts CHANGED
@@ -9,6 +9,7 @@ export {
9
9
  WithFramerBreakpoints,
10
10
  ContextProviders,
11
11
  AdaptedLink,
12
+ withCSS,
12
13
  } from './react.js'
13
14
 
14
15
  export { Link, ResolveLinks }
package/src/react.tsx CHANGED
@@ -9,6 +9,7 @@ import {
9
9
  useMemo,
10
10
  useSyncExternalStore,
11
11
  } from 'react'
12
+ import { version } from './version.js'
12
13
  import {
13
14
  breakpointsStyles,
14
15
  breakpointsStylesLegacy,
@@ -162,7 +163,10 @@ export const WithFramerBreakpoints = forwardRef(function WithFramerBreakpoints<
162
163
  )
163
164
  } else {
164
165
  variants.set(realVariant, {
165
- className: classNames('unframer unframer-hidden', `unframer-${breakpointName}`),
166
+ className: classNames(
167
+ 'unframer unframer-hidden',
168
+ `unframer-${breakpointName}`,
169
+ ),
166
170
  variant: realVariant,
167
171
  breakpoints: [breakpointName],
168
172
  })
@@ -193,6 +197,7 @@ export const WithFramerBreakpoints = forwardRef(function WithFramerBreakpoints<
193
197
  )
194
198
  },
195
199
  )
200
+ parts.push(<DebugUnframerVersion />)
196
201
 
197
202
  return parts
198
203
  })
@@ -232,6 +237,7 @@ import {
232
237
  FramerLink as Link,
233
238
  } from './framer.js'
234
239
  import React from 'react'
240
+ import { style } from 'real-framer-motion/client'
235
241
 
236
242
  type Routes = Record<string, { path: string }>
237
243
 
@@ -354,3 +360,49 @@ export function ContextProviders({
354
360
  </FetchClientProvider>
355
361
  )
356
362
  }
363
+
364
+ const isFunction = (value: any): value is Function => {
365
+ return typeof value === 'function'
366
+ }
367
+
368
+ var framerCSSMarker = 'data-framer-css-ssr'
369
+
370
+ /**
371
+ * Add Unframer debug information to debug websites using Unframer
372
+ */
373
+ function DebugUnframerVersion() {
374
+ return (
375
+ <details style={{ display: 'none' }}>
376
+ Using{' '}
377
+ <a href='https://unframer.co' className=''>
378
+ Framer React Export
379
+ </a>{' '}
380
+ version {version}
381
+ </details>
382
+ )
383
+ }
384
+
385
+ // overrides the default withCSS which does not work with Astro because it does not simply renders style tags
386
+ export const withCSS = (Component, escapedCSS, componentSerializationId) =>
387
+ forwardRef((props, ref) => {
388
+ const id3 = componentSerializationId
389
+
390
+ if (isFunction(escapedCSS)) escapedCSS = escapedCSS('PREVIEW')
391
+ const concatenatedCSS = Array.isArray(escapedCSS)
392
+ ? escapedCSS.join('\n')
393
+ : escapedCSS
394
+ return (
395
+ <>
396
+ <style
397
+ {...{
398
+ [framerCSSMarker]: true,
399
+ }}
400
+ data-framer-component={id3}
401
+ dangerouslySetInnerHTML={{
402
+ __html: concatenatedCSS,
403
+ }}
404
+ />
405
+ <Component {...props} ref={ref} />
406
+ </>
407
+ )
408
+ })
package/src/version.ts ADDED
@@ -0,0 +1 @@
1
+ export const version = '2.18.2'