@threadlabs/looma 0.14.0 → 0.14.1

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": "@threadlabs/looma",
3
- "version": "0.14.0",
3
+ "version": "0.14.1",
4
4
  "type": "module",
5
5
  "description": "Looma components as HTML, Vue, and plain DOM, with design tokens.",
6
6
  "license": "MIT",
@@ -3,24 +3,63 @@
3
3
  /* Named values: a term and what it is, for each item (ui-description-item). */
4
4
  /* Rows line every term up in one column and every value in the next, through subgrid. */
5
5
  :scope {
6
+ --_gap: var(--ui-space-2);
7
+ --_gap-compact: var(--ui-space-1);
8
+ --_column-gap: var(--ui-space-6);
9
+ --_min: 10rem;
10
+ --_track: var(--_min);
11
+ --_tile-padding: var(--ui-space-3);
6
12
  display: grid;
7
13
  grid-template-columns: minmax(6rem, max-content) minmax(0, 1fr);
8
- gap: var(--ui-space-2) var(--ui-space-6);
14
+ gap: var(--_gap) var(--_column-gap);
9
15
  min-inline-size: 0;
10
16
  margin: 0;
11
17
  }
12
18
 
13
- /* Tiles pass their shape to the items through private properties, which cross into each item. */
19
+ /* Stacked, grid, and tiles set each term above its value, passing the shape to the items through
20
+ private properties, which cross into each item. */
21
+ :scope[data-ui-description-list-state~="layout=stacked"],
22
+ :scope[data-ui-description-list-state~="layout=grid"],
14
23
  :scope[data-ui-description-list-state~="layout=tiles"] {
15
24
  --_ui-description-display: flex;
16
25
  --_ui-description-column: auto;
26
+ --_ui-description-align: stretch;
27
+ --_gap: var(--ui-space-4);
28
+ --_gap-compact: var(--ui-space-2);
29
+ grid-template-columns: minmax(0, 1fr);
30
+ }
31
+
32
+ /* A column is at least --_min wide; with columns set, at least its share of the width, so no more
33
+ than that many fit. */
34
+ :scope[data-ui-description-list-state~="layout=grid"],
35
+ :scope[data-ui-description-list-state~="layout=tiles"] {
36
+ grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--_track)), 1fr));
37
+ }
38
+
39
+ :scope[data-ui-description-list-state~="layout=tiles"] {
17
40
  --_ui-description-align: flex-start;
18
41
  --_ui-description-value-size: var(--ui-font-size-lg);
19
- --_ui-description-padding: var(--ui-space-3);
42
+ --_ui-description-padding: var(--_tile-padding);
20
43
  --_ui-description-border-width: 1px;
21
- display: grid;
22
- grid-template-columns: repeat(auto-fill, minmax(min(100%, 10rem), 1fr));
23
- gap: var(--ui-space-3);
44
+ --_gap: var(--ui-space-3);
45
+ --_gap-compact: var(--ui-space-2);
46
+ --_column-gap: var(--_gap);
47
+ }
48
+
49
+ :scope[data-ui-description-list-state~="columns=2"] {
50
+ --_track: max(var(--_min), (100% - var(--_column-gap)) / 2);
51
+ }
52
+ :scope[data-ui-description-list-state~="columns=3"] {
53
+ --_track: max(var(--_min), (100% - 2 * var(--_column-gap)) / 3);
54
+ }
55
+ :scope[data-ui-description-list-state~="columns=4"] {
56
+ --_track: max(var(--_min), (100% - 3 * var(--_column-gap)) / 4);
57
+ }
58
+
59
+ /* Compact takes each layout's closer spacing. */
60
+ :scope[data-ui-description-list-state~="density=compact"] {
61
+ --_gap: var(--_gap-compact);
62
+ --_tile-padding: var(--ui-space-2);
24
63
  }
25
64
 
26
65
  /* A component that sets its display still honours the hidden attribute on its root. */
@@ -32,7 +71,13 @@
32
71
  /* Named values: a term and what it is, for each item (ui-description-item). */
33
72
  /* Rows line every term up in one column and every value in the next, through subgrid. */
34
73
 
35
- /* Tiles pass their shape to the items through private properties, which cross into each item. */
74
+ /* Stacked, grid, and tiles set each term above its value, passing the shape to the items through
75
+ private properties, which cross into each item. */
76
+
77
+ /* A column is at least --_min wide; with columns set, at least its share of the width, so no more
78
+ than that many fit. */
79
+
80
+ /* Compact takes each layout's closer spacing. */
36
81
 
37
82
  /* A component that sets its display still honours the hidden attribute on its root. */
38
83
  }
@@ -0,0 +1,134 @@
1
+ /* Generated by HTML Next 1.0.0-alpha.7. Do not edit. */
2
+ @scope ([data-component~="ui-table"]) to ([data-component], [data-slotted]) {
3
+ /* Styles an authored <table> (caption, thead, tbody, th scope) without replacing it: the table is
4
+ meaningful before JavaScript, and a screen reader reads it as a table. The root scrolls a table
5
+ wider than it, or taller than a bounded height; while it does, the controller makes the root a named, focusable region so a
6
+ keyboard can scroll it. A cell's data-ui-align (start, center, or end; start by default) sets its
7
+ content along the row, such as end for a column of figures. */
8
+ :scope {
9
+ --_pad-block: var(--ui-space-1);
10
+ --_pad-inline: var(--ui-space-3);
11
+ --_row-size: var(--ui-control-size);
12
+ display: block;
13
+ box-sizing: border-box;
14
+ max-inline-size: 100%;
15
+ min-inline-size: 0;
16
+ min-block-size: 0;
17
+ overflow: auto;
18
+ overscroll-behavior-inline: contain;
19
+ /* The sideways scroll fade every Looma scroller uses (see ui-scroll-area). Only the inline edges
20
+ fade, so a sticky header never fades. */
21
+ --_ui-scroll-fade-direction: to right;
22
+ --_ui-scroll-fade-size: var(--ui-scroll-fade-size, 24px);
23
+ mask-image: linear-gradient(
24
+ var(--_ui-scroll-fade-direction),
25
+ transparent,
26
+ #000 var(--_ui-scroll-fade-start),
27
+ #000 calc(100% - var(--_ui-scroll-fade-end)),
28
+ transparent
29
+ );
30
+ animation: ui-scroll-fade-start linear, ui-scroll-fade-start-hold linear, ui-scroll-fade-end-hold linear, ui-scroll-fade-end linear;
31
+ animation-timeline: scroll(self inline);
32
+ animation-range:
33
+ 0 var(--_ui-scroll-fade-size),
34
+ var(--_ui-scroll-fade-size) calc(100% + 1px),
35
+ -1px calc(100% - var(--_ui-scroll-fade-size)),
36
+ calc(100% - var(--_ui-scroll-fade-size)) 100%;
37
+ }
38
+
39
+ :scope:dir(rtl) {
40
+ --_ui-scroll-fade-direction: to left;
41
+ }
42
+
43
+ :scope:focus-visible {
44
+ outline: 2px solid var(--ui-focus-ring);
45
+ outline-offset: -2px;
46
+ }
47
+
48
+ :scope[data-ui-table-state~="density=compact"] {
49
+ --_pad-block: var(--ui-space-0-5);
50
+ --_pad-inline: var(--ui-space-2);
51
+ --_row-size: var(--ui-control-size-sm);
52
+ }
53
+
54
+ /* Separate borders stay on their cells when a sticky header scrolls; collapsed ones stay behind. */
55
+
56
+ /* Every row is at least one control tall, so a row holding a checkbox, select, or input keeps the
57
+ rhythm of the rows around it. A cell's height is its minimum. */
58
+
59
+ /* A component that sets its display still honours the hidden attribute on its root. */
60
+ :scope[hidden] {
61
+ display: none;
62
+ }
63
+ }
64
+ @scope ([data-component~="ui-table"]) to ([data-component]) {
65
+ /* Styles an authored <table> (caption, thead, tbody, th scope) without replacing it: the table is
66
+ meaningful before JavaScript, and a screen reader reads it as a table. The root scrolls a table
67
+ wider than it, or taller than a bounded height; while it does, the controller makes the root a named, focusable region so a
68
+ keyboard can scroll it. A cell's data-ui-align (start, center, or end; start by default) sets its
69
+ content along the row, such as end for a column of figures. */
70
+
71
+ /* Separate borders stay on their cells when a sticky header scrolls; collapsed ones stay behind. */
72
+ :where([data-slotted], [data-slotted] *):is(table) {
73
+ inline-size: 100%;
74
+ border-collapse: separate;
75
+ border-spacing: 0;
76
+ color: var(--ui-text-primary);
77
+ font-size: var(--ui-font-size-sm);
78
+ line-height: var(--ui-line-height);
79
+ font-variant-numeric: tabular-nums;
80
+ }
81
+
82
+ :where([data-slotted], [data-slotted] *):is(caption) {
83
+ padding-block-end: var(--ui-space-2);
84
+ color: var(--ui-text-secondary);
85
+ font-weight: var(--ui-font-medium);
86
+ text-align: start;
87
+ }
88
+
89
+ /* Every row is at least one control tall, so a row holding a checkbox, select, or input keeps the
90
+ rhythm of the rows around it. A cell's height is its minimum. */
91
+ :where([data-slotted], [data-slotted] *):is(th),
92
+ :where([data-slotted], [data-slotted] *):is(td) {
93
+ block-size: var(--_row-size);
94
+ padding: var(--_pad-block) var(--_pad-inline);
95
+ border-block-end: 1px solid var(--ui-border-subtle);
96
+ text-align: start;
97
+ vertical-align: middle;
98
+ }
99
+
100
+ :where([data-slotted], [data-slotted] *):is(thead th) {
101
+ block-size: auto;
102
+ padding-block: var(--ui-space-2);
103
+ border-block-end-color: var(--ui-border-default);
104
+ background: var(--ui-surface);
105
+ color: var(--ui-text-muted);
106
+ font-weight: var(--ui-font-medium);
107
+ white-space: nowrap;
108
+ vertical-align: bottom;
109
+ }
110
+
111
+ :where([data-slotted], [data-slotted] *):is(tbody th) {
112
+ font-weight: var(--ui-font-medium);
113
+ }
114
+
115
+ :where([data-slotted], [data-slotted] *):is(tbody tr:last-child > *) {
116
+ border-block-end-width: 0;
117
+ }
118
+
119
+ :where([data-slotted], [data-slotted] *):is([data-ui-align="center"]) {
120
+ text-align: center;
121
+ }
122
+
123
+ :where([data-slotted], [data-slotted] *):is([data-ui-align="end"]) {
124
+ text-align: end;
125
+ }
126
+
127
+ :scope[data-ui-table-state~="stickyHeader"] :where([data-slotted], [data-slotted] *):is(thead th) {
128
+ position: sticky;
129
+ inset-block-start: 0;
130
+ z-index: 1;
131
+ }
132
+
133
+ /* A component that sets its display still honours the hidden attribute on its root. */
134
+ }
@@ -6,7 +6,9 @@ export interface UiDescriptionListElement extends HTMLDListElement {
6
6
  removeEventListener<K extends keyof UiDescriptionListEventMap>(type: K, listener: (this: UiDescriptionListElement, event: UiDescriptionListEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
7
7
  }
8
8
  export interface UiDescriptionListProps {
9
- layout?: "rows" | "tiles" | null;
9
+ columns?: "2" | "3" | "4" | null;
10
+ density?: "comfortable" | "compact" | null;
11
+ layout?: "rows" | "stacked" | "grid" | "tiles" | null;
10
12
  attributes?: Readonly<Record<string, string | number | boolean | null | undefined>>;
11
13
  children?: readonly (string | Node)[];
12
14
  slots?: Readonly<Record<string, readonly (string | Node)[]>>;
@@ -5,7 +5,9 @@ import "../styles/ui-description-list.css";
5
5
  export function createUiDescriptionList(options = {}) {
6
6
  const { attributes = {}, children = [], slots = {}, ...componentProps } = options;
7
7
  const projected = [];
8
- const prop0 = componentProps["layout"] === undefined ? "rows" : componentProps["layout"];
8
+ const prop0 = componentProps["columns"] === undefined ? undefined : componentProps["columns"];
9
+ const prop1 = componentProps["density"] === undefined ? "comfortable" : componentProps["density"];
10
+ const prop2 = componentProps["layout"] === undefined ? "rows" : componentProps["layout"];
9
11
  const element = document.createElement("dl");
10
12
  for (const [name, value] of Object.entries(attributes)) {
11
13
  if (value === null || value === undefined || value === false) continue;
@@ -21,7 +23,9 @@ export function createUiDescriptionList(options = {}) {
21
23
  } else {
22
24
  }
23
25
  manageGeneratedProps(element, [
24
- { name: "layout", attribute: "data-layout", value: componentProps["layout"], default: "rows", type: ["rows","tiles"], required: false },
26
+ { name: "columns", attribute: "data-columns", value: componentProps["columns"], type: ["2","3","4"], required: false },
27
+ { name: "density", attribute: "data-density", value: componentProps["density"], default: "comfortable", type: ["comfortable","compact"], required: false },
28
+ { name: "layout", attribute: "data-layout", value: componentProps["layout"], default: "rows", type: ["rows","stacked","grid","tiles"], required: false },
25
29
  ]);
26
30
  return element;
27
31
  }
@@ -0,0 +1,15 @@
1
+ // Generated by HTML Next 1.0.0-alpha.7 for Vanilla DOM. Do not edit.
2
+ export interface UiTableEventMap {
3
+ }
4
+ export interface UiTableElement extends HTMLDivElement {
5
+ addEventListener<K extends keyof UiTableEventMap>(type: K, listener: (this: UiTableElement, event: UiTableEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
6
+ removeEventListener<K extends keyof UiTableEventMap>(type: K, listener: (this: UiTableElement, event: UiTableEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
7
+ }
8
+ export interface UiTableProps {
9
+ density?: "comfortable" | "compact" | null;
10
+ stickyHeader?: boolean | null;
11
+ attributes?: Readonly<Record<string, string | number | boolean | null | undefined>>;
12
+ children?: readonly (string | Node)[];
13
+ slots?: Readonly<Record<string, readonly (string | Node)[]>>;
14
+ }
15
+ export declare function createUiTable(props?: UiTableProps): UiTableElement;
@@ -0,0 +1,30 @@
1
+ // Generated by HTML Next 1.0.0-alpha.7 for Vanilla DOM. Do not edit.
2
+ import { manageComponentLifecycle } from "@nextwebwg/html-next/runtime";
3
+ import * as controller from "../components/ui-table/ui-table.js";
4
+ import "../styles/ui-table.css";
5
+
6
+ const definition = {...{"contract":{"tag":"ui-table","props":{"density":{"type":{"enum":["comfortable","compact"]},"required":false,"target":{"attribute":"density"},"default":"comfortable"},"stickyHeader":{"type":"boolean","required":false,"target":{"attribute":"stickyheader"},"default":false}}},"template":{"kind":"element","name":"div","attributes":[],"children":[{"kind":"slot"}]},"declarations":[],"root":{"kind":"native","element":"div","choices":["div"]}},source:{file:import.meta.url},css:""};
7
+
8
+ export function createUiTable(options = {}) {
9
+ const { attributes = {}, children = [], slots = {}, ...componentProps } = options;
10
+ const projected = [];
11
+ const element = document.createElement("div");
12
+ for (const [name, value] of Object.entries(attributes)) {
13
+ if (value === null || value === undefined || value === false) continue;
14
+ element.setAttribute(name, value === true ? "" : String(value));
15
+ }
16
+ element.setAttribute("data-component", "ui-table");
17
+ if (children.length > 0) {
18
+ for (const child of children) {
19
+ const node = typeof child === "string" ? document.createTextNode(child) : child;
20
+ projected.push([node, ""]);
21
+ element.append(node);
22
+ }
23
+ } else {
24
+ }
25
+ manageComponentLifecycle(element, definition, { props: componentProps, projected,
26
+ controller,
27
+ });
28
+ return element;
29
+ }
30
+
package/vanilla/index.js CHANGED
@@ -55,6 +55,7 @@ export * from "./UiStack.js";
55
55
  export * from "./UiStatusMessage.js";
56
56
  export * from "./UiSwitch.js";
57
57
  export * from "./UiSwitcher.js";
58
+ export * from "./UiTable.js";
58
59
  export * from "./UiTabs.js";
59
60
  export * from "./UiText.js";
60
61
  export * from "./UiTextarea.js";
@@ -1,12 +1,15 @@
1
1
  type __VLS_Props = {
2
- layout?: 'rows' | 'tiles';
2
+ columns?: '2' | '3' | '4';
3
+ density?: 'comfortable' | 'compact';
4
+ layout?: 'rows' | 'stacked' | 'grid' | 'tiles';
3
5
  };
4
6
  declare var __VLS_1: {};
5
7
  type __VLS_Slots = {} & {
6
8
  default?: (props: typeof __VLS_1) => any;
7
9
  };
8
10
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
9
- layout: "rows" | "tiles";
11
+ density: "comfortable" | "compact";
12
+ layout: "rows" | "stacked" | "grid" | "tiles";
10
13
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
14
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
12
15
  declare const _default: typeof __VLS_export;
@@ -6,9 +6,12 @@ defineOptions({ inheritAttrs: false })
6
6
 
7
7
  const props = withDefaults(
8
8
  defineProps<{
9
- layout?: 'rows' | 'tiles'
9
+ columns?: '2' | '3' | '4'
10
+ density?: 'comfortable' | 'compact'
11
+ layout?: 'rows' | 'stacked' | 'grid' | 'tiles'
10
12
  }>(),
11
13
  {
14
+ density: 'comfortable',
12
15
  layout: 'rows',
13
16
  },
14
17
  )
@@ -17,6 +20,8 @@ const props = withDefaults(
17
20
  const hostState = computed(() =>
18
21
  [
19
22
  props.layout && `layout layout=${props.layout}`,
23
+ props.columns && `columns columns=${props.columns}`,
24
+ props.density && `density density=${props.density}`,
20
25
  ].filter(Boolean).join(' ')
21
26
  )
22
27
  </script>
@@ -35,24 +40,63 @@ const hostState = computed(() =>
35
40
  /* Named values: a term and what it is, for each item (ui-description-item). */
36
41
  /* Rows line every term up in one column and every value in the next, through subgrid. */
37
42
  [data-component~="ui-description-list"] {
43
+ --_gap: var(--ui-space-2);
44
+ --_gap-compact: var(--ui-space-1);
45
+ --_column-gap: var(--ui-space-6);
46
+ --_min: 10rem;
47
+ --_track: var(--_min);
48
+ --_tile-padding: var(--ui-space-3);
38
49
  display: grid;
39
50
  grid-template-columns: minmax(6rem, max-content) minmax(0, 1fr);
40
- gap: var(--ui-space-2) var(--ui-space-6);
51
+ gap: var(--_gap) var(--_column-gap);
41
52
  min-inline-size: 0;
42
53
  margin: 0;
43
54
  }
44
55
 
45
- /* Tiles pass their shape to the items through private properties, which cross into each item. */
56
+ /* Stacked, grid, and tiles set each term above its value, passing the shape to the items through
57
+ private properties, which cross into each item. */
58
+ [data-component~="ui-description-list"][data-ui-description-list-state~="layout=stacked"],
59
+ [data-component~="ui-description-list"][data-ui-description-list-state~="layout=grid"],
46
60
  [data-component~="ui-description-list"][data-ui-description-list-state~="layout=tiles"] {
47
61
  --_ui-description-display: flex;
48
62
  --_ui-description-column: auto;
63
+ --_ui-description-align: stretch;
64
+ --_gap: var(--ui-space-4);
65
+ --_gap-compact: var(--ui-space-2);
66
+ grid-template-columns: minmax(0, 1fr);
67
+ }
68
+
69
+ /* A column is at least --_min wide; with columns set, at least its share of the width, so no more
70
+ than that many fit. */
71
+ [data-component~="ui-description-list"][data-ui-description-list-state~="layout=grid"],
72
+ [data-component~="ui-description-list"][data-ui-description-list-state~="layout=tiles"] {
73
+ grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--_track)), 1fr));
74
+ }
75
+
76
+ [data-component~="ui-description-list"][data-ui-description-list-state~="layout=tiles"] {
49
77
  --_ui-description-align: flex-start;
50
78
  --_ui-description-value-size: var(--ui-font-size-lg);
51
- --_ui-description-padding: var(--ui-space-3);
79
+ --_ui-description-padding: var(--_tile-padding);
52
80
  --_ui-description-border-width: 1px;
53
- display: grid;
54
- grid-template-columns: repeat(auto-fill, minmax(min(100%, 10rem), 1fr));
55
- gap: var(--ui-space-3);
81
+ --_gap: var(--ui-space-3);
82
+ --_gap-compact: var(--ui-space-2);
83
+ --_column-gap: var(--_gap);
84
+ }
85
+
86
+ [data-component~="ui-description-list"][data-ui-description-list-state~="columns=2"] {
87
+ --_track: max(var(--_min), (100% - var(--_column-gap)) / 2);
88
+ }
89
+ [data-component~="ui-description-list"][data-ui-description-list-state~="columns=3"] {
90
+ --_track: max(var(--_min), (100% - 2 * var(--_column-gap)) / 3);
91
+ }
92
+ [data-component~="ui-description-list"][data-ui-description-list-state~="columns=4"] {
93
+ --_track: max(var(--_min), (100% - 3 * var(--_column-gap)) / 4);
94
+ }
95
+
96
+ /* Compact takes each layout's closer spacing. */
97
+ [data-component~="ui-description-list"][data-ui-description-list-state~="density=compact"] {
98
+ --_gap: var(--_gap-compact);
99
+ --_tile-padding: var(--ui-space-2);
56
100
  }
57
101
 
58
102
  /* A component that sets its display still honours the hidden attribute on its root. */
package/vue/UiList.d.ts CHANGED
@@ -7,8 +7,8 @@ type __VLS_Slots = {} & {
7
7
  default?: (props: typeof __VLS_1) => any;
8
8
  };
9
9
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
10
- layout: "rows" | "grid";
11
10
  density: "comfortable" | "compact";
11
+ layout: "rows" | "grid";
12
12
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
13
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
14
14
  declare const _default: typeof __VLS_export;
@@ -0,0 +1,20 @@
1
+ type __VLS_Props = {
2
+ density?: 'comfortable' | 'compact';
3
+ stickyHeader?: boolean;
4
+ };
5
+ declare var __VLS_1: {};
6
+ type __VLS_Slots = {} & {
7
+ default?: (props: typeof __VLS_1) => any;
8
+ };
9
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
10
+ density: "comfortable" | "compact";
11
+ stickyHeader: boolean;
12
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
14
+ declare const _default: typeof __VLS_export;
15
+ export default _default;
16
+ type __VLS_WithSlots<T, S> = T & {
17
+ new (): {
18
+ $slots: S;
19
+ };
20
+ };
package/vue/UiTable.js ADDED
@@ -0,0 +1,2 @@
1
+ import { t as UiTable_default } from "./chunks/UiTable.js";
2
+ export { UiTable_default as default };
@@ -0,0 +1,172 @@
1
+ <!-- Generated by HTML Next 1.0.0-alpha.7 for Vue 3.5. Do not edit. -->
2
+ <script setup lang="ts">
3
+ import { computed, ref } from 'vue'
4
+ import * as controllerModule from '../components/ui-table/ui-table.js'
5
+ import { createDispatch, useComponentHost } from './host'
6
+
7
+ defineOptions({ inheritAttrs: false })
8
+
9
+ const props = withDefaults(
10
+ defineProps<{
11
+ density?: 'comfortable' | 'compact'
12
+ stickyHeader?: boolean
13
+ }>(),
14
+ {
15
+ density: 'comfortable',
16
+ stickyHeader: false,
17
+ },
18
+ )
19
+
20
+ const root = ref<HTMLElement | null>(null)
21
+
22
+ /** The values the styles' :host-state() rules test. */
23
+ const hostState = computed(() =>
24
+ [
25
+ props.density && `density density=${props.density}`,
26
+ props.stickyHeader && 'stickyHeader',
27
+ ].filter(Boolean).join(' ')
28
+ )
29
+
30
+ const dispatch = createDispatch(root)
31
+
32
+ useComponentHost(controllerModule.default, {
33
+ root,
34
+ dispatch,
35
+ props,
36
+ })
37
+ </script>
38
+
39
+ <template>
40
+ <div
41
+ data-component="ui-table"
42
+ v-bind="$attrs"
43
+ :data-ui-table-state="hostState || undefined"
44
+ ref="root"
45
+ >
46
+ <slot />
47
+ </div>
48
+ </template>
49
+
50
+ <style scoped>
51
+ /* Styles an authored <table> (caption, thead, tbody, th scope) without replacing it: the table is
52
+ meaningful before JavaScript, and a screen reader reads it as a table. The root scrolls a table
53
+ wider than it, or taller than a bounded height; while it does, the controller makes the root a named, focusable region so a
54
+ keyboard can scroll it. A cell's data-ui-align (start, center, or end; start by default) sets its
55
+ content along the row, such as end for a column of figures. */
56
+ [data-component~="ui-table"] {
57
+ --_pad-block: var(--ui-space-1);
58
+ --_pad-inline: var(--ui-space-3);
59
+ --_row-size: var(--ui-control-size);
60
+ display: block;
61
+ box-sizing: border-box;
62
+ max-inline-size: 100%;
63
+ min-inline-size: 0;
64
+ min-block-size: 0;
65
+ overflow: auto;
66
+ overscroll-behavior-inline: contain;
67
+ /* The sideways scroll fade every Looma scroller uses (see ui-scroll-area). Only the inline edges
68
+ fade, so a sticky header never fades. */
69
+ --_ui-scroll-fade-direction: to right;
70
+ --_ui-scroll-fade-size: var(--ui-scroll-fade-size, 24px);
71
+ mask-image: linear-gradient(
72
+ var(--_ui-scroll-fade-direction),
73
+ transparent,
74
+ #000 var(--_ui-scroll-fade-start),
75
+ #000 calc(100% - var(--_ui-scroll-fade-end)),
76
+ transparent
77
+ );
78
+ animation:
79
+ ui-scroll-fade-start linear,
80
+ ui-scroll-fade-start-hold linear,
81
+ ui-scroll-fade-end-hold linear,
82
+ ui-scroll-fade-end linear;
83
+ animation-timeline: scroll(self inline);
84
+ animation-range:
85
+ 0 var(--_ui-scroll-fade-size),
86
+ var(--_ui-scroll-fade-size) calc(100% + 1px),
87
+ -1px calc(100% - var(--_ui-scroll-fade-size)),
88
+ calc(100% - var(--_ui-scroll-fade-size)) 100%;
89
+ }
90
+
91
+ [data-component~="ui-table"]:dir(rtl) {
92
+ --_ui-scroll-fade-direction: to left;
93
+ }
94
+
95
+ [data-component~="ui-table"]:focus-visible {
96
+ outline: 2px solid var(--ui-focus-ring);
97
+ outline-offset: -2px;
98
+ }
99
+
100
+ [data-component~="ui-table"][data-ui-table-state~="density=compact"] {
101
+ --_pad-block: var(--ui-space-0-5);
102
+ --_pad-inline: var(--ui-space-2);
103
+ --_row-size: var(--ui-control-size-sm);
104
+ }
105
+
106
+ /* Separate borders stay on their cells when a sticky header scrolls; collapsed ones stay behind. */
107
+ :slotted(table) {
108
+ inline-size: 100%;
109
+ border-collapse: separate;
110
+ border-spacing: 0;
111
+ color: var(--ui-text-primary);
112
+ font-size: var(--ui-font-size-sm);
113
+ line-height: var(--ui-line-height);
114
+ font-variant-numeric: tabular-nums;
115
+ }
116
+
117
+ :slotted(caption) {
118
+ padding-block-end: var(--ui-space-2);
119
+ color: var(--ui-text-secondary);
120
+ font-weight: var(--ui-font-medium);
121
+ text-align: start;
122
+ }
123
+
124
+ /* Every row is at least one control tall, so a row holding a checkbox, select, or input keeps the
125
+ rhythm of the rows around it. A cell's height is its minimum. */
126
+ :slotted(th),
127
+ :slotted(td) {
128
+ block-size: var(--_row-size);
129
+ padding: var(--_pad-block) var(--_pad-inline);
130
+ border-block-end: 1px solid var(--ui-border-subtle);
131
+ text-align: start;
132
+ vertical-align: middle;
133
+ }
134
+
135
+ :slotted(thead th) {
136
+ block-size: auto;
137
+ padding-block: var(--ui-space-2);
138
+ border-block-end-color: var(--ui-border-default);
139
+ background: var(--ui-surface);
140
+ color: var(--ui-text-muted);
141
+ font-weight: var(--ui-font-medium);
142
+ white-space: nowrap;
143
+ vertical-align: bottom;
144
+ }
145
+
146
+ :slotted(tbody th) {
147
+ font-weight: var(--ui-font-medium);
148
+ }
149
+
150
+ :slotted(tbody tr:last-child > *) {
151
+ border-block-end-width: 0;
152
+ }
153
+
154
+ :slotted([data-ui-align="center"]) {
155
+ text-align: center;
156
+ }
157
+
158
+ :slotted([data-ui-align="end"]) {
159
+ text-align: end;
160
+ }
161
+
162
+ [data-component~="ui-table"][data-ui-table-state~="stickyHeader"] :slotted(thead th) {
163
+ position: sticky;
164
+ inset-block-start: 0;
165
+ z-index: 1;
166
+ }
167
+
168
+ /* A component that sets its display still honours the hidden attribute on its root. */
169
+ [data-component~="ui-table"][hidden] {
170
+ display: none;
171
+ }
172
+ </style>
@@ -7,15 +7,23 @@ var _hoisted_1 = ["data-ui-description-list-state"];
7
7
  var UiDescriptionList_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
8
8
  inheritAttrs: false,
9
9
  __name: "UiDescriptionList",
10
- props: { layout: { default: "rows" } },
10
+ props: {
11
+ columns: {},
12
+ density: { default: "comfortable" },
13
+ layout: { default: "rows" }
14
+ },
11
15
  setup(__props) {
12
16
  const props = __props;
13
17
  /** The values the styles' :host-state() rules test. */
14
- const hostState = computed(() => [props.layout && `layout layout=${props.layout}`].filter(Boolean).join(" "));
18
+ const hostState = computed(() => [
19
+ props.layout && `layout layout=${props.layout}`,
20
+ props.columns && `columns columns=${props.columns}`,
21
+ props.density && `density density=${props.density}`
22
+ ].filter(Boolean).join(" "));
15
23
  return (_ctx, _cache) => {
16
24
  return openBlock(), createElementBlock("dl", mergeProps({ "data-component": "ui-description-list" }, _ctx.$attrs, { "data-ui-description-list-state": hostState.value || void 0 }), [renderSlot(_ctx.$slots, "default", {}, void 0, true)], 16, _hoisted_1);
17
25
  };
18
26
  }
19
- }), [["__scopeId", "data-v-a4548235"]]);
27
+ }), [["__scopeId", "data-v-640c2332"]]);
20
28
  //#endregion
21
29
  export { UiDescriptionList_default as t };