@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.
- package/dist/graphify/consolidated.d.ts +17 -3
- package/dist/graphify/consolidated.d.ts.map +1 -1
- package/dist/graphify/index.d.ts +2 -0
- package/dist/graphify/index.d.ts.map +1 -1
- package/dist/graphify/index.js +1 -1
- package/dist/graphify/index.js.map +1 -1
- package/dist/graphify/resolve.d.ts +48 -0
- package/dist/graphify/resolve.d.ts.map +1 -0
- package/dist/graphify/resolve.js +83 -0
- package/dist/graphify/resolve.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/subsystem/ComponentDetail.d.ts +16 -7
- package/dist/subsystem/ComponentDetail.d.ts.map +1 -1
- package/dist/subsystem/ComponentDetail.js +124 -82
- package/dist/subsystem/ComponentDetail.js.map +1 -1
- package/dist/subsystem/SubsystemComponentGraph.d.ts.map +1 -1
- package/dist/subsystem/SubsystemComponentGraph.js +31 -3
- package/dist/subsystem/SubsystemComponentGraph.js.map +1 -1
- package/dist/subsystem/model.d.ts +14 -0
- package/dist/subsystem/model.d.ts.map +1 -1
- package/dist/subsystem/model.js +26 -1
- package/dist/subsystem/model.js.map +1 -1
- package/package.json +1 -1
- package/src/graphify/consolidated.ts +17 -3
- package/src/graphify/index.ts +9 -0
- package/src/graphify/resolve.test.ts +89 -0
- package/src/graphify/resolve.ts +115 -0
- package/src/index.ts +10 -0
- package/src/stories/SubsystemComponentGraph.stories.tsx +331 -11
- package/src/subsystem/ComponentDetail.tsx +355 -156
- package/src/subsystem/SubsystemComponentGraph.tsx +53 -3
- package/src/subsystem/model.test.ts +11 -0
- package/src/subsystem/model.ts +25 -1
package/src/subsystem/model.ts
CHANGED
|
@@ -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',
|