@principal-ai/principal-view-react 0.16.35 → 0.16.36

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 (36) hide show
  1. package/dist/graphify/consolidated.d.ts +17 -3
  2. package/dist/graphify/consolidated.d.ts.map +1 -1
  3. package/dist/graphify/index.d.ts +2 -0
  4. package/dist/graphify/index.d.ts.map +1 -1
  5. package/dist/graphify/index.js +1 -1
  6. package/dist/graphify/index.js.map +1 -1
  7. package/dist/graphify/resolve.d.ts +48 -0
  8. package/dist/graphify/resolve.d.ts.map +1 -0
  9. package/dist/graphify/resolve.js +83 -0
  10. package/dist/graphify/resolve.js.map +1 -0
  11. package/dist/index.d.ts +3 -0
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +2 -0
  14. package/dist/index.js.map +1 -1
  15. package/dist/subsystem/ComponentDetail.d.ts +16 -7
  16. package/dist/subsystem/ComponentDetail.d.ts.map +1 -1
  17. package/dist/subsystem/ComponentDetail.js +124 -82
  18. package/dist/subsystem/ComponentDetail.js.map +1 -1
  19. package/dist/subsystem/SubsystemComponentGraph.d.ts.map +1 -1
  20. package/dist/subsystem/SubsystemComponentGraph.js +31 -3
  21. package/dist/subsystem/SubsystemComponentGraph.js.map +1 -1
  22. package/dist/subsystem/model.d.ts +14 -0
  23. package/dist/subsystem/model.d.ts.map +1 -1
  24. package/dist/subsystem/model.js +26 -1
  25. package/dist/subsystem/model.js.map +1 -1
  26. package/package.json +1 -1
  27. package/src/graphify/consolidated.ts +17 -3
  28. package/src/graphify/index.ts +9 -0
  29. package/src/graphify/resolve.test.ts +89 -0
  30. package/src/graphify/resolve.ts +115 -0
  31. package/src/index.ts +10 -0
  32. package/src/stories/SubsystemComponentGraph.stories.tsx +331 -11
  33. package/src/subsystem/ComponentDetail.tsx +355 -156
  34. package/src/subsystem/SubsystemComponentGraph.tsx +53 -3
  35. package/src/subsystem/model.test.ts +11 -0
  36. package/src/subsystem/model.ts +25 -1
@@ -119,6 +119,30 @@ export function deriveNameFromSymbol(
119
119
  return existingName ?? 'untitled';
120
120
  }
121
121
 
122
+ /**
123
+ * Human-readable purl identity — drops the `pkg:<type>/` scheme wrapper and
124
+ * trailing version, keeping the package / owner-repo identity:
125
+ *
126
+ * pkg:npm/@principal-ai/core → `@principal-ai/core`
127
+ * pkg:github/principal-ai/my-repo → `principal-ai/my-repo`
128
+ * pkg:npm/left-pad@1.3.0 → `left-pad`
129
+ * pkg:generic/local--Users-me-my-app → `Users-me-my-app (local)`
130
+ *
131
+ * Local purls encode the absolute path with dashes for slashes, which is not
132
+ * losslessly decodable — shown as-is with a `(local)` marker.
133
+ */
134
+ export function formatPurl(purl: string): string {
135
+ const match = /^pkg:[^/#?]+\/(.+)$/.exec(purl);
136
+ if (!match) return purl;
137
+ let identity = match[1].split(/[?#]/)[0];
138
+ const at = identity.indexOf('@');
139
+ if (at > 0) identity = identity.slice(0, at); // trailing @version
140
+ if (identity.startsWith('local--')) {
141
+ return `${identity.slice('local--'.length)} (local)`;
142
+ }
143
+ return identity;
144
+ }
145
+
122
146
  export interface SubsystemGraphDocument {
123
147
  components: SubsystemComponent[];
124
148
  edges: SubsystemComponentEdge[];
@@ -174,7 +198,7 @@ export const MECHANISM_COLOR: Record<SubsystemEdgeMechanism, string> = {
174
198
  'registers-into': '#ff6b35', // orange
175
199
  };
176
200
 
177
- const MECHANISM_STYLE: Record<SubsystemEdgeMechanism, 'solid' | 'dashed' | 'dotted'> = {
201
+ export const MECHANISM_STYLE: Record<SubsystemEdgeMechanism, 'solid' | 'dashed' | 'dotted'> = {
178
202
  imports: 'solid',
179
203
  imports_from: 'solid',
180
204
  re_exports: 'solid',