@nuxt/ui 0.0.0-alpha.4 → 0.1.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) Nuxt Team
3
+ Copyright (c) 2021 Nuxt Project
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,47 +1,80 @@
1
- # Nuxt UI
1
+ # Nuxt UI Components
2
+
3
+ <a href="https://www.npmjs.com/package/@nuxt/ui-edge"><img src="https://flat.badgen.net/npm/v/@nuxt/ui-edge"></a>
4
+
5
+ UI kit for Nuxt 3's examples and internal tooling UI.
6
+
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
+
9
+ 🏀 [Online Playground](https://components.ui.nuxtjs.org)
2
10
 
3
11
  ## Install
4
12
 
5
- ```sh
6
- # npm
7
- npm install @nuxt/ui@npm:@nuxt/ui-edge
13
+ ```ts
14
+ // nuxt.config.js
15
+ import { defineNuxtConfig } from 'nuxt3'
8
16
 
9
- # yarn
10
- yarn install @nuxt/ui@npm:@nuxt/ui-edge
17
+ export default defineNuxtConfig({
18
+ modules: [
19
+ '@nuxt/ui'
20
+ ]
21
+ })
11
22
  ```
12
23
 
13
24
  ## Usage
14
25
 
15
- ## Components
26
+ Nuxt UI is an unbundled component library powered by [UnoCSS](https://github.com/antfu/unocss) and [VueUse](https://vueuse.org/).
16
27
 
17
- ### Base
28
+ In Nuxt UI, we introduced the `n` attribute for every component to customize the styles and variations. For example, to make a red button:
18
29
 
19
- - [ ] `<NCard>`
20
- - [ ] `<NInput>`
21
- - [ ] `<NCheckbox>`
22
- - [ ] `<NRadio>`
23
- - [ ] `<NIcon>`
24
- - [ ] `<NButton>`
25
- - [ ] `<NButtonGroup>`
26
- - [ ] `<NSpinner>`
27
- - [ ] `<NAlert>`
28
- - [ ] `<NBadge>`
30
+ ```html
31
+ <NButton n="red" />
32
+ ```
33
+
34
+ to make it larger, add the size specifier (`sm`, `md`, `lg` or `xl`) the `n` attribute:
29
35
 
30
- ### Interactive
36
+ ```html
37
+ <NButton n="red xl" />
38
+ ```
31
39
 
32
- - [ ] `<NTabs>`
33
- - [ ] `<NDropdown>`
34
- - [ ] `<NPopup>`
35
- - [ ] `<NNotification>`
36
- - [ ] `<NModal>`
40
+ You can apply the same specifiers to any other component, for example:
37
41
 
38
- ### Layout
42
+ ```html
43
+ <NCheckbox n="red xl" />
44
+ ```
39
45
 
40
- - [ ] `<NContainer>`
41
- - [ ] `<NDrawer>`
42
- - [ ] `<NNavbar>`
43
- - [ ] `<NPagination>`
46
+ Apply it to parent components could make a local theme scope
44
47
 
45
- ## License
48
+ ```html
49
+ <NCard n="green-500">
50
+ <!-- both of them are themed green -->
51
+ <NCheckbox>i accept the terms & conditions</NCheckbox>
52
+ <NButton>Submit</NButton>
53
+ </NCard>
54
+ ```
55
+
56
+ ## Theming
57
+
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.
59
+
60
+ It's also possible to override the default theme globally, for example:
61
+
62
+ ```ts
63
+ // nuxt.config.js
64
+ import { defineNuxtConfig } from 'nuxt3'
65
+
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
+ ```
46
79
 
47
- MIT
80
+ You can find all the default values and available entries in [src/unocss/index.ts](./src/unocss/index.ts).
@@ -0,0 +1,14 @@
1
+ :root {
2
+ --nui-c-context: 125,125,125;
3
+ }
4
+
5
+ html {
6
+ background-color: white;
7
+ }
8
+
9
+ html.dark {
10
+ color-scheme: dark;
11
+ background-color: #222;
12
+ color: white;
13
+ }
14
+
@@ -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<{ (...args: any): void }>()
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>
@@ -2,7 +2,7 @@
2
2
  <Component
3
3
  :is="(href || target) ? 'a' : 'nuxt-link'"
4
4
  v-bind="$props"
5
- class="n-link n-link-base n-transition"
5
+ class="n-link n-link-base hover:n-link-hover n-transition"
6
6
  >
7
7
  <slot />
8
8
  </Component>
@@ -32,8 +32,8 @@ const props = withDefaults(
32
32
  }>(),
33
33
  {
34
34
  modelValue: '',
35
- disabled: false,
36
- },
35
+ disabled: false
36
+ }
37
37
  )
38
38
  const emit = defineEmits<{(...args: any): void}>()
39
39
  const model = useVModel(props, 'modelValue', emit, { passive: true })
@@ -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="text"
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,10 +1,17 @@
1
1
  <script setup lang="ts">
2
- const props = defineProps<{
3
- name?: string
2
+ import NIcon from './NIcon.vue'
3
+ import NuxtIcon from './NuxtIcon.vue'
4
+
5
+ interface Props {
6
+ example?: string
4
7
  showTips?: boolean
5
- class?: string
6
- openPath?: string
7
- }>()
8
+ class?: string // eslint-disable-line vue/no-reserved-props
9
+ openPath?: string,
10
+ repo?: string
11
+ }
12
+ const props = withDefaults(defineProps<Props>(), {
13
+ repo: 'nuxt/framework'
14
+ })
8
15
 
9
16
  const openInEditor = () => {
10
17
  fetch(`/__open-in-editor?file=${encodeURIComponent(props.openPath || 'app.vue')}`)
@@ -14,21 +21,41 @@ const openInEditor = () => {
14
21
  <template>
15
22
  <div class="relative font-sans" n="green6">
16
23
  <div class="container max-w-200 mx-auto py-10 px-4">
17
- <div class="flex flex-col gap-2 items-center mb-4">
18
- <img src="https://raw.githubusercontent.com/nuxt/framework/main/playground/assets/logo.svg" h="12">
24
+ <div class="flex items-end gap-3 mb-4 relative">
25
+ <slot name="icon">
26
+ <NuxtIcon />
27
+ </slot>
19
28
  <div class="text-xl flex">
20
29
  <div class="op-50">
21
30
  examples/
22
31
  </div>
23
32
  <slot name="name">
24
- <NLink :href="`https://github.com/nuxt/framework/tree/main/examples/${name}`" target="_blank">
25
- {{ name }}
33
+ <NLink :href="`https://github.com/${repo}/tree/main/examples/${example}`" target="_blank">
34
+ {{ example }}
26
35
  </NLink>
27
36
  </slot>
28
37
  </div>
29
- <slot name="subtitle" />
38
+ <div flex-auto />
39
+ <div class="op20 hover:op-100 n-transition -mb-2 -mr-1">
40
+ <NButton
41
+ n="borderless lg"
42
+ class="p-2 op50"
43
+ :to="`https://github.com/${repo}/tree/main/examples/${example}`"
44
+ target="_blank"
45
+ >
46
+ <NIcon icon="carbon-code" />
47
+ </NButton>
48
+ <NDarkToggle>
49
+ <template #default="{ toggle }">
50
+ <NButton n="borderless lg" p-2 op50 @click="toggle">
51
+ <NIcon icon="dark:carbon-moon carbon-sun" />
52
+ </NButton>
53
+ </template>
54
+ </NDarkToggle>
55
+ </div>
30
56
  </div>
31
57
 
58
+ <slot name="subtitle" />
32
59
  <slot name="nav" />
33
60
 
34
61
  <NCard class="p-6 flex flex-col gap-2 text-center" :class="$props.class">
@@ -0,0 +1,20 @@
1
+ <template>
2
+ <svg viewBox="0 0 221 65" fill="none" xmlns="http://www.w3.org/2000/svg" class="h-10">
3
+ <g clip-path="url(#a)">
4
+ <path
5
+ fill="currentColor"
6
+ 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"
7
+ />
8
+ <path
9
+ fill-rule="evenodd"
10
+ clip-rule="evenodd"
11
+ 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"
12
+ fill="#80EEC0"
13
+ />
14
+ <path
15
+ 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"
16
+ fill="#00DC82"
17
+ />
18
+ </g>
19
+ </svg>
20
+ </template>
@@ -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
@@ -1,6 +1,9 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
2
 
3
- declare const _default: _nuxt_schema.LegacyNuxtModule;
3
+ declare const _default: _nuxt_schema.NuxtModule<{
4
+ preset: string;
5
+ dev: boolean;
6
+ }>;
4
7
 
5
8
  declare module '@nuxt/schema' {
6
9
  interface NuxtConfig {
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 { mergeDeep } from '@unocss/core';
8
- import presetUno, { theme } from '@unocss/preset-uno';
9
- import { parseColorUtil, fonts } from '@unocss/preset-mini/rules';
10
- import presetIcons from '@unocss/preset-icons';
11
- import presetAttributify from '@unocss/preset-attributify';
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 { rgba } = parseColorUtil(body, theme) || {};
26
- if (rgba) {
24
+ const color = parseColor(body, theme);
25
+ if (color?.cssColor?.type === "rgb" && color.cssColor.components) {
27
26
  return {
28
- "--nui-c-context": `${rgba.join(",")}`
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
- "color": "white !important"
36
+ color: "white !important"
38
37
  }],
39
38
  ["n-disabled", {
40
- "opacity": 0.4,
39
+ opacity: 0.4,
41
40
  "pointer-events": "none",
42
- "filter": "saturate(0)"
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-link-base": "hover:decoration-dotted hover:underline-offset-2 hover:text-context hover:underline",
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
- "display": "inline-block",
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
- name: "nui",
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
- const presetStyles = resolve(options.preset, "styles.css");
127
- if (existsSync(presetStyles))
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
- await installModule(nuxt, UnocssModule);
132
- await installModule(nuxt, VueUseModule);
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
@@ -1,5 +1,5 @@
1
1
  // CommonJS proxy to bypass jiti transforms from nuxt 2 and using native ESM
2
- module.exports = function(...args) {
2
+ module.exports = function (...args) {
3
3
  return import('./dist/nuxt.mjs').then(m => m.default.call(this, ...args))
4
4
  }
5
5
 
package/package.json CHANGED
@@ -1,16 +1,8 @@
1
1
  {
2
2
  "name": "@nuxt/ui",
3
- "version": "0.0.0-alpha.4",
4
- "type": "module",
3
+ "version": "0.1.1",
5
4
  "license": "MIT",
6
- "scripts": {
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
- "@unocss/core": "^0.16.3",
31
- "@unocss/nuxt": "^0.16.3",
32
- "@unocss/preset-attributify": "^0.16.3",
33
- "@unocss/preset-icons": "^0.16.3",
34
- "@unocss/preset-mini": "^0.16.3",
35
- "@unocss/preset-uno": "^0.16.3",
36
- "@unocss/reset": "^0.16.3",
37
- "@vueuse/integrations": "^7.3.0",
38
- "@vueuse/nuxt": "^7.3.0",
39
- "focus-trap": "^6.7.1"
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",
41
+ "defu": "^6.0.0",
42
+ "focus-trap": "^6.7.3",
43
+ "unocss": "^0.31.6"
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
- "typescript": "^4.5.3",
48
- "unbuild": "^0.6.3"
47
+ "unbuild": "^0.7.4"
48
+ },
49
+ "publishConfig": {
50
+ "access": "public"
49
51
  },
50
- "eslintConfig": {
51
- "extends": "@antfu"
52
- }
52
+ "gitHead": "efbb705b65badd081240c63f63be61ec3874e9dc"
53
53
  }
package/dist/nuxt.cjs DELETED
@@ -1,146 +0,0 @@
1
- 'use strict';
2
-
3
- const url = require('url');
4
- const path = require('path');
5
- const fs = require('fs');
6
- const kit = require('@nuxt/kit');
7
- const UnocssModule = require('@unocss/nuxt');
8
- const VueUseModule = require('@vueuse/nuxt');
9
- const core = require('@unocss/core');
10
- const presetUno = require('@unocss/preset-uno');
11
- const rules = require('@unocss/preset-mini/rules');
12
- const presetIcons = require('@unocss/preset-icons');
13
- const presetAttributify = require('@unocss/preset-attributify');
14
-
15
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
16
-
17
- const UnocssModule__default = /*#__PURE__*/_interopDefaultLegacy(UnocssModule);
18
- const VueUseModule__default = /*#__PURE__*/_interopDefaultLegacy(VueUseModule);
19
- const presetUno__default = /*#__PURE__*/_interopDefaultLegacy(presetUno);
20
- const presetIcons__default = /*#__PURE__*/_interopDefaultLegacy(presetIcons);
21
- const presetAttributify__default = /*#__PURE__*/_interopDefaultLegacy(presetAttributify);
22
-
23
- const NuxtUIPreset = {
24
- name: "nuxt-ui",
25
- theme: core.mergeDeep(presetUno.theme, {
26
- colors: {
27
- context: "rgba(var(--nui-c-context),%alpha)"
28
- },
29
- fontFamily: {
30
- sans: "Avenir, Helvetica, Arial, sans-serif"
31
- }
32
- }),
33
- rules: [
34
- [/^n-(.*)$/, ([, body], { theme }) => {
35
- const { rgba } = rules.parseColorUtil(body, theme) || {};
36
- if (rgba) {
37
- return {
38
- "--nui-c-context": `${rgba.join(",")}`
39
- };
40
- }
41
- }],
42
- [/^n-(.*)$/, rules.fonts[1][1]],
43
- ["n-dashed", { "border-style": "dashed" }],
44
- ["n-solid", {
45
- "background-color": "rgba(var(--nui-c-context), 1) !important",
46
- "border-color": "rgba(var(--nui-c-context), 1)",
47
- "color": "white !important"
48
- }],
49
- ["n-disabled", {
50
- "opacity": 0.4,
51
- "pointer-events": "none",
52
- "filter": "saturate(0)"
53
- }]
54
- ],
55
- variants: [
56
- (input) => {
57
- const prefix = "n-disabled:";
58
- if (input.startsWith(prefix)) {
59
- return {
60
- matcher: input.slice(prefix.length),
61
- selector: (input2) => `[disabled] ${input2}, ${input2}[disabled]`
62
- };
63
- }
64
- },
65
- (input) => {
66
- const prefix = "n-checked:";
67
- if (input.startsWith(prefix)) {
68
- return {
69
- matcher: input.slice(prefix.length),
70
- selector: (input2) => `[checked] ${input2}, ${input2}[checked]`
71
- };
72
- }
73
- }
74
- ],
75
- shortcuts: {
76
- "n-bg-base": "bg-white dark:bg-[#222]",
77
- "n-border-base": "border-gray-400/50",
78
- "n-border-300": "border-gray-400/40",
79
- "n-border-200": "border-gray-400/25",
80
- "n-transition": "transition-all duration-200",
81
- "n-focus-base": "ring-2 ring-context/50",
82
- "n-active-base": "ring-3 ring-context/10",
83
- "n-link-base": "hover:decoration-dotted hover:underline-offset-2 hover:text-context hover:underline",
84
- "n-card-base": "border n-border-200 rounded n-bg-base shadow-sm",
85
- "n-header-upper": "text-sm uppercase mb-2 leading-1.2em tracking-wide op50",
86
- "n-button-base": "border n-border-base rounded shadow-sm px-1em py-0.25em inline-flex items-center gap-1 op80 !outline-none",
87
- "n-button-hover": "op100 !border-context text-context",
88
- "n-button-active": "n-active-base bg-context/5",
89
- "n-button-icon": "-ml-0.2em mr-0.2em text-1.1em",
90
- "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",
91
- "n-checkbox-box-checked": "bg-context border-context",
92
- "n-checkbox-icon": "carbon-checkmark",
93
- "n-radio-box": "border n-border-base w-1.2em h-1.2em mr-1 text-white flex flex-none rounded-full overflow-visible",
94
- "n-radio-box-checked": "border-context",
95
- "n-radio-inner": "bg-context rounded-1/2 w-0 h-0 m-auto",
96
- "n-radio-inner-checked": "w-0.8em h-0.8em",
97
- "n-switch-base": "inline-flex items-center select-none",
98
- "n-switch-slider": "mr-1 rounded-full border n-border-base relative p-2px",
99
- "n-switch-slider-checked": "border-context/20 bg-context/10",
100
- "n-switch-thumb": "h-1em w-1em rounded-1/2 border n-border-base ml-0 mr-0.8em",
101
- "n-switch-thumb-checked": "bg-context border-context ml-0.8em mr-0",
102
- "n-tip-base": "bg-context/8 text-context px-1em py-0.4em rounded flex items-center dark:bg-context/12",
103
- "n-tip-icon": "-ml-0.2em mr-0.4em text-1.1em"
104
- }
105
- };
106
- function extendUnocssOptions(user = {}) {
107
- return {
108
- ...user,
109
- preflight: true,
110
- presets: [
111
- presetUno__default(),
112
- presetAttributify__default(),
113
- presetIcons__default({
114
- prefix: "",
115
- scale: 1.2,
116
- extraProperties: {
117
- "display": "inline-block",
118
- "vertical-align": "middle"
119
- }
120
- }),
121
- NuxtUIPreset,
122
- ...user.presets || []
123
- ]
124
- };
125
- }
126
-
127
- const rPath = (p) => url.fileURLToPath(new URL(p, (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('nuxt.cjs', document.baseURI).href))).toString());
128
- const nuxt = kit.defineNuxtModule({
129
- name: "nui",
130
- defaults: {
131
- preset: rPath("./preset"),
132
- dev: false
133
- },
134
- async setup(options, nuxt) {
135
- kit.addComponentsDir({ path: rPath("./components") });
136
- const presetStyles = path.resolve(options.preset, "styles.css");
137
- if (fs.existsSync(presetStyles))
138
- nuxt.options.css.push(presetStyles);
139
- if (!options.dev)
140
- nuxt.options.unocss = extendUnocssOptions(nuxt.options.unocss);
141
- await kit.installModule(nuxt, UnocssModule__default);
142
- await kit.installModule(nuxt, VueUseModule__default);
143
- }
144
- });
145
-
146
- module.exports = nuxt;