lostcoords-ui 0.14.8 → 0.14.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9447bf582316b0fe793871dafe7d039b6fdd7b583a11fa15593716326bb7043c
4
- data.tar.gz: 7d60e53c68a6a3c892b0791115476dbbfba1fe0923403e0e4dc3a536bd5c0528
3
+ metadata.gz: df62b2154bc5fe1c0561cc8f5a92db48a0dffdb2b6e73afce18ebeefaa5dd50a
4
+ data.tar.gz: 986cb18b76430f68a676d6786c65f3c3c4483e23bf445cd3248702df46a3d282
5
5
  SHA512:
6
- metadata.gz: 961df87717626401a16edc329d5e07feff638359a0767a1592a1c422f234a96db7e1c8a0b35a67798c200ad47e470e1a3564e73fe1a5b5473c0c052707e97043
7
- data.tar.gz: 893dc15f1e35de2578647d50b7640827124eeb44d7f6fcffb55892a10f417f00f621972419b96bc2469353860d5e3273c8bd57443d3d8537b61a7a3a37026862
6
+ metadata.gz: 03ae7326f876da302da67b0ee3f2c6edd98ca240cbe54ec9d7233e954e145593895616c2ac0d52fff637366b32cfa8a57ab01071719a3b7fb4744298335cb085
7
+ data.tar.gz: 1e4c6fbccdf6b5a969a37588f1aed9eb4e0847b64e646d53b12d8b554f02301737353e6480e9546b8f2a6585af1273d8ec48e599165d04ab1d295d53e7d84d78
data/README.md CHANGED
@@ -51,12 +51,12 @@ Tailwind build writes stable paths for them next to the engine's own import:
51
51
  @import "../builds/tailwind/lostcoords_ui/components/menu.css";
52
52
  ```
53
53
 
54
- `base.css` holds the document defaults: body styles, heading defaults, global inline-code styles and
55
- document corner radii. Skip it when the host owns its base styles, map the library's tokens to your
54
+ `base.css` holds the document defaults: body styles, heading defaults, global inline-code styles, the
55
+ focus ring and the reduced-motion reset. Skip it when the host owns its base styles, map the library's tokens to your
56
56
  app's theme and keep your Tailwind theme declarations after the imports.
57
57
  `core.css` holds the tokens, buttons, badges, avatars, cards, alerts, form controls, choices,
58
58
  toggles, layout, typography and navigation. The opt-in entries are `dialog` (with the phone sheet),
59
- `menu` (menus and popovers), `toast`, `search`, `tooltip`, `collapsible`, `code-block`,
59
+ `menu` (menus and popovers), `toast`, `search`, `tooltip`, `hovercard`, `collapsible`, `code-block`,
60
60
  `emoji-picker`, `table`, `prose` and `shell` (`lc_app_header`, `lc_sidebar`, `lc_docs_shell` and `lc_dock`; the
61
61
  dock's action menu and the sidebar's account menu also need `menu`). A component whose entry is missing renders unstyled.
62
62
 
@@ -170,6 +170,47 @@ 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.11
174
+
175
+ Nothing needs an edit. Changed:
176
+
177
+ - **A disabled `lc_input`, `lc_select`, `lc_textarea` or toggle pill looks disabled**: muted text and a
178
+ not-allowed cursor, as buttons and segmented items already had. A disabled select no longer fills on hover.
179
+ - **Emoji grid buttons show the focus ring.** They marked keyboard focus with the hover fill alone.
180
+ - **The emoji picker has a set height**, on desktop and as a phone sheet. It grew when its catalog arrived
181
+ after opening, and on desktop could jump to the other side of its trigger.
182
+ - **`lc_search` group titles use the eyebrow role**, so under `lang="ja"` they drop the mono face and
183
+ uppercase like every other eyebrow.
184
+
185
+ Fixed:
186
+
187
+ - **Input methods.** Escape that cancels a conversion no longer closes the dialog, menu or popover around
188
+ the field. `lc_search` shows results for text committed from an input method in Chrome, which sends no
189
+ input event after the composition ends. In Safari, the Enter that commits a conversion no longer picks
190
+ the first match in the emoji picker or any other catalog picker.
191
+ - **A catalog that failed to load is asked for again** on the next open; the failure was kept until a
192
+ full page load.
193
+ - **An `lc_dialog` replaced while open releases the page.** A stream that swapped the open dialog sent no
194
+ close event, so the page stayed scroll-locked.
195
+ - **A linked or interactive card eases its lift and fill on hover.** The transition named `transform`,
196
+ which the lift does not use, and replaced the card's own.
197
+ - **A button-mode `lc_toggle_group` renders its `value:` selected.** The choice appeared only once the
198
+ controller connected.
199
+ - **An `lc_fieldset` with an error turns its legend red**, as a field does its label.
200
+ - **Skin-tone options carry `aria-checked`**, so a screen reader announces the chosen one.
201
+ - **`lc_char_counter` follows a form reset**, and a tooltip dismissed with Escape shows again after
202
+ coming back to a cached page.
203
+ - **A collapsible closes in a browser without `::details-content`**, where reading its duration threw.
204
+
205
+ ## Changes in 0.14.10
206
+
207
+ Nothing needs an edit. Added:
208
+
209
+ - **Pills can scroll in one row.** `lc_toggle_group(variant: :pills, scroll: true)` keeps its pills in a
210
+ single row that scrolls sideways, its edges fading while there is more to see; `scroll: :narrow` does
211
+ so only while the nearest `@container` is under `@md`, and wraps above it. A pill's focus ring stays
212
+ visible at the scroller's edge.
213
+
173
214
  ## Changes in 0.14.8
174
215
 
175
216
  Nothing needs an edit. Changed:
@@ -637,7 +678,7 @@ With `name:` they are native radios in labels, which bring their own arrows, sub
637
678
  `value:` and `checked:`, and the group's `value:` checks the matching item. With `as: :nav` they are links in a
638
679
  labelled `nav`; items take `href:` and `current:`. Otherwise they are radio buttons whose selection lives in the
639
680
  `lc-selection` controller, which dispatches `lc-selection:change`; items take `value:` and `selected:`. An item
640
- given another kind's arguments raises. `variant: :pills` lays any of them out as wrapping toggle pills, sized by `size:`, instead of a segmented track.
681
+ given another kind's arguments raises. `variant: :pills` lays any of them out as wrapping toggle pills, sized by `size:`, instead of a segmented track; with `scroll: true` (or `:narrow`, only inside a container under `@md`) the pills stay in one row that scrolls sideways.
641
682
  Items take `icon:` and `icon_only:` as `lc_toggle` does. A segmented group's `layout: :stacked` puts each item's icon
642
683
  over its label, and `layout: :adaptive` makes the group full width and stacks its items only while the group is
643
684
  narrower than 24rem. `scroll: true` lets a track wider than its container scroll sideways, its edges fading.
@@ -98,7 +98,10 @@
98
98
  color: var(--foreground);
99
99
  flex-direction: column;
100
100
  inline-size: 100%;
101
- max-block-size: min(72svh, 34rem);
101
+
102
+ /* A set height, not a maximum: the catalog arrives after the panel opens, and the panel would
103
+ grow under the reader's finger, or jump to the other side of its trigger on desktop. */
104
+ block-size: min(72svh, 34rem);
102
105
  padding-block-end: max(env(safe-area-inset-bottom), 8px);
103
106
  border-start-start-radius: var(--radius-3xl, 1.5rem);
104
107
  border-start-end-radius: var(--radius-3xl, 1.5rem);
@@ -340,7 +343,6 @@
340
343
  &:focus-visible {
341
344
  background: var(--muted);
342
345
  transform: scale(1.12);
343
- outline: none;
344
346
  }
345
347
 
346
348
  &[aria-current="true"] { background: color-mix(in oklab, var(--primary) 12%, var(--background)); }
@@ -405,7 +407,7 @@
405
407
  inset-block: calc(100% + 8px) auto;
406
408
  inset-inline: 0 auto;
407
409
  inline-size: min(var(--lc-emoji-picker-popover-width, 22rem), calc(100vw - 32px));
408
- max-block-size: min(28rem, calc(100vh - 96px));
410
+ block-size: min(28rem, calc(100vh - 96px));
409
411
  padding-block-end: 0;
410
412
  border-radius: var(--radius-3xl, 1.5rem);
411
413
  transform: translateY(-4px) scale(0.98);
@@ -102,6 +102,8 @@ module Lostcoords::Ui
102
102
  "font-sans text-muted-foreground whitespace-nowrap cursor-pointer no-underline " \
103
103
  "transition-[background-color,border-color,color,transform] duration-(--lc-motion-quick) ease-(--lc-ease-out) " \
104
104
  "lc-press hover:text-foreground " \
105
+ "lc-disabled:cursor-not-allowed lc-disabled:text-[color-mix(in_oklab,var(--foreground)_38%,transparent)] " \
106
+ "has-lc-disabled:cursor-not-allowed has-lc-disabled:text-[color-mix(in_oklab,var(--foreground)_38%,transparent)] " \
105
107
  "aria-pressed:bg-primary aria-pressed:border-transparent aria-pressed:text-primary-foreground aria-pressed:shadow-none " \
106
108
  "aria-checked:bg-primary aria-checked:border-transparent aria-checked:text-primary-foreground aria-checked:shadow-none " \
107
109
  "aria-[current]:not-aria-[current=false]:bg-primary aria-[current]:not-aria-[current=false]:border-transparent " \
@@ -8,7 +8,7 @@ module Lostcoords::Ui
8
8
  md: "p-inset",
9
9
  sm: "[--lc-inset:var(--spacing-content)] p-inset"
10
10
  }.freeze
11
- HOVER_LIFT = "transition-[transform,box-shadow] duration-(--lc-motion-control) ease-(--lc-ease-out) motion-safe:hover:-translate-y-0.5 hover:shadow-(--lc-shadow)"
11
+ HOVER_LIFT = "transition-[background-color,border-color,box-shadow,translate] duration-(--lc-motion-control) ease-(--lc-ease-out) motion-safe:hover:-translate-y-0.5 hover:shadow-(--lc-shadow)"
12
12
 
13
13
  def lc_card_class(interactive: false, padding: :md, extra: nil)
14
14
  padding = lc_option!(:padding, padding, CARD_PADDING.keys)
@@ -31,6 +31,17 @@ module Lostcoords::Ui
31
31
  }.freeze
32
32
  # A track wider than its container scrolls sideways, its edges fading while there is more to see.
33
33
  TOGGLE_GROUP_SCROLL = "lc-scroll-fade-x max-w-full overflow-x-auto [scrollbar-width:none] *:shrink-0"
34
+ # Pills that scroll sideways in one row instead of wrapping. The 2px inset keeps a pill's focus ring
35
+ # inside the scroller, which clips it otherwise. :narrow scrolls only while the nearest @container is
36
+ # under @md and wraps above it; the fade is inert whenever nothing overflows.
37
+ # Class names are written out whole so Tailwind finds them in this source.
38
+ PILLS_SCROLL = {
39
+ true => "lc-scroll-fade-x motion-safe:scroll-smooth flex-nowrap overflow-x-auto overscroll-x-contain [scrollbar-width:none] " \
40
+ "[&::-webkit-scrollbar]:hidden *:shrink-0 -my-0.5 py-0.5 -mx-0.5 px-0.5",
41
+ narrow: "lc-scroll-fade-x motion-safe:scroll-smooth @max-md:flex-nowrap @max-md:overflow-x-auto @max-md:overscroll-x-contain " \
42
+ "@max-md:[scrollbar-width:none] @max-md:[&::-webkit-scrollbar]:hidden @max-md:*:shrink-0 @max-md:-my-0.5 @max-md:py-0.5 " \
43
+ "@max-md:-mx-0.5 @max-md:px-0.5"
44
+ }.freeze
34
45
 
35
46
  INPUT_BASE =
36
47
  "w-full max-w-full min-w-0 " \
@@ -38,14 +49,15 @@ module Lostcoords::Ui
38
49
  "font-sans text-base bg-(--lc-field-bg,var(--input)) text-foreground placeholder:text-muted-foreground " \
39
50
  "border border-transparent rounded-xl lc-squircle " \
40
51
  "transition-[border-color,box-shadow] duration-(--lc-motion-quick) ease-(--lc-ease-out) " \
41
- "aria-invalid:border-destructive aria-invalid:shadow-[0_0_0_3px_color-mix(in_oklab,var(--destructive)_16%,transparent)]"
52
+ "aria-invalid:border-destructive aria-invalid:shadow-[0_0_0_3px_color-mix(in_oklab,var(--destructive)_16%,transparent)] " \
53
+ "lc-disabled:cursor-not-allowed lc-disabled:text-[color-mix(in_oklab,var(--foreground)_38%,transparent)]"
42
54
 
43
55
  # Text and nothing else: for a control inside a row that draws the focus ring itself, such as lc_list_field.
44
56
  INPUT_PLAIN =
45
57
  "w-full max-w-full min-w-0 min-h-9 p-0 border-0 bg-transparent font-sans text-base text-foreground " \
46
58
  "placeholder:text-muted-foreground aria-invalid:placeholder:text-destructive outline-none"
47
59
 
48
- FIELD_BASE = "lc-field grid min-w-0 has-aria-invalid:[&>label]:text-destructive"
60
+ FIELD_BASE = "lc-field grid min-w-0 has-aria-invalid:[&>label]:text-destructive aria-invalid:[&>legend]:text-destructive"
49
61
  FIELD_SIZES = { sm: "gap-tight", md: "gap-related" }.freeze
50
62
  # Field labels use the text roles; TypographyHelper loads after this file, so its sizes are read at call time.
51
63
  FIELD_LABEL_ROLES = { sm: :caption, md: :label }.freeze
@@ -85,7 +97,7 @@ module Lostcoords::Ui
85
97
 
86
98
 
87
99
  def lc_select_class(size: :md, extra: nil)
88
- lc_tw(lc_input_class(size: size), "lc-select rounded-pill ps-4 pe-10 cursor-pointer hover:bg-(--lc-input-hover)", extra)
100
+ lc_tw(lc_input_class(size: size), "lc-select rounded-pill ps-4 pe-10 cursor-pointer enabled:hover:bg-(--lc-input-hover)", extra)
89
101
  end
90
102
 
91
103
  def lc_textarea_class(extra: nil)
@@ -38,7 +38,7 @@ module Lostcoords::Ui
38
38
  }
39
39
  }.freeze
40
40
  NAV_INDICATOR = "pointer-events-none absolute start-0 top-0 bg-(--lc-nav-indicator,var(--accent)) opacity-0 " \
41
- "transition-[translate,width,height,opacity] duration-[400ms] ease-(--lc-ease-out-expo) motion-reduce:transition-none " \
41
+ "transition-[translate,width,height,opacity] duration-400 ease-(--lc-ease-out-expo) motion-reduce:transition-none " \
42
42
  "group-data-[indicator]/nav:opacity-100"
43
43
 
44
44
  # An inline text link. Prose inside lc_prose styles its links already.
@@ -34,7 +34,7 @@ module Lostcoords::Ui
34
34
  lc_label!(title, :title)
35
35
  defaults = { class: "flex flex-col py-related", aria: { label: title }, data: { slot: "search-group" } }
36
36
  tag.section(**lc_attributes(defaults, attributes)) do
37
- safe_join([ tag.h2(title, class: "px-heading pb-related font-mono text-xs font-medium uppercase tracking-widest text-muted-foreground", data: { slot: "search-group-title" }), (capture(&block) if block) ])
37
+ safe_join([ tag.h2(title, class: lc_text_class(size: :eyebrow, tone: :muted, extra: "px-heading pb-related"), data: { slot: "search-group-title" }), (capture(&block) if block) ])
38
38
  end
39
39
  end
40
40
 
@@ -108,7 +108,8 @@ module Lostcoords::Ui
108
108
  # as: :nav makes links, the current one marked with aria-current; otherwise radio buttons whose
109
109
  # selection lives in the lc-selection controller.
110
110
  # variant: :pills lays the items out as wrapping toggle pills, sized by size:, instead of a segmented track.
111
- # layout: and scroll: shape the segmented track; see lc_toggle_group_class.
111
+ # layout: and scroll: shape the segmented track; see lc_toggle_group_class. Pills take scroll: true
112
+ # to stay one sideways-scrolling row, or scroll: :narrow to do so only inside a container under @md.
112
113
  def lc_toggle_group(label:, name: nil, value: nil, as: :div, variant: :segmented, size: :md, layout: :inline, scroll: false, **attributes, &block)
113
114
  lc_label!(label, :label)
114
115
  as = lc_option!(:as, as, %i[div nav])
@@ -116,13 +117,16 @@ module Lostcoords::Ui
116
117
  size = lc_option!(:size, size, ButtonHelper::BUTTON_SIZES.keys)
117
118
  layout = lc_option!(:layout, layout, FormHelper::TOGGLE_GROUP_LAYOUTS.keys)
118
119
  raise ArgumentError, "size: sizes pills; a segmented toggle group has one size" if variant == :segmented && size != :md
119
- raise ArgumentError, "layout: and scroll: shape a segmented track; pills wrap" if variant == :pills && (layout != :inline || scroll)
120
+ raise ArgumentError, "layout: shapes a segmented track; pills wrap" if variant == :pills && layout != :inline
121
+ scroll = scroll.to_sym if scroll.is_a?(String)
122
+ allowed_scroll = variant == :pills ? [ false, *FormHelper::PILLS_SCROLL.keys ] : [ false, true ]
123
+ raise ArgumentError, "Invalid scroll: #{scroll.inspect}. Expected one of: #{allowed_scroll.map(&:inspect).join(', ')}" unless allowed_scroll.include?(scroll)
120
124
  raise ArgumentError, "a nav toggle group marks its current link; it takes no name: or value:" if as == :nav && (name || value)
121
125
 
122
126
  mode = as == :nav ? :links : (name ? :radios : :buttons)
123
127
  content = lc_within_toggle_group({ mode: mode, name: name, value: value&.to_s, variant: variant, size: size, layout: layout }) { capture(&block) if block }
124
128
 
125
- defaults = { class: (variant == :pills ? lc_inline_class : lc_toggle_group_class(layout: layout, scroll: scroll)), data: { slot: "toggle-group" } }
129
+ defaults = { class: (variant == :pills ? lc_inline_class(extra: FormHelper::PILLS_SCROLL[scroll]) : lc_toggle_group_class(layout: layout, scroll: scroll)), data: { slot: "toggle-group" } }
126
130
  case mode
127
131
  when :links
128
132
  tag.nav(content, **lc_attributes(defaults, attributes, { aria: { label: label } }))
@@ -157,6 +161,7 @@ module Lostcoords::Ui
157
161
  return lc_toggle_radio(content, group[:name], value, checked, input, defaults, attributes)
158
162
  end
159
163
 
164
+ selected = group[:value] == value.to_s if selected.nil?
160
165
  required = { type: "button", role: "radio", data: { lc_selection_target: "option", value: value } }
161
166
  tag.button(content, **lc_attributes(defaults.merge(aria: { checked: selected || false }), attributes, required))
162
167
  end
@@ -19,11 +19,16 @@ export default class extends Controller {
19
19
  this.field = this.forValue ? document.getElementById(this.forValue) : this.nearestField()
20
20
  this.input = () => this.render()
21
21
  this.field?.addEventListener("input", this.input)
22
+ // A reset empties the field after its event, and sends no input event of its own.
23
+ this.form = this.field?.form
24
+ this.reset = () => setTimeout(this.input)
25
+ this.form?.addEventListener("reset", this.reset)
22
26
  this.render()
23
27
  }
24
28
 
25
29
  disconnect() {
26
30
  this.field?.removeEventListener("input", this.input)
31
+ this.form?.removeEventListener("reset", this.reset)
27
32
  }
28
33
 
29
34
  update({ detail }) {
@@ -89,10 +89,11 @@ export default class extends Controller {
89
89
  return this.element.querySelector(":scope > summary").offsetHeight + chrome
90
90
  }
91
91
 
92
+ // A browser without ::details-content reports no duration: close at once instead of throwing.
92
93
  transitionDurations() {
93
94
  return getComputedStyle(this.element, "::details-content")
94
95
  .transitionDuration.split(",")
95
- .map((duration) => parseFloat(duration) * 1000)
96
+ .map((duration) => parseFloat(duration) * 1000 || 0)
96
97
  }
97
98
 
98
99
  // Opening near the bottom of a scroller grows content off-screen, so the
@@ -10,6 +10,12 @@ export default class extends Controller {
10
10
  this.unregisterDialog?.()
11
11
  }
12
12
 
13
+ // A stream that replaces an open dialog sends no close event, and the page would stay locked.
14
+ dialogTargetDisconnected() {
15
+ this.unregisterDialog?.()
16
+ this.unregisterDialog = null
17
+ }
18
+
13
19
  open(event) {
14
20
  event?.preventDefault()
15
21
  if (this.hasFrameTarget) {
@@ -222,7 +222,9 @@ export default class extends CatalogPicker {
222
222
  }
223
223
  if (this.hasToneMenuTarget) {
224
224
  this.toneMenuTarget.querySelectorAll("[data-tone-index]").forEach((button) => {
225
- markCurrent(button, Number(button.dataset.toneIndex) === this.tone)
225
+ const chosen = Number(button.dataset.toneIndex) === this.tone
226
+ markCurrent(button, chosen)
227
+ button.setAttribute("aria-checked", String(chosen))
226
228
  })
227
229
  }
228
230
  }
@@ -102,6 +102,8 @@ export default class extends Controller {
102
102
  this.input()
103
103
  }
104
104
 
105
+ // Chrome's last input event of a composition still reports isComposing, so the field also sends
106
+ // compositionend here.
105
107
  input(event) {
106
108
  if (event?.isComposing) return
107
109
  this.clearTarget.hidden = !this.inputTarget.value
@@ -1,5 +1,5 @@
1
1
  import { Controller } from "@hotwired/stimulus"
2
- import { navigate } from "lostcoords/ui/helpers/roving_focus"
2
+ import { navigate, rove } from "lostcoords/ui/helpers/roving_focus"
3
3
 
4
4
  // The ARIA tabs pattern. Arrow keys follow the tab list's aria-orientation, and
5
5
  // Home and End jump to the ends. With automatic activation, moving focus selects
@@ -21,14 +21,10 @@ export default class extends Controller {
21
21
  })
22
22
  if (!tab) return
23
23
 
24
- if (this.activationValue === "manual") this.focusOnly(tab)
24
+ if (this.activationValue === "manual") rove(this.tabTargets, tab)
25
25
  else this.show(tab)
26
26
  }
27
27
 
28
- focusOnly(tab) {
29
- for (const candidate of this.tabTargets) candidate.tabIndex = candidate === tab ? 0 : -1
30
- }
31
-
32
28
  show(tab) {
33
29
  for (const candidate of this.tabTargets) {
34
30
  const selected = candidate === tab
@@ -19,7 +19,7 @@ export default class extends Controller {
19
19
 
20
20
  this.element.toggleAttribute("data-open", true)
21
21
  this.release = liftToTopLayer(this.contentTarget, this.element)
22
- this.stopPageLeave = onPageLeave(() => this.close({ immediate: true }))
22
+ this.stopPageLeave = onPageLeave(() => this.leave())
23
23
  this.unregister = registerDismissable({
24
24
  type: "tooltip",
25
25
  element: this.element,
@@ -38,6 +38,13 @@ export default class extends Controller {
38
38
  dismiss() {
39
39
  this.element.dataset.dismissed = ""
40
40
  this.close({ immediate: true })
41
+ this.stopPageLeave = onPageLeave(() => this.leave())
42
+ }
43
+
44
+ // A cached page must not remember an Escape: the tooltip would stay hidden on the way back.
45
+ leave() {
46
+ delete this.element.dataset.dismissed
47
+ this.close({ immediate: true })
41
48
  }
42
49
 
43
50
  close({ immediate = false } = {}) {
@@ -174,7 +174,7 @@ export class CatalogPicker extends FloatingPanel {
174
174
  // Arrow Down leaves the search for the first option in view; Enter picks
175
175
  // the best match.
176
176
  onSearchKeydown(event) {
177
- if (event.isComposing) return
177
+ if (event.isComposing || event.keyCode === 229) return
178
178
 
179
179
  if (event.key === "ArrowDown") {
180
180
  const top = this.bodyTarget.getBoundingClientRect().top
@@ -387,6 +387,11 @@ export class CatalogPicker extends FloatingPanel {
387
387
  )
388
388
  catalog.template = template
389
389
  })
390
+ .catch(() => {})
391
+ // A failed load is forgotten, so the next open asks again.
392
+ .finally(() => {
393
+ if (!catalog.template) catalog.request = null
394
+ })
390
395
  return catalog.request
391
396
  }
392
397
 
@@ -49,6 +49,8 @@ export function closeTopDismissable(event) {
49
49
 
50
50
  function dismissOnEscape(event) {
51
51
  if (event.key !== "Escape" && event.key !== "Esc") return
52
+ // Escape that cancels an IME conversion belongs to the input method, as it does for a native dialog.
53
+ if (event.isComposing || event.keyCode === 229) return
52
54
  if (clearSearchField(event)) return
53
55
  if (!closeTopDismissable(event)) return
54
56
 
@@ -10,7 +10,7 @@
10
10
  <%= tag.form action: src, method: :get, role: "search", class: "flex shrink-0 items-center gap-heading", data: { action: "submit->lc-search#submit" } do %>
11
11
  <label class="<%= lc_glass_class(extra: "flex min-h-14 min-w-0 flex-1 cursor-text items-center gap-heading ps-5 pe-2 sm:min-h-16") %>" data-lc-search-target="bar">
12
12
  <%= lc_icon "magnifying-glass", options: { class: "size-6 shrink-0 text-muted-foreground", "aria-hidden": true, "data-lc-search-target": "glyph" } %>
13
- <input type="search" name="<%= param %>" class="lc-search-input min-w-0 flex-1 self-stretch border-0 bg-transparent text-base text-foreground outline-none placeholder:text-muted-foreground" aria-label="<%= label %>" placeholder="<%= placeholder %>" autocomplete="off" autocapitalize="off" spellcheck="false" enterkeyhint="search" data-lc-search-target="input" data-action="input->lc-search#input"<% if shortcut %> data-controller="lc-shortcut" data-lc-shortcut-keys-value="<%= shortcut %>"<% end %>>
13
+ <input type="search" name="<%= param %>" class="lc-search-input min-w-0 flex-1 self-stretch border-0 bg-transparent text-base text-foreground outline-none placeholder:text-muted-foreground" aria-label="<%= label %>" placeholder="<%= placeholder %>" autocomplete="off" autocapitalize="off" spellcheck="false" enterkeyhint="search" data-lc-search-target="input" data-action="input->lc-search#input compositionend->lc-search#input"<% if shortcut %> data-controller="lc-shortcut" data-lc-shortcut-keys-value="<%= shortcut %>"<% end %>>
14
14
  <%= lc_icon_button lc_t("lostcoords.ui.search.clear"), icon: "x-circle", size: :sm, shape: :circle, hidden: true, data: { lc_search_target: "clear", action: "lc-search#clear" } %>
15
15
  </label>
16
16
  <%= lc_button lc_t("lostcoords.ui.search.cancel"), variant: :ghost, size: :sm, class: "sm:hidden", data: { lc_search_target: "cancel", action: "lc-search#close" } %>
@@ -1,5 +1,5 @@
1
1
  module Lostcoords
2
2
  module Ui
3
- VERSION = "0.14.8"
3
+ VERSION = "0.14.11"
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.8
4
+ version: 0.14.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lost Coordinates