lostcoords-ui 0.14.11 → 0.14.12

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: df62b2154bc5fe1c0561cc8f5a92db48a0dffdb2b6e73afce18ebeefaa5dd50a
4
- data.tar.gz: 986cb18b76430f68a676d6786c65f3c3c4483e23bf445cd3248702df46a3d282
3
+ metadata.gz: dc041cd2b9ef1078c34335a00669cc6fdcdc22622e16a656a6ca20d8e1aaada6
4
+ data.tar.gz: cd4f1528f765fde97389ce9242e7c47b18b37c916d87156cb682f1205644449a
5
5
  SHA512:
6
- metadata.gz: 03ae7326f876da302da67b0ee3f2c6edd98ca240cbe54ec9d7233e954e145593895616c2ac0d52fff637366b32cfa8a57ab01071719a3b7fb4744298335cb085
7
- data.tar.gz: 1e4c6fbccdf6b5a969a37588f1aed9eb4e0847b64e646d53b12d8b554f02301737353e6480e9546b8f2a6585af1273d8ec48e599165d04ab1d295d53e7d84d78
6
+ metadata.gz: d00c1bbca1ca15a7cd38aa205efe5c2caae746cfa4b1e56794e0a0f6160cff618fde0fcc96cf181b0c0a0aa3f618c3acc741921a15c8fff318b38ca7050ab6a3
7
+ data.tar.gz: a0fc3feba6f2aecccf32f92d7e015f60bba5b01daa5ea5e5ef48a93efab0d48896cbc00f2810ad241daed534e03cfeb6baaeb601baca20dbb7d2179a14297d9b
data/README.md CHANGED
@@ -57,7 +57,7 @@ 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
59
  `menu` (menus and popovers), `toast`, `search`, `tooltip`, `hovercard`, `collapsible`, `code-block`,
60
- `emoji-picker`, `table`, `prose` and `shell` (`lc_app_header`, `lc_sidebar`, `lc_docs_shell` and `lc_dock`; the
60
+ `emoji-picker` (its phone sheet also needs `dialog`), `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
 
63
63
  The gem's stylesheets write into the `components` and `modules` layers, so the host declares that layer order.
@@ -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.12
174
+
175
+ Needs an edit only if you import component entries one by one: `emoji-picker` now also needs `dialog`,
176
+ which holds the phone sheet. Changed:
177
+
178
+ - **The emoji picker's phone sheet is the shared `lc-sheet`.** It had its own copy with tighter corners,
179
+ a darker backdrop and a faster slide; it now has the radius, scrim and timing of every other sheet.
180
+ - **`lc_list_field` rows are inset like the rows around them** from `sm` up (`px-inset`); they sat 4px
181
+ further out than `lc_list_row` and the section heading.
182
+ - **`lc_icon_button_class` defaults to `shape: :circle`**, as `lc_icon_button` does, so the compact
183
+ pager's arrows are round. Pass `shape: :square` to keep the old look.
184
+ - **The responsive nav's links and indicator are squircles from `sm` up**, like `layout: :row`. Being
185
+ pills on phones had switched the squircle off at every width.
186
+ - **Popovers, hovercards and the emoji popover take their timing from `--lc-motion-feedback`**; they
187
+ wrote the same 160ms as a literal.
188
+
189
+ Fixed:
190
+
191
+ - **An avatar in an `lc_avatar_stack` shows the focus ring.** The stack removed every avatar's outline,
192
+ including the ring of one rendered as a button.
193
+
173
194
  ## Changes in 0.14.11
174
195
 
175
196
  Nothing needs an edit. Changed:
@@ -1436,7 +1457,7 @@ Generated by `bin/rails lostcoords:ui:builders`; `bin/lint` checks this list aga
1436
1457
  - `lc_toggle_class(active: false, ghost: false, size: :md, extra: nil)` (BadgeHelper)
1437
1458
  - `lc_button_class(variant: :primary, tone: :default, size: :md, block: false, extra: nil)` (ButtonHelper)
1438
1459
  - `lc_select_trigger_class(size: :md, block: false, extra: nil)` (ButtonHelper)
1439
- - `lc_icon_button_class(shape: :square, size: :md, icon_size: size, variant: :ghost, tone: :default, extra: nil)` (ButtonHelper)
1460
+ - `lc_icon_button_class(shape: :circle, size: :md, icon_size: size, variant: :ghost, tone: :default, extra: nil)` (ButtonHelper)
1440
1461
  - `lc_card_class(interactive: false, padding: :md, extra: nil)` (CardHelper)
1441
1462
  - `lc_choice_label_class(card: false, extra: nil)` (ChoiceHelper)
1442
1463
  - `lc_checkbox_class(extra: nil)` (ChoiceHelper)
@@ -46,90 +46,16 @@
46
46
  display: inline-flex;
47
47
  }
48
48
 
49
- /* ==================================================================== */
50
-
51
- /* Mobile-first: the picker opens as a bottom half-sheet. */
52
-
53
- /* ==================================================================== */
54
-
55
- /* The sheet renders in the top layer (Popover API), so this ::backdrop
56
- dims everything beneath it — including the app nav. The allow-discrete
57
- transitions keep it in the top layer while it eases out, so it fades
58
- both ways instead of snapping away on close. */
59
- .lc-emoji-picker__popover::backdrop {
60
- background: var(--lc-scrim);
61
- opacity: 0;
62
- transition:
63
- opacity 220ms var(--lc-ease-out),
64
- display 220ms allow-discrete,
65
- overlay 220ms allow-discrete;
66
-
67
- @media (prefers-reduced-motion: reduce) { transition: none; }
68
- }
69
-
70
- /* Only the phone sheet dims the page; the desktop popover rides the top
71
- layer too (so nothing paints over it) but floats over an undimmed page. */
72
- @media (width < 40rem) {
73
- .lc-emoji-picker__popover:popover-open::backdrop {
74
- opacity: 1;
75
-
76
- @starting-style { opacity: 0; }
77
- }
78
- }
79
-
80
- /* Phones get a solid sheet; on desktop the host paints the popover as a
81
- floating surface (glass in wariwari), so the gem leaves it unpainted. */
82
- @media (width < 40rem) {
83
- .lc-emoji-picker__popover {
84
- border: 1px solid var(--lc-glass-edge, var(--border));
85
- border-block-end: 0;
86
- background: var(--background);
87
- box-shadow: 0 -12px 40px -12px color-mix(in oklab, var(--foreground) 45%, transparent);
88
- }
89
- }
90
-
49
+ /* On a phone the popover is an lc-sheet, which owns its place, edge, backdrop and slide. From sm
50
+ up it is an anchored popover (below), painted by the host. */
91
51
  .lc-emoji-picker__popover {
92
- position: fixed;
93
- inset: auto 0 0;
94
52
  margin: 0;
95
53
  z-index: var(--lc-z-overlay);
96
54
  display: none;
55
+ flex-direction: column;
97
56
  max-inline-size: none;
98
57
  color: var(--foreground);
99
- flex-direction: column;
100
- inline-size: 100%;
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);
105
- padding-block-end: max(env(safe-area-inset-bottom), 8px);
106
- border-start-start-radius: var(--radius-3xl, 1.5rem);
107
- border-start-end-radius: var(--radius-3xl, 1.5rem);
108
58
  overscroll-behavior: contain;
109
- transform: translateY(100%);
110
- transition:
111
- transform 260ms var(--lc-ease-out-expo),
112
- display 260ms allow-discrete,
113
- overlay 260ms allow-discrete;
114
-
115
- /* Top-layer (Popover API) drives display, so showPopover()/hidePopover()
116
- animate the slide in AND out via the allow-discrete transitions. */
117
- &:popover-open {
118
- display: flex;
119
- transform: translateY(0);
120
-
121
- @starting-style { transform: translateY(100%); }
122
- }
123
-
124
- @media (prefers-reduced-motion: reduce) { transition: none; }
125
- }
126
-
127
- /* Fallback for browsers without the Popover API: class-driven display. */
128
- @supports not selector(:popover-open) {
129
- .lc-emoji-picker__popover[data-open] {
130
- display: flex;
131
- transform: translateY(0);
132
- }
133
59
  }
134
60
 
135
61
  /* ---- Search row --------------------------------------------------- */
@@ -413,10 +339,10 @@
413
339
  transform: translateY(-4px) scale(0.98);
414
340
  opacity: 0;
415
341
  transition:
416
- opacity 160ms var(--lc-ease-out-expo),
417
- transform 160ms var(--lc-ease-out-expo),
418
- display 160ms allow-discrete,
419
- overlay 160ms allow-discrete;
342
+ opacity var(--lc-motion-feedback) var(--lc-ease-out-expo),
343
+ transform var(--lc-motion-feedback) var(--lc-ease-out-expo),
344
+ display var(--lc-motion-feedback) allow-discrete,
345
+ overlay var(--lc-motion-feedback) allow-discrete;
420
346
 
421
347
  &[data-open] {
422
348
  display: flex;
@@ -438,3 +364,13 @@
438
364
  }
439
365
  }
440
366
  }
367
+
368
+ @layer modules {
369
+ /* A set height, not the sheet's fit to content: the catalog arrives after the sheet opens, and
370
+ it would grow under the reader's finger. */
371
+ @media (width < 40rem) {
372
+ .lc-emoji-picker__popover.lc-sheet {
373
+ block-size: min(calc(var(--lc-sheet-floor, 100svh) * 0.72), 34rem);
374
+ }
375
+ }
376
+ }
@@ -22,11 +22,11 @@
22
22
 
23
23
  /* allow-discrete keeps a lifted card in the top layer while it fades out. */
24
24
  transition:
25
- opacity 160ms var(--lc-ease-out-expo),
26
- transform 160ms var(--lc-ease-out-expo),
27
- visibility 160ms,
28
- display 160ms allow-discrete,
29
- overlay 160ms allow-discrete;
25
+ opacity var(--lc-motion-feedback) var(--lc-ease-out-expo),
26
+ transform var(--lc-motion-feedback) var(--lc-ease-out-expo),
27
+ visibility var(--lc-motion-feedback),
28
+ display var(--lc-motion-feedback) allow-discrete,
29
+ overlay var(--lc-motion-feedback) allow-discrete;
30
30
  }
31
31
 
32
32
  .lc-hovercard[data-side="top"] > .lc-hovercard__content {
@@ -7,10 +7,10 @@
7
7
  transform: var(--lc-popover-from, translateY(--spacing(-1)) scale(0.98));
8
8
  pointer-events: none;
9
9
  transition:
10
- opacity 160ms var(--lc-ease-out-expo),
11
- transform 160ms var(--lc-ease-out-expo),
12
- display 160ms allow-discrete,
13
- overlay 160ms allow-discrete;
10
+ opacity var(--lc-motion-feedback) var(--lc-ease-out-expo),
11
+ transform var(--lc-motion-feedback) var(--lc-ease-out-expo),
12
+ display var(--lc-motion-feedback) allow-discrete,
13
+ overlay var(--lc-motion-feedback) allow-discrete;
14
14
 
15
15
  &:is([data-open], :popover-open) {
16
16
  opacity: 1;
@@ -1,12 +1,20 @@
1
1
  /* Squircle corners where the browser supports corner-shape. WebKit keeps plain
2
2
  rounded corners. A squircle reads tighter than a circular arc of the same
3
3
  radius, so its radius grows by a third. Library surfaces carry this class;
4
- host elements are never matched by their rounded-* classes. */
4
+ host elements are never matched by their rounded-* classes. A pill is never
5
+ a squircle; an element that is a pill only on phones (max-sm:) is one from sm up. */
5
6
  @utility lc-squircle {
6
7
  @supports (corner-shape: squircle) {
7
8
  &:not([class*="rounded-full"], [class*="rounded-pill"]) {
8
9
  --lc-corner-scale: 1.333;
9
10
  corner-shape: squircle;
10
11
  }
12
+
13
+ @media (width >= 40rem) {
14
+ &:is([class~="max-sm:rounded-pill"], [class~="max-sm:rounded-full"]):not([class~="rounded-pill"], [class~="rounded-full"]) {
15
+ --lc-corner-scale: 1.333;
16
+ corner-shape: squircle;
17
+ }
18
+ }
11
19
  }
12
20
  }
@@ -52,7 +52,7 @@ module Lostcoords::Ui
52
52
  # its avatars, so a context's own `[&_.lc-avatar]:` override still wins. The border cuts each
53
53
  # avatar out of the one beneath, so it takes the fill it sits on (--lc-avatar-cutout).
54
54
  AVATAR_STACK_BASE =
55
- "lc-avatar-stack relative inline-flex items-center min-w-0 [&_.lc-avatar]:outline-none " \
55
+ "lc-avatar-stack relative inline-flex items-center min-w-0 [&_.lc-avatar:not(:focus-visible)]:outline-none " \
56
56
  "[--lc-avatar-size:--spacing(8)] [--lc-avatar-border:--spacing(0.5)] [--lc-avatar-ring-gap:1] " \
57
57
  "[--lc-avatar-stack-overlap:--spacing(1.5)]"
58
58
 
@@ -139,7 +139,7 @@ module Lostcoords::Ui
139
139
  end
140
140
 
141
141
  # The base is already a ghost button, so variant: :ghost adds nothing; tone: recolours any variant.
142
- def lc_icon_button_class(shape: :square, size: :md, icon_size: size, variant: :ghost, tone: :default, extra: nil)
142
+ def lc_icon_button_class(shape: :circle, size: :md, icon_size: size, variant: :ghost, tone: :default, extra: nil)
143
143
  shape = lc_option!(:shape, shape, ICON_BUTTON_SHAPES.keys)
144
144
  size = lc_option!(:size, size, ICON_BUTTON_SIZES.keys)
145
145
  icon_size = lc_option!(:icon_size, icon_size, ICON_BUTTON_ICON_SIZES.keys)
@@ -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 has-[[data-plain]:focus-visible]:lc-focus-ring"
28
+ LIST_FIELD = "@container px-content py-2.5 sm:px-inset 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 " \
@@ -3,7 +3,6 @@ import { registerDismissable } from "lostcoords/ui/helpers/dismiss_stack"
3
3
  import { settleFocus } from "lostcoords/ui/helpers/focus"
4
4
  import { menuItems, navigateMenu } from "lostcoords/ui/helpers/menu_keys"
5
5
  import { navigate } from "lostcoords/ui/helpers/roving_focus"
6
- import { prefersReducedMotion } from "lostcoords/ui/helpers/viewport"
7
6
 
8
7
  const TONE_MODIFIERS = ["", "\u{1F3FB}", "\u{1F3FC}", "\u{1F3FD}", "\u{1F3FE}", "\u{1F3FF}"]
9
8
  const TONE_STORAGE_KEY = "lostcoords_ui:lc-emoji-picker:tone"
@@ -357,16 +356,6 @@ export default class extends CatalogPicker {
357
356
  return this.hasRecentTarget ? this.recentTarget : null
358
357
  }
359
358
 
360
- get sheetMotion() {
361
- const duration = prefersReducedMotion() ? 0 : 260
362
- return {
363
- duration,
364
- settle: duration && 280,
365
- transition: "transform 260ms var(--lc-ease-out-expo, ease-out)",
366
- offscreen: "translateY(100%)",
367
- }
368
- }
369
-
370
359
  get quickButtons() {
371
360
  return Array.from(this.element.querySelectorAll(":scope > button[data-emoji]"))
372
361
  }
@@ -40,7 +40,7 @@
40
40
  </button>
41
41
 
42
42
  <div
43
- class="lc-emoji-picker__popover <%= popover_class %>"
43
+ class="lc-emoji-picker__popover lc-sheet <%= popover_class %>"
44
44
  data-lc-emoji-picker-target="popover"
45
45
  data-controller="lc-sheet"
46
46
  data-action="click->lc-emoji-picker#select pointerover->lc-emoji-picker#preview focusin->lc-emoji-picker#preview lc-sheet:dismiss->lc-emoji-picker#close"
@@ -1,5 +1,5 @@
1
1
  module Lostcoords
2
2
  module Ui
3
- VERSION = "0.14.11"
3
+ VERSION = "0.14.12"
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.11
4
+ version: 0.14.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lost Coordinates