@weasel-js/core 1.5.1 → 1.6.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 +273 -0
- package/dist/{autoPoseDescriptor-Dr6CwNZK.d.ts → autoPoseDescriptor-_XOyF7t4.d.ts} +2 -1
- package/dist/{chunk-P6MGECVO.js → chunk-44EWMJV2.js} +3 -3
- package/dist/{chunk-P6MGECVO.js.map → chunk-44EWMJV2.js.map} +1 -1
- package/dist/{chunk-XXQ6FLCJ.js → chunk-H6N2JSZ3.js} +3 -3
- package/dist/{chunk-XXQ6FLCJ.js.map → chunk-H6N2JSZ3.js.map} +1 -1
- package/dist/{chunk-HAGOFNP5.js → chunk-HPFJUUTF.js} +25 -20
- package/dist/chunk-HPFJUUTF.js.map +1 -0
- package/dist/{chunk-3LPQ2XZG.js → chunk-L5YNZYEG.js} +8 -13
- package/dist/chunk-L5YNZYEG.js.map +1 -0
- package/dist/{chunk-LXJDWBEL.js → chunk-PNNZSYRD.js} +2 -2
- package/dist/{chunk-LXJDWBEL.js.map → chunk-PNNZSYRD.js.map} +1 -1
- package/dist/{chunk-GREL4MVO.js → chunk-THCSDHII.js} +2084 -1344
- package/dist/chunk-THCSDHII.js.map +1 -0
- package/dist/clipboard.d.ts +2 -1
- package/dist/clone.d.ts +3 -2
- package/dist/{depSchema-BubKMv-2.d.ts → depSchema-BhgZc0-Q.d.ts} +79 -55
- package/dist/{grid-Z_Af3vTl.d.ts → grid-Dx2gQbNv.d.ts} +22 -6
- package/dist/index.d.ts +374 -92
- package/dist/index.js +6 -6
- package/dist/insert.d.ts +4 -3
- package/dist/insert.js +2 -2
- package/dist/{math-E3rZn4bR.d.ts → math-DRa6HBBs.d.ts} +7 -21
- package/dist/math.d.ts +5 -4
- package/dist/math.js +2 -2
- package/dist/move.d.ts +5 -4
- package/dist/move.js +3 -3
- package/dist/{options-BPcmwYk7.d.ts → options-CzjxFoYZ.d.ts} +1 -1
- package/dist/path-JEV2c5If.d.ts +48 -0
- package/dist/{pointSnapToGrid-CgcK2R_I.d.ts → pointSnapToGrid-7mCcm6qG.d.ts} +1 -1
- package/dist/{poseDescriptor-PgfVKfa0.d.ts → poseDescriptor-rZa9W5hJ.d.ts} +1 -48
- package/dist/renderer.d.ts +8 -7
- package/dist/renderer.js +6 -6
- package/dist/resize.d.ts +6 -5
- package/dist/resize.js +3 -3
- package/dist/{types-BdaK9PcP.d.ts → types-CxC8P6W0.d.ts} +27 -1
- package/dist/{types-BHGdrOcu.d.ts → types-D_74YlWs.d.ts} +1 -1
- package/package.json +10 -10
- package/dist/chunk-3LPQ2XZG.js.map +0 -1
- package/dist/chunk-GREL4MVO.js.map +0 -1
- package/dist/chunk-HAGOFNP5.js.map +0 -1
package/dist/clipboard.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NodeId } from '@weasel-js/routing';
|
|
2
|
-
import { C as ClipboardSnapshot, I as InsertAdapter } from './types-
|
|
2
|
+
import { C as ClipboardSnapshot, I as InsertAdapter } from './types-CxC8P6W0.js';
|
|
3
3
|
import '@weasel-js/history';
|
|
4
|
+
import './path-JEV2c5If.js';
|
|
4
5
|
|
|
5
6
|
type Replacer$1 = (key: string, value: unknown) => unknown;
|
|
6
7
|
/** Options for `useClipboardOps`. */
|
package/dist/clone.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { C as CloneBehavior } from './types-
|
|
1
|
+
import { C as CloneBehavior } from './types-D_74YlWs.js';
|
|
2
2
|
import '@weasel-js/history';
|
|
3
|
-
import './types-
|
|
3
|
+
import './types-CxC8P6W0.js';
|
|
4
|
+
import './path-JEV2c5If.js';
|
|
4
5
|
import '@weasel-js/routing';
|
|
5
6
|
|
|
6
7
|
/** Clone-on-alt-drag behavior for `useClone`; activates when Alt/Option is held at drag start. */
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { GradStop, ColorSpace, TextureHandle, FillStyle, Stroke, ScreenLength } from '@weasel-js/paint';
|
|
2
|
-
import {
|
|
2
|
+
import { NodeId, Bounds, View, SelectionApi, ActionDeps, IngestItem, DragSample, Point2 } from '@weasel-js/routing';
|
|
3
|
+
import { P as Path } from './path-JEV2c5If.js';
|
|
3
4
|
import { ResolvedRun, TextStyle, TextVerticalAlign } from '@weasel-js/text';
|
|
5
|
+
import { Mat3 } from '@weasel-js/geom';
|
|
4
6
|
import * as _weasel_js_history from '@weasel-js/history';
|
|
5
7
|
import { Op, History, SerializedHistory } from '@weasel-js/history';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
+
import { a as SceneAdapter, L as LayoutStrategy, b as LayoutDropTargetMode, I as InsertAdapter } from './types-CxC8P6W0.js';
|
|
9
|
+
import { P as PoseDescriptor } from './poseDescriptor-rZa9W5hJ.js';
|
|
8
10
|
import { ActiveToolContextValue } from '@weasel-js/routing/react';
|
|
9
|
-
import { B as BoundsConstraint, P as PointSnapBehavior } from './types-
|
|
10
|
-
import { Mat3 as Mat3$1 } from '@weasel-js/geom';
|
|
11
|
+
import { B as BoundsConstraint, P as PointSnapBehavior } from './types-D_74YlWs.js';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Axis-aligned rectangle pose with optional rotation. The canonical pose
|
|
@@ -627,7 +628,7 @@ interface FitViewToBoundsOptions {
|
|
|
627
628
|
* returns `currentView` unchanged and logs a `console.warn`. Callers that
|
|
628
629
|
* want to no-op silently can detect zero area themselves before calling.
|
|
629
630
|
*/
|
|
630
|
-
declare function fitViewToBounds(bounds: Bounds, viewportDims: ViewportDims, currentView: View
|
|
631
|
+
declare function fitViewToBounds(bounds: Bounds, viewportDims: ViewportDims, currentView: View, opts?: FitViewToBoundsOptions): View;
|
|
631
632
|
|
|
632
633
|
/**
|
|
633
634
|
* Minimal compile/link/lookup wrapper for a GL program. Throws
|
|
@@ -827,7 +828,8 @@ declare class GLTextureCache {
|
|
|
827
828
|
*
|
|
828
829
|
* Key: ImageBitmap (or pattern source object) identity (WeakMap) — lets GC
|
|
829
830
|
* reclaim unreferenced bitmaps. The GL textures are NOT freed when the source
|
|
830
|
-
* is gc'd;
|
|
831
|
+
* is gc'd; a source's owner that knows it will never be drawn again frees them
|
|
832
|
+
* with {@link releaseImageSource}.
|
|
831
833
|
*
|
|
832
834
|
* Wrapping is set once at upload time per the `repetition` parameter:
|
|
833
835
|
* - undefined / 'no-repeat' → CLAMP_TO_EDGE
|
|
@@ -844,6 +846,8 @@ type TexSource = ImageBitmap | ImageData | HTMLCanvasElement | HTMLImageElement;
|
|
|
844
846
|
declare class GLImageCache {
|
|
845
847
|
private readonly gl;
|
|
846
848
|
private readonly minification;
|
|
849
|
+
/** This context's `MAX_TEXTURE_SIZE`. */
|
|
850
|
+
readonly maxTextureSide: number;
|
|
847
851
|
private readonly map;
|
|
848
852
|
/**
|
|
849
853
|
* MAG_FILTER each texture currently carries, so a redundant write can be
|
|
@@ -869,6 +873,11 @@ declare class GLImageCache {
|
|
|
869
873
|
* headless print/export path); bilinear-only minification undersamples
|
|
870
874
|
* and produces moiré. */
|
|
871
875
|
constructor(gl: WebGL2RenderingContext, minification?: ImageMinification);
|
|
876
|
+
/** Delete `key`'s texture, if it has one. */
|
|
877
|
+
release(key: object): void;
|
|
878
|
+
/** Stop answering {@link releaseImageSource} and {@link maxImageTextureSide}.
|
|
879
|
+
* Call when the context is disposed or lost. */
|
|
880
|
+
dispose(): void;
|
|
872
881
|
upload(key: object, source: TexSource, repetition?: PatternRepetition): WebGLTexture;
|
|
873
882
|
bind(key: object, unit: number): void;
|
|
874
883
|
/** Set `key`'s MAG_FILTER, skipping the call when it already holds that
|
|
@@ -970,37 +979,48 @@ declare class GradientRampAtlas {
|
|
|
970
979
|
* `apply(m, x, y)` returns `[m * (x, y, 1)] = [m00*x + m01*y + tx,
|
|
971
980
|
* m10*x + m11*y + ty]`.
|
|
972
981
|
*/
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
declare function
|
|
982
|
+
|
|
983
|
+
type GlMat3 = Float32Array;
|
|
984
|
+
declare function identity(): GlMat3;
|
|
985
|
+
declare function multiply(out: GlMat3, m: GlMat3): GlMat3;
|
|
976
986
|
/** `m · T(tx, ty)`: composes onto `m`, where `@weasel-js/geom`'s `translate`
|
|
977
987
|
* constructs a fresh matrix. */
|
|
978
|
-
declare function translated(m:
|
|
988
|
+
declare function translated(m: GlMat3, tx: number, ty: number): GlMat3;
|
|
979
989
|
/** `m · S(sx, sy)`: composes onto `m`, where geom's `scale` constructs one. */
|
|
980
|
-
declare function scaled(m:
|
|
990
|
+
declare function scaled(m: GlMat3, sx: number, sy: number): GlMat3;
|
|
991
|
+
/** This layout read as the kernel's 6-element affine. The two carry the same
|
|
992
|
+
* logical order, so the conversion is a repack and nothing else — it exists
|
|
993
|
+
* so the repack has a name instead of appearing inline at each crossing. */
|
|
994
|
+
declare function toAffine(m: GlMat3): Mat3;
|
|
995
|
+
/** The kernel's affine in this layout. The inverse of {@link toAffine}, and
|
|
996
|
+
* what an `SvgGroupNode.transform` (also a kernel affine) becomes on its way
|
|
997
|
+
* to a `GroupDrawCommand`. */
|
|
998
|
+
declare function fromAffine(a: Mat3): GlMat3;
|
|
981
999
|
/** Inverse of an affine matrix, or `null` when `@weasel-js/geom`'s `invert`
|
|
982
1000
|
* finds it singular — the same rule, read through this layout. */
|
|
983
|
-
declare function invert(m:
|
|
984
|
-
declare function apply(m:
|
|
1001
|
+
declare function invert(m: GlMat3): GlMat3 | null;
|
|
1002
|
+
declare function apply(m: GlMat3, x: number, y: number): [number, number];
|
|
985
1003
|
/**
|
|
986
1004
|
* Map screen pixel coords (0..width on X, 0..height on Y, top-left origin)
|
|
987
1005
|
* into clip space (-1..1 on X, 1..-1 on Y — note Y flip so screen-down
|
|
988
1006
|
* matches clip-down).
|
|
989
1007
|
*/
|
|
990
|
-
declare function screenToClip(width: number, height: number):
|
|
1008
|
+
declare function screenToClip(width: number, height: number): GlMat3;
|
|
991
1009
|
/**
|
|
992
1010
|
* Uniform-equivalent scale factor: the square root of the absolute
|
|
993
1011
|
* determinant of the linear part, i.e. the geometric mean of the two axis
|
|
994
1012
|
* scales. Rotation-invariant. Under non-uniform scale it is between the two
|
|
995
1013
|
* axes and exact on neither — the same compromise `meanScale` documents.
|
|
996
1014
|
*/
|
|
997
|
-
declare function meanScaleOf(m:
|
|
1015
|
+
declare function meanScaleOf(m: GlMat3): number;
|
|
998
1016
|
/** The renderer's 3x3 matrix operations, as one namespace. These work on the
|
|
999
1017
|
* 9-element `Float32Array` form the GL uniform upload wants — distinct from
|
|
1000
|
-
* `@weasel-js/geom`'s 6-element affine `
|
|
1018
|
+
* `@weasel-js/geom`'s 6-element affine `GlMat3`, though the logical element
|
|
1001
1019
|
* order is the same. */
|
|
1002
1020
|
declare const mat3: {
|
|
1003
1021
|
identity: typeof identity;
|
|
1022
|
+
toAffine: typeof toAffine;
|
|
1023
|
+
fromAffine: typeof fromAffine;
|
|
1004
1024
|
multiply: typeof multiply;
|
|
1005
1025
|
translated: typeof translated;
|
|
1006
1026
|
scaled: typeof scaled;
|
|
@@ -1013,7 +1033,7 @@ declare const mat3: {
|
|
|
1013
1033
|
/** Row-major 4×5 color matrix identity. */
|
|
1014
1034
|
declare const IDENTITY_COLOR_MATRIX: Float32Array<ArrayBuffer>;
|
|
1015
1035
|
interface GroupFrame {
|
|
1016
|
-
transform?:
|
|
1036
|
+
transform?: GlMat3;
|
|
1017
1037
|
alpha?: number;
|
|
1018
1038
|
/** Row-major 4×5 color matrix (20 floats). Absent leaves the stack unchanged. */
|
|
1019
1039
|
colorMatrix?: Float32Array | number[];
|
|
@@ -1022,7 +1042,7 @@ declare class GroupState {
|
|
|
1022
1042
|
private transformStack;
|
|
1023
1043
|
private alphaStack;
|
|
1024
1044
|
private colorMatrixStack;
|
|
1025
|
-
get transform():
|
|
1045
|
+
get transform(): GlMat3;
|
|
1026
1046
|
get alpha(): number;
|
|
1027
1047
|
get colorMatrix(): Float32Array;
|
|
1028
1048
|
push(frame: GroupFrame): void;
|
|
@@ -1180,7 +1200,7 @@ interface PathDrawCommand {
|
|
|
1180
1200
|
* is how a container node's transform reaches its descendants. */
|
|
1181
1201
|
interface GroupDrawCommand {
|
|
1182
1202
|
kind: 'group';
|
|
1183
|
-
transform?:
|
|
1203
|
+
transform?: GlMat3;
|
|
1184
1204
|
alpha?: number;
|
|
1185
1205
|
/**
|
|
1186
1206
|
* Optional 4×5 color matrix (row-major, 20 numbers) — `out = M₄ₓ₄ * in + bias`.
|
|
@@ -1402,7 +1422,7 @@ declare class DrawBatch {
|
|
|
1402
1422
|
* alpha). An affine maps a rect to a parallelogram, so two triangles still
|
|
1403
1423
|
* cover it and the batch draws at `u_model` identity.
|
|
1404
1424
|
*/
|
|
1405
|
-
pushRect(x: number, y: number, w: number, h: number, m:
|
|
1425
|
+
pushRect(x: number, y: number, w: number, h: number, m: GlMat3, r: number, g: number, b: number, a: number): void;
|
|
1406
1426
|
/**
|
|
1407
1427
|
* Append one image quad: the destination rect `(x, y, w, h)` mapped through
|
|
1408
1428
|
* `m`, sampling `(u0, v0)`-`(u1, v1)`, every corner carrying `post` as the
|
|
@@ -1416,7 +1436,7 @@ declare class DrawBatch {
|
|
|
1416
1436
|
* `slot` is the texture unit the corners sample, which `draw.ts` assigns per
|
|
1417
1437
|
* bitmap within the run.
|
|
1418
1438
|
*/
|
|
1419
|
-
pushQuad(x: number, y: number, w: number, h: number, m:
|
|
1439
|
+
pushQuad(x: number, y: number, w: number, h: number, m: GlMat3, u0: number, v0: number, u1: number, v1: number, post: number, slot: number): void;
|
|
1420
1440
|
/**
|
|
1421
1441
|
* Append one glyph quad: the box `(x0, y0)`-`(x1, y1)` mapped through `m`,
|
|
1422
1442
|
* sampling `(u0, v0)`-`(u1, v1)` of the font atlas at `slot`, painted in
|
|
@@ -1438,7 +1458,7 @@ declare class DrawBatch {
|
|
|
1438
1458
|
* winding, which is what lets a run of mixed rects, image quads and glyphs
|
|
1439
1459
|
* keep the canonical index pattern.
|
|
1440
1460
|
*/
|
|
1441
|
-
pushGlyph(x0: number, y0: number, x1: number, y1: number, baselineY: number, tanItalic: number, m:
|
|
1461
|
+
pushGlyph(x0: number, y0: number, x1: number, y1: number, baselineY: number, tanItalic: number, m: GlMat3, u0: number, v0: number, u1: number, v1: number, r: number, g: number, b: number, a: number, slot: number, mode: number): void;
|
|
1442
1462
|
/**
|
|
1443
1463
|
* Append one rect filled by a gradient: the corners of `(x, y, w, h)` mapped
|
|
1444
1464
|
* through `m`, sampling the ramp atlas at `slot`.
|
|
@@ -1455,16 +1475,16 @@ declare class DrawBatch {
|
|
|
1455
1475
|
* Values outside 0..1 are the sampler's business; the atlas clamps to the
|
|
1456
1476
|
* edge texel, which is what the gradient shader's own `clamp` did.
|
|
1457
1477
|
*/
|
|
1458
|
-
pushGradientRect(x: number, y: number, w: number, h: number, m:
|
|
1478
|
+
pushGradientRect(x: number, y: number, w: number, h: number, m: GlMat3, uv: GradientUV, post: number, slot: number, mode: number, r: number, g: number, b: number, a: number): void;
|
|
1459
1479
|
/** `pushMesh` for a mesh filled by a gradient — see `pushGradientRect` for
|
|
1460
1480
|
* what `uv`, `post` and `mode` carry. */
|
|
1461
|
-
pushGradientMesh(mesh: Mesh, m:
|
|
1481
|
+
pushGradientMesh(mesh: Mesh, m: GlMat3, uv: GradientUV, post: number, slot: number, mode: number, r: number, g: number, b: number, a: number): void;
|
|
1462
1482
|
/**
|
|
1463
1483
|
* Append a tessellated mesh through `m`, all vertices carrying `rgba`. The
|
|
1464
1484
|
* mesh's own indices are rebased onto the staged vertices, which is why the
|
|
1465
1485
|
* index buffer is uploaded per flush rather than written once.
|
|
1466
1486
|
*/
|
|
1467
|
-
pushMesh(mesh: Mesh, m:
|
|
1487
|
+
pushMesh(mesh: Mesh, m: GlMat3, r: number, g: number, b: number, a: number): void;
|
|
1468
1488
|
/** Upload the staged geometry into the next set of buffers and bind its VAO.
|
|
1469
1489
|
* Returns the index count for the caller's `drawElements`. */
|
|
1470
1490
|
uploadAndBind(): number;
|
|
@@ -1648,7 +1668,7 @@ declare class WeaselRenderer {
|
|
|
1648
1668
|
* it — every other command carries its own transform in the stream, so
|
|
1649
1669
|
* callers with no view concept can keep calling `render(commands)`.
|
|
1650
1670
|
*/
|
|
1651
|
-
render(commands: DrawCommand[], viewMatrix?:
|
|
1671
|
+
render(commands: DrawCommand[], viewMatrix?: GlMat3): void;
|
|
1652
1672
|
/** Change the curve-flattening tolerance after construction. `undefined`
|
|
1653
1673
|
* restores the cached `DEFAULT_FLATTEN_TOLERANCE` route. */
|
|
1654
1674
|
setFlattenTolerance(tolerance: number | undefined): void;
|
|
@@ -1708,23 +1728,14 @@ declare function frameRect(sheet: SpriteSheet, index: number): {
|
|
|
1708
1728
|
};
|
|
1709
1729
|
|
|
1710
1730
|
/**
|
|
1711
|
-
* View →
|
|
1731
|
+
* View → GlMat3 helper for layer `draw` implementations on world-space layers.
|
|
1712
1732
|
*
|
|
1713
|
-
*
|
|
1714
|
-
*
|
|
1715
|
-
*
|
|
1716
|
-
*
|
|
1733
|
+
* `View` is `@weasel-js/routing`'s, the one every viewport action is typed
|
|
1734
|
+
* in. A type-only import emits no runtime edge, so there is no reason for the
|
|
1735
|
+
* renderer to hold a second structurally-identical declaration and put it in
|
|
1736
|
+
* the emitted `.d.ts` anonymously.
|
|
1717
1737
|
*/
|
|
1718
1738
|
|
|
1719
|
-
/** A weasel View — `{x, y, scale: {x, y}}`. Local type to avoid a cross-package import. */
|
|
1720
|
-
interface View {
|
|
1721
|
-
x: number;
|
|
1722
|
-
y: number;
|
|
1723
|
-
scale: {
|
|
1724
|
-
x: number;
|
|
1725
|
-
y: number;
|
|
1726
|
-
};
|
|
1727
|
-
}
|
|
1728
1739
|
/**
|
|
1729
1740
|
* Build the world→screen transform matrix for a `View`.
|
|
1730
1741
|
* Use as the `transform` field of a `kind: 'group'` DrawCommand to wrap
|
|
@@ -1735,7 +1746,7 @@ interface View {
|
|
|
1735
1746
|
* Column-major layout (matches `mat3.identity()`):
|
|
1736
1747
|
* `[scale.x, 0, 0, 0, scale.y, 0, -view.x*scale.x, -view.y*scale.y, 1]`.
|
|
1737
1748
|
*/
|
|
1738
|
-
declare function viewToMat3(view: View):
|
|
1749
|
+
declare function viewToMat3(view: View): GlMat3;
|
|
1739
1750
|
|
|
1740
1751
|
/** A screen-space rectangle, CSS pixels. */
|
|
1741
1752
|
interface CullRect {
|
|
@@ -1760,7 +1771,7 @@ interface CullRect {
|
|
|
1760
1771
|
*
|
|
1761
1772
|
* Returns `cmds` itself when nothing was dropped.
|
|
1762
1773
|
*/
|
|
1763
|
-
declare function cullDrawCommands(cmds: DrawCommand[], transform:
|
|
1774
|
+
declare function cullDrawCommands(cmds: DrawCommand[], transform: GlMat3, rect: CullRect): DrawCommand[];
|
|
1764
1775
|
|
|
1765
1776
|
/** Options for stroke tessellation. */
|
|
1766
1777
|
interface StrokeOptions {
|
|
@@ -2517,7 +2528,7 @@ interface ViewAnimationOptions {
|
|
|
2517
2528
|
/** Easing curve. Default `easeOutCubic`. */
|
|
2518
2529
|
easing?: EasingSpec;
|
|
2519
2530
|
/** Replace the kit's log-scale / fixed-anchor curve. */
|
|
2520
|
-
interpolator?: InterpolatorFactory<View
|
|
2531
|
+
interpolator?: InterpolatorFactory<View>;
|
|
2521
2532
|
/** Fires when the target is reached. Not called on cancel. */
|
|
2522
2533
|
onDone?: () => void;
|
|
2523
2534
|
}
|
|
@@ -2528,21 +2539,21 @@ interface AnimateToBoundsOptions extends FitViewToBoundsOptions, ViewAnimationOp
|
|
|
2528
2539
|
* channel `view.set` uses, so a camera animation on an uncontrolled canvas
|
|
2529
2540
|
* costs no React render. */
|
|
2530
2541
|
interface ViewChannel {
|
|
2531
|
-
get(): View
|
|
2532
|
-
set(v: View
|
|
2542
|
+
get(): View;
|
|
2543
|
+
set(v: View): void;
|
|
2533
2544
|
}
|
|
2534
2545
|
/** The camera animation surface. One animation at a time. */
|
|
2535
2546
|
interface ViewAnimationApi {
|
|
2536
2547
|
/** Glide from the live view to `to`. A thunk receives the pending target when
|
|
2537
2548
|
* one is in flight, so successive discrete steps compound. */
|
|
2538
|
-
animate(to: View
|
|
2549
|
+
animate(to: View | ((base: View) => View), opts?: ViewAnimationOptions): void;
|
|
2539
2550
|
/** `fitViewToBounds` composed with `animate`. */
|
|
2540
2551
|
animateToBounds(bounds: Bounds, dims: ViewportDims, opts?: AnimateToBoundsOptions): void;
|
|
2541
2552
|
/** Cancel. The view stays where it is — no jump to the target. */
|
|
2542
2553
|
stop(): void;
|
|
2543
2554
|
isAnimating(): boolean;
|
|
2544
2555
|
/** Where the in-flight animation is heading, or null when none is. */
|
|
2545
|
-
target(): View
|
|
2556
|
+
target(): View | null;
|
|
2546
2557
|
/** Cancel unless the write that prompted this came from the runner's own
|
|
2547
2558
|
* per-frame write. Feed it from every channel that can move the camera. */
|
|
2548
2559
|
stopIfExternal(): void;
|
|
@@ -2587,6 +2598,10 @@ declare function useViewAnimationOn(view: ViewChannel, animator: Animator): View
|
|
|
2587
2598
|
interface PoseAdapter<TPose> {
|
|
2588
2599
|
getPose(id: string): TPose;
|
|
2589
2600
|
getParent(id: string): string | null;
|
|
2601
|
+
/** Whether `id`'s pose is a frame its children are expressed in. Absent
|
|
2602
|
+
* means every node is one. A container whose pose derives from its children
|
|
2603
|
+
* is not: its children share its frame, so the fold passes over it. */
|
|
2604
|
+
definesFrame?(id: string): boolean;
|
|
2590
2605
|
}
|
|
2591
2606
|
/**
|
|
2592
2607
|
* The transforms a `compose` represents **exactly**. A parent transform wider
|
|
@@ -2836,19 +2851,19 @@ interface GeometryProjection {
|
|
|
2836
2851
|
id?: string;
|
|
2837
2852
|
data: unknown;
|
|
2838
2853
|
pose: unknown;
|
|
2839
|
-
}, m: Mat3
|
|
2854
|
+
}, m: Mat3): unknown | null;
|
|
2840
2855
|
}
|
|
2841
2856
|
|
|
2842
2857
|
/** Minimal view API the action layer consumes. */
|
|
2843
2858
|
interface ViewApi {
|
|
2844
|
-
get(): View
|
|
2845
|
-
set(v: View
|
|
2859
|
+
get(): View;
|
|
2860
|
+
set(v: View): void;
|
|
2846
2861
|
/** Optional recenter callback. When wired, `viewportZoomAction`'s `reset`
|
|
2847
2862
|
* branch (Cmd-0) calls this instead of resetting to identity — letting
|
|
2848
2863
|
* consumers re-fit the page (or other reference bounds) into the workspace.
|
|
2849
2864
|
* Return the target `View` to let the action animate there; return nothing
|
|
2850
2865
|
* to keep dispatching the view yourself. */
|
|
2851
|
-
recenter?(): View
|
|
2866
|
+
recenter?(): View | void;
|
|
2852
2867
|
/** Optional canvas-local host dimensions (CSS px). When wired,
|
|
2853
2868
|
* `viewportZoomAction`'s keyboard branches (Cmd+= / Cmd+-) anchor at the
|
|
2854
2869
|
* host center instead of the top-left origin. Null when the host isn't
|
|
@@ -2859,11 +2874,11 @@ interface ViewApi {
|
|
|
2859
2874
|
} | null;
|
|
2860
2875
|
/** Optional camera animation. `<SceneCanvas>` wires these three; a consumer
|
|
2861
2876
|
* publishing their own `view` dep need not, and actions fall back to `set`. */
|
|
2862
|
-
animate?(to: View
|
|
2877
|
+
animate?(to: View, opts?: ViewAnimationOptions): void;
|
|
2863
2878
|
stopAnimation?(): void;
|
|
2864
2879
|
/** Where an in-flight camera animation is heading, or null. Compute the next
|
|
2865
2880
|
* discrete step from this so repeated presses compound. */
|
|
2866
|
-
animationTarget?(): View
|
|
2881
|
+
animationTarget?(): View | null;
|
|
2867
2882
|
/** Optional momentum decay. `<SceneCanvas>` wires this from `useDecayLoop`;
|
|
2868
2883
|
* a consumer publishing their own `view` dep need not, and `viewport.dragPan`
|
|
2869
2884
|
* simply lands the pan without coasting. */
|
|
@@ -2963,6 +2978,12 @@ interface EditAnchorsDep {
|
|
|
2963
2978
|
* (when the polygon lives on data.path). Records one history entry
|
|
2964
2979
|
* labelled `label`. */
|
|
2965
2980
|
applyEdit(id: string, worldPath: unknown, label: string): void;
|
|
2981
|
+
/** The ops `applyEdit` would commit for the same arguments, unapplied, so
|
|
2982
|
+
* a caller can make the edit part of a larger batch — the pen joining
|
|
2983
|
+
* two paths edits one node and deletes the other in one undo step.
|
|
2984
|
+
* Optional; a caller that needs it declines the composite edit without
|
|
2985
|
+
* it. Returns `[]` when `id` has no editable polygon. */
|
|
2986
|
+
editOps?(id: string, worldPath: unknown, label: string): Op[];
|
|
2966
2987
|
/**
|
|
2967
2988
|
* Anchors currently selected within the edited path, as **flat anchor
|
|
2968
2989
|
* indices** — the same numbering `enumerateAnchors` produces and the
|
|
@@ -3235,6 +3256,9 @@ interface ResizePolicy<TPose> {
|
|
|
3235
3256
|
*/
|
|
3236
3257
|
interface LayoutDep {
|
|
3237
3258
|
getLayout(containerId: string): LayoutStrategy<unknown> | null;
|
|
3259
|
+
/** Which container wins when several contain the drop point. Default
|
|
3260
|
+
* `'innermost'`. */
|
|
3261
|
+
dropTarget?: LayoutDropTargetMode;
|
|
3238
3262
|
}
|
|
3239
3263
|
/**
|
|
3240
3264
|
* Dep for `enterTextEditAction`.
|
|
@@ -3476,4 +3500,4 @@ declare module '@weasel-js/routing' {
|
|
|
3476
3500
|
}
|
|
3477
3501
|
}
|
|
3478
3502
|
|
|
3479
|
-
export { type
|
|
3503
|
+
export { type DerivedDep as $, type SliceDep as A, type VertexColorChannel as B, type CullRect as C, type DrawCommand as D, type Effect as E, type InsertExtras as F, type GlMat3 as G, type SerializedScene as H, IDENTITY_COLOR_MATRIX as I, type GeometryProjection as J, type ContentHandlerEntry as K, type SvgIngestOptions as L, type Mesh as M, type Node as N, type PanBounds as O, type PathDrawCommand as P, type Animator as Q, type RenderTarget as R, SPRITE_STRIDE as S, type TextDrawCommand as T, ColorOverrideRegistry as U, type ViewAnimationOptions as V, WeaselRenderer as W, type UseSceneOptions as X, type SceneRegistry as Y, type RegisteredOp as Z, type PoseOverrides as _, type GroupDrawCommand as a, type StaggerSpringPoseOptions as a$, type ViewportDims as a0, ShaderProgram as a1, type BooleansAdapter as a2, type UseAnimatorOptions as a3, type SpringPresetName as a4, type EasingSpec as a5, type AnimationHandle as a6, type SampledTrack as a7, type AddLayerSpec as a8, type AddNodeSpec as a9, type Keyframe as aA, type LassoSelectDep as aB, type LayerRecord as aC, type LayoutDep as aD, type LeafNode as aE, type LoopFactory as aF, type LoopOptions as aG, type NestedTimeline as aH, type NodeAtPointDep as aI, type PhysicsHandle as aJ, type PhysicsOptions as aK, type PoseAdapter as aL, type PoseClosure as aM, type PoseOverride as aN, RECT_POSE_COMPOSITION as aO, RIGID_POSE_COMPOSITION as aP, type ResizePolicy as aQ, SPRING_PRESETS as aR, type SerializedNode as aS, type SnapDep as aT, type SpringOptions as aU, type SpringPreset as aV, type StaggerBuilder as aW, type StaggerDelay as aX, type StaggerFactory as aY, type StaggerOptions as aZ, type StaggerPerItem as a_, type AnimateToBoundsOptions as aa, type AreaSelectDep as ab, type BezierEasing as ac, type BooleanOp as ad, type BooleanOpResult as ae, type ClipboardDep as af, type ClipboardIngestCtx as ag, type ColorOverride as ah, type ColorOverrideFn as ai, type ContainerNode as aj, type DecayLoopConfig as ak, type DecayOptions as al, EASINGS as am, type EasingFn as an, type EasingName as ao, type EditAnchorsDep as ap, type EventBooking as aq, type EventBookingHandle as ar, type EventTrack as as, type FitViewToBoundsOptions as at, IDENTITY_POSE_COMPOSITION as au, type IngestCtx as av, type IngestionDep as aw, type InsertDep as ax, type Interpolate as ay, type InterpolatorFactory as az, type ImageDrawCommand as b, resolveEasing as b$, type StaggerTweenOptions as b0, type SvgUnpacker as b1, type SystemLayerRecord as b2, type SystemLayerSpec as b3, type TextEditDep as b4, type TimelineClock as b5, type TimelineEvent as b6, type TimelineHandle as b7, type TimelineOptions as b8, type TimelineTrack as b9, easeInOutCirc as bA, easeInOutCubic as bB, easeInOutElastic as bC, easeInOutExpo as bD, easeInOutQuad as bE, easeInOutQuart as bF, easeInOutQuint as bG, easeInOutSine as bH, easeInQuad as bI, easeInQuart as bJ, easeInQuint as bK, easeInSine as bL, easeOut as bM, easeOutBack as bN, easeOutBounce as bO, easeOutCirc as bP, easeOutCubic as bQ, easeOutElastic as bR, easeOutExpo as bS, easeOutQuad as bT, easeOutQuart as bU, easeOutQuint as bV, easeOutSine as bW, fitViewToBounds as bX, linear as bY, rebaseLocalPose as bZ, registerContentHandler as b_, type Track as ba, type TweenLoopOptions as bb, type TweenOptions as bc, type UserLayerRecord as bd, VIEW_ANIMATION_KEY as be, type ViewAnimationApi as bf, type ViewApi as bg, type ViewChannel as bh, applyBooleanOp as bi, asNodeId as bj, composeRectPose as bk, composeRigidPose as bl, composeWorldPose as bm, cubicBezierEasing as bn, decomposeRectPose as bo, decomposeRigidPose as bp, easeIn as bq, easeInBack as br, easeInBounce as bs, easeInCirc as bt, easeInCubic as bu, easeInElastic as bv, easeInExpo as bw, easeInOut as bx, easeInOutBack as by, easeInOutBounce as bz, type ImageMinification as c, resolveStrokeWidth as c0, translateRectPose as c1, useDecayLoop as c2, useViewAnimation as c3, useViewAnimationOn as c4, worldPoseLookup as c5, ShaderCompileError as d, type ShaderDrawCommand as e, type ShaderProgramHandle as f, type ShaderUniform as g, type SolidPaint as h, type SpriteSheet as i, type SpritesDrawCommand as j, type StrokeOptions as k, type WeaselRendererOptions as l, blur as m, buildGradientRamp as n, cullDrawCommands as o, frameRect as p, mat3 as q, registerEffect as r, registerProgram as s, tessellateStroke as t, vignette as u, viewToMat3 as v, type Scene as w, type RectPose as x, type InertiaConfig as y, type PoseComposition as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { M as MoveBehavior, S as SnapStrategy } from './types-
|
|
1
|
+
import { M as MoveBehavior, S as SnapStrategy } from './types-D_74YlWs.js';
|
|
2
2
|
import { DebugSink } from '@weasel-js/routing';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -10,17 +10,33 @@ import { DebugSink } from '@weasel-js/routing';
|
|
|
10
10
|
* as base units) or a `{ value, unit }` tag that's resolved against a
|
|
11
11
|
* `UnitSystem` at the API boundary. Internals never see units.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
13
|
+
* An entry is affine — `base = value * factor + offset` — so a scale that
|
|
14
|
+
* puts zero somewhere else (degC against K) is expressible. No per-axis
|
|
15
|
+
* units. No mixed-unit arithmetic.
|
|
14
16
|
*/
|
|
15
17
|
/** A unit name (e.g. `'in'`, `'ft'`, `'mm'`). Looked up in a `UnitSystem`. */
|
|
16
18
|
type Unit = string;
|
|
17
|
-
/**
|
|
19
|
+
/** What one unit is worth in base units: `base = value * factor + offset`. */
|
|
20
|
+
interface UnitScale {
|
|
21
|
+
factor: number;
|
|
22
|
+
/** Where this unit puts zero, in base units. Absent is 0 — a pure scale. */
|
|
23
|
+
offset?: number;
|
|
24
|
+
}
|
|
25
|
+
/** One unit's conversion. A bare number is the `{ factor }` shorthand. */
|
|
26
|
+
type UnitEntry = number | UnitScale;
|
|
27
|
+
/** Conversion table mapping unit names to their scale against a base unit. */
|
|
18
28
|
interface UnitSystem {
|
|
19
29
|
/** Name of the base unit, e.g. 'in'. All conversions resolve to this. */
|
|
20
30
|
base: Unit;
|
|
21
|
-
/**
|
|
22
|
-
units: Record<Unit,
|
|
31
|
+
/** How to reach base units from each unit. The base unit's entry is 1. */
|
|
32
|
+
units: Record<Unit, UnitEntry>;
|
|
23
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* One unit's scale, with the bare-number shorthand widened and the offset
|
|
36
|
+
* defaulted — what every conversion in the kit reads. Throws if the system
|
|
37
|
+
* does not carry the unit.
|
|
38
|
+
*/
|
|
39
|
+
declare function unitScale(unitSystem: UnitSystem, unit: Unit): Required<UnitScale>;
|
|
24
40
|
/** Value at a unit-aware API boundary: bare number (in base units) or `{ value, unit }` tag. */
|
|
25
41
|
type UnitValue = number | {
|
|
26
42
|
value: number;
|
|
@@ -139,4 +155,4 @@ declare function pointToGridCell(point: {
|
|
|
139
155
|
row: number;
|
|
140
156
|
};
|
|
141
157
|
|
|
142
|
-
export { ANGLE_RADIANS as A, IMPERIAL_INCHES as I, METRIC_MM as M, type OriginProjection as O, PIXELS as P, RECT_ORIGIN_PROJECTION as R, type UseMoveOptions as U, type UnitValue as a, type UnitSystem as b, type
|
|
158
|
+
export { ANGLE_RADIANS as A, IMPERIAL_INCHES as I, METRIC_MM as M, type OriginProjection as O, PIXELS as P, RECT_ORIGIN_PROJECTION as R, type UseMoveOptions as U, type UnitValue as a, type UnitSystem as b, type UnitEntry as c, type Unit as d, type UnitScale as e, formatUnit as f, gridSnapStrategy as g, pointToGridCell as p, resolveUnit as r, unitScale as u };
|