@sit-onyx/nuxt-docs 0.2.0-dev-20260114152822 → 0.2.0-dev-20260114161848
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/app/components/HighlightedCode.vue +30 -0
- package/app/components/PackageManagerCodeTabs.vue +2 -9
- package/app/components/content/ProseBr.global.vue +13 -0
- package/nuxt.config.ts +7 -0
- package/package.json +5 -5
- /package/app/components/content/{NpmInstallCodeTabs.vue → NpmInstallCodeTabs.global.vue} +0 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
const props = defineProps<{
|
|
3
|
+
code: string;
|
|
4
|
+
language: string;
|
|
5
|
+
}>();
|
|
6
|
+
|
|
7
|
+
const snippet = computed(() => {
|
|
8
|
+
return `
|
|
9
|
+
\`\`\`${props.language}
|
|
10
|
+
${props.code}
|
|
11
|
+
\`\`\`
|
|
12
|
+
`;
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const { data: ast } = await useAsyncData(snippet, () => parseMarkdown(snippet.value));
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<!-- eslint-disable-next-line vue/no-root-v-if -->
|
|
19
|
+
<template>
|
|
20
|
+
<!--
|
|
21
|
+
We need to override the components here to force using the regular pre and code components.
|
|
22
|
+
This way, the renderer does not use the globally defined ProsePre and ProseCode components which have their own styling, features etc.
|
|
23
|
+
-->
|
|
24
|
+
<MDCRenderer
|
|
25
|
+
v-if="ast"
|
|
26
|
+
:body="ast.body"
|
|
27
|
+
:data="ast.data"
|
|
28
|
+
:components="{ pre: 'pre', code: 'code' }"
|
|
29
|
+
/>
|
|
30
|
+
</template>
|
|
@@ -4,6 +4,7 @@ import bunIcon from "~/assets/icons/bun.svg?raw";
|
|
|
4
4
|
import npmIcon from "~/assets/icons/npm.svg?raw";
|
|
5
5
|
import pnpmIcon from "~/assets/icons/pnpm.svg?raw";
|
|
6
6
|
import yarnIcon from "~/assets/icons/yarn.svg?raw";
|
|
7
|
+
import HighlightedCode from "./HighlightedCode.vue";
|
|
7
8
|
|
|
8
9
|
type PackageManager = "pnpm" | "npm" | "yarn" | "bun";
|
|
9
10
|
|
|
@@ -29,20 +30,12 @@ const tabs = computed(() => {
|
|
|
29
30
|
|
|
30
31
|
return tabs.filter((tab) => tab.code);
|
|
31
32
|
});
|
|
32
|
-
|
|
33
|
-
const getMDCValue = (code: string, language: string) => {
|
|
34
|
-
return `
|
|
35
|
-
\`\`\`${language}
|
|
36
|
-
${code}
|
|
37
|
-
\`\`\`
|
|
38
|
-
`;
|
|
39
|
-
};
|
|
40
33
|
</script>
|
|
41
34
|
|
|
42
35
|
<template>
|
|
43
36
|
<OnyxUnstableCodeTabs v-model="selectedTab">
|
|
44
37
|
<OnyxUnstableCodeTab v-for="tab in tabs" v-bind="tab" :key="tab.value" :label="tab.value">
|
|
45
|
-
<
|
|
38
|
+
<HighlightedCode :code="tab.code" :language="tab.language" />
|
|
46
39
|
</OnyxUnstableCodeTab>
|
|
47
40
|
</OnyxUnstableCodeTabs>
|
|
48
41
|
</template>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Note: this component needs to marked as global so it is displayed correctly when building the app (since @nuxt/content does not include a ProseBr by default)
|
|
3
|
+
-->
|
|
4
|
+
<template>
|
|
5
|
+
<br aria-hidden="true" />
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<style lang="scss" scoped>
|
|
9
|
+
br {
|
|
10
|
+
display: block;
|
|
11
|
+
height: 1lh;
|
|
12
|
+
}
|
|
13
|
+
</style>
|
package/nuxt.config.ts
CHANGED
|
@@ -17,4 +17,11 @@ export default defineNuxtConfig({
|
|
|
17
17
|
// Otherwise if we would e.g. add en here, the project would always be forced to register en, even if it does not plan to add en translations
|
|
18
18
|
// which could conflict with e.g. "const { locales } = useI18n()" to render a language switch which would always include en then
|
|
19
19
|
},
|
|
20
|
+
mdc: {
|
|
21
|
+
components: {
|
|
22
|
+
map: {
|
|
23
|
+
br: "ProseBr",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
20
27
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sit-onyx/nuxt-docs",
|
|
3
|
-
"version": "0.2.0-dev-
|
|
3
|
+
"version": "0.2.0-dev-20260114161848",
|
|
4
4
|
"description": "Nuxt layer/template for creating documentations with the onyx design system",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Schwarz IT KG",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"@nuxtjs/mdc": ">= 0.17.2",
|
|
32
32
|
"@nuxtjs/i18n": ">= 10",
|
|
33
33
|
"sass-embedded": ">= 1",
|
|
34
|
-
"@sit-onyx/icons": "^1.4.0-dev-
|
|
34
|
+
"@sit-onyx/icons": "^1.4.0-dev-20260114161848",
|
|
35
35
|
"@sit-onyx/nuxt": "^1.0.1",
|
|
36
|
-
"sit-onyx": "^1.6.0-dev-
|
|
36
|
+
"sit-onyx": "^1.6.0-dev-20260114161848"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@fontsource-variable/source-code-pro": ">= 5",
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
"sass-embedded": "1.97.2",
|
|
50
50
|
"typescript": "5.9.3",
|
|
51
51
|
"vue": "3.5.26",
|
|
52
|
-
"@sit-onyx/icons": "^1.4.0-dev-
|
|
52
|
+
"@sit-onyx/icons": "^1.4.0-dev-20260114161848",
|
|
53
53
|
"@sit-onyx/nuxt": "^1.0.1",
|
|
54
54
|
"@sit-onyx/shared": "^0.1.0",
|
|
55
|
-
"sit-onyx": "^1.6.0-dev-
|
|
55
|
+
"sit-onyx": "^1.6.0-dev-20260114161848"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"dev": "pnpm dev:prepare && nuxi dev playground",
|
|
File without changes
|