tempo-sdk 0.0.87 → 0.0.92

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/astro.js +7 -7
  2. package/dist/canvas/astro.js +1 -1
  3. package/dist/canvas/editor.js +1 -1
  4. package/dist/canvas/index.js +2 -2
  5. package/dist/canvas/interact-projection.js +1 -1
  6. package/dist/canvas/parser.js +1 -1
  7. package/dist/canvas/svelte.js +10 -2
  8. package/dist/canvas/svelte.js.map +1 -1
  9. package/dist/canvas/vue.js +1 -1
  10. package/dist/{chunk-RQ54RXOY.js → chunk-3XEEVCM3.js} +36 -12
  11. package/dist/chunk-3XEEVCM3.js.map +1 -0
  12. package/dist/{chunk-2ZQMVAFM.js → chunk-6SOP4XU6.js} +98 -33
  13. package/dist/chunk-6SOP4XU6.js.map +1 -0
  14. package/dist/{chunk-Y72PIE3I.js → chunk-AFXE462X.js} +5 -4
  15. package/dist/{chunk-Y72PIE3I.js.map → chunk-AFXE462X.js.map} +1 -1
  16. package/dist/{chunk-DMT5MRMS.js → chunk-BQPKOVI5.js} +4 -3
  17. package/dist/{chunk-DMT5MRMS.js.map → chunk-BQPKOVI5.js.map} +1 -1
  18. package/dist/{chunk-PTL3UFIF.js → chunk-FENUT2N2.js} +2 -2
  19. package/dist/{chunk-PTL3UFIF.js.map → chunk-FENUT2N2.js.map} +1 -1
  20. package/dist/{chunk-H6OZIX2U.js → chunk-FGWGY3G3.js} +27 -3
  21. package/dist/chunk-FGWGY3G3.js.map +1 -0
  22. package/dist/{chunk-CXGAJRK7.js → chunk-KQSOE4KZ.js} +7 -7
  23. package/dist/chunk-MU7S7NU7.js +183 -0
  24. package/dist/chunk-MU7S7NU7.js.map +1 -0
  25. package/dist/{chunk-PPIIUCX5.js → chunk-NXPP3CSM.js} +5 -4
  26. package/dist/chunk-NXPP3CSM.js.map +1 -0
  27. package/dist/{chunk-GVH7HUMT.js → chunk-RZ3TG6MV.js} +2 -2
  28. package/dist/{chunk-GVH7HUMT.js.map → chunk-RZ3TG6MV.js.map} +1 -1
  29. package/dist/{chunk-AUG3ZWTR.js → chunk-TWW2DL7E.js} +2 -2
  30. package/dist/{chunk-AUG3ZWTR.js.map → chunk-TWW2DL7E.js.map} +1 -1
  31. package/dist/{chunk-5VIBKVFO.js → chunk-U66QI3EN.js} +28 -18
  32. package/dist/chunk-U66QI3EN.js.map +1 -0
  33. package/dist/{controls-reader-Z7OQWYWQ.js → controls-reader-5MFHYBZZ.js} +4 -4
  34. package/dist/expo/plugin.cjs +97 -32
  35. package/dist/expo/plugin.cjs.map +1 -1
  36. package/dist/expo/plugin.js +1 -1
  37. package/dist/expo-babel-plugin.cjs +97 -32
  38. package/dist/expo-babel-plugin.cjs.map +1 -1
  39. package/dist/expo-babel-plugin.d.cts +2 -0
  40. package/dist/expo-babel-plugin.d.ts +2 -0
  41. package/dist/expo-babel-plugin.js +1 -1
  42. package/dist/index.d.ts +2 -0
  43. package/dist/index.js +6 -6
  44. package/dist/nextjs/plugin.cjs +1 -1
  45. package/dist/nextjs/plugin.cjs.map +1 -1
  46. package/dist/nextjs/plugin.js +1 -1
  47. package/dist/nextjs-loader.cjs +126 -37
  48. package/dist/nextjs-loader.cjs.map +1 -1
  49. package/dist/nextjs.cjs +1 -1
  50. package/dist/nextjs.cjs.map +1 -1
  51. package/dist/nextjs.d.cts +2 -0
  52. package/dist/nextjs.d.ts +2 -0
  53. package/dist/nextjs.js +1 -1
  54. package/dist/nuxt/runtime/identity.js +1 -1
  55. package/dist/nuxt.js +230 -53
  56. package/dist/nuxt.js.map +1 -1
  57. package/dist/svelte.js +99 -24
  58. package/dist/svelte.js.map +1 -1
  59. package/dist/vue.js +120 -22
  60. package/dist/vue.js.map +1 -1
  61. package/package.json +1 -1
  62. package/dist/chunk-2ZQMVAFM.js.map +0 -1
  63. package/dist/chunk-5VIBKVFO.js.map +0 -1
  64. package/dist/chunk-H6BQZOAW.js +0 -121
  65. package/dist/chunk-H6BQZOAW.js.map +0 -1
  66. package/dist/chunk-H6OZIX2U.js.map +0 -1
  67. package/dist/chunk-PPIIUCX5.js.map +0 -1
  68. package/dist/chunk-RQ54RXOY.js.map +0 -1
  69. /package/dist/{chunk-CXGAJRK7.js.map → chunk-KQSOE4KZ.js.map} +0 -0
  70. /package/dist/{controls-reader-Z7OQWYWQ.js.map → controls-reader-5MFHYBZZ.js.map} +0 -0
package/dist/astro.js CHANGED
@@ -1,30 +1,30 @@
1
1
  import {
2
2
  annotateAstroSource,
3
3
  parseAstroSource
4
- } from "./chunk-5VIBKVFO.js";
4
+ } from "./chunk-U66QI3EN.js";
5
5
  import "./chunk-EGRHWZRV.js";
6
6
  import {
7
7
  MagicString
8
8
  } from "./chunk-JVVHU3A7.js";
9
9
  import {
10
10
  tempoVitePlugin
11
- } from "./chunk-CXGAJRK7.js";
11
+ } from "./chunk-KQSOE4KZ.js";
12
12
  import "./chunk-PYAJHLXO.js";
13
13
  import "./chunk-DI2ZFAWL.js";
14
14
  import {
15
15
  TEMPO_HOST_IDENTITY_CAPABILITY_HEADER,
16
16
  TEMPO_HOST_IDENTITY_ENDPOINT,
17
17
  createTempoHostIdentity
18
- } from "./chunk-AUG3ZWTR.js";
19
- import "./chunk-DMT5MRMS.js";
20
- import "./chunk-H6OZIX2U.js";
18
+ } from "./chunk-TWW2DL7E.js";
19
+ import "./chunk-BQPKOVI5.js";
20
+ import "./chunk-FGWGY3G3.js";
21
21
  import {
22
22
  sourceVersionHash
23
- } from "./chunk-H6BQZOAW.js";
23
+ } from "./chunk-MU7S7NU7.js";
24
24
  import {
25
25
  componentFrameworkForStoryboard,
26
26
  parseCanvasFile
27
- } from "./chunk-Y72PIE3I.js";
27
+ } from "./chunk-AFXE462X.js";
28
28
  import "./chunk-5HIIF354.js";
29
29
  import "./chunk-WTXOWQ7N.js";
30
30
  import "./chunk-65B52AR7.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  StoryboardSlot
3
- } from "../chunk-PPIIUCX5.js";
3
+ } from "../chunk-NXPP3CSM.js";
4
4
  import "../chunk-DNERBE7A.js";
5
5
  import "../chunk-5M45Z7K6.js";
6
6
  import {
@@ -2,7 +2,7 @@ import {
2
2
  STORYBOARD_SDK_COMPONENTS,
3
3
  parseCanvasFile,
4
4
  storyboardComponentForFramework
5
- } from "../chunk-Y72PIE3I.js";
5
+ } from "../chunk-AFXE462X.js";
6
6
  import "../chunk-CYQE3TLC.js";
7
7
 
8
8
  // canvas/editor.ts
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  installTempoInteractProjectionSource
3
- } from "../chunk-RQ54RXOY.js";
3
+ } from "../chunk-3XEEVCM3.js";
4
4
  import "../chunk-SGN7BDRE.js";
5
5
  import "../chunk-XN2K7GED.js";
6
6
  import {
@@ -38,7 +38,7 @@ import {
38
38
  useStoryboardSize,
39
39
  v1DirectUrlSize,
40
40
  v1RenderRequestSize
41
- } from "../chunk-PPIIUCX5.js";
41
+ } from "../chunk-NXPP3CSM.js";
42
42
  import {
43
43
  PROJECTION_PENDING_ATTRIBUTE,
44
44
  PROJECTION_SCOPE_ROLE,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  installTempoInteractProjectionSource
3
- } from "../chunk-RQ54RXOY.js";
3
+ } from "../chunk-3XEEVCM3.js";
4
4
  import "../chunk-SGN7BDRE.js";
5
5
  import "../chunk-XN2K7GED.js";
6
6
  import "../chunk-65B52AR7.js";
@@ -11,7 +11,7 @@ import {
11
11
  parseComponentRoot,
12
12
  storyboardComponentForFramework,
13
13
  unwrapTsExpression
14
- } from "../chunk-Y72PIE3I.js";
14
+ } from "../chunk-AFXE462X.js";
15
15
  import "../chunk-CYQE3TLC.js";
16
16
  export {
17
17
  NO_CANVAS_DECLARATION_ERROR,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  StoryboardSlot
3
- } from "../chunk-PPIIUCX5.js";
3
+ } from "../chunk-NXPP3CSM.js";
4
4
  import "../chunk-DNERBE7A.js";
5
5
  import "../chunk-5M45Z7K6.js";
6
6
 
@@ -47,6 +47,13 @@ function SvelteStoryboard({
47
47
  }
48
48
  );
49
49
  }
50
+ function svelteComponentIdentity(component) {
51
+ const symbol = Object.getOwnPropertySymbols(component).find(
52
+ (symbol2) => symbol2.description === "hmr"
53
+ );
54
+ const hmr = symbol ? Reflect.get(component, symbol) : null;
55
+ return hmr && typeof hmr === "object" && typeof hmr.fn === "function" && typeof hmr.update === "function" && hmr.current !== null && typeof hmr.current === "object" ? hmr.current : component;
56
+ }
50
57
  function SvelteComponentMount({
51
58
  component,
52
59
  props
@@ -54,6 +61,7 @@ function SvelteComponentMount({
54
61
  const targetRef = useRef(null);
55
62
  const [mountError, setMountError] = useState(null);
56
63
  const runtime = readSvelteRuntime();
64
+ const componentIdentity = svelteComponentIdentity(component);
57
65
  useLayoutEffect(() => {
58
66
  const target = targetRef.current;
59
67
  if (!target) return;
@@ -73,7 +81,7 @@ function SvelteComponentMount({
73
81
  if (current) void runtime.unmount(current);
74
82
  target.replaceChildren();
75
83
  };
76
- }, [component, runtime]);
84
+ }, [componentIdentity, runtime]);
77
85
  if (mountError) throw mountError;
78
86
  return /* @__PURE__ */ jsx("div", { ref: targetRef, "data-tempo-hide-fiber": "true" });
79
87
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../canvas/svelte.tsx"],"sourcesContent":["import { useLayoutEffect, useRef, useState } from \"react\";\n\nimport {\n StoryboardSlot,\n type StoryboardLayout,\n type StoryboardVrtConfig,\n} from \"./storyboard\";\n\n/** Public Svelte 5 component call shape. This Svelte-specific entrypoint keeps\n * React-only consumers of tempo-sdk/canvas from resolving the optional Svelte\n * peer dependency. */\nexport type SvelteComponent<\n Props extends Record<string, unknown> = Record<string, unknown>,\n> = import(\"svelte\").Component<Props>;\n\ntype SvelteRuntime = typeof import(\"svelte\");\ntype SvelteRuntimeState =\n | { kind: \"pending\"; promise: Promise<void> }\n | { kind: \"ready\"; runtime: SvelteRuntime }\n | { kind: \"error\"; error: unknown };\n\nlet svelteRuntimeState: SvelteRuntimeState | null = null;\n\n/** Suspense resource for the optional Svelte runtime. The storyboard must not\n * report its React shell as rendered before the authored Svelte DOM exists,\n * otherwise the component projection opens with a permanent DOM-only\n * baseline. */\nfunction readSvelteRuntime(): SvelteRuntime {\n if (svelteRuntimeState?.kind === \"ready\") return svelteRuntimeState.runtime;\n if (svelteRuntimeState?.kind === \"error\") throw svelteRuntimeState.error;\n if (!svelteRuntimeState) {\n const promise = import(\"svelte\").then(\n (runtime) => {\n svelteRuntimeState = { kind: \"ready\", runtime };\n },\n (error: unknown) => {\n svelteRuntimeState = { kind: \"error\", error };\n },\n );\n svelteRuntimeState = { kind: \"pending\", promise };\n }\n throw svelteRuntimeState.promise;\n}\n\nexport function SvelteStoryboard<\n Props extends Record<string, unknown> = Record<string, unknown>,\n>({\n id,\n name,\n component,\n layout,\n props,\n vrt,\n ...annotations\n}: {\n id: string;\n component: SvelteComponent<Props>;\n layout: StoryboardLayout;\n name?: string;\n props?: Props;\n vrt?: boolean | StoryboardVrtConfig;\n} & Record<`data-tempo-${string}`, unknown>) {\n return (\n <StoryboardSlot\n data-tempo-hide-fiber=\"true\"\n id={id}\n name={name}\n layout={layout}\n kind=\"component\"\n uiFramework=\"svelte\"\n vrt={!!vrt}\n >\n <SvelteComponentMount component={component} props={props} />\n </StoryboardSlot>\n );\n}\n\nfunction SvelteComponentMount<Props extends Record<string, unknown>>({\n component,\n props,\n}: {\n component: SvelteComponent<Props>;\n props?: Props;\n}) {\n const targetRef = useRef<HTMLDivElement | null>(null);\n const [mountError, setMountError] = useState<unknown>(null);\n const runtime = readSvelteRuntime();\n\n useLayoutEffect(() => {\n const target = targetRef.current;\n if (!target) return;\n let mounted: Record<string, unknown> | null = null;\n try {\n mounted = runtime.mount(component as never, {\n target,\n props: props ?? ({} as Props),\n }) as Record<string, unknown>;\n runtime.flushSync();\n } catch (error) {\n setMountError(error);\n }\n\n return () => {\n const current = mounted;\n mounted = null;\n if (current) void runtime.unmount(current);\n target.replaceChildren();\n };\n // Svelte component props are explicit static storyboard inputs today.\n // Canvas source/HMR replaces the component module when they change; avoid\n // remounting just because a parent React render recreated the props object.\n }, [component, runtime]);\n\n if (mountError) throw mountError;\n return <div ref={targetRef} data-tempo-hide-fiber=\"true\" />;\n}\n"],"mappings":";;;;;;;AAAA,SAAS,iBAAiB,QAAQ,gBAAgB;AAwE5C;AAnDN,IAAI,qBAAgD;AAMpD,SAAS,oBAAmC;AAC1C,MAAI,oBAAoB,SAAS,QAAS,QAAO,mBAAmB;AACpE,MAAI,oBAAoB,SAAS,QAAS,OAAM,mBAAmB;AACnE,MAAI,CAAC,oBAAoB;AACvB,UAAM,UAAU,OAAO,QAAQ,EAAE;AAAA,MAC/B,CAAC,YAAY;AACX,6BAAqB,EAAE,MAAM,SAAS,QAAQ;AAAA,MAChD;AAAA,MACA,CAAC,UAAmB;AAClB,6BAAqB,EAAE,MAAM,SAAS,MAAM;AAAA,MAC9C;AAAA,IACF;AACA,yBAAqB,EAAE,MAAM,WAAW,QAAQ;AAAA,EAClD;AACA,QAAM,mBAAmB;AAC3B;AAEO,SAAS,iBAEd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAO6C;AAC3C,SACE;AAAA,IAAC;AAAA;AAAA,MACC,yBAAsB;AAAA,MACtB;AAAA,MACA;AAAA,MACA;AAAA,MACA,MAAK;AAAA,MACL,aAAY;AAAA,MACZ,KAAK,CAAC,CAAC;AAAA,MAEP,8BAAC,wBAAqB,WAAsB,OAAc;AAAA;AAAA,EAC5D;AAEJ;AAEA,SAAS,qBAA4D;AAAA,EACnE;AAAA,EACA;AACF,GAGG;AACD,QAAM,YAAY,OAA8B,IAAI;AACpD,QAAM,CAAC,YAAY,aAAa,IAAI,SAAkB,IAAI;AAC1D,QAAM,UAAU,kBAAkB;AAElC,kBAAgB,MAAM;AACpB,UAAM,SAAS,UAAU;AACzB,QAAI,CAAC,OAAQ;AACb,QAAI,UAA0C;AAC9C,QAAI;AACF,gBAAU,QAAQ,MAAM,WAAoB;AAAA,QAC1C;AAAA,QACA,OAAO,SAAU,CAAC;AAAA,MACpB,CAAC;AACD,cAAQ,UAAU;AAAA,IACpB,SAAS,OAAO;AACd,oBAAc,KAAK;AAAA,IACrB;AAEA,WAAO,MAAM;AACX,YAAM,UAAU;AAChB,gBAAU;AACV,UAAI,QAAS,MAAK,QAAQ,QAAQ,OAAO;AACzC,aAAO,gBAAgB;AAAA,IACzB;AAAA,EAIF,GAAG,CAAC,WAAW,OAAO,CAAC;AAEvB,MAAI,WAAY,OAAM;AACtB,SAAO,oBAAC,SAAI,KAAK,WAAW,yBAAsB,QAAO;AAC3D;","names":[]}
1
+ {"version":3,"sources":["../../canvas/svelte.tsx"],"sourcesContent":["import { useLayoutEffect, useRef, useState } from \"react\";\n\nimport {\n StoryboardSlot,\n type StoryboardLayout,\n type StoryboardVrtConfig,\n} from \"./storyboard\";\n\n/** Public Svelte 5 component call shape. This Svelte-specific entrypoint keeps\n * React-only consumers of tempo-sdk/canvas from resolving the optional Svelte\n * peer dependency. */\nexport type SvelteComponent<\n Props extends Record<string, unknown> = Record<string, unknown>,\n> = import(\"svelte\").Component<Props>;\n\ntype SvelteRuntime = typeof import(\"svelte\");\ntype SvelteRuntimeState =\n | { kind: \"pending\"; promise: Promise<void> }\n | { kind: \"ready\"; runtime: SvelteRuntime }\n | { kind: \"error\"; error: unknown };\n\nlet svelteRuntimeState: SvelteRuntimeState | null = null;\n\n/** Suspense resource for the optional Svelte runtime. The storyboard must not\n * report its React shell as rendered before the authored Svelte DOM exists,\n * otherwise the component projection opens with a permanent DOM-only\n * baseline. */\nfunction readSvelteRuntime(): SvelteRuntime {\n if (svelteRuntimeState?.kind === \"ready\") return svelteRuntimeState.runtime;\n if (svelteRuntimeState?.kind === \"error\") throw svelteRuntimeState.error;\n if (!svelteRuntimeState) {\n const promise = import(\"svelte\").then(\n (runtime) => {\n svelteRuntimeState = { kind: \"ready\", runtime };\n },\n (error: unknown) => {\n svelteRuntimeState = { kind: \"error\", error };\n },\n );\n svelteRuntimeState = { kind: \"pending\", promise };\n }\n throw svelteRuntimeState.promise;\n}\n\nexport function SvelteStoryboard<\n Props extends Record<string, unknown> = Record<string, unknown>,\n>({\n id,\n name,\n component,\n layout,\n props,\n vrt,\n ...annotations\n}: {\n id: string;\n component: SvelteComponent<Props>;\n layout: StoryboardLayout;\n name?: string;\n props?: Props;\n vrt?: boolean | StoryboardVrtConfig;\n} & Record<`data-tempo-${string}`, unknown>) {\n return (\n <StoryboardSlot\n data-tempo-hide-fiber=\"true\"\n id={id}\n name={name}\n layout={layout}\n kind=\"component\"\n uiFramework=\"svelte\"\n vrt={!!vrt}\n >\n <SvelteComponentMount component={component} props={props} />\n </StoryboardSlot>\n );\n}\n\n/** Svelte's dev HMR exports a new function on every evaluation, but its\n * current signal names the existing live component family. Preserve that\n * mounted wrapper: remounting a later export disconnects the DOM from the\n * signal updated by subsequent hot updates. Production components and actual\n * component replacements retain their ordinary function identity.\n *\n * The optional Svelte 5 compiler HMR protocol uses a private symbol. Inspect\n * its full shape conservatively; unknown runtimes keep normal remounting.\n */\nfunction svelteComponentIdentity(component: object): object {\n const symbol = Object.getOwnPropertySymbols(component).find(\n (symbol) => symbol.description === \"hmr\",\n );\n const hmr = symbol ? Reflect.get(component, symbol) : null;\n return hmr &&\n typeof hmr === \"object\" &&\n typeof hmr.fn === \"function\" &&\n typeof hmr.update === \"function\" &&\n hmr.current !== null &&\n typeof hmr.current === \"object\"\n ? hmr.current\n : component;\n}\n\nfunction SvelteComponentMount<Props extends Record<string, unknown>>({\n component,\n props,\n}: {\n component: SvelteComponent<Props>;\n props?: Props;\n}) {\n const targetRef = useRef<HTMLDivElement | null>(null);\n const [mountError, setMountError] = useState<unknown>(null);\n const runtime = readSvelteRuntime();\n const componentIdentity = svelteComponentIdentity(component);\n\n useLayoutEffect(() => {\n const target = targetRef.current;\n if (!target) return;\n let mounted: Record<string, unknown> | null = null;\n try {\n mounted = runtime.mount(component as never, {\n target,\n props: props ?? ({} as Props),\n }) as Record<string, unknown>;\n runtime.flushSync();\n } catch (error) {\n setMountError(error);\n }\n\n return () => {\n const current = mounted;\n mounted = null;\n if (current) void runtime.unmount(current);\n target.replaceChildren();\n };\n // Svelte component props are explicit static storyboard inputs today.\n // Actual component-family replacement remounts; Svelte HMR updates its\n // existing family in place. Static storyboard props remain unchanged.\n }, [componentIdentity, runtime]);\n\n if (mountError) throw mountError;\n return <div ref={targetRef} data-tempo-hide-fiber=\"true\" />;\n}\n"],"mappings":";;;;;;;AAAA,SAAS,iBAAiB,QAAQ,gBAAgB;AAwE5C;AAnDN,IAAI,qBAAgD;AAMpD,SAAS,oBAAmC;AAC1C,MAAI,oBAAoB,SAAS,QAAS,QAAO,mBAAmB;AACpE,MAAI,oBAAoB,SAAS,QAAS,OAAM,mBAAmB;AACnE,MAAI,CAAC,oBAAoB;AACvB,UAAM,UAAU,OAAO,QAAQ,EAAE;AAAA,MAC/B,CAAC,YAAY;AACX,6BAAqB,EAAE,MAAM,SAAS,QAAQ;AAAA,MAChD;AAAA,MACA,CAAC,UAAmB;AAClB,6BAAqB,EAAE,MAAM,SAAS,MAAM;AAAA,MAC9C;AAAA,IACF;AACA,yBAAqB,EAAE,MAAM,WAAW,QAAQ;AAAA,EAClD;AACA,QAAM,mBAAmB;AAC3B;AAEO,SAAS,iBAEd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAO6C;AAC3C,SACE;AAAA,IAAC;AAAA;AAAA,MACC,yBAAsB;AAAA,MACtB;AAAA,MACA;AAAA,MACA;AAAA,MACA,MAAK;AAAA,MACL,aAAY;AAAA,MACZ,KAAK,CAAC,CAAC;AAAA,MAEP,8BAAC,wBAAqB,WAAsB,OAAc;AAAA;AAAA,EAC5D;AAEJ;AAWA,SAAS,wBAAwB,WAA2B;AAC1D,QAAM,SAAS,OAAO,sBAAsB,SAAS,EAAE;AAAA,IACrD,CAACA,YAAWA,QAAO,gBAAgB;AAAA,EACrC;AACA,QAAM,MAAM,SAAS,QAAQ,IAAI,WAAW,MAAM,IAAI;AACtD,SAAO,OACL,OAAO,QAAQ,YACf,OAAO,IAAI,OAAO,cAClB,OAAO,IAAI,WAAW,cACtB,IAAI,YAAY,QAChB,OAAO,IAAI,YAAY,WACrB,IAAI,UACJ;AACN;AAEA,SAAS,qBAA4D;AAAA,EACnE;AAAA,EACA;AACF,GAGG;AACD,QAAM,YAAY,OAA8B,IAAI;AACpD,QAAM,CAAC,YAAY,aAAa,IAAI,SAAkB,IAAI;AAC1D,QAAM,UAAU,kBAAkB;AAClC,QAAM,oBAAoB,wBAAwB,SAAS;AAE3D,kBAAgB,MAAM;AACpB,UAAM,SAAS,UAAU;AACzB,QAAI,CAAC,OAAQ;AACb,QAAI,UAA0C;AAC9C,QAAI;AACF,gBAAU,QAAQ,MAAM,WAAoB;AAAA,QAC1C;AAAA,QACA,OAAO,SAAU,CAAC;AAAA,MACpB,CAAC;AACD,cAAQ,UAAU;AAAA,IACpB,SAAS,OAAO;AACd,oBAAc,KAAK;AAAA,IACrB;AAEA,WAAO,MAAM;AACX,YAAM,UAAU;AAChB,gBAAU;AACV,UAAI,QAAS,MAAK,QAAQ,QAAQ,OAAO;AACzC,aAAO,gBAAgB;AAAA,IACzB;AAAA,EAIF,GAAG,CAAC,mBAAmB,OAAO,CAAC;AAE/B,MAAI,WAAY,OAAM;AACtB,SAAO,oBAAC,SAAI,KAAK,WAAW,yBAAsB,QAAO;AAC3D;","names":["symbol"]}
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  StoryboardSlot,
3
3
  useCanvasStoryboardRenderId
4
- } from "../chunk-PPIIUCX5.js";
4
+ } from "../chunk-NXPP3CSM.js";
5
5
  import "../chunk-DNERBE7A.js";
6
6
  import "../chunk-5M45Z7K6.js";
7
7
 
@@ -140,6 +140,12 @@ function browserFrameClock() {
140
140
  }
141
141
 
142
142
  // ../../modules/rate-limiter/work-scheduler.ts
143
+ var keyPriorityRank = {
144
+ low: 0,
145
+ normal: 1,
146
+ high: 2,
147
+ "extra-high": 3
148
+ };
143
149
  var browserClock = () => ({
144
150
  now: () => performance.now(),
145
151
  ...browserFrameClock(),
@@ -173,7 +179,8 @@ function createWorkScheduler(options = {}) {
173
179
  const interactive = /* @__PURE__ */ new Set();
174
180
  const priorities = /* @__PURE__ */ new Map();
175
181
  let highPriorityKeys = 0;
176
- const rank = { low: 0, normal: 1, high: 2 };
182
+ let extraHighPriorityKeys = 0;
183
+ const rank = keyPriorityRank;
177
184
  const getPriority = (key) => {
178
185
  if (key === void 0) return "normal";
179
186
  if (typeof key === "symbol") return priorities.get(key) ?? "normal";
@@ -184,8 +191,13 @@ function createWorkScheduler(options = {}) {
184
191
  }
185
192
  return result;
186
193
  };
187
- const priorityOf = (job) => job.foreground?.() ? "high" : getPriority(job.key);
188
- const high = (job) => job !== void 0 && priorityOf(job) === "high";
194
+ const priorityOf = (job) => {
195
+ const owner = getPriority(job.key);
196
+ return job.foreground?.() && rank[owner] < rank.high ? "high" : owner;
197
+ };
198
+ const high = (job) => job !== void 0 && rank[priorityOf(job)] >= rank.high;
199
+ const extraHigh = (job) => job !== void 0 && priorityOf(job) === "extra-high";
200
+ const byPriority = (a, b) => rank[priorityOf(b)] - rank[priorityOf(a)] || (a.priority === "frame" ? -1 : b.priority === "frame" ? 1 : 0) || a.at - b.at;
189
201
  const paintWaits = /* @__PURE__ */ new Set();
190
202
  let frame = null;
191
203
  let idle = null;
@@ -221,17 +233,25 @@ function createWorkScheduler(options = {}) {
221
233
  if (kind === "frame" && interactive.size && queues.input.size)
222
234
  return first(queues.input);
223
235
  const urgentInput = candidate(queues.input);
224
- if (high(urgentInput)) return urgentInput;
225
- if (kind === "frame" && queues.input.size) return first(queues.input);
226
- if (interactive.size) return void 0;
227
236
  const candidates = [
228
237
  candidate(queues.visible),
229
238
  candidate(queues.background),
230
239
  ...kind === "frame" ? [candidate(queues.frame)] : []
231
240
  ].filter((job) => !!job);
232
- return candidates.filter((job) => high(job) && clock.now() - job.at >= highPriorityAgeMs).sort((a, b) => a.at - b.at)[0] ?? candidates.sort(
233
- (a, b) => rank[priorityOf(b)] - rank[priorityOf(a)] || (a.priority === "frame" ? -1 : b.priority === "frame" ? 1 : 0) || a.at - b.at
234
- )[0];
241
+ if (!interactive.size) {
242
+ const clicked = [urgentInput, ...candidates].filter(
243
+ (job) => extraHigh(job)
244
+ );
245
+ const aged = clicked.filter((job) => clock.now() - job.at >= highPriorityAgeMs).sort((a, b) => a.at - b.at)[0];
246
+ if (aged) return aged;
247
+ if (extraHigh(urgentInput)) return urgentInput;
248
+ const ready = clicked.sort(byPriority)[0];
249
+ if (ready) return ready;
250
+ }
251
+ if (high(urgentInput)) return urgentInput;
252
+ if (kind === "frame" && queues.input.size) return first(queues.input);
253
+ if (interactive.size) return void 0;
254
+ return candidates.filter((job) => high(job) && clock.now() - job.at >= highPriorityAgeMs).sort((a, b) => a.at - b.at)[0] ?? candidates.sort(byPriority)[0];
235
255
  };
236
256
  async function pump(kind, deadline) {
237
257
  if (disposed || draining) return;
@@ -433,8 +453,10 @@ function createWorkScheduler(options = {}) {
433
453
  setPriority(key, priority) {
434
454
  const before = getPriority(key);
435
455
  if (disposed || before === priority) return;
436
- if (before === "high") highPriorityKeys--;
437
- if (priority === "high") highPriorityKeys++;
456
+ if (rank[before] >= rank.high) highPriorityKeys--;
457
+ if (rank[priority] >= rank.high) highPriorityKeys++;
458
+ if (before === "extra-high") extraHighPriorityKeys--;
459
+ if (priority === "extra-high") extraHighPriorityKeys++;
438
460
  if (priority === "normal") priorities.delete(key);
439
461
  else priorities.set(key, priority);
440
462
  request();
@@ -453,6 +475,7 @@ function createWorkScheduler(options = {}) {
453
475
  return {
454
476
  interactiveClaims: interactive.size,
455
477
  highPriorityKeys,
478
+ extraHighPriorityKeys,
456
479
  eligibleJobs: count(),
457
480
  queued: count(),
458
481
  oldestMs: Math.max(
@@ -471,6 +494,7 @@ function createWorkScheduler(options = {}) {
471
494
  disposed = true;
472
495
  priorities.clear();
473
496
  highPriorityKeys = 0;
497
+ extraHighPriorityKeys = 0;
474
498
  for (const abort of paintWaits) abort();
475
499
  if (frame !== null) clock.cancelFrame(frame);
476
500
  if (idle !== null) clock.cancelIdle?.(idle);
@@ -8242,4 +8266,4 @@ function installTempoInteractProjectionSource() {
8242
8266
  export {
8243
8267
  installTempoInteractProjectionSource
8244
8268
  };
8245
- //# sourceMappingURL=chunk-RQ54RXOY.js.map
8269
+ //# sourceMappingURL=chunk-3XEEVCM3.js.map