@fieldnotes/core 0.65.0 → 0.66.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 +1268 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +195 -19
- package/dist/index.d.ts +195 -19
- package/dist/index.js +1254 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -267,7 +267,7 @@ interface Tool {
|
|
|
267
267
|
setOptions?(options: object): void;
|
|
268
268
|
onOptionsChange?(listener: () => void): () => void;
|
|
269
269
|
}
|
|
270
|
-
type ToolName = 'hand' | 'select' | 'pencil' | 'eraser' | 'arrow' | 'note' | 'image' | 'text' | 'shape' | 'measure' | 'path' | 'template' | 'laser' | 'ping';
|
|
270
|
+
type ToolName = 'hand' | 'select' | 'pencil' | 'eraser' | 'arrow' | 'note' | 'image' | 'text' | 'shape' | 'measure' | 'path' | 'template' | 'laser' | 'ping' | 'fog';
|
|
271
271
|
|
|
272
272
|
declare function snapPoint(point: Point, gridSize: number): Point;
|
|
273
273
|
declare function snapToHexCenter(point: Point, cellSize: number, orientation: HexOrientation): Point;
|
|
@@ -341,6 +341,61 @@ interface Layer {
|
|
|
341
341
|
opacity: number;
|
|
342
342
|
}
|
|
343
343
|
|
|
344
|
+
declare const FOG_STATE_VERSION = 1;
|
|
345
|
+
declare const FOG_TILE_CELLS = 128;
|
|
346
|
+
declare const FOG_MAX_TILES = 256;
|
|
347
|
+
type FogBase = 'covered' | 'revealed';
|
|
348
|
+
interface FogDefinitionV1 {
|
|
349
|
+
readonly version: 1;
|
|
350
|
+
readonly generation: string;
|
|
351
|
+
readonly bounds: Bounds;
|
|
352
|
+
readonly cellSize: number;
|
|
353
|
+
readonly tileCells: 128;
|
|
354
|
+
readonly base: FogBase;
|
|
355
|
+
}
|
|
356
|
+
interface FogTileV1 {
|
|
357
|
+
readonly x: number;
|
|
358
|
+
readonly y: number;
|
|
359
|
+
readonly data: string;
|
|
360
|
+
}
|
|
361
|
+
interface FogStateV1 {
|
|
362
|
+
readonly definition: FogDefinitionV1;
|
|
363
|
+
readonly tiles: readonly FogTileV1[];
|
|
364
|
+
}
|
|
365
|
+
type FogViewMode = 'off' | 'editor' | 'player';
|
|
366
|
+
type FogOperation = 'reveal' | 'conceal';
|
|
367
|
+
type FogRegion = {
|
|
368
|
+
kind: 'brush';
|
|
369
|
+
points: readonly Point[];
|
|
370
|
+
radius: number;
|
|
371
|
+
} | {
|
|
372
|
+
kind: 'rectangle';
|
|
373
|
+
from: Point;
|
|
374
|
+
to: Point;
|
|
375
|
+
} | {
|
|
376
|
+
kind: 'polygon';
|
|
377
|
+
points: readonly Point[];
|
|
378
|
+
};
|
|
379
|
+
interface FogToolOptions {
|
|
380
|
+
operation?: FogOperation;
|
|
381
|
+
shape?: 'brush' | 'rectangle' | 'polygon';
|
|
382
|
+
radius?: number;
|
|
383
|
+
}
|
|
384
|
+
interface FogPatch {
|
|
385
|
+
readonly tiles: readonly FogTileV1[];
|
|
386
|
+
}
|
|
387
|
+
interface FogChangeEvent {
|
|
388
|
+
readonly kind: 'tiles' | 'definition' | 'reset' | 'disable';
|
|
389
|
+
readonly tiles?: readonly {
|
|
390
|
+
readonly x: number;
|
|
391
|
+
readonly y: number;
|
|
392
|
+
}[];
|
|
393
|
+
readonly origin?: string;
|
|
394
|
+
}
|
|
395
|
+
interface FogViewEvent {
|
|
396
|
+
readonly mode: FogViewMode;
|
|
397
|
+
}
|
|
398
|
+
|
|
344
399
|
interface CanvasState {
|
|
345
400
|
version: number;
|
|
346
401
|
camera: {
|
|
@@ -350,6 +405,7 @@ interface CanvasState {
|
|
|
350
405
|
elements: CanvasElement[];
|
|
351
406
|
layers?: Layer[];
|
|
352
407
|
activeLayerId?: string;
|
|
408
|
+
fog?: FogStateV1;
|
|
353
409
|
}
|
|
354
410
|
|
|
355
411
|
interface LayerManagerEvents {
|
|
@@ -392,6 +448,55 @@ declare class LayerManager {
|
|
|
392
448
|
private findFallbackLayer;
|
|
393
449
|
}
|
|
394
450
|
|
|
451
|
+
interface Command {
|
|
452
|
+
execute(store: ElementStore): void;
|
|
453
|
+
undo(store: ElementStore): void;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
type FogIdFactory = () => string;
|
|
457
|
+
interface FogManagerOptions {
|
|
458
|
+
idFactory?: FogIdFactory;
|
|
459
|
+
onCommand?: (command: Command) => void;
|
|
460
|
+
}
|
|
461
|
+
type ChangeListener = (event: FogChangeEvent) => void;
|
|
462
|
+
type ViewListener = (event: FogViewEvent) => void;
|
|
463
|
+
declare class FogManager {
|
|
464
|
+
private state;
|
|
465
|
+
private viewMode;
|
|
466
|
+
private readonly idFactory;
|
|
467
|
+
private readonly onCommand;
|
|
468
|
+
private readonly changeListeners;
|
|
469
|
+
private readonly viewListeners;
|
|
470
|
+
constructor(options?: FogManagerOptions);
|
|
471
|
+
getState(): FogStateV1 | null;
|
|
472
|
+
getViewMode(): FogViewMode;
|
|
473
|
+
initialize(options: {
|
|
474
|
+
bounds: Bounds;
|
|
475
|
+
base?: FogBase;
|
|
476
|
+
cellSize?: number;
|
|
477
|
+
}): FogStateV1;
|
|
478
|
+
loadState(state: FogStateV1 | null, meta?: {
|
|
479
|
+
origin?: string;
|
|
480
|
+
}): void;
|
|
481
|
+
/** Restores a historical visual state without reusing its causal generation id. */
|
|
482
|
+
restoreHistoryState(state: FogStateV1 | null): void;
|
|
483
|
+
setBounds(bounds: Bounds): void;
|
|
484
|
+
reset(base: FogBase): void;
|
|
485
|
+
disable(): void;
|
|
486
|
+
setViewMode(mode: FogViewMode): void;
|
|
487
|
+
applyRegion(region: FogRegion, operation: FogOperation): void;
|
|
488
|
+
applyPatchDirect(patch: FogPatch, meta?: {
|
|
489
|
+
origin?: string;
|
|
490
|
+
}): void;
|
|
491
|
+
applyTilesDirect(tiles: readonly FogTileV1[]): void;
|
|
492
|
+
on(event: 'change', listener: ChangeListener): () => void;
|
|
493
|
+
on(event: 'view', listener: ViewListener): () => void;
|
|
494
|
+
dispose(): void;
|
|
495
|
+
private collectTiles;
|
|
496
|
+
private notifyChange;
|
|
497
|
+
private notifyView;
|
|
498
|
+
}
|
|
499
|
+
|
|
395
500
|
interface StorageAdapter {
|
|
396
501
|
load(key: string): Promise<string | null>;
|
|
397
502
|
save(key: string, value: string): Promise<void>;
|
|
@@ -402,6 +507,7 @@ interface AutoSaveOptions {
|
|
|
402
507
|
key?: string;
|
|
403
508
|
debounceMs?: number;
|
|
404
509
|
layerManager?: LayerManager;
|
|
510
|
+
fogManager?: FogManager;
|
|
405
511
|
adapter?: StorageAdapter;
|
|
406
512
|
onError?: (error: Error) => void;
|
|
407
513
|
}
|
|
@@ -411,6 +517,7 @@ declare class AutoSave {
|
|
|
411
517
|
private readonly key;
|
|
412
518
|
private readonly debounceMs;
|
|
413
519
|
private readonly layerManager?;
|
|
520
|
+
private readonly fogManager?;
|
|
414
521
|
private readonly adapter;
|
|
415
522
|
private timerId;
|
|
416
523
|
private unsubscribers;
|
|
@@ -502,11 +609,6 @@ declare class ToolManager {
|
|
|
502
609
|
onRegister(listener: (tool: Tool) => void): () => void;
|
|
503
610
|
}
|
|
504
611
|
|
|
505
|
-
interface Command {
|
|
506
|
-
execute(store: ElementStore): void;
|
|
507
|
-
undo(store: ElementStore): void;
|
|
508
|
-
}
|
|
509
|
-
|
|
510
612
|
interface HistoryStackOptions {
|
|
511
613
|
maxSize?: number;
|
|
512
614
|
}
|
|
@@ -635,6 +737,11 @@ interface ExportImageOptions extends ExportResourceOptions, HtmlExportOptions {
|
|
|
635
737
|
* a non-fatal `'unsupported'` diagnostic regardless of this flag.
|
|
636
738
|
*/
|
|
637
739
|
strictMissingCanvasHtml?: boolean;
|
|
740
|
+
fog?: {
|
|
741
|
+
state: FogStateV1;
|
|
742
|
+
mode: 'editor' | 'player';
|
|
743
|
+
color?: string;
|
|
744
|
+
} | false;
|
|
638
745
|
}
|
|
639
746
|
type ExportAssetErrorReason = 'load' | 'timeout' | 'encode';
|
|
640
747
|
interface ExportAssetError {
|
|
@@ -660,20 +767,14 @@ interface ExportSvgOptions extends ExportResourceOptions, HtmlExportOptions {
|
|
|
660
767
|
background?: string;
|
|
661
768
|
filter?: (el: CanvasElement) => boolean;
|
|
662
769
|
rasterScale?: number;
|
|
663
|
-
/** Registry of canvas-backed html painters, keyed by `htmlType`. When absent (or when
|
|
664
|
-
* an element's `htmlType` isn't claimed), html elements fall back to the legacy
|
|
665
|
-
* DOM-raster path (`renderHtml`). */
|
|
666
770
|
htmlPainters?: HtmlPainterRegistry;
|
|
667
|
-
/** `htmlType`s that must route to canvas even before a painter for them is
|
|
668
|
-
* registered — lets a host declare intent up front (mirrors `HtmlPainterRegistry.expect`). */
|
|
669
771
|
expectedCanvasTypes?: ReadonlySet<string>;
|
|
670
|
-
/**
|
|
671
|
-
* When true, a canvas-routed html element with no active painter throws
|
|
672
|
-
* `HtmlPainterMissingError` instead of reporting `onHtmlError` and continuing.
|
|
673
|
-
* DOM-routed html elements are never affected — a missing `renderHtml` stays
|
|
674
|
-
* a non-fatal `'unsupported'` diagnostic regardless of this flag.
|
|
675
|
-
*/
|
|
676
772
|
strictMissingCanvasHtml?: boolean;
|
|
773
|
+
fog?: {
|
|
774
|
+
state: FogStateV1;
|
|
775
|
+
mode: 'editor' | 'player';
|
|
776
|
+
color?: string;
|
|
777
|
+
} | false;
|
|
677
778
|
}
|
|
678
779
|
declare function exportSvg(store: ElementStore, options?: ExportSvgOptions, layerManager?: LayerManager): Promise<string>;
|
|
679
780
|
|
|
@@ -699,6 +800,33 @@ interface RenderStatsSnapshot {
|
|
|
699
800
|
frameCount: number;
|
|
700
801
|
}
|
|
701
802
|
|
|
803
|
+
interface FogRendererOptions {
|
|
804
|
+
editorColor?: string;
|
|
805
|
+
playerColor?: string;
|
|
806
|
+
}
|
|
807
|
+
declare class FogRenderer {
|
|
808
|
+
private tileCache;
|
|
809
|
+
private state;
|
|
810
|
+
private viewMode;
|
|
811
|
+
private dirty;
|
|
812
|
+
private editorColor;
|
|
813
|
+
private playerColor;
|
|
814
|
+
constructor(options?: FogRendererOptions);
|
|
815
|
+
setState(state: FogStateV1 | null): void;
|
|
816
|
+
setViewMode(mode: FogViewMode): void;
|
|
817
|
+
getState(): FogStateV1 | null;
|
|
818
|
+
getViewMode(): FogViewMode;
|
|
819
|
+
markDirty(): void;
|
|
820
|
+
isDirty(): boolean;
|
|
821
|
+
isVisible(): boolean;
|
|
822
|
+
render(ctx: CanvasRenderingContext2D, camera: Camera, viewportWidth: number, viewportHeight: number, _dpr: number): void;
|
|
823
|
+
renderForExport(ctx: CanvasRenderingContext2D, state: FogStateV1, mode: 'editor' | 'player', color?: string): void;
|
|
824
|
+
dispose(): void;
|
|
825
|
+
private tileRaster;
|
|
826
|
+
private renderTile;
|
|
827
|
+
private renderTileForExport;
|
|
828
|
+
}
|
|
829
|
+
|
|
702
830
|
/**
|
|
703
831
|
* A world-space draw callback rendered above elements on every frame,
|
|
704
832
|
* regardless of which tool is active. The context arrives with the camera
|
|
@@ -789,6 +917,11 @@ interface ViewportOptions {
|
|
|
789
917
|
panInertia?: boolean;
|
|
790
918
|
/** Show an overview minimap (bottom-right) with tap/drag-to-navigate. Default `false`. */
|
|
791
919
|
minimap?: boolean;
|
|
920
|
+
/** Fog-of-war presentation options. Enables fog rendering and the `fog` accessor. */
|
|
921
|
+
fog?: {
|
|
922
|
+
editorColor?: string;
|
|
923
|
+
playerColor?: string;
|
|
924
|
+
};
|
|
792
925
|
}
|
|
793
926
|
interface HitTestOptions {
|
|
794
927
|
/** Skip elements on locked layers. Default `true` (selection semantics). */
|
|
@@ -825,6 +958,8 @@ declare class Viewport {
|
|
|
825
958
|
private _smartGuides;
|
|
826
959
|
private readonly _gridSize;
|
|
827
960
|
private readonly renderLoop;
|
|
961
|
+
private readonly fogManager;
|
|
962
|
+
private readonly fogRenderer;
|
|
828
963
|
private readonly domNodeManager;
|
|
829
964
|
private readonly interactMode;
|
|
830
965
|
private readonly onHtmlElementMount?;
|
|
@@ -850,6 +985,7 @@ declare class Viewport {
|
|
|
850
985
|
private unsubRecorderEnd;
|
|
851
986
|
constructor(container: HTMLElement, options?: ViewportOptions);
|
|
852
987
|
get ctx(): CanvasRenderingContext2D | null;
|
|
988
|
+
get fog(): FogManager;
|
|
853
989
|
get snapToGrid(): boolean;
|
|
854
990
|
setSnapToGrid(enabled: boolean): void;
|
|
855
991
|
get smartGuides(): boolean;
|
|
@@ -2087,6 +2223,8 @@ declare class MinimapController {
|
|
|
2087
2223
|
private readonly renderer;
|
|
2088
2224
|
private readonly htmlPainters;
|
|
2089
2225
|
private scene;
|
|
2226
|
+
private fogRenderer;
|
|
2227
|
+
private fogUnsub;
|
|
2090
2228
|
private frameId;
|
|
2091
2229
|
private debounceTimer;
|
|
2092
2230
|
private dragging;
|
|
@@ -2094,6 +2232,7 @@ declare class MinimapController {
|
|
|
2094
2232
|
private readonly unsubs;
|
|
2095
2233
|
constructor(viewport: Viewport, canvas: HTMLCanvasElement, options?: MinimapControllerOptions);
|
|
2096
2234
|
setSize(width: number, height: number): void;
|
|
2235
|
+
setFogRenderer(renderer: FogRenderer | null): void;
|
|
2097
2236
|
requestDraw(): void;
|
|
2098
2237
|
/**
|
|
2099
2238
|
* Invalidates the cached scene bitmap in response to html-painter registry
|
|
@@ -3039,6 +3178,43 @@ declare class TemplateTool implements Tool {
|
|
|
3039
3178
|
private notifyOptionsChange;
|
|
3040
3179
|
}
|
|
3041
3180
|
|
|
3042
|
-
declare
|
|
3181
|
+
declare function encodeBase64(bytes: Uint8Array): string;
|
|
3182
|
+
declare function decodeBase64(str: string): Uint8Array;
|
|
3183
|
+
declare function canonicalizeFogTile(tile: FogTileV1, def: FogDefinitionV1): FogTileV1 | null;
|
|
3184
|
+
declare function validateFogDefinition(def: unknown): asserts def is FogDefinitionV1;
|
|
3185
|
+
declare function validateFogTile(tile: unknown, def: FogDefinitionV1): asserts tile is FogTileV1;
|
|
3186
|
+
declare function validateFogState(state: unknown): asserts state is FogStateV1;
|
|
3187
|
+
declare function recommendedFogCellSize(bounds: Bounds): number;
|
|
3188
|
+
|
|
3189
|
+
declare class FogTool implements Tool {
|
|
3190
|
+
readonly name = "fog";
|
|
3191
|
+
private drawing;
|
|
3192
|
+
private points;
|
|
3193
|
+
private startPoint;
|
|
3194
|
+
private operation;
|
|
3195
|
+
private shape;
|
|
3196
|
+
private radius;
|
|
3197
|
+
private readonly manager;
|
|
3198
|
+
private optionListeners;
|
|
3199
|
+
constructor(manager: FogManager, options?: FogToolOptions);
|
|
3200
|
+
onActivate(ctx: ToolContext): void;
|
|
3201
|
+
onDeactivate(ctx: ToolContext): void;
|
|
3202
|
+
getOptions(): FogToolOptions;
|
|
3203
|
+
setOptions(options: FogToolOptions): void;
|
|
3204
|
+
onOptionsChange(listener: () => void): () => void;
|
|
3205
|
+
onPointerDown(state: PointerState, ctx: ToolContext): void;
|
|
3206
|
+
onPointerMove(state: PointerState, ctx: ToolContext): void;
|
|
3207
|
+
onPointerUp(_state: PointerState, ctx: ToolContext): void;
|
|
3208
|
+
onPointerCancel(_state: PointerState, ctx: ToolContext): void;
|
|
3209
|
+
onKeyDown(event: KeyboardEvent, ctx: ToolContext): boolean;
|
|
3210
|
+
renderOverlay(ctx: CanvasRenderingContext2D): void;
|
|
3211
|
+
private buildRegion;
|
|
3212
|
+
private cancelGesture;
|
|
3213
|
+
private renderBrushPreview;
|
|
3214
|
+
private renderRectanglePreview;
|
|
3215
|
+
private renderPolygonPreview;
|
|
3216
|
+
}
|
|
3217
|
+
|
|
3218
|
+
declare const VERSION = "0.66.0";
|
|
3043
3219
|
|
|
3044
|
-
export { AWARENESS_MAX_SELECTION, AWARENESS_PRESENCE_KIND, type ActivationOptions, type ActiveFormats, type AlignEdge, type ArrowElement, type ArrowStrokeStyle, ArrowTool, type ArrowToolOptions, type AttachAwarenessOptions, AutoSave, type AutoSaveOptions, type AwarenessFields, type AwarenessHandle, type AwarenessIdentity, type AwarenessPresence, type AwarenessViewport, 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, LocalAwareness, type LocalAwarenessHost, type LocalAwarenessOptions, 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, PEER_COLORS, PING_PRESENCE_KIND, type PathAnchor, type PathDistance, type PathEmission, type PathPresence, type PathRangeBand, type PathSegment, PathTool, type PathToolOptions, type Peer, type PeerLeaveReason, PeerRoster, type PeerRosterOptions, PencilTool, type PencilToolOptions, type PingEmission, PingInput, type PingInputHost, type PingInputOptions, type PingPresence, PingTool, type PingToolOptions, type Point, type PointerState, type PresenceChannel, type RectTrackerHost, RemoteCursorOverlay, type RemoteCursorOverlayHost, type RemoteCursorOverlayOptions, 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, RemoteSelectionOverlay, type RemoteSelectionOverlayHost, type RemoteSelectionOverlayOptions, 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, attachAwareness, boundsIntersect, cameraOriginForView, captureCameraView, computeElementRects, createArrow, createGrid, createHtmlElement, createImage, createNote, createShape, createStroke, createTemplate, createText, defaultPeerColor, drawHexPath, elementRectsEqual, exportImage, exportSvg, fitZoomForView, footprintFromSize, getActiveFormats, getArrowBounds, getArrowControlPoint, getArrowMidpoint, getArrowTangentAngle, getBendFromPoint, getElementBounds, getElementStyle, getElementsBoundingBox, getHexCellsInCone, getHexCellsInLine, getHexCellsInRadius, getHexCellsInRectangle, getHexCellsInSquare, getHexDistance, gridDistanceCells, isAwarenessPresence, isFocusPresence, isLaserTrailPresence, isMeasurePresence, isNearBezier, isPathPresence, isPingPresence, pathDistanceCells, resolveHtmlRouting, setFontSize, smartSnap, snapFootprintCenter, snapPoint, snapToCellCenter, snapToHexCenter, styleToPatch, toFocusPresence, toLaserTrailPresence, toMeasurePresence, toPathPresence, toPingPresence, toggleBold, toggleItalic, toggleStrikethrough, toggleUnderline };
|
|
3220
|
+
export { AWARENESS_MAX_SELECTION, AWARENESS_PRESENCE_KIND, type ActivationOptions, type ActiveFormats, type AlignEdge, type ArrowElement, type ArrowStrokeStyle, ArrowTool, type ArrowToolOptions, type AttachAwarenessOptions, AutoSave, type AutoSaveOptions, type AwarenessFields, type AwarenessHandle, type AwarenessIdentity, type AwarenessPresence, type AwarenessViewport, 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, FOG_MAX_TILES, FOG_STATE_VERSION, FOG_TILE_CELLS, type FocusAudience, type FocusPresence, type FocusRole, type FogBase, type FogChangeEvent, type FogDefinitionV1, type FogIdFactory, FogManager, type FogManagerOptions, type FogOperation, type FogPatch, type FogRegion, FogRenderer, type FogRendererOptions, type FogStateV1, type FogTileV1, FogTool, type FogToolOptions, type FogViewEvent, type FogViewMode, 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, LocalAwareness, type LocalAwarenessHost, type LocalAwarenessOptions, 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, PEER_COLORS, PING_PRESENCE_KIND, type PathAnchor, type PathDistance, type PathEmission, type PathPresence, type PathRangeBand, type PathSegment, PathTool, type PathToolOptions, type Peer, type PeerLeaveReason, PeerRoster, type PeerRosterOptions, PencilTool, type PencilToolOptions, type PingEmission, PingInput, type PingInputHost, type PingInputOptions, type PingPresence, PingTool, type PingToolOptions, type Point, type PointerState, type PresenceChannel, type RectTrackerHost, RemoteCursorOverlay, type RemoteCursorOverlayHost, type RemoteCursorOverlayOptions, 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, RemoteSelectionOverlay, type RemoteSelectionOverlayHost, type RemoteSelectionOverlayOptions, 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, attachAwareness, boundsIntersect, cameraOriginForView, canonicalizeFogTile, captureCameraView, computeElementRects, createArrow, createGrid, createHtmlElement, createImage, createNote, createShape, createStroke, createTemplate, createText, defaultPeerColor, drawHexPath, elementRectsEqual, exportImage, exportSvg, fitZoomForView, decodeBase64 as fogDecodeBase64, encodeBase64 as fogEncodeBase64, footprintFromSize, getActiveFormats, getArrowBounds, getArrowControlPoint, getArrowMidpoint, getArrowTangentAngle, getBendFromPoint, getElementBounds, getElementStyle, getElementsBoundingBox, getHexCellsInCone, getHexCellsInLine, getHexCellsInRadius, getHexCellsInRectangle, getHexCellsInSquare, getHexDistance, gridDistanceCells, isAwarenessPresence, isFocusPresence, isLaserTrailPresence, isMeasurePresence, isNearBezier, isPathPresence, isPingPresence, pathDistanceCells, recommendedFogCellSize, resolveHtmlRouting, setFontSize, smartSnap, snapFootprintCenter, snapPoint, snapToCellCenter, snapToHexCenter, styleToPatch, toFocusPresence, toLaserTrailPresence, toMeasurePresence, toPathPresence, toPingPresence, toggleBold, toggleItalic, toggleStrikethrough, toggleUnderline, validateFogDefinition, validateFogState, validateFogTile };
|
package/dist/index.d.ts
CHANGED
|
@@ -267,7 +267,7 @@ interface Tool {
|
|
|
267
267
|
setOptions?(options: object): void;
|
|
268
268
|
onOptionsChange?(listener: () => void): () => void;
|
|
269
269
|
}
|
|
270
|
-
type ToolName = 'hand' | 'select' | 'pencil' | 'eraser' | 'arrow' | 'note' | 'image' | 'text' | 'shape' | 'measure' | 'path' | 'template' | 'laser' | 'ping';
|
|
270
|
+
type ToolName = 'hand' | 'select' | 'pencil' | 'eraser' | 'arrow' | 'note' | 'image' | 'text' | 'shape' | 'measure' | 'path' | 'template' | 'laser' | 'ping' | 'fog';
|
|
271
271
|
|
|
272
272
|
declare function snapPoint(point: Point, gridSize: number): Point;
|
|
273
273
|
declare function snapToHexCenter(point: Point, cellSize: number, orientation: HexOrientation): Point;
|
|
@@ -341,6 +341,61 @@ interface Layer {
|
|
|
341
341
|
opacity: number;
|
|
342
342
|
}
|
|
343
343
|
|
|
344
|
+
declare const FOG_STATE_VERSION = 1;
|
|
345
|
+
declare const FOG_TILE_CELLS = 128;
|
|
346
|
+
declare const FOG_MAX_TILES = 256;
|
|
347
|
+
type FogBase = 'covered' | 'revealed';
|
|
348
|
+
interface FogDefinitionV1 {
|
|
349
|
+
readonly version: 1;
|
|
350
|
+
readonly generation: string;
|
|
351
|
+
readonly bounds: Bounds;
|
|
352
|
+
readonly cellSize: number;
|
|
353
|
+
readonly tileCells: 128;
|
|
354
|
+
readonly base: FogBase;
|
|
355
|
+
}
|
|
356
|
+
interface FogTileV1 {
|
|
357
|
+
readonly x: number;
|
|
358
|
+
readonly y: number;
|
|
359
|
+
readonly data: string;
|
|
360
|
+
}
|
|
361
|
+
interface FogStateV1 {
|
|
362
|
+
readonly definition: FogDefinitionV1;
|
|
363
|
+
readonly tiles: readonly FogTileV1[];
|
|
364
|
+
}
|
|
365
|
+
type FogViewMode = 'off' | 'editor' | 'player';
|
|
366
|
+
type FogOperation = 'reveal' | 'conceal';
|
|
367
|
+
type FogRegion = {
|
|
368
|
+
kind: 'brush';
|
|
369
|
+
points: readonly Point[];
|
|
370
|
+
radius: number;
|
|
371
|
+
} | {
|
|
372
|
+
kind: 'rectangle';
|
|
373
|
+
from: Point;
|
|
374
|
+
to: Point;
|
|
375
|
+
} | {
|
|
376
|
+
kind: 'polygon';
|
|
377
|
+
points: readonly Point[];
|
|
378
|
+
};
|
|
379
|
+
interface FogToolOptions {
|
|
380
|
+
operation?: FogOperation;
|
|
381
|
+
shape?: 'brush' | 'rectangle' | 'polygon';
|
|
382
|
+
radius?: number;
|
|
383
|
+
}
|
|
384
|
+
interface FogPatch {
|
|
385
|
+
readonly tiles: readonly FogTileV1[];
|
|
386
|
+
}
|
|
387
|
+
interface FogChangeEvent {
|
|
388
|
+
readonly kind: 'tiles' | 'definition' | 'reset' | 'disable';
|
|
389
|
+
readonly tiles?: readonly {
|
|
390
|
+
readonly x: number;
|
|
391
|
+
readonly y: number;
|
|
392
|
+
}[];
|
|
393
|
+
readonly origin?: string;
|
|
394
|
+
}
|
|
395
|
+
interface FogViewEvent {
|
|
396
|
+
readonly mode: FogViewMode;
|
|
397
|
+
}
|
|
398
|
+
|
|
344
399
|
interface CanvasState {
|
|
345
400
|
version: number;
|
|
346
401
|
camera: {
|
|
@@ -350,6 +405,7 @@ interface CanvasState {
|
|
|
350
405
|
elements: CanvasElement[];
|
|
351
406
|
layers?: Layer[];
|
|
352
407
|
activeLayerId?: string;
|
|
408
|
+
fog?: FogStateV1;
|
|
353
409
|
}
|
|
354
410
|
|
|
355
411
|
interface LayerManagerEvents {
|
|
@@ -392,6 +448,55 @@ declare class LayerManager {
|
|
|
392
448
|
private findFallbackLayer;
|
|
393
449
|
}
|
|
394
450
|
|
|
451
|
+
interface Command {
|
|
452
|
+
execute(store: ElementStore): void;
|
|
453
|
+
undo(store: ElementStore): void;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
type FogIdFactory = () => string;
|
|
457
|
+
interface FogManagerOptions {
|
|
458
|
+
idFactory?: FogIdFactory;
|
|
459
|
+
onCommand?: (command: Command) => void;
|
|
460
|
+
}
|
|
461
|
+
type ChangeListener = (event: FogChangeEvent) => void;
|
|
462
|
+
type ViewListener = (event: FogViewEvent) => void;
|
|
463
|
+
declare class FogManager {
|
|
464
|
+
private state;
|
|
465
|
+
private viewMode;
|
|
466
|
+
private readonly idFactory;
|
|
467
|
+
private readonly onCommand;
|
|
468
|
+
private readonly changeListeners;
|
|
469
|
+
private readonly viewListeners;
|
|
470
|
+
constructor(options?: FogManagerOptions);
|
|
471
|
+
getState(): FogStateV1 | null;
|
|
472
|
+
getViewMode(): FogViewMode;
|
|
473
|
+
initialize(options: {
|
|
474
|
+
bounds: Bounds;
|
|
475
|
+
base?: FogBase;
|
|
476
|
+
cellSize?: number;
|
|
477
|
+
}): FogStateV1;
|
|
478
|
+
loadState(state: FogStateV1 | null, meta?: {
|
|
479
|
+
origin?: string;
|
|
480
|
+
}): void;
|
|
481
|
+
/** Restores a historical visual state without reusing its causal generation id. */
|
|
482
|
+
restoreHistoryState(state: FogStateV1 | null): void;
|
|
483
|
+
setBounds(bounds: Bounds): void;
|
|
484
|
+
reset(base: FogBase): void;
|
|
485
|
+
disable(): void;
|
|
486
|
+
setViewMode(mode: FogViewMode): void;
|
|
487
|
+
applyRegion(region: FogRegion, operation: FogOperation): void;
|
|
488
|
+
applyPatchDirect(patch: FogPatch, meta?: {
|
|
489
|
+
origin?: string;
|
|
490
|
+
}): void;
|
|
491
|
+
applyTilesDirect(tiles: readonly FogTileV1[]): void;
|
|
492
|
+
on(event: 'change', listener: ChangeListener): () => void;
|
|
493
|
+
on(event: 'view', listener: ViewListener): () => void;
|
|
494
|
+
dispose(): void;
|
|
495
|
+
private collectTiles;
|
|
496
|
+
private notifyChange;
|
|
497
|
+
private notifyView;
|
|
498
|
+
}
|
|
499
|
+
|
|
395
500
|
interface StorageAdapter {
|
|
396
501
|
load(key: string): Promise<string | null>;
|
|
397
502
|
save(key: string, value: string): Promise<void>;
|
|
@@ -402,6 +507,7 @@ interface AutoSaveOptions {
|
|
|
402
507
|
key?: string;
|
|
403
508
|
debounceMs?: number;
|
|
404
509
|
layerManager?: LayerManager;
|
|
510
|
+
fogManager?: FogManager;
|
|
405
511
|
adapter?: StorageAdapter;
|
|
406
512
|
onError?: (error: Error) => void;
|
|
407
513
|
}
|
|
@@ -411,6 +517,7 @@ declare class AutoSave {
|
|
|
411
517
|
private readonly key;
|
|
412
518
|
private readonly debounceMs;
|
|
413
519
|
private readonly layerManager?;
|
|
520
|
+
private readonly fogManager?;
|
|
414
521
|
private readonly adapter;
|
|
415
522
|
private timerId;
|
|
416
523
|
private unsubscribers;
|
|
@@ -502,11 +609,6 @@ declare class ToolManager {
|
|
|
502
609
|
onRegister(listener: (tool: Tool) => void): () => void;
|
|
503
610
|
}
|
|
504
611
|
|
|
505
|
-
interface Command {
|
|
506
|
-
execute(store: ElementStore): void;
|
|
507
|
-
undo(store: ElementStore): void;
|
|
508
|
-
}
|
|
509
|
-
|
|
510
612
|
interface HistoryStackOptions {
|
|
511
613
|
maxSize?: number;
|
|
512
614
|
}
|
|
@@ -635,6 +737,11 @@ interface ExportImageOptions extends ExportResourceOptions, HtmlExportOptions {
|
|
|
635
737
|
* a non-fatal `'unsupported'` diagnostic regardless of this flag.
|
|
636
738
|
*/
|
|
637
739
|
strictMissingCanvasHtml?: boolean;
|
|
740
|
+
fog?: {
|
|
741
|
+
state: FogStateV1;
|
|
742
|
+
mode: 'editor' | 'player';
|
|
743
|
+
color?: string;
|
|
744
|
+
} | false;
|
|
638
745
|
}
|
|
639
746
|
type ExportAssetErrorReason = 'load' | 'timeout' | 'encode';
|
|
640
747
|
interface ExportAssetError {
|
|
@@ -660,20 +767,14 @@ interface ExportSvgOptions extends ExportResourceOptions, HtmlExportOptions {
|
|
|
660
767
|
background?: string;
|
|
661
768
|
filter?: (el: CanvasElement) => boolean;
|
|
662
769
|
rasterScale?: number;
|
|
663
|
-
/** Registry of canvas-backed html painters, keyed by `htmlType`. When absent (or when
|
|
664
|
-
* an element's `htmlType` isn't claimed), html elements fall back to the legacy
|
|
665
|
-
* DOM-raster path (`renderHtml`). */
|
|
666
770
|
htmlPainters?: HtmlPainterRegistry;
|
|
667
|
-
/** `htmlType`s that must route to canvas even before a painter for them is
|
|
668
|
-
* registered — lets a host declare intent up front (mirrors `HtmlPainterRegistry.expect`). */
|
|
669
771
|
expectedCanvasTypes?: ReadonlySet<string>;
|
|
670
|
-
/**
|
|
671
|
-
* When true, a canvas-routed html element with no active painter throws
|
|
672
|
-
* `HtmlPainterMissingError` instead of reporting `onHtmlError` and continuing.
|
|
673
|
-
* DOM-routed html elements are never affected — a missing `renderHtml` stays
|
|
674
|
-
* a non-fatal `'unsupported'` diagnostic regardless of this flag.
|
|
675
|
-
*/
|
|
676
772
|
strictMissingCanvasHtml?: boolean;
|
|
773
|
+
fog?: {
|
|
774
|
+
state: FogStateV1;
|
|
775
|
+
mode: 'editor' | 'player';
|
|
776
|
+
color?: string;
|
|
777
|
+
} | false;
|
|
677
778
|
}
|
|
678
779
|
declare function exportSvg(store: ElementStore, options?: ExportSvgOptions, layerManager?: LayerManager): Promise<string>;
|
|
679
780
|
|
|
@@ -699,6 +800,33 @@ interface RenderStatsSnapshot {
|
|
|
699
800
|
frameCount: number;
|
|
700
801
|
}
|
|
701
802
|
|
|
803
|
+
interface FogRendererOptions {
|
|
804
|
+
editorColor?: string;
|
|
805
|
+
playerColor?: string;
|
|
806
|
+
}
|
|
807
|
+
declare class FogRenderer {
|
|
808
|
+
private tileCache;
|
|
809
|
+
private state;
|
|
810
|
+
private viewMode;
|
|
811
|
+
private dirty;
|
|
812
|
+
private editorColor;
|
|
813
|
+
private playerColor;
|
|
814
|
+
constructor(options?: FogRendererOptions);
|
|
815
|
+
setState(state: FogStateV1 | null): void;
|
|
816
|
+
setViewMode(mode: FogViewMode): void;
|
|
817
|
+
getState(): FogStateV1 | null;
|
|
818
|
+
getViewMode(): FogViewMode;
|
|
819
|
+
markDirty(): void;
|
|
820
|
+
isDirty(): boolean;
|
|
821
|
+
isVisible(): boolean;
|
|
822
|
+
render(ctx: CanvasRenderingContext2D, camera: Camera, viewportWidth: number, viewportHeight: number, _dpr: number): void;
|
|
823
|
+
renderForExport(ctx: CanvasRenderingContext2D, state: FogStateV1, mode: 'editor' | 'player', color?: string): void;
|
|
824
|
+
dispose(): void;
|
|
825
|
+
private tileRaster;
|
|
826
|
+
private renderTile;
|
|
827
|
+
private renderTileForExport;
|
|
828
|
+
}
|
|
829
|
+
|
|
702
830
|
/**
|
|
703
831
|
* A world-space draw callback rendered above elements on every frame,
|
|
704
832
|
* regardless of which tool is active. The context arrives with the camera
|
|
@@ -789,6 +917,11 @@ interface ViewportOptions {
|
|
|
789
917
|
panInertia?: boolean;
|
|
790
918
|
/** Show an overview minimap (bottom-right) with tap/drag-to-navigate. Default `false`. */
|
|
791
919
|
minimap?: boolean;
|
|
920
|
+
/** Fog-of-war presentation options. Enables fog rendering and the `fog` accessor. */
|
|
921
|
+
fog?: {
|
|
922
|
+
editorColor?: string;
|
|
923
|
+
playerColor?: string;
|
|
924
|
+
};
|
|
792
925
|
}
|
|
793
926
|
interface HitTestOptions {
|
|
794
927
|
/** Skip elements on locked layers. Default `true` (selection semantics). */
|
|
@@ -825,6 +958,8 @@ declare class Viewport {
|
|
|
825
958
|
private _smartGuides;
|
|
826
959
|
private readonly _gridSize;
|
|
827
960
|
private readonly renderLoop;
|
|
961
|
+
private readonly fogManager;
|
|
962
|
+
private readonly fogRenderer;
|
|
828
963
|
private readonly domNodeManager;
|
|
829
964
|
private readonly interactMode;
|
|
830
965
|
private readonly onHtmlElementMount?;
|
|
@@ -850,6 +985,7 @@ declare class Viewport {
|
|
|
850
985
|
private unsubRecorderEnd;
|
|
851
986
|
constructor(container: HTMLElement, options?: ViewportOptions);
|
|
852
987
|
get ctx(): CanvasRenderingContext2D | null;
|
|
988
|
+
get fog(): FogManager;
|
|
853
989
|
get snapToGrid(): boolean;
|
|
854
990
|
setSnapToGrid(enabled: boolean): void;
|
|
855
991
|
get smartGuides(): boolean;
|
|
@@ -2087,6 +2223,8 @@ declare class MinimapController {
|
|
|
2087
2223
|
private readonly renderer;
|
|
2088
2224
|
private readonly htmlPainters;
|
|
2089
2225
|
private scene;
|
|
2226
|
+
private fogRenderer;
|
|
2227
|
+
private fogUnsub;
|
|
2090
2228
|
private frameId;
|
|
2091
2229
|
private debounceTimer;
|
|
2092
2230
|
private dragging;
|
|
@@ -2094,6 +2232,7 @@ declare class MinimapController {
|
|
|
2094
2232
|
private readonly unsubs;
|
|
2095
2233
|
constructor(viewport: Viewport, canvas: HTMLCanvasElement, options?: MinimapControllerOptions);
|
|
2096
2234
|
setSize(width: number, height: number): void;
|
|
2235
|
+
setFogRenderer(renderer: FogRenderer | null): void;
|
|
2097
2236
|
requestDraw(): void;
|
|
2098
2237
|
/**
|
|
2099
2238
|
* Invalidates the cached scene bitmap in response to html-painter registry
|
|
@@ -3039,6 +3178,43 @@ declare class TemplateTool implements Tool {
|
|
|
3039
3178
|
private notifyOptionsChange;
|
|
3040
3179
|
}
|
|
3041
3180
|
|
|
3042
|
-
declare
|
|
3181
|
+
declare function encodeBase64(bytes: Uint8Array): string;
|
|
3182
|
+
declare function decodeBase64(str: string): Uint8Array;
|
|
3183
|
+
declare function canonicalizeFogTile(tile: FogTileV1, def: FogDefinitionV1): FogTileV1 | null;
|
|
3184
|
+
declare function validateFogDefinition(def: unknown): asserts def is FogDefinitionV1;
|
|
3185
|
+
declare function validateFogTile(tile: unknown, def: FogDefinitionV1): asserts tile is FogTileV1;
|
|
3186
|
+
declare function validateFogState(state: unknown): asserts state is FogStateV1;
|
|
3187
|
+
declare function recommendedFogCellSize(bounds: Bounds): number;
|
|
3188
|
+
|
|
3189
|
+
declare class FogTool implements Tool {
|
|
3190
|
+
readonly name = "fog";
|
|
3191
|
+
private drawing;
|
|
3192
|
+
private points;
|
|
3193
|
+
private startPoint;
|
|
3194
|
+
private operation;
|
|
3195
|
+
private shape;
|
|
3196
|
+
private radius;
|
|
3197
|
+
private readonly manager;
|
|
3198
|
+
private optionListeners;
|
|
3199
|
+
constructor(manager: FogManager, options?: FogToolOptions);
|
|
3200
|
+
onActivate(ctx: ToolContext): void;
|
|
3201
|
+
onDeactivate(ctx: ToolContext): void;
|
|
3202
|
+
getOptions(): FogToolOptions;
|
|
3203
|
+
setOptions(options: FogToolOptions): void;
|
|
3204
|
+
onOptionsChange(listener: () => void): () => void;
|
|
3205
|
+
onPointerDown(state: PointerState, ctx: ToolContext): void;
|
|
3206
|
+
onPointerMove(state: PointerState, ctx: ToolContext): void;
|
|
3207
|
+
onPointerUp(_state: PointerState, ctx: ToolContext): void;
|
|
3208
|
+
onPointerCancel(_state: PointerState, ctx: ToolContext): void;
|
|
3209
|
+
onKeyDown(event: KeyboardEvent, ctx: ToolContext): boolean;
|
|
3210
|
+
renderOverlay(ctx: CanvasRenderingContext2D): void;
|
|
3211
|
+
private buildRegion;
|
|
3212
|
+
private cancelGesture;
|
|
3213
|
+
private renderBrushPreview;
|
|
3214
|
+
private renderRectanglePreview;
|
|
3215
|
+
private renderPolygonPreview;
|
|
3216
|
+
}
|
|
3217
|
+
|
|
3218
|
+
declare const VERSION = "0.66.0";
|
|
3043
3219
|
|
|
3044
|
-
export { AWARENESS_MAX_SELECTION, AWARENESS_PRESENCE_KIND, type ActivationOptions, type ActiveFormats, type AlignEdge, type ArrowElement, type ArrowStrokeStyle, ArrowTool, type ArrowToolOptions, type AttachAwarenessOptions, AutoSave, type AutoSaveOptions, type AwarenessFields, type AwarenessHandle, type AwarenessIdentity, type AwarenessPresence, type AwarenessViewport, 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, LocalAwareness, type LocalAwarenessHost, type LocalAwarenessOptions, 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, PEER_COLORS, PING_PRESENCE_KIND, type PathAnchor, type PathDistance, type PathEmission, type PathPresence, type PathRangeBand, type PathSegment, PathTool, type PathToolOptions, type Peer, type PeerLeaveReason, PeerRoster, type PeerRosterOptions, PencilTool, type PencilToolOptions, type PingEmission, PingInput, type PingInputHost, type PingInputOptions, type PingPresence, PingTool, type PingToolOptions, type Point, type PointerState, type PresenceChannel, type RectTrackerHost, RemoteCursorOverlay, type RemoteCursorOverlayHost, type RemoteCursorOverlayOptions, 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, RemoteSelectionOverlay, type RemoteSelectionOverlayHost, type RemoteSelectionOverlayOptions, 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, attachAwareness, boundsIntersect, cameraOriginForView, captureCameraView, computeElementRects, createArrow, createGrid, createHtmlElement, createImage, createNote, createShape, createStroke, createTemplate, createText, defaultPeerColor, drawHexPath, elementRectsEqual, exportImage, exportSvg, fitZoomForView, footprintFromSize, getActiveFormats, getArrowBounds, getArrowControlPoint, getArrowMidpoint, getArrowTangentAngle, getBendFromPoint, getElementBounds, getElementStyle, getElementsBoundingBox, getHexCellsInCone, getHexCellsInLine, getHexCellsInRadius, getHexCellsInRectangle, getHexCellsInSquare, getHexDistance, gridDistanceCells, isAwarenessPresence, isFocusPresence, isLaserTrailPresence, isMeasurePresence, isNearBezier, isPathPresence, isPingPresence, pathDistanceCells, resolveHtmlRouting, setFontSize, smartSnap, snapFootprintCenter, snapPoint, snapToCellCenter, snapToHexCenter, styleToPatch, toFocusPresence, toLaserTrailPresence, toMeasurePresence, toPathPresence, toPingPresence, toggleBold, toggleItalic, toggleStrikethrough, toggleUnderline };
|
|
3220
|
+
export { AWARENESS_MAX_SELECTION, AWARENESS_PRESENCE_KIND, type ActivationOptions, type ActiveFormats, type AlignEdge, type ArrowElement, type ArrowStrokeStyle, ArrowTool, type ArrowToolOptions, type AttachAwarenessOptions, AutoSave, type AutoSaveOptions, type AwarenessFields, type AwarenessHandle, type AwarenessIdentity, type AwarenessPresence, type AwarenessViewport, 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, FOG_MAX_TILES, FOG_STATE_VERSION, FOG_TILE_CELLS, type FocusAudience, type FocusPresence, type FocusRole, type FogBase, type FogChangeEvent, type FogDefinitionV1, type FogIdFactory, FogManager, type FogManagerOptions, type FogOperation, type FogPatch, type FogRegion, FogRenderer, type FogRendererOptions, type FogStateV1, type FogTileV1, FogTool, type FogToolOptions, type FogViewEvent, type FogViewMode, 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, LocalAwareness, type LocalAwarenessHost, type LocalAwarenessOptions, 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, PEER_COLORS, PING_PRESENCE_KIND, type PathAnchor, type PathDistance, type PathEmission, type PathPresence, type PathRangeBand, type PathSegment, PathTool, type PathToolOptions, type Peer, type PeerLeaveReason, PeerRoster, type PeerRosterOptions, PencilTool, type PencilToolOptions, type PingEmission, PingInput, type PingInputHost, type PingInputOptions, type PingPresence, PingTool, type PingToolOptions, type Point, type PointerState, type PresenceChannel, type RectTrackerHost, RemoteCursorOverlay, type RemoteCursorOverlayHost, type RemoteCursorOverlayOptions, 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, RemoteSelectionOverlay, type RemoteSelectionOverlayHost, type RemoteSelectionOverlayOptions, 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, attachAwareness, boundsIntersect, cameraOriginForView, canonicalizeFogTile, captureCameraView, computeElementRects, createArrow, createGrid, createHtmlElement, createImage, createNote, createShape, createStroke, createTemplate, createText, defaultPeerColor, drawHexPath, elementRectsEqual, exportImage, exportSvg, fitZoomForView, decodeBase64 as fogDecodeBase64, encodeBase64 as fogEncodeBase64, footprintFromSize, getActiveFormats, getArrowBounds, getArrowControlPoint, getArrowMidpoint, getArrowTangentAngle, getBendFromPoint, getElementBounds, getElementStyle, getElementsBoundingBox, getHexCellsInCone, getHexCellsInLine, getHexCellsInRadius, getHexCellsInRectangle, getHexCellsInSquare, getHexDistance, gridDistanceCells, isAwarenessPresence, isFocusPresence, isLaserTrailPresence, isMeasurePresence, isNearBezier, isPathPresence, isPingPresence, pathDistanceCells, recommendedFogCellSize, resolveHtmlRouting, setFontSize, smartSnap, snapFootprintCenter, snapPoint, snapToCellCenter, snapToHexCenter, styleToPatch, toFocusPresence, toLaserTrailPresence, toMeasurePresence, toPathPresence, toPingPresence, toggleBold, toggleItalic, toggleStrikethrough, toggleUnderline, validateFogDefinition, validateFogState, validateFogTile };
|