@weasel-js/core 1.7.0 → 1.7.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/CHANGELOG.md +764 -0
- package/README.md +7 -8
- package/dist/WeaselProvider.js +15 -0
- package/dist/WeaselProvider.js.map +1 -0
- package/dist/affordances/composeAffordanceLayer.js +224 -0
- package/dist/affordances/composeAffordanceLayer.js.map +1 -0
- package/dist/affordances/cornerResize.js +69 -0
- package/dist/affordances/cornerResize.js.map +1 -0
- package/dist/affordances/hitAffordanceRegions.js +138 -0
- package/dist/affordances/hitAffordanceRegions.js.map +1 -0
- package/dist/affordances/pathAnchors.js +66 -0
- package/dist/affordances/pathAnchors.js.map +1 -0
- package/dist/affordances/rotationHandle.js +103 -0
- package/dist/affordances/rotationHandle.js.map +1 -0
- package/dist/animation/behaviors/momentum.js +118 -0
- package/dist/animation/behaviors/momentum.js.map +1 -0
- package/dist/animation/colorHelpers.js +135 -0
- package/dist/animation/colorHelpers.js.map +1 -0
- package/dist/animation/colorRegistry.js +37 -0
- package/dist/animation/colorRegistry.js.map +1 -0
- package/dist/animation/index.js +20 -0
- package/dist/animation/loop.js +62 -0
- package/dist/animation/loop.js.map +1 -0
- package/dist/animation/observe.js +23 -0
- package/dist/animation/observe.js.map +1 -0
- package/dist/animation/poseHelpers.js +50 -0
- package/dist/animation/poseHelpers.js.map +1 -0
- package/dist/animation/reflow.js +121 -0
- package/dist/animation/reflow.js.map +1 -0
- package/dist/animation/rig/bindRig.js +74 -0
- package/dist/animation/rig/bindRig.js.map +1 -0
- package/dist/animation/rig/blendPoses.js +43 -0
- package/dist/animation/rig/blendPoses.js.map +1 -0
- package/dist/animation/rig/mirrorPose.js +19 -0
- package/dist/animation/rig/mirrorPose.js.map +1 -0
- package/dist/animation/rig/resolveSkeleton.js +33 -0
- package/dist/animation/rig/resolveSkeleton.js.map +1 -0
- package/dist/animation/rig/solveIk.js +103 -0
- package/dist/animation/rig/solveIk.js.map +1 -0
- package/dist/animation/rig/types.js +12 -0
- package/dist/animation/rig/types.js.map +1 -0
- package/dist/animation/rig/useRig.js +23 -0
- package/dist/animation/rig/useRig.js.map +1 -0
- package/dist/animation/slew.js +27 -0
- package/dist/animation/slew.js.map +1 -0
- package/dist/animation/stagger.js +138 -0
- package/dist/animation/stagger.js.map +1 -0
- package/dist/animation/timeline/booking.js +106 -0
- package/dist/animation/timeline/booking.js.map +1 -0
- package/dist/animation/timeline/createTimeline.js +116 -0
- package/dist/animation/timeline/createTimeline.js.map +1 -0
- package/dist/animation/timeline/sampleTrack.js +29 -0
- package/dist/animation/timeline/sampleTrack.js.map +1 -0
- package/dist/animation/useAnimator.js +329 -0
- package/dist/animation/useAnimator.js.map +1 -0
- package/dist/animation/wrappers/animateLifecycle.js +40 -0
- package/dist/animation/wrappers/animateLifecycle.js.map +1 -0
- package/dist/animation/wrappers/animateOnSetPose.js +44 -0
- package/dist/animation/wrappers/animateOnSetPose.js.map +1 -0
- package/dist/{autoPoseDescriptor-_XOyF7t4.d.ts → autoPoseDescriptor-BT_vp9FO.d.ts} +2 -2
- package/dist/{builtins-DLn2lCr_.d.ts → builtins-BSUfH8nU.d.ts} +738 -513
- package/dist/canvas/Canvas.js +608 -0
- package/dist/canvas/Canvas.js.map +1 -0
- package/dist/canvas/CanvasView.js +255 -0
- package/dist/canvas/CanvasView.js.map +1 -0
- package/dist/canvas/CursorCoordsHud.js +75 -0
- package/dist/canvas/CursorCoordsHud.js.map +1 -0
- package/dist/canvas/DrawCanvas.js +67 -0
- package/dist/canvas/DrawCanvas.js.map +1 -0
- package/dist/canvas/MinimapCanvas.js +139 -0
- package/dist/canvas/MinimapCanvas.js.map +1 -0
- package/dist/canvas/ModalityHud.js +66 -0
- package/dist/canvas/ModalityHud.js.map +1 -0
- package/dist/canvas/NodeShape.js +391 -0
- package/dist/canvas/NodeShape.js.map +1 -0
- package/dist/canvas/PickHud.js +93 -0
- package/dist/canvas/PickHud.js.map +1 -0
- package/dist/canvas/SceneCanvas/ActionsProviderIfRoot.js +10 -0
- package/dist/canvas/SceneCanvas/ActionsProviderIfRoot.js.map +1 -0
- package/dist/canvas/SceneCanvas/DepRegistryProviderIfRoot.js +10 -0
- package/dist/canvas/SceneCanvas/DepRegistryProviderIfRoot.js.map +1 -0
- package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js +51 -0
- package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js.map +1 -0
- package/dist/canvas/SceneCanvas/contributionFrameHooks.js +42 -0
- package/dist/canvas/SceneCanvas/contributionFrameHooks.js.map +1 -0
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js +549 -0
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js.map +1 -0
- package/dist/canvas/SceneCanvas/defaultNodeRouting.js +26 -0
- package/dist/canvas/SceneCanvas/defaultNodeRouting.js.map +1 -0
- package/dist/canvas/SceneCanvas/dispatcherGestureBounds.js +69 -0
- package/dist/canvas/SceneCanvas/dispatcherGestureBounds.js.map +1 -0
- package/dist/canvas/SceneCanvas/features.js +97 -0
- package/dist/canvas/SceneCanvas/features.js.map +1 -0
- package/dist/canvas/SceneCanvas/poseGeometry.js +46 -0
- package/dist/canvas/SceneCanvas/poseGeometry.js.map +1 -0
- package/dist/canvas/SceneCanvas/useActionsPropResolver.js +48 -0
- package/dist/canvas/SceneCanvas/useActionsPropResolver.js.map +1 -0
- package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js +70 -0
- package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js.map +1 -0
- package/dist/canvas/SceneCanvas/useContributionRoles.js +75 -0
- package/dist/canvas/SceneCanvas/useContributionRoles.js.map +1 -0
- package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js +172 -0
- package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js.map +1 -0
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js +69 -0
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js +127 -0
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js.map +1 -0
- package/dist/canvas/SceneCanvas/useViewportActions.js +30 -0
- package/dist/canvas/SceneCanvas/useViewportActions.js.map +1 -0
- package/dist/canvas/SceneCanvas.js +992 -0
- package/dist/canvas/SceneCanvas.js.map +1 -0
- package/dist/canvas/SceneViewCanvas.js +54 -0
- package/dist/canvas/SceneViewCanvas.js.map +1 -0
- package/dist/canvas/accentColor.js +9 -0
- package/dist/canvas/accentColor.js.map +1 -0
- package/dist/canvas/affordanceAt.js +63 -0
- package/dist/canvas/affordanceAt.js.map +1 -0
- package/dist/canvas/buildSceneTree.js +65 -0
- package/dist/canvas/buildSceneTree.js.map +1 -0
- package/dist/canvas/canvasRenderer.js +89 -0
- package/dist/canvas/canvasRenderer.js.map +1 -0
- package/dist/canvas/colorOverrides.js +16 -0
- package/dist/canvas/colorOverrides.js.map +1 -0
- package/dist/canvas/defaultDrawOne.js +43 -0
- package/dist/canvas/defaultDrawOne.js.map +1 -0
- package/dist/canvas/deps/areaSelect.js +19 -0
- package/dist/canvas/deps/areaSelect.js.map +1 -0
- package/dist/canvas/deps/debug.js +9 -0
- package/dist/canvas/deps/debug.js.map +1 -0
- package/dist/canvas/deps/dispatcher.js +11 -0
- package/dist/canvas/deps/dispatcher.js.map +1 -0
- package/dist/canvas/deps/editAnchors.js +101 -0
- package/dist/canvas/deps/editAnchors.js.map +1 -0
- package/dist/canvas/deps/geometryProjection.js +11 -0
- package/dist/canvas/deps/geometryProjection.js.map +1 -0
- package/dist/canvas/deps/hitTestArea.js +51 -0
- package/dist/canvas/deps/hitTestArea.js.map +1 -0
- package/dist/canvas/deps/ingestion.js +31 -0
- package/dist/canvas/deps/ingestion.js.map +1 -0
- package/dist/canvas/deps/insert.js +116 -0
- package/dist/canvas/deps/insert.js.map +1 -0
- package/dist/canvas/deps/lassoSelect.js +20 -0
- package/dist/canvas/deps/lassoSelect.js.map +1 -0
- package/dist/canvas/deps/layout.js +34 -0
- package/dist/canvas/deps/layout.js.map +1 -0
- package/dist/canvas/deps/nodeAtPoint.js +19 -0
- package/dist/canvas/deps/nodeAtPoint.js.map +1 -0
- package/dist/canvas/deps/poseComposition.js +11 -0
- package/dist/canvas/deps/poseComposition.js.map +1 -0
- package/dist/canvas/deps/poseDescriptor.js +12 -0
- package/dist/canvas/deps/poseDescriptor.js.map +1 -0
- package/dist/canvas/deps/resizePolicy.js +35 -0
- package/dist/canvas/deps/resizePolicy.js.map +1 -0
- package/dist/canvas/deps/slice.js +99 -0
- package/dist/canvas/deps/slice.js.map +1 -0
- package/dist/canvas/deps/snap.js +11 -0
- package/dist/canvas/deps/snap.js.map +1 -0
- package/dist/canvas/deps/textEdit.js +21 -0
- package/dist/canvas/deps/textEdit.js.map +1 -0
- package/dist/canvas/deps/view.js +43 -0
- package/dist/canvas/deps/view.js.map +1 -0
- package/dist/canvas/derivedPath.js +47 -0
- package/dist/canvas/derivedPath.js.map +1 -0
- package/dist/canvas/drawEnvelope.js +22 -0
- package/dist/canvas/drawEnvelope.js.map +1 -0
- package/dist/canvas/getNodeAtPoint.js +18 -0
- package/dist/canvas/getNodeAtPoint.js.map +1 -0
- package/dist/canvas/hostAnchor.js +29 -0
- package/dist/canvas/hostAnchor.js.map +1 -0
- package/dist/canvas/hud.module.js +18 -0
- package/dist/canvas/hud.module.js.map +1 -0
- package/dist/canvas/insertPreviewExtent.js +103 -0
- package/dist/canvas/insertPreviewExtent.js.map +1 -0
- package/dist/canvas/kitRequirements.js +177 -0
- package/dist/canvas/kitRequirements.js.map +1 -0
- package/dist/canvas/layerOrder.js +66 -0
- package/dist/canvas/layerOrder.js.map +1 -0
- package/dist/canvas/layerSlots.js +14 -0
- package/dist/canvas/layerSlots.js.map +1 -0
- package/dist/canvas/minimapMath.js +80 -0
- package/dist/canvas/minimapMath.js.map +1 -0
- package/dist/canvas/mountedCanvases.js +20 -0
- package/dist/canvas/mountedCanvases.js.map +1 -0
- package/dist/canvas/overlayRoleStrokes.js +17 -0
- package/dist/canvas/overlayRoleStrokes.js.map +1 -0
- package/dist/canvas/paintCull.js +20 -0
- package/dist/canvas/paintCull.js.map +1 -0
- package/dist/canvas/pickWalk.js +158 -0
- package/dist/canvas/pickWalk.js.map +1 -0
- package/dist/canvas/planeClips.js +30 -0
- package/dist/canvas/planeClips.js.map +1 -0
- package/dist/canvas/poseRotation.js +35 -0
- package/dist/canvas/poseRotation.js.map +1 -0
- package/dist/canvas/rasterToPng.js +21 -0
- package/dist/canvas/rasterToPng.js.map +1 -0
- package/dist/canvas/renderDebugSnapshot.js +32 -0
- package/dist/canvas/renderDebugSnapshot.js.map +1 -0
- package/dist/canvas/renderNeeds.js +25 -0
- package/dist/canvas/renderNeeds.js.map +1 -0
- package/dist/canvas/renderSceneToPixels.js +143 -0
- package/dist/canvas/renderSceneToPixels.js.map +1 -0
- package/dist/canvas/sceneAdapter.js +270 -0
- package/dist/canvas/sceneAdapter.js.map +1 -0
- package/dist/canvas/sceneLayerPaint.js +37 -0
- package/dist/canvas/sceneLayerPaint.js.map +1 -0
- package/dist/canvas/sceneSlotWiring.js +20 -0
- package/dist/canvas/sceneSlotWiring.js.map +1 -0
- package/dist/canvas/sceneViewRender.js +72 -0
- package/dist/canvas/sceneViewRender.js.map +1 -0
- package/dist/canvas/slopsDebugLayer.js +61 -0
- package/dist/canvas/slopsDebugLayer.js.map +1 -0
- package/dist/canvas/surfaceContribution.js +15 -0
- package/dist/canvas/surfaceContribution.js.map +1 -0
- package/dist/canvas/toolPreview.js +39 -0
- package/dist/canvas/toolPreview.js.map +1 -0
- package/dist/canvas/useCanvasRenderer.js +11 -0
- package/dist/canvas/useCanvasRenderer.js.map +1 -0
- package/dist/canvas/useFrameLoop.js +60 -0
- package/dist/canvas/useFrameLoop.js.map +1 -0
- package/dist/canvas/useHostAnchor.js +71 -0
- package/dist/canvas/useHostAnchor.js.map +1 -0
- package/dist/canvas/useLateContentRedraw.js +21 -0
- package/dist/canvas/useLateContentRedraw.js.map +1 -0
- package/dist/canvas/useRedrawOn.js +21 -0
- package/dist/canvas/useRedrawOn.js.map +1 -0
- package/dist/canvas/useViewHelpers.js +120 -0
- package/dist/canvas/useViewHelpers.js.map +1 -0
- package/dist/canvas/viewInputs.js +17 -0
- package/dist/canvas/viewInputs.js.map +1 -0
- package/dist/canvas/viewRegistry.js +61 -0
- package/dist/canvas/viewRegistry.js.map +1 -0
- package/dist/canvas/wrapNodeOutput.js +14 -0
- package/dist/canvas/wrapNodeOutput.js.map +1 -0
- package/dist/clipboard.d.ts +10 -5
- package/dist/clipboard.js +3 -5
- package/dist/clone.d.ts +3 -3
- package/dist/clone.js +2 -5
- package/dist/core/adapters/arrayAdapter.js +85 -0
- package/dist/core/adapters/arrayAdapter.js.map +1 -0
- package/dist/core/adapters/useArrayAdapter.js +13 -0
- package/dist/core/adapters/useArrayAdapter.js.map +1 -0
- package/dist/core/applyOps.js +12 -0
- package/dist/core/applyOps.js.map +1 -0
- package/dist/core/device/index.js +4 -0
- package/dist/core/device/targets.js +17 -0
- package/dist/core/device/targets.js.map +1 -0
- package/dist/core/device/useDeviceProfile.js +75 -0
- package/dist/core/device/useDeviceProfile.js.map +1 -0
- package/dist/core/fillInPoseFrame.js +102 -0
- package/dist/core/fillInPoseFrame.js.map +1 -0
- package/dist/core/geometry/poseDescriptor.js +98 -0
- package/dist/core/geometry/poseDescriptor.js.map +1 -0
- package/dist/core/geometry/poseRotation.js +58 -0
- package/dist/core/geometry/poseRotation.js.map +1 -0
- package/dist/core/geometry/regionHit.js +102 -0
- package/dist/core/geometry/regionHit.js.map +1 -0
- package/dist/core/geometry/unionBounds.js +60 -0
- package/dist/core/geometry/unionBounds.js.map +1 -0
- package/dist/core/gradient.js +136 -0
- package/dist/core/gradient.js.map +1 -0
- package/dist/core/isPlainObject.js +11 -0
- package/dist/core/isPlainObject.js.map +1 -0
- package/dist/core/layers/render.js +150 -0
- package/dist/core/layers/render.js.map +1 -0
- package/dist/core/markerInset.js +24 -0
- package/dist/core/markerInset.js.map +1 -0
- package/dist/core/mixed.js +6 -0
- package/dist/core/mixed.js.map +1 -0
- package/dist/core/ops/arrange.js +31 -0
- package/dist/core/ops/arrange.js.map +1 -0
- package/dist/core/ops/create.js +32 -0
- package/dist/core/ops/create.js.map +1 -0
- package/dist/core/ops/createHistory.js +20 -0
- package/dist/core/ops/createHistory.js.map +1 -0
- package/dist/core/ops/delete.js +89 -0
- package/dist/core/ops/delete.js.map +1 -0
- package/dist/core/ops/registry.js +17 -0
- package/dist/core/ops/registry.js.map +1 -0
- package/dist/core/ops/reorder/algorithms.js +55 -0
- package/dist/core/ops/reorder/algorithms.js.map +1 -0
- package/dist/core/ops/reorder/index.js +140 -0
- package/dist/core/ops/reorder/index.js.map +1 -0
- package/dist/core/ops/reparent.js +52 -0
- package/dist/core/ops/reparent.js.map +1 -0
- package/dist/core/ops/select.js +34 -0
- package/dist/core/ops/select.js.map +1 -0
- package/dist/core/ops/setData.js +34 -0
- package/dist/core/ops/setData.js.map +1 -0
- package/dist/core/ops/setLayer.js +34 -0
- package/dist/core/ops/setLayer.js.map +1 -0
- package/dist/core/ops/setLayout.js +31 -0
- package/dist/core/ops/setLayout.js.map +1 -0
- package/dist/core/ops/setPath.js +57 -0
- package/dist/core/ops/setPath.js.map +1 -0
- package/dist/core/ops/setText.js +34 -0
- package/dist/core/ops/setText.js.map +1 -0
- package/dist/core/ops/slot.js +37 -0
- package/dist/core/ops/slot.js.map +1 -0
- package/dist/core/ops/transform.js +42 -0
- package/dist/core/ops/transform.js.map +1 -0
- package/dist/core/paintKinds.js +156 -0
- package/dist/core/paintKinds.js.map +1 -0
- package/dist/core/scene/NodeProperties.js +20 -0
- package/dist/core/scene/NodeProperties.js.map +1 -0
- package/dist/core/scene/NodeRouting.js +24 -0
- package/dist/core/scene/NodeRouting.js.map +1 -0
- package/dist/core/scene/arrivals.js +12 -0
- package/dist/core/scene/arrivals.js.map +1 -0
- package/dist/core/scene/composeFrame.js +29 -0
- package/dist/core/scene/composeFrame.js.map +1 -0
- package/dist/core/scene/depMemo.js +18 -0
- package/dist/core/scene/depMemo.js.map +1 -0
- package/dist/core/scene/dependents.js +66 -0
- package/dist/core/scene/dependents.js.map +1 -0
- package/dist/core/scene/derivedPath.js +31 -0
- package/dist/core/scene/derivedPath.js.map +1 -0
- package/dist/core/scene/effectivePose.js +78 -0
- package/dist/core/scene/effectivePose.js.map +1 -0
- package/dist/core/scene/kitRegistry.js +33 -0
- package/dist/core/scene/kitRegistry.js.map +1 -0
- package/dist/core/scene/layoutPass.js +96 -0
- package/dist/core/scene/layoutPass.js.map +1 -0
- package/dist/core/scene/nodeFnFields.js +83 -0
- package/dist/core/scene/nodeFnFields.js.map +1 -0
- package/dist/core/scene/nodeMemo.js +28 -0
- package/dist/core/scene/nodeMemo.js.map +1 -0
- package/dist/core/scene/poseFeed.js +87 -0
- package/dist/core/scene/poseFeed.js.map +1 -0
- package/dist/core/scene/poseOverrides.js +52 -0
- package/dist/core/scene/poseOverrides.js.map +1 -0
- package/dist/core/scene/poseSnapshot.js +54 -0
- package/dist/core/scene/poseSnapshot.js.map +1 -0
- package/dist/core/scene/scene.js +1271 -0
- package/dist/core/scene/scene.js.map +1 -0
- package/dist/core/scene/types.js +6 -0
- package/dist/core/scene/types.js.map +1 -0
- package/dist/core/scene/useScene.js +32 -0
- package/dist/core/scene/useScene.js.map +1 -0
- package/dist/core/selection/chromeState.js +31 -0
- package/dist/core/selection/chromeState.js.map +1 -0
- package/dist/core/selection/selectionTarget.js +6 -0
- package/dist/core/selection/selectionTarget.js.map +1 -0
- package/dist/core/selection/useSelection.js +71 -0
- package/dist/core/selection/useSelection.js.map +1 -0
- package/dist/core/shapeKinds.js +54 -0
- package/dist/core/shapeKinds.js.map +1 -0
- package/dist/core/strokeMarkerShapes.js +139 -0
- package/dist/core/strokeMarkerShapes.js.map +1 -0
- package/dist/core/strokeMarkers.js +28 -0
- package/dist/core/strokeMarkers.js.map +1 -0
- package/dist/core/stylus/stylus.js +39 -0
- package/dist/core/stylus/stylus.js.map +1 -0
- package/dist/core/stylus/usePointerStylus.js +51 -0
- package/dist/core/stylus/usePointerStylus.js.map +1 -0
- package/dist/core/usePaintKinds.js +17 -0
- package/dist/core/usePaintKinds.js.map +1 -0
- package/dist/core/viewport/clampView.js +24 -0
- package/dist/core/viewport/clampView.js.map +1 -0
- package/dist/core/viewport/clientToWorld.js +8 -0
- package/dist/core/viewport/clientToWorld.js.map +1 -0
- package/dist/core/viewport/createVelocityTracker.js +39 -0
- package/dist/core/viewport/createVelocityTracker.js.map +1 -0
- package/dist/core/viewport/fitToBounds.js +18 -0
- package/dist/core/viewport/fitToBounds.js.map +1 -0
- package/dist/core/viewport/fitViewToBounds.js +36 -0
- package/dist/core/viewport/fitViewToBounds.js.map +1 -0
- package/dist/core/viewport/interpolateView.js +34 -0
- package/dist/core/viewport/interpolateView.js.map +1 -0
- package/dist/core/viewport/meanScale.js +8 -0
- package/dist/core/viewport/meanScale.js.map +1 -0
- package/dist/core/viewport/parallax.js +111 -0
- package/dist/core/viewport/parallax.js.map +1 -0
- package/dist/core/viewport/pxExtent.js +42 -0
- package/dist/core/viewport/pxExtent.js.map +1 -0
- package/dist/core/viewport/sceneNodeClientRect.js +18 -0
- package/dist/core/viewport/sceneNodeClientRect.js.map +1 -0
- package/dist/core/viewport/screenSlop.js +27 -0
- package/dist/core/viewport/screenSlop.js.map +1 -0
- package/dist/core/viewport/useAutoCenter.js +32 -0
- package/dist/core/viewport/useAutoCenter.js.map +1 -0
- package/dist/core/viewport/useCanvasSize.js +29 -0
- package/dist/core/viewport/useCanvasSize.js.map +1 -0
- package/dist/core/viewport/useDecayLoop.js +63 -0
- package/dist/core/viewport/useDecayLoop.js.map +1 -0
- package/dist/core/viewport/useVelocityTracker.js +10 -0
- package/dist/core/viewport/useVelocityTracker.js.map +1 -0
- package/dist/core/viewport/useViewAnimation.js +63 -0
- package/dist/core/viewport/useViewAnimation.js.map +1 -0
- package/dist/core/viewport/view.js +37 -0
- package/dist/core/viewport/view.js.map +1 -0
- package/dist/core/viewport/viewTransform.js +11 -0
- package/dist/core/viewport/viewTransform.js.map +1 -0
- package/dist/core/viewport/viewportWorldRect.js +13 -0
- package/dist/core/viewport/viewportWorldRect.js.map +1 -0
- package/dist/core/viewport/wheelHandler.js +30 -0
- package/dist/core/viewport/wheelHandler.js.map +1 -0
- package/dist/core/viewport/zoomAt.js +22 -0
- package/dist/core/viewport/zoomAt.js.map +1 -0
- package/dist/core/viewport/zoomBounds.js +20 -0
- package/dist/core/viewport/zoomBounds.js.map +1 -0
- package/dist/{pointSnapToGrid-Dp2IxLGb.d.ts → cornerHandles-CDcZOV8h.d.ts} +3 -13
- package/dist/debug/createDebugOverlayLayer.js +358 -0
- package/dist/debug/createDebugOverlayLayer.js.map +1 -0
- package/dist/debug/createDebugSink.js +83 -0
- package/dist/debug/createDebugSink.js.map +1 -0
- package/dist/debug/defaultTheme.js +31 -0
- package/dist/debug/defaultTheme.js.map +1 -0
- package/dist/debug/flag.js +41 -0
- package/dist/debug/flag.js.map +1 -0
- package/dist/debug/frameStats.js +16 -0
- package/dist/debug/frameStats.js.map +1 -0
- package/dist/debug/parseDebugFlags.js +32 -0
- package/dist/debug/parseDebugFlags.js.map +1 -0
- package/dist/features/chrome-caps/buildChromeCtx.js +16 -0
- package/dist/features/chrome-caps/buildChromeCtx.js.map +1 -0
- package/dist/features/chrome-caps/conditions.js +36 -0
- package/dist/features/chrome-caps/conditions.js.map +1 -0
- package/dist/features/chrome-caps/defaults.js +26 -0
- package/dist/features/chrome-caps/defaults.js.map +1 -0
- package/dist/features/chrome-caps/index.js +7 -0
- package/dist/features/chrome-caps/resolve.js +23 -0
- package/dist/features/chrome-caps/resolve.js.map +1 -0
- package/dist/features/chrome-caps/useHoverTracking.js +27 -0
- package/dist/features/chrome-caps/useHoverTracking.js.map +1 -0
- package/dist/features/cursor/paintedCursorLayer.js +60 -0
- package/dist/features/cursor/paintedCursorLayer.js.map +1 -0
- package/dist/features/focus/gateLayer.js +14 -0
- package/dist/features/focus/gateLayer.js.map +1 -0
- package/dist/features/focus/useCanvasFocus.js +29 -0
- package/dist/features/focus/useCanvasFocus.js.map +1 -0
- package/dist/features/groups/children.js +23 -0
- package/dist/features/groups/children.js.map +1 -0
- package/dist/features/groups/composePose.js +67 -0
- package/dist/features/groups/composePose.js.map +1 -0
- package/dist/features/groups/nestedHit.js +40 -0
- package/dist/features/groups/nestedHit.js.map +1 -0
- package/dist/features/groups/unionOfChildren.js +15 -0
- package/dist/features/groups/unionOfChildren.js.map +1 -0
- package/dist/features/images/imageCache.js +94 -0
- package/dist/features/images/imageCache.js.map +1 -0
- package/dist/features/ingestion/contentHandlers.js +37 -0
- package/dist/features/ingestion/contentHandlers.js.map +1 -0
- package/dist/features/ingestion/imageHandler.js +45 -0
- package/dist/features/ingestion/imageHandler.js.map +1 -0
- package/dist/features/ingestion/index.js +8 -0
- package/dist/features/ingestion/openFilePicker.js +15 -0
- package/dist/features/ingestion/openFilePicker.js.map +1 -0
- package/dist/features/ingestion/registerKitHandlers.js +26 -0
- package/dist/features/ingestion/registerKitHandlers.js.map +1 -0
- package/dist/features/ingestion/svgHandler.js +58 -0
- package/dist/features/ingestion/svgHandler.js.map +1 -0
- package/dist/features/ingestion/weaselJsonHandler.js +39 -0
- package/dist/features/ingestion/weaselJsonHandler.js.map +1 -0
- package/dist/features/longPress/longPressFeedback.js +96 -0
- package/dist/features/longPress/longPressFeedback.js.map +1 -0
- package/dist/features/meshPaint/bake.js +79 -0
- package/dist/features/meshPaint/bake.js.map +1 -0
- package/dist/features/meshPaint/bakeCache.js +59 -0
- package/dist/features/meshPaint/bakeCache.js.map +1 -0
- package/dist/features/meshPaint/handles.js +86 -0
- package/dist/features/meshPaint/handles.js.map +1 -0
- package/dist/features/meshPaint/lazyKind.js +1298 -0
- package/dist/features/meshPaint/lazyKind.js.map +1 -0
- package/dist/features/meshPaint/meshPaint.js +236 -0
- package/dist/features/meshPaint/meshPaint.js.map +1 -0
- package/dist/features/meshPaint/meshShader.js +6 -0
- package/dist/features/meshPaint/meshShader.js.map +1 -0
- package/dist/features/meshPaint/register.js +7 -0
- package/dist/features/meshPaint/register.js.map +1 -0
- package/dist/features/meshPaint/surface.js +110 -0
- package/dist/features/meshPaint/surface.js.map +1 -0
- package/dist/features/minimap/actions.js +53 -0
- package/dist/features/minimap/actions.js.map +1 -0
- package/dist/features/minimap/createMinimapContribution.js +96 -0
- package/dist/features/minimap/createMinimapContribution.js.map +1 -0
- package/dist/features/minimap/layers.js +103 -0
- package/dist/features/minimap/layers.js.map +1 -0
- package/dist/features/modes/modeLayers.js +113 -0
- package/dist/features/modes/modeLayers.js.map +1 -0
- package/dist/features/overlays/useNodeOverlayFrame.js +103 -0
- package/dist/features/overlays/useNodeOverlayFrame.js.map +1 -0
- package/dist/features/parallax/createParallaxLayer.js +26 -0
- package/dist/features/parallax/createParallaxLayer.js.map +1 -0
- package/dist/features/parallax/createParallaxPlane.js +26 -0
- package/dist/features/parallax/createParallaxPlane.js.map +1 -0
- package/dist/features/paths/anchorEdits.js +156 -0
- package/dist/features/paths/anchorEdits.js.map +1 -0
- package/dist/features/paths/anchors.js +154 -0
- package/dist/features/paths/anchors.js.map +1 -0
- package/dist/features/paths/booleans.js +2 -0
- package/dist/features/paths/index.js +15 -0
- package/dist/features/paths/markerCommands.js +116 -0
- package/dist/features/paths/markerCommands.js.map +1 -0
- package/dist/features/paths/markerSites.js +59 -0
- package/dist/features/paths/markerSites.js.map +1 -0
- package/dist/features/paths/markers.js +95 -0
- package/dist/features/paths/markers.js.map +1 -0
- package/dist/features/paths/nearestAnchor.js +36 -0
- package/dist/features/paths/nearestAnchor.js.map +1 -0
- package/dist/features/paths/originProjection.js +16 -0
- package/dist/features/paths/originProjection.js.map +1 -0
- package/dist/features/paths/pathEditingOverlayLayer.js +137 -0
- package/dist/features/paths/pathEditingOverlayLayer.js.map +1 -0
- package/dist/features/paths/pathInWorld.js +41 -0
- package/dist/features/paths/pathInWorld.js.map +1 -0
- package/dist/features/paths/pathLayer.js +44 -0
- package/dist/features/paths/pathLayer.js.map +1 -0
- package/dist/features/paths/penPreviewLayer.js +220 -0
- package/dist/features/paths/penPreviewLayer.js.map +1 -0
- package/dist/features/paths/poseDescriptor.js +44 -0
- package/dist/features/paths/poseDescriptor.js.map +1 -0
- package/dist/features/paths/tessellate/stroke.js +230 -0
- package/dist/features/paths/tessellate/stroke.js.map +1 -0
- package/dist/features/patterns/index.js +23 -0
- package/dist/features/patterns/index.js.map +1 -0
- package/dist/features/patterns/patterns-builtin.js +38 -0
- package/dist/features/patterns/patterns-builtin.js.map +1 -0
- package/dist/features/patterns/resolveSpec.js +57 -0
- package/dist/features/patterns/resolveSpec.js.map +1 -0
- package/dist/features/patterns/tileGeometry.js +158 -0
- package/dist/features/patterns/tileGeometry.js.map +1 -0
- package/dist/features/pointer/PointerContext.js +45 -0
- package/dist/features/pointer/PointerContext.js.map +1 -0
- package/dist/features/poseRun/usePoseRun.js +70 -0
- package/dist/features/poseRun/usePoseRun.js.map +1 -0
- package/dist/features/selection/SelectionContext.js +46 -0
- package/dist/features/selection/SelectionContext.js.map +1 -0
- package/dist/features/selection/overlay.js +442 -0
- package/dist/features/selection/overlay.js.map +1 -0
- package/dist/features/simulation/createSimulation.js +61 -0
- package/dist/features/simulation/createSimulation.js.map +1 -0
- package/dist/features/simulation/types.js +6 -0
- package/dist/features/simulation/types.js.map +1 -0
- package/dist/features/simulation/useSimulation.js +74 -0
- package/dist/features/simulation/useSimulation.js.map +1 -0
- package/dist/features/text/domRuns.js +258 -0
- package/dist/features/text/domRuns.js.map +1 -0
- package/dist/features/text/fitTextPose.js +38 -0
- package/dist/features/text/fitTextPose.js.map +1 -0
- package/dist/features/text/hitTest.js +45 -0
- package/dist/features/text/hitTest.js.map +1 -0
- package/dist/features/text/renderLabel.js +14 -0
- package/dist/features/text/renderLabel.js.map +1 -0
- package/dist/features/text/runs/effectiveRangeStyle.js +66 -0
- package/dist/features/text/runs/effectiveRangeStyle.js.map +1 -0
- package/dist/features/text/runs/flagRange.js +53 -0
- package/dist/features/text/runs/flagRange.js.map +1 -0
- package/dist/features/text/runs/rangeStyle.js +135 -0
- package/dist/features/text/runs/rangeStyle.js.map +1 -0
- package/dist/features/text/textCommand.js +59 -0
- package/dist/features/text/textCommand.js.map +1 -0
- package/dist/features/text/textLayer.js +35 -0
- package/dist/features/text/textLayer.js.map +1 -0
- package/dist/features/text/textToPath.js +181 -0
- package/dist/features/text/textToPath.js.map +1 -0
- package/dist/features/text/useSceneTextEdit.js +138 -0
- package/dist/features/text/useSceneTextEdit.js.map +1 -0
- package/dist/features/text/useTextEdit.js +465 -0
- package/dist/features/text/useTextEdit.js.map +1 -0
- package/dist/features/tiling/createTiledLayer.js +63 -0
- package/dist/features/tiling/createTiledLayer.js.map +1 -0
- package/dist/features/tiling/tiledProject.js +14 -0
- package/dist/features/tiling/tiledProject.js.map +1 -0
- package/dist/features/viewports/viewResolver.js +59 -0
- package/dist/features/viewports/viewResolver.js.map +1 -0
- package/dist/features/viewports/viewportLayer.js +58 -0
- package/dist/features/viewports/viewportLayer.js.map +1 -0
- package/dist/icons/ArrowIcon.js +23 -0
- package/dist/icons/ArrowIcon.js.map +1 -0
- package/dist/icons/EllipseIcon.js +21 -0
- package/dist/icons/EllipseIcon.js.map +1 -0
- package/dist/icons/EyedropperIcon.js +49 -0
- package/dist/icons/EyedropperIcon.js.map +1 -0
- package/dist/icons/HandIcon.js +59 -0
- package/dist/icons/HandIcon.js.map +1 -0
- package/dist/icons/ImageIcon.js +34 -0
- package/dist/icons/ImageIcon.js.map +1 -0
- package/dist/icons/LassoIcon.js +22 -0
- package/dist/icons/LassoIcon.js.map +1 -0
- package/dist/icons/LineIcon.js +22 -0
- package/dist/icons/LineIcon.js.map +1 -0
- package/dist/icons/PenIcon.js +36 -0
- package/dist/icons/PenIcon.js.map +1 -0
- package/dist/icons/PencilIcon.js +25 -0
- package/dist/icons/PencilIcon.js.map +1 -0
- package/dist/icons/PolygonIcon.js +19 -0
- package/dist/icons/PolygonIcon.js.map +1 -0
- package/dist/icons/RectIcon.js +37 -0
- package/dist/icons/RectIcon.js.map +1 -0
- package/dist/icons/SelectIcon.js +20 -0
- package/dist/icons/SelectIcon.js.map +1 -0
- package/dist/icons/StarIcon.js +19 -0
- package/dist/icons/StarIcon.js.map +1 -0
- package/dist/icons/TextIcon.js +19 -0
- package/dist/icons/TextIcon.js.map +1 -0
- package/dist/icons/UnknownIcon.js +33 -0
- package/dist/icons/UnknownIcon.js.map +1 -0
- package/dist/icons/_base.js +12 -0
- package/dist/icons/_base.js.map +1 -0
- package/dist/index.css +2 -62
- package/dist/index.d.ts +1955 -1891
- package/dist/index.js +312 -13
- package/dist/input/keyState.js +76 -0
- package/dist/input/keyState.js.map +1 -0
- package/dist/input/useKeyState.js +22 -0
- package/dist/input/useKeyState.js.map +1 -0
- package/dist/interactions/actions/actionShortcuts.js +32 -0
- package/dist/interactions/actions/actionShortcuts.js.map +1 -0
- package/dist/interactions/actions/align/align.js +81 -0
- package/dist/interactions/actions/align/align.js.map +1 -0
- package/dist/interactions/actions/booleans/booleans.js +120 -0
- package/dist/interactions/actions/booleans/booleans.js.map +1 -0
- package/dist/interactions/actions/booleans/useBooleans.js +20 -0
- package/dist/interactions/actions/booleans/useBooleans.js.map +1 -0
- package/dist/interactions/actions/booleans/useBooleansAdapter.js +9 -0
- package/dist/interactions/actions/booleans/useBooleansAdapter.js.map +1 -0
- package/dist/interactions/actions/clipboard/clipboardOps.js +94 -0
- package/dist/interactions/actions/clipboard/clipboardOps.js.map +1 -0
- package/dist/interactions/actions/clipboard/materializePaste.js +25 -0
- package/dist/interactions/actions/clipboard/materializePaste.js.map +1 -0
- package/dist/interactions/actions/clipboard/wireFormat.js +43 -0
- package/dist/interactions/actions/clipboard/wireFormat.js.map +1 -0
- package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js +26 -0
- package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js.map +1 -0
- package/dist/interactions/actions/defaultCommitAdapter.js +42 -0
- package/dist/interactions/actions/defaultCommitAdapter.js.map +1 -0
- package/dist/interactions/actions/defaults/align.js +71 -0
- package/dist/interactions/actions/defaults/align.js.map +1 -0
- package/dist/interactions/actions/defaults/anchorEditing.js +235 -0
- package/dist/interactions/actions/defaults/anchorEditing.js.map +1 -0
- package/dist/interactions/actions/defaults/areaSelect.js +75 -0
- package/dist/interactions/actions/defaults/areaSelect.js.map +1 -0
- package/dist/interactions/actions/defaults/booleans.js +52 -0
- package/dist/interactions/actions/defaults/booleans.js.map +1 -0
- package/dist/interactions/actions/defaults/cancelGesture.js +24 -0
- package/dist/interactions/actions/defaults/cancelGesture.js.map +1 -0
- package/dist/interactions/actions/defaults/clearSelection.js +19 -0
- package/dist/interactions/actions/defaults/clearSelection.js.map +1 -0
- package/dist/interactions/actions/defaults/clipboard.js +78 -0
- package/dist/interactions/actions/defaults/clipboard.js.map +1 -0
- package/dist/interactions/actions/defaults/clone.js +96 -0
- package/dist/interactions/actions/defaults/clone.js.map +1 -0
- package/dist/interactions/actions/defaults/createOutlines.js +47 -0
- package/dist/interactions/actions/defaults/createOutlines.js.map +1 -0
- package/dist/interactions/actions/defaults/createPaintAction.js +85 -0
- package/dist/interactions/actions/defaults/createPaintAction.js.map +1 -0
- package/dist/interactions/actions/defaults/delete.js +61 -0
- package/dist/interactions/actions/defaults/delete.js.map +1 -0
- package/dist/interactions/actions/defaults/distribute.js +66 -0
- package/dist/interactions/actions/defaults/distribute.js.map +1 -0
- package/dist/interactions/actions/defaults/duplicate.js +83 -0
- package/dist/interactions/actions/defaults/duplicate.js.map +1 -0
- package/dist/interactions/actions/defaults/editAnchors.js +100 -0
- package/dist/interactions/actions/defaults/editAnchors.js.map +1 -0
- package/dist/interactions/actions/defaults/enterPathEdit.js +29 -0
- package/dist/interactions/actions/defaults/enterPathEdit.js.map +1 -0
- package/dist/interactions/actions/defaults/enterTextEdit.js +20 -0
- package/dist/interactions/actions/defaults/enterTextEdit.js.map +1 -0
- package/dist/interactions/actions/defaults/escape.js +26 -0
- package/dist/interactions/actions/defaults/escape.js.map +1 -0
- package/dist/interactions/actions/defaults/exitPathEdit.js +22 -0
- package/dist/interactions/actions/defaults/exitPathEdit.js.map +1 -0
- package/dist/interactions/actions/defaults/flip.js +119 -0
- package/dist/interactions/actions/defaults/flip.js.map +1 -0
- package/dist/interactions/actions/defaults/freshNodeId.js +10 -0
- package/dist/interactions/actions/defaults/freshNodeId.js.map +1 -0
- package/dist/interactions/actions/defaults/group.js +131 -0
- package/dist/interactions/actions/defaults/group.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/actionGlyphIcons.js +40 -0
- package/dist/interactions/actions/defaults/icons/actionGlyphIcons.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/actionGlyphs.js +10 -0
- package/dist/interactions/actions/defaults/icons/actionGlyphs.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/alignIcons.js +173 -0
- package/dist/interactions/actions/defaults/icons/alignIcons.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/booleanIcons.js +171 -0
- package/dist/interactions/actions/defaults/icons/booleanIcons.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/distributeIcons.js +63 -0
- package/dist/interactions/actions/defaults/icons/distributeIcons.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/editIcons.js +280 -0
- package/dist/interactions/actions/defaults/icons/editIcons.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/outlineIcons.js +53 -0
- package/dist/interactions/actions/defaults/icons/outlineIcons.js.map +1 -0
- package/dist/interactions/actions/defaults/ingest.js +58 -0
- package/dist/interactions/actions/defaults/ingest.js.map +1 -0
- package/dist/interactions/actions/defaults/insert.js +288 -0
- package/dist/interactions/actions/defaults/insert.js.map +1 -0
- package/dist/interactions/actions/defaults/insertPathAnchor.js +50 -0
- package/dist/interactions/actions/defaults/insertPathAnchor.js.map +1 -0
- package/dist/interactions/actions/defaults/lassoSelect.js +156 -0
- package/dist/interactions/actions/defaults/lassoSelect.js.map +1 -0
- package/dist/interactions/actions/defaults/move.js +656 -0
- package/dist/interactions/actions/defaults/move.js.map +1 -0
- package/dist/interactions/actions/defaults/nudge.js +110 -0
- package/dist/interactions/actions/defaults/nudge.js.map +1 -0
- package/dist/interactions/actions/defaults/pinchZoom.js +63 -0
- package/dist/interactions/actions/defaults/pinchZoom.js.map +1 -0
- package/dist/interactions/actions/defaults/reorder.js +143 -0
- package/dist/interactions/actions/defaults/reorder.js.map +1 -0
- package/dist/interactions/actions/defaults/requiresSelection.js +10 -0
- package/dist/interactions/actions/defaults/requiresSelection.js.map +1 -0
- package/dist/interactions/actions/defaults/resize.js +332 -0
- package/dist/interactions/actions/defaults/resize.js.map +1 -0
- package/dist/interactions/actions/defaults/rotate.js +181 -0
- package/dist/interactions/actions/defaults/rotate.js.map +1 -0
- package/dist/interactions/actions/defaults/selectAll.js +27 -0
- package/dist/interactions/actions/defaults/selectAll.js.map +1 -0
- package/dist/interactions/actions/defaults/setFill.js +27 -0
- package/dist/interactions/actions/defaults/setFill.js.map +1 -0
- package/dist/interactions/actions/defaults/setFillOpacity.js +15 -0
- package/dist/interactions/actions/defaults/setFillOpacity.js.map +1 -0
- package/dist/interactions/actions/defaults/setStroke.js +36 -0
- package/dist/interactions/actions/defaults/setStroke.js.map +1 -0
- package/dist/interactions/actions/defaults/setStrokeOpacity.js +21 -0
- package/dist/interactions/actions/defaults/setStrokeOpacity.js.map +1 -0
- package/dist/interactions/actions/defaults/slice.js +39 -0
- package/dist/interactions/actions/defaults/slice.js.map +1 -0
- package/dist/interactions/actions/defaults/sliceOps.js +60 -0
- package/dist/interactions/actions/defaults/sliceOps.js.map +1 -0
- package/dist/interactions/actions/defaults/toolActivate.js +35 -0
- package/dist/interactions/actions/defaults/toolActivate.js.map +1 -0
- package/dist/interactions/actions/defaults/toolResetToDefault.js +26 -0
- package/dist/interactions/actions/defaults/toolResetToDefault.js.map +1 -0
- package/dist/interactions/actions/defaults/undoRedo.js +51 -0
- package/dist/interactions/actions/defaults/undoRedo.js.map +1 -0
- package/dist/interactions/actions/defaults/viewportDragPan.js +88 -0
- package/dist/interactions/actions/defaults/viewportDragPan.js.map +1 -0
- package/dist/interactions/actions/defaults/viewportWheelPan.js +57 -0
- package/dist/interactions/actions/defaults/viewportWheelPan.js.map +1 -0
- package/dist/interactions/actions/defaults/viewportZoom.js +143 -0
- package/dist/interactions/actions/defaults/viewportZoom.js.map +1 -0
- package/dist/interactions/actions/distribute/distribute.js +42 -0
- package/dist/interactions/actions/distribute/distribute.js.map +1 -0
- package/dist/interactions/actions/distribute/plan.js +29 -0
- package/dist/interactions/actions/distribute/plan.js.map +1 -0
- package/dist/interactions/actions/edit-anchors/geometry.js +61 -0
- package/dist/interactions/actions/edit-anchors/geometry.js.map +1 -0
- package/dist/interactions/actions/edit-anchors/handles.js +43 -0
- package/dist/interactions/actions/edit-anchors/handles.js.map +1 -0
- package/dist/interactions/actions/flip/helpers.js +35 -0
- package/dist/interactions/actions/flip/helpers.js.map +1 -0
- package/dist/interactions/actions/geometryProjection.js +18 -0
- package/dist/interactions/actions/geometryProjection.js.map +1 -0
- package/dist/interactions/actions/gestureLifecycle.js +44 -0
- package/dist/interactions/actions/gestureLifecycle.js.map +1 -0
- package/dist/interactions/actions/lasso-select/behaviors/selectFromLasso.js +39 -0
- package/dist/interactions/actions/lasso-select/behaviors/selectFromLasso.js.map +1 -0
- package/dist/interactions/actions/move/behaviors/snapBackOrDelete.js +36 -0
- package/dist/interactions/actions/move/behaviors/snapBackOrDelete.js.map +1 -0
- package/dist/interactions/actions/move/behaviors/snapToContainer.js +67 -0
- package/dist/interactions/actions/move/behaviors/snapToContainer.js.map +1 -0
- package/dist/interactions/actions/move/gestureAdapter.js +37 -0
- package/dist/interactions/actions/move/gestureAdapter.js.map +1 -0
- package/dist/interactions/actions/outlines/createOutlines.js +84 -0
- package/dist/interactions/actions/outlines/createOutlines.js.map +1 -0
- package/dist/interactions/actions/outlines/useCreateOutlinesAdapter.js +9 -0
- package/dist/interactions/actions/outlines/useCreateOutlinesAdapter.js.map +1 -0
- package/dist/interactions/actions/planeInput.js +168 -0
- package/dist/interactions/actions/planeInput.js.map +1 -0
- package/dist/interactions/actions/poseDescriptorDep.js +9 -0
- package/dist/interactions/actions/poseDescriptorDep.js.map +1 -0
- package/dist/interactions/actions/poseFrame.js +38 -0
- package/dist/interactions/actions/poseFrame.js.map +1 -0
- package/dist/interactions/actions/previewOverrides.js +25 -0
- package/dist/interactions/actions/previewOverrides.js.map +1 -0
- package/dist/interactions/actions/resize/autoPoseDescriptor.js +32 -0
- package/dist/interactions/actions/resize/autoPoseDescriptor.js.map +1 -0
- package/dist/interactions/actions/resize/behaviors/clampMinSize.js +18 -0
- package/dist/interactions/actions/resize/behaviors/clampMinSize.js.map +1 -0
- package/dist/interactions/actions/resize/behaviors/index.js +8 -0
- package/dist/interactions/actions/resize/behaviors/index.js.map +1 -0
- package/dist/interactions/actions/resize/behaviors/lockAspect.js +24 -0
- package/dist/interactions/actions/resize/behaviors/lockAspect.js.map +1 -0
- package/dist/interactions/actions/resize/cornerHandles.js +72 -0
- package/dist/interactions/actions/resize/cornerHandles.js.map +1 -0
- package/dist/interactions/actions/resolveOverlays.js +60 -0
- package/dist/interactions/actions/resolveOverlays.js.map +1 -0
- package/dist/interactions/actions/resolvePreviews.js +61 -0
- package/dist/interactions/actions/resolvePreviews.js.map +1 -0
- package/dist/interactions/actions/rotate/geometry.js +46 -0
- package/dist/interactions/actions/rotate/geometry.js.map +1 -0
- package/dist/interactions/actions/rotate/handle.js +27 -0
- package/dist/interactions/actions/rotate/handle.js.map +1 -0
- package/dist/interactions/actions/spatialReference.js +42 -0
- package/dist/interactions/actions/spatialReference.js.map +1 -0
- package/dist/interactions/actions/useStandardActions.js +142 -0
- package/dist/interactions/actions/useStandardActions.js.map +1 -0
- package/dist/interactions/gestures/dragGesture/dragGesture.js +111 -0
- package/dist/interactions/gestures/dragGesture/dragGesture.js.map +1 -0
- package/dist/interactions/gestures/dragRadial/dragRadial.js +117 -0
- package/dist/interactions/gestures/dragRadial/dragRadial.js.map +1 -0
- package/dist/interactions/gestures/dragRect/dragRect.js +164 -0
- package/dist/interactions/gestures/dragRect/dragRect.js.map +1 -0
- package/dist/interactions/gestures/handleDrag/handleDrag.js +46 -0
- package/dist/interactions/gestures/handleDrag/handleDrag.js.map +1 -0
- package/dist/interactions/gestures/pointerDrag/pointerDrag.js +118 -0
- package/dist/interactions/gestures/pointerDrag/pointerDrag.js.map +1 -0
- package/dist/interactions/gestures/shared/originProjection.js +42 -0
- package/dist/interactions/gestures/shared/originProjection.js.map +1 -0
- package/dist/interactions/gestures/shared/screenTolerance.js +21 -0
- package/dist/interactions/gestures/shared/screenTolerance.js.map +1 -0
- package/dist/interactions/gestures/shared/snap.js +24 -0
- package/dist/interactions/gestures/shared/snap.js.map +1 -0
- package/dist/interactions/gestures/thresholdDrag/thresholdDrag.js +30 -0
- package/dist/interactions/gestures/thresholdDrag/thresholdDrag.js.map +1 -0
- package/dist/layout/arrivals.js +36 -0
- package/dist/layout/arrivals.js.map +1 -0
- package/dist/{math-MCQcf_gc.d.ts → math-CUMxmZzn.d.ts} +8 -116
- package/dist/math.d.ts +4 -5
- package/dist/math.js +6 -4
- package/dist/mesh.d.ts +268 -0
- package/dist/mesh.js +7 -0
- package/dist/move.d.ts +7 -49
- package/dist/move.js +3 -142
- package/dist/originProjection-BSn4xiEy.d.ts +57 -0
- package/dist/patterns-builtin.js +3 -3
- package/dist/{poseDescriptor-rZa9W5hJ.d.ts → poseDescriptor-CjSXMf8X.d.ts} +3 -3
- package/dist/registerProgram-ateHDGjw.d.ts +193 -0
- package/dist/renderer/DrawCommand.js +6 -0
- package/dist/renderer/DrawCommand.js.map +1 -0
- package/dist/renderer/WeaselRenderer.js +328 -0
- package/dist/renderer/WeaselRenderer.js.map +1 -0
- package/dist/renderer/cache/GLImageCache.js +64 -0
- package/dist/renderer/cache/GLImageCache.js.map +1 -0
- package/dist/renderer/cache/GLMeshCache.js +102 -0
- package/dist/renderer/cache/GLMeshCache.js.map +1 -0
- package/dist/renderer/cache/GLTextureCache.js +51 -0
- package/dist/renderer/cache/GLTextureCache.js.map +1 -0
- package/dist/renderer/cache/GradientRampAtlas.js +82 -0
- package/dist/renderer/cache/GradientRampAtlas.js.map +1 -0
- package/dist/renderer/cache/cache.js +13 -0
- package/dist/renderer/cache/cache.js.map +1 -0
- package/dist/renderer/cache/markerCommandCache.js +59 -0
- package/dist/renderer/cache/markerCommandCache.js.map +1 -0
- package/dist/renderer/cache/outlineMeshCache.js +15 -0
- package/dist/renderer/cache/outlineMeshCache.js.map +1 -0
- package/dist/renderer/cache/outlineStrokeMeshCache.js +31 -0
- package/dist/renderer/cache/outlineStrokeMeshCache.js.map +1 -0
- package/dist/renderer/cache/strokeMeshCache.js +44 -0
- package/dist/renderer/cache/strokeMeshCache.js.map +1 -0
- package/dist/renderer/cullDrawCommands.js +89 -0
- package/dist/renderer/cullDrawCommands.js.map +1 -0
- package/dist/renderer/draw.js +1109 -0
- package/dist/renderer/draw.js.map +1 -0
- package/dist/renderer/drawBatch.js +168 -0
- package/dist/renderer/drawBatch.js.map +1 -0
- package/dist/renderer/effects/EffectTargets.js +45 -0
- package/dist/renderer/effects/EffectTargets.js.map +1 -0
- package/dist/renderer/effects/builtins.js +31 -0
- package/dist/renderer/effects/builtins.js.map +1 -0
- package/dist/renderer/effects/composite.js +9 -0
- package/dist/renderer/effects/composite.js.map +1 -0
- package/dist/renderer/effects/effectPrelude.js +10 -0
- package/dist/renderer/effects/effectPrelude.js.map +1 -0
- package/dist/renderer/effects/types.js +10 -0
- package/dist/renderer/effects/types.js.map +1 -0
- package/dist/renderer/index.js +19 -0
- package/dist/renderer/math/color.js +341 -0
- package/dist/renderer/math/color.js.map +1 -0
- package/dist/renderer/math/mat3.js +71 -0
- package/dist/renderer/math/mat3.js.map +1 -0
- package/dist/renderer/math/patternSpace.js +22 -0
- package/dist/renderer/math/patternSpace.js.map +1 -0
- package/dist/renderer/math/viewToMat3.js +19 -0
- package/dist/renderer/math/viewToMat3.js.map +1 -0
- package/dist/renderer/paintResources.js +18 -0
- package/dist/renderer/paintResources.js.map +1 -0
- package/dist/renderer/paintScratch.js +37 -0
- package/dist/renderer/paintScratch.js.map +1 -0
- package/dist/renderer/shaders/ShaderProgram.js +74 -0
- package/dist/renderer/shaders/ShaderProgram.js.map +1 -0
- package/dist/renderer/shaders/batchFill.js +118 -0
- package/dist/renderer/shaders/batchFill.js.map +1 -0
- package/dist/renderer/shaders/customPrelude.js +34 -0
- package/dist/renderer/shaders/customPrelude.js.map +1 -0
- package/dist/renderer/shaders/extractUniformNames.js +184 -0
- package/dist/renderer/shaders/extractUniformNames.js.map +1 -0
- package/dist/renderer/shaders/glyphPaint.js +61 -0
- package/dist/renderer/shaders/glyphPaint.js.map +1 -0
- package/dist/renderer/shaders/gradFill.js +30 -0
- package/dist/renderer/shaders/gradFill.js.map +1 -0
- package/dist/renderer/shaders/imageFill.js +14 -0
- package/dist/renderer/shaders/imageFill.js.map +1 -0
- package/dist/renderer/shaders/pathFill.js +13 -0
- package/dist/renderer/shaders/pathFill.js.map +1 -0
- package/dist/renderer/shaders/patternFill.js +24 -0
- package/dist/renderer/shaders/patternFill.js.map +1 -0
- package/dist/renderer/shaders/registerProgram.js +18 -0
- package/dist/renderer/shaders/registerProgram.js.map +1 -0
- package/dist/renderer/spriteSheet.js +14 -0
- package/dist/renderer/spriteSheet.js.map +1 -0
- package/dist/renderer/state/GroupState.js +77 -0
- package/dist/renderer/state/GroupState.js.map +1 -0
- package/dist/renderer/syntheticItalic.js +6 -0
- package/dist/renderer/syntheticItalic.js.map +1 -0
- package/dist/renderer/textures/registerTexture.js +14 -0
- package/dist/renderer/textures/registerTexture.js.map +1 -0
- package/dist/renderer.d.ts +11 -21
- package/dist/renderer.js +18 -13
- package/dist/resize.d.ts +10 -46
- package/dist/resize.js +7 -5
- package/dist/routing.js +2 -3
- package/dist/scheduling/useVisibleRaf.js +69 -0
- package/dist/scheduling/useVisibleRaf.js.map +1 -0
- package/dist/test-hook/createTestHook.js +39 -0
- package/dist/test-hook/createTestHook.js.map +1 -0
- package/dist/test-hook/install.js +12 -0
- package/dist/test-hook/install.js.map +1 -0
- package/dist/test-seams-fYf6m5pu.d.ts +356 -0
- package/dist/test-seams.d.ts +6 -0
- package/dist/test-seams.js +3 -0
- package/dist/tools/builtin/ellipse/useEllipseTool.js +33 -0
- package/dist/tools/builtin/ellipse/useEllipseTool.js.map +1 -0
- package/dist/tools/builtin/eyedropper/useEyedropperTool.js +55 -0
- package/dist/tools/builtin/eyedropper/useEyedropperTool.js.map +1 -0
- package/dist/tools/builtin/hand/dragPanContribution.js +17 -0
- package/dist/tools/builtin/hand/dragPanContribution.js.map +1 -0
- package/dist/tools/builtin/hand/useHandTool.js +31 -0
- package/dist/tools/builtin/hand/useHandTool.js.map +1 -0
- package/dist/tools/builtin/image/useImageTool.js +41 -0
- package/dist/tools/builtin/image/useImageTool.js.map +1 -0
- package/dist/tools/builtin/lasso/useLassoTool.js +42 -0
- package/dist/tools/builtin/lasso/useLassoTool.js.map +1 -0
- package/dist/tools/builtin/line/useLineTool.js +33 -0
- package/dist/tools/builtin/line/useLineTool.js.map +1 -0
- package/dist/tools/builtin/pen/usePenTool.js +414 -0
- package/dist/tools/builtin/pen/usePenTool.js.map +1 -0
- package/dist/tools/builtin/pencil/usePencilTool.js +36 -0
- package/dist/tools/builtin/pencil/usePencilTool.js.map +1 -0
- package/dist/tools/builtin/pickTopMostHit.js +45 -0
- package/dist/tools/builtin/pickTopMostHit.js.map +1 -0
- package/dist/tools/builtin/polygon/usePolygonTool.js +81 -0
- package/dist/tools/builtin/polygon/usePolygonTool.js.map +1 -0
- package/dist/tools/builtin/rect/useRectTool.js +32 -0
- package/dist/tools/builtin/rect/useRectTool.js.map +1 -0
- package/dist/tools/builtin/select/selectionContributions.js +109 -0
- package/dist/tools/builtin/select/selectionContributions.js.map +1 -0
- package/dist/tools/builtin/select/useSelectTool.js +162 -0
- package/dist/tools/builtin/select/useSelectTool.js.map +1 -0
- package/dist/tools/builtin/shared/insertToolOptions.js +8 -0
- package/dist/tools/builtin/shared/insertToolOptions.js.map +1 -0
- package/dist/tools/builtin/slice/useSliceTool.js +263 -0
- package/dist/tools/builtin/slice/useSliceTool.js.map +1 -0
- package/dist/tools/builtin/star/useStarTool.js +82 -0
- package/dist/tools/builtin/star/useStarTool.js.map +1 -0
- package/dist/tools/builtin/text/useTextTool.js +177 -0
- package/dist/tools/builtin/text/useTextTool.js.map +1 -0
- package/dist/tools/overlayBinding.js +8 -0
- package/dist/tools/overlayBinding.js.map +1 -0
- package/dist/tools/prefs.js +47 -0
- package/dist/tools/prefs.js.map +1 -0
- package/dist/tools/useKeybindings.js +66 -0
- package/dist/tools/useKeybindings.js.map +1 -0
- package/dist/{types-D-9QWBy5.d.ts → types-CA54-mAZ.d.ts} +181 -13
- package/dist/{types-qYpyTAiZ.d.ts → types-DSjd6W3n.d.ts} +32 -6
- package/dist/util/color.js +26 -0
- package/dist/util/color.js.map +1 -0
- package/dist/util/constrainTo45.js +17 -0
- package/dist/util/constrainTo45.js.map +1 -0
- package/dist/util/paint.js +72 -0
- package/dist/util/paint.js.map +1 -0
- package/dist/version.js +6 -0
- package/dist/version.js.map +1 -0
- package/package.json +29 -19
- package/dist/chunk-3TY6FHAF.js +0 -170
- package/dist/chunk-3TY6FHAF.js.map +0 -1
- package/dist/chunk-DGWNNKGD.js +0 -248
- package/dist/chunk-DGWNNKGD.js.map +0 -1
- package/dist/chunk-G4ZGQMY7.js +0 -33372
- package/dist/chunk-G4ZGQMY7.js.map +0 -1
- package/dist/chunk-L5YNZYEG.js +0 -648
- package/dist/chunk-L5YNZYEG.js.map +0 -1
- package/dist/chunk-LU4IJ52W.js +0 -111
- package/dist/chunk-LU4IJ52W.js.map +0 -1
- package/dist/chunk-M24CLARN.js +0 -28
- package/dist/chunk-M24CLARN.js.map +0 -1
- package/dist/chunk-NE27EOLP.js +0 -146
- package/dist/chunk-NE27EOLP.js.map +0 -1
- package/dist/chunk-PNNZSYRD.js +0 -318
- package/dist/chunk-PNNZSYRD.js.map +0 -1
- package/dist/chunk-UPZY4ART.js +0 -29
- package/dist/chunk-UPZY4ART.js.map +0 -1
- package/dist/chunk-WPNA6L5O.js +0 -250
- package/dist/chunk-WPNA6L5O.js.map +0 -1
- package/dist/chunk-XMAWPGTK.js +0 -128
- package/dist/chunk-XMAWPGTK.js.map +0 -1
- package/dist/clipboard.js.map +0 -1
- package/dist/clone.js.map +0 -1
- package/dist/grid-CY5UKlZh.d.ts +0 -98
- package/dist/index.css.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/insert.d.ts +0 -36
- package/dist/insert.js +0 -81
- package/dist/insert.js.map +0 -1
- package/dist/math.js.map +0 -1
- package/dist/move.js.map +0 -1
- package/dist/path-JEV2c5If.d.ts +0 -48
- package/dist/patterns-builtin.js.map +0 -1
- package/dist/renderer.css +0 -62
- package/dist/renderer.css.map +0 -1
- package/dist/renderer.js.map +0 -1
- package/dist/resize.js.map +0 -1
- package/dist/routing.js.map +0 -1
- package/dist/types-D2tTKEU0.d.ts +0 -18
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color.js","names":["parseColor","cached","CACHE","input","result","parseColorUncached","CACHE_MAX","s","parseHex","lower","named","NAMED_COLORS","parsed","parseRgbFunction","parseHslFunction","RESOLVE_COLOR_CACHE_CAP","resolveColorCache","resolveColor","hit","frozen","parseColorToRgba255","r","g","b","normalizeHex","trimmed","body","hexToRgba","rgbaToHex","rgba","a","f","n","base","hex","unwrapFn","name","splitChannels","parts","p","slash","head","alpha","parseChannel","tok","clamp01","max","parseAlpha","channels","h","parseHue","sat","parsePercentOrNumber","lit","hslToRgb","hslToSrgb","out"],"sources":["../../../src/renderer/math/color.ts"],"sourcesContent":["import { hslToSrgb } from '@weasel-js/paint';\n\n/**\n * Parse a CSS color string into [r, g, b, a] with 0..1 components.\n *\n * Supported forms:\n * - Hex: `#rgb`, `#rgba`, `#rrggbb`, `#rrggbbaa` (any case)\n * - `rgb()` / `rgba()` with integer, float, or percent R/G/B; number or\n * percent alpha; commas or modern space-separated `R G B / A` syntax\n * - `hsl()` / `hsla()` with hue as a unitless number (deg) or with `deg`,\n * `rad`, `grad`, `turn` units; saturation/lightness as percent (or\n * unitless in the modern syntax); same alpha rules and separator rules\n * as `rgb()`\n * - The 148 CSS named colors plus `transparent`\n *\n * Not supported: `oklch()`, `lab()`, `color()`, `currentColor`, system\n * colors. Throws on anything unrecognized.\n *\n * Results are cached by input-string identity. Callers MUST treat the\n * returned tuple as read-only — mutation would corrupt the cache.\n */\nexport function parseColor(input: string): [number, number, number, number] {\n const cached = CACHE.get(input);\n if (cached !== undefined) return cached;\n const result = parseColorUncached(input);\n if (CACHE.size >= CACHE_MAX) CACHE.clear();\n CACHE.set(input, result);\n return result;\n}\n\nconst CACHE = new Map<string, [number, number, number, number]>();\nconst CACHE_MAX = 1024;\n\nfunction parseColorUncached(input: string): [number, number, number, number] {\n const s = input.trim();\n if (s.startsWith('#')) return parseHex(s);\n\n const lower = s.toLowerCase();\n\n // Named colors and `transparent` are checked before fn() forms because the\n // fn() regexes won't match them anyway and the lookup is cheaper than a\n // failed regex match.\n const named = NAMED_COLORS[lower];\n if (named !== undefined) return named;\n\n if (lower.startsWith('rgb')) {\n const parsed = parseRgbFunction(lower);\n if (parsed) return parsed;\n }\n if (lower.startsWith('hsl')) {\n const parsed = parseHslFunction(lower);\n if (parsed) return parsed;\n }\n\n throw new Error(`parseColor: unrecognized color \"${input}\"`);\n}\n\nconst RESOLVE_COLOR_CACHE_CAP = 1024;\nconst resolveColorCache = new Map<string, readonly [number, number, number, number]>();\n\n/** Cached `parseColor`. Use this from renderer hot paths (per-frame draw\n * callbacks, gradient ramp builds) so repeated color strings — which are\n * common when many objects share a fill — don't re-tokenize each frame.\n *\n * Cache is keyed by input-string identity, capped at ~1024 entries, and\n * cleared wholesale on overflow (no LRU tracking — simple is fine since\n * the working set in any one app is typically much smaller than the cap). */\nexport function resolveColor(input: string): readonly [number, number, number, number] {\n const hit = resolveColorCache.get(input);\n if (hit) return hit;\n if (resolveColorCache.size >= RESOLVE_COLOR_CACHE_CAP) {\n resolveColorCache.clear();\n }\n const parsed = parseColor(input);\n const frozen = parsed as readonly [number, number, number, number];\n resolveColorCache.set(input, frozen);\n return frozen;\n}\n\n/** @internal Test-only: drops the resolveColor memoization cache so tests\n * can assert behavior in isolation. Never call from production code. */\nexport function __resetResolveColorCache(): void {\n resolveColorCache.clear();\n}\n\n/** Same as `parseColor` but returns integer 0..255 components. */\nexport function parseColorToRgba255(input: string): [number, number, number, number] {\n const [r, g, b, a] = parseColor(input);\n return [\n Math.round(r * 255),\n Math.round(g * 255),\n Math.round(b * 255),\n Math.round(a * 255),\n ];\n}\n\n/**\n * Canonicalize a hex color string to lowercase `#rrggbb` or `#rrggbbaa`.\n *\n * Accepts: `#rgb`, `#rgba`, `#rrggbb`, `#rrggbbaa`, with or without the\n * leading `#`, any case. Throws on other inputs.\n */\nexport function normalizeHex(input: string): string {\n const trimmed = input.trim();\n const body = (trimmed.startsWith('#') ? trimmed.slice(1) : trimmed).toLowerCase();\n if (!/^[0-9a-f]+$/.test(body)) {\n throw new Error(`normalizeHex: invalid hex \"${input}\"`);\n }\n if (body.length === 3) {\n return `#${body[0]}${body[0]}${body[1]}${body[1]}${body[2]}${body[2]}`;\n }\n if (body.length === 4) {\n return `#${body[0]}${body[0]}${body[1]}${body[1]}${body[2]}${body[2]}${body[3]}${body[3]}`;\n }\n if (body.length === 6 || body.length === 8) {\n return `#${body}`;\n }\n throw new Error(`normalizeHex: invalid hex \"${input}\"`);\n}\n\n/**\n * Parse a hex color into [r, g, b, a] with 0..1 components. Accepts the same\n * forms as `normalizeHex`, including a missing leading `#`.\n */\nexport function hexToRgba(input: string): [number, number, number, number] {\n return parseHex(normalizeHex(input));\n}\n\n/**\n * Format [r, g, b, a] (0..1 components) as a hex string. Emits `#rrggbb` when\n * alpha is exactly 1 (or omitted), otherwise `#rrggbbaa`.\n */\nexport function rgbaToHex(rgba: readonly [number, number, number, number] | readonly [number, number, number]): string {\n const [r, g, b] = rgba;\n const a = rgba.length === 4 ? rgba[3] : 1;\n const f = (n: number) => Math.max(0, Math.min(255, Math.round(n * 255))).toString(16).padStart(2, '0');\n const base = `#${f(r)}${f(g)}${f(b)}`;\n return a >= 1 ? base : `${base}${f(a)}`;\n}\n\nfunction parseHex(s: string): [number, number, number, number] {\n const hex = s.slice(1);\n if (hex.length === 3) {\n return [\n parseInt(hex[0] + hex[0], 16) / 255,\n parseInt(hex[1] + hex[1], 16) / 255,\n parseInt(hex[2] + hex[2], 16) / 255,\n 1,\n ];\n }\n if (hex.length === 4) {\n return [\n parseInt(hex[0] + hex[0], 16) / 255,\n parseInt(hex[1] + hex[1], 16) / 255,\n parseInt(hex[2] + hex[2], 16) / 255,\n parseInt(hex[3] + hex[3], 16) / 255,\n ];\n }\n if (hex.length === 6) {\n return [\n parseInt(hex.slice(0, 2), 16) / 255,\n parseInt(hex.slice(2, 4), 16) / 255,\n parseInt(hex.slice(4, 6), 16) / 255,\n 1,\n ];\n }\n if (hex.length === 8) {\n return [\n parseInt(hex.slice(0, 2), 16) / 255,\n parseInt(hex.slice(2, 4), 16) / 255,\n parseInt(hex.slice(4, 6), 16) / 255,\n parseInt(hex.slice(6, 8), 16) / 255,\n ];\n }\n throw new Error(`parseColor: invalid hex \"${s}\"`);\n}\n\n/** Match `name( body )` and return the trimmed body, or null. */\nfunction unwrapFn(s: string, name: string): string | null {\n if (!s.startsWith(name + '(') || !s.endsWith(')')) return null;\n return s.slice(name.length + 1, -1).trim();\n}\n\n/**\n * Split a function body into the value tokens (3 channels + optional alpha).\n * Supports both legacy `r, g, b[, a]` and modern `r g b[ / a]` separators.\n * Returns null if the token count is wrong.\n */\nfunction splitChannels(body: string): { rgb: [string, string, string]; alpha: string | null } | null {\n if (body.includes(',')) {\n const parts = body.split(',').map((p) => p.trim());\n if (parts.length !== 3 && parts.length !== 4) return null;\n return {\n rgb: [parts[0], parts[1], parts[2]],\n alpha: parts.length === 4 ? parts[3] : null,\n };\n }\n // Modern syntax: whitespace-separated, with optional `/ alpha` tail.\n const slash = body.indexOf('/');\n const head = (slash === -1 ? body : body.slice(0, slash)).trim();\n const alpha = slash === -1 ? null : body.slice(slash + 1).trim();\n const parts = head.split(/\\s+/);\n if (parts.length !== 3) return null;\n if (alpha !== null && alpha === '') return null;\n return { rgb: [parts[0], parts[1], parts[2]], alpha };\n}\n\n/** Parse a channel value: integer, float, or percent. Returns 0..1 (with `max` as the integer scale). */\nfunction parseChannel(tok: string, max: number): number | null {\n if (tok.endsWith('%')) {\n const n = Number(tok.slice(0, -1));\n if (!Number.isFinite(n)) return null;\n return clamp01(n / 100);\n }\n const n = Number(tok);\n if (!Number.isFinite(n)) return null;\n return clamp01(n / max);\n}\n\n/** Alpha may be a number 0..1 or a percent. */\nfunction parseAlpha(tok: string | null): number {\n if (tok === null) return 1;\n if (tok.endsWith('%')) {\n const n = Number(tok.slice(0, -1));\n return Number.isFinite(n) ? clamp01(n / 100) : 1;\n }\n const n = Number(tok);\n return Number.isFinite(n) ? clamp01(n) : 1;\n}\n\nfunction parseRgbFunction(s: string): [number, number, number, number] | null {\n const body = unwrapFn(s, 'rgba') ?? unwrapFn(s, 'rgb');\n if (body === null) return null;\n const channels = splitChannels(body);\n if (!channels) return null;\n const r = parseChannel(channels.rgb[0], 255);\n const g = parseChannel(channels.rgb[1], 255);\n const b = parseChannel(channels.rgb[2], 255);\n if (r === null || g === null || b === null) return null;\n return [r, g, b, parseAlpha(channels.alpha)];\n}\n\nfunction parseHslFunction(s: string): [number, number, number, number] | null {\n const body = unwrapFn(s, 'hsla') ?? unwrapFn(s, 'hsl');\n if (body === null) return null;\n const channels = splitChannels(body);\n if (!channels) return null;\n const h = parseHue(channels.rgb[0]);\n const sat = parsePercentOrNumber(channels.rgb[1]);\n const lit = parsePercentOrNumber(channels.rgb[2]);\n if (h === null || sat === null || lit === null) return null;\n const [r, g, b] = hslToRgb(h, sat, lit);\n return [r, g, b, parseAlpha(channels.alpha)];\n}\n\n/** Parse a hue token: `<number>`, `<number>deg`, `<number>rad`, `<number>grad`, `<number>turn`. Returns degrees 0..360 (modulo). */\nfunction parseHue(tok: string): number | null {\n let n: number;\n if (tok.endsWith('deg')) n = Number(tok.slice(0, -3));\n else if (tok.endsWith('grad')) n = Number(tok.slice(0, -4)) * 0.9; // 400grad = 360deg\n else if (tok.endsWith('rad')) n = Number(tok.slice(0, -3)) * (180 / Math.PI);\n else if (tok.endsWith('turn')) n = Number(tok.slice(0, -4)) * 360;\n else n = Number(tok);\n if (!Number.isFinite(n)) return null;\n return ((n % 360) + 360) % 360;\n}\n\n/** Saturation/lightness may be percent (CSS Color 3) or unitless number 0..1 (modern). */\nfunction parsePercentOrNumber(tok: string): number | null {\n if (tok.endsWith('%')) {\n const n = Number(tok.slice(0, -1));\n return Number.isFinite(n) ? clamp01(n / 100) : null;\n }\n const n = Number(tok);\n return Number.isFinite(n) ? clamp01(n) : null;\n}\n\n/**\n * HSL → RGB, all components 0..1 except hue in degrees (0..360). paint's\n * `hslToSrgb` under the name this file's callers use.\n *\n * @internal Not part of the public API; not re-exported from the barrel.\n */\nexport const hslToRgb = hslToSrgb;\n\nfunction clamp01(n: number): number {\n return n < 0 ? 0 : n > 1 ? 1 : n;\n}\n\n// CSS Color Module Level 4 named colors. Stored as already-resolved tuples so\n// lookup is O(1) and avoids a second parse hop.\nconst NAMED_COLORS: Record<string, [number, number, number, number]> = (() => {\n const hex: Record<string, number> = {\n aliceblue: 0xf0f8ff, antiquewhite: 0xfaebd7, aqua: 0x00ffff, aquamarine: 0x7fffd4,\n azure: 0xf0ffff, beige: 0xf5f5dc, bisque: 0xffe4c4, black: 0x000000,\n blanchedalmond: 0xffebcd, blue: 0x0000ff, blueviolet: 0x8a2be2, brown: 0xa52a2a,\n burlywood: 0xdeb887, cadetblue: 0x5f9ea0, chartreuse: 0x7fff00, chocolate: 0xd2691e,\n coral: 0xff7f50, cornflowerblue: 0x6495ed, cornsilk: 0xfff8dc, crimson: 0xdc143c,\n cyan: 0x00ffff, darkblue: 0x00008b, darkcyan: 0x008b8b, darkgoldenrod: 0xb8860b,\n darkgray: 0xa9a9a9, darkgreen: 0x006400, darkgrey: 0xa9a9a9, darkkhaki: 0xbdb76b,\n darkmagenta: 0x8b008b, darkolivegreen: 0x556b2f, darkorange: 0xff8c00, darkorchid: 0x9932cc,\n darkred: 0x8b0000, darksalmon: 0xe9967a, darkseagreen: 0x8fbc8f, darkslateblue: 0x483d8b,\n darkslategray: 0x2f4f4f, darkslategrey: 0x2f4f4f, darkturquoise: 0x00ced1, darkviolet: 0x9400d3,\n deeppink: 0xff1493, deepskyblue: 0x00bfff, dimgray: 0x696969, dimgrey: 0x696969,\n dodgerblue: 0x1e90ff, firebrick: 0xb22222, floralwhite: 0xfffaf0, forestgreen: 0x228b22,\n fuchsia: 0xff00ff, gainsboro: 0xdcdcdc, ghostwhite: 0xf8f8ff, gold: 0xffd700,\n goldenrod: 0xdaa520, gray: 0x808080, green: 0x008000, greenyellow: 0xadff2f,\n grey: 0x808080, honeydew: 0xf0fff0, hotpink: 0xff69b4, indianred: 0xcd5c5c,\n indigo: 0x4b0082, ivory: 0xfffff0, khaki: 0xf0e68c, lavender: 0xe6e6fa,\n lavenderblush: 0xfff0f5, lawngreen: 0x7cfc00, lemonchiffon: 0xfffacd, lightblue: 0xadd8e6,\n lightcoral: 0xf08080, lightcyan: 0xe0ffff, lightgoldenrodyellow: 0xfafad2, lightgray: 0xd3d3d3,\n lightgreen: 0x90ee90, lightgrey: 0xd3d3d3, lightpink: 0xffb6c1, lightsalmon: 0xffa07a,\n lightseagreen: 0x20b2aa, lightskyblue: 0x87cefa, lightslategray: 0x778899, lightslategrey: 0x778899,\n lightsteelblue: 0xb0c4de, lightyellow: 0xffffe0, lime: 0x00ff00, limegreen: 0x32cd32,\n linen: 0xfaf0e6, magenta: 0xff00ff, maroon: 0x800000, mediumaquamarine: 0x66cdaa,\n mediumblue: 0x0000cd, mediumorchid: 0xba55d3, mediumpurple: 0x9370db, mediumseagreen: 0x3cb371,\n mediumslateblue: 0x7b68ee, mediumspringgreen: 0x00fa9a, mediumturquoise: 0x48d1cc, mediumvioletred: 0xc71585,\n midnightblue: 0x191970, mintcream: 0xf5fffa, mistyrose: 0xffe4e1, moccasin: 0xffe4b5,\n navajowhite: 0xffdead, navy: 0x000080, oldlace: 0xfdf5e6, olive: 0x808000,\n olivedrab: 0x6b8e23, orange: 0xffa500, orangered: 0xff4500, orchid: 0xda70d6,\n palegoldenrod: 0xeee8aa, palegreen: 0x98fb98, paleturquoise: 0xafeeee, palevioletred: 0xdb7093,\n papayawhip: 0xffefd5, peachpuff: 0xffdab9, peru: 0xcd853f, pink: 0xffc0cb,\n plum: 0xdda0dd, powderblue: 0xb0e0e6, purple: 0x800080, rebeccapurple: 0x663399,\n red: 0xff0000, rosybrown: 0xbc8f8f, royalblue: 0x4169e1, saddlebrown: 0x8b4513,\n salmon: 0xfa8072, sandybrown: 0xf4a460, seagreen: 0x2e8b57, seashell: 0xfff5ee,\n sienna: 0xa0522d, silver: 0xc0c0c0, skyblue: 0x87ceeb, slateblue: 0x6a5acd,\n slategray: 0x708090, slategrey: 0x708090, snow: 0xfffafa, springgreen: 0x00ff7f,\n steelblue: 0x4682b4, tan: 0xd2b48c, teal: 0x008080, thistle: 0xd8bfd8,\n tomato: 0xff6347, turquoise: 0x40e0d0, violet: 0xee82ee, wheat: 0xf5deb3,\n white: 0xffffff, whitesmoke: 0xf5f5f5, yellow: 0xffff00, yellowgreen: 0x9acd32,\n };\n const out: Record<string, [number, number, number, number]> = {\n transparent: [0, 0, 0, 0],\n };\n for (const name in hex) {\n const n = hex[name];\n out[name] = [((n >> 16) & 0xff) / 255, ((n >> 8) & 0xff) / 255, (n & 0xff) / 255, 1];\n }\n return out;\n})();\n"],"mappings":";;AAqBA,SAAgB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AK,IAAMpB,KAAQF,GAAK;EACtB,IAAMF,IAAIE,EAAIE;EACd,EAAIA,KAAQ;IAAGJ,KAAK,KAAM,OAAQ;IAAOA,KAAK,IAAK,OAAQ;IAAMA,IAAI,OAAQ;GAAK;EAAC;CACrF;CACA,OAAOwB;AACT,EAAA,CAAG"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { invert as e } from "@weasel-js/geom";
|
|
2
|
+
//#region src/renderer/math/mat3.ts
|
|
3
|
+
function t(e, t, n, r, i, a) {
|
|
4
|
+
return new Float32Array([
|
|
5
|
+
e,
|
|
6
|
+
t,
|
|
7
|
+
0,
|
|
8
|
+
n,
|
|
9
|
+
r,
|
|
10
|
+
0,
|
|
11
|
+
i,
|
|
12
|
+
a,
|
|
13
|
+
1
|
|
14
|
+
]);
|
|
15
|
+
}
|
|
16
|
+
function n() {
|
|
17
|
+
return t(1, 0, 0, 1, 0, 0);
|
|
18
|
+
}
|
|
19
|
+
function r(e, n) {
|
|
20
|
+
let r = e[0], i = e[1], a = e[3], o = e[4], s = e[6], c = e[7], l = n[0], u = n[1], d = n[3], f = n[4], p = n[6], m = n[7];
|
|
21
|
+
return t(r * l + a * u, i * l + o * u, r * d + a * f, i * d + o * f, r * p + a * m + s, i * p + o * m + c);
|
|
22
|
+
}
|
|
23
|
+
function i(e, n, i) {
|
|
24
|
+
return r(e, t(1, 0, 0, 1, n, i));
|
|
25
|
+
}
|
|
26
|
+
function a(e, n, i) {
|
|
27
|
+
return r(e, t(n, 0, 0, i, 0, 0));
|
|
28
|
+
}
|
|
29
|
+
function o(e) {
|
|
30
|
+
return [
|
|
31
|
+
e[0],
|
|
32
|
+
e[1],
|
|
33
|
+
e[3],
|
|
34
|
+
e[4],
|
|
35
|
+
e[6],
|
|
36
|
+
e[7]
|
|
37
|
+
];
|
|
38
|
+
}
|
|
39
|
+
function s(e) {
|
|
40
|
+
return t(e[0], e[1], e[2], e[3], e[4], e[5]);
|
|
41
|
+
}
|
|
42
|
+
function c(t) {
|
|
43
|
+
let n = e(o(t));
|
|
44
|
+
return n && s(n);
|
|
45
|
+
}
|
|
46
|
+
function l(e, t, n) {
|
|
47
|
+
let r = e[0], i = e[1], a = e[3], o = e[4], s = e[6], c = e[7];
|
|
48
|
+
return [r * t + a * n + s, i * t + o * n + c];
|
|
49
|
+
}
|
|
50
|
+
function u(e, n) {
|
|
51
|
+
return t(2 / e, 0, 0, -2 / n, -1, 1);
|
|
52
|
+
}
|
|
53
|
+
function d(e) {
|
|
54
|
+
return Math.sqrt(Math.abs(e[0] * e[4] - e[1] * e[3]));
|
|
55
|
+
}
|
|
56
|
+
var f = {
|
|
57
|
+
identity: n,
|
|
58
|
+
toAffine: o,
|
|
59
|
+
fromAffine: s,
|
|
60
|
+
multiply: r,
|
|
61
|
+
translated: i,
|
|
62
|
+
scaled: a,
|
|
63
|
+
invert: c,
|
|
64
|
+
apply: l,
|
|
65
|
+
screenToClip: u,
|
|
66
|
+
meanScaleOf: d
|
|
67
|
+
};
|
|
68
|
+
//#endregion
|
|
69
|
+
export { f as mat3 };
|
|
70
|
+
|
|
71
|
+
//# sourceMappingURL=mat3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mat3.js","names":["multiply","invert","invertAffine","create","a","b","c","d","tx","ty","identity","multiply$1","out","ma","m","mb","mc","md","mtx","mty","translated","scaled","sx","sy","toAffine","fromAffine","invert$1","inv","invert","apply","x","y","screenToClip","width","height","meanScaleOf","mat3"],"sources":["../../../src/renderer/math/mat3.ts"],"sourcesContent":["/**\n * 2D affine matrix utilities. Column-major 9-element Float32Array, matching\n * `WebGL2RenderingContext.uniformMatrix3fv` byte order so we can pass the\n * array directly without a transpose flag.\n *\n * Layout (column-major):\n * [m00, m10, 0,\n * m01, m11, 0,\n * tx, ty, 1]\n *\n * `apply(m, x, y)` returns `[m * (x, y, 1)] = [m00*x + m01*y + tx,\n * m10*x + m11*y + ty]`.\n */\n\nimport { invert as invertAffine, type Mat3 as Affine } from '@weasel-js/geom';\n\n/** A 2D affine transform as a column-major 9-element `Float32Array`, laid out as above. */\nexport type GlMat3 = Float32Array;\n\nfunction create(a: number, b: number, c: number, d: number, tx: number, ty: number): GlMat3 {\n // Column-major:\n // col 0: (a, b, 0)\n // col 1: (c, d, 0)\n // col 2: (tx, ty, 1)\n return new Float32Array([a, b, 0, c, d, 0, tx, ty, 1]);\n}\n\nfunction identity(): GlMat3 {\n return create(1, 0, 0, 1, 0, 0);\n}\n\nfunction multiply(out: GlMat3, m: GlMat3): GlMat3 {\n // out := out · m (right-multiply by m).\n const a = out[0], b = out[1];\n const c = out[3], d = out[4];\n const tx = out[6], ty = out[7];\n const ma = m[0], mb = m[1];\n const mc = m[3], md = m[4];\n const mtx = m[6], mty = m[7];\n\n return create(\n a * ma + c * mb, // new a\n b * ma + d * mb, // new b\n a * mc + c * md, // new c\n b * mc + d * md, // new d\n a * mtx + c * mty + tx, // new tx\n b * mtx + d * mty + ty, // new ty\n );\n}\n\n/** `m · T(tx, ty)`: composes onto `m`, where `@weasel-js/geom`'s `translate`\n * constructs a fresh matrix. */\nfunction translated(m: GlMat3, tx: number, ty: number): GlMat3 {\n const t = create(1, 0, 0, 1, tx, ty);\n return multiply(m, t);\n}\n\n/** `m · S(sx, sy)`: composes onto `m`, where geom's `scale` constructs one. */\nfunction scaled(m: GlMat3, sx: number, sy: number): GlMat3 {\n const s = create(sx, 0, 0, sy, 0, 0);\n return multiply(m, s);\n}\n\n/** This layout read as the kernel's 6-element affine. The two carry the same\n * logical order, so the conversion is a repack and nothing else — it exists\n * so the repack has a name instead of appearing inline at each crossing. */\nfunction toAffine(m: GlMat3): Affine {\n return [m[0], m[1], m[3], m[4], m[6], m[7]];\n}\n\n/** The kernel's affine in this layout. The inverse of {@link toAffine}, and\n * what an `SvgGroupNode.transform` (also a kernel affine) becomes on its way\n * to a `GroupDrawCommand`. */\nfunction fromAffine(a: Affine): GlMat3 {\n return create(a[0], a[1], a[2], a[3], a[4], a[5]);\n}\n\n/** Inverse of an affine matrix, or `null` when `@weasel-js/geom`'s `invert`\n * finds it singular — the same rule, read through this layout. */\nfunction invert(m: GlMat3): GlMat3 | null {\n const inv = invertAffine(toAffine(m));\n return inv && fromAffine(inv);\n}\n\nfunction apply(m: GlMat3, x: number, y: number): [number, number] {\n const a = m[0], b = m[1];\n const c = m[3], d = m[4];\n const tx = m[6], ty = m[7];\n return [a * x + c * y + tx, b * x + d * y + ty];\n}\n\n/**\n * Map screen pixel coords (0..width on X, 0..height on Y, top-left origin)\n * into clip space (-1..1 on X, 1..-1 on Y — note Y flip so screen-down\n * matches clip-down).\n */\nfunction screenToClip(width: number, height: number): GlMat3 {\n return create(\n 2 / width, // a\n 0, // b\n 0, // c\n -2 / height, // d\n -1, // tx\n 1, // ty\n );\n}\n\n/**\n * Uniform-equivalent scale factor: the square root of the absolute\n * determinant of the linear part, i.e. the geometric mean of the two axis\n * scales. Rotation-invariant. Under non-uniform scale it is between the two\n * axes and exact on neither — the same compromise `meanScale` documents.\n */\nfunction meanScaleOf(m: GlMat3): number {\n return Math.sqrt(Math.abs(m[0] * m[4] - m[1] * m[3]));\n}\n\n/** The renderer's 3x3 matrix operations, as one namespace. These work on the\n * 9-element `Float32Array` form the GL uniform upload wants — distinct from\n * `@weasel-js/geom`'s 6-element affine `GlMat3`, though the logical element\n * order is the same. */\nexport const mat3 = {\n identity,\n toAffine,\n fromAffine,\n multiply,\n translated,\n scaled,\n invert,\n apply,\n screenToClip,\n meanScaleOf,\n};\n"],"mappings":";;AAmBA,SAASG,EAAO,GAAW,GAAW,GAAW,GAAW,GAAY,GAAoB;CAK1F,OAAO,IAAI,aAAa;EAACC;EAAGC;EAAG;EAAGC;EAAGC;EAAG;EAAGC;EAAIC;EAAI;CAAC,CAAC;AACvD;AAEA,SAASC,IAAmB;CAC1B,OAAOP,EAAO,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAChC;AAEA,SAASH,EAAS,GAAa,GAAmB;CAEhD,IAAMI,I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AE;CACxB,OAAO,CAACV,IAAI0B,IAAIxB,IAAIyB,IAAIvB,GAAIH,IAAIyB,IAAIvB,IAAIwB,IAAItB,CAAE;AAChD;AAOA,SAASuB,EAAa,GAAe,GAAwB;CAC3D,OAAO7B,EACL,IAAI8B,GACJ,GACA,GACA,KAAKC,GACL,IACA,CACF;AACF;AAQA,SAASC,EAAY,GAAmB;CACtC,OAAO,KAAK,KAAK,KAAK,IAAIrB,EAAE,KAAKA,EAAE,KAAKA,EAAE,KAAKA,EAAE,EAAE,CAAC;AACtD;AAMA,IAAasB,IAAO;CAClB;CACA;CACA;CACA,UAAAzB;CACA;CACA;CACA,QAAAe;CACA;CACA;CACA;AACF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { mat3 as e } from "./mat3.js";
|
|
2
|
+
//#region src/renderer/math/patternSpace.ts
|
|
3
|
+
function t(t, n, r) {
|
|
4
|
+
let [i, a, o, s] = r ?? [
|
|
5
|
+
1,
|
|
6
|
+
0,
|
|
7
|
+
0,
|
|
8
|
+
1
|
|
9
|
+
], c = e.fromAffine([
|
|
10
|
+
i,
|
|
11
|
+
a,
|
|
12
|
+
o,
|
|
13
|
+
s,
|
|
14
|
+
n.x,
|
|
15
|
+
n.y
|
|
16
|
+
]), l = e.invert(c);
|
|
17
|
+
return l && e.multiply(l, t);
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { t as patternTileSpace };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=patternSpace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patternSpace.js","names":["patternTileSpace","a","b","c","d","transform","placement","mat3","origin","unplace","spaceInverse"],"sources":["../../../src/renderer/math/patternSpace.ts"],"sourcesContent":["import type { PatternTransform } from '@weasel-js/paint';\nimport { mat3, type GlMat3 } from './mat3';\n\n/**\n * Screen → tile-space matrix for a pattern fill: `spaceInverse` takes a screen\n * position into the paint's `units` space, then this undoes the tile's\n * placement there, `origin + transform · tile`. Tile space is in paint units,\n * so the shader divides by the tile's size to get a texture coordinate.\n *\n * `null` when `transform` is singular — a tile collapsed to a line has no\n * point to sample for most of the plane, and a paint with no inverse draws\n * nothing, as gradients do.\n */\nexport function patternTileSpace(\n spaceInverse: GlMat3,\n origin: { x: number; y: number },\n transform: PatternTransform | undefined,\n): GlMat3 | null {\n const [a, b, c, d] = transform ?? [1, 0, 0, 1];\n const placement = mat3.fromAffine([a, b, c, d, origin.x, origin.y]);\n const unplace = mat3.invert(placement);\n return unplace && mat3.multiply(unplace, spaceInverse);\n}\n"],"mappings":";;AAaA,SAAgBA,EACd,GACA,GACA,GACe;CACf,IAAM,CAACC,GAAGC,GAAGC,GAAGC,KAAKC,KAAa;EAAC;EAAG;EAAG;EAAG;CAAC,GACvCC,IAAYC,EAAK,WAAW;EAACN;EAAGC;EAAGC;EAAGC;EAAGI,EAAO;EAAGA,EAAO;CAAC,CAAC,GAC5DC,IAAUF,EAAK,OAAOD,CAAS;CACrC,OAAOG,KAAWF,EAAK,SAASE,GAASC,CAAY;AACvD"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/renderer/math/viewToMat3.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
let t = e.scale.x, n = e.scale.y, r = -e.x * t + 0, i = -e.y * n + 0;
|
|
4
|
+
return new Float32Array([
|
|
5
|
+
t,
|
|
6
|
+
0,
|
|
7
|
+
0,
|
|
8
|
+
0,
|
|
9
|
+
n,
|
|
10
|
+
0,
|
|
11
|
+
r,
|
|
12
|
+
i,
|
|
13
|
+
1
|
|
14
|
+
]);
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { e as viewToMat3 };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=viewToMat3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewToMat3.js","names":["viewToMat3","sx","view","sy","tx","ty"],"sources":["../../../src/renderer/math/viewToMat3.ts"],"sourcesContent":["/**\n * View → GlMat3 helper for layer `draw` implementations on world-space layers.\n *\n * `View` is `@weasel-js/routing`'s, the one every viewport action is typed\n * in. A type-only import emits no runtime edge, so there is no reason for the\n * renderer to hold a second structurally-identical declaration and put it in\n * the emitted `.d.ts` anonymously.\n */\n\nimport type { View } from '@weasel-js/routing';\nimport type { GlMat3 } from './mat3';\n\nexport type { View };\n\n/**\n * Build the world→screen transform matrix for a `View`.\n * Use as the `transform` field of a `kind: 'group'` DrawCommand to wrap\n * world-space content emitted from a layer `draw` implementation.\n *\n * Mapping: `screen = (world − {view.x, view.y}) × {view.scale.x, view.scale.y}`.\n *\n * Column-major layout (matches `mat3.identity()`):\n * `[scale.x, 0, 0, 0, scale.y, 0, -view.x*scale.x, -view.y*scale.y, 1]`.\n */\nexport function viewToMat3(view: View): GlMat3 {\n const sx = view.scale.x;\n const sy = view.scale.y;\n // Add 0 to coerce -0 → 0, matching `mat3.identity()` for the {0,0,1} case.\n const tx = -view.x * sx + 0;\n const ty = -view.y * sy + 0;\n return new Float32Array([\n sx, 0, 0,\n 0, sy, 0,\n tx, ty, 1,\n ]) as GlMat3;\n}\n"],"mappings":";AAwBA,SAAgBA,EAAW,GAAoB;CAC7C,IAAMC,IAAKC,EAAK,MAAM,GAChBC,IAAKD,EAAK,MAAM,GAEhBE,IAAK,CAACF,EAAK,IAAID,IAAK,GACpBI,IAAK,CAACH,EAAK,IAAIC,IAAK;CAC1B,OAAO,IAAI,aAAa;EACtBF;EAAI;EAAG;EACP;EAAGE;EAAI;EACPC;EAAIC;EAAI;CACV,CAAC;AACH"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/renderer/paintResources.ts
|
|
2
|
+
function e() {
|
|
3
|
+
let e = [];
|
|
4
|
+
return {
|
|
5
|
+
onRelease(t) {
|
|
6
|
+
e ? e.push(t) : t();
|
|
7
|
+
},
|
|
8
|
+
release() {
|
|
9
|
+
let t = e;
|
|
10
|
+
e = null;
|
|
11
|
+
for (let e of t ?? []) e();
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { e as createPaintResources };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=paintResources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paintResources.js","names":["createPaintResources","releases","release","pending"],"sources":["../../src/renderer/paintResources.ts"],"sourcesContent":["import type { PaintResources } from 'core/paintKinds';\n\n/** A {@link PaintResources} with the end of its lifetime in the owner's hands. */\nexport interface OwnedPaintResources extends PaintResources {\n /** Run every registered release, once. Idempotent. */\n release(): void;\n}\n\n/** A fresh paint-resource lifetime. The renderer opens one per context\n * generation and releases it on dispose or context restore. */\nexport function createPaintResources(): OwnedPaintResources {\n let releases: Array<() => void> | null = [];\n return {\n onRelease(release) {\n if (releases) releases.push(release);\n else release();\n },\n release() {\n const pending = releases;\n releases = null;\n for (const release of pending ?? []) release();\n },\n };\n}\n"],"mappings":";AAUA,SAAgBA,IAA4C;CAC1D,IAAIC,IAAqC,CAAC;CAC1C,OAAO;EACL,UAAU,GAAS;GACjB,AAAIA,IAAUA,EAAS,KAAKC,CAAO,IAC9BA,EAAQ;EACf;EACA,UAAU;GACR,IAAMC,IAAUF;GAChB,IAAW;GACX,KAAK,IAAMC,KAAWC,KAAW,CAAC,GAAG,EAAQ;EAC/C;CACF;AACF"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
//#region src/renderer/paintScratch.ts
|
|
2
|
+
var e = class {
|
|
3
|
+
gl;
|
|
4
|
+
target = null;
|
|
5
|
+
constructor(e) {
|
|
6
|
+
this.gl = e;
|
|
7
|
+
}
|
|
8
|
+
acquire(e, n) {
|
|
9
|
+
let r = this.target;
|
|
10
|
+
if (r && r.width >= e && r.height >= n) return r;
|
|
11
|
+
let i = Math.max(r?.width ?? 0, t(e)), a = Math.max(r?.height ?? 0, t(n));
|
|
12
|
+
return this.release(), this.target = this.create(i, a), this.target;
|
|
13
|
+
}
|
|
14
|
+
release() {
|
|
15
|
+
this.target &&= (this.gl.deleteFramebuffer(this.target.fbo), this.gl.deleteTexture(this.target.texture), null);
|
|
16
|
+
}
|
|
17
|
+
create(e, t) {
|
|
18
|
+
let n = this.gl, r = n.createTexture();
|
|
19
|
+
n.bindTexture(n.TEXTURE_2D, r), n.texImage2D(n.TEXTURE_2D, 0, n.RGBA8, e, t, 0, n.RGBA, n.UNSIGNED_BYTE, null), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MIN_FILTER, n.NEAREST), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MAG_FILTER, n.NEAREST), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_S, n.CLAMP_TO_EDGE), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_T, n.CLAMP_TO_EDGE), n.bindTexture(n.TEXTURE_2D, null);
|
|
20
|
+
let i = n.createFramebuffer();
|
|
21
|
+
return n.bindFramebuffer(n.FRAMEBUFFER, i), n.framebufferTexture2D(n.FRAMEBUFFER, n.COLOR_ATTACHMENT0, n.TEXTURE_2D, r, 0), n.bindFramebuffer(n.FRAMEBUFFER, null), {
|
|
22
|
+
fbo: i,
|
|
23
|
+
texture: r,
|
|
24
|
+
width: e,
|
|
25
|
+
height: t
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
function t(e) {
|
|
30
|
+
let t = 64;
|
|
31
|
+
for (; t < e;) t *= 2;
|
|
32
|
+
return t;
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { e as PaintScratch };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=paintScratch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paintScratch.js","names":["PaintScratch","gl","have","width","height","w","pow2","h","texture","fbo","side","n"],"sources":["../../src/renderer/paintScratch.ts"],"sourcesContent":["/**\n * The offscreen color buffer a registered paint kind renders into when what it\n * fills is not a path: atlas glyphs, whose coverage then masks what it drew.\n *\n * One per renderer, grown in powers of two to the largest region asked of it\n * and never shrunk, so a frame of differently sized text groups reallocates a\n * few times and then not at all. The region is clamped to the drawing buffer,\n * which bounds the buffer too. It has no stencil: nothing drawn into it is\n * clipped — the clip applies to the glyphs sampling it.\n */\n\nexport interface PaintScratchTarget {\n readonly fbo: WebGLFramebuffer;\n readonly texture: WebGLTexture;\n /** Texture size, at least the region asked for. */\n readonly width: number;\n readonly height: number;\n}\n\nconst MIN_SIDE = 64;\n\nexport class PaintScratch {\n private readonly gl: WebGL2RenderingContext;\n private target: PaintScratchTarget | null = null;\n\n constructor(gl: WebGL2RenderingContext) {\n this.gl = gl;\n }\n\n /** A buffer at least `width` × `height` device pixels. Its contents are\n * whatever the last user left; the caller clears the region it uses. */\n acquire(width: number, height: number): PaintScratchTarget {\n const have = this.target;\n if (have && have.width >= width && have.height >= height) return have;\n const w = Math.max(have?.width ?? 0, pow2(width));\n const h = Math.max(have?.height ?? 0, pow2(height));\n this.release();\n this.target = this.create(w, h);\n return this.target;\n }\n\n /** Drop the buffer. Called on dispose and on context restore, where the\n * handles are already dead and only the bookkeeping has to go. */\n release(): void {\n if (!this.target) return;\n this.gl.deleteFramebuffer(this.target.fbo);\n this.gl.deleteTexture(this.target.texture);\n this.target = null;\n }\n\n private create(width: number, height: number): PaintScratchTarget {\n const gl = this.gl;\n const texture = gl.createTexture()!;\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA8, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n // The region is laid on the device-pixel grid, so every fragment reading\n // it lands on a texel center and NEAREST is exact.\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.bindTexture(gl.TEXTURE_2D, null);\n\n const fbo = gl.createFramebuffer()!;\n gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n return { fbo, texture, width, height };\n }\n}\n\nfunction pow2(n: number): number {\n let side = MIN_SIDE;\n while (side < n) side *= 2;\n return side;\n}\n"],"mappings":";AAmBA,IAEaA,IAAb,MAA0B;CACxB;CACA,SAA4C;CAE5C,YAAY,GAA4B;EACtC,KAAK,KAAKC;CACZ;CAIA,QAAQ,GAAe,GAAoC;EACzD,IAAMC,IAAO,KAAK;EAClB,IAAIA,KAAQA,EAAK,SAASC,KAASD,EAAK,UAAUE,GAAQ,OAAOF;EACjE,IAAMG,IAAI,KAAK,IAAIH,GAAM,SAAS,GAAGI,EAAKH,CAAK,CAAC,GAC1CI,IAAI,KAAK,IAAIL,GAAM,UAAU,GAAGI,EAAKF,CAAM,CAAC;EAGlD,OAFA,KAAK,QAAQ,GACb,KAAK,SAAS,KAAK,OAAOC,GAAGE,CAAC,GACvB,KAAK;CACd;CAIA,UAAgB;EACd,AAGA,KAAK,YAFL,KAAK,GAAG,kBAAkB,KAAK,OAAO,GAAG,GACzC,KAAK,GAAG,cAAc,KAAK,OAAO,OAAO,GAC3B;CAChB;CAEA,OAAe,GAAe,GAAoC;EAChE,IAAMN,IAAK,KAAK,IACVO,IAAUP,EAAG,cAAc;EASjC,AARAA,EAAG,YAAYA,EAAG,YAAYO,CAAO,GACrCP,EAAG,WAAWA,EAAG,YAAY,GAAGA,EAAG,OAAOE,GAAOC,GAAQ,GAAGH,EAAG,MAAMA,EAAG,eAAe,IAAI,GAG3FA,EAAG,cAAcA,EAAG,YAAYA,EAAG,oBAAoBA,EAAG,OAAO,GACjEA,EAAG,cAAcA,EAAG,YAAYA,EAAG,oBAAoBA,EAAG,OAAO,GACjEA,EAAG,cAAcA,EAAG,YAAYA,EAAG,gBAAgBA,EAAG,aAAa,GACnEA,EAAG,cAAcA,EAAG,YAAYA,EAAG,gBAAgBA,EAAG,aAAa,GACnEA,EAAG,YAAYA,EAAG,YAAY,IAAI;EAElC,IAAMQ,IAAMR,EAAG,kBAAkB;EAIjC,OAHAA,EAAG,gBAAgBA,EAAG,aAAaQ,CAAG,GACtCR,EAAG,qBAAqBA,EAAG,aAAaA,EAAG,mBAAmBA,EAAG,YAAYO,GAAS,CAAC,GACvFP,EAAG,gBAAgBA,EAAG,aAAa,IAAI,GAChC;GAAE;GAAK;GAAS;GAAO;EAAO;CACvC;AACF;AAEA,SAASK,EAAK,GAAmB;CAC/B,IAAII,IAAO;CACX,OAAOA,IAAOC,IAAG,KAAQ;CACzB,OAAOD;AACT"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
//#region src/renderer/shaders/ShaderProgram.ts
|
|
2
|
+
var e = class extends Error {
|
|
3
|
+
stage;
|
|
4
|
+
log;
|
|
5
|
+
constructor(e, t) {
|
|
6
|
+
super(`shader ${e} failure: ${t}`), this.stage = e, this.log = t, this.name = "ShaderCompileError";
|
|
7
|
+
}
|
|
8
|
+
}, t = class {
|
|
9
|
+
gl;
|
|
10
|
+
handle;
|
|
11
|
+
uniforms = /* @__PURE__ */ new Map();
|
|
12
|
+
arrays = /* @__PURE__ */ new Map();
|
|
13
|
+
attributes = /* @__PURE__ */ new Map();
|
|
14
|
+
constructor(t, n, r) {
|
|
15
|
+
this.gl = t;
|
|
16
|
+
let i = this.compile(t.VERTEX_SHADER, n, "vertex"), a;
|
|
17
|
+
try {
|
|
18
|
+
a = this.compile(t.FRAGMENT_SHADER, r, "fragment");
|
|
19
|
+
} catch (e) {
|
|
20
|
+
throw t.deleteShader(i), e;
|
|
21
|
+
}
|
|
22
|
+
let o = t.createProgram();
|
|
23
|
+
if (!o) throw t.deleteShader(i), t.deleteShader(a), Error("createProgram returned null");
|
|
24
|
+
if (t.attachShader(o, i), t.attachShader(o, a), t.linkProgram(o), t.deleteShader(i), t.deleteShader(a), !t.getProgramParameter(o, t.LINK_STATUS)) {
|
|
25
|
+
let n = t.getProgramInfoLog(o) ?? "";
|
|
26
|
+
throw t.deleteProgram(o), new e("link", n);
|
|
27
|
+
}
|
|
28
|
+
this.handle = o;
|
|
29
|
+
}
|
|
30
|
+
compile(t, n, r) {
|
|
31
|
+
let i = this.gl, a = i.createShader(t);
|
|
32
|
+
if (!a) throw Error("createShader returned null");
|
|
33
|
+
if (i.shaderSource(a, n), i.compileShader(a), !i.getShaderParameter(a, i.COMPILE_STATUS)) {
|
|
34
|
+
let t = i.getShaderInfoLog(a) ?? "";
|
|
35
|
+
throw i.deleteShader(a), new e(r, t);
|
|
36
|
+
}
|
|
37
|
+
return a;
|
|
38
|
+
}
|
|
39
|
+
lookupUniforms(e) {
|
|
40
|
+
for (let t of e) {
|
|
41
|
+
let e = this.gl.getUniformLocation(this.handle, t);
|
|
42
|
+
e !== null && this.uniforms.set(t, e);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
lookupUniformArrays(e) {
|
|
46
|
+
for (let [t, { type: n, size: r }] of e) {
|
|
47
|
+
let e = `${t}[0]`, i = this.uniforms.get(e) ?? this.gl.getUniformLocation(this.handle, e);
|
|
48
|
+
i !== null && this.arrays.set(t, {
|
|
49
|
+
type: n,
|
|
50
|
+
size: r,
|
|
51
|
+
location: i
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
lookupAttributes(e) {
|
|
56
|
+
for (let t of e) {
|
|
57
|
+
let e = this.gl.getAttribLocation(this.handle, t);
|
|
58
|
+
e >= 0 && this.attributes.set(t, e);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
uniform(e) {
|
|
62
|
+
return this.uniforms.get(e);
|
|
63
|
+
}
|
|
64
|
+
uniformArray(e) {
|
|
65
|
+
return this.arrays.get(e);
|
|
66
|
+
}
|
|
67
|
+
attribute(e) {
|
|
68
|
+
return this.attributes.get(e);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
//#endregion
|
|
72
|
+
export { e as ShaderCompileError, t as ShaderProgram };
|
|
73
|
+
|
|
74
|
+
//# sourceMappingURL=ShaderProgram.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShaderProgram.js","names":["ShaderCompileError","stage","log","ShaderProgram","gl","vs","vertSrc","fs","fragSrc","program","shader","type","source","name","names","loc","decls","base","location"],"sources":["../../../src/renderer/shaders/ShaderProgram.ts"],"sourcesContent":["/**\n * Minimal compile/link/lookup wrapper for a GL program. Throws\n * `ShaderCompileError` on compile or link failure with the GL info log\n * embedded in the error message — never returns a half-initialized program.\n *\n * Designed so test code can stub `getShaderParameter` / `getProgramParameter`\n * via the recorder Proxy without further special-casing.\n */\n\nexport type Stage = 'vertex' | 'fragment' | 'link';\n\n/** Thrown when a shader fails to compile or link, carrying which stage failed\n * and the driver's log. */\nexport class ShaderCompileError extends Error {\n constructor(public readonly stage: Stage, public readonly log: string) {\n super(`shader ${stage} failure: ${log}`);\n this.name = 'ShaderCompileError';\n }\n}\n\n/** An array uniform a program can be written as a whole: its element type as\n * declared, its declared length, and the location of slot 0. */\nexport interface UniformArray {\n readonly type: string;\n readonly size: number;\n readonly location: WebGLUniformLocation;\n}\n\n/** A linked GL program with its uniform and attribute locations cached by name. */\nexport class ShaderProgram {\n readonly handle: WebGLProgram;\n private readonly uniforms = new Map<string, WebGLUniformLocation>();\n private readonly arrays = new Map<string, UniformArray>();\n private readonly attributes = new Map<string, number>();\n\n constructor(\n private readonly gl: WebGL2RenderingContext,\n vertSrc: string,\n fragSrc: string,\n ) {\n const vs = this.compile(gl.VERTEX_SHADER, vertSrc, 'vertex');\n let fs: WebGLShader;\n try {\n fs = this.compile(gl.FRAGMENT_SHADER, fragSrc, 'fragment');\n } catch (e) {\n gl.deleteShader(vs);\n throw e;\n }\n const program = gl.createProgram();\n if (!program) {\n gl.deleteShader(vs);\n gl.deleteShader(fs);\n throw new Error('createProgram returned null');\n }\n gl.attachShader(program, vs);\n gl.attachShader(program, fs);\n gl.linkProgram(program);\n // Flagged for deletion, attached shaders live exactly as long as the\n // program, so `deleteProgram` frees them too.\n gl.deleteShader(vs);\n gl.deleteShader(fs);\n if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {\n const log = gl.getProgramInfoLog(program) ?? '';\n gl.deleteProgram(program);\n throw new ShaderCompileError('link', log);\n }\n this.handle = program;\n }\n\n private compile(type: number, source: string, stage: Stage): WebGLShader {\n const gl = this.gl;\n const shader = gl.createShader(type);\n if (!shader) throw new Error('createShader returned null');\n gl.shaderSource(shader, source);\n gl.compileShader(shader);\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {\n const log = gl.getShaderInfoLog(shader) ?? '';\n gl.deleteShader(shader);\n throw new ShaderCompileError(stage, log);\n }\n return shader;\n }\n\n lookupUniforms(names: readonly string[]): void {\n for (const name of names) {\n const loc = this.gl.getUniformLocation(this.handle, name);\n if (loc !== null) this.uniforms.set(name, loc);\n }\n }\n\n /** Record each array's slot-0 location under its bare name. An array the\n * driver optimized away has no location and is left out. */\n lookupUniformArrays(decls: ReadonlyMap<string, { type: string; size: number }>): void {\n for (const [name, { type, size }] of decls) {\n const base = `${name}[0]`;\n const location = this.uniforms.get(base) ?? this.gl.getUniformLocation(this.handle, base);\n if (location !== null) this.arrays.set(name, { type, size, location });\n }\n }\n\n lookupAttributes(names: readonly string[]): void {\n for (const name of names) {\n const loc = this.gl.getAttribLocation(this.handle, name);\n if (loc >= 0) this.attributes.set(name, loc);\n }\n }\n\n uniform(name: string): WebGLUniformLocation | undefined {\n return this.uniforms.get(name);\n }\n\n uniformArray(name: string): UniformArray | undefined {\n return this.arrays.get(name);\n }\n\n attribute(name: string): number | undefined {\n return this.attributes.get(name);\n }\n}\n"],"mappings":";AAa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mBAAmBM,GAAQN,EAAG,cAAc,GAAG;GACrD,IAAMF,IAAME,EAAG,iBAAiBM,CAAM,KAAK;GAE3C,MADAN,EAAG,aAAaM,CAAM,GAChB,IAAIV,EAAmBC,GAAOC,CAAG;EACzC;EACA,OAAOQ;CACT;CAEA,eAAe,GAAgC;EAC7C,KAAK,IAAMG,KAAQC,GAAO;GACxB,IAAMC,IAAM,KAAK,GAAG,mBAAmB,KAAK,QAAQF,CAAI;GACxD,AAAIE,MAAQ,QAAM,KAAK,SAAS,IAAIF,GAAME,CAAG;EAC/C;CACF;CAIA,oBAAoB,GAAkE;EACpF,KAAK,IAAM,CAACF,GAAM,EAAE,SAAM,cAAWG,GAAO;GAC1C,IAAMC,IAAO,GAAGJ,EAAK,MACfK,IAAW,KAAK,SAAS,IAAID,CAAI,KAAK,KAAK,GAAG,mBAAmB,KAAK,QAAQA,CAAI;GACxF,AAAIC,MAAa,QAAM,KAAK,OAAO,IAAIL,GAAM;IAAE;IAAM;IAAM;GAAS,CAAC;EACvE;CACF;CAEA,iBAAiB,GAAgC;EAC/C,KAAK,IAAMA,KAAQC,GAAO;GACxB,IAAMC,IAAM,KAAK,GAAG,kBAAkB,KAAK,QAAQF,CAAI;GACvD,AAAIE,KAAO,KAAG,KAAK,WAAW,IAAIF,GAAME,CAAG;EAC7C;CACF;CAEA,QAAQ,GAAgD;EACtD,OAAO,KAAK,SAAS,IAAIF,CAAI;CAC/B;CAEA,aAAa,GAAwC;EACnD,OAAO,KAAK,OAAO,IAAIA,CAAI;CAC7B;CAEA,UAAU,GAAkC;EAC1C,OAAO,KAAK,WAAW,IAAIA,CAAI;CACjC;AACF"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { GLYPH_COVERAGE_GLSL as e } from "@weasel-js/font";
|
|
2
|
+
//#region src/renderer/shaders/batchFill.ts
|
|
3
|
+
var t = 8, n = 0, r = 0, i = 3, a = 4, o = (1 / (2 * Math.PI)).toFixed(10);
|
|
4
|
+
function s(e, n) {
|
|
5
|
+
return e + t * n;
|
|
6
|
+
}
|
|
7
|
+
var c = {
|
|
8
|
+
a_position: 0,
|
|
9
|
+
a_vertexColor: 1,
|
|
10
|
+
a_uv: 2,
|
|
11
|
+
a_post: 3,
|
|
12
|
+
a_texSlot: 4
|
|
13
|
+
}, l = c;
|
|
14
|
+
function u(e) {
|
|
15
|
+
let t = [];
|
|
16
|
+
for (let n = 1; n < e; n++) t.push(` if (slot == ${n}) return texture(u_samplers[${n}], uv);`);
|
|
17
|
+
return t.join("\n");
|
|
18
|
+
}
|
|
19
|
+
var d = `#version 300 es
|
|
20
|
+
layout(location = ${l.a_position}) in vec2 a_position;
|
|
21
|
+
layout(location = ${l.a_vertexColor}) in vec4 a_vertexColor;
|
|
22
|
+
layout(location = ${l.a_uv}) in vec2 a_uv;
|
|
23
|
+
layout(location = ${l.a_post}) in float a_post;
|
|
24
|
+
layout(location = ${l.a_texSlot}) in float a_texSlot;
|
|
25
|
+
uniform mat3 u_proj;
|
|
26
|
+
uniform mat3 u_model;
|
|
27
|
+
out vec4 v_vertexColor;
|
|
28
|
+
out vec2 v_uv;
|
|
29
|
+
out float v_post;
|
|
30
|
+
flat out int v_texSlot;
|
|
31
|
+
flat out float v_paintMode;
|
|
32
|
+
void main() {
|
|
33
|
+
vec3 screen = u_model * vec3(a_position, 1.0);
|
|
34
|
+
vec3 clip = u_proj * vec3(screen.xy, 1.0);
|
|
35
|
+
gl_Position = vec4(clip.xy, 0.0, 1.0);
|
|
36
|
+
v_vertexColor = a_vertexColor;
|
|
37
|
+
v_uv = a_uv;
|
|
38
|
+
v_post = a_post;
|
|
39
|
+
// slot + 8 * mode, unpacked — see the file header for why they share a float.
|
|
40
|
+
int packed = int(a_texSlot + 0.5);
|
|
41
|
+
v_texSlot = packed % ${t};
|
|
42
|
+
v_paintMode = float(packed / ${t});
|
|
43
|
+
}
|
|
44
|
+
`, f = `#version 300 es
|
|
45
|
+
precision highp float;
|
|
46
|
+
in vec4 v_vertexColor;
|
|
47
|
+
in vec2 v_uv;
|
|
48
|
+
in float v_post;
|
|
49
|
+
flat in int v_texSlot;
|
|
50
|
+
flat in float v_paintMode;
|
|
51
|
+
uniform sampler2D u_samplers[${t}];
|
|
52
|
+
uniform vec4 u_color;
|
|
53
|
+
uniform float u_alpha;
|
|
54
|
+
uniform float u_synthBold;
|
|
55
|
+
uniform vec2 u_fieldScale[${t}];
|
|
56
|
+
uniform mat4 u_colorMatrix;
|
|
57
|
+
uniform vec4 u_colorBias;
|
|
58
|
+
out vec4 outColor;
|
|
59
|
+
|
|
60
|
+
vec4 sampleSlot(int slot, vec2 uv) {
|
|
61
|
+
${u(t)}
|
|
62
|
+
return texture(u_samplers[0], uv);
|
|
63
|
+
}
|
|
64
|
+
${e}
|
|
65
|
+
void main() {
|
|
66
|
+
float isGrad = step(2.5, v_paintMode);
|
|
67
|
+
// A radial or conic vertex carries a gradient-space coordinate rather than a
|
|
68
|
+
// texture coordinate, and its atlas row rather than an alpha. The sample is
|
|
69
|
+
// split across the branch rather than the coordinate selected before it: an
|
|
70
|
+
// arm that reads v_uv straight is a fetch the hardware can schedule against a
|
|
71
|
+
// varying, and one reading a coordinate the shader computed is not. Selecting
|
|
72
|
+
// the coordinate first and sampling once costs 65% of a fragment that is not
|
|
73
|
+
// a gradient; splitting it costs 5% (tests/perf/fill-rate.spec.ts).
|
|
74
|
+
//
|
|
75
|
+
// Branching at all is safe here where it would not be around the glyph math:
|
|
76
|
+
// v_paintMode is flat, so every fragment of a quad takes the same arm, and
|
|
77
|
+
// nothing in either arm is a derivative.
|
|
78
|
+
vec4 texel;
|
|
79
|
+
if (isGrad > 0.5) {
|
|
80
|
+
float t = v_paintMode > 3.5
|
|
81
|
+
? fract(atan(v_uv.y, v_uv.x) * ${o})
|
|
82
|
+
: length(v_uv);
|
|
83
|
+
texel = sampleSlot(v_texSlot, vec2(t, v_post));
|
|
84
|
+
} else {
|
|
85
|
+
texel = sampleSlot(v_texSlot, v_uv);
|
|
86
|
+
}
|
|
87
|
+
float isGlyph = step(0.5, v_paintMode) * step(v_paintMode, 2.5);
|
|
88
|
+
// Unconditional, and multiplied out afterwards rather than branched around:
|
|
89
|
+
// see the file header.
|
|
90
|
+
float coverage = glyphCoverage(texel, v_paintMode, u_synthBold, v_uv, u_fieldScale[v_texSlot]);
|
|
91
|
+
// A glyph's texel is a distance field, so it takes no part in the color; a
|
|
92
|
+
// plain vertex multiplies its texel in as it always did.
|
|
93
|
+
vec4 src = mix(texel, vec4(1.0), isGlyph) * u_color * v_vertexColor;
|
|
94
|
+
vec4 mapped = clamp(u_colorMatrix * src + u_colorBias, 0.0, 1.0);
|
|
95
|
+
float a = mapped.a * u_alpha * mix(v_post, 1.0, isGrad) * mix(1.0, coverage, isGlyph);
|
|
96
|
+
outColor = vec4(mapped.rgb * a, a);
|
|
97
|
+
}
|
|
98
|
+
`, p = [
|
|
99
|
+
"u_proj",
|
|
100
|
+
"u_model",
|
|
101
|
+
"u_samplers",
|
|
102
|
+
"u_color",
|
|
103
|
+
"u_alpha",
|
|
104
|
+
"u_synthBold",
|
|
105
|
+
"u_fieldScale",
|
|
106
|
+
"u_colorMatrix",
|
|
107
|
+
"u_colorBias"
|
|
108
|
+
], m = [
|
|
109
|
+
"a_position",
|
|
110
|
+
"a_vertexColor",
|
|
111
|
+
"a_uv",
|
|
112
|
+
"a_post",
|
|
113
|
+
"a_texSlot"
|
|
114
|
+
];
|
|
115
|
+
//#endregion
|
|
116
|
+
export { c as BATCH_ATTRIBUTE_LOCATIONS, m as BATCH_FILL_ATTRIBUTES, p as BATCH_FILL_UNIFORMS, f as BATCH_FRAG_SRC, t as BATCH_TEXTURE_SLOTS, d as BATCH_VERT_SRC, a as PAINT_MODE_CONIC, r as PAINT_MODE_PLAIN, i as PAINT_MODE_RADIAL, n as WHITE_SLOT, s as packSlot };
|
|
117
|
+
|
|
118
|
+
//# sourceMappingURL=batchFill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batchFill.js","names":["BATCH_TEXTURE_SLOTS","WHITE_SLOT","PAINT_MODE_PLAIN","PAINT_MODE_RADIAL","PAINT_MODE_CONIC","INV_TAU","packSlot","slot","mode","BATCH_ATTRIBUTE_LOCATIONS","L","sampleChain","arms","i","slots","BATCH_VERT_SRC","BATCH_FRAG_SRC","GLYPH_COVERAGE_GLSL","BATCH_FILL_UNIFORMS","BATCH_FILL_ATTRIBUTES"],"sources":["../../../src/renderer/shaders/batchFill.ts"],"sourcesContent":["/**\n * GLSL ES 3.0 source for the batch program — the one shader a run of solid\n * geometry, image quads and glyphs shares.\n *\n * **Every vertex names the texture it samples.** `a_texSlot` is an index into\n * `u_samplers`, and slot 0 is always the 1x1 white texel, so a solid's\n * `texture() * a_vertexColor` is the vertex color exactly. The multiply is\n * exact: an 8-bit white texel samples to 1.0, and 1.0 * x is x.\n *\n * The slot is per vertex rather than per flush because the run holds several\n * textures at once. Reserving slot 0 for white is what makes a solid's promise\n * true no matter what else joins its run: before this, a solid carried the\n * white texel's UV but the flush bound the run's *image*, so every ground rect\n * beside an atlas quad came out multiplied by whatever texel sat at the middle\n * of that atlas. A wall of white grounds drew olive.\n *\n * **The chain is unrolled because GLSL ES 3.0 will not index a sampler array\n * with a variable** — the index must be a constant expression, so `if (i == 0)\n * … if (i == 1) …` over constants is the only legal form. `v_texSlot` is\n * constant across a primitive, so the branch is uniform within any one\n * triangle; the coordinate it samples is a varying computed before the branch,\n * which is what keeps the implicit derivatives well defined.\n *\n * **The paint mode rides in `a_texSlot`, and the glyph math runs either way.**\n * A glyph vertex names a font atlas whose texel is a distance field rather than\n * a color, so its coverage comes from `glyphCoverage` and its color comes from\n * the vertex alone. That coverage is computed on every fragment, glyph or not,\n * because a derivative in non-uniform control flow is undefined and it\n * has to be taken before anything selects on the mode — see\n * `GLYPH_COVERAGE_GLSL`. Priced head to head at 432M fragments a frame\n * (`tests/perf/fill-rate.spec.ts`), that roughly doubles a fragment that is not\n * a glyph — the figure recorded when text landed was 1.4%, and it was wrong:\n * the control gated its glyph math on a factor the compiler folds to zero, so\n * it timed a shader with that math deleted. Fill is not what a wall is bound\n * by, which is why the conclusion stands even though the number did not.\n *\n * **A gradient is a textured quad off the ramp atlas.** A linear one needs no\n * mode: its ramp position is affine in position, so `a_uv` is (ramp position,\n * atlas row) and the plain path samples it. A radial or conic one carries the\n * gradient-space coordinate instead — affine even where the ramp position is\n * not — with the row in `a_post`, and the fragment takes a `length` or an\n * `atan` of it behind a branch on the flat mode. That branch carries the sample\n * itself, not just the coordinate: a fetch from a varying is one the hardware\n * schedules ahead, and one from a computed coordinate is not, which is 65% of\n * a fragment against 5%.\n *\n * **Mode and slot share one attribute because the vertex is the thing that\n * costs.** Both are small enumerations, so `slot + 8 * mode` packs them with\n * room to spare. Carrying the mode as a float of its own instead measures 9%\n * slower at the densest rung of `tests/perf/atlas-wall.spec.ts` — 1.78 ms\n * against 1.63 for 7,500 commands, taken ABBA in one sitting — because the\n * whole batch exists to make one buffer write a frame cheap, and every extra\n * float widens that write for every rect and quad in the run, not just for the\n * glyphs that read it.\n *\n * `a_post` is the alpha factor applied *after* the color matrix. An image quad\n * puts its opacity there, where `u_opacity` used to be — the fold is exact for\n * the same reason the old image shader's was, the matrix cannot see it. Solid\n * geometry and glyphs leave it at 1 and fold their own alpha into\n * `a_vertexColor`, which is only sound under an identity matrix; `draw.ts` owns\n * that condition.\n *\n * Inputs:\n * a_position vec2 screen-space x,y of the corner\n * a_vertexColor vec4 straight-alpha color; (1,1,1,1) on an image vertex\n * a_uv vec2 texture coordinate 0..1; the white texel for solids\n * a_post float alpha factor applied after the color matrix\n * a_texSlot float slot + 8 * paint mode; slot 0 is the white texel\n *\n * Output: PREMULTIPLIED alpha. Blend: `gl.blendFunc(ONE, ONE_MINUS_SRC_ALPHA)`.\n */\n\nimport { GLYPH_COVERAGE_GLSL } from '@weasel-js/font';\n\n/**\n * Texture units the batch program samples, slot 0 being the white texel.\n *\n * Fixed rather than queried: WebGL2 guarantees at least 16 fragment texture\n * units, so 8 is available everywhere without asking, and asking would mean a\n * `getParameter` the GL recorder answers with a recording function rather than\n * a number. Seven textures in one run is what \"a document with a handful of\n * distinct images, and a font or two\" needs; past that the run breaks as it\n * always did, and every extra slot is another compare in the fragment chain.\n */\nexport const BATCH_TEXTURE_SLOTS = 8;\n\n/** Slot every solid vertex carries — the white texel, bound by `flushBatch`. */\nexport const WHITE_SLOT = 0;\n\n/** Paint mode for everything whose texel is a color rather than a field. */\nexport const PAINT_MODE_PLAIN = 0;\n\n/**\n * Paint modes for the two gradients whose ramp position is not affine in\n * position — the ones a vertex cannot simply carry.\n *\n * They sit above the glyph modes (1 and 2), so `isGlyph` is a range rather than\n * a threshold. What a vertex carries in these modes is the *gradient-space\n * coordinate* in `a_uv` and its atlas row in `a_post`: that coordinate is\n * affine even where the ramp position is not, so the CPU folds it to two affine\n * rows and the shader takes a `length` or an `atan` of the result.\n *\n * A linear gradient has neither mode: its ramp position is affine outright, so\n * it is a textured quad off the atlas at `PAINT_MODE_PLAIN` and pays nothing\n * here.\n */\nexport const PAINT_MODE_RADIAL = 3;\nexport const PAINT_MODE_CONIC = 4;\n\n/** 1 / 2π, which turns a conic gradient's angle into a ramp position. */\nconst INV_TAU = (1 / (2 * Math.PI)).toFixed(10);\n\n/** Pack a texture slot and a paint mode into the one `a_texSlot` float. */\nexport function packSlot(slot: number, mode: number): number {\n return slot + BATCH_TEXTURE_SLOTS * mode;\n}\n\n/** The paint mode packed into an `a_texSlot` value — for the tests, which read\n * a vertex back out of the buffer it was staged into. */\nexport function paintModeOf(packed: number): number {\n return Math.floor((packed + 0.5) / BATCH_TEXTURE_SLOTS);\n}\n\n/**\n * Where each batch attribute lives, pinned rather than left to the linker so\n * `glyphPaint`'s program can draw from the same VAO.\n */\nexport const BATCH_ATTRIBUTE_LOCATIONS = {\n a_position: 0, a_vertexColor: 1, a_uv: 2, a_post: 3, a_texSlot: 4,\n} as const;\n\nconst L = BATCH_ATTRIBUTE_LOCATIONS;\n\nfunction sampleChain(slots: number): string {\n const arms: string[] = [];\n for (let i = 1; i < slots; i++) {\n arms.push(` if (slot == ${i}) return texture(u_samplers[${i}], uv);`);\n }\n return arms.join('\\n');\n}\n\nexport const BATCH_VERT_SRC = /* glsl */ `#version 300 es\nlayout(location = ${L.a_position}) in vec2 a_position;\nlayout(location = ${L.a_vertexColor}) in vec4 a_vertexColor;\nlayout(location = ${L.a_uv}) in vec2 a_uv;\nlayout(location = ${L.a_post}) in float a_post;\nlayout(location = ${L.a_texSlot}) in float a_texSlot;\nuniform mat3 u_proj;\nuniform mat3 u_model;\nout vec4 v_vertexColor;\nout vec2 v_uv;\nout float v_post;\nflat out int v_texSlot;\nflat out float v_paintMode;\nvoid main() {\n vec3 screen = u_model * vec3(a_position, 1.0);\n vec3 clip = u_proj * vec3(screen.xy, 1.0);\n gl_Position = vec4(clip.xy, 0.0, 1.0);\n v_vertexColor = a_vertexColor;\n v_uv = a_uv;\n v_post = a_post;\n // slot + 8 * mode, unpacked — see the file header for why they share a float.\n int packed = int(a_texSlot + 0.5);\n v_texSlot = packed % ${BATCH_TEXTURE_SLOTS};\n v_paintMode = float(packed / ${BATCH_TEXTURE_SLOTS});\n}\n`;\n\nexport const BATCH_FRAG_SRC = /* glsl */ `#version 300 es\nprecision highp float;\nin vec4 v_vertexColor;\nin vec2 v_uv;\nin float v_post;\nflat in int v_texSlot;\nflat in float v_paintMode;\nuniform sampler2D u_samplers[${BATCH_TEXTURE_SLOTS}];\nuniform vec4 u_color;\nuniform float u_alpha;\nuniform float u_synthBold;\nuniform vec2 u_fieldScale[${BATCH_TEXTURE_SLOTS}];\nuniform mat4 u_colorMatrix;\nuniform vec4 u_colorBias;\nout vec4 outColor;\n\nvec4 sampleSlot(int slot, vec2 uv) {\n${sampleChain(BATCH_TEXTURE_SLOTS)}\n return texture(u_samplers[0], uv);\n}\n${GLYPH_COVERAGE_GLSL}\nvoid main() {\n float isGrad = step(2.5, v_paintMode);\n // A radial or conic vertex carries a gradient-space coordinate rather than a\n // texture coordinate, and its atlas row rather than an alpha. The sample is\n // split across the branch rather than the coordinate selected before it: an\n // arm that reads v_uv straight is a fetch the hardware can schedule against a\n // varying, and one reading a coordinate the shader computed is not. Selecting\n // the coordinate first and sampling once costs 65% of a fragment that is not\n // a gradient; splitting it costs 5% (tests/perf/fill-rate.spec.ts).\n //\n // Branching at all is safe here where it would not be around the glyph math:\n // v_paintMode is flat, so every fragment of a quad takes the same arm, and\n // nothing in either arm is a derivative.\n vec4 texel;\n if (isGrad > 0.5) {\n float t = v_paintMode > ${PAINT_MODE_CONIC - 0.5}\n ? fract(atan(v_uv.y, v_uv.x) * ${INV_TAU})\n : length(v_uv);\n texel = sampleSlot(v_texSlot, vec2(t, v_post));\n } else {\n texel = sampleSlot(v_texSlot, v_uv);\n }\n float isGlyph = step(0.5, v_paintMode) * step(v_paintMode, 2.5);\n // Unconditional, and multiplied out afterwards rather than branched around:\n // see the file header.\n float coverage = glyphCoverage(texel, v_paintMode, u_synthBold, v_uv, u_fieldScale[v_texSlot]);\n // A glyph's texel is a distance field, so it takes no part in the color; a\n // plain vertex multiplies its texel in as it always did.\n vec4 src = mix(texel, vec4(1.0), isGlyph) * u_color * v_vertexColor;\n vec4 mapped = clamp(u_colorMatrix * src + u_colorBias, 0.0, 1.0);\n float a = mapped.a * u_alpha * mix(v_post, 1.0, isGrad) * mix(1.0, coverage, isGlyph);\n outColor = vec4(mapped.rgb * a, a);\n}\n`;\n\nexport const BATCH_FILL_UNIFORMS = [\n 'u_proj', 'u_model', 'u_samplers', 'u_color', 'u_alpha', 'u_synthBold', 'u_fieldScale',\n 'u_colorMatrix', 'u_colorBias',\n] as const;\n\nexport const BATCH_FILL_ATTRIBUTES = [\n 'a_position', 'a_vertexColor', 'a_uv', 'a_post', 'a_texSlot',\n] as const;\n"],"mappings":";;AAoFA,IAAaA,IAAsB,GAGtBC,IAAa,GAGbC,IAAmB,GAgBnBC,IAAoB,GACpBC,IAAmB,GAG1BC,KAAW,KAAK,IAAI,KAAK,IAAA,CAAK,QAAQ,EAAE;AAG9C,SAAgBC,EAAS,GAAc,GAAsB;CAC3D,OAAOC,IAAOP,IAAsBQ;AACtC;AAYA,IAAaC,IAA4B;CACvC,YAAY;CAAG,eAAe;CAAG,MAAM;CAAG,QAAQ;CAAG,WAAW;AAClE,GAEMC,IAAID;AAEV,SAASE,EAAY,GAAuB;CAC1C,IAAMC,IAAiB,CAAC;CACxB,KAAK,IAAIC,IAAI,GAAGA,IAAIC,GAAO,KACzB,EAAK,KAAK,iBAAiBD,EAAE,8BAA8BA,EAAE,QAAQ;CAEvE,OAAOD,EAAK,KAAK,IAAI;AACvB;AAEA,IAAaG,IAA4B;oBACrBL,EAAE,WAAW;oBACbA,EAAE,cAAc;oBAChBA,EAAE,KAAK;oBACPA,EAAE,OAAO;oBACTA,EAAE,UAAU;;;;;;;;;;;;;;;;;yBAiBPV,EAAoB;iCACZA,EAAoB;;GAIxCgB,IAA4B;;;;;;;+BAOVhB,EAAoB;;;;4BAIvBA,EAAoB;;;;;;EAM9CW,EAAYX,CAAmB,EAAE;;;EAGjCiB,EAAoB;;;;;;;;;;;;;;;;;uCAiBiBZ,EAAQ;;;;;;;;;;;;;;;;;GAmBlCa,IAAsB;CACjC;CAAU;CAAW;CAAc;CAAW;CAAW;CAAe;CACxE;CAAiB;AACnB,GAEaC,IAAwB;CACnC;CAAc;CAAiB;CAAQ;CAAU;AACnD"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//#region src/renderer/shaders/customPrelude.ts
|
|
2
|
+
var e = "#version 300 es\nin vec2 a_position;\nin vec2 a_uv;\nuniform vec4 u_bounds;\nuniform mat3 u_view;\nuniform mat3 u_proj;\nout vec2 v_uv;\nout vec2 v_screen;\nout vec2 v_world;\n\nvoid main() {\n float sx = u_bounds.x + a_uv.x * u_bounds.z;\n float sy = u_bounds.y + a_uv.y * u_bounds.w;\n v_screen = vec2(sx, sy);\n v_uv = a_uv;\n\n float det = u_view[0][0] * u_view[1][1] - u_view[0][1] * u_view[1][0];\n // A flat view has no inverse: every fragment reads the world origin, not a plausible wrong mapping.\n float invDet = det != 0.0 ? 1.0 / det : 0.0;\n v_world = vec2(\n ((sx - u_view[2][0]) * u_view[1][1] + (sy - u_view[2][1]) * -u_view[0][1]) * invDet,\n ((sx - u_view[2][0]) * -u_view[1][0] + (sy - u_view[2][1]) * u_view[0][0]) * invDet\n );\n\n vec3 clip = u_proj * vec3(sx, sy, 1.0);\n gl_Position = vec4(clip.xy, 0.0, 1.0);\n}\n", t = ["a_position", "a_uv"], n = [
|
|
3
|
+
"u_bounds",
|
|
4
|
+
"u_view",
|
|
5
|
+
"u_proj"
|
|
6
|
+
], r = new Float32Array([
|
|
7
|
+
-1,
|
|
8
|
+
-1,
|
|
9
|
+
0,
|
|
10
|
+
0,
|
|
11
|
+
1,
|
|
12
|
+
-1,
|
|
13
|
+
1,
|
|
14
|
+
0,
|
|
15
|
+
1,
|
|
16
|
+
1,
|
|
17
|
+
1,
|
|
18
|
+
1,
|
|
19
|
+
-1,
|
|
20
|
+
1,
|
|
21
|
+
0,
|
|
22
|
+
1
|
|
23
|
+
]), i = new Uint16Array([
|
|
24
|
+
0,
|
|
25
|
+
1,
|
|
26
|
+
2,
|
|
27
|
+
0,
|
|
28
|
+
2,
|
|
29
|
+
3
|
|
30
|
+
]);
|
|
31
|
+
//#endregion
|
|
32
|
+
export { t as CUSTOM_ATTRIBUTES, n as CUSTOM_KIT_UNIFORMS, e as CUSTOM_VERT_SRC, i as QUAD_INDICES, r as QUAD_VERTICES };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=customPrelude.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customPrelude.js","names":["CUSTOM_VERT_SRC","CUSTOM_ATTRIBUTES","CUSTOM_KIT_UNIFORMS","QUAD_VERTICES","QUAD_INDICES"],"sources":["../../../src/renderer/shaders/customPrelude.ts"],"sourcesContent":["/**\n * Kit-supplied vertex shader for kind:'shader' DrawCommands.\n *\n * Consumers write only fragment shaders. The vertex shader is fixed:\n * it generates a quad covering the DrawCommand's `bounds` rect and\n * exposes three varyings the fragment shader can consume.\n *\n * PUBLIC CONTRACT (varyings and kit uniforms):\n *\n * in vec2 a_position -1..1 NDC quad (set by the kit)\n * in vec2 a_uv 0..1 across the bounds rect\n *\n * uniform vec4 u_bounds x, y, w, h in screen-space CSS pixels (set by kit)\n * uniform mat3 u_view weasel View matrix, world→screen (set by kit)\n * uniform mat3 u_proj screen→clip projection (internal, not documented)\n *\n * out vec2 v_uv 0..1 across the bounds rect (top-left origin)\n * out vec2 v_screen screen-space pixel coordinate of this fragment\n * out vec2 v_world approximate world-space coordinate (via view inverse)\n *\n * PREMULTIPLIED ALPHA REQUIREMENT:\n * The canvas uses premultipliedAlpha:true (the WebGL2 default). Consumer\n * fragment shaders MUST output premultiplied alpha:\n *\n * outColor = vec4(rgb * a, a); // CORRECT\n * outColor = vec4(rgb, a); // WRONG — over-brightens translucent pixels\n *\n * The renderer uses gl.blendFunc(ONE, ONE_MINUS_SRC_ALPHA) to match.\n */\n\n/**\n * Kit-supplied vertex shader source for custom programs.\n *\n * @remarks\n * **PREMULTIPLIED ALPHA:** Your fragment shader MUST output `vec4(rgb * a, a)`,\n * not `vec4(rgb, a)`. The canvas is composited with premultipliedAlpha:true;\n * straight-alpha output causes over-bright rendering for any fragment with a < 1.\n */\nexport const CUSTOM_VERT_SRC = /* glsl */ `#version 300 es\nin vec2 a_position;\nin vec2 a_uv;\nuniform vec4 u_bounds;\nuniform mat3 u_view;\nuniform mat3 u_proj;\nout vec2 v_uv;\nout vec2 v_screen;\nout vec2 v_world;\n\nvoid main() {\n float sx = u_bounds.x + a_uv.x * u_bounds.z;\n float sy = u_bounds.y + a_uv.y * u_bounds.w;\n v_screen = vec2(sx, sy);\n v_uv = a_uv;\n\n float det = u_view[0][0] * u_view[1][1] - u_view[0][1] * u_view[1][0];\n // A flat view has no inverse: every fragment reads the world origin, not a plausible wrong mapping.\n float invDet = det != 0.0 ? 1.0 / det : 0.0;\n v_world = vec2(\n ((sx - u_view[2][0]) * u_view[1][1] + (sy - u_view[2][1]) * -u_view[0][1]) * invDet,\n ((sx - u_view[2][0]) * -u_view[1][0] + (sy - u_view[2][1]) * u_view[0][0]) * invDet\n );\n\n vec3 clip = u_proj * vec3(sx, sy, 1.0);\n gl_Position = vec4(clip.xy, 0.0, 1.0);\n}\n`;\n\n/**\n * Attribute names used by the custom vertex shader.\n * The renderer looks these up after compile.\n */\nexport const CUSTOM_ATTRIBUTES = ['a_position', 'a_uv'] as const;\n\n/**\n * Kit-managed uniform names for custom shader programs.\n * These are set per-draw by drawShader(); consumers must NOT redeclare them.\n */\nexport const CUSTOM_KIT_UNIFORMS = ['u_bounds', 'u_view', 'u_proj'] as const;\n\n/**\n * Auto-quad geometry: 4 vertices covering NDC (-1..1) and UV (0..1).\n *\n * Layout per vertex: [a_position.x, a_position.y, a_uv.x, a_uv.y]\n *\n * Vertex order (UV space, screen y-down):\n * 0: top-left (-1, -1, 0, 0)\n * 1: top-right ( 1, -1, 1, 0)\n * 2: bottom-right ( 1, 1, 1, 1)\n * 3: bottom-left (-1, 1, 0, 1)\n */\nexport const QUAD_VERTICES = new Float32Array([\n -1, -1, 0, 0,\n 1, -1, 1, 0,\n 1, 1, 1, 1,\n -1, 1, 0, 1,\n]);\n\nexport const QUAD_INDICES = new Uint16Array([0, 1, 2, 0, 2, 3]);\n"],"mappings":";AAsCA,IAAaA,IAA6B,61BAiC7BC,IAAoB,CAAC,cAAc,MAAM,GAMzCC,IAAsB;CAAC;CAAY;CAAU;AAAQ,GAarDC,IAAgB,IAAI,aAAa;CAC5C;CAAI;CAAK;CAAG;CACX;CAAG;CAAK;CAAG;CACX;CAAI;CAAI;CAAG;CACZ;CAAK;CAAI;CAAG;AACd,CAAC,GAEYC,IAAe,IAAI,YAAY;CAAC;CAAG;CAAG;CAAG;CAAG;CAAG;AAAC,CAAC"}
|