@ttoss/fsl-theme 2.1.1 → 2.1.2
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/{Types-a_sfpbha.d.cts → Types-8o6d09ll.d.cts} +23 -24
- package/dist/{Types-a_sfpbha.d.mts → Types-8o6d09ll.d.mts} +23 -24
- package/dist/{baseBundle-CXdxj_re.mjs → baseBundle-C6RP-2Qb.mjs} +1 -1
- package/dist/{baseBundle-a9LDsqYy.cjs → baseBundle-C6yVk4x0.cjs} +1 -1
- package/dist/{createTheme-B7H0xSVp.cjs → createTheme-BzlJdFAG.cjs} +18 -18
- package/dist/{createTheme-Bm9LVQ4w.mjs → createTheme-gTjIryKH.mjs} +18 -18
- package/dist/css-BVePVvTJ.mjs +96 -0
- package/dist/css-CKvOE4mT.cjs +113 -0
- package/dist/css.cjs +5 -41
- package/dist/css.d.cts +22 -2
- package/dist/css.d.mts +22 -2
- package/dist/css.mjs +3 -41
- package/dist/dataviz/index.cjs +2 -2
- package/dist/dataviz/index.d.cts +1 -1
- package/dist/dataviz/index.d.mts +1 -1
- package/dist/dataviz/index.mjs +1 -1
- package/dist/dtcg.cjs +11 -16
- package/dist/dtcg.d.cts +3 -3
- package/dist/dtcg.d.mts +3 -3
- package/dist/dtcg.mjs +11 -16
- package/dist/{index-BmZQVd3G.d.cts → index-CIkVRaGC.d.cts} +1 -1
- package/dist/{index-XZsRrMTF.d.mts → index-OP4B-9hU.d.mts} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +1 -1
- package/dist/{react-DQErMGJz.cjs → react-C1WRCOFF.cjs} +43 -9
- package/dist/{react-BwnHHvJj.d.mts → react-C9QSshf3.d.mts} +30 -3
- package/dist/{react-2D_CNVF2.d.cts → react-CZDLBN6v.d.cts} +30 -3
- package/dist/react.cjs +2 -1
- package/dist/react.d.cts +2 -2
- package/dist/react.d.mts +2 -2
- package/dist/react.mjs +38 -10
- package/dist/themes/bruttal.cjs +2 -2
- package/dist/themes/bruttal.d.cts +1 -1
- package/dist/themes/bruttal.d.mts +1 -1
- package/dist/themes/bruttal.mjs +2 -2
- package/dist/{toCssVars-CWTlp9St.mjs → toCssVars-CTGqZ_t3.mjs} +5 -5
- package/dist/{toCssVars-D0BR23cP.cjs → toCssVars-NGi4K2Oc.cjs} +5 -5
- package/dist/vars.cjs +2 -2
- package/dist/vars.d.cts +1 -1
- package/dist/vars.d.mts +1 -1
- package/dist/vars.mjs +2 -2
- package/dist/{withDataviz-DrUtw8cc.cjs → withDataviz-B-XQ1MDT.cjs} +1 -1
- package/dist/{withDataviz-Ln3sEwb7.mjs → withDataviz-B3mEhBPh.mjs} +1 -1
- package/llms.txt +10 -10
- package/package.json +1 -1
|
@@ -824,21 +824,20 @@ interface CoreSizeViewport {
|
|
|
824
824
|
full: RawValue;
|
|
825
825
|
};
|
|
826
826
|
}
|
|
827
|
-
/** Three-step hit target size ramp (min / base / prominent). */
|
|
828
|
-
interface CoreSizeHitScale {
|
|
829
|
-
min: RawValue;
|
|
830
|
-
base: RawValue;
|
|
831
|
-
prominent: RawValue;
|
|
832
|
-
}
|
|
833
827
|
/**
|
|
834
|
-
* Hit target
|
|
835
|
-
*
|
|
828
|
+
* Hit target floors split by pointer type.
|
|
829
|
+
*
|
|
830
|
+
* A **single ergonomic floor per pointer profile** — the minimum interactive
|
|
831
|
+
* target, never a visual size and never a scale. The theme defines one value;
|
|
832
|
+
* `toCssVars` injects the `coarse` value under `@media (any-pointer: coarse)`.
|
|
833
|
+
* (Evidence: the former three-step ramp shipped with only `base` ever consumed
|
|
834
|
+
* — see ADR-020.)
|
|
836
835
|
*/
|
|
837
836
|
interface CoreSizeHit {
|
|
838
|
-
/** Fine pointer (mouse/trackpad) hit
|
|
839
|
-
fine:
|
|
840
|
-
/** Coarse pointer (touch) hit
|
|
841
|
-
coarse:
|
|
837
|
+
/** Fine pointer (mouse/trackpad) hit target floor. */
|
|
838
|
+
fine: RawValue;
|
|
839
|
+
/** Coarse pointer (touch) hit target floor. */
|
|
840
|
+
coarse: RawValue;
|
|
842
841
|
}
|
|
843
842
|
interface CoreSizing {
|
|
844
843
|
ramp: {
|
|
@@ -852,20 +851,20 @@ interface CoreSizing {
|
|
|
852
851
|
}
|
|
853
852
|
interface SemanticSizing {
|
|
854
853
|
/**
|
|
855
|
-
* Ergonomic hit
|
|
856
|
-
*
|
|
857
|
-
*
|
|
854
|
+
* Ergonomic hit target — a **single interactive floor** (min interactive
|
|
855
|
+
* area), not a visual size and not a scale. Enforce via `min-height` /
|
|
856
|
+
* `min-width`; the visible control size comes from its inset + type, with
|
|
857
|
+
* `hit` only guaranteeing the ergonomic minimum.
|
|
858
858
|
*
|
|
859
|
-
*
|
|
860
|
-
* where `floor` is a fixed `Npx`
|
|
861
|
-
*
|
|
862
|
-
*
|
|
859
|
+
* Resolves to the **fine-pointer** value (`core.sizing.hit.fine`), which may
|
|
860
|
+
* use `clamp(floor, preferred, max)` where `floor` is a fixed `Npx`
|
|
861
|
+
* ergonomic minimum — guaranteeing accessibility while letting the rem
|
|
862
|
+
* `preferred` respect user font-size. The CSS output layer (`toCssVars`)
|
|
863
|
+
* automatically injects the coarse-pointer override (`core.sizing.hit.coarse`,
|
|
864
|
+
* always fixed `px`) inside `@media (any-pointer: coarse)` — no component
|
|
865
|
+
* code needed.
|
|
863
866
|
*/
|
|
864
|
-
hit:
|
|
865
|
-
/** Minimum interactive area for small / secondary targets (icon-only buttons, toolbar items). Enforce via `min-width` / `min-height`; not a visual size. */min: CoreSizingRef; /** Default interactive area for standard buttons, inputs, and toggles. Pick when no other step applies. */
|
|
866
|
-
base: CoreSizingRef; /** Prominent interactive area for high-emphasis or low-density targets (CTAs, dialog actions). */
|
|
867
|
-
prominent: CoreSizingRef;
|
|
868
|
-
};
|
|
867
|
+
hit: CoreSizingRef;
|
|
869
868
|
/**
|
|
870
869
|
* Visual glyph dimensions. Set on the icon element itself; never used to
|
|
871
870
|
* gate the hit target that wraps it (that is `hit.*`).
|
|
@@ -824,21 +824,20 @@ interface CoreSizeViewport {
|
|
|
824
824
|
full: RawValue;
|
|
825
825
|
};
|
|
826
826
|
}
|
|
827
|
-
/** Three-step hit target size ramp (min / base / prominent). */
|
|
828
|
-
interface CoreSizeHitScale {
|
|
829
|
-
min: RawValue;
|
|
830
|
-
base: RawValue;
|
|
831
|
-
prominent: RawValue;
|
|
832
|
-
}
|
|
833
827
|
/**
|
|
834
|
-
* Hit target
|
|
835
|
-
*
|
|
828
|
+
* Hit target floors split by pointer type.
|
|
829
|
+
*
|
|
830
|
+
* A **single ergonomic floor per pointer profile** — the minimum interactive
|
|
831
|
+
* target, never a visual size and never a scale. The theme defines one value;
|
|
832
|
+
* `toCssVars` injects the `coarse` value under `@media (any-pointer: coarse)`.
|
|
833
|
+
* (Evidence: the former three-step ramp shipped with only `base` ever consumed
|
|
834
|
+
* — see ADR-020.)
|
|
836
835
|
*/
|
|
837
836
|
interface CoreSizeHit {
|
|
838
|
-
/** Fine pointer (mouse/trackpad) hit
|
|
839
|
-
fine:
|
|
840
|
-
/** Coarse pointer (touch) hit
|
|
841
|
-
coarse:
|
|
837
|
+
/** Fine pointer (mouse/trackpad) hit target floor. */
|
|
838
|
+
fine: RawValue;
|
|
839
|
+
/** Coarse pointer (touch) hit target floor. */
|
|
840
|
+
coarse: RawValue;
|
|
842
841
|
}
|
|
843
842
|
interface CoreSizing {
|
|
844
843
|
ramp: {
|
|
@@ -852,20 +851,20 @@ interface CoreSizing {
|
|
|
852
851
|
}
|
|
853
852
|
interface SemanticSizing {
|
|
854
853
|
/**
|
|
855
|
-
* Ergonomic hit
|
|
856
|
-
*
|
|
857
|
-
*
|
|
854
|
+
* Ergonomic hit target — a **single interactive floor** (min interactive
|
|
855
|
+
* area), not a visual size and not a scale. Enforce via `min-height` /
|
|
856
|
+
* `min-width`; the visible control size comes from its inset + type, with
|
|
857
|
+
* `hit` only guaranteeing the ergonomic minimum.
|
|
858
858
|
*
|
|
859
|
-
*
|
|
860
|
-
* where `floor` is a fixed `Npx`
|
|
861
|
-
*
|
|
862
|
-
*
|
|
859
|
+
* Resolves to the **fine-pointer** value (`core.sizing.hit.fine`), which may
|
|
860
|
+
* use `clamp(floor, preferred, max)` where `floor` is a fixed `Npx`
|
|
861
|
+
* ergonomic minimum — guaranteeing accessibility while letting the rem
|
|
862
|
+
* `preferred` respect user font-size. The CSS output layer (`toCssVars`)
|
|
863
|
+
* automatically injects the coarse-pointer override (`core.sizing.hit.coarse`,
|
|
864
|
+
* always fixed `px`) inside `@media (any-pointer: coarse)` — no component
|
|
865
|
+
* code needed.
|
|
863
866
|
*/
|
|
864
|
-
hit:
|
|
865
|
-
/** Minimum interactive area for small / secondary targets (icon-only buttons, toolbar items). Enforce via `min-width` / `min-height`; not a visual size. */min: CoreSizingRef; /** Default interactive area for standard buttons, inputs, and toggles. Pick when no other step applies. */
|
|
866
|
-
base: CoreSizingRef; /** Prominent interactive area for high-emphasis or low-density targets (CTAs, dialog actions). */
|
|
867
|
-
prominent: CoreSizingRef;
|
|
868
|
-
};
|
|
867
|
+
hit: CoreSizingRef;
|
|
869
868
|
/**
|
|
870
869
|
* Visual glyph dimensions. Set on the icon element itself; never used to
|
|
871
870
|
* gate the hit target that wraps it (that is `hit.*`).
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
-
import { a as darkAlternate, i as baseTheme, n as createTheme, r as baseBrief } from "./createTheme-
|
|
2
|
+
import { a as darkAlternate, i as baseTheme, n as createTheme, r as baseBrief } from "./createTheme-gTjIryKH.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/baseBundle.ts
|
|
5
5
|
/**
|
|
@@ -58,7 +58,9 @@ var baseTheme = {
|
|
|
58
58
|
300: "#cbd5e1",
|
|
59
59
|
400: "#94a3b8",
|
|
60
60
|
500: "#64748b",
|
|
61
|
+
600: "#475569",
|
|
61
62
|
700: "#334155",
|
|
63
|
+
800: "#1e293b",
|
|
62
64
|
900: "#0f172a",
|
|
63
65
|
1e3: "#020617"
|
|
64
66
|
},
|
|
@@ -239,16 +241,8 @@ var baseTheme = {
|
|
|
239
241
|
}
|
|
240
242
|
},
|
|
241
243
|
hit: {
|
|
242
|
-
fine:
|
|
243
|
-
|
|
244
|
-
base: "clamp(32px, 2rem, 40px)",
|
|
245
|
-
prominent: "clamp(40px, 2.5rem, 48px)"
|
|
246
|
-
},
|
|
247
|
-
coarse: {
|
|
248
|
-
min: "32px",
|
|
249
|
-
base: "48px",
|
|
250
|
-
prominent: "56px"
|
|
251
|
-
}
|
|
244
|
+
fine: "clamp(32px, 2rem, 36px)",
|
|
245
|
+
coarse: "48px"
|
|
252
246
|
}
|
|
253
247
|
},
|
|
254
248
|
radii: {
|
|
@@ -953,6 +947,11 @@ var baseTheme = {
|
|
|
953
947
|
raised: "{core.elevation.level.2}",
|
|
954
948
|
overlay: "{core.elevation.level.3}",
|
|
955
949
|
blocking: "{core.elevation.level.4}"
|
|
950
|
+
},
|
|
951
|
+
tonal: {
|
|
952
|
+
raised: "{core.colors.neutral.0}",
|
|
953
|
+
overlay: "{core.colors.neutral.0}",
|
|
954
|
+
blocking: "{core.colors.neutral.0}"
|
|
956
955
|
}
|
|
957
956
|
},
|
|
958
957
|
text: {
|
|
@@ -1108,9 +1107,9 @@ var baseTheme = {
|
|
|
1108
1107
|
spacing: {
|
|
1109
1108
|
inset: {
|
|
1110
1109
|
control: {
|
|
1111
|
-
sm: "{core.spacing.
|
|
1112
|
-
md: "{core.spacing.
|
|
1113
|
-
lg: "{core.spacing.
|
|
1110
|
+
sm: "{core.spacing.1}",
|
|
1111
|
+
md: "{core.spacing.2}",
|
|
1112
|
+
lg: "{core.spacing.4}"
|
|
1114
1113
|
},
|
|
1115
1114
|
surface: {
|
|
1116
1115
|
sm: "{core.spacing.4}",
|
|
@@ -1145,11 +1144,7 @@ var baseTheme = {
|
|
|
1145
1144
|
}
|
|
1146
1145
|
},
|
|
1147
1146
|
sizing: {
|
|
1148
|
-
hit: {
|
|
1149
|
-
min: "{core.sizing.hit.fine.min}",
|
|
1150
|
-
base: "{core.sizing.hit.fine.base}",
|
|
1151
|
-
prominent: "{core.sizing.hit.fine.prominent}"
|
|
1152
|
-
},
|
|
1147
|
+
hit: "{core.sizing.hit.fine}",
|
|
1153
1148
|
icon: {
|
|
1154
1149
|
sm: "{core.sizing.ramp.ui.2}",
|
|
1155
1150
|
md: "{core.sizing.ramp.ui.3}",
|
|
@@ -1744,6 +1739,11 @@ var darkAlternate = {
|
|
|
1744
1739
|
raised: "{core.elevation.emphatic.2}",
|
|
1745
1740
|
overlay: "{core.elevation.emphatic.3}",
|
|
1746
1741
|
blocking: "{core.elevation.emphatic.4}"
|
|
1742
|
+
},
|
|
1743
|
+
tonal: {
|
|
1744
|
+
raised: "{core.colors.neutral.800}",
|
|
1745
|
+
overlay: "{core.colors.neutral.700}",
|
|
1746
|
+
blocking: "{core.colors.neutral.700}"
|
|
1747
1747
|
}
|
|
1748
1748
|
}
|
|
1749
1749
|
}
|
|
@@ -58,7 +58,9 @@ var baseTheme = {
|
|
|
58
58
|
300: "#cbd5e1",
|
|
59
59
|
400: "#94a3b8",
|
|
60
60
|
500: "#64748b",
|
|
61
|
+
600: "#475569",
|
|
61
62
|
700: "#334155",
|
|
63
|
+
800: "#1e293b",
|
|
62
64
|
900: "#0f172a",
|
|
63
65
|
1e3: "#020617"
|
|
64
66
|
},
|
|
@@ -239,16 +241,8 @@ var baseTheme = {
|
|
|
239
241
|
}
|
|
240
242
|
},
|
|
241
243
|
hit: {
|
|
242
|
-
fine:
|
|
243
|
-
|
|
244
|
-
base: "clamp(32px, 2rem, 40px)",
|
|
245
|
-
prominent: "clamp(40px, 2.5rem, 48px)"
|
|
246
|
-
},
|
|
247
|
-
coarse: {
|
|
248
|
-
min: "32px",
|
|
249
|
-
base: "48px",
|
|
250
|
-
prominent: "56px"
|
|
251
|
-
}
|
|
244
|
+
fine: "clamp(32px, 2rem, 36px)",
|
|
245
|
+
coarse: "48px"
|
|
252
246
|
}
|
|
253
247
|
},
|
|
254
248
|
radii: {
|
|
@@ -953,6 +947,11 @@ var baseTheme = {
|
|
|
953
947
|
raised: "{core.elevation.level.2}",
|
|
954
948
|
overlay: "{core.elevation.level.3}",
|
|
955
949
|
blocking: "{core.elevation.level.4}"
|
|
950
|
+
},
|
|
951
|
+
tonal: {
|
|
952
|
+
raised: "{core.colors.neutral.0}",
|
|
953
|
+
overlay: "{core.colors.neutral.0}",
|
|
954
|
+
blocking: "{core.colors.neutral.0}"
|
|
956
955
|
}
|
|
957
956
|
},
|
|
958
957
|
text: {
|
|
@@ -1108,9 +1107,9 @@ var baseTheme = {
|
|
|
1108
1107
|
spacing: {
|
|
1109
1108
|
inset: {
|
|
1110
1109
|
control: {
|
|
1111
|
-
sm: "{core.spacing.
|
|
1112
|
-
md: "{core.spacing.
|
|
1113
|
-
lg: "{core.spacing.
|
|
1110
|
+
sm: "{core.spacing.1}",
|
|
1111
|
+
md: "{core.spacing.2}",
|
|
1112
|
+
lg: "{core.spacing.4}"
|
|
1114
1113
|
},
|
|
1115
1114
|
surface: {
|
|
1116
1115
|
sm: "{core.spacing.4}",
|
|
@@ -1145,11 +1144,7 @@ var baseTheme = {
|
|
|
1145
1144
|
}
|
|
1146
1145
|
},
|
|
1147
1146
|
sizing: {
|
|
1148
|
-
hit: {
|
|
1149
|
-
min: "{core.sizing.hit.fine.min}",
|
|
1150
|
-
base: "{core.sizing.hit.fine.base}",
|
|
1151
|
-
prominent: "{core.sizing.hit.fine.prominent}"
|
|
1152
|
-
},
|
|
1147
|
+
hit: "{core.sizing.hit.fine}",
|
|
1153
1148
|
icon: {
|
|
1154
1149
|
sm: "{core.sizing.ramp.ui.2}",
|
|
1155
1150
|
md: "{core.sizing.ramp.ui.3}",
|
|
@@ -1744,6 +1739,11 @@ var darkAlternate = {
|
|
|
1744
1739
|
raised: "{core.elevation.emphatic.2}",
|
|
1745
1740
|
overlay: "{core.elevation.emphatic.3}",
|
|
1746
1741
|
blocking: "{core.elevation.emphatic.4}"
|
|
1742
|
+
},
|
|
1743
|
+
tonal: {
|
|
1744
|
+
raised: "{core.colors.neutral.800}",
|
|
1745
|
+
overlay: "{core.colors.neutral.700}",
|
|
1746
|
+
blocking: "{core.colors.neutral.700}"
|
|
1747
1747
|
}
|
|
1748
1748
|
}
|
|
1749
1749
|
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
+
import { n as toCssVars } from "./toCssVars-CTGqZ_t3.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/roots/preflight.ts
|
|
5
|
+
/**
|
|
6
|
+
* The theme's base stylesheet as a raw CSS string — box-sizing reset, body
|
|
7
|
+
* typography/colour bound to semantic tokens, and the reduced-motion guard.
|
|
8
|
+
* Inject once at the app root. Requires the `--tt-*` custom properties to be
|
|
9
|
+
* present (via `getThemeStylesContent` / `<ThemeStyles>` / `<ThemeProvider>`).
|
|
10
|
+
*/
|
|
11
|
+
var PREFLIGHT_CSS = `*,
|
|
12
|
+
*::before,
|
|
13
|
+
*::after {
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
html,
|
|
18
|
+
body {
|
|
19
|
+
margin: 0;
|
|
20
|
+
padding: 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
body {
|
|
24
|
+
font-family: var(--tt-text-body-md-font-family, system-ui, sans-serif);
|
|
25
|
+
font-size: var(--tt-text-body-md-font-size);
|
|
26
|
+
line-height: var(--tt-text-body-md-line-height);
|
|
27
|
+
color: var(--tt-colors-informational-primary-text-default);
|
|
28
|
+
background-color: var(--tt-colors-informational-primary-background-default);
|
|
29
|
+
-webkit-font-smoothing: antialiased;
|
|
30
|
+
text-rendering: optimizeLegibility;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@media (prefers-reduced-motion: reduce) {
|
|
34
|
+
*,
|
|
35
|
+
*::before,
|
|
36
|
+
*::after {
|
|
37
|
+
animation-duration: 0.01ms !important;
|
|
38
|
+
animation-iteration-count: 1 !important;
|
|
39
|
+
transition-duration: 0.01ms !important;
|
|
40
|
+
scroll-behavior: auto !important;
|
|
41
|
+
}
|
|
42
|
+
}`;
|
|
43
|
+
/**
|
|
44
|
+
* Returns the theme's base stylesheet — see {@link PREFLIGHT_CSS}. A function
|
|
45
|
+
* for API symmetry with `getThemeStylesContent`; the value is static.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* import { getPreflightStyles } from '@ttoss/fsl-theme/css';
|
|
50
|
+
* res.type('text/css').send(getPreflightStyles());
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
var getPreflightStyles = () => {
|
|
54
|
+
return PREFLIGHT_CSS;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/css.ts
|
|
59
|
+
/**
|
|
60
|
+
* Returns the full CSS string for a theme bundle — all `--tt-*` custom
|
|
61
|
+
* properties, coarse-pointer overrides, reduced-motion overrides, and
|
|
62
|
+
* container query progressive enhancement — ready to inject into a
|
|
63
|
+
* `<style>` tag or serve as a static `.css` file.
|
|
64
|
+
*
|
|
65
|
+
* Symmetric counterpart to `getThemeScriptContent()` for CSS.
|
|
66
|
+
* Use `<ThemeStyles>` from `@ttoss/fsl-theme/react` for React apps.
|
|
67
|
+
*
|
|
68
|
+
* When `themeId` is omitted (canonical 1-theme model), CSS targets `:root` and
|
|
69
|
+
* the alternate mode selector becomes `:root[data-tt-mode="dark"]`. Pass
|
|
70
|
+
* `themeId` only for multi-theme scenarios (Storybook, micro-frontends).
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts
|
|
74
|
+
* // Canonical: no themeId needed (CSS goes to :root)
|
|
75
|
+
* import { createTheme } from '@ttoss/fsl-theme';
|
|
76
|
+
* import { getThemeStylesContent } from '@ttoss/fsl-theme/css';
|
|
77
|
+
*
|
|
78
|
+
* const myBundle = createTheme();
|
|
79
|
+
*
|
|
80
|
+
* app.get('/theme.css', (_, res) => {
|
|
81
|
+
* res.type('text/css').send(getThemeStylesContent(myBundle));
|
|
82
|
+
* });
|
|
83
|
+
*
|
|
84
|
+
* // Multi-theme: explicit themeId for scoping
|
|
85
|
+
* res.type('text/css').send(getThemeStylesContent(myBundle, 'myTheme'));
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
var getThemeStylesContent = (bundle, themeId, options) => {
|
|
89
|
+
return toCssVars(bundle, {
|
|
90
|
+
themeId,
|
|
91
|
+
systemModeFallback: options?.systemModeFallback
|
|
92
|
+
}).toCssString();
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
//#endregion
|
|
96
|
+
export { PREFLIGHT_CSS as n, getPreflightStyles as r, getThemeStylesContent as t };
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
+
const require_toCssVars = require('./toCssVars-NGi4K2Oc.cjs');
|
|
3
|
+
|
|
4
|
+
//#region src/roots/preflight.ts
|
|
5
|
+
/**
|
|
6
|
+
* The theme's base stylesheet as a raw CSS string — box-sizing reset, body
|
|
7
|
+
* typography/colour bound to semantic tokens, and the reduced-motion guard.
|
|
8
|
+
* Inject once at the app root. Requires the `--tt-*` custom properties to be
|
|
9
|
+
* present (via `getThemeStylesContent` / `<ThemeStyles>` / `<ThemeProvider>`).
|
|
10
|
+
*/
|
|
11
|
+
var PREFLIGHT_CSS = `*,
|
|
12
|
+
*::before,
|
|
13
|
+
*::after {
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
html,
|
|
18
|
+
body {
|
|
19
|
+
margin: 0;
|
|
20
|
+
padding: 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
body {
|
|
24
|
+
font-family: var(--tt-text-body-md-font-family, system-ui, sans-serif);
|
|
25
|
+
font-size: var(--tt-text-body-md-font-size);
|
|
26
|
+
line-height: var(--tt-text-body-md-line-height);
|
|
27
|
+
color: var(--tt-colors-informational-primary-text-default);
|
|
28
|
+
background-color: var(--tt-colors-informational-primary-background-default);
|
|
29
|
+
-webkit-font-smoothing: antialiased;
|
|
30
|
+
text-rendering: optimizeLegibility;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@media (prefers-reduced-motion: reduce) {
|
|
34
|
+
*,
|
|
35
|
+
*::before,
|
|
36
|
+
*::after {
|
|
37
|
+
animation-duration: 0.01ms !important;
|
|
38
|
+
animation-iteration-count: 1 !important;
|
|
39
|
+
transition-duration: 0.01ms !important;
|
|
40
|
+
scroll-behavior: auto !important;
|
|
41
|
+
}
|
|
42
|
+
}`;
|
|
43
|
+
/**
|
|
44
|
+
* Returns the theme's base stylesheet — see {@link PREFLIGHT_CSS}. A function
|
|
45
|
+
* for API symmetry with `getThemeStylesContent`; the value is static.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* import { getPreflightStyles } from '@ttoss/fsl-theme/css';
|
|
50
|
+
* res.type('text/css').send(getPreflightStyles());
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
var getPreflightStyles = () => {
|
|
54
|
+
return PREFLIGHT_CSS;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/css.ts
|
|
59
|
+
/**
|
|
60
|
+
* Returns the full CSS string for a theme bundle — all `--tt-*` custom
|
|
61
|
+
* properties, coarse-pointer overrides, reduced-motion overrides, and
|
|
62
|
+
* container query progressive enhancement — ready to inject into a
|
|
63
|
+
* `<style>` tag or serve as a static `.css` file.
|
|
64
|
+
*
|
|
65
|
+
* Symmetric counterpart to `getThemeScriptContent()` for CSS.
|
|
66
|
+
* Use `<ThemeStyles>` from `@ttoss/fsl-theme/react` for React apps.
|
|
67
|
+
*
|
|
68
|
+
* When `themeId` is omitted (canonical 1-theme model), CSS targets `:root` and
|
|
69
|
+
* the alternate mode selector becomes `:root[data-tt-mode="dark"]`. Pass
|
|
70
|
+
* `themeId` only for multi-theme scenarios (Storybook, micro-frontends).
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts
|
|
74
|
+
* // Canonical: no themeId needed (CSS goes to :root)
|
|
75
|
+
* import { createTheme } from '@ttoss/fsl-theme';
|
|
76
|
+
* import { getThemeStylesContent } from '@ttoss/fsl-theme/css';
|
|
77
|
+
*
|
|
78
|
+
* const myBundle = createTheme();
|
|
79
|
+
*
|
|
80
|
+
* app.get('/theme.css', (_, res) => {
|
|
81
|
+
* res.type('text/css').send(getThemeStylesContent(myBundle));
|
|
82
|
+
* });
|
|
83
|
+
*
|
|
84
|
+
* // Multi-theme: explicit themeId for scoping
|
|
85
|
+
* res.type('text/css').send(getThemeStylesContent(myBundle, 'myTheme'));
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
var getThemeStylesContent = (bundle, themeId, options) => {
|
|
89
|
+
return require_toCssVars.toCssVars(bundle, {
|
|
90
|
+
themeId,
|
|
91
|
+
systemModeFallback: options?.systemModeFallback
|
|
92
|
+
}).toCssString();
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
//#endregion
|
|
96
|
+
Object.defineProperty(exports, 'PREFLIGHT_CSS', {
|
|
97
|
+
enumerable: true,
|
|
98
|
+
get: function () {
|
|
99
|
+
return PREFLIGHT_CSS;
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
Object.defineProperty(exports, 'getPreflightStyles', {
|
|
103
|
+
enumerable: true,
|
|
104
|
+
get: function () {
|
|
105
|
+
return getPreflightStyles;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
Object.defineProperty(exports, 'getThemeStylesContent', {
|
|
109
|
+
enumerable: true,
|
|
110
|
+
get: function () {
|
|
111
|
+
return getThemeStylesContent;
|
|
112
|
+
}
|
|
113
|
+
});
|
package/dist/css.cjs
CHANGED
|
@@ -3,47 +3,11 @@ Object.defineProperty(exports, Symbol.toStringTag, {
|
|
|
3
3
|
value: 'Module'
|
|
4
4
|
});
|
|
5
5
|
const require_helpers = require('./helpers-BU40JvFA.cjs');
|
|
6
|
-
const require_toCssVars = require('./toCssVars-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* properties, coarse-pointer overrides, reduced-motion overrides, and
|
|
12
|
-
* container query progressive enhancement — ready to inject into a
|
|
13
|
-
* `<style>` tag or serve as a static `.css` file.
|
|
14
|
-
*
|
|
15
|
-
* Symmetric counterpart to `getThemeScriptContent()` for CSS.
|
|
16
|
-
* Use `<ThemeStyles>` from `@ttoss/fsl-theme/react` for React apps.
|
|
17
|
-
*
|
|
18
|
-
* When `themeId` is omitted (canonical 1-theme model), CSS targets `:root` and
|
|
19
|
-
* the alternate mode selector becomes `:root[data-tt-mode="dark"]`. Pass
|
|
20
|
-
* `themeId` only for multi-theme scenarios (Storybook, micro-frontends).
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```ts
|
|
24
|
-
* // Canonical: no themeId needed (CSS goes to :root)
|
|
25
|
-
* import { createTheme } from '@ttoss/fsl-theme';
|
|
26
|
-
* import { getThemeStylesContent } from '@ttoss/fsl-theme/css';
|
|
27
|
-
*
|
|
28
|
-
* const myBundle = createTheme();
|
|
29
|
-
*
|
|
30
|
-
* app.get('/theme.css', (_, res) => {
|
|
31
|
-
* res.type('text/css').send(getThemeStylesContent(myBundle));
|
|
32
|
-
* });
|
|
33
|
-
*
|
|
34
|
-
* // Multi-theme: explicit themeId for scoping
|
|
35
|
-
* res.type('text/css').send(getThemeStylesContent(myBundle, 'myTheme'));
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
var getThemeStylesContent = (bundle, themeId, options) => {
|
|
39
|
-
return require_toCssVars.toCssVars(bundle, {
|
|
40
|
-
themeId,
|
|
41
|
-
systemModeFallback: options?.systemModeFallback
|
|
42
|
-
}).toCssString();
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
//#endregion
|
|
46
|
-
exports.getThemeStylesContent = getThemeStylesContent;
|
|
6
|
+
const require_toCssVars = require('./toCssVars-NGi4K2Oc.cjs');
|
|
7
|
+
const require_css = require('./css-CKvOE4mT.cjs');
|
|
8
|
+
exports.PREFLIGHT_CSS = require_css.PREFLIGHT_CSS;
|
|
9
|
+
exports.getPreflightStyles = require_css.getPreflightStyles;
|
|
10
|
+
exports.getThemeStylesContent = require_css.getThemeStylesContent;
|
|
47
11
|
exports.toCssVarName = require_toCssVars.toCssVarName;
|
|
48
12
|
exports.toCssVars = require_toCssVars.toCssVars;
|
|
49
13
|
exports.toFlatTokens = require_helpers.toFlatTokens;
|
package/dist/css.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { a as ThemeTokens, i as ThemeBundle } from "./Types-
|
|
2
|
+
import { a as ThemeTokens, i as ThemeBundle } from "./Types-8o6d09ll.cjs";
|
|
3
3
|
|
|
4
4
|
//#region src/roots/helpers.d.ts
|
|
5
5
|
/**
|
|
@@ -24,6 +24,26 @@ declare const toFlatTokens: (theme: ThemeTokens, options?: {
|
|
|
24
24
|
*/
|
|
25
25
|
type FlatTokenMap = Record<string, string | number>;
|
|
26
26
|
//#endregion
|
|
27
|
+
//#region src/roots/preflight.d.ts
|
|
28
|
+
/**
|
|
29
|
+
* The theme's base stylesheet as a raw CSS string — box-sizing reset, body
|
|
30
|
+
* typography/colour bound to semantic tokens, and the reduced-motion guard.
|
|
31
|
+
* Inject once at the app root. Requires the `--tt-*` custom properties to be
|
|
32
|
+
* present (via `getThemeStylesContent` / `<ThemeStyles>` / `<ThemeProvider>`).
|
|
33
|
+
*/
|
|
34
|
+
declare const PREFLIGHT_CSS = "*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\nhtml,\nbody {\n margin: 0;\n padding: 0;\n}\n\nbody {\n font-family: var(--tt-text-body-md-font-family, system-ui, sans-serif);\n font-size: var(--tt-text-body-md-font-size);\n line-height: var(--tt-text-body-md-line-height);\n color: var(--tt-colors-informational-primary-text-default);\n background-color: var(--tt-colors-informational-primary-background-default);\n -webkit-font-smoothing: antialiased;\n text-rendering: optimizeLegibility;\n}\n\n@media (prefers-reduced-motion: reduce) {\n *,\n *::before,\n *::after {\n animation-duration: 0.01ms !important;\n animation-iteration-count: 1 !important;\n transition-duration: 0.01ms !important;\n scroll-behavior: auto !important;\n }\n}";
|
|
35
|
+
/**
|
|
36
|
+
* Returns the theme's base stylesheet — see {@link PREFLIGHT_CSS}. A function
|
|
37
|
+
* for API symmetry with `getThemeStylesContent`; the value is static.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* import { getPreflightStyles } from '@ttoss/fsl-theme/css';
|
|
42
|
+
* res.type('text/css').send(getPreflightStyles());
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
declare const getPreflightStyles: () => string;
|
|
46
|
+
//#endregion
|
|
27
47
|
//#region src/roots/toCssVars.d.ts
|
|
28
48
|
/**
|
|
29
49
|
* Convert a full token path to a CSS custom property name.
|
|
@@ -184,4 +204,4 @@ declare const getThemeStylesContent: (bundle: ThemeBundle, themeId?: string, opt
|
|
|
184
204
|
systemModeFallback?: boolean;
|
|
185
205
|
}) => string;
|
|
186
206
|
//#endregion
|
|
187
|
-
export { type BundleCssVarsOptions, type BundleCssVarsResult, type CssVarsOptions, type CssVarsResult, type FlatTokenMap, getThemeStylesContent, toCssVarName, toCssVars, toFlatTokens };
|
|
207
|
+
export { type BundleCssVarsOptions, type BundleCssVarsResult, type CssVarsOptions, type CssVarsResult, type FlatTokenMap, PREFLIGHT_CSS, getPreflightStyles, getThemeStylesContent, toCssVarName, toCssVars, toFlatTokens };
|
package/dist/css.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { a as ThemeTokens, i as ThemeBundle } from "./Types-
|
|
2
|
+
import { a as ThemeTokens, i as ThemeBundle } from "./Types-8o6d09ll.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/roots/helpers.d.ts
|
|
5
5
|
/**
|
|
@@ -24,6 +24,26 @@ declare const toFlatTokens: (theme: ThemeTokens, options?: {
|
|
|
24
24
|
*/
|
|
25
25
|
type FlatTokenMap = Record<string, string | number>;
|
|
26
26
|
//#endregion
|
|
27
|
+
//#region src/roots/preflight.d.ts
|
|
28
|
+
/**
|
|
29
|
+
* The theme's base stylesheet as a raw CSS string — box-sizing reset, body
|
|
30
|
+
* typography/colour bound to semantic tokens, and the reduced-motion guard.
|
|
31
|
+
* Inject once at the app root. Requires the `--tt-*` custom properties to be
|
|
32
|
+
* present (via `getThemeStylesContent` / `<ThemeStyles>` / `<ThemeProvider>`).
|
|
33
|
+
*/
|
|
34
|
+
declare const PREFLIGHT_CSS = "*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\nhtml,\nbody {\n margin: 0;\n padding: 0;\n}\n\nbody {\n font-family: var(--tt-text-body-md-font-family, system-ui, sans-serif);\n font-size: var(--tt-text-body-md-font-size);\n line-height: var(--tt-text-body-md-line-height);\n color: var(--tt-colors-informational-primary-text-default);\n background-color: var(--tt-colors-informational-primary-background-default);\n -webkit-font-smoothing: antialiased;\n text-rendering: optimizeLegibility;\n}\n\n@media (prefers-reduced-motion: reduce) {\n *,\n *::before,\n *::after {\n animation-duration: 0.01ms !important;\n animation-iteration-count: 1 !important;\n transition-duration: 0.01ms !important;\n scroll-behavior: auto !important;\n }\n}";
|
|
35
|
+
/**
|
|
36
|
+
* Returns the theme's base stylesheet — see {@link PREFLIGHT_CSS}. A function
|
|
37
|
+
* for API symmetry with `getThemeStylesContent`; the value is static.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* import { getPreflightStyles } from '@ttoss/fsl-theme/css';
|
|
42
|
+
* res.type('text/css').send(getPreflightStyles());
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
declare const getPreflightStyles: () => string;
|
|
46
|
+
//#endregion
|
|
27
47
|
//#region src/roots/toCssVars.d.ts
|
|
28
48
|
/**
|
|
29
49
|
* Convert a full token path to a CSS custom property name.
|
|
@@ -184,4 +204,4 @@ declare const getThemeStylesContent: (bundle: ThemeBundle, themeId?: string, opt
|
|
|
184
204
|
systemModeFallback?: boolean;
|
|
185
205
|
}) => string;
|
|
186
206
|
//#endregion
|
|
187
|
-
export { type BundleCssVarsOptions, type BundleCssVarsResult, type CssVarsOptions, type CssVarsResult, type FlatTokenMap, getThemeStylesContent, toCssVarName, toCssVars, toFlatTokens };
|
|
207
|
+
export { type BundleCssVarsOptions, type BundleCssVarsResult, type CssVarsOptions, type CssVarsResult, type FlatTokenMap, PREFLIGHT_CSS, getPreflightStyles, getThemeStylesContent, toCssVarName, toCssVars, toFlatTokens };
|