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/dist/index.js CHANGED
@@ -1,43 +1,49 @@
1
1
  import { MDI_VIEW_BOX, mdiIconNames, mdiPaths } from "./icons/mdi.js";
2
2
  import { iconRegistry, registerIcons, resolveIconPath } from "./icons/registry.js";
3
3
  import { ICON_COMPONENT_KEY, provideIconComponent, useIconComponent } from "./icons/resolver.js";
4
- import _sfc_main$15 from "./icons/Icon.js";
4
+ import _sfc_main$18 from "./icons/Icon.js";
5
5
  import _sfc_main from "./components/Alert.js";
6
6
  import _sfc_main$1 from "./components/Avatar.js";
7
7
  import _sfc_main$2 from "./components/Badge.js";
8
- import _sfc_main$3 from "./components/Breadcrumb.js";
9
- import _sfc_main$4 from "./components/Button.js";
10
- import _sfc_main$5 from "./components/ButtonsGroup.js";
11
- import _sfc_main$6 from "./components/Card.js";
12
- import _sfc_main$7 from "./components/Checkbox.js";
13
- import _sfc_main$8 from "./components/Divider.js";
8
+ import _sfc_main$3 from "./components/Banner.js";
9
+ import _sfc_main$4 from "./components/Breadcrumb.js";
10
+ import _sfc_main$5 from "./components/Button.js";
11
+ import _sfc_main$6 from "./components/ButtonsGroup.js";
12
+ import _sfc_main$7 from "./components/Card.js";
13
+ import _sfc_main$8 from "./components/Checkbox.js";
14
+ import _sfc_main$9 from "./components/CodeBlock.js";
15
+ import _sfc_main$10 from "./components/ComparisonTable.js";
16
+ import _sfc_main$11 from "./components/Divider.js";
14
17
  import { useEventListener } from "./composables/useEventListener.js";
15
18
  import { onClickOutside } from "./composables/onClickOutside.js";
16
- import _sfc_main$9 from "./components/Dropdown.js";
17
- import _sfc_main$10 from "./components/DropdownItem.js";
18
- import _sfc_main$11 from "./components/DropdownRow.js";
19
- import _sfc_main$12 from "./components/DropdownSubmenu.js";
20
- import _sfc_main$13 from "./components/FileInput.js";
21
- import _sfc_main$14 from "./components/FormField.js";
22
- import _sfc_main$16 from "./components/IconTile.js";
23
- import _sfc_main$17 from "./components/Input.js";
24
- import _sfc_main$18 from "./components/Kbd.js";
25
- import _sfc_main$19 from "./components/ListMenu.js";
26
- import _sfc_main$20 from "./components/ListMenuItem.js";
19
+ import _sfc_main$12 from "./components/Dropdown.js";
20
+ import _sfc_main$13 from "./components/DropdownItem.js";
21
+ import _sfc_main$14 from "./components/DropdownRow.js";
22
+ import _sfc_main$15 from "./components/DropdownSubmenu.js";
23
+ import _sfc_main$16 from "./components/FileInput.js";
24
+ import _sfc_main$17 from "./components/FormField.js";
25
+ import _sfc_main$19 from "./components/IconTile.js";
26
+ import _sfc_main$20 from "./components/Input.js";
27
+ import _sfc_main$21 from "./components/Kbd.js";
28
+ import _sfc_main$22 from "./components/ListMenu.js";
29
+ import _sfc_main$23 from "./components/ListMenuItem.js";
27
30
  import { useBackButton } from "./composables/useBackButton.js";
28
- import _sfc_main$21 from "./components/Modal.js";
29
- import _sfc_main$22 from "./components/Numpad.js";
30
- import _sfc_main$23 from "./components/Popup.js";
31
- import _sfc_main$24 from "./components/ProgressBar.js";
32
- import _sfc_main$25 from "./components/Prompt.js";
33
- import _sfc_main$26 from "./components/Radio.js";
34
- import _sfc_main$27 from "./components/SectionHeading.js";
35
- import _sfc_main$28 from "./components/Segmented.js";
36
- import _sfc_main$29 from "./components/Select.js";
37
- import _sfc_main$30 from "./components/Slider.js";
38
- import _sfc_main$31 from "./components/Stepper.js";
39
- import _sfc_main$32 from "./components/Toggle.js";
40
- import _sfc_main$33 from "./components/Tooltip.js";
31
+ import _sfc_main$24 from "./components/Modal.js";
32
+ import _sfc_main$25 from "./components/Numpad.js";
33
+ import _sfc_main$26 from "./components/Popup.js";
34
+ import _sfc_main$27 from "./components/ProgressBar.js";
35
+ import _sfc_main$28 from "./components/Prompt.js";
36
+ import _sfc_main$29 from "./components/Radio.js";
37
+ import _sfc_main$30 from "./components/SectionHeading.js";
38
+ import _sfc_main$31 from "./components/Segmented.js";
39
+ import _sfc_main$32 from "./components/Select.js";
40
+ import _sfc_main$33 from "./components/Slider.js";
41
+ import _sfc_main$34 from "./components/Spinner.js";
42
+ import _sfc_main$35 from "./components/Stepper.js";
43
+ import _sfc_main$36 from "./components/ThemeToggle.js";
44
+ import _sfc_main$37 from "./components/Toast.js";
45
+ import _sfc_main$38 from "./components/Toggle.js";
46
+ import _sfc_main$39 from "./components/Tooltip.js";
41
47
  import { components } from "./components/index.js";
42
48
  import { COMPONENT_NAMES, DEFAULT_PREFIX, componentEntries, prefixed } from "./manifest.js";
43
49
  //#region src/index.js
@@ -157,6 +163,6 @@ function createNumoriUI(components = {}, options = {}) {
157
163
  } };
158
164
  }
159
165
  //#endregion
160
- export { COMPONENT_NAMES, DEFAULT_PREFIX, ICON_COMPONENT_KEY, MDI_VIEW_BOX, NumoriUI, NumoriUI as default, _sfc_main as UiAlert, _sfc_main$1 as UiAvatar, _sfc_main$2 as UiBadge, _sfc_main$3 as UiBreadcrumb, _sfc_main$4 as UiButton, _sfc_main$5 as UiButtonsGroup, _sfc_main$6 as UiCard, _sfc_main$7 as UiCheckbox, _sfc_main$8 as UiDivider, _sfc_main$9 as UiDropdown, _sfc_main$10 as UiDropdownItem, _sfc_main$11 as UiDropdownRow, _sfc_main$12 as UiDropdownSubmenu, _sfc_main$13 as UiFileInput, _sfc_main$14 as UiFormField, _sfc_main$15 as UiIcon, _sfc_main$16 as UiIconTile, _sfc_main$17 as UiInput, _sfc_main$18 as UiKbd, _sfc_main$19 as UiListMenu, _sfc_main$20 as UiListMenuItem, _sfc_main$21 as UiModal, _sfc_main$22 as UiNumpad, _sfc_main$23 as UiPopup, _sfc_main$24 as UiProgressBar, _sfc_main$25 as UiPrompt, _sfc_main$26 as UiRadio, _sfc_main$27 as UiSectionHeading, _sfc_main$28 as UiSegmented, _sfc_main$29 as UiSelect, _sfc_main$30 as UiSlider, _sfc_main$31 as UiStepper, _sfc_main$32 as UiToggle, _sfc_main$33 as UiTooltip, componentEntries, components, createNumoriUI, iconRegistry, mdiIconNames, mdiPaths, onClickOutside, prefixed, provideIconComponent, registerIcons, resolveIconPath, useBackButton, useEventListener, useIconComponent };
166
+ export { COMPONENT_NAMES, DEFAULT_PREFIX, ICON_COMPONENT_KEY, MDI_VIEW_BOX, NumoriUI, NumoriUI as default, _sfc_main as UiAlert, _sfc_main$1 as UiAvatar, _sfc_main$2 as UiBadge, _sfc_main$3 as UiBanner, _sfc_main$4 as UiBreadcrumb, _sfc_main$5 as UiButton, _sfc_main$6 as UiButtonsGroup, _sfc_main$7 as UiCard, _sfc_main$8 as UiCheckbox, _sfc_main$9 as UiCodeBlock, _sfc_main$10 as UiComparisonTable, _sfc_main$11 as UiDivider, _sfc_main$12 as UiDropdown, _sfc_main$13 as UiDropdownItem, _sfc_main$14 as UiDropdownRow, _sfc_main$15 as UiDropdownSubmenu, _sfc_main$16 as UiFileInput, _sfc_main$17 as UiFormField, _sfc_main$18 as UiIcon, _sfc_main$19 as UiIconTile, _sfc_main$20 as UiInput, _sfc_main$21 as UiKbd, _sfc_main$22 as UiListMenu, _sfc_main$23 as UiListMenuItem, _sfc_main$24 as UiModal, _sfc_main$25 as UiNumpad, _sfc_main$26 as UiPopup, _sfc_main$27 as UiProgressBar, _sfc_main$28 as UiPrompt, _sfc_main$29 as UiRadio, _sfc_main$30 as UiSectionHeading, _sfc_main$31 as UiSegmented, _sfc_main$32 as UiSelect, _sfc_main$33 as UiSlider, _sfc_main$34 as UiSpinner, _sfc_main$35 as UiStepper, _sfc_main$36 as UiThemeToggle, _sfc_main$37 as UiToast, _sfc_main$38 as UiToggle, _sfc_main$39 as UiTooltip, componentEntries, components, createNumoriUI, iconRegistry, mdiIconNames, mdiPaths, onClickOutside, prefixed, provideIconComponent, registerIcons, resolveIconPath, useBackButton, useEventListener, useIconComponent };
161
167
 
162
168
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/index.js"],"sourcesContent":["/**\n * Numori UI — the Numori design system as a standalone Vue 3 component library.\n *\n * This is the framework-agnostic entry point. It works in any Vue 3 app with\n * no build-tool integration at all:\n *\n * import { createApp } from 'vue'\n * import NumoriUI from 'numori-ui'\n * import './app.css' // @import \"tailwindcss\"; @import \"numori-ui/css\";\n *\n * createApp(App).use(NumoriUI).mount('#app')\n *\n * For a nicer developer experience there are two build-tool integrations that\n * register the components for you, so templates need no imports:\n *\n * - `numori-ui/nuxt` — a Nuxt module\n * - `numori-ui/vite` — a Vite plugin\n *\n * Styling is Tailwind CSS v4 and is deliberately NOT bundled as compiled CSS.\n * The components are plain utility classes, so they inherit the host app's\n * Tailwind build: one pass, one stylesheet, no duplication, and every token is\n * overridable. All the host has to do is import `numori-ui/css`, which supplies\n * the design tokens and tells Tailwind to scan this package for classes.\n */\n\nimport { components } from './components/index.js'\nimport { DEFAULT_PREFIX, prefixed } from './manifest.js'\nimport { ICON_COMPONENT_KEY } from './icons/resolver.js'\nimport { registerIcons } from './icons/registry.js'\n\nexport * from './components/index.js'\n\nexport { DEFAULT_PREFIX, COMPONENT_NAMES, componentEntries, prefixed } from './manifest.js'\nexport { registerIcons, iconRegistry, resolveIconPath } from './icons/registry.js'\nexport { provideIconComponent, useIconComponent, ICON_COMPONENT_KEY } from './icons/resolver.js'\nexport { MDI_VIEW_BOX, mdiPaths, mdiIconNames } from './icons/mdi.js'\nexport { useBackButton } from './composables/useBackButton.js'\nexport { onClickOutside } from './composables/onClickOutside.js'\nexport { useEventListener } from './composables/useEventListener.js'\n\n/**\n * Vue plugin that globally registers every Numori UI component.\n *\n * @type {import('vue').Plugin}\n *\n * @param {import('vue').App} app\n * @param {object} [options]\n * @param {string} [options.prefix='Ui']\n * Prefix for registered tags. `'Ui'` gives `<UiButton>`. Must be non-empty —\n * see the note in `install` for why.\n * @param {string[]} [options.include]\n * Register only these base names (e.g. `['Button', 'Modal']`). Note this\n * affects *global registration* only — it is not tree-shaking. To actually\n * drop unused components from the bundle, skip the plugin and import the\n * components you use directly.\n * @param {string[]} [options.exclude]\n * Skip these base names. Useful when the host has its own `<UiButton>`.\n * @param {object} [options.icons]\n * @param {import('vue').Component|string} [options.icons.component]\n * Render all icons with this component instead of the bundled inline SVGs.\n * Receives a `name` prop and must forward `class` to its root element.\n * @param {Record<string,string>} [options.icons.extra]\n * Extra icon path data to add to the bundled set, keyed by name.\n *\n * @example Default registration\n * app.use(NumoriUI)\n *\n * @example Custom prefix\n * app.use(NumoriUI, { prefix: 'N' }) // <NButton>\n *\n * @example Delegate icons to an existing icon component\n * app.use(NumoriUI, { icons: { component: MyIcon } })\n */\nexport const NumoriUI = {\n install(app, options = {}) {\n const { prefix = DEFAULT_PREFIX, include, exclude = [], icons = {} } = options\n\n // An empty prefix is rejected rather than merely discouraged. `Button`\n // renders its root as `<component :is=\"tag\">` with `tag` defaulting to\n // `'button'`, and Vue's dynamic-component lookup capitalises before\n // matching — so a globally registered `Button` would resolve `'button'`\n // back to itself and recurse until the stack blows. The failure is a bare\n // \"Maximum call stack size exceeded\" with no hint of the cause, so it is\n // much kinder to refuse up front.\n if (typeof prefix !== 'string' || prefix.length === 0) {\n throw new Error(\n '[numori-ui] `prefix` must be a non-empty string. Registering components under their ' +\n 'bare names would make <Button> resolve its own native `button` root element, ' +\n 'recursing infinitely. Use a prefix such as \"Ui\" or \"N\".',\n )\n }\n\n if (icons.extra) registerIcons(icons.extra)\n // app-level provide, so it reaches every component including those\n // teleported out of the tree (modals, select panels).\n if (icons.component) app.provide(ICON_COMPONENT_KEY, icons.component)\n\n for (const [name, component] of Object.entries(components)) {\n if (include && !include.includes(name)) continue\n if (exclude.includes(name)) continue\n app.component(prefixed(name, prefix), component)\n }\n },\n}\n\nexport default NumoriUI\n\n/**\n * Build a Vue plugin that globally registers only the components you hand it.\n *\n * `NumoriUI` is convenient but it is not tree-shakeable: to register everything\n * it has to reference everything, so `app.use(NumoriUI)` puts all 29 components\n * in your bundle (~82 kB) whether you render them or not. The `include` option\n * does not change that — it controls registration, not bundling.\n *\n * This factory is the way to get both. You import the components you want, so\n * the bundler sees exactly that set and drops the rest, and you still get global\n * tags instead of importing them into every file.\n *\n * Keys become the registered tag names verbatim, so no prefix option is needed\n * and there is no naming magic — rename in the object literal if you want a\n * different tag.\n *\n * @param {Record<string, import('vue').Component>} components\n * Map of tag name to component, e.g. `{ UiButton, UiModal }`.\n * @param {object} [options]\n * @param {object} [options.icons] Same shape as the `NumoriUI` plugin's option.\n * @returns {import('vue').Plugin}\n *\n * @example Global tags, but only two components bundled\n * import { createNumoriUI, UiButton, UiModal } from 'numori-ui'\n *\n * app.use(createNumoriUI({ UiButton, UiModal }))\n *\n * @example Registering under different tag names\n * app.use(createNumoriUI({ NButton: UiButton, NModal: UiModal }))\n */\nexport function createNumoriUI(components = {}, options = {}) {\n const { icons = {} } = options\n\n // `UiButton` renders its root as `<component :is=\"tag\">`, and Vue capitalises\n // when resolving a dynamic component. Registering it under a name that\n // case-insensitively matches one of those tags would make it resolve itself\n // and recurse until the stack overflows, reported only as \"Maximum call stack\n // size exceeded\". Cheap to catch here, miserable to debug later.\n const DYNAMIC_TAGS = ['button', 'a', 'div', 'span', 'label', 'li']\n for (const name of Object.keys(components)) {\n if (DYNAMIC_TAGS.includes(name.toLowerCase())) {\n throw new Error(\n `[numori-ui] Cannot register a component as \"${name}\": it collides with the native <${name.toLowerCase()}> ` +\n 'element that UiButton can render as its root, which would recurse infinitely. ' +\n `Use a prefixed name such as \"Ui${name}\".`,\n )\n }\n }\n\n return {\n install(app) {\n if (icons.extra) registerIcons(icons.extra)\n if (icons.component) app.provide(ICON_COMPONENT_KEY, icons.component)\n\n for (const [name, component] of Object.entries(components)) {\n app.component(name, component)\n }\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyEA,IAAa,WAAW,EACtB,QAAQ,KAAK,UAAU,CAAC,GAAG;CACzB,MAAM,EAAE,SAAA,MAAyB,SAAS,UAAU,CAAC,GAAG,QAAQ,CAAC,MAAM;CASvE,IAAI,OAAO,WAAW,YAAY,OAAO,WAAW,GAClD,MAAM,IAAI,MACR,8NAGF;CAGF,IAAI,MAAM,OAAO,cAAc,MAAM,KAAK;CAG1C,IAAI,MAAM,WAAW,IAAI,QAAQ,oBAAoB,MAAM,SAAS;CAEpE,KAAK,MAAM,CAAC,MAAM,cAAc,OAAO,QAAQ,UAAU,GAAG;EAC1D,IAAI,WAAW,CAAC,QAAQ,SAAS,IAAI,GAAG;EACxC,IAAI,QAAQ,SAAS,IAAI,GAAG;EAC5B,IAAI,UAAU,SAAS,MAAM,MAAM,GAAG,SAAS;CACjD;AACF,EACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,SAAgB,eAAe,aAAa,CAAC,GAAG,UAAU,CAAC,GAAG;CAC5D,MAAM,EAAE,QAAQ,CAAC,MAAM;CAOvB,MAAM,eAAe;EAAC;EAAU;EAAK;EAAO;EAAQ;EAAS;CAAI;CACjE,KAAK,MAAM,QAAQ,OAAO,KAAK,UAAU,GACvC,IAAI,aAAa,SAAS,KAAK,YAAY,CAAC,GAC1C,MAAM,IAAI,MACR,+CAA+C,KAAK,kCAAkC,KAAK,YAAY,EAAE,iHAErE,KAAK,GAC3C;CAIJ,OAAO,EACL,QAAQ,KAAK;EACX,IAAI,MAAM,OAAO,cAAc,MAAM,KAAK;EAC1C,IAAI,MAAM,WAAW,IAAI,QAAQ,oBAAoB,MAAM,SAAS;EAEpE,KAAK,MAAM,CAAC,MAAM,cAAc,OAAO,QAAQ,UAAU,GACvD,IAAI,UAAU,MAAM,SAAS;CAEjC,EACF;AACF"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.js"],"sourcesContent":["/**\n * Numori UI — the Numori design system as a standalone Vue 3 component library.\n *\n * This is the framework-agnostic entry point. It works in any Vue 3 app with\n * no build-tool integration at all:\n *\n * import { createApp } from 'vue'\n * import NumoriUI from 'numori-ui'\n * import './app.css' // @import \"tailwindcss\"; @import \"numori-ui/css\";\n *\n * createApp(App).use(NumoriUI).mount('#app')\n *\n * For a nicer developer experience there are two build-tool integrations that\n * register the components for you, so templates need no imports:\n *\n * - `numori-ui/nuxt` — a Nuxt module\n * - `numori-ui/vite` — a Vite plugin\n *\n * Styling is Tailwind CSS v4 and is deliberately NOT bundled as compiled CSS.\n * The components are plain utility classes, so they inherit the host app's\n * Tailwind build: one pass, one stylesheet, no duplication, and every token is\n * overridable. All the host has to do is import `numori-ui/css`, which supplies\n * the design tokens and tells Tailwind to scan this package for classes.\n */\n\nimport { components } from './components/index.js'\nimport { DEFAULT_PREFIX, prefixed } from './manifest.js'\nimport { ICON_COMPONENT_KEY } from './icons/resolver.js'\nimport { registerIcons } from './icons/registry.js'\n\nexport * from './components/index.js'\n\nexport { DEFAULT_PREFIX, COMPONENT_NAMES, componentEntries, prefixed } from './manifest.js'\nexport { registerIcons, iconRegistry, resolveIconPath } from './icons/registry.js'\nexport { provideIconComponent, useIconComponent, ICON_COMPONENT_KEY } from './icons/resolver.js'\nexport { MDI_VIEW_BOX, mdiPaths, mdiIconNames } from './icons/mdi.js'\nexport { useBackButton } from './composables/useBackButton.js'\nexport { onClickOutside } from './composables/onClickOutside.js'\nexport { useEventListener } from './composables/useEventListener.js'\n\n/**\n * Vue plugin that globally registers every Numori UI component.\n *\n * @type {import('vue').Plugin}\n *\n * @param {import('vue').App} app\n * @param {object} [options]\n * @param {string} [options.prefix='Ui']\n * Prefix for registered tags. `'Ui'` gives `<UiButton>`. Must be non-empty —\n * see the note in `install` for why.\n * @param {string[]} [options.include]\n * Register only these base names (e.g. `['Button', 'Modal']`). Note this\n * affects *global registration* only — it is not tree-shaking. To actually\n * drop unused components from the bundle, skip the plugin and import the\n * components you use directly.\n * @param {string[]} [options.exclude]\n * Skip these base names. Useful when the host has its own `<UiButton>`.\n * @param {object} [options.icons]\n * @param {import('vue').Component|string} [options.icons.component]\n * Render all icons with this component instead of the bundled inline SVGs.\n * Receives a `name` prop and must forward `class` to its root element.\n * @param {Record<string,string>} [options.icons.extra]\n * Extra icon path data to add to the bundled set, keyed by name.\n *\n * @example Default registration\n * app.use(NumoriUI)\n *\n * @example Custom prefix\n * app.use(NumoriUI, { prefix: 'N' }) // <NButton>\n *\n * @example Delegate icons to an existing icon component\n * app.use(NumoriUI, { icons: { component: MyIcon } })\n */\nexport const NumoriUI = {\n install(app, options = {}) {\n const { prefix = DEFAULT_PREFIX, include, exclude = [], icons = {} } = options\n\n // An empty prefix is rejected rather than merely discouraged. `Button`\n // renders its root as `<component :is=\"tag\">` with `tag` defaulting to\n // `'button'`, and Vue's dynamic-component lookup capitalises before\n // matching — so a globally registered `Button` would resolve `'button'`\n // back to itself and recurse until the stack blows. The failure is a bare\n // \"Maximum call stack size exceeded\" with no hint of the cause, so it is\n // much kinder to refuse up front.\n if (typeof prefix !== 'string' || prefix.length === 0) {\n throw new Error(\n '[numori-ui] `prefix` must be a non-empty string. Registering components under their ' +\n 'bare names would make <Button> resolve its own native `button` root element, ' +\n 'recursing infinitely. Use a prefix such as \"Ui\" or \"N\".',\n )\n }\n\n if (icons.extra) registerIcons(icons.extra)\n // app-level provide, so it reaches every component including those\n // teleported out of the tree (modals, select panels).\n if (icons.component) app.provide(ICON_COMPONENT_KEY, icons.component)\n\n for (const [name, component] of Object.entries(components)) {\n if (include && !include.includes(name)) continue\n if (exclude.includes(name)) continue\n app.component(prefixed(name, prefix), component)\n }\n },\n}\n\nexport default NumoriUI\n\n/**\n * Build a Vue plugin that globally registers only the components you hand it.\n *\n * `NumoriUI` is convenient but it is not tree-shakeable: to register everything\n * it has to reference everything, so `app.use(NumoriUI)` puts all 29 components\n * in your bundle (~82 kB) whether you render them or not. The `include` option\n * does not change that — it controls registration, not bundling.\n *\n * This factory is the way to get both. You import the components you want, so\n * the bundler sees exactly that set and drops the rest, and you still get global\n * tags instead of importing them into every file.\n *\n * Keys become the registered tag names verbatim, so no prefix option is needed\n * and there is no naming magic — rename in the object literal if you want a\n * different tag.\n *\n * @param {Record<string, import('vue').Component>} components\n * Map of tag name to component, e.g. `{ UiButton, UiModal }`.\n * @param {object} [options]\n * @param {object} [options.icons] Same shape as the `NumoriUI` plugin's option.\n * @returns {import('vue').Plugin}\n *\n * @example Global tags, but only two components bundled\n * import { createNumoriUI, UiButton, UiModal } from 'numori-ui'\n *\n * app.use(createNumoriUI({ UiButton, UiModal }))\n *\n * @example Registering under different tag names\n * app.use(createNumoriUI({ NButton: UiButton, NModal: UiModal }))\n */\nexport function createNumoriUI(components = {}, options = {}) {\n const { icons = {} } = options\n\n // `UiButton` renders its root as `<component :is=\"tag\">`, and Vue capitalises\n // when resolving a dynamic component. Registering it under a name that\n // case-insensitively matches one of those tags would make it resolve itself\n // and recurse until the stack overflows, reported only as \"Maximum call stack\n // size exceeded\". Cheap to catch here, miserable to debug later.\n const DYNAMIC_TAGS = ['button', 'a', 'div', 'span', 'label', 'li']\n for (const name of Object.keys(components)) {\n if (DYNAMIC_TAGS.includes(name.toLowerCase())) {\n throw new Error(\n `[numori-ui] Cannot register a component as \"${name}\": it collides with the native <${name.toLowerCase()}> ` +\n 'element that UiButton can render as its root, which would recurse infinitely. ' +\n `Use a prefixed name such as \"Ui${name}\".`,\n )\n }\n }\n\n return {\n install(app) {\n if (icons.extra) registerIcons(icons.extra)\n if (icons.component) app.provide(ICON_COMPONENT_KEY, icons.component)\n\n for (const [name, component] of Object.entries(components)) {\n app.component(name, component)\n }\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyEA,IAAa,WAAW,EACtB,QAAQ,KAAK,UAAU,CAAC,GAAG;CACzB,MAAM,EAAE,SAAA,MAAyB,SAAS,UAAU,CAAC,GAAG,QAAQ,CAAC,MAAM;CASvE,IAAI,OAAO,WAAW,YAAY,OAAO,WAAW,GAClD,MAAM,IAAI,MACR,8NAGF;CAGF,IAAI,MAAM,OAAO,cAAc,MAAM,KAAK;CAG1C,IAAI,MAAM,WAAW,IAAI,QAAQ,oBAAoB,MAAM,SAAS;CAEpE,KAAK,MAAM,CAAC,MAAM,cAAc,OAAO,QAAQ,UAAU,GAAG;EAC1D,IAAI,WAAW,CAAC,QAAQ,SAAS,IAAI,GAAG;EACxC,IAAI,QAAQ,SAAS,IAAI,GAAG;EAC5B,IAAI,UAAU,SAAS,MAAM,MAAM,GAAG,SAAS;CACjD;AACF,EACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,SAAgB,eAAe,aAAa,CAAC,GAAG,UAAU,CAAC,GAAG;CAC5D,MAAM,EAAE,QAAQ,CAAC,MAAM;CAOvB,MAAM,eAAe;EAAC;EAAU;EAAK;EAAO;EAAQ;EAAS;CAAI;CACjE,KAAK,MAAM,QAAQ,OAAO,KAAK,UAAU,GACvC,IAAI,aAAa,SAAS,KAAK,YAAY,CAAC,GAC1C,MAAM,IAAI,MACR,+CAA+C,KAAK,kCAAkC,KAAK,YAAY,EAAE,iHAErE,KAAK,GAC3C;CAIJ,OAAO,EACL,QAAQ,KAAK;EACX,IAAI,MAAM,OAAO,cAAc,MAAM,KAAK;EAC1C,IAAI,MAAM,WAAW,IAAI,QAAQ,oBAAoB,MAAM,SAAS;EAEpE,KAAK,MAAM,CAAC,MAAM,cAAc,OAAO,QAAQ,UAAU,GACvD,IAAI,UAAU,MAAM,SAAS;CAEjC,EACF;AACF"}
package/dist/manifest.js CHANGED
@@ -22,11 +22,14 @@ var COMPONENT_NAMES = [
22
22
  "Alert",
23
23
  "Avatar",
24
24
  "Badge",
25
+ "Banner",
25
26
  "Breadcrumb",
26
27
  "Button",
27
28
  "ButtonsGroup",
28
29
  "Card",
29
30
  "Checkbox",
31
+ "CodeBlock",
32
+ "ComparisonTable",
30
33
  "Divider",
31
34
  "Dropdown",
32
35
  "DropdownItem",
@@ -49,7 +52,10 @@ var COMPONENT_NAMES = [
49
52
  "Segmented",
50
53
  "Select",
51
54
  "Slider",
55
+ "Spinner",
52
56
  "Stepper",
57
+ "ThemeToggle",
58
+ "Toast",
53
59
  "Toggle",
54
60
  "Tooltip"
55
61
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.js","names":[],"sources":["../src/manifest.js"],"sourcesContent":["/**\n * Component manifest — the single list of what Numori UI ships.\n *\n * Kept as plain data (no imports) so it can be consumed by things that must\n * not pull Vue or any `.vue` file into their graph: the Nuxt module and the\n * Vite plugin both run in Node at config time and only need names and paths.\n *\n * `src/components/index.js` holds the matching real imports for bundling. The\n * two are cross-checked by `scripts/verify.mjs`, so a component added in one\n * place and forgotten in the other fails the build rather than shipping\n * half-registered.\n */\n\n/** Default prefix for registered component names, e.g. `Ui` -> `<UiButton>`. */\nexport const DEFAULT_PREFIX = 'Ui'\n\n/**\n * Base names of every shipped component, without prefix or extension.\n * Order is alphabetical, matching the files on disk.\n * @type {string[]}\n */\nexport const COMPONENT_NAMES = [\n 'Alert',\n 'Avatar',\n 'Badge',\n 'Breadcrumb',\n 'Button',\n 'ButtonsGroup',\n 'Card',\n 'Checkbox',\n 'Divider',\n 'Dropdown',\n 'DropdownItem',\n 'DropdownRow',\n 'DropdownSubmenu',\n 'FileInput',\n 'FormField',\n 'IconTile',\n 'Input',\n 'Kbd',\n 'ListMenu',\n 'ListMenuItem',\n 'Modal',\n 'Numpad',\n 'Popup',\n 'ProgressBar',\n 'Prompt',\n 'Radio',\n 'SectionHeading',\n 'Segmented',\n 'Select',\n 'Slider',\n 'Stepper',\n 'Toggle',\n 'Tooltip',\n]\n\n/**\n * The icon component is listed separately: it lives outside `components/`\n * because it is the framework seam rather than a UI primitive, and the other\n * components import it directly by path.\n */\nexport const ICON_COMPONENT = { name: 'Icon', file: 'icons/Icon.vue' }\n\n/**\n * Every registerable component as `{ name, file }`, where `file` is relative\n * to `src/`. Includes the icon component.\n * @returns {Array<{ name: string, file: string }>}\n */\nexport function componentEntries() {\n return [\n ...COMPONENT_NAMES.map((name) => ({ name, file: `components/${name}.vue` })),\n ICON_COMPONENT,\n ]\n}\n\n/**\n * Apply a prefix to a base component name.\n *\n * The prefix must be non-empty; the entry points validate this. Registering\n * bare names breaks `Button`, whose root is `<component :is=\"tag\">` with `tag`\n * defaulting to `'button'` — Vue capitalises when resolving dynamic components,\n * so a registered `Button` would match its own root element and recurse.\n *\n * @param {string} name Base name, e.g. 'Button'.\n * @param {string} [prefix=DEFAULT_PREFIX] Prefix to apply, e.g. 'Ui' or 'N'.\n * @returns {string} e.g. 'UiButton'\n */\nexport function prefixed(name, prefix = DEFAULT_PREFIX) {\n return `${prefix || ''}${name}`\n}\n"],"mappings":";;;;;;;;;;;;;;AAcA,IAAa,iBAAiB;;;;;;AAO9B,IAAa,kBAAkB;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;;;;AAOA,IAAa,iBAAiB;CAAE,MAAM;CAAQ,MAAM;AAAiB;;;;;;AAOrE,SAAgB,mBAAmB;CACjC,OAAO,CACL,GAAG,gBAAgB,KAAK,UAAU;EAAE;EAAM,MAAM,cAAc,KAAK;CAAM,EAAE,GAC3E,cACF;AACF;;;;;;;;;;;;;AAcA,SAAgB,SAAS,MAAM,SAAA,MAAyB;CACtD,OAAO,GAAG,UAAU,KAAK;AAC3B"}
1
+ {"version":3,"file":"manifest.js","names":[],"sources":["../src/manifest.js"],"sourcesContent":["/**\n * Component manifest — the single list of what Numori UI ships.\n *\n * Kept as plain data (no imports) so it can be consumed by things that must\n * not pull Vue or any `.vue` file into their graph: the Nuxt module and the\n * Vite plugin both run in Node at config time and only need names and paths.\n *\n * `src/components/index.js` holds the matching real imports for bundling. The\n * two are cross-checked by `scripts/verify.mjs`, so a component added in one\n * place and forgotten in the other fails the build rather than shipping\n * half-registered.\n */\n\n/** Default prefix for registered component names, e.g. `Ui` -> `<UiButton>`. */\nexport const DEFAULT_PREFIX = 'Ui'\n\n/**\n * Base names of every shipped component, without prefix or extension.\n * Order is alphabetical, matching the files on disk.\n * @type {string[]}\n */\nexport const COMPONENT_NAMES = [\n 'Alert',\n 'Avatar',\n 'Badge',\n 'Banner',\n 'Breadcrumb',\n 'Button',\n 'ButtonsGroup',\n 'Card',\n 'Checkbox',\n 'CodeBlock',\n 'ComparisonTable',\n 'Divider',\n 'Dropdown',\n 'DropdownItem',\n 'DropdownRow',\n 'DropdownSubmenu',\n 'FileInput',\n 'FormField',\n 'IconTile',\n 'Input',\n 'Kbd',\n 'ListMenu',\n 'ListMenuItem',\n 'Modal',\n 'Numpad',\n 'Popup',\n 'ProgressBar',\n 'Prompt',\n 'Radio',\n 'SectionHeading',\n 'Segmented',\n 'Select',\n 'Slider',\n 'Spinner',\n 'Stepper',\n 'ThemeToggle',\n 'Toast',\n 'Toggle',\n 'Tooltip',\n]\n\n/**\n * The icon component is listed separately: it lives outside `components/`\n * because it is the framework seam rather than a UI primitive, and the other\n * components import it directly by path.\n */\nexport const ICON_COMPONENT = { name: 'Icon', file: 'icons/Icon.vue' }\n\n/**\n * Every registerable component as `{ name, file }`, where `file` is relative\n * to `src/`. Includes the icon component.\n * @returns {Array<{ name: string, file: string }>}\n */\nexport function componentEntries() {\n return [\n ...COMPONENT_NAMES.map((name) => ({ name, file: `components/${name}.vue` })),\n ICON_COMPONENT,\n ]\n}\n\n/**\n * Apply a prefix to a base component name.\n *\n * The prefix must be non-empty; the entry points validate this. Registering\n * bare names breaks `Button`, whose root is `<component :is=\"tag\">` with `tag`\n * defaulting to `'button'` — Vue capitalises when resolving dynamic components,\n * so a registered `Button` would match its own root element and recurse.\n *\n * @param {string} name Base name, e.g. 'Button'.\n * @param {string} [prefix=DEFAULT_PREFIX] Prefix to apply, e.g. 'Ui' or 'N'.\n * @returns {string} e.g. 'UiButton'\n */\nexport function prefixed(name, prefix = DEFAULT_PREFIX) {\n return `${prefix || ''}${name}`\n}\n"],"mappings":";;;;;;;;;;;;;;AAcA,IAAa,iBAAiB;;;;;;AAO9B,IAAa,kBAAkB;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;;;;AAOA,IAAa,iBAAiB;CAAE,MAAM;CAAQ,MAAM;AAAiB;;;;;;AAOrE,SAAgB,mBAAmB;CACjC,OAAO,CACL,GAAG,gBAAgB,KAAK,UAAU;EAAE;EAAM,MAAM,cAAc,KAAK;CAAM,EAAE,GAC3E,cACF;AACF;;;;;;;;;;;;;AAcA,SAAgB,SAAS,MAAM,SAAA,MAAyB;CACtD,OAAO,GAAG,UAAU,KAAK;AAC3B"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "numori-ui",
3
3
  "type": "module",
4
- "version": "0.2.0",
4
+ "version": "0.3.0",
5
5
  "description": "The Numori design system — a Tailwind 4 Vue 3 component library, consumable as a Nuxt module or a Vite plugin.",
6
6
  "author": {
7
7
  "name": "Erik Bjerke",
@@ -0,0 +1,149 @@
1
+ <template>
2
+ <Transition
3
+ enter-active-class="transition-all duration-300 ease-out"
4
+ enter-from-class="max-h-0 opacity-0"
5
+ enter-to-class="max-h-24 opacity-100"
6
+ leave-active-class="transition-all duration-200 ease-in"
7
+ leave-from-class="max-h-24 opacity-100"
8
+ leave-to-class="max-h-0 opacity-0"
9
+ >
10
+ <component
11
+ :is="clickable ? 'button' : 'div'"
12
+ v-if="show"
13
+ class="w-full shrink-0 overflow-hidden text-xs font-medium"
14
+ :class="[colorClass, clickable && 'cursor-pointer text-left']"
15
+ :style="safeArea ? { paddingTop: 'env(safe-area-inset-top, 0px)' } : undefined"
16
+ :type="clickable ? 'button' : undefined"
17
+ role="status"
18
+ @click="clickable && emit('click')"
19
+ >
20
+ <div class="relative flex items-center justify-center gap-2 px-4 py-1.5">
21
+ <UiIcon v-if="icon" :name="icon" class="w-3.5 h-3.5 shrink-0" />
22
+ <span
23
+ ><slot>{{ message }}</slot></span
24
+ >
25
+
26
+ <button
27
+ v-if="dismissible"
28
+ type="button"
29
+ class="absolute right-3 inline-flex items-center opacity-80 hover:opacity-100"
30
+ :aria-label="dismissLabel"
31
+ @click.stop="emit('dismiss')"
32
+ >
33
+ <UiIcon name="mdi:close" class="w-3.5 h-3.5" />
34
+ </button>
35
+ </div>
36
+ </component>
37
+ </Transition>
38
+ </template>
39
+
40
+ <script setup>
41
+ /**
42
+ * UiBanner — a full-width status strip that slides in above the content.
43
+ *
44
+ * The shape shared by "you're offline", "your email isn't verified" and "a new
45
+ * version is available": a thin, edge-to-edge bar that expands into view, states
46
+ * one thing with an optional icon, and collapses away when the condition clears.
47
+ * Mount it permanently and drive `show` from the condition; the height/opacity
48
+ * transition does the appearing and disappearing.
49
+ *
50
+ * It sits at the top of the layout, so it honours the top safe-area inset by
51
+ * default — on a notched phone the padding keeps the text out from under the
52
+ * status bar. Turn `safeArea` off for a banner that is not at the very top.
53
+ *
54
+ * Two optional affordances: `clickable` turns the whole bar into a button (for
55
+ * "tap here to verify"), and `dismissible` adds a close control. They emit
56
+ * `click` and `dismiss` respectively — the parent decides what those mean.
57
+ *
58
+ * Colour is a small semantic set rather than free-form, so banners stay
59
+ * consistent across apps; pass `bg-*`/`text-*` classes to step outside it.
60
+ *
61
+ * @example Offline notice
62
+ * <UiBanner :show="offline" color="warning" icon="mdi:wifi-off"
63
+ * message="You're offline — changes will sync when you reconnect" />
64
+ *
65
+ * @example Tappable call to action
66
+ * <UiBanner :show="!verified" color="info" icon="mdi:email-alert-outline"
67
+ * clickable message="Your email is not verified — tap here to verify"
68
+ * @click="openVerify" />
69
+ */
70
+ import { computed } from 'vue'
71
+ import UiIcon from '../icons/Icon.vue'
72
+
73
+ const props = defineProps({
74
+ /**
75
+ * Whether the banner is shown. Drive this from the condition it reports;
76
+ * toggling it runs the slide-in / collapse-out transition.
77
+ * @type {boolean}
78
+ * @default false
79
+ */
80
+ show: { type: Boolean, default: false },
81
+
82
+ /**
83
+ * Colour of the bar.
84
+ * @type {string}
85
+ * @default 'info'
86
+ * @values 'info' | 'success' | 'warning' | 'error' | 'neutral'
87
+ */
88
+ color: { type: String, default: 'info' },
89
+
90
+ /**
91
+ * Optional MDI icon shown before the message.
92
+ * @type {string}
93
+ * @default ''
94
+ */
95
+ icon: { type: String, default: '' },
96
+
97
+ /**
98
+ * Message text. Ignored when the default slot is used.
99
+ * @type {string}
100
+ * @default ''
101
+ */
102
+ message: { type: String, default: '' },
103
+
104
+ /**
105
+ * Makes the whole bar a button that emits `click`.
106
+ * @type {boolean}
107
+ * @default false
108
+ */
109
+ clickable: { type: Boolean, default: false },
110
+
111
+ /**
112
+ * Adds a close control that emits `dismiss`.
113
+ * @type {boolean}
114
+ * @default false
115
+ */
116
+ dismissible: { type: Boolean, default: false },
117
+
118
+ /**
119
+ * Accessible label for the dismiss control.
120
+ * @type {string}
121
+ * @default 'Dismiss'
122
+ */
123
+ dismissLabel: { type: String, default: 'Dismiss' },
124
+
125
+ /**
126
+ * Pads for the top safe-area inset, for a banner pinned to the top of the
127
+ * screen. Turn off when the banner sits lower in the layout.
128
+ * @type {boolean}
129
+ * @default true
130
+ */
131
+ safeArea: { type: Boolean, default: true },
132
+ })
133
+
134
+ const emit = defineEmits(['click', 'dismiss'])
135
+
136
+ /**
137
+ * Banner colours come from the design tokens so a rebrand carries through.
138
+ * `info` uses the primary ramp; `neutral` is the surface grey.
139
+ */
140
+ const COLORS = {
141
+ info: 'bg-primary-600 dark:bg-primary-700 text-white',
142
+ success: 'bg-success-600 dark:bg-success-700 text-white',
143
+ warning: 'bg-warning-500 dark:bg-warning-600 text-white',
144
+ error: 'bg-error-600 dark:bg-error-700 text-white',
145
+ neutral: 'bg-gray-800 dark:bg-gray-700 text-white',
146
+ }
147
+
148
+ const colorClass = computed(() => COLORS[props.color] || COLORS.info)
149
+ </script>
@@ -0,0 +1,99 @@
1
+ <template>
2
+ <div class="group relative">
3
+ <div
4
+ v-if="label"
5
+ 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"
6
+ >
7
+ <span>{{ label }}</span>
8
+ </div>
9
+
10
+ <button
11
+ type="button"
12
+ 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"
13
+ :class="label ? 'top-11' : 'top-2'"
14
+ :aria-label="copied ? copiedLabel : copyLabel"
15
+ @click="copy"
16
+ >
17
+ <UiIcon
18
+ :name="copied ? 'mdi:check' : 'mdi:content-copy'"
19
+ class="size-3.5"
20
+ :class="copied ? 'text-success-600 dark:text-success-400' : ''"
21
+ />
22
+ {{ copied ? copiedLabel : copyLabel }}
23
+ </button>
24
+
25
+ <pre
26
+ class="overflow-x-auto border border-gray-200 bg-gray-950 p-4 text-[13px] leading-relaxed text-gray-100 dark:border-gray-700"
27
+ :class="label ? 'rounded-b-xl' : 'rounded-xl'"
28
+ ><code>{{ code }}</code></pre>
29
+ </div>
30
+ </template>
31
+
32
+ <script setup>
33
+ /**
34
+ * UiCodeBlock — a static, copyable code snippet.
35
+ *
36
+ * For code that documents itself rather than runs: install commands, config,
37
+ * import statements. A copy button fades in on hover or keyboard focus, so it
38
+ * stays out of the way while reading and confirms with a tick for a moment after
39
+ * a successful copy. An optional `label` renders a filename/language caption
40
+ * across the top.
41
+ *
42
+ * The copy uses the async Clipboard API and fails silently if it is
43
+ * unavailable (an insecure context, or permission denied) — a docs snippet
44
+ * should never throw because the clipboard was blocked. The button's labels are
45
+ * props rather than fixed strings so the component carries no baked-in language.
46
+ *
47
+ * @example
48
+ * <UiCodeBlock label="Terminal" code="npm install numori-ui" />
49
+ *
50
+ * @example Localised button labels
51
+ * <UiCodeBlock :code="snippet" :copy-label="$t('ui.copy')" :copied-label="$t('ui.copied')" />
52
+ */
53
+ import { ref } from 'vue'
54
+ import UiIcon from '../icons/Icon.vue'
55
+
56
+ const props = defineProps({
57
+ /**
58
+ * The snippet text.
59
+ * @type {string}
60
+ */
61
+ code: { type: String, required: true },
62
+
63
+ /**
64
+ * Optional filename/language caption shown above the block.
65
+ * @type {string}
66
+ * @default ''
67
+ */
68
+ label: { type: String, default: '' },
69
+
70
+ /**
71
+ * Label for the copy button in its resting state.
72
+ * @type {string}
73
+ * @default 'Copy'
74
+ */
75
+ copyLabel: { type: String, default: 'Copy' },
76
+
77
+ /**
78
+ * Label shown briefly after a successful copy.
79
+ * @type {string}
80
+ * @default 'Copied'
81
+ */
82
+ copiedLabel: { type: String, default: 'Copied' },
83
+ })
84
+
85
+ const copied = ref(false)
86
+
87
+ async function copy() {
88
+ try {
89
+ await navigator.clipboard.writeText(props.code)
90
+ copied.value = true
91
+ setTimeout(() => {
92
+ copied.value = false
93
+ }, 1600)
94
+ } catch {
95
+ // Clipboard unavailable (insecure context or denied permission); ignore
96
+ // rather than throw for a snippet whose whole job is to sit there and read.
97
+ }
98
+ }
99
+ </script>
@@ -0,0 +1,141 @@
1
+ <template>
2
+ <div class="overflow-x-auto rounded-2xl border border-gray-200 dark:border-gray-700">
3
+ <table class="w-full min-w-2xl border-collapse text-left text-sm">
4
+ <caption class="sr-only">
5
+ {{
6
+ caption
7
+ }}
8
+ </caption>
9
+
10
+ <thead>
11
+ <tr class="border-b border-gray-200 dark:border-gray-700">
12
+ <th scope="col" class="px-5 py-4 font-semibold text-gray-500 dark:text-gray-400">
13
+ <span class="sr-only">{{ featureLabel }}</span>
14
+ </th>
15
+ <th
16
+ scope="col"
17
+ 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"
18
+ >
19
+ {{ primaryLabel }}
20
+ </th>
21
+ <th scope="col" class="w-2/5 px-5 py-4 font-semibold text-gray-600 dark:text-gray-300">
22
+ {{ secondaryLabel }}
23
+ </th>
24
+ </tr>
25
+ </thead>
26
+
27
+ <tbody>
28
+ <tr
29
+ v-for="(row, index) in rows"
30
+ :key="row.key ?? index"
31
+ 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"
32
+ >
33
+ <th scope="row" class="px-5 py-4 font-medium text-gray-900 dark:text-gray-100">
34
+ {{ row.feature }}
35
+ </th>
36
+
37
+ <td
38
+ class="bg-primary-50/50 px-5 py-4 text-gray-700 dark:bg-primary-400/5 dark:text-gray-200"
39
+ >
40
+ <span class="flex items-start gap-2">
41
+ <UiIcon
42
+ :name="primaryIcon"
43
+ class="mt-0.5 size-4 shrink-0 text-success-600 dark:text-success-400"
44
+ />
45
+ {{ row.primary }}
46
+ </span>
47
+ </td>
48
+
49
+ <td class="px-5 py-4 text-gray-600 dark:text-gray-400">
50
+ <span class="flex items-start gap-2">
51
+ <UiIcon
52
+ :name="secondaryIcon"
53
+ class="mt-0.5 size-4 shrink-0 text-gray-400 dark:text-gray-500"
54
+ />
55
+ {{ row.secondary }}
56
+ </span>
57
+ </td>
58
+ </tr>
59
+ </tbody>
60
+ </table>
61
+ </div>
62
+ </template>
63
+
64
+ <script setup>
65
+ /**
66
+ * UiComparisonTable — a two-way, feature-by-feature comparison.
67
+ *
68
+ * A real `<table>`, not a grid of divs, because it is tabular data: the
69
+ * `<caption>`, `scope="col"` headers and `scope="row"` feature cells are what let
70
+ * a screen reader announce a whole row together ("Open source · yes · no")
71
+ * instead of reading three disconnected columns. The first (feature) column
72
+ * header is visually blank but named for assistive technology.
73
+ *
74
+ * The layout favours one column — the "primary" one is tinted with the accent —
75
+ * for the common "us versus the usual way" table. The leading icons are
76
+ * decorative; the cell text carries the meaning, so nothing depends on colour or
77
+ * glyph alone. It scrolls horizontally on narrow screens rather than crushing
78
+ * the columns.
79
+ *
80
+ * @example
81
+ * <UiComparisonTable
82
+ * caption="How Numori compares"
83
+ * primary-label="Numori"
84
+ * secondary-label="The usual suite"
85
+ * feature-label="Feature"
86
+ * :rows="[
87
+ * { key: 'oss', feature: 'Open source', primary: 'Entire ecosystem', secondary: 'The client, sometimes' },
88
+ * { key: 'sync', feature: 'Sync', primary: 'End-to-end encrypted', secondary: 'Readable on the server' },
89
+ * ]"
90
+ * />
91
+ */
92
+ import UiIcon from '../icons/Icon.vue'
93
+
94
+ defineProps({
95
+ /**
96
+ * Table summary for assistive technology. Rendered visually hidden.
97
+ * @type {string}
98
+ */
99
+ caption: { type: String, required: true },
100
+
101
+ /**
102
+ * Rows to render. Each is `{ key?, feature, primary, secondary }`; `key`
103
+ * should be stable if present, and falls back to the row index.
104
+ * @type {Array<{ key?: string|number, feature: string, primary: string, secondary: string }>}
105
+ */
106
+ rows: { type: Array, required: true },
107
+
108
+ /**
109
+ * Heading for the accented (primary) column.
110
+ * @type {string}
111
+ */
112
+ primaryLabel: { type: String, required: true },
113
+
114
+ /**
115
+ * Heading for the comparison (secondary) column.
116
+ * @type {string}
117
+ */
118
+ secondaryLabel: { type: String, required: true },
119
+
120
+ /**
121
+ * Accessible name for the otherwise-blank first column.
122
+ * @type {string}
123
+ * @default 'Feature'
124
+ */
125
+ featureLabel: { type: String, default: 'Feature' },
126
+
127
+ /**
128
+ * MDI icon marking each primary-column cell.
129
+ * @type {string}
130
+ * @default 'mdi:check-circle'
131
+ */
132
+ primaryIcon: { type: String, default: 'mdi:check-circle' },
133
+
134
+ /**
135
+ * MDI icon marking each secondary-column cell.
136
+ * @type {string}
137
+ * @default 'mdi:minus-circle-outline'
138
+ */
139
+ secondaryIcon: { type: String, default: 'mdi:minus-circle-outline' },
140
+ })
141
+ </script>
@@ -0,0 +1,70 @@
1
+ <template>
2
+ <UiIcon
3
+ :name="icon"
4
+ class="animate-spin"
5
+ :class="sizeClass"
6
+ :aria-hidden="label ? undefined : 'true'"
7
+ :aria-label="label || undefined"
8
+ :role="label ? 'status' : undefined"
9
+ />
10
+ </template>
11
+
12
+ <script setup>
13
+ /**
14
+ * UiSpinner — a spinning icon for loading and in-progress states.
15
+ *
16
+ * The same glyph `UiButton` shows while loading, pulled out as a standalone
17
+ * primitive so anything can signal work in progress without reaching for a
18
+ * button or hand-rolling `animate-spin`. Colour is inherited (`text-*`), exactly
19
+ * like `UiIcon`, so a spinner tints to match whatever surrounds it.
20
+ *
21
+ * By default it is decorative and hidden from assistive technology, which is
22
+ * right when a nearby label already says what is happening ("Saving…" next to
23
+ * it). Give it a `label` and it becomes a live `role="status"` region that
24
+ * announces on its own — use that when the spinner is the only thing on screen.
25
+ *
26
+ * @example Inline, decorative
27
+ * <UiSpinner />
28
+ *
29
+ * @example Larger, tinted, and self-announcing
30
+ * <UiSpinner size="lg" label="Syncing" class="text-primary-600 dark:text-primary-400" />
31
+ */
32
+ import { computed } from 'vue'
33
+ import UiIcon from '../icons/Icon.vue'
34
+
35
+ const props = defineProps({
36
+ /**
37
+ * Diameter of the spinner.
38
+ * @type {string}
39
+ * @default 'md'
40
+ * @values 'xs' | 'sm' | 'md' | 'lg' | 'xl'
41
+ */
42
+ size: { type: String, default: 'md' },
43
+
44
+ /**
45
+ * Accessible label. When set, the spinner is announced as a live status
46
+ * region; when omitted, it is hidden from assistive technology as decorative.
47
+ * @type {string}
48
+ * @default ''
49
+ */
50
+ label: { type: String, default: '' },
51
+
52
+ /**
53
+ * MDI icon to spin. The default is the same one `UiButton` uses; pass another
54
+ * (e.g. `'mdi:sync'`) for a different look.
55
+ * @type {string}
56
+ * @default 'mdi:loading'
57
+ */
58
+ icon: { type: String, default: 'mdi:loading' },
59
+ })
60
+
61
+ const SIZES = {
62
+ xs: 'w-3 h-3',
63
+ sm: 'w-3.5 h-3.5',
64
+ md: 'w-5 h-5',
65
+ lg: 'w-6 h-6',
66
+ xl: 'w-8 h-8',
67
+ }
68
+
69
+ const sizeClass = computed(() => SIZES[props.size] || SIZES.md)
70
+ </script>