@xleddyl/443-components-vue 0.16.102 → 0.16.103

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 (40) hide show
  1. package/CATALOG.md +147 -147
  2. package/README.md +49 -28
  3. package/dist/components/layout/AppShell.vue +89 -1
  4. package/dist/components/layout/AppShell.vue.d.ts +12 -2
  5. package/dist/components/overlays/ConfirmDialog.vue.d.ts +8 -0
  6. package/dist/components/overlays/ConfirmHost.vue.d.ts +8 -0
  7. package/dist/components/overlays/Drawer.vue +9 -1
  8. package/dist/components/overlays/Drawer.vue.d.ts +10 -0
  9. package/dist/components/overlays/Modal.vue.d.ts +8 -0
  10. package/dist/components/overlays/Toaster.vue +2 -1
  11. package/dist/components/templates/DashboardLayout.vue +11 -1
  12. package/dist/components/templates/DashboardLayout.vue.d.ts +10 -0
  13. package/dist/components/templates/FormDrawer.vue +3 -1
  14. package/dist/components/templates/FormDrawer.vue.d.ts +6 -0
  15. package/dist/components/templates/FormModal.vue.d.ts +4 -0
  16. package/dist/components/templates/SettingsModal.vue.d.ts +8 -0
  17. package/dist/composables/usePreferences.d.ts +1 -0
  18. package/dist/composables/usePreferences.mjs +2 -1
  19. package/dist/composables/useRouteRecord.mjs +6 -4
  20. package/dist/icons/builtin.d.ts +3 -0
  21. package/dist/icons/builtin.mjs +9 -0
  22. package/dist/internal/forms/leave.mjs +9 -2
  23. package/dist/internal/overlays/DialogFrame.vue +152 -90
  24. package/dist/internal/overlays/DialogFrame.vue.d.ts +8 -0
  25. package/dist/internal/overlays/OverlayView.vue.d.ts +10 -0
  26. package/dist/internal/overlays/avoid.mjs +16 -0
  27. package/dist/internal/overlays/dialog.d.ts +3 -0
  28. package/dist/internal/overlays/dialog.mjs +61 -15
  29. package/dist/internal/overlays/dock.d.ts +16 -0
  30. package/dist/internal/overlays/dock.mjs +10 -0
  31. package/dist/locale/de.mjs +8 -0
  32. package/dist/locale/en.mjs +8 -0
  33. package/dist/locale/it.mjs +8 -0
  34. package/dist/locale/types.d.ts +8 -0
  35. package/dist/styles/feedback/skeleton.css +6 -0
  36. package/dist/styles/layout/app-shell.css +75 -0
  37. package/dist/styles/layout/stack.css +7 -0
  38. package/dist/styles/overlays/drawer.css +59 -0
  39. package/dist/styles/overlays/modal.css +1 -0
  40. package/package.json +1 -1
package/README.md CHANGED
@@ -241,6 +241,7 @@ UI choices are kept in one preferences store: the theme, the preset, the collaps
241
241
  | `shell:<storageKey>` | `boolean` (collapsed) | `AppShell` and `DashboardLayout` (`shell:k-sidebar-collapsed`) |
242
242
  | `grid:<storageKey>` | `GridPreference` (`{ columns?: GridColumnState[], pageSize }`) | `DataGrid` with `storageKey`: visibility, order, width, pinned, page size |
243
243
  | `workspace:<storageKey>` | `WorkspacePreference` (`{ left?: { width, collapsed }, right?: { width, collapsed } }`) | `WorkspaceLayout` with `storageKey`: side pane widths and collapsed state |
244
+ | `dock:<dockStorageKey>` | `number` (px) | `AppShell` and `DashboardLayout`: the width of the docked drawer panel |
244
245
 
245
246
  `PREFERENCE_KEYS` builds them (`PREFERENCE_KEYS.grid('orders')`). Your own keys work too: use a namespace of your app (`app:<name>`).
246
247
 
@@ -460,13 +461,13 @@ Several controls in one `FormField`. Only the primary control takes the field id
460
461
 
461
462
  Every `Form` registers its dirty state in the nearest leave scope while it is mounted, so a form can not be left silently, wherever it is:
462
463
 
463
- | Scope | Asks before |
464
- | ------------------------- | -------------------------------------------------------------------------------------------------------------- |
465
- | `Modal`, `Drawer` | close (button, Escape, backdrop, `close()`), trail navigation; then `beforeClose` runs |
466
- | `FormDrawer`, `FormModal` | the same, plus the cancel button (`onCancel` too); `confirmDiscard()` asks on demand |
467
- | `SettingsModal` | Back, the breadcrumb, another section, `openPage()`, close, a route change of its `route` entry (browser back) |
468
- | `useRouteRecord` | a navigation that closes or replaces the record, with the topmost open dialog dirty (or your `beforeLeave`) |
469
- | Page (the app root scope) | a route path change (vue-router or Nuxt, through `$router`) and the tab close (`beforeunload`) |
464
+ | Scope | Asks before |
465
+ | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
466
+ | `Modal`, `Drawer` | close (button, Escape, backdrop, `close()`), trail navigation; then `beforeClose` runs |
467
+ | `FormDrawer`, `FormModal` | the same, plus the cancel button (`onCancel` too); `confirmDiscard()` asks on demand |
468
+ | `SettingsModal` | Back, the breadcrumb, another section, `openPage()`, close, a route change of its `route` entry (browser back) |
469
+ | `useRouteRecord` | a navigation or an `openRecord()` that closes or replaces the record, with the topmost open dialog (or the docked drawer) dirty, or your `beforeLeave` |
470
+ | Page (the app root scope) | a route path change (vue-router or Nuxt, through `$router`) and the tab close (`beforeunload`) |
470
471
 
471
472
  Scopes nest: a dirty form in a drawer also blocks a route change of the page. The question is `useConfirm().discard()` (localized in `en`, `it`, `de`, the copy of the nearest scope: `guardTitle` and `guardMessage` of the overlay), shown once even when several guards ask for the same navigation or click. A form does not block while it is submitting, disabled or read only, and a successful `onSubmit` marks it clean (throw to keep it dirty; without `onSubmit` nothing changes). `form.markClean()` does it by hand (a save outside `onSubmit`), `form.reset(values)` loads new saved values.
472
473
 
@@ -764,12 +765,31 @@ const confirmDiscard = () => !dirty.value || confirm({ title: 'Discard changes?'
764
765
  </KDrawer>
765
766
  ```
766
767
 
768
+ #### Docked drawers
769
+
770
+ `docked` on a right `Drawer` or `FormDrawer` keeps it beside the page instead of above it, like a detail panel of a list: the page stays usable while the drawer is open, and a click on another row shows that record in the same panel.
771
+
772
+ ```vue
773
+ <KFormDrawer v-model:open="overlay.open.value" docked size="lg" :title="title" :form="form">
774
+ ...
775
+ </KFormDrawer>
776
+ ```
777
+
778
+ - It needs a `DashboardLayout` or an `AppShell` around the page, and a shell width of at least 1280px. Otherwise (and on a phone) it is the normal overlay drawer, and it changes mode while it is open when the window is resized.
779
+ - The shell shows a dock on the right of the page as long as a docked drawer is mounted, also while it is closed: a page with a docked drawer shows the empty state of the dock ("Nothing selected", `dockEmptyTitle` and `dockEmptyDescription` of the layout), and a page without one shows no dock. The open drawer fills the dock.
780
+ - The dock has a resize handle on its left edge (min 22rem, max 48rem and at most 45% of the shell, double click resets to 30rem). The width goes to the preferences store under `dock:<dockStorageKey>` (default `k-dock`, `false` keeps it only in memory).
781
+ - `size` gives the width of the overlay mode only. A docked drawer of size `lg`, `xl` or `full` gets an expand button in the header (`expandLabel`, `collapseLabel`): it shows the same drawer as an overlay at its size, and the button, Escape or a click on the backdrop docks it again.
782
+ - A docked drawer is not modal: no backdrop, no scroll lock, focus stays where it was when it opens, and Escape closes it only when the focus is inside it (and no menu or nested dialog is open). The leave guard is the same: closing it, its trail and a navigation ask before they drop a dirty form.
783
+ - `useRouteRecord().openRecord(id)` asks the discard question when it replaces another open record (the user clicked another row with a dirty form). The default `beforeLeave` reads the topmost modal dialog, else the docked drawer. A discard accepted by a scope also answers the next question of the same scope in the same task, so a drawer that asks and then calls `openRecord()` asks once.
784
+ - Toasts move to the left of the dock.
785
+ - The body of every Drawer and Modal is a size container (`k-drawer`, `k-modal`), so put container queries on the content instead of viewport breakpoints: with Tailwind, `@sm:grid-cols-2` instead of `sm:grid-cols-2`. The header wraps its actions under the title when the panel is narrower than 40rem.
786
+
767
787
  - `size="fullscreen"` on a Modal fills the viewport edge to edge (no radius, no outer padding, safe area insets inside the panel) and never turns into a bottom sheet.
768
788
  - Overlays reset the field context: controls inside a Modal, Drawer, CommandPalette, menu, Popover or HoverCard panel do not inherit the id, description or invalid state of a `FormField` that contains the trigger. Call `provideFieldBoundary()` in your own overlay components to do the same.
769
789
 
770
790
  ### Deep links
771
791
 
772
- `useRouteRecord(key, options?)` is the record version of `useRouteState`. `#family/fam_1` opens a record and `#family/new` the create form (`newId`). Options: `find(id)` (gives `current`), `loaded` (while false, `loading` is true, so the drawer opens at once with its skeleton; when true and `find` gives nothing, the entry is removed), `canCreate`, `linkedKeys` (entries removed together with the record, such as a tab or a sub record), `beforeLeave` (a function that returns `true` or `false`, or a promise of it, called before a navigation would close the open record or show another one: the entry changes or is removed, or the path changes while it is open; `false` cancels the navigation, so the back button, a link or a row of another record ask the same discard question as the drawer; without it the leave guard of the topmost open dialog asks, see [Unsaved changes](#unsaved-changes)). It returns `param`, `id`, `isNew`, `current`, `loading`, `open` (for `v-model:open`), `openRecord(id | null, linked?)`, `close()` and `replaceId(id, linked?)` (after a create). All the entries change in one navigation. `close()`, `open = false`, `openRecord()` and `replaceId()` skip `beforeLeave` (they come after the drawer question or are on purpose). The guard is registered on mount, only in a component with a router.
792
+ `useRouteRecord(key, options?)` is the record version of `useRouteState`. `#family/fam_1` opens a record and `#family/new` the create form (`newId`). Options: `find(id)` (gives `current`), `loaded` (while false, `loading` is true, so the drawer opens at once with its skeleton; when true and `find` gives nothing, the entry is removed), `canCreate`, `linkedKeys` (entries removed together with the record, such as a tab or a sub record), `beforeLeave` (a function that returns `true` or `false`, or a promise of it, called before a navigation would close the open record or show another one: the entry changes or is removed, or the path changes while it is open; `false` cancels the navigation, so the back button, a link or a row of another record ask the same discard question as the drawer; without it the leave guard of the topmost open dialog asks, see [Unsaved changes](#unsaved-changes)). It returns `param`, `id`, `isNew`, `current`, `loading`, `open` (for `v-model:open`), `openRecord(id | null, linked?)`, `close()` and `replaceId(id, linked?)` (after a create). All the entries change in one navigation. `close()`, `open = false` and `replaceId()` skip `beforeLeave` (they come after the drawer question or are on purpose). `openRecord()` calls it only when it replaces another open record (a row click next to a [docked drawer](#docked-drawers)). The guard is registered on mount, only in a component with a router.
773
793
 
774
794
  ```ts
775
795
  const drawer = useTemplateRef<{ confirmDiscard: () => Promise<boolean> }>('drawer')
@@ -880,26 +900,27 @@ Ready defaults to start a dashboard project: an app frame, an auth frame and pag
880
900
  </KDashboardLayout>
881
901
  ```
882
902
 
883
- | Prop | Default | Notes |
884
- | ---------------------------------------------------------------------------------- | ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
885
- | `variant` | `'inset'` | `inset` (canvas sidebar, inset content panel), `sidebar` (bordered sidebar, full bleed content), `floating` (raised sidebar card on the canvas). |
886
- | `navigation` | | `NavItem[]` or `NavSection[]` (`{ label?, items }`). Items: `label`, `to`/`href`, `icon`, `badge`, `exact`, `active`, `external`, `disabled`, `children`. |
887
- | `currentPath` | router path | Active state is computed from the router (`$route`) with prefix matching (`/` and `exact` items match exactly). |
888
- | `brandName`, `brandSubtitle`, `brandIcon`, `brandLogo`, `brandShowName`, `brandTo` | `brandTo: '/'` | `brandLogo` takes an image URL, inline SVG markup or a component; the name is hidden next to a logo unless `brandShowName`. Or the `#brand` slot. `brandAlign` (`'start'` or `'center'`) centers the brand in the expanded sidebar, with the collapse button on the right. The collapse button uses the icons `sidebar-collapse` and `sidebar-expand` (chevrons by default), so `k.icons.aliases: { 'sidebar-collapse': 'lucide:panel-left-close', 'sidebar-expand': 'lucide:panel-left-open' }` changes only that button. |
889
- | `account` | | `{ name, email?, avatar?, role?, menu? }`. Shown as a row (avatar, name, email, chevron) at the bottom of the sidebar. |
890
- | `accountAction` | `'settings'` | `settings`: the row opens a `SettingsModal` (`settingsSections`, `settingsPresets`, `v-model:settings-open`, `v-model:settings-section`, `@sign-out`). `menu`: a DropdownMenu with `account.menu`, selections emit `account-select`. Or replace it with the `#account` slot. |
891
- | `settingsRoute`, `settingsResolvePage` | `false` | Sync the settings modal with the URL (`?settings=users/usr_123`): `true` uses the key `settings`, a string sets the key. `settingsRouteLocation: 'hash'` gives `#settings/users/usr_123`. `settingsAccountSection` renames the built-in account section. `settingsResolvePage(section, id, parents)` gives the label of a subpage restored from the URL. See SettingsModal. |
892
- | `settingsHideSession` | `false` | Hides the Session group (sign out) in the account section of the settings modal. The Sign out item in the nav stays. |
893
- | `breadcrumbs` | | Rendered in the desktop topbar. `#topbar` replaces them, `#actions` adds buttons on the right. |
894
- | `search` | `false` | `true` adds a CommandPalette with every navigation item, an array adds your own command groups, an async function `(query, signal) => CommandGroup<T>[]` searches on your server (item `data` reaches `#search-item` typed) (matching navigation items come first unless `searchNavigation` is `false`). `#search` replaces it. |
895
- | `searchProps` | | Options for the built-in CommandPalette: `minQueryLength`, `debounce`, `placeholder`, `label`, `emptyText` (a string or `(query) => string`), `minQueryText`, `errorText`, `loadingText`, `resultsText`, `notice`, `recentKey`, footer labels. Slots `#search-item`, `#search-empty`, `#search-group-label` and `#search-after-results` reach the palette. |
896
- | `themeSwitch` | `false` | `'sidebar'`, `'topbar'` or `false`. The default keeps the theme choice only in the Appearance section of the settings modal. With `accountAction="menu"` there is no settings modal, so set `'sidebar'` or `'topbar'`. |
897
- | `collapsible`, `v-model:collapsed`, `storageKey` | `true`, `'k-sidebar-collapsed'` | Icon rail on desktop. Saved in the [preferences store](#preferences) under `shell:<storageKey>`, and in a cookie under Nuxt (rendered on the server, no flash). `false` disables persistence. |
898
- | `shortcut` | `'mod+b'` | Toggles the rail on desktop and the drawer on mobile. `searchShortcut` defaults to `mod+k`. |
899
- | `v-model:open` | `false` | Mobile drawer (below 768px of shell width): scrim, focus moves into the drawer, the content is `inert`, Escape and the scrim close it and focus returns to the burger. |
900
- | `fluid`, `viewTransition` | `false`, `true` | Full width content; `view-transition-name` on sidebar and panel so page transitions keep the frame still. |
901
- | `fill` | `false` | Full height, full bleed content (the same as `content="bleed"`): no padding, gap or max width, and the content fills the panel (a page that is one DataGrid with `height="100%"`). Also on `AppShell`; in the `k-dashboard` layout per page with `definePageMeta({ fill: true })` or for every page with `dashboard.fill`. |
902
- | `content` | `'page'` | Content layout (`ShellContent`). `page`: max width (`--k-shell-content`, 72rem), padding, the panel scrolls. `fill`: full width and full height with the normal padding and gap; the panel never scrolls and the content is a flex column with `min-height: 0`, so a child with `flex: 1` (a `DataGrid` with `fill`, `Tabs` with `stretch`, a `.k-page` root) takes the rest of the height. `centered`: the same full height, with the width kept at `--k-shell-content` and centered. `bleed`: full width and height without padding or gap. `fill` (boolean) is an alias of `bleed` and `fluid` removes the max width of `page`; `content` wins over both. Also on `AppShell`; in the `k-dashboard` layout per page with `definePageMeta({ content: 'fill' })` (typed) or for every page with `dashboard.content` in the app config. |
903
+ | Prop | Default | Notes |
904
+ | ------------------------------------------------------------------------------------------ | ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
905
+ | `variant` | `'inset'` | `inset` (canvas sidebar, inset content panel), `sidebar` (bordered sidebar, full bleed content), `floating` (raised sidebar card on the canvas). |
906
+ | `navigation` | | `NavItem[]` or `NavSection[]` (`{ label?, items }`). Items: `label`, `to`/`href`, `icon`, `badge`, `exact`, `active`, `external`, `disabled`, `children`. |
907
+ | `currentPath` | router path | Active state is computed from the router (`$route`) with prefix matching (`/` and `exact` items match exactly). |
908
+ | `brandName`, `brandSubtitle`, `brandIcon`, `brandLogo`, `brandShowName`, `brandTo` | `brandTo: '/'` | `brandLogo` takes an image URL, inline SVG markup or a component; the name is hidden next to a logo unless `brandShowName`. Or the `#brand` slot. `brandAlign` (`'start'` or `'center'`) centers the brand in the expanded sidebar, with the collapse button on the right. The collapse button uses the icons `sidebar-collapse` and `sidebar-expand` (chevrons by default), so `k.icons.aliases: { 'sidebar-collapse': 'lucide:panel-left-close', 'sidebar-expand': 'lucide:panel-left-open' }` changes only that button. |
909
+ | `account` | | `{ name, email?, avatar?, role?, menu? }`. Shown as a row (avatar, name, email, chevron) at the bottom of the sidebar. |
910
+ | `accountAction` | `'settings'` | `settings`: the row opens a `SettingsModal` (`settingsSections`, `settingsPresets`, `v-model:settings-open`, `v-model:settings-section`, `@sign-out`). `menu`: a DropdownMenu with `account.menu`, selections emit `account-select`. Or replace it with the `#account` slot. |
911
+ | `settingsRoute`, `settingsResolvePage` | `false` | Sync the settings modal with the URL (`?settings=users/usr_123`): `true` uses the key `settings`, a string sets the key. `settingsRouteLocation: 'hash'` gives `#settings/users/usr_123`. `settingsAccountSection` renames the built-in account section. `settingsResolvePage(section, id, parents)` gives the label of a subpage restored from the URL. See SettingsModal. |
912
+ | `settingsHideSession` | `false` | Hides the Session group (sign out) in the account section of the settings modal. The Sign out item in the nav stays. |
913
+ | `breadcrumbs` | | Rendered in the desktop topbar. `#topbar` replaces them, `#actions` adds buttons on the right. |
914
+ | `search` | `false` | `true` adds a CommandPalette with every navigation item, an array adds your own command groups, an async function `(query, signal) => CommandGroup<T>[]` searches on your server (item `data` reaches `#search-item` typed) (matching navigation items come first unless `searchNavigation` is `false`). `#search` replaces it. |
915
+ | `searchProps` | | Options for the built-in CommandPalette: `minQueryLength`, `debounce`, `placeholder`, `label`, `emptyText` (a string or `(query) => string`), `minQueryText`, `errorText`, `loadingText`, `resultsText`, `notice`, `recentKey`, footer labels. Slots `#search-item`, `#search-empty`, `#search-group-label` and `#search-after-results` reach the palette. |
916
+ | `themeSwitch` | `false` | `'sidebar'`, `'topbar'` or `false`. The default keeps the theme choice only in the Appearance section of the settings modal. With `accountAction="menu"` there is no settings modal, so set `'sidebar'` or `'topbar'`. |
917
+ | `collapsible`, `v-model:collapsed`, `storageKey` | `true`, `'k-sidebar-collapsed'` | Icon rail on desktop. Saved in the [preferences store](#preferences) under `shell:<storageKey>`, and in a cookie under Nuxt (rendered on the server, no flash). `false` disables persistence. |
918
+ | `shortcut` | `'mod+b'` | Toggles the rail on desktop and the drawer on mobile. `searchShortcut` defaults to `mod+k`. |
919
+ | `v-model:open` | `false` | Mobile drawer (below 768px of shell width): scrim, focus moves into the drawer, the content is `inert`, Escape and the scrim close it and focus returns to the burger. |
920
+ | `dockStorageKey`, `dockLabel`, `dockEmptyTitle`, `dockEmptyDescription`, `dockResizeLabel` | `'k-dock'` | The dock of [docked drawers](#docked-drawers): the preference key of its width (`false` keeps it in memory), the label of the `aside`, the empty state and the label of the resize handle. Also on `AppShell` (no default key). |
921
+ | `fluid`, `viewTransition` | `false`, `true` | Full width content; `view-transition-name` on sidebar and panel so page transitions keep the frame still. |
922
+ | `fill` | `false` | Full height, full bleed content (the same as `content="bleed"`): no padding, gap or max width, and the content fills the panel (a page that is one DataGrid with `height="100%"`). Also on `AppShell`; in the `k-dashboard` layout per page with `definePageMeta({ fill: true })` or for every page with `dashboard.fill`. |
923
+ | `content` | `'page'` | Content layout (`ShellContent`). `page`: max width (`--k-shell-content`, 72rem), padding, the panel scrolls. `fill`: full width and full height with the normal padding and gap; the panel never scrolls and the content is a flex column with `min-height: 0`, so a child with `flex: 1` (a `DataGrid` with `fill`, `Tabs` with `stretch`, a `.k-page` root) takes the rest of the height. `centered`: the same full height, with the width kept at `--k-shell-content` and centered. `bleed`: full width and height without padding or gap. `fill` (boolean) is an alias of `bleed` and `fluid` removes the max width of `page`; `content` wins over both. Also on `AppShell`; in the `k-dashboard` layout per page with `definePageMeta({ content: 'fill' })` (typed) or for every page with `dashboard.content` in the app config. |
903
924
 
904
925
  Slots: `brand`, `search`, `sidebar-top` (under the search, for example a workspace select), `sidebar` (replaces the navigation), `sidebar-footer`, `account`, `topbar-brand`, `topbar`, `actions`, default, plus `settings-section-<id>`, `settings-actions-<id>`, `settings-tabs-<id>`, `settings-nav-footer`, `settings-account-start` and `settings-account-fields`, forwarded to the SettingsModal. The exposed `openSettings(id?)` opens it on a section. Landmarks: skip link, `aside` and `nav` with labels, `main` with an id, `aria-current="page"` on the active link. `SidebarNav` (layout group) renders the same navigation data inside your own `Sidebar`.
905
926
 
@@ -92,6 +92,33 @@
92
92
  </div>
93
93
  </main>
94
94
  </div>
95
+ <aside
96
+ class="k-shell-dock"
97
+ :style="{ '--k-shell-dock-width': `${dockSize}px` }"
98
+ :aria-label="dockText"
99
+ >
100
+ <ResizeHandle
101
+ v-model="dockWidth"
102
+ class="k-shell-dock-handle"
103
+ target="after"
104
+ :min="DOCK_WIDTH.min"
105
+ :max="dockMax"
106
+ :label="dockResizeText"
107
+ :on-reset="resetDock"
108
+ @resize-start="dockResizing = true"
109
+ @resize-end="endDockResize"
110
+ />
111
+ <div ref="dockFrameRef" class="k-shell-dock-frame">
112
+ <EmptyState
113
+ class="k-shell-dock-empty"
114
+ icon="cursor-arrow-rays"
115
+ variant="plain"
116
+ :title="dockEmptyTitleText"
117
+ :description="dockEmptyDescriptionText"
118
+ />
119
+ <div ref="dockSlot" class="k-shell-dock-slot" />
120
+ </div>
121
+ </aside>
95
122
  <slot name="overlays" />
96
123
  </div>
97
124
  </template>
@@ -101,6 +128,7 @@ import { useResizeObserver } from "../../internal/core/resize";
101
128
  import {
102
129
  computed,
103
130
  nextTick,
131
+ onBeforeUnmount,
104
132
  onMounted,
105
133
  provide,
106
134
  ref,
@@ -114,9 +142,13 @@ import { useLocale } from "../../composables/useLocale";
114
142
  import { SHELL_KEY } from "../../internal/layout/keys";
115
143
  import { usePersistedBoolean } from "../../internal/layout/persist";
116
144
  import Button from "../core/Button.vue";
145
+ import EmptyState from "../feedback/EmptyState.vue";
117
146
  import Skeleton from "../feedback/Skeleton.vue";
118
147
  import SkeletonList from "../feedback/SkeletonList.vue";
148
+ import ResizeHandle from "./ResizeHandle.vue";
119
149
  import { focusFirst } from "../../internal/core/focus";
150
+ import { DOCK_BREAKPOINT, DOCK_KEY, DOCK_WIDTH, dockFrame } from "../../internal/overlays/dock";
151
+ import { PREFERENCE_KEYS, usePreference } from "../../composables/usePreferences";
120
152
  const props = defineProps({
121
153
  variant: { type: String, required: false, default: "inset" },
122
154
  sidebarLabel: { type: String, required: false },
@@ -131,7 +163,12 @@ const props = defineProps({
131
163
  shortcut: { type: [String, Boolean], required: false, default: false },
132
164
  viewTransition: { type: Boolean, required: false },
133
165
  loading: { type: Boolean, required: false },
134
- loadingLabel: { type: String, required: false }
166
+ loadingLabel: { type: String, required: false },
167
+ dockStorageKey: { type: [String, Boolean], required: false },
168
+ dockLabel: { type: String, required: false },
169
+ dockEmptyTitle: { type: String, required: false },
170
+ dockEmptyDescription: { type: String, required: false },
171
+ dockResizeLabel: { type: String, required: false }
135
172
  });
136
173
  const contentMode = computed(() => props.content ?? (props.fill ? "bleed" : "page"));
137
174
  const { t } = useLocale();
@@ -140,12 +177,19 @@ const closeText = computed(() => props.closeLabel ?? t("shell.closeNavigation"))
140
177
  const menuText = computed(() => props.menuLabel ?? t("shell.openNavigation"));
141
178
  const skipText = computed(() => props.skipLabel ?? t("shell.skipToContent"));
142
179
  const loadingText = computed(() => props.loadingLabel ?? t("shell.loadingPage"));
180
+ const dockText = computed(() => props.dockLabel ?? t("dock.label"));
181
+ const dockEmptyTitleText = computed(() => props.dockEmptyTitle ?? t("dock.emptyTitle"));
182
+ const dockEmptyDescriptionText = computed(
183
+ () => props.dockEmptyDescription ?? t("dock.emptyDescription")
184
+ );
185
+ const dockResizeText = computed(() => props.dockResizeLabel ?? t("dock.resize"));
143
186
  const collapsedModel = defineModel("collapsed", { type: Boolean, ...{ default: false } });
144
187
  const open = defineModel("open", { type: Boolean, ...{ default: false } });
145
188
  const MOBILE_BREAKPOINT = 768;
146
189
  const slots = useSlots();
147
190
  const collapsed = usePersistedBoolean(collapsedModel.value, props.storageKey);
148
191
  const mobile = ref(false);
192
+ const shellWidth = ref(0);
149
193
  const drawer = computed(() => open.value && mobile.value);
150
194
  watch(collapsedModel, (value) => collapsed.value = value);
151
195
  watch(
@@ -193,6 +237,7 @@ useHotkey(() => props.shortcut ? [props.shortcut] : [], toggle, {
193
237
  allowInInputs: false
194
238
  });
195
239
  function measure(width) {
240
+ shellWidth.value = width;
196
241
  mobile.value = width > 0 && width < MOBILE_BREAKPOINT;
197
242
  if (!mobile.value && open.value) open.value = false;
198
243
  }
@@ -209,6 +254,49 @@ watch(open, (value) => {
209
254
  if (!value) return;
210
255
  nextTick(() => focusFirst(sidebar.value, { preventScroll: true }));
211
256
  });
257
+ const dockSlot = useTemplateRef("dockSlot");
258
+ const dockFrameRef = useTemplateRef("dockFrameRef");
259
+ const dockWide = computed(() => shellWidth.value >= DOCK_BREAKPOINT);
260
+ const dockPreference = props.dockStorageKey ? usePreference(PREFERENCE_KEYS.dock(props.dockStorageKey), DOCK_WIDTH.initial, {
261
+ validate: (value) => typeof value === "number" && value > 0
262
+ }) : ref(DOCK_WIDTH.initial);
263
+ const dockWidth = ref(dockPreference.value);
264
+ const dockResizing = ref(false);
265
+ const dockMax = computed(
266
+ () => Math.max(
267
+ DOCK_WIDTH.min,
268
+ Math.min(DOCK_WIDTH.max, Math.round(shellWidth.value * DOCK_WIDTH.share) || DOCK_WIDTH.max)
269
+ )
270
+ );
271
+ const dockSize = computed(() => Math.min(Math.max(dockWidth.value, DOCK_WIDTH.min), dockMax.value));
272
+ watch(dockPreference, (value) => {
273
+ if (!dockResizing.value && value !== dockWidth.value) dockWidth.value = value;
274
+ });
275
+ function persistDock() {
276
+ if (dockResizing.value || dockPreference.value === dockWidth.value) return;
277
+ dockPreference.value = dockWidth.value;
278
+ }
279
+ watch(dockWidth, persistDock);
280
+ function endDockResize() {
281
+ dockResizing.value = false;
282
+ persistDock();
283
+ }
284
+ function resetDock() {
285
+ dockWidth.value = DOCK_WIDTH.initial;
286
+ }
287
+ useResizeObserver(
288
+ () => [dockFrameRef.value],
289
+ ([entry]) => {
290
+ const frame = dockFrameRef.value;
291
+ if (!entry || !frame) return;
292
+ if (entry.contentRect.width > 0) dockFrame.value = frame;
293
+ else if (dockFrame.value === frame) dockFrame.value = null;
294
+ }
295
+ );
296
+ onBeforeUnmount(() => {
297
+ if (dockFrame.value && dockFrame.value === dockFrameRef.value) dockFrame.value = null;
298
+ });
299
+ provide(DOCK_KEY, { target: dockSlot, wide: dockWide });
212
300
  provide(SHELL_KEY, {
213
301
  sidebarId,
214
302
  collapsed,
@@ -15,7 +15,7 @@ declare var __VLS_8: {
15
15
  openNav: typeof openNav;
16
16
  mobile: boolean;
17
17
  collapsed: boolean;
18
- }, __VLS_19: {}, __VLS_36: {}, __VLS_38: {};
18
+ }, __VLS_19: {}, __VLS_36: {}, __VLS_52: {};
19
19
  type __VLS_Slots = {} & {
20
20
  sidebar?: (props: typeof __VLS_8) => any;
21
21
  } & {
@@ -25,7 +25,7 @@ type __VLS_Slots = {} & {
25
25
  } & {
26
26
  default?: (props: typeof __VLS_36) => any;
27
27
  } & {
28
- overlays?: (props: typeof __VLS_38) => any;
28
+ overlays?: (props: typeof __VLS_52) => any;
29
29
  };
30
30
  declare const __VLS_base: import("vue").DefineComponent<{
31
31
  variant?: AppShellVariant;
@@ -42,6 +42,11 @@ declare const __VLS_base: import("vue").DefineComponent<{
42
42
  viewTransition?: boolean;
43
43
  loading?: boolean;
44
44
  loadingLabel?: string;
45
+ dockStorageKey?: string | false;
46
+ dockLabel?: string;
47
+ dockEmptyTitle?: string;
48
+ dockEmptyDescription?: string;
49
+ dockResizeLabel?: string;
45
50
  collapsed?: boolean;
46
51
  open?: boolean;
47
52
  key?: PropertyKey | undefined;
@@ -259,6 +264,11 @@ declare const __VLS_base: import("vue").DefineComponent<{
259
264
  viewTransition?: boolean;
260
265
  loading?: boolean;
261
266
  loadingLabel?: string;
267
+ dockStorageKey?: string | false;
268
+ dockLabel?: string;
269
+ dockEmptyTitle?: string;
270
+ dockEmptyDescription?: string;
271
+ dockResizeLabel?: string;
262
272
  collapsed?: boolean;
263
273
  open?: boolean;
264
274
  key?: PropertyKey | undefined;
@@ -23,6 +23,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
23
23
  prefix?: "k-modal" | "k-drawer" | undefined;
24
24
  fill?: boolean;
25
25
  size?: import("./types.ts").ModalSize;
26
+ dock?: boolean;
26
27
  tabs?: import("../layout/types.ts").TabItem[];
27
28
  label?: string;
28
29
  style?: import("vue").StyleValue;
@@ -237,6 +238,9 @@ declare const __VLS_base: import("vue").DefineComponent<{
237
238
  backLabel?: string;
238
239
  guardTitle?: string;
239
240
  guardMessage?: string;
241
+ expandable?: boolean;
242
+ expandLabel?: string;
243
+ collapseLabel?: string;
240
244
  onOpen?: (() => any) | undefined;
241
245
  "onUpdate:tab"?: ((value: string | number | undefined) => any) | undefined;
242
246
  closedby?: import("../../index.ts").DialogClosedBy;
@@ -264,6 +268,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
264
268
  prefix?: "k-modal" | "k-drawer" | undefined;
265
269
  fill?: boolean;
266
270
  size?: import("./types.ts").ModalSize;
271
+ dock?: boolean;
267
272
  tabs?: import("../layout/types.ts").TabItem[];
268
273
  label?: string;
269
274
  style?: import("vue").StyleValue;
@@ -478,6 +483,9 @@ declare const __VLS_base: import("vue").DefineComponent<{
478
483
  backLabel?: string;
479
484
  guardTitle?: string;
480
485
  guardMessage?: string;
486
+ expandable?: boolean;
487
+ expandLabel?: string;
488
+ collapseLabel?: string;
481
489
  onOpen?: (() => any) | undefined;
482
490
  "onUpdate:tab"?: ((value: string | number | undefined) => any) | undefined;
483
491
  closedby?: import("../../index.ts").DialogClosedBy;
@@ -13,6 +13,7 @@ declare const __VLS_export: import("vue").DefineComponent<Partial<NonNullable<{
13
13
  readonly prefix?: "k-modal" | "k-drawer" | undefined;
14
14
  readonly fill?: boolean | undefined;
15
15
  readonly size?: import("./types.ts").ModalSize | undefined;
16
+ readonly dock?: boolean | undefined;
16
17
  readonly tabs?: import("../layout/types.ts").TabItem[] | undefined;
17
18
  readonly label?: string | undefined;
18
19
  readonly style?: import("vue").StyleValue;
@@ -227,6 +228,9 @@ declare const __VLS_export: import("vue").DefineComponent<Partial<NonNullable<{
227
228
  readonly backLabel?: string | undefined;
228
229
  readonly guardTitle?: string | undefined;
229
230
  readonly guardMessage?: string | undefined;
231
+ readonly expandable?: boolean | undefined;
232
+ readonly expandLabel?: string | undefined;
233
+ readonly collapseLabel?: string | undefined;
230
234
  readonly onOpen?: (() => any) | undefined;
231
235
  readonly "onUpdate:tab"?: ((value: string | number | undefined) => any) | undefined;
232
236
  readonly closedby?: import("../../index.ts").DialogClosedBy | undefined;
@@ -250,6 +254,7 @@ declare const __VLS_export: import("vue").DefineComponent<Partial<NonNullable<{
250
254
  readonly prefix?: "k-modal" | "k-drawer" | undefined;
251
255
  readonly fill?: boolean | undefined;
252
256
  readonly size?: import("./types.ts").ModalSize | undefined;
257
+ readonly dock?: boolean | undefined;
253
258
  readonly tabs?: import("../layout/types.ts").TabItem[] | undefined;
254
259
  readonly label?: string | undefined;
255
260
  readonly style?: import("vue").StyleValue;
@@ -464,6 +469,9 @@ declare const __VLS_export: import("vue").DefineComponent<Partial<NonNullable<{
464
469
  readonly backLabel?: string | undefined;
465
470
  readonly guardTitle?: string | undefined;
466
471
  readonly guardMessage?: string | undefined;
472
+ readonly expandable?: boolean | undefined;
473
+ readonly expandLabel?: string | undefined;
474
+ readonly collapseLabel?: string | undefined;
467
475
  readonly onOpen?: (() => any) | undefined;
468
476
  readonly "onUpdate:tab"?: ((value: string | number | undefined) => any) | undefined;
469
477
  readonly closedby?: import("../../index.ts").DialogClosedBy | undefined;
@@ -20,6 +20,10 @@
20
20
  :tabs="tabs"
21
21
  :trail="trail"
22
22
  :back-label="backLabel"
23
+ :dock="docked && side === 'right'"
24
+ :expandable="EXPANDABLE_SIZES.includes(size)"
25
+ :expand-label="expandLabel"
26
+ :collapse-label="collapseLabel"
23
27
  v-model:tab="tab"
24
28
  @navigate="(index) => emit('navigate', index)"
25
29
  @open="emit('open')"
@@ -53,8 +57,12 @@ defineProps({
53
57
  backLabel: { type: String, required: false },
54
58
  guard: { type: Boolean, required: false, default: true },
55
59
  guardTitle: { type: String, required: false },
56
- guardMessage: { type: String, required: false }
60
+ guardMessage: { type: String, required: false },
61
+ docked: { type: Boolean, required: false },
62
+ expandLabel: { type: String, required: false },
63
+ collapseLabel: { type: String, required: false }
57
64
  });
65
+ const EXPANDABLE_SIZES = ["lg", "xl", "full"];
58
66
  const slots = defineSlots();
59
67
  const slotNames = () => Object.keys(slots);
60
68
  const emit = defineEmits(["open", "close", "afterLeave", "navigate"]);
@@ -21,10 +21,14 @@ declare const __VLS_base: import("vue").DefineComponent<{
21
21
  guard?: boolean;
22
22
  guardTitle?: string;
23
23
  guardMessage?: string;
24
+ docked?: boolean;
25
+ expandLabel?: string;
26
+ collapseLabel?: string;
24
27
  open?: boolean | undefined;
25
28
  tab?: TabItem["value"];
26
29
  key?: PropertyKey | undefined;
27
30
  prefix?: "k-modal" | "k-drawer" | undefined;
31
+ dock?: boolean;
28
32
  style?: import("vue").StyleValue;
29
33
  results?: (string | number) | undefined;
30
34
  placeholder?: string | undefined;
@@ -222,6 +226,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
222
226
  onVnodeUnmounted?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
223
227
  onCancel?: ((payload: Event) => void) | undefined;
224
228
  rootClass?: unknown;
229
+ expandable?: boolean;
225
230
  closedby?: import("../../index.ts").DialogClosedBy;
226
231
  }, {
227
232
  close: () => Promise<boolean>;
@@ -254,10 +259,14 @@ declare const __VLS_base: import("vue").DefineComponent<{
254
259
  guard?: boolean;
255
260
  guardTitle?: string;
256
261
  guardMessage?: string;
262
+ docked?: boolean;
263
+ expandLabel?: string;
264
+ collapseLabel?: string;
257
265
  open?: boolean | undefined;
258
266
  tab?: TabItem["value"];
259
267
  key?: PropertyKey | undefined;
260
268
  prefix?: "k-modal" | "k-drawer" | undefined;
269
+ dock?: boolean;
261
270
  style?: import("vue").StyleValue;
262
271
  results?: (string | number) | undefined;
263
272
  placeholder?: string | undefined;
@@ -455,6 +464,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
455
464
  onVnodeUnmounted?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
456
465
  onCancel?: ((payload: Event) => void) | undefined;
457
466
  rootClass?: unknown;
467
+ expandable?: boolean;
458
468
  closedby?: import("../../index.ts").DialogClosedBy;
459
469
  }> & Readonly<{
460
470
  onClose?: (() => any) | undefined;
@@ -28,6 +28,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
28
28
  tab?: TabItem["value"];
29
29
  key?: PropertyKey | undefined;
30
30
  prefix?: "k-modal" | "k-drawer" | undefined;
31
+ dock?: boolean;
31
32
  style?: import("vue").StyleValue;
32
33
  results?: (string | number) | undefined;
33
34
  placeholder?: string | undefined;
@@ -225,6 +226,9 @@ declare const __VLS_base: import("vue").DefineComponent<{
225
226
  onVnodeUnmounted?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
226
227
  onCancel?: ((payload: Event) => void) | undefined;
227
228
  rootClass?: unknown;
229
+ expandable?: boolean;
230
+ expandLabel?: string;
231
+ collapseLabel?: string;
228
232
  closedby?: import("../../index.ts").DialogClosedBy;
229
233
  }, {
230
234
  close: () => Promise<boolean>;
@@ -264,6 +268,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
264
268
  tab?: TabItem["value"];
265
269
  key?: PropertyKey | undefined;
266
270
  prefix?: "k-modal" | "k-drawer" | undefined;
271
+ dock?: boolean;
267
272
  style?: import("vue").StyleValue;
268
273
  results?: (string | number) | undefined;
269
274
  placeholder?: string | undefined;
@@ -461,6 +466,9 @@ declare const __VLS_base: import("vue").DefineComponent<{
461
466
  onVnodeUnmounted?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
462
467
  onCancel?: ((payload: Event) => void) | undefined;
463
468
  rootClass?: unknown;
469
+ expandable?: boolean;
470
+ expandLabel?: string;
471
+ collapseLabel?: string;
464
472
  closedby?: import("../../index.ts").DialogClosedBy;
465
473
  }> & Readonly<{
466
474
  onClose?: (() => any) | undefined;
@@ -115,6 +115,7 @@ import { toastList } from "../../internal/overlays/toast";
115
115
  import { isPopoverOpen, supportsPopover } from "../../internal/floating/support";
116
116
  import { spokenToneKey, toneIcons } from "../../internal/core/tone";
117
117
  import { modalStack } from "../../internal/overlays/dialog";
118
+ import { dockFrame } from "../../internal/overlays/dock";
118
119
  import { useHostClaim } from "../../internal/overlays/host";
119
120
  import { useToasterAvoidance } from "../../internal/overlays/avoid";
120
121
  import { LIVE_DELAY } from "../../internal/core/live";
@@ -149,7 +150,7 @@ const heights = reactive(/* @__PURE__ */ new Map());
149
150
  const mounted = ref(false);
150
151
  const outlet = computed(() => modalStack[modalStack.length - 1] ?? null);
151
152
  const avoidance = useToasterAvoidance({
152
- outlet: () => outlet.value,
153
+ outlet: () => outlet.value ?? dockFrame.value,
153
154
  toaster: toasterRef,
154
155
  position: () => props.position
155
156
  });
@@ -18,6 +18,11 @@
18
18
  :view-transition="viewTransition"
19
19
  :loading="loading"
20
20
  :loading-label="loadingLabel"
21
+ :dock-storage-key="dockStorageKey"
22
+ :dock-label="dockLabel"
23
+ :dock-empty-title="dockEmptyTitle"
24
+ :dock-empty-description="dockEmptyDescription"
25
+ :dock-resize-label="dockResizeLabel"
21
26
  >
22
27
  <template #sidebar="{ collapsed: isCollapsed }">
23
28
  <Sidebar
@@ -238,7 +243,12 @@ const props = defineProps({
238
243
  collapseLabel: { type: String, required: false },
239
244
  closeLabel: { type: String, required: false },
240
245
  accountLabel: { type: String, required: false },
241
- themeLabel: { type: String, required: false }
246
+ themeLabel: { type: String, required: false },
247
+ dockStorageKey: { type: [String, Boolean], required: false, default: "k-dock" },
248
+ dockLabel: { type: String, required: false },
249
+ dockEmptyTitle: { type: String, required: false },
250
+ dockEmptyDescription: { type: String, required: false },
251
+ dockResizeLabel: { type: String, required: false }
242
252
  });
243
253
  const emit = defineEmits(["accountSelect"]);
244
254
  const slots = defineSlots();
@@ -55,6 +55,11 @@ declare const __VLS_export: <T = unknown>(__VLS_props: NonNullable<Awaited<typeo
55
55
  closeLabel?: string;
56
56
  accountLabel?: string;
57
57
  themeLabel?: string;
58
+ dockStorageKey?: string | false;
59
+ dockLabel?: string;
60
+ dockEmptyTitle?: string;
61
+ dockEmptyDescription?: string;
62
+ dockResizeLabel?: string;
58
63
  } & {
59
64
  collapsed?: boolean;
60
65
  open?: boolean;
@@ -81,6 +86,11 @@ declare const __VLS_export: <T = unknown>(__VLS_props: NonNullable<Awaited<typeo
81
86
  readonly viewTransition?: boolean | undefined;
82
87
  readonly loading?: boolean | undefined;
83
88
  readonly loadingLabel?: string | undefined;
89
+ readonly dockStorageKey?: string | false | undefined;
90
+ readonly dockLabel?: string | undefined;
91
+ readonly dockEmptyTitle?: string | undefined;
92
+ readonly dockEmptyDescription?: string | undefined;
93
+ readonly dockResizeLabel?: string | undefined;
84
94
  readonly collapsed?: boolean | undefined;
85
95
  readonly open?: boolean | undefined;
86
96
  readonly key?: PropertyKey | undefined;