@weasel-js/core 0.7.2 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +541 -0
- package/dist/{DrawCommand-CJtqqt8H.d.ts → DrawCommand-DCmiNkBj.d.ts} +38 -170
- package/dist/{chunk-CQNKCG34.js → chunk-6SHZHXXR.js} +47 -10
- package/dist/chunk-6SHZHXXR.js.map +1 -0
- package/dist/{chunk-5F3PIERN.js → chunk-D2C6K6FO.js} +1420 -652
- package/dist/chunk-D2C6K6FO.js.map +1 -0
- package/dist/chunk-DCIU3SRK.js +505 -0
- package/dist/chunk-DCIU3SRK.js.map +1 -0
- package/dist/chunk-IO5Z75X4.js +167 -0
- package/dist/chunk-IO5Z75X4.js.map +1 -0
- package/dist/{chunk-VOVKONXA.js → chunk-UB6A6L77.js} +3 -3
- package/dist/{chunk-VOVKONXA.js.map → chunk-UB6A6L77.js.map} +1 -1
- package/dist/{chunk-BGGZ4CVF.js → chunk-Z3KNFTTS.js} +6 -6
- package/dist/chunk-Z3KNFTTS.js.map +1 -0
- package/dist/clipboard.d.ts +2 -2
- package/dist/clone.d.ts +1 -1
- package/dist/{geometry-D9BDMiQi.d.ts → geometry-DVeZ2i-c.d.ts} +1 -1
- package/dist/{grid-CaSK9bHV.d.ts → grid-XcFQVS0f.d.ts} +1 -1
- package/dist/{index-DOYRTfP0.d.ts → index-ChM3ZJ2v.d.ts} +278 -93
- package/dist/index.d.ts +442 -57
- package/dist/index.js +6 -6
- package/dist/insert.d.ts +2 -2
- package/dist/insert.js +5 -5
- package/dist/insert.js.map +1 -1
- package/dist/move.d.ts +3 -3
- package/dist/move.js +2 -2
- package/dist/{options-DMWeTELe.d.ts → options-wAvCnOZd.d.ts} +1 -1
- package/dist/paint-types-CnLIzqq1.d.ts +261 -0
- package/dist/patterns-builtin.d.ts +57 -2
- package/dist/patterns-builtin.js +1 -97
- package/dist/patterns-builtin.js.map +1 -1
- package/dist/{pointSnapToGrid-C3EruUwt.d.ts → pointSnapToGrid-BuDZWBrL.d.ts} +2 -2
- package/dist/renderer.d.ts +25 -8
- package/dist/renderer.js +6 -6
- package/dist/resize.d.ts +3 -3
- package/dist/resize.js +2 -2
- package/dist/routing.d.ts +7 -7
- package/dist/routing.js +1 -1
- package/dist/{types-Dcaa0tPq.d.ts → types-BhJJ2OCM.d.ts} +9 -1
- package/dist/{types-Cpb4hii1.d.ts → types-DUpI7Apc.d.ts} +3 -95
- package/dist/{viewToMat3-D4lrBigW.d.ts → viewToMat3-BvaWCN99.d.ts} +1 -1
- package/package.json +6 -6
- package/dist/chunk-5F3PIERN.js.map +0 -1
- package/dist/chunk-BGGZ4CVF.js.map +0 -1
- package/dist/chunk-CQNKCG34.js.map +0 -1
- package/dist/chunk-SYM6RAM4.js +0 -232
- package/dist/chunk-SYM6RAM4.js.map +0 -1
- package/dist/chunk-Y52N27PF.js +0 -39
- package/dist/chunk-Y52N27PF.js.map +0 -1
- package/dist/registerTexture-BzHTLhD9.d.ts +0 -25
- /package/dist/{types-B6MMiodD.d.ts → path-B6MMiodD.d.ts} +0 -0
package/dist/renderer.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { I as ImageMinification, G as GLImageCache } from './viewToMat3-
|
|
2
|
-
export { V as ViewLike, v as viewToMat3 } from './viewToMat3-
|
|
3
|
-
import { G as GradStop,
|
|
4
|
-
export {
|
|
5
|
-
import {
|
|
1
|
+
import { I as ImageMinification, G as GLImageCache } from './viewToMat3-BvaWCN99.js';
|
|
2
|
+
export { V as ViewLike, v as viewToMat3 } from './viewToMat3-BvaWCN99.js';
|
|
3
|
+
import { G as GradStop, S as Stroke } from './paint-types-CnLIzqq1.js';
|
|
4
|
+
export { a as TextureHandle, r as registerTexture } from './paint-types-CnLIzqq1.js';
|
|
5
|
+
import { M as Mat3, S as ShaderProgramHandle, D as DrawCommand } from './DrawCommand-DCmiNkBj.js';
|
|
6
|
+
export { G as GroupDrawCommand, I as ImageDrawCommand, P as PathDrawCommand, a as ShaderDrawCommand, b as ShaderUniform, c as SolidPaint, T as TextDrawCommand, m as mat3, r as registerProgram } from './DrawCommand-DCmiNkBj.js';
|
|
7
|
+
import { P as Path } from './path-B6MMiodD.js';
|
|
6
8
|
export { canQueryLocalFonts, enableLocalFontOutlines, hasFontOutlines, isCanvasFont, listFontOutlines, outlineStatus, registerCanvasFont, registerFont, registerFontOutlines, subscribeGlyphReady, unregisterCanvasFont, unregisterFontOutlines } from '@weasel-js/font';
|
|
7
|
-
export { T as TextureHandle, r as registerTexture } from './registerTexture-BzHTLhD9.js';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Minimal compile/link/lookup wrapper for a GL program. Throws
|
|
@@ -153,12 +154,18 @@ declare class GLMeshCache {
|
|
|
153
154
|
* linear filtering, and mipmap resampling corrupts the multi-channel SDF signal.
|
|
154
155
|
*/
|
|
155
156
|
type TexSource = HTMLImageElement | ImageBitmap | ImageData | HTMLCanvasElement;
|
|
157
|
+
/** How a texture samples outside `0..1`. Pattern tiles need `'repeat'`;
|
|
158
|
+
* everything else clamps. WebGL2 allows `REPEAT` on NPOT textures, so a
|
|
159
|
+
* tile of any size tiles correctly. */
|
|
160
|
+
type TextureWrap = 'clamp' | 'repeat';
|
|
156
161
|
declare class GLTextureCache {
|
|
157
162
|
private readonly gl;
|
|
158
163
|
private readonly map;
|
|
159
164
|
constructor(gl: WebGL2RenderingContext);
|
|
160
165
|
has(id: string): boolean;
|
|
161
|
-
|
|
166
|
+
/** Uploads once per id; `wrap` therefore applies on first upload only.
|
|
167
|
+
* An id is either a pattern tile or a shader texture, never both. */
|
|
168
|
+
upload(id: string, source: TexSource, wrap?: TextureWrap): string;
|
|
162
169
|
/** Create a single-channel R8 texture from raw bytes (full upload).
|
|
163
170
|
* No-op if `id` already exists. Same LINEAR/CLAMP params as `upload`;
|
|
164
171
|
* UNPACK_ALIGNMENT dropped to 1 for non-4-aligned row widths. */
|
|
@@ -266,6 +273,7 @@ declare class WeaselRenderer {
|
|
|
266
273
|
private textSdfR8;
|
|
267
274
|
private imageFill;
|
|
268
275
|
private gradFill;
|
|
276
|
+
private patternFill;
|
|
269
277
|
private meshCache;
|
|
270
278
|
private textureCache;
|
|
271
279
|
private imageCache;
|
|
@@ -338,7 +346,15 @@ declare class WeaselRenderer {
|
|
|
338
346
|
* A disposed renderer ignores further `render()` and `registerProgram()`
|
|
339
347
|
* calls. */
|
|
340
348
|
dispose(): void;
|
|
341
|
-
|
|
349
|
+
/**
|
|
350
|
+
* Draw one frame.
|
|
351
|
+
*
|
|
352
|
+
* `viewMatrix` is the frame's world→screen transform. It is only consulted
|
|
353
|
+
* by `units: 'world'` gradients, which fall back to screen space without
|
|
354
|
+
* it — every other command carries its own transform in the stream, so
|
|
355
|
+
* callers with no view concept can keep calling `render(commands)`.
|
|
356
|
+
*/
|
|
357
|
+
render(commands: DrawCommand[], viewMatrix?: Mat3): void;
|
|
342
358
|
resize(dims: {
|
|
343
359
|
width: number;
|
|
344
360
|
height: number;
|
|
@@ -351,6 +367,7 @@ declare class WeaselRenderer {
|
|
|
351
367
|
/** @internal */ _textSdfR8(): ShaderProgram;
|
|
352
368
|
/** @internal */ _imageFill(): ShaderProgram;
|
|
353
369
|
/** @internal */ _gradFill(): ShaderProgram;
|
|
370
|
+
/** @internal */ _patternFill(): ShaderProgram;
|
|
354
371
|
/** @internal */ _meshCache(): GLMeshCache;
|
|
355
372
|
/** @internal */ _textureCache(): GLTextureCache;
|
|
356
373
|
/** @internal */ _imageCache(): GLImageCache;
|
package/dist/renderer.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
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-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
4
|
-
import './chunk-
|
|
5
|
-
import './chunk-
|
|
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';
|
|
2
|
+
import './chunk-DCIU3SRK.js';
|
|
3
|
+
import './chunk-UB6A6L77.js';
|
|
4
|
+
import './chunk-Z3KNFTTS.js';
|
|
5
|
+
import './chunk-6SHZHXXR.js';
|
|
6
6
|
import './chunk-775XXAHR.js';
|
|
7
7
|
import './chunk-UGFFCMQP.js';
|
|
8
8
|
import './chunk-BHVYVFGV.js';
|
|
9
9
|
import './chunk-GVCNT7UH.js';
|
|
10
|
-
export { registerTexture } from './chunk-
|
|
10
|
+
export { registerTexture } from './chunk-IO5Z75X4.js';
|
|
11
11
|
import './chunk-PZ5AY32C.js';
|
|
12
12
|
//# sourceMappingURL=renderer.js.map
|
|
13
13
|
//# sourceMappingURL=renderer.js.map
|
package/dist/resize.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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-
|
|
2
|
-
export { P as PoseProjection, R as RECT_POSE_DESCRIPTOR, a as ROTATED_POSE_DESCRIPTOR } from './geometry-
|
|
3
|
-
import { R as ResizePose, B as BoundsConstraint, M as ModifierState } from './types-
|
|
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-BuDZWBrL.js';
|
|
2
|
+
export { P as PoseProjection, R as RECT_POSE_DESCRIPTOR, a as ROTATED_POSE_DESCRIPTOR } from './geometry-DVeZ2i-c.js';
|
|
3
|
+
import { R as ResizePose, B as BoundsConstraint, M as ModifierState } from './types-BhJJ2OCM.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-BJ8_cyT7.js';
|
package/dist/resize.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { CORNER_ANCHORS, DEFAULT_RESIZE_BEHAVIORS, clampMinSize, cornerPoint, cornerResizeHandles, fixedCornerOf, hitCornerHandle, lockAspectWithModifier, pointSnapToGrid, snapToGrid, snapToGuides } from './chunk-
|
|
2
|
-
export { RECT_POSE_DESCRIPTOR, ROTATED_POSE_DESCRIPTOR } from './chunk-
|
|
1
|
+
export { CORNER_ANCHORS, DEFAULT_RESIZE_BEHAVIORS, clampMinSize, cornerPoint, cornerResizeHandles, fixedCornerOf, hitCornerHandle, lockAspectWithModifier, pointSnapToGrid, snapToGrid, snapToGuides } from './chunk-Z3KNFTTS.js';
|
|
2
|
+
export { RECT_POSE_DESCRIPTOR, ROTATED_POSE_DESCRIPTOR } from './chunk-6SHZHXXR.js';
|
|
3
3
|
import './chunk-PZ5AY32C.js';
|
|
4
4
|
//# sourceMappingURL=resize.js.map
|
|
5
5
|
//# sourceMappingURL=resize.js.map
|
package/dist/routing.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
export {
|
|
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';
|
|
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-
|
|
3
|
+
import './types-DUpI7Apc.js';
|
|
4
4
|
import '@weasel-js/history';
|
|
5
|
-
import './
|
|
6
|
-
import './types-
|
|
5
|
+
import './path-B6MMiodD.js';
|
|
6
|
+
import './types-BhJJ2OCM.js';
|
|
7
7
|
import './types-B_-khFM0.js';
|
|
8
8
|
import './view-DSQgxBJB.js';
|
|
9
9
|
import '@weasel-js/modes';
|
|
10
10
|
import 'react';
|
|
11
|
-
import './
|
|
12
|
-
import './
|
|
11
|
+
import './geometry-DVeZ2i-c.js';
|
|
12
|
+
import './paint-types-CnLIzqq1.js';
|
|
13
|
+
import './DrawCommand-DCmiNkBj.js';
|
|
13
14
|
import 'react/jsx-runtime';
|
|
14
|
-
import './geometry-D9BDMiQi.js';
|
|
15
15
|
import '@weasel-js/geom';
|
|
16
16
|
import './types-BJ8_cyT7.js';
|
package/dist/routing.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { GESTURE_DESCRIPTORS, PREDICATE_TARGET, RESERVED_ID_NAMES, RESERVED_ID_PREFIXES, ROUTE_FIELD_DEFINITIONS, ROUTE_TERMS, buildRouteRegistry, canonicalModifiers, collapseShiftPairs, defineTool, defineViewportTool, describeRoute, describeRouteParts, findConflicts, findScopedConflicts, formatConflict, formatPhaseAtom, formatRoute, getGestureDescriptor, isKnownGestureName, parseRoute, reportRouteConflicts } from './chunk-
|
|
1
|
+
export { GESTURE_DESCRIPTORS, PREDICATE_TARGET, RESERVED_ID_NAMES, RESERVED_ID_PREFIXES, ROUTE_FIELD_DEFINITIONS, ROUTE_TERMS, buildRouteRegistry, canonicalModifiers, collapseShiftPairs, defineTool, defineViewportTool, describeRoute, describeRouteParts, findConflicts, findScopedConflicts, formatConflict, formatPhaseAtom, formatRoute, getGestureDescriptor, isKnownGestureName, parseRoute, reportRouteConflicts } from './chunk-DCIU3SRK.js';
|
|
2
2
|
import './chunk-PZ5AY32C.js';
|
|
3
3
|
//# sourceMappingURL=routing.js.map
|
|
4
4
|
//# sourceMappingURL=routing.js.map
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import { Op } from '@weasel-js/history';
|
|
2
2
|
import { S as SnapTarget, M as MoveAdapter, I as InsertAdapter } from './types-B_-khFM0.js';
|
|
3
3
|
|
|
4
|
-
/**
|
|
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
|
+
*/
|
|
5
12
|
interface ModifierState {
|
|
6
13
|
alt: boolean;
|
|
7
14
|
shift: boolean;
|
|
8
15
|
meta: boolean;
|
|
9
16
|
ctrl: boolean;
|
|
10
17
|
}
|
|
18
|
+
|
|
11
19
|
/** Pointer position in both world and client coords. */
|
|
12
20
|
interface PointerState {
|
|
13
21
|
worldX: number;
|
|
@@ -1,25 +1,7 @@
|
|
|
1
1
|
import * as _weasel_js_history from '@weasel-js/history';
|
|
2
2
|
import { Op, SerializedHistory } from '@weasel-js/history';
|
|
3
|
-
import { P as Path } from './
|
|
3
|
+
import { P as Path } from './path-B6MMiodD.js';
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* Pose composition for hierarchical scene graphs.
|
|
7
|
-
*
|
|
8
|
-
* As of the nesting change, `getPose(id)` on adapters returns the
|
|
9
|
-
* **local** pose — relative to the object's direct parent. Anything in the
|
|
10
|
-
* kit that needs to draw, hit-test, snap, or otherwise reason about world
|
|
11
|
-
* coordinates routes through `composeWorldPose`, which walks the parent
|
|
12
|
-
* chain and folds local poses together via a consumer-supplied `compose`.
|
|
13
|
-
*
|
|
14
|
-
* Pose shape is generic, so the compose strategy is too. For the common
|
|
15
|
-
* `{x, y, width, height}` axis-aligned rect, use `composeRectPose` —
|
|
16
|
-
* translation only, child dimensions preserved. Custom pose shapes (paths,
|
|
17
|
-
* matrix transforms) supply their own.
|
|
18
|
-
*
|
|
19
|
-
* The inverse — `rebaseLocalPose` — converts a world-space pose into a
|
|
20
|
-
* local pose under a target parent. Used when reparenting so the visual
|
|
21
|
-
* world position of a child is preserved across the parent change.
|
|
22
|
-
*/
|
|
23
5
|
/**
|
|
24
6
|
* Axis-aligned rectangle pose with optional rotation. The canonical pose
|
|
25
7
|
* shape used by `composeRectPose` and the `unionBounds` helper. Rotation is
|
|
@@ -27,8 +9,7 @@ import { P as Path } from './types-B6MMiodD.js';
|
|
|
27
9
|
* code that consumes rotation already reads `pose.rotation ?? 0`
|
|
28
10
|
* (`SceneCanvas.defaultDrawOne`, `rotate/handle.ts`, `pathInWorld.ts`), so
|
|
29
11
|
* the slot exists on every default scene whether or not the consumer
|
|
30
|
-
* populates it.
|
|
31
|
-
* don't depend on features.
|
|
12
|
+
* populates it.
|
|
32
13
|
*/
|
|
33
14
|
interface RectPose {
|
|
34
15
|
x: number;
|
|
@@ -38,79 +19,6 @@ interface RectPose {
|
|
|
38
19
|
/** Rotation in radians around the unrotated AABB center. Absent === 0. */
|
|
39
20
|
rotation?: number;
|
|
40
21
|
}
|
|
41
|
-
/** Minimal adapter needed by `composeWorldPose` and friends — pose lookup plus parent walk. */
|
|
42
|
-
interface PoseAdapter<TPose> {
|
|
43
|
-
getPose(id: string): TPose;
|
|
44
|
-
getParent(id: string): string | null;
|
|
45
|
-
}
|
|
46
|
-
/** Consumer's pose-composition strategy for hierarchical scenes. `compose`
|
|
47
|
-
* folds a child's pose (in parent's frame) up to the next frame; `decompose`
|
|
48
|
-
* is its inverse. Default is IDENTITY — an absolute-pose scene where every
|
|
49
|
-
* node already stores world coords (parent is grouping-only, no transform). */
|
|
50
|
-
interface PoseComposition<TPose> {
|
|
51
|
-
compose: (parent: TPose, child: TPose) => TPose;
|
|
52
|
-
decompose: (parent: TPose, world: TPose) => TPose;
|
|
53
|
-
}
|
|
54
|
-
/** Default pose-composition strategy: IDENTITY. Both `compose` and
|
|
55
|
-
* `decompose` return the child/world pose unchanged, modeling an
|
|
56
|
-
* absolute-pose scene where every node stores world coords and parents are
|
|
57
|
-
* grouping-only (no transform). With this strategy `composeWorldPose`
|
|
58
|
-
* returns a node's own raw pose and `rebaseLocalPose` is a no-op. */
|
|
59
|
-
declare const IDENTITY_POSE_COMPOSITION: PoseComposition<unknown>;
|
|
60
|
-
/**
|
|
61
|
-
* Walk `id`'s parent chain (root first to id last) and fold local poses into
|
|
62
|
-
* a world pose via `compose`. Returns the world pose for `id`. Cycle-safe:
|
|
63
|
-
* a visited-set guard breaks if the chain ever loops back to itself.
|
|
64
|
-
*
|
|
65
|
-
* `compose(parent, child)` interprets `child` as expressed *in `parent`'s
|
|
66
|
-
* local frame* and returns the equivalent pose in the next frame up. For a
|
|
67
|
-
* standard translation-only rect: `world = { x: p.x + c.x, y: p.y + c.y,
|
|
68
|
-
* width: c.width, height: c.height }`.
|
|
69
|
-
*/
|
|
70
|
-
declare function composeWorldPose<TPose>(adapter: PoseAdapter<TPose>, id: string, compose: (parent: TPose, child: TPose) => TPose): TPose;
|
|
71
|
-
/**
|
|
72
|
-
* Default `compose` for axis-aligned rectangles. Adds translation; preserves
|
|
73
|
-
* child width/height. Treat as the canonical compose for any
|
|
74
|
-
* `{x, y, width, height}` pose under a translation-only hierarchy.
|
|
75
|
-
*
|
|
76
|
-
* Generic over the concrete pose type so callers with a wider pose
|
|
77
|
-
* (e.g. `RectPose & { rotation }`) can pass it through; the extra fields
|
|
78
|
-
* are taken from the child unchanged.
|
|
79
|
-
*/
|
|
80
|
-
declare function composeRectPose<TPose extends RectPose>(parent: TPose, child: TPose): TPose;
|
|
81
|
-
/**
|
|
82
|
-
* Translate a `RectPose`-shaped pose by `(dx, dy)`. Suitable as the default
|
|
83
|
-
* `translatePose` for `useMove` when poses carry top-level `x`/`y`. Other
|
|
84
|
-
* fields (width/height, plus any extra props on `TPose`) are preserved.
|
|
85
|
-
*/
|
|
86
|
-
declare function translateRectPose<TPose extends RectPose>(pose: TPose, dx: number, dy: number): TPose;
|
|
87
|
-
/**
|
|
88
|
-
* Convert `worldPose` into a local pose expressed under `newParentId`'s
|
|
89
|
-
* frame. Used when reparenting so the child's visual world position is
|
|
90
|
-
* preserved despite the change of frame. Inverse of one `compose` step.
|
|
91
|
-
*
|
|
92
|
-
* `decompose(parent, world)` returns the local pose `child` such that
|
|
93
|
-
* `compose(parent, child) === world`. For axis-aligned rects:
|
|
94
|
-
* `child = { ...world, x: world.x - parent.x, y: world.y - parent.y }`.
|
|
95
|
-
*
|
|
96
|
-
* Pass `newParentId === null` for the root frame; the function returns
|
|
97
|
-
* `worldPose` unchanged.
|
|
98
|
-
*/
|
|
99
|
-
declare function rebaseLocalPose<TPose>(adapter: PoseAdapter<TPose>, worldPose: TPose, newParentId: string | null, compose: (parent: TPose, child: TPose) => TPose, decompose: (parent: TPose, world: TPose) => TPose): TPose;
|
|
100
|
-
/** Inverse of `composeRectPose` — subtracts parent translation. */
|
|
101
|
-
declare function decomposeRectPose<TPose extends RectPose>(parent: TPose, world: TPose): TPose;
|
|
102
|
-
/**
|
|
103
|
-
* Build a `(id) => world pose | null` callback over a `PoseAdapter`.
|
|
104
|
-
* Convenience for RenderLayers that take a `getPose` callback (selection
|
|
105
|
-
* overlays, debug layers, etc.) so consumers don't hand-write a
|
|
106
|
-
* `composeWorldPose` call per layer.
|
|
107
|
-
*
|
|
108
|
-
* Returns `null` when `adapter.getPose` or `adapter.getParent` throws — the
|
|
109
|
-
* common case is an id removed mid-render between selection state and the
|
|
110
|
-
* next paint. Layers should treat `null` as "skip this id."
|
|
111
|
-
*/
|
|
112
|
-
declare function worldPoseLookup<TPose>(adapter: PoseAdapter<TPose>, compose: (parent: TPose, child: TPose) => TPose): (id: string) => TPose | null;
|
|
113
|
-
|
|
114
22
|
/**
|
|
115
23
|
* # SceneNode — the thing in the scene
|
|
116
24
|
*
|
|
@@ -442,4 +350,4 @@ interface Scene<TData, TLayer extends string, TPose = RectPose> {
|
|
|
442
350
|
getVersion(): number;
|
|
443
351
|
}
|
|
444
352
|
|
|
445
|
-
export { type AddLayerSpec as A, type ContainerNode as C,
|
|
353
|
+
export { type AddLayerSpec as A, type ContainerNode as C, type LayerRecord as L, type NodeId as N, type RectPose as R, type Scene as S, type UseSceneOptions as U, type Node as a, type SerializedScene as b, type SceneRegistry as c, type RegisteredOp as d, type AddNodeSpec as e, type LeafNode as f, type SerializedNode as g, type SystemLayerRecord as h, type SystemLayerSpec as i, type UserLayerRecord as j, asNodeId as k };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weasel-js/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.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": "0.
|
|
78
|
-
"@weasel-js/geom": "0.
|
|
79
|
-
"@weasel-js/gestures": "0.
|
|
80
|
-
"@weasel-js/history": "0.
|
|
81
|
-
"@weasel-js/modes": "0.
|
|
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",
|
|
82
82
|
"earcut": "2.2.4",
|
|
83
83
|
"polygon-clipping": "^0.15.7"
|
|
84
84
|
},
|