@sepveneto/dnde 0.8.8 → 0.8.10

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.
@@ -26,9 +26,10 @@ declare const editor: import("pinia").Store<"editor", Pick<{
26
26
  };
27
27
  config: {
28
28
  list: import("./store").ConfigPanel[];
29
+ ctx: import("./store").ConfigPluginContext;
29
30
  get defaultPane(): string;
30
- addPanel(panel: import("./store").ConfigPanel): void;
31
- validate(data: any): Promise<boolean>;
31
+ addPanel(options: import("./store").ConfigPanelOptions): import("./store").ConfigPanel;
32
+ validate(): Promise<boolean>;
32
33
  };
33
34
  };
34
35
  showTopbar: Vue.ComputedRef<boolean>;
@@ -62,9 +63,10 @@ declare const editor: import("pinia").Store<"editor", Pick<{
62
63
  };
63
64
  config: {
64
65
  list: import("./store").ConfigPanel[];
66
+ ctx: import("./store").ConfigPluginContext;
65
67
  get defaultPane(): string;
66
- addPanel(panel: import("./store").ConfigPanel): void;
67
- validate(data: any): Promise<boolean>;
68
+ addPanel(options: import("./store").ConfigPanelOptions): import("./store").ConfigPanel;
69
+ validate(): Promise<boolean>;
68
70
  };
69
71
  };
70
72
  showTopbar: Vue.ComputedRef<boolean>;
@@ -98,9 +100,10 @@ declare const editor: import("pinia").Store<"editor", Pick<{
98
100
  };
99
101
  config: {
100
102
  list: import("./store").ConfigPanel[];
103
+ ctx: import("./store").ConfigPluginContext;
101
104
  get defaultPane(): string;
102
- addPanel(panel: import("./store").ConfigPanel): void;
103
- validate(data: any): Promise<boolean>;
105
+ addPanel(options: import("./store").ConfigPanelOptions): import("./store").ConfigPanel;
106
+ validate(): Promise<boolean>;
104
107
  };
105
108
  };
106
109
  showTopbar: Vue.ComputedRef<boolean>;
package/dist/api.d.ts ADDED
@@ -0,0 +1,22 @@
1
+ /**
2
+ * `<mpd-editor>` 的指令式 API(`register` / `validate` / `getData` / `setData`)。
3
+ *
4
+ * 元素在模块加载时就已经注册好(见 main.ts),但真正的编辑器要等宿主调用 `register()`
5
+ * 拿到生产者地址、生产者 `setup` 加载完成之后才会挂载。也就是说「元素已经在页面上」和
6
+ * 「编辑器已经就绪」是两个时刻,宿主不应该被迫去对齐它们。
7
+ *
8
+ * 这里的做法:挂载前宿主如果已经调用了这些方法,先把调用排队(返回值是 Promise),
9
+ * 挂载完成时(Editor.vue 的 setup 里调用 `bindEditorApi`)再按顺序补上。
10
+ * 因此 `el.setData(data)` 这种写法在挂载前后都成立,宿主不需要 v-if / nextTick。
11
+ */
12
+ /** 编辑器对外暴露的方法名(与 Editor.vue 的 defineExpose 保持一致) */
13
+ export type EditorApiMethod = 'register' | 'validate' | 'getData' | 'setData';
14
+ /** 已挂载编辑器的真实实现,由 Editor.vue 提供 */
15
+ export type EditorApi = Record<EditorApiMethod, (...args: any[]) => any>;
16
+ /**
17
+ * 调用元素的指令式 API:编辑器已经挂载就直接执行,否则排队等挂载后补上。
18
+ * 此时返回的是 Promise(挂载后调用返回真实结果,`await` 在两种情况下都适用)。
19
+ */
20
+ export declare function invokeEditorApi(host: any, method: EditorApiMethod, args: any[]): any;
21
+ /** 编辑器挂载完成:交出真正的实现,并补齐挂载前的调用 */
22
+ export declare function bindEditorApi(host: any, api: EditorApi): void;
@@ -27,9 +27,10 @@ declare const _default: import("vue").DefineComponent<{}, {
27
27
  };
28
28
  config: {
29
29
  list: import("@/store").ConfigPanel[];
30
+ ctx: import("@/store").ConfigPluginContext;
30
31
  get defaultPane(): string;
31
- addPanel(panel: import("@/store").ConfigPanel): void;
32
- validate(data: any): Promise<boolean>;
32
+ addPanel(options: import("@/store").ConfigPanelOptions): import("@/store").ConfigPanel;
33
+ validate(): Promise<boolean>;
33
34
  };
34
35
  };
35
36
  showTopbar: import("vue").ComputedRef<boolean>;
@@ -63,9 +64,10 @@ declare const _default: import("vue").DefineComponent<{}, {
63
64
  };
64
65
  config: {
65
66
  list: import("@/store").ConfigPanel[];
67
+ ctx: import("@/store").ConfigPluginContext;
66
68
  get defaultPane(): string;
67
- addPanel(panel: import("@/store").ConfigPanel): void;
68
- validate(data: any): Promise<boolean>;
69
+ addPanel(options: import("@/store").ConfigPanelOptions): import("@/store").ConfigPanel;
70
+ validate(): Promise<boolean>;
69
71
  };
70
72
  };
71
73
  showTopbar: import("vue").ComputedRef<boolean>;
@@ -99,9 +101,10 @@ declare const _default: import("vue").DefineComponent<{}, {
99
101
  };
100
102
  config: {
101
103
  list: import("@/store").ConfigPanel[];
104
+ ctx: import("@/store").ConfigPluginContext;
102
105
  get defaultPane(): string;
103
- addPanel(panel: import("@/store").ConfigPanel): void;
104
- validate(data: any): Promise<boolean>;
106
+ addPanel(options: import("@/store").ConfigPanelOptions): import("@/store").ConfigPanel;
107
+ validate(): Promise<boolean>;
105
108
  };
106
109
  };
107
110
  showTopbar: import("vue").ComputedRef<boolean>;
@@ -1,6 +1,7 @@
1
1
  import type { Node } from '@sepveneto/dnde-core/class';
2
2
  type __VLS_Props = {
3
3
  node: Node;
4
+ preview?: boolean;
4
5
  };
5
6
  declare var __VLS_5: {};
6
7
  type __VLS_Slots = {} & {