@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,148 @@
1
+ /**
2
+ * Result Type - Railway-Oriented Programming
3
+ *
4
+ * Functional error handling without exceptions.
5
+ * Represents either a successful value or an error.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * function divide(a: number, b: number): Result<number, Error> {
10
+ * if (b === 0) {
11
+ * return Result.fail(new Error('Division by zero'));
12
+ * }
13
+ * return Result.ok(a / b);
14
+ * }
15
+ *
16
+ * const result = divide(10, 2);
17
+ * if (result.isSuccess()) {
18
+ * console.log('Value:', result.getValue()); // 5
19
+ * } else {
20
+ * console.error('Error:', result.getError());
21
+ * }
22
+ * ```
23
+ *
24
+ * Powered by Nikkory
25
+ */
26
+ export declare class Result<T, E = Error> {
27
+ private readonly success;
28
+ private readonly value?;
29
+ private readonly error?;
30
+ private constructor();
31
+ /**
32
+ * Create a successful Result
33
+ *
34
+ * @param value - The success value
35
+ * @returns Result containing the value
36
+ */
37
+ static ok<T, E = Error>(value?: T): Result<T, E>;
38
+ /**
39
+ * Create a failed Result
40
+ *
41
+ * @param error - The error
42
+ * @returns Result containing the error
43
+ */
44
+ static fail<T, E = Error>(error: E): Result<T, E>;
45
+ /**
46
+ * Check if Result is successful
47
+ */
48
+ isSuccess(): boolean;
49
+ /**
50
+ * Check if Result is failure
51
+ */
52
+ isFailure(): boolean;
53
+ /**
54
+ * Get the value (throws if failure)
55
+ *
56
+ * @throws {Error} If Result is a failure
57
+ */
58
+ getValue(): T;
59
+ /**
60
+ * Get the error (throws if success)
61
+ *
62
+ * @throws {Error} If Result is a success
63
+ */
64
+ getError(): E;
65
+ /**
66
+ * Get value or default
67
+ *
68
+ * @param defaultValue - Value to return if Result is failure
69
+ */
70
+ getOrElse(defaultValue: T): T;
71
+ /**
72
+ * Get value or compute default
73
+ *
74
+ * @param fn - Function to compute default value
75
+ */
76
+ getOrElseCompute(fn: (error: E) => T): T;
77
+ /**
78
+ * Map the value if successful
79
+ *
80
+ * @param fn - Mapping function
81
+ * @returns New Result with mapped value
82
+ */
83
+ map<U>(fn: (value: T) => U): Result<U, E>;
84
+ /**
85
+ * Map the error if failure
86
+ *
87
+ * @param fn - Error mapping function
88
+ * @returns New Result with mapped error
89
+ */
90
+ mapError<F>(fn: (error: E) => F): Result<T, F>;
91
+ /**
92
+ * Flat map (chain) operations
93
+ *
94
+ * @param fn - Function returning a Result
95
+ * @returns Flattened Result
96
+ */
97
+ flatMap<U>(fn: (value: T) => Result<U, E>): Result<U, E>;
98
+ /**
99
+ * Execute callback if successful
100
+ *
101
+ * @param fn - Callback function
102
+ * @returns This Result for chaining
103
+ */
104
+ onSuccess(fn: (value: T) => void): Result<T, E>;
105
+ /**
106
+ * Execute callback if failure
107
+ *
108
+ * @param fn - Callback function
109
+ * @returns This Result for chaining
110
+ */
111
+ onFailure(fn: (error: E) => void): Result<T, E>;
112
+ /**
113
+ * Match pattern for Result
114
+ *
115
+ * @param patterns - Success and failure handlers
116
+ * @returns Result of the matched pattern
117
+ */
118
+ match<U>(patterns: {
119
+ ok: (value: T) => U;
120
+ fail: (error: E) => U;
121
+ }): U;
122
+ /**
123
+ * Convert Result to JSON
124
+ */
125
+ toJSON(): object;
126
+ /**
127
+ * Combine multiple Results
128
+ *
129
+ * @param results - Array of Results
130
+ * @returns Result containing array of values or first error
131
+ */
132
+ static combine<T, E = Error>(results: Result<T, E>[]): Result<T[], E>;
133
+ /**
134
+ * Try to execute a function and wrap result
135
+ *
136
+ * @param fn - Function to execute
137
+ * @returns Result wrapping the function result or error
138
+ */
139
+ static try<T>(fn: () => T): Result<T, Error>;
140
+ /**
141
+ * Try to execute an async function and wrap result
142
+ *
143
+ * @param fn - Async function to execute
144
+ * @returns Promise of Result wrapping the function result or error
145
+ */
146
+ static tryAsync<T>(fn: () => Promise<T>): Promise<Result<T, Error>>;
147
+ }
148
+ //# sourceMappingURL=Result.d.ts.map
@@ -0,0 +1,298 @@
1
+ /**
2
+ * Algorithm Engine Types
3
+ * Core types for the 24-Factor × 3-Tier × 12-Design-Systems generation engine
4
+ *
5
+ * @packageDocumentation
6
+ * @module types/algorithm-engine
7
+ * @since 4.0.0
8
+ *
9
+ * Powered by Nikkory
10
+ */
11
+ import type { Tier, DesignSystem, ComponentType } from './index';
12
+ /**
13
+ * Factor ID (1-24)
14
+ * Each factor represents a styling dimension in the 24-Factor system
15
+ */
16
+ export type FactorId = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24;
17
+ /**
18
+ * Factor Group
19
+ * Logical grouping of factors by purpose
20
+ */
21
+ export type FactorGroup = 'visual' | 'layout' | 'motion' | 'experience';
22
+ /**
23
+ * Factor Definition
24
+ * Complete definition of a single factor in the 24-Factor system
25
+ */
26
+ export interface FactorDefinition {
27
+ /** Factor ID (1-24) */
28
+ readonly id: FactorId;
29
+ /** Human-readable name */
30
+ readonly name: string;
31
+ /** Detailed description of what this factor controls */
32
+ readonly description: string;
33
+ /** Logical group this factor belongs to */
34
+ readonly group: FactorGroup;
35
+ /** CSS property this factor maps to (if applicable) */
36
+ readonly cssProperty?: string;
37
+ /** Data attribute for Hybrid integration */
38
+ readonly dataAttribute?: string;
39
+ /** Default value when no design system value is provided */
40
+ readonly defaultValue: string;
41
+ /** All possible values this factor can have */
42
+ readonly possibleValues: readonly string[];
43
+ }
44
+ /**
45
+ * Factor Value from Design System
46
+ * Resolved value for a factor from a specific design system
47
+ */
48
+ export interface FactorValue {
49
+ /** Factor ID this value is for */
50
+ readonly factorId: FactorId;
51
+ /** Semantic value name (e.g., 'md', 'lg', 'primary') */
52
+ readonly value: string;
53
+ /** Generated Tailwind CSS classes */
54
+ readonly tailwindClasses: string;
55
+ /** Optional CSS variables for Hybrid integration */
56
+ readonly cssVariables?: Record<string, string>;
57
+ }
58
+ /**
59
+ * Code Features by Tier
60
+ * Defines which React patterns are required for each tier
61
+ */
62
+ export interface TierCodeFeatures {
63
+ /** Use React.forwardRef for ref forwarding */
64
+ readonly useForwardRef: boolean;
65
+ /** Use React.memo for performance optimization */
66
+ readonly useMemo: boolean;
67
+ /** Use useCallback for handler memoization */
68
+ readonly useCallback: boolean;
69
+ /** Set displayName for debugging */
70
+ readonly setDisplayName: boolean;
71
+ /** Include analytics event tracking */
72
+ readonly includeAnalytics: boolean;
73
+ /** Include ARIA attributes for accessibility */
74
+ readonly includeAria: boolean;
75
+ }
76
+ /**
77
+ * Lines of Code Range
78
+ * Expected LOC range for components in this tier
79
+ */
80
+ export interface LocRange {
81
+ readonly min: number;
82
+ readonly max: number;
83
+ }
84
+ /**
85
+ * Factor Range
86
+ * Defines which factors (1-24) are enabled for a tier
87
+ */
88
+ export interface FactorRange {
89
+ /** Starting factor ID (inclusive) */
90
+ readonly start: FactorId;
91
+ /** Ending factor ID (inclusive) */
92
+ readonly end: FactorId;
93
+ }
94
+ /**
95
+ * Tier Registry Entry
96
+ * Complete definition of a tier's capabilities and constraints
97
+ */
98
+ export interface TierRegistryEntry {
99
+ /** Tier identifier */
100
+ readonly tier: Tier;
101
+ /** Which factors are enabled for this tier */
102
+ readonly factorRange: FactorRange;
103
+ /** Which code features are required for this tier */
104
+ readonly codeFeatures: TierCodeFeatures;
105
+ /** Expected lines of code range */
106
+ readonly locRange: LocRange;
107
+ }
108
+ /**
109
+ * Factor Applicability for Component
110
+ * Defines whether a factor applies to a specific component type
111
+ *
112
+ * - null: Factor not applicable (khuyết) - skip this factor
113
+ * - true: Factor applicable with design system default value
114
+ * - string: Factor applicable with specific override value
115
+ */
116
+ export type FactorApplicability = null | true | string;
117
+ /**
118
+ * Component Registry Entry
119
+ * Complete definition of a component's generation requirements
120
+ */
121
+ export interface ComponentRegistryEntry {
122
+ /** Unique component ID (e.g., 'button', 'card', 'modal') */
123
+ readonly id: string;
124
+ /** Human-readable name */
125
+ readonly name: string;
126
+ /** Component category (e.g., 'basic', 'feedback', 'navigation') */
127
+ readonly category: string;
128
+ /** Base HTML element type (e.g., 'button', 'div', 'section') */
129
+ readonly elementType: string;
130
+ /** Factor applicability map - which factors apply to this component */
131
+ readonly factorApplicability: Partial<Record<FactorId, FactorApplicability>>;
132
+ /** Which design systems this component supports */
133
+ readonly designSystems: readonly DesignSystem[];
134
+ /** Which tiers this component supports */
135
+ readonly tiers: readonly Tier[];
136
+ }
137
+ /**
138
+ * Design System Registry Entry
139
+ * Complete definition of a design system's factor values
140
+ */
141
+ export interface DesignSystemRegistryEntry {
142
+ /** Design system identifier */
143
+ readonly id: DesignSystem;
144
+ /** Human-readable name */
145
+ readonly name: string;
146
+ /** Description of design system aesthetic */
147
+ readonly description: string;
148
+ /** Factor values for this design system */
149
+ readonly factorValues: Partial<Record<FactorId, FactorValue>>;
150
+ /** CSS variables for Hybrid integration */
151
+ readonly cssVariables: Record<string, string>;
152
+ /** Optional Tailwind config extensions */
153
+ readonly tailwindConfig?: Record<string, unknown>;
154
+ }
155
+ /**
156
+ * Generation Input
157
+ * Input parameters for generating a component
158
+ */
159
+ export interface GenerationInput {
160
+ /** Component type to generate */
161
+ readonly componentType: ComponentType;
162
+ /** Design system to use */
163
+ readonly designSystem: DesignSystem;
164
+ /** Quality tier */
165
+ readonly tier: Tier;
166
+ /** Optional factor value overrides */
167
+ readonly factorOverrides?: Partial<Record<FactorId, string>>;
168
+ /** Optional output directory */
169
+ readonly outputDir?: string;
170
+ }
171
+ /**
172
+ * Generation Metadata
173
+ * Metadata about the generated component
174
+ */
175
+ export interface GenerationMetadata {
176
+ /** Generated component name (e.g., 'MaterialButtonEnterprise') */
177
+ readonly componentName: string;
178
+ /** Display name for React DevTools */
179
+ readonly displayName: string;
180
+ /** Factors that were applied */
181
+ readonly factorsApplied: FactorId[];
182
+ /** Total lines of code */
183
+ readonly linesOfCode: number;
184
+ /** Generation timestamp */
185
+ readonly generatedAt: Date;
186
+ }
187
+ /**
188
+ * Generation Output
189
+ * Complete output from component generation
190
+ */
191
+ export interface GenerationOutput {
192
+ /** Generated component code */
193
+ readonly code: string;
194
+ /** Generated styles (Tailwind classes or CSS) */
195
+ readonly styles: string;
196
+ /** Optional TypeScript types file content */
197
+ readonly types?: string;
198
+ /** Optional test file content */
199
+ readonly tests?: string;
200
+ /** Generation metadata */
201
+ readonly metadata: GenerationMetadata;
202
+ }
203
+ /**
204
+ * Resolved Factors
205
+ * Result of 3-layer factor resolution
206
+ */
207
+ export interface ResolvedFactors {
208
+ /** Tier that was used for resolution */
209
+ readonly tier: Tier;
210
+ /** Factors that were applied with their values */
211
+ readonly appliedFactors: Map<FactorId, FactorValue>;
212
+ /** Factors that were skipped (not applicable to component) */
213
+ readonly skippedFactors: FactorId[];
214
+ /** Factors that were overridden by user */
215
+ readonly overriddenFactors: FactorId[];
216
+ }
217
+ /**
218
+ * Factor Resolver Input
219
+ * Input for the 3-layer factor resolution process
220
+ */
221
+ export interface FactorResolverInput {
222
+ /** Component type being generated */
223
+ readonly componentType: ComponentType;
224
+ /** Target design system */
225
+ readonly designSystem: DesignSystem;
226
+ /** Quality tier */
227
+ readonly tier: Tier;
228
+ /** Optional factor overrides */
229
+ readonly factorOverrides?: Partial<Record<FactorId, string>>;
230
+ }
231
+ /**
232
+ * Batch Generation Input
233
+ * Input for generating multiple components at once
234
+ */
235
+ export interface BatchGenerationInput {
236
+ /** Component types to generate (or all if not specified) */
237
+ readonly componentTypes?: readonly ComponentType[];
238
+ /** Design systems to generate for (or all if not specified) */
239
+ readonly designSystems?: readonly DesignSystem[];
240
+ /** Tiers to generate (or all if not specified) */
241
+ readonly tiers?: readonly Tier[];
242
+ /** Output directory base path */
243
+ readonly outputDir: string;
244
+ /** Whether to overwrite existing files */
245
+ readonly overwrite?: boolean;
246
+ }
247
+ /**
248
+ * Batch Generation Result
249
+ * Result of batch component generation
250
+ */
251
+ export interface BatchGenerationResult {
252
+ /** Total components requested */
253
+ readonly total: number;
254
+ /** Successfully generated count */
255
+ readonly successful: number;
256
+ /** Failed generation count */
257
+ readonly failed: number;
258
+ /** Total lines of code generated */
259
+ readonly totalLinesOfCode: number;
260
+ /** Individual generation results */
261
+ readonly results: readonly GenerationResultItem[];
262
+ /** Generation duration in milliseconds */
263
+ readonly durationMs: number;
264
+ }
265
+ /**
266
+ * Generation Result Item
267
+ * Result for a single component in batch generation
268
+ */
269
+ export interface GenerationResultItem {
270
+ /** Component identifier */
271
+ readonly componentId: string;
272
+ /** Whether generation succeeded */
273
+ readonly success: boolean;
274
+ /** Error message if failed */
275
+ readonly error?: string;
276
+ /** Output file path if succeeded */
277
+ readonly outputPath?: string;
278
+ /** Lines of code if succeeded */
279
+ readonly linesOfCode?: number;
280
+ }
281
+ /**
282
+ * Validation Result
283
+ * Result of input validation
284
+ */
285
+ export interface ValidationResult {
286
+ /** Whether validation passed */
287
+ readonly valid: boolean;
288
+ /** Validation error messages (if any) */
289
+ readonly errors: readonly string[];
290
+ /** Validation warning messages (if any) */
291
+ readonly warnings: readonly string[];
292
+ }
293
+ /**
294
+ * Validator Function Type
295
+ * Generic validator function signature
296
+ */
297
+ export type ValidatorFn<T> = (input: T) => ValidationResult;
298
+ //# sourceMappingURL=algorithm-engine.types.d.ts.map
@@ -0,0 +1,268 @@
1
+ /**
2
+ * Base Types for Unified Granularity Architecture
3
+ *
4
+ * This file defines the core types for the 6-level granularity system,
5
+ * replacing duplicate Section/Page/Layout/Template patterns with a
6
+ * unified generic approach.
7
+ *
8
+ * @packageDocumentation
9
+ * @module types/granularity
10
+ * @since 4.0.0
11
+ *
12
+ * Powered by Nikkory
13
+ */
14
+ import type { DesignSystem, Tier } from '../index';
15
+ /**
16
+ * 6 Granularity Levels - Component hierarchy from smallest to largest
17
+ *
18
+ * @category types
19
+ * @since 4.0.0
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * const level: GranularityLevel = 'section';
24
+ * const config: GranularityConfig<'page'> = { ... };
25
+ * ```
26
+ *
27
+ * Powered by Nikkory
28
+ */
29
+ export type GranularityLevel = 'atom' | 'component' | 'section' | 'page' | 'layout' | 'template';
30
+ /**
31
+ * Granularity hierarchy for cascade - ordered from highest to lowest
32
+ *
33
+ * Higher levels cascade factors DOWN to lower levels.
34
+ * Template is the highest level (6), Atom is the lowest (1).
35
+ *
36
+ * @category constants
37
+ * @since 4.0.0
38
+ *
39
+ * @example
40
+ * ```typescript
41
+ * // Iterate from highest to lowest
42
+ * for (const level of GRANULARITY_HIERARCHY) {
43
+ * console.log(level); // template, layout, page, section, component, atom
44
+ * }
45
+ * ```
46
+ *
47
+ * Powered by Nikkory
48
+ */
49
+ export declare const GRANULARITY_HIERARCHY: readonly GranularityLevel[];
50
+ /**
51
+ * Get numeric rank for a granularity level
52
+ *
53
+ * Returns a number where:
54
+ * - template = 6 (highest)
55
+ * - layout = 5
56
+ * - page = 4
57
+ * - section = 3
58
+ * - component = 2
59
+ * - atom = 1 (lowest)
60
+ *
61
+ * @category utils
62
+ * @since 4.0.0
63
+ *
64
+ * @param level - The granularity level to get rank for
65
+ * @returns Numeric rank (1-6)
66
+ *
67
+ * @example
68
+ * ```typescript
69
+ * getGranularityRank('template'); // 6
70
+ * getGranularityRank('atom'); // 1
71
+ * getGranularityRank('section'); // 3
72
+ *
73
+ * // Use for comparison
74
+ * if (getGranularityRank(a) > getGranularityRank(b)) {
75
+ * // a is higher level than b
76
+ * }
77
+ * ```
78
+ *
79
+ * Powered by Nikkory
80
+ */
81
+ export declare function getGranularityRank(level: GranularityLevel): number;
82
+ /**
83
+ * Factor categories for grouping related factors
84
+ *
85
+ * @category types
86
+ * @since 4.0.0
87
+ *
88
+ * @example
89
+ * ```typescript
90
+ * const category: FactorCategory = 'visual';
91
+ * ```
92
+ *
93
+ * Powered by Nikkory
94
+ */
95
+ export type GranularityFactorCategory = 'visual' | 'layout' | 'behavior' | 'responsive' | 'a11y';
96
+ /**
97
+ * Factor definition with level and cascade behavior
98
+ *
99
+ * This REPLACES hardcoded 8/13/24 factor arrays with a dynamic
100
+ * registry-based approach where each factor specifies its minimum
101
+ * level and whether it cascades down to child granularities.
102
+ *
103
+ * @category types
104
+ * @since 4.0.0
105
+ *
106
+ * @example
107
+ * ```typescript
108
+ * const spacingFactor: GranularityFactorDefinition = {
109
+ * id: 'spacing',
110
+ * name: 'Spacing',
111
+ * category: 'layout',
112
+ * level: 'template',
113
+ * cascadeDown: true,
114
+ * defaults: {
115
+ * 'material-design': 'md',
116
+ * 'ios-hig': 'sm'
117
+ * },
118
+ * options: ['xs', 'sm', 'md', 'lg', 'xl'],
119
+ * description: 'Controls spacing between elements'
120
+ * };
121
+ * ```
122
+ *
123
+ * Powered by Nikkory
124
+ */
125
+ export interface GranularityFactorDefinition {
126
+ /** Factor unique identifier */
127
+ readonly id: string;
128
+ /** Human-readable name */
129
+ readonly name: string;
130
+ /** Factor category */
131
+ readonly category: GranularityFactorCategory;
132
+ /** Minimum granularity level where this factor applies */
133
+ readonly level: GranularityLevel;
134
+ /** Whether factor cascades DOWN to child granularities */
135
+ readonly cascadeDown: boolean;
136
+ /** Default value per design system */
137
+ readonly defaults: Partial<Record<DesignSystem, unknown>>;
138
+ /** Possible values */
139
+ readonly options?: readonly unknown[];
140
+ /** Description for documentation */
141
+ readonly description: string;
142
+ }
143
+ /**
144
+ * Template visibility levels for sharing
145
+ *
146
+ * @category types
147
+ * @since 4.0.0
148
+ *
149
+ * Powered by Nikkory
150
+ */
151
+ export type GranularityTemplateVisibility = 'private' | 'team' | 'public';
152
+ /**
153
+ * Layout configuration for slot arrangements
154
+ *
155
+ * @category types
156
+ * @since 4.0.0
157
+ *
158
+ * @example
159
+ * ```typescript
160
+ * const layout: LayoutConfig = {
161
+ * type: 'grid',
162
+ * columns: 3,
163
+ * gap: 'md',
164
+ * alignment: 'center'
165
+ * };
166
+ * ```
167
+ *
168
+ * Powered by Nikkory
169
+ */
170
+ export interface GranularityLayoutConfig {
171
+ readonly type: 'grid' | 'flex' | 'stack' | 'masonry' | 'carousel';
172
+ readonly columns?: 1 | 2 | 3 | 4 | 6;
173
+ readonly gap?: GranularitySpacingLevel;
174
+ readonly alignment?: GranularityAlignmentType;
175
+ }
176
+ /**
177
+ * Spacing levels for consistent spacing scale
178
+ *
179
+ * @category types
180
+ * @since 4.0.0
181
+ *
182
+ * Powered by Nikkory
183
+ */
184
+ export type GranularitySpacingLevel = 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
185
+ /**
186
+ * Alignment types for layout positioning
187
+ *
188
+ * @category types
189
+ * @since 4.0.0
190
+ *
191
+ * Powered by Nikkory
192
+ */
193
+ export type GranularityAlignmentType = 'start' | 'center' | 'end' | 'stretch' | 'between';
194
+ /**
195
+ * Style overrides for customization
196
+ *
197
+ * @category types
198
+ * @since 4.0.0
199
+ *
200
+ * @example
201
+ * ```typescript
202
+ * const styles: StyleOverrides = {
203
+ * className: 'custom-section',
204
+ * tailwindClasses: 'bg-gray-100 p-4 rounded-lg'
205
+ * };
206
+ * ```
207
+ *
208
+ * Powered by Nikkory
209
+ */
210
+ export interface GranularityStyleOverrides {
211
+ readonly className?: string;
212
+ readonly style?: Record<string, string>;
213
+ readonly tailwindClasses?: string;
214
+ }
215
+ /**
216
+ * Factor values map - key-value pairs for resolved factors
217
+ *
218
+ * @category types
219
+ * @since 4.0.0
220
+ *
221
+ * @example
222
+ * ```typescript
223
+ * const factors: FactorValues = {
224
+ * spacing: 'md',
225
+ * colorPrimary: '#3B82F6',
226
+ * borderRadius: 'lg'
227
+ * };
228
+ * ```
229
+ *
230
+ * Powered by Nikkory
231
+ */
232
+ export type GranularityFactorValues = Record<string, unknown>;
233
+ /**
234
+ * Base fields shared by ALL granularity levels
235
+ *
236
+ * This interface defines the common fields that every granularity
237
+ * config must have, regardless of whether it's an atom, component,
238
+ * section, page, layout, or template.
239
+ *
240
+ * @category types
241
+ * @since 4.0.0
242
+ *
243
+ * @typeParam G - The granularity level this config is for
244
+ *
245
+ * @example
246
+ * ```typescript
247
+ * interface MySectionConfig extends GranularityBaseFields<'section'> {
248
+ * customField: string;
249
+ * }
250
+ * ```
251
+ *
252
+ * Powered by Nikkory
253
+ */
254
+ export interface GranularityBaseFields<G extends GranularityLevel> {
255
+ /** Unique identifier */
256
+ readonly id: string;
257
+ /** Granularity level */
258
+ readonly granularity: G;
259
+ /** Design system */
260
+ readonly designSystem: DesignSystem;
261
+ /** Quality tier */
262
+ readonly tier: Tier;
263
+ /** Display title */
264
+ readonly title: string;
265
+ /** Optional subtitle/description */
266
+ readonly subtitle?: string;
267
+ }
268
+ //# sourceMappingURL=base.types.d.ts.map