@nuxt/devtools-ui-kit 0.8.5 → 1.0.0-beta.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.
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <span class="n-badge">
3
+ <slot />
4
+ </span>
5
+ </template>
@@ -3,10 +3,14 @@
3
3
  // @ts-ignore tsconfig
4
4
  import { NuxtLink } from '#components'
5
5
 
6
- defineProps<{
6
+ withDefaults(defineProps<{
7
7
  to?: string
8
8
  icon?: string
9
- }>()
9
+ border?: boolean
10
+ disabled?: boolean
11
+ }>(), {
12
+ border: true,
13
+ })
10
14
  </script>
11
15
 
12
16
  <template>
@@ -14,10 +18,14 @@ defineProps<{
14
18
  :is="to ? NuxtLink : 'button'"
15
19
  :to="to"
16
20
  v-bind="$attrs"
17
- class="n-button n-button-base active:n-button-active focus-visible:n-focus-base n-transition hover:n-button-hover n-disabled:n-disabled"
21
+ :class="[
22
+ { 'n-button-base active:n-button-active focus-visible:n-focus-base hover:n-button-hover': border },
23
+ { 'n-icon-button': !$slots.default },
24
+ ]"
25
+ class="n-button n-transition n-disabled:n-disabled"
18
26
  >
19
27
  <slot name="icon">
20
- <NIcon v-if="icon" :icon="icon" class="n-button-icon" />
28
+ <NIcon v-if="icon" :icon="icon" :class="{ 'n-button-icon': $slots.default }" />
21
29
  </slot>
22
30
  <slot />
23
31
  </Component>
@@ -0,0 +1,77 @@
1
+ <script setup lang="ts">
2
+ import { ref } from 'vue'
3
+ import { onClickOutside, useElementSize } from '@vueuse/core'
4
+
5
+ const props = withDefaults(defineProps<{
6
+ modelValue?: boolean
7
+ top?: HTMLElement | string
8
+ left?: HTMLElement | string
9
+ autoClose?: boolean
10
+ transition?: 'right' | 'bottom' | 'top'
11
+ }>(), {
12
+ transition: 'right',
13
+ })
14
+
15
+ const emit = defineEmits<{
16
+ (e: 'close'): void
17
+ }>()
18
+
19
+ const el = ref<HTMLElement>()
20
+
21
+ const { height } = useElementSize(() => props.top as HTMLElement, undefined, { box: 'border-box' })
22
+
23
+ const width = typeof props.left === 'string' && props.left.startsWith('#')
24
+ ? document.querySelector(props.left)?.getBoundingClientRect().width
25
+ : useElementSize(() => props.left as HTMLElement, undefined, { box: 'border-box' }).width
26
+
27
+ onClickOutside(el, () => {
28
+ if (props.modelValue && props.autoClose)
29
+ emit('close')
30
+ }, {
31
+ ignore: ['a', 'button', 'summary', '[role="dialog"]'],
32
+ })
33
+
34
+ const transitionType = {
35
+ right: {
36
+ 'enter-from-class': 'transform translate-x-1/1',
37
+ 'leave-to-class': 'transform translate-x-1/1',
38
+ },
39
+ top: {
40
+ 'enter-from-class': 'transform translate-y--1/1',
41
+ 'leave-to-class': 'transform translate-y--1/1',
42
+ },
43
+ bottom: {
44
+ 'enter-from-class': 'transform translate-y-1/1',
45
+ 'leave-to-class': 'transform translate-y-1/1',
46
+ },
47
+ }
48
+ </script>
49
+
50
+ <template>
51
+ <Transition
52
+ v-bind="transitionType[transition]"
53
+ enter-active-class="duration-200 ease-in"
54
+ enter-to-class="opacity-100"
55
+ leave-active-class="duration-200 ease-out"
56
+ leave-from-class="opacity-100"
57
+ >
58
+ <div
59
+ v-if="modelValue"
60
+ ref="el"
61
+ :border="`${transition === 'right' ? 'l' : transition === 'bottom' ? 't' : 'b'} base`"
62
+ flex="~ col gap-1"
63
+ :class="{ 'right-0': transition === 'right' || transition === 'bottom' }"
64
+ absolute bottom-0 z-10 z-20 of-auto text-sm glass-effect
65
+ :style="{
66
+ top: transition === 'bottom' ? 'auto' : `${height}px`,
67
+ left: transition === 'right' && !width ? 'auto' : `${width}px`,
68
+ }"
69
+ v-bind="$attrs"
70
+ >
71
+ <NButton absolute right-2 top-2 z-20 text-xl icon="carbon-close" :border="false" @click="$emit('close')" />
72
+ <div relative h-full w-full of-auto>
73
+ <slot />
74
+ </div>
75
+ </div>
76
+ </Transition>
77
+ </template>
@@ -1,21 +1,29 @@
1
1
  <script setup lang="ts">
2
- // eslint-disable-next-line ts/prefer-ts-expect-error
3
- // @ts-ignore tsconfig
4
- import { NuxtLink } from '#components'
2
+ import { computed } from 'vue'
5
3
 
6
- defineProps<{
4
+ const props = defineProps<{
7
5
  to?: string
8
6
  href?: string
9
7
  target?: string
8
+ underline?: boolean
10
9
  }>()
10
+
11
+ const link = computed(() => props.href || props.to)
11
12
  </script>
12
13
 
13
14
  <template>
14
- <Component
15
- :is="(href || target) ? 'a' : NuxtLink"
16
- v-bind="$props"
17
- class="n-link n-transition hover:n-link-hover n-link-base"
15
+ <NuxtLink
16
+ v-bind="link ? {
17
+ href: link,
18
+ target,
19
+ rel: target === '_blank' ? 'noopener noreferrer' : null,
20
+ } : {}"
21
+ :class="{ 'n-link n-transition hover:n-link-hover n-link-base': link || underline }"
18
22
  >
19
23
  <slot />
20
- </Component>
24
+ <div
25
+ v-if="link && target === '_blank'"
26
+ i-carbon:arrow-up-right translate-y--1 text-xs op50
27
+ />
28
+ </NuxtLink>
21
29
  </template>
@@ -21,12 +21,13 @@ const input = useVModel(props, 'modelValue', emit, { passive: true })
21
21
 
22
22
  <template>
23
23
  <div
24
- class="n-select flex flex items-center border n-border-base rounded px-2 py-1 focus-within:n-focus-base focus-within:border-context n-bg-base"
24
+ class="n-select flex flex items-center border rounded px-2 py-1 focus-within:n-focus-base focus-within:border-context n-bg-base"
25
+ :class="disabled ? 'border-gray:10' : 'n-border-base'"
25
26
  >
26
27
  <slot name="icon">
27
28
  <NIcon v-if="icon" :icon="icon" class="mr-0.4em text-1.1em op50" />
28
29
  </slot>
29
- <select v-model="input" :disabled="disabled" class="w-full flex-auto n-bg-base !outline-none">
30
+ <select v-model="input" :disabled="disabled" class="w-full flex-auto n-bg-base !outline-none" :class="disabled ? 'appearance-none' : ''">
30
31
  <option v-if="placeholder" value="" disabled hidden>
31
32
  {{ placeholder }}
32
33
  </option>
@@ -0,0 +1,82 @@
1
+ <script setup lang="ts">
2
+ import { computed, ref } from 'vue'
3
+ import { useLocalStorage } from '@vueuse/core'
4
+ import { Pane, Splitpanes } from 'splitpanes'
5
+
6
+ import 'splitpanes/dist/splitpanes.css'
7
+
8
+ const props = withDefaults(defineProps<{
9
+ /**
10
+ * The key to use for storing the pane sizes in localStorage.
11
+ */
12
+ storageKey?: string
13
+ stateKey?: string
14
+ leftSize?: number
15
+ minSize?: number
16
+ horizontal?: boolean
17
+ }>(), {
18
+ stateKey: 'nuxt-devtools-panels-state',
19
+ })
20
+
21
+ const state = useLocalStorage<Record<string, number>>(props.stateKey, {} as any, { listenToStorageChanges: false })
22
+
23
+ const DEFAULT = 30
24
+
25
+ const key = props.storageKey
26
+ const size = key
27
+ ? computed({
28
+ get: () => state.value[key] || props.leftSize || DEFAULT,
29
+ set: (v) => { state.value[key] = v },
30
+ })
31
+ : ref(props.leftSize || DEFAULT)
32
+ </script>
33
+
34
+ <template>
35
+ <Splitpanes :horizontal="horizontal" h-full of-hidden @resize="size = $event[0].size">
36
+ <Pane h-full class="of-auto!" :size="size" :min-size="$slots.right ? (minSize || 10) : 100">
37
+ <slot name="left" />
38
+ </Pane>
39
+ <Pane v-if="$slots.right" relative h-full class="of-auto!" :min-size="minSize || 10">
40
+ <slot name="right" />
41
+ </Pane>
42
+ </Splitpanes>
43
+ </template>
44
+
45
+ <style>
46
+ .splitpanes__splitter {
47
+ position: relative;
48
+ }
49
+ .splitpanes__splitter:before {
50
+ position: absolute;
51
+ left: 0;
52
+ top: 0;
53
+ transition: .2s ease;
54
+ content: '';
55
+ transition: opacity 0.4s;
56
+ z-index: 1;
57
+ }
58
+ .splitpanes__splitter:hover:before {
59
+ background: #8881;
60
+ opacity: 1;
61
+ }
62
+ .splitpanes--vertical>.splitpanes__splitter {
63
+ min-width: 0 !important;
64
+ width: 0 !important;
65
+ @apply border-r border-base
66
+ }
67
+ .splitpanes--horizontal>.splitpanes__splitter {
68
+ min-height: 0 !important;
69
+ height: 0 !important;
70
+ @apply border-t border-base
71
+ }
72
+ .splitpanes--vertical>.splitpanes__splitter:before {
73
+ left: -5px;
74
+ right: -4px;
75
+ height: 100%;
76
+ }
77
+ .splitpanes--horizontal>.splitpanes__splitter:before {
78
+ top: -5px;
79
+ bottom: -4px;
80
+ width: 100%;
81
+ }
82
+ </style>
@@ -8,6 +8,7 @@ const props = withDefaults(
8
8
  placeholder?: string
9
9
  disabled?: boolean
10
10
  autofocus?: boolean
11
+ readonly?: boolean
11
12
  type?: string
12
13
  }>(),
13
14
  {
package/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "devtools-ui-kit",
3
3
  "configKey": "devtoolsUIKit",
4
- "version": "0.8.5"
4
+ "version": "1.0.0-beta.0"
5
5
  }
package/dist/unocss.mjs CHANGED
@@ -1,17 +1,16 @@
1
1
  import { parseColor } from '@unocss/preset-mini/utils';
2
2
  import { theme } from '@unocss/preset-mini';
3
3
  import { fonts } from '@unocss/preset-mini/rules';
4
- import { mergeDeep, presetUno, presetAttributify, presetTypography, presetIcons, transformerDirectives, transformerVariantGroup } from 'unocss';
4
+ import { mergeDeep, presetUno, presetAttributify, presetTypography, presetIcons, presetWebFonts, transformerDirectives, transformerVariantGroup } from 'unocss';
5
5
 
6
6
  function unocssPreset() {
7
7
  return {
8
8
  name: "@nuxt/devtools-ui-kit",
9
9
  theme: mergeDeep(theme, {
10
10
  colors: {
11
+ brand: "#00DC82",
12
+ primary: "#099e61",
11
13
  context: "rgba(var(--nui-c-context),%alpha)"
12
- },
13
- fontFamily: {
14
- sans: "Avenir, Helvetica, Arial, sans-serif"
15
14
  }
16
15
  }),
17
16
  rules: [
@@ -120,6 +119,9 @@ function unocssPreset() {
120
119
  "n-code-block": "dark:bg-[#121212] bg-white",
121
120
  // icon-button
122
121
  "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",
122
+ // badge
123
+ "n-badge-base": "bg-context/10 text-context rounded whitespace-nowrap select-none",
124
+ "n-badge": "n-badge-base mx-0.5 px-1.5 py-0.5 text-xs",
123
125
  // loading
124
126
  "n-loading": "flex h-full w-full justify-center items-center",
125
127
  "n-panel-grids": "n-panel-grids-light dark:n-panel-grids-dark",
@@ -144,6 +146,12 @@ function extendUnocssOptions(user = {}) {
144
146
  }
145
147
  // ...(user?.icons || {})
146
148
  }),
149
+ presetWebFonts({
150
+ fonts: {
151
+ sans: "DM Sans",
152
+ mono: "DM Mono"
153
+ }
154
+ }),
147
155
  unocssPreset(),
148
156
  ...user.presets || []
149
157
  ],
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nuxt/devtools-ui-kit",
3
3
  "type": "module",
4
- "version": "0.8.5",
4
+ "version": "1.0.0-beta.0",
5
5
  "license": "MIT",
6
6
  "repository": "nuxt/devtools",
7
7
  "exports": {
@@ -23,33 +23,34 @@
23
23
  "dist"
24
24
  ],
25
25
  "peerDependencies": {
26
- "@nuxt/devtools": "0.8.5"
26
+ "@nuxt/devtools": "1.0.0-beta.0"
27
27
  },
28
28
  "dependencies": {
29
29
  "@iconify-json/carbon": "^1.1.21",
30
30
  "@iconify-json/logos": "^1.1.37",
31
31
  "@iconify-json/ri": "^1.1.12",
32
- "@iconify-json/tabler": "^1.1.91",
33
- "@nuxt/kit": "^3.7.3",
32
+ "@iconify-json/tabler": "^1.1.92",
33
+ "@nuxt/kit": "^3.7.4",
34
34
  "@nuxtjs/color-mode": "^3.3.0",
35
- "@unocss/core": "^0.56.0",
36
- "@unocss/nuxt": "^0.56.0",
37
- "@unocss/preset-attributify": "^0.56.0",
38
- "@unocss/preset-icons": "^0.56.0",
39
- "@unocss/preset-mini": "^0.56.0",
40
- "@unocss/reset": "^0.56.0",
35
+ "@unocss/core": "^0.56.2",
36
+ "@unocss/nuxt": "^0.56.2",
37
+ "@unocss/preset-attributify": "^0.56.2",
38
+ "@unocss/preset-icons": "^0.56.2",
39
+ "@unocss/preset-mini": "^0.56.2",
40
+ "@unocss/reset": "^0.56.2",
41
41
  "@vueuse/core": "^10.4.1",
42
42
  "@vueuse/integrations": "^10.4.1",
43
43
  "@vueuse/nuxt": "^10.4.1",
44
44
  "defu": "^6.1.2",
45
- "focus-trap": "^7.5.2",
46
- "unocss": "^0.56.0",
45
+ "focus-trap": "^7.5.3",
46
+ "splitpanes": "^3.1.5",
47
+ "unocss": "^0.56.2",
47
48
  "v-lazy-show": "^0.2.3",
48
- "@nuxt/devtools-kit": "0.8.5"
49
+ "@nuxt/devtools-kit": "1.0.0-beta.0"
49
50
  },
50
51
  "devDependencies": {
51
- "nuxt": "^3.7.3",
52
- "@nuxt/devtools": "0.8.5"
52
+ "nuxt": "^3.7.4",
53
+ "@nuxt/devtools": "1.0.0-beta.0"
53
54
  },
54
55
  "publishConfig": {
55
56
  "access": "public"
@@ -1,25 +0,0 @@
1
- <script setup lang="ts">
2
- // eslint-disable-next-line ts/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
- disabled?: boolean
10
- }>()
11
- </script>
12
-
13
- <template>
14
- <Component
15
- :is="to ? NuxtLink : 'button'"
16
- :to="to"
17
- v-bind="$attrs"
18
- class="n-transition n-icon-button"
19
- :class="{
20
- 'n-disabled op10!': props.disabled,
21
- }"
22
- >
23
- <NIcon :icon="props.icon" />
24
- </Component>
25
- </template>
@@ -1,24 +0,0 @@
1
- <script setup lang="ts">
2
- import NLink from './NLink.vue'
3
-
4
- defineProps<{
5
- link?: string
6
- }>()
7
- </script>
8
-
9
- <template>
10
- <component
11
- :is="link ? NLink : 'div'"
12
- v-bind="link ? {
13
- href: link,
14
- target: '_blank',
15
- rel: 'noopener noreferrer',
16
- } : {}"
17
- >
18
- <slot />
19
- <div
20
- v-if="link"
21
- i-carbon:arrow-up-right translate-y--1 text-xs op50
22
- />
23
- </component>
24
- </template>