@principal-ai/subsystems-react 0.56.0 → 0.56.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.
Files changed (49) hide show
  1. package/dist/index.d.ts +0 -6
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +0 -3
  4. package/dist/index.js.map +1 -1
  5. package/dist/pierre/PierreTrailCodeView.d.ts +3 -3
  6. package/dist/pierre/PierreTrailCodeView.d.ts.map +1 -1
  7. package/dist/pierre/PierreTrailCodeView.js +16 -16
  8. package/dist/pierre/PierreTrailCodeView.js.map +1 -1
  9. package/dist/pierre/trailSnippet.d.ts +10 -0
  10. package/dist/pierre/trailSnippet.d.ts.map +1 -0
  11. package/dist/pierre/trailSnippet.js +22 -0
  12. package/dist/pierre/trailSnippet.js.map +1 -0
  13. package/dist/subsystem/FileDrawer.d.ts +9 -11
  14. package/dist/subsystem/FileDrawer.d.ts.map +1 -1
  15. package/dist/subsystem/FileDrawer.js +23 -23
  16. package/dist/subsystem/FileDrawer.js.map +1 -1
  17. package/dist/subsystem/GraphSidebar.d.ts.map +1 -1
  18. package/dist/subsystem/GraphSidebar.js +3 -1
  19. package/dist/subsystem/GraphSidebar.js.map +1 -1
  20. package/dist/subsystem/SubsystemComponentGraph.d.ts +4 -3
  21. package/dist/subsystem/SubsystemComponentGraph.d.ts.map +1 -1
  22. package/dist/subsystem/SubsystemComponentGraph.js +32 -30
  23. package/dist/subsystem/SubsystemComponentGraph.js.map +1 -1
  24. package/package.json +1 -1
  25. package/src/index.ts +0 -37
  26. package/src/pierre/PierreTrailCodeView.tsx +14 -23
  27. package/src/pierre/trailSnippet.test.ts +74 -0
  28. package/src/pierre/trailSnippet.ts +35 -0
  29. package/src/stories/Canvases/Subsystem/LayoutDirection.stories.tsx +55 -3
  30. package/src/subsystem/FileDrawer.test.tsx +130 -0
  31. package/src/subsystem/FileDrawer.tsx +27 -28
  32. package/src/subsystem/GraphSidebar.test.tsx +56 -1
  33. package/src/subsystem/GraphSidebar.tsx +3 -1
  34. package/src/subsystem/SubsystemComponentGraph.tsx +65 -57
  35. package/dist/subsystem/DecorationPanel.d.ts +0 -37
  36. package/dist/subsystem/DecorationPanel.d.ts.map +0 -1
  37. package/dist/subsystem/DecorationPanel.js +0 -147
  38. package/dist/subsystem/DecorationPanel.js.map +0 -1
  39. package/dist/subsystem/decoration.d.ts +0 -112
  40. package/dist/subsystem/decoration.d.ts.map +0 -1
  41. package/dist/subsystem/decoration.js +0 -54
  42. package/dist/subsystem/decoration.js.map +0 -1
  43. package/src/stories/Canvases/Subsystem/StepEmphasis.stories.tsx +0 -528
  44. package/src/stories/Components/DecorationPanel.stories.tsx +0 -160
  45. package/src/subsystem/DecorationPanel.test.tsx +0 -128
  46. package/src/subsystem/DecorationPanel.tsx +0 -334
  47. package/src/subsystem/decoration.test.ts +0 -72
  48. package/src/subsystem/decoration.ts +0 -151
  49. package/src/subsystem/stepEmphasis.test.ts +0 -110
@@ -199,7 +199,7 @@ export interface SubsystemComponentGraphProps {
199
199
  * sidebar's bottom half offers a Files/Trails toggle:
200
200
  * the flows panel lists each trail's steps (`symbol` or `file:line`);
201
201
  * clicking a flow row toggles its steps; clicking a step focuses that
202
- * step's edge and (when `renderTrailViewer` is set) opens the bottom
202
+ * step's edge and (when `renderTrailViewer` is set) opens the code
203
203
  * drawer on that flow's snippets. Opened flows stay on the canvas
204
204
  * (unselected ones dimmed); everything else is hidden.
205
205
  */
@@ -450,8 +450,9 @@ export interface SubsystemComponentGraphProps {
450
450
  renderFileViewer?: (file: string, opts?: SubsystemOpenFileOptions) => ReactNode;
451
451
  /**
452
452
  * Host-injected multi-snippet viewer for a focused trail. When set,
453
- * clicking a flow step opens the bottom drawer with this content and
454
- * updates it as the focused step changes.
453
+ * clicking a flow step opens the code drawer with this content and
454
+ * updates it as the focused step changes. Docks left for vertical layouts,
455
+ * below the canvas for horizontal layouts.
455
456
  */
456
457
  renderTrailViewer?: (ctx: TrailViewerContext) => ReactNode;
457
458
  /**
@@ -928,10 +929,10 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
928
929
  const showDesc = !!description && descriptionVisible;
929
930
  // Sidebar width lives in the shared GraphWithSidebar chrome — draggable and
930
931
  // persisted under `principal.subsystems.sidebarWidth.<persistKey>`. The graph
931
- // only bounds how wide the panel may get so the canvas keeps room to breathe;
932
+ // caps it at half the view width so the canvas keeps room to breathe;
932
933
  // a width saved under the old view-state key still seeds the panel once.
933
934
  const sidebarMaxWidth = useMemo(
934
- () => Math.max(Math.min((_measured?.w ?? 680) * 0.5, 600), 240),
935
+ () => Math.max((_measured?.w ?? 680) * 0.5, 240),
935
936
  [_measured?.w],
936
937
  );
937
938
  // Persist the trail working set per model. Each write merges into the
@@ -2080,7 +2081,8 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
2080
2081
  const drawerFillHeight =
2081
2082
  drawerTarget?.kind === 'file' && drawerTarget.startLine == null;
2082
2083
  const fileOverlayOpen = fileOverlay != null;
2083
- const collapseCanvas = drawerFillHeight || fileOverlayOpen;
2084
+ const collapseCanvas =
2085
+ drawerFillHeight || (fileOverlayOpen && committedDirection !== 'vertical');
2084
2086
 
2085
2087
  // Drop the full-file overlay when the underlying trail drawer changes
2086
2088
  // or closes — open-file keeps the same drawerTarget so the snippets stay mounted.
@@ -3041,6 +3043,57 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
3041
3043
  })}
3042
3044
  </>
3043
3045
  ) : null;
3046
+ const fileOverlayView = fileOverlay && (
3047
+ <div
3048
+ style={{
3049
+ position: 'absolute',
3050
+ inset: 0,
3051
+ zIndex: 8,
3052
+ display: 'flex',
3053
+ flexDirection: 'column',
3054
+ background: theme.colors.background,
3055
+ borderLeft: `1px solid ${theme.colors.border}`,
3056
+ }}
3057
+ >
3058
+ <div
3059
+ style={{
3060
+ display: 'flex',
3061
+ alignItems: 'center',
3062
+ gap: 8,
3063
+ padding: '6px 10px',
3064
+ borderBottom: `1px solid ${theme.colors.border}`,
3065
+ flexShrink: 0,
3066
+ }}
3067
+ >
3068
+ <span
3069
+ title={fileOverlay.file}
3070
+ style={{
3071
+ flex: 1,
3072
+ minWidth: 0,
3073
+ overflow: 'hidden',
3074
+ textOverflow: 'ellipsis',
3075
+ whiteSpace: 'nowrap',
3076
+ fontFamily: theme.fonts.monospace,
3077
+ fontSize: theme.fontSizes[0],
3078
+ color: theme.colors.textMuted ?? theme.colors.textSecondary,
3079
+ }}
3080
+ >
3081
+ {fileOverlay.file}
3082
+ </span>
3083
+ <FileOverlayCloseButton onClose={closeFileOverlay} />
3084
+ </div>
3085
+ <div style={{ flex: 1, minHeight: 0, overflow: 'auto' }}>
3086
+ <FileDrawerContent
3087
+ render={renderDrawerContent}
3088
+ file={fileOverlay.file}
3089
+ startLine={fileOverlay.startLine}
3090
+ endLine={fileOverlay.endLine}
3091
+ fullFile
3092
+ />
3093
+ </div>
3094
+ </div>
3095
+ );
3096
+
3044
3097
  return (
3045
3098
  <GraphWithSidebar
3046
3099
  hidden={!sidebarVisible}
@@ -3063,7 +3116,7 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
3063
3116
  onResizeEnd={() => requestAnimationFrame(() => fitView())}
3064
3117
  >
3065
3118
  {/* Graph area */}
3066
- <div style={{ flex: 1, position: 'relative', display: 'flex', flexDirection: 'column', minHeight: 0 }}>
3119
+ <div style={{ flex: 1, position: 'relative', display: 'flex', flexDirection: committedDirection === 'vertical' ? 'row' : 'column', minHeight: 0, minWidth: 0 }}>
3067
3120
  {/* Canvas box — the edge-label overlay and legend anchor here, so
3068
3121
  overlays shift with the canvas, not the labels. Collapses when the
3069
3122
  file drawer fills the column (whole-file reading). */}
@@ -3073,6 +3126,7 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
3073
3126
  position: 'relative',
3074
3127
  flex: collapseCanvas ? 0 : 1,
3075
3128
  minHeight: 0,
3129
+ minWidth: 0,
3076
3130
  height: collapseCanvas ? 0 : undefined,
3077
3131
  overflow: 'hidden',
3078
3132
  display: 'flex',
@@ -3537,10 +3591,13 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
3537
3591
  />
3538
3592
  </div>
3539
3593
  )}
3594
+ {/* Vertical full-file reading replaces only the graph, not either left column. */}
3595
+ {committedDirection === 'vertical' && fileOverlayView}
3540
3596
  </div>
3541
3597
  <FileDrawer
3542
3598
  title={drawerTitle}
3543
3599
  onClose={closeDrawer}
3600
+ placement={committedDirection === 'vertical' ? 'left' : 'bottom'}
3544
3601
  fillHeight={drawerFillHeight}
3545
3602
  suppressEscape={fileOverlayOpen}
3546
3603
  hidden={hideDrawer}
@@ -3579,56 +3636,7 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
3579
3636
  />
3580
3637
  ) : null}
3581
3638
  </FileDrawer>
3582
- {fileOverlay && (
3583
- <div
3584
- style={{
3585
- position: 'absolute',
3586
- inset: 0,
3587
- zIndex: 8,
3588
- display: 'flex',
3589
- flexDirection: 'column',
3590
- background: theme.colors.background,
3591
- borderLeft: `1px solid ${theme.colors.border}`,
3592
- }}
3593
- >
3594
- <div
3595
- style={{
3596
- display: 'flex',
3597
- alignItems: 'center',
3598
- gap: 8,
3599
- padding: '6px 10px',
3600
- borderBottom: `1px solid ${theme.colors.border}`,
3601
- flexShrink: 0,
3602
- }}
3603
- >
3604
- <span
3605
- title={fileOverlay.file}
3606
- style={{
3607
- flex: 1,
3608
- minWidth: 0,
3609
- overflow: 'hidden',
3610
- textOverflow: 'ellipsis',
3611
- whiteSpace: 'nowrap',
3612
- fontFamily: theme.fonts.monospace,
3613
- fontSize: theme.fontSizes[0],
3614
- color: theme.colors.textMuted ?? theme.colors.textSecondary,
3615
- }}
3616
- >
3617
- {fileOverlay.file}
3618
- </span>
3619
- <FileOverlayCloseButton onClose={closeFileOverlay} />
3620
- </div>
3621
- <div style={{ flex: 1, minHeight: 0, overflow: 'auto' }}>
3622
- <FileDrawerContent
3623
- render={renderDrawerContent}
3624
- file={fileOverlay.file}
3625
- startLine={fileOverlay.startLine}
3626
- endLine={fileOverlay.endLine}
3627
- fullFile
3628
- />
3629
- </div>
3630
- </div>
3631
- )}
3639
+ {committedDirection !== 'vertical' && fileOverlayView}
3632
3640
  {/* Startup cover — hides measurement, layout swap, and camera settle.
3633
3641
  Kept away during a direction flip: the flip is meant to be watched,
3634
3642
  and the cover would swallow the node slide. */}
@@ -1,37 +0,0 @@
1
- /**
2
- * DecorationPanel — the reading surface for one `SubsystemDecoration`.
3
- *
4
- * A decoration is an additive, unverified layer over one or more subsystem
5
- * models: markdown prose, an ordered list of trails (each naming its own
6
- * model), and optional draft structure. This panel is the container's own
7
- * surface — it deliberately does not render the graph. Selecting a trail (or
8
- * a draft component) is handed back to the host, which decides whether to
9
- * focus a model, open a tab, or overlay the draft.
10
- *
11
- * Nothing here writes: the first prototype is read-only plus an on/off toggle.
12
- */
13
- /// <reference types="react" />
14
- import { type DecorationDraftComponent, type DecorationTrailRef, type SubsystemDecoration } from './decoration';
15
- export interface DecorationPanelTrailMeta {
16
- title: string;
17
- stepCount?: number;
18
- }
19
- export interface DecorationPanelProps {
20
- decoration: SubsystemDecoration;
21
- /** Whether the decoration overlay is currently on. */
22
- active: boolean;
23
- onToggleActive: (active: boolean) => void;
24
- /** Click a trail row. The host focuses the owning model/trail. */
25
- onSelectTrail?: (ref: DecorationTrailRef) => void;
26
- /** Click a draft component. Omit to render the draft list read-only. */
27
- onSelectDraftComponent?: (component: DecorationDraftComponent) => void;
28
- /**
29
- * Resolve a base trail's display title/step count from its owning model.
30
- * Draft trails carry their content inline and need no resolver.
31
- */
32
- resolveTrail?: (ref: DecorationTrailRef) => DecorationPanelTrailMeta | undefined;
33
- /** Friendly model names, keyed by `modelId`. Falls back to the id. */
34
- modelLabels?: ReadonlyMap<string, string>;
35
- }
36
- export declare function DecorationPanel({ decoration, active, onToggleActive, onSelectTrail, onSelectDraftComponent, resolveTrail, modelLabels, }: DecorationPanelProps): import("react").JSX.Element;
37
- //# sourceMappingURL=DecorationPanel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DecorationPanel.d.ts","sourceRoot":"","sources":["../../src/subsystem/DecorationPanel.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;;AAMH,OAAO,EAGL,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACzB,MAAM,cAAc,CAAC;AAEtB,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,mBAAmB,CAAC;IAChC,sDAAsD;IACtD,MAAM,EAAE,OAAO,CAAC;IAChB,cAAc,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IAC1C,kEAAkE;IAClE,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAClD,wEAAwE;IACxE,sBAAsB,CAAC,EAAE,CAAC,SAAS,EAAE,wBAAwB,KAAK,IAAI,CAAC;IACvE;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,kBAAkB,KAAK,wBAAwB,GAAG,SAAS,CAAC;IACjF,sEAAsE;IACtE,WAAW,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC3C;AAED,wBAAgB,eAAe,CAAC,EAC9B,UAAU,EACV,MAAM,EACN,cAAc,EACd,aAAa,EACb,sBAAsB,EACtB,YAAY,EACZ,WAAW,GACZ,EAAE,oBAAoB,+BAqRtB"}
@@ -1,147 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useTheme } from '@principal-ade/industry-theme';
3
- import { Box, Eye, EyeOff, Network, Route, Sparkles } from 'lucide-react';
4
- import { IndustryMarkdownSlide } from 'themed-markdown';
5
- import { decorationTrailId, groupDecorationTrailsByModel, } from './decoration';
6
- export function DecorationPanel({ decoration, active, onToggleActive, onSelectTrail, onSelectDraftComponent, resolveTrail, modelLabels, }) {
7
- const { theme } = useTheme();
8
- const muted = theme.colors.textMuted ?? theme.colors.textSecondary;
9
- const secondary = theme.colors.textSecondary ?? muted;
10
- const warning = theme.colors.warning ?? secondary;
11
- const accent = theme.colors.accent ?? theme.colors.primary ?? theme.colors.text;
12
- const groups = groupDecorationTrailsByModel(decoration.trails);
13
- const draftComponents = decoration.draft?.components ?? [];
14
- const draftEdges = decoration.draft?.edges ?? [];
15
- const sectionLabel = {
16
- fontFamily: theme.fonts.monospace,
17
- fontSize: theme.fontSizes[0],
18
- fontWeight: theme.fontWeights.semibold,
19
- letterSpacing: '0.06em',
20
- textTransform: 'uppercase',
21
- };
22
- return (_jsxs("div", { style: {
23
- display: 'flex',
24
- flexDirection: 'column',
25
- width: '100%',
26
- height: '100%',
27
- minHeight: 0,
28
- background: theme.colors.background,
29
- color: theme.colors.text,
30
- }, children: [_jsx("header", { style: {
31
- flexShrink: 0,
32
- padding: '14px 16px 10px',
33
- borderBottom: `1px solid ${theme.colors.border}`,
34
- }, children: _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 8 }, children: [_jsx(Sparkles, { size: 15, strokeWidth: 2, color: accent, "aria-hidden": true }), _jsx("h2", { style: {
35
- flex: 1,
36
- minWidth: 0,
37
- margin: 0,
38
- overflowWrap: 'anywhere',
39
- fontFamily: theme.fonts.monospace,
40
- fontSize: theme.fontSizes[2],
41
- fontWeight: theme.fontWeights.semibold,
42
- }, children: decoration.title }), _jsxs("button", { type: "button", "aria-pressed": active, "aria-label": active ? 'Turn decoration off' : 'Turn decoration on', title: active ? 'Turn decoration off' : 'Turn decoration on', onClick: () => onToggleActive(!active), style: {
43
- display: 'inline-flex',
44
- alignItems: 'center',
45
- gap: 4,
46
- flexShrink: 0,
47
- padding: '3px 8px',
48
- borderRadius: 4,
49
- border: `1px solid ${active ? accent : theme.colors.border}`,
50
- background: active ? `${accent}18` : 'transparent',
51
- color: active ? accent : muted,
52
- fontFamily: theme.fonts.monospace,
53
- fontSize: theme.fontSizes[0],
54
- cursor: 'pointer',
55
- }, children: [active ? _jsx(Eye, { size: 12, strokeWidth: 2 }) : _jsx(EyeOff, { size: 12, strokeWidth: 2 }), active ? 'On' : 'Off'] })] }) }), _jsxs("div", { style: { flex: 1, minHeight: 0, overflowY: 'auto', padding: '12px 16px 18px' }, children: [decoration.description && (_jsx("div", { style: { fontSize: theme.fontSizes[1], lineHeight: theme.lineHeights.body }, children: _jsx(IndustryMarkdownSlide, { content: decoration.description, slideIdPrefix: `decoration-${decoration.id}`, slideIndex: 0, isVisible: true, theme: theme, disableScroll: true, disableBasePadding: true, enableKeyboardScrolling: false, autoFocusOnVisible: false }) })), _jsxs("section", { style: {
56
- marginTop: 16,
57
- paddingTop: 14,
58
- borderTop: `1px solid ${theme.colors.border}`,
59
- }, children: [_jsxs("div", { style: { ...sectionLabel, color: secondary }, children: ["Trails \u00B7 ", decoration.trails.length] }), groups.map((group) => (_jsxs("div", { children: [_jsxs("div", { style: {
60
- display: 'flex',
61
- alignItems: 'center',
62
- gap: 6,
63
- margin: '12px 0 3px',
64
- }, children: [_jsx(Network, { size: 14, strokeWidth: 2, color: secondary, "aria-hidden": true }), _jsx("span", { style: {
65
- minWidth: 0,
66
- overflow: 'hidden',
67
- textOverflow: 'ellipsis',
68
- whiteSpace: 'nowrap',
69
- fontFamily: theme.fonts.monospace,
70
- fontSize: theme.fontSizes[1],
71
- fontWeight: theme.fontWeights.semibold,
72
- color: theme.colors.text,
73
- }, children: modelLabels?.get(group.modelId) ?? group.modelId })] }), group.trails.map((ref) => {
74
- const meta = resolveTrail?.(ref);
75
- const title = meta?.title ??
76
- (ref.kind === 'draft' ? ref.trail.title : ref.trailId);
77
- const stepCount = meta?.stepCount ??
78
- (ref.kind === 'draft' ? ref.trail.steps.length : undefined);
79
- return (_jsxs("button", { type: "button", onClick: () => onSelectTrail?.(ref), style: {
80
- display: 'flex',
81
- alignItems: 'center',
82
- gap: 8,
83
- width: '100%',
84
- minWidth: 0,
85
- padding: '6px 6px 6px 0',
86
- border: 'none',
87
- borderRadius: 4,
88
- background: 'transparent',
89
- color: theme.colors.text,
90
- textAlign: 'left',
91
- cursor: onSelectTrail ? 'pointer' : 'default',
92
- }, children: [_jsx(Route, { size: 13, strokeWidth: 2, color: muted, "aria-hidden": true }), _jsx("span", { style: {
93
- flex: 1,
94
- minWidth: 0,
95
- overflow: 'hidden',
96
- textOverflow: 'ellipsis',
97
- whiteSpace: 'nowrap',
98
- fontFamily: theme.fonts.monospace,
99
- fontSize: theme.fontSizes[1],
100
- }, children: title }), ref.kind === 'draft' && (_jsx("span", { style: {
101
- flexShrink: 0,
102
- padding: '1px 5px',
103
- borderRadius: 3,
104
- border: `1px solid ${warning}`,
105
- color: warning,
106
- fontFamily: theme.fonts.monospace,
107
- fontSize: theme.fontSizes[0],
108
- }, children: "draft" })), stepCount != null && (_jsx("span", { style: {
109
- flexShrink: 0,
110
- fontFamily: theme.fonts.monospace,
111
- fontSize: theme.fontSizes[0],
112
- color: secondary,
113
- }, children: stepCount }))] }, decorationTrailId(ref)));
114
- })] }, group.modelId)))] }), (draftComponents.length > 0 || draftEdges.length > 0) && (_jsxs("section", { style: { marginTop: 18 }, children: [_jsx("div", { style: { ...sectionLabel, color: secondary }, children: "Draft structure \u00B7 not verified" }), draftComponents.map((component) => (_jsxs("button", { type: "button", onClick: () => onSelectDraftComponent?.(component), style: {
115
- display: 'flex',
116
- alignItems: 'center',
117
- gap: 8,
118
- width: '100%',
119
- minWidth: 0,
120
- padding: '6px 6px 6px 0',
121
- border: 'none',
122
- borderRadius: 4,
123
- background: 'transparent',
124
- color: theme.colors.text,
125
- textAlign: 'left',
126
- cursor: onSelectDraftComponent ? 'pointer' : 'default',
127
- }, children: [_jsx(Box, { size: 13, strokeWidth: 2, color: muted, "aria-hidden": true }), _jsx("span", { style: {
128
- flex: 1,
129
- minWidth: 0,
130
- overflow: 'hidden',
131
- textOverflow: 'ellipsis',
132
- whiteSpace: 'nowrap',
133
- fontFamily: theme.fonts.monospace,
134
- fontSize: theme.fontSizes[1],
135
- }, children: component.name }), component.construct && (_jsx("span", { style: {
136
- flexShrink: 0,
137
- fontFamily: theme.fonts.monospace,
138
- fontSize: theme.fontSizes[0],
139
- color: secondary,
140
- }, children: component.construct }))] }, component.alias))), draftEdges.length > 0 && (_jsxs("div", { style: {
141
- marginTop: 4,
142
- fontFamily: theme.fonts.monospace,
143
- fontSize: theme.fontSizes[0],
144
- color: secondary,
145
- }, children: ["+ ", draftEdges.length, " draft edge", draftEdges.length === 1 ? '' : 's'] }))] }))] })] }));
146
- }
147
- //# sourceMappingURL=DecorationPanel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DecorationPanel.js","sourceRoot":"","sources":["../../src/subsystem/DecorationPanel.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EACL,iBAAiB,EACjB,4BAA4B,GAI7B,MAAM,cAAc,CAAC;AAyBtB,MAAM,UAAU,eAAe,CAAC,EAC9B,UAAU,EACV,MAAM,EACN,cAAc,EACd,aAAa,EACb,sBAAsB,EACtB,YAAY,EACZ,WAAW,GACU;IACrB,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC7B,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,SAAS,IAAI,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC;IACnE,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,aAAa,IAAI,KAAK,CAAC;IACtD,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CA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GACV,EACN,SAAS,CAAC,SAAS,IAAI,CACtB,eACE,KAAK,EAAE;4CACL,UAAU,EAAE,CAAC;4CACb,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS;4CACjC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;4CAC5B,KAAK,EAAE,SAAS;yCACjB,YAEA,SAAS,CAAC,SAAS,GACf,CACR,KA3CI,SAAS,CAAC,KAAK,CA4Cb,CACV,CAAC,EACD,UAAU,CAAC,MAAM,GAAG,CAAC,IAAI,CACxB,eACE,KAAK,EAAE;oCACL,SAAS,EAAE,CAAC;oCACZ,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS;oCACjC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;oCAC5B,KAAK,EAAE,SAAS;iCACjB,mBAEE,UAAU,CAAC,MAAM,iBAAa,UAAU,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,IAC/D,CACP,IACO,CACX,IACG,IACF,CACP,CAAC;AACJ,CAAC"}
@@ -1,112 +0,0 @@
1
- /**
2
- * Subsystem decoration — PROTOTYPE contract for the ephemeral, unverified layer.
3
- *
4
- * A decoration composes trails from one or more models, carries a markdown
5
- * description, and may add draft structure. The base model stays verified-only;
6
- * a decoration is never audited against source.
7
- *
8
- * **Each trail ref names its own model.** There is no decoration-level `base`
9
- * field: a decoration can mix models by construction, and a single-model
10
- * decoration is just the case where every ref happens to share a `modelId`.
11
- *
12
- * A trail can be either:
13
- * - `base` — a reference to a trail that already exists in a model; or
14
- * - `draft` — a trail that only exists in the decoration. This is what
15
- * migration needs when a base trail depends on draft components: the whole
16
- * trail moves into the decoration rather than dangling in the base.
17
- *
18
- * The contract is deliberately host-local and not part of the portable
19
- * subsystem document. If decorations become shareable, `modelId` needs a
20
- * portable identity key (the local `sg-...` ids are re-minted).
21
- */
22
- import type { SubsystemTrail, SubsystemTrailMechanism } from './model';
23
- export interface DecorationStepAnchor {
24
- /** Claim fingerprint of the anchored step (see `stepClaimKey`). */
25
- stepKey: string;
26
- /** Optional per-anchor note. The decoration description carries the prose. */
27
- note?: string;
28
- }
29
- interface DecorationTrailRefBase {
30
- /** Store-local model id. The trail id is only unique within this model. */
31
- modelId: string;
32
- /** Optional step-level anchors inside this trail. */
33
- stepAnchors?: DecorationStepAnchor[];
34
- }
35
- /** A trail that already exists in the base model. */
36
- export interface DecorationBaseTrailRef extends DecorationTrailRefBase {
37
- kind: 'base';
38
- trailId: string;
39
- }
40
- /** A speculative trail that exists only in the decoration. */
41
- export interface DecorationDraftTrailRef extends DecorationTrailRefBase {
42
- kind: 'draft';
43
- trail: SubsystemTrail;
44
- }
45
- export type DecorationTrailRef = DecorationBaseTrailRef | DecorationDraftTrailRef;
46
- /**
47
- * Draft structure: a component that does not exist in source yet. No
48
- * `file`/`symbol` — those are the verification coordinates the base model
49
- * requires, and a draft component deliberately has none.
50
- */
51
- export interface DecorationDraftComponent {
52
- alias: string;
53
- name: string;
54
- /** Intended construct shape (`class`, `function`, …). */
55
- construct?: string;
56
- purpose?: string;
57
- module?: string;
58
- process?: string;
59
- }
60
- /** A speculative edge between base or draft aliases. */
61
- export interface DecorationDraftEdge {
62
- from: string;
63
- to: string;
64
- mechanism: SubsystemTrailMechanism;
65
- }
66
- export interface DecorationDraft {
67
- components?: DecorationDraftComponent[];
68
- edges?: DecorationDraftEdge[];
69
- }
70
- export interface DecorationProvenance {
71
- source: 'author' | 'agent';
72
- author?: string;
73
- /** ISO timestamp. */
74
- at: string;
75
- }
76
- export interface SubsystemDecoration {
77
- version: 1;
78
- id: string;
79
- title: string;
80
- /** Markdown, rendered like the model description. */
81
- description: string;
82
- /**
83
- * Ordered trails the decoration cares about. Order is the reading order;
84
- * `modelId` may vary from ref to ref. A trail is either a base ref or a
85
- * draft trail that lives only here.
86
- */
87
- trails: DecorationTrailRef[];
88
- /** Optional draft delta. Absent = a pure reading path. */
89
- draft?: DecorationDraft;
90
- provenance: DecorationProvenance;
91
- }
92
- /** The trail id for either kind of ref. */
93
- export declare function decorationTrailId(ref: DecorationTrailRef): string;
94
- /** Stable key for a trail ref across models. `trailId` alone is not enough. */
95
- export declare function decorationTrailKey(ref: Pick<DecorationTrailRef, 'modelId'> & {
96
- trailId?: string;
97
- trail?: SubsystemTrail;
98
- }): string;
99
- /**
100
- * Group trail refs by their owning model, preserving first-seen model order
101
- * and the authored trail order within each group. The UI uses this to render
102
- * "which trails it cares about" without a separate model list.
103
- */
104
- export declare function groupDecorationTrailsByModel(refs: readonly DecorationTrailRef[]): Array<{
105
- modelId: string;
106
- trails: DecorationTrailRef[];
107
- }>;
108
- /** The distinct models a decoration touches, in first-seen order. */
109
- export declare function decorationModelIds(refs: readonly DecorationTrailRef[]): string[];
110
- export declare function findDecorationTrail(refs: readonly DecorationTrailRef[], modelId: string, trailId: string): DecorationTrailRef | undefined;
111
- export {};
112
- //# sourceMappingURL=decoration.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"decoration.d.ts","sourceRoot":"","sources":["../../src/subsystem/decoration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAEvE,MAAM,WAAW,oBAAoB;IACnC,mEAAmE;IACnE,OAAO,EAAE,MAAM,CAAC;IAChB,8EAA8E;IAC9E,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,UAAU,sBAAsB;IAC9B,2EAA2E;IAC3E,OAAO,EAAE,MAAM,CAAC;IAChB,qDAAqD;IACrD,WAAW,CAAC,EAAE,oBAAoB,EAAE,CAAC;CACtC;AAED,qDAAqD;AACrD,MAAM,WAAW,sBAAuB,SAAQ,sBAAsB;IACpE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,8DAA8D;AAC9D,MAAM,WAAW,uBAAwB,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kBAAkB,CAChC,GAAG,EAAE,IAAI,CAAC,kBAAkB,EAAE,SAAS,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,cAAc,CAAA;CAAE,GACtF,MAAM,CAGR;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,SAAS,kBAAkB,EAAE,GAClC,KAAK,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,kBAAkB,EAAE,CAAA;CAAE,CAAC,CAQ1D;AAED,qEAAqE;AACrE,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,SAAS,kBAAkB,EAAE,GAClC,MAAM,EAAE,CAEV;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,SAAS,kBAAkB,EAAE,EACnC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GACd,kBAAkB,GAAG,SAAS,CAIhC"}
@@ -1,54 +0,0 @@
1
- /**
2
- * Subsystem decoration — PROTOTYPE contract for the ephemeral, unverified layer.
3
- *
4
- * A decoration composes trails from one or more models, carries a markdown
5
- * description, and may add draft structure. The base model stays verified-only;
6
- * a decoration is never audited against source.
7
- *
8
- * **Each trail ref names its own model.** There is no decoration-level `base`
9
- * field: a decoration can mix models by construction, and a single-model
10
- * decoration is just the case where every ref happens to share a `modelId`.
11
- *
12
- * A trail can be either:
13
- * - `base` — a reference to a trail that already exists in a model; or
14
- * - `draft` — a trail that only exists in the decoration. This is what
15
- * migration needs when a base trail depends on draft components: the whole
16
- * trail moves into the decoration rather than dangling in the base.
17
- *
18
- * The contract is deliberately host-local and not part of the portable
19
- * subsystem document. If decorations become shareable, `modelId` needs a
20
- * portable identity key (the local `sg-...` ids are re-minted).
21
- */
22
- /** The trail id for either kind of ref. */
23
- export function decorationTrailId(ref) {
24
- return ref.kind === 'base' ? ref.trailId : ref.trail.id;
25
- }
26
- /** Stable key for a trail ref across models. `trailId` alone is not enough. */
27
- export function decorationTrailKey(ref) {
28
- const trailId = ref.trailId ?? ref.trail?.id ?? '';
29
- return `${ref.modelId}:${trailId}`;
30
- }
31
- /**
32
- * Group trail refs by their owning model, preserving first-seen model order
33
- * and the authored trail order within each group. The UI uses this to render
34
- * "which trails it cares about" without a separate model list.
35
- */
36
- export function groupDecorationTrailsByModel(refs) {
37
- const groups = new Map();
38
- for (const ref of refs) {
39
- const existing = groups.get(ref.modelId);
40
- if (existing)
41
- existing.push(ref);
42
- else
43
- groups.set(ref.modelId, [ref]);
44
- }
45
- return [...groups].map(([modelId, trails]) => ({ modelId, trails }));
46
- }
47
- /** The distinct models a decoration touches, in first-seen order. */
48
- export function decorationModelIds(refs) {
49
- return [...new Set(refs.map((ref) => ref.modelId))];
50
- }
51
- export function findDecorationTrail(refs, modelId, trailId) {
52
- return refs.find((ref) => ref.modelId === modelId && decorationTrailId(ref) === trailId);
53
- }
54
- //# sourceMappingURL=decoration.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"decoration.js","sourceRoot":"","sources":["../../src/subsystem/decoration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAqFH,2CAA2C;AAC3C,MAAM,UAAU,iBAAiB,CAAC,GAAuB;IACvD,OAAO,GAAG,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;AAC1D,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,kBAAkB,CAChC,GAAuF;IAEvF,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC;IACnD,OAAO,GAAG,GAAG,CAAC,OAAO,IAAI,OAAO,EAAE,CAAC;AACrC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,4BAA4B,CAC1C,IAAmC;IAEnC,MAAM,MAAM,GAAG,IAAI,GAAG,EAAg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