@atom.io/spa 0.0.5 → 0.0.7

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 (108) hide show
  1. package/README.md +381 -10
  2. package/README.mdx +101 -5
  3. package/dist/astro-application.d.ts +1 -1
  4. package/dist/astro-client.d.ts +1 -1
  5. package/dist/astro-client.js +2 -2
  6. package/dist/astro-request-DRKvDjsO.js.map +1 -1
  7. package/dist/astro-resumability-client.d.ts +1 -1
  8. package/dist/astro-server.js +1 -1
  9. package/dist/{astro-shared-DHIpjNIG.d.ts → astro-shared-DZp1x8RQ.d.ts} +2 -2
  10. package/dist/{astro-shared-DHIpjNIG.d.ts.map → astro-shared-DZp1x8RQ.d.ts.map} +1 -1
  11. package/dist/astro.d.ts +1 -1
  12. package/dist/astro.js +1 -1
  13. package/dist/{capabilities-BCtBG-ni.d.ts → capabilities-DNcnGRv_.d.ts} +11 -5
  14. package/dist/capabilities-DNcnGRv_.d.ts.map +1 -0
  15. package/dist/{capabilities-BkQ2i0vV.js → capabilities-nOIitQ-_.js} +6 -4
  16. package/dist/capabilities-nOIitQ-_.js.map +1 -0
  17. package/dist/client.min.js +1 -1
  18. package/dist/{core-DjFJ0aIJ.js → core-B4rJ0xdc.js} +22 -12
  19. package/dist/core-B4rJ0xdc.js.map +1 -0
  20. package/dist/development/astro-client.js +2 -2
  21. package/dist/development/astro-request-DRKvDjsO.js.map +1 -1
  22. package/dist/development/astro-server.js +1 -1
  23. package/dist/development/astro.js +1 -1
  24. package/dist/development/{capabilities-BkQ2i0vV.js → capabilities-nOIitQ-_.js} +6 -4
  25. package/dist/development/capabilities-nOIitQ-_.js.map +1 -0
  26. package/dist/development/{core-DxPiKryn.js → core-BHA7I1nf.js} +24 -14
  27. package/dist/development/core-BHA7I1nf.js.map +1 -0
  28. package/dist/development/{dom-BytVV6Rp.js → dom-DQ0M3rLL.js} +11 -10
  29. package/dist/development/{dom-BytVV6Rp.js.map → dom-DQ0M3rLL.js.map} +1 -1
  30. package/dist/development/floating.js +148 -0
  31. package/dist/development/floating.js.map +1 -0
  32. package/dist/development/index.js +4 -4
  33. package/dist/development/jsx-runtime.js +2 -2
  34. package/dist/development/jsx-runtime.js.map +1 -1
  35. package/dist/development/konva.js +2 -2
  36. package/dist/development/motion.js +419 -25
  37. package/dist/development/motion.js.map +1 -1
  38. package/dist/development/renderer.js +2 -2
  39. package/dist/development/{server-renderer-CUQXh9oF.js → server-renderer-DCLoMdOX.js} +3 -3
  40. package/dist/development/{server-renderer-CUQXh9oF.js.map → server-renderer-DCLoMdOX.js.map} +1 -1
  41. package/dist/development/server.js +1 -1
  42. package/dist/{src-DWIqXCiz.js → development/src-DoQgCX-O.js} +2 -2
  43. package/dist/development/{src-WSHJxR9b.js.map → src-DoQgCX-O.js.map} +1 -1
  44. package/dist/development/three.js +87 -31
  45. package/dist/development/three.js.map +1 -1
  46. package/dist/development/{vite-CSHoxzXU.js → vite-Bmyb6P5w.js} +32 -7
  47. package/dist/development/vite-Bmyb6P5w.js.map +1 -0
  48. package/dist/development/vite.js +1 -1
  49. package/dist/{dom-B5OxgHkr.js → dom-D8g3roX9.js} +11 -10
  50. package/dist/{dom-B5OxgHkr.js.map → dom-D8g3roX9.js.map} +1 -1
  51. package/dist/floating.d.ts +16 -0
  52. package/dist/floating.d.ts.map +1 -0
  53. package/dist/floating.js +148 -0
  54. package/dist/floating.js.map +1 -0
  55. package/dist/{index-DufwkB6W.d.ts → index-BFnXIfOj.d.ts} +3 -3
  56. package/dist/{index-DufwkB6W.d.ts.map → index-BFnXIfOj.d.ts.map} +1 -1
  57. package/dist/index.d.ts +4 -4
  58. package/dist/index.js +4 -4
  59. package/dist/{jsx-runtime-DMDVr7A5.d.ts → jsx-runtime-DQnpyT_g.d.ts} +2 -2
  60. package/dist/{jsx-runtime-DMDVr7A5.d.ts.map → jsx-runtime-DQnpyT_g.d.ts.map} +1 -1
  61. package/dist/jsx-runtime.d.ts +1 -1
  62. package/dist/jsx-runtime.js +2 -2
  63. package/dist/jsx-runtime.js.map +1 -1
  64. package/dist/konva.d.ts +3 -3
  65. package/dist/konva.js +2 -2
  66. package/dist/motion.d.ts +39 -16
  67. package/dist/motion.d.ts.map +1 -1
  68. package/dist/motion.js +419 -25
  69. package/dist/motion.js.map +1 -1
  70. package/dist/renderer.d.ts +1 -1
  71. package/dist/renderer.js +2 -2
  72. package/dist/{server-renderer-DcU55e6s.js → server-renderer-D0rsFL_-.js} +3 -3
  73. package/dist/{server-renderer-DcU55e6s.js.map → server-renderer-D0rsFL_-.js.map} +1 -1
  74. package/dist/server.d.ts +1 -1
  75. package/dist/server.js +1 -1
  76. package/dist/size.json +12 -12
  77. package/dist/{development/src-WSHJxR9b.js → src-Bme1kz2b.js} +2 -2
  78. package/dist/{src-DWIqXCiz.js.map → src-Bme1kz2b.js.map} +1 -1
  79. package/dist/three.d.ts +27 -8
  80. package/dist/three.d.ts.map +1 -1
  81. package/dist/three.js +87 -31
  82. package/dist/three.js.map +1 -1
  83. package/dist/{vite-CSHoxzXU.js → vite-Bmyb6P5w.js} +32 -7
  84. package/dist/vite-Bmyb6P5w.js.map +1 -0
  85. package/dist/vite.js +1 -1
  86. package/package.json +18 -5
  87. package/src/astro-request.ts +1 -1
  88. package/src/capabilities.ts +11 -4
  89. package/src/compiler.ts +28 -9
  90. package/src/core.ts +26 -12
  91. package/src/dom.ts +12 -11
  92. package/src/floating.ts +234 -0
  93. package/src/index.ts +1 -0
  94. package/src/jsx-runtime.ts +4 -1
  95. package/src/motion-layout.ts +363 -0
  96. package/src/motion-transition.ts +92 -0
  97. package/src/motion-tween.ts +19 -2
  98. package/src/motion.ts +215 -77
  99. package/src/presence.ts +1 -1
  100. package/src/three-events.ts +14 -10
  101. package/src/three.ts +134 -39
  102. package/dist/capabilities-BCtBG-ni.d.ts.map +0 -1
  103. package/dist/capabilities-BkQ2i0vV.js.map +0 -1
  104. package/dist/core-DjFJ0aIJ.js.map +0 -1
  105. package/dist/development/capabilities-BkQ2i0vV.js.map +0 -1
  106. package/dist/development/core-DxPiKryn.js.map +0 -1
  107. package/dist/development/vite-CSHoxzXU.js.map +0 -1
  108. package/dist/vite-CSHoxzXU.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"astro-request-DRKvDjsO.js","names":[],"sources":["../../src/astro-request.ts"],"sourcesContent":["import type { RootStore } from \"atom.io/internal\"\nimport { IMPLICIT, Store } from \"atom.io/internal\"\n\nimport { applicationContext } from \"./astro-context.ts\"\n\nconst requests = new WeakMap<Request, ReturnType<typeof createRequest>>()\nfunction createRequest() {\n\tconst application = applicationContext()\n\tlet store: RootStore | undefined\n\treturn {\n\t\tapplication,\n\t\tget store(): RootStore {\n\t\t\tapplication.signal.throwIfAborted()\n\t\t\tif (!store) {\n\t\t\t\tstore = new Store(\n\t\t\t\t\t{ name: `spa-request`, lifespan: `ephemeral`, isProduction: true },\n\t\t\t\t\tIMPLICIT.STORE,\n\t\t\t\t) as RootStore\n\t\t\t\tconst selected = store\n\t\t\t\tapplication.onCleanup(() => {\n\t\t\t\t\tconst errors: unknown[] = []\n\t\t\t\t\tfor (const state of selected.atoms.values()) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tstate.cleanup?.()\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\terrors.push(error)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tfor (const resource of selected.miscResources.values()) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tresource[Symbol.dispose]()\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\terrors.push(error)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (errors.length)\n\t\t\t\t\t\tthrow new AggregateError(errors, `spa: request cleanup failed`)\n\t\t\t\t})\n\t\t\t}\n\t\t\tsyncDefinitions(store)\n\t\t\treturn store\n\t\t},\n\t}\n}\nexport function requestApplication(\n\trequest: Request,\n): ReturnType<typeof createRequest> {\n\tlet app = requests.get(request)\n\tif (!app) {\n\t\tapp = createRequest()\n\t\trequests.set(request, app)\n\t\tconst dispose = () => {\n\t\t\tapp!.application.dispose()\n\t\t}\n\t\trequest.signal.addEventListener(`abort`, dispose, { once: true })\n\t\tapp.application.onCleanup(() => {\n\t\t\trequest.signal.removeEventListener(`abort`, dispose)\n\t\t})\n\t\tif (request.signal.aborted) dispose()\n\t}\n\treturn app\n}\n/** Install definitions imported after an earlier island started this request. */\nexport function syncDefinitions(store: RootStore): void {\n\tconst source = IMPLICIT.STORE\n\tfor (const field of [\n\t\t`families`,\n\t\t`atoms`,\n\t\t`readonlySelectors`,\n\t\t`writableSelectors`,\n\t\t`transactions`,\n\t\t`timelineFamilies`,\n\t\t`timelines`,\n\t] as const) {\n\t\tfor (const [key, resource] of source[field]) {\n\t\t\tif (!store[field].has(key)) resource.install(store)\n\t\t}\n\t}\n}\n"],"mappings":";;;AAKA,MAAM,2BAAW,IAAI,QAAmD;AACxE,SAAS,gBAAgB;CACxB,MAAM,cAAc,mBAAmB;CACvC,IAAI;CACJ,OAAO;EACN;EACA,IAAI,QAAmB;GACtB,YAAY,OAAO,eAAe;GAClC,IAAI,CAAC,OAAO;IACX,QAAQ,IAAI,MACX;KAAE,MAAM;KAAe,UAAU;KAAa,cAAc;IAAK,GACjE,SAAS,KACV;IACA,MAAM,WAAW;IACjB,YAAY,gBAAgB;KAC3B,MAAM,SAAoB,CAAC;KAC3B,KAAK,MAAM,SAAS,SAAS,MAAM,OAAO,GACzC,IAAI;MACH,MAAM,UAAU;KACjB,SAAS,OAAO;MACf,OAAO,KAAK,KAAK;KAClB;KAED,KAAK,MAAM,YAAY,SAAS,cAAc,OAAO,GACpD,IAAI;MACH,SAAS,OAAO,QAAQ,CAAC;KAC1B,SAAS,OAAO;MACf,OAAO,KAAK,KAAK;KAClB;KAED,IAAI,OAAO,QACV,MAAM,IAAI,eAAe,QAAQ,6BAA6B;IAChE,CAAC;GACF;GACA,gBAAgB,KAAK;GACrB,OAAO;EACR;CACD;AACD;AACA,SAAgB,mBACf,SACmC;CACnC,IAAI,MAAM,SAAS,IAAI,OAAO;CAC9B,IAAI,CAAC,KAAK;EACT,MAAM,cAAc;EACpB,SAAS,IAAI,SAAS,GAAG;EACzB,MAAM,gBAAgB;GACrB,IAAK,YAAY,QAAQ;EAC1B;EACA,QAAQ,OAAO,iBAAiB,SAAS,SAAS,EAAE,MAAM,KAAK,CAAC;EAChE,IAAI,YAAY,gBAAgB;GAC/B,QAAQ,OAAO,oBAAoB,SAAS,OAAO;EACpD,CAAC;EACD,IAAI,QAAQ,OAAO,SAAS,QAAQ;CACrC;CACA,OAAO;AACR;;AAEA,SAAgB,gBAAgB,OAAwB;CACvD,MAAM,SAAS,SAAS;CACxB,KAAK,MAAM,SAAS;EACnB;EACA;EACA;EACA;EACA;EACA;EACA;CACD,GACC,KAAK,MAAM,CAAC,KAAK,aAAa,OAAO,QACpC,IAAI,CAAC,MAAM,MAAM,CAAC,IAAI,GAAG,GAAG,SAAS,QAAQ,KAAK;AAGrD"}
1
+ {"version":3,"file":"astro-request-DRKvDjsO.js","names":[],"sources":["../../src/astro-request.ts"],"sourcesContent":["import type { RootStore } from \"atom.io/internal\"\nimport { IMPLICIT, Store } from \"atom.io/internal\"\n\nimport { applicationContext } from \"./astro-context.ts\"\n\nconst requests = new WeakMap<Request, ReturnType<typeof createRequest>>()\nfunction createRequest() {\n\tconst application = applicationContext()\n\tlet store: RootStore | undefined\n\treturn {\n\t\tapplication,\n\t\tget store(): RootStore {\n\t\t\tapplication.signal.throwIfAborted()\n\t\t\tif (!store) {\n\t\t\t\tstore = new Store(\n\t\t\t\t\t{ name: `spa-request`, lifespan: `ephemeral`, isProduction: true },\n\t\t\t\t\tIMPLICIT.STORE,\n\t\t\t\t) as RootStore\n\t\t\t\tconst selected = store\n\t\t\t\tapplication.onCleanup(() => {\n\t\t\t\t\tconst errors: unknown[] = []\n\t\t\t\t\tfor (const state of selected.atoms.values()) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tstate.cleanup?.()\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\terrors.push(error)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tfor (const resource of selected.miscResources.values()) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tresource[Symbol.dispose]()\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\terrors.push(error)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (errors.length)\n\t\t\t\t\t\tthrow new AggregateError(errors, `spa: request cleanup failed`)\n\t\t\t\t})\n\t\t\t}\n\t\t\tsyncDefinitions(store)\n\t\t\treturn store\n\t\t},\n\t}\n}\nexport function requestApplication(\n\trequest: Request,\n): ReturnType<typeof createRequest> {\n\tlet app = requests.get(request)\n\tif (!app) {\n\t\tapp = createRequest()\n\t\trequests.set(request, app)\n\t\tconst dispose = () => {\n\t\t\tapp!.application.dispose()\n\t\t}\n\t\trequest.signal.addEventListener(`abort`, dispose, { once: true })\n\t\tapp.application.onCleanup(() => {\n\t\t\trequest.signal.removeEventListener(`abort`, dispose)\n\t\t})\n\t\tif (request.signal.aborted) dispose()\n\t}\n\treturn app\n}\n/** Install definitions imported after an earlier island started this request. */\nfunction syncDefinitions(store: RootStore): void {\n\tconst source = IMPLICIT.STORE\n\tfor (const field of [\n\t\t`families`,\n\t\t`atoms`,\n\t\t`readonlySelectors`,\n\t\t`writableSelectors`,\n\t\t`transactions`,\n\t\t`timelineFamilies`,\n\t\t`timelines`,\n\t] as const) {\n\t\tfor (const [key, resource] of source[field]) {\n\t\t\tif (!store[field].has(key)) resource.install(store)\n\t\t}\n\t}\n}\n"],"mappings":";;;AAKA,MAAM,2BAAW,IAAI,QAAmD;AACxE,SAAS,gBAAgB;CACxB,MAAM,cAAc,mBAAmB;CACvC,IAAI;CACJ,OAAO;EACN;EACA,IAAI,QAAmB;GACtB,YAAY,OAAO,eAAe;GAClC,IAAI,CAAC,OAAO;IACX,QAAQ,IAAI,MACX;KAAE,MAAM;KAAe,UAAU;KAAa,cAAc;IAAK,GACjE,SAAS,KACV;IACA,MAAM,WAAW;IACjB,YAAY,gBAAgB;KAC3B,MAAM,SAAoB,CAAC;KAC3B,KAAK,MAAM,SAAS,SAAS,MAAM,OAAO,GACzC,IAAI;MACH,MAAM,UAAU;KACjB,SAAS,OAAO;MACf,OAAO,KAAK,KAAK;KAClB;KAED,KAAK,MAAM,YAAY,SAAS,cAAc,OAAO,GACpD,IAAI;MACH,SAAS,OAAO,QAAQ,CAAC;KAC1B,SAAS,OAAO;MACf,OAAO,KAAK,KAAK;KAClB;KAED,IAAI,OAAO,QACV,MAAM,IAAI,eAAe,QAAQ,6BAA6B;IAChE,CAAC;GACF;GACA,gBAAgB,KAAK;GACrB,OAAO;EACR;CACD;AACD;AACA,SAAgB,mBACf,SACmC;CACnC,IAAI,MAAM,SAAS,IAAI,OAAO;CAC9B,IAAI,CAAC,KAAK;EACT,MAAM,cAAc;EACpB,SAAS,IAAI,SAAS,GAAG;EACzB,MAAM,gBAAgB;GACrB,IAAK,YAAY,QAAQ;EAC1B;EACA,QAAQ,OAAO,iBAAiB,SAAS,SAAS,EAAE,MAAM,KAAK,CAAC;EAChE,IAAI,YAAY,gBAAgB;GAC/B,QAAQ,OAAO,oBAAoB,SAAS,OAAO;EACpD,CAAC;EACD,IAAI,QAAQ,OAAO,SAAS,QAAQ;CACrC;CACA,OAAO;AACR;;AAEA,SAAS,gBAAgB,OAAwB;CAChD,MAAM,SAAS,SAAS;CACxB,KAAK,MAAM,SAAS;EACnB;EACA;EACA;EACA;EACA;EACA;EACA;CACD,GACC,KAAK,MAAM,CAAC,KAAK,aAAa,OAAO,QACpC,IAAI,CAAC,MAAM,MAAM,CAAC,IAAI,GAAG,GAAG,SAAS,QAAQ,KAAK;AAGrD"}
@@ -1,7 +1,7 @@
1
1
  import { n as failPreparation, r as storeContext } from "./astro-context-OdlexHR4.js";
2
2
  import { t as requestApplication } from "./astro-request-DRKvDjsO.js";
3
3
  import { n as islandStore, t as island } from "./astro-shared-83hxw7-M.js";
4
- import { t as renderToStringWithReads } from "./server-renderer-CUQXh9oF.js";
4
+ import { t as renderToStringWithReads } from "./server-renderer-DCLoMdOX.js";
5
5
  // src/astro-server.ts
6
6
  const createRenderer = (awaitState = false) => ({
7
7
  name: `spa`,
@@ -1,4 +1,4 @@
1
- import { t as spa } from "./vite-CSHoxzXU.js";
1
+ import { t as spa } from "./vite-Bmyb6P5w.js";
2
2
  // src/astro.ts
3
3
  function integration(options = {}) {
4
4
  return {
@@ -12,7 +12,7 @@ function validateCapabilities(scope, props) {
12
12
  }
13
13
  }
14
14
  /** Separate framework properties from native attributes and own their bindings. */
15
- function capabilityProps(scope, target, read) {
15
+ function capabilityProps(scope, target, read, applyNative) {
16
16
  const bindings = /* @__PURE__ */ new Map();
17
17
  scope._root._presence?.target(scope, target);
18
18
  const cleanup = () => {
@@ -41,14 +41,16 @@ function capabilityProps(scope, target, read) {
41
41
  group[key.slice(namespace.length + 1)] = props[key];
42
42
  groups.set(namespace, group);
43
43
  }
44
+ const previousStyle = applyNative?.(native);
44
45
  for (const [namespace, values] of groups) {
45
46
  let binding = bindings.get(namespace);
46
47
  if (!binding) {
47
- binding = scope._root._capabilities.get(namespace).attach(target);
48
+ binding = scope._root._capabilities.get(namespace).attach(target, scope);
48
49
  bindings.set(namespace, binding);
49
50
  scope._root._presence?.bind(scope, binding, read ?? (() => props), namespace);
50
51
  }
51
- binding.update(values);
52
+ if (previousStyle !== void 0) binding.update(values, previousStyle);
53
+ else binding.update(values);
52
54
  }
53
55
  for (const [namespace, binding] of bindings) if (!groups.has(namespace)) {
54
56
  bindings.delete(namespace);
@@ -60,4 +62,4 @@ function capabilityProps(scope, target, read) {
60
62
  }
61
63
  export { capabilityProps as n, validateCapabilities as r, capabilityNamespace as t };
62
64
 
63
- //# sourceMappingURL=capabilities-BkQ2i0vV.js.map
65
+ //# sourceMappingURL=capabilities-nOIitQ-_.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities-nOIitQ-_.js","names":[],"sources":["../../src/capabilities.ts"],"sourcesContent":["import type { Cleanup, Root, Scope } from \"./core.ts\"\nimport type { ExitHandle, PresenceCoordinator } from \"./presence.ts\"\n\n/** Native renderers expose property access without importing capability engines. */\nexport interface CapabilityTarget {\n\tkind: string\n\tnode: unknown\n\tsuspend?(): Cleanup\n\tread?(key: string): unknown\n\twrite?(key: string, value: unknown): void\n\tlisten?(event: string, listener: () => void): Cleanup\n}\nexport interface CapabilityBinding {\n\texit?(props: Record<string, unknown>): ExitHandle | undefined\n\tresume?(): void\n\t/** Inline CSS before native style replacement, for restoring capability-owned values. */\n\tupdate(props: Record<string, unknown>, previousStyle?: string): void\n\tdispose(): void\n}\nexport interface Capability {\n\tnamespace: string\n\t/** Prepare a synchronous update batch and return its commit callback. */\n\tbeforeUpdate?(root: Root): Cleanup\n\tpresence?(root: Root): PresenceCoordinator\n\tscheduleFrame?(callback: (time: number) => void): Cleanup\n\t/** SPA supplies ownership for integrations that measure after mount or report async errors. */\n\tattach(target: CapabilityTarget, scope?: Scope): CapabilityBinding\n}\n\nexport function capabilityNamespace(key: string): string | undefined {\n\tconst colon = key.indexOf(`:`)\n\tif (colon < 0) return undefined\n\tconst namespace = key.slice(0, colon)\n\treturn /^(xml|xmlns|xlink)$/.test(namespace) ? undefined : namespace\n}\nexport function validateCapabilities(\n\tscope: Scope,\n\tprops: Record<string, unknown>,\n): void {\n\tfor (const key of Object.keys(props)) {\n\t\tconst namespace = capabilityNamespace(key)\n\t\tif (namespace && !scope._root._capabilities.has(namespace))\n\t\t\tthrow new Error(\n\t\t\t\t`spa: capability \"${namespace}\" is not registered for this root`,\n\t\t\t)\n\t}\n}\n\n/** Separate framework properties from native attributes and own their bindings. */\nexport function capabilityProps(\n\tscope: Scope,\n\ttarget: CapabilityTarget,\n\tread?: () => Record<string, any>,\n\tapplyNative?: (props: Record<string, any>) => string | undefined,\n): (props: Record<string, any>) => Record<string, any> {\n\tconst bindings = new Map<string, CapabilityBinding>()\n\n\tscope._root._presence?.target(scope, target)\n\tconst cleanup: Cleanup = () => {\n\t\tconst errors: unknown[] = []\n\t\tfor (const binding of [...bindings.values()].reverse()) {\n\t\t\ttry {\n\t\t\t\tbinding.dispose()\n\t\t\t} catch (error) {\n\t\t\t\terrors.push(error)\n\t\t\t}\n\t\t}\n\t\tbindings.clear()\n\t\tif (errors.length) throw new AggregateError(errors)\n\t}\n\tscope._cleanups.add(cleanup)\n\treturn (props) => {\n\t\tvalidateCapabilities(scope, props)\n\t\tconst native: Record<string, any> = {}\n\t\tconst groups = new Map<string, Record<string, unknown>>()\n\t\tfor (const key of Object.keys(props)) {\n\t\t\tconst namespace = capabilityNamespace(key)\n\t\t\tif (!namespace) {\n\t\t\t\tconst value = props[key]\n\t\t\t\tnative[key] =\n\t\t\t\t\tkey.startsWith(`on`) && typeof value === `function`\n\t\t\t\t\t\t? (scope._root._presence?.event(scope, value) ?? value)\n\t\t\t\t\t\t: value\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tconst group = groups.get(namespace) ?? {}\n\t\t\tgroup[key.slice(namespace.length + 1)] = props[key]\n\t\t\tgroups.set(namespace, group)\n\t\t}\n\t\tconst previousStyle = applyNative?.(native)\n\t\tfor (const [namespace, values] of groups) {\n\t\t\tlet binding = bindings.get(namespace)\n\t\t\tif (!binding) {\n\t\t\t\tbinding = scope._root._capabilities.get(namespace)!.attach(target, scope)\n\t\t\t\tbindings.set(namespace, binding)\n\t\t\t\tscope._root._presence?.bind(\n\t\t\t\t\tscope,\n\t\t\t\t\tbinding,\n\t\t\t\t\tread ?? (() => props),\n\t\t\t\t\tnamespace,\n\t\t\t\t)\n\t\t\t}\n\t\t\tif (previousStyle !== undefined) binding.update(values, previousStyle)\n\t\t\telse binding.update(values)\n\t\t}\n\t\tfor (const [namespace, binding] of bindings)\n\t\t\tif (!groups.has(namespace)) {\n\t\t\t\tbindings.delete(namespace)\n\t\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AM,WAAW,MAAM,OAAO,KAAK,KAAK,QAC/C;IACJ;GACD;GACA,MAAM,QAAQ,OAAO,IAAI,SAAS,KAAK,CAAC;GACxC,MAAM,IAAI,MAAM,UAAU,SAAS,CAAC,KAAK,MAAM;GAC/C,OAAO,IAAI,WAAW,KAAK;EAC5B;EACA,MAAM,gBAAgB,cAAc,MAAM;EAC1C,KAAK,MAAM,CAAC,WAAW,WAAW,QAAQ;GACzC,IAAI,UAAU,SAAS,IAAI,SAAS;GACpC,IAAI,CAAC,SAAS;IACb,UAAU,MAAM,MAAM,cAAc,IAAI,SAAS,CAAC,CAAE,OAAO,QAAQ,KAAK;IACxE,SAAS,IAAI,WAAW,OAAO;IAC/B,MAAM,MAAM,WAAW,KACtB,OACA,SACA,eAAe,QACf,SACD;GACD;GACA,IAAI,kBAAkB,KAAA,GAAW,QAAQ,OAAO,QAAQ,aAAa;QAChE,QAAQ,OAAO,MAAM;EAC3B;EACA,KAAK,MAAM,CAAC,WAAW,YAAY,UAClC,IAAI,CAAC,OAAO,IAAI,SAAS,GAAG;GAC3B,SAAS,OAAO,SAAS;GACzB,MAAM,MAAM,WAAW,OAAO,OAAO;GACrC,QAAQ,QAAQ;EACjB;EACD,OAAO;CACR;AACD"}
@@ -1,4 +1,4 @@
1
- import { IMPLICIT, actUponStore, clearTimelineInStore, findInStore, findTimelineInStore, getFromStore, getTimelineTransactionAtHead, setIntoStore, subscribeToState, subscribeToTimeline, timeTravel, timeTravelTransactionGroupInStore, withdraw } from "atom.io/internal";
1
+ import { IMPLICIT, actUponStore, clearTimelineInStore, disposeFromStore, findInStore, findTimelineInStore, getFromStore, getTimelineTransactionAtHead, setIntoStore, subscribeToState, subscribeToTimeline, timeTravel, timeTravelTransactionGroupInStore, withdraw } from "atom.io/internal";
2
2
  // src/core.ts
3
3
  let owner;
4
4
  let tracking;
@@ -99,12 +99,18 @@ function createRoot(options = {}, server = false) {
99
99
  root._presence = capability.presence(root);
100
100
  }
101
101
  root.flush = () => {
102
+ if (!root._queue.size && !root._mounts.length) return;
102
103
  try {
103
- let passes = 0;
104
- while (root._queue.size || root._mounts.length) {
105
- if (++passes > 100) throw new Error(`spa: update loop`);
106
- for (const run of [...root._queue]) if (root._queue.delete(run)) run();
107
- for (const run of root._mounts.splice(0)) run();
104
+ const commits = [...capabilities.values()].map((capability) => capability.beforeUpdate?.(root));
105
+ try {
106
+ let passes = 0;
107
+ while (root._queue.size || root._mounts.length) {
108
+ if (++passes > 100) throw new Error(`spa: update loop`);
109
+ for (const run of [...root._queue]) if (root._queue.delete(run)) run();
110
+ for (const run of root._mounts.splice(0)) run();
111
+ }
112
+ } finally {
113
+ for (const commit of commits) commit?.();
108
114
  }
109
115
  } catch (error) {
110
116
  fail(root, error);
@@ -116,6 +122,10 @@ function createRoot(options = {}, server = false) {
116
122
  function useStore() {
117
123
  return owner._root._store;
118
124
  }
125
+ /** Return atom.io disposal bound to the current root's store. */
126
+ function useDisposal() {
127
+ return disposeFromStore.bind(null, useStore());
128
+ }
119
129
  function onCleanup(cleanup) {
120
130
  owner._cleanups.add(cleanup);
121
131
  }
@@ -166,13 +176,13 @@ function observe(scope, read, apply) {
166
176
  }
167
177
  /** Resolve a fixed family key in the current owner's store. */
168
178
  function resolveStateToken(token, key) {
169
- const store = owner._root._store;
179
+ const store = useStore();
170
180
  return token.type.endsWith(`_family`) ? findInStore(store, token, key) : token;
171
181
  }
172
182
  function useGetter(token, key) {
173
183
  token = resolveStateToken(token, key);
174
184
  const root = owner._root;
175
- const store = root._store;
185
+ const store = useStore();
176
186
  const subscribe = (notify) => subscribeToState(store, token, `spa:${serial++}`, notify);
177
187
  return () => {
178
188
  const value = getFromStore(store, token);
@@ -183,18 +193,18 @@ function useGetter(token, key) {
183
193
  }
184
194
  function useSetter(token, key) {
185
195
  token = resolveStateToken(token, key);
186
- const store = owner._root._store;
196
+ const store = useStore();
187
197
  return (value) => {
188
198
  setIntoStore(store, token, value);
189
199
  };
190
200
  }
191
201
  function useTransaction(token) {
192
- return actUponStore(owner._root._store, token, `spa:${serial++}`);
202
+ return actUponStore(useStore(), token, `spa:${serial++}`);
193
203
  }
194
204
  const refs = /* @__PURE__ */ new WeakMap();
195
205
  function useRef(token, key) {
196
206
  token = resolveStateToken(token, key);
197
- const store = owner._root._store;
207
+ const store = useStore();
198
208
  const owners = refs.get(store) ?? /* @__PURE__ */ new Map();
199
209
  refs.set(store, owners);
200
210
  const identity = {};
@@ -212,7 +222,7 @@ function useRef(token, key) {
212
222
  };
213
223
  }
214
224
  function useTimeline(token, key) {
215
- const store = owner._root._store;
225
+ const store = useStore();
216
226
  const selected = token.type === `timeline_family` ? findTimelineInStore(store, token, key) : token;
217
227
  const subscribe = (notify) => subscribeToTimeline(store, selected, `spa:${serial++}`, notify);
218
228
  const read = () => {
@@ -256,6 +266,6 @@ function isPresent(scope) {
256
266
  for (let at = scope; at; at = at._parent) if (at._dead || at._exiting) return false;
257
267
  return true;
258
268
  }
259
- export { useSetter as _, invalidate as a, useTransaction as b, onCleanup as c, plain as d, resolveStateToken as f, useRef as g, useId as h, fail as i, onMount as l, useGetter as m, createScope as n, isPresent as o, untrack as p, dispose as r, observe as s, createRoot as t, owner as u, useStore as v, within as x, useTimeline as y };
269
+ export { within as S, useRef as _, invalidate as a, useTimeline as b, onCleanup as c, plain as d, resolveStateToken as f, useId as g, useGetter as h, fail as i, onMount as l, useDisposal as m, createScope as n, isPresent as o, untrack as p, dispose as r, observe as s, createRoot as t, owner as u, useSetter as v, useTransaction as x, useStore as y };
260
270
 
261
- //# sourceMappingURL=core-DxPiKryn.js.map
271
+ //# sourceMappingURL=core-BHA7I1nf.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core-BHA7I1nf.js","names":[],"sources":["../../src/core.ts"],"sourcesContent":["import type {\n\tdisposeState,\n\tReadableFamilyToken,\n\tReadableToken,\n\tRegularAtomFamilyToken,\n\tRegularAtomToken,\n\tSetter,\n\tTimelineFamilyToken,\n\tTimelineManageable,\n\tTimelineToken,\n\tTransactionToken,\n\tViewOf,\n\tWritableFamilyToken,\n\tWritableToken,\n} from \"atom.io\"\nimport type { Canonical } from \"atom.io/foundations/canonical\"\nimport type { RootStore } from \"atom.io/internal\"\nimport {\n\tactUponStore,\n\tclearTimelineInStore,\n\tdisposeFromStore,\n\tfindInStore,\n\tfindTimelineInStore,\n\tgetFromStore,\n\tgetTimelineTransactionAtHead,\n\tIMPLICIT,\n\tsetIntoStore,\n\tsubscribeToState,\n\tsubscribeToTimeline,\n\ttimeTravel,\n\ttimeTravelTransactionGroupInStore,\n\twithdraw,\n} from \"atom.io/internal\"\n\nimport type { Capability } from \"./capabilities.ts\"\nimport type {\n\tExitParticipant,\n\tPresenceCoordinator,\n\tPresenceTarget,\n} from \"./presence.ts\"\n\nexport type Cleanup = () => void\n// A callable interface permits the recursive Children union. A type alias does not.\n/* oxlint-disable typescript/prefer-function-type -- A callable interface is required for recursive Children. */\nexport interface Accessor<T> {\n\t(): T\n}\n/* oxlint-enable typescript/prefer-function-type */\nexport type Component<P = any> = (props: P) => Children\n/** A JSX descriptor for an intrinsic tag, component, or fragment. */\nexport interface SpaElement {\n\ttype: string | Component | null\n\tprops: Record<string, any>\n}\n/** Renderable content, including nested groups and reactive accessors. */\nexport type Children =\n\t| SpaElement\n\t| string\n\t| number\n\t| bigint\n\t| boolean\n\t| null\n\t| undefined\n\t| readonly Children[]\n\t| Accessor<Children>\nexport interface RootOptions {\n\tcapabilities?: readonly Capability[]\n\tstore?: RootStore\n\tidPrefix?: string\n\tonError?: (error: unknown) => void\n}\nexport interface Scope {\n\t_exiting?: boolean\n\t_exits?: Set<ExitParticipant>\n\t_targets?: Set<PresenceTarget>\n\t_root: Root\n\t_parent?: Scope | undefined\n\t_cleanups: Set<Cleanup | Scope>\n\t_updates: Cleanup[]\n\t_dead: boolean\n}\nexport interface Root extends Scope {\n\t_onRead?: ((value: unknown, token: ReadableToken<unknown>) => void) | undefined\n\t_presence?: PresenceCoordinator\n\t_capabilities: Map<string, Capability>\n\t_store: RootStore\n\t_prefix: string\n\t_id: number\n\t_queue: Set<Cleanup>\n\t_mounts: Cleanup[] | undefined\n\tflush: Cleanup\n\terror: (error: unknown) => void\n}\n\nexport let owner: Scope | undefined\ntype Subscribe = (notify: Cleanup) => Cleanup\nlet tracking: ((subscribe: Subscribe) => void) | undefined\nlet serial = 0\n\nexport function within<T>(scope: Scope, run: () => T): T {\n\tconst previous = owner\n\towner = scope\n\ttry {\n\t\treturn run()\n\t} finally {\n\t\towner = previous\n\t}\n}\nexport function untrack<T>(run: () => T): T {\n\tconst previous = tracking\n\ttracking = undefined\n\ttry {\n\t\treturn run()\n\t} finally {\n\t\ttracking = previous\n\t}\n}\nexport function createScope(parent?: Scope): Scope {\n\tconst child: Scope = {\n\t\t_root: parent?._root as Root,\n\t\t_parent: parent,\n\t\t_cleanups: new Set(),\n\t\t_updates: [],\n\t\t_dead: false,\n\t}\n\tparent?._cleanups.add(child)\n\treturn child\n}\nexport function fail(scope: Scope, error: unknown): never {\n\ttry {\n\t\tdispose(scope)\n\t} catch (cleanup) {\n\t\tthrow new AggregateError([error, cleanup])\n\t}\n\tthrow error\n}\nexport function dispose(scope: Scope): void {\n\tif (scope._dead) return\n\tscope._dead = true\n\tconst errors: unknown[] = []\n\ttry {\n\t\tscope._root._presence?.forget(scope)\n\t} catch (error) {\n\t\terrors.push(error)\n\t}\n\tfor (const cleanup of [...scope._cleanups].reverse()) {\n\t\ttry {\n\t\t\ttypeof cleanup === `function` ? cleanup() : dispose(cleanup)\n\t\t} catch (error) {\n\t\t\terrors.push(error)\n\t\t}\n\t}\n\tscope._parent?._cleanups.delete(scope)\n\tscope._cleanups.clear()\n\tscope._updates.length = 0\n\tif (errors.length) throw new AggregateError(errors)\n}\nexport function invalidate(scope: Scope): void {\n\tfor (const run of scope._updates) enqueue(scope, run)\n\tfor (const child of scope._cleanups)\n\t\tif (typeof child !== `function`) invalidate(child)\n}\nfunction enqueue(scope: Scope, run: Cleanup): void {\n\tif (!isPresent(scope)) return\n\tconst root = scope._root\n\tif (!root._queue.size)\n\t\tqueueMicrotask(() => {\n\t\t\ttry {\n\t\t\t\troot.flush()\n\t\t\t} catch (error) {\n\t\t\t\troot.error(error)\n\t\t\t}\n\t\t})\n\troot._queue.add(run)\n}\nexport function createRoot(options: RootOptions = {}, server = false): Root {\n\tconst capabilities = new Map<string, Capability>()\n\tfor (const capability of options.capabilities ?? []) {\n\t\tif (capabilities.has(capability.namespace))\n\t\t\tthrow new Error(`spa: duplicate capability ${capability.namespace}`)\n\t\tcapabilities.set(capability.namespace, capability)\n\t}\n\tconst root = {\n\t\t_capabilities: capabilities,\n\t\t_store: options.store ?? IMPLICIT.STORE,\n\t\t_prefix: options.idPrefix ?? `w${serial++}`,\n\t\t_id: 0,\n\t\t...createScope(),\n\t\t_queue: new Set(),\n\t\t_mounts: server ? undefined : [],\n\t} as unknown as Root\n\troot._root = root\n\troot.error =\n\t\toptions.onError ??\n\t\t((error) => {\n\t\t\tthrow error\n\t\t})\n\tfor (const capability of capabilities.values())\n\t\tif (capability.presence) {\n\t\t\tif (root._presence) throw new Error(`spa: multiple presence coordinators`)\n\t\t\troot._presence = capability.presence(root)\n\t\t}\n\troot.flush = () => {\n\t\tif (!root._queue.size && !root._mounts!.length) return\n\t\ttry {\n\t\t\tconst commits = [...capabilities.values()].map((capability) =>\n\t\t\t\tcapability.beforeUpdate?.(root),\n\t\t\t)\n\t\t\ttry {\n\t\t\t\tlet passes = 0\n\t\t\t\twhile (root._queue.size || root._mounts!.length) {\n\t\t\t\t\tif (import.meta.env.DEV && ++passes > 100)\n\t\t\t\t\t\tthrow new Error(`spa: update loop`)\n\t\t\t\t\tfor (const run of [...root._queue]) if (root._queue.delete(run)) run()\n\t\t\t\t\tfor (const run of root._mounts!.splice(0)) run()\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tfor (const commit of commits) commit?.()\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tfail(root, error)\n\t\t}\n\t}\n\treturn root\n}\n/** Return the atom.io store selected by the current root. */\nexport function useStore(): RootStore {\n\treturn owner!._root._store\n}\n/** Return atom.io disposal bound to the current root's store. */\nexport function useDisposal(): typeof disposeState {\n\treturn disposeFromStore.bind(null, useStore()) as typeof disposeState\n}\nexport function onCleanup(cleanup: Cleanup): void {\n\towner!._cleanups.add(cleanup)\n}\nexport function onMount(run: Cleanup): void {\n\tconst scope = owner!\n\tscope._root._mounts?.push(() => {\n\t\tif (!scope._dead)\n\t\t\twithin(scope, () => {\n\t\t\t\tuntrack(run)\n\t\t\t})\n\t})\n}\nexport function useId(): string {\n\tconst root = owner!._root\n\treturn `${root._prefix}-${root._id++}`\n}\n\nexport function observe<T>(\n\tscope: Scope,\n\tread: Accessor<T>,\n\tapply: (value: T) => void,\n): void {\n\tconst subscriptions = new Map<Subscribe, Cleanup>()\n\tconst run = () => {\n\t\tif (!isPresent(scope)) return\n\t\tconst used = new Set<Subscribe>()\n\t\tconst previous = tracking\n\t\ttracking = (subscribe) => {\n\t\t\tused.add(subscribe)\n\t\t\tif (!subscriptions.has(subscribe))\n\t\t\t\tsubscriptions.set(\n\t\t\t\t\tsubscribe,\n\t\t\t\t\tsubscribe(() => {\n\t\t\t\t\t\tenqueue(scope, run)\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t}\n\t\tlet value: T\n\t\ttry {\n\t\t\tvalue = within(scope, read)\n\t\t} finally {\n\t\t\ttracking = previous\n\t\t\tfor (const [subscribe, unsubscribe] of subscriptions)\n\t\t\t\tif (!used.has(subscribe)) {\n\t\t\t\t\tunsubscribe()\n\t\t\t\t\tsubscriptions.delete(subscribe)\n\t\t\t\t}\n\t\t}\n\t\tuntrack(() => {\n\t\t\tapply(value)\n\t\t})\n\t}\n\tscope._updates.push(run)\n\tscope._cleanups.add(() => {\n\t\tscope._root._queue.delete(run)\n\t\tfor (const unsubscribe of subscriptions.values()) unsubscribe()\n\t})\n\trun()\n}\n\n/** Resolve a fixed family key in the current owner's store. */\nexport function resolveStateToken(token: any, key?: Canonical): any {\n\tconst store = useStore()\n\treturn token.type.endsWith(`_family`) ? findInStore(store, token, key!) : token\n}\n\n/** Capture a token for this instance. Change the component key to change its token. */\nexport function useGetter<T, E = never>(\n\ttoken: ReadableToken<T, any, E>,\n): Accessor<ViewOf<T | E>>\nexport function useGetter<T, K extends Canonical, E = never>(\n\tfamily: ReadableFamilyToken<T, K, E>,\n\tkey: NoInfer<K>,\n): Accessor<ViewOf<T | E>>\nexport function useGetter(token: any, key?: Canonical): Accessor<any> {\n\ttoken = resolveStateToken(token, key)\n\tconst root = owner!._root\n\tconst store = useStore()\n\tconst subscribe: Subscribe = (notify) =>\n\t\tsubscribeToState(store, token, `spa:${serial++}`, notify)\n\treturn () => {\n\t\tconst value = getFromStore(store, token)\n\t\troot._onRead?.(value, token)\n\t\ttracking?.(subscribe)\n\t\treturn value\n\t}\n}\nexport function useSetter<T>(\n\ttoken: WritableToken<T, any, any>,\n): (value: T | Setter<T>) => void\nexport function useSetter<T, K extends Canonical>(\n\tfamily: WritableFamilyToken<T, K, any>,\n\tkey: NoInfer<K>,\n): (value: T | Setter<T>) => void\nexport function useSetter(token: any, key?: Canonical): (value: any) => void {\n\ttoken = resolveStateToken(token, key)\n\tconst store = useStore()\n\treturn (value) => {\n\t\tsetIntoStore(store, token, value)\n\t}\n}\nexport function useTransaction<F extends (...args: any[]) => any>(\n\ttoken: TransactionToken<F>,\n): (...args: Parameters<F>) => ReturnType<F> {\n\treturn actUponStore(useStore(), token, `spa:${serial++}`)\n}\n\nconst refs = new WeakMap<RootStore, Map<string, object>>()\nexport function useRef<E extends Element>(\n\ttoken: RegularAtomToken<E | null>,\n): (element: E | null) => void\nexport function useRef<E extends Element, K extends Canonical>(\n\tfamily: RegularAtomFamilyToken<E | null, K>,\n\tkey: NoInfer<K>,\n): (element: E | null) => void\nexport function useRef<E extends Element>(\n\ttoken: any,\n\tkey?: Canonical,\n): (element: E | null) => void {\n\ttoken = resolveStateToken(token, key)\n\tconst store = useStore()\n\tconst owners = refs.get(store) ?? new Map<string, object>()\n\trefs.set(store, owners)\n\tconst identity = {}\n\tlet held: E | null = null\n\treturn (element) => {\n\t\tif (element) {\n\t\t\theld = element\n\t\t\towners.set(token.key, identity)\n\t\t\tsetIntoStore(store, token, element)\n\t\t} else if (owners.get(token.key) === identity) {\n\t\t\towners.delete(token.key)\n\t\t\tif (getFromStore(store, token) === held) setIntoStore(store, token, null)\n\t\t\theld = null\n\t\t}\n\t}\n}\nexport interface TimelineControls {\n\tgetCursor(): number\n\tgetLength(): number\n\tundo(): void\n\tredo(): void\n\tclear(): void\n\tgetTransaction(): { undo?: Cleanup; redo?: Cleanup }\n}\nexport function useTimeline<M extends TimelineManageable>(\n\ttoken: TimelineToken<M>,\n): TimelineControls\nexport function useTimeline<K extends Canonical, M extends TimelineManageable>(\n\tfamily: TimelineFamilyToken<K, M>,\n\tkey: NoInfer<K>,\n): TimelineControls\nexport function useTimeline(token: any, key?: Canonical): TimelineControls {\n\tconst store = useStore()\n\tconst selected: TimelineToken<any> =\n\t\ttoken.type === `timeline_family`\n\t\t\t? findTimelineInStore(store, token, key!)\n\t\t\t: token\n\tconst subscribe: Subscribe = (notify) =>\n\t\tsubscribeToTimeline(store, selected, `spa:${serial++}`, notify)\n\tconst read = () => {\n\t\tconst timeline = withdraw(store, selected)\n\t\ttracking?.(subscribe)\n\t\treturn timeline\n\t}\n\treturn {\n\t\tgetCursor: () => read().at,\n\t\tgetLength: () => read().history.length,\n\t\tundo: () => {\n\t\t\ttimeTravel(store, `undo`, selected)\n\t\t},\n\t\tredo: () => {\n\t\t\ttimeTravel(store, `redo`, selected)\n\t\t},\n\t\tclear: () => {\n\t\t\tclearTimelineInStore(store, selected)\n\t\t},\n\t\tgetTransaction: () => {\n\t\t\tconst timeline = read()\n\t\t\tconst controls: ReturnType<TimelineControls[`getTransaction`]> = {}\n\t\t\tfor (const direction of [`undo`, `redo`] as const) {\n\t\t\t\tconst group = getTimelineTransactionAtHead(timeline, direction)\n\t\t\t\tif (group)\n\t\t\t\t\tcontrols[direction] = () => {\n\t\t\t\t\t\ttimeTravelTransactionGroupInStore(store, direction, group)\n\t\t\t\t\t}\n\t\t\t}\n\t\t\treturn controls\n\t\t},\n\t}\n}\n\nexport function plain(value: Children): string {\n\tif (typeof value === `function`) return plain(value())\n\tif (Array.isArray(value)) return value.map(plain).join(``)\n\tif (value == null || typeof value === `boolean`) return ``\n\tif (import.meta.env.DEV && typeof value === `object`)\n\t\tthrow new Error(`spa: text required`)\n\t// oxlint-disable-next-line typescript/no-base-to-string -- Valid text children are primitives here; development rejects malformed object children.\n\treturn String(value)\n}\n\nexport function isPresent(scope: Scope): boolean {\n\tfor (let at: Scope | undefined = scope; at; at = at._parent)\n\t\tif (at._dead || at._exiting) return false\n\treturn true\n}\n"],"mappings":";;AA8FA,IAAW;AAEX,IAAI;AACJ,IAAI,SAAS;AAEb,SAAgB,OAAU,OAAc,KAAiB;CACxD,MAAM,WAAW;CACjB,QAAQ;CACR,IAAI;EACH,OAAO,IAAI;CACZ,UAAU;EACT,QAAQ;CACT;AACD;AACA,SAAgB,QAAW,KAAiB;CAC3C,MAAM,WAAW;CACjB,WAAW,KAAA;CACX,IAAI;EACH,OAAO,IAAI;CACZ,UAAU;EACT,WAAW;CACZ;AACD;AACA,SAAgB,YAAY,QAAuB;CAClD,MAAM,QAAe;EACpB,OAAO,QAAQ;EACf,SAAS;EACT,2BAAW,IAAI,IAAI;EACnB,UAAU,CAAC;EACX,OAAO;CACR;CACA,QAAQ,UAAU,IAAI,KAAK;CAC3B,OAAO;AACR;AACA,SAAgB,KAAK,OAAc,OAAuB;CACzD,IAAI;EACH,QAAQ,KAAK;CACd,SAAS,SAAS;EACjB,MAAM,IAAI,eAAe,CAAC,OAAO,OAAO,CAAC;CAC1C;CACA,MAAM;AACP;AACA,SAAgB,QAAQ,OAAoB;CAC3C,IAAI,MAAM,OAAO;CACjB,MAAM,QAAQ;CACd,MAAM,SAAoB,CAAC;CAC3B,IAAI;EACH,M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AAO,QAAQ,QAAQ;EACnC;EACA,aAAa;GACZ,qBAAqB,OAAO,QAAQ;EACrC;EACA,sBAAsB;GACrB,MAAM,WAAW,KAAK;GACtB,MAAM,WAA2D,CAAC;GAClE,KAAK,MAAM,aAAa,CAAC,QAAQ,MAAM,GAAY;IAClD,MAAM,QAAQ,6BAA6B,UAAU,SAAS;IAC9D,IAAI,OACH,SAAS,mBAAmB;KAC3B,kCAAkC,OAAO,WAAW,KAAK;IAC1D;GACF;GACA,OAAO;EACR;CACD;AACD;AAEA,SAAgB,MAAM,OAAyB;CAC9C,IAAI,OAAO,UAAU,YAAY,OAAO,MAAM,MAAM,CAAC;CACrD,IAAI,MAAM,QAAQ,KAAK,GAAG,OAAO,MAAM,IAAI,KAAK,CAAC,CAAC,KAAK,EAAE;CACzD,IAAI,SAAS,QAAQ,OAAO,UAAU,WAAW,OAAO;CACxD,IAA2B,OAAO,UAAU,UAC3C,MAAM,IAAI,MAAM,oBAAoB;CAErC,OAAO,OAAO,KAAK;AACpB;AAEA,SAAgB,UAAU,OAAuB;CAChD,KAAK,IAAI,KAAwB,OAAO,IAAI,KAAK,GAAG,SACnD,IAAI,GAAG,SAAS,GAAG,UAAU,OAAO;CACrC,OAAO;AACR"}
@@ -1,5 +1,5 @@
1
- import { n as capabilityProps } from "./capabilities-BkQ2i0vV.js";
2
- import { a as invalidate, d as plain, i as fail, n as createScope, p as untrack, r as dispose, s as observe, t as createRoot, x as within } from "./core-DxPiKryn.js";
1
+ import { n as capabilityProps } from "./capabilities-nOIitQ-_.js";
2
+ import { S as within, a as invalidate, d as plain, i as fail, n as createScope, p as untrack, r as dispose, s as observe, t as createRoot } from "./core-BHA7I1nf.js";
3
3
  import { Fragment, merge } from "./jsx-runtime.js";
4
4
  // src/dom.ts
5
5
  const HTML = `http://www.w3.org/1999/xhtml`;
@@ -165,16 +165,12 @@ function mount(value, parent, before, owner, namespace, cursor, source = () => v
165
165
  if (!/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/.test(vnode.type) || ns !== HTML) mount(() => props[`children`], element, null, owner, vnode.type === `foreignObject` ? HTML : ns, children);
166
166
  finish(children);
167
167
  }
168
+ let previous = {};
168
169
  const nativeProps = capabilityProps(owner, {
169
170
  kind: `dom`,
170
171
  node: element
171
- }, () => ({ ...props }));
172
- let previous = {};
173
- owner._cleanups.add(() => {
174
- for (const key in previous) if (key.startsWith(`on`)) property(element, key, null, previous[key]);
175
- });
176
- observe(owner, () => ({ ...props }), (all) => {
177
- const next = nativeProps(all);
172
+ }, () => ({ ...props }), (next) => {
173
+ const previousStyle = previous[`style`] !== next[`style`] ? element.getAttribute(`style`) ?? `` : void 0;
178
174
  for (const key in {
179
175
  ...previous,
180
176
  ...next
@@ -183,7 +179,12 @@ function mount(value, parent, before, owner, namespace, cursor, source = () => v
183
179
  previous[key] = next[key];
184
180
  }
185
181
  previous = next;
182
+ return previousStyle;
183
+ });
184
+ owner._cleanups.add(() => {
185
+ for (const key in previous) if (key.startsWith(`on`)) property(element, key, null, previous[key]);
186
186
  });
187
+ observe(owner, () => ({ ...props }), nativeProps);
187
188
  const ref = untrack(() => props[`ref`]);
188
189
  if (ref) owner._root._mounts.unshift(() => {
189
190
  if (!owner._dead) {
@@ -237,4 +238,4 @@ function hydrate(setup, host, options = {}) {
237
238
  }
238
239
  export { render as n, hydrate as t };
239
240
 
240
- //# sourceMappingURL=dom-BytVV6Rp.js.map
241
+ //# sourceMappingURL=dom-DQ0M3rLL.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dom-BytVV6Rp.js","names":[],"sources":["../../src/dom.ts"],"sourcesContent":["import { capabilityProps } from \"./capabilities.ts\"\nimport type {\n\tAccessor,\n\tChildren,\n\tRootOptions,\n\tScope,\n\tSpaElement,\n} from \"./core.ts\"\nimport {\n\tcreateRoot,\n\tcreateScope,\n\tdispose,\n\tfail,\n\tinvalidate,\n\tobserve,\n\tplain,\n\tuntrack,\n\twithin,\n} from \"./core.ts\"\nimport { Fragment, merge } from \"./jsx-runtime.ts\"\n\nconst HTML = `http://www.w3.org/1999/xhtml`\nconst SVG = `http://www.w3.org/2000/svg`\ntype Cursor = {\n\tnode: Node | null\n\treport(expected: Node | null, found: Node | null): void\n}\ntype RecordNode = { _value: Children; _scope: Scope; _start: Node; _end: Node }\n\nfunction finish(cursor?: Cursor): void {\n\tif (cursor?.node) {\n\t\tcursor.report(null, cursor.node)\n\t\twhile (cursor.node) {\n\t\t\tconst node: Node = cursor.node\n\t\t\tcursor.node = node.nextSibling\n\t\t\t;(node as ChildNode).remove()\n\t\t}\n\t}\n}\n\nfunction take(\n\tnode: Node,\n\tparent: Node,\n\tbefore: Node | null,\n\towner: Scope,\n\tcursor?: Cursor,\n): Node {\n\tif (\n\t\tcursor &&\n\t\t!(node.nodeType === 3 && !node.nodeValue && cursor.node?.nodeType !== 3)\n\t) {\n\t\tconst found = cursor.node\n\t\tif (\n\t\t\t!found ||\n\t\t\tfound.nodeType !== node.nodeType ||\n\t\t\tfound.nodeName !== node.nodeName ||\n\t\t\t(found as Element).namespaceURI !== (node as Element).namespaceURI ||\n\t\t\t(node.nodeType !== 1 && found.nodeValue !== node.nodeValue)\n\t\t) {\n\t\t\tcursor.report(node, found)\n\t\t\tparent.insertBefore(node, found)\n\t\t\tcursor.node = found?.nextSibling ?? null\n\t\t\t;(found as ChildNode | null)?.remove()\n\t\t} else {\n\t\t\tnode = found\n\t\t\tcursor.node = found.nextSibling\n\t\t}\n\t} else parent.insertBefore(node, cursor ? cursor.node : before)\n\towner._cleanups.add(() => {\n\t\t;(node as ChildNode).remove()\n\t})\n\treturn node\n}\nfunction comment(\n\tvalue: string,\n\tparent: Node,\n\tbefore: Node | null,\n\towner: Scope,\n\tcursor?: Cursor,\n): Node {\n\treturn take(\n\t\tparent.ownerDocument!.createComment(value),\n\t\tparent,\n\t\tbefore,\n\t\towner,\n\t\tcursor,\n\t)\n}\nfunction property(\n\telement: Element,\n\tkey: string,\n\tvalue: any,\n\tprevious: any,\n): void {\n\tif (/^(key|children|ref)$/.test(key)) return\n\tif (key === `innerHTML` && element.localName === `astro-slot`) return\n\tif (\n\t\t/^(innerHTML|outerHTML|textContent|innerText|dangerouslySetInnerHTML)$/.test(\n\t\t\tkey,\n\t\t)\n\t)\n\t\tthrow new Error(import.meta.env.DEV ? `spa: owned content` : undefined)\n\tif (key.startsWith(`on`)) {\n\t\tconst capture = /(?<!Pointer)Capture$/.test(key)\n\t\tconst event = key\n\t\t\t.slice(2, capture ? -7 : undefined)\n\t\t\t.toLowerCase()\n\t\t\t.replace(`doubleclick`, `dblclick`)\n\t\tif (previous) element.removeEventListener(event, previous, capture)\n\t\tif (value != null) {\n\t\t\tif (import.meta.env.DEV && typeof value !== `function`)\n\t\t\t\tthrow new Error(`spa: event handler`)\n\t\t\telement.addEventListener(event, value, capture)\n\t\t}\n\t\treturn\n\t}\n\tif (key === `className`) key = `class`\n\tif (key === `htmlFor`) key = `for`\n\tif (\n\t\timport.meta.env.DEV &&\n\t\tkey === `style` &&\n\t\tvalue != null &&\n\t\ttypeof value !== `string`\n\t)\n\t\tthrow new Error(`spa: CSS string required`)\n\tif (\n\t\telement.namespaceURI === HTML &&\n\t\tkey in element &&\n\t\t!/^(style|form|list)$/.test(key)\n\t) {\n\t\tconst target = element as any\n\t\ttarget[key] = value ?? (typeof target[key] === `boolean` ? false : ``)\n\t} else if (value == null || (value === false && !/^(aria-|data-)/.test(key)))\n\t\telement.removeAttribute(key)\n\telse\n\t\telement.setAttribute(\n\t\t\tkey,\n\t\t\tvalue === true && !/^(aria-|data-)/.test(key) ? `` : String(value),\n\t\t)\n}\n\nfunction mount(\n\tvalue: Children,\n\tparent: Node,\n\tbefore: Node | null,\n\towner: Scope,\n\tnamespace: string,\n\tcursor?: Cursor,\n\tsource = () => value,\n): void {\n\tif (typeof value === `function`) {\n\t\tcomment(`{`, parent, before, owner, cursor)\n\t\tlet end: Node | null = null\n\t\tlet records = new Map<unknown, RecordNode>()\n\t\tconst presence = owner._root._presence?.collection<RecordNode, Children>(\n\t\t\t(record) => record._scope,\n\t\t\t(record, child) =>\n\t\t\t\ttypeof record._value === typeof child &&\n\t\t\t\t(record._value as SpaElement | null)?.type ===\n\t\t\t\t\t(child as SpaElement | null)?.type,\n\t\t)\n\t\tconst retire = (\n\t\t\trecord: RecordNode,\n\t\t\tkey: unknown,\n\t\t\teligible: boolean,\n\t\t\tindex: number,\n\t\t) => {\n\t\t\tif (presence) presence.remove(record, key, eligible, index, () => {})\n\t\t\telse dispose(record._scope)\n\t\t}\n\t\tlet initial = cursor\n\t\tobserve(\n\t\t\towner,\n\t\t\t() => (source() as () => Children)(),\n\t\t\t(next) => {\n\t\t\t\tconst values = ([next] as unknown[]).flat(Infinity) as Children[]\n\t\t\t\tconst kept = new Map<unknown, RecordNode>()\n\t\t\t\tconst focus = parent.ownerDocument!.activeElement as HTMLElement | null\n\t\t\t\tfor (let index = 0; index < values.length; index++) {\n\t\t\t\t\tconst child = values[index]\n\t\t\t\t\tconst vnode = child as SpaElement | null\n\t\t\t\t\tconst explicit = vnode?.props?.[`key`]\n\t\t\t\t\tconst key = explicit == null ? index : String(explicit)\n\t\t\t\t\tif (import.meta.env.DEV && kept.has(key))\n\t\t\t\t\t\tthrow new Error(`spa: duplicate key`)\n\t\t\t\t\tlet record = records.get(key)\n\t\t\t\t\tif (\n\t\t\t\t\t\trecord &&\n\t\t\t\t\t\t(typeof record._value !== typeof child ||\n\t\t\t\t\t\t\t(record._value as SpaElement | null)?.type !== vnode?.type)\n\t\t\t\t\t) {\n\t\t\t\t\t\tretire(\n\t\t\t\t\t\t\trecord,\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tchild == null || typeof child === `boolean`,\n\t\t\t\t\t\t\t[...records.keys()].indexOf(key),\n\t\t\t\t\t\t)\n\t\t\t\t\t\trecord = undefined\n\t\t\t\t\t}\n\t\t\t\t\trecord ??= presence?.take(key, child)\n\t\t\t\t\tif (!record) {\n\t\t\t\t\t\tconst childOwner = createScope(owner)\n\t\t\t\t\t\trecord = {\n\t\t\t\t\t\t\t_value: child,\n\t\t\t\t\t\t\t_scope: childOwner,\n\t\t\t\t\t\t\t_start: comment(`[`, parent, end ?? before, childOwner, initial),\n\t\t\t\t\t\t\t_end: null!,\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst held = record\n\t\t\t\t\t\tmount(\n\t\t\t\t\t\t\tchild,\n\t\t\t\t\t\t\tparent,\n\t\t\t\t\t\t\tend ?? before,\n\t\t\t\t\t\t\tchildOwner,\n\t\t\t\t\t\t\tnamespace,\n\t\t\t\t\t\t\tinitial,\n\t\t\t\t\t\t\t() => held._value,\n\t\t\t\t\t\t)\n\t\t\t\t\t\trecord._end = comment(\n\t\t\t\t\t\t\t`]`,\n\t\t\t\t\t\t\tparent,\n\t\t\t\t\t\t\tend ?? before,\n\t\t\t\t\t\t\tchildOwner,\n\t\t\t\t\t\t\tinitial,\n\t\t\t\t\t\t)\n\t\t\t\t\t} else {\n\t\t\t\t\t\trecord._value = child\n\t\t\t\t\t\towner._root._presence?.resume(record._scope)\n\t\t\t\t\t\tinvalidate(record._scope)\n\t\t\t\t\t}\n\t\t\t\t\tkept.set(key, record)\n\t\t\t\t}\n\t\t\t\tfor (const [key, record] of records)\n\t\t\t\t\tif (!kept.has(key))\n\t\t\t\t\t\tretire(record, key, true, [...records.keys()].indexOf(key))\n\t\t\t\tif (!initial) {\n\t\t\t\t\tlet at = end ?? before\n\t\t\t\t\tconst rendered = presence?.merge([...kept.values()]) ?? [\n\t\t\t\t\t\t...kept.values(),\n\t\t\t\t\t]\n\t\t\t\t\tfor (const record of rendered.reverse()) {\n\t\t\t\t\t\tif (record._end.nextSibling !== at) {\n\t\t\t\t\t\t\tconst range = parent.ownerDocument!.createRange()\n\t\t\t\t\t\t\trange.setStartBefore(record._start)\n\t\t\t\t\t\t\trange.setEndAfter(record._end)\n\t\t\t\t\t\t\tparent.insertBefore(range.extractContents(), at)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tat = record._start\n\t\t\t\t\t}\n\t\t\t\t\tif (\n\t\t\t\t\t\tfocus?.isConnected &&\n\t\t\t\t\t\t!focus.closest(`[inert]`) &&\n\t\t\t\t\t\tfocus !== parent.ownerDocument!.activeElement\n\t\t\t\t\t)\n\t\t\t\t\t\tfocus.focus({ preventScroll: true })\n\t\t\t\t}\n\t\t\t\tinitial = undefined\n\t\t\t\trecords = kept\n\t\t\t},\n\t\t)\n\t\tend = comment(`}`, parent, before, owner, cursor)\n\t\treturn\n\t}\n\tif (Array.isArray(value)) {\n\t\tfor (const child of value)\n\t\t\tmount(child, parent, before, owner, namespace, cursor)\n\t\treturn\n\t}\n\tif (value == null || typeof value === `boolean`) return\n\tif (typeof value !== `object`) {\n\t\tcomment(`t`, parent, before, owner, cursor)\n\t\tconst text = take(\n\t\t\tparent.ownerDocument!.createTextNode(String(value)),\n\t\t\tparent,\n\t\t\tbefore,\n\t\t\towner,\n\t\t\tcursor,\n\t\t)\n\t\tobserve(owner, source as Accessor<string | number | bigint>, (next) => {\n\t\t\tconst data = String(next)\n\t\t\tif (text.nodeValue !== data) text.nodeValue = data\n\t\t})\n\t\treturn\n\t}\n\tif (import.meta.env.DEV && (!(`type` in value) || !(`props` in value)))\n\t\tthrow new Error(`spa: invalid child`)\n\tconst vnode = value as SpaElement\n\tconst props = merge(() => (source() as SpaElement).props)\n\tif (!vnode.type || vnode.type === Fragment) {\n\t\tmount(() => props[`children`], parent, before, owner, namespace, cursor)\n\t\treturn\n\t}\n\tif (typeof vnode.type === `function`) {\n\t\tconst childOwner = createScope(owner)\n\t\tconst output = within(childOwner, () =>\n\t\t\tuntrack(() => (vnode.type as Function)(props)),\n\t\t)\n\t\tmount(output, parent, before, childOwner, namespace, cursor)\n\t\treturn\n\t}\n\tconst ns = vnode.type === `svg` ? SVG : namespace\n\tconst element = take(\n\t\tparent.ownerDocument!.createElementNS(ns, vnode.type),\n\t\tparent,\n\t\tbefore,\n\t\towner,\n\t\tcursor,\n\t) as Element\n\tif (vnode.type === `astro-slot`) {\n\t\tif (!cursor) element.innerHTML = props[`innerHTML`] ?? ``\n\t} else if (ns === HTML && /^(textarea|title|style|script)$/.test(vnode.type)) {\n\t\tobserve(\n\t\t\towner,\n\t\t\t() =>\n\t\t\t\tplain(\n\t\t\t\t\tvnode.type === `textarea`\n\t\t\t\t\t\t? (props[`value`] ?? props[`children`])\n\t\t\t\t\t\t: props[`children`],\n\t\t\t\t),\n\t\t\t(text) => {\n\t\t\t\tif (element.textContent !== text) element.textContent = text\n\t\t\t},\n\t\t)\n\t} else {\n\t\tconst children = cursor\n\t\t\t? { node: element.firstChild, report: cursor.report }\n\t\t\t: undefined\n\t\tif (\n\t\t\t!/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/.test(\n\t\t\t\tvnode.type,\n\t\t\t) ||\n\t\t\tns !== HTML\n\t\t)\n\t\t\tmount(\n\t\t\t\t() => props[`children`],\n\t\t\t\telement,\n\t\t\t\tnull,\n\t\t\t\towner,\n\t\t\t\tvnode.type === `foreignObject` ? HTML : ns,\n\t\t\t\tchildren,\n\t\t\t)\n\t\tfinish(children)\n\t}\n\tconst nativeProps = capabilityProps(\n\t\towner,\n\t\t{ kind: `dom`, node: element },\n\t\t() => ({ ...props }),\n\t)\n\tlet previous: Record<string, any> = {}\n\towner._cleanups.add(() => {\n\t\tfor (const key in previous)\n\t\t\tif (key.startsWith(`on`)) property(element, key, null, previous[key])\n\t})\n\tobserve(\n\t\towner,\n\t\t() => ({ ...props }),\n\t\t(all) => {\n\t\t\tconst next = nativeProps(all)\n\t\t\tfor (const key in { ...previous, ...next })\n\t\t\t\tif (\n\t\t\t\t\t!Object.is(previous[key], next[key]) ||\n\t\t\t\t\ttypeof next[key] === `object`\n\t\t\t\t) {\n\t\t\t\t\tproperty(element, key, next[key], previous[key])\n\t\t\t\t\tprevious[key] = next[key]\n\t\t\t\t}\n\t\t\tprevious = next\n\t\t},\n\t)\n\tconst ref = untrack(() => props[`ref`])\n\tif (ref) {\n\t\towner._root._mounts!.unshift(() => {\n\t\t\tif (!owner._dead) {\n\t\t\t\towner._cleanups.add(() => ref(null))\n\t\t\t\tref(element)\n\t\t\t}\n\t\t})\n\t}\n}\n\nexport interface SpaRoot {\n\tdispose(): void\n\tflush(): void\n}\nfunction start(\n\tsetup: () => Children,\n\thost: Element,\n\toptions: RootOptions,\n\thydrating: boolean,\n): SpaRoot {\n\tlet reported = false\n\tconst cursor: Cursor | undefined = hydrating\n\t\t? {\n\t\t\t\tnode: host.firstChild,\n\t\t\t\treport(expected, found) {\n\t\t\t\t\tif (!reported) {\n\t\t\t\t\t\treported = true\n\t\t\t\t\t\t// eslint-disable-next-line no-console -- Recoverable degradation must remain human-readable in production.\n\t\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t\t`spa: hydration mismatch. Repairing server HTML to match the browser view; replaced nodes may lose focus or unsaved input.`,\n\t\t\t\t\t\t\t{ host, expected, found },\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t}\n\t\t: undefined\n\tconst marker = cursor?.node\n\tconst prefix =\n\t\tmarker?.nodeType === 8 && marker.nodeValue?.startsWith(`w:`)\n\t\t\t? marker.nodeValue.slice(2)\n\t\t\t: undefined\n\tconst root = createRoot(options)\n\tif (prefix !== undefined && options.idPrefix === undefined)\n\t\troot._prefix = prefix\n\ttry {\n\t\tcomment(`w:${root._prefix}`, host, null, root, cursor)\n\t\twithin(root, () => {\n\t\t\tmount(\n\t\t\t\tuntrack(setup),\n\t\t\t\thost,\n\t\t\t\tnull,\n\t\t\t\troot,\n\t\t\t\thost.namespaceURI === SVG ? SVG : HTML,\n\t\t\t\tcursor,\n\t\t\t)\n\t\t})\n\t\tcomment(`/w`, host, null, root, cursor)\n\t\tfinish(cursor)\n\t\troot.flush()\n\t} catch (error) {\n\t\tfail(root, error)\n\t}\n\treturn {\n\t\tdispose: () => {\n\t\t\tdispose(root)\n\t\t},\n\t\tflush: root.flush,\n\t}\n}\nexport function render(\n\tsetup: () => Children,\n\thost: Element,\n\toptions: RootOptions = {},\n): SpaRoot {\n\treturn start(setup, host, options, false)\n}\nexport function hydrate(\n\tsetup: () => Children,\n\thost: Element,\n\toptions: RootOptions = {},\n): SpaRoot {\n\treturn start(setup, host, options, true)\n}\n"],"mappings":";;;;AAqBA,MAAM,OAAO;AACb,MAAM,MAAM;AAOZ,SAAS,OAAO,QAAuB;CACtC,IAAI,QAAQ,MAAM;EACjB,OAAO,OAAO,MAAM,OAAO,IAAI;EAC/B,OAAO,OAAO,MAAM;GACnB,MAAM,OAAa,OAAO;GAC1B,OAAO,OAAO,KAAK;GAClB,KAAoB,OAAO;EAC7B;CACD;AACD;AAEA,SAAS,KACR,MACA,QACA,QACA,OACA,QACO;CACP,IACC,UACA,EAAE,KAAK,aAAa,KAAK,CAAC,KAAK,aAAa,OAAO,MAAM,aAAa,IACrE;EACD,MAAM,QAAQ,OAAO;EACrB,IACC,CAAC,SACD,MAAM,aAAa,KAAK,YACxB,MAAM,aAAa,KAAK,YACvB,MAAkB,iBAAkB,KAAiB,gBACrD,KAAK,aAAa,KAAK,MAAM,cAAc,KAAK,WAChD;GACD,OAAO,OAAO,MAAM,KAAK;GACzB,OAAO,aAAa,MAAM,KAAK;GAC/B,OAAO,OAAO,OAAO,eAAe;GACnC,OAA6B,OAAO;EACtC,OAAO;GACN,OAAO;GACP,OAAO,OAAO,MAAM;EACrB;CACD,OAAO,OAAO,aAAa,MAAM,SAAS,OAAO,OAAO,MAAM;CAC9D,MAAM,UAAU,UAAU;EACxB,KAAoB,OAAO;CAC7B,CAAC;CACD,OAAO;AACR;AACA,SAAS,QACR,OACA,QACA,QACA,OACA,QACO;CACP,OAAO,KACN,OAAO,cAAe,cAAc,KAAK,GACzC,QACA,QACA,OACA,MACD;AACD;AACA,SAAS,SACR,SACA,KACA,OACA,UACO;CACP,IAAI,uBAAuB,KAAK,GAAG,GAAG;CACtC,IAAI,QAAQ,eAAe,QAAQ,cAAc,cAAc;CAC/D,IACC,w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ACA,MACA,KAAK,iBAAiB,MAAM,MAAM,MAClC,MACD;EACD,CAAC;EACD,QAAQ,MAAM,MAAM,MAAM,MAAM,MAAM;EACtC,OAAO,MAAM;EACb,KAAK,MAAM;CACZ,SAAS,OAAO;EACf,KAAK,MAAM,KAAK;CACjB;CACA,OAAO;EACN,eAAe;GACd,QAAQ,IAAI;EACb;EACA,OAAO,KAAK;CACb;AACD;AACA,SAAgB,OACf,OACA,MACA,UAAuB,CAAC,GACd;CACV,OAAO,MAAM,OAAO,MAAM,SAAS,KAAK;AACzC;AACA,SAAgB,QACf,OACA,MACA,UAAuB,CAAC,GACd;CACV,OAAO,MAAM,OAAO,MAAM,SAAS,IAAI;AACxC"}
1
+ {"version":3,"file":"dom-DQ0M3rLL.js","names":[],"sources":["../../src/dom.ts"],"sourcesContent":["import { capabilityProps } from \"./capabilities.ts\"\nimport type {\n\tAccessor,\n\tChildren,\n\tRootOptions,\n\tScope,\n\tSpaElement,\n} from \"./core.ts\"\nimport {\n\tcreateRoot,\n\tcreateScope,\n\tdispose,\n\tfail,\n\tinvalidate,\n\tobserve,\n\tplain,\n\tuntrack,\n\twithin,\n} from \"./core.ts\"\nimport { Fragment, merge } from \"./jsx-runtime.ts\"\n\nconst HTML = `http://www.w3.org/1999/xhtml`\nconst SVG = `http://www.w3.org/2000/svg`\ntype Cursor = {\n\tnode: Node | null\n\treport(expected: Node | null, found: Node | null): void\n}\ntype RecordNode = { _value: Children; _scope: Scope; _start: Node; _end: Node }\n\nfunction finish(cursor?: Cursor): void {\n\tif (cursor?.node) {\n\t\tcursor.report(null, cursor.node)\n\t\twhile (cursor.node) {\n\t\t\tconst node: Node = cursor.node\n\t\t\tcursor.node = node.nextSibling\n\t\t\t;(node as ChildNode).remove()\n\t\t}\n\t}\n}\n\nfunction take(\n\tnode: Node,\n\tparent: Node,\n\tbefore: Node | null,\n\towner: Scope,\n\tcursor?: Cursor,\n): Node {\n\tif (\n\t\tcursor &&\n\t\t!(node.nodeType === 3 && !node.nodeValue && cursor.node?.nodeType !== 3)\n\t) {\n\t\tconst found = cursor.node\n\t\tif (\n\t\t\t!found ||\n\t\t\tfound.nodeType !== node.nodeType ||\n\t\t\tfound.nodeName !== node.nodeName ||\n\t\t\t(found as Element).namespaceURI !== (node as Element).namespaceURI ||\n\t\t\t(node.nodeType !== 1 && found.nodeValue !== node.nodeValue)\n\t\t) {\n\t\t\tcursor.report(node, found)\n\t\t\tparent.insertBefore(node, found)\n\t\t\tcursor.node = found?.nextSibling ?? null\n\t\t\t;(found as ChildNode | null)?.remove()\n\t\t} else {\n\t\t\tnode = found\n\t\t\tcursor.node = found.nextSibling\n\t\t}\n\t} else parent.insertBefore(node, cursor ? cursor.node : before)\n\towner._cleanups.add(() => {\n\t\t;(node as ChildNode).remove()\n\t})\n\treturn node\n}\nfunction comment(\n\tvalue: string,\n\tparent: Node,\n\tbefore: Node | null,\n\towner: Scope,\n\tcursor?: Cursor,\n): Node {\n\treturn take(\n\t\tparent.ownerDocument!.createComment(value),\n\t\tparent,\n\t\tbefore,\n\t\towner,\n\t\tcursor,\n\t)\n}\nfunction property(\n\telement: Element,\n\tkey: string,\n\tvalue: any,\n\tprevious: any,\n): void {\n\tif (/^(key|children|ref)$/.test(key)) return\n\tif (key === `innerHTML` && element.localName === `astro-slot`) return\n\tif (\n\t\t/^(innerHTML|outerHTML|textContent|innerText|dangerouslySetInnerHTML)$/.test(\n\t\t\tkey,\n\t\t)\n\t)\n\t\tthrow new Error(import.meta.env.DEV ? `spa: owned content` : undefined)\n\tif (key.startsWith(`on`)) {\n\t\tconst capture = /(?<!Pointer)Capture$/.test(key)\n\t\tconst event = key\n\t\t\t.slice(2, capture ? -7 : undefined)\n\t\t\t.toLowerCase()\n\t\t\t.replace(`doubleclick`, `dblclick`)\n\t\tif (previous) element.removeEventListener(event, previous, capture)\n\t\tif (value != null) {\n\t\t\tif (import.meta.env.DEV && typeof value !== `function`)\n\t\t\t\tthrow new Error(`spa: event handler`)\n\t\t\telement.addEventListener(event, value, capture)\n\t\t}\n\t\treturn\n\t}\n\tif (key === `className`) key = `class`\n\tif (key === `htmlFor`) key = `for`\n\tif (\n\t\timport.meta.env.DEV &&\n\t\tkey === `style` &&\n\t\tvalue != null &&\n\t\ttypeof value !== `string`\n\t)\n\t\tthrow new Error(`spa: CSS string required`)\n\tif (\n\t\telement.namespaceURI === HTML &&\n\t\tkey in element &&\n\t\t!/^(style|form|list)$/.test(key)\n\t) {\n\t\tconst target = element as any\n\t\ttarget[key] = value ?? (typeof target[key] === `boolean` ? false : ``)\n\t} else if (value == null || (value === false && !/^(aria-|data-)/.test(key)))\n\t\telement.removeAttribute(key)\n\telse\n\t\telement.setAttribute(\n\t\t\tkey,\n\t\t\tvalue === true && !/^(aria-|data-)/.test(key) ? `` : String(value),\n\t\t)\n}\n\nfunction mount(\n\tvalue: Children,\n\tparent: Node,\n\tbefore: Node | null,\n\towner: Scope,\n\tnamespace: string,\n\tcursor?: Cursor,\n\tsource = () => value,\n): void {\n\tif (typeof value === `function`) {\n\t\tcomment(`{`, parent, before, owner, cursor)\n\t\tlet end: Node | null = null\n\t\tlet records = new Map<unknown, RecordNode>()\n\t\tconst presence = owner._root._presence?.collection<RecordNode, Children>(\n\t\t\t(record) => record._scope,\n\t\t\t(record, child) =>\n\t\t\t\ttypeof record._value === typeof child &&\n\t\t\t\t(record._value as SpaElement | null)?.type ===\n\t\t\t\t\t(child as SpaElement | null)?.type,\n\t\t)\n\t\tconst retire = (\n\t\t\trecord: RecordNode,\n\t\t\tkey: unknown,\n\t\t\teligible: boolean,\n\t\t\tindex: number,\n\t\t) => {\n\t\t\tif (presence) presence.remove(record, key, eligible, index, () => {})\n\t\t\telse dispose(record._scope)\n\t\t}\n\t\tlet initial = cursor\n\t\tobserve(\n\t\t\towner,\n\t\t\t() => (source() as () => Children)(),\n\t\t\t(next) => {\n\t\t\t\tconst values = ([next] as unknown[]).flat(Infinity) as Children[]\n\t\t\t\tconst kept = new Map<unknown, RecordNode>()\n\t\t\t\tconst focus = parent.ownerDocument!.activeElement as HTMLElement | null\n\t\t\t\tfor (let index = 0; index < values.length; index++) {\n\t\t\t\t\tconst child = values[index]\n\t\t\t\t\tconst vnode = child as SpaElement | null\n\t\t\t\t\tconst explicit = vnode?.props?.[`key`]\n\t\t\t\t\tconst key = explicit == null ? index : String(explicit)\n\t\t\t\t\tif (import.meta.env.DEV && kept.has(key))\n\t\t\t\t\t\tthrow new Error(`spa: duplicate key`)\n\t\t\t\t\tlet record = records.get(key)\n\t\t\t\t\tif (\n\t\t\t\t\t\trecord &&\n\t\t\t\t\t\t(typeof record._value !== typeof child ||\n\t\t\t\t\t\t\t(record._value as SpaElement | null)?.type !== vnode?.type)\n\t\t\t\t\t) {\n\t\t\t\t\t\tretire(\n\t\t\t\t\t\t\trecord,\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tchild == null || typeof child === `boolean`,\n\t\t\t\t\t\t\t[...records.keys()].indexOf(key),\n\t\t\t\t\t\t)\n\t\t\t\t\t\trecord = undefined\n\t\t\t\t\t}\n\t\t\t\t\trecord ??= presence?.take(key, child)\n\t\t\t\t\tif (!record) {\n\t\t\t\t\t\tconst childOwner = createScope(owner)\n\t\t\t\t\t\trecord = {\n\t\t\t\t\t\t\t_value: child,\n\t\t\t\t\t\t\t_scope: childOwner,\n\t\t\t\t\t\t\t_start: comment(`[`, parent, end ?? before, childOwner, initial),\n\t\t\t\t\t\t\t_end: null!,\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst held = record\n\t\t\t\t\t\tmount(\n\t\t\t\t\t\t\tchild,\n\t\t\t\t\t\t\tparent,\n\t\t\t\t\t\t\tend ?? before,\n\t\t\t\t\t\t\tchildOwner,\n\t\t\t\t\t\t\tnamespace,\n\t\t\t\t\t\t\tinitial,\n\t\t\t\t\t\t\t() => held._value,\n\t\t\t\t\t\t)\n\t\t\t\t\t\trecord._end = comment(\n\t\t\t\t\t\t\t`]`,\n\t\t\t\t\t\t\tparent,\n\t\t\t\t\t\t\tend ?? before,\n\t\t\t\t\t\t\tchildOwner,\n\t\t\t\t\t\t\tinitial,\n\t\t\t\t\t\t)\n\t\t\t\t\t} else {\n\t\t\t\t\t\trecord._value = child\n\t\t\t\t\t\towner._root._presence?.resume(record._scope)\n\t\t\t\t\t\tinvalidate(record._scope)\n\t\t\t\t\t}\n\t\t\t\t\tkept.set(key, record)\n\t\t\t\t}\n\t\t\t\tfor (const [key, record] of records)\n\t\t\t\t\tif (!kept.has(key))\n\t\t\t\t\t\tretire(record, key, true, [...records.keys()].indexOf(key))\n\t\t\t\tif (!initial) {\n\t\t\t\t\tlet at = end ?? before\n\t\t\t\t\tconst rendered = presence?.merge([...kept.values()]) ?? [\n\t\t\t\t\t\t...kept.values(),\n\t\t\t\t\t]\n\t\t\t\t\tfor (const record of rendered.reverse()) {\n\t\t\t\t\t\tif (record._end.nextSibling !== at) {\n\t\t\t\t\t\t\tconst range = parent.ownerDocument!.createRange()\n\t\t\t\t\t\t\trange.setStartBefore(record._start)\n\t\t\t\t\t\t\trange.setEndAfter(record._end)\n\t\t\t\t\t\t\tparent.insertBefore(range.extractContents(), at)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tat = record._start\n\t\t\t\t\t}\n\t\t\t\t\tif (\n\t\t\t\t\t\tfocus?.isConnected &&\n\t\t\t\t\t\t!focus.closest(`[inert]`) &&\n\t\t\t\t\t\tfocus !== parent.ownerDocument!.activeElement\n\t\t\t\t\t)\n\t\t\t\t\t\tfocus.focus({ preventScroll: true })\n\t\t\t\t}\n\t\t\t\tinitial = undefined\n\t\t\t\trecords = kept\n\t\t\t},\n\t\t)\n\t\tend = comment(`}`, parent, before, owner, cursor)\n\t\treturn\n\t}\n\tif (Array.isArray(value)) {\n\t\tfor (const child of value)\n\t\t\tmount(child, parent, before, owner, namespace, cursor)\n\t\treturn\n\t}\n\tif (value == null || typeof value === `boolean`) return\n\tif (typeof value !== `object`) {\n\t\tcomment(`t`, parent, before, owner, cursor)\n\t\tconst text = take(\n\t\t\tparent.ownerDocument!.createTextNode(String(value)),\n\t\t\tparent,\n\t\t\tbefore,\n\t\t\towner,\n\t\t\tcursor,\n\t\t)\n\t\tobserve(owner, source as Accessor<string | number | bigint>, (next) => {\n\t\t\tconst data = String(next)\n\t\t\tif (text.nodeValue !== data) text.nodeValue = data\n\t\t})\n\t\treturn\n\t}\n\tif (import.meta.env.DEV && (!(`type` in value) || !(`props` in value)))\n\t\tthrow new Error(`spa: invalid child`)\n\tconst vnode = value as SpaElement\n\tconst props = merge(() => (source() as SpaElement).props)\n\tif (!vnode.type || vnode.type === Fragment) {\n\t\tmount(() => props[`children`], parent, before, owner, namespace, cursor)\n\t\treturn\n\t}\n\tif (typeof vnode.type === `function`) {\n\t\tconst childOwner = createScope(owner)\n\t\tconst output = within(childOwner, () =>\n\t\t\tuntrack(() => (vnode.type as Function)(props)),\n\t\t)\n\t\tmount(output, parent, before, childOwner, namespace, cursor)\n\t\treturn\n\t}\n\tconst ns = vnode.type === `svg` ? SVG : namespace\n\tconst element = take(\n\t\tparent.ownerDocument!.createElementNS(ns, vnode.type),\n\t\tparent,\n\t\tbefore,\n\t\towner,\n\t\tcursor,\n\t) as Element\n\tif (vnode.type === `astro-slot`) {\n\t\tif (!cursor) element.innerHTML = props[`innerHTML`] ?? ``\n\t} else if (ns === HTML && /^(textarea|title|style|script)$/.test(vnode.type)) {\n\t\tobserve(\n\t\t\towner,\n\t\t\t() =>\n\t\t\t\tplain(\n\t\t\t\t\tvnode.type === `textarea`\n\t\t\t\t\t\t? (props[`value`] ?? props[`children`])\n\t\t\t\t\t\t: props[`children`],\n\t\t\t\t),\n\t\t\t(text) => {\n\t\t\t\tif (element.textContent !== text) element.textContent = text\n\t\t\t},\n\t\t)\n\t} else {\n\t\tconst children = cursor\n\t\t\t? { node: element.firstChild, report: cursor.report }\n\t\t\t: undefined\n\t\tif (\n\t\t\t!/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/.test(\n\t\t\t\tvnode.type,\n\t\t\t) ||\n\t\t\tns !== HTML\n\t\t)\n\t\t\tmount(\n\t\t\t\t() => props[`children`],\n\t\t\t\telement,\n\t\t\t\tnull,\n\t\t\t\towner,\n\t\t\t\tvnode.type === `foreignObject` ? HTML : ns,\n\t\t\t\tchildren,\n\t\t\t)\n\t\tfinish(children)\n\t}\n\tlet previous: Record<string, any> = {}\n\tconst nativeProps = capabilityProps(\n\t\towner,\n\t\t{ kind: `dom`, node: element },\n\t\t() => ({ ...props }),\n\t\t(next) => {\n\t\t\tconst previousStyle =\n\t\t\t\tprevious[`style`] !== next[`style`]\n\t\t\t\t\t? (element.getAttribute(`style`) ?? ``)\n\t\t\t\t\t: undefined\n\t\t\tfor (const key in { ...previous, ...next })\n\t\t\t\tif (\n\t\t\t\t\t!Object.is(previous[key], next[key]) ||\n\t\t\t\t\ttypeof next[key] === `object`\n\t\t\t\t) {\n\t\t\t\t\tproperty(element, key, next[key], previous[key])\n\t\t\t\t\tprevious[key] = next[key]\n\t\t\t\t}\n\t\t\tprevious = next\n\t\t\treturn previousStyle\n\t\t},\n\t)\n\towner._cleanups.add(() => {\n\t\tfor (const key in previous)\n\t\t\tif (key.startsWith(`on`)) property(element, key, null, previous[key])\n\t})\n\tobserve(owner, () => ({ ...props }), nativeProps)\n\tconst ref = untrack(() => props[`ref`])\n\tif (ref) {\n\t\towner._root._mounts!.unshift(() => {\n\t\t\tif (!owner._dead) {\n\t\t\t\towner._cleanups.add(() => ref(null))\n\t\t\t\tref(element)\n\t\t\t}\n\t\t})\n\t}\n}\n\nexport interface SpaRoot {\n\tdispose(): void\n\tflush(): void\n}\nfunction start(\n\tsetup: () => Children,\n\thost: Element,\n\toptions: RootOptions,\n\thydrating: boolean,\n): SpaRoot {\n\tlet reported = false\n\tconst cursor: Cursor | undefined = hydrating\n\t\t? {\n\t\t\t\tnode: host.firstChild,\n\t\t\t\treport(expected, found) {\n\t\t\t\t\tif (!reported) {\n\t\t\t\t\t\treported = true\n\t\t\t\t\t\t// eslint-disable-next-line no-console -- Recoverable degradation must remain human-readable in production.\n\t\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t\t`spa: hydration mismatch. Repairing server HTML to match the browser view; replaced nodes may lose focus or unsaved input.`,\n\t\t\t\t\t\t\t{ host, expected, found },\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t}\n\t\t: undefined\n\tconst marker = cursor?.node\n\tconst prefix =\n\t\tmarker?.nodeType === 8 && marker.nodeValue?.startsWith(`w:`)\n\t\t\t? marker.nodeValue.slice(2)\n\t\t\t: undefined\n\tconst root = createRoot(options)\n\tif (prefix !== undefined && options.idPrefix === undefined)\n\t\troot._prefix = prefix\n\ttry {\n\t\tcomment(`w:${root._prefix}`, host, null, root, cursor)\n\t\twithin(root, () => {\n\t\t\tmount(\n\t\t\t\tuntrack(setup),\n\t\t\t\thost,\n\t\t\t\tnull,\n\t\t\t\troot,\n\t\t\t\thost.namespaceURI === SVG ? SVG : HTML,\n\t\t\t\tcursor,\n\t\t\t)\n\t\t})\n\t\tcomment(`/w`, host, null, root, cursor)\n\t\tfinish(cursor)\n\t\troot.flush()\n\t} catch (error) {\n\t\tfail(root, error)\n\t}\n\treturn {\n\t\tdispose: () => {\n\t\t\tdispose(root)\n\t\t},\n\t\tflush: root.flush,\n\t}\n}\nexport function render(\n\tsetup: () => Children,\n\thost: Element,\n\toptions: RootOptions = {},\n): SpaRoot {\n\treturn start(setup, host, options, false)\n}\nexport function hydrate(\n\tsetup: () => Children,\n\thost: Element,\n\toptions: RootOptions = {},\n): SpaRoot {\n\treturn start(setup, host, options, true)\n}\n"],"mappings":";;;;AAqBA,MAAM,OAAO;AACb,MAAM,MAAM;AAOZ,SAAS,OAAO,QAAuB;CACtC,IAAI,QAAQ,MAAM;EACjB,OAAO,OAAO,MAAM,OAAO,IAAI;EAC/B,OAAO,OAAO,MAAM;GACnB,MAAM,OAAa,OAAO;GAC1B,OAAO,OAAO,KAAK;GAClB,KAAoB,OAAO;EA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;AACzC;AACA,SAAgB,QACf,OACA,MACA,UAAuB,CAAC,GACd;CACV,OAAO,MAAM,OAAO,MAAM,SAAS,IAAI;AACxC"}
@@ -0,0 +1,148 @@
1
+ import { S as within, i as fail, l as onMount } from "./core-BHA7I1nf.js";
2
+ import { autoUpdate, computePosition } from "@floating-ui/dom";
3
+ // src/floating.ts
4
+ const allowed = /* @__PURE__ */ new Set([
5
+ `reference`,
6
+ `placement`,
7
+ `strategy`,
8
+ `middleware`,
9
+ `enabled`,
10
+ `autoUpdate`
11
+ ]);
12
+ const observerKeys = [
13
+ `ancestorScroll`,
14
+ `ancestorResize`,
15
+ `elementResize`,
16
+ `layoutShift`,
17
+ `animationFrame`
18
+ ];
19
+ const ownedStyles = [
20
+ `position`,
21
+ `left`,
22
+ `top`,
23
+ `translate`,
24
+ `visibility`
25
+ ];
26
+ function attach(target, scope) {
27
+ const element = target.node;
28
+ if (target.kind !== `dom` || element?.namespaceURI !== `http://www.w3.org/1999/xhtml`) throw new Error(`spa/floating: floating elements must be HTML elements`);
29
+ let props = {};
30
+ let dead = false;
31
+ let mounted = false;
32
+ let generation = 0;
33
+ let request = 0;
34
+ let stop;
35
+ let reference;
36
+ let observing;
37
+ let original;
38
+ let positioned = false;
39
+ let translation = ``;
40
+ const restore = () => {
41
+ if (!original) return;
42
+ for (const [key, style] of original) if (style.value) element.style.setProperty(key, style.value, style.priority);
43
+ else element.style.removeProperty(key);
44
+ original = void 0;
45
+ positioned = false;
46
+ translation = ``;
47
+ };
48
+ const disconnect = () => {
49
+ ++generation;
50
+ stop?.();
51
+ stop = void 0;
52
+ reference = void 0;
53
+ };
54
+ const report = (error) => {
55
+ if (!scope) {
56
+ queueMicrotask(() => {
57
+ throw error;
58
+ });
59
+ return;
60
+ }
61
+ try {
62
+ fail(scope._root, error);
63
+ } catch (failure) {
64
+ scope._root.error(failure);
65
+ }
66
+ };
67
+ const updatePosition = () => {
68
+ const anchor = reference;
69
+ if (dead || !anchor) return;
70
+ const currentGeneration = generation;
71
+ const currentRequest = ++request;
72
+ computePosition(anchor, element, {
73
+ placement: props.placement ?? `bottom`,
74
+ strategy: props.strategy ?? `absolute`,
75
+ middleware: props.middleware ? [...props.middleware] : []
76
+ }).then(({ x, y }) => {
77
+ if (dead || generation !== currentGeneration || currentRequest !== request) return;
78
+ translation = `${x}px ${y}px`;
79
+ element.style.setProperty(`translate`, translation);
80
+ if (!positioned) {
81
+ positioned = true;
82
+ const visibility = original.get(`visibility`);
83
+ if (visibility.value) element.style.setProperty(`visibility`, visibility.value, visibility.priority);
84
+ else element.style.removeProperty(`visibility`);
85
+ }
86
+ }, (error) => {
87
+ if (!dead && generation === currentGeneration && currentRequest === request) report(error);
88
+ });
89
+ };
90
+ const connect = () => {
91
+ if (dead || !mounted) return;
92
+ const nextReference = props.enabled === false ? void 0 : props.reference ?? void 0;
93
+ const nextObserving = props.autoUpdate ?? true;
94
+ const optionsChanged = typeof nextObserving !== typeof observing || (typeof nextObserving === `object` && typeof observing === `object` ? observerKeys.some((key) => nextObserving[key] !== observing[key]) : nextObserving !== observing);
95
+ const reconnect = nextReference !== reference || optionsChanged;
96
+ if (reconnect) disconnect();
97
+ if (!nextReference) {
98
+ restore();
99
+ return;
100
+ }
101
+ original ??= new Map(ownedStyles.map((key) => [key, {
102
+ value: element.style.getPropertyValue(key),
103
+ priority: element.style.getPropertyPriority(key)
104
+ }]));
105
+ element.style.setProperty(`position`, props.strategy ?? `absolute`);
106
+ element.style.setProperty(`left`, `0px`);
107
+ element.style.setProperty(`top`, `0px`);
108
+ if (positioned) element.style.setProperty(`translate`, translation);
109
+ else element.style.setProperty(`visibility`, `hidden`, `important`);
110
+ reference = nextReference;
111
+ observing = typeof nextObserving === `object` ? { ...nextObserving } : nextObserving;
112
+ if (reconnect && nextObserving !== false) stop = autoUpdate(nextReference, element, updatePosition, typeof nextObserving === `object` ? nextObserving : void 0);
113
+ else updatePosition();
114
+ };
115
+ const mount = () => {
116
+ if (dead) return;
117
+ mounted = true;
118
+ connect();
119
+ };
120
+ if (scope) within(scope, () => {
121
+ onMount(mount);
122
+ });
123
+ else queueMicrotask(mount);
124
+ return {
125
+ update(next) {
126
+ if (dead) return;
127
+ for (const key of Object.keys(next)) if (!allowed.has(key)) throw new Error(`spa/floating: unknown property floating:${key}`);
128
+ props = next;
129
+ connect();
130
+ },
131
+ dispose() {
132
+ if (dead) return;
133
+ dead = true;
134
+ disconnect();
135
+ restore();
136
+ }
137
+ };
138
+ }
139
+ /** Position HTML overlays using CSS translate, leaving transform available to Motion. */
140
+ function floatingCapability() {
141
+ return {
142
+ namespace: `floating`,
143
+ attach
144
+ };
145
+ }
146
+ export { floatingCapability };
147
+
148
+ //# sourceMappingURL=floating.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"floating.js","names":[],"sources":["../../src/floating.ts"],"sourcesContent":["import type {\n\tAutoUpdateOptions,\n\tMiddleware,\n\tPlacement,\n\tReferenceElement,\n\tStrategy,\n} from \"@floating-ui/dom\"\nimport { autoUpdate, computePosition } from \"@floating-ui/dom\"\n\nimport type {\n\tCapability,\n\tCapabilityBinding,\n\tCapabilityTarget,\n} from \"./capabilities.ts\"\nimport type { Scope } from \"./core.ts\"\nimport { fail, onMount, within } from \"./core.ts\"\n\nexport interface FloatingAttributes<Kind extends string = `dom`> {\n\t[`floating:reference`]?: Kind extends `dom` ? ReferenceElement | null : never\n\t[`floating:placement`]?: Kind extends `dom` ? Placement : never\n\t[`floating:strategy`]?: Kind extends `dom` ? Strategy : never\n\t[`floating:middleware`]?: Kind extends `dom` ? readonly Middleware[] : never\n\t[`floating:enabled`]?: Kind extends `dom` ? boolean : never\n\t[`floating:autoUpdate`]?: Kind extends `dom`\n\t\t? boolean | AutoUpdateOptions\n\t\t: never\n}\n\n// eslint-disable-next-line quotes -- TypeScript module augmentation requires a string literal.\ndeclare module \"@atom.io/spa/jsx-runtime\" {\n\t// oxlint-disable-next-line typescript/no-empty-interface -- Declaration merging supplies optional floating attributes.\n\tinterface CapabilityAttributes<\n\t\tKind extends string,\n\t> extends FloatingAttributes<Kind> {}\n}\n\ninterface FloatingProps {\n\treference?: ReferenceElement | null\n\tplacement?: Placement\n\tstrategy?: Strategy\n\tmiddleware?: readonly Middleware[]\n\tenabled?: boolean\n\tautoUpdate?: boolean | AutoUpdateOptions\n}\nconst allowed = new Set([\n\t`reference`,\n\t`placement`,\n\t`strategy`,\n\t`middleware`,\n\t`enabled`,\n\t`autoUpdate`,\n])\nconst observerKeys = [\n\t`ancestorScroll`,\n\t`ancestorResize`,\n\t`elementResize`,\n\t`layoutShift`,\n\t`animationFrame`,\n] as const\nconst ownedStyles = [\n\t`position`,\n\t`left`,\n\t`top`,\n\t`translate`,\n\t`visibility`,\n] as const\n\nfunction attach(target: CapabilityTarget, scope?: Scope): CapabilityBinding {\n\tconst element = target.node as HTMLElement\n\tif (\n\t\ttarget.kind !== `dom` ||\n\t\telement?.namespaceURI !== `http://www.w3.org/1999/xhtml`\n\t)\n\t\tthrow new Error(`spa/floating: floating elements must be HTML elements`)\n\tlet props: FloatingProps = {}\n\tlet dead = false\n\tlet mounted = false\n\tlet generation = 0\n\tlet request = 0\n\tlet stop: (() => void) | undefined\n\tlet reference: ReferenceElement | undefined\n\tlet observing: boolean | AutoUpdateOptions | undefined\n\tlet original: Map<string, { value: string; priority: string }> | undefined\n\tlet positioned = false\n\tlet translation = ``\n\n\tconst restore = () => {\n\t\tif (!original) return\n\t\tfor (const [key, style] of original) {\n\t\t\tif (style.value)\n\t\t\t\telement.style.setProperty(key, style.value, style.priority)\n\t\t\telse element.style.removeProperty(key)\n\t\t}\n\t\toriginal = undefined\n\t\tpositioned = false\n\t\ttranslation = ``\n\t}\n\tconst disconnect = () => {\n\t\t++generation\n\t\tstop?.()\n\t\tstop = undefined\n\t\treference = undefined\n\t}\n\tconst report = (error: unknown) => {\n\t\tif (!scope) {\n\t\t\tqueueMicrotask(() => {\n\t\t\t\tthrow error\n\t\t\t})\n\t\t\treturn\n\t\t}\n\t\ttry {\n\t\t\tfail(scope._root, error)\n\t\t} catch (failure) {\n\t\t\tscope._root.error(failure)\n\t\t}\n\t}\n\tconst updatePosition = () => {\n\t\tconst anchor = reference\n\t\tif (dead || !anchor) return\n\t\tconst currentGeneration = generation\n\t\tconst currentRequest = ++request\n\t\tvoid computePosition(anchor, element, {\n\t\t\tplacement: props.placement ?? `bottom`,\n\t\t\tstrategy: props.strategy ?? `absolute`,\n\t\t\tmiddleware: props.middleware ? [...props.middleware] : [],\n\t\t}).then(\n\t\t\t({ x, y }) => {\n\t\t\t\tif (\n\t\t\t\t\tdead ||\n\t\t\t\t\tgeneration !== currentGeneration ||\n\t\t\t\t\tcurrentRequest !== request\n\t\t\t\t)\n\t\t\t\t\treturn\n\t\t\t\ttranslation = `${x}px ${y}px`\n\t\t\t\telement.style.setProperty(`translate`, translation)\n\t\t\t\tif (!positioned) {\n\t\t\t\t\tpositioned = true\n\t\t\t\t\tconst visibility = original!.get(`visibility`)!\n\t\t\t\t\tif (visibility.value)\n\t\t\t\t\t\telement.style.setProperty(\n\t\t\t\t\t\t\t`visibility`,\n\t\t\t\t\t\t\tvisibility.value,\n\t\t\t\t\t\t\tvisibility.priority,\n\t\t\t\t\t\t)\n\t\t\t\t\telse element.style.removeProperty(`visibility`)\n\t\t\t\t}\n\t\t\t},\n\t\t\t(error: unknown) => {\n\t\t\t\tif (\n\t\t\t\t\t!dead &&\n\t\t\t\t\tgeneration === currentGeneration &&\n\t\t\t\t\tcurrentRequest === request\n\t\t\t\t)\n\t\t\t\t\treport(error)\n\t\t\t},\n\t\t)\n\t}\n\tconst connect = () => {\n\t\tif (dead || !mounted) return\n\t\tconst nextReference =\n\t\t\tprops.enabled === false ? undefined : (props.reference ?? undefined)\n\t\tconst nextObserving = props.autoUpdate ?? true\n\t\tconst optionsChanged =\n\t\t\ttypeof nextObserving !== typeof observing ||\n\t\t\t(typeof nextObserving === `object` && typeof observing === `object`\n\t\t\t\t? observerKeys.some(\n\t\t\t\t\t\t(key) =>\n\t\t\t\t\t\t\tnextObserving[key] !== (observing as AutoUpdateOptions)[key],\n\t\t\t\t\t)\n\t\t\t\t: nextObserving !== observing)\n\t\tconst reconnect = nextReference !== reference || optionsChanged\n\t\tif (reconnect) disconnect()\n\t\tif (!nextReference) {\n\t\t\trestore()\n\t\t\treturn\n\t\t}\n\t\toriginal ??= new Map(\n\t\t\townedStyles.map((key) => [\n\t\t\t\tkey,\n\t\t\t\t{\n\t\t\t\t\tvalue: element.style.getPropertyValue(key),\n\t\t\t\t\tpriority: element.style.getPropertyPriority(key),\n\t\t\t\t},\n\t\t\t]),\n\t\t)\n\t\telement.style.setProperty(`position`, props.strategy ?? `absolute`)\n\t\telement.style.setProperty(`left`, `0px`)\n\t\telement.style.setProperty(`top`, `0px`)\n\t\tif (positioned) element.style.setProperty(`translate`, translation)\n\t\telse element.style.setProperty(`visibility`, `hidden`, `important`)\n\t\treference = nextReference\n\t\tobserving =\n\t\t\ttypeof nextObserving === `object` ? { ...nextObserving } : nextObserving\n\t\tif (reconnect && nextObserving !== false) {\n\t\t\tstop = autoUpdate(\n\t\t\t\tnextReference,\n\t\t\t\telement,\n\t\t\t\tupdatePosition,\n\t\t\t\ttypeof nextObserving === `object` ? nextObserving : undefined,\n\t\t\t)\n\t\t} else updatePosition()\n\t}\n\tconst mount = () => {\n\t\tif (dead) return\n\t\tmounted = true\n\t\tconnect()\n\t}\n\tif (scope)\n\t\twithin(scope, () => {\n\t\t\tonMount(mount)\n\t\t})\n\telse queueMicrotask(mount)\n\treturn {\n\t\tupdate(next) {\n\t\t\tif (dead) return\n\t\t\tfor (const key of Object.keys(next))\n\t\t\t\tif (!allowed.has(key))\n\t\t\t\t\tthrow new Error(`spa/floating: unknown property floating:${key}`)\n\t\t\tprops = next\n\t\t\tconnect()\n\t\t},\n\t\tdispose() {\n\t\t\tif (dead) return\n\t\t\tdead = true\n\t\t\tdisconnect()\n\t\t\trestore()\n\t\t},\n\t}\n}\n\n/** Position HTML overlays using CSS translate, leaving transform available to Motion. */\nexport function floatingCapability(): Capability {\n\treturn { namespace: `floating`, attach }\n}\n"],"mappings":";;;AA4CA,MAAM,0BAAU,IAAI,IAAI;CACvB;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;AACD,MAAM,eAAe;CACpB;CACA;CACA;CACA;CACA;AACD;AACA,MAAM,cAAc;CACnB;CACA;CACA;CACA;CACA;AACD;AAEA,SAAS,OAAO,QAA0B,OAAkC;CAC3E,MAAM,UAAU,OAAO;CACvB,IACC,OAAO,SAAS,SAChB,SAAS,iBAAiB,gCAE1B,MAAM,IAAI,MAAM,uDAAuD;CACxE,IAAI,QAAuB,CAAC;CAC5B,IAAI,OAAO;CACX,IAAI,UAAU;CACd,IAAI,aAAa;CACjB,IAAI,UAAU;CACd,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI,aAAa;CACjB,IAAI,cAAc;CAElB,MAAM,gBAAgB;EACrB,IAAI,CAAC,UAAU;EACf,KAAK,MAAM,CAAC,KAAK,UAAU,UAC1B,IAAI,MAAM,OACT,QAAQ,MAAM,YAAY,KAAK,MAAM,OAAO,MAAM,QAAQ;OACtD,QAAQ,MAAM,eAAe,GAAG;EAEtC,WAAW,KAAA;EACX,aAAa;EACb,cAAc;CACf;CACA,MAAM,mBAAmB;EACxB,EAAE;EACF,OAAO;EACP,OAAO,KAAA;EACP,YAAY,KAAA;CACb;CACA,MAAM,UAAU,UAAmB;EAClC,IAAI,CAAC,OAAO;GACX,qBAAqB;IACpB,MAAM;GACP,CAAC;GACD;EACD;EACA,IAAI;GACH,KAAK,MAAM,OAAO,KAAK;EACxB,SAAS,SAAS;GACjB,MAAM,MAAM,MAAM,OAAO;EAC1B;CACD;CACA,MAAM,uBAAuB;EAC5B,MAAM,SAAS;EACf,IAAI,QAAQ,CAAC,QAAQ;EACrB,MAAM,oBAAoB;EAC1B,MAAM,iBAAiB,EAAE;EACzB,gBAAqB,QAAQ,SAAS;GACrC,WAAW,MAAM,aAAa;GAC9B,U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AAW;OAC7D,QAAQ,MAAM,YAAY,cAAc,UAAU,WAAW;EAClE,YAAY;EACZ,YACC,OAAO,kBAAkB,WAAW,EAAE,GAAG,cAAc,IAAI;EAC5D,IAAI,aAAa,kBAAkB,OAClC,OAAO,WACN,eACA,SACA,gBACA,OAAO,kBAAkB,WAAW,gBAAgB,KAAA,CACrD;OACM,eAAe;CACvB;CACA,MAAM,cAAc;EACnB,IAAI,MAAM;EACV,UAAU;EACV,QAAQ;CACT;CACA,IAAI,OACH,OAAO,aAAa;EACnB,QAAQ,KAAK;CACd,CAAC;MACG,eAAe,KAAK;CACzB,OAAO;EACN,OAAO,MAAM;GACZ,IAAI,MAAM;GACV,KAAK,MAAM,OAAO,OAAO,KAAK,IAAI,GACjC,IAAI,CAAC,QAAQ,IAAI,GAAG,GACnB,MAAM,IAAI,MAAM,2CAA2C,KAAK;GAClE,QAAQ;GACR,QAAQ;EACT;EACA,UAAU;GACT,IAAI,MAAM;GACV,OAAO;GACP,WAAW;GACX,QAAQ;EACT;CACD;AACD;;AAGA,SAAgB,qBAAiC;CAChD,OAAO;EAAE,WAAW;EAAY;CAAO;AACxC"}
@@ -1,5 +1,5 @@
1
- import { _ as useSetter, b as useTransaction, c as onCleanup, g as useRef, h as useId, l as onMount, m as useGetter, v as useStore, y as useTimeline } from "./core-DxPiKryn.js";
1
+ import { _ as useRef, b as useTimeline, c as onCleanup, g as useId, h as useGetter, l as onMount, m as useDisposal, v as useSetter, x as useTransaction, y as useStore } from "./core-BHA7I1nf.js";
2
2
  import { Fragment } from "./jsx-runtime.js";
3
- import { n as render, t as hydrate } from "./dom-BytVV6Rp.js";
4
- import { t as useLoadable } from "./src-WSHJxR9b.js";
5
- export { Fragment, hydrate, onCleanup, onMount, render, useGetter, useId, useLoadable, useRef, useSetter, useStore, useTimeline, useTransaction };
3
+ import { n as render, t as hydrate } from "./dom-DQ0M3rLL.js";
4
+ import { t as useLoadable } from "./src-DoQgCX-O.js";
5
+ export { Fragment, hydrate, onCleanup, onMount, render, useDisposal, useGetter, useId, useLoadable, useRef, useSetter, useStore, useTimeline, useTransaction };
@@ -14,10 +14,10 @@ function merge(...sources) {
14
14
  return new Proxy({}, {
15
15
  get: (_, key) => values().reverse().find((source) => Object.hasOwn(source, key))?.[key],
16
16
  ownKeys: () => [...new Set(values().flatMap(Object.keys))],
17
- getOwnPropertyDescriptor: () => ({
17
+ getOwnPropertyDescriptor: (_, key) => values().some((source) => Object.hasOwn(source, key)) ? {
18
18
  enumerable: true,
19
19
  configurable: true
20
- })
20
+ } : void 0
21
21
  });
22
22
  }
23
23
  export { Fragment, jsx, jsxDEV, jsxs, merge };
@@ -1 +1 @@
1
- {"version":3,"file":"jsx-runtime.js","names":[],"sources":["../../src/jsx-runtime.ts"],"sourcesContent":["import type { Children, Component, SpaElement } from \"./core.ts\"\nimport type { HTMLAttributes, NativeElements } from \"./jsx-types.d.ts\"\n\nexport type {\n\tAriaAttributes,\n\tDOMAttributes,\n\tEventAttributes,\n\tEventHandler,\n\tHTMLAttributes,\n\tRef,\n\tSVGAttributes,\n\tTargetedEvent,\n} from \"./jsx-types.d.ts\"\n\n/** Optional integrations augment attributes without changing element identity. */\n// oxlint-disable-next-line typescript/no-empty-interface -- Optional integrations augment this declaration.\nexport interface CapabilityAttributes<Kind extends string = string> {}\n\nexport const Fragment = (props: { children?: Children }): Children =>\n\tprops.children\nexport function jsx(\n\ttype: SpaElement[`type`],\n\tprops: SpaElement[`props`] | null,\n\tkey?: unknown,\n): SpaElement {\n\treturn {\n\t\ttype,\n\t\tprops: key === undefined ? (props ?? {}) : merge(props ?? {}, { key }),\n\t}\n}\nexport const jsxs = jsx\nexport const jsxDEV = jsx\n\n/** Preserve lazy props and spread precedence, including keys added by later updates. */\nexport function merge(\n\t...sources: (Record<string, any> | (() => Record<string, any>))[]\n): Record<string, any> {\n\tconst values = () =>\n\t\tsources.map(\n\t\t\t(source) => (typeof source === `function` ? source() : source) ?? {},\n\t\t)\n\treturn new Proxy(\n\t\t{},\n\t\t{\n\t\t\tget: (_, key) =>\n\t\t\t\tvalues()\n\t\t\t\t\t.reverse()\n\t\t\t\t\t.find((source) => Object.hasOwn(source, key))?.[key],\n\t\t\townKeys: () => [...new Set(values().flatMap(Object.keys))],\n\t\t\tgetOwnPropertyDescriptor: () => ({ enumerable: true, configurable: true }),\n\t\t},\n\t)\n}\n\nexport namespace JSX {\n\texport type Element = SpaElement\n\texport type ElementType = keyof IntrinsicElements | Component\n\texport interface ElementChildrenAttribute {\n\t\tchildren: {}\n\t}\n\texport interface IntrinsicAttributes {\n\t\tkey?: string | number\n\t}\n\t/** Augment this interface to declare attributes for registered custom elements. */\n\texport interface IntrinsicElements extends NativeElements {\n\t\t[tag: `${string}-${string}`]: HTMLAttributes<HTMLElement>\n\t}\n}\n"],"mappings":";AAkBA,MAAa,YAAY,UACxB,MAAM;AACP,SAAgB,IACf,MACA,OACA,KACa;CACb,OAAO;EACN;EACA,OAAO,QAAQ,KAAA,IAAa,SAAS,CAAC,IAAK,MAAM,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC;CACtE;AACD;AACA,MAAa,OAAO;AACpB,MAAa,SAAS;;AAGtB,SAAgB,MACf,GAAG,SACmB;CACtB,MAAM,eACL,QAAQ,KACN,YAAY,OAAO,WAAW,aAAa,OAAO,IAAI,WAAW,CAAC,CACpE;CACD,OAAO,IAAI,MACV,CAAC,GACD;EACC,MAAM,GAAG,QACR,OAAO,CAAC,CACN,QAAQ,CAAC,CACT,MAAM,WAAW,OAAO,OAAO,QAAQ,GAAG,CAAC,CAAC,GAAG;EAClD,eAAe,CAAC,GAAG,IAAI,IAAI,OAAO,CAAC,CAAC,QAAQ,OAAO,IAAI,CAAC,CAAC;EACzD,iCAAiC;GAAE,YAAY;GAAM,cAAc;EAAK;CACzE,CACD;AACD"}
1
+ {"version":3,"file":"jsx-runtime.js","names":[],"sources":["../../src/jsx-runtime.ts"],"sourcesContent":["import type { Children, Component, SpaElement } from \"./core.ts\"\nimport type { HTMLAttributes, NativeElements } from \"./jsx-types.d.ts\"\n\nexport type {\n\tAriaAttributes,\n\tDOMAttributes,\n\tEventAttributes,\n\tEventHandler,\n\tHTMLAttributes,\n\tRef,\n\tSVGAttributes,\n\tTargetedEvent,\n} from \"./jsx-types.d.ts\"\n\n/** Optional integrations augment attributes without changing element identity. */\n// oxlint-disable-next-line typescript/no-empty-interface -- Optional integrations augment this declaration.\nexport interface CapabilityAttributes<Kind extends string = string> {}\n\nexport const Fragment = (props: { children?: Children }): Children =>\n\tprops.children\nexport function jsx(\n\ttype: SpaElement[`type`],\n\tprops: SpaElement[`props`] | null,\n\tkey?: unknown,\n): SpaElement {\n\treturn {\n\t\ttype,\n\t\tprops: key === undefined ? (props ?? {}) : merge(props ?? {}, { key }),\n\t}\n}\nexport const jsxs = jsx\nexport const jsxDEV = jsx\n\n/** Preserve lazy props and spread precedence, including keys added by later updates. */\nexport function merge(\n\t...sources: (Record<string, any> | (() => Record<string, any>))[]\n): Record<string, any> {\n\tconst values = () =>\n\t\tsources.map(\n\t\t\t(source) => (typeof source === `function` ? source() : source) ?? {},\n\t\t)\n\treturn new Proxy(\n\t\t{},\n\t\t{\n\t\t\tget: (_, key) =>\n\t\t\t\tvalues()\n\t\t\t\t\t.reverse()\n\t\t\t\t\t.find((source) => Object.hasOwn(source, key))?.[key],\n\t\t\townKeys: () => [...new Set(values().flatMap(Object.keys))],\n\t\t\tgetOwnPropertyDescriptor: (_, key) =>\n\t\t\t\tvalues().some((source) => Object.hasOwn(source, key))\n\t\t\t\t\t? { enumerable: true, configurable: true }\n\t\t\t\t\t: undefined,\n\t\t},\n\t)\n}\n\nexport namespace JSX {\n\texport type Element = SpaElement\n\texport type ElementType = keyof IntrinsicElements | Component\n\texport interface ElementChildrenAttribute {\n\t\tchildren: {}\n\t}\n\texport interface IntrinsicAttributes {\n\t\tkey?: string | number\n\t}\n\t/** Augment this interface to declare attributes for registered custom elements. */\n\texport interface IntrinsicElements extends NativeElements {\n\t\t[tag: `${string}-${string}`]: HTMLAttributes<HTMLElement>\n\t}\n}\n"],"mappings":";AAkBA,MAAa,YAAY,UACxB,MAAM;AACP,SAAgB,IACf,MACA,OACA,KACa;CACb,OAAO;EACN;EACA,OAAO,QAAQ,KAAA,IAAa,SAAS,CAAC,IAAK,MAAM,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC;CACtE;AACD;AACA,MAAa,OAAO;AACpB,MAAa,SAAS;;AAGtB,SAAgB,MACf,GAAG,SACmB;CACtB,MAAM,eACL,QAAQ,KACN,YAAY,OAAO,WAAW,aAAa,OAAO,IAAI,WAAW,CAAC,CACpE;CACD,OAAO,IAAI,MACV,CAAC,GACD;EACC,MAAM,GAAG,QACR,OAAO,CAAC,CACN,QAAQ,CAAC,CACT,MAAM,WAAW,OAAO,OAAO,QAAQ,GAAG,CAAC,CAAC,GAAG;EAClD,eAAe,CAAC,GAAG,IAAI,IAAI,OAAO,CAAC,CAAC,QAAQ,OAAO,IAAI,CAAC,CAAC;EACzD,2BAA2B,GAAG,QAC7B,OAAO,CAAC,CAAC,MAAM,WAAW,OAAO,OAAO,QAAQ,GAAG,CAAC,IACjD;GAAE,YAAY;GAAM,cAAc;EAAK,IACvC,KAAA;CACL,CACD;AACD"}
@@ -1,5 +1,5 @@
1
- import { n as capabilityProps } from "./capabilities-BkQ2i0vV.js";
2
- import { c as onCleanup, l as onMount, u as owner } from "./core-DxPiKryn.js";
1
+ import { n as capabilityProps } from "./capabilities-nOIitQ-_.js";
2
+ import { c as onCleanup, l as onMount, u as owner } from "./core-BHA7I1nf.js";
3
3
  import { jsx } from "./jsx-runtime.js";
4
4
  import { bindScene, createSceneRenderer, sceneComponent } from "./renderer.js";
5
5
  import Konva from "konva";