@signalsafe/tree-spec-editor 0.2.0 → 0.2.2
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/LICENSE +21 -0
- package/README.md +186 -59
- package/dist/index.d.ts +11 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/lib/PanelHeaderCollapseCarets.d.ts +4 -7
- package/dist/lib/PanelHeaderCollapseCarets.d.ts.map +1 -1
- package/dist/lib/PanelHeaderCollapseCarets.js +2 -10
- package/dist/lib/buildDefaultToolbarSpec.d.ts +5 -155
- package/dist/lib/buildDefaultToolbarSpec.d.ts.map +1 -1
- package/dist/lib/buildDefaultToolbarSpec.js +17 -198
- package/dist/lib/panelHelpers.d.ts +1 -7
- package/dist/lib/panelHelpers.d.ts.map +1 -1
- package/dist/lib/panelHelpers.js +11 -19
- package/dist/lib/panelNodeLink.d.ts +13 -0
- package/dist/lib/panelNodeLink.d.ts.map +1 -0
- package/dist/lib/panelNodeLink.js +12 -0
- package/dist/lib/selectionStyles.d.ts +9 -0
- package/dist/lib/selectionStyles.d.ts.map +1 -0
- package/dist/lib/selectionStyles.js +8 -0
- package/dist/lib/toolbar/defaultToolbarTypes.d.ts +89 -0
- package/dist/lib/toolbar/defaultToolbarTypes.d.ts.map +1 -0
- package/dist/lib/toolbar/defaultToolbarTypes.js +1 -0
- package/dist/lib/toolbar/toolbarSectionBuilders.d.ts +10 -0
- package/dist/lib/toolbar/toolbarSectionBuilders.d.ts.map +1 -0
- package/dist/lib/toolbar/toolbarSectionBuilders.js +153 -0
- package/dist/modals/AuditLogModal.d.ts +1 -1
- package/dist/modals/AuditLogModal.d.ts.map +1 -1
- package/dist/modals/AuditLogModal.js +1 -1
- package/dist/modals/DraftHistoryModal.d.ts +1 -1
- package/dist/modals/DraftHistoryModal.d.ts.map +1 -1
- package/dist/modals/DraftHistoryModal.js +1 -1
- package/dist/modals/PublishReviewModal.d.ts +1 -1
- package/dist/modals/PublishReviewModal.d.ts.map +1 -1
- package/dist/panels/AdvancedJsonPanel.d.ts +1 -1
- package/dist/panels/AdvancedJsonPanel.d.ts.map +1 -1
- package/dist/panels/AppearancePanel.d.ts +26 -0
- package/dist/panels/AppearancePanel.d.ts.map +1 -0
- package/dist/panels/AppearancePanel.js +76 -0
- package/dist/panels/ChoiceEdgeAppearanceFields.d.ts +10 -0
- package/dist/panels/ChoiceEdgeAppearanceFields.d.ts.map +1 -0
- package/dist/panels/ChoiceEdgeAppearanceFields.js +13 -0
- package/dist/panels/ChoiceTemplatesPanel.d.ts +27 -0
- package/dist/panels/ChoiceTemplatesPanel.d.ts.map +1 -0
- package/dist/panels/ChoiceTemplatesPanel.js +9 -0
- package/dist/panels/GraphEditorInfoPanel.d.ts +5 -2
- package/dist/panels/GraphEditorInfoPanel.d.ts.map +1 -1
- package/dist/panels/GraphEditorInfoPanel.js +6 -6
- package/dist/panels/InspectorPanel.d.ts +3 -78
- package/dist/panels/InspectorPanel.d.ts.map +1 -1
- package/dist/panels/InspectorPanel.js +20 -60
- package/dist/panels/IssuesPanel.d.ts +6 -2
- package/dist/panels/IssuesPanel.d.ts.map +1 -1
- package/dist/panels/IssuesPanel.js +15 -8
- package/dist/panels/NodesPanel.d.ts +3 -1
- package/dist/panels/NodesPanel.d.ts.map +1 -1
- package/dist/panels/NodesPanel.js +12 -14
- package/dist/panels/SelectedEdgePanel.d.ts +10 -3
- package/dist/panels/SelectedEdgePanel.d.ts.map +1 -1
- package/dist/panels/SelectedEdgePanel.js +5 -6
- package/dist/panels/ToolbarPanel.d.ts +4 -6
- package/dist/panels/ToolbarPanel.d.ts.map +1 -1
- package/dist/panels/ToolbarPanel.js +2 -4
- package/dist/panels/inspector/ChoiceEditorCard.d.ts +28 -0
- package/dist/panels/inspector/ChoiceEditorCard.d.ts.map +1 -0
- package/dist/panels/inspector/ChoiceEditorCard.js +36 -0
- package/dist/panels/inspector/ChoiceEditorList.d.ts +25 -0
- package/dist/panels/inspector/ChoiceEditorList.d.ts.map +1 -0
- package/dist/panels/inspector/ChoiceEditorList.js +10 -0
- package/dist/panels/inspector/NodeTypeField.d.ts +8 -0
- package/dist/panels/inspector/NodeTypeField.d.ts.map +1 -0
- package/dist/panels/inspector/NodeTypeField.js +12 -0
- package/dist/panels/inspector/RequiredNodeCard.d.ts +14 -0
- package/dist/panels/inspector/RequiredNodeCard.d.ts.map +1 -0
- package/dist/panels/inspector/RequiredNodeCard.js +16 -0
- package/dist/panels/inspector/choiceActionIconProps.d.ts +12 -0
- package/dist/panels/inspector/choiceActionIconProps.d.ts.map +1 -0
- package/dist/panels/inspector/choiceActionIconProps.js +26 -0
- package/dist/panels/inspector/types.d.ts +77 -0
- package/dist/panels/inspector/types.d.ts.map +1 -0
- package/dist/panels/inspector/types.js +11 -0
- package/package.json +83 -65
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { TOOLBAR_ITEM_KIND } from '../../panels/ToolbarPanel.js';
|
|
2
|
+
export function appendBackSlot(items, slot) {
|
|
3
|
+
items.push({
|
|
4
|
+
kind: TOOLBAR_ITEM_KIND.CUSTOM,
|
|
5
|
+
id: slot.id ?? 'back',
|
|
6
|
+
render: slot.render,
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
export function appendAddDropdown(items, nodeTypes, actions, labels, isPublished) {
|
|
10
|
+
const addEntries = nodeTypes.map((entry, index) => {
|
|
11
|
+
if (entry.divider) {
|
|
12
|
+
return { id: entry.id ?? `divider-${index}`, label: '', divider: true };
|
|
13
|
+
}
|
|
14
|
+
const type = entry.type ?? 'prompt';
|
|
15
|
+
return {
|
|
16
|
+
id: entry.id ?? `add-${type}`,
|
|
17
|
+
label: entry.label ?? type,
|
|
18
|
+
onClick: () => actions.addNodeOfType(type, entry.patch),
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
if (addEntries.length === 0)
|
|
22
|
+
return;
|
|
23
|
+
items.push({
|
|
24
|
+
kind: TOOLBAR_ITEM_KIND.DROPDOWN,
|
|
25
|
+
id: 'add',
|
|
26
|
+
label: labels.add ?? '+ Add',
|
|
27
|
+
disabled: isPublished,
|
|
28
|
+
entries: addEntries,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
export function appendTemplatesDropdown(items, templates, actions, labels, isPublished) {
|
|
32
|
+
if (templates.length === 0)
|
|
33
|
+
return;
|
|
34
|
+
items.push({
|
|
35
|
+
kind: TOOLBAR_ITEM_KIND.DROPDOWN,
|
|
36
|
+
id: 'templates',
|
|
37
|
+
label: labels.templates ?? 'Templates',
|
|
38
|
+
disabled: isPublished,
|
|
39
|
+
entries: templates.map((t) => ({
|
|
40
|
+
id: t.id,
|
|
41
|
+
label: t.label,
|
|
42
|
+
onClick: () => actions.insertTemplate(t.spec),
|
|
43
|
+
})),
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
export function appendLayoutButtons(items, state, actions, labels) {
|
|
47
|
+
const { isPublished, hasTree } = state;
|
|
48
|
+
items.push({
|
|
49
|
+
kind: TOOLBAR_ITEM_KIND.BUTTON,
|
|
50
|
+
id: 'reset-view',
|
|
51
|
+
label: labels.resetView ?? 'Reset view',
|
|
52
|
+
disabled: !hasTree,
|
|
53
|
+
onClick: () => actions.triggerResetView(),
|
|
54
|
+
}, {
|
|
55
|
+
kind: TOOLBAR_ITEM_KIND.BUTTON,
|
|
56
|
+
id: 'auto-layout',
|
|
57
|
+
label: labels.autoLayout ?? 'Auto layout',
|
|
58
|
+
disabled: !hasTree || isPublished,
|
|
59
|
+
onClick: () => actions.autoLayout(),
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
export function appendUndoRedo(items, state, actions, labels) {
|
|
63
|
+
if (!actions.undo || !actions.redo)
|
|
64
|
+
return;
|
|
65
|
+
const { isPublished, canUndo = false, canRedo = false } = state;
|
|
66
|
+
items.push({
|
|
67
|
+
kind: TOOLBAR_ITEM_KIND.BUTTON,
|
|
68
|
+
id: 'undo',
|
|
69
|
+
label: labels.undo ?? 'Undo',
|
|
70
|
+
disabled: isPublished || !canUndo,
|
|
71
|
+
onClick: () => actions.undo(),
|
|
72
|
+
}, {
|
|
73
|
+
kind: TOOLBAR_ITEM_KIND.BUTTON,
|
|
74
|
+
id: 'redo',
|
|
75
|
+
label: labels.redo ?? 'Redo',
|
|
76
|
+
disabled: isPublished || !canRedo,
|
|
77
|
+
onClick: () => actions.redo(),
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
export function appendCapabilityButtons(items, capabilities, state, actions, labels) {
|
|
81
|
+
const { isPublished, creatingSnapshot, cloning, hasTree } = state;
|
|
82
|
+
if (capabilities.canValidate) {
|
|
83
|
+
items.push({
|
|
84
|
+
kind: TOOLBAR_ITEM_KIND.BUTTON,
|
|
85
|
+
id: 'validate',
|
|
86
|
+
label: labels.validate ?? 'Validate',
|
|
87
|
+
disabled: !hasTree,
|
|
88
|
+
onClick: () => void actions.validate(),
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
if (capabilities.canListSnapshots) {
|
|
92
|
+
items.push({
|
|
93
|
+
kind: TOOLBAR_ITEM_KIND.BUTTON,
|
|
94
|
+
id: 'draft-history',
|
|
95
|
+
label: labels.history ?? 'Draft history',
|
|
96
|
+
onClick: () => actions.setShowDraftHistory(true),
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
if (capabilities.canListAudit) {
|
|
100
|
+
items.push({
|
|
101
|
+
kind: TOOLBAR_ITEM_KIND.BUTTON,
|
|
102
|
+
id: 'audit',
|
|
103
|
+
label: labels.audit ?? 'Audit log',
|
|
104
|
+
onClick: () => actions.setShowAudit(true),
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
if (capabilities.canCreateSnapshot) {
|
|
108
|
+
items.push({
|
|
109
|
+
kind: TOOLBAR_ITEM_KIND.BUTTON,
|
|
110
|
+
id: 'snapshot',
|
|
111
|
+
label: creatingSnapshot ? 'Creating…' : (labels.snapshot ?? 'Snapshot'),
|
|
112
|
+
disabled: isPublished || creatingSnapshot || !hasTree,
|
|
113
|
+
onClick: () => void actions.createSnapshot(),
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
if (capabilities.canCloneToDraft) {
|
|
117
|
+
items.push({
|
|
118
|
+
kind: TOOLBAR_ITEM_KIND.BUTTON,
|
|
119
|
+
id: 'clone-to-draft',
|
|
120
|
+
label: cloning ? 'Cloning…' : (labels.clone ?? 'Clone to draft'),
|
|
121
|
+
disabled: cloning,
|
|
122
|
+
onClick: () => void actions.cloneToDraft(),
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
export function appendSaveAndPublish(items, capabilities, state, actions, labels, preview) {
|
|
127
|
+
const { isPublished, saving, publishing, canPublish, hasTree } = state;
|
|
128
|
+
items.push({
|
|
129
|
+
kind: TOOLBAR_ITEM_KIND.BUTTON,
|
|
130
|
+
id: 'save-draft',
|
|
131
|
+
label: saving ? 'Saving…' : (labels.save ?? 'Save draft'),
|
|
132
|
+
disabled: isPublished || saving || !hasTree,
|
|
133
|
+
onClick: () => void actions.saveDraft(),
|
|
134
|
+
});
|
|
135
|
+
if (capabilities.canPublish) {
|
|
136
|
+
items.push({
|
|
137
|
+
kind: TOOLBAR_ITEM_KIND.BUTTON,
|
|
138
|
+
id: 'publish',
|
|
139
|
+
label: publishing ? 'Publishing…' : (labels.publish ?? 'Publish'),
|
|
140
|
+
disabled: isPublished || publishing || !canPublish,
|
|
141
|
+
onClick: () => actions.setShowPublishModal(true),
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
if (preview) {
|
|
145
|
+
items.push({
|
|
146
|
+
kind: TOOLBAR_ITEM_KIND.BUTTON,
|
|
147
|
+
id: 'preview',
|
|
148
|
+
label: labels.preview ?? 'Preview',
|
|
149
|
+
disabled: preview.disabled ?? false,
|
|
150
|
+
onClick: preview.onClick,
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
@@ -17,5 +17,5 @@ export interface AuditLogModalProps {
|
|
|
17
17
|
/** Override the Close button label in the footer. */
|
|
18
18
|
closeLabel?: string;
|
|
19
19
|
}
|
|
20
|
-
export default function AuditLogModal({ show, loadingAudit, auditEvents, onClose, title, subtitle, loadingText, emptyStateText, actorLabel, closeLabel, }: Readonly<AuditLogModalProps>): import("react
|
|
20
|
+
export default function AuditLogModal({ show, loadingAudit, auditEvents, onClose, title, subtitle, loadingText, emptyStateText, actorLabel, closeLabel, }: Readonly<AuditLogModalProps>): import("react").JSX.Element | null;
|
|
21
21
|
//# sourceMappingURL=AuditLogModal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuditLogModal.d.ts","sourceRoot":"","sources":["../../src/modals/AuditLogModal.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAEhF,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE,sBAAsB,EAAE,CAAC;IACtC,OAAO,EAAE,MAAM,IAAI,CAAC;IAEpB,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uCAAuC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kEAAkE;IAClE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iFAAiF;IACjF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AASD,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAClC,IAAI,EACJ,YAAY,EACZ,WAAW,EACX,OAAO,EACP,KAAqB,EACrB,QAA2B,EAC3B,WAAkC,EAClC,cAAyC,EACzC,UAAgC,EAChC,UAAgC,GACnC,EAAE,QAAQ,CAAC,kBAAkB,CAAC,
|
|
1
|
+
{"version":3,"file":"AuditLogModal.d.ts","sourceRoot":"","sources":["../../src/modals/AuditLogModal.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAEhF,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE,sBAAsB,EAAE,CAAC;IACtC,OAAO,EAAE,MAAM,IAAI,CAAC;IAEpB,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uCAAuC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kEAAkE;IAClE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iFAAiF;IACjF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AASD,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAClC,IAAI,EACJ,YAAY,EACZ,WAAW,EACX,OAAO,EACP,KAAqB,EACrB,QAA2B,EAC3B,WAAkC,EAClC,cAAyC,EACzC,UAAgC,EAChC,UAAgC,GACnC,EAAE,QAAQ,CAAC,kBAAkB,CAAC,sCAwD9B"}
|
|
@@ -17,7 +17,7 @@ export default function AuditLogModal({ show, loadingAudit, auditEvents, onClose
|
|
|
17
17
|
auditContent = (_jsx("div", { className: "text-muted", children: _jsx("em", { children: emptyStateText }) }));
|
|
18
18
|
}
|
|
19
19
|
else {
|
|
20
|
-
auditContent = (_jsx("ul", { className: "list-unstyled mb-0 overflow-auto-max-h-400", children: auditEvents.map((e) => (_jsxs("li", { className: "border-bottom py-2", children: [_jsxs("div", { className: "d-flex justify-content-between align-items-start", children: [_jsx("span", { className: "badge bg-secondary me-2", children: e.action }), _jsx("span", { className: "text-muted font-size-12", children: new Date(e.
|
|
20
|
+
auditContent = (_jsx("ul", { className: "list-unstyled mb-0 overflow-auto-max-h-400", children: auditEvents.map((e) => (_jsxs("li", { className: "border-bottom py-2", children: [_jsxs("div", { className: "d-flex justify-content-between align-items-start", children: [_jsx("span", { className: "badge bg-secondary me-2", children: e.action }), _jsx("span", { className: "text-muted font-size-12", children: new Date(e.created_on).toLocaleString() })] }), e.actor == null ? null : (_jsxs("span", { className: "text-muted font-size-12", children: [actorLabel, " ", e.actor] })), e.detail && Object.keys(e.detail).length > 0 ? (_jsx("pre", { className: "mb-0 mt-1 small text-muted font-size-11", children: JSON.stringify(e.detail) })) : null] }, e.id))) }));
|
|
21
21
|
}
|
|
22
22
|
return (_jsx("dialog", { className: "modal d-block modal-backdrop-dark", open: true, children: _jsx("div", { className: "modal-dialog modal-lg", children: _jsxs("div", { className: "modal-content", children: [_jsxs("div", { className: "modal-header", children: [_jsx("h5", { className: "modal-title", children: title }), _jsx(CloseButton, { "aria-label": "Close", onClick: onClose })] }), _jsxs("div", { className: "modal-body", children: [_jsx("p", { className: "text-muted font-size-13", children: subtitle }), auditContent] }), _jsx("div", { className: "modal-footer", children: _jsx(Button, { variant: "secondary", onClick: onClose, children: closeLabel }) })] }) }) }));
|
|
23
23
|
}
|
|
@@ -30,5 +30,5 @@ export interface DraftHistoryModalProps {
|
|
|
30
30
|
/** Override the Close button label in the footer. */
|
|
31
31
|
closeLabel?: string;
|
|
32
32
|
}
|
|
33
|
-
export default function DraftHistoryModal({ show, loadingSnapshots, snapshots, restoringSnapshotId, creatingSnapshot, tree, onClose, onCreateSnapshot, onRestoreSnapshot, title, subtitle, listCaption, createSnapshotLabel, creatingSnapshotLabel, restoreLabel, restoringLabel, loadingText, emptyStateText, closeLabel, }: Readonly<DraftHistoryModalProps>): import("react
|
|
33
|
+
export default function DraftHistoryModal({ show, loadingSnapshots, snapshots, restoringSnapshotId, creatingSnapshot, tree, onClose, onCreateSnapshot, onRestoreSnapshot, title, subtitle, listCaption, createSnapshotLabel, creatingSnapshotLabel, restoreLabel, restoringLabel, loadingText, emptyStateText, closeLabel, }: Readonly<DraftHistoryModalProps>): import("react").JSX.Element | null;
|
|
34
34
|
//# sourceMappingURL=DraftHistoryModal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DraftHistoryModal.d.ts","sourceRoot":"","sources":["../../src/modals/DraftHistoryModal.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAE1F,MAAM,WAAW,sBAAsB;IACnC,IAAI,EAAE,OAAO,CAAC;IACd,gBAAgB,EAAE,OAAO,CAAC;IAC1B,SAAS,EAAE,oBAAoB,EAAE,CAAC;IAClC,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC;IACxB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,iBAAiB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAEhD,0DAA0D;IAC1D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sEAAsE;IACtE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,uEAAuE;IACvE,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,2CAA2C;IAC3C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gFAAgF;IAChF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,uCAAuC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qEAAqE;IACrE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,qDAAqD;IACrD,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAcD,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACtC,IAAI,EACJ,gBAAgB,EAChB,SAAS,EACT,mBAAmB,EACnB,gBAAgB,EAChB,IAAI,EACJ,OAAO,EACP,gBAAgB,EAChB,iBAAiB,EACjB,KAAqB,EACrB,QAA2B,EAC3B,WAAkC,EAClC,mBAA0C,EAC1C,qBAA8C,EAC9C,YAAoC,EACpC,cAAwC,EACxC,WAAkC,EAClC,cAAyC,EACzC,UAAgC,GACnC,EAAE,QAAQ,CAAC,sBAAsB,CAAC,
|
|
1
|
+
{"version":3,"file":"DraftHistoryModal.d.ts","sourceRoot":"","sources":["../../src/modals/DraftHistoryModal.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAE1F,MAAM,WAAW,sBAAsB;IACnC,IAAI,EAAE,OAAO,CAAC;IACd,gBAAgB,EAAE,OAAO,CAAC;IAC1B,SAAS,EAAE,oBAAoB,EAAE,CAAC;IAClC,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC;IACxB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,iBAAiB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAEhD,0DAA0D;IAC1D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sEAAsE;IACtE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,uEAAuE;IACvE,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,2CAA2C;IAC3C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gFAAgF;IAChF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,uCAAuC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qEAAqE;IACrE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,qDAAqD;IACrD,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAcD,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACtC,IAAI,EACJ,gBAAgB,EAChB,SAAS,EACT,mBAAmB,EACnB,gBAAgB,EAChB,IAAI,EACJ,OAAO,EACP,gBAAgB,EAChB,iBAAiB,EACjB,KAAqB,EACrB,QAA2B,EAC3B,WAAkC,EAClC,mBAA0C,EAC1C,qBAA8C,EAC9C,YAAoC,EACpC,cAAwC,EACxC,WAAkC,EAClC,cAAyC,EACzC,UAAgC,GACnC,EAAE,QAAQ,CAAC,sBAAsB,CAAC,sCAuElC"}
|
|
@@ -21,7 +21,7 @@ export default function DraftHistoryModal({ show, loadingSnapshots, snapshots, r
|
|
|
21
21
|
snapshotsContent = (_jsx("div", { className: "text-muted", children: _jsx("em", { children: emptyStateText }) }));
|
|
22
22
|
}
|
|
23
23
|
else {
|
|
24
|
-
snapshotsContent = (_jsx("ul", { className: "list-unstyled mb-0 overflow-auto-max-h-320", children: snapshots.map((s) => (_jsxs("li", { className: "d-flex justify-content-between align-items-center border-bottom py-2", children: [_jsxs("div", { children: [_jsx("span", { className: "text-muted font-size-12", children: new Date(s.
|
|
24
|
+
snapshotsContent = (_jsx("ul", { className: "list-unstyled mb-0 overflow-auto-max-h-320", children: snapshots.map((s) => (_jsxs("li", { className: "d-flex justify-content-between align-items-center border-bottom py-2", children: [_jsxs("div", { children: [_jsx("span", { className: "text-muted font-size-12", children: new Date(s.created_on).toLocaleString() }), s.label ? _jsx("span", { className: "ms-2", children: s.label }) : null, s.spec_hash ? (_jsxs("span", { className: "ms-2 text-muted font-size-11", children: [s.spec_hash.slice(0, 8), "\u2026"] })) : null] }), _jsx(Button, { variant: "outline-warning", onClick: () => onRestoreSnapshot(s.id), disabled: restoringSnapshotId !== null, children: restoringSnapshotId === s.id ? restoringLabel : restoreLabel })] }, s.id))) }));
|
|
25
25
|
}
|
|
26
26
|
return (_jsx("dialog", { className: "modal d-block modal-backdrop-dark", open: true, children: _jsx("div", { className: "modal-dialog modal-lg", children: _jsxs("div", { className: "modal-content", children: [_jsxs("div", { className: "modal-header", children: [_jsx("h5", { className: "modal-title", children: title }), _jsx(CloseButton, { "aria-label": "Close", onClick: onClose })] }), _jsxs("div", { className: "modal-body", children: [_jsx("p", { className: "text-muted font-size-13", children: subtitle }), _jsxs("div", { className: "d-flex justify-content-between align-items-center mb-3", children: [_jsx("span", { className: "text-muted font-size-13", children: listCaption }), _jsx(Button, { variant: "outline-primary", onClick: onCreateSnapshot, disabled: !tree || creatingSnapshot, children: creatingSnapshot ? creatingSnapshotLabel : createSnapshotLabel })] }), snapshotsContent] }), _jsx("div", { className: "modal-footer", children: _jsx(Button, { variant: "secondary", onClick: onClose, children: closeLabel }) })] }) }) }));
|
|
27
27
|
}
|
|
@@ -33,5 +33,5 @@ export interface PublishReviewModalProps {
|
|
|
33
33
|
/** Override the Publish button label while publishing (default "Publishing\u2026"). */
|
|
34
34
|
publishingLabel?: string;
|
|
35
35
|
}
|
|
36
|
-
export default function PublishReviewModal({ show, tree, baselineTree, issues, publishing, onClose, onPublish, computeDiffSummary, title, summaryText, errorAlertText, cancelLabel, publishLabel, publishingLabel, }: Readonly<PublishReviewModalProps>): import("react
|
|
36
|
+
export default function PublishReviewModal({ show, tree, baselineTree, issues, publishing, onClose, onPublish, computeDiffSummary, title, summaryText, errorAlertText, cancelLabel, publishLabel, publishingLabel, }: Readonly<PublishReviewModalProps>): import("react").JSX.Element | null;
|
|
37
37
|
//# sourceMappingURL=PublishReviewModal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PublishReviewModal.d.ts","sourceRoot":"","sources":["../../src/modals/PublishReviewModal.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAA4B,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGrF,OAAO,EAAsB,KAAK,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAExF,MAAM,WAAW,uBAAuB;IACpC,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC;IACxB,YAAY,EAAE,UAAU,GAAG,IAAI,CAAC;IAChC,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,kBAAkB,EAAE,CAChB,MAAM,EAAE,UAAU,GAAG,IAAI,EACzB,KAAK,EAAE,UAAU,KAChB;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,UAAU,EAAE,OAAO,CAAA;KAAE,CAAC;IAE9C,4EAA4E;IAC5E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iEAAiE;IACjE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mEAAmE;IACnE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,wCAAwC;IACxC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iEAAiE;IACjE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uFAAuF;IACvF,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B;AAUD,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EACvC,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,UAAU,EACV,OAAO,EACP,SAAS,EACT,kBAAkB,EAClB,KAAqB,EACrB,WAAkC,EAClC,cAAyC,EACzC,WAAkC,EAClC,YAAoC,EACpC,eAA0C,GAC7C,EAAE,QAAQ,CAAC,uBAAuB,CAAC,
|
|
1
|
+
{"version":3,"file":"PublishReviewModal.d.ts","sourceRoot":"","sources":["../../src/modals/PublishReviewModal.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAA4B,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGrF,OAAO,EAAsB,KAAK,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAExF,MAAM,WAAW,uBAAuB;IACpC,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC;IACxB,YAAY,EAAE,UAAU,GAAG,IAAI,CAAC;IAChC,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,kBAAkB,EAAE,CAChB,MAAM,EAAE,UAAU,GAAG,IAAI,EACzB,KAAK,EAAE,UAAU,KAChB;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,UAAU,EAAE,OAAO,CAAA;KAAE,CAAC;IAE9C,4EAA4E;IAC5E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iEAAiE;IACjE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mEAAmE;IACnE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,wCAAwC;IACxC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iEAAiE;IACjE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uFAAuF;IACvF,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B;AAUD,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EACvC,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,UAAU,EACV,OAAO,EACP,SAAS,EACT,kBAAkB,EAClB,KAAqB,EACrB,WAAkC,EAClC,cAAyC,EACzC,WAAkC,EAClC,YAAoC,EACpC,eAA0C,GAC7C,EAAE,QAAQ,CAAC,uBAAuB,CAAC,sCAyCnC"}
|
|
@@ -23,5 +23,5 @@ export interface AdvancedJsonPanelProps {
|
|
|
23
23
|
/** Optional extra class names applied to the outer `card` element. */
|
|
24
24
|
className?: string;
|
|
25
25
|
}
|
|
26
|
-
export default function AdvancedJsonPanel({ children, title, subtitle, onExpandAll, onCollapseAll, expandAllLabel, collapseAllLabel, className, }: Readonly<AdvancedJsonPanelProps>): import("react
|
|
26
|
+
export default function AdvancedJsonPanel({ children, title, subtitle, onExpandAll, onCollapseAll, expandAllLabel, collapseAllLabel, className, }: Readonly<AdvancedJsonPanelProps>): import("react").JSX.Element;
|
|
27
27
|
//# sourceMappingURL=AdvancedJsonPanel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdvancedJsonPanel.d.ts","sourceRoot":"","sources":["../../src/panels/AdvancedJsonPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvC,MAAM,WAAW,sBAAsB;IACnC,uEAAuE;IACvE,QAAQ,EAAE,SAAS,CAAC;IACpB,sEAAsE;IACtE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,4EAA4E;IAC5E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gFAAgF;IAChF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAID,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACtC,QAAQ,EACR,KAAqB,EACrB,QAAQ,EACR,WAAW,EACX,aAAa,EACb,cAA6B,EAC7B,gBAAiC,EACjC,SAAS,GACZ,EAAE,QAAQ,CAAC,sBAAsB,CAAC
|
|
1
|
+
{"version":3,"file":"AdvancedJsonPanel.d.ts","sourceRoot":"","sources":["../../src/panels/AdvancedJsonPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvC,MAAM,WAAW,sBAAsB;IACnC,uEAAuE;IACvE,QAAQ,EAAE,SAAS,CAAC;IACpB,sEAAsE;IACtE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,4EAA4E;IAC5E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gFAAgF;IAChF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAID,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACtC,QAAQ,EACR,KAAqB,EACrB,QAAQ,EACR,WAAW,EACX,aAAa,EACb,cAA6B,EAC7B,gBAAiC,EACjC,SAAS,GACZ,EAAE,QAAQ,CAAC,sBAAsB,CAAC,+BAsClC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Right-rail panel for canvas-only node appearance (colors, size, text wrap, lock)
|
|
3
|
+
* and per-choice edge styling. Hosts inject node field UI via `renderAppearanceFields`.
|
|
4
|
+
*/
|
|
5
|
+
import type { ReactNode } from 'react';
|
|
6
|
+
import { type ChoiceEdgeHints, type EditorNode, type EditorTransition, type EditorTree } from '@signalsafe/tree-spec-editor-core';
|
|
7
|
+
import type { InspectorNodeRenderContext } from './InspectorPanel';
|
|
8
|
+
export interface AppearancePanelProps {
|
|
9
|
+
tree: EditorTree;
|
|
10
|
+
selectedNode: EditorNode | null;
|
|
11
|
+
selectedEdge?: EditorTransition | null;
|
|
12
|
+
focusChoiceId?: string | null;
|
|
13
|
+
isPublished?: boolean;
|
|
14
|
+
onUpdateSelectedNode: (patch: Partial<EditorNode>) => void;
|
|
15
|
+
/** Render appearance controls for the selected node. Hidden when an edge is selected. */
|
|
16
|
+
renderAppearanceFields: (ctx: InspectorNodeRenderContext) => ReactNode;
|
|
17
|
+
onUpdateChoiceEdgeHints?: (nodeId: string, choiceId: string, patch: Partial<ChoiceEdgeHints>) => void;
|
|
18
|
+
/** Jump to a node from the selected-edge summary line. */
|
|
19
|
+
onNodeSelect?: (nodeId: string) => void;
|
|
20
|
+
title?: string;
|
|
21
|
+
emptyStateText?: string;
|
|
22
|
+
/** Shown above node fields when a node is selected. */
|
|
23
|
+
helperText?: string;
|
|
24
|
+
}
|
|
25
|
+
export default function AppearancePanel({ tree, selectedNode, selectedEdge, focusChoiceId, isPublished, onUpdateSelectedNode, renderAppearanceFields, onUpdateChoiceEdgeHints, onNodeSelect, title, emptyStateText, helperText, }: Readonly<AppearancePanelProps>): import("react").JSX.Element;
|
|
26
|
+
//# sourceMappingURL=AppearancePanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppearancePanel.d.ts","sourceRoot":"","sources":["../../src/panels/AppearancePanel.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,EAEH,KAAK,eAAe,EAEpB,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,UAAU,EAClB,MAAM,mCAAmC,CAAC;AAK3C,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAEnE,MAAM,WAAW,oBAAoB;IACjC,IAAI,EAAE,UAAU,CAAC;IACjB,YAAY,EAAE,UAAU,GAAG,IAAI,CAAC;IAChC,YAAY,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACvC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,oBAAoB,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IAC3D,yFAAyF;IACzF,sBAAsB,EAAE,CAAC,GAAG,EAAE,0BAA0B,KAAK,SAAS,CAAC;IACvE,uBAAuB,CAAC,EAAE,CACtB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,OAAO,CAAC,eAAe,CAAC,KAC9B,IAAI,CAAC;IACV,0DAA0D;IAC1D,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAmID,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EACpC,IAAI,EACJ,YAAY,EACZ,YAAmB,EACnB,aAAoB,EACpB,WAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,EACvB,YAAY,EACZ,KAAoB,EACpB,cAA4D,EAC5D,UAAkE,GACrE,EAAE,QAAQ,CAAC,oBAAoB,CAAC,+BA0EhC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { getTransition, } from '@signalsafe/tree-spec-editor-core';
|
|
4
|
+
import PanelHeaderCollapseCarets from '../lib/PanelHeaderCollapseCarets';
|
|
5
|
+
import { PanelNodeLink } from '../lib/panelNodeLink';
|
|
6
|
+
import ChoiceEdgeAppearanceFields from './ChoiceEdgeAppearanceFields';
|
|
7
|
+
function resolveActiveChoiceId(choices, selectedEdge, focusChoiceId) {
|
|
8
|
+
if (selectedEdge)
|
|
9
|
+
return selectedEdge.fromChoiceId;
|
|
10
|
+
const ids = (choices ?? []).map((choice) => choice.id);
|
|
11
|
+
if (focusChoiceId && ids.includes(focusChoiceId))
|
|
12
|
+
return focusChoiceId;
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
const EDGE_APPEARANCE_HELPER = 'Canvas only (not shown in preview or training)';
|
|
16
|
+
function EdgeContextBreadcrumb({ fromNodeId, choiceId, toNodeId, onNodeSelect, }) {
|
|
17
|
+
return (_jsxs("div", { className: "text-muted font-size-12 mb-3", children: [_jsx(PanelNodeLink, { nodeId: fromNodeId, onNodeSelect: onNodeSelect }), ' · ', choiceId, ' → ', toNodeId ? _jsx(PanelNodeLink, { nodeId: toNodeId, onNodeSelect: onNodeSelect }) : '(not connected)'] }));
|
|
18
|
+
}
|
|
19
|
+
function EdgeAppearanceSection({ choice, isPublished, onPatch, }) {
|
|
20
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "text-muted small mb-2", children: EDGE_APPEARANCE_HELPER }), _jsx("div", { className: "small fw-semibold mb-2", children: "Edge appearance" }), _jsx(ChoiceEdgeAppearanceFields, { variant: "embedded", choice: choice, isPublished: isPublished, onPatch: onPatch })] }));
|
|
21
|
+
}
|
|
22
|
+
function appearancePanelBodyClassName(hasSelection, expanded) {
|
|
23
|
+
if (hasSelection && !expanded) {
|
|
24
|
+
return 'card-body d-none';
|
|
25
|
+
}
|
|
26
|
+
return 'card-body';
|
|
27
|
+
}
|
|
28
|
+
function deriveAppearancePanelViewState({ tree, selectedNode, selectedEdge, focusChoiceId, onUpdateChoiceEdgeHints, }) {
|
|
29
|
+
const edgeFocused = Boolean(selectedEdge);
|
|
30
|
+
const contextNode = selectedNode ??
|
|
31
|
+
(selectedEdge ? tree.nodes[selectedEdge.fromNodeId] ?? null : null);
|
|
32
|
+
const choices = contextNode?.choices ?? [];
|
|
33
|
+
const activeChoiceId = resolveActiveChoiceId(choices, selectedEdge, focusChoiceId);
|
|
34
|
+
const activeChoice = activeChoiceId
|
|
35
|
+
? choices.find((choice) => choice.id === activeChoiceId) ?? null
|
|
36
|
+
: null;
|
|
37
|
+
const choiceFocused = Boolean(focusChoiceId &&
|
|
38
|
+
!edgeFocused &&
|
|
39
|
+
selectedNode &&
|
|
40
|
+
choices.some((choice) => choice.id === focusChoiceId));
|
|
41
|
+
const edgeAppearanceMode = edgeFocused || choiceFocused;
|
|
42
|
+
const showEdgeAppearance = Boolean(onUpdateChoiceEdgeHints && contextNode && activeChoice && edgeAppearanceMode);
|
|
43
|
+
const showNodeAppearance = Boolean(contextNode && !edgeAppearanceMode);
|
|
44
|
+
const hasSelection = Boolean(selectedNode || selectedEdge);
|
|
45
|
+
const edgeFromNodeId = selectedEdge?.fromNodeId ?? (choiceFocused ? selectedNode?.id ?? null : null);
|
|
46
|
+
const edgeToNodeId = selectedEdge?.toNodeId ??
|
|
47
|
+
(edgeFromNodeId && activeChoiceId
|
|
48
|
+
? getTransition(tree, edgeFromNodeId, activeChoiceId)?.toNodeId ?? null
|
|
49
|
+
: null);
|
|
50
|
+
return {
|
|
51
|
+
contextNode,
|
|
52
|
+
activeChoiceId,
|
|
53
|
+
activeChoice,
|
|
54
|
+
showEdgeAppearance,
|
|
55
|
+
showNodeAppearance,
|
|
56
|
+
hasSelection,
|
|
57
|
+
edgeFromNodeId,
|
|
58
|
+
edgeToNodeId,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export default function AppearancePanel({ tree, selectedNode, selectedEdge = null, focusChoiceId = null, isPublished = false, onUpdateSelectedNode, renderAppearanceFields, onUpdateChoiceEdgeHints, onNodeSelect, title = 'Appearance', emptyStateText = 'Select a node or edge to edit appearance.', helperText = 'Canvas node only (not shown in preview or training)', }) {
|
|
62
|
+
const [expanded, setExpanded] = useState(true);
|
|
63
|
+
const { contextNode, activeChoiceId, activeChoice, showEdgeAppearance, showNodeAppearance, hasSelection, edgeFromNodeId, edgeToNodeId, } = deriveAppearancePanelViewState({
|
|
64
|
+
tree,
|
|
65
|
+
selectedNode,
|
|
66
|
+
selectedEdge,
|
|
67
|
+
focusChoiceId,
|
|
68
|
+
onUpdateChoiceEdgeHints,
|
|
69
|
+
});
|
|
70
|
+
return (_jsxs("div", { className: "card mt-3", children: [_jsxs("div", { className: "card-header bg-body-secondary py-2 px-2 d-flex align-items-center min-w-0", children: [_jsx("span", { className: "fw-semibold", children: title }), hasSelection ? (_jsx(PanelHeaderCollapseCarets, { expanded: expanded, onToggle: () => setExpanded((v) => !v) })) : null] }), _jsx("div", { className: appearancePanelBodyClassName(hasSelection, expanded), "aria-hidden": Boolean(hasSelection && !expanded), children: hasSelection && contextNode ? (_jsxs(_Fragment, { children: [showNodeAppearance ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "text-muted small mb-2", children: helperText }), renderAppearanceFields({
|
|
71
|
+
tree,
|
|
72
|
+
node: contextNode,
|
|
73
|
+
isPublished,
|
|
74
|
+
onUpdateNode: onUpdateSelectedNode,
|
|
75
|
+
})] })) : null, showEdgeAppearance && edgeFromNodeId && activeChoiceId && activeChoice ? (_jsxs(_Fragment, { children: [_jsx(EdgeContextBreadcrumb, { fromNodeId: edgeFromNodeId, choiceId: activeChoiceId, toNodeId: edgeToNodeId, onNodeSelect: onNodeSelect }), _jsx(EdgeAppearanceSection, { choice: activeChoice, isPublished: isPublished, onPatch: (patch) => onUpdateChoiceEdgeHints(contextNode.id, activeChoice.id, patch) })] })) : null] })) : (_jsx("div", { className: "text-muted", children: _jsx("em", { children: emptyStateText }) })) })] }));
|
|
76
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ChoiceEdgeHints, type EditorChoice } from '@signalsafe/tree-spec-editor-core';
|
|
2
|
+
export interface ChoiceEdgeAppearanceFieldsProps {
|
|
3
|
+
choice: EditorChoice;
|
|
4
|
+
isPublished?: boolean;
|
|
5
|
+
onPatch: (patch: Partial<ChoiceEdgeHints>) => void;
|
|
6
|
+
/** Standalone adds a section border/title for embedding under choice cards. */
|
|
7
|
+
variant?: 'standalone' | 'embedded';
|
|
8
|
+
}
|
|
9
|
+
export default function ChoiceEdgeAppearanceFields({ choice, isPublished, onPatch, variant, }: Readonly<ChoiceEdgeAppearanceFieldsProps>): import("react").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=ChoiceEdgeAppearanceFields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChoiceEdgeAppearanceFields.d.ts","sourceRoot":"","sources":["../../src/panels/ChoiceEdgeAppearanceFields.tsx"],"names":[],"mappings":"AAGA,OAAO,EAIH,KAAK,eAAe,EACpB,KAAK,YAAY,EACpB,MAAM,mCAAmC,CAAC;AAE3C,MAAM,WAAW,+BAA+B;IAC5C,MAAM,EAAE,YAAY,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC;IACnD,+EAA+E;IAC/E,OAAO,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;CACvC;AAED,MAAM,CAAC,OAAO,UAAU,0BAA0B,CAAC,EAC/C,MAAM,EACN,WAAmB,EACnB,OAAO,EACP,OAAsB,GACzB,EAAE,QAAQ,CAAC,+BAA+B,CAAC,+BAqE3C"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Form } from 'react-bootstrap';
|
|
3
|
+
import { EDITOR_EDGE_TYPE_OPTIONS, getChoiceEdgeHints, resolveEdgeStrokeColorForDisplay, } from '@signalsafe/tree-spec-editor-core';
|
|
4
|
+
export default function ChoiceEdgeAppearanceFields({ choice, isPublished = false, onPatch, variant = 'standalone', }) {
|
|
5
|
+
const hints = getChoiceEdgeHints(choice);
|
|
6
|
+
const fields = (_jsxs(_Fragment, { children: [_jsx(Form.Check, { type: "switch", id: `choice-edge-show-label-${choice.id}`, className: "mb-2", label: "Show label on canvas", checked: hints.showLabel !== false, disabled: isPublished, onChange: (event) => onPatch({ showLabel: event.target.checked }) }), _jsxs(Form.Group, { className: "mb-2", children: [_jsx(Form.Label, { className: "small mb-1", children: "Stroke color" }), _jsxs("div", { className: "d-flex gap-2 align-items-center", children: [_jsx(Form.Control, { type: "color", className: "graph-editor-appearance-color-input", value: resolveEdgeStrokeColorForDisplay(choice), disabled: isPublished, onChange: (event) => onPatch({ strokeColor: event.target.value }) }), _jsx("button", { type: "button", className: "btn btn-sm btn-outline-secondary", disabled: isPublished || hints.strokeColor === undefined, onClick: () => onPatch({ strokeColor: undefined }), children: "Reset" })] })] }), _jsxs(Form.Group, { className: "mb-0", children: [_jsx(Form.Label, { className: "small mb-1", children: "Edge type" }), _jsx(Form.Select, { value: hints.edgeType ?? 'default', disabled: isPublished, onChange: (event) => onPatch({
|
|
7
|
+
edgeType: event.target.value,
|
|
8
|
+
}), children: EDITOR_EDGE_TYPE_OPTIONS.map((option) => (_jsx("option", { value: option.value ?? 'default', children: option.label }, option.value ?? 'default'))) })] })] }));
|
|
9
|
+
if (variant === 'embedded') {
|
|
10
|
+
return fields;
|
|
11
|
+
}
|
|
12
|
+
return (_jsxs("div", { className: "mt-3 pt-2 border-top", children: [_jsx("div", { className: "small fw-semibold mb-2", children: "Edge appearance (canvas only)" }), fields] }));
|
|
13
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Preset choice bundles for quick insertion into a node.
|
|
3
|
+
* Exported for custom host layouts; not yet wired in the reference graph editor page.
|
|
4
|
+
* Pair with `appendChoiceTemplate` from `@signalsafe/tree-spec-editor-core`.
|
|
5
|
+
*/
|
|
6
|
+
/** Host-provided preset choice bundle (optional stable ids per choice). */
|
|
7
|
+
export type ChoiceTemplateItem = {
|
|
8
|
+
id: string;
|
|
9
|
+
label: string;
|
|
10
|
+
choices: ReadonlyArray<{
|
|
11
|
+
label: string;
|
|
12
|
+
id?: string;
|
|
13
|
+
}>;
|
|
14
|
+
};
|
|
15
|
+
/** Host-provided single choice preset (stable id + default label). */
|
|
16
|
+
export type ChoicePresetItem = {
|
|
17
|
+
id: string;
|
|
18
|
+
label: string;
|
|
19
|
+
};
|
|
20
|
+
export interface ChoiceTemplatesPanelProps {
|
|
21
|
+
templates: ReadonlyArray<ChoiceTemplateItem>;
|
|
22
|
+
selectedNodeId: string | null;
|
|
23
|
+
isPublished?: boolean;
|
|
24
|
+
onApplyTemplate: (template: ChoiceTemplateItem) => void;
|
|
25
|
+
}
|
|
26
|
+
export default function ChoiceTemplatesPanel({ templates, selectedNodeId, isPublished, onApplyTemplate, }: Readonly<ChoiceTemplatesPanelProps>): import("react").JSX.Element;
|
|
27
|
+
//# sourceMappingURL=ChoiceTemplatesPanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChoiceTemplatesPanel.d.ts","sourceRoot":"","sources":["../../src/panels/ChoiceTemplatesPanel.tsx"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,2EAA2E;AAC3E,MAAM,MAAM,kBAAkB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,aAAa,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC1D,CAAC;AAEF,sEAAsE;AACtE,MAAM,MAAM,gBAAgB,GAAG;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,WAAW,yBAAyB;IACtC,SAAS,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;IAC7C,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,eAAe,EAAE,CAAC,QAAQ,EAAE,kBAAkB,KAAK,IAAI,CAAC;CAC3D;AAED,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,EACzC,SAAS,EACT,cAAc,EACd,WAAmB,EACnB,eAAe,GAClB,EAAE,QAAQ,CAAC,yBAAyB,CAAC,+BAiCrC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Button, Card } from 'react-bootstrap';
|
|
4
|
+
import PanelHeaderCollapseCarets from '../lib/PanelHeaderCollapseCarets';
|
|
5
|
+
export default function ChoiceTemplatesPanel({ templates, selectedNodeId, isPublished = false, onApplyTemplate, }) {
|
|
6
|
+
const [expanded, setExpanded] = useState(true);
|
|
7
|
+
const disabled = isPublished || !selectedNodeId;
|
|
8
|
+
return (_jsxs(Card, { className: "mb-3", children: [_jsxs(Card.Header, { className: "d-flex align-items-center justify-content-between py-2", children: [_jsx("span", { className: "fw-semibold", children: "Choice templates" }), _jsx(PanelHeaderCollapseCarets, { expanded: expanded, onToggle: () => setExpanded((value) => !value) })] }), _jsx("div", { className: `card-body py-2${expanded ? '' : ' d-none'}`, "aria-hidden": !expanded, children: selectedNodeId ? (_jsx("div", { className: "d-flex flex-wrap gap-2", children: templates.map((template) => (_jsx(Button, { type: "button", size: "sm", variant: "outline-secondary", disabled: disabled, title: template.choices.map((choice) => choice.label).join(' · '), onClick: () => onApplyTemplate(template), children: template.label }, template.id))) })) : (_jsx("p", { className: "text-muted small mb-0", children: "Select a node to add preset choices." })) })] }));
|
|
9
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AutosaveStatus } from '@signalsafe/tree-spec-editor-core';
|
|
1
|
+
import { type AutosaveStatus, type GraphEditorEdgeType } from '@signalsafe/tree-spec-editor-core';
|
|
2
2
|
export interface GraphEditorInfoPanelProps {
|
|
3
3
|
scenarioId: string;
|
|
4
4
|
versionId: string;
|
|
@@ -15,6 +15,9 @@ export interface GraphEditorInfoPanelProps {
|
|
|
15
15
|
title?: string;
|
|
16
16
|
/** Optional formatter for ISO timestamps. Defaults to `new Date(iso).toLocaleString()`. */
|
|
17
17
|
formatTimestamp?: (iso: string) => string;
|
|
18
|
+
/** Scenario-level default edge routing when a choice uses Default. */
|
|
19
|
+
defaultEdgeType?: GraphEditorEdgeType;
|
|
20
|
+
onUpdateDefaultEdgeType?: (edgeType: GraphEditorEdgeType) => void;
|
|
18
21
|
}
|
|
19
|
-
export default function GraphEditorInfoPanel({ scenarioId, versionId, name, createdAt, updatedAt, isPublished, autosaveStatus, lastValidatedAt, title, formatTimestamp, }: Readonly<GraphEditorInfoPanelProps>): import("react
|
|
22
|
+
export default function GraphEditorInfoPanel({ scenarioId, versionId, name, createdAt, updatedAt, isPublished, autosaveStatus, lastValidatedAt, title, formatTimestamp, defaultEdgeType, onUpdateDefaultEdgeType, }: Readonly<GraphEditorInfoPanelProps>): import("react").JSX.Element;
|
|
20
23
|
//# sourceMappingURL=GraphEditorInfoPanel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphEditorInfoPanel.d.ts","sourceRoot":"","sources":["../../src/panels/GraphEditorInfoPanel.tsx"],"names":[],"mappings":"AAKA,OAAO,
|
|
1
|
+
{"version":3,"file":"GraphEditorInfoPanel.d.ts","sourceRoot":"","sources":["../../src/panels/GraphEditorInfoPanel.tsx"],"names":[],"mappings":"AAKA,OAAO,EAGH,KAAK,cAAc,EACnB,KAAK,mBAAmB,EAC3B,MAAM,mCAAmC,CAAC;AAE3C,MAAM,WAAW,yBAAyB;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,kEAAkE;IAClE,WAAW,EAAE,OAAO,CAAC;IACrB,2DAA2D;IAC3D,cAAc,EAAE,cAAc,CAAC;IAC/B,gFAAgF;IAChF,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2FAA2F;IAC3F,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;IAC1C,sEAAsE;IACtE,eAAe,CAAC,EAAE,mBAAmB,CAAC;IACtC,uBAAuB,CAAC,EAAE,CAAC,QAAQ,EAAE,mBAAmB,KAAK,IAAI,CAAC;CACrE;AA0BD,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,EACzC,UAAU,EACV,SAAS,EACT,IAAI,EACJ,SAAS,EACT,SAAS,EACT,WAAW,EACX,cAAc,EACd,eAAe,EACf,KAAc,EACd,eAAwC,EACxC,eAA8B,EAC9B,uBAAuB,GAC1B,EAAE,QAAQ,CAAC,yBAAyB,CAAC,+BAsFrC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from 'react';
|
|
3
|
-
import { Badge, Table } from 'react-bootstrap';
|
|
3
|
+
import { Badge, Form, Table } from 'react-bootstrap';
|
|
4
4
|
import PanelHeaderCollapseCarets from '../lib/PanelHeaderCollapseCarets';
|
|
5
|
-
import { getAutosaveStatusLabel } from '@signalsafe/tree-spec-editor-core';
|
|
5
|
+
import { EDITOR_EDGE_TYPE_OPTIONS, getAutosaveStatusLabel, } from '@signalsafe/tree-spec-editor-core';
|
|
6
6
|
function defaultFormatTimestamp(iso) {
|
|
7
7
|
return new Date(iso).toLocaleString();
|
|
8
8
|
}
|
|
@@ -17,9 +17,9 @@ function autosaveDisplay(isPublished, status) {
|
|
|
17
17
|
const label = getAutosaveStatusLabel(status);
|
|
18
18
|
return label || '—';
|
|
19
19
|
}
|
|
20
|
-
export default function GraphEditorInfoPanel({ scenarioId, versionId, name, createdAt, updatedAt, isPublished, autosaveStatus, lastValidatedAt, title = 'Info', formatTimestamp = defaultFormatTimestamp, }) {
|
|
20
|
+
export default function GraphEditorInfoPanel({ scenarioId, versionId, name, createdAt, updatedAt, isPublished, autosaveStatus, lastValidatedAt, title = 'Info', formatTimestamp = defaultFormatTimestamp, defaultEdgeType = 'smoothstep', onUpdateDefaultEdgeType, }) {
|
|
21
21
|
const [expanded, setExpanded] = useState(true);
|
|
22
|
-
return (_jsxs("div", { className: "card mb-3", children: [_jsx("div", { className: "card-header bg-body-secondary py-2 px-2", children: _jsxs("div", { className: "d-flex align-items-center flex-wrap gap-1", children: [_jsx("h5", { className: "mb-0", children: title }), _jsx(PanelHeaderCollapseCarets, { expanded: expanded, onToggle: () => setExpanded((v) => !v) })] }) }),
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
return (_jsxs("div", { className: "card mb-3", children: [_jsx("div", { className: "card-header bg-body-secondary py-2 px-2", children: _jsxs("div", { className: "d-flex align-items-center flex-wrap gap-1", children: [_jsx("h5", { className: "mb-0", children: title }), _jsx(PanelHeaderCollapseCarets, { expanded: expanded, onToggle: () => setExpanded((v) => !v) })] }) }), _jsxs("div", { className: `card-body p-0${expanded ? '' : ' d-none'}`, "aria-hidden": !expanded, children: [_jsx(Table, { striped: true, bordered: true, hover: true, responsive: true, className: "m-0", children: _jsxs("tbody", { children: [_jsx(PropertyRow, { label: "Name", value: name }), _jsx(PropertyRow, { label: "Status", value: _jsx(Badge, { bg: isPublished ? 'success' : 'secondary', children: isPublished ? STATUS_PUBLISHED : STATUS_DRAFT }) }), _jsx(PropertyRow, { label: "Save state", value: _jsx("span", { className: "text-muted", children: autosaveDisplay(isPublished, autosaveStatus) }) }), _jsx(PropertyRow, { label: "Validated", value: _jsx("span", { className: "text-muted", children: lastValidatedAt
|
|
23
|
+
? `Validated ${formatTimestamp(lastValidatedAt)}`
|
|
24
|
+
: 'Not validated' }) }), _jsx(PropertyRow, { label: "Scenario ID", value: _jsx("span", { className: "font-monospace small text-break", children: scenarioId }) }), _jsx(PropertyRow, { label: "Version ID", value: _jsx("span", { className: "font-monospace small text-break", children: versionId }) }), _jsx(PropertyRow, { label: "Created", value: createdAt ? formatTimestamp(createdAt) : '—' }), _jsx(PropertyRow, { label: "Updated", value: updatedAt ? formatTimestamp(updatedAt) : '—' })] }) }), onUpdateDefaultEdgeType ? (_jsxs("div", { className: "p-3 border-top", children: [_jsx("div", { className: "small fw-semibold mb-2", children: "Global" }), _jsxs(Form.Group, { className: "mb-0", children: [_jsx(Form.Label, { className: "small mb-1", children: "Scenario default edge type" }), _jsx(Form.Select, { value: defaultEdgeType, disabled: isPublished, onChange: (event) => onUpdateDefaultEdgeType(event.target.value), children: EDITOR_EDGE_TYPE_OPTIONS.filter((option) => option.value !== 'default').map((option) => (_jsx("option", { value: option.value, children: option.label }, option.value))) }), _jsx("div", { className: "text-muted small mt-1", children: "Used when a choice edge type is set to Default." })] })] })) : null] })] }));
|
|
25
25
|
}
|
|
@@ -1,79 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* Renders a **Required** card (Type, Prompt, optional `renderExtraNodeFields`) and a **Choices**
|
|
5
|
-
* card (list-group rows with Label / Next / Outcome / delete). Hosts inject project-specific UI through optional render-prop slots:
|
|
6
|
-
*
|
|
7
|
-
* - `outcomeOptions`: override the END-transition outcome `<select>` options
|
|
8
|
-
* (default = the three canonical `TerminalOutcome` values from `@signalsafe/tree-spec`).
|
|
9
|
-
* - `hideOutcomeField`: hide the outcome `<select>` entirely when the host manages outcomes
|
|
10
|
-
* elsewhere.
|
|
11
|
-
* - `renderExtraNodeFields`: render additional UI below the prompt textarea, scoped to the
|
|
12
|
-
* currently-selected node.
|
|
13
|
-
* - `renderExtraChoiceFields`: render additional UI below each choice card.
|
|
14
|
-
*/
|
|
15
|
-
import type { ReactNode } from 'react';
|
|
16
|
-
import { type EditorChoice, type EditorNode, type EditorTransition, type EditorTree } from '@signalsafe/tree-spec-editor-core';
|
|
17
|
-
/**
|
|
18
|
-
* Canonical outcome values from the `@signalsafe/tree-spec` wire contract.
|
|
19
|
-
* Hosts can override via the `outcomeOptions` prop.
|
|
20
|
-
*/
|
|
21
|
-
export declare const DEFAULT_OUTCOME_OPTIONS: ReadonlyArray<{
|
|
22
|
-
value: string;
|
|
23
|
-
label: string;
|
|
24
|
-
}>;
|
|
25
|
-
export interface InspectorNodeRenderContext {
|
|
26
|
-
tree: EditorTree;
|
|
27
|
-
node: EditorNode;
|
|
28
|
-
isPublished: boolean;
|
|
29
|
-
onUpdateNode: (patch: Partial<EditorNode>) => void;
|
|
30
|
-
}
|
|
31
|
-
export interface InspectorChoiceRenderContext {
|
|
32
|
-
tree: EditorTree;
|
|
33
|
-
node: EditorNode;
|
|
34
|
-
choice: EditorChoice;
|
|
35
|
-
transition: EditorTransition | undefined;
|
|
36
|
-
isPublished: boolean;
|
|
37
|
-
onUpdateNode: (patch: Partial<EditorNode>) => void;
|
|
38
|
-
}
|
|
39
|
-
export interface InspectorPanelProps {
|
|
40
|
-
tree: EditorTree;
|
|
41
|
-
selectedNode: EditorNode | null;
|
|
42
|
-
focusChoiceId?: string | null;
|
|
43
|
-
isPublished?: boolean;
|
|
44
|
-
onUpdateSelectedNode: (patch: Partial<EditorNode>) => void;
|
|
45
|
-
onAddChoice: () => void;
|
|
46
|
-
onDeleteChoice: (choiceId: string) => void;
|
|
47
|
-
onSetChoiceTarget: (choiceId: string, targetNodeId: string) => void;
|
|
48
|
-
onSetChoiceOutcome: (choiceId: string, outcome: string) => void;
|
|
49
|
-
/**
|
|
50
|
-
* Override the END-transition outcome `<select>` options.
|
|
51
|
-
* Defaults to the canonical TreeSpec `TerminalOutcome` values.
|
|
52
|
-
*/
|
|
53
|
-
outcomeOptions?: ReadonlyArray<{
|
|
54
|
-
value: string;
|
|
55
|
-
label: string;
|
|
56
|
-
}>;
|
|
57
|
-
/** Hide the outcome selector entirely. Useful when the host manages outcomes elsewhere. */
|
|
58
|
-
hideOutcomeField?: boolean;
|
|
59
|
-
/** Render extra UI below the prompt textarea, scoped to the current node. */
|
|
60
|
-
renderExtraNodeFields?: (ctx: InspectorNodeRenderContext) => ReactNode;
|
|
61
|
-
/** Render extra UI below each choice card (after Next/Outcome). */
|
|
62
|
-
renderExtraChoiceFields?: (ctx: InspectorChoiceRenderContext) => ReactNode;
|
|
63
|
-
/**
|
|
64
|
-
* When set, shows a delete control in the Required card header (grid-style icon button).
|
|
65
|
-
* Typical host: `editor.actions.deleteSelectedNode`. Disabled when `isPublished` is true.
|
|
66
|
-
*/
|
|
67
|
-
onDeleteSelectedNode?: () => void;
|
|
68
|
-
/** Override the Required card header (default "Required"). */
|
|
69
|
-
title?: string;
|
|
70
|
-
/** Override the empty-state message (default "Select a node to edit it."). */
|
|
71
|
-
emptyStateText?: string;
|
|
72
|
-
/**
|
|
73
|
-
* Override the muted helper text under the Type field.
|
|
74
|
-
* Defaults to: "Type is stored as a string in tree_spec. You can use presets or any custom value."
|
|
75
|
-
*/
|
|
76
|
-
typeHelperText?: string;
|
|
77
|
-
}
|
|
78
|
-
export default function InspectorPanel({ tree, selectedNode, focusChoiceId, isPublished, onUpdateSelectedNode, onAddChoice, onDeleteChoice, onSetChoiceTarget, onSetChoiceOutcome, outcomeOptions, hideOutcomeField, renderExtraNodeFields, renderExtraChoiceFields, title, emptyStateText, typeHelperText, onDeleteSelectedNode, }: Readonly<InspectorPanelProps>): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import { type InspectorPanelProps } from './inspector/types';
|
|
2
|
+
export { DEFAULT_OUTCOME_OPTIONS, type ChoiceTypeOption, type InspectorChoiceRenderContext, type InspectorNodeRenderContext, type InspectorPanelProps, } from './inspector/types';
|
|
3
|
+
export default function InspectorPanel({ tree, selectedNode, focusChoiceId, isPublished, onUpdateSelectedNode, onAddChoice, onDeleteChoice, onMoveChoice, onSetChoiceTarget, onSetChoiceOutcome, outcomeOptions, hideOutcomeField, renderExtraNodeFields, renderExtraChoiceFields, choiceTypes, onSetChoiceType, title, emptyStateText, typeHelperText, onDeleteSelectedNode, onFocusChoice, }: Readonly<InspectorPanelProps>): import("react").JSX.Element;
|
|
79
4
|
//# sourceMappingURL=InspectorPanel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InspectorPanel.d.ts","sourceRoot":"","sources":["../../src/panels/InspectorPanel.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"InspectorPanel.d.ts","sourceRoot":"","sources":["../../src/panels/InspectorPanel.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAGH,KAAK,mBAAmB,EAC3B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACH,uBAAuB,EACvB,KAAK,gBAAgB,EACrB,KAAK,4BAA4B,EACjC,KAAK,0BAA0B,EAC/B,KAAK,mBAAmB,GAC3B,MAAM,mBAAmB,CAAC;AAE3B,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACnC,IAAI,EACJ,YAAY,EACZ,aAAoB,EACpB,WAAmB,EACnB,oBAAoB,EACpB,WAAW,EACX,cAAc,EACd,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,cAAwC,EACxC,gBAAwB,EACxB,qBAAqB,EACrB,uBAAuB,EACvB,WAAW,EACX,eAAe,EACf,KAAkB,EAClB,cAA4C,EAC5C,cAAyC,EACzC,oBAAoB,EACpB,aAAa,GAChB,EAAE,QAAQ,CAAC,mBAAmB,CAAC,+BAuC/B"}
|