@nuxt/devtools-ui-kit 2.2.1 → 2.3.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.
- package/dist/components/NBadgeHashed.vue +21 -0
- package/dist/components/NButton.mjs +0 -1
- package/dist/components/NCodeBlock.vue +2 -1
- package/dist/composables/color.d.ts +1 -0
- package/dist/composables/color.mjs +7 -0
- package/dist/module.json +2 -2
- package/dist/module.mjs +1 -2
- package/package.json +11 -11
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import { getHslColorFromStringHash } from '../composables/color'
|
|
4
|
+
import NBadge from './NBadge.vue'
|
|
5
|
+
|
|
6
|
+
const props = defineProps<{
|
|
7
|
+
text: string
|
|
8
|
+
}>()
|
|
9
|
+
|
|
10
|
+
const color = computed(() => {
|
|
11
|
+
const foreground = getHslColorFromStringHash(props.text, 50, 60)
|
|
12
|
+
const background = getHslColorFromStringHash(props.text, 50, 60, 0.05)
|
|
13
|
+
return { color: foreground, background }
|
|
14
|
+
})
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<NBadge :style="color">
|
|
19
|
+
{{ text }}<slot />
|
|
20
|
+
</NBadge>
|
|
21
|
+
</template>
|
|
@@ -22,7 +22,6 @@ export default defineComponent({
|
|
|
22
22
|
...attrs,
|
|
23
23
|
...!props.to && { type: props.type },
|
|
24
24
|
...props.disabled ? { disabled: true } : { tabindex: 0 },
|
|
25
|
-
// @ts-expect-error ignore type
|
|
26
25
|
class: [
|
|
27
26
|
props.border ? "n-button-base active:n-button-active focus-visible:n-focus-base hover:n-button-hover" : "",
|
|
28
27
|
slots.default ? "" : "n-icon-button",
|
|
@@ -10,6 +10,7 @@ const props = withDefaults(
|
|
|
10
10
|
lang?: BuiltinLanguage | 'text'
|
|
11
11
|
lines?: boolean
|
|
12
12
|
inline?: boolean
|
|
13
|
+
grammarContextCode?: string
|
|
13
14
|
transformRendered?: (code: string) => string
|
|
14
15
|
}>(),
|
|
15
16
|
{
|
|
@@ -22,7 +23,7 @@ const emit = defineEmits(['loaded'])
|
|
|
22
23
|
const rendered = computed(() => {
|
|
23
24
|
const result = props.lang === 'text'
|
|
24
25
|
? { code: props.code, supported: false }
|
|
25
|
-
: devToolsClient.value?.devtools.renderCodeHighlight(props.code, props.lang) || { code: props.code, supported: false }
|
|
26
|
+
: devToolsClient.value?.devtools.renderCodeHighlight(props.code, props.lang, { grammarContextCode: props.grammarContextCode }) || { code: props.code, supported: false }
|
|
26
27
|
if (result.supported && props.transformRendered)
|
|
27
28
|
result.code = props.transformRendered(result.code)
|
|
28
29
|
if (result.supported)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getHslColorFromStringHash(name: string, saturation?: number, lightness?: number, opacity?: number | string): string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export function getHslColorFromStringHash(name, saturation = 65, lightness = 50, opacity = 1) {
|
|
2
|
+
let hash = 0;
|
|
3
|
+
for (let i = 0; i < name.length; i++)
|
|
4
|
+
hash = name.charCodeAt(i) + ((hash << 5) - hash);
|
|
5
|
+
const h = hash % 360;
|
|
6
|
+
return `hsla(${h}, ${saturation}%, ${lightness}%, ${opacity})`;
|
|
7
|
+
}
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -13,7 +13,7 @@ function rPath(p) {
|
|
|
13
13
|
}
|
|
14
14
|
const module = defineNuxtModule({
|
|
15
15
|
meta: {
|
|
16
|
-
name: "devtools-ui-kit",
|
|
16
|
+
name: "@nuxt/devtools-ui-kit",
|
|
17
17
|
configKey: "devtoolsUIKit"
|
|
18
18
|
},
|
|
19
19
|
defaults: {
|
|
@@ -26,7 +26,6 @@ const module = defineNuxtModule({
|
|
|
26
26
|
nuxt.options.css.unshift(rPath("assets/styles.css"));
|
|
27
27
|
if (!options.dev)
|
|
28
28
|
nuxt.options.unocss = extendUnocssOptions(nuxt.options.unocss);
|
|
29
|
-
nuxt.options.vueuse = nuxt.options.vueuse || {};
|
|
30
29
|
nuxt.options.colorMode = defu(nuxt.options.colorMode, { classSuffix: "" });
|
|
31
30
|
const resolver = createResolver(import.meta.url);
|
|
32
31
|
await installModule(await resolver.resolvePath("@unocss/nuxt"));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/devtools-ui-kit",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.3.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://devtools.nuxt.com/module/ui-kit",
|
|
7
7
|
"repository": {
|
|
@@ -28,33 +28,33 @@
|
|
|
28
28
|
"dist"
|
|
29
29
|
],
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@nuxt/devtools": "2.
|
|
31
|
+
"@nuxt/devtools": "2.3.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@iconify-json/carbon": "^1.2.8",
|
|
35
35
|
"@iconify-json/logos": "^1.2.4",
|
|
36
36
|
"@iconify-json/ri": "^1.2.5",
|
|
37
|
-
"@iconify-json/tabler": "^1.2.
|
|
38
|
-
"@nuxt/kit": "^3.
|
|
37
|
+
"@iconify-json/tabler": "^1.2.17",
|
|
38
|
+
"@nuxt/kit": "^3.16.0",
|
|
39
39
|
"@unocss/core": "^66.0.0",
|
|
40
40
|
"@unocss/nuxt": "^66.0.0",
|
|
41
41
|
"@unocss/preset-attributify": "^66.0.0",
|
|
42
42
|
"@unocss/preset-icons": "^66.0.0",
|
|
43
43
|
"@unocss/preset-mini": "^66.0.0",
|
|
44
44
|
"@unocss/reset": "^66.0.0",
|
|
45
|
-
"@vueuse/core": "^
|
|
46
|
-
"@vueuse/integrations": "^
|
|
47
|
-
"@vueuse/nuxt": "^
|
|
45
|
+
"@vueuse/core": "^13.0.0",
|
|
46
|
+
"@vueuse/integrations": "^13.0.0",
|
|
47
|
+
"@vueuse/nuxt": "^13.0.0",
|
|
48
48
|
"defu": "^6.1.4",
|
|
49
49
|
"focus-trap": "^7.6.4",
|
|
50
|
-
"splitpanes": "^3.
|
|
50
|
+
"splitpanes": "^3.2.0",
|
|
51
51
|
"unocss": "^66.0.0",
|
|
52
52
|
"v-lazy-show": "^0.3.0",
|
|
53
|
-
"@nuxt/devtools-kit": "2.
|
|
53
|
+
"@nuxt/devtools-kit": "2.3.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"nuxt": "^3.
|
|
57
|
-
"@nuxt/devtools": "2.
|
|
56
|
+
"nuxt": "^3.16.0",
|
|
57
|
+
"@nuxt/devtools": "2.3.0"
|
|
58
58
|
},
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public"
|