lostcoords-ui 0.14.4 → 0.14.5
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.
- checksums.yaml +4 -4
- data/README.md +21 -0
- data/app/assets/tailwind/lostcoords/ui/base.css +1 -2
- data/app/assets/tailwind/lostcoords/ui/emoji-picker.css +0 -5
- data/app/assets/tailwind/lostcoords/ui/utilities.css +8 -0
- data/app/helpers/lostcoords/ui/form_helper.rb +1 -2
- data/app/helpers/lostcoords/ui/list_group_helper.rb +1 -2
- data/app/javascript/lostcoords/ui/controllers/lc_emoji_picker_controller.js +7 -1
- data/lib/lostcoords/ui/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e061ef0f5e56280a6a307f83c8973c5ee67f559e51fad6c204dbb0e4a1f14b06
|
|
4
|
+
data.tar.gz: eb9d51da41159c64e095c9a2b278062056c1551f942a99b8db284e08f2faf09a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5b5bfe64afe74ec39952deb44ba4e61b81bac7ea1ced30bd5e8e49ba712cc30df155f62385515ca837eeadf117a1e1ebf3ec70654714eac8baa6db1b604d01fb
|
|
7
|
+
data.tar.gz: c23667fe2803b558ffddc30e92f1195bacfa833c74d19461b42d9d66a5a45f866ab8d9f1c9b17d0fd263dd10ffb4f9449d057ff65e884bc7f86814ba8126db97
|
data/README.md
CHANGED
|
@@ -170,6 +170,22 @@ Omit `only` to register every library controller. Unknown identifiers raise befo
|
|
|
170
170
|
registered, and repeated calls on the same application keep later overrides, so register defaults
|
|
171
171
|
before application overrides.
|
|
172
172
|
|
|
173
|
+
## Changes in 0.14.5
|
|
174
|
+
|
|
175
|
+
One edit, only for a host that skips `base.css`:
|
|
176
|
+
|
|
177
|
+
- **The focus ring is drawn in one place, `lc-focus-ring`.** Fields and the emoji picker's search drew their
|
|
178
|
+
own copy as a box shadow, and a linked list row drew a third with a different offset. They now take the
|
|
179
|
+
shared ring: `base.css` applies it to whatever holds keyboard focus, and the list row applies the same
|
|
180
|
+
utility while its link has focus. A host with its own base styles gets its own focus style on fields; to
|
|
181
|
+
keep the library's, add `:is(input, textarea, select):focus-visible { @apply lc-focus-ring; }`.
|
|
182
|
+
|
|
183
|
+
Faster:
|
|
184
|
+
|
|
185
|
+
- **The emoji catalog loads when someone reaches for the picker** (pointer, touch or focus), not with every
|
|
186
|
+
page that has one. It is every emoji there is, about 900KB of markup; opening the picker waits for the
|
|
187
|
+
same request.
|
|
188
|
+
|
|
173
189
|
## Changes in 0.14.4
|
|
174
190
|
|
|
175
191
|
Nothing needs an edit. Focus behaves more like the platform:
|
|
@@ -1140,6 +1156,11 @@ closed from inside, such as by choosing a menu item, returns focus to what opene
|
|
|
1140
1156
|
moves focus back itself calls `settleFocus()` from `lostcoords/ui/helpers/focus` afterwards for the same
|
|
1141
1157
|
rule. Hosts that skip `base.css` hide the ring on `[data-lc-focus-quiet]:focus-visible`.
|
|
1142
1158
|
|
|
1159
|
+
The ring itself is the `lc-focus-ring` utility: two units of `--ring` hugging the element's own radius.
|
|
1160
|
+
`base.css` draws it on every focusable element, so a component never restates an outline. One whose ring
|
|
1161
|
+
belongs on another element applies the utility through a variant, as a linked list row does with
|
|
1162
|
+
`has-[[data-slot=list-link]:focus-visible]:lc-focus-ring`.
|
|
1163
|
+
|
|
1143
1164
|
Page-wide shortcuts focus a field or press a button. Merge `lc_shortcut_data` into the element's data and
|
|
1144
1165
|
show the keys with `lc_kbd`:
|
|
1145
1166
|
|
|
@@ -28,8 +28,7 @@
|
|
|
28
28
|
on the keyboard (helpers/focus). */
|
|
29
29
|
:is(a, button, input, textarea, select, summary, [tabindex]:not(dialog)):focus-visible:not([data-lc-focus-quiet]),
|
|
30
30
|
label:has(input.sr-only:focus-visible, + input.sr-only:focus-visible) {
|
|
31
|
-
|
|
32
|
-
outline-offset: 0;
|
|
31
|
+
@apply lc-focus-ring;
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
dialog:focus-visible, [data-lc-focus-quiet]:focus-visible { outline: none; }
|
|
@@ -172,11 +172,6 @@
|
|
|
172
172
|
-webkit-appearance: none;
|
|
173
173
|
appearance: none;
|
|
174
174
|
}
|
|
175
|
-
|
|
176
|
-
&:focus {
|
|
177
|
-
outline: none;
|
|
178
|
-
box-shadow: 0 0 0 calc(var(--spacing) * 0.5) var(--ring, color-mix(in oklab, var(--primary) 50%, transparent));
|
|
179
|
-
}
|
|
180
175
|
}
|
|
181
176
|
|
|
182
177
|
/* ---- Skin-tone control ------------------------------------------- */
|
|
@@ -5,6 +5,14 @@
|
|
|
5
5
|
@custom-variant lc-disabled (&:disabled:not([aria-busy="true"]));
|
|
6
6
|
@custom-variant lc-pending (&:disabled[aria-busy="true"]);
|
|
7
7
|
|
|
8
|
+
/* The focus ring, drawn here and nowhere else. base.css puts it on whatever holds keyboard
|
|
9
|
+
focus; a component whose ring belongs on another element, such as a row around its link,
|
|
10
|
+
applies it through a variant. */
|
|
11
|
+
@utility lc-focus-ring {
|
|
12
|
+
outline: calc(var(--spacing) * 0.5) solid var(--ring, color-mix(in oklab, var(--primary) 50%, transparent));
|
|
13
|
+
outline-offset: 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
8
16
|
/* A control gives a little as it is pressed, unless it is disabled. */
|
|
9
17
|
@utility lc-press {
|
|
10
18
|
@media (prefers-reduced-motion: no-preference) {
|
|
@@ -36,9 +36,8 @@ module Lostcoords::Ui
|
|
|
36
36
|
"w-full max-w-full min-w-0 " \
|
|
37
37
|
"px-3 " \
|
|
38
38
|
"font-sans text-base bg-(--lc-field-bg,var(--input)) text-foreground placeholder:text-muted-foreground " \
|
|
39
|
-
"border border-transparent rounded-xl lc-squircle
|
|
39
|
+
"border border-transparent rounded-xl lc-squircle " \
|
|
40
40
|
"transition-[border-color,box-shadow] duration-(--lc-motion-quick) ease-(--lc-ease-out) " \
|
|
41
|
-
"focus:shadow-[0_0_0_calc(var(--spacing)*0.5)_var(--ring,color-mix(in_oklab,var(--primary)_50%,transparent))] " \
|
|
42
41
|
"aria-invalid:border-destructive aria-invalid:shadow-[0_0_0_3px_color-mix(in_oklab,var(--destructive)_16%,transparent)]"
|
|
43
42
|
|
|
44
43
|
# Text and nothing else: for a control inside a row that shows focus itself, such as lc_list_field.
|
|
@@ -14,8 +14,7 @@ module Lostcoords::Ui
|
|
|
14
14
|
# A linked li or div row: the title's link covers the row, the row's own controls sit above it,
|
|
15
15
|
# and the row shows the link's focus ring.
|
|
16
16
|
LIST_ROW_LINKED =
|
|
17
|
-
"relative has-[[data-slot=list-link]:focus-visible]:
|
|
18
|
-
"has-[[data-slot=list-link]:focus-visible]:outline-(--ring,color-mix(in_oklab,var(--primary)_50%,transparent)) " \
|
|
17
|
+
"relative has-[[data-slot=list-link]:focus-visible]:lc-focus-ring " \
|
|
19
18
|
"[&_:is(a[href],button,input,select,textarea,summary,[tabindex]):not([data-slot=list-link])]:relative " \
|
|
20
19
|
"[&_:is(a[href],button,input,select,textarea,summary,[tabindex]):not([data-slot=list-link])]:z-raised"
|
|
21
20
|
LIST_LINK = "text-inherit no-underline focus-visible:outline-none after:absolute after:inset-0 after:rounded-[inherit] after:content-['']"
|
|
@@ -7,6 +7,7 @@ import { prefersReducedMotion } from "lostcoords/ui/helpers/viewport"
|
|
|
7
7
|
|
|
8
8
|
const TONE_MODIFIERS = ["", "\u{1F3FB}", "\u{1F3FC}", "\u{1F3FD}", "\u{1F3FE}", "\u{1F3FF}"]
|
|
9
9
|
const TONE_STORAGE_KEY = "lostcoords_ui:lc-emoji-picker:tone"
|
|
10
|
+
const REACH = ["pointerenter", "touchstart", "focusin"]
|
|
10
11
|
|
|
11
12
|
function markCurrent(element, current) {
|
|
12
13
|
element.setAttribute("aria-current", String(current))
|
|
@@ -36,10 +37,15 @@ export default class extends CatalogPicker {
|
|
|
36
37
|
super.connect()
|
|
37
38
|
this.tone = this.readTone()
|
|
38
39
|
this.syncTones()
|
|
39
|
-
|
|
40
|
+
// The catalog is every emoji there is. It loads once someone reaches for the picker, not
|
|
41
|
+
// with each page that has one: opening it waits for the same request.
|
|
42
|
+
this.reach = () => this.fetchCatalog()
|
|
43
|
+
for (const type of REACH)
|
|
44
|
+
this.element.addEventListener(type, this.reach, { once: true, passive: true })
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
disconnect() {
|
|
48
|
+
for (const type of REACH) this.element.removeEventListener(type, this.reach)
|
|
43
49
|
this.unregisterTones?.()
|
|
44
50
|
this.clearPopover()
|
|
45
51
|
super.disconnect()
|