|
1 | 1 | <script lang="ts"> |
2 | 2 | import { Table } from 'svelte-ux'; |
| 3 | + import type { Component } from 'content-collections'; |
3 | 4 |
|
4 | 5 | import { h2 as H2 } from '$lib/markdown/blueprints/default/blueprint.svelte'; |
5 | 6 | import { tableCell } from '@layerstack/svelte-table'; |
6 | 7 | import ExampleListing from '$lib/components/ExampleListing.svelte'; |
7 | 8 | import { page } from '$app/state'; |
8 | 9 |
|
9 | 10 | import RelatedLink from '$lib/components/RelatedLink.svelte'; |
| 11 | + import type { PropertyInfo } from '$lib/api-types.js'; |
10 | 12 |
|
11 | 13 | let { data } = $props(); |
12 | | - const { PageComponent, metadata, api, catalog } = $derived(data); |
| 14 | + const { PageComponent, catalog } = $derived(data); |
| 15 | + const metadata = $derived(data.metadata as Component); |
| 16 | + const api = $derived(metadata.api); |
13 | 17 | </script> |
14 | 18 |
|
15 | 19 | <!-- Markdown page --> |
|
39 | 43 | }} |
40 | 44 | > |
41 | 45 | <tbody slot="data" let:columns let:data let:getCellValue let:getCellContent> |
42 | | - {#each data ?? [] as rowData, rowIndex} |
| 46 | + {#each (data ?? []) as rowData, rowIndex (rowIndex)} |
| 47 | + {@const row = rowData as PropertyInfo} |
43 | 48 | <tr class="hover:bg-surface-content/5 border-b"> |
44 | 49 | {#each columns as column (column.name)} |
45 | 50 | {@const value = getCellValue(column, rowData, rowIndex)} |
|
50 | 55 | <span class="text-xs font-pixel bg-surface-content/10 px-2 py-1 rounded border" |
51 | 56 | >{value}</span |
52 | 57 | > |
53 | | - {#if rowData.required} |
| 58 | + {#if row.required} |
54 | 59 | <span |
55 | 60 | class="bg-danger/10 px-1 py-0.5 font-medium rounded border border-danger text-danger text-xs" |
56 | 61 | >required</span |
|
60 | 65 | {:else if column.name === 'type'} |
61 | 66 | <span class="font-pixel text-xs text-surface-content/70">{value}</span> |
62 | 67 | {:else if column.name === 'description'} |
63 | | - <span class="whitespace-pre-line">{value}</span> |
64 | | - {#if rowData.default != null} |
| 68 | + {#if row.descriptionHtml} |
| 69 | + <span class="prose-inline">{@html row.descriptionHtml}</span> |
| 70 | + {:else} |
| 71 | + <span class="whitespace-pre-line">{value}</span> |
| 72 | + {/if} |
| 73 | + {#if row.default != null} |
65 | 74 | <div class="mt-2 text-surface-content/70"> |
66 | | - default: <span class="font-pixel">{rowData.default}</span> |
| 75 | + default: <span class="font-pixel">{row.default}</span> |
67 | 76 | </div> |
68 | 77 | {/if} |
69 | 78 | {:else} |
|
0 commit comments