@sit-onyx/nuxt-docs 1.0.0-beta.5 → 1.0.0-beta.7

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,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/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.5",
4
+ "version": "1.0.0-beta.7",
5
5
  "description": "Nuxt layer/template for creating documentations with the onyx design system",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -29,9 +29,9 @@
29
29
  "@nuxt/image": ">= 1",
30
30
  "@nuxtjs/color-mode": ">= 3",
31
31
  "sass-embedded": ">= 1",
32
- "@sit-onyx/icons": "^1.0.0-beta.14",
33
- "@sit-onyx/nuxt": "^1.0.0-beta.194",
34
- "sit-onyx": "^1.0.0-beta.192"
32
+ "@sit-onyx/icons": "^1.0.0-beta.15",
33
+ "@sit-onyx/nuxt": "^1.0.0-beta.196",
34
+ "sit-onyx": "^1.0.0-beta.194"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@fontsource-variable/source-code-pro": ">= 5",
@@ -44,17 +44,17 @@
44
44
  "sass-embedded": "1.86.3",
45
45
  "typescript": "5.8.3",
46
46
  "vue": "3.5.13",
47
- "@sit-onyx/icons": "^1.0.0-beta.14",
48
- "@sit-onyx/nuxt": "^1.0.0-beta.194",
47
+ "@sit-onyx/icons": "^1.0.0-beta.15",
48
+ "@sit-onyx/nuxt": "^1.0.0-beta.196",
49
49
  "@sit-onyx/shared": "^1.0.0-beta.2",
50
- "sit-onyx": "^1.0.0-beta.192"
50
+ "sit-onyx": "^1.0.0-beta.194"
51
51
  },
52
52
  "scripts": {
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"
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)"
59
59
  }
60
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
  }