@alfakit/vue 0.1.6 → 0.1.8

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 (43) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/eject-manifest.json +4 -2
  3. package/dist/index.js +2 -2
  4. package/dist/starter-kit/index.d.ts +1 -1
  5. package/dist/starter-kit/index.d.ts.map +1 -1
  6. package/dist/starter-kit/index.js +2 -2
  7. package/dist/starter-kit/widgets/LanguageMenu.js +7 -0
  8. package/dist/starter-kit/widgets/LanguageMenu.js.map +1 -0
  9. package/dist/starter-kit/widgets/LanguageMenu.vue.d.ts +3 -0
  10. package/dist/starter-kit/widgets/LanguageMenu.vue.d.ts.map +1 -0
  11. package/dist/starter-kit/widgets/LanguageMenu.vue_vue_type_script_setup_true_lang.js +52 -0
  12. package/dist/starter-kit/widgets/LanguageMenu.vue_vue_type_script_setup_true_lang.js.map +1 -0
  13. package/dist/starter-kit/widgets/LanguageSwitcherTrigger.js +7 -0
  14. package/dist/starter-kit/widgets/LanguageSwitcherTrigger.js.map +1 -0
  15. package/dist/starter-kit/widgets/LanguageSwitcherTrigger.vue.d.ts +11 -0
  16. package/dist/starter-kit/widgets/LanguageSwitcherTrigger.vue.d.ts.map +1 -0
  17. package/dist/starter-kit/widgets/LanguageSwitcherTrigger.vue_vue_type_script_setup_true_lang.js +32 -0
  18. package/dist/starter-kit/widgets/LanguageSwitcherTrigger.vue_vue_type_script_setup_true_lang.js.map +1 -0
  19. package/dist/starter-kit/widgets/LoadedLanguageSwitcher.js +7 -0
  20. package/dist/starter-kit/widgets/LoadedLanguageSwitcher.js.map +1 -0
  21. package/dist/starter-kit/widgets/LoadedLanguageSwitcher.vue.d.ts +12 -0
  22. package/dist/starter-kit/widgets/LoadedLanguageSwitcher.vue.d.ts.map +1 -0
  23. package/dist/starter-kit/widgets/LoadedLanguageSwitcher.vue_vue_type_script_setup_true_lang.js +28 -0
  24. package/dist/starter-kit/widgets/LoadedLanguageSwitcher.vue_vue_type_script_setup_true_lang.js.map +1 -0
  25. package/dist/starter-kit/widgets/index.d.ts +26 -0
  26. package/dist/starter-kit/widgets/index.d.ts.map +1 -1
  27. package/dist/starter-kit/widgets/index.js +19 -18
  28. package/dist/starter-kit/widgets/index.js.map +1 -1
  29. package/dist/starter-kit/widgets/loaded.d.ts +1 -0
  30. package/dist/starter-kit/widgets/loaded.d.ts.map +1 -1
  31. package/dist/starter-kit/widgets/loaded.js +5 -4
  32. package/dist/starter-kit/widgets/use-widgets.d.ts +2 -1
  33. package/dist/starter-kit/widgets/use-widgets.d.ts.map +1 -1
  34. package/dist/starter-kit/widgets/use-widgets.js +15 -15
  35. package/dist/starter-kit/widgets/use-widgets.js.map +1 -1
  36. package/package.json +2 -2
  37. package/src/starter-kit/index.ts +1 -0
  38. package/src/starter-kit/widgets/LanguageMenu.vue +46 -0
  39. package/src/starter-kit/widgets/LanguageSwitcherTrigger.vue +34 -0
  40. package/src/starter-kit/widgets/LoadedLanguageSwitcher.vue +27 -0
  41. package/src/starter-kit/widgets/index.ts +24 -2
  42. package/src/starter-kit/widgets/loaded.ts +1 -0
  43. package/src/starter-kit/widgets/use-widgets.ts +10 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @alfakit/vue
2
2
 
3
+ ## 0.1.8
4
+
5
+ ### Patch Changes
6
+
7
+ - `<AlfakitLanguageSwitcher />`: a drop-in header component for starter kits, so users can switch the panel's language from the app header. The first click right after a switch no longer gets lost.
8
+ - Updated dependencies
9
+ - @alfakit/core@0.1.8
10
+
11
+ ## 0.1.7
12
+
13
+ ### Patch Changes
14
+
15
+ - Released with AlfaKit 0.1.7 to keep the npm and PHP versions the same (no frontend changes).
16
+ - Updated dependencies
17
+ - @alfakit/core@0.1.7
18
+
3
19
  ## 0.1.6
4
20
 
5
21
  ### Patch Changes
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "package": "@alfakit/vue",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "adapter": "vue",
5
- "generatedAt": "2026-10-21T13:38:54.828Z",
5
+ "generatedAt": "2026-10-22T11:23:33.540Z",
6
6
  "components": {
7
7
  "TextInput": {
8
8
  "file": "src/components/fields/TextInputField.vue",
@@ -1563,6 +1563,7 @@
1563
1563
  },
1564
1564
  "src/starter-kit/widgets/index.ts": {
1565
1565
  "AlfakitCopilot": "AlfakitCopilot",
1566
+ "AlfakitLanguageSwitcher": "AlfakitLanguageSwitcher",
1566
1567
  "AlfakitNotifications": "AlfakitNotifications",
1567
1568
  "AlfakitSearch": "AlfakitSearch",
1568
1569
  "AlfakitTenantSwitcher": "AlfakitTenantSwitcher"
@@ -1576,6 +1577,7 @@
1576
1577
  "StarterKitPageOptions": "StarterKitPageOptions",
1577
1578
  "StarterKitContentLayout": "StarterKitContentLayout",
1578
1579
  "AlfakitCopilot": "AlfakitCopilot",
1580
+ "AlfakitLanguageSwitcher": "AlfakitLanguageSwitcher",
1579
1581
  "AlfakitNotifications": "AlfakitNotifications",
1580
1582
  "AlfakitSearch": "AlfakitSearch",
1581
1583
  "AlfakitTenantSwitcher": "AlfakitTenantSwitcher"
package/dist/index.js CHANGED
@@ -314,6 +314,6 @@ import Va from "./starter-kit/AlfakitStarterKitRoot.js";
314
314
  import { AlfakitWidgets as Ha } from "./starter-kit/dashboard-widgets.js";
315
315
  import { useAlfakitNavigation as Ua } from "./starter-kit/navigation.js";
316
316
  import { createStarterKitPage as Wa } from "./starter-kit/starter-kit.js";
317
- import { AlfakitCopilot as Ga, AlfakitNotifications as Ka, AlfakitSearch as qa, AlfakitTenantSwitcher as Ja } from "./starter-kit/widgets/index.js";
317
+ import { AlfakitCopilot as Ga, AlfakitLanguageSwitcher as Ka, AlfakitNotifications as qa, AlfakitSearch as Ja, AlfakitTenantSwitcher as Ya } from "./starter-kit/widgets/index.js";
318
318
  export * from "@alfakit/core";
319
- export { e as ALFAKIT_KEY, G as ActionButton, ne as ActionGroupMenu, re as ActionList, Jt as ActionModals, Yt as AiCopilot, Xt as AiStream, na as Alert, ra as AlertDescription, ia as AlertTitle, Zt as AlfakitAnalytics, za as AlfakitComponent, Ga as AlfakitCopilot, Ka as AlfakitNotifications, Ia as AlfakitPage, qa as AlfakitSearch, Va as AlfakitStarterKitRoot, Ja as AlfakitTenantSwitcher, Ra as AlfakitToaster, Ha as AlfakitWidgets, Qt as AnalyticsBreakdown, ja as AppLayout, Nt as AppPage, zi as AppSidebar, Ma as AuthLayout, Dt as Avatar, Ot as AvatarFallback, kt as AvatarImage, R as Badge, Tt as BlankLayout, Bi as BottomNav, Ci as Brand, En as Breadcrumb, aa as BreadcrumbEllipsis, Dn as BreadcrumbItem, On as BreadcrumbLink, kn as BreadcrumbList, An as BreadcrumbPage, jn as BreadcrumbSeparator, Vi as Breadcrumbs, qn as BuilderField, B as Button, yn as CMS_BLOCK_COMPONENTS, $t as CMS_KEY, oa as Calendar, ri as CalendarWidget, an as CallToActionBlock, Ir as CalloutComponent, pt as Card, sa as CardAction, mt as CardContent, ca as CardDescription, la as CardFooter, ua as CardHeader, da as CardTitle, ht as ChartWidget, ve as Checkbox, Jn as CheckboxField, Yn as CheckboxListField, ln as CmsBlockHeading, on as CmsBlocks, Sn as CmsFooter, Cn as CmsHead, Tn as CmsHeader, fn as CmsImage, bn as CmsLanguageSwitcher, rn as CmsLinkButton, Nn as CmsLivePreview, xn as CmsMenuList, wn as CmsNav, Mn as CmsPage, Xn as CodeEditorField, In as CodeEntryComponent, Gn as Collapsible, Kn as CollapsibleContent, Jr as CollapsibleTrigger, Ln as ColorEntryComponent, Zn as ColorPickerField, sn as ColumnsBlock, We as Command, fa as CommandDialog, Ge as CommandEmpty, Ke as CommandGroup, qe as CommandInput, Je as CommandItem, Ye as CommandList, pa as CommandSeparator, ma as CommandShortcut, Et as ConflictBanner, Ct as ContentBlockRenderer, Oa as DashboardCustomizer, dt as DataTable, $n as DatePickerField, Hi as DebugFormState, Wi as DebugPanel, Gi as DebugPanelSlot, Ui as DebugTreeNode, De as Dialog, ha as DialogClose, Oe as DialogContent, ke as DialogDescription, nt as DialogFooter, Ae as DialogHeader, je as DialogTitle, Me as DialogTrigger, K as DropdownMenu, ga as DropdownMenuCheckboxItem, q as DropdownMenuContent, Z as DropdownMenuGroup, J as DropdownMenuItem, Qe as DropdownMenuLabel, _a as DropdownMenuPortal, $e as DropdownMenuRadioGroup, et as DropdownMenuRadioItem, Y as DropdownMenuSeparator, Q as DropdownMenuShortcut, $ as DropdownMenuSub, ee as DropdownMenuSubContent, te as DropdownMenuSubTrigger, X as DropdownMenuTrigger, cn as EmbedBlock, Rr as EmptyStateComponent, Pn as EntryPlaceholder, Fn as EntryWrapper, un as FaqBlock, dn as FeaturesBlock, Wn as FieldWrapper, zr as FieldsetComponent, kr as FileManager, Ar as FileManagerBrowser, jr as FileManagerPickerField, er as FileUploadField, Ze as FilterIndicators, ci as FlashToasts, Br as FlexComponent, me as FormBlock, He as FormattedText, Na as FullscreenLayout, Vr as FusedGroupComponent, pn as GalleryBlock, Ti as GlobalSearch, Hr as GridComponent, Mr as HelpdeskChat, Nr as HelpdeskInbox, mn as HeroBlock, tr as HiddenField, Ur as HtmlComponent, F as Icon, Wr as IconComponent, Rn as IconEntryComponent, nr as IconPickerField, hn as ImageBlock, Gr as ImageComponent, zn as ImageEntryComponent, Ki as ImpersonationBanner, ye as Input, Pr as Kanban, Bn as KeyValueEntryComponent, rr as KeyValueField, wt as KeyboardShortcuts, st as Label, ft as LazyPlaceholder, it as LiveRecordsPill, Ni as LocaleSubMenu, qi as LocaleSwitcher, ka as MAX_WIDTHS, Fr as MixedContent, ir as ModalTableSelectField, or as MoneyInputField, de as NotificationActionButton, di as NotificationsMenu, sr as OneTimeCodeInputField, Pt as PageBlock, Fa as PageContent, Ft as PageForm, jt as PageHeader, It as PageInfolist, Mt as PageShell, Lt as PageTable, Rt as PageWidgets, Kr as PlaceholderComponent, Ne as Popover, va as PopoverAnchor, Pe as PopoverContent, Fe as PopoverTrigger, Ji as PwaManager, Li as PwaMenuItems, ar as QueryBuilderRulesField, ur as RadioField, cr as RadioGroup, lr as RadioGroupItem, fi as RealtimeNotifications, At as RecordPresence, Da as RecordVersionsComponent, le as RenderComponent, Vn as RepeatableEntryComponent, dr as RepeaterField, fr as RichEditorField, gn as RichTextBlock, t as STANDALONE_KEY, qr as SchemaChildren, ue as SchemaRenderer, ui as ScrollArea, li as ScrollBar, _n as SectionBlock, Yr as SectionComponent, pr as Select, mr as SelectContent, br as SelectField, hr as SelectGroup, gr as SelectItem, _r as SelectLabel, ya as SelectSeparator, vr as SelectTrigger, yr as SelectValue, Qi as Separator, Ie as Sheet, ba as SheetClose, Le as SheetContent, Re as SheetDescription, qt as SheetFooter, ze as SheetHeader, Be as SheetTitle, Ve as SheetTrigger, Yi as ShortcutKeys, Xi as ShortcutsOverlay, mi as Sidebar, hi as SidebarContent, gi as SidebarFooter, Ei as SidebarGroup, Di as SidebarGroupContent, Oi as SidebarGroupLabel, _i as SidebarHeader, xa as SidebarInput, Sa as SidebarInset, vi as SidebarMenu, bi as SidebarMenuButton, xi as SidebarMenuItem, ki as SidebarMenuSub, Ai as SidebarMenuSubButton, ji as SidebarMenuSubItem, Ca as SidebarProvider, Si as SidebarRail, wa as SidebarSeparator, $i as SidebarTrigger, Pi as SignInLink, lt as Skeleton, xr as SliderField, Ee as Slot, V as Spinner, ut as Spreadsheet, Ba as StarterKitContentLayout, gt as StatsOverviewWidget, Ue as Switch, be as Table, xe as TableBody, Ta as TableCaption, Se as TableCell, Xe as TableCellContent, rt as TableFilters, tt as TableFooter, Ce as TableHead, we as TableHeader, ot as TablePagination, Te as TableRow, ct as TableViews, yt as Tabs, Xr as TabsComponent, bt as TabsContent, xt as TabsList, St as TabsTrigger, Sr as TagsInputField, Mi as TenantMenu, vn as TestimonialsBlock, Zr as TextComponent, Hn as TextEntryComponent, Tr as TextInputField, Cr as Textarea, wr as TextareaField, Zi as ThemeToggle, Ea as Toaster, Dr as ToggleButtonsField, Or as ToggleField, H as Tooltip, U as TooltipContent, Er as TooltipProvider, W as TooltipTrigger, Aa as TopNavLayout, ta as Topbar, ea as TopbarLocaleSwitcher, ti as TranslationManager, ni as Tree, fe as UndoButton, Qr as UnorderedListComponent, Fi as UserAvatar, Ri as UserMenu, $r as ViewComponent, Un as ViewEntryComponent, vt as WidgetGrid, _t as WidgetRenderer, ei as WizardComponent, C as badgeColorClasses, L as badgeVariants, z as buttonVariants, b as cn, w as colorClass, si as configureAlfakit, La as createAlfakit, oi as createDefaultRegistry, Wa as createStarterKitPage, T as cssColor, ii as discoverComponents, ai as discoveredComponent, E as ghostButtonColorClasses, P as hasIcon, D as iconBackgroundColorClasses, O as iconSizeClasses, Ii as installPwa, k as outlineButtonColorClasses, Pa as panelLayouts, Qn as phpToDateFnsFormat, n as provideAlfakit, en as provideCms, ie as provideForm, v as providePageActionContext, r as provideStandalone, I as resolveIcon, pe as showToast, yi as sidebarMenuButtonVariants, A as solidButtonColorClasses, j as switchOffColorClasses, M as switchOnColorClasses, N as textColorClasses, i as useActionRunner, a as useAlfakit, Ua as useAlfakitNavigation, o as useAlfakitProps, zt as useAppPage, s as useChoice, tn as useCms, nn as useCmsT, c as useDirection, ae as useField, oe as useFormState, se as useFormStore, l as useFormatter, wi as useHydrated, he as useIsMobile, Vt as useLiveProps, at as useLiveUpdates, u as useLocalization, d as useOptionalAlfakit, ce as useOptionalFormStore, y as usePageActionContext, Bt as usePageBlock, Ht as usePageForm, Ut as usePageMethod, Wt as usePageMethods, f as usePageSchema, p as usePanel, m as usePollComponent, h as useRegistry, Gt as useReloadProps, Lr as useSchemaComponentContext, ge as useScrollToErroredItem, Kt as useShortcut, pi as useSidebar, g as useStandalone, x as useStore, S as useStoreSelector, _ as useT, _e as useVirtualList };
319
+ export { e as ALFAKIT_KEY, G as ActionButton, ne as ActionGroupMenu, re as ActionList, Jt as ActionModals, Yt as AiCopilot, Xt as AiStream, na as Alert, ra as AlertDescription, ia as AlertTitle, Zt as AlfakitAnalytics, za as AlfakitComponent, Ga as AlfakitCopilot, Ka as AlfakitLanguageSwitcher, qa as AlfakitNotifications, Ia as AlfakitPage, Ja as AlfakitSearch, Va as AlfakitStarterKitRoot, Ya as AlfakitTenantSwitcher, Ra as AlfakitToaster, Ha as AlfakitWidgets, Qt as AnalyticsBreakdown, ja as AppLayout, Nt as AppPage, zi as AppSidebar, Ma as AuthLayout, Dt as Avatar, Ot as AvatarFallback, kt as AvatarImage, R as Badge, Tt as BlankLayout, Bi as BottomNav, Ci as Brand, En as Breadcrumb, aa as BreadcrumbEllipsis, Dn as BreadcrumbItem, On as BreadcrumbLink, kn as BreadcrumbList, An as BreadcrumbPage, jn as BreadcrumbSeparator, Vi as Breadcrumbs, qn as BuilderField, B as Button, yn as CMS_BLOCK_COMPONENTS, $t as CMS_KEY, oa as Calendar, ri as CalendarWidget, an as CallToActionBlock, Ir as CalloutComponent, pt as Card, sa as CardAction, mt as CardContent, ca as CardDescription, la as CardFooter, ua as CardHeader, da as CardTitle, ht as ChartWidget, ve as Checkbox, Jn as CheckboxField, Yn as CheckboxListField, ln as CmsBlockHeading, on as CmsBlocks, Sn as CmsFooter, Cn as CmsHead, Tn as CmsHeader, fn as CmsImage, bn as CmsLanguageSwitcher, rn as CmsLinkButton, Nn as CmsLivePreview, xn as CmsMenuList, wn as CmsNav, Mn as CmsPage, Xn as CodeEditorField, In as CodeEntryComponent, Gn as Collapsible, Kn as CollapsibleContent, Jr as CollapsibleTrigger, Ln as ColorEntryComponent, Zn as ColorPickerField, sn as ColumnsBlock, We as Command, fa as CommandDialog, Ge as CommandEmpty, Ke as CommandGroup, qe as CommandInput, Je as CommandItem, Ye as CommandList, pa as CommandSeparator, ma as CommandShortcut, Et as ConflictBanner, Ct as ContentBlockRenderer, Oa as DashboardCustomizer, dt as DataTable, $n as DatePickerField, Hi as DebugFormState, Wi as DebugPanel, Gi as DebugPanelSlot, Ui as DebugTreeNode, De as Dialog, ha as DialogClose, Oe as DialogContent, ke as DialogDescription, nt as DialogFooter, Ae as DialogHeader, je as DialogTitle, Me as DialogTrigger, K as DropdownMenu, ga as DropdownMenuCheckboxItem, q as DropdownMenuContent, Z as DropdownMenuGroup, J as DropdownMenuItem, Qe as DropdownMenuLabel, _a as DropdownMenuPortal, $e as DropdownMenuRadioGroup, et as DropdownMenuRadioItem, Y as DropdownMenuSeparator, Q as DropdownMenuShortcut, $ as DropdownMenuSub, ee as DropdownMenuSubContent, te as DropdownMenuSubTrigger, X as DropdownMenuTrigger, cn as EmbedBlock, Rr as EmptyStateComponent, Pn as EntryPlaceholder, Fn as EntryWrapper, un as FaqBlock, dn as FeaturesBlock, Wn as FieldWrapper, zr as FieldsetComponent, kr as FileManager, Ar as FileManagerBrowser, jr as FileManagerPickerField, er as FileUploadField, Ze as FilterIndicators, ci as FlashToasts, Br as FlexComponent, me as FormBlock, He as FormattedText, Na as FullscreenLayout, Vr as FusedGroupComponent, pn as GalleryBlock, Ti as GlobalSearch, Hr as GridComponent, Mr as HelpdeskChat, Nr as HelpdeskInbox, mn as HeroBlock, tr as HiddenField, Ur as HtmlComponent, F as Icon, Wr as IconComponent, Rn as IconEntryComponent, nr as IconPickerField, hn as ImageBlock, Gr as ImageComponent, zn as ImageEntryComponent, Ki as ImpersonationBanner, ye as Input, Pr as Kanban, Bn as KeyValueEntryComponent, rr as KeyValueField, wt as KeyboardShortcuts, st as Label, ft as LazyPlaceholder, it as LiveRecordsPill, Ni as LocaleSubMenu, qi as LocaleSwitcher, ka as MAX_WIDTHS, Fr as MixedContent, ir as ModalTableSelectField, or as MoneyInputField, de as NotificationActionButton, di as NotificationsMenu, sr as OneTimeCodeInputField, Pt as PageBlock, Fa as PageContent, Ft as PageForm, jt as PageHeader, It as PageInfolist, Mt as PageShell, Lt as PageTable, Rt as PageWidgets, Kr as PlaceholderComponent, Ne as Popover, va as PopoverAnchor, Pe as PopoverContent, Fe as PopoverTrigger, Ji as PwaManager, Li as PwaMenuItems, ar as QueryBuilderRulesField, ur as RadioField, cr as RadioGroup, lr as RadioGroupItem, fi as RealtimeNotifications, At as RecordPresence, Da as RecordVersionsComponent, le as RenderComponent, Vn as RepeatableEntryComponent, dr as RepeaterField, fr as RichEditorField, gn as RichTextBlock, t as STANDALONE_KEY, qr as SchemaChildren, ue as SchemaRenderer, ui as ScrollArea, li as ScrollBar, _n as SectionBlock, Yr as SectionComponent, pr as Select, mr as SelectContent, br as SelectField, hr as SelectGroup, gr as SelectItem, _r as SelectLabel, ya as SelectSeparator, vr as SelectTrigger, yr as SelectValue, Qi as Separator, Ie as Sheet, ba as SheetClose, Le as SheetContent, Re as SheetDescription, qt as SheetFooter, ze as SheetHeader, Be as SheetTitle, Ve as SheetTrigger, Yi as ShortcutKeys, Xi as ShortcutsOverlay, mi as Sidebar, hi as SidebarContent, gi as SidebarFooter, Ei as SidebarGroup, Di as SidebarGroupContent, Oi as SidebarGroupLabel, _i as SidebarHeader, xa as SidebarInput, Sa as SidebarInset, vi as SidebarMenu, bi as SidebarMenuButton, xi as SidebarMenuItem, ki as SidebarMenuSub, Ai as SidebarMenuSubButton, ji as SidebarMenuSubItem, Ca as SidebarProvider, Si as SidebarRail, wa as SidebarSeparator, $i as SidebarTrigger, Pi as SignInLink, lt as Skeleton, xr as SliderField, Ee as Slot, V as Spinner, ut as Spreadsheet, Ba as StarterKitContentLayout, gt as StatsOverviewWidget, Ue as Switch, be as Table, xe as TableBody, Ta as TableCaption, Se as TableCell, Xe as TableCellContent, rt as TableFilters, tt as TableFooter, Ce as TableHead, we as TableHeader, ot as TablePagination, Te as TableRow, ct as TableViews, yt as Tabs, Xr as TabsComponent, bt as TabsContent, xt as TabsList, St as TabsTrigger, Sr as TagsInputField, Mi as TenantMenu, vn as TestimonialsBlock, Zr as TextComponent, Hn as TextEntryComponent, Tr as TextInputField, Cr as Textarea, wr as TextareaField, Zi as ThemeToggle, Ea as Toaster, Dr as ToggleButtonsField, Or as ToggleField, H as Tooltip, U as TooltipContent, Er as TooltipProvider, W as TooltipTrigger, Aa as TopNavLayout, ta as Topbar, ea as TopbarLocaleSwitcher, ti as TranslationManager, ni as Tree, fe as UndoButton, Qr as UnorderedListComponent, Fi as UserAvatar, Ri as UserMenu, $r as ViewComponent, Un as ViewEntryComponent, vt as WidgetGrid, _t as WidgetRenderer, ei as WizardComponent, C as badgeColorClasses, L as badgeVariants, z as buttonVariants, b as cn, w as colorClass, si as configureAlfakit, La as createAlfakit, oi as createDefaultRegistry, Wa as createStarterKitPage, T as cssColor, ii as discoverComponents, ai as discoveredComponent, E as ghostButtonColorClasses, P as hasIcon, D as iconBackgroundColorClasses, O as iconSizeClasses, Ii as installPwa, k as outlineButtonColorClasses, Pa as panelLayouts, Qn as phpToDateFnsFormat, n as provideAlfakit, en as provideCms, ie as provideForm, v as providePageActionContext, r as provideStandalone, I as resolveIcon, pe as showToast, yi as sidebarMenuButtonVariants, A as solidButtonColorClasses, j as switchOffColorClasses, M as switchOnColorClasses, N as textColorClasses, i as useActionRunner, a as useAlfakit, Ua as useAlfakitNavigation, o as useAlfakitProps, zt as useAppPage, s as useChoice, tn as useCms, nn as useCmsT, c as useDirection, ae as useField, oe as useFormState, se as useFormStore, l as useFormatter, wi as useHydrated, he as useIsMobile, Vt as useLiveProps, at as useLiveUpdates, u as useLocalization, d as useOptionalAlfakit, ce as useOptionalFormStore, y as usePageActionContext, Bt as usePageBlock, Ht as usePageForm, Ut as usePageMethod, Wt as usePageMethods, f as usePageSchema, p as usePanel, m as usePollComponent, h as useRegistry, Gt as useReloadProps, Lr as useSchemaComponentContext, ge as useScrollToErroredItem, Kt as useShortcut, pi as useSidebar, g as useStandalone, x as useStore, S as useStoreSelector, _ as useT, _e as useVirtualList };
@@ -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, AlfakitNotifications as o, AlfakitSearch as s, AlfakitTenantSwitcher as c } from "./widgets/index.js";
7
- export { a as AlfakitCopilot, o as AlfakitNotifications, s as AlfakitSearch, t as AlfakitStarterKitRoot, c as AlfakitTenantSwitcher, n as AlfakitWidgets, e as StarterKitContentLayout, i as createStarterKitPage, r as useAlfakitNavigation };
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,7 @@
1
+ import e from "./LanguageMenu.vue_vue_type_script_setup_true_lang.js";
2
+ //#region src/starter-kit/widgets/LanguageMenu.vue
3
+ var t = e;
4
+ //#endregion
5
+ export { t as default };
6
+
7
+ //# sourceMappingURL=LanguageMenu.js.map
@@ -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,7 @@
1
+ import e from "./LanguageSwitcherTrigger.vue_vue_type_script_setup_true_lang.js";
2
+ //#region src/starter-kit/widgets/LanguageSwitcherTrigger.vue
3
+ var t = e;
4
+ //#endregion
5
+ export { t as default };
6
+
7
+ //# sourceMappingURL=LanguageSwitcherTrigger.js.map
@@ -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"}
@@ -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
@@ -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,7 @@
1
+ import e from "./LoadedLanguageSwitcher.vue_vue_type_script_setup_true_lang.js";
2
+ //#region src/starter-kit/widgets/LoadedLanguageSwitcher.vue
3
+ var t = e;
4
+ //#endregion
5
+ export { t as default };
6
+
7
+ //# sourceMappingURL=LoadedLanguageSwitcher.js.map
@@ -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"}
@@ -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
@@ -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;AAqGZ;;;;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"}
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 "./NotificationsTrigger.js";
4
- import r from "./SearchTrigger.js";
5
- import i from "./TenantSwitcherTrigger.js";
6
- import { starterKitWidgets as a } from "@alfakit/core";
7
- import { usePage as o } from "@inertiajs/vue3";
8
- import { computed as s, defineAsyncComponent as c, defineComponent as l, h as u } from "vue";
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 d(e, t) {
11
- let n = o();
12
- return s(() => a(n.props, e(), t));
11
+ function f(e, t) {
12
+ let n = s();
13
+ return c(() => o(n.props, e(), t));
13
14
  }
14
- var f = e("AlfakitLoadedSearch", () => import("./loaded.js").then((e) => e.LoadedSearch), r), p = e("AlfakitLoadedNotifications", () => import("./loaded.js").then((e) => e.LoadedNotifications), n), m = e("AlfakitLoadedTenantSwitcher", () => import("./loaded.js").then((e) => e.LoadedTenantSwitcher), i), h = e("AlfakitLoadedCopilot", () => import("./loaded.js").then((e) => e.LoadedCopilot), t), g = c(() => import("./StarterKitImpersonationBanner.js"));
15
- function _(e, t, n, r) {
16
- return l({
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 = d(() => e.panel, n);
24
+ let i = f(() => e.panel, n);
24
25
  return () => {
25
- let e = i.value, a = e?.widgets.impersonation ? u(g, { source: e }) : null;
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 = u("span", {
28
+ let o = d("span", {
28
29
  "data-slot": t,
29
30
  class: "inline-flex"
30
- }, [u(r, { source: e })]);
31
+ }, [d(r, { source: e })]);
31
32
  return a ? [a, o] : o;
32
33
  };
33
34
  }
34
35
  });
35
36
  }
36
- var v = _("AlfakitSearch", "starter-kit-search", "search", f), y = _("AlfakitNotifications", "starter-kit-notifications", "notifications", p), b = _("AlfakitTenantSwitcher", "starter-kit-tenant-switcher", "tenancy", m), x = _("AlfakitCopilot", "starter-kit-copilot", "copilot", h);
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 { x as AlfakitCopilot, y as AlfakitNotifications, v as AlfakitSearch, b as AlfakitTenantSwitcher };
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 tenant 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, AlfakitNotifications, AlfakitSearch } from '@alfakit/vue'\n * </script>\n *\n * <template>\n * <AlfakitSearch />\n * <AlfakitNotifications />\n * <AlfakitCopilot />\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 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"],"mappings":";;;;;;;;;AAyCA,SAASQ,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,GAC7DjB,CACF,GAEMkB,IAAsBF,EAC1B,oCACM,OAAO,cAAW,CAAC,MAAM,MAAWC,EAAO,mBAAmB,GACpEhB,CACF,GAEMkB,IAAuBH,EAC3B,qCACM,OAAO,cAAW,CAAC,MAAM,MAAWC,EAAO,oBAAoB,GACrEf,CACF,GAEMkB,IAAgBJ,EACpB,8BACM,OAAO,cAAW,CAAC,MAAM,MAAWC,EAAO,aAAa,GAC9Dd,CACF,GAGMkB,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,IAASjB,QAA2BkB,EAAM,OAAOZ,CAAI;GAE3D,aAAa;IACX,IAAMa,IAAkCF,EAAO,OAGzCG,IAASD,GAAO,QAAQ,gBAC1BE,EAAER,GAA+B,EAAE,QAAQM,EAAM,CAAC,IAClD;IAEJ,IAAI,CAACA,GAAO,QAAQb,IAAO,OAAOc;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,UACAR,CACF,GAMamB,IAAuBX,EAClC,wBACA,6BACA,iBACAL,CACF,GAMaiB,IAAwBZ,EACnC,yBACA,+BACA,WACAJ,CACF,GAQaiB,IAAiBb,EAC5B,kBACA,uBACA,WACAH,CACF"}
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 "./LoadedNotifications.js";
3
- import n from "./LoadedSearch.js";
4
- import r from "./LoadedTenantSwitcher.js";
5
- export { e as LoadedCopilot, t as LoadedNotifications, n as LoadedSearch, r as LoadedTenantSwitcher };
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 };
@@ -3,7 +3,8 @@ import { type ComputedRef, type Ref } from 'vue';
3
3
  import type { AlfakitContextValue } from '../../context';
4
4
  /**
5
5
  * The panel the loaded components render with, once its data (`widgets.endpoint`) has
6
- * loaded: null until then. A tenant switch (another endpoint) loads its own.
6
+ * loaded: null until then. It is loaded per endpoint (a tenant switch) and language (a
7
+ * language switch), so the components follow a switch.
7
8
  */
8
9
  export declare function useWidgetsPanel(source: Ref<StarterKitWidgets>): ComputedRef<PanelSchema | null>;
9
10
  /** @internal The context of the loaded header components (browser only). */
@@ -1 +1 @@
1
- {"version":3,"file":"use-widgets.d.ts","sourceRoot":"","sources":["../../../src/starter-kit/widgets/use-widgets.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACvB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAwB,KAAK,WAAW,EAAE,KAAK,GAAG,EAAE,MAAM,KAAK,CAAA;AACtE,OAAO,KAAK,EAAE,mBAAmB,EAAgB,MAAM,eAAe,CAAA;AAKtE;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,GAAG,CAAC,iBAAiB,CAAC,GAAG,WAAW,CAAC,WAAW,GAAG,IAAI,CAAC,CAyB/F;AAMD,4EAA4E;AAC5E,wBAAgB,qBAAqB,IAAI,mBAAmB,CAS3D"}
1
+ {"version":3,"file":"use-widgets.d.ts","sourceRoot":"","sources":["../../../src/starter-kit/widgets/use-widgets.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACvB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAwB,KAAK,WAAW,EAAE,KAAK,GAAG,EAAE,MAAM,KAAK,CAAA;AACtE,OAAO,KAAK,EAAE,mBAAmB,EAAgB,MAAM,eAAe,CAAA;AAKtE;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,GAAG,CAAC,iBAAiB,CAAC,GAAG,WAAW,CAAC,WAAW,GAAG,IAAI,CAAC,CA4B/F;AAMD,4EAA4E;AAC5E,wBAAgB,qBAAqB,IAAI,mBAAmB,CAS3D"}
@@ -1,20 +1,20 @@
1
- import { ActionRunner as e, ComponentRegistry as t, Translator as n, loadStarterKitPanel as r, loadedStarterKitPanel as i, starterKitWidgetsPanel as a } from "@alfakit/core";
2
- import { computed as o, ref as s, watch as c } from "vue";
1
+ import { ActionRunner as e, ComponentRegistry as t, Translator as n, loadStarterKitPanel as r, loadedStarterKitPanel as i, starterKitPanelLocale as a, starterKitWidgetsPanel as o } from "@alfakit/core";
2
+ import { computed as s, ref as c, watch as l } from "vue";
3
3
  //#region src/starter-kit/widgets/use-widgets.ts
4
- function l(e) {
5
- let t = s(0);
6
- return c(() => e.value.widgets.endpoint, (e, n, i) => {
7
- let a = !0;
8
- i(() => a = !1), r(e).then(() => a && t.value++, () => {});
9
- }, { immediate: !0 }), o(() => {
4
+ function u(e) {
5
+ let t = c(0);
6
+ return l(() => [e.value.widgets.endpoint, a(e.value)], ([e, n], i, a) => {
7
+ let o = !0;
8
+ a(() => o = !1), r(e, n).then(() => o && t.value++, () => {});
9
+ }, { immediate: !0 }), s(() => {
10
10
  t.value;
11
- let n = i(e.value.widgets.endpoint);
12
- return n ? a(n, e.value) : null;
11
+ let n = i(e.value.widgets.endpoint, a(e.value));
12
+ return n ? o(n, e.value) : null;
13
13
  });
14
14
  }
15
- var u = null;
16
- function d() {
17
- return u ??= {
15
+ var d = null;
16
+ function f() {
17
+ return d ??= {
18
18
  registry: new t(),
19
19
  pages: {},
20
20
  translator: new n(),
@@ -22,9 +22,9 @@ function d() {
22
22
  action: "",
23
23
  modal: ""
24
24
  } })
25
- }, u;
25
+ }, d;
26
26
  }
27
27
  //#endregion
28
- export { l as useWidgetsPanel, d as widgetsAlfakitContext };
28
+ export { u as useWidgetsPanel, f as widgetsAlfakitContext };
29
29
 
30
30
  //# sourceMappingURL=use-widgets.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-widgets.js","names":["useWidgetsPanel","version","ref","watch","source","active","onCleanup","loadStarterKitPanel","endpoint","computed","base","loadedStarterKitPanel","starterKitWidgetsPanel","widgetsContext","widgetsAlfakitContext","ComponentRegistry","Translator","ActionRunner"],"sources":["../../../src/starter-kit/widgets/use-widgets.ts"],"sourcesContent":["import {\n ActionRunner,\n ComponentRegistry,\n Translator,\n loadStarterKitPanel,\n loadedStarterKitPanel,\n starterKitWidgetsPanel,\n type PanelSchema,\n type StarterKitWidgets,\n} from '@alfakit/core'\nimport { computed, ref, watch, type ComputedRef, type Ref } from 'vue'\nimport type { AlfakitContextValue, AnyComponent } from '../../context'\n\n// The loaded components' panel and context; `./index` (the eager triggers) must not import\n// this module, which pulls in the action runner.\n\n/**\n * The panel the loaded components render with, once its data (`widgets.endpoint`) has\n * loaded: null until then. A tenant switch (another endpoint) loads its own.\n */\nexport function useWidgetsPanel(source: Ref<StarterKitWidgets>): ComputedRef<PanelSchema | null> {\n const version = ref(0)\n\n watch(\n () => source.value.widgets.endpoint,\n (endpoint, _old, onCleanup) => {\n let active = true\n\n onCleanup(() => (active = false))\n\n void loadStarterKitPanel(endpoint).then(\n () => active && version.value++,\n () => {},\n )\n },\n { immediate: true },\n )\n\n return computed(() => {\n void version.value\n\n const base = loadedStarterKitPanel(source.value.widgets.endpoint)\n\n return base ? starterKitWidgetsPanel(base, source.value) : null\n })\n}\n\n// One context for the browser session: its own translator (the panel's strings), an empty\n// registry (only `panel:icon` overrides are looked up here) and an idle action runner.\nlet widgetsContext: AlfakitContextValue | null = null\n\n/** @internal The context of the loaded header components (browser only). */\nexport function widgetsAlfakitContext(): AlfakitContextValue {\n widgetsContext ??= {\n registry: new ComponentRegistry<AnyComponent>(),\n pages: {},\n translator: new Translator(),\n actions: new ActionRunner({ endpoints: { action: '', modal: '' } }),\n }\n\n return widgetsContext\n}\n"],"mappings":";;;AAoBA,SAAgBA,EAAgB,GAAiE;CAC/F,IAAMC,IAAUC,EAAI,CAAC;CAiBrB,OAfAC,QACQC,EAAO,MAAM,QAAQ,WAC1B,GAAU,GAAM,MAAc;EAC7B,IAAIC,IAAS;EAIb,AAFAC,QAAiB,IAAS,EAAM,GAEhCC,EAAyBC,CAAQ,CAAC,CAAC,WAC3BH,KAAU,EAAQ,eAClB,CAAC,CACT;CACF,GACA,EAAE,WAAW,GAAK,CACpB,GAEOI,QAAe;EACpB,EAAa;EAEb,IAAMC,IAAOC,EAAsBP,EAAO,MAAM,QAAQ,QAAQ;EAEhE,OAAOM,IAAOE,EAAuBF,GAAMN,EAAO,KAAK,IAAI;CAC7D,CAAC;AACH;AAIA,IAAIS,IAA6C;AAGjD,SAAgBC,IAA6C;CAQ3D,OAPA,MAAmB;EACjB,UAAU,IAAIC,EAAgC;EAC9C,OAAO,CAAC;EACR,YAAY,IAAIC,EAAW;EAC3B,SAAS,IAAIC,EAAa,EAAE,WAAW;GAAE,QAAQ;GAAI,OAAO;EAAG,EAAE,CAAC;CACpE,GAEOJ;AACT"}
1
+ {"version":3,"file":"use-widgets.js","names":["useWidgetsPanel","version","ref","watch","source","starterKitPanelLocale","endpoint","locale","active","onCleanup","loadStarterKitPanel","computed","base","loadedStarterKitPanel","starterKitWidgetsPanel","widgetsContext","widgetsAlfakitContext","ComponentRegistry","Translator","ActionRunner"],"sources":["../../../src/starter-kit/widgets/use-widgets.ts"],"sourcesContent":["import {\n ActionRunner,\n ComponentRegistry,\n Translator,\n loadStarterKitPanel,\n loadedStarterKitPanel,\n starterKitPanelLocale,\n starterKitWidgetsPanel,\n type PanelSchema,\n type StarterKitWidgets,\n} from '@alfakit/core'\nimport { computed, ref, watch, type ComputedRef, type Ref } from 'vue'\nimport type { AlfakitContextValue, AnyComponent } from '../../context'\n\n// The loaded components' panel and context; `./index` (the eager triggers) must not import\n// this module, which pulls in the action runner.\n\n/**\n * The panel the loaded components render with, once its data (`widgets.endpoint`) has\n * loaded: null until then. It is loaded per endpoint (a tenant switch) and language (a\n * language switch), so the components follow a switch.\n */\nexport function useWidgetsPanel(source: Ref<StarterKitWidgets>): ComputedRef<PanelSchema | null> {\n const version = ref(0)\n\n watch(\n () => [source.value.widgets.endpoint, starterKitPanelLocale(source.value)] as const,\n ([endpoint, locale], _old, onCleanup) => {\n let active = true\n\n onCleanup(() => (active = false))\n\n void loadStarterKitPanel(endpoint, locale).then(\n () => active && version.value++,\n () => {},\n )\n },\n { immediate: true },\n )\n\n return computed(() => {\n void version.value\n\n const base = loadedStarterKitPanel(\n source.value.widgets.endpoint,\n starterKitPanelLocale(source.value),\n )\n\n return base ? starterKitWidgetsPanel(base, source.value) : null\n })\n}\n\n// One context for the browser session: its own translator (the panel's strings), an empty\n// registry (only `panel:icon` overrides are looked up here) and an idle action runner.\nlet widgetsContext: AlfakitContextValue | null = null\n\n/** @internal The context of the loaded header components (browser only). */\nexport function widgetsAlfakitContext(): AlfakitContextValue {\n widgetsContext ??= {\n registry: new ComponentRegistry<AnyComponent>(),\n pages: {},\n translator: new Translator(),\n actions: new ActionRunner({ endpoints: { action: '', modal: '' } }),\n }\n\n return widgetsContext\n}\n"],"mappings":";;;AAsBA,SAAgBA,EAAgB,GAAiE;CAC/F,IAAMC,IAAUC,EAAI,CAAC;CAiBrB,OAfAC,QACQ,CAACC,EAAO,MAAM,QAAQ,UAAUC,EAAsBD,EAAO,KAAK,CAAC,IACxE,CAACE,GAAUC,IAAS,GAAM,MAAc;EACvC,IAAIC,IAAS;EAIb,AAFAC,QAAiB,IAAS,EAAM,GAEhCC,EAAyBJ,GAAUC,CAAM,CAAC,CAAC,WACnCC,KAAU,EAAQ,eAClB,CAAC,CACT;CACF,GACA,EAAE,WAAW,GAAK,CACpB,GAEOG,QAAe;EACpB,EAAa;EAEb,IAAMC,IAAOC,EACXT,EAAO,MAAM,QAAQ,UACrBC,EAAsBD,EAAO,KAAK,CACpC;EAEA,OAAOQ,IAAOE,EAAuBF,GAAMR,EAAO,KAAK,IAAI;CAC7D,CAAC;AACH;AAIA,IAAIW,IAA6C;AAGjD,SAAgBC,IAA6C;CAQ3D,OAPA,MAAmB;EACjB,UAAU,IAAIC,EAAgC;EAC9C,OAAO,CAAC;EACR,YAAY,IAAIC,EAAW;EAC3B,SAAS,IAAIC,EAAa,EAAE,WAAW;GAAE,QAAQ;GAAI,OAAO;EAAG,EAAE,CAAC;CACpE,GAEOJ;AACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfakit/vue",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "Vue 3 + shadcn-vue renderer for Alfakit, the Laravel admin panel builder by Alfa Six.",
5
5
  "license": "MIT",
6
6
  "author": "Alfa Six (https://alfasixbh.com)",
@@ -96,7 +96,7 @@
96
96
  "reka-ui": "^2.11.0",
97
97
  "tailwind-merge": "^3.7.0",
98
98
  "vue-sonner": "^2.0.9",
99
- "@alfakit/core": "0.1.6"
99
+ "@alfakit/core": "0.1.8"
100
100
  },
101
101
  "peerDependencies": {
102
102
  "@inertiajs/vue3": "^3.0.0",
@@ -5,6 +5,7 @@ export { createStarterKitPage, type StarterKitPageOptions } from './starter-kit'
5
5
  export { default as StarterKitContentLayout } from './StarterKitContentLayout.vue'
6
6
  export {
7
7
  AlfakitCopilot,
8
+ AlfakitLanguageSwitcher,
8
9
  AlfakitNotifications,
9
10
  AlfakitSearch,
10
11
  AlfakitTenantSwitcher,
@@ -0,0 +1,46 @@
1
+ <script setup lang="ts">
2
+ import { takeRequestedStarterKitLanguages } from '@alfakit/core'
3
+ import { LanguagesIcon } from '@lucide/vue'
4
+ import { computed, onMounted, ref } from 'vue'
5
+ import LocaleOptions from '../../components/panel/LocaleOptions.vue'
6
+ import DropdownMenu from '../../components/ui/DropdownMenu.vue'
7
+ import DropdownMenuContent from '../../components/ui/DropdownMenuContent.vue'
8
+ import DropdownMenuTrigger from '../../components/ui/DropdownMenuTrigger.vue'
9
+ import { useLocalization, useT } from '../../context'
10
+
11
+ /** The loaded language button and menu, inside the widgets' context (`WidgetShell`). */
12
+
13
+ const t = useT()
14
+ const localization = useLocalization()
15
+ const open = ref(false)
16
+
17
+ // A click on the trigger before the menu loaded opens it once mounted (taken per mount: the
18
+ // header is a persistent layout, so the switcher around it outlives a language switch), a
19
+ // frame later, as the menu closes again when it opens while focus is on the replaced button.
20
+ onMounted(() => {
21
+ if (takeRequestedStarterKitLanguages()) requestAnimationFrame(() => (open.value = true))
22
+ })
23
+ const label = computed(() => t('change_language', {}, 'Change language'))
24
+ </script>
25
+
26
+ <template>
27
+ <DropdownMenu v-model:open="open">
28
+ <DropdownMenuTrigger as-child>
29
+ <button
30
+ type="button"
31
+ data-slot="language-switcher-trigger"
32
+ :aria-label="label"
33
+ :title="label"
34
+ 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]"
35
+ >
36
+ <LanguagesIcon class="size-4" aria-hidden="true" />
37
+ <span :lang="localization.tag" :dir="localization.direction" class="hidden sm:inline">{{
38
+ localization.label
39
+ }}</span>
40
+ </button>
41
+ </DropdownMenuTrigger>
42
+ <DropdownMenuContent align="end" class="min-w-40">
43
+ <LocaleOptions />
44
+ </DropdownMenuContent>
45
+ </DropdownMenu>
46
+ </template>
@@ -0,0 +1,34 @@
1
+ <script setup lang="ts">
2
+ import { requestStarterKitLanguages, type StarterKitWidgets } from '@alfakit/core'
3
+ import { LanguagesIcon } from '@lucide/vue'
4
+ import { computed } from 'vue'
5
+
6
+ /**
7
+ * The language button until its menu has loaded: the languages icon and the current
8
+ * language in its own name (from `sm`). A click is remembered and opens the menu once loaded.
9
+ */
10
+ const props = defineProps<{ source: StarterKitWidgets }>()
11
+
12
+ const language = computed(() => props.source.widgets.language)
13
+ </script>
14
+
15
+ <template>
16
+ <button
17
+ type="button"
18
+ data-slot="language-switcher-trigger"
19
+ :aria-label="language?.label"
20
+ aria-haspopup="menu"
21
+ :title="language?.label"
22
+ 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]"
23
+ @click="requestStarterKitLanguages()"
24
+ >
25
+ <LanguagesIcon class="size-4" aria-hidden="true" />
26
+ <span
27
+ v-if="language"
28
+ :lang="language.current.tag"
29
+ :dir="language.current.direction"
30
+ class="hidden sm:inline"
31
+ >{{ language.current.label }}</span
32
+ >
33
+ </button>
34
+ </template>
@@ -0,0 +1,27 @@
1
+ <script setup lang="ts">
2
+ import { showsLanguageSwitcher, type StarterKitWidgets } from '@alfakit/core'
3
+ import { computed, toRef } from 'vue'
4
+ import LanguageMenu from './LanguageMenu.vue'
5
+ import LanguageSwitcherTrigger from './LanguageSwitcherTrigger.vue'
6
+ import { useWidgetsPanel } from './use-widgets'
7
+ import WidgetShell from './WidgetShell.vue'
8
+
9
+ /**
10
+ * The panel's language menu (its languages in their own names, `LocaleOptions`): picking
11
+ * one posts to the panel's locale endpoint and reloads the page in it. Nothing without a
12
+ * language switcher with two or more languages.
13
+ */
14
+ const props = defineProps<{ source: StarterKitWidgets }>()
15
+
16
+ const panel = useWidgetsPanel(toRef(props, 'source'))
17
+ const visible = computed(() => showsLanguageSwitcher(panel.value?.localization, 'auth'))
18
+ </script>
19
+
20
+ <template>
21
+ <template v-if="panel">
22
+ <WidgetShell v-if="visible" :panel="panel">
23
+ <LanguageMenu />
24
+ </WidgetShell>
25
+ </template>
26
+ <LanguageSwitcherTrigger v-else :source="props.source" />
27
+ </template>
@@ -15,25 +15,27 @@ import {
15
15
  } from 'vue'
16
16
  import { lazyComponent } from '../../lib/lazy'
17
17
  import CopilotTrigger from './CopilotTrigger.vue'
18
+ import LanguageSwitcherTrigger from './LanguageSwitcherTrigger.vue'
18
19
  import NotificationsTrigger from './NotificationsTrigger.vue'
19
20
  import SearchTrigger from './SearchTrigger.vue'
20
21
  import TenantSwitcherTrigger from './TenantSwitcherTrigger.vue'
21
22
 
22
23
  /**
23
24
  * Drop-in header components of starter kit mode (`Panel::starterKit()`): AlfaKit's search,
24
- * notifications bell and tenant switcher in the host's own header, on every page of the
25
+ * notifications bell, tenant switcher and language switcher in the host's own header, on every page of the
25
26
  * application. They read the shared `alfakitNavigation` prop, render a lightweight trigger
26
27
  * straight away, and load their code and the panel data once mounted (never during SSR).
27
28
  *
28
29
  * ```vue
29
30
  * <script setup lang="ts">
30
- * import { AlfakitCopilot, AlfakitNotifications, AlfakitSearch } from '@alfakit/vue'
31
+ * import { AlfakitCopilot, AlfakitLanguageSwitcher, AlfakitNotifications, AlfakitSearch } from '@alfakit/vue'
31
32
  * </script>
32
33
  *
33
34
  * <template>
34
35
  * <AlfakitSearch />
35
36
  * <AlfakitNotifications />
36
37
  * <AlfakitCopilot />
38
+ * <AlfakitLanguageSwitcher />
37
39
  * </template>
38
40
  * ```
39
41
  */
@@ -66,6 +68,12 @@ const LoadedTenantSwitcher = lazyComponent(
66
68
  TenantSwitcherTrigger,
67
69
  )
68
70
 
71
+ const LoadedLanguageSwitcher = lazyComponent(
72
+ 'AlfakitLoadedLanguageSwitcher',
73
+ () => import('./loaded').then((module) => module.LoadedLanguageSwitcher),
74
+ LanguageSwitcherTrigger,
75
+ )
76
+
69
77
  const LoadedCopilot = lazyComponent(
70
78
  'AlfakitLoadedCopilot',
71
79
  () => import('./loaded').then((module) => module.LoadedCopilot),
@@ -159,3 +167,17 @@ export const AlfakitCopilot = headerWidget(
159
167
  'copilot',
160
168
  LoadedCopilot,
161
169
  )
170
+
171
+ /**
172
+ * The panel's language menu (`locales()`): the current language straight away, and each
173
+ * language in its own name once loaded. Picking one switches the panel's language (the
174
+ * session, the cookie and `persistLocaleUsing()`) and reloads the page, so AlfaKit pages and
175
+ * the header components show it; the host's own pages and `<html lang dir>` are the app's.
176
+ * Renders nothing for guests or with fewer than two languages.
177
+ */
178
+ export const AlfakitLanguageSwitcher = headerWidget(
179
+ 'AlfakitLanguageSwitcher',
180
+ 'starter-kit-language-switcher',
181
+ 'language',
182
+ LoadedLanguageSwitcher,
183
+ )
@@ -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'
@@ -4,6 +4,7 @@ import {
4
4
  Translator,
5
5
  loadStarterKitPanel,
6
6
  loadedStarterKitPanel,
7
+ starterKitPanelLocale,
7
8
  starterKitWidgetsPanel,
8
9
  type PanelSchema,
9
10
  type StarterKitWidgets,
@@ -16,19 +17,20 @@ import type { AlfakitContextValue, AnyComponent } from '../../context'
16
17
 
17
18
  /**
18
19
  * The panel the loaded components render with, once its data (`widgets.endpoint`) has
19
- * loaded: null until then. A tenant switch (another endpoint) loads its own.
20
+ * loaded: null until then. It is loaded per endpoint (a tenant switch) and language (a
21
+ * language switch), so the components follow a switch.
20
22
  */
21
23
  export function useWidgetsPanel(source: Ref<StarterKitWidgets>): ComputedRef<PanelSchema | null> {
22
24
  const version = ref(0)
23
25
 
24
26
  watch(
25
- () => source.value.widgets.endpoint,
26
- (endpoint, _old, onCleanup) => {
27
+ () => [source.value.widgets.endpoint, starterKitPanelLocale(source.value)] as const,
28
+ ([endpoint, locale], _old, onCleanup) => {
27
29
  let active = true
28
30
 
29
31
  onCleanup(() => (active = false))
30
32
 
31
- void loadStarterKitPanel(endpoint).then(
33
+ void loadStarterKitPanel(endpoint, locale).then(
32
34
  () => active && version.value++,
33
35
  () => {},
34
36
  )
@@ -39,7 +41,10 @@ export function useWidgetsPanel(source: Ref<StarterKitWidgets>): ComputedRef<Pan
39
41
  return computed(() => {
40
42
  void version.value
41
43
 
42
- const base = loadedStarterKitPanel(source.value.widgets.endpoint)
44
+ const base = loadedStarterKitPanel(
45
+ source.value.widgets.endpoint,
46
+ starterKitPanelLocale(source.value),
47
+ )
43
48
 
44
49
  return base ? starterKitWidgetsPanel(base, source.value) : null
45
50
  })