@xleddyl/443-components-vue 0.16.76 → 0.16.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CATALOG.md +22 -21
- package/README.md +3 -1
- package/dist/components/layout/AppShell.vue +23 -3
- package/dist/components/layout/AppShell.vue.d.ts +9 -3
- package/dist/components/templates/DashboardLayout.vue +8 -0
- package/dist/components/templates/DashboardLayout.vue.d.ts +5 -0
- package/dist/locale/de.mjs +2 -1
- package/dist/locale/en.mjs +2 -1
- package/dist/locale/it.mjs +2 -1
- package/dist/locale/types.d.ts +1 -0
- package/dist/nuxt/module.mjs +7 -2
- package/dist/nuxt/runtime/dashboard.d.ts +1 -0
- package/dist/nuxt/runtime/dashboard.mjs +3 -0
- package/dist/nuxt/runtime/layouts/dashboard.vue +3 -1
- package/dist/nuxt/runtime/navigation.d.ts +2 -0
- package/dist/nuxt/runtime/navigation.mjs +35 -0
- package/dist/styles/forms/checkbox.css +4 -1
- package/dist/styles/forms/radio.css +4 -1
- package/dist/styles/layout/app-shell.css +20 -0
- package/package.json +1 -1
package/CATALOG.md
CHANGED
|
@@ -231,25 +231,25 @@ Mount `OverlayHost` once for the imperative hooks (see [Composables](#composable
|
|
|
231
231
|
|
|
232
232
|
## Layout
|
|
233
233
|
|
|
234
|
-
| Component | Purpose and when to use it | Main props, models, slots, events
|
|
235
|
-
| ---------------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
236
|
-
| `Card` | Container with optional title, description, icon, actions and footer. Can be a link or a selectable button. | Props: `title`, `description`, `icon`, `variant` (raised, outline, subtle), `padding`, `as`, `to`, `href`, `selected`, `disabled`, `animated`. Slots: default, `header`, `title`, `description`, `icon`, `actions`, `footer`.
|
|
237
|
-
| `PageHeader` | Page title with description, breadcrumbs, badge and actions. The page templates include it. | Props: `title`, `description`, `icon`, `breadcrumbs`, `level`, `bordered`, `align`, `truncate`. Slots: `actions`, `badge`, `description`, `title`, `icon`, `breadcrumbs`.
|
|
238
|
-
| `Breadcrumbs` | Path navigation. | Props: `items` (`label`, `to`, `href`, `icon`), `separator`, `linkLast`, `ancestors`, `size` (`md`, `lg` for a title sized trail). Slot: `item`.
|
|
239
|
-
| `Stepper` | Step indicator for wizards and multi step flows (import, checkout). Horizontal or vertical, compact on narrow widths. | Model: `v-model` (current step value). Props: `steps` (`value`, `label`, `description`, `icon`, `disabled`, `state`: `complete` or `error`), `label`, `orientation`, `size`, `linear` (only completed and current steps clickable), `readonly`, `compact` (`'auto'` by default, `true`, `false`), `summary` (false hides the compact "Step 2 of 4" line), `positionLabel`, `completeLabel`, `errorLabel`. Event: `select`.
|
|
240
|
-
| `Tabs` | Tabs with panels, badges and dots. Segmented or underline. | Model: `v-model` (active value). Props: `items` (`value`, `label`, `icon`, `color` (a palette name or hex, a dot before the label), `badge`, `badgeTone`, `dot`, `title` (a tooltip on hover and focus, also on a disabled tab; native `title` until mount), `disabled`), `variant`, `size`, `lazy`, `fill`, `stretch`, `inset`, `controls` (id of a panel outside the component: only the tab list renders). Slots: `panel-<value>`, `panel`.
|
|
241
|
-
| `Accordion` | Collapsible sections. | Model: `v-model` (open value or values). Props: `items` (`value`, `title`, `description`, `content`, `icon`), `multiple`, `collapsible`, `variant`. Slots: default, `title`.
|
|
242
|
-
| `Separator` | Divider, labelled divider, or section heading with description and actions. | Props: `orientation`, `variant` (label, heading), `label`, `description`, `align`, `level`, `lines` (default `true`; `false` hides the lines of either variant). Slots: default, `description`, `actions`.
|
|
243
|
-
| `Stack` | Flex row or column with gap. | Props: `direction`, `gap` (none to xl), `align`, `justify`, `wrap`, `responsive`, `as`.
|
|
244
|
-
| `Grid` | Responsive CSS grid. | Props: `columns` (number or breakpoints), `minItemWidth` (auto fit), `gap`, `as`.
|
|
245
|
-
| `Toolbar` | Group of controls with arrow key navigation (ARIA toolbar). | Props: `label`, `orientation`, `roving`, `bordered`.
|
|
246
|
-
| `CopyButton` | Button that copies a value and shows "copied". | Props: `value`, `label`, `copiedLabel`, `showLabel`, `size`, `variant`, `tone`, `resetAfter`. Event: `copy(success)`.
|
|
247
|
-
| `ThemeSwitch` | Light, dark and system switch. | Props: `variant` (segmented, icon), `size`, `showLabels`.
|
|
248
|
-
| `NavLink` | One navigation link with icon, badge and active state. | Props: `label`, `to`, `href`, `icon`, `badge`, `active`, `match` (exact, prefix), `external`, `disabled`. Slots: default, `icon`.
|
|
249
|
-
| `AppShell` | App frame: sidebar, topbar, mobile menu, collapse, skip link. Use it for a custom frame. Use `DashboardLayout` for the ready one. | Models: `v-model:collapsed`, `v-model:open`. Props: `variant` (inset, sidebar, floating), `content` (`page`, `fill`, `centered`, `bleed`), `fluid`, `fill`, `topbar`, `storageKey` (collapsed state in the preferences store), `shortcut`. Slots: default, `sidebar`, `topbar`, `overlays
|
|
250
|
-
| `Sidebar` | Sidebar content with header, collapse button and footer. Goes in the `sidebar` slot of `AppShell`. | Props: `label`, `collapsible`, `collapseLabel`, `brandAlign` (`start`, `center`). Icons `sidebar-collapse` and `sidebar-expand` for the collapse button. Slots: default, `header`, `top`, `footer`.
|
|
251
|
-
| `SidebarNav` | Navigation list from data, with groups and children. | Props: `items` (`NavItem[]` or `NavSection[]`: `label`, `to`, `icon`, `badge`, `children`), `currentPath`.
|
|
252
|
-
| `SidebarSection` | Labelled block inside a sidebar for hand written links. | Prop: `label`. Slot: default.
|
|
234
|
+
| Component | Purpose and when to use it | Main props, models, slots, events | Playground |
|
|
235
|
+
| ---------------- | --------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------- |
|
|
236
|
+
| `Card` | Container with optional title, description, icon, actions and footer. Can be a link or a selectable button. | Props: `title`, `description`, `icon`, `variant` (raised, outline, subtle), `padding`, `as`, `to`, `href`, `selected`, `disabled`, `animated`. Slots: default, `header`, `title`, `description`, `icon`, `actions`, `footer`. | `layout/card.vue` |
|
|
237
|
+
| `PageHeader` | Page title with description, breadcrumbs, badge and actions. The page templates include it. | Props: `title`, `description`, `icon`, `breadcrumbs`, `level`, `bordered`, `align`, `truncate`. Slots: `actions`, `badge`, `description`, `title`, `icon`, `breadcrumbs`. | `layout/page-header.vue` |
|
|
238
|
+
| `Breadcrumbs` | Path navigation. | Props: `items` (`label`, `to`, `href`, `icon`), `separator`, `linkLast`, `ancestors`, `size` (`md`, `lg` for a title sized trail). Slot: `item`. | `layout/breadcrumbs.vue` |
|
|
239
|
+
| `Stepper` | Step indicator for wizards and multi step flows (import, checkout). Horizontal or vertical, compact on narrow widths. | Model: `v-model` (current step value). Props: `steps` (`value`, `label`, `description`, `icon`, `disabled`, `state`: `complete` or `error`), `label`, `orientation`, `size`, `linear` (only completed and current steps clickable), `readonly`, `compact` (`'auto'` by default, `true`, `false`), `summary` (false hides the compact "Step 2 of 4" line), `positionLabel`, `completeLabel`, `errorLabel`. Event: `select`. | `layout/stepper.vue` |
|
|
240
|
+
| `Tabs` | Tabs with panels, badges and dots. Segmented or underline. | Model: `v-model` (active value). Props: `items` (`value`, `label`, `icon`, `color` (a palette name or hex, a dot before the label), `badge`, `badgeTone`, `dot`, `title` (a tooltip on hover and focus, also on a disabled tab; native `title` until mount), `disabled`), `variant`, `size`, `lazy`, `fill`, `stretch`, `inset`, `controls` (id of a panel outside the component: only the tab list renders). Slots: `panel-<value>`, `panel`. | `layout/tabs.vue` |
|
|
241
|
+
| `Accordion` | Collapsible sections. | Model: `v-model` (open value or values). Props: `items` (`value`, `title`, `description`, `content`, `icon`), `multiple`, `collapsible`, `variant`. Slots: default, `title`. | `layout/accordion.vue` |
|
|
242
|
+
| `Separator` | Divider, labelled divider, or section heading with description and actions. | Props: `orientation`, `variant` (label, heading), `label`, `description`, `align`, `level`, `lines` (default `true`; `false` hides the lines of either variant). Slots: default, `description`, `actions`. | `layout/separator.vue` |
|
|
243
|
+
| `Stack` | Flex row or column with gap. | Props: `direction`, `gap` (none to xl), `align`, `justify`, `wrap`, `responsive`, `as`. | `layout/stack.vue` |
|
|
244
|
+
| `Grid` | Responsive CSS grid. | Props: `columns` (number or breakpoints), `minItemWidth` (auto fit), `gap`, `as`. | `layout/grid.vue` |
|
|
245
|
+
| `Toolbar` | Group of controls with arrow key navigation (ARIA toolbar). | Props: `label`, `orientation`, `roving`, `bordered`. | `layout/toolbar.vue` |
|
|
246
|
+
| `CopyButton` | Button that copies a value and shows "copied". | Props: `value`, `label`, `copiedLabel`, `showLabel`, `size`, `variant`, `tone`, `resetAfter`. Event: `copy(success)`. | `layout/copy-button.vue` |
|
|
247
|
+
| `ThemeSwitch` | Light, dark and system switch. | Props: `variant` (segmented, icon), `size`, `showLabels`. | `layout/theme-switch.vue` |
|
|
248
|
+
| `NavLink` | One navigation link with icon, badge and active state. | Props: `label`, `to`, `href`, `icon`, `badge`, `active`, `match` (exact, prefix), `external`, `disabled`. Slots: default, `icon`. | `layout/nav-link.vue` |
|
|
249
|
+
| `AppShell` | App frame: sidebar, topbar, mobile menu, collapse, skip link. Use it for a custom frame. Use `DashboardLayout` for the ready one. | Models: `v-model:collapsed`, `v-model:open`. Props: `variant` (inset, sidebar, floating), `content` (`page`, `fill`, `centered`, `bleed`), `fluid`, `fill`, `topbar`, `storageKey` (collapsed state in the preferences store), `shortcut`, `loading` (hides the page content and shows a page skeleton, `aria-busy` on `main`), `loadingLabel`. Slots: default, `sidebar`, `topbar`, `overlays`, `loading` (replaces the default page skeleton). | `layout/app-shell.vue` |
|
|
250
|
+
| `Sidebar` | Sidebar content with header, collapse button and footer. Goes in the `sidebar` slot of `AppShell`. | Props: `label`, `collapsible`, `collapseLabel`, `brandAlign` (`start`, `center`). Icons `sidebar-collapse` and `sidebar-expand` for the collapse button. Slots: default, `header`, `top`, `footer`. | `layout/app-shell.vue` |
|
|
251
|
+
| `SidebarNav` | Navigation list from data, with groups and children. | Props: `items` (`NavItem[]` or `NavSection[]`: `label`, `to`, `icon`, `badge`, `children`), `currentPath`. | `layout/app-shell.vue` |
|
|
252
|
+
| `SidebarSection` | Labelled block inside a sidebar for hand written links. | Prop: `label`. Slot: default. | `layout/app-shell.vue` |
|
|
253
253
|
|
|
254
254
|
## Feedback
|
|
255
255
|
|
|
@@ -271,7 +271,7 @@ Templates combine core parts into whole pages and layouts. Start from them for n
|
|
|
271
271
|
|
|
272
272
|
| Component | Purpose and when to use it | Main props, models, slots, events | Playground |
|
|
273
273
|
| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- |
|
|
274
|
-
| `DashboardLayout` | Ready app frame: brand, navigation, command search, account menu, settings modal, breadcrumbs, theme switch. Put it in `layouts/default.vue`. | Models: `v-model:collapsed`, `v-model:open`, `v-model:settingsOpen`, `v-model:settingsSection`. Props: `navigation` (`NavItem[]` or `NavSection[]`), `account` (`name`, `email`, `avatar`, `role`, `menu`), `brandName`, `brandIcon`, `brandLogo`, `breadcrumbs`, `search` (true, groups or function), `settingsSections`, `settingsRoute`, `settingsRouteLocation`, `settingsAccountSection`, `settingsResolvePage`, `settingsHideSession`, `variant`, `content` (`page`, `fill`, `centered`, `bleed`; per page with `definePageMeta({ content })` in `k-dashboard`), `fluid`, `fill`, `onSignOut`. Slots: default, `actions`, `brand`, `sidebar-top`, `sidebar`, `sidebar-footer`, `account`, `topbar`, `search-item`, `settings-account-start`, `settings-account-fields`, `settings-section-<id>`, `settings-actions-<id>`, `settings-tabs-<id>`, `settings-nav-footer`. Event: `accountSelect`.
|
|
274
|
+
| `DashboardLayout` | Ready app frame: brand, navigation, command search, account menu, settings modal, breadcrumbs, theme switch. Put it in `layouts/default.vue`. | Models: `v-model:collapsed`, `v-model:open`, `v-model:settingsOpen`, `v-model:settingsSection`. Props: `navigation` (`NavItem[]` or `NavSection[]`), `account` (`name`, `email`, `avatar`, `role`, `menu`), `brandName`, `brandIcon`, `brandLogo`, `breadcrumbs`, `search` (true, groups or function), `settingsSections`, `settingsRoute`, `settingsRouteLocation`, `settingsAccountSection`, `settingsResolvePage`, `settingsHideSession`, `variant`, `content` (`page`, `fill`, `centered`, `bleed`; per page with `definePageMeta({ content })` in `k-dashboard`), `fluid`, `fill`, `loading` (page skeleton while a navigation is pending: bind `useNavigationPending()` in Nuxt), `loadingLabel`, `onSignOut`. Slots: default, `loading`, `actions`, `brand`, `sidebar-top`, `sidebar`, `sidebar-footer`, `account`, `topbar`, `search-item`, `settings-account-start`, `settings-account-fields`, `settings-section-<id>`, `settings-actions-<id>`, `settings-tabs-<id>`, `settings-nav-footer`. Event: `accountSelect`. | `templates/dashboard-layout.vue` |
|
|
275
275
|
| `AuthLayout` | Frame of sign in, sign up and reset password pages: left column with brand, title (or a large breadcrumb), form and footer; aside panel on the right from 960px. | Props: `title`, `description`, `breadcrumbs`, `footer`, `brandName`, `brandIcon`, `brandLogo`, `aside`, `asideTitle`, `asideDescription`, `themeSwitch`. Slots: default, `links`, `footer`, `brand`, `aside`, `corner`. | `templates/auth-layout.vue` |
|
|
276
276
|
| `AuthLogin` | Complete sign in page in two steps (email, then password with a breadcrumb back). Offers to sign in again after `AuthLogout`. | Props: `submit` (`{ email, password }`), `submitError`, `title`, `description`, `emailLabel`, `emailPlaceholder`, `passwordLabel`, `submitLabel`, `stepKey`, `reasonKey`, frame props of `AuthLayout`. Slots: `links` (`{ email, step }`), `footer`, `brand`, `aside`, `corner`. | `templates/auth-login.vue` |
|
|
277
277
|
| `AuthLogout` | Sign out page: runs `logout()`, remembers the account, reloads the sign in page. Retry on error. | Props: `logout`, `account` (`{ email, name }`), `loginTo`, `reasonKey`, frame props of `AuthLayout`. Slots: `footer`, `brand`, `aside`, `corner`. Helpers: `rememberSignedOutAccount`, `takeSignedOutAccount`, `SIGNED_OUT_REASON`. | `templates/auth-login.vue` |
|
|
@@ -293,7 +293,7 @@ Templates combine core parts into whole pages and layouts. Start from them for n
|
|
|
293
293
|
| `Brand` | Logo and name block (image URL, inline SVG or component). | Props: `name`, `subtitle`, `icon`, `logo`, `to`, `size`, `accent`, `hideText`, `showName`. Slots: default, `logo`, `mark`, `subtitle`. | `templates/dashboard-layout.vue` |
|
|
294
294
|
| `AccountMenu` | Account button with avatar, name and a dropdown menu. Used by `DashboardLayout`. | Props: `name`, `email`, `avatar`, `menu` (menu items), `placement`, `icon`. Event: `select`. | `templates/dashboard-layout.vue` |
|
|
295
295
|
|
|
296
|
-
Nuxt ready layouts: with `k: { layouts: true }` the module registers the layouts `k-dashboard` and `k-auth`. They read brand, navigation, account and settings from `app.config.ts` (`k` key). `useDashboard()` gives the runtime account, breadcrumbs and badges for `k-dashboard`. See README, section "Nuxt: ready layouts".
|
|
296
|
+
Nuxt ready layouts: with `k: { layouts: true }` the module registers the layouts `k-dashboard` and `k-auth`. They read brand, navigation, account and settings from `app.config.ts` (`k` key). `useDashboard()` gives the runtime account, breadcrumbs and badges for `k-dashboard`. `useNavigationPending()` is `true` from the start of a navigation to another path until the new page has rendered; the module waits two frames at the start so the skeleton paints first, and `k-dashboard` binds it to `loading`. See README, section "Nuxt: ready layouts".
|
|
297
297
|
|
|
298
298
|
## Grid (group `grid`)
|
|
299
299
|
|
|
@@ -370,6 +370,7 @@ All are exported from `@xleddyl/443-components-vue` and auto-imported in Nuxt.
|
|
|
370
370
|
| `useIcons` helpers, `createIcons`, `provideIcons` | Register your own icons by name. | Nuxt: option `k.icons: { dir: '~/assets/icons' }`. | `components/core/icon.vue` |
|
|
371
371
|
| `useLinkComponent`, `createLinkComponent` | Use the router link (for example `NuxtLink`) for every `to` prop. | The Nuxt module does it for you. | - |
|
|
372
372
|
| `useDashboard` (Nuxt only) | Runtime account, breadcrumbs and badges for the `k-dashboard` layout. | Auto-imported by the module. | `layouts/` of the playground |
|
|
373
|
+
| `useNavigationPending` (Nuxt only) | `true` while a navigation to another path renders the new page. Bind it to `loading` of `DashboardLayout` or `AppShell`. | Auto-imported by the module. | `layouts/` of the playground |
|
|
373
374
|
|
|
374
375
|
## Before you build your own
|
|
375
376
|
|
package/README.md
CHANGED
|
@@ -474,7 +474,7 @@ async function switchView() {
|
|
|
474
474
|
| editor | RichTextEditor |
|
|
475
475
|
| chart | ChartPanel, ChartLegend, LineChart, BarChart, DoughnutChart |
|
|
476
476
|
|
|
477
|
-
Composables: `useTheme`, `usePreset`, `useForm`, `useField`, `useFieldControl`, `useToast` (and `toast`), `useConfirm`, `useAlert`, `usePrompt`, `useModal`, `useDrawer`, `useOverlay`, `useModalContext`, `useLoading` (and `withLoading`), `useLoadingState`, `useHotkey`, `useCopy`, `useFileDrop` (with `readDroppedFiles`), `useSortable`, `usePasswordStrength`, `useTableSort`, `useAppShell`, `useRouteState`, `useRouteRecord`, `usePageCommands`, `usePreference` (with `usePreferences`, `createPreferences`, `providePreferences`), `useScrollLock`, `useLeaveGuard` (with `useLeaveScope`, `provideLeaveScope`), `useDirtyGuard`, `useIcons` helpers and `useLinkComponent`, `provideFieldBoundary`, `provideAuxiliaryControls`, `provideForm`, `provideGridConfig` (with `createGridConfig`, `useGridConfig`), `useLocale`. With the Nuxt module also `useDashboard()` (runtime account, breadcrumbs and badges for the `k-dashboard` layout).
|
|
477
|
+
Composables: `useTheme`, `usePreset`, `useForm`, `useField`, `useFieldControl`, `useToast` (and `toast`), `useConfirm`, `useAlert`, `usePrompt`, `useModal`, `useDrawer`, `useOverlay`, `useModalContext`, `useLoading` (and `withLoading`), `useLoadingState`, `useHotkey`, `useCopy`, `useFileDrop` (with `readDroppedFiles`), `useSortable`, `usePasswordStrength`, `useTableSort`, `useAppShell`, `useRouteState`, `useRouteRecord`, `usePageCommands`, `usePreference` (with `usePreferences`, `createPreferences`, `providePreferences`), `useScrollLock`, `useLeaveGuard` (with `useLeaveScope`, `provideLeaveScope`), `useDirtyGuard`, `useIcons` helpers and `useLinkComponent`, `provideFieldBoundary`, `provideAuxiliaryControls`, `provideForm`, `provideGridConfig` (with `createGridConfig`, `useGridConfig`), `useLocale`. With the Nuxt module also `useDashboard()` (runtime account, breadcrumbs and badges for the `k-dashboard` layout) and `useNavigationPending()` (`true` while a navigation to another path renders the new page).
|
|
478
478
|
|
|
479
479
|
### Buttons and tooltips
|
|
480
480
|
|
|
@@ -919,6 +919,8 @@ The account row opens the SettingsModal (`account.action: 'menu'` with `account.
|
|
|
919
919
|
|
|
920
920
|
Pages pick them with `definePageMeta({ layout: 'k-dashboard', title: 'Items' })` or `layout: 'k-auth'` (the auth frame shows `title` and `description` from the page meta). Both layouts set the document title from `meta.title` and the brand name (`Items · Acme`; a page's own `useHead({ title })` wins) and announce route changes through a polite live region, unless the app already renders `<NuxtRouteAnnouncer />`. Breadcrumbs come from `meta.breadcrumbs`, otherwise from the matching navigation item (plus `meta.title` on deeper pages). At runtime `useDashboard().value = { account, breadcrumbs, badges: { '/items': 12 } }` overrides the account, the breadcrumbs and the badges. Set it in route middleware (`definePageMeta({ middleware })`) or a plugin, not in the page `setup`: the layout renders the sidebar and breadcrumbs before the page, so a value set during the page render would differ between the server HTML and hydration.
|
|
921
921
|
|
|
922
|
+
When a link goes to another path, the old page stays on screen until the new page has rendered (Vue renders it in one synchronous pass, or waits for its async setup). The module plugin `k:navigation` sets `useNavigationPending()` at the start of the navigation and waits two animation frames, so `k-dashboard` hides the old page and paints a page skeleton (the `loading` prop of `DashboardLayout`) before the new page renders. It ends when the new page has rendered, or at `page:finish` for a page that suspends. Hash and query changes on the same path keep the page. In your own layout, bind it yourself: `<KDashboardLayout :loading="useNavigationPending().value">`, and replace the skeleton with the `loading` slot.
|
|
923
|
+
|
|
922
924
|
### Starter
|
|
923
925
|
|
|
924
926
|
The playground ships a small app built only from these pieces, typechecked and built with it: [`playground/nuxt/app/pages/starter`](../../playground/nuxt/app/pages/starter) (`index.vue` dashboard, `login.vue` auth, `settings.vue`, `items/index.vue`, `items/[id].vue`, `items/new.vue`, `projects.vue` first run), [`app.config.ts`](../../playground/nuxt/app/app.config.ts) and [`error.vue`](../../playground/nuxt/app/error.vue). To start a project copy those files and set:
|
|
@@ -62,17 +62,32 @@
|
|
|
62
62
|
/>
|
|
63
63
|
<slot name="topbar" :open-nav="openNav" :mobile="mobile" :collapsed="collapsed" />
|
|
64
64
|
</header>
|
|
65
|
-
<main
|
|
65
|
+
<main
|
|
66
|
+
:id="mainId"
|
|
67
|
+
class="k-shell-main"
|
|
68
|
+
tabindex="-1"
|
|
69
|
+
:aria-busy="loading ? 'true' : void 0"
|
|
70
|
+
>
|
|
66
71
|
<div
|
|
67
72
|
class="k-shell-content"
|
|
68
73
|
:class="[
|
|
69
74
|
`k-shell-content-${contentMode}`,
|
|
70
75
|
{
|
|
71
76
|
'is-fluid': fluid && contentMode === 'page',
|
|
72
|
-
'is-fill': contentMode === 'bleed'
|
|
77
|
+
'is-fill': contentMode === 'bleed',
|
|
78
|
+
'is-loading': loading
|
|
73
79
|
}
|
|
74
80
|
]"
|
|
75
81
|
>
|
|
82
|
+
<div v-if="loading" class="k-shell-loading" role="status" :aria-label="loadingText">
|
|
83
|
+
<slot name="loading">
|
|
84
|
+
<div class="k-shell-loading-header">
|
|
85
|
+
<Skeleton width="16rem" height="1.75rem" />
|
|
86
|
+
<Skeleton width="28rem" height="1rem" />
|
|
87
|
+
</div>
|
|
88
|
+
<SkeletonList :rows="8" />
|
|
89
|
+
</slot>
|
|
90
|
+
</div>
|
|
76
91
|
<slot />
|
|
77
92
|
</div>
|
|
78
93
|
</main>
|
|
@@ -99,6 +114,8 @@ import { useLocale } from "../../composables/useLocale";
|
|
|
99
114
|
import { SHELL_KEY } from "../../internal/layout/keys";
|
|
100
115
|
import { usePersistedBoolean } from "../../internal/layout/persist";
|
|
101
116
|
import Button from "../core/Button.vue";
|
|
117
|
+
import Skeleton from "../feedback/Skeleton.vue";
|
|
118
|
+
import SkeletonList from "../feedback/SkeletonList.vue";
|
|
102
119
|
import { focusFirst } from "../../internal/core/focus";
|
|
103
120
|
const props = defineProps({
|
|
104
121
|
variant: { type: String, required: false, default: "inset" },
|
|
@@ -112,7 +129,9 @@ const props = defineProps({
|
|
|
112
129
|
topbar: { type: Boolean, required: false, default: void 0 },
|
|
113
130
|
storageKey: { type: [String, Boolean], required: false },
|
|
114
131
|
shortcut: { type: [String, Boolean], required: false, default: false },
|
|
115
|
-
viewTransition: { type: Boolean, required: false }
|
|
132
|
+
viewTransition: { type: Boolean, required: false },
|
|
133
|
+
loading: { type: Boolean, required: false },
|
|
134
|
+
loadingLabel: { type: String, required: false }
|
|
116
135
|
});
|
|
117
136
|
const contentMode = computed(() => props.content ?? (props.fill ? "bleed" : "page"));
|
|
118
137
|
const { t } = useLocale();
|
|
@@ -120,6 +139,7 @@ const sidebarText = computed(() => props.sidebarLabel ?? t("shell.navigation"));
|
|
|
120
139
|
const closeText = computed(() => props.closeLabel ?? t("shell.closeNavigation"));
|
|
121
140
|
const menuText = computed(() => props.menuLabel ?? t("shell.openNavigation"));
|
|
122
141
|
const skipText = computed(() => props.skipLabel ?? t("shell.skipToContent"));
|
|
142
|
+
const loadingText = computed(() => props.loadingLabel ?? t("shell.loadingPage"));
|
|
123
143
|
const collapsedModel = defineModel("collapsed", { type: Boolean, ...{ default: false } });
|
|
124
144
|
const open = defineModel("open", { type: Boolean, ...{ default: false } });
|
|
125
145
|
const MOBILE_BREAKPOINT = 768;
|
|
@@ -15,15 +15,17 @@ declare var __VLS_8: {
|
|
|
15
15
|
openNav: typeof openNav;
|
|
16
16
|
mobile: boolean;
|
|
17
17
|
collapsed: boolean;
|
|
18
|
-
}, __VLS_19: {},
|
|
18
|
+
}, __VLS_19: {}, __VLS_36: {}, __VLS_38: {};
|
|
19
19
|
type __VLS_Slots = {} & {
|
|
20
20
|
sidebar?: (props: typeof __VLS_8) => any;
|
|
21
21
|
} & {
|
|
22
22
|
topbar?: (props: typeof __VLS_17) => any;
|
|
23
23
|
} & {
|
|
24
|
-
|
|
24
|
+
loading?: (props: typeof __VLS_19) => any;
|
|
25
25
|
} & {
|
|
26
|
-
|
|
26
|
+
default?: (props: typeof __VLS_36) => any;
|
|
27
|
+
} & {
|
|
28
|
+
overlays?: (props: typeof __VLS_38) => any;
|
|
27
29
|
};
|
|
28
30
|
declare const __VLS_base: import("vue").DefineComponent<{
|
|
29
31
|
variant?: AppShellVariant;
|
|
@@ -38,6 +40,8 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
38
40
|
storageKey?: string | false;
|
|
39
41
|
shortcut?: string | false;
|
|
40
42
|
viewTransition?: boolean;
|
|
43
|
+
loading?: boolean;
|
|
44
|
+
loadingLabel?: string;
|
|
41
45
|
collapsed?: boolean;
|
|
42
46
|
open?: boolean;
|
|
43
47
|
key?: PropertyKey | undefined;
|
|
@@ -253,6 +257,8 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
253
257
|
storageKey?: string | false;
|
|
254
258
|
shortcut?: string | false;
|
|
255
259
|
viewTransition?: boolean;
|
|
260
|
+
loading?: boolean;
|
|
261
|
+
loadingLabel?: string;
|
|
256
262
|
collapsed?: boolean;
|
|
257
263
|
open?: boolean;
|
|
258
264
|
key?: PropertyKey | undefined;
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
:storage-key="storageKey || void 0"
|
|
17
17
|
:shortcut="shortcut"
|
|
18
18
|
:view-transition="viewTransition"
|
|
19
|
+
:loading="loading"
|
|
20
|
+
:loading-label="loadingLabel"
|
|
19
21
|
>
|
|
20
22
|
<template #sidebar="{ collapsed: isCollapsed }">
|
|
21
23
|
<Sidebar
|
|
@@ -135,6 +137,10 @@
|
|
|
135
137
|
</div>
|
|
136
138
|
</template>
|
|
137
139
|
|
|
140
|
+
<template v-if="slots.loading" #loading>
|
|
141
|
+
<slot name="loading" />
|
|
142
|
+
</template>
|
|
143
|
+
|
|
138
144
|
<slot />
|
|
139
145
|
|
|
140
146
|
<template v-if="hasSettings" #overlays>
|
|
@@ -223,6 +229,8 @@ const props = defineProps({
|
|
|
223
229
|
fill: { type: Boolean, required: false },
|
|
224
230
|
content: { type: String, required: false },
|
|
225
231
|
viewTransition: { type: Boolean, required: false, default: true },
|
|
232
|
+
loading: { type: Boolean, required: false },
|
|
233
|
+
loadingLabel: { type: String, required: false },
|
|
226
234
|
navLabel: { type: String, required: false },
|
|
227
235
|
sidebarLabel: { type: String, required: false },
|
|
228
236
|
menuLabel: { type: String, required: false },
|
|
@@ -45,6 +45,8 @@ declare const __VLS_export: <T = unknown>(__VLS_props: NonNullable<Awaited<typeo
|
|
|
45
45
|
fill?: boolean;
|
|
46
46
|
content?: ShellContent;
|
|
47
47
|
viewTransition?: boolean;
|
|
48
|
+
loading?: boolean;
|
|
49
|
+
loadingLabel?: string;
|
|
48
50
|
navLabel?: string;
|
|
49
51
|
sidebarLabel?: string;
|
|
50
52
|
menuLabel?: string;
|
|
@@ -77,6 +79,8 @@ declare const __VLS_export: <T = unknown>(__VLS_props: NonNullable<Awaited<typeo
|
|
|
77
79
|
readonly storageKey?: string | false | undefined;
|
|
78
80
|
readonly shortcut?: string | false | undefined;
|
|
79
81
|
readonly viewTransition?: boolean | undefined;
|
|
82
|
+
readonly loading?: boolean | undefined;
|
|
83
|
+
readonly loadingLabel?: string | undefined;
|
|
80
84
|
readonly collapsed?: boolean | undefined;
|
|
81
85
|
readonly open?: boolean | undefined;
|
|
82
86
|
readonly key?: PropertyKey | undefined;
|
|
@@ -286,6 +290,7 @@ declare const __VLS_export: <T = unknown>(__VLS_props: NonNullable<Awaited<typeo
|
|
|
286
290
|
attrs: any;
|
|
287
291
|
slots: {
|
|
288
292
|
default?: () => unknown;
|
|
293
|
+
loading?: () => unknown;
|
|
289
294
|
brand?: (props: {
|
|
290
295
|
collapsed: boolean;
|
|
291
296
|
}) => unknown;
|
package/dist/locale/de.mjs
CHANGED
|
@@ -389,7 +389,8 @@ export const de = {
|
|
|
389
389
|
skipToContent: "Zum Inhalt springen",
|
|
390
390
|
main: "Hauptnavigation",
|
|
391
391
|
closeNavigation: "Navigation schlie\xDFen",
|
|
392
|
-
navigation: "Navigation"
|
|
392
|
+
navigation: "Navigation",
|
|
393
|
+
loadingPage: "Seite wird geladen"
|
|
393
394
|
},
|
|
394
395
|
stat: {
|
|
395
396
|
increased: "Gestiegen um",
|
package/dist/locale/en.mjs
CHANGED
|
@@ -389,7 +389,8 @@ export const en = {
|
|
|
389
389
|
skipToContent: "Skip to content",
|
|
390
390
|
main: "Primary",
|
|
391
391
|
closeNavigation: "Close navigation",
|
|
392
|
-
navigation: "Navigation"
|
|
392
|
+
navigation: "Navigation",
|
|
393
|
+
loadingPage: "Loading page"
|
|
393
394
|
},
|
|
394
395
|
stat: {
|
|
395
396
|
increased: "Increased by",
|
package/dist/locale/it.mjs
CHANGED
|
@@ -389,7 +389,8 @@ export const it = {
|
|
|
389
389
|
skipToContent: "Vai al contenuto",
|
|
390
390
|
main: "Principale",
|
|
391
391
|
closeNavigation: "Chiudi navigazione",
|
|
392
|
-
navigation: "Navigazione"
|
|
392
|
+
navigation: "Navigazione",
|
|
393
|
+
loadingPage: "Caricamento pagina"
|
|
393
394
|
},
|
|
394
395
|
stat: {
|
|
395
396
|
increased: "Aumento di",
|
package/dist/locale/types.d.ts
CHANGED
package/dist/nuxt/module.mjs
CHANGED
|
@@ -128,9 +128,14 @@ export default defineNuxtModule({
|
|
|
128
128
|
addPlugin(resolver.resolve("./runtime/storage"));
|
|
129
129
|
addPlugin(resolver.resolve("./runtime/locale"));
|
|
130
130
|
addPlugin(resolver.resolve("./runtime/route-state"));
|
|
131
|
+
addPlugin(resolver.resolve("./runtime/navigation"));
|
|
131
132
|
if (typeof options.grid === "object") addPlugin(resolver.resolve("./runtime/grid"));
|
|
132
|
-
if (options.composables)
|
|
133
|
-
addImports(
|
|
133
|
+
if (options.composables) {
|
|
134
|
+
addImports([
|
|
135
|
+
{ name: "useDashboard", from: resolver.resolve("./runtime/dashboard") },
|
|
136
|
+
{ name: "useNavigationPending", from: resolver.resolve("./runtime/dashboard") }
|
|
137
|
+
]);
|
|
138
|
+
}
|
|
134
139
|
const layouts = resolveLayouts(options.layouts);
|
|
135
140
|
if (layouts.length) {
|
|
136
141
|
addTypeTemplate({
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
:storage-key="dashboard.storageKey"
|
|
23
23
|
:fluid="dashboard.fluid"
|
|
24
24
|
:content="content"
|
|
25
|
+
:loading="navigationPending"
|
|
25
26
|
>
|
|
26
27
|
<slot />
|
|
27
28
|
</DashboardLayout>
|
|
@@ -39,10 +40,11 @@ import DashboardLayout from "../../../components/templates/DashboardLayout.vue";
|
|
|
39
40
|
import { useLayoutHead } from "../layout-head";
|
|
40
41
|
import RouteAnnouncer from "../RouteAnnouncer.vue";
|
|
41
42
|
import { navBreadcrumbs, navTarget, toNavSections } from "../../../internal/layout/navigation";
|
|
42
|
-
import { useDashboard } from "../dashboard";
|
|
43
|
+
import { useDashboard, useNavigationPending } from "../dashboard";
|
|
43
44
|
const appConfig = useAppConfig();
|
|
44
45
|
const route = useRoute();
|
|
45
46
|
const state = useDashboard();
|
|
47
|
+
const navigationPending = useNavigationPending();
|
|
46
48
|
const config = computed(() => appConfig.k ?? {});
|
|
47
49
|
const brand = computed(() => config.value.brand ?? {});
|
|
48
50
|
useLayoutHead(() => brand.value.name);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { defineNuxtPlugin, useRouter } from "nuxt/app";
|
|
2
|
+
import { nextTick } from "vue";
|
|
3
|
+
import { useNavigationPending } from "./dashboard.mjs";
|
|
4
|
+
function nextFrame() {
|
|
5
|
+
return new Promise((resolve) => requestAnimationFrame(() => resolve()));
|
|
6
|
+
}
|
|
7
|
+
export default defineNuxtPlugin({
|
|
8
|
+
name: "k:navigation",
|
|
9
|
+
setup(nuxtApp) {
|
|
10
|
+
if (import.meta.server) return;
|
|
11
|
+
const pending = useNavigationPending();
|
|
12
|
+
const router = useRouter();
|
|
13
|
+
let suspended = false;
|
|
14
|
+
const done = () => {
|
|
15
|
+
suspended = false;
|
|
16
|
+
pending.value = false;
|
|
17
|
+
};
|
|
18
|
+
nuxtApp.hook("page:start", () => {
|
|
19
|
+
if (pending.value) suspended = true;
|
|
20
|
+
});
|
|
21
|
+
nuxtApp.hook("page:finish", done);
|
|
22
|
+
router.beforeEach(async (to, from) => {
|
|
23
|
+
if (nuxtApp.isHydrating || pending.value || to.path === from.path) return;
|
|
24
|
+
pending.value = true;
|
|
25
|
+
await nextFrame();
|
|
26
|
+
await nextFrame();
|
|
27
|
+
});
|
|
28
|
+
router.afterEach(async (_to, _from, failure) => {
|
|
29
|
+
if (failure) return done();
|
|
30
|
+
await nextTick();
|
|
31
|
+
if (!suspended) done();
|
|
32
|
+
});
|
|
33
|
+
router.onError(done);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
@@ -28,11 +28,14 @@
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
.k-checkbox-input:disabled + .k-checkbox-box {
|
|
31
|
-
background: var(--k-subtle);
|
|
32
31
|
box-shadow: none;
|
|
33
32
|
opacity: 0.6;
|
|
34
33
|
}
|
|
35
34
|
|
|
35
|
+
.k-checkbox-input:disabled:not(:checked, :indeterminate) + .k-checkbox-box {
|
|
36
|
+
background: var(--k-subtle);
|
|
37
|
+
}
|
|
38
|
+
|
|
36
39
|
.k-checkbox.is-readonly {
|
|
37
40
|
cursor: default;
|
|
38
41
|
}
|
|
@@ -31,11 +31,14 @@
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
.k-radio-input:disabled + .k-radio-dot {
|
|
34
|
-
background: var(--k-subtle);
|
|
35
34
|
box-shadow: none;
|
|
36
35
|
opacity: 0.6;
|
|
37
36
|
}
|
|
38
37
|
|
|
38
|
+
.k-radio-input:disabled:not(:checked) + .k-radio-dot {
|
|
39
|
+
background: var(--k-subtle);
|
|
40
|
+
}
|
|
41
|
+
|
|
39
42
|
.k-radio-icon {
|
|
40
43
|
--k-icon-size: 1rem;
|
|
41
44
|
margin-top: calc((1lh - 1rem) / 2);
|
|
@@ -114,6 +114,26 @@ html.k-root body {
|
|
|
114
114
|
max-width: none;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
.k-shell-content.is-loading > :not(.k-shell-loading) {
|
|
118
|
+
display: none !important;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.k-shell-loading {
|
|
122
|
+
display: flex;
|
|
123
|
+
flex-direction: column;
|
|
124
|
+
gap: 1.5rem;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.k-shell-content.is-fill > .k-shell-loading {
|
|
128
|
+
padding: var(--k-shell-padding, 1.5rem 1.75rem 1.75rem);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.k-shell-loading-header {
|
|
132
|
+
display: flex;
|
|
133
|
+
flex-direction: column;
|
|
134
|
+
gap: 0.5rem;
|
|
135
|
+
}
|
|
136
|
+
|
|
117
137
|
.k-shell.is-fill .k-shell-main {
|
|
118
138
|
min-height: 0;
|
|
119
139
|
}
|
package/package.json
CHANGED