@threadlabs/looma 0.16.2 → 0.16.4
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-button/ui-button.html +6 -0
- package/components/ui-form-field/ui-form-field.html +29 -5
- package/components/ui-input/ui-input.html +9 -4
- package/components/ui-input/ui-input.js +8 -2
- package/components/ui-nav-item/ui-nav-item.html +5 -1
- package/components/ui-select/ui-select.html +25 -5
- package/components/ui-text/ui-text.html +17 -4
- package/dist/index.js +1 -1
- package/editor/chunks/extensions.js +13 -1
- package/package.json +1 -1
- package/styles/ui-button.css +6 -0
- package/styles/ui-form-field.css +29 -5
- package/styles/ui-input.css +5 -1
- package/styles/ui-nav-item.css +5 -1
- package/styles/ui-select.css +25 -5
- package/styles/ui-text.css +14 -2
- package/vanilla/UiInput.d.ts +1 -1
- package/vanilla/UiInput.js +1 -1
- package/vanilla/UiText.d.ts +1 -1
- package/vanilla/UiText.js +76 -1
- package/vue/UiButton.vue +6 -0
- package/vue/UiFormField.vue +29 -5
- package/vue/UiInput.d.ts +2 -2
- package/vue/UiInput.vue +7 -3
- package/vue/UiNavItem.vue +5 -1
- package/vue/UiSelect.vue +28 -5
- package/vue/UiText.d.ts +13 -3
- package/vue/UiText.vue +50 -2
- package/vue/chunks/UiButton.js +1 -1
- package/vue/chunks/UiFormField.js +1 -1
- package/vue/chunks/UiInput.js +1 -1
- package/vue/chunks/UiNavItem.js +1 -1
- package/vue/chunks/UiSelect.js +1 -1
- package/vue/chunks/UiText.js +23 -3
- package/vue/components.css +197 -128
- package/vue/editor/index.js +14 -3
|
@@ -119,6 +119,10 @@
|
|
|
119
119
|
syntax: "*";
|
|
120
120
|
inherits: false;
|
|
121
121
|
}
|
|
122
|
+
@property --ui-button-white-space {
|
|
123
|
+
syntax: "*";
|
|
124
|
+
inherits: false;
|
|
125
|
+
}
|
|
122
126
|
|
|
123
127
|
:host {
|
|
124
128
|
--_hue: var(--ui-accent);
|
|
@@ -162,6 +166,8 @@
|
|
|
162
166
|
font: inherit;
|
|
163
167
|
font-weight: var(--ui-font-medium);
|
|
164
168
|
text-decoration: none;
|
|
169
|
+
/* Unset, a button wraps as its container does. */
|
|
170
|
+
white-space: var(--ui-button-white-space, inherit);
|
|
165
171
|
line-height: var(--ui-line-height-tight);
|
|
166
172
|
padding: var(--ui-space-2) var(--ui-space-3);
|
|
167
173
|
background-image: var(--ui-raised-highlight);
|
|
@@ -25,19 +25,43 @@
|
|
|
25
25
|
syntax: "*";
|
|
26
26
|
inherits: false;
|
|
27
27
|
}
|
|
28
|
+
@property --ui-form-field-help-font-size {
|
|
29
|
+
syntax: "*";
|
|
30
|
+
inherits: false;
|
|
31
|
+
}
|
|
28
32
|
@property --ui-form-field-help-min-block-size {
|
|
29
33
|
syntax: "*";
|
|
30
34
|
inherits: false;
|
|
31
35
|
}
|
|
36
|
+
@property --ui-form-field-help-text {
|
|
37
|
+
syntax: "*";
|
|
38
|
+
inherits: false;
|
|
39
|
+
}
|
|
40
|
+
@property --ui-form-field-label-font-size {
|
|
41
|
+
syntax: "*";
|
|
42
|
+
inherits: false;
|
|
43
|
+
}
|
|
44
|
+
@property --ui-form-field-label-text {
|
|
45
|
+
syntax: "*";
|
|
46
|
+
inherits: false;
|
|
47
|
+
}
|
|
48
|
+
@property --ui-form-field-min-inline-size {
|
|
49
|
+
syntax: "*";
|
|
50
|
+
inherits: false;
|
|
51
|
+
}
|
|
32
52
|
|
|
33
53
|
:host {
|
|
34
54
|
/* Hooks do not inherit, so the parts below read them from the root. */
|
|
35
55
|
--_ui-form-field-danger: var(--ui-form-field-danger);
|
|
36
56
|
--_ui-form-field-help-min-block-size: var(--ui-form-field-help-min-block-size);
|
|
57
|
+
--_ui-form-field-label-text: var(--ui-form-field-label-text);
|
|
58
|
+
--_ui-form-field-label-font-size: var(--ui-form-field-label-font-size);
|
|
59
|
+
--_ui-form-field-help-text: var(--ui-form-field-help-text);
|
|
60
|
+
--_ui-form-field-help-font-size: var(--ui-form-field-help-font-size);
|
|
37
61
|
|
|
38
62
|
display: grid;
|
|
39
63
|
gap: var(--ui-space-2);
|
|
40
|
-
min-inline-size: 0;
|
|
64
|
+
min-inline-size: var(--ui-form-field-min-inline-size, 0);
|
|
41
65
|
align-content: start;
|
|
42
66
|
color: var(--ui-text-primary);
|
|
43
67
|
}
|
|
@@ -51,8 +75,8 @@
|
|
|
51
75
|
}
|
|
52
76
|
|
|
53
77
|
.label {
|
|
54
|
-
color: var(--ui-text-secondary);
|
|
55
|
-
font-size: var(--ui-font-size-sm);
|
|
78
|
+
color: var(--_ui-form-field-label-text, var(--ui-text-secondary));
|
|
79
|
+
font-size: var(--_ui-form-field-label-font-size, var(--ui-font-size-sm));
|
|
56
80
|
}
|
|
57
81
|
|
|
58
82
|
/* A label action, such as a small help button, sits after the label text in a box one line
|
|
@@ -75,8 +99,8 @@
|
|
|
75
99
|
}
|
|
76
100
|
|
|
77
101
|
.help {
|
|
78
|
-
color: var(--ui-text-muted);
|
|
79
|
-
font-size: var(--ui-font-size-sm);
|
|
102
|
+
color: var(--_ui-form-field-help-text, var(--ui-text-muted));
|
|
103
|
+
font-size: var(--_ui-form-field-help-font-size, var(--ui-font-size-sm));
|
|
80
104
|
line-height: var(--ui-line-height-md);
|
|
81
105
|
}
|
|
82
106
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<template component="ui-input" controller="./ui-input.js">
|
|
2
2
|
<defs>
|
|
3
|
-
<prop name="value" type="string"
|
|
4
|
-
>The input's text. Setting or changing it replaces the live text; between changes the user's typing stands, so
|
|
5
|
-
also the input's default, so a form
|
|
3
|
+
<prop name="value" type="string | number"
|
|
4
|
+
>The input's value: text, or a number for a type="number" field. Setting or changing it replaces the live text; between changes the user's typing stands, so
|
|
5
|
+
follow input events to keep it in step. A number field keeps text that means the same number, such as 1.0 for 1. It is also the input's default, so a form
|
|
6
|
+
reset returns to it.</prop>
|
|
6
7
|
<prop name="disabled" type="boolean" default="false">Prevents editing and form submission.</prop>
|
|
7
8
|
<prop name="invalid" type="boolean" default="false">Exposes invalid state to assistive technology and styling.</prop>
|
|
8
9
|
<prop name="readonly" type="boolean" default="false">Allows selection without allowing edits.</prop>
|
|
@@ -41,6 +42,10 @@
|
|
|
41
42
|
syntax: "*";
|
|
42
43
|
inherits: false;
|
|
43
44
|
}
|
|
45
|
+
@property --ui-input-inline-size {
|
|
46
|
+
syntax: "*";
|
|
47
|
+
inherits: false;
|
|
48
|
+
}
|
|
44
49
|
@property --ui-input-invalid-border {
|
|
45
50
|
syntax: "*";
|
|
46
51
|
inherits: false;
|
|
@@ -69,7 +74,7 @@
|
|
|
69
74
|
:host {
|
|
70
75
|
box-sizing: border-box;
|
|
71
76
|
display: inline-block;
|
|
72
|
-
inline-size: 100
|
|
77
|
+
inline-size: var(--ui-input-inline-size, 100%);
|
|
73
78
|
min-inline-size: 0;
|
|
74
79
|
min-block-size: var(--ui-input-min-block-size, var(--_ui-default-input-min-block-size, var(--ui-control-size-md)));
|
|
75
80
|
margin: 0;
|
|
@@ -4,7 +4,13 @@ export default function controller(host) {
|
|
|
4
4
|
return host.effect(() => {
|
|
5
5
|
const value = host.state.value;
|
|
6
6
|
if (value === undefined || value === null) return;
|
|
7
|
-
host.element
|
|
8
|
-
|
|
7
|
+
const input = host.element;
|
|
8
|
+
const text = String(value);
|
|
9
|
+
input.defaultValue = text;
|
|
10
|
+
if (input.value === text) return;
|
|
11
|
+
// A number field's text can differ from the number it means (1.0 is 1, and Chromium reads 12. as
|
|
12
|
+
// 12). Writing the value would erase what the user is typing, so a field that means it stays.
|
|
13
|
+
if (input.type === "number" && input.value !== "" && Number(input.value) === Number(value)) return;
|
|
14
|
+
input.value = text;
|
|
9
15
|
});
|
|
10
16
|
}
|
|
@@ -52,6 +52,10 @@
|
|
|
52
52
|
syntax: "*";
|
|
53
53
|
inherits: false;
|
|
54
54
|
}
|
|
55
|
+
@property --ui-nav-item-inline-size {
|
|
56
|
+
syntax: "*";
|
|
57
|
+
inherits: false;
|
|
58
|
+
}
|
|
55
59
|
|
|
56
60
|
/* One destination in a side or rail navigation: an icon to find it by (leading), its name (the
|
|
57
61
|
default slot), and an optional line under it (description), such as the record a section
|
|
@@ -65,7 +69,7 @@
|
|
|
65
69
|
display: flex;
|
|
66
70
|
align-items: center;
|
|
67
71
|
gap: var(--ui-space-3);
|
|
68
|
-
inline-size: 100
|
|
72
|
+
inline-size: var(--ui-nav-item-inline-size, 100%);
|
|
69
73
|
min-inline-size: 0;
|
|
70
74
|
min-block-size: var(--ui-control-size, 2.5rem);
|
|
71
75
|
margin: 0;
|
|
@@ -15,10 +15,26 @@
|
|
|
15
15
|
<select :disabled="disabled" :required="required" :aria-invalid="invalid"><slot></slot></select>
|
|
16
16
|
<style>
|
|
17
17
|
/* This component's hooks style the element they are set on, and never a nested one. */
|
|
18
|
+
@property --ui-select-border {
|
|
19
|
+
syntax: "*";
|
|
20
|
+
inherits: false;
|
|
21
|
+
}
|
|
22
|
+
@property --ui-select-border-hover {
|
|
23
|
+
syntax: "*";
|
|
24
|
+
inherits: false;
|
|
25
|
+
}
|
|
26
|
+
@property --ui-select-focus-border {
|
|
27
|
+
syntax: "*";
|
|
28
|
+
inherits: false;
|
|
29
|
+
}
|
|
18
30
|
@property --ui-select-focus-shadow {
|
|
19
31
|
syntax: "*";
|
|
20
32
|
inherits: false;
|
|
21
33
|
}
|
|
34
|
+
@property --ui-select-inline-size {
|
|
35
|
+
syntax: "*";
|
|
36
|
+
inherits: false;
|
|
37
|
+
}
|
|
22
38
|
@property --ui-select-invalid-border {
|
|
23
39
|
syntax: "*";
|
|
24
40
|
inherits: false;
|
|
@@ -35,18 +51,22 @@
|
|
|
35
51
|
syntax: "*";
|
|
36
52
|
inherits: false;
|
|
37
53
|
}
|
|
54
|
+
@property --ui-select-surface {
|
|
55
|
+
syntax: "*";
|
|
56
|
+
inherits: false;
|
|
57
|
+
}
|
|
38
58
|
|
|
39
59
|
:host {
|
|
40
60
|
box-sizing: border-box;
|
|
41
61
|
display: inline-block;
|
|
42
|
-
inline-size: 100
|
|
62
|
+
inline-size: var(--ui-select-inline-size, 100%);
|
|
43
63
|
min-inline-size: 0;
|
|
44
64
|
min-block-size: var(--ui-control-size-md);
|
|
45
65
|
margin: 0;
|
|
46
66
|
padding: var(--ui-space-2) var(--ui-space-3);
|
|
47
|
-
border: 1px solid var(--ui-control-border, var(--ui-border-strong));
|
|
67
|
+
border: 1px solid var(--ui-select-border, var(--ui-control-border, var(--ui-border-strong)));
|
|
48
68
|
border-radius: var(--ui-select-radius, var(--ui-field-radius, var(--ui-radius-md)));
|
|
49
|
-
background-color: var(--ui-control-surface, var(--ui-surface-elevated));
|
|
69
|
+
background-color: var(--ui-select-surface, var(--ui-control-surface, var(--ui-surface-elevated)));
|
|
50
70
|
color: var(--ui-text-primary);
|
|
51
71
|
color-scheme: light dark;
|
|
52
72
|
font: inherit;
|
|
@@ -73,11 +93,11 @@
|
|
|
73
93
|
}
|
|
74
94
|
|
|
75
95
|
:host:hover:not(:focus):not(:disabled) {
|
|
76
|
-
border-color: var(--ui-control-border-hover, var(--ui-text-secondary));
|
|
96
|
+
border-color: var(--ui-select-border-hover, var(--ui-control-border-hover, var(--ui-text-secondary)));
|
|
77
97
|
}
|
|
78
98
|
|
|
79
99
|
:host:focus-visible {
|
|
80
|
-
border-color: var(--ui-control-focus, var(--ui-accent-solid));
|
|
100
|
+
border-color: var(--ui-select-focus-border, var(--ui-control-focus, var(--ui-accent-solid)));
|
|
81
101
|
outline: none;
|
|
82
102
|
box-shadow: var(--ui-select-focus-shadow, var(--ui-control-inset), var(--ui-control-focus-halo-shadow));
|
|
83
103
|
}
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
exactly, such as an address, in the monospace face.</prop>
|
|
15
15
|
<prop name="truncate" type="boolean" default="false">Keeps the text on one line, ending in an ellipsis when it does not fit.</prop>
|
|
16
16
|
<prop name="align" type="start | center" default="start">Aligns the text within its line.</prop>
|
|
17
|
-
<prop name="as" type="p | span | div | small | strong | label" default="p"
|
|
18
|
-
>The native element the text renders: a paragraph by default, inline span, small, or strong within a line, a div for a block,
|
|
19
|
-
|
|
17
|
+
<prop name="as" type="p | span | div | small | strong | label | h2 | h3 | h4 | h5 | h6" default="p"
|
|
18
|
+
>The native element the text renders: a paragraph by default, inline span, small, or strong within a line, a div for a block, a label for a control, or a
|
|
19
|
+
heading, h2 to h6, below a Page Header's h1 and a Section's h2. A heading takes its size and weight from size and weight, like any other text.</prop>
|
|
20
20
|
</defs>
|
|
21
21
|
<template $match>
|
|
22
22
|
<span $when="as = 'span'"><slot></slot></span>
|
|
@@ -24,11 +24,17 @@
|
|
|
24
24
|
<small $when="as = 'small'"><slot></slot></small>
|
|
25
25
|
<strong $when="as = 'strong'"><slot></slot></strong>
|
|
26
26
|
<label $when="as = 'label'"><slot></slot></label>
|
|
27
|
+
<h2 $when="as = 'h2'"><slot></slot></h2>
|
|
28
|
+
<h3 $when="as = 'h3'"><slot></slot></h3>
|
|
29
|
+
<h4 $when="as = 'h4'"><slot></slot></h4>
|
|
30
|
+
<h5 $when="as = 'h5'"><slot></slot></h5>
|
|
31
|
+
<h6 $when="as = 'h6'"><slot></slot></h6>
|
|
27
32
|
<p $else><slot></slot></p>
|
|
28
33
|
</template>
|
|
29
34
|
<style>
|
|
30
35
|
/* Running text, set on the type scale and in a tone that says what it is, so a view never styles
|
|
31
|
-
text of its own. The root is a paragraph unless as= names a span, div, small, strong,
|
|
36
|
+
text of its own. The root is a paragraph unless as= names a span, div, small, strong, label, or
|
|
37
|
+
heading. */
|
|
32
38
|
:host {
|
|
33
39
|
margin: 0;
|
|
34
40
|
min-inline-size: 0;
|
|
@@ -36,6 +42,13 @@
|
|
|
36
42
|
text-align: start;
|
|
37
43
|
}
|
|
38
44
|
|
|
45
|
+
/* A heading drops the browser's heading size and weight, so size and weight set it as they set
|
|
46
|
+
any text, and inherit keeps the text around it. */
|
|
47
|
+
:host:is(h2, h3, h4, h5, h6) {
|
|
48
|
+
font-size: inherit;
|
|
49
|
+
font-weight: inherit;
|
|
50
|
+
}
|
|
51
|
+
|
|
39
52
|
:host-state([size="xs"]) {
|
|
40
53
|
font-size: var(--ui-font-size-xs);
|
|
41
54
|
line-height: var(--ui-line-height);
|