@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.
@@ -1,6 +1,6 @@
1
1
  import { ZodType, z } from "zod";
2
2
  import { ComponentType } from "react";
3
- //#region ../errors/src/index.d.ts
3
+ //#region ../errors/dist/index.d.ts
4
4
  type ErrorIssue = {
5
5
  path: string;
6
6
  message: string;
@@ -11,99 +11,47 @@ declare class NessoError extends Error {
11
11
  constructor(issues: ErrorIssue[]);
12
12
  }
13
13
  //#endregion
14
- //#region ../schema/src/types.d.ts
15
- type Position = {
16
- x: number;
17
- y: number;
18
- };
19
- type Concept = {
20
- id: string;
21
- label: string;
22
- description?: string;
23
- color?: string;
24
- bold?: boolean;
25
- italic?: boolean;
26
- position: Position;
27
- };
28
- type RelationType = {
29
- id: string;
30
- label: string;
31
- };
32
- type Relation = {
33
- source: string;
34
- predicate: string;
35
- target: string;
36
- };
37
- type Graph = {
38
- concepts: Concept[];
39
- relationTypes: RelationType[];
40
- relations: Relation[];
41
- };
42
- //#endregion
43
- //#region ../i18n/src/locale.d.ts
44
- declare const locales: readonly ['en', 'it', 'zh-CN'];
45
- type Locale = typeof locales[number];
46
- //#endregion
47
- //#region src/definitions.d.ts
48
- 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'];
49
- declare const themeDefinition: z.ZodObject<{
50
- id: z.ZodString;
51
- colors: z.ZodObject<{
52
- background: z.ZodString;
53
- border: z.ZodString;
54
- canvas: z.ZodString;
55
- edge: z.ZodString;
56
- foreground: z.ZodString;
57
- handle: z.ZodString;
58
- hover: z.ZodString;
59
- muted: z.ZodString;
60
- "muted-foreground": z.ZodString;
61
- "node-border": z.ZodString;
62
- pressed: z.ZodString;
63
- primary: z.ZodString;
64
- "primary-foreground": z.ZodString;
65
- "primary-hover": z.ZodString;
66
- ring: z.ZodString;
67
- "selection-halo": z.ZodString;
68
- sidebar: z.ZodString;
69
- }, z.core.$strict>;
70
- metrics: z.ZodObject<{
71
- 'radius-control': z.ZodNumber;
72
- 'radius-object': z.ZodNumber;
73
- 'duration-state': z.ZodNumber;
74
- }, z.core.$strict>;
75
- fonts: z.ZodObject<{
76
- sans: z.ZodObject<{
77
- faces: z.ZodArray<z.ZodObject<{
78
- path: z.ZodString;
79
- weight: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
80
- style: z.ZodEnum<{
81
- italic: "italic";
82
- normal: "normal";
83
- }>;
84
- unicodeRange: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
85
- }, z.core.$strict>>;
86
- }, z.core.$strict>;
87
- mono: z.ZodObject<{
88
- faces: z.ZodArray<z.ZodObject<{
89
- path: z.ZodString;
90
- weight: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
91
- style: z.ZodEnum<{
92
- italic: "italic";
93
- normal: "normal";
94
- }>;
95
- unicodeRange: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
96
- }, 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;
97
34
  }, z.core.$strict>;
98
- }, 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>>;
99
45
  }, z.core.$strict>;
100
- type ThemeDefinition = DeepReadonly<z.infer<typeof themeDefinition>>;
101
- type Definition = ThemeDefinition | VocabDefinition;
102
- declare function parseDefinition(kind: 'theme', value: unknown): ThemeDefinition;
103
- declare function parseDefinition(kind: 'vocab', value: unknown): VocabDefinition;
104
- 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>;
105
49
  //#endregion
106
- //#region src/types.d.ts
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
107
55
  type DeepReadonly<T> = T extends readonly (infer U)[] ? readonly DeepReadonly<U>[] : T extends object ? { readonly [K in keyof T]: DeepReadonly<T[K]>; } : T;
108
56
  type Selection = readonly {
109
57
  readonly kind: 'concept' | 'relation';
@@ -115,7 +63,7 @@ type NessoOperation = {
115
63
  readonly id: string;
116
64
  readonly value: string;
117
65
  } | {
118
- readonly kind: 'concept.description';
66
+ readonly kind: 'concept.notes';
119
67
  readonly id: string;
120
68
  readonly value: string;
121
69
  } | {
@@ -229,7 +177,9 @@ type NessoOperation = {
229
177
  };
230
178
  type VocabDefinition = {
231
179
  readonly id: string;
232
- readonly relationTypes: readonly Readonly<RelationType>[];
180
+ readonly relationTypes: readonly (Readonly<RelationType> & {
181
+ readonly translations?: Readonly<Partial<Record<Locale, string>>>;
182
+ })[];
233
183
  readonly defaultTypeId: string;
234
184
  };
235
185
  type SavedView = {
@@ -256,6 +206,9 @@ type SectionId = 'sidebar' | 'sidebar.pinned-views' | 'sidebar.views' | 'inspect
256
206
  type Preferences = {
257
207
  readonly locale?: Locale;
258
208
  readonly introSeen?: boolean;
209
+ readonly mcpEnabled?: boolean;
210
+ readonly disabledBundledActionPlugins?: readonly string[];
211
+ readonly canvasTabOrder?: readonly string[];
259
212
  readonly activeVocabId: string;
260
213
  readonly activeRendererId: string;
261
214
  readonly activeThemeId: string;
@@ -288,7 +241,7 @@ type NessoStore = {
288
241
  readonly position: Readonly<Position>;
289
242
  }[], historyGroup?: string) => void;
290
243
  readonly setConceptLabel: (id: string, label: string, historyGroup?: string) => void;
291
- readonly setConceptDescription: (id: string, description: string, historyGroup?: string) => void;
244
+ readonly setConceptNotes: (id: string, notes: string, historyGroup?: string) => void;
292
245
  readonly setConceptColor: (id: string, color: string, historyGroup?: string) => void;
293
246
  readonly setConceptBold: (id: string, value: boolean, historyGroup?: string) => void;
294
247
  readonly setConceptItalic: (id: string, value: boolean, historyGroup?: string) => void;
@@ -318,24 +271,69 @@ type NessoStore = {
318
271
  readonly deleteView: (id: string) => void;
319
272
  readonly getViewGraph: (id: string) => GraphSnapshot;
320
273
  };
321
- type NotificationAction = {
322
- readonly label: string;
323
- readonly onClick: () => void;
324
- };
325
- type Notification = {
326
- readonly title: string;
327
- readonly description?: string;
328
- } & ({
329
- readonly tone: 'info' | 'warning';
330
- } | {
331
- readonly tone: 'confirmation';
332
- readonly action: NotificationAction;
333
- readonly cancelAction: NotificationAction;
334
- });
335
- type Notifications = {
336
- readonly notify: (notification: Notification) => string;
337
- readonly dismiss: (id: string) => void;
338
- };
274
+ //#endregion
275
+ //#region ../core/dist/commands.d.ts
276
+ type WriteMethods = Omit<NessoStore, 'getState' | 'subscribe' | 'getViewGraph' | 'conceptPlacementOffset' | 'applyOperations' | 'setViewport' | 'setActiveRenderer' | 'resetGraph'>;
277
+ 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; };
278
+ //#endregion
279
+ //#region src/definitions.d.ts
280
+ 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'];
281
+ declare const themeDefinition: z.ZodObject<{
282
+ id: z.ZodString;
283
+ colors: z.ZodObject<{
284
+ background: z.ZodString;
285
+ border: z.ZodString;
286
+ canvas: z.ZodString;
287
+ edge: z.ZodString;
288
+ foreground: z.ZodString;
289
+ handle: z.ZodString;
290
+ hover: z.ZodString;
291
+ muted: z.ZodString;
292
+ "muted-foreground": z.ZodString;
293
+ "node-border": z.ZodString;
294
+ pressed: z.ZodString;
295
+ primary: z.ZodString;
296
+ "primary-foreground": z.ZodString;
297
+ "primary-hover": z.ZodString;
298
+ ring: z.ZodString;
299
+ "selection-halo": z.ZodString;
300
+ sidebar: z.ZodString;
301
+ }, z.core.$strict>;
302
+ metrics: z.ZodObject<{
303
+ 'radius-control': z.ZodNumber;
304
+ 'radius-object': z.ZodNumber;
305
+ 'duration-state': z.ZodNumber;
306
+ }, z.core.$strict>;
307
+ fonts: z.ZodObject<{
308
+ sans: z.ZodObject<{
309
+ faces: z.ZodArray<z.ZodObject<{
310
+ path: z.ZodString;
311
+ weight: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
312
+ style: z.ZodEnum<{
313
+ italic: "italic";
314
+ normal: "normal";
315
+ }>;
316
+ unicodeRange: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
317
+ }, z.core.$strict>>;
318
+ }, z.core.$strict>;
319
+ mono: z.ZodObject<{
320
+ faces: z.ZodArray<z.ZodObject<{
321
+ path: z.ZodString;
322
+ weight: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
323
+ style: z.ZodEnum<{
324
+ italic: "italic";
325
+ normal: "normal";
326
+ }>;
327
+ unicodeRange: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
328
+ }, z.core.$strict>>;
329
+ }, z.core.$strict>;
330
+ }, z.core.$strict>;
331
+ }, z.core.$strict>;
332
+ type ThemeDefinition = DeepReadonly<z.infer<typeof themeDefinition>>;
333
+ type Definition = ThemeDefinition | VocabDefinition;
334
+ declare function parseDefinition(kind: 'theme', value: unknown): ThemeDefinition;
335
+ declare function parseDefinition(kind: 'vocab', value: unknown): VocabDefinition;
336
+ declare function parseDefinition(kind: 'theme' | 'vocab', value: unknown): Definition;
339
337
  //#endregion
340
338
  //#region src/i18n.d.ts
341
339
  type LocalizedText = Readonly<{
@@ -352,9 +350,17 @@ declare class PluginError extends NessoError {
352
350
  }
353
351
  declare function parseOrThrow(schema: ZodType, value: unknown, prefix?: string): any;
354
352
  //#endregion
355
- //#region src/commands.d.ts
356
- type WriteMethods = Omit<NessoStore, 'getState' | 'subscribe' | 'getViewGraph' | 'conceptPlacementOffset' | 'applyOperations' | 'setViewport' | 'setActiveRenderer' | 'resetGraph'>;
357
- 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; };
353
+ //#region src/images.d.ts
354
+ declare const imageRenderOptions: z.ZodObject<{
355
+ format: z.ZodLiteral<"png">;
356
+ scale: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<4>]>>;
357
+ }, z.core.$strict>;
358
+ declare const renderedImage: z.ZodObject<{
359
+ mediaType: z.ZodLiteral<"image/png">;
360
+ base64: z.ZodString;
361
+ }, z.core.$strict>;
362
+ type ImageRenderOptions = Readonly<z.infer<typeof imageRenderOptions>>;
363
+ type RenderedImage = Readonly<z.infer<typeof renderedImage>>;
358
364
  //#endregion
359
365
  //#region src/files.d.ts
360
366
  declare const fileTextLimit: number;
@@ -362,11 +368,15 @@ declare const fileOpenOptions: z.ZodObject<{
362
368
  extensions: z.ZodArray<z.ZodString>;
363
369
  mimeTypes: z.ZodArray<z.ZodString>;
364
370
  }, z.core.$strict>;
365
- declare const fileSaveOptions: z.ZodObject<{
371
+ declare const fileSaveOptions: z.ZodUnion<readonly [z.ZodObject<{
366
372
  name: z.ZodString;
367
373
  mediaType: z.ZodString;
368
374
  text: z.ZodString;
369
- }, z.core.$strict>;
375
+ }, z.core.$strict>, z.ZodObject<{
376
+ name: z.ZodString;
377
+ mediaType: z.ZodString;
378
+ base64: z.ZodString;
379
+ }, z.core.$strict>]>;
370
380
  declare const fileOpenResult: z.ZodNullable<z.ZodObject<{
371
381
  name: z.ZodString;
372
382
  mediaType: z.ZodString;
@@ -389,13 +399,32 @@ declare const pluginStorageLimits: {
389
399
  type JsonValue = null | string | number | boolean | readonly JsonValue[] | {
390
400
  readonly [key: string]: JsonValue;
391
401
  };
402
+ declare const pluginStorageScope: z.ZodDiscriminatedUnion<[z.ZodObject<{
403
+ kind: z.ZodLiteral<"concept">;
404
+ id: z.ZodString;
405
+ }, z.core.$strict>, z.ZodObject<{
406
+ kind: z.ZodLiteral<"view">;
407
+ id: z.ZodString;
408
+ }, z.core.$strict>], "kind">;
392
409
  declare const pluginStorageKey: z.ZodObject<{
393
410
  key: z.ZodString;
394
- conceptId: z.ZodOptional<z.ZodString>;
411
+ scope: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
412
+ kind: z.ZodLiteral<"concept">;
413
+ id: z.ZodString;
414
+ }, z.core.$strict>, z.ZodObject<{
415
+ kind: z.ZodLiteral<"view">;
416
+ id: z.ZodString;
417
+ }, z.core.$strict>], "kind">>;
395
418
  }, z.core.$strict>;
396
419
  declare const pluginStorageRecord: z.ZodObject<{
397
420
  key: z.ZodString;
398
- conceptId: z.ZodOptional<z.ZodString>;
421
+ scope: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
422
+ kind: z.ZodLiteral<"concept">;
423
+ id: z.ZodString;
424
+ }, z.core.$strict>, z.ZodObject<{
425
+ kind: z.ZodLiteral<"view">;
426
+ id: z.ZodString;
427
+ }, z.core.$strict>], "kind">>;
399
428
  value: z.ZodPipe<z.ZodCustom<JsonValue, JsonValue>, z.ZodTransform<string | number | boolean | readonly JsonValue[] | {
400
429
  readonly [key: string]: JsonValue;
401
430
  } | null, JsonValue>>;
@@ -404,7 +433,13 @@ declare const pluginStorageSnapshot: z.ZodObject<{
404
433
  revision: z.ZodNumber;
405
434
  records: z.ZodArray<z.ZodObject<{
406
435
  key: z.ZodString;
407
- conceptId: z.ZodOptional<z.ZodString>;
436
+ scope: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
437
+ kind: z.ZodLiteral<"concept">;
438
+ id: z.ZodString;
439
+ }, z.core.$strict>, z.ZodObject<{
440
+ kind: z.ZodLiteral<"view">;
441
+ id: z.ZodString;
442
+ }, z.core.$strict>], "kind">>;
408
443
  value: z.ZodPipe<z.ZodCustom<JsonValue, JsonValue>, z.ZodTransform<string | number | boolean | readonly JsonValue[] | {
409
444
  readonly [key: string]: JsonValue;
410
445
  } | null, JsonValue>>;
@@ -412,10 +447,11 @@ declare const pluginStorageSnapshot: z.ZodObject<{
412
447
  }, z.core.$strict>;
413
448
  type PluginStorageRecord = DeepReadonly<z.infer<typeof pluginStorageRecord>>;
414
449
  type PluginStorageKey = DeepReadonly<z.infer<typeof pluginStorageKey>>;
450
+ type PluginStorageScope = DeepReadonly<z.infer<typeof pluginStorageScope>>;
415
451
  type PluginStorage = {
416
452
  readonly list: () => Promise<readonly PluginStorageRecord[]>;
417
- readonly set: (key: string, value: PluginStorageRecord['value'], conceptId?: string) => Promise<boolean>;
418
- readonly delete: (key: string, conceptId?: string) => Promise<boolean>;
453
+ readonly set: (key: string, value: PluginStorageRecord['value'], scope?: PluginStorageScope) => Promise<boolean>;
454
+ readonly delete: (key: string, scope?: PluginStorageScope) => Promise<boolean>;
419
455
  };
420
456
  declare function parsePluginStorageSnapshot(value: unknown): DeepReadonly<z.infer<typeof pluginStorageSnapshot>>;
421
457
  declare function parsePluginStorageRecord(value: unknown): PluginStorageRecord;
@@ -424,6 +460,9 @@ declare function parsePluginStorageKey(value: unknown): PluginStorageKey;
424
460
  //#region src/data.d.ts
425
461
  declare function checkMessageSize(value: unknown, limit: number, maximumDepth?: number): void;
426
462
  //#endregion
463
+ //#region src/theme-fonts.d.ts
464
+ declare const fontFaces: (ranges: Record<string, string>, stem: string, weight: [number, number]) => ThemeDefinition['fonts']['sans'];
465
+ //#endregion
427
466
  //#region src/runtime.d.ts
428
467
  declare const runtimeLimits: {
429
468
  readonly request: number;
@@ -435,6 +474,24 @@ declare const runtimeLimits: {
435
474
  readonly action: 120000;
436
475
  readonly heartbeat: 15000;
437
476
  };
477
+ declare const badgeLimits: {
478
+ readonly value: 999999;
479
+ readonly execution: 2000;
480
+ readonly refresh: 15000;
481
+ readonly rate: 1000;
482
+ };
483
+ declare const actionBadgeResult: z.ZodObject<{
484
+ value: z.ZodNullable<z.ZodNumber>;
485
+ refreshAt: z.ZodOptional<z.ZodNumber>;
486
+ }, z.core.$strict>;
487
+ type ActionBadgeInput = {
488
+ readonly viewId: string | null;
489
+ readonly viewGraph: GraphSnapshot;
490
+ readonly records: readonly PluginStorageRecord[];
491
+ readonly now: number;
492
+ };
493
+ type ActionBadgeResult = DeepReadonly<z.infer<typeof actionBadgeResult>>;
494
+ declare const parseActionBadgeResult: (value: unknown) => ActionBadgeResult;
438
495
  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"];
439
496
  declare const metadata: z.ZodObject<{
440
497
  name: z.ZodObject<{
@@ -459,16 +516,16 @@ type PluginI18n = DeepReadonly<{
459
516
  }>;
460
517
  declare function parsePluginI18n(value: unknown): PluginI18n;
461
518
  declare const manifest: z.ZodDiscriminatedUnion<[z.ZodObject<{
462
- apiVersion: z.ZodLiteral<1>;
519
+ apiVersion: z.ZodLiteral<2>;
463
520
  kind: z.ZodLiteral<"actions">;
464
521
  entry: z.ZodString;
465
522
  writes: z.ZodArray<z.ZodEnum<{
466
523
  "concept.add": "concept.add";
467
524
  "concept.bold": "concept.bold";
468
525
  "concept.color": "concept.color";
469
- "concept.description": "concept.description";
470
526
  "concept.italic": "concept.italic";
471
527
  "concept.label": "concept.label";
528
+ "concept.notes": "concept.notes";
472
529
  "concept.position": "concept.position";
473
530
  "concept.positions": "concept.positions";
474
531
  "concept.remove": "concept.remove";
@@ -482,12 +539,13 @@ declare const manifest: z.ZodDiscriminatedUnion<[z.ZodObject<{
482
539
  }>>;
483
540
  capabilities: z.ZodArray<z.ZodEnum<{
484
541
  files: "files";
542
+ images: "images";
485
543
  notifications: "notifications";
486
544
  storage: "storage";
487
545
  ui: "ui";
488
546
  }>>;
489
547
  }, z.core.$strict>, ...z.ZodObject<{
490
- apiVersion: z.ZodLiteral<1>;
548
+ apiVersion: z.ZodLiteral<2>;
491
549
  kind: z.ZodLiteral<"theme" | "vocab">;
492
550
  entry: z.ZodString;
493
551
  writes: z.ZodTuple<[], null>;
@@ -506,7 +564,7 @@ declare const message: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject
506
564
  id: z.ZodString;
507
565
  value: z.ZodString;
508
566
  }, z.core.$strict>, z.ZodObject<{
509
- kind: z.ZodLiteral<"concept.description">;
567
+ kind: z.ZodLiteral<"concept.notes">;
510
568
  id: z.ZodString;
511
569
  value: z.ZodString;
512
570
  }, z.core.$strict>, z.ZodObject<{
@@ -665,7 +723,13 @@ declare const message: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject
665
723
  method: z.ZodLiteral<"storage.set">;
666
724
  params: z.ZodObject<{
667
725
  key: z.ZodString;
668
- conceptId: z.ZodOptional<z.ZodString>;
726
+ scope: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
727
+ kind: z.ZodLiteral<"concept">;
728
+ id: z.ZodString;
729
+ }, z.core.$strict>, z.ZodObject<{
730
+ kind: z.ZodLiteral<"view">;
731
+ id: z.ZodString;
732
+ }, z.core.$strict>], "kind">>;
669
733
  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 | {
670
734
  readonly [key: string]: string | number | boolean | /*elided*/ any | /*elided*/ any | null;
671
735
  } | null)[] | {
@@ -772,7 +836,13 @@ declare const message: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject
772
836
  method: z.ZodLiteral<"storage.delete">;
773
837
  params: z.ZodObject<{
774
838
  key: z.ZodString;
775
- conceptId: z.ZodOptional<z.ZodString>;
839
+ scope: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
840
+ kind: z.ZodLiteral<"concept">;
841
+ id: z.ZodString;
842
+ }, z.core.$strict>, z.ZodObject<{
843
+ kind: z.ZodLiteral<"view">;
844
+ id: z.ZodString;
845
+ }, z.core.$strict>], "kind">>;
776
846
  revision: z.ZodNumber;
777
847
  }, z.core.$strict>;
778
848
  }, z.core.$strict>, z.ZodObject<{
@@ -810,10 +880,23 @@ declare const message: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject
810
880
  id: z.ZodNumber;
811
881
  contextId: z.ZodString;
812
882
  method: z.ZodLiteral<"files.save">;
813
- params: z.ZodObject<{
883
+ params: z.ZodUnion<readonly [z.ZodObject<{
814
884
  name: z.ZodString;
815
885
  mediaType: z.ZodString;
816
886
  text: z.ZodString;
887
+ }, z.core.$strict>, z.ZodObject<{
888
+ name: z.ZodString;
889
+ mediaType: z.ZodString;
890
+ base64: z.ZodString;
891
+ }, z.core.$strict>]>;
892
+ }, z.core.$strict>, z.ZodObject<{
893
+ type: z.ZodLiteral<"request">;
894
+ id: z.ZodNumber;
895
+ contextId: z.ZodString;
896
+ method: z.ZodLiteral<"images.renderView">;
897
+ params: z.ZodObject<{
898
+ format: z.ZodLiteral<"png">;
899
+ scale: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<4>]>>;
817
900
  }, z.core.$strict>;
818
901
  }, z.core.$strict>], "method">, z.ZodObject<{
819
902
  type: z.ZodLiteral<"panel-ready">;
@@ -823,6 +906,12 @@ declare const message: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject
823
906
  }, z.core.$strict>, z.ZodObject<{
824
907
  type: z.ZodLiteral<"contribution">;
825
908
  value: z.ZodUnknown;
909
+ }, z.core.$strict>, z.ZodObject<{
910
+ type: z.ZodLiteral<"badge-result">;
911
+ value: z.ZodObject<{
912
+ value: z.ZodNullable<z.ZodNumber>;
913
+ refreshAt: z.ZodOptional<z.ZodNumber>;
914
+ }, z.core.$strict>;
826
915
  }, z.core.$strict>, z.ZodObject<{
827
916
  type: z.ZodLiteral<"close">;
828
917
  reason: z.ZodString;
@@ -864,11 +953,14 @@ declare const actionDescriptor: z.ZodObject<{
864
953
  }, z.core.$strict>;
865
954
  icon: z.ZodOptional<z.ZodString>;
866
955
  ui: z.ZodOptional<z.ZodLiteral<true>>;
956
+ badge: z.ZodOptional<z.ZodLiteral<true>>;
867
957
  }, z.core.$strict>;
868
- 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'];
869
- type ActionIconName = typeof actionIconNames[number];
958
+ 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'];
959
+ type ActionIconName = (typeof actionIconNames)[number];
870
960
  type ActionDescriptor = DeepReadonly<z.infer<typeof actionDescriptor>>;
871
- type ActionContribution = Omit<ActionDescriptor, 'ui'> & ({
961
+ type ActionContribution = Omit<ActionDescriptor, 'ui' | 'badge'> & {
962
+ readonly badge?: (input: ActionBadgeInput) => ActionBadgeResult | Promise<ActionBadgeResult>;
963
+ } & ({
872
964
  readonly ui: ComponentType<ActionContext>;
873
965
  readonly run?: never;
874
966
  } | {
@@ -928,6 +1020,9 @@ type ActionContext = {
928
1020
  }>;
929
1021
  };
930
1022
  readonly storage: PluginStorage;
1023
+ readonly images: {
1024
+ readonly renderView: (options: ImageRenderOptions) => Promise<RenderedImage>;
1025
+ };
931
1026
  readonly signal: AbortSignal;
932
1027
  };
933
1028
  declare function parsePluginMessage(value: unknown): z.infer<typeof message>;
@@ -938,4 +1033,4 @@ declare function createPluginClient(port: MessagePort, initial: unknown): {
938
1033
  getPresentation: () => Pick<ActionState, 'theme' | 'locale'>;
939
1034
  };
940
1035
  //#endregion
941
- export { themeColors as $, createWriteCommands as A, NotificationAction as B, parsePluginStorageSnapshot as C, FileSaveOptions as D, FileOpenResult as E, GraphSnapshot as F, SectionId as G, PanelSizes as H, NessoOperation as I, VocabDefinition as J, Selection as K, NessoState as L, parseOrThrow as M, LocalizedText as N, fileTextLimit as O, resolvePluginText as P, parseDefinition as Q, NessoStore as R, parsePluginStorageRecord as S, FileOpenOptions as T, Preferences as U, Notifications as V, SavedView as W, Definition as X, WorkspaceState as Y, ThemeDefinition as Z, checkMessageSize as _, ActionState as a, PluginStorageRecord as b, actionIconNames as c, parsePluginI18n as d, parsePluginManifest as f, themeTokens as g, sha256Hex as h, ActionIconName as i, PluginError as j, parseFileOptions as k, createPluginClient as l, runtimeLimits as m, ActionContribution as n, PluginI18n as o, parsePluginMessage as p, Viewport as q, ActionDescriptor as r, PluginManifest as s, ActionContext as t, parseContribution as u, PluginStorage as v, pluginStorageLimits as w, parsePluginStorageKey as x, PluginStorageKey as y, Notification as z };
1036
+ export { pluginStorageLimits as A, LocalizedText as B, PluginStorage as C, parsePluginStorageKey as D, PluginStorageScope as E, parseFileOptions as F, themeColors as G, Definition as H, ImageRenderOptions as I, SavedView as J, GraphSnapshot as K, RenderedImage as L, FileOpenResult as M, FileSaveOptions as N, parsePluginStorageRecord as O, fileTextLimit as P, PluginError as R, checkMessageSize as S, PluginStorageRecord as T, ThemeDefinition as U, resolvePluginText as V, parseDefinition as W, VocabDefinition as X, Selection as Y, 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, FileOpenOptions as j, parsePluginStorageSnapshot as k, PluginManifest as l, parseContribution as m, ActionBadgeResult as n, ActionIconName as o, parseActionBadgeResult as p, NessoOperation 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, parseOrThrow as z };
package/dist/runtime.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { $ as themeColors, C as parsePluginStorageSnapshot, D as FileSaveOptions, E as FileOpenResult, M as parseOrThrow, N as LocalizedText, O as fileTextLimit, P as resolvePluginText, Q as parseDefinition, S as parsePluginStorageRecord, T as FileOpenOptions, X as Definition, _ as checkMessageSize, a as ActionState, c as actionIconNames, d as parsePluginI18n, f as parsePluginManifest, g as themeTokens, h as sha256Hex, i as ActionIconName, j as PluginError, k as parseFileOptions, l as createPluginClient, m as runtimeLimits, n as ActionContribution, o as PluginI18n, p as parsePluginMessage, r as ActionDescriptor, s as PluginManifest, t as ActionContext, u as parseContribution, w as pluginStorageLimits, x as parsePluginStorageKey } from "./runtime-D4jO7tbm.js";
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 pluginStorageLimits, B as LocalizedText, D as parsePluginStorageKey, F as parseFileOptions, G as themeColors, H as Definition, I as ImageRenderOptions, L as RenderedImage, M as FileOpenResult, N as FileSaveOptions, O as parsePluginStorageRecord, P as fileTextLimit, R as PluginError, S as checkMessageSize, V as resolvePluginText, W 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 FileOpenOptions, k as parsePluginStorageSnapshot, 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 parseOrThrow } from "./runtime-DGDBGkWs.js";
2
+ export { ActionBadgeInput, ActionBadgeResult, ActionContext, ActionContribution, ActionDescriptor, ActionIconName, ActionState, type Definition, type FileOpenOptions, type FileOpenResult, type FileSaveOptions, type ImageRenderOptions, type LocalizedText, PluginError, PluginI18n, PluginManifest, type RenderedImage, 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 { x as PluginError, t as actionIconNames, m as checkMessageSize, n as createPluginClient, g as fileTextLimit, r as parseContribution, v as parseDefinition, _ as parseFileOptions, S as parseOrThrow, i as parsePluginI18n, a as parsePluginManifest, o as parsePluginMessage, u as parsePluginStorageKey, d as parsePluginStorageRecord, f as parsePluginStorageSnapshot, p as pluginStorageLimits, h as resolvePluginText, s as runtimeLimits, c as sha256Hex, y as themeColors, l as themeTokens } from "./runtime-CJPU4o4h.js";
1
+ export { C as PluginError, t as actionIconNames, n as badgeLimits, _ as checkMessageSize, r as createPluginClient, x as fileTextLimit, f as fontFaces, i as parseActionBadgeResult, a as parseContribution, y as parseDefinition, S 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, b as themeColors, d as themeTokens } from "./runtime-D6GosMdU.js";
package/example/README.md CHANGED
@@ -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
- { manifest, files: [{ path: manifest.nesso.entry, bytes: new TextEncoder().encode(compiledCode) }] },
32
- 'en'
31
+ {
32
+ manifest,
33
+ files: [{ path: manifest.nesso.entry, bytes: new TextEncoder().encode(compiledCode) }],
34
+ },
35
+ 'en',
33
36
  )
34
37
  ```
35
38