@nuxt/devtools-ui-kit 0.2.3 → 0.2.5
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 +1 -71
- package/dist/components/NCodeBlock.vue +18 -0
- package/dist/components/NDropdown.vue +1 -1
- package/dist/components/NIconTitle.vue +15 -0
- package/dist/components/NMarkdown.vue +19 -0
- package/dist/components/NSectionBlock.vue +71 -0
- package/dist/components/NSelect.vue +35 -0
- package/dist/components/NTextInput.vue +2 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +0 -1
- package/dist/runtime/client.d.ts +1 -0
- package/dist/runtime/client.mjs +2 -0
- package/dist/unocss.mjs +4 -2
- package/package.json +15 -11
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
|
-
|
|
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,18 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// This components requires to run in DevTools to render correctly
|
|
3
|
+
import { devToolsClient } from '../runtime/client'
|
|
4
|
+
|
|
5
|
+
defineProps<{
|
|
6
|
+
code: string
|
|
7
|
+
lang?: string
|
|
8
|
+
}>()
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<template v-if="lang && devToolsClient?.devtools?.renderCodeHighlight">
|
|
13
|
+
<pre class="n-code-block" v-html="devToolsClient.devtools.renderCodeHighlight(code, lang)" />
|
|
14
|
+
</template>
|
|
15
|
+
<template v-else>
|
|
16
|
+
<pre class="n-code-block" v-text="code" />
|
|
17
|
+
</template>
|
|
18
|
+
</template>
|
|
@@ -22,7 +22,7 @@ onClickOutside(el, () => {
|
|
|
22
22
|
</slot>
|
|
23
23
|
|
|
24
24
|
<div
|
|
25
|
-
class="absolute n-transition n-bg-base rounded z-10
|
|
25
|
+
class="absolute n-transition n-bg-base rounded border z-10 n-border-base shadow"
|
|
26
26
|
:class="[enabled ? 'op-100' : 'op0 pointer-events-none -translate-y-1']"
|
|
27
27
|
>
|
|
28
28
|
<slot />
|
|
@@ -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,19 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// This components requires to run in DevTools to render correctly
|
|
3
|
+
|
|
4
|
+
import { devToolsClient } from '../runtime/client'
|
|
5
|
+
|
|
6
|
+
defineProps<{
|
|
7
|
+
markdown: string
|
|
8
|
+
tag?: string
|
|
9
|
+
}>()
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<template v-if="markdown && devToolsClient?.devtools?.renderMarkdown">
|
|
14
|
+
<component :is="tag || 'span'" class="n-markdown" v-html="devToolsClient.devtools.renderMarkdown(markdown)" />
|
|
15
|
+
</template>
|
|
16
|
+
<template v-else>
|
|
17
|
+
<component :is="tag || 'span'" class="n-markdown" v-text="markdown" />
|
|
18
|
+
</template>
|
|
19
|
+
</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
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)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const devToolsClient: import("vue").Ref<import("@nuxt/devtools").NuxtDevtoolsIframeClient | undefined>;
|
package/dist/unocss.mjs
CHANGED
|
@@ -59,6 +59,7 @@ const unocssPreset = () => ({
|
|
|
59
59
|
// general
|
|
60
60
|
"n-bg-base": "bg-white dark:bg-[#151515]",
|
|
61
61
|
"n-bg-active": "bg-gray:5",
|
|
62
|
+
"n-bg-hover": "bg-gray:3",
|
|
62
63
|
"n-border-base": "border-gray/20",
|
|
63
64
|
"n-transition": "transition-all duration-200",
|
|
64
65
|
"n-focus-base": "ring-2 ring-context/50",
|
|
@@ -92,8 +93,9 @@ const unocssPreset = () => ({
|
|
|
92
93
|
"n-switch-thumb": "h-1em w-1em rounded-1/2 border n-border-base ml-0 mr-0.8em",
|
|
93
94
|
"n-switch-thumb-checked": "bg-context border-context ml-0.8em mr-0",
|
|
94
95
|
// tip
|
|
95
|
-
"n-tip-base": "bg-context/
|
|
96
|
-
|
|
96
|
+
"n-tip-base": "bg-context/4 text-context px-1em py-0.4em rounded flex gap-2 items-center dark:bg-context/12",
|
|
97
|
+
// icon
|
|
98
|
+
"n-icon": "flex-none"
|
|
97
99
|
}
|
|
98
100
|
});
|
|
99
101
|
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.
|
|
4
|
+
"version": "0.2.5",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "nuxt/devtools",
|
|
7
7
|
"exports": {
|
|
@@ -22,25 +22,29 @@
|
|
|
22
22
|
"dist",
|
|
23
23
|
"*.cjs"
|
|
24
24
|
],
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"@nuxt/devtools": "0.2.5"
|
|
27
|
+
},
|
|
25
28
|
"dependencies": {
|
|
26
|
-
"@iconify-json/carbon": "^1.1.
|
|
27
|
-
"@nuxt/kit": "^3.2.
|
|
29
|
+
"@iconify-json/carbon": "^1.1.16",
|
|
30
|
+
"@nuxt/kit": "^3.2.3",
|
|
28
31
|
"@nuxtjs/color-mode": "^3.2.0",
|
|
29
|
-
"@unocss/core": "^0.50.
|
|
30
|
-
"@unocss/nuxt": "^0.50.
|
|
31
|
-
"@unocss/preset-attributify": "^0.50.
|
|
32
|
-
"@unocss/preset-icons": "^0.50.
|
|
33
|
-
"@unocss/preset-mini": "^0.50.
|
|
34
|
-
"@unocss/reset": "^0.50.
|
|
32
|
+
"@unocss/core": "^0.50.1",
|
|
33
|
+
"@unocss/nuxt": "^0.50.1",
|
|
34
|
+
"@unocss/preset-attributify": "^0.50.1",
|
|
35
|
+
"@unocss/preset-icons": "^0.50.1",
|
|
36
|
+
"@unocss/preset-mini": "^0.50.1",
|
|
37
|
+
"@unocss/reset": "^0.50.1",
|
|
35
38
|
"@vueuse/core": "^9.13.0",
|
|
36
39
|
"@vueuse/integrations": "^9.13.0",
|
|
37
40
|
"@vueuse/nuxt": "^9.13.0",
|
|
38
41
|
"defu": "^6.1.2",
|
|
39
42
|
"focus-trap": "^7.3.1",
|
|
40
|
-
"unocss": "^0.50.
|
|
43
|
+
"unocss": "^0.50.1",
|
|
44
|
+
"@nuxt/devtools": "0.2.5"
|
|
41
45
|
},
|
|
42
46
|
"devDependencies": {
|
|
43
|
-
"nuxt": "^3.2.
|
|
47
|
+
"nuxt": "^3.2.3"
|
|
44
48
|
},
|
|
45
49
|
"publishConfig": {
|
|
46
50
|
"access": "public"
|