@sit-onyx/nuxt-docs 1.0.0-beta.91 → 1.0.0-beta.92

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sit-onyx/nuxt-docs",
3
- "version": "1.0.0-beta.91",
3
+ "version": "1.0.0-beta.92",
4
4
  "description": "Nuxt layer/template for creating documentations with the onyx design system",
5
5
  "type": "module",
6
6
  "author": "Schwarz IT KG",
@@ -35,8 +35,8 @@
35
35
  "@nuxtjs/color-mode": ">= 3",
36
36
  "sass-embedded": ">= 1",
37
37
  "@sit-onyx/icons": "^1.0.0-beta.21",
38
- "@sit-onyx/nuxt": "^1.0.0-beta.279",
39
- "sit-onyx": "^1.0.0-beta.278"
38
+ "@sit-onyx/nuxt": "^1.0.0-beta.280",
39
+ "sit-onyx": "^1.0.0-beta.279"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@fontsource-variable/source-code-pro": ">= 5",
@@ -47,14 +47,14 @@
47
47
  "@nuxtjs/color-mode": ">= 3",
48
48
  "@playwright/experimental-ct-vue": "1.54.1",
49
49
  "@playwright/test": "1.54.1",
50
- "nuxt": "^3.17.7",
50
+ "nuxt": "^4.0.1",
51
51
  "sass-embedded": "1.89.2",
52
52
  "typescript": "5.8.3",
53
53
  "vue": "3.5.18",
54
54
  "@sit-onyx/icons": "^1.0.0-beta.21",
55
- "@sit-onyx/nuxt": "^1.0.0-beta.279",
55
+ "@sit-onyx/nuxt": "^1.0.0-beta.280",
56
56
  "@sit-onyx/shared": "^1.0.0-beta.4",
57
- "sit-onyx": "^1.0.0-beta.278"
57
+ "sit-onyx": "^1.0.0-beta.279"
58
58
  },
59
59
  "scripts": {
60
60
  "dev": "pnpm dev:prepare && nuxi dev playground",
package/app.config.ts DELETED
@@ -1,32 +0,0 @@
1
- import type { OnyxNavBarProps, OnyxNavItemProps } from "sit-onyx";
2
-
3
- // TYPES
4
- declare module "@nuxt/schema" {
5
- interface AppConfigInput {
6
- onyxDocs?: OnyxAppConfig;
7
- }
8
-
9
- interface AppConfig {
10
- onyxDocs: OnyxAppConfig & typeof defaultAppConfig;
11
- }
12
- }
13
-
14
- export type OnyxAppConfig = {
15
- nav?: Partial<OnyxNavBarProps> & {
16
- items?: NavItem[];
17
- };
18
- };
19
-
20
- export type NavItem = OnyxNavItemProps & { children?: NavItem[] };
21
-
22
- // CONFIG
23
- const defaultAppConfig = {
24
- nav: {
25
- appName: "Documentation",
26
- withBackButton: true,
27
- },
28
- } satisfies OnyxAppConfig;
29
-
30
- export default defineAppConfig({
31
- onyxDocs: defaultAppConfig,
32
- });
package/app.vue DELETED
@@ -1,17 +0,0 @@
1
- <template>
2
- <OnyxAppLayout class="onyx-grid-max-md onyx-grid-center">
3
- <template #navBar>
4
- <NavBar />
5
- </template>
6
-
7
- <NuxtRouteAnnouncer />
8
-
9
- <NuxtLayout>
10
- <slot>
11
- <NuxtPage />
12
- </slot>
13
- </NuxtLayout>
14
-
15
- <OnyxToast />
16
- </OnyxAppLayout>
17
- </template>
@@ -1,44 +0,0 @@
1
- <script setup lang="ts">
2
- import circleContrast from "@sit-onyx/icons/circle-contrast.svg?raw";
3
- import { extractLinkProps, type ColorSchemeValue } from "sit-onyx";
4
-
5
- const { onyxDocs } = useAppConfig();
6
- const router = useRouter();
7
- const colorMode = useColorMode();
8
-
9
- const isColorSchemeDialogOpen = ref(false);
10
-
11
- const colorScheme = computed({
12
- get: () => {
13
- return colorMode.preference === "system" ? "auto" : (colorMode.preference as ColorSchemeValue);
14
- },
15
- set: (newValue) => {
16
- colorMode.preference = newValue === "auto" ? "system" : newValue;
17
- },
18
- });
19
- </script>
20
-
21
- <template>
22
- <OnyxNavBar v-bind="onyxDocs.nav" @navigate-back="router.back">
23
- <NavItem
24
- v-for="item in onyxDocs.nav?.items"
25
- :key="extractLinkProps(item.link ?? '').href"
26
- v-bind="item"
27
- />
28
-
29
- <template #contextArea>
30
- <OnyxIconButton
31
- label="Toggle color scheme"
32
- :icon="circleContrast"
33
- color="neutral"
34
- @click="isColorSchemeDialogOpen = true"
35
- />
36
- </template>
37
-
38
- <OnyxColorSchemeDialog
39
- v-model="colorScheme"
40
- :open="isColorSchemeDialogOpen"
41
- @close="isColorSchemeDialogOpen = false"
42
- />
43
- </OnyxNavBar>
44
- </template>
@@ -1,21 +0,0 @@
1
- <script lang="ts" setup>
2
- import type { NavItem } from "../app.config";
3
-
4
- const props = defineProps<NavItem>();
5
-
6
- /**
7
- * Same as `props` but without the `children` property to prevent console warnings when using `v-bind`.
8
- */
9
- const navItemProps = computed(() => {
10
- const { children: _, ...rest } = props;
11
- return rest;
12
- });
13
- </script>
14
-
15
- <template>
16
- <OnyxNavItem v-bind="navItemProps">
17
- <template v-if="props.children?.length" #children>
18
- <NavItem v-for="child in props.children" :key="child.label" v-bind="child" />
19
- </template>
20
- </OnyxNavItem>
21
- </template>
@@ -1,27 +0,0 @@
1
- <script lang="ts" setup>
2
- import type { LinkTarget } from "sit-onyx";
3
-
4
- const props = withDefaults(
5
- defineProps<{
6
- href?: string;
7
- target?: LinkTarget;
8
- }>(),
9
- {
10
- href: "",
11
- },
12
- );
13
-
14
- defineSlots<{
15
- default(): unknown;
16
- }>();
17
-
18
- // needed to show external link icon only on mounted to prevent hydration errors
19
- const isMounted = ref(false);
20
- onMounted(() => (isMounted.value = true));
21
- </script>
22
-
23
- <template>
24
- <OnyxLink v-bind="props" :with-external-icon="isMounted ? 'auto' : false">
25
- <slot></slot>
26
- </OnyxLink>
27
- </template>
@@ -1,15 +0,0 @@
1
- <script lang="ts" setup>
2
- const props = defineProps<{
3
- id?: string;
4
- }>();
5
-
6
- defineSlots<{
7
- default(): unknown;
8
- }>();
9
- </script>
10
-
11
- <template>
12
- <OnyxHeadline is="h1" :hash="props.id">
13
- <slot />
14
- </OnyxHeadline>
15
- </template>
@@ -1,15 +0,0 @@
1
- <script lang="ts" setup>
2
- const props = defineProps<{
3
- id?: string;
4
- }>();
5
-
6
- defineSlots<{
7
- default(): unknown;
8
- }>();
9
- </script>
10
-
11
- <template>
12
- <OnyxHeadline is="h2" :hash="props.id">
13
- <slot />
14
- </OnyxHeadline>
15
- </template>
@@ -1,15 +0,0 @@
1
- <script lang="ts" setup>
2
- const props = defineProps<{
3
- id?: string;
4
- }>();
5
-
6
- defineSlots<{
7
- default(): unknown;
8
- }>();
9
- </script>
10
-
11
- <template>
12
- <OnyxHeadline is="h3" :hash="props.id">
13
- <slot />
14
- </OnyxHeadline>
15
- </template>
@@ -1,15 +0,0 @@
1
- <script lang="ts" setup>
2
- const props = defineProps<{
3
- id?: string;
4
- }>();
5
-
6
- defineSlots<{
7
- default(): unknown;
8
- }>();
9
- </script>
10
-
11
- <template>
12
- <OnyxHeadline is="h4" :hash="props.id">
13
- <slot />
14
- </OnyxHeadline>
15
- </template>
@@ -1,15 +0,0 @@
1
- <script lang="ts" setup>
2
- const props = defineProps<{
3
- id?: string;
4
- }>();
5
-
6
- defineSlots<{
7
- default(): unknown;
8
- }>();
9
- </script>
10
-
11
- <template>
12
- <OnyxHeadline is="h5" :hash="props.id">
13
- <slot />
14
- </OnyxHeadline>
15
- </template>
@@ -1,15 +0,0 @@
1
- <script lang="ts" setup>
2
- const props = defineProps<{
3
- id?: string;
4
- }>();
5
-
6
- defineSlots<{
7
- default(): unknown;
8
- }>();
9
- </script>
10
-
11
- <template>
12
- <OnyxHeadline is="h6" :hash="props.id">
13
- <slot />
14
- </OnyxHeadline>
15
- </template>
@@ -1,16 +0,0 @@
1
- <script lang="ts" setup>
2
- const props = withDefaults(
3
- defineProps<{
4
- src?: string;
5
- alt?: string;
6
- }>(),
7
- {
8
- src: "",
9
- alt: "",
10
- },
11
- );
12
- </script>
13
-
14
- <template>
15
- <NuxtImg :src="props.src" :alt="props.alt" :format="src?.endsWith('.svg') ? undefined : 'webp'" />
16
- </template>
@@ -1,48 +0,0 @@
1
- <script lang="ts" setup>
2
- import type { VNode } from "vue";
3
-
4
- const slots = defineSlots<{
5
- default(): VNode[];
6
- }>();
7
-
8
- /**
9
- * Extracts the table head and body as vnodes from the slot content.
10
- */
11
- const extractSlotContent = () => {
12
- const [head, body] = slots.default();
13
-
14
- return {
15
- headRows: extractTableRows(head),
16
- bodyRows: extractTableRows(body),
17
- };
18
- };
19
-
20
- /**
21
- * Extracts all table rows `<tr>` vnodes from the given vnode (e.g. table head or body).
22
- */
23
- const extractTableRows = (vnode?: VNode): VNode[] => {
24
- if (
25
- !vnode?.children ||
26
- typeof vnode.children !== "object" ||
27
- !("default" in vnode.children) ||
28
- typeof vnode.children.default !== "function"
29
- ) {
30
- return [];
31
- }
32
-
33
- return vnode.children.default();
34
- };
35
-
36
- const content = shallowRef(extractSlotContent());
37
- onBeforeUpdate(() => (content.value = extractSlotContent())); // update content when component is updated
38
- </script>
39
-
40
- <template>
41
- <OnyxTable striped with-vertical-borders>
42
- <template #head>
43
- <component :is="tr" v-for="tr in content.headRows" :key="tr.key" />
44
- </template>
45
-
46
- <component :is="tr" v-for="tr in content.bodyRows" :key="tr.key" />
47
- </OnyxTable>
48
- </template>
package/error.vue DELETED
@@ -1,57 +0,0 @@
1
- <script setup lang="ts">
2
- import type { NuxtError } from "#app";
3
- import App from "./app.vue";
4
-
5
- const props = defineProps<{
6
- error: NuxtError;
7
- }>();
8
-
9
- const handleError = () => clearError({ redirect: "/" });
10
- </script>
11
-
12
- <template>
13
- <App>
14
- <div class="error">
15
- <OnyxErrorSVG class="error__image" />
16
-
17
- <div class="error__headline">
18
- <OnyxHeadline is="h1">{{ props.error.message }}</OnyxHeadline>
19
- <OnyxButton label="Back to home" @click="handleError" />
20
- </div>
21
-
22
- <OnyxAccordion>
23
- <OnyxAccordionItem value="details">
24
- <template #header>Technical error details</template>
25
- <pre class="error__details">{{ props.error }}</pre>
26
- </OnyxAccordionItem>
27
- </OnyxAccordion>
28
- </div>
29
- </App>
30
- </template>
31
-
32
- <style lang="scss" scoped>
33
- .error {
34
- display: flex;
35
- flex-direction: column;
36
- align-items: center;
37
- gap: var(--onyx-density-3xl);
38
-
39
- &__image {
40
- width: 32rem;
41
- display: block;
42
- }
43
-
44
- &__headline {
45
- display: flex;
46
- flex-direction: column;
47
- align-items: center;
48
- gap: var(--onyx-density-md);
49
- }
50
-
51
- &__details {
52
- white-space: pre-wrap;
53
- overflow-wrap: anywhere;
54
- font-family: var(--onyx-font-family-mono);
55
- }
56
- }
57
- </style>
@@ -1,5 +0,0 @@
1
- <template>
2
- <OnyxPageLayout>
3
- <slot />
4
- </OnyxPageLayout>
5
- </template>
@@ -1,19 +0,0 @@
1
- <script setup lang="ts">
2
- const route = useRoute();
3
- const collection = await useAsyncData(() => queryCollection("content").path(route.path).first());
4
-
5
- if (!collection.data.value) {
6
- throw createError({
7
- message: "Page not found",
8
- statusCode: 404,
9
- });
10
- }
11
-
12
- const data = toRef(() => collection.data.value!);
13
- useSeoMeta({ ...data.value.seo });
14
- </script>
15
-
16
- <!-- eslint-disable-next-line vue/no-root-v-if -- the v-if here is theoretically not needed because we throw above it ifs undefined so the user will be redirected to the error page. However, there is still a console warning so we include the v-if here to prevent it. -->
17
- <template>
18
- <ContentRenderer v-if="data" :value="data" />
19
- </template>