@sit-onyx/nuxt-docs 1.0.0-beta.2 → 1.0.0-beta.20

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.
@@ -7,8 +7,7 @@ const props = defineProps<NavItem>();
7
7
  * Same as `props` but without the `children` property to prevent console warnings when using `v-bind`.
8
8
  */
9
9
  const navItemProps = computed(() => {
10
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
11
- const { children, ...rest } = props;
10
+ const { children: _, ...rest } = props;
12
11
  return rest;
13
12
  });
14
13
  </script>
@@ -0,0 +1,48 @@
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/nuxt.config.ts CHANGED
@@ -3,13 +3,7 @@ export default defineNuxtConfig({
3
3
  devtools: { enabled: true },
4
4
  compatibilityDate: "2025-01-20",
5
5
  typescript: { typeCheck: "build" },
6
- modules: [
7
- "@sit-onyx/nuxt",
8
- "@nuxt/content",
9
- "@nuxtjs/color-mode",
10
- "@nuxt/image",
11
- "@nuxt/test-utils/module",
12
- ],
6
+ modules: ["@sit-onyx/nuxt", "@nuxt/content", "@nuxtjs/color-mode", "@nuxt/image"],
13
7
  css: ["@fontsource-variable/source-code-pro", "@fontsource-variable/source-sans-3"],
14
8
  colorMode: {
15
9
  classSuffix: "",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sit-onyx/nuxt-docs",
3
3
  "type": "module",
4
- "version": "1.0.0-beta.2",
4
+ "version": "1.0.0-beta.20",
5
5
  "description": "Nuxt layer/template for creating documentations with the onyx design system",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -19,7 +19,6 @@
19
19
  "layouts",
20
20
  "pages",
21
21
  "*.ts",
22
- "!playwright.config.ts",
23
22
  "*.vue",
24
23
  "*.json"
25
24
  ],
@@ -30,9 +29,9 @@
30
29
  "@nuxt/image": ">= 1",
31
30
  "@nuxtjs/color-mode": ">= 3",
32
31
  "sass-embedded": ">= 1",
33
- "@sit-onyx/icons": "^1.0.0-beta.14",
34
- "@sit-onyx/nuxt": "^1.0.0-beta.192",
35
- "sit-onyx": "^1.0.0-beta.190"
32
+ "@sit-onyx/icons": "^1.0.0-beta.16",
33
+ "@sit-onyx/nuxt": "^1.0.0-beta.209",
34
+ "sit-onyx": "^1.0.0-beta.207"
36
35
  },
37
36
  "devDependencies": {
38
37
  "@fontsource-variable/source-code-pro": ">= 5",
@@ -45,17 +44,17 @@
45
44
  "sass-embedded": "1.86.3",
46
45
  "typescript": "5.8.3",
47
46
  "vue": "3.5.13",
48
- "@sit-onyx/icons": "^1.0.0-beta.14",
49
- "sit-onyx": "^1.0.0-beta.190",
47
+ "@sit-onyx/icons": "^1.0.0-beta.16",
48
+ "@sit-onyx/nuxt": "^1.0.0-beta.209",
50
49
  "@sit-onyx/shared": "^1.0.0-beta.2",
51
- "@sit-onyx/nuxt": "^1.0.0-beta.192"
50
+ "sit-onyx": "^1.0.0-beta.207"
52
51
  },
53
52
  "scripts": {
54
- "dev": "nuxi dev .playground",
55
- "dev:prepare": "nuxt prepare .playground",
56
- "build": "nuxt build .playground",
57
- "generate": "nuxt generate .playground",
58
- "preview": "nuxt preview .playground",
59
- "test:playwright": "pnpm dev:prepare && playwright install && playwright test"
53
+ "dev": "nuxi dev playground",
54
+ "dev:prepare": "nuxt prepare playground",
55
+ "build": "nuxt build playground",
56
+ "generate": "nuxt generate playground",
57
+ "preview": "nuxt preview playground",
58
+ "test:playwright": "pnpm dev:prepare && (cd playground && pnpm test:playwright)"
60
59
  }
61
60
  }
package/tsconfig.json CHANGED
@@ -1,3 +1,3 @@
1
1
  {
2
- "extends": "./.playground/.nuxt/tsconfig.json"
2
+ "extends": "./playground/.nuxt/tsconfig.json"
3
3
  }