@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.
- package/README.md +193 -2
- package/THIRD_PARTY_NOTICES.md +29 -0
- package/dist/a11y/focus.d.ts +60 -0
- package/dist/a11y/focus.js +222 -0
- package/dist/a11y/index.d.ts +2 -0
- package/dist/a11y/index.js +4 -0
- package/dist/a11y/semantics.d.ts +37 -0
- package/dist/a11y/semantics.js +88 -0
- package/dist/commands/builtins.d.ts +88 -0
- package/dist/commands/builtins.js +362 -0
- package/dist/commands/command.d.ts +23 -0
- package/dist/commands/command.js +20 -0
- package/dist/commands/draft.d.ts +33 -0
- package/dist/commands/draft.js +96 -0
- package/dist/commands/history.d.ts +34 -0
- package/dist/commands/history.js +80 -0
- package/dist/commands/index.d.ts +6 -0
- package/dist/commands/index.js +6 -0
- package/dist/commands/patch.d.ts +24 -0
- package/dist/commands/patch.js +44 -0
- package/dist/commands/transaction.d.ts +16 -0
- package/dist/commands/transaction.js +39 -0
- package/dist/core/diagnostics.d.ts +23 -0
- package/dist/core/diagnostics.js +23 -0
- package/dist/core/disposable.d.ts +14 -0
- package/dist/core/disposable.js +51 -0
- package/dist/core/engine.d.ts +108 -0
- package/dist/core/engine.js +323 -0
- package/dist/core/event-bus.d.ts +10 -0
- package/dist/core/event-bus.js +33 -0
- package/dist/core/ids.d.ts +13 -0
- package/dist/core/ids.js +6 -0
- package/dist/core/index.d.ts +7 -0
- package/dist/core/index.js +7 -0
- package/dist/core/plugin.d.ts +20 -0
- package/dist/core/plugin.js +47 -0
- package/dist/core/services.d.ts +14 -0
- package/dist/core/services.js +20 -0
- package/dist/devtools/index.d.ts +1 -0
- package/dist/devtools/index.js +2 -0
- package/dist/devtools/panel.d.ts +39 -0
- package/dist/devtools/panel.js +100 -0
- package/dist/dom/a11y-layer.d.ts +32 -0
- package/dist/dom/a11y-layer.js +358 -0
- package/dist/dom/anchor.d.ts +34 -0
- package/dist/dom/anchor.js +35 -0
- package/dist/dom/index.d.ts +6 -0
- package/dist/dom/index.js +8 -0
- package/dist/dom/menu.d.ts +24 -0
- package/dist/dom/menu.js +122 -0
- package/dist/dom/overlays.d.ts +29 -0
- package/dist/dom/overlays.js +82 -0
- package/dist/dom/paint/collect.d.ts +8 -0
- package/dist/dom/paint/collect.js +589 -0
- package/dist/dom/paint/css.d.ts +86 -0
- package/dist/dom/paint/css.js +526 -0
- package/dist/dom/paint/draw.d.ts +16 -0
- package/dist/dom/paint/draw.js +413 -0
- package/dist/dom/paint/ghost.d.ts +2 -0
- package/dist/dom/paint/ghost.js +8 -0
- package/dist/dom/paint/index.d.ts +6 -0
- package/dist/dom/paint/index.js +9 -0
- package/dist/dom/paint/text.d.ts +26 -0
- package/dist/dom/paint/text.js +209 -0
- package/dist/dom/paint/types.d.ts +174 -0
- package/dist/dom/paint/types.js +7 -0
- package/dist/dom/paint/watch.d.ts +10 -0
- package/dist/dom/paint/watch.js +109 -0
- package/dist/dom/position.d.ts +37 -0
- package/dist/dom/position.js +125 -0
- package/dist/dom/text-editor.d.ts +27 -0
- package/dist/dom/text-editor.js +128 -0
- package/dist/events/event.d.ts +122 -0
- package/dist/events/event.js +130 -0
- package/dist/events/eventer.d.ts +24 -0
- package/dist/events/eventer.js +83 -0
- package/dist/events/index.d.ts +3 -0
- package/dist/events/index.js +3 -0
- package/dist/events/interaction.d.ts +43 -0
- package/dist/events/interaction.js +203 -0
- package/dist/geometry/anchors.d.ts +14 -0
- package/dist/geometry/anchors.js +13 -0
- package/dist/geometry/bounds.d.ts +16 -0
- package/dist/geometry/bounds.js +42 -0
- package/dist/geometry/curves.d.ts +39 -0
- package/dist/geometry/curves.js +68 -0
- package/dist/geometry/index.d.ts +6 -0
- package/dist/geometry/index.js +6 -0
- package/dist/geometry/matrix.d.ts +22 -0
- package/dist/geometry/matrix.js +56 -0
- package/dist/geometry/spaces.d.ts +22 -0
- package/dist/geometry/spaces.js +28 -0
- package/dist/geometry/vec2.d.ts +12 -0
- package/dist/geometry/vec2.js +10 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +22 -0
- package/dist/interaction/behaviors.d.ts +10 -0
- package/dist/interaction/behaviors.js +744 -0
- package/dist/interaction/controller.d.ts +180 -0
- package/dist/interaction/controller.js +269 -0
- package/dist/interaction/hit-test.d.ts +45 -0
- package/dist/interaction/hit-test.js +119 -0
- package/dist/interaction/index.d.ts +4 -0
- package/dist/interaction/index.js +7 -0
- package/dist/interaction/web-input.d.ts +13 -0
- package/dist/interaction/web-input.js +172 -0
- package/dist/layout/index.d.ts +1 -0
- package/dist/layout/index.js +2 -0
- package/dist/layout/layout.d.ts +27 -0
- package/dist/layout/layout.js +266 -0
- package/dist/react/canvas/graph.d.ts +83 -0
- package/dist/react/canvas/graph.js +89 -0
- package/dist/react/canvas/hooks.d.ts +42 -0
- package/dist/react/canvas/hooks.js +78 -0
- package/dist/react/canvas/index.d.ts +35 -0
- package/dist/react/canvas/index.js +8 -0
- package/dist/react/components.d.ts +55 -0
- package/dist/react/components.js +197 -0
- package/dist/react/context.d.ts +4 -0
- package/dist/react/context.js +9 -0
- package/dist/react/flow/api/LICENSE +21 -0
- package/dist/react/flow/api/externals.d.ts +12 -0
- package/dist/react/flow/api/react/additional-components/Background/Background.d.ts +7 -0
- package/dist/react/flow/api/react/additional-components/Background/Patterns.d.ts +17 -0
- package/dist/react/flow/api/react/additional-components/Background/index.d.ts +2 -0
- package/dist/react/flow/api/react/additional-components/Background/types.d.ts +25 -0
- package/dist/react/flow/api/react/additional-components/Controls/ControlButton.d.ts +2 -0
- package/dist/react/flow/api/react/additional-components/Controls/Controls.d.ts +7 -0
- package/dist/react/flow/api/react/additional-components/Controls/Icons/FitView.d.ts +1 -0
- package/dist/react/flow/api/react/additional-components/Controls/Icons/Lock.d.ts +1 -0
- package/dist/react/flow/api/react/additional-components/Controls/Icons/Minus.d.ts +1 -0
- package/dist/react/flow/api/react/additional-components/Controls/Icons/Plus.d.ts +1 -0
- package/dist/react/flow/api/react/additional-components/Controls/Icons/Unlock.d.ts +1 -0
- package/dist/react/flow/api/react/additional-components/Controls/index.d.ts +3 -0
- package/dist/react/flow/api/react/additional-components/Controls/types.d.ts +20 -0
- package/dist/react/flow/api/react/additional-components/EdgeToolbar/EdgeToolbar.d.ts +2 -0
- package/dist/react/flow/api/react/additional-components/EdgeToolbar/index.d.ts +2 -0
- package/dist/react/flow/api/react/additional-components/EdgeToolbar/types.d.ts +6 -0
- package/dist/react/flow/api/react/additional-components/MiniMap/MiniMap.d.ts +8 -0
- package/dist/react/flow/api/react/additional-components/MiniMap/MiniMapNode.d.ts +4 -0
- package/dist/react/flow/api/react/additional-components/MiniMap/MiniMapNodes.d.ts +5 -0
- package/dist/react/flow/api/react/additional-components/MiniMap/index.d.ts +3 -0
- package/dist/react/flow/api/react/additional-components/MiniMap/types.d.ts +44 -0
- package/dist/react/flow/api/react/additional-components/NodeResizer/NodeResizeControl.d.ts +5 -0
- package/dist/react/flow/api/react/additional-components/NodeResizer/NodeResizer.d.ts +2 -0
- package/dist/react/flow/api/react/additional-components/NodeResizer/index.d.ts +3 -0
- package/dist/react/flow/api/react/additional-components/NodeResizer/types.d.ts +32 -0
- package/dist/react/flow/api/react/additional-components/NodeToolbar/NodeToolbar.d.ts +2 -0
- package/dist/react/flow/api/react/additional-components/NodeToolbar/NodeToolbarPortal.d.ts +4 -0
- package/dist/react/flow/api/react/additional-components/NodeToolbar/index.d.ts +2 -0
- package/dist/react/flow/api/react/additional-components/NodeToolbar/types.d.ts +9 -0
- package/dist/react/flow/api/react/additional-components/index.d.ts +6 -0
- package/dist/react/flow/api/react/components/A11yDescriptions/index.d.ts +7 -0
- package/dist/react/flow/api/react/components/Attribution/index.d.ts +8 -0
- package/dist/react/flow/api/react/components/BatchProvider/index.d.ts +10 -0
- package/dist/react/flow/api/react/components/BatchProvider/types.d.ts +6 -0
- package/dist/react/flow/api/react/components/BatchProvider/useQueue.d.ts +2 -0
- package/dist/react/flow/api/react/components/ConnectionLine/index.d.ts +11 -0
- package/dist/react/flow/api/react/components/EdgeLabelRenderer/index.d.ts +5 -0
- package/dist/react/flow/api/react/components/EdgeWrapper/EdgeUpdateAnchors.d.ts +14 -0
- package/dist/react/flow/api/react/components/EdgeWrapper/index.d.ts +5 -0
- package/dist/react/flow/api/react/components/EdgeWrapper/utils.d.ts +11 -0
- package/dist/react/flow/api/react/components/Edges/BaseEdge.d.ts +2 -0
- package/dist/react/flow/api/react/components/Edges/BezierEdge.d.ts +4 -0
- package/dist/react/flow/api/react/components/Edges/EdgeAnchor.d.ts +13 -0
- package/dist/react/flow/api/react/components/Edges/EdgeText.d.ts +7 -0
- package/dist/react/flow/api/react/components/Edges/SimpleBezierEdge.d.ts +20 -0
- package/dist/react/flow/api/react/components/Edges/SmoothStepEdge.d.ts +4 -0
- package/dist/react/flow/api/react/components/Edges/StepEdge.d.ts +4 -0
- package/dist/react/flow/api/react/components/Edges/StraightEdge.d.ts +4 -0
- package/dist/react/flow/api/react/components/Edges/index.d.ts +5 -0
- package/dist/react/flow/api/react/components/Handle/index.d.ts +8 -0
- package/dist/react/flow/api/react/components/NodeWrapper/index.d.ts +4 -0
- package/dist/react/flow/api/react/components/NodeWrapper/useNodeObserver.d.ts +7 -0
- package/dist/react/flow/api/react/components/NodeWrapper/utils.d.ts +8 -0
- package/dist/react/flow/api/react/components/Nodes/DefaultNode.d.ts +2 -0
- package/dist/react/flow/api/react/components/Nodes/GroupNode.d.ts +1 -0
- package/dist/react/flow/api/react/components/Nodes/InputNode.d.ts +2 -0
- package/dist/react/flow/api/react/components/Nodes/OutputNode.d.ts +2 -0
- package/dist/react/flow/api/react/components/Nodes/utils.d.ts +12 -0
- package/dist/react/flow/api/react/components/NodesSelection/index.d.ts +8 -0
- package/dist/react/flow/api/react/components/Panel/index.d.ts +8 -0
- package/dist/react/flow/api/react/components/ReactFlowProvider/index.d.ts +20 -0
- package/dist/react/flow/api/react/components/SelectionListener/index.d.ts +6 -0
- package/dist/react/flow/api/react/components/StoreUpdater/index.d.ts +67 -0
- package/dist/react/flow/api/react/components/UserSelection/index.d.ts +1 -0
- package/dist/react/flow/api/react/components/ViewportPortal/index.d.ts +4 -0
- package/dist/react/flow/api/react/container/EdgeRenderer/MarkerDefinitions.d.ts +9 -0
- package/dist/react/flow/api/react/container/EdgeRenderer/MarkerSymbols.d.ts +8 -0
- package/dist/react/flow/api/react/container/EdgeRenderer/index.d.ts +12 -0
- package/dist/react/flow/api/react/container/FlowRenderer/index.d.ts +13 -0
- package/dist/react/flow/api/react/container/GraphView/index.d.ts +10 -0
- package/dist/react/flow/api/react/container/GraphView/useNodeOrEdgeTypesWarning.d.ts +3 -0
- package/dist/react/flow/api/react/container/GraphView/useStylesLoadedWarning.d.ts +1 -0
- package/dist/react/flow/api/react/container/NodeRenderer/index.d.ts +9 -0
- package/dist/react/flow/api/react/container/NodeRenderer/useResizeObserver.d.ts +1 -0
- package/dist/react/flow/api/react/container/Pane/index.d.ts +10 -0
- package/dist/react/flow/api/react/container/ReactFlow/Wrapper.d.ts +19 -0
- package/dist/react/flow/api/react/container/ReactFlow/index.d.ts +3 -0
- package/dist/react/flow/api/react/container/ReactFlow/init-values.d.ts +3 -0
- package/dist/react/flow/api/react/container/Viewport/index.d.ts +6 -0
- package/dist/react/flow/api/react/container/ZoomPane/index.d.ts +7 -0
- package/dist/react/flow/api/react/contexts/HandleConfigContext.d.ts +11 -0
- package/dist/react/flow/api/react/contexts/NodeIdContext.d.ts +5 -0
- package/dist/react/flow/api/react/contexts/StoreContext.d.ts +3 -0
- package/dist/react/flow/api/react/hooks/useColorModeClass.d.ts +2 -0
- package/dist/react/flow/api/react/hooks/useConnection.d.ts +3 -0
- package/dist/react/flow/api/react/hooks/useDrag.d.ts +12 -0
- package/dist/react/flow/api/react/hooks/useEdges.d.ts +2 -0
- package/dist/react/flow/api/react/hooks/useGlobalKeyHandler.d.ts +5 -0
- package/dist/react/flow/api/react/hooks/useHandleConnections.d.ts +10 -0
- package/dist/react/flow/api/react/hooks/useInternalNode.d.ts +2 -0
- package/dist/react/flow/api/react/hooks/useIsomorphicLayoutEffect.d.ts +2 -0
- package/dist/react/flow/api/react/hooks/useKeyPress.d.ts +7 -0
- package/dist/react/flow/api/react/hooks/useMoveSelectedNodes.d.ts +5 -0
- package/dist/react/flow/api/react/hooks/useNodeConnections.d.ts +2 -0
- package/dist/react/flow/api/react/hooks/useNodes.d.ts +2 -0
- package/dist/react/flow/api/react/hooks/useNodesData.d.ts +4 -0
- package/dist/react/flow/api/react/hooks/useNodesEdgesState.d.ts +12 -0
- package/dist/react/flow/api/react/hooks/useNodesInitialized.d.ts +4 -0
- package/dist/react/flow/api/react/hooks/useOnEdgesChangeMiddleware.d.ts +3 -0
- package/dist/react/flow/api/react/hooks/useOnInitHandler.d.ts +2 -0
- package/dist/react/flow/api/react/hooks/useOnNodesChangeMiddleware.d.ts +3 -0
- package/dist/react/flow/api/react/hooks/useOnSelectionChange.d.ts +5 -0
- package/dist/react/flow/api/react/hooks/useOnViewportChange.d.ts +7 -0
- package/dist/react/flow/api/react/hooks/useReactFlow.d.ts +2 -0
- package/dist/react/flow/api/react/hooks/useResizeHandler.d.ts +2 -0
- package/dist/react/flow/api/react/hooks/useStore.d.ts +8 -0
- package/dist/react/flow/api/react/hooks/useUpdateNodeInternals.d.ts +2 -0
- package/dist/react/flow/api/react/hooks/useViewport.d.ts +2 -0
- package/dist/react/flow/api/react/hooks/useViewportHelper.d.ts +3 -0
- package/dist/react/flow/api/react/hooks/useViewportSync.d.ts +2 -0
- package/dist/react/flow/api/react/hooks/useVisibleEdgeIds.d.ts +1 -0
- package/dist/react/flow/api/react/hooks/useVisibleNodeIds.d.ts +1 -0
- package/dist/react/flow/api/react/index.d.ts +41 -0
- package/dist/react/flow/api/react/store/index.d.ts +18 -0
- package/dist/react/flow/api/react/store/initialState.d.ts +18 -0
- package/dist/react/flow/api/react/styles/utils.d.ts +2 -0
- package/dist/react/flow/api/react/types/component-props.d.ts +127 -0
- package/dist/react/flow/api/react/types/edges.d.ts +111 -0
- package/dist/react/flow/api/react/types/general.d.ts +53 -0
- package/dist/react/flow/api/react/types/index.d.ts +6 -0
- package/dist/react/flow/api/react/types/instance.d.ts +64 -0
- package/dist/react/flow/api/react/types/nodes.d.ts +41 -0
- package/dist/react/flow/api/react/types/store.d.ts +114 -0
- package/dist/react/flow/api/react/utils/changes.d.ts +15 -0
- package/dist/react/flow/api/react/utils/edges.d.ts +3 -0
- package/dist/react/flow/api/react/utils/general.d.ts +5 -0
- package/dist/react/flow/api/react/utils/index.d.ts +3 -0
- package/dist/react/flow/api/system/constants.d.ts +43 -0
- package/dist/react/flow/api/system/index.d.ts +8 -0
- package/dist/react/flow/api/system/types/changes.d.ts +48 -0
- package/dist/react/flow/api/system/types/edges.d.ts +72 -0
- package/dist/react/flow/api/system/types/general.d.ts +175 -0
- package/dist/react/flow/api/system/types/handles.d.ts +21 -0
- package/dist/react/flow/api/system/types/index.d.ts +7 -0
- package/dist/react/flow/api/system/types/nodes.d.ts +89 -0
- package/dist/react/flow/api/system/types/panzoom.d.ts +58 -0
- package/dist/react/flow/api/system/types/utils.d.ts +46 -0
- package/dist/react/flow/api/system/utils/attribution.d.ts +1 -0
- package/dist/react/flow/api/system/utils/connections.d.ts +4 -0
- package/dist/react/flow/api/system/utils/dom.d.ts +20 -0
- package/dist/react/flow/api/system/utils/edge-toolbar.d.ts +1 -0
- package/dist/react/flow/api/system/utils/edges/bezier-edge.d.ts +40 -0
- package/dist/react/flow/api/system/utils/edges/general.d.ts +44 -0
- package/dist/react/flow/api/system/utils/edges/index.d.ts +5 -0
- package/dist/react/flow/api/system/utils/edges/positions.d.ts +16 -0
- package/dist/react/flow/api/system/utils/edges/smoothstep-edge.d.ts +21 -0
- package/dist/react/flow/api/system/utils/edges/straight-edge.d.ts +13 -0
- package/dist/react/flow/api/system/utils/general.d.ts +56 -0
- package/dist/react/flow/api/system/utils/graph.d.ts +45 -0
- package/dist/react/flow/api/system/utils/index.d.ts +12 -0
- package/dist/react/flow/api/system/utils/marker.d.ts +8 -0
- package/dist/react/flow/api/system/utils/node-toolbar.d.ts +2 -0
- package/dist/react/flow/api/system/utils/shallow-node-data.d.ts +4 -0
- package/dist/react/flow/api/system/utils/store.d.ts +33 -0
- package/dist/react/flow/api/system/utils/types.d.ts +7 -0
- package/dist/react/flow/api/system/xydrag/XYDrag.d.ts +56 -0
- package/dist/react/flow/api/system/xydrag/index.d.ts +1 -0
- package/dist/react/flow/api/system/xydrag/utils.d.ts +22 -0
- package/dist/react/flow/api/system/xyhandle/XYHandle.d.ts +2 -0
- package/dist/react/flow/api/system/xyhandle/index.d.ts +1 -0
- package/dist/react/flow/api/system/xyhandle/types.d.ts +49 -0
- package/dist/react/flow/api/system/xyhandle/utils.d.ts +9 -0
- package/dist/react/flow/api/system/xyminimap/index.d.ts +27 -0
- package/dist/react/flow/api/system/xypanzoom/XYPanZoom.d.ts +11 -0
- package/dist/react/flow/api/system/xypanzoom/eventhandler.d.ts +45 -0
- package/dist/react/flow/api/system/xypanzoom/filter.d.ts +15 -0
- package/dist/react/flow/api/system/xypanzoom/index.d.ts +1 -0
- package/dist/react/flow/api/system/xypanzoom/utils.d.ts +8 -0
- package/dist/react/flow/api/system/xyresizer/XYResizer.d.ts +51 -0
- package/dist/react/flow/api/system/xyresizer/index.d.ts +2 -0
- package/dist/react/flow/api/system/xyresizer/types.d.ts +26 -0
- package/dist/react/flow/api/system/xyresizer/utils.d.ts +41 -0
- package/dist/react/flow/components.d.ts +148 -0
- package/dist/react/flow/components.js +526 -0
- package/dist/react/flow/configuration.d.ts +6 -0
- package/dist/react/flow/configuration.js +27 -0
- package/dist/react/flow/drag.d.ts +14 -0
- package/dist/react/flow/drag.js +273 -0
- package/dist/react/flow/extras.d.ts +155 -0
- package/dist/react/flow/extras.js +317 -0
- package/dist/react/flow/handle.d.ts +21 -0
- package/dist/react/flow/handle.js +149 -0
- package/dist/react/flow/hooks.d.ts +47 -0
- package/dist/react/flow/hooks.js +131 -0
- package/dist/react/flow/index.d.ts +78 -0
- package/dist/react/flow/index.js +73 -0
- package/dist/react/flow/queries.d.ts +20 -0
- package/dist/react/flow/queries.js +30 -0
- package/dist/react/flow/react-flow.d.ts +73 -0
- package/dist/react/flow/react-flow.js +1445 -0
- package/dist/react/flow/resize.d.ts +30 -0
- package/dist/react/flow/resize.js +49 -0
- package/dist/react/flow/store.d.ts +412 -0
- package/dist/react/flow/store.js +713 -0
- package/dist/react/flow/style.css +630 -0
- package/dist/react/flow/style.css.d.ts +2 -0
- package/dist/react/flow/system.d.ts +146 -0
- package/dist/react/flow/system.js +300 -0
- package/dist/react/flow/types.d.ts +131 -0
- package/dist/react/flow/types.js +1 -0
- package/dist/react/flow/utils.d.ts +77 -0
- package/dist/react/flow/utils.js +285 -0
- package/dist/react/hooks.d.ts +14 -0
- package/dist/react/hooks.js +44 -0
- package/dist/react/index.d.ts +3 -0
- package/dist/react/index.js +5 -0
- package/dist/render/backend.d.ts +26 -0
- package/dist/render/backend.js +5 -0
- package/dist/render/canvas2d/backend.d.ts +7 -0
- package/dist/render/canvas2d/backend.js +122 -0
- package/dist/render/canvas2d/index.d.ts +1 -0
- package/dist/render/canvas2d/index.js +2 -0
- package/dist/render/color.d.ts +9 -0
- package/dist/render/color.js +69 -0
- package/dist/render/commands.d.ts +69 -0
- package/dist/render/commands.js +1 -0
- package/dist/render/display-list.d.ts +65 -0
- package/dist/render/display-list.js +316 -0
- package/dist/render/images.d.ts +35 -0
- package/dist/render/images.js +83 -0
- package/dist/render/index.d.ts +14 -0
- package/dist/render/index.js +16 -0
- package/dist/render/painters.d.ts +35 -0
- package/dist/render/painters.js +109 -0
- package/dist/render/renderer.d.ts +70 -0
- package/dist/render/renderer.js +162 -0
- package/dist/render/scene-index.d.ts +21 -0
- package/dist/render/scene-index.js +64 -0
- package/dist/render/text.d.ts +8 -0
- package/dist/render/text.js +100 -0
- package/dist/render/theme.d.ts +21 -0
- package/dist/render/theme.js +33 -0
- package/dist/render/ui.d.ts +63 -0
- package/dist/render/ui.js +188 -0
- package/dist/render/webgl2/atlas.d.ts +36 -0
- package/dist/render/webgl2/atlas.js +93 -0
- package/dist/render/webgl2/backend.d.ts +19 -0
- package/dist/render/webgl2/backend.js +338 -0
- package/dist/render/webgl2/index.d.ts +2 -0
- package/dist/render/webgl2/index.js +3 -0
- package/dist/render/webgl2/shaders.d.ts +6 -0
- package/dist/render/webgl2/shaders.js +112 -0
- package/dist/render/webgpu/index.d.ts +1 -0
- package/dist/render/webgpu/index.js +3 -0
- package/dist/scene/builtins.d.ts +25 -0
- package/dist/scene/builtins.js +60 -0
- package/dist/scene/dirty.d.ts +11 -0
- package/dist/scene/dirty.js +10 -0
- package/dist/scene/index.d.ts +5 -0
- package/dist/scene/index.js +5 -0
- package/dist/scene/record.d.ts +40 -0
- package/dist/scene/record.js +12 -0
- package/dist/scene/scene-graph.d.ts +58 -0
- package/dist/scene/scene-graph.js +178 -0
- package/dist/scene/schema.d.ts +27 -0
- package/dist/scene/schema.js +32 -0
- package/dist/sdk/create-avis.d.ts +109 -0
- package/dist/sdk/create-avis.js +162 -0
- package/dist/sdk/index.d.ts +1 -0
- package/dist/sdk/index.js +2 -0
- package/dist/serialization/format.d.ts +46 -0
- package/dist/serialization/format.js +20 -0
- package/dist/serialization/index.d.ts +3 -0
- package/dist/serialization/index.js +3 -0
- package/dist/serialization/migrate.d.ts +7 -0
- package/dist/serialization/migrate.js +54 -0
- package/dist/serialization/serialize.d.ts +10 -0
- package/dist/serialization/serialize.js +114 -0
- package/dist/state/index.d.ts +2 -0
- package/dist/state/index.js +2 -0
- package/dist/state/selector.d.ts +6 -0
- package/dist/state/selector.js +29 -0
- package/dist/state/store.d.ts +91 -0
- package/dist/state/store.js +102 -0
- package/dist/style/computed.d.ts +84 -0
- package/dist/style/computed.js +296 -0
- package/dist/style/index.d.ts +6 -0
- package/dist/style/index.js +8 -0
- package/dist/style/style-engine.d.ts +33 -0
- package/dist/style/style-engine.js +113 -0
- package/dist/style/tokens.d.ts +49 -0
- package/dist/style/tokens.js +142 -0
- package/dist/style/utilities.d.ts +34 -0
- package/dist/style/utilities.js +341 -0
- package/dist/style/values.d.ts +30 -0
- package/dist/style/values.js +361 -0
- package/dist/style/variants.d.ts +38 -0
- package/dist/style/variants.js +55 -0
- package/dist/sync/index.d.ts +2 -0
- package/dist/sync/index.js +1 -0
- package/dist/sync/save-queue.d.ts +24 -0
- package/dist/sync/save-queue.js +88 -0
- package/dist/wasm/index.d.ts +2 -0
- package/dist/wasm/index.js +2 -0
- package/dist/wasm/load.d.ts +7 -0
- package/dist/wasm/load.js +47 -0
- package/dist/wasm/pkg/avis_engine_wasm.d.ts +84 -0
- package/dist/wasm/pkg/avis_engine_wasm.js +339 -0
- package/dist/wasm/pkg/avis_engine_wasm_bg.wasm +0 -0
- package/dist/wasm/reference.d.ts +38 -0
- package/dist/wasm/reference.js +174 -0
- package/package.json +76 -4
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A uniform grid of boxes for viewport culling and hit candidates. Items
|
|
6
|
+
* spanning more than `MAX_CELLS` cells sit in a list checked one by one.
|
|
7
|
+
*/
|
|
8
|
+
export class SpatialGrid {
|
|
9
|
+
free(): void;
|
|
10
|
+
[Symbol.dispose](): void;
|
|
11
|
+
clear(): void;
|
|
12
|
+
/**
|
|
13
|
+
* Adds the item, or moves it when it is there.
|
|
14
|
+
*/
|
|
15
|
+
insert(id: number, min_x: number, min_y: number, max_x: number, max_y: number): void;
|
|
16
|
+
constructor(cell: number);
|
|
17
|
+
/**
|
|
18
|
+
* The ids whose box meets the query box (edges touching count), sorted.
|
|
19
|
+
*/
|
|
20
|
+
query(min_x: number, min_y: number, max_x: number, max_y: number): Uint32Array;
|
|
21
|
+
remove(id: number): void;
|
|
22
|
+
readonly size: number;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* `a × b` for 2D affine matrices stored as `[a, b, c, d, e, f]` (the
|
|
27
|
+
* canvas `setTransform` order): the Phase 1 parity probe.
|
|
28
|
+
*/
|
|
29
|
+
export function mat2d_multiply(a: Float64Array | number[], b: Float64Array | number[]): Float64Array;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Triangles (x, y pairs, 6 vertices a segment) for a cubic curve stroked
|
|
33
|
+
* `half_width` to each side, sampled in `segments` steps. The curve is
|
|
34
|
+
* `[x0, y0, x1, y1, x2, y2, x3, y3]` (`bezierControls`). Normals come from
|
|
35
|
+
* central differences between samples.
|
|
36
|
+
*/
|
|
37
|
+
export function stroke_bezier(controls: Float64Array | number[], half_width: number, segments: number): Float32Array;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The crate version, to check which build the page loaded.
|
|
41
|
+
*/
|
|
42
|
+
export function version(): string;
|
|
43
|
+
|
|
44
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
45
|
+
|
|
46
|
+
export interface InitOutput {
|
|
47
|
+
readonly memory: WebAssembly.Memory;
|
|
48
|
+
readonly __wbg_spatialgrid_free: (a: number, b: number) => void;
|
|
49
|
+
readonly mat2d_multiply: (a: number, b: number, c: number, d: number) => [number, number];
|
|
50
|
+
readonly spatialgrid_clear: (a: number) => void;
|
|
51
|
+
readonly spatialgrid_insert: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
52
|
+
readonly spatialgrid_new: (a: number) => number;
|
|
53
|
+
readonly spatialgrid_query: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
54
|
+
readonly spatialgrid_remove: (a: number, b: number) => void;
|
|
55
|
+
readonly spatialgrid_size: (a: number) => number;
|
|
56
|
+
readonly stroke_bezier: (a: number, b: number, c: number, d: number) => [number, number];
|
|
57
|
+
readonly version: () => [number, number];
|
|
58
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
59
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
60
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
61
|
+
readonly __wbindgen_start: () => void;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
68
|
+
* a precompiled `WebAssembly.Module`.
|
|
69
|
+
*
|
|
70
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
71
|
+
*
|
|
72
|
+
* @returns {InitOutput}
|
|
73
|
+
*/
|
|
74
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
78
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
79
|
+
*
|
|
80
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
81
|
+
*
|
|
82
|
+
* @returns {Promise<InitOutput>}
|
|
83
|
+
*/
|
|
84
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
/* @ts-self-types="./avis_engine_wasm.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A uniform grid of boxes for viewport culling and hit candidates. Items
|
|
5
|
+
* spanning more than `MAX_CELLS` cells sit in a list checked one by one.
|
|
6
|
+
*/
|
|
7
|
+
export class SpatialGrid {
|
|
8
|
+
__destroy_into_raw() {
|
|
9
|
+
const ptr = this.__wbg_ptr;
|
|
10
|
+
this.__wbg_ptr = 0;
|
|
11
|
+
SpatialGridFinalization.unregister(this);
|
|
12
|
+
return ptr;
|
|
13
|
+
}
|
|
14
|
+
free() {
|
|
15
|
+
const ptr = this.__destroy_into_raw();
|
|
16
|
+
wasm.__wbg_spatialgrid_free(ptr, 0);
|
|
17
|
+
}
|
|
18
|
+
clear() {
|
|
19
|
+
wasm.spatialgrid_clear(this.__wbg_ptr);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Adds the item, or moves it when it is there.
|
|
23
|
+
* @param {number} id
|
|
24
|
+
* @param {number} min_x
|
|
25
|
+
* @param {number} min_y
|
|
26
|
+
* @param {number} max_x
|
|
27
|
+
* @param {number} max_y
|
|
28
|
+
*/
|
|
29
|
+
insert(id, min_x, min_y, max_x, max_y) {
|
|
30
|
+
wasm.spatialgrid_insert(this.__wbg_ptr, id, min_x, min_y, max_x, max_y);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @param {number} cell
|
|
34
|
+
*/
|
|
35
|
+
constructor(cell) {
|
|
36
|
+
const ret = wasm.spatialgrid_new(cell);
|
|
37
|
+
this.__wbg_ptr = ret;
|
|
38
|
+
SpatialGridFinalization.register(this, this.__wbg_ptr, this);
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The ids whose box meets the query box (edges touching count), sorted.
|
|
43
|
+
* @param {number} min_x
|
|
44
|
+
* @param {number} min_y
|
|
45
|
+
* @param {number} max_x
|
|
46
|
+
* @param {number} max_y
|
|
47
|
+
* @returns {Uint32Array}
|
|
48
|
+
*/
|
|
49
|
+
query(min_x, min_y, max_x, max_y) {
|
|
50
|
+
const ret = wasm.spatialgrid_query(this.__wbg_ptr, min_x, min_y, max_x, max_y);
|
|
51
|
+
var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
52
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
53
|
+
return v1;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* @param {number} id
|
|
57
|
+
*/
|
|
58
|
+
remove(id) {
|
|
59
|
+
wasm.spatialgrid_remove(this.__wbg_ptr, id);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* @returns {number}
|
|
63
|
+
*/
|
|
64
|
+
get size() {
|
|
65
|
+
const ret = wasm.spatialgrid_size(this.__wbg_ptr);
|
|
66
|
+
return ret >>> 0;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (Symbol.dispose) SpatialGrid.prototype[Symbol.dispose] = SpatialGrid.prototype.free;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* `a × b` for 2D affine matrices stored as `[a, b, c, d, e, f]` (the
|
|
73
|
+
* canvas `setTransform` order): the Phase 1 parity probe.
|
|
74
|
+
* @param {Float64Array | number[]} a
|
|
75
|
+
* @param {Float64Array | number[]} b
|
|
76
|
+
* @returns {Float64Array}
|
|
77
|
+
*/
|
|
78
|
+
export function mat2d_multiply(a, b) {
|
|
79
|
+
let ptr0, len0, ptr1, len1;
|
|
80
|
+
try {
|
|
81
|
+
ptr0 = passArrayF64ToWasm0(a, wasm.__wbindgen_malloc);
|
|
82
|
+
len0 = WASM_VECTOR_LEN;
|
|
83
|
+
ptr1 = passArrayF64ToWasm0(b, wasm.__wbindgen_malloc);
|
|
84
|
+
len1 = WASM_VECTOR_LEN;
|
|
85
|
+
} catch (e) {
|
|
86
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 8, 8); }
|
|
87
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 8, 8); }
|
|
88
|
+
throw e;
|
|
89
|
+
}
|
|
90
|
+
const ret = wasm.mat2d_multiply(ptr0, len0, ptr1, len1);
|
|
91
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
92
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
93
|
+
return v3;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Triangles (x, y pairs, 6 vertices a segment) for a cubic curve stroked
|
|
98
|
+
* `half_width` to each side, sampled in `segments` steps. The curve is
|
|
99
|
+
* `[x0, y0, x1, y1, x2, y2, x3, y3]` (`bezierControls`). Normals come from
|
|
100
|
+
* central differences between samples.
|
|
101
|
+
* @param {Float64Array | number[]} controls
|
|
102
|
+
* @param {number} half_width
|
|
103
|
+
* @param {number} segments
|
|
104
|
+
* @returns {Float32Array}
|
|
105
|
+
*/
|
|
106
|
+
export function stroke_bezier(controls, half_width, segments) {
|
|
107
|
+
const val2 = +half_width;
|
|
108
|
+
const val3 = +segments;
|
|
109
|
+
const ptr0 = passArrayF64ToWasm0(controls, wasm.__wbindgen_malloc);
|
|
110
|
+
const len0 = WASM_VECTOR_LEN;
|
|
111
|
+
const ret = wasm.stroke_bezier(ptr0, len0, val2, val3);
|
|
112
|
+
var v4 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
113
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
114
|
+
return v4;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* The crate version, to check which build the page loaded.
|
|
119
|
+
* @returns {string}
|
|
120
|
+
*/
|
|
121
|
+
export function version() {
|
|
122
|
+
let deferred1_0;
|
|
123
|
+
let deferred1_1;
|
|
124
|
+
try {
|
|
125
|
+
const ret = wasm.version();
|
|
126
|
+
deferred1_0 = ret[0];
|
|
127
|
+
deferred1_1 = ret[1];
|
|
128
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
129
|
+
} finally {
|
|
130
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
function __wbg_get_imports() {
|
|
134
|
+
const import0 = {
|
|
135
|
+
__proto__: null,
|
|
136
|
+
__wbg___wbindgen_throw_4c88d8bf264fd984: function(arg0, arg1) {
|
|
137
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
138
|
+
},
|
|
139
|
+
__wbindgen_init_externref_table: function() {
|
|
140
|
+
const table = wasm.__wbindgen_externrefs;
|
|
141
|
+
table.set(0, undefined);
|
|
142
|
+
table.set(1024, undefined);
|
|
143
|
+
table.set(1025, null);
|
|
144
|
+
table.set(1026, true);
|
|
145
|
+
table.set(1027, false);
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
return {
|
|
149
|
+
__proto__: null,
|
|
150
|
+
"./avis_engine_wasm_bg.js": import0,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const SpatialGridFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
155
|
+
? { register: () => {}, unregister: () => {} }
|
|
156
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_spatialgrid_free(ptr, 1));
|
|
157
|
+
|
|
158
|
+
function getArrayF32FromWasm0(ptr, len) {
|
|
159
|
+
ptr = ptr >>> 0;
|
|
160
|
+
return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function getArrayF64FromWasm0(ptr, len) {
|
|
164
|
+
ptr = ptr >>> 0;
|
|
165
|
+
return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function getArrayU32FromWasm0(ptr, len) {
|
|
169
|
+
ptr = ptr >>> 0;
|
|
170
|
+
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
let cachedFloat32ArrayMemory0 = null;
|
|
174
|
+
function getFloat32ArrayMemory0() {
|
|
175
|
+
if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
|
|
176
|
+
cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
|
|
177
|
+
}
|
|
178
|
+
return cachedFloat32ArrayMemory0;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
let cachedFloat64ArrayMemory0 = null;
|
|
182
|
+
function getFloat64ArrayMemory0() {
|
|
183
|
+
if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
|
|
184
|
+
cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer);
|
|
185
|
+
}
|
|
186
|
+
return cachedFloat64ArrayMemory0;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function getStringFromWasm0(ptr, len) {
|
|
190
|
+
ptr = ptr >>> 0;
|
|
191
|
+
return decodeText(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
let cachedUint32ArrayMemory0 = null;
|
|
195
|
+
function getUint32ArrayMemory0() {
|
|
196
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
197
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
198
|
+
}
|
|
199
|
+
return cachedUint32ArrayMemory0;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
let cachedUint8ArrayMemory0 = null;
|
|
203
|
+
function getUint8ArrayMemory0() {
|
|
204
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
205
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
206
|
+
}
|
|
207
|
+
return cachedUint8ArrayMemory0;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function passArrayF64ToWasm0(arg, malloc) {
|
|
211
|
+
const ptr = malloc(arg.length * 8, 8) >>> 0;
|
|
212
|
+
getFloat64ArrayMemory0().set(arg, ptr / 8);
|
|
213
|
+
WASM_VECTOR_LEN = arg.length;
|
|
214
|
+
return ptr;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
|
|
218
|
+
cachedTextDecoder.decode();
|
|
219
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
220
|
+
let numBytesDecoded = 0;
|
|
221
|
+
function decodeText(bytes) {
|
|
222
|
+
numBytesDecoded += bytes.length;
|
|
223
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
224
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
|
|
225
|
+
cachedTextDecoder.decode();
|
|
226
|
+
numBytesDecoded = bytes.length;
|
|
227
|
+
}
|
|
228
|
+
return cachedTextDecoder.decode(bytes);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
let WASM_VECTOR_LEN = 0;
|
|
232
|
+
|
|
233
|
+
let wasmModule, wasmInstance, wasm;
|
|
234
|
+
function __wbg_finalize_init(instance, module) {
|
|
235
|
+
wasmInstance = instance;
|
|
236
|
+
wasm = instance.exports;
|
|
237
|
+
wasmModule = module;
|
|
238
|
+
cachedFloat32ArrayMemory0 = null;
|
|
239
|
+
cachedFloat64ArrayMemory0 = null;
|
|
240
|
+
cachedUint32ArrayMemory0 = null;
|
|
241
|
+
cachedUint8ArrayMemory0 = null;
|
|
242
|
+
wasm.__wbindgen_start();
|
|
243
|
+
return wasm;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
async function __wbg_load(module, imports) {
|
|
247
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
248
|
+
if (!module.ok) {
|
|
249
|
+
throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
253
|
+
try {
|
|
254
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
255
|
+
} catch (e) {
|
|
256
|
+
const validResponse = expectedResponseType(module.type);
|
|
257
|
+
|
|
258
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
259
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
260
|
+
|
|
261
|
+
} else { throw e; }
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
const bytes = await module.arrayBuffer();
|
|
266
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
267
|
+
} else {
|
|
268
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
269
|
+
|
|
270
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
271
|
+
return { instance, module };
|
|
272
|
+
} else {
|
|
273
|
+
return instance;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
function expectedResponseType(type) {
|
|
278
|
+
switch (type) {
|
|
279
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
280
|
+
}
|
|
281
|
+
return false;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
function initSync(module) {
|
|
286
|
+
if (wasm !== undefined) return wasm;
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
if (module !== undefined) {
|
|
290
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
291
|
+
({module} = module)
|
|
292
|
+
} else {
|
|
293
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
const imports = __wbg_get_imports();
|
|
298
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
299
|
+
module = new WebAssembly.Module(module);
|
|
300
|
+
}
|
|
301
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
302
|
+
return __wbg_finalize_init(instance, module);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
let __wbg_init_promise;
|
|
306
|
+
async function __wbg_init(module_or_path) {
|
|
307
|
+
if (wasm !== undefined) return wasm;
|
|
308
|
+
if (__wbg_init_promise === undefined) {
|
|
309
|
+
__wbg_init_promise = __wbg_init_once(module_or_path);
|
|
310
|
+
__wbg_init_promise.catch(() => { __wbg_init_promise = undefined; });
|
|
311
|
+
}
|
|
312
|
+
return __wbg_init_promise;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
async function __wbg_init_once(module_or_path) {
|
|
316
|
+
|
|
317
|
+
if (module_or_path !== undefined) {
|
|
318
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
319
|
+
({module_or_path} = module_or_path)
|
|
320
|
+
} else {
|
|
321
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
if (module_or_path === undefined) {
|
|
326
|
+
module_or_path = new URL('avis_engine_wasm_bg.wasm', import.meta.url);
|
|
327
|
+
}
|
|
328
|
+
const imports = __wbg_get_imports();
|
|
329
|
+
|
|
330
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
331
|
+
module_or_path = fetch(module_or_path);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
335
|
+
|
|
336
|
+
return __wbg_finalize_init(instance, module);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
export { initSync, __wbg_init as default };
|
|
Binary file
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** A uniform grid of boxes (viewport culling, hit candidates). */
|
|
2
|
+
export interface SpatialGrid {
|
|
3
|
+
readonly size: number;
|
|
4
|
+
/** Adds the item, or moves it when it is there. */
|
|
5
|
+
insert(id: number, minX: number, minY: number, maxX: number, maxY: number): void;
|
|
6
|
+
remove(id: number): void;
|
|
7
|
+
clear(): void;
|
|
8
|
+
/** The ids whose box meets the query box (touching counts), sorted. */
|
|
9
|
+
query(minX: number, minY: number, maxX: number, maxY: number): Uint32Array;
|
|
10
|
+
/** Frees WASM memory (a no-op in TypeScript). */
|
|
11
|
+
free?(): void;
|
|
12
|
+
}
|
|
13
|
+
export declare class ReferenceGrid implements SpatialGrid {
|
|
14
|
+
private readonly cell;
|
|
15
|
+
private cells;
|
|
16
|
+
private items;
|
|
17
|
+
private big;
|
|
18
|
+
constructor(cell: number);
|
|
19
|
+
get size(): number;
|
|
20
|
+
private range;
|
|
21
|
+
insert(id: number, minX: number, minY: number, maxX: number, maxY: number): void;
|
|
22
|
+
remove(id: number): void;
|
|
23
|
+
clear(): void;
|
|
24
|
+
query(minX: number, minY: number, maxX: number, maxY: number): Uint32Array<ArrayBuffer>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Triangles (x, y pairs, 6 vertices a segment) for a cubic curve stroked
|
|
28
|
+
* `halfWidth` to each side, in `segments` steps; normals from central
|
|
29
|
+
* differences.
|
|
30
|
+
*/
|
|
31
|
+
export declare function strokeBezier(controls: ArrayLike<number>, halfWidth: number, segments: number): Float32Array;
|
|
32
|
+
export type Kernels = {
|
|
33
|
+
version(): string;
|
|
34
|
+
mat2d_multiply(a: Float64Array, b: Float64Array): Float64Array;
|
|
35
|
+
createSpatialGrid(cell: number): SpatialGrid;
|
|
36
|
+
strokeBezier(controls: ArrayLike<number>, halfWidth: number, segments: number): Float32Array;
|
|
37
|
+
};
|
|
38
|
+
export declare const referenceKernels: Kernels;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The TypeScript reference of every WASM kernel: what the engine runs when
|
|
3
|
+
* the WASM build isn't there, and what parity tests compare against. Each
|
|
4
|
+
* follows `wasm/src/lib.rs` step for step.
|
|
5
|
+
*/
|
|
6
|
+
import { multiply } from "../geometry/matrix.js";
|
|
7
|
+
const MAX_CELLS = 256;
|
|
8
|
+
export class ReferenceGrid {
|
|
9
|
+
cell;
|
|
10
|
+
cells = new Map();
|
|
11
|
+
items = new Map();
|
|
12
|
+
big = new Set();
|
|
13
|
+
constructor(cell) {
|
|
14
|
+
this.cell = cell > 0 ? cell : 256;
|
|
15
|
+
}
|
|
16
|
+
get size() {
|
|
17
|
+
return this.items.size;
|
|
18
|
+
}
|
|
19
|
+
range(minX, minY, maxX, maxY) {
|
|
20
|
+
const c = this.cell;
|
|
21
|
+
return [Math.floor(minX / c), Math.floor(minY / c), Math.floor(maxX / c), Math.floor(maxY / c)];
|
|
22
|
+
}
|
|
23
|
+
insert(id, minX, minY, maxX, maxY) {
|
|
24
|
+
this.remove(id);
|
|
25
|
+
if (!(minX <= maxX && minY <= maxY))
|
|
26
|
+
return;
|
|
27
|
+
const r = this.range(minX, minY, maxX, maxY);
|
|
28
|
+
const count = (r[2] - r[0] + 1) * (r[3] - r[1] + 1);
|
|
29
|
+
let range = null;
|
|
30
|
+
if (count > MAX_CELLS) {
|
|
31
|
+
this.big.add(id);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
for (let x = r[0]; x <= r[2]; x++) {
|
|
35
|
+
for (let y = r[1]; y <= r[3]; y++) {
|
|
36
|
+
const key = `${x},${y}`;
|
|
37
|
+
const list = this.cells.get(key);
|
|
38
|
+
if (list)
|
|
39
|
+
list.push(id);
|
|
40
|
+
else
|
|
41
|
+
this.cells.set(key, [id]);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
range = r;
|
|
45
|
+
}
|
|
46
|
+
this.items.set(id, { bounds: [minX, minY, maxX, maxY], range });
|
|
47
|
+
}
|
|
48
|
+
remove(id) {
|
|
49
|
+
const item = this.items.get(id);
|
|
50
|
+
if (!item)
|
|
51
|
+
return;
|
|
52
|
+
this.items.delete(id);
|
|
53
|
+
if (!item.range) {
|
|
54
|
+
this.big.delete(id);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const r = item.range;
|
|
58
|
+
for (let x = r[0]; x <= r[2]; x++) {
|
|
59
|
+
for (let y = r[1]; y <= r[3]; y++) {
|
|
60
|
+
const key = `${x},${y}`;
|
|
61
|
+
const list = this.cells.get(key);
|
|
62
|
+
if (!list)
|
|
63
|
+
continue;
|
|
64
|
+
const next = list.filter((each) => each !== id);
|
|
65
|
+
if (next.length)
|
|
66
|
+
this.cells.set(key, next);
|
|
67
|
+
else
|
|
68
|
+
this.cells.delete(key);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
clear() {
|
|
73
|
+
this.cells.clear();
|
|
74
|
+
this.items.clear();
|
|
75
|
+
this.big.clear();
|
|
76
|
+
}
|
|
77
|
+
query(minX, minY, maxX, maxY) {
|
|
78
|
+
const found = new Set();
|
|
79
|
+
const hits = (b) => b[0] <= maxX && b[2] >= minX && b[1] <= maxY && b[3] >= minY;
|
|
80
|
+
const r = this.range(minX, minY, maxX, maxY);
|
|
81
|
+
const count = (r[2] - r[0] + 1) * (r[3] - r[1] + 1);
|
|
82
|
+
const visit = (list) => {
|
|
83
|
+
for (const id of list)
|
|
84
|
+
if (hits(this.items.get(id).bounds))
|
|
85
|
+
found.add(id);
|
|
86
|
+
};
|
|
87
|
+
if (count > this.cells.size) {
|
|
88
|
+
// A query bigger than the filled cells: walk the cells instead.
|
|
89
|
+
for (const [key, list] of this.cells) {
|
|
90
|
+
const [x, y] = key.split(",").map(Number);
|
|
91
|
+
if (x < r[0] || x > r[2] || y < r[1] || y > r[3])
|
|
92
|
+
continue;
|
|
93
|
+
visit(list);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
for (let x = r[0]; x <= r[2]; x++) {
|
|
98
|
+
for (let y = r[1]; y <= r[3]; y++) {
|
|
99
|
+
const list = this.cells.get(`${x},${y}`);
|
|
100
|
+
if (list)
|
|
101
|
+
visit(list);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
for (const id of this.big)
|
|
106
|
+
if (hits(this.items.get(id).bounds))
|
|
107
|
+
found.add(id);
|
|
108
|
+
return Uint32Array.from([...found].sort((a, b) => a - b));
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Triangles (x, y pairs, 6 vertices a segment) for a cubic curve stroked
|
|
113
|
+
* `halfWidth` to each side, in `segments` steps; normals from central
|
|
114
|
+
* differences.
|
|
115
|
+
*/
|
|
116
|
+
export function strokeBezier(controls, halfWidth, segments) {
|
|
117
|
+
if (controls.length !== 8 || segments <= 0)
|
|
118
|
+
return new Float32Array(0);
|
|
119
|
+
const n = Math.floor(segments);
|
|
120
|
+
const px = new Float64Array(n + 1);
|
|
121
|
+
const py = new Float64Array(n + 1);
|
|
122
|
+
for (let i = 0; i <= n; i++) {
|
|
123
|
+
const t = i / n;
|
|
124
|
+
const u = 1 - t;
|
|
125
|
+
const a = u * u * u;
|
|
126
|
+
const b = 3 * u * u * t;
|
|
127
|
+
const c = 3 * u * t * t;
|
|
128
|
+
const d = t * t * t;
|
|
129
|
+
px[i] = a * controls[0] + b * controls[2] + c * controls[4] + d * controls[6];
|
|
130
|
+
py[i] = a * controls[1] + b * controls[3] + c * controls[5] + d * controls[7];
|
|
131
|
+
}
|
|
132
|
+
const left = new Float64Array((n + 1) * 2);
|
|
133
|
+
const right = new Float64Array((n + 1) * 2);
|
|
134
|
+
for (let i = 0; i <= n; i++) {
|
|
135
|
+
const next = i < n ? i + 1 : n;
|
|
136
|
+
const previous = i > 0 ? i - 1 : 0;
|
|
137
|
+
let dx = px[next] - px[previous];
|
|
138
|
+
let dy = py[next] - py[previous];
|
|
139
|
+
const length = Math.sqrt(dx * dx + dy * dy);
|
|
140
|
+
if (length > 0) {
|
|
141
|
+
dx /= length;
|
|
142
|
+
dy /= length;
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
dx = 1;
|
|
146
|
+
dy = 0;
|
|
147
|
+
}
|
|
148
|
+
left[i * 2] = px[i] - dy * halfWidth;
|
|
149
|
+
left[i * 2 + 1] = py[i] + dx * halfWidth;
|
|
150
|
+
right[i * 2] = px[i] + dy * halfWidth;
|
|
151
|
+
right[i * 2 + 1] = py[i] - dx * halfWidth;
|
|
152
|
+
}
|
|
153
|
+
const out = new Float32Array(n * 12);
|
|
154
|
+
let k = 0;
|
|
155
|
+
const push = (side, i) => {
|
|
156
|
+
out[k++] = side[i * 2];
|
|
157
|
+
out[k++] = side[i * 2 + 1];
|
|
158
|
+
};
|
|
159
|
+
for (let i = 0; i < n; i++) {
|
|
160
|
+
push(left, i);
|
|
161
|
+
push(right, i);
|
|
162
|
+
push(left, i + 1);
|
|
163
|
+
push(right, i);
|
|
164
|
+
push(right, i + 1);
|
|
165
|
+
push(left, i + 1);
|
|
166
|
+
}
|
|
167
|
+
return out;
|
|
168
|
+
}
|
|
169
|
+
export const referenceKernels = {
|
|
170
|
+
version: () => "ts-reference",
|
|
171
|
+
mat2d_multiply: (a, b) => multiply(new Float64Array(6), a, b),
|
|
172
|
+
createSpatialGrid: (cell) => new ReferenceGrid(cell),
|
|
173
|
+
strokeBezier,
|
|
174
|
+
};
|