@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.
Files changed (70) hide show
  1. package/README.md +132 -33
  2. package/dist/index.d.ts +39 -41
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +23 -26
  5. package/dist/lib/PanelHeaderCollapseCarets.d.ts.map +1 -1
  6. package/dist/lib/PanelHeaderCollapseCarets.js +2 -1
  7. package/dist/lib/panelHelpers.d.ts +8 -1
  8. package/dist/lib/panelHelpers.d.ts.map +1 -1
  9. package/dist/lib/panelHelpers.js +14 -6
  10. package/dist/lib/panelNodeLink.d.ts.map +1 -1
  11. package/dist/lib/panelNodeLink.js +2 -1
  12. package/dist/lib/selectionStyles.d.ts +6 -6
  13. package/dist/lib/selectionStyles.d.ts.map +1 -1
  14. package/dist/lib/selectionStyles.js +6 -6
  15. package/dist/modals/AuditLogModal.d.ts +0 -6
  16. package/dist/modals/AuditLogModal.d.ts.map +1 -1
  17. package/dist/modals/AuditLogModal.js +6 -5
  18. package/dist/modals/DraftHistoryModal.d.ts +0 -10
  19. package/dist/modals/DraftHistoryModal.d.ts.map +1 -1
  20. package/dist/modals/DraftHistoryModal.js +6 -5
  21. package/dist/modals/PublishReviewModal.d.ts.map +1 -1
  22. package/dist/modals/PublishReviewModal.js +3 -2
  23. package/dist/panels/AdvancedJsonPanel.d.ts +1 -1
  24. package/dist/panels/AdvancedJsonPanel.d.ts.map +1 -1
  25. package/dist/panels/AdvancedJsonPanel.js +4 -4
  26. package/dist/panels/AppearancePanel.d.ts +1 -1
  27. package/dist/panels/AppearancePanel.d.ts.map +1 -1
  28. package/dist/panels/AppearancePanel.js +9 -11
  29. package/dist/panels/ChoiceEdgeAppearanceFields.d.ts.map +1 -1
  30. package/dist/panels/ChoiceEdgeAppearanceFields.js +4 -3
  31. package/dist/panels/ChoiceTemplatesPanel.d.ts.map +1 -1
  32. package/dist/panels/ChoiceTemplatesPanel.js +4 -3
  33. package/dist/panels/GraphEditorInfoPanel.d.ts.map +1 -1
  34. package/dist/panels/GraphEditorInfoPanel.js +6 -5
  35. package/dist/panels/InspectorPanel.d.ts +2 -2
  36. package/dist/panels/InspectorPanel.d.ts.map +1 -1
  37. package/dist/panels/InspectorPanel.js +5 -5
  38. package/dist/panels/IssuesPanel.d.ts.map +1 -1
  39. package/dist/panels/IssuesPanel.js +7 -8
  40. package/dist/panels/NodesPanel.d.ts.map +1 -1
  41. package/dist/panels/NodesPanel.js +9 -8
  42. package/dist/panels/SelectedEdgePanel.d.ts +2 -2
  43. package/dist/panels/SelectedEdgePanel.d.ts.map +1 -1
  44. package/dist/panels/SelectedEdgePanel.js +4 -3
  45. package/dist/panels/ToolbarPanel.d.ts +6 -18
  46. package/dist/panels/ToolbarPanel.d.ts.map +1 -1
  47. package/dist/panels/ToolbarPanel.js +10 -24
  48. package/dist/panels/inspector/ChoiceEditorCard.d.ts +1 -1
  49. package/dist/panels/inspector/ChoiceEditorCard.d.ts.map +1 -1
  50. package/dist/panels/inspector/ChoiceEditorCard.js +7 -6
  51. package/dist/panels/inspector/ChoiceEditorList.d.ts +1 -1
  52. package/dist/panels/inspector/ChoiceEditorList.d.ts.map +1 -1
  53. package/dist/panels/inspector/ChoiceEditorList.js +5 -3
  54. package/dist/panels/inspector/NodeTypeField.d.ts.map +1 -1
  55. package/dist/panels/inspector/NodeTypeField.js +4 -3
  56. package/dist/panels/inspector/RequiredNodeCard.d.ts +1 -1
  57. package/dist/panels/inspector/RequiredNodeCard.d.ts.map +1 -1
  58. package/dist/panels/inspector/RequiredNodeCard.js +5 -4
  59. package/dist/panels/inspector/choiceActionIconProps.d.ts +3 -2
  60. package/dist/panels/inspector/choiceActionIconProps.d.ts.map +1 -1
  61. package/dist/panels/inspector/choiceActionIconProps.js +4 -2
  62. package/dist/ui/editorClasses.d.ts +66 -0
  63. package/dist/ui/editorClasses.d.ts.map +1 -0
  64. package/dist/ui/editorClasses.js +89 -0
  65. package/dist/ui/primitives.d.ts +23 -0
  66. package/dist/ui/primitives.d.ts.map +1 -0
  67. package/dist/ui/primitives.js +32 -0
  68. package/docs/UI_KIT_AGNOSTIC_REFACTOR.md +186 -0
  69. package/docs/UI_KIT_AGNOSTIC_USAGE.md +129 -0
  70. package/package.json +11 -9
@@ -6,9 +6,9 @@
6
6
  */
7
7
  import type { ReactNode } from 'react';
8
8
  import type { EditorTransition } from '@signalsafe/tree-spec-editor-core';
9
- import { type PanelNodeLinkContext } from '../lib/panelNodeLink';
9
+ import { type PanelNodeLinkContext } from '../lib/panelNodeLink.js';
10
10
  export type SelectedEdgeDetailsContext = PanelNodeLinkContext;
11
- export { PanelNodeLink } from '../lib/panelNodeLink';
11
+ export { PanelNodeLink } from '../lib/panelNodeLink.js';
12
12
  export interface SelectedEdgePanelProps {
13
13
  selectedEdge: EditorTransition | null;
14
14
  /** Select a node when its id is clicked in the default details line. */
@@ -1 +1 @@
1
- {"version":3,"file":"SelectedEdgePanel.d.ts","sourceRoot":"","sources":["../../src/panels/SelectedEdgePanel.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAE1E,OAAO,EAA+B,KAAK,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE9F,MAAM,MAAM,0BAA0B,GAAG,oBAAoB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,MAAM,WAAW,sBAAsB;IACnC,YAAY,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACtC,wEAAwE;IACxE,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,yDAAyD;IACzD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,gBAAgB,EAAE,GAAG,EAAE,0BAA0B,KAAK,SAAS,CAAC;CAC1F;AAED,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACtC,YAAY,EACZ,YAAY,EACZ,KAAuB,EACvB,aAA2C,GAC9C,EAAE,QAAQ,CAAC,sBAAsB,CAAC,sCAalC"}
1
+ {"version":3,"file":"SelectedEdgePanel.d.ts","sourceRoot":"","sources":["../../src/panels/SelectedEdgePanel.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAE1E,OAAO,EAA+B,KAAK,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AASjG,MAAM,MAAM,0BAA0B,GAAG,oBAAoB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,MAAM,WAAW,sBAAsB;IACnC,YAAY,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACtC,wEAAwE;IACxE,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,yDAAyD;IACzD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,gBAAgB,EAAE,GAAG,EAAE,0BAA0B,KAAK,SAAS,CAAC;CAC1F;AAED,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACtC,YAAY,EACZ,YAAY,EACZ,KAAuB,EACvB,aAA2C,GAC9C,EAAE,QAAQ,CAAC,sBAAsB,CAAC,sCAalC"}
@@ -1,8 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { renderDefaultEdgeBreadcrumb } from '../lib/panelNodeLink';
3
- export { PanelNodeLink } from '../lib/panelNodeLink';
2
+ import { renderDefaultEdgeBreadcrumb } from '../lib/panelNodeLink.js';
3
+ import { EDITOR_CARD, EDITOR_CARD_BODY, EDITOR_MUTED, EDITOR_SPACING_MT_3, joinClasses, } from '../ui/editorClasses.js';
4
+ export { PanelNodeLink } from '../lib/panelNodeLink.js';
4
5
  export default function SelectedEdgePanel({ selectedEdge, onNodeSelect, title = 'Selected Edge', renderDetails = renderDefaultEdgeBreadcrumb, }) {
5
6
  if (!selectedEdge)
6
7
  return null;
7
- return (_jsx("div", { className: "card mt-3", children: _jsxs("div", { className: "card-body", children: [_jsx("div", { className: "fw-bold", children: title }), _jsx("div", { className: "text-muted font-size-12", children: renderDetails(selectedEdge, { onNodeSelect }) })] }) }));
8
+ return (_jsx("div", { className: joinClasses(EDITOR_CARD, EDITOR_SPACING_MT_3), children: _jsxs("div", { className: EDITOR_CARD_BODY, children: [_jsx("div", { className: "graph-editor-text--bold", children: title }), _jsx("div", { className: joinClasses(EDITOR_MUTED, 'graph-editor-text--sm'), children: renderDetails(selectedEdge, { onNodeSelect }) })] }) }));
8
9
  }
@@ -1,15 +1,3 @@
1
- /**
2
- * Data-driven toolbar for the TreeSpec graph editor (and similar editor pages).
3
- *
4
- * Hosts pass an array of `ToolbarItem`s describing the visual elements they want in
5
- * the toolbar — buttons, dropdowns, badges, plain text, or arbitrary custom render
6
- * functions. The package owns layout (wrap, gap, alignment) and Bootstrap chrome;
7
- * the host owns every label, disabled rule, adapter-gated visibility, and callback
8
- * (encoded as closures inside each item).
9
- *
10
- * The `custom` item kind exists for one-offs like router-aware links — that way
11
- * the package stays free of `react-router` (or any other) routing concerns.
12
- */
13
1
  import { type ReactNode } from 'react';
14
2
  /**
15
3
  * Discriminator values used by the `kind` field on every {@link ToolbarItem}.
@@ -31,7 +19,7 @@ export interface ToolbarButtonItem {
31
19
  id?: string;
32
20
  label: ReactNode;
33
21
  onClick: () => void;
34
- /** Bootstrap variant. Default: `"outline-secondary"`. */
22
+ /** Visual tone hook (e.g. `neutral`, `success`, `primary`). Default: `neutral`. Legacy Bootstrap variant strings are mapped. */
35
23
  variant?: string;
36
24
  disabled?: boolean;
37
25
  title?: string;
@@ -44,7 +32,7 @@ export interface ToolbarDropdownEntry {
44
32
  label: ReactNode;
45
33
  onClick?: () => void;
46
34
  disabled?: boolean;
47
- /** When true, render a `<Dropdown.Divider />` and ignore label/onClick. */
35
+ /** When true, render a menu divider and ignore label/onClick. */
48
36
  divider?: boolean;
49
37
  }
50
38
  export interface ToolbarDropdownItem {
@@ -52,7 +40,7 @@ export interface ToolbarDropdownItem {
52
40
  id?: string;
53
41
  label: ReactNode;
54
42
  entries: ToolbarDropdownEntry[];
55
- /** Bootstrap variant for the toggle. Default: `"outline-secondary"`. */
43
+ /** Toggle tone hook. Default: `neutral`. Legacy Bootstrap variant strings are mapped. */
56
44
  variant?: string;
57
45
  disabled?: boolean;
58
46
  className?: string;
@@ -61,7 +49,7 @@ export interface ToolbarBadgeItem {
61
49
  kind: typeof TOOLBAR_ITEM_KIND.BADGE;
62
50
  id?: string;
63
51
  label: ReactNode;
64
- /** Bootstrap badge variant (e.g. `"success"`, `"secondary"`). Default: `"secondary"`. */
52
+ /** Badge tone hook (e.g. `success`, `neutral`). Default: `neutral`. */
65
53
  variant?: string;
66
54
  className?: string;
67
55
  }
@@ -69,7 +57,7 @@ export interface ToolbarTextItem {
69
57
  kind: typeof TOOLBAR_ITEM_KIND.TEXT;
70
58
  id?: string;
71
59
  content: ReactNode;
72
- /** Override the default `"ms-2 text-muted font-size-12"` styling. */
60
+ /** Override default muted toolbar text styling. */
73
61
  className?: string;
74
62
  }
75
63
  export interface ToolbarCustomItem {
@@ -81,7 +69,7 @@ export interface ToolbarCustomItem {
81
69
  export type ToolbarItem = ToolbarButtonItem | ToolbarDropdownItem | ToolbarBadgeItem | ToolbarTextItem | ToolbarCustomItem;
82
70
  export interface ToolbarPanelProps {
83
71
  items: ToolbarItem[];
84
- /** Override the outer wrapper className. Default: `"d-flex gap-2 align-items-center flex-wrap"`. */
72
+ /** Override the outer wrapper className. */
85
73
  className?: string;
86
74
  }
87
75
  export default function ToolbarPanel({ items, className, }: Readonly<ToolbarPanelProps>): import("react").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"ToolbarPanel.d.ts","sourceRoot":"","sources":["../../src/panels/ToolbarPanel.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGjD;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;;;;;;CAMpB,CAAC;AAEX,0EAA0E;AAC1E,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC;AAEzF,MAAM,WAAW,iBAAiB;IAC9B,IAAI,EAAE,OAAO,iBAAiB,CAAC,MAAM,CAAC;IACtC,+EAA+E;IAC/E,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,yDAAyD;IACzD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,iDAAiD;AACjD,MAAM,WAAW,oBAAoB;IACjC,+EAA+E;IAC/E,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,mBAAmB;IAChC,IAAI,EAAE,OAAO,iBAAiB,CAAC,QAAQ,CAAC;IACxC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,oBAAoB,EAAE,CAA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B,uEAAuE;IACvE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,OAAO,iBAAiB,CAAC,IAAI,CAAC;IACpC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,SAAS,CAAC;IACnB,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAC9B,IAAI,EAAE,OAAO,iBAAiB,CAAC,MAAM,CAAC;IACtC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,oFAAoF;IACpF,MAAM,EAAE,MAAM,SAAS,CAAC;CAC3B;AAED,MAAM,MAAM,WAAW,GACjB,iBAAiB,GACjB,mBAAmB,GACnB,gBAAgB,GAChB,eAAe,GACf,iBAAiB,CAAC;AAExB,MAAM,WAAW,iBAAiB;IAC9B,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAwED,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACjC,KAAK,EACL,SAAiD,GACpD,EAAE,QAAQ,CAAC,iBAAiB,CAAC,+BAQ7B"}
@@ -1,18 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- /**
3
- * Data-driven toolbar for the TreeSpec graph editor (and similar editor pages).
4
- *
5
- * Hosts pass an array of `ToolbarItem`s describing the visual elements they want in
6
- * the toolbar — buttons, dropdowns, badges, plain text, or arbitrary custom render
7
- * functions. The package owns layout (wrap, gap, alignment) and Bootstrap chrome;
8
- * the host owns every label, disabled rule, adapter-gated visibility, and callback
9
- * (encoded as closures inside each item).
10
- *
11
- * The `custom` item kind exists for one-offs like router-aware links — that way
12
- * the package stays free of `react-router` (or any other) routing concerns.
13
- */
14
2
  import { Fragment } from 'react';
15
- import { Button, Dropdown } from 'react-bootstrap';
3
+ import { EDITOR_DROPDOWN, EDITOR_DROPDOWN_DIVIDER, EDITOR_DROPDOWN_ITEM, EDITOR_DROPDOWN_MENU, EDITOR_FLEX, EDITOR_MUTED, editorBadgeToneClass, editorBtnToneClass, joinClasses, } from '../ui/editorClasses.js';
16
4
  /**
17
5
  * Discriminator values used by the `kind` field on every {@link ToolbarItem}.
18
6
  * Use these constants instead of bare string literals (e.g.
@@ -25,25 +13,23 @@ export const TOOLBAR_ITEM_KIND = {
25
13
  TEXT: 'text',
26
14
  CUSTOM: 'custom',
27
15
  };
28
- const DEFAULT_BUTTON_VARIANT = 'outline-secondary';
29
- const DEFAULT_DROPDOWN_VARIANT = 'outline-secondary';
30
- const DEFAULT_BADGE_VARIANT = 'secondary';
31
- const DEFAULT_TEXT_CLASS = 'ms-2 text-muted font-size-12';
32
- const DEFAULT_WRAPPER_CLASS = 'd-flex gap-2 align-items-center flex-wrap';
16
+ const DEFAULT_TEXT_CLASS = `${EDITOR_MUTED} graph-editor-toolbar__text`;
33
17
  function renderItem(item) {
34
18
  switch (item.kind) {
35
19
  case TOOLBAR_ITEM_KIND.BUTTON:
36
- return (_jsx(Button, { variant: item.variant ?? DEFAULT_BUTTON_VARIANT, onClick: item.onClick, disabled: item.disabled, title: item.title, className: item.className, children: item.label }));
20
+ return (_jsx("button", { type: "button", className: joinClasses(editorBtnToneClass(item.variant), item.className), onClick: item.onClick, disabled: item.disabled, title: item.title, children: item.label }));
37
21
  case TOOLBAR_ITEM_KIND.DROPDOWN:
38
- return (_jsxs(Dropdown, { className: item.className ?? 'd-inline', children: [_jsx(Dropdown.Toggle, { variant: item.variant ?? DEFAULT_DROPDOWN_VARIANT, disabled: item.disabled, children: item.label }), _jsx(Dropdown.Menu, { children: item.entries.map((entry, idx) => {
22
+ return (_jsxs("details", { className: joinClasses(EDITOR_DROPDOWN, item.className), children: [_jsx("summary", { className: joinClasses(editorBtnToneClass(item.variant), item.disabled && 'graph-editor-btn--disabled'), children: item.label }), _jsx("div", { className: EDITOR_DROPDOWN_MENU, role: "menu", children: item.entries.map((entry, idx) => {
39
23
  const entryKey = entry.id ?? `entry-${idx}`;
40
24
  if (entry.divider) {
41
- return _jsx(Dropdown.Divider, {}, entryKey);
25
+ return _jsx("div", { className: EDITOR_DROPDOWN_DIVIDER, role: "separator" }, entryKey);
42
26
  }
43
- return (_jsx(Dropdown.Item, { onClick: entry.onClick, disabled: entry.disabled, children: entry.label }, entryKey));
27
+ return (_jsx("button", { type: "button", role: "menuitem", className: EDITOR_DROPDOWN_ITEM, onClick: entry.disabled || !entry.onClick
28
+ ? undefined
29
+ : () => entry.onClick(), disabled: entry.disabled, children: entry.label }, entryKey));
44
30
  }) })] }));
45
31
  case TOOLBAR_ITEM_KIND.BADGE:
46
- return (_jsx("span", { className: item.className ?? `badge bg-${item.variant ?? DEFAULT_BADGE_VARIANT}`, children: item.label }));
32
+ return (_jsx("span", { className: item.className ?? editorBadgeToneClass(item.variant), children: item.label }));
47
33
  case TOOLBAR_ITEM_KIND.TEXT:
48
34
  return (_jsx("span", { className: item.className ?? DEFAULT_TEXT_CLASS, children: item.content }));
49
35
  case TOOLBAR_ITEM_KIND.CUSTOM:
@@ -52,6 +38,6 @@ function renderItem(item) {
52
38
  return null;
53
39
  }
54
40
  }
55
- export default function ToolbarPanel({ items, className = DEFAULT_WRAPPER_CLASS, }) {
41
+ export default function ToolbarPanel({ items, className = `${EDITOR_FLEX} graph-editor-toolbar`, }) {
56
42
  return (_jsx("div", { className: className, children: items.map((item, idx) => (_jsx(Fragment, { children: renderItem(item) }, item.id ?? `item-${idx}`))) }));
57
43
  }
@@ -1,6 +1,6 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import { type EditorChoice, type EditorNode, type EditorTree } from '@signalsafe/tree-spec-editor-core';
3
- import type { ChoiceTypeOption, InspectorChoiceRenderContext } from './types';
3
+ import type { ChoiceTypeOption, InspectorChoiceRenderContext } from './types.js';
4
4
  export default function ChoiceEditorCard({ choice, tree, selectedNode, focusChoiceId, isPublished, canMoveUp, canMoveDown, usedChoiceTypeIds, onUpdateSelectedNode, onDeleteChoice, onMoveChoice, onSetChoiceTarget, onSetChoiceOutcome, onSetChoiceType, choiceTypes, outcomeOptions, hideOutcomeField, renderExtraChoiceFields, onFocusChoice, }: Readonly<{
5
5
  choice: EditorChoice;
6
6
  tree: EditorTree;
@@ -1 +1 @@
1
- {"version":3,"file":"ChoiceEditorCard.d.ts","sourceRoot":"","sources":["../../../src/panels/inspector/ChoiceEditorCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,SAAS,EAAE,MAAM,OAAO,CAAC;AAGpD,OAAO,EAGH,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,UAAU,EAClB,MAAM,mCAAmC,CAAC;AAI3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAC;AAE9E,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACrC,MAAM,EACN,IAAI,EACJ,YAAY,EACZ,aAAa,EACb,WAAW,EACX,SAAS,EACT,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,EACd,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,uBAAuB,EACvB,aAAa,GAChB,EAAE,QAAQ,CAAC;IACR,MAAM,EAAE,YAAY,CAAC;IACrB,IAAI,EAAE,UAAU,CAAC;IACjB,YAAY,EAAE,UAAU,CAAC;IACzB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,iBAAiB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/B,oBAAoB,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IAC3D,cAAc,EAAE,CAA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C,EAAE,CAAC,GAAG,EAAE,4BAA4B,KAAK,SAAS,CAAC;IAC3E,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9C,CAAC,+BAgKD"}
@@ -1,8 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Form } from 'react-bootstrap';
3
2
  import { END_NODE_ID, getTransition, } from '@signalsafe/tree-spec-editor-core';
4
- import { LIST_SELECTION_CLASS, LIST_SELECTION_TEXT_CLASS } from '../../lib/selectionStyles';
5
- import { choiceActionIconProps } from './choiceActionIconProps';
3
+ import { LIST_SELECTION_CLASS, LIST_SELECTION_TEXT_CLASS } from '../../lib/selectionStyles.js';
4
+ import { EDITOR_FLEX_ALIGN_END, EDITOR_FLEX_BETWEEN, EDITOR_FLEX_FILL, EDITOR_FLEX_GROW_1, EDITOR_FLEX_ROW, EDITOR_FLEX_SHRINK_0, EDITOR_LIST_ITEM, EDITOR_MIN_W_0, EDITOR_SPACING_MB_0, EDITOR_SPACING_MB_1, EDITOR_SPACING_MB_2, EDITOR_SPACING_MT_0, EDITOR_SPACING_MT_2, joinClasses, } from '../../ui/editorClasses.js';
5
+ import { EditorField, EditorInput, EditorLabel, EditorSelect, } from '../../ui/primitives.js';
6
+ import { choiceActionIconProps } from './choiceActionIconProps.js';
6
7
  export default function ChoiceEditorCard({ choice, tree, selectedNode, focusChoiceId, isPublished, canMoveUp, canMoveDown, usedChoiceTypeIds, onUpdateSelectedNode, onDeleteChoice, onMoveChoice, onSetChoiceTarget, onSetChoiceOutcome, onSetChoiceType, choiceTypes, outcomeOptions, hideOutcomeField, renderExtraChoiceFields, onFocusChoice, }) {
7
8
  const transition = getTransition(tree, selectedNode.id, choice.id);
8
9
  const targetNodeId = transition?.toNodeId ?? '';
@@ -12,18 +13,18 @@ export default function ChoiceEditorCard({ choice, tree, selectedNode, focusChoi
12
13
  const knownTypeIds = new Set((choiceTypes ?? []).map((type) => type.id));
13
14
  const showTypeSelect = Boolean(choiceTypes?.length && onSetChoiceType);
14
15
  const isCustomType = showTypeSelect && !knownTypeIds.has(choice.id);
15
- return (_jsxs("div", { id: `choice-editor-${selectedNode.id}-${choice.id}`, className: `list-group-item py-3 px-3${isFocused ? ` ${LIST_SELECTION_CLASS} ${LIST_SELECTION_TEXT_CLASS}` : ''}`, onFocusCapture: () => onFocusChoice?.(choice.id), children: [_jsxs("div", { className: "d-flex w-100 justify-content-between align-items-end gap-2 mb-2", children: [_jsxs("div", { className: "d-flex flex-grow-1 min-w-0 gap-2", children: [showTypeSelect ? (_jsxs(Form.Group, { className: "mb-0 flex-fill min-w-0", children: [_jsx(Form.Label, { className: "mb-1", children: "Type" }), _jsxs(Form.Select, { value: isCustomType ? '__custom__' : choice.id, disabled: isPublished, "aria-label": `Choice type for ${choice.id}`, onChange: (event) => {
16
+ return (_jsxs("div", { id: `choice-editor-${selectedNode.id}-${choice.id}`, className: joinClasses(EDITOR_LIST_ITEM, isFocused && LIST_SELECTION_CLASS, isFocused && LIST_SELECTION_TEXT_CLASS), onFocusCapture: () => onFocusChoice?.(choice.id), children: [_jsxs("div", { className: joinClasses(EDITOR_FLEX_BETWEEN, EDITOR_SPACING_MB_2, EDITOR_FLEX_ALIGN_END), children: [_jsxs("div", { className: joinClasses(EDITOR_FLEX_ROW, EDITOR_FLEX_GROW_1, EDITOR_MIN_W_0, 'graph-editor-flex--gap'), children: [showTypeSelect ? (_jsxs(EditorField, { className: joinClasses(EDITOR_SPACING_MB_0, EDITOR_FLEX_FILL, EDITOR_MIN_W_0), children: [_jsx(EditorLabel, { className: EDITOR_SPACING_MB_1, children: "Type" }), _jsxs(EditorSelect, { value: isCustomType ? '__custom__' : choice.id, disabled: isPublished, "aria-label": `Choice type for ${choice.id}`, onChange: (event) => {
16
17
  const nextTypeId = event.target.value;
17
18
  if (nextTypeId && nextTypeId !== '__custom__') {
18
19
  const type = choiceTypes.find((item) => item.id === nextTypeId);
19
20
  onSetChoiceType(choice.id, nextTypeId, type?.label);
20
21
  }
21
- }, children: [choiceTypes.map((type) => (_jsx("option", { value: type.id, disabled: type.id !== choice.id && usedChoiceTypeIds.has(type.id), title: type.label, children: type.id }, type.id))), isCustomType ? (_jsxs("option", { value: "__custom__", children: [choice.id, " (custom)"] })) : null] })] })) : (_jsxs(Form.Group, { className: "mb-0 flex-fill min-w-0", children: [_jsx(Form.Label, { className: "mb-1", children: "Type" }), _jsx(Form.Control, { plaintext: true, readOnly: true, className: "text-uppercase fw-semibold", value: choice.id })] })), hideOutcomeField ? null : (_jsxs(Form.Group, { className: "mb-0 flex-fill min-w-0", children: [_jsx(Form.Label, { className: "mb-1", children: "Outcome" }), showOutcome ? (_jsx(Form.Select, { value: outcomeValue, disabled: isPublished, "aria-label": `Outcome for ${choice.id}`, onChange: (e) => onSetChoiceOutcome(choice.id, e.target.value), children: outcomeOptions.map((opt) => (_jsx("option", { value: opt.value, children: opt.label }, opt.value))) })) : (_jsx(Form.Select, { disabled: true, "aria-label": `Outcome for ${choice.id}`, value: "", children: _jsx("option", { value: "", children: "When Next is END" }) }))] }))] }), _jsxs("div", { className: "d-flex align-items-center gap-2 flex-shrink-0", children: [onMoveChoice ? (_jsxs(_Fragment, { children: [_jsx("i", { ...choiceActionIconProps(() => onMoveChoice(choice.id, 'up'), 'Move choice up', 'bi bi-chevron-up text-secondary', isPublished || !canMoveUp) }), _jsx("i", { ...choiceActionIconProps(() => onMoveChoice(choice.id, 'down'), 'Move choice down', 'bi bi-chevron-down text-secondary', isPublished || !canMoveDown) })] })) : null, _jsx("i", { ...choiceActionIconProps(() => onDeleteChoice(choice.id), 'Delete choice', 'bi bi-trash text-danger') })] })] }), _jsx(Form.Label, { className: "mt-0", children: "Label" }), _jsx(Form.Control, { value: choice.label, onChange: (event) => {
22
+ }, children: [choiceTypes.map((type) => (_jsx("option", { value: type.id, disabled: type.id !== choice.id && usedChoiceTypeIds.has(type.id), title: type.label, children: type.id }, type.id))), isCustomType ? (_jsxs("option", { value: "__custom__", children: [choice.id, " (custom)"] })) : null] })] })) : (_jsxs(EditorField, { className: joinClasses(EDITOR_SPACING_MB_0, EDITOR_FLEX_FILL, EDITOR_MIN_W_0), children: [_jsx(EditorLabel, { className: EDITOR_SPACING_MB_1, children: "Type" }), _jsx(EditorInput, { readOnly: true, className: "graph-editor-input--plain graph-editor-text--uppercase graph-editor-text--semibold", value: choice.id })] })), hideOutcomeField ? null : (_jsxs(EditorField, { className: joinClasses(EDITOR_SPACING_MB_0, EDITOR_FLEX_FILL, EDITOR_MIN_W_0), children: [_jsx(EditorLabel, { className: EDITOR_SPACING_MB_1, children: "Outcome" }), showOutcome ? (_jsx(EditorSelect, { value: outcomeValue, disabled: isPublished, "aria-label": `Outcome for ${choice.id}`, onChange: (e) => onSetChoiceOutcome(choice.id, e.target.value), children: outcomeOptions.map((opt) => (_jsx("option", { value: opt.value, children: opt.label }, opt.value))) })) : (_jsx(EditorSelect, { disabled: true, "aria-label": `Outcome for ${choice.id}`, value: "", children: _jsx("option", { value: "", children: "When Next is END" }) }))] }))] }), _jsxs("div", { className: joinClasses(EDITOR_FLEX_ROW, EDITOR_FLEX_SHRINK_0, 'graph-editor-flex--gap'), children: [onMoveChoice ? (_jsxs(_Fragment, { children: [_jsx("span", { ...choiceActionIconProps(() => onMoveChoice(choice.id, 'up'), 'Move choice up', undefined, isPublished || !canMoveUp, '↑') }), _jsx("span", { ...choiceActionIconProps(() => onMoveChoice(choice.id, 'down'), 'Move choice down', undefined, isPublished || !canMoveDown, '↓') })] })) : null, _jsx("span", { ...choiceActionIconProps(() => onDeleteChoice(choice.id), 'Delete choice', 'graph-editor-action-icon--danger', isPublished, '×') })] })] }), _jsx(EditorLabel, { className: EDITOR_SPACING_MT_0, children: "Label" }), _jsx(EditorInput, { value: choice.label, onChange: (event) => {
22
23
  const updatedChoices = (selectedNode.choices ?? []).map((existingChoice) => existingChoice.id === choice.id
23
24
  ? { ...existingChoice, label: event.target.value }
24
25
  : existingChoice);
25
26
  onUpdateSelectedNode({ choices: updatedChoices });
26
- } }), _jsx(Form.Label, { className: "mt-2", children: "Next" }), _jsxs(Form.Select, { value: targetNodeId, onChange: (e) => onSetChoiceTarget(choice.id, e.target.value), children: [_jsx("option", { value: "", children: "(not connected)" }), Object.values(tree.nodes).map((n) => (_jsxs("option", { value: n.id, children: [n.id, " \u00B7 ", n.prompt?.slice(0, 40) || n.type] }, n.id))), _jsx("option", { value: END_NODE_ID, children: "END" })] }), renderExtraChoiceFields
27
+ } }), _jsx(EditorLabel, { className: EDITOR_SPACING_MT_2, children: "Next" }), _jsxs(EditorSelect, { value: targetNodeId, onChange: (e) => onSetChoiceTarget(choice.id, e.target.value), children: [_jsx("option", { value: "", children: "(not connected)" }), Object.values(tree.nodes).map((n) => (_jsxs("option", { value: n.id, children: [n.id, " \u00B7 ", n.prompt?.slice(0, 40) || n.type] }, n.id))), _jsx("option", { value: END_NODE_ID, children: "END" })] }), renderExtraChoiceFields
27
28
  ? renderExtraChoiceFields({
28
29
  tree,
29
30
  node: selectedNode,
@@ -1,6 +1,6 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { EditorNode, EditorTree } from '@signalsafe/tree-spec-editor-core';
3
- import type { ChoiceTypeOption, InspectorChoiceRenderContext } from './types';
3
+ import type { ChoiceTypeOption, InspectorChoiceRenderContext } from './types.js';
4
4
  export default function ChoiceEditorList({ tree, selectedNode, focusChoiceId, isPublished, onAddChoice, onUpdateSelectedNode, onDeleteChoice, onMoveChoice, onSetChoiceTarget, onSetChoiceOutcome, onSetChoiceType, choiceTypes, outcomeOptions, hideOutcomeField, renderExtraChoiceFields, onFocusChoice, }: Readonly<{
5
5
  tree: EditorTree;
6
6
  selectedNode: EditorNode;
@@ -1 +1 @@
1
- {"version":3,"file":"ChoiceEditorList.d.ts","sourceRoot":"","sources":["../../../src/panels/inspector/ChoiceEditorList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OA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,CAAC;IACpE,iBAAiB,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IACpE,kBAAkB,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAChE,eAAe,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACpF,WAAW,CAAC,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAC9C,cAAc,EAAE,aAAa,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAChE,gBAAgB,EAAE,OAAO,CAAC;IAC1B,uBAAuB,CAAC,EAAE,CAAC,GAAG,EAAE,4BAA4B,KAAK,SAAS,CAAC;IAC3E,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9C,CAAC,+BAqED"}
@@ -1,10 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState } from 'react';
3
- import PanelHeaderCollapseCarets from '../../lib/PanelHeaderCollapseCarets';
4
- import ChoiceEditorCard from './ChoiceEditorCard';
3
+ import PanelHeaderCollapseCarets from '../../lib/PanelHeaderCollapseCarets.js';
4
+ import { EDITOR_CARD, EDITOR_CARD_BODY, EDITOR_CARD_HEADER, EDITOR_FLEX_BETWEEN, EDITOR_FLEX_ROW, EDITOR_FLEX_SHRINK_0, EDITOR_HIDDEN, EDITOR_LIST, EDITOR_MIN_W_0, EDITOR_MUTED, EDITOR_SCROLL, EDITOR_SPACING_MT_3, EDITOR_SPACING_PX_3, EDITOR_SPACING_PY_3, joinClasses, } from '../../ui/editorClasses.js';
5
+ import { EditorIconButton } from '../../ui/primitives.js';
6
+ import ChoiceEditorCard from './ChoiceEditorCard.js';
5
7
  export default function ChoiceEditorList({ tree, selectedNode, focusChoiceId, isPublished, onAddChoice, onUpdateSelectedNode, onDeleteChoice, onMoveChoice, onSetChoiceTarget, onSetChoiceOutcome, onSetChoiceType, choiceTypes, outcomeOptions, hideOutcomeField, renderExtraChoiceFields, onFocusChoice, }) {
6
8
  const choices = selectedNode.choices ?? [];
7
9
  const [choicesExpanded, setChoicesExpanded] = useState(true);
8
10
  const usedChoiceTypeIds = new Set(choices.map((choice) => choice.id));
9
- return (_jsxs("div", { className: "card mt-3", children: [_jsxs("div", { className: "card-header bg-body-secondary py-2 px-2 d-flex justify-content-between align-items-center gap-2", children: [_jsxs("div", { className: "d-flex align-items-center min-w-0", children: [_jsx("span", { className: "fw-semibold", children: "Choices" }), _jsx(PanelHeaderCollapseCarets, { expanded: choicesExpanded, onToggle: () => setChoicesExpanded((v) => !v) })] }), _jsx("div", { className: "d-flex align-items-center gap-1 flex-shrink-0", children: _jsx("button", { type: "button", className: "btn p-0 border-0 bg-transparent flex-shrink-0", "aria-label": "Add choice", title: "Add choice", disabled: isPublished, onClick: onAddChoice, children: _jsx("i", { className: `bi bi-plus-lg action-icon${isPublished ? ' text-secondary opacity-50' : ' text-primary cursor-pointer'}`, "aria-hidden": true }) }) })] }), _jsx("div", { className: `card-body p-0${choicesExpanded ? '' : ' d-none'}`, "aria-hidden": !choicesExpanded, children: choices.length === 0 ? (_jsx("div", { className: "text-muted small py-3 px-3", children: _jsx("em", { children: "No choices" }) })) : (_jsx("div", { className: "list-group list-group-flush overflow-auto-max-h-320", children: choices.map((choice, index) => (_jsx(ChoiceEditorCard, { choice: choice, tree: tree, selectedNode: selectedNode, focusChoiceId: focusChoiceId, isPublished: isPublished, canMoveUp: index > 0, canMoveDown: index < choices.length - 1, usedChoiceTypeIds: usedChoiceTypeIds, onUpdateSelectedNode: onUpdateSelectedNode, onDeleteChoice: onDeleteChoice, onMoveChoice: onMoveChoice, onSetChoiceTarget: onSetChoiceTarget, onSetChoiceOutcome: onSetChoiceOutcome, onSetChoiceType: onSetChoiceType, choiceTypes: choiceTypes, outcomeOptions: outcomeOptions, hideOutcomeField: hideOutcomeField, renderExtraChoiceFields: renderExtraChoiceFields, onFocusChoice: onFocusChoice }, choice.id))) })) })] }));
11
+ return (_jsxs("div", { className: joinClasses(EDITOR_CARD, EDITOR_SPACING_MT_3), children: [_jsxs("div", { className: joinClasses(EDITOR_CARD_HEADER, EDITOR_FLEX_BETWEEN), children: [_jsxs("div", { className: joinClasses(EDITOR_FLEX_ROW, EDITOR_MIN_W_0), children: [_jsx("span", { className: "graph-editor-text--semibold", children: "Choices" }), _jsx(PanelHeaderCollapseCarets, { expanded: choicesExpanded, onToggle: () => setChoicesExpanded((v) => !v) })] }), _jsx("div", { className: joinClasses(EDITOR_FLEX_ROW, EDITOR_FLEX_SHRINK_0), children: _jsx(EditorIconButton, { className: joinClasses(EDITOR_FLEX_SHRINK_0, isPublished ? 'graph-editor-btn--disabled' : 'graph-editor-btn--primary'), "aria-label": "Add choice", title: "Add choice", disabled: isPublished, onClick: onAddChoice, children: "+" }) })] }), _jsx("div", { className: joinClasses(EDITOR_CARD_BODY, 'graph-editor-card__body--flush', !choicesExpanded && EDITOR_HIDDEN), "aria-hidden": !choicesExpanded, children: choices.length === 0 ? (_jsx("div", { className: joinClasses(EDITOR_MUTED, 'graph-editor-text--sm', EDITOR_SPACING_PY_3, EDITOR_SPACING_PX_3), children: _jsx("em", { children: "No choices" }) })) : (_jsx("div", { className: joinClasses(EDITOR_LIST, EDITOR_SCROLL, 'overflow-auto-max-h-320'), children: choices.map((choice, index) => (_jsx(ChoiceEditorCard, { choice: choice, tree: tree, selectedNode: selectedNode, focusChoiceId: focusChoiceId, isPublished: isPublished, canMoveUp: index > 0, canMoveDown: index < choices.length - 1, usedChoiceTypeIds: usedChoiceTypeIds, onUpdateSelectedNode: onUpdateSelectedNode, onDeleteChoice: onDeleteChoice, onMoveChoice: onMoveChoice, onSetChoiceTarget: onSetChoiceTarget, onSetChoiceOutcome: onSetChoiceOutcome, onSetChoiceType: onSetChoiceType, choiceTypes: choiceTypes, outcomeOptions: outcomeOptions, hideOutcomeField: hideOutcomeField, renderExtraChoiceFields: renderExtraChoiceFields, onFocusChoice: onFocusChoice }, choice.id))) })) })] }));
10
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"NodeTypeField.d.ts","sourceRoot":"","sources":["../../../src/panels/inspector/NodeTypeField.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEH,KAAK,UAAU,EAClB,MAAM,mCAAmC,CAAC;AAE3C,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAClC,YAAY,EACZ,WAAW,EACX,oBAAoB,EACpB,cAAc,GACjB,EAAE,QAAQ,CAAC;IACR,YAAY,EAAE,UAAU,CAAC;IACzB,WAAW,EAAE,OAAO,CAAC;IACrB,oBAAoB,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IAC3D,cAAc,EAAE,MAAM,CAAC;CAC1B,CAAC,+BAkCD"}
1
+ {"version":3,"file":"NodeTypeField.d.ts","sourceRoot":"","sources":["../../../src/panels/inspector/NodeTypeField.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEH,KAAK,UAAU,EAClB,MAAM,mCAAmC,CAAC;AAW3C,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAClC,YAAY,EACZ,WAAW,EACX,oBAAoB,EACpB,cAAc,GACjB,EAAE,QAAQ,CAAC;IACR,YAAY,EAAE,UAAU,CAAC;IACzB,WAAW,EAAE,OAAO,CAAC;IACrB,oBAAoB,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IAC3D,cAAc,EAAE,MAAM,CAAC;CAC1B,CAAC,+BAkCD"}
@@ -1,12 +1,13 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Form } from 'react-bootstrap';
3
2
  import { TREE_SPEC_NODE_TYPE_PRESETS, } from '@signalsafe/tree-spec-editor-core';
3
+ import { EDITOR_MUTED, EDITOR_SPACING_MB_2, EDITOR_SPACING_MT_1, EDITOR_SPACING_MT_2, joinClasses, } from '../../ui/editorClasses.js';
4
+ import { EditorField, EditorInput, EditorLabel, EditorSelect } from '../../ui/primitives.js';
4
5
  export default function NodeTypeField({ selectedNode, isPublished, onUpdateSelectedNode, typeHelperText, }) {
5
6
  const isPreset = TREE_SPEC_NODE_TYPE_PRESETS.includes(selectedNode.type);
6
- return (_jsxs(Form.Group, { className: "mb-2", children: [_jsx(Form.Label, { children: "Type" }), _jsxs(Form.Select, { value: isPreset ? selectedNode.type : '__custom__', onChange: (e) => {
7
+ return (_jsxs(EditorField, { className: EDITOR_SPACING_MB_2, children: [_jsx(EditorLabel, { children: "Type" }), _jsxs(EditorSelect, { value: isPreset ? selectedNode.type : '__custom__', onChange: (e) => {
7
8
  const nextType = e.target.value;
8
9
  if (nextType === '__custom__')
9
10
  return;
10
11
  onUpdateSelectedNode({ type: nextType });
11
- }, disabled: isPublished, children: [TREE_SPEC_NODE_TYPE_PRESETS.map((t) => (_jsx("option", { value: t, children: t }, t))), _jsx("option", { value: "__custom__", children: "custom\u2026" })] }), isPreset ? null : (_jsx(Form.Control, { className: "mt-2", value: selectedNode.type, onChange: (e) => onUpdateSelectedNode({ type: e.target.value }), placeholder: "Enter custom type\u2026", disabled: isPublished })), _jsx("div", { className: "text-muted mt-1 font-size-12", children: typeHelperText })] }));
12
+ }, disabled: isPublished, children: [TREE_SPEC_NODE_TYPE_PRESETS.map((t) => (_jsx("option", { value: t, children: t }, t))), _jsx("option", { value: "__custom__", children: "custom\u2026" })] }), isPreset ? null : (_jsx(EditorInput, { className: EDITOR_SPACING_MT_2, value: selectedNode.type, onChange: (e) => onUpdateSelectedNode({ type: e.target.value }), placeholder: "Enter custom type\u2026", disabled: isPublished })), _jsx("div", { className: joinClasses(EDITOR_MUTED, 'graph-editor-text--sm', EDITOR_SPACING_MT_1), children: typeHelperText })] }));
12
13
  }
@@ -1,6 +1,6 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { EditorNode, EditorTree } from '@signalsafe/tree-spec-editor-core';
3
- import type { InspectorNodeRenderContext } from './types';
3
+ import type { InspectorNodeRenderContext } from './types.js';
4
4
  export default function RequiredNodeCard({ tree, selectedNode, isPublished, title, typeHelperText, onUpdateSelectedNode, onDeleteSelectedNode, renderExtraNodeFields, }: Readonly<{
5
5
  tree: EditorTree;
6
6
  selectedNode: EditorNode;
@@ -1 +1 @@
1
- {"version":3,"file":"RequiredNodeCard.d.ts","sourceRoot":"","sources":["../../../src/panels/inspector/RequiredNodeCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,SAAS,EAAE,MAAM,OAAO,CAAC;AAIpD,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAIhF,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAE1D,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACrC,IAAI,EACJ,YAAY,EACZ,WAAW,EACX,KAAK,EACL,cAAc,EACd,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,GACxB,EAAE,QAAQ,CAAC;IACR,IAAI,EAAE,UAAU,CAAC;IACjB,YAAY,EAAE,UAAU,CAAC;IACzB,WAAW,EAAE,OAAO,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,oBAAoB,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IAC3D,oBAAoB,CAAC,EAAE,MAAM,IAAI,CAAC;IAClC,qBAAqB,CAAC,EAAE,CAAC,GAAG,EAAE,0BAA0B,KAAK,SAAS,CAAC;CAC1E,CAAC,+BA4DD"}
1
+ {"version":3,"file":"RequiredNodeCard.d.ts","sourceRoot":"","sources":["../../../src/panels/inspector/RequiredNodeCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,SAAS,EAAE,MAAM,OAAO,CAAC;AAGpD,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAiBhF,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAE7D,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACrC,IAAI,EACJ,YAAY,EACZ,WAAW,EACX,KAAK,EACL,cAAc,EACd,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,GACxB,EAAE,QAAQ,CAAC;IACR,IAAI,EAAE,UAAU,CAAC;IACjB,YAAY,EAAE,UAAU,CAAC;IACzB,WAAW,EAAE,OAAO,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,oBAAoB,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IAC3D,oBAAoB,CAAC,EAAE,MAAM,IAAI,CAAC;IAClC,qBAAqB,CAAC,EAAE,CAAC,GAAG,EAAE,0BAA0B,KAAK,SAAS,CAAC;CAC1E,CAAC,+BA2DD"}
@@ -1,11 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState } from 'react';
3
- import { Form } from 'react-bootstrap';
4
- import PanelHeaderCollapseCarets from '../../lib/PanelHeaderCollapseCarets';
5
- import NodeTypeField from './NodeTypeField';
3
+ import PanelHeaderCollapseCarets from '../../lib/PanelHeaderCollapseCarets.js';
4
+ import { EDITOR_CARD, EDITOR_CARD_BODY, EDITOR_CARD_HEADER, EDITOR_FLEX_BETWEEN, EDITOR_FLEX_ROW, EDITOR_FLEX_SHRINK_0, EDITOR_HIDDEN, EDITOR_MIN_W_0, EDITOR_SPACING_MB_2, joinClasses, } from '../../ui/editorClasses.js';
5
+ import { EditorField, EditorIconButton, EditorLabel, EditorTextarea } from '../../ui/primitives.js';
6
+ import NodeTypeField from './NodeTypeField.js';
6
7
  export default function RequiredNodeCard({ tree, selectedNode, isPublished, title, typeHelperText, onUpdateSelectedNode, onDeleteSelectedNode, renderExtraNodeFields, }) {
7
8
  const [requiredExpanded, setRequiredExpanded] = useState(true);
8
- return (_jsxs("div", { className: "card", children: [_jsxs("div", { className: "card-header bg-body-secondary py-2 px-2 d-flex justify-content-between align-items-center gap-2", children: [_jsxs("div", { className: "d-flex align-items-center min-w-0", children: [_jsx("span", { className: "fw-semibold", children: title }), _jsx(PanelHeaderCollapseCarets, { expanded: requiredExpanded, onToggle: () => setRequiredExpanded((v) => !v) })] }), onDeleteSelectedNode ? (_jsx("button", { type: "button", className: "btn p-0 border-0 bg-transparent flex-shrink-0", "aria-label": "Delete node", title: "Delete node", disabled: isPublished, onClick: onDeleteSelectedNode, children: _jsx("i", { className: `bi bi-trash action-icon cursor-pointer${isPublished ? ' text-secondary opacity-50' : ' text-danger'}`, "aria-hidden": true }) })) : null] }), _jsxs("div", { className: `card-body${requiredExpanded ? '' : ' d-none'}`, "aria-hidden": !requiredExpanded, children: [_jsx(NodeTypeField, { selectedNode: selectedNode, isPublished: isPublished, onUpdateSelectedNode: onUpdateSelectedNode, typeHelperText: typeHelperText }), _jsxs(Form.Group, { className: "mb-2", children: [_jsx(Form.Label, { children: "Prompt" }), _jsx(Form.Control, { as: "textarea", rows: 4, value: selectedNode.prompt, onChange: (e) => onUpdateSelectedNode({ prompt: e.target.value }) })] }), renderExtraNodeFields
9
+ return (_jsxs("div", { className: EDITOR_CARD, children: [_jsxs("div", { className: joinClasses(EDITOR_CARD_HEADER, EDITOR_FLEX_BETWEEN), children: [_jsxs("div", { className: joinClasses(EDITOR_FLEX_ROW, EDITOR_MIN_W_0), children: [_jsx("span", { className: "graph-editor-text--semibold", children: title }), _jsx(PanelHeaderCollapseCarets, { expanded: requiredExpanded, onToggle: () => setRequiredExpanded((v) => !v) })] }), onDeleteSelectedNode ? (_jsx(EditorIconButton, { className: joinClasses(EDITOR_FLEX_SHRINK_0, isPublished ? 'graph-editor-btn--disabled' : 'graph-editor-btn--danger'), "aria-label": "Delete node", title: "Delete node", disabled: isPublished, onClick: onDeleteSelectedNode, children: "\uD83D\uDDD1" })) : null] }), _jsxs("div", { className: joinClasses(EDITOR_CARD_BODY, !requiredExpanded && EDITOR_HIDDEN), "aria-hidden": !requiredExpanded, children: [_jsx(NodeTypeField, { selectedNode: selectedNode, isPublished: isPublished, onUpdateSelectedNode: onUpdateSelectedNode, typeHelperText: typeHelperText }), _jsxs(EditorField, { className: EDITOR_SPACING_MB_2, children: [_jsx(EditorLabel, { children: "Prompt" }), _jsx(EditorTextarea, { rows: 4, value: selectedNode.prompt, onChange: (e) => onUpdateSelectedNode({ prompt: e.target.value }) })] }), renderExtraNodeFields
9
10
  ? renderExtraNodeFields({
10
11
  tree,
11
12
  node: selectedNode,
@@ -1,11 +1,12 @@
1
- import type { KeyboardEvent, MouseEvent } from 'react';
2
- export declare function choiceActionIconProps(onClick: () => void, title: string, className: string, disabled?: boolean): {
1
+ import type { KeyboardEvent, MouseEvent, ReactNode } from 'react';
2
+ export declare function choiceActionIconProps(onClick: () => void, title: string, className?: string, disabled?: boolean, children?: ReactNode): {
3
3
  role: "button";
4
4
  tabIndex: number;
5
5
  title: string;
6
6
  'aria-label': string;
7
7
  'aria-disabled': boolean | undefined;
8
8
  className: string;
9
+ children: ReactNode;
9
10
  onClick: ((event: MouseEvent<HTMLElement>) => void) | undefined;
10
11
  onKeyDown: ((event: KeyboardEvent<HTMLElement>) => void) | undefined;
11
12
  };
@@ -1 +1 @@
1
- {"version":3,"file":"choiceActionIconProps.d.ts","sourceRoot":"","sources":["../../../src/panels/inspector/choiceActionIconProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEvD,wBAAgB,qBAAqB,CACjC,OAAO,EAAE,MAAM,IAAI,EACnB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,QAAQ,UAAQ;;;;;;;sBAaE,UAAU,CAAC,WAAW,CAAC;wBAOvB,aAAa,CAAC,WAAW,CAAC;EAQ/C"}
1
+ {"version":3,"file":"choiceActionIconProps.d.ts","sourceRoot":"","sources":["../../../src/panels/inspector/choiceActionIconProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIlE,wBAAgB,qBAAqB,CACjC,OAAO,EAAE,MAAM,IAAI,EACnB,KAAK,EAAE,MAAM,EACb,SAAS,CAAC,EAAE,MAAM,EAClB,QAAQ,UAAQ,EAChB,QAAQ,CAAC,EAAE,SAAS;;;;;;;;sBAgBF,UAAU,CAAC,WAAW,CAAC;wBAOvB,aAAa,CAAC,WAAW,CAAC;EAQ/C"}
@@ -1,11 +1,13 @@
1
- export function choiceActionIconProps(onClick, title, className, disabled = false) {
1
+ import { joinClasses } from '../../ui/editorClasses.js';
2
+ export function choiceActionIconProps(onClick, title, className, disabled = false, children) {
2
3
  return {
3
4
  role: 'button',
4
5
  tabIndex: disabled ? -1 : 0,
5
6
  title,
6
7
  'aria-label': title,
7
8
  'aria-disabled': disabled ? true : undefined,
8
- className: `${className} action-icon flex-shrink-0${disabled ? ' text-secondary opacity-50' : ' cursor-pointer'}`,
9
+ className: joinClasses('graph-editor-action-icon', className, disabled && 'graph-editor-action-icon--disabled'),
10
+ children,
9
11
  onClick: disabled
10
12
  ? undefined
11
13
  : (event) => {
@@ -0,0 +1,66 @@
1
+ /** UI-kit agnostic layout and shell class hooks (host styles via CSS or UI library). */
2
+ export declare const EDITOR_CARD = "graph-editor-card";
3
+ export declare const EDITOR_CARD_HEADER = "graph-editor-card__header";
4
+ export declare const EDITOR_CARD_BODY = "graph-editor-card__body";
5
+ export declare const EDITOR_CARD_FOOTER = "graph-editor-card__footer";
6
+ export declare const EDITOR_LIST = "graph-editor-list";
7
+ export declare const EDITOR_LIST_ITEM = "graph-editor-list__item";
8
+ export declare const EDITOR_INPUT = "graph-editor-input";
9
+ export declare const EDITOR_SELECT = "graph-editor-select";
10
+ export declare const EDITOR_TEXTAREA = "graph-editor-textarea";
11
+ export declare const EDITOR_CHECKBOX = "graph-editor-checkbox";
12
+ export declare const EDITOR_BTN = "graph-editor-btn";
13
+ export declare const EDITOR_BTN_ICON = "graph-editor-btn graph-editor-btn--icon";
14
+ export declare const EDITOR_BADGE = "graph-editor-badge";
15
+ export declare const EDITOR_MODAL = "graph-editor-modal";
16
+ export declare const EDITOR_MODAL_DIALOG = "graph-editor-modal__dialog";
17
+ export declare const EDITOR_MODAL_CONTENT = "graph-editor-modal__content";
18
+ export declare const EDITOR_MODAL_HEADER = "graph-editor-modal__header";
19
+ export declare const EDITOR_MODAL_BODY = "graph-editor-modal__body";
20
+ export declare const EDITOR_MODAL_FOOTER = "graph-editor-modal__footer";
21
+ export declare const EDITOR_MODAL_TITLE = "graph-editor-modal__title";
22
+ export declare const EDITOR_ALERT = "graph-editor-alert";
23
+ export declare const EDITOR_TABLE = "graph-editor-table";
24
+ export declare const EDITOR_DROPDOWN = "graph-editor-dropdown";
25
+ export declare const EDITOR_DROPDOWN_MENU = "graph-editor-dropdown__menu";
26
+ export declare const EDITOR_DROPDOWN_ITEM = "graph-editor-dropdown__item";
27
+ export declare const EDITOR_DROPDOWN_DIVIDER = "graph-editor-dropdown__divider";
28
+ export declare const EDITOR_FIELD = "graph-editor-field";
29
+ export declare const EDITOR_FIELD_LABEL = "graph-editor-field__label";
30
+ export declare const EDITOR_FLEX = "graph-editor-flex";
31
+ export declare const EDITOR_FLEX_BETWEEN = "graph-editor-flex graph-editor-flex--between";
32
+ export declare const EDITOR_FLEX_ROW = "graph-editor-flex graph-editor-flex--row";
33
+ export declare const EDITOR_FLEX_ALIGN_END = "graph-editor-flex graph-editor-flex--align-end";
34
+ export declare const EDITOR_FLEX_WRAP = "graph-editor-flex graph-editor-flex--wrap";
35
+ export declare const EDITOR_ALIGN_TOP = "graph-editor-align-top";
36
+ export declare const EDITOR_MIN_W_0 = "graph-editor-min-w-0";
37
+ export declare const EDITOR_FLEX_SHRINK_0 = "graph-editor-flex-shrink-0";
38
+ export declare const EDITOR_FLEX_GROW_1 = "graph-editor-flex-grow-1";
39
+ export declare const EDITOR_FLEX_FILL = "graph-editor-flex-fill";
40
+ export declare const EDITOR_TEXT_BREAK = "graph-editor-text--break";
41
+ export declare const EDITOR_TEXT_START = "graph-editor-text--start";
42
+ export declare const EDITOR_TEXT_END = "graph-editor-text--end";
43
+ export declare const EDITOR_SPACING_MB_0 = "graph-editor-spacing--mb-0";
44
+ export declare const EDITOR_SPACING_MB_1 = "graph-editor-spacing--mb-1";
45
+ export declare const EDITOR_SPACING_MB_2 = "graph-editor-spacing--mb-2";
46
+ export declare const EDITOR_SPACING_MB_3 = "graph-editor-spacing--mb-3";
47
+ export declare const EDITOR_SPACING_MT_0 = "graph-editor-spacing--mt-0";
48
+ export declare const EDITOR_SPACING_MT_1 = "graph-editor-spacing--mt-1";
49
+ export declare const EDITOR_SPACING_MT_2 = "graph-editor-spacing--mt-2";
50
+ export declare const EDITOR_SPACING_MT_3 = "graph-editor-spacing--mt-3";
51
+ export declare const EDITOR_SPACING_ME_2 = "graph-editor-spacing--me-2";
52
+ export declare const EDITOR_SPACING_MS_AUTO = "graph-editor-spacing--ms-auto";
53
+ export declare const EDITOR_SPACING_PY_2 = "graph-editor-spacing--py-2";
54
+ export declare const EDITOR_SPACING_PY_3 = "graph-editor-spacing--py-3";
55
+ export declare const EDITOR_SPACING_PX_3 = "graph-editor-spacing--px-3";
56
+ export declare const EDITOR_SPACING_PT_2 = "graph-editor-spacing--pt-2";
57
+ export declare const EDITOR_SPACING_M_0 = "graph-editor-spacing--m-0";
58
+ export declare const EDITOR_MUTED = "graph-editor-muted";
59
+ export declare const EDITOR_MONO = "graph-editor-mono";
60
+ export declare const EDITOR_HIDDEN = "graph-editor-hidden";
61
+ export declare const EDITOR_SCROLL = "graph-editor-scroll";
62
+ export declare function editorBtnToneClass(variant?: string): string;
63
+ export declare function editorBadgeToneClass(variant?: string): string;
64
+ export declare function editorAlertToneClass(tone: 'info' | 'danger'): string;
65
+ export declare function joinClasses(...parts: Array<string | false | null | undefined>): string;
66
+ //# sourceMappingURL=editorClasses.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editorClasses.d.ts","sourceRoot":"","sources":["../../src/ui/editorClasses.ts"],"names":[],"mappings":"AAAA,wFAAwF;AAExF,eAAO,MAAM,WAAW,sBAAsB,CAAC;AAC/C,eAAO,MAAM,kBAAkB,8BAA8B,CAAC;AAC9D,eAAO,MAAM,gBAAgB,4BAA4B,CAAC;AAC1D,eAAO,MAAM,kBAAkB,8BAA8B,CAAC;AAE9D,eAAO,MAAM,WAAW,sBAAsB,CAAC;AAC/C,eAAO,MAAM,gBAAgB,4BAA4B,CAAC;AAE1D,eAAO,MAAM,YAAY,uBAAuB,CAAC;AACjD,eAAO,MAAM,aAAa,wBAAwB,CAAC;AACnD,eAAO,MAAM,eAAe,0BAA0B,CAAC;AACvD,eAAO,MAAM,eAAe,0BAA0B,CAAC;AAEvD,eAAO,MAAM,UAAU,qBAAqB,CAAC;AAC7C,eAAO,MAAM,eAAe,4CAA4C,CAAC;AACzE,eAAO,MAAM,YAAY,uBAAuB,CAAC;AAEjD,eAAO,MAAM,YAAY,uBAAuB,CAAC;AACjD,eAAO,MAAM,mBAAmB,+BAA+B,CAAC;AAChE,eAAO,MAAM,oBAAoB,gCAAgC,CAAC;AAClE,eAAO,MAAM,mBAAmB,+BAA+B,CAAC;AAChE,eAAO,MAAM,iBAAiB,6BAA6B,CAAC;AAC5D,eAAO,MAAM,mBAAmB,+BAA+B,CAAC;AAChE,eAAO,MAAM,kBAAkB,8BAA8B,CAAC;AAE9D,eAAO,MAAM,YAAY,uBAAuB,CAAC;AACjD,eAAO,MAAM,YAAY,uBAAuB,CAAC;AAEjD,eAAO,MAAM,eAAe,0BAA0B,CAAC;AACvD,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AM,mBAAmB,+BAA+B,CAAC;AAChE,eAAO,MAAM,mBAAmB,+BAA+B,CAAC;AAChE,eAAO,MAAM,kBAAkB,8BAA8B,CAAC;AAC9D,eAAO,MAAM,YAAY,uBAAuB,CAAC;AACjD,eAAO,MAAM,WAAW,sBAAsB,CAAC;AAC/C,eAAO,MAAM,aAAa,wBAAwB,CAAC;AACnD,eAAO,MAAM,aAAa,wBAAwB,CAAC;AAEnD,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAG3D;AAED,wBAAgB,oBAAoB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAG7D;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,CAEpE;AAgBD,wBAAgB,WAAW,CAAC,GAAG,KAAK,EAAE,KAAK,CAAC,MAAM,GAAG,KAAK,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,MAAM,CAEtF"}
@@ -0,0 +1,89 @@
1
+ /** UI-kit agnostic layout and shell class hooks (host styles via CSS or UI library). */
2
+ export const EDITOR_CARD = 'graph-editor-card';
3
+ export const EDITOR_CARD_HEADER = 'graph-editor-card__header';
4
+ export const EDITOR_CARD_BODY = 'graph-editor-card__body';
5
+ export const EDITOR_CARD_FOOTER = 'graph-editor-card__footer';
6
+ export const EDITOR_LIST = 'graph-editor-list';
7
+ export const EDITOR_LIST_ITEM = 'graph-editor-list__item';
8
+ export const EDITOR_INPUT = 'graph-editor-input';
9
+ export const EDITOR_SELECT = 'graph-editor-select';
10
+ export const EDITOR_TEXTAREA = 'graph-editor-textarea';
11
+ export const EDITOR_CHECKBOX = 'graph-editor-checkbox';
12
+ export const EDITOR_BTN = 'graph-editor-btn';
13
+ export const EDITOR_BTN_ICON = 'graph-editor-btn graph-editor-btn--icon';
14
+ export const EDITOR_BADGE = 'graph-editor-badge';
15
+ export const EDITOR_MODAL = 'graph-editor-modal';
16
+ export const EDITOR_MODAL_DIALOG = 'graph-editor-modal__dialog';
17
+ export const EDITOR_MODAL_CONTENT = 'graph-editor-modal__content';
18
+ export const EDITOR_MODAL_HEADER = 'graph-editor-modal__header';
19
+ export const EDITOR_MODAL_BODY = 'graph-editor-modal__body';
20
+ export const EDITOR_MODAL_FOOTER = 'graph-editor-modal__footer';
21
+ export const EDITOR_MODAL_TITLE = 'graph-editor-modal__title';
22
+ export const EDITOR_ALERT = 'graph-editor-alert';
23
+ export const EDITOR_TABLE = 'graph-editor-table';
24
+ export const EDITOR_DROPDOWN = 'graph-editor-dropdown';
25
+ export const EDITOR_DROPDOWN_MENU = 'graph-editor-dropdown__menu';
26
+ export const EDITOR_DROPDOWN_ITEM = 'graph-editor-dropdown__item';
27
+ export const EDITOR_DROPDOWN_DIVIDER = 'graph-editor-dropdown__divider';
28
+ export const EDITOR_FIELD = 'graph-editor-field';
29
+ export const EDITOR_FIELD_LABEL = 'graph-editor-field__label';
30
+ export const EDITOR_FLEX = 'graph-editor-flex';
31
+ export const EDITOR_FLEX_BETWEEN = 'graph-editor-flex graph-editor-flex--between';
32
+ export const EDITOR_FLEX_ROW = 'graph-editor-flex graph-editor-flex--row';
33
+ export const EDITOR_FLEX_ALIGN_END = 'graph-editor-flex graph-editor-flex--align-end';
34
+ export const EDITOR_FLEX_WRAP = 'graph-editor-flex graph-editor-flex--wrap';
35
+ export const EDITOR_ALIGN_TOP = 'graph-editor-align-top';
36
+ export const EDITOR_MIN_W_0 = 'graph-editor-min-w-0';
37
+ export const EDITOR_FLEX_SHRINK_0 = 'graph-editor-flex-shrink-0';
38
+ export const EDITOR_FLEX_GROW_1 = 'graph-editor-flex-grow-1';
39
+ export const EDITOR_FLEX_FILL = 'graph-editor-flex-fill';
40
+ export const EDITOR_TEXT_BREAK = 'graph-editor-text--break';
41
+ export const EDITOR_TEXT_START = 'graph-editor-text--start';
42
+ export const EDITOR_TEXT_END = 'graph-editor-text--end';
43
+ export const EDITOR_SPACING_MB_0 = 'graph-editor-spacing--mb-0';
44
+ export const EDITOR_SPACING_MB_1 = 'graph-editor-spacing--mb-1';
45
+ export const EDITOR_SPACING_MB_2 = 'graph-editor-spacing--mb-2';
46
+ export const EDITOR_SPACING_MB_3 = 'graph-editor-spacing--mb-3';
47
+ export const EDITOR_SPACING_MT_0 = 'graph-editor-spacing--mt-0';
48
+ export const EDITOR_SPACING_MT_1 = 'graph-editor-spacing--mt-1';
49
+ export const EDITOR_SPACING_MT_2 = 'graph-editor-spacing--mt-2';
50
+ export const EDITOR_SPACING_MT_3 = 'graph-editor-spacing--mt-3';
51
+ export const EDITOR_SPACING_ME_2 = 'graph-editor-spacing--me-2';
52
+ export const EDITOR_SPACING_MS_AUTO = 'graph-editor-spacing--ms-auto';
53
+ export const EDITOR_SPACING_PY_2 = 'graph-editor-spacing--py-2';
54
+ export const EDITOR_SPACING_PY_3 = 'graph-editor-spacing--py-3';
55
+ export const EDITOR_SPACING_PX_3 = 'graph-editor-spacing--px-3';
56
+ export const EDITOR_SPACING_PT_2 = 'graph-editor-spacing--pt-2';
57
+ export const EDITOR_SPACING_M_0 = 'graph-editor-spacing--m-0';
58
+ export const EDITOR_MUTED = 'graph-editor-muted';
59
+ export const EDITOR_MONO = 'graph-editor-mono';
60
+ export const EDITOR_HIDDEN = 'graph-editor-hidden';
61
+ export const EDITOR_SCROLL = 'graph-editor-scroll';
62
+ export function editorBtnToneClass(variant) {
63
+ const tone = normalizeToolbarTone(variant);
64
+ return `${EDITOR_BTN} graph-editor-btn--${tone}`;
65
+ }
66
+ export function editorBadgeToneClass(variant) {
67
+ const tone = normalizeToolbarTone(variant ?? 'neutral');
68
+ return `${EDITOR_BADGE} graph-editor-badge--${tone}`;
69
+ }
70
+ export function editorAlertToneClass(tone) {
71
+ return `${EDITOR_ALERT} graph-editor-alert--${tone}`;
72
+ }
73
+ function normalizeToolbarTone(variant) {
74
+ if (!variant)
75
+ return 'neutral';
76
+ const map = {
77
+ 'outline-secondary': 'neutral',
78
+ secondary: 'neutral',
79
+ success: 'success',
80
+ primary: 'primary',
81
+ danger: 'danger',
82
+ info: 'info',
83
+ warning: 'warning',
84
+ };
85
+ return map[variant] ?? variant.replace(/^outline-/, '');
86
+ }
87
+ export function joinClasses(...parts) {
88
+ return parts.filter(Boolean).join(' ');
89
+ }
@@ -0,0 +1,23 @@
1
+ import type { ButtonHTMLAttributes, InputHTMLAttributes, LabelHTMLAttributes, ReactNode, SelectHTMLAttributes, TextareaHTMLAttributes } from 'react';
2
+ export declare function EditorButton({ tone, className, children, ...rest }: ButtonHTMLAttributes<HTMLButtonElement> & {
3
+ tone?: string;
4
+ }): import("react").JSX.Element;
5
+ export declare function EditorIconButton({ className, children, ...rest }: ButtonHTMLAttributes<HTMLButtonElement>): import("react").JSX.Element;
6
+ export declare function EditorCloseButton({ className, label, ...rest }: ButtonHTMLAttributes<HTMLButtonElement> & {
7
+ label?: string;
8
+ }): import("react").JSX.Element;
9
+ export declare function EditorInput({ className, ...rest }: InputHTMLAttributes<HTMLInputElement>): import("react").JSX.Element;
10
+ export declare function EditorSelect({ className, children, ...rest }: SelectHTMLAttributes<HTMLSelectElement>): import("react").JSX.Element;
11
+ export declare function EditorTextarea({ className, ...rest }: TextareaHTMLAttributes<HTMLTextAreaElement>): import("react").JSX.Element;
12
+ export declare function EditorField({ className, children, }: {
13
+ className?: string;
14
+ children: ReactNode;
15
+ }): import("react").JSX.Element;
16
+ export declare function EditorLabel({ className, children, ...rest }: LabelHTMLAttributes<HTMLLabelElement>): import("react").JSX.Element;
17
+ export declare function EditorCheckbox({ className, label, ...rest }: InputHTMLAttributes<HTMLInputElement> & {
18
+ label?: ReactNode;
19
+ }): import("react").JSX.Element;
20
+ export declare function EditorSwitch({ className, label, ...rest }: InputHTMLAttributes<HTMLInputElement> & {
21
+ label?: ReactNode;
22
+ }): import("react").JSX.Element;
23
+ //# sourceMappingURL=primitives.d.ts.map