@framingui/core 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.
Files changed (254) hide show
  1. package/README.md +758 -0
  2. package/dist/blueprint.d.ts +44 -0
  3. package/dist/blueprint.d.ts.map +1 -0
  4. package/dist/blueprint.js +163 -0
  5. package/dist/blueprint.js.map +1 -0
  6. package/dist/component-schemas.d.ts +78 -0
  7. package/dist/component-schemas.d.ts.map +1 -0
  8. package/dist/component-schemas.js +1037 -0
  9. package/dist/component-schemas.js.map +1 -0
  10. package/dist/css-generator.d.ts +42 -0
  11. package/dist/css-generator.d.ts.map +1 -0
  12. package/dist/css-generator.js +339 -0
  13. package/dist/css-generator.js.map +1 -0
  14. package/dist/icon-library.d.ts +109 -0
  15. package/dist/icon-library.d.ts.map +1 -0
  16. package/dist/icon-library.js +204 -0
  17. package/dist/icon-library.js.map +1 -0
  18. package/dist/index.d.ts +36 -0
  19. package/dist/index.d.ts.map +1 -0
  20. package/dist/index.js +53 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/layout-css-generator.d.ts +158 -0
  23. package/dist/layout-css-generator.d.ts.map +1 -0
  24. package/dist/layout-css-generator.js +901 -0
  25. package/dist/layout-css-generator.js.map +1 -0
  26. package/dist/layout-resolver.d.ts +92 -0
  27. package/dist/layout-resolver.d.ts.map +1 -0
  28. package/dist/layout-resolver.js +275 -0
  29. package/dist/layout-resolver.js.map +1 -0
  30. package/dist/layout-tokens/index.d.ts +16 -0
  31. package/dist/layout-tokens/index.d.ts.map +1 -0
  32. package/dist/layout-tokens/index.js +16 -0
  33. package/dist/layout-tokens/index.js.map +1 -0
  34. package/dist/layout-tokens/keyboard.d.ts +254 -0
  35. package/dist/layout-tokens/keyboard.d.ts.map +1 -0
  36. package/dist/layout-tokens/keyboard.js +407 -0
  37. package/dist/layout-tokens/keyboard.js.map +1 -0
  38. package/dist/layout-tokens/mobile-shells.d.ts +78 -0
  39. package/dist/layout-tokens/mobile-shells.d.ts.map +1 -0
  40. package/dist/layout-tokens/mobile-shells.js +635 -0
  41. package/dist/layout-tokens/mobile-shells.js.map +1 -0
  42. package/dist/layout-tokens/pages.d.ts +100 -0
  43. package/dist/layout-tokens/pages.d.ts.map +1 -0
  44. package/dist/layout-tokens/pages.js +576 -0
  45. package/dist/layout-tokens/pages.js.map +1 -0
  46. package/dist/layout-tokens/responsive.d.ts +109 -0
  47. package/dist/layout-tokens/responsive.d.ts.map +1 -0
  48. package/dist/layout-tokens/responsive.js +167 -0
  49. package/dist/layout-tokens/responsive.js.map +1 -0
  50. package/dist/layout-tokens/safe-area.d.ts +156 -0
  51. package/dist/layout-tokens/safe-area.d.ts.map +1 -0
  52. package/dist/layout-tokens/safe-area.js +316 -0
  53. package/dist/layout-tokens/safe-area.js.map +1 -0
  54. package/dist/layout-tokens/sections-advanced.d.ts +277 -0
  55. package/dist/layout-tokens/sections-advanced.d.ts.map +1 -0
  56. package/dist/layout-tokens/sections-advanced.js +593 -0
  57. package/dist/layout-tokens/sections-advanced.js.map +1 -0
  58. package/dist/layout-tokens/sections.d.ts +137 -0
  59. package/dist/layout-tokens/sections.d.ts.map +1 -0
  60. package/dist/layout-tokens/sections.js +694 -0
  61. package/dist/layout-tokens/sections.js.map +1 -0
  62. package/dist/layout-tokens/shells.d.ts +77 -0
  63. package/dist/layout-tokens/shells.d.ts.map +1 -0
  64. package/dist/layout-tokens/shells.js +408 -0
  65. package/dist/layout-tokens/shells.js.map +1 -0
  66. package/dist/layout-tokens/touch-target.d.ts +119 -0
  67. package/dist/layout-tokens/touch-target.d.ts.map +1 -0
  68. package/dist/layout-tokens/touch-target.js +156 -0
  69. package/dist/layout-tokens/touch-target.js.map +1 -0
  70. package/dist/layout-tokens/types.d.ts +632 -0
  71. package/dist/layout-tokens/types.d.ts.map +1 -0
  72. package/dist/layout-tokens/types.js +49 -0
  73. package/dist/layout-tokens/types.js.map +1 -0
  74. package/dist/layout-validation.d.ts +1547 -0
  75. package/dist/layout-validation.d.ts.map +1 -0
  76. package/dist/layout-validation.js +628 -0
  77. package/dist/layout-validation.js.map +1 -0
  78. package/dist/render.d.ts +23 -0
  79. package/dist/render.d.ts.map +1 -0
  80. package/dist/render.js +244 -0
  81. package/dist/render.js.map +1 -0
  82. package/dist/schema-validation.d.ts +208 -0
  83. package/dist/schema-validation.d.ts.map +1 -0
  84. package/dist/schema-validation.js +205 -0
  85. package/dist/schema-validation.js.map +1 -0
  86. package/dist/screen-generation/generators/css-in-js-generator.d.ts +82 -0
  87. package/dist/screen-generation/generators/css-in-js-generator.d.ts.map +1 -0
  88. package/dist/screen-generation/generators/css-in-js-generator.js +335 -0
  89. package/dist/screen-generation/generators/css-in-js-generator.js.map +1 -0
  90. package/dist/screen-generation/generators/index.d.ts +13 -0
  91. package/dist/screen-generation/generators/index.d.ts.map +1 -0
  92. package/dist/screen-generation/generators/index.js +32 -0
  93. package/dist/screen-generation/generators/index.js.map +1 -0
  94. package/dist/screen-generation/generators/react-generator.d.ts +100 -0
  95. package/dist/screen-generation/generators/react-generator.d.ts.map +1 -0
  96. package/dist/screen-generation/generators/react-generator.js +379 -0
  97. package/dist/screen-generation/generators/react-generator.js.map +1 -0
  98. package/dist/screen-generation/generators/tailwind-generator.d.ts +105 -0
  99. package/dist/screen-generation/generators/tailwind-generator.d.ts.map +1 -0
  100. package/dist/screen-generation/generators/tailwind-generator.js +355 -0
  101. package/dist/screen-generation/generators/tailwind-generator.js.map +1 -0
  102. package/dist/screen-generation/generators/types.d.ts +136 -0
  103. package/dist/screen-generation/generators/types.d.ts.map +1 -0
  104. package/dist/screen-generation/generators/types.js +18 -0
  105. package/dist/screen-generation/generators/types.js.map +1 -0
  106. package/dist/screen-generation/generators/utils.d.ts +187 -0
  107. package/dist/screen-generation/generators/utils.d.ts.map +1 -0
  108. package/dist/screen-generation/generators/utils.js +312 -0
  109. package/dist/screen-generation/generators/utils.js.map +1 -0
  110. package/dist/screen-generation/index.d.ts +14 -0
  111. package/dist/screen-generation/index.d.ts.map +1 -0
  112. package/dist/screen-generation/index.js +33 -0
  113. package/dist/screen-generation/index.js.map +1 -0
  114. package/dist/screen-generation/resolver/component-resolver.d.ts +157 -0
  115. package/dist/screen-generation/resolver/component-resolver.d.ts.map +1 -0
  116. package/dist/screen-generation/resolver/component-resolver.js +295 -0
  117. package/dist/screen-generation/resolver/component-resolver.js.map +1 -0
  118. package/dist/screen-generation/resolver/index.d.ts +10 -0
  119. package/dist/screen-generation/resolver/index.d.ts.map +1 -0
  120. package/dist/screen-generation/resolver/index.js +46 -0
  121. package/dist/screen-generation/resolver/index.js.map +1 -0
  122. package/dist/screen-generation/resolver/layout-resolver.d.ts +155 -0
  123. package/dist/screen-generation/resolver/layout-resolver.d.ts.map +1 -0
  124. package/dist/screen-generation/resolver/layout-resolver.js +193 -0
  125. package/dist/screen-generation/resolver/layout-resolver.js.map +1 -0
  126. package/dist/screen-generation/resolver/screen-resolver.d.ts +174 -0
  127. package/dist/screen-generation/resolver/screen-resolver.d.ts.map +1 -0
  128. package/dist/screen-generation/resolver/screen-resolver.js +373 -0
  129. package/dist/screen-generation/resolver/screen-resolver.js.map +1 -0
  130. package/dist/screen-generation/resolver/token-resolver.d.ts +170 -0
  131. package/dist/screen-generation/resolver/token-resolver.d.ts.map +1 -0
  132. package/dist/screen-generation/resolver/token-resolver.js +260 -0
  133. package/dist/screen-generation/resolver/token-resolver.js.map +1 -0
  134. package/dist/screen-generation/types.d.ts +116 -0
  135. package/dist/screen-generation/types.d.ts.map +1 -0
  136. package/dist/screen-generation/types.js +33 -0
  137. package/dist/screen-generation/types.js.map +1 -0
  138. package/dist/screen-generation/validators.d.ts +286 -0
  139. package/dist/screen-generation/validators.d.ts.map +1 -0
  140. package/dist/screen-generation/validators.js +323 -0
  141. package/dist/screen-generation/validators.js.map +1 -0
  142. package/dist/screen-templates/__tests__/registry.test.d.ts +6 -0
  143. package/dist/screen-templates/__tests__/registry.test.d.ts.map +1 -0
  144. package/dist/screen-templates/__tests__/registry.test.js +247 -0
  145. package/dist/screen-templates/__tests__/registry.test.js.map +1 -0
  146. package/dist/screen-templates/__tests__/templates.test.d.ts +6 -0
  147. package/dist/screen-templates/__tests__/templates.test.d.ts.map +1 -0
  148. package/dist/screen-templates/__tests__/templates.test.js +179 -0
  149. package/dist/screen-templates/__tests__/templates.test.js.map +1 -0
  150. package/dist/screen-templates/index.d.ts +39 -0
  151. package/dist/screen-templates/index.d.ts.map +1 -0
  152. package/dist/screen-templates/index.js +79 -0
  153. package/dist/screen-templates/index.js.map +1 -0
  154. package/dist/screen-templates/registry.d.ts +177 -0
  155. package/dist/screen-templates/registry.d.ts.map +1 -0
  156. package/dist/screen-templates/registry.js +274 -0
  157. package/dist/screen-templates/registry.js.map +1 -0
  158. package/dist/screen-templates/templates/account/index.d.ts +6 -0
  159. package/dist/screen-templates/templates/account/index.d.ts.map +1 -0
  160. package/dist/screen-templates/templates/account/index.js +6 -0
  161. package/dist/screen-templates/templates/account/index.js.map +1 -0
  162. package/dist/screen-templates/templates/account/profile.d.ts +23 -0
  163. package/dist/screen-templates/templates/account/profile.d.ts.map +1 -0
  164. package/dist/screen-templates/templates/account/profile.js +249 -0
  165. package/dist/screen-templates/templates/account/profile.js.map +1 -0
  166. package/dist/screen-templates/templates/auth/forgot-password.d.ts +23 -0
  167. package/dist/screen-templates/templates/auth/forgot-password.d.ts.map +1 -0
  168. package/dist/screen-templates/templates/auth/forgot-password.js +203 -0
  169. package/dist/screen-templates/templates/auth/forgot-password.js.map +1 -0
  170. package/dist/screen-templates/templates/auth/index.d.ts +9 -0
  171. package/dist/screen-templates/templates/auth/index.d.ts.map +1 -0
  172. package/dist/screen-templates/templates/auth/index.js +9 -0
  173. package/dist/screen-templates/templates/auth/index.js.map +1 -0
  174. package/dist/screen-templates/templates/auth/login.d.ts +24 -0
  175. package/dist/screen-templates/templates/auth/login.d.ts.map +1 -0
  176. package/dist/screen-templates/templates/auth/login.js +254 -0
  177. package/dist/screen-templates/templates/auth/login.js.map +1 -0
  178. package/dist/screen-templates/templates/auth/signup.d.ts +24 -0
  179. package/dist/screen-templates/templates/auth/signup.d.ts.map +1 -0
  180. package/dist/screen-templates/templates/auth/signup.js +315 -0
  181. package/dist/screen-templates/templates/auth/signup.js.map +1 -0
  182. package/dist/screen-templates/templates/auth/verification.d.ts +23 -0
  183. package/dist/screen-templates/templates/auth/verification.d.ts.map +1 -0
  184. package/dist/screen-templates/templates/auth/verification.js +239 -0
  185. package/dist/screen-templates/templates/auth/verification.js.map +1 -0
  186. package/dist/screen-templates/templates/feedback/confirmation.d.ts +9 -0
  187. package/dist/screen-templates/templates/feedback/confirmation.d.ts.map +1 -0
  188. package/dist/screen-templates/templates/feedback/confirmation.js +107 -0
  189. package/dist/screen-templates/templates/feedback/confirmation.js.map +1 -0
  190. package/dist/screen-templates/templates/feedback/empty.d.ts +9 -0
  191. package/dist/screen-templates/templates/feedback/empty.d.ts.map +1 -0
  192. package/dist/screen-templates/templates/feedback/empty.js +90 -0
  193. package/dist/screen-templates/templates/feedback/empty.js.map +1 -0
  194. package/dist/screen-templates/templates/feedback/error.d.ts +9 -0
  195. package/dist/screen-templates/templates/feedback/error.d.ts.map +1 -0
  196. package/dist/screen-templates/templates/feedback/error.js +99 -0
  197. package/dist/screen-templates/templates/feedback/error.js.map +1 -0
  198. package/dist/screen-templates/templates/feedback/index.d.ts +10 -0
  199. package/dist/screen-templates/templates/feedback/index.d.ts.map +1 -0
  200. package/dist/screen-templates/templates/feedback/index.js +10 -0
  201. package/dist/screen-templates/templates/feedback/index.js.map +1 -0
  202. package/dist/screen-templates/templates/feedback/loading.d.ts +9 -0
  203. package/dist/screen-templates/templates/feedback/loading.d.ts.map +1 -0
  204. package/dist/screen-templates/templates/feedback/loading.js +77 -0
  205. package/dist/screen-templates/templates/feedback/loading.js.map +1 -0
  206. package/dist/screen-templates/templates/feedback/success.d.ts +9 -0
  207. package/dist/screen-templates/templates/feedback/success.d.ts.map +1 -0
  208. package/dist/screen-templates/templates/feedback/success.js +99 -0
  209. package/dist/screen-templates/templates/feedback/success.js.map +1 -0
  210. package/dist/screen-templates/templates/home/index.d.ts +6 -0
  211. package/dist/screen-templates/templates/home/index.d.ts.map +1 -0
  212. package/dist/screen-templates/templates/home/index.js +6 -0
  213. package/dist/screen-templates/templates/home/index.js.map +1 -0
  214. package/dist/screen-templates/templates/home/landing.d.ts +24 -0
  215. package/dist/screen-templates/templates/home/landing.d.ts.map +1 -0
  216. package/dist/screen-templates/templates/home/landing.js +197 -0
  217. package/dist/screen-templates/templates/home/landing.js.map +1 -0
  218. package/dist/screen-templates/templates/settings/index.d.ts +6 -0
  219. package/dist/screen-templates/templates/settings/index.d.ts.map +1 -0
  220. package/dist/screen-templates/templates/settings/index.js +6 -0
  221. package/dist/screen-templates/templates/settings/index.js.map +1 -0
  222. package/dist/screen-templates/templates/settings/preferences.d.ts +24 -0
  223. package/dist/screen-templates/templates/settings/preferences.d.ts.map +1 -0
  224. package/dist/screen-templates/templates/settings/preferences.js +265 -0
  225. package/dist/screen-templates/templates/settings/preferences.js.map +1 -0
  226. package/dist/screen-templates/types.d.ts +229 -0
  227. package/dist/screen-templates/types.d.ts.map +1 -0
  228. package/dist/screen-templates/types.js +7 -0
  229. package/dist/screen-templates/types.js.map +1 -0
  230. package/dist/theme-v2.d.ts +361 -0
  231. package/dist/theme-v2.d.ts.map +1 -0
  232. package/dist/theme-v2.js +251 -0
  233. package/dist/theme-v2.js.map +1 -0
  234. package/dist/theme.d.ts +60 -0
  235. package/dist/theme.d.ts.map +1 -0
  236. package/dist/theme.js +78 -0
  237. package/dist/theme.js.map +1 -0
  238. package/dist/token-resolver.d.ts +69 -0
  239. package/dist/token-resolver.d.ts.map +1 -0
  240. package/dist/token-resolver.js +122 -0
  241. package/dist/token-resolver.js.map +1 -0
  242. package/dist/token-validation.d.ts +432 -0
  243. package/dist/token-validation.d.ts.map +1 -0
  244. package/dist/token-validation.js +140 -0
  245. package/dist/token-validation.js.map +1 -0
  246. package/dist/tokens.d.ts +158 -0
  247. package/dist/tokens.d.ts.map +1 -0
  248. package/dist/tokens.js +10 -0
  249. package/dist/tokens.js.map +1 -0
  250. package/dist/types.d.ts +77 -0
  251. package/dist/types.d.ts.map +1 -0
  252. package/dist/types.js +7 -0
  253. package/dist/types.js.map +1 -0
  254. package/package.json +54 -0
@@ -0,0 +1,361 @@
1
+ /**
2
+ * @framingui/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
+ * Semantic 토큰 → CSS 변수명 매핑
221
+ * themeToCSS (ui 패키지)와 페이지 템플릿이 동일한 매핑을 참조
222
+ *
223
+ * 'component' 변수: @framingui/ui 컴포넌트가 참조
224
+ * 'page' 변수: 페이지 템플릿 인라인 스타일이 참조
225
+ */
226
+ export declare const CSS_VARIABLE_MAP: {
227
+ readonly 'bg-background': {
228
+ readonly ref: "semantic.background.canvas";
229
+ readonly type: "component";
230
+ };
231
+ readonly 'bg-foreground': {
232
+ readonly ref: "semantic.text.primary";
233
+ readonly fallbackRef: "atomic.color.neutral.900";
234
+ readonly type: "component";
235
+ };
236
+ readonly 'bg-card': {
237
+ readonly ref: "semantic.background.surface.default";
238
+ readonly type: "component";
239
+ };
240
+ readonly 'bg-card-foreground': {
241
+ readonly ref: "semantic.text.primary";
242
+ readonly fallbackRef: "atomic.color.neutral.900";
243
+ readonly type: "component";
244
+ };
245
+ readonly 'bg-popover': {
246
+ readonly ref: "semantic.background.surface.default";
247
+ readonly type: "component";
248
+ };
249
+ readonly 'bg-popover-foreground': {
250
+ readonly ref: "semantic.text.primary";
251
+ readonly fallbackRef: "atomic.color.neutral.900";
252
+ readonly type: "component";
253
+ };
254
+ readonly 'bg-primary': {
255
+ readonly ref: "semantic.background.brand.default";
256
+ readonly type: "component";
257
+ };
258
+ readonly 'bg-primary-foreground': {
259
+ readonly ref: "_white";
260
+ readonly type: "component";
261
+ };
262
+ readonly 'bg-secondary': {
263
+ readonly ref: "semantic.background.surface.emphasis";
264
+ readonly type: "component";
265
+ };
266
+ readonly 'bg-secondary-foreground': {
267
+ readonly ref: "semantic.text.primary";
268
+ readonly fallbackRef: "atomic.color.neutral.900";
269
+ readonly type: "component";
270
+ };
271
+ readonly 'bg-muted': {
272
+ readonly ref: "semantic.background.surface.subtle";
273
+ readonly type: "component";
274
+ };
275
+ readonly 'bg-muted-foreground': {
276
+ readonly ref: "semantic.text.secondary";
277
+ readonly fallbackRef: "atomic.color.neutral.500";
278
+ readonly type: "component";
279
+ };
280
+ readonly 'bg-accent': {
281
+ readonly ref: "semantic.background.surface.emphasis";
282
+ readonly type: "component";
283
+ };
284
+ readonly 'bg-accent-foreground': {
285
+ readonly ref: "semantic.text.primary";
286
+ readonly fallbackRef: "atomic.color.neutral.900";
287
+ readonly type: "component";
288
+ };
289
+ readonly 'bg-destructive': {
290
+ readonly ref: "_destructive";
291
+ readonly type: "component";
292
+ };
293
+ readonly 'bg-destructive-foreground': {
294
+ readonly ref: "_white";
295
+ readonly type: "component";
296
+ };
297
+ readonly 'border-default': {
298
+ readonly ref: "semantic.border.default.default";
299
+ readonly type: "component";
300
+ };
301
+ readonly 'border-input': {
302
+ readonly ref: "semantic.border.default.subtle";
303
+ readonly type: "component";
304
+ };
305
+ readonly 'border-ring': {
306
+ readonly ref: "semantic.background.brand.default";
307
+ readonly type: "component";
308
+ };
309
+ readonly 'bg-canvas': {
310
+ readonly ref: "semantic.background.canvas";
311
+ readonly type: "page";
312
+ };
313
+ readonly 'bg-surface': {
314
+ readonly ref: "semantic.background.surface.default";
315
+ readonly type: "page";
316
+ };
317
+ readonly 'text-primary': {
318
+ readonly ref: "semantic.text.primary";
319
+ readonly fallbackRef: "atomic.color.neutral.900";
320
+ readonly type: "page";
321
+ };
322
+ readonly 'text-secondary': {
323
+ readonly ref: "semantic.text.secondary";
324
+ readonly fallbackRef: "atomic.color.neutral.500";
325
+ readonly type: "page";
326
+ };
327
+ readonly 'text-tertiary': {
328
+ readonly ref: "semantic.text.muted";
329
+ readonly fallbackRef: "atomic.color.neutral.400";
330
+ readonly type: "page";
331
+ };
332
+ readonly 'action-primary': {
333
+ readonly ref: "semantic.text.primary";
334
+ readonly fallbackRef: "semantic.background.brand.default";
335
+ readonly type: "page";
336
+ };
337
+ readonly 'action-primary-text': {
338
+ readonly ref: "_white";
339
+ readonly type: "page";
340
+ };
341
+ readonly 'border-emphasis': {
342
+ readonly ref: "semantic.border.default.emphasis";
343
+ readonly type: "page";
344
+ };
345
+ };
346
+ export type CSSVariableName = keyof typeof CSS_VARIABLE_MAP;
347
+ /**
348
+ * 테마에서 white 색상을 안전하게 가져오기
349
+ * v2.1 스키마에서 white는 neutral.white에 위치
350
+ */
351
+ export declare function getWhiteColor(theme: ThemeV2): OKLCHColorV2;
352
+ /**
353
+ * Convert OKLCH color object to CSS string
354
+ */
355
+ export declare function oklchToCSSV2(color: OKLCHColorV2): string;
356
+ /**
357
+ * Resolve a token reference to its actual value
358
+ * Supports: atomic.*, semantic.*, elevation.* references
359
+ */
360
+ export declare function resolveTokenRef(ref: string, theme: ThemeV2): string | null;
361
+ //# 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,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AWtD;AAMD;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuEnB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,gBAAgB,CAAC;AAE5D;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,CAO1D;AAMD;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAKxD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAkC1E"}
@@ -0,0 +1,251 @@
1
+ /**
2
+ * @framingui/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
+ 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
+ // CSS Variable Mapping - 단일 진실 원천
115
+ // ============================================================================
116
+ /**
117
+ * Semantic 토큰 → CSS 변수명 매핑
118
+ * themeToCSS (ui 패키지)와 페이지 템플릿이 동일한 매핑을 참조
119
+ *
120
+ * 'component' 변수: @framingui/ui 컴포넌트가 참조
121
+ * 'page' 변수: 페이지 템플릿 인라인 스타일이 참조
122
+ */
123
+ export const CSS_VARIABLE_MAP = {
124
+ // 컴포넌트 변수 (shadcn 호환)
125
+ 'bg-background': { ref: 'semantic.background.canvas', type: 'component' },
126
+ 'bg-foreground': {
127
+ ref: 'semantic.text.primary',
128
+ fallbackRef: 'atomic.color.neutral.900',
129
+ type: 'component',
130
+ },
131
+ 'bg-card': { ref: 'semantic.background.surface.default', type: 'component' },
132
+ 'bg-card-foreground': {
133
+ ref: 'semantic.text.primary',
134
+ fallbackRef: 'atomic.color.neutral.900',
135
+ type: 'component',
136
+ },
137
+ 'bg-popover': { ref: 'semantic.background.surface.default', type: 'component' },
138
+ 'bg-popover-foreground': {
139
+ ref: 'semantic.text.primary',
140
+ fallbackRef: 'atomic.color.neutral.900',
141
+ type: 'component',
142
+ },
143
+ 'bg-primary': { ref: 'semantic.background.brand.default', type: 'component' },
144
+ 'bg-primary-foreground': { ref: '_white', type: 'component' },
145
+ 'bg-secondary': { ref: 'semantic.background.surface.emphasis', type: 'component' },
146
+ 'bg-secondary-foreground': {
147
+ ref: 'semantic.text.primary',
148
+ fallbackRef: 'atomic.color.neutral.900',
149
+ type: 'component',
150
+ },
151
+ 'bg-muted': { ref: 'semantic.background.surface.subtle', type: 'component' },
152
+ 'bg-muted-foreground': {
153
+ ref: 'semantic.text.secondary',
154
+ fallbackRef: 'atomic.color.neutral.500',
155
+ type: 'component',
156
+ },
157
+ 'bg-accent': { ref: 'semantic.background.surface.emphasis', type: 'component' },
158
+ 'bg-accent-foreground': {
159
+ ref: 'semantic.text.primary',
160
+ fallbackRef: 'atomic.color.neutral.900',
161
+ type: 'component',
162
+ },
163
+ 'bg-destructive': { ref: '_destructive', type: 'component' },
164
+ 'bg-destructive-foreground': { ref: '_white', type: 'component' },
165
+ 'border-default': { ref: 'semantic.border.default.default', type: 'component' },
166
+ 'border-input': { ref: 'semantic.border.default.subtle', type: 'component' },
167
+ 'border-ring': { ref: 'semantic.background.brand.default', type: 'component' },
168
+ // 페이지 변수 (인라인 스타일 호환)
169
+ 'bg-canvas': { ref: 'semantic.background.canvas', type: 'page' },
170
+ 'bg-surface': { ref: 'semantic.background.surface.default', type: 'page' },
171
+ 'text-primary': {
172
+ ref: 'semantic.text.primary',
173
+ fallbackRef: 'atomic.color.neutral.900',
174
+ type: 'page',
175
+ },
176
+ 'text-secondary': {
177
+ ref: 'semantic.text.secondary',
178
+ fallbackRef: 'atomic.color.neutral.500',
179
+ type: 'page',
180
+ },
181
+ 'text-tertiary': {
182
+ ref: 'semantic.text.muted',
183
+ fallbackRef: 'atomic.color.neutral.400',
184
+ type: 'page',
185
+ },
186
+ 'action-primary': {
187
+ ref: 'semantic.text.primary',
188
+ fallbackRef: 'semantic.background.brand.default',
189
+ type: 'page',
190
+ },
191
+ 'action-primary-text': { ref: '_white', type: 'page' },
192
+ 'border-emphasis': { ref: 'semantic.border.default.emphasis', type: 'page' },
193
+ };
194
+ /**
195
+ * 테마에서 white 색상을 안전하게 가져오기
196
+ * v2.1 스키마에서 white는 neutral.white에 위치
197
+ */
198
+ export function getWhiteColor(theme) {
199
+ const neutral = theme.tokens.atomic.color.neutral;
200
+ if (neutral && 'white' in neutral) {
201
+ return neutral.white;
202
+ }
203
+ // 최종 폴백: 순백색
204
+ return { l: 1, c: 0, h: 0 };
205
+ }
206
+ // ============================================================================
207
+ // Color Utilities
208
+ // ============================================================================
209
+ /**
210
+ * Convert OKLCH color object to CSS string
211
+ */
212
+ export function oklchToCSSV2(color) {
213
+ const l = Math.max(0, Math.min(1, color.l));
214
+ const c = Math.max(0, Math.min(0.5, color.c));
215
+ const h = ((color.h % 360) + 360) % 360;
216
+ return `oklch(${l} ${c} ${h})`;
217
+ }
218
+ /**
219
+ * Resolve a token reference to its actual value
220
+ * Supports: atomic.*, semantic.*, elevation.* references
221
+ */
222
+ export function resolveTokenRef(ref, theme) {
223
+ if (!ref.includes('.')) {
224
+ return ref; // Not a reference, return as-is
225
+ }
226
+ const parts = ref.split('.');
227
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
228
+ let current = theme;
229
+ // Navigate through: "atomic.color.brand.500" -> theme.tokens.atomic.color.brand.500
230
+ if (parts[0] === 'atomic' || parts[0] === 'semantic' || parts[0] === 'component') {
231
+ current = theme.tokens;
232
+ }
233
+ for (const part of parts) {
234
+ if (current && typeof current === 'object' && part in current) {
235
+ current = current[part];
236
+ }
237
+ else {
238
+ return null;
239
+ }
240
+ }
241
+ // If result is OKLCH color object, convert to CSS
242
+ if (current &&
243
+ typeof current === 'object' &&
244
+ 'l' in current &&
245
+ 'c' in current &&
246
+ 'h' in current) {
247
+ return oklchToCSSV2(current);
248
+ }
249
+ return typeof current === 'string' ? current : null;
250
+ }
251
+ //# 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,C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