@principal-ai/subsystems-react 0.51.0 → 0.51.1

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 (87) hide show
  1. package/dist/index.d.ts +6 -6
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +6 -4
  4. package/dist/index.js.map +1 -1
  5. package/dist/pierre/PierreTrailCodeView.d.ts +1 -1
  6. package/dist/pierre/PierreTrailCodeView.d.ts.map +1 -1
  7. package/dist/pierre/PierreTrailCodeView.js +44 -21
  8. package/dist/pierre/PierreTrailCodeView.js.map +1 -1
  9. package/dist/stories/Subsystem/C4Graph/c4ProposedElements.fixture.d.ts +493 -0
  10. package/dist/stories/Subsystem/C4Graph/c4ProposedElements.fixture.d.ts.map +1 -0
  11. package/dist/stories/Subsystem/C4Graph/c4ProposedElements.fixture.js +329 -0
  12. package/dist/stories/Subsystem/C4Graph/c4ProposedElements.fixture.js.map +1 -0
  13. package/dist/subsystem/C4Graph.d.ts +2 -2
  14. package/dist/subsystem/C4Graph.d.ts.map +1 -1
  15. package/dist/subsystem/C4Graph.js +25 -16
  16. package/dist/subsystem/C4Graph.js.map +1 -1
  17. package/dist/subsystem/C4NodeCard.d.ts +71 -36
  18. package/dist/subsystem/C4NodeCard.d.ts.map +1 -1
  19. package/dist/subsystem/C4NodeCard.js +88 -94
  20. package/dist/subsystem/C4NodeCard.js.map +1 -1
  21. package/dist/subsystem/FileDrawer.d.ts.map +1 -1
  22. package/dist/subsystem/FileDrawer.js +20 -21
  23. package/dist/subsystem/FileDrawer.js.map +1 -1
  24. package/dist/subsystem/IssueList.js +1 -1
  25. package/dist/subsystem/IssueList.js.map +1 -1
  26. package/dist/subsystem/SubsystemComponentGraph.d.ts.map +1 -1
  27. package/dist/subsystem/SubsystemComponentGraph.js +13 -4
  28. package/dist/subsystem/SubsystemComponentGraph.js.map +1 -1
  29. package/dist/subsystem/c4.d.ts +272 -0
  30. package/dist/subsystem/c4.d.ts.map +1 -0
  31. package/dist/subsystem/c4.js +322 -0
  32. package/dist/subsystem/c4.js.map +1 -0
  33. package/dist/subsystem/c4Evidence.d.ts +143 -0
  34. package/dist/subsystem/c4Evidence.d.ts.map +1 -0
  35. package/dist/subsystem/c4Evidence.js +240 -0
  36. package/dist/subsystem/c4Evidence.js.map +1 -0
  37. package/dist/subsystem/model.d.ts +2 -6
  38. package/dist/subsystem/model.d.ts.map +1 -1
  39. package/dist/subsystem/model.js.map +1 -1
  40. package/package.json +4 -3
  41. package/src/index.ts +26 -28
  42. package/src/pierre/PierreTrailCodeView.tsx +49 -21
  43. package/src/stories/Subsystem/C4Graph/C4NodeGallery.stories.tsx +167 -79
  44. package/src/stories/Subsystem/C4Graph/ProposedElements.stories.tsx +293 -0
  45. package/src/stories/Subsystem/C4Graph/c4ProposedElements.fixture.ts +366 -0
  46. package/src/stories/Subsystem/ComponentGraph/IssueOverlay.stories.tsx +1 -1
  47. package/src/stories/Subsystem/ComponentGraph/Issues.stories.tsx +1 -1
  48. package/src/subsystem/C4Graph.tsx +39 -24
  49. package/src/subsystem/C4NodeCard.test.ts +169 -64
  50. package/src/subsystem/C4NodeCard.tsx +102 -108
  51. package/src/subsystem/FileDrawer.tsx +32 -34
  52. package/src/subsystem/IssueList.tsx +1 -1
  53. package/src/subsystem/SubsystemComponentGraph.tsx +13 -5
  54. package/src/subsystem/c4.test.ts +573 -0
  55. package/src/subsystem/c4.ts +558 -0
  56. package/src/subsystem/c4Evidence.test.ts +386 -0
  57. package/src/subsystem/c4Evidence.ts +329 -0
  58. package/src/subsystem/model.ts +2 -6
  59. package/dist/stories/Subsystem/C4Graph/c4Associations.fixture.d.ts +0 -95
  60. package/dist/stories/Subsystem/C4Graph/c4Associations.fixture.d.ts.map +0 -1
  61. package/dist/stories/Subsystem/C4Graph/c4Associations.fixture.js +0 -340
  62. package/dist/stories/Subsystem/C4Graph/c4Associations.fixture.js.map +0 -1
  63. package/dist/stories/Subsystem/C4Graph/c4Fixture.d.ts +0 -7
  64. package/dist/stories/Subsystem/C4Graph/c4Fixture.d.ts.map +0 -1
  65. package/dist/stories/Subsystem/C4Graph/c4Fixture.js +0 -7335
  66. package/dist/stories/Subsystem/C4Graph/c4Fixture.js.map +0 -1
  67. package/dist/stories/Subsystem/C4Graph/generateFixture.d.ts +0 -2
  68. package/dist/stories/Subsystem/C4Graph/generateFixture.d.ts.map +0 -1
  69. package/dist/stories/Subsystem/C4Graph/generateFixture.js +0 -145
  70. package/dist/stories/Subsystem/C4Graph/generateFixture.js.map +0 -1
  71. package/dist/subsystem/c4Associations.d.ts +0 -186
  72. package/dist/subsystem/c4Associations.d.ts.map +0 -1
  73. package/dist/subsystem/c4Associations.js +0 -284
  74. package/dist/subsystem/c4Associations.js.map +0 -1
  75. package/dist/subsystem/toC4.d.ts +0 -214
  76. package/dist/subsystem/toC4.d.ts.map +0 -1
  77. package/dist/subsystem/toC4.js +0 -282
  78. package/dist/subsystem/toC4.js.map +0 -1
  79. package/src/stories/Subsystem/C4Graph/C4Associations.stories.tsx +0 -273
  80. package/src/stories/Subsystem/C4Graph/C4Container.stories.tsx +0 -101
  81. package/src/stories/Subsystem/C4Graph/c4Associations.fixture.ts +0 -344
  82. package/src/stories/Subsystem/C4Graph/c4Fixture.ts +0 -7339
  83. package/src/stories/Subsystem/C4Graph/generateFixture.ts +0 -161
  84. package/src/subsystem/c4Associations.test.ts +0 -484
  85. package/src/subsystem/c4Associations.ts +0 -398
  86. package/src/subsystem/toC4.test.ts +0 -114
  87. package/src/subsystem/toC4.ts +0 -478
@@ -117,21 +117,46 @@ export function FileDrawer({
117
117
  userSelect: "none",
118
118
  }}
119
119
  >
120
+ {showProgress && progress != null && (
121
+ <div
122
+ role="img"
123
+ aria-label={`Step ${progress.index + 1} of ${progress.total}`}
124
+ style={{
125
+ display: "flex",
126
+ gap: 2,
127
+ flexShrink: 0,
128
+ }}
129
+ >
130
+ {Array.from({ length: progress.total }, (_, i) => (
131
+ <span
132
+ key={i}
133
+ style={{
134
+ flex: 1,
135
+ height: 2,
136
+ borderRadius: 1,
137
+ background:
138
+ i <= progress.index
139
+ ? theme.colors.primary
140
+ : theme.colors.border,
141
+ }}
142
+ />
143
+ ))}
144
+ </div>
145
+ )}
120
146
  <div
121
147
  style={{
122
148
  display: "flex",
123
149
  alignItems: "center",
124
150
  gap: 8,
125
- padding: "6px 10px",
126
- // With segments present they form the header's bottom edge, so
127
- // only draw the hairline when there is nothing to stand in for it.
128
- borderBottom: showProgress
129
- ? "none"
130
- : `1px solid ${theme.colors.border}`,
151
+ // Top runs deeper than the bottom so the title/label sits
152
+ // optically centered inside the sticky top edge.
153
+ padding: "10px 10px 8px",
154
+ // The header row is the last chrome row now, so its hairline is
155
+ // the boundary with the code below.
156
+ borderBottom: `1px solid ${theme.colors.border}`,
131
157
  }}
132
158
  >
133
159
  <span
134
- title={title ?? undefined}
135
160
  style={{
136
161
  flex: 1,
137
162
  minWidth: 0,
@@ -197,33 +222,6 @@ export function FileDrawer({
197
222
  <X size={14} />
198
223
  </button>
199
224
  </div>
200
- {showProgress && progress != null && (
201
- <div
202
- role="img"
203
- aria-label={`Step ${progress.index + 1} of ${progress.total}`}
204
- style={{
205
- display: "flex",
206
- gap: 2,
207
- flexShrink: 0,
208
- padding: "0 10px 6px",
209
- }}
210
- >
211
- {Array.from({ length: progress.total }, (_, i) => (
212
- <span
213
- key={i}
214
- style={{
215
- flex: 1,
216
- height: 2,
217
- borderRadius: 1,
218
- background:
219
- i <= progress.index
220
- ? theme.colors.primary
221
- : theme.colors.border,
222
- }}
223
- />
224
- ))}
225
- </div>
226
- )}
227
225
  </div>
228
226
  <div style={{ flex: 1, minHeight: 0, overflow: "auto" }}>
229
227
  {children}
@@ -233,7 +233,7 @@ export function humanizeIssueKind(kind: string): string {
233
233
  const KIND_LABEL: Record<string, string> = {
234
234
  missing_file: 'Construct declaration file missing',
235
235
  symbol_ambiguous: 'Multiple construct symbol matches',
236
- symbol_unmatched: 'Construct symbol unconfirmed',
236
+ symbol_unmatched: 'Construct symbol missing',
237
237
  stale_declaration: 'Construct declaration drift',
238
238
  construct_mismatch: 'Construct type mismatch',
239
239
  construct_unconfirmed: 'Construct type unconfirmed',
@@ -869,16 +869,24 @@ function Inner({ components, trails, graphifyRelations, orderByLine, initialTrai
869
869
  // the selected step until it does.
870
870
  const [visibleStepIndex, setVisibleStepIndex] = useState<number | null>(null);
871
871
  const drawerStepIndex = drawerTarget?.kind === 'trail' ? drawerTarget.stepIndex : null;
872
+ // Reset when the drawer switches trail (or closes) — synchronously, so the bar
873
+ // never paints the previous trail's position. A step change *within* the same
874
+ // trail is deliberately not reset: the code view scrolls to the new step and
875
+ // the viewport tracker carries the fill across that scroll. Resetting on step
876
+ // change flashed — the post-paint effect snapped the fill to the target, then
877
+ // Pierre's smooth scroll re-reported the old viewport, bouncing target → old →
878
+ // target.
879
+ const activeTrailId = focusedTrail?.id ?? null;
880
+ const [visibleTrailId, setVisibleTrailId] = useState(activeTrailId);
881
+ if (activeTrailId !== visibleTrailId) {
882
+ setVisibleTrailId(activeTrailId);
883
+ setVisibleStepIndex(null);
884
+ }
872
885
  const drawerProgress = useMemo(() => {
873
886
  if (drawerStepIndex == null || !focusedTrail) return null;
874
887
  return { index: visibleStepIndex ?? drawerStepIndex, total: focusedTrail.steps.length };
875
888
  }, [drawerStepIndex, focusedTrail, visibleStepIndex]);
876
889
 
877
- // A new trail or step invalidates whatever the last scroll reported.
878
- useEffect(() => {
879
- setVisibleStepIndex(null);
880
- }, [focusedTrail?.id, drawerStepIndex]);
881
-
882
890
  // Refresh selected component when the components list updates (e.g. verify
883
891
  // writes back declarationRef).
884
892
  useEffect(() => {