@weasel-js/core 1.0.3 → 1.1.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.
Files changed (37) hide show
  1. package/CHANGELOG.md +251 -0
  2. package/dist/{chunk-SMCZRSYB.js → chunk-3B4QEB2G.js} +810 -228
  3. package/dist/chunk-3B4QEB2G.js.map +1 -0
  4. package/dist/{chunk-U45SODC2.js → chunk-4Z6J4IVH.js} +43 -27
  5. package/dist/chunk-4Z6J4IVH.js.map +1 -0
  6. package/dist/{chunk-3KGMJMOS.js → chunk-CSMF654J.js} +3 -3
  7. package/dist/{chunk-3KGMJMOS.js.map → chunk-CSMF654J.js.map} +1 -1
  8. package/dist/{chunk-TR3HZN34.js → chunk-J3YC3GVF.js} +5 -4
  9. package/dist/chunk-J3YC3GVF.js.map +1 -0
  10. package/dist/{chunk-3JYFAQIB.js → chunk-J7LUY47N.js} +3 -3
  11. package/dist/{chunk-3JYFAQIB.js.map → chunk-J7LUY47N.js.map} +1 -1
  12. package/dist/clipboard.d.ts +1 -1
  13. package/dist/clone.d.ts +2 -2
  14. package/dist/{geometry-5X6TrAkX.d.ts → geometry-C56YbnfD.d.ts} +1 -1
  15. package/dist/{grid-sfilv5HP.d.ts → grid-DqOi0Vgi.d.ts} +1 -1
  16. package/dist/index.d.ts +179 -59
  17. package/dist/index.js +5 -5
  18. package/dist/insert.d.ts +3 -3
  19. package/dist/insert.js +1 -1
  20. package/dist/move.d.ts +4 -4
  21. package/dist/move.js +3 -3
  22. package/dist/move.js.map +1 -1
  23. package/dist/{options-CbsIgQci.d.ts → options-C6HYCKP7.d.ts} +1 -1
  24. package/dist/{pointSnapToGrid-C3wowsQy.d.ts → pointSnapToGrid-BBtn5bus.d.ts} +2 -2
  25. package/dist/{registry-CxnkXbG8.d.ts → registry-DGBrjGbB.d.ts} +4 -4
  26. package/dist/renderer.d.ts +29 -13
  27. package/dist/renderer.js +5 -5
  28. package/dist/resize.d.ts +4 -4
  29. package/dist/resize.js +2 -2
  30. package/dist/routing.d.ts +4 -4
  31. package/dist/routing.js +1 -1
  32. package/dist/{types-ByZxoD6P.d.ts → types-BhrifbZ1.d.ts} +1 -1
  33. package/dist/{types-DpQ0cWYC.d.ts → types-DbysOO-2.d.ts} +10 -3
  34. package/package.json +6 -6
  35. package/dist/chunk-SMCZRSYB.js.map +0 -1
  36. package/dist/chunk-TR3HZN34.js.map +0 -1
  37. package/dist/chunk-U45SODC2.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import { Op } from '@weasel-js/history';
2
- import { I as InsertBehavior, R as ResizePose } from './types-ByZxoD6P.js';
2
+ import { I as InsertBehavior, R as ResizePose } from './types-BhrifbZ1.js';
3
3
 
4
4
  /** Option surface for the `insert` action.
5
5
  *
@@ -1,5 +1,5 @@
1
- import { c as ResizeAnchor, R as ResizePose, B as BoundsConstraint, P as PointSnapBehavior, d as PointSnapFrame, M as ModifierState } from './types-ByZxoD6P.js';
2
- import { B as Bounds, P as PoseProjection } from './geometry-5X6TrAkX.js';
1
+ import { c as ResizeAnchor, R as ResizePose, B as BoundsConstraint, P as PointSnapBehavior, d as PointSnapFrame, M as ModifierState } from './types-BhrifbZ1.js';
2
+ import { B as Bounds, P as PoseProjection } from './geometry-C56YbnfD.js';
3
3
  import { D as DebugSink } from './types-BHK2dkMu.js';
4
4
 
5
5
  /** Corner resize-handle: world-space center plus the anchor that pins the opposite corner during resize. */
@@ -1,17 +1,17 @@
1
1
  import { N as NodeId, R as RectPose, S as Scene } from './types-vqxpCFVp.js';
2
- import { M as ModifierState, A as ActionBehavior, c as ResizeAnchor, R as ResizePose, B as BoundsConstraint, P as PointSnapBehavior } from './types-ByZxoD6P.js';
2
+ import { M as ModifierState, A as ActionBehavior, c as ResizeAnchor, R as ResizePose, B as BoundsConstraint, P as PointSnapBehavior } from './types-BhrifbZ1.js';
3
3
  import { V as View } from './view-DSQgxBJB.js';
4
4
  import { CapabilityTag } from '@weasel-js/modes';
5
5
  import * as React from 'react';
6
6
  import { MutableRefObject, ReactNode, ReactElement } from 'react';
7
7
  import { GestureSpec, IngestItem, InputEvent } from '@weasel-js/gestures';
8
- import { B as Bounds, P as PoseProjection } from './geometry-5X6TrAkX.js';
8
+ import { B as Bounds, P as PoseProjection } from './geometry-C56YbnfD.js';
9
9
  import { F as FillStyle, S as Stroke } from './paint-types-CnLIzqq1.js';
10
10
  import { D as DrawCommand } from './DrawCommand-BbPrSTra.js';
11
11
  import * as react_jsx_runtime from 'react/jsx-runtime';
12
12
  import { P as Path } from './path-B6MMiodD.js';
13
13
  import { Op, History } from '@weasel-js/history';
14
- import { L as LayoutStrategy, I as InsertAdapter } from './types-DpQ0cWYC.js';
14
+ import { L as LayoutStrategy, I as InsertAdapter } from './types-DbysOO-2.js';
15
15
  import { D as DebugSink } from './types-BHK2dkMu.js';
16
16
  import { Mat3 } from '@weasel-js/geom';
17
17
 
@@ -3043,4 +3043,4 @@ declare function useActionsRegistry(): ActionsRegistry | null;
3043
3043
  */
3044
3044
  declare function useAction(action: Action): void;
3045
3045
 
3046
- export { type BindingOpts as $, type Action as A, type BooleansAdapter as B, type Condition as C, type Dims as D, type Eligibility as E, type ScopedBinding as F, type GeometryProjection as G, type HotkeyTrigger as H, type InsertExtras as I, ALWAYS as J, type ActionDeps as K, type LayerHit as L, ActionDisabledReason as M, type ActionEnabledResult as N, type OverlayPosition as O, type ActionEntry as P, ActionsProvider as Q, type RenderLayer as R, type SliceDep as S, type Tool as T, type UseSelectionOptions as U, type VisibilityRules as V, ActiveToolContextProvider as W, ActiveToolContextProviderIfRoot as X, type ActiveToolContextProviderProps as Y, type ActiveToolContextValue as Z, type AreaSelectDep as _, type DeviceProfile as a, evaluateEnabled as a$, type BooleanOp as a0, type BooleanOpResult as a1, type BoundGesture as a2, type BuildRuleCtxArgs as a3, type ClaimableGesture as a4, type ClipboardDep as a5, type ClipboardIngestCtx as a6, type CustomPaintContext as a7, type DepName as a8, type DepRegistry as a9, type ResizePolicy as aA, type ResolveAllOptions as aB, type ResolveOnlyResult as aC, type ResolvedCandidate as aD, type SelectionExtendKey as aE, type SelectionMode as aF, type Selector as aG, type SnapDep as aH, type SvgUnpacker as aI, type TextEditDep as aJ, type ToolModifiers as aK, type ToolPresentation as aL, type ToolSlot as aM, type UiOngoingControl as aN, type ViewApi as aO, applyBooleanOp as aP, buildRuleCtx as aQ, clipboardCopyAction as aR, clipboardCutAction as aS, composeRectPose as aT, composeWorldPose as aU, createDispatcher as aV, decomposeRectPose as aW, describeRule as aX, drawLayers as aY, enterTextEditAction as aZ, evaluate as a_, DepRegistryProvider as aa, type DispatcherContext as ab, type DragSample as ac, type EditAnchorsDep as ad, type GestureBinding as ae, IDENTITY_POSE_COMPOSITION as af, type ImmediateInvoker as ag, type IngestCtx as ah, type IngestionDep as ai, type InsertDep as aj, type InvocationCtx as ak, type Invoker as al, type LassoSelectDep as am, type LayoutDep as an, type MatchResult as ao, NEVER as ap, type NodeAtPointDep as aq, type OngoingHandle as ar, type OngoingInvoker as as, type OngoingOverlay as at, type Point2 as au, PointerContextProvider as av, type PointerContextValue as aw, type PointerWorldPos as ax, type PoseAdapter as ay, type PoseComposition as az, type DetectedDeviceFacts as b, rebaseLocalPose as b0, registerContentHandler as b1, sliceAction as b2, specificity as b3, translateRectPose as b4, useAction as b5, useActionsRegistry as b6, useActiveToolContext as b7, useDepRegistry as b8, useDepSource as b9, useOptionalActiveToolContext as ba, useOptionalDepRegistry as bb, usePointerContext as bc, useSelection as bd, worldPoseLookup as be, type Rule as c, type RuleCtx as d, type ChromeCtx as e, type ChromeId as f, type DepSchema as g, type ActionsRegistry as h, type AffordanceHit as i, type Dispatcher as j, type ToolDef as k, type ViewportToolDef as l, type AnyTool as m, type ToolCtx as n, type ToolKeybinding as o, type ChromeState as p, type SelectionApi as q, type ContentHandlerEntry as r, type SvgIngestOptions as s, type ActionsProp as t, type Affordance as u, type AffordanceRegion as v, type AffordanceBinding as w, type CommonAffordanceScratch as x, type BindingScope as y, type Contribution as z };
3046
+ export { type BooleanOp as $, type Action as A, type BooleansAdapter as B, type Condition as C, type Dims as D, type Eligibility as E, ALWAYS as F, type GeometryProjection as G, type HotkeyTrigger as H, type InsertExtras as I, type ActionDeps as J, ActionDisabledReason as K, type LayerHit as L, type ActionEnabledResult as M, type ActionEntry as N, type OverlayPosition as O, ActionsProvider as P, ActiveToolContextProvider as Q, type RenderLayer as R, type SliceDep as S, type Tool as T, type UseSelectionOptions as U, type VisibilityRules as V, ActiveToolContextProviderIfRoot as W, type ActiveToolContextProviderProps as X, type ActiveToolContextValue as Y, type AreaSelectDep as Z, type BindingOpts as _, type DeviceProfile as a, evaluateEnabled as a$, type BooleanOpResult as a0, type BoundGesture as a1, type BuildRuleCtxArgs as a2, type ClaimableGesture as a3, type ClipboardDep as a4, type ClipboardIngestCtx as a5, type CustomPaintContext as a6, type DepName as a7, type DepRegistry as a8, DepRegistryProvider as a9, type ResolveAllOptions as aA, type ResolveOnlyResult as aB, type ResolvedCandidate as aC, type SelectionExtendKey as aD, type SelectionMode as aE, type Selector as aF, type SnapDep as aG, type SvgUnpacker as aH, type TextEditDep as aI, type ToolCtx as aJ, type ToolModifiers as aK, type ToolPresentation as aL, type ToolSlot as aM, type UiOngoingControl as aN, type ViewApi as aO, applyBooleanOp as aP, buildRuleCtx as aQ, clipboardCopyAction as aR, clipboardCutAction as aS, composeRectPose as aT, composeWorldPose as aU, createDispatcher as aV, decomposeRectPose as aW, describeRule as aX, drawLayers as aY, enterTextEditAction as aZ, evaluate as a_, type DispatcherContext as aa, type DragSample as ab, type EditAnchorsDep as ac, type GestureBinding as ad, IDENTITY_POSE_COMPOSITION as ae, type ImmediateInvoker as af, type IngestCtx as ag, type IngestionDep as ah, type InsertDep as ai, type InvocationCtx as aj, type Invoker as ak, type LassoSelectDep as al, type LayoutDep as am, type MatchResult as an, NEVER as ao, type NodeAtPointDep as ap, type OngoingHandle as aq, type OngoingInvoker as ar, type OngoingOverlay as as, type Point2 as at, PointerContextProvider as au, type PointerContextValue as av, type PointerWorldPos as aw, type PoseAdapter as ax, type PoseComposition as ay, type ResizePolicy as az, type DetectedDeviceFacts as b, rebaseLocalPose as b0, registerContentHandler as b1, sliceAction as b2, specificity as b3, translateRectPose as b4, useAction as b5, useActionsRegistry as b6, useActiveToolContext as b7, useDepRegistry as b8, useDepSource as b9, useOptionalActiveToolContext as ba, useOptionalDepRegistry as bb, usePointerContext as bc, useSelection as bd, worldPoseLookup as be, type Rule as c, type RuleCtx as d, type ChromeCtx as e, type ChromeId as f, type DepSchema as g, type ActionsRegistry as h, type AffordanceHit as i, type Dispatcher as j, type ToolDef as k, type ViewportToolDef as l, type AnyTool as m, type ToolKeybinding as n, type ChromeState as o, type SelectionApi as p, type ContentHandlerEntry as q, type SvgIngestOptions as r, type ActionsProp as s, type Affordance as t, type AffordanceRegion as u, type AffordanceBinding as v, type CommonAffordanceScratch as w, type BindingScope as x, type Contribution as y, type ScopedBinding as z };
@@ -159,7 +159,8 @@ declare class GLMeshCache {
159
159
  * GL texture upload + cache for MSDF font atlases (and future images).
160
160
  *
161
161
  * Textures are keyed by a string id (the font family name or image id).
162
- * Upload happens once; subsequent uploads for the same id are no-ops.
162
+ * Pixels are uploaded once per id; a later upload of the same id reuses the
163
+ * texture and only re-applies its wrap mode when that changed.
163
164
  * The cache is GL-context-bound; discard and create a new one on context loss.
164
165
  *
165
166
  * Atlas format: RGBA UNSIGNED_BYTE, linear filtering, no mipmaps.
@@ -174,11 +175,15 @@ type TextureWrap = 'clamp' | 'repeat';
174
175
  declare class GLTextureCache {
175
176
  private readonly gl;
176
177
  private readonly map;
178
+ private readonly wraps;
177
179
  constructor(gl: WebGL2RenderingContext);
178
180
  has(id: string): boolean;
179
- /** Uploads once per id; `wrap` therefore applies on first upload only.
180
- * An id is either a pattern tile or a shader texture, never both. */
181
+ /** Uploads the pixels once per id. `wrap` is re-applied whenever it differs
182
+ * from what the id was last uploaded under: the same registered image can
183
+ * be a clamped shader texture in one draw and a repeating pattern tile in
184
+ * the next, and first-upload-wins gave the second one the first one's mode. */
181
185
  upload(id: string, source: TexSource, wrap?: TextureWrap): string;
186
+ private applyWrap;
182
187
  /** Create a single-channel R8 texture from raw bytes (full upload).
183
188
  * No-op if `id` already exists. Same LINEAR/CLAMP params as `upload`;
184
189
  * UNPACK_ALIGNMENT dropped to 1 for non-4-aligned row widths. */
@@ -245,6 +250,9 @@ declare class GroupState {
245
250
  get alpha(): number;
246
251
  get colorMatrix(): Float32Array;
247
252
  push(frame: GroupFrame): void;
253
+ /** Drop every pushed frame, leaving the root. A frame that throws part-way
254
+ * down the tree never pops, and the next frame would draw under leftovers. */
255
+ reset(): void;
248
256
  pop(): void;
249
257
  }
250
258
 
@@ -261,16 +269,22 @@ declare class GroupState {
261
269
 
262
270
  declare class SolidBatch {
263
271
  private readonly gl;
264
- private readonly vao;
265
- private readonly vbo;
266
- private readonly ibo;
272
+ private readonly aPos;
273
+ private readonly aColor;
274
+ /** Cycled per flush, and created on first use so a renderer that flushes
275
+ * rarely allocates as few slots as it flushes. */
276
+ private readonly ring;
277
+ private next;
278
+ /** The same, for flushes past a slot's capacity; these sets grow to fit. */
279
+ private readonly largeRing;
280
+ private nextLarge;
267
281
  private verts;
268
282
  private idx;
269
283
  private nVerts;
270
284
  private nIdx;
271
- /** What the GPU buffers are currently sized for. */
272
- private vboVerts;
273
- private iboIdx;
285
+ /** Whether the staged run is rects alone, so its indices are the canonical
286
+ * quad pattern and a slot already holding that pattern needs no upload. */
287
+ private pureRects;
274
288
  constructor(gl: WebGL2RenderingContext, prog: ShaderProgram);
275
289
  get length(): number;
276
290
  /** Whether staging `vertices` more would put the run past the per-flush cap. */
@@ -287,15 +301,17 @@ declare class SolidBatch {
287
301
  * index buffer is uploaded per flush rather than written once.
288
302
  */
289
303
  pushMesh(mesh: Mesh, m: Mat3, r: number, g: number, b: number, a: number): void;
290
- /** Upload the staged geometry and bind the batch VAO. Returns the index
291
- * count for the caller's `drawElements`. */
304
+ /** Upload the staged geometry into the next set of buffers and bind its VAO.
305
+ * Returns the index count for the caller's `drawElements`. */
292
306
  uploadAndBind(): number;
293
307
  reset(): void;
294
308
  dispose(): void;
295
309
  /** Grow the CPU arrays so `vertices` / `indices` more fit. */
296
310
  private reserve;
297
- /** Size both GPU buffers for at least what is staged, doubling to amortize. */
298
- private growGpu;
311
+ private nextRingSlot;
312
+ private nextLargeSlot;
313
+ private createSet;
314
+ private deleteSet;
299
315
  }
300
316
 
301
317
  /** How to construct a `WeaselRenderer`: the GL context or canvas to draw
package/dist/renderer.js CHANGED
@@ -1,8 +1,8 @@
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-SMCZRSYB.js';
2
- import './chunk-TR3HZN34.js';
3
- import './chunk-3KGMJMOS.js';
4
- import './chunk-3JYFAQIB.js';
5
- import './chunk-U45SODC2.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-3B4QEB2G.js';
2
+ import './chunk-J3YC3GVF.js';
3
+ import './chunk-CSMF654J.js';
4
+ import './chunk-J7LUY47N.js';
5
+ import './chunk-4Z6J4IVH.js';
6
6
  import './chunk-JOSUVS6C.js';
7
7
  import './chunk-UGFFCMQP.js';
8
8
  import './chunk-BHVYVFGV.js';
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-C3wowsQy.js';
2
- export { P as PoseProjection, R as RECT_POSE_DESCRIPTOR, a as ROTATED_POSE_DESCRIPTOR } from './geometry-5X6TrAkX.js';
3
- import { R as ResizePose, B as BoundsConstraint, M as ModifierState } from './types-ByZxoD6P.js';
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-BBtn5bus.js';
2
+ export { P as PoseProjection, R as RECT_POSE_DESCRIPTOR, a as ROTATED_POSE_DESCRIPTOR } from './geometry-C56YbnfD.js';
3
+ import { R as ResizePose, B as BoundsConstraint, M as ModifierState } from './types-BhrifbZ1.js';
4
4
  import { G as Guide } from './types-D2tTKEU0.js';
5
5
  import { V as View } from './view-DSQgxBJB.js';
6
6
  import './types-BHK2dkMu.js';
7
7
  import '@weasel-js/history';
8
- import './types-DpQ0cWYC.js';
8
+ import './types-DbysOO-2.js';
9
9
 
10
10
  /** Resize constraint that stops a node shrinking past a minimum. The anchored
11
11
  * edge stays put, so clamping pushes the dragged edge back rather than moving
package/dist/resize.js CHANGED
@@ -1,4 +1,4 @@
1
- export { CORNER_ANCHORS, DEFAULT_RESIZE_BEHAVIORS, clampMinSize, cornerPoint, cornerResizeHandles, fixedCornerOf, hitCornerHandle, lockAspectWithModifier, pointSnapToGrid, snapToGrid, snapToGuides } from './chunk-3JYFAQIB.js';
2
- export { RECT_POSE_DESCRIPTOR, ROTATED_POSE_DESCRIPTOR } from './chunk-U45SODC2.js';
1
+ export { CORNER_ANCHORS, DEFAULT_RESIZE_BEHAVIORS, clampMinSize, cornerPoint, cornerResizeHandles, fixedCornerOf, hitCornerHandle, lockAspectWithModifier, pointSnapToGrid, snapToGrid, snapToGuides } from './chunk-J7LUY47N.js';
2
+ export { RECT_POSE_DESCRIPTOR, ROTATED_POSE_DESCRIPTOR } from './chunk-4Z6J4IVH.js';
3
3
  //# sourceMappingURL=resize.js.map
4
4
  //# sourceMappingURL=resize.js.map
package/dist/routing.d.ts CHANGED
@@ -1,15 +1,15 @@
1
1
  import { ParsedModifiers, GestureName, GestureSpec } from '@weasel-js/gestures';
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 { T as Tool } from './registry-CxnkXbG8.js';
3
+ import { T as Tool } from './registry-DGBrjGbB.js';
4
4
  import './types-vqxpCFVp.js';
5
5
  import '@weasel-js/history';
6
6
  import './path-B6MMiodD.js';
7
- import './types-ByZxoD6P.js';
8
- import './types-DpQ0cWYC.js';
7
+ import './types-BhrifbZ1.js';
8
+ import './types-DbysOO-2.js';
9
9
  import './view-DSQgxBJB.js';
10
10
  import '@weasel-js/modes';
11
11
  import 'react';
12
- import './geometry-5X6TrAkX.js';
12
+ import './geometry-C56YbnfD.js';
13
13
  import './paint-types-CnLIzqq1.js';
14
14
  import './DrawCommand-BbPrSTra.js';
15
15
  import 'react/jsx-runtime';
package/dist/routing.js CHANGED
@@ -1,3 +1,3 @@
1
- export { GESTURE_DESCRIPTORS, RESERVED_ID_NAMES, RESERVED_ID_PREFIXES, ROUTE_FIELD_DEFINITIONS, ROUTE_TERMS, buildRouteRegistry, canonicalModifiers, collapseShiftPairs, describeRoute, describeRouteParts, findConflicts, formatPhaseAtom, formatRoute, getGestureDescriptor, isKnownGestureName, parseRoute } from './chunk-TR3HZN34.js';
1
+ export { GESTURE_DESCRIPTORS, RESERVED_ID_NAMES, RESERVED_ID_PREFIXES, ROUTE_FIELD_DEFINITIONS, ROUTE_TERMS, buildRouteRegistry, canonicalModifiers, collapseShiftPairs, describeRoute, describeRouteParts, findConflicts, formatPhaseAtom, formatRoute, getGestureDescriptor, isKnownGestureName, parseRoute } from './chunk-J3YC3GVF.js';
2
2
  //# sourceMappingURL=routing.js.map
3
3
  //# sourceMappingURL=routing.js.map
@@ -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-DpQ0cWYC.js';
2
+ import { S as SnapTarget, M as MoveAdapter, I as InsertAdapter } from './types-DbysOO-2.js';
3
3
 
4
4
  /**
5
5
  * Snapshot of modifier-key state at gesture dispatch.
@@ -139,7 +139,12 @@ interface SceneAdapter<TNode extends {
139
139
  getParent(id: string): string | null;
140
140
  setPose(id: string, pose: TPose): void;
141
141
  setParent(id: string, parentId: string | null): void;
142
- insertNode(node: TNode): void;
142
+ /** `index` is the node's z-position among its siblings. `createDeleteOp`
143
+ * captures it and `invert()` forwards it, so an implementation that drops
144
+ * it makes undo of a delete restore the node at the top instead of where
145
+ * it was. Treat it as required-if-you-have-order; omit only for an
146
+ * unordered store. */
147
+ insertNode(node: TNode, index?: number): void;
143
148
  removeNode(id: string): void;
144
149
  setSelection(ids: string[]): void;
145
150
  applyOps?(ops: Op[], label?: string): void;
@@ -316,8 +321,10 @@ interface InsertAdapter<TNode extends {
316
321
  dx: number;
317
322
  dy: number;
318
323
  };
319
- /** Mutator wired by `insertNode`-using ops (kit-side InsertOp). */
320
- insertNode(node: TNode): void;
324
+ /** Mutator wired by `insertNode`-using ops (kit-side InsertOp). `index`
325
+ * carries the z-position a delete captured, so undo restores paint order;
326
+ * see `SceneAdapter.insertNode`. */
327
+ insertNode(node: TNode, index?: number): void;
321
328
  /** Mutator wired by `setSelection` ops batched alongside paste. */
322
329
  setSelection(ids: string[]): void;
323
330
  /** Optional: see SceneAdapter.applyOps. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weasel-js/core",
3
- "version": "1.0.3",
3
+ "version": "1.1.0",
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.3",
78
- "@weasel-js/geom": "1.0.3",
79
- "@weasel-js/gestures": "1.0.3",
80
- "@weasel-js/history": "1.0.3",
81
- "@weasel-js/modes": "1.0.3",
77
+ "@weasel-js/font": "1.1.0",
78
+ "@weasel-js/geom": "1.1.0",
79
+ "@weasel-js/gestures": "1.1.0",
80
+ "@weasel-js/history": "1.1.0",
81
+ "@weasel-js/modes": "1.1.0",
82
82
  "earcut": "2.2.4",
83
83
  "polygon-clipping": "^0.15.7"
84
84
  },