@hy-bricks/canvas 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { ComponentInstanceHandle } from '@hy-bricks/core';
1
2
  import { ComponentOptionsMixin } from 'vue';
2
3
  import { ComponentProvideOptions } from 'vue';
3
4
  import { ComputedRef } from 'vue';
@@ -484,6 +485,7 @@ export declare type CanvasBindingMode = 'off' | 'data-preview' | 'runtime';
484
485
  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
 
486
487
  export declare interface CanvasContext {
488
+ readonly canvasId: string;
487
489
  document: DocumentStore;
488
490
  selection: SelectionStore;
489
491
  viewport: ViewportStore;
@@ -523,6 +525,7 @@ export declare interface CanvasContext {
523
525
  }
524
526
 
525
527
  export declare interface CanvasContextOptions {
528
+ canvasId?: string;
526
529
  initialDocument?: PageDocument;
527
530
  scheduler?: RenderSchedulerOptions;
528
531
  viewport?: ViewportStoreOptions;
@@ -777,11 +780,18 @@ export declare interface CanvasHandle {
777
780
  getBindingMode(): CanvasBindingMode;
778
781
  testBinding(bindingId: string, mockPayload?: unknown): BindingTestTrace[];
779
782
  on<E extends 'binding:fire' | 'binding:error' | 'binding:trace'>(event: E, cb: BindingEventCb<E>): () => void;
783
+ on<E extends 'instance:ready' | 'instance:unmounted'>(event: E, cb: (instanceId: string) => void): () => void;
784
+ getInstanceRuntime(instanceId: string): ComponentInstanceHandle | null;
785
+ getInstanceReady(instanceId: string): Promise<void>;
780
786
  startTracing(opts?: TraceCollectorOptions): void;
781
787
  stopTracing(): BindingTraceEvent[];
782
788
  getTraceBuffer(): readonly BindingTraceEvent[];
783
789
  invalidateDataSource(sourceId?: string): void;
784
790
  getDataSourceSnapshot(): DataSourceSnapshot;
791
+ getCachedBySourceId(sourceId: string, params?: Record<string, unknown>): {
792
+ value: unknown;
793
+ status: DataSourceStatus;
794
+ } | undefined;
785
795
  attachBindingDelegate(delegate: WirePageBindingsHandle | null, dataStore?: DataSourceStore | null): void;
786
796
  }
787
797
 
@@ -1142,6 +1152,10 @@ declare interface DataSourceStore {
1142
1152
  }): void;
1143
1153
  invalidate(sourceId?: string): void;
1144
1154
  getSnapshot(): DataSourceSnapshot;
1155
+ getCachedBySourceId(sourceId: string, params?: Record<string, unknown>): {
1156
+ value: unknown;
1157
+ status: DataSourceStatus;
1158
+ } | undefined;
1145
1159
  disposeAll(): void;
1146
1160
  readonly isDisposed: boolean;
1147
1161
  attachTraceBridge(cb: (ev: StoreTraceEvent) => void): () => void;
@@ -1345,6 +1359,10 @@ export declare interface GridContainerLayout {
1345
1359
  }>;
1346
1360
  }
1347
1361
 
1362
+ export declare class HandleDisposedError extends Error {
1363
+ constructor(message?: string);
1364
+ }
1365
+
1348
1366
  export declare function hitTestInstance(canvasPt: Point, instances: readonly PageInstance[], domBoxLookup?: (instanceId: string) => Rect | null): string | null;
1349
1367
 
1350
1368
  export declare const HyperCardCanvasDesigner: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
@@ -1354,6 +1372,10 @@ binding: ShallowRef<WirePageBindingsHandle | null, WirePageBindingsHandle | null
1354
1372
  data: {
1355
1373
  invalidateDataSource(sourceId?: string): void;
1356
1374
  getDataSourceSnapshot(): DataSourceSnapshot;
1375
+ getCachedBySourceId(sourceId: string, params?: Record<string, unknown>): {
1376
+ value: unknown;
1377
+ status: DataSourceStatus;
1378
+ } | undefined;
1357
1379
  } | null;
1358
1380
  }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
1359
1381
  rootEl: HTMLDivElement;
@@ -1363,6 +1385,10 @@ export declare interface HyperCardPageRendererExpose {
1363
1385
  data: {
1364
1386
  invalidateDataSource(sourceId?: string): void;
1365
1387
  getDataSourceSnapshot(): DataSourceSnapshot;
1388
+ getCachedBySourceId(sourceId: string, params?: Record<string, unknown>): {
1389
+ value: unknown;
1390
+ status: DataSourceStatus;
1391
+ } | undefined;
1366
1392
  } | null;
1367
1393
  binding: WirePageBindingsHandle | null;
1368
1394
  }