vlite3 1.5.12 → 1.5.13
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/Dropdown/DropdownMenu.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 +17 -0
- package/docs/all-components.md +89 -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 +339 -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
- /package/components/Dropdown/{DropdownMenu2.vue.js → DropdownMenu3.vue.js} +0 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Price
|
|
2
|
+
|
|
3
|
+
**Import:** `import { Price } from 'vlite3'`
|
|
4
|
+
|
|
5
|
+
A reactive utility component to render properly formatted currency values. It automatically formats numbers based on the standard `Intl.NumberFormat` API.
|
|
6
|
+
|
|
7
|
+
The component inherits its currency settings from the global `vlite3` configuration, but can be overridden locally on a per-component basis.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Default | Description |
|
|
14
|
+
| :--------- | :----------------- | :------ | :-------------------------------------------------------------------------- |
|
|
15
|
+
| `value` | `number \| string` | `0` | The numeric value to format. Strings are automatically parsed to numbers. |
|
|
16
|
+
| `currency` | `string` | — | Local override for the currency code (e.g., `'EUR'`, `'GBP'`, `'JPY'`). |
|
|
17
|
+
| `numberFormat` | `string` | `'standard'` | How the number is formatted. Set to `'compact'` to use abbreviations (e.g., 1K, 1M). |
|
|
18
|
+
| `compactThreshold` | `number` | `1000` | The value at which numbers start to be compacted. Numbers below this remain standard. |
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
### Basic Local Usage
|
|
25
|
+
|
|
26
|
+
Pass a numeric or string value. By default, it will use `'USD'` unless globally configured otherwise.
|
|
27
|
+
|
|
28
|
+
```vue
|
|
29
|
+
<script setup lang="ts">
|
|
30
|
+
import { Price } from 'vlite3'
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<template>
|
|
34
|
+
<Price :value="1234.56" />
|
|
35
|
+
<Price :value="2500" currency="EUR" />
|
|
36
|
+
<Price :value="1000000" numberFormat="compact" /> <!-- Renders as $1M -->
|
|
37
|
+
<Price :value="9500" numberFormat="compact" :compactThreshold="10000" /> <!-- Below threshold, renders $9,500 -->
|
|
38
|
+
<Price :value="15000" numberFormat="compact" :compactThreshold="10000" /> <!-- Above threshold, renders $15K -->
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Global Configuration
|
|
46
|
+
|
|
47
|
+
You can set a default currency for your entire application during plugin initialization. This is useful if your application primarily operates in a specific region.
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
// main.ts
|
|
51
|
+
import { createApp } from 'vue'
|
|
52
|
+
import { createVLite } from 'vlite3'
|
|
53
|
+
import App from './App.vue'
|
|
54
|
+
|
|
55
|
+
const app = createApp(App)
|
|
56
|
+
|
|
57
|
+
const vlite = createVLite({
|
|
58
|
+
components: {
|
|
59
|
+
price: {
|
|
60
|
+
currency: 'GBP', // Set default currency to British Pound
|
|
61
|
+
numberFormat: 'standard', // Set default format to standard
|
|
62
|
+
compactThreshold: 1000, // Sets default compaction threshold
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
app.use(vlite)
|
|
68
|
+
app.mount('#app')
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Dynamic Global Updates (Change From Anywhere)
|
|
75
|
+
|
|
76
|
+
If your application allows users to switch their preferred currency on the fly (e.g., from a settings menu or navbar), you can dynamically update the global configuration using the `updateConfig` utility.
|
|
77
|
+
|
|
78
|
+
Because the configuration state is fully reactive, **all** `<Price />` components across your application will instantly re-render with the newly selected currency.
|
|
79
|
+
|
|
80
|
+
```vue
|
|
81
|
+
<script setup lang="ts">
|
|
82
|
+
import { updateConfig } from 'vlite3'
|
|
83
|
+
|
|
84
|
+
const switchCurrency = (newCurrency: string) => {
|
|
85
|
+
// This will dynamically update the global config and trigger a re-render
|
|
86
|
+
// for all Price components globally without refreshing the page.
|
|
87
|
+
updateConfig({
|
|
88
|
+
components: {
|
|
89
|
+
price: {
|
|
90
|
+
currency: newCurrency
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
</script>
|
|
96
|
+
|
|
97
|
+
<template>
|
|
98
|
+
<div class="flex gap-2">
|
|
99
|
+
<button @click="switchCurrency('USD')">USD</button>
|
|
100
|
+
<button @click="switchCurrency('EUR')">EUR</button>
|
|
101
|
+
<button @click="switchCurrency('GBP')">GBP</button>
|
|
102
|
+
</div>
|
|
103
|
+
</template>
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# PricingPlan
|
|
2
|
+
|
|
3
|
+
**Import:** `import { PricingPlan } from 'vlite3'`
|
|
4
|
+
|
|
5
|
+
### Description
|
|
6
|
+
|
|
7
|
+
A responsive pricing table component supporting highlighting, features lists, and different visual variants.
|
|
8
|
+
|
|
9
|
+
### Props
|
|
10
|
+
|
|
11
|
+
| Prop | Type | Default | Description |
|
|
12
|
+
| :----------- | :------------------------ | :---------- | :---------------------------------------- |
|
|
13
|
+
| `items` | `PricingPlanItemSchema[]` | `[]` | Array of plan definitions |
|
|
14
|
+
| `modelValue` | `string \| number` | `null` | Selected plan ID (v-model) |
|
|
15
|
+
| `variant` | `'outline' \| 'solid'` | `'outline'` | Visual style variant |
|
|
16
|
+
| `columns` | `number` | `3` | Number of columns (responsive by default) |
|
|
17
|
+
| `gap` | `number` | `6` | Gap between cards (tailwind scale) |
|
|
18
|
+
|
|
19
|
+
### Item Schema (`PricingPlanItemSchema`)
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
interface PricingPlanItemSchema {
|
|
23
|
+
id: string | number
|
|
24
|
+
title: string
|
|
25
|
+
price: string
|
|
26
|
+
period?: string
|
|
27
|
+
description?: string
|
|
28
|
+
features: Array<string | { text: string; included: boolean }>
|
|
29
|
+
buttonText?: string
|
|
30
|
+
popular?: boolean // Adds "Popular" badge
|
|
31
|
+
recommended?: boolean // Adds styling emphasis
|
|
32
|
+
variant?: 'outline' | 'solid' // Override per item
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Events
|
|
37
|
+
|
|
38
|
+
- `@update:modelValue`: Emitted when a plan is selected (via button click).
|
|
39
|
+
- `@change`: Emitted when selection changes.
|
|
40
|
+
|
|
41
|
+
### Usage
|
|
42
|
+
|
|
43
|
+
```vue
|
|
44
|
+
<script setup>
|
|
45
|
+
import { ref } from 'vue'
|
|
46
|
+
|
|
47
|
+
const selected = ref('pro')
|
|
48
|
+
const plans = [
|
|
49
|
+
{
|
|
50
|
+
id: 'basic',
|
|
51
|
+
title: 'Basic',
|
|
52
|
+
price: '/bin/zsh',
|
|
53
|
+
features: ['1 Project', 'Basic Support'],
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
id: 'pro',
|
|
57
|
+
title: 'Pro',
|
|
58
|
+
price: '',
|
|
59
|
+
popular: true,
|
|
60
|
+
features: ['Unlimited Projects', 'Priority Support'],
|
|
61
|
+
},
|
|
62
|
+
]
|
|
63
|
+
</script>
|
|
64
|
+
|
|
65
|
+
<template>
|
|
66
|
+
<PricingPlan v-model="selected" :items="plans" variant="outline" />
|
|
67
|
+
</template>
|
|
68
|
+
```
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# ProgressBar
|
|
2
|
+
|
|
3
|
+
**Import:** `import { ProgressBar } from 'vlite3'`
|
|
4
|
+
|
|
5
|
+
### Description
|
|
6
|
+
|
|
7
|
+
A versatile progress bar component supporting linear and circular modes with striped, animated, and indeterminate states.
|
|
8
|
+
|
|
9
|
+
### Props
|
|
10
|
+
|
|
11
|
+
| Prop | Type | Default | Description |
|
|
12
|
+
| :-------------- | :----------------------- | :--------------- | :--------------------------------------- |
|
|
13
|
+
| `modelValue` | `number` | required | Current progress (0-100) |
|
|
14
|
+
| `type` | `'linear' \| 'circular'` | `'linear'` | Visual style mode |
|
|
15
|
+
| `variant` | `ProgressBarVariant` | `'primary'` | Color theme |
|
|
16
|
+
| `size` | `ProgressBarSize` | `'md'` | Size preset |
|
|
17
|
+
| `showValue` | `boolean` | `false` | Show percentage label |
|
|
18
|
+
| `label` | `string` | — | Custom text label (overrides percentage) |
|
|
19
|
+
| `indeterminate` | `boolean` | `false` | Loading state without specific value |
|
|
20
|
+
| `striped` | `boolean` | `false` | Enable striped background (Linear only) |
|
|
21
|
+
| `animated` | `boolean` | `false` | Animate stripes (Linear only) |
|
|
22
|
+
| `height` | `string \| number` | — | Custom height (Linear) |
|
|
23
|
+
| `width` | `string \| number` | — | Custom width (Circular) |
|
|
24
|
+
| `color` | `string` | — | Custom hex color |
|
|
25
|
+
| `trackColor` | `string` | — | Custom track color |
|
|
26
|
+
| `strokeWidth` | `number` | — | Custom stroke thickness (Circular) |
|
|
27
|
+
| `rounded` | `string` | `'rounded-full'` | Border radius class |
|
|
28
|
+
|
|
29
|
+
### Types
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
type ProgressBarVariant =
|
|
33
|
+
| 'primary'
|
|
34
|
+
| 'secondary'
|
|
35
|
+
| 'success'
|
|
36
|
+
| 'warning'
|
|
37
|
+
| 'danger'
|
|
38
|
+
| 'info'
|
|
39
|
+
| 'gradient'
|
|
40
|
+
type ProgressBarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl'
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Usage
|
|
44
|
+
|
|
45
|
+
```vue
|
|
46
|
+
<ProgressBar :model-value="45" variant="success" show-value />
|
|
47
|
+
|
|
48
|
+
<ProgressBar type="circular" :model-value="75" size="lg" />
|
|
49
|
+
|
|
50
|
+
<ProgressBar indeterminate striped animated variant="warning" />
|
|
51
|
+
|
|
52
|
+
<ProgressBar type="circular" :model-value="90" color="#6366f1" track-color="#e0e7ff" :width="120" />
|
|
53
|
+
```
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# QRCode
|
|
2
|
+
|
|
3
|
+
**Import:** `import { QRCode } from 'vlite3'`
|
|
4
|
+
|
|
5
|
+
### Description
|
|
6
|
+
|
|
7
|
+
A lightweight and responsive QR Code component powered by `qrcode`. It encodes any supplied string exactly as provided, or displays a pre-generated QR image URL.
|
|
8
|
+
|
|
9
|
+
### Props
|
|
10
|
+
|
|
11
|
+
| Prop | Type | Default | Description |
|
|
12
|
+
| :------------ | :----------------- | :------------ | :------------------------------------------------------------------------ |
|
|
13
|
+
| `value` | `string` | — | The string value to encode into a QR code |
|
|
14
|
+
| `imageUrl` | `string` | — | A direct URL to an existing QR code image (overrides `value` if provided) |
|
|
15
|
+
| `size` | `number \| string` | `200` | Width/height of the container box |
|
|
16
|
+
| `margin` | `number` | `4` | Quiet zone margin |
|
|
17
|
+
| `scale` | `number` | `4` | Internal render scale for crisp display and printing |
|
|
18
|
+
| `errorCorrectionLevel` | `'L' \| 'M' \| 'Q' \| 'H'` | `'M'` | QR error-correction level |
|
|
19
|
+
| `alt` | `string` | `'QR Code'` | Accessible image description |
|
|
20
|
+
| `color.dark` | `string` | `'#000000ff'` | Color for dark modules (ensure hex with alpha e.g. `#000000ff`) |
|
|
21
|
+
| `color.light` | `string` | `'#ffffffff'` | Color for light modules (ensure hex with alpha e.g. `#ffffffff`) |
|
|
22
|
+
|
|
23
|
+
### Usage
|
|
24
|
+
|
|
25
|
+
#### From Value
|
|
26
|
+
|
|
27
|
+
```vue
|
|
28
|
+
<script setup>
|
|
29
|
+
import { QRCode } from 'vlite3'
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<template>
|
|
33
|
+
<QRCode value="https://example.com" :size="250" />
|
|
34
|
+
</template>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
#### From Existing Image URL
|
|
38
|
+
|
|
39
|
+
```vue
|
|
40
|
+
<template>
|
|
41
|
+
<QRCode image-url="https://example.com/qr.png" :size="250" />
|
|
42
|
+
</template>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
#### Base64 or Other Pre-Encoded Values
|
|
46
|
+
|
|
47
|
+
Pass pre-encoded values directly. The component treats them as ordinary strings and does not decode, normalize, or otherwise transform their content.
|
|
48
|
+
|
|
49
|
+
```vue
|
|
50
|
+
<template>
|
|
51
|
+
<QRCode
|
|
52
|
+
:value="base64Value"
|
|
53
|
+
:size="320"
|
|
54
|
+
:margin="4"
|
|
55
|
+
alt="Invoice QR code" />
|
|
56
|
+
</template>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
If `value` is a `data:image/...` URL, the component displays it directly instead of re-encoding it.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Rating
|
|
2
|
+
|
|
3
|
+
The `Rating` component allows users to view and provide ratings using highly customizable icons (stars, hearts, emojis, etc.). It supports half-values, read-only modes, custom active/inactive states, and progressive distribution charts.
|
|
4
|
+
|
|
5
|
+
## Base Components
|
|
6
|
+
|
|
7
|
+
- `Rating`
|
|
8
|
+
- `ReviewSummary`
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```vue
|
|
13
|
+
<script setup>
|
|
14
|
+
import { Rating, ReviewSummary } from 'vlite3'
|
|
15
|
+
import { ref } from 'vue'
|
|
16
|
+
|
|
17
|
+
const rating = ref(3)
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<Rating v-model="rating" />
|
|
22
|
+
</template>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Features
|
|
26
|
+
|
|
27
|
+
- **Interactive Half Values**: Pass `allow-half` to select 0.5 increments.
|
|
28
|
+
- **Solid vs Outline Styling**: `solid` prop (`true` by default) automatically ensures the selected rating is visually filled by injecting `fill-current`. You can set `:solid="false"` for outline styling.
|
|
29
|
+
- **Custom Icons & Emojis**: Supply a specific `lucide` icon or an entire Array of different emojis through `icon` and `active-icon`.
|
|
30
|
+
- **Review Summary UI**: Visualizes the distribution of votes seamlessly using `ReviewSummary`.
|
|
31
|
+
|
|
32
|
+
## Props
|
|
33
|
+
|
|
34
|
+
### Rating
|
|
35
|
+
|
|
36
|
+
| Prop | Type | Default | Description |
|
|
37
|
+
| ---- | ---- | ------- | ----------- |
|
|
38
|
+
| `modelValue` | `number` | `0` | The current value of the rating. |
|
|
39
|
+
| `max` | `number` | `5` | The maximum possible rating value. |
|
|
40
|
+
| `allowHalf` | `boolean` | `false` | Enables interactive half-star selection. |
|
|
41
|
+
| `readonly` | `boolean` | `false` | When true, the rating cannot be modified. |
|
|
42
|
+
| `showText` | `boolean` | `false` | Displays the numeric rating (e.g., 4.5 / 5) next to the icons. |
|
|
43
|
+
| `icon` | `string \| string[]` | `'lucide:star'` | The default icon(s) to display for unselected values. |
|
|
44
|
+
| `activeIcon` | `string \| string[]` | `'lucide:star'` | The icon(s) to display for active/filled values. |
|
|
45
|
+
| `activeColor` | `string` | `'text-amber-400'` | Tailwind classes applied to the active icons. |
|
|
46
|
+
| `inactiveColor` | `string` | `'text-muted-foreground/30'` | Tailwind classes applied to the inactive/empty icons. |
|
|
47
|
+
| `size` | `'sm' \| 'md' \| 'lg' \| 'xl'` | `'md'` | The size of the icons. |
|
|
48
|
+
| `clearable` | `boolean` | `false` | If true, clicking the active icon again resets the value to 0. |
|
|
49
|
+
| `solid` | `boolean` | `true` | If true, applies `fill-current` to make active icons solid. Set to `false` for outline styles. |
|
|
50
|
+
| `disabled` | `boolean` | `false` | Disables interaction and dims the component. |
|
|
51
|
+
|
|
52
|
+
### ReviewSummary
|
|
53
|
+
|
|
54
|
+
| Prop | Type | Default | Description |
|
|
55
|
+
| ---- | ---- | ------- | ----------- |
|
|
56
|
+
| `ratingDistribution` | `array` | `[]` | Array of objects `{ rating: number, percentage: number, count?: number }`. |
|
|
57
|
+
| `totalReviews` | `number` | `undefined` | Total number of reviews (fallback is calculated from count). |
|
|
58
|
+
| `averageRating` | `number` | `undefined` | The average rating (fallback is calculated from distribution). |
|
|
59
|
+
| `showTotal` | `boolean` | `true` | Shows the "Based on N global ratings" text. |
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
# RichTextEditor
|
|
2
|
+
|
|
3
|
+
**Import:** `import { RichTextEditor, RichTextReader } from 'vlite3'`
|
|
4
|
+
|
|
5
|
+
### Description
|
|
6
|
+
|
|
7
|
+
A lightweight WYSIWYG editor built on the native browser `contenteditable` API — no heavy editor framework. Supports headings, inline formatting, lists, blockquotes, links, images, alignment, and more. The `v-model` value is an HTML string.
|
|
8
|
+
|
|
9
|
+
Images inserted via the toolbar, paste, or drag-and-drop are uploaded through `useFileUpload` (the same service used by `FilePicker` / form file fields). While uploading, a temporary blob URL is shown; it is replaced with the final URL when the upload completes.
|
|
10
|
+
|
|
11
|
+
Pair with `RichTextReader` to render saved HTML with the same typography as the editor.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
### Props
|
|
16
|
+
|
|
17
|
+
| Prop | Type | Default | Description |
|
|
18
|
+
| :------------ | :------------- | :----------------- | :-------------------------------------------------------------------------- |
|
|
19
|
+
| `modelValue` | `string` | `''` | Binding (`v-model`) — HTML content |
|
|
20
|
+
| `placeholder` | `string` | `'Start typing…'` | Placeholder shown when the editor is empty |
|
|
21
|
+
| `label` | `string` | — | Optional label above the editor |
|
|
22
|
+
| `error` | `string` | — | Error message shown below the editor (also sets invalid styles) |
|
|
23
|
+
| `id` | `string` | auto-generated | DOM id for the editable surface |
|
|
24
|
+
| `disabled` | `boolean` | `false` | Disables editing and toolbar actions |
|
|
25
|
+
| `readonly` | `boolean` | `false` | Makes content non-editable while still showing the toolbar (disabled) |
|
|
26
|
+
| `minHeight` | `string` | `'180px'` | Minimum height of the editable area |
|
|
27
|
+
| `maxHeight` | `string` | `''` | Maximum height; when set, the editor scrolls vertically |
|
|
28
|
+
| `tools` | `RichTextTools`| — | Toolbar contents — preset string, tool ID array, or omit for full toolbar |
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
### Events
|
|
33
|
+
|
|
34
|
+
| Event | Payload | Description |
|
|
35
|
+
| :------------------ | :------------ | :------------------------------------------------------- |
|
|
36
|
+
| `update:modelValue` | `string` | Emitted on every content change with the current HTML |
|
|
37
|
+
| `focus` | `FocusEvent` | Emitted when the editor gains focus |
|
|
38
|
+
| `blur` | `FocusEvent` | Emitted when the editor loses focus |
|
|
39
|
+
| `image-removed` | `string` | Emitted with the image URL when an `<img>` is deleted |
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
### Types
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
/** Single toolbar button identifier */
|
|
47
|
+
export type RichTextToolId =
|
|
48
|
+
| 'undo' | 'redo'
|
|
49
|
+
| 'h1' | 'h2' | 'p'
|
|
50
|
+
| 'bold' | 'italic' | 'underline' | 'strikethrough' | 'code'
|
|
51
|
+
| 'bulletList' | 'orderedList' | 'blockquote' | 'hr' | 'image'
|
|
52
|
+
| 'alignLeft' | 'alignCenter' | 'alignRight'
|
|
53
|
+
| 'link' | 'clearFormat'
|
|
54
|
+
|
|
55
|
+
/** Curated toolbar presets */
|
|
56
|
+
export type RichTextToolsPreset = 'all' | 'standard' | 'basic' | 'minimal'
|
|
57
|
+
|
|
58
|
+
/** Accepted by the `tools` prop */
|
|
59
|
+
export type RichTextTools = RichTextToolId[] | RichTextToolsPreset
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Also exported: `resolveRichTextTools`, `RICH_TEXT_TOOL_GROUPS`.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
### Toolbar customization (`tools` prop)
|
|
67
|
+
|
|
68
|
+
| Value | Buttons included |
|
|
69
|
+
| :----------- | :------------------------------------------------------------ |
|
|
70
|
+
| _(omit)_ / `'all'` | Every tool |
|
|
71
|
+
| `'standard'` | Everything except alignment (`alignLeft` / `Center` / `Right`) |
|
|
72
|
+
| `'basic'` | Headings, inline formatting, lists, blockquote, image, link, clear |
|
|
73
|
+
| `'minimal'` | `bold`, `italic`, `bulletList`, `link` |
|
|
74
|
+
| `RichTextToolId[]` | Only the listed tools, rendered in canonical group order |
|
|
75
|
+
|
|
76
|
+
Group separators are hidden automatically when adjacent groups have no visible tools.
|
|
77
|
+
|
|
78
|
+
#### Available tool IDs
|
|
79
|
+
|
|
80
|
+
| Group | Tool IDs |
|
|
81
|
+
| :---------------- | :----------------------------------------------------- |
|
|
82
|
+
| History | `undo`, `redo` |
|
|
83
|
+
| Block format | `h1`, `h2`, `p` |
|
|
84
|
+
| Inline formatting | `bold`, `italic`, `underline`, `strikethrough`, `code` |
|
|
85
|
+
| Lists & blocks | `bulletList`, `orderedList`, `blockquote`, `hr`, `image` |
|
|
86
|
+
| Alignment | `alignLeft`, `alignCenter`, `alignRight` |
|
|
87
|
+
| Misc | `link`, `clearFormat` |
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
### Keyboard shortcuts
|
|
92
|
+
|
|
93
|
+
| Shortcut | Action |
|
|
94
|
+
| :-------------------- | :------------------ |
|
|
95
|
+
| `Ctrl/Cmd + B` | Bold |
|
|
96
|
+
| `Ctrl/Cmd + I` | Italic |
|
|
97
|
+
| `Ctrl/Cmd + U` | Underline |
|
|
98
|
+
| `Ctrl/Cmd + K` | Insert / edit link |
|
|
99
|
+
| `Ctrl/Cmd + Z` / `Y` | Undo / Redo |
|
|
100
|
+
| `Escape` | Close link popover |
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
### Usage
|
|
105
|
+
|
|
106
|
+
#### Basic
|
|
107
|
+
|
|
108
|
+
```vue
|
|
109
|
+
<script setup lang="ts">
|
|
110
|
+
import { ref } from 'vue'
|
|
111
|
+
import { RichTextEditor } from 'vlite3'
|
|
112
|
+
|
|
113
|
+
const content = ref('<p>Hello <strong>World</strong>!</p>')
|
|
114
|
+
</script>
|
|
115
|
+
|
|
116
|
+
<template>
|
|
117
|
+
<RichTextEditor v-model="content" placeholder="Start typing…" />
|
|
118
|
+
</template>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
#### With label & error
|
|
122
|
+
|
|
123
|
+
```vue
|
|
124
|
+
<RichTextEditor
|
|
125
|
+
v-model="description"
|
|
126
|
+
label="Description"
|
|
127
|
+
placeholder="Write a description…"
|
|
128
|
+
error="This field is required" />
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
#### Custom height
|
|
132
|
+
|
|
133
|
+
```vue
|
|
134
|
+
<RichTextEditor
|
|
135
|
+
v-model="notes"
|
|
136
|
+
label="Notes"
|
|
137
|
+
min-height="80px"
|
|
138
|
+
max-height="320px" />
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
#### Toolbar presets
|
|
142
|
+
|
|
143
|
+
```vue
|
|
144
|
+
<!-- Minimal: bold, italic, bullet list, link -->
|
|
145
|
+
<RichTextEditor v-model="content" tools="minimal" />
|
|
146
|
+
|
|
147
|
+
<!-- Basic: headings + formatting + lists + image + link -->
|
|
148
|
+
<RichTextEditor v-model="content" tools="basic" />
|
|
149
|
+
|
|
150
|
+
<!-- Explicit subset (canonical group order is preserved) -->
|
|
151
|
+
<RichTextEditor
|
|
152
|
+
v-model="content"
|
|
153
|
+
:tools="['bold', 'italic', 'bulletList', 'link', 'image']" />
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
#### Disabled / readonly
|
|
157
|
+
|
|
158
|
+
```vue
|
|
159
|
+
<RichTextEditor v-model="content" :disabled="true" />
|
|
160
|
+
<RichTextEditor v-model="content" :readonly="true" />
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
#### Image removal
|
|
164
|
+
|
|
165
|
+
```vue
|
|
166
|
+
<RichTextEditor
|
|
167
|
+
v-model="content"
|
|
168
|
+
@image-removed="(url) => deleteFromStorage(url)" />
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
# RichTextReader
|
|
174
|
+
|
|
175
|
+
**Import:** `import { RichTextReader } from 'vlite3'`
|
|
176
|
+
|
|
177
|
+
### Description
|
|
178
|
+
|
|
179
|
+
Read-only renderer for HTML produced by `RichTextEditor`. Uses the same typography styles so published content matches what authors saw while editing. Ideal for detail pages, comments, blog posts, and previews.
|
|
180
|
+
|
|
181
|
+
### Props
|
|
182
|
+
|
|
183
|
+
| Prop | Type | Default | Description |
|
|
184
|
+
| :-------- | :------- | :------ | :----------------------------------- |
|
|
185
|
+
| `content` | `string` | `''` | HTML string to render (`v-html`) |
|
|
186
|
+
|
|
187
|
+
### Usage
|
|
188
|
+
|
|
189
|
+
```vue
|
|
190
|
+
<script setup lang="ts">
|
|
191
|
+
import { ref } from 'vue'
|
|
192
|
+
import { RichTextEditor, RichTextReader } from 'vlite3'
|
|
193
|
+
|
|
194
|
+
const content = ref('<p>Hello <strong>World</strong>!</p>')
|
|
195
|
+
</script>
|
|
196
|
+
|
|
197
|
+
<template>
|
|
198
|
+
<RichTextEditor v-model="content" />
|
|
199
|
+
|
|
200
|
+
<div class="mt-6 p-6 border rounded-lg">
|
|
201
|
+
<RichTextReader :content="content" />
|
|
202
|
+
</div>
|
|
203
|
+
</template>
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
### Form integration
|
|
209
|
+
|
|
210
|
+
Use `type: 'richTextEditor'` in a form schema. The field value is an HTML string. Pass editor props via `props` (including `tools`, `minHeight`, `maxHeight`). See [Forms](./forms.md#rich-text-editor) for schema examples, required-field behavior, and image upload notes.
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# ScaleGenerator
|
|
2
|
+
|
|
3
|
+
**Import:** `import { ScaleGenerator } from 'vlite3'`
|
|
4
|
+
|
|
5
|
+
A generic CSS-transform scaler. Renders any content at a fixed **target**
|
|
6
|
+
width and applies a `transform: scale(...)` so it shrinks to fit the
|
|
7
|
+
available viewport. Designed for preview panes that need to embed a
|
|
8
|
+
full-width page (storefront, dashboard, document, marketing site).
|
|
9
|
+
|
|
10
|
+
The component is **pure geometry** — it knows nothing about shops or any
|
|
11
|
+
specific domain. It is reused by the ERP editor's storefront preview, by
|
|
12
|
+
any future embed-style preview, and by the live storefront when a fixed
|
|
13
|
+
display width is desired.
|
|
14
|
+
|
|
15
|
+
### Props
|
|
16
|
+
|
|
17
|
+
| Prop | Type | Default | Description |
|
|
18
|
+
| :---------------- | :------------------------------ | :---------- | :------------------------------------------------------------------------------------------------------ |
|
|
19
|
+
| `enabled` | `boolean` | `undefined` | Master switch. When `false` the content renders at its natural width (clamped to `maxWidth`). |
|
|
20
|
+
| `targetWidth` | `number` | `1440` | The width (in `px`) the content was designed for. Falls back to `maxWidth`. |
|
|
21
|
+
| `maxWidth` | `number` | — | Hard cap on the content width when not scaling. |
|
|
22
|
+
| `minScale` | `number` | `0.25` | Lower bound for the computed scale. |
|
|
23
|
+
| `maxScale` | `number` | `1` | Upper bound for the computed scale. |
|
|
24
|
+
| `scale` | `number \| null` | `null` | Manual scale override. When provided, the component uses this value (clamped) instead of computing one. |
|
|
25
|
+
| `isEditMode` | `boolean` | `false` | When `true`, scaling is enabled by default. |
|
|
26
|
+
| `horizontalAlign` | `'left' \| 'center' \| 'right'` | `'center'` | Horizontal alignment of the (possibly scaled) content inside the frame. |
|
|
27
|
+
| `contentClass` | `string` | `''` | Extra class for the inner content wrapper. |
|
|
28
|
+
|
|
29
|
+
### Events
|
|
30
|
+
|
|
31
|
+
- `@update:scale` — emitted with the current scale (already clamped).
|
|
32
|
+
- `@update:containerWidth` — emitted with the frame's current `clientWidth`.
|
|
33
|
+
- `@update:ready` — emitted once after the first fitted scale is applied
|
|
34
|
+
(content was kept invisible until then to avoid a full-size flash).
|
|
35
|
+
|
|
36
|
+
### Scoped Slot
|
|
37
|
+
|
|
38
|
+
The default slot exposes four values:
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
{
|
|
42
|
+
scale: number // current effective scale (1 when disabled)
|
|
43
|
+
containerWidth: number // frame's current width in px
|
|
44
|
+
targetWidth: number // resolved target width
|
|
45
|
+
ready: boolean // true after the initial measurement reveal
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Usage
|
|
50
|
+
|
|
51
|
+
```vue
|
|
52
|
+
<script setup lang="ts">
|
|
53
|
+
import { ScaleGenerator } from 'vlite3'
|
|
54
|
+
import { ref } from 'vue'
|
|
55
|
+
|
|
56
|
+
const liveScale = ref(1)
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<template>
|
|
60
|
+
<ScaleGenerator
|
|
61
|
+
:target-width="1440"
|
|
62
|
+
:min-scale="0.25"
|
|
63
|
+
:max-scale="1"
|
|
64
|
+
@update:scale="(v) => (liveScale = v)">
|
|
65
|
+
<div class="p-8">…your 1440px-wide content…</div>
|
|
66
|
+
</ScaleGenerator>
|
|
67
|
+
</template>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Notes
|
|
71
|
+
|
|
72
|
+
- The component uses `ResizeObserver` to react to viewport changes. It
|
|
73
|
+
guards the global with `typeof ResizeObserver === 'undefined'` so it is
|
|
74
|
+
safe to import in SSR contexts (Nuxt server build will simply skip
|
|
75
|
+
observation).
|
|
76
|
+
- `transform: scale(...)` is layout-free: descendants keep their original
|
|
77
|
+
font sizes, padding, and Tailwind utility behavior. The visible
|
|
78
|
+
difference is the effective rendered size.
|
|
79
|
+
- This viewport transform is independent from `ThemeProvider`'s optional
|
|
80
|
+
base-font spacing scale, which changes the content's own `--spacing` token.
|
|
81
|
+
- The frame's height tracks `content.scrollHeight * scale` so the wrapper
|
|
82
|
+
shrinks/grows with the content.
|
|
83
|
+
- The frame uses `overflow: clip` so it clips scaled content without
|
|
84
|
+
becoming a scroll container. Descendant `scrollIntoView` / focus
|
|
85
|
+
navigation cannot displace the frame (`overflow: hidden` would still
|
|
86
|
+
allow programmatic scrolling).
|
|
87
|
+
- On first paint while scaling is enabled, the frame stays clipped with zero
|
|
88
|
+
height and `visibility: hidden` until a positive frame width is measured and
|
|
89
|
+
remains stable across a paint boundary. This prevents hidden tabs and other
|
|
90
|
+
temporarily zero-width layouts from revealing at `minScale` before their real
|
|
91
|
+
geometry is available.
|
|
92
|
+
- Initial transform transitions are disabled with an inline style, including
|
|
93
|
+
transitions supplied through `contentClass`. The guard is removed only after
|
|
94
|
+
the fitted transform is committed; later resizes keep the normal
|
|
95
|
+
`duration-150` transition (unless reduced motion is preferred).
|
|
96
|
+
- ResizeObserver callbacks are coalesced to a single `requestAnimationFrame`
|
|
97
|
+
tick. Scale / width / height emits are skipped when values are unchanged
|
|
98
|
+
to prevent parent shell feedback loops.
|
|
99
|
+
- The frame and content wrappers use `contain: layout style` and the
|
|
100
|
+
content uses `will-change: transform` so scaled previews stay on their
|
|
101
|
+
own compositor layer (see `docs/guides/performance.md`).
|