@mantine-vue/code-highlight 3.0.0 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/cjs/index.cjs +511 -576
  2. package/cjs/index.cjs.map +1 -1
  3. package/esm/index.mjs +511 -576
  4. package/esm/index.mjs.map +1 -1
  5. package/lib/CodeHighlight/CodeHighlight.d.ts +46 -496
  6. package/lib/CodeHighlight/CodeHighlight.types.d.ts +80 -0
  7. package/lib/CodeHighlight/CodeHighlight.vue.d.ts +17 -0
  8. package/lib/CodeHighlight/CodeHighlightControl/CodeHighlightControl.d.ts +2 -68
  9. package/lib/CodeHighlight/CodeHighlightControl/CodeHighlightControl.types.d.ts +20 -0
  10. package/lib/CodeHighlight/CodeHighlightControl/CodeHighlightControl.vue.d.ts +15 -0
  11. package/lib/CodeHighlight/CopyCodeButton/CopyCodeButton.d.ts +1 -32
  12. package/lib/CodeHighlight/CopyCodeButton/CopyCodeButton.vue.d.ts +8 -0
  13. package/lib/CodeHighlight/CopyCodeButton/CopyIcon.d.ts +1 -13
  14. package/lib/CodeHighlight/CopyCodeButton/CopyIcon.vue.d.ts +6 -0
  15. package/lib/CodeHighlight/ExpandCodeButton/ExpandCodeButton.d.ts +1 -41
  16. package/lib/CodeHighlight/ExpandCodeButton/ExpandCodeButton.vue.d.ts +15 -0
  17. package/lib/CodeHighlight/ExpandCodeButton/ExpandIcon.d.ts +1 -13
  18. package/lib/CodeHighlight/ExpandCodeButton/ExpandIcon.vue.d.ts +6 -0
  19. package/lib/CodeHighlight/InlineCodeHighlight.d.ts +16 -107
  20. package/lib/CodeHighlight/InlineCodeHighlight.types.d.ts +30 -0
  21. package/lib/CodeHighlight/InlineCodeHighlight.vue.d.ts +5 -0
  22. package/lib/CodeHighlightProvider/CodeHighlightAdapterProvider.vue.d.ts +14 -0
  23. package/lib/CodeHighlightProvider/CodeHighlightProvider.d.ts +19 -32
  24. package/lib/CodeHighlightProvider/CodeHighlightProvider.types.d.ts +25 -0
  25. package/lib/CodeHighlightTabs/CodeHighlightTabs.d.ts +43 -262
  26. package/lib/CodeHighlightTabs/CodeHighlightTabs.types.d.ts +47 -0
  27. package/lib/CodeHighlightTabs/CodeHighlightTabs.vue.d.ts +21 -0
  28. package/lib/CodeHighlightTabs/FileIcon.d.ts +1 -40
  29. package/lib/CodeHighlightTabs/FileIcon.vue.d.ts +21 -0
  30. package/lib/index.d.mts +3 -3
  31. package/lib/index.d.ts +3 -3
  32. package/package.json +3 -3
package/cjs/index.cjs CHANGED
@@ -1,301 +1,284 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ let vue = require("vue");
2
3
  let _mantine_vue_core = require("@mantine-vue/core");
3
4
  let _mantine_vue_hooks = require("@mantine-vue/hooks");
4
- let vue = require("vue");
5
- var CodeHighlight_module_default = {
6
- root: "_root_1avu3_1",
7
- codeHighlight: "_codeHighlight_1avu3_5",
8
- inlineCodeHighlight: "_inlineCodeHighlight_1avu3_37",
9
- pre: "_pre_1avu3_71",
10
- code: "_code_1avu3_5",
11
- controls: "_controls_1avu3_101",
12
- control: "_control_1avu3_101",
13
- controlTooltip: "_controlTooltip_1avu3_146",
14
- codeWrapper: "_codeWrapper_1avu3_158",
15
- lineNumbers: "_lineNumbers_1avu3_165",
16
- scrollarea: "_scrollarea_1avu3_182",
17
- showCodeButton: "_showCodeButton_1avu3_207",
18
- file: "_file_1avu3_234",
19
- fileIcon: "_fileIcon_1avu3_305",
20
- filesScrollarea: "_filesScrollarea_1avu3_311",
21
- files: "_files_1avu3_311"
22
- };
23
- //#endregion
24
5
  //#region src/CodeHighlightProvider/adapters/plain-text-adapter.ts
25
6
  var plainTextAdapter = { getHighlighter: () => ({ code }) => ({
26
7
  highlightedCode: code,
27
8
  isHighlighted: false
28
9
  }) };
29
10
  //#endregion
30
- //#region src/CodeHighlightProvider/CodeHighlightProvider.ts
31
- var CodeHighlightContext = Symbol("CodeHighlightContext");
32
- function provideCodeHighlightAdapterContext(value) {
33
- (0, vue.provide)(CodeHighlightContext, value);
34
- }
35
- function useHighlight() {
36
- return (0, vue.inject)(CodeHighlightContext, null)?.highlight || plainTextAdapter.getHighlighter(null);
37
- }
38
- var CodeHighlightAdapterProvider = (0, vue.defineComponent)({
11
+ //#region src/CodeHighlightProvider/CodeHighlightAdapterProvider.vue?vue&type=script&setup=true&lang.ts
12
+ var _hoisted_1$1 = { style: { "display": "contents" } };
13
+ //#endregion
14
+ //#region src/CodeHighlightProvider/CodeHighlightAdapterProvider.vue
15
+ var CodeHighlightAdapterProvider_default = /* @__PURE__ */ (0, vue.defineComponent)({
39
16
  name: "CodeHighlightAdapterProvider",
40
- props: { adapter: {
41
- type: Object,
42
- required: true
43
- } },
44
- setup(props, { slots }) {
17
+ __name: "CodeHighlightAdapterProvider",
18
+ props: { adapter: {} },
19
+ setup(__props) {
20
+ const props = __props;
45
21
  const context = (0, vue.ref)(null);
46
22
  const highlight = (0, vue.computed)(() => props.adapter.getHighlighter(context.value));
47
- (0, vue.onMounted)(() => {
48
- props.adapter.loadContext?.().then((value) => {
49
- context.value = value;
50
- });
51
- });
23
+ (0, vue.onMounted)(() => props.adapter.loadContext?.().then((value) => {
24
+ context.value = value;
25
+ }));
52
26
  provideCodeHighlightAdapterContext({
53
27
  adapter: props.adapter,
54
28
  get highlight() {
55
29
  return highlight.value;
56
30
  }
57
31
  });
58
- return () => (0, vue.h)("div", { style: { display: "contents" } }, slots.default?.());
32
+ return (_ctx, _cache) => {
33
+ return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$1, [(0, vue.renderSlot)(_ctx.$slots, "default")]);
34
+ };
59
35
  }
60
36
  });
61
37
  //#endregion
38
+ //#region src/CodeHighlightProvider/CodeHighlightProvider.ts
39
+ var CodeHighlightContext = Symbol("CodeHighlightContext");
40
+ function provideCodeHighlightAdapterContext(value) {
41
+ (0, vue.provide)(CodeHighlightContext, value);
42
+ }
43
+ function useHighlight() {
44
+ return (0, vue.inject)(CodeHighlightContext, null)?.highlight || plainTextAdapter.getHighlighter(null);
45
+ }
46
+ var CodeHighlightAdapterProvider = CodeHighlightAdapterProvider_default;
47
+ //#endregion
62
48
  //#region src/CodeHighlight/CodeHighlight.context.ts
63
49
  var [provideCodeHighlightContext, useCodeHighlightContext] = (0, _mantine_vue_core.createSafeContext)("CodeHighlightProvider was not found in the component tree");
64
50
  //#endregion
65
- //#region src/CodeHighlight/CodeHighlightControl/CodeHighlightControl.ts
66
- var CodeHighlightControl = (0, vue.defineComponent)({
51
+ //#region src/CodeHighlight/CodeHighlightControl/CodeHighlightControl.vue
52
+ var CodeHighlightControl_default = /* @__PURE__ */ (0, vue.defineComponent)({
67
53
  name: "CodeHighlightControl",
68
54
  inheritAttrs: false,
55
+ __name: "CodeHighlightControl",
69
56
  props: {
70
- tooltipLabel: {
71
- type: String,
72
- default: void 0
73
- },
74
- classNames: {
75
- type: [Object, Function],
76
- default: void 0
77
- },
78
- styles: {
79
- type: [Object, Function],
80
- default: void 0
81
- },
82
- vars: {
83
- type: [Object, Function],
84
- default: void 0
85
- },
86
- component: {
87
- type: String,
88
- default: "button"
89
- },
90
- onClick: {
91
- type: Function,
92
- default: void 0
93
- }
57
+ tooltipLabel: {},
58
+ component: { default: "button" },
59
+ classNames: {},
60
+ styles: {},
61
+ vars: {}
94
62
  },
95
- setup(rawProps, { attrs, slots }) {
63
+ emits: ["click"],
64
+ setup(__props, { emit: __emit }) {
65
+ const rawProps = __props;
66
+ const emit = __emit;
96
67
  const props = (0, _mantine_vue_core.useProps)("CodeHighlightControl", null, rawProps);
68
+ const attrs = (0, vue.useAttrs)();
97
69
  const ctx = useCodeHighlightContext();
98
- return () => {
99
- const tooltipStyles = ctx.getStyles("controlTooltip");
100
- const control = (0, vue.h)(_mantine_vue_core.ActionIcon, {
101
- ...ctx.getStyles("control"),
102
- ...attrs,
103
- component: props.component,
104
- variant: "none",
105
- "data-code-color-scheme": ctx.codeColorScheme,
106
- onClick: props.onClick
107
- }, slots);
108
- return props.tooltipLabel ? (0, vue.h)(_mantine_vue_core.Tooltip, {
109
- label: props.tooltipLabel,
70
+ const tooltipStyles = (0, vue.computed)(() => ctx.getStyles("controlTooltip"));
71
+ return (_ctx, _cache) => {
72
+ return (0, vue.unref)(props).tooltipLabel ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_mantine_vue_core.Tooltip), {
73
+ key: 0,
74
+ label: (0, vue.unref)(props).tooltipLabel,
110
75
  fz: "sm",
111
76
  position: "bottom",
112
- classNames: { tooltip: tooltipStyles.class },
113
- styles: { tooltip: tooltipStyles.style },
114
- "data-code-color-scheme": ctx.codeColorScheme,
115
- transitionProps: { duration: 0 }
116
- }, () => control) : control;
77
+ "class-names": { tooltip: tooltipStyles.value.class },
78
+ styles: { tooltip: tooltipStyles.value.style },
79
+ "data-code-color-scheme": (0, vue.unref)(ctx).codeColorScheme,
80
+ "transition-props": { duration: 0 }
81
+ }, {
82
+ default: (0, vue.withCtx)(() => [(0, vue.createVNode)((0, vue.unref)(_mantine_vue_core.ActionIcon), (0, vue.mergeProps)({
83
+ ...(0, vue.unref)(ctx).getStyles("control"),
84
+ ...(0, vue.unref)(attrs)
85
+ }, {
86
+ component: (0, vue.unref)(props).component,
87
+ variant: "none",
88
+ "data-code-color-scheme": (0, vue.unref)(ctx).codeColorScheme,
89
+ onClick: _cache[0] || (_cache[0] = (event) => emit("click", event))
90
+ }), {
91
+ default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default")]),
92
+ _: 3
93
+ }, 16, ["component", "data-code-color-scheme"])]),
94
+ _: 3
95
+ }, 8, [
96
+ "label",
97
+ "class-names",
98
+ "styles",
99
+ "data-code-color-scheme"
100
+ ])) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_mantine_vue_core.ActionIcon), (0, vue.mergeProps)({ key: 1 }, {
101
+ ...(0, vue.unref)(ctx).getStyles("control"),
102
+ ...(0, vue.unref)(attrs)
103
+ }, {
104
+ component: (0, vue.unref)(props).component,
105
+ variant: "none",
106
+ "data-code-color-scheme": (0, vue.unref)(ctx).codeColorScheme,
107
+ onClick: _cache[1] || (_cache[1] = (event) => emit("click", event))
108
+ }), {
109
+ default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default")]),
110
+ _: 3
111
+ }, 16, ["component", "data-code-color-scheme"]));
117
112
  };
118
113
  }
119
114
  });
120
115
  //#endregion
121
- //#region src/CodeHighlight/CopyCodeButton/CopyIcon.ts
122
- var CopyIcon = (0, vue.defineComponent)({
116
+ //#region src/CodeHighlight/CopyCodeButton/CopyIcon.vue
117
+ var CopyIcon_default = /* @__PURE__ */ (0, vue.defineComponent)({
123
118
  name: "CopyIcon",
124
119
  inheritAttrs: false,
125
- props: { copied: {
126
- type: Boolean,
127
- required: true
128
- } },
129
- setup(props, { attrs }) {
130
- return () => (0, vue.h)("svg", {
131
- ...attrs,
132
- xmlns: "http://www.w3.org/2000/svg",
133
- viewBox: "0 0 24 24",
134
- strokeWidth: "2",
135
- stroke: "currentColor",
136
- fill: "none",
137
- strokeLinecap: "round",
138
- strokeLinejoin: "round"
139
- }, props.copied ? [(0, vue.h)("path", {
140
- stroke: "none",
141
- d: "M0 0h24v24H0z",
142
- fill: "none"
143
- }), (0, vue.h)("path", { d: "M5 12l5 5l10 -10" })] : [
144
- (0, vue.h)("path", {
120
+ __name: "CopyIcon",
121
+ props: { copied: { type: Boolean } },
122
+ setup(__props) {
123
+ return (_ctx, _cache) => {
124
+ return (0, vue.openBlock)(), (0, vue.createElementBlock)("svg", (0, vue.mergeProps)(_ctx.$attrs, {
125
+ xmlns: "http://www.w3.org/2000/svg",
126
+ viewBox: "0 0 24 24",
127
+ "stroke-width": "2",
128
+ stroke: "currentColor",
129
+ fill: "none",
130
+ "stroke-linecap": "round",
131
+ "stroke-linejoin": "round"
132
+ }), [__props.copied ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 0 }, [_cache[0] || (_cache[0] = (0, vue.createElementVNode)("path", {
145
133
  stroke: "none",
146
134
  d: "M0 0h24v24H0z",
147
135
  fill: "none"
148
- }),
149
- (0, vue.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" }),
150
- (0, vue.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" })
151
- ]);
136
+ }, null, -1)), _cache[1] || (_cache[1] = (0, vue.createElementVNode)("path", { d: "M5 12l5 5l10 -10" }, null, -1))], 64)) : ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 1 }, [
137
+ _cache[2] || (_cache[2] = (0, vue.createElementVNode)("path", {
138
+ stroke: "none",
139
+ d: "M0 0h24v24H0z",
140
+ fill: "none"
141
+ }, null, -1)),
142
+ _cache[3] || (_cache[3] = (0, vue.createElementVNode)("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" }, null, -1)),
143
+ _cache[4] || (_cache[4] = (0, vue.createElementVNode)("path", { d: "M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2" }, null, -1))
144
+ ], 64))], 16);
145
+ };
152
146
  }
153
147
  });
154
148
  //#endregion
155
- //#region src/CodeHighlight/CopyCodeButton/CopyCodeButton.ts
156
- var CopyCodeButton = (0, vue.defineComponent)({
149
+ //#region src/CodeHighlight/CopyCodeButton/CopyCodeButton.vue
150
+ var CopyCodeButton_default = /* @__PURE__ */ (0, vue.defineComponent)({
157
151
  name: "CopyCodeButton",
152
+ __name: "CopyCodeButton",
158
153
  props: {
159
- code: {
160
- type: String,
161
- required: true
162
- },
163
- copiedLabel: {
164
- type: String,
165
- default: "Copied"
166
- },
167
- copyLabel: {
168
- type: String,
169
- default: "Copy"
170
- }
154
+ code: {},
155
+ copiedLabel: { default: "Copied" },
156
+ copyLabel: { default: "Copy" }
171
157
  },
172
- setup(props) {
158
+ setup(__props) {
159
+ const props = __props;
173
160
  const clipboard = (0, _mantine_vue_hooks.useClipboard)();
174
- return () => (0, vue.h)(CodeHighlightControl, {
175
- onClick: () => clipboard.copy(props.code.trim()),
176
- variant: "none",
177
- tooltipLabel: clipboard.copied.value ? props.copiedLabel : props.copyLabel,
178
- "aria-label": clipboard.copied.value ? props.copiedLabel : `${props.copyLabel} code`
179
- }, () => (0, vue.h)(CopyIcon, { copied: clipboard.copied.value }));
161
+ return (_ctx, _cache) => {
162
+ return (0, vue.openBlock)(), (0, vue.createBlock)(CodeHighlightControl_default, {
163
+ variant: "none",
164
+ "tooltip-label": (0, vue.unref)(clipboard).copied.value ? props.copiedLabel : props.copyLabel,
165
+ "aria-label": (0, vue.unref)(clipboard).copied.value ? props.copiedLabel : `${props.copyLabel} code`,
166
+ onClick: _cache[0] || (_cache[0] = ($event) => (0, vue.unref)(clipboard).copy(props.code.trim()))
167
+ }, {
168
+ default: (0, vue.withCtx)(() => [(0, vue.createVNode)(CopyIcon_default, { copied: (0, vue.unref)(clipboard).copied.value }, null, 8, ["copied"])]),
169
+ _: 1
170
+ }, 8, ["tooltip-label", "aria-label"]);
171
+ };
180
172
  }
181
173
  });
182
174
  //#endregion
183
- //#region src/CodeHighlight/ExpandCodeButton/ExpandIcon.ts
184
- var ExpandIcon = (0, vue.defineComponent)({
175
+ //#region src/CodeHighlight/ExpandCodeButton/ExpandIcon.vue
176
+ var ExpandIcon_default = /* @__PURE__ */ (0, vue.defineComponent)({
185
177
  name: "ExpandIcon",
186
178
  inheritAttrs: false,
187
- props: { expanded: {
188
- type: Boolean,
189
- required: true
190
- } },
191
- setup(props, { attrs }) {
192
- return () => (0, vue.h)("svg", {
193
- ...attrs,
194
- xmlns: "http://www.w3.org/2000/svg",
195
- viewBox: "0 0 24 24",
196
- strokeWidth: "2",
197
- stroke: "currentColor",
198
- fill: "none",
199
- strokeLinecap: "round",
200
- strokeLinejoin: "round"
201
- }, props.expanded ? [
202
- (0, vue.h)("path", {
203
- stroke: "none",
204
- d: "M0 0h24v24H0z",
205
- fill: "none"
206
- }),
207
- (0, vue.h)("path", { d: "M12 13v-8l-3 3m6 0l-3 -3" }),
208
- (0, vue.h)("path", { d: "M9 17l1 0" }),
209
- (0, vue.h)("path", { d: "M14 17l1 0" }),
210
- (0, vue.h)("path", { d: "M19 17l1 0" }),
211
- (0, vue.h)("path", { d: "M4 17l1 0" })
212
- ] : [
213
- (0, vue.h)("path", {
179
+ __name: "ExpandIcon",
180
+ props: { expanded: { type: Boolean } },
181
+ setup(__props) {
182
+ return (_ctx, _cache) => {
183
+ return (0, vue.openBlock)(), (0, vue.createElementBlock)("svg", (0, vue.mergeProps)(_ctx.$attrs, {
184
+ xmlns: "http://www.w3.org/2000/svg",
185
+ viewBox: "0 0 24 24",
186
+ "stroke-width": "2",
187
+ stroke: "currentColor",
188
+ fill: "none",
189
+ "stroke-linecap": "round",
190
+ "stroke-linejoin": "round"
191
+ }), [_cache[2] || (_cache[2] = (0, vue.createElementVNode)("path", {
214
192
  stroke: "none",
215
193
  d: "M0 0h24v24H0z",
216
194
  fill: "none"
217
- }),
218
- (0, vue.h)("path", { d: "M12 11v8l3 -3m-6 0l3 3" }),
219
- (0, vue.h)("path", { d: "M9 7l1 0" }),
220
- (0, vue.h)("path", { d: "M14 7l1 0" }),
221
- (0, vue.h)("path", { d: "M19 7l1 0" }),
222
- (0, vue.h)("path", { d: "M4 7l1 0" })
223
- ]);
195
+ }, null, -1)), __props.expanded ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 0 }, [_cache[0] || (_cache[0] = (0, vue.createStaticVNode)("<path d=\"M12 13v-8l-3 3m6 0l-3 -3\"></path><path d=\"M9 17l1 0\"></path><path d=\"M14 17l1 0\"></path><path d=\"M19 17l1 0\"></path><path d=\"M4 17l1 0\"></path>", 5))], 64)) : ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 1 }, [_cache[1] || (_cache[1] = (0, vue.createStaticVNode)("<path d=\"M12 11v8l3 -3m-6 0l3 3\"></path><path d=\"M9 7l1 0\"></path><path d=\"M14 7l1 0\"></path><path d=\"M19 7l1 0\"></path><path d=\"M4 7l1 0\"></path>", 5))], 64))], 16);
196
+ };
224
197
  }
225
198
  });
226
199
  //#endregion
227
- //#region src/CodeHighlight/ExpandCodeButton/ExpandCodeButton.ts
228
- var ExpandCodeButton = (0, vue.defineComponent)({
200
+ //#region src/CodeHighlight/ExpandCodeButton/ExpandCodeButton.vue
201
+ var ExpandCodeButton_default = /* @__PURE__ */ (0, vue.defineComponent)({
229
202
  name: "ExpandCodeButton",
203
+ __name: "ExpandCodeButton",
230
204
  props: {
231
- expanded: {
232
- type: Boolean,
233
- required: true
234
- },
235
- onExpand: {
236
- type: Function,
237
- required: true
238
- },
239
- collapseCodeLabel: {
240
- type: String,
241
- default: "Collapse code"
242
- },
243
- expandCodeLabel: {
244
- type: String,
245
- default: "Expand code"
246
- }
205
+ expanded: { type: Boolean },
206
+ collapseCodeLabel: { default: "Collapse code" },
207
+ expandCodeLabel: { default: "Expand code" }
247
208
  },
248
- setup(props) {
249
- return () => (0, vue.h)(CodeHighlightControl, {
250
- onClick: () => props.onExpand(!props.expanded),
251
- tooltipLabel: props.expanded ? props.collapseCodeLabel : props.expandCodeLabel,
252
- "aria-label": props.expanded ? props.collapseCodeLabel : props.expandCodeLabel
253
- }, () => (0, vue.h)(ExpandIcon, { expanded: props.expanded }));
209
+ emits: ["expand"],
210
+ setup(__props, { emit: __emit }) {
211
+ const props = __props;
212
+ const emit = __emit;
213
+ return (_ctx, _cache) => {
214
+ return (0, vue.openBlock)(), (0, vue.createBlock)(CodeHighlightControl_default, {
215
+ "tooltip-label": props.expanded ? props.collapseCodeLabel : props.expandCodeLabel,
216
+ "aria-label": props.expanded ? props.collapseCodeLabel : props.expandCodeLabel,
217
+ onClick: _cache[0] || (_cache[0] = ($event) => emit("expand", !props.expanded))
218
+ }, {
219
+ default: (0, vue.withCtx)(() => [(0, vue.createVNode)(ExpandIcon_default, { expanded: props.expanded }, null, 8, ["expanded"])]),
220
+ _: 1
221
+ }, 8, ["tooltip-label", "aria-label"]);
222
+ };
254
223
  }
255
224
  });
256
- //#endregion
257
- //#region src/CodeHighlight/CodeHighlight.ts
258
- var defaultProps = {
259
- withCopyButton: true,
260
- expandCodeLabel: "Expand code",
261
- collapseCodeLabel: "Collapse code"
225
+ var CodeHighlight_module_default = {
226
+ root: "_root_1avu3_1",
227
+ codeHighlight: "_codeHighlight_1avu3_5",
228
+ inlineCodeHighlight: "_inlineCodeHighlight_1avu3_37",
229
+ pre: "_pre_1avu3_71",
230
+ code: "_code_1avu3_5",
231
+ controls: "_controls_1avu3_101",
232
+ control: "_control_1avu3_101",
233
+ controlTooltip: "_controlTooltip_1avu3_146",
234
+ codeWrapper: "_codeWrapper_1avu3_158",
235
+ lineNumbers: "_lineNumbers_1avu3_165",
236
+ scrollarea: "_scrollarea_1avu3_182",
237
+ showCodeButton: "_showCodeButton_1avu3_207",
238
+ file: "_file_1avu3_234",
239
+ fileIcon: "_fileIcon_1avu3_305",
240
+ filesScrollarea: "_filesScrollarea_1avu3_311",
241
+ files: "_files_1avu3_311"
262
242
  };
243
+ //#endregion
244
+ //#region src/CodeHighlight/CodeHighlight.vue?vue&type=script&setup=true&lang.ts
245
+ var _hoisted_1 = ["data-with-border", "innerHTML"];
246
+ var _hoisted_2 = ["data-with-border"];
247
+ var _hoisted_3 = ["data-with-offset"];
248
+ var _hoisted_4 = ["data-with-offset"];
249
+ var _hoisted_5 = ["data-with-offset"];
250
+ var _hoisted_6 = ["innerHTML"];
263
251
  var varsResolver$1 = (0, _mantine_vue_core.createVarsResolver)((theme, { maxCollapsedHeight, background, radius }) => ({ codeHighlight: {
264
252
  "--ch-max-height": (0, _mantine_vue_core.rem)(maxCollapsedHeight),
265
253
  "--ch-background": background ? (0, _mantine_vue_core.getThemeColor)(background, theme) : void 0,
266
254
  "--ch-radius": typeof radius !== "undefined" ? (0, _mantine_vue_core.getRadius)(radius) : void 0
267
255
  } }));
268
- function renderHtmlOrText(isHighlighted, highlightedCode, code) {
269
- return isHighlighted ? { innerHTML: highlightedCode } : { textContent: code.trim() };
270
- }
271
- function cx(...values) {
272
- return values.filter(Boolean);
273
- }
274
- function resolveColorScheme(value) {
275
- if (value !== "auto") return value;
276
- return typeof window !== "undefined" && window.matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light";
277
- }
278
- var CodeHighlightBase = (0, vue.defineComponent)({
256
+ //#endregion
257
+ //#region src/CodeHighlight/CodeHighlight.vue
258
+ var CodeHighlight_default = /* @__PURE__ */ (0, vue.defineComponent)({
279
259
  name: "CodeHighlight",
280
260
  inheritAttrs: false,
281
- slots: Object,
261
+ __name: "CodeHighlight",
282
262
  props: {
283
- code: {
284
- type: String,
285
- required: true
286
- },
287
- language: {
288
- type: String,
289
- default: void 0
290
- },
291
- copyLabel: {
292
- type: String,
293
- default: void 0
263
+ __withOffset: {
264
+ type: Boolean,
265
+ default: false
294
266
  },
295
- copiedLabel: {
296
- type: String,
297
- default: void 0
267
+ __staticSelector: {},
268
+ __inline: {
269
+ type: Boolean,
270
+ default: false
298
271
  },
272
+ code: {},
273
+ language: {},
274
+ classNames: {},
275
+ styles: {},
276
+ vars: {},
277
+ unstyled: { type: Boolean },
278
+ class: {},
279
+ style: {},
280
+ copyLabel: {},
281
+ copiedLabel: {},
299
282
  defaultExpanded: {
300
283
  type: Boolean,
301
284
  default: void 0
@@ -304,38 +287,19 @@ var CodeHighlightBase = (0, vue.defineComponent)({
304
287
  type: Boolean,
305
288
  default: void 0
306
289
  },
307
- onExpandedChange: {
308
- type: Function,
309
- default: void 0
310
- },
311
- maxCollapsedHeight: {
312
- type: [String, Number],
313
- default: void 0
314
- },
290
+ maxCollapsedHeight: {},
315
291
  withCopyButton: {
316
292
  type: Boolean,
317
- default: void 0
293
+ default: true
318
294
  },
319
295
  withExpandButton: {
320
296
  type: Boolean,
321
297
  default: false
322
298
  },
323
- expandCodeLabel: {
324
- type: String,
325
- default: void 0
326
- },
327
- collapseCodeLabel: {
328
- type: String,
329
- default: void 0
330
- },
331
- background: {
332
- type: String,
333
- default: void 0
334
- },
335
- radius: {
336
- type: [String, Number],
337
- default: void 0
338
- },
299
+ expandCodeLabel: { default: "Expand code" },
300
+ collapseCodeLabel: { default: "Collapse code" },
301
+ background: {},
302
+ radius: {},
339
303
  withBorder: {
340
304
  type: Boolean,
341
305
  default: false
@@ -344,45 +308,16 @@ var CodeHighlightBase = (0, vue.defineComponent)({
344
308
  type: Boolean,
345
309
  default: false
346
310
  },
347
- controls: {
348
- type: [Array, Function],
349
- default: void 0
350
- },
351
- codeColorScheme: {
352
- type: String,
353
- default: void 0
354
- },
355
- __withOffset: {
356
- type: Boolean,
357
- default: false
358
- },
359
- __staticSelector: {
360
- type: String,
361
- default: void 0
362
- },
363
- __inline: {
364
- type: Boolean,
365
- default: false
366
- },
367
- classNames: {
368
- type: [Object, Function],
369
- default: void 0
370
- },
371
- styles: {
372
- type: [Object, Function],
373
- default: void 0
374
- },
375
- vars: {
376
- type: [Object, Function],
377
- default: void 0
378
- },
379
- unstyled: {
380
- type: Boolean,
381
- default: false
382
- }
311
+ controls: {},
312
+ codeColorScheme: {}
383
313
  },
384
- setup(rawProps, { attrs, slots }) {
385
- const props = (0, _mantine_vue_core.useProps)("CodeHighlight", defaultProps, rawProps);
314
+ emits: ["update:expanded", "expanded-change"],
315
+ setup(__props, { emit: __emit }) {
316
+ const rawProps = __props;
317
+ const emit = __emit;
318
+ const props = (0, _mantine_vue_core.useProps)("CodeHighlight", null, rawProps);
319
+ const attrs = (0, vue.useAttrs)();
320
+ const slots = (0, vue.useSlots)();
386
321
  const mantine = (0, _mantine_vue_core.useMantineContext)();
387
322
  const getStyles = (0, _mantine_vue_core.useStyles)({
388
323
  name: props.__staticSelector || "CodeHighlight",
@@ -401,147 +336,161 @@ var CodeHighlightBase = (0, vue.defineComponent)({
401
336
  value: () => props.expanded,
402
337
  defaultValue: props.defaultExpanded,
403
338
  finalValue: true,
404
- onChange: (value) => props.onExpandedChange?.(value)
339
+ onChange: (value) => {
340
+ emit("update:expanded", value);
341
+ emit("expanded-change", value);
342
+ }
405
343
  });
406
344
  const highlight = useHighlight();
345
+ function resolveColorScheme(value) {
346
+ if (value !== "auto") return value;
347
+ return typeof window !== "undefined" && window.matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light";
348
+ }
349
+ const highlighted = (0, vue.computed)(() => highlight({
350
+ code: props.code.trim(),
351
+ language: props.language,
352
+ colorScheme: props.codeColorScheme ?? resolveColorScheme(mantine.colorScheme.value)
353
+ }));
354
+ const renderedControls = (0, vue.computed)(() => {
355
+ const value = props.controls !== void 0 ? typeof props.controls === "function" ? props.controls() : props.controls : slots.controls?.();
356
+ return Array.isArray(value) ? value : value ? [value] : [];
357
+ });
358
+ const shouldDisplayControls = (0, vue.computed)(() => renderedControls.value.length > 0 || props.withExpandButton || props.withCopyButton);
359
+ const lineNumbers = (0, vue.computed)(() => props.code.trim().split("\n").map((_, index) => index + 1));
360
+ const renderControls = () => renderedControls.value;
407
361
  provideCodeHighlightContext({
408
362
  getStyles,
409
363
  get codeColorScheme() {
410
364
  return props.codeColorScheme;
411
365
  }
412
366
  });
413
- return () => {
414
- const colorScheme = resolveColorScheme(mantine.colorScheme.value);
415
- const highlightedCode = highlight({
416
- code: props.code.trim(),
417
- language: props.language,
418
- colorScheme: props.codeColorScheme ?? colorScheme
419
- });
420
- const codeContent = renderHtmlOrText(highlightedCode.isHighlighted, highlightedCode.highlightedCode, props.code);
421
- if (props.__inline) return (0, vue.h)(_mantine_vue_core.Box, {
422
- component: "code",
423
- ...attrs,
424
- ...highlightedCode.codeElementProps,
425
- ...getStyles("codeHighlight", {
426
- className: cx(highlightedCode.codeElementProps?.class, attrs.class),
427
- style: [highlightedCode.codeElementProps?.style, attrs.style]
428
- }),
429
- "data-with-border": props.withBorder || void 0,
430
- ...codeContent
431
- });
432
- const renderedControls = props.controls !== void 0 ? typeof props.controls === "function" ? props.controls() : props.controls : slots.controls?.();
433
- const controlsArray = Array.isArray(renderedControls) ? renderedControls : renderedControls ? [renderedControls] : [];
434
- const shouldDisplayControls = controlsArray.length > 0 || props.withExpandButton || props.withCopyButton;
435
- return (0, vue.h)(_mantine_vue_core.Box, {
436
- ...attrs,
437
- ...getStyles("codeHighlight"),
367
+ return (_ctx, _cache) => {
368
+ return (0, vue.unref)(props).__inline && highlighted.value.isHighlighted ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("code", (0, vue.mergeProps)({ key: 0 }, {
369
+ ...(0, vue.unref)(attrs),
370
+ ...highlighted.value.codeElementProps,
371
+ ...(0, vue.unref)(getStyles)("codeHighlight", {
372
+ className: [highlighted.value.codeElementProps?.class, (0, vue.unref)(attrs).class],
373
+ style: [highlighted.value.codeElementProps?.style, (0, vue.unref)(attrs).style]
374
+ })
375
+ }, {
376
+ "data-with-border": (0, vue.unref)(props).withBorder || void 0,
377
+ innerHTML: highlighted.value.highlightedCode
378
+ }), null, 16, _hoisted_1)) : (0, vue.unref)(props).__inline ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("code", (0, vue.mergeProps)({ key: 1 }, {
379
+ ...(0, vue.unref)(attrs),
380
+ ...highlighted.value.codeElementProps,
381
+ ...(0, vue.unref)(getStyles)("codeHighlight", {
382
+ className: [highlighted.value.codeElementProps?.class, (0, vue.unref)(attrs).class],
383
+ style: [highlighted.value.codeElementProps?.style, (0, vue.unref)(attrs).style]
384
+ })
385
+ }, { "data-with-border": (0, vue.unref)(props).withBorder || void 0 }), (0, vue.toDisplayString)((0, vue.unref)(props).code.trim()), 17, _hoisted_2)) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_mantine_vue_core.Box), (0, vue.mergeProps)({ key: 2 }, {
386
+ ...(0, vue.unref)(attrs),
387
+ ...(0, vue.unref)(getStyles)("codeHighlight")
388
+ }, {
438
389
  dir: "ltr",
439
- "data-code-color-scheme": props.codeColorScheme,
440
- "data-with-border": props.withBorder || void 0
441
- }, () => [
442
- shouldDisplayControls ? (0, vue.h)("div", {
443
- ...getStyles("controls"),
444
- "data-with-offset": props.__withOffset || void 0
445
- }, [
446
- ...controlsArray,
447
- props.withExpandButton ? (0, vue.h)(ExpandCodeButton, {
448
- expanded: expanded.value,
449
- onExpand: setExpanded,
450
- expandCodeLabel: props.expandCodeLabel,
451
- collapseCodeLabel: props.collapseCodeLabel
452
- }) : null,
453
- props.withCopyButton ? (0, vue.h)(CopyCodeButton, {
454
- code: props.code,
455
- copiedLabel: props.copiedLabel,
456
- copyLabel: props.copyLabel
457
- }) : null
458
- ]) : null,
459
- (0, vue.h)(_mantine_vue_core.ScrollArea, {
460
- type: "hover",
461
- scrollbarSize: 4,
462
- dir: "ltr",
463
- offsetScrollbars: false,
464
- "data-collapsed": !expanded.value || void 0,
465
- styles: { viewport: { overscrollBehaviorInline: "none" } },
466
- ...getStyles("scrollarea")
467
- }, () => (0, vue.h)("div", getStyles("codeWrapper"), [props.withLineNumbers ? (0, vue.h)("div", {
468
- ...getStyles("lineNumbers"),
469
- "data-with-offset": props.__withOffset || void 0
470
- }, props.code.trim().split("\n").map((_, index) => (0, vue.h)("div", { key: index }, index + 1))) : null, (0, vue.h)("pre", {
471
- ...getStyles("pre"),
472
- "data-with-offset": props.__withOffset || void 0
473
- }, (0, vue.h)("code", {
474
- ...highlightedCode.codeElementProps,
475
- ...getStyles("code", {
476
- className: highlightedCode.codeElementProps?.class,
477
- style: highlightedCode.codeElementProps?.style
478
- }),
479
- ...codeContent
480
- }))])),
481
- (0, vue.h)(_mantine_vue_core.UnstyledButton, {
482
- ...getStyles("showCodeButton"),
483
- mod: { hidden: expanded.value },
484
- onClick: () => setExpanded(true),
485
- "data-code-color-scheme": props.codeColorScheme
486
- }, () => props.expandCodeLabel)
487
- ]);
390
+ "data-code-color-scheme": (0, vue.unref)(props).codeColorScheme,
391
+ "data-with-border": (0, vue.unref)(props).withBorder || void 0
392
+ }), {
393
+ default: (0, vue.withCtx)(() => [
394
+ shouldDisplayControls.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", (0, vue.mergeProps)({ key: 0 }, (0, vue.unref)(getStyles)("controls"), { "data-with-offset": (0, vue.unref)(props).__withOffset || void 0 }), [
395
+ ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(renderControls))),
396
+ (0, vue.unref)(props).withExpandButton ? ((0, vue.openBlock)(), (0, vue.createBlock)(ExpandCodeButton_default, {
397
+ key: 0,
398
+ expanded: (0, vue.unref)(expanded),
399
+ "expand-code-label": (0, vue.unref)(props).expandCodeLabel,
400
+ "collapse-code-label": (0, vue.unref)(props).collapseCodeLabel,
401
+ onExpand: (0, vue.unref)(setExpanded)
402
+ }, null, 8, [
403
+ "expanded",
404
+ "expand-code-label",
405
+ "collapse-code-label",
406
+ "onExpand"
407
+ ])) : (0, vue.createCommentVNode)("", true),
408
+ (0, vue.unref)(props).withCopyButton ? ((0, vue.openBlock)(), (0, vue.createBlock)(CopyCodeButton_default, {
409
+ key: 1,
410
+ code: (0, vue.unref)(props).code,
411
+ "copied-label": (0, vue.unref)(props).copiedLabel,
412
+ "copy-label": (0, vue.unref)(props).copyLabel
413
+ }, null, 8, [
414
+ "code",
415
+ "copied-label",
416
+ "copy-label"
417
+ ])) : (0, vue.createCommentVNode)("", true)
418
+ ], 16, _hoisted_3)) : (0, vue.createCommentVNode)("", true),
419
+ (0, vue.createVNode)((0, vue.unref)(_mantine_vue_core.ScrollArea), (0, vue.mergeProps)({
420
+ type: "hover",
421
+ "scrollbar-size": 4,
422
+ dir: "ltr",
423
+ "offset-scrollbars": false,
424
+ "data-collapsed": !(0, vue.unref)(expanded) || void 0,
425
+ styles: { viewport: { overscrollBehaviorInline: "none" } }
426
+ }, (0, vue.unref)(getStyles)("scrollarea")), {
427
+ default: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", (0, vue.normalizeProps)((0, vue.guardReactiveProps)((0, vue.unref)(getStyles)("codeWrapper"))), [(0, vue.unref)(props).withLineNumbers ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", (0, vue.mergeProps)({ key: 0 }, (0, vue.unref)(getStyles)("lineNumbers"), { "data-with-offset": (0, vue.unref)(props).__withOffset || void 0 }), [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(lineNumbers.value, (line) => {
428
+ return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", { key: line }, (0, vue.toDisplayString)(line), 1);
429
+ }), 128))], 16, _hoisted_4)) : (0, vue.createCommentVNode)("", true), (0, vue.createElementVNode)("pre", (0, vue.mergeProps)((0, vue.unref)(getStyles)("pre"), { "data-with-offset": (0, vue.unref)(props).__withOffset || void 0 }), [highlighted.value.isHighlighted ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("code", (0, vue.mergeProps)({ key: 0 }, {
430
+ ...highlighted.value.codeElementProps,
431
+ ...(0, vue.unref)(getStyles)("code", {
432
+ className: highlighted.value.codeElementProps?.class,
433
+ style: highlighted.value.codeElementProps?.style
434
+ })
435
+ }, { innerHTML: highlighted.value.highlightedCode }), null, 16, _hoisted_6)) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("code", (0, vue.normalizeProps)((0, vue.mergeProps)({ key: 1 }, {
436
+ ...highlighted.value.codeElementProps,
437
+ ...(0, vue.unref)(getStyles)("code", {
438
+ className: highlighted.value.codeElementProps?.class,
439
+ style: highlighted.value.codeElementProps?.style
440
+ })
441
+ })), (0, vue.toDisplayString)((0, vue.unref)(props).code.trim()), 17))], 16, _hoisted_5)], 16)]),
442
+ _: 1
443
+ }, 16, ["data-collapsed"]),
444
+ (0, vue.createVNode)((0, vue.unref)(_mantine_vue_core.UnstyledButton), (0, vue.mergeProps)((0, vue.unref)(getStyles)("showCodeButton"), {
445
+ mod: { hidden: (0, vue.unref)(expanded) },
446
+ "data-code-color-scheme": (0, vue.unref)(props).codeColorScheme,
447
+ onClick: _cache[0] || (_cache[0] = ($event) => (0, vue.unref)(setExpanded)(true))
448
+ }), {
449
+ default: (0, vue.withCtx)(() => [(0, vue.createTextVNode)((0, vue.toDisplayString)((0, vue.unref)(props).expandCodeLabel), 1)]),
450
+ _: 1
451
+ }, 16, ["mod", "data-code-color-scheme"])
452
+ ]),
453
+ _: 1
454
+ }, 16, ["data-code-color-scheme", "data-with-border"]));
488
455
  };
489
456
  }
490
457
  });
491
- var CodeHighlight = Object.assign(CodeHighlightBase, {
458
+ //#endregion
459
+ //#region src/CodeHighlight/CodeHighlight.ts
460
+ var CodeHighlight = Object.assign(CodeHighlight_default, {
492
461
  classes: CodeHighlight_module_default,
493
462
  varsResolver: varsResolver$1,
494
- Control: CodeHighlightControl
463
+ Control: CodeHighlightControl_default
495
464
  });
496
465
  //#endregion
497
- //#region src/CodeHighlight/InlineCodeHighlight.ts
466
+ //#region src/CodeHighlight/InlineCodeHighlight.vue?vue&type=script&setup=true&lang.ts
498
467
  var varsResolver = (0, _mantine_vue_core.createVarsResolver)((theme, { background, radius }) => ({ inlineCodeHighlight: {
499
468
  "--ch-background": background ? (0, _mantine_vue_core.getThemeColor)(background, theme) : void 0,
500
469
  "--ch-radius": typeof radius !== "undefined" ? (0, _mantine_vue_core.getRadius)(radius) : void 0
501
470
  } }));
502
- var InlineCodeHighlight = (0, vue.defineComponent)({
471
+ //#endregion
472
+ //#region src/CodeHighlight/InlineCodeHighlight.ts
473
+ var InlineCodeHighlight = Object.assign(/* @__PURE__ */ (0, vue.defineComponent)({
503
474
  name: "InlineCodeHighlight",
504
475
  inheritAttrs: false,
476
+ __name: "InlineCodeHighlight",
505
477
  props: {
506
- code: {
507
- type: String,
508
- required: true
509
- },
510
- language: {
511
- type: String,
512
- default: void 0
513
- },
514
- background: {
515
- type: String,
516
- default: void 0
517
- },
518
- radius: {
519
- type: [String, Number],
520
- default: void 0
521
- },
478
+ code: {},
479
+ language: {},
480
+ background: {},
481
+ radius: {},
522
482
  withBorder: {
523
483
  type: Boolean,
524
484
  default: false
525
485
  },
526
- classNames: {
527
- type: [Object, Function],
528
- default: void 0
529
- },
530
- styles: {
531
- type: [Object, Function],
532
- default: void 0
533
- },
534
- vars: {
535
- type: [Object, Function],
536
- default: void 0
537
- },
538
- unstyled: {
539
- type: Boolean,
540
- default: false
541
- }
486
+ classNames: {},
487
+ styles: {},
488
+ vars: {},
489
+ unstyled: { type: Boolean }
542
490
  },
543
- setup(rawProps, { attrs }) {
544
- const props = (0, _mantine_vue_core.useProps)("InlineCodeHighlight", null, rawProps);
491
+ setup(__props) {
492
+ const props = (0, _mantine_vue_core.useProps)("InlineCodeHighlight", null, __props);
493
+ const attrs = (0, vue.useAttrs)();
545
494
  const getStyles = (0, _mantine_vue_core.useStyles)({
546
495
  name: "InlineCodeHighlight",
547
496
  classes: CodeHighlight_module_default,
@@ -555,81 +504,68 @@ var InlineCodeHighlight = (0, vue.defineComponent)({
555
504
  varsResolver,
556
505
  rootSelector: "inlineCodeHighlight"
557
506
  });
558
- return () => (0, vue.h)(CodeHighlight, {
559
- ...attrs,
560
- ...props,
561
- ...getStyles("inlineCodeHighlight"),
562
- __inline: true
563
- });
507
+ return (_ctx, _cache) => {
508
+ return (0, vue.openBlock)(), (0, vue.createBlock)(CodeHighlight_default, (0, vue.mergeProps)({
509
+ ...(0, vue.unref)(attrs),
510
+ ...(0, vue.unref)(props),
511
+ ...(0, vue.unref)(getStyles)("inlineCodeHighlight")
512
+ }, { __inline: "" }), null, 16);
513
+ };
564
514
  }
565
- });
566
- Object.assign(InlineCodeHighlight, {
515
+ }), {
567
516
  classes: CodeHighlight_module_default,
568
517
  varsResolver
569
518
  });
570
519
  //#endregion
571
- //#region src/CodeHighlightTabs/FileIcon.ts
572
- var FileIcon = (0, vue.defineComponent)({
520
+ //#region src/CodeHighlightTabs/FileIcon.vue
521
+ var FileIcon_default = /* @__PURE__ */ (0, vue.defineComponent)({
573
522
  name: "FileIcon",
574
523
  inheritAttrs: false,
575
- slots: Object,
524
+ __name: "FileIcon",
576
525
  props: {
577
- fileName: {
578
- type: String,
579
- default: void 0
580
- },
581
- getFileIcon: {
582
- type: Function,
583
- default: void 0
584
- },
585
- fileIcon: {
586
- type: [
587
- String,
588
- Number,
589
- Object,
590
- Function,
591
- Array
592
- ],
593
- default: void 0
594
- }
526
+ fileName: {},
527
+ getFileIcon: { type: Function },
528
+ fileIcon: { type: [
529
+ Object,
530
+ String,
531
+ Number,
532
+ Boolean,
533
+ null,
534
+ Array
535
+ ] }
595
536
  },
596
- setup(props, { attrs, slots }) {
597
- return () => {
598
- if (props.fileIcon) return (0, vue.h)("span", attrs, props.fileIcon);
599
- if (props.getFileIcon && props.fileName) return (0, vue.h)("span", attrs, props.getFileIcon(props.fileName));
600
- if (slots.fileIcon) return (0, vue.h)("span", attrs, slots.fileIcon());
601
- if (slots.getFileIcon && props.fileName) return (0, vue.h)("span", attrs, slots.getFileIcon({ fileName: props.fileName }));
537
+ setup(__props) {
538
+ const props = __props;
539
+ const slots = (0, vue.useSlots)();
540
+ const renderIcon = () => {
541
+ if (props.fileIcon) return props.fileIcon;
542
+ if (props.getFileIcon && props.fileName) return props.getFileIcon(props.fileName);
543
+ if (slots.fileIcon) return slots.fileIcon();
544
+ if (slots.getFileIcon && props.fileName) return slots.getFileIcon({ fileName: props.fileName });
602
545
  return null;
603
546
  };
547
+ return (_ctx, _cache) => {
548
+ return renderIcon() ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", (0, vue.normalizeProps)((0, vue.mergeProps)({ key: 0 }, _ctx.$attrs)), [((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(renderIcon)))], 16)) : (0, vue.createCommentVNode)("", true);
549
+ };
604
550
  }
605
551
  });
606
552
  //#endregion
607
553
  //#region src/CodeHighlightTabs/CodeHighlightTabs.ts
608
- var CodeHighlightTabs = (0, vue.defineComponent)({
554
+ var CodeHighlightTabs = Object.assign(/* @__PURE__ */ (0, vue.defineComponent)({
609
555
  name: "CodeHighlightTabs",
610
556
  inheritAttrs: false,
611
- slots: Object,
557
+ __name: "CodeHighlightTabs",
612
558
  props: {
613
- code: {
614
- type: Array,
615
- required: true
616
- },
617
- getFileIcon: {
618
- type: Function,
619
- default: void 0
620
- },
621
- defaultActiveTab: {
622
- type: Number,
623
- default: void 0
624
- },
625
- activeTab: {
626
- type: Number,
627
- default: void 0
628
- },
629
- onTabChange: {
630
- type: Function,
631
- default: void 0
632
- },
559
+ code: {},
560
+ getFileIcon: {},
561
+ defaultActiveTab: {},
562
+ activeTab: {},
563
+ classNames: {},
564
+ styles: {},
565
+ vars: {},
566
+ unstyled: { type: Boolean },
567
+ copyLabel: {},
568
+ copiedLabel: {},
633
569
  defaultExpanded: {
634
570
  type: Boolean,
635
571
  default: void 0
@@ -638,81 +574,39 @@ var CodeHighlightTabs = (0, vue.defineComponent)({
638
574
  type: Boolean,
639
575
  default: void 0
640
576
  },
641
- onExpandedChange: {
642
- type: Function,
643
- default: void 0
644
- },
645
- withCopyButton: {
646
- type: Boolean,
647
- default: void 0
648
- },
577
+ maxCollapsedHeight: {},
578
+ withCopyButton: { type: Boolean },
649
579
  withExpandButton: {
650
580
  type: Boolean,
651
581
  default: false
652
582
  },
583
+ expandCodeLabel: {},
584
+ collapseCodeLabel: {},
585
+ background: {},
586
+ radius: {},
653
587
  withBorder: {
654
588
  type: Boolean,
655
589
  default: false
656
590
  },
657
- radius: {
658
- type: [String, Number],
659
- default: void 0
660
- },
661
- maxCollapsedHeight: {
662
- type: [String, Number],
663
- default: void 0
664
- },
665
- copyLabel: {
666
- type: String,
667
- default: void 0
668
- },
669
- copiedLabel: {
670
- type: String,
671
- default: void 0
672
- },
673
- expandCodeLabel: {
674
- type: String,
675
- default: void 0
676
- },
677
- collapseCodeLabel: {
678
- type: String,
679
- default: void 0
680
- },
681
- background: {
682
- type: String,
683
- default: void 0
684
- },
685
- controls: {
686
- type: [Array, Function],
687
- default: void 0
688
- },
689
- codeColorScheme: {
690
- type: String,
691
- default: void 0
692
- },
693
591
  withLineNumbers: {
694
592
  type: Boolean,
695
593
  default: false
696
594
  },
697
- classNames: {
698
- type: [Object, Function],
699
- default: void 0
700
- },
701
- styles: {
702
- type: [Object, Function],
703
- default: void 0
704
- },
705
- vars: {
706
- type: [Object, Function],
707
- default: void 0
708
- },
709
- unstyled: {
710
- type: Boolean,
711
- default: false
712
- }
595
+ controls: {},
596
+ codeColorScheme: {}
713
597
  },
714
- setup(rawProps, { attrs, slots }) {
598
+ emits: [
599
+ "update:activeTab",
600
+ "tab-change",
601
+ "update:expanded",
602
+ "expanded-change"
603
+ ],
604
+ setup(__props, { emit: __emit }) {
605
+ const rawProps = __props;
606
+ const emit = __emit;
715
607
  const props = (0, _mantine_vue_core.useProps)("CodeHighlightTabs", null, rawProps);
608
+ const attrs = (0, vue.useAttrs)();
609
+ const slots = (0, vue.useSlots)();
716
610
  const getStyles = (0, _mantine_vue_core.useStyles)({
717
611
  name: "CodeHighlightTabs",
718
612
  classes: CodeHighlight_module_default,
@@ -728,73 +622,114 @@ var CodeHighlightTabs = (0, vue.defineComponent)({
728
622
  defaultValue: props.defaultActiveTab,
729
623
  value: () => props.activeTab,
730
624
  finalValue: 0,
731
- onChange: (tab) => props.onTabChange?.(tab)
625
+ onChange: (tab) => {
626
+ emit("update:activeTab", tab);
627
+ emit("tab-change", tab);
628
+ }
732
629
  });
733
630
  const [expanded, setExpanded] = (0, _mantine_vue_hooks.useUncontrolled)({
734
631
  defaultValue: props.defaultExpanded,
735
632
  value: () => props.expanded,
736
633
  finalValue: true,
737
- onChange: (next) => props.onExpandedChange?.(next)
634
+ onChange: (next) => {
635
+ emit("update:expanded", next);
636
+ emit("expanded-change", next);
637
+ }
738
638
  });
739
- (0, vue.watch)(() => [value.value, props.code.length], ([currentValue, length]) => {
740
- if (currentValue >= length) setValue(length - 1);
639
+ (0, vue.watch)(() => [value.value, props.code.length], ([current, length]) => {
640
+ if (current >= length) setValue(length - 1);
741
641
  }, { immediate: true });
742
- return () => {
743
- if (props.code.length <= 0) return null;
744
- const currentCode = props.code[value.value] || {
745
- code: "",
746
- language: "tsx",
747
- fileName: ""
748
- };
749
- const getFileIcon = props.getFileIcon ?? (slots.getFileIcon ? (fileName) => slots.getFileIcon?.({ fileName }) : void 0);
750
- const files = props.code.map((node, index) => (0, vue.h)(_mantine_vue_core.UnstyledButton, {
751
- ...getStyles("file"),
752
- key: node.fileName ?? index,
753
- mod: { active: index === value.value },
754
- onClick: () => setValue(index),
755
- "data-color-scheme": props.codeColorScheme
756
- }, () => [(0, vue.h)(FileIcon, {
757
- fileIcon: node.icon,
758
- getFileIcon,
759
- fileName: node.fileName,
760
- key: "file-icon",
761
- ...getStyles("fileIcon")
762
- }), (0, vue.h)("span", { key: "file-name" }, node.fileName)]));
763
- return (0, vue.h)(_mantine_vue_core.Box, {
764
- ...attrs,
765
- ...getStyles("root")
766
- }, () => [(0, vue.h)(_mantine_vue_core.ScrollArea, {
767
- type: "never",
768
- dir: "ltr",
769
- offsetScrollbars: false,
770
- ...getStyles("filesScrollarea")
771
- }, () => (0, vue.h)("div", getStyles("files"), files)), (0, vue.h)(CodeHighlight, {
772
- code: currentCode.code,
773
- language: currentCode.language,
774
- expanded: expanded.value,
775
- onExpandedChange: setExpanded,
776
- withCopyButton: props.withCopyButton,
777
- withExpandButton: props.withExpandButton,
778
- withBorder: props.withBorder,
779
- radius: props.radius,
780
- maxCollapsedHeight: props.maxCollapsedHeight,
781
- copiedLabel: props.copiedLabel,
782
- copyLabel: props.copyLabel,
783
- expandCodeLabel: props.expandCodeLabel,
784
- collapseCodeLabel: props.collapseCodeLabel,
785
- background: props.background,
786
- controls: props.controls,
787
- codeColorScheme: props.codeColorScheme,
788
- withLineNumbers: props.withLineNumbers,
789
- __withOffset: true,
790
- __staticSelector: "CodeHighlightTabs",
791
- classNames: props.classNames,
792
- styles: props.styles
793
- }, { controls: slots.controls })]);
642
+ const currentCode = (0, vue.computed)(() => props.code[value.value] || {
643
+ code: "",
644
+ language: "tsx",
645
+ fileName: ""
646
+ });
647
+ const fileIconResolver = (0, vue.computed)(() => props.getFileIcon ?? (slots.getFileIcon ? (fileName) => slots.getFileIcon?.({ fileName }) : void 0));
648
+ return (_ctx, _cache) => {
649
+ return (0, vue.unref)(props).code.length ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_mantine_vue_core.Box), (0, vue.normalizeProps)((0, vue.mergeProps)({ key: 0 }, {
650
+ ...(0, vue.unref)(attrs),
651
+ ...(0, vue.unref)(getStyles)("root")
652
+ })), {
653
+ default: (0, vue.withCtx)(() => [(0, vue.createVNode)((0, vue.unref)(_mantine_vue_core.ScrollArea), (0, vue.mergeProps)({
654
+ type: "never",
655
+ dir: "ltr",
656
+ "offset-scrollbars": false
657
+ }, (0, vue.unref)(getStyles)("filesScrollarea")), {
658
+ default: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", (0, vue.normalizeProps)((0, vue.guardReactiveProps)((0, vue.unref)(getStyles)("files"))), [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)((0, vue.unref)(props).code, (node, index) => {
659
+ return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_mantine_vue_core.UnstyledButton), (0, vue.mergeProps)({ key: node.fileName ?? index }, { ref_for: true }, (0, vue.unref)(getStyles)("file"), {
660
+ mod: { active: index === (0, vue.unref)(value) },
661
+ "data-color-scheme": (0, vue.unref)(props).codeColorScheme,
662
+ onClick: ($event) => (0, vue.unref)(setValue)(index)
663
+ }), {
664
+ default: (0, vue.withCtx)(() => [(0, vue.createVNode)(FileIcon_default, (0, vue.mergeProps)({
665
+ "file-icon": node.icon,
666
+ "get-file-icon": fileIconResolver.value,
667
+ "file-name": node.fileName
668
+ }, { ref_for: true }, (0, vue.unref)(getStyles)("fileIcon")), null, 16, [
669
+ "file-icon",
670
+ "get-file-icon",
671
+ "file-name"
672
+ ]), (0, vue.createElementVNode)("span", null, (0, vue.toDisplayString)(node.fileName), 1)]),
673
+ _: 2
674
+ }, 1040, [
675
+ "mod",
676
+ "data-color-scheme",
677
+ "onClick"
678
+ ]);
679
+ }), 128))], 16)]),
680
+ _: 1
681
+ }, 16), (0, vue.createVNode)(CodeHighlight_default, {
682
+ code: currentCode.value.code,
683
+ language: currentCode.value.language,
684
+ expanded: (0, vue.unref)(expanded),
685
+ "with-copy-button": (0, vue.unref)(props).withCopyButton,
686
+ "with-expand-button": (0, vue.unref)(props).withExpandButton,
687
+ "with-border": (0, vue.unref)(props).withBorder,
688
+ radius: (0, vue.unref)(props).radius,
689
+ "max-collapsed-height": (0, vue.unref)(props).maxCollapsedHeight,
690
+ "copied-label": (0, vue.unref)(props).copiedLabel,
691
+ "copy-label": (0, vue.unref)(props).copyLabel,
692
+ "expand-code-label": (0, vue.unref)(props).expandCodeLabel,
693
+ "collapse-code-label": (0, vue.unref)(props).collapseCodeLabel,
694
+ background: (0, vue.unref)(props).background,
695
+ controls: (0, vue.unref)(props).controls,
696
+ "code-color-scheme": (0, vue.unref)(props).codeColorScheme,
697
+ "with-line-numbers": (0, vue.unref)(props).withLineNumbers,
698
+ "__with-offset": "",
699
+ "__static-selector": "CodeHighlightTabs",
700
+ onExpandedChange: (0, vue.unref)(setExpanded),
701
+ "class-names": (0, vue.unref)(props).classNames,
702
+ styles: (0, vue.unref)(props).styles
703
+ }, (0, vue.createSlots)({ _: 2 }, [_ctx.$slots.controls ? {
704
+ name: "controls",
705
+ fn: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "controls")]),
706
+ key: "0"
707
+ } : void 0]), 1032, [
708
+ "code",
709
+ "language",
710
+ "expanded",
711
+ "with-copy-button",
712
+ "with-expand-button",
713
+ "with-border",
714
+ "radius",
715
+ "max-collapsed-height",
716
+ "copied-label",
717
+ "copy-label",
718
+ "expand-code-label",
719
+ "collapse-code-label",
720
+ "background",
721
+ "controls",
722
+ "code-color-scheme",
723
+ "with-line-numbers",
724
+ "onExpandedChange",
725
+ "class-names",
726
+ "styles"
727
+ ])]),
728
+ _: 3
729
+ }, 16)) : (0, vue.createCommentVNode)("", true);
794
730
  };
795
731
  }
796
- });
797
- Object.assign(CodeHighlightTabs, { classes: CodeHighlight_module_default });
732
+ }), { classes: CodeHighlight_module_default });
798
733
  //#endregion
799
734
  //#region src/CodeHighlightProvider/adapters/highlight-js-adapter.ts
800
735
  function createHighlightJsAdapter(hljs) {
@@ -1978,7 +1913,7 @@ var createShikiAdapter = (loadShiki, { forceColorScheme } = {}) => ({
1978
1913
  //#endregion
1979
1914
  exports.CodeHighlight = CodeHighlight;
1980
1915
  exports.CodeHighlightAdapterProvider = CodeHighlightAdapterProvider;
1981
- exports.CodeHighlightControl = CodeHighlightControl;
1916
+ exports.CodeHighlightControl = CodeHighlightControl_default;
1982
1917
  exports.CodeHighlightTabs = CodeHighlightTabs;
1983
1918
  exports.InlineCodeHighlight = InlineCodeHighlight;
1984
1919
  exports.createHighlightJsAdapter = createHighlightJsAdapter;