@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 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": 6,
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`; relations may carry a view-local `bend`. `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
 
@@ -254,17 +254,17 @@ Call helpers on `document` and declare their operation kinds in `nesso.writes`:
254
254
  | `removeRelation(id)` | `relation.remove` |
255
255
  | `setRelationBend(id, value)` | `relation.bend` |
256
256
  | `setSelection([{ kind, id }])` | `selection.set` |
257
- | `setViewMembership(viewId, conceptId, included)` | `view.membership` |
257
+ | `setMapMembership(mapId, conceptId, included)` | `map.membership` |
258
258
 
259
- 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
260
 
261
- `setRelationBend` follows the same active-view 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 view, and self-relations cannot be bent. Removing or reconnecting a relation clears its bends; changing only its predicate preserves them.
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.
262
262
 
263
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.
264
264
 
265
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.
266
266
 
267
- 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.
268
268
 
269
269
  ### Files, images, notifications, and failures
270
270
 
@@ -273,12 +273,12 @@ The invoked view is **not a write sandbox**: permitted writes can affect the who
273
273
  | `files.open({ extensions: ['json'], mimeTypes: ['application/json'] })` | `files` | `{ name, mediaType, text }`, or `null` on cancellation. Extensions omit the dot. |
274
274
  | `files.save({ name: 'graph.json', mediaType: 'application/json', text })` | `files` | `{ saved: boolean }`; cancellation returns `false`. |
275
275
  | `files.save({ name: 'graph.png', mediaType: 'image/png', base64 })` | `files` | `{ saved: boolean }`; the host decodes canonical base64 before saving. |
276
- | `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. |
277
277
  | `notifications.notify({ tone: 'info', title: { en: 'Done' }, description: { en: 'Labels updated' } })` | `notifications` | A notification ID. Tone is `info` or `warning`; description is optional. |
278
278
 
279
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.
280
280
 
281
- `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`.
282
282
 
283
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.
284
284
 
@@ -295,24 +295,24 @@ await storage.set(
295
295
  { kind: 'concept', id: concept.id },
296
296
  )
297
297
  await storage.set('settings', { enabled: true })
298
- if (viewId !== null)
299
- 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 })
300
300
  await storage.delete('progress', { kind: 'concept', id: concept.id })
301
301
  ```
302
302
 
303
- `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`:
304
304
 
305
- - Without `scope`, the record belongs to the document, for example plugin configuration or notes for Overview (`viewId === null`).
306
- - With `{ kind: 'concept', id }`, it belongs to that concept. Its data is shared across all views containing the concept.
307
- - With `{ kind: 'view', id }`, it belongs to that saved view, independently of its name or membership. Use a non-null `viewId`.
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 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.
309
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.
310
310
 
311
311
  The [downgrade and backup policy](../../docs/compatibility.md#downgrades-and-backups) also applies to private plugin data.
312
312
 
313
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.
314
314
 
315
- 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.
316
316
 
317
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.
318
318
 
@@ -323,9 +323,9 @@ Await all storage calls before the action returns. Success means the change is i
323
323
  #### Data lifecycle
324
324
 
325
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.
326
- - Renaming a view or changing membership does not affect scoped records. Removing a view does not delete concept data.
327
- - 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.
328
- - 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.
329
329
  - Disabling, uninstalling, replacing, or crashing a plugin does not delete its stored data.
330
330
 
331
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-BrbkQ4Oi.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-ZHRz4_y1.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 = 6;
69
+ export declare const pluginApiVersion = 7;
70
70
  declare const manifest: z.ZodDiscriminatedUnion<[z.ZodObject<{
71
- apiVersion: z.ZodLiteral<6>;
71
+ apiVersion: z.ZodLiteral<7>;
72
72
  kind: z.ZodLiteral<"actions">;
73
73
  entry: z.ZodString;
74
74
  writes: z.ZodArray<z.ZodEnum<{
@@ -82,6 +82,8 @@ 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";
85
87
  "relation.bend": "relation.bend";
86
88
  "relation.connect": "relation.connect";
87
89
  "relation.reconnect": "relation.reconnect";
@@ -89,8 +91,6 @@ declare const manifest: z.ZodDiscriminatedUnion<[z.ZodObject<{
89
91
  "relation.type": "relation.type";
90
92
  "relation.type.create": "relation.type.create";
91
93
  "selection.set": "selection.set";
92
- "view.create": "view.create";
93
- "view.membership": "view.membership";
94
94
  }>>;
95
95
  capabilities: z.ZodArray<z.ZodEnum<{
96
96
  files: "files";
@@ -100,7 +100,7 @@ declare const manifest: z.ZodDiscriminatedUnion<[z.ZodObject<{
100
100
  ui: "ui";
101
101
  }>>;
102
102
  }, z.core.$strict>, ...z.ZodObject<{
103
- apiVersion: z.ZodLiteral<6>;
103
+ apiVersion: z.ZodLiteral<7>;
104
104
  kind: z.ZodLiteral<"theme" | "vocab">;
105
105
  entry: z.ZodString;
106
106
  writes: z.ZodTuple<[], null>;
@@ -210,28 +210,28 @@ declare const message: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject
210
210
  id: z.ZodString;
211
211
  }, z.core.$strict>>;
212
212
  }, z.core.$strict>, z.ZodObject<{
213
- kind: z.ZodLiteral<"view.activate">;
213
+ kind: z.ZodLiteral<"map.activate">;
214
214
  id: z.ZodNullable<z.ZodString>;
215
215
  }, z.core.$strict>, z.ZodObject<{
216
- kind: z.ZodLiteral<"view.create">;
216
+ kind: z.ZodLiteral<"map.create">;
217
217
  id: z.ZodString;
218
218
  name: z.ZodString;
219
219
  conceptIds: z.ZodArray<z.ZodString>;
220
220
  }, z.core.$strict>, z.ZodObject<{
221
- kind: z.ZodLiteral<"view.rename">;
221
+ kind: z.ZodLiteral<"map.rename">;
222
222
  id: z.ZodString;
223
223
  name: z.ZodString;
224
224
  }, z.core.$strict>, z.ZodObject<{
225
- kind: z.ZodLiteral<"view.pin">;
225
+ kind: z.ZodLiteral<"map.pin">;
226
226
  id: z.ZodString;
227
227
  pinned: z.ZodBoolean;
228
228
  }, z.core.$strict>, z.ZodObject<{
229
- kind: z.ZodLiteral<"view.membership">;
230
- viewId: z.ZodString;
229
+ kind: z.ZodLiteral<"map.membership">;
230
+ mapId: z.ZodString;
231
231
  conceptId: z.ZodString;
232
232
  included: z.ZodBoolean;
233
233
  }, z.core.$strict>, z.ZodObject<{
234
- kind: z.ZodLiteral<"view.remove">;
234
+ kind: z.ZodLiteral<"map.remove">;
235
235
  id: z.ZodString;
236
236
  }, z.core.$strict>, ...z.ZodObject<{
237
237
  kind: z.ZodLiteral<"preferences.theme" | "preferences.vocab">;
@@ -254,11 +254,11 @@ declare const message: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject
254
254
  id: z.ZodEnum<{
255
255
  inspector: "inspector";
256
256
  "inspector.connections": "inspector.connections";
257
+ "inspector.maps": "inspector.maps";
257
258
  "inspector.nodes": "inspector.nodes";
258
- "inspector.views": "inspector.views";
259
259
  sidebar: "sidebar";
260
- "sidebar.pinned-views": "sidebar.pinned-views";
261
- "sidebar.views": "sidebar.views";
260
+ "sidebar.maps": "sidebar.maps";
261
+ "sidebar.pinned-maps": "sidebar.pinned-maps";
262
262
  }>;
263
263
  open: z.ZodBoolean;
264
264
  }, z.core.$strict>], "kind">>;
@@ -290,7 +290,7 @@ declare const message: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject
290
290
  kind: z.ZodLiteral<"concept">;
291
291
  id: z.ZodString;
292
292
  }, z.core.$strict>, z.ZodObject<{
293
- kind: z.ZodLiteral<"view">;
293
+ kind: z.ZodLiteral<"map">;
294
294
  id: z.ZodString;
295
295
  }, z.core.$strict>], "kind">>;
296
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 | {
@@ -403,7 +403,7 @@ declare const message: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject
403
403
  kind: z.ZodLiteral<"concept">;
404
404
  id: z.ZodString;
405
405
  }, z.core.$strict>, z.ZodObject<{
406
- kind: z.ZodLiteral<"view">;
406
+ kind: z.ZodLiteral<"map">;
407
407
  id: z.ZodString;
408
408
  }, z.core.$strict>], "kind">>;
409
409
  revision: z.ZodNumber;
@@ -456,7 +456,7 @@ declare const message: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject
456
456
  type: z.ZodLiteral<"request">;
457
457
  id: z.ZodNumber;
458
458
  contextId: z.ZodString;
459
- method: z.ZodLiteral<"images.renderView">;
459
+ method: z.ZodLiteral<"images.renderCanvas">;
460
460
  params: z.ZodObject<{
461
461
  format: z.ZodLiteral<"png">;
462
462
  scale: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<2>, z.ZodLiteral<4>]>>;
@@ -542,13 +542,13 @@ export type ActionState = {
542
542
  x: number;
543
543
  y: number;
544
544
  }>;
545
- readonly viewGraph: ViewGraphSnapshot;
545
+ readonly mapGraph: MapGraphSnapshot;
546
546
  readonly selected: Selection;
547
547
  readonly workspace: {
548
- readonly activeViewId: string | null;
549
- readonly savedViews: readonly Pick<SavedView, 'id' | 'name' | 'pinned'>[];
548
+ readonly activeMapId: string | null;
549
+ readonly maps: readonly Pick<WorkspaceMap, 'id' | 'name' | 'pinned'>[];
550
550
  };
551
- readonly targetViewId: string | null;
551
+ readonly targetMapId: string | null;
552
552
  readonly activeVocab: VocabDefinition | null;
553
553
  readonly history: {
554
554
  readonly canUndo: boolean;
@@ -558,9 +558,9 @@ export type ActionState = {
558
558
  type WriteOptions = {
559
559
  readonly historyGroup?: string;
560
560
  };
561
- 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'>;
562
562
  export type ActionContext = {
563
- readonly viewId: string | null;
563
+ readonly mapId: string | null;
564
564
  readonly document: PluginWrites & {
565
565
  readonly getState: () => ActionState;
566
566
  readonly subscribe: (listener: () => void) => () => void;
@@ -585,7 +585,7 @@ export type ActionContext = {
585
585
  };
586
586
  readonly storage: PluginStorage;
587
587
  readonly images: {
588
- readonly renderView: (options: ImageRenderOptions) => Promise<RenderedImage>;
588
+ readonly renderCanvas: (options: ImageRenderOptions) => Promise<RenderedImage>;
589
589
  };
590
590
  readonly signal: AbortSignal;
591
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';
@@ -77,17 +77,17 @@ const operation = z.discriminatedUnion('kind', [
77
77
  z.strictObject({ kind: z.literal('history.undo') }),
78
78
  z.strictObject({ kind: z.literal('history.redo') }),
79
79
  z.strictObject({ kind: z.literal('selection.set'), value: selection }),
80
- z.strictObject({ kind: z.literal('view.activate'), id: id.nullable() }),
81
- z.strictObject({ kind: z.literal('view.create'), id, name: z.string(), conceptIds: z.array(id) }),
82
- z.strictObject({ kind: z.literal('view.rename'), id, name: z.string() }),
83
- 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() }),
84
84
  z.strictObject({
85
- kind: z.literal('view.membership'),
86
- viewId: id,
85
+ kind: z.literal('map.membership'),
86
+ mapId: id,
87
87
  conceptId: id,
88
88
  included: z.boolean(),
89
89
  }),
90
- z.strictObject({ kind: z.literal('view.remove'), id }),
90
+ z.strictObject({ kind: z.literal('map.remove'), id }),
91
91
  ...['vocab', 'theme'].map((kind) => z.strictObject({ kind: z.literal(`preferences.${kind}`), id })),
92
92
  z.strictObject({ kind: z.literal('preferences.locale'), value: locale }),
93
93
  z.strictObject({
@@ -98,11 +98,11 @@ const operation = z.discriminatedUnion('kind', [
98
98
  kind: z.literal('preferences.section'),
99
99
  id: z.enum([
100
100
  'sidebar',
101
- 'sidebar.pinned-views',
102
- 'sidebar.views',
101
+ 'sidebar.pinned-maps',
102
+ 'sidebar.maps',
103
103
  'inspector',
104
104
  'inspector.connections',
105
- 'inspector.views',
105
+ 'inspector.maps',
106
106
  'inspector.nodes',
107
107
  ]),
108
108
  open: z.boolean(),
@@ -119,7 +119,7 @@ export function parsePluginI18n(value) {
119
119
  checkMessageSize(value, 64 * 1024);
120
120
  return parseOrThrow(pluginI18n, value, 'i18n.');
121
121
  }
122
- export const pluginApiVersion = 6;
122
+ export const pluginApiVersion = 7;
123
123
  const manifestFields = {
124
124
  apiVersion: z.literal(pluginApiVersion),
125
125
  };
@@ -149,8 +149,8 @@ const pluginWriteKinds = [
149
149
  'relation.remove',
150
150
  'relation.bend',
151
151
  'selection.set',
152
- 'view.create',
153
- 'view.membership',
152
+ 'map.create',
153
+ 'map.membership',
154
154
  ];
155
155
  const operationDeclarations = z.array(z.enum(pluginWriteKinds));
156
156
  const manifest = z
@@ -216,7 +216,7 @@ const request = z.discriminatedUnion('method', [
216
216
  z.strictObject({ ...envelope, method: z.literal('files.save'), params: fileSaveOptions }),
217
217
  z.strictObject({
218
218
  ...envelope,
219
- method: z.literal('images.renderView'),
219
+ method: z.literal('images.renderCanvas'),
220
220
  params: imageRenderOptions,
221
221
  }),
222
222
  ]);
@@ -301,16 +301,16 @@ const actionStateSchema = z.strictObject({
301
301
  ]))),
302
302
  colorScheme: z.enum(colorSchemes),
303
303
  conceptPlacementOffset: position,
304
- viewGraph: viewGraphSchema,
304
+ mapGraph: mapGraphSchema,
305
305
  selected: selection,
306
- targetViewId: id.nullable(),
306
+ targetMapId: id.nullable(),
307
307
  activeVocab: z
308
308
  .strictObject({ id, relationTypes: z.array(vocabRelationType), defaultTypeId: id })
309
309
  .nullable(),
310
310
  history: z.strictObject({ canUndo: z.boolean(), canRedo: z.boolean() }),
311
311
  workspace: z.strictObject({
312
- activeViewId: id.nullable(),
313
- 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() })),
314
314
  }),
315
315
  });
316
316
  const reply = z.union([
@@ -342,7 +342,7 @@ const results = {
342
342
  'notifications.notify': id,
343
343
  'files.open': fileOpenResult,
344
344
  'files.save': z.strictObject({ saved: z.boolean() }),
345
- 'images.renderView': renderedImage,
345
+ 'images.renderCanvas': renderedImage,
346
346
  };
347
347
  export function parsePluginMessage(value) {
348
348
  checkMessageSize(value, runtimeLimits.request);
@@ -457,7 +457,7 @@ export function createPluginClient(port, initial) {
457
457
  readRevision = Math.max(readRevision, result.revision);
458
458
  return result;
459
459
  };
460
- 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) => {
461
461
  await applyOperations(operations, options);
462
462
  }, async (id, committed) => {
463
463
  await committed;
@@ -479,7 +479,7 @@ export function createPluginClient(port, initial) {
479
479
  return result.changed;
480
480
  };
481
481
  const context = {
482
- viewId: state.targetViewId,
482
+ mapId: state.targetMapId,
483
483
  document: {
484
484
  ...writes,
485
485
  getState,
@@ -494,7 +494,7 @@ export function createPluginClient(port, initial) {
494
494
  applyOperations,
495
495
  },
496
496
  notifications: { notify: (value) => call('notifications.notify', value) },
497
- images: { renderView: (options) => call('images.renderView', options) },
497
+ images: { renderCanvas: (options) => call('images.renderCanvas', options) },
498
498
  files: {
499
499
  open: (options) => call('files.open', options),
500
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-BrbkQ4Oi.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-ZHRz4_y1.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";