@weasel-js/core 1.0.2 → 1.0.3
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 +61 -0
- package/dist/{DrawCommand-DCmiNkBj.d.ts → DrawCommand-BbPrSTra.d.ts} +24 -0
- package/dist/{chunk-Z3KNFTTS.js → chunk-3JYFAQIB.js} +3 -3
- package/dist/chunk-3JYFAQIB.js.map +1 -0
- package/dist/{chunk-UB6A6L77.js → chunk-3KGMJMOS.js} +3 -3
- package/dist/{chunk-UB6A6L77.js.map → chunk-3KGMJMOS.js.map} +1 -1
- package/dist/{chunk-IO5Z75X4.js → chunk-HGF5X6MZ.js} +2 -2
- package/dist/chunk-HGF5X6MZ.js.map +1 -0
- package/dist/{chunk-775XXAHR.js → chunk-JOSUVS6C.js} +2 -2
- package/dist/{chunk-775XXAHR.js.map → chunk-JOSUVS6C.js.map} +1 -1
- package/dist/{chunk-PI56ORHE.js → chunk-SMCZRSYB.js} +88 -59
- package/dist/chunk-SMCZRSYB.js.map +1 -0
- package/dist/{chunk-W2WB4352.js → chunk-TR3HZN34.js} +2 -2
- package/dist/chunk-TR3HZN34.js.map +1 -0
- package/dist/{chunk-6SHZHXXR.js → chunk-U45SODC2.js} +2 -2
- package/dist/{chunk-6SHZHXXR.js.map → chunk-U45SODC2.js.map} +1 -1
- package/dist/clipboard.d.ts +5 -2
- package/dist/clipboard.js +1 -1
- package/dist/clone.d.ts +2 -2
- package/dist/{geometry-CnISZ11w.d.ts → geometry-5X6TrAkX.d.ts} +1 -1
- package/dist/{grid-CBiLBnyc.d.ts → grid-sfilv5HP.d.ts} +7 -2
- package/dist/index.d.ts +546 -20
- package/dist/index.js +7 -7
- package/dist/insert.d.ts +6 -3
- package/dist/insert.js +1 -1
- package/dist/insert.js.map +1 -1
- package/dist/move.d.ts +26 -5
- package/dist/move.js +2 -2
- package/dist/move.js.map +1 -1
- package/dist/{options-DoOvx50U.d.ts → options-CbsIgQci.d.ts} +3 -1
- package/dist/patterns-builtin.d.ts +8 -0
- package/dist/patterns-builtin.js +1 -1
- package/dist/{pointSnapToGrid-Bj4r_lEQ.d.ts → pointSnapToGrid-C3wowsQy.d.ts} +9 -3
- package/dist/{registry-BQL4oyTg.d.ts → registry-CxnkXbG8.d.ts} +90 -6
- package/dist/renderer.d.ts +25 -4
- package/dist/renderer.js +7 -7
- package/dist/resize.d.ts +12 -5
- package/dist/resize.js +2 -2
- package/dist/routing.d.ts +7 -7
- package/dist/routing.js +1 -1
- package/dist/{types-Dtxe7jTS.d.ts → types-BHK2dkMu.d.ts} +23 -0
- package/dist/{types-Ct4n0Z38.d.ts → types-ByZxoD6P.d.ts} +1 -1
- package/dist/{types-Ch0Goo-j.d.ts → types-DpQ0cWYC.d.ts} +20 -0
- package/dist/{types-Kh_osAq9.d.ts → types-vqxpCFVp.d.ts} +31 -0
- package/dist/{viewToMat3-BvaWCN99.d.ts → viewToMat3-CQW_YqDw.d.ts} +1 -1
- package/package.json +6 -6
- package/dist/chunk-IO5Z75X4.js.map +0 -1
- package/dist/chunk-PI56ORHE.js.map +0 -1
- package/dist/chunk-W2WB4352.js.map +0 -1
- package/dist/chunk-Z3KNFTTS.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -2,40 +2,40 @@ import * as React$1 from 'react';
|
|
|
2
2
|
import React__default, { RefObject, ReactNode, Ref, MouseEvent as MouseEvent$1, MutableRefObject } from 'react';
|
|
3
3
|
import { a as ViewTransform, V as View, Z as ZoomBound, b as ZoomFactor } from './view-DSQgxBJB.js';
|
|
4
4
|
export { s as screenToWorld, v as viewToTransform, w as worldToScreen } from './view-DSQgxBJB.js';
|
|
5
|
-
import { a as UnitValue, b as UnitSystem, U as UseMoveOptions, O as OriginProjection } from './grid-
|
|
6
|
-
export { I as IMPERIAL_INCHES, M as METRIC_MM, P as PIXELS, R as RECT_ORIGIN_PROJECTION, c as Unit, f as formatUnit, g as gridSnapStrategy, p as pointToGridCell, r as resolveUnit } from './grid-
|
|
7
|
-
import { R as RenderLayer, D as Dims, a as DeviceProfile, b as DetectedDeviceFacts, C as Condition, c as Rule, d as RuleCtx, V as VisibilityRules, e as ChromeCtx, f as ChromeId, A as Action, g as DepSchema, S as SliceDep, h as ActionsRegistry, T as Tool, i as AffordanceHit, j as Dispatcher, k as ToolDef, l as ViewportToolDef, m as AnyTool, O as OverlayPosition, n as ToolCtx, o as ToolKeybinding, H as HotkeyTrigger, L as LayerHit, p as ChromeState, q as SelectionApi, I as InsertExtras, G as GeometryProjection, r as ContentHandlerEntry, s as SvgIngestOptions, U as UseSelectionOptions, t as ActionsProp, u as Affordance, v as AffordanceRegion, w as AffordanceBinding, x as CommonAffordanceScratch, B as BooleansAdapter, E as Eligibility, y as BindingScope, z as Contribution, F as ScopedBinding } from './registry-
|
|
8
|
-
export { J as ALWAYS, K as ActionDeps, M as ActionDisabledReason, N as ActionEnabledResult, P as ActionEntry, Q as ActionsProvider, W as ActiveToolContextProvider, X as ActiveToolContextProviderIfRoot, Y as ActiveToolContextProviderProps, Z as ActiveToolContextValue, _ as AreaSelectDep, $ as BindingOpts, a0 as BooleanOp, a1 as BooleanOpResult, a2 as BoundGesture, a3 as BuildRuleCtxArgs, a4 as ClaimableGesture, a5 as ClipboardDep, a6 as ClipboardIngestCtx, a7 as CustomPaintContext, a8 as DepName, a9 as DepRegistry, aa as DepRegistryProvider, ab as DispatcherContext, ac as DragSample, ad as EditAnchorsDep, ae as GestureBinding, af as IDENTITY_POSE_COMPOSITION, ag as ImmediateInvoker, ah as IngestCtx, ai as IngestionDep, aj as InsertDep, ak as InvocationCtx, al as Invoker, am as LassoSelectDep, an as LayoutDep, ao as MatchResult, ap as NEVER, aq as NodeAtPointDep, ar as OngoingHandle, as as OngoingInvoker, at as OngoingOverlay, au as Point2, av as PointerContextProvider, aw as PointerContextValue, ax as PointerWorldPos, ay as PoseAdapter, az as PoseComposition, aA as ResizePolicy, aB as ResolveAllOptions, aC as ResolveOnlyResult, aD as ResolvedCandidate, aE as SelectionExtendKey, aF as SelectionMode, aG as Selector, aH as SnapDep, aI as SvgUnpacker, aJ as TextEditDep, aK as ToolModifiers, aL as ToolPresentation, aM as ToolSlot, aN as UiOngoingControl, aO as ViewApi, aP as applyBooleanOp, aQ as buildRuleCtx, aR as clipboardCopyAction, aS as clipboardCutAction, aT as composeRectPose, aU as composeWorldPose, aV as createDispatcher, aW as decomposeRectPose, aX as describeRule, aY as drawLayers, aZ as enterTextEditAction, a_ as evaluate, a$ as evaluateEnabled, b0 as rebaseLocalPose, b1 as registerContentHandler, b2 as sliceAction, b3 as specificity, b4 as translateRectPose, b5 as useAction, b6 as useActionsRegistry, b7 as useActiveToolContext, b8 as useDepRegistry, b9 as useDepSource, ba as useOptionalActiveToolContext, bb as useOptionalDepRegistry, bc as usePointerContext, bd as useSelection, be as worldPoseLookup } from './registry-
|
|
5
|
+
import { a as UnitValue, b as UnitSystem, U as UseMoveOptions, O as OriginProjection } from './grid-sfilv5HP.js';
|
|
6
|
+
export { I as IMPERIAL_INCHES, M as METRIC_MM, P as PIXELS, R as RECT_ORIGIN_PROJECTION, c as Unit, f as formatUnit, g as gridSnapStrategy, p as pointToGridCell, r as resolveUnit } from './grid-sfilv5HP.js';
|
|
7
|
+
import { R as RenderLayer, D as Dims, a as DeviceProfile, b as DetectedDeviceFacts, C as Condition, c as Rule, d as RuleCtx, V as VisibilityRules, e as ChromeCtx, f as ChromeId, A as Action, g as DepSchema, S as SliceDep, h as ActionsRegistry, T as Tool, i as AffordanceHit, j as Dispatcher, k as ToolDef, l as ViewportToolDef, m as AnyTool, O as OverlayPosition, n as ToolCtx, o as ToolKeybinding, H as HotkeyTrigger, L as LayerHit, p as ChromeState, q as SelectionApi, I as InsertExtras, G as GeometryProjection, r as ContentHandlerEntry, s as SvgIngestOptions, U as UseSelectionOptions, t as ActionsProp, u as Affordance, v as AffordanceRegion, w as AffordanceBinding, x as CommonAffordanceScratch, B as BooleansAdapter, E as Eligibility, y as BindingScope, z as Contribution, F as ScopedBinding } from './registry-CxnkXbG8.js';
|
|
8
|
+
export { J as ALWAYS, K as ActionDeps, M as ActionDisabledReason, N as ActionEnabledResult, P as ActionEntry, Q as ActionsProvider, W as ActiveToolContextProvider, X as ActiveToolContextProviderIfRoot, Y as ActiveToolContextProviderProps, Z as ActiveToolContextValue, _ as AreaSelectDep, $ as BindingOpts, a0 as BooleanOp, a1 as BooleanOpResult, a2 as BoundGesture, a3 as BuildRuleCtxArgs, a4 as ClaimableGesture, a5 as ClipboardDep, a6 as ClipboardIngestCtx, a7 as CustomPaintContext, a8 as DepName, a9 as DepRegistry, aa as DepRegistryProvider, ab as DispatcherContext, ac as DragSample, ad as EditAnchorsDep, ae as GestureBinding, af as IDENTITY_POSE_COMPOSITION, ag as ImmediateInvoker, ah as IngestCtx, ai as IngestionDep, aj as InsertDep, ak as InvocationCtx, al as Invoker, am as LassoSelectDep, an as LayoutDep, ao as MatchResult, ap as NEVER, aq as NodeAtPointDep, ar as OngoingHandle, as as OngoingInvoker, at as OngoingOverlay, au as Point2, av as PointerContextProvider, aw as PointerContextValue, ax as PointerWorldPos, ay as PoseAdapter, az as PoseComposition, aA as ResizePolicy, aB as ResolveAllOptions, aC as ResolveOnlyResult, aD as ResolvedCandidate, aE as SelectionExtendKey, aF as SelectionMode, aG as Selector, aH as SnapDep, aI as SvgUnpacker, aJ as TextEditDep, aK as ToolModifiers, aL as ToolPresentation, aM as ToolSlot, aN as UiOngoingControl, aO as ViewApi, aP as applyBooleanOp, aQ as buildRuleCtx, aR as clipboardCopyAction, aS as clipboardCutAction, aT as composeRectPose, aU as composeWorldPose, aV as createDispatcher, aW as decomposeRectPose, aX as describeRule, aY as drawLayers, aZ as enterTextEditAction, a_ as evaluate, a$ as evaluateEnabled, b0 as rebaseLocalPose, b1 as registerContentHandler, b2 as sliceAction, b3 as specificity, b4 as translateRectPose, b5 as useAction, b6 as useActionsRegistry, b7 as useActiveToolContext, b8 as useDepRegistry, b9 as useDepSource, ba as useOptionalActiveToolContext, bb as useOptionalDepRegistry, bc as usePointerContext, bd as useSelection, be as worldPoseLookup } from './registry-CxnkXbG8.js';
|
|
9
9
|
import { S as Stroke, F as FillStyle, a as TextureHandle, T as TilePatternSpec, b as GradientKind, G as GradStop, c as GradientFill } from './paint-types-CnLIzqq1.js';
|
|
10
10
|
export { d as GradientUnits, R as Region, e as StrokeAlign, f as alignedStrokeRect } from './paint-types-CnLIzqq1.js';
|
|
11
|
-
import { B as Bounds, P as PoseProjection, F as FitViewToBoundsOptions, V as ViewportDims } from './geometry-
|
|
12
|
-
export { R as RECT_POSE_DESCRIPTOR, a as ROTATED_POSE_DESCRIPTOR, f as fitViewToBounds } from './geometry-
|
|
13
|
-
import { N as NodeId, S as Scene, a as Node$1, b as SerializedScene, R as RectPose, U as UseSceneOptions, c as SceneRegistry, d as RegisteredOp } from './types-
|
|
14
|
-
export { A as AddLayerSpec, e as AddNodeSpec, C as ContainerNode, L as LayerRecord, f as LeafNode, g as SerializedNode, h as SystemLayerRecord, i as SystemLayerSpec, j as UserLayerRecord, k as asNodeId } from './types-
|
|
15
|
-
import { M as ModifierState, R as ResizePose, B as BoundsConstraint, P as PointSnapBehavior, L as LassoSelectBehavior, a as RotatedPose, e as RotateBehavior, S as SnapStrategy, c as ResizeAnchor, b as MoveBehavior, I as InsertBehavior } from './types-
|
|
16
|
-
export { A as ActionBehavior, f as AreaSelectOverlay, g as BehaviorMoveResult, h as BehaviorResult, C as CloneBehavior, i as CloneLayer, j as ClonePose, G as GestureContext, k as GroupTransform, l as InsertMoveResult, m as InsertOverlay, n as InsertPoint, o as InsertProposed, p as LassoSelectMoveResult, q as LassoSelectOverlay, r as LassoSelectPose, s as LassoSelectProposed, t as PointSnapContext, d as PointSnapFrame, u as PointSnapResult, v as PointerState, w as ResizeMoveResult, x as ResizeOverlay, y as ResizeProposed, z as RotateMoveResult, D as RotateOverlay, E as RotateProposed } from './types-
|
|
17
|
-
import { U as UseResizeOptions } from './pointSnapToGrid-
|
|
18
|
-
export { C as CORNER_ANCHORS, a as CornerAnchor, e as CornerEdge, b as CornerHandle, c as cornerPoint, d as cornerResizeHandles, h as hitCornerHandle, p as pointSnapToGrid } from './pointSnapToGrid-
|
|
11
|
+
import { B as Bounds, P as PoseProjection, F as FitViewToBoundsOptions, V as ViewportDims } from './geometry-5X6TrAkX.js';
|
|
12
|
+
export { R as RECT_POSE_DESCRIPTOR, a as ROTATED_POSE_DESCRIPTOR, f as fitViewToBounds } from './geometry-5X6TrAkX.js';
|
|
13
|
+
import { N as NodeId, S as Scene, a as Node$1, b as SerializedScene, R as RectPose, U as UseSceneOptions, c as SceneRegistry, d as RegisteredOp } from './types-vqxpCFVp.js';
|
|
14
|
+
export { A as AddLayerSpec, e as AddNodeSpec, C as ContainerNode, L as LayerRecord, f as LeafNode, g as SerializedNode, h as SystemLayerRecord, i as SystemLayerSpec, j as UserLayerRecord, k as asNodeId } from './types-vqxpCFVp.js';
|
|
15
|
+
import { M as ModifierState, R as ResizePose, B as BoundsConstraint, P as PointSnapBehavior, L as LassoSelectBehavior, a as RotatedPose, e as RotateBehavior, S as SnapStrategy, c as ResizeAnchor, b as MoveBehavior, I as InsertBehavior } from './types-ByZxoD6P.js';
|
|
16
|
+
export { A as ActionBehavior, f as AreaSelectOverlay, g as BehaviorMoveResult, h as BehaviorResult, C as CloneBehavior, i as CloneLayer, j as ClonePose, G as GestureContext, k as GroupTransform, l as InsertMoveResult, m as InsertOverlay, n as InsertPoint, o as InsertProposed, p as LassoSelectMoveResult, q as LassoSelectOverlay, r as LassoSelectPose, s as LassoSelectProposed, t as PointSnapContext, d as PointSnapFrame, u as PointSnapResult, v as PointerState, w as ResizeMoveResult, x as ResizeOverlay, y as ResizeProposed, z as RotateMoveResult, D as RotateOverlay, E as RotateProposed } from './types-ByZxoD6P.js';
|
|
17
|
+
import { U as UseResizeOptions } from './pointSnapToGrid-C3wowsQy.js';
|
|
18
|
+
export { C as CORNER_ANCHORS, a as CornerAnchor, e as CornerEdge, b as CornerHandle, c as cornerPoint, d as cornerResizeHandles, h as hitCornerHandle, p as pointSnapToGrid } from './pointSnapToGrid-C3wowsQy.js';
|
|
19
19
|
import { BodyClassification, IngestItem } from '@weasel-js/gestures';
|
|
20
20
|
export { ClickSpec, DragSpec, DropSpec, GestureSpec, IngestItem, InputEvent, KeyHeldSpec, KeySpec, ModSpec, MultiTouchSpec, PasteSpec, TargetSpec, WheelSpec } from '@weasel-js/gestures';
|
|
21
|
-
import { M as MoveAdapter, A as AreaSelectAdapter, R as RotateAdapter, a as LassoHitMode, b as LassoSelectAdapter, c as ResizeAdapter, d as SceneAdapter, L as LayoutStrategy, e as LayerEnumerableAdapter, I as InsertAdapter, C as ClipboardSnapshot, O as OrderedAdapter, f as LayoutSnap } from './types-
|
|
22
|
-
export { g as ContainerBounds, D as DropTarget, h as LayoutChild, i as LayoutContainer, j as LayoutDragged, S as SnapTarget } from './types-
|
|
23
|
-
import { D as DebugSink, a as DebugConfig, b as DebugSnapshot, c as DebugStrokes, d as DebugTheme } from './types-
|
|
24
|
-
export { e as DebugFeature, f as DebugStroke, H as HandleKind, g as HitShape, R as RecordedBounds, h as RecordedHandle, i as RecordedHitbox, j as RecordedLayer, k as RecordedOrigin, l as RecordedSnap } from './types-
|
|
21
|
+
import { M as MoveAdapter, A as AreaSelectAdapter, R as RotateAdapter, a as LassoHitMode, b as LassoSelectAdapter, c as ResizeAdapter, d as SceneAdapter, L as LayoutStrategy, e as LayerEnumerableAdapter, I as InsertAdapter, C as ClipboardSnapshot, O as OrderedAdapter, f as LayoutSnap } from './types-DpQ0cWYC.js';
|
|
22
|
+
export { g as ContainerBounds, D as DropTarget, h as LayoutChild, i as LayoutContainer, j as LayoutDragged, S as SnapTarget } from './types-DpQ0cWYC.js';
|
|
23
|
+
import { D as DebugSink, a as DebugConfig, b as DebugSnapshot, c as DebugStrokes, d as DebugTheme } from './types-BHK2dkMu.js';
|
|
24
|
+
export { e as DebugFeature, f as DebugStroke, H as HandleKind, g as HitShape, R as RecordedBounds, h as RecordedHandle, i as RecordedHitbox, j as RecordedLayer, k as RecordedOrigin, l as RecordedSnap } from './types-BHK2dkMu.js';
|
|
25
25
|
import { a as PolygonPath, P as Path, b as PathFillRule, R as RectPath } from './path-B6MMiodD.js';
|
|
26
26
|
export { c as PATH_C, d as PATH_CMD_LENGTHS, e as PATH_L, f as PATH_M, g as PATH_Q, h as PATH_Z } from './path-B6MMiodD.js';
|
|
27
27
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
28
|
-
import { D as DrawCommand, S as ShaderProgramHandle, P as PathDrawCommand, d as StyledRun, R as ResolvedTextStyle, e as TextStyle, f as TextVerticalAlign } from './DrawCommand-
|
|
29
|
-
export { g as DEFAULT_TEXT_STYLE, G as GroupDrawCommand, I as ImageDrawCommand, M as Mat3, h as ResolvedRun, a as ShaderDrawCommand, b as ShaderUniform, T as TextDrawCommand, i as fontString, j as markdownToRuns, k as resolveRuns, l as resolveTextStyle, n as runsToMarkdown, o as runsToPlainText, t as toRuns, v as verticalAlignOffset } from './DrawCommand-
|
|
28
|
+
import { D as DrawCommand, S as ShaderProgramHandle, P as PathDrawCommand, d as StyledRun, R as ResolvedTextStyle, e as TextStyle, f as TextVerticalAlign } from './DrawCommand-BbPrSTra.js';
|
|
29
|
+
export { g as DEFAULT_TEXT_STYLE, G as GroupDrawCommand, I as ImageDrawCommand, M as Mat3, h as ResolvedRun, a as ShaderDrawCommand, b as ShaderUniform, T as TextDrawCommand, i as fontString, j as markdownToRuns, k as resolveRuns, l as resolveTextStyle, n as runsToMarkdown, o as runsToPlainText, t as toRuns, v as verticalAlignOffset } from './DrawCommand-BbPrSTra.js';
|
|
30
30
|
import { Op, CreateHistoryOptions, History } from '@weasel-js/history';
|
|
31
31
|
export * from '@weasel-js/history';
|
|
32
32
|
export { Op } from '@weasel-js/history';
|
|
33
33
|
import { Mat3 } from '@weasel-js/geom';
|
|
34
34
|
import { G as Guide } from './types-D2tTKEU0.js';
|
|
35
|
-
export { U as UseInsertOptions } from './options-
|
|
35
|
+
export { U as UseInsertOptions } from './options-CbsIgQci.js';
|
|
36
36
|
export { UseClipboardOpsOptions, UseClipboardOpsReturn, WEASEL_CLIPBOARD_MIME, WEASEL_CLIPBOARD_MIME_WEB, buildWeaselClipboardText, embedWeaselMetadataInSvg, extractWeaselClipboardFromSvg, parseWeaselClipboardText, sniffWeaselClipboardText, useClipboardOps } from './clipboard.js';
|
|
37
37
|
export { cloneByAltDrag } from './clone.js';
|
|
38
|
-
export { I as ImageMinification, v as viewToMat3 } from './viewToMat3-
|
|
38
|
+
export { I as ImageMinification, v as viewToMat3 } from './viewToMat3-CQW_YqDw.js';
|
|
39
39
|
export { FontVariant, LocalFontOutlinesResult, OutlineFontStyle, OutlineSource, OutlineStatus, OutlineVariant, canQueryLocalFonts, enableLocalFontOutlines, hasFontOutlines, isCanvasFont, listFontOutlines, outlineStatus, registerCanvasFont, registerFont, registerFontOutlines, subscribeGlyphReady, unregisterCanvasFont, unregisterFontOutlines } from '@weasel-js/font';
|
|
40
40
|
import { CapabilityTag } from '@weasel-js/modes';
|
|
41
41
|
|
|
@@ -272,6 +272,10 @@ interface ViewportLayer<TData> extends RenderLayer<TData> {
|
|
|
272
272
|
y: number;
|
|
273
273
|
} | null;
|
|
274
274
|
}
|
|
275
|
+
/** Build a layer that renders other layers through a second view, inside a
|
|
276
|
+
* sub-region of the canvas — a minimap, an inset, a magnifier. Its
|
|
277
|
+
* `reproject` maps screen points back through the inner view so the region
|
|
278
|
+
* can be interacted with. */
|
|
275
279
|
declare function createViewportLayer<TData>(opts: CreateViewportLayerOpts<TData>): ViewportLayer<TData>;
|
|
276
280
|
/**
|
|
277
281
|
* @experimental
|
|
@@ -291,10 +295,15 @@ declare function viewportsAt<TData>(layers: readonly ViewportLayer<TData>[], out
|
|
|
291
295
|
};
|
|
292
296
|
} | null;
|
|
293
297
|
|
|
298
|
+
/** One value for both axes, or a separate value per axis. */
|
|
294
299
|
type ScalarOrXY = number | {
|
|
295
300
|
x: number;
|
|
296
301
|
y: number;
|
|
297
302
|
};
|
|
303
|
+
/** How a parallax plane tracks the camera: `pan` is the fraction of the
|
|
304
|
+
* camera's translation it follows (1 = locked to the scene, 0 = fixed to the
|
|
305
|
+
* screen), `zoom` the same for scale, and `anchor` the world point both are
|
|
306
|
+
* measured from. */
|
|
298
307
|
interface ParallaxOpts {
|
|
299
308
|
pan: ScalarOrXY;
|
|
300
309
|
zoom?: ScalarOrXY;
|
|
@@ -316,6 +325,7 @@ interface ParallaxOpts {
|
|
|
316
325
|
*/
|
|
317
326
|
declare function deriveParallaxView(outer: View, opts: ParallaxOpts): View;
|
|
318
327
|
|
|
328
|
+
/** Options for `createParallaxLayer`. */
|
|
319
329
|
interface CreateParallaxLayerOpts<TData> extends ParallaxOpts {
|
|
320
330
|
id: string;
|
|
321
331
|
label: string;
|
|
@@ -364,6 +374,8 @@ interface SimulationForce<TNode extends SimulationNode = SimulationNode> {
|
|
|
364
374
|
(alpha: number): void;
|
|
365
375
|
initialize?(nodes: TNode[], random?: () => number): void;
|
|
366
376
|
}
|
|
377
|
+
/** Options for `useSimulation`: the nodes to move, the forces acting on them,
|
|
378
|
+
* and the cooling schedule that decides when the simulation settles. */
|
|
367
379
|
interface UseSimulationOptions<TNode extends SimulationNode> {
|
|
368
380
|
/** Mutable array of nodes. Kit + forces mutate vx/vy/x/y in place. */
|
|
369
381
|
nodes: TNode[];
|
|
@@ -387,6 +399,16 @@ interface UseSimulationOptions<TNode extends SimulationNode> {
|
|
|
387
399
|
requestFrame?: (cb: (t: number) => void) => number;
|
|
388
400
|
cancelFrame?: (handle: number) => void;
|
|
389
401
|
}
|
|
402
|
+
/**
|
|
403
|
+
* A running force simulation over a set of nodes.
|
|
404
|
+
*
|
|
405
|
+
* Each tick applies every force and then integrates velocities, scaled by
|
|
406
|
+
* `alpha` — a temperature that decays toward `alphaTarget` so the layout
|
|
407
|
+
* settles instead of jittering forever. Raise `alphaTarget` to reheat it,
|
|
408
|
+
* which is what a drag does.
|
|
409
|
+
*
|
|
410
|
+
* Nodes are mutated in place; the simulation holds the array, not a copy.
|
|
411
|
+
*/
|
|
390
412
|
interface Simulation<TNode extends SimulationNode> {
|
|
391
413
|
readonly nodes: TNode[];
|
|
392
414
|
setNodes(nodes: TNode[]): this;
|
|
@@ -414,7 +436,10 @@ interface Simulation<TNode extends SimulationNode> {
|
|
|
414
436
|
}
|
|
415
437
|
/** Default alpha decay: such that alpha drops from 1 to alphaMin (0.001) in 300 ticks. */
|
|
416
438
|
declare const DEFAULT_ALPHA_DECAY: number;
|
|
439
|
+
/** Alpha below which a cooling simulation is considered settled. */
|
|
417
440
|
declare const DEFAULT_ALPHA_MIN = 0.001;
|
|
441
|
+
/** Fraction of velocity shed each tick — friction. Higher settles sooner and
|
|
442
|
+
* overshoots less. */
|
|
418
443
|
declare const DEFAULT_VELOCITY_DECAY = 0.4;
|
|
419
444
|
|
|
420
445
|
/**
|
|
@@ -555,6 +580,7 @@ interface PointerStylusState extends StylusData {
|
|
|
555
580
|
* glass without contact. */
|
|
556
581
|
hovering: boolean;
|
|
557
582
|
}
|
|
583
|
+
/** Options for `usePointerStylus`. */
|
|
558
584
|
interface UsePointerStylusOptions {
|
|
559
585
|
/** Throttle re-renders to ≈this many state updates per second. The latest
|
|
560
586
|
* sample is always kept; intermediates are dropped. Default 60. Set to
|
|
@@ -721,12 +747,15 @@ interface ThresholdDragHandle {
|
|
|
721
747
|
/** Begin a threshold-gated drag from a React PointerDown event; returns a handle exposing live state. */
|
|
722
748
|
declare function startThresholdDrag(e: React.PointerEvent, opts: ThresholdDragOptions): ThresholdDragHandle;
|
|
723
749
|
|
|
750
|
+
/** The world rect a view is not allowed to show outside of. */
|
|
724
751
|
interface ClampBounds {
|
|
725
752
|
x: number;
|
|
726
753
|
y: number;
|
|
727
754
|
width: number;
|
|
728
755
|
height: number;
|
|
729
756
|
}
|
|
757
|
+
/** Canvas dimensions in CSS pixels — needed to know how much world a view
|
|
758
|
+
* actually shows. */
|
|
730
759
|
interface CanvasSize {
|
|
731
760
|
width: number;
|
|
732
761
|
height: number;
|
|
@@ -822,6 +851,7 @@ declare const ROTATION_HANDLE_BASE_PX = 24;
|
|
|
822
851
|
* force-touch-chrome demos possible without stubbing `matchMedia`.
|
|
823
852
|
*/
|
|
824
853
|
declare function useDeviceProfile(overrides?: Partial<DeviceProfile>): DeviceProfile;
|
|
854
|
+
/** Props for `<DeviceProfileProvider>`. */
|
|
825
855
|
interface DeviceProfileProviderProps {
|
|
826
856
|
/** Partial override folded over detected facts. */
|
|
827
857
|
value?: Partial<DeviceProfile>;
|
|
@@ -1169,6 +1199,7 @@ declare function resolveVisibility(consumer: VisibilityRules | undefined, ctx: C
|
|
|
1169
1199
|
* fixture, or `<SceneCanvas>`.
|
|
1170
1200
|
*/
|
|
1171
1201
|
|
|
1202
|
+
/** The pieces of live canvas state a `ChromeCtx` is assembled from. */
|
|
1172
1203
|
interface BuildChromeCtxArgs {
|
|
1173
1204
|
focused: boolean;
|
|
1174
1205
|
selection: readonly NodeId[];
|
|
@@ -1181,6 +1212,8 @@ interface BuildChromeCtxArgs {
|
|
|
1181
1212
|
hover: NodeId | null;
|
|
1182
1213
|
view: View;
|
|
1183
1214
|
}
|
|
1215
|
+
/** Gather the current canvas state into the context that chrome-visibility
|
|
1216
|
+
* rules are evaluated against. Rebuilt per frame. */
|
|
1184
1217
|
declare function buildChromeCtx(args: BuildChromeCtxArgs): ChromeCtx;
|
|
1185
1218
|
|
|
1186
1219
|
/**
|
|
@@ -1198,6 +1231,7 @@ declare function buildChromeCtx(args: BuildChromeCtxArgs): ChromeCtx;
|
|
|
1198
1231
|
* during paint, so the hover state is always read fresh.
|
|
1199
1232
|
*/
|
|
1200
1233
|
|
|
1234
|
+
/** Options for `useHoverTracking`. */
|
|
1201
1235
|
interface UseHoverTrackingArgs {
|
|
1202
1236
|
canvasRef: RefObject<HTMLCanvasElement | null>;
|
|
1203
1237
|
/** Client → world conversion. Same shape as the dispatcher's. */
|
|
@@ -1211,6 +1245,9 @@ interface UseHoverTrackingArgs {
|
|
|
1211
1245
|
} | null;
|
|
1212
1246
|
enabled?: boolean;
|
|
1213
1247
|
}
|
|
1248
|
+
/** Track which node the pointer is over. Returns a getter rather than state,
|
|
1249
|
+
* so per-frame code can read the current value without the hover re-rendering
|
|
1250
|
+
* the component on every pointer move. */
|
|
1214
1251
|
declare function useHoverTracking(args: UseHoverTrackingArgs): () => NodeId | null;
|
|
1215
1252
|
|
|
1216
1253
|
/**
|
|
@@ -1889,6 +1926,10 @@ declare function useStandardActions(opts: UseStandardActionsOptions): void;
|
|
|
1889
1926
|
* widened to all op-apply methods.
|
|
1890
1927
|
*/
|
|
1891
1928
|
|
|
1929
|
+
/** Build the adapter the default actions commit through when the consumer
|
|
1930
|
+
* supplies no `applyOps` hook of its own — it applies ops straight to the
|
|
1931
|
+
* scene. Selection, path and text ops are not covered; those surfaces belong
|
|
1932
|
+
* to their own owners. */
|
|
1892
1933
|
declare function defaultCommitAdapter<TPose>(scene: Scene<unknown, string, TPose>): {
|
|
1893
1934
|
getNode: (id: string) => Node$1<unknown, string, TPose> | undefined;
|
|
1894
1935
|
getNodes: () => Node$1<unknown, string, TPose>[];
|
|
@@ -1904,16 +1945,25 @@ declare function defaultCommitAdapter<TPose>(scene: Scene<unknown, string, TPose
|
|
|
1904
1945
|
insertNode: (node: Node$1<unknown, string, TPose>, index?: number) => NodeId;
|
|
1905
1946
|
};
|
|
1906
1947
|
|
|
1948
|
+
/** Options for `useResizePolicy`. Each omitted field falls back to the kit
|
|
1949
|
+
* default. */
|
|
1907
1950
|
interface UseResizePolicyOptions<TPose> {
|
|
1908
1951
|
constraints?: TPose extends ResizePose ? BoundsConstraint<TPose>[] : never[];
|
|
1909
1952
|
pointSnap?: TPose extends ResizePose ? PointSnapBehavior<TPose>[] : never[];
|
|
1910
1953
|
expandIds?: (ids: string[]) => string[];
|
|
1911
1954
|
projection?: PoseProjection<TPose>;
|
|
1912
1955
|
}
|
|
1956
|
+
/** Publish how resizing should behave — constraints, point snapping, group
|
|
1957
|
+
* expansion, pose projection — for the resize action to consult. */
|
|
1913
1958
|
declare function useResizePolicy<TPose>(options: UseResizePolicyOptions<TPose>): void;
|
|
1914
1959
|
|
|
1960
|
+
/** Publish how a slice (knife cut) is performed, so the `slice` action can
|
|
1961
|
+
* run against the consumer's geometry. */
|
|
1915
1962
|
declare function useSliceDep(dep: SliceDep): void;
|
|
1916
1963
|
|
|
1964
|
+
/** Options for `useGestureDispatcher`: the element to listen on, the actions
|
|
1965
|
+
* and tools in play, and the hooks that turn raw DOM events into the world
|
|
1966
|
+
* coordinates and hit targets bindings match against. */
|
|
1917
1967
|
interface UseGestureDispatcherOptions {
|
|
1918
1968
|
/** Ref to the canvas element. Pointer/wheel/multitouch listeners attach here. */
|
|
1919
1969
|
canvasRef: RefObject<HTMLCanvasElement | null>;
|
|
@@ -2039,6 +2089,15 @@ interface UseGestureDispatcherOptions {
|
|
|
2039
2089
|
*/
|
|
2040
2090
|
getRuleCtx?: () => RuleCtx;
|
|
2041
2091
|
}
|
|
2092
|
+
/**
|
|
2093
|
+
* Attach the input pipeline to a canvas: DOM pointer, wheel, keyboard and
|
|
2094
|
+
* multitouch listeners in, normalized input events out, routed through the
|
|
2095
|
+
* dispatcher to whichever action a binding names.
|
|
2096
|
+
*
|
|
2097
|
+
* Everything it needs beyond its options — the active tool, the dep registry —
|
|
2098
|
+
* comes from context, so it must be mounted inside `<SceneCanvas>`'s
|
|
2099
|
+
* providers.
|
|
2100
|
+
*/
|
|
2042
2101
|
declare function useGestureDispatcher(opts: UseGestureDispatcherOptions): void;
|
|
2043
2102
|
|
|
2044
2103
|
/**
|
|
@@ -2082,6 +2141,8 @@ declare function computeWheelAction(state: WheelState, input: WheelInput, bounds
|
|
|
2082
2141
|
*/
|
|
2083
2142
|
declare function clientToCanvas(canvas: HTMLCanvasElement, clientX: number, clientY: number): [number, number];
|
|
2084
2143
|
|
|
2144
|
+
/** Records recent pointer deltas and reports the current velocity, averaged
|
|
2145
|
+
* over the last 100ms — the throw speed a momentum decay starts from. */
|
|
2085
2146
|
declare function useVelocityTracker(): {
|
|
2086
2147
|
record(dx: number, dy: number, t: number): void;
|
|
2087
2148
|
getVelocity(): {
|
|
@@ -2091,12 +2152,15 @@ declare function useVelocityTracker(): {
|
|
|
2091
2152
|
reset(): void;
|
|
2092
2153
|
};
|
|
2093
2154
|
|
|
2155
|
+
/** Per-axis limits on a view's position. Any side may be left open. */
|
|
2094
2156
|
interface PanBounds {
|
|
2095
2157
|
minX?: number;
|
|
2096
2158
|
maxX?: number;
|
|
2097
2159
|
minY?: number;
|
|
2098
2160
|
maxY?: number;
|
|
2099
2161
|
}
|
|
2162
|
+
/** How a decay should run: its starting velocity, how fast it slows, and what
|
|
2163
|
+
* happens if it reaches the pan limits. */
|
|
2100
2164
|
interface DecayLoopConfig {
|
|
2101
2165
|
velocity: {
|
|
2102
2166
|
vx: number;
|
|
@@ -2122,11 +2186,15 @@ interface DecayLoopConfig {
|
|
|
2122
2186
|
onTick: (dx: number, dy: number) => void;
|
|
2123
2187
|
onEnd?: () => void;
|
|
2124
2188
|
}
|
|
2189
|
+
/** A rAF loop that coasts a value to a stop under friction, reporting the
|
|
2190
|
+
* per-frame delta. What turns a released pan drag into momentum scrolling. */
|
|
2125
2191
|
declare function useDecayLoop(): {
|
|
2126
2192
|
start: (config: DecayLoopConfig) => void;
|
|
2127
2193
|
cancel: () => void;
|
|
2128
2194
|
};
|
|
2129
2195
|
|
|
2196
|
+
/** Animate the view from where it is to a target view — zoom-to-fit,
|
|
2197
|
+
* zoom-to-selection, and anything else that should glide rather than jump. */
|
|
2130
2198
|
declare function useViewTween(setView: (v: View) => void): {
|
|
2131
2199
|
animateTo: (from: View, to: View, opts?: {
|
|
2132
2200
|
duration?: number;
|
|
@@ -2206,6 +2274,8 @@ declare function defineTool<TScratch = void>(def: ToolDef<TScratch>): Tool<TScra
|
|
|
2206
2274
|
*/
|
|
2207
2275
|
declare function defineViewportTool<TScratch = void>(def: ViewportToolDef<TScratch>): Tool<TScratch>;
|
|
2208
2276
|
|
|
2277
|
+
/** Options for `useTools`: which tools exist, which one starts active, and
|
|
2278
|
+
* which run continuously regardless of the active one. */
|
|
2209
2279
|
interface UseToolsOptions {
|
|
2210
2280
|
/** Initial active-slot tool id. Must exist in `registry`. */
|
|
2211
2281
|
active: string;
|
|
@@ -2216,6 +2286,8 @@ interface UseToolsOptions {
|
|
|
2216
2286
|
/** Always-on tools — listen continuously regardless of active slot. */
|
|
2217
2287
|
ambient?: AnyTool[];
|
|
2218
2288
|
}
|
|
2289
|
+
/** The tool registry's runtime surface: which tool is active, which is
|
|
2290
|
+
* temporarily held by a hotkey, and how to change either. */
|
|
2219
2291
|
interface ToolsApi {
|
|
2220
2292
|
/** Current active-slot tool id. */
|
|
2221
2293
|
active: string;
|
|
@@ -2260,6 +2332,7 @@ interface ToolsApi {
|
|
|
2260
2332
|
*/
|
|
2261
2333
|
declare function useTools(opts: UseToolsOptions): ToolsApi;
|
|
2262
2334
|
|
|
2335
|
+
/** Options for `useKeybindings`. */
|
|
2263
2336
|
interface UseKeybindingsOptions {
|
|
2264
2337
|
/** Skip all wiring. Useful for touch apps or test isolation. */
|
|
2265
2338
|
disable?: boolean;
|
|
@@ -2278,8 +2351,12 @@ interface UseKeybindingsOptions {
|
|
|
2278
2351
|
*/
|
|
2279
2352
|
isToolEligible?: (toolId: string) => boolean;
|
|
2280
2353
|
}
|
|
2354
|
+
/** Wire the single-key tool-activation shortcuts (V, P, T, …) and Escape to
|
|
2355
|
+
* return to the default tool. Activation is gated on what the active mode
|
|
2356
|
+
* allows, so a key cannot reach a tool the palette greys out. */
|
|
2281
2357
|
declare function useKeybindings(tools: ToolsApi, options?: UseKeybindingsOptions): void;
|
|
2282
2358
|
|
|
2359
|
+
/** The value types a built-in pref leaf can hold. */
|
|
2283
2360
|
type ToolPrefKind = 'number' | 'boolean' | 'string' | 'enum' | 'color' | 'paint';
|
|
2284
2361
|
interface ToolPrefBase<K extends string, Value> {
|
|
2285
2362
|
kind: K;
|
|
@@ -2301,9 +2378,13 @@ interface ToolPrefBase<K extends string, Value> {
|
|
|
2301
2378
|
* `pose.x` / `pose.y`). Purely presentational. */
|
|
2302
2379
|
pair?: string;
|
|
2303
2380
|
}
|
|
2381
|
+
/** How a schema-driven UI should present a number pref. */
|
|
2304
2382
|
type ToolPrefNumberControl = 'input' | 'slider';
|
|
2383
|
+
/** How a schema-driven UI should present a boolean pref. */
|
|
2305
2384
|
type ToolPrefBooleanControl = 'checkbox' | 'switch';
|
|
2385
|
+
/** How a schema-driven UI should present a string pref. */
|
|
2306
2386
|
type ToolPrefStringControl = 'input' | 'textarea';
|
|
2387
|
+
/** How a schema-driven UI should present an enum pref. */
|
|
2307
2388
|
type ToolPrefEnumControl = 'select' | 'radio';
|
|
2308
2389
|
/** Display-unit conversion for number leaves whose stored value uses a
|
|
2309
2390
|
* canonical unit the user shouldn't see (e.g. radians stored, degrees
|
|
@@ -2314,6 +2395,8 @@ interface ToolPrefNumberUnit {
|
|
|
2314
2395
|
/** Shown after the input, e.g. `'°'`. */
|
|
2315
2396
|
suffix?: string;
|
|
2316
2397
|
}
|
|
2398
|
+
/** A numeric pref, optionally bounded and stepped, and optionally stored in a
|
|
2399
|
+
* different unit from the one shown. */
|
|
2317
2400
|
interface ToolPrefNumber extends ToolPrefBase<'number', number> {
|
|
2318
2401
|
min?: number;
|
|
2319
2402
|
max?: number;
|
|
@@ -2321,12 +2404,15 @@ interface ToolPrefNumber extends ToolPrefBase<'number', number> {
|
|
|
2321
2404
|
control?: ToolPrefNumberControl;
|
|
2322
2405
|
unit?: ToolPrefNumberUnit;
|
|
2323
2406
|
}
|
|
2407
|
+
/** An on/off pref. */
|
|
2324
2408
|
interface ToolPrefBoolean extends ToolPrefBase<'boolean', boolean> {
|
|
2325
2409
|
control?: ToolPrefBooleanControl;
|
|
2326
2410
|
}
|
|
2411
|
+
/** A free-text pref. */
|
|
2327
2412
|
interface ToolPrefString extends ToolPrefBase<'string', string> {
|
|
2328
2413
|
control?: ToolPrefStringControl;
|
|
2329
2414
|
}
|
|
2415
|
+
/** A pref with a fixed set of labeled choices. */
|
|
2330
2416
|
interface ToolPrefEnum<T extends string = string> extends ToolPrefBase<'enum', T> {
|
|
2331
2417
|
options: readonly {
|
|
2332
2418
|
value: T;
|
|
@@ -2334,6 +2420,8 @@ interface ToolPrefEnum<T extends string = string> extends ToolPrefBase<'enum', T
|
|
|
2334
2420
|
}[];
|
|
2335
2421
|
control?: ToolPrefEnumControl;
|
|
2336
2422
|
}
|
|
2423
|
+
/** A single color, stored as a hex string. For a value that may also be a
|
|
2424
|
+
* gradient or a pattern, use {@link ToolPrefPaint} instead. */
|
|
2337
2425
|
interface ToolPrefColor extends ToolPrefBase<'color', string> {
|
|
2338
2426
|
/** Value is `#rrggbb`, or `#rrggbbaa` when `alpha` is set (UIs then
|
|
2339
2427
|
* offer an opacity control). */
|
|
@@ -2362,6 +2450,8 @@ interface ToolPrefPaint extends ToolPrefBase<'paint', unknown> {
|
|
|
2362
2450
|
/** Offer an opacity control alongside the color. */
|
|
2363
2451
|
alpha?: boolean;
|
|
2364
2452
|
}
|
|
2453
|
+
/** One built-in pref leaf. `ToolPrefLeaf` widens this to include
|
|
2454
|
+
* app-defined kinds. */
|
|
2365
2455
|
type ToolPref = ToolPrefNumber | ToolPrefBoolean | ToolPrefString | ToolPrefEnum | ToolPrefColor | ToolPrefPaint;
|
|
2366
2456
|
/** Built-in or app-defined leaf. */
|
|
2367
2457
|
type ToolPrefLeaf = ToolPref | ToolPrefCustom;
|
|
@@ -2372,6 +2462,8 @@ interface ToolPrefGroup {
|
|
|
2372
2462
|
children: Record<string, ToolPrefLeaf | ToolPrefGroup>;
|
|
2373
2463
|
}
|
|
2374
2464
|
|
|
2465
|
+
/** Options for `useSelectTool`: how a point resolves to nodes, how a click
|
|
2466
|
+
* chooses among them, and the appearance of the marquee. */
|
|
2375
2467
|
interface UseSelectToolOptions<TPose> {
|
|
2376
2468
|
/** Return ids of all objects whose painted body covers (worldX, worldY).
|
|
2377
2469
|
* Order doesn't matter — the tool collapses parent/child overlap via
|
|
@@ -2465,6 +2557,8 @@ declare function useSelectTool<TNode extends {
|
|
|
2465
2557
|
id: string;
|
|
2466
2558
|
}, TPose>(adapter: SelectAdapter<TNode, TPose>, options: UseSelectToolOptions<TPose>): Tool<null>;
|
|
2467
2559
|
|
|
2560
|
+
/** Options for `useRotateTool` — mostly the placement and hit size of the
|
|
2561
|
+
* rotation handle. */
|
|
2468
2562
|
interface UseRotateToolOptions<TNode extends {
|
|
2469
2563
|
id: string;
|
|
2470
2564
|
}, _TPose> {
|
|
@@ -2547,6 +2641,9 @@ interface PickTopMostHitAdapter {
|
|
|
2547
2641
|
* `getZIndex` when both are present. */
|
|
2548
2642
|
compareZ?: (a: string, b: string) => number;
|
|
2549
2643
|
}
|
|
2644
|
+
/** Reduce a set of hit ids to the single one a click should act on: drop any
|
|
2645
|
+
* id that is an ancestor of another in the set, then take the topmost of what
|
|
2646
|
+
* remains. */
|
|
2550
2647
|
declare function pickTopMostHit(ids: readonly string[], adapter: PickTopMostHitAdapter | undefined | null): string | null;
|
|
2551
2648
|
|
|
2552
2649
|
/** Hit-existing gate shared by the drag-insert tool hooks. When the consumer
|
|
@@ -2559,6 +2656,8 @@ declare function applyHitExistingGate(ctx: ToolCtx<unknown>, hitExisting: ((p: {
|
|
|
2559
2656
|
y: number;
|
|
2560
2657
|
}) => string | string[] | null) | undefined): boolean;
|
|
2561
2658
|
|
|
2659
|
+
/** Momentum settings for the hand tool: how quickly a flung view slows, when
|
|
2660
|
+
* it stops, and what happens at the pan limits. */
|
|
2562
2661
|
interface InertiaConfig {
|
|
2563
2662
|
friction?: number;
|
|
2564
2663
|
minSpeed?: number;
|
|
@@ -2567,6 +2666,7 @@ interface InertiaConfig {
|
|
|
2567
2666
|
/** View-coordinate limits for boundary clamping. Requires `boundary` to take effect. */
|
|
2568
2667
|
bounds?: PanBounds;
|
|
2569
2668
|
}
|
|
2669
|
+
/** Options for `useHandTool`. */
|
|
2570
2670
|
interface UseHandToolOptions {
|
|
2571
2671
|
inertia?: false | InertiaConfig;
|
|
2572
2672
|
/**
|
|
@@ -2615,6 +2715,8 @@ declare function useHandTool(opts?: UseHandToolOptions): Tool<HandScratch | null
|
|
|
2615
2715
|
* factories and hit gating belong on those deps, not on the tool. */
|
|
2616
2716
|
declare function useTextTool(): Tool<undefined>;
|
|
2617
2717
|
|
|
2718
|
+
/** Options for `usePinchZoomTool`: the zoom limits, and whether it is wired
|
|
2719
|
+
* at all. */
|
|
2618
2720
|
interface PinchZoomToolOpts {
|
|
2619
2721
|
min?: number;
|
|
2620
2722
|
max?: number;
|
|
@@ -2650,6 +2752,8 @@ interface PenAnchor$1 {
|
|
|
2650
2752
|
* anchor's incoming handle is NOT mirrored from this one. */
|
|
2651
2753
|
altBroken?: boolean;
|
|
2652
2754
|
}
|
|
2755
|
+
/** One in-progress subpath of the pen tool: its anchors so far, and whether
|
|
2756
|
+
* the user has closed it. */
|
|
2653
2757
|
interface PenSubpath {
|
|
2654
2758
|
anchors: PenAnchor$1[];
|
|
2655
2759
|
closed: boolean;
|
|
@@ -2686,6 +2790,8 @@ interface PenScratch {
|
|
|
2686
2790
|
draggingHandleAt: number | null;
|
|
2687
2791
|
closeHintActive: boolean;
|
|
2688
2792
|
}
|
|
2793
|
+
/** Options for `usePenTool`: how a finished path becomes a pose, where it is
|
|
2794
|
+
* inserted, and when a closed subpath commits. */
|
|
2689
2795
|
interface UsePenToolOptions<TPose> {
|
|
2690
2796
|
/** Wrap a finished PolygonPath in the consumer's pose type. */
|
|
2691
2797
|
wrapPath: (path: PolygonPath, opts: {
|
|
@@ -2780,6 +2886,7 @@ declare function useRectTool(): Tool<null>;
|
|
|
2780
2886
|
*/
|
|
2781
2887
|
declare function useEllipseTool(): Tool<null>;
|
|
2782
2888
|
|
|
2889
|
+
/** Options for `useImageTool`. */
|
|
2783
2890
|
interface UseImageToolOptions {
|
|
2784
2891
|
/** Image source for inserted nodes — a URL, a `blob:` URL, or a
|
|
2785
2892
|
* `data:image/…;base64,…` URI. Stored verbatim on each new node's
|
|
@@ -2803,6 +2910,7 @@ interface UseImageToolOptions {
|
|
|
2803
2910
|
*/
|
|
2804
2911
|
declare function useImageTool(options: UseImageToolOptions): Tool<null>;
|
|
2805
2912
|
|
|
2913
|
+
/** Options for `useEyedropperTool`. */
|
|
2806
2914
|
interface UseEyedropperToolOptions {
|
|
2807
2915
|
/** Called when the user picks a color. `null` means "no node was hit
|
|
2808
2916
|
* with a color" — currently only reachable when `colorOf` returns null
|
|
@@ -2833,6 +2941,7 @@ interface UseEyedropperToolOptions {
|
|
|
2833
2941
|
*/
|
|
2834
2942
|
declare function useEyedropperTool(opts: UseEyedropperToolOptions): Tool<null>;
|
|
2835
2943
|
|
|
2944
|
+
/** An endpoint of a line, in world coordinates. */
|
|
2836
2945
|
interface LinePoint {
|
|
2837
2946
|
x: number;
|
|
2838
2947
|
y: number;
|
|
@@ -2858,6 +2967,7 @@ declare function useLineTool(): Tool<null>;
|
|
|
2858
2967
|
* Consumers should import from here directly; `lassoSelect.ts`
|
|
2859
2968
|
* re-exports the same symbol for back-compat. */
|
|
2860
2969
|
|
|
2970
|
+
/** Options for the `lasso-select` action. */
|
|
2861
2971
|
interface UseLassoSelectOptions {
|
|
2862
2972
|
behaviors?: LassoSelectBehavior[];
|
|
2863
2973
|
/** When set, overrides any behavior's `defaultTransient`. */
|
|
@@ -2873,6 +2983,8 @@ interface UseLassoSelectOptions {
|
|
|
2873
2983
|
debug?: DebugSink;
|
|
2874
2984
|
}
|
|
2875
2985
|
|
|
2986
|
+
/** Options for `useLassoTool` — the lasso-select action's options plus the
|
|
2987
|
+
* tool's own hit mode and activation key. */
|
|
2876
2988
|
interface UseLassoToolOptions extends Pick<UseLassoSelectOptions, 'behaviors' | 'transient' | 'label' | 'onGestureStart' | 'onGestureEnd' | 'minVertexSpacing' | 'debug'> {
|
|
2877
2989
|
/** Hit mode forwarded to the default `selectFromLasso` behavior when no
|
|
2878
2990
|
* explicit `behaviors` array is passed. Default 'intersect'. */
|
|
@@ -2891,10 +3003,12 @@ interface UseLassoToolOptions extends Pick<UseLassoSelectOptions, 'behaviors' |
|
|
|
2891
3003
|
* `lassoSelectAction` (see `src/interactions/actions/defaults/lassoSelect.ts`). */
|
|
2892
3004
|
declare function useLassoTool(_adapter: LassoSelectAdapter, options?: UseLassoToolOptions): Tool<undefined>;
|
|
2893
3005
|
|
|
3006
|
+
/** A point in world coordinates. */
|
|
2894
3007
|
interface PolygonPoint {
|
|
2895
3008
|
x: number;
|
|
2896
3009
|
y: number;
|
|
2897
3010
|
}
|
|
3011
|
+
/** Options for `usePolygonTool`. */
|
|
2898
3012
|
interface UsePolygonToolOptions {
|
|
2899
3013
|
label?: string;
|
|
2900
3014
|
/** Initial side count. Side count persists across gestures
|
|
@@ -2919,10 +3033,12 @@ declare function usePolygonTool<TNode extends {
|
|
|
2919
3033
|
id: string;
|
|
2920
3034
|
}>(options?: UsePolygonToolOptions): Tool<null>;
|
|
2921
3035
|
|
|
3036
|
+
/** A point in world coordinates. */
|
|
2922
3037
|
interface StarPoint {
|
|
2923
3038
|
x: number;
|
|
2924
3039
|
y: number;
|
|
2925
3040
|
}
|
|
3041
|
+
/** Options for `useStarTool`. */
|
|
2926
3042
|
interface UseStarToolOptions {
|
|
2927
3043
|
label?: string;
|
|
2928
3044
|
/** Initial point count. Persists across gestures (Illustrator
|
|
@@ -3324,6 +3440,9 @@ interface HierarchicalAdapter<TNode, TPose> {
|
|
|
3324
3440
|
* `viewportRegistered` is false and SceneCanvas omits `hand` from the registry.
|
|
3325
3441
|
*/
|
|
3326
3442
|
|
|
3443
|
+
/** Which viewport interactions `<SceneCanvas>` wires up — pan inertia, pinch
|
|
3444
|
+
* zoom, wheel pan, wheel and keyboard zoom. Each may be switched off with
|
|
3445
|
+
* `false` or tuned with an options object. */
|
|
3327
3446
|
interface ViewportConfig {
|
|
3328
3447
|
inertia?: boolean | {
|
|
3329
3448
|
friction?: number;
|
|
@@ -3411,9 +3530,15 @@ type SelectionOverlaySlotConfig<TPose> = Omit<SelectionOverlayLayerOpts<TPose>,
|
|
|
3411
3530
|
type StandardSlotConfig<TNode extends {
|
|
3412
3531
|
id: string;
|
|
3413
3532
|
}, TPose> = GridSlotConfig | SceneSlotConfig<TNode, TPose> | SelectionOverlaySlotConfig<TPose>;
|
|
3533
|
+
/** What may fill one of the canvas's named layer slots: a config the canvas
|
|
3534
|
+
* builds the layer from, a pre-built layer, or `null` to leave the slot
|
|
3535
|
+
* empty. */
|
|
3414
3536
|
type LayerSlotValue<TNode extends {
|
|
3415
3537
|
id: string;
|
|
3416
3538
|
}, TPose> = StandardSlotConfig<TNode, TPose> | CustomLayerEntry | null;
|
|
3539
|
+
/** The canvas's render stack, as named slots. The standard slots (grid,
|
|
3540
|
+
* scene, selection overlay, cell highlight) can be configured, replaced with
|
|
3541
|
+
* a layer of your own, or switched off; further keys add custom layers. */
|
|
3417
3542
|
type LayersMap<TNode extends {
|
|
3418
3543
|
id: string;
|
|
3419
3544
|
}, TPose> = {
|
|
@@ -3798,6 +3923,7 @@ interface CanvasHelpers<TPose> {
|
|
|
3798
3923
|
getIsVisible(): (id: string) => boolean;
|
|
3799
3924
|
}
|
|
3800
3925
|
|
|
3926
|
+
/** Which of a node's two per-anchor color arrays an override applies to. */
|
|
3801
3927
|
type VertexColorChannel = 'fill' | 'stroke';
|
|
3802
3928
|
/** Function-form override: receives the consumer-supplied base color
|
|
3803
3929
|
* array and the current animation timestamp (ms, from the animator's
|
|
@@ -3821,7 +3947,12 @@ declare class ColorOverrideRegistry {
|
|
|
3821
3947
|
version(): number;
|
|
3822
3948
|
}
|
|
3823
3949
|
|
|
3950
|
+
/** An easing curve: maps normalized progress `t ∈ [0, 1]` to eased progress.
|
|
3951
|
+
* Curves may leave the 0–1 range in the middle (back, elastic) but should
|
|
3952
|
+
* pass through 0 at 0 and 1 at 1. */
|
|
3824
3953
|
type EasingFn = (t: number) => number;
|
|
3954
|
+
/** Blends two `T` values at eased progress `t`. Called once per frame; see
|
|
3955
|
+
* {@link InterpolatorFactory} when the blend has setup worth hoisting. */
|
|
3825
3956
|
type Interpolate<T> = (from: T, to: T, t: number) => T;
|
|
3826
3957
|
/** Factory interpolator: built ONCE at tween start with (from, to), the returned
|
|
3827
3958
|
* function is called with `t ∈ [0, 1]` each frame. Use for interpolators with
|
|
@@ -3829,12 +3960,17 @@ type Interpolate<T> = (from: T, to: T, t: number) => T;
|
|
|
3829
3960
|
* shape exactly. For cheap interpolations the per-tick `Interpolate<T>` form is
|
|
3830
3961
|
* fine; this is the escape hatch when setup-per-tick is wasteful. */
|
|
3831
3962
|
type InterpolatorFactory<T> = (from: T, to: T) => (t: number) => T;
|
|
3963
|
+
/** A spring's physical parameters. Higher stiffness settles faster, higher
|
|
3964
|
+
* damping overshoots less, higher mass makes both sluggish. */
|
|
3832
3965
|
interface SpringPreset {
|
|
3833
3966
|
stiffness: number;
|
|
3834
3967
|
damping: number;
|
|
3835
3968
|
mass: number;
|
|
3836
3969
|
}
|
|
3970
|
+
/** One of the tunings in `SPRING_PRESETS`. */
|
|
3837
3971
|
type SpringPresetName = 'gentle' | 'wobbly' | 'stiff' | 'slow';
|
|
3972
|
+
/** A running animation. Cancel it, or bend its time — pausing and time-scaling
|
|
3973
|
+
* act on this animation's own virtual clock, independent of the animator's. */
|
|
3838
3974
|
interface AnimationHandle {
|
|
3839
3975
|
/** Monotonic id assigned by the animator. */
|
|
3840
3976
|
id: number;
|
|
@@ -3849,6 +3985,9 @@ interface AnimationHandle {
|
|
|
3849
3985
|
/** True iff this handle is currently paused. */
|
|
3850
3986
|
isPaused(): boolean;
|
|
3851
3987
|
}
|
|
3988
|
+
/** A duration-based animation from `from` to `to` over `ms`, shaped by an
|
|
3989
|
+
* easing curve. Reach for a spring instead when the motion should respond to
|
|
3990
|
+
* where the value already is rather than restart from a fixed duration. */
|
|
3852
3991
|
interface TweenOptions<T> {
|
|
3853
3992
|
from: T;
|
|
3854
3993
|
to: T;
|
|
@@ -3867,6 +4006,9 @@ interface TweenOptions<T> {
|
|
|
3867
4006
|
/** Any new animation passed the same cancelKey cancels the prior one in flight. */
|
|
3868
4007
|
cancelKey?: string;
|
|
3869
4008
|
}
|
|
4009
|
+
/** A spring animation: runs until the value settles on `to` rather than for a
|
|
4010
|
+
* set duration, so it absorbs an initial velocity naturally. Non-numeric `T`
|
|
4011
|
+
* needs the four vector helpers. */
|
|
3870
4012
|
interface SpringOptions<T> {
|
|
3871
4013
|
from: T;
|
|
3872
4014
|
to: T;
|
|
@@ -3888,6 +4030,9 @@ interface SpringOptions<T> {
|
|
|
3888
4030
|
onDone?: () => void;
|
|
3889
4031
|
cancelKey?: string;
|
|
3890
4032
|
}
|
|
4033
|
+
/** Spring and decay as one animation. With a `to`, a spring pulls toward it;
|
|
4034
|
+
* with `to: null`, the value coasts on its velocity. Either can become the
|
|
4035
|
+
* other mid-flight through the handle. */
|
|
3891
4036
|
interface PhysicsOptions<T> {
|
|
3892
4037
|
from: T;
|
|
3893
4038
|
/** Target. `null` ⇒ no spring force (decay-mode). */
|
|
@@ -3908,12 +4053,16 @@ interface PhysicsOptions<T> {
|
|
|
3908
4053
|
onDone?: () => void;
|
|
3909
4054
|
cancelKey?: string;
|
|
3910
4055
|
}
|
|
4056
|
+
/** An `AnimationHandle` that can also be steered while it runs — the point of
|
|
4057
|
+
* the physics primitive. */
|
|
3911
4058
|
interface PhysicsHandle<T = unknown> extends AnimationHandle {
|
|
3912
4059
|
/** Retarget mid-flight. `null` ⇒ switch to decay-mode (no spring force). */
|
|
3913
4060
|
setTarget(to: T | null): void;
|
|
3914
4061
|
/** Replace the current velocity in T-units per second. */
|
|
3915
4062
|
setVelocity(v: T): void;
|
|
3916
4063
|
}
|
|
4064
|
+
/** Momentum: coast from `from` at `velocity`, slowing by `friction` each
|
|
4065
|
+
* second until below `threshold`. What a flick-to-pan leaves behind. */
|
|
3917
4066
|
interface DecayOptions<T> {
|
|
3918
4067
|
from: T;
|
|
3919
4068
|
velocity: T;
|
|
@@ -3928,6 +4077,8 @@ interface DecayOptions<T> {
|
|
|
3928
4077
|
onDone?: () => void;
|
|
3929
4078
|
cancelKey?: string;
|
|
3930
4079
|
}
|
|
4080
|
+
/** Options for `useAnimator`. Everything here is an injection seam for tests;
|
|
4081
|
+
* the defaults are the real clock, rAF, and `setTimeout`. */
|
|
3931
4082
|
interface UseAnimatorOptions {
|
|
3932
4083
|
/** Optional clock injection for tests. Returns ms since some epoch. */
|
|
3933
4084
|
now?: () => number;
|
|
@@ -3940,6 +4091,15 @@ interface UseAnimatorOptions {
|
|
|
3940
4091
|
/** Companion to `setTimer`. Defaults to global `clearTimeout`. */
|
|
3941
4092
|
clearTimer?: (handle: unknown) => void;
|
|
3942
4093
|
}
|
|
4094
|
+
/**
|
|
4095
|
+
* Owns every running animation on a canvas and drives them from one rAF loop.
|
|
4096
|
+
* Beyond the primitives (`tween`, `spring`, `decay`, `physics`) it offers
|
|
4097
|
+
* composition — `loop`, `stagger` — and bulk control by handle, by cancel-key,
|
|
4098
|
+
* or over everything at once.
|
|
4099
|
+
*
|
|
4100
|
+
* An animator does not know about the scene: animations report values through
|
|
4101
|
+
* `onTick` and the caller decides what to do with them.
|
|
4102
|
+
*/
|
|
3943
4103
|
interface Animator {
|
|
3944
4104
|
tween<T>(opts: TweenOptions<T>): AnimationHandle;
|
|
3945
4105
|
spring<T>(opts: SpringOptions<T>): AnimationHandle;
|
|
@@ -4043,6 +4203,7 @@ interface Animator {
|
|
|
4043
4203
|
*/
|
|
4044
4204
|
keepAlive(): () => void;
|
|
4045
4205
|
}
|
|
4206
|
+
/** Options for `Animator.loop`. */
|
|
4046
4207
|
interface LoopOptions {
|
|
4047
4208
|
/** Maximum number of iterations. Default Infinity. */
|
|
4048
4209
|
count?: number;
|
|
@@ -4059,15 +4220,20 @@ interface StaggerOptions {
|
|
|
4059
4220
|
* any timer or child is alive. */
|
|
4060
4221
|
cancelKey?: string;
|
|
4061
4222
|
}
|
|
4223
|
+
/** Produces one iteration of a loop. Must arrange for `next` to be called when
|
|
4224
|
+
* the animation it returns finishes, or the loop stalls after one pass. */
|
|
4062
4225
|
type LoopFactory = (iteration: number, next: () => void) => AnimationHandle;
|
|
4063
4226
|
/** Per-index delay schedule. Number ⇒ `index * delay` ms. Function ⇒ caller
|
|
4064
4227
|
* decides the absolute delay for each index (e.g. `i => i * i * 30`). */
|
|
4065
4228
|
type StaggerDelay = number | ((index: number) => number);
|
|
4229
|
+
/** Produces the animation for one staggered item. */
|
|
4066
4230
|
type StaggerFactory<TItem> = (item: TItem, index: number) => AnimationHandle;
|
|
4067
4231
|
/** A `T` value or a function that derives one from the per-item context. Used
|
|
4068
4232
|
* by the fluent builder methods (`.tween`, `.springPose`) so each item can
|
|
4069
4233
|
* vary an option (e.g. `to: (_item, i) => (i + 1) * 10`). */
|
|
4070
4234
|
type StaggerPerItem<T, TItem> = T | ((item: TItem, index: number) => T);
|
|
4235
|
+
/** Options for the stagger builder's `.tween`: a tween per item, where
|
|
4236
|
+
* `from`, `to` and `ms` may each vary by item. */
|
|
4071
4237
|
interface StaggerTweenOptions<T, TItem> {
|
|
4072
4238
|
from: StaggerPerItem<T, TItem>;
|
|
4073
4239
|
to: StaggerPerItem<T, TItem>;
|
|
@@ -4077,6 +4243,8 @@ interface StaggerTweenOptions<T, TItem> {
|
|
|
4077
4243
|
onTick: (value: T, item: TItem, index: number) => void;
|
|
4078
4244
|
onDone?: (item: TItem, index: number) => void;
|
|
4079
4245
|
}
|
|
4246
|
+
/** Options for the stagger builder's `.springPose`: the spring tuning, and
|
|
4247
|
+
* whether each item's settle is recorded as an undoable op. */
|
|
4080
4248
|
interface StaggerSpringPoseOptions<TPose> {
|
|
4081
4249
|
preset?: SpringPresetName;
|
|
4082
4250
|
stiffness?: number;
|
|
@@ -4086,6 +4254,8 @@ interface StaggerSpringPoseOptions<TPose> {
|
|
|
4086
4254
|
recordOp?: boolean;
|
|
4087
4255
|
opLabel?: string;
|
|
4088
4256
|
}
|
|
4257
|
+
/** Fluent form of `Animator.stagger`: pick what to run per item after the
|
|
4258
|
+
* items and the delay schedule are already fixed. */
|
|
4089
4259
|
interface StaggerBuilder<TItem> {
|
|
4090
4260
|
/** Run an arbitrary per-item factory. */
|
|
4091
4261
|
each(factory: StaggerFactory<TItem>): AnimationHandle;
|
|
@@ -4100,6 +4270,8 @@ interface StaggerBuilder<TItem> {
|
|
|
4100
4270
|
id: string;
|
|
4101
4271
|
}, TPose>, poseFn: (item: TItem, index: number) => TPose, opts?: StaggerSpringPoseOptions<TPose>): AnimationHandle;
|
|
4102
4272
|
}
|
|
4273
|
+
/** Options for `Animator.tweenLoop` — a tween's options plus how each
|
|
4274
|
+
* iteration relates to the last. */
|
|
4103
4275
|
interface TweenLoopOptions<T> {
|
|
4104
4276
|
from: T;
|
|
4105
4277
|
to: T;
|
|
@@ -4133,6 +4305,10 @@ interface ReorderAdapter {
|
|
|
4133
4305
|
getChildren(parentId: string | null): string[];
|
|
4134
4306
|
setChildOrder(parentId: string | null, ids: string[]): void;
|
|
4135
4307
|
}
|
|
4308
|
+
/** Everything the interaction layer can ask of a scene, as one type: the
|
|
4309
|
+
* move, resize, rotate, selection, layer and reorder contracts combined.
|
|
4310
|
+
* `<SceneCanvas>` synthesizes one of these, which is why most consumers never
|
|
4311
|
+
* touch an adapter directly. */
|
|
4136
4312
|
type SceneCanvasAdapter<TData, TLayer extends string, TPose> = MoveAdapter<Node$1<TData, TLayer, TPose>, TPose> & ResizeAdapter<Node$1<TData, TLayer, TPose>, TPose> & RotateAdapter<Node$1<TData, TLayer, TPose>, TPose> & AreaSelectAdapter & LassoSelectAdapter & LayerEnumerableAdapter<TLayer> & ReorderAdapter & Partial<InsertAdapter<Node$1<TData, TLayer, TPose>>> & {
|
|
4137
4313
|
getParent(id: string): string | null;
|
|
4138
4314
|
getSelection(): string[];
|
|
@@ -4193,6 +4369,9 @@ interface SceneToAdapterOptions<TData, TLayer extends string, TPose> {
|
|
|
4193
4369
|
* primitive — containers move but their descendants don't follow. */
|
|
4194
4370
|
cascadeContainerPose?: 'rect' | ((pose: TPose, dx: number, dy: number) => TPose);
|
|
4195
4371
|
}
|
|
4372
|
+
/** Derive the adapter for a scene. Reads go straight to the scene; writes are
|
|
4373
|
+
* ops applied through its history, so anything done through the adapter is
|
|
4374
|
+
* undoable. */
|
|
4196
4375
|
declare function sceneToAdapter<TData, TLayer extends string, TPose>(scene: Scene<TData, TLayer, TPose>, options?: SceneToAdapterOptions<TData, TLayer, TPose>): SceneCanvasAdapter<TData, TLayer, TPose>;
|
|
4197
4376
|
/**
|
|
4198
4377
|
* React-hook wrapper around `sceneToAdapter`. Memoizes on `scene`,
|
|
@@ -4213,11 +4392,14 @@ declare function useSceneAdapter<TData, TLayer extends string, TPose>(scene: Sce
|
|
|
4213
4392
|
* Consumers should import from here directly; `rotate.ts` re-exports the
|
|
4214
4393
|
* same symbols for back-compat. */
|
|
4215
4394
|
|
|
4395
|
+
/** Projects a pose to and from a rotated bounding box, so the rotate action
|
|
4396
|
+
* can work on pose shapes that carry rotation differently. */
|
|
4216
4397
|
interface RotateGeometry<TPose> {
|
|
4217
4398
|
getRotatedBounds(pose: TPose): RotatedPose;
|
|
4218
4399
|
/** Write a new rotation back into the pose; bounds stay the same. */
|
|
4219
4400
|
withRotation(pose: TPose, rotation: number): TPose;
|
|
4220
4401
|
}
|
|
4402
|
+
/** Options for the `rotate` action. */
|
|
4221
4403
|
interface UseRotateOptions<TPose> {
|
|
4222
4404
|
/** Behaviors are typed against the pose shape; the kit ships none yet
|
|
4223
4405
|
* (rotation snap behaviors are deferred). For non-rect TPose, behaviors
|
|
@@ -4329,6 +4511,8 @@ interface OpenFilePickerOptions {
|
|
|
4329
4511
|
/** Allow multi-select. Default false. */
|
|
4330
4512
|
multiple?: boolean;
|
|
4331
4513
|
}
|
|
4514
|
+
/** Show the browser's file picker and resolve with what the user chose —
|
|
4515
|
+
* empty when they cancel. Must be called from a user gesture. */
|
|
4332
4516
|
declare function openFilePicker(opts?: OpenFilePickerOptions): Promise<File[]>;
|
|
4333
4517
|
|
|
4334
4518
|
/**
|
|
@@ -4377,6 +4561,9 @@ interface NodeRouting {
|
|
|
4377
4561
|
/** Enumerate registered kinds in registration order. */
|
|
4378
4562
|
list(): readonly NodeRoutingEntry[];
|
|
4379
4563
|
}
|
|
4564
|
+
/** Build a registry of per-node-kind routing entries, which decide how a node
|
|
4565
|
+
* kind is drawn, hit-tested and serialized. Registering a duplicate kind name
|
|
4566
|
+
* throws. */
|
|
4380
4567
|
declare function createNodeRouting(): NodeRouting;
|
|
4381
4568
|
|
|
4382
4569
|
/**
|
|
@@ -4443,6 +4630,9 @@ interface NodePaintCtx {
|
|
|
4443
4630
|
* load-status error variant). */
|
|
4444
4631
|
resolveImage?: (node: Node$1<unknown, string, unknown>) => ImageBitmap | undefined;
|
|
4445
4632
|
}
|
|
4633
|
+
/** A painter for one kind of node: which nodes it claims, and the draw
|
|
4634
|
+
* commands it emits for them. Registering one is how a consumer teaches the
|
|
4635
|
+
* default renderer to draw its own node kinds. */
|
|
4446
4636
|
interface NodeShapeEntry<TData = unknown, TPose = unknown> {
|
|
4447
4637
|
/** Stable identifier — used for unregistration and debugging. Pick
|
|
4448
4638
|
* something descriptive: `'kit:text'`, `'app:image'`, etc. */
|
|
@@ -4487,6 +4677,7 @@ interface NodeInk {
|
|
|
4487
4677
|
/** Stroke width in world units. `0` for no stroke. */
|
|
4488
4678
|
strokeWidth: number;
|
|
4489
4679
|
}
|
|
4680
|
+
/** Options for `registerNodeShape`. */
|
|
4490
4681
|
interface RegisterNodeShapeOptions {
|
|
4491
4682
|
/** `'high'` puts the painter ahead of all normally-registered ones (so
|
|
4492
4683
|
* it can win over a kit built-in). `'normal'` appends at the end. */
|
|
@@ -4596,6 +4787,9 @@ type NodeFill = string | FillStyle;
|
|
|
4596
4787
|
* overlay since their content already shows.
|
|
4597
4788
|
*/
|
|
4598
4789
|
|
|
4790
|
+
/** Paint one node the way the kit does by default: dispatch to the first
|
|
4791
|
+
* registered node-shape painter that matches, then draw its `data.label` on
|
|
4792
|
+
* top when it has one. Consumers replace or wrap this via `drawOne`. */
|
|
4599
4793
|
declare function defaultDrawOne<TData, TLayer extends string, TPose>(node: Node$1<TData, TLayer, TPose>, pose: TPose, ctx?: NodePaintCtx): DrawCommand[];
|
|
4600
4794
|
|
|
4601
4795
|
/** Default size in CSS pixels for selection corner-handles AND their
|
|
@@ -4625,6 +4819,9 @@ interface SceneCanvasHit {
|
|
|
4625
4819
|
id: string;
|
|
4626
4820
|
kind: string;
|
|
4627
4821
|
}
|
|
4822
|
+
/** Props for `<SceneCanvas>`. Most are optional: a scene is the only thing it
|
|
4823
|
+
* truly needs, and everything else — tools, layers, selection handling,
|
|
4824
|
+
* layouts, animation — layers onto sensible defaults. */
|
|
4628
4825
|
type SceneCanvasProps<TData, TLayer extends string, TPose> = Omit<CanvasProps<Node$1<TData, TLayer, TPose>, TPose>, 'adapter' | 'moveOptions' | 'resizeOptions' | 'rotateOptions' | 'snap' | 'pickEvery' | 'boundsOf' | 'handleHitRadius' | 'selection' | 'selectionOptions' | 'tools' | 'geometry' | 'layers' | 'onBackgroundClick' | 'getIsVisible'> & {
|
|
4629
4826
|
/** A `Scene` (typically from `useScene`) — or a `SerializedScene`
|
|
4630
4827
|
* JSON object, which SceneCanvas bakes into a Scene internally on
|
|
@@ -5105,10 +5302,24 @@ type SceneCanvasProps<TData, TLayer extends string, TPose> = Omit<CanvasProps<No
|
|
|
5105
5302
|
onDoubleClick?: (hit: SceneCanvasHit | null) => void;
|
|
5106
5303
|
};
|
|
5107
5304
|
declare function SceneCanvasInner<TData, TLayer extends string, TPose>(props: SceneCanvasProps<TData, TLayer, TPose>, ref: React__default.ForwardedRef<SceneCanvasApi>): react_jsx_runtime.JSX.Element;
|
|
5305
|
+
/**
|
|
5306
|
+
* The canvas component: renders a `Scene` and wires the interaction stack
|
|
5307
|
+
* around it.
|
|
5308
|
+
*
|
|
5309
|
+
* Mounting one gives you the whole default kit — an adapter synthesized from
|
|
5310
|
+
* the scene, the built-in tools and actions, selection, undo, and the gesture
|
|
5311
|
+
* dispatcher — with each piece replaceable through props. This is the intended
|
|
5312
|
+
* entry point; the lower-level primitives it composes are not part of the
|
|
5313
|
+
* public surface.
|
|
5314
|
+
*
|
|
5315
|
+
* Its ref exposes a `SceneCanvasApi` for the imperative operations that do not
|
|
5316
|
+
* fit a prop (view control, hit queries, redraw requests).
|
|
5317
|
+
*/
|
|
5108
5318
|
declare const SceneCanvas: <TData, TLayer extends string, TPose>(props: SceneCanvasProps<TData, TLayer, TPose> & {
|
|
5109
5319
|
ref?: React__default.Ref<SceneCanvasApi>;
|
|
5110
5320
|
}) => ReturnType<typeof SceneCanvasInner>;
|
|
5111
5321
|
|
|
5322
|
+
/** Props for `<CursorCoordsHud>`. */
|
|
5112
5323
|
interface CursorCoordsHudProps {
|
|
5113
5324
|
canvasRef: React.RefObject<HTMLCanvasElement | null>;
|
|
5114
5325
|
viewRef: React.RefObject<View>;
|
|
@@ -5118,8 +5329,11 @@ interface CursorCoordsHudProps {
|
|
|
5118
5329
|
right?: number;
|
|
5119
5330
|
};
|
|
5120
5331
|
}
|
|
5332
|
+
/** Debug overlay showing the pointer's client and world coordinates and the
|
|
5333
|
+
* current frame rate, pinned to the canvas's top-right corner. */
|
|
5121
5334
|
declare function CursorCoordsHud({ canvasRef, viewRef, offset }: CursorCoordsHudProps): react_jsx_runtime.JSX.Element | null;
|
|
5122
5335
|
|
|
5336
|
+
/** Props for `<PickHud>`. */
|
|
5123
5337
|
interface PickHudProps {
|
|
5124
5338
|
canvasRef: React.RefObject<HTMLCanvasElement | null>;
|
|
5125
5339
|
viewRef: React.RefObject<View>;
|
|
@@ -5135,6 +5349,8 @@ interface PickHudProps {
|
|
|
5135
5349
|
right?: number;
|
|
5136
5350
|
};
|
|
5137
5351
|
}
|
|
5352
|
+
/** Debug overlay listing every node under the pointer, with the one a click
|
|
5353
|
+
* would actually select shown in bold. */
|
|
5138
5354
|
declare function PickHud({ canvasRef, viewRef, pickEvery, pickBest, offset }: PickHudProps): react_jsx_runtime.JSX.Element | null;
|
|
5139
5355
|
|
|
5140
5356
|
/**
|
|
@@ -5161,6 +5377,8 @@ interface ImageNodeData {
|
|
|
5161
5377
|
opacity?: number;
|
|
5162
5378
|
};
|
|
5163
5379
|
}
|
|
5380
|
+
/** Where an image is in its load: never requested, in flight, decoded, or
|
|
5381
|
+
* failed. Renderers paint a placeholder for anything but `'ready'`. */
|
|
5164
5382
|
type ImageStatus = 'idle' | 'loading' | 'ready' | 'error';
|
|
5165
5383
|
/** Synchronous read. Returns the decoded bitmap when ready; otherwise returns
|
|
5166
5384
|
* `undefined` and lazily starts a de-duped async load for `src`. */
|
|
@@ -5256,6 +5474,9 @@ interface NodeProperties {
|
|
|
5256
5474
|
/** Enumerate registered kinds in registration order. */
|
|
5257
5475
|
list(): readonly NodePropertiesEntry[];
|
|
5258
5476
|
}
|
|
5477
|
+
/** Build a registry of per-node-kind property descriptors, which schema-driven
|
|
5478
|
+
* property panels read to know what a node exposes. Registering a duplicate
|
|
5479
|
+
* kind name throws. */
|
|
5259
5480
|
declare function createNodeProperties(): NodeProperties;
|
|
5260
5481
|
|
|
5261
5482
|
/** Radians-stored / degrees-shown conversion for `pose.rotation` leaves.
|
|
@@ -5307,6 +5528,8 @@ declare const inferredNodeProperties: readonly NodePropertiesEntry[];
|
|
|
5307
5528
|
* group level (see `renderSceneToCanvas`'s implementation).
|
|
5308
5529
|
*/
|
|
5309
5530
|
type SceneViewDrawOne<TData, TLayer extends string, TPose> = (node: Node$1<TData, TLayer, TPose>, pose: TPose, view: View) => DrawCommand[];
|
|
5531
|
+
/** What to draw into an existing canvas: the scene, the view, and the same
|
|
5532
|
+
* painting hooks `<SceneCanvas>` takes. */
|
|
5310
5533
|
interface RenderSceneToCanvasArgs<TData, TLayer extends string, TPose> {
|
|
5311
5534
|
/** The DOM canvas to paint into. The helper owns its WebGL2 context: the
|
|
5312
5535
|
* first call on a given canvas creates a renderer and stashes it; subsequent
|
|
@@ -5379,6 +5602,7 @@ declare function buildSceneViewCommands<TData, TLayer extends string, TPose>(sce
|
|
|
5379
5602
|
*/
|
|
5380
5603
|
declare function renderSceneToCanvas<TData, TLayer extends string, TPose>(args: RenderSceneToCanvasArgs<TData, TLayer, TPose>): void;
|
|
5381
5604
|
|
|
5605
|
+
/** Props for `<SceneViewCanvas>`. */
|
|
5382
5606
|
interface SceneViewCanvasProps<TData, TLayer extends string, TPose> {
|
|
5383
5607
|
/** Scene to render. Must be the same `Scene` instance passed to whoever
|
|
5384
5608
|
* is mutating it; the component subscribes to its version stream and
|
|
@@ -5423,6 +5647,9 @@ declare function SceneViewCanvasInner<TData, TLayer extends string, TPose>(props
|
|
|
5423
5647
|
*/
|
|
5424
5648
|
declare const SceneViewCanvas: typeof SceneViewCanvasInner;
|
|
5425
5649
|
|
|
5650
|
+
/** Build a scene outside React. `useScene` is the usual entry point; reach for
|
|
5651
|
+
* this in tests, in headless rendering, or wherever a scene must outlive a
|
|
5652
|
+
* component. Throws if no system layers are declared. */
|
|
5426
5653
|
declare function createScene<TData, TLayer extends string, TPose = RectPose>(options: UseSceneOptions<TData, TLayer, TPose>): Scene<TData, TLayer, TPose>;
|
|
5427
5654
|
/** Reconstruct a Scene from a JSON snapshot produced by `scene.toJSON()`.
|
|
5428
5655
|
* Function fields (e.g., `clipFromPose`) are resolved by string key via the
|
|
@@ -5466,6 +5693,8 @@ type DefaultLayer = typeof DEFAULT_LAYER;
|
|
|
5466
5693
|
declare function useScene<TItem extends {
|
|
5467
5694
|
id: string;
|
|
5468
5695
|
}>(options: UseSceneTrivialOptions<TItem>): Scene<TItem, DefaultLayer, TItem>;
|
|
5696
|
+
/** The full call shape: explicit layers, initial nodes, custom ops, and
|
|
5697
|
+
* history configuration. */
|
|
5469
5698
|
declare function useScene<TData, TLayer extends string, TPose = RectPose>(options: UseSceneOptions<TData, TLayer, TPose>): Scene<TData, TLayer, TPose>;
|
|
5470
5699
|
|
|
5471
5700
|
/**
|
|
@@ -5545,6 +5774,7 @@ declare function computeFitView<TData, TLayer extends string, TPose>(scene: Scen
|
|
|
5545
5774
|
*/
|
|
5546
5775
|
declare function computeIndicatorCommand(mainView: View, mainViewDims: ViewportDims, style?: IndicatorStyle): PathDrawCommand;
|
|
5547
5776
|
|
|
5777
|
+
/** Props for `<MinimapCanvas>`. */
|
|
5548
5778
|
interface MinimapCanvasProps<TData, TLayer extends string, TPose> {
|
|
5549
5779
|
/** Same scene the main canvas is rendering. */
|
|
5550
5780
|
scene: Scene<TData, TLayer, TPose>;
|
|
@@ -5612,6 +5842,7 @@ interface HeadlessCanvasLike {
|
|
|
5612
5842
|
height: number;
|
|
5613
5843
|
getContext(contextId: 'webgl2', options?: WebGLContextAttributes): unknown;
|
|
5614
5844
|
}
|
|
5845
|
+
/** What to render, at what resolution, and with which quality settings. */
|
|
5615
5846
|
interface RenderSceneToPixelsArgs<TData, TLayer extends string, TPose> {
|
|
5616
5847
|
scene: Scene<TData, TLayer, TPose>;
|
|
5617
5848
|
/** Scene-space rect to render (origin + size in scene units). Output pixel
|
|
@@ -5655,6 +5886,8 @@ interface RenderSceneToPixelsArgs<TData, TLayer extends string, TPose> {
|
|
|
5655
5886
|
* `flattenTolerance`. Explicitly passing 0.25 is always valid. */
|
|
5656
5887
|
flattenTolerancePx?: number;
|
|
5657
5888
|
}
|
|
5889
|
+
/** The result of planning a headless render: how big the output is, the view
|
|
5890
|
+
* that maps the source rect onto it, and the commands to draw. */
|
|
5658
5891
|
interface PixelRenderPlan {
|
|
5659
5892
|
width: number;
|
|
5660
5893
|
height: number;
|
|
@@ -5665,6 +5898,15 @@ interface PixelRenderPlan {
|
|
|
5665
5898
|
* anisotropic `View`, and the full command list (background + view-wrapped
|
|
5666
5899
|
* scene). Exported for tests and for callers targeting their own renderer. */
|
|
5667
5900
|
declare function planPixelRender<TData, TLayer extends string, TPose>(args: Omit<RenderSceneToPixelsArgs<TData, TLayer, TPose>, 'gl' | 'createCanvas' | 'flattenTolerancePx'>): PixelRenderPlan;
|
|
5901
|
+
/**
|
|
5902
|
+
* Render part of a scene to raw pixels, with no canvas mounted and no React
|
|
5903
|
+
* involved — for export, thumbnails, print, and pixel-diff tests.
|
|
5904
|
+
*
|
|
5905
|
+
* Output size follows from the source rect and the requested scale, so
|
|
5906
|
+
* rendering the same region at a higher scale is a real resolution increase
|
|
5907
|
+
* rather than an upscale: curves are re-flattened and glyphs re-rasterized for
|
|
5908
|
+
* the output resolution.
|
|
5909
|
+
*/
|
|
5668
5910
|
declare function renderSceneToPixels<TData, TLayer extends string, TPose>(args: RenderSceneToPixelsArgs<TData, TLayer, TPose>): RasterImage;
|
|
5669
5911
|
|
|
5670
5912
|
/**
|
|
@@ -5741,22 +5983,36 @@ declare function SelectionContextProviderIfRoot({ children, }: {
|
|
|
5741
5983
|
*/
|
|
5742
5984
|
declare function usePublishSelection(ids: readonly NodeId[], kinds?: readonly (string | undefined)[]): void;
|
|
5743
5985
|
|
|
5986
|
+
/** Mount a `<PointerContextProvider>` only when none is already in scope. */
|
|
5744
5987
|
declare function PointerProviderIfRoot({ children }: {
|
|
5745
5988
|
children: ReactNode;
|
|
5746
5989
|
}): react_jsx_runtime.JSX.Element;
|
|
5747
5990
|
|
|
5991
|
+
/** Mount an `<ActionsProvider>` only when none is already in scope, so
|
|
5992
|
+
* nesting canvases share one action registry instead of shadowing it. */
|
|
5748
5993
|
declare function ActionsProviderIfRoot({ children }: {
|
|
5749
5994
|
children: ReactNode;
|
|
5750
5995
|
}): react_jsx_runtime.JSX.Element;
|
|
5751
5996
|
|
|
5997
|
+
/** Mount a `<DepRegistryProvider>` only when none is already in scope, so a
|
|
5998
|
+
* consumer's dep sources are not shadowed by a nested canvas. */
|
|
5752
5999
|
declare function DepRegistryProviderIfRoot({ children }: {
|
|
5753
6000
|
children: ReactNode;
|
|
5754
6001
|
}): react_jsx_runtime.JSX.Element;
|
|
5755
6002
|
|
|
6003
|
+
/**
|
|
6004
|
+
* Mounts every kit-wide provider at once — deps, actions, active tool,
|
|
6005
|
+
* selection and pointer — each only if one is not already in scope.
|
|
6006
|
+
*
|
|
6007
|
+
* `<SceneCanvas>` does this for itself, so this is for the case where kit
|
|
6008
|
+
* state has to be shared by things outside a canvas: a toolbar, a property
|
|
6009
|
+
* panel, or two canvases that should agree on the selection.
|
|
6010
|
+
*/
|
|
5756
6011
|
declare function WeaselProvider({ children }: {
|
|
5757
6012
|
children: ReactNode;
|
|
5758
6013
|
}): react_jsx_runtime.JSX.Element;
|
|
5759
6014
|
|
|
6015
|
+
/** Options for `useCanvasFocus`. */
|
|
5760
6016
|
interface UseCanvasFocusOptions {
|
|
5761
6017
|
/** Initial focus state. Default `false` — handles hidden until first click. */
|
|
5762
6018
|
initial?: boolean;
|
|
@@ -5764,6 +6020,8 @@ interface UseCanvasFocusOptions {
|
|
|
5764
6020
|
* document tab order). Set to `-1` for programmatic-only focus. */
|
|
5765
6021
|
tabIndex?: number;
|
|
5766
6022
|
}
|
|
6023
|
+
/** What `useCanvasFocus` hands back: the focus state, the props that
|
|
6024
|
+
* maintain it, and a getter for reading it from per-frame code. */
|
|
5767
6025
|
interface CanvasFocusReturn {
|
|
5768
6026
|
/** Live boolean — true when the element has DOM focus. Triggers re-renders
|
|
5769
6027
|
* when the focus state changes (set via React state). */
|
|
@@ -5783,6 +6041,8 @@ interface CanvasFocusReturn {
|
|
|
5783
6041
|
/** Imperative focus / blur. Useful for tests and programmatic control. */
|
|
5784
6042
|
setFocused: (next: boolean) => void;
|
|
5785
6043
|
}
|
|
6044
|
+
/** Track DOM focus on the canvas, so chrome that should only show while the
|
|
6045
|
+
* canvas is focused can be gated on it. */
|
|
5786
6046
|
declare function useCanvasFocus(options?: UseCanvasFocusOptions): CanvasFocusReturn;
|
|
5787
6047
|
|
|
5788
6048
|
/**
|
|
@@ -5796,6 +6056,7 @@ declare function useCanvasFocus(options?: UseCanvasFocusOptions): CanvasFocusRet
|
|
|
5796
6056
|
* construction time.
|
|
5797
6057
|
*/
|
|
5798
6058
|
|
|
6059
|
+
/** Options for `gateLayer`. */
|
|
5799
6060
|
interface GateLayerOptions<TData> {
|
|
5800
6061
|
/** The wrapped layer. Its `id`, `label`, `defaultVisible`, `alwaysOn`,
|
|
5801
6062
|
* `space` flow through unchanged. */
|
|
@@ -5803,6 +6064,9 @@ interface GateLayerOptions<TData> {
|
|
|
5803
6064
|
/** Returns `true` to render the layer this frame, `false` to skip. */
|
|
5804
6065
|
visible: () => boolean;
|
|
5805
6066
|
}
|
|
6067
|
+
/** Wrap a render layer so it only draws while `visible()` is true. The
|
|
6068
|
+
* predicate is consulted per frame, which is how chrome follows canvas focus
|
|
6069
|
+
* without the layer knowing anything about focus. */
|
|
5806
6070
|
declare function gateLayer<TData>(opts: GateLayerOptions<TData>): RenderLayer<TData>;
|
|
5807
6071
|
|
|
5808
6072
|
/**
|
|
@@ -5928,6 +6192,8 @@ declare function annulusSemiAxes(shape: Extract<AffordanceRegion['shape'], {
|
|
|
5928
6192
|
ry: number;
|
|
5929
6193
|
};
|
|
5930
6194
|
|
|
6195
|
+
/** Options for `createCornerResizeAffordance` — the size and appearance of
|
|
6196
|
+
* the corner handles. */
|
|
5931
6197
|
interface CornerResizeAffordanceOptions {
|
|
5932
6198
|
/** Hit radius (screen-px) for the corner handles. Default 8. */
|
|
5933
6199
|
handleHitRadius?: number;
|
|
@@ -5936,6 +6202,8 @@ interface CornerResizeAffordanceOptions {
|
|
|
5936
6202
|
fill?: string;
|
|
5937
6203
|
stroke?: string;
|
|
5938
6204
|
}
|
|
6205
|
+
/** What a corner-resize hit hands to the resize action: which corner stays
|
|
6206
|
+
* put, what is being resized, and the world-space pivot to scale from. */
|
|
5939
6207
|
interface CornerResizeScratch extends CommonAffordanceScratch {
|
|
5940
6208
|
/** Resize anchor identifying the OPPOSITE corner (the one that stays
|
|
5941
6209
|
* fixed). Matches the kit's existing ResizeAnchor convention. */
|
|
@@ -5963,6 +6231,8 @@ interface CornerResizeScratch extends CommonAffordanceScratch {
|
|
|
5963
6231
|
*/
|
|
5964
6232
|
declare function createCornerResizeAffordance(opts?: CornerResizeAffordanceOptions): Affordance;
|
|
5965
6233
|
|
|
6234
|
+
/** Options for `createRotationAffordance` — how thick the rotate band is
|
|
6235
|
+
* outside the selection, and how (or whether) it is painted. */
|
|
5966
6236
|
interface RotationAffordanceOptions {
|
|
5967
6237
|
/** Minimum screen-space thickness of the rotate-zone band outside the
|
|
5968
6238
|
* selection AABB. The outer ellipse semi-axes are clamped to
|
|
@@ -5982,6 +6252,8 @@ interface RotationAffordanceOptions {
|
|
|
5982
6252
|
/** Cursor while hovering the ring. Defaults to `'grab'`. */
|
|
5983
6253
|
cursor?: string;
|
|
5984
6254
|
}
|
|
6255
|
+
/** What a rotation-handle hit hands to the rotate action: what is being
|
|
6256
|
+
* rotated, and the world-space pivot it turns around. */
|
|
5985
6257
|
interface RotationScratch extends CommonAffordanceScratch {
|
|
5986
6258
|
/** Id of the rotation target — single selection id, or
|
|
5987
6259
|
* `MULTI_RESIZE_TARGET_ID` for multi-selection. */
|
|
@@ -6036,12 +6308,16 @@ interface AnchorState {
|
|
|
6036
6308
|
/** Current editable path for a node id. Non-polygon values are ignored. */
|
|
6037
6309
|
getPose(id: string): unknown;
|
|
6038
6310
|
}
|
|
6311
|
+
/** Options for the path-anchor affordances. */
|
|
6039
6312
|
interface PathAnchorAffordanceOptions {
|
|
6040
6313
|
/** Hit radius (screen-px) for anchor and control points. Default 8. */
|
|
6041
6314
|
hitRadius?: number;
|
|
6042
6315
|
/** Cursor while hovering an anchor or control. Defaults to `'pointer'`. */
|
|
6043
6316
|
cursor?: string;
|
|
6044
6317
|
}
|
|
6318
|
+
/** What an anchor hit hands to the action that follows: which path, which
|
|
6319
|
+
* anchor, and whether the grab was on the anchor itself or one of its two
|
|
6320
|
+
* control points. */
|
|
6045
6321
|
interface AnchorScratch extends CommonAffordanceScratch {
|
|
6046
6322
|
/** Node id of the path the anchor belongs to. */
|
|
6047
6323
|
targetId: string;
|
|
@@ -6167,6 +6443,7 @@ interface MeasuredText {
|
|
|
6167
6443
|
/** Greedy word-wrap text measurement against `maxWidth`; preserves explicit `\n` breaks. */
|
|
6168
6444
|
declare function measureText(ctx: CanvasRenderingContext2D, text: string, maxWidth: number, style: ResolvedTextStyle): MeasuredText;
|
|
6169
6445
|
|
|
6446
|
+
/** Options for `measureTextBounds`. */
|
|
6170
6447
|
interface MeasureTextBoundsOpts {
|
|
6171
6448
|
/** Wrap width; words exceeding it start a new line. Default `Infinity` (no wrap). */
|
|
6172
6449
|
maxWidth?: number;
|
|
@@ -6277,10 +6554,12 @@ declare function caretIndexAt(ctx: CanvasRenderingContext2D, x: number, y: numbe
|
|
|
6277
6554
|
* closing edge from `polygon[N-1]` to `polygon[0]` is implicit. Even-odd
|
|
6278
6555
|
* fill rule (matches `pointInPath`).
|
|
6279
6556
|
*/
|
|
6557
|
+
/** A 2D point or vector. */
|
|
6280
6558
|
interface Vec2 {
|
|
6281
6559
|
x: number;
|
|
6282
6560
|
y: number;
|
|
6283
6561
|
}
|
|
6562
|
+
/** An axis-aligned rectangle. */
|
|
6284
6563
|
interface Rect {
|
|
6285
6564
|
x: number;
|
|
6286
6565
|
y: number;
|
|
@@ -6376,6 +6655,8 @@ declare function fitTextPose(ctx: CanvasRenderingContext2D, pose: TextPose, opts
|
|
|
6376
6655
|
* `isMixed` check, regardless of what's being aggregated.
|
|
6377
6656
|
*/
|
|
6378
6657
|
declare const MIXED: unique symbol;
|
|
6658
|
+
/** The type of {@link MIXED}. Property panels use it to say "the selection
|
|
6659
|
+
* does not agree on this value" without colliding with any real value. */
|
|
6379
6660
|
type Mixed = typeof MIXED;
|
|
6380
6661
|
|
|
6381
6662
|
/**
|
|
@@ -6701,6 +6982,8 @@ interface UseSceneTextEditReturn extends UseTextEditReturn {
|
|
|
6701
6982
|
* a caret offset via `caretIndexAt`, and starts edit on that node. */
|
|
6702
6983
|
onDoubleClick: (e: MouseEvent$1<HTMLElement>) => void;
|
|
6703
6984
|
}
|
|
6985
|
+
/** Wire double-click-to-edit text on a scene: mounts a DOM editing overlay
|
|
6986
|
+
* over the node being edited and writes the result back as an undoable op. */
|
|
6704
6987
|
declare function useSceneTextEdit<TData extends DefaultTextData, TLayer extends string, TPose extends RectPose = RectPose>(scene: Scene<TData, TLayer, TPose>, container: HTMLElement | null, options?: UseSceneTextEditOptions<TData>): UseSceneTextEditReturn;
|
|
6705
6988
|
|
|
6706
6989
|
/**
|
|
@@ -6727,6 +7010,8 @@ declare function useSceneTextEdit<TData extends DefaultTextData, TLayer extends
|
|
|
6727
7010
|
|
|
6728
7011
|
/** The additive run flags. */
|
|
6729
7012
|
type FlagKey = 'bold' | 'italic' | 'underline' | 'strikethrough';
|
|
7013
|
+
/** The result of toggling a style flag over a text range: the rewritten runs
|
|
7014
|
+
* and node style, and whether the change could be made at all. */
|
|
6730
7015
|
interface SetFlagResult {
|
|
6731
7016
|
runs: StyledRun[];
|
|
6732
7017
|
style: TextStyle;
|
|
@@ -6763,6 +7048,9 @@ declare function setFlagOverRange(runs: readonly StyledRun[], style: TextStyle,
|
|
|
6763
7048
|
* silently different result.
|
|
6764
7049
|
*/
|
|
6765
7050
|
|
|
7051
|
+
/** Build a draw command for a single unstyled string. Text is laid out with
|
|
7052
|
+
* the registered font's metrics, wrapped at `maxWidth` and aligned within
|
|
7053
|
+
* `height` when both are given. */
|
|
6766
7054
|
declare function textCommand(x: number, y: number, text: string, style?: TextStyle, maxWidth?: number, height?: number, verticalAlign?: TextVerticalAlign): DrawCommand;
|
|
6767
7055
|
|
|
6768
7056
|
/**
|
|
@@ -6932,6 +7220,8 @@ declare function gradientForBounds(kind: GradientKind, bounds: {
|
|
|
6932
7220
|
* the renderer in one frame.
|
|
6933
7221
|
*/
|
|
6934
7222
|
|
|
7223
|
+
/** The box a `'bounds'` gradient's normalized geometry is mapped onto —
|
|
7224
|
+
* usually a node's bounds. */
|
|
6935
7225
|
interface FillPoseBox {
|
|
6936
7226
|
x: number;
|
|
6937
7227
|
y: number;
|
|
@@ -7142,6 +7432,9 @@ interface MoveToIndexArgs {
|
|
|
7142
7432
|
/** Op: move all `ids` to a contiguous block starting at `index` within `parentId`'s child order. */
|
|
7143
7433
|
declare function createMoveToIndexOp(args: MoveToIndexArgs): Op;
|
|
7144
7434
|
|
|
7435
|
+
/** The geometry fields a `setPath` op replaces together — the path itself,
|
|
7436
|
+
* whether it is closed, and the parameters it was generated from. They move
|
|
7437
|
+
* as one so a parametric shape and its baked path never disagree. */
|
|
7145
7438
|
interface SetPathFields {
|
|
7146
7439
|
path: unknown;
|
|
7147
7440
|
closed: boolean;
|
|
@@ -7187,6 +7480,7 @@ interface HitAdapter<TNode extends {
|
|
|
7187
7480
|
getPose: (id: string) => TPose;
|
|
7188
7481
|
getParent: (id: string) => string | null;
|
|
7189
7482
|
}
|
|
7483
|
+
/** Options for `nestedHitTester`. */
|
|
7190
7484
|
interface NestedHitOpts<TNode extends {
|
|
7191
7485
|
id: string;
|
|
7192
7486
|
}, TPose> {
|
|
@@ -7203,6 +7497,8 @@ interface NestedHitOpts<TNode extends {
|
|
|
7203
7497
|
* never (treat every object as hittable). */
|
|
7204
7498
|
isGroup?: (id: string, obj: TNode | undefined) => boolean;
|
|
7205
7499
|
}
|
|
7500
|
+
/** Hit-test entry points for a nested scene: one that always picks the
|
|
7501
|
+
* outermost ancestor, and one that steps deeper on alt-click. */
|
|
7206
7502
|
interface NestedHitTester {
|
|
7207
7503
|
/** Outermost-ancestor pick. Suitable as the chrome-level `pickEvery`: a
|
|
7208
7504
|
* casual click selects the whole top-level ancestor. Returns `null` on
|
|
@@ -7216,6 +7512,9 @@ interface NestedHitTester {
|
|
|
7216
7512
|
* Plug into `useSelectTool({ pickBest })`. */
|
|
7217
7513
|
pickBest: (worldX: number, worldY: number, alt: boolean, selection: readonly string[]) => string | null;
|
|
7218
7514
|
}
|
|
7515
|
+
/** Build hit-testers that respect containers: a plain click selects the
|
|
7516
|
+
* top-level ancestor, and alt-clicking descends one level at a time toward
|
|
7517
|
+
* the leaf actually under the pointer. */
|
|
7219
7518
|
declare function nestedHitTester<TNode extends {
|
|
7220
7519
|
id: string;
|
|
7221
7520
|
}, TPose>(adapter: HitAdapter<TNode, TPose>, opts: NestedHitOpts<TNode, TPose>): NestedHitTester;
|
|
@@ -7332,6 +7631,9 @@ declare function boundsOfPath(path: Path): RectPath;
|
|
|
7332
7631
|
* uses it to validate the array length in dev builds.
|
|
7333
7632
|
*/
|
|
7334
7633
|
|
|
7634
|
+
/** One anchor of an editable path: its on-curve point plus the two control
|
|
7635
|
+
* handles that shape the segments either side of it. Handles are in the same
|
|
7636
|
+
* space as the point, and absent when the adjoining segment is straight. */
|
|
7335
7637
|
interface PenAnchor {
|
|
7336
7638
|
x: number;
|
|
7337
7639
|
y: number;
|
|
@@ -7357,6 +7659,8 @@ declare function pathToAnchors(path: PolygonPath): {
|
|
|
7357
7659
|
anchors: PenAnchor[][];
|
|
7358
7660
|
closed: boolean[];
|
|
7359
7661
|
};
|
|
7662
|
+
/** How many anchors a path has. Matches the per-anchor arrays the renderer
|
|
7663
|
+
* expects for `vertexColors`. */
|
|
7360
7664
|
declare function countPathAnchors(path: Path): number;
|
|
7361
7665
|
|
|
7362
7666
|
interface Point {
|
|
@@ -7670,6 +7974,10 @@ declare function flattenQuadratic(x0: number, y0: number, x1: number, y1: number
|
|
|
7670
7974
|
* front.
|
|
7671
7975
|
*/
|
|
7672
7976
|
declare function flattenCubicWithArcLen(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, tolerance: number, out: number[], arcOut: number[]): number;
|
|
7977
|
+
/** Flatten a quadratic bezier into line segments within `tolerance`, appending
|
|
7978
|
+
* points to `out` and their cumulative arc lengths to `arcOut`. The arc
|
|
7979
|
+
* lengths are what lets per-anchor color and dash phase be interpolated
|
|
7980
|
+
* evenly along the curve rather than per segment. */
|
|
7673
7981
|
declare function flattenQuadraticWithArcLen(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, tolerance: number, out: number[], arcOut: number[]): number;
|
|
7674
7982
|
|
|
7675
7983
|
/**
|
|
@@ -7734,8 +8042,11 @@ declare function decomposePath(parent: Path, world: Path): Path;
|
|
|
7734
8042
|
* one subpath is also returned as a single-element array — a trivial pass.
|
|
7735
8043
|
*/
|
|
7736
8044
|
|
|
8045
|
+
/** Split a path into one path per subpath, cutting at each `M`. A path with a
|
|
8046
|
+
* single subpath comes back as a one-element array. */
|
|
7737
8047
|
declare function splitSubpaths(path: PolygonPath): PolygonPath[];
|
|
7738
8048
|
|
|
8049
|
+
/** Options for `splitByLine`. */
|
|
7739
8050
|
interface SplitByLineOptions {
|
|
7740
8051
|
/** Polyline flattening tolerance for the boundary-crossing gate. */
|
|
7741
8052
|
flattenTolerance?: number;
|
|
@@ -7795,6 +8106,7 @@ declare const pathOriginProjection: OriginProjection<Path>;
|
|
|
7795
8106
|
* argument.
|
|
7796
8107
|
*/
|
|
7797
8108
|
|
|
8109
|
+
/** Appearance of the pen tool's in-progress path. */
|
|
7798
8110
|
interface PenPreviewStyle {
|
|
7799
8111
|
anchorFill?: string;
|
|
7800
8112
|
anchorStroke?: string;
|
|
@@ -7803,12 +8115,16 @@ interface PenPreviewStyle {
|
|
|
7803
8115
|
closeHintFill?: string;
|
|
7804
8116
|
finishedSubpathStroke?: string;
|
|
7805
8117
|
}
|
|
8118
|
+
/** Options for `createPenPreviewLayer`. */
|
|
7806
8119
|
interface CreatePenPreviewLayerOptions {
|
|
7807
8120
|
/** The Tool returned by usePenTool. The layer reads its scratch via
|
|
7808
8121
|
* `tool.initScratch()` (the hook is contracted to return a stable ref). */
|
|
7809
8122
|
penTool: Tool<PenScratch>;
|
|
7810
8123
|
style?: PenPreviewStyle;
|
|
7811
8124
|
}
|
|
8125
|
+
/** Render layer that draws the pen tool's path as it is being placed —
|
|
8126
|
+
* committed anchors, the rubber band to the cursor, and the close hint. Draws
|
|
8127
|
+
* nothing when the pen is idle. */
|
|
7812
8128
|
declare function createPenPreviewLayer(opts: CreatePenPreviewLayerOptions): RenderLayer<unknown>;
|
|
7813
8129
|
|
|
7814
8130
|
/**
|
|
@@ -7833,6 +8149,8 @@ declare function createPenPreviewLayer(opts: CreatePenPreviewLayerOptions): Rend
|
|
|
7833
8149
|
* stay constant regardless of zoom.
|
|
7834
8150
|
*/
|
|
7835
8151
|
|
|
8152
|
+
/** Options for `createPathEditingOverlayLayer`. Everything is read per frame,
|
|
8153
|
+
* so the layer follows a changing edit target without being rebuilt. */
|
|
7836
8154
|
interface CreatePathEditingOverlayLayerOptions {
|
|
7837
8155
|
/** Returns the id of the polygon currently in anchor-edit mode, or null
|
|
7838
8156
|
* when no node is being edited. Read each frame so live selection /
|
|
@@ -7863,6 +8181,7 @@ interface CreatePathEditingOverlayLayerOptions {
|
|
|
7863
8181
|
/** Optional styling overrides. */
|
|
7864
8182
|
style?: PathEditingOverlayStyle;
|
|
7865
8183
|
}
|
|
8184
|
+
/** Appearance of the anchor and handle markers. */
|
|
7866
8185
|
interface PathEditingOverlayStyle {
|
|
7867
8186
|
anchorSizePx?: number;
|
|
7868
8187
|
handleDotRadiusPx?: number;
|
|
@@ -7882,6 +8201,9 @@ interface PathEditingOverlayStyle {
|
|
|
7882
8201
|
/** Fill of the marquee rubber band. */
|
|
7883
8202
|
marqueeFill?: string;
|
|
7884
8203
|
}
|
|
8204
|
+
/** Render layer that draws the anchors and control handles of the path
|
|
8205
|
+
* currently being anchor-edited. Draws nothing when no path is being
|
|
8206
|
+
* edited. */
|
|
7885
8207
|
declare function createPathEditingOverlayLayer(opts: CreatePathEditingOverlayLayerOptions): RenderLayer<unknown>;
|
|
7886
8208
|
|
|
7887
8209
|
/** Union of N paths. Commutative. Returns an empty path if all inputs are empty. */
|
|
@@ -7945,6 +8267,7 @@ interface SharedAnchor {
|
|
|
7945
8267
|
/** Spiro continuity class at this anchor. Default 'g2-smooth'. */
|
|
7946
8268
|
spiroType?: 'corner' | 'g2-smooth' | 'g4-smooth';
|
|
7947
8269
|
}
|
|
8270
|
+
/** Which curve representation an anchor set is interpreted through. */
|
|
7948
8271
|
type CurveRepKind = 'bezierCubic' | 'bezierQuadratic' | 'nurbs' | 'spiro';
|
|
7949
8272
|
/** A user-facing control surfaced by a representation. Rendered uniformly
|
|
7950
8273
|
* by the demo's panel sidebar. */
|
|
@@ -7987,14 +8310,19 @@ interface CurveRepresentation {
|
|
|
7987
8310
|
discriminators(anchors: SharedAnchor[]): Discriminator[];
|
|
7988
8311
|
}
|
|
7989
8312
|
|
|
8313
|
+
/** Cubic bezier: each segment takes two control handles. The familiar pen-tool curve, and what SVG path data stores natively. */
|
|
7990
8314
|
declare const bezierCubic: CurveRepresentation;
|
|
7991
8315
|
|
|
8316
|
+
/** Quadratic bezier: one control point per segment. Cheaper than cubic and what TrueType glyph outlines use, at the cost of expressiveness. */
|
|
7992
8317
|
declare const bezierQuadratic: CurveRepresentation;
|
|
7993
8318
|
|
|
8319
|
+
/** NURBS: anchors act as weighted control points the curve is pulled toward rather than passing through. Flattened to line segments when converted to a path. */
|
|
7994
8320
|
declare const nurbs: CurveRepresentation;
|
|
7995
8321
|
|
|
8322
|
+
/** Spiro (κ-curves): curvature-continuous through each anchor, so joins stay visually smooth without hand-tuned handles. Approximated as cubics when converted to a path. */
|
|
7996
8323
|
declare const spiro: CurveRepresentation;
|
|
7997
8324
|
|
|
8325
|
+
/** Every curve representation the kit ships, keyed by kind. */
|
|
7998
8326
|
declare const CURVE_REPS: Readonly<Record<CurveRepKind, CurveRepresentation>>;
|
|
7999
8327
|
|
|
8000
8328
|
/**
|
|
@@ -8218,6 +8546,8 @@ declare function guideSnapStrategy<TPose extends {
|
|
|
8218
8546
|
x: number;
|
|
8219
8547
|
y: number;
|
|
8220
8548
|
}>(getGuides: () => readonly Guide[], options?: Omit<GuideSnapOptions<TPose>, 'origin'>): SnapStrategy<TPose>;
|
|
8549
|
+
/** As above, for a `TPose` that is not a rect: `origin` tells the strategy how
|
|
8550
|
+
* to read and write the pose's origin. */
|
|
8221
8551
|
declare function guideSnapStrategy<TPose>(getGuides: () => readonly Guide[], options: GuideSnapOptions<TPose> & {
|
|
8222
8552
|
origin: OriginProjection<TPose>;
|
|
8223
8553
|
}): SnapStrategy<TPose>;
|
|
@@ -8288,6 +8618,9 @@ interface AlignBounds {
|
|
|
8288
8618
|
/** Which feature of a box to test against candidates, per axis.
|
|
8289
8619
|
* 'min' = left/top edge, 'center' = centerline, 'max' = right/bottom edge. */
|
|
8290
8620
|
type AlignAnchor = 'min' | 'center' | 'max';
|
|
8621
|
+
/** The correction an alignment match asks for: the translation that lands the
|
|
8622
|
+
* dragged bounds on the matched guides, and the guides themselves so they can
|
|
8623
|
+
* be drawn. */
|
|
8291
8624
|
interface AlignMatchResult {
|
|
8292
8625
|
dx: number;
|
|
8293
8626
|
dy: number;
|
|
@@ -8301,6 +8634,8 @@ interface AlignBoundsProjection<TPose> {
|
|
|
8301
8634
|
boundsOf(pose: TPose): AlignBounds;
|
|
8302
8635
|
translate(pose: TPose, dx: number, dy: number): TPose;
|
|
8303
8636
|
}
|
|
8637
|
+
/** Which candidate lines to derive from a set of bounds — edges, centers, or
|
|
8638
|
+
* both, and whether the page box contributes its own. */
|
|
8304
8639
|
interface DeriveAlignmentGuidesOptions {
|
|
8305
8640
|
/** Include the document/page box's edges + center as candidates. */
|
|
8306
8641
|
page?: AlignBounds;
|
|
@@ -8423,16 +8758,22 @@ declare function rotationHandle(pose: {
|
|
|
8423
8758
|
* handle's center on both axes. Mirrors `hitCornerHandle`. */
|
|
8424
8759
|
declare function hitRotationHandle(handle: RotationHandle, px: number, py: number, radius: number): boolean;
|
|
8425
8760
|
|
|
8761
|
+
/** A point in world coordinates. */
|
|
8426
8762
|
interface DragRectPoint {
|
|
8427
8763
|
x: number;
|
|
8428
8764
|
y: number;
|
|
8429
8765
|
}
|
|
8766
|
+
/** The axis-aligned box between the drag's two corners, always with
|
|
8767
|
+
* non-negative extents regardless of drag direction. */
|
|
8430
8768
|
interface DragRectBounds {
|
|
8431
8769
|
x: number;
|
|
8432
8770
|
y: number;
|
|
8433
8771
|
width: number;
|
|
8434
8772
|
height: number;
|
|
8435
8773
|
}
|
|
8774
|
+
/** Live state of a rectangle drag, handed to each lifecycle callback. Either
|
|
8775
|
+
* corner can be moved mid-gesture, which is how a tool re-anchors a drag
|
|
8776
|
+
* without restarting it. */
|
|
8436
8777
|
interface DragRectCtx<TScratch = unknown> {
|
|
8437
8778
|
start: DragRectPoint;
|
|
8438
8779
|
current: DragRectPoint;
|
|
@@ -8445,12 +8786,15 @@ interface DragRectCtx<TScratch = unknown> {
|
|
|
8445
8786
|
/** Override the current point mid-gesture (between start and end). */
|
|
8446
8787
|
setCurrent(p: DragRectPoint): void;
|
|
8447
8788
|
}
|
|
8789
|
+
/** The context handed to `onEnd`, adding whether the final box is too small
|
|
8790
|
+
* to be meaningful. */
|
|
8448
8791
|
interface DragRectEndCtx<TScratch = unknown> extends DragRectCtx<TScratch> {
|
|
8449
8792
|
/** True if the end-time bounds are at or below `minBounds` on either axis.
|
|
8450
8793
|
* Present-tense state check — distinct from the base's retrospective
|
|
8451
8794
|
* `wasSubThreshold`. Computed by this wrapper, not by `useDragGesture`. */
|
|
8452
8795
|
isSubThreshold: boolean;
|
|
8453
8796
|
}
|
|
8797
|
+
/** Options for `useDragRect`. */
|
|
8454
8798
|
interface UseDragRectOptions<TScratch = unknown> {
|
|
8455
8799
|
minBounds?: {
|
|
8456
8800
|
width: number;
|
|
@@ -8470,6 +8814,7 @@ interface UseDragRectOptions<TScratch = unknown> {
|
|
|
8470
8814
|
* behavior is identical to today (identity passthrough). */
|
|
8471
8815
|
snapPoint?: (p: DragRectPoint) => DragRectPoint;
|
|
8472
8816
|
}
|
|
8817
|
+
/** Drives a rectangle drag and publishes the live box for overlay drawing. */
|
|
8473
8818
|
interface DragRectController {
|
|
8474
8819
|
start(worldX: number, worldY: number, modifiers: ModifierState): void;
|
|
8475
8820
|
move(worldX: number, worldY: number, modifiers: ModifierState): boolean;
|
|
@@ -8482,6 +8827,14 @@ interface DragRectController {
|
|
|
8482
8827
|
} | null;
|
|
8483
8828
|
readonly isActive: boolean;
|
|
8484
8829
|
}
|
|
8830
|
+
/**
|
|
8831
|
+
* The gesture "the user drew a rectangle": press, drag, release, with the
|
|
8832
|
+
* resulting box reported live and at commit.
|
|
8833
|
+
*
|
|
8834
|
+
* It is a spatial input primitive, not an insert mechanism — what the box
|
|
8835
|
+
* means is entirely up to whoever consumes it. Marquee selection, cropping and
|
|
8836
|
+
* shape insertion all sit on top of the same gesture.
|
|
8837
|
+
*/
|
|
8485
8838
|
declare function useDragRect<TScratch = unknown>(options?: UseDragRectOptions<TScratch>): DragRectController;
|
|
8486
8839
|
|
|
8487
8840
|
/** Pointer position in both world (gesture-coord) and client (CSS-px) space. */
|
|
@@ -8504,11 +8857,15 @@ interface DragGestureCtx<TScratch = unknown> {
|
|
|
8504
8857
|
/** 'pending' or 'active'. Never 'idle' inside a callback. */
|
|
8505
8858
|
phase: 'pending' | 'active';
|
|
8506
8859
|
}
|
|
8860
|
+
/** The context handed to `onEnd`, adding whether the gesture ever passed its
|
|
8861
|
+
* activation threshold. */
|
|
8507
8862
|
interface DragGestureEndCtx<TScratch = unknown> extends DragGestureCtx<TScratch> {
|
|
8508
8863
|
/** True if phase never reached 'active'. Wrappers without thresholdReached
|
|
8509
8864
|
* always see false here (their gesture activates at start()). */
|
|
8510
8865
|
wasSubThreshold: boolean;
|
|
8511
8866
|
}
|
|
8867
|
+
/** Options for `useDragGesture`: when the gesture becomes active, and what to
|
|
8868
|
+
* do at each point in its lifecycle. */
|
|
8512
8869
|
interface UseDragGestureOptions<TScratch = unknown> {
|
|
8513
8870
|
initScratch?: () => TScratch;
|
|
8514
8871
|
/** Predicate consulted on each move while phase === 'pending'. Return true
|
|
@@ -8523,6 +8880,8 @@ interface UseDragGestureOptions<TScratch = unknown> {
|
|
|
8523
8880
|
onGestureStart?: () => void;
|
|
8524
8881
|
onGestureEnd?: (committed: boolean) => void;
|
|
8525
8882
|
}
|
|
8883
|
+
/** Drives a drag gesture. The owner feeds it pointer positions; it decides
|
|
8884
|
+
* when the drag has really begun and calls back accordingly. */
|
|
8526
8885
|
interface DragGestureController {
|
|
8527
8886
|
start(point: DragGesturePoint, modifiers: ModifierState): void;
|
|
8528
8887
|
move(point: DragGesturePoint, modifiers: ModifierState): boolean;
|
|
@@ -8531,25 +8890,41 @@ interface DragGestureController {
|
|
|
8531
8890
|
readonly phase: DragGesturePhase;
|
|
8532
8891
|
readonly isActive: boolean;
|
|
8533
8892
|
}
|
|
8893
|
+
/**
|
|
8894
|
+
* The base drag primitive: tracks a pointer from press to release, with an
|
|
8895
|
+
* optional threshold below which the gesture stays pending and commits
|
|
8896
|
+
* nothing.
|
|
8897
|
+
*
|
|
8898
|
+
* It is a gesture and only a gesture — it says where the pointer went, never
|
|
8899
|
+
* what that should do. `useDragRect` and `useDragRadial` build on it, and
|
|
8900
|
+
* actions decide what to make of the result.
|
|
8901
|
+
*/
|
|
8534
8902
|
declare function useDragGesture<TScratch = unknown>(options?: UseDragGestureOptions<TScratch>): DragGestureController;
|
|
8535
8903
|
|
|
8904
|
+
/** A point in world coordinates. */
|
|
8536
8905
|
interface DragRadialPoint {
|
|
8537
8906
|
x: number;
|
|
8538
8907
|
y: number;
|
|
8539
8908
|
}
|
|
8909
|
+
/** A radial drag expressed as its center and the polar coordinates of the
|
|
8910
|
+
* cursor relative to it. */
|
|
8540
8911
|
interface DragRadialState {
|
|
8541
8912
|
center: DragRadialPoint;
|
|
8542
8913
|
radius: number;
|
|
8543
8914
|
rotation: number;
|
|
8544
8915
|
}
|
|
8916
|
+
/** Live state of a radial drag, handed to each lifecycle callback. */
|
|
8545
8917
|
interface DragRadialCtx<TScratch = unknown> extends DragRadialState {
|
|
8546
8918
|
modifiers: ModifierState;
|
|
8547
8919
|
scratch: TScratch;
|
|
8548
8920
|
}
|
|
8921
|
+
/** The context handed to `onEnd`, adding whether the final radius is too
|
|
8922
|
+
* small to be meaningful. */
|
|
8549
8923
|
interface DragRadialEndCtx<TScratch = unknown> extends DragRadialCtx<TScratch> {
|
|
8550
8924
|
/** True at end time if the radius is at or below `minRadius`. */
|
|
8551
8925
|
isSubThreshold: boolean;
|
|
8552
8926
|
}
|
|
8927
|
+
/** Options for `useDragRadial`. */
|
|
8553
8928
|
interface UseDragRadialOptions<TScratch = unknown> {
|
|
8554
8929
|
minRadius?: number;
|
|
8555
8930
|
initScratch?: () => TScratch;
|
|
@@ -8566,6 +8941,8 @@ interface UseDragRadialOptions<TScratch = unknown> {
|
|
|
8566
8941
|
* When omitted, behavior is identical to today (identity passthrough). */
|
|
8567
8942
|
snapPoint?: (p: DragRadialPoint) => DragRadialPoint;
|
|
8568
8943
|
}
|
|
8944
|
+
/** Drives a radial drag and publishes the live center/radius/rotation for
|
|
8945
|
+
* overlay drawing. */
|
|
8569
8946
|
interface DragRadialController {
|
|
8570
8947
|
start(worldX: number, worldY: number, modifiers: ModifierState): void;
|
|
8571
8948
|
move(worldX: number, worldY: number, modifiers: ModifierState): boolean;
|
|
@@ -8685,6 +9062,7 @@ declare function setScratch<T>(store: ScratchStore, key: ScratchKey<T>, value: T
|
|
|
8685
9062
|
* `false` if it wasn't. */
|
|
8686
9063
|
declare function deleteScratch<T>(store: ScratchStore, key: ScratchKey<T>): boolean;
|
|
8687
9064
|
|
|
9065
|
+
/** Options for `selectFromLasso`. */
|
|
8688
9066
|
interface SelectFromLassoOptions {
|
|
8689
9067
|
/** Hit mode for `hitTestLasso`. Default 'intersect'. */
|
|
8690
9068
|
mode?: LassoHitMode;
|
|
@@ -8769,6 +9147,8 @@ interface UseDistributeReturn {
|
|
|
8769
9147
|
* remaining items are repositioned. Single batch — one undo step. */
|
|
8770
9148
|
declare function useDistribute<TPose>(adapter: DistributeAdapter<TPose>, options?: UseDistributeOptions<TPose>): UseDistributeReturn;
|
|
8771
9149
|
|
|
9150
|
+
/** The six Boolean path operations, each acting on the current selection and
|
|
9151
|
+
* committing as one undo step. */
|
|
8772
9152
|
interface UseBooleansReturn {
|
|
8773
9153
|
union(): void;
|
|
8774
9154
|
intersect(): void;
|
|
@@ -8777,13 +9157,18 @@ interface UseBooleansReturn {
|
|
|
8777
9157
|
divide(): void;
|
|
8778
9158
|
crop(): void;
|
|
8779
9159
|
}
|
|
9160
|
+
/** Options for `useBooleans`. */
|
|
8780
9161
|
interface UseBooleansOptions {
|
|
8781
9162
|
/** No-op. Retained for source-compatibility; auto-registration is now
|
|
8782
9163
|
* handled by `useStandardActions` via the Pathfinder descriptors. */
|
|
8783
9164
|
enableActions?: boolean;
|
|
8784
9165
|
}
|
|
9166
|
+
/** Bind the Boolean path operations to an adapter that knows how to read the
|
|
9167
|
+
* selection, fetch world-space paths and mint result nodes. */
|
|
8785
9168
|
declare function useBooleans(adapter: BooleansAdapter, _options?: UseBooleansOptions): UseBooleansReturn;
|
|
8786
9169
|
|
|
9170
|
+
/** Publish a Boolean-ops adapter so the built-in Pathfinder actions can run.
|
|
9171
|
+
* Silently does nothing outside a `<DepRegistryProvider>`. */
|
|
8787
9172
|
declare function useBooleansAdapter(adapter: BooleansAdapter): void;
|
|
8788
9173
|
|
|
8789
9174
|
/**
|
|
@@ -8879,39 +9264,79 @@ declare const DEFAULT_DEBUG_THEME: DebugTheme;
|
|
|
8879
9264
|
*/
|
|
8880
9265
|
declare const DEFAULT_DEBUG_STROKES: DebugStrokes;
|
|
8881
9266
|
|
|
9267
|
+
/** No easing: constant rate from start to finish. */
|
|
8882
9268
|
declare const linear: EasingFn;
|
|
9269
|
+
/** Accelerates from a standstill, gently. */
|
|
8883
9270
|
declare const easeInQuad: EasingFn;
|
|
9271
|
+
/** Decelerates to a stop, gently. The safe default for UI motion. */
|
|
8884
9272
|
declare const easeOutQuad: EasingFn;
|
|
9273
|
+
/** Accelerates then decelerates, gently. */
|
|
8885
9274
|
declare const easeInOutQuad: EasingFn;
|
|
9275
|
+
/** Accelerates from a standstill, moderately. */
|
|
8886
9276
|
declare const easeInCubic: EasingFn;
|
|
9277
|
+
/** Decelerates to a stop, moderately. */
|
|
8887
9278
|
declare const easeOutCubic: EasingFn;
|
|
9279
|
+
/** Accelerates then decelerates, moderately. */
|
|
8888
9280
|
declare const easeInOutCubic: EasingFn;
|
|
9281
|
+
/** Accelerates from a standstill, sharply. */
|
|
8889
9282
|
declare const easeInQuart: EasingFn;
|
|
9283
|
+
/** Decelerates to a stop, sharply. */
|
|
8890
9284
|
declare const easeOutQuart: EasingFn;
|
|
9285
|
+
/** Accelerates then decelerates, sharply. */
|
|
8891
9286
|
declare const easeInOutQuart: EasingFn;
|
|
9287
|
+
/** Accelerates from a standstill, very sharply. */
|
|
8892
9288
|
declare const easeInQuint: EasingFn;
|
|
9289
|
+
/** Decelerates to a stop, very sharply. */
|
|
8893
9290
|
declare const easeOutQuint: EasingFn;
|
|
9291
|
+
/** Accelerates then decelerates, very sharply. */
|
|
8894
9292
|
declare const easeInOutQuint: EasingFn;
|
|
9293
|
+
/** Accelerates from a standstill along a sine curve — the mildest
|
|
9294
|
+
* acceleration of the built-ins. */
|
|
8895
9295
|
declare const easeInSine: EasingFn;
|
|
9296
|
+
/** Decelerates to a stop along a sine curve — the mildest
|
|
9297
|
+
* deceleration of the built-ins. */
|
|
8896
9298
|
declare const easeOutSine: EasingFn;
|
|
9299
|
+
/** Accelerates then decelerates along a sine curve. */
|
|
8897
9300
|
declare const easeInOutSine: EasingFn;
|
|
9301
|
+
/** Accelerates exponentially: barely moves at first, then rushes. */
|
|
8898
9302
|
declare const easeInExpo: EasingFn;
|
|
9303
|
+
/** Decelerates exponentially: leaps away, then creeps in. */
|
|
8899
9304
|
declare const easeOutExpo: EasingFn;
|
|
9305
|
+
/** Exponential at both ends — a very fast middle between two
|
|
9306
|
+
* near-still extremes. */
|
|
8900
9307
|
declare const easeInOutExpo: EasingFn;
|
|
9308
|
+
/** Accelerates along a circular arc: slow start, abrupt arrival. */
|
|
8901
9309
|
declare const easeInCirc: EasingFn;
|
|
9310
|
+
/** Decelerates along a circular arc: abrupt start, slow arrival. */
|
|
8902
9311
|
declare const easeOutCirc: EasingFn;
|
|
9312
|
+
/** Circular arcs at both ends. */
|
|
8903
9313
|
declare const easeInOutCirc: EasingFn;
|
|
9314
|
+
/** Pulls back past the start before moving forward. Overshoots below 0. */
|
|
8904
9315
|
declare const easeInBack: EasingFn;
|
|
9316
|
+
/** Overshoots the target, then settles back onto it. Exceeds 1. */
|
|
8905
9317
|
declare const easeOutBack: EasingFn;
|
|
9318
|
+
/** Overshoots at both ends. Leaves the 0–1 range on each side. */
|
|
8906
9319
|
declare const easeInOutBack: EasingFn;
|
|
9320
|
+
/** Oscillates around the start with growing amplitude, then snaps away. */
|
|
8907
9321
|
declare const easeInElastic: EasingFn;
|
|
9322
|
+
/** Springs past the target and wobbles into it. Exceeds 1. */
|
|
8908
9323
|
declare const easeOutElastic: EasingFn;
|
|
9324
|
+
/** Wobbles at both ends. Leaves the 0–1 range on each side. */
|
|
8909
9325
|
declare const easeInOutElastic: EasingFn;
|
|
9326
|
+
/** Lands on the target and bounces, in hops of decreasing height. */
|
|
8910
9327
|
declare const easeOutBounce: EasingFn;
|
|
9328
|
+
/** Bounces up to the start before departing — `easeOutBounce` reversed. */
|
|
8911
9329
|
declare const easeInBounce: EasingFn;
|
|
9330
|
+
/** Bounces at both ends. */
|
|
8912
9331
|
declare const easeInOutBounce: EasingFn;
|
|
9332
|
+
/** Alias for `easeInQuad`, kept for call sites that predate the
|
|
9333
|
+
* named-curve library. */
|
|
8913
9334
|
declare const easeIn: EasingFn;
|
|
9335
|
+
/** Alias for `easeOutQuad`, kept for call sites that predate the
|
|
9336
|
+
* named-curve library. */
|
|
8914
9337
|
declare const easeOut: EasingFn;
|
|
9338
|
+
/** Alias for `easeInOutQuad`, kept for call sites that predate the
|
|
9339
|
+
* named-curve library. */
|
|
8915
9340
|
declare const easeInOut: EasingFn;
|
|
8916
9341
|
/** All easings in one bag — useful for demos / pickers. */
|
|
8917
9342
|
declare const EASINGS: {
|
|
@@ -8947,11 +9372,18 @@ declare const EASINGS: {
|
|
|
8947
9372
|
readonly easeOutBounce: EasingFn;
|
|
8948
9373
|
readonly easeInOutBounce: EasingFn;
|
|
8949
9374
|
};
|
|
9375
|
+
/** The name of one of the built-in easing curves. */
|
|
8950
9376
|
type EasingName = keyof typeof EASINGS;
|
|
9377
|
+
/** Named spring tunings, from softest to firmest. Springs settle on a target
|
|
9378
|
+
* rather than running for a fixed duration, so these are an alternative to an
|
|
9379
|
+
* easing curve, not a modifier on one. */
|
|
8951
9380
|
declare const SPRING_PRESETS: Record<SpringPresetName, SpringPreset>;
|
|
8952
9381
|
|
|
9382
|
+
/** Create the animator for a canvas. One rAF loop drives every animation it
|
|
9383
|
+
* owns, and everything still running is cancelled on unmount. */
|
|
8953
9384
|
declare function useAnimator(opts?: UseAnimatorOptions): Animator;
|
|
8954
9385
|
|
|
9386
|
+
/** Options for `tweenPose`. */
|
|
8955
9387
|
interface TweenPoseOptions<TPose> {
|
|
8956
9388
|
id: string;
|
|
8957
9389
|
to: TPose;
|
|
@@ -8967,6 +9399,7 @@ interface TweenPoseOptions<TPose> {
|
|
|
8967
9399
|
opLabel?: string;
|
|
8968
9400
|
onDone?: () => void;
|
|
8969
9401
|
}
|
|
9402
|
+
/** Options for `springPose`. */
|
|
8970
9403
|
interface SpringPoseOptions<TPose> {
|
|
8971
9404
|
id: string;
|
|
8972
9405
|
to: TPose;
|
|
@@ -8979,13 +9412,25 @@ interface SpringPoseOptions<TPose> {
|
|
|
8979
9412
|
opLabel?: string;
|
|
8980
9413
|
onDone?: () => void;
|
|
8981
9414
|
}
|
|
9415
|
+
/**
|
|
9416
|
+
* Animate one node's pose to `to` over `ms`, writing each frame through the
|
|
9417
|
+
* adapter.
|
|
9418
|
+
*
|
|
9419
|
+
* Unlike the color helpers this really does move the node. Undo therefore has
|
|
9420
|
+
* to be considered: by default a single transform op covering the whole
|
|
9421
|
+
* animation is recorded up front, so one undo returns the node to where it
|
|
9422
|
+
* started rather than replaying frames.
|
|
9423
|
+
*/
|
|
8982
9424
|
declare function tweenPose<TNode extends {
|
|
8983
9425
|
id: string;
|
|
8984
9426
|
}, TPose>(animator: Animator, adapter: SceneAdapter<TNode, TPose>, opts: TweenPoseOptions<TPose>): AnimationHandle;
|
|
9427
|
+
/** `tweenPose` driven by a spring instead of a duration. Same op-recording
|
|
9428
|
+
* behavior. */
|
|
8985
9429
|
declare function springPose<TNode extends {
|
|
8986
9430
|
id: string;
|
|
8987
9431
|
}, TPose>(animator: Animator, adapter: SceneAdapter<TNode, TPose>, opts: SpringPoseOptions<TPose>): AnimationHandle;
|
|
8988
9432
|
|
|
9433
|
+
/** Options for `animateOnSetPose`. */
|
|
8989
9434
|
interface AnimateOnSetPoseOptions<TPose> {
|
|
8990
9435
|
/** Default: 200ms tween with easeOut. */
|
|
8991
9436
|
ms?: number;
|
|
@@ -9013,10 +9458,24 @@ interface AnimateOnSetPoseOptions<TPose> {
|
|
|
9013
9458
|
/** Op label for the recorded transform op. Default: `'animate'`. */
|
|
9014
9459
|
opLabel?: string;
|
|
9015
9460
|
}
|
|
9461
|
+
/**
|
|
9462
|
+
* Wrap an adapter so every `setPose` animates to the new pose instead of
|
|
9463
|
+
* jumping to it. Anything that moves a node — a layout strategy, an action, a
|
|
9464
|
+
* consumer's own code — is animated without knowing it, since the adapter is
|
|
9465
|
+
* the single write path.
|
|
9466
|
+
*
|
|
9467
|
+
* Poses written from inside another animation's tick, and (optionally) poses
|
|
9468
|
+
* written for a node currently under a gesture, are passed straight through:
|
|
9469
|
+
* animating those would fight whatever is already driving the node.
|
|
9470
|
+
*/
|
|
9016
9471
|
declare function animateOnSetPose<TNode extends {
|
|
9017
9472
|
id: string;
|
|
9018
9473
|
}, TPose>(adapter: SceneAdapter<TNode, TPose>, animator: Animator, opts?: AnimateOnSetPoseOptions<TPose>): SceneAdapter<TNode, TPose>;
|
|
9019
9474
|
|
|
9475
|
+
/** How nodes enter and leave. `enterFrom` derives the pose a new node starts
|
|
9476
|
+
* at, given where it belongs; `exitTo` derives the pose a departing node
|
|
9477
|
+
* animates to before it is actually removed. Omit either to leave that
|
|
9478
|
+
* transition instant. */
|
|
9020
9479
|
interface LifecycleAnimation<TPose> {
|
|
9021
9480
|
/** Pose to animate the new object FROM at insert. */
|
|
9022
9481
|
enterFrom?: (final: TPose) => TPose;
|
|
@@ -9026,11 +9485,14 @@ interface LifecycleAnimation<TPose> {
|
|
|
9026
9485
|
easing?: EasingFn;
|
|
9027
9486
|
geometry?: PoseProjection<TPose>;
|
|
9028
9487
|
}
|
|
9488
|
+
/** Wrap an adapter so inserts and removals animate — the scene-graph
|
|
9489
|
+
* equivalent of CSS enter/leave transitions. */
|
|
9029
9490
|
declare function animateLifecycle<TNode extends {
|
|
9030
9491
|
id: string;
|
|
9031
9492
|
pose?: TPose;
|
|
9032
9493
|
}, TPose>(adapter: SceneAdapter<TNode, TPose>, animator: Animator, opts: LifecycleAnimation<TPose>): SceneAdapter<TNode, TPose>;
|
|
9033
9494
|
|
|
9495
|
+
/** Options for the `momentum` move behavior. */
|
|
9034
9496
|
interface MomentumOptions {
|
|
9035
9497
|
/** Required: the per-Canvas animator that will own the decay. */
|
|
9036
9498
|
animator: Animator;
|
|
@@ -9067,10 +9529,24 @@ interface MomentumOptions {
|
|
|
9067
9529
|
*/
|
|
9068
9530
|
boundary?: 'stop' | 'continue';
|
|
9069
9531
|
}
|
|
9532
|
+
/**
|
|
9533
|
+
* Move behavior that keeps a dragged node coasting after the pointer is
|
|
9534
|
+
* released, at the velocity it was travelling, until friction brings it below
|
|
9535
|
+
* `threshold`.
|
|
9536
|
+
*
|
|
9537
|
+
* Plugs into the move action rather than replacing it, so the drag itself is
|
|
9538
|
+
* unchanged — this only decides what happens after the release. The whole
|
|
9539
|
+
* flick, coast included, records as one undoable transform.
|
|
9540
|
+
*/
|
|
9070
9541
|
declare function momentum<TPose>(opts: MomentumOptions): MoveBehavior<TPose>;
|
|
9071
9542
|
|
|
9543
|
+
/** Convert an 8-bit sRGB triple to OKLab. */
|
|
9072
9544
|
declare function srgbU8ToOklab(r: number, g: number, b: number): [number, number, number];
|
|
9545
|
+
/** Convert OKLab back to an 8-bit sRGB triple, clamped into gamut. */
|
|
9073
9546
|
declare function oklabToSrgbU8(L: number, A: number, B: number): [number, number, number];
|
|
9547
|
+
/** Blend two 8-bit sRGB colors through OKLab. Perceptually even, and it does
|
|
9548
|
+
* not pass through the muddy midpoints an sRGB blend produces between
|
|
9549
|
+
* complementary hues. */
|
|
9074
9550
|
declare function lerpOklab(from: readonly [number, number, number], to: readonly [number, number, number], t: number): [number, number, number];
|
|
9075
9551
|
/** Convert OKLab (L, a, b) to OKLCh (L, C, h). h is in radians, range [-π, π]. */
|
|
9076
9552
|
declare function oklabToOklch(L: number, A: number, B: number): [number, number, number];
|
|
@@ -9081,6 +9557,9 @@ declare function oklchToOklab(L: number, C: number, h: number): [number, number,
|
|
|
9081
9557
|
* is taken from the other endpoint (avoids hue snap-from-undefined).
|
|
9082
9558
|
* h inputs are in radians. */
|
|
9083
9559
|
declare function lerpOklch(from: readonly [number, number, number], to: readonly [number, number, number], t: number): [number, number, number];
|
|
9560
|
+
/** Which space a color blend is computed in. `'rgb'` is cheapest; `'oklab'`
|
|
9561
|
+
* is perceptually even; `'oklch'` additionally travels around the hue wheel
|
|
9562
|
+
* rather than through it. */
|
|
9084
9563
|
type ColorSpace = 'rgb' | 'oklab' | 'oklch';
|
|
9085
9564
|
/** Lerp a flat RGBA color array `from` toward `to`. Inputs are 0..1
|
|
9086
9565
|
* floats (the renderer's color space); outputs are 0..1 floats too.
|
|
@@ -9100,6 +9579,7 @@ declare function lerpColorArray(from: readonly number[], to: readonly number[],
|
|
|
9100
9579
|
* when a custom color-space or shaping is needed.
|
|
9101
9580
|
*/
|
|
9102
9581
|
type ColorInterpolate = (from: readonly number[], to: readonly number[], t: number) => number[];
|
|
9582
|
+
/** Options for `tweenVertexColors`. */
|
|
9103
9583
|
interface TweenVertexColorsOptions {
|
|
9104
9584
|
id: string;
|
|
9105
9585
|
channel: VertexColorChannel;
|
|
@@ -9116,7 +9596,17 @@ interface TweenVertexColorsOptions {
|
|
|
9116
9596
|
interpolate?: ColorInterpolate;
|
|
9117
9597
|
onDone?: () => void;
|
|
9118
9598
|
}
|
|
9599
|
+
/**
|
|
9600
|
+
* Animate one node's per-anchor colors from `from` to `to` over `ms`.
|
|
9601
|
+
*
|
|
9602
|
+
* The colors are published to the animator's `colorOverrides` registry rather
|
|
9603
|
+
* than written into the scene, so nothing is recorded in history and the
|
|
9604
|
+
* node's own data is untouched; the override is dropped when the animation
|
|
9605
|
+
* finishes. Starting another color animation on the same node and channel
|
|
9606
|
+
* cancels this one.
|
|
9607
|
+
*/
|
|
9119
9608
|
declare function tweenVertexColors(animator: Animator, opts: TweenVertexColorsOptions): AnimationHandle;
|
|
9609
|
+
/** Options for `springVertexColors`. */
|
|
9120
9610
|
interface SpringVertexColorsOptions {
|
|
9121
9611
|
id: string;
|
|
9122
9612
|
channel: VertexColorChannel;
|
|
@@ -9132,7 +9622,10 @@ interface SpringVertexColorsOptions {
|
|
|
9132
9622
|
interpolate?: ColorInterpolate;
|
|
9133
9623
|
onDone?: () => void;
|
|
9134
9624
|
}
|
|
9625
|
+
/** `tweenVertexColors` driven by a spring instead of a duration. Same override
|
|
9626
|
+
* semantics. */
|
|
9135
9627
|
declare function springVertexColors(animator: Animator, opts: SpringVertexColorsOptions): AnimationHandle;
|
|
9628
|
+
/** Options for `cycleVertexColors`. */
|
|
9136
9629
|
interface CycleVertexColorsOptions {
|
|
9137
9630
|
id: string;
|
|
9138
9631
|
channel: VertexColorChannel;
|
|
@@ -9144,6 +9637,9 @@ interface CycleVertexColorsOptions {
|
|
|
9144
9637
|
* progress `t` in 0..1; returns the blended array in 0..1 floats. */
|
|
9145
9638
|
interpolate?: ColorInterpolate;
|
|
9146
9639
|
}
|
|
9640
|
+
/** Removes an installed color cycle. Unlike the other color helpers this is
|
|
9641
|
+
* not an `AnimationHandle`, because a cycle has no progress to pause or
|
|
9642
|
+
* scale — it only ends. */
|
|
9147
9643
|
interface CycleHandle {
|
|
9148
9644
|
cancel(): void;
|
|
9149
9645
|
}
|
|
@@ -9158,6 +9654,9 @@ interface CycleHandle {
|
|
|
9158
9654
|
* cycleVertexColors holds an `animator.keepAlive()` entry for the
|
|
9159
9655
|
* lifetime of the cycle; `cancel()` releases it. */
|
|
9160
9656
|
declare function cycleVertexColors(animator: Animator, opts: CycleVertexColorsOptions): CycleHandle;
|
|
9657
|
+
/** Options for `staggerVertexColors`. `origin` picks which anchor the wave
|
|
9658
|
+
* starts from and `perAnchorDelay` how far behind each successive anchor
|
|
9659
|
+
* runs. */
|
|
9161
9660
|
interface StaggerVertexColorsOptions {
|
|
9162
9661
|
id: string;
|
|
9163
9662
|
channel: VertexColorChannel;
|
|
@@ -9173,6 +9672,9 @@ interface StaggerVertexColorsOptions {
|
|
|
9173
9672
|
interpolate?: ColorInterpolate;
|
|
9174
9673
|
onDone?: () => void;
|
|
9175
9674
|
}
|
|
9675
|
+
/** Run the same color change across a node's anchors as a wave, each anchor
|
|
9676
|
+
* starting later than the one before it. Same override semantics as
|
|
9677
|
+
* `tweenVertexColors`. */
|
|
9176
9678
|
declare function staggerVertexColors(animator: Animator, opts: StaggerVertexColorsOptions): AnimationHandle;
|
|
9177
9679
|
/** Build an n-anchor rainbow RGBA array sweeping the hue wheel. The
|
|
9178
9680
|
* output is suitable to pass directly into `stroke.vertexColors`,
|
|
@@ -9188,8 +9690,14 @@ declare function rainbowVertexColors(n: number, opts?: {
|
|
|
9188
9690
|
* `to`-target typically needs. */
|
|
9189
9691
|
declare function solidVertexColors(n: number, r: number, g: number, b: number, a?: number): number[];
|
|
9190
9692
|
|
|
9693
|
+
/** Snap policy that never picks a target — every drop is rejected, which is
|
|
9694
|
+
* what a free-form container wants. */
|
|
9191
9695
|
declare function none<TPose>(): LayoutSnap<TPose>;
|
|
9696
|
+
/** Snap policy that always picks the target closest to the pointer, however
|
|
9697
|
+
* far away it is. */
|
|
9192
9698
|
declare function nearest<TPose>(): LayoutSnap<TPose>;
|
|
9699
|
+
/** Snap policy that picks the closest target, but only within `tolerance`
|
|
9700
|
+
* world units — beyond that the drop is rejected. */
|
|
9193
9701
|
declare function nearestWithin<TPose>(opts: {
|
|
9194
9702
|
tolerance: number;
|
|
9195
9703
|
}): LayoutSnap<TPose>;
|
|
@@ -9211,6 +9719,7 @@ declare function containedThenNearest<TPose>(): LayoutSnap<TPose>;
|
|
|
9211
9719
|
*/
|
|
9212
9720
|
declare function cellAt<TPose>(): LayoutSnap<TPose>;
|
|
9213
9721
|
|
|
9722
|
+
/** Options for `freeform`. */
|
|
9214
9723
|
interface FreeformOptions<TPose> {
|
|
9215
9724
|
snap?: LayoutSnap<TPose>;
|
|
9216
9725
|
}
|
|
@@ -9222,6 +9731,7 @@ interface FreeformOptions<TPose> {
|
|
|
9222
9731
|
*/
|
|
9223
9732
|
declare function freeform<TPose>(opts?: FreeformOptions<TPose>): LayoutStrategy<TPose>;
|
|
9224
9733
|
|
|
9734
|
+
/** Options for `tileGrid`. */
|
|
9225
9735
|
interface TileGridOptions<TPose> {
|
|
9226
9736
|
cols: number;
|
|
9227
9737
|
rows: number;
|
|
@@ -9241,9 +9751,14 @@ interface TileGridOptions<TPose> {
|
|
|
9241
9751
|
height: number;
|
|
9242
9752
|
}, dragged: TPose): TPose;
|
|
9243
9753
|
}
|
|
9754
|
+
/** Layout strategy that arranges children into a fixed grid of cells, one
|
|
9755
|
+
* child per cell. A drag reflows the others to make room, and the container
|
|
9756
|
+
* holds at most `cols × rows` children. */
|
|
9244
9757
|
declare function tileGrid<TPose>(opts: TileGridOptions<TPose>): LayoutStrategy<TPose>;
|
|
9245
9758
|
|
|
9759
|
+
/** Which points within a container a child can snap to. */
|
|
9246
9760
|
type SnapPattern = 'corners' | 'edges' | 'center' | 'grid';
|
|
9761
|
+
/** Options for `snapPoint`. */
|
|
9247
9762
|
interface SnapPointOptions<TPose> {
|
|
9248
9763
|
pattern: SnapPattern;
|
|
9249
9764
|
/** Spacing for the 'grid' pattern, in world units. Default 50. */
|
|
@@ -9252,10 +9767,14 @@ interface SnapPointOptions<TPose> {
|
|
|
9252
9767
|
tolerance?: number;
|
|
9253
9768
|
snap?: LayoutSnap<TPose>;
|
|
9254
9769
|
}
|
|
9770
|
+
/** A point in world coordinates. */
|
|
9255
9771
|
type Pt = {
|
|
9256
9772
|
x: number;
|
|
9257
9773
|
y: number;
|
|
9258
9774
|
};
|
|
9775
|
+
/** Layout strategy that leaves children where they are but offers a fixed set
|
|
9776
|
+
* of points — corners, edge midpoints, center, or a grid — for a dragged
|
|
9777
|
+
* child to land on. */
|
|
9259
9778
|
declare function snapPoint<TPose extends Pt>(opts: SnapPointOptions<TPose>): LayoutStrategy<TPose>;
|
|
9260
9779
|
|
|
9261
9780
|
/**
|
|
@@ -9372,11 +9891,17 @@ declare function HandIcon({ className, size }: IconProps): react_jsx_runtime.JSX
|
|
|
9372
9891
|
* inside — readable, debuggable, not hidden. */
|
|
9373
9892
|
declare function UnknownIcon({ className, size }: IconProps): react_jsx_runtime.JSX.Element;
|
|
9374
9893
|
|
|
9894
|
+
/** Icon for the union operation: two overlapping circles merged into one filled shape. */
|
|
9375
9895
|
declare function UnionIcon(): react_jsx_runtime.JSX.Element;
|
|
9896
|
+
/** Icon for the intersect operation: only the overlap of two circles filled. */
|
|
9376
9897
|
declare function IntersectIcon(): react_jsx_runtime.JSX.Element;
|
|
9898
|
+
/** Icon for the subtract operation: the front circle removed from the back one. */
|
|
9377
9899
|
declare function SubtractIcon(): react_jsx_runtime.JSX.Element;
|
|
9900
|
+
/** Icon for the exclude operation: both circles filled except their overlap. */
|
|
9378
9901
|
declare function ExcludeIcon(): react_jsx_runtime.JSX.Element;
|
|
9902
|
+
/** Icon for the divide operation: two circles split into their separate regions. */
|
|
9379
9903
|
declare function DivideIcon(): react_jsx_runtime.JSX.Element;
|
|
9904
|
+
/** Icon for the crop operation: the back shape clipped to the front one. */
|
|
9380
9905
|
declare function CropIcon(): react_jsx_runtime.JSX.Element;
|
|
9381
9906
|
|
|
9382
9907
|
/** What the registry knows at dispatch time. */
|
|
@@ -9416,6 +9941,7 @@ declare function scopeBindings(entries: Iterable<Contribution>, state: Eligibili
|
|
|
9416
9941
|
*/
|
|
9417
9942
|
declare function mergeContributions(...bundles: readonly Contribution[][]): Contribution[];
|
|
9418
9943
|
|
|
9944
|
+
/** Appearance of the dashed box drawn during a marquee or insert drag. */
|
|
9419
9945
|
interface InsertOverlayStyle {
|
|
9420
9946
|
fill?: string;
|
|
9421
9947
|
stroke?: string;
|