@nesso-how/plugin 0.4.0 → 0.6.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 +121 -51
- 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 +28 -0
- package/dist/node/definitions.d.ts +69 -0
- package/dist/node/definitions.js +124 -0
- package/dist/node/errors.d.ts +10 -0
- package/dist/node/errors.js +45 -0
- package/dist/node/files.d.ts +20 -0
- package/dist/node/files.js +36 -0
- package/dist/node/i18n.d.ts +12 -0
- package/dist/node/i18n.js +11 -0
- package/dist/node/index.d.ts +6 -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 +555 -0
- package/dist/node/runtime.js +513 -0
- package/dist/node/storage.d.ts +46 -0
- package/dist/node/storage.js +67 -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-C-k6OiHL.js → runtime-BM45o1qi.js} +307 -219
- package/dist/{runtime-BrWPGuBB.d.ts → runtime-BxtTAcko.d.ts} +159 -123
- package/dist/runtime.d.ts +2 -2
- package/dist/runtime.js +1 -1
- package/example/README.md +11 -8
- package/example/package.json +46 -20
- package/example/src/Quiz.css +50 -0
- package/example/src/Quiz.tsx +70 -0
- package/example/src/index.ts +18 -9
- package/example/tsconfig.json +6 -4
- package/example/vite.config.ts +14 -0
- package/package.json +9 -3
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ZodType, z } from "zod";
|
|
2
|
-
|
|
2
|
+
import { ComponentType } from "react";
|
|
3
|
+
//#region ../errors/dist/index.d.ts
|
|
3
4
|
type ErrorIssue = {
|
|
4
5
|
path: string;
|
|
5
6
|
message: string;
|
|
@@ -10,99 +11,47 @@ declare class NessoError extends Error {
|
|
|
10
11
|
constructor(issues: ErrorIssue[]);
|
|
11
12
|
}
|
|
12
13
|
//#endregion
|
|
13
|
-
//#region ../schema/
|
|
14
|
-
|
|
15
|
-
x:
|
|
16
|
-
y:
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
id: string
|
|
20
|
-
label:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
predicate: string;
|
|
34
|
-
target: string;
|
|
35
|
-
};
|
|
36
|
-
type Graph = {
|
|
37
|
-
concepts: Concept[];
|
|
38
|
-
relationTypes: RelationType[];
|
|
39
|
-
relations: Relation[];
|
|
40
|
-
};
|
|
41
|
-
//#endregion
|
|
42
|
-
//#region ../i18n/src/locale.d.ts
|
|
43
|
-
declare const locales: readonly ['en', 'it', 'zh-CN'];
|
|
44
|
-
type Locale = typeof locales[number];
|
|
45
|
-
//#endregion
|
|
46
|
-
//#region src/definitions.d.ts
|
|
47
|
-
declare const themeColors: readonly ['background', 'foreground', 'canvas', 'sidebar', 'primary', 'primary-hover', 'primary-foreground', 'muted', 'muted-foreground', 'hover', 'pressed', 'border', 'ring', 'selection-halo', 'node-border', 'edge', 'handle'];
|
|
48
|
-
declare const themeDefinition: z.ZodObject<{
|
|
49
|
-
id: z.ZodString;
|
|
50
|
-
colors: z.ZodObject<{
|
|
51
|
-
background: z.ZodString;
|
|
52
|
-
border: z.ZodString;
|
|
53
|
-
canvas: z.ZodString;
|
|
54
|
-
edge: z.ZodString;
|
|
55
|
-
foreground: z.ZodString;
|
|
56
|
-
handle: z.ZodString;
|
|
57
|
-
hover: z.ZodString;
|
|
58
|
-
muted: z.ZodString;
|
|
59
|
-
"muted-foreground": z.ZodString;
|
|
60
|
-
"node-border": z.ZodString;
|
|
61
|
-
pressed: z.ZodString;
|
|
62
|
-
primary: z.ZodString;
|
|
63
|
-
"primary-foreground": z.ZodString;
|
|
64
|
-
"primary-hover": z.ZodString;
|
|
65
|
-
ring: z.ZodString;
|
|
66
|
-
"selection-halo": z.ZodString;
|
|
67
|
-
sidebar: z.ZodString;
|
|
68
|
-
}, z.core.$strict>;
|
|
69
|
-
metrics: z.ZodObject<{
|
|
70
|
-
'radius-control': z.ZodNumber;
|
|
71
|
-
'radius-object': z.ZodNumber;
|
|
72
|
-
'duration-state': z.ZodNumber;
|
|
73
|
-
}, z.core.$strict>;
|
|
74
|
-
fonts: z.ZodObject<{
|
|
75
|
-
sans: z.ZodObject<{
|
|
76
|
-
faces: z.ZodArray<z.ZodObject<{
|
|
77
|
-
path: z.ZodString;
|
|
78
|
-
weight: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
79
|
-
style: z.ZodEnum<{
|
|
80
|
-
italic: "italic";
|
|
81
|
-
normal: "normal";
|
|
82
|
-
}>;
|
|
83
|
-
unicodeRange: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
|
|
84
|
-
}, z.core.$strict>>;
|
|
85
|
-
}, z.core.$strict>;
|
|
86
|
-
mono: z.ZodObject<{
|
|
87
|
-
faces: z.ZodArray<z.ZodObject<{
|
|
88
|
-
path: z.ZodString;
|
|
89
|
-
weight: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
90
|
-
style: z.ZodEnum<{
|
|
91
|
-
italic: "italic";
|
|
92
|
-
normal: "normal";
|
|
93
|
-
}>;
|
|
94
|
-
unicodeRange: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
|
|
95
|
-
}, z.core.$strict>>;
|
|
14
|
+
//#region ../schema/dist/types.d.ts
|
|
15
|
+
declare const positionSchema: z.ZodObject<{
|
|
16
|
+
x: z.ZodNumber;
|
|
17
|
+
y: z.ZodNumber;
|
|
18
|
+
}, z.core.$strict>;
|
|
19
|
+
declare const relationTypeSchema: z.ZodObject<{
|
|
20
|
+
id: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
21
|
+
label: z.ZodString;
|
|
22
|
+
}, z.core.$strict>;
|
|
23
|
+
declare const graphSchema: z.ZodObject<{
|
|
24
|
+
concepts: z.ZodArray<z.ZodObject<{
|
|
25
|
+
id: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
26
|
+
label: z.ZodString;
|
|
27
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
28
|
+
color: z.ZodOptional<z.ZodString>;
|
|
29
|
+
bold: z.ZodOptional<z.ZodBoolean>;
|
|
30
|
+
italic: z.ZodOptional<z.ZodBoolean>;
|
|
31
|
+
position: z.ZodObject<{
|
|
32
|
+
x: z.ZodNumber;
|
|
33
|
+
y: z.ZodNumber;
|
|
96
34
|
}, z.core.$strict>;
|
|
97
|
-
}, z.core.$strict
|
|
35
|
+
}, z.core.$strict>>;
|
|
36
|
+
relationTypes: z.ZodArray<z.ZodObject<{
|
|
37
|
+
id: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
38
|
+
label: z.ZodString;
|
|
39
|
+
}, z.core.$strict>>;
|
|
40
|
+
relations: z.ZodArray<z.ZodObject<{
|
|
41
|
+
source: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
42
|
+
predicate: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
43
|
+
target: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
44
|
+
}, z.core.$strict>>;
|
|
98
45
|
}, z.core.$strict>;
|
|
99
|
-
type
|
|
100
|
-
type
|
|
101
|
-
|
|
102
|
-
declare function parseDefinition(kind: 'vocab', value: unknown): VocabDefinition;
|
|
103
|
-
declare function parseDefinition(kind: 'theme' | 'vocab', value: unknown): Definition;
|
|
46
|
+
type Position = z.infer<typeof positionSchema>;
|
|
47
|
+
type RelationType = z.infer<typeof relationTypeSchema>;
|
|
48
|
+
type Graph = z.infer<typeof graphSchema>;
|
|
104
49
|
//#endregion
|
|
105
|
-
//#region
|
|
50
|
+
//#region ../i18n/dist/locale.d.ts
|
|
51
|
+
declare const locales: readonly ['en', 'it', 'zh-CN'];
|
|
52
|
+
type Locale = (typeof locales)[number];
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region ../core/dist/types.d.ts
|
|
106
55
|
type DeepReadonly<T> = T extends readonly (infer U)[] ? readonly DeepReadonly<U>[] : T extends object ? { readonly [K in keyof T]: DeepReadonly<T[K]>; } : T;
|
|
107
56
|
type Selection = readonly {
|
|
108
57
|
readonly kind: 'concept' | 'relation';
|
|
@@ -114,7 +63,7 @@ type NessoOperation = {
|
|
|
114
63
|
readonly id: string;
|
|
115
64
|
readonly value: string;
|
|
116
65
|
} | {
|
|
117
|
-
readonly kind: 'concept.
|
|
66
|
+
readonly kind: 'concept.notes';
|
|
118
67
|
readonly id: string;
|
|
119
68
|
readonly value: string;
|
|
120
69
|
} | {
|
|
@@ -228,7 +177,9 @@ type NessoOperation = {
|
|
|
228
177
|
};
|
|
229
178
|
type VocabDefinition = {
|
|
230
179
|
readonly id: string;
|
|
231
|
-
readonly relationTypes: readonly Readonly<RelationType>
|
|
180
|
+
readonly relationTypes: readonly (Readonly<RelationType> & {
|
|
181
|
+
readonly translations?: Readonly<Partial<Record<Locale, string>>>;
|
|
182
|
+
})[];
|
|
232
183
|
readonly defaultTypeId: string;
|
|
233
184
|
};
|
|
234
185
|
type SavedView = {
|
|
@@ -255,6 +206,7 @@ type SectionId = 'sidebar' | 'sidebar.pinned-views' | 'sidebar.views' | 'inspect
|
|
|
255
206
|
type Preferences = {
|
|
256
207
|
readonly locale?: Locale;
|
|
257
208
|
readonly introSeen?: boolean;
|
|
209
|
+
readonly mcpEnabled?: boolean;
|
|
258
210
|
readonly activeVocabId: string;
|
|
259
211
|
readonly activeRendererId: string;
|
|
260
212
|
readonly activeThemeId: string;
|
|
@@ -287,7 +239,7 @@ type NessoStore = {
|
|
|
287
239
|
readonly position: Readonly<Position>;
|
|
288
240
|
}[], historyGroup?: string) => void;
|
|
289
241
|
readonly setConceptLabel: (id: string, label: string, historyGroup?: string) => void;
|
|
290
|
-
readonly
|
|
242
|
+
readonly setConceptNotes: (id: string, notes: string, historyGroup?: string) => void;
|
|
291
243
|
readonly setConceptColor: (id: string, color: string, historyGroup?: string) => void;
|
|
292
244
|
readonly setConceptBold: (id: string, value: boolean, historyGroup?: string) => void;
|
|
293
245
|
readonly setConceptItalic: (id: string, value: boolean, historyGroup?: string) => void;
|
|
@@ -317,24 +269,69 @@ type NessoStore = {
|
|
|
317
269
|
readonly deleteView: (id: string) => void;
|
|
318
270
|
readonly getViewGraph: (id: string) => GraphSnapshot;
|
|
319
271
|
};
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
};
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
272
|
+
//#endregion
|
|
273
|
+
//#region ../core/dist/commands.d.ts
|
|
274
|
+
type WriteMethods = Omit<NessoStore, 'getState' | 'subscribe' | 'getViewGraph' | 'conceptPlacementOffset' | 'applyOperations' | 'setViewport' | 'setActiveRenderer' | 'resetGraph'>;
|
|
275
|
+
declare function createWriteCommands<Commit, Created>(applyOperations: (...args: Parameters<NessoStore['applyOperations']>) => Commit, created: (id: string, commit: Commit) => Created): { readonly [K in keyof WriteMethods]: (...args: Parameters<WriteMethods[K]>) => K extends 'addConcept' | 'createView' ? Created : Commit; };
|
|
276
|
+
//#endregion
|
|
277
|
+
//#region src/definitions.d.ts
|
|
278
|
+
declare const themeColors: readonly ['background', 'foreground', 'canvas', 'sidebar', 'primary', 'primary-hover', 'primary-foreground', 'muted', 'muted-foreground', 'hover', 'pressed', 'border', 'ring', 'selection-halo', 'node-border', 'edge', 'handle'];
|
|
279
|
+
declare const themeDefinition: z.ZodObject<{
|
|
280
|
+
id: z.ZodString;
|
|
281
|
+
colors: z.ZodObject<{
|
|
282
|
+
background: z.ZodString;
|
|
283
|
+
border: z.ZodString;
|
|
284
|
+
canvas: z.ZodString;
|
|
285
|
+
edge: z.ZodString;
|
|
286
|
+
foreground: z.ZodString;
|
|
287
|
+
handle: z.ZodString;
|
|
288
|
+
hover: z.ZodString;
|
|
289
|
+
muted: z.ZodString;
|
|
290
|
+
"muted-foreground": z.ZodString;
|
|
291
|
+
"node-border": z.ZodString;
|
|
292
|
+
pressed: z.ZodString;
|
|
293
|
+
primary: z.ZodString;
|
|
294
|
+
"primary-foreground": z.ZodString;
|
|
295
|
+
"primary-hover": z.ZodString;
|
|
296
|
+
ring: z.ZodString;
|
|
297
|
+
"selection-halo": z.ZodString;
|
|
298
|
+
sidebar: z.ZodString;
|
|
299
|
+
}, z.core.$strict>;
|
|
300
|
+
metrics: z.ZodObject<{
|
|
301
|
+
'radius-control': z.ZodNumber;
|
|
302
|
+
'radius-object': z.ZodNumber;
|
|
303
|
+
'duration-state': z.ZodNumber;
|
|
304
|
+
}, z.core.$strict>;
|
|
305
|
+
fonts: z.ZodObject<{
|
|
306
|
+
sans: z.ZodObject<{
|
|
307
|
+
faces: z.ZodArray<z.ZodObject<{
|
|
308
|
+
path: z.ZodString;
|
|
309
|
+
weight: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
310
|
+
style: z.ZodEnum<{
|
|
311
|
+
italic: "italic";
|
|
312
|
+
normal: "normal";
|
|
313
|
+
}>;
|
|
314
|
+
unicodeRange: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
|
|
315
|
+
}, z.core.$strict>>;
|
|
316
|
+
}, z.core.$strict>;
|
|
317
|
+
mono: z.ZodObject<{
|
|
318
|
+
faces: z.ZodArray<z.ZodObject<{
|
|
319
|
+
path: z.ZodString;
|
|
320
|
+
weight: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
321
|
+
style: z.ZodEnum<{
|
|
322
|
+
italic: "italic";
|
|
323
|
+
normal: "normal";
|
|
324
|
+
}>;
|
|
325
|
+
unicodeRange: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
|
|
326
|
+
}, z.core.$strict>>;
|
|
327
|
+
}, z.core.$strict>;
|
|
328
|
+
}, z.core.$strict>;
|
|
329
|
+
}, z.core.$strict>;
|
|
330
|
+
type ThemeDefinition = DeepReadonly<z.infer<typeof themeDefinition>>;
|
|
331
|
+
type Definition = ThemeDefinition | VocabDefinition;
|
|
332
|
+
declare function parseDefinition(kind: 'theme', value: unknown): ThemeDefinition;
|
|
333
|
+
declare function parseDefinition(kind: 'vocab', value: unknown): VocabDefinition;
|
|
334
|
+
declare function parseDefinition(kind: 'theme' | 'vocab', value: unknown): Definition;
|
|
338
335
|
//#endregion
|
|
339
336
|
//#region src/i18n.d.ts
|
|
340
337
|
type LocalizedText = Readonly<{
|
|
@@ -351,10 +348,6 @@ declare class PluginError extends NessoError {
|
|
|
351
348
|
}
|
|
352
349
|
declare function parseOrThrow(schema: ZodType, value: unknown, prefix?: string): any;
|
|
353
350
|
//#endregion
|
|
354
|
-
//#region src/commands.d.ts
|
|
355
|
-
type WriteMethods = Omit<NessoStore, 'getState' | 'subscribe' | 'getViewGraph' | 'conceptPlacementOffset' | 'applyOperations' | 'setViewport' | 'setActiveRenderer' | 'resetGraph'>;
|
|
356
|
-
declare function createWriteCommands<Commit, Created>(applyOperations: (...args: Parameters<NessoStore['applyOperations']>) => Commit, created: (id: string, commit: Commit) => Created): { readonly [K in keyof WriteMethods]: (...args: Parameters<WriteMethods[K]>) => K extends 'addConcept' | 'createView' ? Created : Commit; };
|
|
357
|
-
//#endregion
|
|
358
351
|
//#region src/files.d.ts
|
|
359
352
|
declare const fileTextLimit: number;
|
|
360
353
|
declare const fileOpenOptions: z.ZodObject<{
|
|
@@ -423,6 +416,9 @@ declare function parsePluginStorageKey(value: unknown): PluginStorageKey;
|
|
|
423
416
|
//#region src/data.d.ts
|
|
424
417
|
declare function checkMessageSize(value: unknown, limit: number, maximumDepth?: number): void;
|
|
425
418
|
//#endregion
|
|
419
|
+
//#region src/theme-fonts.d.ts
|
|
420
|
+
declare const fontFaces: (ranges: Record<string, string>, stem: string, weight: [number, number]) => ThemeDefinition['fonts']['sans'];
|
|
421
|
+
//#endregion
|
|
426
422
|
//#region src/runtime.d.ts
|
|
427
423
|
declare const runtimeLimits: {
|
|
428
424
|
readonly request: number;
|
|
@@ -432,7 +428,26 @@ declare const runtimeLimits: {
|
|
|
432
428
|
readonly interaction: 300000;
|
|
433
429
|
readonly initialization: 10000;
|
|
434
430
|
readonly action: 120000;
|
|
431
|
+
readonly heartbeat: 15000;
|
|
432
|
+
};
|
|
433
|
+
declare const badgeLimits: {
|
|
434
|
+
readonly value: 999999;
|
|
435
|
+
readonly execution: 2000;
|
|
436
|
+
readonly refresh: 15000;
|
|
437
|
+
readonly rate: 1000;
|
|
438
|
+
};
|
|
439
|
+
declare const actionBadgeResult: z.ZodObject<{
|
|
440
|
+
value: z.ZodNullable<z.ZodNumber>;
|
|
441
|
+
refreshAt: z.ZodOptional<z.ZodNumber>;
|
|
442
|
+
}, z.core.$strict>;
|
|
443
|
+
type ActionBadgeInput = {
|
|
444
|
+
readonly viewId: string | null;
|
|
445
|
+
readonly viewGraph: GraphSnapshot;
|
|
446
|
+
readonly records: readonly PluginStorageRecord[];
|
|
447
|
+
readonly now: number;
|
|
435
448
|
};
|
|
449
|
+
type ActionBadgeResult = DeepReadonly<z.infer<typeof actionBadgeResult>>;
|
|
450
|
+
declare const parseActionBadgeResult: (value: unknown) => ActionBadgeResult;
|
|
436
451
|
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"];
|
|
437
452
|
declare const metadata: z.ZodObject<{
|
|
438
453
|
name: z.ZodObject<{
|
|
@@ -464,9 +479,9 @@ declare const manifest: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
464
479
|
"concept.add": "concept.add";
|
|
465
480
|
"concept.bold": "concept.bold";
|
|
466
481
|
"concept.color": "concept.color";
|
|
467
|
-
"concept.description": "concept.description";
|
|
468
482
|
"concept.italic": "concept.italic";
|
|
469
483
|
"concept.label": "concept.label";
|
|
484
|
+
"concept.notes": "concept.notes";
|
|
470
485
|
"concept.position": "concept.position";
|
|
471
486
|
"concept.positions": "concept.positions";
|
|
472
487
|
"concept.remove": "concept.remove";
|
|
@@ -482,6 +497,7 @@ declare const manifest: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
482
497
|
files: "files";
|
|
483
498
|
notifications: "notifications";
|
|
484
499
|
storage: "storage";
|
|
500
|
+
ui: "ui";
|
|
485
501
|
}>>;
|
|
486
502
|
}, z.core.$strict>, ...z.ZodObject<{
|
|
487
503
|
apiVersion: z.ZodLiteral<1>;
|
|
@@ -503,7 +519,7 @@ declare const message: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
503
519
|
id: z.ZodString;
|
|
504
520
|
value: z.ZodString;
|
|
505
521
|
}, z.core.$strict>, z.ZodObject<{
|
|
506
|
-
kind: z.ZodLiteral<"concept.
|
|
522
|
+
kind: z.ZodLiteral<"concept.notes">;
|
|
507
523
|
id: z.ZodString;
|
|
508
524
|
value: z.ZodString;
|
|
509
525
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -813,8 +829,19 @@ declare const message: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
813
829
|
text: z.ZodString;
|
|
814
830
|
}, z.core.$strict>;
|
|
815
831
|
}, z.core.$strict>], "method">, z.ZodObject<{
|
|
832
|
+
type: z.ZodLiteral<"panel-ready">;
|
|
833
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
834
|
+
type: z.ZodLiteral<"pong">;
|
|
835
|
+
id: z.ZodNumber;
|
|
836
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
816
837
|
type: z.ZodLiteral<"contribution">;
|
|
817
838
|
value: z.ZodUnknown;
|
|
839
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
840
|
+
type: z.ZodLiteral<"badge-result">;
|
|
841
|
+
value: z.ZodObject<{
|
|
842
|
+
value: z.ZodNullable<z.ZodNumber>;
|
|
843
|
+
refreshAt: z.ZodOptional<z.ZodNumber>;
|
|
844
|
+
}, z.core.$strict>;
|
|
818
845
|
}, z.core.$strict>, z.ZodObject<{
|
|
819
846
|
type: z.ZodLiteral<"close">;
|
|
820
847
|
reason: z.ZodString;
|
|
@@ -855,13 +882,21 @@ declare const actionDescriptor: z.ZodObject<{
|
|
|
855
882
|
'zh-CN': z.ZodOptional<z.ZodString>;
|
|
856
883
|
}, z.core.$strict>;
|
|
857
884
|
icon: z.ZodOptional<z.ZodString>;
|
|
885
|
+
ui: z.ZodOptional<z.ZodLiteral<true>>;
|
|
886
|
+
badge: z.ZodOptional<z.ZodLiteral<true>>;
|
|
858
887
|
}, z.core.$strict>;
|
|
859
|
-
declare const actionIconNames: readonly ['arrow-right', 'book-open', 'clipboard-paste', 'copy', 'download', 'file-down', 'file-up', 'folder', 'globe', 'layers', 'pencil', 'play', 'plus', 'refresh', 'scissors', 'search', 'share', 'sparkles', 'upload', 'zap'];
|
|
860
|
-
type ActionIconName = typeof actionIconNames[number];
|
|
888
|
+
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'];
|
|
889
|
+
type ActionIconName = (typeof actionIconNames)[number];
|
|
861
890
|
type ActionDescriptor = DeepReadonly<z.infer<typeof actionDescriptor>>;
|
|
862
|
-
type ActionContribution = ActionDescriptor & {
|
|
891
|
+
type ActionContribution = Omit<ActionDescriptor, 'ui' | 'badge'> & {
|
|
892
|
+
readonly badge?: (input: ActionBadgeInput) => ActionBadgeResult | Promise<ActionBadgeResult>;
|
|
893
|
+
} & ({
|
|
894
|
+
readonly ui: ComponentType<ActionContext>;
|
|
895
|
+
readonly run?: never;
|
|
896
|
+
} | {
|
|
897
|
+
readonly ui?: never;
|
|
863
898
|
readonly run: (context: ActionContext) => void | Promise<void>;
|
|
864
|
-
};
|
|
899
|
+
});
|
|
865
900
|
declare function parseContribution(kind: 'theme' | 'vocab', value: unknown): Definition;
|
|
866
901
|
declare function parseContribution(kind: 'actions', value: unknown): readonly ActionDescriptor[];
|
|
867
902
|
type ActionState = {
|
|
@@ -922,6 +957,7 @@ declare function sha256Hex(bytes: Uint8Array): Promise<string>;
|
|
|
922
957
|
declare function createPluginClient(port: MessagePort, initial: unknown): {
|
|
923
958
|
context: ActionContext;
|
|
924
959
|
close: () => void;
|
|
960
|
+
getPresentation: () => Pick<ActionState, 'theme' | 'locale'>;
|
|
925
961
|
};
|
|
926
962
|
//#endregion
|
|
927
|
-
export {
|
|
963
|
+
export { FileOpenOptions as A, ThemeDefinition as B, PluginStorage as C, parsePluginStorageRecord as D, parsePluginStorageKey as E, PluginError as F, SavedView as G, themeColors as H, parseOrThrow as I, Selection as K, LocalizedText as L, FileSaveOptions as M, fileTextLimit as N, parsePluginStorageSnapshot as O, parseFileOptions as P, resolvePluginText as R, checkMessageSize as S, PluginStorageRecord as T, GraphSnapshot as U, parseDefinition as V, NessoOperation as W, parsePluginMessage as _, ActionDescriptor as a, themeTokens as b, PluginI18n as c, badgeLimits as d, createPluginClient as f, parsePluginManifest as g, parsePluginI18n as h, ActionContribution as i, FileOpenResult as j, pluginStorageLimits as k, PluginManifest as l, parseContribution as m, ActionBadgeResult as n, ActionIconName as o, parseActionBadgeResult as p, VocabDefinition as q, ActionContext as r, ActionState as s, ActionBadgeInput as t, actionIconNames as u, runtimeLimits as v, PluginStorageKey as w, fontFaces as x, sha256Hex as y, Definition as z };
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { ActionContext, ActionContribution, ActionDescriptor, ActionIconName, ActionState, type Definition, type FileOpenOptions, type FileOpenResult, type FileSaveOptions, type LocalizedText, PluginError, PluginI18n, PluginManifest, actionIconNames, checkMessageSize, createPluginClient, fileTextLimit, parseContribution, parseDefinition, parseFileOptions, parseOrThrow, parsePluginI18n, parsePluginManifest, parsePluginMessage, parsePluginStorageKey, parsePluginStorageRecord, parsePluginStorageSnapshot, pluginStorageLimits, resolvePluginText, runtimeLimits, sha256Hex, themeColors, themeTokens };
|
|
1
|
+
import { A as FileOpenOptions, D as parsePluginStorageRecord, E as parsePluginStorageKey, F as PluginError, H as themeColors, I as parseOrThrow, L as LocalizedText, M as FileSaveOptions, N as fileTextLimit, O as parsePluginStorageSnapshot, P as parseFileOptions, R as resolvePluginText, S as checkMessageSize, V as parseDefinition, _ as parsePluginMessage, a as ActionDescriptor, b as themeTokens, c as PluginI18n, d as badgeLimits, f as createPluginClient, g as parsePluginManifest, h as parsePluginI18n, i as ActionContribution, j as FileOpenResult, k as pluginStorageLimits, l as PluginManifest, m as parseContribution, n as ActionBadgeResult, o as ActionIconName, p as parseActionBadgeResult, r as ActionContext, s as ActionState, t as ActionBadgeInput, u as actionIconNames, v as runtimeLimits, x as fontFaces, y as sha256Hex, z as Definition } from "./runtime-BxtTAcko.js";
|
|
2
|
+
export { ActionBadgeInput, ActionBadgeResult, ActionContext, ActionContribution, ActionDescriptor, ActionIconName, ActionState, type Definition, type FileOpenOptions, type FileOpenResult, type FileSaveOptions, type LocalizedText, PluginError, PluginI18n, PluginManifest, actionIconNames, badgeLimits, checkMessageSize, createPluginClient, fileTextLimit, fontFaces, parseActionBadgeResult, parseContribution, parseDefinition, parseFileOptions, parseOrThrow, parsePluginI18n, parsePluginManifest, parsePluginMessage, parsePluginStorageKey, parsePluginStorageRecord, parsePluginStorageSnapshot, pluginStorageLimits, resolvePluginText, runtimeLimits, sha256Hex, themeColors, themeTokens };
|
package/dist/runtime.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { C as PluginError, t as actionIconNames, n as badgeLimits, _ as checkMessageSize, r as createPluginClient, y as fileTextLimit, f as fontFaces, i as parseActionBadgeResult, a as parseContribution, x as parseDefinition, b as parseFileOptions, w as parseOrThrow, o as parsePluginI18n, s as parsePluginManifest, c as parsePluginMessage, p as parsePluginStorageKey, m as parsePluginStorageRecord, h as parsePluginStorageSnapshot, g as pluginStorageLimits, v as resolvePluginText, l as runtimeLimits, u as sha256Hex, S as themeColors, d as themeTokens } from "./runtime-BM45o1qi.js";
|
package/example/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Plugin Example
|
|
2
2
|
|
|
3
|
-
The official Nesso
|
|
3
|
+
The official Nesso plugin example: an **Uppercase labels** action and a React **Concept Quiz** with persistent progress. See [`src/index.ts`](src/index.ts) and [`src/Quiz.tsx`](src/Quiz.tsx).
|
|
4
4
|
|
|
5
5
|
## Install and try
|
|
6
6
|
|
|
7
|
-
In the desktop app, open Settings → Plugins, search for `@nesso-how/plugin-example`, and install it. Approve its declared access to concept labels.
|
|
7
|
+
In the desktop app, open Settings → Plugins, search for `@nesso-how/plugin-example`, and install it. Approve its declared access to concept labels, interactive panels, and private storage. The panel example requires the SDK and app versions containing central-panel support; build from this checkout until that SDK release is published.
|
|
8
8
|
|
|
9
|
-
Run
|
|
9
|
+
Run either action from a view's context menu in the Explorer, or from its actions in the Inspector with nothing selected.
|
|
10
10
|
|
|
11
11
|
## Build your own
|
|
12
12
|
|
|
@@ -17,9 +17,9 @@ npm install
|
|
|
17
17
|
npm run build
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
The
|
|
20
|
+
The Vite configuration bundles code and imported CSS into `dist/index.js`, leaving React and React DOM to Nesso. See the [UI contract](../README.md#action-ui) for runtime requirements.
|
|
21
21
|
|
|
22
|
-
Choose your own package name and action
|
|
22
|
+
Choose your own package name, plugin metadata, and action IDs and labels before publishing.
|
|
23
23
|
|
|
24
24
|
## Test an unpublished build
|
|
25
25
|
|
|
@@ -28,8 +28,11 @@ Open `package.json` and `dist/index.js` in a text editor. In desktop DevTools, s
|
|
|
28
28
|
```ts
|
|
29
29
|
const result = await window.nessoPlugins.propose(
|
|
30
30
|
crypto.randomUUID(),
|
|
31
|
-
{
|
|
32
|
-
|
|
31
|
+
{
|
|
32
|
+
manifest,
|
|
33
|
+
files: [{ path: manifest.nesso.entry, bytes: new TextEncoder().encode(compiledCode) }],
|
|
34
|
+
},
|
|
35
|
+
'en',
|
|
33
36
|
)
|
|
34
37
|
```
|
|
35
38
|
|
package/example/package.json
CHANGED
|
@@ -1,42 +1,68 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nesso-how/plugin-example",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "Official example showing how to build Nesso plugins with the SDK and plugin APIs",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"nesso-plugin"
|
|
7
|
+
],
|
|
5
8
|
"license": "MIT",
|
|
6
9
|
"repository": {
|
|
7
10
|
"type": "git",
|
|
8
11
|
"url": "git+https://github.com/nesso-how/nesso.git",
|
|
9
12
|
"directory": "packages/plugin/example"
|
|
10
13
|
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"src",
|
|
17
|
+
"tsconfig.json",
|
|
18
|
+
"vite.config.ts"
|
|
19
|
+
],
|
|
11
20
|
"type": "module",
|
|
12
|
-
"
|
|
13
|
-
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public",
|
|
23
|
+
"registry": "https://registry.npmjs.org/"
|
|
24
|
+
},
|
|
14
25
|
"scripts": {
|
|
15
26
|
"check": "tsc",
|
|
16
|
-
"build": "npm run check &&
|
|
27
|
+
"build": "npm run check && vite build",
|
|
17
28
|
"prepack": "npm run build"
|
|
18
29
|
},
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@nesso-how/ui": "1.0.0-beta.1",
|
|
32
|
+
"react": "^19.2.8",
|
|
33
|
+
"react-dom": "^19.2.8"
|
|
22
34
|
},
|
|
23
35
|
"devDependencies": {
|
|
24
|
-
"@nesso-how/plugin": "0.
|
|
25
|
-
"
|
|
26
|
-
"
|
|
36
|
+
"@nesso-how/plugin": "0.6.0",
|
|
37
|
+
"@types/react": "^19.2.18",
|
|
38
|
+
"@types/react-dom": "^19.2.7",
|
|
39
|
+
"typescript": "~7.0.2",
|
|
40
|
+
"vite": "^8.3.0",
|
|
41
|
+
"vite-plugin-css-injected-by-js": "^5.0.3"
|
|
42
|
+
},
|
|
43
|
+
"i18n": {
|
|
44
|
+
"metadata": {
|
|
45
|
+
"name": {
|
|
46
|
+
"en": "Plugin Example"
|
|
47
|
+
},
|
|
48
|
+
"description": {
|
|
49
|
+
"en": "Learn how to build Nesso plugins with the SDK and plugin APIs."
|
|
50
|
+
},
|
|
51
|
+
"documentation": {
|
|
52
|
+
"en": "A reference plugin for developers, with practical examples of using Nesso's SDK and plugin APIs to define actions, interact with graph data, and build custom interfaces."
|
|
53
|
+
}
|
|
54
|
+
}
|
|
27
55
|
},
|
|
28
56
|
"nesso": {
|
|
29
57
|
"apiVersion": 1,
|
|
30
58
|
"kind": "actions",
|
|
31
59
|
"entry": "dist/index.js",
|
|
32
|
-
"writes": [
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
"documentation": { "en": "Changes the labels of concepts in the invoked view in one undoable transaction. Concepts shared with other views change there too." }
|
|
40
|
-
}
|
|
60
|
+
"writes": [
|
|
61
|
+
"concept.label"
|
|
62
|
+
],
|
|
63
|
+
"capabilities": [
|
|
64
|
+
"ui",
|
|
65
|
+
"storage"
|
|
66
|
+
]
|
|
41
67
|
}
|
|
42
68
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
.quiz {
|
|
2
|
+
display: grid;
|
|
3
|
+
min-height: 100dvh;
|
|
4
|
+
place-items: center;
|
|
5
|
+
padding: 24px;
|
|
6
|
+
color: var(--foreground);
|
|
7
|
+
font:
|
|
8
|
+
13px/1.5 var(--font-sans),
|
|
9
|
+
system-ui,
|
|
10
|
+
sans-serif;
|
|
11
|
+
}
|
|
12
|
+
.quiz-card {
|
|
13
|
+
width: 100%;
|
|
14
|
+
max-width: 560px;
|
|
15
|
+
overflow-wrap: anywhere;
|
|
16
|
+
text-align: center;
|
|
17
|
+
}
|
|
18
|
+
.quiz h1 {
|
|
19
|
+
margin: 0 0 4px;
|
|
20
|
+
font-size: 20px;
|
|
21
|
+
font-weight: 500;
|
|
22
|
+
}
|
|
23
|
+
.quiz [data-step] {
|
|
24
|
+
margin: 0 0 16px;
|
|
25
|
+
color: var(--muted-foreground);
|
|
26
|
+
}
|
|
27
|
+
.quiz [data-question] {
|
|
28
|
+
margin: 0;
|
|
29
|
+
color: var(--muted-foreground);
|
|
30
|
+
}
|
|
31
|
+
.quiz [data-answer] {
|
|
32
|
+
min-height: 1.5em;
|
|
33
|
+
margin: 16px 0;
|
|
34
|
+
font-size: 18px;
|
|
35
|
+
}
|
|
36
|
+
.quiz [data-result] {
|
|
37
|
+
width: fit-content;
|
|
38
|
+
margin: 8px auto 24px;
|
|
39
|
+
padding: 16px 24px;
|
|
40
|
+
border: 1px solid var(--border);
|
|
41
|
+
border-radius: 12px;
|
|
42
|
+
background: var(--muted);
|
|
43
|
+
font-size: 18px;
|
|
44
|
+
font-weight: 500;
|
|
45
|
+
}
|
|
46
|
+
.quiz footer {
|
|
47
|
+
display: flex;
|
|
48
|
+
justify-content: center;
|
|
49
|
+
gap: 8px;
|
|
50
|
+
}
|