@avis-studio/engine 0.0.0-stage → 0.1.0-beta.1

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 (424) hide show
  1. package/README.md +193 -2
  2. package/THIRD_PARTY_NOTICES.md +29 -0
  3. package/dist/a11y/focus.d.ts +60 -0
  4. package/dist/a11y/focus.js +222 -0
  5. package/dist/a11y/index.d.ts +2 -0
  6. package/dist/a11y/index.js +4 -0
  7. package/dist/a11y/semantics.d.ts +37 -0
  8. package/dist/a11y/semantics.js +88 -0
  9. package/dist/commands/builtins.d.ts +88 -0
  10. package/dist/commands/builtins.js +362 -0
  11. package/dist/commands/command.d.ts +23 -0
  12. package/dist/commands/command.js +20 -0
  13. package/dist/commands/draft.d.ts +33 -0
  14. package/dist/commands/draft.js +96 -0
  15. package/dist/commands/history.d.ts +34 -0
  16. package/dist/commands/history.js +80 -0
  17. package/dist/commands/index.d.ts +6 -0
  18. package/dist/commands/index.js +6 -0
  19. package/dist/commands/patch.d.ts +24 -0
  20. package/dist/commands/patch.js +44 -0
  21. package/dist/commands/transaction.d.ts +16 -0
  22. package/dist/commands/transaction.js +39 -0
  23. package/dist/core/diagnostics.d.ts +23 -0
  24. package/dist/core/diagnostics.js +23 -0
  25. package/dist/core/disposable.d.ts +14 -0
  26. package/dist/core/disposable.js +51 -0
  27. package/dist/core/engine.d.ts +108 -0
  28. package/dist/core/engine.js +323 -0
  29. package/dist/core/event-bus.d.ts +10 -0
  30. package/dist/core/event-bus.js +33 -0
  31. package/dist/core/ids.d.ts +13 -0
  32. package/dist/core/ids.js +6 -0
  33. package/dist/core/index.d.ts +7 -0
  34. package/dist/core/index.js +7 -0
  35. package/dist/core/plugin.d.ts +20 -0
  36. package/dist/core/plugin.js +47 -0
  37. package/dist/core/services.d.ts +14 -0
  38. package/dist/core/services.js +20 -0
  39. package/dist/devtools/index.d.ts +1 -0
  40. package/dist/devtools/index.js +2 -0
  41. package/dist/devtools/panel.d.ts +39 -0
  42. package/dist/devtools/panel.js +100 -0
  43. package/dist/dom/a11y-layer.d.ts +32 -0
  44. package/dist/dom/a11y-layer.js +358 -0
  45. package/dist/dom/anchor.d.ts +34 -0
  46. package/dist/dom/anchor.js +35 -0
  47. package/dist/dom/index.d.ts +6 -0
  48. package/dist/dom/index.js +8 -0
  49. package/dist/dom/menu.d.ts +24 -0
  50. package/dist/dom/menu.js +122 -0
  51. package/dist/dom/overlays.d.ts +29 -0
  52. package/dist/dom/overlays.js +82 -0
  53. package/dist/dom/paint/collect.d.ts +8 -0
  54. package/dist/dom/paint/collect.js +589 -0
  55. package/dist/dom/paint/css.d.ts +86 -0
  56. package/dist/dom/paint/css.js +526 -0
  57. package/dist/dom/paint/draw.d.ts +16 -0
  58. package/dist/dom/paint/draw.js +413 -0
  59. package/dist/dom/paint/ghost.d.ts +2 -0
  60. package/dist/dom/paint/ghost.js +8 -0
  61. package/dist/dom/paint/index.d.ts +6 -0
  62. package/dist/dom/paint/index.js +9 -0
  63. package/dist/dom/paint/text.d.ts +26 -0
  64. package/dist/dom/paint/text.js +209 -0
  65. package/dist/dom/paint/types.d.ts +174 -0
  66. package/dist/dom/paint/types.js +7 -0
  67. package/dist/dom/paint/watch.d.ts +10 -0
  68. package/dist/dom/paint/watch.js +109 -0
  69. package/dist/dom/position.d.ts +37 -0
  70. package/dist/dom/position.js +125 -0
  71. package/dist/dom/text-editor.d.ts +27 -0
  72. package/dist/dom/text-editor.js +128 -0
  73. package/dist/events/event.d.ts +122 -0
  74. package/dist/events/event.js +130 -0
  75. package/dist/events/eventer.d.ts +24 -0
  76. package/dist/events/eventer.js +83 -0
  77. package/dist/events/index.d.ts +3 -0
  78. package/dist/events/index.js +3 -0
  79. package/dist/events/interaction.d.ts +43 -0
  80. package/dist/events/interaction.js +203 -0
  81. package/dist/geometry/anchors.d.ts +14 -0
  82. package/dist/geometry/anchors.js +13 -0
  83. package/dist/geometry/bounds.d.ts +16 -0
  84. package/dist/geometry/bounds.js +42 -0
  85. package/dist/geometry/curves.d.ts +39 -0
  86. package/dist/geometry/curves.js +68 -0
  87. package/dist/geometry/index.d.ts +6 -0
  88. package/dist/geometry/index.js +6 -0
  89. package/dist/geometry/matrix.d.ts +22 -0
  90. package/dist/geometry/matrix.js +56 -0
  91. package/dist/geometry/spaces.d.ts +22 -0
  92. package/dist/geometry/spaces.js +28 -0
  93. package/dist/geometry/vec2.d.ts +12 -0
  94. package/dist/geometry/vec2.js +10 -0
  95. package/dist/index.d.ts +16 -0
  96. package/dist/index.js +22 -0
  97. package/dist/interaction/behaviors.d.ts +10 -0
  98. package/dist/interaction/behaviors.js +744 -0
  99. package/dist/interaction/controller.d.ts +180 -0
  100. package/dist/interaction/controller.js +269 -0
  101. package/dist/interaction/hit-test.d.ts +45 -0
  102. package/dist/interaction/hit-test.js +119 -0
  103. package/dist/interaction/index.d.ts +4 -0
  104. package/dist/interaction/index.js +7 -0
  105. package/dist/interaction/web-input.d.ts +13 -0
  106. package/dist/interaction/web-input.js +172 -0
  107. package/dist/layout/index.d.ts +1 -0
  108. package/dist/layout/index.js +2 -0
  109. package/dist/layout/layout.d.ts +27 -0
  110. package/dist/layout/layout.js +266 -0
  111. package/dist/react/canvas/graph.d.ts +83 -0
  112. package/dist/react/canvas/graph.js +89 -0
  113. package/dist/react/canvas/hooks.d.ts +42 -0
  114. package/dist/react/canvas/hooks.js +78 -0
  115. package/dist/react/canvas/index.d.ts +35 -0
  116. package/dist/react/canvas/index.js +8 -0
  117. package/dist/react/components.d.ts +55 -0
  118. package/dist/react/components.js +197 -0
  119. package/dist/react/context.d.ts +4 -0
  120. package/dist/react/context.js +9 -0
  121. package/dist/react/flow/api/LICENSE +21 -0
  122. package/dist/react/flow/api/externals.d.ts +12 -0
  123. package/dist/react/flow/api/react/additional-components/Background/Background.d.ts +7 -0
  124. package/dist/react/flow/api/react/additional-components/Background/Patterns.d.ts +17 -0
  125. package/dist/react/flow/api/react/additional-components/Background/index.d.ts +2 -0
  126. package/dist/react/flow/api/react/additional-components/Background/types.d.ts +25 -0
  127. package/dist/react/flow/api/react/additional-components/Controls/ControlButton.d.ts +2 -0
  128. package/dist/react/flow/api/react/additional-components/Controls/Controls.d.ts +7 -0
  129. package/dist/react/flow/api/react/additional-components/Controls/Icons/FitView.d.ts +1 -0
  130. package/dist/react/flow/api/react/additional-components/Controls/Icons/Lock.d.ts +1 -0
  131. package/dist/react/flow/api/react/additional-components/Controls/Icons/Minus.d.ts +1 -0
  132. package/dist/react/flow/api/react/additional-components/Controls/Icons/Plus.d.ts +1 -0
  133. package/dist/react/flow/api/react/additional-components/Controls/Icons/Unlock.d.ts +1 -0
  134. package/dist/react/flow/api/react/additional-components/Controls/index.d.ts +3 -0
  135. package/dist/react/flow/api/react/additional-components/Controls/types.d.ts +20 -0
  136. package/dist/react/flow/api/react/additional-components/EdgeToolbar/EdgeToolbar.d.ts +2 -0
  137. package/dist/react/flow/api/react/additional-components/EdgeToolbar/index.d.ts +2 -0
  138. package/dist/react/flow/api/react/additional-components/EdgeToolbar/types.d.ts +6 -0
  139. package/dist/react/flow/api/react/additional-components/MiniMap/MiniMap.d.ts +8 -0
  140. package/dist/react/flow/api/react/additional-components/MiniMap/MiniMapNode.d.ts +4 -0
  141. package/dist/react/flow/api/react/additional-components/MiniMap/MiniMapNodes.d.ts +5 -0
  142. package/dist/react/flow/api/react/additional-components/MiniMap/index.d.ts +3 -0
  143. package/dist/react/flow/api/react/additional-components/MiniMap/types.d.ts +44 -0
  144. package/dist/react/flow/api/react/additional-components/NodeResizer/NodeResizeControl.d.ts +5 -0
  145. package/dist/react/flow/api/react/additional-components/NodeResizer/NodeResizer.d.ts +2 -0
  146. package/dist/react/flow/api/react/additional-components/NodeResizer/index.d.ts +3 -0
  147. package/dist/react/flow/api/react/additional-components/NodeResizer/types.d.ts +32 -0
  148. package/dist/react/flow/api/react/additional-components/NodeToolbar/NodeToolbar.d.ts +2 -0
  149. package/dist/react/flow/api/react/additional-components/NodeToolbar/NodeToolbarPortal.d.ts +4 -0
  150. package/dist/react/flow/api/react/additional-components/NodeToolbar/index.d.ts +2 -0
  151. package/dist/react/flow/api/react/additional-components/NodeToolbar/types.d.ts +9 -0
  152. package/dist/react/flow/api/react/additional-components/index.d.ts +6 -0
  153. package/dist/react/flow/api/react/components/A11yDescriptions/index.d.ts +7 -0
  154. package/dist/react/flow/api/react/components/Attribution/index.d.ts +8 -0
  155. package/dist/react/flow/api/react/components/BatchProvider/index.d.ts +10 -0
  156. package/dist/react/flow/api/react/components/BatchProvider/types.d.ts +6 -0
  157. package/dist/react/flow/api/react/components/BatchProvider/useQueue.d.ts +2 -0
  158. package/dist/react/flow/api/react/components/ConnectionLine/index.d.ts +11 -0
  159. package/dist/react/flow/api/react/components/EdgeLabelRenderer/index.d.ts +5 -0
  160. package/dist/react/flow/api/react/components/EdgeWrapper/EdgeUpdateAnchors.d.ts +14 -0
  161. package/dist/react/flow/api/react/components/EdgeWrapper/index.d.ts +5 -0
  162. package/dist/react/flow/api/react/components/EdgeWrapper/utils.d.ts +11 -0
  163. package/dist/react/flow/api/react/components/Edges/BaseEdge.d.ts +2 -0
  164. package/dist/react/flow/api/react/components/Edges/BezierEdge.d.ts +4 -0
  165. package/dist/react/flow/api/react/components/Edges/EdgeAnchor.d.ts +13 -0
  166. package/dist/react/flow/api/react/components/Edges/EdgeText.d.ts +7 -0
  167. package/dist/react/flow/api/react/components/Edges/SimpleBezierEdge.d.ts +20 -0
  168. package/dist/react/flow/api/react/components/Edges/SmoothStepEdge.d.ts +4 -0
  169. package/dist/react/flow/api/react/components/Edges/StepEdge.d.ts +4 -0
  170. package/dist/react/flow/api/react/components/Edges/StraightEdge.d.ts +4 -0
  171. package/dist/react/flow/api/react/components/Edges/index.d.ts +5 -0
  172. package/dist/react/flow/api/react/components/Handle/index.d.ts +8 -0
  173. package/dist/react/flow/api/react/components/NodeWrapper/index.d.ts +4 -0
  174. package/dist/react/flow/api/react/components/NodeWrapper/useNodeObserver.d.ts +7 -0
  175. package/dist/react/flow/api/react/components/NodeWrapper/utils.d.ts +8 -0
  176. package/dist/react/flow/api/react/components/Nodes/DefaultNode.d.ts +2 -0
  177. package/dist/react/flow/api/react/components/Nodes/GroupNode.d.ts +1 -0
  178. package/dist/react/flow/api/react/components/Nodes/InputNode.d.ts +2 -0
  179. package/dist/react/flow/api/react/components/Nodes/OutputNode.d.ts +2 -0
  180. package/dist/react/flow/api/react/components/Nodes/utils.d.ts +12 -0
  181. package/dist/react/flow/api/react/components/NodesSelection/index.d.ts +8 -0
  182. package/dist/react/flow/api/react/components/Panel/index.d.ts +8 -0
  183. package/dist/react/flow/api/react/components/ReactFlowProvider/index.d.ts +20 -0
  184. package/dist/react/flow/api/react/components/SelectionListener/index.d.ts +6 -0
  185. package/dist/react/flow/api/react/components/StoreUpdater/index.d.ts +67 -0
  186. package/dist/react/flow/api/react/components/UserSelection/index.d.ts +1 -0
  187. package/dist/react/flow/api/react/components/ViewportPortal/index.d.ts +4 -0
  188. package/dist/react/flow/api/react/container/EdgeRenderer/MarkerDefinitions.d.ts +9 -0
  189. package/dist/react/flow/api/react/container/EdgeRenderer/MarkerSymbols.d.ts +8 -0
  190. package/dist/react/flow/api/react/container/EdgeRenderer/index.d.ts +12 -0
  191. package/dist/react/flow/api/react/container/FlowRenderer/index.d.ts +13 -0
  192. package/dist/react/flow/api/react/container/GraphView/index.d.ts +10 -0
  193. package/dist/react/flow/api/react/container/GraphView/useNodeOrEdgeTypesWarning.d.ts +3 -0
  194. package/dist/react/flow/api/react/container/GraphView/useStylesLoadedWarning.d.ts +1 -0
  195. package/dist/react/flow/api/react/container/NodeRenderer/index.d.ts +9 -0
  196. package/dist/react/flow/api/react/container/NodeRenderer/useResizeObserver.d.ts +1 -0
  197. package/dist/react/flow/api/react/container/Pane/index.d.ts +10 -0
  198. package/dist/react/flow/api/react/container/ReactFlow/Wrapper.d.ts +19 -0
  199. package/dist/react/flow/api/react/container/ReactFlow/index.d.ts +3 -0
  200. package/dist/react/flow/api/react/container/ReactFlow/init-values.d.ts +3 -0
  201. package/dist/react/flow/api/react/container/Viewport/index.d.ts +6 -0
  202. package/dist/react/flow/api/react/container/ZoomPane/index.d.ts +7 -0
  203. package/dist/react/flow/api/react/contexts/HandleConfigContext.d.ts +11 -0
  204. package/dist/react/flow/api/react/contexts/NodeIdContext.d.ts +5 -0
  205. package/dist/react/flow/api/react/contexts/StoreContext.d.ts +3 -0
  206. package/dist/react/flow/api/react/hooks/useColorModeClass.d.ts +2 -0
  207. package/dist/react/flow/api/react/hooks/useConnection.d.ts +3 -0
  208. package/dist/react/flow/api/react/hooks/useDrag.d.ts +12 -0
  209. package/dist/react/flow/api/react/hooks/useEdges.d.ts +2 -0
  210. package/dist/react/flow/api/react/hooks/useGlobalKeyHandler.d.ts +5 -0
  211. package/dist/react/flow/api/react/hooks/useHandleConnections.d.ts +10 -0
  212. package/dist/react/flow/api/react/hooks/useInternalNode.d.ts +2 -0
  213. package/dist/react/flow/api/react/hooks/useIsomorphicLayoutEffect.d.ts +2 -0
  214. package/dist/react/flow/api/react/hooks/useKeyPress.d.ts +7 -0
  215. package/dist/react/flow/api/react/hooks/useMoveSelectedNodes.d.ts +5 -0
  216. package/dist/react/flow/api/react/hooks/useNodeConnections.d.ts +2 -0
  217. package/dist/react/flow/api/react/hooks/useNodes.d.ts +2 -0
  218. package/dist/react/flow/api/react/hooks/useNodesData.d.ts +4 -0
  219. package/dist/react/flow/api/react/hooks/useNodesEdgesState.d.ts +12 -0
  220. package/dist/react/flow/api/react/hooks/useNodesInitialized.d.ts +4 -0
  221. package/dist/react/flow/api/react/hooks/useOnEdgesChangeMiddleware.d.ts +3 -0
  222. package/dist/react/flow/api/react/hooks/useOnInitHandler.d.ts +2 -0
  223. package/dist/react/flow/api/react/hooks/useOnNodesChangeMiddleware.d.ts +3 -0
  224. package/dist/react/flow/api/react/hooks/useOnSelectionChange.d.ts +5 -0
  225. package/dist/react/flow/api/react/hooks/useOnViewportChange.d.ts +7 -0
  226. package/dist/react/flow/api/react/hooks/useReactFlow.d.ts +2 -0
  227. package/dist/react/flow/api/react/hooks/useResizeHandler.d.ts +2 -0
  228. package/dist/react/flow/api/react/hooks/useStore.d.ts +8 -0
  229. package/dist/react/flow/api/react/hooks/useUpdateNodeInternals.d.ts +2 -0
  230. package/dist/react/flow/api/react/hooks/useViewport.d.ts +2 -0
  231. package/dist/react/flow/api/react/hooks/useViewportHelper.d.ts +3 -0
  232. package/dist/react/flow/api/react/hooks/useViewportSync.d.ts +2 -0
  233. package/dist/react/flow/api/react/hooks/useVisibleEdgeIds.d.ts +1 -0
  234. package/dist/react/flow/api/react/hooks/useVisibleNodeIds.d.ts +1 -0
  235. package/dist/react/flow/api/react/index.d.ts +41 -0
  236. package/dist/react/flow/api/react/store/index.d.ts +18 -0
  237. package/dist/react/flow/api/react/store/initialState.d.ts +18 -0
  238. package/dist/react/flow/api/react/styles/utils.d.ts +2 -0
  239. package/dist/react/flow/api/react/types/component-props.d.ts +127 -0
  240. package/dist/react/flow/api/react/types/edges.d.ts +111 -0
  241. package/dist/react/flow/api/react/types/general.d.ts +53 -0
  242. package/dist/react/flow/api/react/types/index.d.ts +6 -0
  243. package/dist/react/flow/api/react/types/instance.d.ts +64 -0
  244. package/dist/react/flow/api/react/types/nodes.d.ts +41 -0
  245. package/dist/react/flow/api/react/types/store.d.ts +114 -0
  246. package/dist/react/flow/api/react/utils/changes.d.ts +15 -0
  247. package/dist/react/flow/api/react/utils/edges.d.ts +3 -0
  248. package/dist/react/flow/api/react/utils/general.d.ts +5 -0
  249. package/dist/react/flow/api/react/utils/index.d.ts +3 -0
  250. package/dist/react/flow/api/system/constants.d.ts +43 -0
  251. package/dist/react/flow/api/system/index.d.ts +8 -0
  252. package/dist/react/flow/api/system/types/changes.d.ts +48 -0
  253. package/dist/react/flow/api/system/types/edges.d.ts +72 -0
  254. package/dist/react/flow/api/system/types/general.d.ts +175 -0
  255. package/dist/react/flow/api/system/types/handles.d.ts +21 -0
  256. package/dist/react/flow/api/system/types/index.d.ts +7 -0
  257. package/dist/react/flow/api/system/types/nodes.d.ts +89 -0
  258. package/dist/react/flow/api/system/types/panzoom.d.ts +58 -0
  259. package/dist/react/flow/api/system/types/utils.d.ts +46 -0
  260. package/dist/react/flow/api/system/utils/attribution.d.ts +1 -0
  261. package/dist/react/flow/api/system/utils/connections.d.ts +4 -0
  262. package/dist/react/flow/api/system/utils/dom.d.ts +20 -0
  263. package/dist/react/flow/api/system/utils/edge-toolbar.d.ts +1 -0
  264. package/dist/react/flow/api/system/utils/edges/bezier-edge.d.ts +40 -0
  265. package/dist/react/flow/api/system/utils/edges/general.d.ts +44 -0
  266. package/dist/react/flow/api/system/utils/edges/index.d.ts +5 -0
  267. package/dist/react/flow/api/system/utils/edges/positions.d.ts +16 -0
  268. package/dist/react/flow/api/system/utils/edges/smoothstep-edge.d.ts +21 -0
  269. package/dist/react/flow/api/system/utils/edges/straight-edge.d.ts +13 -0
  270. package/dist/react/flow/api/system/utils/general.d.ts +56 -0
  271. package/dist/react/flow/api/system/utils/graph.d.ts +45 -0
  272. package/dist/react/flow/api/system/utils/index.d.ts +12 -0
  273. package/dist/react/flow/api/system/utils/marker.d.ts +8 -0
  274. package/dist/react/flow/api/system/utils/node-toolbar.d.ts +2 -0
  275. package/dist/react/flow/api/system/utils/shallow-node-data.d.ts +4 -0
  276. package/dist/react/flow/api/system/utils/store.d.ts +33 -0
  277. package/dist/react/flow/api/system/utils/types.d.ts +7 -0
  278. package/dist/react/flow/api/system/xydrag/XYDrag.d.ts +56 -0
  279. package/dist/react/flow/api/system/xydrag/index.d.ts +1 -0
  280. package/dist/react/flow/api/system/xydrag/utils.d.ts +22 -0
  281. package/dist/react/flow/api/system/xyhandle/XYHandle.d.ts +2 -0
  282. package/dist/react/flow/api/system/xyhandle/index.d.ts +1 -0
  283. package/dist/react/flow/api/system/xyhandle/types.d.ts +49 -0
  284. package/dist/react/flow/api/system/xyhandle/utils.d.ts +9 -0
  285. package/dist/react/flow/api/system/xyminimap/index.d.ts +27 -0
  286. package/dist/react/flow/api/system/xypanzoom/XYPanZoom.d.ts +11 -0
  287. package/dist/react/flow/api/system/xypanzoom/eventhandler.d.ts +45 -0
  288. package/dist/react/flow/api/system/xypanzoom/filter.d.ts +15 -0
  289. package/dist/react/flow/api/system/xypanzoom/index.d.ts +1 -0
  290. package/dist/react/flow/api/system/xypanzoom/utils.d.ts +8 -0
  291. package/dist/react/flow/api/system/xyresizer/XYResizer.d.ts +51 -0
  292. package/dist/react/flow/api/system/xyresizer/index.d.ts +2 -0
  293. package/dist/react/flow/api/system/xyresizer/types.d.ts +26 -0
  294. package/dist/react/flow/api/system/xyresizer/utils.d.ts +41 -0
  295. package/dist/react/flow/components.d.ts +148 -0
  296. package/dist/react/flow/components.js +526 -0
  297. package/dist/react/flow/configuration.d.ts +6 -0
  298. package/dist/react/flow/configuration.js +27 -0
  299. package/dist/react/flow/drag.d.ts +14 -0
  300. package/dist/react/flow/drag.js +273 -0
  301. package/dist/react/flow/extras.d.ts +155 -0
  302. package/dist/react/flow/extras.js +317 -0
  303. package/dist/react/flow/handle.d.ts +21 -0
  304. package/dist/react/flow/handle.js +149 -0
  305. package/dist/react/flow/hooks.d.ts +47 -0
  306. package/dist/react/flow/hooks.js +131 -0
  307. package/dist/react/flow/index.d.ts +78 -0
  308. package/dist/react/flow/index.js +73 -0
  309. package/dist/react/flow/queries.d.ts +20 -0
  310. package/dist/react/flow/queries.js +30 -0
  311. package/dist/react/flow/react-flow.d.ts +73 -0
  312. package/dist/react/flow/react-flow.js +1445 -0
  313. package/dist/react/flow/resize.d.ts +30 -0
  314. package/dist/react/flow/resize.js +49 -0
  315. package/dist/react/flow/store.d.ts +412 -0
  316. package/dist/react/flow/store.js +713 -0
  317. package/dist/react/flow/style.css +630 -0
  318. package/dist/react/flow/style.css.d.ts +2 -0
  319. package/dist/react/flow/system.d.ts +146 -0
  320. package/dist/react/flow/system.js +300 -0
  321. package/dist/react/flow/types.d.ts +131 -0
  322. package/dist/react/flow/types.js +1 -0
  323. package/dist/react/flow/utils.d.ts +77 -0
  324. package/dist/react/flow/utils.js +285 -0
  325. package/dist/react/hooks.d.ts +14 -0
  326. package/dist/react/hooks.js +44 -0
  327. package/dist/react/index.d.ts +3 -0
  328. package/dist/react/index.js +5 -0
  329. package/dist/render/backend.d.ts +26 -0
  330. package/dist/render/backend.js +5 -0
  331. package/dist/render/canvas2d/backend.d.ts +7 -0
  332. package/dist/render/canvas2d/backend.js +122 -0
  333. package/dist/render/canvas2d/index.d.ts +1 -0
  334. package/dist/render/canvas2d/index.js +2 -0
  335. package/dist/render/color.d.ts +9 -0
  336. package/dist/render/color.js +69 -0
  337. package/dist/render/commands.d.ts +69 -0
  338. package/dist/render/commands.js +1 -0
  339. package/dist/render/display-list.d.ts +65 -0
  340. package/dist/render/display-list.js +316 -0
  341. package/dist/render/images.d.ts +35 -0
  342. package/dist/render/images.js +83 -0
  343. package/dist/render/index.d.ts +14 -0
  344. package/dist/render/index.js +16 -0
  345. package/dist/render/painters.d.ts +35 -0
  346. package/dist/render/painters.js +109 -0
  347. package/dist/render/renderer.d.ts +70 -0
  348. package/dist/render/renderer.js +162 -0
  349. package/dist/render/scene-index.d.ts +21 -0
  350. package/dist/render/scene-index.js +64 -0
  351. package/dist/render/text.d.ts +8 -0
  352. package/dist/render/text.js +100 -0
  353. package/dist/render/theme.d.ts +21 -0
  354. package/dist/render/theme.js +33 -0
  355. package/dist/render/ui.d.ts +63 -0
  356. package/dist/render/ui.js +188 -0
  357. package/dist/render/webgl2/atlas.d.ts +36 -0
  358. package/dist/render/webgl2/atlas.js +93 -0
  359. package/dist/render/webgl2/backend.d.ts +19 -0
  360. package/dist/render/webgl2/backend.js +338 -0
  361. package/dist/render/webgl2/index.d.ts +2 -0
  362. package/dist/render/webgl2/index.js +3 -0
  363. package/dist/render/webgl2/shaders.d.ts +6 -0
  364. package/dist/render/webgl2/shaders.js +112 -0
  365. package/dist/render/webgpu/index.d.ts +1 -0
  366. package/dist/render/webgpu/index.js +3 -0
  367. package/dist/scene/builtins.d.ts +25 -0
  368. package/dist/scene/builtins.js +60 -0
  369. package/dist/scene/dirty.d.ts +11 -0
  370. package/dist/scene/dirty.js +10 -0
  371. package/dist/scene/index.d.ts +5 -0
  372. package/dist/scene/index.js +5 -0
  373. package/dist/scene/record.d.ts +40 -0
  374. package/dist/scene/record.js +12 -0
  375. package/dist/scene/scene-graph.d.ts +58 -0
  376. package/dist/scene/scene-graph.js +178 -0
  377. package/dist/scene/schema.d.ts +27 -0
  378. package/dist/scene/schema.js +32 -0
  379. package/dist/sdk/create-avis.d.ts +109 -0
  380. package/dist/sdk/create-avis.js +162 -0
  381. package/dist/sdk/index.d.ts +1 -0
  382. package/dist/sdk/index.js +2 -0
  383. package/dist/serialization/format.d.ts +46 -0
  384. package/dist/serialization/format.js +20 -0
  385. package/dist/serialization/index.d.ts +3 -0
  386. package/dist/serialization/index.js +3 -0
  387. package/dist/serialization/migrate.d.ts +7 -0
  388. package/dist/serialization/migrate.js +54 -0
  389. package/dist/serialization/serialize.d.ts +10 -0
  390. package/dist/serialization/serialize.js +114 -0
  391. package/dist/state/index.d.ts +2 -0
  392. package/dist/state/index.js +2 -0
  393. package/dist/state/selector.d.ts +6 -0
  394. package/dist/state/selector.js +29 -0
  395. package/dist/state/store.d.ts +91 -0
  396. package/dist/state/store.js +102 -0
  397. package/dist/style/computed.d.ts +84 -0
  398. package/dist/style/computed.js +296 -0
  399. package/dist/style/index.d.ts +6 -0
  400. package/dist/style/index.js +8 -0
  401. package/dist/style/style-engine.d.ts +33 -0
  402. package/dist/style/style-engine.js +113 -0
  403. package/dist/style/tokens.d.ts +49 -0
  404. package/dist/style/tokens.js +142 -0
  405. package/dist/style/utilities.d.ts +34 -0
  406. package/dist/style/utilities.js +341 -0
  407. package/dist/style/values.d.ts +30 -0
  408. package/dist/style/values.js +361 -0
  409. package/dist/style/variants.d.ts +38 -0
  410. package/dist/style/variants.js +55 -0
  411. package/dist/sync/index.d.ts +2 -0
  412. package/dist/sync/index.js +1 -0
  413. package/dist/sync/save-queue.d.ts +24 -0
  414. package/dist/sync/save-queue.js +88 -0
  415. package/dist/wasm/index.d.ts +2 -0
  416. package/dist/wasm/index.js +2 -0
  417. package/dist/wasm/load.d.ts +7 -0
  418. package/dist/wasm/load.js +47 -0
  419. package/dist/wasm/pkg/avis_engine_wasm.d.ts +84 -0
  420. package/dist/wasm/pkg/avis_engine_wasm.js +339 -0
  421. package/dist/wasm/pkg/avis_engine_wasm_bg.wasm +0 -0
  422. package/dist/wasm/reference.d.ts +38 -0
  423. package/dist/wasm/reference.js +174 -0
  424. package/package.json +76 -4
@@ -0,0 +1,42 @@
1
+ import type { Edge, Node, NodeChange } from "../flow/index.js";
2
+ /** The graph as the app gave it: its nodes and edges. */
3
+ export type GraphData<N extends Node = Node, E extends Edge = Edge> = {
4
+ nodes: N[];
5
+ edges: E[];
6
+ };
7
+ /** A node's box on the canvas: absolute position and measured size. */
8
+ export type NodeBox = {
9
+ x: number;
10
+ y: number;
11
+ width: number;
12
+ height: number;
13
+ };
14
+ /**
15
+ * A value derived from the graph's nodes and edges; the component re-renders
16
+ * only when `equals` (default `Object.is`) says it changed.
17
+ */
18
+ export declare function useGraphSelect<T, N extends Node = Node, E extends Edge = Edge>(select: (graph: GraphData<N, E>) => T, equals?: (a: T, b: T) => boolean): T;
19
+ /** A value derived from one node (`undefined` when it doesn't exist). */
20
+ export declare function useGraphNode<T, N extends Node = Node>(id: string | null | undefined, select: (node: N | undefined) => T, equals?: (a: T, b: T) => boolean): T;
21
+ /** A node's box (absolute position, measured size), or `null`. */
22
+ export declare function useNodeBox(id: string | null | undefined): NodeBox | null;
23
+ /** The camera's zoom. */
24
+ export declare function useZoom(): number;
25
+ /** How far the camera may zoom out and in. */
26
+ export declare function useZoomRange(): {
27
+ min: number;
28
+ max: number;
29
+ };
30
+ /** The canvas pane's size on screen, in pixels. */
31
+ export declare function usePaneSize(): {
32
+ width: number;
33
+ height: number;
34
+ };
35
+ /** The canvas's root element (for portals and screen measures). */
36
+ export declare function useCanvasElement(): HTMLDivElement | null;
37
+ /**
38
+ * Debugging: hands every node change to `listener` while mounted, in place
39
+ * of the canvas's `onNodesChange` (as React Flow's devtools did). Pass a
40
+ * stable listener.
41
+ */
42
+ export declare function useNodeChangesTap(listener: (changes: NodeChange[]) => void): void;
@@ -0,0 +1,78 @@
1
+ /*
2
+ * AVIS Engine · react/canvas hooks that read the graph without knowing how
3
+ * the store keeps it (docs/avis-engine/NATIVE-API-PLAN.md, "Còn lại" 1).
4
+ * UI code reads nodes, edges, a node's box, the zoom and the pane through
5
+ * these, never the store's internals (`nodeLookup`, `internals`,
6
+ * `measured`, `transform`, `domNode`), so the store can change behind them.
7
+ */
8
+ import { useCallback, useEffect } from "react";
9
+ import { useStore, useStoreApi } from "../flow/hooks.js";
10
+ const sameBox = (a, b) => a === b ||
11
+ (a !== null &&
12
+ b !== null &&
13
+ a.x === b.x &&
14
+ a.y === b.y &&
15
+ a.width === b.width &&
16
+ a.height === b.height);
17
+ /**
18
+ * A value derived from the graph's nodes and edges; the component re-renders
19
+ * only when `equals` (default `Object.is`) says it changed.
20
+ */
21
+ export function useGraphSelect(select, equals) {
22
+ return useStore((state) => select({
23
+ nodes: state.nodes,
24
+ edges: state.edges,
25
+ }), equals);
26
+ }
27
+ /** A value derived from one node (`undefined` when it doesn't exist). */
28
+ export function useGraphNode(id, select, equals) {
29
+ return useStore((state) => select((id ? state.nodeLookup.get(id)?.internals.userNode : undefined)), equals);
30
+ }
31
+ /** A node's box (absolute position, measured size), or `null`. */
32
+ export function useNodeBox(id) {
33
+ const select = useCallback((state) => {
34
+ const node = id ? state.nodeLookup.get(id) : undefined;
35
+ if (!node)
36
+ return null;
37
+ const { x, y } = node.internals.positionAbsolute;
38
+ return {
39
+ x,
40
+ y,
41
+ width: node.measured.width ?? 0,
42
+ height: node.measured.height ?? 0,
43
+ };
44
+ }, [id]);
45
+ return useStore(select, sameBox);
46
+ }
47
+ /** The camera's zoom. */
48
+ export function useZoom() {
49
+ return useStore((state) => state.transform[2]);
50
+ }
51
+ /** How far the camera may zoom out and in. */
52
+ export function useZoomRange() {
53
+ const min = useStore((state) => state.minZoom);
54
+ const max = useStore((state) => state.maxZoom);
55
+ return { min, max };
56
+ }
57
+ /** The canvas pane's size on screen, in pixels. */
58
+ export function usePaneSize() {
59
+ const width = useStore((state) => state.width);
60
+ const height = useStore((state) => state.height);
61
+ return { width, height };
62
+ }
63
+ /** The canvas's root element (for portals and screen measures). */
64
+ export function useCanvasElement() {
65
+ return useStore((state) => state.domNode);
66
+ }
67
+ /**
68
+ * Debugging: hands every node change to `listener` while mounted, in place
69
+ * of the canvas's `onNodesChange` (as React Flow's devtools did). Pass a
70
+ * stable listener.
71
+ */
72
+ export function useNodeChangesTap(listener) {
73
+ const store = useStoreApi();
74
+ useEffect(() => {
75
+ store.setState({ onNodesChange: listener });
76
+ return () => store.setState({ onNodesChange: undefined });
77
+ }, [store, listener]);
78
+ }
@@ -0,0 +1,35 @@
1
+ import type { JSX, RefAttributes } from "react";
2
+ import type { Edge, Node, ReactFlowInstance, ReactFlowProps } from "../flow/index.js";
3
+ import type { NodeBox } from "./hooks.js";
4
+ /** What AVIS adds to the canvas props: which nodes and edges get DOM. */
5
+ export type GraphMountProps<N extends Node = Node> = {
6
+ /**
7
+ * Whether a node gets DOM. A refused node stays in the store (selection,
8
+ * fitView, bounds, MiniMap) with its declared size and handles; the
9
+ * canvas engine draws it. Default: every node that isn't `hidden`.
10
+ */
11
+ mountNode?: (node: N) => boolean;
12
+ /** `false`: no edge DOM (the canvas engine draws them). Default `true`. */
13
+ mountEdges?: boolean;
14
+ };
15
+ export type GraphCanvasProps<N extends Node = Node, E extends Edge = Edge> = ReactFlowProps<N, E> & GraphMountProps<N>;
16
+ /** The canvas's imperative API (`useGraph()`), with AVIS's additions. */
17
+ export type GraphInstance<N extends Node = Node, E extends Edge = Edge> = ReactFlowInstance<N, E> & {
18
+ /** A node's absolute position (inside frames too), or `null`. */
19
+ getNodePosition(id: string): {
20
+ x: number;
21
+ y: number;
22
+ } | null;
23
+ /** A node's box (absolute position, measured size), or `null`. */
24
+ getNodeBox(id: string): NodeBox | null;
25
+ };
26
+ /** The canvas's imperative API: nodes, edges, viewport, conversions. */
27
+ export declare const useGraph: <N extends Node = Node, E extends Edge = Edge>() => GraphInstance<N, E>;
28
+ /** The graph canvas: its store, its DOM layers and the engine's input. */
29
+ export declare const GraphCanvas: <N extends Node = Node, E extends Edge = Edge>(props: GraphCanvasProps<N, E> & RefAttributes<HTMLDivElement>) => JSX.Element;
30
+ export { ReactFlowProvider as GraphCanvasProvider, useStore as useGraphStore, useStoreApi as useGraphStoreApi, BezierEdge, StraightEdge, StepEdge, SmoothStepEdge, SimpleBezierEdge, Handle, Panel, NodeToolbar as NodeOverlay, NodeResizer, NodeResizeControl, Background, MiniMap, MiniMapNode, Controls, ControlButton, EdgeLabelRenderer as EdgeLabelLayer, EdgeToolbar, ViewportPortal as ViewportLayer, BaseEdge, EdgeText, useNodeId, useNodes, useEdges, useViewport, useInternalNode, useConnection, useNodesData as useNodeData, useNodeConnections as useNodeLinks, useHandleConnections as useHandleLinks, useNodesState, useEdgesState, useKeyPress, useOnSelectionChange, useOnViewportChange, useNodesInitialized, useUpdateNodeInternals, Position as HandleSide, SelectionMode, ConnectionMode, ConnectionLineType, BackgroundVariant, MarkerType, PanOnScrollMode, ResizeControlVariant, getBezierPath, getStraightPath, getSmoothStepPath, getSimpleBezierPath, getBezierEdgeCenter, getEdgeCenter, getNodesBounds, getViewportForBounds, getOutgoers, getIncomers, getConnectedEdges, addEdge, reconnectEdge, applyNodeChanges, applyEdgeChanges, isNode, isEdge, } from "../flow/index.js";
31
+ export type { ReactFlowState as GraphState, XYPosition as GraphPoint, Node, Edge, BuiltInNode, BuiltInEdge, InternalNode as MeasuredNode, NodeProps, EdgeProps, NodeTypes, EdgeTypes, NodeChange, EdgeChange, NodeHandle, Connection, ConnectionLineComponentProps, HandleProps, PanelProps, PanelPosition, NodeToolbarProps as NodeOverlayProps, Viewport, OnNodesChange, OnEdgesChange, OnConnect, OnConnectStart, OnConnectEnd, FitViewOptions, Rect, Dimensions, } from "../flow/index.js";
32
+ export { useGraphSelect, useGraphNode, useNodeBox, useZoom, useZoomRange, usePaneSize, useCanvasElement, useNodeChangesTap, } from "./hooks.js";
33
+ export type { GraphData, NodeBox } from "./hooks.js";
34
+ export { appNode, nodeHandles, nodeLayer, nodePosition, nodeSize, useGraphController, useGraphView, } from "./graph.js";
35
+ export type { GraphController, GraphHandlers, GraphNodeRef, GraphOptions, GraphView, NodeHandleRect, } from "./graph.js";
@@ -0,0 +1,8 @@
1
+ import { ReactFlow, useReactFlow } from "../flow/index.js";
2
+ /** The canvas's imperative API: nodes, edges, viewport, conversions. */
3
+ export const useGraph = useReactFlow;
4
+ /** The graph canvas: its store, its DOM layers and the engine's input. */
5
+ export const GraphCanvas = ReactFlow;
6
+ export { ReactFlowProvider as GraphCanvasProvider, useStore as useGraphStore, useStoreApi as useGraphStoreApi, BezierEdge, StraightEdge, StepEdge, SmoothStepEdge, SimpleBezierEdge, Handle, Panel, NodeToolbar as NodeOverlay, NodeResizer, NodeResizeControl, Background, MiniMap, MiniMapNode, Controls, ControlButton, EdgeLabelRenderer as EdgeLabelLayer, EdgeToolbar, ViewportPortal as ViewportLayer, BaseEdge, EdgeText, useNodeId, useNodes, useEdges, useViewport, useInternalNode, useConnection, useNodesData as useNodeData, useNodeConnections as useNodeLinks, useHandleConnections as useHandleLinks, useNodesState, useEdgesState, useKeyPress, useOnSelectionChange, useOnViewportChange, useNodesInitialized, useUpdateNodeInternals, Position as HandleSide, SelectionMode, ConnectionMode, ConnectionLineType, BackgroundVariant, MarkerType, PanOnScrollMode, ResizeControlVariant, getBezierPath, getStraightPath, getSmoothStepPath, getSimpleBezierPath, getBezierEdgeCenter, getEdgeCenter, getNodesBounds, getViewportForBounds, getOutgoers, getIncomers, getConnectedEdges, addEdge, reconnectEdge, applyNodeChanges, applyEdgeChanges, isNode, isEdge, } from "../flow/index.js";
7
+ export { useGraphSelect, useGraphNode, useNodeBox, useZoom, useZoomRange, usePaneSize, useCanvasElement, useNodeChangesTap, } from "./hooks.js";
8
+ export { appNode, nodeHandles, nodeLayer, nodePosition, nodeSize, useGraphController, useGraphView, } from "./graph.js";
@@ -0,0 +1,55 @@
1
+ import { type CSSProperties, type ReactNode } from "react";
2
+ import { type Avis, type AvisNodeInput, type AvisOptions } from "../sdk/create-avis.js";
3
+ import type { UIElement } from "../render/ui.js";
4
+ import type { Placement } from "../dom/position.js";
5
+ export type AvisCanvasProps = {
6
+ options?: Omit<AvisOptions, "container">;
7
+ className?: string;
8
+ style?: CSSProperties;
9
+ children?: ReactNode;
10
+ onReady?: (avis: Avis) => void;
11
+ };
12
+ /** The canvas: sets up the engine once, in its own div. */
13
+ export declare function AvisCanvas({ options, className, style, children, onReady }: AvisCanvasProps): import("react").JSX.Element;
14
+ export type ElementProps = {
15
+ className?: string;
16
+ children?: ReactNode;
17
+ data?: Record<string, string | boolean>;
18
+ ariaLabel?: string;
19
+ disabled?: boolean;
20
+ };
21
+ /** A styled box inside a frame. */
22
+ export declare function Box(_: ElementProps): null;
23
+ /** The spec's <Rect>: a styled box. */
24
+ export declare const Rect: typeof Box;
25
+ /** Styled text inside a frame. */
26
+ export declare function Text(_: Omit<ElementProps, "children"> & {
27
+ children?: string | number | (string | number)[];
28
+ }): null;
29
+ /** A button drawn on the canvas, with a real DOM button for the keyboard; `action` comes back in onPress. */
30
+ export declare function Button(_: ElementProps & {
31
+ action: string;
32
+ }): null;
33
+ /** The element children of a frame, as styled elements. */
34
+ export declare function toElements(children: ReactNode): UIElement[];
35
+ export type NodeProps = Omit<AvisNodeInput, "parentId" | "children"> & {
36
+ children?: ReactNode;
37
+ /** Called with an element's `action` when it is pressed (click or keyboard). */
38
+ onPress?: (action: string | undefined, path: number[]) => void;
39
+ /** The node's id once it exists. */
40
+ onCreate?: (id: string) => void;
41
+ };
42
+ /** A scene node; with a className (or element children) it is a styled node. */
43
+ export declare function Node({ children, onPress, onCreate, ...input }: NodeProps): import("react").JSX.Element | null;
44
+ /** The spec's <Frame>: a styled node whose element children it lays out. */
45
+ export declare function Frame(props: NodeProps): import("react").JSX.Element;
46
+ export type NodeToolbarProps = {
47
+ /** The node; the single selected node by default (React Flow's NodeToolbar). */
48
+ nodeId?: string;
49
+ placement?: Placement;
50
+ offset?: number;
51
+ className?: string;
52
+ children?: ReactNode;
53
+ };
54
+ /** DOM next to a GPU node, following it as the camera moves. */
55
+ export declare function NodeToolbar({ nodeId, placement, offset, className, children }: NodeToolbarProps): import("react").ReactPortal | null;
@@ -0,0 +1,197 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /*
3
+ * Declarative canvas content (spec §6, React adapter):
4
+ *
5
+ * <AvisCanvas options={{ tokens }}>
6
+ * <Frame className="flex flex-col gap-4 p-6 bg-card rounded-xl" position={{ x: 100, y: 100 }} size={{ width: 320, height: 240 }}>
7
+ * <Text className="text-lg font-semibold text-foreground">Hello AVIS</Text>
8
+ * <Rect className="w-32 h-12 rounded-lg bg-primary hover:bg-primary/90 data-[selected=true]:ring-2" />
9
+ * </Frame>
10
+ * </AvisCanvas>
11
+ *
12
+ * - <Frame> (and <Node>) are scene nodes: created by a command when they
13
+ * mount, updated when their props change, deleted when they unmount.
14
+ * - <Box>, <Rect>, <Text> and <Button> inside a <Frame> are its styled
15
+ * elements, laid out by the frame's classes. They are read from the
16
+ * children, not rendered.
17
+ * - A <Frame> or <Node> nested in a <Frame> becomes its child node.
18
+ */
19
+ import { Children, isValidElement, useContext, useEffect, useLayoutEffect, useRef, useState, } from "react";
20
+ import { createPortal } from "react-dom";
21
+ import { createAvis } from "../sdk/create-avis.js";
22
+ import { nodeScreenRect } from "../dom/anchor.js";
23
+ import { AvisContext, ParentContext } from "./context.js";
24
+ import { useAvis, useSelection } from "./hooks.js";
25
+ /** The canvas: sets up the engine once, in its own div. */
26
+ export function AvisCanvas({ options, className, style, children, onReady }) {
27
+ const ref = useRef(null);
28
+ const [avis, setAvis] = useState(null);
29
+ const setup = useRef({ options, onReady });
30
+ useEffect(() => {
31
+ let alive = true;
32
+ let made = null;
33
+ createAvis({ ...setup.current.options, container: ref.current }).then((created) => {
34
+ if (!alive)
35
+ return created.dispose();
36
+ made = created;
37
+ setAvis(created);
38
+ setup.current.onReady?.(created);
39
+ });
40
+ return () => {
41
+ alive = false;
42
+ made?.dispose();
43
+ setAvis(null);
44
+ };
45
+ }, []);
46
+ return (_jsx("div", { ref: ref, className: className, style: { position: "relative", ...style }, children: avis && _jsx(AvisContext.Provider, { value: avis, children: children }) }));
47
+ }
48
+ /** A styled box inside a frame. */
49
+ export function Box(_) {
50
+ return null;
51
+ }
52
+ /** The spec's <Rect>: a styled box. */
53
+ export const Rect = Box;
54
+ /** Styled text inside a frame. */
55
+ export function Text(_) {
56
+ return null;
57
+ }
58
+ /** A button drawn on the canvas, with a real DOM button for the keyboard; `action` comes back in onPress. */
59
+ export function Button(_) {
60
+ return null;
61
+ }
62
+ const ELEMENTS = new Set([Box, Text, Button]);
63
+ /** The element children of a frame, as styled elements. */
64
+ export function toElements(children) {
65
+ const out = [];
66
+ Children.forEach(children, (child) => {
67
+ if (typeof child === "string" || typeof child === "number") {
68
+ out.push({ text: String(child) });
69
+ return;
70
+ }
71
+ if (!isValidElement(child) || !ELEMENTS.has(child.type))
72
+ return;
73
+ const props = child.props;
74
+ const element = {
75
+ className: props.className,
76
+ data: props.data,
77
+ ariaLabel: props.ariaLabel,
78
+ disabled: props.disabled,
79
+ };
80
+ if (child.type === Text) {
81
+ element.text = Children.toArray(props.children).join("");
82
+ }
83
+ else if (child.type === Button) {
84
+ element.role = "button";
85
+ element.action = props.action;
86
+ const kids = toElements(props.children);
87
+ if (kids.length === 1 && kids[0].text !== undefined && !kids[0].className)
88
+ element.text = kids[0].text;
89
+ else
90
+ element.children = kids;
91
+ }
92
+ else {
93
+ element.children = toElements(props.children);
94
+ }
95
+ out.push(element);
96
+ });
97
+ return out;
98
+ }
99
+ /** The scene-node children (not elements) of a frame. */
100
+ const nodeChildren = (children) => Children.toArray(children).filter((child) => isValidElement(child) && !ELEMENTS.has(child.type));
101
+ const sameJson = (a, b) => JSON.stringify(a) === JSON.stringify(b);
102
+ /** A scene node; with a className (or element children) it is a styled node. */
103
+ export function Node({ children, onPress, onCreate, ...input }) {
104
+ const avis = useAvis();
105
+ const parentId = useContext(ParentContext);
106
+ const [id, setId] = useState(null);
107
+ const elements = toElements(children);
108
+ const desired = {
109
+ ...input,
110
+ parentId,
111
+ ...(input.className !== undefined || elements.length ? { children: elements } : {}),
112
+ };
113
+ const latest = useRef(desired);
114
+ const last = useRef(null);
115
+ const callbacks = useRef({ onPress, onCreate });
116
+ useLayoutEffect(() => {
117
+ latest.current = desired;
118
+ callbacks.current = { onPress, onCreate };
119
+ });
120
+ // Created once; deleted on unmount.
121
+ useLayoutEffect(() => {
122
+ const created = avis.createNode(latest.current);
123
+ last.current = latest.current;
124
+ setId(created);
125
+ callbacks.current.onCreate?.(created);
126
+ return () => {
127
+ if (!avis.engine.disposed && avis.engine.store.get().document.nodes[created]) {
128
+ avis.commands.execute("node.delete", { ids: [created] });
129
+ }
130
+ };
131
+ }, [avis]);
132
+ // Prop changes become one update; drags on the canvas aren't undone by
133
+ // re-renders (only changed props are pushed).
134
+ useLayoutEffect(() => {
135
+ const before = last.current;
136
+ const next = latest.current;
137
+ if (!id || !before)
138
+ return;
139
+ const change = {};
140
+ if (!sameJson(before.position, next.position) && next.position)
141
+ change.position = next.position;
142
+ if (!sameJson(before.size, next.size) && next.size)
143
+ change.size = next.size;
144
+ if (before.className !== next.className)
145
+ change.className = next.className;
146
+ if (before.text !== next.text)
147
+ change.text = next.text;
148
+ if (!sameJson(before.children, next.children) && next.children)
149
+ change.children = next.children;
150
+ if (!sameJson(before.props, next.props) && next.props)
151
+ change.props = next.props;
152
+ if (Object.keys(change).length)
153
+ avis.updateNode(id, change);
154
+ last.current = next;
155
+ });
156
+ useEffect(() => {
157
+ if (!id)
158
+ return;
159
+ const off = avis.events.on("element:press", (event) => {
160
+ if (event.nodeId === id)
161
+ callbacks.current.onPress?.(event.action, event.path);
162
+ });
163
+ return () => off.dispose();
164
+ }, [avis, id]);
165
+ const nested = nodeChildren(children);
166
+ if (!id || !nested.length)
167
+ return null;
168
+ return _jsx(ParentContext.Provider, { value: id, children: nested });
169
+ }
170
+ /** The spec's <Frame>: a styled node whose element children it lays out. */
171
+ export function Frame(props) {
172
+ return _jsx(Node, { ...props });
173
+ }
174
+ /** DOM next to a GPU node, following it as the camera moves. */
175
+ export function NodeToolbar({ nodeId, placement = "top", offset = 10, className, children }) {
176
+ const avis = useAvis();
177
+ const selection = useSelection();
178
+ const target = nodeId ?? (selection.length === 1 ? selection[0] : null);
179
+ const ref = useRef(null);
180
+ const targetRef = useRef(target);
181
+ useLayoutEffect(() => {
182
+ targetRef.current = target;
183
+ avis.overlays.update();
184
+ });
185
+ const shown = target !== null;
186
+ useLayoutEffect(() => {
187
+ const el = ref.current;
188
+ if (!el)
189
+ return;
190
+ // React owns the element (a portal into the overlay layer); the engine places it.
191
+ const handle = avis.overlays.anchor(() => (targetRef.current && !avis.engine.store.get().interaction.gesture ? nodeScreenRect(avis.engine, targetRef.current) : null), el, { placement, offset, append: false });
192
+ return () => handle.dispose();
193
+ }, [avis, placement, offset, shown]);
194
+ return shown
195
+ ? createPortal(_jsx("div", { ref: ref, role: "toolbar", className: className, children: children }), avis.overlays.element)
196
+ : null;
197
+ }
@@ -0,0 +1,4 @@
1
+ import type { Avis } from "../sdk/create-avis.js";
2
+ export declare const AvisContext: import("react").Context<Avis | null>;
3
+ /** The scene node children are created inside (a frame), or null for the root. */
4
+ export declare const ParentContext: import("react").Context<string | null>;
@@ -0,0 +1,9 @@
1
+ /*
2
+ * React adapter contexts. The adapter never renders frames: React creates,
3
+ * updates and removes nodes through commands, and reads engine state with
4
+ * fine-grained subscriptions (spec §6).
5
+ */
6
+ import { createContext } from "react";
7
+ export const AvisContext = createContext(null);
8
+ /** The scene node children are created inside (a frame), or null for the root. */
9
+ export const ParentContext = createContext(null);
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019-2025 webkid GmbH
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.
@@ -0,0 +1,12 @@
1
+ // Stand-ins for the d3 and zustand types React Flow's declarations mention.
2
+ /* eslint-disable @typescript-eslint/no-explicit-any */
3
+ export type ZoomBehavior<_E = any, _D = any> = any
4
+ export type ZoomTransform = { k: number; x: number; y: number }
5
+ export type Selection<_A = any, _B = any, _C = any, _D = any> = any
6
+ export type D3DragEvent<_A = any, _B = any, _C = any> = any
7
+ export type SubjectPosition = { x: number; y: number }
8
+ /** The coordinate pair used by the ported minimap's pointer API. */
9
+ export declare function pointer(event: unknown, target?: EventTarget | null): [number, number]
10
+ export type StoreApi<T> = { getState(): T; setState(partial: Partial<T> | ((state: T) => Partial<T>), replace?: boolean): void; subscribe(listener: (state: T, prev: T) => void): () => void }
11
+ export type UseBoundStoreWithEqualityFn<S> = S extends StoreApi<infer T> ? S & (<U>(selector: (state: T) => U, equalityFn?: (a: U, b: U) => boolean) => U) : never
12
+ export type Transition<_A = any, _B = any, _C = any, _D = any> = any
@@ -0,0 +1,7 @@
1
+ import { type BackgroundProps } from './types.js';
2
+ declare function BackgroundComponent({ id, variant, gap, size, lineWidth, offset, color, bgColor, style, className, patternClassName, }: BackgroundProps): import("react/jsx-runtime").JSX.Element;
3
+ declare namespace BackgroundComponent {
4
+ var displayName: string;
5
+ }
6
+ export declare const Background: import("react").MemoExoticComponent<typeof BackgroundComponent>;
7
+ export {};
@@ -0,0 +1,17 @@
1
+ import { BackgroundVariant } from './types.js';
2
+ type LinePatternProps = {
3
+ dimensions: [
4
+ number,
5
+ number
6
+ ];
7
+ variant: BackgroundVariant;
8
+ lineWidth?: number;
9
+ className?: string;
10
+ };
11
+ export declare function LinePattern({ dimensions, lineWidth, variant, className }: LinePatternProps): import("react/jsx-runtime").JSX.Element;
12
+ type DotPatternProps = {
13
+ radius: number;
14
+ className?: string;
15
+ };
16
+ export declare function DotPattern({ radius, className }: DotPatternProps): import("react/jsx-runtime").JSX.Element;
17
+ export {};
@@ -0,0 +1,2 @@
1
+ export { Background } from './Background.js';
2
+ export { BackgroundVariant, type BackgroundProps } from './types.js';
@@ -0,0 +1,25 @@
1
+ import { CSSProperties } from 'react';
2
+ export declare enum BackgroundVariant {
3
+ Lines = "lines",
4
+ Dots = "dots",
5
+ Cross = "cross"
6
+ }
7
+ export type BackgroundProps = {
8
+ id?: string;
9
+ color?: string;
10
+ bgColor?: string;
11
+ className?: string;
12
+ patternClassName?: string;
13
+ gap?: number | [
14
+ number,
15
+ number
16
+ ];
17
+ size?: number;
18
+ offset?: number | [
19
+ number,
20
+ number
21
+ ];
22
+ lineWidth?: number;
23
+ variant?: BackgroundVariant;
24
+ style?: CSSProperties;
25
+ };
@@ -0,0 +1,2 @@
1
+ import type { ControlButtonProps } from './types.js';
2
+ export declare function ControlButton({ children, className, ...rest }: ControlButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import type { ControlProps } from './types.js';
2
+ declare function ControlsComponent({ style, showZoom, showFitView, showInteractive, fitViewOptions, onZoomIn, onZoomOut, onFitView, onInteractiveChange, className, children, position, orientation, 'aria-label': ariaLabel, }: ControlProps): import("react/jsx-runtime").JSX.Element;
3
+ declare namespace ControlsComponent {
4
+ var displayName: string;
5
+ }
6
+ export declare const Controls: import("react").MemoExoticComponent<typeof ControlsComponent>;
7
+ export {};
@@ -0,0 +1 @@
1
+ export declare function FitViewIcon(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare function LockIcon(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare function MinusIcon(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare function PlusIcon(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare function UnlockIcon(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ export { Controls } from './Controls.js';
2
+ export { ControlButton } from './ControlButton.js';
3
+ export type { ControlProps, ControlButtonProps } from './types.js';
@@ -0,0 +1,20 @@
1
+ import type { ButtonHTMLAttributes, ReactNode } from 'react';
2
+ import type { PanelPosition } from "../../../system/index.js";
3
+ import type { FitViewOptions } from '../../types/index.js';
4
+ export type ControlProps = {
5
+ showZoom?: boolean;
6
+ showFitView?: boolean;
7
+ showInteractive?: boolean;
8
+ fitViewOptions?: FitViewOptions;
9
+ onZoomIn?: () => void;
10
+ onZoomOut?: () => void;
11
+ onFitView?: () => void;
12
+ onInteractiveChange?: (interactiveStatus: boolean) => void;
13
+ position?: PanelPosition;
14
+ children?: ReactNode;
15
+ style?: React.CSSProperties;
16
+ className?: string;
17
+ 'aria-label'?: string;
18
+ orientation?: 'horizontal' | 'vertical';
19
+ };
20
+ export type ControlButtonProps = ButtonHTMLAttributes<HTMLButtonElement>;
@@ -0,0 +1,2 @@
1
+ import type { EdgeToolbarProps } from './types.js';
2
+ export declare function EdgeToolbar({ edgeId, x, y, children, className, style, isVisible, alignX, alignY, ...rest }: EdgeToolbarProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,2 @@
1
+ export { EdgeToolbar } from './EdgeToolbar.js';
2
+ export type { EdgeToolbarProps } from './types.js';
@@ -0,0 +1,6 @@
1
+ import type { HTMLAttributes, ReactNode } from 'react';
2
+ import type { EdgeToolbarBaseProps } from "../../../system/index.js";
3
+ export type EdgeToolbarProps = EdgeToolbarBaseProps & HTMLAttributes<HTMLDivElement> & {
4
+ edgeId: string;
5
+ children?: ReactNode;
6
+ };
@@ -0,0 +1,8 @@
1
+ import type { Node } from '../../types/index.js';
2
+ import type { MiniMapProps } from './types.js';
3
+ declare function MiniMapComponent<NodeType extends Node = Node>({ style, className, nodeStrokeColor, nodeColor, nodeClassName, nodeBorderRadius, nodeStrokeWidth, nodeComponent, bgColor, maskColor, maskStrokeColor, maskStrokeWidth, position, onClick, onNodeClick, pannable, zoomable, ariaLabel, inversePan, zoomStep, offsetScale, }: MiniMapProps<NodeType>): import("react/jsx-runtime").JSX.Element;
4
+ declare namespace MiniMapComponent {
5
+ var displayName: string;
6
+ }
7
+ export declare const MiniMap: typeof MiniMapComponent;
8
+ export {};
@@ -0,0 +1,4 @@
1
+ import type { MiniMapNodeProps } from './types.js';
2
+ declare function MiniMapNodeComponent({ id, x, y, width, height, style, color, strokeColor, strokeWidth, className, borderRadius, shapeRendering, selected, onClick, }: MiniMapNodeProps): import("react/jsx-runtime").JSX.Element;
3
+ export declare const MiniMapNode: import("react").MemoExoticComponent<typeof MiniMapNodeComponent>;
4
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { Node } from '../../types/index.js';
2
+ import type { MiniMapNodes as MiniMapNodesProps } from './types.js';
3
+ declare function MiniMapNodes<NodeType extends Node>({ nodeStrokeColor, nodeColor, nodeClassName, nodeBorderRadius, nodeStrokeWidth, nodeComponent: NodeComponent, onClick, }: MiniMapNodesProps<NodeType>): import("react/jsx-runtime").JSX.Element;
4
+ declare const _default: typeof MiniMapNodes;
5
+ export default _default;
@@ -0,0 +1,3 @@
1
+ export { MiniMap } from './MiniMap.js';
2
+ export { MiniMapNode } from './MiniMapNode.js';
3
+ export * from './types.js';