@signalsafe/tree-spec-editor 0.2.2 → 0.3.0
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 +132 -33
- package/dist/index.d.ts +39 -41
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -26
- package/dist/lib/PanelHeaderCollapseCarets.d.ts.map +1 -1
- package/dist/lib/PanelHeaderCollapseCarets.js +2 -1
- package/dist/lib/panelHelpers.d.ts +8 -1
- package/dist/lib/panelHelpers.d.ts.map +1 -1
- package/dist/lib/panelHelpers.js +14 -6
- package/dist/lib/panelNodeLink.d.ts.map +1 -1
- package/dist/lib/panelNodeLink.js +2 -1
- package/dist/lib/selectionStyles.d.ts +6 -6
- package/dist/lib/selectionStyles.d.ts.map +1 -1
- package/dist/lib/selectionStyles.js +6 -6
- package/dist/modals/AuditLogModal.d.ts +0 -6
- package/dist/modals/AuditLogModal.d.ts.map +1 -1
- package/dist/modals/AuditLogModal.js +6 -5
- package/dist/modals/DraftHistoryModal.d.ts +0 -10
- package/dist/modals/DraftHistoryModal.d.ts.map +1 -1
- package/dist/modals/DraftHistoryModal.js +6 -5
- package/dist/modals/PublishReviewModal.d.ts.map +1 -1
- package/dist/modals/PublishReviewModal.js +3 -2
- package/dist/panels/AdvancedJsonPanel.d.ts +1 -1
- package/dist/panels/AdvancedJsonPanel.d.ts.map +1 -1
- package/dist/panels/AdvancedJsonPanel.js +4 -4
- package/dist/panels/AppearancePanel.d.ts +1 -1
- package/dist/panels/AppearancePanel.d.ts.map +1 -1
- package/dist/panels/AppearancePanel.js +9 -11
- package/dist/panels/ChoiceEdgeAppearanceFields.d.ts.map +1 -1
- package/dist/panels/ChoiceEdgeAppearanceFields.js +4 -3
- package/dist/panels/ChoiceTemplatesPanel.d.ts.map +1 -1
- package/dist/panels/ChoiceTemplatesPanel.js +4 -3
- package/dist/panels/GraphEditorInfoPanel.d.ts.map +1 -1
- package/dist/panels/GraphEditorInfoPanel.js +6 -5
- package/dist/panels/InspectorPanel.d.ts +2 -2
- package/dist/panels/InspectorPanel.d.ts.map +1 -1
- package/dist/panels/InspectorPanel.js +5 -5
- package/dist/panels/IssuesPanel.d.ts.map +1 -1
- package/dist/panels/IssuesPanel.js +7 -8
- package/dist/panels/NodesPanel.d.ts.map +1 -1
- package/dist/panels/NodesPanel.js +9 -8
- package/dist/panels/SelectedEdgePanel.d.ts +2 -2
- package/dist/panels/SelectedEdgePanel.d.ts.map +1 -1
- package/dist/panels/SelectedEdgePanel.js +4 -3
- package/dist/panels/ToolbarPanel.d.ts +6 -18
- package/dist/panels/ToolbarPanel.d.ts.map +1 -1
- package/dist/panels/ToolbarPanel.js +10 -24
- package/dist/panels/inspector/ChoiceEditorCard.d.ts +1 -1
- package/dist/panels/inspector/ChoiceEditorCard.d.ts.map +1 -1
- package/dist/panels/inspector/ChoiceEditorCard.js +7 -6
- package/dist/panels/inspector/ChoiceEditorList.d.ts +1 -1
- package/dist/panels/inspector/ChoiceEditorList.d.ts.map +1 -1
- package/dist/panels/inspector/ChoiceEditorList.js +5 -3
- package/dist/panels/inspector/NodeTypeField.d.ts.map +1 -1
- package/dist/panels/inspector/NodeTypeField.js +4 -3
- package/dist/panels/inspector/RequiredNodeCard.d.ts +1 -1
- package/dist/panels/inspector/RequiredNodeCard.d.ts.map +1 -1
- package/dist/panels/inspector/RequiredNodeCard.js +5 -4
- package/dist/panels/inspector/choiceActionIconProps.d.ts +3 -2
- package/dist/panels/inspector/choiceActionIconProps.d.ts.map +1 -1
- package/dist/panels/inspector/choiceActionIconProps.js +4 -2
- package/dist/ui/editorClasses.d.ts +66 -0
- package/dist/ui/editorClasses.d.ts.map +1 -0
- package/dist/ui/editorClasses.js +89 -0
- package/dist/ui/primitives.d.ts +23 -0
- package/dist/ui/primitives.d.ts.map +1 -0
- package/dist/ui/primitives.js +32 -0
- package/docs/UI_KIT_AGNOSTIC_REFACTOR.md +186 -0
- package/docs/UI_KIT_AGNOSTIC_USAGE.md +129 -0
- package/package.json +11 -9
package/README.md
CHANGED
|
@@ -1,42 +1,141 @@
|
|
|
1
1
|
# `@signalsafe/tree-spec-editor`
|
|
2
2
|
|
|
3
|
-
React
|
|
3
|
+
React **UI-kit agnostic shell** for authoring TreeSpec graphs: canvas (from `@signalsafe/tree-spec-editor-react`), sidebar panels, modals, and toolbar helpers. Hosts style panels with Bootstrap, Material UI, or custom CSS via `graph-editor-*` class hooks.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
| | |
|
|
6
|
+
|---|---|
|
|
7
|
+
| **npm** | `@signalsafe/tree-spec-editor` |
|
|
8
|
+
| **GitHub** | [SignalSafeSoftware/tree-spec-editor](https://github.com/SignalSafeSoftware/tree-spec-editor) |
|
|
9
|
+
| **Peer deps** | `react`, `react-dom`, `reactflow` |
|
|
10
|
+
|
|
11
|
+
## What this package does
|
|
12
|
+
|
|
13
|
+
- Ships a ready-to-embed **graph editor UI** (`TreeSpecGraphEditor` re-export, panels, modals, toolbar).
|
|
14
|
+
- Re-exports selected **editor-core helpers** and types for one-stop imports in React hosts.
|
|
15
|
+
|
|
16
|
+
## What this package does not do
|
|
17
|
+
|
|
18
|
+
- Routing, REST/GraphQL clients, or authentication — your host app loads/saves drafts and enforces permissions.
|
|
19
|
+
- Wire compile/publish without your adapter — use `useTreeSpecEditor` from `@signalsafe/tree-spec-editor-react` with a host adapter.
|
|
20
|
+
- React Flow CSS by itself — the canvas lives in `-editor-react`; **consumers may need** `import 'reactflow/dist/style.css'` in the app entry (see `@signalsafe/tree-spec-editor-react` README). This package keeps `sideEffects: false` because it does not import CSS directly.
|
|
21
|
+
|
|
22
|
+
## Package stack
|
|
23
|
+
|
|
24
|
+
| Layer | Package |
|
|
25
|
+
|---|---|
|
|
26
|
+
| Wire | `@signalsafe/tree-spec` |
|
|
27
|
+
| Editor model | `@signalsafe/tree-spec-editor-core` |
|
|
28
|
+
| React Flow canvas | `@signalsafe/tree-spec-editor-react` |
|
|
29
|
+
| **UI shell (this package)** | `@signalsafe/tree-spec-editor` |
|
|
6
30
|
|
|
7
31
|
## Install
|
|
8
32
|
|
|
9
33
|
```bash
|
|
10
|
-
npm install @signalsafe/tree-spec-editor react react-dom reactflow
|
|
34
|
+
npm install @signalsafe/tree-spec-editor @signalsafe/tree-spec-editor-react @signalsafe/tree-spec-editor-core @signalsafe/tree-spec react react-dom reactflow
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Import React Flow CSS as documented in `@signalsafe/tree-spec-editor-react`. **Bootstrap is not required** — the host styles panels via `graph-editor-*` class hooks (see below).
|
|
38
|
+
|
|
39
|
+
## UI-kit agnostic styling
|
|
40
|
+
|
|
41
|
+
This package renders **semantic HTML** with stable **`graph-editor-*` classes**. Your app owns Bootstrap, Material UI, Tailwind, or plain CSS.
|
|
42
|
+
|
|
43
|
+
**Docs:** [docs/UI_KIT_AGNOSTIC_USAGE.md](./docs/UI_KIT_AGNOSTIC_USAGE.md) (class hooks, render props, DeliveryPlus migration).
|
|
44
|
+
|
|
45
|
+
### Minimal plain HTML example
|
|
46
|
+
|
|
47
|
+
Panels work without any UI library once you map the hooks:
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
import { ToolbarPanel, IssuesPanel } from '@signalsafe/tree-spec-editor';
|
|
51
|
+
|
|
52
|
+
// Host CSS (global stylesheet or CSS module)
|
|
53
|
+
const editorStyles = `
|
|
54
|
+
.graph-editor-card { border: 1px solid #ccc; border-radius: 6px; margin-bottom: 1rem; }
|
|
55
|
+
.graph-editor-card__header { padding: 0.5rem 0.75rem; background: #f5f5f5; font-weight: 600; }
|
|
56
|
+
.graph-editor-list__item { padding: 0.5rem 0.75rem; border-top: 1px solid #eee; }
|
|
57
|
+
.graph-editor-list__item--selected { background: #e7f1ff; }
|
|
58
|
+
.graph-editor-btn { padding: 0.25rem 0.75rem; border: 1px solid #999; border-radius: 4px; background: #fff; }
|
|
59
|
+
.graph-editor-badge--error { background: #dc3545; color: #fff; padding: 0.1rem 0.4rem; border-radius: 4px; }
|
|
60
|
+
`;
|
|
61
|
+
|
|
62
|
+
export function EditorChrome() {
|
|
63
|
+
return (
|
|
64
|
+
<>
|
|
65
|
+
<style>{editorStyles}</style>
|
|
66
|
+
<ToolbarPanel items={[{ kind: 'button', id: 'save', label: 'Save', onClick: () => {} }]} />
|
|
67
|
+
<IssuesPanel issues={[]} lastValidatedAt={null} onSelectIssue={() => {}} />
|
|
68
|
+
</>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Optional: Bootstrap styling in the host app (not a package requirement)
|
|
74
|
+
|
|
75
|
+
If your host already uses Bootstrap, add **host-owned** CSS that maps hooks to Bootstrap utilities — the package does not import Bootstrap:
|
|
76
|
+
|
|
77
|
+
```css
|
|
78
|
+
/* Host app: graph-editor-bootstrap-bridge.css (example) */
|
|
79
|
+
.graph-editor-card { /* mirror .card rules or @import bootstrap */ }
|
|
80
|
+
.graph-editor-btn--neutral { /* mirror .btn.btn-outline-secondary */ }
|
|
81
|
+
.graph-editor-list__item--selected { /* mirror .list-group-item-primary */ }
|
|
82
|
+
.graph-editor-badge--error { /* mirror .badge.text-bg-danger */ }
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Development
|
|
86
|
+
|
|
87
|
+
Requires Node.js **>=22.12.0** (`engines.node`). CI runs checks, tests, and smoke on Node **22** and **24**; publish uses Node **24**. Node 20 is no longer supported (GitHub Actions Node 20 deprecation).
|
|
88
|
+
|
|
89
|
+
`yarn build` uses `tsconfig.build.json` and resolves `@signalsafe/*` from `node_modules`. Ecosystem sibling `paths` in `tsconfig.json` apply to local typecheck/tests only.
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
yarn install
|
|
93
|
+
yarn build
|
|
94
|
+
yarn test
|
|
95
|
+
yarn typecheck
|
|
11
96
|
```
|
|
12
97
|
|
|
13
|
-
|
|
98
|
+
## Security
|
|
99
|
+
|
|
100
|
+
See [SECURITY.md](./SECURITY.md). Host applications must enforce authorization, validate TreeSpec server-side, and control publish permissions.
|
|
101
|
+
|
|
102
|
+
## Changelog and releases
|
|
103
|
+
|
|
104
|
+
- [CHANGELOG.md](./CHANGELOG.md)
|
|
105
|
+
- [RELEASING.md](./RELEASING.md)
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Detailed component reference
|
|
110
|
+
|
|
111
|
+
The sections below document panels, modals, toolbar items, and integration patterns. Import from **`@signalsafe/tree-spec-editor`** package root only (no subpath exports).
|
|
14
112
|
|
|
15
113
|
## Source layout (maintainers)
|
|
16
114
|
|
|
17
|
-
Published consumers import only the package root
|
|
115
|
+
Published consumers import only the package root. Layer stack:
|
|
18
116
|
|
|
19
117
|
| Layer | Package | Owns |
|
|
20
118
|
|-------|---------|------|
|
|
21
119
|
| Wire | [`@signalsafe/tree-spec`](../tree-spec/README.md) | TreeSpec wire types, constants, compile/lint. Pure TS. |
|
|
22
120
|
| Core | [`@signalsafe/tree-spec-editor-core`](../tree-spec-editor-core/README.md) | Editor model, tree operations, layout/autosave/keyboard helpers, constants. Pure TS. |
|
|
23
121
|
| React | [`@signalsafe/tree-spec-editor-react`](../tree-spec-editor-react/README.md) | React Flow canvas (`TreeSpecGraphEditor`). React-specific, UI-library-agnostic. |
|
|
24
|
-
| Shell | **`@signalsafe/tree-spec-editor`** (this package) |
|
|
122
|
+
| Shell | **`@signalsafe/tree-spec-editor`** (this package) | UI-kit agnostic panels, modals, toolbar (`graph-editor-*` hooks). Re-exports canvas from `-react` and helpers from `-core`. |
|
|
25
123
|
|
|
26
124
|
| Directory | Contents |
|
|
27
125
|
|-----------|----------|
|
|
28
|
-
| `src/panels/` | Sidebar, toolbar, inspector, and JSON chrome components (
|
|
29
|
-
| `src/modals/` | Publish review, draft history, and audit log dialogs (
|
|
30
|
-
| `src/
|
|
126
|
+
| `src/panels/` | Sidebar, toolbar, inspector, and JSON chrome components (UI-kit agnostic React) |
|
|
127
|
+
| `src/modals/` | Publish review, draft history, and audit log dialogs (UI-kit agnostic React) |
|
|
128
|
+
| `src/ui/` | UI-kit agnostic primitives and `graph-editor-*` class tokens |
|
|
129
|
+
| `src/lib/panelHelpers.ts` | `getIssueSeverityToken`, `getIssueSeverityBadgeClass` (semantic badge hooks) |
|
|
31
130
|
| `src/index.ts` | Public barrel — **do not** import from subpaths in apps. Re-exports the canvas from `@signalsafe/tree-spec-editor-react` and the framework-agnostic surface from `@signalsafe/tree-spec-editor-core` |
|
|
32
131
|
|
|
33
|
-
Tests live under `tests/panels/`, `tests/modals/`,
|
|
132
|
+
Tests live under `tests/panels/`, `tests/modals/`, and `tests/index.test.ts` in this repo. Canvas tests live in **`tree-spec-editor-react`**; core helper tests live in **`tree-spec-editor-core`**.
|
|
34
133
|
|
|
35
134
|
## Choosing the right package
|
|
36
135
|
|
|
37
136
|
| You want… | Import from |
|
|
38
137
|
|----------|-------------|
|
|
39
|
-
| The full React
|
|
138
|
+
| The full React editor shell (canvas + panels + modals + toolbar) | `@signalsafe/tree-spec-editor` (this package) |
|
|
40
139
|
| Just the canvas, with your own UI library (Material / Tailwind / custom) | `@signalsafe/tree-spec-editor-react` |
|
|
41
140
|
| Just the framework-agnostic helpers (CLI, server-side preview, Angular shell) | `@signalsafe/tree-spec-editor-core` |
|
|
42
141
|
| Just the wire contract (validation, compile, lint) | `@signalsafe/tree-spec` |
|
|
@@ -49,16 +148,16 @@ Tests live under `tests/panels/`, `tests/modals/`, plus `tests/index.test.ts` fo
|
|
|
49
148
|
| Angular editor | `@signalsafe/tree-spec-editor-angular` (planned) + `-core` |
|
|
50
149
|
| Vue editor | `@signalsafe/tree-spec-editor-vue` (planned) + `-core` |
|
|
51
150
|
|
|
52
|
-
This package
|
|
151
|
+
This package is **UI-kit agnostic** — it does not ship Material, Angular, or Vue implementations. Hosts style with their own UI library or CSS. A future `@signalsafe/tree-spec-editor-bootstrap` may offer a reference Bootstrap skin.
|
|
53
152
|
|
|
54
|
-
See [
|
|
153
|
+
See package READMEs in the [`tree-spec-editor-core`](https://github.com/SignalSafeSoftware/tree-spec-editor-core) and [`tree-spec-editor-react`](https://github.com/SignalSafeSoftware/tree-spec-editor-react) repos for layer rules.
|
|
55
154
|
|
|
56
|
-
##
|
|
155
|
+
## Host import pattern
|
|
57
156
|
|
|
58
|
-
|
|
157
|
+
Typical host apps import from **three** packages:
|
|
59
158
|
|
|
60
159
|
```tsx
|
|
61
|
-
//
|
|
160
|
+
// UI shell — panels, modals, toolbar, canvas default export
|
|
62
161
|
import TreeSpecGraphEditor, { AppearancePanel, buildDefaultToolbarSpec, … } from '@signalsafe/tree-spec-editor';
|
|
63
162
|
|
|
64
163
|
// Stateful orchestration hook (not re-exported from the shell barrel)
|
|
@@ -78,9 +177,9 @@ The smallest useful integration is:
|
|
|
78
177
|
2. Render `TreeSpecGraphEditor`.
|
|
79
178
|
3. Replace the state value in `onChange`.
|
|
80
179
|
|
|
81
|
-
The
|
|
180
|
+
The example below uses a minimal in-memory tree (screenshot assets are not bundled in the npm package).
|
|
82
181
|
|
|
83
|
-
|
|
182
|
+
<!-- Screenshot: add your own capture when integrating the editor in your app -->
|
|
84
183
|
|
|
85
184
|
```tsx
|
|
86
185
|
import { useState, type JSX } from 'react';
|
|
@@ -161,7 +260,7 @@ export function ExampleTreeSpecEditor(): JSX.Element {
|
|
|
161
260
|
- `LIST_SELECTION_CLASS`, `CANVAS_SELECTION_CLASS`, …: shared CSS class helpers for list/canvas selection highlighting.
|
|
162
261
|
- `buildDefaultToolbarSpec`: builds the default action toolbar (`+ Add`, Templates, layout, Undo/Redo, validate/history/audit/snapshot/clone, save/publish/preview) without status chrome — draft/autosave live in `GraphEditorInfoPanel`.
|
|
163
262
|
- `PublishReviewModal`, `DraftHistoryModal`, `AuditLogModal`: presentational modals for the publish-review / draft-snapshot / audit-log authoring flows; all strings are overridable.
|
|
164
|
-
- `ToolbarPanel`: data-driven toolbar that takes an `items: ToolbarItem[]` array (`button` / `dropdown` / `badge` / `text` / `custom` kinds) and renders
|
|
263
|
+
- `ToolbarPanel`: data-driven toolbar that takes an `items: ToolbarItem[]` array (`button` / `dropdown` / `badge` / `text` / `custom` kinds) and renders semantic HTML with `graph-editor-*` classes in a single flex wrapper.
|
|
165
264
|
- `duplicateNode`, `deleteNode`, `computeTreeDiffSummary`, `applyTreeTemplate`: project-agnostic tree-operation helpers (clone a node, delete a node with cascade, summarize a structural diff, insert a reusable subgraph template).
|
|
166
265
|
- `getAutosaveStatusLabel`, `getKeyboardShortcutAction`, `shouldQueueInitialValidation`: editor-lifecycle helpers (default autosave label, default keyboard-shortcut mapper, "should we validate on load?" tri-state policy).
|
|
167
266
|
- `AUTOSAVE_STATUS`, `KEYBOARD_SHORTCUT_ACTION`, `GRAPH_SELECTION_KIND`, `TOOLBAR_ITEM_KIND`: runtime constant objects for the matching string-union types. Use these instead of bare string literals (`AUTOSAVE_STATUS.SAVING`, `KEYBOARD_SHORTCUT_ACTION.SAVE`, `GRAPH_SELECTION_KIND.NODE`, `TOOLBAR_ITEM_KIND.BUTTON`). The types (`AutosaveStatus`, `KeyboardShortcutAction`, `GraphSelectionKind`, `ToolbarItemKind`) are derived from these constants.
|
|
@@ -171,7 +270,7 @@ export function ExampleTreeSpecEditor(): JSX.Element {
|
|
|
171
270
|
- `GraphSelection` and `GraphEditorIssue`: optional selection and issue-display types.
|
|
172
271
|
- `autoLayoutTree` and `getNextSpawnPosition`: layout helpers for placing nodes.
|
|
173
272
|
- `lintEditorTree`, `getTransition`, `upsertTransition`, `deleteTransitionsForChoice`: editor helpers for validation and transition updates.
|
|
174
|
-
- `buildStableEntries`, `getIssueSeverityBadgeClass`: small helpers reused by the sidebar panels and available for hosts that compose their own UI.
|
|
273
|
+
- `buildStableEntries`, `getIssueSeverityBadgeClass`, `getIssueSeverityToken`: small helpers reused by the sidebar panels and available for hosts that compose their own UI.
|
|
175
274
|
|
|
176
275
|
## Feature Examples
|
|
177
276
|
|
|
@@ -179,9 +278,9 @@ export function ExampleTreeSpecEditor(): JSX.Element {
|
|
|
179
278
|
|
|
180
279
|
Pass `issues` when you want the editor to highlight problem nodes and edges.
|
|
181
280
|
|
|
182
|
-
The
|
|
281
|
+
The example below demonstrates validation highlighting (screenshot assets are not bundled in the npm package).
|
|
183
282
|
|
|
184
|
-
|
|
283
|
+
<!-- Screenshot: add your own capture when integrating the editor in your app -->
|
|
185
284
|
|
|
186
285
|
```tsx
|
|
187
286
|
import { useMemo, useState, type JSX } from 'react';
|
|
@@ -341,7 +440,7 @@ The package also ships two presentational components for the editor's left rail.
|
|
|
341
440
|
|
|
342
441
|
### `IssuesPanel`
|
|
343
442
|
|
|
344
|
-
Renders a
|
|
443
|
+
Renders a **card** (`graph-editor-card`) matching **`NodesPanel`** chrome: header plus flush list body. Each issue row mirrors the **Nodes** header rhythm: **truncated `node id, type`** on the left (type resolved from the optional **`tree`** prop), **severity** as a **`graph-editor-badge`** on the right, then the **message** (monospace) and optional **choice id** line. The empty state is a single list item. Clicking a row invokes `onSelectIssue`.
|
|
345
444
|
|
|
346
445
|
```tsx
|
|
347
446
|
import { useMemo, useState, type JSX } from 'react';
|
|
@@ -480,7 +579,7 @@ export function CompiledTreeSpecPanel({ tree }: Props): JSX.Element {
|
|
|
480
579
|
|
|
481
580
|
### `InspectorPanel`
|
|
482
581
|
|
|
483
|
-
The right-rail node inspector. When a node is in context (selected directly, or as the source of a selected edge), it renders two
|
|
582
|
+
The right-rail node inspector. When a node is in context (selected directly, or as the source of a selected edge), it renders two cards: **Required** (Type, Prompt, and `renderExtraNodeFields`) and **Choices** (list rows). The universal fields the package owns:
|
|
484
583
|
|
|
485
584
|
- **Type** `<select>` (with the package's `TREE_SPEC_NODE_TYPE_PRESETS` + custom-value input, or a host-supplied **choice type** catalog via `choiceTypes` / `onSetChoiceType`).
|
|
486
585
|
- **Prompt** `<textarea>`.
|
|
@@ -611,7 +710,7 @@ Right-rail panel for **canvas-only** styling. Combines:
|
|
|
611
710
|
|
|
612
711
|
Scenario-level default edge routing lives in `GraphEditorInfoPanel`, not here.
|
|
613
712
|
|
|
614
|
-
Hosts typically pair node fields with a project-specific component
|
|
713
|
+
Hosts typically pair node fields with a project-specific component:
|
|
615
714
|
|
|
616
715
|
```tsx
|
|
617
716
|
import { AppearancePanel, InspectorPanel } from '@signalsafe/tree-spec-editor';
|
|
@@ -646,7 +745,7 @@ Optional compact read-only card that surfaces the currently selected transition.
|
|
|
646
745
|
|
|
647
746
|
## Modals
|
|
648
747
|
|
|
649
|
-
Three presentational modals cover the standard TreeSpec authoring flows. Each
|
|
748
|
+
Three presentational modals cover the standard TreeSpec authoring flows. Each uses a native `<dialog>` with `graph-editor-modal-*` classes, owns its list/empty/loading rendering, and exposes overridable `title` / `subtitle` / `emptyStateText` / button-label props so the package stays free of project-specific wording. Hosts wire the data, fetch on `show`, and provide callbacks.
|
|
650
749
|
|
|
651
750
|
### `PublishReviewModal`
|
|
652
751
|
|
|
@@ -759,7 +858,7 @@ function DraftHistoryModalContainer({
|
|
|
759
858
|
|
|
760
859
|
### `AuditLogModal`
|
|
761
860
|
|
|
762
|
-
A modal that lists authoring audit events for the current tree_spec version. Each row shows the `action` as a
|
|
861
|
+
A modal that lists authoring audit events for the current tree_spec version. Each row shows the `action` as a badge, the formatted `created_at` timestamp, the optional `actor` (numeric id or string), and the optional `detail` JSON. The host owns the `auditEvents: TreeSpecAuditEventItem[]` array and the `loadingAudit` flag.
|
|
763
862
|
|
|
764
863
|
```tsx
|
|
765
864
|
import { AuditLogModal, type TreeSpecAuditEventItem } from '@signalsafe/tree-spec-editor';
|
|
@@ -828,7 +927,7 @@ const items = buildDefaultToolbarSpec({
|
|
|
828
927
|
### `ToolbarPanel`
|
|
829
928
|
|
|
830
929
|
A data-driven toolbar for editor pages. Hosts pass an `items: ToolbarItem[]`
|
|
831
|
-
array; the package renders
|
|
930
|
+
array; the package renders semantic toolbar markup (`<button>`, `<details>` menu, badges,
|
|
832
931
|
muted text) inside a single flex wrapper. Project-specific concerns —
|
|
833
932
|
adapter capability gates, dropdown vocabularies, button labels, and disabled
|
|
834
933
|
rules — stay in the host as closures inside each item. Prefer
|
|
@@ -861,10 +960,10 @@ const items: ToolbarItem[] = [
|
|
|
861
960
|
|
|
862
961
|
**Item kinds.** Each `ToolbarItem` is one of:
|
|
863
962
|
|
|
864
|
-
- `kind: 'button'`: `label`, `onClick`, optional `variant` (Bootstrap variant string
|
|
865
|
-
- `kind: 'dropdown'`: `label`, `entries` (array of `{ id?, label, onClick?, disabled?, divider? }`), optional `variant` (toggle
|
|
866
|
-
- `kind: 'badge'`: `label`, optional `variant` (
|
|
867
|
-
- `kind: 'text'`: `content`, optional `className` (default
|
|
963
|
+
- `kind: 'button'`: `label`, `onClick`, optional `variant` (tone hook or legacy Bootstrap variant string — mapped to `graph-editor-btn--*`), `disabled`, `title`, `className`.
|
|
964
|
+
- `kind: 'dropdown'`: `label`, `entries` (array of `{ id?, label, onClick?, disabled?, divider? }`), optional `variant` (toggle tone), `disabled`, `className`. Entries with `divider: true` render a menu divider.
|
|
965
|
+
- `kind: 'badge'`: `label`, optional `variant` (tone hook) or full `className` override.
|
|
966
|
+
- `kind: 'text'`: `content`, optional `className` (default muted toolbar text classes).
|
|
868
967
|
- `kind: 'custom'`: `render: () => ReactNode` for one-offs the package shouldn't know about (e.g. `<Link>` from `react-router-dom`).
|
|
869
968
|
|
|
870
969
|
Every item supports an optional `id` used as the React key. `ToolbarPanel` also accepts an optional `className` to override the outer wrapper styling.
|
|
@@ -1145,7 +1244,7 @@ function addPromptNode(tree: EditorTree): EditorTree {
|
|
|
1145
1244
|
## Notes
|
|
1146
1245
|
|
|
1147
1246
|
- Import from the package root only.
|
|
1148
|
-
- Install `react`, `react-dom`,
|
|
1247
|
+
- Install `react`, `react-dom`, and `reactflow` in the consuming app. Style panels with your UI library or CSS targeting `graph-editor-*` classes.
|
|
1149
1248
|
- If you need wire-format compile/decompile helpers, use `@signalsafe/tree-spec`.
|
|
1150
1249
|
|
|
1151
1250
|
## Repository
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @packageDocumentation
|
|
3
|
-
*
|
|
3
|
+
* UI-kit agnostic TreeSpec graph editor shell.
|
|
4
4
|
*
|
|
5
5
|
* Layered architecture:
|
|
6
6
|
* - `@signalsafe/tree-spec` — wire contract (pure TS, no UI).
|
|
@@ -8,53 +8,51 @@
|
|
|
8
8
|
* and constants (no React, no DOM).
|
|
9
9
|
* - `@signalsafe/tree-spec-editor-react` — headless React: React Flow canvas
|
|
10
10
|
* (no UI library).
|
|
11
|
-
* - **`@signalsafe/tree-spec-editor`** (this package) —
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* The framework-agnostic surface from `-core` and the canvas from `-react`
|
|
15
|
-
* are re-exported from this barrel for consumer convenience. Hosts targeting
|
|
16
|
-
* alternative UI libraries (e.g. Material) should consume `-react` plus their
|
|
17
|
-
* own UI shell instead.
|
|
11
|
+
* - **`@signalsafe/tree-spec-editor`** (this package) — composable panels,
|
|
12
|
+
* modals, toolbar, and semantic `graph-editor-*` class hooks. Hosts style
|
|
13
|
+
* with Bootstrap, Material UI, or custom CSS.
|
|
18
14
|
*
|
|
19
15
|
* Source layout:
|
|
20
16
|
* - `panels/` — sidebar / toolbar / inspector presentational components
|
|
21
17
|
* - `modals/` — authoring-flow dialogs
|
|
22
|
-
* - `
|
|
18
|
+
* - `ui/` — UI-kit agnostic primitives and class tokens
|
|
19
|
+
* - `lib/` — panel helpers and toolbar builders
|
|
23
20
|
*/
|
|
24
21
|
export { default } from '@signalsafe/tree-spec-editor-react';
|
|
25
22
|
export type { TreeSpecGraphEditorProps, GraphEditorVersionInfo } from '@signalsafe/tree-spec-editor-react';
|
|
26
|
-
export { default as IssuesPanel } from './panels/IssuesPanel';
|
|
27
|
-
export type { IssuesPanelProps } from './panels/IssuesPanel';
|
|
28
|
-
export { default as GraphEditorInfoPanel } from './panels/GraphEditorInfoPanel';
|
|
29
|
-
export type { GraphEditorInfoPanelProps } from './panels/GraphEditorInfoPanel';
|
|
30
|
-
export { default as NodesPanel } from './panels/NodesPanel';
|
|
31
|
-
export type { NodesPanelProps } from './panels/NodesPanel';
|
|
32
|
-
export { default as AdvancedJsonPanel } from './panels/AdvancedJsonPanel';
|
|
33
|
-
export type { AdvancedJsonPanelProps } from './panels/AdvancedJsonPanel';
|
|
34
|
-
export { default as InspectorPanel, DEFAULT_OUTCOME_OPTIONS } from './panels/InspectorPanel';
|
|
35
|
-
export type { InspectorPanelProps, InspectorNodeRenderContext, InspectorChoiceRenderContext, } from './panels/InspectorPanel';
|
|
36
|
-
export { default as AppearancePanel } from './panels/AppearancePanel';
|
|
37
|
-
export type { AppearancePanelProps } from './panels/AppearancePanel';
|
|
38
|
-
export { default as SelectedEdgePanel } from './panels/SelectedEdgePanel';
|
|
39
|
-
export type { SelectedEdgePanelProps } from './panels/SelectedEdgePanel';
|
|
40
|
-
export { default as ChoiceTemplatesPanel } from './panels/ChoiceTemplatesPanel';
|
|
41
|
-
export type { ChoiceTemplatesPanelProps, ChoiceTemplateItem, ChoicePresetItem } from './panels/ChoiceTemplatesPanel';
|
|
42
|
-
export type { ChoiceTypeOption } from './panels/InspectorPanel';
|
|
43
|
-
export { default as ChoiceEdgeAppearanceFields } from './panels/ChoiceEdgeAppearanceFields';
|
|
44
|
-
export type { ChoiceEdgeAppearanceFieldsProps } from './panels/ChoiceEdgeAppearanceFields';
|
|
45
|
-
export { default as PublishReviewModal } from './modals/PublishReviewModal';
|
|
46
|
-
export type { PublishReviewModalProps } from './modals/PublishReviewModal';
|
|
47
|
-
export { default as DraftHistoryModal } from './modals/DraftHistoryModal';
|
|
48
|
-
export type { DraftHistoryModalProps } from './modals/DraftHistoryModal';
|
|
49
|
-
export { default as AuditLogModal } from './modals/AuditLogModal';
|
|
50
|
-
export type { AuditLogModalProps } from './modals/AuditLogModal';
|
|
51
|
-
export { default as ToolbarPanel, TOOLBAR_ITEM_KIND } from './panels/ToolbarPanel';
|
|
52
|
-
export type { ToolbarPanelProps, ToolbarItem, ToolbarItemKind, ToolbarButtonItem, ToolbarDropdownItem, ToolbarDropdownEntry, ToolbarBadgeItem, ToolbarTextItem, ToolbarCustomItem, } from './panels/ToolbarPanel';
|
|
53
|
-
export { getIssueSeverityBadgeClass } from './lib/panelHelpers';
|
|
54
|
-
export {
|
|
55
|
-
export {
|
|
56
|
-
export {
|
|
57
|
-
export
|
|
23
|
+
export { default as IssuesPanel } from './panels/IssuesPanel.js';
|
|
24
|
+
export type { IssuesPanelProps } from './panels/IssuesPanel.js';
|
|
25
|
+
export { default as GraphEditorInfoPanel } from './panels/GraphEditorInfoPanel.js';
|
|
26
|
+
export type { GraphEditorInfoPanelProps } from './panels/GraphEditorInfoPanel.js';
|
|
27
|
+
export { default as NodesPanel } from './panels/NodesPanel.js';
|
|
28
|
+
export type { NodesPanelProps } from './panels/NodesPanel.js';
|
|
29
|
+
export { default as AdvancedJsonPanel } from './panels/AdvancedJsonPanel.js';
|
|
30
|
+
export type { AdvancedJsonPanelProps } from './panels/AdvancedJsonPanel.js';
|
|
31
|
+
export { default as InspectorPanel, DEFAULT_OUTCOME_OPTIONS } from './panels/InspectorPanel.js';
|
|
32
|
+
export type { InspectorPanelProps, InspectorNodeRenderContext, InspectorChoiceRenderContext, } from './panels/InspectorPanel.js';
|
|
33
|
+
export { default as AppearancePanel } from './panels/AppearancePanel.js';
|
|
34
|
+
export type { AppearancePanelProps } from './panels/AppearancePanel.js';
|
|
35
|
+
export { default as SelectedEdgePanel } from './panels/SelectedEdgePanel.js';
|
|
36
|
+
export type { SelectedEdgePanelProps } from './panels/SelectedEdgePanel.js';
|
|
37
|
+
export { default as ChoiceTemplatesPanel } from './panels/ChoiceTemplatesPanel.js';
|
|
38
|
+
export type { ChoiceTemplatesPanelProps, ChoiceTemplateItem, ChoicePresetItem } from './panels/ChoiceTemplatesPanel.js';
|
|
39
|
+
export type { ChoiceTypeOption } from './panels/InspectorPanel.js';
|
|
40
|
+
export { default as ChoiceEdgeAppearanceFields } from './panels/ChoiceEdgeAppearanceFields.js';
|
|
41
|
+
export type { ChoiceEdgeAppearanceFieldsProps } from './panels/ChoiceEdgeAppearanceFields.js';
|
|
42
|
+
export { default as PublishReviewModal } from './modals/PublishReviewModal.js';
|
|
43
|
+
export type { PublishReviewModalProps } from './modals/PublishReviewModal.js';
|
|
44
|
+
export { default as DraftHistoryModal } from './modals/DraftHistoryModal.js';
|
|
45
|
+
export type { DraftHistoryModalProps } from './modals/DraftHistoryModal.js';
|
|
46
|
+
export { default as AuditLogModal } from './modals/AuditLogModal.js';
|
|
47
|
+
export type { AuditLogModalProps } from './modals/AuditLogModal.js';
|
|
48
|
+
export { default as ToolbarPanel, TOOLBAR_ITEM_KIND } from './panels/ToolbarPanel.js';
|
|
49
|
+
export type { ToolbarPanelProps, ToolbarItem, ToolbarItemKind, ToolbarButtonItem, ToolbarDropdownItem, ToolbarDropdownEntry, ToolbarBadgeItem, ToolbarTextItem, ToolbarCustomItem, } from './panels/ToolbarPanel.js';
|
|
50
|
+
export { getIssueSeverityBadgeClass, getIssueSeverityToken } from './lib/panelHelpers.js';
|
|
51
|
+
export type { IssueSeverityToken } from './lib/panelHelpers.js';
|
|
52
|
+
export { LIST_SELECTION_CLASS, CANVAS_SELECTION_CLASS, LIST_SELECTION_TEXT_CLASS, CANVAS_SELECTION_TEXT_CLASS } from './lib/selectionStyles.js';
|
|
53
|
+
export { default as PanelHeaderCollapseCarets } from './lib/PanelHeaderCollapseCarets.js';
|
|
54
|
+
export { buildDefaultToolbarSpec } from './lib/buildDefaultToolbarSpec.js';
|
|
55
|
+
export type { BuildDefaultToolbarSpecOptions, DefaultToolbarActions, DefaultToolbarCapabilities, DefaultToolbarLabels, DefaultToolbarNodeType, DefaultToolbarState, DefaultToolbarTemplate, } from './lib/buildDefaultToolbarSpec.js';
|
|
58
56
|
export { END_NODE_ID, GRAPH_SELECTION_KIND, safeUUID, getTransition, upsertTransition, deleteTransitionsForChoice, lintEditorTree, parsePydanticOutcomeErrors, shouldQueueInitialValidation, TREE_SPEC_NODE_TYPE_PRESETS, autoLayoutTree, getNextSpawnPosition, needsInitialLayout, getThemeHints, getEditorHints, isNodeLocked, patchEditorHints, editorHintsToStyle, RENDER_HINTS_THEME_NS, RENDER_HINTS_EDITOR_NS, GRAPH_POSITION_KEY, getAutosaveStatusLabel, AUTOSAVE_STATUS, getKeyboardShortcutAction, KEYBOARD_SHORTCUT_ACTION, applyTreeTemplate, applyEditorConnectOnDrop, computeTreeDiffSummary, deleteNode, duplicateNode, buildStableEntries, } from '@signalsafe/tree-spec-editor-core';
|
|
59
57
|
export type { EditorChoice, EditorNode, EditorTransition, EditorTree, GraphEditorIssue, GraphSelection, GraphSelectionKind, ReactFlowEdgeChange, ReactFlowNodeChange, TreeSpecAuditEventItem, TreeSpecSnapshotItem, TreeSpecNodeTypePreset, AutosaveStatus, KeyboardShortcutAction, KeyboardShortcutParams, ApplyTreeTemplateOptions, TreeDiffSummary, TreeTemplateNodeSpec, TreeTemplateSpec, TreeTemplateTransitionSpec, ConnectOnDropOptions, NodeEditorHints, GraphPosition, } from '@signalsafe/tree-spec-editor-core';
|
|
60
58
|
export type { TreeSpecIssue, TreeSpecWire } from '@signalsafe/tree-spec';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @packageDocumentation
|
|
3
|
-
*
|
|
3
|
+
* UI-kit agnostic TreeSpec graph editor shell.
|
|
4
4
|
*
|
|
5
5
|
* Layered architecture:
|
|
6
6
|
* - `@signalsafe/tree-spec` — wire contract (pure TS, no UI).
|
|
@@ -8,37 +8,34 @@
|
|
|
8
8
|
* and constants (no React, no DOM).
|
|
9
9
|
* - `@signalsafe/tree-spec-editor-react` — headless React: React Flow canvas
|
|
10
10
|
* (no UI library).
|
|
11
|
-
* - **`@signalsafe/tree-spec-editor`** (this package) —
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* The framework-agnostic surface from `-core` and the canvas from `-react`
|
|
15
|
-
* are re-exported from this barrel for consumer convenience. Hosts targeting
|
|
16
|
-
* alternative UI libraries (e.g. Material) should consume `-react` plus their
|
|
17
|
-
* own UI shell instead.
|
|
11
|
+
* - **`@signalsafe/tree-spec-editor`** (this package) — composable panels,
|
|
12
|
+
* modals, toolbar, and semantic `graph-editor-*` class hooks. Hosts style
|
|
13
|
+
* with Bootstrap, Material UI, or custom CSS.
|
|
18
14
|
*
|
|
19
15
|
* Source layout:
|
|
20
16
|
* - `panels/` — sidebar / toolbar / inspector presentational components
|
|
21
17
|
* - `modals/` — authoring-flow dialogs
|
|
22
|
-
* - `
|
|
18
|
+
* - `ui/` — UI-kit agnostic primitives and class tokens
|
|
19
|
+
* - `lib/` — panel helpers and toolbar builders
|
|
23
20
|
*/
|
|
24
21
|
export { default } from '@signalsafe/tree-spec-editor-react';
|
|
25
|
-
export { default as IssuesPanel } from './panels/IssuesPanel';
|
|
26
|
-
export { default as GraphEditorInfoPanel } from './panels/GraphEditorInfoPanel';
|
|
27
|
-
export { default as NodesPanel } from './panels/NodesPanel';
|
|
28
|
-
export { default as AdvancedJsonPanel } from './panels/AdvancedJsonPanel';
|
|
29
|
-
export { default as InspectorPanel, DEFAULT_OUTCOME_OPTIONS } from './panels/InspectorPanel';
|
|
30
|
-
export { default as AppearancePanel } from './panels/AppearancePanel';
|
|
31
|
-
export { default as SelectedEdgePanel } from './panels/SelectedEdgePanel';
|
|
32
|
-
export { default as ChoiceTemplatesPanel } from './panels/ChoiceTemplatesPanel';
|
|
33
|
-
export { default as ChoiceEdgeAppearanceFields } from './panels/ChoiceEdgeAppearanceFields';
|
|
34
|
-
export { default as PublishReviewModal } from './modals/PublishReviewModal';
|
|
35
|
-
export { default as DraftHistoryModal } from './modals/DraftHistoryModal';
|
|
36
|
-
export { default as AuditLogModal } from './modals/AuditLogModal';
|
|
37
|
-
export { default as ToolbarPanel, TOOLBAR_ITEM_KIND } from './panels/ToolbarPanel';
|
|
38
|
-
export { getIssueSeverityBadgeClass } from './lib/panelHelpers';
|
|
39
|
-
export { LIST_SELECTION_CLASS, CANVAS_SELECTION_CLASS, LIST_SELECTION_TEXT_CLASS, CANVAS_SELECTION_TEXT_CLASS } from './lib/selectionStyles';
|
|
40
|
-
export { default as PanelHeaderCollapseCarets } from './lib/PanelHeaderCollapseCarets';
|
|
41
|
-
export { buildDefaultToolbarSpec } from './lib/buildDefaultToolbarSpec';
|
|
22
|
+
export { default as IssuesPanel } from './panels/IssuesPanel.js';
|
|
23
|
+
export { default as GraphEditorInfoPanel } from './panels/GraphEditorInfoPanel.js';
|
|
24
|
+
export { default as NodesPanel } from './panels/NodesPanel.js';
|
|
25
|
+
export { default as AdvancedJsonPanel } from './panels/AdvancedJsonPanel.js';
|
|
26
|
+
export { default as InspectorPanel, DEFAULT_OUTCOME_OPTIONS } from './panels/InspectorPanel.js';
|
|
27
|
+
export { default as AppearancePanel } from './panels/AppearancePanel.js';
|
|
28
|
+
export { default as SelectedEdgePanel } from './panels/SelectedEdgePanel.js';
|
|
29
|
+
export { default as ChoiceTemplatesPanel } from './panels/ChoiceTemplatesPanel.js';
|
|
30
|
+
export { default as ChoiceEdgeAppearanceFields } from './panels/ChoiceEdgeAppearanceFields.js';
|
|
31
|
+
export { default as PublishReviewModal } from './modals/PublishReviewModal.js';
|
|
32
|
+
export { default as DraftHistoryModal } from './modals/DraftHistoryModal.js';
|
|
33
|
+
export { default as AuditLogModal } from './modals/AuditLogModal.js';
|
|
34
|
+
export { default as ToolbarPanel, TOOLBAR_ITEM_KIND } from './panels/ToolbarPanel.js';
|
|
35
|
+
export { getIssueSeverityBadgeClass, getIssueSeverityToken } from './lib/panelHelpers.js';
|
|
36
|
+
export { LIST_SELECTION_CLASS, CANVAS_SELECTION_CLASS, LIST_SELECTION_TEXT_CLASS, CANVAS_SELECTION_TEXT_CLASS } from './lib/selectionStyles.js';
|
|
37
|
+
export { default as PanelHeaderCollapseCarets } from './lib/PanelHeaderCollapseCarets.js';
|
|
38
|
+
export { buildDefaultToolbarSpec } from './lib/buildDefaultToolbarSpec.js';
|
|
42
39
|
/* ------------------------------------------------------------------------- */
|
|
43
40
|
/* Framework-agnostic re-exports from @signalsafe/tree-spec-editor-core. */
|
|
44
41
|
/* Hosts may consume these directly from `-core` to skip the React surface. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PanelHeaderCollapseCarets.d.ts","sourceRoot":"","sources":["../../src/lib/PanelHeaderCollapseCarets.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PanelHeaderCollapseCarets.d.ts","sourceRoot":"","sources":["../../src/lib/PanelHeaderCollapseCarets.tsx"],"names":[],"mappings":"AAEA,MAAM,WAAW,8BAA8B;IAC3C,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,qDAAqD;AACrD,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAAC,EAC9C,QAAQ,EACR,QAAQ,GACX,EAAE,QAAQ,CAAC,8BAA8B,CAAC,+BAU1C"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { EditorIconButton } from '../ui/primitives.js';
|
|
2
3
|
/** Collapse/expand carets for card panel headers. */
|
|
3
4
|
export default function PanelHeaderCollapseCarets({ expanded, onToggle, }) {
|
|
4
|
-
return (_jsx(
|
|
5
|
+
return (_jsx(EditorIconButton, { "aria-expanded": expanded, "aria-label": expanded ? 'Collapse panel' : 'Expand panel', onClick: onToggle, children: expanded ? '▲' : '▼' }));
|
|
5
6
|
}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** Semantic severity token for host UI mapping. */
|
|
2
|
+
export type IssueSeverityToken = 'error' | 'warning' | 'info' | 'neutral';
|
|
3
|
+
/** Maps a TreeSpec issue severity to a UI-kit agnostic token. */
|
|
4
|
+
export declare function getIssueSeverityToken(severity: string): IssueSeverityToken;
|
|
5
|
+
/**
|
|
6
|
+
* Returns semantic badge class hooks for issue rows.
|
|
7
|
+
* Hosts style `.graph-editor-badge--*` with Bootstrap, MUI, or custom CSS.
|
|
8
|
+
*/
|
|
2
9
|
export declare function getIssueSeverityBadgeClass(severity: string): string;
|
|
3
10
|
//# sourceMappingURL=panelHelpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"panelHelpers.d.ts","sourceRoot":"","sources":["../../src/lib/panelHelpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"panelHelpers.d.ts","sourceRoot":"","sources":["../../src/lib/panelHelpers.ts"],"names":[],"mappings":"AAIA,mDAAmD;AACnD,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAC;AAE1E,iEAAiE;AACjE,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,kBAAkB,CAW1E;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEnE"}
|
package/dist/lib/panelHelpers.js
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import { TREE_SPEC_ISSUE_SEVERITY } from '@signalsafe/tree-spec';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { EDITOR_BADGE } from '../ui/editorClasses.js';
|
|
3
|
+
/** Maps a TreeSpec issue severity to a UI-kit agnostic token. */
|
|
4
|
+
export function getIssueSeverityToken(severity) {
|
|
4
5
|
switch (severity) {
|
|
5
6
|
case TREE_SPEC_ISSUE_SEVERITY.ERROR:
|
|
6
|
-
return '
|
|
7
|
+
return 'error';
|
|
7
8
|
case TREE_SPEC_ISSUE_SEVERITY.WARNING:
|
|
8
|
-
return '
|
|
9
|
+
return 'warning';
|
|
9
10
|
case TREE_SPEC_ISSUE_SEVERITY.INFO:
|
|
10
|
-
return '
|
|
11
|
+
return 'info';
|
|
11
12
|
default:
|
|
12
|
-
return '
|
|
13
|
+
return 'neutral';
|
|
13
14
|
}
|
|
14
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Returns semantic badge class hooks for issue rows.
|
|
18
|
+
* Hosts style `.graph-editor-badge--*` with Bootstrap, MUI, or custom CSS.
|
|
19
|
+
*/
|
|
20
|
+
export function getIssueSeverityBadgeClass(severity) {
|
|
21
|
+
return `${EDITOR_BADGE} graph-editor-badge--${getIssueSeverityToken(severity)}`;
|
|
22
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"panelNodeLink.d.ts","sourceRoot":"","sources":["../../src/lib/panelNodeLink.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"panelNodeLink.d.ts","sourceRoot":"","sources":["../../src/lib/panelNodeLink.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAI1E,MAAM,WAAW,oBAAoB;IACjC,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C;AAED,6FAA6F;AAC7F,wBAAgB,aAAa,CAAC,EAC1B,MAAM,EACN,YAAY,GACf,EAAE,QAAQ,CAAC;IACR,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C,CAAC,GAAG,SAAS,CAcb;AAED,kEAAkE;AAClE,wBAAgB,2BAA2B,CACvC,IAAI,EAAE,gBAAgB,EACtB,EAAE,YAAY,EAAE,EAAE,oBAAoB,GACvC,SAAS,CAUX"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { EDITOR_BTN, joinClasses } from '../ui/editorClasses.js';
|
|
2
3
|
/** Clickable node id for panel breadcrumb lines; plain text when `onNodeSelect` is unset. */
|
|
3
4
|
export function PanelNodeLink({ nodeId, onNodeSelect, }) {
|
|
4
5
|
if (!onNodeSelect) {
|
|
5
6
|
return nodeId;
|
|
6
7
|
}
|
|
7
|
-
return (_jsx("button", { type: "button", className:
|
|
8
|
+
return (_jsx("button", { type: "button", className: joinClasses(EDITOR_BTN, 'graph-editor-btn--link', 'graph-editor-text--sm'), onClick: () => onNodeSelect(nodeId), children: nodeId }));
|
|
8
9
|
}
|
|
9
10
|
/** Default `from · choice → to` line for selected transitions. */
|
|
10
11
|
export function renderDefaultEdgeBreadcrumb(edge, { onNodeSelect }) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
export declare const LIST_SELECTION_CLASS = "
|
|
3
|
-
/**
|
|
4
|
-
export declare const LIST_SELECTION_TEXT_CLASS = "graph-editor-
|
|
1
|
+
/** List row selection highlight (sidebar Nodes / Issues). */
|
|
2
|
+
export declare const LIST_SELECTION_CLASS = "graph-editor-list__item--selected";
|
|
3
|
+
/** Readable text on selected sidebar rows. */
|
|
4
|
+
export declare const LIST_SELECTION_TEXT_CLASS = "graph-editor-list__item-text--selected";
|
|
5
5
|
/** Canvas / card selection highlight matching list selection. */
|
|
6
|
-
export declare const CANVAS_SELECTION_CLASS = "
|
|
7
|
-
/**
|
|
6
|
+
export declare const CANVAS_SELECTION_CLASS = "graph-editor-canvas__selected";
|
|
7
|
+
/** Readable text on selected canvas nodes. */
|
|
8
8
|
export declare const CANVAS_SELECTION_TEXT_CLASS = "graph-editor-canvas-selected";
|
|
9
9
|
//# sourceMappingURL=selectionStyles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectionStyles.d.ts","sourceRoot":"","sources":["../../src/lib/selectionStyles.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"selectionStyles.d.ts","sourceRoot":"","sources":["../../src/lib/selectionStyles.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,eAAO,MAAM,oBAAoB,sCAAsC,CAAC;AAExE,8CAA8C;AAC9C,eAAO,MAAM,yBAAyB,2CAA2C,CAAC;AAElF,iEAAiE;AACjE,eAAO,MAAM,sBAAsB,kCAAkC,CAAC;AAEtE,8CAA8C;AAC9C,eAAO,MAAM,2BAA2B,iCAAiC,CAAC"}
|