@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.
@@ -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 require_helpers = require('./helpers-BU40JvFA.cjs');
6
- const require_baseBundle = require('./baseBundle-C6yVk4x0.cjs');
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 { a as ThemeTokens, n as SemanticTokens } from "./Types-8o6d09ll.cjs";
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 { a as ThemeTokens, n as SemanticTokens } from "./Types-8o6d09ll.mjs";
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 { o as isPlainObject } from "./helpers-BXaKe2s3.mjs";
3
- import { t as baseBundle } from "./baseBundle-C6RP-2Qb.mjs";
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
  *
@@ -1,5 +1,5 @@
1
1
  /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
- import { t as buildTheme } from "./createTheme-gTjIryKH.mjs";
2
+ import { t as buildTheme } from "./createTheme-C05ONnLw.mjs";
3
3
 
4
4
  //#region src/dataviz/baseTheme.ts
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
- const require_createTheme = require('./createTheme-BzlJdFAG.cjs');
2
+ const require_createTheme = require('./createTheme-r7mUCPFX.cjs');
3
3
 
4
4
  //#region src/dataviz/baseTheme.ts
5
5
  /**
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/fsl-theme",
3
- "version": "2.1.2",
3
+ "version": "2.1.4",
4
4
  "description": "ttoss theme provider for UI.",
5
5
  "keywords": [
6
6
  "css-variables",