vlite3 1.5.12 → 1.5.14
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/README.md +20 -8
- package/components/Accordion/AccordionContent.vue.js +2 -2
- package/components/CommandPalette/CommandPaletteContent2.vue.js +1 -1
- package/components/CommandPalette/{CommandPaletteItem2.vue.js → CommandPaletteItem.vue.js} +1 -1
- package/components/Form/AccordionView2.vue.js +1 -1
- package/components/Form/Form.vue.js +2 -2
- package/components/NavbarCommandPalette.vue.js +1 -1
- package/components/PanZoomViewport/PanZoomViewport.vue.d.ts +7 -7
- package/components/PanZoomViewport/PanZoomViewport.vue.js +1 -1
- package/components/Tabes/Tabes.vue.js +2 -2
- package/docs/README.md +16 -0
- package/docs/component-index.md +313 -0
- package/docs/components/accordion.md +52 -0
- package/docs/components/alert.md +34 -0
- package/docs/components/app-shell.md +371 -0
- package/docs/components/async-select.md +264 -0
- package/docs/components/attachments-list.md +231 -0
- package/docs/components/avatar-group.md +74 -0
- package/docs/components/avatar-uploader.md +61 -0
- package/docs/components/avatar.md +28 -0
- package/docs/components/badge.md +81 -0
- package/docs/components/barcode.md +42 -0
- package/docs/components/beacon.md +29 -0
- package/docs/components/breadcrumb.md +317 -0
- package/docs/components/button-group.md +35 -0
- package/docs/components/button.md +86 -0
- package/docs/components/calendar.md +95 -0
- package/docs/components/carousel.md +122 -0
- package/docs/components/cart.md +533 -0
- package/docs/components/category-manager.md +269 -0
- package/docs/components/category-menu.md +251 -0
- package/docs/components/charts.md +1456 -0
- package/docs/components/chat.md +330 -0
- package/docs/components/checkbox.md +31 -0
- package/docs/components/chip.md +137 -0
- package/docs/components/choice-box.md +40 -0
- package/docs/components/clipboard.md +105 -0
- package/docs/components/clock.md +70 -0
- package/docs/components/color-picker.md +82 -0
- package/docs/components/command-palette.md +214 -0
- package/docs/components/comment-thread.md +171 -0
- package/docs/components/confirmation-modal.md +50 -0
- package/docs/components/custom-fields-display.md +94 -0
- package/docs/components/custom-fields.md +97 -0
- package/docs/components/data-list.md +93 -0
- package/docs/components/data-table.md +922 -0
- package/docs/components/date-picker.md +58 -0
- package/docs/components/date-range-picker.md +24 -0
- package/docs/components/date-time.md +104 -0
- package/docs/components/dropdown.md +740 -0
- package/docs/components/empty.md +100 -0
- package/docs/components/export-data.md +320 -0
- package/docs/components/file-picker.md +83 -0
- package/docs/components/file-preview.md +42 -0
- package/docs/components/file-tree.md +144 -0
- package/docs/components/footer.md +251 -0
- package/docs/components/forms.md +776 -0
- package/docs/components/gantt-chart.md +767 -0
- package/docs/components/google-login.md +67 -0
- package/docs/components/google-map.md +128 -0
- package/docs/components/heatmap.md +80 -0
- package/docs/components/icon-picker.md +58 -0
- package/docs/components/icon.md +176 -0
- package/docs/components/image-comparison.md +51 -0
- package/docs/components/image-magnifier.md +26 -0
- package/docs/components/import-data.md +521 -0
- package/docs/components/input.md +58 -0
- package/docs/components/invoice.md +339 -0
- package/docs/components/kanban.md +302 -0
- package/docs/components/label.md +25 -0
- package/docs/components/list.md +419 -0
- package/docs/components/masonry.md +55 -0
- package/docs/components/modal.md +133 -0
- package/docs/components/multi-select.md +54 -0
- package/docs/components/navbar.md +403 -0
- package/docs/components/number-input.md +41 -0
- package/docs/components/otp-input.md +68 -0
- package/docs/components/pagination.md +83 -0
- package/docs/components/pan-zoom-viewport.md +245 -0
- package/docs/components/permission-editor.md +322 -0
- package/docs/components/persona.md +56 -0
- package/docs/components/price.md +106 -0
- package/docs/components/pricing-plan.md +68 -0
- package/docs/components/progress-bar.md +53 -0
- package/docs/components/qr-code.md +59 -0
- package/docs/components/rating.md +59 -0
- package/docs/components/rich-text-editor.md +210 -0
- package/docs/components/scale-generator.md +101 -0
- package/docs/components/screen.md +208 -0
- package/docs/components/seo-provider.md +189 -0
- package/docs/components/side-panel.md +94 -0
- package/docs/components/sidebar-menu.md +422 -0
- package/docs/components/skeleton.md +115 -0
- package/docs/components/slider.md +48 -0
- package/docs/components/spinner.md +27 -0
- package/docs/components/splitter.md +97 -0
- package/docs/components/stats.md +234 -0
- package/docs/components/status-chip.md +232 -0
- package/docs/components/switch.md +23 -0
- package/docs/components/tabs.md +335 -0
- package/docs/components/tag-input.md +55 -0
- package/docs/components/textarea.md +31 -0
- package/docs/components/theme-provider.md +130 -0
- package/docs/components/theme-toggle.md +36 -0
- package/docs/components/thumbnail-selector.md +186 -0
- package/docs/components/timeline.md +225 -0
- package/docs/components/toast-notification.md +89 -0
- package/docs/components/tooltip.md +31 -0
- package/docs/components/workbook.md +102 -0
- package/docs/composables/use-theme.md +59 -0
- package/docs/getting-started/setup.md +176 -0
- package/docs/guides/draggable.md +211 -0
- package/docs/guides/internationalization.md +281 -0
- package/docs/guides/performance.md +118 -0
- package/docs/guides/testing-forms.md +154 -0
- package/docs/guides/testing-overlays.md +131 -0
- package/docs/guides/theming.md +124 -0
- package/docs/utilities/search.md +580 -0
- package/docs/utilities/utilities.md +371 -0
- package/docs-manifest.json +336 -0
- package/package.json +5 -13
- package/scripts/generate-docs-manifest.js +207 -0
- package/scripts/sync-docs.js +754 -0
- package/style.css +1 -1
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
# Screen
|
|
2
|
+
|
|
3
|
+
**Import:** `import { Screen } from 'vlite3'`
|
|
4
|
+
|
|
5
|
+
### Description
|
|
6
|
+
|
|
7
|
+
`Screen` is a high-level smart wrapper component designed to standardise page layouts. It automatically manages titles, search, pagination, custom filters, primary actions (Add buttons/modals), empty states, delete operations, and seamlessly toggles between view components. View mode is automatically persisted using `usePersistentState`.
|
|
8
|
+
|
|
9
|
+
It supports **any number of named views** — table, list, kanban, calendar, or any custom view — via the `views` prop. The legacy `table` and `list` props remain fully supported for backward compatibility.
|
|
10
|
+
|
|
11
|
+
It also supports built-in **Export** and **Import** capabilities (via `ExportData` and `ImportData` sub-components) accessible through a contextual dropdown menu when configured.
|
|
12
|
+
|
|
13
|
+
Alternatively, you can provide layouts via the `#table`, `#list`, and `#grid` slots instead of component props, which also support the view toggling and receive all necessary props exactly like the child components do.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
### Props
|
|
18
|
+
|
|
19
|
+
| Prop | Type | Default | Description |
|
|
20
|
+
| :--------------------- | :------------------------------ | :----------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
21
|
+
| `name` | `string` | `''` | Optional identifier used to persist the view state. Combined with `title` to form a unique storage key. |
|
|
22
|
+
| `title` | `string` | `''` | Page title displayed at the top of the screen header. |
|
|
23
|
+
| `titleI18n` | `string` | — | i18n key for the page title. Takes priority over `title` when set. |
|
|
24
|
+
| `description` | `string` | `''` | Subtitle/description text rendered below the title. |
|
|
25
|
+
| `descriptionI18n` | `string` | — | i18n key for the description. |
|
|
26
|
+
| `info` | `string` | — | Tooltip info text shown next to the title via an info icon. |
|
|
27
|
+
| `infoI18n` | `string` | — | i18n key for the info tooltip. |
|
|
28
|
+
| `data` | `any[]` | `[]` | The data array passed down to the active view component/slot. |
|
|
29
|
+
| `loading` | `boolean` | `false` | Propagated to child views and disables Refresh button while active. |
|
|
30
|
+
| `refetch` | `Function` | — | Called on every search, filter, pagination, sort, or quick-filter change. Receives `{ pagination, search, sort, filter }`. |
|
|
31
|
+
| `pageInfo` | `PageInfo` | — | Pagination metadata (`currentPage`, `totalPages`, `totalItems`, `itemsPerPage`). |
|
|
32
|
+
| `paginationProps` | `ScreenPaginationProps` | `{ alignment: 'between', navType: 'icon', showItemsPerPage: true, ... }` | Props forwarded to the `Pagination` component. |
|
|
33
|
+
| `canSearch` | `boolean` | `true` | Show/hide the search input. |
|
|
34
|
+
| `canAdd` | `boolean` | `true` | Show/hide the Add button. |
|
|
35
|
+
| `pagination` | `boolean` | `true` | Show/hide the pagination bar. |
|
|
36
|
+
| `filterSchema` | `IForm[]` | `[]` | Form schema for the advanced filter modal/dropdown. |
|
|
37
|
+
| `filterType` | `'modal' \| 'dropdown'` | `'modal'` | Style of the advanced filter trigger. |
|
|
38
|
+
| `showRefresh` | `boolean` | `false` | Show a manual Refresh button in the toolbar. |
|
|
39
|
+
| `quickFilters` | `ScreenQuickFilter[]` | `[]` | Array of tab options rendered as a **line-variant tab bar** between the header and content. |
|
|
40
|
+
| `skipQuickFilterViews` | `string[]` | `[]` | Array of view keys (e.g., `['calendar', 'kanban']`) where quick filters should be hidden. If omitted, quick filters are shown on all views. |
|
|
41
|
+
| `quickFilterKey` | `string` | `'status'` | The key used to add the active quick filter value to the `filter` property in the refetch. |
|
|
42
|
+
| `defaultQuickFilter` | `string \| number` | first tab's value | Initial quick-filter value. Defaults to the first entry in `quickFilters` when not set. |
|
|
43
|
+
| `views` | `ScreenView[]` | — | **Dynamic multi-view definitions.** Pass any number of named views (table, list, kanban, calendar, etc.). Each entry renders a toggle button and maps to its component. The first entry is the default view. |
|
|
44
|
+
| `list` | `Component` | — | **Legacy.** Component rendered in list/grid view. Prefer `views` for new usage. |
|
|
45
|
+
| `table` | `Component` | — | **Legacy.** Component rendered in table view. Prefer `views` for new usage. |
|
|
46
|
+
| `addBtn` | `AddBtnConfig` | — | Configuration for the Add button (label, icon, variant, modal, router link, etc.). |
|
|
47
|
+
| `addComponent` | `Component` | — | Fully custom component to replace the default Add button area. |
|
|
48
|
+
| `exportSchema` | `ExportField[]` | `[]` | Fields definition for the Export feature. |
|
|
49
|
+
| `importSchema` | `ImportField[]` | `[]` | Fields definition for the Import feature. |
|
|
50
|
+
| `exportProps` | `Record<string,any> \| boolean` | `false` | Extra props forwarded to `ExportData`. Set to `true` to enable with defaults. |
|
|
51
|
+
| `importProps` | `Record<string,any> \| boolean` | `false` | Extra props forwarded to `ImportData`. Set to `true` to enable with defaults. |
|
|
52
|
+
| `exportMode` | `'frontend' \| 'backend'` | `'frontend'` | Export processing mode. |
|
|
53
|
+
| `exportType` | `string` | — | Identifier passed to `vliteConfig.services.exportApi` for backend exports. |
|
|
54
|
+
| `importType` | `string` | — | Identifier passed to `vliteConfig.services.importApi` for backend imports. |
|
|
55
|
+
| `customHeader` | `boolean` | `false` | When `true`, hides the auto-generated header — use the `#custom-header` slot instead. |
|
|
56
|
+
| `emptyTitle` | `string` | — | Title shown in the empty state. |
|
|
57
|
+
| `emptyTitleI18n` | `string` | — | i18n key for the empty state title. |
|
|
58
|
+
| `emptyDescription` | `string` | — | Description shown in the empty state. |
|
|
59
|
+
| `emptyDescriptionI18n` | `string` | — | i18n key for the empty state description. |
|
|
60
|
+
| `emptyIcon` | `string` | `'lucide:inbox'` | Icon shown in the empty state. |
|
|
61
|
+
| `containerClass` | `string` | — | Extra CSS class applied to the content wrapper `<div>`. |
|
|
62
|
+
| `headerClass` | `string` | — | Extra CSS class applied to the header row `<div>`. |
|
|
63
|
+
| `titleClass` | `string` | — | Extra CSS class applied to the title `<h1>`. |
|
|
64
|
+
| `descriptionClass` | `string` | — | Extra CSS class applied to the description `<p>`. |
|
|
65
|
+
| `viewProps` | `Record<string,any>` | `{}` | Additional props forwarded to the active view component. |
|
|
66
|
+
| `hideSelectable` | `boolean` | `false` | Hides the row-selection checkbox and bulk-delete button. |
|
|
67
|
+
| `hideDeleteBtn` | `boolean` | `true` | Show/hide the bulk delete button when rows are selected. |
|
|
68
|
+
| `skipEmptyViews` | `string[]` | `[]` | Array of view keys that should bypass the default empty state and always render their component even when there is no data. Useful for kanban boards or calendars where empty columns/grids are needed. |
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
### `ScreenView` type
|
|
73
|
+
```ts
|
|
74
|
+
export interface ScreenView {
|
|
75
|
+
/** Unique key used to identify and persist this view */
|
|
76
|
+
key: string
|
|
77
|
+
/** The Vue component to render for this view */
|
|
78
|
+
component: Component | any
|
|
79
|
+
/** Icon string (e.g. lucide icon name) shown in the view toggle button */
|
|
80
|
+
icon?: string
|
|
81
|
+
/** Tooltip / aria-label for the toggle button */
|
|
82
|
+
label?: string
|
|
83
|
+
/** i18n key for the label */
|
|
84
|
+
labelI18n?: string
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
### Multi-View Support (`views` prop)
|
|
91
|
+
|
|
92
|
+
The `views` prop enables fully dynamic, extensible view switching. Pass an array of `ScreenView` objects — each renders a toggle button and maps to its component. The first entry becomes the default active view (unless persisted state overrides it).
|
|
93
|
+
|
|
94
|
+
All view components receive the same standard props: `data`, `loading`, `refetch`, `selectedRows`, `delete`, and anything in `viewProps`.
|
|
95
|
+
|
|
96
|
+
#### Example — Table + List + Kanban + Calendar
|
|
97
|
+
```vue
|
|
98
|
+
<script setup>
|
|
99
|
+
import { defineAsyncComponent } from 'vue'
|
|
100
|
+
const UserTable = defineAsyncComponent(() => import('./UserTable.vue'))
|
|
101
|
+
const UserList = defineAsyncComponent(() => import('./UserList.vue'))
|
|
102
|
+
const UserKanban = defineAsyncComponent(() => import('./UserKanban.vue'))
|
|
103
|
+
const UserCalendar = defineAsyncComponent(() => import('./UserCalendar.vue'))
|
|
104
|
+
</script>
|
|
105
|
+
|
|
106
|
+
<template>
|
|
107
|
+
<Screen
|
|
108
|
+
name="users"
|
|
109
|
+
title="Users"
|
|
110
|
+
:data="users"
|
|
111
|
+
:loading="loading"
|
|
112
|
+
:refetch="fetchUsers"
|
|
113
|
+
:views="[
|
|
114
|
+
{ key: 'table', component: UserTable, icon: 'lucide:list', label: 'Table' },
|
|
115
|
+
{ key: 'list', component: UserList, icon: 'lucide:layout-grid', label: 'Grid' },
|
|
116
|
+
{ key: 'kanban', component: UserKanban, icon: 'lucide:kanban', label: 'Kanban' },
|
|
117
|
+
{ key: 'calendar', component: UserCalendar, icon: 'lucide:calendar', label: 'Calendar' },
|
|
118
|
+
]" />
|
|
119
|
+
</template>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
#### Example — Two views only
|
|
123
|
+
```vue
|
|
124
|
+
<Screen
|
|
125
|
+
name="orders"
|
|
126
|
+
title="Orders"
|
|
127
|
+
:data="orders"
|
|
128
|
+
:refetch="fetchOrders"
|
|
129
|
+
:views="[
|
|
130
|
+
{ key: 'table', component: OrderTable, icon: 'lucide:list', label: 'Table' },
|
|
131
|
+
{ key: 'board', component: OrderBoard, icon: 'lucide:layout-panel-left', label: 'Board' },
|
|
132
|
+
]" />
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
### Legacy Props (`table` / `list`)
|
|
138
|
+
|
|
139
|
+
The original `table` and `list` props are fully supported and work exactly as before. They are normalised internally into the `views` system with default icons and keys.
|
|
140
|
+
```vue
|
|
141
|
+
<Screen
|
|
142
|
+
name="users"
|
|
143
|
+
title="Users"
|
|
144
|
+
:data="users"
|
|
145
|
+
:table="UserTable"
|
|
146
|
+
:list="UserList"
|
|
147
|
+
:refetch="fetchUsers" />
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
### Quick Filters
|
|
153
|
+
|
|
154
|
+
Quick filters provide a **tab bar** UI pattern common in modern dashboards (Shopify, Linear, Vercel). They appear between the header toolbar and the content area, using a clean `line` variant. The selected value will add to the `filter` property in the refetch based on the provided key. Default will be `status`. This behavior is completely invisible to the main Screen Filter state.
|
|
155
|
+
|
|
156
|
+
By default, quick filters are shown across all active views. You can hide them for specific views by passing an array of view keys to the `skipQuickFilterViews` prop (e.g., `:skip-quick-filter-views="['calendar', 'kanban']"`).
|
|
157
|
+
|
|
158
|
+
#### `ScreenQuickFilter` type
|
|
159
|
+
```ts
|
|
160
|
+
export interface ScreenQuickFilter {
|
|
161
|
+
label: string
|
|
162
|
+
labelI18n?: string
|
|
163
|
+
value: string | number
|
|
164
|
+
icon?: string
|
|
165
|
+
/** Optional badge/count shown next to the label, e.g. "Active (12)" */
|
|
166
|
+
count?: number
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
#### Refetch payload
|
|
171
|
+
|
|
172
|
+
When a quick-filter tab is selected, `refetch` is called, and the quick filter's value is automatically added to the `filter` property based on the provided `quickFilterKey` (default will be `'status'`):
|
|
173
|
+
```ts
|
|
174
|
+
refetch({
|
|
175
|
+
pagination: { page: 1, limit: 10 },
|
|
176
|
+
search: '...',
|
|
177
|
+
sort: { field: '', order: '' },
|
|
178
|
+
filter: { status: 'active', ...otherFilters }, // The selected tab value mapped to quickFilterKey
|
|
179
|
+
})
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
### Slots
|
|
185
|
+
|
|
186
|
+
| Slot | Description |
|
|
187
|
+
| :-------------- | :--------------------------------------------------------------------------------------------- |
|
|
188
|
+
| `title` | Replaces the `<h1>` title element. |
|
|
189
|
+
| `description` | Replaces the description paragraph. |
|
|
190
|
+
| `before-search` | Injected before the search input in the toolbar. |
|
|
191
|
+
| `actions` | Replaces the entire Add button area (use to provide fully custom action buttons). |
|
|
192
|
+
| `after-add` | Appended after the Add button / ScreenOptionsDropdown. |
|
|
193
|
+
| `custom-header` | Full replacement header (only rendered when `customHeader: true`). |
|
|
194
|
+
| `sub-header` | Rendered after the main header row and after the quick-filter tabs, before the content. |
|
|
195
|
+
| `empty` | Custom empty state (replaces `ScreenEmptyState`). |
|
|
196
|
+
| `table` | Slot-based table view. Receives `{ data, loading, selectedRows, delete, updateSelectedRows }`. |
|
|
197
|
+
| `list` | Slot-based list view. Same scoped props as `#table`. |
|
|
198
|
+
| `grid` | Slot-based grid view (treated as list mode). Same scoped props. |
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
### Events
|
|
203
|
+
|
|
204
|
+
| Event | Payload | Description |
|
|
205
|
+
| :------- | :------ | :---------------------------------------------------------------- |
|
|
206
|
+
| `add` | — | Emitted when the default Add is clicked (no `addBtn` configured). |
|
|
207
|
+
| `delete` | `any[]` | Emitted after the user confirms bulk/row deletion. |
|
|
208
|
+
| `activeView` | `string` | Emitted when the active view mode changes (e.g. toggled by user) **and on initial mount** so the parent always knows the current view. |
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
# SeoProvider
|
|
2
|
+
|
|
3
|
+
**Import:** `import { SeoProvider, useSeo } from 'vlite3'`
|
|
4
|
+
|
|
5
|
+
`SeoProvider` is vlite3's framework-agnostic SEO foundation. Applications map
|
|
6
|
+
site and route domain data onto provider inputs; vlite3 alone owns fallback
|
|
7
|
+
resolution, token replacement, normalization, and adapter output.
|
|
8
|
+
|
|
9
|
+
The default adapter is suitable for client-rendered Vue applications. Nuxt/SSR
|
|
10
|
+
hosts supply an adapter while reusing the same `SeoPayload`.
|
|
11
|
+
|
|
12
|
+
## Breaking changes
|
|
13
|
+
|
|
14
|
+
- `SeoData.keywords` accepts a string, an array, or `null`; normalized
|
|
15
|
+
`SeoPayload.keywords` is always a comma-separated string.
|
|
16
|
+
- `SeoData.robots` accepts a string, a boolean index flag, a structured
|
|
17
|
+
directive object, or `null`; normalized `SeoPayload.robots` is a string or
|
|
18
|
+
`null`.
|
|
19
|
+
- `SeoData.jsonLd` accepts one object, an ordered array, or `null`;
|
|
20
|
+
normalized `SeoPayload.jsonLd` is always an array.
|
|
21
|
+
- All canonical fields, including OG/Twitter/JSON-LD fields, can be declared
|
|
22
|
+
directly through `useSeo`. `overrides` remains compatible and wins.
|
|
23
|
+
- `SeoData` is the authored input contract. `SeoPayload` is the normalized
|
|
24
|
+
adapter contract.
|
|
25
|
+
|
|
26
|
+
## Props
|
|
27
|
+
|
|
28
|
+
| Prop | Type | Default | Description |
|
|
29
|
+
| :--- | :--- | :--- | :--- |
|
|
30
|
+
| `defaults` | `Partial<SeoData> \| null` | `null` | Site-level baseline. |
|
|
31
|
+
| `fallback` | `Partial<SeoData> \| null` | `null` | Static page/domain fallback. |
|
|
32
|
+
| `pageFallbacks` | `Record<string, Partial<SeoData>> \| null` | `null` | Page-key fallback map. |
|
|
33
|
+
| `pageType` | `string` | `home` | Active page key when no context declares one. |
|
|
34
|
+
| `globalReplacements` | `SeoReplacements` | — | Tokens available to every layer. |
|
|
35
|
+
| `sanitizeText` | `boolean` | `false` | Converts resolved textual fields from HTML/rich text to plain text. |
|
|
36
|
+
| `adapter` | `SeoAdapter \| null` | DOM adapter | Host-specific emitter. |
|
|
37
|
+
|
|
38
|
+
The provider emits `update(payload: SeoPayload)` after every normalized
|
|
39
|
+
change and renders its default slot.
|
|
40
|
+
|
|
41
|
+
## Resolution contract
|
|
42
|
+
|
|
43
|
+
Precedence is:
|
|
44
|
+
|
|
45
|
+
1. `context.overrides`
|
|
46
|
+
2. direct `useSeo` context fields
|
|
47
|
+
3. active page/static fallback
|
|
48
|
+
4. site defaults
|
|
49
|
+
|
|
50
|
+
Empty strings and empty arrays fall through. `null` explicitly clears an
|
|
51
|
+
inherited value. Tokens are replaced after a layer is selected. When
|
|
52
|
+
sanitization is enabled, textual fields are converted to plain text after token
|
|
53
|
+
replacement.
|
|
54
|
+
|
|
55
|
+
OG and Twitter title, description, image, and URL derive from the normalized
|
|
56
|
+
core fields when their dedicated values are absent. `ogType` defaults to
|
|
57
|
+
`website` on `home`; `twitterCard` derives from image presence.
|
|
58
|
+
Twitter image alt text derives from `ogImageAlt` when it is not authored
|
|
59
|
+
separately.
|
|
60
|
+
|
|
61
|
+
## Input ergonomics
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
const defaults: Partial<SeoData> = {
|
|
65
|
+
title: 'Acme',
|
|
66
|
+
description: '<p>Furniture & lighting</p>',
|
|
67
|
+
keywords: ['furniture', 'lighting'],
|
|
68
|
+
robots: { index: true, follow: true },
|
|
69
|
+
jsonLd: [
|
|
70
|
+
createOrganizationStructuredData({
|
|
71
|
+
name: 'Acme',
|
|
72
|
+
url: 'https://example.com',
|
|
73
|
+
}),
|
|
74
|
+
createWebPageStructuredData({
|
|
75
|
+
name: 'Home',
|
|
76
|
+
url: 'https://example.com',
|
|
77
|
+
}),
|
|
78
|
+
],
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Robot booleans normalize as follows:
|
|
83
|
+
|
|
84
|
+
| Input | Output |
|
|
85
|
+
| :--- | :--- |
|
|
86
|
+
| `true` | `index, follow` |
|
|
87
|
+
| `false` | `noindex, nofollow` |
|
|
88
|
+
| `{ index: false, follow: true }` | `noindex, follow` |
|
|
89
|
+
|
|
90
|
+
Structured robots also support `archive`, `imageIndex`, `translate`, and
|
|
91
|
+
an `additional` directive list.
|
|
92
|
+
|
|
93
|
+
## Structured-data builders
|
|
94
|
+
|
|
95
|
+
All builders are pure, DOM-free functions returning plain JSON-LD objects:
|
|
96
|
+
|
|
97
|
+
- `createArticleStructuredData`
|
|
98
|
+
- `createPersonStructuredData`
|
|
99
|
+
- `createCreativeWorkStructuredData`
|
|
100
|
+
- `createWebPageStructuredData`
|
|
101
|
+
- `createOrganizationStructuredData`
|
|
102
|
+
- `createBreadcrumbListStructuredData`
|
|
103
|
+
- `createStructuredData` for any other schema.org type
|
|
104
|
+
- `defineStructuredData` as a typed passthrough for fully custom objects
|
|
105
|
+
|
|
106
|
+
Dedicated builders include `https://schema.org` as `@context`, omit
|
|
107
|
+
`null`/`undefined` optional properties, and can receive a custom context or
|
|
108
|
+
`@id`.
|
|
109
|
+
|
|
110
|
+
## Plain-text sanitizer
|
|
111
|
+
|
|
112
|
+
`htmlToPlainText(value, options?)` is a pure O(input) scanner. It strips tags,
|
|
113
|
+
comments, script/style contents, decodes named and numeric entities, and
|
|
114
|
+
normalizes whitespace. Set `preserveLineBreaks` for multi-line output.
|
|
115
|
+
|
|
116
|
+
Use the provider's `sanitizeText` prop for all resolved SEO text, or call the
|
|
117
|
+
helper directly when structured-data descriptions also need the same value.
|
|
118
|
+
|
|
119
|
+
## Canonical/OG URL composition
|
|
120
|
+
|
|
121
|
+
`composeSeoUrl(origin, path, options?)` and its
|
|
122
|
+
`composeCanonicalUrl` alias:
|
|
123
|
+
|
|
124
|
+
- require an HTTP(S) origin;
|
|
125
|
+
- normalize root and trailing slashes;
|
|
126
|
+
- preserve search parameters by default;
|
|
127
|
+
- omit fragments by default;
|
|
128
|
+
- support `remove`, `preserve`, or `add` trailing-slash modes.
|
|
129
|
+
|
|
130
|
+
Invalid origins return an empty string rather than emitting a malformed URL.
|
|
131
|
+
|
|
132
|
+
## Per-page context
|
|
133
|
+
|
|
134
|
+
```ts
|
|
135
|
+
const handle = useSeo({
|
|
136
|
+
pageType: 'article',
|
|
137
|
+
title: '{{articleTitle}} · {{siteName}}',
|
|
138
|
+
description: article.body,
|
|
139
|
+
canonicalUrl: composeSeoUrl(origin, route.path),
|
|
140
|
+
robots: { index: article.isPublished, follow: true },
|
|
141
|
+
jsonLd: createArticleStructuredData({
|
|
142
|
+
headline: article.title,
|
|
143
|
+
description: htmlToPlainText(article.body),
|
|
144
|
+
}),
|
|
145
|
+
replacements: {
|
|
146
|
+
articleTitle: article.title,
|
|
147
|
+
siteName: site.name,
|
|
148
|
+
},
|
|
149
|
+
sanitizeText: true,
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
handle.update(nextContext)
|
|
153
|
+
handle.clear()
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Multiple callers merge in registration order; later defined scalar fields win,
|
|
157
|
+
while replacements and overrides shallow-merge. Each handle clears only its
|
|
158
|
+
own entry and automatically unregisters on unmount. Outside a provider,
|
|
159
|
+
`useSeo` remains a safe no-op.
|
|
160
|
+
|
|
161
|
+
## Adapters
|
|
162
|
+
|
|
163
|
+
`createDomSeoAdapter()` writes title, standard meta, complete Open Graph and
|
|
164
|
+
Twitter meta, canonical, favicon, and every JSON-LD block. It keeps a single
|
|
165
|
+
tag per semantic key, removes stale tags during navigation, reuses JSON-LD
|
|
166
|
+
scripts by `@id` or stable position, and removes all owned state on
|
|
167
|
+
`reset()`. It no-ops when `document` is unavailable.
|
|
168
|
+
|
|
169
|
+
Custom adapters receive normalized data:
|
|
170
|
+
|
|
171
|
+
```ts
|
|
172
|
+
interface SeoPayload {
|
|
173
|
+
pageType: string
|
|
174
|
+
title: string
|
|
175
|
+
description: string
|
|
176
|
+
keywords: string
|
|
177
|
+
robots: string | null
|
|
178
|
+
jsonLd: SeoStructuredData[]
|
|
179
|
+
// remaining canonical, OG, Twitter, favicon, and site fields
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Pure exports and tests
|
|
184
|
+
|
|
185
|
+
The pure modules export `normalizeSeo`, `replaceSeoTokens`,
|
|
186
|
+
`normalizeSeoKeywords`, `normalizeSeoRobots`, `normalizeSeoJsonLd`,
|
|
187
|
+
the sanitizer, URL composers, and every structured-data builder. They import no
|
|
188
|
+
Vue, Nuxt, or DOM APIs and are covered by the plain-Node test file
|
|
189
|
+
`tests/SeoProvider.test.ts`.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# SidePanel
|
|
2
|
+
|
|
3
|
+
**Import:** `import { SidePanel } from 'vlite3'`
|
|
4
|
+
|
|
5
|
+
### Props
|
|
6
|
+
|
|
7
|
+
| Prop | Type | Default | Description |
|
|
8
|
+
| :------------------ | :-------------------------- | :------------ | :--------------------------------- |
|
|
9
|
+
| `show` | `boolean` | `false` | Binding (`v-model:show`) |
|
|
10
|
+
| `title` | `string` | — | Panel title |
|
|
11
|
+
| `titleI18n` | `string` | — | I18n key for title |
|
|
12
|
+
| `description` | `string` | — | Helper text below title |
|
|
13
|
+
| `descriptionI18n` | `string` | — | I18n key for helper text |
|
|
14
|
+
| `position` | `SidePanelPosition` | `right` | Slide from `left` or `right` |
|
|
15
|
+
| `size` | `SidePanelSize` | `md` | Width preset (`sm` to `full`) |
|
|
16
|
+
| `closeOutside` | `boolean` | `true` | Close on backdrop click |
|
|
17
|
+
| `hideCloseButton` | `boolean` | `false` | Hide the 'X' button |
|
|
18
|
+
| `mobileMenuVariant` | `'sidepanel' \| 'dropdown'` | `'sidepanel'` | Mobile menu style |
|
|
19
|
+
| `backdrop` | `boolean` | `true` | Show overlay |
|
|
20
|
+
| `class` | `string` | — | Custom container class |
|
|
21
|
+
| `overlayClass` | `string` | — | Custom backdrop class |
|
|
22
|
+
| `triggerClass` | `string` | — | Custom trigger element class |
|
|
23
|
+
| `headerClass` | `string` | — | Custom header area class |
|
|
24
|
+
| `bodyClass` | `string` | — | Custom internal body class |
|
|
25
|
+
| `footerClass` | `string` | — | Custom footer area class |
|
|
26
|
+
| `body` | `Component` | — | Component for lazy loading content |
|
|
27
|
+
| `bodyProps` | `object` | — | Props for the body component |
|
|
28
|
+
|
|
29
|
+
### Types
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
type SidePanelPosition = 'left' | 'right'
|
|
33
|
+
type SidePanelSize = 'sm' | 'md' | 'lg' | 'xl' | 'full'
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Events
|
|
37
|
+
|
|
38
|
+
- `@close`
|
|
39
|
+
- `@update:show`
|
|
40
|
+
- `@onOpen`
|
|
41
|
+
- `@onAfterOpen`: Animation complete
|
|
42
|
+
- `@onAfterClose`: Animation complete
|
|
43
|
+
|
|
44
|
+
### Slots
|
|
45
|
+
|
|
46
|
+
| Slot | Description | Props |
|
|
47
|
+
| :-------- | :------------------------------ | :---------------------- |
|
|
48
|
+
| `trigger` | Clickable element to open panel | — |
|
|
49
|
+
| `header` | Custom header content | — |
|
|
50
|
+
| `default` | Body content | `{ close: () => void }` |
|
|
51
|
+
| `footer` | Footer content | `{ close: () => void }` |
|
|
52
|
+
|
|
53
|
+
### Usage
|
|
54
|
+
|
|
55
|
+
```vue
|
|
56
|
+
<SidePanel title="Settings" position="right" size="lg">
|
|
57
|
+
<template #trigger>
|
|
58
|
+
<Button variant="ghost" icon="lucide:settings" />
|
|
59
|
+
</template>
|
|
60
|
+
|
|
61
|
+
<div class="p-4">
|
|
62
|
+
<h4 class="font-medium">Account Settings</h4>
|
|
63
|
+
<!-- settings controls -->
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
<template #footer="{ close }">
|
|
67
|
+
<Button class="w-full" @click="close">Done</Button>
|
|
68
|
+
</template>
|
|
69
|
+
</SidePanel>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
#### Mobile Menu Dropdown Variant
|
|
73
|
+
|
|
74
|
+
```vue
|
|
75
|
+
<Navbar variant="header" mobile-menu-variant="dropdown" mobileBreakpoint="xl">
|
|
76
|
+
<template #logo>Brand</template>
|
|
77
|
+
<template #left>
|
|
78
|
+
<Button variant="ghost">Home</Button>
|
|
79
|
+
<Button variant="ghost">About</Button>
|
|
80
|
+
</template>
|
|
81
|
+
<template #right>
|
|
82
|
+
<Button>Login</Button>
|
|
83
|
+
</template>
|
|
84
|
+
|
|
85
|
+
<!-- Custom mobile menu content -->
|
|
86
|
+
<template #mobile-menu>
|
|
87
|
+
<div class="flex flex-col p-2 space-y-2">
|
|
88
|
+
<NavbarItem label="Home" />
|
|
89
|
+
<NavbarItem label="About" />
|
|
90
|
+
<Button class="w-full">Login</Button>
|
|
91
|
+
</div>
|
|
92
|
+
</template>
|
|
93
|
+
</Navbar>
|
|
94
|
+
```
|