@threadlabs/looma 0.10.10 → 0.10.12
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/components/ui-list/ui-list.html +33 -0
- package/components/ui-list-item/ui-list-item.html +146 -0
- package/components/ui-tree-item/ui-tree-item.html +39 -29
- package/components/ui-tree-item/ui-tree-item.js +17 -11
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/styles/ui-list-item.css +146 -0
- package/styles/ui-list.css +33 -0
- package/styles/ui-tree-item.css +44 -32
- package/vanilla/UiList.d.ts +14 -0
- package/vanilla/UiList.js +29 -0
- package/vanilla/UiListItem.d.ts +15 -0
- package/vanilla/UiListItem.js +77 -0
- package/vanilla/UiTreeItem.js +1 -1
- package/vanilla/index.js +2 -0
- package/vue/UiList.d.ts +18 -0
- package/vue/UiList.js +2 -0
- package/vue/UiList.vue +60 -0
- package/vue/UiListItem.d.ts +26 -0
- package/vue/UiListItem.js +2 -0
- package/vue/UiListItem.vue +171 -0
- package/vue/UiTreeItem.vue +49 -29
- package/vue/chunks/UiList.js +24 -0
- package/vue/chunks/UiListItem.js +39 -0
- package/vue/chunks/UiTreeItem.js +15 -5
- package/vue/components.css +243 -87
- package/vue/index.d.ts +2 -0
- package/vue/index.js +3 -1
package/package.json
CHANGED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/* Generated by HTML Next 1.0.0-alpha.5. Do not edit. */
|
|
2
|
+
@scope ([data-component~="ui-list-item"]) to ([data-component], [data-slotted]) {
|
|
3
|
+
/* One entry in a list: something to recognise (leading, usually an icon), its name (the default
|
|
4
|
+
slot), one line about it (description), and what it offers (trailing, such as a button or a
|
|
5
|
+
badge). The title and description are one line each and end in an ellipsis, so every item in a
|
|
6
|
+
list has the same height.
|
|
7
|
+
|
|
8
|
+
A link in the title is the whole item: its hit area stretches over the item, so the icon and the
|
|
9
|
+
padding follow it too, and the item takes the link's focus ring. The link stays a real link, so
|
|
10
|
+
a router, a modified click, and "open in new tab" all work. Trailing controls sit above it and
|
|
11
|
+
stay their own. */
|
|
12
|
+
:scope {
|
|
13
|
+
position: relative;
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
gap: var(--ui-list-item-gap, var(--ui-space-3));
|
|
18
|
+
min-inline-size: 0;
|
|
19
|
+
min-block-size: var(--ui-control-size, 2.5rem);
|
|
20
|
+
padding-block: var(--ui-list-item-padding-block, var(--ui-space-2));
|
|
21
|
+
padding-inline: var(--ui-list-item-padding-inline, var(--ui-space-3));
|
|
22
|
+
border-radius: var(--ui-radius-md);
|
|
23
|
+
color: var(--ui-text-primary);
|
|
24
|
+
transition: background-color var(--ui-motion-fast) var(--ui-motion-ease), border-color var(--ui-motion-fast) var(--ui-motion-ease);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
:scope[data-ui-list-item-state~="variant=card"] {
|
|
28
|
+
padding-block: var(--ui-list-item-padding-block, var(--ui-space-3));
|
|
29
|
+
padding-inline: var(--ui-list-item-padding-inline, var(--ui-space-4));
|
|
30
|
+
border: 1px solid var(--ui-border-default);
|
|
31
|
+
border-radius: var(--ui-radius-lg);
|
|
32
|
+
background: var(--ui-surface-raised);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
:scope:has(.title a[href]:hover) {
|
|
36
|
+
background: var(--ui-surface-hover);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
:scope[data-ui-list-item-state~="variant=card"]:has(.title a[href]:hover) {
|
|
40
|
+
border-color: var(--ui-border-strong);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
:scope[data-ui-list-item-state~="current"] {
|
|
44
|
+
background: var(--ui-surface-hover);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
:scope:has(.title a[href]:focus-visible) {
|
|
48
|
+
box-shadow: 0 0 0 2px var(--ui-focus-ring);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.leading,
|
|
52
|
+
.trailing {
|
|
53
|
+
display: inline-flex;
|
|
54
|
+
flex: none;
|
|
55
|
+
align-items: center;
|
|
56
|
+
gap: var(--ui-space-2);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.leading {
|
|
60
|
+
color: var(--ui-text-muted);
|
|
61
|
+
font-size: var(--ui-list-item-icon-size, var(--ui-font-size-lg));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* Trailing controls take their own clicks, above the title link's stretched hit area. */
|
|
65
|
+
.trailing {
|
|
66
|
+
position: relative;
|
|
67
|
+
z-index: 1;
|
|
68
|
+
color: var(--ui-text-muted);
|
|
69
|
+
font-size: var(--ui-font-size-sm);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.content {
|
|
73
|
+
display: flex;
|
|
74
|
+
flex: 1;
|
|
75
|
+
flex-direction: column;
|
|
76
|
+
gap: var(--ui-space-0-5, 2px);
|
|
77
|
+
min-inline-size: 0;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.title,
|
|
81
|
+
.description {
|
|
82
|
+
display: block;
|
|
83
|
+
min-inline-size: 0;
|
|
84
|
+
overflow: hidden;
|
|
85
|
+
text-overflow: ellipsis;
|
|
86
|
+
white-space: nowrap;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.title {
|
|
90
|
+
font-size: var(--ui-font-size-md);
|
|
91
|
+
font-weight: var(--ui-font-medium);
|
|
92
|
+
line-height: var(--ui-line-height-tight);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.description {
|
|
96
|
+
color: var(--ui-text-muted);
|
|
97
|
+
font-size: var(--ui-font-size-sm);
|
|
98
|
+
line-height: var(--ui-line-height-tight);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/* An unused region takes no space. */
|
|
102
|
+
.leading:empty,
|
|
103
|
+
.description:empty,
|
|
104
|
+
.trailing:empty {
|
|
105
|
+
display: none;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/* A component that sets its display still honours the hidden attribute on its root. */
|
|
109
|
+
:scope[hidden] {
|
|
110
|
+
display: none;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
@scope ([data-component~="ui-list-item"]) to ([data-component]) {
|
|
114
|
+
/* One entry in a list: something to recognise (leading, usually an icon), its name (the default
|
|
115
|
+
slot), one line about it (description), and what it offers (trailing, such as a button or a
|
|
116
|
+
badge). The title and description are one line each and end in an ellipsis, so every item in a
|
|
117
|
+
list has the same height.
|
|
118
|
+
|
|
119
|
+
A link in the title is the whole item: its hit area stretches over the item, so the icon and the
|
|
120
|
+
padding follow it too, and the item takes the link's focus ring. The link stays a real link, so
|
|
121
|
+
a router, a modified click, and "open in new tab" all work. Trailing controls sit above it and
|
|
122
|
+
stay their own. */
|
|
123
|
+
|
|
124
|
+
/* Trailing controls take their own clicks, above the title link's stretched hit area. */
|
|
125
|
+
|
|
126
|
+
.title > :where([data-slotted], [data-slotted] *):is(a) {
|
|
127
|
+
color: inherit;
|
|
128
|
+
text-decoration: none;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.title > :where([data-slotted], [data-slotted] *):is(a:focus-visible) {
|
|
132
|
+
outline: none;
|
|
133
|
+
box-shadow: none;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.title > :where([data-slotted], [data-slotted] *):is(a[href])::after {
|
|
137
|
+
position: absolute;
|
|
138
|
+
inset: 0;
|
|
139
|
+
border-radius: inherit;
|
|
140
|
+
content: "";
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/* An unused region takes no space. */
|
|
144
|
+
|
|
145
|
+
/* A component that sets its display still honours the hidden attribute on its root. */
|
|
146
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* Generated by HTML Next 1.0.0-alpha.5. Do not edit. */
|
|
2
|
+
@scope ([data-component~="ui-list"]) to ([data-component], [data-slotted]) {
|
|
3
|
+
/* A list of items (ui-list-item). It owns the spacing between them, so a view never sets it. The
|
|
4
|
+
explicit list role keeps the list announced as one: some browsers drop it from a list with no
|
|
5
|
+
markers. */
|
|
6
|
+
:scope {
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
gap: var(--ui-list-gap, var(--ui-space-1));
|
|
10
|
+
min-inline-size: 0;
|
|
11
|
+
margin: 0;
|
|
12
|
+
padding: 0;
|
|
13
|
+
list-style: none;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
:scope[data-ui-list-state~="layout=grid"] {
|
|
17
|
+
display: grid;
|
|
18
|
+
grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--ui-list-min-item-width, 14rem)), 1fr));
|
|
19
|
+
gap: var(--ui-list-gap, var(--ui-space-3));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* A component that sets its display still honours the hidden attribute on its root. */
|
|
23
|
+
:scope[hidden] {
|
|
24
|
+
display: none;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
@scope ([data-component~="ui-list"]) to ([data-component]) {
|
|
28
|
+
/* A list of items (ui-list-item). It owns the spacing between them, so a view never sets it. The
|
|
29
|
+
explicit list role keeps the list announced as one: some browsers drop it from a list with no
|
|
30
|
+
markers. */
|
|
31
|
+
|
|
32
|
+
/* A component that sets its display still honours the hidden attribute on its root. */
|
|
33
|
+
}
|
package/styles/ui-tree-item.css
CHANGED
|
@@ -136,6 +136,9 @@
|
|
|
136
136
|
block-size: 1em;
|
|
137
137
|
margin-inline-start: var(--ui-space-1);
|
|
138
138
|
color: var(--ui-text-muted);
|
|
139
|
+
/* Above the label, so a sliding name passes under the icon. */
|
|
140
|
+
position: relative;
|
|
141
|
+
z-index: 1;
|
|
139
142
|
}
|
|
140
143
|
|
|
141
144
|
.leading:empty {
|
|
@@ -156,6 +159,9 @@
|
|
|
156
159
|
/* The cell clips: a name longer than the row slides inside it rather than over its icons. */
|
|
157
160
|
overflow: hidden;
|
|
158
161
|
padding: var(--ui-tree-item-label-padding-block, var(--ui-space-1)) var(--ui-tree-item-label-padding-inline, var(--ui-space-2));
|
|
162
|
+
/* The length of the fade before the controls. The label's one flex child lays out no gap; this
|
|
163
|
+
is where the controller reads the length in pixels to stop a sliding name before the fade. */
|
|
164
|
+
column-gap: var(--ui-space-3);
|
|
159
165
|
}
|
|
160
166
|
|
|
161
167
|
/* Slotted label content fills the cell, so a link is the row's hit area rather than sizing to
|
|
@@ -171,6 +177,27 @@
|
|
|
171
177
|
white-space: nowrap;
|
|
172
178
|
}
|
|
173
179
|
|
|
180
|
+
/* The controls sit over the label's end, so the text fades out where they begin. The fade is
|
|
181
|
+
the truncation mark while it shows: an ellipsis under it would read as a second one. */
|
|
182
|
+
.row:hover > .label,
|
|
183
|
+
.row:focus-within > .label {
|
|
184
|
+
text-overflow: clip;
|
|
185
|
+
mask-image: linear-gradient(
|
|
186
|
+
to right,
|
|
187
|
+
#000 calc(100% - var(--_tree-actions-width, 1.75rem) - var(--ui-space-3)),
|
|
188
|
+
transparent calc(100% - var(--_tree-actions-width, 1.75rem))
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.row:hover > .label:dir(rtl),
|
|
193
|
+
.row:focus-within > .label:dir(rtl) {
|
|
194
|
+
mask-image: linear-gradient(
|
|
195
|
+
to left,
|
|
196
|
+
#000 calc(100% - var(--_tree-actions-width, 1.75rem) - var(--ui-space-3)),
|
|
197
|
+
transparent calc(100% - var(--_tree-actions-width, 1.75rem))
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
|
|
174
201
|
/* A hovered row reads its whole name: the label slides far enough to show the end, waits
|
|
175
202
|
there, and comes back. Only when it actually overflows — the controller measures by how
|
|
176
203
|
much — after the controls have taken their place over its end — and hands over the distance
|
|
@@ -182,13 +209,17 @@
|
|
|
182
209
|
will-change: transform;
|
|
183
210
|
}
|
|
184
211
|
|
|
185
|
-
/*
|
|
186
|
-
|
|
212
|
+
/* This comes after the hover fade, which it replaces at the same specificity. While the name
|
|
213
|
+
slides, the label reaches back under the icon (the controller measures how far) with its text
|
|
214
|
+
where it was, and fades out across that stretch, gone by the icon's middle: the name slips
|
|
215
|
+
under the icon rather than stopping at a hard edge beside it. */
|
|
187
216
|
.row[data-ui-marquee] > .label {
|
|
217
|
+
margin-inline-start: calc(-1 * var(--_marquee-lead, 0px));
|
|
218
|
+
padding-inline-start: calc(var(--_marquee-lead, 0px) + var(--ui-tree-item-label-padding-inline, var(--ui-space-2)));
|
|
188
219
|
mask-image: linear-gradient(
|
|
189
220
|
to right,
|
|
190
|
-
transparent
|
|
191
|
-
#000 var(--ui-space-2),
|
|
221
|
+
transparent calc(var(--_marquee-lead, 0px) / 2),
|
|
222
|
+
#000 calc(var(--_marquee-lead, 0px) + var(--ui-tree-item-label-padding-inline, var(--ui-space-2))),
|
|
192
223
|
#000 calc(100% - var(--_tree-actions-width, 1.75rem) - var(--ui-space-3)),
|
|
193
224
|
transparent calc(100% - var(--_tree-actions-width, 1.75rem))
|
|
194
225
|
);
|
|
@@ -197,8 +228,8 @@
|
|
|
197
228
|
.row[data-ui-marquee] > .label:dir(rtl) {
|
|
198
229
|
mask-image: linear-gradient(
|
|
199
230
|
to left,
|
|
200
|
-
transparent
|
|
201
|
-
#000 var(--ui-space-2),
|
|
231
|
+
transparent calc(var(--_marquee-lead, 0px) / 2),
|
|
232
|
+
#000 calc(var(--_marquee-lead, 0px) + var(--ui-tree-item-label-padding-inline, var(--ui-space-2))),
|
|
202
233
|
#000 calc(100% - var(--_tree-actions-width, 1.75rem) - var(--ui-space-3)),
|
|
203
234
|
transparent calc(100% - var(--_tree-actions-width, 1.75rem))
|
|
204
235
|
);
|
|
@@ -211,27 +242,6 @@
|
|
|
211
242
|
}
|
|
212
243
|
}
|
|
213
244
|
|
|
214
|
-
/* The controls sit over the label's end, so the text fades out where they begin. The fade is
|
|
215
|
-
the truncation mark while it shows: an ellipsis under it would read as a second one. */
|
|
216
|
-
.row:hover > .label,
|
|
217
|
-
.row:focus-within > .label {
|
|
218
|
-
text-overflow: clip;
|
|
219
|
-
mask-image: linear-gradient(
|
|
220
|
-
to right,
|
|
221
|
-
#000 calc(100% - var(--_tree-actions-width, 1.75rem) - var(--ui-space-3)),
|
|
222
|
-
transparent calc(100% - var(--_tree-actions-width, 1.75rem))
|
|
223
|
-
);
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
.row:hover > .label:dir(rtl),
|
|
227
|
-
.row:focus-within > .label:dir(rtl) {
|
|
228
|
-
mask-image: linear-gradient(
|
|
229
|
-
to left,
|
|
230
|
-
#000 calc(100% - var(--_tree-actions-width, 1.75rem) - var(--ui-space-3)),
|
|
231
|
-
transparent calc(100% - var(--_tree-actions-width, 1.75rem))
|
|
232
|
-
);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
245
|
.actions {
|
|
236
246
|
position: absolute;
|
|
237
247
|
z-index: 1;
|
|
@@ -408,21 +418,23 @@
|
|
|
408
418
|
min-inline-size: 0;
|
|
409
419
|
}
|
|
410
420
|
|
|
421
|
+
/* The controls sit over the label's end, so the text fades out where they begin. The fade is
|
|
422
|
+
the truncation mark while it shows: an ellipsis under it would read as a second one. */
|
|
423
|
+
|
|
411
424
|
/* A hovered row reads its whole name: the label slides far enough to show the end, waits
|
|
412
425
|
there, and comes back. Only when it actually overflows — the controller measures by how
|
|
413
426
|
much — after the controls have taken their place over its end — and hands over the distance
|
|
414
427
|
and a duration from it, so a longer name travels no faster. */
|
|
415
428
|
|
|
416
|
-
/*
|
|
417
|
-
|
|
429
|
+
/* This comes after the hover fade, which it replaces at the same specificity. While the name
|
|
430
|
+
slides, the label reaches back under the icon (the controller measures how far) with its text
|
|
431
|
+
where it was, and fades out across that stretch, gone by the icon's middle: the name slips
|
|
432
|
+
under the icon rather than stopping at a hard edge beside it. */
|
|
418
433
|
|
|
419
434
|
/* Reduced motion keeps the fade, which already says the name continues. */
|
|
420
435
|
@media (prefers-reduced-motion: reduce) {
|
|
421
436
|
}
|
|
422
437
|
|
|
423
|
-
/* The controls sit over the label's end, so the text fades out where they begin. The fade is
|
|
424
|
-
the truncation mark while it shows: an ellipsis under it would read as a second one. */
|
|
425
|
-
|
|
426
438
|
.row:hover > .label > :where([data-slotted], [data-slotted] *):is(*),
|
|
427
439
|
.row:focus-within > .label > :where([data-slotted], [data-slotted] *):is(*) {
|
|
428
440
|
text-overflow: clip;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Generated by HTML Next 1.0.0-alpha.5 for Vanilla DOM. Do not edit.
|
|
2
|
+
export interface UiListEventMap {
|
|
3
|
+
}
|
|
4
|
+
export interface UiListElement extends HTMLUListElement {
|
|
5
|
+
addEventListener<K extends keyof UiListEventMap>(type: K, listener: (this: UiListElement, event: UiListEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
6
|
+
removeEventListener<K extends keyof UiListEventMap>(type: K, listener: (this: UiListElement, event: UiListEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
|
|
7
|
+
}
|
|
8
|
+
export interface UiListProps {
|
|
9
|
+
layout?: "rows" | "grid" | null;
|
|
10
|
+
attributes?: Readonly<Record<string, string | number | boolean | null | undefined>>;
|
|
11
|
+
children?: readonly (string | Node)[];
|
|
12
|
+
slots?: Readonly<Record<string, readonly (string | Node)[]>>;
|
|
13
|
+
}
|
|
14
|
+
export declare function createUiList(props?: UiListProps): UiListElement;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Generated by HTML Next 1.0.0-alpha.5 for Vanilla DOM. Do not edit.
|
|
2
|
+
import { manageGeneratedProps } from "@nextwebwg/html-next/generated-runtime";
|
|
3
|
+
import "../styles/ui-list.css";
|
|
4
|
+
|
|
5
|
+
export function createUiList(options = {}) {
|
|
6
|
+
const { attributes = {}, children = [], slots = {}, as, ...componentProps } = options;
|
|
7
|
+
const projected = [];
|
|
8
|
+
const prop0 = componentProps["layout"] === undefined ? "rows" : componentProps["layout"];
|
|
9
|
+
const element = document.createElement("ul");
|
|
10
|
+
for (const [name, value] of Object.entries(attributes)) {
|
|
11
|
+
if (value === null || value === undefined || value === false) continue;
|
|
12
|
+
element.setAttribute(name, value === true ? "" : String(value));
|
|
13
|
+
}
|
|
14
|
+
if (!element.hasAttribute("role")) element.setAttribute("role", "list");
|
|
15
|
+
element.setAttribute("data-component", "ui-list");
|
|
16
|
+
if (children.length > 0) {
|
|
17
|
+
for (const child of children) {
|
|
18
|
+
const node = typeof child === "string" ? document.createTextNode(child) : child;
|
|
19
|
+
projected.push([node, ""]);
|
|
20
|
+
element.append(node);
|
|
21
|
+
}
|
|
22
|
+
} else {
|
|
23
|
+
}
|
|
24
|
+
manageGeneratedProps(element, [
|
|
25
|
+
{ name: "layout", attribute: "data-layout", value: componentProps["layout"], default: "rows", type: ["rows","grid"], required: false },
|
|
26
|
+
]);
|
|
27
|
+
return element;
|
|
28
|
+
}
|
|
29
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Generated by HTML Next 1.0.0-alpha.5 for Vanilla DOM. Do not edit.
|
|
2
|
+
export interface UiListItemEventMap {
|
|
3
|
+
}
|
|
4
|
+
export interface UiListItemElement extends HTMLLIElement {
|
|
5
|
+
addEventListener<K extends keyof UiListItemEventMap>(type: K, listener: (this: UiListItemElement, event: UiListItemEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
6
|
+
removeEventListener<K extends keyof UiListItemEventMap>(type: K, listener: (this: UiListItemElement, event: UiListItemEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
|
|
7
|
+
}
|
|
8
|
+
export interface UiListItemProps {
|
|
9
|
+
current?: boolean | null;
|
|
10
|
+
variant?: "row" | "card" | 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 createUiListItem(props?: UiListItemProps): UiListItemElement;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// Generated by HTML Next 1.0.0-alpha.5 for Vanilla DOM. Do not edit.
|
|
2
|
+
import { manageGeneratedProps } from "@nextwebwg/html-next/generated-runtime";
|
|
3
|
+
import "../styles/ui-list-item.css";
|
|
4
|
+
|
|
5
|
+
export function createUiListItem(options = {}) {
|
|
6
|
+
const { attributes = {}, children = [], slots = {}, as, ...componentProps } = options;
|
|
7
|
+
const projected = [];
|
|
8
|
+
const prop0 = componentProps["current"] === undefined ? false : componentProps["current"];
|
|
9
|
+
const prop1 = componentProps["variant"] === undefined ? "row" : componentProps["variant"];
|
|
10
|
+
const element = document.createElement("li");
|
|
11
|
+
for (const [name, value] of Object.entries(attributes)) {
|
|
12
|
+
if (value === null || value === undefined || value === false) continue;
|
|
13
|
+
element.setAttribute(name, value === true ? "" : String(value));
|
|
14
|
+
}
|
|
15
|
+
const value0 = prop0;
|
|
16
|
+
if (typeof value0 === "boolean") element.setAttribute("aria-current", String(value0));
|
|
17
|
+
else element.removeAttribute("aria-current");
|
|
18
|
+
element.setAttribute("data-component", "ui-list-item");
|
|
19
|
+
const element0 = document.createElement("span");
|
|
20
|
+
element0.setAttribute("class", "leading");
|
|
21
|
+
if (slots["leading"] ?? [].length > 0) {
|
|
22
|
+
for (const child of slots["leading"] ?? []) {
|
|
23
|
+
const node = typeof child === "string" ? document.createTextNode(child) : child;
|
|
24
|
+
projected.push([node, "leading"]);
|
|
25
|
+
element0.append(node);
|
|
26
|
+
}
|
|
27
|
+
} else {
|
|
28
|
+
}
|
|
29
|
+
element.append(element0);
|
|
30
|
+
const element1 = document.createElement("span");
|
|
31
|
+
element1.setAttribute("class", "content");
|
|
32
|
+
const element2 = document.createElement("span");
|
|
33
|
+
element2.setAttribute("class", "title");
|
|
34
|
+
if (children.length > 0) {
|
|
35
|
+
for (const child of children) {
|
|
36
|
+
const node = typeof child === "string" ? document.createTextNode(child) : child;
|
|
37
|
+
projected.push([node, ""]);
|
|
38
|
+
element2.append(node);
|
|
39
|
+
}
|
|
40
|
+
} else {
|
|
41
|
+
}
|
|
42
|
+
element1.append(element2);
|
|
43
|
+
const element3 = document.createElement("span");
|
|
44
|
+
element3.setAttribute("class", "description");
|
|
45
|
+
if (slots["description"] ?? [].length > 0) {
|
|
46
|
+
for (const child of slots["description"] ?? []) {
|
|
47
|
+
const node = typeof child === "string" ? document.createTextNode(child) : child;
|
|
48
|
+
projected.push([node, "description"]);
|
|
49
|
+
element3.append(node);
|
|
50
|
+
}
|
|
51
|
+
} else {
|
|
52
|
+
}
|
|
53
|
+
element1.append(element3);
|
|
54
|
+
element.append(element1);
|
|
55
|
+
const element4 = document.createElement("span");
|
|
56
|
+
element4.setAttribute("class", "trailing");
|
|
57
|
+
if (slots["trailing"] ?? [].length > 0) {
|
|
58
|
+
for (const child of slots["trailing"] ?? []) {
|
|
59
|
+
const node = typeof child === "string" ? document.createTextNode(child) : child;
|
|
60
|
+
projected.push([node, "trailing"]);
|
|
61
|
+
element4.append(node);
|
|
62
|
+
}
|
|
63
|
+
} else {
|
|
64
|
+
}
|
|
65
|
+
element.append(element4);
|
|
66
|
+
manageGeneratedProps(element, [
|
|
67
|
+
{ name: "current", attribute: "data-current", value: componentProps["current"], default: false, type: "boolean", required: false },
|
|
68
|
+
{ name: "variant", attribute: "data-variant", value: componentProps["variant"], default: "row", type: ["row","card"], required: false },
|
|
69
|
+
], (name, value) => {
|
|
70
|
+
if (name === "current") {
|
|
71
|
+
if (value === null || value === undefined) element.removeAttribute("aria-current");
|
|
72
|
+
else element.setAttribute("aria-current", String(value));
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
return element;
|
|
76
|
+
}
|
|
77
|
+
|
package/vanilla/UiTreeItem.js
CHANGED
|
@@ -3,7 +3,7 @@ import { manageComponentLifecycle } from "@nextwebwg/html-next/runtime";
|
|
|
3
3
|
import * as controller from "../components/ui-tree-item/ui-tree-item.js";
|
|
4
4
|
import "../styles/ui-tree-item.css";
|
|
5
5
|
|
|
6
|
-
const definition = {...{"contract":{"tag":"ui-tree-item","props":{"accepts":{"type":"string","required":false,"target":{"attribute":"data-accepts"},"default":""},"container":{"type":"boolean","required":false,"target":{"attribute":"container"},"default":false},"disabled":{"type":"boolean","required":false,"target":{"attribute":"aria-disabled"},"default":false},"dragType":{"type":"string","required":false,"target":{"attribute":"data-drag-type"},"default":"item"},"dropDepth":{"type":"number","required":false,"target":{"attribute":"data-drop-depth"}},"dropScope":{"type":"string","required":false,"target":{"attribute":"data-drop-scope"},"default":""},"expanded":{"type":"boolean","required":false,"target":{"attribute":"expanded"},"default":false},"itemId":{"type":"string","required":false,"target":{"attribute":"data-item-id"},"default":""},"label":{"type":"string","required":false,"target":{"attribute":"aria-label"},"default":""},"marquee":{"type":"boolean","required":false,"target":{"attribute":"marquee"},"default":false},"selected":{"type":"boolean","required":false,"target":{"attribute":"aria-selected"},"default":false},"sortable":{"type":"boolean","required":false,"target":{"attribute":"sortable"},"default":false},"subtreeDepth":{"type":"number","required":false,"target":{"attribute":"data-subtree-depth"}}}},"template":{"kind":"element","name":"div","attributes":[{"kind":"literal","name":"role","value":"treeitem"},{"kind":"attribute","name":"aria-label","expression":"label","expressionPlan":{"source":"label","ast":{"kind":"id","name":"label"},"dependencies":["label"]}},{"kind":"attribute","name":"aria-level","expression":"structuralLevel","expressionPlan":{"source":"structuralLevel","ast":{"kind":"id","name":"structuralLevel"},"dependencies":["structuralLevel"]}},{"kind":"attribute","name":"aria-selected","expression":"selected","expressionPlan":{"source":"selected","ast":{"kind":"id","name":"selected"},"dependencies":["selected"]}},{"kind":"attribute","name":"aria-disabled","expression":"disabled","expressionPlan":{"source":"disabled","ast":{"kind":"id","name":"disabled"},"dependencies":["disabled"]}},{"kind":"attribute","name":"data-item-id","expression":"itemId","expressionPlan":{"source":"itemId","ast":{"kind":"id","name":"itemId"},"dependencies":["itemId"]}},{"kind":"attribute","name":"data-drag-type","expression":"dragType","expressionPlan":{"source":"dragType","ast":{"kind":"id","name":"dragType"},"dependencies":["dragType"]}},{"kind":"attribute","name":"data-drop-scope","expression":"dropScope","expressionPlan":{"source":"dropScope","ast":{"kind":"id","name":"dropScope"},"dependencies":["dropScope"]}},{"kind":"attribute","name":"data-accepts","expression":"accepts","expressionPlan":{"source":"accepts","ast":{"kind":"id","name":"accepts"},"dependencies":["accepts"]}},{"kind":"attribute","name":"data-drop-depth","expression":"dropDepth","expressionPlan":{"source":"dropDepth","ast":{"kind":"id","name":"dropDepth"},"dependencies":["dropDepth"]}},{"kind":"attribute","name":"data-subtree-depth","expression":"subtreeDepth","expressionPlan":{"source":"subtreeDepth","ast":{"kind":"id","name":"subtreeDepth"},"dependencies":["subtreeDepth"]}}],"children":[{"kind":"element","name":"div","attributes":[{"kind":"literal","name":"class","value":"row"}],"children":[{"kind":"element","name":"button","attributes":[{"kind":"literal","name":"class","value":"drag-handle"},{"kind":"literal","name":"type","value":"button"},{"kind":"literal","name":"draggable","value":"true"},{"kind":"attribute","name":"aria-label","expression":"format('Drag %s to reorder', label)","expressionPlan":{"source":"format('Drag %s to reorder', label)","ast":{"kind":"call","fn":"format","args":[{"kind":"literal","value":"Drag %s to reorder"},{"kind":"id","name":"label"}]},"dependencies":["label"]}}],"children":[{"kind":"element","name":"svg","attributes":[{"kind":"literal","name":"aria-hidden","value":"true"},{"kind":"literal","name":"focusable","value":"false"},{"kind":"literal","name":"viewBox","value":"0 0 24 24"},{"kind":"literal","name":"fill","value":"none"},{"kind":"literal","name":"stroke","value":"currentColor"},{"kind":"literal","name":"stroke-width","value":"2"},{"kind":"literal","name":"stroke-linecap","value":"round"},{"kind":"literal","name":"stroke-linejoin","value":"round"}],"children":[{"kind":"element","name":"circle","attributes":[{"kind":"literal","name":"cx","value":"9"},{"kind":"literal","name":"cy","value":"12"},{"kind":"literal","name":"r","value":"1"}],"children":[]},{"kind":"element","name":"circle","attributes":[{"kind":"literal","name":"cx","value":"9"},{"kind":"literal","name":"cy","value":"5"},{"kind":"literal","name":"r","value":"1"}],"children":[]},{"kind":"element","name":"circle","attributes":[{"kind":"literal","name":"cx","value":"9"},{"kind":"literal","name":"cy","value":"19"},{"kind":"literal","name":"r","value":"1"}],"children":[]},{"kind":"element","name":"circle","attributes":[{"kind":"literal","name":"cx","value":"15"},{"kind":"literal","name":"cy","value":"12"},{"kind":"literal","name":"r","value":"1"}],"children":[]},{"kind":"element","name":"circle","attributes":[{"kind":"literal","name":"cx","value":"15"},{"kind":"literal","name":"cy","value":"5"},{"kind":"literal","name":"r","value":"1"}],"children":[]},{"kind":"element","name":"circle","attributes":[{"kind":"literal","name":"cx","value":"15"},{"kind":"literal","name":"cy","value":"19"},{"kind":"literal","name":"r","value":"1"}],"children":[]}]}],"flow":{"kind":"if","test":"sortable and not disabled","testPlan":{"source":"sortable and not disabled","ast":{"kind":"binary","op":"and","left":{"kind":"id","name":"sortable"},"right":{"kind":"unary","op":"not","operand":{"kind":"id","name":"disabled"}}},"dependencies":["disabled","sortable"]}},"ref":"dragHandle"},{"kind":"element","name":"button","attributes":[{"kind":"literal","name":"class","value":"disclosure"},{"kind":"literal","name":"type","value":"button"},{"kind":"attribute","name":"disabled","expression":"disabled","expressionPlan":{"source":"disabled","ast":{"kind":"id","name":"disabled"},"dependencies":["disabled"]}},{"kind":"attribute","name":"hidden","expression":"not isContainer","expressionPlan":{"source":"not isContainer","ast":{"kind":"unary","op":"not","operand":{"kind":"id","name":"isContainer"}},"dependencies":["isContainer"]}}],"children":[{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"disclosure-icon"},{"kind":"literal","name":"aria-hidden","value":"true"}],"children":[]}],"ref":"disclosure"},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"leading"}],"children":[{"kind":"slot","fallback":[],"name":"leading"}]},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"label"}],"children":[{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"label-text"}],"children":[{"kind":"slot","fallback":[{"kind":"element","name":"template","attributes":[{"kind":"directive","name":"value","expression":"label","expressionPlan":{"source":"label","ast":{"kind":"id","name":"label"},"dependencies":["label"]}}],"children":[]}],"name":"label"}],"ref":"labelText"}]},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"actions"}],"children":[{"kind":"slot","fallback":[],"name":"actions"}],"ref":"actions"},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"drop-indicator row-drop-indicator"},{"kind":"literal","name":"aria-hidden","value":"true"}],"children":[]}],"ref":"row"},{"kind":"element","name":"div","attributes":[{"kind":"literal","name":"class","value":"children"},{"kind":"literal","name":"role","value":"group"},{"kind":"attribute","name":"hidden","expression":"not (isContainer and internalExpanded)","expressionPlan":{"source":"not (isContainer and internalExpanded)","ast":{"kind":"unary","op":"not","operand":{"kind":"binary","op":"and","left":{"kind":"id","name":"isContainer"},"right":{"kind":"id","name":"internalExpanded"}}},"dependencies":["internalExpanded","isContainer"]}}],"children":[{"kind":"slot"}],"ref":"children"},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"drop-indicator subtree-drop-indicator"},{"kind":"literal","name":"aria-hidden","value":"true"}],"children":[]}]},"declarations":[{"kind":"state","name":"internalExpanded","expression":{"source":"false","ast":{"kind":"literal","value":false},"dependencies":[]}},{"kind":"state","name":"structuralLevel","expression":{"source":"1","ast":{"kind":"literal","value":1},"dependencies":[]}},{"kind":"state","name":"tabStop","expression":{"source":"false","ast":{"kind":"literal","value":false},"dependencies":[]}},{"kind":"state","name":"isContainer","expression":{"source":"false","ast":{"kind":"literal","value":false},"dependencies":[]}},{"kind":"event","name":"expand","type":"object({ id: string, expanded: boolean, trigger: keyboard | pointer | programmatic })","bubbles":false,"composed":true,"cancelable":false}],"root":{"kind":"native","element":"div","choices":["div"]}},source:{file:import.meta.url},css:""};
|
|
6
|
+
const definition = {...{"contract":{"tag":"ui-tree-item","props":{"accepts":{"type":"string","required":false,"target":{"attribute":"data-accepts"},"default":""},"container":{"type":"boolean","required":false,"target":{"attribute":"container"},"default":false},"disabled":{"type":"boolean","required":false,"target":{"attribute":"aria-disabled"},"default":false},"dragType":{"type":"string","required":false,"target":{"attribute":"data-drag-type"},"default":"item"},"dropDepth":{"type":"number","required":false,"target":{"attribute":"data-drop-depth"}},"dropScope":{"type":"string","required":false,"target":{"attribute":"data-drop-scope"},"default":""},"expanded":{"type":"boolean","required":false,"target":{"attribute":"expanded"},"default":false},"itemId":{"type":"string","required":false,"target":{"attribute":"data-item-id"},"default":""},"label":{"type":"string","required":false,"target":{"attribute":"aria-label"},"default":""},"marquee":{"type":"boolean","required":false,"target":{"attribute":"marquee"},"default":false},"selected":{"type":"boolean","required":false,"target":{"attribute":"aria-selected"},"default":false},"sortable":{"type":"boolean","required":false,"target":{"attribute":"sortable"},"default":false},"subtreeDepth":{"type":"number","required":false,"target":{"attribute":"data-subtree-depth"}}}},"template":{"kind":"element","name":"div","attributes":[{"kind":"literal","name":"role","value":"treeitem"},{"kind":"attribute","name":"aria-label","expression":"label","expressionPlan":{"source":"label","ast":{"kind":"id","name":"label"},"dependencies":["label"]}},{"kind":"attribute","name":"aria-level","expression":"structuralLevel","expressionPlan":{"source":"structuralLevel","ast":{"kind":"id","name":"structuralLevel"},"dependencies":["structuralLevel"]}},{"kind":"attribute","name":"aria-selected","expression":"selected","expressionPlan":{"source":"selected","ast":{"kind":"id","name":"selected"},"dependencies":["selected"]}},{"kind":"attribute","name":"aria-disabled","expression":"disabled","expressionPlan":{"source":"disabled","ast":{"kind":"id","name":"disabled"},"dependencies":["disabled"]}},{"kind":"attribute","name":"data-item-id","expression":"itemId","expressionPlan":{"source":"itemId","ast":{"kind":"id","name":"itemId"},"dependencies":["itemId"]}},{"kind":"attribute","name":"data-drag-type","expression":"dragType","expressionPlan":{"source":"dragType","ast":{"kind":"id","name":"dragType"},"dependencies":["dragType"]}},{"kind":"attribute","name":"data-drop-scope","expression":"dropScope","expressionPlan":{"source":"dropScope","ast":{"kind":"id","name":"dropScope"},"dependencies":["dropScope"]}},{"kind":"attribute","name":"data-accepts","expression":"accepts","expressionPlan":{"source":"accepts","ast":{"kind":"id","name":"accepts"},"dependencies":["accepts"]}},{"kind":"attribute","name":"data-drop-depth","expression":"dropDepth","expressionPlan":{"source":"dropDepth","ast":{"kind":"id","name":"dropDepth"},"dependencies":["dropDepth"]}},{"kind":"attribute","name":"data-subtree-depth","expression":"subtreeDepth","expressionPlan":{"source":"subtreeDepth","ast":{"kind":"id","name":"subtreeDepth"},"dependencies":["subtreeDepth"]}}],"children":[{"kind":"element","name":"div","attributes":[{"kind":"literal","name":"class","value":"row"}],"children":[{"kind":"element","name":"button","attributes":[{"kind":"literal","name":"class","value":"drag-handle"},{"kind":"literal","name":"type","value":"button"},{"kind":"literal","name":"draggable","value":"true"},{"kind":"attribute","name":"aria-label","expression":"format('Drag %s to reorder', label)","expressionPlan":{"source":"format('Drag %s to reorder', label)","ast":{"kind":"call","fn":"format","args":[{"kind":"literal","value":"Drag %s to reorder"},{"kind":"id","name":"label"}]},"dependencies":["label"]}}],"children":[{"kind":"element","name":"svg","attributes":[{"kind":"literal","name":"aria-hidden","value":"true"},{"kind":"literal","name":"focusable","value":"false"},{"kind":"literal","name":"viewBox","value":"0 0 24 24"},{"kind":"literal","name":"fill","value":"none"},{"kind":"literal","name":"stroke","value":"currentColor"},{"kind":"literal","name":"stroke-width","value":"2"},{"kind":"literal","name":"stroke-linecap","value":"round"},{"kind":"literal","name":"stroke-linejoin","value":"round"}],"children":[{"kind":"element","name":"circle","attributes":[{"kind":"literal","name":"cx","value":"9"},{"kind":"literal","name":"cy","value":"12"},{"kind":"literal","name":"r","value":"1"}],"children":[]},{"kind":"element","name":"circle","attributes":[{"kind":"literal","name":"cx","value":"9"},{"kind":"literal","name":"cy","value":"5"},{"kind":"literal","name":"r","value":"1"}],"children":[]},{"kind":"element","name":"circle","attributes":[{"kind":"literal","name":"cx","value":"9"},{"kind":"literal","name":"cy","value":"19"},{"kind":"literal","name":"r","value":"1"}],"children":[]},{"kind":"element","name":"circle","attributes":[{"kind":"literal","name":"cx","value":"15"},{"kind":"literal","name":"cy","value":"12"},{"kind":"literal","name":"r","value":"1"}],"children":[]},{"kind":"element","name":"circle","attributes":[{"kind":"literal","name":"cx","value":"15"},{"kind":"literal","name":"cy","value":"5"},{"kind":"literal","name":"r","value":"1"}],"children":[]},{"kind":"element","name":"circle","attributes":[{"kind":"literal","name":"cx","value":"15"},{"kind":"literal","name":"cy","value":"19"},{"kind":"literal","name":"r","value":"1"}],"children":[]}]}],"flow":{"kind":"if","test":"sortable and not disabled","testPlan":{"source":"sortable and not disabled","ast":{"kind":"binary","op":"and","left":{"kind":"id","name":"sortable"},"right":{"kind":"unary","op":"not","operand":{"kind":"id","name":"disabled"}}},"dependencies":["disabled","sortable"]}},"ref":"dragHandle"},{"kind":"element","name":"button","attributes":[{"kind":"literal","name":"class","value":"disclosure"},{"kind":"literal","name":"type","value":"button"},{"kind":"attribute","name":"disabled","expression":"disabled","expressionPlan":{"source":"disabled","ast":{"kind":"id","name":"disabled"},"dependencies":["disabled"]}},{"kind":"attribute","name":"hidden","expression":"not isContainer","expressionPlan":{"source":"not isContainer","ast":{"kind":"unary","op":"not","operand":{"kind":"id","name":"isContainer"}},"dependencies":["isContainer"]}}],"children":[{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"disclosure-icon"},{"kind":"literal","name":"aria-hidden","value":"true"}],"children":[]}],"ref":"disclosure"},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"leading"}],"children":[{"kind":"slot","fallback":[],"name":"leading"}],"ref":"leading"},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"label"}],"children":[{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"label-text"}],"children":[{"kind":"slot","fallback":[{"kind":"element","name":"template","attributes":[{"kind":"directive","name":"value","expression":"label","expressionPlan":{"source":"label","ast":{"kind":"id","name":"label"},"dependencies":["label"]}}],"children":[]}],"name":"label"}],"ref":"labelText"}],"ref":"label"},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"actions"}],"children":[{"kind":"slot","fallback":[],"name":"actions"}],"ref":"actions"},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"drop-indicator row-drop-indicator"},{"kind":"literal","name":"aria-hidden","value":"true"}],"children":[]}],"ref":"row"},{"kind":"element","name":"div","attributes":[{"kind":"literal","name":"class","value":"children"},{"kind":"literal","name":"role","value":"group"},{"kind":"attribute","name":"hidden","expression":"not (isContainer and internalExpanded)","expressionPlan":{"source":"not (isContainer and internalExpanded)","ast":{"kind":"unary","op":"not","operand":{"kind":"binary","op":"and","left":{"kind":"id","name":"isContainer"},"right":{"kind":"id","name":"internalExpanded"}}},"dependencies":["internalExpanded","isContainer"]}}],"children":[{"kind":"slot"}],"ref":"children"},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"drop-indicator subtree-drop-indicator"},{"kind":"literal","name":"aria-hidden","value":"true"}],"children":[]}]},"declarations":[{"kind":"state","name":"internalExpanded","expression":{"source":"false","ast":{"kind":"literal","value":false},"dependencies":[]}},{"kind":"state","name":"structuralLevel","expression":{"source":"1","ast":{"kind":"literal","value":1},"dependencies":[]}},{"kind":"state","name":"tabStop","expression":{"source":"false","ast":{"kind":"literal","value":false},"dependencies":[]}},{"kind":"state","name":"isContainer","expression":{"source":"false","ast":{"kind":"literal","value":false},"dependencies":[]}},{"kind":"event","name":"expand","type":"object({ id: string, expanded: boolean, trigger: keyboard | pointer | programmatic })","bubbles":false,"composed":true,"cancelable":false}],"root":{"kind":"native","element":"div","choices":["div"]}},source:{file:import.meta.url},css:""};
|
|
7
7
|
|
|
8
8
|
export function createUiTreeItem(options = {}) {
|
|
9
9
|
const { attributes = {}, children = [], slots = {}, as, ...componentProps } = options;
|
package/vanilla/index.js
CHANGED
|
@@ -25,6 +25,8 @@ export * from "./UiGrid.js";
|
|
|
25
25
|
export * from "./UiIcon.js";
|
|
26
26
|
export * from "./UiIconButton.js";
|
|
27
27
|
export * from "./UiInput.js";
|
|
28
|
+
export * from "./UiList.js";
|
|
29
|
+
export * from "./UiListItem.js";
|
|
28
30
|
export * from "./UiMenu.js";
|
|
29
31
|
export * from "./UiMenuItem.js";
|
|
30
32
|
export * from "./UiPopover.js";
|
package/vue/UiList.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
layout?: 'rows' | 'grid';
|
|
3
|
+
};
|
|
4
|
+
declare var __VLS_1: {};
|
|
5
|
+
type __VLS_Slots = {} & {
|
|
6
|
+
default?: (props: typeof __VLS_1) => any;
|
|
7
|
+
};
|
|
8
|
+
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" | "grid";
|
|
10
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
12
|
+
declare const _default: typeof __VLS_export;
|
|
13
|
+
export default _default;
|
|
14
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
15
|
+
new (): {
|
|
16
|
+
$slots: S;
|
|
17
|
+
};
|
|
18
|
+
};
|
package/vue/UiList.js
ADDED
package/vue/UiList.vue
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<!-- Generated by HTML Next 1.0.0-alpha.5 for Vue 3.5. Do not edit. -->
|
|
2
|
+
<script setup lang="ts">
|
|
3
|
+
import { computed } from 'vue'
|
|
4
|
+
|
|
5
|
+
defineOptions({ inheritAttrs: false })
|
|
6
|
+
|
|
7
|
+
const props = withDefaults(
|
|
8
|
+
defineProps<{
|
|
9
|
+
layout?: 'rows' | 'grid'
|
|
10
|
+
}>(),
|
|
11
|
+
{
|
|
12
|
+
layout: 'rows',
|
|
13
|
+
},
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
/** The values the styles' :host-state() rules test. */
|
|
17
|
+
const hostState = computed(() =>
|
|
18
|
+
[
|
|
19
|
+
props.layout && `layout layout=${props.layout}`,
|
|
20
|
+
].filter(Boolean).join(' ')
|
|
21
|
+
)
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<template>
|
|
25
|
+
<ul
|
|
26
|
+
data-component="ui-list"
|
|
27
|
+
role="list"
|
|
28
|
+
v-bind="$attrs"
|
|
29
|
+
:data-ui-list-state="hostState || undefined"
|
|
30
|
+
>
|
|
31
|
+
<slot />
|
|
32
|
+
</ul>
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<style scoped>
|
|
36
|
+
/* A list of items (ui-list-item). It owns the spacing between them, so a view never sets it. The
|
|
37
|
+
explicit list role keeps the list announced as one: some browsers drop it from a list with no
|
|
38
|
+
markers. */
|
|
39
|
+
[data-component~="ui-list"] {
|
|
40
|
+
display: flex;
|
|
41
|
+
flex-direction: column;
|
|
42
|
+
gap: var(--ui-list-gap, var(--ui-space-1));
|
|
43
|
+
min-inline-size: 0;
|
|
44
|
+
margin: 0;
|
|
45
|
+
padding: 0;
|
|
46
|
+
list-style: none;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
[data-component~="ui-list"][data-ui-list-state~="layout=grid"] {
|
|
50
|
+
display: grid;
|
|
51
|
+
grid-template-columns:
|
|
52
|
+
repeat(auto-fill, minmax(min(100%, var(--ui-list-min-item-width, 14rem)), 1fr));
|
|
53
|
+
gap: var(--ui-list-gap, var(--ui-space-3));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* A component that sets its display still honours the hidden attribute on its root. */
|
|
57
|
+
[data-component~="ui-list"][hidden] {
|
|
58
|
+
display: none;
|
|
59
|
+
}
|
|
60
|
+
</style>
|