@nuxt/devtools-ui-kit 0.4.6 → 0.5.0

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.
@@ -15,3 +15,77 @@ html.dark {
15
15
  ::selection {
16
16
  background: #8884;
17
17
  }
18
+
19
+ /* Shiki */
20
+ .shiki .line {
21
+ position: relative;
22
+ display: inline-block;
23
+ width: 100%;
24
+ }
25
+
26
+ .shiki.diff .line > span {
27
+ opacity: 0.75;
28
+ filter: saturate(0.75);
29
+ }
30
+
31
+ .shiki.diff .line-added,
32
+ .shiki.diff .line-removed {
33
+ scroll-margin: 5em;
34
+ }
35
+
36
+ .shiki.diff .line-added > span,
37
+ .shiki.diff .line-removed > span {
38
+ opacity: 1 !important;
39
+ z-index: 100;
40
+ position: inherit;
41
+ scroll-margin: 20px;
42
+ }
43
+
44
+ .shiki.diff .line-added > span {
45
+ color: #218c3b !important;
46
+ }
47
+
48
+ .shiki.diff .line-removed > span {
49
+ color: #8c2c21 !important;
50
+ }
51
+
52
+ .shiki .line-added:after {
53
+ content: "";
54
+ background-color: #43885440;
55
+ display: block;
56
+ position: absolute;
57
+ left: 0;
58
+ right: 0;
59
+ top: 0;
60
+ bottom: 0;
61
+ }
62
+
63
+ .shiki .line-removed:after {
64
+ content: "";
65
+ background-color: #8f4b3950;
66
+ display: block;
67
+ position: absolute;
68
+ left: 0;
69
+ right: 0;
70
+ top: 0;
71
+ bottom: 0;
72
+ }
73
+
74
+ /* Color Mode transition */
75
+ ::view-transition-old(root),
76
+ ::view-transition-new(root) {
77
+ animation: none;
78
+ mix-blend-mode: normal;
79
+ }
80
+ ::view-transition-old(root) {
81
+ z-index: 1;
82
+ }
83
+ ::view-transition-new(root) {
84
+ z-index: 2147483646;
85
+ }
86
+ .dark::view-transition-old(root) {
87
+ z-index: 2147483646;
88
+ }
89
+ .dark::view-transition-new(root) {
90
+ z-index: 1;
91
+ }
@@ -16,7 +16,7 @@ const checked = useVModel(props, 'modelValue', emit, { passive: true })
16
16
 
17
17
  <template>
18
18
  <label
19
- class="hover:n-checkbox-hover n-checkbox select-none items-center n-disabled:n-disabled"
19
+ class="n-checkbox hover:n-checkbox-hover select-none items-center n-disabled:n-disabled"
20
20
  :checked="checked || null"
21
21
  :disabled="disabled || null"
22
22
  >
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  // This components requires to run in DevTools to render correctly
3
- import { computed } from 'vue'
3
+ import { computed, nextTick } from 'vue'
4
4
  import { devToolsClient } from '../runtime/client'
5
5
 
6
6
  const props = withDefaults(
@@ -8,11 +8,22 @@ const props = withDefaults(
8
8
  code: string
9
9
  lang?: string
10
10
  lines?: boolean
11
+ transformRendered?: (code: string) => string
11
12
  }>(), {
12
13
  lines: true,
13
14
  },
14
15
  )
15
- const rendered = computed(() => devToolsClient.value?.devtools.renderCodeHighlight(props.code, props.lang as string) || { code: props.code, supported: false })
16
+
17
+ const emit = defineEmits(['loaded'])
18
+
19
+ const rendered = computed(() => {
20
+ const result = devToolsClient.value?.devtools.renderCodeHighlight(props.code, props.lang as string) || { code: props.code, supported: false }
21
+ if (result.supported && props.transformRendered)
22
+ result.code = props.transformRendered(result.code)
23
+ if (result.supported)
24
+ nextTick(() => emit('loaded'))
25
+ return result
26
+ })
16
27
  </script>
17
28
 
18
29
  <template>
@@ -1,6 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { computed } from 'vue'
3
- import { useToggle } from '@vueuse/core'
2
+ import { computed, nextTick } from 'vue'
4
3
 
5
4
  // @ts-expect-error auto imported from @nuxtjs/color-mode
6
5
  import { useColorMode } from '#imports'
@@ -14,7 +13,55 @@ const isDark = computed<boolean>({
14
13
  mode.preference = isDark.value ? 'light' : 'dark'
15
14
  },
16
15
  })
17
- const toggle = useToggle(isDark)
16
+
17
+ const isAppearanceTransition = typeof document !== 'undefined'
18
+ // @ts-expect-error: Transition API
19
+ && document.startViewTransition
20
+ && !window.matchMedia('(prefers-reduced-motion: reduce)').matches
21
+
22
+ /**
23
+ * Credit to [@hooray](https://github.com/hooray)
24
+ * @see https://github.com/vuejs/vitepress/pull/2347
25
+ */
26
+ function toggle(event?: MouseEvent) {
27
+ if (!isAppearanceTransition || !event) {
28
+ isDark.value = !isDark.value
29
+ return
30
+ }
31
+
32
+ const x = event.clientX
33
+ const y = event.clientY
34
+ const endRadius = Math.hypot(
35
+ Math.max(x, innerWidth - x),
36
+ Math.max(y, innerHeight - y),
37
+ )
38
+ // @ts-expect-error: Transition API
39
+ const transition = document.startViewTransition(async () => {
40
+ isDark.value = !isDark.value
41
+ await nextTick()
42
+ })
43
+
44
+ transition.ready.then(() => {
45
+ const clipPath = [
46
+ `circle(0px at ${x}px ${y}px)`,
47
+ `circle(${endRadius}px at ${x}px ${y}px)`,
48
+ ]
49
+ document.documentElement.animate(
50
+ {
51
+ clipPath: isDark.value
52
+ ? [...clipPath].reverse()
53
+ : clipPath,
54
+ },
55
+ {
56
+ duration: 400,
57
+ easing: 'ease-in',
58
+ pseudoElement: isDark.value
59
+ ? '::view-transition-old(root)'
60
+ : '::view-transition-new(root)',
61
+ },
62
+ )
63
+ })
64
+ }
18
65
  const context = {
19
66
  mode,
20
67
  isDark,
@@ -59,7 +59,7 @@ export default {
59
59
  ]"
60
60
  @click="close()"
61
61
  />
62
- <NCard v-bind="$attrs" ref="card">
62
+ <NCard v-bind="$attrs" ref="card" class="max-h-screen of-auto">
63
63
  <slot />
64
64
  </NCard>
65
65
  </div>
@@ -15,7 +15,7 @@ onClickOutside(el, () => {
15
15
 
16
16
  <template>
17
17
  <div ref="el" class="relative">
18
- <slot name="trigger" :enabled="enabled" @click="enabled = !enabled">
18
+ <slot name="trigger" :enabled="enabled" :click="() => enabled = !enabled">
19
19
  <NButton @click="enabled = !enabled">
20
20
  Dropdown
21
21
  </NButton>
@@ -14,7 +14,7 @@ defineProps<{
14
14
  <Component
15
15
  :is="(href || target) ? 'a' : NuxtLink"
16
16
  v-bind="$props"
17
- class="n-link hover:n-link-hover n-transition n-link-base"
17
+ class="n-link n-transition hover:n-link-hover n-link-base"
18
18
  >
19
19
  <slot />
20
20
  </Component>
@@ -19,7 +19,7 @@ const model = useVModel(props, 'modelValue', emit, { passive: true })
19
19
 
20
20
  <template>
21
21
  <label
22
- class="n-radio hover:n-radio-hover inline-flex select-none items-center n-disabled:n-disabled"
22
+ class="n-radio inline-flex hover:n-radio-hover select-none items-center n-disabled:n-disabled"
23
23
  :checked="model === value || null"
24
24
  :disabled="disabled || null"
25
25
  >
@@ -16,7 +16,7 @@ const checked = useVModel(props, 'modelValue', emit, { passive: true })
16
16
 
17
17
  <template>
18
18
  <label
19
- class="n-switch n-switch-base n-disabled:n-disabled"
19
+ class="n-switch n-switch-base hover:n-switch-hover n-disabled:n-disabled"
20
20
  :checked="checked || null"
21
21
  :disabled="disabled || null"
22
22
  >
package/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "devtools-ui-kit",
3
3
  "configKey": "devtoolsUIKit",
4
- "version": "0.4.6"
4
+ "version": "0.5.0"
5
5
  }
@@ -1 +1 @@
1
- export declare const devToolsClient: import("vue").Ref<import("@nuxt/devtools-kit/dist/client-api-f551dae7").c | undefined>;
1
+ export declare const devToolsClient: import("vue").Ref<import("@nuxt/devtools-kit/dist/client-api-dfe1af35").c | undefined>;
package/dist/unocss.mjs CHANGED
@@ -94,17 +94,20 @@ function unocssPreset() {
94
94
  "n-button-active": "n-active-base bg-context/5",
95
95
  "n-button-icon": "-ml-0.2em mr-0.2em text-1.1em",
96
96
  // checkbox
97
- "n-checkbox": "inline-flex gap-1 items-center",
97
+ "n-checkbox": "inline-flex gap-1 items-center rounded",
98
+ "n-checkbox-hover": "op100 n-bg-hover cursor-pointer",
98
99
  "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",
99
100
  "n-checkbox-box-checked": "bg-context border-context",
100
101
  "n-checkbox-icon": "carbon-checkmark w-1em h-1em m-auto",
101
102
  // radio
102
- "n-radio-box": "border n-border-base w-1.2em h-1.2em mr-1 text-white flex flex-none rounded-full overflow-visible",
103
+ "n-radio-box": "border rounded n-border-base w-1.2em h-1.2em mr-1 text-white flex flex-none rounded-full overflow-visible",
104
+ "n-radio-hover": "op100 n-bg-hover cursor-pointer",
103
105
  "n-radio-box-checked": "border-context",
104
106
  "n-radio-inner": "bg-context rounded-1/2 w-0 h-0 m-auto",
105
107
  "n-radio-inner-checked": "w-0.8em h-0.8em",
106
108
  // switch
107
- "n-switch-base": "inline-flex items-center select-none",
109
+ "n-switch-base": "inline-flex items-center select-none rounded-full pe-2",
110
+ "n-switch-hover": "op100 n-bg-hover cursor-pointer",
108
111
  "n-switch-slider": "mr-1 rounded-full border n-border-base relative p-2px",
109
112
  "n-switch-slider-checked": "border-context/20 bg-context/10",
110
113
  "n-switch-thumb": "h-1em w-1em rounded-1/2 border n-border-base ml-0 mr-0.8em",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nuxt/devtools-ui-kit",
3
3
  "type": "module",
4
- "version": "0.4.6",
4
+ "version": "0.5.0",
5
5
  "license": "MIT",
6
6
  "repository": "nuxt/devtools",
7
7
  "exports": {
@@ -23,30 +23,30 @@
23
23
  "*.cjs"
24
24
  ],
25
25
  "peerDependencies": {
26
- "@nuxt/devtools": "0.4.6"
26
+ "@nuxt/devtools": "0.5.0"
27
27
  },
28
28
  "dependencies": {
29
29
  "@iconify-json/carbon": "^1.1.16",
30
- "@nuxt/kit": "^3.4.3",
30
+ "@nuxt/kit": "^3.5.0",
31
31
  "@nuxtjs/color-mode": "^3.2.0",
32
- "@unocss/core": "^0.51.12",
33
- "@unocss/nuxt": "^0.51.12",
34
- "@unocss/preset-attributify": "^0.51.12",
35
- "@unocss/preset-icons": "^0.51.12",
36
- "@unocss/preset-mini": "^0.51.12",
37
- "@unocss/reset": "^0.51.12",
32
+ "@unocss/core": "^0.51.13",
33
+ "@unocss/nuxt": "^0.51.13",
34
+ "@unocss/preset-attributify": "^0.51.13",
35
+ "@unocss/preset-icons": "^0.51.13",
36
+ "@unocss/preset-mini": "^0.51.13",
37
+ "@unocss/reset": "^0.51.13",
38
38
  "@vueuse/core": "^10.1.2",
39
39
  "@vueuse/integrations": "^10.1.2",
40
40
  "@vueuse/nuxt": "^10.1.2",
41
41
  "defu": "^6.1.2",
42
- "focus-trap": "^7.4.0",
43
- "unocss": "^0.51.12",
42
+ "focus-trap": "^7.4.1",
43
+ "unocss": "^0.51.13",
44
44
  "v-lazy-show": "^0.2.3",
45
- "@nuxt/devtools-kit": "0.4.6",
46
- "@nuxt/devtools": "0.4.6"
45
+ "@nuxt/devtools": "0.5.0",
46
+ "@nuxt/devtools-kit": "0.5.0"
47
47
  },
48
48
  "devDependencies": {
49
- "nuxt": "^3.4.3"
49
+ "nuxt": "^3.5.0"
50
50
  },
51
51
  "publishConfig": {
52
52
  "access": "public"