@nuxt/devtools-ui-kit 0.2.5 → 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.
@@ -1,4 +1,6 @@
1
1
  <script setup lang="ts">
2
+ // eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
3
+ // @ts-ignore tsconfig
2
4
  import { NuxtLink } from '#components'
3
5
 
4
6
  defineProps<{
@@ -16,7 +16,7 @@ const checked = useVModel(props, 'modelValue', emit, { passive: true })
16
16
 
17
17
  <template>
18
18
  <label
19
- class="items-center select-none n-disabled:n-disabled n-checkbox inline-flex hover:n-checkbox-hover"
19
+ class="items-center select-none n-disabled:n-disabled n-checkbox hover:n-checkbox-hover"
20
20
  :checked="checked || null"
21
21
  :disabled="disabled || null"
22
22
  >
@@ -30,6 +30,6 @@ const checked = useVModel(props, 'modelValue', emit, { passive: true })
30
30
  <span class="n-transition n-checkbox-box n-checked:n-checkbox-box-checked peer-active:n-active-base peer-focus-visible:n-focus-base">
31
31
  <NIcon class="n-transition op0 n-checkbox-icon transform scale-0 n-checked:op100 n-checked:scale-100" />
32
32
  </span>
33
- <span><slot /></span>
33
+ <span :class="checked ? '' : 'op50'" class="n-transition"><slot /></span>
34
34
  </label>
35
35
  </template>
@@ -1,18 +1,50 @@
1
1
  <script setup lang="ts">
2
2
  // This components requires to run in DevTools to render correctly
3
+ import { computed } from 'vue'
3
4
  import { devToolsClient } from '../runtime/client'
4
5
 
5
- defineProps<{
6
- code: string
7
- lang?: string
8
- }>()
6
+ const props = withDefaults(
7
+ defineProps<{
8
+ code: string
9
+ lang?: string
10
+ lines?: boolean
11
+ }>(), {
12
+ lines: true,
13
+ },
14
+ )
15
+ const rendered = computed(() => devToolsClient.value?.devtools.renderCodeHighlight(props.code, props.lang as string) || { code: props.code, supported: false })
9
16
  </script>
10
17
 
11
18
  <template>
12
- <template v-if="lang && devToolsClient?.devtools?.renderCodeHighlight">
13
- <pre class="n-code-block" v-html="devToolsClient.devtools.renderCodeHighlight(code, lang)" />
19
+ <template v-if="lang && rendered.supported">
20
+ <pre
21
+ class="n-code-block"
22
+ :class="lines ? 'n-code-block-lines' : ''"
23
+ v-html="rendered.code"
24
+ />
14
25
  </template>
15
26
  <template v-else>
16
- <pre class="n-code-block" v-text="code" />
27
+ <pre
28
+ class="n-code-block"
29
+ :class="lines ? 'n-code-block-lines' : ''"
30
+ v-text="code"
31
+ />
17
32
  </template>
18
33
  </template>
34
+
35
+ <style>
36
+ .n-code-block-lines .shiki code {
37
+ counter-reset: step;
38
+ counter-increment: step calc(var(--start, 1) - 1);
39
+ }
40
+ .n-code-block-lines .shiki code .line::before {
41
+ content: counter(step);
42
+ counter-increment: step;
43
+ width: 2rem;
44
+ padding-right: 0.5rem;
45
+ margin-right: 0.5rem;
46
+ display: inline-block;
47
+ text-align: right;
48
+ --at-apply: text-truegray:50;
49
+ }
50
+ </style>
@@ -27,7 +27,8 @@ onMounted(() => {
27
27
  watch(show, (v) => {
28
28
  if (v)
29
29
  activate()
30
- else deactivate()
30
+ else
31
+ deactivate()
31
32
  }, { immediate: true })
32
33
  })
33
34
 
@@ -44,21 +45,23 @@ export default {
44
45
  </script>
45
46
 
46
47
  <template>
47
- <div
48
- class="n-transition fixed flex items-center justify-center n-dialog inset-0 z-100"
49
- :class="[
50
- show ? '' : 'op0 pointer-events-none',
51
- ]"
52
- >
48
+ <Teleport v-if="show" to="body">
53
49
  <div
54
- class="absolute inset-0 -z-1"
50
+ class="n-transition fixed flex items-center justify-center z-100 n-dialog inset-0"
55
51
  :class="[
56
- dim ? 'bg-black/50' : '',
52
+ show ? '' : 'op0 pointer-events-none visibility-none',
57
53
  ]"
58
- @click="close"
59
- />
60
- <NCard v-bind="$attrs" ref="card">
61
- <slot />
62
- </NCard>
63
- </div>
54
+ >
55
+ <div
56
+ class="inset-0 absolute -z-1"
57
+ :class="[
58
+ dim ? 'bg-black/50' : '',
59
+ ]"
60
+ @click="close()"
61
+ />
62
+ <NCard v-bind="$attrs" ref="card">
63
+ <slot />
64
+ </NCard>
65
+ </div>
66
+ </Teleport>
64
67
  </template>
@@ -0,0 +1,21 @@
1
+ <script setup lang="ts">
2
+ // eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
3
+ // @ts-ignore tsconfig
4
+ import { NuxtLink } from '#components'
5
+
6
+ const props = defineProps<{
7
+ to?: string
8
+ icon: string
9
+ }>()
10
+ </script>
11
+
12
+ <template>
13
+ <Component
14
+ :is="to ? NuxtLink : 'button'"
15
+ :to="to"
16
+ v-bind="$attrs"
17
+ class="n-transition n-icon-button"
18
+ >
19
+ <NIcon :icon="props.icon" />
20
+ </Component>
21
+ </template>
@@ -1,4 +1,6 @@
1
1
  <script setup lang="ts">
2
+ // eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
3
+ // @ts-ignore tsconfig
2
4
  import { NuxtLink } from '#components'
3
5
 
4
6
  defineProps<{
@@ -12,7 +14,7 @@ defineProps<{
12
14
  <Component
13
15
  :is="(href || target) ? 'a' : NuxtLink"
14
16
  v-bind="$props"
15
- class="n-link n-link-base hover:n-link-hover n-transition"
17
+ class="n-transition n-link n-link-base hover:n-link-hover"
16
18
  >
17
19
  <slot />
18
20
  </Component>
@@ -0,0 +1,10 @@
1
+ <template>
2
+ <div class="n-loading">
3
+ <div class="flex flex-col items-center text-lg animate-pulse">
4
+ <div class="text-4xl op50 i-carbon-circle-dash animate-spin" />
5
+ <slot>
6
+ Loading...
7
+ </slot>
8
+ </div>
9
+ </div>
10
+ </template>
@@ -19,7 +19,7 @@ const model = useVModel(props, 'modelValue', emit, { passive: true })
19
19
 
20
20
  <template>
21
21
  <label
22
- class="inline-flex items-center select-none n-disabled:n-disabled n-radio hover:n-radio-hover"
22
+ class="n-disabled:n-disabled items-center select-none inline-flex n-radio hover:n-radio-hover"
23
23
  :checked="model === value || null"
24
24
  :disabled="disabled || null"
25
25
  >
@@ -30,7 +30,7 @@ const model = useVModel(props, 'modelValue', emit, { passive: true })
30
30
  :disabled="disabled"
31
31
  :name="name"
32
32
  :value="value"
33
- @keypress.enter="model = value"
33
+ @keypress.enter="model = value!"
34
34
  >
35
35
  <span class="n-transition peer-active:n-active-base peer-focus-visible:n-focus-base n-radio-box n-checked:n-radio-box-checked">
36
36
  <div class="n-transition n-radio-inner n-checked:n-radio-inner-checked" />
@@ -22,16 +22,21 @@ withDefaults(
22
22
  <summary class="select-none cursor-pointer p4 hover:bg-active" :class="collapse ? '' : 'pointer-events-none'">
23
23
  <NIconTitle :icon="icon" :text="text" class="text-xl op75">
24
24
  <div>
25
- {{ text }}
26
- <div v-if="description" class="op50 text-sm">
27
- {{ description }}
25
+ <slot name="text">
26
+ {{ text }}
27
+ </slot>
28
+ <div v-if="description || $slots.description" class="op50 text-sm">
29
+ <slot name="description">
30
+ {{ description }}
31
+ </slot>
28
32
  </div>
29
33
  </div>
30
34
  <div class="flex-auto" />
35
+ <slot name="actions" />
31
36
  <NIcon
32
37
  v-if="collapse"
33
38
  icon="carbon-chevron-down"
34
- class="text-base op50 cursor-pointer transition duration-500 place-self-start chevron"
39
+ class="op50 cursor-pointer text-base transition duration-500 place-self-start chevron"
35
40
  />
36
41
  </NIconTitle>
37
42
  </summary>
@@ -20,12 +20,12 @@ const input = useVModel(props, 'modelValue', emit, { passive: true })
20
20
 
21
21
  <template>
22
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"
23
+ class="flex items-center flex n-bg-base rounded py-1 border n-border-base px-2 n-text-input focus-within:n-focus-base focus-within:border-context"
24
24
  >
25
25
  <slot name="icon">
26
26
  <NIcon v-if="icon" :icon="icon" class="op50 mr-0.4em text-1.1em" />
27
27
  </slot>
28
- <select v-model="input" :disabled="disabled" class="flex-auto n-bg-base w-full !outline-none">
28
+ <select v-model="input" :disabled="disabled" class="n-bg-base flex-auto w-full !outline-none">
29
29
  <option v-if="placeholder" value="" disabled hidden>
30
30
  {{ placeholder }}
31
31
  </option>
@@ -28,10 +28,8 @@ const checked = useVModel(props, 'modelValue', emit, { passive: true })
28
28
  @keypress.enter="checked = !checked"
29
29
  >
30
30
  <div class="n-transition peer-active:n-active-base peer-focus-visible:n-focus-base n-switch-slider n-checked:n-switch-slider-checked">
31
- <div
32
- class="n-transition n-switch-thumb n-checked:n-switch-thumb-checked"
33
- />
31
+ <div class="n-transition n-switch-thumb n-checked:n-switch-thumb-checked" />
34
32
  </div>
35
- <span><slot /></span>
33
+ <slot />
36
34
  </label>
37
35
  </template>
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.5"
4
+ "version": "0.3.1"
5
5
  }
package/dist/module.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { fileURLToPath } from 'url';
1
+ import { fileURLToPath } from 'node:url';
2
2
  import { defineNuxtModule, addComponentsDir, createResolver, installModule } from '@nuxt/kit';
3
3
  import defu from 'defu';
4
4
  import { extendUnocssOptions } from './unocss.mjs';
@@ -1 +1 @@
1
- export declare const devToolsClient: import("vue").Ref<import("@nuxt/devtools").NuxtDevtoolsIframeClient | undefined>;
1
+ export declare const devToolsClient: import("vue").Ref<import("@nuxt/devtools-kit/dist/client-api-34a84dad").c | undefined>;
@@ -1,2 +1,2 @@
1
- import { useDevtoolsClient } from "@nuxt/devtools/iframe-client";
1
+ import { useDevtoolsClient } from "@nuxt/devtools-kit/iframe-client";
2
2
  export const devToolsClient = useDevtoolsClient();
package/dist/unocss.mjs CHANGED
@@ -78,9 +78,10 @@ const unocssPreset = () => ({
78
78
  "n-button-active": "n-active-base bg-context/5",
79
79
  "n-button-icon": "-ml-0.2em mr-0.2em text-1.1em",
80
80
  // checkbox
81
+ "n-checkbox": "inline-flex gap-1 items-center",
81
82
  "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
83
  "n-checkbox-box-checked": "bg-context border-context",
83
- "n-checkbox-icon": "carbon-checkmark",
84
+ "n-checkbox-icon": "carbon-checkmark w-1em h-1em m-auto",
84
85
  // radio
85
86
  "n-radio-box": "border n-border-base w-1.2em h-1.2em mr-1 text-white flex flex-none rounded-full overflow-visible",
86
87
  "n-radio-box-checked": "border-context",
@@ -95,7 +96,13 @@ const unocssPreset = () => ({
95
96
  // tip
96
97
  "n-tip-base": "bg-context/4 text-context px-1em py-0.4em rounded flex gap-2 items-center dark:bg-context/12",
97
98
  // icon
98
- "n-icon": "flex-none"
99
+ "n-icon": "flex-none",
100
+ // code
101
+ "n-code-block": "dark:bg-[#121212] bg-white",
102
+ // icon-button
103
+ "n-icon-button": "aspect-1/1 w-1.6em h-1.6em flex items-center justify-center rounded op50 hover:op100 hover:n-bg-active",
104
+ // loading
105
+ "n-loading": "flex h-full w-full justify-center items-center"
99
106
  }
100
107
  });
101
108
  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.5",
4
+ "version": "0.3.1",
5
5
  "license": "MIT",
6
6
  "repository": "nuxt/devtools",
7
7
  "exports": {
@@ -23,34 +23,36 @@
23
23
  "*.cjs"
24
24
  ],
25
25
  "peerDependencies": {
26
- "@nuxt/devtools": "0.2.5"
26
+ "@nuxt/devtools": "0.3.1"
27
27
  },
28
28
  "dependencies": {
29
29
  "@iconify-json/carbon": "^1.1.16",
30
- "@nuxt/kit": "^3.2.3",
30
+ "@nuxt/kit": "^3.3.1",
31
31
  "@nuxtjs/color-mode": "^3.2.0",
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",
32
+ "@unocss/core": "^0.50.6",
33
+ "@unocss/nuxt": "^0.50.6",
34
+ "@unocss/preset-attributify": "^0.50.6",
35
+ "@unocss/preset-icons": "^0.50.6",
36
+ "@unocss/preset-mini": "^0.50.6",
37
+ "@unocss/reset": "^0.50.6",
38
38
  "@vueuse/core": "^9.13.0",
39
39
  "@vueuse/integrations": "^9.13.0",
40
40
  "@vueuse/nuxt": "^9.13.0",
41
41
  "defu": "^6.1.2",
42
- "focus-trap": "^7.3.1",
43
- "unocss": "^0.50.1",
44
- "@nuxt/devtools": "0.2.5"
42
+ "focus-trap": "^7.4.0",
43
+ "unocss": "^0.50.6",
44
+ "@nuxt/devtools": "0.3.1",
45
+ "@nuxt/devtools-kit": "0.3.1"
45
46
  },
46
47
  "devDependencies": {
47
- "nuxt": "^3.2.3"
48
+ "nuxt": "^3.3.1"
48
49
  },
49
50
  "publishConfig": {
50
51
  "access": "public"
51
52
  },
52
53
  "scripts": {
53
54
  "build": "nuxt-build-module",
55
+ "stub": "nuxt-build-module --stub",
54
56
  "dev": "nuxi dev playground",
55
57
  "playground:build": "nuxi generate playground"
56
58
  }