@sit-onyx/nuxt-docs 0.2.0 → 0.3.0-dev-20260211170858

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,4 @@
1
+ :root {
2
+ /** Basic vertical spacing for markdown elements. */
3
+ --onyx-docs-density-paragraph: var(--onyx-density-md);
4
+ }
@@ -45,6 +45,8 @@ const getSidebarItemProps = (item: SidebarNavigationItem): SidebarItemProps => {
45
45
  showArrow: item.sidebar?.root,
46
46
  };
47
47
  };
48
+
49
+ const { icon } = useIcon(computed(() => props.item.icon));
48
50
  </script>
49
51
 
50
52
  <template>
@@ -64,7 +66,7 @@ const getSidebarItemProps = (item: SidebarNavigationItem): SidebarItemProps => {
64
66
  <OnyxAccordionItem :value="props.item.path">
65
67
  <template #header>
66
68
  <div class="sidebar-accordion__header">
67
- <ResolvableIcon v-if="props.item.icon" :name="props.item.icon" />
69
+ <OnyxIcon v-if="icon" :icon />
68
70
  {{ props.item.title }}
69
71
  </div>
70
72
  </template>
@@ -33,9 +33,15 @@ const tabs = computed(() => {
33
33
  </script>
34
34
 
35
35
  <template>
36
- <OnyxUnstableCodeTabs v-model="selectedTab">
37
- <OnyxUnstableCodeTab v-for="tab in tabs" v-bind="tab" :key="tab.value" :label="tab.value">
36
+ <OnyxCodeTabs v-model="selectedTab" class="tabs">
37
+ <OnyxCodeTab v-for="tab in tabs" v-bind="tab" :key="tab.value" :label="tab.value">
38
38
  <HighlightedCode :code="tab.code" :language="tab.language" />
39
- </OnyxUnstableCodeTab>
40
- </OnyxUnstableCodeTabs>
39
+ </OnyxCodeTab>
40
+ </OnyxCodeTabs>
41
41
  </template>
42
+
43
+ <style lang="scss" scoped>
44
+ .tabs {
45
+ margin-block: var(--onyx-docs-density-paragraph);
46
+ }
47
+ </style>
@@ -14,11 +14,13 @@ export type SidebarItemProps = {
14
14
  };
15
15
 
16
16
  const props = defineProps<SidebarItemProps>();
17
+
18
+ const { icon } = useIcon(computed(() => props.icon));
17
19
  </script>
18
20
 
19
21
  <template>
20
22
  <OnyxSidebarItem class="sidebar-item" :link="props.link">
21
- <ResolvableIcon v-if="props.icon" :name="props.icon" />
23
+ <OnyxIcon v-if="icon" :icon />
22
24
  {{ props.label }}
23
25
  <OnyxIcon v-if="props.showArrow" :icon="iconArrowSmallRight" />
24
26
  </OnyxSidebarItem>
@@ -0,0 +1,29 @@
1
+ <script lang="ts" setup>
2
+ import type { OnyxInfoCardProps } from "sit-onyx";
3
+
4
+ const props = withDefaults(defineProps<OnyxInfoCardProps>(), {
5
+ icon: undefined, // using "undefined" so it does not default to "false" so the correct default icon is used by the OnyxInfoCard
6
+ });
7
+
8
+ const slots = defineSlots<{
9
+ default?(): unknown;
10
+ }>();
11
+
12
+ const { icon: iconContent } = useIcon(
13
+ computed(() => (typeof props.icon === "string" ? props.icon : undefined)),
14
+ );
15
+ </script>
16
+
17
+ <template>
18
+ <OnyxInfoCard class="card" v-bind="props" :icon="iconContent ?? props.icon">
19
+ <template v-if="slots.default" #default>
20
+ <slot mdc-unwrap="p"></slot>
21
+ </template>
22
+ </OnyxInfoCard>
23
+ </template>
24
+
25
+ <style lang="scss" scoped>
26
+ .card {
27
+ margin-block: var(--onyx-docs-density-paragraph);
28
+ }
29
+ </style>
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import type { LinkTarget } from "sit-onyx";
2
+ import { isInternalLink, type LinkTarget } from "sit-onyx";
3
3
 
4
4
  const props = withDefaults(
5
5
  defineProps<{
@@ -21,7 +21,11 @@ onMounted(() => (isMounted.value = true));
21
21
  </script>
22
22
 
23
23
  <template>
24
- <OnyxLink v-bind="props" :with-external-icon="isMounted ? 'auto' : false">
24
+ <OnyxLink
25
+ v-bind="props"
26
+ :target="!isInternalLink(props.href) ? '_blank' : props.target"
27
+ :with-external-icon="isMounted ? 'auto' : false"
28
+ >
25
29
  <slot></slot>
26
30
  </OnyxLink>
27
31
  </template>
@@ -0,0 +1,20 @@
1
+ <script lang="ts" setup>
2
+ defineSlots<{
3
+ default(): unknown;
4
+ }>();
5
+ </script>
6
+
7
+ <template>
8
+ <code class="onyx-text--small">
9
+ <slot></slot>
10
+ </code>
11
+ </template>
12
+
13
+ <style lang="scss" scoped>
14
+ code {
15
+ background-color: var(--onyx-color-base-background-blank);
16
+ border: var(--onyx-1px-in-rem) solid var(--onyx-color-component-border-neutral);
17
+ border-radius: var(--onyx-radius-sm);
18
+ padding: var(--onyx-density-3xs) var(--onyx-density-2xs);
19
+ }
20
+ </style>
@@ -16,7 +16,7 @@ defineSlots<{
16
16
 
17
17
  <style lang="scss" scoped>
18
18
  .onyx-headline {
19
- margin-top: var(--onyx-density-lg);
19
+ margin-top: var(--onyx-density-2xl);
20
20
  margin-bottom: var(--onyx-density-xs);
21
21
  }
22
22
  </style>
@@ -16,7 +16,7 @@ defineSlots<{
16
16
 
17
17
  <style lang="scss" scoped>
18
18
  .onyx-headline {
19
- margin-top: var(--onyx-density-lg);
19
+ margin-top: var(--onyx-density-xl);
20
20
  margin-bottom: var(--onyx-density-2xs);
21
21
  }
22
22
  </style>
@@ -0,0 +1,12 @@
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 ProseHr by default)
3
+ -->
4
+ <template>
5
+ <OnyxSeparator class="separator" />
6
+ </template>
7
+
8
+ <style lang="scss" scoped>
9
+ .separator {
10
+ margin-block: var(--onyx-docs-density-paragraph);
11
+ }
12
+ </style>
@@ -12,7 +12,6 @@ defineSlots<{
12
12
 
13
13
  <style lang="scss" scoped>
14
14
  ol {
15
- margin-top: var(--onyx-density-xs);
16
- margin-bottom: var(--onyx-density-xs);
15
+ margin-block: var(--onyx-density-xs);
17
16
  }
18
17
  </style>
@@ -0,0 +1,17 @@
1
+ <script lang="ts" setup>
2
+ defineSlots<{
3
+ default(): unknown;
4
+ }>();
5
+ </script>
6
+
7
+ <template>
8
+ <p>
9
+ <slot></slot>
10
+ </p>
11
+ </template>
12
+
13
+ <style lang="scss" scoped>
14
+ p {
15
+ margin-block: var(--onyx-docs-density-paragraph);
16
+ }
17
+ </style>
@@ -38,14 +38,9 @@ const value = "tab-1";
38
38
  </script>
39
39
 
40
40
  <template>
41
- <OnyxUnstableCodeTabs :model-value="value">
42
- <OnyxUnstableCodeTab
43
- :value
44
- :code="props.code"
45
- :language="props.language"
46
- :label="props.filename"
47
- >
41
+ <OnyxCodeTabs :model-value="value">
42
+ <OnyxCodeTab :value :code="props.code" :language="props.language" :label="props.filename">
48
43
  <pre :class="props.class"><slot></slot></pre>
49
- </OnyxUnstableCodeTab>
50
- </OnyxUnstableCodeTabs>
44
+ </OnyxCodeTab>
45
+ </OnyxCodeTabs>
51
46
  </template>
@@ -33,7 +33,7 @@ const content = computed(() => {
33
33
  </script>
34
34
 
35
35
  <template>
36
- <OnyxTable striped with-vertical-borders>
36
+ <OnyxTable class="table" striped with-vertical-borders>
37
37
  <template #head>
38
38
  <component :is="tr" v-for="tr in content.headRows" :key="tr.key" />
39
39
  </template>
@@ -41,3 +41,9 @@ const content = computed(() => {
41
41
  <component :is="tr" v-for="tr in content.bodyRows" :key="tr.key" />
42
42
  </OnyxTable>
43
43
  </template>
44
+
45
+ <style lang="scss" scoped>
46
+ .table {
47
+ margin-block: var(--onyx-docs-density-paragraph);
48
+ }
49
+ </style>
@@ -12,7 +12,6 @@ defineSlots<{
12
12
 
13
13
  <style lang="scss" scoped>
14
14
  ul {
15
- margin-top: var(--onyx-density-xs);
16
- margin-bottom: var(--onyx-density-xs);
15
+ margin-block: var(--onyx-density-xs);
17
16
  }
18
17
  </style>
@@ -0,0 +1,31 @@
1
+ import * as ALL_ICONS from "@sit-onyx/icons";
2
+ import { getIconImportName } from "@sit-onyx/icons/utils";
3
+
4
+ /**
5
+ * Composable for resolving the icon content based on the icon name.
6
+ */
7
+ export const useIcon = (iconName: MaybeRef<string | undefined>) => {
8
+ const icon = ref<string>();
9
+
10
+ watch(
11
+ toRef(iconName),
12
+ (newIconName) => {
13
+ icon.value = newIconName
14
+ ? ALL_ICONS[getIconImportName(newIconName) as keyof typeof ALL_ICONS]
15
+ : undefined;
16
+
17
+ if (newIconName && import.meta.dev && !icon.value) {
18
+ // eslint-disable-next-line no-console -- used only during development environment
19
+ console.warn(`Dynamic icon with name "${iconName}" not found.`);
20
+ }
21
+ },
22
+ { immediate: true },
23
+ );
24
+
25
+ return {
26
+ /**
27
+ * Resolved icon content.
28
+ */
29
+ icon,
30
+ };
31
+ };
@@ -1,3 +1,4 @@
1
+ import { computed, useAsyncData, useI18n, useLocalePath, useRoute } from "#imports"; // since nuxt 4.3 the auto-imports don't work for this composable anymore; Might be related to https://github.com/nuxt/nuxt/issues/22342
1
2
  import type { Collections, ContentNavigationItem } from "@nuxt/content";
2
3
 
3
4
  export type SidebarNavigationItem = {
package/nuxt.config.ts CHANGED
@@ -1,4 +1,11 @@
1
- // https://nuxt.com/docs/api/configuration/nuxt-config
1
+ import { createResolver } from "nuxt/kit";
2
+
3
+ // using a resolver here so path are correctly resolved when extending this app as Nuxt layer
4
+ const { resolve } = createResolver(import.meta.url);
5
+
6
+ /**
7
+ * @see https://nuxt.com/docs/api/configuration/nuxt-config
8
+ */
2
9
  export default defineNuxtConfig({
3
10
  $meta: {
4
11
  // the name is used to generate import aliases so the user can easily import
@@ -10,7 +17,11 @@ export default defineNuxtConfig({
10
17
  compatibilityDate: "2025-01-20",
11
18
  typescript: { typeCheck: "build" },
12
19
  modules: ["@sit-onyx/nuxt", "@nuxt/content", "@nuxtjs/color-mode", "@nuxt/image", "@nuxtjs/i18n"],
13
- css: ["@fontsource-variable/source-code-pro", "@fontsource-variable/source-sans-3"],
20
+ css: [
21
+ "@fontsource-variable/source-code-pro",
22
+ "@fontsource-variable/source-sans-3",
23
+ resolve("./app/assets/styles/index.scss"),
24
+ ],
14
25
  i18n: {
15
26
  defaultLocale: "en",
16
27
  // we explicitly don't define any default locales here so the project is fully in charge if defining which locales to use.
@@ -21,6 +32,7 @@ export default defineNuxtConfig({
21
32
  components: {
22
33
  map: {
23
34
  br: "ProseBr",
35
+ hr: "ProseHr",
24
36
  },
25
37
  },
26
38
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sit-onyx/nuxt-docs",
3
- "version": "0.2.0",
3
+ "version": "0.3.0-dev-20260211170858",
4
4
  "description": "Nuxt layer/template for creating documentations with the onyx design system",
5
5
  "type": "module",
6
6
  "author": "Schwarz IT KG",
@@ -28,31 +28,31 @@
28
28
  "@nuxt/content": ">= 3",
29
29
  "@nuxt/image": ">= 1",
30
30
  "@nuxtjs/color-mode": ">= 4",
31
- "@nuxtjs/mdc": ">= 0.17.2",
32
31
  "@nuxtjs/i18n": ">= 10",
32
+ "@nuxtjs/mdc": ">= 0.20.1",
33
33
  "sass-embedded": ">= 1",
34
- "@sit-onyx/icons": "^1.4.0",
34
+ "@sit-onyx/icons": "^1.6.0-dev-20260211170858",
35
35
  "@sit-onyx/nuxt": "^1.0.1",
36
- "sit-onyx": "^1.6.0"
36
+ "sit-onyx": "^1.8.0-dev-20260211170858"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@fontsource-variable/source-code-pro": ">= 5",
40
40
  "@fontsource-variable/source-sans-3": ">= 5",
41
41
  "@nuxt/content": ">= 3",
42
42
  "@nuxt/image": ">= 1",
43
- "@nuxt/test-utils": "^3.23.0",
43
+ "@nuxt/test-utils": "^4.0.0",
44
44
  "@nuxtjs/color-mode": ">= 4",
45
- "@nuxtjs/mdc": ">= 0.17.2",
45
+ "@nuxtjs/mdc": ">= 0.20.1",
46
46
  "@playwright/experimental-ct-vue": "1.57.0",
47
47
  "@playwright/test": "1.57.0",
48
- "nuxt": "4.2.2",
49
- "sass-embedded": "1.97.2",
48
+ "nuxt": "4.3.1",
49
+ "sass-embedded": "1.97.3",
50
50
  "typescript": "5.9.3",
51
- "vue": "3.5.26",
52
- "@sit-onyx/icons": "^1.4.0",
51
+ "vue": "3.5.27",
52
+ "@sit-onyx/icons": "^1.6.0-dev-20260211170858",
53
53
  "@sit-onyx/nuxt": "^1.0.1",
54
54
  "@sit-onyx/shared": "^0.1.0",
55
- "sit-onyx": "^1.6.0"
55
+ "sit-onyx": "^1.8.0-dev-20260211170858"
56
56
  },
57
57
  "scripts": {
58
58
  "dev": "pnpm dev:prepare && nuxi dev playground",
@@ -1,31 +0,0 @@
1
- <script lang="ts" setup>
2
- import * as ALL_ICONS from "@sit-onyx/icons";
3
- import { getIconImportName } from "@sit-onyx/icons/utils";
4
-
5
- const props = defineProps<{
6
- /**
7
- * Icon name that should be resolved.
8
- */
9
- name: string;
10
- }>();
11
-
12
- const icon = ref<string>();
13
-
14
- watch(
15
- () => props.name,
16
- (iconName) => {
17
- icon.value = ALL_ICONS[getIconImportName(iconName) as keyof typeof ALL_ICONS];
18
-
19
- if (import.meta.dev && !icon.value) {
20
- // eslint-disable-next-line no-console -- used only during development environment
21
- console.warn(`Dynamic icon with name "${iconName}" not found.`);
22
- }
23
- },
24
- { immediate: true },
25
- );
26
- </script>
27
-
28
- <!-- eslint-disable-next-line vue/no-root-v-if -->
29
- <template>
30
- <OnyxIcon v-if="icon" :icon />
31
- </template>