@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 CHANGED
@@ -52,7 +52,7 @@ export const create = (): readonly ActionContribution[] => {
52
52
  run: async ({ document }) => {
53
53
  const state = document.getState()
54
54
 
55
- const operations: readonly NessoOperation[] = state.viewGraph.concepts.map(
55
+ const operations: readonly NessoOperation[] = state.mapGraph.concepts.map(
56
56
  ({ id, label }) => ({
57
57
  kind: 'concept.label',
58
58
  id,
@@ -68,7 +68,7 @@ export const create = (): readonly ActionContribution[] => {
68
68
  }
69
69
  ```
70
70
 
71
- `create()` defines the action; Nesso calls `run` when the user invokes it. This action uppercases every concept label in that view with one undoable batch. Shared concepts change in every view containing them.
71
+ `create()` defines the action; Nesso calls `run` when the user invokes it. This action uppercases every concept label in that map with one undoable batch. Shared concepts change in every map containing them.
72
72
 
73
73
  ### Package metadata and permissions
74
74
 
@@ -80,7 +80,7 @@ Keep the example's build configuration and set these fields in `package.json`:
80
80
  "version": "1.0.0",
81
81
  "keywords": ["nesso-plugin"],
82
82
  "nesso": {
83
- "apiVersion": 5,
83
+ "apiVersion": 7,
84
84
  "kind": "actions",
85
85
  "entry": "dist/index.js",
86
86
  "writes": ["concept.label"],
@@ -89,7 +89,7 @@ Keep the example's build configuration and set these fields in `package.json`:
89
89
  "i18n": {
90
90
  "metadata": {
91
91
  "name": { "en": "Label tools" },
92
- "description": { "en": "Uppercase concept labels in a view." },
92
+ "description": { "en": "Uppercase concept labels in a map." },
93
93
  "documentation": { "en": "Updates labels in one undoable batch." }
94
94
  }
95
95
  }
@@ -150,11 +150,11 @@ Local plugins stay installed across restarts and appear in Settings → Plugins
150
150
 
151
151
  To update a local plugin the user has asked to replace, call `plugins`, find its entry with `local: true`, and pass its current `contentId` as `replacing` alongside `directory`. MCP cannot replace or shadow npm-installed or bundled plugins; use a different package name for your local copy.
152
152
 
153
- Try the installed action from a view's actions menu, or choose the theme/vocabulary in Settings. Check that the plugin handles cancellation and stale-state errors, closes cleanly, and restores saved data after restarting Nesso.
153
+ Try the installed action from a map's actions menu, or choose the theme/vocabulary in Settings. Check that the plugin handles cancellation and stale-state errors, closes cleanly, and restores saved data after restarting Nesso.
154
154
 
155
155
  ## Action API
156
156
 
157
- Nesso passes `{ document, storage, files, images, notifications, signal, viewId }` to `run` as `ActionContext`. `document` exposes the shared graph, view membership, and transient selection; `storage` holds the plugin's private data for that document.
157
+ Nesso passes `{ document, storage, files, images, notifications, signal, mapId }` to `run` as `ActionContext`. `document` exposes the shared graph, map membership, and transient selection; `storage` holds the plugin's private data for that document.
158
158
 
159
159
  `create()` receives no arguments and returns an array of actions with unique lowercase kebab-case IDs, localized labels, optional icons, and either a `run(context)` handler or a React component in `ui`. The two forms are mutually exclusive. Use `ActionIconName` for supported icons.
160
160
 
@@ -172,7 +172,7 @@ function Browse({ document }: ActionContext) {
172
172
  const state = useSyncExternalStore(document.subscribe, document.getState)
173
173
  return (
174
174
  <ul>
175
- {state.viewGraph.concepts.map(({ id, label }) => (
175
+ {state.mapGraph.concepts.map(({ id, label }) => (
176
176
  <li key={id}>{label}</li>
177
177
  ))}
178
178
  </ul>
@@ -186,7 +186,7 @@ export const create = (): readonly ActionContribution[] => [
186
186
 
187
187
  #### Context
188
188
 
189
- Components receive `ActionContext` directly as props, with the same APIs and permissions as `run`. `viewId` and the supplied `viewGraph` refer to the invoked view. Subscribe with `useSyncExternalStore` when rendering snapshot data. Discovery runs `create()` in a Worker, so keep DOM access and effects inside components or `run`, not at module scope or in `create()`. The panel can access its own DOM, but not the host DOM, native bridge, network, or direct persistent storage; use the injected APIs for files and storage.
189
+ Components receive `ActionContext` directly as props, with the same APIs and permissions as `run`. `mapId` and the supplied `mapGraph` refer to the invoked map. Subscribe with `useSyncExternalStore` when rendering snapshot data. Discovery runs `create()` in a Worker, so keep DOM access and effects inside components or `run`, not at module scope or in `create()`. The panel can access its own DOM, but not the host DOM, native bridge, network, or direct persistent storage; use the injected APIs for files and storage.
190
190
 
191
191
  #### Styling
192
192
 
@@ -194,7 +194,7 @@ Nesso supplies React, the `@nesso-how/ui` component stylesheet, and theme CSS va
194
194
 
195
195
  #### Lifecycle
196
196
 
197
- Nesso provides the panel title, close control, and loading/error screens. Opening a panel or changing the active view starts a new React instance and invalidates the previous context. Closing it, changing documents, replacing/removing the plugin, or a runtime failure ends the session.
197
+ Nesso provides the panel title, close control, and loading/error screens. Opening a panel or changing the active map starts a new React instance and invalidates the previous context. Closing it, changing documents, replacing/removing the plugin, or a runtime failure ends the session.
198
198
 
199
199
  Keep mutable state inside the component and clean up subscriptions in React effects. Module-scope state is not guaranteed between sessions: Nesso may reuse or discard the runtime, so keep state in the instance or `storage`. Save progress through `storage` as it changes; cleanup may not finish. Panels have no action execution timeout, but initialization and API requests have deadlines. Handle expected errors in the UI; uncaught errors or rejected promises fail the session.
200
200
 
@@ -203,18 +203,18 @@ Keep mutable state inside the component and clean up subscriptions in React effe
203
203
  Add optional `badge(input)` to a `run` or `ui` action. It may return synchronously or asynchronously:
204
204
 
205
205
  ```ts
206
- badge: ({ viewGraph }) => ({
207
- value: viewGraph.concepts.length,
206
+ badge: ({ mapGraph }) => ({
207
+ value: mapGraph.concepts.length,
208
208
  })
209
209
  ```
210
210
 
211
- - `input`: readonly `viewId` (`null` for All), target `viewGraph`, private document storage `records` (requires `storage`; otherwise empty), and `now` in Unix milliseconds.
211
+ - `input`: readonly `mapId` (`null` for the graph), target `mapGraph`, private document storage `records` (requires `storage`; otherwise empty), and `now` in Unix milliseconds.
212
212
  - Return `{ value: number | null, refreshAt?: number }`. `value` is an integer from 0 to 999,999; zero and `null` hide the badge.
213
213
  - For time-dependent counts, calculate from `now` and return `refreshAt` as an absolute Unix-millisecond timestamp. Omit it otherwise. Timed refreshes run no more often than every 15 seconds.
214
214
 
215
- Runs in an isolated Worker with no action APIs and a 2-second calculation limit. Nesso calculates only visible badges and refreshes them after graph, saved-view, or plugin storage changes. Results are not persisted; failures hide the badge.
215
+ Runs in an isolated Worker with no action APIs and a 2-second calculation limit. Nesso calculates only visible badges and refreshes them after graph, map, or plugin storage changes. Results are not persisted; failures hide the badge.
216
216
 
217
- ### Read the invoked view
217
+ ### Read the invoked map
218
218
 
219
219
  - `document.getState()` returns the latest readonly local snapshot synchronously and makes it the basis for subsequent writes.
220
220
  - `await document.refresh()` fetches and reads a fresh snapshot. Use it after deferred work, such as a file dialog, before computing edits.
@@ -222,12 +222,12 @@ Runs in an isolated Worker with no action APIs and a 2-second calculation limit.
222
222
 
223
223
  The graph snapshot provides:
224
224
 
225
- - `viewGraph`: `{ concepts, relations, relationTypes }` for the invoked view. In a saved view, concepts carry its `position`, `color`, `bold`, `italic`, and `strikethrough`. `color` is a preset id such as `sand`, shown with `var(--preset-sand)`, or a fixed `#rrggbb` value.
226
- - `selected`: the invoked view's selection.
227
- - `targetViewId`: the invoked view's ID, or `null` for All; fixed for each invocation. Headless actions keep their target during navigation; panels restart with a new invocation when the active view changes.
225
+ - `mapGraph`: `{ concepts, relations, relationTypes }` for the invoked map. Outside the graph, concepts carry the map's `position`, `color`, `bold`, `italic`, and `strikethrough`; relations may carry a map-local `bend`. `color` is a preset id such as `sand`, shown with `var(--preset-sand)`, or a fixed `#rrggbb` value.
226
+ - `selected`: the invoked map's selection.
227
+ - `targetMapId`: the invoked map's ID, or `null` for the graph; fixed for each invocation. Headless actions keep their target during navigation; panels restart with a new invocation when the active map changes.
228
228
  - `activeVocab`: the current vocabulary, or `null`.
229
229
 
230
- `viewGraph` contains stored relation-type labels. `resolveRelationTypeLabel(type, vocabs, locale)`, exported by `@nesso-how/plugin`, returns a translated display label from the supplied vocabularies, preserving custom labels.
230
+ `mapGraph` contains stored relation-type labels. `resolveRelationTypeLabel(type, vocabs, locale)`, exported by `@nesso-how/plugin`, returns a translated display label from the supplied vocabularies, preserving custom labels.
231
231
 
232
232
  Concept and relation-type IDs are absolute IRIs. Relations are `{ source, predicate, target }` triples; use `JSON.stringify([source, predicate, target])` as their selection/write ID.
233
233
 
@@ -252,16 +252,19 @@ Call helpers on `document` and declare their operation kinds in `nesso.writes`:
252
252
  | `setRelationType(id, typeId)` | `relation.type` |
253
253
  | `createRelationType(id, label)` | `relation.type.create` |
254
254
  | `removeRelation(id)` | `relation.remove` |
255
+ | `setRelationBend(id, value)` | `relation.bend` |
255
256
  | `setSelection([{ kind, id }])` | `selection.set` |
256
- | `setViewMembership(viewId, conceptId, included)` | `view.membership` |
257
+ | `setMapMembership(mapId, conceptId, included)` | `map.membership` |
257
258
 
258
- Position, color, and style helpers edit the invoked saved view; they reject the batch in All, after navigation, or for concepts outside the view. `addConcept` returns the new IRI. New concepts join the active saved view, at the given position or near the single selected concept, and link to that concept, if any. These links and `connect` use the vocabulary's default relation type. `createRelationType` creates and assigns a type to the given relation. The selection keeps only concepts and relations visible in the active view.
259
+ Position, color, and style helpers edit the invoked map; they reject the batch in the graph, after navigation, or for concepts outside the map. `addConcept` returns the new IRI. New concepts join the active map, at the given position or near the single selected concept, and link to that concept, if any. These links and `connect` use the vocabulary's default relation type. `createRelationType` creates and assigns a type to the given relation. The selection keeps only concepts and relations visible in the active map.
260
+
261
+ `setRelationBend` follows the same active-map guard. Its finite value is the signed midpoint displacement as a fraction of the endpoint segment's length; `0` restores the automatic curve. Both endpoints must belong to the active map, and self-relations cannot be bent. Removing or reconnecting a relation clears its bends; changing only its predicate preserves them.
259
262
 
260
263
  For related edits, use `document.applyOperations(operations)` as in the quickstart. The entire batch succeeds or changes nothing. Editing, reconnecting, retyping, or removing an unknown concept or relation rejects the batch, as does reconnecting or retyping onto an existing relation; removing an item already removed earlier in the same batch, such as a relation of a removed concept, is allowed. Separate calls are separate transactions. Raw `concept.add` operations require an explicit new absolute IRI.
261
264
 
262
265
  Every write checks against the last snapshot you read, or the initial snapshot if you haven't read one. Successful writes advance that baseline, so awaited sequential writes work normally. Incoming updates alone do not advance it. A conflict rejects with `stale-state`; let the failure propagate so Nesso can ask the user to run the action again. Never retry mutations automatically or read a new snapshot just to submit edits calculated from old data.
263
266
 
264
- The invoked view is **not a write sandbox**: permitted writes can affect the whole document. Only the operations listed above are available to plugins.
267
+ The invoked map is **not a write sandbox**: permitted writes can affect the whole document. Only the operations listed above are available to plugins.
265
268
 
266
269
  ### Files, images, notifications, and failures
267
270
 
@@ -270,12 +273,12 @@ The invoked view is **not a write sandbox**: permitted writes can affect the who
270
273
  | `files.open({ extensions: ['json'], mimeTypes: ['application/json'] })` | `files` | `{ name, mediaType, text }`, or `null` on cancellation. Extensions omit the dot. |
271
274
  | `files.save({ name: 'graph.json', mediaType: 'application/json', text })` | `files` | `{ saved: boolean }`; cancellation returns `false`. |
272
275
  | `files.save({ name: 'graph.png', mediaType: 'image/png', base64 })` | `files` | `{ saved: boolean }`; the host decodes canonical base64 before saving. |
273
- | `images.renderView({ format: 'png', scale: 2 })` | `images` | `{ mediaType: 'image/png', base64 }` for the invoked view. |
276
+ | `images.renderCanvas({ format: 'png', scale: 2 })` | `images` | `{ mediaType: 'image/png', base64 }` for the invoked canvas. |
274
277
  | `notifications.notify({ tone: 'info', title: { en: 'Done' }, description: { en: 'Labels updated' } })` | `notifications` | A notification ID. Tone is `info` or `warning`; description is optional. |
275
278
 
276
279
  File saves accept exactly one of UTF-8 `text` or canonical `base64` (without a data URL prefix), with a 16 MiB decoded byte limit. File opening remains UTF-8 text only. Host-managed dialogs or browser downloads grant no unrestricted filesystem access. Plugins have no Node, host DOM, direct filesystem, clipboard, or network access.
277
280
 
278
- `images.renderView` captures the invoked view with the current theme and fonts, without selection or canvas controls. In the Overview (`viewId` `null`) it captures the overview map of the complete graph. Scale defaults to `2`, or accepts `4`, and is a maximum: views too large for it render at the highest of `4`, `2`, or `1` within 8192 pixels per side and 16,777,216 pixels total. Empty views, views over that budget at scale `1`, and PNGs over 16 MiB fail. Save the result separately with `files.save({ name: 'view.png', ...image })`; this also requires `files`.
281
+ `images.renderCanvas` captures the canvas the action was invoked from with the current theme and fonts, without selection or canvas controls: the map, or in the graph (`mapId` `null`) every concept as shown on the graph canvas. Scale defaults to `2`, or accepts `4`, and is a maximum: canvases too large for it render at the highest of `4`, `2`, or `1` within 8192 pixels per side and 16,777,216 pixels total. Empty canvases, canvases over that budget at scale `1`, and PNGs over 16 MiB fail. Save the result separately with `files.save({ name: 'map.png', ...image })`; this also requires `files`.
279
282
 
280
283
  Failures throw `PluginError` with `code` and `{ path, message }[]` issues. Let them propagate instead of reporting success. Files and notifications cannot be rolled back with graph edits.
281
284
 
@@ -292,24 +295,24 @@ await storage.set(
292
295
  { kind: 'concept', id: concept.id },
293
296
  )
294
297
  await storage.set('settings', { enabled: true })
295
- if (viewId !== null)
296
- await storage.set('notes', { text: 'Project ideas' }, { kind: 'view', id: viewId })
298
+ if (mapId !== null)
299
+ await storage.set('notes', { text: 'Project ideas' }, { kind: 'map', id: mapId })
297
300
  await storage.delete('progress', { kind: 'concept', id: concept.id })
298
301
  ```
299
302
 
300
- `storage.list()` returns all records as an array, including records associated with deleted concepts or views. Each record has a `key`, a JSON `value`, and an optional `scope`:
303
+ `storage.list()` returns all records as an array, including records associated with deleted concepts or maps. Each record has a `key`, a JSON `value`, and an optional `scope`:
301
304
 
302
- - Without `scope`, the record belongs to the document, for example plugin configuration or notes for Overview (`viewId === null`).
303
- - With `{ kind: 'concept', id }`, it belongs to that concept. Its data is shared across all views containing the concept.
304
- - With `{ kind: 'view', id }`, it belongs to that saved view, independently of its name or membership. Use a non-null `viewId`.
305
- - Scopes identify records within the same plugin/document namespace; they do not create separate namespaces or revision baselines. The same key can be used at document scope and for different concepts and views, including a concept and view with the same ID.
305
+ - Without `scope`, the record belongs to the document, for example plugin configuration or notes for the graph (`mapId === null`).
306
+ - With `{ kind: 'concept', id }`, it belongs to that concept. Its data is shared across all maps containing the concept.
307
+ - With `{ kind: 'map', id }`, it belongs to that map, independently of its name or membership. Use a non-null `mapId`.
308
+ - Scopes identify records within the same plugin/document namespace; they do not create separate namespaces or revision baselines. The same key can be used at document scope and for different concepts and maps, including a concept and map with the same ID.
306
309
  - Your plugin owns the payload format and any migrations. Version it independently of the SDK and package version; Nesso does not interpret its fields.
307
310
 
308
311
  The [downgrade and backup policy](../../docs/compatibility.md#downgrades-and-backups) also applies to private plugin data.
309
312
 
310
313
  `storage.set(key, value, scope?)` saves one record and `storage.delete(key, scope?)` removes one. Each call is a single transaction returning `true` if data changed, or `false` if nothing changed, such as saving an identical value or deleting a missing record. Failed writes throw.
311
314
 
312
- Setting a scoped record requires the concept or saved view to exist. Concept IDs must be absolute IRIs; view IDs are opaque identifiers. Deleting a record also accepts references to deleted entities.
315
+ Setting a scoped record requires the concept or map to exist. Concept IDs must be absolute IRIs; map IDs are opaque identifiers. Deleting a record also accepts references to deleted entities.
313
316
 
314
317
  Each write checks the storage revision from your last `storage.list()` or successful write. If you have not listed storage, the SDK reads the initial revision for you. Concurrent changes reject the write with `stale-state`; the SDK does not retry or refresh the revision. List storage again and recompute your changes rather than resubmitting old data.
315
318
 
@@ -320,9 +323,9 @@ Await all storage calls before the action returns. Success means the change is i
320
323
  #### Data lifecycle
321
324
 
322
325
  - A document has a persistent identity outside graph JSON-LD. Resetting it creates a new identity and empty plugin storage; a mismatched saved identity is reported and protected, never silently attached to another document.
323
- - Renaming a view or changing membership does not affect scoped records. Removing a view does not delete concept data.
324
- - Deleting a concept or saved view retains its records, including across restart and backup restoration. Document Undo/Redo can recover the entity during the current app session, reconnecting its records by the same ID; private storage changes themselves do not enter graph history. Creating a different entity with the same name does not reconnect old records.
325
- - Use scopes for concept or view data, including logs. Nesso does not interpret IDs embedded in keys or payloads and does not automatically delete orphaned records; your plugin must clean them up explicitly.
326
+ - Renaming a map or changing membership does not affect scoped records. Removing a map does not delete concept data.
327
+ - Deleting a concept or map retains its records, including across restart and backup restoration. Document Undo/Redo can recover the entity during the current app session, reconnecting its records by the same ID; private storage changes themselves do not enter graph history. Creating a different entity with the same name does not reconnect old records.
328
+ - Use scopes for concept or map data, including logs. Nesso does not interpret IDs embedded in keys or payloads and does not automatically delete orphaned records; your plugin must clean them up explicitly.
326
329
  - Disabling, uninstalling, replacing, or crashing a plugin does not delete its stored data.
327
330
 
328
331
  #### Limits
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { $ as VocabDefinition, B as LocalizedText, C as PluginStorage, E as PluginStorageScope, H as ColorScheme, I as ImageRenderOptions, J as GraphSnapshot, L as RenderedImage, Q as ViewGraphSnapshot, R as PluginError, T as PluginStorageRecord, W as ThemeDefinition, X as SavedView, Y as NessoOperation, Z as Selection, a as ActionDescriptor, c as PluginI18n, i as ActionContribution, l as PluginManifest, n as ActionBadgeResult, o as ActionIconName, q as resolveRelationTypeLabel, r as ActionContext, s as ActionState, t as ActionBadgeInput, u as actionIconNames, w as PluginStorageKey } from "./runtime-BgIX6ayx.js";
2
- export { type ActionBadgeInput, type ActionBadgeResult, type ActionContext, type ActionContribution, type ActionDescriptor, type ActionIconName, type ActionState, type ColorScheme, type GraphSnapshot, type ImageRenderOptions, type LocalizedText, type NessoOperation, PluginError, type PluginI18n, type PluginManifest, type PluginStorage, type PluginStorageKey, type PluginStorageRecord, type PluginStorageScope, type RenderedImage, type SavedView, type Selection, type ThemeDefinition, type ViewGraphSnapshot, type VocabDefinition, actionIconNames, resolveRelationTypeLabel };
1
+ import { $ as WorkspaceMap, B as LocalizedText, C as PluginStorage, E as PluginStorageScope, H as ColorScheme, I as ImageRenderOptions, J as GraphSnapshot, L as RenderedImage, Q as VocabDefinition, R as PluginError, T as PluginStorageRecord, W as ThemeDefinition, X as NessoOperation, Y as MapGraphSnapshot, Z as Selection, a as ActionDescriptor, c as PluginI18n, i as ActionContribution, l as PluginManifest, n as ActionBadgeResult, o as ActionIconName, q as resolveRelationTypeLabel, r as ActionContext, s as ActionState, t as ActionBadgeInput, u as actionIconNames, w as PluginStorageKey } from "./runtime-C_IkTCNf.js";
2
+ export { type ActionBadgeInput, type ActionBadgeResult, type ActionContext, type ActionContribution, type ActionDescriptor, type ActionIconName, type ActionState, type ColorScheme, type GraphSnapshot, type ImageRenderOptions, type LocalizedText, type MapGraphSnapshot, type NessoOperation, PluginError, type PluginI18n, type PluginManifest, type PluginStorage, type PluginStorageKey, type PluginStorageRecord, type PluginStorageScope, type RenderedImage, type Selection, type ThemeDefinition, type VocabDefinition, type WorkspaceMap, actionIconNames, resolveRelationTypeLabel };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { C as PluginError, t as actionIconNames } from "./runtime-BXlQ2vrU.js";
1
+ import { C as PluginError, t as actionIconNames } from "./runtime-BGO97h75.js";
2
2
  //#region ../core/dist/vocab.js
3
3
  function resolveRelationTypeLabel(type, vocabs, locale) {
4
4
  for (const vocab of vocabs) {
@@ -1,4 +1,4 @@
1
- export type { GraphSnapshot, NessoOperation, SavedView, Selection, ViewGraphSnapshot, VocabDefinition, } from '@nesso-how/core';
1
+ export type { GraphSnapshot, NessoOperation, WorkspaceMap, Selection, MapGraphSnapshot, VocabDefinition, } from '@nesso-how/core';
2
2
  export { resolveRelationTypeLabel } from '@nesso-how/core';
3
3
  export type { ColorScheme, ThemeDefinition } from './definitions.ts';
4
4
  export { PluginError } from './errors.ts';
@@ -2,7 +2,7 @@ import { z } from 'zod';
2
2
  import { type ImageRenderOptions, type RenderedImage } from './images.ts';
3
3
  export type { ImageRenderOptions, RenderedImage } from './images.ts';
4
4
  import type { ComponentType } from 'react';
5
- import type { DeepReadonly, NessoOperation, Selection, SavedView, ViewGraphSnapshot, VocabDefinition } from '@nesso-how/core';
5
+ import type { DeepReadonly, NessoOperation, Selection, WorkspaceMap, MapGraphSnapshot, VocabDefinition } from '@nesso-how/core';
6
6
  import type { Locale } from '@nesso-how/i18n';
7
7
  import { type ColorScheme, type Definition } from './definitions.ts';
8
8
  import { type FileOpenOptions, type FileOpenResult, type FileSaveOptions } from './files.ts';
@@ -36,8 +36,8 @@ declare const actionBadgeResult: z.ZodObject<{
36
36
  refreshAt: z.ZodOptional<z.ZodNumber>;
37
37
  }, z.core.$strict>;
38
38
  export type ActionBadgeInput = {
39
- readonly viewId: string | null;
40
- readonly viewGraph: ViewGraphSnapshot;
39
+ readonly mapId: string | null;
40
+ readonly mapGraph: MapGraphSnapshot;
41
41
  readonly records: readonly PluginStorageRecord[];
42
42
  readonly now: number;
43
43
  };
@@ -66,9 +66,9 @@ export type PluginI18n = DeepReadonly<{
66
66
  [key: string]: LocalizedText | z.infer<typeof metadata>;
67
67
  }>;
68
68
  export declare function parsePluginI18n(value: unknown): PluginI18n;
69
- export declare const pluginApiVersion = 5;
69
+ export declare const pluginApiVersion = 7;
70
70
  declare const manifest: z.ZodDiscriminatedUnion<[z.ZodObject<{
71
- apiVersion: z.ZodLiteral<5>;
71
+ apiVersion: z.ZodLiteral<7>;
72
72
  kind: z.ZodLiteral<"actions">;
73
73
  entry: z.ZodString;
74
74
  writes: z.ZodArray<z.ZodEnum<{
@@ -82,14 +82,15 @@ declare const manifest: z.ZodDiscriminatedUnion<[z.ZodObject<{
82
82
  "concept.positions": "concept.positions";
83
83
  "concept.remove": "concept.remove";
84
84
  "concept.strikethrough": "concept.strikethrough";
85
+ "map.create": "map.create";
86
+ "map.membership": "map.membership";
87
+ "relation.bend": "relation.bend";
85
88
  "relation.connect": "relation.connect";
86
89
  "relation.reconnect": "relation.reconnect";
87
90
  "relation.remove": "relation.remove";
88
91
  "relation.type": "relation.type";
89
92
  "relation.type.create": "relation.type.create";
90
93
  "selection.set": "selection.set";
91
- "view.create": "view.create";
92
- "view.membership": "view.membership";
93
94
  }>>;
94
95
  capabilities: z.ZodArray<z.ZodEnum<{
95
96
  files: "files";
@@ -99,7 +100,7 @@ declare const manifest: z.ZodDiscriminatedUnion<[z.ZodObject<{
99
100
  ui: "ui";
100
101
  }>>;
101
102
  }, z.core.$strict>, ...z.ZodObject<{
102
- apiVersion: z.ZodLiteral<5>;
103
+ apiVersion: z.ZodLiteral<7>;
103
104
  kind: z.ZodLiteral<"theme" | "vocab">;
104
105
  entry: z.ZodString;
105
106
  writes: z.ZodTuple<[], null>;
@@ -188,6 +189,10 @@ declare const message: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject
188
189
  }, z.core.$strict>, z.ZodObject<{
189
190
  kind: z.ZodLiteral<"relation.remove">;
190
191
  id: z.ZodString;
192
+ }, z.core.$strict>, z.ZodObject<{
193
+ kind: z.ZodLiteral<"relation.bend">;
194
+ id: z.ZodString;
195
+ value: z.ZodNumber;
191
196
  }, z.core.$strict>, z.ZodObject<{
192
197
  kind: z.ZodLiteral<"document.reset">;
193
198
  id: z.ZodString;
@@ -205,28 +210,28 @@ declare const message: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject
205
210
  id: z.ZodString;
206
211
  }, z.core.$strict>>;
207
212
  }, z.core.$strict>, z.ZodObject<{
208
- kind: z.ZodLiteral<"view.activate">;
213
+ kind: z.ZodLiteral<"map.activate">;
209
214
  id: z.ZodNullable<z.ZodString>;
210
215
  }, z.core.$strict>, z.ZodObject<{
211
- kind: z.ZodLiteral<"view.create">;
216
+ kind: z.ZodLiteral<"map.create">;
212
217
  id: z.ZodString;
213
218
  name: z.ZodString;
214
219
  conceptIds: z.ZodArray<z.ZodString>;
215
220
  }, z.core.$strict>, z.ZodObject<{
216
- kind: z.ZodLiteral<"view.rename">;
221
+ kind: z.ZodLiteral<"map.rename">;
217
222
  id: z.ZodString;
218
223
  name: z.ZodString;
219
224
  }, z.core.$strict>, z.ZodObject<{
220
- kind: z.ZodLiteral<"view.pin">;
225
+ kind: z.ZodLiteral<"map.pin">;
221
226
  id: z.ZodString;
222
227
  pinned: z.ZodBoolean;
223
228
  }, z.core.$strict>, z.ZodObject<{
224
- kind: z.ZodLiteral<"view.membership">;
225
- viewId: z.ZodString;
229
+ kind: z.ZodLiteral<"map.membership">;
230
+ mapId: z.ZodString;
226
231
  conceptId: z.ZodString;
227
232
  included: z.ZodBoolean;
228
233
  }, z.core.$strict>, z.ZodObject<{
229
- kind: z.ZodLiteral<"view.remove">;
234
+ kind: z.ZodLiteral<"map.remove">;
230
235
  id: z.ZodString;
231
236
  }, z.core.$strict>, ...z.ZodObject<{
232
237
  kind: z.ZodLiteral<"preferences.theme" | "preferences.vocab">;
@@ -249,11 +254,11 @@ declare const message: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject
249
254
  id: z.ZodEnum<{
250
255
  inspector: "inspector";
251
256
  "inspector.connections": "inspector.connections";
257
+ "inspector.maps": "inspector.maps";
252
258
  "inspector.nodes": "inspector.nodes";
253
- "inspector.views": "inspector.views";
254
259
  sidebar: "sidebar";
255
- "sidebar.pinned-views": "sidebar.pinned-views";
256
- "sidebar.views": "sidebar.views";
260
+ "sidebar.maps": "sidebar.maps";
261
+ "sidebar.pinned-maps": "sidebar.pinned-maps";
257
262
  }>;
258
263
  open: z.ZodBoolean;
259
264
  }, z.core.$strict>], "kind">>;
@@ -285,7 +290,7 @@ declare const message: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject
285
290
  kind: z.ZodLiteral<"concept">;
286
291
  id: z.ZodString;
287
292
  }, z.core.$strict>, z.ZodObject<{
288
- kind: z.ZodLiteral<"view">;
293
+ kind: z.ZodLiteral<"map">;
289
294
  id: z.ZodString;
290
295
  }, z.core.$strict>], "kind">>;
291
296
  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 | {
@@ -398,7 +403,7 @@ declare const message: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject
398
403
  kind: z.ZodLiteral<"concept">;
399
404
  id: z.ZodString;
400
405
  }, z.core.$strict>, z.ZodObject<{
401
- kind: z.ZodLiteral<"view">;
406
+ kind: z.ZodLiteral<"map">;
402
407
  id: z.ZodString;
403
408
  }, z.core.$strict>], "kind">>;
404
409
  revision: z.ZodNumber;
@@ -451,7 +456,7 @@ declare const message: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject
451
456
  type: z.ZodLiteral<"request">;
452
457
  id: z.ZodNumber;
453
458
  contextId: z.ZodString;
454
- method: z.ZodLiteral<"images.renderView">;
459
+ method: z.ZodLiteral<"images.renderCanvas">;
455
460
  params: z.ZodObject<{
456
461
  format: z.ZodLiteral<"png">;
457
462
  scale: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<4>]>>;
@@ -537,13 +542,13 @@ export type ActionState = {
537
542
  x: number;
538
543
  y: number;
539
544
  }>;
540
- readonly viewGraph: ViewGraphSnapshot;
545
+ readonly mapGraph: MapGraphSnapshot;
541
546
  readonly selected: Selection;
542
547
  readonly workspace: {
543
- readonly activeViewId: string | null;
544
- readonly savedViews: readonly Pick<SavedView, 'id' | 'name' | 'pinned'>[];
548
+ readonly activeMapId: string | null;
549
+ readonly maps: readonly Pick<WorkspaceMap, 'id' | 'name' | 'pinned'>[];
545
550
  };
546
- readonly targetViewId: string | null;
551
+ readonly targetMapId: string | null;
547
552
  readonly activeVocab: VocabDefinition | null;
548
553
  readonly history: {
549
554
  readonly canUndo: boolean;
@@ -553,9 +558,9 @@ export type ActionState = {
553
558
  type WriteOptions = {
554
559
  readonly historyGroup?: string;
555
560
  };
556
- type PluginWrites = Omit<ReturnType<typeof createWriteCommands<Promise<void>, Promise<string>>>, 'undo' | 'redo' | 'setView' | 'setActiveVocab' | 'setActiveTheme' | 'setLocale' | 'setPanelSizes' | 'setSectionOpen' | 'createView' | 'renameView' | 'setViewPinned' | 'deleteView'>;
561
+ type PluginWrites = Omit<ReturnType<typeof createWriteCommands<Promise<void>, Promise<string>>>, 'undo' | 'redo' | 'setMap' | 'setActiveVocab' | 'setActiveTheme' | 'setLocale' | 'setPanelSizes' | 'setSectionOpen' | 'createMap' | 'renameMap' | 'setMapPinned' | 'deleteMap'>;
557
562
  export type ActionContext = {
558
- readonly viewId: string | null;
563
+ readonly mapId: string | null;
559
564
  readonly document: PluginWrites & {
560
565
  readonly getState: () => ActionState;
561
566
  readonly subscribe: (listener: () => void) => () => void;
@@ -580,7 +585,7 @@ export type ActionContext = {
580
585
  };
581
586
  readonly storage: PluginStorage;
582
587
  readonly images: {
583
- readonly renderView: (options: ImageRenderOptions) => Promise<RenderedImage>;
588
+ readonly renderCanvas: (options: ImageRenderOptions) => Promise<RenderedImage>;
584
589
  };
585
590
  readonly signal: AbortSignal;
586
591
  };
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { imageRenderOptions, renderedImage, } from './images.js';
3
- import { positionSchema, viewGraphSchema } from '@nesso-how/schema';
3
+ import { positionSchema, mapGraphSchema } from '@nesso-how/schema';
4
4
  import { parseOrThrow, PluginError, pluginErrorCodes } from './errors.js';
5
5
  import { colorSchemes, parseDefinition, themeColors, vocabRelationType, } from './definitions.js';
6
6
  import { fileOpenOptions, fileOpenResult, fileSaveOptions, } from './files.js';
@@ -72,21 +72,22 @@ const operation = z.discriminatedUnion('kind', [
72
72
  z.strictObject({ kind: z.literal('relation.type'), id, typeId: id }),
73
73
  z.strictObject({ kind: z.literal('relation.type.create'), id, typeId: id, label: z.string() }),
74
74
  z.strictObject({ kind: z.literal('relation.remove'), id }),
75
+ z.strictObject({ kind: z.literal('relation.bend'), id, value: z.number() }),
75
76
  z.strictObject({ kind: z.literal('document.reset'), id }),
76
77
  z.strictObject({ kind: z.literal('history.undo') }),
77
78
  z.strictObject({ kind: z.literal('history.redo') }),
78
79
  z.strictObject({ kind: z.literal('selection.set'), value: selection }),
79
- z.strictObject({ kind: z.literal('view.activate'), id: id.nullable() }),
80
- z.strictObject({ kind: z.literal('view.create'), id, name: z.string(), conceptIds: z.array(id) }),
81
- z.strictObject({ kind: z.literal('view.rename'), id, name: z.string() }),
82
- z.strictObject({ kind: z.literal('view.pin'), id, pinned: z.boolean() }),
80
+ z.strictObject({ kind: z.literal('map.activate'), id: id.nullable() }),
81
+ z.strictObject({ kind: z.literal('map.create'), id, name: z.string(), conceptIds: z.array(id) }),
82
+ z.strictObject({ kind: z.literal('map.rename'), id, name: z.string() }),
83
+ z.strictObject({ kind: z.literal('map.pin'), id, pinned: z.boolean() }),
83
84
  z.strictObject({
84
- kind: z.literal('view.membership'),
85
- viewId: id,
85
+ kind: z.literal('map.membership'),
86
+ mapId: id,
86
87
  conceptId: id,
87
88
  included: z.boolean(),
88
89
  }),
89
- z.strictObject({ kind: z.literal('view.remove'), id }),
90
+ z.strictObject({ kind: z.literal('map.remove'), id }),
90
91
  ...['vocab', 'theme'].map((kind) => z.strictObject({ kind: z.literal(`preferences.${kind}`), id })),
91
92
  z.strictObject({ kind: z.literal('preferences.locale'), value: locale }),
92
93
  z.strictObject({
@@ -97,11 +98,11 @@ const operation = z.discriminatedUnion('kind', [
97
98
  kind: z.literal('preferences.section'),
98
99
  id: z.enum([
99
100
  'sidebar',
100
- 'sidebar.pinned-views',
101
- 'sidebar.views',
101
+ 'sidebar.pinned-maps',
102
+ 'sidebar.maps',
102
103
  'inspector',
103
104
  'inspector.connections',
104
- 'inspector.views',
105
+ 'inspector.maps',
105
106
  'inspector.nodes',
106
107
  ]),
107
108
  open: z.boolean(),
@@ -118,7 +119,7 @@ export function parsePluginI18n(value) {
118
119
  checkMessageSize(value, 64 * 1024);
119
120
  return parseOrThrow(pluginI18n, value, 'i18n.');
120
121
  }
121
- export const pluginApiVersion = 5;
122
+ export const pluginApiVersion = 7;
122
123
  const manifestFields = {
123
124
  apiVersion: z.literal(pluginApiVersion),
124
125
  };
@@ -146,9 +147,10 @@ const pluginWriteKinds = [
146
147
  'relation.type',
147
148
  'relation.type.create',
148
149
  'relation.remove',
150
+ 'relation.bend',
149
151
  'selection.set',
150
- 'view.create',
151
- 'view.membership',
152
+ 'map.create',
153
+ 'map.membership',
152
154
  ];
153
155
  const operationDeclarations = z.array(z.enum(pluginWriteKinds));
154
156
  const manifest = z
@@ -214,7 +216,7 @@ const request = z.discriminatedUnion('method', [
214
216
  z.strictObject({ ...envelope, method: z.literal('files.save'), params: fileSaveOptions }),
215
217
  z.strictObject({
216
218
  ...envelope,
217
- method: z.literal('images.renderView'),
219
+ method: z.literal('images.renderCanvas'),
218
220
  params: imageRenderOptions,
219
221
  }),
220
222
  ]);
@@ -299,16 +301,16 @@ const actionStateSchema = z.strictObject({
299
301
  ]))),
300
302
  colorScheme: z.enum(colorSchemes),
301
303
  conceptPlacementOffset: position,
302
- viewGraph: viewGraphSchema,
304
+ mapGraph: mapGraphSchema,
303
305
  selected: selection,
304
- targetViewId: id.nullable(),
306
+ targetMapId: id.nullable(),
305
307
  activeVocab: z
306
308
  .strictObject({ id, relationTypes: z.array(vocabRelationType), defaultTypeId: id })
307
309
  .nullable(),
308
310
  history: z.strictObject({ canUndo: z.boolean(), canRedo: z.boolean() }),
309
311
  workspace: z.strictObject({
310
- activeViewId: id.nullable(),
311
- savedViews: z.array(z.strictObject({ id, name: z.string(), pinned: z.boolean() })),
312
+ activeMapId: id.nullable(),
313
+ maps: z.array(z.strictObject({ id, name: z.string(), pinned: z.boolean() })),
312
314
  }),
313
315
  });
314
316
  const reply = z.union([
@@ -340,7 +342,7 @@ const results = {
340
342
  'notifications.notify': id,
341
343
  'files.open': fileOpenResult,
342
344
  'files.save': z.strictObject({ saved: z.boolean() }),
343
- 'images.renderView': renderedImage,
345
+ 'images.renderCanvas': renderedImage,
344
346
  };
345
347
  export function parsePluginMessage(value) {
346
348
  checkMessageSize(value, runtimeLimits.request);
@@ -455,7 +457,7 @@ export function createPluginClient(port, initial) {
455
457
  readRevision = Math.max(readRevision, result.revision);
456
458
  return result;
457
459
  };
458
- const { undo: _undo, redo: _redo, setView: _view, setActiveVocab: _vocab, setActiveTheme: _theme, setLocale: _locale, setPanelSizes: _panels, setSectionOpen: _section, createView: _createView, renameView: _renameView, setViewPinned: _pin, deleteView: _deleteView, ...writes } = createWriteCommands(async (operations, options) => {
460
+ 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) => {
459
461
  await applyOperations(operations, options);
460
462
  }, async (id, committed) => {
461
463
  await committed;
@@ -477,7 +479,7 @@ export function createPluginClient(port, initial) {
477
479
  return result.changed;
478
480
  };
479
481
  const context = {
480
- viewId: state.targetViewId,
482
+ mapId: state.targetMapId,
481
483
  document: {
482
484
  ...writes,
483
485
  getState,
@@ -492,7 +494,7 @@ export function createPluginClient(port, initial) {
492
494
  applyOperations,
493
495
  },
494
496
  notifications: { notify: (value) => call('notifications.notify', value) },
495
- images: { renderView: (options) => call('images.renderView', options) },
497
+ images: { renderCanvas: (options) => call('images.renderCanvas', options) },
496
498
  files: {
497
499
  open: (options) => call('files.open', options),
498
500
  save: (options) => call('files.save', options),
@@ -15,7 +15,7 @@ declare const pluginStorageScope: z.ZodDiscriminatedUnion<[z.ZodObject<{
15
15
  kind: z.ZodLiteral<"concept">;
16
16
  id: z.ZodString;
17
17
  }, z.core.$strict>, z.ZodObject<{
18
- kind: z.ZodLiteral<"view">;
18
+ kind: z.ZodLiteral<"map">;
19
19
  id: z.ZodString;
20
20
  }, z.core.$strict>], "kind">;
21
21
  export declare const pluginStorageKey: z.ZodObject<{
@@ -24,7 +24,7 @@ export declare const pluginStorageKey: z.ZodObject<{
24
24
  kind: z.ZodLiteral<"concept">;
25
25
  id: z.ZodString;
26
26
  }, z.core.$strict>, z.ZodObject<{
27
- kind: z.ZodLiteral<"view">;
27
+ kind: z.ZodLiteral<"map">;
28
28
  id: z.ZodString;
29
29
  }, z.core.$strict>], "kind">>;
30
30
  }, z.core.$strict>;
@@ -34,7 +34,7 @@ export declare const pluginStorageRecord: z.ZodObject<{
34
34
  kind: z.ZodLiteral<"concept">;
35
35
  id: z.ZodString;
36
36
  }, z.core.$strict>, z.ZodObject<{
37
- kind: z.ZodLiteral<"view">;
37
+ kind: z.ZodLiteral<"map">;
38
38
  id: z.ZodString;
39
39
  }, z.core.$strict>], "kind">>;
40
40
  value: z.ZodPipe<z.ZodCustom<JsonValue, JsonValue>, z.ZodTransform<string | number | boolean | readonly JsonValue[] | {
@@ -50,7 +50,7 @@ export declare const pluginStorageSnapshot: z.ZodObject<{
50
50
  kind: z.ZodLiteral<"concept">;
51
51
  id: z.ZodString;
52
52
  }, z.core.$strict>, z.ZodObject<{
53
- kind: z.ZodLiteral<"view">;
53
+ kind: z.ZodLiteral<"map">;
54
54
  id: z.ZodString;
55
55
  }, z.core.$strict>], "kind">>;
56
56
  value: z.ZodPipe<z.ZodCustom<JsonValue, JsonValue>, z.ZodTransform<string | number | boolean | readonly JsonValue[] | {
@@ -27,7 +27,7 @@ const isJsonValue = (value, depth = 0) => {
27
27
  };
28
28
  const pluginStorageScope = z.discriminatedUnion('kind', [
29
29
  z.strictObject({ kind: z.literal('concept'), id: z.string().max(2048) }),
30
- z.strictObject({ kind: z.literal('view'), id: z.string().max(2048) }),
30
+ z.strictObject({ kind: z.literal('map'), id: z.string().max(2048) }),
31
31
  ]);
32
32
  const fields = {
33
33
  key: z.string().min(1).max(128),
package/dist/package.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { c as PluginI18n, l as PluginManifest } from "./runtime-BgIX6ayx.js";
1
+ import { c as PluginI18n, l as PluginManifest } from "./runtime-C_IkTCNf.js";
2
2
  //#region src/package.d.ts
3
3
  export declare const packageLimits: {
4
4
  readonly entry: number;
package/dist/package.js CHANGED
@@ -1,4 +1,4 @@
1
- import { C as PluginError, _ as checkMessageSize, d as sha256Hex, o as parsePluginI18n, s as parsePluginManifest, w as parseOrThrow, y as parseDefinition } from "./runtime-BXlQ2vrU.js";
1
+ import { C as PluginError, _ as checkMessageSize, d as sha256Hex, o as parsePluginI18n, s as parsePluginManifest, w as parseOrThrow, y as parseDefinition } from "./runtime-BGO97h75.js";
2
2
  import { z } from "zod";
3
3
  import parseVersion from "semver/functions/parse.js";
4
4
  import validateName from "validate-npm-package-name";