lostcoords-ui 0.14.6 → 0.14.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b9905bd1837028339420ab4601d23e1499a6a9ba355b694707fa79284dad63fd
4
- data.tar.gz: 7f53b12ddc748f8aa39d820af1a278b07d9cdcbafca0eef0392258352f3eacdf
3
+ metadata.gz: 9447bf582316b0fe793871dafe7d039b6fdd7b583a11fa15593716326bb7043c
4
+ data.tar.gz: 7d60e53c68a6a3c892b0791115476dbbfba1fe0923403e0e4dc3a536bd5c0528
5
5
  SHA512:
6
- metadata.gz: 923ff077a975fd90c19daf1a186a1a334516dacb0351e89fb1094a13016b86068d21e0f3e5cabd52c70c72d5d3a3f58e97909dc6b299d3de2c0f950c394c4f5e
7
- data.tar.gz: 73ed37232a4ac32ecf122f81df0e039bc8b9040f6812a343fa79f25e214a90d2255c41ae35c08c577590c2d5f458fa35e836624f7a50c9d82719fa185bdec007
6
+ metadata.gz: 961df87717626401a16edc329d5e07feff638359a0767a1592a1c422f234a96db7e1c8a0b35a67798c200ad47e470e1a3564e73fe1a5b5473c0c052707e97043
7
+ data.tar.gz: 893dc15f1e35de2578647d50b7640827124eeb44d7f6fcffb55892a10f417f00f621972419b96bc2469353860d5e3273c8bd57443d3d8537b61a7a3a37026862
data/README.md CHANGED
@@ -170,6 +170,27 @@ 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.8
174
+
175
+ Nothing needs an edit. Changed:
176
+
177
+ - **An `lc_list_field` row rings while its plain input has focus.** It showed the accent fill alone, so
178
+ these rows were the one place a focused field had no ring. The fill stays.
179
+
180
+ Fixed:
181
+
182
+ - **A lifted panel moves in the frame it grows in.** A panel that outgrew the viewport as its content
183
+ loaded, such as the emoji picker when its catalog arrives, was painted once at the old spot before
184
+ flipping to the other side of its trigger.
185
+
186
+ ## Changes in 0.14.7
187
+
188
+ Nothing needs an edit. Fixed:
189
+
190
+ - **Focus also returns when the host removes the dialog as it closes.** Such a caller unregisters before
191
+ the `close` event arrives, which is where 0.14.6 returned focus, so Safari still left it on the page.
192
+ Focus now settles when a closed dialog is unregistered.
193
+
173
194
  ## Changes in 0.14.6
174
195
 
175
196
  Nothing needs an edit. Fixed:
@@ -724,7 +745,7 @@ narrow row the label folds to its `icon:`, and the text stays the accessible nam
724
745
  a `<label>` for that control; `as: :fieldset` names a group of controls, such as chips, with a legend.
725
746
  `as: :span, surface: false` draws the row inside another element, such as a collapsible's summary.
726
747
  `lc_input(plain: true)` drops the field's fill, border, padding and height so the text sits in the row,
727
- which tints while that input has focus. Toggles take `--lc-field-bg` like fields, so on a card or list
748
+ which tints and shows the focus ring while that input has focus. Toggles take `--lc-field-bg` like fields, so on a card or list
728
749
  row they use `--card-input`.
729
750
 
730
751
  ```erb
@@ -40,7 +40,7 @@ module Lostcoords::Ui
40
40
  "transition-[border-color,box-shadow] duration-(--lc-motion-quick) ease-(--lc-ease-out) " \
41
41
  "aria-invalid:border-destructive aria-invalid:shadow-[0_0_0_3px_color-mix(in_oklab,var(--destructive)_16%,transparent)]"
42
42
 
43
- # Text and nothing else: for a control inside a row that shows focus itself, such as lc_list_field.
43
+ # Text and nothing else: for a control inside a row that draws the focus ring itself, such as lc_list_field.
44
44
  INPUT_PLAIN =
45
45
  "w-full max-w-full min-w-0 min-h-9 p-0 border-0 bg-transparent font-sans text-base text-foreground " \
46
46
  "placeholder:text-muted-foreground aria-invalid:placeholder:text-destructive outline-none"
@@ -25,7 +25,7 @@ module Lostcoords::Ui
25
25
  "hover:bg-accent has-checked:bg-primary-soft has-checked:font-semibold has-lc-disabled:cursor-not-allowed has-lc-pending:cursor-progress has-lc-disabled:opacity-45"
26
26
  LIST_ROW_CHOICE_CHECK = "ms-auto size-4 shrink-0 text-primary invisible group-has-checked/choice:visible"
27
27
  LIST_FIELD_ELEMENTS = %i[div fieldset span].freeze
28
- LIST_FIELD = "@container px-content py-2.5 transition-colors duration-(--lc-motion-quick) has-[[data-plain]:focus]:bg-accent"
28
+ LIST_FIELD = "@container px-content py-2.5 transition-colors duration-(--lc-motion-quick) has-[[data-plain]:focus]:bg-accent has-[[data-plain]:focus-visible]:lc-focus-ring"
29
29
  LIST_FIELD_GRID = "grid min-h-9 grid-cols-[1.25rem_minmax(0,1fr)] items-center gap-x-heading gap-y-related @md:grid-cols-[8rem_minmax(0,1fr)]"
30
30
  LIST_FIELD_LABEL =
31
31
  "flex items-center gap-related text-label font-semibold text-muted-foreground " \
@@ -66,14 +66,12 @@ export function registerDialog(
66
66
  if (!inside) close(event)
67
67
  }
68
68
  // A dialog closed and shown again in the same task fires close while it is already open again.
69
- // By now the browser has handed focus back to what had it before the dialog opened, if
70
- // anything had.
71
69
  const unregisterOnClose = () => {
72
- if (dialog.open) return
73
- unregister()
74
- returnFocus(opener, dialog)
75
- settleFocus()
70
+ if (!dialog.open) unregister()
76
71
  }
72
+ // A closed dialog has handed focus back to what had it before it opened, if anything had. A
73
+ // caller that removes the dialog as it closes unregisters before the close event arrives, so
74
+ // focus settles here and not in that event.
77
75
  const unregister = () => {
78
76
  if (registrations.get(dialog) !== unregister) return
79
77
  registrations.delete(dialog)
@@ -81,6 +79,10 @@ export function registerDialog(
81
79
  dialog.removeEventListener("close", unregisterOnClose)
82
80
  dialog.removeEventListener("click", closeOnBackdrop)
83
81
  unregisterDismissable()
82
+ if (dialog.open) return
83
+
84
+ returnFocus(opener, dialog)
85
+ settleFocus()
84
86
  }
85
87
 
86
88
  registrations.set(dialog, unregister)
@@ -96,7 +96,9 @@ export function liftToTopLayer(panel, trigger) {
96
96
  const schedule = () => (frame ??= requestAnimationFrame(place))
97
97
 
98
98
  place()
99
- const resizes = new ResizeObserver(schedule)
99
+ // A resize is delivered before the frame paints, so the panel moves in the frame it grows in:
100
+ // one that outgrows the viewport as its content loads is never painted at the old spot.
101
+ const resizes = new ResizeObserver(place)
100
102
  resizes.observe(panel)
101
103
  window.addEventListener("scroll", schedule, { capture: true, passive: true })
102
104
  window.addEventListener("resize", schedule, { passive: true })
@@ -1,5 +1,5 @@
1
1
  module Lostcoords
2
2
  module Ui
3
- VERSION = "0.14.6"
3
+ VERSION = "0.14.8"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lostcoords-ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.6
4
+ version: 0.14.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lost Coordinates