@castui/cast-ui 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +194 -61
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Button/Button.js +2 -4
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Card/Card.d.ts.map +1 -1
- package/dist/components/Card/Card.js +4 -10
- package/dist/components/Card/Card.js.map +1 -1
- package/dist/default.reference.json +125 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/theme/ThemeProvider.d.ts +6 -4
- package/dist/theme/ThemeProvider.d.ts.map +1 -1
- package/dist/theme/ThemeProvider.js +8 -6
- package/dist/theme/ThemeProvider.js.map +1 -1
- package/dist/theme/createTheme.d.ts +49 -0
- package/dist/theme/createTheme.d.ts.map +1 -0
- package/dist/theme/createTheme.js +85 -0
- package/dist/theme/createTheme.js.map +1 -0
- package/dist/theme/fonts.d.ts +75 -17
- package/dist/theme/fonts.d.ts.map +1 -1
- package/dist/theme/fonts.js +120 -22
- package/dist/theme/fonts.js.map +1 -1
- package/dist/theme/index.d.ts +3 -1
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +2 -1
- package/dist/theme/index.js.map +1 -1
- package/dist/theme/types.d.ts +4 -3
- package/dist/theme/types.d.ts.map +1 -1
- package/dist/theme/types.js +3 -2
- package/dist/theme/types.js.map +1 -1
- package/dist/tokens/generated/default.d.ts +3 -0
- package/dist/tokens/generated/default.d.ts.map +1 -0
- package/dist/tokens/generated/{white-label.js → default.js} +3 -3
- package/dist/tokens/generated/default.js.map +1 -0
- package/dist/tokens/generated/index.d.ts +1 -4
- package/dist/tokens/generated/index.d.ts.map +1 -1
- package/dist/tokens/generated/index.js +1 -4
- package/dist/tokens/generated/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/tokens/generated/consumer.d.ts +0 -3
- package/dist/tokens/generated/consumer.d.ts.map +0 -1
- package/dist/tokens/generated/consumer.js +0 -126
- package/dist/tokens/generated/consumer.js.map +0 -1
- package/dist/tokens/generated/corporate.d.ts +0 -3
- package/dist/tokens/generated/corporate.d.ts.map +0 -1
- package/dist/tokens/generated/corporate.js +0 -126
- package/dist/tokens/generated/corporate.js.map +0 -1
- package/dist/tokens/generated/luxury.d.ts +0 -3
- package/dist/tokens/generated/luxury.d.ts.map +0 -1
- package/dist/tokens/generated/luxury.js +0 -126
- package/dist/tokens/generated/luxury.js.map +0 -1
- package/dist/tokens/generated/white-label.d.ts +0 -3
- package/dist/tokens/generated/white-label.d.ts.map +0 -1
- package/dist/tokens/generated/white-label.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export { CastThemeProvider, useTheme } from './theme';
|
|
2
2
|
export type { CastThemeProviderProps } from './theme';
|
|
3
3
|
export type { CastTheme, ThemeName, SemanticTokens, ComponentTokens, ButtonTokens, CardTokens, } from './theme';
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
4
|
+
export { createTheme } from './theme';
|
|
5
|
+
export type { DeepPartial } from './theme';
|
|
6
|
+
export { getThemeFontFamilies, googleFontsUrl, resolveFont, ANDROID_WEIGHT_SUFFIX } from './theme';
|
|
7
|
+
export { defaultTheme } from './tokens/generated';
|
|
6
8
|
export { Button } from './components/Button/Button';
|
|
7
9
|
export type { ButtonProps, ButtonVariant } from './components/Button/Button';
|
|
8
10
|
export { Card } from './components/Card/Card';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACtD,YAAY,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AACtD,YAAY,EACV,SAAS,EACT,SAAS,EACT,cAAc,EACd,eAAe,EACf,YAAY,EACZ,UAAU,GACX,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACtD,YAAY,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AACtD,YAAY,EACV,SAAS,EACT,SAAS,EACT,cAAc,EACd,eAAe,EACf,YAAY,EACZ,UAAU,GACX,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAGnG,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE7E,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,YAAY,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
// ---------------------------------------------------------------------------
|
|
4
4
|
// Theme system
|
|
5
5
|
export { CastThemeProvider, useTheme } from './theme';
|
|
6
|
-
export {
|
|
6
|
+
export { createTheme } from './theme';
|
|
7
|
+
export { getThemeFontFamilies, googleFontsUrl, resolveFont, ANDROID_WEIGHT_SUFFIX } from './theme';
|
|
7
8
|
// Theme objects
|
|
8
|
-
export {
|
|
9
|
+
export { defaultTheme } from './tokens/generated';
|
|
9
10
|
// Components
|
|
10
11
|
export { Button } from './components/Button/Button';
|
|
11
12
|
export { Card } from './components/Card/Card';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,kCAAkC;AAClC,8EAA8E;AAE9E,eAAe;AACf,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAUtD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,kCAAkC;AAClC,8EAA8E;AAE9E,eAAe;AACf,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAUtD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAEnG,gBAAgB;AAChB,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,aAAa;AACb,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAGpD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { CastTheme } from './types';
|
|
3
3
|
export interface CastThemeProviderProps {
|
|
4
|
-
/** The theme object to provide. Defaults to
|
|
4
|
+
/** The theme object to provide. Defaults to the Default base theme. */
|
|
5
5
|
theme?: CastTheme;
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
}
|
|
@@ -9,10 +9,12 @@ export interface CastThemeProviderProps {
|
|
|
9
9
|
* Wraps the component tree with the selected Cast theme.
|
|
10
10
|
*
|
|
11
11
|
* ```tsx
|
|
12
|
-
* import { CastThemeProvider } from '@castui/cast-ui';
|
|
13
|
-
* import
|
|
12
|
+
* import { CastThemeProvider, createTheme } from '@castui/cast-ui';
|
|
13
|
+
* import overrides from './my-brand.json';
|
|
14
14
|
*
|
|
15
|
-
*
|
|
15
|
+
* const myTheme = createTheme(overrides);
|
|
16
|
+
*
|
|
17
|
+
* <CastThemeProvider theme={myTheme}>
|
|
16
18
|
* <App />
|
|
17
19
|
* </CastThemeProvider>
|
|
18
20
|
* ```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../src/theme/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAazC,MAAM,WAAW,sBAAsB;IACrC,
|
|
1
|
+
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../src/theme/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAazC,MAAM,WAAW,sBAAsB;IACrC,uEAAuE;IACvE,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,KAAoB,EACpB,QAAQ,GACT,EAAE,sBAAsB,2CAIxB;AAMD;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,IAAI,SAAS,CAEpC"}
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { createContext, useContext } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { defaultTheme } from '../tokens/generated';
|
|
4
4
|
// ---------------------------------------------------------------------------
|
|
5
5
|
// Context
|
|
6
6
|
// ---------------------------------------------------------------------------
|
|
7
|
-
const ThemeContext = createContext(
|
|
7
|
+
const ThemeContext = createContext(defaultTheme);
|
|
8
8
|
/**
|
|
9
9
|
* Wraps the component tree with the selected Cast theme.
|
|
10
10
|
*
|
|
11
11
|
* ```tsx
|
|
12
|
-
* import { CastThemeProvider } from '@castui/cast-ui';
|
|
13
|
-
* import
|
|
12
|
+
* import { CastThemeProvider, createTheme } from '@castui/cast-ui';
|
|
13
|
+
* import overrides from './my-brand.json';
|
|
14
14
|
*
|
|
15
|
-
*
|
|
15
|
+
* const myTheme = createTheme(overrides);
|
|
16
|
+
*
|
|
17
|
+
* <CastThemeProvider theme={myTheme}>
|
|
16
18
|
* <App />
|
|
17
19
|
* </CastThemeProvider>
|
|
18
20
|
* ```
|
|
19
21
|
*/
|
|
20
|
-
export function CastThemeProvider({ theme =
|
|
22
|
+
export function CastThemeProvider({ theme = defaultTheme, children, }) {
|
|
21
23
|
return (_jsx(ThemeContext.Provider, { value: theme, children: children }));
|
|
22
24
|
}
|
|
23
25
|
// ---------------------------------------------------------------------------
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeProvider.js","sourceRoot":"","sources":["../../src/theme/ThemeProvider.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ThemeProvider.js","sourceRoot":"","sources":["../../src/theme/ThemeProvider.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E,MAAM,YAAY,GAAG,aAAa,CAAY,YAAY,CAAC,CAAC;AAY5D;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAChC,KAAK,GAAG,YAAY,EACpB,QAAQ,GACe;IACvB,OAAO,CACL,KAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAAyB,CACxE,CAAC;AACJ,CAAC;AAED,8EAA8E;AAC9E,OAAO;AACP,8EAA8E;AAE9E;;;;;;;;;GASG;AACH,MAAM,UAAU,QAAQ;IACtB,OAAO,UAAU,CAAC,YAAY,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme creation utility.
|
|
3
|
+
*
|
|
4
|
+
* `createTheme()` deep-merges partial overrides with the default base theme,
|
|
5
|
+
* producing a complete `CastTheme` object. This is the primary API for
|
|
6
|
+
* creating custom branded themes.
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { createTheme, defaultTheme } from '@castui/cast-ui';
|
|
10
|
+
* import overrides from './my-brand.json';
|
|
11
|
+
*
|
|
12
|
+
* const myTheme = createTheme(overrides);
|
|
13
|
+
* // → complete CastTheme with your overrides applied on top of defaultTheme
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
import type { CastTheme } from './types';
|
|
17
|
+
/**
|
|
18
|
+
* Recursively makes all properties of `T` optional.
|
|
19
|
+
* Useful for typing partial theme overrides passed to `createTheme()`.
|
|
20
|
+
*/
|
|
21
|
+
export type DeepPartial<T> = {
|
|
22
|
+
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Create a complete `CastTheme` by deep-merging partial overrides with a
|
|
26
|
+
* base theme (defaults to `defaultTheme`).
|
|
27
|
+
*
|
|
28
|
+
* Works with both small partial overrides *and* complete theme objects
|
|
29
|
+
* exported from Figma.
|
|
30
|
+
*
|
|
31
|
+
* @param overrides – Partial theme values to apply on top of the base.
|
|
32
|
+
* @param base – Optional base theme. Defaults to `defaultTheme`.
|
|
33
|
+
* @returns A complete, merged `CastTheme` object.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* // Minimal override – only change the primary colour
|
|
38
|
+
* const myTheme = createTheme({
|
|
39
|
+
* name: 'my-brand',
|
|
40
|
+
* semantic: { color: { primary: '#FF0000' } },
|
|
41
|
+
* });
|
|
42
|
+
*
|
|
43
|
+
* // Full override from a JSON file
|
|
44
|
+
* import overrides from './my-brand.json';
|
|
45
|
+
* const myTheme = createTheme(overrides);
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare function createTheme(overrides: DeepPartial<CastTheme>, base?: CastTheme): CastTheme;
|
|
49
|
+
//# sourceMappingURL=createTheme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createTheme.d.ts","sourceRoot":"","sources":["../../src/theme/createTheme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAMzC;;;GAGG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI;KAC1B,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAChE,CAAC;AA0DF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,WAAW,CACzB,SAAS,EAAE,WAAW,CAAC,SAAS,CAAC,EACjC,IAAI,CAAC,EAAE,SAAS,GACf,SAAS,CAMX"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme creation utility.
|
|
3
|
+
*
|
|
4
|
+
* `createTheme()` deep-merges partial overrides with the default base theme,
|
|
5
|
+
* producing a complete `CastTheme` object. This is the primary API for
|
|
6
|
+
* creating custom branded themes.
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { createTheme, defaultTheme } from '@castui/cast-ui';
|
|
10
|
+
* import overrides from './my-brand.json';
|
|
11
|
+
*
|
|
12
|
+
* const myTheme = createTheme(overrides);
|
|
13
|
+
* // → complete CastTheme with your overrides applied on top of defaultTheme
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
// Deep merge
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
/**
|
|
20
|
+
* Recursively merge `source` into `target`, returning a new object.
|
|
21
|
+
* - Objects are recursed into.
|
|
22
|
+
* - Arrays and primitives from `source` replace `target` values.
|
|
23
|
+
*/
|
|
24
|
+
function deepMerge(target, source) {
|
|
25
|
+
const result = { ...target };
|
|
26
|
+
for (const key of Object.keys(source)) {
|
|
27
|
+
const sourceVal = source[key];
|
|
28
|
+
const targetVal = result[key];
|
|
29
|
+
if (sourceVal !== null &&
|
|
30
|
+
typeof sourceVal === 'object' &&
|
|
31
|
+
!Array.isArray(sourceVal) &&
|
|
32
|
+
targetVal !== null &&
|
|
33
|
+
typeof targetVal === 'object' &&
|
|
34
|
+
!Array.isArray(targetVal)) {
|
|
35
|
+
result[key] = deepMerge(targetVal, sourceVal);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
result[key] = sourceVal;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return result;
|
|
42
|
+
}
|
|
43
|
+
// ---------------------------------------------------------------------------
|
|
44
|
+
// createTheme
|
|
45
|
+
// ---------------------------------------------------------------------------
|
|
46
|
+
// Lazy reference to avoid circular import at module load time.
|
|
47
|
+
// `defaultTheme` is generated and imports from `types.ts`; this file also
|
|
48
|
+
// imports from `types.ts`, but we only need the *value* at call time.
|
|
49
|
+
let _defaultTheme;
|
|
50
|
+
function getDefaultTheme() {
|
|
51
|
+
if (!_defaultTheme) {
|
|
52
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
53
|
+
_defaultTheme = require('../tokens/generated').defaultTheme;
|
|
54
|
+
}
|
|
55
|
+
return _defaultTheme;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Create a complete `CastTheme` by deep-merging partial overrides with a
|
|
59
|
+
* base theme (defaults to `defaultTheme`).
|
|
60
|
+
*
|
|
61
|
+
* Works with both small partial overrides *and* complete theme objects
|
|
62
|
+
* exported from Figma.
|
|
63
|
+
*
|
|
64
|
+
* @param overrides – Partial theme values to apply on top of the base.
|
|
65
|
+
* @param base – Optional base theme. Defaults to `defaultTheme`.
|
|
66
|
+
* @returns A complete, merged `CastTheme` object.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* // Minimal override – only change the primary colour
|
|
71
|
+
* const myTheme = createTheme({
|
|
72
|
+
* name: 'my-brand',
|
|
73
|
+
* semantic: { color: { primary: '#FF0000' } },
|
|
74
|
+
* });
|
|
75
|
+
*
|
|
76
|
+
* // Full override from a JSON file
|
|
77
|
+
* import overrides from './my-brand.json';
|
|
78
|
+
* const myTheme = createTheme(overrides);
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
export function createTheme(overrides, base) {
|
|
82
|
+
const baseTheme = base ?? getDefaultTheme();
|
|
83
|
+
return deepMerge(baseTheme, overrides);
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=createTheme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createTheme.js","sourceRoot":"","sources":["../../src/theme/createTheme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAgBH,8EAA8E;AAC9E,aAAa;AACb,8EAA8E;AAE9E;;;;GAIG;AACH,SAAS,SAAS,CAChB,MAAS,EACT,MAA+B;IAE/B,MAAM,MAAM,GAAG,EAAE,GAAG,MAAM,EAA6B,CAAC;IAExD,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACtC,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC9B,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAE9B,IACE,SAAS,KAAK,IAAI;YAClB,OAAO,SAAS,KAAK,QAAQ;YAC7B,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;YACzB,SAAS,KAAK,IAAI;YAClB,OAAO,SAAS,KAAK,QAAQ;YAC7B,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EACzB,CAAC;YACD,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,CACrB,SAAoC,EACpC,SAAoC,CACrC,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;QAC1B,CAAC;IACH,CAAC;IAED,OAAO,MAAW,CAAC;AACrB,CAAC;AAED,8EAA8E;AAC9E,cAAc;AACd,8EAA8E;AAE9E,+DAA+D;AAC/D,0EAA0E;AAC1E,sEAAsE;AACtE,IAAI,aAAoC,CAAC;AAEzC,SAAS,eAAe;IACtB,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,iEAAiE;QACjE,aAAa,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC,YAAyB,CAAC;IAC3E,CAAC;IACD,OAAO,aAAa,CAAC;AACvB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,WAAW,CACzB,SAAiC,EACjC,IAAgB;IAEhB,MAAM,SAAS,GAAG,IAAI,IAAI,eAAe,EAAE,CAAC;IAC5C,OAAO,SAAS,CACd,SAA+C,EAC/C,SAA+C,CACxB,CAAC;AAC5B,CAAC"}
|
package/dist/theme/fonts.d.ts
CHANGED
|
@@ -1,33 +1,91 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Font-loading helpers.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* font-family names to `require()`-able assets (for Expo) or Google Fonts
|
|
6
|
-
* URLs (for web).
|
|
4
|
+
* Provides utilities for loading custom fonts used by any Cast UI theme.
|
|
7
5
|
*
|
|
8
|
-
* **
|
|
9
|
-
* rendering themed components:
|
|
6
|
+
* **Web** – use `googleFontsUrl(theme)` to generate a `<link>` href:
|
|
10
7
|
*
|
|
11
8
|
* ```ts
|
|
12
|
-
* import {
|
|
13
|
-
* import { THEME_FONTS } from '@castui/cast-ui/theme/fonts';
|
|
9
|
+
* import { googleFontsUrl } from '@castui/cast-ui';
|
|
14
10
|
*
|
|
15
|
-
* const
|
|
11
|
+
* const url = googleFontsUrl(myTheme);
|
|
12
|
+
* if (url) document.head.innerHTML += `<link href="${url}" rel="stylesheet" />`;
|
|
16
13
|
* ```
|
|
17
14
|
*
|
|
18
|
-
* **
|
|
19
|
-
*
|
|
15
|
+
* **React Native / Expo** – use `getThemeFontFamilies(theme)` to discover
|
|
16
|
+
* which font families need loading, then pass them to `expo-font`.
|
|
17
|
+
*
|
|
18
|
+
* ### Android font registration convention
|
|
19
|
+
*
|
|
20
|
+
* Android cannot combine a generic `fontFamily` with a numeric `fontWeight`
|
|
21
|
+
* for custom fonts — it silently falls back to the system font. Instead,
|
|
22
|
+
* each weight must be registered under a distinct name that matches the Expo
|
|
23
|
+
* Google Fonts convention:
|
|
24
|
+
*
|
|
25
|
+
* | Weight | Registration key |
|
|
26
|
+
* |--------|------------------------------|
|
|
27
|
+
* | 400 | `"FontName"` |
|
|
28
|
+
* | 500 | `"FontName_500Medium"` |
|
|
29
|
+
* | 700 | `"FontName_700Bold"` |
|
|
30
|
+
*
|
|
31
|
+
* Use {@link resolveFont} in component styles to transparently handle this.
|
|
20
32
|
*/
|
|
21
|
-
import type
|
|
33
|
+
import { type TextStyle } from 'react-native';
|
|
34
|
+
import type { CastTheme } from './types';
|
|
22
35
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
36
|
+
* Dynamically extract all non-`system-ui` font families from a theme object.
|
|
37
|
+
*
|
|
38
|
+
* Scans both the semantic `fontFamily` layer and component-level font
|
|
39
|
+
* properties to discover every custom font the theme uses. Returns a
|
|
40
|
+
* deduplicated array of family names suitable for loading via Google Fonts
|
|
41
|
+
* or `expo-font`.
|
|
42
|
+
*
|
|
43
|
+
* @param theme – Any complete `CastTheme` object.
|
|
44
|
+
* @returns Array of unique font family names (excluding `system-ui`).
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* const families = getThemeFontFamilies(myTheme);
|
|
49
|
+
* // → ['Poppins'] or ['Inter', 'Merriweather'] etc.
|
|
50
|
+
* ```
|
|
26
51
|
*/
|
|
27
|
-
export declare
|
|
52
|
+
export declare function getThemeFontFamilies(theme: CastTheme): string[];
|
|
28
53
|
/**
|
|
29
54
|
* Google Fonts `<link>` href for a given theme.
|
|
30
|
-
*
|
|
55
|
+
*
|
|
56
|
+
* Dynamically inspects the theme to discover which font families are needed.
|
|
57
|
+
* Returns `null` if the theme uses only system fonts.
|
|
58
|
+
*
|
|
59
|
+
* @param theme – Any complete `CastTheme` object.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* const url = googleFontsUrl(myTheme);
|
|
64
|
+
* if (url) {
|
|
65
|
+
* const link = document.createElement('link');
|
|
66
|
+
* link.href = url;
|
|
67
|
+
* link.rel = 'stylesheet';
|
|
68
|
+
* document.head.appendChild(link);
|
|
69
|
+
* }
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
export declare function googleFontsUrl(theme: CastTheme): string | null;
|
|
73
|
+
/**
|
|
74
|
+
* Suffix appended to a font family name on Android to select a specific
|
|
75
|
+
* weight. Matches the Expo Google Fonts registration convention.
|
|
76
|
+
*
|
|
77
|
+
* Weight 400 maps to the bare family name (empty suffix).
|
|
78
|
+
*/
|
|
79
|
+
export declare const ANDROID_WEIGHT_SUFFIX: Record<number, string>;
|
|
80
|
+
/**
|
|
81
|
+
* Return the correct `fontFamily` / `fontWeight` style props for the
|
|
82
|
+
* current platform.
|
|
83
|
+
*
|
|
84
|
+
* - **iOS / Web** — returns `{ fontFamily, fontWeight }` unchanged.
|
|
85
|
+
* - **Android** — maps to a weight-specific registered font name
|
|
86
|
+
* (e.g. `"Poppins_700Bold"`) and resets `fontWeight` to `'normal'`.
|
|
87
|
+
* - **system-ui** — omits `fontFamily` entirely (platform default)
|
|
88
|
+
* and passes `fontWeight` through on all platforms.
|
|
31
89
|
*/
|
|
32
|
-
export declare function
|
|
90
|
+
export declare function resolveFont(fontFamily: string, fontWeight: number): Pick<TextStyle, 'fontFamily' | 'fontWeight'>;
|
|
33
91
|
//# sourceMappingURL=fonts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fonts.d.ts","sourceRoot":"","sources":["../../src/theme/fonts.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"fonts.d.ts","sourceRoot":"","sources":["../../src/theme/fonts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,EAAE,CAyB/D;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAS9D;AAMD;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAIxD,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CACzB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,GACjB,IAAI,CAAC,SAAS,EAAE,YAAY,GAAG,YAAY,CAAC,CAmB9C"}
|
package/dist/theme/fonts.js
CHANGED
|
@@ -1,40 +1,97 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Font-loading helpers.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* font-family names to `require()`-able assets (for Expo) or Google Fonts
|
|
6
|
-
* URLs (for web).
|
|
4
|
+
* Provides utilities for loading custom fonts used by any Cast UI theme.
|
|
7
5
|
*
|
|
8
|
-
* **
|
|
9
|
-
* rendering themed components:
|
|
6
|
+
* **Web** – use `googleFontsUrl(theme)` to generate a `<link>` href:
|
|
10
7
|
*
|
|
11
8
|
* ```ts
|
|
12
|
-
* import {
|
|
13
|
-
* import { THEME_FONTS } from '@castui/cast-ui/theme/fonts';
|
|
9
|
+
* import { googleFontsUrl } from '@castui/cast-ui';
|
|
14
10
|
*
|
|
15
|
-
* const
|
|
11
|
+
* const url = googleFontsUrl(myTheme);
|
|
12
|
+
* if (url) document.head.innerHTML += `<link href="${url}" rel="stylesheet" />`;
|
|
16
13
|
* ```
|
|
17
14
|
*
|
|
18
|
-
* **
|
|
19
|
-
*
|
|
15
|
+
* **React Native / Expo** – use `getThemeFontFamilies(theme)` to discover
|
|
16
|
+
* which font families need loading, then pass them to `expo-font`.
|
|
17
|
+
*
|
|
18
|
+
* ### Android font registration convention
|
|
19
|
+
*
|
|
20
|
+
* Android cannot combine a generic `fontFamily` with a numeric `fontWeight`
|
|
21
|
+
* for custom fonts — it silently falls back to the system font. Instead,
|
|
22
|
+
* each weight must be registered under a distinct name that matches the Expo
|
|
23
|
+
* Google Fonts convention:
|
|
24
|
+
*
|
|
25
|
+
* | Weight | Registration key |
|
|
26
|
+
* |--------|------------------------------|
|
|
27
|
+
* | 400 | `"FontName"` |
|
|
28
|
+
* | 500 | `"FontName_500Medium"` |
|
|
29
|
+
* | 700 | `"FontName_700Bold"` |
|
|
30
|
+
*
|
|
31
|
+
* Use {@link resolveFont} in component styles to transparently handle this.
|
|
20
32
|
*/
|
|
33
|
+
import { Platform } from 'react-native';
|
|
21
34
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
35
|
+
* Dynamically extract all non-`system-ui` font families from a theme object.
|
|
36
|
+
*
|
|
37
|
+
* Scans both the semantic `fontFamily` layer and component-level font
|
|
38
|
+
* properties to discover every custom font the theme uses. Returns a
|
|
39
|
+
* deduplicated array of family names suitable for loading via Google Fonts
|
|
40
|
+
* or `expo-font`.
|
|
41
|
+
*
|
|
42
|
+
* @param theme – Any complete `CastTheme` object.
|
|
43
|
+
* @returns Array of unique font family names (excluding `system-ui`).
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* const families = getThemeFontFamilies(myTheme);
|
|
48
|
+
* // → ['Poppins'] or ['Inter', 'Merriweather'] etc.
|
|
49
|
+
* ```
|
|
25
50
|
*/
|
|
26
|
-
export
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
51
|
+
export function getThemeFontFamilies(theme) {
|
|
52
|
+
const families = new Set();
|
|
53
|
+
// Semantic font families
|
|
54
|
+
const sf = theme.semantic.fontFamily;
|
|
55
|
+
for (const key of Object.keys(sf)) {
|
|
56
|
+
const family = sf[key];
|
|
57
|
+
if (family && family !== 'system-ui') {
|
|
58
|
+
families.add(family);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
// Component-level font families
|
|
62
|
+
const { button, card } = theme.component;
|
|
63
|
+
if (button.fontFamily && button.fontFamily !== 'system-ui') {
|
|
64
|
+
families.add(button.fontFamily);
|
|
65
|
+
}
|
|
66
|
+
if (card.headingFontFamily && card.headingFontFamily !== 'system-ui') {
|
|
67
|
+
families.add(card.headingFontFamily);
|
|
68
|
+
}
|
|
69
|
+
if (card.bodyFontFamily && card.bodyFontFamily !== 'system-ui') {
|
|
70
|
+
families.add(card.bodyFontFamily);
|
|
71
|
+
}
|
|
72
|
+
return Array.from(families);
|
|
73
|
+
}
|
|
32
74
|
/**
|
|
33
75
|
* Google Fonts `<link>` href for a given theme.
|
|
34
|
-
*
|
|
76
|
+
*
|
|
77
|
+
* Dynamically inspects the theme to discover which font families are needed.
|
|
78
|
+
* Returns `null` if the theme uses only system fonts.
|
|
79
|
+
*
|
|
80
|
+
* @param theme – Any complete `CastTheme` object.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```ts
|
|
84
|
+
* const url = googleFontsUrl(myTheme);
|
|
85
|
+
* if (url) {
|
|
86
|
+
* const link = document.createElement('link');
|
|
87
|
+
* link.href = url;
|
|
88
|
+
* link.rel = 'stylesheet';
|
|
89
|
+
* document.head.appendChild(link);
|
|
90
|
+
* }
|
|
91
|
+
* ```
|
|
35
92
|
*/
|
|
36
|
-
export function googleFontsUrl(
|
|
37
|
-
const families =
|
|
93
|
+
export function googleFontsUrl(theme) {
|
|
94
|
+
const families = getThemeFontFamilies(theme);
|
|
38
95
|
if (families.length === 0)
|
|
39
96
|
return null;
|
|
40
97
|
const params = families
|
|
@@ -42,4 +99,45 @@ export function googleFontsUrl(themeName) {
|
|
|
42
99
|
.join('&');
|
|
43
100
|
return `https://fonts.googleapis.com/css2?${params}&display=swap`;
|
|
44
101
|
}
|
|
102
|
+
// ---------------------------------------------------------------------------
|
|
103
|
+
// Android font-weight resolution
|
|
104
|
+
// ---------------------------------------------------------------------------
|
|
105
|
+
/**
|
|
106
|
+
* Suffix appended to a font family name on Android to select a specific
|
|
107
|
+
* weight. Matches the Expo Google Fonts registration convention.
|
|
108
|
+
*
|
|
109
|
+
* Weight 400 maps to the bare family name (empty suffix).
|
|
110
|
+
*/
|
|
111
|
+
export const ANDROID_WEIGHT_SUFFIX = {
|
|
112
|
+
400: '',
|
|
113
|
+
500: '_500Medium',
|
|
114
|
+
700: '_700Bold',
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* Return the correct `fontFamily` / `fontWeight` style props for the
|
|
118
|
+
* current platform.
|
|
119
|
+
*
|
|
120
|
+
* - **iOS / Web** — returns `{ fontFamily, fontWeight }` unchanged.
|
|
121
|
+
* - **Android** — maps to a weight-specific registered font name
|
|
122
|
+
* (e.g. `"Poppins_700Bold"`) and resets `fontWeight` to `'normal'`.
|
|
123
|
+
* - **system-ui** — omits `fontFamily` entirely (platform default)
|
|
124
|
+
* and passes `fontWeight` through on all platforms.
|
|
125
|
+
*/
|
|
126
|
+
export function resolveFont(fontFamily, fontWeight) {
|
|
127
|
+
const weight = String(fontWeight);
|
|
128
|
+
// system-ui → platform default; just pass through fontWeight
|
|
129
|
+
if (fontFamily === 'system-ui') {
|
|
130
|
+
return { fontWeight: weight };
|
|
131
|
+
}
|
|
132
|
+
// Android needs a weight-specific registered name
|
|
133
|
+
if (Platform.OS === 'android') {
|
|
134
|
+
const suffix = ANDROID_WEIGHT_SUFFIX[fontWeight] ?? '';
|
|
135
|
+
return {
|
|
136
|
+
fontFamily: `${fontFamily}${suffix}`,
|
|
137
|
+
fontWeight: 'normal',
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
// iOS / Web – pass through unchanged
|
|
141
|
+
return { fontFamily, fontWeight: weight };
|
|
142
|
+
}
|
|
45
143
|
//# sourceMappingURL=fonts.js.map
|
package/dist/theme/fonts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fonts.js","sourceRoot":"","sources":["../../src/theme/fonts.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"fonts.js","sourceRoot":"","sources":["../../src/theme/fonts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,QAAQ,EAAkB,MAAM,cAAc,CAAC;AAGxD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAgB;IACnD,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;IAEnC,yBAAyB;IACzB,MAAM,EAAE,GAAG,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC;IACrC,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAwB,EAAE,CAAC;QACzD,MAAM,MAAM,GA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E9E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAA2B;IAC3D,GAAG,EAAE,EAAE;IACP,GAAG,EAAE,YAAY;IACjB,GAAG,EAAE,UAAU;CAChB,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,UAAU,WAAW,CACzB,UAAkB,EAClB,UAAkB;IAElB,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAA4B,CAAC;IAE7D,6DAA6D;IAC7D,IAAI,UAAU,KAAK,WAAW,EAAE,CAAC;QAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;IAChC,CAAC;IAED,kDAAkD;IAClD,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;QAC9B,MAAM,MAAM,GAAG,qBAAqB,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;QACvD,OAAO;YACL,UAAU,EAAE,GAAG,UAAU,GAAG,MAAM,EAAE;YACpC,UAAU,EAAE,QAAQ;SACrB,CAAC;IACJ,CAAC;IAED,qCAAqC;IACrC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;AAC5C,CAAC"}
|
package/dist/theme/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { CastThemeProvider, useTheme } from './ThemeProvider';
|
|
2
2
|
export type { CastThemeProviderProps } from './ThemeProvider';
|
|
3
|
-
export {
|
|
3
|
+
export { createTheme } from './createTheme';
|
|
4
|
+
export type { DeepPartial } from './createTheme';
|
|
5
|
+
export { getThemeFontFamilies, googleFontsUrl, resolveFont, ANDROID_WEIGHT_SUFFIX } from './fonts';
|
|
4
6
|
export type { CastTheme, ThemeName, SemanticTokens, SemanticColors, SemanticFontFamily, SemanticFontSize, SemanticFontWeight, SemanticLineHeight, SemanticLetterSpacing, SemanticParagraphSpacing, SemanticParagraphIndent, SemanticBorderRadius, ComponentTokens, ButtonTokens, ButtonVariantTokens, ButtonOutlineTokens, ButtonStateTokens, CardTokens, } from './types';
|
|
5
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC9D,YAAY,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC9D,YAAY,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AACnG,YAAY,EACV,SAAS,EACT,SAAS,EACT,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,oBAAoB,EACpB,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,UAAU,GACX,MAAM,SAAS,CAAC"}
|
package/dist/theme/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { CastThemeProvider, useTheme } from './ThemeProvider';
|
|
2
|
-
export {
|
|
2
|
+
export { createTheme } from './createTheme';
|
|
3
|
+
export { getThemeFontFamilies, googleFontsUrl, resolveFont, ANDROID_WEIGHT_SUFFIX } from './fonts';
|
|
3
4
|
//# sourceMappingURL=index.js.map
|
package/dist/theme/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE9D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE9D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/theme/types.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Cast Design System theme type.
|
|
3
3
|
*
|
|
4
|
-
* Every theme
|
|
5
|
-
*
|
|
4
|
+
* Every theme conforms to this interface. The library ships a Default base
|
|
5
|
+
* theme; consumers create custom themes via `createTheme()` with partial
|
|
6
|
+
* overrides. Components consume tokens via `useTheme()` and reference
|
|
6
7
|
* properties from the semantic and component layers.
|
|
7
8
|
*
|
|
8
9
|
* Generated theme objects resolve all Figma token aliases to final values.
|
|
@@ -141,7 +142,7 @@ export interface ComponentTokens {
|
|
|
141
142
|
button: ButtonTokens;
|
|
142
143
|
card: CardTokens;
|
|
143
144
|
}
|
|
144
|
-
export type ThemeName =
|
|
145
|
+
export type ThemeName = string;
|
|
145
146
|
export interface CastTheme {
|
|
146
147
|
name: ThemeName;
|
|
147
148
|
semantic: SemanticTokens;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/theme/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/theme/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,MAA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CAAC;IAChB,QAAQ,EAAE,cAAc,CAAC;IACzB,SAAS,EAAE,eAAe,CAAC;CAC5B"}
|
package/dist/theme/types.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Cast Design System theme type.
|
|
3
3
|
*
|
|
4
|
-
* Every theme
|
|
5
|
-
*
|
|
4
|
+
* Every theme conforms to this interface. The library ships a Default base
|
|
5
|
+
* theme; consumers create custom themes via `createTheme()` with partial
|
|
6
|
+
* overrides. Components consume tokens via `useTheme()` and reference
|
|
6
7
|
* properties from the semantic and component layers.
|
|
7
8
|
*
|
|
8
9
|
* Generated theme objects resolve all Figma token aliases to final values.
|
package/dist/theme/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/theme/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/theme/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
|