@nesso-how/plugin 0.5.0 → 0.7.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/README.md +102 -58
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/node/data.d.ts +1 -0
- package/dist/node/data.js +39 -0
- package/dist/node/definitions.d.ts +69 -0
- package/dist/node/definitions.js +124 -0
- package/dist/node/errors.d.ts +12 -0
- package/dist/node/errors.js +60 -0
- package/dist/node/files.d.ts +25 -0
- package/dist/node/files.js +53 -0
- package/dist/node/i18n.d.ts +12 -0
- package/dist/node/i18n.js +11 -0
- package/dist/node/images.d.ts +11 -0
- package/dist/node/images.js +10 -0
- package/dist/node/index.d.ts +7 -0
- package/dist/node/index.js +2 -0
- package/dist/node/package.d.ts +34 -0
- package/dist/node/package.js +224 -0
- package/dist/node/runtime.d.ts +586 -0
- package/dist/node/runtime.js +511 -0
- package/dist/node/storage.d.ts +72 -0
- package/dist/node/storage.js +71 -0
- package/dist/node/theme-fonts.d.ts +2 -0
- package/dist/node/theme-fonts.js +11 -0
- package/dist/package.d.ts +1 -1
- package/dist/package.js +1 -1
- package/dist/{runtime-CJPU4o4h.js → runtime-D6GosMdU.js} +375 -252
- package/dist/{runtime-D4jO7tbm.d.ts → runtime-DGDBGkWs.d.ts} +228 -133
- package/dist/runtime.d.ts +2 -2
- package/dist/runtime.js +1 -1
- package/example/README.md +5 -2
- package/example/package.json +37 -19
- package/example/src/Quiz.css +50 -8
- package/example/src/Quiz.tsx +29 -8
- package/example/src/index.ts +7 -5
- package/package.json +4 -3
|
@@ -0,0 +1,586 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { type ImageRenderOptions, type RenderedImage } from './images.ts';
|
|
3
|
+
export type { ImageRenderOptions, RenderedImage } from './images.ts';
|
|
4
|
+
import type { ComponentType } from 'react';
|
|
5
|
+
import type { DeepReadonly, GraphSnapshot, NessoOperation, Selection, SavedView, VocabDefinition } from '@nesso-how/core';
|
|
6
|
+
import type { Locale } from '@nesso-how/i18n';
|
|
7
|
+
import { type Definition } from './definitions.ts';
|
|
8
|
+
import { type FileOpenOptions, type FileOpenResult, type FileSaveOptions } from './files.ts';
|
|
9
|
+
import { createWriteCommands } from '@nesso-how/core';
|
|
10
|
+
import { type LocalizedText } from './i18n.ts';
|
|
11
|
+
import { type PluginStorage, type PluginStorageRecord } from './storage.ts';
|
|
12
|
+
export { checkMessageSize } from './data.ts';
|
|
13
|
+
export { parsePluginStorageKey, parsePluginStorageRecord, parsePluginStorageSnapshot, pluginStorageLimits, } from './storage.ts';
|
|
14
|
+
export { resolvePluginText, type LocalizedText } from './i18n.ts';
|
|
15
|
+
export { fontFaces } from './theme-fonts.ts';
|
|
16
|
+
export { parseOrThrow, PluginError } from './errors.ts';
|
|
17
|
+
export { parseDefinition, themeColors, type Definition } from './definitions.ts';
|
|
18
|
+
export { parseFileOptions, fileTextLimit, type FileOpenOptions, type FileSaveOptions, type FileOpenResult, } from './files.ts';
|
|
19
|
+
export declare const runtimeLimits: {
|
|
20
|
+
readonly request: number;
|
|
21
|
+
readonly snapshot: number;
|
|
22
|
+
readonly pending: 64;
|
|
23
|
+
readonly deadline: 30000;
|
|
24
|
+
readonly interaction: 300000;
|
|
25
|
+
readonly initialization: 10000;
|
|
26
|
+
readonly action: 120000;
|
|
27
|
+
readonly heartbeat: 15000;
|
|
28
|
+
};
|
|
29
|
+
export declare const badgeLimits: {
|
|
30
|
+
readonly value: 999999;
|
|
31
|
+
readonly execution: 2000;
|
|
32
|
+
readonly refresh: 15000;
|
|
33
|
+
readonly rate: 1000;
|
|
34
|
+
};
|
|
35
|
+
declare const actionBadgeResult: z.ZodObject<{
|
|
36
|
+
value: z.ZodNullable<z.ZodNumber>;
|
|
37
|
+
refreshAt: z.ZodOptional<z.ZodNumber>;
|
|
38
|
+
}, z.core.$strict>;
|
|
39
|
+
export type ActionBadgeInput = {
|
|
40
|
+
readonly viewId: string | null;
|
|
41
|
+
readonly viewGraph: GraphSnapshot;
|
|
42
|
+
readonly records: readonly PluginStorageRecord[];
|
|
43
|
+
readonly now: number;
|
|
44
|
+
};
|
|
45
|
+
export type ActionBadgeResult = DeepReadonly<z.infer<typeof actionBadgeResult>>;
|
|
46
|
+
export declare const parseActionBadgeResult: (value: unknown) => ActionBadgeResult;
|
|
47
|
+
export declare const themeTokens: readonly ["background", "foreground", "canvas", "sidebar", "primary", "primary-hover", "primary-foreground", "muted", "muted-foreground", "hover", "pressed", "border", "ring", "selection-halo", "node-border", "edge", "handle", "font-sans", "font-mono", "radius-control", "radius-object", "duration-state"];
|
|
48
|
+
declare const metadata: z.ZodObject<{
|
|
49
|
+
name: z.ZodObject<{
|
|
50
|
+
en: z.ZodString;
|
|
51
|
+
it: z.ZodOptional<z.ZodString>;
|
|
52
|
+
'zh-CN': z.ZodOptional<z.ZodString>;
|
|
53
|
+
}, z.core.$strict>;
|
|
54
|
+
description: z.ZodObject<{
|
|
55
|
+
en: z.ZodString;
|
|
56
|
+
it: z.ZodOptional<z.ZodString>;
|
|
57
|
+
'zh-CN': z.ZodOptional<z.ZodString>;
|
|
58
|
+
}, z.core.$strict>;
|
|
59
|
+
documentation: z.ZodObject<{
|
|
60
|
+
en: z.ZodString;
|
|
61
|
+
it: z.ZodOptional<z.ZodString>;
|
|
62
|
+
'zh-CN': z.ZodOptional<z.ZodString>;
|
|
63
|
+
}, z.core.$strict>;
|
|
64
|
+
}, z.core.$strict>;
|
|
65
|
+
export type PluginI18n = DeepReadonly<{
|
|
66
|
+
metadata: z.infer<typeof metadata>;
|
|
67
|
+
[key: string]: LocalizedText | z.infer<typeof metadata>;
|
|
68
|
+
}>;
|
|
69
|
+
export declare function parsePluginI18n(value: unknown): PluginI18n;
|
|
70
|
+
declare const manifest: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
71
|
+
apiVersion: z.ZodLiteral<2>;
|
|
72
|
+
kind: z.ZodLiteral<"actions">;
|
|
73
|
+
entry: z.ZodString;
|
|
74
|
+
writes: z.ZodArray<z.ZodEnum<{
|
|
75
|
+
"concept.add": "concept.add";
|
|
76
|
+
"concept.bold": "concept.bold";
|
|
77
|
+
"concept.color": "concept.color";
|
|
78
|
+
"concept.italic": "concept.italic";
|
|
79
|
+
"concept.label": "concept.label";
|
|
80
|
+
"concept.notes": "concept.notes";
|
|
81
|
+
"concept.position": "concept.position";
|
|
82
|
+
"concept.positions": "concept.positions";
|
|
83
|
+
"concept.remove": "concept.remove";
|
|
84
|
+
"relation.connect": "relation.connect";
|
|
85
|
+
"relation.reconnect": "relation.reconnect";
|
|
86
|
+
"relation.remove": "relation.remove";
|
|
87
|
+
"relation.type": "relation.type";
|
|
88
|
+
"relation.type.create": "relation.type.create";
|
|
89
|
+
"selection.set": "selection.set";
|
|
90
|
+
"view.membership": "view.membership";
|
|
91
|
+
}>>;
|
|
92
|
+
capabilities: z.ZodArray<z.ZodEnum<{
|
|
93
|
+
files: "files";
|
|
94
|
+
images: "images";
|
|
95
|
+
notifications: "notifications";
|
|
96
|
+
storage: "storage";
|
|
97
|
+
ui: "ui";
|
|
98
|
+
}>>;
|
|
99
|
+
}, z.core.$strict>, ...z.ZodObject<{
|
|
100
|
+
apiVersion: z.ZodLiteral<2>;
|
|
101
|
+
kind: z.ZodLiteral<"theme" | "vocab">;
|
|
102
|
+
entry: z.ZodString;
|
|
103
|
+
writes: z.ZodTuple<[], null>;
|
|
104
|
+
capabilities: z.ZodTuple<[], null>;
|
|
105
|
+
}, z.core.$strict>[]], "kind">;
|
|
106
|
+
export type PluginManifest = DeepReadonly<z.infer<typeof manifest>>;
|
|
107
|
+
export declare function parsePluginManifest(value: unknown): z.infer<typeof manifest>;
|
|
108
|
+
declare const message: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
109
|
+
type: z.ZodLiteral<"request">;
|
|
110
|
+
id: z.ZodNumber;
|
|
111
|
+
contextId: z.ZodString;
|
|
112
|
+
method: z.ZodLiteral<"document.applyOperations">;
|
|
113
|
+
params: z.ZodObject<{
|
|
114
|
+
operations: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
115
|
+
kind: z.ZodLiteral<"concept.label">;
|
|
116
|
+
id: z.ZodString;
|
|
117
|
+
value: z.ZodString;
|
|
118
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
119
|
+
kind: z.ZodLiteral<"concept.notes">;
|
|
120
|
+
id: z.ZodString;
|
|
121
|
+
value: z.ZodString;
|
|
122
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
123
|
+
kind: z.ZodLiteral<"concept.color">;
|
|
124
|
+
id: z.ZodString;
|
|
125
|
+
value: z.ZodString;
|
|
126
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
127
|
+
kind: z.ZodLiteral<"concept.bold">;
|
|
128
|
+
id: z.ZodString;
|
|
129
|
+
value: z.ZodBoolean;
|
|
130
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
131
|
+
kind: z.ZodLiteral<"concept.italic">;
|
|
132
|
+
id: z.ZodString;
|
|
133
|
+
value: z.ZodBoolean;
|
|
134
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
135
|
+
kind: z.ZodLiteral<"concept.position">;
|
|
136
|
+
id: z.ZodString;
|
|
137
|
+
value: z.ZodObject<{
|
|
138
|
+
x: z.ZodNumber;
|
|
139
|
+
y: z.ZodNumber;
|
|
140
|
+
}, z.core.$strict>;
|
|
141
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
142
|
+
kind: z.ZodLiteral<"concept.positions">;
|
|
143
|
+
updates: z.ZodArray<z.ZodObject<{
|
|
144
|
+
id: z.ZodString;
|
|
145
|
+
position: z.ZodObject<{
|
|
146
|
+
x: z.ZodNumber;
|
|
147
|
+
y: z.ZodNumber;
|
|
148
|
+
}, z.core.$strict>;
|
|
149
|
+
}, z.core.$strict>>;
|
|
150
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
151
|
+
kind: z.ZodLiteral<"concept.add">;
|
|
152
|
+
id: z.ZodString;
|
|
153
|
+
position: z.ZodOptional<z.ZodObject<{
|
|
154
|
+
x: z.ZodNumber;
|
|
155
|
+
y: z.ZodNumber;
|
|
156
|
+
}, z.core.$strict>>;
|
|
157
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
158
|
+
kind: z.ZodLiteral<"concept.remove">;
|
|
159
|
+
id: z.ZodString;
|
|
160
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
161
|
+
kind: z.ZodLiteral<"relation.connect">;
|
|
162
|
+
source: z.ZodString;
|
|
163
|
+
target: z.ZodString;
|
|
164
|
+
type: z.ZodOptional<z.ZodObject<{
|
|
165
|
+
id: z.ZodString;
|
|
166
|
+
label: z.ZodString;
|
|
167
|
+
}, z.core.$strict>>;
|
|
168
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
169
|
+
kind: z.ZodLiteral<"relation.reconnect">;
|
|
170
|
+
id: z.ZodString;
|
|
171
|
+
source: z.ZodString;
|
|
172
|
+
target: z.ZodString;
|
|
173
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
174
|
+
kind: z.ZodLiteral<"relation.type">;
|
|
175
|
+
id: z.ZodString;
|
|
176
|
+
typeId: z.ZodString;
|
|
177
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
178
|
+
kind: z.ZodLiteral<"relation.type.create">;
|
|
179
|
+
id: z.ZodString;
|
|
180
|
+
typeId: z.ZodString;
|
|
181
|
+
label: z.ZodString;
|
|
182
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
183
|
+
kind: z.ZodLiteral<"relation.remove">;
|
|
184
|
+
id: z.ZodString;
|
|
185
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
186
|
+
kind: z.ZodLiteral<"document.reset">;
|
|
187
|
+
id: z.ZodString;
|
|
188
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
189
|
+
kind: z.ZodLiteral<"history.undo">;
|
|
190
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
191
|
+
kind: z.ZodLiteral<"history.redo">;
|
|
192
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
193
|
+
kind: z.ZodLiteral<"selection.set">;
|
|
194
|
+
value: z.ZodArray<z.ZodObject<{
|
|
195
|
+
kind: z.ZodEnum<{
|
|
196
|
+
concept: "concept";
|
|
197
|
+
relation: "relation";
|
|
198
|
+
}>;
|
|
199
|
+
id: z.ZodString;
|
|
200
|
+
}, z.core.$strict>>;
|
|
201
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
202
|
+
kind: z.ZodLiteral<"view.activate">;
|
|
203
|
+
id: z.ZodNullable<z.ZodString>;
|
|
204
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
205
|
+
kind: z.ZodLiteral<"view.create">;
|
|
206
|
+
id: z.ZodString;
|
|
207
|
+
name: z.ZodString;
|
|
208
|
+
conceptIds: z.ZodArray<z.ZodString>;
|
|
209
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
210
|
+
kind: z.ZodLiteral<"view.rename">;
|
|
211
|
+
id: z.ZodString;
|
|
212
|
+
name: z.ZodString;
|
|
213
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
214
|
+
kind: z.ZodLiteral<"view.pin">;
|
|
215
|
+
id: z.ZodString;
|
|
216
|
+
pinned: z.ZodBoolean;
|
|
217
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
218
|
+
kind: z.ZodLiteral<"view.membership">;
|
|
219
|
+
viewId: z.ZodString;
|
|
220
|
+
conceptId: z.ZodString;
|
|
221
|
+
included: z.ZodBoolean;
|
|
222
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
223
|
+
kind: z.ZodLiteral<"view.remove">;
|
|
224
|
+
id: z.ZodString;
|
|
225
|
+
}, z.core.$strict>, ...z.ZodObject<{
|
|
226
|
+
kind: z.ZodLiteral<"preferences.theme" | "preferences.vocab">;
|
|
227
|
+
id: z.ZodString;
|
|
228
|
+
}, z.core.$strict>[], z.ZodObject<{
|
|
229
|
+
kind: z.ZodLiteral<"preferences.locale">;
|
|
230
|
+
value: z.ZodEnum<{
|
|
231
|
+
en: "en";
|
|
232
|
+
it: "it";
|
|
233
|
+
"zh-CN": "zh-CN";
|
|
234
|
+
}>;
|
|
235
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
236
|
+
kind: z.ZodLiteral<"preferences.panels">;
|
|
237
|
+
value: z.ZodObject<{
|
|
238
|
+
explorerWidth: z.ZodNumber;
|
|
239
|
+
inspectorWidth: z.ZodNumber;
|
|
240
|
+
}, z.core.$strict>;
|
|
241
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
242
|
+
kind: z.ZodLiteral<"preferences.section">;
|
|
243
|
+
id: z.ZodEnum<{
|
|
244
|
+
inspector: "inspector";
|
|
245
|
+
"inspector.connections": "inspector.connections";
|
|
246
|
+
"inspector.nodes": "inspector.nodes";
|
|
247
|
+
"inspector.views": "inspector.views";
|
|
248
|
+
sidebar: "sidebar";
|
|
249
|
+
"sidebar.pinned-views": "sidebar.pinned-views";
|
|
250
|
+
"sidebar.views": "sidebar.views";
|
|
251
|
+
}>;
|
|
252
|
+
open: z.ZodBoolean;
|
|
253
|
+
}, z.core.$strict>], "kind">>;
|
|
254
|
+
revision: z.ZodNumber;
|
|
255
|
+
options: z.ZodOptional<z.ZodObject<{
|
|
256
|
+
historyGroup: z.ZodOptional<z.ZodString>;
|
|
257
|
+
}, z.core.$strict>>;
|
|
258
|
+
}, z.core.$strict>;
|
|
259
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
260
|
+
type: z.ZodLiteral<"request">;
|
|
261
|
+
id: z.ZodNumber;
|
|
262
|
+
contextId: z.ZodString;
|
|
263
|
+
method: z.ZodLiteral<"document.refresh">;
|
|
264
|
+
params: z.ZodObject<{}, z.core.$strict>;
|
|
265
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
266
|
+
type: z.ZodLiteral<"request">;
|
|
267
|
+
id: z.ZodNumber;
|
|
268
|
+
contextId: z.ZodString;
|
|
269
|
+
method: z.ZodLiteral<"storage.list">;
|
|
270
|
+
params: z.ZodObject<{}, z.core.$strict>;
|
|
271
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
272
|
+
type: z.ZodLiteral<"request">;
|
|
273
|
+
id: z.ZodNumber;
|
|
274
|
+
contextId: z.ZodString;
|
|
275
|
+
method: z.ZodLiteral<"storage.set">;
|
|
276
|
+
params: z.ZodObject<{
|
|
277
|
+
key: z.ZodString;
|
|
278
|
+
scope: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
279
|
+
kind: z.ZodLiteral<"concept">;
|
|
280
|
+
id: z.ZodString;
|
|
281
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
282
|
+
kind: z.ZodLiteral<"view">;
|
|
283
|
+
id: z.ZodString;
|
|
284
|
+
}, z.core.$strict>], "kind">>;
|
|
285
|
+
value: z.ZodPipe<z.ZodCustom<string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | /*elided*/ any | {
|
|
286
|
+
readonly [key: string]: string | number | boolean | /*elided*/ any | /*elided*/ any | null;
|
|
287
|
+
} | null)[] | {
|
|
288
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
289
|
+
} | null)[] | {
|
|
290
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
291
|
+
} | null)[] | {
|
|
292
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
293
|
+
} | null)[] | {
|
|
294
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
295
|
+
} | null)[] | {
|
|
296
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
297
|
+
} | null)[] | {
|
|
298
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
299
|
+
} | null)[] | {
|
|
300
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
301
|
+
} | null)[] | {
|
|
302
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
303
|
+
} | null)[] | {
|
|
304
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
305
|
+
} | null)[] | {
|
|
306
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
307
|
+
} | null)[] | {
|
|
308
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
309
|
+
} | null, string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | {
|
|
310
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
311
|
+
} | null)[] | {
|
|
312
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
313
|
+
} | null)[] | {
|
|
314
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
315
|
+
} | null)[] | {
|
|
316
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
317
|
+
} | null)[] | {
|
|
318
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
319
|
+
} | null)[] | {
|
|
320
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
321
|
+
} | null)[] | {
|
|
322
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
323
|
+
} | null)[] | {
|
|
324
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
325
|
+
} | null)[] | {
|
|
326
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
327
|
+
} | null)[] | {
|
|
328
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
329
|
+
} | null)[] | {
|
|
330
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
331
|
+
} | null)[] | {
|
|
332
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
333
|
+
} | null>, z.ZodTransform<string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | {
|
|
334
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
335
|
+
} | null)[] | {
|
|
336
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
337
|
+
} | null)[] | {
|
|
338
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
339
|
+
} | null)[] | {
|
|
340
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
341
|
+
} | null)[] | {
|
|
342
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
343
|
+
} | null)[] | {
|
|
344
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
345
|
+
} | null)[] | {
|
|
346
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
347
|
+
} | null)[] | {
|
|
348
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
349
|
+
} | null)[] | {
|
|
350
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
351
|
+
} | null)[] | {
|
|
352
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
353
|
+
} | null)[] | {
|
|
354
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
355
|
+
} | null)[] | {
|
|
356
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
357
|
+
} | null, string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | {
|
|
358
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
359
|
+
} | null)[] | {
|
|
360
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
361
|
+
} | null)[] | {
|
|
362
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
363
|
+
} | null)[] | {
|
|
364
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
365
|
+
} | null)[] | {
|
|
366
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
367
|
+
} | null)[] | {
|
|
368
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
369
|
+
} | null)[] | {
|
|
370
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
371
|
+
} | null)[] | {
|
|
372
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
373
|
+
} | null)[] | {
|
|
374
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
375
|
+
} | null)[] | {
|
|
376
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
377
|
+
} | null)[] | {
|
|
378
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
379
|
+
} | null)[] | {
|
|
380
|
+
readonly [key: string]: string | number | boolean | any | any | null;
|
|
381
|
+
} | null>>;
|
|
382
|
+
revision: z.ZodNumber;
|
|
383
|
+
}, z.core.$strict>;
|
|
384
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
385
|
+
type: z.ZodLiteral<"request">;
|
|
386
|
+
id: z.ZodNumber;
|
|
387
|
+
contextId: z.ZodString;
|
|
388
|
+
method: z.ZodLiteral<"storage.delete">;
|
|
389
|
+
params: z.ZodObject<{
|
|
390
|
+
key: z.ZodString;
|
|
391
|
+
scope: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
392
|
+
kind: z.ZodLiteral<"concept">;
|
|
393
|
+
id: z.ZodString;
|
|
394
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
395
|
+
kind: z.ZodLiteral<"view">;
|
|
396
|
+
id: z.ZodString;
|
|
397
|
+
}, z.core.$strict>], "kind">>;
|
|
398
|
+
revision: z.ZodNumber;
|
|
399
|
+
}, z.core.$strict>;
|
|
400
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
401
|
+
type: z.ZodLiteral<"request">;
|
|
402
|
+
id: z.ZodNumber;
|
|
403
|
+
contextId: z.ZodString;
|
|
404
|
+
method: z.ZodLiteral<"notifications.notify">;
|
|
405
|
+
params: z.ZodObject<{
|
|
406
|
+
tone: z.ZodEnum<{
|
|
407
|
+
info: "info";
|
|
408
|
+
warning: "warning";
|
|
409
|
+
}>;
|
|
410
|
+
title: z.ZodObject<{
|
|
411
|
+
en: z.ZodString;
|
|
412
|
+
it: z.ZodOptional<z.ZodString>;
|
|
413
|
+
'zh-CN': z.ZodOptional<z.ZodString>;
|
|
414
|
+
}, z.core.$strict>;
|
|
415
|
+
description: z.ZodOptional<z.ZodObject<{
|
|
416
|
+
en: z.ZodString;
|
|
417
|
+
it: z.ZodOptional<z.ZodString>;
|
|
418
|
+
'zh-CN': z.ZodOptional<z.ZodString>;
|
|
419
|
+
}, z.core.$strict>>;
|
|
420
|
+
}, z.core.$strict>;
|
|
421
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
422
|
+
type: z.ZodLiteral<"request">;
|
|
423
|
+
id: z.ZodNumber;
|
|
424
|
+
contextId: z.ZodString;
|
|
425
|
+
method: z.ZodLiteral<"files.open">;
|
|
426
|
+
params: z.ZodObject<{
|
|
427
|
+
extensions: z.ZodArray<z.ZodString>;
|
|
428
|
+
mimeTypes: z.ZodArray<z.ZodString>;
|
|
429
|
+
}, z.core.$strict>;
|
|
430
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
431
|
+
type: z.ZodLiteral<"request">;
|
|
432
|
+
id: z.ZodNumber;
|
|
433
|
+
contextId: z.ZodString;
|
|
434
|
+
method: z.ZodLiteral<"files.save">;
|
|
435
|
+
params: z.ZodUnion<readonly [z.ZodObject<{
|
|
436
|
+
name: z.ZodString;
|
|
437
|
+
mediaType: z.ZodString;
|
|
438
|
+
text: z.ZodString;
|
|
439
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
440
|
+
name: z.ZodString;
|
|
441
|
+
mediaType: z.ZodString;
|
|
442
|
+
base64: z.ZodString;
|
|
443
|
+
}, z.core.$strict>]>;
|
|
444
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
445
|
+
type: z.ZodLiteral<"request">;
|
|
446
|
+
id: z.ZodNumber;
|
|
447
|
+
contextId: z.ZodString;
|
|
448
|
+
method: z.ZodLiteral<"images.renderView">;
|
|
449
|
+
params: z.ZodObject<{
|
|
450
|
+
format: z.ZodLiteral<"png">;
|
|
451
|
+
scale: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<4>]>>;
|
|
452
|
+
}, z.core.$strict>;
|
|
453
|
+
}, z.core.$strict>], "method">, z.ZodObject<{
|
|
454
|
+
type: z.ZodLiteral<"panel-ready">;
|
|
455
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
456
|
+
type: z.ZodLiteral<"pong">;
|
|
457
|
+
id: z.ZodNumber;
|
|
458
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
459
|
+
type: z.ZodLiteral<"contribution">;
|
|
460
|
+
value: z.ZodUnknown;
|
|
461
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
462
|
+
type: z.ZodLiteral<"badge-result">;
|
|
463
|
+
value: z.ZodObject<{
|
|
464
|
+
value: z.ZodNullable<z.ZodNumber>;
|
|
465
|
+
refreshAt: z.ZodOptional<z.ZodNumber>;
|
|
466
|
+
}, z.core.$strict>;
|
|
467
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
468
|
+
type: z.ZodLiteral<"close">;
|
|
469
|
+
reason: z.ZodString;
|
|
470
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
471
|
+
type: z.ZodLiteral<"complete">;
|
|
472
|
+
ok: z.ZodLiteral<true>;
|
|
473
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
474
|
+
type: z.ZodLiteral<"complete">;
|
|
475
|
+
ok: z.ZodLiteral<false>;
|
|
476
|
+
error: z.ZodObject<{
|
|
477
|
+
code: z.ZodEnum<{
|
|
478
|
+
cancelled: "cancelled";
|
|
479
|
+
closed: "closed";
|
|
480
|
+
denied: "denied";
|
|
481
|
+
failed: "failed";
|
|
482
|
+
"invalid-input": "invalid-input";
|
|
483
|
+
"stale-context": "stale-context";
|
|
484
|
+
"stale-state": "stale-state";
|
|
485
|
+
timeout: "timeout";
|
|
486
|
+
unavailable: "unavailable";
|
|
487
|
+
}>;
|
|
488
|
+
issues: z.ZodArray<z.ZodObject<{
|
|
489
|
+
path: z.ZodString;
|
|
490
|
+
message: z.ZodString;
|
|
491
|
+
}, z.core.$strict>>;
|
|
492
|
+
displayMessage: z.ZodOptional<z.ZodObject<{
|
|
493
|
+
en: z.ZodString;
|
|
494
|
+
it: z.ZodOptional<z.ZodString>;
|
|
495
|
+
'zh-CN': z.ZodOptional<z.ZodString>;
|
|
496
|
+
}, z.core.$strict>>;
|
|
497
|
+
}, z.core.$strict>;
|
|
498
|
+
}, z.core.$strict>]>;
|
|
499
|
+
declare const actionDescriptor: z.ZodObject<{
|
|
500
|
+
id: z.ZodString;
|
|
501
|
+
label: z.ZodObject<{
|
|
502
|
+
en: z.ZodString;
|
|
503
|
+
it: z.ZodOptional<z.ZodString>;
|
|
504
|
+
'zh-CN': z.ZodOptional<z.ZodString>;
|
|
505
|
+
}, z.core.$strict>;
|
|
506
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
507
|
+
ui: z.ZodOptional<z.ZodLiteral<true>>;
|
|
508
|
+
badge: z.ZodOptional<z.ZodLiteral<true>>;
|
|
509
|
+
}, z.core.$strict>;
|
|
510
|
+
export declare const actionIconNames: readonly ['arrow-right', 'book-open', 'clipboard-paste', 'copy', 'download', 'file-down', 'file-up', 'folder', 'glasses', 'globe', 'layers', 'pencil', 'play', 'plus', 'refresh', 'repeat', 'scissors', 'search', 'share', 'sparkles', 'upload', 'zap'];
|
|
511
|
+
export type ActionIconName = (typeof actionIconNames)[number];
|
|
512
|
+
export type ActionDescriptor = DeepReadonly<z.infer<typeof actionDescriptor>>;
|
|
513
|
+
export type ActionContribution = Omit<ActionDescriptor, 'ui' | 'badge'> & {
|
|
514
|
+
readonly badge?: (input: ActionBadgeInput) => ActionBadgeResult | Promise<ActionBadgeResult>;
|
|
515
|
+
} & ({
|
|
516
|
+
readonly ui: ComponentType<ActionContext>;
|
|
517
|
+
readonly run?: never;
|
|
518
|
+
} | {
|
|
519
|
+
readonly ui?: never;
|
|
520
|
+
readonly run: (context: ActionContext) => void | Promise<void>;
|
|
521
|
+
});
|
|
522
|
+
export declare function parseContribution(kind: 'theme' | 'vocab', value: unknown): Definition;
|
|
523
|
+
export declare function parseContribution(kind: 'actions', value: unknown): readonly ActionDescriptor[];
|
|
524
|
+
export type ActionState = {
|
|
525
|
+
readonly revision: number;
|
|
526
|
+
readonly contextId: string;
|
|
527
|
+
readonly locale: Locale;
|
|
528
|
+
readonly theme: Readonly<Record<string, string>>;
|
|
529
|
+
readonly conceptPlacementOffset: Readonly<{
|
|
530
|
+
x: number;
|
|
531
|
+
y: number;
|
|
532
|
+
}>;
|
|
533
|
+
readonly viewGraph: GraphSnapshot;
|
|
534
|
+
readonly selected: Selection;
|
|
535
|
+
readonly workspace: {
|
|
536
|
+
readonly activeViewId: string | null;
|
|
537
|
+
readonly savedViews: readonly Pick<SavedView, 'id' | 'name' | 'pinned'>[];
|
|
538
|
+
};
|
|
539
|
+
readonly targetViewId: string | null;
|
|
540
|
+
readonly activeVocab: VocabDefinition | null;
|
|
541
|
+
readonly history: {
|
|
542
|
+
readonly canUndo: boolean;
|
|
543
|
+
readonly canRedo: boolean;
|
|
544
|
+
};
|
|
545
|
+
};
|
|
546
|
+
type WriteOptions = {
|
|
547
|
+
readonly historyGroup?: string;
|
|
548
|
+
};
|
|
549
|
+
type PluginWrites = Omit<ReturnType<typeof createWriteCommands<Promise<void>, Promise<string>>>, 'undo' | 'redo' | 'setView' | 'setActiveVocab' | 'setActiveTheme' | 'setLocale' | 'setPanelSizes' | 'setSectionOpen' | 'createView' | 'renameView' | 'setViewPinned' | 'deleteView'>;
|
|
550
|
+
export type ActionContext = {
|
|
551
|
+
readonly viewId: string | null;
|
|
552
|
+
readonly document: PluginWrites & {
|
|
553
|
+
readonly getState: () => ActionState;
|
|
554
|
+
readonly subscribe: (listener: () => void) => () => void;
|
|
555
|
+
readonly refresh: () => Promise<ActionState>;
|
|
556
|
+
readonly applyOperations: (operations: readonly NessoOperation[], options?: WriteOptions) => Promise<{
|
|
557
|
+
readonly revision: number;
|
|
558
|
+
readonly changed: boolean;
|
|
559
|
+
}>;
|
|
560
|
+
};
|
|
561
|
+
readonly notifications: {
|
|
562
|
+
readonly notify: (value: {
|
|
563
|
+
readonly tone: 'info' | 'warning';
|
|
564
|
+
readonly title: LocalizedText;
|
|
565
|
+
readonly description?: LocalizedText;
|
|
566
|
+
}) => Promise<string>;
|
|
567
|
+
};
|
|
568
|
+
readonly files: {
|
|
569
|
+
readonly open: (options: FileOpenOptions) => Promise<FileOpenResult>;
|
|
570
|
+
readonly save: (options: FileSaveOptions) => Promise<{
|
|
571
|
+
readonly saved: boolean;
|
|
572
|
+
}>;
|
|
573
|
+
};
|
|
574
|
+
readonly storage: PluginStorage;
|
|
575
|
+
readonly images: {
|
|
576
|
+
readonly renderView: (options: ImageRenderOptions) => Promise<RenderedImage>;
|
|
577
|
+
};
|
|
578
|
+
readonly signal: AbortSignal;
|
|
579
|
+
};
|
|
580
|
+
export declare function parsePluginMessage(value: unknown): z.infer<typeof message>;
|
|
581
|
+
export declare function sha256Hex(bytes: Uint8Array): Promise<string>;
|
|
582
|
+
export declare function createPluginClient(port: MessagePort, initial: unknown): {
|
|
583
|
+
context: ActionContext;
|
|
584
|
+
close: () => void;
|
|
585
|
+
getPresentation: () => Pick<ActionState, 'theme' | 'locale'>;
|
|
586
|
+
};
|