diff --git a/.github/workflows/ci-dev.yml b/.github/workflows/ci-dev.yml
index d3884791..29f70cda 100644
--- a/.github/workflows/ci-dev.yml
+++ b/.github/workflows/ci-dev.yml
@@ -52,12 +52,12 @@ jobs:
- name: Lint
run: pnpm run lint
- - name: Build
- run: pnpm run build
-
- name: Typecheck
run: pnpm run typecheck
+ - name: Build
+ run: pnpm run build
+
- name: Release Edge
if: github.event_name == 'push'
run: ./scripts/release-edge.sh
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index a2724ddc..8c1cd78d 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -52,12 +52,12 @@ jobs:
- name: Lint
run: pnpm run lint
- - name: Build
- run: pnpm run build
-
- name: Typecheck
run: pnpm run typecheck
+ - name: Build
+ run: pnpm run build
+
- name: Version Check
id: check
uses: EndBug/version-check@v2
diff --git a/.nuxtrc b/.nuxtrc
new file mode 100644
index 00000000..87857b2a
--- /dev/null
+++ b/.nuxtrc
@@ -0,0 +1,3 @@
+imports.autoImport=false
+typescript.includeWorkspace=true
+typescript.strict=false
diff --git a/docs/.nuxtrc b/docs/.nuxtrc
new file mode 100644
index 00000000..109361b8
--- /dev/null
+++ b/docs/.nuxtrc
@@ -0,0 +1 @@
+imports.autoImport=true
diff --git a/docs/components/Footer.vue b/docs/components/Footer.vue
index 3a19b92d..d899d5df 100644
--- a/docs/components/Footer.vue
+++ b/docs/components/Footer.vue
@@ -24,10 +24,14 @@
-
-
-
-
+
+
+
+
+
+
diff --git a/docs/components/Header.vue b/docs/components/Header.vue
index ed1369a5..708e816e 100644
--- a/docs/components/Header.vue
+++ b/docs/components/Header.vue
@@ -27,7 +27,7 @@
icon="i-simple-icons-github"
aria-label="GitHub"
class="hidden lg:inline-flex"
- v-bind="$elements.button.secondary"
+ v-bind="($elements.button.secondary as any)"
/>
diff --git a/docs/components/content/examples/VerticalNavigationExampleAvatarSlot.vue b/docs/components/content/examples/VerticalNavigationExampleAvatarSlot.vue
index 32f4585e..02ded2cf 100644
--- a/docs/components/content/examples/VerticalNavigationExampleAvatarSlot.vue
+++ b/docs/components/content/examples/VerticalNavigationExampleAvatarSlot.vue
@@ -27,8 +27,6 @@ const links = [{
to: 'https://github.com/smarroufin',
target: '_blank'
}]
-
-const { ui } = useAppConfig()
@@ -36,8 +34,8 @@ const { ui } = useAppConfig()
diff --git a/docs/content/1.getting-started/3.theming.md b/docs/content/1.getting-started/3.theming.md
index e3266cd3..3fc1f39f 100644
--- a/docs/content/1.getting-started/3.theming.md
+++ b/docs/content/1.getting-started/3.theming.md
@@ -1,5 +1,7 @@
---
description: 'Learn how to customize the look and feel of the components.'
+navigation:
+ badge: New
---
## Overview
@@ -79,7 +81,7 @@ This can also happen when you bind a dynamic color to a component: `
- ...
-
+
```
This will smartly replace the `font-medium` by `font-semibold` and prevent any class duplication and any class priority issue.
+You can change this behaviour by setting `strategy` to `override` inside the `ui` prop: :u-badge{label="New" class="!rounded-full" variant="subtle"}
+
+```vue
+
+```
+
### `class` attribute
You can also use the `class` attribute to add classes to the component.
diff --git a/docs/content/5.navigation/1.vertical-navigation.md b/docs/content/5.navigation/1.vertical-navigation.md
index 5a224629..ea5cecf6 100644
--- a/docs/content/5.navigation/1.vertical-navigation.md
+++ b/docs/content/5.navigation/1.vertical-navigation.md
@@ -125,8 +125,6 @@ const links = [{
to: 'https://github.com/benjamincanac',
target: '_blank'
}, ...]
-
-const { ui } = useAppConfig()
@@ -134,8 +132,8 @@ const { ui } = useAppConfig()
diff --git a/docs/nuxt.config.ts b/docs/nuxt.config.ts
index 64c7d691..f79e5c29 100644
--- a/docs/nuxt.config.ts
+++ b/docs/nuxt.config.ts
@@ -76,10 +76,6 @@ export default defineNuxtConfig({
exposed: false
}
},
- typescript: {
- strict: false,
- includeWorkspace: true
- },
hooks: {
// Related to https://github.com/nuxt/nuxt/pull/22558
'components:extend': (components) => {
diff --git a/docs/package.json b/docs/package.json
index c4c6fb72..185fd8cd 100644
--- a/docs/package.json
+++ b/docs/package.json
@@ -10,7 +10,7 @@
"@nuxt/content": "npm:@nuxt/content-edge@2.8.2-28246255.cae34d7",
"@nuxt/devtools": "^0.8.3",
"@nuxt/eslint-config": "^0.2.0",
- "@nuxthq/elements": "npm:@nuxthq/elements-edge@0.0.1-28246521.0e46d44",
+ "@nuxthq/elements": "npm:@nuxthq/elements-edge@0.0.1-28253627.e4bd6ad",
"@nuxthq/studio": "^0.14.1",
"@nuxtjs/fontaine": "^0.4.1",
"@nuxtjs/google-fonts": "^3.0.2",
diff --git a/package.json b/package.json
index c8a82d9b..a9ee9c25 100644
--- a/package.json
+++ b/package.json
@@ -25,8 +25,8 @@
"build:docs": "nuxi generate docs",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
- "typecheck": "nuxi typecheck",
- "prepare": "nuxi prepare docs",
+ "typecheck": "vue-tsc --noEmit && nuxi typecheck docs",
+ "prepare": "nuxt-module-build --stub && nuxt-module-build prepare && nuxi prepare docs",
"release": "release-it"
},
"dependencies": {
@@ -45,9 +45,10 @@
"@vueuse/integrations": "^10.4.1",
"@vueuse/math": "^10.4.1",
"defu": "^6.1.2",
- "ohash": "^1.1.3",
- "scule": "^1.0.0",
"fuse.js": "^6.6.2",
+ "ohash": "^1.1.3",
+ "pathe": "^1.1.1",
+ "scule": "^1.0.0",
"tailwind-merge": "^1.14.0",
"tailwindcss": "^3.3.3"
},
@@ -61,9 +62,9 @@
"release-it": "^16.1.5",
"typescript": "^5.2.2",
"unbuild": "^2.0.0",
+ "valibot": "^0.15.0",
"vue-tsc": "^1.8.11",
"yup": "^1.2.0",
- "zod": "^3.22.2",
- "valibot": "^0.15.0"
+ "zod": "^3.22.2"
}
}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index f14f8d7b..7fa0418d 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -59,6 +59,9 @@ importers:
ohash:
specifier: ^1.1.3
version: 1.1.3
+ pathe:
+ specifier: ^1.1.1
+ version: 1.1.1
scule:
specifier: ^1.0.0
version: 1.0.0
@@ -120,7 +123,7 @@ importers:
version: 1.1.12
'@iconify-json/simple-icons':
specifier: latest
- version: 1.1.70
+ version: 1.1.71
'@nuxt/content':
specifier: npm:@nuxt/content-edge@2.8.2-28246255.cae34d7
version: /@nuxt/content-edge@2.8.2-28246255.cae34d7(rollup@3.28.1)(vue@3.3.4)
@@ -131,8 +134,8 @@ importers:
specifier: ^0.2.0
version: 0.2.0(eslint@8.49.0)
'@nuxthq/elements':
- specifier: npm:@nuxthq/elements-edge@0.0.1-28246521.0e46d44
- version: /@nuxthq/elements-edge@0.0.1-28246521.0e46d44(rollup@3.28.1)(vue@3.3.4)(webpack@5.88.2)
+ specifier: npm:@nuxthq/elements-edge@0.0.1-28253627.e4bd6ad
+ version: /@nuxthq/elements-edge@0.0.1-28253627.e4bd6ad(rollup@3.28.1)(vue@3.3.4)(webpack@5.88.2)
'@nuxthq/studio':
specifier: ^0.14.1
version: 0.14.1(rollup@3.28.1)
@@ -1061,8 +1064,8 @@ packages:
dependencies:
'@iconify/types': 2.0.0
- /@iconify-json/simple-icons@1.1.70:
- resolution: {integrity: sha512-YZoHn180s0PELhjlMMTMVG8FxQOfP3AIn7P6KNV8xONzt/GwqMkYQ92DNYZbvSyQ4NhRajm27YkaOeSwNusr7A==}
+ /@iconify-json/simple-icons@1.1.71:
+ resolution: {integrity: sha512-3WVgJTaWBUOvq4G99v3Qs46zqnOJGNVMMlKCw+p8/gfbVz9mEAiwiqfGr+mpraotuwvUuQoJMi4SyseO8qjYDQ==}
dependencies:
'@iconify/types': 2.0.0
dev: true
@@ -1748,8 +1751,8 @@ packages:
- vue-tsc
dev: true
- /@nuxthq/elements-edge@0.0.1-28246521.0e46d44(rollup@3.28.1)(vue@3.3.4)(webpack@5.88.2):
- resolution: {integrity: sha512-8MU2WXawTcZFpaAOuz0WYDBR8fjblH6UTS9wlXz3qNRya15wOAH62a7VNfdy2xsE8Rlmv1DeuIVFZnIO24Rmbw==}
+ /@nuxthq/elements-edge@0.0.1-28253627.e4bd6ad(rollup@3.28.1)(vue@3.3.4)(webpack@5.88.2):
+ resolution: {integrity: sha512-y7ujX/dr4CcmY1JilTjpU++IEN5+9NrdeQseC8+OvLE3rHE0/5d9KWusa+0y+o5z3NjM3mzupSYraBWoH8/qvQ==}
dependencies:
'@nuxt/ui': 2.8.1(rollup@3.28.1)(vue@3.3.4)(webpack@5.88.2)
'@vueuse/core': 10.4.1(vue@3.3.4)
@@ -7050,6 +7053,7 @@ packages:
/jiti@1.19.3:
resolution: {integrity: sha512-5eEbBDQT/jF1xg6l36P+mWGGoH9Spuy0PCdSr2dtWRDGC6ph/w9ZCL4lmESW8f8F7MwT3XKescfP0wnZWAKL9w==}
hasBin: true
+ dev: true
/jiti@1.20.0:
resolution: {integrity: sha512-3TV69ZbrvV6U5DfQimop50jE9Dl6J8O1ja1dvBbMba/sZ3YBEQqJ2VZRoQPVnhlzjNtU1vaXRZVrVjU4qtm8yA==}
@@ -11191,7 +11195,7 @@ packages:
fast-glob: 3.3.1
glob-parent: 6.0.2
is-glob: 4.0.3
- jiti: 1.19.3
+ jiti: 1.20.0
lilconfig: 2.1.0
micromatch: 4.0.5
normalize-path: 3.0.0
diff --git a/src/module.ts b/src/module.ts
index 39e7ccf5..369eaa3b 100644
--- a/src/module.ts
+++ b/src/module.ts
@@ -1,12 +1,12 @@
-import { defineNuxtModule, installModule, addComponentsDir, addImportsDir, createResolver, addPlugin, resolvePath } from '@nuxt/kit'
+import { defineNuxtModule, installModule, addComponentsDir, addImportsDir, createResolver, addPlugin } from '@nuxt/kit'
import defaultColors from 'tailwindcss/colors.js'
import { defaultExtractor as createDefaultExtractor } from 'tailwindcss/lib/lib/defaultExtractor.js'
import { iconsPlugin, getIconCollections } from '@egoist/tailwindcss-icons'
import { name, version } from '../package.json'
import { generateSafelist, excludeColors, customSafelistExtractor } from './colors'
-import appConfig from './runtime/app.config'
-
-type DeepPartial = Partial<{ [P in keyof T]: DeepPartial | { [key: string]: string } }>
+import createTemplates from './templates'
+import * as config from './runtime/ui.config'
+import type { DeepPartial, Strategy } from './runtime/types/utils'
const defaultExtractor = createDefaultExtractor({ tailwindConfig: { separator: ':' } })
@@ -16,13 +16,21 @@ delete defaultColors.trueGray
delete defaultColors.coolGray
delete defaultColors.blueGray
+type UI = {
+ primary?: string
+ gray?: string
+ colors?: string[]
+ strategy?: Strategy
+} & DeepPartial
+
+declare module 'nuxt/schema' {
+ interface AppConfigInput {
+ ui?: UI
+ }
+}
declare module '@nuxt/schema' {
interface AppConfigInput {
- ui?: {
- primary?: string
- gray?: string
- colors?: string[]
- } & DeepPartial
+ ui?: UI
}
}
@@ -64,12 +72,9 @@ export default defineNuxtModule({
nuxt.options.build.transpile.push(runtimeDir)
nuxt.options.build.transpile.push('@popperjs/core', '@headlessui/vue')
- nuxt.options.css.push(resolve(runtimeDir, 'ui.css'))
+ nuxt.options.alias['#ui'] = runtimeDir
- const appConfigFile = await resolvePath(resolve(runtimeDir, 'app.config'))
- nuxt.hook('app:resolve', (app) => {
- app.configs.push(appConfigFile)
- })
+ nuxt.options.css.push(resolve(runtimeDir, 'ui.css'))
nuxt.hook('tailwindcss:config', function (tailwindConfig) {
const globalColors: any = {
@@ -117,10 +122,10 @@ export default defineNuxtModule({
const colors = excludeColors(globalColors)
nuxt.options.appConfig.ui = {
- ...nuxt.options.appConfig.ui,
primary: 'green',
gray: 'cool',
- colors
+ colors,
+ strategy: 'merge'
}
tailwindConfig.safelist = tailwindConfig.safelist || []
@@ -130,6 +135,8 @@ export default defineNuxtModule({
tailwindConfig.plugins.push(iconsPlugin({ collections: getIconCollections(options.icons as any[]) }))
})
+ createTemplates(nuxt)
+
// Modules
await installModule('@nuxtjs/color-mode', { classSuffix: '' })
diff --git a/src/runtime/components/data/Table.vue b/src/runtime/components/data/Table.vue
index 6d1b5b56..da229a96 100644
--- a/src/runtime/components/data/Table.vue
+++ b/src/runtime/components/data/Table.vue
@@ -1,5 +1,5 @@
-
+
@@ -71,19 +71,17 @@ import { ref, computed, defineComponent, toRaw } from 'vue'
import type { PropType } from 'vue'
import { upperFirst } from 'scule'
import { defu } from 'defu'
-import { twMerge } from 'tailwind-merge'
-import { omit, get } from '../../utils/lodash'
-import { defuTwMerge } from '../../utils'
import UButton from '../elements/Button.vue'
import UIcon from '../elements/Icon.vue'
import UCheckbox from '../forms/Checkbox.vue'
-import type { Button } from '../../types/button'
-import { useAppConfig } from '#imports'
-// TODO: Remove
+import { useUI } from '../../composables/useUI'
+import { mergeConfig, omit, get } from '../../utils'
+import type { Strategy, Button } from '../../types'
// @ts-expect-error
import appConfig from '#build/app.config'
+import { table } from '#ui/ui.config'
-// const appConfig = useAppConfig()
+const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.table, table)
function defaultComparator (a: T, z: T): boolean {
return a === z
@@ -123,15 +121,15 @@ export default defineComponent({
},
sortButton: {
type: Object as PropType