@atom.io/spa 0.0.7 → 0.0.9

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 (152) hide show
  1. package/README.md +169 -25
  2. package/README.mdx +62 -15
  3. package/dist/astro-application.d.ts +1 -1
  4. package/dist/astro-client.d.ts +1 -1
  5. package/dist/astro-client.d.ts.map +1 -1
  6. package/dist/astro-client.js +5 -4
  7. package/dist/astro-client.js.map +1 -1
  8. package/dist/astro-resumability-client.d.ts +1 -1
  9. package/dist/astro-server.js +4 -4
  10. package/dist/astro-server.js.map +1 -1
  11. package/dist/{astro-shared-83hxw7-M.js → astro-shared-DBwINQav.js} +2 -2
  12. package/dist/{astro-shared-83hxw7-M.js.map → astro-shared-DBwINQav.js.map} +1 -1
  13. package/dist/{astro-shared-DZp1x8RQ.d.ts → astro-shared-KxK9OUSj.d.ts} +2 -2
  14. package/dist/{astro-shared-DZp1x8RQ.d.ts.map → astro-shared-KxK9OUSj.d.ts.map} +1 -1
  15. package/dist/astro.d.ts +1 -1
  16. package/dist/astro.js +1 -1
  17. package/dist/{capabilities-DNcnGRv_.d.ts → capabilities-ChgSs6bp.d.ts} +34 -6
  18. package/dist/capabilities-ChgSs6bp.d.ts.map +1 -0
  19. package/dist/client.min.js +1 -1
  20. package/dist/core-DD2giR6E.js +451 -0
  21. package/dist/core-DD2giR6E.js.map +1 -0
  22. package/dist/development/astro-client.js +5 -4
  23. package/dist/development/astro-client.js.map +1 -1
  24. package/dist/development/astro-server.js +4 -4
  25. package/dist/development/astro-server.js.map +1 -1
  26. package/dist/development/{astro-shared-83hxw7-M.js → astro-shared-DBwINQav.js} +2 -2
  27. package/dist/development/{astro-shared-83hxw7-M.js.map → astro-shared-DBwINQav.js.map} +1 -1
  28. package/dist/development/astro.js +1 -1
  29. package/dist/development/core-DrUd8x25.js +465 -0
  30. package/dist/development/core-DrUd8x25.js.map +1 -0
  31. package/dist/development/{dom-DQ0M3rLL.js → dom-BRFv7FP_.js} +150 -35
  32. package/dist/development/dom-BRFv7FP_.js.map +1 -0
  33. package/dist/development/floating.js +2 -6
  34. package/dist/development/floating.js.map +1 -1
  35. package/dist/development/hot.js +164 -0
  36. package/dist/development/hot.js.map +1 -0
  37. package/dist/development/identity-DwB8MTM1.js +121 -0
  38. package/dist/development/identity-DwB8MTM1.js.map +1 -0
  39. package/dist/development/index.js +5 -5
  40. package/dist/development/jsx-runtime-BGDPK50B.js +49 -0
  41. package/dist/development/jsx-runtime-BGDPK50B.js.map +1 -0
  42. package/dist/development/jsx-runtime.js +1 -25
  43. package/dist/development/konva.js +12 -5
  44. package/dist/development/konva.js.map +1 -1
  45. package/dist/development/motion.js +4 -21
  46. package/dist/development/motion.js.map +1 -1
  47. package/dist/development/renderer.js +41 -40
  48. package/dist/development/renderer.js.map +1 -1
  49. package/dist/development/{server-renderer-DCLoMdOX.js → server-renderer-u1-c5PGd.js} +8 -18
  50. package/dist/development/server-renderer-u1-c5PGd.js.map +1 -0
  51. package/dist/development/server.js +1 -1
  52. package/dist/{src-Bme1kz2b.js → development/src-CB7ruwRs.js} +3 -3
  53. package/dist/development/src-CB7ruwRs.js.map +1 -0
  54. package/dist/development/three.js +20 -19
  55. package/dist/development/three.js.map +1 -1
  56. package/dist/development/vite-WUiz1ju6.js +545 -0
  57. package/dist/development/vite-WUiz1ju6.js.map +1 -0
  58. package/dist/development/vite.js +1 -1
  59. package/dist/{dom-D8g3roX9.js → dom--HZvmgqd.js} +139 -32
  60. package/dist/dom--HZvmgqd.js.map +1 -0
  61. package/dist/floating.d.ts +1 -1
  62. package/dist/floating.d.ts.map +1 -1
  63. package/dist/floating.js +2 -6
  64. package/dist/floating.js.map +1 -1
  65. package/dist/hot.d.ts +15 -0
  66. package/dist/hot.d.ts.map +1 -0
  67. package/dist/hot.js +19 -0
  68. package/dist/hot.js.map +1 -0
  69. package/dist/identity-oFU5p-Qj.js +121 -0
  70. package/dist/identity-oFU5p-Qj.js.map +1 -0
  71. package/dist/{index-BFnXIfOj.d.ts → index-DdA39aMv.d.ts} +4 -4
  72. package/dist/{index-BFnXIfOj.d.ts.map → index-DdA39aMv.d.ts.map} +1 -1
  73. package/dist/index.d.ts +4 -4
  74. package/dist/index.js +5 -5
  75. package/dist/jsx-runtime-BGDPK50B.js +49 -0
  76. package/dist/jsx-runtime-BGDPK50B.js.map +1 -0
  77. package/dist/{jsx-runtime-DQnpyT_g.d.ts → jsx-runtime-CCvcEosg.d.ts} +14 -9
  78. package/dist/jsx-runtime-CCvcEosg.d.ts.map +1 -0
  79. package/dist/jsx-runtime.d.ts +1 -1
  80. package/dist/jsx-runtime.js +1 -25
  81. package/dist/konva.d.ts +46 -9
  82. package/dist/konva.d.ts.map +1 -1
  83. package/dist/konva.js +12 -5
  84. package/dist/konva.js.map +1 -1
  85. package/dist/motion.d.ts +1 -1
  86. package/dist/motion.js +4 -21
  87. package/dist/motion.js.map +1 -1
  88. package/dist/renderer.d.ts +1 -1
  89. package/dist/renderer.d.ts.map +1 -1
  90. package/dist/renderer.js +39 -40
  91. package/dist/renderer.js.map +1 -1
  92. package/dist/{server-renderer-D0rsFL_-.js → server-renderer-BYFDmqnM.js} +8 -18
  93. package/dist/server-renderer-BYFDmqnM.js.map +1 -0
  94. package/dist/server.d.ts +1 -1
  95. package/dist/server.js +1 -1
  96. package/dist/size.json +12 -12
  97. package/dist/{development/src-DoQgCX-O.js → src-B2W_TA_X.js} +3 -3
  98. package/dist/src-B2W_TA_X.js.map +1 -0
  99. package/dist/three.d.ts +3 -3
  100. package/dist/three.d.ts.map +1 -1
  101. package/dist/three.js +20 -19
  102. package/dist/three.js.map +1 -1
  103. package/dist/vite-WUiz1ju6.js +545 -0
  104. package/dist/vite-WUiz1ju6.js.map +1 -0
  105. package/dist/vite.d.ts.map +1 -1
  106. package/dist/vite.js +1 -1
  107. package/package.json +16 -9
  108. package/src/astro-client.ts +3 -2
  109. package/src/astro-server.ts +2 -2
  110. package/src/capabilities.ts +48 -21
  111. package/src/compiler-hmr.ts +297 -0
  112. package/src/compiler.ts +127 -25
  113. package/src/core.ts +282 -33
  114. package/src/dom-forms.ts +127 -0
  115. package/src/dom.ts +116 -52
  116. package/src/floating.ts +2 -6
  117. package/src/hot.ts +190 -0
  118. package/src/identity.ts +39 -0
  119. package/src/index.ts +2 -0
  120. package/src/jsx-runtime.ts +6 -26
  121. package/src/jsx-types.d.ts +8 -3
  122. package/src/konva.ts +66 -10
  123. package/src/motion.ts +3 -1
  124. package/src/presence.ts +11 -23
  125. package/src/props.ts +55 -0
  126. package/src/renderer.ts +91 -71
  127. package/src/server-renderer.ts +18 -13
  128. package/src/three.ts +23 -24
  129. package/src/use-loadable.ts +2 -2
  130. package/src/vite.ts +44 -4
  131. package/dist/capabilities-DNcnGRv_.d.ts.map +0 -1
  132. package/dist/capabilities-nOIitQ-_.js +0 -65
  133. package/dist/capabilities-nOIitQ-_.js.map +0 -1
  134. package/dist/core-B4rJ0xdc.js +0 -268
  135. package/dist/core-B4rJ0xdc.js.map +0 -1
  136. package/dist/development/capabilities-nOIitQ-_.js +0 -65
  137. package/dist/development/capabilities-nOIitQ-_.js.map +0 -1
  138. package/dist/development/core-BHA7I1nf.js +0 -271
  139. package/dist/development/core-BHA7I1nf.js.map +0 -1
  140. package/dist/development/dom-DQ0M3rLL.js.map +0 -1
  141. package/dist/development/jsx-runtime.js.map +0 -1
  142. package/dist/development/server-renderer-DCLoMdOX.js.map +0 -1
  143. package/dist/development/src-DoQgCX-O.js.map +0 -1
  144. package/dist/development/vite-Bmyb6P5w.js +0 -265
  145. package/dist/development/vite-Bmyb6P5w.js.map +0 -1
  146. package/dist/dom-D8g3roX9.js.map +0 -1
  147. package/dist/jsx-runtime-DQnpyT_g.d.ts.map +0 -1
  148. package/dist/jsx-runtime.js.map +0 -1
  149. package/dist/server-renderer-D0rsFL_-.js.map +0 -1
  150. package/dist/src-Bme1kz2b.js.map +0 -1
  151. package/dist/vite-Bmyb6P5w.js +0 -265
  152. package/dist/vite-Bmyb6P5w.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as useStore, a as Children, c as SpaElement, d as onMount, f as useDisposal, g as useSetter, h as useRef, i as Accessor, l as TimelineControls, m as useId, n as CapabilityBinding, o as Component, p as useGetter, r as CapabilityTarget, s as RootOptions, t as Capability, u as onCleanup, v as useTimeline, y as useTransaction } from "./capabilities-DNcnGRv_.js";
2
- import { a as render, i as hydrate, n as useLoadable, r as SpaRoot, t as LoadableValue } from "./index-BFnXIfOj.js";
3
- import { n as Fragment } from "./jsx-runtime-DQnpyT_g.js";
4
- export { type Accessor, type Capability, type CapabilityBinding, type CapabilityTarget, type Children, type Component, Fragment, type LoadableValue, type RootOptions, type SpaElement, type SpaRoot, type TimelineControls, hydrate, onCleanup, onMount, render, useDisposal, useGetter, useId, useLoadable, useRef, useSetter, useStore, useTimeline, useTransaction };
1
+ import { S as useTransaction, _ as useId, a as Children, b as useStore, c as RootBoundary, d as TimelineControls, f as onCleanup, g as useGetter, h as useDisposal, i as Accessor, l as RootOptions, m as onMount, n as CapabilityBinding, o as Component, p as onCommit, r as CapabilityTarget, t as Capability, u as SpaElement, v as useRef, x as useTimeline, y as useSetter } from "./capabilities-ChgSs6bp.js";
2
+ import { a as render, i as hydrate, n as useLoadable, r as SpaRoot, t as LoadableValue } from "./index-DdA39aMv.js";
3
+ import { n as Fragment } from "./jsx-runtime-CCvcEosg.js";
4
+ export { type Accessor, type Capability, type CapabilityBinding, type CapabilityTarget, type Children, type Component, Fragment, type LoadableValue, RootBoundary as Root, type RootOptions, type SpaElement, type SpaRoot, type TimelineControls, hydrate, onCleanup, onCommit, onMount, render, useDisposal, useGetter, useId, useLoadable, useRef, useSetter, useStore, useTimeline, useTransaction };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
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-B4rJ0xdc.js";
2
- import { Fragment } from "./jsx-runtime.js";
3
- import { n as render, t as hydrate } from "./dom-D8g3roX9.js";
4
- import { t as useLoadable } from "./src-Bme1kz2b.js";
5
- export { Fragment, hydrate, onCleanup, onMount, render, useDisposal, useGetter, useId, useLoadable, useRef, useSetter, useStore, useTimeline, useTransaction };
1
+ import { C as useSetter, E as useTransaction, S as useRef, T as useTimeline, b as useGetter, d as onCommit, f as onMount, t as RootBoundary, u as onCleanup, w as useStore, x as useId, y as useDisposal } from "./core-DD2giR6E.js";
2
+ import { n as render, t as hydrate } from "./dom--HZvmgqd.js";
3
+ import { t as Fragment } from "./jsx-runtime-BGDPK50B.js";
4
+ import { t as useLoadable } from "./src-B2W_TA_X.js";
5
+ export { Fragment, RootBoundary as Root, hydrate, onCleanup, onCommit, onMount, render, useDisposal, useGetter, useId, useLoadable, useRef, useSetter, useStore, useTimeline, useTransaction };
@@ -0,0 +1,49 @@
1
+ // src/props.ts
2
+ function liveProps(values, fixedKey) {
3
+ const source = (name) => values().reverse().find((props) => Object.hasOwn(props, name));
4
+ const has = (_, name) => fixedKey && name === `key` ? fixedKey.present : source(name) !== void 0;
5
+ return new Proxy({}, {
6
+ has,
7
+ get(_, name) {
8
+ if (fixedKey && name === `key`) return fixedKey.value;
9
+ const props = source(name);
10
+ return props && Reflect.get(props, name);
11
+ },
12
+ ownKeys() {
13
+ const keys = new Set(values().flatMap(Object.keys));
14
+ if (fixedKey?.present) keys.add(`key`);
15
+ else if (fixedKey) keys.delete(`key`);
16
+ return [...keys];
17
+ },
18
+ getOwnPropertyDescriptor(_, name) {
19
+ if (has(_, name)) return {
20
+ enumerable: true,
21
+ configurable: true
22
+ };
23
+ }
24
+ });
25
+ }
26
+ /** Preserve lazy props and spread precedence, including keys added by later updates. */
27
+ function merge(...sources) {
28
+ return liveProps(() => sources.map((source) => (typeof source === `function` ? source() : source) ?? {}));
29
+ }
30
+ /** Expose the first key while leaving data props live, including through spreads. */
31
+ function instanceProps(read, key) {
32
+ return liveProps(() => [read()], {
33
+ value: key,
34
+ present: key !== void 0 || Object.hasOwn(read(), `key`)
35
+ });
36
+ }
37
+ // src/jsx-runtime.ts
38
+ const Fragment = (props) => props.children;
39
+ function jsx(type, props, key) {
40
+ return {
41
+ type,
42
+ props: key === void 0 ? props ?? {} : merge(props ?? {}, { key })
43
+ };
44
+ }
45
+ const jsxs = jsx;
46
+ const jsxDEV = jsx;
47
+ export { instanceProps as a, jsxs as i, jsx as n, merge as o, jsxDEV as r, Fragment as t };
48
+
49
+ //# sourceMappingURL=jsx-runtime-BGDPK50B.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsx-runtime-BGDPK50B.js","names":[],"sources":["../src/props.ts","../src/jsx-runtime.ts"],"sourcesContent":["import type { Canonical } from \"atom.io/foundations/canonical\"\n\nimport type { SpaElement } from \"./core.ts\"\n\ntype Props = SpaElement[`props`]\ntype FixedKey = { value: Canonical | undefined; present: boolean }\n\nfunction liveProps(values: () => Props[], fixedKey?: FixedKey): Props {\n\tconst source = (name: PropertyKey) =>\n\t\tvalues()\n\t\t\t.reverse()\n\t\t\t.find((props) => Object.hasOwn(props, name))\n\tconst has = (_: Props, name: PropertyKey): boolean =>\n\t\tfixedKey && name === `key` ? fixedKey.present : source(name) !== undefined\n\treturn new Proxy(\n\t\t{},\n\t\t{\n\t\t\thas,\n\t\t\tget(_, name) {\n\t\t\t\tif (fixedKey && name === `key`) return fixedKey.value\n\t\t\t\tconst props = source(name)\n\t\t\t\treturn props && Reflect.get(props, name)\n\t\t\t},\n\t\t\townKeys() {\n\t\t\t\tconst keys = new Set(values().flatMap(Object.keys))\n\t\t\t\tif (fixedKey?.present) keys.add(`key`)\n\t\t\t\telse if (fixedKey) keys.delete(`key`)\n\t\t\t\treturn [...keys]\n\t\t\t},\n\t\t\tgetOwnPropertyDescriptor(_, name) {\n\t\t\t\tif (has(_, name)) return { enumerable: true, configurable: true }\n\t\t\t},\n\t\t},\n\t)\n}\n\n/** Preserve lazy props and spread precedence, including keys added by later updates. */\nexport function merge(...sources: (Props | (() => Props))[]): Props {\n\treturn liveProps(() =>\n\t\tsources.map(\n\t\t\t(source) => (typeof source === `function` ? source() : source) ?? {},\n\t\t),\n\t)\n}\n\n/** Expose the first key while leaving data props live, including through spreads. */\nexport function instanceProps(\n\tread: () => Props,\n\tkey: Canonical | undefined,\n): Props {\n\treturn liveProps(() => [read()], {\n\t\tvalue: key,\n\t\tpresent: key !== undefined || Object.hasOwn(read(), `key`),\n\t})\n}\n","import type { Canonical } from \"atom.io/foundations/canonical\"\n\nimport type { Children, Component, SpaElement } from \"./core.ts\"\nimport type { HTMLAttributes, NativeElements } from \"./jsx-types.d.ts\"\nimport { merge } from \"./props.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\"\nexport { merge } from \"./props.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?: Canonical,\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\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?: Canonical | undefined\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":";AAOA,SAAS,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
1
- import { a as Children, c as SpaElement, o as Component } from "./capabilities-DNcnGRv_.js";
2
- /** Native events retain their target; only currentTarget is the attached element. */
1
+ import { a as Children, o as Component, u as SpaElement } from "./capabilities-ChgSs6bp.js";
2
+ import { Canonical } from "atom.io/foundations/canonical";
3
+ /** Native targets are preserved; currentTarget identifies the attached element. */
3
4
  type TargetedEvent<E extends Element, T extends Event = Event> = Omit<T, `currentTarget`> & {
4
5
  readonly currentTarget: E;
5
- };
6
+ } & (T extends FocusEvent | MouseEvent ? {
7
+ readonly relatedTarget: (EventTarget & Element) | null;
8
+ } : {});
6
9
  type EventHandler<E extends Element, T extends Event = Event> = (event: TargetedEvent<E, T>) => void;
7
10
  type Ref<E extends Element> = (element: E | null) => void;
8
11
  type Attributes<T> = { [K in keyof T]?: T[K] | null | undefined; };
@@ -160,7 +163,7 @@ type AriaAttributes = Attributes<{
160
163
  }>;
161
164
  type DOMAttributes<E extends Element> = CapabilityAttributes<`dom`> & EventAttributes<E> & AriaAttributes & Attributes<{
162
165
  children: Children;
163
- key: string | number;
166
+ key: Canonical;
164
167
  ref: Ref<E>;
165
168
  id: string;
166
169
  class: string;
@@ -563,6 +566,7 @@ interface HTMLTagAttributes {
563
566
  type HTMLIntrinsicElements = { [Tag in keyof HTMLElementTagNameMap]: HTMLAttributes<HTMLElementTagNameMap[Tag]> & (Tag extends keyof HTMLTagAttributes ? HTMLAliases<HTMLTagAttributes[Tag]> : {}); };
564
567
  /** SVG uses literal attribute names: e.g. stroke-width, not strokeWidth. */
565
568
  type SVGAttributes<E extends SVGElement = SVGElement> = DOMAttributes<E> & Attributes<{
569
+ focusable: Booleanish | `auto`;
566
570
  lang: string;
567
571
  [`xml:lang`]: string;
568
572
  [`xml:space`]: `default` | `preserve`;
@@ -939,16 +943,17 @@ type SVGIntrinsicElements = { [Tag in keyof SVGElementTagNameMap]: SVGAttributes
939
943
  // JSX cannot infer namespace from parents. Shared names (a, script, style,
940
944
  // title) use HTML types; unambiguous SVG tags retain their concrete SVG type.
941
945
  type NativeElements = HTMLIntrinsicElements & Omit<SVGIntrinsicElements, keyof HTMLIntrinsicElements>;
946
+ type Props = SpaElement[`props`];
947
+ /** Preserve lazy props and spread precedence, including keys added by later updates. */
948
+ declare function merge(...sources: (Props | (() => Props))[]): Props;
942
949
  /** Optional integrations augment attributes without changing element identity. */
943
950
  interface CapabilityAttributes<Kind extends string = string> {}
944
951
  declare const Fragment: (props: {
945
952
  children?: Children;
946
953
  }) => Children;
947
- declare function jsx(type: SpaElement[`type`], props: SpaElement[`props`] | null, key?: unknown): SpaElement;
954
+ declare function jsx(type: SpaElement[`type`], props: SpaElement[`props`] | null, key?: Canonical): SpaElement;
948
955
  declare const jsxs: typeof jsx;
949
956
  declare const jsxDEV: typeof jsx;
950
- /** Preserve lazy props and spread precedence, including keys added by later updates. */
951
- declare function merge(...sources: (Record<string, any> | (() => Record<string, any>))[]): Record<string, any>;
952
957
  declare namespace JSX {
953
958
  type Element = SpaElement;
954
959
  type ElementType = keyof IntrinsicElements | Component;
@@ -956,7 +961,7 @@ declare namespace JSX {
956
961
  children: {};
957
962
  }
958
963
  interface IntrinsicAttributes {
959
- key?: string | number;
964
+ key?: Canonical | undefined;
960
965
  }
961
966
  /** Augment this interface to declare attributes for registered custom elements. */
962
967
  interface IntrinsicElements extends NativeElements {
@@ -964,4 +969,4 @@ declare namespace JSX {
964
969
  }
965
970
  }
966
971
  export { jsxDEV as a, AriaAttributes as c, EventHandler as d, HTMLAttributes as f, TargetedEvent as h, jsx as i, DOMAttributes as l, SVGAttributes as m, Fragment as n, jsxs as o, Ref as p, JSX as r, merge as s, CapabilityAttributes as t, EventAttributes as u };
967
- //# sourceMappingURL=jsx-runtime-DQnpyT_g.d.ts.map
972
+ //# sourceMappingURL=jsx-runtime-CCvcEosg.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsx-runtime-CCvcEosg.d.ts","names":[],"sources":["../src/jsx-types.d.ts","../src/props.ts","../src/jsx-runtime.ts"],"mappings":";;;KAMY,cAAc,UAAU,SAAS,UAAU,QAAQ,SAAS,KACvE;WAEc,eAAe;KAAO,UAAU,aAAa;WAC7C,gBAAgB,cAAc;;KAEjC,aAAa,UAAU,SAAS,UAAU,QAAQ,UAC7D,OAAO,cAAc,GAAG;KAEb,IAAI,UAAU,YAAY,SAAS;KAE1C,WAAW,QAAQ,WAAW,KAAK,EAAE;;UAGhC;EACT;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;KAEI,UAAU,oBACZ,IACA,WAAW,MACV,gBAAgB,aAAa,WAAW;KACvC,cAAc,UAAU,WAAW,UAAU,mBAC/C,2BACA,UAAU,mBACT,2BACA,UAAU,kBACT,0BACA,UAAU,sBACT,8BACA,UAAU,gBACT,wBACA,UAAU,aACT,qBACA;KACI,gBAAgB,UAAU,cAEpC,WAAW,cAAc,oBAAoB,UAAU,yBACpD,aAAa,GAAG,QAAQ,cAAc,GAAG,IAAI;KAG7C;KACO,iBAAiB;GAC3B;GACA,gBAAgB;GAChB;GACA;GACA;GACA,cAAc;GACd,iBAAiB;GACjB;GACA;GACA;GACA;GACA;GACA,iBAAiB;GACjB;GACA;GACA;GACA,kBAAkB;GAClB;GACA;GACA,kBAAkB;GAClB;GACA,iBAAiB;GACjB,kBAAkB;GAClB,gBAAgB;GAChB,iBAAiB;GACjB;GACA;GACA;GACA;GACA;GACA,eAAe;GACf,mBAAmB;GACnB,yBAAyB;GACzB;GACA;GACA;GACA;GACA,iBAAiB;GACjB,kBAAkB;GAClB;GAWA,kBAAkB;GAClB;GACA;GACA;GACA;GACA;GACA,kBAAkB;GAClB;GACA;GACA;GACA;GACA;GACA;;KAGU,cAAc,UAAU,WAAW,8BAC9C,gBAAgB,KAChB,iBACA;EACC,UAAU;EACV,KAAK;EACL,KAAK,IAAI;EACT;EACA;EACA;EACA;EACA;EACA;EACA;EACA;QACO;;;KAIJ,YAAY,KAAK,WAAW,QAC/B,WAAW,KAAK,mBAAmB,UAAU,cAC3C,EAAE;KAIM,eAAe,UAAU,cAAc,eAClD,cAAc,KACb;EACC;EACA;EAOA;EACA;EACA;EACA;EACA;EACA;EAQA;EACA;EACA;EACA;EASA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;KAGE;KACA;KAUA;KACA;EACJ;EACA;EACA;EACA;EACA;EACA;;KAEI;EACJ;EACA;EACA;EACA,aAAa;EACb;EACA;EACA;EACA;EACA;;KAEI;EACJ;EACA;EACA;EACA;EACA,gBAAgB;EAChB;EACA;EACA;;KAEI;EACJ;EACA;EACA;EACA;EACA;;;UAIS;EACT,GAAG;EACH,MAAM;IACL;IACA;IACA;;EAED,OAAO;EACP;IAAQ;IAAc;;EACtB;IAAc;;EACd,QAAQ;IACP;IACA;IACA;IACA,OAAO;IACP;IACA;IACA;IACA;;EAED;IAAU,QAAQ;IAAgB,OAAO;;EACzC;IAAO;;EACP;IAAY;;EACZ;IAAQ,OAAO;;EACf;IAAO;IAAc;;EACrB;IAAW;IAAc;;EACzB;IAAU;IAAe;;EACzB;IACC,QAAQ;IACR;IACA;IACA,OAAO;;EAER;IAAY;IAAmB;IAAc;;EAC7C;IACC;KACC;IACD;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAED;IAAQ;;EACR;IACC;IACA;IACA;IACA,QAAQ;IACR;IACA;IACA,gBAAgB;IAChB;IACA;IACA;IACA,OAAO;;EAER;IACC;IACA,aAAa;IACb;IACA;IACA,QAAQ;IACR;IACA;IACA,gBAAgB;IAChB;IACA;IACA;IACA;IACA,OAAO;;EAER,OAAO;IACN;IACA;IACA;IACA;IACA;IACA;IACA,cAAc;IACd;IACA;IACA,QAAQ;IACR;IACA,KAAK;IACL;IACA,KAAK;IACL;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,MAAM;IACN;IACA,OAAO;IACP,OAAO;;EAER;IAAO;IAAc;;EACrB;IAAS;IAAa;IAAiB;;EACvC;IAAM;;EACN;IACC;IACA;IACA,aAAa;IACb;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,gBAAgB;IAChB;IACA;IACA;;EAED;IAAO;;EACP;IACC;IACA;IACA;KACC;IACD;IACA;;EAED;IACC;IACA;IACA;IACA;IACA;IACA;;EAED;IACC;IACA;IACA,QAAQ;IACR;IACA;IACA;IACA,OAAO;;EAER;IAAM;IAAmB;IAAe;;EACxC;IAAY;IAAmB;;EAC/B;IACC;IACA;IACA;IACA,OAAO;;EAER;IAAU;IAAa;IAAiB;IAAc;;EACtD;IAAY;IAAa;;EACzB;IAAK;;EACL;IACC;IACA;IACA;IACA,aAAa;IACb;IACA;IACA;IACA;IACA,gBAAgB;IAChB;IACA;;EAED;IACC;IACA;IACA;IACA;IACA;IACA;IACA;IACA,OAAO;;EAER;IAAQ;;EACR;IACC,QAAQ;IACR;IACA;IACA;IACA;IACA;IACA,OAAO;;EAER;IAAS;IAAkB;IAAe;IAAe;;EACzD;IAAS,aAAa;IAAgB,aAAa;;EACnD,IAAI;EACJ;IACC;IACA;IACA;IACA;;EAED;IACC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAED,IAAI;EACJ;IAAQ;;EACR;IACC;IACA;IACA;IACA;IACA;;EAED,OAAO;IACN;IACA,QAAQ;IACR;IACA;IACA,OAAO;;;KAIG,2BACV,aAAa,wBAAwB,eACrC,sBAAsB,SAErB,kBAAkB,oBAChB,YAAY,kBAAkB;;KAKvB,cAAc,UAAU,aAAa,cAAc,cAAc,KAC5E;EACC,WAAW;EACX;GACC;GACA;EACD;GACC;GACA;GACA,mBAAmB;EACpB;GACC;GACA;EACD;GACC;GACA;GACA;EACD;EACA;EACA;GACC;EACD;GACC,iBAAiB;GACjB;EACD;GACC;GACA,kBAAkB;GAClB;GACA,cAAc;GACd,qBAAqB;GACrB;GACA;GACA;GACA,gBAAgB;GAChB;GACA,mBAAmB;GACnB;GACA;GACA;GACA;EACD;EACA,SAAS;EACT;GACC;GACA;GACA;GACA;GACA,iBAAiB;EAClB;GACC,qBAAqB;GACrB,sBAAsB;GACtB;GACA;GACA,sBAAsB;GACtB,mBAAmB;GACnB,iBAAiB;GACjB;GACA;GACA;EACD;GACC;GACA;GACA;EACD;GACC,iBAAiB;GACjB;;KAGE;EACJ,GAAG;EACH,GAAG;EACH,OAAO;EACP,QAAQ;;KAEJ;EAAe;EAAiB;;KAChC;EAAY;GAAe;;KAC3B,qBAAqB;EAAW;;KAChC,eAAe;EACnB;EACA;EACA,OAAO;EACP,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL;EACA,aAAa;EACb,WAAW;EACX;EACA;EACA;EACA;EACA,MAAM;EACN,IAAI;EACJ,IAAI;EACJ;EACA;;KAEI;EACJ,GAAG;EACH,GAAG;EACH,IAAI;EACJ,IAAI;EACJ,QAAQ;EACR,YAAY;EACZ;;UAES;EACT,GAAG;IACF;IACA;IACA;IACA;IACA;;EAED,SAAS;EACT,eAAe;IACd;IACA;IACA,QAAQ;IACR;;EAED,kBAAkB;IACjB;;EAED;IACC,IAAI;IACJ,IAAI;IACJ,GAAG;IACH;;EAED;IAAY;;EACZ;IACC,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ;;EAED,SAAS;IAAuB;IAAY;IAAa;;EACzD,eAAe;IACd;IACA;IACA;;EAED,qBAAqB;IAAuB;;EAC5C,aAAa;IACZ;IACA;IACA;IACA;IACA;IACA;IACA;;EAED,kBAAkB;IACjB;IACA,OAAO;IACP;IACA;IACA;IACA;IACA;IACA;IACA,eAAe;;EAEhB,mBAAmB;IAClB;IACA;IACA;IACA,kBAAkB;;EAEnB,mBAAmB;IAClB;IACA;IACA;IACA;IACA;;EAED;IAAkB;IAAiB;;EACnC,cAAc;IACb,IAAI;IACJ,IAAI;IACJ,cAAc;;EAEf,SAAS;EACT;IACC;IACA;IACA;IACA;IACA;IACA;IACA;;EAED,SAAS;EACT,SAAS;EACT,SAAS;EACT,gBAAgB;IACf;IACA,cAAc;IACd;;EAED,SAAS,qBACR;IAAY;IAA6B,aAAa;;EACvD,SAAS;EACT;IAAe;;EACf,cAAc;IACb;IACA;IACA,QAAQ;;EAET,UAAU;IACT;IACA,IAAI;IACJ,IAAI;;EAEL;IAAgB;IAAW;IAAW;;EACtC,oBAAoB;IACnB;IACA;IACA;IACA;IACA,kBAAkB;;EAEnB;IACC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAED,QAAQ;IAAuB;;EAC/B,cAAc;IACb,eAAe;IACf;IACA;IACA;IACA;;EAED,QAAQ;IAAW;IAAqB;;EACxC,eAAe;EACf,OAAO,SACN;IACC;IACA,aAAa;IACb;;EAEF;IACC,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ;;EAED,gBAAgB;IACf,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ;IACA;IACA;;EAED,QAAQ;IACP,MAAM;IACN,MAAM;IACN,aAAa;IACb,cAAc;IACd;IACA,QAAQ;;EAET,MAAM;IAAW;IAAmB;;EACpC,OAAO;EACP;IAAQ;IAAW;;EACnB,SAAS,SACR,aACA;IACC;IACA;IACA;;EAEF;IAAW;IAAgB;;EAC3B,UAAU;EACV,gBAAgB;IACf,IAAI;IACJ,IAAI;IACJ,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ;IACA;IACA;;EAED,MAAM;IAAW,IAAI;IAAgB,IAAI;IAAgB;;EACzD,QAAQ;IAAY;IAAc,aAAa;;EAC/C,KAAK;EACL;IAAQ,QAAQ;;EAChB;IAAS;IAAc;IAAe;;EACtC,KAAK,SAAS;IAAe;;EAC7B,QAAQ,SAAS;IAAe,MAAM;IAAgB,MAAM;;EAC5D,MAAM;EACN,UAAU;IACT,aAAa;IACb;IACA;IACA;IACA,YAAY;IACZ;;EAED,OAAO;EACP,KAAK,SAAS;EACd,MAAM;IAAe;;;KAEV,0BACV,aAAa,uBAAuB,cAAc,qBAAqB,SACtE,kBAAkB,mBAAmB,WAAW,iBAAiB;;;KAKxD,iBAAiB,wBAC5B,KAAK,4BAA4B;KC/4B7B,QAAQ;;iBAiCG,SAAS,UAAU,eAAe,YAAY;;UCjB7C,qBAAqB;cAEzB,WAAQ;EAAa,WAAW;MAAa;iBAE1C,IACf,MAAM,oBACN,OAAO,4BACP,MAAM,YACJ;cAMU,aAAI;cACJ,eAAM;kBAEF;OACJ,UAAU;OACV,oBAAoB,oBAAoB;YACnC;IAChB;;YAEgB;IAChB,MAAM;;;YAGU,0BAA0B;KACzC,6BAA6B,eAAe"}
@@ -1,2 +1,2 @@
1
- import { a as jsxDEV, c as AriaAttributes, d as EventHandler, f as HTMLAttributes, h as TargetedEvent, i as jsx, l as DOMAttributes, m as SVGAttributes, n as Fragment, o as jsxs, p as Ref, r as JSX, s as merge, t as CapabilityAttributes, u as EventAttributes } from "./jsx-runtime-DQnpyT_g.js";
1
+ import { a as jsxDEV, c as AriaAttributes, d as EventHandler, f as HTMLAttributes, h as TargetedEvent, i as jsx, l as DOMAttributes, m as SVGAttributes, n as Fragment, o as jsxs, p as Ref, r as JSX, s as merge, t as CapabilityAttributes, u as EventAttributes } from "./jsx-runtime-CCvcEosg.js";
2
2
  export { type AriaAttributes, CapabilityAttributes, type DOMAttributes, type EventAttributes, type EventHandler, Fragment, type HTMLAttributes, JSX, type Ref, type SVGAttributes, type TargetedEvent, jsx, jsxDEV, jsxs, merge };
@@ -1,25 +1 @@
1
- // src/jsx-runtime.ts
2
- const Fragment = (props) => props.children;
3
- function jsx(type, props, key) {
4
- return {
5
- type,
6
- props: key === void 0 ? props ?? {} : merge(props ?? {}, { key })
7
- };
8
- }
9
- const jsxs = jsx;
10
- const jsxDEV = jsx;
11
- /** Preserve lazy props and spread precedence, including keys added by later updates. */
12
- function merge(...sources) {
13
- const values = () => sources.map((source) => (typeof source === `function` ? source() : source) ?? {});
14
- return new Proxy({}, {
15
- get: (_, key) => values().reverse().find((source) => Object.hasOwn(source, key))?.[key],
16
- ownKeys: () => [...new Set(values().flatMap(Object.keys))],
17
- getOwnPropertyDescriptor: (_, key) => values().some((source) => Object.hasOwn(source, key)) ? {
18
- enumerable: true,
19
- configurable: true
20
- } : void 0
21
- });
22
- }
23
- export { Fragment, jsx, jsxDEV, jsxs, merge };
24
-
25
- //# sourceMappingURL=jsx-runtime.js.map
1
+ export { t as Fragment, n as jsx, r as jsxDEV, i as jsxs, o as merge } from "./jsx-runtime-BGDPK50B.js";
package/dist/konva.d.ts CHANGED
@@ -1,19 +1,56 @@
1
- import { a as Children, c as SpaElement } from "./capabilities-DNcnGRv_.js";
1
+ import { a as Children, u as SpaElement } from "./capabilities-ChgSs6bp.js";
2
2
  import { SceneRenderer } from "./renderer.js";
3
- import "./index-BFnXIfOj.js";
4
- import { t as CapabilityAttributes } from "./jsx-runtime-DQnpyT_g.js";
3
+ import "./index-DdA39aMv.js";
4
+ import { t as CapabilityAttributes } from "./jsx-runtime-CCvcEosg.js";
5
5
  import Konva from "konva";
6
- type Props<C, N> = C & CapabilityAttributes<`konva`> & {
6
+ type InteractionEvent = MouseEvent | TouchEvent | PointerEvent;
7
+ interface Events {
8
+ onClick: MouseEvent;
9
+ onDblClick: MouseEvent;
10
+ onMouseDown: MouseEvent;
11
+ onMouseUp: MouseEvent;
12
+ onMouseMove: MouseEvent;
13
+ onMouseEnter: MouseEvent;
14
+ onMouseLeave: MouseEvent;
15
+ onMouseOver: MouseEvent;
16
+ onMouseOut: MouseEvent;
17
+ onContextMenu: PointerEvent;
18
+ onWheel: WheelEvent;
19
+ onPointerDown: PointerEvent;
20
+ onPointerUp: PointerEvent;
21
+ onPointerMove: PointerEvent;
22
+ onPointerEnter: PointerEvent;
23
+ onPointerLeave: PointerEvent;
24
+ onPointerOver: PointerEvent;
25
+ onPointerOut: PointerEvent;
26
+ onPointerCancel: PointerEvent;
27
+ onPointerClick: PointerEvent;
28
+ onPointerDblClick: PointerEvent;
29
+ onGotPointerCapture: PointerEvent;
30
+ onLostPointerCapture: PointerEvent;
31
+ onTouchStart: TouchEvent;
32
+ onTouchMove: TouchEvent;
33
+ onTouchEnd: TouchEvent;
34
+ onTouchCancel: TouchEvent;
35
+ onTap: TouchEvent;
36
+ onDblTap: TouchEvent;
37
+ onDragStart: InteractionEvent;
38
+ onDragMove: InteractionEvent;
39
+ onDragEnd: InteractionEvent;
40
+ onTransformStart: InteractionEvent;
41
+ onTransform: InteractionEvent;
42
+ onTransformEnd: InteractionEvent | undefined;
43
+ }
44
+ type Config<C> = { [K in keyof C as string extends K ? never : number extends K ? never : K]: C[K]; };
45
+ type Props<C, N extends Konva.Node> = Config<C> & { [K in keyof Events]?: ((event: Omit<Konva.KonvaEventObject<Events[K]>, `currentTarget`> & {
46
+ readonly currentTarget: N;
47
+ }) => void) | undefined; } & CapabilityAttributes<`konva`> & {
7
48
  children?: Children;
8
49
  ref?: (node: N | null) => void;
9
- onClick?: (event: Konva.KonvaEventObject<MouseEvent>) => void;
10
- onPointerDown?: (event: Konva.KonvaEventObject<PointerEvent>) => void;
11
- onDragMove?: (event: Konva.KonvaEventObject<DragEvent>) => void;
12
- onDragEnd?: (event: Konva.KonvaEventObject<DragEvent>) => void;
13
50
  };
14
51
  declare const renderer: SceneRenderer<import("konva/lib/Node").Node<import("konva/lib/Node").NodeConfig>>;
15
52
  /** A DOM boundary owning a Konva stage and its scene subtree. */
16
- export declare function Stage(props: Props<Omit<Konva.StageConfig, `container`>, Konva.Stage> & {
53
+ export declare function Stage(props: Props<Omit<Config<Konva.StageConfig>, `container`>, Konva.Stage> & {
17
54
  width?: number;
18
55
  height?: number;
19
56
  }): SpaElement;
@@ -1 +1 @@
1
- {"version":3,"file":"konva.d.ts","names":["_$__renderer_ts0.SceneRenderer"],"sources":["../src/konva.ts"],"mappings":";;;;;KAUK,MAAM,GAAG,KAAK,IAClB;EACC,WAAW;EACX,OAAO,MAAM;EACb,WAAW,OAAO,MAAM,iBAAiB;EACzC,iBAAiB,OAAO,MAAM,iBAAiB;EAC/C,cAAc,OAAO,MAAM,iBAAiB;EAC5C,aAAa,OAAO,MAAM,iBAAiB;;cAyCvC,UAAAA,uCAAQ,8BAAA;;wBA6CE,MACf,OAAO,MAAM,KAAK,MAAM,2BAA2B,MAAM;EACxD;EACA;IAEC;qBA0DU,QAAK,OAAA,gCAAA,uCAAA,WAAA;qBAEL,QAAK,OAAA,oCAAA,2CAAA,WAAA;qBAEL,OAAI,OAAA,sCAAA,4CAAA,UAAA;qBACJ,SAAM,OAAA,wCAAA,gDAAA,YAAA;qBAEN,UAAO,OAAA,yCAAA,kDAAA,aAAA;qBAEP,OAAI,OAAA,sCAAA,4CAAA,qCAAA,iBAAA;qBACJ,OAAI,OAAA,sCAAA,4CAAA,UAAA;qBACJ,QAAK,OAAA,uCAAA,8CAAA,WAAA;qBAEL,OAAI,OAAA,sCAAA,4CAAA,UAAA;qBACJ,OAAI,OAAA,sCAAA,4CAAA,UAAA;qBACJ,cAAW,OAAA,6CAAA,0DAAA,iBAAA"}
1
+ {"version":3,"file":"konva.d.ts","names":["_$__renderer_ts0.SceneRenderer"],"sources":["../src/konva.ts"],"mappings":";;;;;KAUK,mBAAmB,aAAa,aAAa;UACxC;EACT,SAAS;EACT,YAAY;EACZ,aAAa;EACb,WAAW;EACX,aAAa;EACb,cAAc;EACd,cAAc;EACd,aAAa;EACb,YAAY;EACZ,eAAe;EACf,SAAS;EACT,eAAe;EACf,aAAa;EACb,eAAe;EACf,gBAAgB;EAChB,gBAAgB;EAChB,eAAe;EACf,cAAc;EACd,iBAAiB;EACjB,gBAAgB;EAChB,mBAAmB;EACnB,qBAAqB;EACrB,sBAAsB;EACtB,cAAc;EACd,aAAa;EACb,YAAY;EACZ,eAAe;EACf,OAAO;EACP,UAAU;EACV,aAAa;EACb,YAAY;EACZ,WAAW;EACX,kBAAkB;EAClB,aAAa;EACb,gBAAgB;;KAEZ,OAAO,QACV,WAAW,oBAAoB,2BAA2B,YAAY,IAAI,EAAE;KAEzE,MAAM,GAAG,UAAU,MAAM,QAAQ,OAAO,QAC3C,WAAW,YAET,OAAO,KAAK,MAAM,iBAAiB,OAAO;WAChC,eAAe;6BAIzB;EACF,WAAW;EACX,OAAO,MAAM;;cAyCT,UAAAA,uCAAQ,8BAAA;;wBAyDE,MACf,OAAO,MAAM,KAAK,OAAO,MAAM,4BAA4B,MAAM;EAChE;EACA;IAEC;qBA0DU,QAAK,OAAA,gCAAA,uCAAA,WAAA;qBAEL,QAAK,OAAA,oCAAA,2CAAA,WAAA;qBAEL,OAAI,OAAA,sCAAA,4CAAA,UAAA;qBACJ,SAAM,OAAA,wCAAA,gDAAA,YAAA;qBAEN,UAAO,OAAA,yCAAA,kDAAA,aAAA;qBAEP,OAAI,OAAA,sCAAA,4CAAA,qCAAA,iBAAA;qBACJ,OAAI,OAAA,sCAAA,4CAAA,UAAA;qBACJ,QAAK,OAAA,uCAAA,8CAAA,WAAA;qBAEL,OAAI,OAAA,sCAAA,4CAAA,UAAA;qBACJ,OAAI,OAAA,sCAAA,4CAAA,UAAA;qBACJ,cAAW,OAAA,6CAAA,0DAAA,iBAAA"}
package/dist/konva.js CHANGED
@@ -1,6 +1,6 @@
1
- import { n as capabilityProps } from "./capabilities-nOIitQ-_.js";
2
- import { c as onCleanup, l as onMount, u as owner } from "./core-B4rJ0xdc.js";
3
- import { jsx } from "./jsx-runtime.js";
1
+ import { i as capabilityProps } from "./identity-oFU5p-Qj.js";
2
+ import { f as onMount, p as owner, u as onCleanup } from "./core-DD2giR6E.js";
3
+ import { n as jsx } from "./jsx-runtime-BGDPK50B.js";
4
4
  import { bindScene, createSceneRenderer, sceneComponent } from "./renderer.js";
5
5
  import Konva from "konva";
6
6
  // src/konva.ts
@@ -66,11 +66,18 @@ const renderer = createSceneRenderer({
66
66
  children(parent, children) {
67
67
  if (children.length && !(parent instanceof Konva.Container)) throw new Error(`spa/konva: shapes cannot contain children`);
68
68
  if (parent instanceof Konva.Container) {
69
- for (const child of [...parent.getChildren()]) if (!children.includes(child)) child.remove();
69
+ const current = parent.getChildren();
70
+ if (current.length === children.length && children.every((child, index) => child === current[index])) return;
71
+ const wanted = new Set(children);
72
+ for (const child of [...current]) if (!wanted.has(child)) child.remove();
70
73
  children.forEach((child, index) => {
71
74
  if (child.getParent() !== parent) parent.add(child);
72
- child.zIndex(index);
75
+ if (parent instanceof Konva.Stage && child.zIndex() !== index) child.zIndex(index);
73
76
  });
77
+ if (!(parent instanceof Konva.Stage)) {
78
+ parent.children = [...children];
79
+ parent._setChildrenIndices();
80
+ }
74
81
  }
75
82
  },
76
83
  destroy(node) {
package/dist/konva.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"konva.js","names":[],"sources":["../src/konva.ts"],"sourcesContent":["import Konva from \"konva\"\n\nimport { capabilityProps } from \"./capabilities.ts\"\nimport { owner } from \"./core.ts\"\nimport type { Children, SpaElement } from \"./index.ts\"\nimport { onCleanup, onMount } from \"./index.ts\"\nimport type { CapabilityAttributes } from \"./jsx-runtime.ts\"\nimport { jsx } from \"./jsx-runtime.ts\"\nimport { bindScene, createSceneRenderer, sceneComponent } from \"./renderer.ts\"\n\ntype Props<C, N> = C &\n\tCapabilityAttributes<`konva`> & {\n\t\tchildren?: Children\n\t\tref?: (node: N | null) => void\n\t\tonClick?: (event: Konva.KonvaEventObject<MouseEvent>) => void\n\t\tonPointerDown?: (event: Konva.KonvaEventObject<PointerEvent>) => void\n\t\tonDragMove?: (event: Konva.KonvaEventObject<DragEvent>) => void\n\t\tonDragEnd?: (event: Konva.KonvaEventObject<DragEvent>) => void\n\t}\nconst constructors = {\n\tLayer: Konva.Layer,\n\tGroup: Konva.Group,\n\tRect: Konva.Rect,\n\tCircle: Konva.Circle,\n\tEllipse: Konva.Ellipse,\n\tLine: Konva.Line,\n\tText: Konva.Text,\n\tImage: Konva.Image,\n\tPath: Konva.Path,\n\tStar: Konva.Star,\n\tTransformer: Konva.Transformer,\n}\nfunction suspendNode(node: Konva.Node): () => void {\n\tconst listening = node.listening()\n\tconst draggable = node.draggable()\n\tnode.listening(false)\n\t// The public setter clears both pending and active native drag records.\n\tnode.draggable(false)\n\treturn () => {\n\t\tnode.listening(listening)\n\t\tnode.draggable(draggable)\n\t}\n}\nfunction updateNode(\n\tnode: Konva.Node,\n\tprops: Record<string, any>,\n\tprevious: Record<string, any>,\n): void {\n\tfor (const key of new Set([...Object.keys(previous), ...Object.keys(props)])) {\n\t\tif (/^(key|children|ref)$/.test(key) || Object.is(props[key], previous[key]))\n\t\t\tcontinue\n\t\tif (key.startsWith(`on`)) {\n\t\t\tconst event = key.slice(2).toLowerCase()\n\t\t\tif (previous[key]) node.off(event, previous[key])\n\t\t\tif (props[key]) node.on(event, props[key])\n\t\t} else node.setAttr(key, props[key])\n\t}\n}\nconst renderer = createSceneRenderer<Konva.Node>({\n\ttarget(node) {\n\t\treturn {\n\t\t\tkind: `konva`,\n\t\t\tnode,\n\t\t\tsuspend() {\n\t\t\t\treturn suspendNode(node)\n\t\t\t},\n\t\t\tread: (key) => node.getAttr(key),\n\t\t\twrite: (key, value) => {\n\t\t\t\tnode.setAttr(key, value)\n\t\t\t},\n\t\t\tlisten(event, listener) {\n\t\t\t\tnode.on(event, listener)\n\t\t\t\treturn () => {\n\t\t\t\t\tnode.off(event, listener)\n\t\t\t\t}\n\t\t\t},\n\t\t}\n\t},\n\tcreate(type) {\n\t\tconst Constructor = constructors[type as keyof typeof constructors]\n\t\tif (!Constructor) throw new Error(`spa/konva: unknown node ${type}`)\n\t\treturn new Constructor({} as any)\n\t},\n\tupdate: updateNode,\n\tchildren(parent, children) {\n\t\tif (children.length && !(parent instanceof Konva.Container))\n\t\t\tthrow new Error(`spa/konva: shapes cannot contain children`)\n\t\tif (parent instanceof Konva.Container) {\n\t\t\tfor (const child of [...parent.getChildren()])\n\t\t\t\tif (!children.includes(child)) child.remove()\n\t\t\tchildren.forEach((child, index) => {\n\t\t\t\tif (child.getParent() !== parent) parent.add(child as any)\n\t\t\t\tchild.zIndex(index)\n\t\t\t})\n\t\t}\n\t},\n\tdestroy(node) {\n\t\tnode.off()\n\t\tnode.destroy()\n\t},\n})\n\n/** A DOM boundary owning a Konva stage and its scene subtree. */\nexport function Stage(\n\tprops: Props<Omit<Konva.StageConfig, `container`>, Konva.Stage> & {\n\t\twidth?: number\n\t\theight?: number\n\t},\n): SpaElement {\n\tlet container: HTMLDivElement | null = null\n\tonMount(() => {\n\t\t// Konva clears its container; preserve SPA's markers in the outer element.\n\t\tconst surface = container!.ownerDocument.createElement(`div`)\n\t\tcontainer!.append(surface)\n\t\tonCleanup(() => {\n\t\t\tsurface.remove()\n\t\t})\n\t\tconst stage = new Konva.Stage({\n\t\t\tcontainer: surface,\n\t\t\twidth: props.width ?? 300,\n\t\t\theight: props.height ?? 150,\n\t\t})\n\t\tonCleanup(() => {\n\t\t\tstage.off()\n\t\t\tstage.destroy()\n\t\t})\n\t\tconst nativeProps = capabilityProps(\n\t\t\towner!,\n\t\t\t{\n\t\t\t\tkind: `konva`,\n\t\t\t\tnode: stage,\n\t\t\t\tsuspend() {\n\t\t\t\t\treturn suspendNode(stage)\n\t\t\t\t},\n\t\t\t\tlisten(event, listener) {\n\t\t\t\t\tstage.on(event, listener)\n\t\t\t\t\treturn () => {\n\t\t\t\t\t\tstage.off(event, listener)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tread: (key) => stage.getAttr(key),\n\t\t\t\twrite: (key, value) => {\n\t\t\t\t\tstage.setAttr(key, value)\n\t\t\t\t},\n\t\t\t},\n\t\t\t() => ({ ...props }),\n\t\t)\n\t\tlet previous: Record<string, any> = {}\n\t\tbindScene(\n\t\t\t() => ({ ...props }),\n\t\t\t(all) => {\n\t\t\t\tconst next = nativeProps(all)\n\t\t\t\tupdateNode(stage, next, previous)\n\t\t\t\tprevious = next\n\t\t\t},\n\t\t)\n\t\tprops.ref?.(stage)\n\t\tonCleanup(() => props.ref?.(null))\n\t\trenderer.mount(() => props.children, stage)\n\t})\n\treturn jsx(`div`, {\n\t\tref: (element: HTMLDivElement | null) => {\n\t\t\tcontainer = element\n\t\t},\n\t})\n}\nexport const Layer =\n\tsceneComponent<Props<Konva.LayerConfig, Konva.Layer>>(`Layer`)\nexport const Group =\n\tsceneComponent<Props<Konva.ContainerConfig, Konva.Group>>(`Group`)\nexport const Rect = sceneComponent<Props<Konva.RectConfig, Konva.Rect>>(`Rect`)\nexport const Circle =\n\tsceneComponent<Props<Konva.CircleConfig, Konva.Circle>>(`Circle`)\nexport const Ellipse =\n\tsceneComponent<Props<Konva.EllipseConfig, Konva.Ellipse>>(`Ellipse`)\nexport const Line = sceneComponent<Props<Konva.LineConfig, Konva.Line>>(`Line`)\nexport const Text = sceneComponent<Props<Konva.TextConfig, Konva.Text>>(`Text`)\nexport const Image =\n\tsceneComponent<Props<Konva.ImageConfig, Konva.Image>>(`Image`)\nexport const Path = sceneComponent<Props<Konva.PathConfig, Konva.Path>>(`Path`)\nexport const Star = sceneComponent<Props<Konva.StarConfig, Konva.Star>>(`Star`)\nexport const Transformer =\n\tsceneComponent<Props<Konva.TransformerConfig, Konva.Transformer>>(\n\t\t`Transformer`,\n\t)\nexport { renderer as konvaRenderer }\n"],"mappings":";;;;;;AAmBA,MAAM,eAAe;CACpB,OAAO,MAAM;CACb,OAAO,MAAM;CACb,MAAM,MAAM;CACZ,QAAQ,MAAM;CACd,SAAS,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QAAQ;GACR,MAAM,OAAO,YAAY,GAAG;GAC5B,WAAW,OAAO,MAAM,QAAQ;GAChC,WAAW;EACZ,CACD;EACA,MAAM,MAAM,KAAK;EACjB,gBAAgB,MAAM,MAAM,IAAI,CAAC;EACjC,SAAS,YAAY,MAAM,UAAU,KAAK;CAC3C,CAAC;CACD,OAAO,IAAI,OAAO,EACjB,MAAM,YAAmC;EACxC,YAAY;CACb,EACD,CAAC;AACF;AACA,MAAa,QACZ,eAAsD,OAAO;AAC9D,MAAa,QACZ,eAA0D,OAAO;AAClE,MAAa,OAAO,eAAoD,MAAM;AAC9E,MAAa,SACZ,eAAwD,QAAQ;AACjE,MAAa,UACZ,eAA0D,SAAS;AACpE,MAAa,OAAO,eAAoD,MAAM;AAC9E,MAAa,OAAO,eAAoD,MAAM;AAC9E,MAAa,QACZ,eAAsD,OAAO;AAC9D,MAAa,OAAO,eAAoD,MAAM;AAC9E,MAAa,OAAO,eAAoD,MAAM;AAC9E,MAAa,cACZ,eACC,aACD"}
1
+ {"version":3,"file":"konva.js","names":[],"sources":["../src/konva.ts"],"sourcesContent":["import Konva from \"konva\"\n\nimport { capabilityProps } from \"./capabilities.ts\"\nimport { owner } from \"./core.ts\"\nimport type { Children, SpaElement } from \"./index.ts\"\nimport { onCleanup, onMount } from \"./index.ts\"\nimport type { CapabilityAttributes } from \"./jsx-runtime.ts\"\nimport { jsx } from \"./jsx-runtime.ts\"\nimport { bindScene, createSceneRenderer, sceneComponent } from \"./renderer.ts\"\n\ntype InteractionEvent = MouseEvent | TouchEvent | PointerEvent\ninterface Events {\n\tonClick: MouseEvent\n\tonDblClick: MouseEvent\n\tonMouseDown: MouseEvent\n\tonMouseUp: MouseEvent\n\tonMouseMove: MouseEvent\n\tonMouseEnter: MouseEvent\n\tonMouseLeave: MouseEvent\n\tonMouseOver: MouseEvent\n\tonMouseOut: MouseEvent\n\tonContextMenu: PointerEvent\n\tonWheel: WheelEvent\n\tonPointerDown: PointerEvent\n\tonPointerUp: PointerEvent\n\tonPointerMove: PointerEvent\n\tonPointerEnter: PointerEvent\n\tonPointerLeave: PointerEvent\n\tonPointerOver: PointerEvent\n\tonPointerOut: PointerEvent\n\tonPointerCancel: PointerEvent\n\tonPointerClick: PointerEvent\n\tonPointerDblClick: PointerEvent\n\tonGotPointerCapture: PointerEvent\n\tonLostPointerCapture: PointerEvent\n\tonTouchStart: TouchEvent\n\tonTouchMove: TouchEvent\n\tonTouchEnd: TouchEvent\n\tonTouchCancel: TouchEvent\n\tonTap: TouchEvent\n\tonDblTap: TouchEvent\n\tonDragStart: InteractionEvent\n\tonDragMove: InteractionEvent\n\tonDragEnd: InteractionEvent\n\tonTransformStart: InteractionEvent\n\tonTransform: InteractionEvent\n\tonTransformEnd: InteractionEvent | undefined\n}\ntype Config<C> = {\n\t[K in keyof C as string extends K ? never : number extends K ? never : K]: C[K]\n}\ntype Props<C, N extends Konva.Node> = Config<C> & {\n\t[K in keyof Events]?:\n\t\t| ((\n\t\t\t\tevent: Omit<Konva.KonvaEventObject<Events[K]>, `currentTarget`> & {\n\t\t\t\t\treadonly currentTarget: N\n\t\t\t\t},\n\t\t ) => void)\n\t\t| undefined\n} & CapabilityAttributes<`konva`> & {\n\t\tchildren?: Children\n\t\tref?: (node: N | null) => void\n\t}\nconst constructors = {\n\tLayer: Konva.Layer,\n\tGroup: Konva.Group,\n\tRect: Konva.Rect,\n\tCircle: Konva.Circle,\n\tEllipse: Konva.Ellipse,\n\tLine: Konva.Line,\n\tText: Konva.Text,\n\tImage: Konva.Image,\n\tPath: Konva.Path,\n\tStar: Konva.Star,\n\tTransformer: Konva.Transformer,\n}\nfunction suspendNode(node: Konva.Node): () => void {\n\tconst listening = node.listening()\n\tconst draggable = node.draggable()\n\tnode.listening(false)\n\t// The public setter clears both pending and active native drag records.\n\tnode.draggable(false)\n\treturn () => {\n\t\tnode.listening(listening)\n\t\tnode.draggable(draggable)\n\t}\n}\nfunction updateNode(\n\tnode: Konva.Node,\n\tprops: Record<string, any>,\n\tprevious: Record<string, any>,\n): void {\n\tfor (const key of new Set([...Object.keys(previous), ...Object.keys(props)])) {\n\t\tif (/^(key|children|ref)$/.test(key) || Object.is(props[key], previous[key]))\n\t\t\tcontinue\n\t\tif (key.startsWith(`on`)) {\n\t\t\tconst event = key.slice(2).toLowerCase()\n\t\t\tif (previous[key]) node.off(event, previous[key])\n\t\t\tif (props[key]) node.on(event, props[key])\n\t\t} else node.setAttr(key, props[key])\n\t}\n}\nconst renderer = createSceneRenderer<Konva.Node>({\n\ttarget(node) {\n\t\treturn {\n\t\t\tkind: `konva`,\n\t\t\tnode,\n\t\t\tsuspend() {\n\t\t\t\treturn suspendNode(node)\n\t\t\t},\n\t\t\tread: (key) => node.getAttr(key),\n\t\t\twrite: (key, value) => {\n\t\t\t\tnode.setAttr(key, value)\n\t\t\t},\n\t\t\tlisten(event, listener) {\n\t\t\t\tnode.on(event, listener)\n\t\t\t\treturn () => {\n\t\t\t\t\tnode.off(event, listener)\n\t\t\t\t}\n\t\t\t},\n\t\t}\n\t},\n\tcreate(type) {\n\t\tconst Constructor = constructors[type as keyof typeof constructors]\n\t\tif (!Constructor) throw new Error(`spa/konva: unknown node ${type}`)\n\t\treturn new Constructor({} as any)\n\t},\n\tupdate: updateNode,\n\tchildren(parent, children) {\n\t\tif (children.length && !(parent instanceof Konva.Container))\n\t\t\tthrow new Error(`spa/konva: shapes cannot contain children`)\n\t\tif (parent instanceof Konva.Container) {\n\t\t\tconst current = parent.getChildren()\n\t\t\tif (\n\t\t\t\tcurrent.length === children.length &&\n\t\t\t\tchildren.every((child, index) => child === current[index])\n\t\t\t)\n\t\t\t\treturn\n\t\t\tconst wanted = new Set(children)\n\t\t\tfor (const child of [...current]) if (!wanted.has(child)) child.remove()\n\t\t\tchildren.forEach((child, index) => {\n\t\t\t\tif (child.getParent() !== parent) parent.add(child as any)\n\t\t\t\t// Layer zIndex also updates the Stage's canvas order.\n\t\t\t\tif (parent instanceof Konva.Stage && child.zIndex() !== index)\n\t\t\t\t\tchild.zIndex(index)\n\t\t\t})\n\t\t\tif (!(parent instanceof Konva.Stage)) {\n\t\t\t\tparent.children = [...children]\n\t\t\t\tparent._setChildrenIndices()\n\t\t\t}\n\t\t}\n\t},\n\tdestroy(node) {\n\t\tnode.off()\n\t\tnode.destroy()\n\t},\n})\n\n/** A DOM boundary owning a Konva stage and its scene subtree. */\nexport function Stage(\n\tprops: Props<Omit<Config<Konva.StageConfig>, `container`>, Konva.Stage> & {\n\t\twidth?: number\n\t\theight?: number\n\t},\n): SpaElement {\n\tlet container: HTMLDivElement | null = null\n\tonMount(() => {\n\t\t// Konva clears its container; preserve SPA's markers in the outer element.\n\t\tconst surface = container!.ownerDocument.createElement(`div`)\n\t\tcontainer!.append(surface)\n\t\tonCleanup(() => {\n\t\t\tsurface.remove()\n\t\t})\n\t\tconst stage = new Konva.Stage({\n\t\t\tcontainer: surface,\n\t\t\twidth: props.width ?? 300,\n\t\t\theight: props.height ?? 150,\n\t\t})\n\t\tonCleanup(() => {\n\t\t\tstage.off()\n\t\t\tstage.destroy()\n\t\t})\n\t\tconst nativeProps = capabilityProps(\n\t\t\towner!,\n\t\t\t{\n\t\t\t\tkind: `konva`,\n\t\t\t\tnode: stage,\n\t\t\t\tsuspend() {\n\t\t\t\t\treturn suspendNode(stage)\n\t\t\t\t},\n\t\t\t\tlisten(event, listener) {\n\t\t\t\t\tstage.on(event, listener)\n\t\t\t\t\treturn () => {\n\t\t\t\t\t\tstage.off(event, listener)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tread: (key) => stage.getAttr(key),\n\t\t\t\twrite: (key, value) => {\n\t\t\t\t\tstage.setAttr(key, value)\n\t\t\t\t},\n\t\t\t},\n\t\t\t() => ({ ...props }),\n\t\t)\n\t\tlet previous: Record<string, any> = {}\n\t\tbindScene(\n\t\t\t() => ({ ...props }),\n\t\t\t(all) => {\n\t\t\t\tconst next = nativeProps(all)\n\t\t\t\tupdateNode(stage, next, previous)\n\t\t\t\tprevious = next\n\t\t\t},\n\t\t)\n\t\tprops.ref?.(stage)\n\t\tonCleanup(() => props.ref?.(null))\n\t\trenderer.mount(() => props.children, stage)\n\t})\n\treturn jsx(`div`, {\n\t\tref: (element: HTMLDivElement | null) => {\n\t\t\tcontainer = element\n\t\t},\n\t})\n}\nexport const Layer =\n\tsceneComponent<Props<Konva.LayerConfig, Konva.Layer>>(`Layer`)\nexport const Group =\n\tsceneComponent<Props<Konva.ContainerConfig, Konva.Group>>(`Group`)\nexport const Rect = sceneComponent<Props<Konva.RectConfig, Konva.Rect>>(`Rect`)\nexport const Circle =\n\tsceneComponent<Props<Konva.CircleConfig, Konva.Circle>>(`Circle`)\nexport const Ellipse =\n\tsceneComponent<Props<Konva.EllipseConfig, Konva.Ellipse>>(`Ellipse`)\nexport const Line = sceneComponent<Props<Konva.LineConfig, Konva.Line>>(`Line`)\nexport const Text = sceneComponent<Props<Konva.TextConfig, Konva.Text>>(`Text`)\nexport const Image =\n\tsceneComponent<Props<Konva.ImageConfig, Konva.Image>>(`Image`)\nexport const Path = sceneComponent<Props<Konva.PathConfig, Konva.Path>>(`Path`)\nexport const Star = sceneComponent<Props<Konva.StarConfig, Konva.Star>>(`Star`)\nexport const Transformer =\n\tsceneComponent<Props<Konva.TransformerConfig, Konva.Transformer>>(\n\t\t`Transformer`,\n\t)\nexport { renderer as konvaRenderer }\n"],"mappings":";;;;;;AA+DA,MAAM,eAAe;CACpB,OAAO,MAAM;CACb,OAAO,MAAM;CACb,MAAM,MAAM;CACZ,QAAQ,MAAM;CACd,SAAS,MAAM;CACf,MAAM,MAAM;CACZ,MAAM,MAAM;CACZ,OAAO,MAAM;CACb,MAAM,MAAM;CACZ,MAAM,MAAM;CACZ,aAAa,MAAM;AACpB;AACA,SAAS,YAAY,MAA8B;CAClD,MAAM,YAAY,KAAK,UAAU;CACjC,MAAM,YAAY,KAAK,UAAU;CACjC,KAAK,UAAU,KAAK;CAEpB,KAAK,UAAU,KAAK;CACpB,aAAa;EACZ,KA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,EAAE,GAAG,MAAM,KACjB,QAAQ;GACR,MAAM,OAAO,YAAY,GAAG;GAC5B,WAAW,OAAO,MAAM,QAAQ;GAChC,WAAW;EACZ,CACD;EACA,MAAM,MAAM,KAAK;EACjB,gBAAgB,MAAM,MAAM,IAAI,CAAC;EACjC,SAAS,YAAY,MAAM,UAAU,KAAK;CAC3C,CAAC;CACD,OAAO,IAAI,OAAO,EACjB,MAAM,YAAmC;EACxC,YAAY;CACb,EACD,CAAC;AACF;AACA,MAAa,QACZ,eAAsD,OAAO;AAC9D,MAAa,QACZ,eAA0D,OAAO;AAClE,MAAa,OAAO,eAAoD,MAAM;AAC9E,MAAa,SACZ,eAAwD,QAAQ;AACjE,MAAa,UACZ,eAA0D,SAAS;AACpE,MAAa,OAAO,eAAoD,MAAM;AAC9E,MAAa,OAAO,eAAoD,MAAM;AAC9E,MAAa,QACZ,eAAsD,OAAO;AAC9D,MAAa,OAAO,eAAoD,MAAM;AAC9E,MAAa,OAAO,eAAoD,MAAM;AAC9E,MAAa,cACZ,eACC,aACD"}
package/dist/motion.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Capability } from "./capabilities-DNcnGRv_.js";
1
+ import { t as Capability } from "./capabilities-ChgSs6bp.js";
2
2
  export type MotionKeyframes = readonly [MotionScalar | null, MotionScalar, ...MotionScalar[]];
3
3
  export type MotionEasing = `linear` | `easeIn` | `easeOut` | `easeInOut` | `circIn` | `circOut` | `circInOut` | `backIn` | `backOut` | `backInOut` | readonly [number, number, number, number];
4
4
  /** Public options remain independent of optional Motion peer declarations. */
package/dist/motion.js CHANGED
@@ -1,4 +1,4 @@
1
- import { S as within, a as invalidate, i as fail, l as onMount, o as isPresent, p as untrack, r as dispose } from "./core-B4rJ0xdc.js";
1
+ import { D as within, c as isPresent, f as onMount, h as reportScopeError, i as dispose, o as fail, s as invalidate, v as untrack } from "./core-DD2giR6E.js";
2
2
  import { acquireProjectionNode, animate, cancelFrame, frame, handOffElementState, hover, keyframes, motionValue, press, readStyleValue, styleEffect, visualElementStore } from "motion";
3
3
  // src/motion-layout.ts
4
4
  let serial = 0;
@@ -397,7 +397,6 @@ function animateTween(value, goal, transition, interrupted) {
397
397
  /** Optional coordinator: only imported by integrations that support retention. */
398
398
  function createPresence(root) {
399
399
  const releases = /* @__PURE__ */ new Map();
400
- const handlers = /* @__PURE__ */ new WeakMap();
401
400
  const groups = /* @__PURE__ */ new Map();
402
401
  const sessions = /* @__PURE__ */ new Set();
403
402
  const active = /* @__PURE__ */ new Map();
@@ -430,14 +429,6 @@ function createPresence(root) {
430
429
  for (let at = scope; at; at = at._parent) if (at === parent) return true;
431
430
  return false;
432
431
  };
433
- const report = (error) => {
434
- if (root._dead) return;
435
- try {
436
- fail(root, error);
437
- } catch (failure) {
438
- root.error(failure);
439
- }
440
- };
441
432
  const finish = () => {
442
433
  for (const group of [...groups.values()]) {
443
434
  if (group.scope._dead || group.sessions.some((session) => !session.done)) continue;
@@ -446,7 +437,7 @@ function createPresence(root) {
446
437
  try {
447
438
  group.done();
448
439
  } catch (error) {
449
- report(error);
440
+ if (!root._dead) reportScopeError(group.scope, error);
450
441
  }
451
442
  }
452
443
  };
@@ -485,14 +476,6 @@ function createPresence(root) {
485
476
  unbind(binding) {
486
477
  releases.get(binding)?.();
487
478
  },
488
- event(scope, handler) {
489
- const cached = handlers.get(scope) ?? /* @__PURE__ */ new WeakMap();
490
- handlers.set(scope, cached);
491
- if (!cached.has(handler)) cached.set(handler, function(...args) {
492
- if (isPresent(scope)) return handler.apply(this, args);
493
- });
494
- return cached.get(handler);
495
- },
496
479
  collection(scopeOf, compatible) {
497
480
  let order = [];
498
481
  const exiting = /* @__PURE__ */ new Map();
@@ -561,7 +544,7 @@ function createPresence(root) {
561
544
  held.done = true;
562
545
  finish();
563
546
  }, (error) => {
564
- if (!held.cancelled) report(error);
547
+ if (!held.cancelled && !root._dead) reportScopeError(held.scope, error);
565
548
  });
566
549
  }
567
550
  collected.push(session);
@@ -983,7 +966,7 @@ function motionCapability(options = {}) {
983
966
  const run = ({ timestamp }) => {
984
967
  callback(timestamp);
985
968
  };
986
- frame.render(run, true);
969
+ frame.postRender(run, true);
987
970
  return () => {
988
971
  cancelFrame(run);
989
972
  };