@asyra/preset 0.5.0

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 (279) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +14 -0
  3. package/dist/catalog.d.ts +3 -0
  4. package/dist/catalog.d.ts.map +1 -0
  5. package/dist/catalog.js +61 -0
  6. package/dist/catalog.js.map +1 -0
  7. package/dist/cleanup-reporter.d.ts +6 -0
  8. package/dist/cleanup-reporter.d.ts.map +1 -0
  9. package/dist/cleanup-reporter.js +14 -0
  10. package/dist/cleanup-reporter.js.map +1 -0
  11. package/dist/components/fills.d.ts +28 -0
  12. package/dist/components/fills.d.ts.map +1 -0
  13. package/dist/components/fills.js +180 -0
  14. package/dist/components/fills.js.map +1 -0
  15. package/dist/components/frame.d.ts +4 -0
  16. package/dist/components/frame.d.ts.map +1 -0
  17. package/dist/components/frame.js +44 -0
  18. package/dist/components/frame.js.map +1 -0
  19. package/dist/components/group.d.ts +72 -0
  20. package/dist/components/group.d.ts.map +1 -0
  21. package/dist/components/group.js +491 -0
  22. package/dist/components/group.js.map +1 -0
  23. package/dist/components/index.d.ts +24 -0
  24. package/dist/components/index.d.ts.map +1 -0
  25. package/dist/components/index.js +65 -0
  26. package/dist/components/index.js.map +1 -0
  27. package/dist/components/oval.d.ts +4 -0
  28. package/dist/components/oval.d.ts.map +1 -0
  29. package/dist/components/oval.js +56 -0
  30. package/dist/components/oval.js.map +1 -0
  31. package/dist/components/rectangle.d.ts +4 -0
  32. package/dist/components/rectangle.d.ts.map +1 -0
  33. package/dist/components/rectangle.js +54 -0
  34. package/dist/components/rectangle.js.map +1 -0
  35. package/dist/components/shape-hit-area.d.ts +8 -0
  36. package/dist/components/shape-hit-area.d.ts.map +1 -0
  37. package/dist/components/shape-hit-area.js +30 -0
  38. package/dist/components/shape-hit-area.js.map +1 -0
  39. package/dist/components/stroke-defaults.d.ts +5 -0
  40. package/dist/components/stroke-defaults.d.ts.map +1 -0
  41. package/dist/components/stroke-defaults.js +4 -0
  42. package/dist/components/stroke-defaults.js.map +1 -0
  43. package/dist/components/vector.d.ts +7 -0
  44. package/dist/components/vector.d.ts.map +1 -0
  45. package/dist/components/vector.js +961 -0
  46. package/dist/components/vector.js.map +1 -0
  47. package/dist/composition/error.d.ts +16 -0
  48. package/dist/composition/error.d.ts.map +1 -0
  49. package/dist/composition/error.js +12 -0
  50. package/dist/composition/error.js.map +1 -0
  51. package/dist/composition/profile-provider.d.ts +7 -0
  52. package/dist/composition/profile-provider.d.ts.map +1 -0
  53. package/dist/composition/profile-provider.js +24 -0
  54. package/dist/composition/profile-provider.js.map +1 -0
  55. package/dist/composition/resolve.d.ts +11 -0
  56. package/dist/composition/resolve.d.ts.map +1 -0
  57. package/dist/composition/resolve.js +96 -0
  58. package/dist/composition/resolve.js.map +1 -0
  59. package/dist/composition/result.d.ts +3 -0
  60. package/dist/composition/result.d.ts.map +1 -0
  61. package/dist/composition/result.js +7 -0
  62. package/dist/composition/result.js.map +1 -0
  63. package/dist/constants.d.ts +30 -0
  64. package/dist/constants.d.ts.map +1 -0
  65. package/dist/constants.js +30 -0
  66. package/dist/constants.js.map +1 -0
  67. package/dist/defaults/install.d.ts +16 -0
  68. package/dist/defaults/install.d.ts.map +1 -0
  69. package/dist/defaults/install.js +51 -0
  70. package/dist/defaults/install.js.map +1 -0
  71. package/dist/defaults/installation.d.ts +14 -0
  72. package/dist/defaults/installation.d.ts.map +1 -0
  73. package/dist/defaults/installation.js +85 -0
  74. package/dist/defaults/installation.js.map +1 -0
  75. package/dist/defaults/modules/basic-shapes.d.ts +3 -0
  76. package/dist/defaults/modules/basic-shapes.d.ts.map +1 -0
  77. package/dist/defaults/modules/basic-shapes.js +9 -0
  78. package/dist/defaults/modules/basic-shapes.js.map +1 -0
  79. package/dist/defaults/modules/containers.d.ts +3 -0
  80. package/dist/defaults/modules/containers.d.ts.map +1 -0
  81. package/dist/defaults/modules/containers.js +9 -0
  82. package/dist/defaults/modules/containers.js.map +1 -0
  83. package/dist/defaults/modules/input.d.ts +3 -0
  84. package/dist/defaults/modules/input.d.ts.map +1 -0
  85. package/dist/defaults/modules/input.js +7 -0
  86. package/dist/defaults/modules/input.js.map +1 -0
  87. package/dist/defaults/modules/selection.d.ts +3 -0
  88. package/dist/defaults/modules/selection.d.ts.map +1 -0
  89. package/dist/defaults/modules/selection.js +20 -0
  90. package/dist/defaults/modules/selection.js.map +1 -0
  91. package/dist/defaults/modules/ui-context.d.ts +3 -0
  92. package/dist/defaults/modules/ui-context.d.ts.map +1 -0
  93. package/dist/defaults/modules/ui-context.js +9 -0
  94. package/dist/defaults/modules/ui-context.js.map +1 -0
  95. package/dist/defaults/modules/vector-editing.d.ts +3 -0
  96. package/dist/defaults/modules/vector-editing.d.ts.map +1 -0
  97. package/dist/defaults/modules/vector-editing.js +22 -0
  98. package/dist/defaults/modules/vector-editing.js.map +1 -0
  99. package/dist/defaults/modules/vector.d.ts +3 -0
  100. package/dist/defaults/modules/vector.d.ts.map +1 -0
  101. package/dist/defaults/modules/vector.js +9 -0
  102. package/dist/defaults/modules/vector.js.map +1 -0
  103. package/dist/defaults/modules/viewport.d.ts +3 -0
  104. package/dist/defaults/modules/viewport.d.ts.map +1 -0
  105. package/dist/defaults/modules/viewport.js +7 -0
  106. package/dist/defaults/modules/viewport.js.map +1 -0
  107. package/dist/defaults/owned-state.d.ts +3 -0
  108. package/dist/defaults/owned-state.d.ts.map +1 -0
  109. package/dist/defaults/owned-state.js +72 -0
  110. package/dist/defaults/owned-state.js.map +1 -0
  111. package/dist/defaults/private-manager.d.ts +3 -0
  112. package/dist/defaults/private-manager.d.ts.map +1 -0
  113. package/dist/defaults/private-manager.js +15 -0
  114. package/dist/defaults/private-manager.js.map +1 -0
  115. package/dist/defaults/types.d.ts +12 -0
  116. package/dist/defaults/types.d.ts.map +1 -0
  117. package/dist/defaults/types.js +2 -0
  118. package/dist/defaults/types.js.map +1 -0
  119. package/dist/events/index.d.ts +3 -0
  120. package/dist/events/index.d.ts.map +1 -0
  121. package/dist/events/index.js +3 -0
  122. package/dist/events/index.js.map +1 -0
  123. package/dist/events/input-events.d.ts +19 -0
  124. package/dist/events/input-events.d.ts.map +1 -0
  125. package/dist/events/input-events.js +18 -0
  126. package/dist/events/input-events.js.map +1 -0
  127. package/dist/events/preset-event-names.d.ts +136 -0
  128. package/dist/events/preset-event-names.d.ts.map +1 -0
  129. package/dist/events/preset-event-names.js +18 -0
  130. package/dist/events/preset-event-names.js.map +1 -0
  131. package/dist/events/register-events.d.ts +4 -0
  132. package/dist/events/register-events.d.ts.map +1 -0
  133. package/dist/events/register-events.js +30 -0
  134. package/dist/events/register-events.js.map +1 -0
  135. package/dist/index.d.ts +15 -0
  136. package/dist/index.d.ts.map +1 -0
  137. package/dist/index.js +13 -0
  138. package/dist/index.js.map +1 -0
  139. package/dist/preset.d.ts +3 -0
  140. package/dist/preset.d.ts.map +1 -0
  141. package/dist/preset.js +86 -0
  142. package/dist/preset.js.map +1 -0
  143. package/dist/props/components/anchor-point-component.d.ts +3 -0
  144. package/dist/props/components/anchor-point-component.d.ts.map +1 -0
  145. package/dist/props/components/anchor-point-component.js +6 -0
  146. package/dist/props/components/anchor-point-component.js.map +1 -0
  147. package/dist/props/components/anchor-points-component.d.ts +3 -0
  148. package/dist/props/components/anchor-points-component.d.ts.map +1 -0
  149. package/dist/props/components/anchor-points-component.js +43 -0
  150. package/dist/props/components/anchor-points-component.js.map +1 -0
  151. package/dist/props/components/children-map-property-component.d.ts +15 -0
  152. package/dist/props/components/children-map-property-component.d.ts.map +1 -0
  153. package/dist/props/components/children-map-property-component.js +205 -0
  154. package/dist/props/components/children-map-property-component.js.map +1 -0
  155. package/dist/props/components/custom-component.d.ts +3 -0
  156. package/dist/props/components/custom-component.d.ts.map +1 -0
  157. package/dist/props/components/custom-component.js +6 -0
  158. package/dist/props/components/custom-component.js.map +1 -0
  159. package/dist/props/components/dimension-component.d.ts +3 -0
  160. package/dist/props/components/dimension-component.d.ts.map +1 -0
  161. package/dist/props/components/dimension-component.js +6 -0
  162. package/dist/props/components/dimension-component.js.map +1 -0
  163. package/dist/props/components/fill-component.d.ts +3 -0
  164. package/dist/props/components/fill-component.d.ts.map +1 -0
  165. package/dist/props/components/fill-component.js +25 -0
  166. package/dist/props/components/fill-component.js.map +1 -0
  167. package/dist/props/components/fills-component.d.ts +3 -0
  168. package/dist/props/components/fills-component.d.ts.map +1 -0
  169. package/dist/props/components/fills-component.js +33 -0
  170. package/dist/props/components/fills-component.js.map +1 -0
  171. package/dist/props/components/index.d.ts +7 -0
  172. package/dist/props/components/index.d.ts.map +1 -0
  173. package/dist/props/components/index.js +51 -0
  174. package/dist/props/components/index.js.map +1 -0
  175. package/dist/props/components/number-value.d.ts +2 -0
  176. package/dist/props/components/number-value.d.ts.map +1 -0
  177. package/dist/props/components/number-value.js +2 -0
  178. package/dist/props/components/number-value.js.map +1 -0
  179. package/dist/props/components/position-component.d.ts +3 -0
  180. package/dist/props/components/position-component.d.ts.map +1 -0
  181. package/dist/props/components/position-component.js +6 -0
  182. package/dist/props/components/position-component.js.map +1 -0
  183. package/dist/props/components/stroke-component.d.ts +3 -0
  184. package/dist/props/components/stroke-component.d.ts.map +1 -0
  185. package/dist/props/components/stroke-component.js +29 -0
  186. package/dist/props/components/stroke-component.js.map +1 -0
  187. package/dist/props/components/strokes-component.d.ts +3 -0
  188. package/dist/props/components/strokes-component.d.ts.map +1 -0
  189. package/dist/props/components/strokes-component.js +44 -0
  190. package/dist/props/components/strokes-component.js.map +1 -0
  191. package/dist/props/components/vector-network-component.d.ts +3 -0
  192. package/dist/props/components/vector-network-component.d.ts.map +1 -0
  193. package/dist/props/components/vector-network-component.js +10 -0
  194. package/dist/props/components/vector-network-component.js.map +1 -0
  195. package/dist/props/components/vector-networks-component.d.ts +2 -0
  196. package/dist/props/components/vector-networks-component.d.ts.map +1 -0
  197. package/dist/props/components/vector-networks-component.js +28 -0
  198. package/dist/props/components/vector-networks-component.js.map +1 -0
  199. package/dist/props/components/vector-point-component.d.ts +3 -0
  200. package/dist/props/components/vector-point-component.d.ts.map +1 -0
  201. package/dist/props/components/vector-point-component.js +15 -0
  202. package/dist/props/components/vector-point-component.js.map +1 -0
  203. package/dist/props/components/vector-points-component.d.ts +2 -0
  204. package/dist/props/components/vector-points-component.d.ts.map +1 -0
  205. package/dist/props/components/vector-points-component.js +66 -0
  206. package/dist/props/components/vector-points-component.js.map +1 -0
  207. package/dist/props/components/vector-segment-component.d.ts +3 -0
  208. package/dist/props/components/vector-segment-component.d.ts.map +1 -0
  209. package/dist/props/components/vector-segment-component.js +11 -0
  210. package/dist/props/components/vector-segment-component.js.map +1 -0
  211. package/dist/props/components/vector-segments-component.d.ts +2 -0
  212. package/dist/props/components/vector-segments-component.d.ts.map +1 -0
  213. package/dist/props/components/vector-segments-component.js +25 -0
  214. package/dist/props/components/vector-segments-component.js.map +1 -0
  215. package/dist/props/register-property-schemas.d.ts +7 -0
  216. package/dist/props/register-property-schemas.d.ts.map +1 -0
  217. package/dist/props/register-property-schemas.js +475 -0
  218. package/dist/props/register-property-schemas.js.map +1 -0
  219. package/dist/registration.d.ts +6 -0
  220. package/dist/registration.d.ts.map +1 -0
  221. package/dist/registration.js +15 -0
  222. package/dist/registration.js.map +1 -0
  223. package/dist/render-layers/index.d.ts +3 -0
  224. package/dist/render-layers/index.d.ts.map +1 -0
  225. package/dist/render-layers/index.js +3 -0
  226. package/dist/render-layers/index.js.map +1 -0
  227. package/dist/render-layers/selection-overlay-render-layer.d.ts +15 -0
  228. package/dist/render-layers/selection-overlay-render-layer.d.ts.map +1 -0
  229. package/dist/render-layers/selection-overlay-render-layer.js +393 -0
  230. package/dist/render-layers/selection-overlay-render-layer.js.map +1 -0
  231. package/dist/render-layers/vector-path-editing-render-layer.d.ts +31 -0
  232. package/dist/render-layers/vector-path-editing-render-layer.d.ts.map +1 -0
  233. package/dist/render-layers/vector-path-editing-render-layer.js +815 -0
  234. package/dist/render-layers/vector-path-editing-render-layer.js.map +1 -0
  235. package/dist/selection/channels.d.ts +23 -0
  236. package/dist/selection/channels.d.ts.map +1 -0
  237. package/dist/selection/channels.js +25 -0
  238. package/dist/selection/channels.js.map +1 -0
  239. package/dist/selection/ids.d.ts +8 -0
  240. package/dist/selection/ids.d.ts.map +1 -0
  241. package/dist/selection/ids.js +49 -0
  242. package/dist/selection/ids.js.map +1 -0
  243. package/dist/selection/register-default-selections.d.ts +6 -0
  244. package/dist/selection/register-default-selections.d.ts.map +1 -0
  245. package/dist/selection/register-default-selections.js +52 -0
  246. package/dist/selection/register-default-selections.js.map +1 -0
  247. package/dist/subscriptions/data-channel.d.ts +12 -0
  248. package/dist/subscriptions/data-channel.d.ts.map +1 -0
  249. package/dist/subscriptions/data-channel.js +1366 -0
  250. package/dist/subscriptions/data-channel.js.map +1 -0
  251. package/dist/subscriptions/index.d.ts +4 -0
  252. package/dist/subscriptions/index.d.ts.map +1 -0
  253. package/dist/subscriptions/index.js +4 -0
  254. package/dist/subscriptions/index.js.map +1 -0
  255. package/dist/subscriptions/render-system.d.ts +3 -0
  256. package/dist/subscriptions/render-system.d.ts.map +1 -0
  257. package/dist/subscriptions/render-system.js +41 -0
  258. package/dist/subscriptions/render-system.js.map +1 -0
  259. package/dist/subscriptions/shared-channels.d.ts +7 -0
  260. package/dist/subscriptions/shared-channels.d.ts.map +1 -0
  261. package/dist/subscriptions/shared-channels.js +67 -0
  262. package/dist/subscriptions/shared-channels.js.map +1 -0
  263. package/dist/system-property-keys.d.ts +69 -0
  264. package/dist/system-property-keys.d.ts.map +1 -0
  265. package/dist/system-property-keys.js +44 -0
  266. package/dist/system-property-keys.js.map +1 -0
  267. package/dist/types.d.ts +32 -0
  268. package/dist/types.d.ts.map +1 -0
  269. package/dist/types.js +2 -0
  270. package/dist/types.js.map +1 -0
  271. package/dist/ui/register-properties.d.ts +12 -0
  272. package/dist/ui/register-properties.d.ts.map +1 -0
  273. package/dist/ui/register-properties.js +318 -0
  274. package/dist/ui/register-properties.js.map +1 -0
  275. package/dist/vector/synthetic-handle.d.ts +3 -0
  276. package/dist/vector/synthetic-handle.d.ts.map +1 -0
  277. package/dist/vector/synthetic-handle.js +38 -0
  278. package/dist/vector/synthetic-handle.js.map +1 -0
  279. package/package.json +55 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Asa Tsai
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,14 @@
1
+ # `@asyra/preset`
2
+
3
+ Optional official framework defaults, including the verified Preset 2D
4
+ composition. Apps may apply, replace, or omit these defaults.
5
+
6
+ ```ts
7
+ import { applyPreset } from '@asyra/preset'
8
+ ```
9
+
10
+ ## Release support
11
+
12
+ The `0.2.5` ESM artifact supports Node.js 24.x. Use only package-root exports.
13
+ Production 3D and HYBRID profiles are not available in this release. See the
14
+ [Framework release support contract](../../docs/ai/framework/RELEASE_SUPPORT.md).
@@ -0,0 +1,3 @@
1
+ import type { PresetCatalogContract } from './types.js';
2
+ export declare const PresetCatalog: PresetCatalogContract;
3
+ //# sourceMappingURL=catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,qBAAqB,EAGtB,MAAM,YAAY,CAAA;AAiEnB,eAAO,MAAM,aAAa,uBAAwC,CAAA"}
@@ -0,0 +1,61 @@
1
+ import { PresetDefaults, PresetProfiles } from './constants.js';
2
+ const profiles = [
3
+ {
4
+ id: PresetProfiles['2D'],
5
+ available: true,
6
+ presetEngineId: '@asyra/render-engine-pixi'
7
+ },
8
+ {
9
+ id: PresetProfiles['3D'],
10
+ available: false,
11
+ presetEngineId: null
12
+ },
13
+ {
14
+ id: PresetProfiles.HYBRID,
15
+ available: false,
16
+ presetEngineId: null
17
+ },
18
+ {
19
+ id: PresetProfiles.CUSTOM,
20
+ available: true,
21
+ presetEngineId: null
22
+ }
23
+ ];
24
+ const defaults = [
25
+ {
26
+ id: PresetDefaults.BASIC_SHAPES,
27
+ available: true,
28
+ requires: []
29
+ },
30
+ {
31
+ id: PresetDefaults.CONTAINERS,
32
+ available: true,
33
+ requires: []
34
+ },
35
+ { id: PresetDefaults.VECTOR, available: true, requires: [] },
36
+ { id: PresetDefaults.INPUT, available: true, requires: [] },
37
+ { id: PresetDefaults.SELECTION, available: true, requires: [] },
38
+ {
39
+ id: PresetDefaults.VECTOR_EDITING,
40
+ available: true,
41
+ requires: [PresetDefaults.VECTOR, PresetDefaults.SELECTION]
42
+ },
43
+ { id: PresetDefaults.VIEWPORT, available: true, requires: [] },
44
+ {
45
+ id: PresetDefaults.UI_CONTEXT,
46
+ available: true,
47
+ requires: [PresetDefaults.SELECTION]
48
+ }
49
+ ];
50
+ const freezeCatalog = (catalog) => {
51
+ catalog.profiles.forEach(Object.freeze);
52
+ catalog.defaults.forEach((entry) => {
53
+ Object.freeze(entry.requires);
54
+ Object.freeze(entry);
55
+ });
56
+ Object.freeze(catalog.profiles);
57
+ Object.freeze(catalog.defaults);
58
+ return Object.freeze(catalog);
59
+ };
60
+ export const PresetCatalog = freezeCatalog({ profiles, defaults });
61
+ //# sourceMappingURL=catalog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.js","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAO/D,MAAM,QAAQ,GAAyC;IACrD;QACE,EAAE,EAAE,cAAc,CAAC,IAAI,CAAC;QACxB,SAAS,EAAE,IAAI;QACf,cAAc,EAAE,2BAA2B;KAC5C;IACD;QACE,EAAE,EAAE,cAAc,CAAC,IAAI,CAAC;QACxB,SAAS,EAAE,KAAK;QAChB,cAAc,EAAE,IAAI;KACrB;IACD;QACE,EAAE,EAAE,cAAc,CAAC,MAAM;QACzB,SAAS,EAAE,KAAK;QAChB,cAAc,EAAE,IAAI;KACrB;IACD;QACE,EAAE,EAAE,cAAc,CAAC,MAAM;QACzB,SAAS,EAAE,IAAI;QACf,cAAc,EAAE,IAAI;KACrB;CACF,CAAA;AAED,MAAM,QAAQ,GAAyC;IACrD;QACE,EAAE,EAAE,cAAc,CAAC,YAAY;QAC/B,SAAS,EAAE,IAAI;QACf,QAAQ,EAAE,EAAE;KACb;IACD;QACE,EAAE,EAAE,cAAc,CAAC,UAAU;QAC7B,SAAS,EAAE,IAAI;QACf,QAAQ,EAAE,EAAE;KACb;IACD,EAAE,EAAE,EAAE,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC5D,EAAE,EAAE,EAAE,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC3D,EAAE,EAAE,EAAE,cAAc,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC/D;QACE,EAAE,EAAE,cAAc,CAAC,cAAc;QACjC,SAAS,EAAE,IAAI;QACf,QAAQ,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,cAAc,CAAC,SAAS,CAAC;KAC5D;IACD,EAAE,EAAE,EAAE,cAAc,CAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC9D;QACE,EAAE,EAAE,cAAc,CAAC,UAAU;QAC7B,SAAS,EAAE,IAAI;QACf,QAAQ,EAAE,CAAC,cAAc,CAAC,SAAS,CAAC;KACrC;CACF,CAAA;AAED,MAAM,aAAa,GAAG,CACpB,OAA8B,EACP,EAAE;IACzB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IACvC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;QACjC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;QAC7B,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IACtB,CAAC,CAAC,CAAA;IACF,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;IAC/B,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;IAC/B,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;AAC/B,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,aAAa,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAA"}
@@ -0,0 +1,6 @@
1
+ export interface CleanupReporter {
2
+ report(): void;
3
+ hasReported(): boolean;
4
+ }
5
+ export declare const createCleanupReporter: (onCleanupReady: ((dispose: () => void) => void) | undefined, dispose: () => void) => CleanupReporter;
6
+ //# sourceMappingURL=cleanup-reporter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cleanup-reporter.d.ts","sourceRoot":"","sources":["../src/cleanup-reporter.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,MAAM,IAAI,IAAI,CAAA;IACd,WAAW,IAAI,OAAO,CAAA;CACvB;AAED,eAAO,MAAM,qBAAqB,GAChC,gBAAgB,CAAC,CAAC,OAAO,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC,GAAG,SAAS,EAC3D,SAAS,MAAM,IAAI,KAClB,eAcF,CAAA"}
@@ -0,0 +1,14 @@
1
+ export const createCleanupReporter = (onCleanupReady, dispose) => {
2
+ let reported = false;
3
+ return {
4
+ report: () => {
5
+ if (reported || !onCleanupReady) {
6
+ return;
7
+ }
8
+ onCleanupReady(dispose);
9
+ reported = true;
10
+ },
11
+ hasReported: () => reported
12
+ };
13
+ };
14
+ //# sourceMappingURL=cleanup-reporter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cleanup-reporter.js","sourceRoot":"","sources":["../src/cleanup-reporter.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,cAA2D,EAC3D,OAAmB,EACF,EAAE;IACnB,IAAI,QAAQ,GAAG,KAAK,CAAA;IAEpB,OAAO;QACL,MAAM,EAAE,GAAG,EAAE;YACX,IAAI,QAAQ,IAAI,CAAC,cAAc,EAAE,CAAC;gBAChC,OAAM;YACR,CAAC;YAED,cAAc,CAAC,OAAO,CAAC,CAAA;YACvB,QAAQ,GAAG,IAAI,CAAA;QACjB,CAAC;QACD,WAAW,EAAE,GAAG,EAAE,CAAC,QAAQ;KAC5B,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,28 @@
1
+ import { type FillAttrs } from '@asyra/utils';
2
+ import { type RenderFillStyle } from '@asyra/core';
3
+ interface SolidRenderableFill {
4
+ kind: 'solid';
5
+ color: number;
6
+ alpha: number;
7
+ }
8
+ interface GradientRenderableFill {
9
+ kind: 'gradient';
10
+ style: RenderFillStyle;
11
+ }
12
+ type RenderableFill = SolidRenderableFill | GradientRenderableFill;
13
+ export declare const toRenderableGradient: (entry: FillAttrs) => RenderFillStyle | null;
14
+ export declare const getRenderableFills: (fills: unknown) => RenderableFill[];
15
+ export declare const getRenderableFill: (fills: unknown) => RenderableFill | null;
16
+ export declare const applyRenderableFill: (graphic: {
17
+ fill: unknown;
18
+ }, fills: unknown, options?: {
19
+ replayPath?: () => void;
20
+ order?: "forward" | "reverse";
21
+ }) => boolean;
22
+ export declare const fillColorToHex: (value: string) => string;
23
+ export declare const DEFAULT_RECTANGLE_FILLS: FillAttrs[];
24
+ export declare const DEFAULT_OVAL_FILLS: FillAttrs[];
25
+ export declare const DEFAULT_FRAME_FILLS: FillAttrs[];
26
+ export declare const DEFAULT_VECTOR_FILLS: FillAttrs[];
27
+ export {};
28
+ //# sourceMappingURL=fills.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fills.d.ts","sourceRoot":"","sources":["../../src/components/fills.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,SAAS,EAGf,MAAM,cAAc,CAAA;AACrB,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,aAAa,CAAA;AAEpB,UAAU,mBAAmB;IAC3B,IAAI,EAAE,OAAO,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd;AAED,UAAU,sBAAsB;IAC9B,IAAI,EAAE,UAAU,CAAA;IAChB,KAAK,EAAE,eAAe,CAAA;CACvB;AAED,KAAK,cAAc,GAAG,mBAAmB,GAAG,sBAAsB,CAAA;AA0BlE,eAAO,MAAM,oBAAoB,GAC/B,OAAO,SAAS,KACf,eAAe,GAAG,IAyGpB,CAAA;AAiCD,eAAO,MAAM,kBAAkB,GAAI,OAAO,OAAO,KAAG,cAAc,EAkBjE,CAAA;AAED,eAAO,MAAM,iBAAiB,GAAI,OAAO,OAAO,KAAG,cAAc,GAAG,IAGnE,CAAA;AAED,eAAO,MAAM,mBAAmB,GAC9B,SAAS;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,EAC1B,OAAO,OAAO,EACd,UAAU;IACR,UAAU,CAAC,EAAE,MAAM,IAAI,CAAA;IACvB,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;CAC9B,KACA,OAsCF,CAAA;AAED,eAAO,MAAM,cAAc,GAAI,OAAO,MAAM,KAAG,MAO9C,CAAA;AAED,eAAO,MAAM,uBAAuB,aAA2C,CAAA;AAC/E,eAAO,MAAM,kBAAkB,aAA2C,CAAA;AAC1E,eAAO,MAAM,mBAAmB,aAA2C,CAAA;AAC3E,eAAO,MAAM,oBAAoB,EAAE,SAAS,EAAO,CAAA"}
@@ -0,0 +1,180 @@
1
+ import { FillKinds, FillGradientTypes, clampOpacity, parseColor, rgbaToColorInt, rgbaToCssColor, rgbaToHex, createDefaultFills, createDefaultFill } from '@asyra/utils';
2
+ import { default as core } from '@asyra/core';
3
+ const normalizeFillEntry = (value) => {
4
+ if (!value || typeof value !== 'object' || Array.isArray(value)) {
5
+ return null;
6
+ }
7
+ return {
8
+ ...createDefaultFill(),
9
+ ...value
10
+ };
11
+ };
12
+ const sortGradientStops = (stops) => [...stops].sort((a, b) => a.position - b.position);
13
+ const toGradientStopColor = (color, opacity) => {
14
+ const parsed = parseColor(color);
15
+ if (!parsed) {
16
+ return null;
17
+ }
18
+ return rgbaToCssColor(parsed, parsed.a * opacity);
19
+ };
20
+ export const toRenderableGradient = (entry) => {
21
+ if (entry.kind !== FillKinds.GRADIENT || !entry.gradient) {
22
+ return null;
23
+ }
24
+ const stops = sortGradientStops(entry.gradient.gradientStops);
25
+ if (!stops.length) {
26
+ return null;
27
+ }
28
+ const colorStops = stops
29
+ .map((stop) => ({
30
+ offset: clampOpacity(stop.position),
31
+ color: toGradientStopColor(stop.color, stop.opacity * entry.opacity)
32
+ }))
33
+ .filter((stop) => stop.color !== null);
34
+ if (!colorStops.length) {
35
+ return null;
36
+ }
37
+ const [startHandle, endHandle] = entry.gradient.gradientHandles;
38
+ const start = startHandle ?? { x: 0, y: 0 };
39
+ const end = endHandle ?? { x: 1, y: 0 };
40
+ if (entry.gradient.gradientType === FillGradientTypes.RADIAL) {
41
+ const sideHandle = entry.gradient.gradientHandles[2] ?? null;
42
+ const radiusY = sideHandle !== null
43
+ ? Math.max(0.001, Math.sqrt((sideHandle.x - start.x) ** 2 + (sideHandle.y - start.y) ** 2))
44
+ : undefined;
45
+ const radialOptions = {
46
+ type: 'radial',
47
+ start,
48
+ end,
49
+ colorStops,
50
+ textureSpace: 'local',
51
+ ...(radiusY !== undefined ? { radiusY } : {})
52
+ };
53
+ return {
54
+ ...core.createRenderGradientFillStyle(radialOptions),
55
+ __gradientOptions: radialOptions
56
+ };
57
+ }
58
+ if (entry.gradient.gradientType === FillGradientTypes.ANGULAR) {
59
+ const angularOptions = {
60
+ type: 'angular',
61
+ start,
62
+ end,
63
+ colorStops,
64
+ textureSpace: 'local'
65
+ };
66
+ return {
67
+ ...core.createRenderGradientFillStyle(angularOptions),
68
+ __gradientOptions: angularOptions
69
+ };
70
+ }
71
+ if (entry.gradient.gradientType === FillGradientTypes.DIAMOND) {
72
+ const diamondOptions = {
73
+ type: 'diamond',
74
+ start,
75
+ end,
76
+ colorStops,
77
+ textureSpace: 'local'
78
+ };
79
+ return {
80
+ ...core.createRenderGradientFillStyle(diamondOptions),
81
+ __gradientOptions: diamondOptions
82
+ };
83
+ }
84
+ // Default: linear gradient
85
+ const linearOptions = {
86
+ type: 'linear',
87
+ start,
88
+ end,
89
+ colorStops,
90
+ textureSpace: 'local'
91
+ };
92
+ return {
93
+ ...core.createRenderGradientFillStyle(linearOptions),
94
+ __gradientOptions: linearOptions
95
+ };
96
+ };
97
+ const getRenderableFillFromEntry = (entry) => {
98
+ if (!entry.visible) {
99
+ return null;
100
+ }
101
+ if (entry.kind === FillKinds.GRADIENT && entry.gradient) {
102
+ const renderableGradient = toRenderableGradient(entry);
103
+ if (!renderableGradient) {
104
+ return null;
105
+ }
106
+ return {
107
+ kind: 'gradient',
108
+ style: renderableGradient
109
+ };
110
+ }
111
+ const parsed = parseColor(entry.color);
112
+ if (!parsed) {
113
+ return null;
114
+ }
115
+ return {
116
+ kind: 'solid',
117
+ color: rgbaToColorInt(parsed),
118
+ alpha: clampOpacity(parsed.a * entry.opacity)
119
+ };
120
+ };
121
+ export const getRenderableFills = (fills) => {
122
+ if (!Array.isArray(fills)) {
123
+ return [];
124
+ }
125
+ return fills.reduce((result, rawFill) => {
126
+ const fill = normalizeFillEntry(rawFill);
127
+ if (!fill) {
128
+ return result;
129
+ }
130
+ const renderableFill = getRenderableFillFromEntry(fill);
131
+ if (renderableFill) {
132
+ result.push(renderableFill);
133
+ }
134
+ return result;
135
+ }, []);
136
+ };
137
+ export const getRenderableFill = (fills) => {
138
+ const renderableFills = getRenderableFills(fills);
139
+ return renderableFills[0] ?? null;
140
+ };
141
+ export const applyRenderableFill = (graphic, fills, options) => {
142
+ const renderableFills = getRenderableFills(fills);
143
+ if (renderableFills.length === 0) {
144
+ return false;
145
+ }
146
+ const orderedFills = options?.order === 'reverse'
147
+ ? [...renderableFills].reverse()
148
+ : renderableFills;
149
+ const applyFill = (value) => graphic.fill.call(graphic, value);
150
+ orderedFills.forEach((renderableFill, index) => {
151
+ if (index > 0) {
152
+ options?.replayPath?.();
153
+ }
154
+ if (renderableFill.kind === 'gradient') {
155
+ applyFill(renderableFill.style);
156
+ return;
157
+ }
158
+ if (renderableFill.alpha >= 1) {
159
+ applyFill(renderableFill.color);
160
+ return;
161
+ }
162
+ applyFill({
163
+ color: renderableFill.color,
164
+ alpha: renderableFill.alpha
165
+ });
166
+ });
167
+ return true;
168
+ };
169
+ export const fillColorToHex = (value) => {
170
+ const parsed = parseColor(value);
171
+ if (!parsed) {
172
+ return '#000000';
173
+ }
174
+ return rgbaToHex(parsed);
175
+ };
176
+ export const DEFAULT_RECTANGLE_FILLS = createDefaultFills({ color: '#cccccc' });
177
+ export const DEFAULT_OVAL_FILLS = createDefaultFills({ color: '#cccccc' });
178
+ export const DEFAULT_FRAME_FILLS = createDefaultFills({ color: '#cccccc' });
179
+ export const DEFAULT_VECTOR_FILLS = [];
180
+ //# sourceMappingURL=fills.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fills.js","sourceRoot":"","sources":["../../src/components/fills.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,iBAAiB,EACjB,YAAY,EACZ,UAAU,EACV,cAAc,EACd,cAAc,EACd,SAAS,EAET,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,OAAO,IAAI,IAAI,EAGhB,MAAM,aAAa,CAAA;AAepB,MAAM,kBAAkB,GAAG,CAAC,KAAc,EAAoB,EAAE;IAC9D,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAChE,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO;QACL,GAAG,iBAAiB,EAAE;QACtB,GAAI,KAA4B;KACjC,CAAA;AACH,CAAC,CAAA;AAED,MAAM,iBAAiB,GAAG,CACxB,KAA0D,EAC1D,EAAE,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAA;AAEvD,MAAM,mBAAmB,GAAG,CAAC,KAAa,EAAE,OAAe,EAAiB,EAAE;IAC5E,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,CAAA;IAChC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC,CAAA;AACnD,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,KAAgB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,EAAE,CAAC;YACvC,SAAS,CAAC,cAAc,CAAC,KAAK,CAAC,CAAA;YAC/B,OAAM;QACR,CAAC;QAED,IAAI,cAAc,CAAC,KAAK,IAAI,CAAC,EAAE,CAAC;YAC9B,SAAS,CAAC,cAAc,CAAC,KAAK,CAAC,CAAA;YAC/B,OAAM;QACR,CAAC;QAED,SAAS,CAAC;YACR,KAAK,EAAE,cAAc,CAAC,KAAK;YAC3B,KAAK,EAAE,cAAc,CAAC,KAAK;SAC5B,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IACF,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAa,EAAU,EAAE;IACtD,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,CAAA;IAChC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,OAAO,SAAS,CAAC,MAAM,CAAC,CAAA;AAC1B,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,uBAAuB,GAAG,kBAAkB,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAA;AAC/E,MAAM,CAAC,MAAM,kBAAkB,GAAG,kBAAkB,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAA;AAC1E,MAAM,CAAC,MAAM,mBAAmB,GAAG,kBAAkB,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAA;AAC3E,MAAM,CAAC,MAAM,oBAAoB,GAAgB,EAAE,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { ComponentDefinition, RenderStrategy } from '@asyra/core';
2
+ export declare const FRAME_COMPONENT_DEFINITION: ComponentDefinition;
3
+ export declare const FRAME_RENDER_STRATEGY: RenderStrategy;
4
+ //# sourceMappingURL=frame.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frame.d.ts","sourceRoot":"","sources":["../../src/components/frame.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAStE,eAAO,MAAM,0BAA0B,EAAE,mBAuBxC,CAAA;AAED,eAAO,MAAM,qBAAqB,EAAE,cAkBnC,CAAA"}
@@ -0,0 +1,44 @@
1
+ import { EntityTypes, PropertyTypes, setElementGeometryLocalBounds } from '@asyra/utils';
2
+ import { applyRenderableFill, DEFAULT_FRAME_FILLS } from './fills.js';
3
+ import { PRESET_REGISTRATION } from '../registration.js';
4
+ export const FRAME_COMPONENT_DEFINITION = {
5
+ type: EntityTypes.FRAME,
6
+ idPrefix: 'fr',
7
+ namePrefix: 'Frame',
8
+ registration: PRESET_REGISTRATION,
9
+ isContainer: true,
10
+ properties: [
11
+ {
12
+ name: PropertyTypes.POSITION,
13
+ type: PropertyTypes.POSITION,
14
+ alias: ['x', 'y', 'rotation']
15
+ },
16
+ {
17
+ name: PropertyTypes.DIMENSION,
18
+ type: PropertyTypes.DIMENSION,
19
+ alias: ['width', 'height']
20
+ },
21
+ {
22
+ name: 'fills',
23
+ type: PropertyTypes.FILLS,
24
+ defaultValue: DEFAULT_FRAME_FILLS
25
+ }
26
+ ]
27
+ };
28
+ export const FRAME_RENDER_STRATEGY = (graphic, data) => {
29
+ graphic.clear();
30
+ setElementGeometryLocalBounds(graphic, {
31
+ x: 0,
32
+ y: 0,
33
+ width: data.width,
34
+ height: data.height
35
+ });
36
+ const replayPath = () => {
37
+ graphic.rect(0, 0, data.width, data.height);
38
+ };
39
+ replayPath();
40
+ applyRenderableFill(graphic, data.fills, { replayPath });
41
+ graphic.x = data.x;
42
+ graphic.y = data.y;
43
+ };
44
+ //# sourceMappingURL=frame.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frame.js","sourceRoot":"","sources":["../../src/components/frame.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,aAAa,EACb,6BAA6B,EAC9B,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,mB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CAAA;IACxD,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAA;IAClB,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAA;AACpB,CAAC,CAAA"}
@@ -0,0 +1,72 @@
1
+ import { type ComponentDefinition, type ElementPropertyValuesUpdate, type RenderStrategy } from '@asyra/core';
2
+ import { type EVENT_OPTIONS, type MoveHierarchyRequest, type MoveHierarchyResult, type RemoveSubtreeResult, type SceneTreeRawData } from '@asyra/utils';
3
+ export declare const GROUP_COMPONENT_DEFINITION: ComponentDefinition;
4
+ export declare const GROUP_RENDER_STRATEGY: RenderStrategy;
5
+ export interface GroupHierarchyReadCore {
6
+ sceneTreeSaveData: () => SceneTreeRawData;
7
+ }
8
+ export interface GroupGeometryProjectionCore extends GroupHierarchyReadCore {
9
+ getElementComputedData: (elementId: string) => Record<string, unknown> | undefined;
10
+ }
11
+ export interface GroupOperationCore extends GroupGeometryProjectionCore {
12
+ createElementInParent: (data: {
13
+ type: string;
14
+ x: number;
15
+ y: number;
16
+ width: number;
17
+ height: number;
18
+ }, parentId: string, index?: number, options?: EVENT_OPTIONS) => string;
19
+ moveElements: (request: MoveHierarchyRequest, options?: EVENT_OPTIONS) => MoveHierarchyResult;
20
+ updateElementProperties: (updates: readonly ElementPropertyValuesUpdate[], options?: EVENT_OPTIONS) => readonly string[];
21
+ removeSubtree: (elementId: string, options?: EVENT_OPTIONS) => RemoveSubtreeResult;
22
+ }
23
+ export interface PreparedGroupOperation {
24
+ readonly kind: 'group';
25
+ readonly parentId: string;
26
+ readonly groupIndex: number;
27
+ readonly elementIds: readonly string[];
28
+ }
29
+ export interface PreparedUngroupOperation {
30
+ readonly kind: 'ungroup';
31
+ readonly groupId: string;
32
+ readonly parentId: string;
33
+ readonly groupIndex: number;
34
+ readonly elementIds: readonly string[];
35
+ }
36
+ export interface GroupBounds {
37
+ readonly x: number;
38
+ readonly y: number;
39
+ readonly width: number;
40
+ readonly height: number;
41
+ }
42
+ export interface GroupOperationResult {
43
+ readonly groupId: string;
44
+ readonly elementIds: readonly string[];
45
+ readonly bounds: GroupBounds;
46
+ }
47
+ export interface UngroupOperationResult {
48
+ readonly groupId: string;
49
+ readonly elementIds: readonly string[];
50
+ readonly removed: true;
51
+ }
52
+ export interface NormalizedGroupBounds {
53
+ readonly groupId: string;
54
+ readonly bounds: GroupBounds;
55
+ }
56
+ interface ElementRectangle {
57
+ readonly id: string;
58
+ readonly x: number;
59
+ readonly y: number;
60
+ readonly width: number;
61
+ readonly height: number;
62
+ }
63
+ export declare const projectGroupGeometryPropertyUpdates: (core: GroupGeometryProjectionCore, initialUpdates: readonly ElementPropertyValuesUpdate[], explicitGroupElementIds?: readonly string[]) => readonly ElementPropertyValuesUpdate[];
64
+ export declare const deriveGroupBounds: (rectangles: readonly Pick<ElementRectangle, "x" | "y" | "width" | "height">[]) => GroupBounds;
65
+ export declare const prepareGroupOperation: (core: GroupHierarchyReadCore, elementIds: readonly string[]) => PreparedGroupOperation;
66
+ export declare const prepareUngroupOperation: (core: GroupHierarchyReadCore, groupId: string) => PreparedUngroupOperation;
67
+ export declare const groupElements: (core: GroupOperationCore, elementIds: readonly string[], options?: EVENT_OPTIONS) => GroupOperationResult;
68
+ export declare const ungroupElement: (core: GroupOperationCore, groupId: string, options?: EVENT_OPTIONS) => UngroupOperationResult;
69
+ export declare const normalizeGroupsForElements: (core: GroupOperationCore, elementIds: readonly string[], options?: EVENT_OPTIONS) => readonly NormalizedGroupBounds[];
70
+ export declare const moveElementsWithGroupGeometry: (core: GroupOperationCore, request: MoveHierarchyRequest, options?: EVENT_OPTIONS) => MoveHierarchyResult;
71
+ export {};
72
+ //# sourceMappingURL=group.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"group.d.ts","sourceRoot":"","sources":["../../src/components/group.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,2BAA2B,EAChC,KAAK,cAAc,EACpB,MAAM,aAAa,CAAA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