@principal-ai/subsystems-react 0.56.15 → 0.56.17
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/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/pierre/PierreFileView.d.ts.map +1 -1
- package/dist/pierre/PierreFileView.js +7 -5
- package/dist/pierre/PierreFileView.js.map +1 -1
- package/dist/pierre/PierreSnippetView.d.ts.map +1 -1
- package/dist/pierre/PierreSnippetView.js +4 -2
- package/dist/pierre/PierreSnippetView.js.map +1 -1
- package/dist/pierre/PierreTrailCodeView.d.ts.map +1 -1
- package/dist/pierre/PierreTrailCodeView.js +4 -1
- package/dist/pierre/PierreTrailCodeView.js.map +1 -1
- package/dist/pierre/pierreBackground.d.ts +12 -0
- package/dist/pierre/pierreBackground.d.ts.map +1 -1
- package/dist/pierre/pierreBackground.js +12 -0
- package/dist/pierre/pierreBackground.js.map +1 -1
- package/dist/subsystem/C4Graph.d.ts +17 -0
- package/dist/subsystem/C4Graph.d.ts.map +1 -1
- package/dist/subsystem/C4Graph.js +128 -61
- package/dist/subsystem/C4Graph.js.map +1 -1
- package/dist/subsystem/C4NodeCard.d.ts.map +1 -1
- package/dist/subsystem/C4NodeCard.js +7 -2
- package/dist/subsystem/C4NodeCard.js.map +1 -1
- package/dist/subsystem/DecorationPanel.d.ts +32 -3
- package/dist/subsystem/DecorationPanel.d.ts.map +1 -1
- package/dist/subsystem/DecorationPanel.js +162 -89
- package/dist/subsystem/DecorationPanel.js.map +1 -1
- package/dist/subsystem/SubsystemComponentGraph.d.ts +2 -0
- package/dist/subsystem/SubsystemComponentGraph.d.ts.map +1 -1
- package/dist/subsystem/SubsystemComponentGraph.js +1 -1
- package/dist/subsystem/SubsystemComponentGraph.js.map +1 -1
- package/dist/subsystem/c4.d.ts +2 -0
- package/dist/subsystem/c4.d.ts.map +1 -1
- package/dist/subsystem/c4.js.map +1 -1
- package/dist/subsystem/decoration.d.ts +19 -0
- package/dist/subsystem/decoration.d.ts.map +1 -1
- package/dist/subsystem/decoration.js.map +1 -1
- package/dist/subsystem/decorationC4.d.ts +9 -0
- package/dist/subsystem/decorationC4.d.ts.map +1 -0
- package/dist/subsystem/decorationC4.js +55 -0
- package/dist/subsystem/decorationC4.js.map +1 -0
- package/package.json +3 -3
- package/src/index.ts +6 -1
- package/src/pierre/PierreFileView.tsx +13 -5
- package/src/pierre/PierreSnippetView.tsx +10 -2
- package/src/pierre/PierreTrailCodeView.tsx +8 -4
- package/src/pierre/pierreBackground.ts +14 -0
- package/src/stories/Components/DecorationPanel.stories.tsx +344 -36
- package/src/stories/Pierre/CodeView.stories.tsx +4 -2
- package/src/subsystem/C4Graph.groups.test.ts +46 -0
- package/src/subsystem/C4Graph.tsx +96 -16
- package/src/subsystem/C4NodeCard.test.ts +35 -1
- package/src/subsystem/C4NodeCard.tsx +7 -2
- package/src/subsystem/DecorationPanel.test.tsx +228 -4
- package/src/subsystem/DecorationPanel.tsx +248 -82
- package/src/subsystem/SubsystemComponentGraph.sidebar.test.tsx +11 -0
- package/src/subsystem/SubsystemComponentGraph.tsx +4 -1
- package/src/subsystem/c4.ts +2 -0
- package/src/subsystem/decoration.ts +25 -0
- package/src/subsystem/decorationC4.test.ts +134 -0
- package/src/subsystem/decorationC4.ts +60 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project a decoration's C4 additions without mutating the base architecture.
|
|
3
|
+
* Hosts resolve trail highlighting and construct membership separately.
|
|
4
|
+
* Invalid additions fail rather than replacing base elements or drawing dangling lines.
|
|
5
|
+
*/
|
|
6
|
+
export function applyDecorationC4(base, decoration, active = true) {
|
|
7
|
+
const draft = decoration.draft?.c4;
|
|
8
|
+
if (!active || !draft)
|
|
9
|
+
return base;
|
|
10
|
+
const ids = new Set([base.system.id, ...base.nodes.map((node) => node.id)]);
|
|
11
|
+
const additions = (draft.elements ?? []).map((element) => {
|
|
12
|
+
if (ids.has(element.id))
|
|
13
|
+
throw new Error(`Duplicate C4 element id: ${element.id}`);
|
|
14
|
+
ids.add(element.id);
|
|
15
|
+
return {
|
|
16
|
+
...element,
|
|
17
|
+
state: 'proposed',
|
|
18
|
+
...(element.kind === 'container' ? { parentId: element.parentId ?? base.system.id } : {}),
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
const nodes = [...base.nodes, ...additions];
|
|
22
|
+
const byId = new Map(nodes.map((node) => [node.id, node]));
|
|
23
|
+
for (const element of additions) {
|
|
24
|
+
if (element.kind === 'component') {
|
|
25
|
+
if (byId.get(element.container)?.kind !== 'container') {
|
|
26
|
+
throw new Error(`Missing C4 container for ${element.id}: ${element.container}`);
|
|
27
|
+
}
|
|
28
|
+
if (element.parentId && element.parentId !== element.container) {
|
|
29
|
+
throw new Error(`Conflicting C4 parent for ${element.id}`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
else if (element.kind === 'container' && element.parentId !== base.system.id) {
|
|
33
|
+
throw new Error(`Unknown C4 system for ${element.id}: ${element.parentId}`);
|
|
34
|
+
}
|
|
35
|
+
else if ((element.kind === 'external-system' || element.kind === 'person') &&
|
|
36
|
+
element.parentId) {
|
|
37
|
+
throw new Error(`External C4 element cannot have a parent: ${element.id}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const edgeIds = new Set(base.edges.map((edge) => edge.id));
|
|
41
|
+
for (const edge of draft.edges ?? []) {
|
|
42
|
+
if (edgeIds.has(edge.id))
|
|
43
|
+
throw new Error(`Duplicate C4 edge id: ${edge.id}`);
|
|
44
|
+
edgeIds.add(edge.id);
|
|
45
|
+
if (!byId.has(edge.source) || !byId.has(edge.target)) {
|
|
46
|
+
throw new Error(`Missing C4 endpoint for edge: ${edge.id}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
...base,
|
|
51
|
+
nodes,
|
|
52
|
+
edges: [...base.edges, ...(draft.edges ?? []).map((edge) => ({ ...edge, draft: true }))],
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=decorationC4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorationC4.js","sourceRoot":"","sources":["../../src/subsystem/decorationC4.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAC/B,IAAa,EACb,UAA+B,EAC/B,MAAM,GAAG,IAAI;IAEb,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,EAAE,EAAE,CAAC;IACnC,IAAI,CAAC,MAAM,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IAEnC,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC5E,MAAM,SAAS,GAAgB,CAAC,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;QACpE,IAAI,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,4BAA4B,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;QACnF,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACpB,OAAO;YACL,GAAG,OAAO;YACV,KAAK,EAAE,UAAU;YACjB,GAAG,CAAC,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC1F,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,EAAE,GAAG,SAAS,CAAC,CAAC;IAC5C,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAC3D,KAAK,MAAM,OAAO,IAAI,SAAS,EAAE;QAC/B,IAAI,OAAO,CAAC,IAAI,KAAK,WAAW,EAAE;YAChC,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,IAAI,KAAK,WAAW,EAAE;gBACrD,MAAM,IAAI,KAAK,CAAC,4BAA4B,OAAO,CAAC,EAAE,KAAK,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;aACjF;YACD,IAAI,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,SAAS,EAAE;gBAC9D,MAAM,IAAI,KAAK,CAAC,6BAA6B,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;aAC5D;SACF;aAAM,IAAI,OAAO,CAAC,IAAI,KAAK,WAAW,IAAI,OAAO,CAAC,QAAQ,KAAK,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE;YAC9E,MAAM,IAAI,KAAK,CAAC,yBAAyB,OAAO,CAAC,EAAE,KAAK,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;SAC7E;aAAM,IACL,CAAC,OAAO,CAAC,IAAI,KAAK,iBAAiB,IAAI,OAAO,CAAC,IAAI,KAAK,QAAQ,CAAC;YACjE,OAAO,CAAC,QAAQ,EAChB;YACA,MAAM,IAAI,KAAK,CAAC,6CAA6C,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;SAC5E;KACF;IAED,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IAC3D,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,IAAI,EAAE,EAAE;QACpC,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;QAC9E,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACrB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;YACpD,MAAM,IAAI,KAAK,CAAC,iCAAiC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;SAC7D;KACF;IACD,OAAO;QACL,GAAG,IAAI;QACP,KAAK;QACL,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;KACzF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@principal-ai/subsystems-react",
|
|
3
|
-
"version": "0.56.
|
|
3
|
+
"version": "0.56.17",
|
|
4
4
|
"description": "React UI for Subsystem Models \u2014 graph, Pierre code views, and session-event feeds",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
"zustand": "4.5.0"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@pierre/diffs": ">=1.
|
|
39
|
+
"@pierre/diffs": ">=1.6.0",
|
|
40
40
|
"@principal-ade/industry-theme": "^0.1.7",
|
|
41
41
|
"@principal-ai/subsystems-core": "^0.51.0",
|
|
42
42
|
"react": "^18.0.0 || ^19.0.0",
|
|
43
43
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@pierre/diffs": "1.
|
|
46
|
+
"@pierre/diffs": "1.6.2",
|
|
47
47
|
"@principal-ade/industry-theme": "0.1.7",
|
|
48
48
|
"@principal-ai/agent-monitoring": "^0.3.38",
|
|
49
49
|
"@principal-ai/subsystems-core": "^0.51.0",
|
package/src/index.ts
CHANGED
|
@@ -251,6 +251,8 @@ export {
|
|
|
251
251
|
export type {
|
|
252
252
|
DecorationBaseTrailRef,
|
|
253
253
|
DecorationDraft,
|
|
254
|
+
DecorationDraftC4,
|
|
255
|
+
DecorationDraftC4Element,
|
|
254
256
|
DecorationDraftComponent,
|
|
255
257
|
DecorationDraftEdge,
|
|
256
258
|
DecorationDraftTrailRef,
|
|
@@ -259,9 +261,12 @@ export type {
|
|
|
259
261
|
DecorationTrailRef,
|
|
260
262
|
SubsystemDecoration,
|
|
261
263
|
} from './subsystem/decoration';
|
|
262
|
-
export {
|
|
264
|
+
export { applyDecorationC4 } from './subsystem/decorationC4';
|
|
265
|
+
export { DecorationHeader, DecorationPanel } from './subsystem/DecorationPanel';
|
|
263
266
|
export type {
|
|
267
|
+
DecorationHeaderProps,
|
|
264
268
|
DecorationPanelProps,
|
|
269
|
+
DecorationPanelSelection,
|
|
265
270
|
DecorationPanelTrailMeta,
|
|
266
271
|
} from './subsystem/DecorationPanel';
|
|
267
272
|
export { GraphLayoutCover } from './subsystem/GraphLayoutCover';
|
|
@@ -13,7 +13,11 @@ import {
|
|
|
13
13
|
preloadHighlighter,
|
|
14
14
|
} from '@pierre/diffs';
|
|
15
15
|
import { useTheme } from '@principal-ade/industry-theme';
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
buildPierreOptions,
|
|
18
|
+
PIERRE_FILE_STYLE,
|
|
19
|
+
PIERRE_PREFERRED_HIGHLIGHTER,
|
|
20
|
+
} from './pierreBackground';
|
|
17
21
|
import { pierreLangForPath } from './pierreFileLang';
|
|
18
22
|
import { isFileUnavailableError } from './fileAvailability';
|
|
19
23
|
import { scrollFocusLineIntoView } from './scrollAnchor';
|
|
@@ -41,9 +45,9 @@ export function PierreFileView({
|
|
|
41
45
|
const [contents, setContents] = useState<string | null>(null);
|
|
42
46
|
const [error, setError] = useState<string | null>(null);
|
|
43
47
|
// Pierre highlights on the main thread with no worker pool: a cold first
|
|
44
|
-
// render paints an empty <pre> and never re-renders once
|
|
45
|
-
// Warm the shared highlighter for this file before mounting <File>
|
|
46
|
-
// very first render produces content.
|
|
48
|
+
// render paints an empty <pre> and never re-renders once the highlighter
|
|
49
|
+
// resolves. Warm the shared highlighter for this file before mounting <File>
|
|
50
|
+
// so the very first render produces content.
|
|
47
51
|
const [highlighterReady, setHighlighterReady] = useState(false);
|
|
48
52
|
const lang = pierreLangForPath(filePath) ?? getFiletypeFromFileName(fileName);
|
|
49
53
|
|
|
@@ -76,7 +80,11 @@ export function PierreFileView({
|
|
|
76
80
|
useEffect(() => {
|
|
77
81
|
let cancelled = false;
|
|
78
82
|
setHighlighterReady(false);
|
|
79
|
-
void preloadHighlighter(
|
|
83
|
+
void preloadHighlighter(
|
|
84
|
+
getHighlighterOptions(lang, {
|
|
85
|
+
preferredHighlighter: PIERRE_PREFERRED_HIGHLIGHTER,
|
|
86
|
+
}),
|
|
87
|
+
)
|
|
80
88
|
.catch(() => {
|
|
81
89
|
// Fall through: let <File> attempt its own (plain-text) render.
|
|
82
90
|
})
|
|
@@ -16,7 +16,11 @@ import {
|
|
|
16
16
|
preloadHighlighter,
|
|
17
17
|
} from '@pierre/diffs';
|
|
18
18
|
import { useTheme } from '@principal-ade/industry-theme';
|
|
19
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
buildPierreOptions,
|
|
21
|
+
PIERRE_FILE_STYLE,
|
|
22
|
+
PIERRE_PREFERRED_HIGHLIGHTER,
|
|
23
|
+
} from './pierreBackground';
|
|
20
24
|
import { pierreLangForPath } from './pierreFileLang';
|
|
21
25
|
import { remapSnippetLineNumbers, sliceSnippetWindow } from './sliceSnippet';
|
|
22
26
|
|
|
@@ -61,7 +65,11 @@ export function PierreSnippetView({
|
|
|
61
65
|
useEffect(() => {
|
|
62
66
|
let cancelled = false;
|
|
63
67
|
setHighlighterReady(false);
|
|
64
|
-
void preloadHighlighter(
|
|
68
|
+
void preloadHighlighter(
|
|
69
|
+
getHighlighterOptions(lang, {
|
|
70
|
+
preferredHighlighter: PIERRE_PREFERRED_HIGHLIGHTER,
|
|
71
|
+
}),
|
|
72
|
+
)
|
|
65
73
|
.catch(() => {
|
|
66
74
|
// Fall through: let <File> attempt its own (plain-text) render.
|
|
67
75
|
})
|
|
@@ -212,7 +212,7 @@ export function PierreTrailCodeView({
|
|
|
212
212
|
const headerFontSize = theme.fontSizes[1];
|
|
213
213
|
const headerHeight =
|
|
214
214
|
Math.round(headerFontSize * TRAIL_HEADER_LINE_HEIGHT) + 2 * TRAIL_HEADER_PAD_Y;
|
|
215
|
-
const viewRef = useRef<CodeViewHandle<undefined>>(null);
|
|
215
|
+
const viewRef = useRef<CodeViewHandle<TrailStepAnnotation, undefined>>(null);
|
|
216
216
|
// CodeView's scroll container — also the box we measure items against.
|
|
217
217
|
const containerRef = useRef<HTMLDivElement | null>(null);
|
|
218
218
|
const [load, setLoad] = useState<FileLoadState>({ status: 'loading' });
|
|
@@ -428,7 +428,7 @@ export function PierreTrailCodeView({
|
|
|
428
428
|
// and the drawer header carries a segmented progress readout.
|
|
429
429
|
|
|
430
430
|
const renderHeaderMetadata = useMemo(() => {
|
|
431
|
-
return (item: CodeViewItem) => {
|
|
431
|
+
return (item: CodeViewItem<TrailStepAnnotation>) => {
|
|
432
432
|
const index = Number.parseInt(item.id.split(':').pop() ?? '', 10);
|
|
433
433
|
const step = trail.steps[index];
|
|
434
434
|
if (!step) return null;
|
|
@@ -469,6 +469,9 @@ export function PierreTrailCodeView({
|
|
|
469
469
|
annotation:
|
|
470
470
|
| LineAnnotation<TrailStepAnnotation>
|
|
471
471
|
| DiffLineAnnotation<TrailStepAnnotation>,
|
|
472
|
+
// 1.6 moved the displayed file/diff to the second argument and the item
|
|
473
|
+
// to the third; trail annotations only need the item id.
|
|
474
|
+
_fileOrDiff: unknown,
|
|
472
475
|
item: CodeViewItem<TrailStepAnnotation>,
|
|
473
476
|
) => {
|
|
474
477
|
const index = Number.parseInt(item.id.split(':').pop() ?? '', 10);
|
|
@@ -513,7 +516,8 @@ export function PierreTrailCodeView({
|
|
|
513
516
|
// Per-token interactions for construct navigation. Only wired when the host
|
|
514
517
|
// supplies both callbacks; providing them also switches Pierre into its
|
|
515
518
|
// token-transformer render path (pointer events land on token spans).
|
|
516
|
-
const symbolHandlers = useMemo(
|
|
519
|
+
const symbolHandlers = useMemo(
|
|
520
|
+
(): Partial<CodeViewReactOptions<TrailStepAnnotation, undefined>> => {
|
|
517
521
|
if (resolveSymbol == null || onSymbolClick == null) return {};
|
|
518
522
|
const resolveAt = (
|
|
519
523
|
props: TokenEventBase,
|
|
@@ -537,7 +541,7 @@ export function PierreTrailCodeView({
|
|
|
537
541
|
};
|
|
538
542
|
}, [resolveSymbol, onSymbolClick]);
|
|
539
543
|
|
|
540
|
-
const options = useMemo((): CodeViewReactOptions => {
|
|
544
|
+
const options = useMemo((): CodeViewReactOptions<TrailStepAnnotation, undefined> => {
|
|
541
545
|
return {
|
|
542
546
|
theme: {
|
|
543
547
|
dark: resolvePierreSyntaxThemeName('dark'),
|
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
/** Shared Pierre / @pierre/diffs option helpers for file + snippet views. */
|
|
2
2
|
|
|
3
|
+
import { canUseWASM, type HighlighterTypes } from '@pierre/diffs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Highlighting backend for every Pierre surface.
|
|
7
|
+
*
|
|
8
|
+
* `'highlights'` is Pierre's WASM lexer (see `@pierre/highlights`): much faster
|
|
9
|
+
* than Shiki and built for streaming/live edits. It needs WebAssembly + SIMD,
|
|
10
|
+
* so older engines fall back to Shiki's JavaScript engine.
|
|
11
|
+
*/
|
|
12
|
+
export const PIERRE_PREFERRED_HIGHLIGHTER: HighlighterTypes = canUseWASM()
|
|
13
|
+
? 'highlights'
|
|
14
|
+
: 'shiki-js';
|
|
15
|
+
|
|
3
16
|
export const PIERRE_FILE_STYLE = { display: 'block' } as const;
|
|
4
17
|
|
|
5
18
|
export const PIERRE_BASE_OPTIONS = {
|
|
6
19
|
disableFileHeader: true,
|
|
20
|
+
preferredHighlighter: PIERRE_PREFERRED_HIGHLIGHTER,
|
|
7
21
|
} as const;
|
|
8
22
|
|
|
9
23
|
/** Chrome overrides for the per-file header (`[data-diffs-header]`). */
|