@alfakit/vue 0.1.7 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/components/actions/ActionModal.js.map +1 -1
- package/dist/components/actions/ActionModal.vue.d.ts.map +1 -1
- package/dist/components/actions/ActionModal.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/actions/ActionModal.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/form/FormBlock.js.map +1 -1
- package/dist/components/form/FormBlock.vue.d.ts.map +1 -1
- package/dist/components/form/FormBlock.vue_vue_type_script_setup_true_lang.js +79 -78
- package/dist/components/form/FormBlock.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/panel/BottomNav.js.map +1 -1
- package/dist/components/panel/BottomNav.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/components/panel/BottomNav.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/panel/KeyboardShortcuts.js.map +1 -1
- package/dist/components/panel/KeyboardShortcuts.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/panel/KeyboardShortcuts.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/panel/NavGroup.js.map +1 -1
- package/dist/components/panel/NavGroup.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/components/panel/NavGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/panel/NavItem.js.map +1 -1
- package/dist/components/panel/NavItem.vue.d.ts.map +1 -1
- package/dist/components/panel/NavItem.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/panel/NavItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/panel/NavSubItem.js.map +1 -1
- package/dist/components/panel/NavSubItem.vue.d.ts.map +1 -1
- package/dist/components/panel/NavSubItem.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/panel/NavSubItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/ui/TooltipTrigger.js.map +1 -1
- package/dist/components/ui/TooltipTrigger.vue.d.ts +2 -2
- package/dist/components/ui/TooltipTrigger.vue.d.ts.map +1 -1
- package/dist/components/ui/TooltipTrigger.vue_vue_type_script_setup_true_lang.js +10 -7
- package/dist/components/ui/TooltipTrigger.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/eject-manifest.json +4 -2
- package/dist/index.js +2 -2
- package/dist/layouts/TopNavLayout.js.map +1 -1
- package/dist/layouts/TopNavLayout.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/layouts/TopNavLayout.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/layouts/TopNavMenu.js.map +1 -1
- package/dist/layouts/TopNavMenu.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/layouts/TopNavMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/standalone/AlfakitComponent.js.map +1 -1
- package/dist/standalone/AlfakitComponent.vue.d.ts.map +1 -1
- package/dist/standalone/AlfakitComponent.vue_vue_type_script_setup_true_lang.js +29 -24
- package/dist/standalone/AlfakitComponent.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/standalone.css +10 -6
- package/dist/starter-kit/AlfakitStarterKitRoot.js.map +1 -1
- package/dist/starter-kit/AlfakitStarterKitRoot.vue.d.ts.map +1 -1
- package/dist/starter-kit/AlfakitStarterKitRoot.vue_vue_type_script_setup_true_lang.js +25 -21
- package/dist/starter-kit/AlfakitStarterKitRoot.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/starter-kit/index.d.ts +1 -1
- package/dist/starter-kit/index.d.ts.map +1 -1
- package/dist/starter-kit/index.js +2 -2
- package/dist/starter-kit/widgets/LanguageMenu.js +7 -0
- package/dist/starter-kit/widgets/LanguageMenu.js.map +1 -0
- package/dist/starter-kit/widgets/LanguageMenu.vue.d.ts +3 -0
- package/dist/starter-kit/widgets/LanguageMenu.vue.d.ts.map +1 -0
- package/dist/starter-kit/widgets/LanguageMenu.vue_vue_type_script_setup_true_lang.js +52 -0
- package/dist/starter-kit/widgets/LanguageMenu.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/starter-kit/widgets/LanguageSwitcherTrigger.js +7 -0
- package/dist/starter-kit/widgets/LanguageSwitcherTrigger.js.map +1 -0
- package/dist/starter-kit/widgets/LanguageSwitcherTrigger.vue.d.ts +11 -0
- package/dist/starter-kit/widgets/LanguageSwitcherTrigger.vue.d.ts.map +1 -0
- package/dist/starter-kit/widgets/LanguageSwitcherTrigger.vue_vue_type_script_setup_true_lang.js +32 -0
- package/dist/starter-kit/widgets/LanguageSwitcherTrigger.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/starter-kit/widgets/LoadedLanguageSwitcher.js +7 -0
- package/dist/starter-kit/widgets/LoadedLanguageSwitcher.js.map +1 -0
- package/dist/starter-kit/widgets/LoadedLanguageSwitcher.vue.d.ts +12 -0
- package/dist/starter-kit/widgets/LoadedLanguageSwitcher.vue.d.ts.map +1 -0
- package/dist/starter-kit/widgets/LoadedLanguageSwitcher.vue_vue_type_script_setup_true_lang.js +28 -0
- package/dist/starter-kit/widgets/LoadedLanguageSwitcher.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/starter-kit/widgets/index.d.ts +26 -0
- package/dist/starter-kit/widgets/index.d.ts.map +1 -1
- package/dist/starter-kit/widgets/index.js +19 -18
- package/dist/starter-kit/widgets/index.js.map +1 -1
- package/dist/starter-kit/widgets/loaded.d.ts +1 -0
- package/dist/starter-kit/widgets/loaded.d.ts.map +1 -1
- package/dist/starter-kit/widgets/loaded.js +5 -4
- package/dist/starter-kit/widgets/use-widgets.d.ts +2 -1
- package/dist/starter-kit/widgets/use-widgets.d.ts.map +1 -1
- package/dist/starter-kit/widgets/use-widgets.js +15 -15
- package/dist/starter-kit/widgets/use-widgets.js.map +1 -1
- package/package.json +2 -2
- package/src/components/actions/ActionModal.vue +2 -0
- package/src/components/form/FormBlock.vue +15 -2
- package/src/components/panel/BottomNav.vue +2 -2
- package/src/components/panel/KeyboardShortcuts.vue +1 -1
- package/src/components/panel/NavGroup.vue +3 -3
- package/src/components/panel/NavItem.vue +5 -1
- package/src/components/panel/NavSubItem.vue +5 -1
- package/src/components/ui/TooltipTrigger.vue +4 -1
- package/src/layouts/TopNavLayout.vue +2 -2
- package/src/layouts/TopNavMenu.vue +1 -1
- package/src/standalone/AlfakitComponent.vue +8 -1
- package/src/starter-kit/AlfakitStarterKitRoot.vue +6 -0
- package/src/starter-kit/index.ts +1 -0
- package/src/starter-kit/widgets/LanguageMenu.vue +46 -0
- package/src/starter-kit/widgets/LanguageSwitcherTrigger.vue +34 -0
- package/src/starter-kit/widgets/LoadedLanguageSwitcher.vue +27 -0
- package/src/starter-kit/widgets/index.ts +24 -2
- package/src/starter-kit/widgets/loaded.ts +1 -0
- package/src/starter-kit/widgets/use-widgets.ts +10 -5
package/dist/standalone.css
CHANGED
|
@@ -54,19 +54,23 @@
|
|
|
54
54
|
--color-gray: var(--muted-foreground);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
/* The same status tokens as the panel's styles.css (WCAG AA under their foregrounds). */
|
|
57
58
|
:root {
|
|
58
|
-
--success: var(--alfakit-success, oklch(0.
|
|
59
|
-
--success-foreground: oklch(0.985 0 0);
|
|
60
|
-
--warning: var(--alfakit-warning, oklch(0.
|
|
61
|
-
--warning-foreground: oklch(0.
|
|
62
|
-
--info: var(--alfakit-info, oklch(0.
|
|
63
|
-
--info-foreground: oklch(0.985 0 0);
|
|
59
|
+
--success: var(--alfakit-success, oklch(0.48 0.14 150.5));
|
|
60
|
+
--success-foreground: var(--alfakit-success-foreground, oklch(0.985 0 0));
|
|
61
|
+
--warning: var(--alfakit-warning, oklch(0.52 0.15 48));
|
|
62
|
+
--warning-foreground: var(--alfakit-warning-foreground, oklch(0.985 0 0));
|
|
63
|
+
--info: var(--alfakit-info, oklch(0.51 0.24 263.5));
|
|
64
|
+
--info-foreground: var(--alfakit-info-foreground, oklch(0.985 0 0));
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
.dark {
|
|
67
68
|
--success: var(--alfakit-success, oklch(0.723 0.219 149.579));
|
|
69
|
+
--success-foreground: var(--alfakit-success-foreground, oklch(0.145 0 0));
|
|
68
70
|
--warning: var(--alfakit-warning, oklch(0.828 0.189 84.429));
|
|
71
|
+
--warning-foreground: var(--alfakit-warning-foreground, oklch(0.145 0 0));
|
|
69
72
|
--info: var(--alfakit-info, oklch(0.707 0.165 254.624));
|
|
73
|
+
--info-foreground: var(--alfakit-info-foreground, oklch(0.145 0 0));
|
|
70
74
|
}
|
|
71
75
|
|
|
72
76
|
/*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlfakitStarterKitRoot.js","names":["_sfc_main","AlfakitStarterKitRoot_vue_vue_type_script_setup_true_lang_default","AlfakitStarterKitRoot_default"],"sources":["../../src/starter-kit/AlfakitStarterKitRoot.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport {\n STARTER_KIT_TOASTER_ID,\n installStarterKitRuntime,\n syncStarterKitPage,\n type AlfakitPageProps,\n} from '@alfakit/core'\nimport { usePage } from '@inertiajs/vue3'\nimport { onMounted, onUnmounted, watch } from 'vue'\nimport AlfakitRoot from '../AlfakitRoot.vue'\nimport { setToasterId, showToast } from '../components/notifications/flash-toasts'\nimport { provideAlfakit } from '../context'\nimport { starterKitContext, type StarterKitPageOptions } from './runtime'\n\n/**\n * The Inertia layout around every Alfakit page in starter kit mode, inside the host layout:\n * Alfakit's context, modals, toasts and the reading direction. It stays mounted while the\n * user moves between Alfakit pages.\n */\nconst props = defineProps<{ options?: StarterKitPageOptions }>()\nconst context = starterKitContext(props.options ?? {})\nconst page = usePage<AlfakitPageProps>()\n\nprovideAlfakit(context)\n\n// Endpoints follow the open page (synchronously, before children run actions).\nwatch(\n () => page.props.alfakit?.endpoints,\n (endpoints) => {\n if (endpoints) {\n context.actions.setEndpoints({ action: endpoints.action ?? '', modal: endpoints.modal ?? '' })\n }\n },\n { immediate: true, flush: 'sync' },\n)\n\nonMounted(() => {\n installStarterKitRuntime(\n (notification) => showToast(notification),\n (key, replacements, fallback) => context.translator.t(key, replacements, fallback),\n )\n setToasterId(STARTER_KIT_TOASTER_ID)\n\n watch(\n () => page.props,\n (value) => syncStarterKitPage(value as AlfakitPageProps),\n { immediate: true },\n )\n})\n\nonUnmounted(() => {\n // A host page is open: its errors and toasts are the host's again.\n syncStarterKitPage(null)\n setToasterId(undefined)\n})\n</script>\n\n<template>\n <!-- The reading direction and language of Alfakit's content only: the host layout around it\n (sidebar, header) and the app's own pages keep the document's. -->\n <div\n data-slot=\"starter-kit-root\"\n :dir=\"page.props.alfakit?.localization?.direction ?? 'ltr'\"\n :lang=\"page.props.alfakit?.localization?.tag\"\n class=\"contents\"\n >\n <AlfakitRoot :toaster-id=\"STARTER_KIT_TOASTER_ID\">\n <slot />\n </AlfakitRoot>\n </div>\n</template>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"AlfakitStarterKitRoot.js","names":["_sfc_main","AlfakitStarterKitRoot_vue_vue_type_script_setup_true_lang_default","AlfakitStarterKitRoot_default"],"sources":["../../src/starter-kit/AlfakitStarterKitRoot.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport {\n STARTER_KIT_TOASTER_ID,\n installStarterKitRuntime,\n syncStarterKitPage,\n type AlfakitPageProps,\n} from '@alfakit/core'\nimport { usePage } from '@inertiajs/vue3'\nimport { onMounted, onUnmounted, watch } from 'vue'\nimport AlfakitRoot from '../AlfakitRoot.vue'\nimport DebugPanelSlot from '../components/panel/DebugPanelSlot.vue'\nimport { setToasterId, showToast } from '../components/notifications/flash-toasts'\nimport { provideAlfakit } from '../context'\nimport { starterKitContext, type StarterKitPageOptions } from './runtime'\n\n/**\n * The Inertia layout around every Alfakit page in starter kit mode, inside the host layout:\n * Alfakit's context, modals, toasts and the reading direction. It stays mounted while the\n * user moves between Alfakit pages.\n */\nconst props = defineProps<{ options?: StarterKitPageOptions }>()\nconst context = starterKitContext(props.options ?? {})\nconst page = usePage<AlfakitPageProps>()\n\nprovideAlfakit(context)\n\n// Endpoints follow the open page (synchronously, before children run actions).\nwatch(\n () => page.props.alfakit?.endpoints,\n (endpoints) => {\n if (endpoints) {\n context.actions.setEndpoints({ action: endpoints.action ?? '', modal: endpoints.modal ?? '' })\n }\n },\n { immediate: true, flush: 'sync' },\n)\n\nonMounted(() => {\n installStarterKitRuntime(\n (notification) => showToast(notification),\n (key, replacements, fallback) => context.translator.t(key, replacements, fallback),\n )\n setToasterId(STARTER_KIT_TOASTER_ID)\n\n watch(\n () => page.props,\n (value) => syncStarterKitPage(value as AlfakitPageProps),\n { immediate: true },\n )\n})\n\nonUnmounted(() => {\n // A host page is open: its errors and toasts are the host's again.\n syncStarterKitPage(null)\n setToasterId(undefined)\n})\n</script>\n\n<template>\n <!-- The reading direction and language of Alfakit's content only: the host layout around it\n (sidebar, header) and the app's own pages keep the document's. -->\n <div\n data-slot=\"starter-kit-root\"\n :dir=\"page.props.alfakit?.localization?.direction ?? 'ltr'\"\n :lang=\"page.props.alfakit?.localization?.tag\"\n class=\"contents\"\n >\n <AlfakitRoot :toaster-id=\"STARTER_KIT_TOASTER_ID\">\n <slot />\n <!-- The debug panel's button lives in AlfaKit's top bar, which a starter kit doesn't\n render: float it in the corner (nothing without `alfakitDebug`). -->\n <div data-slot=\"starter-kit-debug-panel\" class=\"fixed end-16 bottom-4 z-40\">\n <DebugPanelSlot />\n </div>\n </AlfakitRoot>\n </div>\n</template>\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlfakitStarterKitRoot.vue.d.ts","sourceRoot":"","sources":["../../src/starter-kit/AlfakitStarterKitRoot.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AlfakitStarterKitRoot.vue.d.ts","sourceRoot":"","sources":["../../src/starter-kit/AlfakitStarterKitRoot.vue"],"names":[],"mappings":"AA2FA,OAAO,EAAqB,KAAK,qBAAqB,EAAE,MAAM,WAAW,CAAA;AAEzE;;;;GAIG;AACH,KAAK,WAAW,GAAG;IAAE,OAAO,CAAC,EAAE,qBAAqB,CAAA;CAAE,CAAC;AAgFvD,QAAA,IAAI,OAAO,IAAW,CAAE;AACxB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAsB/C,QAAA,MAAM,eAAe,kSAMnB,CAAC;wBACkB,eAAe,CAAC,OAAO,eAAe,EAAE,WAAW,CAAC;AAAzE,wBAA0E;AAQ1E,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -1,40 +1,44 @@
|
|
|
1
1
|
import { provideAlfakit as e } from "../context.js";
|
|
2
2
|
import { setToasterId as t, showToast as n } from "../components/notifications/flash-toasts.js";
|
|
3
|
-
import r from "../
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import r from "../components/panel/DebugPanelSlot.js";
|
|
4
|
+
import i from "../AlfakitRoot.js";
|
|
5
|
+
import { starterKitContext as a } from "./runtime.js";
|
|
6
|
+
import { STARTER_KIT_TOASTER_ID as o, installStarterKitRuntime as s, syncStarterKitPage as c } from "@alfakit/core";
|
|
7
|
+
import { usePage as l } from "@inertiajs/vue3";
|
|
8
|
+
import { createElementBlock as u, createElementVNode as d, createVNode as f, defineComponent as p, onMounted as m, onUnmounted as h, openBlock as g, renderSlot as _, unref as v, watch as y, withCtx as b } from "vue";
|
|
8
9
|
//#region src/starter-kit/AlfakitStarterKitRoot.vue?vue&type=script&setup=true&lang.ts
|
|
9
|
-
var
|
|
10
|
+
var x = ["dir", "lang"], S = {
|
|
11
|
+
"data-slot": "starter-kit-debug-panel",
|
|
12
|
+
class: "fixed end-16 bottom-4 z-40"
|
|
13
|
+
}, C = /*@__PURE__*/ p({
|
|
10
14
|
__name: "AlfakitStarterKitRoot",
|
|
11
15
|
props: { options: {} },
|
|
12
|
-
setup(
|
|
13
|
-
let
|
|
14
|
-
return e(
|
|
15
|
-
e &&
|
|
16
|
+
setup(p) {
|
|
17
|
+
let C = a(p.options ?? {}), w = l();
|
|
18
|
+
return e(C), y(() => w.props.alfakit?.endpoints, (e) => {
|
|
19
|
+
e && C.actions.setEndpoints({
|
|
16
20
|
action: e.action ?? "",
|
|
17
21
|
modal: e.modal ?? ""
|
|
18
22
|
});
|
|
19
23
|
}, {
|
|
20
24
|
immediate: !0,
|
|
21
25
|
flush: "sync"
|
|
22
|
-
}),
|
|
23
|
-
|
|
24
|
-
}),
|
|
25
|
-
|
|
26
|
-
}), (e, t) => (
|
|
26
|
+
}), m(() => {
|
|
27
|
+
s((e) => n(e), (e, t, n) => C.translator.t(e, t, n)), t(o), y(() => w.props, (e) => c(e), { immediate: !0 });
|
|
28
|
+
}), h(() => {
|
|
29
|
+
c(null), t(void 0);
|
|
30
|
+
}), (e, t) => (g(), u("div", {
|
|
27
31
|
"data-slot": "starter-kit-root",
|
|
28
|
-
dir:
|
|
29
|
-
lang:
|
|
32
|
+
dir: v(w).props.alfakit?.localization?.direction ?? "ltr",
|
|
33
|
+
lang: v(w).props.alfakit?.localization?.tag,
|
|
30
34
|
class: "contents"
|
|
31
|
-
}, [
|
|
32
|
-
default:
|
|
35
|
+
}, [f(i, { "toaster-id": v(o) }, {
|
|
36
|
+
default: b(() => [_(e.$slots, "default"), d("div", S, [f(r)])]),
|
|
33
37
|
_: 3
|
|
34
|
-
}, 8, ["toaster-id"])], 8,
|
|
38
|
+
}, 8, ["toaster-id"])], 8, x));
|
|
35
39
|
}
|
|
36
40
|
});
|
|
37
41
|
//#endregion
|
|
38
|
-
export {
|
|
42
|
+
export { C as default };
|
|
39
43
|
|
|
40
44
|
//# sourceMappingURL=AlfakitStarterKitRoot.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlfakitStarterKitRoot.vue_vue_type_script_setup_true_lang.js","names":["props","_openBlock","_createElementBlock","_unref","_createVNode","AlfakitRoot","_withCtx","_renderSlot","AlfakitRoot_default","_hoisted_1","AlfakitStarterKitRoot_vue_vue_type_script_setup_true_lang_default","context","starterKitContext","__props","page","usePage","provideAlfakit","watch","endpoints","onMounted","installStarterKitRuntime","showToast","notification","key","replacements","fallback","setToasterId","STARTER_KIT_TOASTER_ID","syncStarterKitPage","value","onUnmounted","openBlock","createElementBlock","unref","createVNode","withCtx","renderSlot","_ctx"],"sources":["../../src/starter-kit/AlfakitStarterKitRoot.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport {\n STARTER_KIT_TOASTER_ID,\n installStarterKitRuntime,\n syncStarterKitPage,\n type AlfakitPageProps,\n} from '@alfakit/core'\nimport { usePage } from '@inertiajs/vue3'\nimport { onMounted, onUnmounted, watch } from 'vue'\nimport AlfakitRoot from '../AlfakitRoot.vue'\nimport { setToasterId, showToast } from '../components/notifications/flash-toasts'\nimport { provideAlfakit } from '../context'\nimport { starterKitContext, type StarterKitPageOptions } from './runtime'\n\n/**\n * The Inertia layout around every Alfakit page in starter kit mode, inside the host layout:\n * Alfakit's context, modals, toasts and the reading direction. It stays mounted while the\n * user moves between Alfakit pages.\n */\nconst props = defineProps<{ options?: StarterKitPageOptions }>()\nconst context = starterKitContext(props.options ?? {})\nconst page = usePage<AlfakitPageProps>()\n\nprovideAlfakit(context)\n\n// Endpoints follow the open page (synchronously, before children run actions).\nwatch(\n () => page.props.alfakit?.endpoints,\n (endpoints) => {\n if (endpoints) {\n context.actions.setEndpoints({ action: endpoints.action ?? '', modal: endpoints.modal ?? '' })\n }\n },\n { immediate: true, flush: 'sync' },\n)\n\nonMounted(() => {\n installStarterKitRuntime(\n (notification) => showToast(notification),\n (key, replacements, fallback) => context.translator.t(key, replacements, fallback),\n )\n setToasterId(STARTER_KIT_TOASTER_ID)\n\n watch(\n () => page.props,\n (value) => syncStarterKitPage(value as AlfakitPageProps),\n { immediate: true },\n )\n})\n\nonUnmounted(() => {\n // A host page is open: its errors and toasts are the host's again.\n syncStarterKitPage(null)\n setToasterId(undefined)\n})\n</script>\n\n<template>\n <!-- The reading direction and language of Alfakit's content only: the host layout around it\n (sidebar, header) and the app's own pages keep the document's. -->\n <div\n data-slot=\"starter-kit-root\"\n :dir=\"page.props.alfakit?.localization?.direction ?? 'ltr'\"\n :lang=\"page.props.alfakit?.localization?.tag\"\n class=\"contents\"\n >\n <AlfakitRoot :toaster-id=\"STARTER_KIT_TOASTER_ID\">\n <slot />\n </AlfakitRoot>\n </div>\n</template>\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"AlfakitStarterKitRoot.vue_vue_type_script_setup_true_lang.js","names":["props","_openBlock","_createElementBlock","_unref","_createVNode","AlfakitRoot","_withCtx","_renderSlot","_createElementVNode","DebugPanelSlot","DebugPanelSlot_default","AlfakitRoot_default","_hoisted_1","_hoisted_2","AlfakitStarterKitRoot_vue_vue_type_script_setup_true_lang_default","context","starterKitContext","__props","page","usePage","provideAlfakit","watch","endpoints","onMounted","installStarterKitRuntime","showToast","notification","key","replacements","fallback","setToasterId","STARTER_KIT_TOASTER_ID","syncStarterKitPage","value","onUnmounted","openBlock","createElementBlock","unref","createVNode","withCtx","renderSlot","_ctx","createElementVNode"],"sources":["../../src/starter-kit/AlfakitStarterKitRoot.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport {\n STARTER_KIT_TOASTER_ID,\n installStarterKitRuntime,\n syncStarterKitPage,\n type AlfakitPageProps,\n} from '@alfakit/core'\nimport { usePage } from '@inertiajs/vue3'\nimport { onMounted, onUnmounted, watch } from 'vue'\nimport AlfakitRoot from '../AlfakitRoot.vue'\nimport DebugPanelSlot from '../components/panel/DebugPanelSlot.vue'\nimport { setToasterId, showToast } from '../components/notifications/flash-toasts'\nimport { provideAlfakit } from '../context'\nimport { starterKitContext, type StarterKitPageOptions } from './runtime'\n\n/**\n * The Inertia layout around every Alfakit page in starter kit mode, inside the host layout:\n * Alfakit's context, modals, toasts and the reading direction. It stays mounted while the\n * user moves between Alfakit pages.\n */\nconst props = defineProps<{ options?: StarterKitPageOptions }>()\nconst context = starterKitContext(props.options ?? {})\nconst page = usePage<AlfakitPageProps>()\n\nprovideAlfakit(context)\n\n// Endpoints follow the open page (synchronously, before children run actions).\nwatch(\n () => page.props.alfakit?.endpoints,\n (endpoints) => {\n if (endpoints) {\n context.actions.setEndpoints({ action: endpoints.action ?? '', modal: endpoints.modal ?? '' })\n }\n },\n { immediate: true, flush: 'sync' },\n)\n\nonMounted(() => {\n installStarterKitRuntime(\n (notification) => showToast(notification),\n (key, replacements, fallback) => context.translator.t(key, replacements, fallback),\n )\n setToasterId(STARTER_KIT_TOASTER_ID)\n\n watch(\n () => page.props,\n (value) => syncStarterKitPage(value as AlfakitPageProps),\n { immediate: true },\n )\n})\n\nonUnmounted(() => {\n // A host page is open: its errors and toasts are the host's again.\n syncStarterKitPage(null)\n setToasterId(undefined)\n})\n</script>\n\n<template>\n <!-- The reading direction and language of Alfakit's content only: the host layout around it\n (sidebar, header) and the app's own pages keep the document's. -->\n <div\n data-slot=\"starter-kit-root\"\n :dir=\"page.props.alfakit?.localization?.direction ?? 'ltr'\"\n :lang=\"page.props.alfakit?.localization?.tag\"\n class=\"contents\"\n >\n <AlfakitRoot :toaster-id=\"STARTER_KIT_TOASTER_ID\">\n <slot />\n <!-- The debug panel's button lives in AlfaKit's top bar, which a starter kit doesn't\n render: float it in the corner (nothing without `alfakitDebug`). -->\n <div data-slot=\"starter-kit-debug-panel\" class=\"fixed end-16 bottom-4 z-40\">\n <DebugPanelSlot />\n </div>\n </AlfakitRoot>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;EAqBA,IAAMe,IAAUC,EAAkBhB,EAAM,WAAW,CAAC,CAAC,GAC/CkB,IAAOC,EAA0B;SAEvCC,EAAeL,CAAO,GAGtBM,QACQH,EAAK,MAAM,SAAS,YACzB,MAAc;GACb,AAAII,KACFP,EAAQ,QAAQ,aAAa;IAAE,QAAQO,EAAU,UAAU;IAAI,OAAOA,EAAU,SAAS;GAAG,CAAC;EAEjG,GACA;GAAE,WAAW;GAAM,OAAO;EAAO,CACnC,GAEAC,QAAgB;GAOd,AANAC,GACG,MAAiBC,EAAUC,CAAY,IACvC,GAAK,GAAc,MAAaX,EAAQ,WAAW,EAAEY,GAAKC,GAAcC,CAAQ,CACnF,GACAC,EAAaC,CAAsB,GAEnCV,QACQH,EAAK,QACV,MAAUc,EAAmBC,CAAyB,GACvD,EAAE,WAAW,GAAK,CACpB;EACF,CAAC,GAEDC,QAAkB;GAGhB,AADAF,EAAmB,IAAI,GACvBF,EAAa,KAAA,CAAS;EACxB,CAAC,cAMC7B,EAAA,GAAAC,EAcM,OAAA;GAbJ,aAAU;GACT,KAAKC,EAAAe,CAAA,CAAI,CAAC,MAAM,SAAS,cAAc,aAAS;GAChD,MAAMf,EAAAe,CAAA,CAAI,CAAC,MAAM,SAAS,cAAc;GACzC,OAAM;EAENd,GAAAA,CAAAA,EAOcC,GAAA,EAPA,cAAYF,EAAA4B,CAAA,EAAsB,GAAA;GAC9C,SAAAzB,QAAQ,CAARC,EAAQkC,EAAA,QAAA,SAAA,GAGRjC,EAEM,OAFNK,GAEM,CADJT,EAAkBK,CAAA,CAAA,CAAA,CAAA,CAAA"}
|
|
@@ -3,5 +3,5 @@ export { AlfakitWidgets } from './dashboard-widgets';
|
|
|
3
3
|
export { useAlfakitNavigation, type AlfakitNavigation } from './navigation';
|
|
4
4
|
export { createStarterKitPage, type StarterKitPageOptions } from './starter-kit';
|
|
5
5
|
export { default as StarterKitContentLayout } from './StarterKitContentLayout.vue';
|
|
6
|
-
export { AlfakitCopilot, AlfakitNotifications, AlfakitSearch, AlfakitTenantSwitcher, } from './widgets';
|
|
6
|
+
export { AlfakitCopilot, AlfakitLanguageSwitcher, AlfakitNotifications, AlfakitSearch, AlfakitTenantSwitcher, } from './widgets';
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/starter-kit/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,oBAAoB,EAAE,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAC3E,OAAO,EAAE,oBAAoB,EAAE,KAAK,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAChF,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,+BAA+B,CAAA;AAClF,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,aAAa,EACb,qBAAqB,GACtB,MAAM,WAAW,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/starter-kit/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,oBAAoB,EAAE,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAC3E,OAAO,EAAE,oBAAoB,EAAE,KAAK,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAChF,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,+BAA+B,CAAA;AAClF,OAAO,EACL,cAAc,EACd,uBAAuB,EACvB,oBAAoB,EACpB,aAAa,EACb,qBAAqB,GACtB,MAAM,WAAW,CAAA"}
|
|
@@ -3,5 +3,5 @@ import t from "./AlfakitStarterKitRoot.js";
|
|
|
3
3
|
import { AlfakitWidgets as n } from "./dashboard-widgets.js";
|
|
4
4
|
import { useAlfakitNavigation as r } from "./navigation.js";
|
|
5
5
|
import { createStarterKitPage as i } from "./starter-kit.js";
|
|
6
|
-
import { AlfakitCopilot as a,
|
|
7
|
-
export { a as AlfakitCopilot, o as
|
|
6
|
+
import { AlfakitCopilot as a, AlfakitLanguageSwitcher as o, AlfakitNotifications as s, AlfakitSearch as c, AlfakitTenantSwitcher as l } from "./widgets/index.js";
|
|
7
|
+
export { a as AlfakitCopilot, o as AlfakitLanguageSwitcher, s as AlfakitNotifications, c as AlfakitSearch, t as AlfakitStarterKitRoot, l as AlfakitTenantSwitcher, n as AlfakitWidgets, e as StarterKitContentLayout, i as createStarterKitPage, r as useAlfakitNavigation };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LanguageMenu.js","names":["_sfc_main","LanguageMenu_vue_vue_type_script_setup_true_lang_default","LanguageMenu_default"],"sources":["../../../src/starter-kit/widgets/LanguageMenu.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { takeRequestedStarterKitLanguages } from '@alfakit/core'\nimport { LanguagesIcon } from '@lucide/vue'\nimport { computed, onMounted, ref } from 'vue'\nimport LocaleOptions from '../../components/panel/LocaleOptions.vue'\nimport DropdownMenu from '../../components/ui/DropdownMenu.vue'\nimport DropdownMenuContent from '../../components/ui/DropdownMenuContent.vue'\nimport DropdownMenuTrigger from '../../components/ui/DropdownMenuTrigger.vue'\nimport { useLocalization, useT } from '../../context'\n\n/** The loaded language button and menu, inside the widgets' context (`WidgetShell`). */\n\nconst t = useT()\nconst localization = useLocalization()\nconst open = ref(false)\n\n// A click on the trigger before the menu loaded opens it once mounted (taken per mount: the\n// header is a persistent layout, so the switcher around it outlives a language switch), a\n// frame later, as the menu closes again when it opens while focus is on the replaced button.\nonMounted(() => {\n if (takeRequestedStarterKitLanguages()) requestAnimationFrame(() => (open.value = true))\n})\nconst label = computed(() => t('change_language', {}, 'Change language'))\n</script>\n\n<template>\n <DropdownMenu v-model:open=\"open\">\n <DropdownMenuTrigger as-child>\n <button\n type=\"button\"\n data-slot=\"language-switcher-trigger\"\n :aria-label=\"label\"\n :title=\"label\"\n class=\"hover:bg-accent hover:text-accent-foreground data-[state=open]:bg-accent focus-visible:ring-ring/50 inline-flex h-9 min-w-9 shrink-0 items-center justify-center gap-1.5 rounded-md px-2 text-sm font-medium outline-none focus-visible:ring-[3px]\"\n >\n <LanguagesIcon class=\"size-4\" aria-hidden=\"true\" />\n <span :lang=\"localization.tag\" :dir=\"localization.direction\" class=\"hidden sm:inline\">{{\n localization.label\n }}</span>\n </button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" class=\"min-w-40\">\n <LocaleOptions />\n </DropdownMenuContent>\n </DropdownMenu>\n</template>\n"],"mappings":""}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
export default _default;
|
|
3
|
+
//# sourceMappingURL=LanguageMenu.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LanguageMenu.vue.d.ts","sourceRoot":"","sources":["../../../src/starter-kit/widgets/LanguageMenu.vue"],"names":[],"mappings":";AA+LA,wBAKG"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { useLocalization as e, useT as t } from "../../context.js";
|
|
2
|
+
import n from "../../components/ui/DropdownMenu.js";
|
|
3
|
+
import r from "../../components/ui/DropdownMenuContent.js";
|
|
4
|
+
import i from "../../components/ui/DropdownMenuTrigger.js";
|
|
5
|
+
import a from "../../components/panel/LocaleOptions.js";
|
|
6
|
+
import { takeRequestedStarterKitLanguages as o } from "@alfakit/core";
|
|
7
|
+
import { computed as s, createBlock as c, createElementVNode as l, createVNode as u, defineComponent as d, onMounted as f, openBlock as p, ref as m, toDisplayString as h, unref as g, withCtx as _ } from "vue";
|
|
8
|
+
import { LanguagesIcon as v } from "@lucide/vue";
|
|
9
|
+
//#region src/starter-kit/widgets/LanguageMenu.vue?vue&type=script&setup=true&lang.ts
|
|
10
|
+
var y = ["aria-label", "title"], b = ["lang", "dir"], x = /*@__PURE__*/ d({
|
|
11
|
+
__name: "LanguageMenu",
|
|
12
|
+
setup(d) {
|
|
13
|
+
let x = t(), S = e(), C = m(!1);
|
|
14
|
+
f(() => {
|
|
15
|
+
o() && requestAnimationFrame(() => C.value = !0);
|
|
16
|
+
});
|
|
17
|
+
let w = s(() => x("change_language", {}, "Change language"));
|
|
18
|
+
return (e, t) => (p(), c(n, {
|
|
19
|
+
open: C.value,
|
|
20
|
+
"onUpdate:open": t[0] ||= (e) => C.value = e
|
|
21
|
+
}, {
|
|
22
|
+
default: _(() => [u(i, { "as-child": "" }, {
|
|
23
|
+
default: _(() => [l("button", {
|
|
24
|
+
type: "button",
|
|
25
|
+
"data-slot": "language-switcher-trigger",
|
|
26
|
+
"aria-label": w.value,
|
|
27
|
+
title: w.value,
|
|
28
|
+
class: "hover:bg-accent hover:text-accent-foreground data-[state=open]:bg-accent focus-visible:ring-ring/50 inline-flex h-9 min-w-9 shrink-0 items-center justify-center gap-1.5 rounded-md px-2 text-sm font-medium outline-none focus-visible:ring-[3px]"
|
|
29
|
+
}, [u(g(v), {
|
|
30
|
+
class: "size-4",
|
|
31
|
+
"aria-hidden": "true"
|
|
32
|
+
}), l("span", {
|
|
33
|
+
lang: g(S).tag,
|
|
34
|
+
dir: g(S).direction,
|
|
35
|
+
class: "hidden sm:inline"
|
|
36
|
+
}, h(g(S).label), 9, b)], 8, y)]),
|
|
37
|
+
_: 1
|
|
38
|
+
}), u(r, {
|
|
39
|
+
align: "end",
|
|
40
|
+
class: "min-w-40"
|
|
41
|
+
}, {
|
|
42
|
+
default: _(() => [u(a)]),
|
|
43
|
+
_: 1
|
|
44
|
+
})]),
|
|
45
|
+
_: 1
|
|
46
|
+
}, 8, ["open"]));
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
//#endregion
|
|
50
|
+
export { x as default };
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=LanguageMenu.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LanguageMenu.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","DropdownMenu","_withCtx","_createVNode","DropdownMenuTrigger","_createElementVNode","_unref","_toDisplayString","DropdownMenuContent","LocaleOptions","DropdownMenu_default","DropdownMenuContent_default","DropdownMenuTrigger_default","LocaleOptions_default","_hoisted_1","_hoisted_2","LanguageMenu_vue_vue_type_script_setup_true_lang_default","t","useT","localization","useLocalization","open","ref","takeRequestedStarterKitLanguages","label","computed","openBlock","createBlock","_cache","$event","withCtx","createVNode","createElementVNode","unref","LanguagesIcon","toDisplayString"],"sources":["../../../src/starter-kit/widgets/LanguageMenu.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { takeRequestedStarterKitLanguages } from '@alfakit/core'\nimport { LanguagesIcon } from '@lucide/vue'\nimport { computed, onMounted, ref } from 'vue'\nimport LocaleOptions from '../../components/panel/LocaleOptions.vue'\nimport DropdownMenu from '../../components/ui/DropdownMenu.vue'\nimport DropdownMenuContent from '../../components/ui/DropdownMenuContent.vue'\nimport DropdownMenuTrigger from '../../components/ui/DropdownMenuTrigger.vue'\nimport { useLocalization, useT } from '../../context'\n\n/** The loaded language button and menu, inside the widgets' context (`WidgetShell`). */\n\nconst t = useT()\nconst localization = useLocalization()\nconst open = ref(false)\n\n// A click on the trigger before the menu loaded opens it once mounted (taken per mount: the\n// header is a persistent layout, so the switcher around it outlives a language switch), a\n// frame later, as the menu closes again when it opens while focus is on the replaced button.\nonMounted(() => {\n if (takeRequestedStarterKitLanguages()) requestAnimationFrame(() => (open.value = true))\n})\nconst label = computed(() => t('change_language', {}, 'Change language'))\n</script>\n\n<template>\n <DropdownMenu v-model:open=\"open\">\n <DropdownMenuTrigger as-child>\n <button\n type=\"button\"\n data-slot=\"language-switcher-trigger\"\n :aria-label=\"label\"\n :title=\"label\"\n class=\"hover:bg-accent hover:text-accent-foreground data-[state=open]:bg-accent focus-visible:ring-ring/50 inline-flex h-9 min-w-9 shrink-0 items-center justify-center gap-1.5 rounded-md px-2 text-sm font-medium outline-none focus-visible:ring-[3px]\"\n >\n <LanguagesIcon class=\"size-4\" aria-hidden=\"true\" />\n <span :lang=\"localization.tag\" :dir=\"localization.direction\" class=\"hidden sm:inline\">{{\n localization.label\n }}</span>\n </button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" class=\"min-w-40\">\n <LocaleOptions />\n </DropdownMenuContent>\n </DropdownMenu>\n</template>\n"],"mappings":";;;;;;;;;;;;EAYA,IAAMkB,IAAIC,EAAK,GACTC,IAAeC,EAAgB,GAC/BC,IAAOC,EAAI,EAAK;EAKtB,QAAgB;GACd,AAAIC,EAAiC,KAAG,4BAA6B,EAAK,QAAQ,EAAK;EACzF,CAAC;EACD,IAAMC,IAAQC,QAAeR,EAAE,mBAAmB,CAAC,GAAG,iBAAiB,CAAC;oBAItElB,EAAA,GAAAC,EAkBeC,GAAA;GAlBO,MAAMoB,EAAA;GAAA,iBAAA,AAAAO,EAAA,QAAA,MAAA,EAAI,QAAAC;;GAC9B,SAAA3B,QAasB,CAbtBC,EAasBC,GAAA,EAbD,YAAA,GAAQ,GAAA;IAC3B,SAAAF,QAWS,CAXTG,EAWS,UAAA;KAVP,MAAK;KACL,aAAU;KACT,cAAYmB,EAAA;KACZ,OAAOA,EAAA;KACR,OAAM;IAENrB,GAAAA,CAAAA,EAAmDG,EAAA4B,CAAA,GAAA;KAApC,OAAM;KAAS,eAAY;IAC1C7B,CAAAA,GAAAA,EAES,QAAA;KAFF,MAAMC,EAAAa,CAAA,CAAY,CAAC;KAAM,KAAKb,EAAAa,CAAA,CAAY,CAAC;KAAW,OAAM;IACjE,GAAAZ,EAAAD,EAAAa,CAAA,CAAY,CAAC,KAAK,GAAA,GAAAJ,CAAA,CAAA,GAAA,GAAAD,CAAA,CAAA,CAAA;;GAIxBX,CAAAA,GAAAA,EAEsBK,GAAA;IAFD,OAAM;IAAM,OAAM;;IACrC,SAAAN,QAAiB,CAAjBC,EAAiBM,CAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LanguageSwitcherTrigger.js","names":["_sfc_main","LanguageSwitcherTrigger_vue_vue_type_script_setup_true_lang_default","LanguageSwitcherTrigger_default"],"sources":["../../../src/starter-kit/widgets/LanguageSwitcherTrigger.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { requestStarterKitLanguages, type StarterKitWidgets } from '@alfakit/core'\nimport { LanguagesIcon } from '@lucide/vue'\nimport { computed } from 'vue'\n\n/**\n * The language button until its menu has loaded: the languages icon and the current\n * language in its own name (from `sm`). A click is remembered and opens the menu once loaded.\n */\nconst props = defineProps<{ source: StarterKitWidgets }>()\n\nconst language = computed(() => props.source.widgets.language)\n</script>\n\n<template>\n <button\n type=\"button\"\n data-slot=\"language-switcher-trigger\"\n :aria-label=\"language?.label\"\n aria-haspopup=\"menu\"\n :title=\"language?.label\"\n class=\"hover:bg-accent hover:text-accent-foreground data-[state=open]:bg-accent focus-visible:ring-ring/50 inline-flex h-9 min-w-9 shrink-0 items-center justify-center gap-1.5 rounded-md px-2 text-sm font-medium outline-none focus-visible:ring-[3px]\"\n @click=\"requestStarterKitLanguages()\"\n >\n <LanguagesIcon class=\"size-4\" aria-hidden=\"true\" />\n <span\n v-if=\"language\"\n :lang=\"language.current.tag\"\n :dir=\"language.current.direction\"\n class=\"hidden sm:inline\"\n >{{ language.current.label }}</span\n >\n </button>\n</template>\n"],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type StarterKitWidgets } from '@alfakit/core';
|
|
2
|
+
/**
|
|
3
|
+
* The language button until its menu has loaded: the languages icon and the current
|
|
4
|
+
* language in its own name (from `sm`). A click is remembered and opens the menu once loaded.
|
|
5
|
+
*/
|
|
6
|
+
type __VLS_Props = {
|
|
7
|
+
source: StarterKitWidgets;
|
|
8
|
+
};
|
|
9
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
10
|
+
export default _default;
|
|
11
|
+
//# sourceMappingURL=LanguageSwitcherTrigger.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LanguageSwitcherTrigger.vue.d.ts","sourceRoot":"","sources":["../../../src/starter-kit/widgets/LanguageSwitcherTrigger.vue"],"names":[],"mappings":"AAoCA,OAAO,EAA8B,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAIlF;;;GAGG;AACH,KAAK,WAAW,GAAG;IAAE,MAAM,EAAE,iBAAiB,CAAA;CAAE,CAAC;;AAqFjD,wBAMG"}
|
package/dist/starter-kit/widgets/LanguageSwitcherTrigger.vue_vue_type_script_setup_true_lang.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { requestStarterKitLanguages as e } from "@alfakit/core";
|
|
2
|
+
import { computed as t, createCommentVNode as n, createElementBlock as r, createVNode as i, defineComponent as a, openBlock as o, toDisplayString as s, unref as c } from "vue";
|
|
3
|
+
import { LanguagesIcon as l } from "@lucide/vue";
|
|
4
|
+
//#region src/starter-kit/widgets/LanguageSwitcherTrigger.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var u = ["aria-label", "title"], d = ["lang", "dir"], f = /*@__PURE__*/ a({
|
|
6
|
+
__name: "LanguageSwitcherTrigger",
|
|
7
|
+
props: { source: {} },
|
|
8
|
+
setup(a) {
|
|
9
|
+
let f = a, p = t(() => f.source.widgets.language);
|
|
10
|
+
return (t, a) => (o(), r("button", {
|
|
11
|
+
type: "button",
|
|
12
|
+
"data-slot": "language-switcher-trigger",
|
|
13
|
+
"aria-label": p.value?.label,
|
|
14
|
+
"aria-haspopup": "menu",
|
|
15
|
+
title: p.value?.label,
|
|
16
|
+
class: "hover:bg-accent hover:text-accent-foreground data-[state=open]:bg-accent focus-visible:ring-ring/50 inline-flex h-9 min-w-9 shrink-0 items-center justify-center gap-1.5 rounded-md px-2 text-sm font-medium outline-none focus-visible:ring-[3px]",
|
|
17
|
+
onClick: a[0] ||= (t) => c(e)()
|
|
18
|
+
}, [i(c(l), {
|
|
19
|
+
class: "size-4",
|
|
20
|
+
"aria-hidden": "true"
|
|
21
|
+
}), p.value ? (o(), r("span", {
|
|
22
|
+
key: 0,
|
|
23
|
+
lang: p.value.current.tag,
|
|
24
|
+
dir: p.value.current.direction,
|
|
25
|
+
class: "hidden sm:inline"
|
|
26
|
+
}, s(p.value.current.label), 9, d)) : n("", !0)], 8, u));
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
//#endregion
|
|
30
|
+
export { f as default };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=LanguageSwitcherTrigger.vue_vue_type_script_setup_true_lang.js.map
|
package/dist/starter-kit/widgets/LanguageSwitcherTrigger.vue_vue_type_script_setup_true_lang.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LanguageSwitcherTrigger.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_unref","_createVNode","_toDisplayString","_createCommentVNode","_hoisted_1","_hoisted_2","LanguageSwitcherTrigger_vue_vue_type_script_setup_true_lang_default","props","__props","language","computed","openBlock","createElementBlock","_cache","unref","requestStarterKitLanguages","createVNode","LanguagesIcon","toDisplayString","createCommentVNode"],"sources":["../../../src/starter-kit/widgets/LanguageSwitcherTrigger.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { requestStarterKitLanguages, type StarterKitWidgets } from '@alfakit/core'\nimport { LanguagesIcon } from '@lucide/vue'\nimport { computed } from 'vue'\n\n/**\n * The language button until its menu has loaded: the languages icon and the current\n * language in its own name (from `sm`). A click is remembered and opens the menu once loaded.\n */\nconst props = defineProps<{ source: StarterKitWidgets }>()\n\nconst language = computed(() => props.source.widgets.language)\n</script>\n\n<template>\n <button\n type=\"button\"\n data-slot=\"language-switcher-trigger\"\n :aria-label=\"language?.label\"\n aria-haspopup=\"menu\"\n :title=\"language?.label\"\n class=\"hover:bg-accent hover:text-accent-foreground data-[state=open]:bg-accent focus-visible:ring-ring/50 inline-flex h-9 min-w-9 shrink-0 items-center justify-center gap-1.5 rounded-md px-2 text-sm font-medium outline-none focus-visible:ring-[3px]\"\n @click=\"requestStarterKitLanguages()\"\n >\n <LanguagesIcon class=\"size-4\" aria-hidden=\"true\" />\n <span\n v-if=\"language\"\n :lang=\"language.current.tag\"\n :dir=\"language.current.direction\"\n class=\"hidden sm:inline\"\n >{{ language.current.label }}</span\n >\n </button>\n</template>\n"],"mappings":";;;;;;;;EASA,IAAMS,IAAQC,GAERC,IAAWC,QAAeH,EAAM,OAAO,QAAQ,QAAQ;oBAI3DT,EAAA,GAAAC,EAiBS,UAAA;GAhBP,MAAK;GACL,aAAU;GACT,cAAYU,EAAA,OAAU;GACvB,iBAAc;GACb,OAAOA,EAAA,OAAU;GAClB,OAAM;GACL,SAAK,AAAAI,EAAA,QAAA,MAAEb,EAAAe,CAAA,CAA0B,CAAA;EAElCd,GAAAA,CAAAA,EAAmDD,EAAAiB,CAAA,GAAA;GAApC,OAAM;GAAS,eAAY;EAElC,CAAA,GAAAR,EAAA,SADRX,EAAA,GAAAC,EAMC,QAAA;;GAJE,MAAMU,EAAA,MAAS,QAAQ;GACvB,KAAKA,EAAA,MAAS,QAAQ;GACvB,OAAM;EACF,GAAAP,EAAAO,EAAA,MAAS,QAAQ,KAAK,GAAA,GAAAJ,CAAA,KAAAc,EAAA,IAAA,EAAA,CAAA,GAAA,GAAAf,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoadedLanguageSwitcher.js","names":["_sfc_main","LoadedLanguageSwitcher_vue_vue_type_script_setup_true_lang_default","LoadedLanguageSwitcher_default"],"sources":["../../../src/starter-kit/widgets/LoadedLanguageSwitcher.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { showsLanguageSwitcher, type StarterKitWidgets } from '@alfakit/core'\nimport { computed, toRef } from 'vue'\nimport LanguageMenu from './LanguageMenu.vue'\nimport LanguageSwitcherTrigger from './LanguageSwitcherTrigger.vue'\nimport { useWidgetsPanel } from './use-widgets'\nimport WidgetShell from './WidgetShell.vue'\n\n/**\n * The panel's language menu (its languages in their own names, `LocaleOptions`): picking\n * one posts to the panel's locale endpoint and reloads the page in it. Nothing without a\n * language switcher with two or more languages.\n */\nconst props = defineProps<{ source: StarterKitWidgets }>()\n\nconst panel = useWidgetsPanel(toRef(props, 'source'))\nconst visible = computed(() => showsLanguageSwitcher(panel.value?.localization, 'auth'))\n</script>\n\n<template>\n <template v-if=\"panel\">\n <WidgetShell v-if=\"visible\" :panel=\"panel\">\n <LanguageMenu />\n </WidgetShell>\n </template>\n <LanguageSwitcherTrigger v-else :source=\"props.source\" />\n</template>\n"],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type StarterKitWidgets } from '@alfakit/core';
|
|
2
|
+
/**
|
|
3
|
+
* The panel's language menu (its languages in their own names, `LocaleOptions`): picking
|
|
4
|
+
* one posts to the panel's locale endpoint and reloads the page in it. Nothing without a
|
|
5
|
+
* language switcher with two or more languages.
|
|
6
|
+
*/
|
|
7
|
+
type __VLS_Props = {
|
|
8
|
+
source: StarterKitWidgets;
|
|
9
|
+
};
|
|
10
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
export default _default;
|
|
12
|
+
//# sourceMappingURL=LoadedLanguageSwitcher.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoadedLanguageSwitcher.vue.d.ts","sourceRoot":"","sources":["../../../src/starter-kit/widgets/LoadedLanguageSwitcher.vue"],"names":[],"mappings":"AA6BA,OAAO,EAAyB,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAO7E;;;;GAIG;AACH,KAAK,WAAW,GAAG;IAAE,MAAM,EAAE,iBAAiB,CAAA;CAAE,CAAC;;AAwEjD,wBAMG"}
|
package/dist/starter-kit/widgets/LoadedLanguageSwitcher.vue_vue_type_script_setup_true_lang.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import e from "./LanguageSwitcherTrigger.js";
|
|
2
|
+
import { useWidgetsPanel as t } from "./use-widgets.js";
|
|
3
|
+
import n from "./WidgetShell.js";
|
|
4
|
+
import r from "./LanguageMenu.js";
|
|
5
|
+
import { showsLanguageSwitcher as i } from "@alfakit/core";
|
|
6
|
+
import { Fragment as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createVNode as u, defineComponent as d, openBlock as f, toRef as p, unref as m, withCtx as h } from "vue";
|
|
7
|
+
//#region src/starter-kit/widgets/LoadedLanguageSwitcher.vue?vue&type=script&setup=true&lang.ts
|
|
8
|
+
var g = /*@__PURE__*/ d({
|
|
9
|
+
__name: "LoadedLanguageSwitcher",
|
|
10
|
+
props: { source: {} },
|
|
11
|
+
setup(d) {
|
|
12
|
+
let g = d, _ = t(p(g, "source")), v = o(() => i(_.value?.localization, "auth"));
|
|
13
|
+
return (t, i) => m(_) ? (f(), l(a, { key: 0 }, [v.value ? (f(), s(n, {
|
|
14
|
+
key: 0,
|
|
15
|
+
panel: m(_)
|
|
16
|
+
}, {
|
|
17
|
+
default: h(() => [u(r)]),
|
|
18
|
+
_: 1
|
|
19
|
+
}, 8, ["panel"])) : c("", !0)], 64)) : (f(), s(e, {
|
|
20
|
+
key: 1,
|
|
21
|
+
source: g.source
|
|
22
|
+
}, null, 8, ["source"]));
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
//#endregion
|
|
26
|
+
export { g as default };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=LoadedLanguageSwitcher.vue_vue_type_script_setup_true_lang.js.map
|
package/dist/starter-kit/widgets/LoadedLanguageSwitcher.vue_vue_type_script_setup_true_lang.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoadedLanguageSwitcher.vue_vue_type_script_setup_true_lang.js","names":["_unref","_openBlock","_createElementBlock","_Fragment","_createBlock","WidgetShell","_withCtx","_createVNode","LanguageMenu","_createCommentVNode","LanguageSwitcherTrigger","LanguageSwitcherTrigger_default","WidgetShell_default","LanguageMenu_default","LoadedLanguageSwitcher_vue_vue_type_script_setup_true_lang_default","props","__props","panel","useWidgetsPanel","toRef","visible","computed","showsLanguageSwitcher","unref","openBlock","createElementBlock","Fragment","createBlock","withCtx","createVNode","createCommentVNode"],"sources":["../../../src/starter-kit/widgets/LoadedLanguageSwitcher.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { showsLanguageSwitcher, type StarterKitWidgets } from '@alfakit/core'\nimport { computed, toRef } from 'vue'\nimport LanguageMenu from './LanguageMenu.vue'\nimport LanguageSwitcherTrigger from './LanguageSwitcherTrigger.vue'\nimport { useWidgetsPanel } from './use-widgets'\nimport WidgetShell from './WidgetShell.vue'\n\n/**\n * The panel's language menu (its languages in their own names, `LocaleOptions`): picking\n * one posts to the panel's locale endpoint and reloads the page in it. Nothing without a\n * language switcher with two or more languages.\n */\nconst props = defineProps<{ source: StarterKitWidgets }>()\n\nconst panel = useWidgetsPanel(toRef(props, 'source'))\nconst visible = computed(() => showsLanguageSwitcher(panel.value?.localization, 'auth'))\n</script>\n\n<template>\n <template v-if=\"panel\">\n <WidgetShell v-if=\"visible\" :panel=\"panel\">\n <LanguageMenu />\n </WidgetShell>\n </template>\n <LanguageSwitcherTrigger v-else :source=\"props.source\" />\n</template>\n"],"mappings":";;;;;;;;;;;EAaA,IAAMe,IAAQC,GAERC,IAAQC,EAAgBC,EAAMJ,GAAO,QAAQ,CAAC,GAC9CK,IAAUC,QAAeC,EAAsBL,EAAM,OAAO,cAAc,MAAM,CAAC;mBAIrEjB,EAAAiB,CAAA,KAAhBhB,EAAA,GAAAC,EAIWC,GAAA,EAAA,KAAA,EAAA,GAAA,CAHUiB,EAAA,SAAnBnB,EAAA,GAAAG,EAEcC,GAAA;;GAFe,OAAOL,EAAAiB,CAAA;;GAClC,SAAAX,QAAgB,CAAhBC,EAAgBC,CAAA,CAAA,CAAA;;EAGpBP,GAAAA,GAAAA,CAAAA,OAAAA,CAAAA,KAAAA,EAAAA,IAAAA,EAAAA,CAAAA,GAAAA,EAAAA,MAAAA,EAAA,GAAAG,EAAyDM,GAAA;;GAAxB,QAAQK,EAAM"}
|
|
@@ -94,4 +94,30 @@ export declare const AlfakitCopilot: import("vue").DefineComponent<import("vue")
|
|
|
94
94
|
}>> & Readonly<{}>, {
|
|
95
95
|
panel: string | undefined;
|
|
96
96
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
97
|
+
/**
|
|
98
|
+
* The panel's language menu (`locales()`): the current language straight away, and each
|
|
99
|
+
* language in its own name once loaded. Picking one switches the panel's language (the
|
|
100
|
+
* session, the cookie and `persistLocaleUsing()`) and reloads the page, so AlfaKit pages and
|
|
101
|
+
* the header components show it; the host's own pages and `<html lang dir>` are the app's.
|
|
102
|
+
* Renders nothing for guests or with fewer than two languages.
|
|
103
|
+
*/
|
|
104
|
+
export declare const AlfakitLanguageSwitcher: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
105
|
+
/** The `starterKit()` panel to use (by default the open AlfaKit page's panel, else the first one that has this component). */
|
|
106
|
+
panel: {
|
|
107
|
+
type: PropType<string | undefined>;
|
|
108
|
+
default: undefined;
|
|
109
|
+
};
|
|
110
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
111
|
+
[key: string]: any;
|
|
112
|
+
}> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
113
|
+
[key: string]: any;
|
|
114
|
+
}>[] | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
115
|
+
/** The `starterKit()` panel to use (by default the open AlfaKit page's panel, else the first one that has this component). */
|
|
116
|
+
panel: {
|
|
117
|
+
type: PropType<string | undefined>;
|
|
118
|
+
default: undefined;
|
|
119
|
+
};
|
|
120
|
+
}>> & Readonly<{}>, {
|
|
121
|
+
panel: string | undefined;
|
|
122
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
97
123
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/starter-kit/widgets/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAOL,KAAK,QAAQ,EACd,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/starter-kit/widgets/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAOL,KAAK,QAAQ,EACd,MAAM,KAAK,CAAA;AA6GZ;;;;GAIG;AACH,eAAO,MAAM,aAAa;IAhCpB,8HAA8H;;cACrG,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC;;;;;;;;IADrD,8HAA8H;;cACrG,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC;;;;;4EAoC1D,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB;IA3C3B,8HAA8H;;cACrG,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC;;;;;;;;IADrD,8HAA8H;;cACrG,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC;;;;;4EA+C1D,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB;IAtD5B,8HAA8H;;cACrG,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC;;;;;;;;IADrD,8HAA8H;;cACrG,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC;;;;;4EA0D1D,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,cAAc;IAnErB,8HAA8H;;cACrG,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC;;;;;;;;IADrD,8HAA8H;;cACrG,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC;;;;;4EAuE1D,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB;IAjF9B,8HAA8H;;cACrG,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC;;;;;;;;IADrD,8HAA8H;;cACrG,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC;;;;;4EAqF1D,CAAA"}
|
|
@@ -1,40 +1,41 @@
|
|
|
1
1
|
import { lazyComponent as e } from "../../lib/lazy.js";
|
|
2
2
|
import t from "./CopilotTrigger.js";
|
|
3
|
-
import n from "./
|
|
4
|
-
import r from "./
|
|
5
|
-
import i from "./
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
3
|
+
import n from "./LanguageSwitcherTrigger.js";
|
|
4
|
+
import r from "./NotificationsTrigger.js";
|
|
5
|
+
import i from "./SearchTrigger.js";
|
|
6
|
+
import a from "./TenantSwitcherTrigger.js";
|
|
7
|
+
import { starterKitWidgets as o } from "@alfakit/core";
|
|
8
|
+
import { usePage as s } from "@inertiajs/vue3";
|
|
9
|
+
import { computed as c, defineAsyncComponent as l, defineComponent as u, h as d } from "vue";
|
|
9
10
|
//#region src/starter-kit/widgets/index.ts
|
|
10
|
-
function
|
|
11
|
-
let n =
|
|
12
|
-
return
|
|
11
|
+
function f(e, t) {
|
|
12
|
+
let n = s();
|
|
13
|
+
return c(() => o(n.props, e(), t));
|
|
13
14
|
}
|
|
14
|
-
var
|
|
15
|
-
function
|
|
16
|
-
return
|
|
15
|
+
var p = e("AlfakitLoadedSearch", () => import("./loaded.js").then((e) => e.LoadedSearch), i), m = e("AlfakitLoadedNotifications", () => import("./loaded.js").then((e) => e.LoadedNotifications), r), h = e("AlfakitLoadedTenantSwitcher", () => import("./loaded.js").then((e) => e.LoadedTenantSwitcher), a), g = e("AlfakitLoadedLanguageSwitcher", () => import("./loaded.js").then((e) => e.LoadedLanguageSwitcher), n), _ = e("AlfakitLoadedCopilot", () => import("./loaded.js").then((e) => e.LoadedCopilot), t), v = l(() => import("./StarterKitImpersonationBanner.js"));
|
|
16
|
+
function y(e, t, n, r) {
|
|
17
|
+
return u({
|
|
17
18
|
name: e,
|
|
18
19
|
props: { panel: {
|
|
19
20
|
type: String,
|
|
20
21
|
default: void 0
|
|
21
22
|
} },
|
|
22
23
|
setup(e) {
|
|
23
|
-
let i =
|
|
24
|
+
let i = f(() => e.panel, n);
|
|
24
25
|
return () => {
|
|
25
|
-
let e = i.value, a = e?.widgets.impersonation ?
|
|
26
|
+
let e = i.value, a = e?.widgets.impersonation ? d(v, { source: e }) : null;
|
|
26
27
|
if (!e?.widgets[n]) return a;
|
|
27
|
-
let o =
|
|
28
|
+
let o = d("span", {
|
|
28
29
|
"data-slot": t,
|
|
29
30
|
class: "inline-flex"
|
|
30
|
-
}, [
|
|
31
|
+
}, [d(r, { source: e })]);
|
|
31
32
|
return a ? [a, o] : o;
|
|
32
33
|
};
|
|
33
34
|
}
|
|
34
35
|
});
|
|
35
36
|
}
|
|
36
|
-
var
|
|
37
|
+
var b = y("AlfakitSearch", "starter-kit-search", "search", p), x = y("AlfakitNotifications", "starter-kit-notifications", "notifications", m), S = y("AlfakitTenantSwitcher", "starter-kit-tenant-switcher", "tenancy", h), C = y("AlfakitCopilot", "starter-kit-copilot", "copilot", _), w = y("AlfakitLanguageSwitcher", "starter-kit-language-switcher", "language", g);
|
|
37
38
|
//#endregion
|
|
38
|
-
export {
|
|
39
|
+
export { C as AlfakitCopilot, w as AlfakitLanguageSwitcher, x as AlfakitNotifications, b as AlfakitSearch, S as AlfakitTenantSwitcher };
|
|
39
40
|
|
|
40
41
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["SearchTrigger","NotificationsTrigger","TenantSwitcherTrigger","CopilotTrigger","CopilotTrigger_default","NotificationsTrigger_default","SearchTrigger_default","TenantSwitcherTrigger_default","useStarterKitWidgets","page","usePage","computed","starterKitWidgets","panelId","part","LoadedSearch","lazyComponent","module","LoadedNotifications","LoadedTenantSwitcher","LoadedCopilot","StarterKitImpersonationBanner","defineAsyncComponent","headerWidget","defineComponent","source","props","value","banner","h","widget","slot","loaded","AlfakitSearch","AlfakitNotifications","AlfakitTenantSwitcher","AlfakitCopilot"],"sources":["../../../src/starter-kit/widgets/index.ts"],"sourcesContent":["import {\n starterKitWidgets,\n type StarterKitWidgets,\n type StarterKitWidgetsSchema,\n} from '@alfakit/core'\nimport { usePage } from '@inertiajs/vue3'\nimport {\n computed,\n defineAsyncComponent,\n defineComponent,\n h,\n type Component,\n type ComputedRef,\n type PropType,\n} from 'vue'\nimport { lazyComponent } from '../../lib/lazy'\nimport CopilotTrigger from './CopilotTrigger.vue'\nimport NotificationsTrigger from './NotificationsTrigger.vue'\nimport SearchTrigger from './SearchTrigger.vue'\nimport TenantSwitcherTrigger from './TenantSwitcherTrigger.vue'\n\n/**\n * Drop-in header components of starter kit mode (`Panel::starterKit()`): AlfaKit's search,\n * notifications bell and
|
|
1
|
+
{"version":3,"file":"index.js","names":["SearchTrigger","NotificationsTrigger","TenantSwitcherTrigger","LanguageSwitcherTrigger","CopilotTrigger","CopilotTrigger_default","LanguageSwitcherTrigger_default","NotificationsTrigger_default","SearchTrigger_default","TenantSwitcherTrigger_default","useStarterKitWidgets","page","usePage","computed","starterKitWidgets","panelId","part","LoadedSearch","lazyComponent","module","LoadedNotifications","LoadedTenantSwitcher","LoadedLanguageSwitcher","LoadedCopilot","StarterKitImpersonationBanner","defineAsyncComponent","headerWidget","defineComponent","source","props","value","banner","h","widget","slot","loaded","AlfakitSearch","AlfakitNotifications","AlfakitTenantSwitcher","AlfakitCopilot","AlfakitLanguageSwitcher"],"sources":["../../../src/starter-kit/widgets/index.ts"],"sourcesContent":["import {\n starterKitWidgets,\n type StarterKitWidgets,\n type StarterKitWidgetsSchema,\n} from '@alfakit/core'\nimport { usePage } from '@inertiajs/vue3'\nimport {\n computed,\n defineAsyncComponent,\n defineComponent,\n h,\n type Component,\n type ComputedRef,\n type PropType,\n} from 'vue'\nimport { lazyComponent } from '../../lib/lazy'\nimport CopilotTrigger from './CopilotTrigger.vue'\nimport LanguageSwitcherTrigger from './LanguageSwitcherTrigger.vue'\nimport NotificationsTrigger from './NotificationsTrigger.vue'\nimport SearchTrigger from './SearchTrigger.vue'\nimport TenantSwitcherTrigger from './TenantSwitcherTrigger.vue'\n\n/**\n * Drop-in header components of starter kit mode (`Panel::starterKit()`): AlfaKit's search,\n * notifications bell, tenant switcher and language switcher in the host's own header, on every page of the\n * application. They read the shared `alfakitNavigation` prop, render a lightweight trigger\n * straight away, and load their code and the panel data once mounted (never during SSR).\n *\n * ```vue\n * <script setup lang=\"ts\">\n * import { AlfakitCopilot, AlfakitLanguageSwitcher, AlfakitNotifications, AlfakitSearch } from '@alfakit/vue'\n * </script>\n *\n * <template>\n * <AlfakitSearch />\n * <AlfakitNotifications />\n * <AlfakitCopilot />\n * <AlfakitLanguageSwitcher />\n * </template>\n * ```\n */\n\n/** The header components' data of a `starterKit()` panel from the shared prop, or null. */\nfunction useStarterKitWidgets(\n panelId: () => string | undefined,\n part: keyof StarterKitWidgetsSchema,\n): ComputedRef<StarterKitWidgets | null> {\n const page = usePage()\n\n return computed(() => starterKitWidgets(page.props, panelId(), part))\n}\n\nconst LoadedSearch = lazyComponent(\n 'AlfakitLoadedSearch',\n () => import('./loaded').then((module) => module.LoadedSearch),\n SearchTrigger,\n)\n\nconst LoadedNotifications = lazyComponent(\n 'AlfakitLoadedNotifications',\n () => import('./loaded').then((module) => module.LoadedNotifications),\n NotificationsTrigger,\n)\n\nconst LoadedTenantSwitcher = lazyComponent(\n 'AlfakitLoadedTenantSwitcher',\n () => import('./loaded').then((module) => module.LoadedTenantSwitcher),\n TenantSwitcherTrigger,\n)\n\nconst LoadedLanguageSwitcher = lazyComponent(\n 'AlfakitLoadedLanguageSwitcher',\n () => import('./loaded').then((module) => module.LoadedLanguageSwitcher),\n LanguageSwitcherTrigger,\n)\n\nconst LoadedCopilot = lazyComponent(\n 'AlfakitLoadedCopilot',\n () => import('./loaded').then((module) => module.LoadedCopilot),\n CopilotTrigger,\n)\n\n// Only needed while impersonating: its code loads then.\nconst StarterKitImpersonationBanner = defineAsyncComponent(\n () => import('./StarterKitImpersonationBanner.vue'),\n)\n\nfunction headerWidget(\n name: string,\n slot: string,\n part: keyof Omit<StarterKitWidgetsSchema, 'endpoint' | 'impersonation'>,\n loaded: Component,\n) {\n return defineComponent({\n name,\n props: {\n /** The `starterKit()` panel to use (by default the open AlfaKit page's panel, else the first one that has this component). */\n panel: { type: String as PropType<string | undefined>, default: undefined },\n },\n setup(props) {\n const source = useStarterKitWidgets(() => props.panel, part)\n\n return () => {\n const value: StarterKitWidgets | null = source.value\n\n // While impersonating, the first header component shows the banner on host pages.\n const banner = value?.widgets.impersonation\n ? h(StarterKitImpersonationBanner, { source: value })\n : null\n\n if (!value?.widgets[part]) return banner\n\n const widget = h('span', { 'data-slot': slot, class: 'inline-flex' }, [\n h(loaded, { source: value }),\n ])\n\n // A single root unless the banner shows, so attributes from the app still fall through.\n return banner ? [banner, widget] : widget\n }\n },\n })\n}\n\n/**\n * AlfaKit's command palette and global search: the search field opens it, and so do the\n * panel's key bindings (⌘K / Ctrl+K by default), registered once for the page. Renders\n * nothing for guests or without global search and a command palette.\n */\nexport const AlfakitSearch = headerWidget(\n 'AlfakitSearch',\n 'starter-kit-search',\n 'search',\n LoadedSearch,\n)\n\n/**\n * The bell with the user's database notifications (`databaseNotifications()`), polling and\n * realtime updates as in the panel. Renders nothing for guests or without them.\n */\nexport const AlfakitNotifications = headerWidget(\n 'AlfakitNotifications',\n 'starter-kit-notifications',\n 'notifications',\n LoadedNotifications,\n)\n\n/**\n * The tenant switcher of a tenancy panel: the current tenant inside the panel, or a menu\n * to choose one on the host's own pages. Renders nothing for guests or other panels.\n */\nexport const AlfakitTenantSwitcher = headerWidget(\n 'AlfakitTenantSwitcher',\n 'starter-kit-tenant-switcher',\n 'tenancy',\n LoadedTenantSwitcher,\n)\n\n/**\n * The AI copilot of alfasix/alfakit-ai (`AiPlugin::copilot()`): its button and chat\n * slide-over, opened with its key bindings (`mod+j`) from any page. Renders nothing for\n * guests, without the plugin's copilot, for users who may not use it and (tenancy panels)\n * outside a tenant.\n */\nexport const AlfakitCopilot = headerWidget(\n 'AlfakitCopilot',\n 'starter-kit-copilot',\n 'copilot',\n LoadedCopilot,\n)\n\n/**\n * The panel's language menu (`locales()`): the current language straight away, and each\n * language in its own name once loaded. Picking one switches the panel's language (the\n * session, the cookie and `persistLocaleUsing()`) and reloads the page, so AlfaKit pages and\n * the header components show it; the host's own pages and `<html lang dir>` are the app's.\n * Renders nothing for guests or with fewer than two languages.\n */\nexport const AlfakitLanguageSwitcher = headerWidget(\n 'AlfakitLanguageSwitcher',\n 'starter-kit-language-switcher',\n 'language',\n LoadedLanguageSwitcher,\n)\n"],"mappings":";;;;;;;;;;AA2CA,SAASU,EACP,GACA,GACuC;CACvC,IAAMC,IAAOC,EAAQ;CAErB,OAAOC,QAAeC,EAAkBH,EAAK,OAAOI,EAAQ,GAAGC,CAAI,CAAC;AACtE;AAEA,IAAMC,IAAeC,EACnB,6BACM,OAAO,cAAW,CAAC,MAAM,MAAWC,EAAO,YAAY,GAC7DnB,CACF,GAEMoB,IAAsBF,EAC1B,oCACM,OAAO,cAAW,CAAC,MAAM,MAAWC,EAAO,mBAAmB,GACpElB,CACF,GAEMoB,IAAuBH,EAC3B,qCACM,OAAO,cAAW,CAAC,MAAM,MAAWC,EAAO,oBAAoB,GACrEjB,CACF,GAEMoB,IAAyBJ,EAC7B,uCACM,OAAO,cAAW,CAAC,MAAM,MAAWC,EAAO,sBAAsB,GACvEhB,CACF,GAEMoB,IAAgBL,EACpB,8BACM,OAAO,cAAW,CAAC,MAAM,MAAWC,EAAO,aAAa,GAC9Df,CACF,GAGMoB,IAAgCC,QAC9B,OAAO,qCACf;AAEA,SAASC,EACP,GACA,GACA,GACA,GACA;CACA,OAAOC,EAAgB;EACrB;EACA,OAAO,EAEL,OAAO;GAAE,MAAM;GAAwC,SAAS,KAAA;EAAU,EAC5E;EACA,MAAM,GAAO;GACX,IAAMC,IAASlB,QAA2BmB,EAAM,OAAOb,CAAI;GAE3D,aAAa;IACX,IAAMc,IAAkCF,EAAO,OAGzCG,IAASD,GAAO,QAAQ,gBAC1BE,EAAER,GAA+B,EAAE,QAAQM,EAAM,CAAC,IAClD;IAEJ,IAAI,CAACA,GAAO,QAAQd,IAAO,OAAOe;IAElC,IAAME,IAASD,EAAE,QAAQ;KAAE,aAAaE;KAAM,OAAO;IAAc,GAAG,CACpEF,EAAEG,GAAQ,EAAE,QAAQL,EAAM,CAAC,CAC7B,CAAC;IAGD,OAAOC,IAAS,CAACA,GAAQE,CAAM,IAAIA;GACrC;EACF;CACF,CAAC;AACH;AAOA,IAAaG,IAAgBV,EAC3B,iBACA,sBACA,UACAT,CACF,GAMaoB,IAAuBX,EAClC,wBACA,6BACA,iBACAN,CACF,GAMakB,IAAwBZ,EACnC,yBACA,+BACA,WACAL,CACF,GAQakB,IAAiBb,EAC5B,kBACA,uBACA,WACAH,CACF,GASaiB,IAA0Bd,EACrC,2BACA,iCACA,YACAJ,CACF"}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Only loaded in the browser (`import('./loaded')`).
|
|
5
5
|
*/
|
|
6
6
|
export { default as LoadedCopilot } from './LoadedCopilot.vue';
|
|
7
|
+
export { default as LoadedLanguageSwitcher } from './LoadedLanguageSwitcher.vue';
|
|
7
8
|
export { default as LoadedNotifications } from './LoadedNotifications.vue';
|
|
8
9
|
export { default as LoadedSearch } from './LoadedSearch.vue';
|
|
9
10
|
export { default as LoadedTenantSwitcher } from './LoadedTenantSwitcher.vue';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loaded.d.ts","sourceRoot":"","sources":["../../../src/starter-kit/widgets/loaded.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAC1E,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAC5D,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,4BAA4B,CAAA"}
|
|
1
|
+
{"version":3,"file":"loaded.d.ts","sourceRoot":"","sources":["../../../src/starter-kit/widgets/loaded.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AAChF,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAC1E,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAC5D,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,4BAA4B,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import e from "./LoadedCopilot.js";
|
|
2
|
-
import t from "./
|
|
3
|
-
import n from "./
|
|
4
|
-
import r from "./
|
|
5
|
-
|
|
2
|
+
import t from "./LoadedLanguageSwitcher.js";
|
|
3
|
+
import n from "./LoadedNotifications.js";
|
|
4
|
+
import r from "./LoadedSearch.js";
|
|
5
|
+
import i from "./LoadedTenantSwitcher.js";
|
|
6
|
+
export { e as LoadedCopilot, t as LoadedLanguageSwitcher, n as LoadedNotifications, r as LoadedSearch, i as LoadedTenantSwitcher };
|