@unframed/mcp 1.0.0-rc.4 → 1.0.0-rc.5
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/data.json +2 -2
- package/package.json +1 -1
package/data.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.0.0-rc.
|
|
2
|
+
"version": "1.0.0-rc.5",
|
|
3
3
|
"components": [
|
|
4
4
|
{
|
|
5
5
|
"name": "accordion",
|
|
@@ -408,7 +408,7 @@
|
|
|
408
408
|
"imports": [
|
|
409
409
|
"@unframed/core/table"
|
|
410
410
|
],
|
|
411
|
-
"docs": "# Table\n\nA table of data, from `columns` and `rows`. Users can sort by the columns\nmarked `sortable`. Rendered as a native `<table>`, so assistive tech reads\nheaders and cells as usual.\n\nSet `columns` and `rows` as properties, or as JSON attributes in plain HTML.\nThe table sorts `rows` itself; with `manual-sort` it only shows the order\nand tells you, so you can sort on the server. Combine it with\n`<uf-pagination>` for long lists.\n\nTags: `<uf-table>`. Import: `import '@unframed/core/table';` (or `npx @unframed/cli add table` to copy the source).\n\n## Columns, rows and sorting\n\nDescribe the columns and pass the rows. Columns marked `sortable` sort on click.\n\n```html\n<uf-table\n label=\"Team\"\n columns='[{\"key\": \"name\", \"label\": \"Name\", \"sortable\": true},\n {\"key\": \"role\", \"label\": \"Role\"},\n {\"key\": \"commits\", \"label\": \"Commits\", \"sortable\": true, \"align\": \"end\"}]'\n rows='[{\"name\": \"John Smith\", \"role\": \"Product designer\", \"commits\": 412},\n {\"name\": \"Jane Doe\", \"role\": \"Engineer\", \"commits\": 1290}]'\n></uf-table>\n```\n\n- In plain HTML, `columns` and `rows` can be JSON attributes. From JavaScript, set them as properties.\n- Give the table a `label`: it names the table for screen readers.\n\n## Formatting, and pages\n\n`format` turns a value into text or a DOM node, like a badge. Sorting still uses the raw values.\n\n```html\n<uf-table id=\"invoices\" label=\"Invoices\" row-key=\"id\"></uf-table>\n<uf-pagination id=\"pages\" label=\"Invoice pages\"></uf-pagination>\n\n<script type=\"module\">\n const table = document.querySelector('#invoices');\n const pages = document.querySelector('#pages');\n const pageSize = 8;\n\n table.columns = [\n { key: 'customer', label: 'Customer', sortable: true },\n { key: 'amount', label: 'Amount', sortable: true, align: 'end',\n format: (value) => euro.format(value) },\n ];\n pages.pages = Math.ceil(invoices.length / pageSize);\n\n const show = (page) => (table.rows = invoices.slice((page - 1) * pageSize, page * pageSize));\n pages.addEventListener('uf-page-change', (event) => show(event.detail.page));\n show(1);\n</script>\n```\n\n- To sort on the server, add `manual-sort`: the table shows the sort and fires `uf-sort`, and you load the rows in that order.\n- Set `--uf-table-max-height` to scroll long tables under a sticky header.\n\n## `<uf-table>` API\n\n### Attributes and properties\n\n| Attribute | Property | Type | Default | Description |\n|---|---|---|---|---|\n| `columns` | | `TableColumn[]` | `[]` | The columns, in order. As an attribute, JSON: `[{\"key\": \"name\", \"label\": \"Name\"}]`. |\n| `rows` | | `TableRow[]` | `[]` | The data, one object per row. As an attribute, JSON: `[{\"name\": \"John\"}]`. |\n| `label` | | `string \\| undefined` | | Accessible name of the table, e.g. \"Invoices\". |\n| `sort-key` | `sortKey` | `string \\| undefined` | | Key of the column the rows are sorted by. |\n| `sort-direction` | `sortDirection` | `SortDirection` | `'ascending'` | Sort order: `ascending` or `descending`. |\n| `manual-sort` | `manualSort` | `boolean` | `false` | Doesn't sort the rows: only shows the sort and fires `uf-sort`, for sorting on the server. |\n| `row-key` | `rowKey` | `string \\| undefined` | | Row property that identifies each row, so rows keep their DOM when the data changes. Defaults to the index. |\n| `striped` | | `boolean` | `false` | Shades every other row. |\n| `density` | | `TableDensity` | `'comfortable'` | Row spacing: `comfortable` or `compact`. |\n\n### Events\n\n| Event | Type | Description |\n|---|---|---|\n| `uf-sort` | `CustomEvent<TableSortDetail>` | The user sorted by a column. |\n\n### Slots\n\n| Slot | Description |\n|---|---|\n| `empty` | Shown when there are no rows. Defaults to \"No data\", or its translation. |\n\n### CSS parts\n\n| Part | Description |\n|---|---|\n| `base` | The scroll container around the table. |\n| `table` | The `<table>`. |\n| `header-cell` | Every header cell (`<th>`). |\n| `sort-button` | The button in a sortable header. |\n| `row` | Every body row. |\n| `cell` | Every body cell. |\n| `empty` | The cell shown when there are no rows. |\n\n### CSS custom properties\n\n| Property | Description |\n|---|---|\n| `--uf-table-max-height` | Height after which the body scrolls under a sticky header. |\n| `--uf-table-border-color` | Border color between rows. |\n| `--uf-table-header-bg` | Background of the header row. |\n| `--uf-table-stripe-bg` | Background of every other row, with `striped`. |\n| `--uf-table-hover-bg` | Background of the row under the pointer. |\n"
|
|
411
|
+
"docs": "# Table\n\nA table of data, from `columns` and `rows`. Users can sort by the columns\nmarked `sortable`. Rendered as a native `<table>`, so assistive tech reads\nheaders and cells as usual.\n\nSet `columns` and `rows` as properties, or as JSON attributes in plain HTML.\nThe table sorts `rows` itself; with `manual-sort` it only shows the order\nand tells you, so you can sort on the server. Combine it with\n`<uf-pagination>` for long lists.\n\nTags: `<uf-table>`. Import: `import '@unframed/core/table';` (or `npx @unframed/cli add table` to copy the source).\n\n## Columns, rows and sorting\n\nDescribe the columns and pass the rows. Columns marked `sortable` sort on click.\n\n```html\n<uf-table\n label=\"Team\"\n columns='[{\"key\": \"name\", \"label\": \"Name\", \"sortable\": true},\n {\"key\": \"role\", \"label\": \"Role\"},\n {\"key\": \"commits\", \"label\": \"Commits\", \"sortable\": true, \"align\": \"end\"}]'\n rows='[{\"name\": \"John Smith\", \"role\": \"Product designer\", \"commits\": 412},\n {\"name\": \"Jane Doe\", \"role\": \"Engineer\", \"commits\": 1290}]'\n></uf-table>\n```\n\n- In plain HTML, `columns` and `rows` can be JSON attributes. From JavaScript, set them as properties.\n- Give the table a `label`: it names the table for screen readers.\n\n## Formatting, and pages\n\n`format` turns a value into text or a DOM node, like a badge. Sorting still uses the raw values.\n\n```html\n<uf-table id=\"invoices\" label=\"Invoices\" row-key=\"id\"></uf-table>\n<uf-pagination id=\"pages\" label=\"Invoice pages\"></uf-pagination>\n\n<script type=\"module\">\n const table = document.querySelector('#invoices');\n const pages = document.querySelector('#pages');\n const pageSize = 8;\n\n table.columns = [\n { key: 'customer', label: 'Customer', sortable: true },\n { key: 'amount', label: 'Amount', sortable: true, align: 'end',\n format: (value) => euro.format(value) },\n ];\n pages.pages = Math.ceil(invoices.length / pageSize);\n\n const show = (page) => (table.rows = invoices.slice((page - 1) * pageSize, page * pageSize));\n pages.addEventListener('uf-page-change', (event) => show(event.detail.page));\n show(1);\n</script>\n```\n\n- In TypeScript, give the columns your row type: `const columns: TableColumn<Invoice>[] = [...]`, with `TableColumn` from `@unframed/core`. Rows can be any interface. Without the annotation, a separate `const columns = [...]` widens `align` to `string`, which `columns` rejects.\n- To sort on the server, add `manual-sort`: the table shows the sort and fires `uf-sort`, and you load the rows in that order.\n- Set `--uf-table-max-height` to scroll long tables under a sticky header.\n\n## `<uf-table>` API\n\n### Attributes and properties\n\n| Attribute | Property | Type | Default | Description |\n|---|---|---|---|---|\n| `columns` | | `TableColumn[]` | `[]` | The columns, in order. As an attribute, JSON: `[{\"key\": \"name\", \"label\": \"Name\"}]`. |\n| `rows` | | `TableRow[]` | `[]` | The data, one object per row. As an attribute, JSON: `[{\"name\": \"John\"}]`. |\n| `label` | | `string \\| undefined` | | Accessible name of the table, e.g. \"Invoices\". |\n| `sort-key` | `sortKey` | `string \\| undefined` | | Key of the column the rows are sorted by. |\n| `sort-direction` | `sortDirection` | `SortDirection` | `'ascending'` | Sort order: `ascending` or `descending`. |\n| `manual-sort` | `manualSort` | `boolean` | `false` | Doesn't sort the rows: only shows the sort and fires `uf-sort`, for sorting on the server. |\n| `row-key` | `rowKey` | `string \\| undefined` | | Row property that identifies each row, so rows keep their DOM when the data changes. Defaults to the index. |\n| `striped` | | `boolean` | `false` | Shades every other row. |\n| `density` | | `TableDensity` | `'comfortable'` | Row spacing: `comfortable` or `compact`. |\n\n### Events\n\n| Event | Type | Description |\n|---|---|---|\n| `uf-sort` | `CustomEvent<TableSortDetail>` | The user sorted by a column. |\n\n### Slots\n\n| Slot | Description |\n|---|---|\n| `empty` | Shown when there are no rows. Defaults to \"No data\", or its translation. |\n\n### CSS parts\n\n| Part | Description |\n|---|---|\n| `base` | The scroll container around the table. |\n| `table` | The `<table>`. |\n| `header-cell` | Every header cell (`<th>`). |\n| `sort-button` | The button in a sortable header. |\n| `row` | Every body row. |\n| `cell` | Every body cell. |\n| `empty` | The cell shown when there are no rows. |\n\n### CSS custom properties\n\n| Property | Description |\n|---|---|\n| `--uf-table-max-height` | Height after which the body scrolls under a sticky header. |\n| `--uf-table-border-color` | Border color between rows. |\n| `--uf-table-header-bg` | Background of the header row. |\n| `--uf-table-stripe-bg` | Background of every other row, with `striped`. |\n| `--uf-table-hover-bg` | Background of the row under the pointer. |\n"
|
|
412
412
|
},
|
|
413
413
|
{
|
|
414
414
|
"name": "tabs",
|
package/package.json
CHANGED