@threadlabs/looma 0.53.9 → 0.53.11
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/README.md +16 -0
- package/blocks/editor-workspace.html +53 -0
- package/blocks/editor-workspace.js +15 -0
- package/blocks/list-detail.html +54 -0
- package/blocks/list-detail.js +62 -0
- package/blocks/search-and-open.html +33 -0
- package/blocks/search-and-open.js +53 -0
- package/blocks/settings-form.html +26 -0
- package/blocks/settings-form.js +16 -0
- package/components/shared/behaviors.d.ts +2 -0
- package/components/shared/behaviors.js +2 -0
- package/components/shared/collection-navigation.d.ts +28 -0
- package/components/shared/collection-navigation.js +40 -0
- package/components/shared/deferred-focus.d.ts +8 -0
- package/components/shared/deferred-focus.js +21 -0
- package/components/shared/form-reset.js +14 -6
- package/components/shared/menu-navigation.js +19 -22
- package/components/shared/overlay-dismissal.js +7 -0
- package/components/shared/overlay.js +3 -2
- package/components/ui-button/ui-button.html +1 -0
- package/components/ui-checkbox/ui-checkbox.html +1 -0
- package/components/ui-color-picker/ui-color-picker.html +1 -1
- package/components/ui-combobox/ui-combobox.html +5 -2
- package/components/ui-combobox/ui-combobox.js +6 -6
- package/components/ui-date-picker/ui-date-picker.js +5 -6
- package/components/ui-date-range-picker/ui-date-range-picker.js +6 -8
- package/components/ui-disclosure/ui-disclosure.html +3 -2
- package/components/ui-editor-toolbar/ui-editor-toolbar.js +8 -6
- package/components/ui-form-field/ui-form-field.html +1 -1
- package/components/ui-input/ui-input.html +1 -0
- package/components/ui-list-item/ui-list-item.html +3 -3
- package/components/ui-listbox/ui-listbox.html +1 -0
- package/components/ui-listbox/ui-listbox.js +10 -16
- package/components/ui-menu/ui-menu.html +1 -1
- package/components/ui-menu-item/ui-menu-item.html +1 -1
- package/components/ui-nav-item/ui-nav-item.html +2 -2
- package/components/ui-radio/ui-radio.html +1 -0
- package/components/ui-radio-group/ui-radio-group.html +1 -0
- package/components/ui-search-shell/ui-search-shell.js +4 -5
- package/components/ui-segmented-control/ui-segmented-control.html +3 -2
- package/components/ui-select/ui-select.html +4 -1
- package/components/ui-sidebar/ui-sidebar.html +7 -0
- package/components/ui-switch/ui-switch.html +1 -0
- package/components/ui-switcher/ui-switcher.html +28 -1
- package/components/ui-tabs/ui-tabs.js +5 -3
- package/components/ui-textarea/ui-textarea.html +5 -2
- package/dist/index.js +1 -1
- package/docs/catalog.json +80 -32
- package/editor/components.css +7 -3
- package/editor/index.js +77 -43
- package/package.json +8 -1
- package/styles/ui-button.css +1 -0
- package/styles/ui-checkbox.css +1 -0
- package/styles/ui-color-picker.css +2 -2
- package/styles/ui-combobox.css +8 -4
- package/styles/ui-disclosure.css +2 -1
- package/styles/ui-form-field.css +1 -1
- package/styles/ui-input.css +1 -0
- package/styles/ui-list-item.css +3 -3
- package/styles/ui-listbox.css +2 -0
- package/styles/ui-menu-item.css +1 -1
- package/styles/ui-nav-item.css +1 -1
- package/styles/ui-radio-group.css +1 -0
- package/styles/ui-radio.css +1 -0
- package/styles/ui-segmented-control.css +3 -2
- package/styles/ui-select.css +4 -1
- package/styles/ui-sidebar.css +12 -1
- package/styles/ui-switch.css +1 -0
- package/styles/ui-switcher.css +22 -1
- package/styles/ui-textarea.css +5 -2
- package/theme-system.css +3 -2
- package/tokens.css +1 -1
- package/vanilla/UiSwitcher.d.ts +2 -1
- package/vanilla/UiSwitcher.js +96 -16
package/styles/ui-form-field.css
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
|
|
34
34
|
.label {
|
|
35
35
|
color: var(--_ui-form-field-label-text, var(--ui-text-secondary));
|
|
36
|
-
font-size: var(--_ui-form-field-label-font-size, var(--ui-field-label-font-size, var(--ui-font-size-
|
|
36
|
+
font-size: var(--_ui-form-field-label-font-size, var(--ui-field-label-font-size, var(--ui-font-size-sm)));
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
/* A label action, such as a small help button, sits after the label text in a box one line
|
package/styles/ui-input.css
CHANGED
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
background-image: var(--_ui-default-input-highlight, var(--ui-surface-highlight, none));
|
|
36
36
|
color: var(--ui-text-primary);
|
|
37
37
|
font: inherit;
|
|
38
|
+
font-size: var(--ui-font-size-sm);
|
|
38
39
|
line-height: var(--ui-line-height-tight);
|
|
39
40
|
box-shadow: var(--ui-input-shadow, var(--_ui-default-input-shadow, var(--ui-control-inset)));
|
|
40
41
|
transition:
|
package/styles/ui-list-item.css
CHANGED
|
@@ -121,9 +121,9 @@
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
.title {
|
|
124
|
-
font-size: var(--ui-font-size-
|
|
124
|
+
font-size: var(--ui-font-size-sm);
|
|
125
125
|
font-weight: var(--_ui-list-item-title-weight, var(--ui-font-medium));
|
|
126
|
-
line-height: var(--ui-line-height
|
|
126
|
+
line-height: var(--ui-line-height);
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
/* Keep identity and disclosure marks beside the first line, even with a long description. */
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
|
|
134
134
|
:scope:where(:is([component~="ui-list-item"]:not(template), [data-component~="ui-list-item"]:not([component])))[data-ui-list-item-state~="align=title"] .leading,
|
|
135
135
|
:scope:where(:is([component~="ui-list-item"]:not(template), [data-component~="ui-list-item"]:not([component])))[data-ui-list-item-state~="align=title"] .trailing {
|
|
136
|
-
min-block-size: calc(var(--ui-font-size-
|
|
136
|
+
min-block-size: calc(var(--ui-font-size-sm) * var(--ui-line-height));
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
.description {
|
package/styles/ui-listbox.css
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
background: var(--ui-listbox-surface, var(--ui-control-surface));
|
|
21
21
|
color: var(--ui-text-primary);
|
|
22
22
|
font: inherit;
|
|
23
|
+
font-size: var(--ui-font-size-sm);
|
|
23
24
|
line-height: var(--ui-line-height-md);
|
|
24
25
|
box-shadow: var(--ui-control-inset);
|
|
25
26
|
outline: none;
|
|
@@ -99,6 +100,7 @@
|
|
|
99
100
|
background: var(--ui-listbox-surface, var(--ui-control-surface));
|
|
100
101
|
color: var(--ui-text-primary);
|
|
101
102
|
font: inherit;
|
|
103
|
+
font-size: var(--ui-font-size-sm);
|
|
102
104
|
line-height: var(--ui-line-height-md);
|
|
103
105
|
box-shadow: var(--ui-control-inset);
|
|
104
106
|
outline: none;
|
package/styles/ui-menu-item.css
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
text-align: left;
|
|
19
19
|
border-radius: var(--ui-menu-item-radius, var(--_ui-default-menu-item-radius, var(--ui-selection-radius)));
|
|
20
20
|
color: var(--ui-text-primary);
|
|
21
|
-
font-size: var(--ui-menu-item-font-size, var(--_ui-default-menu-item-font-size, var(--ui-font-size-
|
|
21
|
+
font-size: var(--ui-menu-item-font-size, var(--_ui-default-menu-item-font-size, var(--ui-font-size-sm)));
|
|
22
22
|
font-weight: var(--ui-font-medium);
|
|
23
23
|
text-decoration: none;
|
|
24
24
|
cursor: pointer;
|
package/styles/ui-nav-item.css
CHANGED
package/styles/ui-radio.css
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
:scope:where(:is([component~="ui-segmented-control"]:not(template), [data-component~="ui-segmented-control"]:not([component]))) {
|
|
11
11
|
--_segmented-size: var(--ui-control-size-md);
|
|
12
12
|
--_segmented-inset: var(--ui-space-3);
|
|
13
|
-
--_segmented-font-size: var(--ui-font-size-
|
|
13
|
+
--_segmented-font-size: var(--ui-font-size-sm);
|
|
14
14
|
--_segmented-padding: var(--ui-space-1) !important;
|
|
15
15
|
--_segmented-radius: var(--ui-field-radius, var(--ui-radius-md));
|
|
16
16
|
display: inline-grid !important;
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
border: 0;
|
|
24
24
|
color: var(--ui-text-primary);
|
|
25
25
|
font: inherit;
|
|
26
|
+
font-size: var(--ui-field-label-font-size, var(--ui-font-size-sm));
|
|
26
27
|
}
|
|
27
28
|
legend {
|
|
28
29
|
float: inline-start;
|
|
@@ -83,7 +84,7 @@
|
|
|
83
84
|
:scope:where(:is([component~="ui-segmented-control"]:not(template), [data-component~="ui-segmented-control"]:not([component])))[data-ui-segmented-control-state~="invalid"] .segments { border-color: var(--ui-field-danger, var(--ui-danger-solid)); }
|
|
84
85
|
:scope:where(:is([component~="ui-segmented-control"]:not(template), [data-component~="ui-segmented-control"]:not([component])))[data-ui-segmented-control-state~="invalid"] legend { color: var(--ui-field-danger, var(--ui-danger-solid)); }
|
|
85
86
|
:scope:where(:is([component~="ui-segmented-control"]:not(template), [data-component~="ui-segmented-control"]:not([component])))[data-ui-segmented-control-state~="size=sm"] { --_segmented-size: var(--ui-control-size-sm); --_segmented-inset: var(--ui-space-2); --_segmented-font-size: var(--ui-font-size-sm); }
|
|
86
|
-
:scope:where(:is([component~="ui-segmented-control"]:not(template), [data-component~="ui-segmented-control"]:not([component])))[data-ui-segmented-control-state~="size=lg"] { --_segmented-size: var(--ui-control-size-lg); --_segmented-inset: var(--ui-space-4); --_segmented-font-size: var(--ui-font-size-
|
|
87
|
+
:scope:where(:is([component~="ui-segmented-control"]:not(template), [data-component~="ui-segmented-control"]:not([component])))[data-ui-segmented-control-state~="size=lg"] { --_segmented-size: var(--ui-control-size-lg); --_segmented-inset: var(--ui-space-4); --_segmented-font-size: var(--ui-font-size-md); }
|
|
87
88
|
:scope:where(:is([component~="ui-segmented-control"]:not(template), [data-component~="ui-segmented-control"]:not([component])))[hidden] { display: none !important; }
|
|
88
89
|
@media (forced-colors: active) {
|
|
89
90
|
.segments { border-color: ButtonText; }
|
package/styles/ui-select.css
CHANGED
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
color: var(--ui-text-primary);
|
|
26
26
|
color-scheme: inherit;
|
|
27
27
|
font: inherit;
|
|
28
|
+
font-size: var(--ui-font-size-sm);
|
|
28
29
|
line-height: var(--ui-line-height-tight);
|
|
29
30
|
box-shadow: var(--ui-select-shadow, var(--ui-shadow-sm));
|
|
30
31
|
transition:
|
|
@@ -119,7 +120,9 @@
|
|
|
119
120
|
|
|
120
121
|
/* Touch may use body-size text in a small native field to avoid focus zoom; this does not impose a larger visible control height. */
|
|
121
122
|
@media (pointer: coarse) {
|
|
122
|
-
:scope:where(:is([component~="ui-select"]:not(template), [data-component~="ui-select"]:not([component])))
|
|
123
|
+
:scope:where(:is([component~="ui-select"]:not(template), [data-component~="ui-select"]:not([component]))),
|
|
124
|
+
:scope:where(:is([component~="ui-select"]:not(template), [data-component~="ui-select"]:not([component])))[data-ui-select-state~="size=sm"],
|
|
125
|
+
:scope:where(:is([component~="ui-select"]:not(template), [data-component~="ui-select"]:not([component])))[data-ui-select-state~="size=lg"] {
|
|
123
126
|
font-size: var(--ui-font-size-md);
|
|
124
127
|
}
|
|
125
128
|
}
|
package/styles/ui-sidebar.css
CHANGED
|
@@ -25,6 +25,13 @@
|
|
|
25
25
|
transition: inline-size var(--ui-motion-layout) var(--ui-motion-layout-ease), visibility var(--ui-motion-layout);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
/* Without a drawer controller, keep navigation in flow and reserve most of the row for content. */
|
|
29
|
+
@media (scripting: none) {
|
|
30
|
+
:scope:where(:is([component~="ui-sidebar"]:not(template), [data-component~="ui-sidebar"]:not([component]))) {
|
|
31
|
+
max-inline-size: 33%;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
28
35
|
:scope:where(:is([component~="ui-sidebar"]:not(template), [data-component~="ui-sidebar"]:not([component])))[data-ui-sidebar-state~="side=end"] {
|
|
29
36
|
border-inline-end: 0;
|
|
30
37
|
border-inline-start: var(--ui-border-width) solid var(--ui-sidebar-border, var(--ui-border-divider));
|
|
@@ -202,7 +209,11 @@
|
|
|
202
209
|
}
|
|
203
210
|
}
|
|
204
211
|
@scope (:is([component~="ui-sidebar"]:not(template), [data-component~="ui-sidebar"]:not([component]))) to (:is([component]:not(template), [data-component]:not([component]))) {
|
|
205
|
-
/*
|
|
212
|
+
/* Without a drawer controller, keep navigation in flow and reserve most of the row for content. */
|
|
213
|
+
@media (scripting: none) {
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/* The panel's content scrolls, and each edge that hides content fades: the scroll fade every
|
|
206
217
|
Looma scroller uses (see ui-scroll-area). */
|
|
207
218
|
|
|
208
219
|
/* Collapsed while docked. */
|
package/styles/ui-switch.css
CHANGED
package/styles/ui-switcher.css
CHANGED
|
@@ -26,6 +26,24 @@
|
|
|
26
26
|
grid-template-columns: minmax(0, 1fr);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
/* Reuse the width threshold as the flex basis. Below it, each full-width item
|
|
30
|
+
gets its own line. Above it, grow factors divide the available space. */
|
|
31
|
+
:scope:where(:is([component~="ui-switcher"]:not(template), [data-component~="ui-switcher"]:not([component]))):is([data-ui-switcher-state~="balance=narrow-start"], [data-ui-switcher-state~="balance=narrow-end"]):not([data-ui-switcher-state~="overLimit"]):not([hidden]) {
|
|
32
|
+
display: flex !important;
|
|
33
|
+
flex-flow: row wrap !important;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.start,
|
|
37
|
+
.end {
|
|
38
|
+
flex: 2 1 var(--_switcher-track) !important;
|
|
39
|
+
min-inline-size: 0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
:scope:where(:is([component~="ui-switcher"]:not(template), [data-component~="ui-switcher"]:not([component])))[data-ui-switcher-state~="balance=narrow-start"] > .start,
|
|
43
|
+
:scope:where(:is([component~="ui-switcher"]:not(template), [data-component~="ui-switcher"]:not([component])))[data-ui-switcher-state~="balance=narrow-end"] > .end {
|
|
44
|
+
flex-grow: 1 !important;
|
|
45
|
+
}
|
|
46
|
+
|
|
29
47
|
:scope:where(:is([component~="ui-switcher"]:not(template), [data-component~="ui-switcher"]:not([component])))[data-ui-switcher-state~="gap=xs"] {
|
|
30
48
|
--_switcher-gap: var(--ui-space-2);
|
|
31
49
|
}
|
|
@@ -66,5 +84,8 @@
|
|
|
66
84
|
}
|
|
67
85
|
}
|
|
68
86
|
@scope (:is([component~="ui-switcher"]:not(template), [data-component~="ui-switcher"]:not([component]))) to (:is([component]:not(template), [data-component]:not([component]))) {
|
|
69
|
-
/*
|
|
87
|
+
/* Reuse the width threshold as the flex basis. Below it, each full-width item
|
|
88
|
+
gets its own line. Above it, grow factors divide the available space. */
|
|
89
|
+
|
|
90
|
+
/* A component that sets its display still honours the hidden attribute on its root. */
|
|
70
91
|
}
|
package/styles/ui-textarea.css
CHANGED
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
background-image: var(--_ui-default-textarea-highlight, var(--ui-surface-highlight, none));
|
|
27
27
|
color: var(--ui-text-primary);
|
|
28
28
|
font: inherit;
|
|
29
|
+
font-size: var(--ui-font-size-sm);
|
|
29
30
|
line-height: var(--ui-line-height-md);
|
|
30
31
|
box-shadow: var(--ui-textarea-shadow, var(--_ui-default-textarea-shadow, var(--ui-control-inset)));
|
|
31
32
|
transition:
|
|
@@ -110,8 +111,10 @@
|
|
|
110
111
|
|
|
111
112
|
/* Below 16px, iOS zooms the page into the focused field, so touch keeps body-size text. */
|
|
112
113
|
@media (pointer: coarse) {
|
|
113
|
-
:scope:where(:is([component~="ui-textarea"]:not(template), [data-component~="ui-textarea"]:not([component])))
|
|
114
|
-
|
|
114
|
+
:scope:where(:is([component~="ui-textarea"]:not(template), [data-component~="ui-textarea"]:not([component]))),
|
|
115
|
+
:scope:where(:is([component~="ui-textarea"]:not(template), [data-component~="ui-textarea"]:not([component])))[data-ui-textarea-state~="size=sm"],
|
|
116
|
+
:scope:where(:is([component~="ui-textarea"]:not(template), [data-component~="ui-textarea"]:not([component])))[data-ui-textarea-state~="size=lg"] {
|
|
117
|
+
font-size: var(--ui-font-size-md);
|
|
115
118
|
}
|
|
116
119
|
}
|
|
117
120
|
|
package/theme-system.css
CHANGED
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
/* Vertical editing/action insets fit the shared box instead of growing with the
|
|
65
65
|
page spacing curve. Multi-line content can still grow intrinsically. */
|
|
66
66
|
--ui-control-inset-block-sm: max(0px, calc((var(--ui-control-size-sm) - var(--ui-font-size-sm) * var(--ui-line-height-tight) - 2 * var(--ui-border-width)) / 2));
|
|
67
|
-
--ui-control-inset-block-md: max(0px, calc((var(--ui-control-size-md) - var(--ui-font-size-
|
|
67
|
+
--ui-control-inset-block-md: max(0px, calc((var(--ui-control-size-md) - var(--ui-font-size-sm) * var(--ui-line-height-tight) - 2 * var(--ui-border-width)) / 2));
|
|
68
68
|
--ui-control-inset-block-lg: max(0px, calc((var(--ui-control-size-lg) - var(--ui-font-size-md) * var(--ui-line-height-tight) - 2 * var(--ui-border-width)) / 2));
|
|
69
69
|
--ui-font-size-xs: max(12px, calc(1rem * 0.75));
|
|
70
70
|
--ui-action-inset-sm: max(var(--ui-space-2), var(--ui-control-inset-block-sm));
|
|
@@ -156,7 +156,8 @@
|
|
|
156
156
|
|
|
157
157
|
@media (pointer: coarse) {
|
|
158
158
|
:where(:root, [data-theme], [data-contrast]) {
|
|
159
|
-
/*
|
|
159
|
+
/* Native fields use body-size text on touch to avoid focus zoom. */
|
|
160
|
+
--ui-control-inset-block-md: max(0px, calc((var(--ui-control-size-md) - var(--ui-font-size-md) * var(--ui-line-height-tight) - 2 * var(--ui-border-width)) / 2));
|
|
160
161
|
--ui-control-inset-block-sm: max(0px, calc((var(--ui-control-size-sm) - var(--ui-font-size-md) * var(--ui-line-height-tight) - 2 * var(--ui-border-width)) / 2));
|
|
161
162
|
}
|
|
162
163
|
}
|
package/tokens.css
CHANGED
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
/* Type scale, from the base size. */
|
|
131
131
|
--ui-font-size-2xs: calc(1rem * 0.6875);
|
|
132
132
|
--ui-font-size-xs: calc(1rem * 0.75);
|
|
133
|
-
/*
|
|
133
|
+
/* UI text: controls, navigation, action rows, labels, and supporting text. Body copy uses md. */
|
|
134
134
|
--ui-font-size-sm: calc(1rem * 0.875);
|
|
135
135
|
--ui-font-size-md: 1rem;
|
|
136
136
|
--ui-font-size-lg: calc(1rem * 1.125);
|
package/vanilla/UiSwitcher.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Generated by HTML Next 1.0.0-alpha.92 for Vanilla DOM. Do not edit.
|
|
2
2
|
export interface UiSwitcherEventMap {
|
|
3
3
|
}
|
|
4
|
-
export interface UiSwitcherElement extends
|
|
4
|
+
export interface UiSwitcherElement extends HTMLElement {
|
|
5
5
|
addEventListener<K extends keyof UiSwitcherEventMap>(type: K, listener: (this: UiSwitcherElement, event: UiSwitcherEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
6
6
|
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: UiSwitcherElement, event: HTMLElementEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
7
7
|
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
@@ -11,6 +11,7 @@ export interface UiSwitcherElement extends HTMLDivElement {
|
|
|
11
11
|
}
|
|
12
12
|
export interface UiSwitcherProps {
|
|
13
13
|
align?: "start" | "center" | "end" | "stretch" | null;
|
|
14
|
+
balance?: "equal" | "narrow-start" | "narrow-end" | null;
|
|
14
15
|
gap?: "xs" | "s" | "m" | "l" | "xl" | null;
|
|
15
16
|
limit?: number | null;
|
|
16
17
|
threshold?: "xs" | "sm" | "md" | "lg" | null;
|
package/vanilla/UiSwitcher.js
CHANGED
|
@@ -1,23 +1,35 @@
|
|
|
1
1
|
// Generated by HTML Next 1.0.0-alpha.92 for Vanilla DOM. Do not edit.
|
|
2
|
-
import { attachGeneratedController, buildTemplate, writeAttribute, dispose, formatOf, keywordFormat, hostState, acceptProps, manageProps, generatedInputs, project, fillSlot, checkFormat, checkInteger, forwardAttributes, resetForwardedAttributes, defineComponent, activateModule } from "@nextwebwg/html-next/generated-runtime";
|
|
2
|
+
import { attachGeneratedController, equalValue, buildTemplate, truthy, writeAttribute, dispose, formatOf, keywordFormat, hostState, acceptProps, manageProps, generatedInputs, project, fillSlot, armElement, replaceRoot, checkFormat, checkInteger, forwardAttributes, resetForwardedAttributes, defineComponent, activateModule } from "@nextwebwg/html-next/generated-runtime";
|
|
3
3
|
import * as controller from "../components/ui-switcher/ui-switcher.js";
|
|
4
4
|
import "../styles/ui-switcher.css";
|
|
5
5
|
|
|
6
6
|
const T0 = ["",[],4];
|
|
7
7
|
const T1 = ["",[]];
|
|
8
|
-
|
|
8
|
+
const T2 = ["",[],"\n ",["div",["class","start"],4],"\n ",["div",["class","end"],4],"\n "];
|
|
9
|
+
const T3 = ["",[]];
|
|
10
|
+
const T4 = ["",[]];
|
|
11
|
+
let P0, P1, P2, P3, P4;
|
|
9
12
|
const S = { n: ["overLimit"], t: ["b"], f: import.meta.url, g: "ui-switcher", a: (host, I) => C(host, I), b: generatedInputs, i: [false] };
|
|
10
|
-
const
|
|
13
|
+
const A = [["div",{},[],"",[],["data-ui-switcher-state","data-ui-switcher-prop-align","data-ui-switcher-prop-balance","data-ui-switcher-prop-gap","data-ui-switcher-prop-limit","data-ui-switcher-prop-threshold"]],["div",{},[],"",[],["data-ui-switcher-state","data-ui-switcher-prop-align","data-ui-switcher-prop-balance","data-ui-switcher-prop-gap","data-ui-switcher-prop-limit","data-ui-switcher-prop-threshold"]]];
|
|
14
|
+
const Q = [[],[]];
|
|
15
|
+
const D = { g: "ui-switcher", props: { "align": { "required":false,"values":["start","center","end","stretch"], c: checkFormat("keyword", keywordFormat), t: "keyword", j: 0, m: ["p",formatOf(keywordFormat)] }, "balance": { "required":false,"values":["equal","narrow-start","narrow-end"],"default":"equal", c: checkFormat("keyword", keywordFormat), t: "keyword", j: 0, m: ["p",formatOf(keywordFormat)] }, "gap": { "required":false,"values":["xs","s","m","l","xl"], c: checkFormat("keyword", keywordFormat), t: "keyword", j: 0, m: ["p",formatOf(keywordFormat)] }, "limit": { "required":false, c: checkInteger, t: "integer", j: 0, m: "i" }, "threshold": { "required":false,"values":["xs","sm","md","lg"], c: checkFormat("keyword", keywordFormat), t: "keyword", j: 0, m: ["p",formatOf(keywordFormat)] } } };
|
|
11
16
|
const C = (host) => activateModule(controller, host);
|
|
12
17
|
|
|
13
18
|
export function createUiSwitcher(options = {}, html) {
|
|
14
19
|
const { attributes: authoredAttributes = {}, children = [], slots = {}, ...componentProps } = options;
|
|
15
|
-
const attributes = Object.fromEntries([...[], ...Object.entries(authoredAttributes)].filter(([name]) => !["align","gap","limit","threshold"].includes(name)));
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
const attributes = Object.fromEntries([...[], ...Object.entries(authoredAttributes)].filter(([name]) => !["align","balance","gap","limit","threshold"].includes(name)));
|
|
21
|
+
const v = [false, null, null, null, null, null];
|
|
22
|
+
let B = acceptProps(undefined, D, S.n, v, componentProps, [], html);
|
|
23
|
+
let a = (truthy(equalValue(v[2], "equal")) ? 0 : 1);
|
|
24
|
+
let element;
|
|
25
|
+
if (a === 0) {
|
|
26
|
+
element = document.createElement("div");
|
|
27
|
+
element.setAttribute("component", "ui-switcher");
|
|
28
|
+
} else {
|
|
29
|
+
element = document.createElement("div");
|
|
30
|
+
element.setAttribute("component", "ui-switcher");
|
|
31
|
+
}
|
|
32
|
+
B = acceptProps(element, D, S.n, v, componentProps, Q[a], html);
|
|
21
33
|
const m1 = (d) => {
|
|
22
34
|
const n = (P1 ??= buildTemplate(T1)).cloneNode(true);
|
|
23
35
|
const r = { n };
|
|
@@ -26,13 +38,36 @@ export function createUiSwitcher(options = {}, html) {
|
|
|
26
38
|
};
|
|
27
39
|
const p1 = (r, c, d) => {
|
|
28
40
|
};
|
|
41
|
+
const m3 = (d) => {
|
|
42
|
+
const n = (P3 ??= buildTemplate(T3)).cloneNode(true);
|
|
43
|
+
const r = { n };
|
|
44
|
+
p3(r, -1, d);
|
|
45
|
+
return r;
|
|
46
|
+
};
|
|
47
|
+
const p3 = (r, c, d) => {
|
|
48
|
+
};
|
|
49
|
+
const m4 = (d) => {
|
|
50
|
+
const n = (P4 ??= buildTemplate(T4)).cloneNode(true);
|
|
51
|
+
const r = { n };
|
|
52
|
+
p4(r, -1, d);
|
|
53
|
+
return r;
|
|
54
|
+
};
|
|
55
|
+
const p4 = (r, c, d) => {
|
|
56
|
+
};
|
|
57
|
+
const m0 = (n, d) => {
|
|
58
|
+
n.append((P0 ??= buildTemplate(T0)).cloneNode(true));
|
|
59
|
+
const t0 = n.firstChild;
|
|
60
|
+
const r = { n, v0: undefined, v1: undefined, a1: t0, e0: t0.nextSibling, b0: undefined, f0: undefined };
|
|
61
|
+
p0(r, -1, d);
|
|
62
|
+
return r;
|
|
63
|
+
};
|
|
29
64
|
const p0 = (r, c, d) => {
|
|
30
65
|
if (c === -1) {
|
|
31
66
|
resetForwardedAttributes(r.n, attributes, r.v0);
|
|
32
67
|
r.v0 = forwardAttributes(r.n, attributes);
|
|
33
68
|
}
|
|
34
|
-
if (c &
|
|
35
|
-
const x0 = hostState(["overLimit","gap","threshold","align"], [v[0], v[2], v[
|
|
69
|
+
if (c & 47) {
|
|
70
|
+
const x0 = hostState(["overLimit","balance","gap","threshold","align"], [v[0], v[2], v[3], v[5], v[1]]);
|
|
36
71
|
const s1 = x0;
|
|
37
72
|
if (s1 !== r.v1) writeAttribute(r.n, "data-ui-switcher-state", (r.v1 = s1) === "" ? null : s1);
|
|
38
73
|
}
|
|
@@ -40,14 +75,59 @@ export function createUiSwitcher(options = {}, html) {
|
|
|
40
75
|
if (Array.isArray(at)) (r.z ??= []).push(() => { at[0].l.delete(at[1]); dispose(at[1]); }); else if (at !== undefined) { r.b0 = m1(d); at.before(r.b0.n); } }
|
|
41
76
|
else if (r.b0 !== undefined) p1(r.b0, c, d);
|
|
42
77
|
};
|
|
43
|
-
const
|
|
44
|
-
|
|
78
|
+
const m2 = (n, d) => {
|
|
79
|
+
n.append((P2 ??= buildTemplate(T2)).cloneNode(true));
|
|
80
|
+
const t0 = n.firstChild.nextSibling;
|
|
81
|
+
const t1 = t0.firstChild;
|
|
82
|
+
const t2 = t0.nextSibling.nextSibling.firstChild;
|
|
83
|
+
const r = { n, v0: undefined, v1: undefined, a1: t1, e0: t1.nextSibling, b0: undefined, f0: undefined, a2: t2, e1: t2.nextSibling, b1: undefined, f1: undefined };
|
|
84
|
+
p2(r, -1, d);
|
|
85
|
+
return r;
|
|
86
|
+
};
|
|
87
|
+
const p2 = (r, c, d) => {
|
|
88
|
+
if (c === -1) {
|
|
89
|
+
resetForwardedAttributes(r.n, attributes, r.v0);
|
|
90
|
+
r.v0 = forwardAttributes(r.n, attributes);
|
|
91
|
+
}
|
|
92
|
+
if (c & 47) {
|
|
93
|
+
const x0 = hostState(["overLimit","balance","gap","threshold","align"], [v[0], v[2], v[3], v[5], v[1]]);
|
|
94
|
+
const s1 = x0;
|
|
95
|
+
if (s1 !== r.v1) writeAttribute(r.n, "data-ui-switcher-state", (r.v1 = s1) === "" ? null : s1);
|
|
96
|
+
}
|
|
97
|
+
if (r.f0 === undefined) { r.f0 = 1; const at = fillSlot(r.a1, r.e0, "start", J, false, undefined, d);
|
|
98
|
+
if (Array.isArray(at)) (r.z ??= []).push(() => { at[0].l.delete(at[1]); dispose(at[1]); }); else if (at !== undefined) { r.b0 = m3(d); at.before(r.b0.n); } }
|
|
99
|
+
else if (r.b0 !== undefined) p3(r.b0, c, d);
|
|
100
|
+
if (r.f1 === undefined) { r.f1 = 1; const at = fillSlot(r.a2, r.e1, "end", J, false, undefined, d);
|
|
101
|
+
if (Array.isArray(at)) (r.z ??= []).push(() => { at[0].l.delete(at[1]); dispose(at[1]); }); else if (at !== undefined) { r.b1 = m4(d); at.before(r.b1.n); } }
|
|
102
|
+
else if (r.b1 !== undefined) p4(r.b1, c, d);
|
|
103
|
+
};
|
|
104
|
+
const M = [m0, m2], N = [p0, p2];
|
|
105
|
+
let R;
|
|
106
|
+
const p = (c, d) => {
|
|
107
|
+
if (R === null) return;
|
|
108
|
+
if (R === undefined) { R = M[a](element, d); return; }
|
|
109
|
+
if (c & 4) {
|
|
110
|
+
const t = (truthy(equalValue(v[2], "equal")) ? 0 : 1);
|
|
111
|
+
if (t !== a) {
|
|
112
|
+
dispose(R);
|
|
113
|
+
for (const key in I.r) delete I.r[key];
|
|
114
|
+
const previous = I.e, next = armElement(previous, A[a], A[t]);
|
|
115
|
+
I.B.b = Q[t];
|
|
116
|
+
a = t;
|
|
117
|
+
R = null;
|
|
118
|
+
R = M[t](next, d);
|
|
119
|
+
replaceRoot(I, previous, next);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
N[a](R, c, d);
|
|
124
|
+
};
|
|
45
125
|
const I = { B };
|
|
46
126
|
const J = project(I, children, slots);
|
|
47
127
|
I.R = new Set();
|
|
48
|
-
I.F = { values: attributes, draw: () => (
|
|
49
|
-
attachGeneratedController(element, S, v, (c, d) => { (
|
|
128
|
+
I.F = { values: attributes, draw: () => p(-1) };
|
|
129
|
+
attachGeneratedController(element, S, v, (c, d) => { p(c, d); for (const f of I.R) f(c, d); }, undefined, undefined, I);
|
|
50
130
|
manageProps(I);
|
|
51
131
|
return element;
|
|
52
132
|
}
|
|
53
|
-
defineComponent("ui-switcher", createUiSwitcher, ["align","gap","limit","threshold"]);
|
|
133
|
+
defineComponent("ui-switcher", createUiSwitcher, ["align","balance","gap","limit","threshold"]);
|