numori-ui 0.2.0 → 0.3.0
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/CHANGELOG.md +40 -0
- package/README.md +12 -10
- package/dist/components/Banner.js +179 -0
- package/dist/components/Banner.js.map +1 -0
- package/dist/components/CodeBlock.js +101 -0
- package/dist/components/CodeBlock.js.map +1 -0
- package/dist/components/ComparisonTable.js +152 -0
- package/dist/components/ComparisonTable.js.map +1 -0
- package/dist/components/Spinner.js +87 -0
- package/dist/components/Spinner.js.map +1 -0
- package/dist/components/ThemeToggle.js +85 -0
- package/dist/components/ThemeToggle.js.map +1 -0
- package/dist/components/Toast.js +107 -0
- package/dist/components/Toast.js.map +1 -0
- package/dist/components/index.js +73 -61
- package/dist/components/index.js.map +1 -1
- package/dist/icons/mdi.js +9 -0
- package/dist/icons/mdi.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.js +38 -32
- package/dist/index.js.map +1 -1
- package/dist/manifest.js +6 -0
- package/dist/manifest.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Banner.vue +149 -0
- package/src/components/CodeBlock.vue +99 -0
- package/src/components/ComparisonTable.vue +141 -0
- package/src/components/Spinner.vue +70 -0
- package/src/components/ThemeToggle.vue +81 -0
- package/src/components/Toast.vue +106 -0
- package/src/components/index.js +18 -0
- package/src/icons/mdi.js +9 -0
- package/src/manifest.js +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,45 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
While the library is pre-1.0, minor versions may add components and options; patch
|
|
8
8
|
versions are fixes.
|
|
9
9
|
|
|
10
|
+
## [0.3.0] — 2026-08-31
|
|
11
|
+
|
|
12
|
+
Six new components, bringing the library to 39 components (40 registered tags,
|
|
13
|
+
including `UiIcon`). All additions are backward compatible. These were extracted
|
|
14
|
+
from the wider Numori ecosystem — the notes app and the marketing site — where
|
|
15
|
+
the same patterns had been rebuilt more than once.
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- **`UiToast`** — a teleported stack of transient, self-dismissing messages with
|
|
20
|
+
enter/leave transitions. Presentational only: the host owns the list and its
|
|
21
|
+
timing and mutates a reactive array. Entries are `{ id, message, type?, icon? }`;
|
|
22
|
+
`type` maps to the `success` / `warning` / `error` tokens with a neutral
|
|
23
|
+
default. The container ignores pointer events so it never blocks the UI, and
|
|
24
|
+
each pill is a polite `role="status"`.
|
|
25
|
+
- **`UiBanner`** — a full-width status strip that slides in above the content
|
|
26
|
+
(offline notices, verification prompts, update prompts). Driven by `show`, with
|
|
27
|
+
a semantic `color`, optional `icon` and message slot, top safe-area padding by
|
|
28
|
+
default, and optional `clickable` / `dismissible` affordances that emit `click`
|
|
29
|
+
and `dismiss`.
|
|
30
|
+
- **`UiSpinner`** — the loading glyph `UiButton` uses, as a standalone primitive.
|
|
31
|
+
Five `size`s, colour inherited via `text-*`. Decorative by default; pass a
|
|
32
|
+
`label` and it becomes a live `role="status"` region.
|
|
33
|
+
- **`UiThemeToggle`** — a stateless light/dark icon button. Takes `isDark` and
|
|
34
|
+
emits `toggle`, leaving persistence to the host (`@nuxtjs/color-mode`, VueUse,
|
|
35
|
+
or hand-written); the sun and moon share a cell and cross-fade with a rotation.
|
|
36
|
+
- **`UiCodeBlock`** — a static, copyable snippet with an optional filename
|
|
37
|
+
caption and a copy button that fades in on hover or focus. Uses the async
|
|
38
|
+
Clipboard API and fails silently where it is unavailable; button labels are
|
|
39
|
+
props, so no language is baked in.
|
|
40
|
+
- **`UiComparisonTable`** — a data-driven, accessible two-way comparison built on
|
|
41
|
+
a real `<table>` (`<caption>`, `scope` headers) with one column accented.
|
|
42
|
+
Decorative leading icons; the cell text carries the meaning.
|
|
43
|
+
|
|
44
|
+
### Changed
|
|
45
|
+
|
|
46
|
+
- README component list, groupings and counts updated for the six additions.
|
|
47
|
+
- Type declarations (`dist/index.d.ts`) now export the six new components.
|
|
48
|
+
|
|
10
49
|
## [0.2.0] — 2026-08-31
|
|
11
50
|
|
|
12
51
|
Five new components, bringing the library to 33 components (34 registered tags,
|
|
@@ -46,5 +85,6 @@ including `UiIcon`). All additions are backward compatible.
|
|
|
46
85
|
- First published release: 28 components (29 registered tags), consumable as a
|
|
47
86
|
Nuxt module, a Vite plugin or a framework-agnostic Vue plugin.
|
|
48
87
|
|
|
88
|
+
[0.3.0]: https://github.com/Numori-Ecosystem/Numori-UI/releases/tag/v0.3.0
|
|
49
89
|
[0.2.0]: https://github.com/Numori-Ecosystem/Numori-UI/releases/tag/v0.2.0
|
|
50
90
|
[0.1.1]: https://github.com/Numori-Ecosystem/Numori-UI/releases/tag/v0.1.1
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Numori UI
|
|
2
2
|
|
|
3
|
-
The Numori design system as a standalone Vue 3 component library.
|
|
3
|
+
The Numori design system as a standalone Vue 3 component library. 39 components, Tailwind CSS v4, no
|
|
4
4
|
TypeScript, consumable as a **Nuxt module** or a **Vite plugin**.
|
|
5
5
|
|
|
6
6
|
Extracted from [Numori Notes](https://github.com/Numori-Ecosystem/Numori-Notes), where these
|
|
@@ -133,7 +133,7 @@ import './style.css'
|
|
|
133
133
|
createApp(App).use(createNumoriUI({ UiButton, UiModal })).mount('#app')
|
|
134
134
|
```
|
|
135
135
|
|
|
136
|
-
There is also `app.use(NumoriUI)`, which registers all
|
|
136
|
+
There is also `app.use(NumoriUI)`, which registers all 40 components in one line — convenient for
|
|
137
137
|
prototyping, but it bundles all of them. See [Tree-shaking](#tree-shaking).
|
|
138
138
|
|
|
139
139
|
## Styling
|
|
@@ -235,8 +235,8 @@ external, so the numbers are Numori UI's own code:
|
|
|
235
235
|
only import what a template references, so nothing further is needed — verified by checking that
|
|
236
236
|
`Numpad`, `Popup` and `Prompt` are absent from the Nuxt playground's client bundle.
|
|
237
237
|
|
|
238
|
-
**`app.use(NumoriUI)` is the one path that is not tree-shakeable.** To register all
|
|
239
|
-
has to reference all
|
|
238
|
+
**`app.use(NumoriUI)` is the one path that is not tree-shakeable.** To register all 40 components it
|
|
239
|
+
has to reference all 40, so they all end up in your bundle. The `include` option does not change
|
|
240
240
|
this — it controls registration, not bundling. Use `createNumoriUI` instead when size matters:
|
|
241
241
|
|
|
242
242
|
```js
|
|
@@ -298,7 +298,7 @@ Every component is documented with JSDoc at the top of its source file, includin
|
|
|
298
298
|
slots and worked examples. Prefixes below assume the default `Ui`.
|
|
299
299
|
|
|
300
300
|
**Actions** — `UiButton` (8 variants × 6 colours × 5 sizes × 5 shapes), `UiButtonsGroup`,
|
|
301
|
-
`UiSegmented` (single-select with a sliding pill)
|
|
301
|
+
`UiSegmented` (single-select with a sliding pill), `UiThemeToggle` (stateless light/dark button)
|
|
302
302
|
|
|
303
303
|
**Forms** — `UiInput` (text, number with steppers, password with toggle, email, phone, textarea,
|
|
304
304
|
built-in validation), `UiSelect` (searchable, groupable, teleported panel), `UiCheckbox`, `UiRadio`,
|
|
@@ -307,11 +307,13 @@ built-in validation), `UiSelect` (searchable, groupable, teleported panel), `UiC
|
|
|
307
307
|
**Overlays** — `UiModal` (teleported, fullscreen-on-mobile, safe-area aware), `UiPrompt`,
|
|
308
308
|
`UiDropdown`, `UiDropdownItem`, `UiDropdownRow`, `UiDropdownSubmenu`, `UiPopup`, `UiTooltip`
|
|
309
309
|
|
|
310
|
-
**Feedback** — `UiAlert`, `UiBadge`, `UiProgressBar`
|
|
310
|
+
**Feedback** — `UiAlert`, `UiBadge`, `UiProgressBar`, `UiSpinner` (loading glyph),
|
|
311
|
+
`UiToast` (transient message stack), `UiBanner` (full-width status strip)
|
|
311
312
|
|
|
312
313
|
**Layout & display** — `UiCard` (the surface primitive, with interactive and highlighted states),
|
|
313
314
|
`UiSectionHeading` (eyebrow / heading / standfirst), `UiBreadcrumb`, `UiIconTile` (tinted icon tile),
|
|
314
|
-
`
|
|
315
|
+
`UiComparisonTable` (accessible two-way comparison), `UiCodeBlock` (copyable snippet), `UiListMenu`,
|
|
316
|
+
`UiListMenuItem`, `UiDivider`, `UiAvatar`, `UiKbd`, `UiIcon`
|
|
315
317
|
|
|
316
318
|
External classes always win. `UiButton` merges them with
|
|
317
319
|
[tailwind-merge](https://github.com/dcastil/tailwind-merge), so `class="bg-gray-100"` genuinely
|
|
@@ -384,7 +386,7 @@ app.use(NumoriUI, {
|
|
|
384
386
|
})
|
|
385
387
|
```
|
|
386
388
|
|
|
387
|
-
Registers all
|
|
389
|
+
Registers all 40 components, and bundles all of them — reach for `createNumoriUI` when that matters:
|
|
388
390
|
|
|
389
391
|
```js
|
|
390
392
|
app.use(createNumoriUI({ UiButton, UiModal }, { icons: { component: MyIcon } }))
|
|
@@ -460,8 +462,8 @@ that outgrows the codemod fails loudly instead of shipping broken.
|
|
|
460
462
|
## Changelog
|
|
461
463
|
|
|
462
464
|
See [CHANGELOG.md](./CHANGELOG.md) for the release history. The current release is
|
|
463
|
-
**0.
|
|
464
|
-
`
|
|
465
|
+
**0.3.0**, which adds `UiToast`, `UiBanner`, `UiSpinner`, `UiThemeToggle`, `UiCodeBlock` and
|
|
466
|
+
`UiComparisonTable`.
|
|
465
467
|
|
|
466
468
|
## Licence and attribution
|
|
467
469
|
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import _sfc_main$1 from "../icons/Icon.js";
|
|
2
|
+
import { Transition, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, normalizeClass, normalizeStyle, openBlock, renderSlot, resolveDynamicComponent, toDisplayString, withCtx, withModifiers } from "vue";
|
|
3
|
+
//#region src/components/Banner.vue
|
|
4
|
+
var _hoisted_1 = { class: "relative flex items-center justify-center gap-2 px-4 py-1.5" };
|
|
5
|
+
var _hoisted_2 = ["aria-label"];
|
|
6
|
+
var _sfc_main = {
|
|
7
|
+
__name: "Banner",
|
|
8
|
+
props: {
|
|
9
|
+
/**
|
|
10
|
+
* Whether the banner is shown. Drive this from the condition it reports;
|
|
11
|
+
* toggling it runs the slide-in / collapse-out transition.
|
|
12
|
+
* @type {boolean}
|
|
13
|
+
* @default false
|
|
14
|
+
*/
|
|
15
|
+
show: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: false
|
|
18
|
+
},
|
|
19
|
+
/**
|
|
20
|
+
* Colour of the bar.
|
|
21
|
+
* @type {string}
|
|
22
|
+
* @default 'info'
|
|
23
|
+
* @values 'info' | 'success' | 'warning' | 'error' | 'neutral'
|
|
24
|
+
*/
|
|
25
|
+
color: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: "info"
|
|
28
|
+
},
|
|
29
|
+
/**
|
|
30
|
+
* Optional MDI icon shown before the message.
|
|
31
|
+
* @type {string}
|
|
32
|
+
* @default ''
|
|
33
|
+
*/
|
|
34
|
+
icon: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: ""
|
|
37
|
+
},
|
|
38
|
+
/**
|
|
39
|
+
* Message text. Ignored when the default slot is used.
|
|
40
|
+
* @type {string}
|
|
41
|
+
* @default ''
|
|
42
|
+
*/
|
|
43
|
+
message: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: ""
|
|
46
|
+
},
|
|
47
|
+
/**
|
|
48
|
+
* Makes the whole bar a button that emits `click`.
|
|
49
|
+
* @type {boolean}
|
|
50
|
+
* @default false
|
|
51
|
+
*/
|
|
52
|
+
clickable: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: false
|
|
55
|
+
},
|
|
56
|
+
/**
|
|
57
|
+
* Adds a close control that emits `dismiss`.
|
|
58
|
+
* @type {boolean}
|
|
59
|
+
* @default false
|
|
60
|
+
*/
|
|
61
|
+
dismissible: {
|
|
62
|
+
type: Boolean,
|
|
63
|
+
default: false
|
|
64
|
+
},
|
|
65
|
+
/**
|
|
66
|
+
* Accessible label for the dismiss control.
|
|
67
|
+
* @type {string}
|
|
68
|
+
* @default 'Dismiss'
|
|
69
|
+
*/
|
|
70
|
+
dismissLabel: {
|
|
71
|
+
type: String,
|
|
72
|
+
default: "Dismiss"
|
|
73
|
+
},
|
|
74
|
+
/**
|
|
75
|
+
* Pads for the top safe-area inset, for a banner pinned to the top of the
|
|
76
|
+
* screen. Turn off when the banner sits lower in the layout.
|
|
77
|
+
* @type {boolean}
|
|
78
|
+
* @default true
|
|
79
|
+
*/
|
|
80
|
+
safeArea: {
|
|
81
|
+
type: Boolean,
|
|
82
|
+
default: true
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
emits: ["click", "dismiss"],
|
|
86
|
+
setup(__props, { emit: __emit }) {
|
|
87
|
+
/**
|
|
88
|
+
* UiBanner — a full-width status strip that slides in above the content.
|
|
89
|
+
*
|
|
90
|
+
* The shape shared by "you're offline", "your email isn't verified" and "a new
|
|
91
|
+
* version is available": a thin, edge-to-edge bar that expands into view, states
|
|
92
|
+
* one thing with an optional icon, and collapses away when the condition clears.
|
|
93
|
+
* Mount it permanently and drive `show` from the condition; the height/opacity
|
|
94
|
+
* transition does the appearing and disappearing.
|
|
95
|
+
*
|
|
96
|
+
* It sits at the top of the layout, so it honours the top safe-area inset by
|
|
97
|
+
* default — on a notched phone the padding keeps the text out from under the
|
|
98
|
+
* status bar. Turn `safeArea` off for a banner that is not at the very top.
|
|
99
|
+
*
|
|
100
|
+
* Two optional affordances: `clickable` turns the whole bar into a button (for
|
|
101
|
+
* "tap here to verify"), and `dismissible` adds a close control. They emit
|
|
102
|
+
* `click` and `dismiss` respectively — the parent decides what those mean.
|
|
103
|
+
*
|
|
104
|
+
* Colour is a small semantic set rather than free-form, so banners stay
|
|
105
|
+
* consistent across apps; pass `bg-*`/`text-*` classes to step outside it.
|
|
106
|
+
*
|
|
107
|
+
* @example Offline notice
|
|
108
|
+
* <UiBanner :show="offline" color="warning" icon="mdi:wifi-off"
|
|
109
|
+
* message="You're offline — changes will sync when you reconnect" />
|
|
110
|
+
*
|
|
111
|
+
* @example Tappable call to action
|
|
112
|
+
* <UiBanner :show="!verified" color="info" icon="mdi:email-alert-outline"
|
|
113
|
+
* clickable message="Your email is not verified — tap here to verify"
|
|
114
|
+
* @click="openVerify" />
|
|
115
|
+
*/
|
|
116
|
+
const props = __props;
|
|
117
|
+
const emit = __emit;
|
|
118
|
+
/**
|
|
119
|
+
* Banner colours come from the design tokens so a rebrand carries through.
|
|
120
|
+
* `info` uses the primary ramp; `neutral` is the surface grey.
|
|
121
|
+
*/
|
|
122
|
+
const COLORS = {
|
|
123
|
+
info: "bg-primary-600 dark:bg-primary-700 text-white",
|
|
124
|
+
success: "bg-success-600 dark:bg-success-700 text-white",
|
|
125
|
+
warning: "bg-warning-500 dark:bg-warning-600 text-white",
|
|
126
|
+
error: "bg-error-600 dark:bg-error-700 text-white",
|
|
127
|
+
neutral: "bg-gray-800 dark:bg-gray-700 text-white"
|
|
128
|
+
};
|
|
129
|
+
const colorClass = computed(() => COLORS[props.color] || COLORS.info);
|
|
130
|
+
return (_ctx, _cache) => {
|
|
131
|
+
return openBlock(), createBlock(Transition, {
|
|
132
|
+
"enter-active-class": "transition-all duration-300 ease-out",
|
|
133
|
+
"enter-from-class": "max-h-0 opacity-0",
|
|
134
|
+
"enter-to-class": "max-h-24 opacity-100",
|
|
135
|
+
"leave-active-class": "transition-all duration-200 ease-in",
|
|
136
|
+
"leave-from-class": "max-h-24 opacity-100",
|
|
137
|
+
"leave-to-class": "max-h-0 opacity-0"
|
|
138
|
+
}, {
|
|
139
|
+
default: withCtx(() => [__props.show ? (openBlock(), createBlock(resolveDynamicComponent(__props.clickable ? "button" : "div"), {
|
|
140
|
+
key: 0,
|
|
141
|
+
class: normalizeClass(["w-full shrink-0 overflow-hidden text-xs font-medium", [colorClass.value, __props.clickable && "cursor-pointer text-left"]]),
|
|
142
|
+
style: normalizeStyle(__props.safeArea ? { paddingTop: "env(safe-area-inset-top, 0px)" } : void 0),
|
|
143
|
+
type: __props.clickable ? "button" : void 0,
|
|
144
|
+
role: "status",
|
|
145
|
+
onClick: _cache[1] || (_cache[1] = ($event) => __props.clickable && emit("click"))
|
|
146
|
+
}, {
|
|
147
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_1, [
|
|
148
|
+
__props.icon ? (openBlock(), createBlock(_sfc_main$1, {
|
|
149
|
+
key: 0,
|
|
150
|
+
name: __props.icon,
|
|
151
|
+
class: "w-3.5 h-3.5 shrink-0"
|
|
152
|
+
}, null, 8, ["name"])) : createCommentVNode("", true),
|
|
153
|
+
createElementVNode("span", null, [renderSlot(_ctx.$slots, "default", {}, () => [createTextVNode(toDisplayString(__props.message), 1)])]),
|
|
154
|
+
__props.dismissible ? (openBlock(), createElementBlock("button", {
|
|
155
|
+
key: 1,
|
|
156
|
+
type: "button",
|
|
157
|
+
class: "absolute right-3 inline-flex items-center opacity-80 hover:opacity-100",
|
|
158
|
+
"aria-label": __props.dismissLabel,
|
|
159
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(($event) => emit("dismiss"), ["stop"]))
|
|
160
|
+
}, [createVNode(_sfc_main$1, {
|
|
161
|
+
name: "mdi:close",
|
|
162
|
+
class: "w-3.5 h-3.5"
|
|
163
|
+
})], 8, _hoisted_2)) : createCommentVNode("", true)
|
|
164
|
+
])]),
|
|
165
|
+
_: 3
|
|
166
|
+
}, 8, [
|
|
167
|
+
"class",
|
|
168
|
+
"style",
|
|
169
|
+
"type"
|
|
170
|
+
])) : createCommentVNode("", true)]),
|
|
171
|
+
_: 3
|
|
172
|
+
});
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
//#endregion
|
|
177
|
+
export { _sfc_main as default };
|
|
178
|
+
|
|
179
|
+
//# sourceMappingURL=Banner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Banner.js","names":[],"sources":["../../src/components/Banner.vue"],"sourcesContent":["<template>\n <Transition\n enter-active-class=\"transition-all duration-300 ease-out\"\n enter-from-class=\"max-h-0 opacity-0\"\n enter-to-class=\"max-h-24 opacity-100\"\n leave-active-class=\"transition-all duration-200 ease-in\"\n leave-from-class=\"max-h-24 opacity-100\"\n leave-to-class=\"max-h-0 opacity-0\"\n >\n <component\n :is=\"clickable ? 'button' : 'div'\"\n v-if=\"show\"\n class=\"w-full shrink-0 overflow-hidden text-xs font-medium\"\n :class=\"[colorClass, clickable && 'cursor-pointer text-left']\"\n :style=\"safeArea ? { paddingTop: 'env(safe-area-inset-top, 0px)' } : undefined\"\n :type=\"clickable ? 'button' : undefined\"\n role=\"status\"\n @click=\"clickable && emit('click')\"\n >\n <div class=\"relative flex items-center justify-center gap-2 px-4 py-1.5\">\n <UiIcon v-if=\"icon\" :name=\"icon\" class=\"w-3.5 h-3.5 shrink-0\" />\n <span\n ><slot>{{ message }}</slot></span\n >\n\n <button\n v-if=\"dismissible\"\n type=\"button\"\n class=\"absolute right-3 inline-flex items-center opacity-80 hover:opacity-100\"\n :aria-label=\"dismissLabel\"\n @click.stop=\"emit('dismiss')\"\n >\n <UiIcon name=\"mdi:close\" class=\"w-3.5 h-3.5\" />\n </button>\n </div>\n </component>\n </Transition>\n</template>\n\n<script setup>\n/**\n * UiBanner — a full-width status strip that slides in above the content.\n *\n * The shape shared by \"you're offline\", \"your email isn't verified\" and \"a new\n * version is available\": a thin, edge-to-edge bar that expands into view, states\n * one thing with an optional icon, and collapses away when the condition clears.\n * Mount it permanently and drive `show` from the condition; the height/opacity\n * transition does the appearing and disappearing.\n *\n * It sits at the top of the layout, so it honours the top safe-area inset by\n * default — on a notched phone the padding keeps the text out from under the\n * status bar. Turn `safeArea` off for a banner that is not at the very top.\n *\n * Two optional affordances: `clickable` turns the whole bar into a button (for\n * \"tap here to verify\"), and `dismissible` adds a close control. They emit\n * `click` and `dismiss` respectively — the parent decides what those mean.\n *\n * Colour is a small semantic set rather than free-form, so banners stay\n * consistent across apps; pass `bg-*`/`text-*` classes to step outside it.\n *\n * @example Offline notice\n * <UiBanner :show=\"offline\" color=\"warning\" icon=\"mdi:wifi-off\"\n * message=\"You're offline — changes will sync when you reconnect\" />\n *\n * @example Tappable call to action\n * <UiBanner :show=\"!verified\" color=\"info\" icon=\"mdi:email-alert-outline\"\n * clickable message=\"Your email is not verified — tap here to verify\"\n * @click=\"openVerify\" />\n */\nimport { computed } from 'vue'\nimport UiIcon from '../icons/Icon.vue'\n\nconst props = defineProps({\n /**\n * Whether the banner is shown. Drive this from the condition it reports;\n * toggling it runs the slide-in / collapse-out transition.\n * @type {boolean}\n * @default false\n */\n show: { type: Boolean, default: false },\n\n /**\n * Colour of the bar.\n * @type {string}\n * @default 'info'\n * @values 'info' | 'success' | 'warning' | 'error' | 'neutral'\n */\n color: { type: String, default: 'info' },\n\n /**\n * Optional MDI icon shown before the message.\n * @type {string}\n * @default ''\n */\n icon: { type: String, default: '' },\n\n /**\n * Message text. Ignored when the default slot is used.\n * @type {string}\n * @default ''\n */\n message: { type: String, default: '' },\n\n /**\n * Makes the whole bar a button that emits `click`.\n * @type {boolean}\n * @default false\n */\n clickable: { type: Boolean, default: false },\n\n /**\n * Adds a close control that emits `dismiss`.\n * @type {boolean}\n * @default false\n */\n dismissible: { type: Boolean, default: false },\n\n /**\n * Accessible label for the dismiss control.\n * @type {string}\n * @default 'Dismiss'\n */\n dismissLabel: { type: String, default: 'Dismiss' },\n\n /**\n * Pads for the top safe-area inset, for a banner pinned to the top of the\n * screen. Turn off when the banner sits lower in the layout.\n * @type {boolean}\n * @default true\n */\n safeArea: { type: Boolean, default: true },\n})\n\nconst emit = defineEmits(['click', 'dismiss'])\n\n/**\n * Banner colours come from the design tokens so a rebrand carries through.\n * `info` uses the primary ramp; `neutral` is the surface grey.\n */\nconst COLORS = {\n info: 'bg-primary-600 dark:bg-primary-700 text-white',\n success: 'bg-success-600 dark:bg-success-700 text-white',\n warning: 'bg-warning-500 dark:bg-warning-600 text-white',\n error: 'bg-error-600 dark:bg-error-700 text-white',\n neutral: 'bg-gray-800 dark:bg-gray-700 text-white',\n}\n\nconst colorClass = computed(() => COLORS[props.color] || COLORS.info)\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwEA,MAAM,QAAQ;EA6Dd,MAAM,OAAO;;;;;EAMb,MAAM,SAAS;GACb,MAAM;GACN,SAAS;GACT,SAAS;GACT,OAAO;GACP,SAAS;EACX;EAEA,MAAM,aAAa,eAAe,OAAO,MAAM,UAAU,OAAO,IAAI;;GAlJlE,OAAA,UAAA,GAAA,YAmCa,YAAA;IAlCX,sBAAmB;IACnB,oBAAiB;IACjB,kBAAe;IACf,sBAAmB;IACnB,oBAAiB;IACjB,kBAAe;;IAEf,SAAA,cA0BY,CAxBJ,QAAA,QAFR,UAAA,GAAA,YA0BY,wBAzBL,QAAA,YAAS,WAAA,KAAA,GAAA;;KAEd,OAAK,eAAA,CAAC,uDAAqD,CAClD,WAAA,OAAY,QAAA,aAAS,0BAAA,CAAA,CAAA;KAC7B,OAAK,eAAE,QAAA,WAAQ,EAAA,YAAA,gCAAA,IAAqD,KAAA,CAAS;KAC7E,MAAM,QAAA,YAAS,WAAc,KAAA;KAC9B,MAAK;KACJ,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,QAAA,aAAa,KAAI,OAAA;;KAEzB,SAAA,cAeM,CAfN,mBAeM,OAfN,YAeM;MAdU,QAAA,QAAd,UAAA,GAAA,YAAgE,aAAA;;OAA3C,MAAM,QAAA;OAAM,OAAM;;MACvC,mBAEC,QAAA,MAAA,CADE,WAA0B,KAAA,QAAA,WAAA,CAAA,SAAA,CAAjB,gBAAA,gBAAA,QAAA,OAAO,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA;MAIX,QAAA,eADR,UAAA,GAAA,mBAQS,UAAA;;OANP,MAAK;OACL,OAAM;OACL,cAAY,QAAA;OACZ,SAAK,OAAA,OAAA,OAAA,KAAA,eAAA,WAAO,KAAI,SAAA,GAAA,CAAA,MAAA,CAAA;MAEjB,GAAA,CAAA,YAA+C,aAAA;OAAvC,MAAK;OAAY,OAAM"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import _sfc_main$1 from "../icons/Icon.js";
|
|
2
|
+
import { createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, normalizeClass, openBlock, ref, toDisplayString } from "vue";
|
|
3
|
+
//#region src/components/CodeBlock.vue
|
|
4
|
+
var _hoisted_1 = { class: "group relative" };
|
|
5
|
+
var _hoisted_2 = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "flex items-center justify-between rounded-t-xl border border-b-0 border-gray-200 bg-gray-50 px-4 py-2 text-xs font-medium text-gray-500 dark:border-gray-700 dark:bg-gray-800/60 dark:text-gray-400"
|
|
8
|
+
};
|
|
9
|
+
var _hoisted_3 = ["aria-label"];
|
|
10
|
+
var _sfc_main = {
|
|
11
|
+
__name: "CodeBlock",
|
|
12
|
+
props: {
|
|
13
|
+
/**
|
|
14
|
+
* The snippet text.
|
|
15
|
+
* @type {string}
|
|
16
|
+
*/
|
|
17
|
+
code: {
|
|
18
|
+
type: String,
|
|
19
|
+
required: true
|
|
20
|
+
},
|
|
21
|
+
/**
|
|
22
|
+
* Optional filename/language caption shown above the block.
|
|
23
|
+
* @type {string}
|
|
24
|
+
* @default ''
|
|
25
|
+
*/
|
|
26
|
+
label: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: ""
|
|
29
|
+
},
|
|
30
|
+
/**
|
|
31
|
+
* Label for the copy button in its resting state.
|
|
32
|
+
* @type {string}
|
|
33
|
+
* @default 'Copy'
|
|
34
|
+
*/
|
|
35
|
+
copyLabel: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: "Copy"
|
|
38
|
+
},
|
|
39
|
+
/**
|
|
40
|
+
* Label shown briefly after a successful copy.
|
|
41
|
+
* @type {string}
|
|
42
|
+
* @default 'Copied'
|
|
43
|
+
*/
|
|
44
|
+
copiedLabel: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: "Copied"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
setup(__props) {
|
|
50
|
+
/**
|
|
51
|
+
* UiCodeBlock — a static, copyable code snippet.
|
|
52
|
+
*
|
|
53
|
+
* For code that documents itself rather than runs: install commands, config,
|
|
54
|
+
* import statements. A copy button fades in on hover or keyboard focus, so it
|
|
55
|
+
* stays out of the way while reading and confirms with a tick for a moment after
|
|
56
|
+
* a successful copy. An optional `label` renders a filename/language caption
|
|
57
|
+
* across the top.
|
|
58
|
+
*
|
|
59
|
+
* The copy uses the async Clipboard API and fails silently if it is
|
|
60
|
+
* unavailable (an insecure context, or permission denied) — a docs snippet
|
|
61
|
+
* should never throw because the clipboard was blocked. The button's labels are
|
|
62
|
+
* props rather than fixed strings so the component carries no baked-in language.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* <UiCodeBlock label="Terminal" code="npm install numori-ui" />
|
|
66
|
+
*
|
|
67
|
+
* @example Localised button labels
|
|
68
|
+
* <UiCodeBlock :code="snippet" :copy-label="$t('ui.copy')" :copied-label="$t('ui.copied')" />
|
|
69
|
+
*/
|
|
70
|
+
const props = __props;
|
|
71
|
+
const copied = ref(false);
|
|
72
|
+
async function copy() {
|
|
73
|
+
try {
|
|
74
|
+
await navigator.clipboard.writeText(props.code);
|
|
75
|
+
copied.value = true;
|
|
76
|
+
setTimeout(() => {
|
|
77
|
+
copied.value = false;
|
|
78
|
+
}, 1600);
|
|
79
|
+
} catch {}
|
|
80
|
+
}
|
|
81
|
+
return (_ctx, _cache) => {
|
|
82
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
83
|
+
__props.label ? (openBlock(), createElementBlock("div", _hoisted_2, [createElementVNode("span", null, toDisplayString(__props.label), 1)])) : createCommentVNode("", true),
|
|
84
|
+
createElementVNode("button", {
|
|
85
|
+
type: "button",
|
|
86
|
+
class: normalizeClass(["absolute right-2 z-10 inline-flex items-center gap-1.5 rounded-lg border border-gray-200 bg-white/80 px-2.5 py-1.5 text-xs font-medium text-gray-600 opacity-0 backdrop-blur transition-all hover:bg-white hover:text-gray-900 focus-visible:opacity-100 group-hover:opacity-100 dark:border-gray-700 dark:bg-gray-800/80 dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-gray-100", __props.label ? "top-11" : "top-2"]),
|
|
87
|
+
"aria-label": copied.value ? __props.copiedLabel : __props.copyLabel,
|
|
88
|
+
onClick: copy
|
|
89
|
+
}, [createVNode(_sfc_main$1, {
|
|
90
|
+
name: copied.value ? "mdi:check" : "mdi:content-copy",
|
|
91
|
+
class: normalizeClass(["size-3.5", copied.value ? "text-success-600 dark:text-success-400" : ""])
|
|
92
|
+
}, null, 8, ["name", "class"]), createTextVNode(" " + toDisplayString(copied.value ? __props.copiedLabel : __props.copyLabel), 1)], 10, _hoisted_3),
|
|
93
|
+
createElementVNode("pre", { class: normalizeClass(["overflow-x-auto border border-gray-200 bg-gray-950 p-4 text-[13px] leading-relaxed text-gray-100 dark:border-gray-700", __props.label ? "rounded-b-xl" : "rounded-xl"]) }, [createElementVNode("code", null, toDisplayString(__props.code), 1)], 2)
|
|
94
|
+
]);
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
//#endregion
|
|
99
|
+
export { _sfc_main as default };
|
|
100
|
+
|
|
101
|
+
//# sourceMappingURL=CodeBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodeBlock.js","names":[],"sources":["../../src/components/CodeBlock.vue"],"sourcesContent":["<template>\n <div class=\"group relative\">\n <div\n v-if=\"label\"\n class=\"flex items-center justify-between rounded-t-xl border border-b-0 border-gray-200 bg-gray-50 px-4 py-2 text-xs font-medium text-gray-500 dark:border-gray-700 dark:bg-gray-800/60 dark:text-gray-400\"\n >\n <span>{{ label }}</span>\n </div>\n\n <button\n type=\"button\"\n class=\"absolute right-2 z-10 inline-flex items-center gap-1.5 rounded-lg border border-gray-200 bg-white/80 px-2.5 py-1.5 text-xs font-medium text-gray-600 opacity-0 backdrop-blur transition-all hover:bg-white hover:text-gray-900 focus-visible:opacity-100 group-hover:opacity-100 dark:border-gray-700 dark:bg-gray-800/80 dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-gray-100\"\n :class=\"label ? 'top-11' : 'top-2'\"\n :aria-label=\"copied ? copiedLabel : copyLabel\"\n @click=\"copy\"\n >\n <UiIcon\n :name=\"copied ? 'mdi:check' : 'mdi:content-copy'\"\n class=\"size-3.5\"\n :class=\"copied ? 'text-success-600 dark:text-success-400' : ''\"\n />\n {{ copied ? copiedLabel : copyLabel }}\n </button>\n\n <pre\n class=\"overflow-x-auto border border-gray-200 bg-gray-950 p-4 text-[13px] leading-relaxed text-gray-100 dark:border-gray-700\"\n :class=\"label ? 'rounded-b-xl' : 'rounded-xl'\"\n ><code>{{ code }}</code></pre>\n </div>\n</template>\n\n<script setup>\n/**\n * UiCodeBlock — a static, copyable code snippet.\n *\n * For code that documents itself rather than runs: install commands, config,\n * import statements. A copy button fades in on hover or keyboard focus, so it\n * stays out of the way while reading and confirms with a tick for a moment after\n * a successful copy. An optional `label` renders a filename/language caption\n * across the top.\n *\n * The copy uses the async Clipboard API and fails silently if it is\n * unavailable (an insecure context, or permission denied) — a docs snippet\n * should never throw because the clipboard was blocked. The button's labels are\n * props rather than fixed strings so the component carries no baked-in language.\n *\n * @example\n * <UiCodeBlock label=\"Terminal\" code=\"npm install numori-ui\" />\n *\n * @example Localised button labels\n * <UiCodeBlock :code=\"snippet\" :copy-label=\"$t('ui.copy')\" :copied-label=\"$t('ui.copied')\" />\n */\nimport { ref } from 'vue'\nimport UiIcon from '../icons/Icon.vue'\n\nconst props = defineProps({\n /**\n * The snippet text.\n * @type {string}\n */\n code: { type: String, required: true },\n\n /**\n * Optional filename/language caption shown above the block.\n * @type {string}\n * @default ''\n */\n label: { type: String, default: '' },\n\n /**\n * Label for the copy button in its resting state.\n * @type {string}\n * @default 'Copy'\n */\n copyLabel: { type: String, default: 'Copy' },\n\n /**\n * Label shown briefly after a successful copy.\n * @type {string}\n * @default 'Copied'\n */\n copiedLabel: { type: String, default: 'Copied' },\n})\n\nconst copied = ref(false)\n\nasync function copy() {\n try {\n await navigator.clipboard.writeText(props.code)\n copied.value = true\n setTimeout(() => {\n copied.value = false\n }, 1600)\n } catch {\n // Clipboard unavailable (insecure context or denied permission); ignore\n // rather than throw for a snippet whose whole job is to sit there and read.\n }\n}\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuDA,MAAM,QAAQ;EA6Bd,MAAM,SAAS,IAAI,KAAK;EAExB,eAAe,OAAO;GACpB,IAAI;IACF,MAAM,UAAU,UAAU,UAAU,MAAM,IAAI;IAC9C,OAAO,QAAQ;IACf,iBAAiB;KACf,OAAO,QAAQ;IACjB,GAAG,IAAI;GACT,QAAQ,CAGR;EACF;;GAhGE,OAAA,UAAA,GAAA,mBA2BM,OA3BN,YA2BM;IAzBI,QAAA,SADR,UAAA,GAAA,mBAKM,OALN,YAKM,CADJ,mBAAwB,QAAA,MAAA,gBAAf,QAAA,KAAK,GAAA,CAAA,CAAA,CAAA,KAAA,mBAAA,IAAA,IAAA;IAGhB,mBAaS,UAAA;KAZP,MAAK;KACL,OAAK,eAAA,CAAC,gYACE,QAAA,QAAK,WAAA,OAAA,CAAA;KACZ,cAAY,OAAA,QAAS,QAAA,cAAc,QAAA;KACnC,SAAO;IAER,GAAA,CAAA,YAIE,aAAA;KAHC,MAAM,OAAA,QAAM,cAAA;KACb,OAAK,eAAA,CAAC,YACE,OAAA,QAAM,2CAAA,EAAA,CAAA;IACd,GAAA,MAAA,GAAA,CAAA,QAAA,OAAA,CAAA,GAAA,gBAAA,MACF,gBAAG,OAAA,QAAS,QAAA,cAAc,QAAA,SAAS,GAAA,CAAA,CAAA,GAAA,IAAA,UAAA;IAGrC,mBAG8B,OAAA,EAF5B,OAAK,eAAA,CAAC,yHACE,QAAA,QAAK,iBAAA,YAAA,CAAA,EAAA,GAAA,CACd,mBAAuB,QAAA,MAAA,gBAAd,QAAA,IAAI,GAAA,CAAA,CAAA,GAAA,CAAA"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import _sfc_main$1 from "../icons/Icon.js";
|
|
2
|
+
import { Fragment, createElementBlock, createElementVNode, createTextVNode, createVNode, openBlock, renderList, toDisplayString } from "vue";
|
|
3
|
+
//#region src/components/ComparisonTable.vue
|
|
4
|
+
var _hoisted_1 = { class: "overflow-x-auto rounded-2xl border border-gray-200 dark:border-gray-700" };
|
|
5
|
+
var _hoisted_2 = { class: "w-full min-w-2xl border-collapse text-left text-sm" };
|
|
6
|
+
var _hoisted_3 = { class: "sr-only" };
|
|
7
|
+
var _hoisted_4 = { class: "border-b border-gray-200 dark:border-gray-700" };
|
|
8
|
+
var _hoisted_5 = {
|
|
9
|
+
scope: "col",
|
|
10
|
+
class: "px-5 py-4 font-semibold text-gray-500 dark:text-gray-400"
|
|
11
|
+
};
|
|
12
|
+
var _hoisted_6 = { class: "sr-only" };
|
|
13
|
+
var _hoisted_7 = {
|
|
14
|
+
scope: "col",
|
|
15
|
+
class: "w-2/5 bg-primary-50 px-5 py-4 font-semibold text-primary-800 dark:bg-primary-400/10 dark:text-primary-200"
|
|
16
|
+
};
|
|
17
|
+
var _hoisted_8 = {
|
|
18
|
+
scope: "col",
|
|
19
|
+
class: "w-2/5 px-5 py-4 font-semibold text-gray-600 dark:text-gray-300"
|
|
20
|
+
};
|
|
21
|
+
var _hoisted_9 = {
|
|
22
|
+
scope: "row",
|
|
23
|
+
class: "px-5 py-4 font-medium text-gray-900 dark:text-gray-100"
|
|
24
|
+
};
|
|
25
|
+
var _hoisted_10 = { class: "bg-primary-50/50 px-5 py-4 text-gray-700 dark:bg-primary-400/5 dark:text-gray-200" };
|
|
26
|
+
var _hoisted_11 = { class: "flex items-start gap-2" };
|
|
27
|
+
var _hoisted_12 = { class: "px-5 py-4 text-gray-600 dark:text-gray-400" };
|
|
28
|
+
var _hoisted_13 = { class: "flex items-start gap-2" };
|
|
29
|
+
var _sfc_main = {
|
|
30
|
+
__name: "ComparisonTable",
|
|
31
|
+
props: {
|
|
32
|
+
/**
|
|
33
|
+
* Table summary for assistive technology. Rendered visually hidden.
|
|
34
|
+
* @type {string}
|
|
35
|
+
*/
|
|
36
|
+
caption: {
|
|
37
|
+
type: String,
|
|
38
|
+
required: true
|
|
39
|
+
},
|
|
40
|
+
/**
|
|
41
|
+
* Rows to render. Each is `{ key?, feature, primary, secondary }`; `key`
|
|
42
|
+
* should be stable if present, and falls back to the row index.
|
|
43
|
+
* @type {Array<{ key?: string|number, feature: string, primary: string, secondary: string }>}
|
|
44
|
+
*/
|
|
45
|
+
rows: {
|
|
46
|
+
type: Array,
|
|
47
|
+
required: true
|
|
48
|
+
},
|
|
49
|
+
/**
|
|
50
|
+
* Heading for the accented (primary) column.
|
|
51
|
+
* @type {string}
|
|
52
|
+
*/
|
|
53
|
+
primaryLabel: {
|
|
54
|
+
type: String,
|
|
55
|
+
required: true
|
|
56
|
+
},
|
|
57
|
+
/**
|
|
58
|
+
* Heading for the comparison (secondary) column.
|
|
59
|
+
* @type {string}
|
|
60
|
+
*/
|
|
61
|
+
secondaryLabel: {
|
|
62
|
+
type: String,
|
|
63
|
+
required: true
|
|
64
|
+
},
|
|
65
|
+
/**
|
|
66
|
+
* Accessible name for the otherwise-blank first column.
|
|
67
|
+
* @type {string}
|
|
68
|
+
* @default 'Feature'
|
|
69
|
+
*/
|
|
70
|
+
featureLabel: {
|
|
71
|
+
type: String,
|
|
72
|
+
default: "Feature"
|
|
73
|
+
},
|
|
74
|
+
/**
|
|
75
|
+
* MDI icon marking each primary-column cell.
|
|
76
|
+
* @type {string}
|
|
77
|
+
* @default 'mdi:check-circle'
|
|
78
|
+
*/
|
|
79
|
+
primaryIcon: {
|
|
80
|
+
type: String,
|
|
81
|
+
default: "mdi:check-circle"
|
|
82
|
+
},
|
|
83
|
+
/**
|
|
84
|
+
* MDI icon marking each secondary-column cell.
|
|
85
|
+
* @type {string}
|
|
86
|
+
* @default 'mdi:minus-circle-outline'
|
|
87
|
+
*/
|
|
88
|
+
secondaryIcon: {
|
|
89
|
+
type: String,
|
|
90
|
+
default: "mdi:minus-circle-outline"
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
setup(__props) {
|
|
94
|
+
/**
|
|
95
|
+
* UiComparisonTable — a two-way, feature-by-feature comparison.
|
|
96
|
+
*
|
|
97
|
+
* A real `<table>`, not a grid of divs, because it is tabular data: the
|
|
98
|
+
* `<caption>`, `scope="col"` headers and `scope="row"` feature cells are what let
|
|
99
|
+
* a screen reader announce a whole row together ("Open source · yes · no")
|
|
100
|
+
* instead of reading three disconnected columns. The first (feature) column
|
|
101
|
+
* header is visually blank but named for assistive technology.
|
|
102
|
+
*
|
|
103
|
+
* The layout favours one column — the "primary" one is tinted with the accent —
|
|
104
|
+
* for the common "us versus the usual way" table. The leading icons are
|
|
105
|
+
* decorative; the cell text carries the meaning, so nothing depends on colour or
|
|
106
|
+
* glyph alone. It scrolls horizontally on narrow screens rather than crushing
|
|
107
|
+
* the columns.
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* <UiComparisonTable
|
|
111
|
+
* caption="How Numori compares"
|
|
112
|
+
* primary-label="Numori"
|
|
113
|
+
* secondary-label="The usual suite"
|
|
114
|
+
* feature-label="Feature"
|
|
115
|
+
* :rows="[
|
|
116
|
+
* { key: 'oss', feature: 'Open source', primary: 'Entire ecosystem', secondary: 'The client, sometimes' },
|
|
117
|
+
* { key: 'sync', feature: 'Sync', primary: 'End-to-end encrypted', secondary: 'Readable on the server' },
|
|
118
|
+
* ]"
|
|
119
|
+
* />
|
|
120
|
+
*/
|
|
121
|
+
return (_ctx, _cache) => {
|
|
122
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("table", _hoisted_2, [
|
|
123
|
+
createElementVNode("caption", _hoisted_3, toDisplayString(__props.caption), 1),
|
|
124
|
+
createElementVNode("thead", null, [createElementVNode("tr", _hoisted_4, [
|
|
125
|
+
createElementVNode("th", _hoisted_5, [createElementVNode("span", _hoisted_6, toDisplayString(__props.featureLabel), 1)]),
|
|
126
|
+
createElementVNode("th", _hoisted_7, toDisplayString(__props.primaryLabel), 1),
|
|
127
|
+
createElementVNode("th", _hoisted_8, toDisplayString(__props.secondaryLabel), 1)
|
|
128
|
+
])]),
|
|
129
|
+
createElementVNode("tbody", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.rows, (row, index) => {
|
|
130
|
+
return openBlock(), createElementBlock("tr", {
|
|
131
|
+
key: row.key ?? index,
|
|
132
|
+
class: "border-b border-gray-100 transition-colors duration-200 last:border-0 hover:bg-gray-50 dark:border-gray-800 dark:hover:bg-gray-900/60"
|
|
133
|
+
}, [
|
|
134
|
+
createElementVNode("th", _hoisted_9, toDisplayString(row.feature), 1),
|
|
135
|
+
createElementVNode("td", _hoisted_10, [createElementVNode("span", _hoisted_11, [createVNode(_sfc_main$1, {
|
|
136
|
+
name: __props.primaryIcon,
|
|
137
|
+
class: "mt-0.5 size-4 shrink-0 text-success-600 dark:text-success-400"
|
|
138
|
+
}, null, 8, ["name"]), createTextVNode(" " + toDisplayString(row.primary), 1)])]),
|
|
139
|
+
createElementVNode("td", _hoisted_12, [createElementVNode("span", _hoisted_13, [createVNode(_sfc_main$1, {
|
|
140
|
+
name: __props.secondaryIcon,
|
|
141
|
+
class: "mt-0.5 size-4 shrink-0 text-gray-400 dark:text-gray-500"
|
|
142
|
+
}, null, 8, ["name"]), createTextVNode(" " + toDisplayString(row.secondary), 1)])])
|
|
143
|
+
]);
|
|
144
|
+
}), 128))])
|
|
145
|
+
])]);
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
//#endregion
|
|
150
|
+
export { _sfc_main as default };
|
|
151
|
+
|
|
152
|
+
//# sourceMappingURL=ComparisonTable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComparisonTable.js","names":[],"sources":["../../src/components/ComparisonTable.vue"],"sourcesContent":["<template>\n <div class=\"overflow-x-auto rounded-2xl border border-gray-200 dark:border-gray-700\">\n <table class=\"w-full min-w-2xl border-collapse text-left text-sm\">\n <caption class=\"sr-only\">\n {{\n caption\n }}\n </caption>\n\n <thead>\n <tr class=\"border-b border-gray-200 dark:border-gray-700\">\n <th scope=\"col\" class=\"px-5 py-4 font-semibold text-gray-500 dark:text-gray-400\">\n <span class=\"sr-only\">{{ featureLabel }}</span>\n </th>\n <th\n scope=\"col\"\n class=\"w-2/5 bg-primary-50 px-5 py-4 font-semibold text-primary-800 dark:bg-primary-400/10 dark:text-primary-200\"\n >\n {{ primaryLabel }}\n </th>\n <th scope=\"col\" class=\"w-2/5 px-5 py-4 font-semibold text-gray-600 dark:text-gray-300\">\n {{ secondaryLabel }}\n </th>\n </tr>\n </thead>\n\n <tbody>\n <tr\n v-for=\"(row, index) in rows\"\n :key=\"row.key ?? index\"\n class=\"border-b border-gray-100 transition-colors duration-200 last:border-0 hover:bg-gray-50 dark:border-gray-800 dark:hover:bg-gray-900/60\"\n >\n <th scope=\"row\" class=\"px-5 py-4 font-medium text-gray-900 dark:text-gray-100\">\n {{ row.feature }}\n </th>\n\n <td\n class=\"bg-primary-50/50 px-5 py-4 text-gray-700 dark:bg-primary-400/5 dark:text-gray-200\"\n >\n <span class=\"flex items-start gap-2\">\n <UiIcon\n :name=\"primaryIcon\"\n class=\"mt-0.5 size-4 shrink-0 text-success-600 dark:text-success-400\"\n />\n {{ row.primary }}\n </span>\n </td>\n\n <td class=\"px-5 py-4 text-gray-600 dark:text-gray-400\">\n <span class=\"flex items-start gap-2\">\n <UiIcon\n :name=\"secondaryIcon\"\n class=\"mt-0.5 size-4 shrink-0 text-gray-400 dark:text-gray-500\"\n />\n {{ row.secondary }}\n </span>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n</template>\n\n<script setup>\n/**\n * UiComparisonTable — a two-way, feature-by-feature comparison.\n *\n * A real `<table>`, not a grid of divs, because it is tabular data: the\n * `<caption>`, `scope=\"col\"` headers and `scope=\"row\"` feature cells are what let\n * a screen reader announce a whole row together (\"Open source · yes · no\")\n * instead of reading three disconnected columns. The first (feature) column\n * header is visually blank but named for assistive technology.\n *\n * The layout favours one column — the \"primary\" one is tinted with the accent —\n * for the common \"us versus the usual way\" table. The leading icons are\n * decorative; the cell text carries the meaning, so nothing depends on colour or\n * glyph alone. It scrolls horizontally on narrow screens rather than crushing\n * the columns.\n *\n * @example\n * <UiComparisonTable\n * caption=\"How Numori compares\"\n * primary-label=\"Numori\"\n * secondary-label=\"The usual suite\"\n * feature-label=\"Feature\"\n * :rows=\"[\n * { key: 'oss', feature: 'Open source', primary: 'Entire ecosystem', secondary: 'The client, sometimes' },\n * { key: 'sync', feature: 'Sync', primary: 'End-to-end encrypted', secondary: 'Readable on the server' },\n * ]\"\n * />\n */\nimport UiIcon from '../icons/Icon.vue'\n\ndefineProps({\n /**\n * Table summary for assistive technology. Rendered visually hidden.\n * @type {string}\n */\n caption: { type: String, required: true },\n\n /**\n * Rows to render. Each is `{ key?, feature, primary, secondary }`; `key`\n * should be stable if present, and falls back to the row index.\n * @type {Array<{ key?: string|number, feature: string, primary: string, secondary: string }>}\n */\n rows: { type: Array, required: true },\n\n /**\n * Heading for the accented (primary) column.\n * @type {string}\n */\n primaryLabel: { type: String, required: true },\n\n /**\n * Heading for the comparison (secondary) column.\n * @type {string}\n */\n secondaryLabel: { type: String, required: true },\n\n /**\n * Accessible name for the otherwise-blank first column.\n * @type {string}\n * @default 'Feature'\n */\n featureLabel: { type: String, default: 'Feature' },\n\n /**\n * MDI icon marking each primary-column cell.\n * @type {string}\n * @default 'mdi:check-circle'\n */\n primaryIcon: { type: String, default: 'mdi:check-circle' },\n\n /**\n * MDI icon marking each secondary-column cell.\n * @type {string}\n * @default 'mdi:minus-circle-outline'\n */\n secondaryIcon: { type: String, default: 'mdi:minus-circle-outline' },\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GACE,OAAA,UAAA,GAAA,mBA2DM,OA3DN,YA2DM,CA1DJ,mBAyDQ,SAzDR,YAyDQ;IAxDN,mBAIU,WAJV,YAIU,gBAFN,QAAA,OAAO,GAAA,CAAA;IAIX,mBAeQ,SAAA,MAAA,CAdN,mBAaK,MAbL,YAaK;KAZH,mBAEK,MAFL,YAEK,CADH,mBAA+C,QAA/C,YAA+C,gBAAtB,QAAA,YAAY,GAAA,CAAA,CAAA,CAAA;KAEvC,mBAKK,MALL,YAKK,gBADA,QAAA,YAAY,GAAA,CAAA;KAEjB,mBAEK,MAFL,YAEK,gBADA,QAAA,cAAc,GAAA,CAAA;;IAKvB,mBAgCQ,SAAA,MAAA,EA/BN,UAAA,IAAA,GAAA,mBA8BK,UAAA,MAAA,WA7BoB,QAAA,OAAf,KAAK,UAAK;KADpB,OAAA,UAAA,GAAA,mBA8BK,MAAA;MA5BF,KAAK,IAAI,OAAO;MACjB,OAAM;;MAEN,mBAEK,MAFL,YAEK,gBADA,IAAI,OAAO,GAAA,CAAA;MAGhB,mBAUK,MAVL,aAUK,CAPH,mBAMO,QANP,aAMO,CALL,YAGE,aAAA;OAFC,MAAM,QAAA;OACP,OAAM;MACN,GAAA,MAAA,GAAA,CAAA,MAAA,CAAA,GAAA,gBAAA,MACF,gBAAG,IAAI,OAAO,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA;MAIlB,mBAQK,MARL,aAQK,CAPH,mBAMO,QANP,aAMO,CALL,YAGE,aAAA;OAFC,MAAM,QAAA;OACP,OAAM;MACN,GAAA,MAAA,GAAA,CAAA,MAAA,CAAA,GAAA,gBAAA,MACF,gBAAG,IAAI,SAAS,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA"}
|