@atom.io/spa 0.0.8 → 0.0.10

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 (185) hide show
  1. package/README.md +194 -30
  2. package/README.mdx +78 -20
  3. package/dist/BrandMarkScene-CBYk-RJ2.js +140 -0
  4. package/dist/BrandMarkScene-CBYk-RJ2.js.map +1 -0
  5. package/dist/astro-application.d.ts +1 -1
  6. package/dist/astro-client.d.ts +1 -1
  7. package/dist/astro-client.d.ts.map +1 -1
  8. package/dist/astro-client.js +5 -4
  9. package/dist/astro-client.js.map +1 -1
  10. package/dist/astro-resumability-client.d.ts +1 -1
  11. package/dist/astro-server.js +4 -4
  12. package/dist/astro-server.js.map +1 -1
  13. package/dist/{astro-shared-83hxw7-M.js → astro-shared-DBwINQav.js} +2 -2
  14. package/dist/{astro-shared-83hxw7-M.js.map → astro-shared-DBwINQav.js.map} +1 -1
  15. package/dist/{astro-shared-DZp1x8RQ.d.ts → astro-shared-KxK9OUSj.d.ts} +2 -2
  16. package/dist/{astro-shared-DZp1x8RQ.d.ts.map → astro-shared-KxK9OUSj.d.ts.map} +1 -1
  17. package/dist/astro.d.ts +1 -1
  18. package/dist/astro.js +1 -1
  19. package/dist/brand-css.d.ts +2 -0
  20. package/dist/brand-model.d.ts +32 -0
  21. package/dist/brand-model.d.ts.map +1 -0
  22. package/dist/brand-model.js +120 -0
  23. package/dist/brand-model.js.map +1 -0
  24. package/dist/brand.css +37 -0
  25. package/dist/brand.d.ts +13 -0
  26. package/dist/brand.d.ts.map +1 -0
  27. package/dist/brand.js +94 -0
  28. package/dist/brand.js.map +1 -0
  29. package/dist/{capabilities-DNcnGRv_.d.ts → capabilities-ChgSs6bp.d.ts} +34 -6
  30. package/dist/capabilities-ChgSs6bp.d.ts.map +1 -0
  31. package/dist/client.min.js +1 -1
  32. package/dist/core-DD2giR6E.js +451 -0
  33. package/dist/core-DD2giR6E.js.map +1 -0
  34. package/dist/development/BrandMarkScene-BDdC7K5M.js +140 -0
  35. package/dist/development/BrandMarkScene-BDdC7K5M.js.map +1 -0
  36. package/dist/development/astro-client.js +5 -4
  37. package/dist/development/astro-client.js.map +1 -1
  38. package/dist/development/astro-server.js +4 -4
  39. package/dist/development/astro-server.js.map +1 -1
  40. package/dist/development/{astro-shared-83hxw7-M.js → astro-shared-DBwINQav.js} +2 -2
  41. package/dist/development/{astro-shared-83hxw7-M.js.map → astro-shared-DBwINQav.js.map} +1 -1
  42. package/dist/development/astro.js +1 -1
  43. package/dist/development/brand-model.js +120 -0
  44. package/dist/development/brand-model.js.map +1 -0
  45. package/dist/development/brand.css +37 -0
  46. package/dist/development/brand.js +94 -0
  47. package/dist/development/brand.js.map +1 -0
  48. package/dist/development/core-DrUd8x25.js +465 -0
  49. package/dist/development/core-DrUd8x25.js.map +1 -0
  50. package/dist/development/{dom-DQ0M3rLL.js → dom-CEVtlaav.js} +152 -36
  51. package/dist/development/dom-CEVtlaav.js.map +1 -0
  52. package/dist/development/floating.js +2 -6
  53. package/dist/development/floating.js.map +1 -1
  54. package/dist/development/hot.js +164 -0
  55. package/dist/development/hot.js.map +1 -0
  56. package/dist/development/identity-B8wTFkyW.js +121 -0
  57. package/dist/development/identity-B8wTFkyW.js.map +1 -0
  58. package/dist/development/index.js +5 -5
  59. package/dist/development/jsx-runtime-BGDPK50B.js +49 -0
  60. package/dist/development/jsx-runtime-BGDPK50B.js.map +1 -0
  61. package/dist/development/jsx-runtime.js +1 -25
  62. package/dist/development/konva.js +12 -5
  63. package/dist/development/konva.js.map +1 -1
  64. package/dist/development/motion.js +41 -39
  65. package/dist/development/motion.js.map +1 -1
  66. package/dist/development/renderer.js +41 -40
  67. package/dist/development/renderer.js.map +1 -1
  68. package/dist/development/{server-renderer-DCLoMdOX.js → server-renderer-zAqEL1g1.js} +8 -18
  69. package/dist/development/server-renderer-zAqEL1g1.js.map +1 -0
  70. package/dist/development/server.js +1 -1
  71. package/dist/{src-Bme1kz2b.js → development/src-CB7ruwRs.js} +3 -3
  72. package/dist/development/src-CB7ruwRs.js.map +1 -0
  73. package/dist/development/three-CsZ6Od1C.js +527 -0
  74. package/dist/development/three-CsZ6Od1C.js.map +1 -0
  75. package/dist/development/three.js +1 -508
  76. package/dist/development/vite-WUiz1ju6.js +545 -0
  77. package/dist/development/vite-WUiz1ju6.js.map +1 -0
  78. package/dist/development/vite.js +1 -1
  79. package/dist/{dom-D8g3roX9.js → dom-DUpa3Sj2.js} +141 -33
  80. package/dist/dom-DUpa3Sj2.js.map +1 -0
  81. package/dist/floating.d.ts +1 -1
  82. package/dist/floating.d.ts.map +1 -1
  83. package/dist/floating.js +2 -6
  84. package/dist/floating.js.map +1 -1
  85. package/dist/hot.d.ts +15 -0
  86. package/dist/hot.d.ts.map +1 -0
  87. package/dist/hot.js +19 -0
  88. package/dist/hot.js.map +1 -0
  89. package/dist/identity-ByJswZtF.js +121 -0
  90. package/dist/identity-ByJswZtF.js.map +1 -0
  91. package/dist/{index-BFnXIfOj.d.ts → index-DdA39aMv.d.ts} +4 -4
  92. package/dist/{index-BFnXIfOj.d.ts.map → index-DdA39aMv.d.ts.map} +1 -1
  93. package/dist/index.d.ts +4 -4
  94. package/dist/index.js +5 -5
  95. package/dist/jsx-runtime-BGDPK50B.js +49 -0
  96. package/dist/jsx-runtime-BGDPK50B.js.map +1 -0
  97. package/dist/{jsx-runtime-DQnpyT_g.d.ts → jsx-runtime-CCvcEosg.d.ts} +14 -9
  98. package/dist/jsx-runtime-CCvcEosg.d.ts.map +1 -0
  99. package/dist/jsx-runtime.d.ts +1 -1
  100. package/dist/jsx-runtime.js +1 -25
  101. package/dist/konva.d.ts +46 -9
  102. package/dist/konva.d.ts.map +1 -1
  103. package/dist/konva.js +12 -5
  104. package/dist/konva.js.map +1 -1
  105. package/dist/motion.d.ts +3 -1
  106. package/dist/motion.d.ts.map +1 -1
  107. package/dist/motion.js +41 -39
  108. package/dist/motion.js.map +1 -1
  109. package/dist/renderer.d.ts +1 -1
  110. package/dist/renderer.d.ts.map +1 -1
  111. package/dist/renderer.js +39 -40
  112. package/dist/renderer.js.map +1 -1
  113. package/dist/{server-renderer-D0rsFL_-.js → server-renderer-D7CdyOMo.js} +8 -18
  114. package/dist/server-renderer-D7CdyOMo.js.map +1 -0
  115. package/dist/server.d.ts +1 -1
  116. package/dist/server.js +1 -1
  117. package/dist/size.json +12 -12
  118. package/dist/{development/src-DoQgCX-O.js → src-B2W_TA_X.js} +3 -3
  119. package/dist/src-B2W_TA_X.js.map +1 -0
  120. package/dist/three-DcYxRXPW.js +527 -0
  121. package/dist/three-DcYxRXPW.js.map +1 -0
  122. package/dist/three.d.ts +24 -3
  123. package/dist/three.d.ts.map +1 -1
  124. package/dist/three.js +1 -508
  125. package/dist/vite-WUiz1ju6.js +545 -0
  126. package/dist/vite-WUiz1ju6.js.map +1 -0
  127. package/dist/vite.d.ts.map +1 -1
  128. package/dist/vite.js +1 -1
  129. package/package.json +45 -18
  130. package/src/BrandMark.module.css +25 -0
  131. package/src/BrandMark.tsx +106 -0
  132. package/src/BrandMarkScene.module.css +10 -0
  133. package/src/BrandMarkScene.tsx +116 -0
  134. package/src/astro-client.ts +3 -2
  135. package/src/astro-server.ts +2 -2
  136. package/src/brand-css.d.ts +2 -0
  137. package/src/brand-model.ts +177 -0
  138. package/src/brand.ts +3 -0
  139. package/src/capabilities.ts +48 -21
  140. package/src/compiler-hmr.ts +297 -0
  141. package/src/compiler.ts +127 -25
  142. package/src/core.ts +282 -33
  143. package/src/dom-forms.ts +127 -0
  144. package/src/dom.ts +124 -53
  145. package/src/floating.ts +2 -6
  146. package/src/hot.ts +191 -0
  147. package/src/identity.ts +39 -0
  148. package/src/index.ts +2 -0
  149. package/src/jsx-runtime.ts +6 -26
  150. package/src/jsx-types.d.ts +8 -3
  151. package/src/konva.ts +66 -10
  152. package/src/lasertag.d.ts +1 -0
  153. package/src/motion-layout.ts +55 -26
  154. package/src/motion.ts +3 -0
  155. package/src/presence.ts +11 -23
  156. package/src/props.ts +55 -0
  157. package/src/renderer.ts +91 -71
  158. package/src/server-renderer.ts +18 -13
  159. package/src/three.ts +92 -46
  160. package/src/use-loadable.ts +2 -2
  161. package/src/vite.ts +44 -4
  162. package/dist/capabilities-DNcnGRv_.d.ts.map +0 -1
  163. package/dist/capabilities-nOIitQ-_.js +0 -65
  164. package/dist/capabilities-nOIitQ-_.js.map +0 -1
  165. package/dist/core-B4rJ0xdc.js +0 -268
  166. package/dist/core-B4rJ0xdc.js.map +0 -1
  167. package/dist/development/capabilities-nOIitQ-_.js +0 -65
  168. package/dist/development/capabilities-nOIitQ-_.js.map +0 -1
  169. package/dist/development/core-BHA7I1nf.js +0 -271
  170. package/dist/development/core-BHA7I1nf.js.map +0 -1
  171. package/dist/development/dom-DQ0M3rLL.js.map +0 -1
  172. package/dist/development/jsx-runtime.js.map +0 -1
  173. package/dist/development/server-renderer-DCLoMdOX.js.map +0 -1
  174. package/dist/development/src-DoQgCX-O.js.map +0 -1
  175. package/dist/development/three.js.map +0 -1
  176. package/dist/development/vite-Bmyb6P5w.js +0 -265
  177. package/dist/development/vite-Bmyb6P5w.js.map +0 -1
  178. package/dist/dom-D8g3roX9.js.map +0 -1
  179. package/dist/jsx-runtime-DQnpyT_g.d.ts.map +0 -1
  180. package/dist/jsx-runtime.js.map +0 -1
  181. package/dist/server-renderer-D0rsFL_-.js.map +0 -1
  182. package/dist/src-Bme1kz2b.js.map +0 -1
  183. package/dist/three.js.map +0 -1
  184. package/dist/vite-Bmyb6P5w.js +0 -265
  185. package/dist/vite-Bmyb6P5w.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index-BFnXIfOj.d.ts","names":[],"sources":["../src/dom.ts","../src/use-loadable.ts"],"mappings":";;;;UA6XiB;EAChB;EACA;;iBAyDe,OACf,aAAa,UACb,MAAM,SACN,UAAS,cACP;iBAGa,QACf,aAAa,UACb,MAAM,SACN,UAAS,cACP;KCxbS,cAAc;EAAO;EAAkB,OAAO;;iBAE1C,YAAY,GAAG,GAC9B,OAAO,cAAc,SAAS,SAAS,KACrC,qBAAqB,cAAc,OAAO,IAAI;iBACjC,YAAY,GAAG,UAAU,WAAW,GACnD,OAAO,oBAAoB,SAAS,IAAI,GAAG,IAC3C,KAAK,QAAQ,KACX,qBAAqB,cAAc,OAAO,IAAI;iBACjC,YAAY,GAAG,GAC9B,OAAO,cAAc,SAAS,SAAS,IACvC,UAAU,QAAQ,KAChB,SAAS,cAAc,OAAO;EAAQ,QAAQ;;iBACjC,YAAY,GAAG,UAAU,WAAW,GACnD,OAAO,oBAAoB,SAAS,IAAI,GAAG,IAC3C,KAAK,QAAQ,IACb,UAAU,QAAQ,KAChB,SAAS,cAAc,OAAO;EAAQ,QAAQ"}
1
+ {"version":3,"file":"index-DdA39aMv.d.ts","names":[],"sources":["../src/dom.ts","../src/use-loadable.ts"],"mappings":";;;;UA+aiB;EAChB;EACA;;iBA4De,OACf,aAAa,UACb,MAAM,SACN,UAAS,cACP;iBASa,QACf,aAAa,UACb,MAAM,SACN,UAAS,cACP;KCnfS,cAAc;EAAO;EAAkB,OAAO;;iBAE1C,YAAY,GAAG,GAC9B,OAAO,cAAc,SAAS,SAAS,KACrC,qBAAqB,cAAc,OAAO,IAAI;iBACjC,YAAY,GAAG,UAAU,WAAW,GACnD,OAAO,oBAAoB,SAAS,IAAI,GAAG,IAC3C,KAAK,QAAQ,KACX,qBAAqB,cAAc,OAAO,IAAI;iBACjC,YAAY,GAAG,GAC9B,OAAO,cAAc,SAAS,SAAS,IACvC,UAAU,QAAQ,KAChB,SAAS,cAAc,OAAO;EAAQ,QAAQ;;iBACjC,YAAY,GAAG,UAAU,WAAW,GACnD,OAAO,oBAAoB,SAAS,IAAI,GAAG,IAC3C,KAAK,QAAQ,IACb,UAAU,QAAQ,KAChB,SAAS,cAAc,OAAO;EAAQ,QAAQ"}
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-DUpa3Sj2.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,UAAU,QAAuB,UAA4B;CACrE,MAAM,UAAU,SACf,OAAO,CAAC,CACN,QAAQ,CAAC,CACT,MAAM,UAAU,OAAO,OAAO,OAAO,IAAI,CAAC;CAC7C,MAAM,OAAO,GAAU,SACtB,YAAY,SAAS,QAAQ,SAAS,UAAU,OAAO,IAAI,MAAM,KAAA;CAClE,OAAO,IAAI,MACV,CAAC,GACD;EACC;EACA,IAAI,GAAG,MAAM;GACZ,IAAI,YAAY,SAAS,OAAO,OAAO,SAAS;GAChD,MAAM,QAAQ,OAAO,IAAI;GACzB,OAAO,SAAS,QAAQ,IAAI,OAAO,IAAI;EACxC;EACA,UAAU;GACT,MAAM,OAAO,IAAI,IAAI,OAAO,CAAC,CAAC,QAAQ,OAAO,IAAI,CAAC;GAClD,IAAI,UAAU,SAAS,KAAK,IAAI,KAAK;QAChC,IAAI,UAAU,KAAK,OAAO,KAAK;GACpC,OAAO,CAAC,GAAG,IAAI;EAChB;EACA,yBAAyB,GAAG,MAAM;GACjC,IAAI,IAAI,GAAG,IAAI,GAAG,OAAO;IAAE,YAAY;IAAM,cAAc;GAAK;EACjE;CACD,CACD;AACD;;AAGA,SAAgB,MAAM,GAAG,SAA2C;CACnE,OAAO,gBACN,QAAQ,KACN,YAAY,OAAO,WAAW,aAAa,OAAO,IAAI,WAAW,CAAC,CACpE,CACD;AACD;;AAGA,SAAgB,cACf,MACA,KACQ;CACR,OAAO,gBAAgB,CAAC,KAAK,CAAC,GAAG;EAChC,OAAO;EACP,SAAS,QAAQ,KAAA,KAAa,OAAO,OAAO,KAAK,GAAG,KAAK;CAC1D,CAAC;AACF;;AChCA,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"}
@@ -1,8 +1,11 @@
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,k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;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-ByJswZtF.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,MAAM;CACf,MAAM,MAAM;CACZ,MAAM,MAAM;CACZ,OAAO,MAAM;CACb,MAAM,MAAM;CACZ,MAAM,MAAM;CACZ,aAAa,MAAM;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K;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,KAAK,UAAU,SAAS;EACxB,KAAK,UAAU,SAAS;CACzB;AACD;AACA,SAAS,WACR,MACA,OACA,UACO;CACP,KAAK,MAAM,uBAAO,IAAI,I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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. */
@@ -46,6 +46,8 @@ export interface MotionAttributes<Kind extends string = `dom`> {
46
46
  [`motion:layoutId`]?: Kind extends `dom` ? string | number : never;
47
47
  [`motion:layoutGroup`]?: Kind extends `dom` ? string | number : never;
48
48
  [`motion:layoutScroll`]?: Kind extends `dom` ? boolean : never;
49
+ /** Measure descendants relative to this instantly positioned layout ancestor. */
50
+ [`motion:layoutRoot`]?: Kind extends `dom` ? boolean : never;
49
51
  [`motion:layoutTransition`]?: Kind extends `dom` ? MotionLayoutTransition : never;
50
52
  [`motion:initial`]?: (Kind extends `dom` ? Partial<Record<keyof MotionDOMTarget, MotionScalar>> : MotionTarget<Kind>) | false;
51
53
  [`motion:animate`]?: MotionTarget<Kind>;
@@ -1 +1 @@
1
- {"version":3,"file":"motion.d.ts","names":[],"sources":["../src/motion.ts"],"mappings":";YAyBY,4BACX,qBACA,iBACG;YAEQ;;iBAaK;EAChB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,OAAO,wBAAwB;;iBAEf,yBAAyB;EACzC,UAAU;EACV,aAAa,SAAS,eAAe;;iBAErB;EAChB;EACA;EACA;EACA;EAMA;EACA;EACA;;YAGW;YACA,kBAAkB,QAC7B,aACS,0JAcR,eAAe;iBAGA;EAChB;EACA;EACA;EACA;EACA;EACA;;YAEW,aAAa,uBAAuB,qBAC7C,kBACA,uBACC,oBACA,eAAe;iBACF,iBAAiB;GAChC,mBAAmB;GACnB,qBAAqB;GACrB,wBAAwB;GACxB,yBAAyB;GACzB,6BAA6B,qBAC3B;GAEF,qBACG,qBACC,QAAQ,aAAa,iBAAiB,iBACtC,aAAa;GAEjB,oBAAoB,aAAa;GACjC,iBAAiB,aAAa;GAC9B,uBAAuB;GACvB,uBAAuB,aAAa;GACpC,qBAAqB,aAAa;;;YAMzB,qBACT,6BACS,iBAAiB;;iBAGX;;EAEhB;;EAEA,mBAAmB;;;wBAkaJ,iBACf,UAAS,0BACP"}
1
+ {"version":3,"file":"motion.d.ts","names":[],"sources":["../src/motion.ts"],"mappings":";YAyBY,4BACX,qBACA,iBACG;YAEQ;;iBAaK;EAChB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,OAAO,wBAAwB;;iBAEf,yBAAyB;EACzC,UAAU;EACV,aAAa,SAAS,eAAe;;iBAErB;EAChB;EACA;EACA;EACA;EAMA;EACA;EACA;;YAGW;YACA,kBAAkB,QAC7B,aACS,0JAcR,eAAe;iBAGA;EAChB;EACA;EACA;EACA;EACA;EACA;;YAEW,aAAa,uBAAuB,qBAC7C,kBACA,uBACC,oBACA,eAAe;iBACF,iBAAiB;GAChC,mBAAmB;GACnB,qBAAqB;GACrB,wBAAwB;GACxB,yBAAyB;;GAEzB,uBAAuB;GACvB,6BAA6B,qBAC3B;GAEF,qBACG,qBACC,QAAQ,aAAa,iBAAiB,iBACtC,aAAa;GAEjB,oBAAoB,aAAa;GACjC,iBAAiB,aAAa;GAC9B,uBAAuB;GACvB,uBAAuB,aAAa;GACpC,qBAAqB,aAAa;;;YAMzB,qBACT,6BACS,iBAAiB;;iBAGX;;EAEhB;;EAEA,mBAAmB;;;wBAmaJ,iBACf,UAAS,0BACP"}
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;
@@ -21,7 +21,7 @@ function createLayoutController(root, options) {
21
21
  const detach = entry.release;
22
22
  entry.release = void 0;
23
23
  entry.node = void 0;
24
- entry.refreshStyles = entry.captureStyles = void 0;
24
+ entry.beginStyles = entry.measureStyles = entry.endStyles = entry.captureStyles = void 0;
25
25
  detach?.();
26
26
  };
27
27
  const configure = (entry) => {
@@ -42,6 +42,7 @@ function createLayoutController(root, options) {
42
42
  }
43
43
  entry.node.setOptions({
44
44
  layoutScroll: entry.props.scroll ?? false,
45
+ layoutRoot: entry.props.root ?? false,
45
46
  animationType: typeof entry.props.animate === `string` ? entry.props.animate : `both`,
46
47
  animate: entry.props.animate !== false && !reduced(),
47
48
  transition: reduced() ? { duration: 0 } : transition
@@ -91,25 +92,26 @@ function createLayoutController(root, options) {
91
92
  let visibility = ``;
92
93
  let pointerEvents = ``;
93
94
  let transform = ``;
95
+ let rendered = ``;
94
96
  const transformTemplate = (_, projected) => `${projected === `none` ? `` : projected} ${transform}`.trim();
95
97
  entry.captureStyles = () => {
96
98
  style.cssText = element.style.cssText;
97
99
  };
98
- entry.refreshStyles = () => {
99
- const rendered = element.style.cssText;
100
+ entry.beginStyles = () => {
101
+ rendered = element.style.cssText;
100
102
  for (const name of styleNames) restore(name);
101
- try {
102
- const authored = getComputedStyle(element);
103
- opacity = authored.opacity || `1`;
104
- visibility = authored.visibility;
105
- pointerEvents = authored.pointerEvents;
106
- transform = authored.transform;
107
- if (!visual.values.has(`opacity`)) node.latestValues[`opacity`] = Number(opacity);
108
- const origin = authored.transformOrigin.split(` `);
109
- for (const [key, value] of [[`originX`, parseFloat(origin[0]) / (element.offsetWidth || 1)], [`originY`, parseFloat(origin[1]) / (element.offsetHeight || 1)]]) if (!visual.values.has(key) && Number.isFinite(value)) node.latestValues[key] = value;
110
- } finally {
111
- element.style.cssText = rendered;
112
- }
103
+ };
104
+ entry.measureStyles = () => {
105
+ const authored = getComputedStyle(element);
106
+ opacity = authored.opacity || `1`;
107
+ visibility = authored.visibility;
108
+ pointerEvents = authored.pointerEvents;
109
+ transform = authored.transform;
110
+ if (!visual.values.has(`opacity`)) node.latestValues[`opacity`] = Number(opacity);
111
+ const origin = authored.transformOrigin.split(` `);
112
+ const width = element.offsetWidth, height = element.offsetHeight;
113
+ entry.size = `${width}:${height}`;
114
+ for (const [key, value] of [[`originX`, parseFloat(origin[0]) / (width || 1)], [`originY`, parseFloat(origin[1]) / (height || 1)]]) if (!visual.values.has(key) && Number.isFinite(value)) node.latestValues[key] = value;
113
115
  const template = transform && transform !== `none` && !Object.keys(visual.latestValues).some((key) => /^(x|y|scale|rotate|skew)/.test(key)) ? transformTemplate : originalProps.transformTemplate;
114
116
  if (visual.getProps().transformTemplate !== template) {
115
117
  const next = { ...visual.getProps() };
@@ -118,6 +120,9 @@ function createLayoutController(root, options) {
118
120
  visual.update(next, null);
119
121
  }
120
122
  };
123
+ entry.endStyles = () => {
124
+ element.style.cssText = rendered;
125
+ };
121
126
  const applyProjectionStyles = node.applyProjectionStyles;
122
127
  node.applyProjectionStyles = (targetStyle, styleProp) => {
123
128
  applyProjectionStyles.call(node, targetStyle, {
@@ -155,14 +160,27 @@ function createLayoutController(root, options) {
155
160
  };
156
161
  observer?.observe(element);
157
162
  }
158
- entry.refreshStyles();
159
- configure(entry);
160
- entry.size = `${element.offsetWidth}:${element.offsetHeight}`;
163
+ };
164
+ const prepareAll = () => {
165
+ const active = ordered();
166
+ for (const entry of active) prepare(entry);
167
+ const begun = [];
168
+ try {
169
+ for (const entry of active) {
170
+ begun.push(entry);
171
+ entry.beginStyles();
172
+ }
173
+ for (const entry of active) entry.measureStyles();
174
+ } finally {
175
+ for (const entry of begun) entry.endStyles();
176
+ }
177
+ for (const entry of active) configure(entry);
178
+ return active;
161
179
  };
162
180
  const commit = () => {
163
181
  try {
164
182
  if (dead) return;
165
- for (const entry of ordered()) prepare(entry);
183
+ prepareAll();
166
184
  const roots = new Set([...entries].flatMap((entry) => entry.node ? [entry.node.root ?? entry.node] : []));
167
185
  for (const projection of roots) projection.didUpdate();
168
186
  for (const entry of entries) if (entry.dead) {
@@ -397,7 +415,6 @@ function animateTween(value, goal, transition, interrupted) {
397
415
  /** Optional coordinator: only imported by integrations that support retention. */
398
416
  function createPresence(root) {
399
417
  const releases = /* @__PURE__ */ new Map();
400
- const handlers = /* @__PURE__ */ new WeakMap();
401
418
  const groups = /* @__PURE__ */ new Map();
402
419
  const sessions = /* @__PURE__ */ new Set();
403
420
  const active = /* @__PURE__ */ new Map();
@@ -430,14 +447,6 @@ function createPresence(root) {
430
447
  for (let at = scope; at; at = at._parent) if (at === parent) return true;
431
448
  return false;
432
449
  };
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
450
  const finish = () => {
442
451
  for (const group of [...groups.values()]) {
443
452
  if (group.scope._dead || group.sessions.some((session) => !session.done)) continue;
@@ -446,7 +455,7 @@ function createPresence(root) {
446
455
  try {
447
456
  group.done();
448
457
  } catch (error) {
449
- report(error);
458
+ if (!root._dead) reportScopeError(group.scope, error);
450
459
  }
451
460
  }
452
461
  };
@@ -485,14 +494,6 @@ function createPresence(root) {
485
494
  unbind(binding) {
486
495
  releases.get(binding)?.();
487
496
  },
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
497
  collection(scopeOf, compatible) {
497
498
  let order = [];
498
499
  const exiting = /* @__PURE__ */ new Map();
@@ -561,7 +562,7 @@ function createPresence(root) {
561
562
  held.done = true;
562
563
  finish();
563
564
  }, (error) => {
564
- if (!held.cancelled) report(error);
565
+ if (!held.cancelled && !root._dead) reportScopeError(held.scope, error);
565
566
  });
566
567
  }
567
568
  collected.push(session);
@@ -632,6 +633,7 @@ const layoutKeys = {
632
633
  layoutId: `id`,
633
634
  layoutGroup: `group`,
634
635
  layoutScroll: `scroll`,
636
+ layoutRoot: `root`,
635
637
  layoutTransition: `transition`
636
638
  };
637
639
  function equal(a, b) {