@nuxt/devtools-ui-kit-nightly 2.2.1-29030652.7bd1409 → 2.2.1-29030668.f7e9ab5

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,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>
@@ -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
@@ -1,7 +1,7 @@
1
1
  {
2
- "name": "devtools-ui-kit",
2
+ "name": "@nuxt/devtools-ui-kit",
3
3
  "configKey": "devtoolsUIKit",
4
- "version": "2.2.1-29030652.7bd1409",
4
+ "version": "2.2.1-29030668.f7e9ab5",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "0.8.4",
7
7
  "unbuild": "3.5.0"
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-nightly",
3
3
  "type": "module",
4
- "version": "2.2.1-29030652.7bd1409",
4
+ "version": "2.2.1-29030668.f7e9ab5",
5
5
  "license": "MIT",
6
6
  "homepage": "https://devtools.nuxt.com/module/ui-kit",
7
7
  "repository": {
@@ -28,14 +28,14 @@
28
28
  "dist"
29
29
  ],
30
30
  "peerDependencies": {
31
- "@nuxt/devtools": "npm:@nuxt/devtools-nightly@2.2.1-29030652.7bd1409"
31
+ "@nuxt/devtools": "npm:@nuxt/devtools-nightly@2.2.1-29030668.f7e9ab5"
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
37
  "@iconify-json/tabler": "^1.2.17",
38
- "@nuxt/devtools-kit": "npm:@nuxt/devtools-kit-nightly@2.2.1-29030652.7bd1409",
38
+ "@nuxt/devtools-kit": "npm:@nuxt/devtools-kit-nightly@2.2.1-29030668.f7e9ab5",
39
39
  "@nuxt/kit": "^3.16.0",
40
40
  "@unocss/core": "^66.0.0",
41
41
  "@unocss/nuxt": "^66.0.0",
@@ -53,7 +53,7 @@
53
53
  "v-lazy-show": "^0.3.0"
54
54
  },
55
55
  "devDependencies": {
56
- "@nuxt/devtools": "npm:@nuxt/devtools-nightly@2.2.1-29030652.7bd1409",
56
+ "@nuxt/devtools": "npm:@nuxt/devtools-nightly@2.2.1-29030668.f7e9ab5",
57
57
  "nuxt": "^3.16.0"
58
58
  },
59
59
  "publishConfig": {