@nesso-how/plugin 1.0.0-beta.17 → 1.0.0-beta.22
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 +6 -5
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/node/definitions.d.ts +59 -18
- package/dist/node/definitions.js +28 -20
- package/dist/node/index.d.ts +1 -1
- package/dist/node/runtime.d.ts +12 -6
- package/dist/node/runtime.js +6 -2
- package/dist/package.d.ts +1 -1
- package/dist/package.js +1 -1
- package/dist/{runtime-vadDPH4B.js → runtime-BXlQ2vrU.js} +69 -21
- package/dist/{runtime-D4-WzVaE.d.ts → runtime-BgIX6ayx.d.ts} +101 -27
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +1 -1
- package/example/package.json +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -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":
|
|
83
|
+
"apiVersion": 5,
|
|
84
84
|
"kind": "actions",
|
|
85
85
|
"entry": "dist/index.js",
|
|
86
86
|
"writes": ["concept.label"],
|
|
@@ -190,7 +190,7 @@ Components receive `ActionContext` directly as props, with the same APIs and per
|
|
|
190
190
|
|
|
191
191
|
#### Styling
|
|
192
192
|
|
|
193
|
-
Nesso supplies React, the `@nesso-how/ui` component stylesheet, and theme CSS variables such as `var(--background)` and `var(--foreground)`. Import your own CSS normally; the [standalone example](example/) bundles and injects it. Bundle dependencies other than React/React DOM and inline assets; remote or separate assets are not supported. The host does not compile plugin Tailwind classes. Read `locale` from `document.getState()` for translated content. Label inputs and preserve Tab/Shift+Tab navigation.
|
|
193
|
+
Nesso supplies React, the `@nesso-how/ui` component stylesheet, and theme CSS variables such as `var(--background)` and `var(--foreground)`. Import your own CSS normally; the [standalone example](example/) bundles and injects it. Bundle dependencies other than React/React DOM and inline assets; remote or separate assets are not supported. The host does not compile plugin Tailwind classes. Read `locale` from `document.getState()` for translated content. `colorScheme` (`light` or `dark`) reports the resolved appearance; Nesso applies it to the panel's `color-scheme`, so use theme variables instead of fixed colors. Label inputs and preserve Tab/Shift+Tab navigation.
|
|
194
194
|
|
|
195
195
|
#### Lifecycle
|
|
196
196
|
|
|
@@ -222,7 +222,7 @@ 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`, and `
|
|
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
226
|
- `selected`: the invoked view's selection.
|
|
227
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.
|
|
228
228
|
- `activeVocab`: the current vocabulary, or `null`.
|
|
@@ -242,6 +242,7 @@ Call helpers on `document` and declare their operation kinds in `nesso.writes`:
|
|
|
242
242
|
| `setConceptColor(id, value)` | `concept.color` |
|
|
243
243
|
| `setConceptBold(id, value)` | `concept.bold` |
|
|
244
244
|
| `setConceptItalic(id, value)` | `concept.italic` |
|
|
245
|
+
| `setConceptStrikethrough(id, value)` | `concept.strikethrough` |
|
|
245
246
|
| `setConceptPosition(id, { x, y })` | `concept.position` |
|
|
246
247
|
| `setConceptPositions([{ id, position: { x, y } }])` | `concept.positions` |
|
|
247
248
|
| `addConcept(position?)` | `concept.add` |
|
|
@@ -367,10 +368,10 @@ Use stable absolute IRIs for relation types and choose a default from your own l
|
|
|
367
368
|
Set `nesso.kind` to `"theme"`, point `entry` to your JSON definition, and use empty `writes` and `capabilities`. A `ThemeDefinition` contains:
|
|
368
369
|
|
|
369
370
|
- `id`: a lowercase kebab-case contribution ID.
|
|
370
|
-
- `colors`: every required token, using `#RRGGBB` or `#RRGGBBAA`. Start with [Paper's
|
|
371
|
+
- `colors`: a `light` and a `dark` palette, each with every required token, using `#RRGGBB` or `#RRGGBBAA`. Start with [Paper's palettes](../../plugins/paper-theme/src/index.ts) or [Kernel's](../../plugins/kernel-theme/src/index.ts).
|
|
371
372
|
- `metrics`: `radius-control` and `radius-object` in pixels, and `duration-state` in milliseconds.
|
|
372
373
|
|
|
373
|
-
|
|
374
|
+
Users choose the appearance (system, light, or dark) separately, and Nesso applies the matching palette. Surfaces (`background`, `canvas`, `sidebar`) must be opaque, light in `light` and dark in `dark`, and text needs 4.5:1 contrast on them and on `primary`. `shadow` colors elevated surfaces such as menus and popovers. Each `preset-*` token sets the background of a concept color preset; concept text uses `foreground`, so it needs 4.5:1 contrast on every preset. Arbitrary CSS and plugin fonts are unsupported. Theme packages ship only their JSON entry. Nesso owns `--font-sans` (Geist) and `--font-mono` (IBM Plex Mono), with system fallbacks for other scripts. Switching themes does not change typography.
|
|
374
375
|
|
|
375
376
|
## API reference
|
|
376
377
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { B as LocalizedText, C as PluginStorage, E as PluginStorageScope,
|
|
2
|
-
export { type ActionBadgeInput, type ActionBadgeResult, type ActionContext, type ActionContribution, type ActionDescriptor, type ActionIconName, type ActionState, 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 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 };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as PluginError, t as actionIconNames } from "./runtime-
|
|
1
|
+
import { C as PluginError, t as actionIconNames } from "./runtime-BXlQ2vrU.js";
|
|
2
2
|
//#region ../core/dist/vocab.js
|
|
3
3
|
function resolveRelationTypeLabel(type, vocabs, locale) {
|
|
4
4
|
for (const vocab of vocabs) {
|
|
@@ -1,26 +1,67 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { DeepReadonly, VocabDefinition } from '@nesso-how/core';
|
|
3
|
-
export declare const themeColors: readonly [
|
|
3
|
+
export declare const themeColors: readonly ["background", "foreground", "canvas", "sidebar", "primary", "primary-hover", "primary-foreground", "muted", "muted-foreground", "hover", "pressed", "border", "ring", "selection-halo", "node-border", "edge", "handle", "shadow", ...("preset-lavender" | "preset-mint" | "preset-neutral" | "preset-peach" | "preset-rose" | "preset-sage" | "preset-sand" | "preset-sky")[]];
|
|
4
|
+
export declare const colorSchemes: readonly ['light', 'dark'];
|
|
5
|
+
export type ColorScheme = (typeof colorSchemes)[number];
|
|
4
6
|
declare const themeDefinition: z.ZodObject<{
|
|
5
7
|
id: z.ZodString;
|
|
6
8
|
colors: z.ZodObject<{
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
9
|
+
light: z.ZodObject<{
|
|
10
|
+
background: z.ZodString;
|
|
11
|
+
border: z.ZodString;
|
|
12
|
+
canvas: z.ZodString;
|
|
13
|
+
edge: z.ZodString;
|
|
14
|
+
foreground: z.ZodString;
|
|
15
|
+
handle: z.ZodString;
|
|
16
|
+
hover: z.ZodString;
|
|
17
|
+
muted: z.ZodString;
|
|
18
|
+
"muted-foreground": z.ZodString;
|
|
19
|
+
"node-border": z.ZodString;
|
|
20
|
+
"preset-lavender": z.ZodString;
|
|
21
|
+
"preset-mint": z.ZodString;
|
|
22
|
+
"preset-neutral": z.ZodString;
|
|
23
|
+
"preset-peach": z.ZodString;
|
|
24
|
+
"preset-rose": z.ZodString;
|
|
25
|
+
"preset-sage": z.ZodString;
|
|
26
|
+
"preset-sand": z.ZodString;
|
|
27
|
+
"preset-sky": z.ZodString;
|
|
28
|
+
pressed: z.ZodString;
|
|
29
|
+
primary: z.ZodString;
|
|
30
|
+
"primary-foreground": z.ZodString;
|
|
31
|
+
"primary-hover": z.ZodString;
|
|
32
|
+
ring: z.ZodString;
|
|
33
|
+
"selection-halo": z.ZodString;
|
|
34
|
+
shadow: z.ZodString;
|
|
35
|
+
sidebar: z.ZodString;
|
|
36
|
+
}, z.core.$strict>;
|
|
37
|
+
dark: z.ZodObject<{
|
|
38
|
+
background: z.ZodString;
|
|
39
|
+
border: z.ZodString;
|
|
40
|
+
canvas: z.ZodString;
|
|
41
|
+
edge: z.ZodString;
|
|
42
|
+
foreground: z.ZodString;
|
|
43
|
+
handle: z.ZodString;
|
|
44
|
+
hover: z.ZodString;
|
|
45
|
+
muted: z.ZodString;
|
|
46
|
+
"muted-foreground": z.ZodString;
|
|
47
|
+
"node-border": z.ZodString;
|
|
48
|
+
"preset-lavender": z.ZodString;
|
|
49
|
+
"preset-mint": z.ZodString;
|
|
50
|
+
"preset-neutral": z.ZodString;
|
|
51
|
+
"preset-peach": z.ZodString;
|
|
52
|
+
"preset-rose": z.ZodString;
|
|
53
|
+
"preset-sage": z.ZodString;
|
|
54
|
+
"preset-sand": z.ZodString;
|
|
55
|
+
"preset-sky": z.ZodString;
|
|
56
|
+
pressed: z.ZodString;
|
|
57
|
+
primary: z.ZodString;
|
|
58
|
+
"primary-foreground": z.ZodString;
|
|
59
|
+
"primary-hover": z.ZodString;
|
|
60
|
+
ring: z.ZodString;
|
|
61
|
+
"selection-halo": z.ZodString;
|
|
62
|
+
shadow: z.ZodString;
|
|
63
|
+
sidebar: z.ZodString;
|
|
64
|
+
}, z.core.$strict>;
|
|
24
65
|
}, z.core.$strict>;
|
|
25
66
|
metrics: z.ZodObject<{
|
|
26
67
|
'radius-control': z.ZodNumber;
|
package/dist/node/definitions.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { validateGraph } from '@nesso-how/schema';
|
|
2
|
+
import { colorPresets, validateGraph } from '@nesso-how/schema';
|
|
3
3
|
import { parseOrThrow } from './errors.js';
|
|
4
|
+
const presetColors = colorPresets.map((preset) => `preset-${preset}`);
|
|
4
5
|
export const themeColors = [
|
|
5
6
|
'background',
|
|
6
7
|
'foreground',
|
|
@@ -19,7 +20,10 @@ export const themeColors = [
|
|
|
19
20
|
'node-border',
|
|
20
21
|
'edge',
|
|
21
22
|
'handle',
|
|
23
|
+
'shadow',
|
|
24
|
+
...presetColors,
|
|
22
25
|
];
|
|
26
|
+
export const colorSchemes = ['light', 'dark'];
|
|
23
27
|
const contributionId = z
|
|
24
28
|
.string()
|
|
25
29
|
.max(64)
|
|
@@ -33,40 +37,44 @@ const luminance = (value) => {
|
|
|
33
37
|
const opaque = (value) => value.length === 7 || value.slice(7).toLowerCase() === 'ff';
|
|
34
38
|
const contrast = (left, right) => (Math.max(luminance(left), luminance(right)) + 0.05) /
|
|
35
39
|
(Math.min(luminance(left), luminance(right)) + 0.05);
|
|
36
|
-
const
|
|
37
|
-
.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
'duration-state': z.number().int().min(0).max(300),
|
|
44
|
-
}),
|
|
45
|
-
})
|
|
46
|
-
.superRefine(({ colors }, context) => {
|
|
40
|
+
const surface = {
|
|
41
|
+
light: { matches: (value) => value >= 0.8, message: 'Expected an opaque light surface' },
|
|
42
|
+
dark: { matches: (value) => value <= 0.05, message: 'Expected an opaque dark surface' },
|
|
43
|
+
};
|
|
44
|
+
const palette = (scheme) => z
|
|
45
|
+
.strictObject(Object.fromEntries(themeColors.map((key) => [key, color])))
|
|
46
|
+
.superRefine((colors, context) => {
|
|
47
47
|
for (const key of ['background', 'canvas', 'sidebar']) {
|
|
48
|
-
if (!opaque(colors[key]) || luminance(colors[key])
|
|
49
|
-
context.addIssue({
|
|
50
|
-
code: 'custom',
|
|
51
|
-
path: ['colors', key],
|
|
52
|
-
message: 'Expected an opaque light surface',
|
|
53
|
-
});
|
|
48
|
+
if (!opaque(colors[key]) || !surface[scheme].matches(luminance(colors[key])))
|
|
49
|
+
context.addIssue({ code: 'custom', path: [key], message: surface[scheme].message });
|
|
54
50
|
if (!opaque(colors.foreground) || contrast(colors.foreground, colors[key]) < 4.5)
|
|
55
51
|
context.addIssue({
|
|
56
52
|
code: 'custom',
|
|
57
|
-
path: ['
|
|
53
|
+
path: ['foreground'],
|
|
58
54
|
message: 'Insufficient foreground contrast',
|
|
59
55
|
});
|
|
60
56
|
}
|
|
57
|
+
for (const key of presetColors)
|
|
58
|
+
if (!opaque(colors[key]) || contrast(colors.foreground, colors[key]) < 4.5)
|
|
59
|
+
context.addIssue({ code: 'custom', path: [key], message: 'Insufficient preset contrast' });
|
|
61
60
|
if (!opaque(colors.primary) ||
|
|
62
61
|
!opaque(colors['primary-foreground']) ||
|
|
63
62
|
contrast(colors.primary, colors['primary-foreground']) < 4.5)
|
|
64
63
|
context.addIssue({
|
|
65
64
|
code: 'custom',
|
|
66
|
-
path: ['
|
|
65
|
+
path: ['primary-foreground'],
|
|
67
66
|
message: 'Insufficient primary contrast',
|
|
68
67
|
});
|
|
69
68
|
});
|
|
69
|
+
const themeDefinition = z.strictObject({
|
|
70
|
+
id: contributionId,
|
|
71
|
+
colors: z.strictObject({ light: palette('light'), dark: palette('dark') }),
|
|
72
|
+
metrics: z.strictObject({
|
|
73
|
+
'radius-control': z.number().min(0).max(16),
|
|
74
|
+
'radius-object': z.number().min(0).max(16),
|
|
75
|
+
'duration-state': z.number().int().min(0).max(300),
|
|
76
|
+
}),
|
|
77
|
+
});
|
|
70
78
|
export const vocabRelationType = z.strictObject({
|
|
71
79
|
id: z.string().min(1).max(2048),
|
|
72
80
|
label: z.string().max(30),
|
package/dist/node/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type { GraphSnapshot, NessoOperation, SavedView, Selection, ViewGraphSnapshot, VocabDefinition, } from '@nesso-how/core';
|
|
2
2
|
export { resolveRelationTypeLabel } from '@nesso-how/core';
|
|
3
|
-
export type { ThemeDefinition } from './definitions.ts';
|
|
3
|
+
export type { ColorScheme, ThemeDefinition } from './definitions.ts';
|
|
4
4
|
export { PluginError } from './errors.ts';
|
|
5
5
|
export type { ActionContext, ActionBadgeInput, ActionBadgeResult, ActionContribution, ActionDescriptor, ActionIconName, ActionState, LocalizedText, PluginI18n, PluginManifest, } from './runtime.ts';
|
|
6
6
|
export { actionIconNames } from './runtime.ts';
|
package/dist/node/runtime.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export type { ImageRenderOptions, RenderedImage } from './images.ts';
|
|
|
4
4
|
import type { ComponentType } from 'react';
|
|
5
5
|
import type { DeepReadonly, NessoOperation, Selection, SavedView, ViewGraphSnapshot, VocabDefinition } from '@nesso-how/core';
|
|
6
6
|
import type { Locale } from '@nesso-how/i18n';
|
|
7
|
-
import { type Definition } from './definitions.ts';
|
|
7
|
+
import { type ColorScheme, type Definition } from './definitions.ts';
|
|
8
8
|
import { type FileOpenOptions, type FileOpenResult, type FileSaveOptions } from './files.ts';
|
|
9
9
|
import { createWriteCommands } from '@nesso-how/core';
|
|
10
10
|
import { type LocalizedText } from './i18n.ts';
|
|
@@ -43,7 +43,7 @@ export type ActionBadgeInput = {
|
|
|
43
43
|
};
|
|
44
44
|
export type ActionBadgeResult = DeepReadonly<z.infer<typeof actionBadgeResult>>;
|
|
45
45
|
export declare const parseActionBadgeResult: (value: unknown) => ActionBadgeResult;
|
|
46
|
-
export declare const themeTokens: readonly ["background", "foreground", "canvas", "sidebar", "primary", "primary-hover", "primary-foreground", "muted", "muted-foreground", "hover", "pressed", "border", "ring", "selection-halo", "node-border", "edge", "handle", "font-sans", "font-mono", "radius-control", "radius-object", "duration-state"];
|
|
46
|
+
export declare const themeTokens: readonly ["background", "foreground", "canvas", "sidebar", "primary", "primary-hover", "primary-foreground", "muted", "muted-foreground", "hover", "pressed", "border", "ring", "selection-halo", "node-border", "edge", "handle", "shadow", ...("preset-lavender" | "preset-mint" | "preset-neutral" | "preset-peach" | "preset-rose" | "preset-sage" | "preset-sand" | "preset-sky")[], "font-sans", "font-mono", "radius-control", "radius-object", "duration-state"];
|
|
47
47
|
declare const metadata: z.ZodObject<{
|
|
48
48
|
name: z.ZodObject<{
|
|
49
49
|
en: z.ZodString;
|
|
@@ -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 =
|
|
69
|
+
export declare const pluginApiVersion = 5;
|
|
70
70
|
declare const manifest: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
71
|
-
apiVersion: z.ZodLiteral<
|
|
71
|
+
apiVersion: z.ZodLiteral<5>;
|
|
72
72
|
kind: z.ZodLiteral<"actions">;
|
|
73
73
|
entry: z.ZodString;
|
|
74
74
|
writes: z.ZodArray<z.ZodEnum<{
|
|
@@ -81,6 +81,7 @@ declare const manifest: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
81
81
|
"concept.position": "concept.position";
|
|
82
82
|
"concept.positions": "concept.positions";
|
|
83
83
|
"concept.remove": "concept.remove";
|
|
84
|
+
"concept.strikethrough": "concept.strikethrough";
|
|
84
85
|
"relation.connect": "relation.connect";
|
|
85
86
|
"relation.reconnect": "relation.reconnect";
|
|
86
87
|
"relation.remove": "relation.remove";
|
|
@@ -98,7 +99,7 @@ declare const manifest: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
98
99
|
ui: "ui";
|
|
99
100
|
}>>;
|
|
100
101
|
}, z.core.$strict>, ...z.ZodObject<{
|
|
101
|
-
apiVersion: z.ZodLiteral<
|
|
102
|
+
apiVersion: z.ZodLiteral<5>;
|
|
102
103
|
kind: z.ZodLiteral<"theme" | "vocab">;
|
|
103
104
|
entry: z.ZodString;
|
|
104
105
|
writes: z.ZodTuple<[], null>;
|
|
@@ -132,6 +133,10 @@ declare const message: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
132
133
|
kind: z.ZodLiteral<"concept.italic">;
|
|
133
134
|
id: z.ZodString;
|
|
134
135
|
value: z.ZodBoolean;
|
|
136
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
137
|
+
kind: z.ZodLiteral<"concept.strikethrough">;
|
|
138
|
+
id: z.ZodString;
|
|
139
|
+
value: z.ZodBoolean;
|
|
135
140
|
}, z.core.$strict>, z.ZodObject<{
|
|
136
141
|
kind: z.ZodLiteral<"concept.position">;
|
|
137
142
|
id: z.ZodString;
|
|
@@ -527,6 +532,7 @@ export type ActionState = {
|
|
|
527
532
|
readonly contextId: string;
|
|
528
533
|
readonly locale: Locale;
|
|
529
534
|
readonly theme: Readonly<Record<string, string>>;
|
|
535
|
+
readonly colorScheme: ColorScheme;
|
|
530
536
|
readonly conceptPlacementOffset: Readonly<{
|
|
531
537
|
x: number;
|
|
532
538
|
y: number;
|
|
@@ -583,5 +589,5 @@ export declare function sha256Hex(bytes: Uint8Array): Promise<string>;
|
|
|
583
589
|
export declare function createPluginClient(port: MessagePort, initial: unknown): {
|
|
584
590
|
context: ActionContext;
|
|
585
591
|
close: () => void;
|
|
586
|
-
getPresentation: () => Pick<ActionState, 'theme' | 'locale'>;
|
|
592
|
+
getPresentation: () => Pick<ActionState, 'theme' | 'colorScheme' | 'locale'>;
|
|
587
593
|
};
|
package/dist/node/runtime.js
CHANGED
|
@@ -2,7 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
import { imageRenderOptions, renderedImage, } from './images.js';
|
|
3
3
|
import { positionSchema, viewGraphSchema } from '@nesso-how/schema';
|
|
4
4
|
import { parseOrThrow, PluginError, pluginErrorCodes } from './errors.js';
|
|
5
|
-
import { parseDefinition, themeColors, vocabRelationType } from './definitions.js';
|
|
5
|
+
import { colorSchemes, parseDefinition, themeColors, vocabRelationType, } from './definitions.js';
|
|
6
6
|
import { fileOpenOptions, fileOpenResult, fileSaveOptions, } from './files.js';
|
|
7
7
|
import { createWriteCommands } from '@nesso-how/core';
|
|
8
8
|
import { localizedText, text } from './i18n.js';
|
|
@@ -54,6 +54,7 @@ const operation = z.discriminatedUnion('kind', [
|
|
|
54
54
|
z.strictObject({ kind: z.literal('concept.color'), id, value: z.string() }),
|
|
55
55
|
z.strictObject({ kind: z.literal('concept.bold'), id, value: z.boolean() }),
|
|
56
56
|
z.strictObject({ kind: z.literal('concept.italic'), id, value: z.boolean() }),
|
|
57
|
+
z.strictObject({ kind: z.literal('concept.strikethrough'), id, value: z.boolean() }),
|
|
57
58
|
z.strictObject({ kind: z.literal('concept.position'), id, value: position }),
|
|
58
59
|
z.strictObject({
|
|
59
60
|
kind: z.literal('concept.positions'),
|
|
@@ -117,7 +118,7 @@ export function parsePluginI18n(value) {
|
|
|
117
118
|
checkMessageSize(value, 64 * 1024);
|
|
118
119
|
return parseOrThrow(pluginI18n, value, 'i18n.');
|
|
119
120
|
}
|
|
120
|
-
export const pluginApiVersion =
|
|
121
|
+
export const pluginApiVersion = 5;
|
|
121
122
|
const manifestFields = {
|
|
122
123
|
apiVersion: z.literal(pluginApiVersion),
|
|
123
124
|
};
|
|
@@ -135,6 +136,7 @@ const pluginWriteKinds = [
|
|
|
135
136
|
'concept.color',
|
|
136
137
|
'concept.bold',
|
|
137
138
|
'concept.italic',
|
|
139
|
+
'concept.strikethrough',
|
|
138
140
|
'concept.position',
|
|
139
141
|
'concept.positions',
|
|
140
142
|
'concept.add',
|
|
@@ -295,6 +297,7 @@ const actionStateSchema = z.strictObject({
|
|
|
295
297
|
.max(512)
|
|
296
298
|
.regex(/^[#\w\s.,()%/"'-]*$/),
|
|
297
299
|
]))),
|
|
300
|
+
colorScheme: z.enum(colorSchemes),
|
|
298
301
|
conceptPlacementOffset: position,
|
|
299
302
|
viewGraph: viewGraphSchema,
|
|
300
303
|
selected: selection,
|
|
@@ -506,6 +509,7 @@ export function createPluginClient(port, initial) {
|
|
|
506
509
|
close,
|
|
507
510
|
getPresentation: () => ({
|
|
508
511
|
theme: state.theme,
|
|
512
|
+
colorScheme: state.colorScheme,
|
|
509
513
|
locale: state.locale,
|
|
510
514
|
}),
|
|
511
515
|
};
|
package/dist/package.d.ts
CHANGED
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-
|
|
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";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import parseVersion from "semver/functions/parse.js";
|
|
4
4
|
import validateName from "validate-npm-package-name";
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
//#region ../schema/dist/core.js
|
|
3
|
+
const colorPresets = [
|
|
4
|
+
"neutral",
|
|
5
|
+
"sand",
|
|
6
|
+
"peach",
|
|
7
|
+
"rose",
|
|
8
|
+
"sage",
|
|
9
|
+
"mint",
|
|
10
|
+
"sky",
|
|
11
|
+
"lavender"
|
|
12
|
+
];
|
|
3
13
|
const conceptKeys = [
|
|
4
14
|
"@id",
|
|
5
15
|
"rdfs:label",
|
|
@@ -42,9 +52,10 @@ const conceptSchema = z.strictObject({
|
|
|
42
52
|
});
|
|
43
53
|
const presentationSchema = z.strictObject({
|
|
44
54
|
position: positionSchema,
|
|
45
|
-
color: z.string().regex(/^#[0-9a-fA-F]{6}$/).optional(),
|
|
55
|
+
color: z.union([z.string().regex(/^#[0-9a-fA-F]{6}$/), z.enum(colorPresets)]).optional(),
|
|
46
56
|
bold: z.boolean().optional(),
|
|
47
|
-
italic: z.boolean().optional()
|
|
57
|
+
italic: z.boolean().optional(),
|
|
58
|
+
strikethrough: z.boolean().optional()
|
|
48
59
|
});
|
|
49
60
|
const viewMemberSchema = presentationSchema.extend({ id: iriSchema });
|
|
50
61
|
const relationTypeSchema = z.strictObject({
|
|
@@ -152,12 +163,13 @@ const viewsSchema = (graph) => z.array(viewSchema).superRefine((views, context)
|
|
|
152
163
|
//#endregion
|
|
153
164
|
//#region ../schema/dist/migrations.js
|
|
154
165
|
const jsonObject$1 = z.record(z.string(), z.unknown());
|
|
155
|
-
z.strictObject({
|
|
166
|
+
const legacyDocument = z.strictObject({
|
|
156
167
|
"@context": jsonObject$1,
|
|
157
168
|
"@graph": z.array(jsonObject$1)
|
|
158
169
|
});
|
|
159
170
|
presentationSchema.partial();
|
|
160
171
|
z.object({ schemaVersion: z.number().int().positive().optional() });
|
|
172
|
+
legacyDocument.extend({ schemaVersion: z.literal(1) });
|
|
161
173
|
//#endregion
|
|
162
174
|
//#region ../schema/dist/validate.js
|
|
163
175
|
function validateGraph(graph, views = []) {
|
|
@@ -170,7 +182,7 @@ function validateGraph(graph, views = []) {
|
|
|
170
182
|
//#region ../schema/dist/jsonld.js
|
|
171
183
|
const jsonObject = z.record(z.string(), z.unknown());
|
|
172
184
|
z.strictObject({
|
|
173
|
-
schemaVersion: z.literal(
|
|
185
|
+
schemaVersion: z.literal(2),
|
|
174
186
|
"@context": jsonObject,
|
|
175
187
|
"@graph": z.array(jsonObject)
|
|
176
188
|
});
|
|
@@ -238,6 +250,11 @@ function createWriteCommands(applyOperations, created) {
|
|
|
238
250
|
id,
|
|
239
251
|
value
|
|
240
252
|
}], historyGroup ? { historyGroup } : void 0),
|
|
253
|
+
setConceptStrikethrough: (id, value, historyGroup) => applyOperations([{
|
|
254
|
+
kind: "concept.strikethrough",
|
|
255
|
+
id,
|
|
256
|
+
value
|
|
257
|
+
}], historyGroup ? { historyGroup } : void 0),
|
|
241
258
|
addConcept: (position, historyGroup) => {
|
|
242
259
|
const id = newIri();
|
|
243
260
|
return created(id, applyOperations([{
|
|
@@ -430,6 +447,7 @@ const renderedImage = z.strictObject({
|
|
|
430
447
|
});
|
|
431
448
|
//#endregion
|
|
432
449
|
//#region src/definitions.ts
|
|
450
|
+
const presetColors = colorPresets.map((preset) => `preset-${preset}`);
|
|
433
451
|
const themeColors = [
|
|
434
452
|
"background",
|
|
435
453
|
"foreground",
|
|
@@ -447,8 +465,11 @@ const themeColors = [
|
|
|
447
465
|
"selection-halo",
|
|
448
466
|
"node-border",
|
|
449
467
|
"edge",
|
|
450
|
-
"handle"
|
|
468
|
+
"handle",
|
|
469
|
+
"shadow",
|
|
470
|
+
...presetColors
|
|
451
471
|
];
|
|
472
|
+
const colorSchemes = ["light", "dark"];
|
|
452
473
|
const contributionId = z.string().max(64).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/);
|
|
453
474
|
const color = z.string().regex(/^#[\da-fA-F]{6}([\da-fA-F]{2})?$/);
|
|
454
475
|
const luminance = (value) => {
|
|
@@ -461,37 +482,56 @@ const luminance = (value) => {
|
|
|
461
482
|
};
|
|
462
483
|
const opaque = (value) => value.length === 7 || value.slice(7).toLowerCase() === "ff";
|
|
463
484
|
const contrast = (left, right) => (Math.max(luminance(left), luminance(right)) + .05) / (Math.min(luminance(left), luminance(right)) + .05);
|
|
464
|
-
const
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
}
|
|
485
|
+
const surface = {
|
|
486
|
+
light: {
|
|
487
|
+
matches: (value) => value >= .8,
|
|
488
|
+
message: "Expected an opaque light surface"
|
|
489
|
+
},
|
|
490
|
+
dark: {
|
|
491
|
+
matches: (value) => value <= .05,
|
|
492
|
+
message: "Expected an opaque dark surface"
|
|
493
|
+
}
|
|
494
|
+
};
|
|
495
|
+
const palette = (scheme) => z.strictObject(Object.fromEntries(themeColors.map((key) => [key, color]))).superRefine((colors, context) => {
|
|
473
496
|
for (const key of [
|
|
474
497
|
"background",
|
|
475
498
|
"canvas",
|
|
476
499
|
"sidebar"
|
|
477
500
|
]) {
|
|
478
|
-
if (!opaque(colors[key]) || luminance(colors[key])
|
|
501
|
+
if (!opaque(colors[key]) || !surface[scheme].matches(luminance(colors[key]))) context.addIssue({
|
|
479
502
|
code: "custom",
|
|
480
|
-
path: [
|
|
481
|
-
message:
|
|
503
|
+
path: [key],
|
|
504
|
+
message: surface[scheme].message
|
|
482
505
|
});
|
|
483
506
|
if (!opaque(colors.foreground) || contrast(colors.foreground, colors[key]) < 4.5) context.addIssue({
|
|
484
507
|
code: "custom",
|
|
485
|
-
path: ["
|
|
508
|
+
path: ["foreground"],
|
|
486
509
|
message: "Insufficient foreground contrast"
|
|
487
510
|
});
|
|
488
511
|
}
|
|
512
|
+
for (const key of presetColors) if (!opaque(colors[key]) || contrast(colors.foreground, colors[key]) < 4.5) context.addIssue({
|
|
513
|
+
code: "custom",
|
|
514
|
+
path: [key],
|
|
515
|
+
message: "Insufficient preset contrast"
|
|
516
|
+
});
|
|
489
517
|
if (!opaque(colors.primary) || !opaque(colors["primary-foreground"]) || contrast(colors.primary, colors["primary-foreground"]) < 4.5) context.addIssue({
|
|
490
518
|
code: "custom",
|
|
491
|
-
path: ["
|
|
519
|
+
path: ["primary-foreground"],
|
|
492
520
|
message: "Insufficient primary contrast"
|
|
493
521
|
});
|
|
494
522
|
});
|
|
523
|
+
const themeDefinition = z.strictObject({
|
|
524
|
+
id: contributionId,
|
|
525
|
+
colors: z.strictObject({
|
|
526
|
+
light: palette("light"),
|
|
527
|
+
dark: palette("dark")
|
|
528
|
+
}),
|
|
529
|
+
metrics: z.strictObject({
|
|
530
|
+
"radius-control": z.number().min(0).max(16),
|
|
531
|
+
"radius-object": z.number().min(0).max(16),
|
|
532
|
+
"duration-state": z.number().int().min(0).max(300)
|
|
533
|
+
})
|
|
534
|
+
});
|
|
495
535
|
const vocabRelationType = z.strictObject({
|
|
496
536
|
id: z.string().min(1).max(2048),
|
|
497
537
|
label: z.string().max(30),
|
|
@@ -707,6 +747,11 @@ const operation = z.discriminatedUnion("kind", [
|
|
|
707
747
|
id,
|
|
708
748
|
value: z.boolean()
|
|
709
749
|
}),
|
|
750
|
+
z.strictObject({
|
|
751
|
+
kind: z.literal("concept.strikethrough"),
|
|
752
|
+
id,
|
|
753
|
+
value: z.boolean()
|
|
754
|
+
}),
|
|
710
755
|
z.strictObject({
|
|
711
756
|
kind: z.literal("concept.position"),
|
|
712
757
|
id,
|
|
@@ -835,8 +880,8 @@ function parsePluginI18n(value) {
|
|
|
835
880
|
checkMessageSize(value, 65536);
|
|
836
881
|
return parseOrThrow(pluginI18n, value, "i18n.");
|
|
837
882
|
}
|
|
838
|
-
const pluginApiVersion =
|
|
839
|
-
const manifestFields = { apiVersion: z.literal(
|
|
883
|
+
const pluginApiVersion = 5;
|
|
884
|
+
const manifestFields = { apiVersion: z.literal(5) };
|
|
840
885
|
const jsEntry = z.string().max(240).regex(/^(?:[\w-]+\/)*[\w-]+\.js$/);
|
|
841
886
|
const jsonEntry = z.string().max(240).regex(/^(?:[\w-]+\/)*[\w-]+\.json$/);
|
|
842
887
|
const operationDeclarations = z.array(z.enum([
|
|
@@ -845,6 +890,7 @@ const operationDeclarations = z.array(z.enum([
|
|
|
845
890
|
"concept.color",
|
|
846
891
|
"concept.bold",
|
|
847
892
|
"concept.italic",
|
|
893
|
+
"concept.strikethrough",
|
|
848
894
|
"concept.position",
|
|
849
895
|
"concept.positions",
|
|
850
896
|
"concept.add",
|
|
@@ -1020,6 +1066,7 @@ const actionStateSchema = z.strictObject({
|
|
|
1020
1066
|
contextId: id,
|
|
1021
1067
|
locale,
|
|
1022
1068
|
theme: z.strictObject(Object.fromEntries(themeTokens.map((token) => [token, z.string().max(512).regex(/^[#\w\s.,()%/"'-]*$/)]))),
|
|
1069
|
+
colorScheme: z.enum(colorSchemes),
|
|
1023
1070
|
conceptPlacementOffset: position,
|
|
1024
1071
|
viewGraph: viewGraphSchema,
|
|
1025
1072
|
selected: selection,
|
|
@@ -1278,6 +1325,7 @@ function createPluginClient(port, initial) {
|
|
|
1278
1325
|
close,
|
|
1279
1326
|
getPresentation: () => ({
|
|
1280
1327
|
theme: state.theme,
|
|
1328
|
+
colorScheme: state.colorScheme,
|
|
1281
1329
|
locale: state.locale
|
|
1282
1330
|
})
|
|
1283
1331
|
};
|
|
@@ -26,18 +26,38 @@ declare const presentationSchema: z.ZodObject<{
|
|
|
26
26
|
x: z.ZodNumber;
|
|
27
27
|
y: z.ZodNumber;
|
|
28
28
|
}, z.core.$strict>;
|
|
29
|
-
color: z.ZodOptional<z.ZodString
|
|
29
|
+
color: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodEnum<{
|
|
30
|
+
lavender: "lavender";
|
|
31
|
+
mint: "mint";
|
|
32
|
+
neutral: "neutral";
|
|
33
|
+
peach: "peach";
|
|
34
|
+
rose: "rose";
|
|
35
|
+
sage: "sage";
|
|
36
|
+
sand: "sand";
|
|
37
|
+
sky: "sky";
|
|
38
|
+
}>]>>;
|
|
30
39
|
bold: z.ZodOptional<z.ZodBoolean>;
|
|
31
40
|
italic: z.ZodOptional<z.ZodBoolean>;
|
|
41
|
+
strikethrough: z.ZodOptional<z.ZodBoolean>;
|
|
32
42
|
}, z.core.$strict>;
|
|
33
43
|
declare const viewMemberSchema: z.ZodObject<{
|
|
34
44
|
position: z.ZodObject<{
|
|
35
45
|
x: z.ZodNumber;
|
|
36
46
|
y: z.ZodNumber;
|
|
37
47
|
}, z.core.$strict>;
|
|
38
|
-
color: z.ZodOptional<z.ZodString
|
|
48
|
+
color: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodEnum<{
|
|
49
|
+
lavender: "lavender";
|
|
50
|
+
mint: "mint";
|
|
51
|
+
neutral: "neutral";
|
|
52
|
+
peach: "peach";
|
|
53
|
+
rose: "rose";
|
|
54
|
+
sage: "sage";
|
|
55
|
+
sand: "sand";
|
|
56
|
+
sky: "sky";
|
|
57
|
+
}>]>>;
|
|
39
58
|
bold: z.ZodOptional<z.ZodBoolean>;
|
|
40
59
|
italic: z.ZodOptional<z.ZodBoolean>;
|
|
60
|
+
strikethrough: z.ZodOptional<z.ZodBoolean>;
|
|
41
61
|
id: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
42
62
|
}, z.core.$strict>;
|
|
43
63
|
declare const relationTypeSchema: z.ZodObject<{
|
|
@@ -101,6 +121,10 @@ type NessoOperation = {
|
|
|
101
121
|
readonly kind: 'concept.italic';
|
|
102
122
|
readonly id: string;
|
|
103
123
|
readonly value: boolean;
|
|
124
|
+
} | {
|
|
125
|
+
readonly kind: 'concept.strikethrough';
|
|
126
|
+
readonly id: string;
|
|
127
|
+
readonly value: boolean;
|
|
104
128
|
} | {
|
|
105
129
|
readonly kind: 'concept.position';
|
|
106
130
|
readonly id: string;
|
|
@@ -177,6 +201,7 @@ type NessoOperation = {
|
|
|
177
201
|
} | {
|
|
178
202
|
readonly kind: 'viewport.set';
|
|
179
203
|
readonly rendererId: string;
|
|
204
|
+
readonly viewId?: string | null;
|
|
180
205
|
readonly value: Viewport;
|
|
181
206
|
} | {
|
|
182
207
|
readonly kind: 'preferences.vocab';
|
|
@@ -240,6 +265,7 @@ type Preferences = {
|
|
|
240
265
|
readonly activeThemeId: string;
|
|
241
266
|
readonly panels: PanelSizes;
|
|
242
267
|
readonly inspectorTab?: 'details' | 'chat';
|
|
268
|
+
readonly appearance?: 'system' | 'light' | 'dark';
|
|
243
269
|
readonly relationGroups?: boolean;
|
|
244
270
|
readonly collapsedSections?: readonly SectionId[];
|
|
245
271
|
};
|
|
@@ -261,7 +287,7 @@ type NessoStore = {
|
|
|
261
287
|
readonly conceptPlacementOffset: Readonly<Position>;
|
|
262
288
|
readonly setSelection: (selection: Selection) => void;
|
|
263
289
|
readonly setView: (id: string | null) => void;
|
|
264
|
-
readonly setViewport: (rendererId: string, viewport: Viewport) => void;
|
|
290
|
+
readonly setViewport: (rendererId: string, viewport: Viewport, viewId?: string | null) => void;
|
|
265
291
|
readonly setConceptPosition: (id: string, position: Readonly<Position>, historyGroup?: string) => void;
|
|
266
292
|
readonly setConceptPositions: (updates: readonly {
|
|
267
293
|
readonly id: string;
|
|
@@ -272,6 +298,7 @@ type NessoStore = {
|
|
|
272
298
|
readonly setConceptColor: (id: string, color: string, historyGroup?: string) => void;
|
|
273
299
|
readonly setConceptBold: (id: string, value: boolean, historyGroup?: string) => void;
|
|
274
300
|
readonly setConceptItalic: (id: string, value: boolean, historyGroup?: string) => void;
|
|
301
|
+
readonly setConceptStrikethrough: (id: string, value: boolean, historyGroup?: string) => void;
|
|
275
302
|
readonly addConcept: (position?: Readonly<Position>, historyGroup?: string) => string;
|
|
276
303
|
readonly connect: (source: string, target: string) => void;
|
|
277
304
|
readonly reconnectRelation: (id: string, source: string, target: string) => void;
|
|
@@ -307,27 +334,68 @@ declare function createWriteCommands<Commit, Created>(applyOperations: (...args:
|
|
|
307
334
|
declare function resolveRelationTypeLabel(type: Readonly<RelationType>, vocabs: readonly VocabDefinition[], locale: Locale): string;
|
|
308
335
|
//#endregion
|
|
309
336
|
//#region src/definitions.d.ts
|
|
310
|
-
declare const themeColors: readonly [
|
|
337
|
+
declare const themeColors: readonly ["background", "foreground", "canvas", "sidebar", "primary", "primary-hover", "primary-foreground", "muted", "muted-foreground", "hover", "pressed", "border", "ring", "selection-halo", "node-border", "edge", "handle", "shadow", ...("preset-lavender" | "preset-mint" | "preset-neutral" | "preset-peach" | "preset-rose" | "preset-sage" | "preset-sand" | "preset-sky")[]];
|
|
338
|
+
declare const colorSchemes: readonly ['light', 'dark'];
|
|
339
|
+
type ColorScheme = (typeof colorSchemes)[number];
|
|
311
340
|
declare const themeDefinition: z.ZodObject<{
|
|
312
341
|
id: z.ZodString;
|
|
313
342
|
colors: z.ZodObject<{
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
343
|
+
light: z.ZodObject<{
|
|
344
|
+
background: z.ZodString;
|
|
345
|
+
border: z.ZodString;
|
|
346
|
+
canvas: z.ZodString;
|
|
347
|
+
edge: z.ZodString;
|
|
348
|
+
foreground: z.ZodString;
|
|
349
|
+
handle: z.ZodString;
|
|
350
|
+
hover: z.ZodString;
|
|
351
|
+
muted: z.ZodString;
|
|
352
|
+
"muted-foreground": z.ZodString;
|
|
353
|
+
"node-border": z.ZodString;
|
|
354
|
+
"preset-lavender": z.ZodString;
|
|
355
|
+
"preset-mint": z.ZodString;
|
|
356
|
+
"preset-neutral": z.ZodString;
|
|
357
|
+
"preset-peach": z.ZodString;
|
|
358
|
+
"preset-rose": z.ZodString;
|
|
359
|
+
"preset-sage": z.ZodString;
|
|
360
|
+
"preset-sand": z.ZodString;
|
|
361
|
+
"preset-sky": z.ZodString;
|
|
362
|
+
pressed: z.ZodString;
|
|
363
|
+
primary: z.ZodString;
|
|
364
|
+
"primary-foreground": z.ZodString;
|
|
365
|
+
"primary-hover": z.ZodString;
|
|
366
|
+
ring: z.ZodString;
|
|
367
|
+
"selection-halo": z.ZodString;
|
|
368
|
+
shadow: z.ZodString;
|
|
369
|
+
sidebar: z.ZodString;
|
|
370
|
+
}, z.core.$strict>;
|
|
371
|
+
dark: z.ZodObject<{
|
|
372
|
+
background: z.ZodString;
|
|
373
|
+
border: z.ZodString;
|
|
374
|
+
canvas: z.ZodString;
|
|
375
|
+
edge: z.ZodString;
|
|
376
|
+
foreground: z.ZodString;
|
|
377
|
+
handle: z.ZodString;
|
|
378
|
+
hover: z.ZodString;
|
|
379
|
+
muted: z.ZodString;
|
|
380
|
+
"muted-foreground": z.ZodString;
|
|
381
|
+
"node-border": z.ZodString;
|
|
382
|
+
"preset-lavender": z.ZodString;
|
|
383
|
+
"preset-mint": z.ZodString;
|
|
384
|
+
"preset-neutral": z.ZodString;
|
|
385
|
+
"preset-peach": z.ZodString;
|
|
386
|
+
"preset-rose": z.ZodString;
|
|
387
|
+
"preset-sage": z.ZodString;
|
|
388
|
+
"preset-sand": z.ZodString;
|
|
389
|
+
"preset-sky": z.ZodString;
|
|
390
|
+
pressed: z.ZodString;
|
|
391
|
+
primary: z.ZodString;
|
|
392
|
+
"primary-foreground": z.ZodString;
|
|
393
|
+
"primary-hover": z.ZodString;
|
|
394
|
+
ring: z.ZodString;
|
|
395
|
+
"selection-halo": z.ZodString;
|
|
396
|
+
shadow: z.ZodString;
|
|
397
|
+
sidebar: z.ZodString;
|
|
398
|
+
}, z.core.$strict>;
|
|
331
399
|
}, z.core.$strict>;
|
|
332
400
|
metrics: z.ZodObject<{
|
|
333
401
|
'radius-control': z.ZodNumber;
|
|
@@ -495,7 +563,7 @@ type ActionBadgeInput = {
|
|
|
495
563
|
};
|
|
496
564
|
type ActionBadgeResult = DeepReadonly<z.infer<typeof actionBadgeResult>>;
|
|
497
565
|
declare const parseActionBadgeResult: (value: unknown) => ActionBadgeResult;
|
|
498
|
-
declare const themeTokens: readonly ["background", "foreground", "canvas", "sidebar", "primary", "primary-hover", "primary-foreground", "muted", "muted-foreground", "hover", "pressed", "border", "ring", "selection-halo", "node-border", "edge", "handle", "font-sans", "font-mono", "radius-control", "radius-object", "duration-state"];
|
|
566
|
+
declare const themeTokens: readonly ["background", "foreground", "canvas", "sidebar", "primary", "primary-hover", "primary-foreground", "muted", "muted-foreground", "hover", "pressed", "border", "ring", "selection-halo", "node-border", "edge", "handle", "shadow", ...("preset-lavender" | "preset-mint" | "preset-neutral" | "preset-peach" | "preset-rose" | "preset-sage" | "preset-sand" | "preset-sky")[], "font-sans", "font-mono", "radius-control", "radius-object", "duration-state"];
|
|
499
567
|
declare const metadata: z.ZodObject<{
|
|
500
568
|
name: z.ZodObject<{
|
|
501
569
|
en: z.ZodString;
|
|
@@ -518,9 +586,9 @@ type PluginI18n = DeepReadonly<{
|
|
|
518
586
|
[key: string]: LocalizedText | z.infer<typeof metadata>;
|
|
519
587
|
}>;
|
|
520
588
|
declare function parsePluginI18n(value: unknown): PluginI18n;
|
|
521
|
-
declare const pluginApiVersion =
|
|
589
|
+
declare const pluginApiVersion = 5;
|
|
522
590
|
declare const manifest: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
523
|
-
apiVersion: z.ZodLiteral<
|
|
591
|
+
apiVersion: z.ZodLiteral<5>;
|
|
524
592
|
kind: z.ZodLiteral<"actions">;
|
|
525
593
|
entry: z.ZodString;
|
|
526
594
|
writes: z.ZodArray<z.ZodEnum<{
|
|
@@ -533,6 +601,7 @@ declare const manifest: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
533
601
|
"concept.position": "concept.position";
|
|
534
602
|
"concept.positions": "concept.positions";
|
|
535
603
|
"concept.remove": "concept.remove";
|
|
604
|
+
"concept.strikethrough": "concept.strikethrough";
|
|
536
605
|
"relation.connect": "relation.connect";
|
|
537
606
|
"relation.reconnect": "relation.reconnect";
|
|
538
607
|
"relation.remove": "relation.remove";
|
|
@@ -550,7 +619,7 @@ declare const manifest: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
550
619
|
ui: "ui";
|
|
551
620
|
}>>;
|
|
552
621
|
}, z.core.$strict>, ...z.ZodObject<{
|
|
553
|
-
apiVersion: z.ZodLiteral<
|
|
622
|
+
apiVersion: z.ZodLiteral<5>;
|
|
554
623
|
kind: z.ZodLiteral<"theme" | "vocab">;
|
|
555
624
|
entry: z.ZodString;
|
|
556
625
|
writes: z.ZodTuple<[], null>;
|
|
@@ -584,6 +653,10 @@ declare const message: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
584
653
|
kind: z.ZodLiteral<"concept.italic">;
|
|
585
654
|
id: z.ZodString;
|
|
586
655
|
value: z.ZodBoolean;
|
|
656
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
657
|
+
kind: z.ZodLiteral<"concept.strikethrough">;
|
|
658
|
+
id: z.ZodString;
|
|
659
|
+
value: z.ZodBoolean;
|
|
587
660
|
}, z.core.$strict>, z.ZodObject<{
|
|
588
661
|
kind: z.ZodLiteral<"concept.position">;
|
|
589
662
|
id: z.ZodString;
|
|
@@ -979,6 +1052,7 @@ type ActionState = {
|
|
|
979
1052
|
readonly contextId: string;
|
|
980
1053
|
readonly locale: Locale;
|
|
981
1054
|
readonly theme: Readonly<Record<string, string>>;
|
|
1055
|
+
readonly colorScheme: ColorScheme;
|
|
982
1056
|
readonly conceptPlacementOffset: Readonly<{
|
|
983
1057
|
x: number;
|
|
984
1058
|
y: number;
|
|
@@ -1035,7 +1109,7 @@ declare function sha256Hex(bytes: Uint8Array): Promise<string>;
|
|
|
1035
1109
|
declare function createPluginClient(port: MessagePort, initial: unknown): {
|
|
1036
1110
|
context: ActionContext;
|
|
1037
1111
|
close: () => void;
|
|
1038
|
-
getPresentation: () => Pick<ActionState, 'theme' | 'locale'>;
|
|
1112
|
+
getPresentation: () => Pick<ActionState, 'theme' | 'colorScheme' | 'locale'>;
|
|
1039
1113
|
};
|
|
1040
1114
|
//#endregion
|
|
1041
|
-
export { pluginStorageLimits as A, LocalizedText as B, PluginStorage as C, parsePluginStorageKey as D, PluginStorageScope as E, parseFileOptions as F,
|
|
1115
|
+
export { VocabDefinition 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, ViewGraphSnapshot as Q, PluginError as R, checkMessageSize as S, PluginStorageRecord as T, Definition as U, resolvePluginText as V, ThemeDefinition as W, SavedView as X, NessoOperation as Y, Selection as Z, parsePluginMessage as _, ActionDescriptor as a, sha256Hex as b, PluginI18n as c, badgeLimits as d, createPluginClient as f, parsePluginManifest as g, parsePluginI18n as h, ActionContribution as i, FileOpenOptions as j, parsePluginStorageSnapshot as k, PluginManifest as l, parseContribution as m, ActionBadgeResult as n, ActionIconName as o, parseActionBadgeResult as p, resolveRelationTypeLabel as q, ActionContext as r, ActionState as s, ActionBadgeInput as t, actionIconNames as u, pluginApiVersion as v, PluginStorageKey as w, themeTokens as x, runtimeLimits as y, parseOrThrow as z };
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as pluginStorageLimits, B as LocalizedText, D as parsePluginStorageKey, F as parseFileOptions, G as
|
|
1
|
+
import { A as pluginStorageLimits, B as LocalizedText, D as parsePluginStorageKey, F as parseFileOptions, G as parseDefinition, I as ImageRenderOptions, K as themeColors, L as RenderedImage, M as FileOpenResult, N as FileSaveOptions, O as parsePluginStorageRecord, P as fileTextLimit, R as PluginError, S as checkMessageSize, U as Definition, V as resolvePluginText, _ as parsePluginMessage, a as ActionDescriptor, b as sha256Hex, c as PluginI18n, d as badgeLimits, f as createPluginClient, g as parsePluginManifest, h as parsePluginI18n, i as ActionContribution, j as FileOpenOptions, k as parsePluginStorageSnapshot, l as PluginManifest, m as parseContribution, n as ActionBadgeResult, o as ActionIconName, p as parseActionBadgeResult, r as ActionContext, s as ActionState, t as ActionBadgeInput, u as actionIconNames, v as pluginApiVersion, x as themeTokens, y as runtimeLimits, z as parseOrThrow } from "./runtime-BgIX6ayx.js";
|
|
2
2
|
export { ActionBadgeInput, ActionBadgeResult, ActionContext, ActionContribution, ActionDescriptor, ActionIconName, ActionState, type Definition, type FileOpenOptions, type FileOpenResult, type FileSaveOptions, type ImageRenderOptions, type LocalizedText, PluginError, PluginI18n, PluginManifest, type RenderedImage, actionIconNames, badgeLimits, checkMessageSize, createPluginClient, fileTextLimit, parseActionBadgeResult, parseContribution, parseDefinition, parseFileOptions, parseOrThrow, parsePluginI18n, parsePluginManifest, parsePluginMessage, parsePluginStorageKey, parsePluginStorageRecord, parsePluginStorageSnapshot, pluginApiVersion, pluginStorageLimits, resolvePluginText, runtimeLimits, sha256Hex, themeColors, themeTokens };
|
package/dist/runtime.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { C as PluginError, t as actionIconNames, n as badgeLimits, _ as checkMessageSize, r as createPluginClient, x as fileTextLimit, i as parseActionBadgeResult, a as parseContribution, y as parseDefinition, S as parseFileOptions, w as parseOrThrow, o as parsePluginI18n, s as parsePluginManifest, c as parsePluginMessage, p as parsePluginStorageKey, m as parsePluginStorageRecord, h as parsePluginStorageSnapshot, l as pluginApiVersion, g as pluginStorageLimits, v as resolvePluginText, u as runtimeLimits, d as sha256Hex, b as themeColors, f as themeTokens } from "./runtime-
|
|
1
|
+
export { C as PluginError, t as actionIconNames, n as badgeLimits, _ as checkMessageSize, r as createPluginClient, x as fileTextLimit, i as parseActionBadgeResult, a as parseContribution, y as parseDefinition, S as parseFileOptions, w as parseOrThrow, o as parsePluginI18n, s as parsePluginManifest, c as parsePluginMessage, p as parsePluginStorageKey, m as parsePluginStorageRecord, h as parsePluginStorageSnapshot, l as pluginApiVersion, g as pluginStorageLimits, v as resolvePluginText, u as runtimeLimits, d as sha256Hex, b as themeColors, f as themeTokens } from "./runtime-BXlQ2vrU.js";
|
package/example/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nesso-how/plugin-example",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.22",
|
|
4
4
|
"description": "Official example showing how to build Nesso plugins with the SDK and plugin APIs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nesso-plugin"
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
"prepack": "npm run build"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@nesso-how/ui": "1.0.0-beta.
|
|
31
|
+
"@nesso-how/ui": "1.0.0-beta.22",
|
|
32
32
|
"react": "^19.2.8",
|
|
33
33
|
"react-dom": "^19.2.8"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@nesso-how/plugin": "1.0.0-beta.
|
|
36
|
+
"@nesso-how/plugin": "1.0.0-beta.22",
|
|
37
37
|
"@types/react": "^19.2.18",
|
|
38
38
|
"@types/react-dom": "^19.2.7",
|
|
39
39
|
"typescript": "~7.0.2",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
"nesso": {
|
|
57
|
-
"apiVersion":
|
|
57
|
+
"apiVersion": 5,
|
|
58
58
|
"kind": "actions",
|
|
59
59
|
"entry": "dist/index.js",
|
|
60
60
|
"writes": [
|