@wow-two-beta/fe 0.0.42 → 0.0.44

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 (48) hide show
  1. package/README.md +21 -3
  2. package/dist/auth/BffSession.d.ts +4 -0
  3. package/dist/auth/BffSession.js +8 -3
  4. package/dist/auth/BffSession.js.map +1 -1
  5. package/dist/foundation/net/hooks/UseRunningVersion.d.ts +30 -0
  6. package/dist/foundation/net/hooks/UseRunningVersion.js +19 -0
  7. package/dist/foundation/net/hooks/UseRunningVersion.js.map +1 -0
  8. package/dist/foundation/net/index.d.ts +1 -0
  9. package/dist/foundation/net/index.js +2 -0
  10. package/dist/foundation/net/index.js.map +1 -1
  11. package/dist/foundation/themes/constants/Authored.js +21 -0
  12. package/dist/foundation/themes/constants/Authored.js.map +1 -1
  13. package/dist/index.css +16 -0
  14. package/dist/index.js +812 -806
  15. package/dist/index.js.map +1 -1
  16. package/dist/presentation/actions/refreshButton/RefreshButton.vue.js.map +1 -1
  17. package/dist/presentation/display/dataTable/DataTable.vue.js.map +1 -1
  18. package/dist/presentation/display/index.d.ts +1 -0
  19. package/dist/presentation/display/index.js +6 -4
  20. package/dist/presentation/display/index.js.map +1 -1
  21. package/dist/presentation/display/versionBadge/VersionBadge.vue.d.ts +27 -0
  22. package/dist/presentation/display/versionBadge/VersionBadge.vue.js +80 -0
  23. package/dist/presentation/display/versionBadge/VersionBadge.vue.js.map +1 -0
  24. package/dist/presentation/display/versionBadge/VersionBadge2.vue.js +5 -0
  25. package/dist/presentation/display/versionBadge/VersionBadge2.vue.js.map +1 -0
  26. package/dist/presentation/display/versionBadge/VersionBadgeExtensions.d.ts +9 -0
  27. package/dist/presentation/display/versionBadge/VersionBadgeExtensions.js +21 -0
  28. package/dist/presentation/display/versionBadge/VersionBadgeExtensions.js.map +1 -0
  29. package/dist/presentation/display/versionBadge/index.d.ts +1 -0
  30. package/dist/presentation/forms/imageEditor/ImageEditor.vue.d.ts +1 -1
  31. package/dist/presentation/layout/appFrame/AppFrame.vue.d.ts +168 -0
  32. package/dist/presentation/layout/appFrame/AppFrame.vue.js +408 -0
  33. package/dist/presentation/layout/appFrame/AppFrame.vue.js.map +1 -0
  34. package/dist/presentation/layout/appFrame/AppFrame2.vue.js +8 -0
  35. package/dist/presentation/layout/appFrame/AppFrame2.vue.js.map +1 -0
  36. package/dist/presentation/layout/appFrame/index.d.ts +1 -0
  37. package/dist/presentation/layout/index.d.ts +1 -0
  38. package/dist/presentation/layout/index.js +90 -86
  39. package/dist/presentation/layout/index.js.map +1 -1
  40. package/dist/presentation/nav/accountMenu/AccountMenu.vue.d.ts +2 -2
  41. package/dist/presentation/nav/appSwitcherMenu/AppSwitcherMenu.vue.d.ts +2 -0
  42. package/dist/presentation/nav/appSwitcherMenu/AppSwitcherMenu.vue.js +15 -8
  43. package/dist/presentation/nav/appSwitcherMenu/AppSwitcherMenu.vue.js.map +1 -1
  44. package/dist/presentation/nav/breadcrumb/Breadcrumb.vue.d.ts +8 -1
  45. package/dist/presentation/nav/breadcrumb/Breadcrumb.vue.js +38 -19
  46. package/dist/presentation/nav/breadcrumb/Breadcrumb.vue.js.map +1 -1
  47. package/dist/themes.css +14 -0
  48. package/package.json +1 -1
@@ -0,0 +1,8 @@
1
+ import _sfc_main from "./AppFrame.vue.js";
2
+ import { AppFrameContentWidth, AppFrameVariant } from "./AppFrame.vue.js";
3
+ export {
4
+ AppFrameContentWidth,
5
+ AppFrameVariant,
6
+ _sfc_main as default
7
+ };
8
+ //# sourceMappingURL=AppFrame2.vue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppFrame2.vue.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -0,0 +1 @@
1
+ export { default as AppFrame, AppFrameContentWidth, AppFrameVariant, type AppFrameAccount, type AppFrameBrandSlotProps, type AppFrameNavSlotProps, type AppFrameProps, type AppFrameSwitcher, } from './AppFrame.vue';
@@ -19,6 +19,7 @@ export * from './listDetailLayout';
19
19
  export * from './resizablePanelsLayout';
20
20
  export * from './pullToRefreshLayout';
21
21
  export * from './appShell';
22
+ export * from './appFrame';
22
23
  export * from './pageHeader';
23
24
  export * from './anchorLayout';
24
25
  export * from './surfaceLayout';
@@ -1,47 +1,48 @@
1
1
  import { default as default2, AnchorLayoutAppearOn } from "./anchorLayout/AnchorLayout.vue.js";
2
- import { default as default3, AppShellNavigation, AppShellScroll, Breakpoint, useAppShell } from "./appShell/AppShell.vue.js";
3
- import { default as default4 } from "./appShell/AppShellAside.vue.js";
4
- import { default as default5, AppShellContentGutter } from "./appShell/AppShellContent.vue.js";
5
- import { default as default6 } from "./appShell/AppShellFooter.vue.js";
6
- import { default as default7, AppShellHeaderHeight } from "./appShell/AppShellHeader.vue.js";
7
- import { default as default8 } from "./appShell/AppShellMain.vue.js";
8
- import { default as default9 } from "./appShell/AppShellSidebar.vue.js";
9
- import { default as default10 } from "./aspectRatioLayout/AspectRatioLayout.vue.js";
10
- import { default as default11 } from "./boxLayout/BoxLayout.vue.js";
11
- import { default as default12, CanvasBounds, CanvasWheel } from "./canvasArea/CanvasArea.vue.js";
12
- import { default as default13 } from "./centerLayout/CenterLayout.vue.js";
13
- import { default as default14 } from "./clusterLayout/ClusterLayout.vue.js";
14
- import { default as default15 } from "./containerLayout/ContainerLayout.vue.js";
15
- import { default as default16 } from "./dividerLayout/DividerLayout.vue.js";
16
- import { default as default17 } from "./fieldsetLayout/FieldsetLayout.vue.js";
17
- import { default as default18 } from "./flexLayout/FlexLayout.vue.js";
18
- import { default as default19, FrameLayoutSurface } from "./frameLayout/FrameLayout.vue.js";
19
- import { default as default20 } from "./grid/Grid.vue.js";
20
- import { default as default21 } from "./hStackLayout/HStackLayout.vue.js";
21
- import { default as default22, InlineLayoutAlign } from "./inlineLayout/InlineLayout.vue.js";
22
- import { default as default23 } from "./inputAddonLayout/InputAddonLayout.vue.js";
23
- import { default as default24 } from "./inputGroup/InputGroup.vue.js";
24
- import { default as default25 } from "./listDetailLayout/ListDetailLayout.vue.js";
25
- import { default as default26 } from "./masonryLayout/MasonryLayout.vue.js";
26
- import { default as default27 } from "./navbar/Navbar.vue.js";
27
- import { default as default28 } from "./pageHeader/PageHeader.vue.js";
28
- import { default as default29 } from "./pageHeader/PageHeaderActions.vue.js";
29
- import { default as default30 } from "./pullToRefreshLayout/PullToRefreshLayout.vue.js";
30
- import { default as default31 } from "./resizablePanelsLayout/ResizablePanel.vue.js";
31
- import { default as default32, useResizableContext } from "./resizablePanelsLayout/ResizablePanelsLayout.vue.js";
32
- import { default as default33 } from "./resizablePanelsLayout/ResizableSeparator.vue.js";
33
- import { default as default34, ScrollAxis } from "./scrollArea/ScrollArea.vue.js";
34
- import { default as default35 } from "./section/Section.vue.js";
35
- import { default as default36 } from "./separatorLayout/SeparatorLayout.vue.js";
36
- import { default as default37 } from "./spacerLayout/SpacerLayout.vue.js";
37
- import { default as default38 } from "./stackLayout/StackLayout.vue.js";
38
- import { default as default39, StickyLayoutSide } from "./stickyLayout/StickyLayout.vue.js";
39
- import { default as default40 } from "./surfaceLayout/SurfaceLayout.vue.js";
40
- import { default as default41 } from "./swipeActionsLayout/SwipeActionsLayout.vue.js";
41
- import { default as default42 } from "./tiltLayout/TiltLayout.vue.js";
42
- import { default as default43 } from "./twoColumnLayout/TwoColumnLayout.vue.js";
43
- import { default as default44 } from "./vStackLayout/VStackLayout.vue.js";
44
- import { default as default45 } from "./virtualScrollArea/VirtualScrollArea.vue.js";
2
+ import { default as default3, AppFrameContentWidth, AppFrameVariant } from "./appFrame/AppFrame.vue.js";
3
+ import { default as default4, AppShellNavigation, AppShellScroll, Breakpoint, useAppShell } from "./appShell/AppShell.vue.js";
4
+ import { default as default5 } from "./appShell/AppShellAside.vue.js";
5
+ import { default as default6, AppShellContentGutter } from "./appShell/AppShellContent.vue.js";
6
+ import { default as default7 } from "./appShell/AppShellFooter.vue.js";
7
+ import { default as default8, AppShellHeaderHeight } from "./appShell/AppShellHeader.vue.js";
8
+ import { default as default9 } from "./appShell/AppShellMain.vue.js";
9
+ import { default as default10 } from "./appShell/AppShellSidebar.vue.js";
10
+ import { default as default11 } from "./aspectRatioLayout/AspectRatioLayout.vue.js";
11
+ import { default as default12 } from "./boxLayout/BoxLayout.vue.js";
12
+ import { default as default13, CanvasBounds, CanvasWheel } from "./canvasArea/CanvasArea.vue.js";
13
+ import { default as default14 } from "./centerLayout/CenterLayout.vue.js";
14
+ import { default as default15 } from "./clusterLayout/ClusterLayout.vue.js";
15
+ import { default as default16 } from "./containerLayout/ContainerLayout.vue.js";
16
+ import { default as default17 } from "./dividerLayout/DividerLayout.vue.js";
17
+ import { default as default18 } from "./fieldsetLayout/FieldsetLayout.vue.js";
18
+ import { default as default19 } from "./flexLayout/FlexLayout.vue.js";
19
+ import { default as default20, FrameLayoutSurface } from "./frameLayout/FrameLayout.vue.js";
20
+ import { default as default21 } from "./grid/Grid.vue.js";
21
+ import { default as default22 } from "./hStackLayout/HStackLayout.vue.js";
22
+ import { default as default23, InlineLayoutAlign } from "./inlineLayout/InlineLayout.vue.js";
23
+ import { default as default24 } from "./inputAddonLayout/InputAddonLayout.vue.js";
24
+ import { default as default25 } from "./inputGroup/InputGroup.vue.js";
25
+ import { default as default26 } from "./listDetailLayout/ListDetailLayout.vue.js";
26
+ import { default as default27 } from "./masonryLayout/MasonryLayout.vue.js";
27
+ import { default as default28 } from "./navbar/Navbar.vue.js";
28
+ import { default as default29 } from "./pageHeader/PageHeader.vue.js";
29
+ import { default as default30 } from "./pageHeader/PageHeaderActions.vue.js";
30
+ import { default as default31 } from "./pullToRefreshLayout/PullToRefreshLayout.vue.js";
31
+ import { default as default32 } from "./resizablePanelsLayout/ResizablePanel.vue.js";
32
+ import { default as default33, useResizableContext } from "./resizablePanelsLayout/ResizablePanelsLayout.vue.js";
33
+ import { default as default34 } from "./resizablePanelsLayout/ResizableSeparator.vue.js";
34
+ import { default as default35, ScrollAxis } from "./scrollArea/ScrollArea.vue.js";
35
+ import { default as default36 } from "./section/Section.vue.js";
36
+ import { default as default37 } from "./separatorLayout/SeparatorLayout.vue.js";
37
+ import { default as default38 } from "./spacerLayout/SpacerLayout.vue.js";
38
+ import { default as default39 } from "./stackLayout/StackLayout.vue.js";
39
+ import { default as default40, StickyLayoutSide } from "./stickyLayout/StickyLayout.vue.js";
40
+ import { default as default41 } from "./surfaceLayout/SurfaceLayout.vue.js";
41
+ import { default as default42 } from "./swipeActionsLayout/SwipeActionsLayout.vue.js";
42
+ import { default as default43 } from "./tiltLayout/TiltLayout.vue.js";
43
+ import { default as default44 } from "./twoColumnLayout/TwoColumnLayout.vue.js";
44
+ import { default as default45 } from "./vStackLayout/VStackLayout.vue.js";
45
+ import { default as default46 } from "./virtualScrollArea/VirtualScrollArea.vue.js";
45
46
  import { AnchorLayoutTransition, AnchorLayoutVisibilityMode } from "./anchorLayout/AnchorLayout.variants.js";
46
47
  import { ContainerLayoutSize, containerVariants } from "./containerLayout/ContainerLayout.variants.js";
47
48
  import { GridBreakpoint, gridVariants, resolveGridColumns, resolveGridGap } from "./grid/Grid.variants.js";
@@ -55,71 +56,74 @@ export {
55
56
  AnchorLayoutAppearOn,
56
57
  AnchorLayoutTransition,
57
58
  AnchorLayoutVisibilityMode,
58
- default3 as AppShell,
59
- default4 as AppShellAside,
60
- default5 as AppShellContent,
59
+ default3 as AppFrame,
60
+ AppFrameContentWidth,
61
+ AppFrameVariant,
62
+ default4 as AppShell,
63
+ default5 as AppShellAside,
64
+ default6 as AppShellContent,
61
65
  AppShellContentGutter,
62
- default6 as AppShellFooter,
63
- default7 as AppShellHeader,
66
+ default7 as AppShellFooter,
67
+ default8 as AppShellHeader,
64
68
  AppShellHeaderHeight,
65
- default8 as AppShellMain,
69
+ default9 as AppShellMain,
66
70
  AppShellNavigation,
67
71
  AppShellScroll,
68
- default9 as AppShellSidebar,
69
- default10 as AspectRatioLayout,
70
- default11 as BoxLayout,
72
+ default10 as AppShellSidebar,
73
+ default11 as AspectRatioLayout,
74
+ default12 as BoxLayout,
71
75
  Breakpoint,
72
- default12 as CanvasArea,
76
+ default13 as CanvasArea,
73
77
  CanvasBounds,
74
78
  CanvasWheel,
75
- default13 as CenterLayout,
76
- default14 as ClusterLayout,
77
- default15 as ContainerLayout,
79
+ default14 as CenterLayout,
80
+ default15 as ClusterLayout,
81
+ default16 as ContainerLayout,
78
82
  ContainerLayoutSize,
79
- default16 as DividerLayout,
80
- default17 as FieldsetLayout,
81
- default18 as FlexLayout,
82
- default19 as FrameLayout,
83
+ default17 as DividerLayout,
84
+ default18 as FieldsetLayout,
85
+ default19 as FlexLayout,
86
+ default20 as FrameLayout,
83
87
  FrameLayoutSurface,
84
- default20 as Grid,
88
+ default21 as Grid,
85
89
  GridBreakpoint,
86
- default21 as HStackLayout,
87
- default22 as InlineLayout,
90
+ default22 as HStackLayout,
91
+ default23 as InlineLayout,
88
92
  InlineLayoutAlign,
89
- default23 as InputAddonLayout,
90
- default24 as InputGroup,
91
- default25 as ListDetailLayout,
92
- default26 as MasonryLayout,
93
- default27 as Navbar,
93
+ default24 as InputAddonLayout,
94
+ default25 as InputGroup,
95
+ default26 as ListDetailLayout,
96
+ default27 as MasonryLayout,
97
+ default28 as Navbar,
94
98
  NavbarElement,
95
99
  NavbarHeight,
96
100
  NavbarOrientation,
97
101
  NavbarVariant,
98
- default28 as PageHeader,
99
- default29 as PageHeaderActions,
100
- default30 as PullToRefreshLayout,
101
- default31 as ResizablePanel,
102
- default32 as ResizablePanelsLayout,
103
- default33 as ResizableSeparator,
104
- default34 as ScrollArea,
102
+ default29 as PageHeader,
103
+ default30 as PageHeaderActions,
104
+ default31 as PullToRefreshLayout,
105
+ default32 as ResizablePanel,
106
+ default33 as ResizablePanelsLayout,
107
+ default34 as ResizableSeparator,
108
+ default35 as ScrollArea,
105
109
  ScrollAxis,
106
- default35 as Section,
110
+ default36 as Section,
107
111
  SectionPaddingY,
108
- default36 as SeparatorLayout,
109
- default37 as SpacerLayout,
110
- default38 as StackLayout,
112
+ default37 as SeparatorLayout,
113
+ default38 as SpacerLayout,
114
+ default39 as StackLayout,
111
115
  StackLayoutAlign,
112
116
  StackLayoutDirection,
113
117
  StackLayoutJustify,
114
118
  StackLayoutWrap,
115
- default39 as StickyLayout,
119
+ default40 as StickyLayout,
116
120
  StickyLayoutSide,
117
- default40 as SurfaceLayout,
118
- default41 as SwipeActionsLayout,
119
- default42 as TiltLayout,
120
- default43 as TwoColumnLayout,
121
- default44 as VStackLayout,
122
- default45 as VirtualScrollArea,
121
+ default41 as SurfaceLayout,
122
+ default42 as SwipeActionsLayout,
123
+ default43 as TiltLayout,
124
+ default44 as TwoColumnLayout,
125
+ default45 as VStackLayout,
126
+ default46 as VirtualScrollArea,
123
127
  containerVariants,
124
128
  dividerVariants,
125
129
  gridVariants,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -114,14 +114,14 @@ declare const _default: __VLS_WithSlots<import('vue').DefineComponent<AccountMen
114
114
  readonly defaultOpen: boolean;
115
115
  readonly panelClass: string | false | Record<string, any> | import('vue').ClassValue[] | null;
116
116
  readonly organization: string;
117
- readonly isBusy: boolean;
118
- readonly triggerLabel: string;
119
117
  readonly avatarSrc: string | null;
118
+ readonly isBusy: boolean;
120
119
  readonly showAppearance: boolean;
121
120
  readonly locales: ReadonlyArray<AccountMenuLocale>;
122
121
  readonly organizations: ReadonlyArray<AccountMenuOrganization>;
123
122
  readonly versions: ReadonlyArray<AccountMenuVersion>;
124
123
  readonly onSignOut: () => unknown;
124
+ readonly triggerLabel: string;
125
125
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>, {
126
126
  /** The account-level destinations — `MenuItem` rows such as account settings, placed after the switcher. */
127
127
  items?(): unknown;
@@ -35,6 +35,8 @@ export interface AppSwitcherMenuProps<T extends AppSwitcherItem = AppSwitcherIte
35
35
  readonly label?: string;
36
36
  /** A second line on the trigger — the organisation or workspace. Hidden below `breakpoint`. */
37
37
  readonly subtitle?: string;
38
+ /** The compact state — the trigger shows the mark alone, as above an icon rail; its accessible name stays. */
39
+ readonly isCompact?: boolean;
38
40
  /** The open state, controlled. The `v-model:open` binding target. */
39
41
  readonly open?: boolean;
40
42
  /** The initial open state when uncontrolled. Default `false`. */
@@ -17,14 +17,17 @@ import _sfc_main$2 from "../../overlays/popover/PopoverTrigger.vue.js";
17
17
  import _sfc_main$5 from "./AppSwitcherMenuPanel.vue.js";
18
18
  import { AppSwitcherMenuExtensions } from "./AppSwitcherMenuExtensions.js";
19
19
  import _sfc_main$3 from "../../../foundation/icons/icon/Icon.vue.js";
20
- const _hoisted_1 = ["aria-expanded", "aria-label", "data-state"];
20
+ const _hoisted_1 = ["aria-expanded", "aria-label", "data-state", "data-compact"];
21
21
  const _hoisted_2 = {
22
22
  "aria-hidden": "true",
23
23
  class: "flex shrink-0",
24
24
  "data-app-switcher-mark": ""
25
25
  };
26
26
  const _hoisted_3 = { class: "grid size-9 place-items-center rounded-lg bg-primary text-primary-foreground" };
27
- const _hoisted_4 = { class: "min-w-0" };
27
+ const _hoisted_4 = {
28
+ key: 0,
29
+ class: "min-w-0"
30
+ };
28
31
  const _hoisted_5 = { class: "block truncate text-sm font-semibold leading-tight" };
29
32
  const _hoisted_6 = ["id"];
30
33
  const _hoisted_7 = { class: "mb-4 flex shrink-0 items-center justify-between gap-3" };
@@ -49,6 +52,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
49
52
  current: {},
50
53
  label: { default: void 0 },
51
54
  subtitle: { default: void 0 },
55
+ isCompact: { type: Boolean, default: false },
52
56
  open: { type: Boolean, default: void 0 },
53
57
  defaultOpen: { type: Boolean, default: false },
54
58
  breakpoint: { default: "md" },
@@ -115,7 +119,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
115
119
  const triggerClasses = computed(
116
120
  () => cn(
117
121
  "group/app-switcher inline-flex min-h-11 min-w-0 max-w-full shrink-0 items-center gap-2.5 rounded-xl border",
118
- "border-transparent py-1 ps-1 pe-2 text-start text-foreground transition-colors motion-reduce:transition-none",
122
+ "border-transparent text-start text-foreground transition-colors motion-reduce:transition-none",
123
+ props.isCompact ? "p-1" : "py-1 ps-1 pe-2",
119
124
  "hover:border-primary/15 hover:bg-primary-soft data-[state=open]:border-primary/15 data-[state=open]:bg-primary-soft",
120
125
  "outline-hidden focus-visible:ring-2 focus-visible:ring-ring",
121
126
  attrs.class
@@ -150,7 +155,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
150
155
  "aria-haspopup": "dialog",
151
156
  "aria-expanded": unref(isOpen),
152
157
  "aria-label": triggerName.value,
153
- "data-state": unref(isOpen) ? "open" : "closed"
158
+ "data-state": unref(isOpen) ? "open" : "closed",
159
+ "data-compact": unref(props).isCompact ? "" : void 0
154
160
  }, rest.value, { class: triggerClasses.value }), [
155
161
  createElementVNode("span", _hoisted_2, [
156
162
  renderSlot(_ctx.$slots, "mark", { current: currentItem.value }, () => [
@@ -162,20 +168,21 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
162
168
  ])
163
169
  ])
164
170
  ]),
165
- createElementVNode("span", _hoisted_4, [
171
+ !unref(props).isCompact ? (openBlock(), createElementBlock("span", _hoisted_4, [
166
172
  createElementVNode("span", _hoisted_5, toDisplayString(appName.value), 1),
167
173
  unref(props).subtitle ? (openBlock(), createElementBlock("span", {
168
174
  key: 0,
169
175
  class: normalizeClass(subtitleClasses.value),
170
176
  "data-app-switcher-subtitle": ""
171
177
  }, toDisplayString(unref(props).subtitle), 3)) : createCommentVNode("", true)
172
- ]),
173
- createVNode(unref(_sfc_main$3), {
178
+ ])) : createCommentVNode("", true),
179
+ !unref(props).isCompact ? (openBlock(), createBlock(unref(_sfc_main$3), {
180
+ key: 1,
174
181
  icon: unref(ChevronDown),
175
182
  size: 16,
176
183
  class: "shrink-0 text-muted-foreground transition-transform duration-200 group-data-[state=open]/app-switcher:rotate-180 motion-reduce:transition-none",
177
184
  "data-app-switcher-chevron": ""
178
- }, null, 8, ["icon"])
185
+ }, null, 8, ["icon"])) : createCommentVNode("", true)
179
186
  ], 16, _hoisted_1)
180
187
  ]),
181
188
  _: 3
@@ -1 +1 @@
1
- {"version":3,"file":"AppSwitcherMenu.vue.js","sources":["../../../../src/presentation/nav/appSwitcherMenu/AppSwitcherMenu.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { HTMLAttributes } from 'vue';\nimport type { IconAdapter } from '../../../foundation/icons';\nimport type { SurfaceVariant } from '../../../foundation/styles';\nimport type { Breakpoint } from '../../layout/appShell/AppShell.vue';\n\n/** Defines which group of an `AppSwitcherMenu` a destination joins. */\nexport const AppSwitcherKind = {\n /** Refers to a workspace app — a tile that opens in the same tab. */\n App: 'app',\n /** Refers to a public site — a link under the divider that opens in a new tab. */\n Site: 'site',\n} as const;\n\nexport type AppSwitcherKind = (typeof AppSwitcherKind)[keyof typeof AppSwitcherKind];\n\n/** Represents one destination in an `AppSwitcherMenu`. */\nexport interface AppSwitcherItem {\n /** The stable identity; `current` names the open app by it. */\n readonly key: string;\n\n /** The app or site name, already translated. */\n readonly label: string;\n\n /** One line under an app's label naming what it is for. */\n readonly description?: string;\n\n /** The address: an absolute HTTPS URL without credentials, query or fragment, else the menu drops the item. */\n readonly href: string;\n\n /** An app tile's glyph. Default the label's first character. */\n readonly icon?: IconAdapter;\n\n /** The group — `app` tiles or `site` links. */\n readonly kind: AppSwitcherKind;\n}\n\n/** Defines props for the control that names the current app and opens the others. */\nexport interface AppSwitcherMenuProps<T extends AppSwitcherItem = AppSwitcherItem> {\n /** Every destination, in display order; each group keeps this order. */\n readonly items: ReadonlyArray<T>;\n\n /** The key of the open app or site; that entry renders as the current marker. */\n readonly current: string;\n\n /** The app name on the trigger. Default the current item's label, else `title`. */\n readonly label?: string;\n\n /** A second line on the trigger — the organisation or workspace. Hidden below `breakpoint`. */\n readonly subtitle?: string;\n\n /** The open state, controlled. The `v-model:open` binding target. */\n readonly open?: boolean;\n\n /** The initial open state when uncontrolled. Default `false`. */\n readonly defaultOpen?: boolean;\n\n /** From this breakpoint up the menu is a popover; below it, a dialog. Default `md`. */\n readonly breakpoint?: Breakpoint;\n\n /** The menu heading. Default `\"Apps\"`, localized. */\n readonly title?: string;\n\n /** The sites group heading. Default `\"Sites\"`, localized. */\n readonly sitesLabel?: string;\n\n /** The dialog's close button name. Default `\"Close\"`, localized. */\n readonly closeLabel?: string;\n\n /** The screen-reader text after each site link. Default `\"(opens in a new tab)\"`, localized. */\n readonly newTabLabel?: string;\n\n /** The trigger's accessible name; `{app}` becomes the app name. Default `\"{app} — switch app\"`, localized. */\n readonly triggerLabel?: string;\n\n /** The panel's surface recipe — `glass` or `glass-outline` for translucent chrome. Default the overlay's own. */\n readonly variant?: SurfaceVariant;\n\n /** The popover and dialog panel class — the hook for an app's own material. */\n readonly panelClass?: HTMLAttributes['class'];\n}\n\n/* Static per-breakpoint classes, so Tailwind finds every one in the source. */\nconst NarrowHiddenClass: Record<Breakpoint, string> = {\n sm: 'max-sm:hidden',\n md: 'max-md:hidden',\n lg: 'max-lg:hidden',\n xl: 'max-xl:hidden',\n '2xl': 'max-2xl:hidden',\n};\n</script>\n\n<script setup lang=\"ts\" generic=\"T extends AppSwitcherItem\">\nimport { computed, onMounted, useAttrs, useTemplateRef, watch } from 'vue';\nimport type { ClassValue } from 'clsx';\nimport { ChevronDown, LayoutGrid } from 'lucide-vue-next';\nimport { TailwindBreakpoints, useMediaQuery } from '../../../foundation/device';\nimport { Icon } from '../../../foundation/icons';\nimport { useLocale, useLocaleDefaults } from '../../../foundation/i18n';\nimport { useId } from '../../../foundation/identifiers';\nimport { useControlled } from '../../../foundation/state';\nimport { cn } from '../../../foundation/styles';\nimport Modal from '../../overlays/modal/Modal.vue';\nimport ModalContent from '../../overlays/modal/ModalContent.vue';\nimport OverlayCloseButton from '../../overlays/OverlayCloseButton.vue';\nimport OverlayTitle from '../../overlays/OverlayTitle.vue';\nimport Popover from '../../overlays/popover/Popover.vue';\nimport PopoverContent from '../../overlays/popover/PopoverContent.vue';\nimport PopoverTrigger from '../../overlays/popover/PopoverTrigger.vue';\nimport AppSwitcherMenuPanel from './AppSwitcherMenuPanel.vue';\nimport { AppSwitcherMenuExtensions } from './AppSwitcherMenuExtensions';\n\n/**\n * Renders the app-switcher menu: one trigger naming the current app, which opens the suite's other apps as tiles\n * and its public sites as new-tab links — a popover under the trigger from `breakpoint` up, a dialog below it.\n */\ndefineOptions({ name: 'AppSwitcherMenu', inheritAttrs: false });\n\ndefineSlots<{\n /** The brand mark at the trigger's start. Default a grid glyph on the primary colour. */\n mark?(props: { current: T | undefined }): unknown;\n}>();\n\nconst componentProps = withDefaults(defineProps<AppSwitcherMenuProps<T>>(), {\n label: undefined,\n subtitle: undefined,\n open: undefined,\n defaultOpen: false,\n breakpoint: 'md',\n triggerLabel: undefined,\n variant: undefined,\n panelClass: undefined,\n});\n\nconst props = useLocaleDefaults(componentProps, 'AppSwitcherMenu', {\n title: 'Apps',\n sitesLabel: 'Sites',\n closeLabel: 'Close',\n newTabLabel: '(opens in a new tab)',\n});\n\nconst emit = defineEmits<{\n /** Fires when the menu opens or closes — the `v-model:open` half. */\n 'update:open': [open: boolean];\n\n /** Fires when the reader opens another app or site. The link navigates unless the listener prevents it. */\n select: [item: T, event: MouseEvent];\n}>();\n\nconst attrs = useAttrs();\nconst locale = useLocale();\nconst titleId = useId('app-switcher-title');\nconst trigger = useTemplateRef<InstanceType<typeof PopoverTrigger>>('trigger');\n\nconst controlled = useControlled<boolean>({\n controlled: () => props.open,\n default: () => props.defaultOpen,\n onChange: (value) => {\n emit('update:open', value);\n },\n});\n\nconst isOpen = controlled.value;\n\nfunction setOpen(open: boolean): void {\n controlled.setValue(open);\n}\n\nfunction close(): void {\n controlled.setValue(false);\n}\n\n/** Whether the viewport reaches `breakpoint` — `false` on the server and in the first render. */\nconst isWide = useMediaQuery(() => `(min-width: ${TailwindBreakpoints[props.breakpoint]}px)`);\n\n/* An open menu closes when the viewport crosses the breakpoint, since its surface changes kind. Registered after\n mount, so the first media-query reading never closes a menu opened by `defaultOpen`. */\nonMounted(() => {\n watch(isWide, () => {\n if (isOpen.value) close();\n });\n});\n\nconst currentItem = computed(() => props.items.find((item) => item.key === props.current));\n\n/** The trigger's visible app name. */\nconst appName = computed(() => props.label ?? currentItem.value?.label ?? props.title);\n\nconst triggerName = computed(() =>\n props.triggerLabel === undefined\n ? locale.t('AppSwitcherMenu.triggerLabel', { app: appName.value }, '{app} — switch app')\n : props.triggerLabel.replaceAll('{app}', appName.value),\n);\n\n/** Every destination the menu can show: the current entry as given, the rest only with a safe href. */\nconst destinations = computed(() =>\n props.items.flatMap((item): AppSwitcherItem[] => {\n if (item.key === props.current) return [item];\n const href = AppSwitcherMenuExtensions.toSafeHref(item.href);\n return href === null ? [] : [{ ...item, href }];\n }),\n);\n\nconst apps = computed(() => destinations.value.filter((item) => item.kind === AppSwitcherKind.App));\nconst sites = computed(() => destinations.value.filter((item) => item.kind === AppSwitcherKind.Site));\n\n/** Reports the caller's own item, not the checked copy the panel rendered. */\nfunction select(item: AppSwitcherItem, event: MouseEvent): void {\n const original = props.items.find((entry) => entry.key === item.key);\n if (original) emit('select', original, event);\n}\n\nconst triggerClasses = computed(() =>\n cn(\n 'group/app-switcher inline-flex min-h-11 min-w-0 max-w-full shrink-0 items-center gap-2.5 rounded-xl border',\n 'border-transparent py-1 ps-1 pe-2 text-start text-foreground transition-colors motion-reduce:transition-none',\n 'hover:border-primary/15 hover:bg-primary-soft data-[state=open]:border-primary/15 data-[state=open]:bg-primary-soft',\n 'outline-hidden focus-visible:ring-2 focus-visible:ring-ring',\n attrs.class as ClassValue,\n ),\n);\n\nconst subtitleClasses = computed(() =>\n cn('block max-w-40 truncate text-xs leading-tight text-muted-foreground', NarrowHiddenClass[props.breakpoint]),\n);\n\nconst popoverClasses = computed(() => cn('w-[min(28rem,calc(100vw-2rem))]', props.panelClass as ClassValue));\n\n/** Everything but `class`, which is re-applied through `cn` above. */\nconst rest = computed(() => {\n const { class: _class, ...others } = attrs;\n return others;\n});\n\n/** The trigger button. */\nconst el = computed(() => trigger.value?.el ?? null);\n\ndefineExpose({ el });\n</script>\n\n<template>\n <Popover :open=\"isOpen && isWide\" placement=\"bottom-start\" @update:open=\"setOpen\">\n <PopoverTrigger ref=\"trigger\" as-child>\n <button\n type=\"button\"\n aria-haspopup=\"dialog\"\n :aria-expanded=\"isOpen\"\n :aria-label=\"triggerName\"\n :data-state=\"isOpen ? 'open' : 'closed'\"\n v-bind=\"rest\"\n :class=\"triggerClasses\"\n >\n <span aria-hidden=\"true\" class=\"flex shrink-0\" data-app-switcher-mark>\n <slot name=\"mark\" :current=\"currentItem\">\n <span class=\"grid size-9 place-items-center rounded-lg bg-primary text-primary-foreground\">\n <Icon :icon=\"LayoutGrid\" :size=\"18\" />\n </span>\n </slot>\n </span>\n <span class=\"min-w-0\">\n <span class=\"block truncate text-sm font-semibold leading-tight\">{{ appName }}</span>\n <span v-if=\"props.subtitle\" :class=\"subtitleClasses\" data-app-switcher-subtitle>{{ props.subtitle }}</span>\n </span>\n <Icon\n :icon=\"ChevronDown\"\n :size=\"16\"\n class=\"shrink-0 text-muted-foreground transition-transform duration-200 group-data-[state=open]/app-switcher:rotate-180 motion-reduce:transition-none\"\n data-app-switcher-chevron\n />\n </button>\n </PopoverTrigger>\n <PopoverContent\n v-if=\"isWide\"\n :aria-labelledby=\"titleId\"\n :variant=\"props.variant\"\n radius=\"xl\"\n :class=\"popoverClasses\"\n >\n <h2 :id=\"titleId\" class=\"mb-3 px-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground\">\n {{ props.title }}\n </h2>\n <AppSwitcherMenuPanel\n :apps=\"apps\"\n :sites=\"sites\"\n :current=\"props.current\"\n :sites-label=\"props.sitesLabel\"\n :new-tab-label=\"props.newTabLabel\"\n @select=\"select\"\n @close=\"close\"\n />\n </PopoverContent>\n </Popover>\n <Modal v-if=\"!isWide\" :open=\"isOpen\" @update:open=\"setOpen\">\n <ModalContent :variant=\"props.variant\" radius=\"xl\" padding=\"lg\" :class=\"props.panelClass\">\n <div class=\"mb-4 flex shrink-0 items-center justify-between gap-3\">\n <OverlayTitle>{{ props.title }}</OverlayTitle>\n <OverlayCloseButton :aria-label=\"props.closeLabel\" class=\"static -me-2 h-11 w-11 rounded-xl\" />\n </div>\n <AppSwitcherMenuPanel\n :apps=\"apps\"\n :sites=\"sites\"\n :current=\"props.current\"\n :sites-label=\"props.sitesLabel\"\n :new-tab-label=\"props.newTabLabel\"\n @select=\"select\"\n @close=\"close\"\n />\n </ModalContent>\n </Modal>\n</template>\n"],"names":["_createVNode","Popover","_unref","PopoverTrigger","_createElementVNode","_mergeProps","_renderSlot","Icon","_toDisplayString","_createElementBlock","_createBlock","PopoverContent","AppSwitcherMenuPanel","Modal","ModalContent","_normalizeClass","OverlayTitle","_createTextVNode","OverlayCloseButton"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOO,MAAM,kBAAkB;AAAA;AAAA,EAE7B,KAAK;AAAA;AAAA,EAEL,MAAM;AACR;AAuEA,MAAM,oBAAgD;AAAA,EACpD,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,OAAO;AACT;;;;;;;;;;;;;;;;;;;;;;AAkCA,UAAM,iBAAiB;AAWvB,UAAM,QAAQ,kBAAkB,gBAAgB,mBAAmB;AAAA,MACjE,OAAO;AAAA,MACP,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,aAAa;AAAA,IAAA,CACd;AAED,UAAM,OAAO;AAQb,UAAM,QAAQ,SAAA;AACd,UAAM,SAAS,UAAA;AACf,UAAM,UAAU,MAAM,oBAAoB;AAC1C,UAAM,UAAU,eAAoD,SAAS;AAE7E,UAA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Q,YAgBQG,aAAA;AAAA;UAhBe,MAAMX,MAAA,MAAA;AAAA,UAAS,iBAAa;AAAA,QAAA;2BACjD,MAce;AAAA,YAdfF,YAcec,aAAA;AAAA,cAdA,SAASZ,MAAA,KAAA,EAAM;AAAA,cAAS,QAAO;AAAA,cAAK,SAAQ;AAAA,cAAM,OAAKa,eAAEb,MAAA,KAAA,EAAM,UAAU;AAAA,YAAA;+BACtF,MAGM;AAAA,gBAHNE,mBAGM,OAHN,YAGM;AAAA,kBAFJJ,YAA8CgB,aAAA,MAAA;AAAA,qCAAhC,MAAiB;AAAA,sBAAdC,gBAAAT,gBAAAN,MAAA,KAAA,EAAM,KAAK,GAAA,CAAA;AAAA,oBAAA;;;kBAC5BF,YAA+FkB,aAAA;AAAA,oBAA1E,cAAYhB,MAAA,KAAA,EAAM;AAAA,oBAAY,OAAM;AAAA,kBAAA;;gBAE3DF,YAQEY,aAAA;AAAA,kBAPC,MAAM,KAAA;AAAA,kBACN,OAAO,MAAA;AAAA,kBACP,SAASV,MAAA,KAAA,EAAM;AAAA,kBACf,eAAaA,MAAA,KAAA,EAAM;AAAA,kBACnB,iBAAeA,MAAA,KAAA,EAAM;AAAA,kBACrB,UAAQ;AAAA,kBACR,SAAO;AAAA,gBAAA;;;;;;;;;;;"}
1
+ {"version":3,"file":"AppSwitcherMenu.vue.js","sources":["../../../../src/presentation/nav/appSwitcherMenu/AppSwitcherMenu.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { HTMLAttributes } from 'vue';\nimport type { IconAdapter } from '../../../foundation/icons';\nimport type { SurfaceVariant } from '../../../foundation/styles';\nimport type { Breakpoint } from '../../layout/appShell/AppShell.vue';\n\n/** Defines which group of an `AppSwitcherMenu` a destination joins. */\nexport const AppSwitcherKind = {\n /** Refers to a workspace app — a tile that opens in the same tab. */\n App: 'app',\n /** Refers to a public site — a link under the divider that opens in a new tab. */\n Site: 'site',\n} as const;\n\nexport type AppSwitcherKind = (typeof AppSwitcherKind)[keyof typeof AppSwitcherKind];\n\n/** Represents one destination in an `AppSwitcherMenu`. */\nexport interface AppSwitcherItem {\n /** The stable identity; `current` names the open app by it. */\n readonly key: string;\n\n /** The app or site name, already translated. */\n readonly label: string;\n\n /** One line under an app's label naming what it is for. */\n readonly description?: string;\n\n /** The address: an absolute HTTPS URL without credentials, query or fragment, else the menu drops the item. */\n readonly href: string;\n\n /** An app tile's glyph. Default the label's first character. */\n readonly icon?: IconAdapter;\n\n /** The group — `app` tiles or `site` links. */\n readonly kind: AppSwitcherKind;\n}\n\n/** Defines props for the control that names the current app and opens the others. */\nexport interface AppSwitcherMenuProps<T extends AppSwitcherItem = AppSwitcherItem> {\n /** Every destination, in display order; each group keeps this order. */\n readonly items: ReadonlyArray<T>;\n\n /** The key of the open app or site; that entry renders as the current marker. */\n readonly current: string;\n\n /** The app name on the trigger. Default the current item's label, else `title`. */\n readonly label?: string;\n\n /** A second line on the trigger — the organisation or workspace. Hidden below `breakpoint`. */\n readonly subtitle?: string;\n\n /** The compact state — the trigger shows the mark alone, as above an icon rail; its accessible name stays. */\n readonly isCompact?: boolean;\n\n /** The open state, controlled. The `v-model:open` binding target. */\n readonly open?: boolean;\n\n /** The initial open state when uncontrolled. Default `false`. */\n readonly defaultOpen?: boolean;\n\n /** From this breakpoint up the menu is a popover; below it, a dialog. Default `md`. */\n readonly breakpoint?: Breakpoint;\n\n /** The menu heading. Default `\"Apps\"`, localized. */\n readonly title?: string;\n\n /** The sites group heading. Default `\"Sites\"`, localized. */\n readonly sitesLabel?: string;\n\n /** The dialog's close button name. Default `\"Close\"`, localized. */\n readonly closeLabel?: string;\n\n /** The screen-reader text after each site link. Default `\"(opens in a new tab)\"`, localized. */\n readonly newTabLabel?: string;\n\n /** The trigger's accessible name; `{app}` becomes the app name. Default `\"{app} — switch app\"`, localized. */\n readonly triggerLabel?: string;\n\n /** The panel's surface recipe — `glass` or `glass-outline` for translucent chrome. Default the overlay's own. */\n readonly variant?: SurfaceVariant;\n\n /** The popover and dialog panel class — the hook for an app's own material. */\n readonly panelClass?: HTMLAttributes['class'];\n}\n\n/* Static per-breakpoint classes, so Tailwind finds every one in the source. */\nconst NarrowHiddenClass: Record<Breakpoint, string> = {\n sm: 'max-sm:hidden',\n md: 'max-md:hidden',\n lg: 'max-lg:hidden',\n xl: 'max-xl:hidden',\n '2xl': 'max-2xl:hidden',\n};\n</script>\n\n<script setup lang=\"ts\" generic=\"T extends AppSwitcherItem\">\nimport { computed, onMounted, useAttrs, useTemplateRef, watch } from 'vue';\nimport type { ClassValue } from 'clsx';\nimport { ChevronDown, LayoutGrid } from 'lucide-vue-next';\nimport { TailwindBreakpoints, useMediaQuery } from '../../../foundation/device';\nimport { Icon } from '../../../foundation/icons';\nimport { useLocale, useLocaleDefaults } from '../../../foundation/i18n';\nimport { useId } from '../../../foundation/identifiers';\nimport { useControlled } from '../../../foundation/state';\nimport { cn } from '../../../foundation/styles';\nimport Modal from '../../overlays/modal/Modal.vue';\nimport ModalContent from '../../overlays/modal/ModalContent.vue';\nimport OverlayCloseButton from '../../overlays/OverlayCloseButton.vue';\nimport OverlayTitle from '../../overlays/OverlayTitle.vue';\nimport Popover from '../../overlays/popover/Popover.vue';\nimport PopoverContent from '../../overlays/popover/PopoverContent.vue';\nimport PopoverTrigger from '../../overlays/popover/PopoverTrigger.vue';\nimport AppSwitcherMenuPanel from './AppSwitcherMenuPanel.vue';\nimport { AppSwitcherMenuExtensions } from './AppSwitcherMenuExtensions';\n\n/**\n * Renders the app-switcher menu: one trigger naming the current app, which opens the suite's other apps as tiles\n * and its public sites as new-tab links — a popover under the trigger from `breakpoint` up, a dialog below it.\n */\ndefineOptions({ name: 'AppSwitcherMenu', inheritAttrs: false });\n\ndefineSlots<{\n /** The brand mark at the trigger's start. Default a grid glyph on the primary colour. */\n mark?(props: { current: T | undefined }): unknown;\n}>();\n\nconst componentProps = withDefaults(defineProps<AppSwitcherMenuProps<T>>(), {\n label: undefined,\n subtitle: undefined,\n isCompact: false,\n open: undefined,\n defaultOpen: false,\n breakpoint: 'md',\n triggerLabel: undefined,\n variant: undefined,\n panelClass: undefined,\n});\n\nconst props = useLocaleDefaults(componentProps, 'AppSwitcherMenu', {\n title: 'Apps',\n sitesLabel: 'Sites',\n closeLabel: 'Close',\n newTabLabel: '(opens in a new tab)',\n});\n\nconst emit = defineEmits<{\n /** Fires when the menu opens or closes — the `v-model:open` half. */\n 'update:open': [open: boolean];\n\n /** Fires when the reader opens another app or site. The link navigates unless the listener prevents it. */\n select: [item: T, event: MouseEvent];\n}>();\n\nconst attrs = useAttrs();\nconst locale = useLocale();\nconst titleId = useId('app-switcher-title');\nconst trigger = useTemplateRef<InstanceType<typeof PopoverTrigger>>('trigger');\n\nconst controlled = useControlled<boolean>({\n controlled: () => props.open,\n default: () => props.defaultOpen,\n onChange: (value) => {\n emit('update:open', value);\n },\n});\n\nconst isOpen = controlled.value;\n\nfunction setOpen(open: boolean): void {\n controlled.setValue(open);\n}\n\nfunction close(): void {\n controlled.setValue(false);\n}\n\n/** Whether the viewport reaches `breakpoint` — `false` on the server and in the first render. */\nconst isWide = useMediaQuery(() => `(min-width: ${TailwindBreakpoints[props.breakpoint]}px)`);\n\n/* An open menu closes when the viewport crosses the breakpoint, since its surface changes kind. Registered after\n mount, so the first media-query reading never closes a menu opened by `defaultOpen`. */\nonMounted(() => {\n watch(isWide, () => {\n if (isOpen.value) close();\n });\n});\n\nconst currentItem = computed(() => props.items.find((item) => item.key === props.current));\n\n/** The trigger's visible app name. */\nconst appName = computed(() => props.label ?? currentItem.value?.label ?? props.title);\n\nconst triggerName = computed(() =>\n props.triggerLabel === undefined\n ? locale.t('AppSwitcherMenu.triggerLabel', { app: appName.value }, '{app} — switch app')\n : props.triggerLabel.replaceAll('{app}', appName.value),\n);\n\n/** Every destination the menu can show: the current entry as given, the rest only with a safe href. */\nconst destinations = computed(() =>\n props.items.flatMap((item): AppSwitcherItem[] => {\n if (item.key === props.current) return [item];\n const href = AppSwitcherMenuExtensions.toSafeHref(item.href);\n return href === null ? [] : [{ ...item, href }];\n }),\n);\n\nconst apps = computed(() => destinations.value.filter((item) => item.kind === AppSwitcherKind.App));\nconst sites = computed(() => destinations.value.filter((item) => item.kind === AppSwitcherKind.Site));\n\n/** Reports the caller's own item, not the checked copy the panel rendered. */\nfunction select(item: AppSwitcherItem, event: MouseEvent): void {\n const original = props.items.find((entry) => entry.key === item.key);\n if (original) emit('select', original, event);\n}\n\nconst triggerClasses = computed(() =>\n cn(\n 'group/app-switcher inline-flex min-h-11 min-w-0 max-w-full shrink-0 items-center gap-2.5 rounded-xl border',\n 'border-transparent text-start text-foreground transition-colors motion-reduce:transition-none',\n props.isCompact ? 'p-1' : 'py-1 ps-1 pe-2',\n 'hover:border-primary/15 hover:bg-primary-soft data-[state=open]:border-primary/15 data-[state=open]:bg-primary-soft',\n 'outline-hidden focus-visible:ring-2 focus-visible:ring-ring',\n attrs.class as ClassValue,\n ),\n);\n\nconst subtitleClasses = computed(() =>\n cn('block max-w-40 truncate text-xs leading-tight text-muted-foreground', NarrowHiddenClass[props.breakpoint]),\n);\n\nconst popoverClasses = computed(() => cn('w-[min(28rem,calc(100vw-2rem))]', props.panelClass as ClassValue));\n\n/** Everything but `class`, which is re-applied through `cn` above. */\nconst rest = computed(() => {\n const { class: _class, ...others } = attrs;\n return others;\n});\n\n/** The trigger button. */\nconst el = computed(() => trigger.value?.el ?? null);\n\ndefineExpose({ el });\n</script>\n\n<template>\n <Popover :open=\"isOpen && isWide\" placement=\"bottom-start\" @update:open=\"setOpen\">\n <PopoverTrigger ref=\"trigger\" as-child>\n <button\n type=\"button\"\n aria-haspopup=\"dialog\"\n :aria-expanded=\"isOpen\"\n :aria-label=\"triggerName\"\n :data-state=\"isOpen ? 'open' : 'closed'\"\n :data-compact=\"props.isCompact ? '' : undefined\"\n v-bind=\"rest\"\n :class=\"triggerClasses\"\n >\n <span aria-hidden=\"true\" class=\"flex shrink-0\" data-app-switcher-mark>\n <slot name=\"mark\" :current=\"currentItem\">\n <span class=\"grid size-9 place-items-center rounded-lg bg-primary text-primary-foreground\">\n <Icon :icon=\"LayoutGrid\" :size=\"18\" />\n </span>\n </slot>\n </span>\n <span v-if=\"!props.isCompact\" class=\"min-w-0\">\n <span class=\"block truncate text-sm font-semibold leading-tight\">{{ appName }}</span>\n <span v-if=\"props.subtitle\" :class=\"subtitleClasses\" data-app-switcher-subtitle>{{ props.subtitle }}</span>\n </span>\n <Icon\n v-if=\"!props.isCompact\"\n :icon=\"ChevronDown\"\n :size=\"16\"\n class=\"shrink-0 text-muted-foreground transition-transform duration-200 group-data-[state=open]/app-switcher:rotate-180 motion-reduce:transition-none\"\n data-app-switcher-chevron\n />\n </button>\n </PopoverTrigger>\n <PopoverContent\n v-if=\"isWide\"\n :aria-labelledby=\"titleId\"\n :variant=\"props.variant\"\n radius=\"xl\"\n :class=\"popoverClasses\"\n >\n <h2 :id=\"titleId\" class=\"mb-3 px-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground\">\n {{ props.title }}\n </h2>\n <AppSwitcherMenuPanel\n :apps=\"apps\"\n :sites=\"sites\"\n :current=\"props.current\"\n :sites-label=\"props.sitesLabel\"\n :new-tab-label=\"props.newTabLabel\"\n @select=\"select\"\n @close=\"close\"\n />\n </PopoverContent>\n </Popover>\n <Modal v-if=\"!isWide\" :open=\"isOpen\" @update:open=\"setOpen\">\n <ModalContent :variant=\"props.variant\" radius=\"xl\" padding=\"lg\" :class=\"props.panelClass\">\n <div class=\"mb-4 flex shrink-0 items-center justify-between gap-3\">\n <OverlayTitle>{{ props.title }}</OverlayTitle>\n <OverlayCloseButton :aria-label=\"props.closeLabel\" class=\"static -me-2 h-11 w-11 rounded-xl\" />\n </div>\n <AppSwitcherMenuPanel\n :apps=\"apps\"\n :sites=\"sites\"\n :current=\"props.current\"\n :sites-label=\"props.sitesLabel\"\n :new-tab-label=\"props.newTabLabel\"\n @select=\"select\"\n @close=\"close\"\n />\n </ModalContent>\n </Modal>\n</template>\n"],"names":["_createVNode","Popover","_unref","PopoverTrigger","_createElementVNode","_mergeProps","_renderSlot","Icon","_openBlock","_createElementBlock","_toDisplayString","_createBlock","PopoverContent","AppSwitcherMenuPanel","Modal","ModalContent","_normalizeClass","OverlayTitle","_createTextVNode","OverlayCloseButton"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOO,MAAM,kBAAkB;AAAA;AAAA,EAE7B,KAAK;AAAA;AAAA,EAEL,MAAM;AACR;AA0EA,MAAM,oBAAgD;AAAA,EACpD,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,OAAO;AACT;;;;;;;;;;;;;;;;;;;;;;;AAkCA,UAAM,iBAAiB;AAYvB,UAAM,QAAQ,kBAAkB,gBAAgB,mBAAmB;AAAA,MACjE,OAAO;AAAA,MACP,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,aAAa;AAAA,IAAA,CACd;AAED,UAAM,OAAO;AAQb,UAAM,QAAQ,SAAA;AACd,UAAM,SAAS,UAAA;AACf,UAAM,UAAU,MAAM,oBAAoB;AAC1C,UAAM,UAAU,eAAoD,SAAS;AAE7E,UAAM,aAAa,cAAuB;AAAA,MACxC,YAAY,MAAM,MAAM;AAAA,MACxB,SAAS,MAAM,MAAM;AAAA,MACrB,UAAU,CAAC,UAAU;AACnB,aAAK,eAAe,KAAK;AAAA,MAC3B;AAAA,IAAA,CACD;AAED,UAAM,SAAS,WAAW;AAE1B,aAAS,QAAQ,MAAqB;AACpC,iBAAW,SAAS,IAAI;AAAA,IAC1B;AAEA,aAAS,QAAc;AACrB,iBAAW,SAAS,KAAK;AAAA,IAC3B;AAGA,UAAM,SAAS,cAAc,MAAM,eAAe,oBAAoB,MAAM,UAAU,CAAC,KAAK;AAI5F,cAAU,MAAM;AACd,YAAM,QAAQ,MAAM;AAClB,YAAI,OAAO,MAAO,OAAA;AAAA,MACpB,CAAC;AAAA,IACH,CAAC;AAED,UAAM,cAAc,SAAS,MAAM,MAAM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iB;AAAA,sBAAdC,gBAAAR,gBAAAR,MAAA,KAAA,EAAM,KAAK,GAAA,CAAA;AAAA,oBAAA;;;kBAC5BF,YAA+FmB,aAAA;AAAA,oBAA1E,cAAYjB,MAAA,KAAA,EAAM;AAAA,oBAAY,OAAM;AAAA,kBAAA;;gBAE3DF,YAQEa,aAAA;AAAA,kBAPC,MAAM,KAAA;AAAA,kBACN,OAAO,MAAA;AAAA,kBACP,SAASX,MAAA,KAAA,EAAM;AAAA,kBACf,eAAaA,MAAA,KAAA,EAAM;AAAA,kBACnB,iBAAeA,MAAA,KAAA,EAAM;AAAA,kBACrB,UAAQ;AAAA,kBACR,SAAO;AAAA,gBAAA;;;;;;;;;;;"}
@@ -6,10 +6,17 @@ export interface BreadcrumbItem {
6
6
  }
7
7
  export interface BreadcrumbProps {
8
8
  readonly items: ReadonlyArray<BreadcrumbItem>;
9
+ /**
10
+ * Keeps the trail on one line, as in an app bar: items shorten with an ellipsis instead of wrapping, the current
11
+ * page takes the emphasis, and below `md` only the last two items show.
12
+ */
13
+ readonly isSingleLine?: boolean;
9
14
  }
10
15
  declare const _default: __VLS_WithSlots<import('vue').DefineComponent<BreadcrumbProps, {
11
16
  el: Readonly<import('vue').ShallowRef<HTMLElement | null>>;
12
- }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<BreadcrumbProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>, {
17
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<BreadcrumbProps> & Readonly<{}>, {
18
+ readonly isSingleLine: boolean;
19
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>, {
13
20
  /** The rich override for an item's `label`. */
14
21
  label?(props: {
15
22
  item: BreadcrumbItem;
@@ -1,30 +1,41 @@
1
- import { defineComponent, useAttrs, useTemplateRef, computed, openBlock, createElementBlock, mergeProps, unref, createElementVNode, Fragment, renderList, renderSlot, createTextVNode, toDisplayString, createVNode, createCommentVNode } from "vue";
1
+ import { defineComponent, useAttrs, useTemplateRef, computed, openBlock, createElementBlock, mergeProps, unref, createElementVNode, normalizeClass, Fragment, renderList, renderSlot, createTextVNode, toDisplayString, createVNode, createCommentVNode } from "vue";
2
2
  import { useLocale } from "../../../foundation/i18n/providers/LocaleContext.js";
3
3
  import { UrlExtensions } from "../../../foundation/dom/UrlExtensions.js";
4
4
  import { ChevronRight } from "lucide-vue-next";
5
5
  import { cn } from "../../../foundation/styles/Cn.js";
6
6
  import _sfc_main$1 from "../../../foundation/icons/icon/Icon.vue.js";
7
7
  const _hoisted_1 = ["aria-label"];
8
- const _hoisted_2 = { class: "flex flex-wrap items-center gap-1.5" };
9
- const _hoisted_3 = ["href"];
10
- const _hoisted_4 = ["aria-current"];
11
- const _hoisted_5 = {
12
- key: 0,
13
- "aria-hidden": "true",
14
- class: "text-subtle-foreground"
15
- };
8
+ const _hoisted_2 = ["href"];
9
+ const _hoisted_3 = ["aria-current"];
16
10
  const _sfc_main = /* @__PURE__ */ defineComponent({
17
11
  ...{ name: "Breadcrumb", inheritAttrs: false },
18
12
  __name: "Breadcrumb",
19
13
  props: {
20
- items: {}
14
+ items: {},
15
+ isSingleLine: { type: Boolean, default: false }
21
16
  },
22
17
  setup(__props, { expose: __expose }) {
23
18
  const locale = useLocale();
24
19
  const props = __props;
25
20
  const attrs = useAttrs();
26
21
  const el = useTemplateRef("el");
27
- const classes = computed(() => cn("text-sm", attrs.class));
22
+ const classes = computed(() => cn("text-sm", props.isSingleLine && "min-w-0", attrs.class));
23
+ const listClasses = computed(
24
+ () => props.isSingleLine ? "flex min-w-0 flex-nowrap items-center gap-1.5" : "flex flex-wrap items-center gap-1.5"
25
+ );
26
+ function itemClasses(index) {
27
+ if (!props.isSingleLine) return void 0;
28
+ const isLast = index === lastIndex.value;
29
+ const isEarly = index < lastIndex.value - 1;
30
+ return cn("min-w-0 truncate", isLast && "font-semibold", isEarly && "max-md:hidden");
31
+ }
32
+ function separatorClasses(index) {
33
+ return cn(
34
+ "text-subtle-foreground",
35
+ props.isSingleLine && "shrink-0",
36
+ props.isSingleLine && index < lastIndex.value - 1 && "max-md:hidden"
37
+ );
38
+ }
28
39
  const rest = computed(() => {
29
40
  const { class: _class, ...others } = attrs;
30
41
  return others;
@@ -37,12 +48,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
37
48
  ref: el,
38
49
  "aria-label": unref(locale).t("Breadcrumb.breadcrumb", void 0, "Breadcrumb")
39
50
  }, rest.value, { class: classes.value }), [
40
- createElementVNode("ol", _hoisted_2, [
51
+ createElementVNode("ol", {
52
+ class: normalizeClass(listClasses.value)
53
+ }, [
41
54
  (openBlock(true), createElementBlock(Fragment, null, renderList(props.items, (item, i) => {
42
55
  return openBlock(), createElementBlock(Fragment, {
43
56
  key: item.href ?? item.label
44
57
  }, [
45
- createElementVNode("li", null, [
58
+ createElementVNode("li", {
59
+ class: normalizeClass(itemClasses(i))
60
+ }, [
46
61
  item.href && i !== lastIndex.value ? (openBlock(), createElementBlock("a", {
47
62
  key: 0,
48
63
  href: unref(UrlExtensions).safeNavigation(item.href),
@@ -54,7 +69,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
54
69
  }, () => [
55
70
  createTextVNode(toDisplayString(item.label), 1)
56
71
  ])
57
- ], 8, _hoisted_3)) : (openBlock(), createElementBlock("span", {
72
+ ], 8, _hoisted_2)) : (openBlock(), createElementBlock("span", {
58
73
  key: 1,
59
74
  "aria-current": i === lastIndex.value ? "page" : void 0,
60
75
  class: "text-foreground"
@@ -65,19 +80,23 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
65
80
  }, () => [
66
81
  createTextVNode(toDisplayString(item.label), 1)
67
82
  ])
68
- ], 8, _hoisted_4))
69
- ]),
70
- i !== lastIndex.value ? (openBlock(), createElementBlock("li", _hoisted_5, [
83
+ ], 8, _hoisted_3))
84
+ ], 2),
85
+ i !== lastIndex.value ? (openBlock(), createElementBlock("li", {
86
+ key: 0,
87
+ "aria-hidden": "true",
88
+ class: normalizeClass(separatorClasses(i))
89
+ }, [
71
90
  renderSlot(_ctx.$slots, "separator", {}, () => [
72
91
  createVNode(unref(_sfc_main$1), {
73
92
  icon: unref(ChevronRight),
74
93
  size: 14
75
94
  }, null, 8, ["icon"])
76
95
  ])
77
- ])) : createCommentVNode("", true)
96
+ ], 2)) : createCommentVNode("", true)
78
97
  ], 64);
79
98
  }), 128))
80
- ])
99
+ ], 2)
81
100
  ], 16, _hoisted_1);
82
101
  };
83
102
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Breadcrumb.vue.js","sources":["../../../../src/presentation/nav/breadcrumb/Breadcrumb.vue"],"sourcesContent":["<script lang=\"ts\">\nexport interface BreadcrumbItem {\n /** The item's label — scalar; an array item carries no rich content. The `#label` slot is the rich override. */\n readonly label: string | number;\n\n /** Make this item a link. Last item is typically rendered as plain text. */\n readonly href?: string;\n}\n\nexport interface BreadcrumbProps {\n readonly items: ReadonlyArray<BreadcrumbItem>;\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { useLocale } from '../../../foundation/i18n';\nimport { UrlExtensions } from '../../../foundation/dom';\nimport { computed, useAttrs, useTemplateRef } from 'vue';\nimport { ChevronRight } from 'lucide-vue-next';\nimport { cn } from '../../../foundation/styles';\nimport { Icon } from '../../../foundation/icons';\n\nconst locale = useLocale();\n\n/**\n * Renders a linear trail of links and separators marking where the reader stands.\n * The last item is always rendered as `aria-current=\"page\"` and not a link. Use the L5\n * collapsing version when the chain gets long.\n */\ndefineOptions({ name: 'Breadcrumb', inheritAttrs: false });\n\ndefineSlots<{\n /** The rich override for an item's `label`. */\n label?(props: { item: BreadcrumbItem; index: number }): unknown;\n\n /** The custom separator element. React's `separator` prop; defaults to a chevron-right icon. */\n separator?(): unknown;\n}>();\n\nconst props = defineProps<BreadcrumbProps>();\n\nconst attrs = useAttrs();\nconst el = useTemplateRef<HTMLElement>('el');\n\nconst classes = computed(() => cn('text-sm', attrs.class as string | undefined));\n\n/** Everything but `class`, which is re-applied through `cn` above. */\nconst rest = computed(() => {\n const { class: _class, ...others } = attrs;\n return others;\n});\n\nconst lastIndex = computed(() => props.items.length - 1);\n\ndefineExpose({ el });\n</script>\n\n<template>\n <!-- `aria-label` sits before `v-bind=\"rest\"` so a consumer-supplied one wins,\n the precedence React got from spreading `{...props}` after it. -->\n <nav ref=\"el\" :aria-label=\"locale.t('Breadcrumb.breadcrumb', undefined, 'Breadcrumb')\" v-bind=\"rest\" :class=\"classes\">\n <ol class=\"flex flex-wrap items-center gap-1.5\">\n <template v-for=\"(item, i) in props.items\" :key=\"item.href ?? item.label\">\n <li>\n <a\n v-if=\"item.href && i !== lastIndex\"\n :href=\"UrlExtensions.safeNavigation(item.href)\"\n class=\"text-muted-foreground hover:text-foreground hover:underline focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring rounded-sm\"\n >\n <slot name=\"label\" :item=\"item\" :index=\"i\">{{ item.label }}</slot>\n </a>\n <span v-else :aria-current=\"i === lastIndex ? 'page' : undefined\" class=\"text-foreground\">\n <slot name=\"label\" :item=\"item\" :index=\"i\">{{ item.label }}</slot>\n </span>\n </li>\n <li v-if=\"i !== lastIndex\" aria-hidden=\"true\" class=\"text-subtle-foreground\">\n <slot name=\"separator\"><Icon :icon=\"ChevronRight\" :size=\"14\" /></slot>\n </li>\n </template>\n </ol>\n </nav>\n</template>\n"],"names":["_openBlock","_createElementBlock","_mergeProps","_unref","_createElementVNode","_Fragment","_renderSlot","_createTextVNode","_toDisplayString","_createVNode","Icon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAsBA,UAAM,SAAS,UAAA;AAiBf,UAAM,QAAQ;AAEd,UAAM,QAAQ,SAAA;AACd,UAAM,KAAK,eAA4B,IAAI;AAE3C,UAAM,UAAU,SAAS,MAAM,GAAG,WAAW,MAAM,KAA2B,CAAC;AAG/E,UAAM,OAAO,SA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BAA/CG,YAAwCN,MAAAO,WAAA,GAAA;AAAA,oBAAjC,MAAMP,MAAA,YAAA;AAAA,oBAAe,MAAM;AAAA,kBAAA;;;;;;;;;;"}
1
+ {"version":3,"file":"Breadcrumb.vue.js","sources":["../../../../src/presentation/nav/breadcrumb/Breadcrumb.vue"],"sourcesContent":["<script lang=\"ts\">\nexport interface BreadcrumbItem {\n /** The item's label — scalar; an array item carries no rich content. The `#label` slot is the rich override. */\n readonly label: string | number;\n\n /** Make this item a link. Last item is typically rendered as plain text. */\n readonly href?: string;\n}\n\nexport interface BreadcrumbProps {\n readonly items: ReadonlyArray<BreadcrumbItem>;\n\n /**\n * Keeps the trail on one line, as in an app bar: items shorten with an ellipsis instead of wrapping, the current\n * page takes the emphasis, and below `md` only the last two items show.\n */\n readonly isSingleLine?: boolean;\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { useLocale } from '../../../foundation/i18n';\nimport { UrlExtensions } from '../../../foundation/dom';\nimport { computed, useAttrs, useTemplateRef } from 'vue';\nimport { ChevronRight } from 'lucide-vue-next';\nimport { cn } from '../../../foundation/styles';\nimport { Icon } from '../../../foundation/icons';\n\nconst locale = useLocale();\n\n/**\n * Renders a linear trail of links and separators marking where the reader stands.\n * The last item is always rendered as `aria-current=\"page\"` and not a link. Use the L5\n * collapsing version when the chain gets long.\n */\ndefineOptions({ name: 'Breadcrumb', inheritAttrs: false });\n\ndefineSlots<{\n /** The rich override for an item's `label`. */\n label?(props: { item: BreadcrumbItem; index: number }): unknown;\n\n /** The custom separator element. React's `separator` prop; defaults to a chevron-right icon. */\n separator?(): unknown;\n}>();\n\nconst props = withDefaults(defineProps<BreadcrumbProps>(), { isSingleLine: false });\n\nconst attrs = useAttrs();\nconst el = useTemplateRef<HTMLElement>('el');\n\nconst classes = computed(() => cn('text-sm', props.isSingleLine && 'min-w-0', attrs.class as string | undefined));\n\nconst listClasses = computed(() =>\n props.isSingleLine ? 'flex min-w-0 flex-nowrap items-center gap-1.5' : 'flex flex-wrap items-center gap-1.5',\n);\n\n/** An item's place from the end of the trail, separators included: the last item is 1, its separator 2. */\nfunction itemClasses(index: number): string | undefined {\n if (!props.isSingleLine) return undefined;\n const isLast = index === lastIndex.value;\n // Below `md` the trail keeps its last two items; the earlier ones return from `md` up.\n const isEarly = index < lastIndex.value - 1;\n return cn('min-w-0 truncate', isLast && 'font-semibold', isEarly && 'max-md:hidden');\n}\n\nfunction separatorClasses(index: number): string {\n return cn(\n 'text-subtle-foreground',\n props.isSingleLine && 'shrink-0',\n props.isSingleLine && index < lastIndex.value - 1 && 'max-md:hidden',\n );\n}\n\n/** Everything but `class`, which is re-applied through `cn` above. */\nconst rest = computed(() => {\n const { class: _class, ...others } = attrs;\n return others;\n});\n\nconst lastIndex = computed(() => props.items.length - 1);\n\ndefineExpose({ el });\n</script>\n\n<template>\n <!-- `aria-label` sits before `v-bind=\"rest\"` so a consumer-supplied one wins,\n the precedence React got from spreading `{...props}` after it. -->\n <nav ref=\"el\" :aria-label=\"locale.t('Breadcrumb.breadcrumb', undefined, 'Breadcrumb')\" v-bind=\"rest\" :class=\"classes\">\n <ol :class=\"listClasses\">\n <template v-for=\"(item, i) in props.items\" :key=\"item.href ?? item.label\">\n <li :class=\"itemClasses(i)\">\n <a\n v-if=\"item.href && i !== lastIndex\"\n :href=\"UrlExtensions.safeNavigation(item.href)\"\n class=\"text-muted-foreground hover:text-foreground hover:underline focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring rounded-sm\"\n >\n <slot name=\"label\" :item=\"item\" :index=\"i\">{{ item.label }}</slot>\n </a>\n <span v-else :aria-current=\"i === lastIndex ? 'page' : undefined\" class=\"text-foreground\">\n <slot name=\"label\" :item=\"item\" :index=\"i\">{{ item.label }}</slot>\n </span>\n </li>\n <li v-if=\"i !== lastIndex\" aria-hidden=\"true\" :class=\"separatorClasses(i)\">\n <slot name=\"separator\"><Icon :icon=\"ChevronRight\" :size=\"14\" /></slot>\n </li>\n </template>\n </ol>\n </nav>\n</template>\n"],"names":["_openBlock","_createElementBlock","_mergeProps","_unref","_createElementVNode","_Fragment","_normalizeClass","_renderSlot","_createTextVNode","_toDisplayString","_createVNode","Icon"],"mappings":";;;;;;;;;;;;;;;;;AA4BA,UAAM,SAAS,UAAA;AAiBf,UAAM,QAAQ;AAEd,UAAM,QAAQ,SAAA;AACd,UAAM,KAAK,eAA4B,IAAI;AAE3C,UAAM,UAAU,SAAS,MAAM,GAAG,WAAW,MAAM,gBAAgB,WAAW,MAAM,KAA2B,CAAC;AAEhH,UAAM,cAAc;AAAA,MAAS,MAC3B,MAAM,eAAe,kDAAkD;AAAA,IAAA;AAIzE,aAAS,YAAY,OAAmC;AACtD,UAAI,CAAC,MAAM,aAAc,QAAO;AAChC,YAAM,SAAS,UAAU,UAAU;AAEnC,YAAM,UAAU,QAAQ,UAAU,QAAQ;AAC1C,aAAO,GAAG,oBAAoB,UAAU,iBAAiB,WAAW,eAAe;AAAA,IACrF;AAEA,aAAS,iBAAiB,OAAuB;AAC/C,aAAO;AAAA,QACL;AAAA,QACA,MAAM,gBAAgB;AAAA,QACtB,MAAM,gBAAgB,QAAQ,UAAU,QAAQ,KAAK;AAAA,MAAA;AAAA,IAEzD;AAGA,UAAM,OAAO,SAAS,MAAM;AAC1B,YAAM,EAAE,OAAO,QAAQ,GAAG,WAAW;AACrC,aAAO;AAAA,IACT,CAAC;AAED,UAAM,YAAY,SAAS,MAAM,MAAM,MAAM,SAAS,CAAC;AAEvD,aAAa,EAAE,IAAI;;AAMjB,aAAAA,UAAA,GAAAC,mBAoBM,OApBNC,WAoBM;AAAA,iBApBG;AAAA,QAAJ,KAAI;AAAA,QAAM,cAAYC,MAAA,MAAA,EAAO,2BAA2B,QAAS,YAAA;AAAA,MAAA,GAAyB,KAAA,OAAI,EAAG,OAAO,QAAA,MAAA,CAAO,GAAA;AAAA,QAClHC,mBAkBK,MAAA;AAAA,UAlBA,sBAAO,YAAA,KAAW;AAAA,QAAA;WACrBJ,UAAA,IAAA,GAAA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