@nuxt/ui 0.1.1 → 0.3.1

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 CHANGED
@@ -12,7 +12,7 @@ UI kit for Nuxt 3's examples and internal tooling UI.
12
12
 
13
13
  ```ts
14
14
  // nuxt.config.js
15
- import { defineNuxtConfig } from 'nuxt3'
15
+ import { defineNuxtConfig } from 'nuxt'
16
16
 
17
17
  export default defineNuxtConfig({
18
18
  modules: [
@@ -61,7 +61,7 @@ It's also possible to override the default theme globally, for example:
61
61
 
62
62
  ```ts
63
63
  // nuxt.config.js
64
- import { defineNuxtConfig } from 'nuxt3'
64
+ import { defineNuxtConfig } from 'nuxt'
65
65
 
66
66
  export default defineNuxtConfig({
67
67
  modules: [
@@ -0,0 +1,7 @@
1
+ <template>
2
+ <svg viewBox="0 0 236 65" fill="none" xmlns="http://www.w3.org/2000/svg">
3
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M29.3445 12.5176c-1.8181-3.10288-6.3636-3.10288-8.1819 0L1.34708 46.334c-1.8182 3.1029.45453 6.9814 4.09096 6.9814H20.9071c-1.5538-1.3478-2.1292-3.6793-.9532-5.68l15.0073-25.5327-5.6167-9.5851Z" fill="#80EEC0" />
4
+ <path d="M41.9001 19.9353c1.5048-2.5387 5.2665-2.5387 6.7712 0l16.3991 27.6679c1.5048 2.5387-.3762 5.7122-3.3855 5.7122H28.8867c-3.0093 0-4.8904-3.1735-3.3857-5.7122l16.3991-27.6679Z" fill="#00DC82" />
5
+ <path d="M93.247 53.206c7.271 0 12.682-4.1739 13.273-10.2874h-5.579c-.508 3.2042-3.6358 5.4388-7.694 5.4388-5.1572 0-9.0462-3.5415-9.0462-10.2451 0-6.7037 3.889-10.2875 9.0462-10.2875 3.9735 0 7.102 2.2345 7.524 5.4811h5.834c-.803-6.1135-6.214-10.2875-13.358-10.2875-7.7358 0-14.6684 5.0593-14.6684 15.0939 0 10.0344 6.8059 15.0937 14.6684 15.0937Zm26.866 0c6.468 0 11.118-4.6378 11.118-10.962 0-6.3242-4.65-10.962-11.118-10.962-6.51 0-11.159 4.6378-11.159 10.962 0 6.3242 4.649 10.962 11.159 10.962Zm0-4.4692c-3.55 0-5.918-2.6562-5.918-6.4928 0-3.8368 2.368-6.4927 5.918-6.4927 3.509 0 5.877 2.6559 5.877 6.4927 0 3.8366-2.368 6.4928-5.877 6.4928Zm19.826 4.1319V41.2743c0-3.12 2.029-5.3967 4.946-5.3967 2.663 0 4.439 2.0239 4.439 4.933v12.0581h5.199V39.7143c0-4.975-3.128-8.4323-7.947-8.4323-3.044 0-5.453 1.3071-6.637 3.6259v-3.2886h-5.199v21.2494h5.199Zm21.158-21.2494h-4.185v4.3427h4.185v9.4864c0 4.722 3.044 7.4203 7.694 7.4203h3.424v-4.3849h-2.833c-1.943 0-3.085-1.0961-3.085-3.2464V35.962h5.918v-4.3427h-5.918v-6.4085h-5.2v6.4085Zm28.684 14.1662c-.55 2.0237-2.283 3.12-4.946 3.12-3.297 0-5.495-2.1924-5.876-5.6074h15.725c.043-.4217.085-1.0541.085-1.7709 0-5.0593-3.211-10.2452-10.357-10.2452-6.974 0-10.441 5.2703-10.441 10.8776 0 5.5654 3.89 11.0464 10.864 11.0464 5.243 0 9.215-2.9092 10.018-7.4205h-5.072Zm-5.369-10.6245c3.086 0 4.947 2.0237 5.158 4.722h-10.483c.549-3.2044 2.408-4.722 5.325-4.722Zm19.141 17.7077V41.2743c0-3.12 2.029-5.3967 4.947-5.3967 2.663 0 4.439 2.0239 4.439 4.933v12.0581h5.199V39.7143c0-4.975-3.128-8.4323-7.947-8.4323-3.044 0-5.453 1.3071-6.638 3.6259v-3.2886h-5.199v21.2494h5.199Zm21.159-21.2494h-4.185v4.3427h4.185v9.4864c0 4.722 3.043 7.4203 7.693 7.4203h3.425v-4.3849h-2.833c-1.945 0-3.086-1.0961-3.086-3.2464V35.962h5.919v-4.3427h-5.919v-6.4085h-5.199v6.4085Z" fill="currentColor" />
6
+ </svg>
7
+ </template>
@@ -1,6 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import NIcon from './NIcon.vue'
3
- import NuxtIcon from './NuxtIcon.vue'
3
+ import NuxtLogo from './NuxtLogo.vue'
4
+ import NuxtContentLogo from './NuxtContentLogo.vue'
4
5
 
5
6
  interface Props {
6
7
  example?: string
@@ -22,8 +23,9 @@ const openInEditor = () => {
22
23
  <div class="relative font-sans" n="green6">
23
24
  <div class="container max-w-200 mx-auto py-10 px-4">
24
25
  <div class="flex items-end gap-3 mb-4 relative">
25
- <slot name="icon">
26
- <NuxtIcon />
26
+ <slot name="logo">
27
+ <NuxtContentLogo v-if="repo === 'nuxt/content'" class="h-10" />
28
+ <NuxtLogo v-else class="h-10" />
27
29
  </slot>
28
30
  <div class="text-xl flex">
29
31
  <div class="op-50">
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <svg viewBox="0 0 221 65" fill="none" xmlns="http://www.w3.org/2000/svg" class="h-10">
2
+ <svg viewBox="0 0 221 65" fill="none" xmlns="http://www.w3.org/2000/svg">
3
3
  <g clip-path="url(#a)">
4
4
  <path
5
5
  fill="currentColor"
@@ -9,8 +9,8 @@ const isDark = computed<boolean>({
9
9
  get () {
10
10
  return mode.value === 'dark'
11
11
  },
12
- set (v) {
13
- mode.preference = v ? 'dark' : 'light'
12
+ set () {
13
+ mode.preference = isDark.value ? 'light' : 'dark'
14
14
  }
15
15
  })
16
16
  const toggle = useToggle(isDark)
package/dist/nuxt.mjs CHANGED
@@ -1,123 +1,11 @@
1
1
  import { fileURLToPath } from 'url';
2
- import { defineNuxtModule, addComponentsDir, installModule } from '@nuxt/kit';
2
+ import { defineNuxtModule, addComponentsDir, createResolver, installModule } from '@nuxt/kit';
3
3
  import defu from 'defu';
4
- import UnocssModule from '@unocss/nuxt';
5
- import VueUseModule from '@vueuse/nuxt';
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';
11
-
12
- const NuxtUIPreset = {
13
- name: "nuxt-ui",
14
- theme: mergeDeep(theme, {
15
- colors: {
16
- context: "rgba(var(--nui-c-context),%alpha)"
17
- },
18
- fontFamily: {
19
- sans: "Avenir, Helvetica, Arial, sans-serif"
20
- }
21
- }),
22
- rules: [
23
- [/^n-(.*)$/, ([, body], { theme }) => {
24
- const color = parseColor(body, theme);
25
- if (color?.cssColor?.type === "rgb" && color.cssColor.components) {
26
- return {
27
- "--nui-c-context": `${color.cssColor.components.join(",")}`
28
- };
29
- }
30
- }],
31
- [/^n-(.*)$/, fonts[1][1]],
32
- ["n-dashed", { "border-style": "dashed" }],
33
- ["n-solid", {
34
- "background-color": "rgba(var(--nui-c-context), 1) !important",
35
- "border-color": "rgba(var(--nui-c-context), 1)",
36
- color: "white !important"
37
- }],
38
- ["n-disabled", {
39
- opacity: 0.4,
40
- "pointer-events": "none",
41
- filter: "saturate(0)"
42
- }]
43
- ],
44
- variants: [
45
- (input) => {
46
- const prefix = "n-disabled:";
47
- if (input.startsWith(prefix)) {
48
- return {
49
- matcher: input.slice(prefix.length),
50
- selector: (input2) => `[disabled] ${input2}, ${input2}[disabled]`
51
- };
52
- }
53
- },
54
- (input) => {
55
- const prefix = "n-checked:";
56
- if (input.startsWith(prefix)) {
57
- return {
58
- matcher: input.slice(prefix.length),
59
- selector: (input2) => `[checked] ${input2}, ${input2}[checked]`
60
- };
61
- }
62
- }
63
- ],
64
- shortcuts: {
65
- "n-bg-base": "bg-white dark:bg-[#222]",
66
- "n-border-base": "border-gray-400/50",
67
- "n-border-300": "border-gray-400/40",
68
- "n-border-200": "border-gray-400/25",
69
- "n-transition": "transition-all duration-200",
70
- "n-focus-base": "ring-2 ring-context/50",
71
- "n-active-base": "ring-3 ring-context/10",
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",
75
- "n-card-base": "border n-border-200 rounded n-bg-base shadow-sm",
76
- "n-header-upper": "text-sm uppercase mb-2 leading-1.2em tracking-wide op50",
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",
78
- "n-button-hover": "op100 !border-context text-context",
79
- "n-button-active": "n-active-base bg-context/5",
80
- "n-button-icon": "-ml-0.2em mr-0.2em text-1.1em",
81
- "n-checkbox-box": "border n-border-base w-1.1em h-1.1em mr-1 text-white flex flex-none items-center rounded-sm overflow-visible",
82
- "n-checkbox-box-checked": "bg-context border-context",
83
- "n-checkbox-icon": "carbon-checkmark",
84
- "n-radio-box": "border n-border-base w-1.2em h-1.2em mr-1 text-white flex flex-none rounded-full overflow-visible",
85
- "n-radio-box-checked": "border-context",
86
- "n-radio-inner": "bg-context rounded-1/2 w-0 h-0 m-auto",
87
- "n-radio-inner-checked": "w-0.8em h-0.8em",
88
- "n-switch-base": "inline-flex items-center select-none",
89
- "n-switch-slider": "mr-1 rounded-full border n-border-base relative p-2px",
90
- "n-switch-slider-checked": "border-context/20 bg-context/10",
91
- "n-switch-thumb": "h-1em w-1em rounded-1/2 border n-border-base ml-0 mr-0.8em",
92
- "n-switch-thumb-checked": "bg-context border-context ml-0.8em mr-0",
93
- "n-tip-base": "bg-context/8 text-context px-1em py-0.4em rounded flex items-center dark:bg-context/12",
94
- "n-tip-icon": "-ml-0.2em mr-0.4em text-1.1em"
95
- }
96
- };
97
- function extendUnocssOptions(user = {}) {
98
- return {
99
- ...user,
100
- preflight: true,
101
- presets: [
102
- presetUno(),
103
- presetAttributify(),
104
- presetIcons({
105
- prefix: "",
106
- scale: 1.2,
107
- extraProperties: {
108
- display: "inline-block",
109
- "vertical-align": "middle"
110
- }
111
- }),
112
- NuxtUIPreset,
113
- ...user.presets || []
114
- ],
115
- transformers: [
116
- transformerDirectives(),
117
- transformerVariantGroup()
118
- ]
119
- };
120
- }
4
+ import { extendUnocssOptions } from './unocss.mjs';
5
+ import '@unocss/preset-mini/utils';
6
+ import '@unocss/preset-mini';
7
+ import '@unocss/preset-mini/rules';
8
+ import 'unocss';
121
9
 
122
10
  const rPath = (p) => fileURLToPath(new URL(p, import.meta.url).toString());
123
11
  const nuxt = defineNuxtModule({
@@ -136,11 +24,12 @@ const nuxt = defineNuxtModule({
136
24
  if (!options.dev) {
137
25
  nuxt.options.unocss = extendUnocssOptions(nuxt.options.unocss);
138
26
  }
139
- nuxt.options.vueuse = Object.assign({ ssrHandlers: true }, nuxt.options.vueuse || {});
27
+ nuxt.options.vueuse = nuxt.options.vueuse || {};
140
28
  nuxt.options.colorMode = defu(nuxt.options.colorMode, { classSuffix: "" });
141
- await installModule(UnocssModule);
142
- await installModule(VueUseModule);
143
- await installModule(NuxtColorMode);
29
+ const resolver = createResolver(import.meta.url);
30
+ await installModule(await resolver.resolvePath("@unocss/nuxt"));
31
+ await installModule(await resolver.resolvePath("@vueuse/nuxt"));
32
+ await installModule(await resolver.resolvePath("@nuxtjs/color-mode"));
144
33
  }
145
34
  });
146
35
 
@@ -0,0 +1,7 @@
1
+ import { Preset } from '@unocss/core';
2
+ import { UnocssNuxtOptions } from '@unocss/nuxt';
3
+
4
+ declare const NuxtUIPreset: () => Preset;
5
+ declare function extendUnocssOptions(user?: UnocssNuxtOptions): UnocssNuxtOptions;
6
+
7
+ export { NuxtUIPreset, extendUnocssOptions };
@@ -0,0 +1,117 @@
1
+ import { parseColor } from '@unocss/preset-mini/utils';
2
+ import { theme } from '@unocss/preset-mini';
3
+ import { fonts } from '@unocss/preset-mini/rules';
4
+ import { mergeDeep, presetUno, presetAttributify, presetTypography, presetIcons, transformerDirectives, transformerVariantGroup } from 'unocss';
5
+
6
+ const NuxtUIPreset = () => ({
7
+ name: "nuxt-ui",
8
+ theme: mergeDeep(theme, {
9
+ colors: {
10
+ context: "rgba(var(--nui-c-context),%alpha)"
11
+ },
12
+ fontFamily: {
13
+ sans: "Avenir, Helvetica, Arial, sans-serif"
14
+ }
15
+ }),
16
+ rules: [
17
+ [/^n-(.*)$/, ([, body], { theme }) => {
18
+ const color = parseColor(body, theme);
19
+ if (color?.cssColor?.type === "rgb" && color.cssColor.components) {
20
+ return {
21
+ "--nui-c-context": `${color.cssColor.components.join(",")}`
22
+ };
23
+ }
24
+ }],
25
+ [/^n-(.*)$/, fonts[1][1]],
26
+ ["n-dashed", { "border-style": "dashed" }],
27
+ ["n-solid", {
28
+ "background-color": "rgba(var(--nui-c-context), 1) !important",
29
+ "border-color": "rgba(var(--nui-c-context), 1)",
30
+ color: "white !important"
31
+ }],
32
+ ["n-disabled", {
33
+ opacity: 0.4,
34
+ "pointer-events": "none",
35
+ filter: "saturate(0)"
36
+ }]
37
+ ],
38
+ variants: [
39
+ (input) => {
40
+ const prefix = "n-disabled:";
41
+ if (input.startsWith(prefix)) {
42
+ return {
43
+ matcher: input.slice(prefix.length),
44
+ selector: (input2) => `[disabled] ${input2}, ${input2}[disabled]`
45
+ };
46
+ }
47
+ },
48
+ (input) => {
49
+ const prefix = "n-checked:";
50
+ if (input.startsWith(prefix)) {
51
+ return {
52
+ matcher: input.slice(prefix.length),
53
+ selector: (input2) => `[checked] ${input2}, ${input2}[checked]`
54
+ };
55
+ }
56
+ }
57
+ ],
58
+ shortcuts: {
59
+ "n-bg-base": "bg-white dark:bg-[#222]",
60
+ "n-border-base": "border-gray-400/50",
61
+ "n-border-300": "border-gray-400/40",
62
+ "n-border-200": "border-gray-400/25",
63
+ "n-transition": "transition-all duration-200",
64
+ "n-focus-base": "ring-2 ring-context/50",
65
+ "n-active-base": "ring-3 ring-context/10",
66
+ "n-borderless": "!border-none !shadow-none",
67
+ "n-link-base": "underline underline-offset-2 underline-black/20 dark:underline-white/40",
68
+ "n-link-hover": "decoration-dotted text-context underline-context",
69
+ "n-card-base": "border n-border-200 rounded n-bg-base shadow-sm",
70
+ "n-header-upper": "text-sm uppercase mb-2 leading-1.2em tracking-wide op50",
71
+ "n-button-base": "border n-border-base rounded shadow-sm px-1em py-0.25em inline-flex items-center gap-1 op80 !outline-none",
72
+ "n-button-hover": "op100 !border-context text-context",
73
+ "n-button-active": "n-active-base bg-context/5",
74
+ "n-button-icon": "-ml-0.2em mr-0.2em text-1.1em",
75
+ "n-checkbox-box": "border n-border-base w-1.1em h-1.1em mr-1 text-white flex flex-none items-center rounded-sm overflow-visible",
76
+ "n-checkbox-box-checked": "bg-context border-context",
77
+ "n-checkbox-icon": "carbon-checkmark",
78
+ "n-radio-box": "border n-border-base w-1.2em h-1.2em mr-1 text-white flex flex-none rounded-full overflow-visible",
79
+ "n-radio-box-checked": "border-context",
80
+ "n-radio-inner": "bg-context rounded-1/2 w-0 h-0 m-auto",
81
+ "n-radio-inner-checked": "w-0.8em h-0.8em",
82
+ "n-switch-base": "inline-flex items-center select-none",
83
+ "n-switch-slider": "mr-1 rounded-full border n-border-base relative p-2px",
84
+ "n-switch-slider-checked": "border-context/20 bg-context/10",
85
+ "n-switch-thumb": "h-1em w-1em rounded-1/2 border n-border-base ml-0 mr-0.8em",
86
+ "n-switch-thumb-checked": "bg-context border-context ml-0.8em mr-0",
87
+ "n-tip-base": "bg-context/8 text-context px-1em py-0.4em rounded flex items-center dark:bg-context/12",
88
+ "n-tip-icon": "-ml-0.2em mr-0.4em text-1.1em"
89
+ }
90
+ });
91
+ function extendUnocssOptions(user = {}) {
92
+ return {
93
+ ...user,
94
+ preflight: true,
95
+ presets: [
96
+ presetUno(),
97
+ presetAttributify(),
98
+ presetTypography(),
99
+ presetIcons({
100
+ prefix: "",
101
+ scale: 1.2,
102
+ extraProperties: {
103
+ display: "inline-block",
104
+ "vertical-align": "middle"
105
+ }
106
+ }),
107
+ NuxtUIPreset(),
108
+ ...user.presets || []
109
+ ],
110
+ transformers: [
111
+ transformerDirectives(),
112
+ transformerVariantGroup()
113
+ ]
114
+ };
115
+ }
116
+
117
+ export { NuxtUIPreset, extendUnocssOptions };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/ui",
3
- "version": "0.1.1",
3
+ "version": "0.3.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -11,6 +11,9 @@
11
11
  "./nuxt": {
12
12
  "import": "./dist/nuxt.mjs",
13
13
  "require": "./nuxt.cjs"
14
+ },
15
+ "./unocss": {
16
+ "import": "./dist/unocss.mjs"
14
17
  }
15
18
  },
16
19
  "main": "./dist/nuxt.mjs",
@@ -20,34 +23,34 @@
20
23
  ],
21
24
  "scripts": {
22
25
  "build": "unbuild",
23
- "dev": "yarn nuxi dev playground",
26
+ "dev": "nuxi dev playground",
24
27
  "lint": "eslint . --ext .vue,.ts",
25
28
  "prepack": "npm run build",
26
- "playground:build": "yarn nuxi build playground"
29
+ "playground:build": "nuxi build playground"
27
30
  },
28
31
  "dependencies": {
29
- "@iconify-json/carbon": "^1.1.3",
30
- "@nuxt/kit": "npm:@nuxt/kit-edge@latest",
31
- "@nuxtjs/color-mode": "^3.0.2",
32
- "@unocss/core": "^0.31.6",
33
- "@unocss/nuxt": "^0.31.6",
34
- "@unocss/preset-attributify": "^0.31.6",
35
- "@unocss/preset-icons": "^0.31.6",
36
- "@unocss/preset-mini": "^0.31.6",
37
- "@unocss/reset": "^0.31.6",
38
- "@vueuse/core": "^8.2.6",
39
- "@vueuse/integrations": "^8.2.6",
40
- "@vueuse/nuxt": "^8.2.6",
32
+ "@iconify-json/carbon": "^1.1.7",
33
+ "@nuxt/kit": "^3.0.0-rc.7",
34
+ "@nuxtjs/color-mode": "^3.1.4",
35
+ "@unocss/core": "^0.45.6",
36
+ "@unocss/nuxt": "^0.45.6",
37
+ "@unocss/preset-attributify": "^0.45.6",
38
+ "@unocss/preset-icons": "^0.45.6",
39
+ "@unocss/preset-mini": "^0.45.6",
40
+ "@unocss/reset": "^0.45.6",
41
+ "@vueuse/core": "^9.1.0",
42
+ "@vueuse/integrations": "^9.1.0",
43
+ "@vueuse/nuxt": "^9.1.0",
41
44
  "defu": "^6.0.0",
42
- "focus-trap": "^6.7.3",
43
- "unocss": "^0.31.6"
45
+ "focus-trap": "^6.9.4",
46
+ "unocss": "^0.45.6"
44
47
  },
45
48
  "devDependencies": {
46
- "nuxt3": "latest",
47
- "unbuild": "^0.7.4"
49
+ "nuxt": "npm:nuxt3@latest",
50
+ "unbuild": "^0.8.8"
48
51
  },
49
52
  "publishConfig": {
50
53
  "access": "public"
51
54
  },
52
- "gitHead": "efbb705b65badd081240c63f63be61ec3874e9dc"
55
+ "gitHead": "24129e2a12f60e30fd1bfc66fa0e5f9d4bb9cbf1"
53
56
  }