@dicehub/kappa 0.6.2 → 1.0.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 (132) hide show
  1. package/CHANGELOG.md +98 -0
  2. package/THIRD_PARTY_NOTICES.md +103 -1
  3. package/dist/{DropdownSubTrigger-DrZmNIcU.js → DropdownSubTrigger-DVOFK5Y1.js} +202 -146
  4. package/dist/DropdownSubTrigger-DVOFK5Y1.js.map +1 -0
  5. package/dist/PoweredByDicehub-DPceYF8f.js +143 -0
  6. package/dist/PoweredByDicehub-DPceYF8f.js.map +1 -0
  7. package/dist/{WorkspaceSwitcher-DBWdKZbM.js → WorkspaceSwitcher-DDAIMxeE.js} +5 -9
  8. package/dist/WorkspaceSwitcher-DDAIMxeE.js.map +1 -0
  9. package/dist/app-shell-PGvfb1aZ.js +570 -0
  10. package/dist/app-shell-PGvfb1aZ.js.map +1 -0
  11. package/dist/blocks/app-shell/AppShell.vue.d.ts +41 -0
  12. package/dist/blocks/app-shell/AppShellActions.vue.d.ts +3 -0
  13. package/dist/blocks/app-shell/AppShellAsideResizeHandle.vue.d.ts +20 -0
  14. package/dist/blocks/app-shell/AppShellPage.vue.d.ts +6 -0
  15. package/dist/blocks/app-shell/AppShellPanels.vue.d.ts +33 -0
  16. package/dist/blocks/app-shell/AppShellSearchDialog.vue.d.ts +10 -0
  17. package/dist/blocks/app-shell/AppShellSearchTrigger.vue.d.ts +7 -0
  18. package/dist/blocks/app-shell/AppShellToolbar.vue.d.ts +3 -0
  19. package/dist/blocks/app-shell/app-shell.d.ts +67 -0
  20. package/dist/blocks/app-shell/index.d.ts +19 -0
  21. package/dist/blocks/app-shell.js +2 -0
  22. package/dist/blocks/file-browser.js +1 -1
  23. package/dist/blocks/index.d.ts +1 -0
  24. package/dist/blocks/sidebar-layout/SidebarLayout.vue.d.ts +2 -0
  25. package/dist/blocks/sidebar-layout/sidebar-layout.d.ts +14 -2
  26. package/dist/blocks/sidebar-layout.js +1 -1
  27. package/dist/blocks/workspace-switcher/workspace-switcher.d.ts +2 -0
  28. package/dist/blocks/workspace-switcher.js +1 -1
  29. package/dist/{breadcrumbs-CIxUxZVD.js → breadcrumbs-CPfb83sY.js} +36 -41
  30. package/dist/{breadcrumbs-CIxUxZVD.js.map → breadcrumbs-CPfb83sY.js.map} +1 -1
  31. package/dist/button-Cst2B-9X.js +208 -0
  32. package/dist/button-Cst2B-9X.js.map +1 -0
  33. package/dist/code-highlighted-BDnrVMMM.js +541 -0
  34. package/dist/code-highlighted-BDnrVMMM.js.map +1 -0
  35. package/dist/{command-palette-BHFB86Gc.js → command-palette-BjXvHrd6.js} +178 -165
  36. package/dist/command-palette-BjXvHrd6.js.map +1 -0
  37. package/dist/components/breadcrumbs.js +1 -1
  38. package/dist/components/button/index.d.ts +2 -0
  39. package/dist/components/button/toolbar-button.d.ts +23 -0
  40. package/dist/components/button.js +2 -2
  41. package/dist/components/code-block/index.d.ts +8 -0
  42. package/dist/components/code-block.js +10 -0
  43. package/dist/components/code-block.js.map +1 -0
  44. package/dist/components/code-highlighted/CodeBlockDisclosure.vue.d.ts +36 -0
  45. package/dist/components/code-highlighted/CodeHighlighted.vue.d.ts +28 -1
  46. package/dist/components/code-highlighted/code-highlighted.d.ts +12 -1
  47. package/dist/components/code-highlighted/use-shiki-highlighter.d.ts +1 -0
  48. package/dist/components/code-highlighted.js +2 -376
  49. package/dist/components/command-palette/CommandPaletteResultItem.vue.d.ts +1 -1
  50. package/dist/components/command-palette.js +1 -1
  51. package/dist/components/context-menu/ContextMenu.vue.d.ts +5 -5
  52. package/dist/components/context-menu.js +2 -2
  53. package/dist/components/data-grid.js +1 -1
  54. package/dist/components/date-picker/DatePicker.vue.d.ts +1 -1
  55. package/dist/components/dialog/Dialog.vue.d.ts +7 -7
  56. package/dist/components/dialog-layout/DialogLayoutAlert.vue.d.ts +3 -3
  57. package/dist/components/dicehub-logo/dicehub-logo.d.ts +17 -4
  58. package/dist/components/dicehub-logo/index.d.ts +1 -1
  59. package/dist/components/dicehub-logo.js +2 -2
  60. package/dist/components/drawer/Drawer.vue.d.ts +3 -3
  61. package/dist/components/dropdown/Dropdown.vue.d.ts +5 -5
  62. package/dist/components/dropdown/DropdownContent.vue.d.ts +1 -0
  63. package/dist/components/dropdown/DropdownSub.vue.d.ts +5 -5
  64. package/dist/components/dropdown/DropdownSubContent.vue.d.ts +1 -0
  65. package/dist/components/dropdown/dropdown.d.ts +2 -0
  66. package/dist/components/dropdown/use-dropdown-focus.d.ts +6 -0
  67. package/dist/components/dropdown.js +2 -2
  68. package/dist/components/filter-bar.js +1 -1
  69. package/dist/components/hover-card/HoverCard.vue.d.ts +2 -2
  70. package/dist/components/kbd.js +1 -1
  71. package/dist/components/loader/Loader.vue.d.ts +1 -1
  72. package/dist/components/matrix-loader/MatrixLoader.vue.d.ts +1 -1
  73. package/dist/components/menu-bar.js +1 -1
  74. package/dist/components/popover/Popover.vue.d.ts +7 -7
  75. package/dist/components/sidebar/SidebarProvider.vue.d.ts +1 -0
  76. package/dist/components/sidebar/index.d.ts +1 -1
  77. package/dist/components/sidebar/sidebar-resize.d.ts +1 -0
  78. package/dist/components/sidebar/sidebar.d.ts +5 -1
  79. package/dist/components/sidebar.js +1 -1
  80. package/dist/components/table/TableCheckCell.vue.d.ts +1 -1
  81. package/dist/components/table/TableCheckHead.vue.d.ts +1 -1
  82. package/dist/components/toolbar/ToolbarButton.vue.d.ts +5 -1
  83. package/dist/components/toolbar/index.d.ts +3 -2
  84. package/dist/components/toolbar/toolbar.d.ts +2 -3
  85. package/dist/components/toolbar.js +3 -2
  86. package/dist/components/tooltip/Tooltip.vue.d.ts +5 -5
  87. package/dist/{context-menu-B_noSd5p.js → context-menu-WmJWrUGu.js} +2 -2
  88. package/dist/{context-menu-B_noSd5p.js.map → context-menu-WmJWrUGu.js.map} +1 -1
  89. package/dist/{data-grid-CobgDr8q.js → data-grid-BQkLsfk0.js} +2 -2
  90. package/dist/{data-grid-CobgDr8q.js.map → data-grid-BQkLsfk0.js.map} +1 -1
  91. package/dist/{dropdown-Dedb1tk8.js → dropdown-BABKXjuz.js} +2 -2
  92. package/dist/{dropdown-Dedb1tk8.js.map → dropdown-BABKXjuz.js.map} +1 -1
  93. package/dist/{file-browser-CGqaz2eI.js → file-browser-BxOJWvrF.js} +5 -5
  94. package/dist/{file-browser-CGqaz2eI.js.map → file-browser-BxOJWvrF.js.map} +1 -1
  95. package/dist/{filter-bar-COAlDQE4.js → filter-bar-CAyW-YoF.js} +2 -2
  96. package/dist/{filter-bar-COAlDQE4.js.map → filter-bar-CAyW-YoF.js.map} +1 -1
  97. package/dist/index.js +104 -103
  98. package/dist/{KbdGroup-CNwqr4vX.js → kbd-CNwqr4vX.js} +1 -1
  99. package/dist/kbd-CNwqr4vX.js.map +1 -0
  100. package/dist/{menu-bar-C-qQn2L1.js → menu-bar-DPJllpvf.js} +2 -2
  101. package/dist/{menu-bar-C-qQn2L1.js.map → menu-bar-DPJllpvf.js.map} +1 -1
  102. package/dist/paneled-bottom.png +0 -0
  103. package/dist/paneled-side.png +0 -0
  104. package/dist/registry/component-registry.json +18 -6
  105. package/dist/registry/generated.d.ts +94 -10
  106. package/dist/{registry-DLklQtS0.js → registry-Bgb2nbb2.js} +121 -9
  107. package/dist/registry-Bgb2nbb2.js.map +1 -0
  108. package/dist/registry.js +1 -1
  109. package/dist/{sidebar-tcrbUrk_.js → sidebar-9TqPqgDD.js} +178 -157
  110. package/dist/sidebar-9TqPqgDD.js.map +1 -0
  111. package/dist/{SidebarLayout-D9RT-MdT.js → sidebar-layout-DRe1HpSt.js} +65 -46
  112. package/dist/sidebar-layout-DRe1HpSt.js.map +1 -0
  113. package/dist/styles/kappa.css +1 -1
  114. package/dist/styles/theme-kappa.css +296 -1
  115. package/dist/styles/tokens.json +767 -0
  116. package/dist/{toolbar-DC-4XdHD.js → toolbar-DJsnox8t.js} +90 -146
  117. package/dist/toolbar-DJsnox8t.js.map +1 -0
  118. package/licenses/nunito.LICENSE +93 -0
  119. package/package.json +1 -1
  120. package/dist/DropdownSubTrigger-DrZmNIcU.js.map +0 -1
  121. package/dist/KbdGroup-CNwqr4vX.js.map +0 -1
  122. package/dist/PoweredByDicehub-BD-y1NZA.js +0 -92
  123. package/dist/PoweredByDicehub-BD-y1NZA.js.map +0 -1
  124. package/dist/SidebarLayout-D9RT-MdT.js.map +0 -1
  125. package/dist/WorkspaceSwitcher-DBWdKZbM.js.map +0 -1
  126. package/dist/button-DSgFcDoO.js +0 -128
  127. package/dist/button-DSgFcDoO.js.map +0 -1
  128. package/dist/command-palette-BHFB86Gc.js.map +0 -1
  129. package/dist/components/code-highlighted.js.map +0 -1
  130. package/dist/registry-DLklQtS0.js.map +0 -1
  131. package/dist/sidebar-tcrbUrk_.js.map +0 -1
  132. package/dist/toolbar-DC-4XdHD.js.map +0 -1
@@ -0,0 +1,541 @@
1
+ import { t as e } from "./select-Bxs-8rkj.js";
2
+ import { Fragment as t, computed as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createTextVNode as s, createVNode as c, defineComponent as l, inject as u, mergeProps as d, nextTick as f, normalizeClass as p, onBeforeUnmount as m, onMounted as h, openBlock as g, provide as _, ref as v, renderList as y, renderSlot as b, shallowRef as x, toDisplayString as S, unref as C, useSlots as w, watch as T, withCtx as E } from "vue";
3
+ import { Clipboard as D } from "@ark-ui/vue/clipboard";
4
+ import { Collapsible as O } from "@ark-ui/vue/collapsible";
5
+ //#region src/components/code-highlighted/CodeHighlightedCopy.vue?vue&type=script&setup=true&lang.ts
6
+ var k = {
7
+ key: 0,
8
+ class: "kappa-code-highlighted__copy-icon",
9
+ viewBox: "0 0 16 16",
10
+ fill: "none",
11
+ "aria-hidden": "true",
12
+ focusable: "false"
13
+ }, A = {
14
+ key: 1,
15
+ class: "kappa-code-highlighted__copy-icon",
16
+ viewBox: "0 0 24 24",
17
+ fill: "none",
18
+ stroke: "currentColor",
19
+ "stroke-width": "2",
20
+ "aria-hidden": "true",
21
+ focusable: "false"
22
+ }, j = {
23
+ class: "kappa-code-highlighted__copy-status",
24
+ "aria-live": "polite",
25
+ "aria-atomic": "true"
26
+ }, M = /* @__PURE__ */ l({
27
+ __name: "CodeHighlightedCopy",
28
+ props: {
29
+ code: {},
30
+ labels: {}
31
+ },
32
+ setup(e) {
33
+ return (t, n) => (g(), r(C(D).Root, {
34
+ class: "kappa-code-highlighted__copy-root",
35
+ "data-slot": "code-highlighted-copy",
36
+ "model-value": e.code,
37
+ timeout: 2e3
38
+ }, {
39
+ default: E(() => [c(C(D).Context, null, {
40
+ default: E((t) => [c(C(D).Trigger, {
41
+ type: "button",
42
+ class: "kappa-code-highlighted__copy",
43
+ "aria-label": t.copied ? e.labels.copied : e.labels.copy
44
+ }, {
45
+ default: E(() => [t.copied ? (g(), a("svg", k, [...n[0] ||= [o("path", {
46
+ d: "M3.25 8.75 6.25 11.5 12.75 4.5",
47
+ stroke: "currentColor",
48
+ "stroke-width": "1.75",
49
+ "stroke-linecap": "round",
50
+ "stroke-linejoin": "round"
51
+ }, null, -1)]])) : (g(), a("svg", A, [...n[1] ||= [o("rect", {
52
+ x: "3",
53
+ y: "8",
54
+ width: "13",
55
+ height: "13",
56
+ rx: "3"
57
+ }, null, -1), o("path", { d: "M8 8V6a3 3 0 0 1 3-3h7a3 3 0 0 1 3 3v7a3 3 0 0 1-3 3h-2" }, null, -1)]]))]),
58
+ _: 2
59
+ }, 1032, ["aria-label"]), o("span", j, S(t.copied ? e.labels.copied : ""), 1)]),
60
+ _: 1
61
+ })]),
62
+ _: 1
63
+ }, 8, ["model-value"]));
64
+ }
65
+ }), N = ["data-collapsible", "data-animated"], ee = { class: "kappa-code-block__content" }, P = /* @__PURE__ */ l({
66
+ inheritAttrs: !1,
67
+ __name: "CodeBlockDisclosure",
68
+ props: {
69
+ collapsible: {
70
+ type: Boolean,
71
+ default: !1
72
+ },
73
+ collapsedLines: { default: 10 },
74
+ defaultOpen: {
75
+ type: Boolean,
76
+ default: !1
77
+ },
78
+ open: {
79
+ type: Boolean,
80
+ default: void 0
81
+ },
82
+ expandLabel: { default: "Expand code" },
83
+ collapseLabel: { default: "Collapse code" }
84
+ },
85
+ emits: ["update:open", "openChange"],
86
+ setup(e, { emit: t }) {
87
+ let l = e, u = t, p = v(null), _ = v(null), y = v(l.defaultOpen), x = v(!0), w = v(!1), D, k = n(() => Number.isFinite(l.collapsedLines) ? Math.max(1, Math.floor(l.collapsedLines)) : 10), A = n(() => l.collapsible && x.value), j = n(() => l.open ?? y.value), M = n(() => !A.value || j.value), P = n(() => M.value ? l.collapseLabel : l.expandLabel);
88
+ function F() {
89
+ let e = _.value, t = e?.querySelector("pre");
90
+ if (!e || !t) return;
91
+ let n = getComputedStyle(t), r = Number.parseFloat(n.lineHeight), i = Number.parseFloat(n.paddingTop) + Number.parseFloat(n.paddingBottom);
92
+ x.value = t.scrollHeight > r * k.value + i + 1;
93
+ }
94
+ function I(e) {
95
+ w.value = !0, l.open === void 0 && (y.value = e.open), u("update:open", e.open), u("openChange", e);
96
+ }
97
+ return T(k, () => f(F)), T(j, () => {
98
+ w.value = !0;
99
+ }), T(M, (e) => {
100
+ !e && _.value?.contains(document.activeElement) && p.value?.querySelector("[data-slot='code-block-toggle']")?.focus();
101
+ }, { flush: "post" }), h(() => {
102
+ T(() => l.collapsible, (e) => {
103
+ D?.disconnect(), D = void 0, e && (F(), !(typeof ResizeObserver > "u" || !_.value) && (D = new ResizeObserver(F), D.observe(_.value)));
104
+ }, {
105
+ immediate: !0,
106
+ flush: "post"
107
+ });
108
+ }), m(() => D?.disconnect()), (t, n) => e.collapsible ? (g(), r(C(O).Root, {
109
+ key: 0,
110
+ "as-child": "",
111
+ open: M.value,
112
+ "collapsed-height": e.collapsible ? "calc(var(--kappa-code-collapsed-lines) * 1.25rem + 1.5rem)" : void 0,
113
+ onOpenChange: I
114
+ }, {
115
+ default: E(() => [o("figure", d({
116
+ ref_key: "rootRef",
117
+ ref: p
118
+ }, t.$attrs, {
119
+ "data-collapsible": e.collapsible || void 0,
120
+ "data-animated": w.value || void 0,
121
+ style: { "--kappa-code-collapsed-lines": k.value }
122
+ }), [
123
+ b(t.$slots, "header"),
124
+ c(C(O).Content, {
125
+ class: "kappa-code-block__content",
126
+ "data-slot": "code-block-content"
127
+ }, {
128
+ default: E(() => [o("div", {
129
+ ref_key: "bodyRef",
130
+ ref: _,
131
+ class: "kappa-code-block__body"
132
+ }, [b(t.$slots, "default", { open: M.value })], 512)]),
133
+ _: 3
134
+ }),
135
+ b(t.$slots, "copy"),
136
+ A.value ? (g(), r(C(O).Trigger, {
137
+ key: 0,
138
+ class: "kappa-code-block__toggle",
139
+ "data-slot": "code-block-toggle"
140
+ }, {
141
+ default: E(() => [s(S(P.value) + " ", 1), c(C(O).Indicator, { "as-child": "" }, {
142
+ default: E(() => [...n[0] ||= [o("svg", {
143
+ class: "kappa-code-block__toggle-icon",
144
+ viewBox: "0 0 16 16",
145
+ fill: "none",
146
+ "aria-hidden": "true"
147
+ }, [o("path", { d: "m4.25 6.25 3.75 3.5 3.75-3.5" })], -1)]]),
148
+ _: 1
149
+ })]),
150
+ _: 1
151
+ })) : i("", !0)
152
+ ], 16, N)]),
153
+ _: 3
154
+ }, 8, ["open", "collapsed-height"])) : (g(), a("figure", d({
155
+ key: 1,
156
+ ref_key: "rootRef",
157
+ ref: p
158
+ }, t.$attrs), [
159
+ b(t.$slots, "header"),
160
+ o("div", ee, [o("div", {
161
+ ref_key: "bodyRef",
162
+ ref: _,
163
+ class: "kappa-code-block__body"
164
+ }, [b(t.$slots, "default", { open: !0 })], 512)]),
165
+ b(t.$slots, "copy")
166
+ ], 16));
167
+ }
168
+ }), F = {
169
+ js: "javascript",
170
+ cjs: "javascript",
171
+ mjs: "javascript",
172
+ ts: "typescript",
173
+ cts: "typescript",
174
+ mts: "typescript",
175
+ sh: "bash",
176
+ zsh: "bash",
177
+ yml: "yaml",
178
+ py: "python",
179
+ md: "markdown",
180
+ gql: "graphql"
181
+ }, I = {
182
+ copy: "Copy",
183
+ copied: "Copied!",
184
+ language: "Code language"
185
+ };
186
+ function L(e) {
187
+ return Object.hasOwn(B, e) ? e : Object.hasOwn(F, e) ? F[e] : null;
188
+ }
189
+ function R(e, t) {
190
+ return [...new Set(e.map((e) => t(e)).filter((e) => e !== null))].sort();
191
+ }
192
+ function z(e, t) {
193
+ return R(e, t).join(",");
194
+ }
195
+ var B = {
196
+ javascript: !0,
197
+ typescript: !0,
198
+ jsx: !0,
199
+ tsx: !0,
200
+ json: !0,
201
+ jsonc: !0,
202
+ html: !0,
203
+ css: !0,
204
+ python: !0,
205
+ yaml: !0,
206
+ markdown: !0,
207
+ graphql: !0,
208
+ sql: !0,
209
+ bash: !0,
210
+ shell: !0,
211
+ diff: !0,
212
+ hcl: !0,
213
+ toml: !0,
214
+ vue: !0
215
+ }, V = Symbol("kappa-shiki-context");
216
+ //#endregion
217
+ //#region src/components/code-highlighted/use-shiki-highlighter.ts
218
+ function te() {
219
+ let e = u(V, null);
220
+ if (!e) throw Error("useShikiHighlighter must be used within a ShikiProvider. Wrap your app with <ShikiProvider> from '@dicehub/kappa/components/code-highlighted'.");
221
+ return U(e);
222
+ }
223
+ function H() {
224
+ return U(u(V, null));
225
+ }
226
+ function U(e) {
227
+ return {
228
+ highlight: (t, n) => {
229
+ if (!e?.highlighter.value || [
230
+ "text",
231
+ "plain",
232
+ "txt"
233
+ ].includes(n)) return null;
234
+ let r = L(n);
235
+ if (!r || !e.languages.value.includes(r)) return console.warn(`[Kappa CodeHighlighted] Language "${n}" is not in the ShikiProvider languages list. Rendering as plain text.`), null;
236
+ try {
237
+ return e.highlighter.value.codeToHtml(t, {
238
+ lang: r,
239
+ themes: {
240
+ light: "github-light",
241
+ dark: "vesper"
242
+ },
243
+ defaultColor: "light-dark()"
244
+ });
245
+ } catch (e) {
246
+ return console.warn(`[Kappa CodeHighlighted] Failed to highlight code with language "${n}":`, e), null;
247
+ }
248
+ },
249
+ isLoading: e?.isLoading ?? v(!1),
250
+ isReady: n(() => !!(e && !e.isLoading.value && e.highlighter.value)),
251
+ error: e?.error ?? x(null),
252
+ labels: e?.labels ?? n(() => I)
253
+ };
254
+ }
255
+ //#endregion
256
+ //#region src/components/code-highlighted/CodeHighlighted.vue?vue&type=script&setup=true&lang.ts
257
+ var W = {
258
+ key: 0,
259
+ class: "kappa-code-highlighted__header"
260
+ }, G = {
261
+ key: 0,
262
+ class: "kappa-code-highlighted__title"
263
+ }, K = {
264
+ key: 2,
265
+ class: "kappa-code-highlighted__actions"
266
+ }, q = ["aria-label", "tabindex"], J = ["innerHTML"], Y = {
267
+ key: 1,
268
+ class: "kappa-code-highlighted__plain"
269
+ }, X = {
270
+ key: 0,
271
+ class: "kappa-code-highlighted__line-number",
272
+ "data-slot": "code-block-line-number",
273
+ "aria-hidden": "true"
274
+ }, Z = { key: 1 }, Q = /* @__PURE__ */ l({
275
+ inheritAttrs: !1,
276
+ __name: "CodeHighlighted",
277
+ props: {
278
+ code: {},
279
+ lang: { default: "text" },
280
+ title: {},
281
+ languageOptions: { default: () => [] },
282
+ showLineNumbers: {
283
+ type: Boolean,
284
+ default: !1
285
+ },
286
+ highlightLines: { default: () => [] },
287
+ showCopyButton: {
288
+ type: Boolean,
289
+ default: !1
290
+ },
291
+ wrap: {
292
+ type: Boolean,
293
+ default: !1
294
+ },
295
+ collapsible: {
296
+ type: Boolean,
297
+ default: !1
298
+ },
299
+ collapsedLines: { default: 10 },
300
+ defaultOpen: {
301
+ type: Boolean,
302
+ default: !1
303
+ },
304
+ open: {
305
+ type: Boolean,
306
+ default: void 0
307
+ },
308
+ expandLabel: { default: "Expand code" },
309
+ collapseLabel: { default: "Collapse code" },
310
+ labels: { default: () => ({}) }
311
+ },
312
+ emits: [
313
+ "update:lang",
314
+ "update:open",
315
+ "openChange"
316
+ ],
317
+ setup(l, { emit: u }) {
318
+ let f = l, m = u, h = w(), _ = H(), v = n(() => ({
319
+ ..._.labels.value,
320
+ ...f.labels
321
+ })), x = n(() => f.code.split("\n")), T = n(() => x.value.length === 1), D = n(() => !!(f.title || h.title || f.languageOptions.length || h.actions)), O = n(() => _.isLoading.value || _.error.value ? null : _.highlight(f.code, f.lang)), k = n(() => N(O.value, f.highlightLines)), A = n(() => f.showLineNumbers && !T.value);
322
+ function j(e) {
323
+ let t = e[0];
324
+ t && t !== f.lang && m("update:lang", t);
325
+ }
326
+ function N(e, t) {
327
+ if (!e) return e;
328
+ let n = new Set(t), r = 0;
329
+ return e.replace(/<span class="line"><\/span>/g, "<span class=\"line\"><br></span>").replace(/<span class="line">/g, () => (r += 1, `<span class="${n.has(r) ? "line line-highlighted" : "line"}">${A.value ? `<span class="kappa-code-highlighted__line-number" data-slot="code-block-line-number" aria-hidden="true">${r}</span>` : ""}`));
330
+ }
331
+ return (n, u) => (g(), r(P, d(n.$attrs, {
332
+ collapsible: l.collapsible,
333
+ "collapsed-lines": l.collapsedLines,
334
+ "default-open": l.defaultOpen,
335
+ open: l.open,
336
+ "expand-label": l.expandLabel,
337
+ "collapse-label": l.collapseLabel,
338
+ "onUpdate:open": u[0] ||= (e) => m("update:open", e),
339
+ onOpenChange: u[1] ||= (e) => m("openChange", e),
340
+ class: ["kappa-code-highlighted kappa-code-block", {
341
+ "kappa-code-highlighted--has-copy": l.showCopyButton,
342
+ "kappa-code-highlighted--single-line": l.showCopyButton && T.value && !D.value,
343
+ "kappa-code-highlighted--with-title": l.title,
344
+ "kappa-code-highlighted--with-header": D.value,
345
+ "kappa-code-highlighted--numbered": A.value
346
+ }],
347
+ "data-slot": "code-highlighted",
348
+ "data-wrap": l.wrap || void 0,
349
+ style: { "--kappa-code-line-number-width": `${String(x.value.length).length + 2}ch` }
350
+ }), {
351
+ header: E(() => [D.value ? (g(), a("figcaption", W, [
352
+ l.title || n.$slots.title ? (g(), a("span", G, [b(n.$slots, "title", {}, () => [s(S(l.title), 1)])])) : i("", !0),
353
+ l.languageOptions.length ? (g(), r(C(e).Root, {
354
+ key: 1,
355
+ class: "kappa-code-highlighted__language-select",
356
+ "aria-label": v.value.language,
357
+ items: l.languageOptions,
358
+ "model-value": [l.lang],
359
+ positioning: {
360
+ placement: "bottom-end",
361
+ gutter: 4,
362
+ sameWidth: !1
363
+ },
364
+ size: "sm",
365
+ "onUpdate:modelValue": j
366
+ }, {
367
+ default: E(() => [c(C(e).Control, null, {
368
+ default: E(() => [c(C(e).Trigger, { class: "kappa-code-highlighted__language-trigger" }, {
369
+ default: E(() => [c(C(e).ValueText), c(C(e).Indicator)]),
370
+ _: 1
371
+ })]),
372
+ _: 1
373
+ }), c(C(e).Positioner, null, {
374
+ default: E(() => [c(C(e).Content, {
375
+ class: "kappa-code-highlighted__language-menu",
376
+ "aria-label": v.value.language
377
+ }, {
378
+ default: E(() => [(g(!0), a(t, null, y(l.languageOptions, (t) => (g(), r(C(e).Item, {
379
+ key: t.value,
380
+ item: t
381
+ }, {
382
+ default: E(() => [s(S(t.label), 1)]),
383
+ _: 2
384
+ }, 1032, ["item"]))), 128))]),
385
+ _: 1
386
+ }, 8, ["aria-label"])]),
387
+ _: 1
388
+ })]),
389
+ _: 1
390
+ }, 8, [
391
+ "aria-label",
392
+ "items",
393
+ "model-value"
394
+ ])) : i("", !0),
395
+ n.$slots.actions ? (g(), a("div", K, [b(n.$slots, "actions")])) : i("", !0),
396
+ l.showCopyButton ? (g(), r(M, {
397
+ key: 3,
398
+ code: l.code,
399
+ labels: v.value
400
+ }, null, 8, ["code", "labels"])) : i("", !0)
401
+ ])) : i("", !0)]),
402
+ default: E(({ open: e }) => [o("div", {
403
+ class: "kappa-code-highlighted__scroll",
404
+ role: "region",
405
+ "aria-label": l.title || "Code block",
406
+ tabindex: e ? 0 : -1,
407
+ dir: "ltr"
408
+ }, [k.value ? (g(), a("div", {
409
+ key: 0,
410
+ class: "kappa-code-highlighted__shiki",
411
+ innerHTML: k.value
412
+ }, null, 8, J)) : (g(), a("pre", Y, [o("code", null, [(g(!0), a(t, null, y(x.value, (e, t) => (g(), a("span", {
413
+ key: t,
414
+ class: p(["line", { "line-highlighted": l.highlightLines.includes(t + 1) }])
415
+ }, [
416
+ A.value ? (g(), a("span", X, S(t + 1), 1)) : i("", !0),
417
+ s(S(e), 1),
418
+ e ? i("", !0) : (g(), a("br", Z))
419
+ ], 2))), 128))])]))], 8, q)]),
420
+ copy: E(() => [l.showCopyButton && !D.value ? (g(), r(M, {
421
+ key: 0,
422
+ code: l.code,
423
+ labels: v.value
424
+ }, null, 8, ["code", "labels"])) : i("", !0)]),
425
+ _: 3
426
+ }, 16, [
427
+ "collapsible",
428
+ "collapsed-lines",
429
+ "default-open",
430
+ "open",
431
+ "expand-label",
432
+ "collapse-label",
433
+ "data-wrap",
434
+ "style",
435
+ "class"
436
+ ]));
437
+ }
438
+ }), ne = {
439
+ javascript: () => import("@shikijs/langs/javascript"),
440
+ typescript: () => import("@shikijs/langs/typescript"),
441
+ jsx: () => import("@shikijs/langs/jsx"),
442
+ tsx: () => import("@shikijs/langs/tsx"),
443
+ json: () => import("@shikijs/langs/json"),
444
+ jsonc: () => import("@shikijs/langs/jsonc"),
445
+ html: () => import("@shikijs/langs/html"),
446
+ css: () => import("@shikijs/langs/css"),
447
+ python: () => import("@shikijs/langs/python"),
448
+ yaml: () => import("@shikijs/langs/yaml"),
449
+ markdown: () => import("@shikijs/langs/markdown"),
450
+ graphql: () => import("@shikijs/langs/graphql"),
451
+ sql: () => import("@shikijs/langs/sql"),
452
+ bash: () => import("@shikijs/langs/bash"),
453
+ shell: () => import("@shikijs/langs/shellscript"),
454
+ diff: () => import("@shikijs/langs/diff"),
455
+ hcl: () => import("@shikijs/langs/hcl"),
456
+ toml: () => import("@shikijs/langs/toml"),
457
+ vue: () => import("@shikijs/langs/vue")
458
+ };
459
+ //#endregion
460
+ //#region src/components/code-highlighted/shiki-lifecycle.ts
461
+ function re(e) {
462
+ let t = !1, n = null;
463
+ return (async () => {
464
+ try {
465
+ let r = await e.create();
466
+ if (t) {
467
+ r.dispose();
468
+ return;
469
+ }
470
+ n = r, e.onReady(r);
471
+ } catch (n) {
472
+ t || e.onError(n);
473
+ } finally {
474
+ t || e.onSettled();
475
+ }
476
+ })(), () => {
477
+ t || (t = !0, n?.dispose());
478
+ };
479
+ }
480
+ //#endregion
481
+ //#region src/components/code-highlighted/ShikiProvider.vue
482
+ var $ = /* @__PURE__ */ l({
483
+ __name: "ShikiProvider",
484
+ props: {
485
+ engine: { default: "javascript" },
486
+ labels: { default: () => ({}) },
487
+ languages: {}
488
+ },
489
+ setup(e) {
490
+ let t = e, r = x(null), i = v(!0), a = x(null), o = v([]), s = n(() => ({
491
+ ...I,
492
+ ...t.labels
493
+ })), c = n(() => z(t.languages, L)), l = v(!1);
494
+ return _(V, {
495
+ highlighter: r,
496
+ isLoading: i,
497
+ error: a,
498
+ languages: o,
499
+ labels: s
500
+ }), h(() => {
501
+ l.value = !0;
502
+ }), T([
503
+ l,
504
+ () => t.engine,
505
+ c
506
+ ], ([e, n], s, c) => {
507
+ if (!e) return;
508
+ let l = R(t.languages, L);
509
+ r.value = null, o.value = [], i.value = !0, a.value = null;
510
+ let u = re({
511
+ async create() {
512
+ let { createHighlighterCore: e } = await import("shiki/core"), t = n === "wasm" ? await import("shiki/engine/oniguruma").then((e) => e.createOnigurumaEngine(import("shiki/wasm"))) : await import("shiki/engine/javascript").then((e) => e.createJavaScriptRegexEngine()), [r, i] = await Promise.all([import("@shikijs/themes/github-light"), import("@shikijs/themes/vesper")]), a = await Promise.all(l.map((e) => ne[e]()));
513
+ return e({
514
+ themes: [r.default, i.default],
515
+ langs: a.map((e) => e.default),
516
+ engine: t
517
+ });
518
+ },
519
+ onError(e) {
520
+ r.value = null, o.value = [], a.value = e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load Shiki");
521
+ },
522
+ onReady(e) {
523
+ r.value = e, o.value = l;
524
+ },
525
+ onSettled() {
526
+ i.value = !1;
527
+ }
528
+ });
529
+ c(() => {
530
+ u(), r.value = null, o.value = [];
531
+ });
532
+ }), (e, t) => b(e.$slots, "default");
533
+ }
534
+ }), ie = Object.assign(Q, {
535
+ Root: Q,
536
+ Provider: $
537
+ });
538
+ //#endregion
539
+ export { I as a, te as i, $ as n, L as o, Q as r, ie as t };
540
+
541
+ //# sourceMappingURL=code-highlighted-BDnrVMMM.js.map