@nuxt/ui 4.11.1 → 4.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/module.json +1 -1
- package/dist/module.mjs +2 -2
- package/dist/runtime/components/Accordion.d.vue.ts +1 -1
- package/dist/runtime/components/Accordion.vue.d.ts +1 -1
- package/dist/runtime/components/Breadcrumb.d.vue.ts +1 -1
- package/dist/runtime/components/Breadcrumb.vue.d.ts +1 -1
- package/dist/runtime/components/Carousel.d.vue.ts +1 -1
- package/dist/runtime/components/Carousel.vue.d.ts +1 -1
- package/dist/runtime/components/CheckboxGroup.d.vue.ts +1 -1
- package/dist/runtime/components/CheckboxGroup.vue.d.ts +1 -1
- package/dist/runtime/components/CommandPalette.d.vue.ts +1 -1
- package/dist/runtime/components/CommandPalette.vue.d.ts +1 -1
- package/dist/runtime/components/ContextMenu.d.vue.ts +1 -1
- package/dist/runtime/components/ContextMenu.vue.d.ts +1 -1
- package/dist/runtime/components/DashboardNavbar.vue +1 -1
- package/dist/runtime/components/DropdownMenu.d.vue.ts +1 -1
- package/dist/runtime/components/DropdownMenu.vue.d.ts +1 -1
- package/dist/runtime/components/FooterColumns.d.vue.ts +1 -1
- package/dist/runtime/components/FooterColumns.vue.d.ts +1 -1
- package/dist/runtime/components/Form.vue +1 -1
- package/dist/runtime/components/Input.vue +5 -5
- package/dist/runtime/components/InputDate.vue +12 -6
- package/dist/runtime/components/InputMenu.d.vue.ts +1 -1
- package/dist/runtime/components/InputMenu.vue +18 -7
- package/dist/runtime/components/InputMenu.vue.d.ts +1 -1
- package/dist/runtime/components/InputTime.vue +12 -6
- package/dist/runtime/components/LinkBase.vue +3 -1
- package/dist/runtime/components/Listbox.d.vue.ts +1 -1
- package/dist/runtime/components/Listbox.vue.d.ts +1 -1
- package/dist/runtime/components/NavigationMenu.d.vue.ts +1 -1
- package/dist/runtime/components/NavigationMenu.vue.d.ts +1 -1
- package/dist/runtime/components/PageAnchors.d.vue.ts +1 -1
- package/dist/runtime/components/PageAnchors.vue.d.ts +1 -1
- package/dist/runtime/components/PageLinks.d.vue.ts +1 -1
- package/dist/runtime/components/PageLinks.vue.d.ts +1 -1
- package/dist/runtime/components/PinInput.d.vue.ts +3 -1
- package/dist/runtime/components/PinInput.vue +15 -7
- package/dist/runtime/components/PinInput.vue.d.ts +3 -1
- package/dist/runtime/components/ProgressGroup.d.vue.ts +1 -1
- package/dist/runtime/components/ProgressGroup.vue.d.ts +1 -1
- package/dist/runtime/components/RadioGroup.d.vue.ts +1 -1
- package/dist/runtime/components/RadioGroup.vue.d.ts +1 -1
- package/dist/runtime/components/Select.d.vue.ts +1 -1
- package/dist/runtime/components/Select.vue.d.ts +1 -1
- package/dist/runtime/components/SelectMenu.d.vue.ts +1 -1
- package/dist/runtime/components/SelectMenu.vue +15 -2
- package/dist/runtime/components/SelectMenu.vue.d.ts +1 -1
- package/dist/runtime/components/Splitter.d.vue.ts +1 -1
- package/dist/runtime/components/Splitter.vue.d.ts +1 -1
- package/dist/runtime/components/Stepper.d.vue.ts +1 -1
- package/dist/runtime/components/Stepper.vue.d.ts +1 -1
- package/dist/runtime/components/Table.vue +24 -2
- package/dist/runtime/components/Tabs.d.vue.ts +1 -1
- package/dist/runtime/components/Tabs.vue.d.ts +1 -1
- package/dist/runtime/components/Textarea.vue +5 -5
- package/dist/runtime/components/Timeline.d.vue.ts +1 -1
- package/dist/runtime/components/Timeline.vue.d.ts +1 -1
- package/dist/runtime/components/Toaster.vue +1 -1
- package/dist/runtime/components/Tree.d.vue.ts +1 -1
- package/dist/runtime/components/Tree.vue +1 -1
- package/dist/runtime/components/Tree.vue.d.ts +1 -1
- package/dist/runtime/components/content/ContentNavigation.d.vue.ts +1 -1
- package/dist/runtime/components/content/ContentNavigation.vue.d.ts +1 -1
- package/dist/runtime/components/content/ContentSurround.d.vue.ts +1 -1
- package/dist/runtime/components/content/ContentSurround.vue.d.ts +1 -1
- package/dist/runtime/components/content/ContentToc.d.vue.ts +1 -1
- package/dist/runtime/components/content/ContentToc.vue.d.ts +1 -1
- package/dist/runtime/composables/useForwardProps.js +2 -2
- package/dist/runtime/composables/useResizable.js +1 -1
- package/dist/runtime/utils/virtualizer.d.ts +1 -1
- package/dist/runtime/utils/virtualizer.js +9 -11
- package/dist/runtime/vue/overrides/inertia/LinkBase.vue +3 -1
- package/dist/shared/{ui.DCJ9twx8.mjs → ui.oNygBd3N.mjs} +28 -1
- package/dist/unplugin.d.mts +2 -1
- package/dist/unplugin.mjs +22 -10
- package/dist/vite.mjs +1 -1
- package/package.json +55 -59
- package/cli/commands/make/component.mjs +0 -86
- package/cli/commands/make/index.mjs +0 -14
- package/cli/commands/make/locale.mjs +0 -93
- package/cli/index.mjs +0 -15
- package/cli/package.json +0 -13
- package/cli/templates.mjs +0 -256
- package/cli/utils.mjs +0 -50
package/cli/templates.mjs
DELETED
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
import { splitByCase, upperFirst, camelCase, kebabCase } from 'scule'
|
|
2
|
-
|
|
3
|
-
const playground = ({ name }) => {
|
|
4
|
-
const upperName = splitByCase(name).map(p => upperFirst(p)).join('')
|
|
5
|
-
const kebabName = kebabCase(name)
|
|
6
|
-
|
|
7
|
-
return {
|
|
8
|
-
filename: `playgrounds/nuxt/app/pages/components/${kebabName}.vue`,
|
|
9
|
-
contents: `
|
|
10
|
-
<template>
|
|
11
|
-
<div>
|
|
12
|
-
<U${upperName} />
|
|
13
|
-
</div>
|
|
14
|
-
</template>
|
|
15
|
-
`
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const component = ({ name, primitive, prose, content }) => {
|
|
20
|
-
const upperName = splitByCase(name).map(p => upperFirst(p)).join('')
|
|
21
|
-
const camelName = camelCase(name)
|
|
22
|
-
const kebabName = kebabCase(name)
|
|
23
|
-
const nested = prose || content
|
|
24
|
-
const dirPrefix = prose ? 'prose/' : (content ? 'content/' : '')
|
|
25
|
-
const importPrefix = nested ? '../..' : '..'
|
|
26
|
-
const componentKey = prose ? `prose.${camelName}` : camelName
|
|
27
|
-
const componentConfigArgs = prose
|
|
28
|
-
? `typeof theme, AppConfig, '${camelName}', 'ui.prose'`
|
|
29
|
-
: `typeof theme, AppConfig, '${camelName}'`
|
|
30
|
-
const appConfigLookup = prose
|
|
31
|
-
? `appConfig.ui?.prose?.${camelName}`
|
|
32
|
-
: `appConfig.ui?.${camelName}`
|
|
33
|
-
|
|
34
|
-
return {
|
|
35
|
-
filename: `src/runtime/components/${dirPrefix}${upperName}.vue`,
|
|
36
|
-
contents: primitive
|
|
37
|
-
? `
|
|
38
|
-
<script lang="ts">
|
|
39
|
-
import type { VNode } from 'vue'
|
|
40
|
-
import type { AppConfig } from '@nuxt/schema'
|
|
41
|
-
import theme from '#build/ui/${dirPrefix}${kebabName}'
|
|
42
|
-
import type { ComponentConfig } from '${importPrefix}/types/tv'
|
|
43
|
-
|
|
44
|
-
type ${upperName} = ComponentConfig<${componentConfigArgs}>
|
|
45
|
-
|
|
46
|
-
export interface ${upperName}Props {
|
|
47
|
-
/**
|
|
48
|
-
* The element or component this component should render as.
|
|
49
|
-
* @defaultValue 'div'
|
|
50
|
-
*/
|
|
51
|
-
as?: any
|
|
52
|
-
class?: any
|
|
53
|
-
ui?: ${upperName}['slots']
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export interface ${upperName}Slots {
|
|
57
|
-
default?(props?: {}): VNode[]
|
|
58
|
-
}
|
|
59
|
-
</script>
|
|
60
|
-
|
|
61
|
-
<script setup lang="ts">
|
|
62
|
-
import { computed } from 'vue'
|
|
63
|
-
import { Primitive } from 'reka-ui'
|
|
64
|
-
import { useAppConfig } from '#imports'
|
|
65
|
-
import { useComponentProps } from '${importPrefix}/composables/useComponentProps'
|
|
66
|
-
import { tv } from '${importPrefix}/utils/tv'
|
|
67
|
-
|
|
68
|
-
const _props = defineProps<${upperName}Props>()
|
|
69
|
-
defineSlots<${upperName}Slots>()
|
|
70
|
-
|
|
71
|
-
const props = useComponentProps('${componentKey}', _props)
|
|
72
|
-
|
|
73
|
-
const appConfig = useAppConfig() as ${upperName}['AppConfig']
|
|
74
|
-
|
|
75
|
-
// eslint-disable-next-line vue/no-dupe-keys
|
|
76
|
-
const ui = computed(() => tv({ extend: theme, ...(${appConfigLookup} || {}) })())
|
|
77
|
-
</script>
|
|
78
|
-
|
|
79
|
-
<template>
|
|
80
|
-
<Primitive :as="props.as" data-slot="root" :class="ui.root({ class: [props.ui?.root, props.class] })">
|
|
81
|
-
<slot />
|
|
82
|
-
</Primitive>
|
|
83
|
-
</template>
|
|
84
|
-
`
|
|
85
|
-
: `
|
|
86
|
-
<script lang="ts">
|
|
87
|
-
import type { ${upperName}RootProps, ${upperName}RootEmits } from 'reka-ui'
|
|
88
|
-
import type { VNode } from 'vue'
|
|
89
|
-
import type { AppConfig } from '@nuxt/schema'
|
|
90
|
-
import theme from '#build/ui/${dirPrefix}${kebabName}'
|
|
91
|
-
import type { ComponentConfig } from '${importPrefix}/types/tv'
|
|
92
|
-
|
|
93
|
-
type ${upperName} = ComponentConfig<${componentConfigArgs}>
|
|
94
|
-
|
|
95
|
-
// TODO: narrow with \`Pick<${upperName}RootProps, '...' | '...'>\` to expose only the props you need.
|
|
96
|
-
export interface ${upperName}Props extends ${upperName}RootProps {
|
|
97
|
-
class?: any
|
|
98
|
-
ui?: ${upperName}['slots']
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export interface ${upperName}Emits extends ${upperName}RootEmits {}
|
|
102
|
-
|
|
103
|
-
export interface ${upperName}Slots {
|
|
104
|
-
default?(props?: {}): VNode[]
|
|
105
|
-
}
|
|
106
|
-
</script>
|
|
107
|
-
|
|
108
|
-
<script setup lang="ts">
|
|
109
|
-
import { computed } from 'vue'
|
|
110
|
-
import { ${upperName}Root } from 'reka-ui'
|
|
111
|
-
import { reactivePick } from '@vueuse/core'
|
|
112
|
-
import { useAppConfig } from '#imports'
|
|
113
|
-
import { useComponentProps } from '${importPrefix}/composables/useComponentProps'
|
|
114
|
-
import { useForwardProps } from '${importPrefix}/composables/useForwardProps'
|
|
115
|
-
import { tv } from '${importPrefix}/utils/tv'
|
|
116
|
-
|
|
117
|
-
const _props = defineProps<${upperName}Props>()
|
|
118
|
-
const emits = defineEmits<${upperName}Emits>()
|
|
119
|
-
defineSlots<${upperName}Slots>()
|
|
120
|
-
|
|
121
|
-
const props = useComponentProps('${componentKey}', _props)
|
|
122
|
-
|
|
123
|
-
const appConfig = useAppConfig() as ${upperName}['AppConfig']
|
|
124
|
-
|
|
125
|
-
// TODO: list the same keys as in \`${upperName}Props\` Pick.
|
|
126
|
-
const rootProps = useForwardProps(reactivePick(props, 'as'), emits)
|
|
127
|
-
|
|
128
|
-
// eslint-disable-next-line vue/no-dupe-keys
|
|
129
|
-
const ui = computed(() => tv({ extend: theme, ...(${appConfigLookup} || {}) })())
|
|
130
|
-
</script>
|
|
131
|
-
|
|
132
|
-
<template>
|
|
133
|
-
<${upperName}Root v-bind="rootProps" data-slot="root" :class="ui.root({ class: [props.ui?.root, props.class] })">
|
|
134
|
-
<slot />
|
|
135
|
-
</${upperName}Root>
|
|
136
|
-
</template>
|
|
137
|
-
`
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
const theme = ({ name, prose, content }) => {
|
|
142
|
-
const kebabName = kebabCase(name)
|
|
143
|
-
|
|
144
|
-
return {
|
|
145
|
-
filename: `src/theme/${prose ? 'prose/' : ''}${content ? 'content/' : ''}${kebabName}.ts`,
|
|
146
|
-
contents: prose
|
|
147
|
-
? `
|
|
148
|
-
export default {
|
|
149
|
-
base: ''
|
|
150
|
-
}
|
|
151
|
-
`
|
|
152
|
-
: `
|
|
153
|
-
export default {
|
|
154
|
-
slots: {
|
|
155
|
-
root: ''
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
`
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
const test = ({ name, prose, content }) => {
|
|
163
|
-
const upperName = splitByCase(name).map(p => upperFirst(p)).join('')
|
|
164
|
-
|
|
165
|
-
return {
|
|
166
|
-
filename: `test/components/${content ? 'content/' : ''}${upperName}.spec.ts`,
|
|
167
|
-
contents: prose
|
|
168
|
-
? undefined
|
|
169
|
-
: `
|
|
170
|
-
import { describe, it, expect } from 'vitest'
|
|
171
|
-
import { axe } from 'vitest-axe'
|
|
172
|
-
import { mountSuspended } from '@nuxt/test-utils/runtime'
|
|
173
|
-
import ${upperName} from '../../${content ? '../' : ''}src/runtime/components/${content ? 'content/' : ''}${upperName}.vue'
|
|
174
|
-
import { renderEach } from '../${content ? '../' : ''}component-render'
|
|
175
|
-
|
|
176
|
-
describe('${upperName}', () => {
|
|
177
|
-
const props = {}
|
|
178
|
-
|
|
179
|
-
renderEach(${upperName}, [
|
|
180
|
-
// Props
|
|
181
|
-
['with as', { props: { as: 'section' } }],
|
|
182
|
-
['with class', { props: { class: '' } }],
|
|
183
|
-
['with ui', { props: { ui: {} } }],
|
|
184
|
-
// Slots
|
|
185
|
-
['with default slot', { props, slots: { default: () => 'Default slot' } }]
|
|
186
|
-
])
|
|
187
|
-
|
|
188
|
-
it('passes accessibility tests', async () => {
|
|
189
|
-
const wrapper = await mountSuspended(${upperName}, {
|
|
190
|
-
props
|
|
191
|
-
})
|
|
192
|
-
|
|
193
|
-
expect(await axe(wrapper.element)).toHaveNoViolations()
|
|
194
|
-
})
|
|
195
|
-
})
|
|
196
|
-
`
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
const docs = ({ name, primitive }) => {
|
|
201
|
-
const kebabName = kebabCase(name)
|
|
202
|
-
const upperName = splitByCase(name).map(p => upperFirst(p)).join('')
|
|
203
|
-
|
|
204
|
-
return {
|
|
205
|
-
filename: `docs/content/docs/2.components/${kebabName}.md`,
|
|
206
|
-
contents: `---
|
|
207
|
-
title: ${upperName}
|
|
208
|
-
description: ''
|
|
209
|
-
links:${primitive
|
|
210
|
-
? ''
|
|
211
|
-
: `
|
|
212
|
-
- label: ${upperName}
|
|
213
|
-
icon: i-custom-reka-ui
|
|
214
|
-
to: https://reka-ui.com/docs/components/${kebabName}`}
|
|
215
|
-
- label: GitHub
|
|
216
|
-
icon: i-simple-icons-github
|
|
217
|
-
to: https://github.com/nuxt/ui/blob/v4/src/runtime/components/${upperName}.vue
|
|
218
|
-
navigation.badge: Soon
|
|
219
|
-
---
|
|
220
|
-
|
|
221
|
-
## Usage
|
|
222
|
-
|
|
223
|
-
## Examples
|
|
224
|
-
|
|
225
|
-
## API
|
|
226
|
-
|
|
227
|
-
### Props
|
|
228
|
-
|
|
229
|
-
:component-props
|
|
230
|
-
|
|
231
|
-
### Slots
|
|
232
|
-
|
|
233
|
-
:component-slots
|
|
234
|
-
|
|
235
|
-
### Emits
|
|
236
|
-
|
|
237
|
-
:component-emits
|
|
238
|
-
|
|
239
|
-
## Theme
|
|
240
|
-
|
|
241
|
-
:component-theme
|
|
242
|
-
|
|
243
|
-
## Changelog
|
|
244
|
-
|
|
245
|
-
:component-changelog
|
|
246
|
-
`
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
export default {
|
|
251
|
-
playground,
|
|
252
|
-
component,
|
|
253
|
-
theme,
|
|
254
|
-
test,
|
|
255
|
-
docs
|
|
256
|
-
}
|
package/cli/utils.mjs
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { promises as fsp } from 'node:fs'
|
|
2
|
-
|
|
3
|
-
export async function sortFile(path) {
|
|
4
|
-
const file = await fsp.readFile(path, 'utf-8')
|
|
5
|
-
|
|
6
|
-
const lines = file.trim().split('\n').sort()
|
|
7
|
-
|
|
8
|
-
await fsp.writeFile(path, lines.join('\n') + '\n')
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export async function appendFile(path, contents) {
|
|
12
|
-
const file = await fsp.readFile(path, 'utf-8')
|
|
13
|
-
|
|
14
|
-
if (!file.includes(contents)) {
|
|
15
|
-
await fsp.writeFile(path, file.trim() + '\n' + contents + '\n')
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Insert a `key?: Partial<ComponentTypes.XProps>` entry into the `ThemeDefaults`
|
|
21
|
-
* interface in `src/runtime/composables/useComponentProps.ts`, keeping entries
|
|
22
|
-
* sorted alphabetically and avoiding duplicates.
|
|
23
|
-
*/
|
|
24
|
-
export async function appendThemeDefault(path, key, propsType) {
|
|
25
|
-
const file = await fsp.readFile(path, 'utf-8')
|
|
26
|
-
const entry = ` ${key}?: Partial<ComponentTypes.${propsType}>`
|
|
27
|
-
|
|
28
|
-
const match = file.match(/(export interface ThemeDefaults \{\n)([\s\S]*?)(\n\})/)
|
|
29
|
-
if (!match) return
|
|
30
|
-
|
|
31
|
-
const [, header, body, footer] = match
|
|
32
|
-
if (body.split('\n').includes(entry)) return
|
|
33
|
-
|
|
34
|
-
const sorted = [...body.split('\n'), entry].sort().join('\n')
|
|
35
|
-
await fsp.writeFile(path, file.replace(match[0], header + sorted + footer))
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function normalizeLocale(locale) {
|
|
39
|
-
if (!locale) {
|
|
40
|
-
return ''
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (locale.includes('_')) {
|
|
44
|
-
return locale.split('_')
|
|
45
|
-
.map((part, index) => index === 0 ? part.toLowerCase() : part.toUpperCase())
|
|
46
|
-
.join('-')
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return locale.toLowerCase()
|
|
50
|
-
}
|