@weasel-js/core 1.4.4 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1295 -2197
- package/README.md +118 -75
- package/dist/autoPoseDescriptor-Dr6CwNZK.d.ts +26 -0
- package/dist/{chunk-WPM42WJP.js → chunk-3LPQ2XZG.js} +196 -406
- package/dist/chunk-3LPQ2XZG.js.map +1 -0
- package/dist/{chunk-R3AWPTLZ.js → chunk-GREL4MVO.js} +7593 -8533
- package/dist/chunk-GREL4MVO.js.map +1 -0
- package/dist/chunk-HAGOFNP5.js +162 -0
- package/dist/chunk-HAGOFNP5.js.map +1 -0
- package/dist/chunk-LXJDWBEL.js +318 -0
- package/dist/chunk-LXJDWBEL.js.map +1 -0
- package/dist/{chunk-2VXGHUVL.js → chunk-P6MGECVO.js} +4 -22
- package/dist/chunk-P6MGECVO.js.map +1 -0
- package/dist/{chunk-PRGBGMH3.js → chunk-XXQ6FLCJ.js} +3 -3
- package/dist/chunk-XXQ6FLCJ.js.map +1 -0
- package/dist/clipboard.d.ts +2 -3
- package/dist/clone.d.ts +3 -2
- package/dist/depSchema-BubKMv-2.d.ts +3479 -0
- package/dist/{grid-0Pbn5B2C.d.ts → grid-Z_Af3vTl.d.ts} +7 -10
- package/dist/index.d.ts +2588 -1556
- package/dist/index.js +6 -5
- package/dist/insert.d.ts +4 -4
- package/dist/insert.js +2 -1
- package/dist/insert.js.map +1 -1
- package/dist/math-E3rZn4bR.d.ts +282 -0
- package/dist/math.d.ts +5 -0
- package/dist/math.js +4 -0
- package/dist/math.js.map +1 -0
- package/dist/move.d.ts +5 -6
- package/dist/move.js +4 -6
- package/dist/move.js.map +1 -1
- package/dist/{options-DbYLImvq.d.ts → options-BPcmwYk7.d.ts} +3 -2
- package/dist/{autoPoseDescriptor-DF1SnnSx.d.ts → pointSnapToGrid-CgcK2R_I.d.ts} +11 -32
- package/dist/poseDescriptor-PgfVKfa0.d.ts +134 -0
- package/dist/renderer.d.ts +9 -4
- package/dist/renderer.js +6 -5
- package/dist/resize.d.ts +11 -12
- package/dist/resize.js +3 -2
- package/dist/routing.d.ts +1 -142
- package/dist/routing.js +1 -1
- package/dist/routing.js.map +1 -1
- package/dist/{types-ei3UMl9R.d.ts → types-BHGdrOcu.d.ts} +12 -41
- package/dist/{types-DEALFt5F.d.ts → types-BdaK9PcP.d.ts} +10 -4
- package/package.json +17 -10
- package/dist/DrawCommand-CD-ug3d9.d.ts +0 -332
- package/dist/builtins-BXFBXegF.d.ts +0 -840
- package/dist/chunk-2VXGHUVL.js.map +0 -1
- package/dist/chunk-BL65SHCX.js +0 -573
- package/dist/chunk-BL65SHCX.js.map +0 -1
- package/dist/chunk-PRGBGMH3.js.map +0 -1
- package/dist/chunk-R3AWPTLZ.js.map +0 -1
- package/dist/chunk-WPM42WJP.js.map +0 -1
- package/dist/geometry-6fCNhAux.d.ts +0 -114
- package/dist/path-JEV2c5If.d.ts +0 -48
- package/dist/registry-BY-wI9gm.d.ts +0 -4003
- package/dist/types-BHK2dkMu.d.ts +0 -172
- package/dist/types-bcc7jcUy.d.ts +0 -594
- package/dist/view-DSQgxBJB.d.ts +0 -63
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { B as
|
|
3
|
-
import { D as DebugSink } from './types-BHK2dkMu.js';
|
|
4
|
-
import { P as Path } from './path-JEV2c5If.js';
|
|
1
|
+
import { ResizeAnchor, Bounds, DebugSink, ModifierState } from '@weasel-js/routing';
|
|
2
|
+
import { B as BoundsConstraint, P as PointSnapBehavior, a as PointSnapFrame } from './types-BHGdrOcu.js';
|
|
5
3
|
|
|
6
4
|
/** Corner resize-handle: world-space center plus the anchor that pins the opposite corner during resize. */
|
|
7
5
|
interface CornerHandle {
|
|
@@ -72,14 +70,13 @@ declare function fixedCornerOf(bounds: Bounds, anchor: ResizeAnchor): {
|
|
|
72
70
|
* Consumers should import from here directly; `resize.ts` re-exports the
|
|
73
71
|
* same symbol for back-compat. */
|
|
74
72
|
|
|
75
|
-
/** Options for the `resize` action:
|
|
76
|
-
* bounding box, and
|
|
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. */
|
|
77
75
|
interface UseResizeOptions<TPose> {
|
|
78
|
-
/** Behaviors are rect-typed: they read/write `{x,y,width,height}`.
|
|
79
|
-
* `TPose
|
|
80
|
-
*
|
|
81
|
-
|
|
82
|
-
behaviors?: TPose extends ResizePose ? BoundsConstraint<TPose>[] : never;
|
|
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;
|
|
83
80
|
resizeLabel?: string;
|
|
84
81
|
/** Reserved; resize is never transient in practice. Ignored. */
|
|
85
82
|
transient?: boolean;
|
|
@@ -99,16 +96,12 @@ interface UseResizeOptions<TPose> {
|
|
|
99
96
|
*
|
|
100
97
|
* Called once at `start()`. Returning `[]` aborts the gesture cleanly. */
|
|
101
98
|
expandIds?: (ids: string[]) => string[];
|
|
102
|
-
/** Projection from `TPose` to bounds and back. Defaults to rect identity
|
|
103
|
-
* when `TPose extends ResizePose`. Required for non-rect TPose (Path,
|
|
104
|
-
* polygon, etc.). */
|
|
105
|
-
geometry?: PoseProjection<TPose>;
|
|
106
99
|
/** Behaviors that operate on world-space anchor points. Fire after
|
|
107
100
|
* `behaviors[]` (bounds-frame). Each behavior receives a `PointSnapContext`
|
|
108
101
|
* with world-space frame points and returns at most one `PointSnapResult`;
|
|
109
102
|
* the hook back-solves the local pose so the chosen frame's world point
|
|
110
103
|
* lands on the snap target. First non-null result wins. */
|
|
111
|
-
pointSnapBehaviors?: TPose extends
|
|
104
|
+
pointSnapBehaviors?: TPose extends Bounds ? PointSnapBehavior<TPose>[] : never;
|
|
112
105
|
/** Optional debug sink. When supplied, records corner-handle positions +
|
|
113
106
|
* circular hitboxes when the gesture starts (covers the on-screen
|
|
114
107
|
* handles for the resized target). Tree-shakes via optional-chain
|
|
@@ -132,24 +125,10 @@ interface UseResizeOptions<TPose> {
|
|
|
132
125
|
* corner, the fixed corner, or the center, per `frame` — to a grid, moving
|
|
133
126
|
* the whole pose by the same delta. Unlike the bounds-level `snapToGrid`,
|
|
134
127
|
* this preserves the node's dimensions. */
|
|
135
|
-
declare function pointSnapToGrid<TPose extends
|
|
128
|
+
declare function pointSnapToGrid<TPose extends Bounds>(args: {
|
|
136
129
|
spacing: number;
|
|
137
130
|
frame?: PointSnapFrame;
|
|
138
131
|
bypassKey?: keyof ModifierState;
|
|
139
132
|
}): PointSnapBehavior<TPose>;
|
|
140
133
|
|
|
141
|
-
|
|
142
|
-
* callers that need to fork between `pathPoseDescriptor` and
|
|
143
|
-
* `RECT_POSE_DESCRIPTOR` without forcing the consumer to wire `geometry`
|
|
144
|
-
* explicitly. */
|
|
145
|
-
declare function isPathLike(p: unknown): p is Path;
|
|
146
|
-
/** Per-call dispatch: if the pose looks like a Path, route to
|
|
147
|
-
* `pathPoseDescriptor`; otherwise treat as a plain rect pose. Avoids forcing
|
|
148
|
-
* demos with Path TPose to wire `geometry={pathPoseDescriptor}` explicitly.
|
|
149
|
-
* `getRotation` surfaces a `pose.rotation` field on non-Path poses so demos
|
|
150
|
-
* using rect-with-rotation shapes (e.g. `RotatedPose`) don't have to wire
|
|
151
|
-
* `geometry={ROTATED_POSE_DESCRIPTOR}` just to get rotated selection chrome
|
|
152
|
-
* and rotation-aware corner hit-tests. */
|
|
153
|
-
declare const AUTO_POSE_DESCRIPTOR: PoseProjection<unknown>;
|
|
154
|
-
|
|
155
|
-
export { AUTO_POSE_DESCRIPTOR as A, CORNER_ANCHORS as C, type UseResizeOptions as U, type CornerAnchor as a, type CornerHandle as b, cornerPoint as c, cornerResizeHandles as d, type CornerEdge as e, fixedCornerOf as f, hitCornerHandle as h, isPathLike as i, pointSnapToGrid as p };
|
|
134
|
+
export { CORNER_ANCHORS as C, type UseResizeOptions as U, type CornerAnchor as a, type CornerHandle as b, cornerPoint as c, cornerResizeHandles as d, type CornerEdge as e, fixedCornerOf as f, hitCornerHandle as h, pointSnapToGrid as p };
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { Bounds } from '@weasel-js/routing';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Path data model. Vector-graphics primitive used kit-wide as the canonical
|
|
5
|
+
* shape (replacing per-shape ad-hoc poses). SVG-style command stream so we
|
|
6
|
+
* cover lines, polygons, beziers, and multi-contour shapes (think the inner
|
|
7
|
+
* hole of an "O") under one type.
|
|
8
|
+
*
|
|
9
|
+
* Storage: command codes in a `Uint8Array`, parameters in a `Float32Array`.
|
|
10
|
+
* Each command consumes a fixed number of float coords from the parameter
|
|
11
|
+
* array; the parser walks both arrays in lockstep. This keeps interaction
|
|
12
|
+
* hot loops monomorphic and keeps GC pressure low under heavy edits.
|
|
13
|
+
*
|
|
14
|
+
* Two path subtypes are distinguished at the type level so common-case
|
|
15
|
+
* machinery (selection AABBs, area-select intersection, hit-testing rect
|
|
16
|
+
* silhouettes) can short-circuit on `RectPath` without paying the polygon
|
|
17
|
+
* kernel cost. Polymorphic kernels accept either via the `Path` union and
|
|
18
|
+
* dispatch on `kind`.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/** Fill rule used by polygon path hit-testing and `ctx.fill()`. */
|
|
22
|
+
type PathFillRule = 'nonzero' | 'evenodd';
|
|
23
|
+
/**
|
|
24
|
+
* Polygon path with arbitrary contours and optional bezier segments.
|
|
25
|
+
* Multi-contour: each `M` opens a new subpath; `Z` closes the current one.
|
|
26
|
+
* Open subpaths (no `Z`) render as polylines and don't contribute to fills.
|
|
27
|
+
*/
|
|
28
|
+
interface PolygonPath {
|
|
29
|
+
kind: 'polygon';
|
|
30
|
+
commands: Uint8Array;
|
|
31
|
+
coords: Float32Array;
|
|
32
|
+
fillRule: PathFillRule;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Axis-aligned rectangle. Fast path for the (very common) case where the
|
|
36
|
+
* shape is just a rect — preserves O(1) bounds and hit-test, avoids the
|
|
37
|
+
* polygon kernel entirely. Promote to `PolygonPath` only when the shape
|
|
38
|
+
* grows beyond what a rect can express.
|
|
39
|
+
*/
|
|
40
|
+
interface RectPath {
|
|
41
|
+
kind: 'rect';
|
|
42
|
+
x: number;
|
|
43
|
+
y: number;
|
|
44
|
+
width: number;
|
|
45
|
+
height: number;
|
|
46
|
+
}
|
|
47
|
+
/** Canonical path shape — either an axis-aligned rect (fast path) or a polygon command stream. */
|
|
48
|
+
type Path = PolygonPath | RectPath;
|
|
49
|
+
|
|
50
|
+
/** `Bounds` with a required rotation angle (radians). Pivot is the AABB
|
|
51
|
+
* center of the unrotated `{x, y, width, height}`. */
|
|
52
|
+
interface RotatedPose extends Bounds {
|
|
53
|
+
rotation: number;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Bridges arbitrary `TPose` shapes into the resize hook's bounds-driven math.
|
|
57
|
+
* The hook reads bounds via `getBounds`, runs anchor-relative math on those
|
|
58
|
+
* bounds, then asks `remapBounds` to project the result back into TPose.
|
|
59
|
+
*
|
|
60
|
+
* `remapBounds(pose, src, dst)` is a single operation that subsumes both
|
|
61
|
+
* "set my own AABB to dst" (single-leaf resize) and "scale me as a leaf
|
|
62
|
+
* inside parent's src→dst rect" (group resize) — they're the same affine
|
|
63
|
+
* map. For rect-shaped poses the default geometry interprets the pose as
|
|
64
|
+
* its own bounds; for Path or polygon poses the consumer supplies a
|
|
65
|
+
* projection that knows how to read and rewrite the underlying geometry.
|
|
66
|
+
*/
|
|
67
|
+
interface PoseDescriptor<TPose, TNode = unknown> {
|
|
68
|
+
getBounds(pose: TPose): Bounds;
|
|
69
|
+
remapBounds(pose: TPose, src: Bounds, dst: Bounds): TPose;
|
|
70
|
+
/** A pose occupying `bounds`, of the same kind as `template`. Unlike
|
|
71
|
+
* `remapBounds`, the result carries none of the template's shape. */
|
|
72
|
+
fromBounds(bounds: Bounds, template: TPose): TPose;
|
|
73
|
+
/** Translate the pose by (dx, dy). Optional — when omitted, callers fall
|
|
74
|
+
* back to a translation derived from `remapBounds` (origin shifted, no
|
|
75
|
+
* scale). Path-shaped poses should provide this for performance. */
|
|
76
|
+
translate?(pose: TPose, dx: number, dy: number): TPose;
|
|
77
|
+
/** True iff any portion of the pose's geometry intersects `rect`. Optional
|
|
78
|
+
* — when omitted, area-select and similar callers test against `getBounds`
|
|
79
|
+
* AABB (looser, but correct for axis-aligned rect poses). */
|
|
80
|
+
intersectsRect?(pose: TPose, rect: Bounds): boolean;
|
|
81
|
+
/** Interpolate between two poses. Optional — animation helpers fall back to
|
|
82
|
+
* rect-shape lerp when omitted (which fails for non-rect poses). */
|
|
83
|
+
lerp?(a: TPose, b: TPose, t: number): TPose;
|
|
84
|
+
/** Read the pose's rotation in radians. Pivot is the AABB center
|
|
85
|
+
* (`getBounds(pose)` center). Default 0 when omitted — descriptor
|
|
86
|
+
* declares "this pose has no rotation." When supplied and non-zero,
|
|
87
|
+
* `useResize` projects the drag delta into the leaf's local frame,
|
|
88
|
+
* runs anchor math there, and translates the resulting pose so the
|
|
89
|
+
* diagonally opposite world-space corner is pinned. */
|
|
90
|
+
getRotation?(pose: TPose): number;
|
|
91
|
+
/** True iff this pose shape can carry a rotation. Consulted by the
|
|
92
|
+
* rotation affordance to decide whether to render the rotate cursor /
|
|
93
|
+
* drag-band over a selection. When omitted, the kit assumes `true` for
|
|
94
|
+
* back-compat — descriptors whose poses lack `x/y/width/height/rotation`
|
|
95
|
+
* fields (e.g. polygon Paths) should return `false` so the affordance
|
|
96
|
+
* hides instead of exposing a non-functional rotate cursor. */
|
|
97
|
+
supportsRotation?(pose: TPose): boolean;
|
|
98
|
+
/** Write a rotation (radians) into the pose, bounds unchanged. Absent means
|
|
99
|
+
* the pose cannot carry one, and the rotate action leaves it alone. */
|
|
100
|
+
withRotation?(pose: TPose, rotation: number): TPose;
|
|
101
|
+
/**
|
|
102
|
+
* A descriptor specialized to one node. Every other method here sees only
|
|
103
|
+
* the pose, so shapes sharing a pose type — a sphere and a box both posed by
|
|
104
|
+
* position/rotation/scale — are indistinguishable to them. Implement this to
|
|
105
|
+
* read `node.data` once and hand back a descriptor that knows which shape it
|
|
106
|
+
* is describing.
|
|
107
|
+
*
|
|
108
|
+
* Callers reach it through {@link poseDescriptorForNode}, at whichever site
|
|
109
|
+
* holds the node; the specialized descriptor then travels into the bounds and
|
|
110
|
+
* hit-test helpers in place of this one. Sites with only an id keep using the
|
|
111
|
+
* unspecialized descriptor, which is why this is optional on both ends.
|
|
112
|
+
*/
|
|
113
|
+
forNode?(node: TNode): PoseDescriptor<TPose, TNode>;
|
|
114
|
+
}
|
|
115
|
+
/** The descriptor `node` should be read through: its own specialization when
|
|
116
|
+
* it declares one, and otherwise the descriptor unchanged. */
|
|
117
|
+
declare function poseDescriptorForNode<TPose, TNode>(descriptor: PoseDescriptor<TPose, TNode>, node: TNode): PoseDescriptor<TPose, TNode>;
|
|
118
|
+
/** Identity geometry for `TPose extends Bounds`. Treats the pose as its
|
|
119
|
+
* own bounds and remaps via affine scale against `src`/`dst`. */
|
|
120
|
+
declare const RECT_POSE_DESCRIPTOR: PoseDescriptor<Bounds>;
|
|
121
|
+
/** Identity geometry for `RotatedPose`. Inherits rect-shape projection
|
|
122
|
+
* from `RECT_POSE_DESCRIPTOR` (the `RotatedPose extends Bounds`
|
|
123
|
+
* subtype lets the rect descriptor's methods apply directly; `remapBounds`
|
|
124
|
+
* preserves the `rotation` field via `...p` spread). Adds `getRotation` so
|
|
125
|
+
* `useResize` knows to take the rotation-aware math path. */
|
|
126
|
+
declare const ROTATED_POSE_DESCRIPTOR: PoseDescriptor<RotatedPose>;
|
|
127
|
+
/** The pose's visual bounds: its frame expanded to cover the rotated
|
|
128
|
+
* rectangle, so a turned shape reports the extent of its ink. */
|
|
129
|
+
declare function visualBoundsViaDescriptor<TPose>(pose: TPose, geometry: PoseDescriptor<TPose>): Bounds;
|
|
130
|
+
/** Translate through `geometry.translate`, or via `remapBounds` onto a shifted
|
|
131
|
+
* copy of the pose's own bounds when the descriptor has none. */
|
|
132
|
+
declare function translatePoseViaDescriptor<TPose>(pose: TPose, dx: number, dy: number, geometry: PoseDescriptor<TPose>): TPose;
|
|
133
|
+
|
|
134
|
+
export { type PoseDescriptor as P, RECT_POSE_DESCRIPTOR as R, type Path as a, ROTATED_POSE_DESCRIPTOR as b, type PolygonPath as c, type RotatedPose as d, type RectPath as e, type PathFillRule as f, poseDescriptorForNode as p, translatePoseViaDescriptor as t, visualBoundsViaDescriptor as v };
|
package/dist/renderer.d.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import { M as Mesh } from './
|
|
2
|
-
export { I as IDENTITY_COLOR_MATRIX, a as ImageMinification, R as RenderTarget, S as ShaderCompileError,
|
|
3
|
-
|
|
4
|
-
import { P as Path } from './path-JEV2c5If.js';
|
|
1
|
+
import { M as Mesh } from './depSchema-BubKMv-2.js';
|
|
2
|
+
export { C as CullRect, D as DrawCommand, E as Effect, G as GroupDrawCommand, I as IDENTITY_COLOR_MATRIX, a as ImageDrawCommand, b as ImageMinification, c as Mat3, P as PathDrawCommand, R as RenderTarget, S as SPRITE_STRIDE, d as ShaderCompileError, e as ShaderDrawCommand, f as ShaderProgramHandle, g as ShaderUniform, h as SolidPaint, i as SpriteSheet, j as SpritesDrawCommand, k as StrokeOptions, T as TextDrawCommand, V as ViewLike, W as WeaselRenderer, l as WeaselRendererOptions, m as blur, n as buildGradientRamp, o as cullDrawCommands, p as frameRect, q as mat3, r as registerEffect, s as registerProgram, t as tessellateStroke, v as viewToMat3, u as vignette } from './depSchema-BubKMv-2.js';
|
|
3
|
+
import { a as Path } from './poseDescriptor-PgfVKfa0.js';
|
|
5
4
|
export { canQueryLocalFonts, enableLocalFontOutlines, hasFontOutlines, isCanvasFont, listFontOutlines, outlineStatus, registerCanvasFont, registerFont, registerFontOutlines, subscribeGlyphReady, unregisterCanvasFont, unregisterFontOutlines } from '@weasel-js/font';
|
|
6
5
|
import { TextureHandle } from '@weasel-js/paint';
|
|
7
6
|
export { TextureHandle } from '@weasel-js/paint';
|
|
8
7
|
import '@weasel-js/text';
|
|
8
|
+
import '@weasel-js/history';
|
|
9
|
+
import '@weasel-js/routing';
|
|
10
|
+
import './types-BdaK9PcP.js';
|
|
11
|
+
import '@weasel-js/routing/react';
|
|
12
|
+
import './types-BHGdrOcu.js';
|
|
13
|
+
import '@weasel-js/geom';
|
|
9
14
|
|
|
10
15
|
/**
|
|
11
16
|
* registerTexture — accepts an image source, assigns an opaque id, stores in
|
package/dist/renderer.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export { EFFECT_KIT_UNIFORMS, EFFECT_VERT_SRC, IDENTITY_COLOR_MATRIX, OUTLINE_MIN_SCREEN_PX, SPRITE_STRIDE, ShaderCompileError, WeaselRenderer, blur, buildGradientRamp, canQueryLocalFonts, enableLocalFontOutlines, frameRect, hasFontOutlines, isCanvasFont, listFontOutlines, mat3, outlineStatus, registerCanvasFont, registerEffect, registerFont, registerFontOutlines, registerProgram, subscribeGlyphReady, tessellate, tessellateStroke, unregisterCanvasFont, unregisterFontOutlines, viewToMat3, vignette } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
4
|
-
import './chunk-
|
|
5
|
-
import './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, frameRect, hasFontOutlines, isCanvasFont, listFontOutlines, mat3, outlineStatus, registerCanvasFont, registerEffect, registerFont, registerFontOutlines, registerProgram, subscribeGlyphReady, tessellate, tessellateStroke, unregisterCanvasFont, unregisterFontOutlines, viewToMat3, vignette } from './chunk-GREL4MVO.js';
|
|
2
|
+
import './chunk-LXJDWBEL.js';
|
|
3
|
+
import './chunk-P6MGECVO.js';
|
|
4
|
+
import './chunk-XXQ6FLCJ.js';
|
|
5
|
+
import './chunk-HAGOFNP5.js';
|
|
6
|
+
import './chunk-3LPQ2XZG.js';
|
|
6
7
|
import './chunk-T3UQ3F6R.js';
|
|
7
8
|
import './chunk-D4AAWR64.js';
|
|
8
9
|
import './chunk-DOBSZOPR.js';
|
package/dist/resize.d.ts
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { P as
|
|
3
|
-
import {
|
|
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-CgcK2R_I.js';
|
|
2
|
+
export { P as PoseDescriptor, R as RECT_POSE_DESCRIPTOR, b as ROTATED_POSE_DESCRIPTOR, p as poseDescriptorForNode } from './poseDescriptor-PgfVKfa0.js';
|
|
3
|
+
import { B as BoundsConstraint } from './types-BHGdrOcu.js';
|
|
4
|
+
import { Bounds, ModifierState, View } from '@weasel-js/routing';
|
|
5
|
+
export { A as AUTO_POSE_DESCRIPTOR, i as isPathLike, a as isRectPose } from './autoPoseDescriptor-Dr6CwNZK.js';
|
|
4
6
|
import { G as Guide } from './types-D2tTKEU0.js';
|
|
5
|
-
import { V as View } from './view-DSQgxBJB.js';
|
|
6
|
-
import './types-BHK2dkMu.js';
|
|
7
|
-
import './path-JEV2c5If.js';
|
|
8
7
|
import '@weasel-js/history';
|
|
9
|
-
import './types-
|
|
8
|
+
import './types-BdaK9PcP.js';
|
|
10
9
|
|
|
11
10
|
/** Resize constraint that stops a node shrinking past a minimum. The anchored
|
|
12
11
|
* edge stays put, so clamping pushes the dragged edge back rather than moving
|
|
13
12
|
* the node. */
|
|
14
|
-
declare function clampMinSize<TPose extends
|
|
13
|
+
declare function clampMinSize<TPose extends Bounds>(args: {
|
|
15
14
|
minWidth: number;
|
|
16
15
|
minHeight: number;
|
|
17
16
|
}): BoundsConstraint<TPose>;
|
|
@@ -38,7 +37,7 @@ type ModKey$2 = keyof ModifierState;
|
|
|
38
37
|
* anchoring at the origin's top edge (`y` stays at `origin.y`). Symmetric
|
|
39
38
|
* for `n` / `s`.
|
|
40
39
|
*/
|
|
41
|
-
declare function lockAspectWithModifier<TPose extends
|
|
40
|
+
declare function lockAspectWithModifier<TPose extends Bounds>(opts?: {
|
|
42
41
|
key?: ModKey$2;
|
|
43
42
|
}): BoundsConstraint<TPose>;
|
|
44
43
|
|
|
@@ -47,7 +46,7 @@ type ModKey$1 = keyof ModifierState;
|
|
|
47
46
|
* anchored ones where they are. By default a node already smaller than one
|
|
48
47
|
* grid cell on an axis is left unsnapped on that axis, so it stays resizable
|
|
49
48
|
* at sub-grid sizes. */
|
|
50
|
-
declare function snapToGrid<TPose extends
|
|
49
|
+
declare function snapToGrid<TPose extends Bounds>(args: {
|
|
51
50
|
spacing: number;
|
|
52
51
|
bypassKey?: ModKey$1;
|
|
53
52
|
suspendBelowDim?: boolean;
|
|
@@ -75,12 +74,12 @@ interface SnapToGuidesResizeArgs {
|
|
|
75
74
|
* edge — east when `anchor.x === 'min'` (west pinned), west when `'max'`.
|
|
76
75
|
* Likewise on Y for horizontal guides.
|
|
77
76
|
*/
|
|
78
|
-
declare function snapToGuides<TPose extends
|
|
77
|
+
declare function snapToGuides<TPose extends Bounds>(args: SnapToGuidesResizeArgs): BoundsConstraint<TPose>;
|
|
79
78
|
|
|
80
79
|
/** The kit's standard resize behaviors, applied when a consumer doesn't
|
|
81
80
|
* supply its own list: shift-drag locks the start pose's aspect ratio.
|
|
82
81
|
* Pass an explicit `behaviors: []` to opt out. Stateless, so one shared
|
|
83
82
|
* frozen instance is safe across every gesture. */
|
|
84
|
-
declare const DEFAULT_RESIZE_BEHAVIORS: readonly BoundsConstraint<
|
|
83
|
+
declare const DEFAULT_RESIZE_BEHAVIORS: readonly BoundsConstraint<Bounds>[];
|
|
85
84
|
|
|
86
85
|
export { DEFAULT_RESIZE_BEHAVIORS, clampMinSize, lockAspectWithModifier, snapToGrid, snapToGuides };
|
package/dist/resize.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { CORNER_ANCHORS, DEFAULT_RESIZE_BEHAVIORS, clampMinSize, cornerPoint, cornerResizeHandles, fixedCornerOf, hitCornerHandle, lockAspectWithModifier, pointSnapToGrid, snapToGrid, snapToGuides } from './chunk-
|
|
2
|
-
|
|
1
|
+
export { CORNER_ANCHORS, DEFAULT_RESIZE_BEHAVIORS, clampMinSize, cornerPoint, cornerResizeHandles, fixedCornerOf, hitCornerHandle, lockAspectWithModifier, pointSnapToGrid, snapToGrid, snapToGuides } from './chunk-XXQ6FLCJ.js';
|
|
2
|
+
import './chunk-HAGOFNP5.js';
|
|
3
|
+
export { AUTO_POSE_DESCRIPTOR, RECT_POSE_DESCRIPTOR, ROTATED_POSE_DESCRIPTOR, isPathLike, isRectPose, poseDescriptorForNode } from './chunk-3LPQ2XZG.js';
|
|
3
4
|
//# sourceMappingURL=resize.js.map
|
|
4
5
|
//# sourceMappingURL=resize.js.map
|
package/dist/routing.d.ts
CHANGED
|
@@ -1,142 +1 @@
|
|
|
1
|
-
|
|
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-BY-wI9gm.js';
|
|
4
|
-
import './types-bcc7jcUy.js';
|
|
5
|
-
import '@weasel-js/history';
|
|
6
|
-
import './path-JEV2c5If.js';
|
|
7
|
-
import './types-ei3UMl9R.js';
|
|
8
|
-
import './types-DEALFt5F.js';
|
|
9
|
-
import './view-DSQgxBJB.js';
|
|
10
|
-
import '@weasel-js/modes';
|
|
11
|
-
import 'react';
|
|
12
|
-
import './DrawCommand-CD-ug3d9.js';
|
|
13
|
-
import '@weasel-js/paint';
|
|
14
|
-
import '@weasel-js/text';
|
|
15
|
-
import './geometry-6fCNhAux.js';
|
|
16
|
-
import '@weasel-js/cursor';
|
|
17
|
-
import 'react/jsx-runtime';
|
|
18
|
-
import './types-BHK2dkMu.js';
|
|
19
|
-
import '@weasel-js/geom';
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* One row in the route registry — a single `GestureBinding` on one tool,
|
|
23
|
-
* flattened into the route grammar's vocabulary so the inspector, the
|
|
24
|
-
* conflict checker, and `describeRoute` can all read the same shape.
|
|
25
|
-
*
|
|
26
|
-
* Multiple rows can share (gesture, arg, target, modifiers) if different tools
|
|
27
|
-
* declare them; consumers walk the list and group client-side.
|
|
28
|
-
*/
|
|
29
|
-
interface RegistryEntry {
|
|
30
|
-
toolId: string;
|
|
31
|
-
/** Which phase the binding's `phase` spec restricts it to. `'any'` when it
|
|
32
|
-
* declares none, declares `'*'`, or declares an atom list whose atoms
|
|
33
|
-
* don't agree on one phase — such a binding fires in either phase, and
|
|
34
|
-
* reporting it as `'initial'` made it collide with genuinely-initial
|
|
35
|
-
* bindings in `findConflicts`' bucket key. */
|
|
36
|
-
phase: 'initial' | 'engaged' | 'any';
|
|
37
|
-
/** Structured v3 modifier requirements. Empty object = "no modifiers
|
|
38
|
-
* held" (the strict default). */
|
|
39
|
-
modifiers: ParsedModifiers;
|
|
40
|
-
gesture: GestureName;
|
|
41
|
-
/** Resolved arg value for arg-bearing gestures (wheel direction,
|
|
42
|
-
* key name, multiTouchTap fingers). Undefined for gestures whose
|
|
43
|
-
* descriptor has no `arg`. */
|
|
44
|
-
arg: string | undefined;
|
|
45
|
-
/** Target class for hit-testing gestures. `undefined` when the descriptor
|
|
46
|
-
* has `hasTarget: false` or the spec declares no target;
|
|
47
|
-
* {@link PREDICATE_TARGET} when the spec uses a `kindOf` predicate, which
|
|
48
|
-
* the route grammar has no notation for. */
|
|
49
|
-
target: string | undefined;
|
|
50
|
-
/** The action this binding fires. */
|
|
51
|
-
actionId: string;
|
|
52
|
-
/** The `GestureSpec` this row was flattened from, by reference. Reflection
|
|
53
|
-
* consumers that need something the grammar doesn't capture — the
|
|
54
|
-
* specificity tuple, a `kindOf` predicate identity — read it here rather
|
|
55
|
-
* than re-walking `Tool.bindings`. */
|
|
56
|
-
spec: GestureSpec;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Stand-in target for a `{ kindOf }` predicate spec.
|
|
60
|
-
*
|
|
61
|
-
* The route grammar can name target *classes* (`empty`, `selected-body`,
|
|
62
|
-
* `kind:rect`) but not arbitrary predicates, so three distinct select-tool
|
|
63
|
-
* bindings all render as this one token. Narrowing it would mean giving the
|
|
64
|
-
* grammar a way to describe a function, which is a real design question and
|
|
65
|
-
* not one this reflection layer should answer by inventing syntax.
|
|
66
|
-
*/
|
|
67
|
-
declare const PREDICATE_TARGET = "predicate";
|
|
68
|
-
/**
|
|
69
|
-
* Flatten every tool's `bindings` into route-registry rows.
|
|
70
|
-
*
|
|
71
|
-
* This was `buildActionRegistry`, and it walked `ToolDef.initial` /
|
|
72
|
-
* `.engaged` phase tables — the grammar that no longer exists. It was also
|
|
73
|
-
* blind to `Tool.bindings` the entire time the two lived side by side, which
|
|
74
|
-
* is why the inspector under-reported select by more than half. The rename
|
|
75
|
-
* fixes a second thing: it never had anything to do with the Actions
|
|
76
|
-
* Registry, and reading `buildActionRegistry` next to `ActionsRegistry`
|
|
77
|
-
* suggested otherwise.
|
|
78
|
-
*/
|
|
79
|
-
declare function buildRouteRegistry(tools: readonly Tool<unknown>[]): RegistryEntry[];
|
|
80
|
-
/** The route-grammar gesture a `GestureSpec.kind` routes as, or `undefined`
|
|
81
|
-
* for kinds the grammar has no name for. */
|
|
82
|
-
declare function routeGestureForSpecKind(kind: GestureSpec['kind']): GestureName | undefined;
|
|
83
|
-
/**
|
|
84
|
-
* Every route string one `GestureSpec` declares, in route-grammar notation.
|
|
85
|
-
*
|
|
86
|
-
* One string per arg alternative — a spec bound to `['ArrowUp','ArrowDown']`
|
|
87
|
-
* yields two routes, because each is separately conflictable and separately
|
|
88
|
-
* readable. Returns `[]` for spec kinds the grammar can't name.
|
|
89
|
-
*
|
|
90
|
-
* This is the display counterpart to {@link buildRouteRegistry}: same
|
|
91
|
-
* projection of a spec onto the grammar, rendered as text instead of as a
|
|
92
|
-
* conflict-checkable row.
|
|
93
|
-
*/
|
|
94
|
-
declare function routesForSpec(spec: GestureSpec): readonly string[];
|
|
95
|
-
|
|
96
|
-
/** Two or more tools declare the same exact (phase, gesture, arg, target,
|
|
97
|
-
* modifiers) tuple — the dispatcher's slot precedence picks one
|
|
98
|
-
* arbitrarily (well, deterministically by slot order, but the author
|
|
99
|
-
* probably didn't intend the duplication). */
|
|
100
|
-
interface Conflict {
|
|
101
|
-
phase: 'initial' | 'engaged' | 'any';
|
|
102
|
-
gesture: GestureName;
|
|
103
|
-
arg: string | undefined;
|
|
104
|
-
target: string | undefined;
|
|
105
|
-
modifiers: ParsedModifiers;
|
|
106
|
-
/** All tool ids that registered the same tuple. At least 2 by
|
|
107
|
-
* construction. Order matches the input tools[] order. */
|
|
108
|
-
toolIds: string[];
|
|
109
|
-
}
|
|
110
|
-
/** Detect exact-tuple overlaps across a tool registration set.
|
|
111
|
-
*
|
|
112
|
-
* Intentionally NOT flagged:
|
|
113
|
-
* - Broad vs. narrow targets (e.g. an untargeted `click` alongside
|
|
114
|
-
* `click` on `empty`) — the dispatcher's specificity ordering resolves
|
|
115
|
-
* those cleanly, and the broad one is usually the intended fallback.
|
|
116
|
-
* - Different modifier requirements on the same target — they fire on
|
|
117
|
-
* different inputs.
|
|
118
|
-
* - A binding whose action declines via `enabled()` so a lower-priority
|
|
119
|
-
* one can take the gesture. Detecting that intent would mean evaluating
|
|
120
|
-
* the action; consumers can suppress known-intentional compositions in
|
|
121
|
-
* their UI layer.
|
|
122
|
-
*
|
|
123
|
-
* - Two `{ kindOf }` predicate targets. The route grammar renders every
|
|
124
|
-
* predicate as the single token {@link PREDICATE_TARGET}, so bucketing on
|
|
125
|
-
* the rendered target alone reported select's `resize` / `rotate` / `move`
|
|
126
|
-
* drags — three genuinely different predicates — as a three-way conflict.
|
|
127
|
-
* Predicate entries bucket by function identity instead, which means two
|
|
128
|
-
* *separately written but equivalent* predicates go unflagged. That's the
|
|
129
|
-
* right way to be wrong here: this check has to be silent when nothing is
|
|
130
|
-
* wrong or nobody will keep it on.
|
|
131
|
-
*
|
|
132
|
-
* Note that two bindings sharing a tuple on the SAME tool are now possible
|
|
133
|
-
* (bindings are an array, where phase tables were objects with unique
|
|
134
|
-
* keys) — so a conflict may name one tool twice.
|
|
135
|
-
*
|
|
136
|
-
* This is the raw same-tuple detector. Feeding it a whole tool *registry*
|
|
137
|
-
* over-reports, because registry tools take turns in the active slot and
|
|
138
|
-
* can't collide with each other — see {@link findScopedConflicts}.
|
|
139
|
-
*/
|
|
140
|
-
declare function findConflicts(tools: readonly Tool<unknown>[]): Conflict[];
|
|
141
|
-
|
|
142
|
-
export { type Conflict, PREDICATE_TARGET, type RegistryEntry, buildRouteRegistry, findConflicts, routeGestureForSpecKind, routesForSpec };
|
|
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';
|
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, routeGestureForSpecKind, routesForSpec } from '
|
|
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';
|
|
2
2
|
//# sourceMappingURL=routing.js.map
|
|
3
3
|
//# sourceMappingURL=routing.js.map
|
package/dist/routing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"routing.js"}
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"routing.js","sourcesContent":[]}
|
|
@@ -1,20 +1,6 @@
|
|
|
1
1
|
import { Op } from '@weasel-js/history';
|
|
2
|
-
import { S as SnapTarget, M as MoveAdapter, I as InsertAdapter } from './types-
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Snapshot of modifier-key state at gesture dispatch.
|
|
6
|
-
*
|
|
7
|
-
* Lives in core rather than beside the gesture types that produce it because
|
|
8
|
-
* `core/selection/chromeState.ts` reads it, and core may not import from
|
|
9
|
-
* `interactions/`. Re-exported from `interactions/gestures/types.ts`, which
|
|
10
|
-
* is still where gesture code names it.
|
|
11
|
-
*/
|
|
12
|
-
interface ModifierState {
|
|
13
|
-
alt: boolean;
|
|
14
|
-
shift: boolean;
|
|
15
|
-
meta: boolean;
|
|
16
|
-
ctrl: boolean;
|
|
17
|
-
}
|
|
2
|
+
import { S as SnapTarget, M as MoveAdapter, I as InsertAdapter } from './types-BdaK9PcP.js';
|
|
3
|
+
import { Bounds, ModifierState, ResizeAnchor } from '@weasel-js/routing';
|
|
18
4
|
|
|
19
5
|
/** Pointer position in both world and client coords. */
|
|
20
6
|
interface PointerState {
|
|
@@ -130,31 +116,20 @@ type BehaviorMoveResult<TPose> = BehaviorResult<TPose>;
|
|
|
130
116
|
* `useMove`) and return a `BehaviorResult` shaping it (or, legacy, an
|
|
131
117
|
* override pose run through the back-compat shim). */
|
|
132
118
|
type MoveBehavior<TPose> = ActionBehavior<TPose, GroupTransform, BehaviorResult<TPose>>;
|
|
133
|
-
|
|
134
|
-
type ResizeAnchor = {
|
|
135
|
-
x: 'min' | 'max' | 'free';
|
|
136
|
-
y: 'min' | 'max' | 'free';
|
|
137
|
-
};
|
|
138
|
-
/** Minimum rect-shaped pose required by the resize machinery. */
|
|
139
|
-
interface ResizePose {
|
|
140
|
-
x: number;
|
|
141
|
-
y: number;
|
|
142
|
-
width: number;
|
|
143
|
-
height: number;
|
|
144
|
-
}
|
|
119
|
+
|
|
145
120
|
/** Per-frame proposed resize: pose plus the anchor pinning the opposite corner. */
|
|
146
|
-
interface ResizeProposed<TPose extends
|
|
121
|
+
interface ResizeProposed<TPose extends Bounds> {
|
|
147
122
|
pose: TPose;
|
|
148
123
|
anchor: ResizeAnchor;
|
|
149
124
|
}
|
|
150
125
|
/** Per-frame result a `BoundsConstraint.onMove` can return to override the proposed pose. */
|
|
151
|
-
interface ResizeMoveResult<TPose extends
|
|
126
|
+
interface ResizeMoveResult<TPose extends Bounds> {
|
|
152
127
|
pose?: TPose;
|
|
153
128
|
}
|
|
154
129
|
/** A bounds-frame constraint plugged into `useResize` / `resizeAction`.
|
|
155
130
|
* Reads/writes `{x,y,width,height}` and can override the proposed pose
|
|
156
131
|
* on each frame (e.g. lock-aspect, clamp-min-size, snap-to-grid). */
|
|
157
|
-
type BoundsConstraint<TPose extends
|
|
132
|
+
type BoundsConstraint<TPose extends Bounds> = ActionBehavior<TPose, ResizeProposed<TPose>, ResizeMoveResult<TPose>>;
|
|
158
133
|
/** Live overlay state exposed by `useResize` for rendering the in-flight resize ghost. */
|
|
159
134
|
interface ResizeOverlay<TPose> {
|
|
160
135
|
id: string;
|
|
@@ -168,11 +143,7 @@ interface ResizeOverlay<TPose> {
|
|
|
168
143
|
* resizes. */
|
|
169
144
|
leafPoses?: Map<string, TPose>;
|
|
170
145
|
}
|
|
171
|
-
|
|
172
|
-
* center of the unrotated `{x, y, width, height}`. */
|
|
173
|
-
interface RotatedPose extends ResizePose {
|
|
174
|
-
rotation: number;
|
|
175
|
-
}
|
|
146
|
+
|
|
176
147
|
/** Per-frame proposed rotation: pose plus the candidate angle in radians. */
|
|
177
148
|
interface RotateProposed<TPose> {
|
|
178
149
|
pose: TPose;
|
|
@@ -203,7 +174,7 @@ interface InsertPoint {
|
|
|
203
174
|
interface InsertProposed<TPose> {
|
|
204
175
|
start: InsertPoint;
|
|
205
176
|
current: InsertPoint;
|
|
206
|
-
bounds:
|
|
177
|
+
bounds: Bounds;
|
|
207
178
|
pose: TPose;
|
|
208
179
|
}
|
|
209
180
|
/** Per-frame result an `InsertBehavior.onMove` can return to override the start/current points. */
|
|
@@ -221,7 +192,7 @@ interface InsertOverlay<TPose> {
|
|
|
221
192
|
start: InsertPoint;
|
|
222
193
|
current: InsertPoint;
|
|
223
194
|
/** Axis-aligned bounding rect derived from `start`/`current`. */
|
|
224
|
-
bounds:
|
|
195
|
+
bounds: Bounds;
|
|
225
196
|
/** TPose constructed from `bounds` via the hook's `posefromBounds`. */
|
|
226
197
|
pose: TPose;
|
|
227
198
|
}
|
|
@@ -276,7 +247,7 @@ type PointSnapFrame = 'dragged-corner' | 'fixed-corner' | 'center' | 'origin';
|
|
|
276
247
|
* `draggedCorner` and `fixedCorner` are `null` for edge drags
|
|
277
248
|
* (`anchor.x === 'free'` or `anchor.y === 'free'`). `center` and
|
|
278
249
|
* `origin` are always present. */
|
|
279
|
-
interface PointSnapContext<TPose extends
|
|
250
|
+
interface PointSnapContext<TPose extends Bounds> {
|
|
280
251
|
draggedCorner: {
|
|
281
252
|
worldX: number;
|
|
282
253
|
worldY: number;
|
|
@@ -305,7 +276,7 @@ interface PointSnapResult {
|
|
|
305
276
|
worldY: number;
|
|
306
277
|
}
|
|
307
278
|
/** A point-snap behavior plugged into `useResize`'s `pointSnapBehaviors`. */
|
|
308
|
-
interface PointSnapBehavior<TPose extends
|
|
279
|
+
interface PointSnapBehavior<TPose extends Bounds> {
|
|
309
280
|
id?: string;
|
|
310
281
|
onMove(ctx: PointSnapContext<TPose>): PointSnapResult | null | undefined;
|
|
311
282
|
}
|
|
@@ -336,4 +307,4 @@ interface CloneBehavior {
|
|
|
336
307
|
}) => Op[];
|
|
337
308
|
}
|
|
338
309
|
|
|
339
|
-
export type { ActionBehavior as A, BoundsConstraint as B, CloneBehavior as C,
|
|
310
|
+
export type { ActionBehavior as A, BoundsConstraint as B, CloneBehavior as C, GestureContext as G, InsertBehavior as I, LassoSelectBehavior as L, MoveBehavior as M, PointSnapBehavior as P, RotateBehavior as R, SnapStrategy as S, PointSnapFrame as a, AreaSelectOverlay as b, BehaviorMoveResult as c, BehaviorResult as d, CloneLayer as e, ClonePose as f, GroupTransform as g, InsertMoveResult as h, InsertOverlay as i, InsertPoint as j, InsertProposed as k, LassoSelectMoveResult as l, LassoSelectOverlay as m, LassoSelectPose as n, LassoSelectProposed as o, PointSnapContext as p, PointSnapResult as q, PointerState as r, ResizeMoveResult as s, ResizeOverlay as t, ResizeProposed as u, RotateMoveResult as v, RotateOverlay as w, RotateProposed as x };
|
|
@@ -133,9 +133,10 @@ interface SnapTarget<TPose = unknown> {
|
|
|
133
133
|
*
|
|
134
134
|
* **Pose semantics:** `getPose` / `setPose` work in **local** coordinates —
|
|
135
135
|
* relative to the node's direct parent (or world, for root-parented nodes).
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
136
|
+
* `getWorldPose` is the composed reading, and is what the render walk, picking
|
|
137
|
+
* and chrome consume. For the common axis-aligned rect pose, `composeRectPose`
|
|
138
|
+
* (translation only) and `composeRigidPose` (a container's pose is a frame, so
|
|
139
|
+
* its rotation reaches its children) ship as the two canonical strategies.
|
|
139
140
|
*/
|
|
140
141
|
interface SceneAdapter<TNode extends {
|
|
141
142
|
id: string;
|
|
@@ -145,6 +146,11 @@ interface SceneAdapter<TNode extends {
|
|
|
145
146
|
getSelection(): string[];
|
|
146
147
|
hitTest(worldX: number, worldY: number): string | null;
|
|
147
148
|
getPose(id: string): TPose;
|
|
149
|
+
/** The node's pose in world coordinates, with every ancestor's frame folded
|
|
150
|
+
* in. Equal to `getPose` under the absolute-pose model; anything reasoning
|
|
151
|
+
* about where a node actually is — picking, chrome, snapping, export —
|
|
152
|
+
* wants this rather than `getPose`. */
|
|
153
|
+
getWorldPose?(id: string): TPose;
|
|
148
154
|
getParent(id: string): string | null;
|
|
149
155
|
setPose(id: string, pose: TPose): void;
|
|
150
156
|
setParent(id: string, parentId: string | null): void;
|
|
@@ -376,4 +382,4 @@ interface OrderedAdapter {
|
|
|
376
382
|
setChildOrder?(parentId: string | null, ids: string[]): void;
|
|
377
383
|
}
|
|
378
384
|
|
|
379
|
-
export type { AreaSelectAdapter as A, ClipboardSnapshot as C, DropTarget as D, InsertAdapter as I, LayoutStrategy as L, MoveAdapter as M, OrderedAdapter as O,
|
|
385
|
+
export type { AreaSelectAdapter as A, ClipboardSnapshot as C, DropTarget as D, InsertAdapter as I, LayoutStrategy as L, MoveAdapter as M, OrderedAdapter as O, ResizeAdapter as R, SnapTarget as S, SceneAdapter as a, LassoHitMode as b, LassoSelectAdapter as c, RotateAdapter as d, LayerEnumerableAdapter as e, LayoutSnap as f, ContainerBounds as g, LayoutChild as h, LayoutContainer as i, LayoutDragged as j };
|