@ttoss/fsl-theme 2.1.2 → 2.1.4
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/README.md +4 -2
- package/dist/{baseBundle-C6RP-2Qb.mjs → baseBundle-BpCf8Cc9.mjs} +1 -1
- package/dist/{baseBundle-C6yVk4x0.cjs → baseBundle-DaO6jyk3.cjs} +1 -1
- package/dist/{createTheme-gTjIryKH.mjs → createTheme-C05ONnLw.mjs} +92 -77
- package/dist/{createTheme-BzlJdFAG.cjs → createTheme-r7mUCPFX.cjs} +92 -77
- package/dist/dataviz/index.cjs +30 -1
- package/dist/dataviz/index.d.cts +22 -1
- package/dist/dataviz/index.d.mts +22 -1
- package/dist/dataviz/index.mjs +30 -2
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/themes/bruttal.cjs +2 -2
- package/dist/themes/bruttal.mjs +2 -2
- package/dist/toVars-BDBDTI_F.mjs +39 -0
- package/dist/toVars-BTDr1haK.d.mts +46 -0
- package/dist/toVars-BcSZEbMb.d.cts +46 -0
- package/dist/toVars-O-E9ryvq.cjs +44 -0
- package/dist/vars.cjs +6 -40
- package/dist/vars.d.cts +4 -44
- package/dist/vars.d.mts +4 -44
- package/dist/vars.mjs +4 -38
- package/dist/{withDataviz-B3mEhBPh.mjs → withDataviz-BKqs0un0.mjs} +1 -1
- package/dist/{withDataviz-B-XQ1MDT.cjs → withDataviz-BzDgnXPu.cjs} +1 -1
- package/llms.txt +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
|
|
2
|
+
import { a as ThemeTokens } from "./Types-8o6d09ll.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/roots/toVars.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Transforms a token-tree type into an identical structure where every leaf
|
|
7
|
+
* value becomes `string` (a CSS `var(--tt-*)` reference).
|
|
8
|
+
*
|
|
9
|
+
* Keys starting with `$` (e.g. `$deprecated`) are excluded — they are
|
|
10
|
+
* metadata, not consumable tokens.
|
|
11
|
+
*
|
|
12
|
+
* Optional keys in the source type remain optional in the mapped type, so
|
|
13
|
+
* theme extensions such as `dataviz?` are typed as `CssVarsMap<...> | undefined`
|
|
14
|
+
* and TypeScript will require callers to guard against `undefined` before
|
|
15
|
+
* accessing their members.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* type Colors = { action: { primary: { background: { default: TokenRef } } } };
|
|
20
|
+
* type ColorVars = CssVarsMap<Colors>;
|
|
21
|
+
* // → { action: { primary: { background: { default: string } } } }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
type CssVarsMap<T> = { [K in keyof T as K extends `$${string}` ? never : K]: NonNullable<T[K]> extends string | number ? string : undefined extends T[K] ? CssVarsMap<NonNullable<T[K]>> | undefined : CssVarsMap<NonNullable<T[K]>> };
|
|
25
|
+
/**
|
|
26
|
+
* Build a deeply-nested CSS var-reference map from a theme's semantic layer.
|
|
27
|
+
*
|
|
28
|
+
* Walks `theme.semantic` recursively and replaces every leaf value with the
|
|
29
|
+
* corresponding `var(--tt-*)` CSS custom property reference. The resulting
|
|
30
|
+
* object has the exact same shape as `theme.semantic` but with `string` leaves.
|
|
31
|
+
*
|
|
32
|
+
* Keys starting with `$` are skipped (deprecation metadata).
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* import { buildVarsMap } from './roots/toVars';
|
|
37
|
+
* import { baseTheme } from './baseTheme';
|
|
38
|
+
*
|
|
39
|
+
* const vars = buildVarsMap(baseTheme);
|
|
40
|
+
* vars.colors.action.primary.background.default
|
|
41
|
+
* // → 'var(--tt-colors-action-primary-background-default)'
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
declare const buildVarsMap: (theme: ThemeTokens) => CssVarsMap<ThemeTokens["semantic"]>;
|
|
45
|
+
//#endregion
|
|
46
|
+
export { buildVarsMap as n, CssVarsMap as t };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
|
|
2
|
+
import { a as ThemeTokens } from "./Types-8o6d09ll.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/roots/toVars.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Transforms a token-tree type into an identical structure where every leaf
|
|
7
|
+
* value becomes `string` (a CSS `var(--tt-*)` reference).
|
|
8
|
+
*
|
|
9
|
+
* Keys starting with `$` (e.g. `$deprecated`) are excluded — they are
|
|
10
|
+
* metadata, not consumable tokens.
|
|
11
|
+
*
|
|
12
|
+
* Optional keys in the source type remain optional in the mapped type, so
|
|
13
|
+
* theme extensions such as `dataviz?` are typed as `CssVarsMap<...> | undefined`
|
|
14
|
+
* and TypeScript will require callers to guard against `undefined` before
|
|
15
|
+
* accessing their members.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* type Colors = { action: { primary: { background: { default: TokenRef } } } };
|
|
20
|
+
* type ColorVars = CssVarsMap<Colors>;
|
|
21
|
+
* // → { action: { primary: { background: { default: string } } } }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
type CssVarsMap<T> = { [K in keyof T as K extends `$${string}` ? never : K]: NonNullable<T[K]> extends string | number ? string : undefined extends T[K] ? CssVarsMap<NonNullable<T[K]>> | undefined : CssVarsMap<NonNullable<T[K]>> };
|
|
25
|
+
/**
|
|
26
|
+
* Build a deeply-nested CSS var-reference map from a theme's semantic layer.
|
|
27
|
+
*
|
|
28
|
+
* Walks `theme.semantic` recursively and replaces every leaf value with the
|
|
29
|
+
* corresponding `var(--tt-*)` CSS custom property reference. The resulting
|
|
30
|
+
* object has the exact same shape as `theme.semantic` but with `string` leaves.
|
|
31
|
+
*
|
|
32
|
+
* Keys starting with `$` are skipped (deprecation metadata).
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* import { buildVarsMap } from './roots/toVars';
|
|
37
|
+
* import { baseTheme } from './baseTheme';
|
|
38
|
+
*
|
|
39
|
+
* const vars = buildVarsMap(baseTheme);
|
|
40
|
+
* vars.colors.action.primary.background.default
|
|
41
|
+
* // → 'var(--tt-colors-action-primary-background-default)'
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
declare const buildVarsMap: (theme: ThemeTokens) => CssVarsMap<ThemeTokens["semantic"]>;
|
|
45
|
+
//#endregion
|
|
46
|
+
export { buildVarsMap as n, CssVarsMap as t };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
+
const require_helpers = require('./helpers-BU40JvFA.cjs');
|
|
3
|
+
const require_toCssVars = require('./toCssVars-NGi4K2Oc.cjs');
|
|
4
|
+
|
|
5
|
+
//#region src/roots/toVars.ts
|
|
6
|
+
/**
|
|
7
|
+
* Build a deeply-nested CSS var-reference map from a theme's semantic layer.
|
|
8
|
+
*
|
|
9
|
+
* Walks `theme.semantic` recursively and replaces every leaf value with the
|
|
10
|
+
* corresponding `var(--tt-*)` CSS custom property reference. The resulting
|
|
11
|
+
* object has the exact same shape as `theme.semantic` but with `string` leaves.
|
|
12
|
+
*
|
|
13
|
+
* Keys starting with `$` are skipped (deprecation metadata).
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* import { buildVarsMap } from './roots/toVars';
|
|
18
|
+
* import { baseTheme } from './baseTheme';
|
|
19
|
+
*
|
|
20
|
+
* const vars = buildVarsMap(baseTheme);
|
|
21
|
+
* vars.colors.action.primary.background.default
|
|
22
|
+
* // → 'var(--tt-colors-action-primary-background-default)'
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
var buildVarsMap = theme => {
|
|
26
|
+
const walk = (obj, prefix) => {
|
|
27
|
+
const result = {};
|
|
28
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
29
|
+
if (key.startsWith("$")) continue;
|
|
30
|
+
const fullPath = `${prefix}.${key}`;
|
|
31
|
+
if (require_helpers.isPlainObject(value)) result[key] = walk(value, fullPath);else if (typeof value === "string" || typeof value === "number") result[key] = `var(${require_toCssVars.toCssVarName(fullPath)})`;
|
|
32
|
+
}
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
return walk(theme.semantic, "semantic");
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
Object.defineProperty(exports, 'buildVarsMap', {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: function () {
|
|
42
|
+
return buildVarsMap;
|
|
43
|
+
}
|
|
44
|
+
});
|
package/dist/vars.cjs
CHANGED
|
@@ -2,44 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, {
|
|
3
3
|
value: 'Module'
|
|
4
4
|
});
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const require_toCssVars = require('./toCssVars-NGi4K2Oc.cjs');
|
|
5
|
+
const require_baseBundle = require('./baseBundle-DaO6jyk3.cjs');
|
|
6
|
+
const require_toVars = require('./toVars-O-E9ryvq.cjs');
|
|
8
7
|
|
|
9
|
-
//#region src/roots/toVars.ts
|
|
10
|
-
/**
|
|
11
|
-
* Build a deeply-nested CSS var-reference map from a theme's semantic layer.
|
|
12
|
-
*
|
|
13
|
-
* Walks `theme.semantic` recursively and replaces every leaf value with the
|
|
14
|
-
* corresponding `var(--tt-*)` CSS custom property reference. The resulting
|
|
15
|
-
* object has the exact same shape as `theme.semantic` but with `string` leaves.
|
|
16
|
-
*
|
|
17
|
-
* Keys starting with `$` are skipped (deprecation metadata).
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```ts
|
|
21
|
-
* import { buildVarsMap } from './roots/toVars';
|
|
22
|
-
* import { baseTheme } from './baseTheme';
|
|
23
|
-
*
|
|
24
|
-
* const vars = buildVarsMap(baseTheme);
|
|
25
|
-
* vars.colors.action.primary.background.default
|
|
26
|
-
* // → 'var(--tt-colors-action-primary-background-default)'
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
var buildVarsMap = theme => {
|
|
30
|
-
const walk = (obj, prefix) => {
|
|
31
|
-
const result = {};
|
|
32
|
-
for (const [key, value] of Object.entries(obj)) {
|
|
33
|
-
if (key.startsWith("$")) continue;
|
|
34
|
-
const fullPath = `${prefix}.${key}`;
|
|
35
|
-
if (require_helpers.isPlainObject(value)) result[key] = walk(value, fullPath);else if (typeof value === "string" || typeof value === "number") result[key] = `var(${require_toCssVars.toCssVarName(fullPath)})`;
|
|
36
|
-
}
|
|
37
|
-
return result;
|
|
38
|
-
};
|
|
39
|
-
return walk(theme.semantic, "semantic");
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
//#endregion
|
|
43
8
|
//#region src/vars.ts
|
|
44
9
|
/**
|
|
45
10
|
* Static map of all semantic tokens as typed CSS `var(--tt-*)` references.
|
|
@@ -84,7 +49,8 @@ var buildVarsMap = theme => {
|
|
|
84
49
|
* `vars` reflects the semantic token shape of the **default theme**. If your
|
|
85
50
|
* project extends `SemanticTokens` with custom token families (e.g. a
|
|
86
51
|
* `dataviz` palette, project-specific component tokens), those extra leaves
|
|
87
|
-
* won't appear on this export.
|
|
52
|
+
* won't appear on this export. The first-party dataviz extension ships its
|
|
53
|
+
* own mirror — `datavizVars` from `@ttoss/fsl-theme/dataviz`.
|
|
88
54
|
*
|
|
89
55
|
* ### Typed extension recipe
|
|
90
56
|
*
|
|
@@ -120,8 +86,8 @@ var buildVarsMap = theme => {
|
|
|
120
86
|
* @see {@link toCssVarName} — for raw CSS property names (without `var()`)
|
|
121
87
|
* @see {@link useResolvedTokens} — for resolved raw values in non-CSS environments (React Native, canvas, PDF)
|
|
122
88
|
*/
|
|
123
|
-
var vars = buildVarsMap(require_baseBundle.baseBundle.base);
|
|
89
|
+
var vars = require_toVars.buildVarsMap(require_baseBundle.baseBundle.base);
|
|
124
90
|
|
|
125
91
|
//#endregion
|
|
126
|
-
exports.buildVarsMap = buildVarsMap;
|
|
92
|
+
exports.buildVarsMap = require_toVars.buildVarsMap;
|
|
127
93
|
exports.vars = vars;
|
package/dist/vars.d.cts
CHANGED
|
@@ -1,48 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { n as SemanticTokens } from "./Types-8o6d09ll.cjs";
|
|
3
|
+
import { n as buildVarsMap, t as CssVarsMap } from "./toVars-BcSZEbMb.cjs";
|
|
3
4
|
|
|
4
|
-
//#region src/roots/toVars.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Transforms a token-tree type into an identical structure where every leaf
|
|
7
|
-
* value becomes `string` (a CSS `var(--tt-*)` reference).
|
|
8
|
-
*
|
|
9
|
-
* Keys starting with `$` (e.g. `$deprecated`) are excluded — they are
|
|
10
|
-
* metadata, not consumable tokens.
|
|
11
|
-
*
|
|
12
|
-
* Optional keys in the source type remain optional in the mapped type, so
|
|
13
|
-
* theme extensions such as `dataviz?` are typed as `CssVarsMap<...> | undefined`
|
|
14
|
-
* and TypeScript will require callers to guard against `undefined` before
|
|
15
|
-
* accessing their members.
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```ts
|
|
19
|
-
* type Colors = { action: { primary: { background: { default: TokenRef } } } };
|
|
20
|
-
* type ColorVars = CssVarsMap<Colors>;
|
|
21
|
-
* // → { action: { primary: { background: { default: string } } } }
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
type CssVarsMap<T> = { [K in keyof T as K extends `$${string}` ? never : K]: NonNullable<T[K]> extends string | number ? string : undefined extends T[K] ? CssVarsMap<NonNullable<T[K]>> | undefined : CssVarsMap<NonNullable<T[K]>> };
|
|
25
|
-
/**
|
|
26
|
-
* Build a deeply-nested CSS var-reference map from a theme's semantic layer.
|
|
27
|
-
*
|
|
28
|
-
* Walks `theme.semantic` recursively and replaces every leaf value with the
|
|
29
|
-
* corresponding `var(--tt-*)` CSS custom property reference. The resulting
|
|
30
|
-
* object has the exact same shape as `theme.semantic` but with `string` leaves.
|
|
31
|
-
*
|
|
32
|
-
* Keys starting with `$` are skipped (deprecation metadata).
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* ```ts
|
|
36
|
-
* import { buildVarsMap } from './roots/toVars';
|
|
37
|
-
* import { baseTheme } from './baseTheme';
|
|
38
|
-
*
|
|
39
|
-
* const vars = buildVarsMap(baseTheme);
|
|
40
|
-
* vars.colors.action.primary.background.default
|
|
41
|
-
* // → 'var(--tt-colors-action-primary-background-default)'
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
declare const buildVarsMap: (theme: ThemeTokens) => CssVarsMap<ThemeTokens["semantic"]>;
|
|
45
|
-
//#endregion
|
|
46
5
|
//#region src/vars.d.ts
|
|
47
6
|
/**
|
|
48
7
|
* Static map of all semantic tokens as typed CSS `var(--tt-*)` references.
|
|
@@ -87,7 +46,8 @@ declare const buildVarsMap: (theme: ThemeTokens) => CssVarsMap<ThemeTokens["sema
|
|
|
87
46
|
* `vars` reflects the semantic token shape of the **default theme**. If your
|
|
88
47
|
* project extends `SemanticTokens` with custom token families (e.g. a
|
|
89
48
|
* `dataviz` palette, project-specific component tokens), those extra leaves
|
|
90
|
-
* won't appear on this export.
|
|
49
|
+
* won't appear on this export. The first-party dataviz extension ships its
|
|
50
|
+
* own mirror — `datavizVars` from `@ttoss/fsl-theme/dataviz`.
|
|
91
51
|
*
|
|
92
52
|
* ### Typed extension recipe
|
|
93
53
|
*
|
package/dist/vars.d.mts
CHANGED
|
@@ -1,48 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { n as SemanticTokens } from "./Types-8o6d09ll.mjs";
|
|
3
|
+
import { n as buildVarsMap, t as CssVarsMap } from "./toVars-BTDr1haK.mjs";
|
|
3
4
|
|
|
4
|
-
//#region src/roots/toVars.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Transforms a token-tree type into an identical structure where every leaf
|
|
7
|
-
* value becomes `string` (a CSS `var(--tt-*)` reference).
|
|
8
|
-
*
|
|
9
|
-
* Keys starting with `$` (e.g. `$deprecated`) are excluded — they are
|
|
10
|
-
* metadata, not consumable tokens.
|
|
11
|
-
*
|
|
12
|
-
* Optional keys in the source type remain optional in the mapped type, so
|
|
13
|
-
* theme extensions such as `dataviz?` are typed as `CssVarsMap<...> | undefined`
|
|
14
|
-
* and TypeScript will require callers to guard against `undefined` before
|
|
15
|
-
* accessing their members.
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```ts
|
|
19
|
-
* type Colors = { action: { primary: { background: { default: TokenRef } } } };
|
|
20
|
-
* type ColorVars = CssVarsMap<Colors>;
|
|
21
|
-
* // → { action: { primary: { background: { default: string } } } }
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
type CssVarsMap<T> = { [K in keyof T as K extends `$${string}` ? never : K]: NonNullable<T[K]> extends string | number ? string : undefined extends T[K] ? CssVarsMap<NonNullable<T[K]>> | undefined : CssVarsMap<NonNullable<T[K]>> };
|
|
25
|
-
/**
|
|
26
|
-
* Build a deeply-nested CSS var-reference map from a theme's semantic layer.
|
|
27
|
-
*
|
|
28
|
-
* Walks `theme.semantic` recursively and replaces every leaf value with the
|
|
29
|
-
* corresponding `var(--tt-*)` CSS custom property reference. The resulting
|
|
30
|
-
* object has the exact same shape as `theme.semantic` but with `string` leaves.
|
|
31
|
-
*
|
|
32
|
-
* Keys starting with `$` are skipped (deprecation metadata).
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* ```ts
|
|
36
|
-
* import { buildVarsMap } from './roots/toVars';
|
|
37
|
-
* import { baseTheme } from './baseTheme';
|
|
38
|
-
*
|
|
39
|
-
* const vars = buildVarsMap(baseTheme);
|
|
40
|
-
* vars.colors.action.primary.background.default
|
|
41
|
-
* // → 'var(--tt-colors-action-primary-background-default)'
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
declare const buildVarsMap: (theme: ThemeTokens) => CssVarsMap<ThemeTokens["semantic"]>;
|
|
45
|
-
//#endregion
|
|
46
5
|
//#region src/vars.d.ts
|
|
47
6
|
/**
|
|
48
7
|
* Static map of all semantic tokens as typed CSS `var(--tt-*)` references.
|
|
@@ -87,7 +46,8 @@ declare const buildVarsMap: (theme: ThemeTokens) => CssVarsMap<ThemeTokens["sema
|
|
|
87
46
|
* `vars` reflects the semantic token shape of the **default theme**. If your
|
|
88
47
|
* project extends `SemanticTokens` with custom token families (e.g. a
|
|
89
48
|
* `dataviz` palette, project-specific component tokens), those extra leaves
|
|
90
|
-
* won't appear on this export.
|
|
49
|
+
* won't appear on this export. The first-party dataviz extension ships its
|
|
50
|
+
* own mirror — `datavizVars` from `@ttoss/fsl-theme/dataviz`.
|
|
91
51
|
*
|
|
92
52
|
* ### Typed extension recipe
|
|
93
53
|
*
|
package/dist/vars.mjs
CHANGED
|
@@ -1,42 +1,7 @@
|
|
|
1
1
|
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
-
import {
|
|
3
|
-
import { t as
|
|
4
|
-
import { t as toCssVarName } from "./toCssVars-CTGqZ_t3.mjs";
|
|
2
|
+
import { t as baseBundle } from "./baseBundle-BpCf8Cc9.mjs";
|
|
3
|
+
import { t as buildVarsMap } from "./toVars-BDBDTI_F.mjs";
|
|
5
4
|
|
|
6
|
-
//#region src/roots/toVars.ts
|
|
7
|
-
/**
|
|
8
|
-
* Build a deeply-nested CSS var-reference map from a theme's semantic layer.
|
|
9
|
-
*
|
|
10
|
-
* Walks `theme.semantic` recursively and replaces every leaf value with the
|
|
11
|
-
* corresponding `var(--tt-*)` CSS custom property reference. The resulting
|
|
12
|
-
* object has the exact same shape as `theme.semantic` but with `string` leaves.
|
|
13
|
-
*
|
|
14
|
-
* Keys starting with `$` are skipped (deprecation metadata).
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```ts
|
|
18
|
-
* import { buildVarsMap } from './roots/toVars';
|
|
19
|
-
* import { baseTheme } from './baseTheme';
|
|
20
|
-
*
|
|
21
|
-
* const vars = buildVarsMap(baseTheme);
|
|
22
|
-
* vars.colors.action.primary.background.default
|
|
23
|
-
* // → 'var(--tt-colors-action-primary-background-default)'
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
var buildVarsMap = theme => {
|
|
27
|
-
const walk = (obj, prefix) => {
|
|
28
|
-
const result = {};
|
|
29
|
-
for (const [key, value] of Object.entries(obj)) {
|
|
30
|
-
if (key.startsWith("$")) continue;
|
|
31
|
-
const fullPath = `${prefix}.${key}`;
|
|
32
|
-
if (isPlainObject(value)) result[key] = walk(value, fullPath);else if (typeof value === "string" || typeof value === "number") result[key] = `var(${toCssVarName(fullPath)})`;
|
|
33
|
-
}
|
|
34
|
-
return result;
|
|
35
|
-
};
|
|
36
|
-
return walk(theme.semantic, "semantic");
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
//#endregion
|
|
40
5
|
//#region src/vars.ts
|
|
41
6
|
/**
|
|
42
7
|
* Static map of all semantic tokens as typed CSS `var(--tt-*)` references.
|
|
@@ -81,7 +46,8 @@ var buildVarsMap = theme => {
|
|
|
81
46
|
* `vars` reflects the semantic token shape of the **default theme**. If your
|
|
82
47
|
* project extends `SemanticTokens` with custom token families (e.g. a
|
|
83
48
|
* `dataviz` palette, project-specific component tokens), those extra leaves
|
|
84
|
-
* won't appear on this export.
|
|
49
|
+
* won't appear on this export. The first-party dataviz extension ships its
|
|
50
|
+
* own mirror — `datavizVars` from `@ttoss/fsl-theme/dataviz`.
|
|
85
51
|
*
|
|
86
52
|
* ### Typed extension recipe
|
|
87
53
|
*
|
package/llms.txt
CHANGED
|
@@ -323,7 +323,7 @@ Never both. Never neither.
|
|
|
323
323
|
|
|
324
324
|
**§8 — Optional families have fallback rules:**
|
|
325
325
|
- `elevation.tonal` absent → fall back to `elevation.surface` alone.
|
|
326
|
-
- `dataviz` absent → the consumer's app does not opt in to dataviz; do not generate dataviz components.
|
|
326
|
+
- `dataviz` absent → the consumer's app does not opt in to dataviz; do not generate dataviz components. When present, reference its tokens via `datavizVars` from `@ttoss/fsl-theme/dataviz` (typed `var(--tt-dataviz-*)` mirror).
|
|
327
327
|
- Optional state (e.g. `hover`) absent on a leaf → fall back to `default`.
|
|
328
328
|
|
|
329
329
|
## Disambiguation — confusable picks
|