use-wc 1.0.0-pre.61 → 1.0.0-pre.63

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.
@@ -977,6 +977,7 @@
977
977
  padding: var(--usewc-layout-popover-menu-padding);
978
978
  background: var(--usewc-color-popover-menu-background);
979
979
  border-radius: var(--usewc-effect-popover-menu-border-radius);
980
+ box-shadow: var(--usewc-effect-popover-menu-shadow);
980
981
 
981
982
  @supports (min-block-size: calc-size(fit-content, min(size, 1px))) {
982
983
  min-block-size: calc-size(fit-content, min(size, var(--min-size)));
@@ -1059,9 +1060,19 @@
1059
1060
 
1060
1061
  /* use-option's own checkmark now renders in-flow (a slot, not a background-image), so it
1061
1062
  already reserves its own leading space via the shared gap/padding above — no extra reservation
1062
- needed here. This block only concerns the native [role="menuitemcheckbox"/"menuitemradio"]
1063
- items, whose checkmark is still theme.css's own background-image on the host. */
1064
- use-menu :is([role="menuitemcheckbox"], [role="menuitemradio"]),
1063
+ needed here. This block only concerns the native [role="menuitemcheckbox"/"menuitemradio"] and
1064
+ [aria-selected] items, whose checkmark is theme.css's own ::before on the host. */
1065
+ use-menu :is([role="menuitemcheckbox"], [role="menuitemradio"], [aria-selected]) {
1066
+ &:has(+ :where([role="menuitemcheckbox"], [role="menuitemradio"], [aria-selected])),
1067
+ & + :where([role="menuitemcheckbox"], [role="menuitemradio"], [aria-selected]) {
1068
+ padding-inline-start: calc(var(--usewc-layout-input-padding-inline) * 2 + var(--usewc-layout-selector-width));
1069
+
1070
+ use-theme-escape & {
1071
+ all: revert-layer;
1072
+ }
1073
+ }
1074
+ }
1075
+
1065
1076
  use-listbox-input {
1066
1077
  &:has(+ :where([role="menuitemcheckbox"], [role="menuitemradio"])),
1067
1078
  & + :where([role="menuitemcheckbox"], [role="menuitemradio"]) {
@@ -1130,19 +1141,46 @@
1130
1141
  }
1131
1142
 
1132
1143
  /* use-option's own checkmark is themed separately, in icon.css, as a mask on its
1133
- selected-indicator part rather than a background-image on the host — this rule only concerns
1134
- the native [aria-checked] menu items, which have no shadow part to target. */
1135
- use-menu [aria-checked="true"] {
1136
- background-image: var(--usewc-effect-menu-item-checkmark-background-image, none);
1137
- /* TODO use logical position */
1138
- background-position: left var(--usewc-layout-input-padding-inline) center;
1139
- background-repeat: no-repeat;
1140
- background-size: var(--usewc-effect-menu-item-checkmark-background-size, 1em);
1144
+ selected-indicator part rather than a ::before on the host — this rule only concerns the
1145
+ native [aria-checked] / [aria-selected] menu items, which have no shadow part to target. The
1146
+ mark is the shared checkmark SVG masked and painted with its own color token (currentColor by
1147
+ default, so it adapts to light/dark on its own), sitting in the leading gutter the
1148
+ padding-reservation block above already carves out. */
1149
+ use-menu :is([aria-checked="true"], [aria-selected="true"]) {
1150
+ position: relative;
1151
+ /* Reserve the gutter unconditionally so the mark never lands on the label, even for a lone
1152
+ marked item with no marked sibling to trigger the adjacency reservation above. */
1153
+ padding-inline-start: calc(var(--usewc-layout-input-padding-inline) * 2 + var(--usewc-layout-selector-width));
1141
1154
 
1142
- use-theme-escape & {
1155
+ &::before {
1156
+ content: "";
1157
+ position: absolute;
1158
+ inset-block: 0;
1159
+ inset-inline-start: var(--usewc-layout-input-padding-inline);
1160
+ margin-block: auto;
1161
+ inline-size: var(--usewc-layout-menu-item-checkmark-size);
1162
+ block-size: var(--usewc-layout-menu-item-checkmark-size);
1163
+ background-color: var(--usewc-effect-menu-item-checkmark-color, currentColor);
1164
+ mask-image: var(--usewc-effect-menu-item-checkmark-mask-image, var(--usewc-icon-checkmark));
1165
+ mask-size: contain;
1166
+ mask-repeat: no-repeat;
1167
+ mask-position: center;
1168
+ }
1169
+
1170
+ use-theme-escape &,
1171
+ use-theme-escape &::before {
1143
1172
  all: revert-layer;
1144
1173
  }
1145
1174
  }
1175
+
1176
+ /* Before it upgrades, a popover-bound use-menu has no [popover] attribute yet — the element
1177
+ injects it in connectedCallback — and isn't :defined, so its slotted items would flash as
1178
+ block content on load. Hide it until then. Once upgraded it's :defined (this rule stops
1179
+ matching) and the injected [popover] keeps it hidden while closed. A standalone always-visible
1180
+ use-menu is hidden only for the few milliseconds until it upgrades. */
1181
+ use-menu:not([popover]):not(:defined) {
1182
+ display: none;
1183
+ }
1146
1184
  }
1147
1185
 
1148
1186
  /* Badge — use-badge.ts ships fixed, literal default styles with no knowledge of the token
@@ -1158,13 +1196,16 @@
1158
1196
  @layer use-theme.badge {
1159
1197
  use-badge {
1160
1198
  --usewc-layout-badge-offset: calc(var(--usewc-layout-badge-dot-size) / 3);
1161
- display: inline-block;
1199
+ display: inline-flex;
1200
+ align-items: center;
1201
+ justify-content: center;
1162
1202
  line-height: 1.5;
1163
1203
  border-radius: var(--usewc-effect-badge-border-radius);
1164
1204
  background: var(--usewc-color-badge-background-static);
1165
1205
  color: var(--usewc-color-badge-text-static);
1166
1206
  font-size: var(--usewc-font-badge-size);
1167
1207
  font-weight: var(--usewc-font-badge-weight);
1208
+ font-variant-numeric: tabular-nums;
1168
1209
  border: var(--usewc-layout-badge-border) solid var(--usewc-color-badge-border);
1169
1210
 
1170
1211
  use-theme-escape & {
@@ -1172,8 +1213,16 @@
1172
1213
  }
1173
1214
  }
1174
1215
 
1216
+ /* A content badge is at least as wide as it is tall — `block-size: 1lh` fixes the height to
1217
+ one line so a longer count can't grow it, `min-inline-size: 1lh` makes a single-glyph badge
1218
+ a circle, and a longer count grows the width out into a pill while the height holds.
1219
+ `tabular-nums` above keeps every digit the same advance width, so `1` and `8`, or `11` and
1220
+ `88`, are identical in size. The inline padding is `em`-relative and small enough that a
1221
+ one-digit count still clears the `1lh` floor rather than widening past it. */
1175
1222
  use-badge:not([dot]) {
1176
1223
  --usewc-layout-badge-offset: 0.5lh;
1224
+ block-size: 1lh;
1225
+ min-inline-size: 1lh;
1177
1226
  padding-inline: var(--usewc-layout-badge-padding-inline);
1178
1227
 
1179
1228
  use-theme-escape & {
package/dist/tokens.css CHANGED
@@ -238,8 +238,9 @@
238
238
  --usewc-layout-dropdown-trigger-icon-size: 1em;
239
239
  --usewc-effect-select-trigger-background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 16L5.0718 8.5L18.9282 8.5L12 16Z' fill='rgb(55,65,81)' /%3E%3C/svg%3E");
240
240
  --usewc-effect-select-trigger-background-size: 1em;
241
- --usewc-effect-menu-item-checkmark-background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 13L10 18L19 7' stroke='rgb(55,65,81)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C%2Fsvg%3E");
242
- --usewc-effect-menu-item-checkmark-background-size: 1em;
241
+ --usewc-effect-menu-item-checkmark-mask-image: var(--usewc-icon-checkmark);
242
+ --usewc-effect-menu-item-checkmark-color: currentColor;
243
+ --usewc-layout-menu-item-checkmark-size: var(--usewc-layout-selected-indicator-size);
243
244
  --usewc-effect-tree-item-expanded-indicator-mask-image: var(--usewc-icon-caret-block-end);
244
245
  --usewc-effect-tree-item-expanded-indicator-color: currentColor;
245
246
  --usewc-effect-tree-item-collapsed-indicator-mask-image: var(--usewc-icon-caret-inline-end);
@@ -532,15 +533,14 @@
532
533
  --usewc-font-button-extra-large-size: var(--usewc-font-size-20);
533
534
  --usewc-layout-button-extra-large-line-height: var(--usewc-line-height-32);
534
535
 
535
- /* Badge */
536
- --usewc-color-badge-background-static: var(--usewc-color-brand-accent);
537
- /* Scaled rather than a fixed white/black: the accent is light enough (2.99:1 with white text,
538
- vs. 7.03:1 with black) that a static color would misjudge it, and would silently stop
539
- matching if the accent itself is ever overridden. */
540
- --usewc-color-badge-text-static: contrast-color(var(--usewc-color-badge-background-static));
536
+ /* Badge — a rose fill with white text: a warm pink-red that stays clear of the danger red's
537
+ hue and the primary blue, so a count badge doesn't read as an error or a button. The fill
538
+ is a fixed shade in both themes (like the primary/danger fills), so no dark-mode override
539
+ is needed. */
540
+ --usewc-color-badge-background-static: oklch(0.62 0.2 12);
541
+ --usewc-color-badge-text-static: var(--usewc-color-white);
541
542
  --usewc-color-badge-border: var(--usewc-color-document-background);
542
- --usewc-layout-badge-padding-inline: var(--usewc-space-6);
543
- --usewc-layout-badge-min-size: var(--usewc-space-16);
543
+ --usewc-layout-badge-padding-inline: var(--usewc-space-4-relative);
544
544
  --usewc-layout-badge-dot-size: var(--usewc-space-12);
545
545
  --usewc-layout-badge-border: var(--usewc-space-1);
546
546
  --usewc-font-badge-size: var(--usewc-font-size-12);
@@ -619,6 +619,7 @@
619
619
  --usewc-color-popover-menu-background: var(--usewc-color-canvas-background);
620
620
  --usewc-color-popover-menu-border: var(--usewc-color-button-base-border-static);
621
621
  --usewc-effect-popover-menu-border-radius: var(--usewc-effect-border-radius-8);
622
+ --usewc-effect-popover-menu-shadow: var(--usewc-effect-surface-shadow);
622
623
  --usewc-font-popover-menu-header-size: var(--usewc-font-size-14);
623
624
  --usewc-font-popover-menu-header-weight: var(--usewc-font-weight-medium);
624
625
  --usewc-color-popover-menu-header-text: var(--usewc-color-gray-400);
@@ -739,7 +740,6 @@
739
740
  --usewc-color-range-track-border-hover: var(--usewc-color-gray-600);
740
741
  --usewc-color-selector-background-hover: oklch(from var(--usewc-color-gray-700) l c h / 0.5);
741
742
  --usewc-effect-select-trigger-background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 16L5.0718 8.5L18.9282 8.5L12 16Z' fill='rgb(229,231,235)' /%3E%3C/svg%3E");
742
- --usewc-effect-menu-item-checkmark-background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 13L10 18L19 7' stroke='rgb(229,231,235)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C%2Fsvg%3E");
743
743
  --usewc-color-surface-backdrop: oklch(0% 0 0 / 0.6);
744
744
  /* "Super light" can't float up on a near-black page — hold the primary's hue and chroma
745
745
  but drop the lightness so the tint reads as a dark primary wash instead. */
package/dist/use-wc.mjs CHANGED
@@ -4471,21 +4471,22 @@ let UseBadge = class UseBadge extends LitElement {
4471
4471
  align-items: center;
4472
4472
  justify-content: center;
4473
4473
  box-sizing: border-box;
4474
- min-inline-size: 1rem;
4475
- min-block-size: 1rem;
4476
- padding-inline: 0.375rem;
4474
+ padding-inline: 0.25em;
4477
4475
  border-radius: 9999px;
4478
4476
  background: CanvasText;
4479
4477
  border: 1px solid currentColor;
4480
4478
  color: Canvas;
4481
4479
  font-size: 0.75rem;
4482
4480
  font-weight: 500;
4483
- line-height: 1;
4481
+ line-height: 1.5;
4482
+ font-variant-numeric: tabular-nums;
4484
4483
  white-space: nowrap;
4485
4484
  }
4486
4485
 
4487
4486
  :host(:not([dot])) {
4488
4487
  --usewc-badge-offset: 0.5lh;
4488
+ block-size: 1lh;
4489
+ min-inline-size: 1lh;
4489
4490
  }
4490
4491
 
4491
4492
  :host(:state(anchored)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "use-wc",
3
- "version": "1.0.0-pre.61",
3
+ "version": "1.0.0-pre.63",
4
4
  "private": false,
5
5
  "homepage": "https://usewc.com",
6
6
  "bugs": "https://github.com/dang-rabbits/use-wc/issues",