@hy-bricks/canvas 0.1.1
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/LICENSE +21 -0
- package/README.md +227 -0
- package/dist/index.cjs +2 -0
- package/dist/index.d.ts +1982 -0
- package/dist/index.mjs +2 -0
- package/package.json +62 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1982 @@
|
|
|
1
|
+
import { ComponentOptionsMixin } from 'vue';
|
|
2
|
+
import { ComponentProvideOptions } from 'vue';
|
|
3
|
+
import { ComputedRef } from 'vue';
|
|
4
|
+
import { DefineComponent } from 'vue';
|
|
5
|
+
import { InjectionKey } from 'vue';
|
|
6
|
+
import { PublicProps } from 'vue';
|
|
7
|
+
import { Ref } from 'vue';
|
|
8
|
+
import { ShallowRef } from 'vue';
|
|
9
|
+
import { VNode } from 'vue';
|
|
10
|
+
|
|
11
|
+
declare const __VLS_component: DefineComponent<__VLS_Props_2, {
|
|
12
|
+
context: CanvasContext;
|
|
13
|
+
handle: CanvasHandle & {
|
|
14
|
+
dispose(): void;
|
|
15
|
+
};
|
|
16
|
+
canvasId: string;
|
|
17
|
+
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
18
|
+
"cannot-drag-slot-child": (payload: {
|
|
19
|
+
instanceId: string;
|
|
20
|
+
parentId: string | undefined;
|
|
21
|
+
}) => any;
|
|
22
|
+
"cannot-drag-layout-managed-child": (payload: {
|
|
23
|
+
instanceId: string;
|
|
24
|
+
parentId: string | undefined;
|
|
25
|
+
parentLayoutMode: ContainerLayoutConfig["mode"];
|
|
26
|
+
}) => any;
|
|
27
|
+
"update:modelValue": (doc: PageDocument) => any;
|
|
28
|
+
"context-ready": (ctx: CanvasContext) => any;
|
|
29
|
+
"handle-ready": (handle: CanvasHandle) => any;
|
|
30
|
+
}, string, PublicProps, Readonly<__VLS_Props_2> & Readonly<{
|
|
31
|
+
"onCannot-drag-slot-child"?: ((payload: {
|
|
32
|
+
instanceId: string;
|
|
33
|
+
parentId: string | undefined;
|
|
34
|
+
}) => any) | undefined;
|
|
35
|
+
"onCannot-drag-layout-managed-child"?: ((payload: {
|
|
36
|
+
instanceId: string;
|
|
37
|
+
parentId: string | undefined;
|
|
38
|
+
parentLayoutMode: ContainerLayoutConfig["mode"];
|
|
39
|
+
}) => any) | undefined;
|
|
40
|
+
"onUpdate:modelValue"?: ((doc: PageDocument) => any) | undefined;
|
|
41
|
+
"onContext-ready"?: ((ctx: CanvasContext) => any) | undefined;
|
|
42
|
+
"onHandle-ready"?: ((handle: CanvasHandle) => any) | undefined;
|
|
43
|
+
}>, {
|
|
44
|
+
mode: CanvasMode;
|
|
45
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
46
|
+
stageContainerEl: HTMLDivElement;
|
|
47
|
+
}, any>;
|
|
48
|
+
|
|
49
|
+
declare const __VLS_component_2: DefineComponent< {}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {
|
|
50
|
+
stageEl: HTMLDivElement;
|
|
51
|
+
}, HTMLDivElement>;
|
|
52
|
+
|
|
53
|
+
declare const __VLS_component_3: DefineComponent<__VLS_Props_4, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
54
|
+
"cannot-drag-slot-child": (payload: {
|
|
55
|
+
instanceId: string;
|
|
56
|
+
parentId: string | undefined;
|
|
57
|
+
}) => any;
|
|
58
|
+
"cannot-drag-layout-managed-child": (payload: {
|
|
59
|
+
instanceId: string;
|
|
60
|
+
parentId: string | undefined;
|
|
61
|
+
parentLayoutMode: ContainerLayoutConfig["mode"];
|
|
62
|
+
}) => any;
|
|
63
|
+
}, string, PublicProps, Readonly<__VLS_Props_4> & Readonly<{
|
|
64
|
+
"onCannot-drag-slot-child"?: ((payload: {
|
|
65
|
+
instanceId: string;
|
|
66
|
+
parentId: string | undefined;
|
|
67
|
+
}) => any) | undefined;
|
|
68
|
+
"onCannot-drag-layout-managed-child"?: ((payload: {
|
|
69
|
+
instanceId: string;
|
|
70
|
+
parentId: string | undefined;
|
|
71
|
+
parentLayoutMode: ContainerLayoutConfig["mode"];
|
|
72
|
+
}) => any) | undefined;
|
|
73
|
+
}>, {
|
|
74
|
+
mode: CanvasMode;
|
|
75
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
76
|
+
layerEl: HTMLDivElement;
|
|
77
|
+
}, HTMLDivElement>;
|
|
78
|
+
|
|
79
|
+
declare type __VLS_Props = {
|
|
80
|
+
payload?: PageRenderPayload;
|
|
81
|
+
document?: PageDocument;
|
|
82
|
+
componentSourceMap?: ComponentSourceMap;
|
|
83
|
+
schedulerOptions?: RenderSchedulerOptions;
|
|
84
|
+
canvasId?: string;
|
|
85
|
+
adapters?: CanvasAdapters;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
declare type __VLS_Props_2 = {
|
|
89
|
+
modelValue?: PageDocument;
|
|
90
|
+
componentSourceMap?: ComponentSourceMap;
|
|
91
|
+
mode?: CanvasMode;
|
|
92
|
+
schedulerOptions?: RenderSchedulerOptions;
|
|
93
|
+
adapters?: CanvasAdapters;
|
|
94
|
+
canvasId?: string;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
declare type __VLS_Props_3 = {
|
|
98
|
+
componentSourceMap?: ComponentSourceMap;
|
|
99
|
+
mode?: CanvasMode;
|
|
100
|
+
schedulerOptions?: RenderSchedulerOptions;
|
|
101
|
+
canvasId?: string;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
declare type __VLS_Props_4 = {
|
|
105
|
+
mode?: CanvasMode;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
declare function __VLS_template(): {
|
|
109
|
+
attrs: Partial<{}>;
|
|
110
|
+
slots: Readonly<{
|
|
111
|
+
default?: () => VNode[];
|
|
112
|
+
'canvas-overlay'?: (props: {
|
|
113
|
+
viewport: CanvasHandle["viewport"];
|
|
114
|
+
handle: CanvasHandle;
|
|
115
|
+
}) => VNode[];
|
|
116
|
+
'reparent-ghost'?: (props: {
|
|
117
|
+
state: {
|
|
118
|
+
rect: Rect;
|
|
119
|
+
target: DropTarget;
|
|
120
|
+
result: CanReparentResult;
|
|
121
|
+
};
|
|
122
|
+
}) => VNode[];
|
|
123
|
+
'split-divider'?: (props: {
|
|
124
|
+
state: {
|
|
125
|
+
parentId: string;
|
|
126
|
+
dividerIndex: number;
|
|
127
|
+
direction: "horizontal" | "vertical";
|
|
128
|
+
rect: Rect;
|
|
129
|
+
isDragging: boolean;
|
|
130
|
+
};
|
|
131
|
+
}) => VNode[];
|
|
132
|
+
}> & {
|
|
133
|
+
default?: () => VNode[];
|
|
134
|
+
'canvas-overlay'?: (props: {
|
|
135
|
+
viewport: CanvasHandle["viewport"];
|
|
136
|
+
handle: CanvasHandle;
|
|
137
|
+
}) => VNode[];
|
|
138
|
+
'reparent-ghost'?: (props: {
|
|
139
|
+
state: {
|
|
140
|
+
rect: Rect;
|
|
141
|
+
target: DropTarget;
|
|
142
|
+
result: CanReparentResult;
|
|
143
|
+
};
|
|
144
|
+
}) => VNode[];
|
|
145
|
+
'split-divider'?: (props: {
|
|
146
|
+
state: {
|
|
147
|
+
parentId: string;
|
|
148
|
+
dividerIndex: number;
|
|
149
|
+
direction: "horizontal" | "vertical";
|
|
150
|
+
rect: Rect;
|
|
151
|
+
isDragging: boolean;
|
|
152
|
+
};
|
|
153
|
+
}) => VNode[];
|
|
154
|
+
};
|
|
155
|
+
refs: {
|
|
156
|
+
stageContainerEl: HTMLDivElement;
|
|
157
|
+
};
|
|
158
|
+
rootEl: any;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
declare function __VLS_template_2(): {
|
|
162
|
+
attrs: Partial<{}>;
|
|
163
|
+
slots: {
|
|
164
|
+
default?(_: {}): any;
|
|
165
|
+
};
|
|
166
|
+
refs: {
|
|
167
|
+
stageEl: HTMLDivElement;
|
|
168
|
+
};
|
|
169
|
+
rootEl: HTMLDivElement;
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
declare function __VLS_template_3(): {
|
|
173
|
+
attrs: Partial<{}>;
|
|
174
|
+
slots: Readonly<{
|
|
175
|
+
'reparent-ghost'?: (props: {
|
|
176
|
+
state: {
|
|
177
|
+
rect: Rect;
|
|
178
|
+
target: DropTarget;
|
|
179
|
+
result: CanReparentResult;
|
|
180
|
+
};
|
|
181
|
+
}) => unknown;
|
|
182
|
+
'split-divider'?: (props: {
|
|
183
|
+
state: {
|
|
184
|
+
parentId: string;
|
|
185
|
+
dividerIndex: number;
|
|
186
|
+
direction: "horizontal" | "vertical";
|
|
187
|
+
rect: Rect;
|
|
188
|
+
isDragging: boolean;
|
|
189
|
+
};
|
|
190
|
+
}) => unknown;
|
|
191
|
+
}> & {
|
|
192
|
+
'reparent-ghost'?: (props: {
|
|
193
|
+
state: {
|
|
194
|
+
rect: Rect;
|
|
195
|
+
target: DropTarget;
|
|
196
|
+
result: CanReparentResult;
|
|
197
|
+
};
|
|
198
|
+
}) => unknown;
|
|
199
|
+
'split-divider'?: (props: {
|
|
200
|
+
state: {
|
|
201
|
+
parentId: string;
|
|
202
|
+
dividerIndex: number;
|
|
203
|
+
direction: "horizontal" | "vertical";
|
|
204
|
+
rect: Rect;
|
|
205
|
+
isDragging: boolean;
|
|
206
|
+
};
|
|
207
|
+
}) => unknown;
|
|
208
|
+
};
|
|
209
|
+
refs: {
|
|
210
|
+
layerEl: HTMLDivElement;
|
|
211
|
+
};
|
|
212
|
+
rootEl: HTMLDivElement;
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
declare type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
216
|
+
|
|
217
|
+
declare type __VLS_TemplateResult_2 = ReturnType<typeof __VLS_template_2>;
|
|
218
|
+
|
|
219
|
+
declare type __VLS_TemplateResult_3 = ReturnType<typeof __VLS_template_3>;
|
|
220
|
+
|
|
221
|
+
declare type __VLS_WithTemplateSlots<T, S> = T & {
|
|
222
|
+
new (): {
|
|
223
|
+
$slots: S;
|
|
224
|
+
};
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
declare type __VLS_WithTemplateSlots_2<T, S> = T & {
|
|
228
|
+
new (): {
|
|
229
|
+
$slots: S;
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
declare type __VLS_WithTemplateSlots_3<T, S> = T & {
|
|
234
|
+
new (): {
|
|
235
|
+
$slots: S;
|
|
236
|
+
};
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
export declare function applyEffectiveSplitRatiosToDocument(doc: PageDocument): PageDocument;
|
|
240
|
+
|
|
241
|
+
export declare function applySplitDividerDrag(startRatios: readonly number[], dividerIndex: number, deltaPx: number, parentAxisPx: number, gap?: number): number[];
|
|
242
|
+
|
|
243
|
+
export declare function assertNeverBindingSource(s: never): never;
|
|
244
|
+
|
|
245
|
+
export declare function assertNeverBindingTarget(t: never): never;
|
|
246
|
+
|
|
247
|
+
export declare interface AssetRef {
|
|
248
|
+
id: string;
|
|
249
|
+
type?: 'image' | 'video' | 'font' | 'json' | 'file';
|
|
250
|
+
url?: string;
|
|
251
|
+
name?: string;
|
|
252
|
+
meta?: Record<string, unknown>;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export declare interface AssetResolver {
|
|
256
|
+
resolve(ref: AssetRef): string | Promise<string>;
|
|
257
|
+
__clearCache(): void;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export declare interface AssetsAdapter {
|
|
261
|
+
resolve(ref: AssetRef): string | Promise<string>;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export declare type BindingErrorCode = 'target-not-mounted' | 'unsupported-cross-canvas' | 'unknown-target-data-input' | 'no-data-adapter' | 'data-query-failed' | 'cycle-detected' | 'invoke-failed';
|
|
265
|
+
|
|
266
|
+
export declare interface BindingErrorEvent {
|
|
267
|
+
bindingId: string;
|
|
268
|
+
code: BindingErrorCode;
|
|
269
|
+
message?: string;
|
|
270
|
+
detail?: unknown;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export declare interface BindingErrorPolicy {
|
|
274
|
+
onError?: 'continue' | 'stop' | 'log';
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
export declare type BindingEventCb<E extends 'binding:fire' | 'binding:error' | 'binding:trace'> = E extends 'binding:fire' ? (event: BindingFireEvent) => void : E extends 'binding:error' ? (event: BindingErrorEvent) => void : (event: BindingTraceEvent) => void;
|
|
278
|
+
|
|
279
|
+
export declare interface BindingFireEvent {
|
|
280
|
+
bindingId: string;
|
|
281
|
+
source: BindingSource;
|
|
282
|
+
target: BindingTarget;
|
|
283
|
+
payload: unknown;
|
|
284
|
+
args: unknown[];
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export declare interface BindingInstanceRef {
|
|
288
|
+
canvasId?: string;
|
|
289
|
+
instanceId: string;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
export declare type BindingIssue = BindingScopedIssue | InstanceDataInputMissingIssue;
|
|
293
|
+
|
|
294
|
+
declare interface BindingIssueBase {
|
|
295
|
+
level: BindingIssueLevel;
|
|
296
|
+
message: string;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
export declare type BindingIssueCode = BindingIssue['code'];
|
|
300
|
+
|
|
301
|
+
export declare type BindingIssueLevel = 'error' | 'warn' | 'info';
|
|
302
|
+
|
|
303
|
+
export declare type BindingMapping = {
|
|
304
|
+
kind: 'passthrough';
|
|
305
|
+
} | {
|
|
306
|
+
kind: 'static';
|
|
307
|
+
args: unknown[];
|
|
308
|
+
} | {
|
|
309
|
+
kind: 'pickPath';
|
|
310
|
+
paths: Array<{
|
|
311
|
+
from: string;
|
|
312
|
+
to?: number | string;
|
|
313
|
+
}>;
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
export declare function bindingModeForCanvasMode(canvasMode: CanvasMode): CanvasBindingMode;
|
|
317
|
+
|
|
318
|
+
export declare function bindingReferencesInstance(binding: NormalizedPageBinding, instanceId: string, canvasId?: string): boolean;
|
|
319
|
+
|
|
320
|
+
export declare interface BindingSchedule {
|
|
321
|
+
once?: boolean;
|
|
322
|
+
throttle?: {
|
|
323
|
+
windowMs: number;
|
|
324
|
+
leading?: boolean;
|
|
325
|
+
trailing?: boolean;
|
|
326
|
+
};
|
|
327
|
+
debounce?: {
|
|
328
|
+
windowMs: number;
|
|
329
|
+
leading?: boolean;
|
|
330
|
+
trailing?: boolean;
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
export declare interface BindingScopedIssue extends BindingIssueBase {
|
|
335
|
+
code: 'invalid-type-source-kind' | 'unknown-source-event' | 'unknown-target-method' | 'unknown-target-event' | 'unknown-target-data-input' | 'orphan-binding' | 'schedule-window-too-small' | 'unsupported-cross-canvas';
|
|
336
|
+
bindingId: string;
|
|
337
|
+
instanceId?: string;
|
|
338
|
+
canvasId?: string;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export declare type BindingSource = {
|
|
342
|
+
kind: 'instanceEvent';
|
|
343
|
+
canvasId?: string;
|
|
344
|
+
instanceId: string;
|
|
345
|
+
event: string;
|
|
346
|
+
} | {
|
|
347
|
+
kind: 'lifecycle';
|
|
348
|
+
canvasId?: string;
|
|
349
|
+
instanceId: string;
|
|
350
|
+
hook: 'mounted' | 'unmounted';
|
|
351
|
+
} | {
|
|
352
|
+
kind: 'page';
|
|
353
|
+
hook: 'pageInit' | 'pageBeforeUnmount';
|
|
354
|
+
} | {
|
|
355
|
+
kind: 'dataSource';
|
|
356
|
+
sourceId: string;
|
|
357
|
+
watch?: 'change';
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
export declare type BindingTarget = {
|
|
361
|
+
kind: 'instanceMethod';
|
|
362
|
+
canvasId?: string;
|
|
363
|
+
instanceId: string;
|
|
364
|
+
method: string;
|
|
365
|
+
} | {
|
|
366
|
+
kind: 'instanceDataInput';
|
|
367
|
+
canvasId?: string;
|
|
368
|
+
instanceId: string;
|
|
369
|
+
key: string;
|
|
370
|
+
} | {
|
|
371
|
+
kind: 'instanceEmit';
|
|
372
|
+
canvasId?: string;
|
|
373
|
+
instanceId: string;
|
|
374
|
+
event: string;
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
export declare interface BindingTestTrace {
|
|
378
|
+
bindingId: string;
|
|
379
|
+
phase: 'mapping' | 'shouldFire' | 'calling-target' | 'done' | 'skipped' | 'error';
|
|
380
|
+
details: Record<string, unknown>;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
export declare interface BindingTraceEvent {
|
|
384
|
+
kind: BindingTraceKind;
|
|
385
|
+
canvasId: string;
|
|
386
|
+
bindingId: string;
|
|
387
|
+
ts: number;
|
|
388
|
+
seq: number;
|
|
389
|
+
chainId?: string;
|
|
390
|
+
reason?: string;
|
|
391
|
+
payload?: unknown;
|
|
392
|
+
args?: unknown[];
|
|
393
|
+
code?: BindingErrorCode;
|
|
394
|
+
message?: string;
|
|
395
|
+
detail?: unknown;
|
|
396
|
+
schedule?: {
|
|
397
|
+
windowMs?: number;
|
|
398
|
+
leading?: boolean;
|
|
399
|
+
trailing?: boolean;
|
|
400
|
+
kind?: 'throttle' | 'debounce';
|
|
401
|
+
};
|
|
402
|
+
cacheKey?: string;
|
|
403
|
+
sourceId?: string;
|
|
404
|
+
writeSeq?: number;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
export declare type BindingTraceKind = 'fire' | 'mapping-failed' | 'scheduled-skipped' | 'scheduled-deferred' | 'scheduled-flushed' | 'scheduled-dropped' | 'error' | 'cycle-detected' | 'stopped-skipped' | 'wire-skipped' | 'data-query-started' | 'data-source-update' | 'data-query-skipped';
|
|
408
|
+
|
|
409
|
+
export declare function buildInstanceTree(instances: readonly PageInstance[]): PageInstanceTreeNode[];
|
|
410
|
+
|
|
411
|
+
export declare interface CannotDragLayoutManagedChildEvent {
|
|
412
|
+
instanceId: string;
|
|
413
|
+
parentId: string | undefined;
|
|
414
|
+
parentLayoutMode: ContainerLayoutConfig['mode'];
|
|
415
|
+
token: number;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
export declare interface CannotDragSlotChildEvent {
|
|
419
|
+
instanceId: string;
|
|
420
|
+
parentId: string | undefined;
|
|
421
|
+
token: number;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
export declare interface CannotReparentEvent {
|
|
425
|
+
instanceId: string;
|
|
426
|
+
target: TreeMoveTarget;
|
|
427
|
+
reason: 'instance-not-exists' | 'parent-not-exists' | 'self-parent' | 'cycle' | 'parent-not-layout' | 'slot-not-exists' | 'accepts-violation' | 'slot-multiple-violated' | 'max-children-exceeded';
|
|
428
|
+
message: string;
|
|
429
|
+
token: number;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
export declare type CannotReparentReason = 'instance-not-exists' | 'parent-not-exists' | 'self-parent' | 'cycle' | 'parent-not-layout' | 'slot-not-exists' | 'accepts-violation' | 'slot-multiple-violated' | 'max-children-exceeded';
|
|
433
|
+
|
|
434
|
+
export declare function canReparent(instances: readonly PageInstance[], instanceId: string, target: TreeMoveTarget, opts?: CanReparentOptions): CanReparentResult;
|
|
435
|
+
|
|
436
|
+
export declare interface CanReparentOptions {
|
|
437
|
+
resolveContract?: ReparentContractResolver;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
export declare interface CanReparentResult {
|
|
441
|
+
ok: boolean;
|
|
442
|
+
reason?: CannotReparentReason;
|
|
443
|
+
message?: string;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
export declare const CANVAS_CONTEXT_KEY: InjectionKey<CanvasContext>;
|
|
447
|
+
|
|
448
|
+
export declare const CANVAS_REPARENT_BRIDGE_KEY: InjectionKey<ReparentBridge>;
|
|
449
|
+
|
|
450
|
+
export declare type CanvasAction = CanvasDocumentAction | CanvasSelectionAction;
|
|
451
|
+
|
|
452
|
+
export declare interface CanvasActionHooks {
|
|
453
|
+
onBeforeAction?: (action: CanvasAction) => boolean | void;
|
|
454
|
+
onAfterAction?: (action: CanvasAction) => void;
|
|
455
|
+
onAfterBatch?: (batchType?: string) => void;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
export declare interface CanvasAdapters {
|
|
459
|
+
data?: DataAdapter;
|
|
460
|
+
assets?: AssetsAdapter;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
export declare interface CanvasBackgroundConfig {
|
|
464
|
+
color?: string;
|
|
465
|
+
image?: AssetRef;
|
|
466
|
+
imageFit?: 'cover' | 'contain' | 'repeat' | 'stretch' | 'center';
|
|
467
|
+
imagePosition?: string;
|
|
468
|
+
opacity?: number;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
export declare interface CanvasBehaviorConfig {
|
|
472
|
+
selectable?: boolean;
|
|
473
|
+
draggable?: boolean;
|
|
474
|
+
resizable?: boolean;
|
|
475
|
+
keyboardMove?: boolean;
|
|
476
|
+
snap?: boolean;
|
|
477
|
+
grid?: boolean;
|
|
478
|
+
allowOverflow?: boolean;
|
|
479
|
+
locked?: boolean;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
export declare type CanvasBindingMode = 'off' | 'data-preview' | 'runtime';
|
|
483
|
+
|
|
484
|
+
export declare type CanvasCommandId = 'undo' | 'redo' | 'deleteSelection' | 'duplicateSelection' | 'clearSelection' | 'cancelInteraction' | 'zoomIn' | 'zoomOut' | 'zoom100' | 'resetViewport' | 'fitToContent' | 'fitToSelection' | 'fitToSelectionOrContent' | 'nudgeSelection' | 'nudgeSelectionLarge' | 'lockSelection' | 'unlockSelection' | 'bringForward' | 'sendBackward' | 'bringToFront' | 'sendToBack' | 'toggleGrid' | 'toggleRuler' | (string & {});
|
|
485
|
+
|
|
486
|
+
export declare interface CanvasContext {
|
|
487
|
+
document: DocumentStore;
|
|
488
|
+
selection: SelectionStore;
|
|
489
|
+
viewport: ViewportStore;
|
|
490
|
+
scheduler: RenderScheduler;
|
|
491
|
+
adapters: CanvasAdapters;
|
|
492
|
+
dataStore: DataSourceStore;
|
|
493
|
+
dispatch(action: CanvasAction): void;
|
|
494
|
+
dispose(): void;
|
|
495
|
+
readonly isBatching: ComputedRef<boolean>;
|
|
496
|
+
beginBatch(): void;
|
|
497
|
+
endBatch(batchType?: string): void;
|
|
498
|
+
registerHooks(hooks: CanvasActionHooks): () => void;
|
|
499
|
+
readonly isRecordingSuppressed: ComputedRef<boolean>;
|
|
500
|
+
suppressRecording<T>(fn: () => T): T;
|
|
501
|
+
readonly effectiveBehavior: ComputedRef<CanvasBehaviorConfig>;
|
|
502
|
+
readonly interactionOptions: ComputedRef<Readonly<Partial<InteractionOptions>>>;
|
|
503
|
+
setInteractionOptions(options: Partial<InteractionOptions>): void;
|
|
504
|
+
readonly toolMode: ComputedRef<CanvasToolMode>;
|
|
505
|
+
setToolMode(mode: CanvasToolMode): void;
|
|
506
|
+
setTemporaryToolMode(mode: CanvasToolMode | null): void;
|
|
507
|
+
readonly mouseCanvasPoint: ComputedRef<{
|
|
508
|
+
x: number;
|
|
509
|
+
y: number;
|
|
510
|
+
} | null>;
|
|
511
|
+
setMouseCanvasPoint(point: {
|
|
512
|
+
x: number;
|
|
513
|
+
y: number;
|
|
514
|
+
} | null): void;
|
|
515
|
+
readonly measuredStageSize: ComputedRef<MeasuredStageSize>;
|
|
516
|
+
readonly measuredCanvasSize: ComputedRef<MeasuredStageSize>;
|
|
517
|
+
setMeasuredStageSize(size: MeasuredStageSize): void;
|
|
518
|
+
readonly layoutIssues: ComputedRef<readonly LayoutIssue[]>;
|
|
519
|
+
setLayoutIssues(issues: readonly LayoutIssue[]): void;
|
|
520
|
+
readonly cannotDragLayoutManagedChildEvent: Readonly<Ref<CannotDragLayoutManagedChildEvent | null>>;
|
|
521
|
+
setCannotDragLayoutManagedChildEvent(ev: CannotDragLayoutManagedChildEvent | null): void;
|
|
522
|
+
resolveAsset(ref: AssetRef): string | Promise<string>;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
export declare interface CanvasContextOptions {
|
|
526
|
+
initialDocument?: PageDocument;
|
|
527
|
+
scheduler?: RenderSchedulerOptions;
|
|
528
|
+
viewport?: ViewportStoreOptions;
|
|
529
|
+
adapters?: CanvasAdapters;
|
|
530
|
+
hooks?: CanvasActionHooks;
|
|
531
|
+
getMode?: () => CanvasMode;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
export declare type CanvasDocumentAction = {
|
|
535
|
+
type: 'addInstance';
|
|
536
|
+
payload: {
|
|
537
|
+
instance: PageInstance;
|
|
538
|
+
};
|
|
539
|
+
} | {
|
|
540
|
+
type: 'removeInstance';
|
|
541
|
+
payload: {
|
|
542
|
+
instanceId: string;
|
|
543
|
+
};
|
|
544
|
+
} | {
|
|
545
|
+
type: 'updateInstance';
|
|
546
|
+
payload: {
|
|
547
|
+
instanceId: string;
|
|
548
|
+
patch: Partial<PageInstance>;
|
|
549
|
+
};
|
|
550
|
+
} | {
|
|
551
|
+
type: 'moveInstance';
|
|
552
|
+
payload: {
|
|
553
|
+
instanceId: string;
|
|
554
|
+
x: number;
|
|
555
|
+
y: number;
|
|
556
|
+
};
|
|
557
|
+
} | {
|
|
558
|
+
type: 'resizeInstance';
|
|
559
|
+
payload: {
|
|
560
|
+
instanceId: string;
|
|
561
|
+
w: number;
|
|
562
|
+
h: number;
|
|
563
|
+
};
|
|
564
|
+
} | {
|
|
565
|
+
type: 'setInstanceProp';
|
|
566
|
+
payload: {
|
|
567
|
+
instanceId: string;
|
|
568
|
+
key: string;
|
|
569
|
+
value: unknown;
|
|
570
|
+
};
|
|
571
|
+
} | {
|
|
572
|
+
type: 'addBinding';
|
|
573
|
+
payload: {
|
|
574
|
+
binding: PageBindingInput;
|
|
575
|
+
};
|
|
576
|
+
} | {
|
|
577
|
+
type: 'removeBinding';
|
|
578
|
+
payload: {
|
|
579
|
+
bindingId: string;
|
|
580
|
+
};
|
|
581
|
+
} | {
|
|
582
|
+
type: 'updateBinding';
|
|
583
|
+
payload: {
|
|
584
|
+
bindingId: string;
|
|
585
|
+
patch: PageBindingPatch;
|
|
586
|
+
};
|
|
587
|
+
} | {
|
|
588
|
+
type: 'updateLayout';
|
|
589
|
+
payload: {
|
|
590
|
+
patch: Partial<CanvasLayoutConfig>;
|
|
591
|
+
};
|
|
592
|
+
} | {
|
|
593
|
+
type: 'setRootLayout';
|
|
594
|
+
payload: {
|
|
595
|
+
rootLayout: ContainerLayoutConfig | null;
|
|
596
|
+
};
|
|
597
|
+
} | {
|
|
598
|
+
type: 'replaceDocument';
|
|
599
|
+
payload: {
|
|
600
|
+
document: PageDocument;
|
|
601
|
+
};
|
|
602
|
+
} | {
|
|
603
|
+
type: 'setComponentOverride';
|
|
604
|
+
payload: {
|
|
605
|
+
instanceId: string;
|
|
606
|
+
override: PageComponentOverride | null;
|
|
607
|
+
};
|
|
608
|
+
} | {
|
|
609
|
+
type: 'setInstanceLocked';
|
|
610
|
+
payload: {
|
|
611
|
+
instanceId: string;
|
|
612
|
+
locked: boolean;
|
|
613
|
+
};
|
|
614
|
+
} | {
|
|
615
|
+
type: 'duplicateInstance';
|
|
616
|
+
payload: {
|
|
617
|
+
instanceId: string;
|
|
618
|
+
newInstanceId: string;
|
|
619
|
+
offset?: {
|
|
620
|
+
x: number;
|
|
621
|
+
y: number;
|
|
622
|
+
};
|
|
623
|
+
};
|
|
624
|
+
} | {
|
|
625
|
+
type: 'setInstanceSize';
|
|
626
|
+
payload: {
|
|
627
|
+
instanceId: string;
|
|
628
|
+
size: PageInstanceSize | null;
|
|
629
|
+
};
|
|
630
|
+
} | {
|
|
631
|
+
type: 'setContainerLayout';
|
|
632
|
+
payload: {
|
|
633
|
+
instanceId: string;
|
|
634
|
+
containerLayout: ContainerLayoutConfig | null;
|
|
635
|
+
};
|
|
636
|
+
} | {
|
|
637
|
+
type: 'updateLayoutBox';
|
|
638
|
+
payload: {
|
|
639
|
+
instanceId: string;
|
|
640
|
+
patch: Partial<LayoutBox>;
|
|
641
|
+
};
|
|
642
|
+
} | {
|
|
643
|
+
type: 'updateLayoutItem';
|
|
644
|
+
payload: {
|
|
645
|
+
instanceId: string;
|
|
646
|
+
patch: Partial<LayoutItem> | null;
|
|
647
|
+
};
|
|
648
|
+
} | {
|
|
649
|
+
type: 'updateRotation';
|
|
650
|
+
payload: {
|
|
651
|
+
instanceId: string;
|
|
652
|
+
value: number;
|
|
653
|
+
};
|
|
654
|
+
};
|
|
655
|
+
|
|
656
|
+
export declare interface CanvasFeatures {
|
|
657
|
+
showHistory?: boolean;
|
|
658
|
+
showDiff?: boolean;
|
|
659
|
+
enablePublish?: boolean;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
export declare interface CanvasGridConfig {
|
|
663
|
+
visible?: boolean;
|
|
664
|
+
size?: number;
|
|
665
|
+
color?: string;
|
|
666
|
+
opacity?: number;
|
|
667
|
+
snap?: boolean;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
export declare interface CanvasGuide {
|
|
671
|
+
id: string;
|
|
672
|
+
axis: 'x' | 'y';
|
|
673
|
+
position: number;
|
|
674
|
+
locked?: boolean;
|
|
675
|
+
label?: string;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
export declare interface CanvasHandle {
|
|
679
|
+
dispatch(action: CanvasAction): void;
|
|
680
|
+
beginBatch(): void;
|
|
681
|
+
endBatch(batchType?: string): void;
|
|
682
|
+
readonly isBatching: Readonly<Ref<boolean>>;
|
|
683
|
+
getSnapshot(): PageDocument;
|
|
684
|
+
readonly selectedIds: Readonly<Ref<readonly string[]>>;
|
|
685
|
+
readonly selectedInstances: ComputedRef<readonly PageInstance[]>;
|
|
686
|
+
readonly viewport: ViewportStore;
|
|
687
|
+
clientToCanvasPoint(point: Point): Point;
|
|
688
|
+
getInstanceAtClientPoint(point: Point): PageInstance | null;
|
|
689
|
+
getDropTarget(point: Point, root?: ParentNode | null, options?: {
|
|
690
|
+
excludeInstanceId?: string;
|
|
691
|
+
}): DropTarget | null;
|
|
692
|
+
duplicateInstance(instanceId: string, options?: DuplicateInstanceOptions): string | null;
|
|
693
|
+
undo(): void;
|
|
694
|
+
redo(): void;
|
|
695
|
+
readonly canUndo: ComputedRef<boolean>;
|
|
696
|
+
readonly canRedo: ComputedRef<boolean>;
|
|
697
|
+
readonly undoStackSize: ComputedRef<number>;
|
|
698
|
+
readonly redoStackSize: ComputedRef<number>;
|
|
699
|
+
clearHistory(): void;
|
|
700
|
+
getLayoutConfig(): CanvasLayoutConfig;
|
|
701
|
+
updateCanvasSize(viewport: Partial<CanvasViewportConfig>): void;
|
|
702
|
+
updateCanvasBackground(bg: Partial<CanvasBackgroundConfig> | null): void;
|
|
703
|
+
updateBehavior(behavior: Partial<CanvasBehaviorConfig>): void;
|
|
704
|
+
setInteractionOptions(options: Partial<InteractionOptions>): void;
|
|
705
|
+
setRootLayout(mode: ContainerLayoutConfig | 'free' | 'split' | 'grid' | 'flex' | 'none' | null): void;
|
|
706
|
+
getEffectiveBehavior(): CanvasBehaviorConfig;
|
|
707
|
+
getInstanceTree(): PageInstanceTreeNode[];
|
|
708
|
+
getInstanceList(): PageInstance[];
|
|
709
|
+
getInstance(instanceId: string): PageInstance | null;
|
|
710
|
+
getSelectedPath(): PageInstanceTreeNode[];
|
|
711
|
+
getBreadcrumb(instanceId: string): PageInstance[];
|
|
712
|
+
focusInstance(instanceId: string): void;
|
|
713
|
+
scrollToInstance(instanceId: string): void;
|
|
714
|
+
resolveAsset(ref: AssetRef): string | Promise<string>;
|
|
715
|
+
moveInstanceInTree(instanceId: string, target: TreeMoveTarget): void;
|
|
716
|
+
canReparent(instanceId: string, target: TreeMoveTarget): CanReparentResult;
|
|
717
|
+
readonly cannotReparentEvent: Readonly<Ref<CannotReparentEvent | null>>;
|
|
718
|
+
readonly cannotDragLayoutManagedChildEvent: Readonly<Ref<CannotDragLayoutManagedChildEvent | null>>;
|
|
719
|
+
getViewportState(): ViewportState;
|
|
720
|
+
getVisibleBounds(): Rect_2;
|
|
721
|
+
getCanvasBounds(): Rect_2;
|
|
722
|
+
getContentBounds(): Rect_2 | null;
|
|
723
|
+
getSelectionBounds(): Rect_2 | null;
|
|
724
|
+
getInstanceBounds(instanceId: string): Rect_2 | null;
|
|
725
|
+
panBy(dx: number, dy: number): void;
|
|
726
|
+
panTo(panX: number, panY: number): void;
|
|
727
|
+
zoomTo(scale: number, options?: {
|
|
728
|
+
center?: Point;
|
|
729
|
+
}): void;
|
|
730
|
+
zoomBy(delta: number, options?: {
|
|
731
|
+
center?: Point;
|
|
732
|
+
}): void;
|
|
733
|
+
zoomToPoint(scale: number, clientPoint: Point): void;
|
|
734
|
+
resetViewport(): void;
|
|
735
|
+
fitToContent(options?: FitOptions): void;
|
|
736
|
+
fitToSelection(options?: FitOptions): void;
|
|
737
|
+
scrollToRect(rect: Rect_2, options?: FitOptions): void;
|
|
738
|
+
readonly toolMode: ComputedRef<CanvasToolMode>;
|
|
739
|
+
getToolMode(): CanvasToolMode;
|
|
740
|
+
setToolMode(mode: CanvasToolMode): void;
|
|
741
|
+
setTemporaryToolMode(mode: CanvasToolMode | null): void;
|
|
742
|
+
getDefaultShortcuts(): CanvasShortcutBinding[];
|
|
743
|
+
executeShortcut(event: KeyboardEvent): boolean;
|
|
744
|
+
executeCommand(id: CanvasCommandId, payload?: unknown): void;
|
|
745
|
+
canExecuteCommand(id: CanvasCommandId): boolean;
|
|
746
|
+
getStaleComponentOverrides(): StaleComponentOverride[];
|
|
747
|
+
setComponentOverride(instanceId: string, override: PageComponentOverride | null): void;
|
|
748
|
+
discardComponentOverride(instanceId: string): void;
|
|
749
|
+
getLayoutIssues(): readonly LayoutIssue[];
|
|
750
|
+
setRulerVisible(visible: boolean): void;
|
|
751
|
+
setGridVisible(visible: boolean): void;
|
|
752
|
+
updateRulerConfig(patch: Partial<CanvasRulerConfig>): void;
|
|
753
|
+
updateGridConfig(patch: Partial<CanvasGridConfig>): void;
|
|
754
|
+
addGuide(guide: Omit<CanvasGuide, 'id'> & {
|
|
755
|
+
id?: string;
|
|
756
|
+
}): string;
|
|
757
|
+
removeGuide(id: string): void;
|
|
758
|
+
updateGuide(id: string, patch: Partial<CanvasGuide>): void;
|
|
759
|
+
getGuides(): CanvasGuide[];
|
|
760
|
+
clearGuides(): void;
|
|
761
|
+
getMouseCanvasPoint(): {
|
|
762
|
+
x: number;
|
|
763
|
+
y: number;
|
|
764
|
+
} | null;
|
|
765
|
+
getInstanceSize(instanceId: string): PageInstanceSize | undefined;
|
|
766
|
+
updateInstanceSize(instanceId: string, size: PageInstanceSize | null): void;
|
|
767
|
+
getContainerLayout(instanceId: string): ContainerLayoutConfig | null;
|
|
768
|
+
updateContainerLayout(instanceId: string, containerLayout: ContainerLayoutConfig | null): void;
|
|
769
|
+
getLayoutBox(instanceId: string): LayoutBox | undefined;
|
|
770
|
+
updateLayoutBox(instanceId: string, patch: Partial<LayoutBox>): void;
|
|
771
|
+
getLayoutItem(instanceId: string): LayoutItem | undefined;
|
|
772
|
+
updateLayoutItem(instanceId: string, patch: Partial<LayoutItem> | null): void;
|
|
773
|
+
getRotation(instanceId: string): number;
|
|
774
|
+
updateRotation(instanceId: string, value: number): void;
|
|
775
|
+
getInstanceOutletRect(parentId: string, slot?: string): DOMRect | null;
|
|
776
|
+
setBindingMode(mode: CanvasBindingMode): void;
|
|
777
|
+
getBindingMode(): CanvasBindingMode;
|
|
778
|
+
testBinding(bindingId: string, mockPayload?: unknown): BindingTestTrace[];
|
|
779
|
+
on<E extends 'binding:fire' | 'binding:error' | 'binding:trace'>(event: E, cb: BindingEventCb<E>): () => void;
|
|
780
|
+
startTracing(opts?: TraceCollectorOptions): void;
|
|
781
|
+
stopTracing(): BindingTraceEvent[];
|
|
782
|
+
getTraceBuffer(): readonly BindingTraceEvent[];
|
|
783
|
+
invalidateDataSource(sourceId?: string): void;
|
|
784
|
+
getDataSourceSnapshot(): DataSourceSnapshot;
|
|
785
|
+
attachBindingDelegate(delegate: WirePageBindingsHandle | null, dataStore?: DataSourceStore | null): void;
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
export declare interface CanvasHandleOptions {
|
|
789
|
+
getStageEl: () => HTMLElement | null;
|
|
790
|
+
recorder?: {
|
|
791
|
+
maxSize?: number;
|
|
792
|
+
};
|
|
793
|
+
resolveContract?: ReparentContractResolver;
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
export declare interface CanvasInteraction {
|
|
797
|
+
marquee: Readonly<MarqueeState>;
|
|
798
|
+
marqueeRect: ComputedRef<Rect | null>;
|
|
799
|
+
drag: Readonly<DragState>;
|
|
800
|
+
isDragging: ComputedRef<boolean>;
|
|
801
|
+
resize: Readonly<ResizeState>;
|
|
802
|
+
isResizing: ComputedRef<boolean>;
|
|
803
|
+
snapLines: Readonly<Ref<readonly SnapLine[]>>;
|
|
804
|
+
cannotDragSlotChildEvent: Readonly<Ref<CannotDragSlotChildEvent | null>>;
|
|
805
|
+
cannotDragLayoutManagedChildEvent: Readonly<Ref<CannotDragLayoutManagedChildEvent | null>>;
|
|
806
|
+
handlePointerDown(canvasPt: Point, modifierKeys: ModifierKeys): {
|
|
807
|
+
startTracking: boolean;
|
|
808
|
+
};
|
|
809
|
+
handlePointerMove(canvasPt: Point): void;
|
|
810
|
+
handlePointerUp(): void;
|
|
811
|
+
cancelMarquee(): void;
|
|
812
|
+
cancelDrag(): void;
|
|
813
|
+
handleResizeStart(instanceId: string, handle: ResizeHandle, canvasPt: Point): {
|
|
814
|
+
startTracking: boolean;
|
|
815
|
+
};
|
|
816
|
+
cancelResize(): void;
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
export declare interface CanvasLayoutConfig {
|
|
820
|
+
type: 'free' | 'flow' | 'nested';
|
|
821
|
+
canvas: CanvasViewportConfig;
|
|
822
|
+
background?: CanvasBackgroundConfig;
|
|
823
|
+
behavior?: CanvasBehaviorConfig;
|
|
824
|
+
rootLayout?: ContainerLayoutConfig;
|
|
825
|
+
guides?: {
|
|
826
|
+
grid?: CanvasGridConfig;
|
|
827
|
+
ruler?: CanvasRulerConfig;
|
|
828
|
+
items?: CanvasGuide[];
|
|
829
|
+
};
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
export declare type CanvasMode = 'design' | 'preview' | 'runtime' | 'inspect';
|
|
833
|
+
|
|
834
|
+
export declare interface CanvasRulerConfig {
|
|
835
|
+
visible?: boolean;
|
|
836
|
+
unit?: 'px';
|
|
837
|
+
size?: number;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
export declare type CanvasSelectionAction = {
|
|
841
|
+
type: 'select';
|
|
842
|
+
payload: {
|
|
843
|
+
instanceId: string;
|
|
844
|
+
};
|
|
845
|
+
} | {
|
|
846
|
+
type: 'toggleSelect';
|
|
847
|
+
payload: {
|
|
848
|
+
instanceId: string;
|
|
849
|
+
};
|
|
850
|
+
} | {
|
|
851
|
+
type: 'addToSelection';
|
|
852
|
+
payload: {
|
|
853
|
+
instanceId: string;
|
|
854
|
+
};
|
|
855
|
+
} | {
|
|
856
|
+
type: 'removeFromSelection';
|
|
857
|
+
payload: {
|
|
858
|
+
instanceId: string;
|
|
859
|
+
};
|
|
860
|
+
} | {
|
|
861
|
+
type: 'clearSelection';
|
|
862
|
+
payload?: undefined;
|
|
863
|
+
} | {
|
|
864
|
+
type: 'selectAll';
|
|
865
|
+
payload: {
|
|
866
|
+
instanceIds: string[];
|
|
867
|
+
};
|
|
868
|
+
};
|
|
869
|
+
|
|
870
|
+
export declare interface CanvasShortcutBinding {
|
|
871
|
+
id: string;
|
|
872
|
+
keys: string[];
|
|
873
|
+
command: CanvasCommandId;
|
|
874
|
+
when?: CanvasShortcutWhen;
|
|
875
|
+
preventDefault?: boolean;
|
|
876
|
+
payload?: unknown;
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
export declare type CanvasShortcutWhen = 'always' | 'design' | 'hasSelection' | 'notEditingText';
|
|
880
|
+
|
|
881
|
+
export declare function canvasSizeToCss(size: CanvasSizeValue): string;
|
|
882
|
+
|
|
883
|
+
export declare type CanvasSizeValue = {
|
|
884
|
+
mode: 'px';
|
|
885
|
+
value: number;
|
|
886
|
+
} | {
|
|
887
|
+
mode: 'percent';
|
|
888
|
+
value: number;
|
|
889
|
+
} | {
|
|
890
|
+
mode: 'vw';
|
|
891
|
+
value: number;
|
|
892
|
+
} | {
|
|
893
|
+
mode: 'vh';
|
|
894
|
+
value: number;
|
|
895
|
+
} | {
|
|
896
|
+
mode: 'auto';
|
|
897
|
+
} | {
|
|
898
|
+
mode: 'fill';
|
|
899
|
+
};
|
|
900
|
+
|
|
901
|
+
export declare const CanvasStage: __VLS_WithTemplateSlots_2<typeof __VLS_component_2, __VLS_TemplateResult_2["slots"]>;
|
|
902
|
+
|
|
903
|
+
export declare type CanvasToolMode = 'select' | 'hand' | 'marquee' | 'insert' | 'inspect' | 'comment' | 'connect' | 'measure';
|
|
904
|
+
|
|
905
|
+
export declare interface CanvasVersionStatus {
|
|
906
|
+
currentVersionLabel?: string;
|
|
907
|
+
hasHistory?: boolean;
|
|
908
|
+
lastPublishedAt?: string;
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
export declare interface CanvasViewportConfig {
|
|
912
|
+
width: CanvasSizeValue;
|
|
913
|
+
height: CanvasSizeValue;
|
|
914
|
+
minWidth?: number;
|
|
915
|
+
minHeight?: number;
|
|
916
|
+
maxWidth?: number;
|
|
917
|
+
maxHeight?: number;
|
|
918
|
+
overflow?: 'visible' | 'hidden' | 'auto';
|
|
919
|
+
fit?: 'fixed' | 'contain' | 'cover' | 'width' | 'height';
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
export declare function cleanLayoutItem(item: LayoutItem | undefined): LayoutItem | null;
|
|
923
|
+
|
|
924
|
+
export declare function clientToCanvas(clientPt: Point, stageEl: HTMLElement, viewport: CanvasContext['viewport']): Point;
|
|
925
|
+
|
|
926
|
+
export declare interface CommandRecord {
|
|
927
|
+
type: string;
|
|
928
|
+
redo: CanvasAction[];
|
|
929
|
+
undo: CanvasAction[];
|
|
930
|
+
timestamp: number;
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
export declare interface CommandRecorder {
|
|
934
|
+
undo(): void;
|
|
935
|
+
redo(): void;
|
|
936
|
+
clear(): void;
|
|
937
|
+
canUndo: ComputedRef<boolean>;
|
|
938
|
+
canRedo: ComputedRef<boolean>;
|
|
939
|
+
undoStackSize: ComputedRef<number>;
|
|
940
|
+
redoStackSize: ComputedRef<number>;
|
|
941
|
+
dispose(): void;
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
export declare interface CommandStackOptions {
|
|
945
|
+
maxSize?: number;
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
export declare interface ComponentCatalogItem {
|
|
949
|
+
componentId: string;
|
|
950
|
+
name: string;
|
|
951
|
+
currentVersion: string;
|
|
952
|
+
description?: string;
|
|
953
|
+
thumbnailUrl?: string;
|
|
954
|
+
tags?: string[];
|
|
955
|
+
kind?: ComponentKind;
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
export declare interface ComponentContract {
|
|
959
|
+
propsDecl: PropDecl[];
|
|
960
|
+
emitsDecl: EmitDecl[];
|
|
961
|
+
methodsDecl: MethodDecl[];
|
|
962
|
+
slotsDecl: SlotDecl[];
|
|
963
|
+
modelDecl: ModelDecl[];
|
|
964
|
+
dataInputsDecl: DataInputDecl[];
|
|
965
|
+
dataOutputsDecl: DataOutputDecl[];
|
|
966
|
+
layoutDecl?: ComponentLayoutDecl;
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
export declare type ComponentKind = 'visual' | 'layout' | 'data';
|
|
970
|
+
|
|
971
|
+
export declare interface ComponentLayoutDecl {
|
|
972
|
+
role?: 'none' | 'container';
|
|
973
|
+
supportedLayouts?: Array<'split' | 'grid' | 'flow' | 'free'>;
|
|
974
|
+
defaultLayout?: ContainerLayoutConfig;
|
|
975
|
+
sizing?: {
|
|
976
|
+
defaultChildSize?: PageInstanceSize;
|
|
977
|
+
allowChildResize?: boolean;
|
|
978
|
+
allowChildDrag?: boolean;
|
|
979
|
+
allowChildReorder?: boolean;
|
|
980
|
+
};
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
export declare type ComponentSourceMap = Record<ComponentVersionKey, ComponentVersionAsset | DraftComponentVersionAsset>;
|
|
984
|
+
|
|
985
|
+
export declare interface ComponentVersionAsset {
|
|
986
|
+
key: ComponentVersionKey;
|
|
987
|
+
componentId: string;
|
|
988
|
+
version: string;
|
|
989
|
+
status: ComponentVersionStatus;
|
|
990
|
+
invalidReason?: string;
|
|
991
|
+
name?: string;
|
|
992
|
+
source?: Source;
|
|
993
|
+
contract?: ComponentContract;
|
|
994
|
+
kind?: ComponentKind;
|
|
995
|
+
updatedAt?: string;
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
export declare type ComponentVersionKey = string;
|
|
999
|
+
|
|
1000
|
+
export declare type ComponentVersionStatus = 'ok' | 'unavailable' | 'missing' | 'broken';
|
|
1001
|
+
|
|
1002
|
+
export declare function computeContentBounds(instances: readonly PageInstance[]): Rect_2 | null;
|
|
1003
|
+
|
|
1004
|
+
export declare function computeEffectiveSplitRatios(rawRatios: readonly number[] | undefined, childrenRatios: readonly (number | undefined)[]): number[];
|
|
1005
|
+
|
|
1006
|
+
export declare function computeFit(rect: Rect_2, container: {
|
|
1007
|
+
w: number;
|
|
1008
|
+
h: number;
|
|
1009
|
+
}, options?: FitOptions): FitResult;
|
|
1010
|
+
|
|
1011
|
+
export declare function computeInverse(action: CanvasAction, ctx: CanvasContext): CanvasAction[] | null;
|
|
1012
|
+
|
|
1013
|
+
export declare function computeNextAxisSize(startAxis: InstanceSizeAxis | undefined, newPxCanvas: number, outletPxCanvas: number | null): InstanceSizeAxis;
|
|
1014
|
+
|
|
1015
|
+
export declare function computeNextLayoutBoxAxis(startMode: LayoutBoxAxisMode | undefined, newPxCanvas: number, outletPxCanvas: number | null): {
|
|
1016
|
+
mode: LayoutBoxAxisMode;
|
|
1017
|
+
value: number;
|
|
1018
|
+
};
|
|
1019
|
+
|
|
1020
|
+
export declare function computeParentLayoutMode(layout: CanvasLayoutConfig | undefined | null, instances: readonly PageInstance[], instanceId: string): ContainerLayoutConfig['mode'] | undefined;
|
|
1021
|
+
|
|
1022
|
+
export declare function computeSelectionBounds(instances: readonly PageInstance[], selectedIds: readonly string[]): Rect_2 | null;
|
|
1023
|
+
|
|
1024
|
+
export declare function computeSlotChildCanvasRect(instanceId: string, stageEl: HTMLElement | null, viewport: CanvasContext['viewport']): Rect | null;
|
|
1025
|
+
|
|
1026
|
+
export declare function computeSnap(input: SnapInput): SnapResult;
|
|
1027
|
+
|
|
1028
|
+
export declare function computeSplitDividers(parentRect: Rect, ratios: readonly number[], direction: 'horizontal' | 'vertical', gap?: number): SplitDivider[];
|
|
1029
|
+
|
|
1030
|
+
export declare function computeVisibleBounds(viewport: {
|
|
1031
|
+
scale: number;
|
|
1032
|
+
panX: number;
|
|
1033
|
+
panY: number;
|
|
1034
|
+
}, container: {
|
|
1035
|
+
w: number;
|
|
1036
|
+
h: number;
|
|
1037
|
+
}): Rect_2;
|
|
1038
|
+
|
|
1039
|
+
export declare type ContainerLayoutConfig = {
|
|
1040
|
+
mode: 'none';
|
|
1041
|
+
} | FreeContainerLayout | FlexContainerLayout | SplitContainerLayout | GridContainerLayout;
|
|
1042
|
+
|
|
1043
|
+
export declare type ContainerLayoutMode = 'none' | 'free' | 'flex' | 'split' | 'grid';
|
|
1044
|
+
|
|
1045
|
+
export declare function containerLayoutToCss(cfg: ContainerLayoutConfig | undefined): Record<string, string> | null;
|
|
1046
|
+
|
|
1047
|
+
export declare type ContractResolver = (versionKey: ComponentVersionKey) => ComponentContract | undefined;
|
|
1048
|
+
|
|
1049
|
+
export declare function createAssetResolver(adapter?: AssetsAdapter): AssetResolver;
|
|
1050
|
+
|
|
1051
|
+
export declare function createCanvasContext(opts?: CanvasContextOptions): CanvasContext;
|
|
1052
|
+
|
|
1053
|
+
export declare function createCanvasHandle(ctx: CanvasContext, options: CanvasHandleOptions): CanvasHandle & {
|
|
1054
|
+
dispose(): void;
|
|
1055
|
+
};
|
|
1056
|
+
|
|
1057
|
+
export declare function createCanvasInteraction(ctx: CanvasContext, opts?: CreateCanvasInteractionOptions): CanvasInteraction;
|
|
1058
|
+
|
|
1059
|
+
export declare interface CreateCanvasInteractionOptions {
|
|
1060
|
+
getRoot?: () => ParentNode | null;
|
|
1061
|
+
getDomBox?: (instanceId: string) => Rect | null;
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
export declare function createCommandRecorder(ctx: CanvasContext, options?: CommandStackOptions): CommandRecorder;
|
|
1065
|
+
|
|
1066
|
+
export declare function createDocumentStore(initial?: PageDocumentInput): DocumentStore;
|
|
1067
|
+
|
|
1068
|
+
export declare function createFreePageDocument(opts?: Omit<CreatePageDocumentOptions, 'rootLayout'>): PageDocument;
|
|
1069
|
+
|
|
1070
|
+
export declare function createMinimalPageDocument(opts?: CreatePageDocumentOptions): PageDocument;
|
|
1071
|
+
|
|
1072
|
+
export declare interface CreatePageDocumentOptions {
|
|
1073
|
+
canvasWidth?: number;
|
|
1074
|
+
canvasHeight?: number;
|
|
1075
|
+
rootLayout?: ContainerLayoutMode | ContainerLayoutConfig;
|
|
1076
|
+
instances?: PageInstance[];
|
|
1077
|
+
bindings?: NormalizedPageBinding[];
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
export declare function createRenderScheduler(opts?: RenderSchedulerOptions): RenderScheduler;
|
|
1081
|
+
|
|
1082
|
+
export declare function createSelectionStore(): SelectionStore;
|
|
1083
|
+
|
|
1084
|
+
export declare function createSplitDividerInteraction(ctx: CanvasContext): SplitDividerInteraction;
|
|
1085
|
+
|
|
1086
|
+
export declare function createViewportStore(opts?: ViewportStoreOptions): ViewportStore;
|
|
1087
|
+
|
|
1088
|
+
export declare interface DataAdapter {
|
|
1089
|
+
query(input: DataQueryInput): unknown | Promise<unknown>;
|
|
1090
|
+
subscribe?(input: DataSubscribeInput, cb: (value: unknown) => void): () => void;
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
export declare interface DataInputDecl {
|
|
1094
|
+
key: string;
|
|
1095
|
+
type?: DeclValueType;
|
|
1096
|
+
label?: string;
|
|
1097
|
+
description?: string;
|
|
1098
|
+
required?: boolean;
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
export declare interface DataOutputDecl {
|
|
1102
|
+
key: string;
|
|
1103
|
+
type?: DeclValueType;
|
|
1104
|
+
label?: string;
|
|
1105
|
+
description?: string;
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
export declare interface DataQueryInput {
|
|
1109
|
+
sourceId: string;
|
|
1110
|
+
params?: Record<string, unknown>;
|
|
1111
|
+
signal?: AbortSignal;
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
export declare interface DataSourceEntry {
|
|
1115
|
+
cacheKey: string;
|
|
1116
|
+
sourceId: string;
|
|
1117
|
+
status: DataSourceStatus;
|
|
1118
|
+
value?: unknown;
|
|
1119
|
+
error?: unknown;
|
|
1120
|
+
lastFetchedAt?: number;
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
declare interface DataSourceRequestInput {
|
|
1124
|
+
bindingId: string;
|
|
1125
|
+
sourceId: string;
|
|
1126
|
+
params?: Record<string, unknown>;
|
|
1127
|
+
onUpdate: (value: unknown) => void;
|
|
1128
|
+
onError?: (err: unknown) => void;
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
export declare interface DataSourceSnapshot {
|
|
1132
|
+
readonly entries: ReadonlyArray<Readonly<DataSourceEntry>>;
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
export declare type DataSourceStatus = 'idle' | 'loading' | 'success' | 'error' | 'stale';
|
|
1136
|
+
|
|
1137
|
+
declare interface DataSourceStore {
|
|
1138
|
+
request(input: DataSourceRequestInput): void;
|
|
1139
|
+
subscribe(input: DataSourceSubscribeInput): void;
|
|
1140
|
+
removeBinding(bindingId: string, options?: {
|
|
1141
|
+
preserveCache?: boolean;
|
|
1142
|
+
}): void;
|
|
1143
|
+
invalidate(sourceId?: string): void;
|
|
1144
|
+
getSnapshot(): DataSourceSnapshot;
|
|
1145
|
+
disposeAll(): void;
|
|
1146
|
+
readonly isDisposed: boolean;
|
|
1147
|
+
attachTraceBridge(cb: (ev: StoreTraceEvent) => void): () => void;
|
|
1148
|
+
getBindingsForCacheKey(cacheKey: string): string[];
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
declare interface DataSourceSubscribeInput extends DataSourceRequestInput {
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
export declare interface DataSubscribeInput {
|
|
1155
|
+
sourceId: string;
|
|
1156
|
+
params?: Record<string, unknown>;
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
declare type DeclValueType = 'string' | 'number' | 'boolean' | 'object' | 'array' | 'any';
|
|
1160
|
+
|
|
1161
|
+
export declare const DEFAULT_FIT_PADDING = 40;
|
|
1162
|
+
|
|
1163
|
+
export declare const DIVIDER_HIT_THICKNESS = 8;
|
|
1164
|
+
|
|
1165
|
+
export declare interface DocumentSource {
|
|
1166
|
+
getDocument(): PageDocument | null;
|
|
1167
|
+
onAction?(cb: (action: unknown) => void): () => void;
|
|
1168
|
+
onDocumentChange?(cb: () => void): () => void;
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
export declare interface DocumentStore {
|
|
1172
|
+
readonly document: Readonly<PageDocument>;
|
|
1173
|
+
readonly instanceCount: ComputedRef<number>;
|
|
1174
|
+
readonly bindingCount: ComputedRef<number>;
|
|
1175
|
+
addInstance(instance: PageInstance): void;
|
|
1176
|
+
removeInstance(instanceId: string): void;
|
|
1177
|
+
updateInstance(instanceId: string, patch: Partial<PageInstance>): void;
|
|
1178
|
+
moveInstance(instanceId: string, x: number, y: number): void;
|
|
1179
|
+
resizeInstance(instanceId: string, w: number, h: number): void;
|
|
1180
|
+
setInstanceProp(instanceId: string, key: string, value: unknown): void;
|
|
1181
|
+
setInstanceLocked(instanceId: string, locked: boolean): void;
|
|
1182
|
+
setInstanceSize(instanceId: string, size: PageInstanceSize | null): void;
|
|
1183
|
+
setInstanceContainerLayout(instanceId: string, containerLayout: ContainerLayoutConfig | null): void;
|
|
1184
|
+
updateInstanceLayoutBox(instanceId: string, patch: Partial<LayoutBox>): void;
|
|
1185
|
+
updateInstanceLayoutItem(instanceId: string, patch: Partial<LayoutItem> | null): void;
|
|
1186
|
+
setInstanceRotation(instanceId: string, value: number): void;
|
|
1187
|
+
duplicateInstance(instanceId: string, newInstanceId: string, offset: {
|
|
1188
|
+
x: number;
|
|
1189
|
+
y: number;
|
|
1190
|
+
}): void;
|
|
1191
|
+
addBinding(binding: PageBindingInput): void;
|
|
1192
|
+
removeBinding(bindingId: string): void;
|
|
1193
|
+
updateBinding(bindingId: string, patch: PageBindingPatch): void;
|
|
1194
|
+
setComponentOverride(instanceId: string, override: PageComponentOverride | null): void;
|
|
1195
|
+
updateLayout(patch: Partial<CanvasLayoutConfig>): void;
|
|
1196
|
+
replaceDocument(newDoc: PageDocumentInput): void;
|
|
1197
|
+
getInstance(instanceId: string): PageInstance | undefined;
|
|
1198
|
+
listInstancesByComponentVersionKey(key: string): PageInstance[];
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
export declare interface DraftComponentVersionAsset {
|
|
1202
|
+
key: ComponentVersionKey;
|
|
1203
|
+
baseVersionKey: ComponentVersionKey;
|
|
1204
|
+
componentId: string;
|
|
1205
|
+
isDraft: true;
|
|
1206
|
+
status: 'ok';
|
|
1207
|
+
source: Source;
|
|
1208
|
+
contract: ComponentContract;
|
|
1209
|
+
contractParseError?: {
|
|
1210
|
+
message: string;
|
|
1211
|
+
at: string;
|
|
1212
|
+
};
|
|
1213
|
+
lastGoodSource: Source;
|
|
1214
|
+
lastGoodContract: ComponentContract;
|
|
1215
|
+
createdAt: string;
|
|
1216
|
+
updatedAt: string;
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
export declare const DRAG_THRESHOLD_CANVAS_PX = 3;
|
|
1220
|
+
|
|
1221
|
+
export declare interface DragState {
|
|
1222
|
+
status: 'idle' | 'pending' | 'active';
|
|
1223
|
+
startPt: Point | null;
|
|
1224
|
+
startRects: Map<string, {
|
|
1225
|
+
x: number;
|
|
1226
|
+
y: number;
|
|
1227
|
+
}>;
|
|
1228
|
+
deferredClickSelect: string | null;
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
export declare interface DropTarget {
|
|
1232
|
+
parentId: string;
|
|
1233
|
+
slot: string;
|
|
1234
|
+
outletEl: HTMLElement;
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
export declare interface DuplicateInstanceOptions {
|
|
1238
|
+
newInstanceId?: string;
|
|
1239
|
+
offset?: {
|
|
1240
|
+
x: number;
|
|
1241
|
+
y: number;
|
|
1242
|
+
};
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
export declare const EFFECTIVE_DEFAULT_SLOT = "default";
|
|
1246
|
+
|
|
1247
|
+
export declare function effectiveSlot(inst: PageInstance): string;
|
|
1248
|
+
|
|
1249
|
+
export declare interface EmitDecl {
|
|
1250
|
+
event: string;
|
|
1251
|
+
label?: string;
|
|
1252
|
+
description?: string;
|
|
1253
|
+
highFrequency?: boolean;
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
export declare function emptyPageDocument(): PageDocument;
|
|
1257
|
+
|
|
1258
|
+
export declare function filterExistingIds(ids: readonly string[], instances: readonly PageInstance[]): string[];
|
|
1259
|
+
|
|
1260
|
+
export declare function filterInstancesInRect(rect: Rect, instances: readonly PageInstance[], domBoxLookup?: (instanceId: string) => Rect | null): string[];
|
|
1261
|
+
|
|
1262
|
+
export declare function findInstanceBreadcrumb(instances: readonly PageInstance[], instanceId: string): PageInstance[];
|
|
1263
|
+
|
|
1264
|
+
export declare function findInstancePath(tree: readonly PageInstanceTreeNode[], instanceId: string): PageInstanceTreeNode[];
|
|
1265
|
+
|
|
1266
|
+
export declare interface FitOptions {
|
|
1267
|
+
padding?: number;
|
|
1268
|
+
maxScale?: number;
|
|
1269
|
+
minScale?: number;
|
|
1270
|
+
animate?: boolean;
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
export declare interface FitResult {
|
|
1274
|
+
scale: number;
|
|
1275
|
+
panX: number;
|
|
1276
|
+
panY: number;
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
export declare interface FlexContainerLayout {
|
|
1280
|
+
mode: 'flex';
|
|
1281
|
+
direction: 'row' | 'column';
|
|
1282
|
+
wrap?: boolean;
|
|
1283
|
+
gap?: number;
|
|
1284
|
+
justify?: 'start' | 'center' | 'end' | 'space-between' | 'space-around';
|
|
1285
|
+
align?: 'start' | 'center' | 'end' | 'stretch';
|
|
1286
|
+
}
|
|
1287
|
+
|
|
1288
|
+
export declare interface FreeContainerLayout {
|
|
1289
|
+
mode: 'free';
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
export declare function getBindingInstanceRefs(binding: NormalizedPageBinding): BindingInstanceRef[];
|
|
1293
|
+
|
|
1294
|
+
export declare function getDefaultShortcuts(): CanvasShortcutBinding[];
|
|
1295
|
+
|
|
1296
|
+
export declare function getDesignerHandle(canvasId: string): CanvasHandle | null;
|
|
1297
|
+
|
|
1298
|
+
export declare function getInstanceWrapperRectFromDom(instanceId: string, root?: ParentNode | null, canvasFallback?: boolean): DOMRect | null;
|
|
1299
|
+
|
|
1300
|
+
export declare function getOutletRectFromDom(parentId: string, slot?: string, root?: ParentNode | null): DOMRect | null;
|
|
1301
|
+
|
|
1302
|
+
export declare function getParentLayoutMode(ctx: CanvasContext, instanceId: string): ContainerLayoutConfig['mode'] | undefined;
|
|
1303
|
+
|
|
1304
|
+
export declare function getSiblings(instances: readonly PageInstance[], parentId: string | null | undefined, slot: string | undefined): PageInstance[];
|
|
1305
|
+
|
|
1306
|
+
export declare function getSlotChildRectFromDom(instanceId: string, root?: ParentNode | null): DOMRect | null;
|
|
1307
|
+
|
|
1308
|
+
export declare interface GridContainerLayout {
|
|
1309
|
+
mode: 'grid';
|
|
1310
|
+
columns: Array<{
|
|
1311
|
+
mode: 'fr' | 'px' | 'percent';
|
|
1312
|
+
value: number;
|
|
1313
|
+
}>;
|
|
1314
|
+
rows: Array<{
|
|
1315
|
+
mode: 'fr' | 'px' | 'percent' | 'auto';
|
|
1316
|
+
value?: number;
|
|
1317
|
+
}>;
|
|
1318
|
+
gap?: number | {
|
|
1319
|
+
row?: number;
|
|
1320
|
+
column?: number;
|
|
1321
|
+
};
|
|
1322
|
+
cells?: Record<string, {
|
|
1323
|
+
row: number;
|
|
1324
|
+
column: number;
|
|
1325
|
+
rowSpan?: number;
|
|
1326
|
+
columnSpan?: number;
|
|
1327
|
+
}>;
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
export declare function hitTestInstance(canvasPt: Point, instances: readonly PageInstance[], domBoxLookup?: (instanceId: string) => Rect | null): string | null;
|
|
1331
|
+
|
|
1332
|
+
export declare const HyperCardCanvasDesigner: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
1333
|
+
|
|
1334
|
+
export declare const HyperCardPageRenderer: DefineComponent<__VLS_Props, {
|
|
1335
|
+
binding: ShallowRef<WirePageBindingsHandle | null, WirePageBindingsHandle | null>;
|
|
1336
|
+
data: {
|
|
1337
|
+
invalidateDataSource(sourceId?: string): void;
|
|
1338
|
+
getDataSourceSnapshot(): DataSourceSnapshot;
|
|
1339
|
+
} | null;
|
|
1340
|
+
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
1341
|
+
rootEl: HTMLDivElement;
|
|
1342
|
+
}, any>;
|
|
1343
|
+
|
|
1344
|
+
export declare interface InstanceDataInputMissingIssue extends BindingIssueBase {
|
|
1345
|
+
code: 'required-data-input-missing';
|
|
1346
|
+
instanceId: string;
|
|
1347
|
+
key: string;
|
|
1348
|
+
canvasId?: string;
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
export declare interface InstanceSizeAxis {
|
|
1352
|
+
mode: InstanceSizeMode;
|
|
1353
|
+
value?: number;
|
|
1354
|
+
min?: number;
|
|
1355
|
+
max?: number;
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
export declare type InstanceSizeMode = 'px' | 'percent' | 'fill' | 'hug' | 'auto';
|
|
1359
|
+
|
|
1360
|
+
export declare const InteractionLayer: __VLS_WithTemplateSlots_3<typeof __VLS_component_3, __VLS_TemplateResult_3["slots"]>;
|
|
1361
|
+
|
|
1362
|
+
export declare type InteractionOptions = CanvasBehaviorConfig;
|
|
1363
|
+
|
|
1364
|
+
export declare function isAdditive(keys: ModifierKeys): boolean;
|
|
1365
|
+
|
|
1366
|
+
export declare function isCanvasRootPlacement(placement: PageInstance['placement'] | undefined): boolean;
|
|
1367
|
+
|
|
1368
|
+
export declare function isContainerChildPlacement(placement: PageInstance['placement'] | undefined): boolean;
|
|
1369
|
+
|
|
1370
|
+
export declare function isDraftKey(key: ComponentVersionKey): boolean;
|
|
1371
|
+
|
|
1372
|
+
export declare function isEditingText(target: EventTarget | null): boolean;
|
|
1373
|
+
|
|
1374
|
+
export declare function isFreePositionLayoutMode(mode: ContainerLayoutConfig['mode'] | undefined): boolean;
|
|
1375
|
+
|
|
1376
|
+
export declare function isInstanceEffectivelyLocked(inst: LockedSubset): boolean;
|
|
1377
|
+
|
|
1378
|
+
export declare function isInstancePositionLocked(inst: LockedSubset): boolean;
|
|
1379
|
+
|
|
1380
|
+
export declare function isInstanceSizeLocked(inst: LockedSubset): boolean;
|
|
1381
|
+
|
|
1382
|
+
export declare function isV1Layout(layout: PageLayout | CanvasLayoutConfig | undefined): layout is CanvasLayoutConfig;
|
|
1383
|
+
|
|
1384
|
+
export declare interface LayoutBox {
|
|
1385
|
+
x: number;
|
|
1386
|
+
y: number;
|
|
1387
|
+
width: number;
|
|
1388
|
+
height: number;
|
|
1389
|
+
widthMode: LayoutBoxAxisMode;
|
|
1390
|
+
heightMode: LayoutBoxAxisMode;
|
|
1391
|
+
overflow?: 'hidden' | 'visible' | 'auto';
|
|
1392
|
+
}
|
|
1393
|
+
|
|
1394
|
+
export declare type LayoutBoxAxisMode = 'px' | 'percent' | 'fill' | 'auto';
|
|
1395
|
+
|
|
1396
|
+
export declare interface LayoutIssue {
|
|
1397
|
+
kind: LayoutIssueKind;
|
|
1398
|
+
instanceId: string;
|
|
1399
|
+
detail: string;
|
|
1400
|
+
}
|
|
1401
|
+
|
|
1402
|
+
export declare type LayoutIssueKind = 'cycle' | 'missing-parent' | 'cross-page-parent' | 'orphan-slot' | 'invalid-slot' | 'parent-not-layout' | 'slot-not-allowed-component' | 'slot-multiple-violated' | 'absolute-child-rejected' | 'depth-exceeded';
|
|
1403
|
+
|
|
1404
|
+
export declare interface LayoutItem {
|
|
1405
|
+
order?: number;
|
|
1406
|
+
grow?: number;
|
|
1407
|
+
shrink?: number;
|
|
1408
|
+
row?: number;
|
|
1409
|
+
column?: number;
|
|
1410
|
+
rowSpan?: number;
|
|
1411
|
+
columnSpan?: number;
|
|
1412
|
+
ratio?: number;
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
export declare function layoutItemToCss(item: LayoutItem | undefined, parentMode: ContainerLayoutConfig['mode'] | undefined): Record<string, string | number> | null;
|
|
1416
|
+
|
|
1417
|
+
export declare interface LegacyPageBinding {
|
|
1418
|
+
id: string;
|
|
1419
|
+
type: 'event' | 'init';
|
|
1420
|
+
disabled?: boolean;
|
|
1421
|
+
source?: {
|
|
1422
|
+
instanceId: string;
|
|
1423
|
+
event: string;
|
|
1424
|
+
};
|
|
1425
|
+
target: {
|
|
1426
|
+
instanceId: string;
|
|
1427
|
+
method: string;
|
|
1428
|
+
args?: unknown[];
|
|
1429
|
+
};
|
|
1430
|
+
options?: {
|
|
1431
|
+
once?: boolean;
|
|
1432
|
+
throttleMs?: number;
|
|
1433
|
+
debounceMs?: number;
|
|
1434
|
+
};
|
|
1435
|
+
}
|
|
1436
|
+
|
|
1437
|
+
declare type Listener = (ids: readonly string[]) => void;
|
|
1438
|
+
|
|
1439
|
+
export declare function listRegisteredCanvasIds(): readonly string[];
|
|
1440
|
+
|
|
1441
|
+
declare type LockedSubset = {
|
|
1442
|
+
locked?: boolean;
|
|
1443
|
+
lockPosition?: boolean;
|
|
1444
|
+
lockSize?: boolean;
|
|
1445
|
+
};
|
|
1446
|
+
|
|
1447
|
+
export declare interface MarqueeState {
|
|
1448
|
+
active: boolean;
|
|
1449
|
+
start: Point | null;
|
|
1450
|
+
end: Point | null;
|
|
1451
|
+
additive: boolean;
|
|
1452
|
+
priorSelection: string[];
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
export declare function matchBinding(binding: CanvasShortcutBinding, ev: KeyboardEvent): boolean;
|
|
1456
|
+
|
|
1457
|
+
export declare const MAX_INSTANCE_TREE_DEPTH = 8;
|
|
1458
|
+
|
|
1459
|
+
declare interface MeasuredStageSize {
|
|
1460
|
+
w: number;
|
|
1461
|
+
h: number;
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1464
|
+
export declare interface MethodDecl {
|
|
1465
|
+
key: string;
|
|
1466
|
+
params?: string[];
|
|
1467
|
+
label?: string;
|
|
1468
|
+
description?: string;
|
|
1469
|
+
argsHint?: string;
|
|
1470
|
+
}
|
|
1471
|
+
|
|
1472
|
+
export declare function migrateInstanceToLayoutBox(inst: PageInstance): PageInstance;
|
|
1473
|
+
|
|
1474
|
+
export declare function migrateLayoutV0ToV1(raw: PageLayout | CanvasLayoutConfig | undefined): CanvasLayoutConfig;
|
|
1475
|
+
|
|
1476
|
+
export declare function migratePlacementToCanvasContainer(inst: PageInstance): PageInstance;
|
|
1477
|
+
|
|
1478
|
+
export declare function migrateRootLayout(layout: CanvasLayoutConfig): CanvasLayoutConfig;
|
|
1479
|
+
|
|
1480
|
+
export declare const MIN_INSTANCE_SIZE = 8;
|
|
1481
|
+
|
|
1482
|
+
export declare const MIN_RATIO_FRACTION = 0.05;
|
|
1483
|
+
|
|
1484
|
+
export declare interface ModelDecl {
|
|
1485
|
+
key: string;
|
|
1486
|
+
prop?: string;
|
|
1487
|
+
event?: string;
|
|
1488
|
+
type?: DeclValueType;
|
|
1489
|
+
defaultValue?: unknown;
|
|
1490
|
+
label?: string;
|
|
1491
|
+
description?: string;
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1494
|
+
export declare interface ModifierKeys {
|
|
1495
|
+
shift: boolean;
|
|
1496
|
+
ctrl: boolean;
|
|
1497
|
+
meta: boolean;
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
export declare type MountState = 'idle' | 'pending' | 'mounting' | 'mounted' | 'disposing';
|
|
1501
|
+
|
|
1502
|
+
export declare function normalizeComponentOverrides(raw: PageDocument['componentOverrides'], instances: readonly PageInstance[]): Record<string, PageComponentOverride>;
|
|
1503
|
+
|
|
1504
|
+
export declare type NormalizedPageBinding = (PageBindingBase & {
|
|
1505
|
+
type: 'event';
|
|
1506
|
+
}) | (PageBindingBase & {
|
|
1507
|
+
type: 'init';
|
|
1508
|
+
}) | (PageBindingBase & {
|
|
1509
|
+
type: 'data';
|
|
1510
|
+
});
|
|
1511
|
+
|
|
1512
|
+
export declare function normalizeInstanceSlotFields(inst: PageInstance): PageInstance;
|
|
1513
|
+
|
|
1514
|
+
export declare function normalizeKeyString(s: string): string;
|
|
1515
|
+
|
|
1516
|
+
export declare function normalizeMarqueeRect(a: Point, b: Point): Rect;
|
|
1517
|
+
|
|
1518
|
+
export declare function normalizePageBindings(raw: PageBindingInput[] | undefined | null): NormalizedPageBinding[];
|
|
1519
|
+
|
|
1520
|
+
export declare function normalizePageDocument(raw: PageDocumentInput): PageDocument;
|
|
1521
|
+
|
|
1522
|
+
export declare type PageBinding = PageBindingInput;
|
|
1523
|
+
|
|
1524
|
+
export declare interface PageBindingBase {
|
|
1525
|
+
id: string;
|
|
1526
|
+
label?: string;
|
|
1527
|
+
disabled?: boolean;
|
|
1528
|
+
source: BindingSource;
|
|
1529
|
+
target: BindingTarget;
|
|
1530
|
+
mapping?: BindingMapping;
|
|
1531
|
+
schedule?: BindingSchedule;
|
|
1532
|
+
errorPolicy?: BindingErrorPolicy;
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1535
|
+
export declare type PageBindingInput = LegacyPageBinding | NormalizedPageBinding;
|
|
1536
|
+
|
|
1537
|
+
export declare type PageBindingPatch = Partial<NormalizedPageBinding>;
|
|
1538
|
+
|
|
1539
|
+
export declare interface PageComponentOverride {
|
|
1540
|
+
instanceId: string;
|
|
1541
|
+
baseVersionKey: ComponentVersionKey;
|
|
1542
|
+
source: Source;
|
|
1543
|
+
contract: ComponentContract;
|
|
1544
|
+
contractParseError?: {
|
|
1545
|
+
message: string;
|
|
1546
|
+
line?: number;
|
|
1547
|
+
column?: number;
|
|
1548
|
+
};
|
|
1549
|
+
createdAt?: string;
|
|
1550
|
+
updatedAt?: string;
|
|
1551
|
+
}
|
|
1552
|
+
|
|
1553
|
+
export declare interface PageDocument {
|
|
1554
|
+
schemaVersion?: '1';
|
|
1555
|
+
layout: PageLayout | CanvasLayoutConfig;
|
|
1556
|
+
instances: PageInstance[];
|
|
1557
|
+
bindings: NormalizedPageBinding[];
|
|
1558
|
+
componentOverrides?: Record<string, PageComponentOverride>;
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1561
|
+
export declare interface PageDocumentInput {
|
|
1562
|
+
schemaVersion?: '1';
|
|
1563
|
+
layout: PageLayout | CanvasLayoutConfig;
|
|
1564
|
+
instances: PageInstance[];
|
|
1565
|
+
bindings: PageBindingInput[];
|
|
1566
|
+
componentOverrides?: Record<string, PageComponentOverride>;
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1569
|
+
export declare interface PageInstance {
|
|
1570
|
+
instanceId: string;
|
|
1571
|
+
componentId: string;
|
|
1572
|
+
componentVersionKey: ComponentVersionKey;
|
|
1573
|
+
alias?: string;
|
|
1574
|
+
rect: {
|
|
1575
|
+
x: number;
|
|
1576
|
+
y: number;
|
|
1577
|
+
w: number;
|
|
1578
|
+
h: number;
|
|
1579
|
+
};
|
|
1580
|
+
zIndex: number;
|
|
1581
|
+
rotation?: number;
|
|
1582
|
+
locked?: boolean;
|
|
1583
|
+
lockPosition?: boolean;
|
|
1584
|
+
lockSize?: boolean;
|
|
1585
|
+
hidden?: boolean;
|
|
1586
|
+
props: Record<string, unknown>;
|
|
1587
|
+
layoutBox?: LayoutBox;
|
|
1588
|
+
layoutItem?: LayoutItem;
|
|
1589
|
+
slotPlacement?: {
|
|
1590
|
+
parentInstanceId: string;
|
|
1591
|
+
slotName: string;
|
|
1592
|
+
order?: number;
|
|
1593
|
+
};
|
|
1594
|
+
parentId?: string;
|
|
1595
|
+
slot?: string;
|
|
1596
|
+
placement?: 'canvas' | 'container' | 'absolute' | 'slot';
|
|
1597
|
+
sizing?: {
|
|
1598
|
+
width?: {
|
|
1599
|
+
mode: 'fixed' | 'fill' | 'hug' | 'percent';
|
|
1600
|
+
value?: number;
|
|
1601
|
+
};
|
|
1602
|
+
height?: {
|
|
1603
|
+
mode: 'fixed' | 'fill' | 'hug' | 'percent';
|
|
1604
|
+
value?: number;
|
|
1605
|
+
};
|
|
1606
|
+
min?: {
|
|
1607
|
+
w?: number;
|
|
1608
|
+
h?: number;
|
|
1609
|
+
};
|
|
1610
|
+
max?: {
|
|
1611
|
+
w?: number;
|
|
1612
|
+
h?: number;
|
|
1613
|
+
};
|
|
1614
|
+
};
|
|
1615
|
+
size?: PageInstanceSize;
|
|
1616
|
+
containerLayout?: ContainerLayoutConfig;
|
|
1617
|
+
position?: 'normal' | 'sticky' | 'pinned';
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
export declare interface PageInstanceSize {
|
|
1621
|
+
width?: InstanceSizeAxis;
|
|
1622
|
+
height?: InstanceSizeAxis;
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1625
|
+
export declare interface PageInstanceTreeNode {
|
|
1626
|
+
instanceId: string;
|
|
1627
|
+
componentId: string;
|
|
1628
|
+
componentVersionKey: string;
|
|
1629
|
+
label?: string;
|
|
1630
|
+
kind: 'visual' | 'layout' | 'data' | string;
|
|
1631
|
+
locked?: boolean;
|
|
1632
|
+
lockPosition?: boolean;
|
|
1633
|
+
lockSize?: boolean;
|
|
1634
|
+
hidden?: boolean;
|
|
1635
|
+
children?: PageInstanceTreeNode[];
|
|
1636
|
+
}
|
|
1637
|
+
|
|
1638
|
+
export declare interface PageLayout {
|
|
1639
|
+
type: 'free';
|
|
1640
|
+
canvas: {
|
|
1641
|
+
w: number;
|
|
1642
|
+
h: number;
|
|
1643
|
+
gridSize?: number;
|
|
1644
|
+
background?: {
|
|
1645
|
+
color?: string;
|
|
1646
|
+
imageAssetId?: string;
|
|
1647
|
+
fit?: 'cover' | 'contain' | 'original';
|
|
1648
|
+
};
|
|
1649
|
+
};
|
|
1650
|
+
}
|
|
1651
|
+
|
|
1652
|
+
export declare interface PageRenderPayload {
|
|
1653
|
+
page: {
|
|
1654
|
+
id: string;
|
|
1655
|
+
name: string;
|
|
1656
|
+
targets: Array<'pc' | 'mobile' | 'screen'>;
|
|
1657
|
+
};
|
|
1658
|
+
version: {
|
|
1659
|
+
version: string;
|
|
1660
|
+
label: string;
|
|
1661
|
+
publishedAt: string;
|
|
1662
|
+
} | null;
|
|
1663
|
+
document: PageDocument;
|
|
1664
|
+
componentVersions: Record<ComponentVersionKey, ComponentVersionAsset | DraftComponentVersionAsset>;
|
|
1665
|
+
}
|
|
1666
|
+
|
|
1667
|
+
export declare function parseComponentVersionKey(key: ComponentVersionKey): ParsedComponentVersionKey | null;
|
|
1668
|
+
|
|
1669
|
+
export declare type ParsedComponentVersionKey = {
|
|
1670
|
+
kind: 'published';
|
|
1671
|
+
componentId: string;
|
|
1672
|
+
version: string;
|
|
1673
|
+
} | {
|
|
1674
|
+
kind: 'draft';
|
|
1675
|
+
componentId: string;
|
|
1676
|
+
pageId: string;
|
|
1677
|
+
baseVersion: string;
|
|
1678
|
+
baseVersionKey: string;
|
|
1679
|
+
};
|
|
1680
|
+
|
|
1681
|
+
export declare function parseKeyEvent(ev: KeyboardEvent): string;
|
|
1682
|
+
|
|
1683
|
+
export declare interface Point {
|
|
1684
|
+
x: number;
|
|
1685
|
+
y: number;
|
|
1686
|
+
}
|
|
1687
|
+
|
|
1688
|
+
export declare interface PropDecl {
|
|
1689
|
+
key: string;
|
|
1690
|
+
type?: DeclValueType;
|
|
1691
|
+
value?: unknown;
|
|
1692
|
+
label?: string;
|
|
1693
|
+
enum?: unknown[];
|
|
1694
|
+
description?: string;
|
|
1695
|
+
required?: boolean;
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
export declare function provideCanvasContext(ctx: CanvasContext): void;
|
|
1699
|
+
|
|
1700
|
+
export declare interface Rect {
|
|
1701
|
+
x: number;
|
|
1702
|
+
y: number;
|
|
1703
|
+
w: number;
|
|
1704
|
+
h: number;
|
|
1705
|
+
}
|
|
1706
|
+
|
|
1707
|
+
declare interface Rect_2 {
|
|
1708
|
+
x: number;
|
|
1709
|
+
y: number;
|
|
1710
|
+
w: number;
|
|
1711
|
+
h: number;
|
|
1712
|
+
}
|
|
1713
|
+
|
|
1714
|
+
export declare function registerDesignerHandle(canvasId: string, handle: CanvasHandle): void;
|
|
1715
|
+
|
|
1716
|
+
export declare function renderLayoutBoxStyle(layoutBox: LayoutBox, zIndex: number, rotation: number | undefined, parentLayoutMode: ContainerLayoutConfig['mode'] | undefined): Record<string, string | number>;
|
|
1717
|
+
|
|
1718
|
+
export declare interface RenderScheduler {
|
|
1719
|
+
register(instanceId: string, el: Element): void;
|
|
1720
|
+
unregister(instanceId: string): void;
|
|
1721
|
+
isMounted(instanceId: string): boolean;
|
|
1722
|
+
getState(instanceId: string): MountState;
|
|
1723
|
+
readonly state: Readonly<Record<string, MountState>>;
|
|
1724
|
+
dispose(): void;
|
|
1725
|
+
}
|
|
1726
|
+
|
|
1727
|
+
export declare interface RenderSchedulerOptions {
|
|
1728
|
+
rootMargin?: string;
|
|
1729
|
+
disposeDelayMs?: number;
|
|
1730
|
+
mountConcurrency?: number;
|
|
1731
|
+
root?: Element | null;
|
|
1732
|
+
}
|
|
1733
|
+
|
|
1734
|
+
export declare interface ReparentBridge {
|
|
1735
|
+
getDropTarget(clientPoint: Point, options?: {
|
|
1736
|
+
excludeInstanceId?: string;
|
|
1737
|
+
}): DropTarget | null;
|
|
1738
|
+
canReparent(instanceId: string, target: TreeMoveTarget): CanReparentResult;
|
|
1739
|
+
moveInstanceInTree(instanceId: string, target: TreeMoveTarget): void;
|
|
1740
|
+
cannotReparentEvent: Readonly<Ref<CannotReparentEvent | null>>;
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1743
|
+
export declare type ReparentContractResolver = (versionKey: ComponentVersionKey) => ComponentContract | undefined;
|
|
1744
|
+
|
|
1745
|
+
export declare type ResizeHandle = 'nw' | 'n' | 'ne' | 'w' | 'e' | 'sw' | 's' | 'se';
|
|
1746
|
+
|
|
1747
|
+
export declare interface ResizeState {
|
|
1748
|
+
status: 'idle' | 'active';
|
|
1749
|
+
handle: ResizeHandle | null;
|
|
1750
|
+
startPt: Point | null;
|
|
1751
|
+
startRect: Rect | null;
|
|
1752
|
+
instanceId: string | null;
|
|
1753
|
+
placement: 'absolute' | 'canvas' | 'slot' | 'container' | null;
|
|
1754
|
+
parentLayoutMode: ContainerLayoutConfig['mode'] | undefined;
|
|
1755
|
+
startSize: PageInstanceSize | null;
|
|
1756
|
+
startLayoutBox: LayoutBox | null;
|
|
1757
|
+
startOutletCanvasSize: {
|
|
1758
|
+
w: number;
|
|
1759
|
+
h: number;
|
|
1760
|
+
} | null;
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1763
|
+
export declare function resolveCanvasSizePx(size: CanvasSizeValue, fallback?: number): number;
|
|
1764
|
+
|
|
1765
|
+
export declare function resolveMeasuredCanvasSizePx(size: CanvasSizeValue, axisSize: number, fallback?: number): number;
|
|
1766
|
+
|
|
1767
|
+
export declare const RuntimeLayer: DefineComponent<__VLS_Props_3, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_3> & Readonly<{}>, {
|
|
1768
|
+
mode: CanvasMode;
|
|
1769
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
1770
|
+
|
|
1771
|
+
export declare interface SelectionStore {
|
|
1772
|
+
readonly selectedIds: ComputedRef<string[]>;
|
|
1773
|
+
readonly size: ComputedRef<number>;
|
|
1774
|
+
readonly primaryId: ComputedRef<string | undefined>;
|
|
1775
|
+
select(instanceId: string): void;
|
|
1776
|
+
toggleSelect(instanceId: string): void;
|
|
1777
|
+
addToSelection(instanceId: string): void;
|
|
1778
|
+
removeFromSelection(instanceId: string): void;
|
|
1779
|
+
clearSelection(): void;
|
|
1780
|
+
selectAll(instanceIds: string[]): void;
|
|
1781
|
+
purgeOrphans(validIds: string[]): void;
|
|
1782
|
+
isSelected(instanceId: string): boolean;
|
|
1783
|
+
}
|
|
1784
|
+
|
|
1785
|
+
export declare const SLOT_CHILD_RESIZE_HANDLES: readonly ["e", "s", "se"];
|
|
1786
|
+
|
|
1787
|
+
export declare interface SlotDecl {
|
|
1788
|
+
name: string;
|
|
1789
|
+
label?: string;
|
|
1790
|
+
accepts?: string[];
|
|
1791
|
+
multiple?: boolean;
|
|
1792
|
+
maxChildren?: number;
|
|
1793
|
+
description?: string;
|
|
1794
|
+
}
|
|
1795
|
+
|
|
1796
|
+
export declare type SnapAxis = 'x' | 'y';
|
|
1797
|
+
|
|
1798
|
+
export declare interface SnapInput {
|
|
1799
|
+
draggedRects: readonly Rect[];
|
|
1800
|
+
otherRects: readonly Rect[];
|
|
1801
|
+
canvasSize: {
|
|
1802
|
+
w: number;
|
|
1803
|
+
h: number;
|
|
1804
|
+
};
|
|
1805
|
+
threshold?: number;
|
|
1806
|
+
manualGuides?: {
|
|
1807
|
+
x?: readonly number[];
|
|
1808
|
+
y?: readonly number[];
|
|
1809
|
+
};
|
|
1810
|
+
}
|
|
1811
|
+
|
|
1812
|
+
export declare type SnapKind = 'edge-left' | 'edge-right' | 'edge-top' | 'edge-bottom' | 'center-x' | 'center-y' | 'canvas-edge' | 'guide';
|
|
1813
|
+
|
|
1814
|
+
export declare interface SnapLine {
|
|
1815
|
+
axis: SnapAxis;
|
|
1816
|
+
pos: number;
|
|
1817
|
+
from: number;
|
|
1818
|
+
to: number;
|
|
1819
|
+
kind: SnapKind;
|
|
1820
|
+
}
|
|
1821
|
+
|
|
1822
|
+
export declare interface SnapResult {
|
|
1823
|
+
dx: number;
|
|
1824
|
+
dy: number;
|
|
1825
|
+
lines: SnapLine[];
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1828
|
+
export declare interface Source {
|
|
1829
|
+
html: string;
|
|
1830
|
+
js: string;
|
|
1831
|
+
css: string;
|
|
1832
|
+
}
|
|
1833
|
+
|
|
1834
|
+
export declare interface SplitContainerLayout {
|
|
1835
|
+
mode: 'split';
|
|
1836
|
+
direction: 'horizontal' | 'vertical';
|
|
1837
|
+
ratios: number[];
|
|
1838
|
+
gap?: number;
|
|
1839
|
+
}
|
|
1840
|
+
|
|
1841
|
+
export declare interface SplitDivider {
|
|
1842
|
+
index: number;
|
|
1843
|
+
rect: Rect;
|
|
1844
|
+
direction: 'horizontal' | 'vertical';
|
|
1845
|
+
}
|
|
1846
|
+
|
|
1847
|
+
export declare interface SplitDividerDragState {
|
|
1848
|
+
status: 'idle' | 'active';
|
|
1849
|
+
parentId: string | null;
|
|
1850
|
+
dividerIndex: number | null;
|
|
1851
|
+
startRatios: number[] | null;
|
|
1852
|
+
parentAxisPx: number;
|
|
1853
|
+
startPt: Point | null;
|
|
1854
|
+
direction: 'horizontal' | 'vertical' | null;
|
|
1855
|
+
gap: number;
|
|
1856
|
+
}
|
|
1857
|
+
|
|
1858
|
+
export declare interface SplitDividerInteraction {
|
|
1859
|
+
drag: Readonly<SplitDividerDragState>;
|
|
1860
|
+
isDragging: Readonly<Ref<boolean>>;
|
|
1861
|
+
handleSplitDividerStart(args: {
|
|
1862
|
+
parentId: string;
|
|
1863
|
+
dividerIndex: number;
|
|
1864
|
+
startRatios: number[];
|
|
1865
|
+
parentAxisPx: number;
|
|
1866
|
+
direction: 'horizontal' | 'vertical';
|
|
1867
|
+
gap: number;
|
|
1868
|
+
canvasPt: Point;
|
|
1869
|
+
}): {
|
|
1870
|
+
startTracking: boolean;
|
|
1871
|
+
};
|
|
1872
|
+
handleSplitDividerMove(canvasPt: Point): void;
|
|
1873
|
+
handleSplitDividerEnd(): void;
|
|
1874
|
+
cancelSplitDividerDrag(): void;
|
|
1875
|
+
}
|
|
1876
|
+
|
|
1877
|
+
export declare interface StaleComponentOverride {
|
|
1878
|
+
instanceId: string;
|
|
1879
|
+
baseVersionKey: ComponentVersionKey;
|
|
1880
|
+
currentVersionKey: ComponentVersionKey;
|
|
1881
|
+
}
|
|
1882
|
+
|
|
1883
|
+
export declare interface StoreTraceEvent {
|
|
1884
|
+
kind: StoreTraceKind;
|
|
1885
|
+
cacheKey: string;
|
|
1886
|
+
sourceId: string;
|
|
1887
|
+
writeSeq?: number;
|
|
1888
|
+
reason?: string;
|
|
1889
|
+
value?: unknown;
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1892
|
+
export declare type StoreTraceKind = 'data-source-update' | 'data-query-skipped';
|
|
1893
|
+
|
|
1894
|
+
export declare function subscribeDesignerRegistry(fn: Listener): () => void;
|
|
1895
|
+
|
|
1896
|
+
export declare interface TraceCollectorOptions {
|
|
1897
|
+
capacity?: number;
|
|
1898
|
+
filterKinds?: BindingTraceKind[];
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1901
|
+
export declare interface TreeMoveTarget {
|
|
1902
|
+
parentId: string | null;
|
|
1903
|
+
slot?: string;
|
|
1904
|
+
index?: number;
|
|
1905
|
+
}
|
|
1906
|
+
|
|
1907
|
+
export declare function unionRects(rects: readonly Rect_2[]): Rect_2 | null;
|
|
1908
|
+
|
|
1909
|
+
export declare function unregisterDesignerHandle(canvasId: string): void;
|
|
1910
|
+
|
|
1911
|
+
export declare function useCanvasContext(): CanvasContext;
|
|
1912
|
+
|
|
1913
|
+
export declare function validateBindings(doc: PageDocument, options?: ValidateBindingsOptions): BindingIssue[];
|
|
1914
|
+
|
|
1915
|
+
export declare interface ValidateBindingsOptions {
|
|
1916
|
+
resolveContract?: ContractResolver;
|
|
1917
|
+
currentCanvasId?: string;
|
|
1918
|
+
}
|
|
1919
|
+
|
|
1920
|
+
export declare function validateInstanceTree(doc: PageDocument, options: ValidateOptions): LayoutIssue[];
|
|
1921
|
+
|
|
1922
|
+
export declare interface ValidateOptions {
|
|
1923
|
+
resolveContract: ContractResolver;
|
|
1924
|
+
maxDepth?: number;
|
|
1925
|
+
}
|
|
1926
|
+
|
|
1927
|
+
export declare const VERSION = "0.0.0-d3.6c-stage";
|
|
1928
|
+
|
|
1929
|
+
export declare interface ViewportState {
|
|
1930
|
+
scale: number;
|
|
1931
|
+
panX: number;
|
|
1932
|
+
panY: number;
|
|
1933
|
+
}
|
|
1934
|
+
|
|
1935
|
+
export declare interface ViewportStore {
|
|
1936
|
+
readonly state: Readonly<ViewportState>;
|
|
1937
|
+
readonly scale: ComputedRef<number>;
|
|
1938
|
+
readonly panX: ComputedRef<number>;
|
|
1939
|
+
readonly panY: ComputedRef<number>;
|
|
1940
|
+
setScale(scale: number): void;
|
|
1941
|
+
zoomAt(viewportPoint: Point, deltaScale: number): void;
|
|
1942
|
+
setPan(panX: number, panY: number): void;
|
|
1943
|
+
panBy(dx: number, dy: number): void;
|
|
1944
|
+
resetView(): void;
|
|
1945
|
+
fitToScreen(canvasSize: {
|
|
1946
|
+
w: number;
|
|
1947
|
+
h: number;
|
|
1948
|
+
}, containerSize: {
|
|
1949
|
+
w: number;
|
|
1950
|
+
h: number;
|
|
1951
|
+
}, padding?: number): void;
|
|
1952
|
+
toCanvasPoint(viewportPoint: Point): Point;
|
|
1953
|
+
toViewportPoint(canvasPoint: Point): Point;
|
|
1954
|
+
}
|
|
1955
|
+
|
|
1956
|
+
export declare interface ViewportStoreOptions {
|
|
1957
|
+
minScale?: number;
|
|
1958
|
+
maxScale?: number;
|
|
1959
|
+
initialScale?: number;
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
export declare function wirePageBindings(options: WirePageBindingsOptions): WirePageBindingsHandle;
|
|
1963
|
+
|
|
1964
|
+
export declare interface WirePageBindingsHandle {
|
|
1965
|
+
setMode(mode: CanvasBindingMode): void;
|
|
1966
|
+
getMode(): CanvasBindingMode;
|
|
1967
|
+
testBinding(bindingId: string, mockPayload?: unknown): BindingTestTrace[];
|
|
1968
|
+
on<E extends 'binding:fire' | 'binding:error' | 'binding:trace'>(event: E, cb: BindingEventCb<E>): () => void;
|
|
1969
|
+
startTracing(opts?: TraceCollectorOptions): void;
|
|
1970
|
+
stopTracing(): BindingTraceEvent[];
|
|
1971
|
+
getTraceBuffer(): readonly BindingTraceEvent[];
|
|
1972
|
+
dispose(): void;
|
|
1973
|
+
}
|
|
1974
|
+
|
|
1975
|
+
export declare interface WirePageBindingsOptions {
|
|
1976
|
+
canvasId: string;
|
|
1977
|
+
source: DocumentSource;
|
|
1978
|
+
initialMode?: CanvasBindingMode;
|
|
1979
|
+
dataStore?: DataSourceStore;
|
|
1980
|
+
}
|
|
1981
|
+
|
|
1982
|
+
export { }
|