@weasel-js/core 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { N as NodeId } from './types-DUpI7Apc.js';
1
+ import { N as NodeId } from './types-Kh_osAq9.js';
2
2
  import { C as ClipboardSnapshot, I as InsertAdapter } from './types-B_-khFM0.js';
3
3
  import '@weasel-js/history';
4
4
  import './path-B6MMiodD.js';
@@ -1,4 +1,4 @@
1
- import { N as NodeId, R as RectPose, S as Scene } from './types-DUpI7Apc.js';
1
+ import { N as NodeId, R as RectPose, S as Scene } from './types-Kh_osAq9.js';
2
2
  import { M as ModifierState, A as ActionBehavior, c as ResizeAnchor, R as ResizePose, B as BoundsConstraint, P as PointSnapBehavior } from './types-BhJJ2OCM.js';
3
3
  import { V as View } from './view-DSQgxBJB.js';
4
4
  import { CapabilityTag } from '@weasel-js/modes';
package/dist/index.d.ts CHANGED
@@ -4,14 +4,14 @@ import { a as ViewTransform, V as View, Z as ZoomBound, b as ZoomFactor } from '
4
4
  export { s as screenToWorld, v as viewToTransform, w as worldToScreen } from './view-DSQgxBJB.js';
5
5
  import { a as UnitValue, b as UnitSystem, U as UseMoveOptions, O as OriginProjection } from './grid-XcFQVS0f.js';
6
6
  export { I as IMPERIAL_INCHES, M as METRIC_MM, P as PIXELS, R as RECT_ORIGIN_PROJECTION, c as Unit, f as formatUnit, g as gridSnapStrategy, p as pointToGridCell, r as resolveUnit } from './grid-XcFQVS0f.js';
7
- import { R as RenderLayer, D as Dims, a as DeviceProfile, b as DetectedDeviceFacts, C as Condition, c as Rule, d as RuleCtx, V as VisibilityRules, e as ChromeCtx, f as ChromeId, A as Action, g as DepSchema, S as SliceDep, h as ActionsRegistry, T as Tool, i as AffordanceHit, j as Dispatcher, k as AnyTool, l as ToolCtx, m as ToolKeybinding, H as HotkeyTrigger, L as LayerHit, n as ChromeState, o as SelectionApi, I as InsertExtras, G as GeometryProjection, p as ContentHandlerEntry, q as SvgIngestOptions, U as UseSelectionOptions, r as ActionsProp, s as Affordance, t as AffordanceBinding, u as AffordanceRegion, v as CommonAffordanceScratch, B as BooleansAdapter, E as Eligibility, w as BindingScope, x as Contribution, y as ScopedBinding } from './index-ChM3ZJ2v.js';
8
- export { z as ALWAYS, F as ActionDeps, J as ActionDisabledReason, K as ActionEnabledResult, M as ActionEntry, N as ActionsProvider, O as ActiveToolContextProvider, P as ActiveToolContextProviderIfRoot, Q as ActiveToolContextProviderProps, W as ActiveToolContextValue, X as AreaSelectDep, Y as BindingOpts, Z as BooleanOp, _ as BooleanOpResult, $ as BoundGesture, a0 as BuildRuleCtxArgs, a1 as ClaimableGesture, a2 as ClipboardDep, a3 as ClipboardIngestCtx, a4 as CustomPaintContext, a5 as DepName, a6 as DepRegistry, a7 as DepRegistryProvider, a8 as DispatcherContext, a9 as DragSample, aa as EditAnchorsDep, ab as GestureBinding, ac as IDENTITY_POSE_COMPOSITION, ad as ImmediateInvoker, ae as IngestCtx, af as IngestionDep, ag as InsertDep, ah as InvocationCtx, ai as Invoker, aj as LassoSelectDep, ak as LayoutDep, al as MatchResult, am as NEVER, an as NodeAtPointDep, ao as OngoingHandle, ap as OngoingInvoker, aq as OngoingOverlay, ar as Point2, as as PointerContextProvider, at as PointerContextValue, au as PointerWorldPos, av as PoseAdapter, aw as PoseComposition, ax as ResizePolicy, ay as ResolveAllOptions, az as ResolveOnlyResult, aA as ResolvedCandidate, aB as SelectionExtendKey, aC as SelectionMode, aD as Selector, aE as SnapDep, aF as SvgUnpacker, aG as TextEditDep, aH as ToolModifiers, aI as ToolPresentation, aJ as ToolSlot, aK as UiOngoingControl, aL as ViewApi, aM as applyBooleanOp, aN as buildRuleCtx, aO as clipboardCopyAction, aP as clipboardCutAction, aQ as composeRectPose, aR as composeWorldPose, aS as createDispatcher, aT as decomposeRectPose, aU as describeRule, aV as drawLayers, aW as enterTextEditAction, aX as evaluate, aY as evaluateEnabled, aZ as rebaseLocalPose, a_ as registerContentHandler, a$ as routing, b0 as sliceAction, b1 as specificity, b2 as translateRectPose, b3 as useAction, b4 as useActionsRegistry, b5 as useActiveToolContext, b6 as useDepRegistry, b7 as useDepSource, b8 as useOptionalActiveToolContext, b9 as useOptionalDepRegistry, ba as usePointerContext, bb as useSelection, bc as worldPoseLookup } from './index-ChM3ZJ2v.js';
7
+ import { R as RenderLayer, D as Dims, a as DeviceProfile, b as DetectedDeviceFacts, C as Condition, c as Rule, d as RuleCtx, V as VisibilityRules, e as ChromeCtx, f as ChromeId, A as Action, g as DepSchema, S as SliceDep, h as ActionsRegistry, T as Tool, i as AffordanceHit, j as Dispatcher, k as AnyTool, l as ToolCtx, m as ToolKeybinding, H as HotkeyTrigger, L as LayerHit, n as ChromeState, o as SelectionApi, I as InsertExtras, G as GeometryProjection, p as ContentHandlerEntry, q as SvgIngestOptions, U as UseSelectionOptions, r as ActionsProp, s as Affordance, t as AffordanceBinding, u as AffordanceRegion, v as CommonAffordanceScratch, B as BooleansAdapter, E as Eligibility, w as BindingScope, x as Contribution, y as ScopedBinding } from './index-DPI8DV0A.js';
8
+ export { z as ALWAYS, F as ActionDeps, J as ActionDisabledReason, K as ActionEnabledResult, M as ActionEntry, N as ActionsProvider, O as ActiveToolContextProvider, P as ActiveToolContextProviderIfRoot, Q as ActiveToolContextProviderProps, W as ActiveToolContextValue, X as AreaSelectDep, Y as BindingOpts, Z as BooleanOp, _ as BooleanOpResult, $ as BoundGesture, a0 as BuildRuleCtxArgs, a1 as ClaimableGesture, a2 as ClipboardDep, a3 as ClipboardIngestCtx, a4 as CustomPaintContext, a5 as DepName, a6 as DepRegistry, a7 as DepRegistryProvider, a8 as DispatcherContext, a9 as DragSample, aa as EditAnchorsDep, ab as GestureBinding, ac as IDENTITY_POSE_COMPOSITION, ad as ImmediateInvoker, ae as IngestCtx, af as IngestionDep, ag as InsertDep, ah as InvocationCtx, ai as Invoker, aj as LassoSelectDep, ak as LayoutDep, al as MatchResult, am as NEVER, an as NodeAtPointDep, ao as OngoingHandle, ap as OngoingInvoker, aq as OngoingOverlay, ar as Point2, as as PointerContextProvider, at as PointerContextValue, au as PointerWorldPos, av as PoseAdapter, aw as PoseComposition, ax as ResizePolicy, ay as ResolveAllOptions, az as ResolveOnlyResult, aA as ResolvedCandidate, aB as SelectionExtendKey, aC as SelectionMode, aD as Selector, aE as SnapDep, aF as SvgUnpacker, aG as TextEditDep, aH as ToolModifiers, aI as ToolPresentation, aJ as ToolSlot, aK as UiOngoingControl, aL as ViewApi, aM as applyBooleanOp, aN as buildRuleCtx, aO as clipboardCopyAction, aP as clipboardCutAction, aQ as composeRectPose, aR as composeWorldPose, aS as createDispatcher, aT as decomposeRectPose, aU as describeRule, aV as drawLayers, aW as enterTextEditAction, aX as evaluate, aY as evaluateEnabled, aZ as rebaseLocalPose, a_ as registerContentHandler, a$ as routing, b0 as sliceAction, b1 as specificity, b2 as translateRectPose, b3 as useAction, b4 as useActionsRegistry, b5 as useActiveToolContext, b6 as useDepRegistry, b7 as useDepSource, b8 as useOptionalActiveToolContext, b9 as useOptionalDepRegistry, ba as usePointerContext, bb as useSelection, bc as worldPoseLookup } from './index-DPI8DV0A.js';
9
9
  import { S as Stroke, F as FillStyle, a as TextureHandle, T as TilePatternSpec, b as GradientKind, G as GradStop, c as GradientFill } from './paint-types-CnLIzqq1.js';
10
10
  export { d as GradientUnits, R as Region, e as StrokeAlign, f as alignedStrokeRect } from './paint-types-CnLIzqq1.js';
11
11
  import { B as Bounds, P as PoseProjection, F as FitViewToBoundsOptions, V as ViewportDims } from './geometry-DVeZ2i-c.js';
12
12
  export { R as RECT_POSE_DESCRIPTOR, a as ROTATED_POSE_DESCRIPTOR, f as fitViewToBounds } from './geometry-DVeZ2i-c.js';
13
- import { N as NodeId, S as Scene, a as Node$1, b as SerializedScene, R as RectPose, U as UseSceneOptions, c as SceneRegistry, d as RegisteredOp } from './types-DUpI7Apc.js';
14
- export { A as AddLayerSpec, e as AddNodeSpec, C as ContainerNode, L as LayerRecord, f as LeafNode, g as SerializedNode, h as SystemLayerRecord, i as SystemLayerSpec, j as UserLayerRecord, k as asNodeId } from './types-DUpI7Apc.js';
13
+ import { N as NodeId, S as Scene, a as Node$1, b as SerializedScene, R as RectPose, U as UseSceneOptions, c as SceneRegistry, d as RegisteredOp } from './types-Kh_osAq9.js';
14
+ export { A as AddLayerSpec, e as AddNodeSpec, C as ContainerNode, L as LayerRecord, f as LeafNode, g as SerializedNode, h as SystemLayerRecord, i as SystemLayerSpec, j as UserLayerRecord, k as asNodeId } from './types-Kh_osAq9.js';
15
15
  import { M as ModifierState, R as ResizePose, B as BoundsConstraint, P as PointSnapBehavior, L as LassoSelectBehavior, a as RotatedPose, e as RotateBehavior, S as SnapStrategy, c as ResizeAnchor, b as MoveBehavior, I as InsertBehavior } from './types-BhJJ2OCM.js';
16
16
  export { A as ActionBehavior, f as AreaSelectOverlay, g as BehaviorMoveResult, h as BehaviorResult, C as CloneBehavior, i as CloneLayer, j as ClonePose, G as GestureContext, k as GroupTransform, l as InsertMoveResult, m as InsertOverlay, n as InsertPoint, o as InsertProposed, p as LassoSelectMoveResult, q as LassoSelectOverlay, r as LassoSelectPose, s as LassoSelectProposed, t as PointSnapContext, d as PointSnapFrame, u as PointSnapResult, v as PointerState, w as ResizeMoveResult, x as ResizeOverlay, y as ResizeProposed, z as RotateMoveResult, D as RotateOverlay, E as RotateProposed } from './types-BhJJ2OCM.js';
17
17
  import { U as UseResizeOptions } from './pointSnapToGrid-BuDZWBrL.js';
@@ -1840,7 +1840,7 @@ declare function useStandardActions(opts: UseStandardActionsOptions): void;
1840
1840
 
1841
1841
  declare function defaultCommitAdapter<TPose>(scene: Scene<unknown, string, TPose>): {
1842
1842
  getNode: (id: string) => Node$1<unknown, string, TPose> | undefined;
1843
- getNodes: () => (Node$1<unknown, string, TPose> | undefined)[];
1843
+ getNodes: () => Node$1<unknown, string, TPose>[];
1844
1844
  getPose: (id: string) => TPose;
1845
1845
  getParent: (id: string) => string | null;
1846
1846
  getChildren: (parentId: string | null) => string[];
@@ -4297,9 +4297,10 @@ declare function createNodeRouting(): NodeRouting;
4297
4297
  * visualization even though selection chrome (which reads `pose.rotation`
4298
4298
  * directly) does rotate — the rect sits still while its chrome spins.
4299
4299
  *
4300
- * `wrapWithPoseRotation` is applied inside `buildSceneLayer` (committed
4301
- * paint) and `usePreviewGhostLayer.buildSubtree` (in-flight preview) so
4302
- * both code paths produce rotated geometry uniformly.
4300
+ * `wrapWithPoseRotation` is applied by `wrapNodeOutput` in both scene walks —
4301
+ * `buildSceneLayer` (main canvas) and `buildSceneViewCommands` (detached
4302
+ * renders) and directly by `usePreviewGhostLayer.buildSubtree` (in-flight
4303
+ * preview), so every code path produces rotated geometry uniformly.
4303
4304
  */
4304
4305
 
4305
4306
  /** Rotation matrix about the AABB center of `(x, y, width, height)`. The pivot
@@ -5224,6 +5225,10 @@ interface RenderSceneToCanvasArgs<TData, TLayer extends string, TPose> {
5224
5225
  * minimap's visible-window indicator. Wrapped in the same view transform
5225
5226
  * as scene commands. */
5226
5227
  extraCommands?: DrawCommand[];
5228
+ /** Optional per-id alpha multiplier, mirroring `<SceneCanvas>`'s scene-slot
5229
+ * `alphaFor`. Pass the same function the main canvas uses to keep a
5230
+ * scoping-dim treatment consistent across both. Defaults to `() => 1`. */
5231
+ alphaFor?: (id: string) => number;
5227
5232
  /** Optional device-pixel ratio. Defaults to `window.devicePixelRatio || 1`
5228
5233
  * when available, otherwise 1. Tests typically pin this to 1 or 2. */
5229
5234
  dpr?: number;
@@ -5231,16 +5236,27 @@ interface RenderSceneToCanvasArgs<TData, TLayer extends string, TPose> {
5231
5236
  /**
5232
5237
  * Build the DrawCommand list that `renderSceneToCanvas` would dispatch.
5233
5238
  *
5234
- * Pure — no GL, no DOM, no side effects. Iterates `scene.renderOrder()`,
5235
- * calls `drawOne` per node, appends any `extraCommands`, and wraps the
5236
- * combined list in a single `{ kind: 'group', transform: viewToMat3(view) }`
5237
- * so the output is in screen space.
5239
+ * Pure — no GL, no DOM, no side effects. Walks the scene through
5240
+ * `buildSceneTree` the same walk `<SceneCanvas>`'s `buildSceneLayer` uses
5241
+ * appends any `extraCommands`, and wraps the result in a single
5242
+ * `{ kind: 'group', transform: viewToMat3(view) }` so the output is in screen
5243
+ * space. Sharing the walk is what keeps hidden layers unpainted and container
5244
+ * clips applied here; a hand-rolled `renderOrder()` loop silently dropped both.
5245
+ *
5246
+ * Each node's commands additionally go through `wrapNodeOutput` — pose
5247
+ * rotation, then the `alphaFor` multiplier — exactly as `buildSceneLayer`
5248
+ * does, so a `drawOne` shared between the two paints the same thing in both.
5249
+ * A `drawOne` that rotates its own output will therefore rotate twice here;
5250
+ * emit unrotated geometry and let the pose drive it.
5251
+ *
5252
+ * Output shape follows `buildSceneTree`: one group per **visible** layer, in
5253
+ * scene-layer order, each holding one group per node on that layer.
5238
5254
  *
5239
5255
  * Exported for tests and for callers that want to render into something
5240
5256
  * other than a real `<canvas>` (e.g. an offscreen renderer or a
5241
5257
  * snapshot fixture).
5242
5258
  */
5243
- declare function buildSceneViewCommands<TData, TLayer extends string, TPose>(scene: Scene<TData, TLayer, TPose>, view: View, drawOne: SceneViewDrawOne<TData, TLayer, TPose>, extraCommands?: ReadonlyArray<DrawCommand>): DrawCommand[];
5259
+ declare function buildSceneViewCommands<TData, TLayer extends string, TPose>(scene: Scene<TData, TLayer, TPose>, view: View, drawOne: SceneViewDrawOne<TData, TLayer, TPose>, extraCommands?: ReadonlyArray<DrawCommand>, alphaFor?: (id: string) => number): DrawCommand[];
5244
5260
  /**
5245
5261
  * Render one frame of `scene` at `view` into `canvas`. See module docstring
5246
5262
  * for the design context.
@@ -5279,6 +5295,10 @@ interface SceneViewCanvasProps<TData, TLayer extends string, TPose> {
5279
5295
  * indicator; available to other consumers that want to overlay a
5280
5296
  * world-space annotation. */
5281
5297
  extraCommands?: ReadonlyArray<DrawCommand>;
5298
+ /** Optional per-id alpha multiplier, mirroring `<SceneCanvas>`'s scene-slot
5299
+ * `alphaFor`. Pass the same function the main canvas uses to keep a
5300
+ * scoping-dim treatment consistent across both. Defaults to `() => 1`. */
5301
+ alphaFor?: (id: string) => number;
5282
5302
  /** Optional CSS class for sizing / positioning the `<canvas>`. The kit
5283
5303
  * does not emit inline styles for layout — use a class. */
5284
5304
  className?: string;
@@ -5450,6 +5470,10 @@ interface MinimapCanvasProps<TData, TLayer extends string, TPose> {
5450
5470
  /** Pose → AABB. Defaults to identity (`pose as Bounds`), matching
5451
5471
  * `sceneAdapter` / `useSelectTool`. */
5452
5472
  poseBounds?: (pose: TPose) => Bounds;
5473
+ /** Optional per-id alpha multiplier, mirroring `<SceneCanvas>`'s scene-slot
5474
+ * `alphaFor`. Pass the same function the main canvas uses so a
5475
+ * scoping-dim treatment shows up in the minimap too. */
5476
+ alphaFor?: (id: string) => number;
5453
5477
  /** Visual tuning of the indicator stroke. */
5454
5478
  indicatorStyle?: IndicatorStyle;
5455
5479
  /** CSS class for sizing / positioning the canvas. */
@@ -5507,6 +5531,10 @@ interface RenderSceneToPixelsArgs<TData, TLayer extends string, TPose> {
5507
5531
  * caches. `undefined` results paint the deterministic grey placeholder
5508
5532
  * outline (see `NodePaintCtx.resolveImage`). */
5509
5533
  resolveImage?: (node: Node$1<TData, TLayer, TPose>) => ImageBitmap | undefined;
5534
+ /** Per-id alpha multiplier, mirroring `<SceneCanvas>`'s scene-slot
5535
+ * `alphaFor`. Pass the same function the on-screen canvas uses so an
5536
+ * export matches what the user is looking at. Defaults to `() => 1`. */
5537
+ alphaFor?: (id: string) => number;
5510
5538
  /** Background fill (any CSS color accepted by the renderer). Default:
5511
5539
  * fully transparent. Passing a color is always valid. */
5512
5540
  background?: string;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { ALWAYS, ANCHOR_HIT_BASE_PX, ActionsProviderIfRoot, ActiveToolContextProvider, ActiveToolContextProviderIfRoot, BUNDLE_TOOLS, COARSE_TARGET_SCALE, CURVE_REPS, ColorOverrideRegistry, CropIcon, CursorCoordsHud, DEFAULT_ALPHA_DECAY, DEFAULT_ALPHA_MIN, DEFAULT_DEBUG_THEME, DEFAULT_DEVICE_PROFILE, DEFAULT_FILL_COLOR, DEFAULT_HANDLE_SIZE, DEFAULT_PALETTE, DEFAULT_ROTATION_HANDLE_DISTANCE, DEFAULT_STROKE_COLOR, DEFAULT_TEXT_STYLE, DEFAULT_VELOCITY_DECAY, DepRegistryProviderIfRoot, DeviceProfileProvider, DivideIcon, EASINGS, EllipseIcon, ExcludeIcon, EyedropperIcon, FALLBACK_FIT_VIEW, GHOST_STROKE, HANDLE_BASE_PX, HandIcon, IDENTITY_POSE_COMPOSITION, IntersectIcon, KIT_SHAPE_KINDS, LassoIcon, LineIcon, MIXED, MOVE_ANCHORS, MinimapCanvas, NEVER, PATH_ANCHOR_CHROME_ID, PenIcon, PencilIcon, PickHud, PointerProviderIfRoot, PolygonIcon, RECT_ALIGN_PROJECTION, ROTATION_HANDLE_BASE_PX, RectIcon, SPRING_PRESETS, SceneCanvas, SceneViewCanvas, SelectIcon, SelectionContextProvider, SelectionContextProviderIfRoot, StarIcon, SubtractIcon, TextIcon, UnionIcon, UnknownIcon, VERSION, WeaselProvider, aabbCenter, actionIs, alignDeltaFor, alignInsertBehavior, alignMoveBehavior, alignResizeBehavior, alignedStrokeRect, always, and, animateLifecycle, animateOnSetPose, annulusSemiAxes, applyBooleanOp, applyHitExistingGate, applyStyleToRange, areaSelectAction, arrayAdapter, asNodeId, bezierCubic, bezierQuadratic, buildChromeCtx, buildRuleCtx, buildSceneViewCommands, canBringForward, canHover, canQueryLocalFonts2 as canQueryLocalFonts, canSendBackward, capabilityAll, capabilityIn, capabilityIs, capabilityNot, caretIndexAt, cellAt, charOffsetToDomPosition, clampView, clearSelectionAction, clientToCanvas, clipboardCopyAction, clipboardCutAction, cloneAction, coarsePointer, composeAffordanceLayer, composePath, composeRectPose, composeSelectionPose, composeWorldPose, computeFitView, computeIndicatorCommand, computeWheelAction, cond, constrainTo45, containedThenNearest, countPathAnchors, createCellHighlightLayer, createChildrenLayer, createCornerResizeAffordance, createDebugOverlayLayer, createDebugSink, createDispatcher, createGridLayer, createGuidesLayer, createHistory, createMarkdownRenderer, createMoveToIndexOp, createNodeProperties, createNodeRouting, createParallaxLayer, createPathAnchorAffordances, createPathEditingOverlayLayer, createPathLayer, createPenPreviewLayer, createReorderOp, createRotationAffordance, createScene, createSelectionHandlesLayer, createSelectionOutlineLayer, createSelectionOverlayLayer, createSetDataOp, createSetLayerOp, createSetPathOp, createSetTextOp, createTextLayer, createViewportLayer, cycleVertexColors, decomposePath, decomposeRectPose, defaultCommitAdapter, defaultDrawOne, defaultLabelTextRenderer, defaultNodeProperties, defaultNodeRouting, defaultVisibilityRules, deriveAlignmentGuides, deriveParallaxView, describeRule, domPositionToCharOffset, domToRuns, drawLayers, 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, enableLocalFontOutlines2 as enableLocalFontOutlines, enterTextEditAction, enumerateAnchors, evaluate, fillInPoseFrame, fillToBoundsFrame, findNodeShape, findShapeInk, findShapeSilhouette, fitTextPose, fitToBounds, fitViewToBounds, fitZoom, focused, fontString, forEachCoalesced, freeform, gateLayer, gesturing, getAlpha01, getImageBitmap, getNodeShapes, getStylusData, gradientForBounds, gradientGeometry, hasFontOutlines2 as hasFontOutlines, hexToRgba, hitAffordanceRegions, hitAnchor, hitRotationHandle, hovering, hoveringSelected, imageStatus, inferredNodeProperties, inferredNodeRouting, insertAction, isCanvasFont2 as isCanvasFont, isEditableTarget, isPatternSpec, lassoSelectAction, layoutMarkdown, lerpColorArray, lerpOklab, lerpOklch, linear, listFontOutlines2 as listFontOutlines, liveScope, makeViewportZoomAction, markdownToRuns, matchAlignment, matchesKeyBinding, meanScale, measureText, measureTextBounds, measuredWidth, mergeAlphaFromPrev, mergeContributions, modeIn, modeIs, modeNot, modifierHeld, momentum, moveAction, multiActive, nearest, nearestWithin, nestedHitTester, never, nodeHasFlag, none, normalizeHex, not, nurbs, oklabToOklch, oklabToSrgbU8, oklchToOklab, openFilePicker, or, outlineStatus2 as outlineStatus, parseColor, parseColorToRgba255, parseDebugFlags, pathContainsPoint, pathContainsPolygon, pathContainsRect, pathDistanceToPoint, pathDivide, pathExclude, pathFromD, pathInPoseFrame, pathInWorld, pathIntersect, pathIntersectsPolygon, pathIntersectsRect, pathOriginProjection, pathSubtract, pathToAnchors, pathUnion, pickTopMostHit, pinchZoomAction, planPixelRender, pointInRotatedRect, pointInTextPose, poseRotationOf, pressureToWidth, rainbowVertexColors, rebaseLocalPose, rectCorners, registerCanvasFont2 as registerCanvasFont, registerContentHandler, registerFont2 as registerFont, registerFontOutlines2 as registerFontOutlines, registerNodeShape, renderLabel, renderSceneToCanvas, renderSceneToPixels, resizeAction, resolveColor, resolveDeviceProfile, resolveFillPattern, resolvePatternSpec, resolveRuns, resolveTextStyle, resolveVisibility, rgbaToHex, rotateAction, rotateAroundAABBCenter, rotatePathAround, rotatePoint, rotatedRectCorners, rotationDegreesUnit, rotationHandle, roundToCell, runsToDom, runsToMarkdown, runsToPlainText, sampleGradientStops, sceneFromJSON, sceneNodeClientRect, sceneToAdapter, scopeBindings, screenToWorld, selectFromLasso, selectionAtLeast, selectionEmpty, selectionIs, setFlagOverRange, shapeCoversPoint, sliceAction, snapPoint, solidVertexColors, specificity, spiro, splitPathByLine, splitSubpaths, springPose, springVertexColors, srgbU8ToOklab, staggerVertexColors, startThresholdDrag, styleAtRange, subscribeGlyphReady2 as subscribeGlyphReady, subscribeImageReady, textCommand, textLineBoxes, tileGrid, toHex8, toRuns, translatePoseViaDescriptor, translateRectPose, tweenPose, tweenVertexColors, unionBounds, unionBoundsPath, unregisterCanvasFont2 as unregisterCanvasFont, unregisterFontOutlines2 as unregisterFontOutlines, useActiveToolContext, useAlign, useAnimator, useArrayAdapter, useAutoCenter, useBooleans, useBooleansAdapter, useCanvasFocus, useCanvasSize, useDecayLoop, useDeviceProfile, useDistribute, useDragGesture, useDragHandle, useDragRadial, useDragRect, useDropZone, useEllipseTool, useEyedropperTool, useGestureDispatcher, useGridCellHover, useGuides, useHandTool, useHandleDrag, useHoverTracking, useImageTool, useKeybindings, useLassoTool, useLineTool, useOptionalActiveToolContext, usePenTool, usePencilTool, usePinchGesture, usePinchZoomTool, usePointerStylus, usePolygonTool, usePublishSelection, useRectTool, useResizePolicy, useRotateTool, useScene, useSceneAdapter, useSceneTextEdit, useSelectTool, useSelection, useSelectionContext, useSimulation, useSliceDep, useStandardActions, useStarTool, useTextEdit, useTextTool, useTools, useVelocityTracker, useViewAnimation, useViewTween, useZoom, verticalAlignOffset, viewToMat3, viewToTransform, viewportDragPanAction, viewportZoomAction, when, withAlpha01, withCoord, withGradientKind, worldEditToStorage, worldPoseLookup, worldToScreen, zoomAt, zoomAtLeast } from './chunk-D2C6K6FO.js';
1
+ export { ALWAYS, ANCHOR_HIT_BASE_PX, ActionsProviderIfRoot, ActiveToolContextProvider, ActiveToolContextProviderIfRoot, BUNDLE_TOOLS, COARSE_TARGET_SCALE, CURVE_REPS, ColorOverrideRegistry, CropIcon, CursorCoordsHud, DEFAULT_ALPHA_DECAY, DEFAULT_ALPHA_MIN, DEFAULT_DEBUG_THEME, DEFAULT_DEVICE_PROFILE, DEFAULT_FILL_COLOR, DEFAULT_HANDLE_SIZE, DEFAULT_PALETTE, DEFAULT_ROTATION_HANDLE_DISTANCE, DEFAULT_STROKE_COLOR, DEFAULT_TEXT_STYLE, DEFAULT_VELOCITY_DECAY, DepRegistryProviderIfRoot, DeviceProfileProvider, DivideIcon, EASINGS, EllipseIcon, ExcludeIcon, EyedropperIcon, FALLBACK_FIT_VIEW, GHOST_STROKE, HANDLE_BASE_PX, HandIcon, IDENTITY_POSE_COMPOSITION, IntersectIcon, KIT_SHAPE_KINDS, LassoIcon, LineIcon, MIXED, MOVE_ANCHORS, MinimapCanvas, NEVER, PATH_ANCHOR_CHROME_ID, PenIcon, PencilIcon, PickHud, PointerProviderIfRoot, PolygonIcon, RECT_ALIGN_PROJECTION, ROTATION_HANDLE_BASE_PX, RectIcon, SPRING_PRESETS, SceneCanvas, SceneViewCanvas, SelectIcon, SelectionContextProvider, SelectionContextProviderIfRoot, StarIcon, SubtractIcon, TextIcon, UnionIcon, UnknownIcon, VERSION, WeaselProvider, aabbCenter, actionIs, alignDeltaFor, alignInsertBehavior, alignMoveBehavior, alignResizeBehavior, alignedStrokeRect, always, and, animateLifecycle, animateOnSetPose, annulusSemiAxes, applyBooleanOp, applyHitExistingGate, applyStyleToRange, areaSelectAction, arrayAdapter, asNodeId, bezierCubic, bezierQuadratic, buildChromeCtx, buildRuleCtx, buildSceneViewCommands, canBringForward, canHover, canQueryLocalFonts2 as canQueryLocalFonts, canSendBackward, capabilityAll, capabilityIn, capabilityIs, capabilityNot, caretIndexAt, cellAt, charOffsetToDomPosition, clampView, clearSelectionAction, clientToCanvas, clipboardCopyAction, clipboardCutAction, cloneAction, coarsePointer, composeAffordanceLayer, composePath, composeRectPose, composeSelectionPose, composeWorldPose, computeFitView, computeIndicatorCommand, computeWheelAction, cond, constrainTo45, containedThenNearest, countPathAnchors, createCellHighlightLayer, createChildrenLayer, createCornerResizeAffordance, createDebugOverlayLayer, createDebugSink, createDispatcher, createGridLayer, createGuidesLayer, createHistory, createMarkdownRenderer, createMoveToIndexOp, createNodeProperties, createNodeRouting, createParallaxLayer, createPathAnchorAffordances, createPathEditingOverlayLayer, createPathLayer, createPenPreviewLayer, createReorderOp, createRotationAffordance, createScene, createSelectionHandlesLayer, createSelectionOutlineLayer, createSelectionOverlayLayer, createSetDataOp, createSetLayerOp, createSetPathOp, createSetTextOp, createTextLayer, createViewportLayer, cycleVertexColors, decomposePath, decomposeRectPose, defaultCommitAdapter, defaultDrawOne, defaultLabelTextRenderer, defaultNodeProperties, defaultNodeRouting, defaultVisibilityRules, deriveAlignmentGuides, deriveParallaxView, describeRule, domPositionToCharOffset, domToRuns, drawLayers, 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, enableLocalFontOutlines2 as enableLocalFontOutlines, enterTextEditAction, enumerateAnchors, evaluate, fillInPoseFrame, fillToBoundsFrame, findNodeShape, findShapeInk, findShapeSilhouette, fitTextPose, fitToBounds, fitViewToBounds, fitZoom, focused, fontString, forEachCoalesced, freeform, gateLayer, gesturing, getAlpha01, getImageBitmap, getNodeShapes, getStylusData, gradientForBounds, gradientGeometry, hasFontOutlines2 as hasFontOutlines, hexToRgba, hitAffordanceRegions, hitAnchor, hitRotationHandle, hovering, hoveringSelected, imageStatus, inferredNodeProperties, inferredNodeRouting, insertAction, isCanvasFont2 as isCanvasFont, isEditableTarget, isPatternSpec, lassoSelectAction, layoutMarkdown, lerpColorArray, lerpOklab, lerpOklch, linear, listFontOutlines2 as listFontOutlines, liveScope, makeViewportZoomAction, markdownToRuns, matchAlignment, matchesKeyBinding, meanScale, measureText, measureTextBounds, measuredWidth, mergeAlphaFromPrev, mergeContributions, modeIn, modeIs, modeNot, modifierHeld, momentum, moveAction, multiActive, nearest, nearestWithin, nestedHitTester, never, nodeHasFlag, none, normalizeHex, not, nurbs, oklabToOklch, oklabToSrgbU8, oklchToOklab, openFilePicker, or, outlineStatus2 as outlineStatus, parseColor, parseColorToRgba255, parseDebugFlags, pathContainsPoint, pathContainsPolygon, pathContainsRect, pathDistanceToPoint, pathDivide, pathExclude, pathFromD, pathInPoseFrame, pathInWorld, pathIntersect, pathIntersectsPolygon, pathIntersectsRect, pathOriginProjection, pathSubtract, pathToAnchors, pathUnion, pickTopMostHit, pinchZoomAction, planPixelRender, pointInRotatedRect, pointInTextPose, poseRotationOf, pressureToWidth, rainbowVertexColors, rebaseLocalPose, rectCorners, registerCanvasFont2 as registerCanvasFont, registerContentHandler, registerFont2 as registerFont, registerFontOutlines2 as registerFontOutlines, registerNodeShape, renderLabel, renderSceneToCanvas, renderSceneToPixels, resizeAction, resolveColor, resolveDeviceProfile, resolveFillPattern, resolvePatternSpec, resolveRuns, resolveTextStyle, resolveVisibility, rgbaToHex, rotateAction, rotateAroundAABBCenter, rotatePathAround, rotatePoint, rotatedRectCorners, rotationDegreesUnit, rotationHandle, roundToCell, runsToDom, runsToMarkdown, runsToPlainText, sampleGradientStops, sceneFromJSON, sceneNodeClientRect, sceneToAdapter, scopeBindings, screenToWorld, selectFromLasso, selectionAtLeast, selectionEmpty, selectionIs, setFlagOverRange, shapeCoversPoint, sliceAction, snapPoint, solidVertexColors, specificity, spiro, splitPathByLine, splitSubpaths, springPose, springVertexColors, srgbU8ToOklab, staggerVertexColors, startThresholdDrag, styleAtRange, subscribeGlyphReady2 as subscribeGlyphReady, subscribeImageReady, textCommand, textLineBoxes, tileGrid, toHex8, toRuns, translatePoseViaDescriptor, translateRectPose, tweenPose, tweenVertexColors, unionBounds, unionBoundsPath, unregisterCanvasFont2 as unregisterCanvasFont, unregisterFontOutlines2 as unregisterFontOutlines, useActiveToolContext, useAlign, useAnimator, useArrayAdapter, useAutoCenter, useBooleans, useBooleansAdapter, useCanvasFocus, useCanvasSize, useDecayLoop, useDeviceProfile, useDistribute, useDragGesture, useDragHandle, useDragRadial, useDragRect, useDropZone, useEllipseTool, useEyedropperTool, useGestureDispatcher, useGridCellHover, useGuides, useHandTool, useHandleDrag, useHoverTracking, useImageTool, useKeybindings, useLassoTool, useLineTool, useOptionalActiveToolContext, usePenTool, usePencilTool, usePinchGesture, usePinchZoomTool, usePointerStylus, usePolygonTool, usePublishSelection, useRectTool, useResizePolicy, useRotateTool, useScene, useSceneAdapter, useSceneTextEdit, useSelectTool, useSelection, useSelectionContext, useSimulation, useSliceDep, useStandardActions, useStarTool, useTextEdit, useTextTool, useTools, useVelocityTracker, useViewAnimation, useViewTween, useZoom, verticalAlignOffset, viewToMat3, viewToTransform, viewportDragPanAction, viewportZoomAction, when, withAlpha01, withCoord, withGradientKind, worldEditToStorage, worldPoseLookup, worldToScreen, zoomAt, zoomAtLeast } from './chunk-FVNWK7U3.js';
2
2
  export { ActionDisabledReason, ActionsProvider, DepRegistryProvider, evaluateEnabled, routing_exports as routing, useAction, useActionsRegistry, useDepRegistry, useDepSource, useOptionalDepRegistry } from './chunk-DCIU3SRK.js';
3
3
  export { createReparentOp, createTransformOp, deleteScratch, getScratch, scratchKey, setScratch, snap } from './chunk-UB6A6L77.js';
4
4
  export { CORNER_ANCHORS, cornerPoint, cornerResizeHandles, hitCornerHandle, pointSnapToGrid } from './chunk-Z3KNFTTS.js';
@@ -233,6 +233,56 @@ declare class GroupState {
233
233
  pop(): void;
234
234
  }
235
235
 
236
+ /**
237
+ * Growable vertex staging for consecutive solid-fill geometry.
238
+ *
239
+ * Geometry only: `draw.ts` owns when a run starts, what breaks it, and the
240
+ * uniforms the flush draws under. Colors ride the vertices (the batch program
241
+ * is `pathFillVColor` with `u_color` left at white) because shapes in a run
242
+ * differ in color and a merged draw has one set of uniforms — and so does the
243
+ * model transform, applied here rather than uploaded, so that shapes under
244
+ * different transforms still share a draw.
245
+ */
246
+
247
+ declare class SolidBatch {
248
+ private readonly gl;
249
+ private readonly vao;
250
+ private readonly vbo;
251
+ private readonly ibo;
252
+ private verts;
253
+ private idx;
254
+ private nVerts;
255
+ private nIdx;
256
+ /** What the GPU buffers are currently sized for. */
257
+ private vboVerts;
258
+ private iboIdx;
259
+ constructor(gl: WebGL2RenderingContext, prog: ShaderProgram);
260
+ get length(): number;
261
+ /** Whether staging `vertices` more would put the run past the per-flush cap. */
262
+ wouldOverflow(vertices: number): boolean;
263
+ /**
264
+ * Append one rect's four corners through `m`, all carrying `rgba` (straight
265
+ * alpha). An affine maps a rect to a parallelogram, so two triangles still
266
+ * cover it and the batch draws at `u_model` identity.
267
+ */
268
+ pushRect(x: number, y: number, w: number, h: number, m: Mat3, r: number, g: number, b: number, a: number): void;
269
+ /**
270
+ * Append a tessellated mesh through `m`, all vertices carrying `rgba`. The
271
+ * mesh's own indices are rebased onto the staged vertices, which is why the
272
+ * index buffer is uploaded per flush rather than written once.
273
+ */
274
+ pushMesh(mesh: Mesh, m: Mat3, r: number, g: number, b: number, a: number): void;
275
+ /** Upload the staged geometry and bind the batch VAO. Returns the index
276
+ * count for the caller's `drawElements`. */
277
+ uploadAndBind(): number;
278
+ reset(): void;
279
+ dispose(): void;
280
+ /** Grow the CPU arrays so `vertices` / `indices` more fit. */
281
+ private reserve;
282
+ /** Size both GPU buffers for at least what is staged, doubling to amortize. */
283
+ private growGpu;
284
+ }
285
+
236
286
  interface WeaselRendererOptions {
237
287
  gl?: WebGL2RenderingContext;
238
288
  canvas?: HTMLCanvasElement;
@@ -281,10 +331,7 @@ declare class WeaselRenderer {
281
331
  private programRegistry;
282
332
  private quadVbo;
283
333
  private quadIbo;
284
- /** Shared rect-fill geometry: 4 verts × 2 floats (dynamic), 6-index static IBO. */
285
- private rectVao;
286
- private rectVbo;
287
- private rectIbo;
334
+ private solidBatch;
288
335
  private readonly groupState;
289
336
  private widthCss;
290
337
  private heightCss;
@@ -301,10 +348,6 @@ declare class WeaselRenderer {
301
348
  * calls and `registerProgram()` calls. */
302
349
  private disposed;
303
350
  constructor(opts: WeaselRendererOptions);
304
- /** Allocate the shared rect VAO + dynamic VBO (4 verts × 2 floats) + static
305
- * IBO (6 indices). drawRectFast bufferSubData's the 4 corner coords each
306
- * draw, avoiding per-rect buffer allocation in animated demos. */
307
- private uploadRectGeometry;
308
351
  private uploadQuadGeometry;
309
352
  /**
310
353
  * Compile a consumer-registered shader program against this renderer's GL context.
@@ -363,6 +406,7 @@ declare class WeaselRenderer {
363
406
  /** @internal */ _gl(): WebGL2RenderingContext;
364
407
  /** @internal */ _pathFill(): ShaderProgram;
365
408
  /** @internal */ _pathFillVColor(): ShaderProgram;
409
+ /** @internal */ _solidBatch(): SolidBatch;
366
410
  /** @internal */ _textSdf(): ShaderProgram;
367
411
  /** @internal */ _textSdfR8(): ShaderProgram;
368
412
  /** @internal */ _imageFill(): ShaderProgram;
package/dist/renderer.js CHANGED
@@ -1,4 +1,4 @@
1
- export { IDENTITY_COLOR_MATRIX, OUTLINE_MIN_SCREEN_PX, ShaderCompileError, WeaselRenderer, buildGradientRamp, canQueryLocalFonts, enableLocalFontOutlines, hasFontOutlines, isCanvasFont, listFontOutlines, mat3, outlineStatus, registerCanvasFont, registerFont, registerFontOutlines, registerProgram, subscribeGlyphReady, tessellate, tessellateStroke, unregisterCanvasFont, unregisterFontOutlines, viewToMat3 } from './chunk-D2C6K6FO.js';
1
+ export { IDENTITY_COLOR_MATRIX, OUTLINE_MIN_SCREEN_PX, ShaderCompileError, WeaselRenderer, buildGradientRamp, canQueryLocalFonts, enableLocalFontOutlines, hasFontOutlines, isCanvasFont, listFontOutlines, mat3, outlineStatus, registerCanvasFont, registerFont, registerFontOutlines, registerProgram, subscribeGlyphReady, tessellate, tessellateStroke, unregisterCanvasFont, unregisterFontOutlines, viewToMat3 } from './chunk-FVNWK7U3.js';
2
2
  import './chunk-DCIU3SRK.js';
3
3
  import './chunk-UB6A6L77.js';
4
4
  import './chunk-Z3KNFTTS.js';
package/dist/routing.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export { bd as Conflict, be as PREDICATE_TARGET, bf as RegistryEntry, bg as ToolDef, m as ToolKeybinding, bh as ToolScopes, bi as ViewportToolDef, bj as buildRouteRegistry, bk as defineTool, bl as defineViewportTool, bm as findConflicts, bn as findScopedConflicts, bo as formatConflict, bp as reportRouteConflicts } from './index-ChM3ZJ2v.js';
1
+ export { bd as Conflict, be as PREDICATE_TARGET, bf as RegistryEntry, bg as ToolDef, m as ToolKeybinding, bh as ToolScopes, bi as ViewportToolDef, bj as buildRouteRegistry, bk as defineTool, bl as defineViewportTool, bm as findConflicts, bn as findScopedConflicts, bo as formatConflict, bp as reportRouteConflicts } from './index-DPI8DV0A.js';
2
2
  export { ChannelRef, DescribeRouteOptions, GESTURE_DESCRIPTORS, GestureArgSpec, GestureDescriptor, GestureName, ModRequirement, ModifierKey, ParsedModifiers, ParsedRoute, PhaseAtom, RESERVED_ID_NAMES, RESERVED_ID_PREFIXES, ROUTE_FIELD_DEFINITIONS, ROUTE_TERMS, RouteDescriptionPart, RouteFieldName, RouteTermLabel, canonicalModifiers, collapseShiftPairs, describeRoute, describeRouteParts, formatPhaseAtom, formatRoute, getGestureDescriptor, isKnownGestureName, parseRoute } from '@weasel-js/gestures';
3
- import './types-DUpI7Apc.js';
3
+ import './types-Kh_osAq9.js';
4
4
  import '@weasel-js/history';
5
5
  import './path-B6MMiodD.js';
6
6
  import './types-BhJJ2OCM.js';
@@ -7,7 +7,7 @@ import { P as Path } from './path-B6MMiodD.js';
7
7
  * shape used by `composeRectPose` and the `unionBounds` helper. Rotation is
8
8
  * in radians, pivoted on the unrotated AABB center; absent === 0. Kit-side
9
9
  * code that consumes rotation already reads `pose.rotation ?? 0`
10
- * (`SceneCanvas.defaultDrawOne`, `rotate/handle.ts`, `pathInWorld.ts`), so
10
+ * (`wrapNodeOutput`, `rotate/handle.ts`, `pathInWorld.ts`), so
11
11
  * the slot exists on every default scene whether or not the consumer
12
12
  * populates it.
13
13
  */
@@ -212,6 +212,13 @@ interface Scene<TData, TLayer extends string, TPose = RectPose> {
212
212
  childrenOf(id: NodeId): readonly NodeId[];
213
213
  ancestorsOf(id: NodeId): readonly NodeId[];
214
214
  renderOrder(): Iterable<NodeId>;
215
+ /** The same layer-major sequence as {@link Scene.renderOrder}, as the nodes
216
+ * themselves. Prefer this wherever the ids are only going to be resolved
217
+ * back to nodes: the traversal already holds them, and re-looking each one
218
+ * up was ~40% of the area hit-test's per-node cost. Cached until a
219
+ * structural edit, so repeat calls hand back the same array — a snapshot,
220
+ * not a live view, and not yours to mutate. */
221
+ renderOrderNodes(): readonly Node<TData, TLayer, TPose>[];
215
222
  add(spec: AddNodeSpec<TData, TLayer, TPose>): NodeId;
216
223
  /** Delete `id` **and its entire subtree** — every descendant is removed in
217
224
  * the same operation. Recorded as one undoable step; `undo()` restores the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weasel-js/core",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Domain-agnostic 2D scene graph primitives for React: viewport math, drag/resize/insert/clone interactions, layered canvas rendering.",
5
5
  "license": "MIT",
6
6
  "author": "orochi235",
@@ -74,11 +74,11 @@
74
74
  "react": ">=18"
75
75
  },
76
76
  "dependencies": {
77
- "@weasel-js/font": "1.0.0",
78
- "@weasel-js/geom": "1.0.0",
79
- "@weasel-js/gestures": "1.0.0",
80
- "@weasel-js/history": "1.0.0",
81
- "@weasel-js/modes": "1.0.0",
77
+ "@weasel-js/font": "1.0.1",
78
+ "@weasel-js/geom": "1.0.1",
79
+ "@weasel-js/gestures": "1.0.1",
80
+ "@weasel-js/history": "1.0.1",
81
+ "@weasel-js/modes": "1.0.1",
82
82
  "earcut": "2.2.4",
83
83
  "polygon-clipping": "^0.15.7"
84
84
  },