pixiboardjs 0.1.0-alpha.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.
@@ -0,0 +1,702 @@
1
+ type JsonPrimitive = null | boolean | number | string;
2
+ type JsonValue = JsonPrimitive | JsonValue[] | {
3
+ [key: string]: JsonValue;
4
+ };
5
+ type Point = {
6
+ x: number;
7
+ y: number;
8
+ };
9
+ type Size = {
10
+ width: number;
11
+ height: number;
12
+ };
13
+ type WorldBounds = {
14
+ minX: number;
15
+ minY: number;
16
+ maxX: number;
17
+ maxY: number;
18
+ };
19
+ type ViewportSnapshot = {
20
+ scale: number;
21
+ offset: Point;
22
+ };
23
+ type AssetRef = {
24
+ assetId: string;
25
+ variant?: "original" | "preview" | "waveform";
26
+ };
27
+ type AssetRecord = {
28
+ id: string;
29
+ kind: string;
30
+ metadata?: Record<string, JsonValue>;
31
+ } & Record<string, JsonValue | undefined>;
32
+ type BoardNode<Props extends JsonValue = JsonValue> = {
33
+ id: string;
34
+ type: string;
35
+ typeVersion: number;
36
+ name?: string;
37
+ x: number;
38
+ y: number;
39
+ width: number;
40
+ height: number;
41
+ rotation: number;
42
+ zIndex: number;
43
+ locked?: boolean;
44
+ visible?: boolean;
45
+ assetRefs?: Record<string, AssetRef>;
46
+ props: Props;
47
+ };
48
+ type BoardDocument = {
49
+ schemaVersion: number;
50
+ revision: number;
51
+ nodes: BoardNode[];
52
+ assets: AssetRecord[];
53
+ viewport?: ViewportSnapshot;
54
+ metadata?: Record<string, JsonValue>;
55
+ };
56
+ type BoardNodeCreateInput<Props extends JsonValue = JsonValue> = Omit<BoardNode<Props>, "id" | "typeVersion" | "rotation" | "zIndex" | "props"> & {
57
+ id?: string;
58
+ typeVersion?: number;
59
+ rotation?: number;
60
+ zIndex?: number;
61
+ props?: Props;
62
+ };
63
+ type BoardNodePatch<Props extends JsonValue = JsonValue> = Partial<Pick<BoardNode<Props>, "name" | "x" | "y" | "width" | "height" | "rotation" | "zIndex" | "locked" | "visible" | "assetRefs" | "props">>;
64
+ type ResizeInput<Props extends JsonValue> = {
65
+ node: Readonly<BoardNode<Props>>;
66
+ width: number;
67
+ height: number;
68
+ };
69
+ /** The eight selection control points, named after compass directions. */
70
+ type ResizeHandle = "nw" | "n" | "ne" | "e" | "se" | "s" | "sw" | "w";
71
+ /** The geometry a resize gesture started from, captured at pointer-down. */
72
+ type NodeGeometry = {
73
+ x: number;
74
+ y: number;
75
+ width: number;
76
+ height: number;
77
+ rotation: number;
78
+ };
79
+ type NodeResizeRequest = {
80
+ handle: ResizeHandle;
81
+ /** Pointer movement since the gesture started, in world units. */
82
+ deltaWorld: Point;
83
+ /**
84
+ * Geometry at pointer-down. Accumulating against it keeps a long drag exact;
85
+ * omitting it resolves against the node's current geometry instead.
86
+ */
87
+ origin?: NodeGeometry;
88
+ minWidth?: number;
89
+ minHeight?: number;
90
+ };
91
+ type ResizePolicy<Props extends JsonValue> = {
92
+ mode: "free";
93
+ } | {
94
+ mode: "aspect-ratio";
95
+ ratio?: number;
96
+ } | {
97
+ mode: "fixed";
98
+ } | {
99
+ mode: "custom";
100
+ resize(input: ResizeInput<Props>): BoardNodePatch<Props>;
101
+ };
102
+ type NodeTypeDefinition$1<Props extends JsonValue = JsonValue> = {
103
+ type: string;
104
+ version: number;
105
+ defaults?: Partial<Props>;
106
+ validate(value: unknown): Props;
107
+ getBounds(node: BoardNode<Props>): WorldBounds;
108
+ resize?: ResizePolicy<Props>;
109
+ };
110
+ type ChangeOrigin = "api" | "ui" | "plugin" | "agent" | "history" | "load" | (string & {});
111
+ type BoardChangeSet = {
112
+ transactionId: string;
113
+ revision: number;
114
+ label?: string;
115
+ origin: ChangeOrigin;
116
+ addedNodeIds: string[];
117
+ updatedNodeIds: string[];
118
+ removedNodeIds: string[];
119
+ assetChangedNodeIds: string[];
120
+ selectionChanged: boolean;
121
+ viewportChanged: boolean;
122
+ timestamp: number;
123
+ };
124
+ type BoardDocumentUpdate = {
125
+ revision: number;
126
+ changedNodes: ReadonlyArray<Readonly<BoardNode>>;
127
+ };
128
+ type NodeListFilter = {
129
+ ids?: string[];
130
+ types?: string[];
131
+ type?: string;
132
+ bounds?: WorldBounds;
133
+ visible?: boolean;
134
+ selected?: boolean;
135
+ limit?: number;
136
+ };
137
+ type TransactionOptions = {
138
+ origin?: ChangeOrigin;
139
+ /**
140
+ * Merges this transaction into the previous history entry when that entry
141
+ * carries the same key. A pointer gesture that commits once per frame passes
142
+ * one key for the whole gesture so it undoes as a single step; each new
143
+ * gesture must pass a fresh key. Every frame still gets its own revision and
144
+ * ChangeSet — only the history entry is coalesced.
145
+ */
146
+ coalesceKey?: string;
147
+ };
148
+ type DocumentLoadOptions$1 = {
149
+ replaceHistory?: boolean;
150
+ };
151
+
152
+ type RegisterNodeTypeOptions = {
153
+ replace?: boolean;
154
+ };
155
+ type NodeTypeRegistryOptions = {
156
+ development?: boolean;
157
+ };
158
+ declare class NodeTypeRegistry {
159
+ private readonly definitions;
160
+ private readonly development;
161
+ constructor(options?: NodeTypeRegistryOptions);
162
+ register<Props extends JsonValue>(definition: NodeTypeDefinition$1<Props>, options?: RegisterNodeTypeOptions): () => void;
163
+ has(type: string): boolean;
164
+ get<Props extends JsonValue = JsonValue>(type: string): NodeTypeDefinition$1<Props> | undefined;
165
+ require<Props extends JsonValue = JsonValue>(type: string): NodeTypeDefinition$1<Props>;
166
+ list(): ReadonlyArray<NodeTypeDefinition$1<JsonValue>>;
167
+ createProps<Props extends JsonValue>(type: string, props: Props | undefined): {
168
+ typeVersion: number;
169
+ props: Props;
170
+ };
171
+ validateNode<Props extends JsonValue>(node: BoardNode<Props>): BoardNode<Props>;
172
+ getBounds<Props extends JsonValue>(node: BoardNode<Props>): WorldBounds;
173
+ private runValidation;
174
+ }
175
+
176
+ type BoardCoreOptions = {
177
+ document?: unknown;
178
+ schemaVersion?: number;
179
+ nodeTypes?: NodeTypeRegistry;
180
+ viewportSize?: Size;
181
+ idFactory?: () => string;
182
+ now?: () => number;
183
+ };
184
+ type BoardChangeEvent = {
185
+ revision: number;
186
+ changeSet: BoardChangeSet;
187
+ documentUpdate: BoardDocumentUpdate;
188
+ };
189
+
190
+ type RequestOptions = {
191
+ signal?: AbortSignal;
192
+ requestId?: string;
193
+ };
194
+ type WriteOptions = RequestOptions & {
195
+ origin?: string;
196
+ label?: string;
197
+ };
198
+ type DocumentLoadOptions = {
199
+ replaceHistory?: boolean;
200
+ };
201
+ type ReadNodesInput = {
202
+ filter?: NodeListFilter;
203
+ limit?: number;
204
+ cursor?: string;
205
+ };
206
+ type PageInfo = {
207
+ hasMore: boolean;
208
+ nextCursor?: string;
209
+ };
210
+ type ReadNodesResult = {
211
+ nodes: readonly BoardNode[];
212
+ page: PageInfo;
213
+ revision: number;
214
+ requestId?: string;
215
+ };
216
+ type ReadAssetsResult = {
217
+ assets: readonly AssetRecord[];
218
+ page: PageInfo;
219
+ revision: number;
220
+ requestId?: string;
221
+ };
222
+ type CreateNodeInput = BoardNodeCreateInput & {
223
+ asset?: AssetRecord;
224
+ };
225
+ type UpdateNodeInput = {
226
+ id: string;
227
+ patch: BoardNodePatch;
228
+ asset?: AssetRecord;
229
+ };
230
+ type WriteResult = {
231
+ changed: boolean;
232
+ nodes: readonly BoardNode[];
233
+ assets?: readonly AssetRecord[];
234
+ deletedNodeIds?: readonly string[];
235
+ deletedAssetIds?: readonly string[];
236
+ revision: number;
237
+ changeSet?: BoardChangeSet;
238
+ requestId?: string;
239
+ };
240
+ type PreviewResult = {
241
+ nodeId: string;
242
+ dataUrl: string;
243
+ mimeType: string;
244
+ width?: number;
245
+ height?: number;
246
+ revision: number;
247
+ requestId?: string;
248
+ };
249
+ type CaptureResult = {
250
+ dataUrl: string;
251
+ mimeType: string;
252
+ width?: number;
253
+ height?: number;
254
+ revision: number;
255
+ requestId?: string;
256
+ };
257
+ type PreviewService = (input: {
258
+ nodeId: string;
259
+ maxWidth?: number;
260
+ maxHeight?: number;
261
+ frameNumber?: number;
262
+ fps?: number;
263
+ }, options: RequestOptions) => Promise<Omit<PreviewResult, "revision" | "requestId">> | Omit<PreviewResult, "revision" | "requestId">;
264
+ type CaptureService = (input: JsonValue, options: RequestOptions) => Promise<Omit<CaptureResult, "revision" | "requestId">> | Omit<CaptureResult, "revision" | "requestId">;
265
+ type BoardCapabilities = {
266
+ availability: {
267
+ preview: boolean;
268
+ capture: boolean;
269
+ };
270
+ document: {
271
+ snapshot(options?: RequestOptions): Promise<Readonly<BoardDocument>>;
272
+ load(input: unknown, options?: DocumentLoadOptions & WriteOptions): Promise<{
273
+ changed: boolean;
274
+ revision: number;
275
+ changeSet: BoardChangeSet;
276
+ requestId?: string;
277
+ }>;
278
+ validate(input: unknown, options?: RequestOptions): Promise<BoardDocument>;
279
+ };
280
+ nodes: {
281
+ read(input?: ReadNodesInput, options?: RequestOptions): Promise<ReadNodesResult>;
282
+ create(input: {
283
+ nodes: readonly CreateNodeInput[];
284
+ }, options?: WriteOptions): Promise<WriteResult>;
285
+ update(input: {
286
+ nodes: readonly UpdateNodeInput[];
287
+ }, options?: WriteOptions): Promise<WriteResult>;
288
+ delete(input: {
289
+ nodeIds: readonly string[];
290
+ }, options?: WriteOptions): Promise<WriteResult>;
291
+ };
292
+ assets: {
293
+ read(input?: {
294
+ ids?: readonly string[];
295
+ kinds?: readonly string[];
296
+ limit?: number;
297
+ cursor?: string;
298
+ }, options?: RequestOptions): Promise<ReadAssetsResult>;
299
+ upsert(input: {
300
+ assets: readonly AssetRecord[];
301
+ }, options?: WriteOptions): Promise<WriteResult>;
302
+ remove(input: {
303
+ assetIds: readonly string[];
304
+ }, options?: WriteOptions): Promise<WriteResult>;
305
+ };
306
+ selection: {
307
+ get(options?: RequestOptions): Promise<readonly string[]>;
308
+ set(nodeIds: readonly string[], options?: WriteOptions): Promise<{
309
+ nodeIds: readonly string[];
310
+ requestId?: string;
311
+ }>;
312
+ };
313
+ viewport: {
314
+ get(options?: RequestOptions): Promise<ViewportSnapshot>;
315
+ set(viewport: ViewportSnapshot, options?: WriteOptions): Promise<{
316
+ viewport: ViewportSnapshot;
317
+ requestId?: string;
318
+ }>;
319
+ };
320
+ history: {
321
+ canUndo(): boolean;
322
+ canRedo(): boolean;
323
+ clear(): void;
324
+ undo(options?: WriteOptions): BoardChangeSet | undefined;
325
+ redo(options?: WriteOptions): BoardChangeSet | undefined;
326
+ };
327
+ preview: {
328
+ get(input: {
329
+ nodeId: string;
330
+ maxWidth?: number;
331
+ maxHeight?: number;
332
+ frameNumber?: number;
333
+ fps?: number;
334
+ }, options?: RequestOptions): Promise<PreviewResult>;
335
+ };
336
+ capture: {
337
+ available: boolean;
338
+ capture(input: JsonValue, options?: RequestOptions): Promise<CaptureResult>;
339
+ };
340
+ };
341
+
342
+ type BoardLifecycleState = "created" | "mounting" | "ready" | "destroying" | "destroyed";
343
+ type DocumentPersistence = {
344
+ load?(options?: {
345
+ signal?: AbortSignal;
346
+ }): Promise<BoardDocument | null>;
347
+ save?(document: BoardDocument, options?: {
348
+ signal?: AbortSignal;
349
+ }): Promise<void>;
350
+ destroy?(): void | Promise<void>;
351
+ };
352
+ type RuntimeRenderer = {
353
+ init(): Promise<void>;
354
+ rebuild(snapshot: Readonly<BoardDocument>): Promise<void>;
355
+ apply(update: BoardDocumentUpdate, changeSet: BoardChangeEvent["changeSet"]): Promise<RendererApplyResult>;
356
+ /**
357
+ * Narrows the renderer to the world rectangle currently on screen, so the
358
+ * number of live render objects tracks visible content rather than document
359
+ * size. `undefined` means "no viewport information — treat every node as
360
+ * visible". Optional: a renderer that retains everything stays valid.
361
+ */
362
+ setVisibleBounds?(bounds: WorldBounds | undefined, scale?: number): Promise<void>;
363
+ /**
364
+ * The ids culling currently keeps. `undefined` means the renderer has no
365
+ * culling information, which callers must read as "everything is visible"
366
+ * rather than "nothing is".
367
+ */
368
+ visibleNodeIds?(): ReadonlySet<string> | undefined;
369
+ refreshRegisteredTypes?(): Promise<void>;
370
+ destroy(): Promise<void>;
371
+ };
372
+ type RendererApplyResult = "applied" | "rebuild-required";
373
+ type CustomDisplayObject = {
374
+ visible?: boolean;
375
+ x?: number;
376
+ y?: number;
377
+ rotation?: number;
378
+ zIndex?: number;
379
+ addChild?(child: CustomDisplayObject): void;
380
+ removeChild?(child: CustomDisplayObject): void;
381
+ destroy?(options?: unknown): void;
382
+ [key: string]: unknown;
383
+ };
384
+ type CustomDisplayFactory = {
385
+ createContainer(): CustomDisplayObject;
386
+ createRect?(width: number, height: number, fill: number | string): CustomDisplayObject;
387
+ createText?(text: string, style?: Record<string, unknown>): CustomDisplayObject;
388
+ };
389
+ type CustomTextureLease = {
390
+ texture?: unknown;
391
+ release?: () => void;
392
+ };
393
+ type CustomNodeRendererContext = {
394
+ assets: {
395
+ acquireTexture(ref: {
396
+ assetId: string;
397
+ variant?: "original" | "preview" | "waveform";
398
+ }, options?: Record<string, unknown>): Promise<CustomTextureLease>;
399
+ };
400
+ invalidate(): void;
401
+ signal: AbortSignal;
402
+ lod: {
403
+ level?: number;
404
+ scale?: number;
405
+ };
406
+ diagnostics: {
407
+ creates: number;
408
+ updates: number;
409
+ destroys: number;
410
+ lateUpdates: number;
411
+ };
412
+ display: CustomDisplayFactory;
413
+ };
414
+ type CustomNodeView<State = unknown> = {
415
+ displayObject: CustomDisplayObject;
416
+ state: State;
417
+ };
418
+ type CustomNodeRenderer<Props extends JsonValue = JsonValue, State = unknown> = {
419
+ create(node: Readonly<BoardNode<Props>>, context: CustomNodeRendererContext): CustomNodeView<State> | Promise<CustomNodeView<State>>;
420
+ update(view: CustomNodeView<State>, node: Readonly<BoardNode<Props>>, context: CustomNodeRendererContext): void | Promise<void>;
421
+ destroy(view: CustomNodeView<State>, context: CustomNodeRendererContext): void;
422
+ hitTest?(node: Readonly<BoardNode<Props>>, worldPoint: Point): boolean;
423
+ };
424
+ type CustomResizePolicy<Props extends JsonValue> = {
425
+ mode: "free";
426
+ } | {
427
+ mode: "aspect-ratio";
428
+ ratio?: number;
429
+ } | {
430
+ mode: "fixed";
431
+ } | {
432
+ mode: "custom";
433
+ resize(input: {
434
+ node: Readonly<BoardNode<Props>>;
435
+ width: number;
436
+ height: number;
437
+ }): BoardNodePatch<Props>;
438
+ };
439
+ type CustomNodeDefinition<Props extends JsonValue = JsonValue, State = unknown> = {
440
+ type: string;
441
+ version: number;
442
+ defaults?: Partial<Props>;
443
+ validate(value: unknown): Props;
444
+ getBounds(node: BoardNode<Props>): WorldBounds;
445
+ resize?: CustomResizePolicy<Props>;
446
+ renderer?: CustomNodeRenderer<Props, State>;
447
+ };
448
+ type PublicNodeTypeDefinition<Props extends JsonValue = JsonValue, State = unknown> = CustomNodeDefinition<Props, State>;
449
+ type CustomNodeDataDefinition<Props extends JsonValue = JsonValue> = Omit<CustomNodeDefinition<Props>, "renderer">;
450
+ type NodeTypeDefinition<Props extends JsonValue = JsonValue> = CustomNodeDataDefinition<Props>;
451
+ type CustomNodeRendererRegistry = {
452
+ register(type: string, renderer: CustomNodeRenderer, options?: NodeTypeRegistrationOptions): () => void;
453
+ get(type: string): CustomNodeRenderer | undefined;
454
+ has(type: string): boolean;
455
+ list(): string[];
456
+ };
457
+ type PublicRendererOptions = {
458
+ registry?: CustomNodeRendererRegistry;
459
+ [key: string]: unknown;
460
+ };
461
+ type PixiBoardRendererOptions = PublicRendererOptions;
462
+ type BrowserEventPort = {
463
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject): void;
464
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject): void;
465
+ };
466
+ type ResizeObserverPort = {
467
+ observe(target: Element): void;
468
+ disconnect(): void;
469
+ };
470
+ type TickerPort = {
471
+ add(listener: () => void): void;
472
+ remove(listener: () => void): void;
473
+ };
474
+ type BoardRuntimePorts = {
475
+ events?: BrowserEventPort;
476
+ createResizeObserver?: (callback: ResizeObserverCallback) => ResizeObserverPort;
477
+ ticker?: TickerPort;
478
+ onKeyboardEvent?: (event: Event) => void;
479
+ onClipboardEvent?: (event: Event) => void;
480
+ };
481
+ type PixiBoardOptions = {
482
+ container?: Element | null;
483
+ document?: unknown;
484
+ headless?: boolean;
485
+ persistence?: DocumentPersistence;
486
+ interactions?: {
487
+ pointer?: boolean;
488
+ keyboard?: boolean;
489
+ clipboard?: boolean;
490
+ };
491
+ /** Floor sizes a resize gesture may shrink a node to, in world units. */
492
+ transform?: {
493
+ minWidth?: number;
494
+ minHeight?: number;
495
+ };
496
+ ports?: BoardRuntimePorts;
497
+ /**
498
+ * Viewport virtualization. On by default: the renderer only keeps views for
499
+ * nodes inside the visible world rectangle plus `padding` world units of
500
+ * margin. Requires the host to report a screen size — via
501
+ * `ports.createResizeObserver` or `core.viewportSize` — because the renderer
502
+ * cannot cull against a viewport it has never been told the size of.
503
+ */
504
+ virtualization?: {
505
+ enabled?: boolean;
506
+ padding?: number;
507
+ };
508
+ core?: Omit<BoardCoreOptions, "document">;
509
+ renderer?: PublicRendererOptions;
510
+ rendererFactory?: (options: PublicRendererOptions) => RuntimeRenderer;
511
+ preview?: PreviewService;
512
+ capture?: CaptureService;
513
+ };
514
+ type CaptureInput = {
515
+ target: "viewport";
516
+ format?: "png" | "jpeg";
517
+ scale?: number;
518
+ } | {
519
+ target: "node";
520
+ nodeId: string;
521
+ format?: "png" | "jpeg";
522
+ scale?: number;
523
+ } | {
524
+ target: "bounds";
525
+ bounds: WorldBounds;
526
+ format?: "png" | "jpeg";
527
+ scale?: number;
528
+ };
529
+ type SelectionChangeEvent = {
530
+ nodeIds: string[];
531
+ previousNodeIds: string[];
532
+ };
533
+ type ViewportChangeEvent = {
534
+ viewport: ViewportSnapshot;
535
+ previousViewport: ViewportSnapshot;
536
+ };
537
+ type HistoryChangeEvent = {
538
+ canUndo: boolean;
539
+ canRedo: boolean;
540
+ };
541
+ type RenderCompleteEvent = {
542
+ revision: number;
543
+ frameId: number;
544
+ };
545
+ type NodeTypeRegistrationOptions = {
546
+ replace?: boolean;
547
+ };
548
+ /**
549
+ * The selection's axis-aligned world rectangle. A single selected node also
550
+ * reports its `rotation` so a host can draw the outline in the node's own
551
+ * frame; a multi-node selection has no shared rotation and reports `0`.
552
+ */
553
+ type TransformBounds = {
554
+ x: number;
555
+ y: number;
556
+ width: number;
557
+ height: number;
558
+ rotation: number;
559
+ nodeIds: string[];
560
+ };
561
+ /** Where one control point sits, in world units, plus its CSS cursor. */
562
+ type TransformHandlePlacement = {
563
+ handle: ResizeHandle;
564
+ /** World position of the handle's centre. */
565
+ world: Point;
566
+ cursor: string;
567
+ };
568
+ type TransformSession = {
569
+ readonly handle: ResizeHandle;
570
+ /**
571
+ * Applies the total pointer movement since `begin()`, in world units.
572
+ * Deltas are absolute rather than incremental so a gesture stays exact
573
+ * under fractional zoom and dropped frames.
574
+ */
575
+ update(deltaWorld: Point): void;
576
+ /** Ends the gesture. Further `update()` calls are ignored. */
577
+ commit(): void;
578
+ /** Ends the gesture and restores the geometry captured at `begin()`. */
579
+ cancel(): void;
580
+ };
581
+ type NodeTypeRegistrationDisposer = () => Promise<void>;
582
+ type NodeQuery = NodeListFilter;
583
+ type PublicBoardEventMap = {
584
+ change: BoardChangeEvent;
585
+ "selection:change": SelectionChangeEvent;
586
+ "viewport:change": ViewportChangeEvent;
587
+ "history:change": HistoryChangeEvent;
588
+ "assets:change": BoardChangeEvent;
589
+ "capability:change": {
590
+ capability: string;
591
+ available: boolean;
592
+ };
593
+ "render:complete": RenderCompleteEvent;
594
+ };
595
+ type NodeHandleEventMap = {
596
+ change: BoardChangeEvent;
597
+ };
598
+ interface NodeHandle<Props extends JsonValue = JsonValue> {
599
+ readonly id: string;
600
+ getAttrs(): Readonly<BoardNode<Props>>;
601
+ setAttrs(patch: BoardNodePatch<Props>): this;
602
+ x(): number;
603
+ x(value: number): this;
604
+ y(): number;
605
+ y(value: number): this;
606
+ width(): number;
607
+ width(value: number): this;
608
+ height(): number;
609
+ height(value: number): this;
610
+ rotation(): number;
611
+ rotation(value: number): this;
612
+ visible(): boolean;
613
+ visible(value: boolean): this;
614
+ remove(): void;
615
+ on<EventName extends keyof NodeHandleEventMap>(eventName: EventName, listener: (event: NodeHandleEventMap[EventName]) => void): () => void;
616
+ }
617
+ interface PixiBoard {
618
+ readonly ready: Promise<void>;
619
+ readonly state: BoardLifecycleState;
620
+ readonly signal: AbortSignal;
621
+ readonly capabilities: BoardCapabilities;
622
+ readonly nodes: {
623
+ create<Props extends JsonValue>(input: BoardNodeCreateInput<Props>): Promise<NodeHandle<Props>>;
624
+ update<Props extends JsonValue>(nodeId: string, patch: BoardNodePatch<Props>): NodeHandle<Props>;
625
+ resize<Props extends JsonValue>(nodeId: string, request: NodeResizeRequest): NodeHandle<Props>;
626
+ remove(nodeId: string): void;
627
+ get<Props extends JsonValue = JsonValue>(nodeId: string): Readonly<BoardNode<Props>> | undefined;
628
+ list(filter?: NodeListFilter): ReadonlyArray<Readonly<BoardNode>>;
629
+ };
630
+ /**
631
+ * Drives resize gestures for the current selection. `transform.begin()`
632
+ * captures the geometry the gesture starts from; each `update()` resolves
633
+ * the accumulated pointer delta through every selected node's ResizePolicy
634
+ * and commits one coalesced transaction, so the whole gesture undoes as a
635
+ * single step.
636
+ */
637
+ readonly transform: {
638
+ handles(): ReadonlyArray<TransformHandlePlacement>;
639
+ bounds(): TransformBounds | undefined;
640
+ begin(handle: ResizeHandle): TransformSession | undefined;
641
+ active(): boolean;
642
+ };
643
+ readonly nodeTypes: {
644
+ register<Props extends JsonValue, State = unknown>(definition: PublicNodeTypeDefinition<Props, State>, options?: NodeTypeRegistrationOptions): Promise<NodeTypeRegistrationDisposer>;
645
+ has(type: string): boolean;
646
+ get(type: string): CustomNodeDataDefinition | undefined;
647
+ list(): ReadonlyArray<CustomNodeDataDefinition>;
648
+ };
649
+ readonly selection: {
650
+ get(): string[];
651
+ set(nodeIds: Iterable<string>): void;
652
+ toggle(nodeId: string): void;
653
+ clear(): void;
654
+ onChange(listener: (event: SelectionChangeEvent) => void): () => void;
655
+ };
656
+ readonly viewport: {
657
+ get(): ViewportSnapshot;
658
+ set(value: ViewportSnapshot): void;
659
+ panBy(deltaX: number, deltaY: number): void;
660
+ zoomAt(screenPoint: Point, factor: number): void;
661
+ fitNodes(nodeIds: string[]): void;
662
+ fitBounds(bounds: WorldBounds): void;
663
+ toWorld(point: Point): Point;
664
+ toScreen(point: Point): Point;
665
+ };
666
+ readonly history: {
667
+ canUndo(): boolean;
668
+ canRedo(): boolean;
669
+ undo(): BoardChangeEvent["changeSet"] | undefined;
670
+ redo(): BoardChangeEvent["changeSet"] | undefined;
671
+ clear(): void;
672
+ };
673
+ readonly document: {
674
+ snapshot(): Readonly<BoardDocument>;
675
+ toJSON(): BoardDocument;
676
+ load(input: unknown, options?: DocumentLoadOptions$1): Promise<void>;
677
+ validate(input: unknown): BoardDocument;
678
+ };
679
+ find(filter?: NodeQuery): ReadonlyArray<Readonly<BoardNode>>;
680
+ findOne(selector: string): Readonly<BoardNode> | undefined;
681
+ /**
682
+ * The node ids the renderer currently keeps live, so DOM overlays can track
683
+ * visible content rather than document size.
684
+ *
685
+ * `undefined` means there is no culling information — a headless board, a
686
+ * renderer that retains everything, or a viewport whose screen size is not
687
+ * measured yet. Callers must treat that as "everything is visible"; treating
688
+ * it as an empty set would blank an overlay on a perfectly valid renderer.
689
+ */
690
+ visibleNodeIds(): ReadonlySet<string> | undefined;
691
+ node<Props extends JsonValue = JsonValue>(nodeId: string): NodeHandle<Props>;
692
+ transaction<Result>(label: string, operation: () => Result, options?: TransactionOptions): Result;
693
+ on<EventName extends keyof PublicBoardEventMap>(eventName: EventName, listener: (event: PublicBoardEventMap[EventName]) => void): () => void;
694
+ focus(): void;
695
+ capture(input: CaptureInput, options?: RequestOptions): Promise<CaptureResult>;
696
+ destroy(): Promise<void>;
697
+ }
698
+ type NodePatch<Props extends JsonValue = JsonValue> = BoardNodePatch<Props>;
699
+ type NodeInput<Props extends JsonValue = JsonValue> = BoardNodeCreateInput<Props>;
700
+ type TransactionOrigin = ChangeOrigin;
701
+
702
+ export type { SelectionChangeEvent as $, AssetRecord as A, BoardNode as B, CaptureInput as C, DocumentLoadOptions$1 as D, NodeListFilter as E, NodePatch as F, NodeQuery as G, HistoryChangeEvent as H, NodeResizeRequest as I, JsonValue as J, NodeTypeDefinition as K, NodeTypeRegistrationDisposer as L, NodeTypeRegistrationOptions as M, NodeGeometry as N, PixiBoardOptions as O, PixiBoard as P, PixiBoardRendererOptions as Q, PublicBoardEventMap as R, PublicNodeTypeDefinition as S, PublicRendererOptions as T, RenderCompleteEvent as U, ViewportSnapshot as V, WorldBounds as W, RendererApplyResult as X, ResizeHandle as Y, ResizeObserverPort as Z, RuntimeRenderer as _, Point as a, TickerPort as a0, TransactionOptions as a1, TransactionOrigin as a2, TransformBounds as a3, TransformHandlePlacement as a4, TransformSession as a5, ViewportChangeEvent as a6, BoardDocument as b, BoardCapabilities as c, BoardChangeEvent as d, BoardDocumentUpdate as e, BoardLifecycleState as f, BoardNodeCreateInput as g, BoardNodePatch as h, BoardRuntimePorts as i, BrowserEventPort as j, CaptureResult as k, ChangeOrigin as l, CustomDisplayFactory as m, CustomDisplayObject as n, CustomNodeDataDefinition as o, CustomNodeDefinition as p, CustomNodeRenderer as q, CustomNodeRendererContext as r, CustomNodeRendererRegistry as s, CustomNodeView as t, CustomResizePolicy as u, CustomTextureLease as v, DocumentPersistence as w, NodeHandle as x, NodeHandleEventMap as y, NodeInput as z };
@@ -0,0 +1 @@
1
+ export { c as BoardCapabilities, d as BoardChangeEvent, b as BoardDocument, e as BoardDocumentUpdate, f as BoardLifecycleState, B as BoardNode, g as BoardNodeCreateInput, h as BoardNodePatch, i as BoardRuntimePorts, j as BrowserEventPort, C as CaptureInput, k as CaptureResult, l as ChangeOrigin, m as CustomDisplayFactory, n as CustomDisplayObject, o as CustomNodeDataDefinition, p as CustomNodeDefinition, q as CustomNodeRenderer, r as CustomNodeRendererContext, s as CustomNodeRendererRegistry, t as CustomNodeView, u as CustomResizePolicy, v as CustomTextureLease, D as DocumentLoadOptions, w as DocumentPersistence, H as HistoryChangeEvent, J as JsonValue, N as NodeGeometry, x as NodeHandle, y as NodeHandleEventMap, z as NodeInput, E as NodeListFilter, F as NodePatch, G as NodeQuery, I as NodeResizeRequest, K as NodeTypeDefinition, L as NodeTypeRegistrationDisposer, M as NodeTypeRegistrationOptions, P as PixiBoard, O as PixiBoardOptions, Q as PixiBoardRendererOptions, a as Point, R as PublicBoardEventMap, S as PublicNodeTypeDefinition, T as PublicRendererOptions, U as RenderCompleteEvent, X as RendererApplyResult, Y as ResizeHandle, Z as ResizeObserverPort, _ as RuntimeRenderer, $ as SelectionChangeEvent, a0 as TickerPort, a1 as TransactionOptions, a2 as TransactionOrigin, a3 as TransformBounds, a4 as TransformHandlePlacement, a5 as TransformSession, a6 as ViewportChangeEvent, V as ViewportSnapshot, W as WorldBounds } from './types-DnR8yhxj.js';