mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 12:14:41 +01:00
Merge remote-tracking branch 'origin/v3' into feat/custom-slots
This commit is contained in:
@@ -11,10 +11,10 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ai-sdk/vue": "^1.2.12",
|
"@ai-sdk/vue": "^1.2.12",
|
||||||
"@iconify-json/logos": "^1.2.4",
|
"@iconify-json/logos": "^1.2.4",
|
||||||
"@iconify-json/lucide": "^1.2.54",
|
"@iconify-json/lucide": "^1.2.56",
|
||||||
"@iconify-json/simple-icons": "^1.2.41",
|
"@iconify-json/simple-icons": "^1.2.42",
|
||||||
"@iconify-json/vscode-icons": "^1.2.23",
|
"@iconify-json/vscode-icons": "^1.2.23",
|
||||||
"@nuxt/content": "^3.6.2",
|
"@nuxt/content": "^3.6.3",
|
||||||
"@nuxt/image": "^1.10.0",
|
"@nuxt/image": "^1.10.0",
|
||||||
"@nuxt/ui": "workspace:*",
|
"@nuxt/ui": "workspace:*",
|
||||||
"@nuxt/ui-pro": "https://pkg.pr.new/@nuxt/ui-pro@22fdc5e",
|
"@nuxt/ui-pro": "https://pkg.pr.new/@nuxt/ui-pro@22fdc5e",
|
||||||
@@ -29,22 +29,22 @@
|
|||||||
"capture-website": "^4.2.0",
|
"capture-website": "^4.2.0",
|
||||||
"joi": "^17.13.3",
|
"joi": "^17.13.3",
|
||||||
"maska": "^3.2.0",
|
"maska": "^3.2.0",
|
||||||
"motion-v": "^1.4.0",
|
"motion-v": "^1.5.0",
|
||||||
"nuxt": "^3.17.6",
|
"nuxt": "^3.17.6",
|
||||||
"nuxt-component-meta": "^0.12.1",
|
"nuxt-component-meta": "^0.12.1",
|
||||||
"nuxt-llms": "^0.1.3",
|
"nuxt-llms": "^0.1.3",
|
||||||
"nuxt-og-image": "^5.1.8",
|
"nuxt-og-image": "^5.1.9",
|
||||||
"prettier": "^3.6.2",
|
"prettier": "^3.6.2",
|
||||||
"shiki-transformer-color-highlight": "^1.0.0",
|
"shiki-transformer-color-highlight": "^1.0.0",
|
||||||
"sortablejs": "^1.15.6",
|
"sortablejs": "^1.15.6",
|
||||||
"superstruct": "^2.0.2",
|
"superstruct": "^2.0.2",
|
||||||
"ufo": "^1.6.1",
|
"ufo": "^1.6.1",
|
||||||
"valibot": "^1.1.0",
|
"valibot": "^1.1.0",
|
||||||
"workers-ai-provider": "^0.7.0",
|
"workers-ai-provider": "^0.7.1",
|
||||||
"yup": "^1.6.1",
|
"yup": "^1.6.1",
|
||||||
"zod": "^3.25.67"
|
"zod": "^3.25.75"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"wrangler": "^4.22.0"
|
"wrangler": "^4.23.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,7 +123,7 @@
|
|||||||
"@tailwindcss/postcss": "^4.1.11",
|
"@tailwindcss/postcss": "^4.1.11",
|
||||||
"@tailwindcss/vite": "^4.1.11",
|
"@tailwindcss/vite": "^4.1.11",
|
||||||
"@tanstack/vue-table": "^8.21.3",
|
"@tanstack/vue-table": "^8.21.3",
|
||||||
"@unhead/vue": "^2.0.11",
|
"@unhead/vue": "^2.0.12",
|
||||||
"@vueuse/core": "^13.5.0",
|
"@vueuse/core": "^13.5.0",
|
||||||
"@vueuse/integrations": "^13.5.0",
|
"@vueuse/integrations": "^13.5.0",
|
||||||
"colortranslator": "^5.0.0",
|
"colortranslator": "^5.0.0",
|
||||||
@@ -152,10 +152,10 @@
|
|||||||
"unplugin-auto-import": "^19.3.0",
|
"unplugin-auto-import": "^19.3.0",
|
||||||
"unplugin-vue-components": "^28.8.0",
|
"unplugin-vue-components": "^28.8.0",
|
||||||
"vaul-vue": "0.4.1",
|
"vaul-vue": "0.4.1",
|
||||||
"vue-component-type-helpers": "^3.0.0"
|
"vue-component-type-helpers": "^3.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@nuxt/eslint-config": "^1.5.0",
|
"@nuxt/eslint-config": "^1.5.2",
|
||||||
"@nuxt/module-builder": "^1.0.1",
|
"@nuxt/module-builder": "^1.0.1",
|
||||||
"@nuxt/test-utils": "^3.19.2",
|
"@nuxt/test-utils": "^3.19.2",
|
||||||
"@release-it/conventional-changelog": "^10.0.1",
|
"@release-it/conventional-changelog": "^10.0.1",
|
||||||
@@ -167,7 +167,7 @@
|
|||||||
"release-it": "^19.0.3",
|
"release-it": "^19.0.3",
|
||||||
"vitest": "^3.2.4",
|
"vitest": "^3.2.4",
|
||||||
"vitest-environment-nuxt": "^1.0.1",
|
"vitest-environment-nuxt": "^1.0.1",
|
||||||
"vue-tsc": "^3.0.0"
|
"vue-tsc": "^3.0.1"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@inertiajs/vue3": "^2.0.7",
|
"@inertiajs/vue3": "^2.0.7",
|
||||||
|
|||||||
@@ -13,12 +13,12 @@
|
|||||||
"@nuxt/ui": "workspace:*",
|
"@nuxt/ui": "workspace:*",
|
||||||
"vue": "^3.5.17",
|
"vue": "^3.5.17",
|
||||||
"vue-router": "^4.5.1",
|
"vue-router": "^4.5.1",
|
||||||
"zod": "^3.25.67"
|
"zod": "^3.25.75"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vitejs/plugin-vue": "^5.2.4",
|
"@vitejs/plugin-vue": "^5.2.4",
|
||||||
"typescript": "^5.8.3",
|
"typescript": "^5.8.3",
|
||||||
"vite": "^6.3.5",
|
"vite": "^6.3.5",
|
||||||
"vue-tsc": "^3.0.0"
|
"vue-tsc": "^3.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ const groups = computed(() => [{
|
|||||||
label: 'Set Wallpaper',
|
label: 'Set Wallpaper',
|
||||||
suffix: 'Choose from beautiful wallpaper collection.',
|
suffix: 'Choose from beautiful wallpaper collection.',
|
||||||
icon: 'i-lucide-image',
|
icon: 'i-lucide-image',
|
||||||
interface: 'wallpaper',
|
view: 'wallpaper',
|
||||||
placeholder: 'Search wallpapers...'
|
placeholder: 'Search wallpapers...'
|
||||||
}, {
|
}, {
|
||||||
label: 'More actions',
|
label: 'More actions',
|
||||||
@@ -279,8 +279,8 @@ defineShortcuts({
|
|||||||
class="sm:max-h-80"
|
class="sm:max-h-80"
|
||||||
@update:model-value="onSelect"
|
@update:model-value="onSelect"
|
||||||
>
|
>
|
||||||
<template #interface="{ interfaceName }">
|
<template #view="{ viewName }">
|
||||||
<div v-if="interfaceName === 'wallpaper'" class="flex flex-col h-full w-full">
|
<div v-if="viewName === 'wallpaper'" class="flex flex-col h-full w-full">
|
||||||
<div class="flex-1 overflow-y-auto p-6">
|
<div class="flex-1 overflow-y-auto p-6">
|
||||||
<div class="grid grid-cols-4 gap-4">
|
<div class="grid grid-cols-4 gap-4">
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -9,17 +9,17 @@
|
|||||||
"typecheck": "nuxt typecheck"
|
"typecheck": "nuxt typecheck"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@iconify-json/lucide": "^1.2.54",
|
"@iconify-json/lucide": "^1.2.56",
|
||||||
"@iconify-json/simple-icons": "^1.2.41",
|
"@iconify-json/simple-icons": "^1.2.42",
|
||||||
"@internationalized/date": "^3.8.2",
|
"@internationalized/date": "^3.8.2",
|
||||||
"@nuxt/ui": "workspace:*",
|
"@nuxt/ui": "workspace:*",
|
||||||
"@nuxthub/core": "^0.9.0",
|
"@nuxthub/core": "^0.9.0",
|
||||||
"nuxt": "^3.17.6",
|
"nuxt": "^3.17.6",
|
||||||
"zod": "^3.25.67"
|
"zod": "^3.25.75"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"typescript": "^5.8.3",
|
"typescript": "^5.8.3",
|
||||||
"vue-tsc": "^3.0.0"
|
"vue-tsc": "^3.0.1"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"unimport": "4.1.1"
|
"unimport": "4.1.1"
|
||||||
|
|||||||
728
pnpm-lock.yaml
generated
728
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -32,10 +32,10 @@ export interface CommandPaletteItem extends Omit<LinkProps, 'type' | 'raw' | 'cu
|
|||||||
placeholder?: string
|
placeholder?: string
|
||||||
children?: CommandPaletteItem[]
|
children?: CommandPaletteItem[]
|
||||||
/**
|
/**
|
||||||
* Custom interface slot to display instead of children items.
|
* Custom view to display instead of children items.
|
||||||
* When defined, clicking this item will show the custom interface.
|
* When defined, clicking this item will show the custom view.
|
||||||
*/
|
*/
|
||||||
interface?: string
|
view?: string
|
||||||
onSelect?(e?: Event): void
|
onSelect?(e?: Event): void
|
||||||
class?: any
|
class?: any
|
||||||
ui?: Pick<CommandPalette['slots'], 'item' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemLeadingChipSize' | 'itemLeadingChip' | 'itemLabel' | 'itemLabelPrefix' | 'itemLabelBase' | 'itemLabelSuffix' | 'itemTrailing' | 'itemTrailingKbds' | 'itemTrailingKbdsSize' | 'itemTrailingHighlightedIcon' | 'itemTrailingIcon'>
|
ui?: Pick<CommandPalette['slots'], 'item' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemLeadingChipSize' | 'itemLeadingChip' | 'itemLabel' | 'itemLabelPrefix' | 'itemLabelBase' | 'itemLabelSuffix' | 'itemTrailing' | 'itemTrailingKbds' | 'itemTrailingKbdsSize' | 'itemTrailingHighlightedIcon' | 'itemTrailingIcon'>
|
||||||
@@ -154,7 +154,7 @@ export type CommandPaletteSlots<G extends CommandPaletteGroup<T> = CommandPalett
|
|||||||
'empty'(props: { searchTerm?: string }): any
|
'empty'(props: { searchTerm?: string }): any
|
||||||
'back'(props: { ui: { [K in keyof Required<CommandPalette['slots']>]: (props?: Record<string, any>) => string } }): any
|
'back'(props: { ui: { [K in keyof Required<CommandPalette['slots']>]: (props?: Record<string, any>) => string } }): any
|
||||||
'close'(props: { ui: { [K in keyof Required<CommandPalette['slots']>]: (props?: Record<string, any>) => string } }): any
|
'close'(props: { ui: { [K in keyof Required<CommandPalette['slots']>]: (props?: Record<string, any>) => string } }): any
|
||||||
'interface'(props: { interfaceName?: string, current: any, searchTerm: string, navigateBack: () => void }): any
|
'view'(props: { viewName?: string, current: any, searchTerm: string, navigateBack: () => void }): any
|
||||||
'item': SlotProps<T>
|
'item': SlotProps<T>
|
||||||
'item-leading': SlotProps<T>
|
'item-leading': SlotProps<T>
|
||||||
'item-label': SlotProps<T>
|
'item-label': SlotProps<T>
|
||||||
@@ -214,15 +214,15 @@ const fuse = computed(() => defu({}, props.fuse, {
|
|||||||
matchAllWhenSearchEmpty: true
|
matchAllWhenSearchEmpty: true
|
||||||
}))
|
}))
|
||||||
|
|
||||||
const history = ref<(CommandPaletteGroup & { placeholder?: string, interface?: string })[]>([])
|
const history = ref<(CommandPaletteGroup & { placeholder?: string, view?: string })[]>([])
|
||||||
|
|
||||||
const placeholder = computed(() => history.value[history.value.length - 1]?.placeholder || props.placeholder || t('commandPalette.placeholder'))
|
const placeholder = computed(() => history.value[history.value.length - 1]?.placeholder || props.placeholder || t('commandPalette.placeholder'))
|
||||||
|
|
||||||
const groups = computed(() => history.value?.length ? [history.value[history.value.length - 1] as G] : props.groups)
|
const groups = computed(() => history.value?.length ? [history.value[history.value.length - 1] as G] : props.groups)
|
||||||
|
|
||||||
const _currentInterface = computed(() => {
|
const currentView = computed(() => {
|
||||||
const current = history.value[history.value.length - 1]
|
const current = history.value[history.value.length - 1]
|
||||||
return current?.interface ? current : null
|
return current?.view ? current : null
|
||||||
})
|
})
|
||||||
|
|
||||||
const items = computed(() => groups.value?.filter((group) => {
|
const items = computed(() => groups.value?.filter((group) => {
|
||||||
@@ -291,7 +291,7 @@ const filteredGroups = computed(() => {
|
|||||||
const listboxRootRef = useTemplateRef('listboxRootRef')
|
const listboxRootRef = useTemplateRef('listboxRootRef')
|
||||||
|
|
||||||
function navigate(item: T) {
|
function navigate(item: T) {
|
||||||
if (!item.children?.length && !item.interface) {
|
if (!item.children?.length && !item.view) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,7 +300,7 @@ function navigate(item: T) {
|
|||||||
label: item.label,
|
label: item.label,
|
||||||
slot: item.slot,
|
slot: item.slot,
|
||||||
placeholder: item.placeholder,
|
placeholder: item.placeholder,
|
||||||
interface: item.interface,
|
view: item.view,
|
||||||
items: item.children || []
|
items: item.children || []
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
@@ -328,7 +328,7 @@ function onBackspace() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onSelect(e: Event, item: T) {
|
function onSelect(e: Event, item: T) {
|
||||||
if (item.children?.length || item.interface) {
|
if (item.children?.length || item.view) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
navigate(item)
|
navigate(item)
|
||||||
@@ -383,11 +383,11 @@ function onSelect(e: Event, item: T) {
|
|||||||
</ListboxFilter>
|
</ListboxFilter>
|
||||||
|
|
||||||
<ListboxContent :class="ui.content({ class: props.ui?.content })">
|
<ListboxContent :class="ui.content({ class: props.ui?.content })">
|
||||||
<div v-if="_currentInterface" :class="ui.viewport({ class: props.ui?.viewport })">
|
<div v-if="currentView" :class="ui.viewport({ class: props.ui?.viewport })">
|
||||||
<slot
|
<slot
|
||||||
name="interface"
|
name="view"
|
||||||
:interface-name="_currentInterface.interface"
|
:view-name="currentView.view"
|
||||||
:current="_currentInterface"
|
:current="currentView"
|
||||||
:search-term="searchTerm"
|
:search-term="searchTerm"
|
||||||
:navigate-back="navigateBack"
|
:navigate-back="navigateBack"
|
||||||
/>
|
/>
|
||||||
@@ -437,7 +437,7 @@ function onSelect(e: Event, item: T) {
|
|||||||
<span :class="ui.itemTrailing({ class: [props.ui?.itemTrailing, item.ui?.itemTrailing] })">
|
<span :class="ui.itemTrailing({ class: [props.ui?.itemTrailing, item.ui?.itemTrailing] })">
|
||||||
<slot :name="((item.slot ? `${item.slot}-trailing` : group.slot ? `${group.slot}-trailing` : `item-trailing`) as keyof CommandPaletteSlots<G, T>)" :item="(item as any)" :index="index">
|
<slot :name="((item.slot ? `${item.slot}-trailing` : group.slot ? `${group.slot}-trailing` : `item-trailing`) as keyof CommandPaletteSlots<G, T>)" :item="(item as any)" :index="index">
|
||||||
<UIcon
|
<UIcon
|
||||||
v-if="(item.children && item.children.length > 0) || item.interface"
|
v-if="(item.children && item.children.length > 0) || item.view"
|
||||||
:name="trailingIcon || appConfig.ui.icons.chevronRight"
|
:name="trailingIcon || appConfig.ui.icons.chevronRight"
|
||||||
:class="ui.itemTrailingIcon({ class: [props.ui?.itemTrailingIcon, item.ui?.itemTrailingIcon] })"
|
:class="ui.itemTrailingIcon({ class: [props.ui?.itemTrailingIcon, item.ui?.itemTrailingIcon] })"
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user