@skdx/tokens 0.27.0 → 0.29.0
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/LICENSE +21 -0
- package/README.md +92 -69
- package/dist/foundation.css +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -1
- package/dist/themes/AntDark.cjs +1 -1
- package/dist/themes/AntDark.d.cts +3 -12
- package/dist/themes/AntDark.d.ts +3 -12
- package/dist/themes/AntDark.js +1 -1
- package/dist/themes/{AntBrand.cjs → AntLight.cjs} +1 -1
- package/dist/themes/{AntBrand.d.cts → AntLight.d.cts} +1 -1
- package/dist/themes/{AntBrand.d.ts → AntLight.d.ts} +1 -1
- package/dist/themes/{AntBrand.js → AntLight.js} +1 -1
- package/dist/themes/CatppuccinLatte.cjs +1 -1
- package/dist/themes/CatppuccinLatte.d.cts +1 -7
- package/dist/themes/CatppuccinLatte.d.ts +1 -7
- package/dist/themes/CatppuccinLatte.js +1 -1
- package/dist/themes/CatppuccinMocha.cjs +1 -1
- package/dist/themes/CatppuccinMocha.d.cts +1 -7
- package/dist/themes/CatppuccinMocha.d.ts +1 -7
- package/dist/themes/CatppuccinMocha.js +1 -1
- package/dist/themes/ChakraDark.cjs +1 -1
- package/dist/themes/ChakraDark.d.cts +3 -12
- package/dist/themes/ChakraDark.d.ts +3 -12
- package/dist/themes/ChakraDark.js +1 -1
- package/dist/themes/{ChakraBrand.cjs → ChakraLight.cjs} +1 -1
- package/dist/themes/{ChakraBrand.d.cts → ChakraLight.d.cts} +1 -1
- package/dist/themes/{ChakraBrand.d.ts → ChakraLight.d.ts} +1 -1
- package/dist/themes/{ChakraBrand.js → ChakraLight.js} +1 -1
- package/dist/themes/CupcakeDark.cjs +1 -1
- package/dist/themes/CupcakeDark.d.cts +3 -5
- package/dist/themes/CupcakeDark.d.ts +3 -5
- package/dist/themes/CupcakeLight.cjs +1 -1
- package/dist/themes/CupcakeLight.d.cts +1 -8
- package/dist/themes/CupcakeLight.d.ts +1 -8
- package/dist/themes/CupcakeLight.js +1 -1
- package/dist/themes/DefaultTheme.cjs +1 -1
- package/dist/themes/DefaultTheme.d.cts +3 -15
- package/dist/themes/DefaultTheme.d.ts +3 -15
- package/dist/themes/DefaultTheme.js +1 -1
- package/dist/themes/DraculaLight.cjs +1 -1
- package/dist/themes/DraculaLight.d.cts +3 -10
- package/dist/themes/DraculaLight.d.ts +3 -10
- package/dist/themes/DraculaLight.js +1 -1
- package/dist/themes/EmeraldDark.cjs +1 -1
- package/dist/themes/EmeraldDark.d.cts +3 -8
- package/dist/themes/EmeraldDark.d.ts +3 -8
- package/dist/themes/EmeraldDark.js +1 -1
- package/dist/themes/{EmeraldBrand.cjs → EmeraldLight.cjs} +1 -1
- package/dist/themes/{EmeraldBrand.d.cts → EmeraldLight.d.cts} +1 -1
- package/dist/themes/{EmeraldBrand.d.ts → EmeraldLight.d.ts} +1 -1
- package/dist/themes/{EmeraldBrand.js → EmeraldLight.js} +1 -1
- package/dist/themes/EverforestDark.cjs +1 -1
- package/dist/themes/EverforestDark.d.cts +1 -2
- package/dist/themes/EverforestDark.d.ts +1 -2
- package/dist/themes/EverforestDark.js +1 -1
- package/dist/themes/EverforestLight.cjs +1 -1
- package/dist/themes/EverforestLight.d.cts +3 -9
- package/dist/themes/EverforestLight.d.ts +3 -9
- package/dist/themes/FluentDark.cjs +1 -1
- package/dist/themes/FluentDark.d.cts +3 -11
- package/dist/themes/FluentDark.d.ts +3 -11
- package/dist/themes/FluentDark.js +1 -1
- package/dist/themes/{FluentBrand.cjs → FluentLight.cjs} +1 -1
- package/dist/themes/{FluentBrand.d.cts → FluentLight.d.cts} +1 -1
- package/dist/themes/{FluentBrand.d.ts → FluentLight.d.ts} +1 -1
- package/dist/themes/{FluentBrand.js → FluentLight.js} +1 -1
- package/dist/themes/GraphiteDark.cjs +1 -1
- package/dist/themes/GraphiteDark.d.cts +3 -8
- package/dist/themes/GraphiteDark.d.ts +3 -8
- package/dist/themes/GraphiteDark.js +1 -1
- package/dist/themes/{GraphiteBrand.cjs → GraphiteLight.cjs} +1 -1
- package/dist/themes/{GraphiteBrand.d.cts → GraphiteLight.d.cts} +1 -1
- package/dist/themes/{GraphiteBrand.d.ts → GraphiteLight.d.ts} +1 -1
- package/dist/themes/{GraphiteBrand.js → GraphiteLight.js} +1 -1
- package/dist/themes/GruvboxDark.cjs +1 -1
- package/dist/themes/GruvboxDark.d.cts +1 -7
- package/dist/themes/GruvboxDark.d.ts +1 -7
- package/dist/themes/GruvboxDark.js +1 -1
- package/dist/themes/GruvboxLight.cjs +1 -1
- package/dist/themes/GruvboxLight.d.cts +3 -13
- package/dist/themes/GruvboxLight.d.ts +3 -13
- package/dist/themes/GruvboxLight.js +1 -1
- package/dist/themes/MaterialDark.cjs +1 -1
- package/dist/themes/MaterialDark.d.cts +3 -12
- package/dist/themes/MaterialDark.d.ts +3 -12
- package/dist/themes/MaterialDark.js +1 -1
- package/dist/themes/{MaterialBrand.cjs → MaterialLight.cjs} +1 -1
- package/dist/themes/MaterialLight.d.cts +3 -0
- package/dist/themes/MaterialLight.d.ts +3 -0
- package/dist/themes/{MaterialBrand.js → MaterialLight.js} +1 -1
- package/dist/themes/MidnightDark.cjs +1 -0
- package/dist/themes/MidnightDark.d.cts +3 -0
- package/dist/themes/MidnightDark.d.ts +3 -0
- package/dist/themes/{MidnightBrand.js → MidnightDark.js} +1 -1
- package/dist/themes/MidnightLight.cjs +1 -1
- package/dist/themes/MidnightLight.d.cts +4 -6
- package/dist/themes/MidnightLight.d.ts +4 -6
- package/dist/themes/MidnightLight.js +1 -1
- package/dist/themes/NordDark.cjs +1 -1
- package/dist/themes/NordDark.js +1 -1
- package/dist/themes/NordLight.cjs +1 -1
- package/dist/themes/NordLight.d.cts +3 -13
- package/dist/themes/NordLight.d.ts +3 -13
- package/dist/themes/NordLight.js +1 -1
- package/dist/themes/OneDark.cjs +1 -1
- package/dist/themes/OneDark.d.cts +1 -7
- package/dist/themes/OneDark.d.ts +1 -7
- package/dist/themes/OneDark.js +1 -1
- package/dist/themes/OneLight.cjs +1 -1
- package/dist/themes/OneLight.d.cts +3 -9
- package/dist/themes/OneLight.d.ts +3 -9
- package/dist/themes/OneLight.js +1 -1
- package/dist/themes/PrimerDark.cjs +1 -1
- package/dist/themes/PrimerDark.d.cts +0 -1
- package/dist/themes/PrimerDark.d.ts +0 -1
- package/dist/themes/PrimerDark.js +1 -1
- package/dist/themes/PrimerLight.d.cts +1 -7
- package/dist/themes/PrimerLight.d.ts +1 -7
- package/dist/themes/RosePine.cjs +1 -1
- package/dist/themes/RosePine.d.cts +1 -7
- package/dist/themes/RosePine.d.ts +1 -7
- package/dist/themes/RosePine.js +1 -1
- package/dist/themes/RosePineDawn.cjs +1 -1
- package/dist/themes/RosePineDawn.d.cts +3 -9
- package/dist/themes/RosePineDawn.d.ts +3 -9
- package/dist/themes/RosePineDawn.js +1 -1
- package/dist/themes/SkandaDark.cjs +1 -1
- package/dist/themes/SkandaDark.d.cts +5 -8
- package/dist/themes/SkandaDark.d.ts +5 -8
- package/dist/themes/SkandaDark.js +1 -1
- package/dist/themes/SkandaLight.cjs +1 -1
- package/dist/themes/SkandaLight.js +1 -1
- package/dist/themes/SolarizedDark.d.cts +1 -7
- package/dist/themes/SolarizedDark.d.ts +1 -7
- package/dist/themes/SolarizedLight.cjs +1 -1
- package/dist/themes/SolarizedLight.d.cts +1 -7
- package/dist/themes/SolarizedLight.d.ts +1 -7
- package/dist/themes/SolarizedLight.js +1 -1
- package/dist/themes/SynthwaveDark.d.cts +1 -7
- package/dist/themes/SynthwaveDark.d.ts +1 -7
- package/dist/themes/SynthwaveLight.cjs +1 -1
- package/dist/themes/SynthwaveLight.d.cts +3 -12
- package/dist/themes/SynthwaveLight.d.ts +3 -12
- package/dist/themes/SynthwaveLight.js +1 -1
- package/dist/themes/brands.cjs +1 -1
- package/dist/themes/brands.d.cts +5 -28
- package/dist/themes/brands.d.ts +5 -28
- package/dist/themes/brands.js +1 -1
- package/dist/themes/createBrandTheme.cjs +1 -1
- package/dist/themes/createBrandTheme.d.cts +11 -23
- package/dist/themes/createBrandTheme.d.ts +11 -23
- package/dist/themes/createBrandTheme.js +1 -1
- package/dist/themes/index.cjs +1 -1
- package/dist/themes/index.d.cts +10 -9
- package/dist/themes/index.d.ts +10 -9
- package/dist/themes/index.js +1 -1
- package/dist/themes.css +1 -1
- package/dist/tokens.css +1 -1
- package/dist/tokens.dtcg.json +14246 -0
- package/dist/utils/aliases.cjs +9 -3
- package/dist/utils/aliases.d.cts +19 -99
- package/dist/utils/aliases.d.ts +19 -99
- package/dist/utils/aliases.js +9 -3
- package/dist/utils/contrast.d.cts +2 -17
- package/dist/utils/contrast.d.ts +2 -17
- package/dist/utils/cssVars.cjs +2 -2
- package/dist/utils/cssVars.d.cts +12 -37
- package/dist/utils/cssVars.d.ts +12 -37
- package/dist/utils/cssVars.js +2 -2
- package/dist/utils/foundation.cjs +4 -4
- package/dist/utils/foundation.d.cts +24 -177
- package/dist/utils/foundation.d.ts +24 -177
- package/dist/utils/foundation.js +3 -3
- package/dist/utils/mode.cjs +1 -1
- package/dist/utils/mode.d.cts +18 -57
- package/dist/utils/mode.d.ts +18 -57
- package/dist/utils/mode.js +1 -1
- package/dist/utils/theme.cjs +1 -1
- package/dist/utils/theme.d.cts +68 -292
- package/dist/utils/theme.d.ts +68 -292
- package/dist/utils/toCss.cjs +5 -5
- package/dist/utils/toCss.d.cts +22 -60
- package/dist/utils/toCss.d.ts +22 -60
- package/dist/utils/toCss.js +5 -5
- package/package.json +5 -4
- package/dist/themes/MaterialBrand.d.cts +0 -3
- package/dist/themes/MaterialBrand.d.ts +0 -3
- package/dist/themes/MidnightBrand.cjs +0 -1
- package/dist/themes/MidnightBrand.d.cts +0 -11
- package/dist/themes/MidnightBrand.d.ts +0 -11
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
${(0,
|
|
1
|
+
"use strict";var a=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var R=(r,o)=>{for(var t in o)a(r,t,{get:o[t],enumerable:!0})},k=(r,o,t,m)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of b(o))!w.call(r,s)&&s!==t&&a(r,s,{get:()=>o[s],enumerable:!(m=v(o,s))||m.enumerable});return r};var z=r=>k(a({},"__esModule",{value:!0}),r);var F={};R(F,{borderWidth:()=>y,breakpoints:()=>M,coarsePointerToCssVars:()=>$,controls:()=>f,controlsCoarse:()=>u,focusRing:()=>h,foundationToCss:()=>V,foundationToCssVars:()=>C,motion:()=>x,opacity:()=>T,radii:()=>d,shadows:()=>l,space:()=>c,typography:()=>p,zIndex:()=>g});module.exports=z(F);var e=require("./cssVars.cjs"),i=require("./theme.cjs"),p={fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif",fontFamilyMono:"'SF Mono', SFMono-Regular, ui-monospace, Menlo, Consolas, monospace",fontSize:{xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem"},fontWeight:{regular:400,medium:500,semibold:600,bold:700},lineHeight:{tight:"1.25",snug:"1.43",normal:"1.5",relaxed:"1.75"},letterSpacing:{tight:"-0.015em",normal:"0em",wide:"0.025em",wider:"0.05em"}},c={1:"0.25rem",2:"0.5rem",3:"0.75rem",4:"1rem",5:"1.25rem",6:"1.5rem",8:"2rem",10:"2.5rem",12:"3rem",16:"4rem"},d={sm:"0.25rem",inner:"0.375rem",md:"0.5rem",lg:"0.75rem",xl:"1rem",full:"9999px"},l={sm:`0 1px 2px 0 ${n(.05)}`,md:`0 4px 6px -1px ${n(.1)}, 0 2px 4px -2px ${n(.1)}`,lg:`0 10px 15px -3px ${n(.1)}, 0 4px 6px -4px ${n(.1)}`,overlay:`0 25px 50px -12px ${n(.25)}`};function n(r){return`rgb(var(--${e.PREFIX}-shadow-color) / calc(${r} * var(--${e.PREFIX}-shadow-strength)))`}var x=i.defaultMotion,g={base:0,dropdown:10,sticky:20,overlay:30,modal:35,popover:40,toast:50,max:9999},h={width:"2px",offset:"2px",offsetInset:"calc(-1 * var(--skdx-focus-ring-width))"},y={thin:"1px",thick:"2px",thicker:"4px"},f={control:{height:{sm:"1.875rem",md:"2.25rem",lg:"2.625rem",compact:"2rem"},padding:{sm:"0.625rem",md:`var(--${e.PREFIX}-space-3)`,lg:`var(--${e.PREFIX}-space-4)`},gap:{sm:`var(--${e.PREFIX}-space-1)`,md:`var(--${e.PREFIX}-space-2)`,lg:`var(--${e.PREFIX}-space-2)`}},iconSize:{sm:"1rem",md:"1.25rem",lg:"1.5rem"},indicatorSize:{sm:"1rem",md:"1.25rem",lg:"1.5rem"},item:{height:{sm:"1.75rem",md:"2.25rem",lg:"2.5rem"},gap:"2px"},overlay:{padding:`var(--${e.PREFIX}-space-1)`,radius:`var(--${e.PREFIX}-radius-lg)`,minWidth:"7.5rem"},field:{gap:`var(--${e.PREFIX}-space-1)`,labelGap:`var(--${e.PREFIX}-space-1)`},target:{min:"24px"}},u={control:{height:{sm:"2.25rem",md:"2.75rem",lg:"3rem",compact:"2.75rem"}},item:{height:{sm:"2.25rem",md:"2.75rem",lg:"3rem"}},target:{min:"44px"}},T={disabled:"0.5",scrim:"0.6"},M={sm:640,md:768,lg:1024,xl:1280};function C(){return(0,e.sectionsToCssVars)([["font",p],["space",c],["radius",d],["shadow",l],["motion",x],["z-index",g],["focus-ring",h],["border-width",y],["opacity",T],...S(f)])}function S(r){let o=t=>r[t];return[["control",o("control")],["icon-size",o("iconSize")],["indicator-size",o("indicatorSize")],["item",o("item")],["overlay",o("overlay")],["field",o("field")],["target",o("target")]]}function $(){return(0,e.sectionsToCssVars)(S(u))}function V(){let r=C(),o=(0,e.reducedMotionVarNames)(r).map(t=>` ${t}: 0ms;`);return`:root {
|
|
2
|
+
${(0,e.varsToDeclarations)(r)}
|
|
3
3
|
}
|
|
4
4
|
@media (prefers-reduced-motion: reduce) {
|
|
5
5
|
:root {
|
|
6
|
-
${
|
|
6
|
+
${o.join(`
|
|
7
7
|
`)}
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
@media (pointer: coarse) {
|
|
11
11
|
:root {
|
|
12
|
-
${(0,
|
|
12
|
+
${(0,e.varsToDeclarations)($()," ")}
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
`}0&&(module.exports={borderWidth,breakpoints,coarsePointerToCssVars,controls,controlsCoarse,focusRing,foundationToCss,foundationToCssVars,motion,opacity,radii,shadows,space,typography,zIndex});
|
|
@@ -1,79 +1,17 @@
|
|
|
1
|
+
import { type CssVar } from './cssVars.cjs';
|
|
1
2
|
import { type ThemeControls, type ThemeControlsCoarse, type ThemeMotion, type ThemeRadii, type ThemeShadows, type ThemeSpace, type ThemeTypography } from './theme.cjs';
|
|
2
|
-
/**
|
|
3
|
-
* The type system: one font stack, one scale, one set of weights,
|
|
4
|
-
* line-heights and tracking steps, shared by every theme.
|
|
5
|
-
*
|
|
6
|
-
* A theme picks colors. It does not get to resize the type scale, because a
|
|
7
|
-
* layout that reflows when you switch brand is a layout that was never
|
|
8
|
-
* designed — it was designed once, against one scale, and every other brand
|
|
9
|
-
* was hoping. The two font *stacks* are the only part a theme can override,
|
|
10
|
-
* and only through {@link ThemeTypographyDeviation}, because impersonating a
|
|
11
|
-
* design language means impersonating its typeface.
|
|
12
|
-
*
|
|
13
|
-
* @public
|
|
14
|
-
*/
|
|
3
|
+
/** The shared type system — font stacks, scale, weights, line-heights, tracking — with only stacks overridable via {@link ThemeTypographyDeviation}. @public */
|
|
15
4
|
export declare const typography: ThemeTypography;
|
|
16
|
-
/**
|
|
17
|
-
* The spacing scale — a 4px base with the usual gaps (no `7`, no `9`) so the
|
|
18
|
-
* steps stay memorable rather than exhaustive. Structural: gap and padding are
|
|
19
|
-
* rhythm, and rhythm is a property of the design system, not of the brand
|
|
20
|
-
* painted on top of it.
|
|
21
|
-
*
|
|
22
|
-
* @public
|
|
23
|
-
*/
|
|
5
|
+
/** The spacing scale — a 4px base, structural rather than per-brand. @public */
|
|
24
6
|
export declare const space: ThemeSpace;
|
|
25
|
-
/**
|
|
26
|
-
* The corner-radius scale. Shared for the same reason {@link space} is: a
|
|
27
|
-
* component's silhouette is part of the system's shape language, and a brand
|
|
28
|
-
* that rounds its corners differently is a different component library
|
|
29
|
-
* wearing the same class names.
|
|
30
|
-
*
|
|
31
|
-
* @public
|
|
32
|
-
*/
|
|
7
|
+
/** The corner-radius scale, structural like {@link space} rather than per-brand. @public */
|
|
33
8
|
export declare const radii: ThemeRadii;
|
|
34
|
-
/**
|
|
35
|
-
* The elevation scale — geometry only. Every value defers its color to
|
|
36
|
-
* `var(--skdx-shadow-color)` and scales its alpha by
|
|
37
|
-
* `var(--skdx-shadow-strength)`, both of which a theme supplies (see
|
|
38
|
-
* {@link ThemeShadowColor}).
|
|
39
|
-
*
|
|
40
|
-
* This split is the whole reason shadows can be shared at all. A shadow is one
|
|
41
|
-
* CSS string that welds geometry to a color, so before this every theme
|
|
42
|
-
* restated `0 4px 6px -1px` purely to be able to change `rgb(…)` at the end of
|
|
43
|
-
* it — 38 copies of the same three offsets, and no way to tell a deliberate
|
|
44
|
-
* elevation change from a color change.
|
|
45
|
-
*
|
|
46
|
-
* The base alphas below are the original `skanda-light` values, so a theme
|
|
47
|
-
* with `strength: '1'` renders exactly what it did before the split.
|
|
48
|
-
* Substitution is lazy: these live at `:root`, but `var(--skdx-shadow-color)`
|
|
49
|
-
* resolves against the element the shadow is finally *used* on, so the active
|
|
50
|
-
* `[data-skdx-theme]` block wins. `calc()` is legal in the alpha slot, and an
|
|
51
|
-
* alpha above 1 clamps rather than erroring — which is what keeps a
|
|
52
|
-
* high-strength dark theme from being a footgun.
|
|
53
|
-
*
|
|
54
|
-
* @public
|
|
55
|
-
*/
|
|
9
|
+
/** The elevation scale (geometry only); color and alpha come from theme-supplied `--skdx-shadow-color`/`-strength` (see {@link ThemeShadowColor}). @public */
|
|
56
10
|
export declare const shadows: ThemeShadows;
|
|
57
|
-
/**
|
|
58
|
-
* The shared animation timing — re-exported from {@link defaultMotion}, which
|
|
59
|
-
* remains the single source so that `themeToCssVars` can keep merging it under
|
|
60
|
-
* a theme's {@link Theme.motion} without importing this module.
|
|
61
|
-
*
|
|
62
|
-
* See {@link ThemeMotion} for why motion is theme-invariant.
|
|
63
|
-
*
|
|
64
|
-
* @public
|
|
65
|
-
*/
|
|
11
|
+
/** The shared animation timing, re-exported from {@link defaultMotion} and invariant per {@link ThemeMotion}. @public */
|
|
66
12
|
export declare const motion: Required<ThemeMotion>;
|
|
67
13
|
/**
|
|
68
|
-
*
|
|
69
|
-
* headers, dialog/popover backdrops, floating content, toasts). Unlike the
|
|
70
|
-
* rest of the token system, z-index isn't a per-brand visual choice — every
|
|
71
|
-
* theme should stack the same way — so it's exported once here rather than
|
|
72
|
-
* duplicated into all 38 {@link Theme} objects. Consumers building an app
|
|
73
|
-
* with multiple concurrent overlay types (e.g. a `Select` opened from inside
|
|
74
|
-
* a `Dialog`, with a `Toast` on top of both) should coordinate their own
|
|
75
|
-
* z-indices against this scale instead of picking ad hoc numbers per
|
|
76
|
-
* component.
|
|
14
|
+
* Structural stacking-order scale for overlay-class UI (dropdowns, headers, dialogs, toasts), shared by every theme.
|
|
77
15
|
*
|
|
78
16
|
* @example
|
|
79
17
|
* ```css
|
|
@@ -88,27 +26,19 @@ export declare const zIndex: {
|
|
|
88
26
|
readonly base: 0;
|
|
89
27
|
readonly dropdown: 10;
|
|
90
28
|
readonly sticky: 20;
|
|
91
|
-
/**
|
|
29
|
+
/** Scrim behind modal. */
|
|
92
30
|
readonly overlay: 30;
|
|
93
|
-
/**
|
|
31
|
+
/** Modal surface; above scrim, below popovers opened from inside. */
|
|
94
32
|
readonly modal: 35;
|
|
95
33
|
readonly popover: 40;
|
|
96
34
|
readonly toast: 50;
|
|
97
|
-
/**
|
|
98
|
-
* Escape hatch for the one thing that must sit above everything, e.g. a
|
|
99
|
-
* debug overlay or an "app is offline" banner. Deliberately far above
|
|
100
|
-
* `toast` so app code never has to guess a bigger number.
|
|
101
|
-
*/
|
|
35
|
+
/** Escape hatch for the one thing that must sit above everything, e.g. a debug overlay. */
|
|
102
36
|
readonly max: 9999;
|
|
103
37
|
};
|
|
104
38
|
/** The shape of the {@link zIndex} scale — a map of named stacking layers (`sticky`, `overlay`, `popover`, `toast`, …) to their numeric `z-index`. @public */
|
|
105
39
|
export type ZIndexScale = typeof zIndex;
|
|
106
40
|
/**
|
|
107
|
-
* Structural focus-ring geometry (width/offset)
|
|
108
|
-
* focus-ring contract is themed per brand ({@link SemanticColors.focusRing}),
|
|
109
|
-
* but the ring's thickness and offset are a layout constant every theme
|
|
110
|
-
* should share, so they live here rather than being repeated as identical
|
|
111
|
-
* values across all 38 bundled themes.
|
|
41
|
+
* Structural focus-ring geometry (width/offset); color is themed separately via {@link SemanticColors.focusRing}.
|
|
112
42
|
*
|
|
113
43
|
* @example
|
|
114
44
|
* ```css
|
|
@@ -123,31 +53,13 @@ export type ZIndexScale = typeof zIndex;
|
|
|
123
53
|
export declare const focusRing: {
|
|
124
54
|
readonly width: "2px";
|
|
125
55
|
readonly offset: "2px";
|
|
126
|
-
/**
|
|
127
|
-
* The offset a *clipping* container hands down to its children.
|
|
128
|
-
*
|
|
129
|
-
* An outline is painted outward from the border edge and is clipped by an
|
|
130
|
-
* ancestor's `overflow` exactly like any other overflowing paint — which
|
|
131
|
-
* sliced the ring off inside every control group that rounds its corners by
|
|
132
|
-
* clipping. Because `outline-offset` is read from a custom property, such a
|
|
133
|
-
* container sets this on itself and every descendant ring moves *inside* the
|
|
134
|
-
* border box, where nothing can reach it. One declaration per clipping
|
|
135
|
-
* container, no per-part focus rules.
|
|
136
|
-
*
|
|
137
|
-
* Negative by exactly the ring width, which lands it flush against the
|
|
138
|
-
* inside of the edge rather than floating in from it.
|
|
139
|
-
*/
|
|
56
|
+
/** Offset for clipping containers: moves the ring inside the border-box so overflow doesn't clip it. */
|
|
140
57
|
readonly offsetInset: "calc(-1 * var(--skdx-focus-ring-width))";
|
|
141
58
|
};
|
|
142
59
|
/** The shape of the {@link focusRing} geometry — the structural `width`/`offset` of the focus ring (its color is themed separately). @public */
|
|
143
60
|
export type FocusRingScale = typeof focusRing;
|
|
144
61
|
/**
|
|
145
|
-
* Border thicknesses
|
|
146
|
-
* geometry is: a brand changes border *color* (see
|
|
147
|
-
* {@link SemanticColors.border}), not how many pixels thick a hairline is.
|
|
148
|
-
* Three steps only — a hairline, an emphasis weight (focus/selected/invalid
|
|
149
|
-
* outlines drawn without the focus ring), and a heavy weight for deliberate
|
|
150
|
-
* structural rules. There is no `0`: that's `border: none`, not a token.
|
|
62
|
+
* Border thicknesses, structural like {@link focusRing}: brand changes border color via {@link SemanticColors.border}, not width; no `0` step exists.
|
|
151
63
|
*
|
|
152
64
|
* @example
|
|
153
65
|
* ```css
|
|
@@ -164,38 +76,17 @@ export declare const borderWidth: {
|
|
|
164
76
|
};
|
|
165
77
|
/** The shape of the {@link borderWidth} scale — `thin`/`thick`/`thicker` border thicknesses. @public */
|
|
166
78
|
export type BorderWidthScale = typeof borderWidth;
|
|
167
|
-
/**
|
|
168
|
-
* The shared control geometry — heights, paddings, icon boxes, row heights and
|
|
169
|
-
* overlay insets. See {@link ThemeControls} for why this is structural rather
|
|
170
|
-
* than per-brand, and for the retuning escape hatch.
|
|
171
|
-
*
|
|
172
|
-
* The ladder is an even 6px step (30/36/42) and every rung sits inside the
|
|
173
|
-
* range the two reference libraries surveyed occupy. Several values are
|
|
174
|
-
* `var()` references rather than lengths on purpose: a control's inline
|
|
175
|
-
* padding *is* a step of {@link space}, and restating `0.75rem` here would let
|
|
176
|
-
* the two drift. The exceptions are the four numbers that are deliberately off
|
|
177
|
-
* a scale — `padding.sm` (10px), `height.compact` (32px), `item.gap` (2px) and
|
|
178
|
-
* `target.min` (24px) — each documented where it is declared.
|
|
179
|
-
*
|
|
180
|
-
* @public
|
|
181
|
-
*/
|
|
79
|
+
/** The shared control geometry (heights, paddings, icon boxes, insets); see {@link ThemeControls} for the retuning escape hatch, and values reference {@link space} steps where they align. @public */
|
|
182
80
|
export declare const controls: ThemeControls;
|
|
183
81
|
/**
|
|
184
|
-
* What a coarse pointer overrides
|
|
185
|
-
*
|
|
82
|
+
* What a coarse pointer overrides, emitted as a `@media (pointer: coarse)`
|
|
83
|
+
* block by {@link foundationToCss}; see {@link ThemeControlsCoarse} for why
|
|
186
84
|
* only hit sizes are listed.
|
|
187
|
-
*
|
|
188
85
|
* @public
|
|
189
86
|
*/
|
|
190
87
|
export declare const controlsCoarse: ThemeControlsCoarse;
|
|
191
88
|
/**
|
|
192
|
-
* The two opacities
|
|
193
|
-
* *not* a 0–100 ramp: an arbitrary ramp invents decisions nobody made, while
|
|
194
|
-
* these two are real, repeated cross-component choices — how faded a disabled
|
|
195
|
-
* control is, and how much a modal scrim dims the page behind it.
|
|
196
|
-
*
|
|
197
|
-
* Scrim *color* is themed ({@link SemanticColors.overlay}); this is the
|
|
198
|
-
* structural strength of the dim, so every brand's scrim occludes equally.
|
|
89
|
+
* The two intentional opacities — disabled fade and modal scrim dim — not an arbitrary ramp; scrim color is themed via {@link SemanticColors.overlay}.
|
|
199
90
|
*
|
|
200
91
|
* @example
|
|
201
92
|
* ```css
|
|
@@ -212,16 +103,7 @@ export declare const opacity: {
|
|
|
212
103
|
/** The shape of the {@link opacity} scale — the `disabled` and `scrim` opacities. @public */
|
|
213
104
|
export type OpacityScale = typeof opacity;
|
|
214
105
|
/**
|
|
215
|
-
* Viewport widths
|
|
216
|
-
* not emitted as CSS custom properties by {@link foundationToCss}. A custom
|
|
217
|
-
* property cannot be used in a `@media` query's condition (`@media (min-width:
|
|
218
|
-
* var(--x))` is invalid CSS), so a `--skdx-breakpoint-*` variable would be a
|
|
219
|
-
* token that looks usable and isn't. Consume these from JS/TS, or from a
|
|
220
|
-
* build step that inlines the number into your own media queries.
|
|
221
|
-
*
|
|
222
|
-
* The components themselves are headless and ship no responsive behavior;
|
|
223
|
-
* this exists so consumers building a styled layer on top don't have to
|
|
224
|
-
* invent their own set.
|
|
106
|
+
* Viewport widths in pixels, as TypeScript exports only — `@media (min-width: var(--x))` is invalid CSS.
|
|
225
107
|
*
|
|
226
108
|
* @example
|
|
227
109
|
* ```ts
|
|
@@ -241,52 +123,17 @@ export declare const breakpoints: {
|
|
|
241
123
|
/** The shape of the {@link breakpoints} scale — named viewport widths in pixels. @public */
|
|
242
124
|
export type BreakpointScale = typeof breakpoints;
|
|
243
125
|
/**
|
|
244
|
-
* Flattens every shared token into
|
|
245
|
-
* values — the foundation's counterpart to `themeToCssVars`. Together the two
|
|
246
|
-
* maps are the complete `--skdx-*` surface, and they never overlap.
|
|
247
|
-
*
|
|
248
|
-
* {@link breakpoints} is not included — see its docs for why a breakpoint
|
|
249
|
-
* can't be a CSS custom property.
|
|
126
|
+
* Flattens every shared token into `--skdx-*` custom property values, the foundation's counterpart to `themeToCssVars`; excludes {@link breakpoints}, which can't be a CSS custom property.
|
|
250
127
|
*
|
|
251
128
|
* @returns A plain object keyed by CSS custom property name (e.g. `'--skdx-space-4'`), unprefixed by any selector.
|
|
252
|
-
*
|
|
253
|
-
* @public
|
|
254
|
-
*/
|
|
255
|
-
export declare function foundationToCssVars(): Record<string, string>;
|
|
256
|
-
/**
|
|
257
|
-
* The control metrics a coarse pointer overrides, as a var map — the
|
|
258
|
-
* `@media (pointer: coarse)` counterpart to {@link foundationToCssVars}.
|
|
259
|
-
*
|
|
260
|
-
* Exported because `@skdx/skins` renders its own no-tokens fallback copy of
|
|
261
|
-
* both blocks from these functions rather than restating the values, which is
|
|
262
|
-
* the only thing that keeps the two in step.
|
|
263
|
-
*
|
|
264
129
|
* @public
|
|
265
130
|
*/
|
|
266
|
-
export declare function
|
|
131
|
+
export declare function foundationToCssVars(): Record<CssVar, string>;
|
|
132
|
+
/** The control metrics a coarse pointer overrides, as a var map — the `@media (pointer: coarse)` counterpart to {@link foundationToCssVars}. @public */
|
|
133
|
+
export declare function coarsePointerToCssVars(): Record<CssVar, string>;
|
|
267
134
|
/**
|
|
268
|
-
* Renders every shared token as a `:root`-scoped `--skdx-*` rule block
|
|
269
|
-
*
|
|
270
|
-
* once**, then inject `themeToCss(theme)` per theme alongside it. Without it
|
|
271
|
-
* the type scale, spacing, radii, shadow geometry and motion are simply
|
|
272
|
-
* absent, because no theme declares them any more.
|
|
273
|
-
*
|
|
274
|
-
* Followed by a `@media (prefers-reduced-motion: reduce)` block that
|
|
275
|
-
* re-declares every `--skdx-motion-duration-*` and `--skdx-motion-stagger-*` as
|
|
276
|
-
* `0ms`. Components are headless and animate nothing themselves, so honoring
|
|
277
|
-
* the preference has to happen where the durations are *defined* rather than
|
|
278
|
-
* where they're used — this way a consumer who writes `transition-duration:
|
|
279
|
-
* var(--skdx-motion-duration-normal)` gets WCAG 2.3.3 behavior for free instead
|
|
280
|
-
* of having to remember the media query at every call site. The easing curve
|
|
281
|
-
* is left alone: it's a shape, not a duration, and is inert at `0ms`. A theme
|
|
282
|
-
* that retunes motion via `ThemeMotionDeviation` emits its own copy of this
|
|
283
|
-
* block, so the guarantee survives the escape hatch.
|
|
284
|
-
*
|
|
285
|
-
* Then a `@media (pointer: coarse)` block re-declaring the hit sizes from
|
|
286
|
-
* {@link controlsCoarse}, for the same reason: the preference has to be honored
|
|
287
|
-
* where the metric is *defined*, so a consumer who writes
|
|
288
|
-
* `block-size: var(--skdx-control-height-md)` gets a touch-sized control without
|
|
289
|
-
* having to remember the query.
|
|
135
|
+
* Renders every shared token as a `:root`-scoped `--skdx-*` rule block, plus `prefers-reduced-motion` and `pointer: coarse` override blocks.
|
|
136
|
+
* Inject this exactly once, then {@link themeToCss} per theme.
|
|
290
137
|
*
|
|
291
138
|
* @example
|
|
292
139
|
* ```ts
|
|
@@ -1,79 +1,17 @@
|
|
|
1
|
+
import { type CssVar } from './cssVars.js';
|
|
1
2
|
import { type ThemeControls, type ThemeControlsCoarse, type ThemeMotion, type ThemeRadii, type ThemeShadows, type ThemeSpace, type ThemeTypography } from './theme.js';
|
|
2
|
-
/**
|
|
3
|
-
* The type system: one font stack, one scale, one set of weights,
|
|
4
|
-
* line-heights and tracking steps, shared by every theme.
|
|
5
|
-
*
|
|
6
|
-
* A theme picks colors. It does not get to resize the type scale, because a
|
|
7
|
-
* layout that reflows when you switch brand is a layout that was never
|
|
8
|
-
* designed — it was designed once, against one scale, and every other brand
|
|
9
|
-
* was hoping. The two font *stacks* are the only part a theme can override,
|
|
10
|
-
* and only through {@link ThemeTypographyDeviation}, because impersonating a
|
|
11
|
-
* design language means impersonating its typeface.
|
|
12
|
-
*
|
|
13
|
-
* @public
|
|
14
|
-
*/
|
|
3
|
+
/** The shared type system — font stacks, scale, weights, line-heights, tracking — with only stacks overridable via {@link ThemeTypographyDeviation}. @public */
|
|
15
4
|
export declare const typography: ThemeTypography;
|
|
16
|
-
/**
|
|
17
|
-
* The spacing scale — a 4px base with the usual gaps (no `7`, no `9`) so the
|
|
18
|
-
* steps stay memorable rather than exhaustive. Structural: gap and padding are
|
|
19
|
-
* rhythm, and rhythm is a property of the design system, not of the brand
|
|
20
|
-
* painted on top of it.
|
|
21
|
-
*
|
|
22
|
-
* @public
|
|
23
|
-
*/
|
|
5
|
+
/** The spacing scale — a 4px base, structural rather than per-brand. @public */
|
|
24
6
|
export declare const space: ThemeSpace;
|
|
25
|
-
/**
|
|
26
|
-
* The corner-radius scale. Shared for the same reason {@link space} is: a
|
|
27
|
-
* component's silhouette is part of the system's shape language, and a brand
|
|
28
|
-
* that rounds its corners differently is a different component library
|
|
29
|
-
* wearing the same class names.
|
|
30
|
-
*
|
|
31
|
-
* @public
|
|
32
|
-
*/
|
|
7
|
+
/** The corner-radius scale, structural like {@link space} rather than per-brand. @public */
|
|
33
8
|
export declare const radii: ThemeRadii;
|
|
34
|
-
/**
|
|
35
|
-
* The elevation scale — geometry only. Every value defers its color to
|
|
36
|
-
* `var(--skdx-shadow-color)` and scales its alpha by
|
|
37
|
-
* `var(--skdx-shadow-strength)`, both of which a theme supplies (see
|
|
38
|
-
* {@link ThemeShadowColor}).
|
|
39
|
-
*
|
|
40
|
-
* This split is the whole reason shadows can be shared at all. A shadow is one
|
|
41
|
-
* CSS string that welds geometry to a color, so before this every theme
|
|
42
|
-
* restated `0 4px 6px -1px` purely to be able to change `rgb(…)` at the end of
|
|
43
|
-
* it — 38 copies of the same three offsets, and no way to tell a deliberate
|
|
44
|
-
* elevation change from a color change.
|
|
45
|
-
*
|
|
46
|
-
* The base alphas below are the original `skanda-light` values, so a theme
|
|
47
|
-
* with `strength: '1'` renders exactly what it did before the split.
|
|
48
|
-
* Substitution is lazy: these live at `:root`, but `var(--skdx-shadow-color)`
|
|
49
|
-
* resolves against the element the shadow is finally *used* on, so the active
|
|
50
|
-
* `[data-skdx-theme]` block wins. `calc()` is legal in the alpha slot, and an
|
|
51
|
-
* alpha above 1 clamps rather than erroring — which is what keeps a
|
|
52
|
-
* high-strength dark theme from being a footgun.
|
|
53
|
-
*
|
|
54
|
-
* @public
|
|
55
|
-
*/
|
|
9
|
+
/** The elevation scale (geometry only); color and alpha come from theme-supplied `--skdx-shadow-color`/`-strength` (see {@link ThemeShadowColor}). @public */
|
|
56
10
|
export declare const shadows: ThemeShadows;
|
|
57
|
-
/**
|
|
58
|
-
* The shared animation timing — re-exported from {@link defaultMotion}, which
|
|
59
|
-
* remains the single source so that `themeToCssVars` can keep merging it under
|
|
60
|
-
* a theme's {@link Theme.motion} without importing this module.
|
|
61
|
-
*
|
|
62
|
-
* See {@link ThemeMotion} for why motion is theme-invariant.
|
|
63
|
-
*
|
|
64
|
-
* @public
|
|
65
|
-
*/
|
|
11
|
+
/** The shared animation timing, re-exported from {@link defaultMotion} and invariant per {@link ThemeMotion}. @public */
|
|
66
12
|
export declare const motion: Required<ThemeMotion>;
|
|
67
13
|
/**
|
|
68
|
-
*
|
|
69
|
-
* headers, dialog/popover backdrops, floating content, toasts). Unlike the
|
|
70
|
-
* rest of the token system, z-index isn't a per-brand visual choice — every
|
|
71
|
-
* theme should stack the same way — so it's exported once here rather than
|
|
72
|
-
* duplicated into all 38 {@link Theme} objects. Consumers building an app
|
|
73
|
-
* with multiple concurrent overlay types (e.g. a `Select` opened from inside
|
|
74
|
-
* a `Dialog`, with a `Toast` on top of both) should coordinate their own
|
|
75
|
-
* z-indices against this scale instead of picking ad hoc numbers per
|
|
76
|
-
* component.
|
|
14
|
+
* Structural stacking-order scale for overlay-class UI (dropdowns, headers, dialogs, toasts), shared by every theme.
|
|
77
15
|
*
|
|
78
16
|
* @example
|
|
79
17
|
* ```css
|
|
@@ -88,27 +26,19 @@ export declare const zIndex: {
|
|
|
88
26
|
readonly base: 0;
|
|
89
27
|
readonly dropdown: 10;
|
|
90
28
|
readonly sticky: 20;
|
|
91
|
-
/**
|
|
29
|
+
/** Scrim behind modal. */
|
|
92
30
|
readonly overlay: 30;
|
|
93
|
-
/**
|
|
31
|
+
/** Modal surface; above scrim, below popovers opened from inside. */
|
|
94
32
|
readonly modal: 35;
|
|
95
33
|
readonly popover: 40;
|
|
96
34
|
readonly toast: 50;
|
|
97
|
-
/**
|
|
98
|
-
* Escape hatch for the one thing that must sit above everything, e.g. a
|
|
99
|
-
* debug overlay or an "app is offline" banner. Deliberately far above
|
|
100
|
-
* `toast` so app code never has to guess a bigger number.
|
|
101
|
-
*/
|
|
35
|
+
/** Escape hatch for the one thing that must sit above everything, e.g. a debug overlay. */
|
|
102
36
|
readonly max: 9999;
|
|
103
37
|
};
|
|
104
38
|
/** The shape of the {@link zIndex} scale — a map of named stacking layers (`sticky`, `overlay`, `popover`, `toast`, …) to their numeric `z-index`. @public */
|
|
105
39
|
export type ZIndexScale = typeof zIndex;
|
|
106
40
|
/**
|
|
107
|
-
* Structural focus-ring geometry (width/offset)
|
|
108
|
-
* focus-ring contract is themed per brand ({@link SemanticColors.focusRing}),
|
|
109
|
-
* but the ring's thickness and offset are a layout constant every theme
|
|
110
|
-
* should share, so they live here rather than being repeated as identical
|
|
111
|
-
* values across all 38 bundled themes.
|
|
41
|
+
* Structural focus-ring geometry (width/offset); color is themed separately via {@link SemanticColors.focusRing}.
|
|
112
42
|
*
|
|
113
43
|
* @example
|
|
114
44
|
* ```css
|
|
@@ -123,31 +53,13 @@ export type ZIndexScale = typeof zIndex;
|
|
|
123
53
|
export declare const focusRing: {
|
|
124
54
|
readonly width: "2px";
|
|
125
55
|
readonly offset: "2px";
|
|
126
|
-
/**
|
|
127
|
-
* The offset a *clipping* container hands down to its children.
|
|
128
|
-
*
|
|
129
|
-
* An outline is painted outward from the border edge and is clipped by an
|
|
130
|
-
* ancestor's `overflow` exactly like any other overflowing paint — which
|
|
131
|
-
* sliced the ring off inside every control group that rounds its corners by
|
|
132
|
-
* clipping. Because `outline-offset` is read from a custom property, such a
|
|
133
|
-
* container sets this on itself and every descendant ring moves *inside* the
|
|
134
|
-
* border box, where nothing can reach it. One declaration per clipping
|
|
135
|
-
* container, no per-part focus rules.
|
|
136
|
-
*
|
|
137
|
-
* Negative by exactly the ring width, which lands it flush against the
|
|
138
|
-
* inside of the edge rather than floating in from it.
|
|
139
|
-
*/
|
|
56
|
+
/** Offset for clipping containers: moves the ring inside the border-box so overflow doesn't clip it. */
|
|
140
57
|
readonly offsetInset: "calc(-1 * var(--skdx-focus-ring-width))";
|
|
141
58
|
};
|
|
142
59
|
/** The shape of the {@link focusRing} geometry — the structural `width`/`offset` of the focus ring (its color is themed separately). @public */
|
|
143
60
|
export type FocusRingScale = typeof focusRing;
|
|
144
61
|
/**
|
|
145
|
-
* Border thicknesses
|
|
146
|
-
* geometry is: a brand changes border *color* (see
|
|
147
|
-
* {@link SemanticColors.border}), not how many pixels thick a hairline is.
|
|
148
|
-
* Three steps only — a hairline, an emphasis weight (focus/selected/invalid
|
|
149
|
-
* outlines drawn without the focus ring), and a heavy weight for deliberate
|
|
150
|
-
* structural rules. There is no `0`: that's `border: none`, not a token.
|
|
62
|
+
* Border thicknesses, structural like {@link focusRing}: brand changes border color via {@link SemanticColors.border}, not width; no `0` step exists.
|
|
151
63
|
*
|
|
152
64
|
* @example
|
|
153
65
|
* ```css
|
|
@@ -164,38 +76,17 @@ export declare const borderWidth: {
|
|
|
164
76
|
};
|
|
165
77
|
/** The shape of the {@link borderWidth} scale — `thin`/`thick`/`thicker` border thicknesses. @public */
|
|
166
78
|
export type BorderWidthScale = typeof borderWidth;
|
|
167
|
-
/**
|
|
168
|
-
* The shared control geometry — heights, paddings, icon boxes, row heights and
|
|
169
|
-
* overlay insets. See {@link ThemeControls} for why this is structural rather
|
|
170
|
-
* than per-brand, and for the retuning escape hatch.
|
|
171
|
-
*
|
|
172
|
-
* The ladder is an even 6px step (30/36/42) and every rung sits inside the
|
|
173
|
-
* range the two reference libraries surveyed occupy. Several values are
|
|
174
|
-
* `var()` references rather than lengths on purpose: a control's inline
|
|
175
|
-
* padding *is* a step of {@link space}, and restating `0.75rem` here would let
|
|
176
|
-
* the two drift. The exceptions are the four numbers that are deliberately off
|
|
177
|
-
* a scale — `padding.sm` (10px), `height.compact` (32px), `item.gap` (2px) and
|
|
178
|
-
* `target.min` (24px) — each documented where it is declared.
|
|
179
|
-
*
|
|
180
|
-
* @public
|
|
181
|
-
*/
|
|
79
|
+
/** The shared control geometry (heights, paddings, icon boxes, insets); see {@link ThemeControls} for the retuning escape hatch, and values reference {@link space} steps where they align. @public */
|
|
182
80
|
export declare const controls: ThemeControls;
|
|
183
81
|
/**
|
|
184
|
-
* What a coarse pointer overrides
|
|
185
|
-
*
|
|
82
|
+
* What a coarse pointer overrides, emitted as a `@media (pointer: coarse)`
|
|
83
|
+
* block by {@link foundationToCss}; see {@link ThemeControlsCoarse} for why
|
|
186
84
|
* only hit sizes are listed.
|
|
187
|
-
*
|
|
188
85
|
* @public
|
|
189
86
|
*/
|
|
190
87
|
export declare const controlsCoarse: ThemeControlsCoarse;
|
|
191
88
|
/**
|
|
192
|
-
* The two opacities
|
|
193
|
-
* *not* a 0–100 ramp: an arbitrary ramp invents decisions nobody made, while
|
|
194
|
-
* these two are real, repeated cross-component choices — how faded a disabled
|
|
195
|
-
* control is, and how much a modal scrim dims the page behind it.
|
|
196
|
-
*
|
|
197
|
-
* Scrim *color* is themed ({@link SemanticColors.overlay}); this is the
|
|
198
|
-
* structural strength of the dim, so every brand's scrim occludes equally.
|
|
89
|
+
* The two intentional opacities — disabled fade and modal scrim dim — not an arbitrary ramp; scrim color is themed via {@link SemanticColors.overlay}.
|
|
199
90
|
*
|
|
200
91
|
* @example
|
|
201
92
|
* ```css
|
|
@@ -212,16 +103,7 @@ export declare const opacity: {
|
|
|
212
103
|
/** The shape of the {@link opacity} scale — the `disabled` and `scrim` opacities. @public */
|
|
213
104
|
export type OpacityScale = typeof opacity;
|
|
214
105
|
/**
|
|
215
|
-
* Viewport widths
|
|
216
|
-
* not emitted as CSS custom properties by {@link foundationToCss}. A custom
|
|
217
|
-
* property cannot be used in a `@media` query's condition (`@media (min-width:
|
|
218
|
-
* var(--x))` is invalid CSS), so a `--skdx-breakpoint-*` variable would be a
|
|
219
|
-
* token that looks usable and isn't. Consume these from JS/TS, or from a
|
|
220
|
-
* build step that inlines the number into your own media queries.
|
|
221
|
-
*
|
|
222
|
-
* The components themselves are headless and ship no responsive behavior;
|
|
223
|
-
* this exists so consumers building a styled layer on top don't have to
|
|
224
|
-
* invent their own set.
|
|
106
|
+
* Viewport widths in pixels, as TypeScript exports only — `@media (min-width: var(--x))` is invalid CSS.
|
|
225
107
|
*
|
|
226
108
|
* @example
|
|
227
109
|
* ```ts
|
|
@@ -241,52 +123,17 @@ export declare const breakpoints: {
|
|
|
241
123
|
/** The shape of the {@link breakpoints} scale — named viewport widths in pixels. @public */
|
|
242
124
|
export type BreakpointScale = typeof breakpoints;
|
|
243
125
|
/**
|
|
244
|
-
* Flattens every shared token into
|
|
245
|
-
* values — the foundation's counterpart to `themeToCssVars`. Together the two
|
|
246
|
-
* maps are the complete `--skdx-*` surface, and they never overlap.
|
|
247
|
-
*
|
|
248
|
-
* {@link breakpoints} is not included — see its docs for why a breakpoint
|
|
249
|
-
* can't be a CSS custom property.
|
|
126
|
+
* Flattens every shared token into `--skdx-*` custom property values, the foundation's counterpart to `themeToCssVars`; excludes {@link breakpoints}, which can't be a CSS custom property.
|
|
250
127
|
*
|
|
251
128
|
* @returns A plain object keyed by CSS custom property name (e.g. `'--skdx-space-4'`), unprefixed by any selector.
|
|
252
|
-
*
|
|
253
|
-
* @public
|
|
254
|
-
*/
|
|
255
|
-
export declare function foundationToCssVars(): Record<string, string>;
|
|
256
|
-
/**
|
|
257
|
-
* The control metrics a coarse pointer overrides, as a var map — the
|
|
258
|
-
* `@media (pointer: coarse)` counterpart to {@link foundationToCssVars}.
|
|
259
|
-
*
|
|
260
|
-
* Exported because `@skdx/skins` renders its own no-tokens fallback copy of
|
|
261
|
-
* both blocks from these functions rather than restating the values, which is
|
|
262
|
-
* the only thing that keeps the two in step.
|
|
263
|
-
*
|
|
264
129
|
* @public
|
|
265
130
|
*/
|
|
266
|
-
export declare function
|
|
131
|
+
export declare function foundationToCssVars(): Record<CssVar, string>;
|
|
132
|
+
/** The control metrics a coarse pointer overrides, as a var map — the `@media (pointer: coarse)` counterpart to {@link foundationToCssVars}. @public */
|
|
133
|
+
export declare function coarsePointerToCssVars(): Record<CssVar, string>;
|
|
267
134
|
/**
|
|
268
|
-
* Renders every shared token as a `:root`-scoped `--skdx-*` rule block
|
|
269
|
-
*
|
|
270
|
-
* once**, then inject `themeToCss(theme)` per theme alongside it. Without it
|
|
271
|
-
* the type scale, spacing, radii, shadow geometry and motion are simply
|
|
272
|
-
* absent, because no theme declares them any more.
|
|
273
|
-
*
|
|
274
|
-
* Followed by a `@media (prefers-reduced-motion: reduce)` block that
|
|
275
|
-
* re-declares every `--skdx-motion-duration-*` and `--skdx-motion-stagger-*` as
|
|
276
|
-
* `0ms`. Components are headless and animate nothing themselves, so honoring
|
|
277
|
-
* the preference has to happen where the durations are *defined* rather than
|
|
278
|
-
* where they're used — this way a consumer who writes `transition-duration:
|
|
279
|
-
* var(--skdx-motion-duration-normal)` gets WCAG 2.3.3 behavior for free instead
|
|
280
|
-
* of having to remember the media query at every call site. The easing curve
|
|
281
|
-
* is left alone: it's a shape, not a duration, and is inert at `0ms`. A theme
|
|
282
|
-
* that retunes motion via `ThemeMotionDeviation` emits its own copy of this
|
|
283
|
-
* block, so the guarantee survives the escape hatch.
|
|
284
|
-
*
|
|
285
|
-
* Then a `@media (pointer: coarse)` block re-declaring the hit sizes from
|
|
286
|
-
* {@link controlsCoarse}, for the same reason: the preference has to be honored
|
|
287
|
-
* where the metric is *defined*, so a consumer who writes
|
|
288
|
-
* `block-size: var(--skdx-control-height-md)` gets a touch-sized control without
|
|
289
|
-
* having to remember the query.
|
|
135
|
+
* Renders every shared token as a `:root`-scoped `--skdx-*` rule block, plus `prefers-reduced-motion` and `pointer: coarse` override blocks.
|
|
136
|
+
* Inject this exactly once, then {@link themeToCss} per theme.
|
|
290
137
|
*
|
|
291
138
|
* @example
|
|
292
139
|
* ```ts
|
package/dist/utils/foundation.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{reducedMotionVarNames as
|
|
1
|
+
import{PREFIX as e,reducedMotionVarNames as i,sectionsToCssVars as a,varsToDeclarations as s}from"./cssVars.js";import{defaultMotion as p}from"./theme.js";var c={fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif",fontFamilyMono:"'SF Mono', SFMono-Regular, ui-monospace, Menlo, Consolas, monospace",fontSize:{xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem"},fontWeight:{regular:400,medium:500,semibold:600,bold:700},lineHeight:{tight:"1.25",snug:"1.43",normal:"1.5",relaxed:"1.75"},letterSpacing:{tight:"-0.015em",normal:"0em",wide:"0.025em",wider:"0.05em"}},d={1:"0.25rem",2:"0.5rem",3:"0.75rem",4:"1rem",5:"1.25rem",6:"1.5rem",8:"2rem",10:"2.5rem",12:"3rem",16:"4rem"},l={sm:"0.25rem",inner:"0.375rem",md:"0.5rem",lg:"0.75rem",xl:"1rem",full:"9999px"},x={sm:`0 1px 2px 0 ${t(.05)}`,md:`0 4px 6px -1px ${t(.1)}, 0 2px 4px -2px ${t(.1)}`,lg:`0 10px 15px -3px ${t(.1)}, 0 4px 6px -4px ${t(.1)}`,overlay:`0 25px 50px -12px ${t(.25)}`};function t(r){return`rgb(var(--${e}-shadow-color) / calc(${r} * var(--${e}-shadow-strength)))`}var g=p,h={base:0,dropdown:10,sticky:20,overlay:30,modal:35,popover:40,toast:50,max:9999},y={width:"2px",offset:"2px",offsetInset:"calc(-1 * var(--skdx-focus-ring-width))"},f={thin:"1px",thick:"2px",thicker:"4px"},u={control:{height:{sm:"1.875rem",md:"2.25rem",lg:"2.625rem",compact:"2rem"},padding:{sm:"0.625rem",md:`var(--${e}-space-3)`,lg:`var(--${e}-space-4)`},gap:{sm:`var(--${e}-space-1)`,md:`var(--${e}-space-2)`,lg:`var(--${e}-space-2)`}},iconSize:{sm:"1rem",md:"1.25rem",lg:"1.5rem"},indicatorSize:{sm:"1rem",md:"1.25rem",lg:"1.5rem"},item:{height:{sm:"1.75rem",md:"2.25rem",lg:"2.5rem"},gap:"2px"},overlay:{padding:`var(--${e}-space-1)`,radius:`var(--${e}-radius-lg)`,minWidth:"7.5rem"},field:{gap:`var(--${e}-space-1)`,labelGap:`var(--${e}-space-1)`},target:{min:"24px"}},T={control:{height:{sm:"2.25rem",md:"2.75rem",lg:"3rem",compact:"2.75rem"}},item:{height:{sm:"2.25rem",md:"2.75rem",lg:"3rem"}},target:{min:"44px"}},C={disabled:"0.5",scrim:"0.6"},w={sm:640,md:768,lg:1024,xl:1280};function S(){return a([["font",c],["space",d],["radius",l],["shadow",x],["motion",g],["z-index",h],["focus-ring",y],["border-width",f],["opacity",C],...m(u)])}function m(r){let o=n=>r[n];return[["control",o("control")],["icon-size",o("iconSize")],["indicator-size",o("indicatorSize")],["item",o("item")],["overlay",o("overlay")],["field",o("field")],["target",o("target")]]}function $(){return a(m(T))}function R(){let r=S(),o=i(r).map(n=>` ${n}: 0ms;`);return`:root {
|
|
2
2
|
${s(r)}
|
|
3
3
|
}
|
|
4
4
|
@media (prefers-reduced-motion: reduce) {
|
|
@@ -9,7 +9,7 @@ ${o.join(`
|
|
|
9
9
|
}
|
|
10
10
|
@media (pointer: coarse) {
|
|
11
11
|
:root {
|
|
12
|
-
${s(
|
|
12
|
+
${s($()," ")}
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
`}export{
|
|
15
|
+
`}export{f as borderWidth,w as breakpoints,$ as coarsePointerToCssVars,u as controls,T as controlsCoarse,y as focusRing,R as foundationToCss,S as foundationToCssVars,g as motion,C as opacity,l as radii,x as shadows,d as space,c as typography,h as zIndex};
|
package/dist/utils/mode.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var l=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var v=(t,e)=>{for(var n in e)l(t,n,{get:e[n],enumerable:!0})},x=(t,e,n,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of E(e))!k.call(t,r)&&r!==n&&l(t,r,{get:()=>e[r],enumerable:!(a=O(e,r))||a.enumerable});return t};var M=t=>x(l({},"__esModule",{value:!0}),t);var I={};v(I,{BRAND_STORAGE_KEY:()=>S,MODE_STORAGE_KEY:()=>h,getThemeInitScript:()=>K,watchSystemMode:()=>T});module.exports=M(I);var o=require("../themes/brands.cjs"),y=require("./toCss.cjs"),h="skdx-mode",S="skdx-brand",b="(prefers-color-scheme: dark)";function T(t={}){let{brand:e,element:n,persist:a=!1,storageKey:r=h}=t,i=(e===void 0?void 0:(0,o.getBrand)(e))??o.defaultBrand,d=window.matchMedia(b),g,p=m=>{let s=null;try{s=localStorage.getItem(r)}catch{}let u=s==="light"||s==="dark"?s:void 0,c=(u!==g?u:void 0)??(m?"dark":"light");if((0,y.applyTheme)(i.themes[c],n),!!a)try{localStorage.setItem(r,c),g=c}catch{}};p(d.matches);let f=m=>p(m.matches);return d.addEventListener("change",f),()=>d.removeEventListener("change",f)}function K(t={}){let{brandKey:e=S,modeKey:n=h,brand:a=o.defaultBrand.name}=t,r=Object.fromEntries(o.brands.map(i=>[i.name,[i.themes.light.name,i.themes.dark.name]]));return`(function(){try{var t=${JSON.stringify(r)},f=${JSON.stringify(a)};var b=localStorage.getItem(${JSON.stringify(e)})||f;var m=localStorage.getItem(${JSON.stringify(n)});if(m!=="light"&&m!=="dark")m=matchMedia(${JSON.stringify(b)}).matches?"dark":"light";var p=t[b]||t[f];if(!p)return;var e=document.documentElement;e.setAttribute("data-skdx-theme",p[m==="dark"?1:0]);e.setAttribute("data-skdx-mode",m);}catch(e){}})();`}0&&(module.exports={BRAND_STORAGE_KEY,MODE_STORAGE_KEY,getThemeInitScript,watchSystemMode});
|