@mantine-vue/code-highlight 1.1.2

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/esm/index.mjs ADDED
@@ -0,0 +1,1974 @@
1
+ import { ActionIcon, Box, ScrollArea, Tooltip, UnstyledButton, createSafeContext, createVarsResolver, getRadius, getThemeColor, rem, useMantineContext, useProps, useStyles } from "@mantine-vue/core";
2
+ import { useClipboard, useUncontrolled } from "@mantine-vue/hooks";
3
+ import { computed, defineComponent, h, inject, onMounted, provide, ref, watch } from "vue";
4
+ var CodeHighlight_module_default = {
5
+ root: "_root_1avu3_1",
6
+ codeHighlight: "_codeHighlight_1avu3_5",
7
+ inlineCodeHighlight: "_inlineCodeHighlight_1avu3_37",
8
+ pre: "_pre_1avu3_71",
9
+ code: "_code_1avu3_5",
10
+ controls: "_controls_1avu3_101",
11
+ control: "_control_1avu3_101",
12
+ controlTooltip: "_controlTooltip_1avu3_146",
13
+ codeWrapper: "_codeWrapper_1avu3_158",
14
+ lineNumbers: "_lineNumbers_1avu3_165",
15
+ scrollarea: "_scrollarea_1avu3_182",
16
+ showCodeButton: "_showCodeButton_1avu3_207",
17
+ file: "_file_1avu3_234",
18
+ fileIcon: "_fileIcon_1avu3_305",
19
+ filesScrollarea: "_filesScrollarea_1avu3_311",
20
+ files: "_files_1avu3_311"
21
+ };
22
+ //#endregion
23
+ //#region src/CodeHighlightProvider/adapters/plain-text-adapter.ts
24
+ var plainTextAdapter = { getHighlighter: () => ({ code }) => ({
25
+ highlightedCode: code,
26
+ isHighlighted: false
27
+ }) };
28
+ //#endregion
29
+ //#region src/CodeHighlightProvider/CodeHighlightProvider.ts
30
+ var CodeHighlightContext = Symbol("CodeHighlightContext");
31
+ function provideCodeHighlightAdapterContext(value) {
32
+ provide(CodeHighlightContext, value);
33
+ }
34
+ function useHighlight() {
35
+ return inject(CodeHighlightContext, null)?.highlight || plainTextAdapter.getHighlighter(null);
36
+ }
37
+ var CodeHighlightAdapterProvider = defineComponent({
38
+ name: "CodeHighlightAdapterProvider",
39
+ props: { adapter: {
40
+ type: Object,
41
+ required: true
42
+ } },
43
+ setup(props, { slots }) {
44
+ const context = ref(null);
45
+ const highlight = computed(() => props.adapter.getHighlighter(context.value));
46
+ onMounted(() => {
47
+ props.adapter.loadContext?.().then((value) => {
48
+ context.value = value;
49
+ });
50
+ });
51
+ provideCodeHighlightAdapterContext({
52
+ adapter: props.adapter,
53
+ get highlight() {
54
+ return highlight.value;
55
+ }
56
+ });
57
+ return () => h("div", { style: { display: "contents" } }, slots.default?.());
58
+ }
59
+ });
60
+ //#endregion
61
+ //#region src/CodeHighlight/CodeHighlight.context.ts
62
+ var [provideCodeHighlightContext, useCodeHighlightContext] = createSafeContext("CodeHighlightProvider was not found in the component tree");
63
+ //#endregion
64
+ //#region src/CodeHighlight/CodeHighlightControl/CodeHighlightControl.ts
65
+ var CodeHighlightControl = defineComponent({
66
+ name: "CodeHighlightControl",
67
+ inheritAttrs: false,
68
+ props: {
69
+ tooltipLabel: {
70
+ type: String,
71
+ default: void 0
72
+ },
73
+ classNames: {
74
+ type: [Object, Function],
75
+ default: void 0
76
+ },
77
+ styles: {
78
+ type: [Object, Function],
79
+ default: void 0
80
+ },
81
+ vars: {
82
+ type: [Object, Function],
83
+ default: void 0
84
+ },
85
+ component: {
86
+ type: String,
87
+ default: "button"
88
+ },
89
+ onClick: {
90
+ type: Function,
91
+ default: void 0
92
+ }
93
+ },
94
+ setup(rawProps, { attrs, slots }) {
95
+ const props = useProps("CodeHighlightControl", null, rawProps);
96
+ const ctx = useCodeHighlightContext();
97
+ return () => {
98
+ const tooltipStyles = ctx.getStyles("controlTooltip");
99
+ const control = h(ActionIcon, {
100
+ ...ctx.getStyles("control"),
101
+ ...attrs,
102
+ component: props.component,
103
+ variant: "none",
104
+ "data-code-color-scheme": ctx.codeColorScheme,
105
+ onClick: props.onClick
106
+ }, slots);
107
+ return props.tooltipLabel ? h(Tooltip, {
108
+ label: props.tooltipLabel,
109
+ fz: "sm",
110
+ position: "bottom",
111
+ classNames: { tooltip: tooltipStyles.class },
112
+ styles: { tooltip: tooltipStyles.style },
113
+ "data-code-color-scheme": ctx.codeColorScheme,
114
+ transitionProps: { duration: 0 }
115
+ }, () => control) : control;
116
+ };
117
+ }
118
+ });
119
+ //#endregion
120
+ //#region src/CodeHighlight/CopyCodeButton/CopyIcon.ts
121
+ var CopyIcon = defineComponent({
122
+ name: "CopyIcon",
123
+ inheritAttrs: false,
124
+ props: { copied: {
125
+ type: Boolean,
126
+ required: true
127
+ } },
128
+ setup(props, { attrs }) {
129
+ return () => h("svg", {
130
+ ...attrs,
131
+ xmlns: "http://www.w3.org/2000/svg",
132
+ viewBox: "0 0 24 24",
133
+ strokeWidth: "2",
134
+ stroke: "currentColor",
135
+ fill: "none",
136
+ strokeLinecap: "round",
137
+ strokeLinejoin: "round"
138
+ }, props.copied ? [h("path", {
139
+ stroke: "none",
140
+ d: "M0 0h24v24H0z",
141
+ fill: "none"
142
+ }), h("path", { d: "M5 12l5 5l10 -10" })] : [
143
+ h("path", {
144
+ stroke: "none",
145
+ d: "M0 0h24v24H0z",
146
+ fill: "none"
147
+ }),
148
+ h("path", { d: "M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z" }),
149
+ h("path", { d: "M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2" })
150
+ ]);
151
+ }
152
+ });
153
+ //#endregion
154
+ //#region src/CodeHighlight/CopyCodeButton/CopyCodeButton.ts
155
+ var CopyCodeButton = defineComponent({
156
+ name: "CopyCodeButton",
157
+ props: {
158
+ code: {
159
+ type: String,
160
+ required: true
161
+ },
162
+ copiedLabel: {
163
+ type: String,
164
+ default: "Copied"
165
+ },
166
+ copyLabel: {
167
+ type: String,
168
+ default: "Copy"
169
+ }
170
+ },
171
+ setup(props) {
172
+ const clipboard = useClipboard();
173
+ return () => h(CodeHighlightControl, {
174
+ onClick: () => clipboard.copy(props.code.trim()),
175
+ variant: "none",
176
+ tooltipLabel: clipboard.copied.value ? props.copiedLabel : props.copyLabel,
177
+ "aria-label": clipboard.copied.value ? props.copiedLabel : `${props.copyLabel} code`
178
+ }, () => h(CopyIcon, { copied: clipboard.copied.value }));
179
+ }
180
+ });
181
+ //#endregion
182
+ //#region src/CodeHighlight/ExpandCodeButton/ExpandIcon.ts
183
+ var ExpandIcon = defineComponent({
184
+ name: "ExpandIcon",
185
+ inheritAttrs: false,
186
+ props: { expanded: {
187
+ type: Boolean,
188
+ required: true
189
+ } },
190
+ setup(props, { attrs }) {
191
+ return () => h("svg", {
192
+ ...attrs,
193
+ xmlns: "http://www.w3.org/2000/svg",
194
+ viewBox: "0 0 24 24",
195
+ strokeWidth: "2",
196
+ stroke: "currentColor",
197
+ fill: "none",
198
+ strokeLinecap: "round",
199
+ strokeLinejoin: "round"
200
+ }, props.expanded ? [
201
+ h("path", {
202
+ stroke: "none",
203
+ d: "M0 0h24v24H0z",
204
+ fill: "none"
205
+ }),
206
+ h("path", { d: "M12 13v-8l-3 3m6 0l-3 -3" }),
207
+ h("path", { d: "M9 17l1 0" }),
208
+ h("path", { d: "M14 17l1 0" }),
209
+ h("path", { d: "M19 17l1 0" }),
210
+ h("path", { d: "M4 17l1 0" })
211
+ ] : [
212
+ h("path", {
213
+ stroke: "none",
214
+ d: "M0 0h24v24H0z",
215
+ fill: "none"
216
+ }),
217
+ h("path", { d: "M12 11v8l3 -3m-6 0l3 3" }),
218
+ h("path", { d: "M9 7l1 0" }),
219
+ h("path", { d: "M14 7l1 0" }),
220
+ h("path", { d: "M19 7l1 0" }),
221
+ h("path", { d: "M4 7l1 0" })
222
+ ]);
223
+ }
224
+ });
225
+ //#endregion
226
+ //#region src/CodeHighlight/ExpandCodeButton/ExpandCodeButton.ts
227
+ var ExpandCodeButton = defineComponent({
228
+ name: "ExpandCodeButton",
229
+ props: {
230
+ expanded: {
231
+ type: Boolean,
232
+ required: true
233
+ },
234
+ onExpand: {
235
+ type: Function,
236
+ required: true
237
+ },
238
+ collapseCodeLabel: {
239
+ type: String,
240
+ default: "Collapse code"
241
+ },
242
+ expandCodeLabel: {
243
+ type: String,
244
+ default: "Expand code"
245
+ }
246
+ },
247
+ setup(props) {
248
+ return () => h(CodeHighlightControl, {
249
+ onClick: () => props.onExpand(!props.expanded),
250
+ tooltipLabel: props.expanded ? props.collapseCodeLabel : props.expandCodeLabel,
251
+ "aria-label": props.expanded ? props.collapseCodeLabel : props.expandCodeLabel
252
+ }, () => h(ExpandIcon, { expanded: props.expanded }));
253
+ }
254
+ });
255
+ //#endregion
256
+ //#region src/CodeHighlight/CodeHighlight.ts
257
+ var defaultProps = {
258
+ withCopyButton: true,
259
+ expandCodeLabel: "Expand code",
260
+ collapseCodeLabel: "Collapse code"
261
+ };
262
+ var varsResolver$1 = createVarsResolver((theme, { maxCollapsedHeight, background, radius }) => ({ codeHighlight: {
263
+ "--ch-max-height": rem(maxCollapsedHeight),
264
+ "--ch-background": background ? getThemeColor(background, theme) : void 0,
265
+ "--ch-radius": typeof radius !== "undefined" ? getRadius(radius) : void 0
266
+ } }));
267
+ function renderHtmlOrText(isHighlighted, highlightedCode, code) {
268
+ return isHighlighted ? { innerHTML: highlightedCode } : { textContent: code.trim() };
269
+ }
270
+ function cx(...values) {
271
+ return values.filter(Boolean);
272
+ }
273
+ function resolveColorScheme(value) {
274
+ if (value !== "auto") return value;
275
+ return typeof window !== "undefined" && window.matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light";
276
+ }
277
+ var CodeHighlightBase = defineComponent({
278
+ name: "CodeHighlight",
279
+ inheritAttrs: false,
280
+ props: {
281
+ code: {
282
+ type: String,
283
+ required: true
284
+ },
285
+ language: {
286
+ type: String,
287
+ default: void 0
288
+ },
289
+ copyLabel: {
290
+ type: String,
291
+ default: void 0
292
+ },
293
+ copiedLabel: {
294
+ type: String,
295
+ default: void 0
296
+ },
297
+ defaultExpanded: {
298
+ type: Boolean,
299
+ default: void 0
300
+ },
301
+ expanded: {
302
+ type: Boolean,
303
+ default: void 0
304
+ },
305
+ onExpandedChange: {
306
+ type: Function,
307
+ default: void 0
308
+ },
309
+ maxCollapsedHeight: {
310
+ type: [String, Number],
311
+ default: void 0
312
+ },
313
+ withCopyButton: {
314
+ type: Boolean,
315
+ default: void 0
316
+ },
317
+ withExpandButton: {
318
+ type: Boolean,
319
+ default: false
320
+ },
321
+ expandCodeLabel: {
322
+ type: String,
323
+ default: void 0
324
+ },
325
+ collapseCodeLabel: {
326
+ type: String,
327
+ default: void 0
328
+ },
329
+ background: {
330
+ type: String,
331
+ default: void 0
332
+ },
333
+ radius: {
334
+ type: [String, Number],
335
+ default: void 0
336
+ },
337
+ withBorder: {
338
+ type: Boolean,
339
+ default: false
340
+ },
341
+ withLineNumbers: {
342
+ type: Boolean,
343
+ default: false
344
+ },
345
+ controls: {
346
+ type: [Array, Function],
347
+ default: void 0
348
+ },
349
+ codeColorScheme: {
350
+ type: String,
351
+ default: void 0
352
+ },
353
+ __withOffset: {
354
+ type: Boolean,
355
+ default: false
356
+ },
357
+ __staticSelector: {
358
+ type: String,
359
+ default: void 0
360
+ },
361
+ __inline: {
362
+ type: Boolean,
363
+ default: false
364
+ },
365
+ classNames: {
366
+ type: [Object, Function],
367
+ default: void 0
368
+ },
369
+ styles: {
370
+ type: [Object, Function],
371
+ default: void 0
372
+ },
373
+ vars: {
374
+ type: [Object, Function],
375
+ default: void 0
376
+ },
377
+ unstyled: {
378
+ type: Boolean,
379
+ default: false
380
+ }
381
+ },
382
+ setup(rawProps, { attrs }) {
383
+ const props = useProps("CodeHighlight", defaultProps, rawProps);
384
+ const mantine = useMantineContext();
385
+ const getStyles = useStyles({
386
+ name: props.__staticSelector || "CodeHighlight",
387
+ classes: CodeHighlight_module_default,
388
+ props,
389
+ className: attrs.class,
390
+ style: attrs.style,
391
+ classNames: props.classNames,
392
+ styles: props.styles,
393
+ vars: props.vars,
394
+ unstyled: props.unstyled,
395
+ varsResolver: varsResolver$1,
396
+ rootSelector: "codeHighlight"
397
+ });
398
+ const [expanded, setExpanded] = useUncontrolled({
399
+ value: () => props.expanded,
400
+ defaultValue: props.defaultExpanded,
401
+ finalValue: true,
402
+ onChange: (value) => props.onExpandedChange?.(value)
403
+ });
404
+ const highlight = useHighlight();
405
+ provideCodeHighlightContext({
406
+ getStyles,
407
+ get codeColorScheme() {
408
+ return props.codeColorScheme;
409
+ }
410
+ });
411
+ return () => {
412
+ const colorScheme = resolveColorScheme(mantine.colorScheme.value);
413
+ const highlightedCode = highlight({
414
+ code: props.code.trim(),
415
+ language: props.language,
416
+ colorScheme: props.codeColorScheme ?? colorScheme
417
+ });
418
+ const codeContent = renderHtmlOrText(highlightedCode.isHighlighted, highlightedCode.highlightedCode, props.code);
419
+ if (props.__inline) return h(Box, {
420
+ component: "code",
421
+ ...attrs,
422
+ ...highlightedCode.codeElementProps,
423
+ ...getStyles("codeHighlight", {
424
+ className: cx(highlightedCode.codeElementProps?.class, attrs.class),
425
+ style: [highlightedCode.codeElementProps?.style, attrs.style]
426
+ }),
427
+ "data-with-border": props.withBorder || void 0,
428
+ ...codeContent
429
+ });
430
+ const renderedControls = typeof props.controls === "function" ? props.controls() : props.controls;
431
+ const controlsArray = Array.isArray(renderedControls) ? renderedControls : renderedControls ? [renderedControls] : [];
432
+ const shouldDisplayControls = controlsArray.length > 0 || props.withExpandButton || props.withCopyButton;
433
+ return h(Box, {
434
+ ...attrs,
435
+ ...getStyles("codeHighlight"),
436
+ dir: "ltr",
437
+ "data-code-color-scheme": props.codeColorScheme,
438
+ "data-with-border": props.withBorder || void 0
439
+ }, () => [
440
+ shouldDisplayControls ? h("div", {
441
+ ...getStyles("controls"),
442
+ "data-with-offset": props.__withOffset || void 0
443
+ }, [
444
+ ...controlsArray,
445
+ props.withExpandButton ? h(ExpandCodeButton, {
446
+ expanded: expanded.value,
447
+ onExpand: setExpanded,
448
+ expandCodeLabel: props.expandCodeLabel,
449
+ collapseCodeLabel: props.collapseCodeLabel
450
+ }) : null,
451
+ props.withCopyButton ? h(CopyCodeButton, {
452
+ code: props.code,
453
+ copiedLabel: props.copiedLabel,
454
+ copyLabel: props.copyLabel
455
+ }) : null
456
+ ]) : null,
457
+ h(ScrollArea, {
458
+ type: "hover",
459
+ scrollbarSize: 4,
460
+ dir: "ltr",
461
+ offsetScrollbars: false,
462
+ "data-collapsed": !expanded.value || void 0,
463
+ styles: { viewport: { overscrollBehaviorInline: "none" } },
464
+ ...getStyles("scrollarea")
465
+ }, () => h("div", getStyles("codeWrapper"), [props.withLineNumbers ? h("div", {
466
+ ...getStyles("lineNumbers"),
467
+ "data-with-offset": props.__withOffset || void 0
468
+ }, props.code.trim().split("\n").map((_, index) => h("div", { key: index }, index + 1))) : null, h("pre", {
469
+ ...getStyles("pre"),
470
+ "data-with-offset": props.__withOffset || void 0
471
+ }, h("code", {
472
+ ...highlightedCode.codeElementProps,
473
+ ...getStyles("code", {
474
+ className: highlightedCode.codeElementProps?.class,
475
+ style: highlightedCode.codeElementProps?.style
476
+ }),
477
+ ...codeContent
478
+ }))])),
479
+ h(UnstyledButton, {
480
+ ...getStyles("showCodeButton"),
481
+ mod: { hidden: expanded.value },
482
+ onClick: () => setExpanded(true),
483
+ "data-code-color-scheme": props.codeColorScheme
484
+ }, () => props.expandCodeLabel)
485
+ ]);
486
+ };
487
+ }
488
+ });
489
+ var CodeHighlight = Object.assign(CodeHighlightBase, {
490
+ classes: CodeHighlight_module_default,
491
+ varsResolver: varsResolver$1,
492
+ Control: CodeHighlightControl
493
+ });
494
+ //#endregion
495
+ //#region src/CodeHighlight/InlineCodeHighlight.ts
496
+ var varsResolver = createVarsResolver((theme, { background, radius }) => ({ inlineCodeHighlight: {
497
+ "--ch-background": background ? getThemeColor(background, theme) : void 0,
498
+ "--ch-radius": typeof radius !== "undefined" ? getRadius(radius) : void 0
499
+ } }));
500
+ var InlineCodeHighlight = defineComponent({
501
+ name: "InlineCodeHighlight",
502
+ inheritAttrs: false,
503
+ props: {
504
+ code: {
505
+ type: String,
506
+ required: true
507
+ },
508
+ language: {
509
+ type: String,
510
+ default: void 0
511
+ },
512
+ background: {
513
+ type: String,
514
+ default: void 0
515
+ },
516
+ radius: {
517
+ type: [String, Number],
518
+ default: void 0
519
+ },
520
+ withBorder: {
521
+ type: Boolean,
522
+ default: false
523
+ },
524
+ classNames: {
525
+ type: [Object, Function],
526
+ default: void 0
527
+ },
528
+ styles: {
529
+ type: [Object, Function],
530
+ default: void 0
531
+ },
532
+ vars: {
533
+ type: [Object, Function],
534
+ default: void 0
535
+ },
536
+ unstyled: {
537
+ type: Boolean,
538
+ default: false
539
+ }
540
+ },
541
+ setup(rawProps, { attrs }) {
542
+ const props = useProps("InlineCodeHighlight", null, rawProps);
543
+ const getStyles = useStyles({
544
+ name: "InlineCodeHighlight",
545
+ classes: CodeHighlight_module_default,
546
+ props,
547
+ className: attrs.class,
548
+ style: attrs.style,
549
+ classNames: props.classNames,
550
+ styles: props.styles,
551
+ unstyled: props.unstyled,
552
+ vars: props.vars,
553
+ varsResolver,
554
+ rootSelector: "inlineCodeHighlight"
555
+ });
556
+ return () => h(CodeHighlight, {
557
+ ...attrs,
558
+ ...props,
559
+ ...getStyles("inlineCodeHighlight"),
560
+ __inline: true
561
+ });
562
+ }
563
+ });
564
+ Object.assign(InlineCodeHighlight, {
565
+ classes: CodeHighlight_module_default,
566
+ varsResolver
567
+ });
568
+ //#endregion
569
+ //#region src/CodeHighlightTabs/FileIcon.ts
570
+ var FileIcon = defineComponent({
571
+ name: "FileIcon",
572
+ inheritAttrs: false,
573
+ props: {
574
+ fileName: {
575
+ type: String,
576
+ default: void 0
577
+ },
578
+ getFileIcon: {
579
+ type: Function,
580
+ default: void 0
581
+ },
582
+ fileIcon: {
583
+ type: [
584
+ String,
585
+ Number,
586
+ Object,
587
+ Function,
588
+ Array
589
+ ],
590
+ default: void 0
591
+ }
592
+ },
593
+ setup(props, { attrs }) {
594
+ return () => {
595
+ if (props.fileIcon) return h("span", attrs, props.fileIcon);
596
+ if (props.getFileIcon && props.fileName) return h("span", attrs, props.getFileIcon(props.fileName));
597
+ return null;
598
+ };
599
+ }
600
+ });
601
+ //#endregion
602
+ //#region src/CodeHighlightTabs/CodeHighlightTabs.ts
603
+ var CodeHighlightTabs = defineComponent({
604
+ name: "CodeHighlightTabs",
605
+ inheritAttrs: false,
606
+ props: {
607
+ code: {
608
+ type: Array,
609
+ required: true
610
+ },
611
+ getFileIcon: {
612
+ type: Function,
613
+ default: void 0
614
+ },
615
+ defaultActiveTab: {
616
+ type: Number,
617
+ default: void 0
618
+ },
619
+ activeTab: {
620
+ type: Number,
621
+ default: void 0
622
+ },
623
+ onTabChange: {
624
+ type: Function,
625
+ default: void 0
626
+ },
627
+ defaultExpanded: {
628
+ type: Boolean,
629
+ default: void 0
630
+ },
631
+ expanded: {
632
+ type: Boolean,
633
+ default: void 0
634
+ },
635
+ onExpandedChange: {
636
+ type: Function,
637
+ default: void 0
638
+ },
639
+ withCopyButton: {
640
+ type: Boolean,
641
+ default: void 0
642
+ },
643
+ withExpandButton: {
644
+ type: Boolean,
645
+ default: false
646
+ },
647
+ withBorder: {
648
+ type: Boolean,
649
+ default: false
650
+ },
651
+ radius: {
652
+ type: [String, Number],
653
+ default: void 0
654
+ },
655
+ maxCollapsedHeight: {
656
+ type: [String, Number],
657
+ default: void 0
658
+ },
659
+ copyLabel: {
660
+ type: String,
661
+ default: void 0
662
+ },
663
+ copiedLabel: {
664
+ type: String,
665
+ default: void 0
666
+ },
667
+ expandCodeLabel: {
668
+ type: String,
669
+ default: void 0
670
+ },
671
+ collapseCodeLabel: {
672
+ type: String,
673
+ default: void 0
674
+ },
675
+ background: {
676
+ type: String,
677
+ default: void 0
678
+ },
679
+ controls: {
680
+ type: [Array, Function],
681
+ default: void 0
682
+ },
683
+ codeColorScheme: {
684
+ type: String,
685
+ default: void 0
686
+ },
687
+ withLineNumbers: {
688
+ type: Boolean,
689
+ default: false
690
+ },
691
+ classNames: {
692
+ type: [Object, Function],
693
+ default: void 0
694
+ },
695
+ styles: {
696
+ type: [Object, Function],
697
+ default: void 0
698
+ },
699
+ vars: {
700
+ type: [Object, Function],
701
+ default: void 0
702
+ },
703
+ unstyled: {
704
+ type: Boolean,
705
+ default: false
706
+ }
707
+ },
708
+ setup(rawProps, { attrs }) {
709
+ const props = useProps("CodeHighlightTabs", null, rawProps);
710
+ const getStyles = useStyles({
711
+ name: "CodeHighlightTabs",
712
+ classes: CodeHighlight_module_default,
713
+ props,
714
+ className: attrs.class,
715
+ style: attrs.style,
716
+ classNames: props.classNames,
717
+ styles: props.styles,
718
+ unstyled: props.unstyled,
719
+ vars: props.vars
720
+ });
721
+ const [value, setValue] = useUncontrolled({
722
+ defaultValue: props.defaultActiveTab,
723
+ value: () => props.activeTab,
724
+ finalValue: 0,
725
+ onChange: (tab) => props.onTabChange?.(tab)
726
+ });
727
+ const [expanded, setExpanded] = useUncontrolled({
728
+ defaultValue: props.defaultExpanded,
729
+ value: () => props.expanded,
730
+ finalValue: true,
731
+ onChange: (next) => props.onExpandedChange?.(next)
732
+ });
733
+ watch(() => [value.value, props.code.length], ([currentValue, length]) => {
734
+ if (currentValue >= length) setValue(length - 1);
735
+ }, { immediate: true });
736
+ return () => {
737
+ if (props.code.length <= 0) return null;
738
+ const currentCode = props.code[value.value] || {
739
+ code: "",
740
+ language: "tsx",
741
+ fileName: ""
742
+ };
743
+ const files = props.code.map((node, index) => h(UnstyledButton, {
744
+ ...getStyles("file"),
745
+ key: node.fileName ?? index,
746
+ mod: { active: index === value.value },
747
+ onClick: () => setValue(index),
748
+ "data-color-scheme": props.codeColorScheme
749
+ }, () => [h(FileIcon, {
750
+ fileIcon: node.icon,
751
+ getFileIcon: props.getFileIcon,
752
+ fileName: node.fileName,
753
+ key: "file-icon",
754
+ ...getStyles("fileIcon")
755
+ }), h("span", { key: "file-name" }, node.fileName)]));
756
+ return h(Box, {
757
+ ...attrs,
758
+ ...getStyles("root")
759
+ }, () => [h(ScrollArea, {
760
+ type: "never",
761
+ dir: "ltr",
762
+ offsetScrollbars: false,
763
+ ...getStyles("filesScrollarea")
764
+ }, () => h("div", getStyles("files"), files)), h(CodeHighlight, {
765
+ code: currentCode.code,
766
+ language: currentCode.language,
767
+ expanded: expanded.value,
768
+ onExpandedChange: setExpanded,
769
+ withCopyButton: props.withCopyButton,
770
+ withExpandButton: props.withExpandButton,
771
+ withBorder: props.withBorder,
772
+ radius: props.radius,
773
+ maxCollapsedHeight: props.maxCollapsedHeight,
774
+ copiedLabel: props.copiedLabel,
775
+ copyLabel: props.copyLabel,
776
+ expandCodeLabel: props.expandCodeLabel,
777
+ collapseCodeLabel: props.collapseCodeLabel,
778
+ background: props.background,
779
+ controls: props.controls,
780
+ codeColorScheme: props.codeColorScheme,
781
+ withLineNumbers: props.withLineNumbers,
782
+ __withOffset: true,
783
+ __staticSelector: "CodeHighlightTabs",
784
+ classNames: props.classNames,
785
+ styles: props.styles
786
+ })]);
787
+ };
788
+ }
789
+ });
790
+ Object.assign(CodeHighlightTabs, { classes: CodeHighlight_module_default });
791
+ //#endregion
792
+ //#region src/CodeHighlightProvider/adapters/highlight-js-adapter.ts
793
+ function createHighlightJsAdapter(hljs) {
794
+ return { getHighlighter: () => ({ code, language }) => {
795
+ const lang = hljs.getLanguage(language) ? language : "plaintext";
796
+ return {
797
+ highlightedCode: hljs.highlight(code.trim(), { language: lang }).value,
798
+ isHighlighted: true,
799
+ codeElementProps: { class: `hljs ${lang}` }
800
+ };
801
+ } };
802
+ }
803
+ //#endregion
804
+ //#region src/CodeHighlightProvider/adapters/shiki-themes.ts
805
+ var light = {
806
+ colors: {
807
+ "activityBar.activeBorder": "#fd8c73",
808
+ "activityBar.background": "#ffffff",
809
+ "activityBar.border": "#d0d7de",
810
+ "activityBar.foreground": "#1f2328",
811
+ "activityBar.inactiveForeground": "#656d76",
812
+ "activityBarBadge.background": "#0969da",
813
+ "activityBarBadge.foreground": "#ffffff",
814
+ "badge.background": "#0969da",
815
+ "badge.foreground": "#ffffff",
816
+ "breadcrumb.activeSelectionForeground": "#656d76",
817
+ "breadcrumb.focusForeground": "#1f2328",
818
+ "breadcrumb.foreground": "#656d76",
819
+ "breadcrumbPicker.background": "#ffffff",
820
+ "button.background": "#1f883d",
821
+ "button.foreground": "#ffffff",
822
+ "button.hoverBackground": "#1a7f37",
823
+ "button.secondaryBackground": "#ebecf0",
824
+ "button.secondaryForeground": "#24292f",
825
+ "button.secondaryHoverBackground": "#f3f4f6",
826
+ "checkbox.background": "#f6f8fa",
827
+ "checkbox.border": "#d0d7de",
828
+ "debugConsole.errorForeground": "#cf222e",
829
+ "debugConsole.infoForeground": "#57606a",
830
+ "debugConsole.sourceForeground": "#9a6700",
831
+ "debugConsole.warningForeground": "#7d4e00",
832
+ "debugConsoleInputIcon.foreground": "#6639ba",
833
+ "debugIcon.breakpointForeground": "#cf222e",
834
+ "debugTokenExpression.boolean": "#116329",
835
+ "debugTokenExpression.error": "#a40e26",
836
+ "debugTokenExpression.name": "#0550ae",
837
+ "debugTokenExpression.number": "#116329",
838
+ "debugTokenExpression.string": "#0a3069",
839
+ "debugTokenExpression.value": "#0a3069",
840
+ "debugToolBar.background": "#ffffff",
841
+ descriptionForeground: "#656d76",
842
+ "diffEditor.insertedLineBackground": "#aceebb4d",
843
+ "diffEditor.insertedTextBackground": "#6fdd8b80",
844
+ "diffEditor.removedLineBackground": "#ffcecb4d",
845
+ "diffEditor.removedTextBackground": "#ff818266",
846
+ "dropdown.background": "#ffffff",
847
+ "dropdown.border": "#d0d7de",
848
+ "dropdown.foreground": "#1f2328",
849
+ "dropdown.listBackground": "#ffffff",
850
+ "editor.background": "#ffffff",
851
+ "editor.findMatchBackground": "#bf8700",
852
+ "editor.findMatchHighlightBackground": "#fae17d80",
853
+ "editor.focusedStackFrameHighlightBackground": "#4ac26b66",
854
+ "editor.foldBackground": "#6e77811a",
855
+ "editor.foreground": "#1f2328",
856
+ "editor.lineHighlightBackground": "#eaeef280",
857
+ "editor.linkedEditingBackground": "#0969da12",
858
+ "editor.selectionHighlightBackground": "#4ac26b40",
859
+ "editor.stackFrameHighlightBackground": "#d4a72c66",
860
+ "editor.wordHighlightBackground": "#eaeef280",
861
+ "editor.wordHighlightBorder": "#afb8c199",
862
+ "editor.wordHighlightStrongBackground": "#afb8c14d",
863
+ "editor.wordHighlightStrongBorder": "#afb8c199",
864
+ "editorBracketHighlight.foreground1": "#0969da",
865
+ "editorBracketHighlight.foreground2": "#1a7f37",
866
+ "editorBracketHighlight.foreground3": "#9a6700",
867
+ "editorBracketHighlight.foreground4": "#cf222e",
868
+ "editorBracketHighlight.foreground5": "#bf3989",
869
+ "editorBracketHighlight.foreground6": "#8250df",
870
+ "editorBracketHighlight.unexpectedBracket.foreground": "#656d76",
871
+ "editorBracketMatch.background": "#4ac26b40",
872
+ "editorBracketMatch.border": "#4ac26b99",
873
+ "editorCursor.foreground": "#0969da",
874
+ "editorGroup.border": "#d0d7de",
875
+ "editorGroupHeader.tabsBackground": "#f6f8fa",
876
+ "editorGroupHeader.tabsBorder": "#d0d7de",
877
+ "editorGutter.addedBackground": "#4ac26b66",
878
+ "editorGutter.deletedBackground": "#ff818266",
879
+ "editorGutter.modifiedBackground": "#d4a72c66",
880
+ "editorIndentGuide.activeBackground": "#1f23283d",
881
+ "editorIndentGuide.background": "#1f23281f",
882
+ "editorInlayHint.background": "#afb8c133",
883
+ "editorInlayHint.foreground": "#656d76",
884
+ "editorInlayHint.paramBackground": "#afb8c133",
885
+ "editorInlayHint.paramForeground": "#656d76",
886
+ "editorInlayHint.typeBackground": "#afb8c133",
887
+ "editorInlayHint.typeForeground": "#656d76",
888
+ "editorLineNumber.activeForeground": "#1f2328",
889
+ "editorLineNumber.foreground": "#8c959f",
890
+ "editorOverviewRuler.border": "#ffffff",
891
+ "editorWhitespace.foreground": "#afb8c1",
892
+ "editorWidget.background": "#ffffff",
893
+ errorForeground: "#cf222e",
894
+ focusBorder: "#0969da",
895
+ foreground: "#1f2328",
896
+ "gitDecoration.addedResourceForeground": "#1a7f37",
897
+ "gitDecoration.conflictingResourceForeground": "#bc4c00",
898
+ "gitDecoration.deletedResourceForeground": "#cf222e",
899
+ "gitDecoration.ignoredResourceForeground": "#6e7781",
900
+ "gitDecoration.modifiedResourceForeground": "#9a6700",
901
+ "gitDecoration.submoduleResourceForeground": "#656d76",
902
+ "gitDecoration.untrackedResourceForeground": "#1a7f37",
903
+ "icon.foreground": "#656d76",
904
+ "input.background": "#ffffff",
905
+ "input.border": "#d0d7de",
906
+ "input.foreground": "#1f2328",
907
+ "input.placeholderForeground": "#6e7781",
908
+ "keybindingLabel.foreground": "#1f2328",
909
+ "list.activeSelectionBackground": "#afb8c133",
910
+ "list.activeSelectionForeground": "#1f2328",
911
+ "list.focusBackground": "#ddf4ff",
912
+ "list.focusForeground": "#1f2328",
913
+ "list.highlightForeground": "#0969da",
914
+ "list.hoverBackground": "#eaeef280",
915
+ "list.hoverForeground": "#1f2328",
916
+ "list.inactiveFocusBackground": "#ddf4ff",
917
+ "list.inactiveSelectionBackground": "#afb8c133",
918
+ "list.inactiveSelectionForeground": "#1f2328",
919
+ "minimapSlider.activeBackground": "#8c959f47",
920
+ "minimapSlider.background": "#8c959f33",
921
+ "minimapSlider.hoverBackground": "#8c959f3d",
922
+ "notificationCenterHeader.background": "#f6f8fa",
923
+ "notificationCenterHeader.foreground": "#656d76",
924
+ "notifications.background": "#ffffff",
925
+ "notifications.border": "#d0d7de",
926
+ "notifications.foreground": "#1f2328",
927
+ "notificationsErrorIcon.foreground": "#cf222e",
928
+ "notificationsInfoIcon.foreground": "#0969da",
929
+ "notificationsWarningIcon.foreground": "#9a6700",
930
+ "panel.background": "#f6f8fa",
931
+ "panel.border": "#d0d7de",
932
+ "panelInput.border": "#d0d7de",
933
+ "panelTitle.activeBorder": "#fd8c73",
934
+ "panelTitle.activeForeground": "#1f2328",
935
+ "panelTitle.inactiveForeground": "#656d76",
936
+ "pickerGroup.border": "#d0d7de",
937
+ "pickerGroup.foreground": "#656d76",
938
+ "progressBar.background": "#0969da",
939
+ "quickInput.background": "#ffffff",
940
+ "quickInput.foreground": "#1f2328",
941
+ "scrollbar.shadow": "#6e778133",
942
+ "scrollbarSlider.activeBackground": "#8c959f47",
943
+ "scrollbarSlider.background": "#8c959f33",
944
+ "scrollbarSlider.hoverBackground": "#8c959f3d",
945
+ "settings.headerForeground": "#1f2328",
946
+ "settings.modifiedItemIndicator": "#d4a72c66",
947
+ "sideBar.background": "#f6f8fa",
948
+ "sideBar.border": "#d0d7de",
949
+ "sideBar.foreground": "#1f2328",
950
+ "sideBarSectionHeader.background": "#f6f8fa",
951
+ "sideBarSectionHeader.border": "#d0d7de",
952
+ "sideBarSectionHeader.foreground": "#1f2328",
953
+ "sideBarTitle.foreground": "#1f2328",
954
+ "statusBar.background": "#ffffff",
955
+ "statusBar.border": "#d0d7de",
956
+ "statusBar.debuggingBackground": "#cf222e",
957
+ "statusBar.debuggingForeground": "#ffffff",
958
+ "statusBar.focusBorder": "#0969da80",
959
+ "statusBar.foreground": "#656d76",
960
+ "statusBar.noFolderBackground": "#ffffff",
961
+ "statusBarItem.activeBackground": "#1f23281f",
962
+ "statusBarItem.focusBorder": "#0969da",
963
+ "statusBarItem.hoverBackground": "#1f232814",
964
+ "statusBarItem.prominentBackground": "#afb8c133",
965
+ "statusBarItem.remoteBackground": "#eaeef2",
966
+ "statusBarItem.remoteForeground": "#1f2328",
967
+ "symbolIcon.arrayForeground": "#953800",
968
+ "symbolIcon.booleanForeground": "#0550ae",
969
+ "symbolIcon.classForeground": "#953800",
970
+ "symbolIcon.colorForeground": "#0a3069",
971
+ "symbolIcon.constantForeground": "#116329",
972
+ "symbolIcon.constructorForeground": "#3e1f79",
973
+ "symbolIcon.enumeratorForeground": "#953800",
974
+ "symbolIcon.enumeratorMemberForeground": "#0550ae",
975
+ "symbolIcon.eventForeground": "#57606a",
976
+ "symbolIcon.fieldForeground": "#953800",
977
+ "symbolIcon.fileForeground": "#7d4e00",
978
+ "symbolIcon.folderForeground": "#7d4e00",
979
+ "symbolIcon.functionForeground": "#6639ba",
980
+ "symbolIcon.interfaceForeground": "#953800",
981
+ "symbolIcon.keyForeground": "#0550ae",
982
+ "symbolIcon.keywordForeground": "#a40e26",
983
+ "symbolIcon.methodForeground": "#6639ba",
984
+ "symbolIcon.moduleForeground": "#a40e26",
985
+ "symbolIcon.namespaceForeground": "#a40e26",
986
+ "symbolIcon.nullForeground": "#0550ae",
987
+ "symbolIcon.numberForeground": "#116329",
988
+ "symbolIcon.objectForeground": "#953800",
989
+ "symbolIcon.operatorForeground": "#0a3069",
990
+ "symbolIcon.packageForeground": "#953800",
991
+ "symbolIcon.propertyForeground": "#953800",
992
+ "symbolIcon.referenceForeground": "#0550ae",
993
+ "symbolIcon.snippetForeground": "#0550ae",
994
+ "symbolIcon.stringForeground": "#0a3069",
995
+ "symbolIcon.structForeground": "#953800",
996
+ "symbolIcon.textForeground": "#0a3069",
997
+ "symbolIcon.typeParameterForeground": "#0a3069",
998
+ "symbolIcon.unitForeground": "#0550ae",
999
+ "symbolIcon.variableForeground": "#953800",
1000
+ "tab.activeBackground": "#ffffff",
1001
+ "tab.activeBorder": "#ffffff",
1002
+ "tab.activeBorderTop": "#fd8c73",
1003
+ "tab.activeForeground": "#1f2328",
1004
+ "tab.border": "#d0d7de",
1005
+ "tab.hoverBackground": "#ffffff",
1006
+ "tab.inactiveBackground": "#f6f8fa",
1007
+ "tab.inactiveForeground": "#656d76",
1008
+ "tab.unfocusedActiveBorder": "#ffffff",
1009
+ "tab.unfocusedActiveBorderTop": "#d0d7de",
1010
+ "tab.unfocusedHoverBackground": "#eaeef280",
1011
+ "terminal.ansiBlack": "#24292f",
1012
+ "terminal.ansiBlue": "#0969da",
1013
+ "terminal.ansiBrightBlack": "#57606a",
1014
+ "terminal.ansiBrightBlue": "#218bff",
1015
+ "terminal.ansiBrightCyan": "#3192aa",
1016
+ "terminal.ansiBrightGreen": "#1a7f37",
1017
+ "terminal.ansiBrightMagenta": "#a475f9",
1018
+ "terminal.ansiBrightRed": "#a40e26",
1019
+ "terminal.ansiBrightWhite": "#8c959f",
1020
+ "terminal.ansiBrightYellow": "#633c01",
1021
+ "terminal.ansiCyan": "#1b7c83",
1022
+ "terminal.ansiGreen": "#116329",
1023
+ "terminal.ansiMagenta": "#8250df",
1024
+ "terminal.ansiRed": "#cf222e",
1025
+ "terminal.ansiWhite": "#6e7781",
1026
+ "terminal.ansiYellow": "#4d2d00",
1027
+ "terminal.foreground": "#1f2328",
1028
+ "textBlockQuote.background": "#f6f8fa",
1029
+ "textBlockQuote.border": "#d0d7de",
1030
+ "textCodeBlock.background": "#afb8c133",
1031
+ "textLink.activeForeground": "#0969da",
1032
+ "textLink.foreground": "#0969da",
1033
+ "textPreformat.foreground": "#656d76",
1034
+ "textSeparator.foreground": "#d8dee4",
1035
+ "titleBar.activeBackground": "#ffffff",
1036
+ "titleBar.activeForeground": "#656d76",
1037
+ "titleBar.border": "#d0d7de",
1038
+ "titleBar.inactiveBackground": "#f6f8fa",
1039
+ "titleBar.inactiveForeground": "#656d76",
1040
+ "tree.indentGuidesStroke": "#d8dee4",
1041
+ "welcomePage.buttonBackground": "#f6f8fa",
1042
+ "welcomePage.buttonHoverBackground": "#f3f4f6"
1043
+ },
1044
+ displayName: "GitHub Light Default",
1045
+ semanticHighlighting: true,
1046
+ tokenColors: [
1047
+ {
1048
+ scope: [
1049
+ "comment",
1050
+ "punctuation.definition.comment",
1051
+ "string.comment"
1052
+ ],
1053
+ settings: { foreground: "#6e7781" }
1054
+ },
1055
+ {
1056
+ scope: ["constant.other.placeholder", "constant.character"],
1057
+ settings: { foreground: "#cf222e" }
1058
+ },
1059
+ {
1060
+ scope: [
1061
+ "constant",
1062
+ "entity.name.constant",
1063
+ "variable.other.constant",
1064
+ "variable.other.enummember",
1065
+ "variable.language",
1066
+ "entity"
1067
+ ],
1068
+ settings: { foreground: "#0550ae" }
1069
+ },
1070
+ {
1071
+ scope: [
1072
+ "entity.name",
1073
+ "meta.export.default",
1074
+ "meta.definition.variable"
1075
+ ],
1076
+ settings: { foreground: "#953800" }
1077
+ },
1078
+ {
1079
+ scope: [
1080
+ "variable.parameter.function",
1081
+ "meta.jsx.children",
1082
+ "meta.block",
1083
+ "meta.tag.attributes",
1084
+ "entity.name.constant",
1085
+ "meta.object.member",
1086
+ "meta.embedded.expression"
1087
+ ],
1088
+ settings: { foreground: "#1f2328" }
1089
+ },
1090
+ {
1091
+ scope: "entity.name.function",
1092
+ settings: { foreground: "#8250df" }
1093
+ },
1094
+ {
1095
+ scope: ["entity.name.tag", "support.class.component"],
1096
+ settings: { foreground: "#116329" }
1097
+ },
1098
+ {
1099
+ scope: "keyword",
1100
+ settings: { foreground: "#cf222e" }
1101
+ },
1102
+ {
1103
+ scope: ["storage", "storage.type"],
1104
+ settings: { foreground: "#cf222e" }
1105
+ },
1106
+ {
1107
+ scope: [
1108
+ "storage.modifier.package",
1109
+ "storage.modifier.import",
1110
+ "storage.type.java"
1111
+ ],
1112
+ settings: { foreground: "#1f2328" }
1113
+ },
1114
+ {
1115
+ scope: ["string", "string punctuation.section.embedded source"],
1116
+ settings: { foreground: "#0a3069" }
1117
+ },
1118
+ {
1119
+ scope: "support",
1120
+ settings: { foreground: "#0550ae" }
1121
+ },
1122
+ {
1123
+ scope: "meta.property-name",
1124
+ settings: { foreground: "#0550ae" }
1125
+ },
1126
+ {
1127
+ scope: "variable",
1128
+ settings: { foreground: "#953800" }
1129
+ },
1130
+ {
1131
+ scope: "variable.other",
1132
+ settings: { foreground: "#1f2328" }
1133
+ },
1134
+ {
1135
+ scope: "invalid.broken",
1136
+ settings: {
1137
+ fontStyle: "italic",
1138
+ foreground: "#82071e"
1139
+ }
1140
+ },
1141
+ {
1142
+ scope: "invalid.deprecated",
1143
+ settings: {
1144
+ fontStyle: "italic",
1145
+ foreground: "#82071e"
1146
+ }
1147
+ },
1148
+ {
1149
+ scope: "invalid.illegal",
1150
+ settings: {
1151
+ fontStyle: "italic",
1152
+ foreground: "#82071e"
1153
+ }
1154
+ },
1155
+ {
1156
+ scope: "invalid.unimplemented",
1157
+ settings: {
1158
+ fontStyle: "italic",
1159
+ foreground: "#82071e"
1160
+ }
1161
+ },
1162
+ {
1163
+ scope: "carriage-return",
1164
+ settings: {
1165
+ background: "#cf222e",
1166
+ content: "^M",
1167
+ fontStyle: "italic underline",
1168
+ foreground: "#f6f8fa"
1169
+ }
1170
+ },
1171
+ {
1172
+ scope: "message.error",
1173
+ settings: { foreground: "#82071e" }
1174
+ },
1175
+ {
1176
+ scope: "string variable",
1177
+ settings: { foreground: "#0550ae" }
1178
+ },
1179
+ {
1180
+ scope: ["source.regexp", "string.regexp"],
1181
+ settings: { foreground: "#0a3069" }
1182
+ },
1183
+ {
1184
+ scope: [
1185
+ "string.regexp.character-class",
1186
+ "string.regexp constant.character.escape",
1187
+ "string.regexp source.ruby.embedded",
1188
+ "string.regexp string.regexp.arbitrary-repitition"
1189
+ ],
1190
+ settings: { foreground: "#0a3069" }
1191
+ },
1192
+ {
1193
+ scope: "string.regexp constant.character.escape",
1194
+ settings: {
1195
+ fontStyle: "bold",
1196
+ foreground: "#116329"
1197
+ }
1198
+ },
1199
+ {
1200
+ scope: "support.constant",
1201
+ settings: { foreground: "#0550ae" }
1202
+ },
1203
+ {
1204
+ scope: "support.variable",
1205
+ settings: { foreground: "#0550ae" }
1206
+ },
1207
+ {
1208
+ scope: "support.type.property-name.json",
1209
+ settings: { foreground: "#116329" }
1210
+ },
1211
+ {
1212
+ scope: "meta.module-reference",
1213
+ settings: { foreground: "#0550ae" }
1214
+ },
1215
+ {
1216
+ scope: "punctuation.definition.list.begin.markdown",
1217
+ settings: { foreground: "#953800" }
1218
+ },
1219
+ {
1220
+ scope: ["markup.heading", "markup.heading entity.name"],
1221
+ settings: {
1222
+ fontStyle: "bold",
1223
+ foreground: "#0550ae"
1224
+ }
1225
+ },
1226
+ {
1227
+ scope: "markup.quote",
1228
+ settings: { foreground: "#116329" }
1229
+ },
1230
+ {
1231
+ scope: "markup.italic",
1232
+ settings: {
1233
+ fontStyle: "italic",
1234
+ foreground: "#1f2328"
1235
+ }
1236
+ },
1237
+ {
1238
+ scope: "markup.bold",
1239
+ settings: {
1240
+ fontStyle: "bold",
1241
+ foreground: "#1f2328"
1242
+ }
1243
+ },
1244
+ {
1245
+ scope: ["markup.underline"],
1246
+ settings: { fontStyle: "underline" }
1247
+ },
1248
+ {
1249
+ scope: ["markup.strikethrough"],
1250
+ settings: { fontStyle: "strikethrough" }
1251
+ },
1252
+ {
1253
+ scope: "markup.inline.raw",
1254
+ settings: { foreground: "#0550ae" }
1255
+ },
1256
+ {
1257
+ scope: [
1258
+ "markup.deleted",
1259
+ "meta.diff.header.from-file",
1260
+ "punctuation.definition.deleted"
1261
+ ],
1262
+ settings: {
1263
+ background: "#ffebe9",
1264
+ foreground: "#82071e"
1265
+ }
1266
+ },
1267
+ {
1268
+ scope: ["punctuation.section.embedded"],
1269
+ settings: { foreground: "#cf222e" }
1270
+ },
1271
+ {
1272
+ scope: [
1273
+ "markup.inserted",
1274
+ "meta.diff.header.to-file",
1275
+ "punctuation.definition.inserted"
1276
+ ],
1277
+ settings: {
1278
+ background: "#dafbe1",
1279
+ foreground: "#116329"
1280
+ }
1281
+ },
1282
+ {
1283
+ scope: ["markup.changed", "punctuation.definition.changed"],
1284
+ settings: {
1285
+ background: "#ffd8b5",
1286
+ foreground: "#953800"
1287
+ }
1288
+ },
1289
+ {
1290
+ scope: ["markup.ignored", "markup.untracked"],
1291
+ settings: {
1292
+ background: "#0550ae",
1293
+ foreground: "#eaeef2"
1294
+ }
1295
+ },
1296
+ {
1297
+ scope: "meta.diff.range",
1298
+ settings: {
1299
+ fontStyle: "bold",
1300
+ foreground: "#8250df"
1301
+ }
1302
+ },
1303
+ {
1304
+ scope: "meta.diff.header",
1305
+ settings: { foreground: "#0550ae" }
1306
+ },
1307
+ {
1308
+ scope: "meta.separator",
1309
+ settings: {
1310
+ fontStyle: "bold",
1311
+ foreground: "#0550ae"
1312
+ }
1313
+ },
1314
+ {
1315
+ scope: "meta.output",
1316
+ settings: { foreground: "#0550ae" }
1317
+ },
1318
+ {
1319
+ scope: [
1320
+ "brackethighlighter.tag",
1321
+ "brackethighlighter.curly",
1322
+ "brackethighlighter.round",
1323
+ "brackethighlighter.square",
1324
+ "brackethighlighter.angle",
1325
+ "brackethighlighter.quote"
1326
+ ],
1327
+ settings: { foreground: "#57606a" }
1328
+ },
1329
+ {
1330
+ scope: "brackethighlighter.unmatched",
1331
+ settings: { foreground: "#82071e" }
1332
+ },
1333
+ {
1334
+ scope: ["constant.other.reference.link", "string.other.link"],
1335
+ settings: { foreground: "#0a3069" }
1336
+ }
1337
+ ],
1338
+ type: "light"
1339
+ };
1340
+ var dark = {
1341
+ type: "dark",
1342
+ colors: {
1343
+ "dropdown.background": "#525252",
1344
+ "list.activeSelectionBackground": "#707070",
1345
+ "quickInputList.focusBackground": "#707070",
1346
+ "list.inactiveSelectionBackground": "#4e4e4e",
1347
+ "list.hoverBackground": "#444444",
1348
+ "list.highlightForeground": "#e58520",
1349
+ "button.background": "#565656",
1350
+ "editor.background": "#1e1e1e",
1351
+ "editor.foreground": "#c5c8c6",
1352
+ "editor.selectionBackground": "#676b7180",
1353
+ "minimap.selectionHighlight": "#676b7180",
1354
+ "editor.selectionHighlightBackground": "#575b6180",
1355
+ "editor.lineHighlightBackground": "#303030",
1356
+ "editorLineNumber.activeForeground": "#949494",
1357
+ "editor.wordHighlightBackground": "#4747a180",
1358
+ "editor.wordHighlightStrongBackground": "#6767ce80",
1359
+ "editorCursor.foreground": "#c07020",
1360
+ "editorWhitespace.foreground": "#505037",
1361
+ "editorIndentGuide.background": "#505037",
1362
+ "editorIndentGuide.activeBackground": "#707057",
1363
+ "editorGroupHeader.tabsBackground": "#282828",
1364
+ "tab.inactiveBackground": "#404040",
1365
+ "tab.border": "#303030",
1366
+ "tab.inactiveForeground": "#d8d8d8",
1367
+ "tab.lastPinnedBorder": "#505050",
1368
+ "peekView.border": "#3655b5",
1369
+ "panelTitle.activeForeground": "#ffffff",
1370
+ "statusBar.background": "#505050",
1371
+ "statusBar.debuggingBackground": "#505050",
1372
+ "statusBar.noFolderBackground": "#505050",
1373
+ "titleBar.activeBackground": "#505050",
1374
+ "statusBarItem.remoteBackground": "#3655b5",
1375
+ "ports.iconRunningProcessForeground": "#CCCCCC",
1376
+ "activityBar.background": "#353535",
1377
+ "activityBar.foreground": "#ffffff",
1378
+ "activityBarBadge.background": "#3655b5",
1379
+ "sideBar.background": "#272727",
1380
+ "sideBarSectionHeader.background": "#505050",
1381
+ "menu.background": "#272727",
1382
+ "menu.foreground": "#CCCCCC",
1383
+ "pickerGroup.foreground": "#b0b0b0",
1384
+ "inputOption.activeBorder": "#3655b5",
1385
+ focusBorder: "#3655b5",
1386
+ "terminal.ansiBlack": "#1e1e1e",
1387
+ "terminal.ansiRed": "#C4265E",
1388
+ "terminal.ansiGreen": "#86B42B",
1389
+ "terminal.ansiYellow": "#B3B42B",
1390
+ "terminal.ansiBlue": "#6A7EC8",
1391
+ "terminal.ansiMagenta": "#8C6BC8",
1392
+ "terminal.ansiCyan": "#56ADBC",
1393
+ "terminal.ansiWhite": "#e3e3dd",
1394
+ "terminal.ansiBrightBlack": "#666666",
1395
+ "terminal.ansiBrightRed": "#f92672",
1396
+ "terminal.ansiBrightGreen": "#A6E22E",
1397
+ "terminal.ansiBrightYellow": "#e2e22e",
1398
+ "terminal.ansiBrightBlue": "#819aff",
1399
+ "terminal.ansiBrightMagenta": "#AE81FF",
1400
+ "terminal.ansiBrightCyan": "#66D9EF",
1401
+ "terminal.ansiBrightWhite": "#f8f8f2",
1402
+ "terminal.inactiveSelectionBackground": "#676b7140"
1403
+ },
1404
+ tokenColors: [
1405
+ { settings: { foreground: "#C5C8C6" } },
1406
+ {
1407
+ scope: [
1408
+ "meta.embedded",
1409
+ "source.groovy.embedded",
1410
+ "variable.legacy.builtin.python"
1411
+ ],
1412
+ settings: { foreground: "#C5C8C6" }
1413
+ },
1414
+ {
1415
+ name: "Comment",
1416
+ scope: "comment",
1417
+ settings: {
1418
+ fontStyle: "",
1419
+ foreground: "#9A9B99"
1420
+ }
1421
+ },
1422
+ {
1423
+ name: "String",
1424
+ scope: "string",
1425
+ settings: {
1426
+ fontStyle: "",
1427
+ foreground: "#9AA83A"
1428
+ }
1429
+ },
1430
+ {
1431
+ name: "String Embedded Source",
1432
+ scope: "string source",
1433
+ settings: {
1434
+ fontStyle: "",
1435
+ foreground: "#D08442"
1436
+ }
1437
+ },
1438
+ {
1439
+ name: "Number",
1440
+ scope: "constant.numeric",
1441
+ settings: {
1442
+ fontStyle: "",
1443
+ foreground: "#6089B4"
1444
+ }
1445
+ },
1446
+ {
1447
+ name: "Built-in constant",
1448
+ scope: "constant.language",
1449
+ settings: {
1450
+ fontStyle: "",
1451
+ foreground: "#408080"
1452
+ }
1453
+ },
1454
+ {
1455
+ name: "User-defined constant",
1456
+ scope: "constant.character, constant.other",
1457
+ settings: {
1458
+ fontStyle: "",
1459
+ foreground: "#8080FF"
1460
+ }
1461
+ },
1462
+ {
1463
+ name: "Keyword",
1464
+ scope: "keyword",
1465
+ settings: {
1466
+ fontStyle: "",
1467
+ foreground: "#6089B4"
1468
+ }
1469
+ },
1470
+ {
1471
+ name: "Support",
1472
+ scope: "support",
1473
+ settings: {
1474
+ fontStyle: "",
1475
+ foreground: "#C7444A"
1476
+ }
1477
+ },
1478
+ {
1479
+ name: "Storage",
1480
+ scope: "storage",
1481
+ settings: {
1482
+ fontStyle: "",
1483
+ foreground: "#9872A2"
1484
+ }
1485
+ },
1486
+ {
1487
+ name: "Class name",
1488
+ scope: "entity.name.class, entity.name.type, entity.name.namespace, entity.name.scope-resolution",
1489
+ settings: {
1490
+ fontStyle: "",
1491
+ foreground: "#9B0000"
1492
+ }
1493
+ },
1494
+ {
1495
+ name: "Inherited class",
1496
+ scope: "entity.other.inherited-class",
1497
+ settings: {
1498
+ fontStyle: "",
1499
+ foreground: "#C7444A"
1500
+ }
1501
+ },
1502
+ {
1503
+ name: "Function name",
1504
+ scope: "entity.name.function",
1505
+ settings: {
1506
+ fontStyle: "",
1507
+ foreground: "#CE6700"
1508
+ }
1509
+ },
1510
+ {
1511
+ name: "Function argument",
1512
+ scope: "variable.parameter",
1513
+ settings: {
1514
+ fontStyle: "",
1515
+ foreground: "#6089B4"
1516
+ }
1517
+ },
1518
+ {
1519
+ name: "Tag name",
1520
+ scope: "entity.name.tag",
1521
+ settings: {
1522
+ fontStyle: "",
1523
+ foreground: "#9872A2"
1524
+ }
1525
+ },
1526
+ {
1527
+ name: "Tag attribute",
1528
+ scope: "entity.other.attribute-name",
1529
+ settings: {
1530
+ fontStyle: "",
1531
+ foreground: "#9872A2"
1532
+ }
1533
+ },
1534
+ {
1535
+ name: "Library function",
1536
+ scope: "support.function",
1537
+ settings: {
1538
+ fontStyle: "",
1539
+ foreground: "#9872A2"
1540
+ }
1541
+ },
1542
+ {
1543
+ name: "Keyword",
1544
+ scope: "keyword",
1545
+ settings: {
1546
+ fontStyle: "",
1547
+ foreground: "#676867"
1548
+ }
1549
+ },
1550
+ {
1551
+ name: "Class Variable",
1552
+ scope: "variable.other, variable.js, punctuation.separator.variable",
1553
+ settings: {
1554
+ fontStyle: "",
1555
+ foreground: "#6089B4"
1556
+ }
1557
+ },
1558
+ {
1559
+ name: "Meta Brace",
1560
+ scope: "punctuation.section.embedded -(source string source punctuation.section.embedded), meta.brace.erb.html",
1561
+ settings: {
1562
+ fontStyle: "",
1563
+ foreground: "#008200"
1564
+ }
1565
+ },
1566
+ {
1567
+ name: "Invalid",
1568
+ scope: "invalid",
1569
+ settings: {
1570
+ fontStyle: "",
1571
+ foreground: "#FF0B00"
1572
+ }
1573
+ },
1574
+ {
1575
+ name: "Normal Variable",
1576
+ scope: "variable.other.php, variable.other.normal",
1577
+ settings: {
1578
+ fontStyle: "",
1579
+ foreground: "#6089B4"
1580
+ }
1581
+ },
1582
+ {
1583
+ name: "Function Object",
1584
+ scope: "meta.function-call.object",
1585
+ settings: {
1586
+ fontStyle: "",
1587
+ foreground: "#9872A2"
1588
+ }
1589
+ },
1590
+ {
1591
+ name: "Function Call Variable",
1592
+ scope: "variable.other.property",
1593
+ settings: {
1594
+ fontStyle: "",
1595
+ foreground: "#9872A2"
1596
+ }
1597
+ },
1598
+ {
1599
+ name: "Keyword Control / Special",
1600
+ scope: [
1601
+ "keyword.control",
1602
+ "keyword.operator.new.cpp",
1603
+ "keyword.operator.delete.cpp",
1604
+ "keyword.other.using",
1605
+ "keyword.other.directive.using",
1606
+ "keyword.other.operator"
1607
+ ],
1608
+ settings: {
1609
+ fontStyle: "",
1610
+ foreground: "#9872A2"
1611
+ }
1612
+ },
1613
+ {
1614
+ name: "Tag",
1615
+ scope: "meta.tag",
1616
+ settings: {
1617
+ fontStyle: "",
1618
+ foreground: "#D0B344"
1619
+ }
1620
+ },
1621
+ {
1622
+ name: "Tag Name",
1623
+ scope: "entity.name.tag",
1624
+ settings: {
1625
+ fontStyle: "",
1626
+ foreground: "#6089B4"
1627
+ }
1628
+ },
1629
+ {
1630
+ name: "Doctype",
1631
+ scope: "meta.doctype, meta.tag.sgml-declaration.doctype, meta.tag.sgml.doctype",
1632
+ settings: {
1633
+ fontStyle: "",
1634
+ foreground: "#9AA83A"
1635
+ }
1636
+ },
1637
+ {
1638
+ name: "Tag Inline Source",
1639
+ scope: "meta.tag.inline source, text.html.php.source",
1640
+ settings: {
1641
+ fontStyle: "",
1642
+ foreground: "#9AA83A"
1643
+ }
1644
+ },
1645
+ {
1646
+ name: "Tag Other",
1647
+ scope: "meta.tag.other, entity.name.tag.style, entity.name.tag.script, meta.tag.block.script, source.js.embedded punctuation.definition.tag.html, source.css.embedded punctuation.definition.tag.html",
1648
+ settings: {
1649
+ fontStyle: "",
1650
+ foreground: "#9872A2"
1651
+ }
1652
+ },
1653
+ {
1654
+ name: "Tag Attribute",
1655
+ scope: "entity.other.attribute-name, meta.tag punctuation.definition.string",
1656
+ settings: {
1657
+ fontStyle: "",
1658
+ foreground: "#D0B344"
1659
+ }
1660
+ },
1661
+ {
1662
+ name: "Tag Value",
1663
+ scope: "meta.tag string -source -punctuation, text source text meta.tag string -punctuation",
1664
+ settings: {
1665
+ fontStyle: "",
1666
+ foreground: "#6089B4"
1667
+ }
1668
+ },
1669
+ {
1670
+ name: "Meta Brace",
1671
+ scope: "punctuation.section.embedded -(source string source punctuation.section.embedded), meta.brace.erb.html",
1672
+ settings: {
1673
+ fontStyle: "",
1674
+ foreground: "#D0B344"
1675
+ }
1676
+ },
1677
+ {
1678
+ name: "HTML ID",
1679
+ scope: "meta.toc-list.id",
1680
+ settings: { foreground: "#9AA83A" }
1681
+ },
1682
+ {
1683
+ name: "HTML String",
1684
+ scope: "string.quoted.double.html, punctuation.definition.string.begin.html, punctuation.definition.string.end.html, punctuation.definition.string.end.html source, string.quoted.double.html source",
1685
+ settings: {
1686
+ fontStyle: "",
1687
+ foreground: "#9AA83A"
1688
+ }
1689
+ },
1690
+ {
1691
+ name: "HTML Tags",
1692
+ scope: "punctuation.definition.tag.html, punctuation.definition.tag.begin, punctuation.definition.tag.end",
1693
+ settings: {
1694
+ fontStyle: "",
1695
+ foreground: "#6089B4"
1696
+ }
1697
+ },
1698
+ {
1699
+ name: "CSS ID",
1700
+ scope: "meta.selector entity.other.attribute-name.id",
1701
+ settings: {
1702
+ fontStyle: "",
1703
+ foreground: "#9872A2"
1704
+ }
1705
+ },
1706
+ {
1707
+ name: "CSS Property Name",
1708
+ scope: "source.css support.type.property-name",
1709
+ settings: {
1710
+ fontStyle: "",
1711
+ foreground: "#676867"
1712
+ }
1713
+ },
1714
+ {
1715
+ name: "CSS Property Value",
1716
+ scope: "meta.property-group support.constant.property-value, meta.property-value support.constant.property-value",
1717
+ settings: {
1718
+ fontStyle: "",
1719
+ foreground: "#C7444A"
1720
+ }
1721
+ },
1722
+ {
1723
+ name: "JavaScript Variable",
1724
+ scope: "variable.language.js",
1725
+ settings: { foreground: "#CC555A" }
1726
+ },
1727
+ {
1728
+ name: "Template Definition",
1729
+ scope: ["punctuation.definition.template-expression", "punctuation.section.embedded.coffee"],
1730
+ settings: { foreground: "#D08442" }
1731
+ },
1732
+ {
1733
+ name: "Reset JavaScript string interpolation expression",
1734
+ scope: ["meta.template.expression"],
1735
+ settings: { foreground: "#C5C8C6" }
1736
+ },
1737
+ {
1738
+ name: "PHP Function Call",
1739
+ scope: "meta.function-call.object.php",
1740
+ settings: {
1741
+ fontStyle: "",
1742
+ foreground: "#D0B344"
1743
+ }
1744
+ },
1745
+ {
1746
+ name: "PHP Single Quote HMTL Fix",
1747
+ scope: "punctuation.definition.string.end.php, punctuation.definition.string.begin.php",
1748
+ settings: { foreground: "#9AA83A" }
1749
+ },
1750
+ {
1751
+ name: "PHP Parenthesis HMTL Fix",
1752
+ scope: "source.php.embedded.line.html",
1753
+ settings: { foreground: "#676867" }
1754
+ },
1755
+ {
1756
+ name: "PHP Punctuation Embedded",
1757
+ scope: "punctuation.section.embedded.begin.php, punctuation.section.embedded.end.php",
1758
+ settings: {
1759
+ fontStyle: "",
1760
+ foreground: "#D08442"
1761
+ }
1762
+ },
1763
+ {
1764
+ name: "Ruby Symbol",
1765
+ scope: "constant.other.symbol.ruby",
1766
+ settings: {
1767
+ fontStyle: "",
1768
+ foreground: "#9AA83A"
1769
+ }
1770
+ },
1771
+ {
1772
+ name: "Ruby Variable",
1773
+ scope: "variable.language.ruby",
1774
+ settings: {
1775
+ fontStyle: "",
1776
+ foreground: "#D0B344"
1777
+ }
1778
+ },
1779
+ {
1780
+ name: "Ruby Special Method",
1781
+ scope: "keyword.other.special-method.ruby",
1782
+ settings: {
1783
+ fontStyle: "",
1784
+ foreground: "#D9B700"
1785
+ }
1786
+ },
1787
+ {
1788
+ name: "Ruby Embedded Source",
1789
+ scope: ["punctuation.section.embedded.begin.ruby", "punctuation.section.embedded.end.ruby"],
1790
+ settings: { foreground: "#D08442" }
1791
+ },
1792
+ {
1793
+ name: "SQL",
1794
+ scope: "keyword.other.DML.sql",
1795
+ settings: {
1796
+ fontStyle: "",
1797
+ foreground: "#D0B344"
1798
+ }
1799
+ },
1800
+ {
1801
+ name: "diff: header",
1802
+ scope: "meta.diff, meta.diff.header",
1803
+ settings: {
1804
+ fontStyle: "italic",
1805
+ foreground: "#E0EDDD"
1806
+ }
1807
+ },
1808
+ {
1809
+ name: "diff: deleted",
1810
+ scope: "markup.deleted",
1811
+ settings: {
1812
+ fontStyle: "",
1813
+ foreground: "#dc322f"
1814
+ }
1815
+ },
1816
+ {
1817
+ name: "diff: changed",
1818
+ scope: "markup.changed",
1819
+ settings: {
1820
+ fontStyle: "",
1821
+ foreground: "#cb4b16"
1822
+ }
1823
+ },
1824
+ {
1825
+ name: "diff: inserted",
1826
+ scope: "markup.inserted",
1827
+ settings: { foreground: "#219186" }
1828
+ },
1829
+ {
1830
+ name: "Markup Quote",
1831
+ scope: "markup.quote",
1832
+ settings: { foreground: "#9872A2" }
1833
+ },
1834
+ {
1835
+ name: "Markup Lists",
1836
+ scope: "markup.list",
1837
+ settings: { foreground: "#9AA83A" }
1838
+ },
1839
+ {
1840
+ name: "Markup Styling",
1841
+ scope: "markup.bold, markup.italic",
1842
+ settings: { foreground: "#6089B4" }
1843
+ },
1844
+ {
1845
+ name: "Markup Inline",
1846
+ scope: "markup.inline.raw",
1847
+ settings: {
1848
+ fontStyle: "",
1849
+ foreground: "#FF0080"
1850
+ }
1851
+ },
1852
+ {
1853
+ name: "Markup Headings",
1854
+ scope: "markup.heading",
1855
+ settings: { foreground: "#D0B344" }
1856
+ },
1857
+ {
1858
+ name: "Markup Setext Header",
1859
+ scope: "markup.heading.setext",
1860
+ settings: {
1861
+ fontStyle: "",
1862
+ foreground: "#D0B344"
1863
+ }
1864
+ },
1865
+ {
1866
+ name: "Markdown Headings",
1867
+ scope: "markup.heading.markdown",
1868
+ settings: { fontStyle: "bold" }
1869
+ },
1870
+ {
1871
+ name: "Markdown Quote",
1872
+ scope: "markup.quote.markdown",
1873
+ settings: {
1874
+ fontStyle: "italic",
1875
+ foreground: ""
1876
+ }
1877
+ },
1878
+ {
1879
+ name: "Markdown Bold",
1880
+ scope: "markup.bold.markdown",
1881
+ settings: { fontStyle: "bold" }
1882
+ },
1883
+ {
1884
+ name: "Markdown Link Title/Description",
1885
+ scope: "string.other.link.title.markdown,string.other.link.description.markdown",
1886
+ settings: { foreground: "#AE81FF" }
1887
+ },
1888
+ {
1889
+ name: "Markdown Underline Link/Image",
1890
+ scope: "markup.underline.link.markdown,markup.underline.link.image.markdown",
1891
+ settings: { foreground: "" }
1892
+ },
1893
+ {
1894
+ name: "Markdown Emphasis",
1895
+ scope: "markup.italic.markdown",
1896
+ settings: { fontStyle: "italic" }
1897
+ },
1898
+ {
1899
+ scope: "markup.strikethrough",
1900
+ settings: { fontStyle: "strikethrough" }
1901
+ },
1902
+ {
1903
+ name: "Markdown Punctuation Definition Link",
1904
+ scope: "markup.list.unnumbered.markdown, markup.list.numbered.markdown",
1905
+ settings: { foreground: "" }
1906
+ },
1907
+ {
1908
+ name: "Markdown List Punctuation",
1909
+ scope: ["punctuation.definition.list.begin.markdown"],
1910
+ settings: { foreground: "" }
1911
+ },
1912
+ {
1913
+ scope: "token.info-token",
1914
+ settings: { foreground: "#6796e6" }
1915
+ },
1916
+ {
1917
+ scope: "token.warn-token",
1918
+ settings: { foreground: "#cd9731" }
1919
+ },
1920
+ {
1921
+ scope: "token.error-token",
1922
+ settings: { foreground: "#f44747" }
1923
+ },
1924
+ {
1925
+ scope: "token.debug-token",
1926
+ settings: { foreground: "#b267e6" }
1927
+ },
1928
+ {
1929
+ name: "this.self",
1930
+ scope: "variable.language",
1931
+ settings: { foreground: "#c7444a" }
1932
+ }
1933
+ ],
1934
+ semanticHighlighting: true
1935
+ };
1936
+ //#endregion
1937
+ //#region src/CodeHighlightProvider/adapters/shiki-adapter.ts
1938
+ function stripElement(openTag, data) {
1939
+ const openIndex = data.indexOf(`<${openTag}`);
1940
+ let closeIndex = openIndex + openTag.length;
1941
+ for (let i = openIndex; i < data.length; i += 1) if (data[i] === ">") {
1942
+ closeIndex = i;
1943
+ break;
1944
+ }
1945
+ return (data.slice(0, openIndex) + data.slice(closeIndex + 1)).replace(`</${openTag}>`, "");
1946
+ }
1947
+ function stripShikiCodeBlocks(data) {
1948
+ return stripElement("code", stripElement("pre", data));
1949
+ }
1950
+ var createShikiAdapter = (loadShiki, { forceColorScheme } = {}) => ({
1951
+ loadContext: loadShiki,
1952
+ getHighlighter: (ctx) => {
1953
+ if (!ctx) return ({ code }) => ({
1954
+ highlightedCode: code,
1955
+ isHighlighted: false
1956
+ });
1957
+ return ({ code, language, colorScheme }) => {
1958
+ let _colorScheme = colorScheme;
1959
+ if (colorScheme === "light") _colorScheme = light;
1960
+ else if (colorScheme === "dark") _colorScheme = dark;
1961
+ return {
1962
+ isHighlighted: true,
1963
+ highlightedCode: stripShikiCodeBlocks(ctx.codeToHtml(code, {
1964
+ lang: language,
1965
+ theme: forceColorScheme || _colorScheme
1966
+ }))
1967
+ };
1968
+ };
1969
+ }
1970
+ });
1971
+ //#endregion
1972
+ export { CodeHighlight, CodeHighlightAdapterProvider, CodeHighlightControl, CodeHighlightTabs, InlineCodeHighlight, createHighlightJsAdapter, createShikiAdapter, plainTextAdapter, stripShikiCodeBlocks, useCodeHighlightContext, useHighlight };
1973
+
1974
+ //# sourceMappingURL=index.mjs.map