@nikkory/vibe-engine 4.0.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 (333) hide show
  1. package/PUBLISH-GUIDE.md +250 -0
  2. package/README.md +1267 -0
  3. package/bin/vibe.js +22 -0
  4. package/dist/adapters/index.d.ts +19 -0
  5. package/dist/browser.d.ts +25 -0
  6. package/dist/browser.js +15083 -0
  7. package/dist/browser.mjs +15000 -0
  8. package/dist/cli/batch-command.d.ts +142 -0
  9. package/dist/cli/generate-command.d.ts +119 -0
  10. package/dist/cli/index.d.ts +34 -0
  11. package/dist/constants/ComponentTypes.d.ts +65 -0
  12. package/dist/constants/DesignSystems.d.ts +64 -0
  13. package/dist/constants/Frameworks.d.ts +71 -0
  14. package/dist/constants/Tiers.d.ts +72 -0
  15. package/dist/constants/index.d.ts +10 -0
  16. package/dist/converters/index.d.ts +12 -0
  17. package/dist/converters/section-converter.d.ts +176 -0
  18. package/dist/index.d.ts +58 -0
  19. package/dist/index.js +19819 -0
  20. package/dist/index.mjs +19496 -0
  21. package/dist/resolution/basic/groups-basic.d.ts +80 -0
  22. package/dist/resolution/basic/index.d.ts +21 -0
  23. package/dist/resolution/basic/intents-basic.d.ts +195 -0
  24. package/dist/resolution/basic/presets-basic.d.ts +96 -0
  25. package/dist/resolution/basic/resolver-basic.d.ts +127 -0
  26. package/dist/resolution/basic/shorthands-basic.d.ts +88 -0
  27. package/dist/resolution/core/groups-core.d.ts +160 -0
  28. package/dist/resolution/core/index.d.ts +21 -0
  29. package/dist/resolution/core/intents-core.d.ts +355 -0
  30. package/dist/resolution/core/presets-core.d.ts +160 -0
  31. package/dist/resolution/core/resolver-core.d.ts +207 -0
  32. package/dist/resolution/core/shorthands-core.d.ts +144 -0
  33. package/dist/resolution/core/types-core.d.ts +167 -0
  34. package/dist/resolution/debugger.d.ts +183 -0
  35. package/dist/resolution/demo.d.ts +57 -0
  36. package/dist/resolution/enterprise/index.d.ts +22 -0
  37. package/dist/resolution/enterprise/metrics.d.ts +152 -0
  38. package/dist/resolution/enterprise/resolver-enterprise.d.ts +108 -0
  39. package/dist/resolution/examples.d.ts +486 -0
  40. package/dist/resolution/groups/experience-group.d.ts +197 -0
  41. package/dist/resolution/groups/index.d.ts +196 -0
  42. package/dist/resolution/groups/layout-group.d.ts +192 -0
  43. package/dist/resolution/groups/motion-group.d.ts +127 -0
  44. package/dist/resolution/groups/visual-group.d.ts +146 -0
  45. package/dist/resolution/index.d.ts +41 -0
  46. package/dist/resolution/intents/button-intents.d.ts +231 -0
  47. package/dist/resolution/intents/card-intents.d.ts +177 -0
  48. package/dist/resolution/intents/feedback-intents.d.ts +222 -0
  49. package/dist/resolution/intents/index.d.ts +189 -0
  50. package/dist/resolution/intents/input-intents.d.ts +231 -0
  51. package/dist/resolution/intents/mood-modifiers.d.ts +154 -0
  52. package/dist/resolution/performance.d.ts +264 -0
  53. package/dist/resolution/presets/button-presets.d.ts +243 -0
  54. package/dist/resolution/presets/card-presets.d.ts +216 -0
  55. package/dist/resolution/presets/data-display-presets.d.ts +290 -0
  56. package/dist/resolution/presets/feedback-presets.d.ts +335 -0
  57. package/dist/resolution/presets/form-presets.d.ts +308 -0
  58. package/dist/resolution/presets/index.d.ts +22 -0
  59. package/dist/resolution/presets/input-presets.d.ts +207 -0
  60. package/dist/resolution/presets/nav-presets.d.ts +235 -0
  61. package/dist/resolution/presets/overlay-presets.d.ts +216 -0
  62. package/dist/resolution/presets/preset-registry.d.ts +212 -0
  63. package/dist/resolution/resolveProps.d.ts +235 -0
  64. package/dist/resolution/shorthand/feel-mappings.d.ts +140 -0
  65. package/dist/resolution/shorthand/index.d.ts +172 -0
  66. package/dist/resolution/shorthand/look-mappings.d.ts +107 -0
  67. package/dist/resolution/shorthand/spacing-mappings.d.ts +164 -0
  68. package/dist/resolution/shorthand/surface-mappings.d.ts +139 -0
  69. package/dist/resolution/standard/groups-standard.d.ts +98 -0
  70. package/dist/resolution/standard/index.d.ts +28 -0
  71. package/dist/resolution/standard/intents-standard.d.ts +232 -0
  72. package/dist/resolution/standard/presets-standard.d.ts +123 -0
  73. package/dist/resolution/standard/resolver-standard.d.ts +204 -0
  74. package/dist/resolution/standard/shorthands-standard.d.ts +98 -0
  75. package/dist/resolution/standard/validators.d.ts +141 -0
  76. package/dist/resolution/types.d.ts +461 -0
  77. package/dist/resolution/validators/factor24-validator.d.ts +418 -0
  78. package/dist/resolution/validators/index.d.ts +14 -0
  79. package/dist/scripts/generate-react-library.d.ts +15 -0
  80. package/dist/scripts/write-react-library.d.ts +18 -0
  81. package/dist/storage/cloud-sync.d.ts +182 -0
  82. package/dist/storage/index.d.ts +69 -0
  83. package/dist/storage/local-storage.d.ts +131 -0
  84. package/dist/storage/section-storage.d.ts +191 -0
  85. package/dist/styling/StyleGenerator.d.ts +76 -0
  86. package/dist/styling/TokenStyleResolver.d.ts +163 -0
  87. package/dist/styling/factor-migration.d.ts +192 -0
  88. package/dist/styling/factor-validators.d.ts +327 -0
  89. package/dist/styling/factors-1-6.d.ts +674 -0
  90. package/dist/styling/factors-12-16.d.ts +700 -0
  91. package/dist/styling/factors-17-24.d.ts +668 -0
  92. package/dist/styling/factors-all.d.ts +348 -0
  93. package/dist/styling/factors.d.ts +291 -0
  94. package/dist/styling/index.d.ts +31 -0
  95. package/dist/styling/types.d.ts +400 -0
  96. package/dist/tokens/schema.d.ts +486 -0
  97. package/dist/types/Option.d.ts +178 -0
  98. package/dist/types/Result.d.ts +148 -0
  99. package/dist/types/algorithm-engine.types.d.ts +298 -0
  100. package/dist/types/granularity/base.types.d.ts +268 -0
  101. package/dist/types/granularity/config.types.d.ts +177 -0
  102. package/dist/types/granularity/factors.types.d.ts +194 -0
  103. package/dist/types/granularity/index.d.ts +57 -0
  104. package/dist/types/granularity/slot.types.d.ts +128 -0
  105. package/dist/types/granularity/template.types.d.ts +179 -0
  106. package/dist/types/granularity-levels/atom.config.d.ts +151 -0
  107. package/dist/types/granularity-levels/component.config.d.ts +175 -0
  108. package/dist/types/granularity-levels/index.d.ts +47 -0
  109. package/dist/types/granularity-levels/layout.config.d.ts +278 -0
  110. package/dist/types/granularity-levels/page.config.d.ts +210 -0
  111. package/dist/types/granularity-levels/section.config.d.ts +188 -0
  112. package/dist/types/granularity-levels/template.config.d.ts +340 -0
  113. package/dist/types/index.d.ts +152 -0
  114. package/dist/types/section-slot.types.d.ts +169 -0
  115. package/dist/types/section-storage.types.d.ts +298 -0
  116. package/dist/types/section-template.types.d.ts +170 -0
  117. package/dist/types/section.types.d.ts +326 -0
  118. package/dist/ui-studio/ComponentGenerator.d.ts +219 -0
  119. package/dist/ui-studio/composition/FactorPropagator.d.ts +268 -0
  120. package/dist/ui-studio/composition/PageGenerator.d.ts +176 -0
  121. package/dist/ui-studio/composition/SectionGenerator.d.ts +312 -0
  122. package/dist/ui-studio/composition/SlotResolver.d.ts +295 -0
  123. package/dist/ui-studio/composition/section-orchestrator.d.ts +306 -0
  124. package/dist/ui-studio/granularity/FactorCascade.d.ts +328 -0
  125. package/dist/ui-studio/granularity/GranularityGenerator.d.ts +266 -0
  126. package/dist/ui-studio/granularity/RecursiveGenerator.d.ts +328 -0
  127. package/dist/ui-studio/index.d.ts +94 -0
  128. package/dist/ui-studio/matrix/ClassMapper.d.ts +128 -0
  129. package/dist/ui-studio/matrix/MatrixResolver.d.ts +203 -0
  130. package/dist/ui-studio/matrix/types.d.ts +96 -0
  131. package/dist/ui-studio/presets/IndustryDetector.d.ts +183 -0
  132. package/dist/ui-studio/presets/component-registry.d.ts +213 -0
  133. package/dist/ui-studio/presets/factor-registry.d.ts +364 -0
  134. package/dist/ui-studio/presets/granularity-registry.d.ts +252 -0
  135. package/dist/ui-studio/presets/index.d.ts +32 -0
  136. package/dist/ui-studio/presets/industries.d.ts +143 -0
  137. package/dist/ui-studio/presets/layout-registry.d.ts +21 -0
  138. package/dist/ui-studio/presets/matrix-groups.d.ts +195 -0
  139. package/dist/ui-studio/presets/page-registry.d.ts +24 -0
  140. package/dist/ui-studio/presets/registry.constants.d.ts +69 -0
  141. package/dist/ui-studio/presets/registry.types.d.ts +166 -0
  142. package/dist/ui-studio/presets/section-defaults.d.ts +175 -0
  143. package/dist/ui-studio/presets/section-registry.d.ts +83 -0
  144. package/dist/ui-studio/presets/section-registry.defaults.d.ts +106 -0
  145. package/dist/ui-studio/presets/section-registry.helpers.d.ts +112 -0
  146. package/dist/ui-studio/presets/section-registry.types.d.ts +181 -0
  147. package/dist/ui-studio/presets/template-registry.d.ts +23 -0
  148. package/dist/ui-studio/presets/variants.d.ts +1038 -0
  149. package/dist/ui-studio/registries/components-registry.d.ts +193 -0
  150. package/dist/ui-studio/registries/design-systems-registry.d.ts +153 -0
  151. package/dist/ui-studio/registries/factors-registry.d.ts +145 -0
  152. package/dist/ui-studio/registries/tiers-registry.d.ts +150 -0
  153. package/dist/ui-studio/resolution/FactorResolver.d.ts +201 -0
  154. package/dist/ui-studio/templates/TestGenerator.d.ts +55 -0
  155. package/dist/ui-studio/templates/TierGenerator.d.ts +153 -0
  156. package/dist/ui-studio/templates/TypesGenerator.d.ts +51 -0
  157. package/dist/ui-studio/types/granularity/base.types.d.ts +268 -0
  158. package/dist/ui-studio/types/granularity/config.types.d.ts +177 -0
  159. package/dist/ui-studio/types/granularity/factors.types.d.ts +194 -0
  160. package/dist/ui-studio/types/granularity/index.d.ts +57 -0
  161. package/dist/ui-studio/types/granularity/slot.types.d.ts +128 -0
  162. package/dist/ui-studio/types/granularity/template.types.d.ts +179 -0
  163. package/dist/ui-studio/types/granularity-levels/atom.config.d.ts +151 -0
  164. package/dist/ui-studio/types/granularity-levels/component.config.d.ts +175 -0
  165. package/dist/ui-studio/types/granularity-levels/index.d.ts +47 -0
  166. package/dist/ui-studio/types/granularity-levels/layout.config.d.ts +278 -0
  167. package/dist/ui-studio/types/granularity-levels/page.config.d.ts +210 -0
  168. package/dist/ui-studio/types/granularity-levels/section.config.d.ts +188 -0
  169. package/dist/ui-studio/types/granularity-levels/template.config.d.ts +340 -0
  170. package/dist/ui-studio/types.d.ts +323 -0
  171. package/dist/utils/CodeUtils.d.ts +103 -0
  172. package/dist/utils/GenerateComponentValidator.d.ts +35 -0
  173. package/dist/utils/Logger.d.ts +101 -0
  174. package/dist/utils/StringUtils.d.ts +120 -0
  175. package/dist/utils/ValidationUtils.d.ts +71 -0
  176. package/dist/utils/errors/BaseError.d.ts +23 -0
  177. package/dist/utils/errors/GenerationError.d.ts +14 -0
  178. package/dist/utils/errors/TemplateNotFoundError.d.ts +13 -0
  179. package/dist/utils/errors/ValidationError.d.ts +13 -0
  180. package/dist/utils/errors/index.d.ts +12 -0
  181. package/dist/utils/factor-resolver.d.ts +294 -0
  182. package/dist/utils/granularity-helpers.d.ts +359 -0
  183. package/dist/utils/index.d.ts +20 -0
  184. package/dist/utils/performance.d.ts +26 -0
  185. package/dist/utils/stringify.d.ts +28 -0
  186. package/dist/validators/component-validator.d.ts +86 -0
  187. package/dist/validators/design-system-validator.d.ts +95 -0
  188. package/dist/validators/factor-validator.d.ts +101 -0
  189. package/dist/validators/index.d.ts +263 -0
  190. package/dist/validators/section-validator.d.ts +120 -0
  191. package/dist/validators/slot-validator.d.ts +161 -0
  192. package/dist/validators/tier-validator.d.ts +102 -0
  193. package/package.json +67 -0
  194. package/tests/16-factor-integration.test.d.ts +14 -0
  195. package/tests/16-factor-visual.test.d.ts +14 -0
  196. package/tests/5-level-integration.test.d.ts +14 -0
  197. package/tests/CodeUtils.test.d.ts +7 -0
  198. package/tests/DesignSystems.test.d.ts +7 -0
  199. package/tests/GenerateComponentValidator.test.d.ts +7 -0
  200. package/tests/Logger.test.d.ts +7 -0
  201. package/tests/StringUtils.test.d.ts +7 -0
  202. package/tests/StyleGenerator.test.d.ts +13 -0
  203. package/tests/Tiers.test.d.ts +7 -0
  204. package/tests/TokenRegistry.test.d.ts +14 -0
  205. package/tests/TokenStyleResolver.test.d.ts +13 -0
  206. package/tests/ValidationUtils.test.d.ts +7 -0
  207. package/tests/_pending_fix/Accordion.test.d.ts +13 -0
  208. package/tests/_pending_fix/Alert.test.d.ts +13 -0
  209. package/tests/_pending_fix/AlertDialog.test.d.ts +13 -0
  210. package/tests/_pending_fix/AspectRatio.test.d.ts +13 -0
  211. package/tests/_pending_fix/Autocomplete.test.d.ts +13 -0
  212. package/tests/_pending_fix/Avatar.test.d.ts +13 -0
  213. package/tests/_pending_fix/Badge.test.d.ts +13 -0
  214. package/tests/_pending_fix/Banner.test.d.ts +13 -0
  215. package/tests/_pending_fix/Box.test.d.ts +13 -0
  216. package/tests/_pending_fix/Breadcrumb.test.d.ts +13 -0
  217. package/tests/_pending_fix/Callout.test.d.ts +13 -0
  218. package/tests/_pending_fix/Card.test.d.ts +13 -0
  219. package/tests/_pending_fix/Center.test.d.ts +13 -0
  220. package/tests/_pending_fix/Checkbox.test.d.ts +13 -0
  221. package/tests/_pending_fix/Chip.test.d.ts +13 -0
  222. package/tests/_pending_fix/ColorPicker.test.d.ts +13 -0
  223. package/tests/_pending_fix/Combobox.test.d.ts +13 -0
  224. package/tests/_pending_fix/CommandPalette.test.d.ts +13 -0
  225. package/tests/_pending_fix/ConfirmationModal.test.d.ts +13 -0
  226. package/tests/_pending_fix/Container.test.d.ts +13 -0
  227. package/tests/_pending_fix/DataTable.test.d.ts +13 -0
  228. package/tests/_pending_fix/DatePicker.test.d.ts +13 -0
  229. package/tests/_pending_fix/DateRangePicker.test.d.ts +13 -0
  230. package/tests/_pending_fix/DateTimePicker.test.d.ts +13 -0
  231. package/tests/_pending_fix/Divider.test.d.ts +13 -0
  232. package/tests/_pending_fix/Drawer.test.d.ts +13 -0
  233. package/tests/_pending_fix/Dropdown.test.d.ts +13 -0
  234. package/tests/_pending_fix/EmptyState.test.d.ts +13 -0
  235. package/tests/_pending_fix/ErrorState.test.d.ts +13 -0
  236. package/tests/_pending_fix/FileDropzone.test.d.ts +13 -0
  237. package/tests/_pending_fix/FileUpload.test.d.ts +13 -0
  238. package/tests/_pending_fix/Flex.test.d.ts +13 -0
  239. package/tests/_pending_fix/Grid.test.d.ts +13 -0
  240. package/tests/_pending_fix/GridItem.test.d.ts +13 -0
  241. package/tests/_pending_fix/HStack.test.d.ts +13 -0
  242. package/tests/_pending_fix/Input.test.d.ts +13 -0
  243. package/tests/_pending_fix/InputCurrency.test.d.ts +13 -0
  244. package/tests/_pending_fix/InputGroup.test.d.ts +13 -0
  245. package/tests/_pending_fix/InputOTP.test.d.ts +13 -0
  246. package/tests/_pending_fix/InputPassword.test.d.ts +13 -0
  247. package/tests/_pending_fix/InputPhone.test.d.ts +13 -0
  248. package/tests/_pending_fix/InputSearch.test.d.ts +13 -0
  249. package/tests/_pending_fix/Link.test.d.ts +13 -0
  250. package/tests/_pending_fix/List.test.d.ts +13 -0
  251. package/tests/_pending_fix/LoadingOverlay.test.d.ts +13 -0
  252. package/tests/_pending_fix/Menu.test.d.ts +13 -0
  253. package/tests/_pending_fix/Modal.test.d.ts +13 -0
  254. package/tests/_pending_fix/MultiSelect.test.d.ts +13 -0
  255. package/tests/_pending_fix/NavGroup.test.d.ts +13 -0
  256. package/tests/_pending_fix/NavItem.test.d.ts +13 -0
  257. package/tests/_pending_fix/NavLink.test.d.ts +13 -0
  258. package/tests/_pending_fix/Navbar.test.d.ts +13 -0
  259. package/tests/_pending_fix/Notification.test.d.ts +13 -0
  260. package/tests/_pending_fix/NotificationBadge.test.d.ts +13 -0
  261. package/tests/_pending_fix/NumberInput.test.d.ts +13 -0
  262. package/tests/_pending_fix/Pagination.test.d.ts +13 -0
  263. package/tests/_pending_fix/Popover.test.d.ts +13 -0
  264. package/tests/_pending_fix/Progress.test.d.ts +13 -0
  265. package/tests/_pending_fix/ProgressCircle.test.d.ts +13 -0
  266. package/tests/_pending_fix/ProgressSteps.test.d.ts +13 -0
  267. package/tests/_pending_fix/Radio.test.d.ts +13 -0
  268. package/tests/_pending_fix/RangeSlider.test.d.ts +13 -0
  269. package/tests/_pending_fix/ResizablePanel.test.d.ts +13 -0
  270. package/tests/_pending_fix/ResultState.test.d.ts +13 -0
  271. package/tests/_pending_fix/ScrollArea.test.d.ts +13 -0
  272. package/tests/_pending_fix/Select.test.d.ts +14 -0
  273. package/tests/_pending_fix/Sheet.test.d.ts +13 -0
  274. package/tests/_pending_fix/Sidebar.test.d.ts +13 -0
  275. package/tests/_pending_fix/SimpleGrid.test.d.ts +13 -0
  276. package/tests/_pending_fix/Skeleton.test.d.ts +13 -0
  277. package/tests/_pending_fix/Slider.test.d.ts +13 -0
  278. package/tests/_pending_fix/Spacer.test.d.ts +13 -0
  279. package/tests/_pending_fix/Spinner.test.d.ts +13 -0
  280. package/tests/_pending_fix/Stack.test.d.ts +13 -0
  281. package/tests/_pending_fix/Stat.test.d.ts +13 -0
  282. package/tests/_pending_fix/Stepper.test.d.ts +14 -0
  283. package/tests/_pending_fix/Switch.test.d.ts +13 -0
  284. package/tests/_pending_fix/Table.test.d.ts +13 -0
  285. package/tests/_pending_fix/Tabs.test.d.ts +13 -0
  286. package/tests/_pending_fix/Textarea.test.d.ts +13 -0
  287. package/tests/_pending_fix/Timeline.test.d.ts +13 -0
  288. package/tests/_pending_fix/Toast.test.d.ts +14 -0
  289. package/tests/_pending_fix/Tooltip.test.d.ts +14 -0
  290. package/tests/_pending_fix/VStack.test.d.ts +13 -0
  291. package/tests/alert.test.d.ts +13 -0
  292. package/tests/badge.test.d.ts +13 -0
  293. package/tests/benchmarks/factor-resolution.bench.d.ts +41 -0
  294. package/tests/button.test.d.ts +16 -0
  295. package/tests/card.test.d.ts +19 -0
  296. package/tests/checkbox.test.d.ts +13 -0
  297. package/tests/component-16-factor-types.test.d.ts +13 -0
  298. package/tests/component-5level-integration.test.d.ts +14 -0
  299. package/tests/component-registry-ui.test.d.ts +13 -0
  300. package/tests/e2e/16-factor-visual.test.d.ts +14 -0
  301. package/tests/edge-cases.test.d.ts +14 -0
  302. package/tests/factor-17-24-integration.test.d.ts +14 -0
  303. package/tests/factor-17-24-performance.test.d.ts +14 -0
  304. package/tests/factor-validators.test.d.ts +13 -0
  305. package/tests/factors-1-6.test.d.ts +13 -0
  306. package/tests/factors-12-16.test.d.ts +13 -0
  307. package/tests/factors-17-24.test.d.ts +21 -0
  308. package/tests/factors-all.test.d.ts +13 -0
  309. package/tests/factors-registry.test.d.ts +11 -0
  310. package/tests/factors.test.d.ts +13 -0
  311. package/tests/granularity-types.test.d.ts +18 -0
  312. package/tests/groups.test.d.ts +14 -0
  313. package/tests/input.test.d.ts +16 -0
  314. package/tests/intents.test.d.ts +14 -0
  315. package/tests/memory-leak.test.d.ts +14 -0
  316. package/tests/modal.test.d.ts +19 -0
  317. package/tests/presets.test.d.ts +14 -0
  318. package/tests/radio.test.d.ts +13 -0
  319. package/tests/resolution-intents.test.d.ts +13 -0
  320. package/tests/resolution-presets.test.d.ts +13 -0
  321. package/tests/resolveProps.test.d.ts +14 -0
  322. package/tests/section-integration.test.d.ts +16 -0
  323. package/tests/section-types.test.d.ts +11 -0
  324. package/tests/setup.d.ts +13 -0
  325. package/tests/shorthands.test.d.ts +14 -0
  326. package/tests/switch.test.d.ts +13 -0
  327. package/tests/tabs.test.d.ts +13 -0
  328. package/tests/tiers-registry.test.d.ts +11 -0
  329. package/tests/useComponentStyles.test.d.ts +11 -0
  330. package/tests/useFactors.test.d.ts +13 -0
  331. package/tests/validators-invalid-input.test.d.ts +13 -0
  332. package/tsup.config.d.ts +11 -0
  333. package/vitest.config.d.ts +3 -0
@@ -0,0 +1,306 @@
1
+ /**
2
+ * Section Generator
3
+ * Coordinates ComponentGenerator calls for each slot in a section
4
+ *
5
+ * @packageDocumentation
6
+ * @module generators/section-generator
7
+ * @since 4.0.0
8
+ *
9
+ * Powered by Nikkory
10
+ */
11
+ import type { SectionConfig, SectionFactors, SlotConfig, StoredComponentInSlot, ComponentType, DesignSystem, Tier } from '../types';
12
+ import type { ComponentGenerator } from '../ComponentGenerator';
13
+ import type { FactorPropagator } from './FactorPropagator';
14
+ import type { ResolvedFactors } from '../../types/algorithm-engine.types';
15
+ /**
16
+ * Input for section generation
17
+ *
18
+ * @remarks
19
+ * Contains all information needed to generate components
20
+ * for a section including config, factors, and slot definitions.
21
+ */
22
+ export interface SectionGenerationInput {
23
+ /** Section configuration (14 fields) */
24
+ readonly sectionConfig: SectionConfig;
25
+ /** Section factors (13 factors) */
26
+ readonly sectionFactors: SectionFactors;
27
+ /** Slot configurations */
28
+ readonly slots: readonly SlotConfig[];
29
+ /** Components stored in slots */
30
+ readonly storedComponents: readonly StoredComponentInSlot[];
31
+ }
32
+ /**
33
+ * Options for section generation behavior
34
+ */
35
+ export interface SectionGenerationOptions {
36
+ /** Generate components in parallel (default: true) */
37
+ readonly parallel?: boolean;
38
+ /** Include CSS variables in output (default: true) */
39
+ readonly includeCssVariables?: boolean;
40
+ /** Include wrapper component (default: true) */
41
+ readonly includeWrapper?: boolean;
42
+ /** Custom class name for section wrapper */
43
+ readonly wrapperClassName?: string;
44
+ }
45
+ /**
46
+ * Generated component in a slot
47
+ */
48
+ export interface GeneratedSlotComponent {
49
+ /** Slot ID */
50
+ readonly slotId: string;
51
+ /** Component instance ID */
52
+ readonly instanceId: string;
53
+ /** Component type */
54
+ readonly componentType: ComponentType;
55
+ /** Generated component code */
56
+ readonly code: string;
57
+ /** Generated styles */
58
+ readonly styles: string;
59
+ /** Resolved component factors */
60
+ readonly factors: ResolvedFactors;
61
+ /** Generation metadata */
62
+ readonly metadata: GeneratedComponentMetadata;
63
+ }
64
+ /**
65
+ * Metadata for generated component
66
+ */
67
+ export interface GeneratedComponentMetadata {
68
+ /** Component type */
69
+ readonly componentType: ComponentType;
70
+ /** Design system used */
71
+ readonly designSystem: DesignSystem;
72
+ /** Quality tier */
73
+ readonly tier: Tier;
74
+ /** Generation timestamp */
75
+ readonly generatedAt: Date;
76
+ /** Lines of code */
77
+ readonly linesOfCode: number;
78
+ }
79
+ /**
80
+ * Result of section generation
81
+ */
82
+ export interface SectionGenerationResult {
83
+ /** Whether generation was successful */
84
+ readonly success: boolean;
85
+ /** Generated slot components */
86
+ readonly components: readonly GeneratedSlotComponent[];
87
+ /** Combined CSS variables */
88
+ readonly cssVariables: string;
89
+ /** Section wrapper code (if includeWrapper) */
90
+ readonly wrapperCode: string;
91
+ /** Complete composed section code */
92
+ readonly composedCode: string;
93
+ /** Generation metadata */
94
+ readonly metadata: SectionGenerationMetadata;
95
+ /** Errors encountered (if any) */
96
+ readonly errors: readonly string[];
97
+ }
98
+ /**
99
+ * Metadata for section generation result
100
+ */
101
+ export interface SectionGenerationMetadata {
102
+ /** Section ID */
103
+ readonly sectionId: string;
104
+ /** Section type */
105
+ readonly sectionType: string;
106
+ /** Number of slots processed */
107
+ readonly slotsProcessed: number;
108
+ /** Number of components generated */
109
+ readonly componentsGenerated: number;
110
+ /** Total lines of code */
111
+ readonly totalLinesOfCode: number;
112
+ /** Generation duration in milliseconds */
113
+ readonly durationMs: number;
114
+ /** Design system used */
115
+ readonly designSystem: DesignSystem;
116
+ /** Quality tier */
117
+ readonly tier: Tier;
118
+ }
119
+ /**
120
+ * Section Generator
121
+ *
122
+ * @remarks
123
+ * Coordinates the generation of all components within a section:
124
+ * 1. Resolves slots to component instances
125
+ * 2. Propagates section factors to each component
126
+ * 3. Generates components in parallel or sequentially
127
+ * 4. Composes the final section output
128
+ *
129
+ * @example
130
+ * ```typescript
131
+ * const generator = createSectionGenerator();
132
+ * const result = await generator.generateSection({
133
+ * sectionConfig,
134
+ * sectionFactors,
135
+ * slots,
136
+ * storedComponents
137
+ * });
138
+ *
139
+ * if (result.success) {
140
+ * console.log(result.composedCode);
141
+ * }
142
+ * ```
143
+ */
144
+ export declare class SectionGenerator {
145
+ private readonly componentGenerator;
146
+ private readonly factorPropagator;
147
+ /**
148
+ * Creates a new SectionGenerator instance
149
+ *
150
+ * @param componentGenerator - ComponentGenerator instance
151
+ * @param factorPropagator - FactorPropagator instance
152
+ */
153
+ constructor(componentGenerator?: ComponentGenerator, factorPropagator?: FactorPropagator);
154
+ /**
155
+ * Generate components for a section
156
+ *
157
+ * @param input - Section generation input
158
+ * @param options - Section generation options
159
+ * @returns Section generation result with generated components
160
+ */
161
+ generateSection(input: SectionGenerationInput, options?: SectionGenerationOptions): Promise<SectionGenerationResult>;
162
+ /**
163
+ * Generate components in parallel using Promise.all
164
+ *
165
+ * @param input - Orchestration input
166
+ * @param errors - Array to collect errors
167
+ * @returns Array of generated slot components
168
+ */
169
+ private generateParallel;
170
+ /**
171
+ * Generate components sequentially
172
+ *
173
+ * @param input - Orchestration input
174
+ * @param errors - Array to collect errors
175
+ * @returns Array of generated slot components
176
+ */
177
+ private generateSequential;
178
+ /**
179
+ * Generate a single slot component
180
+ *
181
+ * @param stored - Stored component configuration
182
+ * @param slot - Slot configuration
183
+ * @param sectionConfig - Section configuration
184
+ * @param sectionFactors - Section factors
185
+ * @param errors - Array to collect errors
186
+ * @returns Generated slot component or null on failure
187
+ */
188
+ private generateSlotComponent;
189
+ /**
190
+ * Generate section wrapper component
191
+ *
192
+ * @param input - Orchestration input
193
+ * @param customClassName - Optional custom class name
194
+ * @returns Section wrapper code
195
+ */
196
+ private generateSectionWrapper;
197
+ /**
198
+ * Compose the final section code
199
+ *
200
+ * @param input - Orchestration input
201
+ * @param components - Generated slot components
202
+ * @param wrapperCode - Section wrapper code
203
+ * @param cssVariables - CSS variables
204
+ * @returns Composed section code
205
+ */
206
+ private composeSection;
207
+ /**
208
+ * Merge CSS variables from all components
209
+ *
210
+ * @param components - Generated components
211
+ * @param factors - Section factors
212
+ * @returns Merged CSS variables string
213
+ */
214
+ private mergeCssVariables;
215
+ /**
216
+ * Generate import statements for components
217
+ *
218
+ * @param components - Generated components
219
+ * @returns Import statements
220
+ */
221
+ private generateImports;
222
+ /**
223
+ * Create an empty result for error cases
224
+ *
225
+ * @param input - Orchestration input
226
+ * @param errors - Error messages
227
+ * @param durationMs - Duration in milliseconds
228
+ * @returns Empty orchestration result
229
+ */
230
+ private createEmptyResult;
231
+ /**
232
+ * Count total lines of code
233
+ *
234
+ * @param components - Generated components
235
+ * @param wrapperCode - Wrapper code
236
+ * @returns Total line count
237
+ */
238
+ private countTotalLines;
239
+ /**
240
+ * Convert string to PascalCase
241
+ *
242
+ * @param str - Input string
243
+ * @returns PascalCase string
244
+ */
245
+ private toPascalCase;
246
+ /**
247
+ * Get spacing value from level
248
+ *
249
+ * @param level - Spacing level
250
+ * @returns CSS spacing value
251
+ */
252
+ private getSpacingValue;
253
+ /**
254
+ * Get max width value from level
255
+ *
256
+ * @param level - Max width level
257
+ * @returns CSS max-width value
258
+ */
259
+ private getMaxWidthValue;
260
+ /**
261
+ * Get border radius value from level
262
+ *
263
+ * @param level - Radius level
264
+ * @returns CSS border-radius value
265
+ */
266
+ private getRadiusValue;
267
+ /**
268
+ * Get elevation/shadow value from level
269
+ *
270
+ * @param level - Elevation level
271
+ * @returns CSS box-shadow value
272
+ */
273
+ private getElevationValue;
274
+ }
275
+ /**
276
+ * Create a new SectionGenerator instance
277
+ *
278
+ * @param componentGenerator - Optional ComponentGenerator
279
+ * @param factorPropagator - Optional FactorPropagator
280
+ * @returns SectionGenerator instance
281
+ *
282
+ * @example
283
+ * ```typescript
284
+ * const generator = createSectionGenerator();
285
+ * ```
286
+ */
287
+ export declare function createSectionGenerator(componentGenerator?: ComponentGenerator, factorPropagator?: FactorPropagator): SectionGenerator;
288
+ /**
289
+ * Convenience function to generate section components
290
+ *
291
+ * @param input - Section generation input
292
+ * @param options - Section generation options
293
+ * @returns Section generation result
294
+ *
295
+ * @example
296
+ * ```typescript
297
+ * const result = await generateSectionComponents({
298
+ * sectionConfig,
299
+ * sectionFactors,
300
+ * slots,
301
+ * storedComponents
302
+ * });
303
+ * ```
304
+ */
305
+ export declare function generateSectionComponents(input: SectionGenerationInput, options?: SectionGenerationOptions): Promise<SectionGenerationResult>;
306
+ //# sourceMappingURL=section-orchestrator.d.ts.map
@@ -0,0 +1,328 @@
1
+ /**
2
+ * FactorCascade - Factor cascade algorithm implementation
3
+ *
4
+ * This module implements the factor cascade algorithm for the Unified
5
+ * Granularity Architecture. Factors cascade DOWN from higher levels
6
+ * (template → layout → page → section → component → atom) based on
7
+ * their cascadeDown property.
8
+ *
9
+ * Key Features:
10
+ * - Dynamic factor resolution based on level and cascadeDown
11
+ * - Factor override priority: Child > Parent > Defaults
12
+ * - Batch operations for cascading multiple factors
13
+ * - Design system-aware defaults
14
+ *
15
+ * Factor Distribution by Level:
16
+ * - Template (level 6): 8 factors - cascadeDown=true
17
+ * - Page (level 4): 5 additional factors
18
+ * - Section (level 3): 5 additional factors
19
+ * - Component (level 2): 6 additional factors
20
+ * - Total: 24 factors
21
+ *
22
+ * @packageDocumentation
23
+ * @module generators
24
+ * @since 4.0.0
25
+ *
26
+ * Powered by Nikkory
27
+ */
28
+ import type { DesignSystem } from '../types';
29
+ import type { GranularityLevel, GranularityFactorValues, GranularityFactorDefinition } from '../../types/granularity';
30
+ /**
31
+ * Input for cascading factors from parent to child
32
+ *
33
+ * @category types
34
+ * @since 4.0.0
35
+ *
36
+ * Powered by Nikkory
37
+ */
38
+ export interface CascadeFactorsInput {
39
+ /** Parent's resolved factors */
40
+ readonly parentFactors: GranularityFactorValues;
41
+ /** Child's granularity level */
42
+ readonly childLevel: GranularityLevel;
43
+ /** Child's explicit factor overrides (highest priority) */
44
+ readonly childOverrides?: GranularityFactorValues;
45
+ /** Design system for defaults */
46
+ readonly designSystem: DesignSystem;
47
+ }
48
+ /**
49
+ * Result of factor cascade operation
50
+ *
51
+ * @category types
52
+ * @since 4.0.0
53
+ *
54
+ * Powered by Nikkory
55
+ */
56
+ export interface CascadeFactorsResult {
57
+ /** Cascaded factors for the child */
58
+ readonly factors: GranularityFactorValues;
59
+ /** Factor IDs that were cascaded from parent */
60
+ readonly cascadedFromParent: readonly string[];
61
+ /** Factor IDs that were overridden by child */
62
+ readonly overriddenByChild: readonly string[];
63
+ /** Factor IDs that used design system defaults */
64
+ readonly fromDefaults: readonly string[];
65
+ }
66
+ /**
67
+ * Options for FactorCascade operations
68
+ *
69
+ * @category types
70
+ * @since 4.0.0
71
+ *
72
+ * Powered by Nikkory
73
+ */
74
+ export interface FactorCascadeOptions {
75
+ /** Whether to include unknown factors (not in registry) */
76
+ readonly includeUnknownFactors?: boolean;
77
+ /** Whether to apply design system defaults for missing factors */
78
+ readonly applyDefaults?: boolean;
79
+ /** Verbose logging */
80
+ readonly verbose?: boolean;
81
+ }
82
+ /**
83
+ * FactorCascade - Handles factor cascading between granularity levels
84
+ *
85
+ * This class implements the factor cascade algorithm that propagates
86
+ * factors from parent levels down to child levels based on the
87
+ * cascadeDown property of each factor.
88
+ *
89
+ * @category generators
90
+ * @since 4.0.0
91
+ *
92
+ * @example
93
+ * ```typescript
94
+ * const cascade = new FactorCascade();
95
+ *
96
+ * // Cascade template factors to page level
97
+ * const result = cascade.cascadeFactors({
98
+ * parentFactors: { spacing: 'lg', colorPrimary: '#3B82F6' },
99
+ * childLevel: 'page',
100
+ * childOverrides: { spacing: 'xl' },
101
+ * designSystem: 'material-design',
102
+ * });
103
+ *
104
+ * console.log(result.factors);
105
+ * // { spacing: 'xl', colorPrimary: '#3B82F6', ... }
106
+ * ```
107
+ *
108
+ * Powered by Nikkory
109
+ */
110
+ export declare class FactorCascade {
111
+ private readonly options;
112
+ constructor(options?: FactorCascadeOptions);
113
+ /**
114
+ * Cascade factors from parent to child with proper priority
115
+ *
116
+ * Priority order (highest to lowest):
117
+ * 1. Child's explicit overrides (childOverrides)
118
+ * 2. Parent's cascading factors (parentFactors with cascadeDown=true)
119
+ * 3. Design system defaults
120
+ *
121
+ * @param input - Cascade input parameters
122
+ * @returns Cascade result with factors and metadata
123
+ *
124
+ * @example
125
+ * ```typescript
126
+ * const result = cascade.cascadeFactors({
127
+ * parentFactors: { spacing: 'lg', gridColumns: 12 },
128
+ * childLevel: 'section',
129
+ * childOverrides: { spacing: 'xl' },
130
+ * designSystem: 'material-design',
131
+ * });
132
+ *
133
+ * // spacing='xl' (from childOverrides)
134
+ * // gridColumns not included (cascadeDown=false for section)
135
+ * ```
136
+ *
137
+ * Powered by Nikkory
138
+ */
139
+ cascadeFactors(input: CascadeFactorsInput): CascadeFactorsResult;
140
+ /**
141
+ * Filter factors that should cascade to a target level
142
+ *
143
+ * Only includes factors that:
144
+ * 1. Have cascadeDown=true
145
+ * 2. Are defined at or above the target level
146
+ *
147
+ * @param factors - Source factors to filter
148
+ * @param targetLevel - Target granularity level
149
+ * @returns Filtered factors that cascade to target
150
+ *
151
+ * @example
152
+ * ```typescript
153
+ * const cascading = cascade.filterCascadingFactors(
154
+ * { spacing: 'lg', gridColumns: 12, colorPrimary: '#3B82F6' },
155
+ * 'section'
156
+ * );
157
+ * // { spacing: 'lg', colorPrimary: '#3B82F6' }
158
+ * // gridColumns excluded because cascadeDown=false
159
+ * ```
160
+ *
161
+ * Powered by Nikkory
162
+ */
163
+ filterCascadingFactors(factors: GranularityFactorValues, targetLevel: GranularityLevel): GranularityFactorValues;
164
+ /**
165
+ * Apply overrides to base factors with proper priority
166
+ *
167
+ * Override priority (highest to lowest):
168
+ * 1. Explicit overrides parameter
169
+ * 2. Base factors
170
+ *
171
+ * @param baseFactors - Base factor values
172
+ * @param overrides - Override values (highest priority)
173
+ * @returns Merged factors with overrides applied
174
+ *
175
+ * @example
176
+ * ```typescript
177
+ * const merged = cascade.applyFactorOverrides(
178
+ * { spacing: 'lg', colorPrimary: '#3B82F6' },
179
+ * { spacing: 'xl' }
180
+ * );
181
+ * // { spacing: 'xl', colorPrimary: '#3B82F6' }
182
+ * ```
183
+ *
184
+ * Powered by Nikkory
185
+ */
186
+ applyFactorOverrides(baseFactors: GranularityFactorValues, overrides: GranularityFactorValues): GranularityFactorValues;
187
+ /**
188
+ * Get all factors applicable at a given granularity level
189
+ *
190
+ * Includes factors defined at this level AND factors from higher
191
+ * levels that have cascadeDown enabled.
192
+ *
193
+ * @param level - The granularity level to query
194
+ * @returns Array of factor definitions applicable at this level
195
+ *
196
+ * Powered by Nikkory
197
+ */
198
+ getFactorsForLevel(level: GranularityLevel): readonly GranularityFactorDefinition[];
199
+ /**
200
+ * Get factor count for each granularity level
201
+ *
202
+ * @returns Map of level to factor count
203
+ *
204
+ * @example
205
+ * ```typescript
206
+ * const counts = cascade.getFactorCountByLevel();
207
+ * console.log(counts);
208
+ * // { template: 8, layout: 10, page: 13, section: 18, component: 24, atom: 24 }
209
+ * ```
210
+ *
211
+ * Powered by Nikkory
212
+ */
213
+ getFactorCountByLevel(): Record<GranularityLevel, number>;
214
+ /**
215
+ * Check if a factor cascades to a target level
216
+ *
217
+ * @param factorId - Factor ID to check
218
+ * @param targetLevel - Target level
219
+ * @returns True if factor cascades to target
220
+ *
221
+ * Powered by Nikkory
222
+ */
223
+ doesFactorCascadeTo(factorId: string, targetLevel: GranularityLevel): boolean;
224
+ /**
225
+ * Log message if verbose mode is enabled
226
+ *
227
+ * @param message - Message to log
228
+ *
229
+ * Powered by Nikkory
230
+ */
231
+ private log;
232
+ }
233
+ /**
234
+ * Create a new FactorCascade instance
235
+ *
236
+ * @param options - Cascade options
237
+ * @returns FactorCascade instance
238
+ *
239
+ * @example
240
+ * ```typescript
241
+ * const cascade = createFactorCascade({ verbose: true });
242
+ * const result = cascade.cascadeFactors({ ... });
243
+ * ```
244
+ *
245
+ * Powered by Nikkory
246
+ */
247
+ export declare function createFactorCascade(options?: FactorCascadeOptions): FactorCascade;
248
+ /**
249
+ * Cascade factors from parent to child (standalone function)
250
+ *
251
+ * @param input - Cascade input parameters
252
+ * @param options - Cascade options
253
+ * @returns Cascade result
254
+ *
255
+ * @example
256
+ * ```typescript
257
+ * import { cascadeFactors } from '@nikkory/vibe-engine';
258
+ *
259
+ * const result = cascadeFactors({
260
+ * parentFactors: { spacing: 'lg' },
261
+ * childLevel: 'section',
262
+ * designSystem: 'material-design',
263
+ * });
264
+ * ```
265
+ *
266
+ * Powered by Nikkory
267
+ */
268
+ export declare function cascadeFactors(input: CascadeFactorsInput, options?: FactorCascadeOptions): CascadeFactorsResult;
269
+ /**
270
+ * Filter cascading factors (standalone function)
271
+ *
272
+ * @param factors - Source factors
273
+ * @param targetLevel - Target level
274
+ * @param options - Cascade options
275
+ * @returns Filtered factors
276
+ *
277
+ * @example
278
+ * ```typescript
279
+ * import { filterCascadingFactors } from '@nikkory/vibe-engine';
280
+ *
281
+ * const cascading = filterCascadingFactors(
282
+ * { spacing: 'lg', gridColumns: 12 },
283
+ * 'section'
284
+ * );
285
+ * ```
286
+ *
287
+ * Powered by Nikkory
288
+ */
289
+ export declare function filterCascadingFactors(factors: GranularityFactorValues, targetLevel: GranularityLevel, options?: FactorCascadeOptions): GranularityFactorValues;
290
+ /**
291
+ * Apply factor overrides (standalone function)
292
+ *
293
+ * @param baseFactors - Base factors
294
+ * @param overrides - Override factors
295
+ * @returns Merged factors
296
+ *
297
+ * @example
298
+ * ```typescript
299
+ * import { applyFactorOverrides } from '@nikkory/vibe-engine';
300
+ *
301
+ * const merged = applyFactorOverrides(
302
+ * { spacing: 'lg' },
303
+ * { spacing: 'xl' }
304
+ * );
305
+ * // { spacing: 'xl' }
306
+ * ```
307
+ *
308
+ * Powered by Nikkory
309
+ */
310
+ export declare function applyFactorOverrides(baseFactors: GranularityFactorValues, overrides: GranularityFactorValues): GranularityFactorValues;
311
+ /**
312
+ * Get factors applicable at a level (standalone function)
313
+ *
314
+ * @param level - Granularity level
315
+ * @returns Array of factor definitions
316
+ *
317
+ * @example
318
+ * ```typescript
319
+ * import { getFactorsForLevel } from '@nikkory/vibe-engine';
320
+ *
321
+ * const pageFactors = getFactorsForLevel('page');
322
+ * console.log(pageFactors.length); // ~13
323
+ * ```
324
+ *
325
+ * Powered by Nikkory
326
+ */
327
+ export declare function getFactorsForLevel(level: GranularityLevel): readonly GranularityFactorDefinition[];
328
+ //# sourceMappingURL=FactorCascade.d.ts.map