@nesso-how/plugin 1.0.0-beta.24 → 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 +35 -35
- 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 +28 -28
- package/dist/node/runtime.js +23 -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-ZHRz4_y1.js → runtime-BGO97h75.js} +55 -54
- package/dist/{runtime-BrbkQ4Oi.d.ts → runtime-C_IkTCNf.d.ts} +59 -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
|
@@ -57,7 +57,7 @@ const presentationSchema = z.strictObject({
|
|
|
57
57
|
italic: z.boolean().optional(),
|
|
58
58
|
strikethrough: z.boolean().optional()
|
|
59
59
|
});
|
|
60
|
-
const
|
|
60
|
+
const conceptMapMemberSchema = presentationSchema.extend({ id: iriSchema });
|
|
61
61
|
const relationTypeSchema = z.strictObject({
|
|
62
62
|
id: iriSchema.refine((id) => !conceptKeys.includes(id), "Reserved concept property IRI"),
|
|
63
63
|
label: z.string()
|
|
@@ -68,10 +68,10 @@ const relationSchema = z.strictObject({
|
|
|
68
68
|
target: iriSchema
|
|
69
69
|
});
|
|
70
70
|
const relationBendSchema = relationSchema.extend({ bend: z.number().refine((value) => value !== 0, "Manual bend must be nonzero") }).refine((relation) => relation.source !== relation.target, "Self-relations cannot be bent");
|
|
71
|
-
const
|
|
71
|
+
const mapSchema = z.strictObject({
|
|
72
72
|
id: iriSchema,
|
|
73
73
|
name: z.string(),
|
|
74
|
-
members: z.array(
|
|
74
|
+
members: z.array(conceptMapMemberSchema),
|
|
75
75
|
relationBends: z.array(relationBendSchema).optional()
|
|
76
76
|
});
|
|
77
77
|
const graphShape = {
|
|
@@ -132,24 +132,24 @@ const checkReferences = (graph, context) => {
|
|
|
132
132
|
}
|
|
133
133
|
};
|
|
134
134
|
const graphSchema = z.strictObject(graphShape).superRefine(checkReferences);
|
|
135
|
-
const
|
|
135
|
+
const mapGraphSchema = z.strictObject({
|
|
136
136
|
...graphShape,
|
|
137
137
|
concepts: z.array(conceptSchema.extend(presentationSchema.partial().shape)),
|
|
138
138
|
relations: z.array(relationSchema.extend({ bend: z.number().optional() }))
|
|
139
139
|
}).superRefine(checkReferences);
|
|
140
|
-
const
|
|
140
|
+
const mapsSchema = (graph) => z.array(mapSchema).superRefine((maps, context) => {
|
|
141
141
|
const concepts = new Set(graph.concepts.map(({ id }) => id));
|
|
142
142
|
const relations = new Set(graph.relations.map(relationKey));
|
|
143
143
|
const taken = /* @__PURE__ */ new Set([...concepts, ...graph.relationTypes.map(({ id }) => id)]);
|
|
144
|
-
for (const [index,
|
|
145
|
-
if (taken.has(
|
|
144
|
+
for (const [index, map] of maps.entries()) {
|
|
145
|
+
if (taken.has(map.id)) context.addIssue({
|
|
146
146
|
code: "custom",
|
|
147
147
|
path: [index, "id"],
|
|
148
|
-
message: `Duplicate
|
|
148
|
+
message: `Duplicate map IRI: ${map.id}`
|
|
149
149
|
});
|
|
150
|
-
taken.add(
|
|
150
|
+
taken.add(map.id);
|
|
151
151
|
const members = /* @__PURE__ */ new Set();
|
|
152
|
-
for (const [position, member] of
|
|
152
|
+
for (const [position, member] of map.members.entries()) {
|
|
153
153
|
if (!concepts.has(member.id) || members.has(member.id)) context.addIssue({
|
|
154
154
|
code: "custom",
|
|
155
155
|
path: [
|
|
@@ -158,12 +158,12 @@ const viewsSchema = (graph) => z.array(viewSchema).superRefine((views, context)
|
|
|
158
158
|
position,
|
|
159
159
|
"id"
|
|
160
160
|
],
|
|
161
|
-
message: `${members.has(member.id) ? "Duplicate" : "Unknown"}
|
|
161
|
+
message: `${members.has(member.id) ? "Duplicate" : "Unknown"} map member: ${member.id}`
|
|
162
162
|
});
|
|
163
163
|
members.add(member.id);
|
|
164
164
|
}
|
|
165
165
|
const bends = /* @__PURE__ */ new Set();
|
|
166
|
-
for (const [position, relation] of (
|
|
166
|
+
for (const [position, relation] of (map.relationBends ?? []).entries()) {
|
|
167
167
|
const key = relationKey(relation);
|
|
168
168
|
if (bends.has(key) || !relations.has(key) || !members.has(relation.source) || !members.has(relation.target)) context.addIssue({
|
|
169
169
|
code: "custom",
|
|
@@ -188,19 +188,20 @@ const legacyDocument = z.strictObject({
|
|
|
188
188
|
presentationSchema.partial();
|
|
189
189
|
z.object({ schemaVersion: z.number().int().positive().optional() });
|
|
190
190
|
legacyDocument.extend({ schemaVersion: z.literal(1) });
|
|
191
|
+
legacyDocument.extend({ schemaVersion: z.literal(3) });
|
|
191
192
|
//#endregion
|
|
192
193
|
//#region ../schema/dist/validate.js
|
|
193
|
-
function validateGraph(graph,
|
|
194
|
+
function validateGraph(graph, maps = []) {
|
|
194
195
|
const result = graphSchema.safeParse(graph);
|
|
195
196
|
if (!result.success) return validationIssues(result.error.issues);
|
|
196
|
-
const
|
|
197
|
-
return
|
|
197
|
+
const mapResult = mapsSchema(result.data).safeParse(maps);
|
|
198
|
+
return mapResult.success ? [] : validationIssues(mapResult.error.issues, "maps");
|
|
198
199
|
}
|
|
199
200
|
//#endregion
|
|
200
201
|
//#region ../schema/dist/jsonld.js
|
|
201
202
|
const jsonObject = z.record(z.string(), z.unknown());
|
|
202
203
|
z.strictObject({
|
|
203
|
-
schemaVersion: z.literal(
|
|
204
|
+
schemaVersion: z.literal(4),
|
|
204
205
|
"@context": jsonObject,
|
|
205
206
|
"@graph": z.array(jsonObject)
|
|
206
207
|
});
|
|
@@ -216,7 +217,7 @@ z.object({
|
|
|
216
217
|
}).catchall(z.unknown());
|
|
217
218
|
z.strictObject({
|
|
218
219
|
"@id": iriSchema,
|
|
219
|
-
"@type": z.literal("
|
|
220
|
+
"@type": z.literal("Map"),
|
|
220
221
|
"rdfs:label": z.string(),
|
|
221
222
|
members: z.array(presentationSchema.extend({ concept: z.strictObject({ "@id": iriSchema }) })),
|
|
222
223
|
relationBends: z.array(relationBendSchema).optional()
|
|
@@ -231,8 +232,8 @@ function createWriteCommands(applyOperations, created) {
|
|
|
231
232
|
kind: "selection.set",
|
|
232
233
|
value
|
|
233
234
|
}]),
|
|
234
|
-
|
|
235
|
-
kind: "
|
|
235
|
+
setMap: (id) => applyOperations([{
|
|
236
|
+
kind: "map.activate",
|
|
236
237
|
id
|
|
237
238
|
}]),
|
|
238
239
|
setConceptPosition: (id, value, historyGroup) => applyOperations([{
|
|
@@ -338,33 +339,33 @@ function createWriteCommands(applyOperations, created) {
|
|
|
338
339
|
id,
|
|
339
340
|
open
|
|
340
341
|
}]),
|
|
341
|
-
|
|
342
|
+
createMap: (name, conceptIds) => {
|
|
342
343
|
const id = newIri();
|
|
343
344
|
return created(id, applyOperations([{
|
|
344
|
-
kind: "
|
|
345
|
+
kind: "map.create",
|
|
345
346
|
id,
|
|
346
347
|
name,
|
|
347
348
|
conceptIds
|
|
348
349
|
}]));
|
|
349
350
|
},
|
|
350
|
-
|
|
351
|
-
kind: "
|
|
351
|
+
renameMap: (id, name) => applyOperations([{
|
|
352
|
+
kind: "map.rename",
|
|
352
353
|
id,
|
|
353
354
|
name
|
|
354
355
|
}]),
|
|
355
|
-
|
|
356
|
-
kind: "
|
|
356
|
+
setMapPinned: (id, pinned) => applyOperations([{
|
|
357
|
+
kind: "map.pin",
|
|
357
358
|
id,
|
|
358
359
|
pinned
|
|
359
360
|
}]),
|
|
360
|
-
|
|
361
|
-
kind: "
|
|
362
|
-
|
|
361
|
+
setMapMembership: (mapId, conceptId, included) => applyOperations([{
|
|
362
|
+
kind: "map.membership",
|
|
363
|
+
mapId,
|
|
363
364
|
conceptId,
|
|
364
365
|
included
|
|
365
366
|
}]),
|
|
366
|
-
|
|
367
|
-
kind: "
|
|
367
|
+
deleteMap: (id) => applyOperations([{
|
|
368
|
+
kind: "map.remove",
|
|
368
369
|
id
|
|
369
370
|
}])
|
|
370
371
|
};
|
|
@@ -661,7 +662,7 @@ const pluginStorageScope = z.discriminatedUnion("kind", [z.strictObject({
|
|
|
661
662
|
kind: z.literal("concept"),
|
|
662
663
|
id: z.string().max(2048)
|
|
663
664
|
}), z.strictObject({
|
|
664
|
-
kind: z.literal("
|
|
665
|
+
kind: z.literal("map"),
|
|
665
666
|
id: z.string().max(2048)
|
|
666
667
|
})]);
|
|
667
668
|
const fields = {
|
|
@@ -840,33 +841,33 @@ const operation = z.discriminatedUnion("kind", [
|
|
|
840
841
|
value: selection
|
|
841
842
|
}),
|
|
842
843
|
z.strictObject({
|
|
843
|
-
kind: z.literal("
|
|
844
|
+
kind: z.literal("map.activate"),
|
|
844
845
|
id: id.nullable()
|
|
845
846
|
}),
|
|
846
847
|
z.strictObject({
|
|
847
|
-
kind: z.literal("
|
|
848
|
+
kind: z.literal("map.create"),
|
|
848
849
|
id,
|
|
849
850
|
name: z.string(),
|
|
850
851
|
conceptIds: z.array(id)
|
|
851
852
|
}),
|
|
852
853
|
z.strictObject({
|
|
853
|
-
kind: z.literal("
|
|
854
|
+
kind: z.literal("map.rename"),
|
|
854
855
|
id,
|
|
855
856
|
name: z.string()
|
|
856
857
|
}),
|
|
857
858
|
z.strictObject({
|
|
858
|
-
kind: z.literal("
|
|
859
|
+
kind: z.literal("map.pin"),
|
|
859
860
|
id,
|
|
860
861
|
pinned: z.boolean()
|
|
861
862
|
}),
|
|
862
863
|
z.strictObject({
|
|
863
|
-
kind: z.literal("
|
|
864
|
-
|
|
864
|
+
kind: z.literal("map.membership"),
|
|
865
|
+
mapId: id,
|
|
865
866
|
conceptId: id,
|
|
866
867
|
included: z.boolean()
|
|
867
868
|
}),
|
|
868
869
|
z.strictObject({
|
|
869
|
-
kind: z.literal("
|
|
870
|
+
kind: z.literal("map.remove"),
|
|
870
871
|
id
|
|
871
872
|
}),
|
|
872
873
|
...["vocab", "theme"].map((kind) => z.strictObject({
|
|
@@ -888,11 +889,11 @@ const operation = z.discriminatedUnion("kind", [
|
|
|
888
889
|
kind: z.literal("preferences.section"),
|
|
889
890
|
id: z.enum([
|
|
890
891
|
"sidebar",
|
|
891
|
-
"sidebar.pinned-
|
|
892
|
-
"sidebar.
|
|
892
|
+
"sidebar.pinned-maps",
|
|
893
|
+
"sidebar.maps",
|
|
893
894
|
"inspector",
|
|
894
895
|
"inspector.connections",
|
|
895
|
-
"inspector.
|
|
896
|
+
"inspector.maps",
|
|
896
897
|
"inspector.nodes"
|
|
897
898
|
]),
|
|
898
899
|
open: z.boolean()
|
|
@@ -909,8 +910,8 @@ function parsePluginI18n(value) {
|
|
|
909
910
|
checkMessageSize(value, 65536);
|
|
910
911
|
return parseOrThrow(pluginI18n, value, "i18n.");
|
|
911
912
|
}
|
|
912
|
-
const pluginApiVersion =
|
|
913
|
-
const manifestFields = { apiVersion: z.literal(
|
|
913
|
+
const pluginApiVersion = 7;
|
|
914
|
+
const manifestFields = { apiVersion: z.literal(7) };
|
|
914
915
|
const jsEntry = z.string().max(240).regex(/^(?:[\w-]+\/)*[\w-]+\.js$/);
|
|
915
916
|
const jsonEntry = z.string().max(240).regex(/^(?:[\w-]+\/)*[\w-]+\.json$/);
|
|
916
917
|
const operationDeclarations = z.array(z.enum([
|
|
@@ -931,8 +932,8 @@ const operationDeclarations = z.array(z.enum([
|
|
|
931
932
|
"relation.remove",
|
|
932
933
|
"relation.bend",
|
|
933
934
|
"selection.set",
|
|
934
|
-
"
|
|
935
|
-
"
|
|
935
|
+
"map.create",
|
|
936
|
+
"map.membership"
|
|
936
937
|
]));
|
|
937
938
|
const manifest = z.discriminatedUnion("kind", [z.strictObject({
|
|
938
939
|
...manifestFields,
|
|
@@ -1013,7 +1014,7 @@ const request = z.discriminatedUnion("method", [
|
|
|
1013
1014
|
}),
|
|
1014
1015
|
z.strictObject({
|
|
1015
1016
|
...envelope,
|
|
1016
|
-
method: z.literal("images.
|
|
1017
|
+
method: z.literal("images.renderCanvas"),
|
|
1017
1018
|
params: imageRenderOptions
|
|
1018
1019
|
})
|
|
1019
1020
|
]);
|
|
@@ -1098,9 +1099,9 @@ const actionStateSchema = z.strictObject({
|
|
|
1098
1099
|
theme: z.strictObject(Object.fromEntries(themeTokens.map((token) => [token, z.string().max(512).regex(/^[#\w\s.,()%/"'-]*$/)]))),
|
|
1099
1100
|
colorScheme: z.enum(colorSchemes),
|
|
1100
1101
|
conceptPlacementOffset: position,
|
|
1101
|
-
|
|
1102
|
+
mapGraph: mapGraphSchema,
|
|
1102
1103
|
selected: selection,
|
|
1103
|
-
|
|
1104
|
+
targetMapId: id.nullable(),
|
|
1104
1105
|
activeVocab: z.strictObject({
|
|
1105
1106
|
id,
|
|
1106
1107
|
relationTypes: z.array(vocabRelationType),
|
|
@@ -1111,8 +1112,8 @@ const actionStateSchema = z.strictObject({
|
|
|
1111
1112
|
canRedo: z.boolean()
|
|
1112
1113
|
}),
|
|
1113
1114
|
workspace: z.strictObject({
|
|
1114
|
-
|
|
1115
|
-
|
|
1115
|
+
activeMapId: id.nullable(),
|
|
1116
|
+
maps: z.array(z.strictObject({
|
|
1116
1117
|
id,
|
|
1117
1118
|
name: z.string(),
|
|
1118
1119
|
pinned: z.boolean()
|
|
@@ -1163,7 +1164,7 @@ const results = {
|
|
|
1163
1164
|
"notifications.notify": id,
|
|
1164
1165
|
"files.open": fileOpenResult,
|
|
1165
1166
|
"files.save": z.strictObject({ saved: z.boolean() }),
|
|
1166
|
-
"images.
|
|
1167
|
+
"images.renderCanvas": renderedImage
|
|
1167
1168
|
};
|
|
1168
1169
|
function parsePluginMessage(value) {
|
|
1169
1170
|
checkMessageSize(value, runtimeLimits.request);
|
|
@@ -1293,7 +1294,7 @@ function createPluginClient(port, initial) {
|
|
|
1293
1294
|
readRevision = Math.max(readRevision, result.revision);
|
|
1294
1295
|
return result;
|
|
1295
1296
|
};
|
|
1296
|
-
const { undo: _undo, redo: _redo,
|
|
1297
|
+
const { undo: _undo, redo: _redo, setMap: _map, setActiveVocab: _vocab, setActiveTheme: _theme, setLocale: _locale, setPanelSizes: _panels, setSectionOpen: _section, createMap: _createMap, renameMap: _renameMap, setMapPinned: _pin, deleteMap: _deleteMap, ...writes } = createWriteCommands(async (operations, options) => {
|
|
1297
1298
|
await applyOperations(operations, options);
|
|
1298
1299
|
}, async (id, committed) => {
|
|
1299
1300
|
await committed;
|
|
@@ -1315,7 +1316,7 @@ function createPluginClient(port, initial) {
|
|
|
1315
1316
|
};
|
|
1316
1317
|
return {
|
|
1317
1318
|
context: {
|
|
1318
|
-
|
|
1319
|
+
mapId: state.targetMapId,
|
|
1319
1320
|
document: {
|
|
1320
1321
|
...writes,
|
|
1321
1322
|
getState,
|
|
@@ -1330,7 +1331,7 @@ function createPluginClient(port, initial) {
|
|
|
1330
1331
|
applyOperations
|
|
1331
1332
|
},
|
|
1332
1333
|
notifications: { notify: (value) => call("notifications.notify", value) },
|
|
1333
|
-
images: {
|
|
1334
|
+
images: { renderCanvas: (options) => call("images.renderCanvas", options) },
|
|
1334
1335
|
files: {
|
|
1335
1336
|
open: (options) => call("files.open", options),
|
|
1336
1337
|
save: (options) => call("files.save", options)
|
|
@@ -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;
|
|
@@ -94,7 +94,7 @@ declare const graphSchema: z.ZodObject<{
|
|
|
94
94
|
type Position = z.infer<typeof positionSchema>;
|
|
95
95
|
type Concept = z.infer<typeof conceptSchema>;
|
|
96
96
|
type Presentation = z.infer<typeof presentationSchema>;
|
|
97
|
-
type
|
|
97
|
+
type ConceptMapMember = z.infer<typeof conceptMapMemberSchema>;
|
|
98
98
|
type RelationType = z.infer<typeof relationTypeSchema>;
|
|
99
99
|
type Relation = z.infer<typeof relationSchema>;
|
|
100
100
|
type RelationBend = z.infer<typeof relationBendSchema>;
|
|
@@ -111,7 +111,7 @@ type Selection = readonly {
|
|
|
111
111
|
readonly id: string;
|
|
112
112
|
}[];
|
|
113
113
|
type GraphSnapshot = DeepReadonly<Graph>;
|
|
114
|
-
type
|
|
114
|
+
type MapGraphSnapshot = DeepReadonly<Omit<Graph, 'concepts' | 'relations'> & {
|
|
115
115
|
concepts: (Concept & Partial<Presentation>)[];
|
|
116
116
|
relations: (Relation & {
|
|
117
117
|
bend?: number;
|
|
@@ -195,33 +195,33 @@ type NessoOperation = {
|
|
|
195
195
|
readonly kind: 'selection.set';
|
|
196
196
|
readonly value: Selection;
|
|
197
197
|
} | {
|
|
198
|
-
readonly kind: '
|
|
198
|
+
readonly kind: 'map.activate';
|
|
199
199
|
readonly id: string | null;
|
|
200
200
|
} | {
|
|
201
|
-
readonly kind: '
|
|
201
|
+
readonly kind: 'map.create';
|
|
202
202
|
readonly id: string;
|
|
203
203
|
readonly name: string;
|
|
204
204
|
readonly conceptIds: readonly string[];
|
|
205
205
|
} | {
|
|
206
|
-
readonly kind: '
|
|
206
|
+
readonly kind: 'map.rename';
|
|
207
207
|
readonly id: string;
|
|
208
208
|
readonly name: string;
|
|
209
209
|
} | {
|
|
210
|
-
readonly kind: '
|
|
210
|
+
readonly kind: 'map.pin';
|
|
211
211
|
readonly id: string;
|
|
212
212
|
readonly pinned: boolean;
|
|
213
213
|
} | {
|
|
214
|
-
readonly kind: '
|
|
215
|
-
readonly
|
|
214
|
+
readonly kind: 'map.membership';
|
|
215
|
+
readonly mapId: string;
|
|
216
216
|
readonly conceptId: string;
|
|
217
217
|
readonly included: boolean;
|
|
218
218
|
} | {
|
|
219
|
-
readonly kind: '
|
|
219
|
+
readonly kind: 'map.remove';
|
|
220
220
|
readonly id: string;
|
|
221
221
|
} | {
|
|
222
222
|
readonly kind: 'viewport.set';
|
|
223
223
|
readonly rendererId: string;
|
|
224
|
-
readonly
|
|
224
|
+
readonly mapId?: string | null;
|
|
225
225
|
readonly value: Viewport;
|
|
226
226
|
} | {
|
|
227
227
|
readonly kind: 'preferences.vocab';
|
|
@@ -253,10 +253,10 @@ type VocabDefinition = {
|
|
|
253
253
|
})[];
|
|
254
254
|
readonly defaultTypeId: string;
|
|
255
255
|
};
|
|
256
|
-
type
|
|
256
|
+
type WorkspaceMap = {
|
|
257
257
|
readonly id: string;
|
|
258
258
|
readonly name: string;
|
|
259
|
-
readonly members: readonly DeepReadonly<
|
|
259
|
+
readonly members: readonly DeepReadonly<ConceptMapMember>[];
|
|
260
260
|
readonly relationBends?: readonly DeepReadonly<RelationBend>[];
|
|
261
261
|
readonly pinned: boolean;
|
|
262
262
|
};
|
|
@@ -266,15 +266,15 @@ type Viewport = {
|
|
|
266
266
|
readonly zoom: number;
|
|
267
267
|
};
|
|
268
268
|
type WorkspaceState = {
|
|
269
|
-
readonly
|
|
270
|
-
readonly
|
|
269
|
+
readonly activeMapId: string | null;
|
|
270
|
+
readonly maps: readonly WorkspaceMap[];
|
|
271
271
|
readonly viewports: Readonly<Partial<Record<string, Viewport>>>;
|
|
272
272
|
};
|
|
273
273
|
type PanelSizes = {
|
|
274
274
|
readonly explorerWidth: number;
|
|
275
275
|
readonly inspectorWidth: number;
|
|
276
276
|
};
|
|
277
|
-
type SectionId = 'sidebar' | 'sidebar.pinned-
|
|
277
|
+
type SectionId = 'sidebar' | 'sidebar.pinned-maps' | 'sidebar.maps' | 'inspector' | 'inspector.connections' | 'inspector.maps' | 'inspector.nodes';
|
|
278
278
|
type Preferences = {
|
|
279
279
|
readonly locale?: Locale;
|
|
280
280
|
readonly introSeen?: boolean;
|
|
@@ -294,7 +294,7 @@ type NessoState = {
|
|
|
294
294
|
readonly graph: GraphSnapshot;
|
|
295
295
|
readonly workspace: WorkspaceState;
|
|
296
296
|
readonly preferences: Preferences;
|
|
297
|
-
readonly
|
|
297
|
+
readonly mapGraph: MapGraphSnapshot;
|
|
298
298
|
readonly selected: Selection;
|
|
299
299
|
readonly vocabs: readonly VocabDefinition[];
|
|
300
300
|
readonly history: {
|
|
@@ -307,8 +307,8 @@ type NessoStore = {
|
|
|
307
307
|
readonly subscribe: (listener: () => void) => () => void;
|
|
308
308
|
readonly conceptPlacementOffset: Readonly<Position>;
|
|
309
309
|
readonly setSelection: (selection: Selection) => void;
|
|
310
|
-
readonly
|
|
311
|
-
readonly setViewport: (rendererId: string, viewport: Viewport,
|
|
310
|
+
readonly setMap: (id: string | null) => void;
|
|
311
|
+
readonly setViewport: (rendererId: string, viewport: Viewport, mapId?: string | null) => void;
|
|
312
312
|
readonly setConceptPosition: (id: string, position: Readonly<Position>, historyGroup?: string) => void;
|
|
313
313
|
readonly setConceptPositions: (updates: readonly {
|
|
314
314
|
readonly id: string;
|
|
@@ -340,17 +340,17 @@ type NessoStore = {
|
|
|
340
340
|
readonly setPanelSizes: (sizes: PanelSizes) => void;
|
|
341
341
|
readonly setSectionOpen: (id: SectionId, open: boolean) => void;
|
|
342
342
|
readonly resetGraph: () => void;
|
|
343
|
-
readonly
|
|
344
|
-
readonly
|
|
345
|
-
readonly
|
|
346
|
-
readonly
|
|
347
|
-
readonly
|
|
348
|
-
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;
|
|
349
349
|
};
|
|
350
350
|
//#endregion
|
|
351
351
|
//#region ../core/dist/commands.d.ts
|
|
352
|
-
type WriteMethods = Omit<NessoStore, 'getState' | 'subscribe' | '
|
|
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' | '
|
|
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; };
|
|
354
354
|
//#endregion
|
|
355
355
|
//#region ../core/dist/vocab.d.ts
|
|
356
356
|
declare function resolveRelationTypeLabel(type: Readonly<RelationType>, vocabs: readonly VocabDefinition[], locale: Locale): string;
|
|
@@ -499,7 +499,7 @@ declare const pluginStorageScope: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
499
499
|
kind: z.ZodLiteral<"concept">;
|
|
500
500
|
id: z.ZodString;
|
|
501
501
|
}, z.core.$strict>, z.ZodObject<{
|
|
502
|
-
kind: z.ZodLiteral<"
|
|
502
|
+
kind: z.ZodLiteral<"map">;
|
|
503
503
|
id: z.ZodString;
|
|
504
504
|
}, z.core.$strict>], "kind">;
|
|
505
505
|
declare const pluginStorageKey: z.ZodObject<{
|
|
@@ -508,7 +508,7 @@ declare const pluginStorageKey: z.ZodObject<{
|
|
|
508
508
|
kind: z.ZodLiteral<"concept">;
|
|
509
509
|
id: z.ZodString;
|
|
510
510
|
}, z.core.$strict>, z.ZodObject<{
|
|
511
|
-
kind: z.ZodLiteral<"
|
|
511
|
+
kind: z.ZodLiteral<"map">;
|
|
512
512
|
id: z.ZodString;
|
|
513
513
|
}, z.core.$strict>], "kind">>;
|
|
514
514
|
}, z.core.$strict>;
|
|
@@ -518,7 +518,7 @@ declare const pluginStorageRecord: z.ZodObject<{
|
|
|
518
518
|
kind: z.ZodLiteral<"concept">;
|
|
519
519
|
id: z.ZodString;
|
|
520
520
|
}, z.core.$strict>, z.ZodObject<{
|
|
521
|
-
kind: z.ZodLiteral<"
|
|
521
|
+
kind: z.ZodLiteral<"map">;
|
|
522
522
|
id: z.ZodString;
|
|
523
523
|
}, z.core.$strict>], "kind">>;
|
|
524
524
|
value: z.ZodPipe<z.ZodCustom<JsonValue, JsonValue>, z.ZodTransform<string | number | boolean | readonly JsonValue[] | {
|
|
@@ -533,7 +533,7 @@ declare const pluginStorageSnapshot: z.ZodObject<{
|
|
|
533
533
|
kind: z.ZodLiteral<"concept">;
|
|
534
534
|
id: z.ZodString;
|
|
535
535
|
}, z.core.$strict>, z.ZodObject<{
|
|
536
|
-
kind: z.ZodLiteral<"
|
|
536
|
+
kind: z.ZodLiteral<"map">;
|
|
537
537
|
id: z.ZodString;
|
|
538
538
|
}, z.core.$strict>], "kind">>;
|
|
539
539
|
value: z.ZodPipe<z.ZodCustom<JsonValue, JsonValue>, z.ZodTransform<string | number | boolean | readonly JsonValue[] | {
|
|
@@ -578,8 +578,8 @@ declare const actionBadgeResult: z.ZodObject<{
|
|
|
578
578
|
refreshAt: z.ZodOptional<z.ZodNumber>;
|
|
579
579
|
}, z.core.$strict>;
|
|
580
580
|
type ActionBadgeInput = {
|
|
581
|
-
readonly
|
|
582
|
-
readonly
|
|
581
|
+
readonly mapId: string | null;
|
|
582
|
+
readonly mapGraph: MapGraphSnapshot;
|
|
583
583
|
readonly records: readonly PluginStorageRecord[];
|
|
584
584
|
readonly now: number;
|
|
585
585
|
};
|
|
@@ -608,9 +608,9 @@ type PluginI18n = DeepReadonly<{
|
|
|
608
608
|
[key: string]: LocalizedText | z.infer<typeof metadata>;
|
|
609
609
|
}>;
|
|
610
610
|
declare function parsePluginI18n(value: unknown): PluginI18n;
|
|
611
|
-
declare const pluginApiVersion =
|
|
611
|
+
declare const pluginApiVersion = 7;
|
|
612
612
|
declare const manifest: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
613
|
-
apiVersion: z.ZodLiteral<
|
|
613
|
+
apiVersion: z.ZodLiteral<7>;
|
|
614
614
|
kind: z.ZodLiteral<"actions">;
|
|
615
615
|
entry: z.ZodString;
|
|
616
616
|
writes: z.ZodArray<z.ZodEnum<{
|
|
@@ -624,6 +624,8 @@ declare const manifest: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
624
624
|
"concept.positions": "concept.positions";
|
|
625
625
|
"concept.remove": "concept.remove";
|
|
626
626
|
"concept.strikethrough": "concept.strikethrough";
|
|
627
|
+
"map.create": "map.create";
|
|
628
|
+
"map.membership": "map.membership";
|
|
627
629
|
"relation.bend": "relation.bend";
|
|
628
630
|
"relation.connect": "relation.connect";
|
|
629
631
|
"relation.reconnect": "relation.reconnect";
|
|
@@ -631,8 +633,6 @@ declare const manifest: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
631
633
|
"relation.type": "relation.type";
|
|
632
634
|
"relation.type.create": "relation.type.create";
|
|
633
635
|
"selection.set": "selection.set";
|
|
634
|
-
"view.create": "view.create";
|
|
635
|
-
"view.membership": "view.membership";
|
|
636
636
|
}>>;
|
|
637
637
|
capabilities: z.ZodArray<z.ZodEnum<{
|
|
638
638
|
files: "files";
|
|
@@ -642,7 +642,7 @@ declare const manifest: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
642
642
|
ui: "ui";
|
|
643
643
|
}>>;
|
|
644
644
|
}, z.core.$strict>, ...z.ZodObject<{
|
|
645
|
-
apiVersion: z.ZodLiteral<
|
|
645
|
+
apiVersion: z.ZodLiteral<7>;
|
|
646
646
|
kind: z.ZodLiteral<"theme" | "vocab">;
|
|
647
647
|
entry: z.ZodString;
|
|
648
648
|
writes: z.ZodTuple<[], null>;
|
|
@@ -752,28 +752,28 @@ declare const message: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
752
752
|
id: z.ZodString;
|
|
753
753
|
}, z.core.$strict>>;
|
|
754
754
|
}, z.core.$strict>, z.ZodObject<{
|
|
755
|
-
kind: z.ZodLiteral<"
|
|
755
|
+
kind: z.ZodLiteral<"map.activate">;
|
|
756
756
|
id: z.ZodNullable<z.ZodString>;
|
|
757
757
|
}, z.core.$strict>, z.ZodObject<{
|
|
758
|
-
kind: z.ZodLiteral<"
|
|
758
|
+
kind: z.ZodLiteral<"map.create">;
|
|
759
759
|
id: z.ZodString;
|
|
760
760
|
name: z.ZodString;
|
|
761
761
|
conceptIds: z.ZodArray<z.ZodString>;
|
|
762
762
|
}, z.core.$strict>, z.ZodObject<{
|
|
763
|
-
kind: z.ZodLiteral<"
|
|
763
|
+
kind: z.ZodLiteral<"map.rename">;
|
|
764
764
|
id: z.ZodString;
|
|
765
765
|
name: z.ZodString;
|
|
766
766
|
}, z.core.$strict>, z.ZodObject<{
|
|
767
|
-
kind: z.ZodLiteral<"
|
|
767
|
+
kind: z.ZodLiteral<"map.pin">;
|
|
768
768
|
id: z.ZodString;
|
|
769
769
|
pinned: z.ZodBoolean;
|
|
770
770
|
}, z.core.$strict>, z.ZodObject<{
|
|
771
|
-
kind: z.ZodLiteral<"
|
|
772
|
-
|
|
771
|
+
kind: z.ZodLiteral<"map.membership">;
|
|
772
|
+
mapId: z.ZodString;
|
|
773
773
|
conceptId: z.ZodString;
|
|
774
774
|
included: z.ZodBoolean;
|
|
775
775
|
}, z.core.$strict>, z.ZodObject<{
|
|
776
|
-
kind: z.ZodLiteral<"
|
|
776
|
+
kind: z.ZodLiteral<"map.remove">;
|
|
777
777
|
id: z.ZodString;
|
|
778
778
|
}, z.core.$strict>, ...z.ZodObject<{
|
|
779
779
|
kind: z.ZodLiteral<"preferences.theme" | "preferences.vocab">;
|
|
@@ -796,11 +796,11 @@ declare const message: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
796
796
|
id: z.ZodEnum<{
|
|
797
797
|
inspector: "inspector";
|
|
798
798
|
"inspector.connections": "inspector.connections";
|
|
799
|
+
"inspector.maps": "inspector.maps";
|
|
799
800
|
"inspector.nodes": "inspector.nodes";
|
|
800
|
-
"inspector.views": "inspector.views";
|
|
801
801
|
sidebar: "sidebar";
|
|
802
|
-
"sidebar.
|
|
803
|
-
"sidebar.
|
|
802
|
+
"sidebar.maps": "sidebar.maps";
|
|
803
|
+
"sidebar.pinned-maps": "sidebar.pinned-maps";
|
|
804
804
|
}>;
|
|
805
805
|
open: z.ZodBoolean;
|
|
806
806
|
}, z.core.$strict>], "kind">>;
|
|
@@ -832,7 +832,7 @@ declare const message: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
832
832
|
kind: z.ZodLiteral<"concept">;
|
|
833
833
|
id: z.ZodString;
|
|
834
834
|
}, z.core.$strict>, z.ZodObject<{
|
|
835
|
-
kind: z.ZodLiteral<"
|
|
835
|
+
kind: z.ZodLiteral<"map">;
|
|
836
836
|
id: z.ZodString;
|
|
837
837
|
}, z.core.$strict>], "kind">>;
|
|
838
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 | {
|
|
@@ -945,7 +945,7 @@ declare const message: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
945
945
|
kind: z.ZodLiteral<"concept">;
|
|
946
946
|
id: z.ZodString;
|
|
947
947
|
}, z.core.$strict>, z.ZodObject<{
|
|
948
|
-
kind: z.ZodLiteral<"
|
|
948
|
+
kind: z.ZodLiteral<"map">;
|
|
949
949
|
id: z.ZodString;
|
|
950
950
|
}, z.core.$strict>], "kind">>;
|
|
951
951
|
revision: z.ZodNumber;
|
|
@@ -998,7 +998,7 @@ declare const message: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
998
998
|
type: z.ZodLiteral<"request">;
|
|
999
999
|
id: z.ZodNumber;
|
|
1000
1000
|
contextId: z.ZodString;
|
|
1001
|
-
method: z.ZodLiteral<"images.
|
|
1001
|
+
method: z.ZodLiteral<"images.renderCanvas">;
|
|
1002
1002
|
params: z.ZodObject<{
|
|
1003
1003
|
format: z.ZodLiteral<"png">;
|
|
1004
1004
|
scale: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<4>]>>;
|
|
@@ -1084,13 +1084,13 @@ type ActionState = {
|
|
|
1084
1084
|
x: number;
|
|
1085
1085
|
y: number;
|
|
1086
1086
|
}>;
|
|
1087
|
-
readonly
|
|
1087
|
+
readonly mapGraph: MapGraphSnapshot;
|
|
1088
1088
|
readonly selected: Selection;
|
|
1089
1089
|
readonly workspace: {
|
|
1090
|
-
readonly
|
|
1091
|
-
readonly
|
|
1090
|
+
readonly activeMapId: string | null;
|
|
1091
|
+
readonly maps: readonly Pick<WorkspaceMap, 'id' | 'name' | 'pinned'>[];
|
|
1092
1092
|
};
|
|
1093
|
-
readonly
|
|
1093
|
+
readonly targetMapId: string | null;
|
|
1094
1094
|
readonly activeVocab: VocabDefinition | null;
|
|
1095
1095
|
readonly history: {
|
|
1096
1096
|
readonly canUndo: boolean;
|
|
@@ -1100,9 +1100,9 @@ type ActionState = {
|
|
|
1100
1100
|
type WriteOptions = {
|
|
1101
1101
|
readonly historyGroup?: string;
|
|
1102
1102
|
};
|
|
1103
|
-
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'>;
|
|
1104
1104
|
type ActionContext = {
|
|
1105
|
-
readonly
|
|
1105
|
+
readonly mapId: string | null;
|
|
1106
1106
|
readonly document: PluginWrites & {
|
|
1107
1107
|
readonly getState: () => ActionState;
|
|
1108
1108
|
readonly subscribe: (listener: () => void) => () => void;
|
|
@@ -1127,7 +1127,7 @@ type ActionContext = {
|
|
|
1127
1127
|
};
|
|
1128
1128
|
readonly storage: PluginStorage;
|
|
1129
1129
|
readonly images: {
|
|
1130
|
-
readonly
|
|
1130
|
+
readonly renderCanvas: (options: ImageRenderOptions) => Promise<RenderedImage>;
|
|
1131
1131
|
};
|
|
1132
1132
|
readonly signal: AbortSignal;
|
|
1133
1133
|
};
|
|
@@ -1139,4 +1139,4 @@ declare function createPluginClient(port: MessagePort, initial: unknown): {
|
|
|
1139
1139
|
getPresentation: () => Pick<ActionState, 'theme' | 'colorScheme' | 'locale'>;
|
|
1140
1140
|
};
|
|
1141
1141
|
//#endregion
|
|
1142
|
-
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 };
|