@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.
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 +51 -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 +228 -0
  231. package/dist/theme-v2.d.ts.map +1 -0
  232. package/dist/theme-v2.js +158 -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 +76 -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 +53 -0
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @tekton-ui/core - Output Generators Module
3
+ * Barrel export for code generation from resolved screens
4
+ * [SPEC-LAYOUT-002] [PHASE-3]
5
+ */
6
+ export { defaultGeneratorOptions } from './types.js';
7
+ // ============================================================================
8
+ // Utilities
9
+ // ============================================================================
10
+ export {
11
+ // String case conversion
12
+ camelCase, pascalCase, kebabCase,
13
+ // Code formatting
14
+ formatCode, indent,
15
+ // JSX/React utilities
16
+ escapeJSX, needsJSXExpression, propValueToJSX,
17
+ // Import generation
18
+ generateImports,
19
+ // CSS utilities
20
+ cssVarToToken, extractPropertyFromCSSVar,
21
+ // Validation
22
+ isValidIdentifier, sanitizeIdentifier, } from './utils.js';
23
+ export { convertCSSVarsToTheme, generateComponentStyles, generateStyledComponents, } from './css-in-js-generator.js';
24
+ // ============================================================================
25
+ // Tailwind Generator
26
+ // ============================================================================
27
+ export { tokenToTailwindClass, generateComponentClasses, generateTailwindConfig, generateTailwindClasses, } from './tailwind-generator.js';
28
+ // ============================================================================
29
+ // React Generator
30
+ // ============================================================================
31
+ export { generateComponentInterface, generateComponentJSX, generateComponentTree, generateReactComponent, } from './react-generator.js';
32
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/screen-generation/generators/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAmBH,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAErD,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E,OAAO;AACL,yBAAyB;AACzB,SAAS,EACT,UAAU,EACV,SAAS;AAET,kBAAkB;AAClB,UAAU,EACV,MAAM;AAEN,sBAAsB;AACtB,SAAS,EACT,kBAAkB,EAClB,cAAc;AAEd,oBAAoB;AACpB,eAAe;AAEf,gBAAgB;AAChB,aAAa,EACb,yBAAyB;AAEzB,aAAa;AACb,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,YAAY,CAAC;AAQpB,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,0BAA0B,CAAC;AAElC,+EAA+E;AAC/E,qBAAqB;AACrB,+EAA+E;AAE/E,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,yBAAyB,CAAC;AAEjC,+EAA+E;AAC/E,kBAAkB;AAClB,+EAA+E;AAE/E,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,100 @@
1
+ /**
2
+ * @tekton-ui/core - React Component Generator
3
+ * Generates React functional components from ResolvedScreen
4
+ * [SPEC-LAYOUT-002] [PHASE-3]
5
+ */
6
+ import type { ResolvedScreen, ResolvedSection, ResolvedComponent } from '../resolver/index.js';
7
+ import type { GeneratorOptions, GeneratorResult, ComponentGenerationContext } from './types.js';
8
+ /**
9
+ * Generate TypeScript interface for component props
10
+ *
11
+ * @param component - Resolved component
12
+ * @returns TypeScript interface code
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * const component = {
17
+ * type: 'Button',
18
+ * schema: {
19
+ * props: [
20
+ * { name: 'variant', type: 'string', required: false },
21
+ * { name: 'children', type: 'React.ReactNode', required: true }
22
+ * ]
23
+ * }
24
+ * };
25
+ *
26
+ * const code = generateComponentInterface(component);
27
+ * // interface ButtonProps {
28
+ * // variant?: string;
29
+ * // children: React.ReactNode;
30
+ * // }
31
+ * ```
32
+ */
33
+ export declare function generateComponentInterface(component: ResolvedComponent): string;
34
+ /**
35
+ * Generate JSX for a component and its children
36
+ *
37
+ * @param component - Resolved component
38
+ * @param context - Generation context
39
+ * @returns JSX code string
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * const component = {
44
+ * type: 'Button',
45
+ * props: { variant: 'primary' },
46
+ * children: ['Click me']
47
+ * };
48
+ *
49
+ * const jsx = generateComponentJSX(component, context);
50
+ * // <button className="bg-primary-500 p-4">Click me</button>
51
+ * ```
52
+ */
53
+ export declare function generateComponentJSX(component: ResolvedComponent, context: ComponentGenerationContext): string;
54
+ /**
55
+ * Generate component tree from resolved sections
56
+ *
57
+ * Creates a nested component structure representing the screen layout.
58
+ *
59
+ * @param sections - Resolved sections
60
+ * @param options - Generator options
61
+ * @returns Component tree JSX code
62
+ */
63
+ export declare function generateComponentTree(sections: ResolvedSection[], options: GeneratorOptions): string;
64
+ /**
65
+ * Generate complete screen component from resolved screen
66
+ *
67
+ * Creates a React functional component representing the entire screen,
68
+ * including all sections and nested components.
69
+ *
70
+ * @param screen - Resolved screen
71
+ * @param options - Generator options
72
+ * @returns Generated React component code
73
+ *
74
+ * @example
75
+ * ```typescript
76
+ * const screen = resolveScreen(screenDefinition);
77
+ * const result = generateReactComponent(screen, {
78
+ * format: 'typescript',
79
+ * cssFramework: 'tailwind',
80
+ * includeTypes: true
81
+ * });
82
+ *
83
+ * console.log(result.code);
84
+ * // import React from 'react';
85
+ * //
86
+ * // interface DashboardScreenProps {}
87
+ * //
88
+ * // export const DashboardScreen: React.FC<DashboardScreenProps> = () => {
89
+ * // return (
90
+ * // <div className="screen">
91
+ * // <section id="stats">
92
+ * // ...
93
+ * // </section>
94
+ * // </div>
95
+ * // );
96
+ * // };
97
+ * ```
98
+ */
99
+ export declare function generateReactComponent(screen: ResolvedScreen, options?: GeneratorOptions): GeneratorResult;
100
+ //# sourceMappingURL=react-generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-generator.d.ts","sourceRoot":"","sources":["../../../src/screen-generation/generators/react-generator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC/F,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAgBhG;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,iBAAiB,GAAG,MAAM,CAqB/E;AAMD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,iBAAiB,EAC5B,OAAO,EAAE,0BAA0B,GAClC,MAAM,CAoCR;AA0JD;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,eAAe,EAAE,EAC3B,OAAO,EAAE,gBAAgB,GACxB,MAAM,CAwBR;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,cAAc,EACtB,OAAO,GAAE,gBAAqB,GAC7B,eAAe,CA6FjB"}
@@ -0,0 +1,379 @@
1
+ /**
2
+ * @tekton-ui/core - React Component Generator
3
+ * Generates React functional components from ResolvedScreen
4
+ * [SPEC-LAYOUT-002] [PHASE-3]
5
+ */
6
+ import { pascalCase, camelCase, generateImports, formatCode, indent, escapeJSX, propValueToJSX, } from './utils.js';
7
+ import { generateComponentClasses } from './tailwind-generator.js';
8
+ // ============================================================================
9
+ // TypeScript Interface Generation
10
+ // ============================================================================
11
+ /**
12
+ * Generate TypeScript interface for component props
13
+ *
14
+ * @param component - Resolved component
15
+ * @returns TypeScript interface code
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * const component = {
20
+ * type: 'Button',
21
+ * schema: {
22
+ * props: [
23
+ * { name: 'variant', type: 'string', required: false },
24
+ * { name: 'children', type: 'React.ReactNode', required: true }
25
+ * ]
26
+ * }
27
+ * };
28
+ *
29
+ * const code = generateComponentInterface(component);
30
+ * // interface ButtonProps {
31
+ * // variant?: string;
32
+ * // children: React.ReactNode;
33
+ * // }
34
+ * ```
35
+ */
36
+ export function generateComponentInterface(component) {
37
+ const interfaceName = `${pascalCase(component.type)}Props`;
38
+ const lines = [];
39
+ lines.push(`interface ${interfaceName} {`);
40
+ for (const propDef of component.schema.props) {
41
+ const optionalMarker = propDef.required ? '' : '?';
42
+ const propType = propDef.type || 'unknown';
43
+ // Add JSDoc comment
44
+ if (propDef.description) {
45
+ lines.push(` /** ${propDef.description} */`);
46
+ }
47
+ lines.push(` ${propDef.name}${optionalMarker}: ${propType};`);
48
+ }
49
+ lines.push('}');
50
+ return lines.join('\n');
51
+ }
52
+ // ============================================================================
53
+ // Component JSX Generation
54
+ // ============================================================================
55
+ /**
56
+ * Generate JSX for a component and its children
57
+ *
58
+ * @param component - Resolved component
59
+ * @param context - Generation context
60
+ * @returns JSX code string
61
+ *
62
+ * @example
63
+ * ```typescript
64
+ * const component = {
65
+ * type: 'Button',
66
+ * props: { variant: 'primary' },
67
+ * children: ['Click me']
68
+ * };
69
+ *
70
+ * const jsx = generateComponentJSX(component, context);
71
+ * // <button className="bg-primary-500 p-4">Click me</button>
72
+ * ```
73
+ */
74
+ export function generateComponentJSX(component, context) {
75
+ const lines = [];
76
+ // Generate opening tag
77
+ const tagName = getJSXTagName(component.type);
78
+ const attributes = generateJSXAttributes(component, context);
79
+ if (!component.children || component.children.length === 0) {
80
+ // Self-closing tag
81
+ lines.push(`<${tagName}${attributes} />`);
82
+ }
83
+ else {
84
+ // Opening tag
85
+ lines.push(`<${tagName}${attributes}>`);
86
+ // Children
87
+ for (const child of component.children) {
88
+ if (typeof child === 'string') {
89
+ // Text content
90
+ lines.push(indent(escapeJSX(child), context.depth + 1));
91
+ }
92
+ else {
93
+ // Child component
94
+ const childContext = {
95
+ ...context,
96
+ depth: context.depth + 1,
97
+ parentType: component.type,
98
+ };
99
+ const childJSX = generateComponentJSX(child, childContext);
100
+ lines.push(indent(childJSX, 1));
101
+ }
102
+ }
103
+ // Closing tag
104
+ lines.push(`</${tagName}>`);
105
+ }
106
+ return lines.join('\n');
107
+ }
108
+ /**
109
+ * Get JSX tag name for component type
110
+ *
111
+ * @param type - Component type
112
+ * @returns JSX tag name
113
+ */
114
+ function getJSXTagName(type) {
115
+ // Map component types to HTML elements
116
+ const tagMap = {
117
+ Button: 'button',
118
+ Input: 'input',
119
+ Text: 'span',
120
+ Heading: 'h2',
121
+ Checkbox: 'input',
122
+ Radio: 'input',
123
+ Switch: 'button',
124
+ Slider: 'input',
125
+ Badge: 'span',
126
+ Avatar: 'img',
127
+ Card: 'div',
128
+ Modal: 'div',
129
+ Tabs: 'div',
130
+ Table: 'table',
131
+ Link: 'a',
132
+ List: 'ul',
133
+ Image: 'img',
134
+ Form: 'form',
135
+ Dropdown: 'select',
136
+ Progress: 'progress',
137
+ };
138
+ return tagMap[type] || 'div';
139
+ }
140
+ /**
141
+ * Generate JSX attributes for component
142
+ *
143
+ * @param component - Resolved component
144
+ * @param context - Generation context
145
+ * @returns JSX attributes string
146
+ */
147
+ function generateJSXAttributes(component, context) {
148
+ const attributes = [];
149
+ // Add className based on CSS framework
150
+ if (context.cssFramework === 'tailwind') {
151
+ const classes = generateComponentClasses(component);
152
+ if (classes.length > 0) {
153
+ attributes.push(`className="${classes.join(' ')}"`);
154
+ }
155
+ }
156
+ else if (context.cssFramework === 'css-modules') {
157
+ const className = camelCase(component.type);
158
+ attributes.push(`className={styles.${className}}`);
159
+ context.imports.add('styles');
160
+ }
161
+ // Add component props (excluding children)
162
+ for (const [propName, propValue] of Object.entries(component.props)) {
163
+ if (propName === 'children') {
164
+ continue;
165
+ }
166
+ const jsxValue = propValueToJSX(propValue);
167
+ attributes.push(`${propName}=${jsxValue}`);
168
+ }
169
+ // Add accessibility attributes
170
+ if (component.schema.a11y.role) {
171
+ attributes.push(`role="${component.schema.a11y.role}"`);
172
+ }
173
+ return attributes.length > 0 ? ' ' + attributes.join(' ') : '';
174
+ }
175
+ // ============================================================================
176
+ // Component Function Generation
177
+ // ============================================================================
178
+ /**
179
+ * Generate React functional component
180
+ *
181
+ * @param component - Resolved component
182
+ * @param options - Generator options
183
+ * @returns Component function code
184
+ *
185
+ * @example
186
+ * ```typescript
187
+ * const component = {
188
+ * type: 'Button',
189
+ * schema: { props: [...] },
190
+ * props: { variant: 'primary' },
191
+ * children: ['Click me']
192
+ * };
193
+ *
194
+ * const code = generateReactComponentFunction(component, options);
195
+ * // export const Button: React.FC<ButtonProps> = ({ variant, children }) => {
196
+ * // return (
197
+ * // <button className="bg-primary-500">
198
+ * // {children}
199
+ * // </button>
200
+ * // );
201
+ * // };
202
+ * ```
203
+ */
204
+ function _generateReactComponentFunction(component, options) {
205
+ const componentName = pascalCase(component.type);
206
+ const propsInterfaceName = `${componentName}Props`;
207
+ const lines = [];
208
+ // Extract prop names for destructuring
209
+ const propNames = component.schema.props.map(p => p.name);
210
+ const propsDestructure = propNames.length > 0 ? `{ ${propNames.join(', ')} }` : '';
211
+ // Function signature
212
+ if (options.includeTypes !== false) {
213
+ lines.push(`export const ${componentName}: React.FC<${propsInterfaceName}> = (${propsDestructure}) => {`);
214
+ }
215
+ else {
216
+ lines.push(`export const ${componentName} = (${propsDestructure}) => {`);
217
+ }
218
+ // Function body
219
+ lines.push(' return (');
220
+ // Generate JSX
221
+ const context = {
222
+ depth: 2,
223
+ imports: new Set(),
224
+ cssFramework: options.cssFramework || 'tailwind',
225
+ format: options.format || 'typescript',
226
+ };
227
+ const jsx = generateComponentJSX(component, context);
228
+ lines.push(indent(jsx, 2));
229
+ lines.push(' );');
230
+ lines.push('};');
231
+ return lines.join('\n');
232
+ }
233
+ // ============================================================================
234
+ // Component Tree Generation
235
+ // ============================================================================
236
+ /**
237
+ * Generate component tree from resolved sections
238
+ *
239
+ * Creates a nested component structure representing the screen layout.
240
+ *
241
+ * @param sections - Resolved sections
242
+ * @param options - Generator options
243
+ * @returns Component tree JSX code
244
+ */
245
+ export function generateComponentTree(sections, options) {
246
+ const lines = [];
247
+ for (const section of sections) {
248
+ // Section wrapper
249
+ lines.push(`<section id="${section.id}">`);
250
+ // Components in section
251
+ for (const component of section.components) {
252
+ const context = {
253
+ depth: 1,
254
+ imports: new Set(),
255
+ cssFramework: options.cssFramework || 'tailwind',
256
+ format: options.format || 'typescript',
257
+ };
258
+ const componentJSX = generateComponentJSX(component, context);
259
+ lines.push(indent(componentJSX, 1));
260
+ }
261
+ lines.push('</section>');
262
+ }
263
+ return lines.join('\n');
264
+ }
265
+ // ============================================================================
266
+ // Screen Component Generation
267
+ // ============================================================================
268
+ /**
269
+ * Generate complete screen component from resolved screen
270
+ *
271
+ * Creates a React functional component representing the entire screen,
272
+ * including all sections and nested components.
273
+ *
274
+ * @param screen - Resolved screen
275
+ * @param options - Generator options
276
+ * @returns Generated React component code
277
+ *
278
+ * @example
279
+ * ```typescript
280
+ * const screen = resolveScreen(screenDefinition);
281
+ * const result = generateReactComponent(screen, {
282
+ * format: 'typescript',
283
+ * cssFramework: 'tailwind',
284
+ * includeTypes: true
285
+ * });
286
+ *
287
+ * console.log(result.code);
288
+ * // import React from 'react';
289
+ * //
290
+ * // interface DashboardScreenProps {}
291
+ * //
292
+ * // export const DashboardScreen: React.FC<DashboardScreenProps> = () => {
293
+ * // return (
294
+ * // <div className="screen">
295
+ * // <section id="stats">
296
+ * // ...
297
+ * // </section>
298
+ * // </div>
299
+ * // );
300
+ * // };
301
+ * ```
302
+ */
303
+ export function generateReactComponent(screen, options = {}) {
304
+ const startTime = performance.now();
305
+ const imports = {
306
+ react: ['default as React'],
307
+ };
308
+ const code = [];
309
+ const warnings = [];
310
+ // Add CSS imports if needed
311
+ if (options.cssFramework === 'css-modules') {
312
+ imports['./styles.module.css'] = ['default as styles'];
313
+ }
314
+ // Generate screen component
315
+ const screenName = pascalCase(screen.id.replace(/-screen$/, '')) + 'Screen';
316
+ const propsInterfaceName = `${screenName}Props`;
317
+ // Interface (empty for screen component)
318
+ if (options.includeTypes !== false) {
319
+ code.push(`interface ${propsInterfaceName} {}`);
320
+ code.push('');
321
+ }
322
+ // Component function
323
+ const lines = [];
324
+ if (options.includeTypes !== false) {
325
+ lines.push(`export const ${screenName}: React.FC<${propsInterfaceName}> = () => {`);
326
+ }
327
+ else {
328
+ lines.push(`export const ${screenName} = () => {`);
329
+ }
330
+ lines.push(' return (');
331
+ lines.push(' <div className="screen" data-screen-id="' + screen.id + '">');
332
+ // Generate component tree
333
+ const componentTree = generateComponentTree(screen.sections, options);
334
+ lines.push(indent(componentTree, 3));
335
+ lines.push(' </div>');
336
+ lines.push(' );');
337
+ lines.push('};');
338
+ code.push(lines.join('\n'));
339
+ // Also generate individual component functions if requested
340
+ const componentFiles = [];
341
+ if (options.includeTypes !== false) {
342
+ // Generate type definitions file
343
+ const typeDefs = [];
344
+ typeDefs.push("import React from 'react';");
345
+ typeDefs.push('');
346
+ const generatedTypes = new Set();
347
+ for (const section of screen.sections) {
348
+ for (const component of section.components) {
349
+ if (!generatedTypes.has(component.type)) {
350
+ typeDefs.push(generateComponentInterface(component));
351
+ typeDefs.push('');
352
+ generatedTypes.add(component.type);
353
+ }
354
+ }
355
+ }
356
+ componentFiles.push({
357
+ path: 'types.ts',
358
+ content: typeDefs.join('\n'),
359
+ type: 'component',
360
+ });
361
+ }
362
+ // Combine imports and code
363
+ const importCode = generateImports(imports, options.format || 'typescript');
364
+ const fullCode = importCode + code.join('\n');
365
+ // Format code
366
+ const formatted = options.prettier !== false ? formatCode(fullCode) : fullCode;
367
+ const endTime = performance.now();
368
+ return {
369
+ code: formatted,
370
+ files: componentFiles,
371
+ warnings,
372
+ meta: {
373
+ duration: endTime - startTime,
374
+ componentCount: screen.sections.reduce((sum, s) => sum + s.components.length, 0),
375
+ lineCount: formatted.split('\n').length,
376
+ },
377
+ };
378
+ }
379
+ //# sourceMappingURL=react-generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-generator.js","sourceRoot":"","sources":["../../../src/screen-generation/generators/react-generator.ts"],"names":[],"mappings":"AA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AAc,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;YAChF,SAAS,EAAE,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM;SACxC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,105 @@
1
+ /**
2
+ * @tekton-ui/core - Tailwind CSS Generator
3
+ * Generates Tailwind class names and configuration from ResolvedScreen
4
+ * [SPEC-LAYOUT-002] [PHASE-3]
5
+ */
6
+ import type { ResolvedScreen, ResolvedComponent } from '../resolver/index.js';
7
+ import type { GeneratorOptions, GeneratorResult } from './types.js';
8
+ /**
9
+ * Convert token binding to Tailwind class name
10
+ *
11
+ * Maps design token references to Tailwind utility classes.
12
+ * Uses a lookup table for performance.
13
+ *
14
+ * @param tokenBinding - Token binding (CSS variable reference)
15
+ * @param context - Resolution context with component props
16
+ * @returns Tailwind class name
17
+ *
18
+ * @example
19
+ * ```typescript
20
+ * tokenToTailwindClass('var(--atomic-spacing-16)', { prop: 'padding' });
21
+ * // → 'p-4'
22
+ *
23
+ * tokenToTailwindClass('var(--semantic-color-primary)', { prop: 'background' });
24
+ * // → 'bg-primary-500'
25
+ * ```
26
+ */
27
+ export declare function tokenToTailwindClass(tokenBinding: string, context: {
28
+ prop: string;
29
+ responsive?: string;
30
+ }): string;
31
+ /**
32
+ * Generate Tailwind classes for component
33
+ *
34
+ * @param component - Resolved component
35
+ * @returns Array of Tailwind class names
36
+ *
37
+ * @example
38
+ * ```typescript
39
+ * const component = {
40
+ * type: 'Button',
41
+ * tokenBindings: {
42
+ * background: 'var(--semantic-color-primary)',
43
+ * padding: 'var(--atomic-spacing-16)'
44
+ * }
45
+ * };
46
+ *
47
+ * generateTailwindClasses(component);
48
+ * // → ['bg-primary-500', 'p-4']
49
+ * ```
50
+ */
51
+ export declare function generateComponentClasses(component: ResolvedComponent): string[];
52
+ /**
53
+ * Generate Tailwind configuration extension
54
+ *
55
+ * Creates a tailwind.config.js extension that maps design tokens
56
+ * to Tailwind theme values.
57
+ *
58
+ * @param cssVars - CSS variables from resolved screen
59
+ * @returns Tailwind config extension code
60
+ *
61
+ * @example
62
+ * ```typescript
63
+ * const cssVars = {
64
+ * 'var(--semantic-color-primary)': 'semantic.color.primary',
65
+ * 'var(--atomic-spacing-16)': 'atomic.spacing.16'
66
+ * };
67
+ *
68
+ * const config = generateTailwindConfig(cssVars);
69
+ * // module.exports = {
70
+ * // theme: {
71
+ * // extend: {
72
+ * // colors: {
73
+ * // 'primary': 'var(--semantic-color-primary)',
74
+ * // },
75
+ * // spacing: {
76
+ * // '4': 'var(--atomic-spacing-16)',
77
+ * // }
78
+ * // }
79
+ * // }
80
+ * // }
81
+ * ```
82
+ */
83
+ export declare function generateTailwindConfig(cssVars: Record<string, string>): string;
84
+ /**
85
+ * Generate Tailwind classes and configuration from resolved screen
86
+ *
87
+ * Creates:
88
+ * - Component class mappings
89
+ * - Tailwind configuration extension
90
+ *
91
+ * @param screen - Resolved screen
92
+ * @param options - Generator options
93
+ * @returns Generator result with code and config
94
+ *
95
+ * @example
96
+ * ```typescript
97
+ * const screen = resolveScreen(screenDefinition);
98
+ * const result = generateTailwindClasses(screen);
99
+ *
100
+ * console.log(result.code); // Component class mappings
101
+ * console.log(result.files[0].content); // tailwind.config.js
102
+ * ```
103
+ */
104
+ export declare function generateTailwindClasses(screen: ResolvedScreen, _options?: GeneratorOptions): GeneratorResult;
105
+ //# sourceMappingURL=tailwind-generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tailwind-generator.d.ts","sourceRoot":"","sources":["../../../src/screen-generation/generators/tailwind-generator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAmDpE;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GAC7C,MAAM,CAiDR;AAmBD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,iBAAiB,GAAG,MAAM,EAAE,CAW/E;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAsG9E;AAMD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,cAAc,EACtB,QAAQ,GAAE,gBAAqB,GAC9B,eAAe,CA8CjB"}