@nuxt/devtools-ui-kit 0.2.2 → 0.2.4

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
@@ -6,74 +6,4 @@
6
6
 
7
7
  UI kit for module authors to build embedded views for Nuxt Devtools.
8
8
 
9
- - [Demo](https://ui-kit.devtools.nuxtjs.org/)
10
-
11
- ## Install
12
-
13
- ```bash
14
- npm i @nuxt/devtools-ui-kit
15
- ```
16
-
17
- ```ts
18
- export default defineNuxtConfig({
19
- modules: [
20
- '@nuxt/devtools-ui-kit'
21
- ]
22
- })
23
- ```
24
-
25
- ## Usage
26
-
27
- `@nuxt/devtools-ui-kit` is an unbundled component library powered by [UnoCSS](https://github.com/antfu/unocss) and [VueUse](https://vueuse.org/).
28
-
29
- In this library, we introduced the `n` attribute for every component to customize the styles and variations. For example, to make a red button:
30
-
31
- ```html
32
- <NButton n="red" />
33
- ```
34
-
35
- to make it larger, add the size specifier (`sm`, `md`, `lg` or `xl`) the `n` attribute:
36
-
37
- ```html
38
- <NButton n="red xl" />
39
- ```
40
-
41
- You can apply the same specifiers to any other component, for example:
42
-
43
- ```html
44
- <NCheckbox n="red xl" />
45
- ```
46
-
47
- Apply it to parent components could make a local theme scope
48
-
49
- ```html
50
- <NCard n="green-500">
51
- <!-- both of them are themed green -->
52
- <NCheckbox>i accept the terms & conditions</NCheckbox>
53
- <NButton>Submit</NButton>
54
- </NCard>
55
- ```
56
-
57
- ## Theming
58
-
59
- Powered by [UnoCSS](https://github.com/antfu/unocss), you can use Tailwind/Windi CSS utilities to quickly customize the look and feel of components.
60
-
61
- It's also possible to override the default theme globally, for example:
62
-
63
- ```ts
64
- // nuxt.config.js
65
- export default defineNuxtConfig({
66
- modules: [
67
- '@nuxt/devtools-ui-kit'
68
- ],
69
- unocss: {
70
- shortcuts: {
71
- 'n-button-base': 'border n-border-base rounded shadow-sm op80 !outline-none',
72
- 'n-button-hover': 'op100 !border-context text-context',
73
- 'n-button-active': 'n-active-base bg-context/5',
74
- }
75
- }
76
- })
77
- ```
78
-
79
- You can find all the default values and available entries in [src/unocss/index.ts](./src/unocss/index.ts).
9
+ Please refer to the [DevTools UI Kit](https://devtools.nuxtjs.org/module/ui-kit) for the full documentation.
@@ -0,0 +1,15 @@
1
+ <script setup lang="ts">
2
+ defineProps<{
3
+ icon?: string
4
+ text?: string
5
+ }>()
6
+ </script>
7
+
8
+ <template>
9
+ <div class="items-center flex flex-gap2">
10
+ <div v-if="icon" :class="icon" />
11
+ <slot>
12
+ <div>{{ text }}</div>
13
+ </slot>
14
+ </div>
15
+ </template>
@@ -0,0 +1,71 @@
1
+ <script setup lang="ts">
2
+ withDefaults(
3
+ defineProps<{
4
+ icon?: string
5
+ text: string
6
+ description?: string
7
+ containerClass?: string
8
+ collapse?: boolean
9
+ open?: boolean
10
+ padding?: boolean | string
11
+ }>(), {
12
+ containerClass: '',
13
+ open: true,
14
+ padding: true,
15
+ collapse: true,
16
+ },
17
+ )
18
+ </script>
19
+
20
+ <template>
21
+ <details :open="open">
22
+ <summary class="select-none cursor-pointer p4 hover:bg-active" :class="collapse ? '' : 'pointer-events-none'">
23
+ <NIconTitle :icon="icon" :text="text" class="text-xl op75">
24
+ <div>
25
+ {{ text }}
26
+ <div v-if="description" class="op50 text-sm">
27
+ {{ description }}
28
+ </div>
29
+ </div>
30
+ <div class="flex-auto" />
31
+ <NIcon
32
+ v-if="collapse"
33
+ icon="carbon-chevron-down"
34
+ class="text-base op50 cursor-pointer transition duration-500 place-self-start chevron"
35
+ />
36
+ </NIconTitle>
37
+ </summary>
38
+ <div class="flex flex-col flex-gap2 pt2 pb6" :class="typeof padding === 'string' ? padding : padding ? 'px8' : ''">
39
+ <slot name="details" />
40
+ <div :class="containerClass" class="mt1">
41
+ <slot />
42
+ </div>
43
+ <slot name="footer" />
44
+ </div>
45
+ </details>
46
+ <div class="x-divider" />
47
+ </template>
48
+
49
+ <style scoped>
50
+ details {
51
+ --at-apply: border-none;
52
+ }
53
+
54
+ summary {
55
+ --at-apply: border-none;
56
+ list-style: none;
57
+ }
58
+
59
+ details[open] summary {
60
+ --at-apply: border-none;
61
+ }
62
+
63
+ details summary::-webkit-details-marker {
64
+ display:none;
65
+ }
66
+
67
+ details[open] .chevron {
68
+ transform: rotate(180deg);
69
+ opacity: 0.75;
70
+ }
71
+ </style>
@@ -0,0 +1,35 @@
1
+ <script setup lang="ts">
2
+ import { useVModel } from '@vueuse/core'
3
+ const props = withDefaults(
4
+ defineProps<{
5
+ modelValue?: any
6
+ placeholder?: string
7
+ icon?: string
8
+ disabled?: boolean
9
+ }>(),
10
+ {
11
+ modelValue: undefined,
12
+ placeholder: '',
13
+ disabled: false,
14
+ icon: '',
15
+ },
16
+ )
17
+ const emit = defineEmits<{ (...args: any): void }>()
18
+ const input = useVModel(props, 'modelValue', emit, { passive: true })
19
+ </script>
20
+
21
+ <template>
22
+ <div
23
+ class="n-bg-base rounded py-1 border n-border-base flex items-center flex n-text-input focus-within:n-focus-base focus-within:border-context px-2"
24
+ >
25
+ <slot name="icon">
26
+ <NIcon v-if="icon" :icon="icon" class="op50 mr-0.4em text-1.1em" />
27
+ </slot>
28
+ <select v-model="input" :disabled="disabled" class="flex-auto n-bg-base w-full !outline-none">
29
+ <option v-if="placeholder" value="" disabled hidden>
30
+ {{ placeholder }}
31
+ </option>
32
+ <slot />
33
+ </select>
34
+ </div>
35
+ </template>
@@ -3,7 +3,7 @@ import { useVModel } from '@vueuse/core'
3
3
 
4
4
  const props = withDefaults(
5
5
  defineProps<{
6
- modelValue?: string
6
+ modelValue?: string | number
7
7
  placeholder?: string
8
8
  icon?: string
9
9
  disabled?: boolean
@@ -28,6 +28,7 @@ const input = useVModel(props, 'modelValue', emit, { passive: true })
28
28
  v-model="input"
29
29
  class="flex-auto n-bg-base w-full !outline-none"
30
30
  :type="type"
31
+ :disabled="disabled"
31
32
  :placeholder="placeholder"
32
33
  >
33
34
  </div>
package/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "devtools-ui-kit",
3
3
  "configKey": "devtoolsUIKit",
4
- "version": "0.2.2"
4
+ "version": "0.2.4"
5
5
  }
package/dist/module.mjs CHANGED
@@ -19,7 +19,6 @@ const module = defineNuxtModule({
19
19
  dev: false
20
20
  },
21
21
  async setup(options, nuxt) {
22
- addComponentsDir({ path: rPath("./components/nuxt") });
23
22
  addComponentsDir({ path: rPath("./components") });
24
23
  nuxt.options.css.unshift(rPath("assets/styles.css"));
25
24
  if (!options.dev)
package/dist/unocss.mjs CHANGED
@@ -92,8 +92,9 @@ const unocssPreset = () => ({
92
92
  "n-switch-thumb": "h-1em w-1em rounded-1/2 border n-border-base ml-0 mr-0.8em",
93
93
  "n-switch-thumb-checked": "bg-context border-context ml-0.8em mr-0",
94
94
  // tip
95
- "n-tip-base": "bg-context/8 text-context px-1em py-0.4em rounded flex items-center dark:bg-context/12",
96
- "n-tip-icon": "-ml-0.2em mr-0.4em text-1.1em"
95
+ "n-tip-base": "bg-context/4 text-context px-1em py-0.4em rounded flex gap-2 items-center dark:bg-context/12",
96
+ // icon
97
+ "n-icon": "flex-none"
97
98
  }
98
99
  });
99
100
  function extendUnocssOptions(user = {}) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nuxt/devtools-ui-kit",
3
3
  "type": "module",
4
- "version": "0.2.2",
4
+ "version": "0.2.4",
5
5
  "license": "MIT",
6
6
  "repository": "nuxt/devtools",
7
7
  "exports": {