@principal-ai/subsystems-react 0.56.32 → 0.56.34
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/anchor.d.ts +1 -44
- package/dist/graphify/anchor.d.ts.map +1 -1
- package/dist/graphify/anchor.js +1 -172
- package/dist/graphify/anchor.js.map +1 -1
- package/dist/graphify/consolidated.d.ts +1 -258
- package/dist/graphify/consolidated.d.ts.map +1 -1
- package/dist/graphify/consolidated.js +1 -10
- package/dist/graphify/consolidated.js.map +1 -1
- package/dist/graphify/construct.d.ts +1 -40
- package/dist/graphify/construct.d.ts.map +1 -1
- package/dist/graphify/construct.js +1 -99
- package/dist/graphify/construct.js.map +1 -1
- package/dist/graphify/ids.d.ts +1 -18
- package/dist/graphify/ids.d.ts.map +1 -1
- package/dist/graphify/ids.js +1 -45
- package/dist/graphify/ids.js.map +1 -1
- package/dist/graphify/resolve.d.ts +1 -47
- package/dist/graphify/resolve.d.ts.map +1 -1
- package/dist/graphify/resolve.js +1 -82
- package/dist/graphify/resolve.js.map +1 -1
- package/dist/graphify/signature.d.ts +1 -86
- package/dist/graphify/signature.d.ts.map +1 -1
- package/dist/graphify/signature.js +1 -275
- package/dist/graphify/signature.js.map +1 -1
- package/dist/graphify/types.d.ts +1 -140
- package/dist/graphify/types.d.ts.map +1 -1
- package/dist/graphify/types.js +1 -7
- package/dist/graphify/types.js.map +1 -1
- package/dist/subsystem/IssueList.d.ts.map +1 -1
- package/dist/subsystem/IssueList.js +4 -1
- package/dist/subsystem/IssueList.js.map +1 -1
- package/dist/subsystem/SubsystemComponentGraph.d.ts +3 -1
- package/dist/subsystem/SubsystemComponentGraph.d.ts.map +1 -1
- package/dist/subsystem/SubsystemComponentGraph.js +16 -2
- package/dist/subsystem/SubsystemComponentGraph.js.map +1 -1
- package/dist/subsystem/containerCard.d.ts +6 -0
- package/dist/subsystem/containerCard.d.ts.map +1 -1
- package/dist/subsystem/containerCard.js +16 -1
- package/dist/subsystem/containerCard.js.map +1 -1
- package/package.json +3 -3
- package/src/graphify/anchor.ts +1 -206
- package/src/graphify/consolidated.ts +1 -298
- package/src/graphify/construct.ts +1 -153
- package/src/graphify/ids.ts +1 -48
- package/src/graphify/resolve.ts +1 -115
- package/src/graphify/signature.ts +1 -354
- package/src/graphify/types.ts +1 -164
- package/src/subsystem/IssueList.category.test.ts +11 -0
- package/src/subsystem/IssueList.tsx +4 -1
- package/src/subsystem/SubsystemComponentGraph.tsx +20 -3
- package/src/subsystem/containerCard.test.ts +30 -0
- package/src/subsystem/containerCard.tsx +34 -1
package/src/graphify/types.ts
CHANGED
|
@@ -1,164 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Graphify graph.json schema types.
|
|
3
|
-
*
|
|
4
|
-
* Mirrors the graphify data model (graphify/validate.py, graphify/export.py)
|
|
5
|
-
* so graphify output can be consumed by this library in a type-compatible way.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/** Any JSON-serializable value carried in node/edge metadata. */
|
|
9
|
-
export type JsonValue = string | number | boolean | null | JsonValue[] | { [key: string]: JsonValue };
|
|
10
|
-
|
|
11
|
-
/** Node classification (graphify/validate.py VALID_FILE_TYPES). */
|
|
12
|
-
export type GraphifyFileType = 'code' | 'document' | 'paper' | 'image' | 'rationale' | 'concept';
|
|
13
|
-
|
|
14
|
-
/** Edge provenance tag (graphify/validate.py VALID_CONFIDENCES). */
|
|
15
|
-
export type GraphifyConfidence = 'EXTRACTED' | 'INFERRED' | 'AMBIGUOUS';
|
|
16
|
-
|
|
17
|
-
/** Optional semantic kind carried on nodes (e.g. `module`, `namespace`). */
|
|
18
|
-
export type GraphifyNodeType = 'module' | 'namespace' | string;
|
|
19
|
-
|
|
20
|
-
/** Canonical relation verbs emitted by graphify extractors and resolvers. */
|
|
21
|
-
export type GraphifyRelation =
|
|
22
|
-
| 'calls'
|
|
23
|
-
| 'imports'
|
|
24
|
-
| 'imports_from'
|
|
25
|
-
| 're_exports'
|
|
26
|
-
| 'references'
|
|
27
|
-
| 'inherits'
|
|
28
|
-
| 'implements'
|
|
29
|
-
| 'mixes_in'
|
|
30
|
-
| 'uses'
|
|
31
|
-
| 'contains'
|
|
32
|
-
| 'defines'
|
|
33
|
-
| 'method'
|
|
34
|
-
| 'decorator'
|
|
35
|
-
| 'rationale_for'
|
|
36
|
-
| 'semantically_similar_to'
|
|
37
|
-
| string;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* A graphify node.
|
|
41
|
-
*
|
|
42
|
-
* Required fields are enforced by graphify/validate.py:
|
|
43
|
-
* `id`, `label`, `file_type`, `source_file`. The rest are populated by the
|
|
44
|
-
* extractors (`source_location`, optional `type`/`metadata`) and by the build
|
|
45
|
-
* writer (`community`, `community_name`, `norm_label`).
|
|
46
|
-
*/
|
|
47
|
-
export interface GraphifyNode {
|
|
48
|
-
/** Stable identifier: repo-relative path + symbol names (make_id slug). */
|
|
49
|
-
id: string;
|
|
50
|
-
/** Human-readable name. */
|
|
51
|
-
label: string;
|
|
52
|
-
/** Classification used as the primary node kind. */
|
|
53
|
-
file_type: GraphifyFileType;
|
|
54
|
-
/** Repo-relative path of the source file this node came from. */
|
|
55
|
-
source_file: string;
|
|
56
|
-
/** `L<line>` location, or `''` for sourceless stub nodes. */
|
|
57
|
-
source_location?: string | null;
|
|
58
|
-
/** Optional semantic kind (e.g. `module`, `namespace`). */
|
|
59
|
-
type?: GraphifyNodeType;
|
|
60
|
-
/** Node state / extra node definitions. */
|
|
61
|
-
state?: string;
|
|
62
|
-
/** Arbitrary per-extractor metadata (e.g. `{ kind: "csharp_namespace" }`). */
|
|
63
|
-
metadata?: Record<string, JsonValue>;
|
|
64
|
-
/** Leiden community id, stamped at build time. */
|
|
65
|
-
community?: number | null;
|
|
66
|
-
/** Human-readable community label, stamped at build time. */
|
|
67
|
-
community_name?: string;
|
|
68
|
-
/** Diacritic-stripped lowercased label, stamped at build time. */
|
|
69
|
-
norm_label?: string;
|
|
70
|
-
/** Extra fields tolerated for forward compatibility. */
|
|
71
|
-
[key: string]: unknown;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* A graphify edge.
|
|
76
|
-
*
|
|
77
|
-
* Required fields: `source`, `target`, `relation`, `confidence`, `source_file`.
|
|
78
|
-
* `context` is populated for `references` edges (e.g. `type`, `return_type`,
|
|
79
|
-
* `field`, `generic_arg`).
|
|
80
|
-
*/
|
|
81
|
-
export interface GraphifyEdge {
|
|
82
|
-
/** Source node id. */
|
|
83
|
-
source: string;
|
|
84
|
-
/** Target node id. */
|
|
85
|
-
target: string;
|
|
86
|
-
/** Canonical relation verb. */
|
|
87
|
-
relation: GraphifyRelation;
|
|
88
|
-
/** Provenance: read directly from source vs. resolved by graphify. */
|
|
89
|
-
confidence: GraphifyConfidence;
|
|
90
|
-
/** Float 0.0-1.0; 1.0 for EXTRACTED, discrete rubric for INFERRED. */
|
|
91
|
-
confidence_score?: number;
|
|
92
|
-
/** Repo-relative path where the relationship was found. */
|
|
93
|
-
source_file: string;
|
|
94
|
-
/** `L<line>` location of the relationship. */
|
|
95
|
-
source_location?: string | null;
|
|
96
|
-
/** Edge weight. */
|
|
97
|
-
weight?: number;
|
|
98
|
-
/** Reference context for `references` edges. */
|
|
99
|
-
context?: string;
|
|
100
|
-
/** Arbitrary per-extractor metadata. */
|
|
101
|
-
metadata?: Record<string, JsonValue>;
|
|
102
|
-
/** Extra fields tolerated for forward compatibility. */
|
|
103
|
-
[key: string]: unknown;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* A graphify hyperedge — a group relationship connecting 3+ nodes.
|
|
108
|
-
*
|
|
109
|
-
* Member list is canonical on `nodes` (aliases `members`/`node_ids` are folded
|
|
110
|
-
* by graphify/export.py build normalization).
|
|
111
|
-
*/
|
|
112
|
-
export interface GraphifyHyperedge {
|
|
113
|
-
/** Stable identifier. */
|
|
114
|
-
id: string;
|
|
115
|
-
/** Human-readable label. */
|
|
116
|
-
label?: string;
|
|
117
|
-
/** Member node ids (canonical key). */
|
|
118
|
-
nodes: string[];
|
|
119
|
-
/** Group relation verb (e.g. `participate_in`, `implement`, `form`). */
|
|
120
|
-
relation?: GraphifyRelation;
|
|
121
|
-
/** Provenance tag. */
|
|
122
|
-
confidence?: GraphifyConfidence;
|
|
123
|
-
/** Float 0.0-1.0. */
|
|
124
|
-
confidence_score?: number;
|
|
125
|
-
/** Repo-relative path where the relationship was found. */
|
|
126
|
-
source_file?: string;
|
|
127
|
-
/** Extra fields tolerated for forward compatibility. */
|
|
128
|
-
[key: string]: unknown;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/** Graph-level metadata stored on the graph (`graph` key). */
|
|
132
|
-
export interface GraphifyGraphMetadata {
|
|
133
|
-
directed?: boolean;
|
|
134
|
-
multigraph?: boolean;
|
|
135
|
-
/** Edges may be serialized under `links` (NetworkX node-link) or `edges`. */
|
|
136
|
-
hyperedges?: GraphifyHyperedge[];
|
|
137
|
-
[key: string]: unknown;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* The full graph.json document.
|
|
142
|
-
*
|
|
143
|
-
* graphify writes NetworkX node-link format: nodes under `nodes`, edges under
|
|
144
|
-
* `links`. Older/legacy payloads may use `edges` instead of `links`.
|
|
145
|
-
*/
|
|
146
|
-
export interface GraphifyGraph {
|
|
147
|
-
/** Graph nodes. */
|
|
148
|
-
nodes: GraphifyNode[];
|
|
149
|
-
/** Graph edges (NetworkX node-link key). */
|
|
150
|
-
links?: GraphifyEdge[];
|
|
151
|
-
/** Legacy alias for `links`. */
|
|
152
|
-
edges?: GraphifyEdge[];
|
|
153
|
-
/** Group relationships connecting 3+ nodes. */
|
|
154
|
-
hyperedges?: GraphifyHyperedge[];
|
|
155
|
-
/** Graph-level metadata (directed, multigraph, hyperedges). */
|
|
156
|
-
graph?: GraphifyGraphMetadata;
|
|
157
|
-
/** Top-level directed flag (NetworkX). */
|
|
158
|
-
directed?: boolean;
|
|
159
|
-
/** Top-level multigraph flag (NetworkX). */
|
|
160
|
-
multigraph?: boolean;
|
|
161
|
-
/** Git HEAD the graph was built against, when available. */
|
|
162
|
-
built_at_commit?: string;
|
|
163
|
-
[key: string]: unknown;
|
|
164
|
-
}
|
|
1
|
+
export * from '@principal-ai/subsystems-core/graphify/types';
|
|
@@ -37,3 +37,14 @@ describe('issueCategory — C4 process kinds', () => {
|
|
|
37
37
|
);
|
|
38
38
|
});
|
|
39
39
|
});
|
|
40
|
+
|
|
41
|
+
describe('issueCategory — unconnected components', () => {
|
|
42
|
+
test('files unconnected components under Trail', () => {
|
|
43
|
+
expect(
|
|
44
|
+
issueCategory({ id: 'x', severity: 'info', kind: 'component_unconnected', message: '' }),
|
|
45
|
+
).toBe('trail');
|
|
46
|
+
expect(
|
|
47
|
+
issueKindLabel({ id: 'x', severity: 'info', kind: 'component_unconnected', message: '' }),
|
|
48
|
+
).toBe('Component has no trail edges');
|
|
49
|
+
});
|
|
50
|
+
});
|
|
@@ -99,6 +99,7 @@ export const SUBSYSTEM_ISSUE_CATEGORY_LABEL: Record<
|
|
|
99
99
|
|
|
100
100
|
/** Default `kind` → layer. Module containment is static; process nest is dynamic. */
|
|
101
101
|
const KIND_CATEGORY: Record<string, SubsystemIssueCategory> = {
|
|
102
|
+
component_unconnected: 'trail',
|
|
102
103
|
missing_file: 'construct',
|
|
103
104
|
symbol_ambiguous: 'construct',
|
|
104
105
|
symbol_unmatched: 'construct',
|
|
@@ -279,6 +280,7 @@ export function humanizeIssueKind(kind: string): string {
|
|
|
279
280
|
* scopes them. Explicit `issue.kindLabel` wins.
|
|
280
281
|
*/
|
|
281
282
|
const KIND_LABEL: Record<string, string> = {
|
|
283
|
+
component_unconnected: 'Component has no trail edges',
|
|
282
284
|
missing_file: 'Construct declaration file missing',
|
|
283
285
|
symbol_ambiguous: 'Multiple construct symbol matches',
|
|
284
286
|
symbol_unmatched: 'Construct symbol missing',
|
|
@@ -345,7 +347,8 @@ const KIND_ORDER: Record<string, number> = {
|
|
|
345
347
|
boundary_process_unbacked: 33,
|
|
346
348
|
boundary_process_proposed: 34,
|
|
347
349
|
boundary_process_rejected: 35,
|
|
348
|
-
// Trail — mechanical issues
|
|
350
|
+
// Trail — graph-level completeness, then mechanical issues and step verification
|
|
351
|
+
component_unconnected: 39,
|
|
349
352
|
trail: 40,
|
|
350
353
|
step_span_unconfirmed: 41,
|
|
351
354
|
step_span_stale: 42,
|
|
@@ -630,7 +630,9 @@ export interface SubsystemComponentGraphProps {
|
|
|
630
630
|
* with its members folded away and their lines rolled up onto it, the way a
|
|
631
631
|
* C4 container view reads. The user opens frames from the card, by
|
|
632
632
|
* double-click, or from the Containers list; a `persistKey` remembers the
|
|
633
|
-
* result. Default true
|
|
633
|
+
* result. Default true, except a model with a single container frame starts
|
|
634
|
+
* open (there is nothing to compare collapsed cards against); pass `false`
|
|
635
|
+
* to start with every frame laid out, `true` to force even a lone frame shut.
|
|
634
636
|
*/
|
|
635
637
|
defaultFramesCollapsed?: boolean;
|
|
636
638
|
}
|
|
@@ -747,7 +749,7 @@ interface InnerProps extends SubsystemComponentGraphProps {
|
|
|
747
749
|
onSidebarTrailChange: (trailId: string | null) => void;
|
|
748
750
|
}
|
|
749
751
|
|
|
750
|
-
function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirection: layoutDirectionProp, defaultLayoutDirection = 'horizontal', onLayoutDirectionChange, hideLayoutToggle = false, refocusOnLayoutFlip = true, initialTrailId, onTrailSelect, onTrailStepHover, onReorderTrails, stepEmphasis, onRemoveStepEmphasis, onSelect, onEdgeSelect, measured: _measured, maxNodeWidth, showEdgeLabels, showSingletonFrames = true, moduleNesting, edgeView, hideSidebar, trailStepMode = 'focus', autoPlayTrails = false, trailAutoPlayIntervalMs = TRAIL_PLAY_PAUSE_MS, onAutoPlayStep, zoomOnTrailFocus = true, trailFocusDurationMs = 300, graphTitle, showTrailTitle = false, description, notes, canvasOverlay, interactive = true, canvasBackground = 'theme', onLayoutReady, onNodeRects, sidebarExtra, sidebarAfterDescription, issues, showIssues, filesActive, sidebarScope, onSidebarTrailChange, focusIssueCategory, laneStatus, onSelectIssue, onApplyIssueFix, onHoverIssue, renderFileViewer, renderTrailViewer, onFileSelect, componentVerification, onInspectSymbol, boundaryColors, codeProcessKeys, regionDetails, defaultFramesCollapsed
|
|
752
|
+
function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirection: layoutDirectionProp, defaultLayoutDirection = 'horizontal', onLayoutDirectionChange, hideLayoutToggle = false, refocusOnLayoutFlip = true, initialTrailId, onTrailSelect, onTrailStepHover, onReorderTrails, stepEmphasis, onRemoveStepEmphasis, onSelect, onEdgeSelect, measured: _measured, maxNodeWidth, showEdgeLabels, showSingletonFrames = true, moduleNesting, edgeView, hideSidebar, trailStepMode = 'focus', autoPlayTrails = false, trailAutoPlayIntervalMs = TRAIL_PLAY_PAUSE_MS, onAutoPlayStep, zoomOnTrailFocus = true, trailFocusDurationMs = 300, graphTitle, showTrailTitle = false, description, notes, canvasOverlay, interactive = true, canvasBackground = 'theme', onLayoutReady, onNodeRects, sidebarExtra, sidebarAfterDescription, issues, showIssues, filesActive, sidebarScope, onSidebarTrailChange, focusIssueCategory, laneStatus, onSelectIssue, onApplyIssueFix, onHoverIssue, renderFileViewer, renderTrailViewer, onFileSelect, componentVerification, onInspectSymbol, boundaryColors, codeProcessKeys, regionDetails, defaultFramesCollapsed, containersActive, hideDrawer = false, persistKey, liveEvents, agentsPanel }: InnerProps) {
|
|
751
753
|
const { theme } = useTheme();
|
|
752
754
|
const { fitView, fitBounds } = useReactFlow();
|
|
753
755
|
const [descriptionOpen, setDescriptionOpen] = useState(false);
|
|
@@ -879,8 +881,23 @@ function Inner({ components, trails, graphifyRelations, orderByLine, layoutDirec
|
|
|
879
881
|
// Stored as a default plus exceptions so "close all" needs no knowledge of
|
|
880
882
|
// which frames the layout will produce: `framesCollapsed` is the default
|
|
881
883
|
// every card frame takes, `toggledGroupIds` the frames flipped away from it.
|
|
884
|
+
// A lone container starts open — a single collapsed card hides the whole
|
|
885
|
+
// model behind one box with nothing to compare it against. An explicit
|
|
886
|
+
// `defaultFramesCollapsed` still wins; so does a persisted choice.
|
|
887
|
+
const resolvedDefaultFramesCollapsed = useMemo(() => {
|
|
888
|
+
if (defaultFramesCollapsed !== undefined) return defaultFramesCollapsed;
|
|
889
|
+
try {
|
|
890
|
+
const count = buildBoundaryLayoutGroups(
|
|
891
|
+
{ components },
|
|
892
|
+
{ showSingletonFrames, moduleNesting, codeProcessKeys },
|
|
893
|
+
).filter((g) => isCardFrame(g.region)).length;
|
|
894
|
+
return count <= 1 ? false : true;
|
|
895
|
+
} catch {
|
|
896
|
+
return true;
|
|
897
|
+
}
|
|
898
|
+
}, [components, showSingletonFrames, moduleNesting, codeProcessKeys, defaultFramesCollapsed]);
|
|
882
899
|
const [framesCollapsed, setFramesCollapsed] = useState<boolean>(
|
|
883
|
-
() => persisted.framesCollapsed ??
|
|
900
|
+
() => persisted.framesCollapsed ?? resolvedDefaultFramesCollapsed,
|
|
884
901
|
);
|
|
885
902
|
const [toggledGroupIds, setToggledGroupIds] = useState<ReadonlySet<string>>(
|
|
886
903
|
() => new Set(persisted.toggledFrames ?? []),
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { describe, expect, test } from 'bun:test';
|
|
2
|
+
import { containerLabelChunks } from './containerCard';
|
|
3
|
+
|
|
4
|
+
describe('containerLabelChunks', () => {
|
|
5
|
+
test('keeps slash-delimited path segments intact and offers a break after slash', () => {
|
|
6
|
+
expect(containerLabelChunks('subsystems-studio/host')).toEqual([
|
|
7
|
+
{ text: 'subsystems-studio/', pathSegment: true, breakAfter: true },
|
|
8
|
+
{ text: 'host', pathSegment: true, breakAfter: false },
|
|
9
|
+
]);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
test('supports multiple slash boundaries', () => {
|
|
13
|
+
expect(containerLabelChunks('packages/foo-bar/baz-qux')).toEqual([
|
|
14
|
+
{ text: 'packages/', pathSegment: true, breakAfter: true },
|
|
15
|
+
{ text: 'foo-bar/', pathSegment: true, breakAfter: true },
|
|
16
|
+
{ text: 'baz-qux', pathSegment: true, breakAfter: false },
|
|
17
|
+
]);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
test('preserves ordinary labels and whitespace', () => {
|
|
21
|
+
expect(containerLabelChunks('foo-bar ordinary label/path-name')).toEqual([
|
|
22
|
+
{ text: 'foo-bar', pathSegment: false, breakAfter: false },
|
|
23
|
+
{ text: ' ', pathSegment: false, breakAfter: false },
|
|
24
|
+
{ text: 'ordinary', pathSegment: false, breakAfter: false },
|
|
25
|
+
{ text: ' ', pathSegment: false, breakAfter: false },
|
|
26
|
+
{ text: 'label/', pathSegment: true, breakAfter: true },
|
|
27
|
+
{ text: 'path-name', pathSegment: true, breakAfter: false },
|
|
28
|
+
]);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* known quantity for the layout that has to reserve room for it.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
+
import { Fragment } from 'react';
|
|
12
13
|
import { useTheme } from '@principal-ade/industry-theme';
|
|
13
14
|
import type { LucideIcon } from 'lucide-react';
|
|
14
15
|
import { TechMark } from './techIcons';
|
|
@@ -110,6 +111,29 @@ export const OPEN_FOOTER_PAD = TOGGLE_INSET + TOGGLE_SIZE + 8;
|
|
|
110
111
|
*/
|
|
111
112
|
export const OPEN_SIDE_PAD = OPEN_FOOTER_PAD;
|
|
112
113
|
|
|
114
|
+
/** Split path-like labels at `/`, keeping each segment (and its slash) together. */
|
|
115
|
+
export function containerLabelChunks(label: string): Array<{
|
|
116
|
+
text: string;
|
|
117
|
+
pathSegment: boolean;
|
|
118
|
+
breakAfter: boolean;
|
|
119
|
+
}> {
|
|
120
|
+
return label.split(/(\s+)/).flatMap((part): Array<{
|
|
121
|
+
text: string;
|
|
122
|
+
pathSegment: boolean;
|
|
123
|
+
breakAfter: boolean;
|
|
124
|
+
}> => {
|
|
125
|
+
if (!part.includes('/') || /^\s+$/.test(part)) {
|
|
126
|
+
return [{ text: part, pathSegment: false, breakAfter: false }];
|
|
127
|
+
}
|
|
128
|
+
const segments = part.split('/');
|
|
129
|
+
return segments.map((segment, index) => ({
|
|
130
|
+
text: `${segment}${index < segments.length - 1 ? '/' : ''}`,
|
|
131
|
+
pathSegment: true,
|
|
132
|
+
breakAfter: index < segments.length - 1,
|
|
133
|
+
}));
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
113
137
|
export interface ContainerCardHeaderProps {
|
|
114
138
|
label: string;
|
|
115
139
|
/** The kind glyph beside the label — a container's sort, a package's mark. */
|
|
@@ -194,7 +218,16 @@ export function ContainerCardHeader({
|
|
|
194
218
|
minWidth: 0,
|
|
195
219
|
}}
|
|
196
220
|
>
|
|
197
|
-
{label
|
|
221
|
+
{containerLabelChunks(label).map((chunk, index) => (
|
|
222
|
+
<Fragment key={index}>
|
|
223
|
+
{chunk.pathSegment ? (
|
|
224
|
+
<span style={{ whiteSpace: 'nowrap' }}>{chunk.text}</span>
|
|
225
|
+
) : (
|
|
226
|
+
chunk.text
|
|
227
|
+
)}
|
|
228
|
+
{chunk.breakAfter && <wbr />}
|
|
229
|
+
</Fragment>
|
|
230
|
+
))}
|
|
198
231
|
</span>
|
|
199
232
|
{Icon && (
|
|
200
233
|
<span
|