@cdx-ui/styles 0.0.1-beta.32 → 0.0.1-beta.33
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/lib/commonjs/index.js +73 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +46 -2
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/index.d.ts +42 -8
- package/lib/typescript/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +55 -8
package/lib/commonjs/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.presetFonts = exports.SUPPORTED_OVERRIDE_SCHEMA_VERSIONS = exports.OVERRIDE_SCHEMA_VERSION = exports.INPUT_TOKEN_MAP = void 0;
|
|
6
7
|
Object.defineProperty(exports, "useCdxFonts", {
|
|
7
8
|
enumerable: true,
|
|
8
9
|
get: function () {
|
|
@@ -10,4 +11,76 @@ Object.defineProperty(exports, "useCdxFonts", {
|
|
|
10
11
|
}
|
|
11
12
|
});
|
|
12
13
|
var _useCdxFonts = require("./useCdxFonts");
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
// Types
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
|
|
18
|
+
/** A DTCG token leaf node. */
|
|
19
|
+
|
|
20
|
+
/** Recursive token group — every non-leaf node in a theme object. */
|
|
21
|
+
|
|
22
|
+
/** The three built-in CDX UI theme presets. */
|
|
23
|
+
|
|
24
|
+
/** Theme metadata stored under `$extensions.com.candescent.theme`. */
|
|
25
|
+
|
|
26
|
+
/** Override metadata stored under `$extensions.com.candescent.themeOverride`. */
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* A complete CDX UI theme object (DTCG-compatible).
|
|
30
|
+
*
|
|
31
|
+
* Presets (Poise, Prestige, Pulse) are full theme objects. At runtime the
|
|
32
|
+
* build-time default preset is augmented by FI overrides via
|
|
33
|
+
* `applyThemeOverrides`.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* A theme override using the hybrid input + semantic structure.
|
|
38
|
+
*
|
|
39
|
+
* - `inputs` — flat map of abstract FI-selected brand values (e.g.
|
|
40
|
+
* `brandPrimary`, `displayFont`). Palette generation expands these into
|
|
41
|
+
* full token scales at runtime.
|
|
42
|
+
* - `overrides` — per-mode flat maps of token dot-paths to resolved values
|
|
43
|
+
* for direct semantic token overrides beyond what inputs generate.
|
|
44
|
+
* - `$extensions` — required metadata including base preset and schema version.
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
// ---------------------------------------------------------------------------
|
|
48
|
+
// Constants
|
|
49
|
+
// ---------------------------------------------------------------------------
|
|
50
|
+
|
|
51
|
+
/** Current override schema version. Consuming apps gate compatibility on this. */
|
|
52
|
+
const OVERRIDE_SCHEMA_VERSION = exports.OVERRIDE_SCHEMA_VERSION = '1.0.0';
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Schema versions that consuming apps accept. Includes the current version and
|
|
56
|
+
* may include the immediately prior version during transition windows.
|
|
57
|
+
* @see docs/internal/token-architecture/16-override-structure.md § 4
|
|
58
|
+
*/
|
|
59
|
+
const SUPPORTED_OVERRIDE_SCHEMA_VERSIONS = exports.SUPPORTED_OVERRIDE_SCHEMA_VERSIONS = ['1.0.0'];
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Schema-level mapping from known input keys to the token path pattern each
|
|
63
|
+
* affects. Used by override application (S5) to route inputs to the correct
|
|
64
|
+
* palette/token namespace. Distinct from the full runtime map (S3).
|
|
65
|
+
*/
|
|
66
|
+
const INPUT_TOKEN_MAP = exports.INPUT_TOKEN_MAP = {
|
|
67
|
+
brandPrimary: 'color.brand',
|
|
68
|
+
accentPrimary: 'color.accent',
|
|
69
|
+
basePrimary: 'color.base',
|
|
70
|
+
displayFont: 'font.display'
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Allowed display font families per preset, consumed by the theme editor for
|
|
75
|
+
* font selection and by consuming apps for validation.
|
|
76
|
+
*/
|
|
77
|
+
const presetFonts = exports.presetFonts = {
|
|
78
|
+
poise: ['Crimson Pro', 'Bitter', 'DM Sans'],
|
|
79
|
+
prestige: ['Libre Caslon Text', 'Cormorant', 'Libre Franklin'],
|
|
80
|
+
pulse: ['Outfit', 'Manrope', 'Public Sans']
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
// ---------------------------------------------------------------------------
|
|
84
|
+
// Hooks
|
|
85
|
+
// ---------------------------------------------------------------------------
|
|
13
86
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_useCdxFonts","require"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_useCdxFonts","require","OVERRIDE_SCHEMA_VERSION","exports","SUPPORTED_OVERRIDE_SCHEMA_VERSIONS","INPUT_TOKEN_MAP","brandPrimary","accentPrimary","basePrimary","displayFont","presetFonts","poise","prestige","pulse"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;AAqHA,IAAAA,YAAA,GAAAC,OAAA;AArHA;AACA;AACA;;AAEA;;AAOA;;AAKA;;AAGA;;AAOA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;;AAiBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA;AACA;AACA;;AAEA;AACO,MAAMC,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,GAAG,OAAgB;;AAEvD;AACA;AACA;AACA;AACA;AACO,MAAME,kCAAqD,GAAAD,OAAA,CAAAC,kCAAA,GAAG,CAAC,OAAO,CAAU;;AAEvF;AACA;AACA;AACA;AACA;AACO,MAAMC,eAAe,GAAAF,OAAA,CAAAE,eAAA,GAAG;EAC7BC,YAAY,EAAE,aAAa;EAC3BC,aAAa,EAAE,cAAc;EAC7BC,WAAW,EAAE,YAAY;EACzBC,WAAW,EAAE;AACf,CAA2C;;AAE3C;AACA;AACA;AACA;AACO,MAAMC,WAA8C,GAAAP,OAAA,CAAAO,WAAA,GAAG;EAC5DC,KAAK,EAAE,CAAC,aAAa,EAAE,QAAQ,EAAE,SAAS,CAAC;EAC3CC,QAAQ,EAAE,CAAC,mBAAmB,EAAE,WAAW,EAAE,gBAAgB,CAAC;EAC9DC,KAAK,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,aAAa;AAC5C,CAAU;;AAEV;AACA;AACA","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
/** Recursive token group — every non-leaf node in a theme object. */
|
|
10
10
|
|
|
11
|
+
/** The three built-in CDX UI theme presets. */
|
|
12
|
+
|
|
11
13
|
/** Theme metadata stored under `$extensions.com.candescent.theme`. */
|
|
12
14
|
|
|
13
15
|
/** Override metadata stored under `$extensions.com.candescent.themeOverride`. */
|
|
@@ -21,9 +23,51 @@
|
|
|
21
23
|
*/
|
|
22
24
|
|
|
23
25
|
/**
|
|
24
|
-
* A theme override
|
|
25
|
-
*
|
|
26
|
+
* A theme override using the hybrid input + semantic structure.
|
|
27
|
+
*
|
|
28
|
+
* - `inputs` — flat map of abstract FI-selected brand values (e.g.
|
|
29
|
+
* `brandPrimary`, `displayFont`). Palette generation expands these into
|
|
30
|
+
* full token scales at runtime.
|
|
31
|
+
* - `overrides` — per-mode flat maps of token dot-paths to resolved values
|
|
32
|
+
* for direct semantic token overrides beyond what inputs generate.
|
|
33
|
+
* - `$extensions` — required metadata including base preset and schema version.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
// ---------------------------------------------------------------------------
|
|
37
|
+
// Constants
|
|
38
|
+
// ---------------------------------------------------------------------------
|
|
39
|
+
|
|
40
|
+
/** Current override schema version. Consuming apps gate compatibility on this. */
|
|
41
|
+
export const OVERRIDE_SCHEMA_VERSION = '1.0.0';
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Schema versions that consuming apps accept. Includes the current version and
|
|
45
|
+
* may include the immediately prior version during transition windows.
|
|
46
|
+
* @see docs/internal/token-architecture/16-override-structure.md § 4
|
|
47
|
+
*/
|
|
48
|
+
export const SUPPORTED_OVERRIDE_SCHEMA_VERSIONS = ['1.0.0'];
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Schema-level mapping from known input keys to the token path pattern each
|
|
52
|
+
* affects. Used by override application (S5) to route inputs to the correct
|
|
53
|
+
* palette/token namespace. Distinct from the full runtime map (S3).
|
|
54
|
+
*/
|
|
55
|
+
export const INPUT_TOKEN_MAP = {
|
|
56
|
+
brandPrimary: 'color.brand',
|
|
57
|
+
accentPrimary: 'color.accent',
|
|
58
|
+
basePrimary: 'color.base',
|
|
59
|
+
displayFont: 'font.display'
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Allowed display font families per preset, consumed by the theme editor for
|
|
64
|
+
* font selection and by consuming apps for validation.
|
|
26
65
|
*/
|
|
66
|
+
export const presetFonts = {
|
|
67
|
+
poise: ['Crimson Pro', 'Bitter', 'DM Sans'],
|
|
68
|
+
prestige: ['Libre Caslon Text', 'Cormorant', 'Libre Franklin'],
|
|
69
|
+
pulse: ['Outfit', 'Manrope', 'Public Sans']
|
|
70
|
+
};
|
|
27
71
|
|
|
28
72
|
// ---------------------------------------------------------------------------
|
|
29
73
|
// Hooks
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useCdxFonts"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA;AACA;AACA;;AAEA;;AAOA;;AAKA;;AAOA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;;AAiBA;AACA;AACA;AACA;;
|
|
1
|
+
{"version":3,"names":["OVERRIDE_SCHEMA_VERSION","SUPPORTED_OVERRIDE_SCHEMA_VERSIONS","INPUT_TOKEN_MAP","brandPrimary","accentPrimary","basePrimary","displayFont","presetFonts","poise","prestige","pulse","useCdxFonts"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA;AACA;AACA;;AAEA;;AAOA;;AAKA;;AAGA;;AAOA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;;AAiBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA;AACA;AACA;;AAEA;AACA,OAAO,MAAMA,uBAAuB,GAAG,OAAgB;;AAEvD;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,kCAAqD,GAAG,CAAC,OAAO,CAAU;;AAEvF;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,eAAe,GAAG;EAC7BC,YAAY,EAAE,aAAa;EAC3BC,aAAa,EAAE,cAAc;EAC7BC,WAAW,EAAE,YAAY;EACzBC,WAAW,EAAE;AACf,CAA2C;;AAE3C;AACA;AACA;AACA;AACA,OAAO,MAAMC,WAA8C,GAAG;EAC5DC,KAAK,EAAE,CAAC,aAAa,EAAE,QAAQ,EAAE,SAAS,CAAC;EAC3CC,QAAQ,EAAE,CAAC,mBAAmB,EAAE,WAAW,EAAE,gBAAgB,CAAC;EAC9DC,KAAK,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,aAAa;AAC5C,CAAU;;AAEV;AACA;AACA;;AAEA,SAASC,WAAW,QAAQ,eAAe","ignoreList":[]}
|
|
@@ -8,15 +8,17 @@ export interface TokenValue {
|
|
|
8
8
|
export interface TokenGroup {
|
|
9
9
|
[key: string]: TokenValue | TokenGroup;
|
|
10
10
|
}
|
|
11
|
+
/** The three built-in CDX UI theme presets. */
|
|
12
|
+
export type Preset = 'poise' | 'prestige' | 'pulse';
|
|
11
13
|
/** Theme metadata stored under `$extensions.com.candescent.theme`. */
|
|
12
14
|
export interface ThemeMetadata {
|
|
13
15
|
name: string;
|
|
14
|
-
preset:
|
|
16
|
+
preset: Preset;
|
|
15
17
|
schemaVersion: string;
|
|
16
18
|
}
|
|
17
19
|
/** Override metadata stored under `$extensions.com.candescent.themeOverride`. */
|
|
18
20
|
export interface ThemeOverrideMetadata {
|
|
19
|
-
basePreset:
|
|
21
|
+
basePreset: Preset;
|
|
20
22
|
schemaVersion: string;
|
|
21
23
|
}
|
|
22
24
|
/**
|
|
@@ -42,16 +44,48 @@ export type ThemeObject = TokenGroup & {
|
|
|
42
44
|
};
|
|
43
45
|
};
|
|
44
46
|
/**
|
|
45
|
-
* A theme override
|
|
46
|
-
*
|
|
47
|
+
* A theme override using the hybrid input + semantic structure.
|
|
48
|
+
*
|
|
49
|
+
* - `inputs` — flat map of abstract FI-selected brand values (e.g.
|
|
50
|
+
* `brandPrimary`, `displayFont`). Palette generation expands these into
|
|
51
|
+
* full token scales at runtime.
|
|
52
|
+
* - `overrides` — per-mode flat maps of token dot-paths to resolved values
|
|
53
|
+
* for direct semantic token overrides beyond what inputs generate.
|
|
54
|
+
* - `$extensions` — required metadata including base preset and schema version.
|
|
47
55
|
*/
|
|
48
|
-
export
|
|
49
|
-
$extensions
|
|
50
|
-
'com.candescent.themeOverride'
|
|
56
|
+
export interface ThemeOverride {
|
|
57
|
+
$extensions: {
|
|
58
|
+
'com.candescent.themeOverride': ThemeOverrideMetadata;
|
|
51
59
|
[key: string]: unknown;
|
|
52
60
|
};
|
|
53
|
-
|
|
61
|
+
inputs?: Record<string, string | number>;
|
|
62
|
+
overrides?: Partial<Record<Mode, Record<string, string | number>>>;
|
|
63
|
+
}
|
|
54
64
|
export type Mode = 'light' | 'dark';
|
|
55
65
|
export type Platform = 'web' | 'ios' | 'android';
|
|
66
|
+
/** Current override schema version. Consuming apps gate compatibility on this. */
|
|
67
|
+
export declare const OVERRIDE_SCHEMA_VERSION: "1.0.0";
|
|
68
|
+
/**
|
|
69
|
+
* Schema versions that consuming apps accept. Includes the current version and
|
|
70
|
+
* may include the immediately prior version during transition windows.
|
|
71
|
+
* @see docs/internal/token-architecture/16-override-structure.md § 4
|
|
72
|
+
*/
|
|
73
|
+
export declare const SUPPORTED_OVERRIDE_SCHEMA_VERSIONS: readonly string[];
|
|
74
|
+
/**
|
|
75
|
+
* Schema-level mapping from known input keys to the token path pattern each
|
|
76
|
+
* affects. Used by override application (S5) to route inputs to the correct
|
|
77
|
+
* palette/token namespace. Distinct from the full runtime map (S3).
|
|
78
|
+
*/
|
|
79
|
+
export declare const INPUT_TOKEN_MAP: {
|
|
80
|
+
readonly brandPrimary: "color.brand";
|
|
81
|
+
readonly accentPrimary: "color.accent";
|
|
82
|
+
readonly basePrimary: "color.base";
|
|
83
|
+
readonly displayFont: "font.display";
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Allowed display font families per preset, consumed by the theme editor for
|
|
87
|
+
* font selection and by consuming apps for validation.
|
|
88
|
+
*/
|
|
89
|
+
export declare const presetFonts: Record<Preset, readonly string[]>;
|
|
56
90
|
export { useCdxFonts } from './useCdxFonts';
|
|
57
91
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAIA,8BAA8B;AAC9B,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACvC;AAED,qEAAqE;AACrE,MAAM,WAAW,UAAU;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,UAAU,CAAC;CACxC;AAED,sEAAsE;AACtE,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,iFAAiF;AACjF,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;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js",
|
|
5
5
|
"module": "lib/module/index.js",
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@expo-google-fonts/manrope": "0.4.2",
|
|
54
54
|
"@expo-google-fonts/outfit": "0.4.3",
|
|
55
55
|
"@expo-google-fonts/public-sans": "0.4.2",
|
|
56
|
-
"@cdx-ui/utils": "0.0.1-beta.
|
|
56
|
+
"@cdx-ui/utils": "0.0.1-beta.33"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"react": "^18.2.0 || ^19.0.0",
|
package/src/index.ts
CHANGED
|
@@ -14,16 +14,19 @@ export interface TokenGroup {
|
|
|
14
14
|
[key: string]: TokenValue | TokenGroup;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
/** The three built-in CDX UI theme presets. */
|
|
18
|
+
export type Preset = 'poise' | 'prestige' | 'pulse';
|
|
19
|
+
|
|
17
20
|
/** Theme metadata stored under `$extensions.com.candescent.theme`. */
|
|
18
21
|
export interface ThemeMetadata {
|
|
19
22
|
name: string;
|
|
20
|
-
preset:
|
|
23
|
+
preset: Preset;
|
|
21
24
|
schemaVersion: string;
|
|
22
25
|
}
|
|
23
26
|
|
|
24
27
|
/** Override metadata stored under `$extensions.com.candescent.themeOverride`. */
|
|
25
28
|
export interface ThemeOverrideMetadata {
|
|
26
|
-
basePreset:
|
|
29
|
+
basePreset: Preset;
|
|
27
30
|
schemaVersion: string;
|
|
28
31
|
}
|
|
29
32
|
|
|
@@ -51,19 +54,63 @@ export type ThemeObject = TokenGroup & {
|
|
|
51
54
|
};
|
|
52
55
|
|
|
53
56
|
/**
|
|
54
|
-
* A theme override
|
|
55
|
-
*
|
|
57
|
+
* A theme override using the hybrid input + semantic structure.
|
|
58
|
+
*
|
|
59
|
+
* - `inputs` — flat map of abstract FI-selected brand values (e.g.
|
|
60
|
+
* `brandPrimary`, `displayFont`). Palette generation expands these into
|
|
61
|
+
* full token scales at runtime.
|
|
62
|
+
* - `overrides` — per-mode flat maps of token dot-paths to resolved values
|
|
63
|
+
* for direct semantic token overrides beyond what inputs generate.
|
|
64
|
+
* - `$extensions` — required metadata including base preset and schema version.
|
|
56
65
|
*/
|
|
57
|
-
export
|
|
58
|
-
$extensions
|
|
59
|
-
'com.candescent.themeOverride'
|
|
66
|
+
export interface ThemeOverride {
|
|
67
|
+
$extensions: {
|
|
68
|
+
'com.candescent.themeOverride': ThemeOverrideMetadata;
|
|
60
69
|
[key: string]: unknown;
|
|
61
70
|
};
|
|
62
|
-
|
|
71
|
+
inputs?: Record<string, string | number>;
|
|
72
|
+
overrides?: Partial<Record<Mode, Record<string, string | number>>>;
|
|
73
|
+
}
|
|
63
74
|
|
|
64
75
|
export type Mode = 'light' | 'dark';
|
|
65
76
|
export type Platform = 'web' | 'ios' | 'android';
|
|
66
77
|
|
|
78
|
+
// ---------------------------------------------------------------------------
|
|
79
|
+
// Constants
|
|
80
|
+
// ---------------------------------------------------------------------------
|
|
81
|
+
|
|
82
|
+
/** Current override schema version. Consuming apps gate compatibility on this. */
|
|
83
|
+
export const OVERRIDE_SCHEMA_VERSION = '1.0.0' as const;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Schema versions that consuming apps accept. Includes the current version and
|
|
87
|
+
* may include the immediately prior version during transition windows.
|
|
88
|
+
* @see docs/internal/token-architecture/16-override-structure.md § 4
|
|
89
|
+
*/
|
|
90
|
+
export const SUPPORTED_OVERRIDE_SCHEMA_VERSIONS: readonly string[] = ['1.0.0'] as const;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Schema-level mapping from known input keys to the token path pattern each
|
|
94
|
+
* affects. Used by override application (S5) to route inputs to the correct
|
|
95
|
+
* palette/token namespace. Distinct from the full runtime map (S3).
|
|
96
|
+
*/
|
|
97
|
+
export const INPUT_TOKEN_MAP = {
|
|
98
|
+
brandPrimary: 'color.brand',
|
|
99
|
+
accentPrimary: 'color.accent',
|
|
100
|
+
basePrimary: 'color.base',
|
|
101
|
+
displayFont: 'font.display',
|
|
102
|
+
} as const satisfies Record<string, string>;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Allowed display font families per preset, consumed by the theme editor for
|
|
106
|
+
* font selection and by consuming apps for validation.
|
|
107
|
+
*/
|
|
108
|
+
export const presetFonts: Record<Preset, readonly string[]> = {
|
|
109
|
+
poise: ['Crimson Pro', 'Bitter', 'DM Sans'],
|
|
110
|
+
prestige: ['Libre Caslon Text', 'Cormorant', 'Libre Franklin'],
|
|
111
|
+
pulse: ['Outfit', 'Manrope', 'Public Sans'],
|
|
112
|
+
} as const;
|
|
113
|
+
|
|
67
114
|
// ---------------------------------------------------------------------------
|
|
68
115
|
// Hooks
|
|
69
116
|
// ---------------------------------------------------------------------------
|