@threadlabs/looma 0.9.2 → 0.10.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/components/shared/form-reset.js +21 -0
- package/components/ui-checkbox/ui-checkbox.html +17 -4
- package/components/ui-checkbox/ui-checkbox.js +9 -0
- package/components/ui-combobox/ui-combobox.html +23 -11
- package/components/ui-combobox/ui-combobox.js +31 -12
- package/components/ui-editable/ui-editable.html +3 -1
- package/components/ui-editable/ui-editable.js +7 -6
- package/components/ui-editor-toolbar/ui-editor-toolbar.html +70 -20
- package/components/ui-editor-toolbar/ui-editor-toolbar.js +24 -0
- package/components/ui-input/ui-input.html +2 -2
- package/components/ui-input/ui-input.js +5 -2
- package/components/ui-radio/ui-radio.html +3 -1
- package/components/ui-radio/ui-radio.js +11 -0
- package/components/ui-radio-group/ui-radio-group.html +7 -5
- package/components/ui-radio-group/ui-radio-group.js +16 -3
- package/components/ui-search-result-row/ui-search-result-row.html +3 -3
- package/components/ui-select/ui-select.html +3 -1
- package/components/ui-select/ui-select.js +5 -2
- package/components/ui-switch/ui-switch.html +7 -4
- package/components/ui-switch/ui-switch.js +9 -0
- package/components/ui-textarea/ui-textarea.html +2 -2
- package/components/ui-textarea/ui-textarea.js +5 -2
- package/components/ui-tree-item/ui-tree-item.html +2 -2
- package/dist/index.js +20 -19
- package/package.json +1 -1
- package/styles/ui-editor-toolbar.css +72 -18
- package/vanilla/UiCheckbox.d.ts +1 -0
- package/vanilla/UiCheckbox.js +7 -4
- package/vanilla/UiCombobox.js +113 -99
- package/vanilla/UiEditorToolbar.js +11 -6
- package/vanilla/UiRadioGroup.js +7 -1
- package/vanilla/UiSearchResultRow.js +4 -1
- package/vanilla/UiSwitch.d.ts +1 -0
- package/vanilla/UiSwitch.js +7 -4
- package/vue/UiCheckbox.d.ts +2 -0
- package/vue/UiCheckbox.vue +3 -0
- package/vue/UiCombobox.vue +27 -4
- package/vue/UiEditorToolbar.vue +90 -20
- package/vue/UiRadioGroup.vue +2 -0
- package/vue/UiSearchResultRow.vue +1 -0
- package/vue/UiSwitch.d.ts +2 -0
- package/vue/UiSwitch.vue +3 -0
- package/vue/chunks/UiCheckbox.js +4 -1
- package/vue/chunks/UiCombobox.js +67 -39
- package/vue/chunks/UiEditorToolbar.js +33 -4
- package/vue/chunks/UiRadioGroup.js +8 -2
- package/vue/chunks/UiSearchResultRow.js +7 -2
- package/vue/chunks/UiSwitch.js +4 -1
- package/vue/components.css +159 -115
package/package.json
CHANGED
|
@@ -1,36 +1,83 @@
|
|
|
1
1
|
/* Generated by HTML Next 1.0.0-alpha.3. Do not edit. */
|
|
2
2
|
@scope ([data-component~="ui-editor-toolbar"]) to ([data-component], [data-slotted]) {
|
|
3
3
|
:scope {
|
|
4
|
+
/* The colour the edge fades blend into: whatever the toolbar is painted with. */
|
|
5
|
+
--_matte: var(--ui-editor-toolbar-surface, var(--ui-surface));
|
|
6
|
+
|
|
4
7
|
position: sticky;
|
|
5
8
|
top: 0;
|
|
6
9
|
z-index: var(--ui-editor-toolbar-z-index, 10);
|
|
7
10
|
display: flex;
|
|
8
11
|
align-items: center;
|
|
9
|
-
justify-content: flex-start;
|
|
10
|
-
gap: var(--ui-editor-toolbar-gap, 2px);
|
|
11
12
|
padding: var(--ui-editor-toolbar-padding-block, 6px) var(--ui-editor-toolbar-padding-inline, 12px);
|
|
12
13
|
min-height: var(--ui-editor-toolbar-min-height, 48px);
|
|
13
|
-
/* More controls than the column is wide is normal at a readable measure, so the row wraps.
|
|
14
|
-
Scrolling hid the tail behind an invisible scrollbar. */
|
|
15
|
-
flex-wrap: wrap;
|
|
16
|
-
row-gap: var(--ui-editor-toolbar-row-gap, var(--ui-editor-toolbar-gap, 2px));
|
|
17
14
|
background: var(--ui-editor-toolbar-surface, var(--ui-surface));
|
|
18
15
|
border-bottom: 1px solid var(--ui-editor-toolbar-border, var(--ui-border));
|
|
19
16
|
}
|
|
20
17
|
|
|
21
|
-
|
|
18
|
+
/* One row, always. When the controls outgrow the space, the row scrolls sideways rather than
|
|
19
|
+
wrapping into several lines, and a fade at each edge that has more to show says so. */
|
|
20
|
+
.strip {
|
|
21
|
+
display: flex;
|
|
22
|
+
flex: 1 1 auto;
|
|
23
|
+
align-items: center;
|
|
24
|
+
justify-content: flex-start;
|
|
25
|
+
gap: var(--ui-editor-toolbar-gap, 2px);
|
|
26
|
+
min-width: 0;
|
|
27
|
+
overflow-x: auto;
|
|
28
|
+
overflow-y: hidden;
|
|
29
|
+
overscroll-behavior-inline: contain;
|
|
30
|
+
scrollbar-width: none;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.strip::-webkit-scrollbar {
|
|
22
34
|
display: none;
|
|
23
35
|
}
|
|
24
36
|
|
|
37
|
+
/* The fades are mattes laid over the strip in the toolbar's own colour, not a mask, so a floating
|
|
38
|
+
toolbar's border and shadow stay whole. Each appears only while that edge hides controls. */
|
|
39
|
+
:scope::before,
|
|
40
|
+
:scope::after {
|
|
41
|
+
position: absolute;
|
|
42
|
+
z-index: 1;
|
|
43
|
+
inset-block: 0;
|
|
44
|
+
inline-size: var(--ui-editor-toolbar-fade-size, 32px);
|
|
45
|
+
content: "";
|
|
46
|
+
opacity: 0;
|
|
47
|
+
pointer-events: none;
|
|
48
|
+
transition: opacity var(--ui-motion-fast, 120ms) var(--ui-motion-ease, ease);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
:scope::before {
|
|
52
|
+
inset-inline-start: 0;
|
|
53
|
+
background: linear-gradient(to right, var(--_matte), transparent);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
:scope::after {
|
|
57
|
+
inset-inline-end: 0;
|
|
58
|
+
background: linear-gradient(to left, var(--_matte), transparent);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
:scope:dir(rtl)::before {
|
|
62
|
+
background: linear-gradient(to left, var(--_matte), transparent);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
:scope:dir(rtl)::after {
|
|
66
|
+
background: linear-gradient(to right, var(--_matte), transparent);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
:scope[data-ui-editor-toolbar-state~="overflowStart"]::before,
|
|
70
|
+
:scope[data-ui-editor-toolbar-state~="overflowEnd"]::after {
|
|
71
|
+
opacity: 1;
|
|
72
|
+
}
|
|
73
|
+
|
|
25
74
|
:scope[data-ui-editor-toolbar-state~="floating"] {
|
|
26
|
-
|
|
27
|
-
position: static;
|
|
75
|
+
position: relative;
|
|
28
76
|
top: auto;
|
|
29
77
|
width: max-content;
|
|
30
78
|
max-width: min(calc(100vw - 24px), 100%);
|
|
31
79
|
min-height: auto;
|
|
32
80
|
padding: var(--ui-editor-toolbar-floating-padding, 4px);
|
|
33
|
-
overflow-x: visible;
|
|
34
81
|
background: color-mix(in srgb, var(--ui-editor-toolbar-surface, var(--ui-surface)) 96%, transparent);
|
|
35
82
|
border: 1px solid var(--ui-editor-toolbar-border, var(--ui-border));
|
|
36
83
|
border-radius: var(--ui-editor-toolbar-floating-radius, var(--ui-radius-lg));
|
|
@@ -52,7 +99,7 @@
|
|
|
52
99
|
}
|
|
53
100
|
|
|
54
101
|
:scope[data-ui-editor-toolbar-state~="floating"] {
|
|
55
|
-
position:
|
|
102
|
+
position: relative;
|
|
56
103
|
inset: auto;
|
|
57
104
|
min-height: auto;
|
|
58
105
|
border: 1px solid var(--ui-editor-toolbar-border, var(--ui-border));
|
|
@@ -63,9 +110,10 @@
|
|
|
63
110
|
|
|
64
111
|
/* Inside LoomaEditor's sticky shell, the shell is the sticky surface. */
|
|
65
112
|
.looma-editor__sticky-toolbar-shell :scope {
|
|
66
|
-
|
|
113
|
+
--_matte: var(--ui-editor-toolbar-surface, var(--ui-surface));
|
|
114
|
+
|
|
115
|
+
position: relative;
|
|
67
116
|
min-height: var(--ui-editor-toolbar-min-height, 48px);
|
|
68
|
-
overscroll-behavior-inline: contain;
|
|
69
117
|
background: transparent;
|
|
70
118
|
border: 0;
|
|
71
119
|
box-shadow: none;
|
|
@@ -77,10 +125,6 @@
|
|
|
77
125
|
max-width: none;
|
|
78
126
|
min-height: 100%;
|
|
79
127
|
padding: 0;
|
|
80
|
-
overflow-x: auto;
|
|
81
|
-
overflow-y: hidden;
|
|
82
|
-
overscroll-behavior-inline: contain;
|
|
83
|
-
scroll-snap-type: x mandatory;
|
|
84
128
|
background: transparent;
|
|
85
129
|
border: 0;
|
|
86
130
|
border-radius: 0;
|
|
@@ -88,16 +132,26 @@
|
|
|
88
132
|
backdrop-filter: none;
|
|
89
133
|
}
|
|
90
134
|
|
|
135
|
+
.looma-editor__mobile-toolbar-shell :scope[data-ui-editor-toolbar-state~="floating"] .strip {
|
|
136
|
+
scroll-snap-type: x mandatory;
|
|
137
|
+
}
|
|
138
|
+
|
|
91
139
|
/* A component that sets its display still honours the hidden attribute on its root. */
|
|
92
140
|
:scope[hidden] {
|
|
93
141
|
display: none;
|
|
94
142
|
}
|
|
95
143
|
}
|
|
96
144
|
@scope ([data-component~="ui-editor-toolbar"]) to ([data-component]) {
|
|
97
|
-
|
|
145
|
+
/* One row, always. When the controls outgrow the space, the row scrolls sideways rather than
|
|
146
|
+
wrapping into several lines, and a fade at each edge that has more to show says so. */
|
|
147
|
+
|
|
148
|
+
.strip > :where([data-slotted], [data-slotted] *):is(*) {
|
|
98
149
|
flex: 0 0 auto;
|
|
99
150
|
}
|
|
100
151
|
|
|
152
|
+
/* The fades are mattes laid over the strip in the toolbar's own colour, not a mask, so a floating
|
|
153
|
+
toolbar's border and shadow stay whole. Each appears only while that edge hides controls. */
|
|
154
|
+
|
|
101
155
|
:where([data-slotted], [data-slotted] *):is(.divider) {
|
|
102
156
|
width: 1px;
|
|
103
157
|
height: 20px;
|
package/vanilla/UiCheckbox.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export interface UiCheckboxProps {
|
|
|
10
10
|
checked?: boolean | null;
|
|
11
11
|
disabled?: boolean | null;
|
|
12
12
|
indeterminate?: boolean | null;
|
|
13
|
+
name?: string | null;
|
|
13
14
|
required?: boolean | null;
|
|
14
15
|
value?: string | null;
|
|
15
16
|
attributes?: Readonly<Record<string, string | number | boolean | null | undefined>>;
|
package/vanilla/UiCheckbox.js
CHANGED
|
@@ -3,7 +3,7 @@ import { manageComponentLifecycle } from "@nextwebwg/html-next/runtime";
|
|
|
3
3
|
import * as controller from "../components/ui-checkbox/ui-checkbox.js";
|
|
4
4
|
import "../styles/ui-checkbox.css";
|
|
5
5
|
|
|
6
|
-
const definition = {...{"contract":{"tag":"ui-checkbox","props":{"checked":{"type":"boolean","required":false,"target":{"attribute":"checked"},"default":false},"disabled":{"type":"boolean","required":false,"target":{"attribute":"disabled"},"default":false},"indeterminate":{"type":"boolean","required":false,"target":{"property":"indeterminate"},"default":false},"required":{"type":"boolean","required":false,"target":{"attribute":"required"},"default":false},"value":{"type":"string","required":false,"target":{"attribute":"value"},"default":"on"}}},"template":{"kind":"element","name":"label","attributes":[],"children":[{"kind":"element","name":"input","attributes":[{"kind":"literal","name":"type","value":"checkbox"},{"kind":"property","key":"checked","name":"checked","expression":"internalChecked","expressionPlan":{"source":"internalChecked","ast":{"kind":"id","name":"internalChecked"},"dependencies":["internalChecked"]}},{"kind":"property","key":"indeterminate","name":"indeterminate","expression":"indeterminate","expressionPlan":{"source":"indeterminate","ast":{"kind":"id","name":"indeterminate"},"dependencies":["indeterminate"]}},{"kind":"attribute","name":"disabled","expression":"disabled","expressionPlan":{"source":"disabled","ast":{"kind":"id","name":"disabled"},"dependencies":["disabled"]}},{"kind":"attribute","name":"required","expression":"required","expressionPlan":{"source":"required","ast":{"kind":"id","name":"required"},"dependencies":["required"]}},{"kind":"attribute","name":"value","expression":"value","expressionPlan":{"source":"value","ast":{"kind":"id","name":"value"},"dependencies":["value"]}}],"children":[],"ref":"input"},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"label"}],"children":[{"kind":"slot"}]}]},"declarations":[{"kind":"state","name":"internalChecked","expression":{"source":"false","ast":{"kind":"literal","value":false},"dependencies":[]}},{"kind":"event","name":"change","type":"object({ checked: boolean, value: string, trigger: keyboard | pointer | programmatic })","bubbles":true,"composed":true,"cancelable":false}],"root":{"kind":"native","element":"label","choices":["label"]}},source:{file:import.meta.url},css:""};
|
|
6
|
+
const definition = {...{"contract":{"tag":"ui-checkbox","props":{"checked":{"type":"boolean","required":false,"target":{"attribute":"checked"},"default":false},"disabled":{"type":"boolean","required":false,"target":{"attribute":"disabled"},"default":false},"indeterminate":{"type":"boolean","required":false,"target":{"property":"indeterminate"},"default":false},"name":{"type":"string","required":false,"target":{"attribute":"name"},"default":""},"required":{"type":"boolean","required":false,"target":{"attribute":"required"},"default":false},"value":{"type":"string","required":false,"target":{"attribute":"value"},"default":"on"}}},"template":{"kind":"element","name":"label","attributes":[],"children":[{"kind":"element","name":"input","attributes":[{"kind":"literal","name":"type","value":"checkbox"},{"kind":"property","key":"checked","name":"checked","expression":"internalChecked","expressionPlan":{"source":"internalChecked","ast":{"kind":"id","name":"internalChecked"},"dependencies":["internalChecked"]}},{"kind":"property","key":"indeterminate","name":"indeterminate","expression":"indeterminate","expressionPlan":{"source":"indeterminate","ast":{"kind":"id","name":"indeterminate"},"dependencies":["indeterminate"]}},{"kind":"attribute","name":"disabled","expression":"disabled","expressionPlan":{"source":"disabled","ast":{"kind":"id","name":"disabled"},"dependencies":["disabled"]}},{"kind":"attribute","name":"required","expression":"required","expressionPlan":{"source":"required","ast":{"kind":"id","name":"required"},"dependencies":["required"]}},{"kind":"attribute","name":"name","expression":"name","expressionPlan":{"source":"name","ast":{"kind":"id","name":"name"},"dependencies":["name"]}},{"kind":"attribute","name":"value","expression":"value","expressionPlan":{"source":"value","ast":{"kind":"id","name":"value"},"dependencies":["value"]}}],"children":[],"ref":"input"},{"kind":"element","name":"span","attributes":[{"kind":"literal","name":"class","value":"label"}],"children":[{"kind":"slot"}]}]},"declarations":[{"kind":"state","name":"internalChecked","expression":{"source":"false","ast":{"kind":"literal","value":false},"dependencies":[]}},{"kind":"event","name":"change","type":"object({ checked: boolean, value: string, trigger: keyboard | pointer | programmatic })","bubbles":true,"composed":true,"cancelable":false}],"root":{"kind":"native","element":"label","choices":["label"]}},source:{file:import.meta.url},css:""};
|
|
7
7
|
|
|
8
8
|
export function createUiCheckbox(options = {}) {
|
|
9
9
|
const { attributes = {}, children = [], slots = {}, as, ...componentProps } = options;
|
|
@@ -24,9 +24,12 @@ export function createUiCheckbox(options = {}) {
|
|
|
24
24
|
const value2 = componentProps["required"] === undefined ? false : componentProps["required"];
|
|
25
25
|
if (value2 === true) element0.setAttribute("required", "");
|
|
26
26
|
else element0.removeAttribute("required");
|
|
27
|
-
const value3 = componentProps["
|
|
28
|
-
if (value3 === null || value3 === undefined) element0.removeAttribute("
|
|
29
|
-
else element0.setAttribute("
|
|
27
|
+
const value3 = componentProps["name"] === undefined ? "" : componentProps["name"];
|
|
28
|
+
if (value3 === null || value3 === undefined) element0.removeAttribute("name");
|
|
29
|
+
else element0.setAttribute("name", String(value3));
|
|
30
|
+
const value4 = componentProps["value"] === undefined ? "on" : componentProps["value"];
|
|
31
|
+
if (value4 === null || value4 === undefined) element0.removeAttribute("value");
|
|
32
|
+
else element0.setAttribute("value", String(value4));
|
|
30
33
|
element.append(element0);
|
|
31
34
|
const element1 = document.createElement("span");
|
|
32
35
|
element1.setAttribute("class", "label");
|