unframer 2.25.1 → 2.25.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/dist/framer.js CHANGED
@@ -314,7 +314,7 @@ exports.WithOverride = WithOverride;
314
314
  exports.withPath = withPath;
315
315
  exports.withPerformanceMarks = withPerformanceMarks;
316
316
  exports.withShape = withShape;
317
- exports.yieldUnlessUrgent = yieldUnlessUrgent;
317
+ exports.yieldToMain = yieldToMain;
318
318
  exports.Router = Router;
319
319
  const chunk_A2PMVMFI_js_1 = require("./framer-chunks/chunk-A2PMVMFI.js");
320
320
  // /:https://app.framerstatic.com/chunk-IGW3TQSG.mjs
@@ -10836,7 +10836,7 @@ function stagger(duration = 0.1, { startDelay = 0, from = 0, ease: ease2, } = {}
10836
10836
  return startDelay + delay2;
10837
10837
  };
10838
10838
  }
10839
- // /:https://app.framerstatic.com/framer.V5AO5VTZ.mjs
10839
+ // /:https://app.framerstatic.com/framer.ZDVTUSJ2.mjs
10840
10840
  const react_10 = require("react");
10841
10841
  const react_11 = __importDefault(require("react"));
10842
10842
  const react_12 = require("react");
@@ -12065,49 +12065,6 @@ function getRouteElementId(route, hash2) {
12065
12065
  }
12066
12066
  return void 0;
12067
12067
  }
12068
- function yieldToMain(options) {
12069
- if ('scheduler' in window) {
12070
- if ('yield' in scheduler)
12071
- return scheduler.yield(options);
12072
- if ('postTask' in scheduler)
12073
- return scheduler.postTask(() => { }, options);
12074
- }
12075
- if ((options == null ? void 0 : options.priority) === 'user-blocking') {
12076
- return Promise.resolve();
12077
- }
12078
- return new Promise((resolve) => {
12079
- setTimeout(resolve);
12080
- });
12081
- }
12082
- async function yieldBefore(fn, options) {
12083
- await yieldToMain(options);
12084
- return fn();
12085
- }
12086
- function interactionResponse(options) {
12087
- return new Promise((resolve) => {
12088
- setTimeout(resolve, 100);
12089
- requestAnimationFrame(() => {
12090
- void yieldBefore(resolve, options);
12091
- });
12092
- });
12093
- }
12094
- function useAfterPaintEffect(effectFn, deps, opts, useEffectFn = react_2.useLayoutEffect) {
12095
- useEffectFn(() => {
12096
- const runAfterPaint = async (fn) => {
12097
- await interactionResponse(opts);
12098
- return fn();
12099
- };
12100
- const runPromise = runAfterPaint(effectFn);
12101
- return () => {
12102
- void (async () => {
12103
- const cleanup = await runPromise;
12104
- if (!cleanup)
12105
- return;
12106
- void runAfterPaint(cleanup);
12107
- })();
12108
- };
12109
- }, deps);
12110
- }
12111
12068
  var EMPTY_ARRAY = [];
12112
12069
  function monitorINPRelatedInputs(signal) {
12113
12070
  const inpRelatedInputs = ['pointerdown', 'pointerup', 'keydown', 'keyup',];
@@ -12189,38 +12146,6 @@ supportsRequestIdleCallback ? window.requestIdleCallback : setTimeout)();
12189
12146
  function encodeSVGForCSS(svg) {
12190
12147
  return `url('data:image/svg+xml,${svg.replaceAll('#', '%23').replaceAll('\'', '%27')}')`;
12191
12148
  }
12192
- var shouldPreloadBasedOnUA = !isBot;
12193
- function useRoutePreloader(routeIds, enabled = true) {
12194
- const { getRoute, } = useRouter();
12195
- (0, react_2.useEffect)(() => {
12196
- if (!getRoute || !enabled || !shouldPreloadBasedOnUA)
12197
- return;
12198
- for (const routeId of routeIds) {
12199
- void preloadRoute(getRoute(routeId));
12200
- }
12201
- }, [routeIds, getRoute, enabled,]);
12202
- }
12203
- async function preloadRoute(route) {
12204
- if (!shouldPreloadBasedOnUA || !route)
12205
- return;
12206
- const component = route.page;
12207
- if (!component || !isLazyComponentType(component))
12208
- return;
12209
- await yieldToMain();
12210
- try {
12211
- await component.preload();
12212
- }
12213
- catch (e) {
12214
- if (false)
12215
- console.warn('Preload failed', route, e);
12216
- }
12217
- }
12218
- function useRouteHandler(routeId, preload = false, elementId) {
12219
- const { navigate, } = useRouter();
12220
- useRoutePreloader([routeId,], preload);
12221
- const handler = react_11.default.useCallback(() => navigate == null ? void 0 : navigate(routeId, elementId), [navigate, elementId, routeId,]);
12222
- return handler;
12223
- }
12224
12149
  var mockWindow = {
12225
12150
  addEventListener: () => { },
12226
12151
  removeEventListener: () => { },
@@ -12279,6 +12204,107 @@ var mockWindow = {
12279
12204
  __framer_events: [],
12280
12205
  };
12281
12206
  var safeWindow = !isWindow ? mockWindow : window;
12207
+ var canUseYield = /* @__PURE__ */ (() => safeWindow.scheduler && 'yield' in safeWindow.scheduler)();
12208
+ var canUsePostTask = /* @__PURE__ */ (() => safeWindow.scheduler && 'postTask' in safeWindow.scheduler)();
12209
+ var pendingResolvers = /* @__PURE__ */ new Set();
12210
+ function resolvePendingPromises() {
12211
+ for (const resolve of pendingResolvers)
12212
+ resolve();
12213
+ pendingResolvers.clear();
12214
+ }
12215
+ function yieldUnlessUrgent(options) {
12216
+ return new Promise((resolve) => {
12217
+ pendingResolvers.add(resolve);
12218
+ if (document.hidden) {
12219
+ resolvePendingPromises();
12220
+ return;
12221
+ }
12222
+ document.addEventListener('visibilitychange', resolvePendingPromises);
12223
+ document.addEventListener('pagehide', resolvePendingPromises);
12224
+ frame.read(() => {
12225
+ const resolveFn = () => {
12226
+ var _a;
12227
+ pendingResolvers.delete(resolve);
12228
+ if ((_a = options == null ? void 0 : options.signal) == null ? void 0 : _a.aborted)
12229
+ return;
12230
+ resolve();
12231
+ };
12232
+ void schedulerYield(options).then(resolveFn);
12233
+ });
12234
+ return;
12235
+ });
12236
+ }
12237
+ function interactionResponse(options) {
12238
+ return new Promise((resolve) => {
12239
+ setTimeout(resolve, 100);
12240
+ frame.read(() => {
12241
+ void schedulerYield(options).then(resolve);
12242
+ });
12243
+ });
12244
+ }
12245
+ function schedulerYield(options) {
12246
+ const priority = options == null ? void 0 : options.priority;
12247
+ const canUseModernAPI = canUseYield || canUsePostTask;
12248
+ if (!canUseModernAPI) {
12249
+ if (priority === 'user-blocking') {
12250
+ return Promise.resolve();
12251
+ }
12252
+ return new Promise((resolve) => {
12253
+ setTimeout(resolve, priority === 'background' ? 1 : 0);
12254
+ });
12255
+ }
12256
+ if (priority === 'background') {
12257
+ return new Promise((resolve) => {
12258
+ setTimeout(resolve, 1);
12259
+ });
12260
+ }
12261
+ if (canUseYield) {
12262
+ return safeWindow.scheduler.yield(options).catch(noop2);
12263
+ }
12264
+ return safeWindow.scheduler.postTask(() => { }, options).catch(noop2);
12265
+ }
12266
+ function yieldToMain(options) {
12267
+ const { continueAfter, ensureContinueBeforeUnload, ...schedulerOptions } = options ?? {};
12268
+ if (ensureContinueBeforeUnload) {
12269
+ return yieldUnlessUrgent(schedulerOptions);
12270
+ }
12271
+ if (continueAfter === 'paint') {
12272
+ return interactionResponse(schedulerOptions);
12273
+ }
12274
+ return schedulerYield(schedulerOptions);
12275
+ }
12276
+ var shouldPreloadBasedOnUA = !isBot;
12277
+ function useRoutePreloader(routeIds, enabled = true) {
12278
+ const { getRoute, } = useRouter();
12279
+ (0, react_2.useEffect)(() => {
12280
+ if (!getRoute || !enabled || !shouldPreloadBasedOnUA)
12281
+ return;
12282
+ for (const routeId of routeIds) {
12283
+ void preloadRoute(getRoute(routeId));
12284
+ }
12285
+ }, [routeIds, getRoute, enabled,]);
12286
+ }
12287
+ async function preloadRoute(route) {
12288
+ if (!shouldPreloadBasedOnUA || !route)
12289
+ return;
12290
+ const component = route.page;
12291
+ if (!component || !isLazyComponentType(component))
12292
+ return;
12293
+ await yieldToMain();
12294
+ try {
12295
+ await component.preload();
12296
+ }
12297
+ catch (e) {
12298
+ if (false)
12299
+ console.warn('Preload failed', route, e);
12300
+ }
12301
+ }
12302
+ function useRouteHandler(routeId, preload = false, elementId) {
12303
+ const { navigate, } = useRouter();
12304
+ useRoutePreloader([routeId,], preload);
12305
+ const handler = react_11.default.useCallback(() => navigate == null ? void 0 : navigate(routeId, elementId), [navigate, elementId, routeId,]);
12306
+ return handler;
12307
+ }
12282
12308
  var timezone;
12283
12309
  var visitorLocale;
12284
12310
  function setTimezoneAndLocaleForTracking() {
@@ -13022,6 +13048,26 @@ var announceNavigation = () => {
13022
13048
  announceDiv.textContent = document.title;
13023
13049
  }, 60);
13024
13050
  };
13051
+ function useAfterPaintEffect(effectFn, deps, options, useEffectFn = react_2.useLayoutEffect) {
13052
+ useEffectFn(() => {
13053
+ const runAfterPaint = async (fn) => {
13054
+ await yieldToMain({
13055
+ ...options,
13056
+ continueAfter: 'paint',
13057
+ });
13058
+ return fn();
13059
+ };
13060
+ const runPromise = runAfterPaint(effectFn);
13061
+ return () => {
13062
+ void (async () => {
13063
+ const cleanup = await runPromise;
13064
+ if (!cleanup)
13065
+ return;
13066
+ void runAfterPaint(cleanup);
13067
+ })();
13068
+ };
13069
+ }, deps);
13070
+ }
13025
13071
  function useMonitorNextPaintAfterRender(label) {
13026
13072
  const resolveHasPainted = (0, react_4.useRef)(void 0);
13027
13073
  useAfterPaintEffect(() => {
@@ -13775,7 +13821,7 @@ function useMarkSuspenseEffectsStart() {
13775
13821
  wasInBackground = true;
13776
13822
  return;
13777
13823
  }
13778
- requestAnimationFrame(() => {
13824
+ frame.read(() => {
13779
13825
  hydrationMarker == null ? void 0 : hydrationMarker.browserRendering.requestAnimationFrame.markStart();
13780
13826
  hydrationMarker == null ? void 0 : hydrationMarker.unattributedHydrationOverhead.measure();
13781
13827
  });
@@ -13796,9 +13842,9 @@ function useMarkSuspenseEffectEnd() {
13796
13842
  hydrationMarker == null ? void 0 : hydrationMarker.useLayoutEffects.markEnd();
13797
13843
  if (wasInBackground || document.visibilityState !== 'visible')
13798
13844
  return;
13799
- requestAnimationFrame(() => {
13845
+ frame.read(() => {
13800
13846
  hydrationMarker == null ? void 0 : hydrationMarker.browserRendering.requestAnimationFrame.markEnd();
13801
- void yieldBefore(() => {
13847
+ void yieldToMain().then(() => {
13802
13848
  hydrationMarker == null ? void 0 : hydrationMarker.browserRendering.layoutStylePaint.markEnd();
13803
13849
  });
13804
13850
  });
@@ -26638,7 +26684,7 @@ function collectBoxShadowsForProps(props, style2) {
26638
26684
  return;
26639
26685
  style2.boxShadow = boxShadow;
26640
26686
  }
26641
- function shadowForShape(boxShadows, rect, shapeId, fillAlpha, strokeAlpha, strokeWidth, strokeClipId, svgStrokeAttributes) {
26687
+ function shadowForShape(boxShadows, rect, shapeId, strokeAlpha, strokeWidth, strokeClipId, svgStrokeAttributes) {
26642
26688
  const definition = [];
26643
26689
  let outsetElement = null;
26644
26690
  let insetElement = null;
@@ -26687,8 +26733,8 @@ function shadowForShape(boxShadows, rect, shapeId, fillAlpha, strokeAlpha, strok
26687
26733
  miter = 4;
26688
26734
  let shadowRect = Rect.merge(...shadowRects);
26689
26735
  shadowRect = Rect.inflate(shadowRect, (expandStrokeWidth * miter / 2 + maxBlur) * 1.1);
26690
- const width = rect.width + (strokeWidth ? strokeWidth / 2 : 0.1);
26691
- const height = rect.height + (strokeWidth ? strokeWidth / 2 : 0.1);
26736
+ const width = rect.width + (strokeWidth ? strokeWidth / 2 : 0);
26737
+ const height = rect.height + (strokeWidth ? strokeWidth / 2 : 0);
26692
26738
  const filterX = shadowRect.x / width * 100;
26693
26739
  const filterY = shadowRect.y / height * 100;
26694
26740
  const filterWidth = shadowRect.width / width * 100;
@@ -26735,7 +26781,6 @@ function shadowForShape(boxShadows, rect, shapeId, fillAlpha, strokeAlpha, strok
26735
26781
  children: /* @__PURE__ */ (0, jsx_runtime_1.jsx)('use', {
26736
26782
  ...svgStrokeAttributes,
26737
26783
  fill: 'black',
26738
- fillOpacity: fillAlpha <= 0 ? 0 : 1,
26739
26784
  stroke: 'black',
26740
26785
  strokeOpacity: strokeAlpha <= 0 ? 0 : 1,
26741
26786
  strokeWidth: strokeAlpha > 0 ? strokeWidth : 0,
@@ -26813,17 +26858,12 @@ function shadowForShape(boxShadows, rect, shapeId, fillAlpha, strokeAlpha, strok
26813
26858
  }
26814
26859
  function outerShadowElements(shapeID, shadow, index) {
26815
26860
  const shadowKey = shapeID.add('_outer_shadow' + index);
26816
- const offsetResultId = shadowKey.add('offset').id;
26817
- const blurResultId = shadowKey.add('blur').id;
26818
- const matrixResultId = shadowKey.add('matrix').id;
26819
26861
  const filterElements = /* @__PURE__ */ (0, jsx_runtime_1.jsx)(OuterShadowFilterElements, {
26820
26862
  shadow,
26821
- blurId: blurResultId,
26822
- offsetId: offsetResultId,
26823
- matrixId: matrixResultId,
26863
+ shadowKey,
26824
26864
  }, shadowKey.id + '-filters');
26825
26865
  const mergeElement = /* @__PURE__ */ (0, jsx_runtime_1.jsx)('feMergeNode', {
26826
- in: matrixResultId,
26866
+ in: shadowKey.id,
26827
26867
  }, shadowKey.id + '-merge');
26828
26868
  return {
26829
26869
  filterElements,
@@ -26831,13 +26871,10 @@ function outerShadowElements(shapeID, shadow, index) {
26831
26871
  };
26832
26872
  }
26833
26873
  var OuterShadowFilterElements = (props) => {
26834
- const { shadow, blurId, offsetId, matrixId, } = props;
26835
- const color2 = shadow.color;
26836
- const rgb = ConvertColor.toRgb(color2);
26837
- const r = roundedNumberString(rgb.r / 255, 3);
26838
- const g = roundedNumberString(rgb.g / 255, 3);
26839
- const b = roundedNumberString(rgb.b / 255, 3);
26840
- const matrixValues = `0 0 0 0 ${r} 0 0 0 0 ${g} 0 0 0 0 ${b} 0 0 0 ${rgb.a} 0`;
26874
+ const { shadow, shadowKey, } = props;
26875
+ const offsetId = shadowKey.add('offset').id;
26876
+ const blurId = shadowKey.add('blur').id;
26877
+ const floodId = shadowKey.add('flood').id;
26841
26878
  return /* @__PURE__ */ (0, jsx_runtime_2.jsxs)(jsx_runtime_1.Fragment, {
26842
26879
  children: [
26843
26880
  /* @__PURE__ */ (0, jsx_runtime_1.jsx)('feOffset', {
@@ -26851,31 +26888,27 @@ var OuterShadowFilterElements = (props) => {
26851
26888
  in: offsetId,
26852
26889
  result: blurId,
26853
26890
  }),
26854
- /* @__PURE__ */ (0, jsx_runtime_1.jsx)('feColorMatrix', {
26855
- colorInterpolationFilters: 'sRGB',
26856
- values: matrixValues,
26857
- type: 'matrix',
26858
- in: blurId,
26859
- result: matrixId,
26891
+ /* @__PURE__ */ (0, jsx_runtime_1.jsx)('feFlood', {
26892
+ floodColor: shadow.color,
26893
+ result: floodId,
26894
+ }),
26895
+ /* @__PURE__ */ (0, jsx_runtime_1.jsx)('feComposite', {
26896
+ in: floodId,
26897
+ in2: blurId,
26898
+ operator: 'in',
26899
+ result: shadowKey.id,
26860
26900
  }),
26861
26901
  ],
26862
26902
  });
26863
26903
  };
26864
26904
  function innerShadowElements(shapeID, shadow, index) {
26865
26905
  const shadowKey = shapeID.add('_inside_shadow' + index);
26866
- const blurId = shadowKey.add('blur').id;
26867
- const offsetId = shadowKey.add('offset').id;
26868
- const compositeId = shadowKey.add('composite').id;
26869
- const matrixId = shadowKey.add('matrix').id;
26870
26906
  const filterElements = /* @__PURE__ */ (0, jsx_runtime_1.jsx)(InnerShadowFilterElements, {
26871
26907
  shadow,
26872
- blurId,
26873
- offsetId,
26874
- compositeId,
26875
- matrixId,
26908
+ shadowKey,
26876
26909
  }, shadowKey.id + '-filters');
26877
26910
  const mergeElement = /* @__PURE__ */ (0, jsx_runtime_1.jsx)('feMergeNode', {
26878
- in: matrixId,
26911
+ in: shadowKey.id,
26879
26912
  }, shadowKey.id + '-merge');
26880
26913
  return {
26881
26914
  filterElements,
@@ -26883,13 +26916,11 @@ function innerShadowElements(shapeID, shadow, index) {
26883
26916
  };
26884
26917
  }
26885
26918
  var InnerShadowFilterElements = (props) => {
26886
- const { shadow, blurId, offsetId, compositeId, matrixId, } = props;
26887
- const color2 = shadow.color;
26888
- const rgb = ConvertColor.toRgb(color2);
26889
- const r = rgb.r / 255;
26890
- const g = rgb.g / 255;
26891
- const b = rgb.b / 255;
26892
- const matrixValues = `0 0 0 0 ${r} 0 0 0 0 ${g} 0 0 0 0 ${b} 0 0 0 ${rgb.a} 0`;
26919
+ const { shadow, shadowKey, } = props;
26920
+ const blurId = shadowKey.add('blur').id;
26921
+ const offsetId = shadowKey.add('offset').id;
26922
+ const compositeId = shadowKey.add('composite').id;
26923
+ const floodId = shadowKey.add('flood').id;
26893
26924
  return /* @__PURE__ */ (0, jsx_runtime_2.jsxs)(jsx_runtime_1.Fragment, {
26894
26925
  children: [
26895
26926
  /* @__PURE__ */ (0, jsx_runtime_1.jsx)('feGaussianBlur', {
@@ -26911,12 +26942,15 @@ var InnerShadowFilterElements = (props) => {
26911
26942
  k3: '1',
26912
26943
  result: compositeId,
26913
26944
  }),
26914
- /* @__PURE__ */ (0, jsx_runtime_1.jsx)('feColorMatrix', {
26915
- colorInterpolationFilters: 'sRGB',
26916
- values: matrixValues,
26917
- type: 'matrix',
26918
- in: compositeId,
26919
- result: matrixId,
26945
+ /* @__PURE__ */ (0, jsx_runtime_1.jsx)('feFlood', {
26946
+ floodColor: shadow.color,
26947
+ result: floodId,
26948
+ }),
26949
+ /* @__PURE__ */ (0, jsx_runtime_1.jsx)('feComposite', {
26950
+ in: floodId,
26951
+ in2: compositeId,
26952
+ operator: 'in',
26953
+ result: shadowKey.id,
26920
26954
  }),
26921
26955
  ],
26922
26956
  });
@@ -33029,6 +33063,9 @@ function Floating({ alignment, placement, safeArea, offsetX, offsetY, anchorRef,
33029
33063
  ref: floatingPositionRef,
33030
33064
  className: className2,
33031
33065
  style: {
33066
+ // Start from the top left of the screen to prevent jumps.
33067
+ top: 0,
33068
+ left: 0,
33032
33069
  // Initially rendered as hidden, but the layout effect will set
33033
33070
  // to visible when the position is calculated.
33034
33071
  visibility: 'hidden',
@@ -33091,7 +33128,7 @@ var GracefullyDegradingErrorBoundary = class extends react_9.Component {
33091
33128
 
33092
33129
  `, error);
33093
33130
  const sampleRate = Math.random();
33094
- if (sampleRate > 0.5)
33131
+ if (sampleRate > 0.25)
33095
33132
  return;
33096
33133
  const stack = error instanceof Error && typeof error.stack === 'string' ? error.stack : null;
33097
33134
  sendTrackingEvent('published_site_load_error', {
@@ -33205,50 +33242,6 @@ function findAnchorElement(target, withinElement) {
33205
33242
  }
33206
33243
  return null;
33207
33244
  }
33208
- var pendingResolvers = /* @__PURE__ */ new Set();
33209
- function resolvePendingPromises() {
33210
- for (const resolve of pendingResolvers)
33211
- resolve();
33212
- pendingResolvers.clear();
33213
- }
33214
- var canUseYield = /* @__PURE__ */ (() => safeWindow.scheduler && 'yield' in safeWindow.scheduler)();
33215
- var canUsePostTask = /* @__PURE__ */ (() => safeWindow.scheduler && 'postTask' in safeWindow.scheduler)();
33216
- function yieldUnlessUrgent(options) {
33217
- return new Promise((resolve) => {
33218
- pendingResolvers.add(resolve);
33219
- if (document.hidden) {
33220
- resolvePendingPromises();
33221
- return;
33222
- }
33223
- document.addEventListener('visibilitychange', resolvePendingPromises);
33224
- document.addEventListener('pagehide', resolvePendingPromises);
33225
- requestAnimationFrame(() => {
33226
- const resolveFn = () => {
33227
- var _a;
33228
- pendingResolvers.delete(resolve);
33229
- if ((_a = options == null ? void 0 : options.signal) == null ? void 0 : _a.aborted)
33230
- return;
33231
- resolve();
33232
- };
33233
- const priority = options == null ? void 0 : options.priority;
33234
- const canUseModernAPI = canUseYield || canUsePostTask;
33235
- if (!canUseModernAPI) {
33236
- if (priority === 'user-blocking')
33237
- return resolveFn();
33238
- return setTimeout(resolveFn, priority === 'background' ? 1 : 0);
33239
- }
33240
- if (priority === 'background') {
33241
- return setTimeout(resolveFn, 1);
33242
- }
33243
- if (canUseYield) {
33244
- safeWindow.scheduler.yield(options).then(resolveFn).catch(noop2);
33245
- return;
33246
- }
33247
- safeWindow.scheduler.postTask(resolveFn, options).catch(noop2);
33248
- });
33249
- return;
33250
- });
33251
- }
33252
33245
  function ChildrenCanSuspend({ children, }) {
33253
33246
  return /* @__PURE__ */ (0, jsx_runtime_1.jsx)(SuspenseThatPreservesDom, {
33254
33247
  children,
@@ -33983,8 +33976,10 @@ function createOnClickLinkHandler(router, routeId, href, trackLinkClick, element
33983
33976
  const shouldPerformNavigation = !usedMetaKey && !isExternalLink;
33984
33977
  const track = () => void trackLinkClick(href);
33985
33978
  if (!shouldPerformNavigation) {
33986
- await yieldUnlessUrgent({
33979
+ await yieldToMain({
33987
33980
  priority: 'user-blocking',
33981
+ ensureContinueBeforeUnload: true,
33982
+ continueAfter: 'paint',
33988
33983
  });
33989
33984
  track();
33990
33985
  return;
@@ -34370,8 +34365,9 @@ var FormContainer = /* @__PURE__ */ react_11.default.forwardRef(function FormCon
34370
34365
  type: 'submit',
34371
34366
  });
34372
34367
  const data2 = new FormData(event.currentTarget);
34373
- await interactionResponse({
34368
+ await yieldToMain({
34374
34369
  priority: 'user-blocking',
34370
+ continueAfter: 'paint',
34375
34371
  });
34376
34372
  addUTMTagsToFormData(data2, safeWindow.document);
34377
34373
  for (const [key7, value,] of data2) {
@@ -34415,8 +34411,9 @@ var FormContainer = /* @__PURE__ */ react_11.default.forwardRef(function FormCon
34415
34411
  };
34416
34412
  const checkValidity = async (e) => {
34417
34413
  const target = e.currentTarget;
34418
- await interactionResponse({
34414
+ await yieldToMain({
34419
34415
  priority: 'background',
34416
+ continueAfter: 'paint',
34420
34417
  });
34421
34418
  (0, react_12.startTransition)(() => dispatch({
34422
34419
  type: anyEmptyRequiredFields(target) ? 'incomplete' : 'complete',
@@ -34656,6 +34653,10 @@ function Router({ defaultPageStyle, disableHistory, initialPathVariables, initia
34656
34653
  const nextRender = monitorNextPaintAfterRender({
34657
34654
  localized: true,
34658
34655
  });
34656
+ await yieldToMain({
34657
+ priority: 'user-blocking',
34658
+ continueAfter: 'paint',
34659
+ });
34659
34660
  let localeId;
34660
34661
  if (isString(localeOrLocaleId)) {
34661
34662
  localeId = localeOrLocaleId;
@@ -34744,11 +34745,14 @@ function Router({ defaultPageStyle, disableHistory, initialPathVariables, initia
34744
34745
  preloaded: hasRendered ? void 0 : routeStatus == null ? void 0 : routeStatus.hasLoaded,
34745
34746
  });
34746
34747
  const executeBeforeUrlUpdate = executeBeforeUrlUpdateOnce(beforeUrlUpdate);
34747
- void yieldUnlessUrgent({
34748
+ void yieldToMain({
34748
34749
  priority: 'background',
34750
+ ensureContinueBeforeUnload: true,
34751
+ continueAfter: 'paint',
34749
34752
  }).then(executeBeforeUrlUpdate);
34750
- await interactionResponse({
34753
+ await yieldToMain({
34751
34754
  priority: 'user-blocking',
34755
+ continueAfter: 'paint',
34752
34756
  });
34753
34757
  if (pathVariables) {
34754
34758
  const inUse = /* @__PURE__ */ new Set();
@@ -40522,11 +40526,14 @@ function useOnAppear(callback) {
40522
40526
  default: callback,
40523
40527
  });
40524
40528
  }
40525
- async function setOverflow(blockDocumentScrolling, show, yieldBefore2 = true) {
40529
+ async function setOverflow(blockDocumentScrolling, show, yieldBefore = true) {
40526
40530
  if (blockDocumentScrolling === false)
40527
40531
  return;
40528
- if (yieldBefore2)
40529
- await interactionResponse();
40532
+ if (yieldBefore) {
40533
+ await yieldToMain({
40534
+ continueAfter: 'paint',
40535
+ });
40536
+ }
40530
40537
  frame.render(() => {
40531
40538
  const htmlStyle = document.documentElement.style;
40532
40539
  if (show) {
@@ -40948,22 +40955,48 @@ function useUpdateIfVisible(ref) {
40948
40955
  runUpdateIfPageIsVisible(runUpdate);
40949
40956
  }, [runUpdateIfPageIsVisible, runUpdateIfElementIsInView, ref,]);
40950
40957
  }
40958
+ var globalWaitingForClickPromise;
40959
+ var globalWaitingForClickResolve;
40960
+ async function getPromiseWithFallback() {
40961
+ return new Promise((resolve) => {
40962
+ const resolveFn = () => {
40963
+ resolve();
40964
+ clearTimeout(timeout);
40965
+ };
40966
+ const timeout = setTimeout(resolveFn, 150);
40967
+ globalWaitingForClickResolve = resolveFn;
40968
+ });
40969
+ }
40970
+ function globalWaitForClickListener(event) {
40971
+ if (event.button === 0) {
40972
+ globalWaitingForClickPromise = getPromiseWithFallback();
40973
+ }
40974
+ }
40975
+ function globalClickReceivedListener() {
40976
+ globalWaitingForClickPromise = void 0;
40977
+ globalWaitingForClickResolve == null ? void 0 : globalWaitingForClickResolve();
40978
+ globalWaitingForClickResolve = void 0;
40979
+ }
40980
+ function useWaitForGlobalClick(enabled = false) {
40981
+ (0, react_2.useEffect)(() => {
40982
+ if (!enabled)
40983
+ return;
40984
+ document.addEventListener('pointerup', globalWaitForClickListener, true);
40985
+ document.__proto__.addEventListener.call(document, 'click', globalClickReceivedListener, true);
40986
+ }, [enabled,]);
40987
+ }
40951
40988
  function useVariantState({ variant, defaultVariant: externalDefaultVariant, transitions: externalTransitions, enabledGestures: externalEnabledGestures, cycleOrder: externalCycleOrder = [], variantProps: variantProps2 = {}, variantClassNames = {}, ref, }) {
40952
40989
  const forceUpdate = useForceUpdate2();
40953
40990
  const isCanvas = useIsOnFramerCanvas();
40954
40991
  const validBaseVariants = useConstant2(() => new Set(externalCycleOrder));
40955
- const { pauseOffscreen: pauseOffscreenFeatureOn, } = useLibraryFeatures();
40956
- const update = (0, react_3.useCallback)((useTransition) => {
40957
- if (useTransition) {
40958
- (0, react_12.startTransition)(() => void forceUpdate());
40959
- return;
40960
- }
40961
- forceUpdate();
40962
- }, [forceUpdate,]);
40992
+ const { pauseOffscreen: pauseOffscreenFeatureOn, yieldOnTap: yieldOnTapFeatureOn, } = useLibraryFeatures();
40993
+ useWaitForGlobalClick(yieldOnTapFeatureOn);
40963
40994
  const runUpdateIfVisible = useUpdateIfVisible(ref);
40964
40995
  const internalState = (0, react_4.useRef)({
40965
40996
  isHovered: false,
40997
+ isHoveredHasUpdated: false,
40966
40998
  isPressed: false,
40999
+ isPressedHasUpdated: false,
40967
41000
  isError: false,
40968
41001
  hasPressedVariants: true,
40969
41002
  baseVariant: safeBaseVariant(variant, externalDefaultVariant, validBaseVariants),
@@ -40972,7 +41005,7 @@ function useVariantState({ variant, defaultVariant: externalDefaultVariant, tran
40972
41005
  loadedBaseVariant: {},
40973
41006
  // When used in generated components, these are static values defined
40974
41007
  // outside of the component function that also need to not result in
40975
- // memoized values being recalculated, so we dump them into the ref.
41008
+ // memorized values being recalculated, so we dump them into the ref.
40976
41009
  defaultVariant: externalDefaultVariant,
40977
41010
  enabledGestures: externalEnabledGestures,
40978
41011
  cycleOrder: externalCycleOrder,
@@ -40985,7 +41018,7 @@ function useVariantState({ variant, defaultVariant: externalDefaultVariant, tran
40985
41018
  const nextGestureVariant = gesture ? createGestureVariant(nextBaseVariant, gesture) : void 0;
40986
41019
  return [nextBaseVariant, nextGestureVariant,];
40987
41020
  }, []);
40988
- const updateIfNeeded = (0, react_3.useCallback)((baseVariant2, gestureVariant2, defaultVariant2, nextBaseVariant, isError2 = false, checkViewport = false, highPriority = false, clearError = false) => {
41021
+ const updateIfNeeded = (0, react_3.useCallback)(async (baseVariant2, gestureVariant2, defaultVariant2, nextBaseVariant, checkViewport = false, clearError = false) => {
40989
41022
  const [nextBase, nextGesture,] = resolveNextVariant(nextBaseVariant);
40990
41023
  if (nextBase === baseVariant2 && nextGesture === gestureVariant2)
40991
41024
  return;
@@ -40993,9 +41026,26 @@ function useVariantState({ variant, defaultVariant: externalDefaultVariant, tran
40993
41026
  internalState.current.isError = false;
40994
41027
  internalState.current.baseVariant = nextBase || defaultVariant2;
40995
41028
  internalState.current.gestureVariant = nextGesture;
40996
- runUpdateIfVisible(() => update(!highPriority || isError2), pauseOffscreenFeatureOn && checkViewport);
40997
- }, [resolveNextVariant, update, runUpdateIfVisible, pauseOffscreenFeatureOn,]);
41029
+ const yieldOnTap = yieldOnTapFeatureOn && internalState.current.isPressedHasUpdated;
41030
+ if (yieldOnTap && globalWaitingForClickPromise) {
41031
+ await globalWaitingForClickPromise;
41032
+ }
41033
+ if (yieldOnTap) {
41034
+ await yieldToMain({
41035
+ priority: 'user-blocking',
41036
+ continueAfter: 'paint',
41037
+ });
41038
+ }
41039
+ const { isHovered: isHovered2, isPressed: isPressed2, isHoveredHasUpdated, isPressedHasUpdated, } = internalState.current;
41040
+ if (isHovered2 || isHoveredHasUpdated || isPressed2 || isPressedHasUpdated) {
41041
+ (0, react_12.startTransition)(forceUpdate);
41042
+ return;
41043
+ }
41044
+ runUpdateIfVisible(() => (0, react_12.startTransition)(forceUpdate), pauseOffscreenFeatureOn && checkViewport);
41045
+ }, [resolveNextVariant, forceUpdate, runUpdateIfVisible, pauseOffscreenFeatureOn, yieldOnTapFeatureOn,]);
40998
41046
  const setGestureState = (0, react_3.useCallback)(({ isHovered: isHovered2, isPressed: isPressed2, isError: isError2, }) => {
41047
+ const isPressedHasUpdated = isPressed2 !== internalState.current.isPressed;
41048
+ const isHoveredHasUpdated = isHovered2 !== internalState.current.isHovered;
40999
41049
  if (isHovered2 !== void 0)
41000
41050
  internalState.current.isHovered = isHovered2;
41001
41051
  if (isPressed2 !== void 0)
@@ -41003,21 +41053,22 @@ function useVariantState({ variant, defaultVariant: externalDefaultVariant, tran
41003
41053
  if (isError2 !== void 0)
41004
41054
  internalState.current.isError = isError2;
41005
41055
  const { baseVariant: baseVariant2, gestureVariant: gestureVariant2, defaultVariant: defaultVariant2, } = internalState.current;
41006
- const visibleUserInteraction = isPressed2 || isHovered2;
41007
- updateIfNeeded(baseVariant2, gestureVariant2, defaultVariant2, baseVariant2, isError2, !visibleUserInteraction, isHovered2);
41056
+ internalState.current.isPressedHasUpdated = isPressedHasUpdated;
41057
+ internalState.current.isHoveredHasUpdated = isHoveredHasUpdated;
41058
+ void updateIfNeeded(baseVariant2, gestureVariant2, defaultVariant2, baseVariant2, false);
41008
41059
  }, [updateIfNeeded,]);
41009
41060
  const setVariant = (0, react_3.useCallback)((proposedVariant, pauseOffscreen = false) => {
41010
41061
  const { defaultVariant: defaultVariant2, cycleOrder, baseVariant: baseVariant2, gestureVariant: gestureVariant2, } = internalState.current;
41011
41062
  const nextBaseVariant = proposedVariant === CycleVariantState
41012
41063
  ? nextVariant(cycleOrder || [], baseVariant2 || defaultVariant2)
41013
41064
  : proposedVariant;
41014
- updateIfNeeded(baseVariant2, gestureVariant2, defaultVariant2, nextBaseVariant, false, pauseOffscreen, false, true);
41065
+ void updateIfNeeded(baseVariant2, gestureVariant2, defaultVariant2, nextBaseVariant, pauseOffscreen, true);
41015
41066
  }, [updateIfNeeded,]);
41016
41067
  const clearLoadingGesture = (0, react_3.useCallback)(() => {
41017
41068
  const { baseVariant: baseVariant2, } = internalState.current;
41018
41069
  internalState.current.loadedBaseVariant[baseVariant2] = true;
41019
- runUpdateIfVisible(() => update(true), true);
41020
- }, [update, runUpdateIfVisible,]);
41070
+ runUpdateIfVisible(() => (0, react_12.startTransition)(forceUpdate), true);
41071
+ }, [forceUpdate, runUpdateIfVisible,]);
41021
41072
  if (variant !== internalState.current.lastVariant) {
41022
41073
  const [nextBase, nextGesture,] = resolveNextVariant(variant);
41023
41074
  internalState.current.lastVariant = nextBase;
@@ -43693,7 +43744,9 @@ var PlainTextInput = /* @__PURE__ */ (0, react_7.forwardRef)(function FormPlainT
43693
43744
  setPrevDefaultValue(defaultValue);
43694
43745
  }
43695
43746
  const handleChange = (0, react_3.useCallback)(async (e) => {
43696
- await interactionResponse();
43747
+ await yieldToMain({
43748
+ continueAfter: 'paint',
43749
+ });
43697
43750
  const newValue = e.target.value;
43698
43751
  onChange == null ? void 0 : onChange(e);
43699
43752
  (0, react_12.startTransition)(() => setHasValue(!!newValue));
@@ -45452,7 +45505,7 @@ var SharedSVGManager = class {
45452
45505
  * VECTOR @TODO - Unsubscribe from vector set items.
45453
45506
  */
45454
45507
  template(id3, svg) {
45455
- const entry = this.vectorSetItems.get(svg);
45508
+ const entry = this.vectorSetItems.get(id3);
45456
45509
  if (entry)
45457
45510
  return `#${entry.id}`;
45458
45511
  this.vectorSetItems.set(id3, {
@@ -46760,7 +46813,7 @@ var Vector = /* @__PURE__ */ (() => {
46760
46813
  }
46761
46814
  const internalShapeId = InternalID.forKey(id3);
46762
46815
  const internalStrokeClipId = InternalID.forKey(strokeClipId);
46763
- const shadow = shadowForShape(shadows, rect, internalShapeId, fillAlpha, strokeAlpha, strokeWidth, internalStrokeClipId, svgStrokeAttributes);
46816
+ const shadow = shadowForShape(shadows, rect, internalShapeId, strokeAlpha, strokeWidth, internalStrokeClipId, svgStrokeAttributes);
46764
46817
  const currentName = target === RenderTarget.preview ? name || void 0 : void 0;
46765
46818
  if (shadow.insetElement !== null || shadow.outsetElement !== null || insideStroke) {
46766
46819
  pathAttributes.id = internalShapeId.id;