@tekton-ui/core 0.2.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 +758 -0
- package/dist/blueprint.d.ts +44 -0
- package/dist/blueprint.d.ts.map +1 -0
- package/dist/blueprint.js +163 -0
- package/dist/blueprint.js.map +1 -0
- package/dist/component-schemas.d.ts +78 -0
- package/dist/component-schemas.d.ts.map +1 -0
- package/dist/component-schemas.js +1037 -0
- package/dist/component-schemas.js.map +1 -0
- package/dist/css-generator.d.ts +42 -0
- package/dist/css-generator.d.ts.map +1 -0
- package/dist/css-generator.js +339 -0
- package/dist/css-generator.js.map +1 -0
- package/dist/icon-library.d.ts +109 -0
- package/dist/icon-library.d.ts.map +1 -0
- package/dist/icon-library.js +204 -0
- package/dist/icon-library.js.map +1 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -0
- package/dist/layout-css-generator.d.ts +158 -0
- package/dist/layout-css-generator.d.ts.map +1 -0
- package/dist/layout-css-generator.js +901 -0
- package/dist/layout-css-generator.js.map +1 -0
- package/dist/layout-resolver.d.ts +92 -0
- package/dist/layout-resolver.d.ts.map +1 -0
- package/dist/layout-resolver.js +275 -0
- package/dist/layout-resolver.js.map +1 -0
- package/dist/layout-tokens/index.d.ts +16 -0
- package/dist/layout-tokens/index.d.ts.map +1 -0
- package/dist/layout-tokens/index.js +16 -0
- package/dist/layout-tokens/index.js.map +1 -0
- package/dist/layout-tokens/keyboard.d.ts +254 -0
- package/dist/layout-tokens/keyboard.d.ts.map +1 -0
- package/dist/layout-tokens/keyboard.js +407 -0
- package/dist/layout-tokens/keyboard.js.map +1 -0
- package/dist/layout-tokens/mobile-shells.d.ts +78 -0
- package/dist/layout-tokens/mobile-shells.d.ts.map +1 -0
- package/dist/layout-tokens/mobile-shells.js +635 -0
- package/dist/layout-tokens/mobile-shells.js.map +1 -0
- package/dist/layout-tokens/pages.d.ts +100 -0
- package/dist/layout-tokens/pages.d.ts.map +1 -0
- package/dist/layout-tokens/pages.js +576 -0
- package/dist/layout-tokens/pages.js.map +1 -0
- package/dist/layout-tokens/responsive.d.ts +109 -0
- package/dist/layout-tokens/responsive.d.ts.map +1 -0
- package/dist/layout-tokens/responsive.js +167 -0
- package/dist/layout-tokens/responsive.js.map +1 -0
- package/dist/layout-tokens/safe-area.d.ts +156 -0
- package/dist/layout-tokens/safe-area.d.ts.map +1 -0
- package/dist/layout-tokens/safe-area.js +316 -0
- package/dist/layout-tokens/safe-area.js.map +1 -0
- package/dist/layout-tokens/sections-advanced.d.ts +277 -0
- package/dist/layout-tokens/sections-advanced.d.ts.map +1 -0
- package/dist/layout-tokens/sections-advanced.js +593 -0
- package/dist/layout-tokens/sections-advanced.js.map +1 -0
- package/dist/layout-tokens/sections.d.ts +137 -0
- package/dist/layout-tokens/sections.d.ts.map +1 -0
- package/dist/layout-tokens/sections.js +694 -0
- package/dist/layout-tokens/sections.js.map +1 -0
- package/dist/layout-tokens/shells.d.ts +77 -0
- package/dist/layout-tokens/shells.d.ts.map +1 -0
- package/dist/layout-tokens/shells.js +408 -0
- package/dist/layout-tokens/shells.js.map +1 -0
- package/dist/layout-tokens/touch-target.d.ts +119 -0
- package/dist/layout-tokens/touch-target.d.ts.map +1 -0
- package/dist/layout-tokens/touch-target.js +156 -0
- package/dist/layout-tokens/touch-target.js.map +1 -0
- package/dist/layout-tokens/types.d.ts +632 -0
- package/dist/layout-tokens/types.d.ts.map +1 -0
- package/dist/layout-tokens/types.js +49 -0
- package/dist/layout-tokens/types.js.map +1 -0
- package/dist/layout-validation.d.ts +1547 -0
- package/dist/layout-validation.d.ts.map +1 -0
- package/dist/layout-validation.js +628 -0
- package/dist/layout-validation.js.map +1 -0
- package/dist/render.d.ts +23 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/render.js +244 -0
- package/dist/render.js.map +1 -0
- package/dist/schema-validation.d.ts +208 -0
- package/dist/schema-validation.d.ts.map +1 -0
- package/dist/schema-validation.js +205 -0
- package/dist/schema-validation.js.map +1 -0
- package/dist/screen-generation/generators/css-in-js-generator.d.ts +82 -0
- package/dist/screen-generation/generators/css-in-js-generator.d.ts.map +1 -0
- package/dist/screen-generation/generators/css-in-js-generator.js +335 -0
- package/dist/screen-generation/generators/css-in-js-generator.js.map +1 -0
- package/dist/screen-generation/generators/index.d.ts +13 -0
- package/dist/screen-generation/generators/index.d.ts.map +1 -0
- package/dist/screen-generation/generators/index.js +32 -0
- package/dist/screen-generation/generators/index.js.map +1 -0
- package/dist/screen-generation/generators/react-generator.d.ts +100 -0
- package/dist/screen-generation/generators/react-generator.d.ts.map +1 -0
- package/dist/screen-generation/generators/react-generator.js +379 -0
- package/dist/screen-generation/generators/react-generator.js.map +1 -0
- package/dist/screen-generation/generators/tailwind-generator.d.ts +105 -0
- package/dist/screen-generation/generators/tailwind-generator.d.ts.map +1 -0
- package/dist/screen-generation/generators/tailwind-generator.js +355 -0
- package/dist/screen-generation/generators/tailwind-generator.js.map +1 -0
- package/dist/screen-generation/generators/types.d.ts +136 -0
- package/dist/screen-generation/generators/types.d.ts.map +1 -0
- package/dist/screen-generation/generators/types.js +18 -0
- package/dist/screen-generation/generators/types.js.map +1 -0
- package/dist/screen-generation/generators/utils.d.ts +187 -0
- package/dist/screen-generation/generators/utils.d.ts.map +1 -0
- package/dist/screen-generation/generators/utils.js +312 -0
- package/dist/screen-generation/generators/utils.js.map +1 -0
- package/dist/screen-generation/index.d.ts +14 -0
- package/dist/screen-generation/index.d.ts.map +1 -0
- package/dist/screen-generation/index.js +33 -0
- package/dist/screen-generation/index.js.map +1 -0
- package/dist/screen-generation/resolver/component-resolver.d.ts +157 -0
- package/dist/screen-generation/resolver/component-resolver.d.ts.map +1 -0
- package/dist/screen-generation/resolver/component-resolver.js +295 -0
- package/dist/screen-generation/resolver/component-resolver.js.map +1 -0
- package/dist/screen-generation/resolver/index.d.ts +10 -0
- package/dist/screen-generation/resolver/index.d.ts.map +1 -0
- package/dist/screen-generation/resolver/index.js +46 -0
- package/dist/screen-generation/resolver/index.js.map +1 -0
- package/dist/screen-generation/resolver/layout-resolver.d.ts +155 -0
- package/dist/screen-generation/resolver/layout-resolver.d.ts.map +1 -0
- package/dist/screen-generation/resolver/layout-resolver.js +193 -0
- package/dist/screen-generation/resolver/layout-resolver.js.map +1 -0
- package/dist/screen-generation/resolver/screen-resolver.d.ts +174 -0
- package/dist/screen-generation/resolver/screen-resolver.d.ts.map +1 -0
- package/dist/screen-generation/resolver/screen-resolver.js +373 -0
- package/dist/screen-generation/resolver/screen-resolver.js.map +1 -0
- package/dist/screen-generation/resolver/token-resolver.d.ts +170 -0
- package/dist/screen-generation/resolver/token-resolver.d.ts.map +1 -0
- package/dist/screen-generation/resolver/token-resolver.js +260 -0
- package/dist/screen-generation/resolver/token-resolver.js.map +1 -0
- package/dist/screen-generation/types.d.ts +116 -0
- package/dist/screen-generation/types.d.ts.map +1 -0
- package/dist/screen-generation/types.js +33 -0
- package/dist/screen-generation/types.js.map +1 -0
- package/dist/screen-generation/validators.d.ts +286 -0
- package/dist/screen-generation/validators.d.ts.map +1 -0
- package/dist/screen-generation/validators.js +323 -0
- package/dist/screen-generation/validators.js.map +1 -0
- package/dist/screen-templates/__tests__/registry.test.d.ts +6 -0
- package/dist/screen-templates/__tests__/registry.test.d.ts.map +1 -0
- package/dist/screen-templates/__tests__/registry.test.js +247 -0
- package/dist/screen-templates/__tests__/registry.test.js.map +1 -0
- package/dist/screen-templates/__tests__/templates.test.d.ts +6 -0
- package/dist/screen-templates/__tests__/templates.test.d.ts.map +1 -0
- package/dist/screen-templates/__tests__/templates.test.js +179 -0
- package/dist/screen-templates/__tests__/templates.test.js.map +1 -0
- package/dist/screen-templates/index.d.ts +39 -0
- package/dist/screen-templates/index.d.ts.map +1 -0
- package/dist/screen-templates/index.js +79 -0
- package/dist/screen-templates/index.js.map +1 -0
- package/dist/screen-templates/registry.d.ts +177 -0
- package/dist/screen-templates/registry.d.ts.map +1 -0
- package/dist/screen-templates/registry.js +274 -0
- package/dist/screen-templates/registry.js.map +1 -0
- package/dist/screen-templates/templates/account/index.d.ts +6 -0
- package/dist/screen-templates/templates/account/index.d.ts.map +1 -0
- package/dist/screen-templates/templates/account/index.js +6 -0
- package/dist/screen-templates/templates/account/index.js.map +1 -0
- package/dist/screen-templates/templates/account/profile.d.ts +23 -0
- package/dist/screen-templates/templates/account/profile.d.ts.map +1 -0
- package/dist/screen-templates/templates/account/profile.js +249 -0
- package/dist/screen-templates/templates/account/profile.js.map +1 -0
- package/dist/screen-templates/templates/auth/forgot-password.d.ts +23 -0
- package/dist/screen-templates/templates/auth/forgot-password.d.ts.map +1 -0
- package/dist/screen-templates/templates/auth/forgot-password.js +203 -0
- package/dist/screen-templates/templates/auth/forgot-password.js.map +1 -0
- package/dist/screen-templates/templates/auth/index.d.ts +9 -0
- package/dist/screen-templates/templates/auth/index.d.ts.map +1 -0
- package/dist/screen-templates/templates/auth/index.js +9 -0
- package/dist/screen-templates/templates/auth/index.js.map +1 -0
- package/dist/screen-templates/templates/auth/login.d.ts +24 -0
- package/dist/screen-templates/templates/auth/login.d.ts.map +1 -0
- package/dist/screen-templates/templates/auth/login.js +254 -0
- package/dist/screen-templates/templates/auth/login.js.map +1 -0
- package/dist/screen-templates/templates/auth/signup.d.ts +24 -0
- package/dist/screen-templates/templates/auth/signup.d.ts.map +1 -0
- package/dist/screen-templates/templates/auth/signup.js +315 -0
- package/dist/screen-templates/templates/auth/signup.js.map +1 -0
- package/dist/screen-templates/templates/auth/verification.d.ts +23 -0
- package/dist/screen-templates/templates/auth/verification.d.ts.map +1 -0
- package/dist/screen-templates/templates/auth/verification.js +239 -0
- package/dist/screen-templates/templates/auth/verification.js.map +1 -0
- package/dist/screen-templates/templates/feedback/confirmation.d.ts +9 -0
- package/dist/screen-templates/templates/feedback/confirmation.d.ts.map +1 -0
- package/dist/screen-templates/templates/feedback/confirmation.js +107 -0
- package/dist/screen-templates/templates/feedback/confirmation.js.map +1 -0
- package/dist/screen-templates/templates/feedback/empty.d.ts +9 -0
- package/dist/screen-templates/templates/feedback/empty.d.ts.map +1 -0
- package/dist/screen-templates/templates/feedback/empty.js +90 -0
- package/dist/screen-templates/templates/feedback/empty.js.map +1 -0
- package/dist/screen-templates/templates/feedback/error.d.ts +9 -0
- package/dist/screen-templates/templates/feedback/error.d.ts.map +1 -0
- package/dist/screen-templates/templates/feedback/error.js +99 -0
- package/dist/screen-templates/templates/feedback/error.js.map +1 -0
- package/dist/screen-templates/templates/feedback/index.d.ts +10 -0
- package/dist/screen-templates/templates/feedback/index.d.ts.map +1 -0
- package/dist/screen-templates/templates/feedback/index.js +10 -0
- package/dist/screen-templates/templates/feedback/index.js.map +1 -0
- package/dist/screen-templates/templates/feedback/loading.d.ts +9 -0
- package/dist/screen-templates/templates/feedback/loading.d.ts.map +1 -0
- package/dist/screen-templates/templates/feedback/loading.js +77 -0
- package/dist/screen-templates/templates/feedback/loading.js.map +1 -0
- package/dist/screen-templates/templates/feedback/success.d.ts +9 -0
- package/dist/screen-templates/templates/feedback/success.d.ts.map +1 -0
- package/dist/screen-templates/templates/feedback/success.js +99 -0
- package/dist/screen-templates/templates/feedback/success.js.map +1 -0
- package/dist/screen-templates/templates/home/index.d.ts +6 -0
- package/dist/screen-templates/templates/home/index.d.ts.map +1 -0
- package/dist/screen-templates/templates/home/index.js +6 -0
- package/dist/screen-templates/templates/home/index.js.map +1 -0
- package/dist/screen-templates/templates/home/landing.d.ts +24 -0
- package/dist/screen-templates/templates/home/landing.d.ts.map +1 -0
- package/dist/screen-templates/templates/home/landing.js +197 -0
- package/dist/screen-templates/templates/home/landing.js.map +1 -0
- package/dist/screen-templates/templates/settings/index.d.ts +6 -0
- package/dist/screen-templates/templates/settings/index.d.ts.map +1 -0
- package/dist/screen-templates/templates/settings/index.js +6 -0
- package/dist/screen-templates/templates/settings/index.js.map +1 -0
- package/dist/screen-templates/templates/settings/preferences.d.ts +24 -0
- package/dist/screen-templates/templates/settings/preferences.d.ts.map +1 -0
- package/dist/screen-templates/templates/settings/preferences.js +265 -0
- package/dist/screen-templates/templates/settings/preferences.js.map +1 -0
- package/dist/screen-templates/types.d.ts +229 -0
- package/dist/screen-templates/types.d.ts.map +1 -0
- package/dist/screen-templates/types.js +7 -0
- package/dist/screen-templates/types.js.map +1 -0
- package/dist/theme-v2.d.ts +228 -0
- package/dist/theme-v2.d.ts.map +1 -0
- package/dist/theme-v2.js +158 -0
- package/dist/theme-v2.js.map +1 -0
- package/dist/theme.d.ts +60 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +76 -0
- package/dist/theme.js.map +1 -0
- package/dist/token-resolver.d.ts +69 -0
- package/dist/token-resolver.d.ts.map +1 -0
- package/dist/token-resolver.js +122 -0
- package/dist/token-resolver.js.map +1 -0
- package/dist/token-validation.d.ts +432 -0
- package/dist/token-validation.d.ts.map +1 -0
- package/dist/token-validation.js +140 -0
- package/dist/token-validation.js.map +1 -0
- package/dist/tokens.d.ts +158 -0
- package/dist/tokens.d.ts.map +1 -0
- package/dist/tokens.js +10 -0
- package/dist/tokens.js.map +1 -0
- package/dist/types.d.ts +77 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/package.json +53 -0
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @tekton-ui/core - Theme Module v2.1
|
|
3
|
+
* Load and manage v2.1 theme definitions from .moai/themes/generated/
|
|
4
|
+
* [SPEC-LAYOUT-002] [THEME-V2]
|
|
5
|
+
*/
|
|
6
|
+
/** OKLCH color format */
|
|
7
|
+
export interface OKLCHColorV2 {
|
|
8
|
+
l: number;
|
|
9
|
+
c: number;
|
|
10
|
+
h: number;
|
|
11
|
+
}
|
|
12
|
+
/** Design DNA - Qualitative essence from reference images */
|
|
13
|
+
export interface DesignDNA {
|
|
14
|
+
moodKeywords: string[];
|
|
15
|
+
targetEmotion: string;
|
|
16
|
+
visualAtmosphere: string;
|
|
17
|
+
}
|
|
18
|
+
/** Atomic Tokens - Layer 1 */
|
|
19
|
+
export interface AtomicTokensV2 {
|
|
20
|
+
color: {
|
|
21
|
+
brand?: Record<string, OKLCHColorV2>;
|
|
22
|
+
neutral?: Record<string, OKLCHColorV2>;
|
|
23
|
+
accent?: Record<string, OKLCHColorV2>;
|
|
24
|
+
success?: OKLCHColorV2;
|
|
25
|
+
warning?: OKLCHColorV2;
|
|
26
|
+
error?: OKLCHColorV2;
|
|
27
|
+
info?: OKLCHColorV2;
|
|
28
|
+
};
|
|
29
|
+
spacing: Record<string, string>;
|
|
30
|
+
radius: Record<string, string>;
|
|
31
|
+
}
|
|
32
|
+
/** Semantic Tokens - Layer 2 */
|
|
33
|
+
export interface SemanticTokensV2 {
|
|
34
|
+
background?: {
|
|
35
|
+
canvas?: string;
|
|
36
|
+
surface?: {
|
|
37
|
+
subtle?: string;
|
|
38
|
+
default?: string;
|
|
39
|
+
emphasis?: string;
|
|
40
|
+
};
|
|
41
|
+
elevated?: Record<string, string>;
|
|
42
|
+
inverse?: Record<string, string>;
|
|
43
|
+
brand?: Record<string, string>;
|
|
44
|
+
};
|
|
45
|
+
foreground?: {
|
|
46
|
+
primary?: Record<string, string>;
|
|
47
|
+
secondary?: Record<string, string>;
|
|
48
|
+
inverse?: Record<string, string>;
|
|
49
|
+
brand?: Record<string, string>;
|
|
50
|
+
disabled?: string;
|
|
51
|
+
placeholder?: string;
|
|
52
|
+
};
|
|
53
|
+
border?: {
|
|
54
|
+
default?: {
|
|
55
|
+
subtle?: string;
|
|
56
|
+
default?: string;
|
|
57
|
+
emphasis?: string;
|
|
58
|
+
};
|
|
59
|
+
focus?: string;
|
|
60
|
+
error?: string;
|
|
61
|
+
success?: string;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/** Component Tokens - Layer 3 */
|
|
65
|
+
export interface ComponentTokensV2 {
|
|
66
|
+
[component: string]: Record<string, unknown>;
|
|
67
|
+
}
|
|
68
|
+
/** State Layer Tokens (MD3 approach) */
|
|
69
|
+
export interface StateLayerTokens {
|
|
70
|
+
hover?: {
|
|
71
|
+
opacity?: number;
|
|
72
|
+
overlayColor?: {
|
|
73
|
+
onLight?: string;
|
|
74
|
+
onDark?: string;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
pressed?: {
|
|
78
|
+
opacity?: number;
|
|
79
|
+
};
|
|
80
|
+
focus?: {
|
|
81
|
+
opacity?: number;
|
|
82
|
+
ring?: {
|
|
83
|
+
width?: string;
|
|
84
|
+
offset?: string;
|
|
85
|
+
color?: string;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
disabled?: {
|
|
89
|
+
opacity?: number;
|
|
90
|
+
contentOpacity?: number;
|
|
91
|
+
};
|
|
92
|
+
dragged?: {
|
|
93
|
+
opacity?: number;
|
|
94
|
+
elevation?: string;
|
|
95
|
+
};
|
|
96
|
+
selected?: {
|
|
97
|
+
opacity?: number;
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
/** Motion Tokens */
|
|
101
|
+
export interface MotionTokens {
|
|
102
|
+
duration?: Record<string, string>;
|
|
103
|
+
easing?: Record<string, string>;
|
|
104
|
+
preset?: Record<string, unknown>;
|
|
105
|
+
}
|
|
106
|
+
/** Elevation Tokens */
|
|
107
|
+
export interface ElevationTokens {
|
|
108
|
+
level?: Record<string, string>;
|
|
109
|
+
context?: Record<string, string>;
|
|
110
|
+
color?: Record<string, string>;
|
|
111
|
+
}
|
|
112
|
+
/** Border Tokens */
|
|
113
|
+
export interface BorderTokens {
|
|
114
|
+
width?: Record<string, string>;
|
|
115
|
+
style?: Record<string, string>;
|
|
116
|
+
radius?: Record<string, string>;
|
|
117
|
+
}
|
|
118
|
+
/** Typography Tokens */
|
|
119
|
+
export interface TypographyTokens {
|
|
120
|
+
fontFamily?: Record<string, string>;
|
|
121
|
+
fontSize?: Record<string, string>;
|
|
122
|
+
fontWeight?: Record<string, string>;
|
|
123
|
+
lineHeight?: Record<string, string>;
|
|
124
|
+
letterSpacing?: Record<string, string>;
|
|
125
|
+
textTransform?: Record<string, string>;
|
|
126
|
+
preset?: Record<string, unknown>;
|
|
127
|
+
}
|
|
128
|
+
/** Density Tokens */
|
|
129
|
+
export interface DensityTokens {
|
|
130
|
+
mode?: 'compact' | 'comfortable' | 'spacious';
|
|
131
|
+
scale?: Record<string, number>;
|
|
132
|
+
spacing?: Record<string, string>;
|
|
133
|
+
sizing?: Record<string, unknown>;
|
|
134
|
+
}
|
|
135
|
+
/** Effects Tokens */
|
|
136
|
+
export interface EffectsTokens {
|
|
137
|
+
blur?: Record<string, string>;
|
|
138
|
+
backdrop?: {
|
|
139
|
+
blur?: string;
|
|
140
|
+
saturate?: string;
|
|
141
|
+
brightness?: string;
|
|
142
|
+
};
|
|
143
|
+
glassmorphism?: {
|
|
144
|
+
enabled?: boolean;
|
|
145
|
+
background?: string;
|
|
146
|
+
blur?: string;
|
|
147
|
+
border?: string;
|
|
148
|
+
};
|
|
149
|
+
gradient?: Record<string, string>;
|
|
150
|
+
overlay?: Record<string, string>;
|
|
151
|
+
}
|
|
152
|
+
/** AI Context for LLM consumption */
|
|
153
|
+
export interface AIContext {
|
|
154
|
+
designPhilosophy?: string;
|
|
155
|
+
colorGuidance?: string;
|
|
156
|
+
componentGuidance?: string;
|
|
157
|
+
spacingGuidance?: string;
|
|
158
|
+
accessibilityNotes?: string;
|
|
159
|
+
}
|
|
160
|
+
/** Dark Mode Overrides */
|
|
161
|
+
export interface DarkModeOverrides {
|
|
162
|
+
tokens?: {
|
|
163
|
+
semantic?: Partial<SemanticTokensV2>;
|
|
164
|
+
};
|
|
165
|
+
stateLayer?: Partial<StateLayerTokens>;
|
|
166
|
+
elevation?: Partial<ElevationTokens>;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Theme V2.1 - Visual DNA Only
|
|
170
|
+
* Pure visual design tokens without layout information
|
|
171
|
+
*/
|
|
172
|
+
export interface ThemeV2 {
|
|
173
|
+
id: string;
|
|
174
|
+
name: string;
|
|
175
|
+
description?: string;
|
|
176
|
+
schemaVersion: '2.1';
|
|
177
|
+
brandTone: 'professional' | 'playful' | 'elegant' | 'bold' | 'minimal' | 'calm' | 'dynamic' | 'premium' | 'warm';
|
|
178
|
+
designDNA?: DesignDNA;
|
|
179
|
+
tokens: {
|
|
180
|
+
atomic: AtomicTokensV2;
|
|
181
|
+
semantic: SemanticTokensV2;
|
|
182
|
+
component?: ComponentTokensV2;
|
|
183
|
+
};
|
|
184
|
+
stateLayer: StateLayerTokens;
|
|
185
|
+
motion: MotionTokens;
|
|
186
|
+
elevation: ElevationTokens;
|
|
187
|
+
border: BorderTokens;
|
|
188
|
+
typography: TypographyTokens;
|
|
189
|
+
density: DensityTokens;
|
|
190
|
+
effects?: EffectsTokens;
|
|
191
|
+
darkMode?: DarkModeOverrides;
|
|
192
|
+
aiContext?: AIContext;
|
|
193
|
+
}
|
|
194
|
+
/** Theme metadata for listing */
|
|
195
|
+
export interface ThemeMetaV2 {
|
|
196
|
+
id: string;
|
|
197
|
+
name: string;
|
|
198
|
+
description?: string;
|
|
199
|
+
brandTone: string;
|
|
200
|
+
schemaVersion: string;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Load theme from .moai/themes/generated/ directory
|
|
204
|
+
* @param themeId - Theme identifier (kebab-case, e.g., "atlantic-magazine-v1")
|
|
205
|
+
* @returns Loaded theme or null if not found
|
|
206
|
+
*/
|
|
207
|
+
export declare function loadThemeV2(themeId: string): ThemeV2 | null;
|
|
208
|
+
/**
|
|
209
|
+
* List all available themes from .moai/themes/generated/
|
|
210
|
+
* @returns Array of theme metadata
|
|
211
|
+
*/
|
|
212
|
+
export declare function listThemesV2(): ThemeMetaV2[];
|
|
213
|
+
/**
|
|
214
|
+
* Check if a theme exists
|
|
215
|
+
* @param themeId - Theme identifier
|
|
216
|
+
* @returns true if theme exists
|
|
217
|
+
*/
|
|
218
|
+
export declare function themeExistsV2(themeId: string): boolean;
|
|
219
|
+
/**
|
|
220
|
+
* Convert OKLCH color object to CSS string
|
|
221
|
+
*/
|
|
222
|
+
export declare function oklchToCSSV2(color: OKLCHColorV2): string;
|
|
223
|
+
/**
|
|
224
|
+
* Resolve a token reference to its actual value
|
|
225
|
+
* Supports: atomic.*, semantic.*, elevation.* references
|
|
226
|
+
*/
|
|
227
|
+
export declare function resolveTokenRef(ref: string, theme: ThemeV2): string | null;
|
|
228
|
+
//# sourceMappingURL=theme-v2.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-v2.d.ts","sourceRoot":"","sources":["../src/theme-v2.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,yBAAyB;AACzB,MAAM,WAAW,YAAY;IAC3B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,6DAA6D;AAC7D,MAAM,WAAW,SAAS;IACxB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,8BAA8B;AAC9B,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE;QACL,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QACrC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QACvC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QACtC,OAAO,CAAC,EAAE,YAAY,CAAC;QACvB,OAAO,CAAC,EAAE,YAAY,CAAC;QACvB,KAAK,CAAC,EAAE,YAAY,CAAC;QACrB,IAAI,CAAC,EAAE,YAAY,CAAC;KACrB,CAAC;IACF,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA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|
|
4
|
+
* [SPEC-LAYOUT-002] [THEME-V2]
|
|
5
|
+
*/
|
|
6
|
+
import { readFileSync, readdirSync, existsSync } from 'node:fs';
|
|
7
|
+
import { join, resolve } from 'node:path';
|
|
8
|
+
// ============================================================================
|
|
9
|
+
// Theme Directory Resolution
|
|
10
|
+
// ============================================================================
|
|
11
|
+
/**
|
|
12
|
+
* Find project root by looking for .moai directory
|
|
13
|
+
*/
|
|
14
|
+
function findProjectRoot(startDir) {
|
|
15
|
+
let currentDir = startDir;
|
|
16
|
+
const root = '/';
|
|
17
|
+
while (currentDir !== root) {
|
|
18
|
+
if (existsSync(join(currentDir, '.moai'))) {
|
|
19
|
+
return currentDir;
|
|
20
|
+
}
|
|
21
|
+
currentDir = resolve(currentDir, '..');
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Get themes directory path
|
|
27
|
+
* Returns .moai/themes/generated/ from project root
|
|
28
|
+
*/
|
|
29
|
+
function getThemesDir() {
|
|
30
|
+
const projectRoot = findProjectRoot(process.cwd());
|
|
31
|
+
if (!projectRoot) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
return join(projectRoot, '.moai', 'themes', 'generated');
|
|
35
|
+
}
|
|
36
|
+
// ============================================================================
|
|
37
|
+
// Theme Loading Functions
|
|
38
|
+
// ============================================================================
|
|
39
|
+
/**
|
|
40
|
+
* Load theme from .moai/themes/generated/ directory
|
|
41
|
+
* @param themeId - Theme identifier (kebab-case, e.g., "atlantic-magazine-v1")
|
|
42
|
+
* @returns Loaded theme or null if not found
|
|
43
|
+
*/
|
|
44
|
+
export function loadThemeV2(themeId) {
|
|
45
|
+
// Security: Prevent path traversal attacks
|
|
46
|
+
if (!themeId || !/^[a-z0-9-]+$/.test(themeId)) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
const themesDir = getThemesDir();
|
|
50
|
+
if (!themesDir || !existsSync(themesDir)) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
const themePath = join(themesDir, `${themeId}.json`);
|
|
54
|
+
if (!existsSync(themePath)) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
try {
|
|
58
|
+
const content = readFileSync(themePath, 'utf-8');
|
|
59
|
+
const theme = JSON.parse(content);
|
|
60
|
+
// Validate schema version
|
|
61
|
+
if (theme.schemaVersion !== '2.1') {
|
|
62
|
+
console.warn(`Theme ${themeId} has invalid schema version: ${theme.schemaVersion}`);
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
return theme;
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
console.error(`Failed to load theme ${themeId}:`, error);
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* List all available themes from .moai/themes/generated/
|
|
74
|
+
* @returns Array of theme metadata
|
|
75
|
+
*/
|
|
76
|
+
export function listThemesV2() {
|
|
77
|
+
const themesDir = getThemesDir();
|
|
78
|
+
if (!themesDir || !existsSync(themesDir)) {
|
|
79
|
+
return [];
|
|
80
|
+
}
|
|
81
|
+
const files = readdirSync(themesDir).filter(f => f.endsWith('.json'));
|
|
82
|
+
const themes = [];
|
|
83
|
+
for (const file of files) {
|
|
84
|
+
const themeId = file.replace('.json', '');
|
|
85
|
+
const theme = loadThemeV2(themeId);
|
|
86
|
+
if (theme) {
|
|
87
|
+
themes.push({
|
|
88
|
+
id: theme.id,
|
|
89
|
+
name: theme.name,
|
|
90
|
+
description: theme.description,
|
|
91
|
+
brandTone: theme.brandTone,
|
|
92
|
+
schemaVersion: theme.schemaVersion,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return themes;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Check if a theme exists
|
|
100
|
+
* @param themeId - Theme identifier
|
|
101
|
+
* @returns true if theme exists
|
|
102
|
+
*/
|
|
103
|
+
export function themeExistsV2(themeId) {
|
|
104
|
+
if (!themeId || !/^[a-z0-9-]+$/.test(themeId)) {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
const themesDir = getThemesDir();
|
|
108
|
+
if (!themesDir) {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
return existsSync(join(themesDir, `${themeId}.json`));
|
|
112
|
+
}
|
|
113
|
+
// ============================================================================
|
|
114
|
+
// Color Utilities
|
|
115
|
+
// ============================================================================
|
|
116
|
+
/**
|
|
117
|
+
* Convert OKLCH color object to CSS string
|
|
118
|
+
*/
|
|
119
|
+
export function oklchToCSSV2(color) {
|
|
120
|
+
const l = Math.max(0, Math.min(1, color.l));
|
|
121
|
+
const c = Math.max(0, Math.min(0.5, color.c));
|
|
122
|
+
const h = ((color.h % 360) + 360) % 360;
|
|
123
|
+
return `oklch(${l} ${c} ${h})`;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Resolve a token reference to its actual value
|
|
127
|
+
* Supports: atomic.*, semantic.*, elevation.* references
|
|
128
|
+
*/
|
|
129
|
+
export function resolveTokenRef(ref, theme) {
|
|
130
|
+
if (!ref.includes('.')) {
|
|
131
|
+
return ref; // Not a reference, return as-is
|
|
132
|
+
}
|
|
133
|
+
const parts = ref.split('.');
|
|
134
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
135
|
+
let current = theme;
|
|
136
|
+
// Navigate through: "atomic.color.brand.500" -> theme.tokens.atomic.color.brand.500
|
|
137
|
+
if (parts[0] === 'atomic' || parts[0] === 'semantic' || parts[0] === 'component') {
|
|
138
|
+
current = theme.tokens;
|
|
139
|
+
}
|
|
140
|
+
for (const part of parts) {
|
|
141
|
+
if (current && typeof current === 'object' && part in current) {
|
|
142
|
+
current = current[part];
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
// If result is OKLCH color object, convert to CSS
|
|
149
|
+
if (current &&
|
|
150
|
+
typeof current === 'object' &&
|
|
151
|
+
'l' in current &&
|
|
152
|
+
'c' in current &&
|
|
153
|
+
'h' in current) {
|
|
154
|
+
return oklchToCSSV2(current);
|
|
155
|
+
}
|
|
156
|
+
return typeof current === 'string' ? current : null;
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=theme-v2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-v2.js","sourceRoot":"","sources":["../src/theme-v2.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAuO1C,+EAA+E;AAC/E,6BAA6B;AAC7B,+EAA+E;AAE/E;;GAEG;AACH,SAAS,eAAe,CAAC,QAAgB;IACvC,IAAI,UAAU,GAAG,QAAQ,CAAC;IAC1B,MAAM,IAAI,GAAG,GAAG,CAAC;IAEjB,OAAO,UAAU,KAAK,IAAI,EAAE,CAAC;QAC3B,IAAI,UAAU,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;YAC1C,OAAO,UAAU,CAAC;QACpB,CAAC;QACD,UAAU,GAAG,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACzC,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;GAGG;AACH,SAAS,YAAY;IACnB,MAAM,WAAW,GAAG,eAAe,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACnD,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,IAAI,CAAC,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;AAC3D,CAAC;AAED,+EAA+E;AAC/E,0BAA0B;AAC1B,+EAA+E;AAE/E;;;;GAIG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ACd,CAAC;QACD,OAAO,YAAY,CAAC,OAAuB,CAAC,CAAC;IAC/C,CAAC;IAED,OAAO,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;AACtD,CAAC"}
|
package/dist/theme.d.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @tekton-ui/core - Theme Module
|
|
3
|
+
* v2.1 Theme System - Load themes from .moai/themes/generated/
|
|
4
|
+
*
|
|
5
|
+
* MIGRATION NOTICE:
|
|
6
|
+
* - v1 themes (packages/core/themes/) have been removed
|
|
7
|
+
* - All themes now use v2.1 schema from .moai/themes/generated/
|
|
8
|
+
* - Use loadThemeV2() and ThemeV2 type for new code
|
|
9
|
+
*/
|
|
10
|
+
export { type ThemeV2, type ThemeMetaV2, type DesignDNA, type AtomicTokensV2, type SemanticTokensV2, type ComponentTokensV2, type StateLayerTokens, type MotionTokens, type ElevationTokens, type BorderTokens, type TypographyTokens, type DensityTokens, type EffectsTokens, type AIContext, type DarkModeOverrides, type OKLCHColorV2, loadThemeV2, listThemesV2, themeExistsV2, oklchToCSSV2, resolveTokenRef, } from './theme-v2.js';
|
|
11
|
+
import { type ThemeV2, type ThemeMetaV2, type OKLCHColorV2 } from './theme-v2.js';
|
|
12
|
+
/**
|
|
13
|
+
* Load a theme by ID
|
|
14
|
+
* @param themeId - Theme identifier (e.g., "atlantic-magazine-v1")
|
|
15
|
+
* @returns Theme object or null if not found
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const theme = loadTheme('atlantic-magazine-v1');
|
|
20
|
+
* if (theme) {
|
|
21
|
+
* console.log(theme.brandTone); // "professional"
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function loadTheme(themeId: string): ThemeV2 | null;
|
|
26
|
+
/**
|
|
27
|
+
* List all available themes
|
|
28
|
+
* @returns Array of theme metadata
|
|
29
|
+
*/
|
|
30
|
+
export declare function listThemes(): ThemeMetaV2[];
|
|
31
|
+
/**
|
|
32
|
+
* Check if a theme exists
|
|
33
|
+
* @param themeId - Theme identifier
|
|
34
|
+
*/
|
|
35
|
+
export declare function themeExists(themeId: string): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Convert OKLCH color to CSS string
|
|
38
|
+
*/
|
|
39
|
+
export declare function oklchToCSS(color: OKLCHColorV2): string;
|
|
40
|
+
export type Theme = ThemeV2;
|
|
41
|
+
export type ThemeMeta = ThemeMetaV2;
|
|
42
|
+
export type OKLCHColor = OKLCHColorV2;
|
|
43
|
+
/**
|
|
44
|
+
* @deprecated v1 built-in themes have been removed. Use themes from .moai/themes/generated/
|
|
45
|
+
*/
|
|
46
|
+
export declare const BUILTIN_THEMES: readonly string[];
|
|
47
|
+
/**
|
|
48
|
+
* @deprecated v1 built-in themes have been removed
|
|
49
|
+
*/
|
|
50
|
+
export type BuiltinThemeId = never;
|
|
51
|
+
/**
|
|
52
|
+
* @deprecated v1 built-in themes have been removed
|
|
53
|
+
*/
|
|
54
|
+
export declare function isBuiltinTheme(_themeId: string): _themeId is BuiltinThemeId;
|
|
55
|
+
/**
|
|
56
|
+
* @deprecated Use theme tokens directly. This function provided minimal v1 CSS output.
|
|
57
|
+
* For v2.1, use generateThemeCSS() from css-generator.ts with proper token resolution.
|
|
58
|
+
*/
|
|
59
|
+
export declare function generateCSSVariables(_theme: ThemeV2): Record<string, string>;
|
|
60
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAEL,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,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
|
|
4
|
+
*
|
|
5
|
+
* MIGRATION NOTICE:
|
|
6
|
+
* - v1 themes (packages/core/themes/) have been removed
|
|
7
|
+
* - All themes now use v2.1 schema from .moai/themes/generated/
|
|
8
|
+
* - Use loadThemeV2() and ThemeV2 type for new code
|
|
9
|
+
*/
|
|
10
|
+
// Re-export all v2.1 theme functionality
|
|
11
|
+
export {
|
|
12
|
+
// Functions
|
|
13
|
+
loadThemeV2, listThemesV2, themeExistsV2, oklchToCSSV2, resolveTokenRef, } from './theme-v2.js';
|
|
14
|
+
// ============================================================================
|
|
15
|
+
// Convenience Aliases (Primary API)
|
|
16
|
+
// ============================================================================
|
|
17
|
+
import { loadThemeV2, listThemesV2, themeExistsV2, oklchToCSSV2, } from './theme-v2.js';
|
|
18
|
+
/**
|
|
19
|
+
* Load a theme by ID
|
|
20
|
+
* @param themeId - Theme identifier (e.g., "atlantic-magazine-v1")
|
|
21
|
+
* @returns Theme object or null if not found
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* const theme = loadTheme('atlantic-magazine-v1');
|
|
26
|
+
* if (theme) {
|
|
27
|
+
* console.log(theme.brandTone); // "professional"
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export function loadTheme(themeId) {
|
|
32
|
+
return loadThemeV2(themeId);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* List all available themes
|
|
36
|
+
* @returns Array of theme metadata
|
|
37
|
+
*/
|
|
38
|
+
export function listThemes() {
|
|
39
|
+
return listThemesV2();
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Check if a theme exists
|
|
43
|
+
* @param themeId - Theme identifier
|
|
44
|
+
*/
|
|
45
|
+
export function themeExists(themeId) {
|
|
46
|
+
return themeExistsV2(themeId);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Convert OKLCH color to CSS string
|
|
50
|
+
*/
|
|
51
|
+
export function oklchToCSS(color) {
|
|
52
|
+
return oklchToCSSV2(color);
|
|
53
|
+
}
|
|
54
|
+
// ============================================================================
|
|
55
|
+
// Deprecated - Remove in next major version
|
|
56
|
+
// ============================================================================
|
|
57
|
+
/**
|
|
58
|
+
* @deprecated v1 built-in themes have been removed. Use themes from .moai/themes/generated/
|
|
59
|
+
*/
|
|
60
|
+
export const BUILTIN_THEMES = [];
|
|
61
|
+
/**
|
|
62
|
+
* @deprecated v1 built-in themes have been removed
|
|
63
|
+
*/
|
|
64
|
+
export function isBuiltinTheme(_themeId) {
|
|
65
|
+
console.warn('isBuiltinTheme() is deprecated. All themes now come from .moai/themes/generated/');
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* @deprecated Use theme tokens directly. This function provided minimal v1 CSS output.
|
|
70
|
+
* For v2.1, use generateThemeCSS() from css-generator.ts with proper token resolution.
|
|
71
|
+
*/
|
|
72
|
+
export function generateCSSVariables(_theme) {
|
|
73
|
+
console.warn('generateCSSVariables() is deprecated. Use generateThemeCSS() for v2.1 themes.');
|
|
74
|
+
return {};
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,yCAAyC;AACzC,OAAO;AAmBL,YAAY;AACZ,WAAW,EACX,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,eAAe,GAChB,MAAM,eAAe,CAAC;AAEvB,+EAA+E;AAC/E,oCAAoC;AACpC,+EAA+E;AAE/E,OAAO,EACL,WAAW,EACX,YAAY,EACZ,aAAa,EACb,YAAY,GAIb,MAAM,eAAe,CAAC;AAEvB;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,SAAS,CAAC,OAAe;IACvC,OAAO,WAAW,CAAC,OAAO,CAAC,CAAC;AAC9B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,UAAU;IACxB,OAAO,YAAY,EAAE,CAAC;AACxB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,OAAO,aAAa,CAAC,OAAO,CAAC,CAAC;AAChC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,KAAmB;IAC5C,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC;AAOD,+EAA+E;AAC/E,4CAA4C;AAC5C,+EAA+E;AAE/E;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAsB,EAAE,CAAC;AAOpD;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,QAAgB;IAC7C,OAAO,CAAC,IAAI,CAAC,kFAAkF,CAAC,CAAC;IACjG,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAe;IAClD,OAAO,CAAC,IAAI,CAAC,+EAA+E,CAAC,CAAC;IAC9F,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @tekton-ui/core - Token Resolution Engine
|
|
3
|
+
* Resolves token references to final values with fallback chain support
|
|
4
|
+
* [SPEC-COMPONENT-001-A] [TOKEN-RESOLUTION]
|
|
5
|
+
*/
|
|
6
|
+
import type { ThemeWithTokens } from './tokens.js';
|
|
7
|
+
/** Token reference in dot notation: "atomic.color.blue.500" */
|
|
8
|
+
export type TokenReference = string;
|
|
9
|
+
/**
|
|
10
|
+
* Resolves a token reference to its final value
|
|
11
|
+
*
|
|
12
|
+
* Supports:
|
|
13
|
+
* - Dot-notation references: "atomic.color.blue.500"
|
|
14
|
+
* - Multi-level references: "component.button.primary.background" → "semantic.foreground.accent" → "atomic.color.blue.500"
|
|
15
|
+
* - Direct values: "#3b82f6" (returned as-is)
|
|
16
|
+
* - Circular reference detection
|
|
17
|
+
*
|
|
18
|
+
* @param ref - Token reference or direct value
|
|
19
|
+
* @param tokens - Theme token structure
|
|
20
|
+
* @param visited - Internal tracking for circular reference detection
|
|
21
|
+
* @returns Resolved token value
|
|
22
|
+
* @throws Error if token not found or circular reference detected
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* resolveToken('atomic.color.blue.500', tokens) // → '#3b82f6'
|
|
27
|
+
* resolveToken('semantic.background.page', tokens) // → '#f9fafb' (via atomic.color.neutral.50)
|
|
28
|
+
* resolveToken('#3b82f6', tokens) // → '#3b82f6' (direct value)
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function resolveToken(ref: TokenReference, tokens: ThemeWithTokens['tokens'], visited?: Set<string>): string;
|
|
32
|
+
/**
|
|
33
|
+
* Resolves token with fallback chain: Component → Semantic → Atomic
|
|
34
|
+
*
|
|
35
|
+
* Attempts to resolve tokens in order of specificity:
|
|
36
|
+
* 1. Component-level token (most specific)
|
|
37
|
+
* 2. Semantic-level token (medium specificity)
|
|
38
|
+
* 3. Atomic-level token (least specific, guaranteed to exist)
|
|
39
|
+
*
|
|
40
|
+
* This enables graceful degradation when component or semantic tokens are missing.
|
|
41
|
+
*
|
|
42
|
+
* @param componentRef - Component-level token reference
|
|
43
|
+
* @param semanticRef - Semantic-level token reference (fallback)
|
|
44
|
+
* @param atomicRef - Atomic-level token reference (final fallback)
|
|
45
|
+
* @param tokens - Theme token structure
|
|
46
|
+
* @returns Resolved token value from first successful resolution
|
|
47
|
+
* @throws Error if all fallback attempts fail
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* // Returns component token if exists
|
|
52
|
+
* resolveWithFallback(
|
|
53
|
+
* 'component.button.primary.background',
|
|
54
|
+
* 'semantic.foreground.accent',
|
|
55
|
+
* 'atomic.color.blue.500',
|
|
56
|
+
* tokens
|
|
57
|
+
* ) // → '#3b82f6'
|
|
58
|
+
*
|
|
59
|
+
* // Falls back to semantic if component missing
|
|
60
|
+
* resolveWithFallback(
|
|
61
|
+
* 'component.button.nonexistent.background',
|
|
62
|
+
* 'semantic.foreground.accent',
|
|
63
|
+
* 'atomic.color.blue.500',
|
|
64
|
+
* tokens
|
|
65
|
+
* ) // → '#3b82f6' (via semantic)
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export declare function resolveWithFallback(componentRef: string, semanticRef: string, atomicRef: string, tokens: ThemeWithTokens['tokens']): string;
|
|
69
|
+
//# sourceMappingURL=token-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-resolver.d.ts","sourceRoot":"","sources":["../src/token-resolver.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAMnD,+DAA+D;AAC/D,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC;AAMpC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE,eAAe,CAAC,QAAQ,CAAC,EACjC,OAAO,GAAE,GAAG,CAAC,MAAM,CAAa,GAC/B,MAAM,CA0CR;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,eAAe,CAAC,QAAQ,CAAC,GAChC,MAAM,CAmBR"}
|