Skip to content

feat(module): add support for vue using unplugin #2416

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 54 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
251f874
refactor(module): split out defaults + template factory
danielroe Oct 17, 2024
52e7cc8
chore: use explicit imports in playground
danielroe Oct 17, 2024
4425302
refactor(module): split out colour resolver
danielroe Oct 17, 2024
34815a5
feat: add support for using nuxt/ui in pure vue using unplugin
danielroe Oct 18, 2024
2950b57
chore: add `fast-deep-equal` to dependency list
danielroe Oct 18, 2024
99b5b03
chore: remove log
danielroe Oct 18, 2024
949f9ee
refactor: pass ui config specifically to templates
danielroe Oct 18, 2024
4659599
chore: add some internal docs
danielroe Oct 18, 2024
833a8dc
refactor(unplugin): migrate to using inline unplugin config
danielroe Oct 18, 2024
49da2da
chore: improve vue playground
danielroe Oct 18, 2024
334f341
chore: enable vue playground to work in stubbed mode
danielroe Oct 18, 2024
d7f671e
Merge branch 'v3' into vue
danielroe Oct 18, 2024
40cc250
chore: fix type checking errors in playground
danielroe Oct 18, 2024
302d39a
chore: typo
danielroe Oct 18, 2024
a75f482
fix: ensure we transform ui components within node_modules
danielroe Oct 18, 2024
6b0ca34
fix: improve NuxtLink stub implementation
danielroe Oct 18, 2024
c1001ff
fix: allow not passing options object
danielroe Oct 18, 2024
96f3518
Merge remote-tracking branch 'origin/v3' into vue
danielroe Oct 18, 2024
f440de9
fix: export from `@unhead/vue`
danielroe Oct 18, 2024
e6a2705
docs: add basic documentation
danielroe Oct 18, 2024
d5949e3
docs: add block type
danielroe Oct 18, 2024
bc218a2
playground-vue: handle responsive like playground
benjamincanac Oct 21, 2024
01bdcba
playground-vue: load playground components
benjamincanac Oct 21, 2024
e8143d2
docs(deps): update `@nuxt/ui-pro`
benjamincanac Oct 21, 2024
b2f785a
docs(installation): move `vue` under synced tabs
benjamincanac Oct 21, 2024
af56b7c
Merge remote-tracking branch 'origin/v3' into vue
danielroe Oct 21, 2024
6e524a2
fix: override UIcon and ULink instead of stubbing vue component
danielroe Oct 21, 2024
660e609
fix: apply `import.meta.client` transform to all components
danielroe Oct 21, 2024
b1c144a
Merge remote-tracking branch 'origin/v3' into vue
danielroe Oct 21, 2024
2f4d9f1
build: add `./vite` subpath
danielroe Oct 23, 2024
6f20dbc
Merge remote-tracking branch 'origin/v3' into vue
danielroe Oct 23, 2024
b33a4a4
fix: support stub types for components
danielroe Oct 23, 2024
38c5b28
fix: ensure we resolve our ids first
danielroe Oct 23, 2024
03326d8
build: ensure `#build/ui` remains unchanged
danielroe Oct 23, 2024
b253f48
build: mark `vite` external
danielroe Oct 23, 2024
ecdd29b
feat: enable disabling declaration generation
danielroe Oct 23, 2024
fa1b255
test: add vue test suite
danielroe Oct 23, 2024
7b0cecd
Merge remote-tracking branch 'origin/v3' into vue
danielroe Oct 23, 2024
f515fa1
chore: lint
danielroe Oct 23, 2024
8ec6550
fix: handle external links
danielroe Oct 23, 2024
b852a4a
fix: simplify link class resolution
danielroe Oct 23, 2024
0e3467a
test: test with overridden components
danielroe Oct 23, 2024
03d71ca
chore: remove unused import
danielroe Oct 23, 2024
d775faa
docs: update to use `/vite` subpath
danielroe Oct 24, 2024
1565d13
Merge remote-tracking branch 'origin/v3' into vue
danielroe Oct 24, 2024
82ba244
Merge remote-tracking branch 'origin/v3' into vue
danielroe Oct 24, 2024
f607c9d
docs(installation): split in two pages
benjamincanac Oct 24, 2024
4f0271f
docs(Header): improve mobile navigation
benjamincanac Oct 25, 2024
c8b8cf9
docs(deps): update `@nuxt/ui-pro`
benjamincanac Oct 25, 2024
44692ad
fix(Icon): add default `inline-block`
benjamincanac Oct 25, 2024
e941573
refactor: extract NuxtLinkProps into project
danielroe Oct 25, 2024
43e7ff5
chore(Icon): move `inline-block` to external icons only
benjamincanac Oct 25, 2024
3a6ca2f
test(Button): remove log
benjamincanac Oct 25, 2024
0f99a4c
docs: clean mdc
benjamincanac Oct 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci-v3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ jobs:
- name: Test
run: pnpm run test

- name: Test (vue)
run: pnpm run test:vue

- name: Build
run: pnpm run build

Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ logs
.env
.env.*
!.env.example

playground-vue/auto-imports.d.ts
playground-vue/components.d.ts
10 changes: 9 additions & 1 deletion build.config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
import { defineBuildConfig } from 'unbuild'

export default defineBuildConfig({
entries: [
'./src/unplugin',
'./src/vite'
],
rollup: {
emitCJS: true
},
replace: {
'process.env.DEV': 'false'
},
hooks: {
'mkdist:entry:options'(ctx, entry, options) {
options.addRelativeDeclarationExtensions = false
}
}
},
externals: ['#build/ui', 'vite']
})
11 changes: 10 additions & 1 deletion docs/app/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,16 @@ useServerSeoMeta({
twitterCard: 'summary_large_image'
})

provide('navigation', navigation)
const updatedNavigation = computed(() => navigation.value.map(item => ({
...item,
children: item.children?.map(child => ({
...child,
active: child.title === 'Installation' ? route.path.startsWith('/getting-started/installation') : undefined,
children: child.title === 'Installation' ? [] : child.children
})) || []
})))

provide('navigation', updatedNavigation)
</script>

<template>
Expand Down
2 changes: 1 addition & 1 deletion docs/app/components/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ defineShortcuts({

<USeparator type="dashed" class="my-4" /> -->

<UContentNavigation :navigation="navigation" />
<UContentNavigation :navigation="navigation" highlight />
</template>
</UHeader>
</template>
30 changes: 26 additions & 4 deletions docs/app/pages/[...slug].vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script setup lang="ts">
import { withoutTrailingSlash } from 'ufo'
import { findPageHeadline } from '#ui-pro/utils/content'
import type { NavItem } from '@nuxt/content'
import { findPageBreadcrumb, mapContentNavigation } from '#ui-pro/utils/content'

const route = useRoute()

Expand All @@ -25,7 +26,9 @@ const { data: surround } = await useAsyncData(`${route.path}-surround`, () => {
.findSurround(withoutTrailingSlash(route.path))
}, { default: () => [] })

const headline = computed(() => findPageHeadline(page.value))
const navigation = inject<Ref<NavItem[]>>('navigation')

const breadcrumb = computed(() => mapContentNavigation(findPageBreadcrumb(navigation?.value, page.value)))

useSeoMeta({
titleTemplate: '%s - Nuxt UI v3',
Expand All @@ -36,7 +39,7 @@ useSeoMeta({
})

defineOgImageComponent('Docs', {
headline: headline.value
headline: breadcrumb.value.map(item => item.label).join(' > ')
})

const communityLinks = computed(() => [{
Expand Down Expand Up @@ -75,12 +78,31 @@ const communityLinks = computed(() => [{

<template>
<UPage v-if="page">
<UPageHeader :title="page.title" :headline="headline">
<UPageHeader :title="page.title">
<template #headline>
<UBreadcrumb :items="breadcrumb" />
</template>

<template #description>
<MDC v-if="page.description" :value="page.description" unwrap="p" />
</template>

<template #links>
<UDropdownMenu v-if="page.select" v-slot="{ open }" :items="page.select.items" :content="{ align: 'end' }">
<UButton
color="neutral"
variant="subtle"
v-bind="page.select.items.find((item: any) => item.to === route.path)"
block
trailing-icon="i-heroicons-chevron-down-20-solid"
:class="[open && 'bg-[var(--ui-bg-accented)]/75']"
:ui="{
trailingIcon: ['transition-transform duration-200', open ? 'rotate-180' : '']
}"
class="w-[128px]"
/>
</UDropdownMenu>

<UButton
v-for="link in page.links"
:key="link.label"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
---
title: Installation
description: 'Learn how to install and configure Nuxt UI v3 in your application.'
title: Install in a Nuxt app
navigation.title: Nuxt
description: 'Learn how to install and configure Nuxt UI in your Nuxt application.'
select:
items:
- label: Nuxt
icon: i-logos-nuxt-icon
to: /getting-started/installation/nuxt
- label: Vue
icon: i-logos-vue
to: /getting-started/installation/vue
---

## Setup

1. Install the Nuxt UI v3 alpha package:

::code-group
::code-group{sync="pm"}

```bash [pnpm]
pnpm add @nuxt/ui@next
Expand Down Expand Up @@ -50,7 +59,7 @@ If you're using **pnpm**, ensure that you either set [`shamefully-hoist=true`](h

## Options

You can customize Nuxt UI by providing options in your `nuxt.config.ts`:
You can customize Nuxt UI by providing options in your `nuxt.config.ts`.

### `prefix`

Expand Down Expand Up @@ -145,7 +154,7 @@ Nuxt UI v3 uses [pkg.pr.new](https://github.com/stackblitz-labs/pkg.pr.new) for

Preview releases are automatically generated for every commit to the `v3` branch and pull requests targeting the `v3` branch. To use it into your project, use the installation command below by replacing `5385f84` with any commit hash or pull request number.

::code-group
::code-group{sync="pm"}

```bash [pnpm]
pnpm add https://pkg.pr.new/@nuxt/ui@5385f84
Expand Down
Loading