@weasel-js/core 1.6.0 → 1.7.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 +266 -0
- package/README.md +24 -4
- package/dist/{depSchema-BhgZc0-Q.d.ts → builtins-DLn2lCr_.d.ts} +693 -53
- package/dist/{chunk-BJN5ZRIJ.js → chunk-3TY6FHAF.js} +7 -4
- package/dist/chunk-3TY6FHAF.js.map +1 -0
- package/dist/{chunk-H6N2JSZ3.js → chunk-DGWNNKGD.js} +3 -3
- package/dist/{chunk-H6N2JSZ3.js.map → chunk-DGWNNKGD.js.map} +1 -1
- package/dist/{chunk-THCSDHII.js → chunk-G4ZGQMY7.js} +2453 -1264
- package/dist/chunk-G4ZGQMY7.js.map +1 -0
- package/dist/{chunk-HPFJUUTF.js → chunk-LU4IJ52W.js} +5 -61
- package/dist/chunk-LU4IJ52W.js.map +1 -0
- package/dist/{chunk-D4AAWR64.js → chunk-M24CLARN.js} +4 -4
- package/dist/{chunk-D4AAWR64.js.map → chunk-M24CLARN.js.map} +1 -1
- package/dist/{chunk-4RJP2N2L.js → chunk-NE27EOLP.js} +8 -5
- package/dist/chunk-NE27EOLP.js.map +1 -0
- package/dist/{chunk-DOBSZOPR.js → chunk-UPZY4ART.js} +3 -3
- package/dist/{chunk-DOBSZOPR.js.map → chunk-UPZY4ART.js.map} +1 -1
- package/dist/{chunk-T3UQ3F6R.js → chunk-WPNA6L5O.js} +47 -13
- package/dist/chunk-WPNA6L5O.js.map +1 -0
- package/dist/{chunk-44EWMJV2.js → chunk-XMAWPGTK.js} +5 -5
- package/dist/{chunk-44EWMJV2.js.map → chunk-XMAWPGTK.js.map} +1 -1
- package/dist/clipboard.d.ts +1 -1
- package/dist/clipboard.js +3 -3
- package/dist/clone.d.ts +2 -2
- package/dist/clone.js +3 -3
- package/dist/grid-CY5UKlZh.d.ts +98 -0
- package/dist/index.css +11 -35
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +912 -1148
- package/dist/index.js +9 -9
- package/dist/insert.d.ts +2 -3
- package/dist/insert.js +1 -1
- package/dist/math.d.ts +1 -1
- package/dist/move.d.ts +5 -4
- package/dist/move.js +4 -4
- package/dist/move.js.map +1 -1
- package/dist/patterns-builtin.js +1 -1
- package/dist/{pointSnapToGrid-7mCcm6qG.d.ts → pointSnapToGrid-Dp2IxLGb.d.ts} +53 -60
- package/dist/renderer.css +11 -35
- package/dist/renderer.css.map +1 -1
- package/dist/renderer.d.ts +17 -8
- package/dist/renderer.js +9 -9
- package/dist/resize.d.ts +3 -3
- package/dist/resize.js +2 -2
- package/dist/routing.d.ts +1 -1
- package/dist/routing.js +1 -1
- package/dist/{types-CxC8P6W0.d.ts → types-D-9QWBy5.d.ts} +9 -6
- package/dist/{types-D_74YlWs.d.ts → types-qYpyTAiZ.d.ts} +4 -7
- package/package.json +15 -12
- package/dist/chunk-4RJP2N2L.js.map +0 -1
- package/dist/chunk-BJN5ZRIJ.js.map +0 -1
- package/dist/chunk-HPFJUUTF.js.map +0 -1
- package/dist/chunk-T3UQ3F6R.js.map +0 -1
- package/dist/chunk-THCSDHII.js.map +0 -1
- package/dist/grid-Dx2gQbNv.d.ts +0 -158
- package/dist/options-CzjxFoYZ.d.ts +0 -67
- package/dist/{math-DRa6HBBs.d.ts → math-MCQcf_gc.d.ts} +111 -111
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export { ACTION_GLYPHS, ALWAYS, ANCHOR_HIT_BASE_PX, ActionDisabledReason, ActionsProvider, ActionsProviderIfRoot, ActionsScope, ActiveToolContextProvider, ActiveToolContextProviderIfRoot, AlignBottomIcon, AlignCenterXIcon, AlignCenterYIcon, AlignLeftIcon, AlignRightIcon, AlignTopIcon, ArrowIcon, BUILTIN_MARKERS, BUNDLE_TOOLS, BringForwardIcon, BringToFrontIcon, COARSE_TARGET_SCALE, CURVE_REPS, CanvasView, ColorOverrideRegistry, CopyIcon, CropIcon, CursorCoordsHud, CutIcon, DEFAULT_ALLOWED_CAPABILITIES, DEFAULT_DEBUG_STROKES, DEFAULT_DEBUG_THEME, DEFAULT_DEVICE_PROFILE, DEFAULT_FILL_COLOR, DEFAULT_HANDLE_SIZE, DEFAULT_MAX_ZOOM, DEFAULT_MIN_ZOOM, DEFAULT_PALETTE, DEFAULT_ROTATION_HANDLE_DISTANCE, DEFAULT_SHAPE_FILL, DEFAULT_STROKE_COLOR, DEFAULT_TEXT_STYLE, DeleteIcon, DepRegistryProvider, DepRegistryProviderIfRoot, DeviceProfileProvider, DistributeHorizontalIcon, DistributeVerticalIcon, DivideIcon, DuplicateIcon, EASINGS, EllipseIcon, ExcludeIcon, EyedropperIcon, FALLBACK_FIT_VIEW, FlipXIcon, FlipYIcon, GHOST_STROKE, GroupIcon, HANDLE_BASE_PX, HandIcon, IDENTITY_JOINT, IDENTITY_POSE_COMPOSITION, ImageIcon, IntersectIcon, KIT_SHAPE_KINDS, KIT_STANDARD_ACTION_IDS, LassoIcon, LineIcon, MARKDOWN_RUN_GRAMMAR, MESH_BAKE_SIZE, MESH_GRADIENT_KIND, MIXED, MOVE_ANCHORS, MinimapCanvas, NEVER, PAINTED_CURSOR_LAYER_ID, PATH_ANCHOR_CHROME_ID, PasteIcon, PenIcon, PencilIcon, PickHud, PointerProviderIfRoot, PolygonIcon, RECT_POSE_COMPOSITION, RIGID_POSE_COMPOSITION, ROTATION_HANDLE_BASE_PX, RectIcon, RedoIcon, SCRIPT_METRICS, SPRING_PRESETS, SPRITE_STRIDE, STROKE_DASH_RATIOS, SceneCanvas, SceneViewCanvas, SelectIcon, SelectionContextProvider, SelectionContextProviderIfRoot, SendBackwardIcon, SendToBackIcon, StarIcon, SubtractIcon, TOOL_PREF_KINDS, TextIcon, UNION_OF_CHILDREN, UndoIcon, UngroupIcon, UnionIcon, UnknownIcon, VERSION, VIEW_ANIMATION_KEY, WHEEL_ZOOM_STEP, WeaselProvider, ZOOM_FLOOR, _resetMarkersForTests, _resetPaintKindsForTests, actionBindings, actionIs, actionItems, actionShortcuts, alignDeltaFor, alignInsertBehavior, alignMoveBehavior, alignResizeBehavior, alignedStrokeRect, always, and, animateLifecycle, animateOnSetPose, annulusSemiAxes, applyBooleanOp, applyStyleToRange, areaSelectAction, arrayAdapter, asNodeId, asPaint, bakeCursor, bakeMesh, bezierCubic, bezierQuadratic, bindRig, blendPoses, blur, buildChromeCtx, buildDepsFromRequires, buildRuleCtx, buildSceneViewCommands, cachedLayoutRuns, canBringForward, canHover, canQueryLocalFonts2 as canQueryLocalFonts, canSendBackward, capabilityAll, capabilityIn, capabilityIs, capabilityNot, caretIndexAt, cellAt, charOffsetToDomPosition, circlePath, clampView, clearSelectionAction, clientToCanvas, clipboardCopyAction, clipboardCutAction, clipboardPasteAction, cloneAction, coarsePointer, composeAffordanceLayer, composePath, composeRectPose, composeRigidPose, composeSelectionPose, composeWorldPose, computeFitView, computeFitViewport, computeIndicatorCommand, computeWheelAction, cond, constrainTo45, containedThenNearest, contrastLineColor, cornerWeights, countPathAnchors, createCellHighlightLayer, createChildrenLayer, createCornerResizeAffordance, createDebugOverlayLayer, createDebugSink, createDispatcher, createGridLayer, createGuidesLayer, createHistory, createKeyState, createMarkdownRenderer, createMoveToIndexOp, createNodeProperties, createNodeRouting, createPaintedCursorLayer, createPaintedCursorState, createParallaxLayer, createPathAnchorAffordances, createPathEditingOverlayLayer, createPathLayer, createPenPreviewLayer, createPoseFeed, createPoseOverrides, createReorderOp, createRotationAffordance, createScene, createSelectionHandlesLayer, createSelectionOutlineLayer, createSelectionOverlayLayer, createSetDataOp, createSetLayerOp, createSetPathOp, createSetTextOp, createSlew, createTextLayer, createTiledLayer, createVelocityTracker, createViewResolver, createViewportLayer, cubicBezierEasing, cullDrawCommands, cursorFor, cycleFill, cycleVertexColors, dashForStrokeStyle, decomposePath, decomposeRectPose, decomposeRigidPose, defaultCommitAdapter, defaultDrawOne, defaultLabelTextRenderer, defaultNodeProperties, defaultNodeRouting, defaultVisibilityRules, defineTool, defineViewportTool, definesFrame, deleteScratch, deriveAlignmentGuides, deriveParallaxView, derivedDepOf, derivedPose, describeRule, documentPose, domPositionToCharOffset, domToRuns, drawLayers, drawOneLayer, easeIn, easeInBack, easeInBounce, easeInCirc, easeInCubic, easeInElastic, easeInExpo, easeInOut, easeInOutBack, easeInOutBounce, easeInOutCirc, easeInOutCubic, easeInOutElastic, easeInOutExpo, easeInOutQuad, easeInOutQuart, easeInOutQuint, easeInOutSine, easeInQuad, easeInQuart, easeInQuint, easeInSine, easeOut, easeOutBack, easeOutBounce, easeOutCirc, easeOutCubic, easeOutElastic, easeOutExpo, easeOutQuad, easeOutQuart, easeOutQuint, easeOutSine, editAnchorsAction, effectivePose, effectiveRangeStyle, enableLocalFontOutlines2 as enableLocalFontOutlines, enterTextEditAction, enumerateAnchors, evalPatch, evaluate, evaluateEnabled, fillInPoseFrame, fillToBoundsFrame, findNodeShape, findShapeInk, findShapeSilhouette, fitTextPose, fitToBounds, fitViewToBounds, fitZoom, flattenPreviews, focused, fontString, forEachCoalesced, frameRect, freeform, gateLayer, gesturing, getAlpha01, getImageBitmap, getMarker, getNodeShapes, getPaintKind, getScratch, getStylusData, gradientForBounds, gradientGeometry, hasFontOutlines2 as hasFontOutlines, hexToOklchDeg, hexToRgba, hitAffordanceRegions, hitAnchor, hitRotationHandle, hostAnchorCss, hostAnchorRect, hovering, hoveringSelected, hslToSrgb, imageStatus, inferredNodeProperties, inferredNodeRouting, insertAction, insertPreviewExtent, interpolateSrgb, interpolateView, isBuiltinToolPref, isCanvasFont2 as isCanvasFont, isEditableTarget, isGradientFill, isLayerPainted, isLayerVisible, isMeshGradientFill, isPatternSpec, isTensorPatch, isValidPatch, isVectorImageSrc, keySpecShortcut, lassoSelectAction, layoutMarkdown, layoutRuns, layoutTextPose, lerpColorArray, lerpOklab, lerpOklch, linear, linearSrgbToOklab, linearToSrgb, listFontOutlines2 as listFontOutlines, listMarkers, listPaintKinds, liveScope, makePinchZoomAction, makeViewportWheelPanAction, makeViewportZoomAction, markdownToRuns, markerDrawCommands, markerInset, markerKeyOf, markerSites, mat3, matchAlignment, matchesKeyBinding, meanScale, measureText, measureTextBounds, measuredWidth, mergeAlphaFromPrev, mergeContributions, meshBounds, meshGradientXml, modeIn, modeIs, modeNot, modifierHeld, momentum, moveAction, multiActive, nearest, nearestWithin, nestedHitTester, never, nodeHasFlag, none, normalizeHex, normalizeView, normalizeZoom, not, nurbs, oklabToLinearSrgb, oklabToOklch, oklabToSrgbU8, oklchDegToHex, oklchToOklab, openFilePicker, openPointerSession, or, outlineStatus2 as outlineStatus, paintAlpha, paintKindOf, paintWithAlpha, paintWithColor, parseColor, parseColorToRgba255, parseDebugFlags, patchBounds, patchCorner, pathContainsPoint, pathContainsPolygon, pathContainsRect, pathDistanceToPoint, pathDivide, pathExclude, pathFromD, pathInPoseFrame, pathInWorld, pathIntersect, pathIntersectsPolygon, pathIntersectsRect, pathOriginProjection, pathSubtract, pathToAnchors, pathUnion, pickTopMostHit, pinchZoomAction, planPixelRender, pointInTextPose, poseRotationOf, prefUnit, pressureToWidth, rainbowVertexColors, rebaseLocalPose, rectMarkerPath, registerCanvasFont2 as registerCanvasFont, registerContentHandler, registerEffect, registerFont2 as registerFont, registerFontOutlines2 as registerFontOutlines, registerMarker, registerNodeShape, registerPaintKind, renderLabel, renderSceneToCanvas, renderSceneToPixels, resizeAction, resolveAlign, resolveColor, resolveCursor, resolveCursorTier, resolveDeviceProfile, resolveEasing, resolveFillPattern, resolveMarkerSize, resolveOverlays, resolveParams, resolvePatternSpec, resolvePreviews, resolveRuns, resolveScreenLength, resolveSkeleton, resolveStrokeWidth, resolveTextStyle, resolveVisibility, rgbaToHex, rigidRigApply, rotateAction, rotateAroundAABBCenter, rotatePathAround, rotationDegreesUnit, rotationHandle, roundRectPath, roundToCell, runsToDom, runsToMarkdown, runsToPlainText, sampleGradientStops, sampleTrack, sceneFromJSON, sceneNodeClientRect, sceneSelectionStore, sceneToAdapter, scopeBindings, scratchKey, screenToWorld, seedMeshPatch, selectFromLasso, selectionAtLeast, selectionEmpty, selectionIs, setFlagOverRange, setScratch, shapeCoversPoint, slewToward, sliceAction, snapPoint, solid, solidVertexColors, specificity, spiro, splitPathByLine, splitSubpaths, springPose, springVertexColors, squarePath, srgbFloatToOklab, srgbToHsl, srgbToLinear, srgbU8ToOklab, staggerVertexColors, startThresholdDrag, strokeDashStyleOf, strokeInsets, strokeOf, strokeWith, styleAtRange, subscribeGlyphReady2 as subscribeGlyphReady, subscribeImageReady, textCommand, textCommandFromPose, textCommandFromRuns, textLineBoxes, textPoseLayoutInput, tileGrid, tiledProject, toHex8, toRuns, transformRunTexts, translateRectPose, trimPolyline, tweenPose, tweenVertexColors, unionBoundsPath, unionOfChildren, unionOfChildrenVia, unregisterCanvasFont2 as unregisterCanvasFont, unregisterFontOutlines2 as unregisterFontOutlines, useAction, useActionsRegistry, useActiveToolContext, useAlign, useAnimator, useArrayAdapter, useAutoCenter, useBooleans, useBooleansAdapter, useCanvasFocus, useCanvasSize, useDecayLoop, useDepRegistry, useDepSource, useDeviceProfile, useDistribute, useDragGesture, useDragHandle, useDragRadial, useDragRect, useDropZone, useEllipseTool, useEyedropperTool, useGestureDispatcher, useGridCellHover, useGuides, useHandTool, useHandleDrag, useHostAnchor, useHoverTracking, useImageTool, useKeyState, useKeybindings, useLassoTool, useLineTool, useNodeOverlayFrame, useOngoingAction, useOptionalActiveToolContext, useOptionalDepRegistry, usePenTool, usePencilTool, usePinchGesture, usePointerStylus, usePolygonTool, usePoseCompositionDepSource, usePoseDescriptorDepSource, usePoseRun, usePublishSelection, useRectTool, useResizePolicy, useRig, useScene, useSceneAdapter, useSceneTextEdit, useSelectTool, useSelection, useSelectionContext, useSimulation, useSliceDep, useStandardActions, useStarTool, useTextEdit, useTextTool, useTools, useVelocityTracker, useViewAnimation, useViewAnimationOn, useVisibleRaf, verticalAlignOffset, viewToMat3, viewToTransform, viewZoom, viewportDragPanAction, viewportWheelPanAction, viewportZoomAction, viewportsAt, vignette, wheelPan, wheelZoom, wheelZoomFactor, when, withAlpha01, withCoord, withGradientKind, worldEditToStorage, worldPoseLookup, worldToScreen, zoomAt, zoomAtLeast } from './chunk-THCSDHII.js';
|
|
1
|
+
export { ACTION_GLYPHS, ALWAYS, ANCHOR_HIT_BASE_PX, ANGLE_RADIANS, AREA_SELECT_ID, ActionDisabledReason, ActionsProvider, ActionsProviderIfRoot, ActiveToolContextProvider, ActiveToolContextProviderIfRoot, AlignBottomIcon, AlignCenterXIcon, AlignCenterYIcon, AlignLeftIcon, AlignRightIcon, AlignTopIcon, ArrowIcon, BUILTIN_MARKERS, BUILTIN_TOOL_IDS, BringForwardIcon, BringToFrontIcon, COARSE_TARGET_SCALE, CROSSHAIR_HALO, CURVE_REPS, CanvasView, ColorOverrideRegistry, CopyIcon, CropIcon, CursorCoordsHud, CutIcon, DEFAULT_ALLOWED_CAPABILITIES, DEFAULT_DEBUG_STROKES, DEFAULT_DEBUG_THEME, DEFAULT_DEVICE_PROFILE, DEFAULT_FILL_COLOR, DEFAULT_HANDLE_SIZE, DEFAULT_MAX_ZOOM, DEFAULT_MIN_ZOOM, DEFAULT_PALETTE, DEFAULT_ROTATION_HANDLE_DISTANCE, DEFAULT_SHAPE_FILL, DEFAULT_STROKE_COLOR, DEFAULT_TEXT_STYLE, DRAG_PAN_ID, DRAG_THRESHOLD_PX, DeleteIcon, DepRegistryProvider, DepRegistryProviderIfRoot, DeviceProfileProvider, DistributeHorizontalIcon, DistributeVerticalIcon, DivideIcon, DuplicateIcon, EASINGS, EllipseIcon, ExcludeIcon, EyedropperIcon, FALLBACK_FIT_VIEW, FEATURE_ACTION_IDS, FlipXIcon, FlipYIcon, GHOST_STROKE, GroupIcon, HANDLE_BASE_PX, HandIcon, IDENTITY_JOINT, IDENTITY_POSE_COMPOSITION, IMPERIAL_INCHES, ImageIcon, InputScope, IntersectIcon, KIT_SHAPE_KINDS, KIT_STANDARD_ACTION_IDS, LassoIcon, LineIcon, MARKDOWN_RUN_GRAMMAR, MESH_BAKE_SIZE, MESH_GRADIENT_KIND, METRIC_MM, MINIMAP_CENTER, MINIMAP_PAN, MIXED, MOVE_ANCHORS, MinimapCanvas, NEVER, PAINTED_CURSOR_LAYER_ID, PATH_ANCHOR_CHROME_ID, PIXELS, PasteIcon, PenIcon, PencilIcon, PickHud, PointerProviderIfRoot, PolygonIcon, RECT_POSE_COMPOSITION, RIGID_POSE_COMPOSITION, ROTATION_HANDLE_BASE_PX, RectIcon, RedoIcon, SCENE_CANVAS_FEATURES, SCRIPT_METRICS, SELECTION_MOVE_ID, SELECTION_TRANSFORM_ID, SPRING_PRESETS, SPRITE_STRIDE, STROKE_DASH_RATIOS, SceneCanvas, SceneViewCanvas, SelectIcon, SelectionContextProvider, SelectionContextProviderIfRoot, SendBackwardIcon, SendToBackIcon, StarIcon, SubtractIcon, TOOL_DRIVEN_ACTION_IDS, TOOL_PREF_KINDS, TextIcon, UNION_OF_CHILDREN, UndoIcon, UngroupIcon, UnionIcon, UnknownIcon, VERSION, VIEW_ANIMATION_KEY, WHEEL_ZOOM_STEP, WeaselProvider, Yoke, ZOOM_FLOOR, _resetMarkersForTests, _resetPaintKindsForTests, actionBindings, actionIs, actionItems, actionShortcuts, alignDeltaFor, alignInsertBehavior, alignMoveBehavior, alignResizeBehavior, alignedStrokeRect, always, and, animateLifecycle, animateOnSetPose, annulusSemiAxes, applyBooleanOp, applyStyleToRange, areaSelectAction, areaSelectContribution, arrayAdapter, asNodeId, asPaint, bakeCursor, bakeMesh, bezierCubic, bezierQuadratic, bindRig, blendPoses, blur, buildChromeCtx, buildDepsFromRequires, buildRuleCtx, buildSceneViewCommands, cachedLayoutRuns, canBringForward, canHover, canQueryLocalFonts2 as canQueryLocalFonts, canSendBackward, capabilityAll, capabilityIn, capabilityIs, capabilityNot, caretIndexAt, cellAt, centerRootOn, charOffsetToDomPosition, circlePath, clampView, clearSelectionAction, clientToCanvas, clipboardCopyAction, clipboardCutAction, clipboardPasteAction, cloneAction, coarsePointer, composeAffordanceLayer, composePath, composeRectPose, composeRigidPose, composeSelectionPose, composeWorldPose, computeFitView, computeFitViewport, computeIndicatorCommand, computeWheelAction, cond, constrainTo45, containedThenNearest, contrastLineColor, cornerWeights, countPathAnchors, createCellHighlightLayer, createChildrenLayer, createCornerResizeAffordance, createDebugOverlayLayer, createDebugSink, createDepRegistry, createDispatcher, createGridLayer, createGuidesLayer, createHistory, createKeyState, createLinkedCursorContribution, createMarkdownRenderer, createMinimapContribution, createMoveToIndexOp, createNodeProperties, createNodeRouting, createPaintedCursorLayer, createPaintedCursorState, createParallaxLayer, createPathAnchorAffordances, createPathEditingOverlayLayer, createPathLayer, createPenPreviewLayer, createPoseFeed, createPoseOverrides, createReflectable, createReorderOp, createRotationAffordance, createScene, createSelectionHandlesLayer, createSelectionOutlineLayer, createSelectionOverlayLayer, createSetDataOp, createSetLayerOp, createSetPathOp, createSetTextOp, createSlew, createTextLayer, createTiledLayer, createVelocityTracker, createViewResolver, createViewportLayer, crosshairRects, cubicBezierEasing, cullDrawCommands, cursorFor, cycleFill, cycleVertexColors, dashForStrokeStyle, decomposePath, decomposeRectPose, decomposeRigidPose, defaultCommitAdapter, defaultDrawOne, defaultLabelTextRenderer, defaultNodeProperties, defaultNodeRouting, defaultVisibilityRules, defineTool, definesFrame, deleteScratch, deriveAlignmentGuides, deriveParallaxView, derivedDepOf, derivedPose, describeRule, documentPose, domPositionToCharOffset, domToRuns, dragPanContribution, drawLayers, drawOneLayer, easeIn, easeInBack, easeInBounce, easeInCirc, easeInCubic, easeInElastic, easeInExpo, easeInOut, easeInOutBack, easeInOutBounce, easeInOutCirc, easeInOutCubic, easeInOutElastic, easeInOutExpo, easeInOutQuad, easeInOutQuart, easeInOutQuint, easeInOutSine, easeInQuad, easeInQuart, easeInQuint, easeInSine, easeOut, easeOutBack, easeOutBounce, easeOutCirc, easeOutCubic, easeOutElastic, easeOutExpo, easeOutQuad, easeOutQuart, easeOutQuint, easeOutSine, editAnchorsAction, effectivePose, effectiveRangeStyle, enableLocalFontOutlines2 as enableLocalFontOutlines, enterTextEditAction, enumerateAnchors, evalPatch, evaluate, evaluateEnabled, fillInPoseFrame, fillToBoundsFrame, findNodeShape, findShapeInk, findShapeSilhouette, fitTextPose, fitToBounds, fitViewToBounds, fitZoom, flattenPreviews, focused, fontOutlineRegistry2 as fontOutlineRegistry, fontRegistry2 as fontRegistry, fontString, forEachCoalesced, formatUnit, frameRect, freeform, gateLayer, gesturing, getAlpha01, getImageBitmap, getMarker, getNodeShapes, getPaintKind, getScratch, getStylusData, gradientForBounds, gradientGeometry, hasFontOutlines2 as hasFontOutlines, hexToOklchDeg, hexToRgba, hitAffordanceRegions, hitAnchor, hitRotationHandle, hostAnchorCss, hostAnchorRect, hovering, hoveringSelected, hslToSrgb, imageStatus, inferredNodeProperties, inferredNodeRouting, insertAction, insertPreviewExtent, interpolateSrgb, interpolateView, isBuiltinToolPref, isCanvasFont2 as isCanvasFont, isEditableTarget, isGradientFill, isLayerPainted, isLayerVisible, isMeshGradientFill, isPatternSpec, isPlainObject, isTensorPatch, isValidPatch, isVectorImageSrc, keySpecShortcut, lassoSelectAction, layoutMarkdown, layoutRuns, layoutTextPose, lerpColorArray, lerpOklab, lerpOklch, linear, linearSrgbToOklab, linearToSrgb, listFontOutlines2 as listFontOutlines, listGradientKinds, listMarkers, listPaintKinds, liveScope, makePinchZoomAction, makeViewportWheelPanAction, makeViewportZoomAction, markdownToRuns, markerInset, markerKeyOf, markerRegistry, markerSites, mat3, matchAlignment, matchesKeyBinding, meanScale, measureText, measureTextBounds, measuredWidth, mergeAlphaFromPrev, mergeContributions, meshBounds, meshFromStops, meshGradientXml, meshStops, minimapCenterAction, minimapPanAction, modeDecorationLayer, modeIn, modeIs, modeNot, modeShortcutSpec, modeShortcuts, modifierHeld, momentum, moveAction, multiActive, nearest, nearestWithin, nestedHitTester, never, nodeHasFlag, none, normalizeHex, normalizeView, normalizeZoom, not, nurbs, oklabToLinearSrgb, oklabToOklch, oklabToSrgbU8, oklchDegToHex, oklchToOklab, onEmptyCanvas, openFilePicker, openPointerSession, or, outlineStatus2 as outlineStatus, paintAlpha, paintKindOf, paintKindRegistry, paintWithAlpha, paintWithColor, parseColor, parseColorToRgba255, parseDebugFlags, pastDragThreshold, patchBounds, patchCorner, pathContainsPoint, pathContainsPolygon, pathContainsRect, pathDistanceToPoint, pathDivide, pathExclude, pathFromD, pathInPoseFrame, pathInWorld, pathIntersect, pathIntersectsPolygon, pathIntersectsRect, pathOriginProjection, pathSubtract, pathToAnchors, pathUnion, pickTopMostHit, pinchZoomAction, planPixelRender, pointInTextPose, poseRotationOf, prefUnit, pressureToWidth, rainbowVertexColors, rebaseLocalPose, rectMarkerPath, registerCanvasFont2 as registerCanvasFont, registerContentHandler, registerEffect, registerFont2 as registerFont, registerFontOutlines2 as registerFontOutlines, registerMarker, registerNodeShape, registerPaintKind, renderLabel, renderSceneToCanvas, renderSceneToPixels, resizeAction, resolveAlign, resolveColor, resolveCursor, resolveCursorTier, resolveDeviceProfile, resolveEasing, resolveFillPattern, resolveMarkerSize, resolveOverlays, resolveParams, resolvePatternSpec, resolvePreviews, resolveRuns, resolveScreenLength, resolveSkeleton, resolveStrokeWidth, resolveTextStyle, resolveUnit, resolveVisibility, rgbaToHex, rigidRigApply, rotateAction, rotateAroundAABBCenter, rotatePathAround, rotationDegreesUnit, rotationHandle, roundRectPath, roundToCell, runsToDom, runsToMarkdown, runsToPlainText, sampleGradientStops, sampleTrack, sceneFromJSON, sceneNodeClientRect, sceneSelectionStore, sceneToAdapter, scopeBindings, scratchKey, screenToWorld, seedMeshPatch, selectFromLasso, selectionAtLeast, selectionEmpty, selectionIs, selectionMoveBindings, selectionMoveContribution, selectionTransformBindings, selectionTransformContribution, setFlagOverRange, setScratch, shapeCoversPoint, slewToward, sliceAction, snapPoint, solid, solidVertexColors, specificity, spiro, splitPathBySegment, splitSubpaths, springPose, springVertexColors, squarePath, srgbFloatToOklab, srgbToHsl, srgbToLinear, srgbU8ToOklab, staggerVertexColors, startThresholdDrag, strokeDashStyleOf, strokeInsets, strokeOf, strokeWith, styleAtRange, subscribeGlyphReady2 as subscribeGlyphReady, subscribeImageReady, subscribeToSources, switchGradientKind, textCommand, textCommandFromPose, textCommandFromRuns, textLineBoxes, textPoseLayoutInput, tileGrid, tiledProject, toHex8, toRuns, transformRunTexts, translateRectPose, trimPolyline, tweenPose, tweenVertexColors, unionBoundsPath, unionOfChildren, unionOfChildrenVia, unitScale, unregisterCanvasFont2 as unregisterCanvasFont, unregisterFontOutlines2 as unregisterFontOutlines, useAction, useActionsRegistry, useActiveToolContext, useAlign, useAnimator, useArrayAdapter, useAutoCenter, useBooleans, useBooleansAdapter, useCanvasFocus, useCanvasSize, useDecayLoop, useDepRegistry, useDepSource, useDeviceProfile, useDistribute, useDragGesture, useDragHandle, useDragRadial, useDragRect, useDropZone, useEllipseTool, useEyedropperTool, useGestureDispatcher, useGridCellHover, useGuides, useHandTool, useHandleDrag, useHostAnchor, useHoverTracking, useImageTool, useKeyState, useKeybindings, useLassoTool, useLineTool, useNodeOverlayFrame, useOngoingAction, useOptionalActiveToolContext, useOptionalDepRegistry, usePenTool, usePencilTool, usePointerStylus, usePolygonTool, usePoseCompositionDepSource, usePoseDescriptorDepSource, usePoseRun, usePublishSelection, useRectTool, useResizePolicy, useRig, useScene, useSceneAdapter, useSceneTextEdit, useSelectTool, useSelection, useSelectionContext, useSimulation, useSliceDep, useStandardActions, useStarTool, useTextEdit, useTextTool, useTools, useVelocityTracker, useViewAnimation, useViewAnimationOn, useVisibleRaf, useYoke, verticalAlignOffset, viewToMat3, viewToTransform, viewZoom, viewportDragPanAction, viewportWheelPanAction, viewportZoomAction, viewportsAt, vignette, wheelPan, wheelZoom, wheelZoomFactor, when, withAlpha01, withCoord, withGradientKind, workspaceTintLayer, worldEditToStorage, worldPoseLookup, worldToScreen, zoomAt, zoomAtLeast } from './chunk-G4ZGQMY7.js';
|
|
2
2
|
export { DEFAULT_ALPHA_DECAY, DEFAULT_ALPHA_MIN, DEFAULT_VELOCITY_DECAY, aabbCenter, createSimulation, pointAlongPath, pointInRotatedRect, rectCorners, rotatePoint, rotatedRectCorners } from './chunk-PNNZSYRD.js';
|
|
3
|
-
export { createReparentOp, createTransformOp, snap } from './chunk-
|
|
4
|
-
export { CORNER_ANCHORS, cornerPoint, cornerResizeHandles, hitCornerHandle, pointSnapToGrid } from './chunk-
|
|
5
|
-
export {
|
|
3
|
+
export { createReparentOp, createTransformOp, snap } from './chunk-XMAWPGTK.js';
|
|
4
|
+
export { CORNER_ANCHORS, cornerPoint, cornerResizeHandles, fixedCornerOf, hitCornerHandle, pointSnapToGrid } from './chunk-DGWNNKGD.js';
|
|
5
|
+
export { DEFAULT_GUIDE_TOLERANCE_PX, RECT_ORIGIN_PROJECTION, gridSnapStrategy, guideSnapStrategy, pointToGridCell, pxExtent, scaleDelta, withinPxBox, withinPxRadius } from './chunk-LU4IJ52W.js';
|
|
6
6
|
export { AUTO_POSE_DESCRIPTOR, DEFAULT_FLATTEN_TOLERANCE, PATH_C, PATH_CMD_LENGTHS, PATH_L, PATH_M, PATH_Q, PATH_Z, PathBuilder, RECT_POSE_DESCRIPTOR, ROTATED_POSE_DESCRIPTOR, axisAlignedBounds, boundsOfPath, ellipsePath, flattenCubic, flattenCubicWithArcLen, flattenQuadratic, flattenQuadraticWithArcLen, isPathLike, isRectPose, linePath, pathCommandCoordCount, pathPoseDescriptor, pointInPath, polygonFromPoints, polylineFromPoints, poseDescriptorForNode, rectPath, regularPolygonPath, scalePathToBounds, starPath, transformPath, translatePath, translatePoseViaDescriptor, unionAABB, unionBounds, visualBoundsViaDescriptor } from './chunk-L5YNZYEG.js';
|
|
7
|
-
export { PointerContextProvider, WEASEL_CLIPBOARD_MIME, WEASEL_CLIPBOARD_MIME_WEB, applyOpsTo, buildWeaselClipboardText, dispatchApplyBatch, dlog, dwarn, embedWeaselMetadataInSvg, extractWeaselClipboardFromSvg, isDebugEnabled, parseWeaselClipboardText, sniffWeaselClipboardText, useClipboardOps, usePointerContext } from './chunk-
|
|
8
|
-
export { cloneByAltDrag } from './chunk-
|
|
9
|
-
export { createSetSelectionOp } from './chunk-
|
|
10
|
-
export { createDeleteOp, createInsertOp, rebuildOp, registerOpFactory, registeredOpNames } from './chunk-
|
|
11
|
-
export { createTilePattern } from './chunk-
|
|
7
|
+
export { PointerContextProvider, WEASEL_CLIPBOARD_MIME, WEASEL_CLIPBOARD_MIME_WEB, applyOpsTo, buildWeaselClipboardText, createPointerStore, dispatchApplyBatch, dlog, dwarn, embedWeaselMetadataInSvg, extractWeaselClipboardFromSvg, isDebugEnabled, parseWeaselClipboardText, sniffWeaselClipboardText, useClipboardOps, usePointerContext, usePointerPosition } from './chunk-WPNA6L5O.js';
|
|
8
|
+
export { cloneByAltDrag } from './chunk-M24CLARN.js';
|
|
9
|
+
export { createSetSelectionOp } from './chunk-UPZY4ART.js';
|
|
10
|
+
export { createDeleteOp, createInsertOp, opFactoryRegistry, rebuildOp, registerOpFactory, registeredOpNames } from './chunk-NE27EOLP.js';
|
|
11
|
+
export { createTilePattern } from './chunk-3TY6FHAF.js';
|
|
12
12
|
//# sourceMappingURL=index.js.map
|
|
13
13
|
//# sourceMappingURL=index.js.map
|
package/dist/insert.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import { I as InsertBehavior } from './types-D_74YlWs.js';
|
|
1
|
+
import { I as InsertBehavior } from './types-qYpyTAiZ.js';
|
|
3
2
|
import { ModifierState, View } from '@weasel-js/routing';
|
|
4
3
|
import { G as Guide } from './types-D2tTKEU0.js';
|
|
5
4
|
import '@weasel-js/history';
|
|
6
|
-
import './types-
|
|
5
|
+
import './types-D-9QWBy5.js';
|
|
7
6
|
import './path-JEV2c5If.js';
|
|
8
7
|
|
|
9
8
|
type ModKey$1 = keyof ModifierState;
|
package/dist/insert.js
CHANGED
package/dist/math.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { P as Path, b as PathFillRule, a as PolygonPath, R as RectPath } from './path-JEV2c5If.js';
|
|
2
2
|
export { Point2 as Vec2 } from '@weasel-js/routing';
|
|
3
3
|
export { P as PoseDescriptor, t as translatePoseViaDescriptor } from './poseDescriptor-rZa9W5hJ.js';
|
|
4
|
-
export { P as PathBuilder, a as Simulation, f as SimulationCore, g as SimulationForce, S as SimulationNode, h as SimulationOptions, j as createSimulation, p as pointAlongPath, n as polygonFromPoints, o as polylineFromPoints, q as rectPath, t as rotatePoint } from './math-
|
|
4
|
+
export { P as PathBuilder, a as Simulation, f as SimulationCore, g as SimulationForce, S as SimulationNode, h as SimulationOptions, j as createSimulation, p as pointAlongPath, n as polygonFromPoints, o as polylineFromPoints, q as rectPath, t as rotatePoint } from './math-MCQcf_gc.js';
|
|
5
5
|
export { DEFAULT_FLATTEN_TOLERANCE, PATH_C, PATH_CMD_LENGTHS, PATH_L, PATH_M, PATH_Q, PATH_Z, flattenCubic, flattenCubicWithArcLen, flattenQuadratic, flattenQuadraticWithArcLen, pathCommandCoordCount } from '@weasel-js/geom';
|
|
6
6
|
export { A as AUTO_POSE_DESCRIPTOR } from './autoPoseDescriptor-_XOyF7t4.js';
|
package/dist/move.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { O as OriginProjection } from './grid-
|
|
2
|
-
export { U as UseMoveOptions } from './grid-
|
|
3
|
-
import { M as MoveBehavior } from './types-
|
|
1
|
+
import { O as OriginProjection } from './grid-CY5UKlZh.js';
|
|
2
|
+
export { U as UseMoveOptions } from './grid-CY5UKlZh.js';
|
|
3
|
+
import { M as MoveBehavior } from './types-qYpyTAiZ.js';
|
|
4
4
|
import { ModifierState, View } from '@weasel-js/routing';
|
|
5
|
-
import { S as SnapTarget } from './types-
|
|
5
|
+
import { S as SnapTarget } from './types-D-9QWBy5.js';
|
|
6
6
|
import { G as Guide } from './types-D2tTKEU0.js';
|
|
7
|
+
import '@weasel-js/quantity';
|
|
7
8
|
import '@weasel-js/history';
|
|
8
9
|
import './path-JEV2c5If.js';
|
|
9
10
|
|
package/dist/move.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { snap, createTransformOp, createReparentOp } from './chunk-
|
|
2
|
-
import { gridSnapStrategy,
|
|
1
|
+
import { snap, createTransformOp, createReparentOp } from './chunk-XMAWPGTK.js';
|
|
2
|
+
import { gridSnapStrategy, AUTO_ORIGIN_PROJECTION, guideSnapStrategy } from './chunk-LU4IJ52W.js';
|
|
3
3
|
import './chunk-L5YNZYEG.js';
|
|
4
|
-
import { createDeleteOp } from './chunk-
|
|
4
|
+
import { createDeleteOp } from './chunk-NE27EOLP.js';
|
|
5
5
|
import { scratchKey, getScratch, setScratch } from '@weasel-js/routing';
|
|
6
6
|
|
|
7
7
|
// src/interactions/actions/move/behaviors/snapToGrid.ts
|
|
@@ -88,7 +88,7 @@ var SNAPSHOTS = scratchKey("snapBackOrDelete.snapshots");
|
|
|
88
88
|
var INDEXES = scratchKey("snapBackOrDelete.indexes");
|
|
89
89
|
function snapBackOrDelete(args) {
|
|
90
90
|
const { radius, onFreeRelease, deleteLabel = "Delete" } = args;
|
|
91
|
-
const proj = args.origin ??
|
|
91
|
+
const proj = args.origin ?? AUTO_ORIGIN_PROJECTION;
|
|
92
92
|
const r2 = radius * radius;
|
|
93
93
|
return {
|
|
94
94
|
onStart(ctx) {
|
package/dist/move.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/interactions/actions/move/behaviors/snapToGrid.ts","../src/interactions/actions/move/behaviors/snapToContainer.ts","../src/interactions/actions/move/behaviors/snapBackOrDelete.ts","../src/interactions/actions/move/behaviors/snapToGuides.ts"],"names":["snap","scratchKey","setScratch","getScratch"],"mappings":";;;;;;;AAQO,SAAS,WAAmD,IAAA,EAG3C;AACtB,EAAA,OAAO,IAAA,CAAK,iBAAwB,IAAA,CAAK,OAAO,GAAG,EAAE,SAAA,EAAW,IAAA,CAAK,SAAA,E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vC,QAAA,MAAM,KAAA,GAAQ,OAAA,EAAS,GAAA,CAAI,EAAE,CAAA,IAAK,EAAA;AAClC,QAAA,MAAM,GAAA,GAAY,CAAC,cAAA,CAAe,EAAE,IAAA,EAAM,KAAK,KAAA,EAAO,WAAA,EAAa,KAAA,EAAO,CAAC,CAAA;AAC3E,QAAA,OAAO,GAAA;AAAA,MACT;AAIA,MAAA,OAAO,IAAA;AAAA,IACT;AAAA,GACF;AACF;;;ACjDO,SAAS,aACd,IAAA,EACqB;AACrB,EAAA,MAAM,QAAA,GAAW,iBAAA,CAAyB,IAAA,CAAK,SAAA,EAAW;AAAA,IACxD,WAAW,IAAA,CAAK,SAAA;AAAA,IAChB,SAAS,IAAA,CAAK,OAAA;AAAA,IACd,QAAQ,IAAA,CAAK;AAAA,GACd,CAAA;AACD,EAAA,OAAO,KAAK,QAAA,EAAU,EAAE,SAAA,EAAW,IAAA,CAAK,WAAW,CAAA;AACrD","file":"move.js","sourcesContent":["import type { ModifierState, MoveBehavior } from '../../../gestures/types';\nimport { snap } from '../../../gestures/shared/snap';\nimport { gridSnapStrategy } from '../../../gestures/shared/strategies/grid';\n\ntype ModKey = keyof ModifierState;\n\n/** Move behavior that snaps the dragged pose's origin to a grid. Hold\n * `bypassKey` to drag freely. */\nexport function snapToGrid<TPose extends { x: number; y: number }>(args: {\n spacing: number;\n bypassKey?: ModKey;\n}): MoveBehavior<TPose> {\n return snap(gridSnapStrategy<TPose>(args.spacing), { bypassKey: args.bypassKey });\n}\n","import { createTransformOp } from 'core/ops/transform';\nimport { createReparentOp } from 'core/ops/reparent';\nimport type { Op } from 'core/ops/types';\nimport type { SnapTarget } from 'core/adapters/types';\nimport type { MoveBehavior, GestureContext } from '../../../gestures/types';\nimport { scratchKey, getScratch, setScratch } from '@weasel-js/routing';\n\ninterface SnapState<TPose> {\n pendingTargetId: string | null;\n pendingTimer: ReturnType<typeof setTimeout> | null;\n committedSnap: SnapTarget<TPose> | null;\n}\n\n// The slot is generic over TPose; we keep the unknown-pose key at module\n// scope and project it through `as` at the read site (each consumer call\n// of `snapToContainer<TPose>` is the only writer of its own SnapState\n// instance, so the cast is safe at runtime).\nconst STATE = scratchKey<SnapState<unknown>>('snapToContainer');\n\nfunction getState<TPose>(ctx: GestureContext<TPose>): SnapState<TPose> {\n let s = getScratch(ctx.scratch, STATE) as SnapState<TPose> | undefined;\n if (!s) {\n s = { pendingTargetId: null, pendingTimer: null, committedSnap: null };\n setScratch(ctx.scratch, STATE, s as SnapState<unknown>);\n }\n return s;\n}\n\nfunction clearTimer<TPose>(s: SnapState<TPose>) {\n if (s.pendingTimer !== null) {\n clearTimeout(s.pendingTimer);\n s.pendingTimer = null;\n }\n s.pendingTargetId = null;\n}\n\n/**\n * Move behavior that drops the dragged node into a container it hovers over\n * for `dwellMs`, reparenting it and taking the pose the container's layout\n * assigns.\n *\n * The dwell is what keeps a drag that merely passes over a container from\n * being captured by it.\n */\nexport function snapToContainer<TPose>(args: {\n dwellMs: number;\n findTarget: (\n draggedId: string,\n worldX: number,\n worldY: number,\n ) => SnapTarget<TPose> | null;\n isInstant?: (target: SnapTarget<TPose>) => boolean;\n moveLabel?: string;\n reparentLabel?: string;\n}): MoveBehavior<TPose> {\n const { dwellMs, findTarget, isInstant, moveLabel = 'Move', reparentLabel = 'Move and reparent' } = args;\n\n return {\n onMove(ctx, _proposed) {\n const s = getState<TPose>(ctx);\n const target = findTarget(ctx.draggedIds[0], ctx.pointer.worldX, ctx.pointer.worldY);\n\n if (s.committedSnap) {\n if (target && target.parentId === s.committedSnap.parentId) {\n return { pose: s.committedSnap.slotPose, snap: s.committedSnap };\n }\n s.committedSnap = null;\n }\n\n if (!target) {\n clearTimer(s);\n return;\n }\n\n if (isInstant?.(target)) {\n clearTimer(s);\n s.committedSnap = target;\n return { pose: target.slotPose, snap: target };\n }\n\n if (s.pendingTargetId === target.parentId) {\n return;\n }\n clearTimer(s);\n s.pendingTargetId = target.parentId;\n s.pendingTimer = setTimeout(() => {\n s.committedSnap = target;\n s.pendingTimer = null;\n }, dwellMs);\n return;\n },\n\n onEnd(ctx) {\n const s = getState<TPose>(ctx);\n clearTimer(s);\n const snap = s.committedSnap ?? ctx.snap;\n if (!snap) return;\n const draggedId = ctx.draggedIds[0];\n const oldParent = ctx.adapter.getParent?.(draggedId) ?? null;\n const fromPose = ctx.origin.get(draggedId)!;\n const ops: Op[] = [\n createTransformOp<TPose>({\n id: draggedId,\n from: fromPose,\n to: snap.slotPose,\n label: moveLabel,\n }),\n ];\n if (oldParent !== snap.parentId) {\n ops.push(createReparentOp({\n id: draggedId,\n fromParentId: oldParent,\n toParentId: snap.parentId,\n label: reparentLabel,\n }));\n }\n return ops;\n },\n };\n}\n","import { createDeleteOp } from 'core/ops/delete';\nimport type { Op } from 'core/ops/types';\nimport type { MoveBehavior } from '../../../gestures/types';\nimport {\n RECT_ORIGIN_PROJECTION,\n type OriginProjection,\n} from '../../../gestures/shared/strategies';\nimport { scratchKey, getScratch, setScratch } from '@weasel-js/routing';\n\nconst SNAPSHOTS = scratchKey<Map<string, { id: string }>>('snapBackOrDelete.snapshots');\nconst INDEXES = scratchKey<Map<string, number>>('snapBackOrDelete.indexes');\n\n/**\n * Move behavior for a drag that is only meaningful near where it started:\n * release inside `radius` and the node returns to its original pose; release\n * outside it and the node either springs back anyway or is deleted, per\n * `onFreeRelease`. A deletion is recorded as an undoable op with paint order\n * preserved.\n */\nexport function snapBackOrDelete<TPose extends { x: number; y: number }>(args: {\n radius: number;\n onFreeRelease: 'snap-back' | 'delete';\n deleteLabel?: string;\n}): MoveBehavior<TPose>;\n/** As above, for a `TPose` that is not a rect: `origin` tells the behavior how\n * to read and write the pose's origin. */\nexport function snapBackOrDelete<TPose>(args: {\n radius: number;\n onFreeRelease: 'snap-back' | 'delete';\n deleteLabel?: string;\n origin: OriginProjection<TPose>;\n}): MoveBehavior<TPose>;\n/** Snap back to the origin pose, or delete, depending on where the drag is\n * released. */\nexport function snapBackOrDelete<TPose>(args: {\n radius: number;\n onFreeRelease: 'snap-back' | 'delete';\n deleteLabel?: string;\n origin?: OriginProjection<TPose>;\n}): MoveBehavior<TPose> {\n const { radius, onFreeRelease, deleteLabel = 'Delete' } = args;\n const proj: OriginProjection<TPose> =\n args.origin ?? (RECT_ORIGIN_PROJECTION as unknown as OriginProjection<TPose>);\n const r2 = radius * radius;\n\n return {\n onStart(ctx) {\n // Snapshot the dragged objects + their z-indexes at gesture start so\n // delete can undo with paint order intact.\n const snapshots = new Map<string, { id: string }>();\n const indexes = new Map<string, number>();\n const nodes = ctx.adapter.getNodes();\n for (const id of ctx.draggedIds) {\n const obj = ctx.adapter.getNode(id) ?? { id };\n snapshots.set(id, obj);\n indexes.set(id, nodes.findIndex((n) => n.id === id));\n }\n setScratch(ctx.scratch, SNAPSHOTS, snapshots);\n setScratch(ctx.scratch, INDEXES, indexes);\n },\n\n onEnd(ctx) {\n if (ctx.snap) return;\n const id = ctx.draggedIds[0];\n const o0 = proj.getOrigin(ctx.origin.get(id)!);\n const o1 = proj.getOrigin(ctx.current.get(id)!);\n const dx = o1.x - o0.x;\n const dy = o1.y - o0.y;\n const within = dx * dx + dy * dy <= r2;\n if (within) {\n return null;\n }\n if (onFreeRelease === 'delete') {\n const snapshots = getScratch(ctx.scratch, SNAPSHOTS);\n const indexes = getScratch(ctx.scratch, INDEXES);\n const obj = snapshots?.get(id) ?? { id };\n const index = indexes?.get(id) ?? -1;\n const ops: Op[] = [createDeleteOp({ node: obj, label: deleteLabel, index })];\n return ops;\n }\n // `'snap-back'` — abort, same as a release inside the radius. Returning\n // `undefined` would defer to the default translate and leave the node\n // where it was dropped, which is the one thing this policy rules out.\n return null;\n },\n };\n}\n","import type { ModifierState, MoveBehavior } from '../../../gestures/types';\nimport type { Guide } from 'features/guides/types';\nimport type { View } from 'core/viewport/view';\nimport type { OriginProjection } from '../../../gestures/shared/strategies/grid';\nimport { snap } from '../../../gestures/shared/snap';\nimport { guideSnapStrategy } from '../../../gestures/shared/strategies/guides';\n\ntype ModKey = keyof ModifierState;\n\n/** Options for the move-flavored `snapToGuides`. */\nexport interface SnapToGuidesMoveArgs<TPose> {\n /** Stable getter into the live guide list (typically from `useGuides`). */\n getGuides: () => readonly Guide[];\n /** Snap tolerance (screen px when `getView` is set, world units otherwise). */\n tolerance?: number;\n /** Read the active view; required for screen-pixel tolerance. */\n getView?: () => View;\n /** Modifier key that bypasses snapping while held. */\n bypassKey?: ModKey;\n /** Origin projection for non-rect TPose (e.g. Path). */\n origin?: OriginProjection<TPose>;\n}\n\n/**\n * Move behavior that snaps the dragged pose's origin to the nearest world-space\n * guide line within `tolerance`. Closest-guide-per-axis wins; the two axes are\n * considered independently. Pair with `useGuides` and `createGuidesLayer`.\n */\nexport function snapToGuides<TPose extends { x: number; y: number }>(\n args: Omit<SnapToGuidesMoveArgs<TPose>, 'origin'>,\n): MoveBehavior<TPose>;\n/** As above, for a `TPose` that is not a rect: `origin` tells the behavior how\n * to read and write the pose's origin. */\nexport function snapToGuides<TPose>(\n args: SnapToGuidesMoveArgs<TPose> & { origin: OriginProjection<TPose> },\n): MoveBehavior<TPose>;\n/** Snap the dragged pose's origin to the nearest guide line, per axis. */\nexport function snapToGuides<TPose>(\n args: SnapToGuidesMoveArgs<TPose>,\n): MoveBehavior<TPose> {\n const strategy = guideSnapStrategy<TPose>(args.getGuides, {\n tolerance: args.tolerance,\n getView: args.getView,\n origin: args.origin as OriginProjection<TPose>,\n });\n return snap(strategy, { bypassKey: args.bypassKey });\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/interactions/actions/move/behaviors/snapToGrid.ts","../src/interactions/actions/move/behaviors/snapToContainer.ts","../src/interactions/actions/move/behaviors/snapBackOrDelete.ts","../src/interactions/actions/move/behaviors/snapToGuides.ts"],"names":["snap","scratchKey","setScratch","getScratch"],"mappings":";;;;;;;AAQO,SAAS,WAAmD,IAAA,EAG3C;AACtB,EAAA,OAAO,IAAA,CAAK,iBAAwB,IAAA,CAAK,OAAO,GAAG,EAAE,SAAA,E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AK,EAAE,EAAA,EAAG;AACvC,QAAA,MAAM,KAAA,GAAQ,OAAA,EAAS,GAAA,CAAI,EAAE,CAAA,IAAK,EAAA;AAClC,QAAA,MAAM,GAAA,GAAY,CAAC,cAAA,CAAe,EAAE,IAAA,EAAM,KAAK,KAAA,EAAO,WAAA,EAAa,KAAA,EAAO,CAAC,CAAA;AAC3E,QAAA,OAAO,GAAA;AAAA,MACT;AAIA,MAAA,OAAO,IAAA;AAAA,IACT;AAAA,GACF;AACF;;;ACjDO,SAAS,aACd,IAAA,EACqB;AACrB,EAAA,MAAM,QAAA,GAAW,iBAAA,CAAyB,IAAA,CAAK,SAAA,EAAW;AAAA,IACxD,WAAW,IAAA,CAAK,SAAA;AAAA,IAChB,SAAS,IAAA,CAAK,OAAA;AAAA,IACd,QAAQ,IAAA,CAAK;AAAA,GACd,CAAA;AACD,EAAA,OAAO,KAAK,QAAA,EAAU,EAAE,SAAA,EAAW,IAAA,CAAK,WAAW,CAAA;AACrD","file":"move.js","sourcesContent":["import type { ModifierState, MoveBehavior } from '../../../gestures/types';\nimport { snap } from '../../../gestures/shared/snap';\nimport { gridSnapStrategy } from '../../../gestures/shared/strategies/grid';\n\ntype ModKey = keyof ModifierState;\n\n/** Move behavior that snaps the dragged pose's origin to a grid. Hold\n * `bypassKey` to drag freely. */\nexport function snapToGrid<TPose extends { x: number; y: number }>(args: {\n spacing: number;\n bypassKey?: ModKey;\n}): MoveBehavior<TPose> {\n return snap(gridSnapStrategy<TPose>(args.spacing), { bypassKey: args.bypassKey });\n}\n","import { createTransformOp } from 'core/ops/transform';\nimport { createReparentOp } from 'core/ops/reparent';\nimport type { Op } from 'core/ops/types';\nimport type { SnapTarget } from 'core/adapters/types';\nimport type { MoveBehavior, GestureContext } from '../../../gestures/types';\nimport { scratchKey, getScratch, setScratch } from '@weasel-js/routing';\n\ninterface SnapState<TPose> {\n pendingTargetId: string | null;\n pendingTimer: ReturnType<typeof setTimeout> | null;\n committedSnap: SnapTarget<TPose> | null;\n}\n\n// The slot is generic over TPose; we keep the unknown-pose key at module\n// scope and project it through `as` at the read site (each consumer call\n// of `snapToContainer<TPose>` is the only writer of its own SnapState\n// instance, so the cast is safe at runtime).\nconst STATE = scratchKey<SnapState<unknown>>('snapToContainer');\n\nfunction getState<TPose>(ctx: GestureContext<TPose>): SnapState<TPose> {\n let s = getScratch(ctx.scratch, STATE) as SnapState<TPose> | undefined;\n if (!s) {\n s = { pendingTargetId: null, pendingTimer: null, committedSnap: null };\n setScratch(ctx.scratch, STATE, s as SnapState<unknown>);\n }\n return s;\n}\n\nfunction clearTimer<TPose>(s: SnapState<TPose>) {\n if (s.pendingTimer !== null) {\n clearTimeout(s.pendingTimer);\n s.pendingTimer = null;\n }\n s.pendingTargetId = null;\n}\n\n/**\n * Move behavior that drops the dragged node into a container it hovers over\n * for `dwellMs`, reparenting it and taking the pose the container's layout\n * assigns.\n *\n * The dwell is what keeps a drag that merely passes over a container from\n * being captured by it.\n */\nexport function snapToContainer<TPose>(args: {\n dwellMs: number;\n findTarget: (\n draggedId: string,\n worldX: number,\n worldY: number,\n ) => SnapTarget<TPose> | null;\n isInstant?: (target: SnapTarget<TPose>) => boolean;\n moveLabel?: string;\n reparentLabel?: string;\n}): MoveBehavior<TPose> {\n const { dwellMs, findTarget, isInstant, moveLabel = 'Move', reparentLabel = 'Move and reparent' } = args;\n\n return {\n onMove(ctx, _proposed) {\n const s = getState<TPose>(ctx);\n const target = findTarget(ctx.draggedIds[0], ctx.pointer.worldX, ctx.pointer.worldY);\n\n if (s.committedSnap) {\n if (target && target.parentId === s.committedSnap.parentId) {\n return { pose: s.committedSnap.slotPose, snap: s.committedSnap };\n }\n s.committedSnap = null;\n }\n\n if (!target) {\n clearTimer(s);\n return;\n }\n\n if (isInstant?.(target)) {\n clearTimer(s);\n s.committedSnap = target;\n return { pose: target.slotPose, snap: target };\n }\n\n if (s.pendingTargetId === target.parentId) {\n return;\n }\n clearTimer(s);\n s.pendingTargetId = target.parentId;\n s.pendingTimer = setTimeout(() => {\n s.committedSnap = target;\n s.pendingTimer = null;\n }, dwellMs);\n return;\n },\n\n onEnd(ctx) {\n const s = getState<TPose>(ctx);\n clearTimer(s);\n const snap = s.committedSnap ?? ctx.snap;\n if (!snap) return;\n const draggedId = ctx.draggedIds[0];\n const oldParent = ctx.adapter.getParent?.(draggedId) ?? null;\n const fromPose = ctx.origin.get(draggedId)!;\n const ops: Op[] = [\n createTransformOp<TPose>({\n id: draggedId,\n from: fromPose,\n to: snap.slotPose,\n label: moveLabel,\n }),\n ];\n if (oldParent !== snap.parentId) {\n ops.push(createReparentOp({\n id: draggedId,\n fromParentId: oldParent,\n toParentId: snap.parentId,\n label: reparentLabel,\n }));\n }\n return ops;\n },\n };\n}\n","import { createDeleteOp } from 'core/ops/delete';\nimport type { Op } from 'core/ops/types';\nimport type { MoveBehavior } from '../../../gestures/types';\nimport {\n AUTO_ORIGIN_PROJECTION,\n type OriginProjection,\n} from '../../../gestures/shared/strategies';\nimport { scratchKey, getScratch, setScratch } from '@weasel-js/routing';\n\nconst SNAPSHOTS = scratchKey<Map<string, { id: string }>>('snapBackOrDelete.snapshots');\nconst INDEXES = scratchKey<Map<string, number>>('snapBackOrDelete.indexes');\n\n/**\n * Move behavior for a drag that is only meaningful near where it started:\n * release inside `radius` and the node returns to its original pose; release\n * outside it and the node either springs back anyway or is deleted, per\n * `onFreeRelease`. A deletion is recorded as an undoable op with paint order\n * preserved.\n */\nexport function snapBackOrDelete<TPose extends { x: number; y: number }>(args: {\n radius: number;\n onFreeRelease: 'snap-back' | 'delete';\n deleteLabel?: string;\n}): MoveBehavior<TPose>;\n/** As above, for a `TPose` that is not a rect: `origin` tells the behavior how\n * to read and write the pose's origin. */\nexport function snapBackOrDelete<TPose>(args: {\n radius: number;\n onFreeRelease: 'snap-back' | 'delete';\n deleteLabel?: string;\n origin: OriginProjection<TPose>;\n}): MoveBehavior<TPose>;\n/** Snap back to the origin pose, or delete, depending on where the drag is\n * released. */\nexport function snapBackOrDelete<TPose>(args: {\n radius: number;\n onFreeRelease: 'snap-back' | 'delete';\n deleteLabel?: string;\n origin?: OriginProjection<TPose>;\n}): MoveBehavior<TPose> {\n const { radius, onFreeRelease, deleteLabel = 'Delete' } = args;\n const proj: OriginProjection<TPose> =\n args.origin ?? (AUTO_ORIGIN_PROJECTION as unknown as OriginProjection<TPose>);\n const r2 = radius * radius;\n\n return {\n onStart(ctx) {\n // Snapshot the dragged objects + their z-indexes at gesture start so\n // delete can undo with paint order intact.\n const snapshots = new Map<string, { id: string }>();\n const indexes = new Map<string, number>();\n const nodes = ctx.adapter.getNodes();\n for (const id of ctx.draggedIds) {\n const obj = ctx.adapter.getNode(id) ?? { id };\n snapshots.set(id, obj);\n indexes.set(id, nodes.findIndex((n) => n.id === id));\n }\n setScratch(ctx.scratch, SNAPSHOTS, snapshots);\n setScratch(ctx.scratch, INDEXES, indexes);\n },\n\n onEnd(ctx) {\n if (ctx.snap) return;\n const id = ctx.draggedIds[0];\n const o0 = proj.getOrigin(ctx.origin.get(id)!);\n const o1 = proj.getOrigin(ctx.current.get(id)!);\n const dx = o1.x - o0.x;\n const dy = o1.y - o0.y;\n const within = dx * dx + dy * dy <= r2;\n if (within) {\n return null;\n }\n if (onFreeRelease === 'delete') {\n const snapshots = getScratch(ctx.scratch, SNAPSHOTS);\n const indexes = getScratch(ctx.scratch, INDEXES);\n const obj = snapshots?.get(id) ?? { id };\n const index = indexes?.get(id) ?? -1;\n const ops: Op[] = [createDeleteOp({ node: obj, label: deleteLabel, index })];\n return ops;\n }\n // `'snap-back'` — abort, same as a release inside the radius. Returning\n // `undefined` would defer to the default translate and leave the node\n // where it was dropped, which is the one thing this policy rules out.\n return null;\n },\n };\n}\n","import type { ModifierState, MoveBehavior } from '../../../gestures/types';\nimport type { Guide } from 'features/guides/types';\nimport type { View } from 'core/viewport/view';\nimport type { OriginProjection } from '../../../gestures/shared/strategies/grid';\nimport { snap } from '../../../gestures/shared/snap';\nimport { guideSnapStrategy } from '../../../gestures/shared/strategies/guides';\n\ntype ModKey = keyof ModifierState;\n\n/** Options for the move-flavored `snapToGuides`. */\nexport interface SnapToGuidesMoveArgs<TPose> {\n /** Stable getter into the live guide list (typically from `useGuides`). */\n getGuides: () => readonly Guide[];\n /** Snap tolerance (screen px when `getView` is set, world units otherwise). */\n tolerance?: number;\n /** Read the active view; required for screen-pixel tolerance. */\n getView?: () => View;\n /** Modifier key that bypasses snapping while held. */\n bypassKey?: ModKey;\n /** Origin projection for non-rect TPose (e.g. Path). */\n origin?: OriginProjection<TPose>;\n}\n\n/**\n * Move behavior that snaps the dragged pose's origin to the nearest world-space\n * guide line within `tolerance`. Closest-guide-per-axis wins; the two axes are\n * considered independently. Pair with `useGuides` and `createGuidesLayer`.\n */\nexport function snapToGuides<TPose extends { x: number; y: number }>(\n args: Omit<SnapToGuidesMoveArgs<TPose>, 'origin'>,\n): MoveBehavior<TPose>;\n/** As above, for a `TPose` that is not a rect: `origin` tells the behavior how\n * to read and write the pose's origin. */\nexport function snapToGuides<TPose>(\n args: SnapToGuidesMoveArgs<TPose> & { origin: OriginProjection<TPose> },\n): MoveBehavior<TPose>;\n/** Snap the dragged pose's origin to the nearest guide line, per axis. */\nexport function snapToGuides<TPose>(\n args: SnapToGuidesMoveArgs<TPose>,\n): MoveBehavior<TPose> {\n const strategy = guideSnapStrategy<TPose>(args.getGuides, {\n tolerance: args.tolerance,\n getView: args.getView,\n origin: args.origin as OriginProjection<TPose>,\n });\n return snap(strategy, { bypassKey: args.bypassKey });\n}\n"]}
|
package/dist/patterns-builtin.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { chunks, crosshatch, dots, drawTileShapes, hatch, tileGeometry, tileSize } from './chunk-
|
|
1
|
+
export { chunks, crosshatch, dots, drawTileShapes, hatch, tileGeometry, tileSize } from './chunk-3TY6FHAF.js';
|
|
2
2
|
//# sourceMappingURL=patterns-builtin.js.map
|
|
3
3
|
//# sourceMappingURL=patterns-builtin.js.map
|
|
@@ -1,5 +1,56 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { B as BoundsConstraint, P as PointSnapBehavior, a as PointSnapFrame } from './types-qYpyTAiZ.js';
|
|
2
|
+
import { Bounds, ResizeAnchor, ModifierState } from '@weasel-js/routing';
|
|
3
|
+
|
|
4
|
+
/** Option surface for the `resize` action. */
|
|
5
|
+
|
|
6
|
+
/** Options for the `resize` action: the constraints applied to the dragged
|
|
7
|
+
* bounding box, how a gesture expands a group into its leaves, and its
|
|
8
|
+
* history and lifecycle. `<SceneCanvas>` publishes them as the
|
|
9
|
+
* `resizePolicy` dep (`resizePolicyOptions`). */
|
|
10
|
+
interface UseResizeOptions<TPose> {
|
|
11
|
+
/** Behaviors are rect-typed: they read/write `{x,y,width,height}`. For a
|
|
12
|
+
* non-rect `TPose`, constraints are typed `never`; the pose descriptor
|
|
13
|
+
* comes from `<SceneCanvas poseDescriptor>`. */
|
|
14
|
+
behaviors?: TPose extends Bounds ? BoundsConstraint<TPose>[] : never;
|
|
15
|
+
/** History label for the committed resize. Default `'Resize'`. */
|
|
16
|
+
resizeLabel?: string;
|
|
17
|
+
/** Commit without an undo entry (`scene.untracked`), bypassing the
|
|
18
|
+
* consumer `applyOps` hook. Unset, a behavior's `defaultTransient` decides. */
|
|
19
|
+
transient?: boolean;
|
|
20
|
+
/** Fired when the resize starts, with the ids it writes. */
|
|
21
|
+
onGestureStart?: (ids: string[]) => void;
|
|
22
|
+
/** Fired once per `onGestureStart`: `true` when the resize wrote to the
|
|
23
|
+
* document, `false` on cancel, a behavior abort, or no change. */
|
|
24
|
+
onGestureEnd?: (committed: boolean) => void;
|
|
25
|
+
/** Optional: expand the incoming id into leaf ids before pose lookups.
|
|
26
|
+
* Used for group expansion: when the
|
|
27
|
+
* gesture is started against a group id, the kit
|
|
28
|
+
* resizes by computing the union AABB of the leaves' origin bounds,
|
|
29
|
+
* running the compute pipeline on that union rect (group bounds), and
|
|
30
|
+
* remapping each leaf via `geometry.remapBounds(leaf, originGroupBounds,
|
|
31
|
+
* proposedGroupBounds)`.
|
|
32
|
+
*
|
|
33
|
+
* When `expandIds` is omitted or returns the original single id, the
|
|
34
|
+
* gesture takes the single-leaf path (the leaf's own bounds become both
|
|
35
|
+
* the origin and the target of the same `remapBounds` call).
|
|
36
|
+
*
|
|
37
|
+
* Called once at `start()`. Returning `[]` aborts the gesture cleanly. */
|
|
38
|
+
expandIds?: (ids: string[]) => string[];
|
|
39
|
+
/** Behaviors that operate on world-space anchor points. Fire after
|
|
40
|
+
* `behaviors[]` (bounds-frame). Each behavior receives a `PointSnapContext`
|
|
41
|
+
* with world-space frame points and returns at most one `PointSnapResult`;
|
|
42
|
+
* the hook back-solves the local pose so the chosen frame's world point
|
|
43
|
+
* lands on the snap target. First non-null result wins. */
|
|
44
|
+
pointSnapBehaviors?: TPose extends Bounds ? PointSnapBehavior<TPose>[] : never;
|
|
45
|
+
/** Per-node resizability predicate. Returns `false` for nodes that should
|
|
46
|
+
* never show resize handles (and thus can't start a resize gesture) — e.g.
|
|
47
|
+
* fixed-footprint icons, locked layers. `<SceneCanvas>` folds this over the
|
|
48
|
+
* current selection into the `selectionResizable` rule-ctx flag, so the
|
|
49
|
+
* default `selection.resize-handles` chrome rule hides handles whenever any
|
|
50
|
+
* selected node is non-resizable (which also disables the affordance, since
|
|
51
|
+
* visible==hittable). Default: every node resizable. */
|
|
52
|
+
resizable?: (id: string) => boolean;
|
|
53
|
+
}
|
|
3
54
|
|
|
4
55
|
/** Corner resize-handle: world-space center plus the anchor that pins the opposite corner during resize. */
|
|
5
56
|
interface CornerHandle {
|
|
@@ -63,64 +114,6 @@ declare function fixedCornerOf(bounds: Bounds, anchor: ResizeAnchor): {
|
|
|
63
114
|
y: number;
|
|
64
115
|
};
|
|
65
116
|
|
|
66
|
-
/** Option surface for the `resize` action.
|
|
67
|
-
*
|
|
68
|
-
* Lives in a sibling file (not `resize.ts`) so the type contract stays stable
|
|
69
|
-
* even after the legacy `useResize` hook is gone.
|
|
70
|
-
* Consumers should import from here directly; `resize.ts` re-exports the
|
|
71
|
-
* same symbol for back-compat. */
|
|
72
|
-
|
|
73
|
-
/** Options for the `resize` action: the constraints applied to the dragged
|
|
74
|
-
* bounding box, and how a gesture expands a group into its leaves. */
|
|
75
|
-
interface UseResizeOptions<TPose> {
|
|
76
|
-
/** Behaviors are rect-typed: they read/write `{x,y,width,height}`. For a
|
|
77
|
-
* non-rect `TPose`, constraints are typed `never`; the pose descriptor
|
|
78
|
-
* comes from `<SceneCanvas poseDescriptor>`. */
|
|
79
|
-
behaviors?: TPose extends Bounds ? BoundsConstraint<TPose>[] : never;
|
|
80
|
-
resizeLabel?: string;
|
|
81
|
-
/** Reserved; resize is never transient in practice. Ignored. */
|
|
82
|
-
transient?: boolean;
|
|
83
|
-
onGestureStart?: (id: string) => void;
|
|
84
|
-
onGestureEnd?: (committed: boolean) => void;
|
|
85
|
-
/** Optional: expand the incoming id into leaf ids before pose lookups.
|
|
86
|
-
* Mirrors `useMove`'s `expandIds`. Used for group expansion: when the
|
|
87
|
-
* gesture is started against a group id, the kit
|
|
88
|
-
* resizes by computing the union AABB of the leaves' origin bounds,
|
|
89
|
-
* running the compute pipeline on that union rect (group bounds), and
|
|
90
|
-
* remapping each leaf via `geometry.remapBounds(leaf, originGroupBounds,
|
|
91
|
-
* proposedGroupBounds)`.
|
|
92
|
-
*
|
|
93
|
-
* When `expandIds` is omitted or returns the original single id, the
|
|
94
|
-
* gesture takes the single-leaf path (the leaf's own bounds become both
|
|
95
|
-
* the origin and the target of the same `remapBounds` call).
|
|
96
|
-
*
|
|
97
|
-
* Called once at `start()`. Returning `[]` aborts the gesture cleanly. */
|
|
98
|
-
expandIds?: (ids: string[]) => string[];
|
|
99
|
-
/** Behaviors that operate on world-space anchor points. Fire after
|
|
100
|
-
* `behaviors[]` (bounds-frame). Each behavior receives a `PointSnapContext`
|
|
101
|
-
* with world-space frame points and returns at most one `PointSnapResult`;
|
|
102
|
-
* the hook back-solves the local pose so the chosen frame's world point
|
|
103
|
-
* lands on the snap target. First non-null result wins. */
|
|
104
|
-
pointSnapBehaviors?: TPose extends Bounds ? PointSnapBehavior<TPose>[] : never;
|
|
105
|
-
/** Optional debug sink. When supplied, records corner-handle positions +
|
|
106
|
-
* circular hitboxes when the gesture starts (covers the on-screen
|
|
107
|
-
* handles for the resized target). Tree-shakes via optional-chain
|
|
108
|
-
* when omitted. */
|
|
109
|
-
debug?: DebugSink;
|
|
110
|
-
/** Hit-test radius for corner handles, in screen pixels. Used purely for
|
|
111
|
-
* the recorded debug hitbox circle radius — does not affect actual hit
|
|
112
|
-
* math (which lives in `usePointerGestures`). Default `8`. */
|
|
113
|
-
handleHitRadius?: number;
|
|
114
|
-
/** Per-node resizability predicate. Returns `false` for nodes that should
|
|
115
|
-
* never show resize handles (and thus can't start a resize gesture) — e.g.
|
|
116
|
-
* fixed-footprint icons, locked layers. `<SceneCanvas>` folds this over the
|
|
117
|
-
* current selection into the `selectionResizable` rule-ctx flag, so the
|
|
118
|
-
* default `selection.resize-handles` chrome rule hides handles whenever any
|
|
119
|
-
* selected node is non-resizable (which also disables the affordance, since
|
|
120
|
-
* visible==hittable). Default: every node resizable. */
|
|
121
|
-
resizable?: (id: string) => boolean;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
117
|
/** Resize behavior that snaps one reference point of the resize — the dragged
|
|
125
118
|
* corner, the fixed corner, or the center, per `frame` — to a grid, moving
|
|
126
119
|
* the whole pose by the same delta. Unlike the bounds-level `snapToGrid`,
|
package/dist/renderer.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* src/canvas/
|
|
1
|
+
/* src/canvas/hud.module.css */
|
|
2
2
|
.hud {
|
|
3
3
|
position: fixed;
|
|
4
4
|
z-index: 10000;
|
|
@@ -14,17 +14,24 @@
|
|
|
14
14
|
pointer-events: none;
|
|
15
15
|
line-height: 1.4;
|
|
16
16
|
text-align: right;
|
|
17
|
+
}
|
|
18
|
+
.sized {
|
|
17
19
|
min-width: 120px;
|
|
18
20
|
max-width: 260px;
|
|
19
21
|
}
|
|
20
|
-
.
|
|
22
|
+
.pre {
|
|
23
|
+
white-space: pre;
|
|
24
|
+
}
|
|
25
|
+
.muted {
|
|
21
26
|
color: #888;
|
|
22
|
-
margin-bottom: 2px;
|
|
23
27
|
}
|
|
24
|
-
.
|
|
28
|
+
.absent {
|
|
25
29
|
color: #888;
|
|
26
30
|
font-style: italic;
|
|
27
31
|
}
|
|
32
|
+
.header {
|
|
33
|
+
margin-bottom: 2px;
|
|
34
|
+
}
|
|
28
35
|
.list {
|
|
29
36
|
list-style: none;
|
|
30
37
|
margin: 0;
|
|
@@ -41,46 +48,15 @@
|
|
|
41
48
|
.itemBest {
|
|
42
49
|
font-weight: 700;
|
|
43
50
|
}
|
|
44
|
-
|
|
45
|
-
/* src/canvas/ModalityHud.module.css */
|
|
46
|
-
.hud {
|
|
47
|
-
position: fixed;
|
|
48
|
-
z-index: 10000;
|
|
49
|
-
background: rgba(0, 0, 0, 0.7);
|
|
50
|
-
color: #e8e8e8;
|
|
51
|
-
font:
|
|
52
|
-
11px ui-monospace,
|
|
53
|
-
SFMono-Regular,
|
|
54
|
-
Menlo,
|
|
55
|
-
monospace;
|
|
56
|
-
padding: 6px 8px;
|
|
57
|
-
border-radius: 4px;
|
|
58
|
-
pointer-events: none;
|
|
59
|
-
line-height: 1.4;
|
|
60
|
-
text-align: right;
|
|
61
|
-
min-width: 120px;
|
|
62
|
-
max-width: 260px;
|
|
63
|
-
}
|
|
64
51
|
.row {
|
|
65
52
|
display: flex;
|
|
66
53
|
gap: 8px;
|
|
67
54
|
justify-content: flex-end;
|
|
68
55
|
white-space: nowrap;
|
|
69
56
|
}
|
|
70
|
-
.label {
|
|
71
|
-
color: #888;
|
|
72
|
-
}
|
|
73
|
-
.value {
|
|
74
|
-
color: #e8e8e8;
|
|
75
|
-
}
|
|
76
|
-
.valueMuted {
|
|
77
|
-
color: #888;
|
|
78
|
-
font-style: italic;
|
|
79
|
-
}
|
|
80
57
|
.stack {
|
|
81
58
|
display: flex;
|
|
82
59
|
flex-direction: column;
|
|
83
|
-
gap: 0;
|
|
84
60
|
align-items: flex-end;
|
|
85
61
|
}
|
|
86
62
|
/*# sourceMappingURL=renderer.css.map */
|
package/dist/renderer.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/canvas/
|
|
1
|
+
{"version":3,"sources":["../src/canvas/hud.module.css"],"sourcesContent":["/* The debug HUDs <Canvas> can draw: CursorCoordsHud, PickHud, ModalityHud. */\n.hud {\n position: fixed;\n z-index: 10000;\n background: rgba(0, 0, 0, 0.7);\n color: #e8e8e8;\n font: 11px ui-monospace, SFMono-Regular, Menlo, monospace;\n padding: 6px 8px;\n border-radius: 4px;\n pointer-events: none;\n line-height: 1.4;\n text-align: right;\n}\n\n.sized {\n min-width: 120px;\n max-width: 260px;\n}\n\n.pre {\n white-space: pre;\n}\n\n.muted {\n color: #888;\n}\n\n/* A value that is not there: an em dash, \"off-canvas\". */\n.absent {\n color: #888;\n font-style: italic;\n}\n\n.header {\n margin-bottom: 2px;\n}\n\n.list {\n list-style: none;\n margin: 0;\n padding: 0;\n display: flex;\n flex-direction: column;\n gap: 1px;\n}\n\n.item {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.itemBest {\n font-weight: 700;\n}\n\n.row {\n display: flex;\n gap: 8px;\n justify-content: flex-end;\n white-space: nowrap;\n}\n\n.stack {\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n}\n"],"mappings":";AACA,CAAC;AACC,YAAU;AACV,WAAS;AACT,cAAY,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;AAC1B,SAAO;AACP;AAAA,IAAM,KAAK,YAAY;AAAA,IAAE,cAAc;AAAA,IAAE,KAAK;AAAA,IAAE;AAChD,WAAS,IAAI;AACb,iBAAe;AACf,kBAAgB;AAChB,eAAa;AACb,cAAY;AACd;AAEA,CAAC;AACC,aAAW;AACX,aAAW;AACb;AAEA,CAAC;AACC,eAAa;AACf;AAEA,CAAC;AACC,SAAO;AACT;AAGA,CAAC;AACC,SAAO;AACP,cAAY;AACd;AAEA,CAAC;AACC,iBAAe;AACjB;AAEA,CAAC;AACC,cAAY;AACZ,UAAQ;AACR,WAAS;AACT,WAAS;AACT,kBAAgB;AAChB,OAAK;AACP;AAEA,CAAC;AACC,eAAa;AACb,YAAU;AACV,iBAAe;AACjB;AAEA,CAAC;AACC,eAAa;AACf;AAEA,CAAC;AACC,WAAS;AACT,OAAK;AACL,mBAAiB;AACjB,eAAa;AACf;AAEA,CAAC;AACC,WAAS;AACT,kBAAgB;AAChB,eAAa;AACf;","names":[]}
|
package/dist/renderer.d.ts
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import { M as Mesh } from './
|
|
2
|
-
export { C as CullRect, D as DrawCommand, E as Effect, G as GlMat3, a as GroupDrawCommand, I as IDENTITY_COLOR_MATRIX, b as ImageDrawCommand, c as ImageMinification, P as PathDrawCommand, R as RenderTarget, S as SPRITE_STRIDE,
|
|
1
|
+
import { M as Mesh } from './builtins-DLn2lCr_.js';
|
|
2
|
+
export { C as CullRect, D as DrawCommand, E as Effect, G as GlMat3, a as GroupDrawCommand, I as IDENTITY_COLOR_MATRIX, b as ImageDrawCommand, c as ImageMinification, P as PathDrawCommand, d as ProgramSource, R as RenderTarget, S as SPRITE_STRIDE, e as ShaderCompileError, f as ShaderDrawCommand, g as ShaderProgramHandle, h as ShaderUniform, i as SolidPaint, j as SpriteSheet, k as SpritesDrawCommand, l as StrokeOptions, T as TextDrawCommand, W as WeaselRenderer, m as WeaselRendererOptions, n as blur, o as buildGradientRamp, p as cullDrawCommands, q as frameRect, r as mat3, s as programSourceRegistry, t as registerEffect, u as registerProgram, v as tessellateStroke, w as viewToMat3, x as vignette } from './builtins-DLn2lCr_.js';
|
|
3
3
|
import { P as Path } from './path-JEV2c5If.js';
|
|
4
|
-
export { canQueryLocalFonts, enableLocalFontOutlines, hasFontOutlines, isCanvasFont, listFontOutlines, outlineStatus, registerCanvasFont, registerFont, registerFontOutlines, subscribeGlyphReady, unregisterCanvasFont, unregisterFontOutlines } from '@weasel-js/font';
|
|
4
|
+
export { canQueryLocalFonts, enableLocalFontOutlines, fontOutlineRegistry, fontRegistry, hasFontOutlines, isCanvasFont, listFontOutlines, outlineStatus, registerCanvasFont, registerFont, registerFontOutlines, subscribeGlyphReady, unregisterCanvasFont, unregisterFontOutlines } from '@weasel-js/font';
|
|
5
5
|
import { TextureHandle } from '@weasel-js/paint';
|
|
6
6
|
export { TextureHandle } from '@weasel-js/paint';
|
|
7
|
+
import { Reflection } from '@weasel-js/registry';
|
|
7
8
|
export { View as ViewLike } from '@weasel-js/routing';
|
|
8
|
-
import '
|
|
9
|
-
import '@weasel-js/geom';
|
|
9
|
+
import 'react';
|
|
10
10
|
import '@weasel-js/history';
|
|
11
|
-
import './types-
|
|
11
|
+
import './types-D-9QWBy5.js';
|
|
12
12
|
import './poseDescriptor-rZa9W5hJ.js';
|
|
13
13
|
import '@weasel-js/routing/react';
|
|
14
|
-
import './types-
|
|
14
|
+
import './types-qYpyTAiZ.js';
|
|
15
|
+
import '@weasel-js/geom';
|
|
16
|
+
import '@weasel-js/text';
|
|
17
|
+
import '@weasel-js/cursor';
|
|
18
|
+
import '@weasel-js/gestures';
|
|
15
19
|
|
|
16
20
|
/**
|
|
17
21
|
* registerTexture — accepts an image source, assigns an opaque id, stores in
|
|
@@ -24,6 +28,11 @@ import './types-D_74YlWs.js';
|
|
|
24
28
|
* Each WeaselRenderer's GLTextureCache does its own dedup via has(id).
|
|
25
29
|
*/
|
|
26
30
|
|
|
31
|
+
interface TextureEntry {
|
|
32
|
+
source: HTMLImageElement | ImageBitmap;
|
|
33
|
+
}
|
|
34
|
+
/** Every registered texture, keyed by its handle id. */
|
|
35
|
+
declare const textureRegistry: Reflection<TextureEntry>;
|
|
27
36
|
/**
|
|
28
37
|
* Register an image for use as a shader texture uniform.
|
|
29
38
|
*
|
|
@@ -89,4 +98,4 @@ declare const EFFECT_VERT_SRC = "#version 300 es\nin vec2 a_position;\nin vec2 a
|
|
|
89
98
|
* redeclare them with different meanings; it may leave any of them out. */
|
|
90
99
|
declare const EFFECT_KIT_UNIFORMS: readonly ["u_source", "u_resolution", "u_texel"];
|
|
91
100
|
|
|
92
|
-
export { EFFECT_KIT_UNIFORMS, EFFECT_VERT_SRC, Mesh, OUTLINE_MIN_SCREEN_PX, type TessellateOptions, registerTexture, tessellate };
|
|
101
|
+
export { EFFECT_KIT_UNIFORMS, EFFECT_VERT_SRC, Mesh, OUTLINE_MIN_SCREEN_PX, type TessellateOptions, type TextureEntry, registerTexture, tessellate, textureRegistry };
|
package/dist/renderer.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export { EFFECT_KIT_UNIFORMS, EFFECT_VERT_SRC, IDENTITY_COLOR_MATRIX, OUTLINE_MIN_SCREEN_PX, SPRITE_STRIDE, ShaderCompileError, WeaselRenderer, blur, buildGradientRamp, canQueryLocalFonts, cullDrawCommands, enableLocalFontOutlines, frameRect, hasFontOutlines, isCanvasFont, listFontOutlines, mat3, outlineStatus, registerCanvasFont, registerEffect, registerFont, registerFontOutlines, registerProgram, subscribeGlyphReady, tessellate, tessellateStroke, unregisterCanvasFont, unregisterFontOutlines, viewToMat3, vignette } from './chunk-
|
|
1
|
+
export { EFFECT_KIT_UNIFORMS, EFFECT_VERT_SRC, IDENTITY_COLOR_MATRIX, OUTLINE_MIN_SCREEN_PX, SPRITE_STRIDE, ShaderCompileError, WeaselRenderer, blur, buildGradientRamp, canQueryLocalFonts, cullDrawCommands, enableLocalFontOutlines, fontOutlineRegistry, fontRegistry, frameRect, hasFontOutlines, isCanvasFont, listFontOutlines, mat3, outlineStatus, programSourceRegistry, registerCanvasFont, registerEffect, registerFont, registerFontOutlines, registerProgram, subscribeGlyphReady, tessellate, tessellateStroke, unregisterCanvasFont, unregisterFontOutlines, viewToMat3, vignette } from './chunk-G4ZGQMY7.js';
|
|
2
2
|
import './chunk-PNNZSYRD.js';
|
|
3
|
-
import './chunk-
|
|
4
|
-
import './chunk-
|
|
5
|
-
import './chunk-
|
|
3
|
+
import './chunk-XMAWPGTK.js';
|
|
4
|
+
import './chunk-DGWNNKGD.js';
|
|
5
|
+
import './chunk-LU4IJ52W.js';
|
|
6
6
|
import './chunk-L5YNZYEG.js';
|
|
7
|
-
import './chunk-
|
|
8
|
-
import './chunk-
|
|
9
|
-
import './chunk-
|
|
10
|
-
import './chunk-
|
|
11
|
-
export { registerTexture } from './chunk-
|
|
7
|
+
import './chunk-WPNA6L5O.js';
|
|
8
|
+
import './chunk-M24CLARN.js';
|
|
9
|
+
import './chunk-UPZY4ART.js';
|
|
10
|
+
import './chunk-NE27EOLP.js';
|
|
11
|
+
export { registerTexture, textureRegistry } from './chunk-3TY6FHAF.js';
|
|
12
12
|
//# sourceMappingURL=renderer.js.map
|
|
13
13
|
//# sourceMappingURL=renderer.js.map
|
package/dist/resize.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { C as CORNER_ANCHORS, a as CornerAnchor, b as CornerHandle, U as UseResizeOptions, c as cornerPoint, d as cornerResizeHandles, f as fixedCornerOf, h as hitCornerHandle, p as pointSnapToGrid } from './pointSnapToGrid-
|
|
1
|
+
export { C as CORNER_ANCHORS, a as CornerAnchor, b as CornerHandle, U as UseResizeOptions, c as cornerPoint, d as cornerResizeHandles, f as fixedCornerOf, h as hitCornerHandle, p as pointSnapToGrid } from './pointSnapToGrid-Dp2IxLGb.js';
|
|
2
2
|
export { P as PoseDescriptor, R as RECT_POSE_DESCRIPTOR, a as ROTATED_POSE_DESCRIPTOR, p as poseDescriptorForNode } from './poseDescriptor-rZa9W5hJ.js';
|
|
3
|
-
import { B as BoundsConstraint } from './types-
|
|
3
|
+
import { B as BoundsConstraint } from './types-qYpyTAiZ.js';
|
|
4
4
|
import { Bounds, ModifierState, View } from '@weasel-js/routing';
|
|
5
5
|
export { A as AUTO_POSE_DESCRIPTOR, i as isPathLike, a as isRectPose } from './autoPoseDescriptor-_XOyF7t4.js';
|
|
6
6
|
import { G as Guide } from './types-D2tTKEU0.js';
|
|
7
7
|
import '@weasel-js/history';
|
|
8
|
-
import './types-
|
|
8
|
+
import './types-D-9QWBy5.js';
|
|
9
9
|
import './path-JEV2c5If.js';
|
|
10
10
|
|
|
11
11
|
/** Resize constraint that stops a node shrinking past a minimum. The anchored
|
package/dist/resize.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { CORNER_ANCHORS, DEFAULT_RESIZE_BEHAVIORS, clampMinSize, cornerPoint, cornerResizeHandles, fixedCornerOf, hitCornerHandle, lockAspectWithModifier, pointSnapToGrid, snapToGrid, snapToGuides } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { CORNER_ANCHORS, DEFAULT_RESIZE_BEHAVIORS, clampMinSize, cornerPoint, cornerResizeHandles, fixedCornerOf, hitCornerHandle, lockAspectWithModifier, pointSnapToGrid, snapToGrid, snapToGuides } from './chunk-DGWNNKGD.js';
|
|
2
|
+
import './chunk-LU4IJ52W.js';
|
|
3
3
|
export { AUTO_POSE_DESCRIPTOR, RECT_POSE_DESCRIPTOR, ROTATED_POSE_DESCRIPTOR, isPathLike, isRectPose, poseDescriptorForNode } from './chunk-L5YNZYEG.js';
|
|
4
4
|
//# sourceMappingURL=resize.js.map
|
|
5
5
|
//# sourceMappingURL=resize.js.map
|
package/dist/routing.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ChannelRef, Conflict, DescribeRouteOptions, GESTURE_DESCRIPTORS, GestureArgSpec, GestureDescriptor, GestureName, ModRequirement, ModifierKey, PREDICATE_TARGET, ParsedModifiers, ParsedRoute, PhaseAtom, RESERVED_ID_NAMES, RESERVED_ID_PREFIXES, ROUTE_FIELD_DEFINITIONS, ROUTE_TERMS, RegistryEntry, RouteDescriptionPart, RouteFieldName, RouteTermLabel, buildRouteRegistry, canonicalModifiers, collapseShiftPairs, describeRoute, describeRouteParts, findConflicts, formatPhaseAtom, formatRoute, getGestureDescriptor, isKnownGestureName, parseRoute, reportRouteConflicts, routeGestureForSpecKind, routesForSpec } from '@weasel-js/routing';
|
|
1
|
+
export { ChannelRef, Conflict, DescribeRouteOptions, DispatchRecord, DispatchRecordInput, DroppedCandidate, GESTURE_DESCRIPTORS, GestureArgSpec, GestureDescriptor, GestureName, ModRequirement, ModeSwitchLogEntry, ModifierKey, PREDICATE_TARGET, ParsedModifiers, ParsedRoute, PhaseAtom, PlacedBy, RESERVED_ID_NAMES, RESERVED_ID_PREFIXES, ROUTE_FIELD_DEFINITIONS, ROUTE_TERMS, RankedCandidate, RecordCandidate, RegistryEntry, RouteDescriptionPart, RouteFieldName, RouteTermLabel, SpecificityPart, TraceLogEntry, WalkStep, buildRouteRegistry, canonicalModifiers, collapseShiftPairs, describeRoute, describeRouteParts, findConflicts, formatPhaseAtom, formatRoute, getGestureDescriptor, isKnownGestureName, parseRoute, reportRouteConflicts, routeGestureForSpecKind, routesForSpec, specKindForRouteGesture } from '@weasel-js/routing';
|
package/dist/routing.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { GESTURE_DESCRIPTORS, PREDICATE_TARGET, RESERVED_ID_NAMES, RESERVED_ID_PREFIXES, ROUTE_FIELD_DEFINITIONS, ROUTE_TERMS, buildRouteRegistry, canonicalModifiers, collapseShiftPairs, describeRoute, describeRouteParts, findConflicts, formatPhaseAtom, formatRoute, getGestureDescriptor, isKnownGestureName, parseRoute, reportRouteConflicts, routeGestureForSpecKind, routesForSpec } from '@weasel-js/routing';
|
|
1
|
+
export { GESTURE_DESCRIPTORS, PREDICATE_TARGET, RESERVED_ID_NAMES, RESERVED_ID_PREFIXES, ROUTE_FIELD_DEFINITIONS, ROUTE_TERMS, buildRouteRegistry, canonicalModifiers, collapseShiftPairs, describeRoute, describeRouteParts, findConflicts, formatPhaseAtom, formatRoute, getGestureDescriptor, isKnownGestureName, parseRoute, reportRouteConflicts, routeGestureForSpecKind, routesForSpec, specKindForRouteGesture } from '@weasel-js/routing';
|
|
2
2
|
//# sourceMappingURL=routing.js.map
|
|
3
3
|
//# sourceMappingURL=routing.js.map
|
|
@@ -294,16 +294,19 @@ interface AreaSelectAdapter {
|
|
|
294
294
|
}
|
|
295
295
|
/**
|
|
296
296
|
* Hit mode for `LassoSelectAdapter.hitTestLasso`:
|
|
297
|
-
* - 'centers' —
|
|
298
|
-
* - 'intersect' —
|
|
299
|
-
* - 'enclosed' —
|
|
297
|
+
* - 'centers' — the center of the node's visual bounds is inside the polygon.
|
|
298
|
+
* - 'intersect' — the node's outline meets the polygon anywhere.
|
|
299
|
+
* - 'enclosed' — the node's whole outline is inside the polygon.
|
|
300
|
+
*
|
|
301
|
+
* The outline is the drawn silhouette, rotation included. `arrayAdapter`,
|
|
302
|
+
* which has no painters to ask, tests its descriptor's bounds instead.
|
|
300
303
|
*/
|
|
301
304
|
type LassoHitMode = 'centers' | 'intersect' | 'enclosed';
|
|
302
305
|
/**
|
|
303
|
-
* Narrow adapter for
|
|
306
|
+
* Narrow adapter for lasso selection. Extends `AreaSelectAdapter` with a
|
|
304
307
|
* polygon hit-test method. Transient — uses `applyOps` like its rectangular
|
|
305
|
-
* sibling. `hitTestLasso` is optional;
|
|
306
|
-
*
|
|
308
|
+
* sibling. `hitTestLasso` is optional; `selectFromLasso` does nothing
|
|
309
|
+
* without it.
|
|
307
310
|
*/
|
|
308
311
|
interface LassoSelectAdapter extends AreaSelectAdapter {
|
|
309
312
|
/** Hit-test against a closed polygon. Vertex order may be CW or CCW; the
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Op } from '@weasel-js/history';
|
|
2
|
-
import { S as SnapTarget, M as MoveAdapter, I as InsertAdapter } from './types-
|
|
2
|
+
import { S as SnapTarget, M as MoveAdapter, I as InsertAdapter } from './types-D-9QWBy5.js';
|
|
3
3
|
import { Bounds, ModifierState, ResizeAnchor } from '@weasel-js/routing';
|
|
4
4
|
|
|
5
5
|
/** Pointer position in both world and client coords. */
|
|
@@ -46,10 +46,9 @@ interface SnapStrategy<TPose> {
|
|
|
46
46
|
* onEnd is uniform: first non-undefined return wins (Op[] = commit those,
|
|
47
47
|
* null = abort, undefined = defer).
|
|
48
48
|
*
|
|
49
|
-
* `defaultTransient`: when
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* `options.transient` is set explicitly, that value wins.
|
|
49
|
+
* `defaultTransient`: when one behavior of a move, resize or rotate sets it
|
|
50
|
+
* and the binding leaves `transient` unset, the gesture commits through
|
|
51
|
+
* `scene.untracked` (no history entry). An explicit `transient` wins.
|
|
53
52
|
*/
|
|
54
53
|
interface ActionBehavior<TPose, TProposed, TMoveResult> {
|
|
55
54
|
defaultTransient?: boolean;
|
|
@@ -295,8 +294,6 @@ type CloneLayer = 'structures' | 'zones' | 'plantings';
|
|
|
295
294
|
/** A behavior plugged into `useClone`; gates on modifier state and emits ops at gesture end. */
|
|
296
295
|
interface CloneBehavior {
|
|
297
296
|
id: string;
|
|
298
|
-
/** Default true. */
|
|
299
|
-
defaultTransient?: boolean;
|
|
300
297
|
/** Decides whether this gesture should activate at start. */
|
|
301
298
|
activates: (modifiers: ModifierState) => boolean;
|
|
302
299
|
/** On end, returns ops to commit (or [] for no-op). */
|