@principal-ai/subsystems-react 0.56.35 → 0.56.37

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 (48) hide show
  1. package/dist/index.d.ts +3 -3
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +2 -2
  4. package/dist/index.js.map +1 -1
  5. package/dist/subsystem/SubsystemComponentGraph.d.ts +50 -8
  6. package/dist/subsystem/SubsystemComponentGraph.d.ts.map +1 -1
  7. package/dist/subsystem/SubsystemComponentGraph.js +291 -50
  8. package/dist/subsystem/SubsystemComponentGraph.js.map +1 -1
  9. package/dist/subsystem/TrailStepsNav.d.ts +1 -1
  10. package/dist/subsystem/TrailStepsNav.d.ts.map +1 -1
  11. package/dist/subsystem/TrailStepsNav.js +2 -1
  12. package/dist/subsystem/TrailStepsNav.js.map +1 -1
  13. package/dist/subsystem/TrailsPanel.d.ts +5 -5
  14. package/dist/subsystem/TrailsPanel.d.ts.map +1 -1
  15. package/dist/subsystem/TrailsPanel.js +23 -43
  16. package/dist/subsystem/TrailsPanel.js.map +1 -1
  17. package/dist/subsystem/model.d.ts +21 -6
  18. package/dist/subsystem/model.d.ts.map +1 -1
  19. package/dist/subsystem/model.js +48 -45
  20. package/dist/subsystem/model.js.map +1 -1
  21. package/dist/subsystem/nodeIconography.d.ts +25 -0
  22. package/dist/subsystem/nodeIconography.d.ts.map +1 -0
  23. package/dist/subsystem/nodeIconography.js +55 -0
  24. package/dist/subsystem/nodeIconography.js.map +1 -0
  25. package/dist/subsystem/nodes.d.ts +9 -8
  26. package/dist/subsystem/nodes.d.ts.map +1 -1
  27. package/dist/subsystem/nodes.js +271 -338
  28. package/dist/subsystem/nodes.js.map +1 -1
  29. package/dist/subsystem/stepEmphasis.d.ts +5 -0
  30. package/dist/subsystem/stepEmphasis.d.ts.map +1 -1
  31. package/dist/subsystem/stepEmphasis.js +7 -0
  32. package/dist/subsystem/stepEmphasis.js.map +1 -1
  33. package/package.json +1 -1
  34. package/src/index.ts +3 -1
  35. package/src/stories/Canvases/Subsystem/AgentDrivenWalkthrough.stories.tsx +1842 -279
  36. package/src/stories/Canvases/Subsystem/Deprecated.stories.tsx +1 -1
  37. package/src/stories/Canvases/Subsystem/NodeAnatomy.stories.tsx +17 -21
  38. package/src/stories/Canvases/Subsystem/NodeIconography.stories.tsx +791 -21
  39. package/src/stories/Canvases/Subsystem/Spotlights.stories.tsx +1 -1
  40. package/src/subsystem/SubsystemComponentGraph.tsx +359 -62
  41. package/src/subsystem/TrailStepsNav.tsx +2 -2
  42. package/src/subsystem/TrailsPanel.tsx +35 -89
  43. package/src/subsystem/model.test.ts +17 -13
  44. package/src/subsystem/model.ts +60 -48
  45. package/src/subsystem/nodeIconography.ts +88 -0
  46. package/src/subsystem/nodes.component.test.tsx +177 -0
  47. package/src/subsystem/nodes.tsx +463 -435
  48. package/src/subsystem/stepEmphasis.ts +8 -0
@@ -1,22 +1,43 @@
1
- import React from 'react';
2
- import '@xyflow/react/dist/style.css';
1
+ import React, { useState } from 'react';
3
2
  import type { Meta, StoryObj } from '@storybook/react';
4
3
  import {
5
- Box,
4
+ Bot,
5
+ Archive,
6
+ CirclePlus,
6
7
  Database,
7
- FileCode2,
8
- Globe,
8
+ HardDrive,
9
9
  List,
10
- PanelsTopLeft,
10
+ LogIn,
11
+ Layers3,
12
+ MemoryStick,
13
+ Network,
14
+ Server,
11
15
  SquareFunction,
12
16
  Type,
17
+ Unplug,
13
18
  UserRound,
19
+ WandSparkles,
20
+ TriangleAlert,
21
+ CircleX,
22
+ Workflow,
14
23
  type LucideIcon,
15
24
  createLucideIcon,
16
25
  } from 'lucide-react';
17
26
  import { ThemeProvider, defaultEditorTheme, useTheme } from '@principal-ade/industry-theme';
18
27
  import { componentColor } from '../../../pierre/constructColors';
19
- import type { SubsystemComponent, SubsystemComponentConstruct } from '../../../subsystem/model';
28
+ import { TechMark, technologyBrand } from '../../../subsystem/techIcons';
29
+ import {
30
+ constructBadgeLabel,
31
+ DEPRECATED_COLOR,
32
+ ROLE_COLOR,
33
+ STORAGE_COLOR,
34
+ } from '../../../subsystem/model';
35
+ import type {
36
+ SubsystemComponent,
37
+ SubsystemComponentConstruct,
38
+ SubsystemGraphNodeData,
39
+ SubsystemNodeIssue,
40
+ } from '../../../subsystem/model';
20
41
 
21
42
  const meta = {
22
43
  title: 'Canvases/Subsystem/UI Isolation/NodeIconography',
@@ -42,23 +63,175 @@ type IconChoice = {
42
63
  };
43
64
 
44
65
  const FunctionLetter = createLucideIcon('FunctionLetter', [
45
- ['path', { d: 'M9 17c2 0 2.8-1 2.8-2.8V10c0-2 1-3.3 3.2-3' }],
46
- ['path', { d: 'M9 11.2h5.7' }],
66
+ ['path', { d: 'M9 17c2 0 2.8-1 2.8-2.8V10c0-2 1-3.3 3.2-3', key: 'f-stem' }],
67
+ ['path', { d: 'M9 11.2h5.7', key: 'f-crossbar' }],
68
+ ]);
69
+
70
+ const ClassGlyph = createLucideIcon('ClassGlyph', [
71
+ ['rect', { x: '3', y: '3', width: '18', height: '18', rx: '2', key: 'class-box' }],
72
+ ['path', { d: 'M16 7.5a5.5 5.5 0 1 0 0 9', key: 'class-c' }],
47
73
  ]);
48
74
 
49
75
  const ICON_CHOICES: IconChoice[] = [
50
76
  { construct: 'function', label: 'function', name: 'submitOrder', Icon: FunctionLetter },
51
- { construct: 'class', label: 'class', name: 'OrderService', Icon: Box },
77
+ { construct: 'class', label: 'class', name: 'OrderService', Icon: ClassGlyph },
52
78
  { construct: 'method', label: 'method', name: 'OrderService.submit', Icon: SquareFunction },
53
- { construct: 'external', label: 'external', name: 'PaymentProvider', Icon: Globe },
54
- { construct: 'store', label: 'store', name: 'orderStore', Icon: Database },
79
+ { construct: 'external', label: 'external', name: 'PaymentProvider', Icon: Network },
80
+ { construct: 'store', label: 'store', name: 'orderStore', Icon: Layers3 },
55
81
  { construct: 'custom_entity', label: 'custom entity', name: 'Customer', Icon: UserRound },
56
- { construct: 'interface', label: 'interface', name: 'OrderRepository', Icon: PanelsTopLeft },
82
+ { construct: 'interface', label: 'interface', name: 'OrderRepository', Icon: Unplug },
57
83
  { construct: 'type_alias', label: 'type alias', name: 'OrderId', Icon: Type },
58
84
  { construct: 'enum', label: 'enum', name: 'OrderStatus', Icon: List },
59
85
  ];
60
86
 
61
- function NodeSpecimen({ choice }: { choice: IconChoice }) {
87
+ type PrimaryOverrideChoice = {
88
+ label: string;
89
+ iconLabel: string;
90
+ name: string;
91
+ color: string;
92
+ Icon?: LucideIcon;
93
+ brand?: string;
94
+ };
95
+
96
+ const PRIMARY_OVERRIDE_CHOICES: PrimaryOverrideChoice[] = [
97
+ {
98
+ label: 'framework stereotype · React',
99
+ iconLabel: 'REACT COMPONENT',
100
+ name: 'CheckoutButton',
101
+ color: '#61dafb',
102
+ brand: 'React',
103
+ },
104
+ { label: 'custom entity · Person', iconLabel: 'PERSON', name: 'Customer', color: '#ff7b72', Icon: UserRound },
105
+ { label: 'custom entity · agent', iconLabel: 'AGENT', name: 'ReviewAgent', color: '#ff7b72', Icon: Bot },
106
+ { label: 'custom entity · service', iconLabel: 'SERVICE', name: 'NotificationService', color: '#ff7b72', Icon: Server },
107
+ { label: 'custom entity · queue', iconLabel: 'QUEUE', name: 'WorkQueue', color: '#ff7b72', Icon: List },
108
+ ];
109
+
110
+ type NodeStateChoice = {
111
+ label: string;
112
+ component: SubsystemComponent;
113
+ state: Partial<Pick<SubsystemGraphNodeData, 'working' | 'issue' | 'proposed' | 'removed'>>;
114
+ };
115
+
116
+ const STORY_PURL = 'pkg:github/story/subsystem-node-iconography';
117
+
118
+ const NODE_STATE_CHOICES: NodeStateChoice[] = [
119
+ {
120
+ label: 'working',
121
+ component: {
122
+ alias: 'review-agent',
123
+ name: 'ReviewAgent',
124
+ construct: 'class',
125
+ file: 'src/agents/review.ts',
126
+ purl: STORY_PURL,
127
+ },
128
+ state: { working: true },
129
+ },
130
+ {
131
+ label: 'issue',
132
+ component: {
133
+ alias: 'order-repository',
134
+ name: 'OrderRepository',
135
+ construct: 'interface',
136
+ file: 'src/orders/repository.ts',
137
+ purl: STORY_PURL,
138
+ },
139
+ state: { issue: { severity: 'error', rung: 'type', count: 1 } satisfies SubsystemNodeIssue },
140
+ },
141
+ {
142
+ label: 'proposed',
143
+ component: {
144
+ alias: 'new-order-flow',
145
+ name: 'newOrderFlow',
146
+ construct: 'function',
147
+ file: 'src/orders/flow.ts',
148
+ purl: STORY_PURL,
149
+ },
150
+ state: { proposed: true },
151
+ },
152
+ {
153
+ label: 'removed',
154
+ component: {
155
+ alias: 'legacy-checkout',
156
+ name: 'legacyCheckout',
157
+ construct: 'function',
158
+ file: 'src/checkout/legacy.ts',
159
+ purl: STORY_PURL,
160
+ },
161
+ state: { removed: true },
162
+ },
163
+ ];
164
+
165
+ const SECONDARY_BADGES = {
166
+ entry: { label: 'ENTRY', color: ROLE_COLOR.entry, Icon: LogIn },
167
+ service: { label: 'SERVICE', color: ROLE_COLOR.service, Icon: Workflow },
168
+ memory: { label: 'MEMORY', color: STORAGE_COLOR.memory, Icon: MemoryStick },
169
+ disk: { label: 'DISK', color: STORAGE_COLOR.disk, Icon: HardDrive },
170
+ external: { label: 'DB', color: STORAGE_COLOR.external, Icon: Database },
171
+ deprecated: { label: 'DEPRECATED', color: DEPRECATED_COLOR, Icon: Archive },
172
+ } satisfies Record<string, { label: string; color: string; Icon: LucideIcon }>;
173
+
174
+ type SecondaryBadgeKind = keyof typeof SECONDARY_BADGES;
175
+ type SecondaryBadgePlacement = 'bottom-center' | 'top-right' | 'bottom-right';
176
+ const SECONDARY_BADGE_PLACEMENTS: Array<[SecondaryBadgePlacement, string]> = [
177
+ ['bottom-center', 'Bottom center'],
178
+ ['top-right', 'Top right'],
179
+ ['bottom-right', 'Bottom right'],
180
+ ];
181
+
182
+ const SECONDARY_BADGE_CASES: Array<{
183
+ label: string;
184
+ name: string;
185
+ construct: 'function' | 'store' | 'class';
186
+ badges: SecondaryBadgeKind[];
187
+ primaryLabel: string;
188
+ primaryIcon?: LucideIcon;
189
+ primaryBrand?: string;
190
+ }> = [
191
+ {
192
+ label: 'role · entry',
193
+ name: 'CheckoutButton',
194
+ construct: 'function',
195
+ badges: ['entry'],
196
+ primaryLabel: 'REACT · COMPONENT',
197
+ primaryBrand: 'React',
198
+ },
199
+ {
200
+ label: 'role · service',
201
+ name: 'OrderService',
202
+ construct: 'class',
203
+ badges: ['service'],
204
+ primaryLabel: 'CLASS',
205
+ primaryIcon: ClassGlyph,
206
+ },
207
+ { label: 'store backing · memory', name: 'sessionStore', construct: 'store', badges: ['memory'], primaryLabel: 'STORE', primaryIcon: Layers3 },
208
+ { label: 'store backing · disk', name: 'modelStore', construct: 'store', badges: ['disk'], primaryLabel: 'STORE', primaryIcon: Layers3 },
209
+ { label: 'store backing · external', name: 'ordersDb', construct: 'store', badges: ['external'], primaryLabel: 'STORE', primaryIcon: Layers3 },
210
+ {
211
+ label: 'combined · store + role',
212
+ name: 'orderStore',
213
+ construct: 'store',
214
+ badges: ['memory', 'service'],
215
+ primaryLabel: 'STORE',
216
+ primaryIcon: Layers3,
217
+ },
218
+ {
219
+ label: 'deprecated · removal details',
220
+ name: 'legacyCheckout',
221
+ construct: 'function',
222
+ badges: ['deprecated'],
223
+ primaryLabel: 'FUNCTION',
224
+ primaryIcon: FunctionLetter,
225
+ },
226
+ ];
227
+
228
+ function NodeSpecimen({
229
+ choice,
230
+ showIconLabel,
231
+ }: {
232
+ choice: IconChoice;
233
+ showIconLabel: boolean;
234
+ }) {
62
235
  const { theme } = useTheme();
63
236
  const color = componentColor(
64
237
  { construct: choice.construct } as Pick<SubsystemComponent, 'construct'>,
@@ -98,9 +271,10 @@ function NodeSpecimen({ choice }: { choice: IconChoice }) {
98
271
  display: 'inline-flex',
99
272
  alignItems: 'center',
100
273
  justifyContent: 'center',
101
- width: 24,
274
+ gap: showIconLabel ? 6 : 0,
275
+ width: showIconLabel ? undefined : 24,
102
276
  height: 24,
103
- flex: '0 0 24px',
277
+ flex: '0 0 auto',
104
278
  overflow: 'visible',
105
279
  color,
106
280
  lineHeight: 0,
@@ -111,14 +285,377 @@ function NodeSpecimen({ choice }: { choice: IconChoice }) {
111
285
  strokeWidth={2}
112
286
  aria-hidden="true"
113
287
  />
288
+ {showIconLabel && (
289
+ <span
290
+ style={{
291
+ fontFamily: theme.fonts.monospace,
292
+ fontSize: theme.fontSizes[1],
293
+ fontWeight: 600,
294
+ lineHeight: '16px',
295
+ textTransform: 'uppercase',
296
+ whiteSpace: 'nowrap',
297
+ }}
298
+ >
299
+ {choice.label}
300
+ </span>
301
+ )}
302
+ </span>
303
+ <span style={{ overflowWrap: 'anywhere' }}>{choice.name}</span>
304
+ </div>
305
+ );
306
+ }
307
+
308
+ function SecondaryBadgeSpecimen({
309
+ name,
310
+ construct,
311
+ badges,
312
+ primaryLabel,
313
+ primaryIcon,
314
+ primaryBrand,
315
+ mode,
316
+ placement,
317
+ showIconLabels = false,
318
+ }: {
319
+ name: string;
320
+ construct: 'function' | 'store' | 'class';
321
+ badges: SecondaryBadgeKind[];
322
+ primaryLabel: string;
323
+ primaryIcon?: LucideIcon;
324
+ primaryBrand?: string;
325
+ mode: 'text' | 'icon';
326
+ showIconLabels?: boolean;
327
+ placement: SecondaryBadgePlacement;
328
+ }) {
329
+ const { theme } = useTheme();
330
+ const nodeColor = componentColor({ construct } as Pick<SubsystemComponent, 'construct'>, 'pierre-dark');
331
+ const nodeBg = theme.colors.backgroundSecondary ?? theme.colors.background;
332
+ const BrandIcon = primaryBrand ? technologyBrand(primaryBrand) : undefined;
333
+ const PrimaryIcon = primaryIcon;
334
+ const badgePosition: React.CSSProperties =
335
+ placement === 'top-right'
336
+ ? { top: -11, right: -2 }
337
+ : placement === 'bottom-right'
338
+ ? { bottom: -8, right: -8 }
339
+ : { bottom: -11, left: '50%', transform: 'translateX(-50%)' };
340
+
341
+ return (
342
+ <div
343
+ style={{
344
+ position: 'relative',
345
+ display: 'flex',
346
+ flexDirection: 'column',
347
+ alignItems: 'center',
348
+ justifyContent: 'flex-start',
349
+ width: 250,
350
+ height: 96,
351
+ boxSizing: 'border-box',
352
+ gap: 8,
353
+ padding: '14px 16px 0',
354
+ border: `2px solid ${nodeColor}`,
355
+ borderRadius: 8,
356
+ background: nodeBg,
357
+ color: theme.colors.text,
358
+ fontFamily: theme.fonts.body,
359
+ fontSize: theme.fontSizes[2],
360
+ fontWeight: 600,
361
+ textAlign: 'center',
362
+ }}
363
+ >
364
+ <span
365
+ style={{
366
+ display: 'inline-flex',
367
+ alignItems: 'center',
368
+ justifyContent: 'center',
369
+ gap: 6,
370
+ width: 'auto',
371
+ height: 24,
372
+ flex: '0 0 auto',
373
+ color: nodeColor,
374
+ lineHeight: 1,
375
+ }}
376
+ >
377
+ {BrandIcon ? (
378
+ <TechMark brand={BrandIcon} size={24} showTitle={false} />
379
+ ) : PrimaryIcon ? (
380
+ <PrimaryIcon size={24} strokeWidth={2} aria-hidden="true" />
381
+ ) : null}
382
+ <span
383
+ style={{
384
+ fontFamily: theme.fonts.monospace,
385
+ fontSize: theme.fontSizes[1],
386
+ fontWeight: 600,
387
+ letterSpacing: 0.25,
388
+ whiteSpace: 'nowrap',
389
+ }}
390
+ >
391
+ {primaryLabel}
392
+ </span>
393
+ </span>
394
+ <span style={{ overflowWrap: 'anywhere' }}>{name}</span>
395
+ <div
396
+ style={{
397
+ position: 'absolute',
398
+ ...badgePosition,
399
+ display: 'flex',
400
+ gap: 6,
401
+ whiteSpace: 'nowrap',
402
+ }}
403
+ >
404
+ {badges.map((kind) => {
405
+ const badge = SECONDARY_BADGES[kind];
406
+ const Icon = badge.Icon;
407
+ return (
408
+ <span
409
+ key={kind}
410
+ title={badge.label}
411
+ aria-label={badge.label}
412
+ style={{
413
+ display: 'inline-flex',
414
+ alignItems: 'center',
415
+ justifyContent: 'center',
416
+ boxSizing: 'border-box',
417
+ minWidth: mode === 'icon' && !showIconLabels ? 26 : undefined,
418
+ height: 26,
419
+ gap: mode === 'icon' && showIconLabels ? 5 : 0,
420
+ padding: mode === 'text' || showIconLabels ? '2px 8px' : 0,
421
+ border: `2px solid ${badge.color}`,
422
+ borderRadius: 4,
423
+ background: nodeBg,
424
+ color: badge.color,
425
+ fontFamily: theme.fonts.monospace,
426
+ fontSize: theme.fontSizes[1],
427
+ fontWeight: 700,
428
+ letterSpacing: 0.5,
429
+ lineHeight: '17px',
430
+ }}
431
+ >
432
+ {mode === 'text' ? (
433
+ badge.label
434
+ ) : (
435
+ <>
436
+ <Icon size={14} strokeWidth={2} aria-hidden="true" />
437
+ {showIconLabels && <span>{badge.label}</span>}
438
+ </>
439
+ )}
440
+ </span>
441
+ );
442
+ })}
443
+ </div>
444
+ </div>
445
+ );
446
+ }
447
+
448
+ function PrimaryOverrideSpecimen({
449
+ choice,
450
+ showIconLabel,
451
+ }: {
452
+ choice: PrimaryOverrideChoice;
453
+ showIconLabel: boolean;
454
+ }) {
455
+ const { theme } = useTheme();
456
+ const nodeBg = theme.colors.backgroundSecondary ?? theme.colors.background;
457
+ const BrandIcon = choice.brand ? technologyBrand(choice.brand) : undefined;
458
+ const Icon = choice.Icon;
459
+
460
+ return (
461
+ <div
462
+ style={{
463
+ display: 'flex',
464
+ flexDirection: 'column',
465
+ alignItems: 'center',
466
+ justifyContent: 'flex-start',
467
+ width: 250,
468
+ height: 96,
469
+ boxSizing: 'border-box',
470
+ gap: 8,
471
+ padding: '14px 16px 0',
472
+ border: `2px solid ${choice.color}`,
473
+ borderRadius: 8,
474
+ background: nodeBg,
475
+ color: theme.colors.text,
476
+ fontFamily: theme.fonts.body,
477
+ fontSize: theme.fontSizes[2],
478
+ fontWeight: 600,
479
+ textAlign: 'center',
480
+ }}
481
+ >
482
+ <span
483
+ title={choice.label}
484
+ aria-label={choice.iconLabel}
485
+ style={{
486
+ display: 'inline-flex',
487
+ alignItems: 'center',
488
+ justifyContent: 'center',
489
+ gap: showIconLabel ? 6 : 0,
490
+ width: showIconLabel ? undefined : 24,
491
+ height: 24,
492
+ flex: '0 0 auto',
493
+ color: choice.color,
494
+ lineHeight: 0,
495
+ }}
496
+ >
497
+ {BrandIcon ? (
498
+ <TechMark brand={BrandIcon} size={24} showTitle={false} />
499
+ ) : Icon ? (
500
+ <Icon size={24} strokeWidth={2} aria-hidden="true" />
501
+ ) : null}
502
+ {showIconLabel && (
503
+ <span
504
+ style={{
505
+ fontFamily: theme.fonts.monospace,
506
+ fontSize: theme.fontSizes[1],
507
+ fontWeight: 600,
508
+ lineHeight: '16px',
509
+ whiteSpace: 'nowrap',
510
+ }}
511
+ >
512
+ {choice.iconLabel}
513
+ </span>
514
+ )}
114
515
  </span>
115
516
  <span style={{ overflowWrap: 'anywhere' }}>{choice.name}</span>
116
517
  </div>
117
518
  );
118
519
  }
119
520
 
521
+ function NodeStateSpecimen({ choice }: { choice: NodeStateChoice }) {
522
+ const { theme } = useTheme();
523
+ const nodeBg = theme.colors.backgroundSecondary ?? theme.colors.background;
524
+ const component = choice.component;
525
+ const primaryIcon = ICON_CHOICES.find((item) => item.construct === component.construct)?.Icon;
526
+ const PrimaryIcon = primaryIcon;
527
+ const constructColor = componentColor(component, 'pierre-dark');
528
+ const issue = choice.state.issue;
529
+ const proposed = choice.state.proposed === true;
530
+ const removed = choice.state.removed === true;
531
+ const working = choice.state.working === true;
532
+ const proposalColor = theme.colors.warning ?? '#d4a017';
533
+ const removedColor = '#6b7280';
534
+ const workingColor = theme.colors.accent ?? theme.colors.primary ?? '#a78bfa';
535
+ const issueColor =
536
+ issue?.severity === 'error'
537
+ ? (theme.colors.error ?? '#e5534b')
538
+ : (theme.colors.warning ?? '#d4a017');
539
+ const borderColor = removed
540
+ ? removedColor
541
+ : constructColor;
542
+ const borderStyle = removed || proposed ? 'dashed' : 'solid';
543
+
544
+ const stateMarker = (
545
+ markerColor: string,
546
+ Icon: LucideIcon,
547
+ anchor: 'top-right' | 'bottom-right',
548
+ ) => (
549
+ <div
550
+ title={choice.label}
551
+ aria-label={choice.label}
552
+ style={{
553
+ position: 'absolute',
554
+ zIndex: 2,
555
+ display: 'inline-flex',
556
+ alignItems: 'center',
557
+ justifyContent: 'center',
558
+ width: 26,
559
+ height: 26,
560
+ boxSizing: 'border-box',
561
+ border: `2px solid ${markerColor}`,
562
+ borderRadius: 5,
563
+ background: nodeBg,
564
+ color: markerColor,
565
+ pointerEvents: 'none',
566
+ ...(anchor === 'top-right'
567
+ ? { top: -10, right: -8 }
568
+ : { bottom: -8, right: -8 }),
569
+ }}
570
+ >
571
+ <Icon size={14} strokeWidth={2} aria-hidden="true" />
572
+ </div>
573
+ );
574
+
575
+ return (
576
+ <div
577
+ style={{
578
+ position: 'relative',
579
+ display: 'flex',
580
+ flexDirection: 'column',
581
+ alignItems: 'center',
582
+ justifyContent: 'flex-start',
583
+ width: 250,
584
+ height: 96,
585
+ boxSizing: 'border-box',
586
+ gap: 8,
587
+ padding: '14px 16px 0',
588
+ border: `${proposed ? 3 : 2}px ${borderStyle} ${borderColor}`,
589
+ borderRadius: component.construct === 'external' ? 0 : 8,
590
+ background: nodeBg,
591
+ color: theme.colors.text,
592
+ fontFamily: theme.fonts.body,
593
+ fontSize: theme.fontSizes[2],
594
+ fontWeight: 600,
595
+ textAlign: 'center',
596
+ opacity: removed ? 0.45 : 1,
597
+ boxShadow: working
598
+ ? `0 0 0 3px ${workingColor}55, 0 0 18px ${workingColor}44`
599
+ : '0 1px 4px rgba(0,0,0,0.25)',
600
+ }}
601
+ >
602
+ <span
603
+ style={{
604
+ display: 'inline-flex',
605
+ alignItems: 'center',
606
+ justifyContent: 'center',
607
+ width: 'auto',
608
+ height: 24,
609
+ flex: '0 0 auto',
610
+ gap: 6,
611
+ overflow: 'visible',
612
+ color: constructColor,
613
+ lineHeight: 1,
614
+ }}
615
+ >
616
+ {PrimaryIcon && (
617
+ <PrimaryIcon
618
+ size={component.construct === 'function' ? 34 : 24}
619
+ strokeWidth={2}
620
+ aria-hidden="true"
621
+ />
622
+ )}
623
+ <span
624
+ style={{
625
+ fontFamily: theme.fonts.monospace,
626
+ fontSize: theme.fontSizes[1],
627
+ fontWeight: 600,
628
+ letterSpacing: 0.25,
629
+ whiteSpace: 'nowrap',
630
+ }}
631
+ >
632
+ {constructBadgeLabel(component).toUpperCase()}
633
+ </span>
634
+ </span>
635
+ <span
636
+ style={{
637
+ color: proposed ? proposalColor : theme.colors.text,
638
+ textDecoration: removed ? 'line-through' : undefined,
639
+ overflowWrap: 'anywhere',
640
+ }}
641
+ >
642
+ {component.name}
643
+ </span>
644
+ {working && <>{stateMarker(workingColor, WandSparkles, 'top-right')}</>}
645
+ {issue && <>{stateMarker(issueColor, TriangleAlert, 'bottom-right')}</>}
646
+ {proposed && <>{stateMarker(proposalColor, CirclePlus, 'top-right')}</>}
647
+ {removed && <>{stateMarker(removedColor, CircleX, 'top-right')}</>}
648
+ </div>
649
+ );
650
+ }
651
+
120
652
  function IconographyGallery() {
121
653
  const { theme } = useTheme();
654
+ const [showConstructIconLabels, setShowConstructIconLabels] = useState(true);
655
+ const [showOverrideIconLabels, setShowOverrideIconLabels] = useState(true);
656
+ const [showSecondaryIconLabels, setShowSecondaryIconLabels] = useState(true);
657
+ const [secondaryBadgePlacement, setSecondaryBadgePlacement] =
658
+ useState<SecondaryBadgePlacement>('bottom-center');
122
659
  const muted = theme.colors.textMuted ?? theme.colors.textSecondary;
123
660
  const border = theme.colors.border;
124
661
 
@@ -133,13 +670,46 @@ function IconographyGallery() {
133
670
  }}
134
671
  >
135
672
  <header style={{ maxWidth: 880, marginBottom: 28 }}>
136
- <h1 style={{ margin: '0 0 8px', fontSize: 22 }}>Node construct iconography</h1>
673
+ <h1 style={{ margin: '0 0 8px', fontSize: 22 }}>Subsystem node iconography</h1>
137
674
  <p style={{ margin: 0, color: muted, lineHeight: 1.55 }}>
138
- A visual-only study of replacing construct-kind text with bare glyphs
139
- above the node name. The production node is unchanged.
675
+ A visual-only study of replacing node labels with glyphs above the
676
+ node name. Construct kinds and special node states are shown; the
677
+ production node is unchanged.
140
678
  </p>
141
679
  </header>
142
680
 
681
+ <div
682
+ style={{
683
+ display: 'flex',
684
+ alignItems: 'center',
685
+ justifyContent: 'space-between',
686
+ gap: 16,
687
+ margin: '0 0 6px',
688
+ }}
689
+ >
690
+ <h2 style={{ margin: 0, fontSize: 16 }}>Construct kinds</h2>
691
+ <button
692
+ type="button"
693
+ aria-pressed={showConstructIconLabels}
694
+ aria-label="Toggle labels beside construct icons"
695
+ onClick={() => setShowConstructIconLabels((visible) => !visible)}
696
+ style={{
697
+ padding: '6px 10px',
698
+ border: `1px solid ${theme.colors.border}`,
699
+ borderRadius: 6,
700
+ background: theme.colors.backgroundSecondary ?? theme.colors.background,
701
+ color: theme.colors.textSecondary,
702
+ fontFamily: theme.fonts.monospace,
703
+ fontSize: 11,
704
+ cursor: 'pointer',
705
+ }}
706
+ >
707
+ {showConstructIconLabels ? 'Icon + label' : 'Icon only'}
708
+ </button>
709
+ </div>
710
+ <p style={{ maxWidth: 760, margin: '0 0 18px', color: muted, lineHeight: 1.5, fontSize: 12 }}>
711
+ Toggle construct names inline with the icons; the node name stays below.
712
+ </p>
143
713
  <div
144
714
  style={{
145
715
  display: 'grid',
@@ -152,6 +722,66 @@ function IconographyGallery() {
152
722
  >
153
723
  {ICON_CHOICES.map((choice) => (
154
724
  <div key={choice.construct}>
725
+ <div
726
+ style={{
727
+ marginBottom: 10,
728
+ color: muted,
729
+ fontFamily: 'ui-monospace, SFMono-Regular, Menlo, monospace',
730
+ fontSize: 10,
731
+ }}
732
+ >
733
+ {choice.label.toUpperCase()}
734
+ </div>
735
+ <NodeSpecimen choice={choice} showIconLabel={showConstructIconLabels} />
736
+ </div>
737
+ ))}
738
+ </div>
739
+
740
+ <div
741
+ style={{
742
+ display: 'flex',
743
+ alignItems: 'center',
744
+ justifyContent: 'space-between',
745
+ gap: 16,
746
+ margin: '28px 0 6px',
747
+ }}
748
+ >
749
+ <h2 style={{ margin: 0, fontSize: 16 }}>Primary badge overrides</h2>
750
+ <button
751
+ type="button"
752
+ aria-pressed={showOverrideIconLabels}
753
+ aria-label="Toggle labels beside primary override icons"
754
+ onClick={() => setShowOverrideIconLabels((visible) => !visible)}
755
+ style={{
756
+ padding: '6px 10px',
757
+ border: `1px solid ${theme.colors.border}`,
758
+ borderRadius: 6,
759
+ background: theme.colors.backgroundSecondary ?? theme.colors.background,
760
+ color: theme.colors.textSecondary,
761
+ fontFamily: theme.fonts.monospace,
762
+ fontSize: 11,
763
+ cursor: 'pointer',
764
+ }}
765
+ >
766
+ {showOverrideIconLabels ? 'Icon + label' : 'Icon only'}
767
+ </button>
768
+ </div>
769
+ <p style={{ maxWidth: 760, margin: '0 0 18px', color: muted, lineHeight: 1.5, fontSize: 12 }}>
770
+ Framework stereotypes and custom entity kinds override the normal
771
+ construct label. These candidates use the primary icon slot above the
772
+ title.
773
+ </p>
774
+ <div
775
+ style={{
776
+ display: 'grid',
777
+ gridTemplateColumns: 'repeat(auto-fit, minmax(250px, 1fr))',
778
+ gap: '24px 18px',
779
+ alignItems: 'start',
780
+ padding: '4px 8px 18px',
781
+ }}
782
+ >
783
+ {PRIMARY_OVERRIDE_CHOICES.map((choice) => (
784
+ <div key={choice.label}>
155
785
  <div
156
786
  style={{
157
787
  marginBottom: 10,
@@ -162,7 +792,147 @@ function IconographyGallery() {
162
792
  >
163
793
  {choice.label}
164
794
  </div>
165
- <NodeSpecimen choice={choice} />
795
+ <PrimaryOverrideSpecimen
796
+ choice={choice}
797
+ showIconLabel={showOverrideIconLabels}
798
+ />
799
+ </div>
800
+ ))}
801
+ </div>
802
+
803
+ <h2 style={{ margin: '28px 0 6px', fontSize: 16 }}>Node state markers</h2>
804
+ <p style={{ maxWidth: 760, margin: '0 0 18px', color: muted, lineHeight: 1.5, fontSize: 12 }}>
805
+ These are state indicators, separate from both the primary construct
806
+ label and secondary role/storage badges. Selection and file-match remain
807
+ border-only.
808
+ </p>
809
+ <div
810
+ style={{
811
+ display: 'grid',
812
+ gridTemplateColumns: 'repeat(auto-fit, minmax(250px, 1fr))',
813
+ gap: '24px 18px',
814
+ alignItems: 'start',
815
+ padding: '4px 8px 18px',
816
+ }}
817
+ >
818
+ {NODE_STATE_CHOICES.map((choice) => (
819
+ <div key={choice.label}>
820
+ <div
821
+ style={{
822
+ marginBottom: 10,
823
+ color: muted,
824
+ fontFamily: 'ui-monospace, SFMono-Regular, Menlo, monospace',
825
+ fontSize: 10,
826
+ }}
827
+ >
828
+ {choice.label}
829
+ </div>
830
+ <NodeStateSpecimen choice={choice} />
831
+ </div>
832
+ ))}
833
+ </div>
834
+
835
+ <div
836
+ style={{
837
+ display: 'flex',
838
+ alignItems: 'center',
839
+ justifyContent: 'space-between',
840
+ gap: 16,
841
+ margin: '28px 0 6px',
842
+ }}
843
+ >
844
+ <h2 style={{ margin: 0, fontSize: 16 }}>Secondary badges</h2>
845
+ <button
846
+ type="button"
847
+ aria-pressed={showSecondaryIconLabels}
848
+ aria-label="Toggle labels beside secondary badge icons"
849
+ onClick={() => setShowSecondaryIconLabels((visible) => !visible)}
850
+ style={{
851
+ padding: '6px 10px',
852
+ border: `1px solid ${theme.colors.border}`,
853
+ borderRadius: 6,
854
+ background: theme.colors.backgroundSecondary ?? theme.colors.background,
855
+ color: theme.colors.textSecondary,
856
+ fontFamily: theme.fonts.monospace,
857
+ fontSize: 11,
858
+ cursor: 'pointer',
859
+ }}
860
+ >
861
+ {showSecondaryIconLabels ? 'Icon + label' : 'Icon only'}
862
+ </button>
863
+ </div>
864
+ <p style={{ maxWidth: 760, margin: '0 0 18px', color: muted, lineHeight: 1.5, fontSize: 12 }}>
865
+ Compare icon treatments and placements for secondary signals. The
866
+ combined store row shows how two badges sit together.
867
+ </p>
868
+ <div
869
+ role="group"
870
+ aria-label="Secondary badge placement"
871
+ style={{ display: 'flex', flexWrap: 'wrap', alignItems: 'center', gap: 6, marginBottom: 18 }}
872
+ >
873
+ <span style={{ color: muted, fontSize: 11, marginRight: 4 }}>Placement</span>
874
+ {SECONDARY_BADGE_PLACEMENTS.map(([placement, label]) => (
875
+ <button
876
+ key={placement}
877
+ type="button"
878
+ aria-pressed={secondaryBadgePlacement === placement}
879
+ onClick={() => setSecondaryBadgePlacement(placement)}
880
+ style={{
881
+ padding: '5px 8px',
882
+ border: `1px solid ${secondaryBadgePlacement === placement ? theme.colors.primary : theme.colors.border}`,
883
+ borderRadius: 5,
884
+ background:
885
+ secondaryBadgePlacement === placement
886
+ ? `${theme.colors.primary}18`
887
+ : theme.colors.backgroundSecondary ?? theme.colors.background,
888
+ color: secondaryBadgePlacement === placement ? theme.colors.primary : theme.colors.textSecondary,
889
+ fontFamily: theme.fonts.monospace,
890
+ fontSize: 10,
891
+ cursor: 'pointer',
892
+ }}
893
+ >
894
+ {label}
895
+ </button>
896
+ ))}
897
+ </div>
898
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 26, padding: '4px 8px 18px' }}>
899
+ {SECONDARY_BADGE_CASES.map((item) => (
900
+ <div key={item.label}>
901
+ <div
902
+ style={{
903
+ marginBottom: 10,
904
+ color: muted,
905
+ fontFamily: 'ui-monospace, SFMono-Regular, Menlo, monospace',
906
+ fontSize: 10,
907
+ }}
908
+ >
909
+ {item.label}
910
+ </div>
911
+ <div
912
+ style={{
913
+ display: 'grid',
914
+ gridTemplateColumns: 'repeat(auto-fit, minmax(250px, 1fr))',
915
+ gap: '18px 24px',
916
+ }}
917
+ >
918
+ <div>
919
+ <div style={{ marginBottom: 8, color: muted, fontSize: 10 }}>Current text</div>
920
+ <SecondaryBadgeSpecimen
921
+ {...item}
922
+ mode="text"
923
+ placement={secondaryBadgePlacement}
924
+ />
925
+ </div>
926
+ <div>
927
+ <div style={{ marginBottom: 8, color: muted, fontSize: 10 }}>Icon candidate</div>
928
+ <SecondaryBadgeSpecimen
929
+ {...item}
930
+ mode="icon"
931
+ showIconLabels={showSecondaryIconLabels}
932
+ placement={secondaryBadgePlacement}
933
+ />
934
+ </div>
935
+ </div>
166
936
  </div>
167
937
  ))}
168
938
  </div>
@@ -184,7 +954,7 @@ function IconographyGallery() {
184
954
  );
185
955
  }
186
956
 
187
- /** Compare a bare-glyph treatment across every subsystem construct. */
957
+ /** Compare construct glyphs and special-case glyph ideas for subsystem nodes. */
188
958
  export const CompareTreatments: Story = {
189
959
  render: () => <IconographyGallery />,
190
960
  };