@weasel-js/core 1.12.0 → 1.13.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +91 -0
- package/dist/animation/poseTarget.js +46 -15
- package/dist/animation/poseTarget.js.map +1 -1
- package/dist/animation/poseTransition.js +3 -3
- package/dist/animation/poseTransition.js.map +1 -1
- package/dist/animation/reflow.js +3 -6
- package/dist/animation/reflow.js.map +1 -1
- package/dist/animation/rig/bindRig.js +2 -2
- package/dist/animation/rig/bindRig.js.map +1 -1
- package/dist/animation/rig/skinBinding.js +2 -2
- package/dist/animation/rig/skinBinding.js.map +1 -1
- package/dist/barrel/canvas.js +5 -3
- package/dist/barrel/chrome.js +3 -1
- package/dist/barrel/paths.js +3 -2
- package/dist/barrel/routing.js +2 -2
- package/dist/barrel/scene.js +6 -1
- package/dist/canvas/NodeShape.js +1 -0
- package/dist/canvas/NodeShape.js.map +1 -1
- package/dist/canvas/SceneCanvas/SceneCanvasInput.js +2 -0
- package/dist/canvas/SceneCanvas/SceneCanvasInput.js.map +1 -1
- package/dist/canvas/SceneCanvas/canvasPassThrough.js +1 -1
- package/dist/canvas/SceneCanvas/canvasPassThrough.js.map +1 -1
- package/dist/canvas/SceneCanvas/defaultNodeRouting.js +2 -2
- package/dist/canvas/SceneCanvas/defaultNodeRouting.js.map +1 -1
- package/dist/canvas/SceneCanvas/scenePointQuery.js +20 -2
- package/dist/canvas/SceneCanvas/scenePointQuery.js.map +1 -1
- package/dist/canvas/SceneCanvas/useCanvasTools.js +3 -0
- package/dist/canvas/SceneCanvas/useCanvasTools.js.map +1 -1
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js +25 -19
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js.map +1 -1
- package/dist/canvas/SceneCanvas/useSceneCanvasLayers.js +7 -0
- package/dist/canvas/SceneCanvas/useSceneCanvasLayers.js.map +1 -1
- package/dist/canvas/SceneCanvas/useSceneCanvasTools.js +1 -0
- package/dist/canvas/SceneCanvas/useSceneCanvasTools.js.map +1 -1
- package/dist/canvas/SceneCanvas/useScenePicking.js +31 -6
- package/dist/canvas/SceneCanvas/useScenePicking.js.map +1 -1
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js +4 -5
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js.map +1 -1
- package/dist/canvas/SceneCanvas/useSceneStandardActions.js +5 -3
- package/dist/canvas/SceneCanvas/useSceneStandardActions.js.map +1 -1
- package/dist/canvas/SceneCanvas.js +19 -2
- package/dist/canvas/SceneCanvas.js.map +1 -1
- package/dist/canvas/accentColor.js +26 -3
- package/dist/canvas/accentColor.js.map +1 -1
- package/dist/canvas/buildSceneTree.js +14 -20
- package/dist/canvas/buildSceneTree.js.map +1 -1
- package/dist/canvas/copiesAbove.js +1 -1
- package/dist/canvas/copiesAbove.js.map +1 -1
- package/dist/canvas/defaultDrawOne.js +10 -7
- package/dist/canvas/defaultDrawOne.js.map +1 -1
- package/dist/canvas/deps/areaSelect.js +5 -2
- package/dist/canvas/deps/areaSelect.js.map +1 -1
- package/dist/canvas/deps/booleans.js +1 -1
- package/dist/canvas/deps/booleans.js.map +1 -1
- package/dist/canvas/deps/enteredGroup.js +81 -0
- package/dist/canvas/deps/enteredGroup.js.map +1 -0
- package/dist/canvas/deps/hitTestArea.js +27 -15
- package/dist/canvas/deps/hitTestArea.js.map +1 -1
- package/dist/canvas/deps/insert.js +4 -36
- package/dist/canvas/deps/insert.js.map +1 -1
- package/dist/canvas/deps/insertSite.js +39 -0
- package/dist/canvas/deps/insertSite.js.map +1 -0
- package/dist/canvas/deps/lassoSelect.js +6 -3
- package/dist/canvas/deps/lassoSelect.js.map +1 -1
- package/dist/canvas/deps/pathLeaf.js +1 -1
- package/dist/canvas/deps/pathLeaf.js.map +1 -1
- package/dist/canvas/deps/slice.js +2 -1
- package/dist/canvas/deps/slice.js.map +1 -1
- package/dist/canvas/derivedPath.js +14 -6
- package/dist/canvas/derivedPath.js.map +1 -1
- package/dist/canvas/doubleClickTarget.js +9 -11
- package/dist/canvas/doubleClickTarget.js.map +1 -1
- package/dist/canvas/drawnBounds.js +16 -7
- package/dist/canvas/drawnBounds.js.map +1 -1
- package/dist/canvas/inheritedPaints.js +22 -11
- package/dist/canvas/inheritedPaints.js.map +1 -1
- package/dist/canvas/nodeShapes/nodePaint.js +1 -7
- package/dist/canvas/nodeShapes/nodePaint.js.map +1 -1
- package/dist/canvas/nodeShapes/pathPainter.js +2 -3
- package/dist/canvas/nodeShapes/pathPainter.js.map +1 -1
- package/dist/canvas/nodeShapes/rectFallbackPainter.js +1 -1
- package/dist/canvas/nodeShapes/rectFallbackPainter.js.map +1 -1
- package/dist/canvas/nodeShapes/shapePainter.js +2 -3
- package/dist/canvas/nodeShapes/shapePainter.js.map +1 -1
- package/dist/canvas/ownClip.js +24 -0
- package/dist/canvas/ownClip.js.map +1 -0
- package/dist/canvas/paintCull.js.map +1 -1
- package/dist/canvas/pickIndex/nodeBroadBox.js +86 -0
- package/dist/canvas/pickIndex/nodeBroadBox.js.map +1 -0
- package/dist/canvas/pickIndex/scenePickIndex.js +208 -0
- package/dist/canvas/pickIndex/scenePickIndex.js.map +1 -0
- package/dist/canvas/pickWalk.js +14 -90
- package/dist/canvas/pickWalk.js.map +1 -1
- package/dist/canvas/poseCascade.js +1 -1
- package/dist/canvas/poseCascade.js.map +1 -1
- package/dist/canvas/publishPreviews.js +97 -0
- package/dist/canvas/publishPreviews.js.map +1 -0
- package/dist/canvas/sceneAdapter.js +7 -5
- package/dist/canvas/sceneAdapter.js.map +1 -1
- package/dist/canvas/sceneClipboard.js +17 -10
- package/dist/canvas/sceneClipboard.js.map +1 -1
- package/dist/canvas/scenePickReads.js +37 -0
- package/dist/canvas/scenePickReads.js.map +1 -0
- package/dist/canvas/scenePickSource.js +74 -0
- package/dist/canvas/scenePickSource.js.map +1 -0
- package/dist/canvas/sceneSlotWiring.js +9 -4
- package/dist/canvas/sceneSlotWiring.js.map +1 -1
- package/dist/canvas/sceneViewRender.js +9 -5
- package/dist/canvas/sceneViewRender.js.map +1 -1
- package/dist/canvas/shownNodes.js +15 -0
- package/dist/canvas/shownNodes.js.map +1 -0
- package/dist/canvas/useSceneAdapter.js +5 -3
- package/dist/canvas/useSceneAdapter.js.map +1 -1
- package/dist/clipboard.d.ts +2 -2
- package/dist/{clone-C3e0OTuF.d.ts → clone-qb2e1F5p.d.ts} +2 -2
- package/dist/clone.d.ts +3 -3
- package/dist/core/isPlainObject.js +2 -2
- package/dist/core/layers/layerGroup.js.map +1 -1
- package/dist/core/scene/NodeRouting.js.map +1 -1
- package/dist/core/scene/arrivalWindow.js +1 -1
- package/dist/core/scene/arrivalWindow.js.map +1 -1
- package/dist/core/scene/clipNothing.js +2 -5
- package/dist/core/scene/clipNothing.js.map +1 -1
- package/dist/core/scene/declaredFieldSetters.js +44 -0
- package/dist/core/scene/declaredFieldSetters.js.map +1 -0
- package/dist/core/scene/depMemo.js +3 -0
- package/dist/core/scene/depMemo.js.map +1 -1
- package/dist/core/scene/dependents.js +3 -1
- package/dist/core/scene/dependents.js.map +1 -1
- package/dist/core/scene/documentOf.js +43 -0
- package/dist/core/scene/documentOf.js.map +1 -0
- package/dist/core/scene/effectivePose.js +37 -13
- package/dist/core/scene/effectivePose.js.map +1 -1
- package/dist/core/scene/fieldEdits.js +17 -14
- package/dist/core/scene/fieldEdits.js.map +1 -1
- package/dist/core/scene/historyForm.js +4 -4
- package/dist/core/scene/historyForm.js.map +1 -1
- package/dist/core/scene/inheritedPaint.js +27 -5
- package/dist/core/scene/inheritedPaint.js.map +1 -1
- package/dist/core/scene/kitOps.js +3 -23
- package/dist/core/scene/kitOps.js.map +1 -1
- package/dist/core/scene/layoutPass.js +1 -2
- package/dist/core/scene/layoutPass.js.map +1 -1
- package/dist/core/scene/nodeAsShown.js +72 -0
- package/dist/core/scene/nodeAsShown.js.map +1 -0
- package/dist/core/scene/nodeFnFields.js +2 -10
- package/dist/core/scene/nodeFnFields.js.map +1 -1
- package/dist/core/scene/nodeMemo.js +6 -1
- package/dist/core/scene/nodeMemo.js.map +1 -1
- package/dist/core/scene/nodeStore.js +2 -4
- package/dist/core/scene/nodeStore.js.map +1 -1
- package/dist/core/scene/pathEffects/derive.js +3 -2
- package/dist/core/scene/pathEffects/derive.js.map +1 -1
- package/dist/core/scene/pathEffects/foundHidden.js +35 -0
- package/dist/core/scene/pathEffects/foundHidden.js.map +1 -0
- package/dist/core/scene/plyStacks.js +89 -0
- package/dist/core/scene/plyStacks.js.map +1 -0
- package/dist/core/scene/poseHold.js +42 -24
- package/dist/core/scene/poseHold.js.map +1 -1
- package/dist/core/scene/poseOverrides.js +35 -38
- package/dist/core/scene/poseOverrides.js.map +1 -1
- package/dist/core/scene/posePlies.js +59 -0
- package/dist/core/scene/posePlies.js.map +1 -0
- package/dist/core/scene/reconcileSpecs.js +6 -15
- package/dist/core/scene/reconcileSpecs.js.map +1 -1
- package/dist/core/scene/renderOrder.js +10 -4
- package/dist/core/scene/renderOrder.js.map +1 -1
- package/dist/core/scene/sameValue.js +17 -0
- package/dist/core/scene/sameValue.js.map +1 -0
- package/dist/core/scene/scene.js +3 -3
- package/dist/core/scene/scene.js.map +1 -1
- package/dist/core/scene/sceneEdits.js +8 -0
- package/dist/core/scene/sceneEdits.js.map +1 -1
- package/dist/core/scene/sceneState.js +1 -2
- package/dist/core/scene/sceneState.js.map +1 -1
- package/dist/core/scene/serialization.js +45 -9
- package/dist/core/scene/serialization.js.map +1 -1
- package/dist/core/scene/staleReplay.js +5 -2
- package/dist/core/scene/staleReplay.js.map +1 -1
- package/dist/core/scene/statedFields.js +4 -2
- package/dist/core/scene/statedFields.js.map +1 -1
- package/dist/core/scene/treeEdits.js +2 -4
- package/dist/core/scene/treeEdits.js.map +1 -1
- package/dist/core/scene/treeOrder.js +3 -1
- package/dist/core/scene/treeOrder.js.map +1 -1
- package/dist/core/scene/treeReads.js +1 -2
- package/dist/core/scene/treeReads.js.map +1 -1
- package/dist/core/scene/treeShape.js +13 -0
- package/dist/core/scene/treeShape.js.map +1 -0
- package/dist/core/scene/types.js.map +1 -1
- package/dist/core/scene/useScene.js +1 -1
- package/dist/core/scene/useScene.js.map +1 -1
- package/dist/{cornerHandles-p8fDIAKt.d.ts → cornerHandles-CNCb7aTY.d.ts} +1 -1
- package/dist/{depSchema-mG19aEdD.d.ts → depSchema-B1RS-IJx.d.ts} +27 -54
- package/dist/devtools/handlers.js +1 -1
- package/dist/devtools/handlers.js.map +1 -1
- package/dist/devtools/protocol.js.map +1 -1
- package/dist/devtools-protocol.d.ts +4 -3
- package/dist/devtools.d.ts +3 -2
- package/dist/features/measure/measureHit.js +5 -3
- package/dist/features/measure/measureHit.js.map +1 -1
- package/dist/features/measure/measurement.js +1 -1
- package/dist/features/measure/measurement.js.map +1 -1
- package/dist/features/modes/modeLayers.js +14 -7
- package/dist/features/modes/modeLayers.js.map +1 -1
- package/dist/features/modes/modeTriggers.js +3 -3
- package/dist/features/modes/modeTriggers.js.map +1 -1
- package/dist/features/pathEffects/effectSources.js +25 -16
- package/dist/features/pathEffects/effectSources.js.map +1 -1
- package/dist/features/pathEffects/readSource.js +1 -1
- package/dist/features/pathEffects/readSource.js.map +1 -1
- package/dist/features/pathEffects/useEffectSourcesLayer.js +15 -19
- package/dist/features/pathEffects/useEffectSourcesLayer.js.map +1 -1
- package/dist/features/paths/editablePath.js +1 -1
- package/dist/features/paths/editablePath.js.map +1 -1
- package/dist/features/paths/pathSnap/sceneIndex.js +1 -1
- package/dist/features/paths/pathSnap/sceneIndex.js.map +1 -1
- package/dist/features/selection/enteredGroupFrame.js +65 -0
- package/dist/features/selection/enteredGroupFrame.js.map +1 -0
- package/dist/features/selection/enteredGroupScope.js +44 -0
- package/dist/features/selection/enteredGroupScope.js.map +1 -0
- package/dist/features/text/sceneTextDrafts.js +26 -27
- package/dist/features/text/sceneTextDrafts.js.map +1 -1
- package/dist/features/text/textHitAt.js +4 -2
- package/dist/features/text/textHitAt.js.map +1 -1
- package/dist/features/text/useSceneTextEdit.js +3 -3
- package/dist/features/text/useSceneTextEdit.js.map +1 -1
- package/dist/index.d.ts +225 -73
- package/dist/index.js +15 -5
- package/dist/interactions/actions/admitsChild.js +11 -0
- package/dist/interactions/actions/admitsChild.js.map +1 -0
- package/dist/interactions/actions/defaults/contextMenu.js +16 -3
- package/dist/interactions/actions/defaults/contextMenu.js.map +1 -1
- package/dist/interactions/actions/defaults/createPaintAction.js +4 -1
- package/dist/interactions/actions/defaults/createPaintAction.js.map +1 -1
- package/dist/interactions/actions/defaults/enterGroup.js +88 -0
- package/dist/interactions/actions/defaults/enterGroup.js.map +1 -0
- package/dist/interactions/actions/defaults/enterPathEdit.js +1 -1
- package/dist/interactions/actions/defaults/enterPathEdit.js.map +1 -1
- package/dist/interactions/actions/defaults/enterTextEdit.js +1 -1
- package/dist/interactions/actions/defaults/enterTextEdit.js.map +1 -1
- package/dist/interactions/actions/defaults/group.js +7 -7
- package/dist/interactions/actions/defaults/group.js.map +1 -1
- package/dist/interactions/actions/defaults/selectAll.js +7 -3
- package/dist/interactions/actions/defaults/selectAll.js.map +1 -1
- package/dist/interactions/actions/defaults/selectDeep.js +35 -0
- package/dist/interactions/actions/defaults/selectDeep.js.map +1 -0
- package/dist/interactions/actions/drawnBoxes.js +2 -1
- package/dist/interactions/actions/drawnBoxes.js.map +1 -1
- package/dist/interactions/actions/insert/action.js +1 -0
- package/dist/interactions/actions/insert/action.js.map +1 -1
- package/dist/interactions/actions/insert/parent.js +7 -5
- package/dist/interactions/actions/insert/parent.js.map +1 -1
- package/dist/interactions/actions/insert/placeAction.js +3 -2
- package/dist/interactions/actions/insert/placeAction.js.map +1 -1
- package/dist/interactions/actions/insert/session.js +2 -2
- package/dist/interactions/actions/insert/session.js.map +1 -1
- package/dist/interactions/actions/move/commit/reparent.js +1 -1
- package/dist/interactions/actions/move/commit/reparent.js.map +1 -1
- package/dist/interactions/actions/move/gestureAdapter.js +6 -7
- package/dist/interactions/actions/move/gestureAdapter.js.map +1 -1
- package/dist/interactions/actions/move/layout/exits.js +1 -1
- package/dist/interactions/actions/move/layout/exits.js.map +1 -1
- package/dist/interactions/actions/move/session.js +4 -4
- package/dist/interactions/actions/move/session.js.map +1 -1
- package/dist/interactions/actions/pathCommands/pathNodes.js +14 -5
- package/dist/interactions/actions/pathCommands/pathNodes.js.map +1 -1
- package/dist/interactions/gestures/thresholdDrag/thresholdDrag.js +14 -2
- package/dist/interactions/gestures/thresholdDrag/thresholdDrag.js.map +1 -1
- package/dist/{math-B56zxVs5.d.ts → math-C_elShP_.d.ts} +2 -5
- package/dist/math.d.ts +1 -1
- package/dist/move.d.ts +4 -4
- package/dist/{options-DBxEryYq.d.ts → options-ClEm3SEl.d.ts} +1 -1
- package/dist/resize.d.ts +4 -4
- package/dist/test-seams.d.ts +6 -6
- package/dist/tools/builtin/pressTarget.js +22 -0
- package/dist/tools/builtin/pressTarget.js.map +1 -0
- package/dist/tools/builtin/select/adapterPointQuery.js +3 -3
- package/dist/tools/builtin/select/adapterPointQuery.js.map +1 -1
- package/dist/tools/builtin/select/collapseDeferred.js +40 -0
- package/dist/tools/builtin/select/collapseDeferred.js.map +1 -0
- package/dist/tools/builtin/select/groupEntry.js +82 -0
- package/dist/tools/builtin/select/groupEntry.js.map +1 -0
- package/dist/tools/builtin/select/pressDecision.js +1 -1
- package/dist/tools/builtin/select/pressDecision.js.map +1 -1
- package/dist/tools/builtin/select/useSelectTool.js +61 -45
- package/dist/tools/builtin/select/useSelectTool.js.map +1 -1
- package/dist/{types-7puAuVD2.d.ts → types-49uYJN3j.d.ts} +1 -1
- package/dist/{types-CniVctmk.d.ts → types-BEdRIhNc.d.ts} +272 -109
- package/dist/{types-oFeQ5VjV.d.ts → types-p2alu-R1.d.ts} +1 -1
- package/dist/version.js +1 -1
- package/package.json +25 -25
package/dist/barrel/canvas.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { DEFAULT_LAYER_RETAIN } from "../core/layers/retain.js";
|
|
2
2
|
import { subscribeToSources } from "../core/layers/redrawSource.js";
|
|
3
3
|
import { depsUnchanged, drawLayers, drawOneLayer, isLayerPainted, isLayerVisible, paintedLayers } from "../core/layers/render.js";
|
|
4
|
+
import { inheritedPaintIn, inheritedPaintOf, inheritsPaint, withInheritedPaint } from "../core/scene/inheritedPaint.js";
|
|
4
5
|
import { dlog, dwarn, isDebugEnabled } from "../debug/flag.js";
|
|
5
|
-
import {
|
|
6
|
-
import { inheritedPaintIn, paintAbove, withInheritedPaints } from "../canvas/inheritedPaints.js";
|
|
6
|
+
import { paintAbove, withInheritedPaintBounds, withInheritedPaints } from "../canvas/inheritedPaints.js";
|
|
7
7
|
import { OVERLAY_ROLE_STROKES } from "../canvas/overlayRoleStrokes.js";
|
|
8
8
|
import { DEFAULT_INK, findNodeShape, findShapeBounds, findShapeInk, findShapeSilhouette, getNodeShapes, registerNodeShape, shapeCoversPoint } from "../canvas/NodeShape.js";
|
|
9
9
|
import { drawnAABBOf, drawnBoundsOf, findShapeDrawnBounds, inkExtentsOf } from "../canvas/drawnBounds.js";
|
|
10
10
|
import { insertPreviewExtent } from "../canvas/insertPreviewExtent.js";
|
|
11
11
|
import { CANVAS_CONTEXT_ATTRIBUTES } from "../canvas/contextAttributes.js";
|
|
12
12
|
import { isOverChildren, overChildren, splitOverChildren } from "../canvas/overChildren.js";
|
|
13
|
+
import { clipOutline } from "../canvas/ownClip.js";
|
|
13
14
|
import { drawnBoundsScene } from "../canvas/derivedPath.js";
|
|
14
15
|
import { sceneToAdapter } from "../canvas/sceneAdapter.js";
|
|
15
16
|
import { defaultDrawOne, defaultPaintBounds } from "../canvas/defaultDrawOne.js";
|
|
@@ -27,6 +28,7 @@ import { PickHud } from "../canvas/PickHud.js";
|
|
|
27
28
|
import { PATH_OVERLAY_ROLES, createPathOverlay } from "../canvas/pathOverlay.js";
|
|
28
29
|
import { DevtoolsLabel, useDevtoolsLabel } from "../devtools/label.js";
|
|
29
30
|
import { defaultNodeRouting, groupNodeRouting, inferredNodeRouting } from "../canvas/SceneCanvas/defaultNodeRouting.js";
|
|
31
|
+
import { publishPreviews } from "../canvas/publishPreviews.js";
|
|
30
32
|
import { DEFAULT_HANDLE_SIZE } from "../canvas/SceneCanvas/props.js";
|
|
31
33
|
import { resolveOverlays } from "../interactions/actions/resolveOverlays.js";
|
|
32
34
|
import { flattenPreviews, resolvePreviews } from "../interactions/actions/resolvePreviews.js";
|
|
@@ -44,4 +46,4 @@ import { modeTriggers } from "../features/modes/modeTriggers.js";
|
|
|
44
46
|
import { createChildrenLayer } from "../core/layers/children.js";
|
|
45
47
|
import { bitmapSrc, getImageBitmap as getImageBitmap$1, imageStatus as imageStatus$1, isVectorImageSrc, releaseImage, retryImage, setImageCacheBudget, subscribeImageReady as subscribeImageReady$1 } from "@weasel-js/renderer";
|
|
46
48
|
|
|
47
|
-
export { CANVAS_CONTEXT_ATTRIBUTES, CursorCoordsHud, DEBUG_FEATURES, DEFAULT_DEBUG_STROKES, DEFAULT_DEBUG_THEME, DEFAULT_HANDLE_SIZE, DEFAULT_INK, DEFAULT_LAYER_RETAIN, DevtoolsLabel, LeanSceneCanvas, OVERLAY_ROLE_STROKES, PATH_OVERLAY_ROLES, PickHud, SceneCanvas, WeaselProvider, bitmapSrc, buildDebugOverlayCommands, createChildrenLayer, createDebugOverlayLayer, createDebugSink, createNodeProperties, createNodeRouting, createPathOverlay, defaultDrawOne, defaultNodeProperties, defaultNodeRouting, defaultPaintBounds, depsUnchanged, dlog, drawLayers, drawOneLayer, drawnAABBOf, drawnBoundsOf, drawnBoundsScene, dwarn, findNodeShape, findShapeBounds, findShapeDrawnBounds, findShapeInk, findShapeSilhouette, flattenPreviews, getImageBitmap$1 as getImageBitmap, getNodeShapes, groupNodeRouting, hostAnchorCss, hostAnchorRect, imageStatus$1 as imageStatus, inferredNodeProperties, inferredNodeRouting, inheritedPaintIn, inheritedPaintOf, inheritsPaint, inkExtentsOf, insertPreviewExtent, isDebugEnabled, isLayerPainted, isLayerVisible, isOverChildren, isVectorImageSrc, kitTextHandler, minSizeOf, modeDecorationLayer, modeTriggers, openFilePicker, overChildren, paintAbove, paintedLayers, parseDebugFlags, registerContentHandler, registerNodeShape, releaseImage, resolveOverlays, resolvePreviews, retryImage, rotationDegreesUnit, routeKind, sceneToAdapter, setImageCacheBudget, shapeCoversPoint, splitOverChildren, subscribeImageReady$1 as subscribeImageReady, subscribeToSources, useDevtoolsLabel, useHostAnchor, useSceneAdapter, withInheritedPaint, withInheritedPaints, workspaceTintLayer };
|
|
49
|
+
export { CANVAS_CONTEXT_ATTRIBUTES, CursorCoordsHud, DEBUG_FEATURES, DEFAULT_DEBUG_STROKES, DEFAULT_DEBUG_THEME, DEFAULT_HANDLE_SIZE, DEFAULT_INK, DEFAULT_LAYER_RETAIN, DevtoolsLabel, LeanSceneCanvas, OVERLAY_ROLE_STROKES, PATH_OVERLAY_ROLES, PickHud, SceneCanvas, WeaselProvider, bitmapSrc, buildDebugOverlayCommands, clipOutline, createChildrenLayer, createDebugOverlayLayer, createDebugSink, createNodeProperties, createNodeRouting, createPathOverlay, defaultDrawOne, defaultNodeProperties, defaultNodeRouting, defaultPaintBounds, depsUnchanged, dlog, drawLayers, drawOneLayer, drawnAABBOf, drawnBoundsOf, drawnBoundsScene, dwarn, findNodeShape, findShapeBounds, findShapeDrawnBounds, findShapeInk, findShapeSilhouette, flattenPreviews, getImageBitmap$1 as getImageBitmap, getNodeShapes, groupNodeRouting, hostAnchorCss, hostAnchorRect, imageStatus$1 as imageStatus, inferredNodeProperties, inferredNodeRouting, inheritedPaintIn, inheritedPaintOf, inheritsPaint, inkExtentsOf, insertPreviewExtent, isDebugEnabled, isLayerPainted, isLayerVisible, isOverChildren, isVectorImageSrc, kitTextHandler, minSizeOf, modeDecorationLayer, modeTriggers, openFilePicker, overChildren, paintAbove, paintedLayers, parseDebugFlags, publishPreviews, registerContentHandler, registerNodeShape, releaseImage, resolveOverlays, resolvePreviews, retryImage, rotationDegreesUnit, routeKind, sceneToAdapter, setImageCacheBudget, shapeCoversPoint, splitOverChildren, subscribeImageReady$1 as subscribeImageReady, subscribeToSources, useDevtoolsLabel, useHostAnchor, useSceneAdapter, withInheritedPaint, withInheritedPaintBounds, withInheritedPaints, workspaceTintLayer };
|
package/dist/barrel/chrome.js
CHANGED
|
@@ -4,6 +4,7 @@ import { annulusSemiAxes, hitAffordanceRegions, pointRegionFrame } from "../affo
|
|
|
4
4
|
import { createCornerResizeAffordance } from "../affordances/cornerResize.js";
|
|
5
5
|
import { createRotationAffordance } from "../affordances/rotationHandle.js";
|
|
6
6
|
import { PATH_ANCHOR_CHROME_ID, createPathAnchorAffordances } from "../affordances/pathAnchors.js";
|
|
7
|
+
import { createEnteredGroup, useEnteredGroup } from "../canvas/deps/enteredGroup.js";
|
|
7
8
|
import { actionIs, always, and, canHover, capabilityAll, capabilityIn, capabilityIs, capabilityNot, coarsePointer, cond, editingAnchors, focused, gesturing, hovering, hoveringSelected, modeIn, modeIs, modeNot, modifierHeld, multiActive, never, not, or, selectionAtLeast, selectionEmpty, selectionIs, when, zoomAtLeast } from "../features/chrome-caps/conditions.js";
|
|
8
9
|
import { composeSelectionPose } from "../features/selection/selectionPose.js";
|
|
9
10
|
import { createSelectionHandlesLayer, createSelectionOutlineLayer, createSelectionOverlayLayer } from "../features/selection/overlay.js";
|
|
@@ -12,8 +13,9 @@ import { resolveVisibility } from "../features/chrome-caps/resolve.js";
|
|
|
12
13
|
import { buildChromeCtx } from "../features/chrome-caps/buildChromeCtx.js";
|
|
13
14
|
import { useHoverTracking } from "../features/chrome-caps/useHoverTracking.js";
|
|
14
15
|
import { ALWAYS, DEFAULT_ALLOWED_CAPABILITIES, NEVER, buildRuleCtx, describeRule, evaluate } from "../features/chrome-caps/index.js";
|
|
16
|
+
import { createEnteredGroupScope } from "../features/selection/enteredGroupScope.js";
|
|
15
17
|
import { composeAffordanceLayer } from "../affordances/composeAffordanceLayer.js";
|
|
16
18
|
import { SelectionContextProvider as SelectionContextProvider$1, SelectionContextProviderIfRoot as SelectionContextProviderIfRoot$1, usePublishSelection as usePublishSelection$1, useSelectionContext } from "@weasel-js/routing/react";
|
|
17
19
|
import { ANGLE_RADIANS as ANGLE_RADIANS$1, IMPERIAL_INCHES, METRIC_MM, PIXELS, axisUnits, formatAxes, formatScoped, formatUnit, fromRoot, parseUnitExpr, resolveAxes, resolveScoped, resolveUnit, resolveUnitExpr, scopesOf as scopesOf$1, toRoot, unitScale } from "@weasel-js/quantity";
|
|
18
20
|
|
|
19
|
-
export { ALWAYS, ANGLE_RADIANS$1 as ANGLE_RADIANS, DEFAULT_ALLOWED_CAPABILITIES, IMPERIAL_INCHES, METRIC_MM, NEVER, PATH_ANCHOR_CHROME_ID, PIXELS, SelectionContextProvider$1 as SelectionContextProvider, SelectionContextProviderIfRoot$1 as SelectionContextProviderIfRoot, actionIs, always, and, annulusSemiAxes, axisUnits, buildChromeCtx, buildRuleCtx, canHover, capabilityAll, capabilityIn, capabilityIs, capabilityNot, coarsePointer, composeAffordanceLayer, composeSelectionPose, cond, createCornerResizeAffordance, createPathAnchorAffordances, createRotationAffordance, createSelectionHandlesLayer, createSelectionOutlineLayer, createSelectionOverlayLayer, defaultVisibilityRules, describeRule, editingAnchors, evaluate, focused, formatAxes, formatScoped, formatUnit, fromRoot, gesturing, hitAffordanceRegions, hovering, hoveringSelected, modeIn, modeIs, modeNot, modifierHeld, multiActive, never, not, or, paintsLayer, parseUnitExpr, pointRegionFrame, resolveAxes, resolveScoped, resolveUnit, resolveUnitExpr, resolveVisibility, scopesOf$1 as scopesOf, selectionAtLeast, selectionEmpty, selectionIs, toRoot, unitScale, useHoverTracking, usePublishSelection$1 as usePublishSelection, useSelection, useSelectionContext, when, zoomAtLeast };
|
|
21
|
+
export { ALWAYS, ANGLE_RADIANS$1 as ANGLE_RADIANS, DEFAULT_ALLOWED_CAPABILITIES, IMPERIAL_INCHES, METRIC_MM, NEVER, PATH_ANCHOR_CHROME_ID, PIXELS, SelectionContextProvider$1 as SelectionContextProvider, SelectionContextProviderIfRoot$1 as SelectionContextProviderIfRoot, actionIs, always, and, annulusSemiAxes, axisUnits, buildChromeCtx, buildRuleCtx, canHover, capabilityAll, capabilityIn, capabilityIs, capabilityNot, coarsePointer, composeAffordanceLayer, composeSelectionPose, cond, createCornerResizeAffordance, createEnteredGroup, createEnteredGroupScope, createPathAnchorAffordances, createRotationAffordance, createSelectionHandlesLayer, createSelectionOutlineLayer, createSelectionOverlayLayer, defaultVisibilityRules, describeRule, editingAnchors, evaluate, focused, formatAxes, formatScoped, formatUnit, fromRoot, gesturing, hitAffordanceRegions, hovering, hoveringSelected, modeIn, modeIs, modeNot, modifierHeld, multiActive, never, not, or, paintsLayer, parseUnitExpr, pointRegionFrame, resolveAxes, resolveScoped, resolveUnit, resolveUnitExpr, resolveVisibility, scopesOf$1 as scopesOf, selectionAtLeast, selectionEmpty, selectionIs, toRoot, unitScale, useEnteredGroup, useHoverTracking, usePublishSelection$1 as usePublishSelection, useSelection, useSelectionContext, when, zoomAtLeast };
|
package/dist/barrel/paths.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { noteFontRead } from "../core/scene/fontReads.js";
|
|
2
2
|
import { derivedPartsOf, pathFromParts, resolvePartPaint } from "../core/scene/derivedParts.js";
|
|
3
|
+
import { sourcesOf } from "../core/scene/dependents.js";
|
|
3
4
|
import { pathPoseDescriptor } from "../core/geometry/pathPoseDescriptor.js";
|
|
4
5
|
import { commitOps } from "../interactions/actions/defaultCommitAdapter.js";
|
|
5
6
|
import { HANDLE_LOCK_ROLES, locksInForce } from "../interactions/actions/edit-anchors/handleDrag.js";
|
|
@@ -10,7 +11,7 @@ import { deleteSelectedMark, editTargetOf, markUnder } from "../interactions/act
|
|
|
10
11
|
import { anchorEditWouldChange, commitAnchorEdit, depOf, requiresAnchorSelection } from "../interactions/actions/defaults/anchorEditing.js";
|
|
11
12
|
import { textAlongParts } from "../core/scene/pathEffects/textAlong.js";
|
|
12
13
|
import { PATH_EFFECT, createPathEffectDerivations, pathEffectNode, pathEffectOf, pathEffectParts, registeredPathEffects } from "../core/scene/pathEffects/derive.js";
|
|
13
|
-
import { effectSourceFor, hiddenSourcesTakenWith } from "../features/pathEffects/effectSources.js";
|
|
14
|
+
import { effectSourceFor, hiddenSourcesTakenWith, sourcesHiddenBy } from "../features/pathEffects/effectSources.js";
|
|
14
15
|
import { makeHandleCommand } from "../interactions/actions/defaults/anchorHandles.js";
|
|
15
16
|
import { joinSelectedAnchors } from "../interactions/actions/defaults/anchorJoin.js";
|
|
16
17
|
import { segmentUnder } from "../interactions/actions/defaults/segmentUnder.js";
|
|
@@ -40,4 +41,4 @@ import { commitBooleanPieces, resolveBooleanOperands } from "../interactions/act
|
|
|
40
41
|
import { CONSTRAINT_TOLERANCE, constrainPathEdit, constraintAnchors, pathAnchorPoints, solveConstraints, solvePathConstraints, unsatisfiedConstraints } from "@weasel-js/geom";
|
|
41
42
|
import { CURVE_REPS, bezierCubic, bezierQuadratic, nurbs, spiro } from "@weasel-js/geom/curves";
|
|
42
43
|
|
|
43
|
-
export { CONSTRAINT_TOLERANCE, CORNER_FIT_TOLERANCE, CORNER_KEYWORDS, CURVE_REPS, DEFAULT_FLATTEN_TOLERANCE, DEFAULT_OVERLAY_STYLE, DEFAULT_SIMPLIFY_TOLERANCE, GEOMETRY_BOUND_DATA, HANDLE_LOCK_ROLES, PATHFINDER_STROKES, PATH_C$1 as PATH_C, PATH_CMD_LENGTHS, PATH_EFFECT, PATH_EFFECT_DERIVATIONS, PATH_L$1 as PATH_L, PATH_M$1 as PATH_M, PATH_Q$1 as PATH_Q, PATH_SNAP_KINDS$1 as PATH_SNAP_KINDS, PATH_SNAP_LABELS, PATH_Z$1 as PATH_Z, PathBuilder, SHAPE_COUNT_RANGE, STAR_RATIO_RANGE, anchorEditWouldChange, applyBooleanOp, asPolygonPath$1 as asPolygonPath, averageAnchorsAt$1 as averageAnchorsAt, bendAlongPath$1 as bendAlongPath, bezierCubic, bezierQuadratic, blendPaths, boundsOfPath$1 as boundsOfPath, circlePath$1 as circlePath, clampShapeGenerator, classifyPathStorage, commitAnchorEdit, commitBooleanPieces, commitOps, composePath, constrainPathEdit, constraintAnchors, cornerAt, cornerFrameAt, cornerFrames, cornerKeywordOf, cornerShapeK, cornerShapePieces, cornerSpecAt, countPathAnchors$1 as countPathAnchors, createPathEditingOverlayLayer, createPathEffectDerivations, createPathLayer, createPathSnapIndex$1 as createPathSnapIndex, createPenPreviewLayer, decomposePath, deleteNode, deleteSelectedMark, depOf, derivedPartsOf, editTargetOf, editedPathSymmetries, effectSourceFor, ellipsePath$1 as ellipsePath, extendToMeet, findPathSnap$1 as findPathSnap, finishPathEditFrame, flattenCubic, flattenCubicWithArcLen, flattenQuadratic, flattenQuadraticWithArcLen, hasCorners, hasEditablePath, hasOpenSubpath$1 as hasOpenSubpath, hiddenSourcesTakenWith, insertAt, intersectSegments, isCornerShape, isShapeGenerator, joinAnchorsAt$1 as joinAnchorsAt, joinPathsCommand, joinSelectedAnchors, lengthenOpenEnd, linePath$1 as linePath, livePathEdit, locksInForce, makeHandleCommand, markUnder, measurePath$1 as measurePath, nextCornerShape, nodeOutline, noteFontRead, nurbs, offsetPath, openEndRay, openPathEnds, pathAnchorPoints, pathCommandCoordCount, pathContainsPoint$1 as pathContainsPoint, pathContainsPolygon, pathContainsRect, pathCopy, pathCrossings, pathDistanceToPoint, pathDivide, pathEditPathOf, pathEditPreview, pathEffectNode, pathEffectOf, pathEffectParts, pathExclude, pathFromD$1 as pathFromD, pathFromParts, pathInPoseFrame$1 as pathInPoseFrame, pathInWorld$1 as pathInWorld, pathIntersect, pathIntersectsPolygon, pathIntersectsRect$1 as pathIntersectsRect, pathNodesOf, pathOriginProjection, pathPoseDescriptor, pathSegments, pathSignedArea, pathSnapGlyph, pathSubtract, pathThroughPoseFrame$1 as pathThroughPoseFrame, pathToAnchors$1 as pathToAnchors, pathToD, pathUnion, planJoin, pointAlongPath, pointInPath$1 as pointInPath, polygonFromPoints$1 as polygonFromPoints, polylineFromPoints$1 as polylineFromPoints, poseFrameInverseOf$1 as poseFrameInverseOf, poseFrameOf$1 as poseFrameOf, poseLinearOf$1 as poseLinearOf, poseRotationOf, prepareBlend$1 as prepareBlend, previewBooleanOp, readEffectSource, rectMarkerPath$1 as rectMarkerPath, rectPath$1 as rectPath, regenerateShape, registeredPathEffects, regularPolygonPath$1 as regularPolygonPath, remapPerAnchor, repeatAlongPath$1 as repeatAlongPath, requiresAnchorSelection, reshapeOps, reshapeTo, resolveBooleanOperands, resolveCorners$1 as resolveCorners, resolveCornersWithSources, resolveEditablePathOf, resolvePartPaint, reversePath, rotatePathAround$1 as rotatePathAround, roundRectPath, scalePathToBounds, segmentUnder, selectedPathNodes, settleShapeGenerator, shapeGeneratorOf, shapeGeneratorPath, simplifyAnchorsAt, simplifyPath$1 as simplifyPath, slotOf, smudgePath, snipPathByPolyline, snipPathsAtCrossings, solveConstraints, solvePathConstraints, spiro, splitByClosure, splitPathByPolyline, splitPathBySegment, splitSubpaths, squarePath$1 as squarePath, starPath$1 as starPath, stationsAlongPath, storeEditablePath, strokeToPath, textAlongParts, transformPath$1 as transformPath, translatePath$1 as translatePath, trianglesToPath, trimPathAt, unionBoundsPath, unsatisfiedConstraints, useAnchorFields, useBooleans, useBooleansAdapter, useEffectSourcesLayer, withCorner, withPath, withPathEffectsRegistry, withoutCorners, withoutGeometryBoundData, withoutShapeGenerator, worldEditToStorage$1 as worldEditToStorage };
|
|
44
|
+
export { CONSTRAINT_TOLERANCE, CORNER_FIT_TOLERANCE, CORNER_KEYWORDS, CURVE_REPS, DEFAULT_FLATTEN_TOLERANCE, DEFAULT_OVERLAY_STYLE, DEFAULT_SIMPLIFY_TOLERANCE, GEOMETRY_BOUND_DATA, HANDLE_LOCK_ROLES, PATHFINDER_STROKES, PATH_C$1 as PATH_C, PATH_CMD_LENGTHS, PATH_EFFECT, PATH_EFFECT_DERIVATIONS, PATH_L$1 as PATH_L, PATH_M$1 as PATH_M, PATH_Q$1 as PATH_Q, PATH_SNAP_KINDS$1 as PATH_SNAP_KINDS, PATH_SNAP_LABELS, PATH_Z$1 as PATH_Z, PathBuilder, SHAPE_COUNT_RANGE, STAR_RATIO_RANGE, anchorEditWouldChange, applyBooleanOp, asPolygonPath$1 as asPolygonPath, averageAnchorsAt$1 as averageAnchorsAt, bendAlongPath$1 as bendAlongPath, bezierCubic, bezierQuadratic, blendPaths, boundsOfPath$1 as boundsOfPath, circlePath$1 as circlePath, clampShapeGenerator, classifyPathStorage, commitAnchorEdit, commitBooleanPieces, commitOps, composePath, constrainPathEdit, constraintAnchors, cornerAt, cornerFrameAt, cornerFrames, cornerKeywordOf, cornerShapeK, cornerShapePieces, cornerSpecAt, countPathAnchors$1 as countPathAnchors, createPathEditingOverlayLayer, createPathEffectDerivations, createPathLayer, createPathSnapIndex$1 as createPathSnapIndex, createPenPreviewLayer, decomposePath, deleteNode, deleteSelectedMark, depOf, derivedPartsOf, editTargetOf, editedPathSymmetries, effectSourceFor, ellipsePath$1 as ellipsePath, extendToMeet, findPathSnap$1 as findPathSnap, finishPathEditFrame, flattenCubic, flattenCubicWithArcLen, flattenQuadratic, flattenQuadraticWithArcLen, hasCorners, hasEditablePath, hasOpenSubpath$1 as hasOpenSubpath, hiddenSourcesTakenWith, insertAt, intersectSegments, isCornerShape, isShapeGenerator, joinAnchorsAt$1 as joinAnchorsAt, joinPathsCommand, joinSelectedAnchors, lengthenOpenEnd, linePath$1 as linePath, livePathEdit, locksInForce, makeHandleCommand, markUnder, measurePath$1 as measurePath, nextCornerShape, nodeOutline, noteFontRead, nurbs, offsetPath, openEndRay, openPathEnds, pathAnchorPoints, pathCommandCoordCount, pathContainsPoint$1 as pathContainsPoint, pathContainsPolygon, pathContainsRect, pathCopy, pathCrossings, pathDistanceToPoint, pathDivide, pathEditPathOf, pathEditPreview, pathEffectNode, pathEffectOf, pathEffectParts, pathExclude, pathFromD$1 as pathFromD, pathFromParts, pathInPoseFrame$1 as pathInPoseFrame, pathInWorld$1 as pathInWorld, pathIntersect, pathIntersectsPolygon, pathIntersectsRect$1 as pathIntersectsRect, pathNodesOf, pathOriginProjection, pathPoseDescriptor, pathSegments, pathSignedArea, pathSnapGlyph, pathSubtract, pathThroughPoseFrame$1 as pathThroughPoseFrame, pathToAnchors$1 as pathToAnchors, pathToD, pathUnion, planJoin, pointAlongPath, pointInPath$1 as pointInPath, polygonFromPoints$1 as polygonFromPoints, polylineFromPoints$1 as polylineFromPoints, poseFrameInverseOf$1 as poseFrameInverseOf, poseFrameOf$1 as poseFrameOf, poseLinearOf$1 as poseLinearOf, poseRotationOf, prepareBlend$1 as prepareBlend, previewBooleanOp, readEffectSource, rectMarkerPath$1 as rectMarkerPath, rectPath$1 as rectPath, regenerateShape, registeredPathEffects, regularPolygonPath$1 as regularPolygonPath, remapPerAnchor, repeatAlongPath$1 as repeatAlongPath, requiresAnchorSelection, reshapeOps, reshapeTo, resolveBooleanOperands, resolveCorners$1 as resolveCorners, resolveCornersWithSources, resolveEditablePathOf, resolvePartPaint, reversePath, rotatePathAround$1 as rotatePathAround, roundRectPath, scalePathToBounds, segmentUnder, selectedPathNodes, settleShapeGenerator, shapeGeneratorOf, shapeGeneratorPath, simplifyAnchorsAt, simplifyPath$1 as simplifyPath, slotOf, smudgePath, snipPathByPolyline, snipPathsAtCrossings, solveConstraints, solvePathConstraints, sourcesHiddenBy, sourcesOf, spiro, splitByClosure, splitPathByPolyline, splitPathBySegment, splitSubpaths, squarePath$1 as squarePath, starPath$1 as starPath, stationsAlongPath, storeEditablePath, strokeToPath, textAlongParts, transformPath$1 as transformPath, translatePath$1 as translatePath, trianglesToPath, trimPathAt, unionBoundsPath, unsatisfiedConstraints, useAnchorFields, useBooleans, useBooleansAdapter, useEffectSourcesLayer, withCorner, withPath, withPathEffectsRegistry, withoutCorners, withoutGeometryBoundData, withoutShapeGenerator, worldEditToStorage$1 as worldEditToStorage };
|
package/dist/barrel/routing.js
CHANGED
|
@@ -57,8 +57,8 @@ import { useSliceTool } from "../tools/builtin/slice/useSliceTool.js";
|
|
|
57
57
|
import { useMeasureTool } from "../tools/builtin/measure/useMeasureTool.js";
|
|
58
58
|
import { isToolSet, toolIdsOf as toolIdsOf$1, toolSet as toolSet$1, toolSetHas, withoutTools } from "../tools/index.js";
|
|
59
59
|
import { useLatest as useLatest$1 } from "@weasel-js/react";
|
|
60
|
-
import { ActionDisabledReason as ActionDisabledReason$1, actionBindings as actionBindings$1, actionCursor, actionItemTitle, actionItems, actionSettingsParams, actionShortcuts, actionsTagged, bindingId, buildDepsFromRequires as buildDepsFromRequires$1, createDepRegistry, createDispatcher as createDispatcher$1, deleteScratch, evaluateActive as evaluateActive$1, evaluateEnabled as evaluateEnabled$1, getScratch as getScratch$1, heldKeySpec as heldKeySpec$1, keySpecShortcut, keysHeld, matchActionItem, overlaysOf as overlaysOf$1, readActionSettings, resolveBindingOverrides, resolveParams as resolveParams$1, resolveSchemaMenu, roleReader as roleReader$1, scratchKey as scratchKey$1, setScratch as setScratch$1, specificity, taggedActionItems, tuneAction } from "@weasel-js/routing";
|
|
60
|
+
import { ActionDisabledReason as ActionDisabledReason$1, actionBindings as actionBindings$1, actionCursor, actionItemTitle, actionItems, actionSettingsParams, actionShortcuts, actionsTagged, bindingId, buildDepsFromRequires as buildDepsFromRequires$1, createDepRegistry, createDispatcher as createDispatcher$1, deleteScratch, evaluateActive as evaluateActive$1, evaluateEnabled as evaluateEnabled$1, getScratch as getScratch$1, heldKeySpec as heldKeySpec$1, keySpecShortcut, keysHeld, matchActionItem, modifierStateOf, overlaysOf as overlaysOf$1, readActionSettings, resolveBindingOverrides, resolveParams as resolveParams$1, resolveSchemaMenu, roleReader as roleReader$1, scratchKey as scratchKey$1, setScratch as setScratch$1, specificity, taggedActionItems, tuneAction } from "@weasel-js/routing";
|
|
61
61
|
import { bodyPredicate, hitPredicate as hitPredicate$1 } from "@weasel-js/gestures";
|
|
62
62
|
import { ActionsProvider as ActionsProvider$1, ActiveToolContextProvider as ActiveToolContextProvider$1, ActiveToolContextProviderIfRoot as ActiveToolContextProviderIfRoot$1, DepRegistryProvider as DepRegistryProvider$1, InputScope as InputScope$1, Yoke, useAction, useActionsRegistry as useActionsRegistry$1, useActiveToolContext, useCommand, useDepRegistry as useDepRegistry$1, useDepSource as useDepSource$1, useGestureDispatcher as useGestureDispatcher$1, useMenuHost as useMenuHost$1, useMenus, useOngoingAction, useOpenKeymap, useOptionalActiveToolContext as useOptionalActiveToolContext$1, useOptionalDepRegistry as useOptionalDepRegistry$1, useYoke } from "@weasel-js/routing/react";
|
|
63
63
|
|
|
64
|
-
export { AREA_SELECT_ID, ActionDisabledReason$1 as ActionDisabledReason, ActionsProvider$1 as ActionsProvider, ActiveToolContextProvider$1 as ActiveToolContextProvider, ActiveToolContextProviderIfRoot$1 as ActiveToolContextProviderIfRoot, CORNER_ANCHORS, DRAG_PAN_ID, DepRegistryProvider$1 as DepRegistryProvider, EDGE_HANDLE_MIN_RADII, INSERT_REPOSITION_BINDING, InputScope$1 as InputScope, KIT_STANDARD_ACTION_IDS, PATH_GESTURE_TAGS, RESIZE_HANDLE_ANCHORS, SELECTION_MOVE_ID, SELECTION_RESIZE_ID, SELECTION_ROTATE_ID, SELECTION_TRANSFORM_ID, STICKY_DEFAULTS, Yoke, actionBindings$1 as actionBindings, actionCursor, actionItemTitle, actionItems, actionSettingsParams, actionShortcuts, actionsTagged, areaSelectAction, areaSelectContribution, bindingId, bodyPredicate, buildDepsFromRequires$1 as buildDepsFromRequires, clearSelectionAction, clipboardCopyAction, clipboardCutAction, clipboardPasteAction, clipboardPasteEventAction, cloneAction, commitDeleteToScene, computeSliceOps, contextMenuAction, cornerPoint, createDeleteAction, createDepRegistry, createDispatcher$1 as createDispatcher, createPointerFollower, createResizeAction, defaultCommitAdapter, defineTool, deleteAction, deleteAnchorsAction, deleteScratch, dragPanContribution, editAnchorsAction, editingLayer, enterTextEditAction, evaluateActive$1 as evaluateActive, evaluateEnabled$1 as evaluateEnabled, exitPathEditToolAction, flipAction, getScratch$1 as getScratch, handlePoint, heldKeySpec$1 as heldKeySpec, hiddenSourceDeleteOps, hitPredicate$1 as hitPredicate, inPlane, insertAction, insertLayer, insertRepositionAction, isCornerHandle, isToolSet, keySpecShortcut, keysHeld, lassoSelectAction, makePinchZoomAction, makeViewportWheelPanAction, makeViewportZoomAction, matchActionItem, moveAction, nudgeAnchorsDownAction, nudgeAnchorsLeftAction, nudgeAnchorsRightAction, nudgeAnchorsUpAction, onEmptyCanvas, openContextMenu, overlaysOf$1 as overlaysOf, pathEditToolAction, pathEditToolActive, pathOperationTags, pickTopMostHit, pinchZoomAction, placeAction, readActionSettings, resizeAction, resizeHandlesFor, resolveBindingOverrides, resolveParams$1 as resolveParams, resolveSchemaMenu, roleReader$1 as roleReader, rotateAction, scratchKey$1 as scratchKey, selectAnchorAction, selectFromLasso, selectionLayer, selectionMoveBindings, selectionMoveContribution, selectionResizeBindings, selectionResizeContribution, selectionRotateBindings, selectionRotateContribution, selectionTransformBindings, selectionTransformContribution, setScratch$1 as setScratch, sliceAction, specificity, stickyData, stickyNodeFactory, taggedActionItems, toolIdsOf$1 as toolIdsOf, toolSet$1 as toolSet, toolSetHas, tuneAction, useAction, useActionsRegistry$1 as useActionsRegistry, useActiveToolContext, useBooleansAdapterSource, useCommand, useDepRegistry$1 as useDepRegistry, useDepSource$1 as useDepSource, useEllipseTool, useEyedropperTool, useGestureDispatcher$1 as useGestureDispatcher, useHandTool, useImageTool, useKeybindings, useLassoTool, useLatest$1 as useLatest, useLineTool, useMeasureTool, useMenuHost$1 as useMenuHost, useMenus, useOngoingAction, useOpenKeymap, useOptionalActiveToolContext$1 as useOptionalActiveToolContext, useOptionalDepRegistry$1 as useOptionalDepRegistry, usePenTool, usePencilTool, usePolygonTool, usePoseDescriptorDepSource, useRectTool, useResizePolicy, useSelectTool, useSliceDep, useSliceDepSource, useSliceTool, useStandardActions, useStarTool, useStickyTool, useTextTool, useTools$1 as useTools, useYoke, viewportDragPanAction, viewportWheelPanAction, viewportZoomAction, withoutTools };
|
|
64
|
+
export { AREA_SELECT_ID, ActionDisabledReason$1 as ActionDisabledReason, ActionsProvider$1 as ActionsProvider, ActiveToolContextProvider$1 as ActiveToolContextProvider, ActiveToolContextProviderIfRoot$1 as ActiveToolContextProviderIfRoot, CORNER_ANCHORS, DRAG_PAN_ID, DepRegistryProvider$1 as DepRegistryProvider, EDGE_HANDLE_MIN_RADII, INSERT_REPOSITION_BINDING, InputScope$1 as InputScope, KIT_STANDARD_ACTION_IDS, PATH_GESTURE_TAGS, RESIZE_HANDLE_ANCHORS, SELECTION_MOVE_ID, SELECTION_RESIZE_ID, SELECTION_ROTATE_ID, SELECTION_TRANSFORM_ID, STICKY_DEFAULTS, Yoke, actionBindings$1 as actionBindings, actionCursor, actionItemTitle, actionItems, actionSettingsParams, actionShortcuts, actionsTagged, areaSelectAction, areaSelectContribution, bindingId, bodyPredicate, buildDepsFromRequires$1 as buildDepsFromRequires, clearSelectionAction, clipboardCopyAction, clipboardCutAction, clipboardPasteAction, clipboardPasteEventAction, cloneAction, commitDeleteToScene, computeSliceOps, contextMenuAction, cornerPoint, createDeleteAction, createDepRegistry, createDispatcher$1 as createDispatcher, createPointerFollower, createResizeAction, defaultCommitAdapter, defineTool, deleteAction, deleteAnchorsAction, deleteScratch, dragPanContribution, editAnchorsAction, editingLayer, enterTextEditAction, evaluateActive$1 as evaluateActive, evaluateEnabled$1 as evaluateEnabled, exitPathEditToolAction, flipAction, getScratch$1 as getScratch, handlePoint, heldKeySpec$1 as heldKeySpec, hiddenSourceDeleteOps, hitPredicate$1 as hitPredicate, inPlane, insertAction, insertLayer, insertRepositionAction, isCornerHandle, isToolSet, keySpecShortcut, keysHeld, lassoSelectAction, makePinchZoomAction, makeViewportWheelPanAction, makeViewportZoomAction, matchActionItem, modifierStateOf, moveAction, nudgeAnchorsDownAction, nudgeAnchorsLeftAction, nudgeAnchorsRightAction, nudgeAnchorsUpAction, onEmptyCanvas, openContextMenu, overlaysOf$1 as overlaysOf, pathEditToolAction, pathEditToolActive, pathOperationTags, pickTopMostHit, pinchZoomAction, placeAction, readActionSettings, resizeAction, resizeHandlesFor, resolveBindingOverrides, resolveParams$1 as resolveParams, resolveSchemaMenu, roleReader$1 as roleReader, rotateAction, scratchKey$1 as scratchKey, selectAnchorAction, selectFromLasso, selectionLayer, selectionMoveBindings, selectionMoveContribution, selectionResizeBindings, selectionResizeContribution, selectionRotateBindings, selectionRotateContribution, selectionTransformBindings, selectionTransformContribution, setScratch$1 as setScratch, sliceAction, specificity, stickyData, stickyNodeFactory, taggedActionItems, toolIdsOf$1 as toolIdsOf, toolSet$1 as toolSet, toolSetHas, tuneAction, useAction, useActionsRegistry$1 as useActionsRegistry, useActiveToolContext, useBooleansAdapterSource, useCommand, useDepRegistry$1 as useDepRegistry, useDepSource$1 as useDepSource, useEllipseTool, useEyedropperTool, useGestureDispatcher$1 as useGestureDispatcher, useHandTool, useImageTool, useKeybindings, useLassoTool, useLatest$1 as useLatest, useLineTool, useMeasureTool, useMenuHost$1 as useMenuHost, useMenus, useOngoingAction, useOpenKeymap, useOptionalActiveToolContext$1 as useOptionalActiveToolContext, useOptionalDepRegistry$1 as useOptionalDepRegistry, usePenTool, usePencilTool, usePolygonTool, usePoseDescriptorDepSource, useRectTool, useResizePolicy, useSelectTool, useSliceDep, useSliceDepSource, useSliceTool, useStandardActions, useStarTool, useStickyTool, useTextTool, useTools$1 as useTools, useYoke, viewportDragPanAction, viewportWheelPanAction, viewportZoomAction, withoutTools };
|
package/dist/barrel/scene.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { IDENTITY_POSE_COMPOSITION, composeWorldPose, composesFrames, rebaseLocalPose } from "../core/scene/composeFrame.js";
|
|
2
2
|
import { RECT_POSE_COMPOSITION, RIGID_POSE_COMPOSITION, composeRectPose, composeRigidPose, decomposeRectPose, decomposeRigidPose, translateRectPose, worldPoseLookup } from "../core/scene/composePose.js";
|
|
3
|
+
import { documentOf } from "../core/scene/documentOf.js";
|
|
4
|
+
import { nodeAsShown } from "../core/scene/nodeAsShown.js";
|
|
3
5
|
import { definesFrame, derivedDepOf, derivedPose, documentDepOf, documentPose, effectivePose } from "../core/scene/effectivePose.js";
|
|
4
6
|
import { axisAlignedBounds, unionAABB, unionBounds } from "../core/geometry/unionBounds.js";
|
|
5
7
|
import { scenePoseAdapter } from "../core/scene/scenePoseAdapter.js";
|
|
@@ -8,7 +10,9 @@ import { measureBetween, measureEndsOf, measureNode, measurePose, measurementOf
|
|
|
8
10
|
import { asNodeId } from "../core/scene/types.js";
|
|
9
11
|
import { annotationLayerIds, isAnnotationLayer, isAnnotationNode } from "../core/scene/annotation.js";
|
|
10
12
|
import { hidesSubtree, isNodeHidden, isNodeLocked, nodeGates } from "../core/scene/nodeGates.js";
|
|
13
|
+
import { statedFields } from "../core/scene/statedFields.js";
|
|
11
14
|
import { applyOpsTo, dispatchApplyBatch } from "../core/applyOps.js";
|
|
15
|
+
import { hasChildren, isLeaf } from "../core/scene/treeShape.js";
|
|
12
16
|
import { SceneArrivalRefused } from "../core/scene/arrivals.js";
|
|
13
17
|
import { opFactoryRegistry, rebuildOp, registerOpFactory, registeredOpNames } from "../core/ops/registry.js";
|
|
14
18
|
import { createTransformOp } from "../core/ops/transform.js";
|
|
@@ -32,6 +36,7 @@ import { createArrangeOp } from "../core/ops/arrange.js";
|
|
|
32
36
|
import { createHistory as createHistory$1 } from "../core/ops/createHistory.js";
|
|
33
37
|
import { SCENE_HISTORY_FORM } from "../core/scene/historyForm.js";
|
|
34
38
|
import { sceneSelectionStore } from "../core/scene/sceneSelection.js";
|
|
39
|
+
import { nodeKindOf, specsFromSerialized } from "../core/scene/serialization.js";
|
|
35
40
|
import { createScene, sceneFromJSON } from "../core/scene/scene.js";
|
|
36
41
|
import { createSetTextOp } from "../core/ops/setText.js";
|
|
37
42
|
import { createSetDependsOnOp } from "../core/ops/setDependsOn.js";
|
|
@@ -49,4 +54,4 @@ import { measurementsContribution } from "../features/measure/measureContributio
|
|
|
49
54
|
import { MIXED } from "@weasel-js/registry";
|
|
50
55
|
import { swapOp } from "@weasel-js/history";
|
|
51
56
|
|
|
52
|
-
export { CLIP_NOTHING, IDENTITY_POSE_COMPOSITION, MEASURE_ACTION_IDS, MEASURE_AFFORDANCE_KIND, MEASURE_LAYER_ID, MIXED, RECT_POSE_COMPOSITION, RIGID_POSE_COMPOSITION, SCENE_HISTORY_FORM, SceneArrivalRefused, UNION_OF_CHILDREN, annotationLayerIds, applyOpsTo, asNodeId, axisAlignedBounds, canBringForward, canSendBackward, carriedDescendants, clipNothing, composeRectPose, composeRigidPose, composeWorldPose, composesFrames, createArrangeOp, createDeleteOp, createHistory$1 as createHistory, createInsertOp, createMeasurements, createMoveToIndexOp, createPoseFeed, createPoseOverrides, createReorderOp, createReparentOp, createScene, createSetChildOrderOp, createSetDataOp, createSetDependsOnOp, createSetHiddenOp, createSetLayerOp, createSetLayoutOp, createSetLockedOp, createSetPathOp, createSetSelectionOp, createSetTextOp, createTransformOp, currentMeasureId, decomposeRectPose, decomposeRigidPose, definesFrame, derivedDepOf, derivedPose, dispatchApplyBatch, documentDepOf, documentPose, effectivePose, hidesSubtree, isAnnotationLayer, isAnnotationNode, isNodeHidden, isNodeLocked, measureAt, measureBetween, measureEndSource, measureEndsOf, measureIds, measureNode, measurePose, measurementOf, measurementsContribution, nestedHitTester, nodeGates, opFactoryRegistry, rebaseLocalPose, rebuildOp, reconcileSpecs, registerOpFactory, registeredOpNames, sceneCarrySource, sceneFromJSON, scenePoseAdapter, sceneSelectionStore, sceneSharedUnitScopes, sceneUnitScopes, swapOp, translateRectPose, unionAABB, unionBounds, unionOfChildren, unionOfChildrenVia, useScene, worldPoseLookup, writtenBy };
|
|
57
|
+
export { CLIP_NOTHING, IDENTITY_POSE_COMPOSITION, MEASURE_ACTION_IDS, MEASURE_AFFORDANCE_KIND, MEASURE_LAYER_ID, MIXED, RECT_POSE_COMPOSITION, RIGID_POSE_COMPOSITION, SCENE_HISTORY_FORM, SceneArrivalRefused, UNION_OF_CHILDREN, annotationLayerIds, applyOpsTo, asNodeId, axisAlignedBounds, canBringForward, canSendBackward, carriedDescendants, clipNothing, composeRectPose, composeRigidPose, composeWorldPose, composesFrames, createArrangeOp, createDeleteOp, createHistory$1 as createHistory, createInsertOp, createMeasurements, createMoveToIndexOp, createPoseFeed, createPoseOverrides, createReorderOp, createReparentOp, createScene, createSetChildOrderOp, createSetDataOp, createSetDependsOnOp, createSetHiddenOp, createSetLayerOp, createSetLayoutOp, createSetLockedOp, createSetPathOp, createSetSelectionOp, createSetTextOp, createTransformOp, currentMeasureId, decomposeRectPose, decomposeRigidPose, definesFrame, derivedDepOf, derivedPose, dispatchApplyBatch, documentDepOf, documentOf, documentPose, effectivePose, hasChildren, hidesSubtree, isAnnotationLayer, isAnnotationNode, isLeaf, isNodeHidden, isNodeLocked, measureAt, measureBetween, measureEndSource, measureEndsOf, measureIds, measureNode, measurePose, measurementOf, measurementsContribution, nestedHitTester, nodeAsShown, nodeGates, nodeKindOf, opFactoryRegistry, rebaseLocalPose, rebuildOp, reconcileSpecs, registerOpFactory, registeredOpNames, sceneCarrySource, sceneFromJSON, scenePoseAdapter, sceneSelectionStore, sceneSharedUnitScopes, sceneUnitScopes, specsFromSerialized, statedFields, swapOp, translateRectPose, unionAABB, unionBounds, unionOfChildren, unionOfChildrenVia, useScene, worldPoseLookup, writtenBy };
|
package/dist/canvas/NodeShape.js
CHANGED
|
@@ -128,6 +128,7 @@ function findShapeBounds(node, pose, ctx) {
|
|
|
128
128
|
* "no opinion" — so callers should keep their own AABB test as a pre-filter.
|
|
129
129
|
*/
|
|
130
130
|
function shapeCoversPoint(node, pose, x, y, opts = {}) {
|
|
131
|
+
if (node.kind === "group") return true;
|
|
131
132
|
const sil = findShapeSilhouette(node, pose, { derivedPath: opts.derivedPath });
|
|
132
133
|
if (sil === null) return true;
|
|
133
134
|
const ink = findShapeInk(node, pose, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeShape.js","names":[],"sources":["../../src/canvas/NodeShape.ts"],"sourcesContent":["/**\n * NodeShape — the **shape trait's** registry: the per-kind `paint` + `silhouette` used by\n * `defaultDrawOne`, clipping, non-rect hit-testing, and lasso/area-select. Teaching the kit\n * about a new kind of shape goes through this registry rather than by overriding `drawOne`.\n *\n * The first entry whose `matches` predicate returns true paints the node: `'high'` entries\n * first, then the built-ins, then `'normal'` ones, in registration order within a tier. Every\n * built-in but `kit:derived` additionally requires a rect-shaped pose — a scene whose poses are\n * some other shape matches none of them, and paints through a consumer painter or not at all.\n */\nimport { glyphGeneration } from '@weasel-js/font';\nimport {\n pathContainsPoint,\n strokeHitTest,\n type Path\n} from '@weasel-js/geom';\nimport { pathThroughPoseFrame } from '@weasel-js/geom';\nimport { bumpNodeMemoGeneration, nodeMemo } from 'core/scene/nodeMemo';\nimport type { Node } from 'core/scene/types';\nimport type { Bounds } from 'core/viewport/fitViewToBounds';\nimport { hasSlop, slopForStrokeHit, widenSlop, type PickSlop } from 'core/viewport/screenSlop';\nimport { DERIVED_PAINTER } from './nodeShapes/derivedPainter';\nimport { IMAGE_PAINTER } from './nodeShapes/imagePainter';\nimport { MEASURE_PAINTER } from './nodeShapes/measurePainter';\nimport { derivesPath } from './nodeShapes/memo';\nimport { PATH_PAINTER } from './nodeShapes/pathPainter';\nimport { paintsPose } from './nodeShapes/poseBox';\nimport { RECT_FALLBACK_PAINTER } from './nodeShapes/rectFallbackPainter';\nimport { SHAPE_PAINTER } from './nodeShapes/shapePainter';\nimport { TEXT_PAINTER } from './nodeShapes/textPainter';\nimport type { NodeShapeEntry, NodeInk, NodeSilhouetteCtx, NodeInkCtx } from './nodeShapeTypes';\nexport type { NodePaintCtx, SceneViewDrawOne, NodeShapeEntry, NodeInk, NodeSilhouetteCtx, NodeInkCtx } from './nodeShapeTypes';\nexport type { InheritedPaint } from 'core/scene/inheritedPaint';\n\n/** What a painter that declares no `ink` is assumed to do. */\nexport const DEFAULT_INK: Readonly<NodeInk> = Object.freeze({ filled: true, outset: 0, inset: 0 });\n\n/** Options for `registerNodeShape`. */\nexport interface RegisterNodeShapeOptions {\n /** `'high'` puts the painter ahead of all normally-registered ones (so\n * it can win over a kit built-in). `'normal'` appends at the end. */\n priority?: 'high' | 'normal';\n}\n\nconst PAINTERS: { high: NodeShapeEntry[]; normal: NodeShapeEntry[] } = {\n high: [],\n normal: [],\n};\n\n// The built-ins go in on first use, not at module load: a bundler may drop an\n// import kept only for its side effect, and the registry would come up empty.\nlet builtInsRegistered = false;\nfunction ensureBuiltIns(): void {\n if (builtInsRegistered) return;\n builtInsRegistered = true;\n registerBuiltInShapePainters();\n}\n\n/** Register a shape painter. Returns a disposer that removes it. */\nexport function registerNodeShape<TData, TPose>(\n painter: NodeShapeEntry<TData, TPose>,\n opts: RegisterNodeShapeOptions = {},\n): () => void {\n ensureBuiltIns();\n const list = opts.priority === 'high' ? PAINTERS.high : PAINTERS.normal;\n list.push(painter as NodeShapeEntry);\n // The painter set is exactly the ambient state `findNodeShape` reads, and a\n // memo keyed on the node alone cannot see it change. See `nodeMemo`.\n bumpNodeMemoGeneration();\n return () => {\n const i = list.indexOf(painter as NodeShapeEntry);\n if (i >= 0) list.splice(i, 1);\n bumpNodeMemoGeneration();\n };\n}\n\n/**\n * Slot names for what picking asks per node per pointer move: which painter matches, and that\n * painter's silhouette path. Both go through {@link nodeMemo}, so they invalidate on `data`\n * (and, for the silhouette, `pose`) reference changes and on a painter registration.\n *\n * Separate slots rather than one entry: they mostly invalidate together, but not always, and a\n * shared entry would force the stricter key on both.\n */\nconst PAINTER_SLOT = 'shape:painter';\nconst PAINTER_SLOT_NONRECT = 'shape:painter:nonrect';\nconst PAINTER_SLOT_DERIVED = 'shape:painter:derived';\nconst PAINTER_SLOT_DERIVED_NONRECT = 'shape:painter:derived:nonrect';\nconst SILHOUETTE_SLOT = 'shape:silhouette';\nconst TEXT_SILHOUETTE_SLOT = 'shape:silhouette:text';\n\n/** The painter that will render `node` — first match in priority order — or undefined if\n * none accepts it. */\nexport function findNodeShape<TData, TPose>(\n node: Node<TData, string, TPose>,\n): NodeShapeEntry<TData, TPose> | undefined {\n // Built-in painters also gate on pose shape and on whether the node derives\n // its path, neither of which shows in `data`, so the key carries both.\n const rect = paintsPose(node.pose);\n const slot = derivesPath(node)\n ? (rect ? PAINTER_SLOT_DERIVED : PAINTER_SLOT_DERIVED_NONRECT)\n : (rect ? PAINTER_SLOT : PAINTER_SLOT_NONRECT);\n return nodeMemo(node as { data?: unknown }, slot, undefined, () =>\n matchNodeShape(node),\n );\n}\n\nfunction matchNodeShape<TData, TPose>(\n node: Node<TData, string, TPose>,\n): NodeShapeEntry<TData, TPose> | undefined {\n ensureBuiltIns();\n for (const p of PAINTERS.high) {\n if (p.matches(node as Node<unknown, string, unknown>)) {\n return p as NodeShapeEntry<TData, TPose>;\n }\n }\n for (const p of PAINTERS.normal) {\n if (p.matches(node as Node<unknown, string, unknown>)) {\n return p as NodeShapeEntry<TData, TPose>;\n }\n }\n return undefined;\n}\n\n/** The silhouette path of `node`, in **world** coords, or null if no painter matches or the\n * matching painter has none.\n *\n * Painters return their silhouette in the pose's local (unrotated) frame;\n * this bakes the pose's frame (`poseFrameOf`: its rotation and `transform`)\n * on top, so clips/area-select of a turned or skewed node use the boundary\n * the renderer draws. */\nexport function findShapeSilhouette<TData, TPose>(\n node: Node<TData, string, TPose>,\n pose: TPose,\n ctx?: NodeSilhouetteCtx,\n): Path | null {\n const build = (): Path | null => {\n const sil = findNodeShape(node)?.silhouette?.(node, pose, ctx) ?? null;\n return sil && pathThroughPoseFrame(sil, pose);\n };\n // `SILHOUETTE_SLOT`'s key is (node, pose, data) and cannot see\n // `ctx.derivedPath` — the same reason `kit:derived` skips `PAINT_SLOT`.\n // Memoizing here would serve one caller's silhouette to a caller that\n // passed a different path. Only an actual path skips it: a scene-backed\n // source answers `null` for every ordinary node, and treating that as a\n // reason to bypass would retire the memo for the whole scene.\n if (ctx?.derivedPath != null) return build();\n // Line boxes follow font metrics, and a face landing changes those with no\n // change to the node, so the text entry is checked against the glyph epoch.\n if (findNodeShape(node) === (TEXT_PAINTER as NodeShapeEntry<unknown, unknown>)) {\n const epoch = glyphGeneration();\n const held = nodeMemo(node as { data?: unknown }, TEXT_SILHOUETTE_SLOT, pose,\n (): { epoch: number; path: Path | null } => ({ epoch, path: build() }));\n if (held.epoch !== epoch) {\n held.epoch = epoch;\n held.path = build();\n }\n return held.path;\n }\n return nodeMemo(node as { data?: unknown }, SILHOUETTE_SLOT, pose, build);\n}\n\n/** Find the painter for `node` and ask how it inks its silhouette. Returns\n * the painter's declared {@link NodeInk}, or `null` when no painter matches\n * or it declares none — callers substitute {@link DEFAULT_INK}. */\nexport function findShapeInk<TData, TPose>(\n node: Node<TData, string, TPose>,\n pose: TPose,\n ctx?: NodeInkCtx,\n): NodeInk | null {\n return findNodeShape(node)?.ink?.(node, pose, ctx) ?? null;\n}\n\n/** Find the painter for `node` and ask for the box its paint fits in. `null`\n * when no painter matches, or the one that does cannot say — see\n * {@link NodeShapeEntry.bounds}. */\nexport function findShapeBounds<TData, TPose>(\n node: Node<TData, string, TPose>,\n pose: TPose,\n ctx?: NodeInkCtx,\n): Bounds | null {\n return findNodeShape(node)?.bounds?.(node, pose, ctx) ?? null;\n}\n\n/** Options for {@link shapeCoversPoint}. */\nexport interface ShapeCoversPointOptions {\n /** Extra grab distance around the outline: **world** units as a number,\n * or screen pixels under a view scale (`{ px, scale }`), which is measured\n * on screen and so stays exact under non-uniform zoom. Defaults to `0`,\n * where a hairline is too thin a target to hit. */\n tolerance?: PickSlop;\n /** View scale, passed to the painter's `ink`, and what a screen reach is\n * read at under a world `tolerance`. Defaults to 1. */\n scale?: number;\n /** The node's derived path — see {@link NodeSilhouetteCtx.derivedPath}.\n * Without it a derived node reports no silhouette and this answers `true`\n * everywhere, which degrades picking to the caller's AABB: for an edge,\n * a zero-sized pose. */\n derivedPath?: Path | null;\n /** See {@link NodeInkCtx.inherited}. Without it an `'inherit'` field is\n * read as none. */\n inherited?: NodeInkCtx['inherited'];\n}\n\n/**\n * Does the shape `node` actually paints cover the world point? Asks the painter's silhouette,\n * the same boundary used for clipping and area-select, rather than the pose rect.\n *\n * The ink counts too: a shape whose interior isn't filled is grabbable along its outline and\n * not through its empty middle. The outline's grab width is the stroke's half-width plus\n * `tolerance`.\n *\n * A painter with no `silhouette`, or one that returns `null` for this node, reports `true` —\n * \"no opinion\" — so callers should keep their own AABB test as a pre-filter.\n */\nexport function shapeCoversPoint<TData, TPose>(\n node: Node<TData, string, TPose>,\n pose: TPose,\n x: number,\n y: number,\n opts: ShapeCoversPointOptions = {},\n): boolean {\n const sil = findShapeSilhouette(node, pose, { derivedPath: opts.derivedPath });\n if (sil === null) return true;\n const ink = findShapeInk(node, pose, { scale: opts.scale, inherited: opts.inherited }) ?? DEFAULT_INK;\n const inside = pathContainsPoint(sil, x, y);\n if (ink.filled && inside) return true;\n // The stroke reaches a different distance on each side, so which side the point is on\n // picks the reach. `tolerance` also makes a filled shape grabbable a few pixels outside\n // its edge.\n const slop = widenSlop(opts.tolerance, (inside ? ink.insetPx : ink.outsetPx) ?? 0, opts.scale);\n const { extra, opts: hit } = slopForStrokeHit(slop);\n const reach = (inside ? ink.inset : ink.outset) + extra;\n return (reach > 0 || hasSlop(slop)) && strokeHitTest(sil, x, y, reach, hit);\n}\n\n/** The current painters in evaluation order — `'high'` tier first, then `'normal'`. */\nexport function getNodeShapes(): readonly NodeShapeEntry[] {\n ensureBuiltIns();\n return [...PAINTERS.high, ...PAINTERS.normal];\n}\n\n/** Test-only: clear the registry and re-register the built-ins. */\nexport function _resetShapePaintersForTests(): void {\n PAINTERS.high.length = 0;\n PAINTERS.normal.length = 0;\n builtInsRegistered = false;\n ensureBuiltIns();\n // `registerNodeShape` already bumps, but the clearing above happens without one.\n bumpNodeMemoGeneration();\n}\n\nfunction registerBuiltInShapePainters(): void {\n registerNodeShape(TEXT_PAINTER);\n registerNodeShape(MEASURE_PAINTER);\n // Ahead of path/shape/image: a derived node whose `data` also carries a\n // `path`, `shape` or `image` means the derived path, and those three match\n // on the presence of the field alone.\n registerNodeShape(DERIVED_PAINTER);\n registerNodeShape(PATH_PAINTER);\n registerNodeShape(SHAPE_PAINTER);\n registerNodeShape(IMAGE_PAINTER);\n registerNodeShape(RECT_FALLBACK_PAINTER);\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"NodeShape.js","names":[],"sources":["../../src/canvas/NodeShape.ts"],"sourcesContent":["/**\n * NodeShape — the **shape trait's** registry: the per-kind `paint` + `silhouette` used by\n * `defaultDrawOne`, clipping, non-rect hit-testing, and lasso/area-select. Teaching the kit\n * about a new kind of shape goes through this registry rather than by overriding `drawOne`.\n *\n * The first entry whose `matches` predicate returns true paints the node: `'high'` entries\n * first, then the built-ins, then `'normal'` ones, in registration order within a tier. Every\n * built-in but `kit:derived` additionally requires a rect-shaped pose — a scene whose poses are\n * some other shape matches none of them, and paints through a consumer painter or not at all.\n */\nimport { glyphGeneration } from '@weasel-js/font';\nimport {\n pathContainsPoint,\n strokeHitTest,\n type Path\n} from '@weasel-js/geom';\nimport { pathThroughPoseFrame } from '@weasel-js/geom';\nimport { bumpNodeMemoGeneration, nodeMemo } from 'core/scene/nodeMemo';\nimport type { Node } from 'core/scene/types';\nimport type { Bounds } from 'core/viewport/fitViewToBounds';\nimport { hasSlop, slopForStrokeHit, widenSlop, type PickSlop } from 'core/viewport/screenSlop';\nimport { DERIVED_PAINTER } from './nodeShapes/derivedPainter';\nimport { IMAGE_PAINTER } from './nodeShapes/imagePainter';\nimport { MEASURE_PAINTER } from './nodeShapes/measurePainter';\nimport { derivesPath } from './nodeShapes/memo';\nimport { PATH_PAINTER } from './nodeShapes/pathPainter';\nimport { paintsPose } from './nodeShapes/poseBox';\nimport { RECT_FALLBACK_PAINTER } from './nodeShapes/rectFallbackPainter';\nimport { SHAPE_PAINTER } from './nodeShapes/shapePainter';\nimport { TEXT_PAINTER } from './nodeShapes/textPainter';\nimport type { NodeShapeEntry, NodeInk, NodeSilhouetteCtx, NodeInkCtx } from './nodeShapeTypes';\nexport type { NodePaintCtx, SceneViewDrawOne, NodeShapeEntry, NodeInk, NodeSilhouetteCtx, NodeInkCtx } from './nodeShapeTypes';\nexport type { InheritedPaint } from 'core/scene/inheritedPaint';\n\n/** What a painter that declares no `ink` is assumed to do. */\nexport const DEFAULT_INK: Readonly<NodeInk> = Object.freeze({ filled: true, outset: 0, inset: 0 });\n\n/** Options for `registerNodeShape`. */\nexport interface RegisterNodeShapeOptions {\n /** `'high'` puts the painter ahead of all normally-registered ones (so\n * it can win over a kit built-in). `'normal'` appends at the end. */\n priority?: 'high' | 'normal';\n}\n\nconst PAINTERS: { high: NodeShapeEntry[]; normal: NodeShapeEntry[] } = {\n high: [],\n normal: [],\n};\n\n// The built-ins go in on first use, not at module load: a bundler may drop an\n// import kept only for its side effect, and the registry would come up empty.\nlet builtInsRegistered = false;\nfunction ensureBuiltIns(): void {\n if (builtInsRegistered) return;\n builtInsRegistered = true;\n registerBuiltInShapePainters();\n}\n\n/** Register a shape painter. Returns a disposer that removes it. */\nexport function registerNodeShape<TData, TPose>(\n painter: NodeShapeEntry<TData, TPose>,\n opts: RegisterNodeShapeOptions = {},\n): () => void {\n ensureBuiltIns();\n const list = opts.priority === 'high' ? PAINTERS.high : PAINTERS.normal;\n list.push(painter as NodeShapeEntry);\n // The painter set is exactly the ambient state `findNodeShape` reads, and a\n // memo keyed on the node alone cannot see it change. See `nodeMemo`.\n bumpNodeMemoGeneration();\n return () => {\n const i = list.indexOf(painter as NodeShapeEntry);\n if (i >= 0) list.splice(i, 1);\n bumpNodeMemoGeneration();\n };\n}\n\n/**\n * Slot names for what picking asks per node per pointer move: which painter matches, and that\n * painter's silhouette path. Both go through {@link nodeMemo}, so they invalidate on `data`\n * (and, for the silhouette, `pose`) reference changes and on a painter registration.\n *\n * Separate slots rather than one entry: they mostly invalidate together, but not always, and a\n * shared entry would force the stricter key on both.\n */\nconst PAINTER_SLOT = 'shape:painter';\nconst PAINTER_SLOT_NONRECT = 'shape:painter:nonrect';\nconst PAINTER_SLOT_DERIVED = 'shape:painter:derived';\nconst PAINTER_SLOT_DERIVED_NONRECT = 'shape:painter:derived:nonrect';\nconst SILHOUETTE_SLOT = 'shape:silhouette';\nconst TEXT_SILHOUETTE_SLOT = 'shape:silhouette:text';\n\n/** The painter that will render `node` — first match in priority order — or undefined if\n * none accepts it. */\nexport function findNodeShape<TData, TPose>(\n node: Node<TData, string, TPose>,\n): NodeShapeEntry<TData, TPose> | undefined {\n // Built-in painters also gate on pose shape and on whether the node derives\n // its path, neither of which shows in `data`, so the key carries both.\n const rect = paintsPose(node.pose);\n const slot = derivesPath(node)\n ? (rect ? PAINTER_SLOT_DERIVED : PAINTER_SLOT_DERIVED_NONRECT)\n : (rect ? PAINTER_SLOT : PAINTER_SLOT_NONRECT);\n return nodeMemo(node as { data?: unknown }, slot, undefined, () =>\n matchNodeShape(node),\n );\n}\n\nfunction matchNodeShape<TData, TPose>(\n node: Node<TData, string, TPose>,\n): NodeShapeEntry<TData, TPose> | undefined {\n ensureBuiltIns();\n for (const p of PAINTERS.high) {\n if (p.matches(node as Node<unknown, string, unknown>)) {\n return p as NodeShapeEntry<TData, TPose>;\n }\n }\n for (const p of PAINTERS.normal) {\n if (p.matches(node as Node<unknown, string, unknown>)) {\n return p as NodeShapeEntry<TData, TPose>;\n }\n }\n return undefined;\n}\n\n/** The silhouette path of `node`, in **world** coords, or null if no painter matches or the\n * matching painter has none.\n *\n * Painters return their silhouette in the pose's local (unrotated) frame;\n * this bakes the pose's frame (`poseFrameOf`: its rotation and `transform`)\n * on top, so clips/area-select of a turned or skewed node use the boundary\n * the renderer draws. */\nexport function findShapeSilhouette<TData, TPose>(\n node: Node<TData, string, TPose>,\n pose: TPose,\n ctx?: NodeSilhouetteCtx,\n): Path | null {\n const build = (): Path | null => {\n const sil = findNodeShape(node)?.silhouette?.(node, pose, ctx) ?? null;\n return sil && pathThroughPoseFrame(sil, pose);\n };\n // `SILHOUETTE_SLOT`'s key is (node, pose, data) and cannot see\n // `ctx.derivedPath` — the same reason `kit:derived` skips `PAINT_SLOT`.\n // Memoizing here would serve one caller's silhouette to a caller that\n // passed a different path. Only an actual path skips it: a scene-backed\n // source answers `null` for every ordinary node, and treating that as a\n // reason to bypass would retire the memo for the whole scene.\n if (ctx?.derivedPath != null) return build();\n // Line boxes follow font metrics, and a face landing changes those with no\n // change to the node, so the text entry is checked against the glyph epoch.\n if (findNodeShape(node) === (TEXT_PAINTER as NodeShapeEntry<unknown, unknown>)) {\n const epoch = glyphGeneration();\n const held = nodeMemo(node as { data?: unknown }, TEXT_SILHOUETTE_SLOT, pose,\n (): { epoch: number; path: Path | null } => ({ epoch, path: build() }));\n if (held.epoch !== epoch) {\n held.epoch = epoch;\n held.path = build();\n }\n return held.path;\n }\n return nodeMemo(node as { data?: unknown }, SILHOUETTE_SLOT, pose, build);\n}\n\n/** Find the painter for `node` and ask how it inks its silhouette. Returns\n * the painter's declared {@link NodeInk}, or `null` when no painter matches\n * or it declares none — callers substitute {@link DEFAULT_INK}. */\nexport function findShapeInk<TData, TPose>(\n node: Node<TData, string, TPose>,\n pose: TPose,\n ctx?: NodeInkCtx,\n): NodeInk | null {\n return findNodeShape(node)?.ink?.(node, pose, ctx) ?? null;\n}\n\n/** Find the painter for `node` and ask for the box its paint fits in. `null`\n * when no painter matches, or the one that does cannot say — see\n * {@link NodeShapeEntry.bounds}. */\nexport function findShapeBounds<TData, TPose>(\n node: Node<TData, string, TPose>,\n pose: TPose,\n ctx?: NodeInkCtx,\n): Bounds | null {\n return findNodeShape(node)?.bounds?.(node, pose, ctx) ?? null;\n}\n\n/** Options for {@link shapeCoversPoint}. */\nexport interface ShapeCoversPointOptions {\n /** Extra grab distance around the outline: **world** units as a number,\n * or screen pixels under a view scale (`{ px, scale }`), which is measured\n * on screen and so stays exact under non-uniform zoom. Defaults to `0`,\n * where a hairline is too thin a target to hit. */\n tolerance?: PickSlop;\n /** View scale, passed to the painter's `ink`, and what a screen reach is\n * read at under a world `tolerance`. Defaults to 1. */\n scale?: number;\n /** The node's derived path — see {@link NodeSilhouetteCtx.derivedPath}.\n * Without it a derived node reports no silhouette and this answers `true`\n * everywhere, which degrades picking to the caller's AABB: for an edge,\n * a zero-sized pose. */\n derivedPath?: Path | null;\n /** See {@link NodeInkCtx.inherited}. Without it an `'inherit'` field is\n * read as none. */\n inherited?: NodeInkCtx['inherited'];\n}\n\n/**\n * Does the shape `node` actually paints cover the world point? Asks the painter's silhouette,\n * the same boundary used for clipping and area-select, rather than the pose rect.\n *\n * The ink counts too: a shape whose interior isn't filled is grabbable along its outline and\n * not through its empty middle. The outline's grab width is the stroke's half-width plus\n * `tolerance`.\n *\n * A painter with no `silhouette`, or one that returns `null` for this node, reports `true` —\n * \"no opinion\" — so callers should keep their own AABB test as a pre-filter.\n */\nexport function shapeCoversPoint<TData, TPose>(\n node: Node<TData, string, TPose>,\n pose: TPose,\n x: number,\n y: number,\n opts: ShapeCoversPointOptions = {},\n): boolean {\n // A group paints nothing, so its interior is its box, which the caller's pre-filter tested.\n if (node.kind === 'group') return true;\n const sil = findShapeSilhouette(node, pose, { derivedPath: opts.derivedPath });\n if (sil === null) return true;\n const ink = findShapeInk(node, pose, { scale: opts.scale, inherited: opts.inherited }) ?? DEFAULT_INK;\n const inside = pathContainsPoint(sil, x, y);\n if (ink.filled && inside) return true;\n // The stroke reaches a different distance on each side, so which side the point is on\n // picks the reach. `tolerance` also makes a filled shape grabbable a few pixels outside\n // its edge.\n const slop = widenSlop(opts.tolerance, (inside ? ink.insetPx : ink.outsetPx) ?? 0, opts.scale);\n const { extra, opts: hit } = slopForStrokeHit(slop);\n const reach = (inside ? ink.inset : ink.outset) + extra;\n return (reach > 0 || hasSlop(slop)) && strokeHitTest(sil, x, y, reach, hit);\n}\n\n/** The current painters in evaluation order — `'high'` tier first, then `'normal'`. */\nexport function getNodeShapes(): readonly NodeShapeEntry[] {\n ensureBuiltIns();\n return [...PAINTERS.high, ...PAINTERS.normal];\n}\n\n/** Test-only: clear the registry and re-register the built-ins. */\nexport function _resetShapePaintersForTests(): void {\n PAINTERS.high.length = 0;\n PAINTERS.normal.length = 0;\n builtInsRegistered = false;\n ensureBuiltIns();\n // `registerNodeShape` already bumps, but the clearing above happens without one.\n bumpNodeMemoGeneration();\n}\n\nfunction registerBuiltInShapePainters(): void {\n registerNodeShape(TEXT_PAINTER);\n registerNodeShape(MEASURE_PAINTER);\n // Ahead of path/shape/image: a derived node whose `data` also carries a\n // `path`, `shape` or `image` means the derived path, and those three match\n // on the presence of the field alone.\n registerNodeShape(DERIVED_PAINTER);\n registerNodeShape(PATH_PAINTER);\n registerNodeShape(SHAPE_PAINTER);\n registerNodeShape(IMAGE_PAINTER);\n registerNodeShape(RECT_FALLBACK_PAINTER);\n}\n"],"mappings":"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"}
|
|
@@ -36,6 +36,7 @@ function SceneCanvasInput(p) {
|
|
|
36
36
|
props,
|
|
37
37
|
viewOn: p.viewOn,
|
|
38
38
|
selection,
|
|
39
|
+
enteredGroup: picking.enteredGroup,
|
|
39
40
|
scene,
|
|
40
41
|
adapter: picking.adapter,
|
|
41
42
|
standardActions: p.tools.standardActions,
|
|
@@ -46,6 +47,7 @@ function SceneCanvasInput(p) {
|
|
|
46
47
|
pickEvery: picking.pickEvery,
|
|
47
48
|
layerIsPainted: picking.viewLayerGate,
|
|
48
49
|
alphaOf: picking.alphaOf,
|
|
50
|
+
reachable: picking.reachable,
|
|
49
51
|
viewAnimation: p.camera.viewAnimation,
|
|
50
52
|
editAnchorsExternalState: p.pathEdit.state,
|
|
51
53
|
canvasRef: canvas.elementRef,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SceneCanvasInput.js","names":["_Fragment"],"sources":["../../../src/canvas/SceneCanvas/SceneCanvasInput.tsx"],"sourcesContent":["import type { ResizeHandleLayout } from 'interactions/actions/resize/cornerHandles';\nimport { useLatest } from '@weasel-js/react';\nimport type { Dispatcher } from '@weasel-js/routing';\nimport type { Scene } from 'core/scene/types';\nimport type { SelectionApi } from 'core/selection/useSelection';\nimport type { RuleCtx } from 'features/chrome-caps';\nimport type { Affordance } from 'affordances/types';\nimport type { PoseDescriptor } from 'interactions/actions/resize/geometry';\nimport type { UseResizeOptions } from 'interactions/actions/resize/options';\nimport { useContext, useEffect, type MutableRefObject, type RefObject } from 'react';\nimport { SnapSourceRegistryContext } from 'features/snap/registry';\nimport type { SnapOutcomeStore } from 'features/snap/outcomeStore';\nimport type { SnapSource } from 'features/snap/types';\nimport { dlog } from '../../debug/flag';\nimport { useDeviceProfile } from '../../core/device/useDeviceProfile';\nimport { useTestHook } from '../../test-hook/useTestHook';\nimport type { CanvasExtensionApi } from '../canvasExtension';\nimport { useHitObserver } from '../useHitObserver';\nimport type { CanvasViewState } from '../useCanvasView';\nimport { GeometryProjectionRegistrar, ResizePolicyRegistrar } from './poseRegistrars';\nimport { usePointerPublisher } from './PointerProviderIfRoot';\nimport type { BridgeAdapter, SceneCanvasProps } from './props';\nimport type { NodeAtPoint } from './useNodeAtPoint';\nimport type { useSceneCanvasTools } from './useSceneCanvasTools';\nimport { useSceneGestureDispatcher } from './useSceneGestureDispatcher';\nimport { useCanvasDevtoolsRoot, type CanvasDevtools } from './useCanvasDevtoolsRoot';\nimport type { useScenePicking } from './useScenePicking';\nimport {\n useSceneStandardActions, type SceneStandardActionsInputs, type StandardActionsProps,\n} from './useSceneStandardActions';\nimport { useToolKeybindings } from './useToolKeybindings';\n\ntype Props = SceneCanvasProps<unknown, string, unknown>;\ntype Picking = ReturnType<typeof useScenePicking<unknown, string, unknown>>;\n\n/** The `<SceneCanvas>` props its input wiring reads. */\nexport type SceneCanvasInputOptions = StandardActionsProps & Pick<\n Props,\n | 'selectTool' | 'geometryProjection' | 'enableGestureDispatcher' | 'enableKeybindings'\n | 'claimKeys' | 'longPress' | 'modes' | 'versionCheck' | 'onClick' | 'onDoubleClick' | 'routing'\n>;\n\n/** What `<SceneCanvas>` hands {@link SceneCanvasInput}. */\nexport interface SceneCanvasInputProps {\n props: SceneCanvasInputOptions;\n scene: Scene<unknown, string, unknown>;\n selection: SelectionApi;\n descriptor: PoseDescriptor<unknown>;\n picking: Pick<\n Picking, 'pickEvery' | 'pickBest' | 'boundsOf' | 'planeOfNode' | 'kindOfNode' | 'doubleClickNames' | 'viewLayerGate' | 'alphaOf'\n > & { adapter: BridgeAdapter };\n /** The node a hit resolves to, for the `onClick` / `onDoubleClick` observers. */\n nodeAtPointRef: MutableRefObject<NodeAtPoint | undefined>;\n tools: ReturnType<typeof useSceneCanvasTools>;\n viewOn: boolean;\n camera: { viewState: CanvasViewState; viewAnimation: SceneStandardActionsInputs['viewAnimation'] };\n dispatcher: Dispatcher;\n pathEdit: {\n state: SceneStandardActionsInputs['editAnchorsExternalState'];\n };\n chrome: { getIsVisible: () => (id: string) => boolean; getRuleCtx: () => RuleCtx | undefined };\n /** The selection overlay's rotate badge, and where the dispatcher reports the affordances\n * it hit-tests, for the slops overlay. */\n overlay: {\n rotationBadge: { distancePx: number; sizePx: number } | null | undefined;\n /** The resize-handle layout the overlay paints, so the hit-test grabs exactly those. */\n resizeHandles: ResizeHandleLayout;\n chromeAffordancesRef: MutableRefObject<readonly Affordance[]>;\n };\n canvas: {\n elementRef: MutableRefObject<HTMLElement | null>;\n apiRef: RefObject<CanvasExtensionApi | null>;\n ready: boolean;\n };\n ingestionClipboard: SceneStandardActionsInputs['ingestionClipboard'];\n /** The enabled presets' snap sources. */\n snapSources: readonly SnapSource[];\n /** The outcome store the canvas's readout layer draws. */\n snapStore: SnapOutcomeStore;\n devtools: CanvasDevtools;\n}\n\n/**\n * The canvas's input wiring: the pointer publisher, the standard actions and their deps, the\n * gesture dispatcher, and the tool keybindings, in that order, then the test hook.\n *\n * A component of its own, mounted ahead of `<SceneCanvas>`'s children, rather than hooks in the\n * canvas's body: dep sources and actions stack newest-live in effect order, and a parent's\n * effects run after its children's, so a child overriding a kit dep would lose to it.\n */\nexport function SceneCanvasInput(p: SceneCanvasInputProps) {\n const { props, scene, selection, picking, chrome, overlay, canvas } = p;\n const { viewState } = p.camera;\n const { selectTool, enableKeybindings = true } = props;\n const snapRegistry = useContext(SnapSourceRegistryContext);\n useEffect(() => {\n dlog('scene-canvas', 'mount');\n return () => dlog('scene-canvas', 'unmount');\n }, []);\n usePointerPublisher(canvas.elementRef, canvas.apiRef);\n useSceneStandardActions({\n props, viewOn: p.viewOn,\n selection, scene, adapter: picking.adapter, standardActions: p.tools.standardActions,\n currentViewRef: viewState.viewRef, onViewChange: viewState.setViewFromInput,\n poseDescriptor: p.descriptor, dispatcher: p.dispatcher,\n pickEvery: picking.pickEvery, layerIsPainted: picking.viewLayerGate, alphaOf: picking.alphaOf,\n viewAnimation: p.camera.viewAnimation, editAnchorsExternalState: p.pathEdit.state,\n canvasRef: canvas.elementRef, canvasApiRef: canvas.apiRef, ingestionClipboard: p.ingestionClipboard,\n snap: { sources: [...(props.snap?.sources ?? []), ...p.snapSources], registry: snapRegistry, store: p.snapStore },\n });\n\n // Rides the gesture dispatcher as an OBSERVER rather than an Action binding because the\n // prop is a notification, not a behavior: as a binding it would lose first-match-wins to\n // `enterPathEdit` on every body hit and silently stop firing.\n const onDoubleClick = useHitObserver(props.onDoubleClick, p.nodeAtPointRef);\n const onClick = useHitObserver(props.onClick, p.nodeAtPointRef);\n const selectionRef = useLatest(selection);\n const { targetScale } = useDeviceProfile();\n const { root, traces } = useCanvasDevtoolsRoot({\n scene, selection, viewState, tools: p.tools.tools, contributions: p.tools.contributions, routing: props.routing,\n element: canvas.elementRef, api: canvas.apiRef, devtools: p.devtools,\n });\n useSceneGestureDispatcher({\n canvasRef: canvas.elementRef, canvasApiRef: canvas.apiRef,\n tools: p.tools.tools, contributions: p.tools.contributions,\n enabled: props.enableGestureDispatcher ?? true, keyboard: enableKeybindings,\n claimKeys: props.claimKeys ?? false,\n selectionRef,\n boundsOf: picking.boundsOf, planeOfNode: picking.planeOfNode,\n pickEvery: picking.pickEvery, pickBest: picking.pickBest, kindOfNode: picking.kindOfNode,\n doubleClickNames: picking.doubleClickNames,\n viewRef: viewState.viewRef, dispatcher: p.dispatcher, traces,\n getIsVisibleForCanvas: chrome.getIsVisible, getRuleCtx: chrome.getRuleCtx,\n targetScale, handleHitRadius: overlay.resizeHandles.hitRadiusPx,\n edgeHandles: overlay.resizeHandles.edges,\n rotationBadge: overlay.rotationBadge, chromeAffordancesRef: overlay.chromeAffordancesRef,\n onDoubleClick, onClick, longPress: props.longPress,\n });\n useToolKeybindings({\n internalTools: p.tools.internal,\n toolsTakeover: p.tools.takeover ?? undefined,\n enableKeybindings,\n modes: props.modes,\n canvasApi: canvas.ready ? canvas.apiRef.current : null,\n versionCheck: props.versionCheck,\n });\n useTestHook({\n getScene: () => scene as never,\n getSelectionIds: () => (selection.current as readonly string[] | undefined) ?? [],\n getView: () => viewState.viewRef.current,\n getActiveToolId: () => p.tools.tools.active ?? null,\n probes: root.probes,\n });\n\n // Mounted only when passed: an empty default registered with the deps above would land\n // after, and over, a dep one of these registered (child effects run first). Absent\n // `geometryProjection` leaves the dep undefined.\n return (\n <>\n {selectTool?.resize\n ? <ResizePolicyRegistrar options={selectTool.resize as UseResizeOptions<unknown>} />\n : null}\n {props.geometryProjection ? <GeometryProjectionRegistrar projection={props.geometryProjection} /> : null}\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA0FA,SAAgB,iBAAiB,GAA0B;CACzD,MAAM,EAAE,OAAO,OAAO,WAAW,SAAS,QAAQ,SAAS,WAAW;CACtE,MAAM,EAAE,cAAc,EAAE;CACxB,MAAM,EAAE,YAAY,oBAAoB,SAAS;CACjD,MAAM,eAAe,WAAW,yBAAyB;CACzD,gBAAgB;EACd,KAAK,gBAAgB,OAAO;EAC5B,aAAa,KAAK,gBAAgB,SAAS;CAC7C,GAAG,CAAC,CAAC;CACL,oBAAoB,OAAO,YAAY,OAAO,MAAM;CACpD,wBAAwB;EACtB;EAAO,QAAQ,EAAE;EACjB;EAAW;EAAO,SAAS,QAAQ;EAAS,iBAAiB,EAAE,MAAM;EACrE,gBAAgB,UAAU;EAAS,cAAc,UAAU;EAC3D,gBAAgB,EAAE;EAAY,YAAY,EAAE;EAC5C,WAAW,QAAQ;EAAW,gBAAgB,QAAQ;EAAe,SAAS,QAAQ;EACtF,eAAe,EAAE,OAAO;EAAe,0BAA0B,EAAE,SAAS;EAC5E,WAAW,OAAO;EAAY,cAAc,OAAO;EAAQ,oBAAoB,EAAE;EACjF,MAAM;GAAE,SAAS,CAAC,GAAI,MAAM,MAAM,WAAW,CAAC,GAAI,GAAG,EAAE,WAAW;GAAG,UAAU;GAAc,OAAO,EAAE;EAAU;CAClH,CAAC;CAKD,MAAM,gBAAgB,eAAe,MAAM,eAAe,EAAE,cAAc;CAC1E,MAAM,UAAU,eAAe,MAAM,SAAS,EAAE,cAAc;CAC9D,MAAM,eAAe,UAAU,SAAS;CACxC,MAAM,EAAE,gBAAgB,iBAAiB;CACzC,MAAM,EAAE,MAAM,WAAW,sBAAsB;EAC7C;EAAO;EAAW;EAAW,OAAO,EAAE,MAAM;EAAO,eAAe,EAAE,MAAM;EAAe,SAAS,MAAM;EACxG,SAAS,OAAO;EAAY,KAAK,OAAO;EAAQ,UAAU,EAAE;CAC9D,CAAC;CACD,0BAA0B;EACxB,WAAW,OAAO;EAAY,cAAc,OAAO;EACnD,OAAO,EAAE,MAAM;EAAO,eAAe,EAAE,MAAM;EAC7C,SAAS,MAAM,2BAA2B;EAAM,UAAU;EAC1D,WAAW,MAAM,aAAa;EAC9B;EACA,UAAU,QAAQ;EAAU,aAAa,QAAQ;EACjD,WAAW,QAAQ;EAAW,UAAU,QAAQ;EAAU,YAAY,QAAQ;EAC9E,kBAAkB,QAAQ;EAC1B,SAAS,UAAU;EAAS,YAAY,EAAE;EAAY;EACtD,uBAAuB,OAAO;EAAc,YAAY,OAAO;EAC/D;EAAa,iBAAiB,QAAQ,cAAc;EACpD,aAAa,QAAQ,cAAc;EACnC,eAAe,QAAQ;EAAe,sBAAsB,QAAQ;EACpE;EAAe;EAAS,WAAW,MAAM;CAC3C,CAAC;CACD,mBAAmB;EACjB,eAAe,EAAE,MAAM;EACvB,eAAe,EAAE,MAAM,YAAY;EACnC;EACA,OAAO,MAAM;EACb,WAAW,OAAO,QAAQ,OAAO,OAAO,UAAU;EAClD,cAAc,MAAM;CACtB,CAAC;CACD,YAAY;EACV,gBAAgB;EAChB,uBAAwB,UAAU,WAA6C,CAAC;EAChF,eAAe,UAAU,QAAQ;EACjC,uBAAuB,EAAE,MAAM,MAAM,UAAU;EAC/C,QAAQ,KAAK;CACf,CAAC;CAKD,OACE,qBAAAA,UAAA,EAAA,UAAA,CACG,YAAY,SACT,oBAAC,uBAAD,EAAuB,SAAS,WAAW,OAAsC,CAAA,IACjF,MACH,MAAM,qBAAqB,oBAAC,6BAAD,EAA6B,YAAY,MAAM,mBAAqB,CAAA,IAAI,IACpG,EAAA,CAAA;AAEN"}
|
|
1
|
+
{"version":3,"file":"SceneCanvasInput.js","names":["_Fragment"],"sources":["../../../src/canvas/SceneCanvas/SceneCanvasInput.tsx"],"sourcesContent":["import type { ResizeHandleLayout } from 'interactions/actions/resize/cornerHandles';\nimport { useLatest } from '@weasel-js/react';\nimport type { Dispatcher } from '@weasel-js/routing';\nimport type { Scene } from 'core/scene/types';\nimport type { SelectionApi } from 'core/selection/useSelection';\nimport type { RuleCtx } from 'features/chrome-caps';\nimport type { Affordance } from 'affordances/types';\nimport type { PoseDescriptor } from 'interactions/actions/resize/geometry';\nimport type { UseResizeOptions } from 'interactions/actions/resize/options';\nimport { useContext, useEffect, type MutableRefObject, type RefObject } from 'react';\nimport { SnapSourceRegistryContext } from 'features/snap/registry';\nimport type { SnapOutcomeStore } from 'features/snap/outcomeStore';\nimport type { SnapSource } from 'features/snap/types';\nimport { dlog } from '../../debug/flag';\nimport { useDeviceProfile } from '../../core/device/useDeviceProfile';\nimport { useTestHook } from '../../test-hook/useTestHook';\nimport type { CanvasExtensionApi } from '../canvasExtension';\nimport { useHitObserver } from '../useHitObserver';\nimport type { CanvasViewState } from '../useCanvasView';\nimport { GeometryProjectionRegistrar, ResizePolicyRegistrar } from './poseRegistrars';\nimport { usePointerPublisher } from './PointerProviderIfRoot';\nimport type { BridgeAdapter, SceneCanvasProps } from './props';\nimport type { NodeAtPoint } from './useNodeAtPoint';\nimport type { useSceneCanvasTools } from './useSceneCanvasTools';\nimport { useSceneGestureDispatcher } from './useSceneGestureDispatcher';\nimport { useCanvasDevtoolsRoot, type CanvasDevtools } from './useCanvasDevtoolsRoot';\nimport type { useScenePicking } from './useScenePicking';\nimport {\n useSceneStandardActions, type SceneStandardActionsInputs, type StandardActionsProps,\n} from './useSceneStandardActions';\nimport { useToolKeybindings } from './useToolKeybindings';\n\ntype Props = SceneCanvasProps<unknown, string, unknown>;\ntype Picking = ReturnType<typeof useScenePicking<unknown, string, unknown>>;\n\n/** The `<SceneCanvas>` props its input wiring reads. */\nexport type SceneCanvasInputOptions = StandardActionsProps & Pick<\n Props,\n | 'selectTool' | 'geometryProjection' | 'enableGestureDispatcher' | 'enableKeybindings'\n | 'claimKeys' | 'longPress' | 'modes' | 'versionCheck' | 'onClick' | 'onDoubleClick' | 'routing'\n>;\n\n/** What `<SceneCanvas>` hands {@link SceneCanvasInput}. */\nexport interface SceneCanvasInputProps {\n props: SceneCanvasInputOptions;\n scene: Scene<unknown, string, unknown>;\n selection: SelectionApi;\n descriptor: PoseDescriptor<unknown>;\n picking: Pick<\n Picking, 'pickEvery' | 'pickBest' | 'boundsOf' | 'planeOfNode' | 'kindOfNode' | 'doubleClickNames' | 'viewLayerGate' | 'alphaOf' | 'enteredGroup' | 'reachable'\n > & { adapter: BridgeAdapter };\n /** The node a hit resolves to, for the `onClick` / `onDoubleClick` observers. */\n nodeAtPointRef: MutableRefObject<NodeAtPoint | undefined>;\n tools: ReturnType<typeof useSceneCanvasTools>;\n viewOn: boolean;\n camera: { viewState: CanvasViewState; viewAnimation: SceneStandardActionsInputs['viewAnimation'] };\n dispatcher: Dispatcher;\n pathEdit: {\n state: SceneStandardActionsInputs['editAnchorsExternalState'];\n };\n chrome: { getIsVisible: () => (id: string) => boolean; getRuleCtx: () => RuleCtx | undefined };\n /** The selection overlay's rotate badge, and where the dispatcher reports the affordances\n * it hit-tests, for the slops overlay. */\n overlay: {\n rotationBadge: { distancePx: number; sizePx: number } | null | undefined;\n /** The resize-handle layout the overlay paints, so the hit-test grabs exactly those. */\n resizeHandles: ResizeHandleLayout;\n chromeAffordancesRef: MutableRefObject<readonly Affordance[]>;\n };\n canvas: {\n elementRef: MutableRefObject<HTMLElement | null>;\n apiRef: RefObject<CanvasExtensionApi | null>;\n ready: boolean;\n };\n ingestionClipboard: SceneStandardActionsInputs['ingestionClipboard'];\n /** The enabled presets' snap sources. */\n snapSources: readonly SnapSource[];\n /** The outcome store the canvas's readout layer draws. */\n snapStore: SnapOutcomeStore;\n devtools: CanvasDevtools;\n}\n\n/**\n * The canvas's input wiring: the pointer publisher, the standard actions and their deps, the\n * gesture dispatcher, and the tool keybindings, in that order, then the test hook.\n *\n * A component of its own, mounted ahead of `<SceneCanvas>`'s children, rather than hooks in the\n * canvas's body: dep sources and actions stack newest-live in effect order, and a parent's\n * effects run after its children's, so a child overriding a kit dep would lose to it.\n */\nexport function SceneCanvasInput(p: SceneCanvasInputProps) {\n const { props, scene, selection, picking, chrome, overlay, canvas } = p;\n const { viewState } = p.camera;\n const { selectTool, enableKeybindings = true } = props;\n const snapRegistry = useContext(SnapSourceRegistryContext);\n useEffect(() => {\n dlog('scene-canvas', 'mount');\n return () => dlog('scene-canvas', 'unmount');\n }, []);\n usePointerPublisher(canvas.elementRef, canvas.apiRef);\n useSceneStandardActions({\n props, viewOn: p.viewOn,\n selection, enteredGroup: picking.enteredGroup, scene, adapter: picking.adapter, standardActions: p.tools.standardActions,\n currentViewRef: viewState.viewRef, onViewChange: viewState.setViewFromInput,\n poseDescriptor: p.descriptor, dispatcher: p.dispatcher,\n pickEvery: picking.pickEvery, layerIsPainted: picking.viewLayerGate, alphaOf: picking.alphaOf, reachable: picking.reachable,\n viewAnimation: p.camera.viewAnimation, editAnchorsExternalState: p.pathEdit.state,\n canvasRef: canvas.elementRef, canvasApiRef: canvas.apiRef, ingestionClipboard: p.ingestionClipboard,\n snap: { sources: [...(props.snap?.sources ?? []), ...p.snapSources], registry: snapRegistry, store: p.snapStore },\n });\n\n // Rides the gesture dispatcher as an OBSERVER rather than an Action binding because the\n // prop is a notification, not a behavior: as a binding it would lose first-match-wins to\n // `enterPathEdit` on every body hit and silently stop firing.\n const onDoubleClick = useHitObserver(props.onDoubleClick, p.nodeAtPointRef);\n const onClick = useHitObserver(props.onClick, p.nodeAtPointRef);\n const selectionRef = useLatest(selection);\n const { targetScale } = useDeviceProfile();\n const { root, traces } = useCanvasDevtoolsRoot({\n scene, selection, viewState, tools: p.tools.tools, contributions: p.tools.contributions, routing: props.routing,\n element: canvas.elementRef, api: canvas.apiRef, devtools: p.devtools,\n });\n useSceneGestureDispatcher({\n canvasRef: canvas.elementRef, canvasApiRef: canvas.apiRef,\n tools: p.tools.tools, contributions: p.tools.contributions,\n enabled: props.enableGestureDispatcher ?? true, keyboard: enableKeybindings,\n claimKeys: props.claimKeys ?? false,\n selectionRef,\n boundsOf: picking.boundsOf, planeOfNode: picking.planeOfNode,\n pickEvery: picking.pickEvery, pickBest: picking.pickBest, kindOfNode: picking.kindOfNode,\n doubleClickNames: picking.doubleClickNames,\n viewRef: viewState.viewRef, dispatcher: p.dispatcher, traces,\n getIsVisibleForCanvas: chrome.getIsVisible, getRuleCtx: chrome.getRuleCtx,\n targetScale, handleHitRadius: overlay.resizeHandles.hitRadiusPx,\n edgeHandles: overlay.resizeHandles.edges,\n rotationBadge: overlay.rotationBadge, chromeAffordancesRef: overlay.chromeAffordancesRef,\n onDoubleClick, onClick, longPress: props.longPress,\n });\n useToolKeybindings({\n internalTools: p.tools.internal,\n toolsTakeover: p.tools.takeover ?? undefined,\n enableKeybindings,\n modes: props.modes,\n canvasApi: canvas.ready ? canvas.apiRef.current : null,\n versionCheck: props.versionCheck,\n });\n useTestHook({\n getScene: () => scene as never,\n getSelectionIds: () => (selection.current as readonly string[] | undefined) ?? [],\n getView: () => viewState.viewRef.current,\n getActiveToolId: () => p.tools.tools.active ?? null,\n probes: root.probes,\n });\n\n // Mounted only when passed: an empty default registered with the deps above would land\n // after, and over, a dep one of these registered (child effects run first). Absent\n // `geometryProjection` leaves the dep undefined.\n return (\n <>\n {selectTool?.resize\n ? <ResizePolicyRegistrar options={selectTool.resize as UseResizeOptions<unknown>} />\n : null}\n {props.geometryProjection ? <GeometryProjectionRegistrar projection={props.geometryProjection} /> : null}\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA0FA,SAAgB,iBAAiB,GAA0B;CACzD,MAAM,EAAE,OAAO,OAAO,WAAW,SAAS,QAAQ,SAAS,WAAW;CACtE,MAAM,EAAE,cAAc,EAAE;CACxB,MAAM,EAAE,YAAY,oBAAoB,SAAS;CACjD,MAAM,eAAe,WAAW,yBAAyB;CACzD,gBAAgB;EACd,KAAK,gBAAgB,OAAO;EAC5B,aAAa,KAAK,gBAAgB,SAAS;CAC7C,GAAG,CAAC,CAAC;CACL,oBAAoB,OAAO,YAAY,OAAO,MAAM;CACpD,wBAAwB;EACtB;EAAO,QAAQ,EAAE;EACjB;EAAW,cAAc,QAAQ;EAAc;EAAO,SAAS,QAAQ;EAAS,iBAAiB,EAAE,MAAM;EACzG,gBAAgB,UAAU;EAAS,cAAc,UAAU;EAC3D,gBAAgB,EAAE;EAAY,YAAY,EAAE;EAC5C,WAAW,QAAQ;EAAW,gBAAgB,QAAQ;EAAe,SAAS,QAAQ;EAAS,WAAW,QAAQ;EAClH,eAAe,EAAE,OAAO;EAAe,0BAA0B,EAAE,SAAS;EAC5E,WAAW,OAAO;EAAY,cAAc,OAAO;EAAQ,oBAAoB,EAAE;EACjF,MAAM;GAAE,SAAS,CAAC,GAAI,MAAM,MAAM,WAAW,CAAC,GAAI,GAAG,EAAE,WAAW;GAAG,UAAU;GAAc,OAAO,EAAE;EAAU;CAClH,CAAC;CAKD,MAAM,gBAAgB,eAAe,MAAM,eAAe,EAAE,cAAc;CAC1E,MAAM,UAAU,eAAe,MAAM,SAAS,EAAE,cAAc;CAC9D,MAAM,eAAe,UAAU,SAAS;CACxC,MAAM,EAAE,gBAAgB,iBAAiB;CACzC,MAAM,EAAE,MAAM,WAAW,sBAAsB;EAC7C;EAAO;EAAW;EAAW,OAAO,EAAE,MAAM;EAAO,eAAe,EAAE,MAAM;EAAe,SAAS,MAAM;EACxG,SAAS,OAAO;EAAY,KAAK,OAAO;EAAQ,UAAU,EAAE;CAC9D,CAAC;CACD,0BAA0B;EACxB,WAAW,OAAO;EAAY,cAAc,OAAO;EACnD,OAAO,EAAE,MAAM;EAAO,eAAe,EAAE,MAAM;EAC7C,SAAS,MAAM,2BAA2B;EAAM,UAAU;EAC1D,WAAW,MAAM,aAAa;EAC9B;EACA,UAAU,QAAQ;EAAU,aAAa,QAAQ;EACjD,WAAW,QAAQ;EAAW,UAAU,QAAQ;EAAU,YAAY,QAAQ;EAC9E,kBAAkB,QAAQ;EAC1B,SAAS,UAAU;EAAS,YAAY,EAAE;EAAY;EACtD,uBAAuB,OAAO;EAAc,YAAY,OAAO;EAC/D;EAAa,iBAAiB,QAAQ,cAAc;EACpD,aAAa,QAAQ,cAAc;EACnC,eAAe,QAAQ;EAAe,sBAAsB,QAAQ;EACpE;EAAe;EAAS,WAAW,MAAM;CAC3C,CAAC;CACD,mBAAmB;EACjB,eAAe,EAAE,MAAM;EACvB,eAAe,EAAE,MAAM,YAAY;EACnC;EACA,OAAO,MAAM;EACb,WAAW,OAAO,QAAQ,OAAO,OAAO,UAAU;EAClD,cAAc,MAAM;CACtB,CAAC;CACD,YAAY;EACV,gBAAgB;EAChB,uBAAwB,UAAU,WAA6C,CAAC;EAChF,eAAe,UAAU,QAAQ;EACjC,uBAAuB,EAAE,MAAM,MAAM,UAAU;EAC/C,QAAQ,KAAK;CACf,CAAC;CAKD,OACE,qBAAAA,UAAA,EAAA,UAAA,CACG,YAAY,SACT,oBAAC,uBAAD,EAAuB,SAAS,WAAW,OAAsC,CAAA,IACjF,MACH,MAAM,qBAAqB,oBAAC,6BAAD,EAA6B,YAAY,MAAM,mBAAqB,CAAA,IAAI,IACpG,EAAA,CAAA;AAEN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canvasPassThrough.js","names":[],"sources":["../../../src/canvas/SceneCanvas/canvasPassThrough.ts"],"sourcesContent":["import type { SceneCanvasProps } from './props';\n\ntype Props = SceneCanvasProps<unknown, string, unknown>;\n\n/** Every prop `<SceneCanvas>` reads itself instead of handing to `<Canvas>`. */\nconst OWN_PROPS = [\n 'scene', 'geometry', 'poseDescriptor', 'selectTool', 'insertNodeFactories', 'insertPaint',\n 'ingestion', 'layoutDropTarget', 'reflowTransition', 'poseTransition', 'geometryProjection', 'routing',\n 'selection', 'selectionOptions', 'selectable', 'tools', 'features', 'enableKeybindings',\n 'claimKeys', 'enableGestureDispatcher', 'onToolsCreated', 'defaultTools', 'toolOptions',\n 'initialActiveTool', 'ambient', 'versionCheck', 'longPress', 'viewport', 'layers', 'actions',\n 'tune', 'bindingOverrides', 'describeKind', 'animator', 'views', 'children', 'debug', 'alphaFor', 'layerVisibility',\n 'layerOrder', 'isPointerInteractive', '
|
|
1
|
+
{"version":3,"file":"canvasPassThrough.js","names":[],"sources":["../../../src/canvas/SceneCanvas/canvasPassThrough.ts"],"sourcesContent":["import type { SceneCanvasProps } from './props';\n\ntype Props = SceneCanvasProps<unknown, string, unknown>;\n\n/** Every prop `<SceneCanvas>` reads itself instead of handing to `<Canvas>`. */\nconst OWN_PROPS = [\n 'scene', 'geometry', 'poseDescriptor', 'selectTool', 'insertNodeFactories', 'insertPaint',\n 'ingestion', 'layoutDropTarget', 'reflowTransition', 'poseTransition', 'geometryProjection', 'routing',\n 'selection', 'selectionOptions', 'selectable', 'tools', 'features', 'enableKeybindings',\n 'claimKeys', 'enableGestureDispatcher', 'onToolsCreated', 'defaultTools', 'toolOptions',\n 'initialActiveTool', 'ambient', 'versionCheck', 'longPress', 'viewport', 'layers', 'actions',\n 'tune', 'bindingOverrides', 'describeKind', 'animator', 'views', 'children', 'debug', 'alphaFor', 'layerVisibility',\n 'layerOrder', 'isPointerInteractive', 'enteredGroup', 'onDoubleClick', 'onClick', 'onHover', 'chromeVisibility', 'modes',\n 'pathEdit', 'defaultPathEdit', 'getFocused', 'cursorCoordsHud', 'pickHud', 'modalityHud', 'view',\n 'onViewChange', 'defaultView', 'viewBounds', 'redrawOn', 'snap',\n] as const satisfies readonly (keyof Props)[];\n\n/** The props `<SceneCanvas>` passes through to its `<Canvas>`: all but its own. */\nexport function canvasPassThrough<P extends object>(props: P): Omit<P, (typeof OWN_PROPS)[number] | 'presetSource'> {\n const rest = { ...props } as Record<string, unknown>;\n for (const key of OWN_PROPS) delete rest[key];\n delete rest.presetSource;\n return rest as Omit<P, (typeof OWN_PROPS)[number] | 'presetSource'>;\n}\n"],"mappings":";;AAKA,IAAM,YAAY;CAChB;CAAS;CAAY;CAAkB;CAAc;CAAuB;CAC5E;CAAa;CAAoB;CAAoB;CAAkB;CAAsB;CAC7F;CAAa;CAAoB;CAAc;CAAS;CAAY;CACpE;CAAa;CAA2B;CAAkB;CAAgB;CAC1E;CAAqB;CAAW;CAAgB;CAAa;CAAY;CAAU;CACnF;CAAQ;CAAoB;CAAgB;CAAY;CAAS;CAAY;CAAS;CAAY;CAClG;CAAc;CAAwB;CAAgB;CAAiB;CAAW;CAAW;CAAoB;CACjH;CAAY;CAAmB;CAAc;CAAmB;CAAW;CAAe;CAC1F;CAAgB;CAAe;CAAc;CAAY;AAC3D;;AAGA,SAAgB,kBAAoC,OAAgE;CAClH,MAAM,OAAO,EAAE,GAAG,MAAM;CACxB,KAAK,MAAM,OAAO,WAAW,OAAO,KAAK;CACzC,OAAO,KAAK;CACZ,OAAO;AACT"}
|
|
@@ -5,11 +5,11 @@ import { isTextData } from "@weasel-js/text";
|
|
|
5
5
|
function isObj(d) {
|
|
6
6
|
return typeof d === "object" && d !== null;
|
|
7
7
|
}
|
|
8
|
-
/** Routes a
|
|
8
|
+
/** Routes a group node as `'group'`, whatever its data holds. `inferredNodeRouting` leads
|
|
9
9
|
* with it; spread it ahead of `defaultNodeRouting`, which is the shape-kind table alone. */
|
|
10
10
|
var groupNodeRouting = {
|
|
11
11
|
name: "group",
|
|
12
|
-
matches: (_data, node) => node?.kind === "
|
|
12
|
+
matches: (_data, node) => node?.kind === "group"
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
15
|
* Routing classifiers for the kit's built-in shape kinds
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultNodeRouting.js","names":[],"sources":["../../../src/canvas/SceneCanvas/defaultNodeRouting.ts"],"sourcesContent":["import { KIT_SHAPE_KINDS } from 'core/shapeKinds';\nimport type { NodeRoutingEntry } from 'core/scene/NodeRouting';\nimport { isTextData } from '@weasel-js/text';\n\nfunction isObj(d: unknown): d is Record<string, unknown> {\n return typeof d === 'object' && d !== null;\n}\n\n/** Routes a
|
|
1
|
+
{"version":3,"file":"defaultNodeRouting.js","names":[],"sources":["../../../src/canvas/SceneCanvas/defaultNodeRouting.ts"],"sourcesContent":["import { KIT_SHAPE_KINDS } from 'core/shapeKinds';\nimport type { NodeRoutingEntry } from 'core/scene/NodeRouting';\nimport { isTextData } from '@weasel-js/text';\n\nfunction isObj(d: unknown): d is Record<string, unknown> {\n return typeof d === 'object' && d !== null;\n}\n\n/** Routes a group node as `'group'`, whatever its data holds. `inferredNodeRouting` leads\n * with it; spread it ahead of `defaultNodeRouting`, which is the shape-kind table alone. */\nexport const groupNodeRouting: NodeRoutingEntry = {\n name: 'group',\n matches: (_data, node) => node?.kind === 'group',\n};\n\n/**\n * Routing classifiers for the kit's built-in shape kinds\n * (`KIT_SHAPE_KINDS`): each entry matches `data.kind === '<name>'`. Routing\n * kinds and shape kinds are independent — `'group'` has no shape painter.\n *\n * Spread it into `<SceneCanvas routing={...}>` when scene data carries a\n * `kind` tag. Data with no `kind` that follows the kit's common shapes\n * (`{ path }`, `{ text }`, `{ image }`) wants `inferredNodeRouting`, which\n * SceneCanvas applies when `routing` is unset.\n */\nexport const defaultNodeRouting: readonly NodeRoutingEntry[] = KIT_SHAPE_KINDS.map(\n (name) => ({\n name,\n matches: (data) =>\n isObj(data) &&\n (data as { kind?: unknown }).kind === name,\n }),\n);\n\n/**\n * Routing classifiers used when a consumer doesn't pass `routing` to\n * `<SceneCanvas>`, keyed on the data's shape rather than a `data.kind` tag.\n *\n * Order matters: `'text'` beats `'path'` so an SVG-imported text node\n * carrying a fallback `path` routes to text-edit.\n */\nexport const inferredNodeRouting: readonly NodeRoutingEntry[] = [\n groupNodeRouting,\n { name: 'text', matches: isTextData },\n { name: 'path', matches: (d) => isObj(d) && d.path != null },\n { name: 'image', matches: (d) => isObj(d) && d.image != null },\n];\n"],"mappings":";;;;AAIA,SAAS,MAAM,GAA0C;CACvD,OAAO,OAAO,MAAM,YAAY,MAAM;AACxC;;;AAIA,IAAa,mBAAqC;CAChD,MAAM;CACN,UAAU,OAAO,SAAS,MAAM,SAAS;AAC3C;;;;;;;;;;;AAYA,IAAa,qBAAkD,gBAAgB,KAC5E,UAAU;CACT;CACA,UAAU,SACR,MAAM,IAAI,KACT,KAA4B,SAAS;AAC1C,EACF;;;;;;;;AASA,IAAa,sBAAmD;CAC9D;CACA;EAAE,MAAM;EAAQ,SAAS;CAAW;CACpC;EAAE,MAAM;EAAQ,UAAU,MAAM,MAAM,CAAC,KAAK,EAAE,QAAQ;CAAK;CAC3D;EAAE,MAAM;EAAS,UAAU,MAAM,MAAM,CAAC,KAAK,EAAE,SAAS;CAAK;AAC/D"}
|
|
@@ -8,7 +8,11 @@ import { applyToPoint, meanScale, pathContainsPoint } from "@weasel-js/geom";
|
|
|
8
8
|
* `pickTolerancePx` of screen slop, refined to the painter's ink when
|
|
9
9
|
* `shapePicking` is on. */
|
|
10
10
|
function scenePointQuery(d, shapePicking, pickTolerancePx) {
|
|
11
|
-
const pointQuery = (px, py, s) => {
|
|
11
|
+
const pointQuery = (px, py, s) => ({
|
|
12
|
+
...bareQuery(px, py, s),
|
|
13
|
+
broad: pointBroad(px, py, s, pickTolerancePx)
|
|
14
|
+
});
|
|
15
|
+
const bareQuery = (px, py, s) => {
|
|
12
16
|
const scale = meanScale(s);
|
|
13
17
|
const tolerance = {
|
|
14
18
|
px: pickTolerancePx,
|
|
@@ -47,7 +51,7 @@ function scenePointQuery(d, shapePicking, pickTolerancePx) {
|
|
|
47
51
|
inCopy: (m) => {
|
|
48
52
|
const [x, y] = applyToPoint(m, px, py);
|
|
49
53
|
const k = Math.sqrt(Math.abs(m[0] * m[3] - m[1] * m[2]));
|
|
50
|
-
return
|
|
54
|
+
return bareQuery(x, y, {
|
|
51
55
|
x: s.x / k,
|
|
52
56
|
y: s.y / k
|
|
53
57
|
});
|
|
@@ -56,6 +60,20 @@ function scenePointQuery(d, shapePicking, pickTolerancePx) {
|
|
|
56
60
|
};
|
|
57
61
|
return pointQuery;
|
|
58
62
|
}
|
|
63
|
+
/** The world box the point query's slop reaches, on the least-scaled axis. */
|
|
64
|
+
function pointBroad(px, py, s, tolerancePx) {
|
|
65
|
+
const least = Math.min(Math.abs(s.x), Math.abs(s.y));
|
|
66
|
+
const r = tolerancePx / least;
|
|
67
|
+
return {
|
|
68
|
+
box: {
|
|
69
|
+
x: px - r,
|
|
70
|
+
y: py - r,
|
|
71
|
+
width: 2 * r,
|
|
72
|
+
height: 2 * r
|
|
73
|
+
},
|
|
74
|
+
pxPerWorld: least
|
|
75
|
+
};
|
|
76
|
+
}
|
|
59
77
|
|
|
60
78
|
//#endregion
|
|
61
79
|
export { scenePointQuery };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scenePointQuery.js","names":[],"sources":["../../../src/canvas/SceneCanvas/scenePointQuery.ts"],"sourcesContent":["import { applyToPoint, meanScale, pathContainsPoint } from '@weasel-js/geom';\nimport type { PickQuery } from 'canvas/pickWalk';\nimport { findShapeInk, shapeCoversPoint } from 'canvas/NodeShape';\nimport { toPlane } from 'core/viewport/parallax';\nimport type { PoseDescriptor } from 'interactions/actions/resize/geometry';\nimport { poseContains, poseContainsRotated } from './poseGeometry';\n\n/** The point query `<SceneCanvas>`'s default pick asks: a world point with\n * `pickTolerancePx` of screen slop, refined to the painter's ink when\n * `shapePicking` is on. */\nexport function scenePointQuery<TPose>(\n d: PoseDescriptor<unknown>,\n shapePicking: boolean,\n pickTolerancePx: number,\n): (px: number, py: number, s: { x: number; y: number }) => PickQuery<TPose> {\n // `s` makes the slop a screen distance, so the grab zone stays the same\n // apparent thickness at any zoom and on every axis. A `{ px }` stroke's\n // reach is on screen too, and joins the slop there.\n const pointQuery = (px: number, py: number, s: { x: number; y: number }): PickQuery<TPose> => {\n const scale = meanScale(s);\n const tolerance = { px: pickTolerancePx, scale: s };\n return {\n hits: (n, pose, derived, inherited) => {\n // The pre-filter has to be at least as generous as the refinement\n // that follows it, or it rejects points the refinement would have\n // claimed. A stroke reaches past the pose box by `outset` — a whole\n // stroke width for an outer align — on top of the pointer slop.\n const ink = shapePicking ? findShapeInk(n as never, pose, { scale, inherited }) : null;\n // A derived node's pose is a placeholder — typically zero-sized at\n // the origin — so its own box rejects every point the path covers.\n // The path is the region to test instead, and `poseContains` already\n // reads a path-like pose as one.\n const slop = { ...tolerance, px: tolerance.px + (ink?.outsetPx ?? 0), reach: ink?.outset ?? 0 };\n const admitted = derived\n ? poseContains(derived as never, px, py, slop, d as PoseDescriptor<unknown>)\n : poseContainsRotated(pose, px, py, slop, d as PoseDescriptor<unknown>);\n if (!admitted) return false;\n // `shapeCoversPoint` narrows the rect to the ink the painter actually\n // lays down (and answers `true` for painters that have no silhouette,\n // so nothing becomes unpickable).\n return !shapePicking\n || shapeCoversPoint(n as never, pose, px, py, {\n tolerance, scale, derivedPath: derived, inherited,\n });\n },\n clipAdmits: (clip) => pathContainsPoint(clip, px, py),\n inPlane: (m) => {\n const p = toPlane(m, { x: px, y: py });\n return pointQuery(p.x, p.y, { x: s.x / m.scale.x, y: s.y / m.scale.y });\n },\n inCopy: (m) => {\n const [x, y] = applyToPoint(m, px, py);\n const k = Math.sqrt(Math.abs(m[0] * m[3] - m[1] * m[2]));\n return
|
|
1
|
+
{"version":3,"file":"scenePointQuery.js","names":[],"sources":["../../../src/canvas/SceneCanvas/scenePointQuery.ts"],"sourcesContent":["import { applyToPoint, meanScale, pathContainsPoint } from '@weasel-js/geom';\nimport type { PickBroad, PickQuery } from 'canvas/pickWalk';\nimport { findShapeInk, shapeCoversPoint } from 'canvas/NodeShape';\nimport { toPlane } from 'core/viewport/parallax';\nimport type { PoseDescriptor } from 'interactions/actions/resize/geometry';\nimport { poseContains, poseContainsRotated } from './poseGeometry';\n\n/** The point query `<SceneCanvas>`'s default pick asks: a world point with\n * `pickTolerancePx` of screen slop, refined to the painter's ink when\n * `shapePicking` is on. */\nexport function scenePointQuery<TPose>(\n d: PoseDescriptor<unknown>,\n shapePicking: boolean,\n pickTolerancePx: number,\n): (px: number, py: number, s: { x: number; y: number }) => PickQuery<TPose> {\n // `s` makes the slop a screen distance, so the grab zone stays the same\n // apparent thickness at any zoom and on every axis. A `{ px }` stroke's\n // reach is on screen too, and joins the slop there.\n const pointQuery = (px: number, py: number, s: { x: number; y: number }): PickQuery<TPose> =>\n ({ ...bareQuery(px, py, s), broad: pointBroad(px, py, s, pickTolerancePx) });\n // A copy is tested by every walk, so the query carried into one asks no index.\n const bareQuery = (px: number, py: number, s: { x: number; y: number }): PickQuery<TPose> => {\n const scale = meanScale(s);\n const tolerance = { px: pickTolerancePx, scale: s };\n return {\n hits: (n, pose, derived, inherited) => {\n // The pre-filter has to be at least as generous as the refinement\n // that follows it, or it rejects points the refinement would have\n // claimed. A stroke reaches past the pose box by `outset` — a whole\n // stroke width for an outer align — on top of the pointer slop.\n const ink = shapePicking ? findShapeInk(n as never, pose, { scale, inherited }) : null;\n // A derived node's pose is a placeholder — typically zero-sized at\n // the origin — so its own box rejects every point the path covers.\n // The path is the region to test instead, and `poseContains` already\n // reads a path-like pose as one.\n const slop = { ...tolerance, px: tolerance.px + (ink?.outsetPx ?? 0), reach: ink?.outset ?? 0 };\n const admitted = derived\n ? poseContains(derived as never, px, py, slop, d as PoseDescriptor<unknown>)\n : poseContainsRotated(pose, px, py, slop, d as PoseDescriptor<unknown>);\n if (!admitted) return false;\n // `shapeCoversPoint` narrows the rect to the ink the painter actually\n // lays down (and answers `true` for painters that have no silhouette,\n // so nothing becomes unpickable).\n return !shapePicking\n || shapeCoversPoint(n as never, pose, px, py, {\n tolerance, scale, derivedPath: derived, inherited,\n });\n },\n clipAdmits: (clip) => pathContainsPoint(clip, px, py),\n inPlane: (m) => {\n const p = toPlane(m, { x: px, y: py });\n return pointQuery(p.x, p.y, { x: s.x / m.scale.x, y: s.y / m.scale.y });\n },\n inCopy: (m) => {\n const [x, y] = applyToPoint(m, px, py);\n const k = Math.sqrt(Math.abs(m[0] * m[3] - m[1] * m[2]));\n return bareQuery(x, y, { x: s.x / k, y: s.y / k });\n },\n };\n };\n return pointQuery;\n}\n\n/** The world box the point query's slop reaches, on the least-scaled axis. */\nfunction pointBroad(px: number, py: number, s: { x: number; y: number }, tolerancePx: number): PickBroad {\n const least = Math.min(Math.abs(s.x), Math.abs(s.y));\n const r = tolerancePx / least;\n return { box: { x: px - r, y: py - r, width: 2 * r, height: 2 * r }, pxPerWorld: least };\n}\n"],"mappings":";;;;;;;;;AAUA,SAAgB,gBACd,GACA,cACA,iBAC2E;CAI3E,MAAM,cAAc,IAAY,IAAY,OACzC;EAAE,GAAG,UAAU,IAAI,IAAI,CAAC;EAAG,OAAO,WAAW,IAAI,IAAI,GAAG,eAAe;CAAE;CAE5E,MAAM,aAAa,IAAY,IAAY,MAAkD;EAC3F,MAAM,QAAQ,UAAU,CAAC;EACzB,MAAM,YAAY;GAAE,IAAI;GAAiB,OAAO;EAAE;EAClD,OAAO;GACL,OAAO,GAAG,MAAM,SAAS,cAAc;IAKrC,MAAM,MAAM,eAAe,aAAa,GAAY,MAAM;KAAE;KAAO;IAAU,CAAC,IAAI;IAKlF,MAAM,OAAO;KAAE,GAAG;KAAW,IAAI,UAAU,MAAM,KAAK,YAAY;KAAI,OAAO,KAAK,UAAU;IAAE;IAI9F,IAAI,EAHa,UACb,aAAa,SAAkB,IAAI,IAAI,MAAM,CAA4B,IACzE,oBAAoB,MAAM,IAAI,IAAI,MAAM,CAA4B,IACzD,OAAO;IAItB,OAAO,CAAC,gBACH,iBAAiB,GAAY,MAAM,IAAI,IAAI;KAC5C;KAAW;KAAO,aAAa;KAAS;IAC1C,CAAC;GACL;GACA,aAAa,SAAS,kBAAkB,MAAM,IAAI,EAAE;GACpD,UAAU,MAAM;IACd,MAAM,IAAI,QAAQ,GAAG;KAAE,GAAG;KAAI,GAAG;IAAG,CAAC;IACrC,OAAO,WAAW,EAAE,GAAG,EAAE,GAAG;KAAE,GAAG,EAAE,IAAI,EAAE,MAAM;KAAG,GAAG,EAAE,IAAI,EAAE,MAAM;IAAE,CAAC;GACxE;GACA,SAAS,MAAM;IACb,MAAM,CAAC,GAAG,KAAK,aAAa,GAAG,IAAI,EAAE;IACrC,MAAM,IAAI,KAAK,KAAK,KAAK,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC;IACvD,OAAO,UAAU,GAAG,GAAG;KAAE,GAAG,EAAE,IAAI;KAAG,GAAG,EAAE,IAAI;IAAE,CAAC;GACnD;EACF;CACF;CACA,OAAO;AACT;;AAGA,SAAS,WAAW,IAAY,IAAY,GAA6B,aAAgC;CACvG,MAAM,QAAQ,KAAK,IAAI,KAAK,IAAI,EAAE,CAAC,GAAG,KAAK,IAAI,EAAE,CAAC,CAAC;CACnD,MAAM,IAAI,cAAc;CACxB,OAAO;EAAE,KAAK;GAAE,GAAG,KAAK;GAAG,GAAG,KAAK;GAAG,OAAO,IAAI;GAAG,QAAQ,IAAI;EAAE;EAAG,YAAY;CAAM;AACzF"}
|
|
@@ -55,13 +55,16 @@ function useCanvasTools(args) {
|
|
|
55
55
|
const pressFeedback = feedbackOpt === true ? defaultPressFeedback : feedbackOpt || null;
|
|
56
56
|
const defaultMarkerDrag = useMemo(() => createViewMarkerContribution(), []);
|
|
57
57
|
const markerDrag = args.actions === null ? null : defaultMarkerDrag;
|
|
58
|
+
const groupEntry = args.actions === null ? null : args.groupEntry;
|
|
58
59
|
const mergedAmbient = useMemo(() => [
|
|
59
60
|
...presetContributions(enabled),
|
|
61
|
+
...groupEntry ? [groupEntry] : [],
|
|
60
62
|
...ambient ?? [],
|
|
61
63
|
...pressFeedback ? [pressFeedback] : [],
|
|
62
64
|
...markerDrag ? [markerDrag] : []
|
|
63
65
|
], [
|
|
64
66
|
enabled,
|
|
67
|
+
groupEntry,
|
|
65
68
|
ambient,
|
|
66
69
|
pressFeedback,
|
|
67
70
|
markerDrag
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCanvasTools.js","names":[],"sources":["../../../src/canvas/SceneCanvas/useCanvasTools.ts"],"sourcesContent":["import { useEffect, useMemo } from 'react';\nimport { useLatest } from '@weasel-js/react';\nimport type { Action } from '@weasel-js/routing';\nimport { createLongPressFeedbackContribution } from '../../features/longPress/longPressFeedback';\nimport { createViewMarkerContribution } from '../../features/viewports/viewMarkerDrag';\nimport { useTools, type Contribution, type Tool, type ToolsApi } from '../../tools/overlayBinding';\nimport {\n presetActions,\n presetAmbient,\n presetContributions,\n resolveFeatures,\n type EnabledPresets,\n type FeatureBindingOptions,\n type FeatureEntry,\n type NamedPresets,\n} from './features';\nimport type { SceneCanvasProps } from './props';\nimport type { ToolsPatch } from './toolRegistry';\nimport { useBuiltinTools } from './useBuiltinTools';\n\ntype Props = SceneCanvasProps<unknown, string, unknown>;\n\n/** Discriminate the polymorphic `tools` prop: `ToolsApi` has `setActive`\n * / `active` / `registry`; the patch record shape has none of those. */\nfunction isToolsApi(tools: ToolsApi | ToolsPatch): tools is ToolsApi {\n return typeof (tools as ToolsApi).setActive === 'function';\n}\n\nconst presetSerials = new WeakMap<object, number>();\nlet nextSerial = 0;\nconst entryKey = (e: FeatureEntry): string => {\n if (typeof e === 'string') return e;\n let n = presetSerials.get(e);\n if (n === undefined) presetSerials.set(e, (n = nextSerial++));\n return `#${n}`;\n};\n\n/** The presets a canvas runs with. Keyed on the entries, not the array, so\n * an inline `features={['draw', pathTools]}` does not re-derive every render. */\nexport function useEnabledFeatures(\n features: readonly FeatureEntry[] | undefined,\n named: NamedPresets | null,\n hasViewport: boolean,\n selectRotates: boolean,\n): EnabledPresets {\n const featuresKey = (features ?? []).map(entryKey).join('|');\n return useMemo(\n () => resolveFeatures(features, named, { viewport: hasViewport, selectRotates }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [featuresKey, named, hasViewport, selectRotates],\n );\n}\n\n/**\n * The canvas's tools: a caller's own `ToolsApi` when the `tools` prop is one\n * (the takeover form), and otherwise the built-ins the presets and\n * `defaultTools` name, patched by a `tools` record.\n */\nexport function useCanvasTools(args: {\n /** The canvas's select tool, which is built from its scene and pickers. */\n select: Tool;\n enabled: EnabledPresets;\n tools: Props['tools'];\n defaultTools: Props['defaultTools'];\n toolOptions: Props['toolOptions'];\n /** `viewport.inertia`, which is the hand tool's. */\n inertia: NonNullable<Props['viewport']>['inertia'];\n ambient: Props['ambient'];\n /** `null` leaves out the kit's default actions, the marker drag among them. */\n actions: Props['actions'];\n /** `longPress.feedback`. Default true, which installs the kit's own. */\n pressFeedback: NonNullable<Props['longPress']>['feedback'];\n initialActiveTool: Props['initialActiveTool'];\n modes: Props['modes'];\n onToolsCreated: Props['onToolsCreated'];\n}): {\n /** What the canvas routes input through: the takeover, or `internal`. */\n tools: ToolsApi;\n /** The canvas's own api, built whether or not a takeover replaces it. */\n internal: ToolsApi;\n takeover: ToolsApi | null;\n} {\n const { select, enabled, tools: toolsProp, defaultTools, toolOptions, inertia, ambient, initialActiveTool, modes, onToolsCreated } = args;\n\n const takeover = toolsProp && isToolsApi(toolsProp) ? toolsProp : null;\n const registry = useBuiltinTools({\n select,\n enabled,\n defaultTools,\n patch: toolsProp && !isToolsApi(toolsProp) ? toolsProp : null,\n toolOptions,\n inertia,\n });\n\n const defaultPressFeedback = useMemo(() => createLongPressFeedbackContribution(), []);\n const feedbackOpt = args.pressFeedback ?? true;\n const pressFeedback = feedbackOpt === true ? defaultPressFeedback : feedbackOpt || null;\n const defaultMarkerDrag = useMemo(() => createViewMarkerContribution(), []);\n const markerDrag = args.actions === null ? null : defaultMarkerDrag;\n const mergedAmbient = useMemo(\n () => [\n ...presetContributions(enabled), ...(ambient ?? []),\n ...(pressFeedback ? [pressFeedback] : []), ...(markerDrag ? [markerDrag] : []),\n ],\n [enabled, ambient, pressFeedback, markerDrag],\n );\n\n const internal = useTools({\n active: initialActiveTool ?? ('select' in registry ? 'select' : null),\n registry,\n ...(mergedAmbient.length ? { ambient: mergedAmbient } : {}),\n ...(modes ? { modes } : {}),\n });\n const tools = takeover ?? internal;\n\n const onToolsCreatedRef = useLatest(onToolsCreated);\n useEffect(() => { onToolsCreatedRef.current?.(tools); }, [tools, onToolsCreatedRef]);\n\n return { tools, internal, takeover };\n}\n\n/**\n * The presets' ambient bindings, and the standard actions the canvas\n * registers. The bindings are not tools and sit outside `tools`, so they apply\n * under a takeover too. An action is registered when an enabled preset brings\n * it, or when it is in `pool` and a tool or contribution on this canvas binds\n * it: a tool brings the actions it routes to, so `defaultTools={['rect']}`\n * works under any preset.\n */\nexport function useFeatureBindings(args: {\n enabled: EnabledPresets;\n /** Actions registered only when something binds them. */\n pool: readonly Action[];\n tools: Pick<ToolsApi, 'registry' | 'ambient'>;\n move: FeatureBindingOptions['move'];\n rotate: FeatureBindingOptions['rotate'];\n}): { contributions: Contribution[]; standardActions: Action[] } {\n const { enabled, pool, tools, move, rotate } = args;\n const contributions = useMemo<Contribution[]>(\n () => presetAmbient(enabled, { move, rotate }),\n [enabled, move, rotate],\n );\n const standardActions = useMemo(() => {\n const out = presetActions(enabled);\n const have = new Set(out.map((a) => a.id));\n const bound = new Set<string>();\n for (const entry of [...Object.values(tools.registry), ...tools.ambient, ...contributions]) {\n for (const b of entry.bindings ?? []) bound.add(b.actionId);\n }\n for (const a of pool) {\n if (bound.has(a.id) && !have.has(a.id)) {\n have.add(a.id);\n out.push(a);\n }\n }\n return out;\n }, [enabled, pool, tools, contributions]);\n return { contributions, standardActions };\n}\n\n"],"mappings":";;;;;;;;;;;AAwBA,SAAS,WAAW,OAAiD;CACnE,OAAO,OAAQ,MAAmB,cAAc;AAClD;AAEA,IAAM,gCAAgB,IAAI,QAAwB;AAClD,IAAI,aAAa;AACjB,IAAM,YAAY,MAA4B;CAC5C,IAAI,OAAO,MAAM,UAAU,OAAO;CAClC,IAAI,IAAI,cAAc,IAAI,CAAC;CAC3B,IAAI,MAAM,QAAW,cAAc,IAAI,GAAI,IAAI,YAAa;CAC5D,OAAO,IAAI;AACb;;;AAIA,SAAgB,mBACd,UACA,OACA,aACA,eACgB;CAChB,MAAM,eAAe,YAAY,CAAC,EAAA,CAAG,IAAI,QAAQ,CAAC,CAAC,KAAK,GAAG;CAC3D,OAAO,cACC,gBAAgB,UAAU,OAAO;EAAE,UAAU;EAAa;CAAc,CAAC,GAE/E;EAAC;EAAa;EAAO;EAAa;CAAa,CACjD;AACF;;;;;;AAOA,SAAgB,eAAe,
|
|
1
|
+
{"version":3,"file":"useCanvasTools.js","names":[],"sources":["../../../src/canvas/SceneCanvas/useCanvasTools.ts"],"sourcesContent":["import { useEffect, useMemo } from 'react';\nimport { useLatest } from '@weasel-js/react';\nimport type { Action } from '@weasel-js/routing';\nimport { createLongPressFeedbackContribution } from '../../features/longPress/longPressFeedback';\nimport { createViewMarkerContribution } from '../../features/viewports/viewMarkerDrag';\nimport { useTools, type Contribution, type Tool, type ToolsApi } from '../../tools/overlayBinding';\nimport {\n presetActions,\n presetAmbient,\n presetContributions,\n resolveFeatures,\n type EnabledPresets,\n type FeatureBindingOptions,\n type FeatureEntry,\n type NamedPresets,\n} from './features';\nimport type { SceneCanvasProps } from './props';\nimport type { ToolsPatch } from './toolRegistry';\nimport { useBuiltinTools } from './useBuiltinTools';\n\ntype Props = SceneCanvasProps<unknown, string, unknown>;\n\n/** Discriminate the polymorphic `tools` prop: `ToolsApi` has `setActive`\n * / `active` / `registry`; the patch record shape has none of those. */\nfunction isToolsApi(tools: ToolsApi | ToolsPatch): tools is ToolsApi {\n return typeof (tools as ToolsApi).setActive === 'function';\n}\n\nconst presetSerials = new WeakMap<object, number>();\nlet nextSerial = 0;\nconst entryKey = (e: FeatureEntry): string => {\n if (typeof e === 'string') return e;\n let n = presetSerials.get(e);\n if (n === undefined) presetSerials.set(e, (n = nextSerial++));\n return `#${n}`;\n};\n\n/** The presets a canvas runs with. Keyed on the entries, not the array, so\n * an inline `features={['draw', pathTools]}` does not re-derive every render. */\nexport function useEnabledFeatures(\n features: readonly FeatureEntry[] | undefined,\n named: NamedPresets | null,\n hasViewport: boolean,\n selectRotates: boolean,\n): EnabledPresets {\n const featuresKey = (features ?? []).map(entryKey).join('|');\n return useMemo(\n () => resolveFeatures(features, named, { viewport: hasViewport, selectRotates }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [featuresKey, named, hasViewport, selectRotates],\n );\n}\n\n/**\n * The canvas's tools: a caller's own `ToolsApi` when the `tools` prop is one\n * (the takeover form), and otherwise the built-ins the presets and\n * `defaultTools` name, patched by a `tools` record.\n */\nexport function useCanvasTools(args: {\n /** The canvas's select tool, which is built from its scene and pickers. */\n select: Tool;\n /** The canvas's group entry and leave, or null where the select preset is off. */\n groupEntry: Contribution | null;\n enabled: EnabledPresets;\n tools: Props['tools'];\n defaultTools: Props['defaultTools'];\n toolOptions: Props['toolOptions'];\n /** `viewport.inertia`, which is the hand tool's. */\n inertia: NonNullable<Props['viewport']>['inertia'];\n ambient: Props['ambient'];\n /** `null` leaves out the kit's default actions, the marker drag among them. */\n actions: Props['actions'];\n /** `longPress.feedback`. Default true, which installs the kit's own. */\n pressFeedback: NonNullable<Props['longPress']>['feedback'];\n initialActiveTool: Props['initialActiveTool'];\n modes: Props['modes'];\n onToolsCreated: Props['onToolsCreated'];\n}): {\n /** What the canvas routes input through: the takeover, or `internal`. */\n tools: ToolsApi;\n /** The canvas's own api, built whether or not a takeover replaces it. */\n internal: ToolsApi;\n takeover: ToolsApi | null;\n} {\n const { select, enabled, tools: toolsProp, defaultTools, toolOptions, inertia, ambient, initialActiveTool, modes, onToolsCreated } = args;\n\n const takeover = toolsProp && isToolsApi(toolsProp) ? toolsProp : null;\n const registry = useBuiltinTools({\n select,\n enabled,\n defaultTools,\n patch: toolsProp && !isToolsApi(toolsProp) ? toolsProp : null,\n toolOptions,\n inertia,\n });\n\n const defaultPressFeedback = useMemo(() => createLongPressFeedbackContribution(), []);\n const feedbackOpt = args.pressFeedback ?? true;\n const pressFeedback = feedbackOpt === true ? defaultPressFeedback : feedbackOpt || null;\n const defaultMarkerDrag = useMemo(() => createViewMarkerContribution(), []);\n const markerDrag = args.actions === null ? null : defaultMarkerDrag;\n const groupEntry = args.actions === null ? null : args.groupEntry;\n const mergedAmbient = useMemo(\n () => [\n ...presetContributions(enabled), ...(groupEntry ? [groupEntry] : []), ...(ambient ?? []),\n ...(pressFeedback ? [pressFeedback] : []), ...(markerDrag ? [markerDrag] : []),\n ],\n [enabled, groupEntry, ambient, pressFeedback, markerDrag],\n );\n\n const internal = useTools({\n active: initialActiveTool ?? ('select' in registry ? 'select' : null),\n registry,\n ...(mergedAmbient.length ? { ambient: mergedAmbient } : {}),\n ...(modes ? { modes } : {}),\n });\n const tools = takeover ?? internal;\n\n const onToolsCreatedRef = useLatest(onToolsCreated);\n useEffect(() => { onToolsCreatedRef.current?.(tools); }, [tools, onToolsCreatedRef]);\n\n return { tools, internal, takeover };\n}\n\n/**\n * The presets' ambient bindings, and the standard actions the canvas\n * registers. The bindings are not tools and sit outside `tools`, so they apply\n * under a takeover too. An action is registered when an enabled preset brings\n * it, or when it is in `pool` and a tool or contribution on this canvas binds\n * it: a tool brings the actions it routes to, so `defaultTools={['rect']}`\n * works under any preset.\n */\nexport function useFeatureBindings(args: {\n enabled: EnabledPresets;\n /** Actions registered only when something binds them. */\n pool: readonly Action[];\n tools: Pick<ToolsApi, 'registry' | 'ambient'>;\n move: FeatureBindingOptions['move'];\n rotate: FeatureBindingOptions['rotate'];\n}): { contributions: Contribution[]; standardActions: Action[] } {\n const { enabled, pool, tools, move, rotate } = args;\n const contributions = useMemo<Contribution[]>(\n () => presetAmbient(enabled, { move, rotate }),\n [enabled, move, rotate],\n );\n const standardActions = useMemo(() => {\n const out = presetActions(enabled);\n const have = new Set(out.map((a) => a.id));\n const bound = new Set<string>();\n for (const entry of [...Object.values(tools.registry), ...tools.ambient, ...contributions]) {\n for (const b of entry.bindings ?? []) bound.add(b.actionId);\n }\n for (const a of pool) {\n if (bound.has(a.id) && !have.has(a.id)) {\n have.add(a.id);\n out.push(a);\n }\n }\n return out;\n }, [enabled, pool, tools, contributions]);\n return { contributions, standardActions };\n}\n\n"],"mappings":"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"}
|