@nesso-how/plugin 1.0.0-beta.23 → 1.0.0-beta.25
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 +37 -34
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/node/index.d.ts +1 -1
- package/dist/node/runtime.d.ts +33 -28
- package/dist/node/runtime.js +25 -23
- package/dist/node/storage.d.ts +4 -4
- package/dist/node/storage.js +1 -1
- package/dist/package.d.ts +1 -1
- package/dist/package.js +1 -1
- package/dist/{runtime-BXlQ2vrU.js → runtime-BGO97h75.js} +86 -55
- package/dist/{runtime-BgIX6ayx.d.ts → runtime-C_IkTCNf.d.ts} +86 -59
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +1 -1
- package/example/README.md +3 -3
- package/example/package.json +4 -4
- package/example/src/Quiz.tsx +4 -4
- package/example/src/index.ts +1 -1
- package/package.json +1 -1
|
@@ -40,7 +40,7 @@ declare const presentationSchema: z.ZodObject<{
|
|
|
40
40
|
italic: z.ZodOptional<z.ZodBoolean>;
|
|
41
41
|
strikethrough: z.ZodOptional<z.ZodBoolean>;
|
|
42
42
|
}, z.core.$strict>;
|
|
43
|
-
declare const
|
|
43
|
+
declare const conceptMapMemberSchema: z.ZodObject<{
|
|
44
44
|
position: z.ZodObject<{
|
|
45
45
|
x: z.ZodNumber;
|
|
46
46
|
y: z.ZodNumber;
|
|
@@ -64,6 +64,17 @@ declare const relationTypeSchema: z.ZodObject<{
|
|
|
64
64
|
id: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
65
65
|
label: z.ZodString;
|
|
66
66
|
}, z.core.$strict>;
|
|
67
|
+
declare const relationSchema: z.ZodObject<{
|
|
68
|
+
source: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
69
|
+
predicate: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
70
|
+
target: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
71
|
+
}, z.core.$strict>;
|
|
72
|
+
declare const relationBendSchema: z.ZodObject<{
|
|
73
|
+
source: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
74
|
+
predicate: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
75
|
+
target: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
76
|
+
bend: z.ZodNumber;
|
|
77
|
+
}, z.core.$strict>;
|
|
67
78
|
declare const graphSchema: z.ZodObject<{
|
|
68
79
|
concepts: z.ZodArray<z.ZodObject<{
|
|
69
80
|
id: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
@@ -83,8 +94,10 @@ declare const graphSchema: z.ZodObject<{
|
|
|
83
94
|
type Position = z.infer<typeof positionSchema>;
|
|
84
95
|
type Concept = z.infer<typeof conceptSchema>;
|
|
85
96
|
type Presentation = z.infer<typeof presentationSchema>;
|
|
86
|
-
type
|
|
97
|
+
type ConceptMapMember = z.infer<typeof conceptMapMemberSchema>;
|
|
87
98
|
type RelationType = z.infer<typeof relationTypeSchema>;
|
|
99
|
+
type Relation = z.infer<typeof relationSchema>;
|
|
100
|
+
type RelationBend = z.infer<typeof relationBendSchema>;
|
|
88
101
|
type Graph = z.infer<typeof graphSchema>;
|
|
89
102
|
//#endregion
|
|
90
103
|
//#region ../i18n/dist/locale.d.ts
|
|
@@ -98,8 +111,11 @@ type Selection = readonly {
|
|
|
98
111
|
readonly id: string;
|
|
99
112
|
}[];
|
|
100
113
|
type GraphSnapshot = DeepReadonly<Graph>;
|
|
101
|
-
type
|
|
114
|
+
type MapGraphSnapshot = DeepReadonly<Omit<Graph, 'concepts' | 'relations'> & {
|
|
102
115
|
concepts: (Concept & Partial<Presentation>)[];
|
|
116
|
+
relations: (Relation & {
|
|
117
|
+
bend?: number;
|
|
118
|
+
})[];
|
|
103
119
|
}>;
|
|
104
120
|
type NessoOperation = {
|
|
105
121
|
readonly kind: 'concept.label';
|
|
@@ -164,6 +180,10 @@ type NessoOperation = {
|
|
|
164
180
|
} | {
|
|
165
181
|
readonly kind: 'relation.remove';
|
|
166
182
|
readonly id: string;
|
|
183
|
+
} | {
|
|
184
|
+
readonly kind: 'relation.bend';
|
|
185
|
+
readonly id: string;
|
|
186
|
+
readonly value: number;
|
|
167
187
|
} | {
|
|
168
188
|
readonly kind: 'document.reset';
|
|
169
189
|
readonly id: string;
|
|
@@ -175,33 +195,33 @@ type NessoOperation = {
|
|
|
175
195
|
readonly kind: 'selection.set';
|
|
176
196
|
readonly value: Selection;
|
|
177
197
|
} | {
|
|
178
|
-
readonly kind: '
|
|
198
|
+
readonly kind: 'map.activate';
|
|
179
199
|
readonly id: string | null;
|
|
180
200
|
} | {
|
|
181
|
-
readonly kind: '
|
|
201
|
+
readonly kind: 'map.create';
|
|
182
202
|
readonly id: string;
|
|
183
203
|
readonly name: string;
|
|
184
204
|
readonly conceptIds: readonly string[];
|
|
185
205
|
} | {
|
|
186
|
-
readonly kind: '
|
|
206
|
+
readonly kind: 'map.rename';
|
|
187
207
|
readonly id: string;
|
|
188
208
|
readonly name: string;
|
|
189
209
|
} | {
|
|
190
|
-
readonly kind: '
|
|
210
|
+
readonly kind: 'map.pin';
|
|
191
211
|
readonly id: string;
|
|
192
212
|
readonly pinned: boolean;
|
|
193
213
|
} | {
|
|
194
|
-
readonly kind: '
|
|
195
|
-
readonly
|
|
214
|
+
readonly kind: 'map.membership';
|
|
215
|
+
readonly mapId: string;
|
|
196
216
|
readonly conceptId: string;
|
|
197
217
|
readonly included: boolean;
|
|
198
218
|
} | {
|
|
199
|
-
readonly kind: '
|
|
219
|
+
readonly kind: 'map.remove';
|
|
200
220
|
readonly id: string;
|
|
201
221
|
} | {
|
|
202
222
|
readonly kind: 'viewport.set';
|
|
203
223
|
readonly rendererId: string;
|
|
204
|
-
readonly
|
|
224
|
+
readonly mapId?: string | null;
|
|
205
225
|
readonly value: Viewport;
|
|
206
226
|
} | {
|
|
207
227
|
readonly kind: 'preferences.vocab';
|
|
@@ -233,10 +253,11 @@ type VocabDefinition = {
|
|
|
233
253
|
})[];
|
|
234
254
|
readonly defaultTypeId: string;
|
|
235
255
|
};
|
|
236
|
-
type
|
|
256
|
+
type WorkspaceMap = {
|
|
237
257
|
readonly id: string;
|
|
238
258
|
readonly name: string;
|
|
239
|
-
readonly members: readonly DeepReadonly<
|
|
259
|
+
readonly members: readonly DeepReadonly<ConceptMapMember>[];
|
|
260
|
+
readonly relationBends?: readonly DeepReadonly<RelationBend>[];
|
|
240
261
|
readonly pinned: boolean;
|
|
241
262
|
};
|
|
242
263
|
type Viewport = {
|
|
@@ -245,15 +266,15 @@ type Viewport = {
|
|
|
245
266
|
readonly zoom: number;
|
|
246
267
|
};
|
|
247
268
|
type WorkspaceState = {
|
|
248
|
-
readonly
|
|
249
|
-
readonly
|
|
269
|
+
readonly activeMapId: string | null;
|
|
270
|
+
readonly maps: readonly WorkspaceMap[];
|
|
250
271
|
readonly viewports: Readonly<Partial<Record<string, Viewport>>>;
|
|
251
272
|
};
|
|
252
273
|
type PanelSizes = {
|
|
253
274
|
readonly explorerWidth: number;
|
|
254
275
|
readonly inspectorWidth: number;
|
|
255
276
|
};
|
|
256
|
-
type SectionId = 'sidebar' | 'sidebar.pinned-
|
|
277
|
+
type SectionId = 'sidebar' | 'sidebar.pinned-maps' | 'sidebar.maps' | 'inspector' | 'inspector.connections' | 'inspector.maps' | 'inspector.nodes';
|
|
257
278
|
type Preferences = {
|
|
258
279
|
readonly locale?: Locale;
|
|
259
280
|
readonly introSeen?: boolean;
|
|
@@ -273,7 +294,7 @@ type NessoState = {
|
|
|
273
294
|
readonly graph: GraphSnapshot;
|
|
274
295
|
readonly workspace: WorkspaceState;
|
|
275
296
|
readonly preferences: Preferences;
|
|
276
|
-
readonly
|
|
297
|
+
readonly mapGraph: MapGraphSnapshot;
|
|
277
298
|
readonly selected: Selection;
|
|
278
299
|
readonly vocabs: readonly VocabDefinition[];
|
|
279
300
|
readonly history: {
|
|
@@ -286,8 +307,8 @@ type NessoStore = {
|
|
|
286
307
|
readonly subscribe: (listener: () => void) => () => void;
|
|
287
308
|
readonly conceptPlacementOffset: Readonly<Position>;
|
|
288
309
|
readonly setSelection: (selection: Selection) => void;
|
|
289
|
-
readonly
|
|
290
|
-
readonly setViewport: (rendererId: string, viewport: Viewport,
|
|
310
|
+
readonly setMap: (id: string | null) => void;
|
|
311
|
+
readonly setViewport: (rendererId: string, viewport: Viewport, mapId?: string | null) => void;
|
|
291
312
|
readonly setConceptPosition: (id: string, position: Readonly<Position>, historyGroup?: string) => void;
|
|
292
313
|
readonly setConceptPositions: (updates: readonly {
|
|
293
314
|
readonly id: string;
|
|
@@ -306,6 +327,7 @@ type NessoStore = {
|
|
|
306
327
|
readonly createRelationType: (id: string, label: string) => void;
|
|
307
328
|
readonly removeConcept: (id: string) => void;
|
|
308
329
|
readonly removeRelation: (id: string) => void;
|
|
330
|
+
readonly setRelationBend: (id: string, value: number, historyGroup?: string) => void;
|
|
309
331
|
readonly applyOperations: (operations: readonly NessoOperation[], options?: {
|
|
310
332
|
readonly historyGroup?: string;
|
|
311
333
|
}) => void;
|
|
@@ -318,17 +340,17 @@ type NessoStore = {
|
|
|
318
340
|
readonly setPanelSizes: (sizes: PanelSizes) => void;
|
|
319
341
|
readonly setSectionOpen: (id: SectionId, open: boolean) => void;
|
|
320
342
|
readonly resetGraph: () => void;
|
|
321
|
-
readonly
|
|
322
|
-
readonly
|
|
323
|
-
readonly
|
|
324
|
-
readonly
|
|
325
|
-
readonly
|
|
326
|
-
readonly
|
|
343
|
+
readonly createMap: (name: string, conceptIds: readonly string[]) => string;
|
|
344
|
+
readonly renameMap: (id: string, name: string) => void;
|
|
345
|
+
readonly setMapPinned: (id: string, pinned: boolean) => void;
|
|
346
|
+
readonly setMapMembership: (mapId: string, conceptId: string, included: boolean) => void;
|
|
347
|
+
readonly deleteMap: (id: string) => void;
|
|
348
|
+
readonly getMapGraph: (id: string) => MapGraphSnapshot;
|
|
327
349
|
};
|
|
328
350
|
//#endregion
|
|
329
351
|
//#region ../core/dist/commands.d.ts
|
|
330
|
-
type WriteMethods = Omit<NessoStore, 'getState' | 'subscribe' | '
|
|
331
|
-
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' | '
|
|
352
|
+
type WriteMethods = Omit<NessoStore, 'getState' | 'subscribe' | 'getMapGraph' | 'conceptPlacementOffset' | 'applyOperations' | 'setViewport' | 'setActiveRenderer' | 'resetGraph'>;
|
|
353
|
+
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' | 'createMap' ? Created : Commit; };
|
|
332
354
|
//#endregion
|
|
333
355
|
//#region ../core/dist/vocab.d.ts
|
|
334
356
|
declare function resolveRelationTypeLabel(type: Readonly<RelationType>, vocabs: readonly VocabDefinition[], locale: Locale): string;
|
|
@@ -477,7 +499,7 @@ declare const pluginStorageScope: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
477
499
|
kind: z.ZodLiteral<"concept">;
|
|
478
500
|
id: z.ZodString;
|
|
479
501
|
}, z.core.$strict>, z.ZodObject<{
|
|
480
|
-
kind: z.ZodLiteral<"
|
|
502
|
+
kind: z.ZodLiteral<"map">;
|
|
481
503
|
id: z.ZodString;
|
|
482
504
|
}, z.core.$strict>], "kind">;
|
|
483
505
|
declare const pluginStorageKey: z.ZodObject<{
|
|
@@ -486,7 +508,7 @@ declare const pluginStorageKey: z.ZodObject<{
|
|
|
486
508
|
kind: z.ZodLiteral<"concept">;
|
|
487
509
|
id: z.ZodString;
|
|
488
510
|
}, z.core.$strict>, z.ZodObject<{
|
|
489
|
-
kind: z.ZodLiteral<"
|
|
511
|
+
kind: z.ZodLiteral<"map">;
|
|
490
512
|
id: z.ZodString;
|
|
491
513
|
}, z.core.$strict>], "kind">>;
|
|
492
514
|
}, z.core.$strict>;
|
|
@@ -496,7 +518,7 @@ declare const pluginStorageRecord: z.ZodObject<{
|
|
|
496
518
|
kind: z.ZodLiteral<"concept">;
|
|
497
519
|
id: z.ZodString;
|
|
498
520
|
}, z.core.$strict>, z.ZodObject<{
|
|
499
|
-
kind: z.ZodLiteral<"
|
|
521
|
+
kind: z.ZodLiteral<"map">;
|
|
500
522
|
id: z.ZodString;
|
|
501
523
|
}, z.core.$strict>], "kind">>;
|
|
502
524
|
value: z.ZodPipe<z.ZodCustom<JsonValue, JsonValue>, z.ZodTransform<string | number | boolean | readonly JsonValue[] | {
|
|
@@ -511,7 +533,7 @@ declare const pluginStorageSnapshot: z.ZodObject<{
|
|
|
511
533
|
kind: z.ZodLiteral<"concept">;
|
|
512
534
|
id: z.ZodString;
|
|
513
535
|
}, z.core.$strict>, z.ZodObject<{
|
|
514
|
-
kind: z.ZodLiteral<"
|
|
536
|
+
kind: z.ZodLiteral<"map">;
|
|
515
537
|
id: z.ZodString;
|
|
516
538
|
}, z.core.$strict>], "kind">>;
|
|
517
539
|
value: z.ZodPipe<z.ZodCustom<JsonValue, JsonValue>, z.ZodTransform<string | number | boolean | readonly JsonValue[] | {
|
|
@@ -556,8 +578,8 @@ declare const actionBadgeResult: z.ZodObject<{
|
|
|
556
578
|
refreshAt: z.ZodOptional<z.ZodNumber>;
|
|
557
579
|
}, z.core.$strict>;
|
|
558
580
|
type ActionBadgeInput = {
|
|
559
|
-
readonly
|
|
560
|
-
readonly
|
|
581
|
+
readonly mapId: string | null;
|
|
582
|
+
readonly mapGraph: MapGraphSnapshot;
|
|
561
583
|
readonly records: readonly PluginStorageRecord[];
|
|
562
584
|
readonly now: number;
|
|
563
585
|
};
|
|
@@ -586,9 +608,9 @@ type PluginI18n = DeepReadonly<{
|
|
|
586
608
|
[key: string]: LocalizedText | z.infer<typeof metadata>;
|
|
587
609
|
}>;
|
|
588
610
|
declare function parsePluginI18n(value: unknown): PluginI18n;
|
|
589
|
-
declare const pluginApiVersion =
|
|
611
|
+
declare const pluginApiVersion = 7;
|
|
590
612
|
declare const manifest: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
591
|
-
apiVersion: z.ZodLiteral<
|
|
613
|
+
apiVersion: z.ZodLiteral<7>;
|
|
592
614
|
kind: z.ZodLiteral<"actions">;
|
|
593
615
|
entry: z.ZodString;
|
|
594
616
|
writes: z.ZodArray<z.ZodEnum<{
|
|
@@ -602,14 +624,15 @@ declare const manifest: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
602
624
|
"concept.positions": "concept.positions";
|
|
603
625
|
"concept.remove": "concept.remove";
|
|
604
626
|
"concept.strikethrough": "concept.strikethrough";
|
|
627
|
+
"map.create": "map.create";
|
|
628
|
+
"map.membership": "map.membership";
|
|
629
|
+
"relation.bend": "relation.bend";
|
|
605
630
|
"relation.connect": "relation.connect";
|
|
606
631
|
"relation.reconnect": "relation.reconnect";
|
|
607
632
|
"relation.remove": "relation.remove";
|
|
608
633
|
"relation.type": "relation.type";
|
|
609
634
|
"relation.type.create": "relation.type.create";
|
|
610
635
|
"selection.set": "selection.set";
|
|
611
|
-
"view.create": "view.create";
|
|
612
|
-
"view.membership": "view.membership";
|
|
613
636
|
}>>;
|
|
614
637
|
capabilities: z.ZodArray<z.ZodEnum<{
|
|
615
638
|
files: "files";
|
|
@@ -619,7 +642,7 @@ declare const manifest: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
619
642
|
ui: "ui";
|
|
620
643
|
}>>;
|
|
621
644
|
}, z.core.$strict>, ...z.ZodObject<{
|
|
622
|
-
apiVersion: z.ZodLiteral<
|
|
645
|
+
apiVersion: z.ZodLiteral<7>;
|
|
623
646
|
kind: z.ZodLiteral<"theme" | "vocab">;
|
|
624
647
|
entry: z.ZodString;
|
|
625
648
|
writes: z.ZodTuple<[], null>;
|
|
@@ -708,6 +731,10 @@ declare const message: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
708
731
|
}, z.core.$strict>, z.ZodObject<{
|
|
709
732
|
kind: z.ZodLiteral<"relation.remove">;
|
|
710
733
|
id: z.ZodString;
|
|
734
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
735
|
+
kind: z.ZodLiteral<"relation.bend">;
|
|
736
|
+
id: z.ZodString;
|
|
737
|
+
value: z.ZodNumber;
|
|
711
738
|
}, z.core.$strict>, z.ZodObject<{
|
|
712
739
|
kind: z.ZodLiteral<"document.reset">;
|
|
713
740
|
id: z.ZodString;
|
|
@@ -725,28 +752,28 @@ declare const message: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
725
752
|
id: z.ZodString;
|
|
726
753
|
}, z.core.$strict>>;
|
|
727
754
|
}, z.core.$strict>, z.ZodObject<{
|
|
728
|
-
kind: z.ZodLiteral<"
|
|
755
|
+
kind: z.ZodLiteral<"map.activate">;
|
|
729
756
|
id: z.ZodNullable<z.ZodString>;
|
|
730
757
|
}, z.core.$strict>, z.ZodObject<{
|
|
731
|
-
kind: z.ZodLiteral<"
|
|
758
|
+
kind: z.ZodLiteral<"map.create">;
|
|
732
759
|
id: z.ZodString;
|
|
733
760
|
name: z.ZodString;
|
|
734
761
|
conceptIds: z.ZodArray<z.ZodString>;
|
|
735
762
|
}, z.core.$strict>, z.ZodObject<{
|
|
736
|
-
kind: z.ZodLiteral<"
|
|
763
|
+
kind: z.ZodLiteral<"map.rename">;
|
|
737
764
|
id: z.ZodString;
|
|
738
765
|
name: z.ZodString;
|
|
739
766
|
}, z.core.$strict>, z.ZodObject<{
|
|
740
|
-
kind: z.ZodLiteral<"
|
|
767
|
+
kind: z.ZodLiteral<"map.pin">;
|
|
741
768
|
id: z.ZodString;
|
|
742
769
|
pinned: z.ZodBoolean;
|
|
743
770
|
}, z.core.$strict>, z.ZodObject<{
|
|
744
|
-
kind: z.ZodLiteral<"
|
|
745
|
-
|
|
771
|
+
kind: z.ZodLiteral<"map.membership">;
|
|
772
|
+
mapId: z.ZodString;
|
|
746
773
|
conceptId: z.ZodString;
|
|
747
774
|
included: z.ZodBoolean;
|
|
748
775
|
}, z.core.$strict>, z.ZodObject<{
|
|
749
|
-
kind: z.ZodLiteral<"
|
|
776
|
+
kind: z.ZodLiteral<"map.remove">;
|
|
750
777
|
id: z.ZodString;
|
|
751
778
|
}, z.core.$strict>, ...z.ZodObject<{
|
|
752
779
|
kind: z.ZodLiteral<"preferences.theme" | "preferences.vocab">;
|
|
@@ -769,11 +796,11 @@ declare const message: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
769
796
|
id: z.ZodEnum<{
|
|
770
797
|
inspector: "inspector";
|
|
771
798
|
"inspector.connections": "inspector.connections";
|
|
799
|
+
"inspector.maps": "inspector.maps";
|
|
772
800
|
"inspector.nodes": "inspector.nodes";
|
|
773
|
-
"inspector.views": "inspector.views";
|
|
774
801
|
sidebar: "sidebar";
|
|
775
|
-
"sidebar.
|
|
776
|
-
"sidebar.
|
|
802
|
+
"sidebar.maps": "sidebar.maps";
|
|
803
|
+
"sidebar.pinned-maps": "sidebar.pinned-maps";
|
|
777
804
|
}>;
|
|
778
805
|
open: z.ZodBoolean;
|
|
779
806
|
}, z.core.$strict>], "kind">>;
|
|
@@ -805,7 +832,7 @@ declare const message: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
805
832
|
kind: z.ZodLiteral<"concept">;
|
|
806
833
|
id: z.ZodString;
|
|
807
834
|
}, z.core.$strict>, z.ZodObject<{
|
|
808
|
-
kind: z.ZodLiteral<"
|
|
835
|
+
kind: z.ZodLiteral<"map">;
|
|
809
836
|
id: z.ZodString;
|
|
810
837
|
}, z.core.$strict>], "kind">>;
|
|
811
838
|
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 | {
|
|
@@ -918,7 +945,7 @@ declare const message: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
918
945
|
kind: z.ZodLiteral<"concept">;
|
|
919
946
|
id: z.ZodString;
|
|
920
947
|
}, z.core.$strict>, z.ZodObject<{
|
|
921
|
-
kind: z.ZodLiteral<"
|
|
948
|
+
kind: z.ZodLiteral<"map">;
|
|
922
949
|
id: z.ZodString;
|
|
923
950
|
}, z.core.$strict>], "kind">>;
|
|
924
951
|
revision: z.ZodNumber;
|
|
@@ -971,7 +998,7 @@ declare const message: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
971
998
|
type: z.ZodLiteral<"request">;
|
|
972
999
|
id: z.ZodNumber;
|
|
973
1000
|
contextId: z.ZodString;
|
|
974
|
-
method: z.ZodLiteral<"images.
|
|
1001
|
+
method: z.ZodLiteral<"images.renderCanvas">;
|
|
975
1002
|
params: z.ZodObject<{
|
|
976
1003
|
format: z.ZodLiteral<"png">;
|
|
977
1004
|
scale: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<4>]>>;
|
|
@@ -1057,13 +1084,13 @@ type ActionState = {
|
|
|
1057
1084
|
x: number;
|
|
1058
1085
|
y: number;
|
|
1059
1086
|
}>;
|
|
1060
|
-
readonly
|
|
1087
|
+
readonly mapGraph: MapGraphSnapshot;
|
|
1061
1088
|
readonly selected: Selection;
|
|
1062
1089
|
readonly workspace: {
|
|
1063
|
-
readonly
|
|
1064
|
-
readonly
|
|
1090
|
+
readonly activeMapId: string | null;
|
|
1091
|
+
readonly maps: readonly Pick<WorkspaceMap, 'id' | 'name' | 'pinned'>[];
|
|
1065
1092
|
};
|
|
1066
|
-
readonly
|
|
1093
|
+
readonly targetMapId: string | null;
|
|
1067
1094
|
readonly activeVocab: VocabDefinition | null;
|
|
1068
1095
|
readonly history: {
|
|
1069
1096
|
readonly canUndo: boolean;
|
|
@@ -1073,9 +1100,9 @@ type ActionState = {
|
|
|
1073
1100
|
type WriteOptions = {
|
|
1074
1101
|
readonly historyGroup?: string;
|
|
1075
1102
|
};
|
|
1076
|
-
type PluginWrites = Omit<ReturnType<typeof createWriteCommands<Promise<void>, Promise<string>>>, 'undo' | 'redo' | '
|
|
1103
|
+
type PluginWrites = Omit<ReturnType<typeof createWriteCommands<Promise<void>, Promise<string>>>, 'undo' | 'redo' | 'setMap' | 'setActiveVocab' | 'setActiveTheme' | 'setLocale' | 'setPanelSizes' | 'setSectionOpen' | 'createMap' | 'renameMap' | 'setMapPinned' | 'deleteMap'>;
|
|
1077
1104
|
type ActionContext = {
|
|
1078
|
-
readonly
|
|
1105
|
+
readonly mapId: string | null;
|
|
1079
1106
|
readonly document: PluginWrites & {
|
|
1080
1107
|
readonly getState: () => ActionState;
|
|
1081
1108
|
readonly subscribe: (listener: () => void) => () => void;
|
|
@@ -1100,7 +1127,7 @@ type ActionContext = {
|
|
|
1100
1127
|
};
|
|
1101
1128
|
readonly storage: PluginStorage;
|
|
1102
1129
|
readonly images: {
|
|
1103
|
-
readonly
|
|
1130
|
+
readonly renderCanvas: (options: ImageRenderOptions) => Promise<RenderedImage>;
|
|
1104
1131
|
};
|
|
1105
1132
|
readonly signal: AbortSignal;
|
|
1106
1133
|
};
|
|
@@ -1112,4 +1139,4 @@ declare function createPluginClient(port: MessagePort, initial: unknown): {
|
|
|
1112
1139
|
getPresentation: () => Pick<ActionState, 'theme' | 'colorScheme' | 'locale'>;
|
|
1113
1140
|
};
|
|
1114
1141
|
//#endregion
|
|
1115
|
-
export {
|
|
1142
|
+
export { WorkspaceMap as $, pluginStorageLimits as A, LocalizedText as B, PluginStorage as C, parsePluginStorageKey as D, PluginStorageScope as E, parseFileOptions as F, parseDefinition as G, ColorScheme as H, ImageRenderOptions as I, GraphSnapshot as J, themeColors as K, RenderedImage as L, FileOpenResult as M, FileSaveOptions as N, parsePluginStorageRecord as O, fileTextLimit as P, VocabDefinition as Q, PluginError as R, checkMessageSize as S, PluginStorageRecord as T, Definition as U, resolvePluginText as V, ThemeDefinition as W, NessoOperation as X, MapGraphSnapshot as Y, Selection as Z, parsePluginMessage as _, ActionDescriptor as a, sha256Hex 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, resolveRelationTypeLabel as q, ActionContext as r, ActionState as s, ActionBadgeInput as t, actionIconNames as u, pluginApiVersion as v, PluginStorageKey as w, themeTokens as x, runtimeLimits as y, parseOrThrow as z };
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as pluginStorageLimits, B as LocalizedText, D as parsePluginStorageKey, F as parseFileOptions, G as parseDefinition, I as ImageRenderOptions, K as themeColors, L as RenderedImage, M as FileOpenResult, N as FileSaveOptions, O as parsePluginStorageRecord, P as fileTextLimit, R as PluginError, S as checkMessageSize, U as Definition, V as resolvePluginText, _ as parsePluginMessage, a as ActionDescriptor, b as sha256Hex, 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 pluginApiVersion, x as themeTokens, y as runtimeLimits, z as parseOrThrow } from "./runtime-
|
|
1
|
+
import { A as pluginStorageLimits, B as LocalizedText, D as parsePluginStorageKey, F as parseFileOptions, G as parseDefinition, I as ImageRenderOptions, K as themeColors, L as RenderedImage, M as FileOpenResult, N as FileSaveOptions, O as parsePluginStorageRecord, P as fileTextLimit, R as PluginError, S as checkMessageSize, U as Definition, V as resolvePluginText, _ as parsePluginMessage, a as ActionDescriptor, b as sha256Hex, 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 pluginApiVersion, x as themeTokens, y as runtimeLimits, z as parseOrThrow } from "./runtime-C_IkTCNf.js";
|
|
2
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, parseActionBadgeResult, parseContribution, parseDefinition, parseFileOptions, parseOrThrow, parsePluginI18n, parsePluginManifest, parsePluginMessage, parsePluginStorageKey, parsePluginStorageRecord, parsePluginStorageSnapshot, pluginApiVersion, pluginStorageLimits, resolvePluginText, runtimeLimits, sha256Hex, themeColors, themeTokens };
|
package/dist/runtime.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { C as PluginError, t as actionIconNames, n as badgeLimits, _ as checkMessageSize, r as createPluginClient, x as fileTextLimit, 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, l as pluginApiVersion, g as pluginStorageLimits, v as resolvePluginText, u as runtimeLimits, d as sha256Hex, b as themeColors, f as themeTokens } from "./runtime-
|
|
1
|
+
export { C as PluginError, t as actionIconNames, n as badgeLimits, _ as checkMessageSize, r as createPluginClient, x as fileTextLimit, 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, l as pluginApiVersion, g as pluginStorageLimits, v as resolvePluginText, u as runtimeLimits, d as sha256Hex, b as themeColors, f as themeTokens } from "./runtime-BGO97h75.js";
|
package/example/README.md
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Two actions built with the Nesso SDK:
|
|
4
4
|
|
|
5
|
-
- **Uppercase labels** changes concept labels in the current
|
|
6
|
-
- **Concept Quiz** uses React to quiz you on the
|
|
5
|
+
- **Uppercase labels** changes concept labels in the current map. See [`src/index.ts`](src/index.ts).
|
|
6
|
+
- **Concept Quiz** uses React to quiz you on the map's relations and saves your progress. See [`src/Quiz.tsx`](src/Quiz.tsx).
|
|
7
7
|
|
|
8
8
|
## Install and try
|
|
9
9
|
|
|
10
10
|
In the desktop app, open Settings → Plugins, search for `@nesso-how/plugin-example`, and install it. Approve access to concept labels, panels, and private storage.
|
|
11
11
|
|
|
12
|
-
Run either action from a
|
|
12
|
+
Run either action from a map's context menu in the Explorer, or from its actions in the Inspector with nothing selected.
|
|
13
13
|
|
|
14
14
|
## Build your own
|
|
15
15
|
|
package/example/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nesso-how/plugin-example",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.25",
|
|
4
4
|
"description": "Official example showing how to build Nesso plugins with the SDK and plugin APIs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nesso-plugin"
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
"prepack": "npm run build"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@nesso-how/ui": "1.0.0-beta.
|
|
31
|
+
"@nesso-how/ui": "1.0.0-beta.25",
|
|
32
32
|
"react": "^19.2.8",
|
|
33
33
|
"react-dom": "^19.2.8"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@nesso-how/plugin": "1.0.0-beta.
|
|
36
|
+
"@nesso-how/plugin": "1.0.0-beta.25",
|
|
37
37
|
"@types/react": "^19.2.18",
|
|
38
38
|
"@types/react-dom": "^19.2.7",
|
|
39
39
|
"typescript": "~7.0.2",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
"nesso": {
|
|
57
|
-
"apiVersion":
|
|
57
|
+
"apiVersion": 7,
|
|
58
58
|
"kind": "actions",
|
|
59
59
|
"entry": "dist/index.js",
|
|
60
60
|
"writes": [
|
package/example/src/Quiz.tsx
CHANGED
|
@@ -3,10 +3,10 @@ import { Button } from '@nesso-how/ui'
|
|
|
3
3
|
import type { ActionContext } from '@nesso-how/plugin'
|
|
4
4
|
import './Quiz.css'
|
|
5
5
|
|
|
6
|
-
export function Quiz({ document, storage,
|
|
6
|
+
export function Quiz({ document, storage, mapId }: ActionContext) {
|
|
7
7
|
const [step, setStep] = useState<number | null>(null)
|
|
8
8
|
const [revealed, setRevealed] = useState(false)
|
|
9
|
-
const key = `quiz:${
|
|
9
|
+
const key = `quiz:${mapId ?? 'all'}`
|
|
10
10
|
|
|
11
11
|
useEffect(() => {
|
|
12
12
|
void storage.list().then((records) => {
|
|
@@ -26,7 +26,7 @@ export function Quiz({ document, storage, viewId }: ActionContext) {
|
|
|
26
26
|
|
|
27
27
|
if (step === null) return null
|
|
28
28
|
|
|
29
|
-
const { concepts, relations, relationTypes } = document.getState().
|
|
29
|
+
const { concepts, relations, relationTypes } = document.getState().mapGraph
|
|
30
30
|
const relation = relations[step]
|
|
31
31
|
const relationType = relationTypes.find(({ id }) => id === relation?.predicate)
|
|
32
32
|
const conceptLabel = (id: string) => concepts.find((item) => item.id === id)?.label || id
|
|
@@ -50,7 +50,7 @@ export function Quiz({ document, storage, viewId }: ActionContext) {
|
|
|
50
50
|
</>
|
|
51
51
|
) : (
|
|
52
52
|
<p data-result role="status">
|
|
53
|
-
{relations.length ? 'Quiz complete!' : 'This
|
|
53
|
+
{relations.length ? 'Quiz complete!' : 'This map has no relations.'}
|
|
54
54
|
</p>
|
|
55
55
|
)}
|
|
56
56
|
<footer>
|
package/example/src/index.ts
CHANGED
|
@@ -8,7 +8,7 @@ export const create = (): readonly ActionContribution[] => {
|
|
|
8
8
|
run: async ({ document }) => {
|
|
9
9
|
const state = document.getState()
|
|
10
10
|
|
|
11
|
-
const operations: readonly NessoOperation[] = state.
|
|
11
|
+
const operations: readonly NessoOperation[] = state.mapGraph.concepts.map(
|
|
12
12
|
({ id, label }) => ({
|
|
13
13
|
kind: 'concept.label',
|
|
14
14
|
id,
|