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/src/framer.js CHANGED
@@ -11104,7 +11104,7 @@ function stagger(duration = 0.1, {
11104
11104
  };
11105
11105
  }
11106
11106
 
11107
- // /:https://app.framerstatic.com/framer.V5AO5VTZ.mjs
11107
+ // /:https://app.framerstatic.com/framer.ZDVTUSJ2.mjs
11108
11108
  import { lazy as ReactLazy, } from 'react';
11109
11109
  import React4 from 'react';
11110
11110
  import { startTransition as startTransition2, } from 'react';
@@ -12294,46 +12294,6 @@ function getRouteElementId(route, hash2,) {
12294
12294
  }
12295
12295
  return void 0;
12296
12296
  }
12297
- function yieldToMain(options,) {
12298
- if ('scheduler' in window) {
12299
- if ('yield' in scheduler) return scheduler.yield(options,);
12300
- if ('postTask' in scheduler) return scheduler.postTask(() => {}, options,);
12301
- }
12302
- if ((options == null ? void 0 : options.priority) === 'user-blocking') {
12303
- return Promise.resolve();
12304
- }
12305
- return new Promise((resolve) => {
12306
- setTimeout(resolve,);
12307
- },);
12308
- }
12309
- async function yieldBefore(fn, options,) {
12310
- await yieldToMain(options,);
12311
- return fn();
12312
- }
12313
- function interactionResponse(options,) {
12314
- return new Promise((resolve) => {
12315
- setTimeout(resolve, 100,);
12316
- requestAnimationFrame(() => {
12317
- void yieldBefore(resolve, options,);
12318
- },);
12319
- },);
12320
- }
12321
- function useAfterPaintEffect(effectFn, deps, opts, useEffectFn = useLayoutEffect,) {
12322
- useEffectFn(() => {
12323
- const runAfterPaint = async (fn) => {
12324
- await interactionResponse(opts,);
12325
- return fn();
12326
- };
12327
- const runPromise = runAfterPaint(effectFn,);
12328
- return () => {
12329
- void (async () => {
12330
- const cleanup = await runPromise;
12331
- if (!cleanup) return;
12332
- void runAfterPaint(cleanup,);
12333
- })();
12334
- };
12335
- }, deps,);
12336
- }
12337
12297
  var EMPTY_ARRAY = [];
12338
12298
  function monitorINPRelatedInputs(signal,) {
12339
12299
  const inpRelatedInputs = ['pointerdown', 'pointerup', 'keydown', 'keyup',];
@@ -12413,37 +12373,6 @@ var requestIdleCallback = /* @__PURE__ */ (() =>
12413
12373
  function encodeSVGForCSS(svg,) {
12414
12374
  return `url('data:image/svg+xml,${svg.replaceAll('#', '%23',).replaceAll('\'', '%27',)}')`;
12415
12375
  }
12416
- var shouldPreloadBasedOnUA = !isBot;
12417
- function useRoutePreloader(routeIds, enabled = true,) {
12418
- const {
12419
- getRoute,
12420
- } = useRouter();
12421
- useEffect(() => {
12422
- if (!getRoute || !enabled || !shouldPreloadBasedOnUA) return;
12423
- for (const routeId of routeIds) {
12424
- void preloadRoute(getRoute(routeId,),);
12425
- }
12426
- }, [routeIds, getRoute, enabled,],);
12427
- }
12428
- async function preloadRoute(route,) {
12429
- if (!shouldPreloadBasedOnUA || !route) return;
12430
- const component = route.page;
12431
- if (!component || !isLazyComponentType(component,)) return;
12432
- await yieldToMain();
12433
- try {
12434
- await component.preload();
12435
- } catch (e) {
12436
- if (false) console.warn('Preload failed', route, e,);
12437
- }
12438
- }
12439
- function useRouteHandler(routeId, preload = false, elementId,) {
12440
- const {
12441
- navigate,
12442
- } = useRouter();
12443
- useRoutePreloader([routeId,], preload,);
12444
- const handler = React4.useCallback(() => navigate == null ? void 0 : navigate(routeId, elementId,), [navigate, elementId, routeId,],);
12445
- return handler;
12446
- }
12447
12376
  var mockWindow = {
12448
12377
  addEventListener: () => {},
12449
12378
  removeEventListener: () => {},
@@ -12502,6 +12431,108 @@ var mockWindow = {
12502
12431
  __framer_events: [],
12503
12432
  };
12504
12433
  var safeWindow = !isWindow ? mockWindow : window;
12434
+ var canUseYield = /* @__PURE__ */ (() => safeWindow.scheduler && 'yield' in safeWindow.scheduler)();
12435
+ var canUsePostTask = /* @__PURE__ */ (() => safeWindow.scheduler && 'postTask' in safeWindow.scheduler)();
12436
+ var pendingResolvers = /* @__PURE__ */ new Set();
12437
+ function resolvePendingPromises() {
12438
+ for (const resolve of pendingResolvers) resolve();
12439
+ pendingResolvers.clear();
12440
+ }
12441
+ function yieldUnlessUrgent(options,) {
12442
+ return new Promise((resolve) => {
12443
+ pendingResolvers.add(resolve,);
12444
+ if (document.hidden) {
12445
+ resolvePendingPromises();
12446
+ return;
12447
+ }
12448
+ document.addEventListener('visibilitychange', resolvePendingPromises,);
12449
+ document.addEventListener('pagehide', resolvePendingPromises,);
12450
+ frame.read(() => {
12451
+ const resolveFn = () => {
12452
+ var _a;
12453
+ pendingResolvers.delete(resolve,);
12454
+ if ((_a = options == null ? void 0 : options.signal) == null ? void 0 : _a.aborted) return;
12455
+ resolve();
12456
+ };
12457
+ void schedulerYield(options,).then(resolveFn,);
12458
+ },);
12459
+ return;
12460
+ },);
12461
+ }
12462
+ function interactionResponse(options,) {
12463
+ return new Promise((resolve) => {
12464
+ setTimeout(resolve, 100,);
12465
+ frame.read(() => {
12466
+ void schedulerYield(options,).then(resolve,);
12467
+ },);
12468
+ },);
12469
+ }
12470
+ function schedulerYield(options,) {
12471
+ const priority = options == null ? void 0 : options.priority;
12472
+ const canUseModernAPI = canUseYield || canUsePostTask;
12473
+ if (!canUseModernAPI) {
12474
+ if (priority === 'user-blocking') {
12475
+ return Promise.resolve();
12476
+ }
12477
+ return new Promise((resolve) => {
12478
+ setTimeout(resolve, priority === 'background' ? 1 : 0,);
12479
+ },);
12480
+ }
12481
+ if (priority === 'background') {
12482
+ return new Promise((resolve) => {
12483
+ setTimeout(resolve, 1,);
12484
+ },);
12485
+ }
12486
+ if (canUseYield) {
12487
+ return safeWindow.scheduler.yield(options,).catch(noop2,);
12488
+ }
12489
+ return safeWindow.scheduler.postTask(() => {}, options,).catch(noop2,);
12490
+ }
12491
+ function yieldToMain(options,) {
12492
+ const {
12493
+ continueAfter,
12494
+ ensureContinueBeforeUnload,
12495
+ ...schedulerOptions
12496
+ } = options ?? {};
12497
+ if (ensureContinueBeforeUnload) {
12498
+ return yieldUnlessUrgent(schedulerOptions,);
12499
+ }
12500
+ if (continueAfter === 'paint') {
12501
+ return interactionResponse(schedulerOptions,);
12502
+ }
12503
+ return schedulerYield(schedulerOptions,);
12504
+ }
12505
+ var shouldPreloadBasedOnUA = !isBot;
12506
+ function useRoutePreloader(routeIds, enabled = true,) {
12507
+ const {
12508
+ getRoute,
12509
+ } = useRouter();
12510
+ useEffect(() => {
12511
+ if (!getRoute || !enabled || !shouldPreloadBasedOnUA) return;
12512
+ for (const routeId of routeIds) {
12513
+ void preloadRoute(getRoute(routeId,),);
12514
+ }
12515
+ }, [routeIds, getRoute, enabled,],);
12516
+ }
12517
+ async function preloadRoute(route,) {
12518
+ if (!shouldPreloadBasedOnUA || !route) return;
12519
+ const component = route.page;
12520
+ if (!component || !isLazyComponentType(component,)) return;
12521
+ await yieldToMain();
12522
+ try {
12523
+ await component.preload();
12524
+ } catch (e) {
12525
+ if (false) console.warn('Preload failed', route, e,);
12526
+ }
12527
+ }
12528
+ function useRouteHandler(routeId, preload = false, elementId,) {
12529
+ const {
12530
+ navigate,
12531
+ } = useRouter();
12532
+ useRoutePreloader([routeId,], preload,);
12533
+ const handler = React4.useCallback(() => navigate == null ? void 0 : navigate(routeId, elementId,), [navigate, elementId, routeId,],);
12534
+ return handler;
12535
+ }
12505
12536
  var timezone;
12506
12537
  var visitorLocale;
12507
12538
  function setTimezoneAndLocaleForTracking() {
@@ -13284,6 +13315,25 @@ var announceNavigation = () => {
13284
13315
  announceDiv.textContent = document.title;
13285
13316
  }, 60,);
13286
13317
  };
13318
+ function useAfterPaintEffect(effectFn, deps, options, useEffectFn = useLayoutEffect,) {
13319
+ useEffectFn(() => {
13320
+ const runAfterPaint = async (fn) => {
13321
+ await yieldToMain({
13322
+ ...options,
13323
+ continueAfter: 'paint',
13324
+ },);
13325
+ return fn();
13326
+ };
13327
+ const runPromise = runAfterPaint(effectFn,);
13328
+ return () => {
13329
+ void (async () => {
13330
+ const cleanup = await runPromise;
13331
+ if (!cleanup) return;
13332
+ void runAfterPaint(cleanup,);
13333
+ })();
13334
+ };
13335
+ }, deps,);
13336
+ }
13287
13337
  function useMonitorNextPaintAfterRender(label,) {
13288
13338
  const resolveHasPainted = useRef3(void 0,);
13289
13339
  useAfterPaintEffect(
@@ -14138,7 +14188,7 @@ function useMarkSuspenseEffectsStart() {
14138
14188
  wasInBackground = true;
14139
14189
  return;
14140
14190
  }
14141
- requestAnimationFrame(() => {
14191
+ frame.read(() => {
14142
14192
  hydrationMarker == null ? void 0 : hydrationMarker.browserRendering.requestAnimationFrame.markStart();
14143
14193
  hydrationMarker == null ? void 0 : hydrationMarker.unattributedHydrationOverhead.measure();
14144
14194
  },);
@@ -14158,9 +14208,9 @@ function useMarkSuspenseEffectEnd() {
14158
14208
  useLayoutEffect(() => {
14159
14209
  hydrationMarker == null ? void 0 : hydrationMarker.useLayoutEffects.markEnd();
14160
14210
  if (wasInBackground || document.visibilityState !== 'visible') return;
14161
- requestAnimationFrame(() => {
14211
+ frame.read(() => {
14162
14212
  hydrationMarker == null ? void 0 : hydrationMarker.browserRendering.requestAnimationFrame.markEnd();
14163
- void yieldBefore(() => {
14213
+ void yieldToMain().then(() => {
14164
14214
  hydrationMarker == null ? void 0 : hydrationMarker.browserRendering.layoutStylePaint.markEnd();
14165
14215
  },);
14166
14216
  },);
@@ -27203,7 +27253,7 @@ function collectBoxShadowsForProps(props, style2,) {
27203
27253
  if (!boxShadow) return;
27204
27254
  style2.boxShadow = boxShadow;
27205
27255
  }
27206
- function shadowForShape(boxShadows, rect, shapeId, fillAlpha, strokeAlpha, strokeWidth, strokeClipId, svgStrokeAttributes,) {
27256
+ function shadowForShape(boxShadows, rect, shapeId, strokeAlpha, strokeWidth, strokeClipId, svgStrokeAttributes,) {
27207
27257
  const definition = [];
27208
27258
  let outsetElement = null;
27209
27259
  let insetElement = null;
@@ -27249,8 +27299,8 @@ function shadowForShape(boxShadows, rect, shapeId, fillAlpha, strokeAlpha, strok
27249
27299
  if (!isFiniteNumber(miter,)) miter = 4;
27250
27300
  let shadowRect = Rect.merge(...shadowRects,);
27251
27301
  shadowRect = Rect.inflate(shadowRect, (expandStrokeWidth * miter / 2 + maxBlur) * 1.1,);
27252
- const width = rect.width + (strokeWidth ? strokeWidth / 2 : 0.1);
27253
- const height = rect.height + (strokeWidth ? strokeWidth / 2 : 0.1);
27302
+ const width = rect.width + (strokeWidth ? strokeWidth / 2 : 0);
27303
+ const height = rect.height + (strokeWidth ? strokeWidth / 2 : 0);
27254
27304
  const filterX = shadowRect.x / width * 100;
27255
27305
  const filterY = shadowRect.y / height * 100;
27256
27306
  const filterWidth = shadowRect.width / width * 100;
@@ -27297,7 +27347,6 @@ function shadowForShape(boxShadows, rect, shapeId, fillAlpha, strokeAlpha, strok
27297
27347
  children: /* @__PURE__ */ jsx3('use', {
27298
27348
  ...svgStrokeAttributes,
27299
27349
  fill: 'black',
27300
- fillOpacity: fillAlpha <= 0 ? 0 : 1,
27301
27350
  stroke: 'black',
27302
27351
  strokeOpacity: strokeAlpha <= 0 ? 0 : 1,
27303
27352
  strokeWidth: strokeAlpha > 0 ? strokeWidth : 0,
@@ -27374,17 +27423,12 @@ function shadowForShape(boxShadows, rect, shapeId, fillAlpha, strokeAlpha, strok
27374
27423
  }
27375
27424
  function outerShadowElements(shapeID, shadow, index,) {
27376
27425
  const shadowKey = shapeID.add('_outer_shadow' + index,);
27377
- const offsetResultId = shadowKey.add('offset',).id;
27378
- const blurResultId = shadowKey.add('blur',).id;
27379
- const matrixResultId = shadowKey.add('matrix',).id;
27380
27426
  const filterElements = /* @__PURE__ */ jsx3(OuterShadowFilterElements, {
27381
27427
  shadow,
27382
- blurId: blurResultId,
27383
- offsetId: offsetResultId,
27384
- matrixId: matrixResultId,
27428
+ shadowKey,
27385
27429
  }, shadowKey.id + '-filters',);
27386
27430
  const mergeElement = /* @__PURE__ */ jsx3('feMergeNode', {
27387
- in: matrixResultId,
27431
+ in: shadowKey.id,
27388
27432
  }, shadowKey.id + '-merge',);
27389
27433
  return {
27390
27434
  filterElements,
@@ -27394,16 +27438,11 @@ function outerShadowElements(shapeID, shadow, index,) {
27394
27438
  var OuterShadowFilterElements = (props) => {
27395
27439
  const {
27396
27440
  shadow,
27397
- blurId,
27398
- offsetId,
27399
- matrixId,
27441
+ shadowKey,
27400
27442
  } = props;
27401
- const color2 = shadow.color;
27402
- const rgb = ConvertColor.toRgb(color2,);
27403
- const r = roundedNumberString(rgb.r / 255, 3,);
27404
- const g = roundedNumberString(rgb.g / 255, 3,);
27405
- const b = roundedNumberString(rgb.b / 255, 3,);
27406
- const matrixValues = `0 0 0 0 ${r} 0 0 0 0 ${g} 0 0 0 0 ${b} 0 0 0 ${rgb.a} 0`;
27443
+ const offsetId = shadowKey.add('offset',).id;
27444
+ const blurId = shadowKey.add('blur',).id;
27445
+ const floodId = shadowKey.add('flood',).id;
27407
27446
  return /* @__PURE__ */ jsxs(Fragment, {
27408
27447
  children: [
27409
27448
  /* @__PURE__ */ jsx3('feOffset', {
@@ -27417,31 +27456,27 @@ var OuterShadowFilterElements = (props) => {
27417
27456
  in: offsetId,
27418
27457
  result: blurId,
27419
27458
  },),
27420
- /* @__PURE__ */ jsx3('feColorMatrix', {
27421
- colorInterpolationFilters: 'sRGB',
27422
- values: matrixValues,
27423
- type: 'matrix',
27424
- in: blurId,
27425
- result: matrixId,
27459
+ /* @__PURE__ */ jsx3('feFlood', {
27460
+ floodColor: shadow.color,
27461
+ result: floodId,
27462
+ },),
27463
+ /* @__PURE__ */ jsx3('feComposite', {
27464
+ in: floodId,
27465
+ in2: blurId,
27466
+ operator: 'in',
27467
+ result: shadowKey.id,
27426
27468
  },),
27427
27469
  ],
27428
27470
  },);
27429
27471
  };
27430
27472
  function innerShadowElements(shapeID, shadow, index,) {
27431
27473
  const shadowKey = shapeID.add('_inside_shadow' + index,);
27432
- const blurId = shadowKey.add('blur',).id;
27433
- const offsetId = shadowKey.add('offset',).id;
27434
- const compositeId = shadowKey.add('composite',).id;
27435
- const matrixId = shadowKey.add('matrix',).id;
27436
27474
  const filterElements = /* @__PURE__ */ jsx3(InnerShadowFilterElements, {
27437
27475
  shadow,
27438
- blurId,
27439
- offsetId,
27440
- compositeId,
27441
- matrixId,
27476
+ shadowKey,
27442
27477
  }, shadowKey.id + '-filters',);
27443
27478
  const mergeElement = /* @__PURE__ */ jsx3('feMergeNode', {
27444
- in: matrixId,
27479
+ in: shadowKey.id,
27445
27480
  }, shadowKey.id + '-merge',);
27446
27481
  return {
27447
27482
  filterElements,
@@ -27451,17 +27486,12 @@ function innerShadowElements(shapeID, shadow, index,) {
27451
27486
  var InnerShadowFilterElements = (props) => {
27452
27487
  const {
27453
27488
  shadow,
27454
- blurId,
27455
- offsetId,
27456
- compositeId,
27457
- matrixId,
27489
+ shadowKey,
27458
27490
  } = props;
27459
- const color2 = shadow.color;
27460
- const rgb = ConvertColor.toRgb(color2,);
27461
- const r = rgb.r / 255;
27462
- const g = rgb.g / 255;
27463
- const b = rgb.b / 255;
27464
- const matrixValues = `0 0 0 0 ${r} 0 0 0 0 ${g} 0 0 0 0 ${b} 0 0 0 ${rgb.a} 0`;
27491
+ const blurId = shadowKey.add('blur',).id;
27492
+ const offsetId = shadowKey.add('offset',).id;
27493
+ const compositeId = shadowKey.add('composite',).id;
27494
+ const floodId = shadowKey.add('flood',).id;
27465
27495
  return /* @__PURE__ */ jsxs(Fragment, {
27466
27496
  children: [
27467
27497
  /* @__PURE__ */ jsx3('feGaussianBlur', {
@@ -27483,12 +27513,15 @@ var InnerShadowFilterElements = (props) => {
27483
27513
  k3: '1',
27484
27514
  result: compositeId,
27485
27515
  },),
27486
- /* @__PURE__ */ jsx3('feColorMatrix', {
27487
- colorInterpolationFilters: 'sRGB',
27488
- values: matrixValues,
27489
- type: 'matrix',
27490
- in: compositeId,
27491
- result: matrixId,
27516
+ /* @__PURE__ */ jsx3('feFlood', {
27517
+ floodColor: shadow.color,
27518
+ result: floodId,
27519
+ },),
27520
+ /* @__PURE__ */ jsx3('feComposite', {
27521
+ in: floodId,
27522
+ in2: compositeId,
27523
+ operator: 'in',
27524
+ result: shadowKey.id,
27492
27525
  },),
27493
27526
  ],
27494
27527
  },);
@@ -33950,6 +33983,9 @@ function Floating({
33950
33983
  ref: floatingPositionRef,
33951
33984
  className: className2,
33952
33985
  style: {
33986
+ // Start from the top left of the screen to prevent jumps.
33987
+ top: 0,
33988
+ left: 0,
33953
33989
  // Initially rendered as hidden, but the layout effect will set
33954
33990
  // to visible when the position is calculated.
33955
33991
  visibility: 'hidden',
@@ -34021,7 +34057,7 @@ var GracefullyDegradingErrorBoundary = class extends Component2 {
34021
34057
  error,
34022
34058
  );
34023
34059
  const sampleRate = Math.random();
34024
- if (sampleRate > 0.5) return;
34060
+ if (sampleRate > 0.25) return;
34025
34061
  const stack = error instanceof Error && typeof error.stack === 'string' ? error.stack : null;
34026
34062
  sendTrackingEvent('published_site_load_error', {
34027
34063
  message: String(error,),
@@ -34134,47 +34170,6 @@ function findAnchorElement(target, withinElement,) {
34134
34170
  }
34135
34171
  return null;
34136
34172
  }
34137
- var pendingResolvers = /* @__PURE__ */ new Set();
34138
- function resolvePendingPromises() {
34139
- for (const resolve of pendingResolvers) resolve();
34140
- pendingResolvers.clear();
34141
- }
34142
- var canUseYield = /* @__PURE__ */ (() => safeWindow.scheduler && 'yield' in safeWindow.scheduler)();
34143
- var canUsePostTask = /* @__PURE__ */ (() => safeWindow.scheduler && 'postTask' in safeWindow.scheduler)();
34144
- function yieldUnlessUrgent(options,) {
34145
- return new Promise((resolve) => {
34146
- pendingResolvers.add(resolve,);
34147
- if (document.hidden) {
34148
- resolvePendingPromises();
34149
- return;
34150
- }
34151
- document.addEventListener('visibilitychange', resolvePendingPromises,);
34152
- document.addEventListener('pagehide', resolvePendingPromises,);
34153
- requestAnimationFrame(() => {
34154
- const resolveFn = () => {
34155
- var _a;
34156
- pendingResolvers.delete(resolve,);
34157
- if ((_a = options == null ? void 0 : options.signal) == null ? void 0 : _a.aborted) return;
34158
- resolve();
34159
- };
34160
- const priority = options == null ? void 0 : options.priority;
34161
- const canUseModernAPI = canUseYield || canUsePostTask;
34162
- if (!canUseModernAPI) {
34163
- if (priority === 'user-blocking') return resolveFn();
34164
- return setTimeout(resolveFn, priority === 'background' ? 1 : 0,);
34165
- }
34166
- if (priority === 'background') {
34167
- return setTimeout(resolveFn, 1,);
34168
- }
34169
- if (canUseYield) {
34170
- safeWindow.scheduler.yield(options,).then(resolveFn,).catch(noop2,);
34171
- return;
34172
- }
34173
- safeWindow.scheduler.postTask(resolveFn, options,).catch(noop2,);
34174
- },);
34175
- return;
34176
- },);
34177
- }
34178
34173
  function ChildrenCanSuspend({
34179
34174
  children,
34180
34175
  },) {
@@ -34916,8 +34911,10 @@ function createOnClickLinkHandler(router, routeId, href, trackLinkClick, element
34916
34911
  const shouldPerformNavigation = !usedMetaKey && !isExternalLink;
34917
34912
  const track = () => void trackLinkClick(href,);
34918
34913
  if (!shouldPerformNavigation) {
34919
- await yieldUnlessUrgent({
34914
+ await yieldToMain({
34920
34915
  priority: 'user-blocking',
34916
+ ensureContinueBeforeUnload: true,
34917
+ continueAfter: 'paint',
34921
34918
  },);
34922
34919
  track();
34923
34920
  return;
@@ -35363,8 +35360,9 @@ var FormContainer = /* @__PURE__ */ React4.forwardRef(function FormContainer2({
35363
35360
  type: 'submit',
35364
35361
  },);
35365
35362
  const data2 = new FormData(event.currentTarget,);
35366
- await interactionResponse({
35363
+ await yieldToMain({
35367
35364
  priority: 'user-blocking',
35365
+ continueAfter: 'paint',
35368
35366
  },);
35369
35367
  addUTMTagsToFormData(data2, safeWindow.document,);
35370
35368
  for (const [key7, value,] of data2) {
@@ -35413,8 +35411,9 @@ var FormContainer = /* @__PURE__ */ React4.forwardRef(function FormContainer2({
35413
35411
  };
35414
35412
  const checkValidity = async (e) => {
35415
35413
  const target = e.currentTarget;
35416
- await interactionResponse({
35414
+ await yieldToMain({
35417
35415
  priority: 'background',
35416
+ continueAfter: 'paint',
35418
35417
  },);
35419
35418
  startTransition2(() =>
35420
35419
  dispatch({
@@ -35663,6 +35662,10 @@ function Router({
35663
35662
  const nextRender = monitorNextPaintAfterRender({
35664
35663
  localized: true,
35665
35664
  },);
35665
+ await yieldToMain({
35666
+ priority: 'user-blocking',
35667
+ continueAfter: 'paint',
35668
+ },);
35666
35669
  let localeId;
35667
35670
  if (isString(localeOrLocaleId,)) {
35668
35671
  localeId = localeOrLocaleId;
@@ -35767,11 +35770,14 @@ function Router({
35767
35770
  preloaded: hasRendered ? void 0 : routeStatus == null ? void 0 : routeStatus.hasLoaded,
35768
35771
  },);
35769
35772
  const executeBeforeUrlUpdate = executeBeforeUrlUpdateOnce(beforeUrlUpdate,);
35770
- void yieldUnlessUrgent({
35773
+ void yieldToMain({
35771
35774
  priority: 'background',
35775
+ ensureContinueBeforeUnload: true,
35776
+ continueAfter: 'paint',
35772
35777
  },).then(executeBeforeUrlUpdate,);
35773
- await interactionResponse({
35778
+ await yieldToMain({
35774
35779
  priority: 'user-blocking',
35780
+ continueAfter: 'paint',
35775
35781
  },);
35776
35782
  if (pathVariables) {
35777
35783
  const inUse = /* @__PURE__ */ new Set();
@@ -41634,9 +41640,13 @@ function useOnAppear(callback,) {
41634
41640
  default: callback,
41635
41641
  },);
41636
41642
  }
41637
- async function setOverflow(blockDocumentScrolling, show, yieldBefore2 = true,) {
41643
+ async function setOverflow(blockDocumentScrolling, show, yieldBefore = true,) {
41638
41644
  if (blockDocumentScrolling === false) return;
41639
- if (yieldBefore2) await interactionResponse();
41645
+ if (yieldBefore) {
41646
+ await yieldToMain({
41647
+ continueAfter: 'paint',
41648
+ },);
41649
+ }
41640
41650
  frame.render(() => {
41641
41651
  const htmlStyle = document.documentElement.style;
41642
41652
  if (show) {
@@ -42049,6 +42059,35 @@ function useUpdateIfVisible(ref,) {
42049
42059
  runUpdateIfPageIsVisible(runUpdate,);
42050
42060
  }, [runUpdateIfPageIsVisible, runUpdateIfElementIsInView, ref,],);
42051
42061
  }
42062
+ var globalWaitingForClickPromise;
42063
+ var globalWaitingForClickResolve;
42064
+ async function getPromiseWithFallback() {
42065
+ return new Promise((resolve) => {
42066
+ const resolveFn = () => {
42067
+ resolve();
42068
+ clearTimeout(timeout,);
42069
+ };
42070
+ const timeout = setTimeout(resolveFn, 150,);
42071
+ globalWaitingForClickResolve = resolveFn;
42072
+ },);
42073
+ }
42074
+ function globalWaitForClickListener(event,) {
42075
+ if (event.button === 0) {
42076
+ globalWaitingForClickPromise = getPromiseWithFallback();
42077
+ }
42078
+ }
42079
+ function globalClickReceivedListener() {
42080
+ globalWaitingForClickPromise = void 0;
42081
+ globalWaitingForClickResolve == null ? void 0 : globalWaitingForClickResolve();
42082
+ globalWaitingForClickResolve = void 0;
42083
+ }
42084
+ function useWaitForGlobalClick(enabled = false,) {
42085
+ useEffect(() => {
42086
+ if (!enabled) return;
42087
+ document.addEventListener('pointerup', globalWaitForClickListener, true,);
42088
+ document.__proto__.addEventListener.call(document, 'click', globalClickReceivedListener, true,);
42089
+ }, [enabled,],);
42090
+ }
42052
42091
  function useVariantState({
42053
42092
  variant,
42054
42093
  defaultVariant: externalDefaultVariant,
@@ -42064,18 +42103,15 @@ function useVariantState({
42064
42103
  const validBaseVariants = useConstant2(() => new Set(externalCycleOrder,));
42065
42104
  const {
42066
42105
  pauseOffscreen: pauseOffscreenFeatureOn,
42106
+ yieldOnTap: yieldOnTapFeatureOn,
42067
42107
  } = useLibraryFeatures();
42068
- const update = useCallback((useTransition) => {
42069
- if (useTransition) {
42070
- startTransition2(() => void forceUpdate());
42071
- return;
42072
- }
42073
- forceUpdate();
42074
- }, [forceUpdate,],);
42108
+ useWaitForGlobalClick(yieldOnTapFeatureOn,);
42075
42109
  const runUpdateIfVisible = useUpdateIfVisible(ref,);
42076
42110
  const internalState = useRef3({
42077
42111
  isHovered: false,
42112
+ isHoveredHasUpdated: false,
42078
42113
  isPressed: false,
42114
+ isPressedHasUpdated: false,
42079
42115
  isError: false,
42080
42116
  hasPressedVariants: true,
42081
42117
  baseVariant: safeBaseVariant(variant, externalDefaultVariant, validBaseVariants,),
@@ -42084,7 +42120,7 @@ function useVariantState({
42084
42120
  loadedBaseVariant: {},
42085
42121
  // When used in generated components, these are static values defined
42086
42122
  // outside of the component function that also need to not result in
42087
- // memoized values being recalculated, so we dump them into the ref.
42123
+ // memorized values being recalculated, so we dump them into the ref.
42088
42124
  defaultVariant: externalDefaultVariant,
42089
42125
  enabledGestures: externalEnabledGestures,
42090
42126
  cycleOrder: externalCycleOrder,
@@ -42110,30 +42146,43 @@ function useVariantState({
42110
42146
  return [nextBaseVariant, nextGestureVariant,];
42111
42147
  }, [],);
42112
42148
  const updateIfNeeded = useCallback(
42113
- (
42114
- baseVariant2,
42115
- gestureVariant2,
42116
- defaultVariant2,
42117
- nextBaseVariant,
42118
- isError2 = false,
42119
- checkViewport = false,
42120
- highPriority = false,
42121
- clearError = false,
42122
- ) => {
42149
+ async (baseVariant2, gestureVariant2, defaultVariant2, nextBaseVariant, checkViewport = false, clearError = false,) => {
42123
42150
  const [nextBase, nextGesture,] = resolveNextVariant(nextBaseVariant,);
42124
42151
  if (nextBase === baseVariant2 && nextGesture === gestureVariant2) return;
42125
42152
  if (clearError) internalState.current.isError = false;
42126
42153
  internalState.current.baseVariant = nextBase || defaultVariant2;
42127
42154
  internalState.current.gestureVariant = nextGesture;
42128
- runUpdateIfVisible(() => update(!highPriority || isError2,), pauseOffscreenFeatureOn && checkViewport,);
42155
+ const yieldOnTap = yieldOnTapFeatureOn && internalState.current.isPressedHasUpdated;
42156
+ if (yieldOnTap && globalWaitingForClickPromise) {
42157
+ await globalWaitingForClickPromise;
42158
+ }
42159
+ if (yieldOnTap) {
42160
+ await yieldToMain({
42161
+ priority: 'user-blocking',
42162
+ continueAfter: 'paint',
42163
+ },);
42164
+ }
42165
+ const {
42166
+ isHovered: isHovered2,
42167
+ isPressed: isPressed2,
42168
+ isHoveredHasUpdated,
42169
+ isPressedHasUpdated,
42170
+ } = internalState.current;
42171
+ if (isHovered2 || isHoveredHasUpdated || isPressed2 || isPressedHasUpdated) {
42172
+ startTransition2(forceUpdate,);
42173
+ return;
42174
+ }
42175
+ runUpdateIfVisible(() => startTransition2(forceUpdate,), pauseOffscreenFeatureOn && checkViewport,);
42129
42176
  },
42130
- [resolveNextVariant, update, runUpdateIfVisible, pauseOffscreenFeatureOn,],
42177
+ [resolveNextVariant, forceUpdate, runUpdateIfVisible, pauseOffscreenFeatureOn, yieldOnTapFeatureOn,],
42131
42178
  );
42132
42179
  const setGestureState = useCallback(({
42133
42180
  isHovered: isHovered2,
42134
42181
  isPressed: isPressed2,
42135
42182
  isError: isError2,
42136
42183
  },) => {
42184
+ const isPressedHasUpdated = isPressed2 !== internalState.current.isPressed;
42185
+ const isHoveredHasUpdated = isHovered2 !== internalState.current.isHovered;
42137
42186
  if (isHovered2 !== void 0) internalState.current.isHovered = isHovered2;
42138
42187
  if (isPressed2 !== void 0) internalState.current.isPressed = isPressed2;
42139
42188
  if (isError2 !== void 0) internalState.current.isError = isError2;
@@ -42142,9 +42191,9 @@ function useVariantState({
42142
42191
  gestureVariant: gestureVariant2,
42143
42192
  defaultVariant: defaultVariant2,
42144
42193
  } = internalState.current;
42145
- const visibleUserInteraction = isPressed2 || isHovered2;
42146
- updateIfNeeded(baseVariant2, gestureVariant2, defaultVariant2, baseVariant2, isError2, !visibleUserInteraction, isHovered2,// a hover needs instant response for a smooth UX; while we optimize for INP for clicks
42147
- );
42194
+ internalState.current.isPressedHasUpdated = isPressedHasUpdated;
42195
+ internalState.current.isHoveredHasUpdated = isHoveredHasUpdated;
42196
+ void updateIfNeeded(baseVariant2, gestureVariant2, defaultVariant2, baseVariant2, false,);
42148
42197
  }, [updateIfNeeded,],);
42149
42198
  const setVariant = useCallback((proposedVariant, pauseOffscreen = false,) => {
42150
42199
  const {
@@ -42156,15 +42205,15 @@ function useVariantState({
42156
42205
  const nextBaseVariant = proposedVariant === CycleVariantState
42157
42206
  ? nextVariant(cycleOrder || [], baseVariant2 || defaultVariant2,)
42158
42207
  : proposedVariant;
42159
- updateIfNeeded(baseVariant2, gestureVariant2, defaultVariant2, nextBaseVariant, false, pauseOffscreen, false, true,);
42208
+ void updateIfNeeded(baseVariant2, gestureVariant2, defaultVariant2, nextBaseVariant, pauseOffscreen, true,);
42160
42209
  }, [updateIfNeeded,],);
42161
42210
  const clearLoadingGesture = useCallback(() => {
42162
42211
  const {
42163
42212
  baseVariant: baseVariant2,
42164
42213
  } = internalState.current;
42165
42214
  internalState.current.loadedBaseVariant[baseVariant2] = true;
42166
- runUpdateIfVisible(() => update(true,), true,);
42167
- }, [update, runUpdateIfVisible,],);
42215
+ runUpdateIfVisible(() => startTransition2(forceUpdate,), true,);
42216
+ }, [forceUpdate, runUpdateIfVisible,],);
42168
42217
  if (variant !== internalState.current.lastVariant) {
42169
42218
  const [nextBase, nextGesture,] = resolveNextVariant(variant,);
42170
42219
  internalState.current.lastVariant = nextBase;
@@ -44925,7 +44974,9 @@ var PlainTextInput = /* @__PURE__ */ forwardRef(function FormPlainTextInput(prop
44925
44974
  setPrevDefaultValue(defaultValue,);
44926
44975
  }
44927
44976
  const handleChange = useCallback(async (e) => {
44928
- await interactionResponse();
44977
+ await yieldToMain({
44978
+ continueAfter: 'paint',
44979
+ },);
44929
44980
  const newValue = e.target.value;
44930
44981
  onChange == null ? void 0 : onChange(e,);
44931
44982
  startTransition2(() => setHasValue(!!newValue,));
@@ -46834,7 +46885,7 @@ var SharedSVGManager = class {
46834
46885
  * VECTOR @TODO - Unsubscribe from vector set items.
46835
46886
  */
46836
46887
  template(id3, svg,) {
46837
- const entry = this.vectorSetItems.get(svg,);
46888
+ const entry = this.vectorSetItems.get(id3,);
46838
46889
  if (entry) return `#${entry.id}`;
46839
46890
  this.vectorSetItems.set(id3, {
46840
46891
  id: id3,
@@ -48276,16 +48327,7 @@ var Vector = /* @__PURE__ */ (() => {
48276
48327
  }
48277
48328
  const internalShapeId = InternalID.forKey(id3,);
48278
48329
  const internalStrokeClipId = InternalID.forKey(strokeClipId,);
48279
- const shadow = shadowForShape(
48280
- shadows,
48281
- rect,
48282
- internalShapeId,
48283
- fillAlpha,
48284
- strokeAlpha,
48285
- strokeWidth,
48286
- internalStrokeClipId,
48287
- svgStrokeAttributes,
48288
- );
48330
+ const shadow = shadowForShape(shadows, rect, internalShapeId, strokeAlpha, strokeWidth, internalStrokeClipId, svgStrokeAttributes,);
48289
48331
  const currentName = target === RenderTarget.preview ? name || void 0 : void 0;
48290
48332
  if (shadow.insetElement !== null || shadow.outsetElement !== null || insideStroke) {
48291
48333
  pathAttributes.id = internalShapeId.id;
@@ -49456,7 +49498,7 @@ export {
49456
49498
  withVariantAppearEffect,
49457
49499
  withVariantFX,
49458
49500
  wrap,
49459
- yieldUnlessUrgent,
49501
+ yieldToMain,
49460
49502
  };
49461
49503
  //! Credit to Astro | MIT License
49462
49504
  /**