@code-coaching/vuetiful 0.1.4 → 0.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 (64) hide show
  1. package/dist/style.css +2 -2
  2. package/dist/styles/all.css +199 -51
  3. package/dist/types/components/atoms/VButton.test.d.ts +1 -0
  4. package/dist/types/components/atoms/VButton.vue.d.ts +6 -72
  5. package/dist/types/components/index.d.ts +2 -1
  6. package/dist/types/components/index.test.d.ts +1 -0
  7. package/dist/types/components/molecules/VRail.vue.d.ts +51 -0
  8. package/dist/types/components/molecules/VRailTile.vue.d.ts +55 -0
  9. package/dist/types/components/molecules/VShell.vue.d.ts +78 -0
  10. package/dist/types/components/molecules/index.d.ts +4 -0
  11. package/dist/types/directives/clipboard.test.d.ts +1 -0
  12. package/dist/types/index.d.ts +1 -1
  13. package/dist/types/index.test.d.ts +1 -0
  14. package/dist/types/services/index.d.ts +2 -0
  15. package/dist/types/services/rail.service.d.ts +4 -0
  16. package/dist/types/utils/code-block/code-block.vue.d.ts +2 -2
  17. package/dist/types/utils/code-block/highlight.service.test.d.ts +1 -0
  18. package/dist/types/utils/dark-mode/dark-mode.service.test.d.ts +1 -0
  19. package/dist/types/utils/dark-mode/dark-mode.vue.d.ts +3 -3
  20. package/dist/types/utils/index.d.ts +3 -3
  21. package/dist/types/utils/index.test.d.ts +1 -0
  22. package/dist/types/utils/platform/platform.service.test.d.ts +1 -0
  23. package/dist/types/utils/theme/callback.test.d.ts +1 -0
  24. package/dist/types/utils/theme/remove.test.d.ts +1 -0
  25. package/dist/types/utils/theme/theme-switcher.vue.d.ts +3 -3
  26. package/dist/types/utils/theme/{theme.d.ts → theme.service.d.ts} +2 -1
  27. package/dist/types/utils/theme/theme.service.test.d.ts +1 -0
  28. package/dist/vuetiful.es.mjs +658 -499
  29. package/dist/vuetiful.umd.js +13 -20
  30. package/package.json +8 -2
  31. package/src/components/atoms/VButton.test.ts +27 -0
  32. package/src/components/atoms/VButton.vue +19 -73
  33. package/src/components/index.test.ts +10 -0
  34. package/src/components/index.ts +2 -1
  35. package/src/components/molecules/VRail.vue +46 -0
  36. package/src/components/molecules/VRailTile.vue +75 -0
  37. package/src/components/molecules/VShell.vue +71 -0
  38. package/src/components/molecules/index.ts +5 -0
  39. package/src/directives/clipboard.test.ts +26 -0
  40. package/src/index.test.ts +26 -0
  41. package/src/index.ts +1 -1
  42. package/src/services/index.ts +3 -0
  43. package/src/services/rail.service.ts +11 -0
  44. package/src/utils/code-block/code-block.vue +1 -1
  45. package/src/utils/code-block/highlight.service.test.ts +24 -0
  46. package/src/utils/dark-mode/dark-mode.service.test.ts +234 -0
  47. package/src/utils/dark-mode/{dark-mode.ts → dark-mode.service.ts} +5 -4
  48. package/src/utils/dark-mode/dark-mode.vue +1 -1
  49. package/src/utils/index.test.ts +11 -0
  50. package/src/utils/index.ts +3 -4
  51. package/src/utils/platform/platform.service.test.ts +19 -0
  52. package/src/utils/theme/callback.test.ts +24 -0
  53. package/src/utils/theme/remove.test.ts +25 -0
  54. package/src/utils/theme/theme.service.test.ts +160 -0
  55. package/src/utils/theme/{theme.ts → theme.service.ts} +6 -7
  56. package/dist/types/constants/MyConstants.d.ts +0 -1
  57. package/dist/types/constants/index.d.ts +0 -2
  58. package/src/constants/MyConstants.ts +0 -1
  59. package/src/constants/index.ts +0 -5
  60. /package/dist/types/utils/code-block/{highlight.d.ts → highlight.service.d.ts} +0 -0
  61. /package/dist/types/utils/dark-mode/{dark-mode.d.ts → dark-mode.service.d.ts} +0 -0
  62. /package/dist/types/utils/platform/{platform.d.ts → platform.service.d.ts} +0 -0
  63. /package/src/utils/code-block/{highlight.ts → highlight.service.ts} +0 -0
  64. /package/src/utils/platform/{platform.ts → platform.service.ts} +0 -0
@@ -1,540 +1,247 @@
1
- import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, Fragment, createTextVNode, toDisplayString, createCommentVNode, renderSlot, ref, readonly, onMounted, createElementVNode, resolveComponent, createVNode, withCtx, renderList, pushScopeId, popScopeId, useAttrs, unref, withDirectives } from "vue";
2
- var _export_sfc = (sfc, props) => {
3
- const target = sfc.__vccOpts || sfc;
4
- for (const [key, val] of props) {
5
- target[key] = val;
6
- }
7
- return target;
8
- };
9
- const _sfc_main$3 = defineComponent({
1
+ import { defineComponent, useAttrs, openBlock, createBlock, resolveDynamicComponent, normalizeClass, unref, withCtx, createElementBlock, Fragment, createTextVNode, toDisplayString, createCommentVNode, renderSlot, provide, createElementVNode, ref, inject, mergeProps, computed, withDirectives, readonly, onMounted, resolveComponent, createVNode, renderList, pushScopeId, popScopeId } from "vue";
2
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
3
+ __name: "VButton",
10
4
  props: {
11
- bgLight: {
12
- type: String,
13
- default: "bg-primary-50"
14
- },
15
- bgDark: {
16
- type: String,
17
- default: "bg-primary-900"
18
- },
19
- textOnLight: {
20
- type: String,
21
- default: "text-primary-900"
22
- },
23
- textOnDark: {
24
- type: String,
25
- default: "text-primary-50"
26
- },
27
- width: {
28
- type: String,
29
- default: "w-fit"
30
- },
31
- height: {
5
+ tag: {
32
6
  type: String,
33
- default: "h-fit"
34
- },
35
- ring: {
36
- type: String,
37
- default: "ring-[1px] ring-primary-500/30"
38
- },
39
- rounded: {
40
- type: String,
41
- default: "rounded-token"
7
+ default: "button"
42
8
  },
43
9
  msg: {
44
10
  type: String
45
11
  }
46
12
  },
47
- setup(props, { attrs }) {
48
- const { currentMode: currentMode2, MODE: MODE2 } = useDarkMode();
49
- const cTransition = `transition-all duration-[200ms]`;
50
- const background = computed(() => {
51
- return currentMode2.value === MODE2.LIGHT ? props.bgLight : props.bgDark;
52
- });
53
- const text = computed(() => {
54
- return currentMode2.value === MODE2.LIGHT ? props.textOnLight : props.textOnDark;
55
- });
56
- const classes = computed(() => {
13
+ setup(__props) {
14
+ const attrs = useAttrs();
15
+ return (_ctx, _cache) => {
57
16
  var _a;
58
- return `${cTransition}
59
- ${background.value}
60
- ${text.value}
61
- ${props.width}
62
- ${props.height}
63
- ${props.ring}
64
- ${props.rounded}
65
- ${(_a = attrs.class) != null ? _a : ""}`;
66
- });
67
- return {
68
- classes
17
+ return openBlock(), createBlock(resolveDynamicComponent(__props.tag), {
18
+ class: normalizeClass(`vuetiful-button btn border-token hover:cursor-pointer ${(_a = unref(attrs).class) != null ? _a : ""}`)
19
+ }, {
20
+ default: withCtx(() => [
21
+ __props.msg ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
22
+ createTextVNode(toDisplayString(__props.msg), 1)
23
+ ], 64)) : createCommentVNode("", true),
24
+ renderSlot(_ctx.$slots, "default")
25
+ ]),
26
+ _: 3
27
+ }, 8, ["class"]);
69
28
  };
70
29
  }
71
30
  });
72
- function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
73
- return openBlock(), createElementBlock("button", {
74
- class: normalizeClass(`cc-button btn ${_ctx.classes}`)
75
- }, [
76
- _ctx.msg ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
77
- createTextVNode(toDisplayString(_ctx.msg), 1)
78
- ], 64)) : createCommentVNode("", true),
79
- renderSlot(_ctx.$slots, "default")
80
- ], 2);
81
- }
82
- var VButton = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$2]]);
83
- var components = /* @__PURE__ */ Object.freeze({
84
- __proto__: null,
85
- [Symbol.toStringTag]: "Module",
86
- VButton
87
- });
88
- var main = "";
89
- var tailwind = "";
90
- const MAGIC_NUM = 100;
91
- var MyConstants = /* @__PURE__ */ Object.freeze({
92
- __proto__: null,
93
- [Symbol.toStringTag]: "Module",
94
- MAGIC_NUM
95
- });
96
- const usePlatform = () => {
97
- const isBrowser2 = typeof window !== "undefined";
98
- return {
99
- isBrowser: isBrowser2
100
- };
101
- };
102
- const { isBrowser: isBrowser$1 } = usePlatform();
103
- const MODE = {
104
- LIGHT: true,
105
- DARK: false
106
- };
107
- const modeOsPrefers = ref(MODE.DARK);
108
- const currentMode = ref(MODE.DARK);
109
- const modeUserPrefers = ref(void 0);
110
- const useDarkMode = () => {
111
- const getModeOsPrefers = () => {
112
- const prefersLightMode = window.matchMedia("(prefers-color-scheme: light)").matches;
113
- setModeOsPrefers(prefersLightMode);
114
- return prefersLightMode;
115
- };
116
- const getModeUserPrefers = () => {
117
- if (isBrowser$1) {
118
- const mode = localStorage.getItem("modeUserPrefers");
119
- if (mode !== null)
120
- modeUserPrefers.value = mode === "true";
121
- }
122
- return modeUserPrefers.value;
123
- };
124
- const getModeAutoPrefers = () => {
125
- const os = getModeOsPrefers();
126
- const user = getModeUserPrefers();
127
- const modeValue = user !== void 0 ? user : os;
128
- return modeValue;
129
- };
130
- const setModeOsPrefers = (value) => {
131
- modeOsPrefers.value = value;
132
- if (isBrowser$1) {
133
- localStorage.setItem("modeOsPrefers", value.toString());
134
- }
135
- };
136
- const setModeUserPrefers = (value) => {
137
- modeUserPrefers.value = value;
138
- if (isBrowser$1) {
139
- localStorage.setItem("modeUserPrefers", value.toString());
140
- }
141
- };
142
- const setModeCurrent = (value) => {
143
- const elemHtmlClasses = document.documentElement.classList;
144
- const classDark = "dark";
145
- value === MODE.LIGHT ? elemHtmlClasses.remove(classDark) : elemHtmlClasses.add(classDark);
146
- currentMode.value = value;
147
- };
148
- const initializeMode = () => {
149
- const mode = getModeAutoPrefers();
150
- setModeCurrent(mode);
151
- };
152
- const autoModeWatcher = () => {
153
- const mql = window.matchMedia("(prefers-color-scheme: light)");
154
- const setMode = (value) => {
155
- const elemHtmlClasses = document.documentElement.classList;
156
- const classDark = `dark`;
157
- value === MODE.LIGHT ? elemHtmlClasses.remove(classDark) : elemHtmlClasses.add(classDark);
158
- setModeCurrent(value);
159
- };
160
- setMode(mql.matches);
161
- mql.onchange = () => {
162
- setMode(mql.matches);
163
- };
164
- };
165
- return {
166
- modeOsPrefers: readonly(modeOsPrefers),
167
- modeUserPrefers: readonly(modeUserPrefers),
168
- currentMode: readonly(currentMode),
169
- getModeOsPrefers,
170
- getModeUserPrefers,
171
- getModeAutoPrefers,
172
- setModeUserPrefers,
173
- setModeCurrent,
174
- autoModeWatcher,
175
- initializeMode,
176
- MODE
177
- };
178
- };
179
- const _sfc_main$2 = defineComponent({
31
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
32
+ __name: "VRail",
180
33
  props: {
181
- bgLight: {
182
- type: String,
183
- default: "bg-surface-50"
184
- },
185
- bgDark: {
186
- type: String,
187
- default: "bg-surface-900"
188
- },
189
- textLight: {
34
+ active: {
190
35
  type: String,
191
- default: "text-surface-50"
36
+ default: "bg-secondary-active-token"
192
37
  },
193
- textDark: {
38
+ hover: {
194
39
  type: String,
195
- default: "text-surface-900"
40
+ default: "hover:bg-secondary-hover-token"
196
41
  },
197
- width: {
42
+ regionLead: {
198
43
  type: String,
199
- default: "w-12"
200
- },
201
- height: {
202
- type: String,
203
- default: "h-6"
44
+ default: ""
204
45
  },
205
- ring: {
46
+ regionDefault: {
206
47
  type: String,
207
- default: "ring-[1px] ring-surface-500/30"
48
+ default: ""
208
49
  },
209
- rounded: {
50
+ regionTrail: {
210
51
  type: String,
211
- default: "rounded-token"
52
+ default: ""
212
53
  }
213
54
  },
214
- setup(props, { attrs }) {
215
- const { initializeMode, setModeCurrent, setModeUserPrefers, currentMode: currentMode2, MODE: MODE2 } = useDarkMode();
216
- onMounted(() => {
217
- initializeMode();
218
- });
219
- const cTransition = `transition-all duration-[200ms]`;
220
- const cTrack = "cursor-pointer";
221
- const cThumb = "aspect-square scale-[0.8] flex justify-center items-center";
222
- const cIcon = "w-[70%] aspect-square";
223
- const svgPath = {
224
- sun: "M361.5 1.2c5 2.1 8.6 6.6 9.6 11.9L391 121l107.9 19.8c5.3 1 9.8 4.6 11.9 9.6s1.5 10.7-1.6 15.2L446.9 256l62.3 90.3c3.1 4.5 3.7 10.2 1.6 15.2s-6.6 8.6-11.9 9.6L391 391 371.1 498.9c-1 5.3-4.6 9.8-9.6 11.9s-10.7 1.5-15.2-1.6L256 446.9l-90.3 62.3c-4.5 3.1-10.2 3.7-15.2 1.6s-8.6-6.6-9.6-11.9L121 391 13.1 371.1c-5.3-1-9.8-4.6-11.9-9.6s-1.5-10.7 1.6-15.2L65.1 256 2.8 165.7c-3.1-4.5-3.7-10.2-1.6-15.2s6.6-8.6 11.9-9.6L121 121 140.9 13.1c1-5.3 4.6-9.8 9.6-11.9s10.7-1.5 15.2 1.6L256 65.1 346.3 2.8c4.5-3.1 10.2-3.7 15.2-1.6zM352 256c0 53-43 96-96 96s-96-43-96-96s43-96 96-96s96 43 96 96zm32 0c0-70.7-57.3-128-128-128s-128 57.3-128 128s57.3 128 128 128s128-57.3 128-128z",
225
- moon: "M223.5 32C100 32 0 132.3 0 256S100 480 223.5 480c60.6 0 115.5-24.2 155.8-63.4c5-4.9 6.3-12.5 3.1-18.7s-10.1-9.7-17-8.5c-9.8 1.7-19.8 2.6-30.1 2.6c-96.9 0-175.5-78.8-175.5-176c0-65.8 36-123.1 89.3-153.3c6.1-3.5 9.2-10.5 7.7-17.3s-7.3-11.9-14.3-12.5c-6.3-.5-12.6-.8-19-.8z"
226
- };
227
- const onToggleHandler = () => {
228
- const toggle = !currentMode2.value;
229
- setModeUserPrefers(toggle);
230
- setModeCurrent(toggle);
231
- };
232
- const onKeyDown = (event) => {
233
- if (["Enter", "Space"].includes(event.code)) {
234
- event.preventDefault();
235
- event.currentTarget.click();
236
- }
237
- };
238
- const trackBg = computed(
239
- () => currentMode2.value === MODE2.LIGHT ? props.bgLight : props.bgDark
240
- );
241
- const thumbBg = computed(
242
- () => currentMode2.value === MODE2.LIGHT ? props.bgDark : props.bgLight
243
- );
244
- const thumbPosition = computed(
245
- () => currentMode2.value === MODE2.LIGHT ? "translate-x-[100%]" : ""
246
- );
247
- const iconFill = computed(() => {
248
- return currentMode2.value === MODE2.LIGHT ? props.textLight : props.textDark;
249
- });
250
- const classesTrack = computed(() => {
251
- var _a;
252
- return `${cTrack} ${cTransition} ${props.width} ${props.height} ${props.ring} ${props.rounded} ${trackBg.value} ${(_a = attrs.class) != null ? _a : ""}`;
253
- });
254
- const classesThumb = computed(
255
- () => `${cThumb} ${cTransition} ${props.height} ${props.rounded} ${thumbBg.value} ${thumbPosition.value}`
256
- );
257
- const classesIcon = computed(() => `${cIcon}`);
258
- return {
259
- classesTrack,
260
- classesThumb,
261
- classesIcon,
262
- svgPath,
263
- onToggleHandler,
264
- onKeyDown,
265
- currentMode: currentMode2,
266
- iconFill
55
+ setup(__props) {
56
+ const props = __props;
57
+ const attrs = useAttrs();
58
+ provide("active", props.active);
59
+ provide("hover", props.hover);
60
+ return (_ctx, _cache) => {
61
+ return openBlock(), createElementBlock("div", {
62
+ class: normalizeClass(["v-rail", `grid h-full w-[70px] grid-rows-[auto_1fr_auto] gap-0 overflow-y-auto sm:w-20 ${unref(attrs).class || ""}`])
63
+ }, [
64
+ createElementVNode("div", {
65
+ class: normalizeClass(["v-bar-lead", __props.regionLead])
66
+ }, [
67
+ renderSlot(_ctx.$slots, "lead")
68
+ ], 2),
69
+ createElementVNode("div", {
70
+ class: normalizeClass(["v-bar-default", __props.regionDefault])
71
+ }, [
72
+ renderSlot(_ctx.$slots, "default")
73
+ ], 2),
74
+ createElementVNode("div", {
75
+ class: normalizeClass(["v-bar-trail", __props.regionTrail])
76
+ }, [
77
+ renderSlot(_ctx.$slots, "trail")
78
+ ], 2)
79
+ ], 2);
267
80
  };
268
81
  }
269
82
  });
270
- const _hoisted_1$2 = ["aria-checked", "title"];
271
- const _hoisted_2$2 = ["d"];
272
- function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
273
- return openBlock(), createElementBlock("div", {
274
- class: normalizeClass(`lightswitch-track ${_ctx.classesTrack}`),
275
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onToggleHandler && _ctx.onToggleHandler(...args)),
276
- onKeydown: _cache[1] || (_cache[1] = (...args) => _ctx.onKeyDown && _ctx.onKeyDown(...args)),
277
- "on:keyup": "",
278
- "on:keypress": "",
279
- role: "switch",
280
- "aria-label": "Light Switch",
281
- "aria-checked": _ctx.currentMode,
282
- title: `Toggle ${_ctx.currentMode === false ? "Dark" : "Light"} Mode`,
283
- tabindex: "0"
284
- }, [
285
- createElementVNode("div", {
286
- class: normalizeClass(`lightswitch-thumb ${_ctx.classesThumb}`)
287
- }, [
288
- (openBlock(), createElementBlock("svg", {
289
- class: normalizeClass(`lightswitch-icon ${_ctx.classesIcon} ${_ctx.iconFill}`),
290
- xmlns: "http://www.w3.org/2000/svg",
291
- viewBox: "0 0 512 512"
292
- }, [
293
- createElementVNode("path", {
294
- fill: "currentColor",
295
- d: _ctx.currentMode ? _ctx.svgPath.sun : _ctx.svgPath.moon
296
- }, null, 8, _hoisted_2$2)
297
- ], 2))
298
- ], 2)
299
- ], 42, _hoisted_1$2);
300
- }
301
- var DarkModeSwitch = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$1]]);
302
- const { isBrowser } = usePlatform();
303
- const THEMES = {
304
- VUETIFUL: "vuetiful",
305
- ROCKET: "rocket",
306
- SAHARA: "sahara",
307
- SEAFOAM: "seafoam",
308
- SEASONAL: "seasonal",
309
- SKELETON: "skeleton",
310
- VINTAGE: "vintage"
311
- };
312
- const builtInUrl = (name) => {
313
- return `https://code-coaching.dev/vuetiful-themes/theme-${name}.css`;
314
- };
315
- const builtInThemes = [
316
- { name: THEMES.VUETIFUL, url: builtInUrl(`${THEMES.VUETIFUL}-0.0.1`) },
317
- { name: THEMES.ROCKET, url: builtInUrl(`${THEMES.ROCKET}`) },
318
- { name: THEMES.SAHARA, url: builtInUrl(`${THEMES.SAHARA}`) },
319
- { name: THEMES.SEAFOAM, url: builtInUrl(`${THEMES.SEAFOAM}`) },
320
- { name: THEMES.SEASONAL, url: builtInUrl(`${THEMES.SEASONAL}`) },
321
- { name: THEMES.SKELETON, url: builtInUrl(`${THEMES.SKELETON}`) },
322
- { name: THEMES.VINTAGE, url: builtInUrl(`${THEMES.VINTAGE}`) }
323
- ];
324
- const themes = ref([...builtInThemes]);
325
- const defaultTheme = THEMES.VUETIFUL;
326
- const chosenTheme = ref(defaultTheme);
327
- const useTheme = () => {
328
- const setTheme = (name) => {
329
- const theme = themes.value.find((t) => t.name === name);
330
- if (!theme)
331
- return;
332
- if (isBrowser) {
333
- localStorage.setItem("vuetiful-theme", theme.name);
334
- document.body.setAttribute("data-theme", theme.name);
335
- }
336
- };
337
- const initializeTheme = (callback) => {
338
- if (isBrowser) {
339
- const storedTheme = localStorage.getItem("vuetiful-theme");
340
- if (storedTheme)
341
- loadTheme(storedTheme, callback);
342
- else
343
- loadTheme(defaultTheme, callback);
344
- }
345
- };
346
- const loadTheme = (themeName, callback) => {
347
- let themeToLoad = themes.value.find((t) => t.name === themeName);
348
- if (!themeToLoad)
349
- themeToLoad = themes.value.find((t) => t.name === defaultTheme) || themes.value[0];
350
- const theme = themeToLoad;
351
- chosenTheme.value = theme.name;
352
- const existingStyle = document.getElementById("theme");
353
- let themeUrl = theme.url;
354
- const link = document.createElement("link");
355
- link.id = "theme";
356
- link.href = themeUrl;
357
- link.type = "text/css";
358
- link.rel = "stylesheet";
359
- link.onload = () => {
360
- if (existingStyle)
361
- existingStyle.remove();
362
- setTheme(theme.name);
363
- if (callback) {
364
- callback();
365
- }
366
- };
367
- const head = document.querySelector("head");
368
- if (head)
369
- head.appendChild(link);
370
- };
371
- const registerAllBuiltInThemes = () => {
372
- return [...builtInThemes];
373
- };
374
- const registerTheme = (name, url) => {
375
- return { url, name };
376
- };
377
- const overwriteThemes = (newThemes) => {
378
- themes.value = [...newThemes];
379
- };
83
+ const selectedRailTile = ref("");
84
+ const useRail = () => {
380
85
  return {
381
- themes: readonly(themes),
382
- chosenTheme: readonly(chosenTheme),
383
- initializeTheme,
384
- loadTheme,
385
- THEMES,
386
- overwriteThemes,
387
- registerAllBuiltInThemes,
388
- registerTheme
86
+ selectedRailTile
389
87
  };
390
88
  };
391
- var themeSwitcher_vue_vue_type_style_index_0_scoped_true_lang = "";
392
- const _sfc_main$1 = defineComponent({
393
- components: {
394
- DarkModeSwitch,
395
- VButton
396
- },
89
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
90
+ __name: "VRailTile",
397
91
  props: {
398
- bgLight: {
399
- type: String,
400
- default: "bg-surface-50"
401
- },
402
- bgDark: {
403
- type: String,
404
- default: "bg-surface-900"
405
- },
406
- textOnLight: {
407
- type: String,
408
- default: "text-surface-900"
409
- },
410
- textOnDark: {
92
+ value: {
411
93
  type: String,
412
- default: "text-surface-50"
413
- },
414
- width: {
415
- type: String,
416
- default: "w-60"
94
+ default: ""
417
95
  },
418
- height: {
96
+ tag: {
419
97
  type: String,
420
- default: "max-h-64 lg:max-h-[500px]"
98
+ default: "button"
421
99
  },
422
- ring: {
100
+ label: {
423
101
  type: String,
424
- default: "ring-[1px] ring-surface-500/30"
425
- },
426
- rounded: {
427
- type: String,
428
- default: "rounded-token"
102
+ default: ""
429
103
  },
430
- roundedContainer: {
104
+ regionIcon: {
431
105
  type: String,
432
- default: "rounded-container-token"
106
+ default: ""
433
107
  },
434
- buttonClasses: {
108
+ regionLabel: {
435
109
  type: String,
436
- default: "w-24"
110
+ default: ""
437
111
  }
438
112
  },
439
- setup(props, { attrs }) {
440
- const { initializeTheme, loadTheme, themes: themes2, chosenTheme: chosenTheme2 } = useTheme();
441
- const { currentMode: currentMode2, MODE: MODE2 } = useDarkMode();
442
- const showPopup = ref(false);
443
- onMounted(() => {
444
- initializeTheme();
445
- });
446
- const cTransition = `transition-all duration-[200ms]`;
447
- function onKeyDown(event) {
448
- if (["Enter", "Space"].includes(event.code)) {
449
- event.preventDefault();
450
- event.currentTarget.click();
451
- }
452
- }
453
- const background = computed(() => {
454
- return currentMode2.value === MODE2.LIGHT ? props.bgLight : props.bgDark;
455
- });
456
- const text = computed(() => {
457
- return currentMode2.value === MODE2.LIGHT ? props.textOnLight : props.textOnDark;
458
- });
459
- const classes = computed(() => {
460
- var _a;
461
- return `${cTransition}
462
- ${background.value}
463
- ${text.value}
464
- ${props.width}
465
- ${props.ring}
466
- ${props.roundedContainer}
467
- ${(_a = attrs.class) != null ? _a : ""}`;
468
- });
469
- const listClasses = computed(() => {
470
- return `${cTransition}
471
- ${props.height}`;
472
- });
473
- const listItemClasses = computed(() => {
474
- return `${cTransition}
475
- ${props.ring}
476
- ${props.rounded}`;
477
- });
478
- return {
479
- onKeyDown,
480
- loadTheme,
481
- currentMode: currentMode2,
482
- classes,
483
- chosenTheme: chosenTheme2,
484
- themes: themes2,
485
- showPopup,
486
- listClasses,
487
- listItemClasses
113
+ emits: ["click"],
114
+ setup(__props, { emit }) {
115
+ const props = __props;
116
+ const attrs = useAttrs();
117
+ const { selectedRailTile: selectedRailTile2 } = useRail();
118
+ const active = inject("active");
119
+ const hover = inject("hover");
120
+ const onClickHandler = (event) => {
121
+ if (!props.value)
122
+ return;
123
+ selectedRailTile2.value = props.value;
124
+ emit("click");
125
+ };
126
+ const onKeyHandler = (event) => {
127
+ if (!props.value)
128
+ return;
129
+ if (!["Enter", "Space"].includes(event.key))
130
+ return;
131
+ selectedRailTile2.value = props.value;
132
+ emit("click");
133
+ };
134
+ return (_ctx, _cache) => {
135
+ return openBlock(), createElementBlock("div", {
136
+ onClick: onClickHandler,
137
+ onKeydown: onKeyHandler
138
+ }, [
139
+ (openBlock(), createBlock(resolveDynamicComponent(__props.tag), mergeProps(unref(attrs), {
140
+ class: `app-rail-tile unstyled grid aspect-square w-full cursor-pointer place-content-center place-items-center space-y-1.5 ${unref(hover)} ${unref(selectedRailTile2) === __props.value ? `${unref(active)}` : ""} ${unref(attrs).class || ""}`
141
+ }), {
142
+ default: withCtx(() => [
143
+ _ctx.$slots.default ? (openBlock(), createElementBlock("div", {
144
+ key: 0,
145
+ class: normalizeClass(`app-rail-tile-icon ${__props.regionIcon}`)
146
+ }, [
147
+ renderSlot(_ctx.$slots, "default")
148
+ ], 2)) : createCommentVNode("", true),
149
+ __props.label ? (openBlock(), createElementBlock("div", {
150
+ key: 1,
151
+ class: normalizeClass(`app-rail-tile-label text-center text-xs font-bold ${__props.regionLabel}`)
152
+ }, toDisplayString(__props.label), 3)) : createCommentVNode("", true)
153
+ ]),
154
+ _: 3
155
+ }, 16, ["class"]))
156
+ ], 32);
488
157
  };
489
158
  }
490
159
  });
491
- const _withScopeId = (n) => (pushScopeId("data-v-3283243a"), n = n(), popScopeId(), n);
492
- const _hoisted_1$1 = { class: "cc-theme-switcher" };
493
- const _hoisted_2$1 = { class: "space-y-4" };
494
- const _hoisted_3$1 = { class: "flex items-center justify-between" };
495
- const _hoisted_4 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("h6", null, "Mode", -1));
496
- const _hoisted_5 = { class: "flex flex-col gap-4" };
497
- const _hoisted_6 = ["onClick"];
498
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
499
- const _component_VButton = resolveComponent("VButton");
500
- const _component_DarkModeSwitch = resolveComponent("DarkModeSwitch");
501
- return openBlock(), createElementBlock("div", _hoisted_1$1, [
502
- createVNode(_component_VButton, {
503
- class: normalizeClass(`cc-theme-switcher__button ${_ctx.buttonClasses}`),
504
- onClick: _cache[0] || (_cache[0] = ($event) => _ctx.showPopup = !_ctx.showPopup)
505
- }, {
506
- default: withCtx(() => [
507
- createTextVNode(" Theme ")
508
- ]),
509
- _: 1
510
- }, 8, ["class"]),
511
- _ctx.showPopup ? (openBlock(), createElementBlock("div", {
512
- key: 0,
513
- class: normalizeClass(["cc-theme-switcher__popup p-4 shadow-xl", _ctx.classes])
514
- }, [
515
- createElementVNode("div", _hoisted_2$1, [
516
- createElementVNode("section", _hoisted_3$1, [
517
- _hoisted_4,
518
- createVNode(_component_DarkModeSwitch)
160
+ const _hoisted_1$3 = { class: "vuetiful-shell-content flex h-full w-full flex-auto overflow-hidden" };
161
+ const _sfc_main$3 = defineComponent({
162
+ __name: "VShell",
163
+ props: {
164
+ regionPage: { type: String, default: "" },
165
+ slotFixedHeader: { type: String, default: "z-10" },
166
+ slotSidebarLeft: { type: String, default: "w-auto" },
167
+ slotSidebarRight: { type: String, default: "w-auto" },
168
+ slotPageHeader: { type: String, default: "" },
169
+ slotPageContent: { type: String, default: "" },
170
+ slotPageFooter: { type: String, default: "" },
171
+ slotFixedFooter: { type: String, default: "" }
172
+ },
173
+ setup(__props) {
174
+ const attrs = useAttrs();
175
+ return (_ctx, _cache) => {
176
+ var _a, _b;
177
+ return openBlock(), createElementBlock("div", {
178
+ class: normalizeClass(`vuetiful-shell flex h-full w-full flex-col overflow-hidden ${(_a = unref(attrs).class) != null ? _a : ""}`)
179
+ }, [
180
+ _ctx.$slots.fixedHeader ? (openBlock(), createElementBlock("header", {
181
+ key: 0,
182
+ class: normalizeClass(`vuetiful-fixed-header ${__props.slotFixedHeader}`)
183
+ }, [
184
+ renderSlot(_ctx.$slots, "fixedHeader")
185
+ ], 2)) : createCommentVNode("", true),
186
+ createElementVNode("div", _hoisted_1$3, [
187
+ _ctx.$slots.sidebarLeft ? (openBlock(), createElementBlock("aside", {
188
+ key: 0,
189
+ class: normalizeClass(`vuetiful-sidebar-left overflow-y-auto overflow-x-hidden ${__props.slotSidebarLeft}`)
190
+ }, [
191
+ renderSlot(_ctx.$slots, "sidebarLeft")
192
+ ], 2)) : createCommentVNode("", true),
193
+ createElementVNode("div", {
194
+ class: normalizeClass(`vuetiful-page flex flex-1 flex-col overflow-x-hidden ${(_b = __props.regionPage) != null ? _b : ""}`)
195
+ }, [
196
+ _ctx.$slots.pageHeader ? (openBlock(), createElementBlock("header", {
197
+ key: 0,
198
+ class: normalizeClass(`vuetiful-page-header flex-none ${__props.slotPageHeader}`)
199
+ }, [
200
+ renderSlot(_ctx.$slots, "pageHeader", {}, () => [
201
+ createTextVNode("(slot:header)")
202
+ ])
203
+ ], 2)) : createCommentVNode("", true),
204
+ createElementVNode("main", {
205
+ class: normalizeClass(`vuetiful-page-content flex-auto ${__props.slotPageContent}`)
206
+ }, [
207
+ renderSlot(_ctx.$slots, "default")
208
+ ], 2),
209
+ _ctx.$slots.pageFooter ? (openBlock(), createElementBlock("footer", {
210
+ key: 1,
211
+ class: normalizeClass(`vuetiful-page-footer flex-none ${__props.slotPageFooter}`)
212
+ }, [
213
+ renderSlot(_ctx.$slots, "pageFooter", {}, () => [
214
+ createTextVNode("(slot:footer)")
215
+ ])
216
+ ], 2)) : createCommentVNode("", true)
217
+ ], 2),
218
+ _ctx.$slots.sidebarRight ? (openBlock(), createElementBlock("aside", {
219
+ key: 1,
220
+ class: normalizeClass(`vuetiful-sidebar-right flex-none overflow-y-auto overflow-x-hidden ${__props.slotSidebarRight}`)
221
+ }, [
222
+ renderSlot(_ctx.$slots, "sidebarRight")
223
+ ], 2)) : createCommentVNode("", true)
519
224
  ]),
520
- createElementVNode("nav", {
521
- class: normalizeClass(["list-nav -m-4 overflow-y-auto p-4", _ctx.listClasses])
225
+ _ctx.$slots.fixedFooter ? (openBlock(), createElementBlock("footer", {
226
+ key: 1,
227
+ class: normalizeClass(`vuetiful-fixed-footer ${__props.slotFixedFooter}`)
522
228
  }, [
523
- createElementVNode("ul", _hoisted_5, [
524
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.themes, (theme, index2) => {
525
- return openBlock(), createElementBlock("li", {
526
- class: normalizeClass(["h-full w-full p-2 text-center capitalize hover:cursor-pointer hover:bg-primary-100 hover:text-primary-900", `${_ctx.listItemClasses} ${_ctx.chosenTheme === theme.name ? "bg-primary-50 text-primary-900" : "bg-surface-200 text-surface-900"}`]),
527
- key: index2,
528
- onClick: ($event) => _ctx.loadTheme(theme.name)
529
- }, toDisplayString(theme.name), 11, _hoisted_6);
530
- }), 128))
531
- ])
532
- ], 2)
533
- ])
534
- ], 2)) : createCommentVNode("", true)
535
- ]);
536
- }
537
- var themeSwitcher = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render], ["__scopeId", "data-v-3283243a"]]);
229
+ renderSlot(_ctx.$slots, "fixedFooter")
230
+ ], 2)) : createCommentVNode("", true)
231
+ ], 2);
232
+ };
233
+ }
234
+ });
235
+ var components = /* @__PURE__ */ Object.freeze({
236
+ __proto__: null,
237
+ [Symbol.toStringTag]: "Module",
238
+ VButton: _sfc_main$6,
239
+ VRail: _sfc_main$5,
240
+ VRailTile: _sfc_main$4,
241
+ VShell: _sfc_main$3
242
+ });
243
+ var main = "";
244
+ var tailwind = "";
538
245
  var githubDark = "";
539
246
  var deepFreezeEs6 = { exports: {} };
540
247
  function deepFreeze(obj) {
@@ -46875,12 +46582,12 @@ const useHighlight = () => {
46875
46582
  highlight: highlight2
46876
46583
  };
46877
46584
  };
46878
- const _hoisted_1 = { key: 0 };
46879
- const _hoisted_2 = {
46585
+ const _hoisted_1$2 = { key: 0 };
46586
+ const _hoisted_2$2 = {
46880
46587
  class: /* @__PURE__ */ normalizeClass(`code-block-language`)
46881
46588
  };
46882
- const _hoisted_3 = ["innerHTML"];
46883
- const _sfc_main = /* @__PURE__ */ defineComponent({
46589
+ const _hoisted_3$1 = ["innerHTML"];
46590
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
46884
46591
  __name: "code-block",
46885
46592
  props: {
46886
46593
  language: {
@@ -46960,7 +46667,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
46960
46667
  }
46961
46668
  );
46962
46669
  return (_ctx, _cache) => {
46963
- return __props.language && __props.code ? (openBlock(), createElementBlock("div", _hoisted_1, [
46670
+ return __props.language && __props.code ? (openBlock(), createElementBlock("div", _hoisted_1$2, [
46964
46671
  createElementVNode("div", {
46965
46672
  class: normalizeClass(`code-block ${unref(classesBase)}`),
46966
46673
  "data-testid": "code-block"
@@ -46968,7 +46675,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
46968
46675
  createElementVNode("header", {
46969
46676
  class: normalizeClass(`code-block-header ${cHeader}`)
46970
46677
  }, [
46971
- createElementVNode("span", _hoisted_2, toDisplayString(languageFormatter(__props.language)), 1),
46678
+ createElementVNode("span", _hoisted_2$2, toDisplayString(languageFormatter(__props.language)), 1),
46972
46679
  withDirectives((openBlock(), createElementBlock("button", {
46973
46680
  class: normalizeClass(`code-block-btn ${__props.button}`),
46974
46681
  onClick: _cache[0] || (_cache[0] = ($event) => onCopyClick())
@@ -46984,13 +46691,465 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
46984
46691
  createElementVNode("code", {
46985
46692
  class: normalizeClass(`code-block-code language-${__props.language}`),
46986
46693
  innerHTML: unref(highlight2)(props.code, props.language)
46987
- }, null, 10, _hoisted_3)
46694
+ }, null, 10, _hoisted_3$1)
46988
46695
  ], 2)
46989
46696
  ], 2)
46990
46697
  ])) : createCommentVNode("", true);
46991
46698
  };
46992
46699
  }
46993
46700
  });
46701
+ const usePlatform = () => {
46702
+ const isBrowser2 = typeof window !== "undefined";
46703
+ return {
46704
+ isBrowser: isBrowser2
46705
+ };
46706
+ };
46707
+ const { isBrowser: isBrowser$1 } = usePlatform();
46708
+ const MODE = {
46709
+ LIGHT: true,
46710
+ DARK: false
46711
+ };
46712
+ const modeOsPrefers = ref(MODE.DARK);
46713
+ const currentMode = ref(MODE.DARK);
46714
+ const modeUserPrefers = ref(void 0);
46715
+ const useDarkMode = () => {
46716
+ const getModeOsPrefers = () => {
46717
+ let prefersLightMode = false;
46718
+ if (isBrowser$1)
46719
+ prefersLightMode = window.matchMedia("(prefers-color-scheme: light)").matches;
46720
+ setModeOsPrefers(prefersLightMode);
46721
+ return prefersLightMode;
46722
+ };
46723
+ const getModeUserPrefers = () => {
46724
+ if (isBrowser$1) {
46725
+ const mode = localStorage.getItem("modeUserPrefers");
46726
+ if (mode !== null)
46727
+ modeUserPrefers.value = mode === "true";
46728
+ }
46729
+ return modeUserPrefers.value;
46730
+ };
46731
+ const getModeAutoPrefers = () => {
46732
+ const os = getModeOsPrefers();
46733
+ const user = getModeUserPrefers();
46734
+ if (user === void 0)
46735
+ return os;
46736
+ return user;
46737
+ };
46738
+ const setModeOsPrefers = (value) => {
46739
+ modeOsPrefers.value = value;
46740
+ if (isBrowser$1) {
46741
+ localStorage.setItem("modeOsPrefers", value.toString());
46742
+ }
46743
+ };
46744
+ const setModeUserPrefers = (value) => {
46745
+ modeUserPrefers.value = value;
46746
+ if (isBrowser$1) {
46747
+ localStorage.setItem("modeUserPrefers", value.toString());
46748
+ }
46749
+ };
46750
+ const setModeCurrent = (value) => {
46751
+ const elemHtmlClasses = document.documentElement.classList;
46752
+ const classDark = "dark";
46753
+ value === MODE.LIGHT ? elemHtmlClasses.remove(classDark) : elemHtmlClasses.add(classDark);
46754
+ currentMode.value = value;
46755
+ };
46756
+ const initializeMode = () => {
46757
+ const mode = getModeAutoPrefers();
46758
+ setModeCurrent(mode);
46759
+ };
46760
+ const autoModeWatcher = () => {
46761
+ const mql = window.matchMedia("(prefers-color-scheme: light)");
46762
+ const setMode = (value) => {
46763
+ const elemHtmlClasses = document.documentElement.classList;
46764
+ const classDark = `dark`;
46765
+ value === MODE.LIGHT ? elemHtmlClasses.remove(classDark) : elemHtmlClasses.add(classDark);
46766
+ setModeCurrent(value);
46767
+ };
46768
+ setMode(mql.matches);
46769
+ mql.onchange = () => {
46770
+ setMode(mql.matches);
46771
+ };
46772
+ };
46773
+ return {
46774
+ modeOsPrefers: readonly(modeOsPrefers),
46775
+ modeUserPrefers: readonly(modeUserPrefers),
46776
+ currentMode: readonly(currentMode),
46777
+ getModeOsPrefers,
46778
+ getModeUserPrefers,
46779
+ getModeAutoPrefers,
46780
+ setModeUserPrefers,
46781
+ setModeCurrent,
46782
+ autoModeWatcher,
46783
+ initializeMode,
46784
+ MODE
46785
+ };
46786
+ };
46787
+ var _export_sfc = (sfc, props) => {
46788
+ const target = sfc.__vccOpts || sfc;
46789
+ for (const [key, val] of props) {
46790
+ target[key] = val;
46791
+ }
46792
+ return target;
46793
+ };
46794
+ const _sfc_main$1 = defineComponent({
46795
+ props: {
46796
+ bgLight: {
46797
+ type: String,
46798
+ default: "bg-surface-50"
46799
+ },
46800
+ bgDark: {
46801
+ type: String,
46802
+ default: "bg-surface-900"
46803
+ },
46804
+ textLight: {
46805
+ type: String,
46806
+ default: "text-surface-50"
46807
+ },
46808
+ textDark: {
46809
+ type: String,
46810
+ default: "text-surface-900"
46811
+ },
46812
+ width: {
46813
+ type: String,
46814
+ default: "w-12"
46815
+ },
46816
+ height: {
46817
+ type: String,
46818
+ default: "h-6"
46819
+ },
46820
+ ring: {
46821
+ type: String,
46822
+ default: "ring-[1px] ring-surface-500/30"
46823
+ },
46824
+ rounded: {
46825
+ type: String,
46826
+ default: "rounded-token"
46827
+ }
46828
+ },
46829
+ setup(props, { attrs }) {
46830
+ const { initializeMode, setModeCurrent, setModeUserPrefers, currentMode: currentMode2, MODE: MODE2 } = useDarkMode();
46831
+ onMounted(() => {
46832
+ initializeMode();
46833
+ });
46834
+ const cTransition = `transition-all duration-[200ms]`;
46835
+ const cTrack = "cursor-pointer";
46836
+ const cThumb = "aspect-square scale-[0.8] flex justify-center items-center";
46837
+ const cIcon = "w-[70%] aspect-square";
46838
+ const svgPath = {
46839
+ sun: "M361.5 1.2c5 2.1 8.6 6.6 9.6 11.9L391 121l107.9 19.8c5.3 1 9.8 4.6 11.9 9.6s1.5 10.7-1.6 15.2L446.9 256l62.3 90.3c3.1 4.5 3.7 10.2 1.6 15.2s-6.6 8.6-11.9 9.6L391 391 371.1 498.9c-1 5.3-4.6 9.8-9.6 11.9s-10.7 1.5-15.2-1.6L256 446.9l-90.3 62.3c-4.5 3.1-10.2 3.7-15.2 1.6s-8.6-6.6-9.6-11.9L121 391 13.1 371.1c-5.3-1-9.8-4.6-11.9-9.6s-1.5-10.7 1.6-15.2L65.1 256 2.8 165.7c-3.1-4.5-3.7-10.2-1.6-15.2s6.6-8.6 11.9-9.6L121 121 140.9 13.1c1-5.3 4.6-9.8 9.6-11.9s10.7-1.5 15.2 1.6L256 65.1 346.3 2.8c4.5-3.1 10.2-3.7 15.2-1.6zM352 256c0 53-43 96-96 96s-96-43-96-96s43-96 96-96s96 43 96 96zm32 0c0-70.7-57.3-128-128-128s-128 57.3-128 128s57.3 128 128 128s128-57.3 128-128z",
46840
+ moon: "M223.5 32C100 32 0 132.3 0 256S100 480 223.5 480c60.6 0 115.5-24.2 155.8-63.4c5-4.9 6.3-12.5 3.1-18.7s-10.1-9.7-17-8.5c-9.8 1.7-19.8 2.6-30.1 2.6c-96.9 0-175.5-78.8-175.5-176c0-65.8 36-123.1 89.3-153.3c6.1-3.5 9.2-10.5 7.7-17.3s-7.3-11.9-14.3-12.5c-6.3-.5-12.6-.8-19-.8z"
46841
+ };
46842
+ const onToggleHandler = () => {
46843
+ const toggle = !currentMode2.value;
46844
+ setModeUserPrefers(toggle);
46845
+ setModeCurrent(toggle);
46846
+ };
46847
+ const onKeyDown = (event) => {
46848
+ if (["Enter", "Space"].includes(event.code)) {
46849
+ event.preventDefault();
46850
+ event.currentTarget.click();
46851
+ }
46852
+ };
46853
+ const trackBg = computed(
46854
+ () => currentMode2.value === MODE2.LIGHT ? props.bgLight : props.bgDark
46855
+ );
46856
+ const thumbBg = computed(
46857
+ () => currentMode2.value === MODE2.LIGHT ? props.bgDark : props.bgLight
46858
+ );
46859
+ const thumbPosition = computed(
46860
+ () => currentMode2.value === MODE2.LIGHT ? "translate-x-[100%]" : ""
46861
+ );
46862
+ const iconFill = computed(() => {
46863
+ return currentMode2.value === MODE2.LIGHT ? props.textLight : props.textDark;
46864
+ });
46865
+ const classesTrack = computed(() => {
46866
+ var _a;
46867
+ return `${cTrack} ${cTransition} ${props.width} ${props.height} ${props.ring} ${props.rounded} ${trackBg.value} ${(_a = attrs.class) != null ? _a : ""}`;
46868
+ });
46869
+ const classesThumb = computed(
46870
+ () => `${cThumb} ${cTransition} ${props.height} ${props.rounded} ${thumbBg.value} ${thumbPosition.value}`
46871
+ );
46872
+ const classesIcon = computed(() => `${cIcon}`);
46873
+ return {
46874
+ classesTrack,
46875
+ classesThumb,
46876
+ classesIcon,
46877
+ svgPath,
46878
+ onToggleHandler,
46879
+ onKeyDown,
46880
+ currentMode: currentMode2,
46881
+ iconFill
46882
+ };
46883
+ }
46884
+ });
46885
+ const _hoisted_1$1 = ["aria-checked", "title"];
46886
+ const _hoisted_2$1 = ["d"];
46887
+ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
46888
+ return openBlock(), createElementBlock("div", {
46889
+ class: normalizeClass(`lightswitch-track ${_ctx.classesTrack}`),
46890
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onToggleHandler && _ctx.onToggleHandler(...args)),
46891
+ onKeydown: _cache[1] || (_cache[1] = (...args) => _ctx.onKeyDown && _ctx.onKeyDown(...args)),
46892
+ "on:keyup": "",
46893
+ "on:keypress": "",
46894
+ role: "switch",
46895
+ "aria-label": "Light Switch",
46896
+ "aria-checked": _ctx.currentMode,
46897
+ title: `Toggle ${_ctx.currentMode === false ? "Dark" : "Light"} Mode`,
46898
+ tabindex: "0"
46899
+ }, [
46900
+ createElementVNode("div", {
46901
+ class: normalizeClass(`lightswitch-thumb ${_ctx.classesThumb}`)
46902
+ }, [
46903
+ (openBlock(), createElementBlock("svg", {
46904
+ class: normalizeClass(`lightswitch-icon ${_ctx.classesIcon} ${_ctx.iconFill}`),
46905
+ xmlns: "http://www.w3.org/2000/svg",
46906
+ viewBox: "0 0 512 512"
46907
+ }, [
46908
+ createElementVNode("path", {
46909
+ fill: "currentColor",
46910
+ d: _ctx.currentMode ? _ctx.svgPath.sun : _ctx.svgPath.moon
46911
+ }, null, 8, _hoisted_2$1)
46912
+ ], 2))
46913
+ ], 2)
46914
+ ], 42, _hoisted_1$1);
46915
+ }
46916
+ var DarkModeSwitch = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
46917
+ var themeSwitcher_vue_vue_type_style_index_0_scoped_true_lang = "";
46918
+ const _sfc_main = defineComponent({
46919
+ components: {
46920
+ DarkModeSwitch,
46921
+ VButton: _sfc_main$6
46922
+ },
46923
+ props: {
46924
+ bgLight: {
46925
+ type: String,
46926
+ default: "bg-surface-50"
46927
+ },
46928
+ bgDark: {
46929
+ type: String,
46930
+ default: "bg-surface-900"
46931
+ },
46932
+ textOnLight: {
46933
+ type: String,
46934
+ default: "text-surface-900"
46935
+ },
46936
+ textOnDark: {
46937
+ type: String,
46938
+ default: "text-surface-50"
46939
+ },
46940
+ width: {
46941
+ type: String,
46942
+ default: "w-60"
46943
+ },
46944
+ height: {
46945
+ type: String,
46946
+ default: "max-h-64 lg:max-h-[500px]"
46947
+ },
46948
+ ring: {
46949
+ type: String,
46950
+ default: "ring-[1px] ring-surface-500/30"
46951
+ },
46952
+ rounded: {
46953
+ type: String,
46954
+ default: "rounded-token"
46955
+ },
46956
+ roundedContainer: {
46957
+ type: String,
46958
+ default: "rounded-container-token"
46959
+ },
46960
+ buttonClasses: {
46961
+ type: String,
46962
+ default: "w-24"
46963
+ }
46964
+ },
46965
+ setup(props, { attrs }) {
46966
+ const { initializeTheme, loadTheme, themes: themes2, chosenTheme: chosenTheme2 } = useTheme();
46967
+ const { currentMode: currentMode2, MODE: MODE2 } = useDarkMode();
46968
+ const showPopup = ref(false);
46969
+ onMounted(() => {
46970
+ initializeTheme();
46971
+ });
46972
+ const cTransition = `transition-all duration-[200ms]`;
46973
+ function onKeyDown(event) {
46974
+ if (["Enter", "Space"].includes(event.code)) {
46975
+ event.preventDefault();
46976
+ event.currentTarget.click();
46977
+ }
46978
+ }
46979
+ const background = computed(() => {
46980
+ return currentMode2.value === MODE2.LIGHT ? props.bgLight : props.bgDark;
46981
+ });
46982
+ const text = computed(() => {
46983
+ return currentMode2.value === MODE2.LIGHT ? props.textOnLight : props.textOnDark;
46984
+ });
46985
+ const classes = computed(() => {
46986
+ var _a;
46987
+ return `${cTransition}
46988
+ ${background.value}
46989
+ ${text.value}
46990
+ ${props.width}
46991
+ ${props.ring}
46992
+ ${props.roundedContainer}
46993
+ ${(_a = attrs.class) != null ? _a : ""}`;
46994
+ });
46995
+ const listClasses = computed(() => {
46996
+ return `${cTransition}
46997
+ ${props.height}`;
46998
+ });
46999
+ const listItemClasses = computed(() => {
47000
+ return `${cTransition}
47001
+ ${props.ring}
47002
+ ${props.rounded}`;
47003
+ });
47004
+ return {
47005
+ onKeyDown,
47006
+ loadTheme,
47007
+ currentMode: currentMode2,
47008
+ classes,
47009
+ chosenTheme: chosenTheme2,
47010
+ themes: themes2,
47011
+ showPopup,
47012
+ listClasses,
47013
+ listItemClasses
47014
+ };
47015
+ }
47016
+ });
47017
+ const _withScopeId = (n) => (pushScopeId("data-v-3283243a"), n = n(), popScopeId(), n);
47018
+ const _hoisted_1 = { class: "cc-theme-switcher" };
47019
+ const _hoisted_2 = { class: "space-y-4" };
47020
+ const _hoisted_3 = { class: "flex items-center justify-between" };
47021
+ const _hoisted_4 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("h6", null, "Mode", -1));
47022
+ const _hoisted_5 = { class: "flex flex-col gap-4" };
47023
+ const _hoisted_6 = ["onClick"];
47024
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
47025
+ const _component_VButton = resolveComponent("VButton");
47026
+ const _component_DarkModeSwitch = resolveComponent("DarkModeSwitch");
47027
+ return openBlock(), createElementBlock("div", _hoisted_1, [
47028
+ createVNode(_component_VButton, {
47029
+ class: normalizeClass(`cc-theme-switcher__button ${_ctx.buttonClasses}`),
47030
+ onClick: _cache[0] || (_cache[0] = ($event) => _ctx.showPopup = !_ctx.showPopup)
47031
+ }, {
47032
+ default: withCtx(() => [
47033
+ createTextVNode(" Theme ")
47034
+ ]),
47035
+ _: 1
47036
+ }, 8, ["class"]),
47037
+ _ctx.showPopup ? (openBlock(), createElementBlock("div", {
47038
+ key: 0,
47039
+ class: normalizeClass(["cc-theme-switcher__popup p-4 shadow-xl", _ctx.classes])
47040
+ }, [
47041
+ createElementVNode("div", _hoisted_2, [
47042
+ createElementVNode("section", _hoisted_3, [
47043
+ _hoisted_4,
47044
+ createVNode(_component_DarkModeSwitch)
47045
+ ]),
47046
+ createElementVNode("nav", {
47047
+ class: normalizeClass(["list-nav -m-4 overflow-y-auto p-4", _ctx.listClasses])
47048
+ }, [
47049
+ createElementVNode("ul", _hoisted_5, [
47050
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.themes, (theme, index2) => {
47051
+ return openBlock(), createElementBlock("li", {
47052
+ class: normalizeClass(["h-full w-full p-2 text-center capitalize hover:cursor-pointer hover:bg-primary-100 hover:text-primary-900", `${_ctx.listItemClasses} ${_ctx.chosenTheme === theme.name ? "bg-primary-50 text-primary-900" : "bg-surface-200 text-surface-900"}`]),
47053
+ key: index2,
47054
+ onClick: ($event) => _ctx.loadTheme(theme.name)
47055
+ }, toDisplayString(theme.name), 11, _hoisted_6);
47056
+ }), 128))
47057
+ ])
47058
+ ], 2)
47059
+ ])
47060
+ ], 2)) : createCommentVNode("", true)
47061
+ ]);
47062
+ }
47063
+ var themeSwitcher = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-3283243a"]]);
47064
+ const { isBrowser } = usePlatform();
47065
+ const THEMES = {
47066
+ VUETIFUL: "vuetiful",
47067
+ ROCKET: "rocket",
47068
+ SAHARA: "sahara",
47069
+ SEAFOAM: "seafoam",
47070
+ SEASONAL: "seasonal",
47071
+ SKELETON: "skeleton",
47072
+ VINTAGE: "vintage"
47073
+ };
47074
+ const builtInUrl = (name) => {
47075
+ return `https://code-coaching.dev/vuetiful-themes/theme-${name}.css`;
47076
+ };
47077
+ const builtInThemes = [
47078
+ { name: THEMES.VUETIFUL, url: builtInUrl(`${THEMES.VUETIFUL}-0.0.1`) },
47079
+ { name: THEMES.ROCKET, url: builtInUrl(`${THEMES.ROCKET}`) },
47080
+ { name: THEMES.SAHARA, url: builtInUrl(`${THEMES.SAHARA}`) },
47081
+ { name: THEMES.SEAFOAM, url: builtInUrl(`${THEMES.SEAFOAM}`) },
47082
+ { name: THEMES.SEASONAL, url: builtInUrl(`${THEMES.SEASONAL}`) },
47083
+ { name: THEMES.SKELETON, url: builtInUrl(`${THEMES.SKELETON}`) },
47084
+ { name: THEMES.VINTAGE, url: builtInUrl(`${THEMES.VINTAGE}`) }
47085
+ ];
47086
+ const themes = ref([...builtInThemes]);
47087
+ const defaultTheme = THEMES.VUETIFUL;
47088
+ const chosenTheme = ref(defaultTheme);
47089
+ const useTheme = () => {
47090
+ const saveThemeToStorage = (name) => {
47091
+ const theme = themes.value.find((t) => t.name === name);
47092
+ if (!theme)
47093
+ return;
47094
+ if (isBrowser) {
47095
+ localStorage.setItem("vuetiful-theme", theme.name);
47096
+ document.body.setAttribute("data-theme", theme.name);
47097
+ }
47098
+ };
47099
+ const initializeTheme = (callback) => {
47100
+ if (isBrowser) {
47101
+ const storedTheme = localStorage.getItem("vuetiful-theme");
47102
+ if (storedTheme)
47103
+ loadTheme(storedTheme, callback);
47104
+ else
47105
+ loadTheme(defaultTheme, callback);
47106
+ }
47107
+ };
47108
+ const loadTheme = (themeName, callback) => {
47109
+ let themeToLoad = themes.value.find((t) => t.name === themeName);
47110
+ if (!themeToLoad)
47111
+ themeToLoad = themes.value.find((t) => t.name === defaultTheme) || themes.value[0];
47112
+ const theme = themeToLoad;
47113
+ chosenTheme.value = theme.name;
47114
+ const existingStyle = document.getElementById("theme");
47115
+ let themeUrl = theme.url;
47116
+ const link = document.createElement("link");
47117
+ link.id = "theme";
47118
+ link.href = themeUrl;
47119
+ link.type = "text/css";
47120
+ link.rel = "stylesheet";
47121
+ link.onload = () => {
47122
+ if (existingStyle)
47123
+ existingStyle.remove();
47124
+ saveThemeToStorage(theme.name);
47125
+ if (callback)
47126
+ callback();
47127
+ };
47128
+ const head = document.querySelector("head");
47129
+ if (head)
47130
+ head.appendChild(link);
47131
+ };
47132
+ const registerAllBuiltInThemes = () => {
47133
+ return [...builtInThemes];
47134
+ };
47135
+ const registerTheme = (name, url) => {
47136
+ return { url, name };
47137
+ };
47138
+ const overwriteThemes = (newThemes) => {
47139
+ themes.value = [...newThemes];
47140
+ };
47141
+ return {
47142
+ themes: readonly(themes),
47143
+ chosenTheme: readonly(chosenTheme),
47144
+ initializeTheme,
47145
+ loadTheme,
47146
+ saveThemeToStorage,
47147
+ THEMES,
47148
+ overwriteThemes,
47149
+ registerAllBuiltInThemes,
47150
+ registerTheme
47151
+ };
47152
+ };
46994
47153
  const clipboard = (el, binding) => {
46995
47154
  el.addEventListener("click", () => {
46996
47155
  navigator.clipboard.writeText(binding.value);
@@ -47002,4 +47161,4 @@ function install(app) {
47002
47161
  }
47003
47162
  }
47004
47163
  var index = { install };
47005
- export { _sfc_main as CodeBlock, DarkModeSwitch, MyConstants, themeSwitcher as ThemeSwitcher, VButton, index as default, useDarkMode, useTheme, clipboard as vClipboard };
47164
+ export { _sfc_main$2 as CodeBlock, DarkModeSwitch, themeSwitcher as ThemeSwitcher, _sfc_main$6 as VButton, _sfc_main$5 as VRail, _sfc_main$4 as VRailTile, _sfc_main$3 as VShell, index as default, useDarkMode, useRail, useTheme, clipboard as vClipboard };