@ttoss/fsl-theme 1.1.13 → 1.1.15

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.
Files changed (91) hide show
  1. package/dist/Types-BiBa17RL.d.cts +1427 -0
  2. package/dist/Types-BiBa17RL.d.mts +1427 -0
  3. package/dist/baseBundle-DxvXyhGa.mjs +17 -0
  4. package/dist/baseBundle-iEFf5nqT.cjs +22 -0
  5. package/dist/{esm/chunk-SE5Z52RE.js → createTheme-BLNYztZU.mjs} +76 -172
  6. package/dist/createTheme-Cv6RP9D6.cjs +1825 -0
  7. package/dist/css.cjs +48 -0
  8. package/dist/{css.d.ts → css.d.cts} +67 -63
  9. package/dist/css.d.mts +168 -0
  10. package/dist/css.mjs +42 -0
  11. package/dist/dataviz/index.cjs +45 -0
  12. package/dist/dataviz/{index.d.ts → index.d.cts} +9 -5
  13. package/dist/dataviz/index.d.mts +66 -0
  14. package/dist/dataviz/index.mjs +39 -0
  15. package/dist/dtcg.cjs +115 -0
  16. package/dist/{dtcg.d.ts → dtcg.d.cts} +9 -7
  17. package/dist/dtcg.d.mts +51 -0
  18. package/dist/dtcg.mjs +112 -0
  19. package/dist/helpers-4p4-QVt_.cjs +258 -0
  20. package/dist/helpers-CaswNJMy.mjs +211 -0
  21. package/dist/{index.d.ts → index-CsIjfw86.d.cts} +42 -34
  22. package/dist/index-nJrjI0BA.d.mts +94 -0
  23. package/dist/index.cjs +16 -0
  24. package/dist/index.d.cts +6 -0
  25. package/dist/index.d.mts +6 -0
  26. package/dist/index.mjs +7 -0
  27. package/dist/{react.d.ts → react-CGa6FlNL.d.cts} +130 -106
  28. package/dist/react-DnKxR2gK.d.mts +370 -0
  29. package/dist/react-EUwpdvY7.cjs +481 -0
  30. package/dist/react.cjs +12 -0
  31. package/dist/react.d.cts +4 -0
  32. package/dist/react.d.mts +4 -0
  33. package/dist/react.mjs +412 -0
  34. package/dist/runtime-entry.cjs +9 -0
  35. package/dist/runtime-entry.d.cts +3 -0
  36. package/dist/runtime-entry.d.mts +3 -0
  37. package/dist/runtime-entry.mjs +3 -0
  38. package/dist/{runtime-entry.d.ts → ssrScript-BVysxDws.d.cts} +26 -23
  39. package/dist/ssrScript-BVysxDws.d.mts +98 -0
  40. package/dist/ssrScript-CRfrN8Pm.cjs +202 -0
  41. package/dist/ssrScript-D3kGPQpi.mjs +179 -0
  42. package/dist/themes/bruttal.cjs +75 -0
  43. package/dist/themes/bruttal.d.cts +3 -0
  44. package/dist/themes/bruttal.d.mts +3 -0
  45. package/dist/themes/bruttal.mjs +72 -0
  46. package/dist/themes/corporate.cjs +34 -0
  47. package/dist/themes/corporate.d.cts +3 -0
  48. package/dist/themes/corporate.d.mts +3 -0
  49. package/dist/{esm/chunk-TPMN75JM.js → themes/corporate.mjs} +7 -5
  50. package/dist/themes/oca.cjs +34 -0
  51. package/dist/themes/oca.d.cts +3 -0
  52. package/dist/themes/oca.d.mts +3 -0
  53. package/dist/{esm/chunk-DU4QDQUC.js → themes/oca.mjs} +7 -5
  54. package/dist/themes/ventures.cjs +34 -0
  55. package/dist/themes/ventures.d.cts +3 -0
  56. package/dist/themes/ventures.d.mts +3 -0
  57. package/dist/{esm/chunk-BXKVVQEP.js → themes/ventures.mjs} +7 -5
  58. package/dist/toCssVars-CYZCe-on.mjs +286 -0
  59. package/dist/toCssVars-DudHKvt2.cjs +297 -0
  60. package/dist/{esm/chunk-4Q4P3JBB.js → tokenRegistry-DjgSN3oU.mjs} +23 -20
  61. package/dist/tokenRegistry-OhaJ9sPJ.cjs +199 -0
  62. package/dist/vars.cjs +127 -0
  63. package/dist/{vars.d.ts → vars.d.cts} +8 -7
  64. package/dist/vars.d.mts +128 -0
  65. package/dist/vars.mjs +123 -0
  66. package/dist/withDataviz-B4pVsOwV.cjs +192 -0
  67. package/dist/{esm/chunk-FBVUI2PK.js → withDataviz-DY5s7R51.mjs} +40 -12
  68. package/package.json +20 -20
  69. package/dist/Types-6tR0_2Ss.d.ts +0 -1452
  70. package/dist/esm/chunk-5PWPAQMC.js +0 -9
  71. package/dist/esm/chunk-HRNXVRS3.js +0 -54
  72. package/dist/esm/chunk-IJGA42O6.js +0 -141
  73. package/dist/esm/chunk-PQPQNZ73.js +0 -262
  74. package/dist/esm/chunk-UMRQ4OTX.js +0 -11
  75. package/dist/esm/chunk-VL6EGE6Z.js +0 -222
  76. package/dist/esm/chunk-WVQSTQD5.js +0 -192
  77. package/dist/esm/css.js +0 -6
  78. package/dist/esm/dataviz/index.js +0 -19
  79. package/dist/esm/dtcg.js +0 -65
  80. package/dist/esm/index.js +0 -10
  81. package/dist/esm/react.js +0 -8
  82. package/dist/esm/runtime-entry.js +0 -4
  83. package/dist/esm/themes/bruttal.js +0 -6
  84. package/dist/esm/themes/corporate.js +0 -6
  85. package/dist/esm/themes/oca.js +0 -6
  86. package/dist/esm/themes/ventures.js +0 -6
  87. package/dist/esm/vars.js +0 -28
  88. package/dist/themes/bruttal.d.ts +0 -5
  89. package/dist/themes/corporate.d.ts +0 -5
  90. package/dist/themes/oca.d.ts +0 -5
  91. package/dist/themes/ventures.d.ts +0 -5
package/dist/css.cjs ADDED
@@ -0,0 +1,48 @@
1
+ /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
+ Object.defineProperty(exports, Symbol.toStringTag, {
3
+ value: 'Module'
4
+ });
5
+ const require_helpers = require('./helpers-4p4-QVt_.cjs');
6
+ const require_toCssVars = require('./toCssVars-DudHKvt2.cjs');
7
+
8
+ //#region src/css.ts
9
+ /**
10
+ * Returns the full CSS string for a theme bundle — all `--tt-*` custom
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
+ const getThemeStylesContent = (bundle, themeId) => {
39
+ return require_toCssVars.toCssVars(bundle, {
40
+ themeId
41
+ }).toCssString();
42
+ };
43
+
44
+ //#endregion
45
+ exports.getThemeStylesContent = getThemeStylesContent;
46
+ exports.toCssVarName = require_toCssVars.toCssVarName;
47
+ exports.toCssVars = require_toCssVars.toCssVars;
48
+ exports.toFlatTokens = require_helpers.toFlatTokens;
@@ -1,5 +1,7 @@
1
- import { T as ThemeTokens, a as ThemeBundle } from './Types-6tR0_2Ss.js';
2
1
 
2
+ import { i as ThemeTokens, r as ThemeBundle } from "./Types-BiBa17RL.cjs";
3
+
4
+ //#region src/roots/helpers.d.ts
3
5
  /**
4
6
  * Flatten a `ThemeTokens` into a `Record<string, string | number>` with
5
7
  * every `{ref}` recursively resolved to its final raw value where possible.
@@ -12,7 +14,7 @@ import { T as ThemeTokens, a as ThemeBundle } from './Types-6tR0_2Ss.js';
12
14
  * This is the universal primitive — every root is derived from this.
13
15
  */
14
16
  declare const toFlatTokens: (theme: ThemeTokens, options?: {
15
- strict?: boolean;
17
+ strict?: boolean;
16
18
  }) => Record<string, string | number>;
17
19
  /**
18
20
  * A flat map of dot-path token keys to resolved raw values.
@@ -21,7 +23,8 @@ declare const toFlatTokens: (theme: ThemeTokens, options?: {
21
23
  * references are preserved as their original `{path}` string.
22
24
  */
23
25
  type FlatTokenMap = Record<string, string | number>;
24
-
26
+ //#endregion
27
+ //#region src/roots/toCssVars.d.ts
25
28
  /**
26
29
  * Convert a full token path to a CSS custom property name.
27
30
  *
@@ -33,78 +36,78 @@ declare const toCssVarName: (tokenPath: string) => string;
33
36
  * Options for `toCssVars()`.
34
37
  */
35
38
  interface CssVarsOptions {
36
- /**
37
- * Theme identifier for scoping. Generates `[data-tt-theme="<themeId>"]` selector.
38
- * When omitted, uses `:root`.
39
- */
40
- themeId?: string;
41
- /**
42
- * Mode for scoping. Adds `[data-tt-mode="<mode>"]` to the selector.
43
- * Only effective when `themeId` is also set.
44
- */
45
- mode?: 'light' | 'dark';
46
- /**
47
- * Custom CSS selector override. Takes precedence over `themeId`/`mode`.
48
- */
49
- selector?: string;
50
- /**
51
- * Sets the `color-scheme` CSS property in the generated block.
52
- * Helps native elements (inputs, scrollbars) respect the active mode.
53
- */
54
- colorScheme?: 'light' | 'dark' | 'light dark';
39
+ /**
40
+ * Theme identifier for scoping. Generates `[data-tt-theme="<themeId>"]` selector.
41
+ * When omitted, uses `:root`.
42
+ */
43
+ themeId?: string;
44
+ /**
45
+ * Mode for scoping. Adds `[data-tt-mode="<mode>"]` to the selector.
46
+ * Only effective when `themeId` is also set.
47
+ */
48
+ mode?: 'light' | 'dark';
49
+ /**
50
+ * Custom CSS selector override. Takes precedence over `themeId`/`mode`.
51
+ */
52
+ selector?: string;
53
+ /**
54
+ * Sets the `color-scheme` CSS property in the generated block.
55
+ * Helps native elements (inputs, scrollbars) respect the active mode.
56
+ */
57
+ colorScheme?: 'light' | 'dark' | 'light dark';
55
58
  }
56
59
  /**
57
60
  * Return type of `toCssVars()`.
58
61
  */
59
62
  interface CssVarsResult {
60
- /** Flat map of CSS custom property names → values (original, including CQ units). */
61
- cssVars: Record<string, string | number>;
62
- /**
63
- * Overrides for `hit.*` tokens when `any-pointer: coarse` is active.
64
- * Apply these inside `@media (any-pointer: coarse) { :root { ... } }`.
65
- * Emitted automatically by `toCssString()`.
66
- */
67
- coarseHitVars: Record<string, string>;
68
- /**
69
- * Overrides for semantic motion duration tokens under reduced-motion.
70
- * All durations are set to `var(--tt-core-motion-duration-none)` (0ms).
71
- * Apply these inside `@media (prefers-reduced-motion: reduce) { :root { ... } }`.
72
- * Emitted automatically by `toCssString()`.
73
- */
74
- reducedMotionVars: Record<string, string>;
75
- /**
76
- * CSS vars whose values contain container query units (cqi, cqb, etc.).
77
- * Emitted inside `@supports (width: 1cqi)` by `toCssString()`.
78
- * The base block uses viewport-safe fallbacks for these vars.
79
- */
80
- containerQueryVars: Record<string, string | number>;
81
- /** The CSS selector used for scoping. */
82
- selector: string;
83
- /** Generates a complete CSS block string. */
84
- toCssString: () => string;
63
+ /** Flat map of CSS custom property names → values (original, including CQ units). */
64
+ cssVars: Record<string, string | number>;
65
+ /**
66
+ * Overrides for `hit.*` tokens when `any-pointer: coarse` is active.
67
+ * Apply these inside `@media (any-pointer: coarse) { :root { ... } }`.
68
+ * Emitted automatically by `toCssString()`.
69
+ */
70
+ coarseHitVars: Record<string, string>;
71
+ /**
72
+ * Overrides for semantic motion duration tokens under reduced-motion.
73
+ * All durations are set to `var(--tt-core-motion-duration-none)` (0ms).
74
+ * Apply these inside `@media (prefers-reduced-motion: reduce) { :root { ... } }`.
75
+ * Emitted automatically by `toCssString()`.
76
+ */
77
+ reducedMotionVars: Record<string, string>;
78
+ /**
79
+ * CSS vars whose values contain container query units (cqi, cqb, etc.).
80
+ * Emitted inside `@supports (width: 1cqi)` by `toCssString()`.
81
+ * The base block uses viewport-safe fallbacks for these vars.
82
+ */
83
+ containerQueryVars: Record<string, string | number>;
84
+ /** The CSS selector used for scoping. */
85
+ selector: string;
86
+ /** Generates a complete CSS block string. */
87
+ toCssString: () => string;
85
88
  }
86
89
  /**
87
90
  * Options for `bundleToCssVars()`.
88
91
  */
89
92
  interface BundleCssVarsOptions {
90
- /**
91
- * Theme identifier for scoping. Generates `[data-tt-theme="<themeId>"]` selectors.
92
- * When omitted, CSS targets `:root` (canonical 1-theme model). The alternate mode
93
- * selector becomes `:root[data-tt-mode="dark"]`. Use `themeId` only for
94
- * multi-theme scenarios (Storybook, micro-frontends).
95
- */
96
- themeId?: string;
93
+ /**
94
+ * Theme identifier for scoping. Generates `[data-tt-theme="<themeId>"]` selectors.
95
+ * When omitted, CSS targets `:root` (canonical 1-theme model). The alternate mode
96
+ * selector becomes `:root[data-tt-mode="dark"]`. Use `themeId` only for
97
+ * multi-theme scenarios (Storybook, micro-frontends).
98
+ */
99
+ themeId?: string;
97
100
  }
98
101
  /**
99
102
  * Return type of `bundleToCssVars()`.
100
103
  */
101
104
  interface BundleCssVarsResult {
102
- /** CSS result for the base mode (all vars). */
103
- base: CssVarsResult;
104
- /** CSS result for the alternate mode (diff-only vars). Undefined if no alternate. */
105
- alternate?: CssVarsResult;
106
- /** Generates a complete CSS string with base + alternate + coarse blocks. */
107
- toCssString: () => string;
105
+ /** CSS result for the base mode (all vars). */
106
+ base: CssVarsResult;
107
+ /** CSS result for the alternate mode (diff-only vars). Undefined if no alternate. */
108
+ alternate?: CssVarsResult;
109
+ /** Generates a complete CSS string with base + alternate + coarse blocks. */
110
+ toCssString: () => string;
108
111
  }
109
112
  /**
110
113
  * Convert a theme (tokens or bundle) into CSS custom properties.
@@ -129,7 +132,8 @@ interface BundleCssVarsResult {
129
132
  */
130
133
  declare function toCssVars(theme: ThemeTokens, options?: CssVarsOptions): CssVarsResult;
131
134
  declare function toCssVars(bundle: ThemeBundle, options?: BundleCssVarsOptions): BundleCssVarsResult;
132
-
135
+ //#endregion
136
+ //#region src/css.d.ts
133
137
  /**
134
138
  * Returns the full CSS string for a theme bundle — all `--tt-*` custom
135
139
  * properties, coarse-pointer overrides, reduced-motion overrides, and
@@ -160,5 +164,5 @@ declare function toCssVars(bundle: ThemeBundle, options?: BundleCssVarsOptions):
160
164
  * ```
161
165
  */
162
166
  declare const getThemeStylesContent: (bundle: ThemeBundle, themeId?: string) => string;
163
-
164
- export { type BundleCssVarsOptions, type BundleCssVarsResult, type CssVarsOptions, type CssVarsResult, type FlatTokenMap, getThemeStylesContent, toCssVarName, toCssVars, toFlatTokens };
167
+ //#endregion
168
+ export { type BundleCssVarsOptions, type BundleCssVarsResult, type CssVarsOptions, type CssVarsResult, type FlatTokenMap, getThemeStylesContent, toCssVarName, toCssVars, toFlatTokens };
package/dist/css.d.mts ADDED
@@ -0,0 +1,168 @@
1
+
2
+ import { i as ThemeTokens, r as ThemeBundle } from "./Types-BiBa17RL.mjs";
3
+
4
+ //#region src/roots/helpers.d.ts
5
+ /**
6
+ * Flatten a `ThemeTokens` into a `Record<string, string | number>` with
7
+ * every `{ref}` recursively resolved to its final raw value where possible.
8
+ *
9
+ * By default, unresolvable references (missing target or circular dependency)
10
+ * are preserved as-is in the output. Pass `{ strict: true }` to instead throw
11
+ * on any unresolved reference — useful in tests and build steps that must
12
+ * fail loudly on palette drift.
13
+ *
14
+ * This is the universal primitive — every root is derived from this.
15
+ */
16
+ declare const toFlatTokens: (theme: ThemeTokens, options?: {
17
+ strict?: boolean;
18
+ }) => Record<string, string | number>;
19
+ /**
20
+ * A flat map of dot-path token keys to resolved raw values.
21
+ *
22
+ * Most `{ref}` values are recursively resolved. Unresolvable or circular
23
+ * references are preserved as their original `{path}` string.
24
+ */
25
+ type FlatTokenMap = Record<string, string | number>;
26
+ //#endregion
27
+ //#region src/roots/toCssVars.d.ts
28
+ /**
29
+ * Convert a full token path to a CSS custom property name.
30
+ *
31
+ * `core.colors.brand.500` → `--tt-core-colors-brand-500`
32
+ * `semantic.colors.action.primary.background.default` → `--tt-colors-action-primary-background-default`
33
+ */
34
+ declare const toCssVarName: (tokenPath: string) => string;
35
+ /**
36
+ * Options for `toCssVars()`.
37
+ */
38
+ interface CssVarsOptions {
39
+ /**
40
+ * Theme identifier for scoping. Generates `[data-tt-theme="<themeId>"]` selector.
41
+ * When omitted, uses `:root`.
42
+ */
43
+ themeId?: string;
44
+ /**
45
+ * Mode for scoping. Adds `[data-tt-mode="<mode>"]` to the selector.
46
+ * Only effective when `themeId` is also set.
47
+ */
48
+ mode?: 'light' | 'dark';
49
+ /**
50
+ * Custom CSS selector override. Takes precedence over `themeId`/`mode`.
51
+ */
52
+ selector?: string;
53
+ /**
54
+ * Sets the `color-scheme` CSS property in the generated block.
55
+ * Helps native elements (inputs, scrollbars) respect the active mode.
56
+ */
57
+ colorScheme?: 'light' | 'dark' | 'light dark';
58
+ }
59
+ /**
60
+ * Return type of `toCssVars()`.
61
+ */
62
+ interface CssVarsResult {
63
+ /** Flat map of CSS custom property names → values (original, including CQ units). */
64
+ cssVars: Record<string, string | number>;
65
+ /**
66
+ * Overrides for `hit.*` tokens when `any-pointer: coarse` is active.
67
+ * Apply these inside `@media (any-pointer: coarse) { :root { ... } }`.
68
+ * Emitted automatically by `toCssString()`.
69
+ */
70
+ coarseHitVars: Record<string, string>;
71
+ /**
72
+ * Overrides for semantic motion duration tokens under reduced-motion.
73
+ * All durations are set to `var(--tt-core-motion-duration-none)` (0ms).
74
+ * Apply these inside `@media (prefers-reduced-motion: reduce) { :root { ... } }`.
75
+ * Emitted automatically by `toCssString()`.
76
+ */
77
+ reducedMotionVars: Record<string, string>;
78
+ /**
79
+ * CSS vars whose values contain container query units (cqi, cqb, etc.).
80
+ * Emitted inside `@supports (width: 1cqi)` by `toCssString()`.
81
+ * The base block uses viewport-safe fallbacks for these vars.
82
+ */
83
+ containerQueryVars: Record<string, string | number>;
84
+ /** The CSS selector used for scoping. */
85
+ selector: string;
86
+ /** Generates a complete CSS block string. */
87
+ toCssString: () => string;
88
+ }
89
+ /**
90
+ * Options for `bundleToCssVars()`.
91
+ */
92
+ interface BundleCssVarsOptions {
93
+ /**
94
+ * Theme identifier for scoping. Generates `[data-tt-theme="<themeId>"]` selectors.
95
+ * When omitted, CSS targets `:root` (canonical 1-theme model). The alternate mode
96
+ * selector becomes `:root[data-tt-mode="dark"]`. Use `themeId` only for
97
+ * multi-theme scenarios (Storybook, micro-frontends).
98
+ */
99
+ themeId?: string;
100
+ }
101
+ /**
102
+ * Return type of `bundleToCssVars()`.
103
+ */
104
+ interface BundleCssVarsResult {
105
+ /** CSS result for the base mode (all vars). */
106
+ base: CssVarsResult;
107
+ /** CSS result for the alternate mode (diff-only vars). Undefined if no alternate. */
108
+ alternate?: CssVarsResult;
109
+ /** Generates a complete CSS string with base + alternate + coarse blocks. */
110
+ toCssString: () => string;
111
+ }
112
+ /**
113
+ * Convert a theme (tokens or bundle) into CSS custom properties.
114
+ *
115
+ * **Overload 1 — ThemeTokens**: returns a single `CssVarsResult`.
116
+ * **Overload 2 — ThemeBundle**: returns a `BundleCssVarsResult` with
117
+ * base + alternate blocks and optimized diff output.
118
+ *
119
+ * @example
120
+ * ```ts
121
+ * import { toCssVars } from '@ttoss/fsl-theme/css';
122
+ * import { createTheme } from '@ttoss/fsl-theme';
123
+ *
124
+ * const myBundle = createTheme();
125
+ *
126
+ * // Single theme tokens
127
+ * const css = toCssVars(myBundle.base).toCssString();
128
+ *
129
+ * // Full bundle (base + dark alternate)
130
+ * const bundleCss = toCssVars(myBundle, { themeId: 'default' }).toCssString();
131
+ * ```
132
+ */
133
+ declare function toCssVars(theme: ThemeTokens, options?: CssVarsOptions): CssVarsResult;
134
+ declare function toCssVars(bundle: ThemeBundle, options?: BundleCssVarsOptions): BundleCssVarsResult;
135
+ //#endregion
136
+ //#region src/css.d.ts
137
+ /**
138
+ * Returns the full CSS string for a theme bundle — all `--tt-*` custom
139
+ * properties, coarse-pointer overrides, reduced-motion overrides, and
140
+ * container query progressive enhancement — ready to inject into a
141
+ * `<style>` tag or serve as a static `.css` file.
142
+ *
143
+ * Symmetric counterpart to `getThemeScriptContent()` for CSS.
144
+ * Use `<ThemeStyles>` from `@ttoss/fsl-theme/react` for React apps.
145
+ *
146
+ * When `themeId` is omitted (canonical 1-theme model), CSS targets `:root` and
147
+ * the alternate mode selector becomes `:root[data-tt-mode="dark"]`. Pass
148
+ * `themeId` only for multi-theme scenarios (Storybook, micro-frontends).
149
+ *
150
+ * @example
151
+ * ```ts
152
+ * // Canonical: no themeId needed (CSS goes to :root)
153
+ * import { createTheme } from '@ttoss/fsl-theme';
154
+ * import { getThemeStylesContent } from '@ttoss/fsl-theme/css';
155
+ *
156
+ * const myBundle = createTheme();
157
+ *
158
+ * app.get('/theme.css', (_, res) => {
159
+ * res.type('text/css').send(getThemeStylesContent(myBundle));
160
+ * });
161
+ *
162
+ * // Multi-theme: explicit themeId for scoping
163
+ * res.type('text/css').send(getThemeStylesContent(myBundle, 'myTheme'));
164
+ * ```
165
+ */
166
+ declare const getThemeStylesContent: (bundle: ThemeBundle, themeId?: string) => string;
167
+ //#endregion
168
+ export { type BundleCssVarsOptions, type BundleCssVarsResult, type CssVarsOptions, type CssVarsResult, type FlatTokenMap, getThemeStylesContent, toCssVarName, toCssVars, toFlatTokens };
package/dist/css.mjs ADDED
@@ -0,0 +1,42 @@
1
+ /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
+ import { s as toFlatTokens } from "./helpers-CaswNJMy.mjs";
3
+ import { n as toCssVars, t as toCssVarName } from "./toCssVars-CYZCe-on.mjs";
4
+
5
+ //#region src/css.ts
6
+ /**
7
+ * Returns the full CSS string for a theme bundle — all `--tt-*` custom
8
+ * properties, coarse-pointer overrides, reduced-motion overrides, and
9
+ * container query progressive enhancement — ready to inject into a
10
+ * `<style>` tag or serve as a static `.css` file.
11
+ *
12
+ * Symmetric counterpart to `getThemeScriptContent()` for CSS.
13
+ * Use `<ThemeStyles>` from `@ttoss/fsl-theme/react` for React apps.
14
+ *
15
+ * When `themeId` is omitted (canonical 1-theme model), CSS targets `:root` and
16
+ * the alternate mode selector becomes `:root[data-tt-mode="dark"]`. Pass
17
+ * `themeId` only for multi-theme scenarios (Storybook, micro-frontends).
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * // Canonical: no themeId needed (CSS goes to :root)
22
+ * import { createTheme } from '@ttoss/fsl-theme';
23
+ * import { getThemeStylesContent } from '@ttoss/fsl-theme/css';
24
+ *
25
+ * const myBundle = createTheme();
26
+ *
27
+ * app.get('/theme.css', (_, res) => {
28
+ * res.type('text/css').send(getThemeStylesContent(myBundle));
29
+ * });
30
+ *
31
+ * // Multi-theme: explicit themeId for scoping
32
+ * res.type('text/css').send(getThemeStylesContent(myBundle, 'myTheme'));
33
+ * ```
34
+ */
35
+ const getThemeStylesContent = (bundle, themeId) => {
36
+ return toCssVars(bundle, {
37
+ themeId
38
+ }).toCssString();
39
+ };
40
+
41
+ //#endregion
42
+ export { getThemeStylesContent, toCssVarName, toCssVars, toFlatTokens };
@@ -0,0 +1,45 @@
1
+ /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
+ Object.defineProperty(exports, Symbol.toStringTag, {
3
+ value: 'Module'
4
+ });
5
+ const require_react = require('../react-EUwpdvY7.cjs');
6
+ const require_withDataviz = require('../withDataviz-B4pVsOwV.cjs');
7
+
8
+ //#region src/dataviz/useDatavizTokens.ts
9
+ /**
10
+ * Access the current theme's **dataviz semantic tokens**.
11
+ *
12
+ * Requires `<ThemeProvider theme={...}>` with a bundle whose theme includes
13
+ * the dataviz extension (`core.dataviz` + `semantic.dataviz`).
14
+ *
15
+ * Throws a descriptive error when the active theme has no dataviz extension,
16
+ * making misconfiguration immediately visible during development.
17
+ *
18
+ * @example
19
+ * ```tsx
20
+ * import { useDatavizTokens } from '@ttoss/fsl-theme/dataviz';
21
+ *
22
+ * const ChartLegend = ({ categories }: { categories: string[] }) => {
23
+ * const dataviz = useDatavizTokens();
24
+ * // Full type-safety, no optional chaining
25
+ * return categories.map((name, i) => (
26
+ * <span key={name} style={{ color: `var(--tt-dataviz-color-series-${i + 1})` }}>
27
+ * {name}
28
+ * </span>
29
+ * ));
30
+ * };
31
+ * ```
32
+ *
33
+ * @see {@link useTokens} — access full semantic tokens (dataviz will be on `tokens.dataviz?`)
34
+ */
35
+ const useDatavizTokens = () => {
36
+ const tokens = require_react.useTokens();
37
+ if (!tokens.dataviz) throw new Error("useDatavizTokens: the active theme does not include the dataviz extension.\nWrap your bundle with withDataviz before passing it to ThemeProvider:\n\n import { withDataviz } from \"@ttoss/fsl-theme/dataviz\";\n export const myTheme = withDataviz(createTheme({ ... }));");
38
+ return tokens.dataviz;
39
+ };
40
+
41
+ //#endregion
42
+ exports.coreDataviz = require_withDataviz.coreDataviz;
43
+ exports.semanticDataviz = require_withDataviz.semanticDataviz;
44
+ exports.useDatavizTokens = useDatavizTokens;
45
+ exports.withDataviz = require_withDataviz.withDataviz;
@@ -1,5 +1,7 @@
1
- import { C as CoreDataviz, b as SemanticDataviz, a as ThemeBundle } from '../Types-6tR0_2Ss.js';
2
1
 
2
+ import { o as CoreDataviz, r as ThemeBundle, s as SemanticDataviz } from "../Types-BiBa17RL.cjs";
3
+
4
+ //#region src/dataviz/baseTheme.d.ts
3
5
  /**
4
6
  * **Default** dataviz encoding primitives — non-color, value-only.
5
7
  *
@@ -7,7 +9,8 @@ import { C as CoreDataviz, b as SemanticDataviz, a as ThemeBundle } from '../Typ
7
9
  */
8
10
  declare const coreDataviz: CoreDataviz;
9
11
  declare const semanticDataviz: SemanticDataviz;
10
-
12
+ //#endregion
13
+ //#region src/dataviz/useDatavizTokens.d.ts
11
14
  /**
12
15
  * Access the current theme's **dataviz semantic tokens**.
13
16
  *
@@ -35,7 +38,8 @@ declare const semanticDataviz: SemanticDataviz;
35
38
  * @see {@link useTokens} — access full semantic tokens (dataviz will be on `tokens.dataviz?`)
36
39
  */
37
40
  declare const useDatavizTokens: () => SemanticDataviz;
38
-
41
+ //#endregion
42
+ //#region src/dataviz/withDataviz.d.ts
39
43
  /**
40
44
  * Extend a `ThemeBundle` with the dataviz token layer.
41
45
  *
@@ -58,5 +62,5 @@ declare const useDatavizTokens: () => SemanticDataviz;
58
62
  * ```
59
63
  */
60
64
  declare const withDataviz: (bundle: ThemeBundle) => ThemeBundle;
61
-
62
- export { CoreDataviz, SemanticDataviz, coreDataviz, semanticDataviz, useDatavizTokens, withDataviz };
65
+ //#endregion
66
+ export { type CoreDataviz, type SemanticDataviz, coreDataviz, semanticDataviz, useDatavizTokens, withDataviz };
@@ -0,0 +1,66 @@
1
+
2
+ import { o as CoreDataviz, r as ThemeBundle, s as SemanticDataviz } from "../Types-BiBa17RL.mjs";
3
+
4
+ //#region src/dataviz/baseTheme.d.ts
5
+ /**
6
+ * **Default** dataviz encoding primitives — non-color, value-only.
7
+ *
8
+ * Analytical color comes from `core.colors.*` — see `semanticDataviz` below.
9
+ */
10
+ declare const coreDataviz: CoreDataviz;
11
+ declare const semanticDataviz: SemanticDataviz;
12
+ //#endregion
13
+ //#region src/dataviz/useDatavizTokens.d.ts
14
+ /**
15
+ * Access the current theme's **dataviz semantic tokens**.
16
+ *
17
+ * Requires `<ThemeProvider theme={...}>` with a bundle whose theme includes
18
+ * the dataviz extension (`core.dataviz` + `semantic.dataviz`).
19
+ *
20
+ * Throws a descriptive error when the active theme has no dataviz extension,
21
+ * making misconfiguration immediately visible during development.
22
+ *
23
+ * @example
24
+ * ```tsx
25
+ * import { useDatavizTokens } from '@ttoss/fsl-theme/dataviz';
26
+ *
27
+ * const ChartLegend = ({ categories }: { categories: string[] }) => {
28
+ * const dataviz = useDatavizTokens();
29
+ * // Full type-safety, no optional chaining
30
+ * return categories.map((name, i) => (
31
+ * <span key={name} style={{ color: `var(--tt-dataviz-color-series-${i + 1})` }}>
32
+ * {name}
33
+ * </span>
34
+ * ));
35
+ * };
36
+ * ```
37
+ *
38
+ * @see {@link useTokens} — access full semantic tokens (dataviz will be on `tokens.dataviz?`)
39
+ */
40
+ declare const useDatavizTokens: () => SemanticDataviz;
41
+ //#endregion
42
+ //#region src/dataviz/withDataviz.d.ts
43
+ /**
44
+ * Extend a `ThemeBundle` with the dataviz token layer.
45
+ *
46
+ * Applies `core.dataviz` (encoding primitives) and `semantic.dataviz` on top
47
+ * of the bundle's base theme. Semantic color mappings reference `core.colors.*`
48
+ * from the base theme, so brand-aligned dataviz palettes are automatic.
49
+ * The dark-mode alternate (if any) is preserved as-is.
50
+ *
51
+ * @param bundle - Bundle to extend (return value of `createTheme`).
52
+ * @returns A new `ThemeBundle` with dataviz tokens included.
53
+ *
54
+ * @example
55
+ * ```ts
56
+ * import { createTheme } from '@ttoss/fsl-theme';
57
+ * import { withDataviz } from '@ttoss/fsl-theme/dataviz';
58
+ *
59
+ * export const myTheme = withDataviz(createTheme({
60
+ * overrides: { core: { colors: { brand: { 500: '#FF0000' } } } },
61
+ * }));
62
+ * ```
63
+ */
64
+ declare const withDataviz: (bundle: ThemeBundle) => ThemeBundle;
65
+ //#endregion
66
+ export { type CoreDataviz, type SemanticDataviz, coreDataviz, semanticDataviz, useDatavizTokens, withDataviz };
@@ -0,0 +1,39 @@
1
+ /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
+ import { n as coreDataviz, r as semanticDataviz, t as withDataviz } from "../withDataviz-DY5s7R51.mjs";
3
+ import { useTokens } from "../react.mjs";
4
+
5
+ //#region src/dataviz/useDatavizTokens.ts
6
+ /**
7
+ * Access the current theme's **dataviz semantic tokens**.
8
+ *
9
+ * Requires `<ThemeProvider theme={...}>` with a bundle whose theme includes
10
+ * the dataviz extension (`core.dataviz` + `semantic.dataviz`).
11
+ *
12
+ * Throws a descriptive error when the active theme has no dataviz extension,
13
+ * making misconfiguration immediately visible during development.
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ * import { useDatavizTokens } from '@ttoss/fsl-theme/dataviz';
18
+ *
19
+ * const ChartLegend = ({ categories }: { categories: string[] }) => {
20
+ * const dataviz = useDatavizTokens();
21
+ * // Full type-safety, no optional chaining
22
+ * return categories.map((name, i) => (
23
+ * <span key={name} style={{ color: `var(--tt-dataviz-color-series-${i + 1})` }}>
24
+ * {name}
25
+ * </span>
26
+ * ));
27
+ * };
28
+ * ```
29
+ *
30
+ * @see {@link useTokens} — access full semantic tokens (dataviz will be on `tokens.dataviz?`)
31
+ */
32
+ const useDatavizTokens = () => {
33
+ const tokens = useTokens();
34
+ if (!tokens.dataviz) throw new Error("useDatavizTokens: the active theme does not include the dataviz extension.\nWrap your bundle with withDataviz before passing it to ThemeProvider:\n\n import { withDataviz } from \"@ttoss/fsl-theme/dataviz\";\n export const myTheme = withDataviz(createTheme({ ... }));");
35
+ return tokens.dataviz;
36
+ };
37
+
38
+ //#endregion
39
+ export { coreDataviz, semanticDataviz, useDatavizTokens, withDataviz };