@jonmilner/ui 0.2.4 → 0.2.6
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.
- package/dist/Checkbox/Checkbox.css +1 -1
- package/dist/base.css +1 -1
- package/dist/brands/font.d.mts +2 -0
- package/dist/brands/font.mjs +21 -13
- package/dist/brands/metrics.mjs +66 -2
- package/dist/docs/Checkbox.md +3 -3
- package/dist/docs/manifest.json +1 -1
- package/dist/docs/theming.md +2 -2
- package/dist/theme/define-theme.mjs +7 -3
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
@layer tokens, reset, atoms, components.box, components.checkbox, components.clickable, components.icon, components.icon-button, components.inline, components.stack, components.text, components.badge, components.button, components.chip, components.field, components.heading, components.dialog, components.alert-dialog, components.menu, components.multiselect, components.search-field, components.tabs, components.tag, components.toast;
|
|
2
|
-
@layer components.checkbox{._1tze2y80{cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent}._1tze2y80:focus-visible{outline:var(--space-2) solid var(--color-focus);outline-offset:var(--space-2)}._1tze2y80[aria-disabled=true]{cursor:not-allowed}._1tze2y80[aria-readonly=true]{cursor:default}._1tze2y81{inline-size:var(--space-16);block-size:var(--space-16);border:var(--space-1) solid var(--color-border-strong);border-radius:var(--radius-sm);background-color:var(--color-bg);color:var(--color-accent-fg);forced-color-adjust:none;place-items:center;display:grid}._1tze2y80:not([aria-checked=true],[aria-checked=mixed],[aria-invalid=true],[aria-disabled=true],[aria-readonly=true]):hover ._1tze2y81{border-color:var(--color-fg)}._1tze2y80:is([aria-checked=true],[aria-checked=mixed]) ._1tze2y81{background-color:var(--color-accent);border-color:var(--color-accent)}._1tze2y80[aria-disabled=true] ._1tze2y81{border-style:dashed;border-color:var(--color-border-strong);background-color:var(--color-bg-muted);color:var(--color-fg-muted)}._1tze2y80[aria-invalid=true] ._1tze2y81{border-width:var(--space-2);border-color:var(--color-danger)}._1tze2y82{fill:none;stroke:currentColor;stroke-width:2px;stroke-linecap:round;stroke-linejoin:round;block-size:100%;inline-size:100%}._1tze2y80[aria-checked=mixed] ._1tze2y83,._1tze2y80:not([aria-checked=mixed]) ._1tze2y84{display:none}}
|
|
2
|
+
@layer components.checkbox{._1tze2y80{cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent}._1tze2y80:focus-visible{outline:var(--space-2) solid var(--color-focus);outline-offset:var(--space-2)}._1tze2y80[aria-disabled=true]{cursor:not-allowed}._1tze2y80[aria-readonly=true]{cursor:default}._1tze2y81{inline-size:var(--space-16);block-size:var(--space-16);border:var(--space-1) solid var(--color-border-strong);border-radius:var(--radius-sm);background-color:var(--color-bg);color:var(--color-accent-fg);forced-color-adjust:none;place-items:center;display:grid}._1tze2y80:not([aria-checked=true],[aria-checked=mixed],[aria-invalid=true],[aria-disabled=true],[aria-readonly=true]):hover ._1tze2y81{border-color:var(--color-fg)}._1tze2y80:is([aria-checked=true],[aria-checked=mixed]) ._1tze2y81{background-color:var(--color-accent);border-color:var(--color-accent)}._1tze2y80[aria-readonly=true] ._1tze2y81{background-clip:padding-box;border-style:dotted}._1tze2y80[aria-disabled=true] ._1tze2y81{border-style:dashed;border-color:var(--color-border-strong);background-clip:border-box;background-color:var(--color-bg-muted);color:var(--color-fg-muted)}._1tze2y80[aria-invalid=true] ._1tze2y81{border-width:var(--space-2);border-color:var(--color-danger)}._1tze2y82{fill:none;stroke:currentColor;stroke-width:2px;stroke-linecap:round;stroke-linejoin:round;block-size:100%;inline-size:100%}._1tze2y80[aria-checked=mixed] ._1tze2y83,._1tze2y80:not([aria-checked=mixed]) ._1tze2y84{display:none}}
|
package/dist/base.css
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
@layer tokens, reset, atoms, components.box, components.checkbox, components.clickable, components.icon, components.icon-button, components.inline, components.stack, components.text, components.badge, components.button, components.chip, components.field, components.heading, components.dialog, components.alert-dialog, components.menu, components.multiselect, components.search-field, components.tabs, components.tag, components.toast;
|
|
2
2
|
@layer tokens{:root{--space-0:0rem;--space-1:.0625rem;--space-2:.125rem;--space-4:.25rem;--space-6:.375rem;--space-8:.5rem;--space-12:.75rem;--space-16:1rem;--space-20:1.25rem;--space-24:1.5rem;--space-32:2rem;--space-40:2.5rem;--space-48:3rem;--space-64:4rem;--space-80:5rem;--space-96:6rem;--size-xs:1.5rem;--size-sm:2rem;--size-med:2.5rem;--size-lg:3rem;--size-xl:3.5rem;--container-prose:40rem;--container-page:64rem;--container-wide:80rem;--radius-none:0;--radius-sm:.25rem;--radius-med:.5rem;--radius-lg:.75rem;--radius-xl:1rem;--radius-full:9999px;--font-size-xs:.75rem;--font-size-sm:.875rem;--font-size-med:1rem;--font-size-lg:1.125rem;--font-size-xl:1.25rem;--font-size-2xl:1.5rem;--font-size-3xl:1.875rem;--font-size-4xl:2.25rem;--font-weight-regular:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--line-height-sm:1.25;--line-height-med:1.5;--line-height-lg:1.75;--z-index-base:0;--z-index-raised:1;--z-index-dropdown:1000;--z-index-sticky:1100;--z-index-overlay:1200;--z-index-modal:1300;--z-index-popover:1400;--z-index-toast:1500;--z-index-tooltip:1600;--duration-fast:.12s;--duration-med:.2s;--duration-slow:.32s;--easing-standard:cubic-bezier(.2, 0, 0, 1);--easing-enter:cubic-bezier(0, 0, 0, 1);--easing-exit:cubic-bezier(.3, 0, 1, 1);--distance-sm:.25rem;--distance-med:.5rem;--distance-lg:1rem;--scale-sm:.02;--scale-med:.05;--scale-lg:.1}[data-brand]{--shadow-sm:0 1px 2px color-mix(in srgb, var(--color-shadow) 12%, transparent);--shadow-med:0 2px 8px color-mix(in srgb, var(--color-shadow) 14%, transparent), 0 1px 2px color-mix(in srgb, var(--color-shadow) 8%, transparent);--shadow-lg:0 8px 24px color-mix(in srgb, var(--color-shadow) 16%, transparent), 0 2px 6px color-mix(in srgb, var(--color-shadow) 8%, transparent)}[data-brand][data-mode=light]{color-scheme:light}[data-brand][data-mode=dark]{--shadow-sm:0 0 0 1px color-mix(in srgb, var(--color-fg) 10%, transparent), 0 1px 2px color-mix(in srgb, var(--color-shadow) 40%, transparent);--shadow-med:0 0 0 1px color-mix(in srgb, var(--color-fg) 10%, transparent), 0 2px 8px color-mix(in srgb, var(--color-shadow) 48%, transparent), 0 1px 2px color-mix(in srgb, var(--color-shadow) 32%, transparent);--shadow-lg:0 0 0 1px color-mix(in srgb, var(--color-fg) 10%, transparent), 0 8px 24px color-mix(in srgb, var(--color-shadow) 56%, transparent), 0 2px 6px color-mix(in srgb, var(--color-shadow) 32%, transparent);color-scheme:dark}[data-brand][data-mode=system]{color-scheme:light dark}:dir(ltr){--dir:1}:dir(rtl){--dir:-1}@media (prefers-color-scheme:dark){[data-brand][data-mode=system]{--shadow-sm:0 0 0 1px color-mix(in srgb, var(--color-fg) 10%, transparent), 0 1px 2px color-mix(in srgb, var(--color-shadow) 40%, transparent);--shadow-med:0 0 0 1px color-mix(in srgb, var(--color-fg) 10%, transparent), 0 2px 8px color-mix(in srgb, var(--color-shadow) 48%, transparent), 0 1px 2px color-mix(in srgb, var(--color-shadow) 32%, transparent);--shadow-lg:0 0 0 1px color-mix(in srgb, var(--color-fg) 10%, transparent), 0 8px 24px color-mix(in srgb, var(--color-shadow) 56%, transparent), 0 2px 6px color-mix(in srgb, var(--color-shadow) 32%, transparent)}}@media (prefers-reduced-motion:reduce){:root{--distance-sm:0rem;--distance-med:0rem;--distance-lg:0rem;--scale-sm:0;--scale-med:0;--scale-lg:0;--duration-fast:.12s;--duration-med:.12s;--duration-slow:.12s}}}
|
|
3
3
|
|
|
4
|
-
@font-face{src:local(Arial),local(ArialMT);size-adjust:101.568%;ascent-override:95.3892%;descent-override:23.7511%;line-gap-override:0%;font-family:Inter Fallback}@font-face{src:local(Courier New),local(CourierNewPSMT);size-adjust:127.781%;ascent-override:79.8319%;descent-override:23.48%;line-gap-override:0%;font-family:JetBrains Mono Fallback}@layer tokens{[data-brand=default]{--color-bg:light-dark(oklch(100% 0 0),oklch(14.5% .006 265));--color-bg-muted:light-dark(oklch(96.8% .004 265),oklch(27% .01 265));--color-bg-raised:light-dark(oklch(100% 0 0),oklch(20.5% .008 265));--color-fg:light-dark(oklch(14.5% .006 265),oklch(98.5% .002 265));--color-fg-muted:light-dark(oklch(44.5% .014 265),oklch(71% .012 265));--color-border:light-dark(oklch(92.5% .006 265),oklch(27% .01 265));--color-border-strong:oklch(55.5% .014 265);--color-accent:light-dark(oklch(54.6% .19 258),oklch(70.7% .14 258));--color-accent-fg:light-dark(oklch(100% 0 0),oklch(14.5% .006 265));--color-danger:light-dark(oklch(56% .2 25),oklch(70.4% .17 25));--color-danger-fg:light-dark(oklch(100% 0 0),oklch(14.5% .006 265));--color-focus:light-dark(oklch(54.6% .19 258),oklch(70.7% .14 258));--color-shadow:light-dark(oklch(14.5% .006 265),oklch(0% 0 0));--font-body:"Inter", "Inter Fallback", sans-serif;--font-heading:"Inter", "Inter Fallback", sans-serif;--font-display:"Inter", "Inter Fallback", sans-serif;--font-label:"Inter", "Inter Fallback", sans-serif;--font-mono:"JetBrains Mono", "JetBrains Mono Fallback", monospace;--font-trim-body-cap:.36377;--font-trim-body-baseline:.36377;--font-trim-heading-cap:.36377;--font-trim-heading-baseline:.36377;--font-trim-display-cap:.36377;--font-trim-display-baseline:.36377;--font-trim-label-cap:.36377;--font-trim-label-baseline:.36377;--font-trim-mono-cap:.37;--font-trim-mono-baseline:.36}@media (forced-colors:active){[data-brand][data-brand]{--color-bg:Canvas;--color-bg-muted:Canvas;--color-bg-raised:Canvas;--color-fg:CanvasText;--color-fg-muted:CanvasText;--color-border:CanvasText;--color-border-strong:CanvasText;--color-accent:LinkText;--color-accent-fg:Canvas;--color-danger:CanvasText;--color-danger-fg:Canvas;--color-focus:Highlight;--color-shadow:CanvasText}}}
|
|
4
|
+
@font-face{src:local(Arial),local(ArialMT);font-weight:400;font-style:normal;size-adjust:101.568%;ascent-override:95.3892%;descent-override:23.7511%;line-gap-override:0%;font-family:Inter Fallback}@font-face{src:local(Arial Bold),local(Arial-BoldMT);font-weight:700;font-style:normal;size-adjust:101.637%;ascent-override:95.3241%;descent-override:23.7349%;line-gap-override:0%;font-family:Inter Fallback}@font-face{src:local(Arial Italic),local(Arial-ItalicMT);font-weight:400;font-style:italic;size-adjust:101.637%;ascent-override:95.3241%;descent-override:23.7349%;line-gap-override:0%;font-family:Inter Fallback}@font-face{src:local(Arial Bold Italic),local(Arial-BoldItalicMT);font-weight:700;font-style:italic;size-adjust:101.706%;ascent-override:95.2591%;descent-override:23.7187%;line-gap-override:0%;font-family:Inter Fallback}@font-face{src:local(Courier New),local(CourierNewPSMT);font-weight:400;font-style:normal;size-adjust:127.781%;ascent-override:79.8319%;descent-override:23.48%;line-gap-override:0%;font-family:JetBrains Mono Fallback}@font-face{src:local(Courier New Bold),local(CourierNewPS-BoldMT);font-weight:700;font-style:normal;size-adjust:123.353%;ascent-override:82.6977%;descent-override:24.3229%;line-gap-override:0%;font-family:JetBrains Mono Fallback}@font-face{src:local(Courier New Italic),local(CourierNewPS-ItalicMT);font-weight:400;font-style:italic;size-adjust:127.781%;ascent-override:79.8319%;descent-override:23.48%;line-gap-override:0%;font-family:JetBrains Mono Fallback}@font-face{src:local(Courier New Bold Italic),local(CourierNewPS-BoldItalicMT);font-weight:700;font-style:italic;size-adjust:123.353%;ascent-override:82.6977%;descent-override:24.3229%;line-gap-override:0%;font-family:JetBrains Mono Fallback}@layer tokens{[data-brand=default]{--color-bg:light-dark(oklch(100% 0 0),oklch(14.5% .006 265));--color-bg-muted:light-dark(oklch(96.8% .004 265),oklch(27% .01 265));--color-bg-raised:light-dark(oklch(100% 0 0),oklch(20.5% .008 265));--color-fg:light-dark(oklch(14.5% .006 265),oklch(98.5% .002 265));--color-fg-muted:light-dark(oklch(44.5% .014 265),oklch(71% .012 265));--color-border:light-dark(oklch(92.5% .006 265),oklch(27% .01 265));--color-border-strong:oklch(55.5% .014 265);--color-accent:light-dark(oklch(54.6% .19 258),oklch(70.7% .14 258));--color-accent-fg:light-dark(oklch(100% 0 0),oklch(14.5% .006 265));--color-danger:light-dark(oklch(56% .2 25),oklch(70.4% .17 25));--color-danger-fg:light-dark(oklch(100% 0 0),oklch(14.5% .006 265));--color-focus:light-dark(oklch(54.6% .19 258),oklch(70.7% .14 258));--color-shadow:light-dark(oklch(14.5% .006 265),oklch(0% 0 0));--font-body:"Inter", "Inter Fallback", sans-serif;--font-heading:"Inter", "Inter Fallback", sans-serif;--font-display:"Inter", "Inter Fallback", sans-serif;--font-label:"Inter", "Inter Fallback", sans-serif;--font-mono:"JetBrains Mono", "JetBrains Mono Fallback", monospace;--font-trim-body-cap:.36377;--font-trim-body-baseline:.36377;--font-trim-heading-cap:.36377;--font-trim-heading-baseline:.36377;--font-trim-display-cap:.36377;--font-trim-display-baseline:.36377;--font-trim-label-cap:.36377;--font-trim-label-baseline:.36377;--font-trim-mono-cap:.37;--font-trim-mono-baseline:.36}@media (forced-colors:active){[data-brand][data-brand]{--color-bg:Canvas;--color-bg-muted:Canvas;--color-bg-raised:Canvas;--color-fg:CanvasText;--color-fg-muted:CanvasText;--color-border:CanvasText;--color-border-strong:CanvasText;--color-accent:LinkText;--color-accent-fg:Canvas;--color-danger:CanvasText;--color-danger-fg:Canvas;--color-focus:Highlight;--color-shadow:CanvasText}}}
|
|
5
5
|
|
|
6
6
|
@layer reset{*,:before,:after{box-sizing:border-box}*{margin:0}html{-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%;text-size-adjust:100%}body{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;min-block-size:100dvb;line-height:1.5}img,picture,video,canvas,svg{max-inline-size:100%;display:block}input,button,textarea,select{font:inherit;color:inherit}p,h1,h2,h3,h4,h5,h6{overflow-wrap:break-word}h1,h2,h3,h4,h5,h6{text-wrap:balance}}
|
package/dist/brands/font.d.mts
CHANGED
|
@@ -8,7 +8,9 @@ export interface FontMetrics {
|
|
|
8
8
|
readonly descent: number;
|
|
9
9
|
readonly lineGap: number;
|
|
10
10
|
readonly unitsPerEm: number;
|
|
11
|
+
readonly variants?: Readonly<Record<string, FontVariant>>;
|
|
11
12
|
}
|
|
13
|
+
export type FontVariant = Omit<FontMetrics, "variants">;
|
|
12
14
|
export interface BrandFont {
|
|
13
15
|
readonly metrics: FontMetrics;
|
|
14
16
|
readonly fallback: FontMetrics;
|
package/dist/brands/font.mjs
CHANGED
|
@@ -11,25 +11,33 @@ function a({ capHeight: e, ascent: n, descent: r, unitsPerEm: i }) {
|
|
|
11
11
|
baseline: t(a)
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
var o = 1.0001;
|
|
15
|
-
function
|
|
16
|
-
let
|
|
14
|
+
var o = 1.0001, s = /^([1-9]00)?(italic)?$/, c = (e, t) => e.variants?.[t]?.familyName === e.familyName, l = ({ fallback: e }) => ["regular", ...Object.keys(e.variants ?? {}).filter((t) => t !== "" && s.test(t) && c(e, t))];
|
|
15
|
+
function u({ metrics: t, fallback: r }, i = "regular") {
|
|
16
|
+
let a = i === "regular", l = a ? r : c(r, i) && r.variants?.[i], u = s.exec(a ? "" : i);
|
|
17
|
+
if (!l || !u) throw Error(`"${r.familyName}" has no ${i} variant`);
|
|
18
|
+
let d = !a && c(t, i) && t.variants?.[i] || t, f = d.capHeight / d.unitsPerEm / (l.capHeight / l.unitsPerEm), p = d.unitsPerEm * f, m = [l.fullName ?? l.familyName, l.postscriptName];
|
|
17
19
|
return {
|
|
18
|
-
src: [...new Set(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
src: [...new Set(m)].filter(Boolean).map((t) => `local(${e(t)})`).join(", "),
|
|
21
|
+
fontWeight: u[1] ?? "400",
|
|
22
|
+
fontStyle: u[2] ? "italic" : "normal",
|
|
23
|
+
sizeAdjust: n(f),
|
|
24
|
+
ascentOverride: n(d.ascent / p * o),
|
|
25
|
+
descentOverride: n(Math.abs(d.descent) / p * o),
|
|
26
|
+
lineGapOverride: n(d.lineGap / p)
|
|
23
27
|
};
|
|
24
28
|
}
|
|
25
|
-
function
|
|
29
|
+
function d(e) {
|
|
26
30
|
let t = /* @__PURE__ */ new Map();
|
|
27
31
|
for (let n of e) {
|
|
28
|
-
let e = r(n), i =
|
|
29
|
-
|
|
32
|
+
let e = r(n), i = t.get(e) ?? /* @__PURE__ */ new Map();
|
|
33
|
+
for (let t of l(n)) {
|
|
34
|
+
let r = u(n, t), a = `${r.fontWeight} ${r.fontStyle}`, o = i.get(a);
|
|
35
|
+
if (o && JSON.stringify(o) !== JSON.stringify(r)) throw Error(`"${e}" is declared with different metrics or fallbacks`);
|
|
36
|
+
i.set(a, r);
|
|
37
|
+
}
|
|
30
38
|
t.set(e, i);
|
|
31
39
|
}
|
|
32
|
-
return t;
|
|
40
|
+
return new Map([...t].map(([e, t]) => [e, [...t.values()]]));
|
|
33
41
|
}
|
|
34
42
|
//#endregion
|
|
35
|
-
export {
|
|
43
|
+
export { u as fallbackFace, d as fallbackFaces, r as fallbackFamily, l as fallbackVariants, i as fontStack, a as fontTrim };
|
package/dist/brands/metrics.mjs
CHANGED
|
@@ -25,7 +25,39 @@ var e = {
|
|
|
25
25
|
ascent: 1854,
|
|
26
26
|
descent: -434,
|
|
27
27
|
lineGap: 67,
|
|
28
|
-
unitsPerEm: 2048
|
|
28
|
+
unitsPerEm: 2048,
|
|
29
|
+
variants: {
|
|
30
|
+
700: {
|
|
31
|
+
familyName: "Arial",
|
|
32
|
+
fullName: "Arial Bold",
|
|
33
|
+
postscriptName: "Arial-BoldMT",
|
|
34
|
+
capHeight: 1466,
|
|
35
|
+
ascent: 1854,
|
|
36
|
+
descent: -434,
|
|
37
|
+
lineGap: 67,
|
|
38
|
+
unitsPerEm: 2048
|
|
39
|
+
},
|
|
40
|
+
italic: {
|
|
41
|
+
familyName: "Arial",
|
|
42
|
+
fullName: "Arial Italic",
|
|
43
|
+
postscriptName: "Arial-ItalicMT",
|
|
44
|
+
capHeight: 1466,
|
|
45
|
+
ascent: 1854,
|
|
46
|
+
descent: -434,
|
|
47
|
+
lineGap: 67,
|
|
48
|
+
unitsPerEm: 2048
|
|
49
|
+
},
|
|
50
|
+
"700italic": {
|
|
51
|
+
familyName: "Arial",
|
|
52
|
+
fullName: "Arial Bold Italic",
|
|
53
|
+
postscriptName: "Arial-BoldItalicMT",
|
|
54
|
+
capHeight: 1465,
|
|
55
|
+
ascent: 1854,
|
|
56
|
+
descent: -434,
|
|
57
|
+
lineGap: 67,
|
|
58
|
+
unitsPerEm: 2048
|
|
59
|
+
}
|
|
60
|
+
}
|
|
29
61
|
}, r = {
|
|
30
62
|
familyName: "Courier New",
|
|
31
63
|
fullName: "Courier New",
|
|
@@ -34,7 +66,39 @@ var e = {
|
|
|
34
66
|
ascent: 1705,
|
|
35
67
|
descent: -615,
|
|
36
68
|
lineGap: 0,
|
|
37
|
-
unitsPerEm: 2048
|
|
69
|
+
unitsPerEm: 2048,
|
|
70
|
+
variants: {
|
|
71
|
+
700: {
|
|
72
|
+
familyName: "Courier New",
|
|
73
|
+
fullName: "Courier New Bold",
|
|
74
|
+
postscriptName: "CourierNewPS-BoldMT",
|
|
75
|
+
capHeight: 1212,
|
|
76
|
+
ascent: 1705,
|
|
77
|
+
descent: -615,
|
|
78
|
+
lineGap: 0,
|
|
79
|
+
unitsPerEm: 2048
|
|
80
|
+
},
|
|
81
|
+
italic: {
|
|
82
|
+
familyName: "Courier New",
|
|
83
|
+
fullName: "Courier New Italic",
|
|
84
|
+
postscriptName: "CourierNewPS-ItalicMT",
|
|
85
|
+
capHeight: 1170,
|
|
86
|
+
ascent: 1705,
|
|
87
|
+
descent: -615,
|
|
88
|
+
lineGap: 0,
|
|
89
|
+
unitsPerEm: 2048
|
|
90
|
+
},
|
|
91
|
+
"700italic": {
|
|
92
|
+
familyName: "Courier New",
|
|
93
|
+
fullName: "Courier New Bold Italic",
|
|
94
|
+
postscriptName: "CourierNewPS-BoldItalicMT",
|
|
95
|
+
capHeight: 1212,
|
|
96
|
+
ascent: 1705,
|
|
97
|
+
descent: -615,
|
|
98
|
+
lineGap: 0,
|
|
99
|
+
unitsPerEm: 2048
|
|
100
|
+
}
|
|
101
|
+
}
|
|
38
102
|
};
|
|
39
103
|
//#endregion
|
|
40
104
|
export { n as arial, r as courierNew, e as inter, t as jetBrainsMono };
|
package/dist/docs/Checkbox.md
CHANGED
|
@@ -22,13 +22,13 @@ A two-state choice, with a third mixed state for a "select all" over a partly se
|
|
|
22
22
|
- Put `name` on the `Field` (or on the Checkbox outside one). A checked box submits `value` (default `"on"`); an unchecked one submits nothing unless you set `uncheckedValue`.
|
|
23
23
|
- `checked` with `onCheckedChange` controls it; `defaultChecked` leaves it uncontrolled.
|
|
24
24
|
- `indeterminate` shows the dash and sets `aria-checked="mixed"`, whatever `checked` is. Clear it yourself when the user clicks: Base UI toggles `checked` but leaves `indeterminate` as you pass it.
|
|
25
|
-
- `disabled` takes it out of the tab order and dashes the border; `readOnly` keeps it focusable and announced (`aria-readonly`) but unchangeable
|
|
25
|
+
- `disabled` takes it out of the tab order and dashes the border; `readOnly` keeps it focusable and announced (`aria-readonly`) but unchangeable, dots the border (disabled's dashes win when both are set) and drops the hover; still say nearby why it cannot change. Set `disabled` on the `Field` to disable the checkbox and mute the label together.
|
|
26
26
|
- Space toggles it; Enter submits the form it is in, as on a native checkbox.
|
|
27
27
|
- For an error, set `invalid` on the `Field` with the message in `Field.Error`; the box border thickens and turns `danger`, and the message says what is wrong.
|
|
28
28
|
- Layout and the target are default style props (`display="inline-flex"`, centered, `flexShrink={0}`, `minInlineSize` and `minBlockSize` `"xs"`, 24px). Raise them freely; never set them below `"xs"`. The box is 16px; there are no sizes yet.
|
|
29
29
|
- `className` is a string and `style` an object (not Base UI's state functions); they go to the span, after the defaults. `render` and `nativeButton` are not accepted.
|
|
30
30
|
- The module has no hooks, so a server component can render it. `onCheckedChange` is a function: set it from a client component.
|
|
31
|
-
- Style states off the ARIA attributes (`[aria-checked='true']`, `'mixed'`, `[aria-disabled='true']`, `[aria-invalid='true']`), not Base UI's `data-*` attributes.
|
|
31
|
+
- Style states off the ARIA attributes (`[aria-checked='true']`, `'mixed'`, `[aria-disabled='true']`, `[aria-readonly='true']`, `[aria-invalid='true']`), not Base UI's `data-*` attributes.
|
|
32
32
|
|
|
33
33
|
## Do
|
|
34
34
|
|
|
@@ -77,7 +77,7 @@ A two-state choice, with a third mixed state for a "select all" over a partly se
|
|
|
77
77
|
|
|
78
78
|
- Role `checkbox` with `aria-checked` `"true"`, `"false"` or `"mixed"`; `aria-disabled`, `aria-readonly` and `aria-required` follow the props, and `aria-invalid` the `Field`.
|
|
79
79
|
- The label, description and error reach it through `aria-labelledby` and `aria-describedby`, which Base UI adds after hydration; server HTML has the label's `for`.
|
|
80
|
-
- Checked and mixed are a filled box with a tick or a dash, invalid a thicker border, disabled a dashed one, so no state is color alone. The box border is `borderStrong` (3:1 on every surface).
|
|
80
|
+
- Checked and mixed are a filled box with a tick or a dash, invalid a thicker border, disabled a dashed one, read-only a dotted one (the fill stops inside it, so the dots show when checked), so no state is color alone and each survives forced colors. The box border is `borderStrong` (3:1 on every surface).
|
|
81
81
|
- Under forced colors the box keeps its role colors' system mappings: the fill is `LinkText` and the mark `Canvas` when checked, the border `CanvasText`, the focus ring `Highlight`.
|
|
82
82
|
- The target is 24 by 24 CSS px; the focus ring wraps the target, not the box.
|
|
83
83
|
|
package/dist/docs/manifest.json
CHANGED
package/dist/docs/theming.md
CHANGED
|
@@ -39,7 +39,7 @@ const inbox = defineTheme({
|
|
|
39
39
|
- **Give a custom brand its own name.** A theme applies page-wide, not only inside its provider: a theme named `default` recolors every `default` provider on the page. The name must be a CSS identifier.
|
|
40
40
|
- **Contrast is checked in development.** Outside production, `defineTheme` throws when a text, fill or focus pair fails WCAG AA in either mode, and lists the pairs. It also checks text on component fills mixed from your roles, such as the dark-mode menu highlight (`fg` 10% into `bgRaised`), where `fg`, `fgMuted` and `danger` need 4.5:1 too, and Button's hover (`fg` 15% over each variant's fill), where `fg`, `accentFg` and `dangerFg` need 4.5:1 on `bg`, `accent` and `danger` tinted. The roles a fill mixes must be opaque. Colors must be literal: hex, `rgb()`, `oklab()`, `oklch()`, `color-mix()` or `light-dark()`. Named colors other than `white`, `black` and `transparent` are rejected, as is a translucent background. `var()` may only reference another color role (`var(--color-accent)`).
|
|
41
41
|
- **Override theme tokens in unlayered CSS or in the theme itself.** The theme is unlayered, so a token set in `@layer app` loses to it. Preset tokens live in `@layer tokens` and can be overridden from `@layer app`.
|
|
42
|
-
- **Fallback faces are global.** A brand font's fallback face is named `"<Family> Fallback"`. The theme declares only faces `base.css` lacks
|
|
42
|
+
- **Fallback faces are global.** A brand font's fallback face is named `"<Family> Fallback"`. The theme declares only faces `base.css` lacks. A font reusing a family name must agree with every face it shares, weight and style included: a fallback listing fewer variants (such as capsize's per-font `arial` import) reuses the others' faces, but one that sizes a shared face differently, or adds a weight or style to a preset's family, throws.
|
|
43
43
|
- **Values must be plain.** Color values and font names may not contain CSS syntax (`;`, braces, `<`, `>`, `\`, `!`, `/*`) or, for font names, quotes; `defineTheme` throws in every mode.
|
|
44
44
|
- **Each change gets its own `href`.** The `href` hashes the CSS, so a theme rebuilt with new colors replaces the old one instead of being deduped away.
|
|
45
45
|
- Under forced colors, every role maps to a system color, as for presets.
|
|
@@ -58,4 +58,4 @@ A provider's `color-scheme` stops at its `div`, so the page canvas and scrollbar
|
|
|
58
58
|
|
|
59
59
|
A brand declares its fonts; the app loads them (fontsource or self-hosted `@font-face`) and owns preloading. The `default` brand uses Inter and JetBrains Mono. In development, `ThemeProvider` warns in the console when a brand font has no `@font-face` or fails to load; in production it renders no check and the check's body is dead code.
|
|
60
60
|
|
|
61
|
-
Until a web font loads, text renders in a fallback face sized to the web font's cap height, so the trim holds where the fallback font (Arial, Courier New) is installed; elsewhere the generic family renders unadjusted. Widths still differ: in the `default` brand, `mono` text is about 28% wider than JetBrains Mono, so expect code to overflow or wrap until the font loads. Where width matters, preload the mono font and load it with `font-display: block` (or `optional`, which may keep the fallback for that page view); a custom brand's gap depends on its own fallback.
|
|
61
|
+
Until a web font loads, text renders in a fallback face sized to the web font's cap height, so the trim holds where the fallback font (Arial, Courier New) is installed; elsewhere the generic family renders unadjusted. Bold, italic and bold italic text get their own fallback faces (`local("Arial Bold")` and so on), each sized to the web font's matching weight and style; in a custom brand, give `fallback` (and `metrics`, for the web font's own sizes) a `variants` map keyed `700`, `italic` and `700italic`, as `@capsizecss/metrics`' `entireMetricsCollection` has them. A fallback without `variants` gets only the regular face, and the browser synthesizes bold and italic from it. Widths still differ: in the `default` brand, `mono` text is about 28% wider than JetBrains Mono, so expect code to overflow or wrap until the font loads. Where width matters, preload the mono font and load it with `font-display: block` (or `optional`, which may keep the fallback for that page view); a custom brand's gap depends on its own fallback.
|
|
@@ -14,7 +14,11 @@ function _(o) {
|
|
|
14
14
|
};
|
|
15
15
|
/^[a-z][\w-]*$/i.test(o.name) || s("the name must be a CSS identifier");
|
|
16
16
|
for (let [e, t] of Object.entries(o.color)) v.test(t) && s(`color.${e} must be a single color value`);
|
|
17
|
-
for (let [e, { metrics: t, fallback: n }] of Object.entries(o.font)) for (let r of [
|
|
17
|
+
for (let [e, { metrics: t, fallback: n }] of Object.entries(o.font)) for (let r of [
|
|
18
|
+
t,
|
|
19
|
+
n,
|
|
20
|
+
...Object.values(n.variants ?? {})
|
|
21
|
+
].flatMap((e) => [
|
|
18
22
|
e.familyName,
|
|
19
23
|
e.fullName,
|
|
20
24
|
e.postscriptName
|
|
@@ -27,9 +31,9 @@ function _(o) {
|
|
|
27
31
|
return s(e.message);
|
|
28
32
|
}
|
|
29
33
|
let b = new Set(l.map(t));
|
|
30
|
-
for (let
|
|
34
|
+
for (let [t, n] of e(u)) b.delete(t), _.get(t).length > n.length && s(`"${t}" is declared with a weight or style base.css lacks`);
|
|
31
35
|
let x = [
|
|
32
|
-
...[..._].filter(([e]) => b.has(e)).
|
|
36
|
+
...[..._].filter(([e]) => b.has(e)).flatMap(([e, t]) => t.map((t) => g("@font-face", [["font-family", `"${e}"`], ...Object.entries(t).map(([e, t]) => [h(e), t])]))),
|
|
33
37
|
g(c, [...d.map((e) => [m(p.color[e]), o.color[e]]), ...f.flatMap((e) => {
|
|
34
38
|
let t = r(o.font[e].metrics);
|
|
35
39
|
return [
|