@nuxt/ui 0.0.0-alpha.5 → 0.1.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/LICENSE +1 -1
- package/README.md +27 -42
- package/dist/assets/styles.css +14 -0
- package/dist/components/NCheckbox.vue +2 -2
- package/dist/components/NDarkToggle.vue +28 -0
- package/dist/components/NDialog.vue +6 -9
- package/dist/components/NDropdown.vue +31 -0
- package/dist/components/NLink.vue +1 -1
- package/dist/components/NRadio.vue +2 -2
- package/dist/components/NSwitch.vue +2 -2
- package/dist/components/NTextInput.vue +4 -2
- package/dist/components/NuxtExampleLayout.vue +43 -7
- package/dist/components/nuxt/NDarkToggle.vue +28 -0
- package/dist/nuxt.d.ts +4 -1
- package/dist/nuxt.mjs +33 -22
- package/nuxt.cjs +1 -1
- package/package.json +29 -29
- package/dist/assets/logo-nuxt3.svg +0 -18
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
# Nuxt UI
|
|
1
|
+
# Nuxt UI Components
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<a href="https://www.npmjs.com/package/@nuxt/ui-edge"><img src="https://flat.badgen.net/npm/v/@nuxt/ui-edge"></a>
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
UI kit for Nuxt 3's examples and internal tooling UI.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
> Note: This library is heavily working in progress and does not serve as a generic UI library (for now). It is not recommended to use it in production.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
# npm
|
|
11
|
-
npm install @nuxt/ui@npm:@nuxt/ui-edge
|
|
9
|
+
🏀 [Online Playground](https://components.ui.nuxtjs.org)
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
yarn install @nuxt/ui@npm:@nuxt/ui-edge
|
|
15
|
-
```
|
|
11
|
+
## Install
|
|
16
12
|
|
|
17
13
|
```ts
|
|
18
14
|
// nuxt.config.js
|
|
19
15
|
import { defineNuxtConfig } from 'nuxt3'
|
|
20
16
|
|
|
21
17
|
export default defineNuxtConfig({
|
|
22
|
-
|
|
18
|
+
modules: [
|
|
23
19
|
'@nuxt/ui'
|
|
24
20
|
]
|
|
25
21
|
})
|
|
@@ -57,39 +53,28 @@ Apply it to parent components could make a local theme scope
|
|
|
57
53
|
</NCard>
|
|
58
54
|
```
|
|
59
55
|
|
|
60
|
-
##
|
|
61
|
-
|
|
62
|
-
### Base
|
|
63
|
-
|
|
64
|
-
- [x] `<NCard>`
|
|
65
|
-
- [x] `<NTextInput>`
|
|
66
|
-
- [x] `<NCheckbox>`
|
|
67
|
-
- [x] `<NRadio>`
|
|
68
|
-
- [x] `<NIcon>`
|
|
69
|
-
- [x] `<NLink>`
|
|
70
|
-
- [x] `<NButton>`
|
|
71
|
-
- [x] `<NTip>`
|
|
72
|
-
- [ ] `<NButtonGroup>`
|
|
73
|
-
- [ ] `<NSpinner>`
|
|
74
|
-
- [ ] `<NAlert>`
|
|
75
|
-
- [ ] `<NBadge>`
|
|
76
|
-
|
|
77
|
-
### Interactive
|
|
56
|
+
## Theming
|
|
78
57
|
|
|
79
|
-
|
|
80
|
-
- [ ] `<NTabs>`
|
|
81
|
-
- [ ] `<NDropdown>`
|
|
82
|
-
- [ ] `<NPopup>`
|
|
83
|
-
- [ ] `<NNotification>`
|
|
84
|
-
- [ ] `<NModal>`
|
|
58
|
+
Powered by [UnoCSS](https://github.com/antfu/unocss), you can use Tailwind/Windi CSS utilities to quickly customize the look and feel of components.
|
|
85
59
|
|
|
86
|
-
|
|
60
|
+
It's also possible to override the default theme globally, for example:
|
|
87
61
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
- [ ] `<NPagination>`
|
|
62
|
+
```ts
|
|
63
|
+
// nuxt.config.js
|
|
64
|
+
import { defineNuxtConfig } from 'nuxt3'
|
|
92
65
|
|
|
93
|
-
|
|
66
|
+
export default defineNuxtConfig({
|
|
67
|
+
modules: [
|
|
68
|
+
'@nuxt/ui'
|
|
69
|
+
],
|
|
70
|
+
unocss: {
|
|
71
|
+
shortcuts: {
|
|
72
|
+
'n-button-base': 'border n-border-base rounded shadow-sm op80 !outline-none',
|
|
73
|
+
'n-button-hover': 'op100 !border-context text-context',
|
|
74
|
+
'n-button-active': 'n-active-base bg-context/5',
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
```
|
|
94
79
|
|
|
95
|
-
|
|
80
|
+
You can find all the default values and available entries in [src/unocss/index.ts](./src/unocss/index.ts).
|
|
@@ -27,8 +27,8 @@ const props = withDefaults(
|
|
|
27
27
|
disabled?: boolean }>(),
|
|
28
28
|
{
|
|
29
29
|
modelValue: false,
|
|
30
|
-
disabled: false
|
|
31
|
-
}
|
|
30
|
+
disabled: false
|
|
31
|
+
}
|
|
32
32
|
)
|
|
33
33
|
const emit = defineEmits<{(...args: any): void}>()
|
|
34
34
|
const checked = useVModel(props, 'modelValue', emit, { passive: true })
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/* eslint-disable vue/no-multiple-template-root */
|
|
3
|
+
import { useColorMode, useToggle } from '@vueuse/core'
|
|
4
|
+
import { computed } from 'vue'
|
|
5
|
+
|
|
6
|
+
const mode = useColorMode()
|
|
7
|
+
|
|
8
|
+
const isDark = computed<boolean>({
|
|
9
|
+
get () {
|
|
10
|
+
return mode.value === 'dark'
|
|
11
|
+
},
|
|
12
|
+
set (v) {
|
|
13
|
+
mode.value = v ? 'dark' : 'light'
|
|
14
|
+
}
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
const toggle = useToggle(isDark)
|
|
18
|
+
|
|
19
|
+
const context = {
|
|
20
|
+
mode,
|
|
21
|
+
isDark,
|
|
22
|
+
toggle
|
|
23
|
+
}
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<template>
|
|
27
|
+
<slot v-bind="context" />
|
|
28
|
+
</template>
|
|
@@ -30,10 +30,10 @@ const props = withDefaults(
|
|
|
30
30
|
}>(),
|
|
31
31
|
{
|
|
32
32
|
modelValue: false,
|
|
33
|
-
dim: true
|
|
34
|
-
}
|
|
33
|
+
dim: true
|
|
34
|
+
}
|
|
35
35
|
)
|
|
36
|
-
const emit = defineEmits<{
|
|
36
|
+
const emit = defineEmits<{(...args: any): void }>()
|
|
37
37
|
|
|
38
38
|
const show = useVModel(props, 'modelValue', emit, { passive: true })
|
|
39
39
|
const card = ref(null)
|
|
@@ -42,14 +42,11 @@ const { activate, deactivate } = useFocusTrap(card, { immediate: false })
|
|
|
42
42
|
|
|
43
43
|
onMounted(() => {
|
|
44
44
|
watch(show, (v) => {
|
|
45
|
-
if (v)
|
|
46
|
-
activate()
|
|
47
|
-
else
|
|
48
|
-
deactivate()
|
|
45
|
+
if (v) { activate() } else { deactivate() }
|
|
49
46
|
}, { immediate: true })
|
|
50
47
|
})
|
|
51
48
|
|
|
52
|
-
function close() {
|
|
49
|
+
function close () {
|
|
53
50
|
show.value = false
|
|
54
51
|
emit('close')
|
|
55
52
|
}
|
|
@@ -57,6 +54,6 @@ function close() {
|
|
|
57
54
|
|
|
58
55
|
<script lang="ts">
|
|
59
56
|
export default {
|
|
60
|
-
inheritAttrs: false
|
|
57
|
+
inheritAttrs: false
|
|
61
58
|
}
|
|
62
59
|
</script>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
import { onClickOutside, useVModel } from '@vueuse/core'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{ modelValue?: boolean }>()
|
|
6
|
+
const emit = defineEmits<{(...args: any): void }>()
|
|
7
|
+
|
|
8
|
+
const enabled = useVModel(props, 'modelValue', emit, { passive: true })
|
|
9
|
+
const el = ref<HTMLDivElement>()
|
|
10
|
+
|
|
11
|
+
onClickOutside(el, () => {
|
|
12
|
+
enabled.value = false
|
|
13
|
+
})
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<div ref="el" class="relative">
|
|
18
|
+
<slot name="trigger" :enabled="enabled" @click="enabled = !enabled">
|
|
19
|
+
<NButton @click="enabled = !enabled">
|
|
20
|
+
Dropdown
|
|
21
|
+
</NButton>
|
|
22
|
+
</slot>
|
|
23
|
+
|
|
24
|
+
<div
|
|
25
|
+
class="absolute z-10 n-transition n-bg-base border n-border-base rounded shadow"
|
|
26
|
+
:class="[enabled ? 'op-100' : 'op0 pointer-events-none -translate-y-1']"
|
|
27
|
+
>
|
|
28
|
+
<slot />
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
</template>
|
|
@@ -29,8 +29,8 @@ const props = withDefaults(
|
|
|
29
29
|
disabled?: boolean }>(),
|
|
30
30
|
{
|
|
31
31
|
modelValue: false,
|
|
32
|
-
disabled: false
|
|
33
|
-
}
|
|
32
|
+
disabled: false
|
|
33
|
+
}
|
|
34
34
|
)
|
|
35
35
|
const emit = defineEmits<{(...args: any): void}>()
|
|
36
36
|
const checked = useVModel(props, 'modelValue', emit, { passive: true })
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<input
|
|
7
7
|
v-model="input"
|
|
8
8
|
class="!outline-none flex-auto n-bg-base"
|
|
9
|
-
type="
|
|
9
|
+
:type="type"
|
|
10
10
|
:placeholder="placeholder"
|
|
11
11
|
>
|
|
12
12
|
</div>
|
|
@@ -21,11 +21,13 @@ const props = withDefaults(
|
|
|
21
21
|
placeholder?: string
|
|
22
22
|
icon?: string
|
|
23
23
|
disabled?: boolean
|
|
24
|
+
type?: string
|
|
24
25
|
}>(),
|
|
25
26
|
{
|
|
26
27
|
modelValue: '',
|
|
27
28
|
disabled: false,
|
|
28
|
-
|
|
29
|
+
type: 'text'
|
|
30
|
+
}
|
|
29
31
|
)
|
|
30
32
|
const emit = defineEmits<{(...args: any): void}>()
|
|
31
33
|
const input = useVModel(props, 'modelValue', emit, { passive: true })
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import NIcon from './NIcon.vue'
|
|
2
3
|
const props = defineProps<{
|
|
3
|
-
|
|
4
|
+
example?: string
|
|
4
5
|
showTips?: boolean
|
|
5
|
-
class?: string
|
|
6
|
+
class?: string // eslint-disable-line vue/no-reserved-props
|
|
6
7
|
openPath?: string
|
|
7
8
|
}>()
|
|
8
9
|
|
|
@@ -14,21 +15,56 @@ const openInEditor = () => {
|
|
|
14
15
|
<template>
|
|
15
16
|
<div class="relative font-sans" n="green6">
|
|
16
17
|
<div class="container max-w-200 mx-auto py-10 px-4">
|
|
17
|
-
<div class="flex
|
|
18
|
-
<
|
|
18
|
+
<div class="flex items-end gap-3 mb-4 relative">
|
|
19
|
+
<svg viewBox="0 0 221 65" fill="none" xmlns="http://www.w3.org/2000/svg" class="h-10">
|
|
20
|
+
<g clip-path="url(#a)">
|
|
21
|
+
<path
|
|
22
|
+
fill="currentColor"
|
|
23
|
+
d="M82.562 18.57h7.302l15.474 24.742V18.571h6.741v35.057h-7.252l-15.525-24.69v24.69h-6.74V18.57Zm59.645 35.058h-6.282v-3.916c-1.429 2.756-4.339 4.308-8.015 4.308-5.822 0-9.603-4.107-9.603-10.018V28.385h6.282V42.71c0 3.456 2.146 5.859 5.362 5.859 3.524 0 5.974-2.704 5.974-6.41V28.385h6.282v25.243Zm21.857-.4-6.026-8.413-6.027 8.414h-6.69l9.296-13.172-8.58-12.071h6.843l5.158 7.264 5.106-7.264h6.895l-8.632 12.07 9.295 13.173h-6.638Zm19.405-32.455v7.611h7.149v5.16h-7.149v12.53c0 .421.17.825.473 1.123.303.298.715.465 1.144.466h5.532v5.955h-4.137c-5.617 0-9.293-3.206-9.293-8.811V33.548h-5.056v-5.164h3.172c1.479 0 2.34-.864 2.34-2.293v-5.318h5.825Z"
|
|
24
|
+
/>
|
|
25
|
+
<path
|
|
26
|
+
fill-rule="evenodd"
|
|
27
|
+
clip-rule="evenodd"
|
|
28
|
+
d="M30.119 11.546c-1.886-3.242-6.6-3.242-8.484 0L1.087 46.875c-1.885 3.241.472 7.293 4.242 7.293h16.04c-1.61-1.408-2.207-3.844-.988-5.934L35.942 21.56l-5.824-10.013Z"
|
|
29
|
+
fill="#80EEC0"
|
|
30
|
+
/>
|
|
31
|
+
<path
|
|
32
|
+
d="M43.137 19.295c1.56-2.652 5.461-2.652 7.022 0l17.004 28.906c1.56 2.652-.39 5.968-3.51 5.968h-34.01c-3.12 0-5.07-3.316-3.51-5.968l17.004-28.906ZM209.174 53.8h-10.691c0-1.85.067-3.452 0-6.02h10.641c1.868 0 3.353.1 4.354-.935 1-1.034 1.501-2.335 1.501-3.903 0-1.834-.667-3.219-2.002-4.153-1.301-.967-2.985-1.451-5.054-1.451h-2.601v-5.254h2.652c1.701 0 3.119-.4 4.253-1.2 1.134-.801 1.701-1.986 1.701-3.553 0-1.301-.434-2.336-1.301-3.103-.834-.8-2.001-1.2-3.503-1.2-1.634 0-2.918.483-3.853 1.45-.9.968-1.401 2.152-1.501 3.553h-6.254c.133-3.236 1.251-5.788 3.352-7.656 2.135-1.868 4.887-2.802 8.256-2.802 2.402 0 4.42.434 6.055 1.301 1.668.834 2.919 1.952 3.753 3.353.867 1.4 1.301 2.952 1.301 4.653 0 1.968-.551 3.636-1.651 5.004-1.068 1.334-2.402 2.235-4.004 2.702 1.969.4 3.57 1.368 4.804 2.902 1.234 1.501 1.852 3.403 1.852 5.705 0 1.934-.468 3.702-1.402 5.304-.934 1.6-2.301 2.885-4.103 3.852-1.768.968-3.953 1.452-6.555 1.452Z"
|
|
33
|
+
fill="#00DC82"
|
|
34
|
+
/>
|
|
35
|
+
</g>
|
|
36
|
+
</svg>
|
|
19
37
|
<div class="text-xl flex">
|
|
20
38
|
<div class="op-50">
|
|
21
39
|
examples/
|
|
22
40
|
</div>
|
|
23
41
|
<slot name="name">
|
|
24
|
-
<NLink :href="`https://github.com/nuxt/framework/tree/main/examples/${
|
|
25
|
-
{{
|
|
42
|
+
<NLink :href="`https://github.com/nuxt/framework/tree/main/examples/${example}`" target="_blank">
|
|
43
|
+
{{ example }}
|
|
26
44
|
</NLink>
|
|
27
45
|
</slot>
|
|
28
46
|
</div>
|
|
29
|
-
<
|
|
47
|
+
<div flex-auto />
|
|
48
|
+
<div class="op20 hover:op-100 n-transition -mb-2 -mr-1">
|
|
49
|
+
<NButton
|
|
50
|
+
n="borderless lg"
|
|
51
|
+
class="p-2 op50"
|
|
52
|
+
:to="`https://github.com/nuxt/framework/tree/main/examples/${example}`"
|
|
53
|
+
target="_blank"
|
|
54
|
+
>
|
|
55
|
+
<NIcon icon="carbon-code" />
|
|
56
|
+
</NButton>
|
|
57
|
+
<NDarkToggle>
|
|
58
|
+
<template #default="{ toggle }">
|
|
59
|
+
<NButton n="borderless lg" p-2 op50 @click="toggle">
|
|
60
|
+
<NIcon icon="dark:carbon-moon carbon-sun" />
|
|
61
|
+
</NButton>
|
|
62
|
+
</template>
|
|
63
|
+
</NDarkToggle>
|
|
64
|
+
</div>
|
|
30
65
|
</div>
|
|
31
66
|
|
|
67
|
+
<slot name="subtitle" />
|
|
32
68
|
<slot name="nav" />
|
|
33
69
|
|
|
34
70
|
<NCard class="p-6 flex flex-col gap-2 text-center" :class="$props.class">
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/* eslint-disable vue/no-multiple-template-root */
|
|
3
|
+
import { computed } from 'vue'
|
|
4
|
+
import { useToggle } from '@vueuse/core'
|
|
5
|
+
import { useColorMode } from '#imports'
|
|
6
|
+
|
|
7
|
+
const mode = useColorMode() // Auto imported from @nuxtjs/color-mode
|
|
8
|
+
const isDark = computed<boolean>({
|
|
9
|
+
get () {
|
|
10
|
+
return mode.value === 'dark'
|
|
11
|
+
},
|
|
12
|
+
set (v) {
|
|
13
|
+
mode.preference = v ? 'dark' : 'light'
|
|
14
|
+
}
|
|
15
|
+
})
|
|
16
|
+
const toggle = useToggle(isDark)
|
|
17
|
+
const context = {
|
|
18
|
+
mode,
|
|
19
|
+
isDark,
|
|
20
|
+
toggle
|
|
21
|
+
}
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<template>
|
|
25
|
+
<ColorScheme tag="span">
|
|
26
|
+
<slot v-bind="context" />
|
|
27
|
+
</ColorScheme>
|
|
28
|
+
</template>
|
package/dist/nuxt.d.ts
CHANGED
package/dist/nuxt.mjs
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { fileURLToPath } from 'url';
|
|
2
|
-
import { resolve } from 'path';
|
|
3
|
-
import { existsSync } from 'fs';
|
|
4
2
|
import { defineNuxtModule, addComponentsDir, installModule } from '@nuxt/kit';
|
|
3
|
+
import defu from 'defu';
|
|
5
4
|
import UnocssModule from '@unocss/nuxt';
|
|
6
5
|
import VueUseModule from '@vueuse/nuxt';
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import presetAttributify from '
|
|
6
|
+
import NuxtColorMode from '@nuxtjs/color-mode';
|
|
7
|
+
import { parseColor } from '@unocss/preset-mini/utils';
|
|
8
|
+
import { theme } from '@unocss/preset-mini';
|
|
9
|
+
import { fonts } from '@unocss/preset-mini/rules';
|
|
10
|
+
import { mergeDeep, presetUno, presetAttributify, presetIcons, transformerDirectives, transformerVariantGroup } from 'unocss';
|
|
12
11
|
|
|
13
12
|
const NuxtUIPreset = {
|
|
14
13
|
name: "nuxt-ui",
|
|
@@ -22,10 +21,10 @@ const NuxtUIPreset = {
|
|
|
22
21
|
}),
|
|
23
22
|
rules: [
|
|
24
23
|
[/^n-(.*)$/, ([, body], { theme }) => {
|
|
25
|
-
const
|
|
26
|
-
if (
|
|
24
|
+
const color = parseColor(body, theme);
|
|
25
|
+
if (color?.cssColor?.type === "rgb" && color.cssColor.components) {
|
|
27
26
|
return {
|
|
28
|
-
"--nui-c-context": `${
|
|
27
|
+
"--nui-c-context": `${color.cssColor.components.join(",")}`
|
|
29
28
|
};
|
|
30
29
|
}
|
|
31
30
|
}],
|
|
@@ -34,12 +33,12 @@ const NuxtUIPreset = {
|
|
|
34
33
|
["n-solid", {
|
|
35
34
|
"background-color": "rgba(var(--nui-c-context), 1) !important",
|
|
36
35
|
"border-color": "rgba(var(--nui-c-context), 1)",
|
|
37
|
-
|
|
36
|
+
color: "white !important"
|
|
38
37
|
}],
|
|
39
38
|
["n-disabled", {
|
|
40
|
-
|
|
39
|
+
opacity: 0.4,
|
|
41
40
|
"pointer-events": "none",
|
|
42
|
-
|
|
41
|
+
filter: "saturate(0)"
|
|
43
42
|
}]
|
|
44
43
|
],
|
|
45
44
|
variants: [
|
|
@@ -70,7 +69,9 @@ const NuxtUIPreset = {
|
|
|
70
69
|
"n-transition": "transition-all duration-200",
|
|
71
70
|
"n-focus-base": "ring-2 ring-context/50",
|
|
72
71
|
"n-active-base": "ring-3 ring-context/10",
|
|
73
|
-
"n-
|
|
72
|
+
"n-borderless": "!border-none !shadow-none",
|
|
73
|
+
"n-link-base": "underline underline-offset-2 underline-black/20 dark:underline-white/40",
|
|
74
|
+
"n-link-hover": "decoration-dotted text-context underline-context",
|
|
74
75
|
"n-card-base": "border n-border-200 rounded n-bg-base shadow-sm",
|
|
75
76
|
"n-header-upper": "text-sm uppercase mb-2 leading-1.2em tracking-wide op50",
|
|
76
77
|
"n-button-base": "border n-border-base rounded shadow-sm px-1em py-0.25em inline-flex items-center gap-1 op80 !outline-none",
|
|
@@ -104,32 +105,42 @@ function extendUnocssOptions(user = {}) {
|
|
|
104
105
|
prefix: "",
|
|
105
106
|
scale: 1.2,
|
|
106
107
|
extraProperties: {
|
|
107
|
-
|
|
108
|
+
display: "inline-block",
|
|
108
109
|
"vertical-align": "middle"
|
|
109
110
|
}
|
|
110
111
|
}),
|
|
111
112
|
NuxtUIPreset,
|
|
112
113
|
...user.presets || []
|
|
114
|
+
],
|
|
115
|
+
transformers: [
|
|
116
|
+
transformerDirectives(),
|
|
117
|
+
transformerVariantGroup()
|
|
113
118
|
]
|
|
114
119
|
};
|
|
115
120
|
}
|
|
116
121
|
|
|
117
122
|
const rPath = (p) => fileURLToPath(new URL(p, import.meta.url).toString());
|
|
118
123
|
const nuxt = defineNuxtModule({
|
|
119
|
-
|
|
124
|
+
meta: {
|
|
125
|
+
name: "nui",
|
|
126
|
+
configKey: "nui"
|
|
127
|
+
},
|
|
120
128
|
defaults: {
|
|
121
129
|
preset: rPath("./preset"),
|
|
122
130
|
dev: false
|
|
123
131
|
},
|
|
124
132
|
async setup(options, nuxt) {
|
|
133
|
+
addComponentsDir({ path: rPath("./components/nuxt") });
|
|
125
134
|
addComponentsDir({ path: rPath("./components") });
|
|
126
|
-
|
|
127
|
-
if (
|
|
128
|
-
nuxt.options.css.push(presetStyles);
|
|
129
|
-
if (!options.dev)
|
|
135
|
+
nuxt.options.css.unshift(rPath("assets/styles.css"));
|
|
136
|
+
if (!options.dev) {
|
|
130
137
|
nuxt.options.unocss = extendUnocssOptions(nuxt.options.unocss);
|
|
131
|
-
|
|
132
|
-
|
|
138
|
+
}
|
|
139
|
+
nuxt.options.vueuse = Object.assign({ ssrHandlers: true }, nuxt.options.vueuse || {});
|
|
140
|
+
nuxt.options.colorMode = defu(nuxt.options.colorMode, { classSuffix: "" });
|
|
141
|
+
await installModule(UnocssModule);
|
|
142
|
+
await installModule(VueUseModule);
|
|
143
|
+
await installModule(NuxtColorMode);
|
|
133
144
|
}
|
|
134
145
|
});
|
|
135
146
|
|
package/nuxt.cjs
CHANGED
package/package.json
CHANGED
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/ui",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"type": "module",
|
|
3
|
+
"version": "0.1.0",
|
|
5
4
|
"license": "MIT",
|
|
6
|
-
"
|
|
7
|
-
"build": "unbuild && cp -R src/components dist/",
|
|
8
|
-
"lint": "eslint . --ext .vue,.ts",
|
|
9
|
-
"dev": "yarn nuxi dev playground",
|
|
10
|
-
"prepublishOnly": "npm run build",
|
|
11
|
-
"release": "bumpp --commit --tag --push --preid alpha && yarn publish --non-interactive"
|
|
12
|
-
},
|
|
13
|
-
"main": "./dist/nuxt.mjs",
|
|
5
|
+
"type": "module",
|
|
14
6
|
"exports": {
|
|
15
7
|
".": {
|
|
16
8
|
"import": "./dist/nuxt.mjs",
|
|
@@ -21,33 +13,41 @@
|
|
|
21
13
|
"require": "./nuxt.cjs"
|
|
22
14
|
}
|
|
23
15
|
},
|
|
16
|
+
"main": "./dist/nuxt.mjs",
|
|
24
17
|
"files": [
|
|
25
18
|
"dist",
|
|
26
19
|
"*.cjs"
|
|
27
20
|
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "unbuild",
|
|
23
|
+
"dev": "yarn nuxi dev playground",
|
|
24
|
+
"lint": "eslint . --ext .vue,.ts",
|
|
25
|
+
"prepack": "npm run build",
|
|
26
|
+
"playground:build": "yarn nuxi build playground"
|
|
27
|
+
},
|
|
28
28
|
"dependencies": {
|
|
29
|
+
"@iconify-json/carbon": "^1.1.3",
|
|
29
30
|
"@nuxt/kit": "npm:@nuxt/kit-edge@latest",
|
|
30
|
-
"@
|
|
31
|
-
"@unocss/
|
|
32
|
-
"@unocss/
|
|
33
|
-
"@unocss/preset-
|
|
34
|
-
"@unocss/preset-
|
|
35
|
-
"@unocss/preset-
|
|
36
|
-
"@unocss/reset": "^0.
|
|
37
|
-
"@vueuse/
|
|
38
|
-
"@vueuse/
|
|
39
|
-
"
|
|
31
|
+
"@nuxtjs/color-mode": "^3.0.2",
|
|
32
|
+
"@unocss/core": "^0.31.5",
|
|
33
|
+
"@unocss/nuxt": "^0.31.5",
|
|
34
|
+
"@unocss/preset-attributify": "^0.31.5",
|
|
35
|
+
"@unocss/preset-icons": "^0.31.5",
|
|
36
|
+
"@unocss/preset-mini": "^0.31.5",
|
|
37
|
+
"@unocss/reset": "^0.31.5",
|
|
38
|
+
"@vueuse/core": "^8.2.6",
|
|
39
|
+
"@vueuse/integrations": "^8.2.6",
|
|
40
|
+
"@vueuse/nuxt": "^8.2.6",
|
|
41
|
+
"defu": "^6.0.0",
|
|
42
|
+
"focus-trap": "^6.7.3",
|
|
43
|
+
"unocss": "^0.31.5"
|
|
40
44
|
},
|
|
41
45
|
"devDependencies": {
|
|
42
|
-
"@antfu/eslint-config": "^0.13.1",
|
|
43
|
-
"@iconify-json/carbon": "^1.0.12",
|
|
44
|
-
"bumpp": "^7.1.1",
|
|
45
|
-
"eslint": "^8.4.1",
|
|
46
46
|
"nuxt3": "latest",
|
|
47
|
-
"
|
|
48
|
-
|
|
47
|
+
"unbuild": "^0.7.4"
|
|
48
|
+
},
|
|
49
|
+
"publishConfig": {
|
|
50
|
+
"access": "public"
|
|
49
51
|
},
|
|
50
|
-
"
|
|
51
|
-
"extends": "@antfu"
|
|
52
|
-
}
|
|
52
|
+
"gitHead": "ae0dd6a25d376b08f2117da2090e25d620e1efba"
|
|
53
53
|
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
<svg viewBox="0 0 221 65" fill="none" xmlns="http://www.w3.org/2000/svg" class="h-8">
|
|
2
|
-
<g clip-path="url(#a)">
|
|
3
|
-
<path fill="currentColor"
|
|
4
|
-
d="M82.5623 18.5705h7.3017l15.474 24.7415V18.5705h6.741v35.0576h-7.252L89.3025 28.938v24.6901h-6.7402V18.5705ZM142.207 53.628h-6.282v-3.916c-1.429 2.7559-4.339 4.3076-8.015 4.3076-5.822 0-9.603-4.1069-9.603-10.0175V28.3847h6.282v14.3251c0 3.4558 2.146 5.8592 5.362 5.8592 3.524 0 5.974-2.7044 5.974-6.4099V28.3847h6.282V53.628ZM164.064 53.2289l-6.026-8.4144-6.027 8.4144h-6.69l9.296-13.1723-8.58-12.0709h6.843l5.158 7.2641 5.106-7.2641h6.895l-8.632 12.0709 9.295 13.1723h-6.638ZM183.469 20.7726v7.6116h7.149v5.1593h-7.149v12.5311c0 .4208.17.8245.473 1.1223.303.2978.715.4654 1.144.4661h5.532v5.9547h-4.137c-5.617 0-9.293-3.2062-9.293-8.8109V33.5484h-5.056v-5.1642h3.172c1.479 0 2.34-.8639 2.34-2.2932v-5.3184h5.825Z">
|
|
5
|
-
</path>
|
|
6
|
-
<path fill-rule="evenodd" clip-rule="evenodd"
|
|
7
|
-
d="M30.1185 11.5456c-1.8853-3.24168-6.5987-3.24169-8.484 0L1.08737 46.8747c-1.885324 3.2417.47133 7.2938 4.24199 7.2938H21.3695c-1.6112-1.4081-2.2079-3.8441-.9886-5.9341l15.5615-26.675-5.8239-10.0138Z"
|
|
8
|
-
fill="#80EEC0"></path>
|
|
9
|
-
<path
|
|
10
|
-
d="M43.1374 19.2952c1.5603-2.6523 5.461-2.6523 7.0212 0l17.0045 28.9057c1.5603 2.6522-.39 5.9676-3.5106 5.9676h-34.009c-3.1206 0-5.0709-3.3154-3.5106-5.9676l17.0045-28.9057ZM209.174 53.8005H198.483c0-1.8514.067-3.4526 0-6.0213h10.641c1.868 0 3.353.1001 4.354-.934 1-1.0341 1.501-2.3351 1.501-3.9029 0-1.8347-.667-3.2191-2.002-4.1532-1.301-.9674-2.985-1.4511-5.054-1.4511h-2.601v-5.2539h2.652c1.701 0 3.119-.4003 4.253-1.2009 1.134-.8006 1.701-1.9849 1.701-3.5527 0-1.301-.434-2.3351-1.301-3.1023-.834-.8007-2.001-1.201-3.503-1.201-1.634 0-2.918.4837-3.853 1.4511-.9.9674-1.401 2.1517-1.501 3.5527h-6.254c.133-3.2358 1.251-5.7877 3.352-7.6558 2.135-1.868 4.887-2.8021 8.256-2.8021 2.402 0 4.42.4337 6.055 1.301 1.668.834 2.919 1.9515 3.753 3.3525.867 1.4011 1.301 2.9523 1.301 4.6536 0 1.9681-.551 3.636-1.651 5.0037-1.068 1.3344-2.402 2.235-4.004 2.7021 1.969.4003 3.57 1.3677 4.804 2.9022 1.234 1.5011 1.852 3.4025 1.852 5.7043 0 1.9347-.468 3.7028-1.402 5.304-.934 1.6012-2.301 2.8855-4.103 3.8529-1.768.9674-3.953 1.4511-6.555 1.4511Z"
|
|
11
|
-
fill="#00DC82"></path>
|
|
12
|
-
</g>
|
|
13
|
-
<defs>
|
|
14
|
-
<clipPath id="a">
|
|
15
|
-
<path fill="#fff" d="M0 0h221v65H0z"></path>
|
|
16
|
-
</clipPath>
|
|
17
|
-
</defs>
|
|
18
|
-
</svg>
|