@principal-ai/principal-view-react 0.16.55 → 0.16.57

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 (125) hide show
  1. package/dist/graphify/consolidated.d.ts +16 -1
  2. package/dist/graphify/consolidated.d.ts.map +1 -1
  3. package/dist/graphify/index.d.ts +1 -1
  4. package/dist/graphify/index.d.ts.map +1 -1
  5. package/dist/graphify/index.js.map +1 -1
  6. package/dist/graphify/kind.d.ts +1 -1
  7. package/dist/graphify/kind.d.ts.map +1 -1
  8. package/dist/graphify/kind.js +7 -1
  9. package/dist/graphify/kind.js.map +1 -1
  10. package/dist/index.d.ts +5 -4
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +3 -2
  13. package/dist/index.js.map +1 -1
  14. package/dist/pierre/constructColors.d.ts +24 -0
  15. package/dist/pierre/constructColors.d.ts.map +1 -0
  16. package/dist/pierre/constructColors.js +91 -0
  17. package/dist/pierre/constructColors.js.map +1 -0
  18. package/dist/pierre/index.d.ts +2 -0
  19. package/dist/pierre/index.d.ts.map +1 -1
  20. package/dist/pierre/index.js +1 -0
  21. package/dist/pierre/index.js.map +1 -1
  22. package/dist/pierre/pierreSyntaxTheme.d.ts +11 -0
  23. package/dist/pierre/pierreSyntaxTheme.d.ts.map +1 -0
  24. package/dist/pierre/pierreSyntaxTheme.js +20 -0
  25. package/dist/pierre/pierreSyntaxTheme.js.map +1 -0
  26. package/dist/pierre/syntaxTokens.d.ts +11 -0
  27. package/dist/pierre/syntaxTokens.d.ts.map +1 -0
  28. package/dist/pierre/syntaxTokens.js +51 -0
  29. package/dist/pierre/syntaxTokens.js.map +1 -0
  30. package/dist/stories/Subsystem/ComponentGraph/fixtures.d.ts +8 -0
  31. package/dist/stories/Subsystem/ComponentGraph/fixtures.d.ts.map +1 -0
  32. package/dist/stories/Subsystem/ComponentGraph/fixtures.js +116 -0
  33. package/dist/stories/Subsystem/ComponentGraph/fixtures.js.map +1 -0
  34. package/dist/subsystem/ComponentDeclaration.d.ts +2 -2
  35. package/dist/subsystem/ComponentDeclaration.d.ts.map +1 -1
  36. package/dist/subsystem/ComponentDeclaration.js +47 -24
  37. package/dist/subsystem/ComponentDeclaration.js.map +1 -1
  38. package/dist/subsystem/SubsystemComponentGraph.d.ts.map +1 -1
  39. package/dist/subsystem/SubsystemComponentGraph.js +23 -2
  40. package/dist/subsystem/SubsystemComponentGraph.js.map +1 -1
  41. package/dist/subsystem/formatDeclaration.d.ts.map +1 -1
  42. package/dist/subsystem/formatDeclaration.js +49 -10
  43. package/dist/subsystem/formatDeclaration.js.map +1 -1
  44. package/dist/subsystem/model.d.ts +57 -12
  45. package/dist/subsystem/model.d.ts.map +1 -1
  46. package/dist/subsystem/model.js +54 -24
  47. package/dist/subsystem/model.js.map +1 -1
  48. package/dist/subsystem/nodes.d.ts +4 -1
  49. package/dist/subsystem/nodes.d.ts.map +1 -1
  50. package/dist/subsystem/nodes.js +70 -21
  51. package/dist/subsystem/nodes.js.map +1 -1
  52. package/dist/subsystem/tokenizeComponent.d.ts +4 -3
  53. package/dist/subsystem/tokenizeComponent.d.ts.map +1 -1
  54. package/dist/subsystem/tokenizeComponent.js +7 -12
  55. package/dist/subsystem/tokenizeComponent.js.map +1 -1
  56. package/dist/subsystem/tokenizeFormatted.d.ts +3 -6
  57. package/dist/subsystem/tokenizeFormatted.d.ts.map +1 -1
  58. package/dist/subsystem/tokenizeFormatted.js +4 -75
  59. package/dist/subsystem/tokenizeFormatted.js.map +1 -1
  60. package/package.json +3 -1
  61. package/src/graphify/consolidated.ts +18 -1
  62. package/src/graphify/index.ts +1 -0
  63. package/src/graphify/kind.ts +7 -1
  64. package/src/index.ts +5 -3
  65. package/src/pierre/constructColors.test.ts +52 -0
  66. package/src/pierre/constructColors.ts +112 -0
  67. package/src/pierre/index.ts +5 -0
  68. package/src/pierre/pierreSyntaxTheme.ts +23 -0
  69. package/src/pierre/syntaxTokens.test.ts +35 -0
  70. package/src/pierre/syntaxTokens.ts +60 -0
  71. package/src/stories/{BoundaryNodes.stories.tsx → Audit/BoundaryNodes.stories.tsx} +1 -1
  72. package/src/stories/{CanvasEdgeTypes.stories.tsx → Audit/CanvasEdgeTypes.stories.tsx} +1 -1
  73. package/src/stories/{CanvasNodeTypes.stories.tsx → Audit/CanvasNodeTypes.stories.tsx} +1 -1
  74. package/src/stories/{ColorPriority.stories.tsx → Audit/ColorPriority.stories.tsx} +1 -1
  75. package/src/stories/{DiamondBadges.stories.tsx → Audit/DiamondBadges.stories.tsx} +1 -1
  76. package/src/stories/{NodeDimensionsTesting.stories.tsx → Audit/NodeDimensionsTesting.stories.tsx} +2 -2
  77. package/src/stories/{NodeFieldsAudit.stories.tsx → Audit/NodeFieldsAudit.stories.tsx} +1 -1
  78. package/src/stories/{NodeFontSizeTesting.stories.tsx → Audit/NodeFontSizeTesting.stories.tsx} +2 -2
  79. package/src/stories/{NodeShapes.stories.tsx → Audit/NodeShapes.stories.tsx} +1 -1
  80. package/src/stories/{WideNodesTesting.stories.tsx → Audit/WideNodesTesting.stories.tsx} +2 -2
  81. package/src/stories/{dashboard → Components}/DashboardRenderer.stories.tsx +2 -2
  82. package/src/stories/{GraphRenderer.stories.tsx → Components/GraphRenderer.stories.tsx} +2 -2
  83. package/src/stories/{MultiCanvasRenderer.stories.tsx → Components/MultiCanvasRenderer.stories.tsx} +2 -2
  84. package/src/stories/{SequenceDiagram.stories.tsx → Components/SequenceDiagram.stories.tsx} +2 -2
  85. package/src/stories/{StateView.stories.tsx → Components/StateView.stories.tsx} +2 -2
  86. package/src/stories/{TraceViewer.stories.tsx → Components/TraceViewer.stories.tsx} +3 -3
  87. package/src/stories/{WorkflowSequenceDiagram.stories.tsx → Components/WorkflowSequenceDiagram.stories.tsx} +1 -1
  88. package/src/stories/{AnimationWorkshop.stories.tsx → Features/AnimationWorkshop.stories.tsx} +5 -5
  89. package/src/stories/{ChangeTypeVisual.stories.tsx → Features/ChangeTypeVisual.stories.tsx} +2 -2
  90. package/src/stories/{EventDrivenAnimations.stories.tsx → Features/EventDrivenAnimations.stories.tsx} +2 -2
  91. package/src/stories/{MultiConfig.stories.tsx → Features/MultiConfig.stories.tsx} +2 -2
  92. package/src/stories/{ElkEdgeRouting.stories.tsx → Layout/ElkEdgeRouting.stories.tsx} +2 -2
  93. package/src/stories/{GraphOrientation.stories.tsx → Layout/GraphOrientation.stories.tsx} +3 -3
  94. package/src/stories/{MultiDirectionalConnections.stories.tsx → Layout/MultiDirectionalConnections.stories.tsx} +2 -2
  95. package/src/stories/{NodeDefinitionComparison.stories.tsx → Nodes/NodeDefinitionComparison.stories.tsx} +2 -2
  96. package/src/stories/{NodeNameFallbacks.stories.tsx → Nodes/NodeNameFallbacks.stories.tsx} +2 -2
  97. package/src/stories/{NumericColors.stories.tsx → Nodes/NumericColors.stories.tsx} +2 -2
  98. package/src/stories/{EventNameDisplay.stories.tsx → OTEL/EventNameDisplay.stories.tsx} +2 -2
  99. package/src/stories/{EventNameFallback.stories.tsx → OTEL/EventNameFallback.stories.tsx} +2 -2
  100. package/src/stories/{OtelComponents.stories.tsx → OTEL/OtelComponents.stories.tsx} +3 -3
  101. package/src/stories/{OtelNodeTypesPrototype.stories.tsx → OTEL/OtelNodeTypesPrototype.stories.tsx} +2 -2
  102. package/src/stories/{RawEventCards.stories.tsx → OTEL/RawEventCards.stories.tsx} +3 -3
  103. package/src/stories/{SpanBadges.stories.tsx → OTEL/SpanBadges.stories.tsx} +1 -1
  104. package/src/stories/{ValidationEventsCanvas.stories.tsx → OTEL/ValidationEventsCanvas.stories.tsx} +3 -3
  105. package/src/stories/{BacklogMdCanvases.stories.tsx → RealWorld/BacklogMdCanvases.stories.tsx} +2 -2
  106. package/src/stories/{FileCitySequence.stories.tsx → RealWorld/FileCitySequence.stories.tsx} +4 -4
  107. package/src/stories/{RealCanvasFiles.stories.tsx → RealWorld/RealCanvasFiles.stories.tsx} +7 -7
  108. package/src/stories/{ComponentDeclarationAudit.stories.tsx → Subsystem/ComponentDeclarationAudit.stories.tsx} +19 -20
  109. package/src/stories/Subsystem/ComponentGraph/Appearance.stories.tsx +365 -0
  110. package/src/stories/Subsystem/ComponentGraph/Basics.stories.tsx +137 -0
  111. package/src/stories/Subsystem/ComponentGraph/Captures.stories.tsx +238 -0
  112. package/src/stories/Subsystem/ComponentGraph/DetailPanel.stories.tsx +315 -0
  113. package/src/stories/Subsystem/ComponentGraph/Scenarios.stories.tsx +959 -0
  114. package/src/stories/Subsystem/ComponentGraph/Spotlights.stories.tsx +646 -0
  115. package/src/stories/Subsystem/ComponentGraph/fixtures.ts +129 -0
  116. package/src/subsystem/ComponentDeclaration.tsx +64 -26
  117. package/src/subsystem/SubsystemComponentGraph.tsx +26 -6
  118. package/src/subsystem/formatDeclaration.ts +57 -11
  119. package/src/subsystem/model.test.ts +38 -6
  120. package/src/subsystem/model.ts +110 -31
  121. package/src/subsystem/nodes.tsx +103 -27
  122. package/src/subsystem/tokenizeComponent.ts +12 -12
  123. package/src/subsystem/tokenizeFormatted.ts +9 -82
  124. package/src/stories/SubsystemComponentGraph.stories.tsx +0 -1225
  125. /package/src/stories/{dashboard/sample-dashboards → data}/activity-feed-analytics.dashboard.json +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"tokenizeComponent.js","sourceRoot":"","sources":["../../src/subsystem/tokenizeComponent.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,8CAA8C;AAC9C,IAAI,eAAe,GAAyD,IAAI,CAAC;AACjF,IAAI,sBAAsB,GAGd,IAAI,CAAC;AAEjB,KAAK,UAAU,WAAW;IACxB,IAAI,CAAC,eAAe,EAAE;QACpB,eAAe,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;KACjD;IACD,IAAI,CAAC,sBAAsB,EAAE;QAC3B,sBAAsB,GAAG,OAAO,CA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HTML with `<span class="hljs-...">` wrappers. This
6
- * module parses that output into our token format so the renderer stays
7
- * language-agnostic.
3
+ * using Shiki + Pierre themes (same highlighter stack as @pierre/diffs).
8
4
  */
5
+ import type { PierreSyntaxThemeName } from '../pierre/pierreSyntaxTheme';
9
6
  import type { SubsystemDeclToken } from './model';
10
7
  /**
11
8
  * Tokenize a formatted TypeScript string into SubsystemDeclToken[].
12
9
  * The input should already be formatted by Prettier (or be valid TS).
13
10
  */
14
- export declare function tokenizeFormatted(code: string): SubsystemDeclToken[];
11
+ export declare function tokenizeFormatted(code: string, themeName?: PierreSyntaxThemeName): Promise<SubsystemDeclToken[]>;
15
12
  //# sourceMappingURL=tokenizeFormatted.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tokenizeFormatted.d.ts","sourceRoot":"","sources":["../../src/subsystem/tokenizeFormatted.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,kBAAkB,EAA0B,MAAM,SAAS,CAAC;AAsB1E;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,EAAE,CAGpE"}
1
+ {"version":3,"file":"tokenizeFormatted.d.ts","sourceRoot":"","sources":["../../src/subsystem/tokenizeFormatted.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,SAAS,GAAE,qBAAqC,GAC/C,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAE/B"}
@@ -1,84 +1,13 @@
1
1
  /**
2
2
  * Tokenize a formatted TypeScript declaration string into SubsystemDeclToken[]
3
- * using highlight.js.
4
- *
5
- * highlight.js produces HTML with `<span class="hljs-...">` wrappers. This
6
- * module parses that output into our token format so the renderer stays
7
- * language-agnostic.
3
+ * using Shiki + Pierre themes (same highlighter stack as @pierre/diffs).
8
4
  */
9
- import hljs from 'highlight.js/lib/core';
10
- import typescript from 'highlight.js/lib/languages/typescript';
11
- // Register once — safe to call multiple times.
12
- try {
13
- hljs.registerLanguage('typescript', typescript);
14
- }
15
- catch {
16
- // Already registered.
17
- }
18
- // hljs class → our token kind
19
- const CLASS_MAP = {
20
- 'hljs-keyword': 'keyword',
21
- 'hljs-title': 'name',
22
- 'hljs-title.function_': 'name',
23
- 'hljs-params': 'member',
24
- 'hljs-type': 'type',
25
- 'hljs-built_in': 'type',
26
- 'hljs-string': 'string',
27
- 'hljs-number': 'string',
28
- 'hljs-comment': 'punctuation',
29
- };
5
+ import { tokenizeWithPierreSyntax } from '../pierre/syntaxTokens';
30
6
  /**
31
7
  * Tokenize a formatted TypeScript string into SubsystemDeclToken[].
32
8
  * The input should already be formatted by Prettier (or be valid TS).
33
9
  */
34
- export function tokenizeFormatted(code) {
35
- const result = hljs.highlight(code, { language: 'typescript' });
36
- return parseHighlightedHtml(result.value);
37
- }
38
- // ---------------------------------------------------------------------------
39
- // HTML parser — walks the hljs output and extracts tokens
40
- // ---------------------------------------------------------------------------
41
- function unescapeHtml(text) {
42
- return text
43
- .replace(/&quot;/g, '"')
44
- .replace(/&lt;/g, '<')
45
- .replace(/&gt;/g, '>')
46
- .replace(/&amp;/g, '&')
47
- .replace(/&#39;/g, "'");
48
- }
49
- function parseHighlightedHtml(html) {
50
- const tokens = [];
51
- // Regex matches either `<span class="hljs-...">`, `</span>`, or text content.
52
- const re = /<span class="([^"]+)">|<\/span>|[^<]+/g;
53
- const classStack = [];
54
- let match;
55
- while ((match = re.exec(html)) !== null) {
56
- const chunk = match[0];
57
- if (chunk.startsWith('<span')) {
58
- // Opening tag — push class onto stack.
59
- classStack.push(match[1]);
60
- }
61
- else if (chunk === '</span>') {
62
- // Closing tag — pop class.
63
- classStack.pop();
64
- }
65
- else {
66
- // Text content — emit tokens for each line segment.
67
- const currentClass = classStack[classStack.length - 1] ?? '';
68
- const kind = CLASS_MAP[currentClass] ?? 'punctuation';
69
- const text = chunk;
70
- // Split on newlines so each line becomes its own token set.
71
- const lines = text.split('\n');
72
- for (let i = 0; i < lines.length; i++) {
73
- if (i > 0) {
74
- tokens.push({ text: '', kind: 'newline' });
75
- }
76
- if (lines[i]) {
77
- tokens.push({ text: unescapeHtml(lines[i]), kind });
78
- }
79
- }
80
- }
81
- }
82
- return tokens;
10
+ export function tokenizeFormatted(code, themeName = 'pierre-dark') {
11
+ return tokenizeWithPierreSyntax(code, themeName);
83
12
  }
84
13
  //# sourceMappingURL=tokenizeFormatted.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tokenizeFormatted.js","sourceRoot":"","sources":["../../src/subsystem/tokenizeFormatted.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,IAAI,MAAM,uBAAuB,CAAC;AACzC,OAAO,UAAU,MAAM,uCAAuC,CAAC;AAG/D,+CAA+C;AAC/C,IAAI;IACF,IAAI,CAAC,gBAAgB,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;CACjD;AAAC,MAAM;IACN,sBAAsB;CACvB;AAED,8BAA8B;AAC9B,MAAM,SAAS,GAA2C;IACxD,cAAc,EAAE,SAAS;IACzB,YAAY,EAAE,MAAM;IACpB,sBAAsB,EAAE,MAAM;IAC9B,aAAa,EAAE,QAAQ;IACvB,WAAW,EAAE,MAAM;IACnB,eAAe,EAAE,MAAM;IACvB,aAAa,EAAE,QAAQ;IACvB,aAAa,EAAE,QAAQ;IACvB,cAAc,EAAE,aAAa;CAC9B,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,CAAC;IAChE,OAAO,oBAAoB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC5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C,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACrC,IAAI,CAAC,GAAG,CAAC,EAAE;oBACT,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;iBAC5C;gBACD,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE;oBACZ,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;iBACrD;aACF;SACF;KACF;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
1
+ {"version":3,"file":"tokenizeFormatted.js","sourceRoot":"","sources":["../../src/subsystem/tokenizeFormatted.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAIlE;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAC/B,IAAY,EACZ,YAAmC,aAAa;IAEhD,OAAO,wBAAwB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AACnD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@principal-ai/principal-view-react",
3
- "version": "0.16.55",
3
+ "version": "0.16.57",
4
4
  "description": "React components for graph-based principal view framework",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -14,6 +14,7 @@
14
14
  "build-storybook": "storybook build"
15
15
  },
16
16
  "dependencies": {
17
+ "@pierre/theme": "^2.0.0",
17
18
  "@pierre/trees": "1.0.0-beta.6",
18
19
  "@xyflow/react": "^12.11.3",
19
20
  "elkjs": "^0.12.0",
@@ -29,6 +30,7 @@
29
30
  "rehype-sanitize": "^6.0.0",
30
31
  "rehype-slug": "^6.0.0",
31
32
  "remark-gfm": "^4.0.1",
33
+ "shiki": "^4.0.0",
32
34
  "themed-markdown": "^0.1.82",
33
35
  "zustand": "4.5.0"
34
36
  },
@@ -190,6 +190,22 @@ export interface GraphifyExternalDetail {
190
190
  label: string;
191
191
  }
192
192
 
193
+ /**
194
+ * A retained-state node (`kind: 'store'`): state and its contract, no
195
+ * behavior. `kind` is the node's verifiable anchor — a store anchors to a
196
+ * *state location* (module consts, a file or db), not to a declaration.
197
+ * When a class manages the store's access, that is a SEPARATE node
198
+ * (`kind: 'class'`, methods = the access mechanism) joined by
199
+ * `writes`/`reads` — never merged into one hybrid node. This payload
200
+ * renders as state declarations (`declare const …`), never as a class
201
+ * stub.
202
+ */
203
+ export interface GraphifyStoreDetail {
204
+ kind: 'store';
205
+ /** The retained state members (module-level consts or class fields). */
206
+ properties: GraphifyPropertyInfo[];
207
+ }
208
+
193
209
  /** A standalone method selected from its owning class. */
194
210
  export interface GraphifyMethodDetail {
195
211
  kind: 'method';
@@ -215,7 +231,8 @@ export type GraphifyComponentDetail =
215
231
  | GraphifyMethodDetail
216
232
  | GraphifyTypeDetail
217
233
  | GraphifyModuleDetail
218
- | GraphifyExternalDetail;
234
+ | GraphifyExternalDetail
235
+ | GraphifyStoreDetail;
219
236
 
220
237
  /** A raw graphify edge backing a facet claim (verification + provenance). */
221
238
  export interface GraphifyEdgeRef {
@@ -31,6 +31,7 @@ export type {
31
31
  GraphifyTypeDetail,
32
32
  GraphifyModuleDetail,
33
33
  GraphifyExternalDetail,
34
+ GraphifyStoreDetail,
34
35
  GraphifyComponentDetail,
35
36
  GraphifyEdgeRef,
36
37
  } from './consolidated';
@@ -104,11 +104,17 @@ export function inferGraphifyKind(
104
104
  return { kind: 'unknown', evidence };
105
105
  }
106
106
 
107
- /** Strict claimed-vs-inferred check (no class≈function alias). */
107
+ /** Type-family constructs all infer as the coarse 'type' — graph structure
108
+ * (implements/references edges) cannot sub-classify interface vs alias vs
109
+ * enum vs variable; only the source declaration can. */
110
+ const TYPE_FAMILY: ReadonlySet<string> = new Set(['interface', 'type_alias', 'enum']);
111
+
112
+ /** Strict claimed-vs-inferred check, with type-family compatibility. */
108
113
  export function kindsMatch(
109
114
  claimed: string | undefined,
110
115
  inferred: InferredGraphifyKind,
111
116
  ): boolean {
112
117
  if (!claimed || claimed === 'external') return true;
118
+ if (TYPE_FAMILY.has(claimed)) return inferred === 'type';
113
119
  return claimed === inferred;
114
120
  }
package/src/index.ts CHANGED
@@ -281,7 +281,8 @@ export type {
281
281
  ComponentDeclarationProps,
282
282
  } from './subsystem/ComponentDeclaration';
283
283
  export { ComponentDeclaration } from './subsystem/ComponentDeclaration';
284
- export { MECHANISM_COLOR, KIND_COLOR, MECHANISM_STYLE } from './subsystem/model';
284
+ export { MECHANISM_COLOR, MECHANISM_STYLE } from './subsystem/model';
285
+ export { CONSTRUCT_COLOR, constructColorsFromPierreTheme } from './pierre/constructColors';
285
286
  export {
286
287
  purlRepoKey,
287
288
  purlOwnerName,
@@ -302,7 +303,7 @@ export type {
302
303
  SubsystemComponent,
303
304
  SubsystemComponentEdge,
304
305
  SubsystemGraphDocument,
305
- SubsystemComponentKind,
306
+ SubsystemComponentConstruct,
306
307
  SubsystemEdgeMechanism,
307
308
  } from './subsystem/model';
308
309
  export type {
@@ -318,9 +319,10 @@ export {
318
319
  } from './subsystem/declarationRef';
319
320
 
320
321
  // Pierre code views (@pierre/diffs wrappers)
321
- export { PierreFileView, PierreSnippetView, sliceSnippetWindow } from './pierre';
322
+ export { PierreFileView, PierreSnippetView, sliceSnippetWindow, resolvePierreSyntaxThemeName } from './pierre';
322
323
  export type {
323
324
  PierreFileViewProps,
324
325
  PierreSnippetViewProps,
325
326
  SnippetSlice,
327
+ PierreSyntaxThemeName,
326
328
  } from './pierre';
@@ -0,0 +1,52 @@
1
+ import { describe, expect, test } from 'bun:test';
2
+ import { CONSTRUCT_COLOR, constructColorsFromPierreTheme } from './constructColors';
3
+ import type { SubsystemComponentConstruct } from '../subsystem/model';
4
+
5
+ const CONSTRUCTS: SubsystemComponentConstruct[] = [
6
+ 'class',
7
+ 'function',
8
+ 'method',
9
+ 'interface',
10
+ 'type_alias',
11
+ 'enum',
12
+ 'module',
13
+ 'store',
14
+ 'external',
15
+ ];
16
+
17
+ const HEX = /^#[0-9a-f]{6}$/;
18
+
19
+ describe('constructColorsFromPierreTheme', () => {
20
+ test('resolves every construct to a hex in both themes (no fallbacks)', () => {
21
+ for (const themeName of ['pierre-dark', 'pierre-light'] as const) {
22
+ const colors = constructColorsFromPierreTheme(themeName);
23
+ for (const construct of CONSTRUCTS) {
24
+ expect(colors[construct]).toMatch(HEX);
25
+ }
26
+ }
27
+ });
28
+
29
+ test('all seven constructs are distinguishable within a theme', () => {
30
+ for (const themeName of ['pierre-dark', 'pierre-light'] as const) {
31
+ const colors = constructColorsFromPierreTheme(themeName);
32
+ const values = CONSTRUCTS.map((c) => colors[c]);
33
+ expect(new Set(values).size).toBe(CONSTRUCTS.length);
34
+ }
35
+ });
36
+
37
+ test('colliding scope pairs are shaded apart (class/type, function/method)', () => {
38
+ const dark = constructColorsFromPierreTheme('pierre-dark');
39
+ expect(dark.class).not.toBe(dark.type);
40
+ expect(dark.function).not.toBe(dark.method);
41
+ });
42
+
43
+ test('dark and light instantiations differ', () => {
44
+ expect(constructColorsFromPierreTheme('pierre-dark')).not.toEqual(
45
+ constructColorsFromPierreTheme('pierre-light'),
46
+ );
47
+ });
48
+
49
+ test('the static dark instantiation matches the derived table', () => {
50
+ expect(CONSTRUCT_COLOR).toEqual(constructColorsFromPierreTheme('pierre-dark'));
51
+ });
52
+ });
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Construct colors derived from the Pierre syntax themes.
3
+ *
4
+ * Single source of truth for node coloring: the same palette the declaration
5
+ * panel and Pierre file views render with. The themes are static JSON objects
6
+ * (VS Code/Shiki `tokenColors` scope rules), so extraction is a synchronous
7
+ * scope lookup — no Shiki call, no React context. Dark/light (and any future
8
+ * variant) resolves by mode at render time.
9
+ *
10
+ * Syntax themes deliberately reuse one hue across related scopes (class and
11
+ * type share `entity.name.class`); the node taxonomy needs distinguishable
12
+ * colors, so colliding constructs take a shade of the scope color — derived
13
+ * from the theme itself, toward white in dark themes and toward black in
14
+ * light themes.
15
+ */
16
+
17
+ import type { SubsystemComponentConstruct } from '../subsystem/model';
18
+ import type { PierreSyntaxThemeName } from './pierreSyntaxTheme';
19
+ import pierreDark from '@pierre/theme/pierre-dark';
20
+ import pierreLight from '@pierre/theme/pierre-light';
21
+
22
+ interface PierreThemeInput {
23
+ type: 'dark' | 'light';
24
+ colors: Record<string, string>;
25
+ tokenColors: Array<{ scope: string | string[]; settings: { foreground?: string } }>;
26
+ }
27
+
28
+ const THEMES: Record<PierreSyntaxThemeName, PierreThemeInput> = {
29
+ 'pierre-dark': pierreDark as unknown as PierreThemeInput,
30
+ 'pierre-light': pierreLight as unknown as PierreThemeInput,
31
+ };
32
+
33
+ /** First rule whose scope list contains the exact scope. */
34
+ function scopeColor(theme: PierreThemeInput, scope: string): string | undefined {
35
+ for (const rule of theme.tokenColors) {
36
+ const scopes = Array.isArray(rule.scope) ? rule.scope : [rule.scope];
37
+ if (scopes.includes(scope)) return rule.settings.foreground;
38
+ }
39
+ return undefined;
40
+ }
41
+
42
+ function hexToRgb(hex: string): [number, number, number] {
43
+ const h = hex.replace('#', '');
44
+ const full = h.length === 3 ? h.split('').map((c) => c + c).join('') : h;
45
+ const n = parseInt(full.slice(0, 6), 16);
46
+ return [(n >> 16) & 255, (n >> 8) & 255, n & 255];
47
+ }
48
+
49
+ function rgbToHex([r, g, b]: [number, number, number]): string {
50
+ const to = (v: number) => Math.max(0, Math.min(255, Math.round(v))).toString(16).padStart(2, '0');
51
+ return `#${to(r)}${to(g)}${to(b)}`;
52
+ }
53
+
54
+ /** Linear blend of two hex colors; amount 0 = base, 1 = other. */
55
+ function mix(hex: string, other: string, amount: number): string {
56
+ const base = hexToRgb(hex);
57
+ const target = hexToRgb(other);
58
+ return rgbToHex([
59
+ base[0] + (target[0] - base[0]) * amount,
60
+ base[1] + (target[1] - base[1]) * amount,
61
+ base[2] + (target[2] - base[2]) * amount,
62
+ ]);
63
+ }
64
+
65
+ export function constructColorsFromPierreTheme(
66
+ themeName: PierreSyntaxThemeName,
67
+ ): Record<SubsystemComponentConstruct, string> {
68
+ const theme = THEMES[themeName];
69
+ // A scope the theme doesn't declare resolves to the theme's own foreground —
70
+ // still all-Pierre, never a hand-picked value.
71
+ const editorFg = theme.colors['editor.foreground'] ?? '#fafafa';
72
+ const pick = (scope: string) => scopeColor(theme, scope) ?? editorFg;
73
+ const towardBackground = theme.type === 'dark' ? lighten : darken;
74
+
75
+ const classColor = pick('entity.name.class');
76
+ const functionColor = pick('entity.name.function');
77
+ const typeColor = pick('support.type');
78
+ const moduleColor = pick('entity.name.namespace');
79
+
80
+ return {
81
+ class: classColor,
82
+ // interface/type are the type-name scope, shaded to separate them from
83
+ // class (whose declaration name shares the same hue in syntax themes)
84
+ interface: towardBackground(typeColor, 0.14),
85
+ type_alias: towardBackground(typeColor, 0.28),
86
+ function: functionColor,
87
+ method: towardBackground(functionColor, 0.14),
88
+ // enum members are constants — the generic constant hue
89
+ enum: pick('constant'),
90
+ // module and store share the constant hue — the module holds the store,
91
+ // and the store IS the retained value, so the store keeps the pure
92
+ // `variable.other.constant` color and the module takes the shade
93
+ module: towardBackground(moduleColor, 0.18),
94
+ store: pick('variable.other.constant'),
95
+ external: pick('comment'),
96
+ };
97
+ }
98
+
99
+ function lighten(hex: string, amount: number): string {
100
+ return mix(hex, '#ffffff', amount);
101
+ }
102
+
103
+ function darken(hex: string, amount: number): string {
104
+ return mix(hex, '#000000', amount);
105
+ }
106
+
107
+ /**
108
+ * The dark-theme instantiation, for consumers without a mode context (the
109
+ * bun-side excalidraw exporter). React components derive per mode instead.
110
+ */
111
+ export const CONSTRUCT_COLOR: Record<SubsystemComponentConstruct, string> =
112
+ constructColorsFromPierreTheme('pierre-dark');
@@ -4,3 +4,8 @@ export { PierreSnippetView } from './PierreSnippetView';
4
4
  export type { PierreSnippetViewProps } from './PierreSnippetView';
5
5
  export { sliceSnippetWindow } from './sliceSnippet';
6
6
  export type { SnippetSlice } from './sliceSnippet';
7
+ export {
8
+ PIERRE_DEFAULT_SYNTAX_THEMES,
9
+ resolvePierreSyntaxThemeName,
10
+ } from './pierreSyntaxTheme';
11
+ export type { PierreSyntaxThemeName } from './pierreSyntaxTheme';
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Pierre syntax theme names — aligned with @pierre/diffs DEFAULT_THEMES.
3
+ */
4
+
5
+ export type PierreSyntaxThemeName = 'pierre-dark' | 'pierre-light';
6
+
7
+ export const PIERRE_DEFAULT_SYNTAX_THEMES = {
8
+ dark: 'pierre-dark',
9
+ light: 'pierre-light',
10
+ } as const satisfies Record<'dark' | 'light', PierreSyntaxThemeName>;
11
+
12
+ /** Pick pierre-dark / pierre-light to match Pierre file views and industry-theme mode. */
13
+ export function resolvePierreSyntaxThemeName(mode?: string): PierreSyntaxThemeName {
14
+ if (mode === 'light') return PIERRE_DEFAULT_SYNTAX_THEMES.light;
15
+ if (mode === 'dark') return PIERRE_DEFAULT_SYNTAX_THEMES.dark;
16
+ if (
17
+ typeof window !== 'undefined' &&
18
+ window.matchMedia('(prefers-color-scheme: light)').matches
19
+ ) {
20
+ return PIERRE_DEFAULT_SYNTAX_THEMES.light;
21
+ }
22
+ return PIERRE_DEFAULT_SYNTAX_THEMES.dark;
23
+ }
@@ -0,0 +1,35 @@
1
+ import { describe, expect, test } from 'bun:test';
2
+ import { tokenizeWithPierreSyntax } from './syntaxTokens';
3
+
4
+ describe('tokenizeWithPierreSyntax', () => {
5
+ test('assigns Pierre dark keyword and type colors', async () => {
6
+ const tokens = await tokenizeWithPierreSyntax(
7
+ 'export class Foo extends Bar {}',
8
+ 'pierre-dark',
9
+ );
10
+ const joined = tokens.filter((t) => t.kind !== 'newline').map((t) => t.text).join('');
11
+ expect(joined).toBe('export class Foo extends Bar {}');
12
+
13
+ const exportTok = tokens.find((t) => t.text === 'export');
14
+ const classTok = tokens.find((t) => t.text === 'class');
15
+ const fooTok = tokens.find((t) => t.text === 'Foo');
16
+ const barTok = tokens.find((t) => t.text === 'Bar');
17
+
18
+ expect(exportTok?.color).toBe('#ff678d');
19
+ expect(classTok?.color).toBe('#d568ea');
20
+ expect(fooTok?.color).toBe('#d568ea');
21
+ expect(barTok?.color).toBe('#d568ea');
22
+ });
23
+
24
+ test('light theme resolves different palette than dark', async () => {
25
+ const [dark, light] = await Promise.all([
26
+ tokenizeWithPierreSyntax('const x = 1', 'pierre-dark'),
27
+ tokenizeWithPierreSyntax('const x = 1', 'pierre-light'),
28
+ ]);
29
+ const darkConst = dark.find((t) => t.text === 'const');
30
+ const lightConst = light.find((t) => t.text === 'const');
31
+ expect(darkConst?.color).toBeTruthy();
32
+ expect(lightConst?.color).toBeTruthy();
33
+ expect(darkConst?.color).not.toBe(lightConst?.color);
34
+ });
35
+ });
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Tokenize TypeScript with Shiki + Pierre themes — same stack as @pierre/diffs.
3
+ */
4
+
5
+ import { createHighlighter, type Highlighter, type ThemeInput } from 'shiki';
6
+ import pierreDark from '@pierre/theme/pierre-dark';
7
+ import pierreLight from '@pierre/theme/pierre-light';
8
+ import type { SubsystemDeclToken } from '../subsystem/model';
9
+ import type { PierreSyntaxThemeName } from './pierreSyntaxTheme';
10
+
11
+ let highlighterPromise: Promise<Highlighter> | null = null;
12
+
13
+ async function getPierreHighlighter(): Promise<Highlighter> {
14
+ if (!highlighterPromise) {
15
+ highlighterPromise = createHighlighter({
16
+ themes: [
17
+ pierreDark as unknown as ThemeInput,
18
+ pierreLight as unknown as ThemeInput,
19
+ ],
20
+ langs: ['typescript'],
21
+ });
22
+ }
23
+ return highlighterPromise;
24
+ }
25
+
26
+ function normalizeColor(color?: string): string | undefined {
27
+ return color?.toLowerCase();
28
+ }
29
+
30
+ /**
31
+ * Tokenize formatted TypeScript using Pierre's Shiki themes.
32
+ * Each token carries the resolved foreground color Pierre would render.
33
+ */
34
+ export async function tokenizeWithPierreSyntax(
35
+ code: string,
36
+ themeName: PierreSyntaxThemeName,
37
+ ): Promise<SubsystemDeclToken[]> {
38
+ const highlighter = await getPierreHighlighter();
39
+ const { tokens } = highlighter.codeToTokens(code, {
40
+ lang: 'typescript',
41
+ theme: themeName,
42
+ });
43
+
44
+ const result: SubsystemDeclToken[] = [];
45
+ for (let lineIndex = 0; lineIndex < tokens.length; lineIndex++) {
46
+ const line = tokens[lineIndex];
47
+ for (const token of line) {
48
+ if (!token.content) continue;
49
+ result.push({
50
+ text: token.content,
51
+ kind: 'punctuation',
52
+ color: normalizeColor(token.color),
53
+ });
54
+ }
55
+ if (lineIndex < tokens.length - 1) {
56
+ result.push({ text: '', kind: 'newline' });
57
+ }
58
+ }
59
+ return result;
60
+ }
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { Meta, StoryObj } from '@storybook/react';
3
- import { GraphRenderer } from '../components/GraphRenderer';
3
+ import { GraphRenderer } from '../../components/GraphRenderer';
4
4
  import type { ExtendedCanvas } from '@principal-ai/principal-view-core';
5
5
  import { ThemeProvider, defaultEditorTheme } from '@principal-ade/industry-theme';
6
6
 
@@ -1,6 +1,6 @@
1
1
  import React, { useState } from 'react';
2
2
  import type { Meta, StoryObj } from '@storybook/react';
3
- import { GraphRenderer } from '../components/GraphRenderer';
3
+ import { GraphRenderer } from '../../components/GraphRenderer';
4
4
  import type { ExtendedCanvas, DerivedEdge } from '@principal-ai/principal-view-core';
5
5
  import { ThemeProvider, defaultEditorTheme } from '@principal-ade/industry-theme';
6
6
 
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { Meta, StoryObj } from '@storybook/react';
3
- import { GraphRenderer } from '../components/GraphRenderer';
3
+ import { GraphRenderer } from '../../components/GraphRenderer';
4
4
  import type { ExtendedCanvas } from '@principal-ai/principal-view-core';
5
5
  import { ThemeProvider, defaultEditorTheme } from '@principal-ade/industry-theme';
6
6
 
@@ -1,6 +1,6 @@
1
1
  import React, { useState, useEffect } from 'react';
2
2
  import type { Meta, StoryObj } from '@storybook/react';
3
- import { GraphRenderer } from '../components/GraphRenderer';
3
+ import { GraphRenderer } from '../../components/GraphRenderer';
4
4
  import type { ExtendedCanvas, GraphEvent, ComponentLibrary } from '@principal-ai/principal-view-core';
5
5
  import { ThemeProvider, defaultEditorTheme } from '@principal-ade/industry-theme';
6
6
 
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { Meta, StoryObj } from '@storybook/react';
3
- import { GraphRenderer } from '../components/GraphRenderer';
3
+ import { GraphRenderer } from '../../components/GraphRenderer';
4
4
  import type { ExtendedCanvas } from '@principal-ai/principal-view-core';
5
5
  import { ThemeProvider, defaultEditorTheme } from '@principal-ade/industry-theme';
6
6
 
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
2
  import type { Meta, StoryObj } from '@storybook/react';
3
- import { GraphRenderer } from '../components/GraphRenderer';
3
+ import { GraphRenderer } from '../../components/GraphRenderer';
4
4
  import type { ExtendedCanvas, ExtendedCanvasNode } from '@principal-ai/principal-view-core';
5
5
  import { ThemeProvider, defaultEditorTheme } from '@principal-ade/industry-theme';
6
6
 
7
7
  const meta = {
8
- title: 'Testing/Node Dimensions & Text Readability',
8
+ title: 'Audit/NodeDimensionsTesting',
9
9
  component: GraphRenderer,
10
10
  parameters: {
11
11
  layout: 'fullscreen',
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { Meta, StoryObj } from '@storybook/react';
3
- import { GraphRenderer } from '../components/GraphRenderer';
3
+ import { GraphRenderer } from '../../components/GraphRenderer';
4
4
  import type { ExtendedCanvas } from '@principal-ai/principal-view-core';
5
5
  import { ThemeProvider, defaultEditorTheme } from '@principal-ade/industry-theme';
6
6
 
@@ -1,12 +1,12 @@
1
1
  import React from 'react';
2
2
  import type { Meta, StoryObj } from '@storybook/react';
3
- import { GraphRenderer } from '../components/GraphRenderer';
3
+ import { GraphRenderer } from '../../components/GraphRenderer';
4
4
  import type { ExtendedCanvas } from '@principal-ai/principal-view-core';
5
5
  import { ThemeProvider, defaultEditorTheme } from '@principal-ade/industry-theme';
6
6
  import type { Theme } from '@principal-ade/industry-theme';
7
7
 
8
8
  const meta = {
9
- title: 'Testing/Node Font Size & Dimensions',
9
+ title: 'Audit/NodeFontSizeTesting',
10
10
  component: GraphRenderer,
11
11
  parameters: {
12
12
  layout: 'fullscreen',
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { Meta, StoryObj } from '@storybook/react';
3
- import { GraphRenderer } from '../components/GraphRenderer';
3
+ import { GraphRenderer } from '../../components/GraphRenderer';
4
4
  import type { ExtendedCanvas } from '@principal-ai/principal-view-core';
5
5
  import { ThemeProvider, defaultEditorTheme } from '@principal-ade/industry-theme';
6
6