@fieldnotes/core 0.63.0 → 0.64.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1037 -329
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +347 -17
- package/dist/index.d.ts +347 -17
- package/dist/index.js +1026 -329
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -241,7 +241,25 @@ interface Tool {
|
|
|
241
241
|
onPointerDown(state: PointerState, ctx: ToolContext): void;
|
|
242
242
|
onPointerMove(state: PointerState, ctx: ToolContext): void;
|
|
243
243
|
onPointerUp(state: PointerState, ctx: ToolContext): void;
|
|
244
|
+
/**
|
|
245
|
+
* The gesture was taken over (a second pointer started navigation) or the
|
|
246
|
+
* platform cancelled the pointer. Optional: tools without it receive
|
|
247
|
+
* `onPointerUp` instead, exactly as before. Implement it when "up" and
|
|
248
|
+
* "abandon" must differ (a multi-step tool must not treat a pinch as input).
|
|
249
|
+
* The gesture's history transaction is still committed afterwards (an
|
|
250
|
+
* in-progress store mutation must never be left open); a tool that wants
|
|
251
|
+
* abandon semantics must revert its own store mutations before returning.
|
|
252
|
+
*/
|
|
253
|
+
onPointerCancel?(state: PointerState, ctx: ToolContext): void;
|
|
244
254
|
onHover?(state: PointerState, ctx: ToolContext): void;
|
|
255
|
+
/**
|
|
256
|
+
* Offered every keydown that reaches the canvas (never from editable
|
|
257
|
+
* targets, and only within the viewport's keyboard scope) BEFORE the
|
|
258
|
+
* shortcut map. Return `true` to consume it (default prevented, no shortcut
|
|
259
|
+
* runs). Listeners are owned by the viewport, so a tool holds no DOM
|
|
260
|
+
* subscriptions and deactivation cannot leak.
|
|
261
|
+
*/
|
|
262
|
+
onKeyDown?(event: KeyboardEvent, ctx: ToolContext): boolean;
|
|
245
263
|
onActivate?(ctx: ToolContext): void;
|
|
246
264
|
onDeactivate?(ctx: ToolContext): void;
|
|
247
265
|
renderOverlay?(ctx: CanvasRenderingContext2D): void;
|
|
@@ -249,11 +267,70 @@ interface Tool {
|
|
|
249
267
|
setOptions?(options: object): void;
|
|
250
268
|
onOptionsChange?(listener: () => void): () => void;
|
|
251
269
|
}
|
|
252
|
-
type ToolName = 'hand' | 'select' | 'pencil' | 'eraser' | 'arrow' | 'note' | 'image' | 'text' | 'shape' | 'measure' | 'template' | 'laser' | 'ping';
|
|
270
|
+
type ToolName = 'hand' | 'select' | 'pencil' | 'eraser' | 'arrow' | 'note' | 'image' | 'text' | 'shape' | 'measure' | 'path' | 'template' | 'laser' | 'ping';
|
|
253
271
|
|
|
254
272
|
declare function snapPoint(point: Point, gridSize: number): Point;
|
|
255
273
|
declare function snapToHexCenter(point: Point, cellSize: number, orientation: HexOrientation): Point;
|
|
256
274
|
declare function smartSnap(point: Point, ctx: ToolContext): Point;
|
|
275
|
+
/** Cell footprint of a snapped thing: a scalar N means N×N cells. */
|
|
276
|
+
type Footprint = number | {
|
|
277
|
+
w: number;
|
|
278
|
+
h: number;
|
|
279
|
+
};
|
|
280
|
+
/**
|
|
281
|
+
* The cell footprint an element of `size` occupies on a square grid: each axis
|
|
282
|
+
* rounds to the NEAREST whole cell (a 1.25-cell token is one cell wide), never
|
|
283
|
+
* below one. Without a usable grid size the footprint is a single cell. Pair it
|
|
284
|
+
* with `snapFootprintCenter` so an odd-cell element lands on a cell centre and
|
|
285
|
+
* an even-cell one on an intersection.
|
|
286
|
+
*/
|
|
287
|
+
declare function footprintFromSize(size: {
|
|
288
|
+
w: number;
|
|
289
|
+
h: number;
|
|
290
|
+
}, gridSize: number): Footprint;
|
|
291
|
+
/**
|
|
292
|
+
* Snaps a CENTRE point so a footprint of `w`×`h` cells fills whole cells on a
|
|
293
|
+
* square grid: an odd axis lands on a cell centre, an even axis on an
|
|
294
|
+
* intersection. Each axis is independent (a 1×2 footprint centres on X and
|
|
295
|
+
* sits on an intersection on Y). Compare `snapPoint`, which snaps to
|
|
296
|
+
* intersections only.
|
|
297
|
+
*/
|
|
298
|
+
declare function snapToCellCenter(point: Point, gridSize: number, footprint?: Footprint): Point;
|
|
299
|
+
/**
|
|
300
|
+
* `smartSnap` for centres: identity when snapping is off, hex centres on hex
|
|
301
|
+
* grids, footprint-aware cell centres otherwise.
|
|
302
|
+
*/
|
|
303
|
+
declare function snapFootprintCenter(point: Point, footprint: Footprint, ctx: ToolContext): Point;
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* How diagonal steps are costed on a SQUARE grid, in cells.
|
|
307
|
+
* - `euclidean` — straight-line distance over the cell size (the ruler's behaviour; default).
|
|
308
|
+
* - `chebyshev` — a diagonal step costs one cell.
|
|
309
|
+
* - `alternate` — diagonals alternate 1, 2, 1, 2 … cells ("5-10-5"), counted over the WHOLE path.
|
|
310
|
+
* - `manhattan` — a diagonal step costs two cells.
|
|
311
|
+
* Ignored on hex grids (hex distance is the cube metric).
|
|
312
|
+
*/
|
|
313
|
+
type DiagonalRule = 'euclidean' | 'chebyshev' | 'alternate' | 'manhattan';
|
|
314
|
+
interface GridMetric {
|
|
315
|
+
gridSize: number;
|
|
316
|
+
gridType?: 'square' | 'hex';
|
|
317
|
+
hexOrientation?: HexOrientation;
|
|
318
|
+
diagonalRule?: DiagonalRule;
|
|
319
|
+
}
|
|
320
|
+
interface PathDistance {
|
|
321
|
+
/** Cost of the whole path in cells. */
|
|
322
|
+
total: number;
|
|
323
|
+
/** Cost after each waypoint; `cumulative[0] === 0`, one entry per point. */
|
|
324
|
+
cumulative: number[];
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Distance of a polyline in grid cells. Stateful rules (`alternate`) accumulate
|
|
328
|
+
* over the whole path, so the unit of computation is the path, not a segment;
|
|
329
|
+
* a segment's own cost is `cumulative[i] - cumulative[i - 1]`.
|
|
330
|
+
*/
|
|
331
|
+
declare function pathDistanceCells(points: readonly Point[], grid: GridMetric): PathDistance;
|
|
332
|
+
/** Two-point convenience over `pathDistanceCells`. */
|
|
333
|
+
declare function gridDistanceCells(a: Point, b: Point, grid: GridMetric): number;
|
|
257
334
|
|
|
258
335
|
interface Layer {
|
|
259
336
|
id: string;
|
|
@@ -419,6 +496,8 @@ declare class ToolManager {
|
|
|
419
496
|
handlePointerDown(state: PointerState, ctx: ToolContext): void;
|
|
420
497
|
handlePointerMove(state: PointerState, ctx: ToolContext): void;
|
|
421
498
|
handlePointerUp(state: PointerState, ctx: ToolContext): void;
|
|
499
|
+
/** Cancels the active gesture; falls back to `onPointerUp` for tools without `onPointerCancel`. */
|
|
500
|
+
handlePointerCancel(state: PointerState, ctx: ToolContext): void;
|
|
422
501
|
onChange(listener: (name: string) => void): () => void;
|
|
423
502
|
onRegister(listener: (tool: Tool) => void): () => void;
|
|
424
503
|
}
|
|
@@ -1568,17 +1647,13 @@ interface RemoteMeasureOverlayOptions {
|
|
|
1568
1647
|
* updated for `maxAgeMs` is expired by a timer — an idle map never renders,
|
|
1569
1648
|
* so expiry cannot ride on the draw path. The overlay never touches elements,
|
|
1570
1649
|
* history, or persisted state, and never moves the viewer's camera.
|
|
1650
|
+
*
|
|
1651
|
+
* The per-sender lifetime is `LingerOverlay`; this class only validates
|
|
1652
|
+
* payloads and draws one measurement.
|
|
1571
1653
|
*/
|
|
1572
1654
|
declare class RemoteMeasureOverlay {
|
|
1573
|
-
private readonly host;
|
|
1574
1655
|
private readonly color;
|
|
1575
|
-
private readonly
|
|
1576
|
-
private readonly fadeMs;
|
|
1577
|
-
private readonly maxAgeMs;
|
|
1578
|
-
private readonly measurements;
|
|
1579
|
-
private unregister;
|
|
1580
|
-
private rafId;
|
|
1581
|
-
private disposed;
|
|
1656
|
+
private readonly overlay;
|
|
1582
1657
|
constructor(host: RemoteMeasureOverlayHost, options?: RemoteMeasureOverlayOptions);
|
|
1583
1658
|
private now;
|
|
1584
1659
|
/**
|
|
@@ -1595,10 +1670,265 @@ declare class RemoteMeasureOverlay {
|
|
|
1595
1670
|
get activeSenderCount(): number;
|
|
1596
1671
|
/** Unregisters the overlay, cancels timers, stops animating. Idempotent. */
|
|
1597
1672
|
dispose(): void;
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1673
|
+
}
|
|
1674
|
+
|
|
1675
|
+
/** A running-total threshold: segments up to `feet` are drawn in `color`. */
|
|
1676
|
+
interface PathRangeBand {
|
|
1677
|
+
readonly feet: number;
|
|
1678
|
+
readonly color: string;
|
|
1679
|
+
}
|
|
1680
|
+
/**
|
|
1681
|
+
* Where a path starts. A host resolves the pointer to the thing being moved
|
|
1682
|
+
* (a token, a marker) so the path anchors on it instead of the raw cursor;
|
|
1683
|
+
* `anchorKey` is opaque to the tool and echoed back on every emission so the
|
|
1684
|
+
* host can apply the move it asked for.
|
|
1685
|
+
*/
|
|
1686
|
+
interface PathAnchor {
|
|
1687
|
+
origin: Point;
|
|
1688
|
+
footprint?: Footprint;
|
|
1689
|
+
anchorKey?: string;
|
|
1690
|
+
}
|
|
1691
|
+
interface PathToolOptions {
|
|
1692
|
+
feetPerCell?: number;
|
|
1693
|
+
color?: string;
|
|
1694
|
+
diagonalRule?: DiagonalRule;
|
|
1695
|
+
footprint?: Footprint;
|
|
1696
|
+
rangeBands?: readonly PathRangeBand[];
|
|
1697
|
+
/**
|
|
1698
|
+
* Screen-space radius, in CSS pixels, around the last waypoint inside which a
|
|
1699
|
+
* tap finishes the path instead of adding a corner. Default `12`. Screen
|
|
1700
|
+
* space so the target keeps its physical size at any zoom; `0` restores
|
|
1701
|
+
* exact-match-only commits (a fingertip can never hit an exact world point on
|
|
1702
|
+
* a gridless canvas, so a touch commit needs the tolerance). Ignored while
|
|
1703
|
+
* this path has an active snapping grid (square, or hex with an
|
|
1704
|
+
* orientation) — there the snapped tap already lands exactly on the last
|
|
1705
|
+
* waypoint, and a screen-space radius could otherwise reach a neighbouring
|
|
1706
|
+
* cell centre at a zoomed-out camera.
|
|
1707
|
+
*/
|
|
1708
|
+
commitTapRadiusPx?: number;
|
|
1709
|
+
/** Returning `null` vetoes the gesture — no path opens and nothing is emitted. */
|
|
1710
|
+
resolveStart?: (world: Point, ctx: ToolContext) => PathAnchor | null;
|
|
1711
|
+
}
|
|
1712
|
+
interface PathSegment {
|
|
1713
|
+
readonly cells: number;
|
|
1714
|
+
readonly feet: number;
|
|
1715
|
+
}
|
|
1716
|
+
/**
|
|
1717
|
+
* A raf-coalesced snapshot of the in-progress path. `waypoints` are the
|
|
1718
|
+
* committed corners; `cursor` is the rubber-banding end (null once the path
|
|
1719
|
+
* closes) and is counted in the totals without being a waypoint. Ephemeral by
|
|
1720
|
+
* contract: presence only — never elements, history, or persisted state.
|
|
1721
|
+
*/
|
|
1722
|
+
interface PathEmission {
|
|
1723
|
+
readonly anchorKey?: string;
|
|
1724
|
+
readonly waypoints: readonly Point[];
|
|
1725
|
+
readonly cursor: Point | null;
|
|
1726
|
+
readonly segments: readonly PathSegment[];
|
|
1727
|
+
readonly totalCells: number;
|
|
1728
|
+
readonly totalFeet: number;
|
|
1729
|
+
readonly color: string;
|
|
1730
|
+
readonly rangeBands: readonly PathRangeBand[];
|
|
1731
|
+
}
|
|
1732
|
+
/**
|
|
1733
|
+
* Multi-waypoint movement measuring: tap to anchor, drag or click to add
|
|
1734
|
+
* corners, tap on or near the last waypoint (or press Enter) to finish, Escape
|
|
1735
|
+
* or a pointer takeover to abandon.
|
|
1736
|
+
*
|
|
1737
|
+
* Store-free by contract: the tool never creates, moves, or deletes elements
|
|
1738
|
+
* and never opens a history transaction — it only measures. A completed path
|
|
1739
|
+
* is handed to `onCommit` listeners and the HOST applies the move (inside its
|
|
1740
|
+
* own transaction) if it wants one. Path snapshots are ephemeral in the same
|
|
1741
|
+
* sense as `MeasureTool`'s: presence only — never elements, history, or
|
|
1742
|
+
* persisted state.
|
|
1743
|
+
*/
|
|
1744
|
+
declare class PathTool implements Tool {
|
|
1745
|
+
readonly name = "path";
|
|
1746
|
+
private feetPerCell;
|
|
1747
|
+
private color;
|
|
1748
|
+
private diagonalRule;
|
|
1749
|
+
private footprintOption;
|
|
1750
|
+
private rangeBands;
|
|
1751
|
+
private commitTapRadiusPx;
|
|
1752
|
+
private resolveStart;
|
|
1753
|
+
private waypoints;
|
|
1754
|
+
private cursor;
|
|
1755
|
+
private anchorKey;
|
|
1756
|
+
private footprint;
|
|
1757
|
+
private pointerDown;
|
|
1758
|
+
private commitOnUp;
|
|
1759
|
+
private gridSize;
|
|
1760
|
+
private gridType;
|
|
1761
|
+
private hexOrientation;
|
|
1762
|
+
private snapEnabled;
|
|
1763
|
+
private optionListeners;
|
|
1764
|
+
private pathListeners;
|
|
1765
|
+
private commitListeners;
|
|
1766
|
+
private emissionRafId;
|
|
1767
|
+
constructor(options?: PathToolOptions);
|
|
1768
|
+
getOptions(): PathToolOptions;
|
|
1769
|
+
setOptions(options: PathToolOptions): void;
|
|
1770
|
+
onOptionsChange(listener: () => void): () => void;
|
|
1771
|
+
/**
|
|
1772
|
+
* Subscribes to raf-coalesced path snapshots. While a path is open,
|
|
1773
|
+
* listeners receive at most one snapshot per animation frame carrying the
|
|
1774
|
+
* latest state; `null` is delivered synchronously when the path closes
|
|
1775
|
+
* (commit, cancel, or deactivate).
|
|
1776
|
+
*/
|
|
1777
|
+
onPath(listener: (emission: PathEmission | null) => void): () => void;
|
|
1778
|
+
/**
|
|
1779
|
+
* Subscribes to finished paths. The emission carries `cursor: null` and the
|
|
1780
|
+
* final waypoints; applying the move (and recording history for it) is the
|
|
1781
|
+
* host's job — the tool has already forgotten the path by then.
|
|
1782
|
+
*/
|
|
1783
|
+
onCommit(listener: (emission: PathEmission) => void): () => void;
|
|
1784
|
+
get isOpen(): boolean;
|
|
1785
|
+
/** Synchronous snapshot of the open path; `null` when no path is open. */
|
|
1786
|
+
getEmission(): PathEmission | null;
|
|
1787
|
+
onPointerDown(state: PointerState, ctx: ToolContext): void;
|
|
1788
|
+
onPointerMove(state: PointerState, ctx: ToolContext): void;
|
|
1789
|
+
onPointerUp(_state: PointerState, ctx: ToolContext): void;
|
|
1790
|
+
onHover(state: PointerState, ctx: ToolContext): void;
|
|
1791
|
+
/** A takeover (second pointer, platform cancel) abandons the path outright. */
|
|
1792
|
+
onPointerCancel(_state: PointerState, ctx: ToolContext): void;
|
|
1793
|
+
onDeactivate(ctx: ToolContext): void;
|
|
1794
|
+
onKeyDown(event: KeyboardEvent, ctx: ToolContext): boolean;
|
|
1795
|
+
renderOverlay(ctx: CanvasRenderingContext2D): void;
|
|
1796
|
+
private lastWaypoint;
|
|
1797
|
+
/**
|
|
1798
|
+
* Is `point` close enough to `last` to mean "finish here"? EXACT match always
|
|
1799
|
+
* qualifies. The screen-space tolerance is added ONLY when this path has no
|
|
1800
|
+
* active snapping grid: on a snapping grid (`gridType === 'square'`, or
|
|
1801
|
+
* `'hex'` with a captured orientation, and `gridSize > 0`) the adjacent
|
|
1802
|
+
* cell/hex centre can be as little as one grid cell away, and a radius
|
|
1803
|
+
* computed from CSS pixels has no relationship to that distance — at a
|
|
1804
|
+
* sufficiently zoomed-out camera the radius would swallow a whole neighbour
|
|
1805
|
+
* cell and turn a deliberate next-waypoint tap into an unwanted commit.
|
|
1806
|
+
* Snapping already makes a fingertip tap land exactly on the last waypoint,
|
|
1807
|
+
* so the tolerance is unnecessary there; it exists for the gridless and
|
|
1808
|
+
* `snapPoint`/identity paths, where a fingertip can never land on an exact
|
|
1809
|
+
* world point.
|
|
1810
|
+
*/
|
|
1811
|
+
private withinCommitRadius;
|
|
1812
|
+
/**
|
|
1813
|
+
* True when this path's captured grid state snaps every waypoint onto a
|
|
1814
|
+
* cell/hex centre: a `square` grid, or a `hex` grid with a captured
|
|
1815
|
+
* orientation, both with a usable `gridSize`. Mirrors the unconditional
|
|
1816
|
+
* branches of `snap` below — NOT the `snapToGrid`-gated fallback, which
|
|
1817
|
+
* leaves waypoints unsnapped when the user turns snapping off.
|
|
1818
|
+
*/
|
|
1819
|
+
private hasSnappingGrid;
|
|
1820
|
+
/**
|
|
1821
|
+
* Snapping to cell or hex centres is UNCONDITIONAL for a `square` grid, or a
|
|
1822
|
+
* `hex` grid WITH a captured orientation: a movement path measures in cells,
|
|
1823
|
+
* so an unsnapped waypoint would report a distance the grid does not agree
|
|
1824
|
+
* with. A `hex` grid WITHOUT an orientation falls through to the
|
|
1825
|
+
* `snapToGrid`-gated `snapPoint` (intersection) branch below, same as the
|
|
1826
|
+
* gridType-less case — unlike `smartSnap`, which is off entirely when the
|
|
1827
|
+
* user turns snapping off.
|
|
1828
|
+
*/
|
|
1829
|
+
private snap;
|
|
1830
|
+
/** The measured polyline: waypoints, plus the cursor when it adds a leg. */
|
|
1831
|
+
private measure;
|
|
1832
|
+
private buildEmission;
|
|
1833
|
+
private commit;
|
|
1834
|
+
private cancel;
|
|
1835
|
+
private reset;
|
|
1836
|
+
private notifyOptionsChange;
|
|
1837
|
+
private scheduleEmission;
|
|
1838
|
+
private emitClear;
|
|
1839
|
+
private emitPath;
|
|
1840
|
+
private emitCommit;
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1843
|
+
/**
|
|
1844
|
+
* The wire shape of a movement-path presence payload. Presence data is untyped
|
|
1845
|
+
* on the wire, so hosts discriminate on `kind`; `isPathPresence` validates a
|
|
1846
|
+
* received payload before it reaches the overlay. Distance is
|
|
1847
|
+
* sender-authoritative: receivers render the payload's `feet` and pre-resolved
|
|
1848
|
+
* `segmentColors` and never recompute from their own grid or range bands.
|
|
1849
|
+
* Paths are ephemeral by contract: presence only — never elements, undo
|
|
1850
|
+
* history, persisted canvas state, or durable operations. The emission's
|
|
1851
|
+
* `anchorKey` is host-private and never travels on the wire.
|
|
1852
|
+
*/
|
|
1853
|
+
type PathPresence = {
|
|
1854
|
+
readonly kind: 'path';
|
|
1855
|
+
readonly points: readonly Point[];
|
|
1856
|
+
/** One entry per segment: `points.length - 1` colours. */
|
|
1857
|
+
readonly segmentColors: readonly string[];
|
|
1858
|
+
readonly feet: number;
|
|
1859
|
+
readonly color?: string;
|
|
1860
|
+
} | {
|
|
1861
|
+
readonly kind: 'path';
|
|
1862
|
+
readonly cleared: true;
|
|
1863
|
+
};
|
|
1864
|
+
declare const PATH_PRESENCE_KIND = "path";
|
|
1865
|
+
/** Point cap for a received path; longer payloads are rejected outright. */
|
|
1866
|
+
declare const PATH_PRESENCE_MAX_POINTS = 256;
|
|
1867
|
+
declare function isPathPresence(data: unknown): data is PathPresence;
|
|
1868
|
+
/**
|
|
1869
|
+
* Builds the presence payload for one local `PathTool` emission. Range bands
|
|
1870
|
+
* are resolved to per-segment colours here, so a receiver renders the sender's
|
|
1871
|
+
* bands without knowing them. `anchorKey` is deliberately dropped: it names a
|
|
1872
|
+
* local element the receiver cannot resolve.
|
|
1873
|
+
*
|
|
1874
|
+
* The sender imposes NO waypoint cap: a path longer than
|
|
1875
|
+
* `PATH_PRESENCE_MAX_POINTS` produces a payload that every receiver rejects, so
|
|
1876
|
+
* a host that allows very long paths should cap waypoints itself or expect
|
|
1877
|
+
* non-delivery beyond the limit.
|
|
1878
|
+
*/
|
|
1879
|
+
declare function toPathPresence(emission: PathEmission | null): PathPresence;
|
|
1880
|
+
/**
|
|
1881
|
+
* The two viewport capabilities the overlay needs; `Viewport` satisfies it.
|
|
1882
|
+
* Structurally identical to the internal `LingerOverlayHost` and to
|
|
1883
|
+
* `RemoteMeasureOverlayHost`; the members are spelled out rather than inherited
|
|
1884
|
+
* so the public shape never depends on an unexported internal interface.
|
|
1885
|
+
*/
|
|
1886
|
+
interface RemotePathOverlayHost {
|
|
1887
|
+
registerOverlay(draw: OverlayRenderer): () => void;
|
|
1888
|
+
requestRender(): void;
|
|
1889
|
+
}
|
|
1890
|
+
interface RemotePathOverlayOptions {
|
|
1891
|
+
/** Style fallback when a payload omits `color`. Default `'#FF5722'`. */
|
|
1892
|
+
color?: string;
|
|
1893
|
+
/** Full-opacity hold after a cleared payload. Default `1500`. */
|
|
1894
|
+
holdMs?: number;
|
|
1895
|
+
/** Linear fade to 0 after the hold. Default `400`. */
|
|
1896
|
+
fadeMs?: number;
|
|
1897
|
+
/** Stale active entries are treated as cleared after this. Default `30000`. */
|
|
1898
|
+
maxAgeMs?: number;
|
|
1899
|
+
}
|
|
1900
|
+
/**
|
|
1901
|
+
* Renders remote movement paths through the viewport overlay registration,
|
|
1902
|
+
* independent of the viewer's active tool. Entries are stamped with local
|
|
1903
|
+
* receive time (remote clocks are never trusted). A cleared payload holds the
|
|
1904
|
+
* final path for `holdMs`, fades over `fadeMs`, and deletes; presence-leave
|
|
1905
|
+
* (`remove`) deletes immediately. An active entry not updated for `maxAgeMs`
|
|
1906
|
+
* is expired by a timer — an idle map never renders, so expiry cannot ride on
|
|
1907
|
+
* the draw path. The overlay never touches elements, history, or persisted
|
|
1908
|
+
* state, and never moves the viewer's camera.
|
|
1909
|
+
*
|
|
1910
|
+
* The per-sender lifetime is `LingerOverlay`; this class only validates
|
|
1911
|
+
* payloads and draws one path.
|
|
1912
|
+
*/
|
|
1913
|
+
declare class RemotePathOverlay {
|
|
1914
|
+
private readonly color;
|
|
1915
|
+
private readonly overlay;
|
|
1916
|
+
constructor(host: RemotePathOverlayHost, options?: RemotePathOverlayOptions);
|
|
1917
|
+
private now;
|
|
1918
|
+
/**
|
|
1919
|
+
* Applies a presence payload from `sender` (any opaque per-sender key, e.g.
|
|
1920
|
+
* the envelope `from`). Non-path or malformed payloads are ignored and
|
|
1921
|
+
* reported as `false`, so hosts can feed every presence frame through.
|
|
1922
|
+
*/
|
|
1923
|
+
apply(sender: string, data: unknown): boolean;
|
|
1924
|
+
/** Removes a sender's path immediately (presence-leave/disconnect). */
|
|
1925
|
+
remove(sender: string): void;
|
|
1926
|
+
/** Removes every path immediately. */
|
|
1927
|
+
clear(): void;
|
|
1928
|
+
/** Number of senders with a visible (active or lingering) path. */
|
|
1929
|
+
get activeSenderCount(): number;
|
|
1930
|
+
/** Unregisters the overlay, cancels timers, stops animating. Idempotent. */
|
|
1931
|
+
dispose(): void;
|
|
1602
1932
|
}
|
|
1603
1933
|
|
|
1604
1934
|
/**
|
|
@@ -2232,8 +2562,8 @@ declare class ShapeTool implements Tool {
|
|
|
2232
2562
|
private computeRect;
|
|
2233
2563
|
private notifyOptionsChange;
|
|
2234
2564
|
private snap;
|
|
2235
|
-
private
|
|
2236
|
-
private
|
|
2565
|
+
private trackShiftKeyDown;
|
|
2566
|
+
private trackShiftKeyUp;
|
|
2237
2567
|
}
|
|
2238
2568
|
|
|
2239
2569
|
interface TemplateToolOptions {
|
|
@@ -2281,6 +2611,6 @@ declare class TemplateTool implements Tool {
|
|
|
2281
2611
|
private notifyOptionsChange;
|
|
2282
2612
|
}
|
|
2283
2613
|
|
|
2284
|
-
declare const VERSION = "0.
|
|
2614
|
+
declare const VERSION = "0.64.0";
|
|
2285
2615
|
|
|
2286
|
-
export { type ActivationOptions, type ActiveFormats, type AlignEdge, type ArrowElement, type ArrowStrokeStyle, ArrowTool, type ArrowToolOptions, AutoSave, type AutoSaveOptions, type BackgroundOptions, type BackgroundPattern, type Binding, type Bounds, Camera, type CameraAnimationEndReason, CameraAnimator, type CameraAnimatorOptions, type CameraChangeInfo, type CameraOptions, type CameraView, type CanvasElement, type CanvasState, type Command, DEFAULT_NOTE_FONT_SIZE, type DistributeAxis, type ElementActivationEvent, type ElementChangeMeta, type ElementRect, type ElementRectMatch, type ElementRectMatchError, ElementRectTracker, type ElementRectTrackerOptions, ElementStore, type ElementStyle, type ElementType, type ElementUpdateEvent, EraserTool, type EraserToolOptions, type ExportAssetError, type ExportAssetErrorReason, type ExportImageOptions, type ExportResourceOptions, type ExportSvgOptions, FOCUS_PRESENCE_KIND, type FocusAudience, type FocusPresence, type FocusRole, type FontSizePreset, type FrameScheduler, type GridElement, type GridInfo, HandTool, type HexOrientation, HistoryStack, type HistoryStackOptions, type HitTestOptions, type HtmlElement, type HtmlExportError, type HtmlExportErrorReason, type HtmlExportOptions, type HtmlExportRenderer, type HtmlPaintContext, type HtmlPaintDiagnostic, type HtmlPainter, HtmlPainterMissingError, HtmlPainterRegistry, type HtmlRenderTarget, type HtmlRouting, type ImageElement, ImageTool, type ImageToolOptions, IndexedDBAdapter, type IndexedDBAdapterOptions, LASER_TRAIL_PRESENCE_KIND, LaserTool, type LaserToolOptions, type LaserTrailEmission, type LaserTrailPresence, type Layer, LayerManager, LocalStorageAdapter, MEASURE_PRESENCE_KIND, type MeasureEmission, type MeasurePresence, MeasureTool, type MeasureToolOptions, type Measurement, MemoryAdapter, MinimapController, type MinimapControllerOptions, type NoteElement, NoteTool, type NoteToolOptions, type OverlayRenderer, PING_PRESENCE_KIND, PencilTool, type PencilToolOptions, type PingEmission, PingInput, type PingInputHost, type PingInputOptions, type PingPresence, PingTool, type PingToolOptions, type Point, type PointerState, type RectTrackerHost, RemoteFocusReceiver, type RemoteFocusReceiverHost, type RemoteFocusReceiverOptions, RemoteLaserOverlay, type RemoteLaserOverlayHost, type RemoteLaserOverlayOptions, RemoteMeasureOverlay, type RemoteMeasureOverlayHost, type RemoteMeasureOverlayOptions, RemotePingOverlay, type RemotePingOverlayHost, type RemotePingOverlayOptions, type RenderStatsSnapshot, type RotateDirection, SelectTool, type SelectionStyleDetails, type ShapeElement, type ShapeKind, ShapeTool, type ShapeToolOptions, type ShortcutBindings, type ShortcutOptions, type ShortcutsApi, type Size, type StorageAdapter, type StrokeElement, type StrokePoint, type TemplateElement, type TemplateRenderStyle, type TemplateShape, TemplateTool, type TemplateToolOptions, type TextElement, TextTool, type TextToolOptions, type Tool, type ToolContext, ToolManager, type ToolName, VERSION, Viewport, type ViewportOptions, applyCameraView, boundsIntersect, cameraOriginForView, captureCameraView, computeElementRects, createArrow, createGrid, createHtmlElement, createImage, createNote, createShape, createStroke, createTemplate, createText, drawHexPath, elementRectsEqual, exportImage, exportSvg, fitZoomForView, getActiveFormats, getArrowBounds, getArrowControlPoint, getArrowMidpoint, getArrowTangentAngle, getBendFromPoint, getElementBounds, getElementStyle, getElementsBoundingBox, getHexCellsInCone, getHexCellsInLine, getHexCellsInRadius, getHexCellsInRectangle, getHexCellsInSquare, getHexDistance, isFocusPresence, isLaserTrailPresence, isMeasurePresence, isNearBezier, isPingPresence, resolveHtmlRouting, setFontSize, smartSnap, snapPoint, snapToHexCenter, styleToPatch, toFocusPresence, toLaserTrailPresence, toMeasurePresence, toPingPresence, toggleBold, toggleItalic, toggleStrikethrough, toggleUnderline };
|
|
2616
|
+
export { type ActivationOptions, type ActiveFormats, type AlignEdge, type ArrowElement, type ArrowStrokeStyle, ArrowTool, type ArrowToolOptions, AutoSave, type AutoSaveOptions, type BackgroundOptions, type BackgroundPattern, type Binding, type Bounds, Camera, type CameraAnimationEndReason, CameraAnimator, type CameraAnimatorOptions, type CameraChangeInfo, type CameraOptions, type CameraView, type CanvasElement, type CanvasState, type Command, DEFAULT_NOTE_FONT_SIZE, type DiagonalRule, type DistributeAxis, type ElementActivationEvent, type ElementChangeMeta, type ElementRect, type ElementRectMatch, type ElementRectMatchError, ElementRectTracker, type ElementRectTrackerOptions, ElementStore, type ElementStyle, type ElementType, type ElementUpdateEvent, EraserTool, type EraserToolOptions, type ExportAssetError, type ExportAssetErrorReason, type ExportImageOptions, type ExportResourceOptions, type ExportSvgOptions, FOCUS_PRESENCE_KIND, type FocusAudience, type FocusPresence, type FocusRole, type FontSizePreset, type Footprint, type FrameScheduler, type GridElement, type GridInfo, type GridMetric, HandTool, type HexOrientation, HistoryStack, type HistoryStackOptions, type HitTestOptions, type HtmlElement, type HtmlExportError, type HtmlExportErrorReason, type HtmlExportOptions, type HtmlExportRenderer, type HtmlPaintContext, type HtmlPaintDiagnostic, type HtmlPainter, HtmlPainterMissingError, HtmlPainterRegistry, type HtmlRenderTarget, type HtmlRouting, type ImageElement, ImageTool, type ImageToolOptions, IndexedDBAdapter, type IndexedDBAdapterOptions, LASER_TRAIL_PRESENCE_KIND, LaserTool, type LaserToolOptions, type LaserTrailEmission, type LaserTrailPresence, type Layer, LayerManager, LocalStorageAdapter, MEASURE_PRESENCE_KIND, type MeasureEmission, type MeasurePresence, MeasureTool, type MeasureToolOptions, type Measurement, MemoryAdapter, MinimapController, type MinimapControllerOptions, type NoteElement, NoteTool, type NoteToolOptions, type OverlayRenderer, PATH_PRESENCE_KIND, PATH_PRESENCE_MAX_POINTS, PING_PRESENCE_KIND, type PathAnchor, type PathDistance, type PathEmission, type PathPresence, type PathRangeBand, type PathSegment, PathTool, type PathToolOptions, PencilTool, type PencilToolOptions, type PingEmission, PingInput, type PingInputHost, type PingInputOptions, type PingPresence, PingTool, type PingToolOptions, type Point, type PointerState, type RectTrackerHost, RemoteFocusReceiver, type RemoteFocusReceiverHost, type RemoteFocusReceiverOptions, RemoteLaserOverlay, type RemoteLaserOverlayHost, type RemoteLaserOverlayOptions, RemoteMeasureOverlay, type RemoteMeasureOverlayHost, type RemoteMeasureOverlayOptions, RemotePathOverlay, type RemotePathOverlayHost, type RemotePathOverlayOptions, RemotePingOverlay, type RemotePingOverlayHost, type RemotePingOverlayOptions, type RenderStatsSnapshot, type RotateDirection, SelectTool, type SelectionStyleDetails, type ShapeElement, type ShapeKind, ShapeTool, type ShapeToolOptions, type ShortcutBindings, type ShortcutOptions, type ShortcutsApi, type Size, type StorageAdapter, type StrokeElement, type StrokePoint, type TemplateElement, type TemplateRenderStyle, type TemplateShape, TemplateTool, type TemplateToolOptions, type TextElement, TextTool, type TextToolOptions, type Tool, type ToolContext, ToolManager, type ToolName, VERSION, Viewport, type ViewportOptions, applyCameraView, boundsIntersect, cameraOriginForView, captureCameraView, computeElementRects, createArrow, createGrid, createHtmlElement, createImage, createNote, createShape, createStroke, createTemplate, createText, drawHexPath, elementRectsEqual, exportImage, exportSvg, fitZoomForView, footprintFromSize, getActiveFormats, getArrowBounds, getArrowControlPoint, getArrowMidpoint, getArrowTangentAngle, getBendFromPoint, getElementBounds, getElementStyle, getElementsBoundingBox, getHexCellsInCone, getHexCellsInLine, getHexCellsInRadius, getHexCellsInRectangle, getHexCellsInSquare, getHexDistance, gridDistanceCells, isFocusPresence, isLaserTrailPresence, isMeasurePresence, isNearBezier, isPathPresence, isPingPresence, pathDistanceCells, resolveHtmlRouting, setFontSize, smartSnap, snapFootprintCenter, snapPoint, snapToCellCenter, snapToHexCenter, styleToPatch, toFocusPresence, toLaserTrailPresence, toMeasurePresence, toPathPresence, toPingPresence, toggleBold, toggleItalic, toggleStrikethrough, toggleUnderline };
|