@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.
- package/PUBLISH-GUIDE.md +250 -0
- package/README.md +1267 -0
- package/bin/vibe.js +22 -0
- package/dist/adapters/index.d.ts +19 -0
- package/dist/browser.d.ts +25 -0
- package/dist/browser.js +15083 -0
- package/dist/browser.mjs +15000 -0
- package/dist/cli/batch-command.d.ts +142 -0
- package/dist/cli/generate-command.d.ts +119 -0
- package/dist/cli/index.d.ts +34 -0
- package/dist/constants/ComponentTypes.d.ts +65 -0
- package/dist/constants/DesignSystems.d.ts +64 -0
- package/dist/constants/Frameworks.d.ts +71 -0
- package/dist/constants/Tiers.d.ts +72 -0
- package/dist/constants/index.d.ts +10 -0
- package/dist/converters/index.d.ts +12 -0
- package/dist/converters/section-converter.d.ts +176 -0
- package/dist/index.d.ts +58 -0
- package/dist/index.js +19819 -0
- package/dist/index.mjs +19496 -0
- package/dist/resolution/basic/groups-basic.d.ts +80 -0
- package/dist/resolution/basic/index.d.ts +21 -0
- package/dist/resolution/basic/intents-basic.d.ts +195 -0
- package/dist/resolution/basic/presets-basic.d.ts +96 -0
- package/dist/resolution/basic/resolver-basic.d.ts +127 -0
- package/dist/resolution/basic/shorthands-basic.d.ts +88 -0
- package/dist/resolution/core/groups-core.d.ts +160 -0
- package/dist/resolution/core/index.d.ts +21 -0
- package/dist/resolution/core/intents-core.d.ts +355 -0
- package/dist/resolution/core/presets-core.d.ts +160 -0
- package/dist/resolution/core/resolver-core.d.ts +207 -0
- package/dist/resolution/core/shorthands-core.d.ts +144 -0
- package/dist/resolution/core/types-core.d.ts +167 -0
- package/dist/resolution/debugger.d.ts +183 -0
- package/dist/resolution/demo.d.ts +57 -0
- package/dist/resolution/enterprise/index.d.ts +22 -0
- package/dist/resolution/enterprise/metrics.d.ts +152 -0
- package/dist/resolution/enterprise/resolver-enterprise.d.ts +108 -0
- package/dist/resolution/examples.d.ts +486 -0
- package/dist/resolution/groups/experience-group.d.ts +197 -0
- package/dist/resolution/groups/index.d.ts +196 -0
- package/dist/resolution/groups/layout-group.d.ts +192 -0
- package/dist/resolution/groups/motion-group.d.ts +127 -0
- package/dist/resolution/groups/visual-group.d.ts +146 -0
- package/dist/resolution/index.d.ts +41 -0
- package/dist/resolution/intents/button-intents.d.ts +231 -0
- package/dist/resolution/intents/card-intents.d.ts +177 -0
- package/dist/resolution/intents/feedback-intents.d.ts +222 -0
- package/dist/resolution/intents/index.d.ts +189 -0
- package/dist/resolution/intents/input-intents.d.ts +231 -0
- package/dist/resolution/intents/mood-modifiers.d.ts +154 -0
- package/dist/resolution/performance.d.ts +264 -0
- package/dist/resolution/presets/button-presets.d.ts +243 -0
- package/dist/resolution/presets/card-presets.d.ts +216 -0
- package/dist/resolution/presets/data-display-presets.d.ts +290 -0
- package/dist/resolution/presets/feedback-presets.d.ts +335 -0
- package/dist/resolution/presets/form-presets.d.ts +308 -0
- package/dist/resolution/presets/index.d.ts +22 -0
- package/dist/resolution/presets/input-presets.d.ts +207 -0
- package/dist/resolution/presets/nav-presets.d.ts +235 -0
- package/dist/resolution/presets/overlay-presets.d.ts +216 -0
- package/dist/resolution/presets/preset-registry.d.ts +212 -0
- package/dist/resolution/resolveProps.d.ts +235 -0
- package/dist/resolution/shorthand/feel-mappings.d.ts +140 -0
- package/dist/resolution/shorthand/index.d.ts +172 -0
- package/dist/resolution/shorthand/look-mappings.d.ts +107 -0
- package/dist/resolution/shorthand/spacing-mappings.d.ts +164 -0
- package/dist/resolution/shorthand/surface-mappings.d.ts +139 -0
- package/dist/resolution/standard/groups-standard.d.ts +98 -0
- package/dist/resolution/standard/index.d.ts +28 -0
- package/dist/resolution/standard/intents-standard.d.ts +232 -0
- package/dist/resolution/standard/presets-standard.d.ts +123 -0
- package/dist/resolution/standard/resolver-standard.d.ts +204 -0
- package/dist/resolution/standard/shorthands-standard.d.ts +98 -0
- package/dist/resolution/standard/validators.d.ts +141 -0
- package/dist/resolution/types.d.ts +461 -0
- package/dist/resolution/validators/factor24-validator.d.ts +418 -0
- package/dist/resolution/validators/index.d.ts +14 -0
- package/dist/scripts/generate-react-library.d.ts +15 -0
- package/dist/scripts/write-react-library.d.ts +18 -0
- package/dist/storage/cloud-sync.d.ts +182 -0
- package/dist/storage/index.d.ts +69 -0
- package/dist/storage/local-storage.d.ts +131 -0
- package/dist/storage/section-storage.d.ts +191 -0
- package/dist/styling/StyleGenerator.d.ts +76 -0
- package/dist/styling/TokenStyleResolver.d.ts +163 -0
- package/dist/styling/factor-migration.d.ts +192 -0
- package/dist/styling/factor-validators.d.ts +327 -0
- package/dist/styling/factors-1-6.d.ts +674 -0
- package/dist/styling/factors-12-16.d.ts +700 -0
- package/dist/styling/factors-17-24.d.ts +668 -0
- package/dist/styling/factors-all.d.ts +348 -0
- package/dist/styling/factors.d.ts +291 -0
- package/dist/styling/index.d.ts +31 -0
- package/dist/styling/types.d.ts +400 -0
- package/dist/tokens/schema.d.ts +486 -0
- package/dist/types/Option.d.ts +178 -0
- package/dist/types/Result.d.ts +148 -0
- package/dist/types/algorithm-engine.types.d.ts +298 -0
- package/dist/types/granularity/base.types.d.ts +268 -0
- package/dist/types/granularity/config.types.d.ts +177 -0
- package/dist/types/granularity/factors.types.d.ts +194 -0
- package/dist/types/granularity/index.d.ts +57 -0
- package/dist/types/granularity/slot.types.d.ts +128 -0
- package/dist/types/granularity/template.types.d.ts +179 -0
- package/dist/types/granularity-levels/atom.config.d.ts +151 -0
- package/dist/types/granularity-levels/component.config.d.ts +175 -0
- package/dist/types/granularity-levels/index.d.ts +47 -0
- package/dist/types/granularity-levels/layout.config.d.ts +278 -0
- package/dist/types/granularity-levels/page.config.d.ts +210 -0
- package/dist/types/granularity-levels/section.config.d.ts +188 -0
- package/dist/types/granularity-levels/template.config.d.ts +340 -0
- package/dist/types/index.d.ts +152 -0
- package/dist/types/section-slot.types.d.ts +169 -0
- package/dist/types/section-storage.types.d.ts +298 -0
- package/dist/types/section-template.types.d.ts +170 -0
- package/dist/types/section.types.d.ts +326 -0
- package/dist/ui-studio/ComponentGenerator.d.ts +219 -0
- package/dist/ui-studio/composition/FactorPropagator.d.ts +268 -0
- package/dist/ui-studio/composition/PageGenerator.d.ts +176 -0
- package/dist/ui-studio/composition/SectionGenerator.d.ts +312 -0
- package/dist/ui-studio/composition/SlotResolver.d.ts +295 -0
- package/dist/ui-studio/composition/section-orchestrator.d.ts +306 -0
- package/dist/ui-studio/granularity/FactorCascade.d.ts +328 -0
- package/dist/ui-studio/granularity/GranularityGenerator.d.ts +266 -0
- package/dist/ui-studio/granularity/RecursiveGenerator.d.ts +328 -0
- package/dist/ui-studio/index.d.ts +94 -0
- package/dist/ui-studio/matrix/ClassMapper.d.ts +128 -0
- package/dist/ui-studio/matrix/MatrixResolver.d.ts +203 -0
- package/dist/ui-studio/matrix/types.d.ts +96 -0
- package/dist/ui-studio/presets/IndustryDetector.d.ts +183 -0
- package/dist/ui-studio/presets/component-registry.d.ts +213 -0
- package/dist/ui-studio/presets/factor-registry.d.ts +364 -0
- package/dist/ui-studio/presets/granularity-registry.d.ts +252 -0
- package/dist/ui-studio/presets/index.d.ts +32 -0
- package/dist/ui-studio/presets/industries.d.ts +143 -0
- package/dist/ui-studio/presets/layout-registry.d.ts +21 -0
- package/dist/ui-studio/presets/matrix-groups.d.ts +195 -0
- package/dist/ui-studio/presets/page-registry.d.ts +24 -0
- package/dist/ui-studio/presets/registry.constants.d.ts +69 -0
- package/dist/ui-studio/presets/registry.types.d.ts +166 -0
- package/dist/ui-studio/presets/section-defaults.d.ts +175 -0
- package/dist/ui-studio/presets/section-registry.d.ts +83 -0
- package/dist/ui-studio/presets/section-registry.defaults.d.ts +106 -0
- package/dist/ui-studio/presets/section-registry.helpers.d.ts +112 -0
- package/dist/ui-studio/presets/section-registry.types.d.ts +181 -0
- package/dist/ui-studio/presets/template-registry.d.ts +23 -0
- package/dist/ui-studio/presets/variants.d.ts +1038 -0
- package/dist/ui-studio/registries/components-registry.d.ts +193 -0
- package/dist/ui-studio/registries/design-systems-registry.d.ts +153 -0
- package/dist/ui-studio/registries/factors-registry.d.ts +145 -0
- package/dist/ui-studio/registries/tiers-registry.d.ts +150 -0
- package/dist/ui-studio/resolution/FactorResolver.d.ts +201 -0
- package/dist/ui-studio/templates/TestGenerator.d.ts +55 -0
- package/dist/ui-studio/templates/TierGenerator.d.ts +153 -0
- package/dist/ui-studio/templates/TypesGenerator.d.ts +51 -0
- package/dist/ui-studio/types/granularity/base.types.d.ts +268 -0
- package/dist/ui-studio/types/granularity/config.types.d.ts +177 -0
- package/dist/ui-studio/types/granularity/factors.types.d.ts +194 -0
- package/dist/ui-studio/types/granularity/index.d.ts +57 -0
- package/dist/ui-studio/types/granularity/slot.types.d.ts +128 -0
- package/dist/ui-studio/types/granularity/template.types.d.ts +179 -0
- package/dist/ui-studio/types/granularity-levels/atom.config.d.ts +151 -0
- package/dist/ui-studio/types/granularity-levels/component.config.d.ts +175 -0
- package/dist/ui-studio/types/granularity-levels/index.d.ts +47 -0
- package/dist/ui-studio/types/granularity-levels/layout.config.d.ts +278 -0
- package/dist/ui-studio/types/granularity-levels/page.config.d.ts +210 -0
- package/dist/ui-studio/types/granularity-levels/section.config.d.ts +188 -0
- package/dist/ui-studio/types/granularity-levels/template.config.d.ts +340 -0
- package/dist/ui-studio/types.d.ts +323 -0
- package/dist/utils/CodeUtils.d.ts +103 -0
- package/dist/utils/GenerateComponentValidator.d.ts +35 -0
- package/dist/utils/Logger.d.ts +101 -0
- package/dist/utils/StringUtils.d.ts +120 -0
- package/dist/utils/ValidationUtils.d.ts +71 -0
- package/dist/utils/errors/BaseError.d.ts +23 -0
- package/dist/utils/errors/GenerationError.d.ts +14 -0
- package/dist/utils/errors/TemplateNotFoundError.d.ts +13 -0
- package/dist/utils/errors/ValidationError.d.ts +13 -0
- package/dist/utils/errors/index.d.ts +12 -0
- package/dist/utils/factor-resolver.d.ts +294 -0
- package/dist/utils/granularity-helpers.d.ts +359 -0
- package/dist/utils/index.d.ts +20 -0
- package/dist/utils/performance.d.ts +26 -0
- package/dist/utils/stringify.d.ts +28 -0
- package/dist/validators/component-validator.d.ts +86 -0
- package/dist/validators/design-system-validator.d.ts +95 -0
- package/dist/validators/factor-validator.d.ts +101 -0
- package/dist/validators/index.d.ts +263 -0
- package/dist/validators/section-validator.d.ts +120 -0
- package/dist/validators/slot-validator.d.ts +161 -0
- package/dist/validators/tier-validator.d.ts +102 -0
- package/package.json +67 -0
- package/tests/16-factor-integration.test.d.ts +14 -0
- package/tests/16-factor-visual.test.d.ts +14 -0
- package/tests/5-level-integration.test.d.ts +14 -0
- package/tests/CodeUtils.test.d.ts +7 -0
- package/tests/DesignSystems.test.d.ts +7 -0
- package/tests/GenerateComponentValidator.test.d.ts +7 -0
- package/tests/Logger.test.d.ts +7 -0
- package/tests/StringUtils.test.d.ts +7 -0
- package/tests/StyleGenerator.test.d.ts +13 -0
- package/tests/Tiers.test.d.ts +7 -0
- package/tests/TokenRegistry.test.d.ts +14 -0
- package/tests/TokenStyleResolver.test.d.ts +13 -0
- package/tests/ValidationUtils.test.d.ts +7 -0
- package/tests/_pending_fix/Accordion.test.d.ts +13 -0
- package/tests/_pending_fix/Alert.test.d.ts +13 -0
- package/tests/_pending_fix/AlertDialog.test.d.ts +13 -0
- package/tests/_pending_fix/AspectRatio.test.d.ts +13 -0
- package/tests/_pending_fix/Autocomplete.test.d.ts +13 -0
- package/tests/_pending_fix/Avatar.test.d.ts +13 -0
- package/tests/_pending_fix/Badge.test.d.ts +13 -0
- package/tests/_pending_fix/Banner.test.d.ts +13 -0
- package/tests/_pending_fix/Box.test.d.ts +13 -0
- package/tests/_pending_fix/Breadcrumb.test.d.ts +13 -0
- package/tests/_pending_fix/Callout.test.d.ts +13 -0
- package/tests/_pending_fix/Card.test.d.ts +13 -0
- package/tests/_pending_fix/Center.test.d.ts +13 -0
- package/tests/_pending_fix/Checkbox.test.d.ts +13 -0
- package/tests/_pending_fix/Chip.test.d.ts +13 -0
- package/tests/_pending_fix/ColorPicker.test.d.ts +13 -0
- package/tests/_pending_fix/Combobox.test.d.ts +13 -0
- package/tests/_pending_fix/CommandPalette.test.d.ts +13 -0
- package/tests/_pending_fix/ConfirmationModal.test.d.ts +13 -0
- package/tests/_pending_fix/Container.test.d.ts +13 -0
- package/tests/_pending_fix/DataTable.test.d.ts +13 -0
- package/tests/_pending_fix/DatePicker.test.d.ts +13 -0
- package/tests/_pending_fix/DateRangePicker.test.d.ts +13 -0
- package/tests/_pending_fix/DateTimePicker.test.d.ts +13 -0
- package/tests/_pending_fix/Divider.test.d.ts +13 -0
- package/tests/_pending_fix/Drawer.test.d.ts +13 -0
- package/tests/_pending_fix/Dropdown.test.d.ts +13 -0
- package/tests/_pending_fix/EmptyState.test.d.ts +13 -0
- package/tests/_pending_fix/ErrorState.test.d.ts +13 -0
- package/tests/_pending_fix/FileDropzone.test.d.ts +13 -0
- package/tests/_pending_fix/FileUpload.test.d.ts +13 -0
- package/tests/_pending_fix/Flex.test.d.ts +13 -0
- package/tests/_pending_fix/Grid.test.d.ts +13 -0
- package/tests/_pending_fix/GridItem.test.d.ts +13 -0
- package/tests/_pending_fix/HStack.test.d.ts +13 -0
- package/tests/_pending_fix/Input.test.d.ts +13 -0
- package/tests/_pending_fix/InputCurrency.test.d.ts +13 -0
- package/tests/_pending_fix/InputGroup.test.d.ts +13 -0
- package/tests/_pending_fix/InputOTP.test.d.ts +13 -0
- package/tests/_pending_fix/InputPassword.test.d.ts +13 -0
- package/tests/_pending_fix/InputPhone.test.d.ts +13 -0
- package/tests/_pending_fix/InputSearch.test.d.ts +13 -0
- package/tests/_pending_fix/Link.test.d.ts +13 -0
- package/tests/_pending_fix/List.test.d.ts +13 -0
- package/tests/_pending_fix/LoadingOverlay.test.d.ts +13 -0
- package/tests/_pending_fix/Menu.test.d.ts +13 -0
- package/tests/_pending_fix/Modal.test.d.ts +13 -0
- package/tests/_pending_fix/MultiSelect.test.d.ts +13 -0
- package/tests/_pending_fix/NavGroup.test.d.ts +13 -0
- package/tests/_pending_fix/NavItem.test.d.ts +13 -0
- package/tests/_pending_fix/NavLink.test.d.ts +13 -0
- package/tests/_pending_fix/Navbar.test.d.ts +13 -0
- package/tests/_pending_fix/Notification.test.d.ts +13 -0
- package/tests/_pending_fix/NotificationBadge.test.d.ts +13 -0
- package/tests/_pending_fix/NumberInput.test.d.ts +13 -0
- package/tests/_pending_fix/Pagination.test.d.ts +13 -0
- package/tests/_pending_fix/Popover.test.d.ts +13 -0
- package/tests/_pending_fix/Progress.test.d.ts +13 -0
- package/tests/_pending_fix/ProgressCircle.test.d.ts +13 -0
- package/tests/_pending_fix/ProgressSteps.test.d.ts +13 -0
- package/tests/_pending_fix/Radio.test.d.ts +13 -0
- package/tests/_pending_fix/RangeSlider.test.d.ts +13 -0
- package/tests/_pending_fix/ResizablePanel.test.d.ts +13 -0
- package/tests/_pending_fix/ResultState.test.d.ts +13 -0
- package/tests/_pending_fix/ScrollArea.test.d.ts +13 -0
- package/tests/_pending_fix/Select.test.d.ts +14 -0
- package/tests/_pending_fix/Sheet.test.d.ts +13 -0
- package/tests/_pending_fix/Sidebar.test.d.ts +13 -0
- package/tests/_pending_fix/SimpleGrid.test.d.ts +13 -0
- package/tests/_pending_fix/Skeleton.test.d.ts +13 -0
- package/tests/_pending_fix/Slider.test.d.ts +13 -0
- package/tests/_pending_fix/Spacer.test.d.ts +13 -0
- package/tests/_pending_fix/Spinner.test.d.ts +13 -0
- package/tests/_pending_fix/Stack.test.d.ts +13 -0
- package/tests/_pending_fix/Stat.test.d.ts +13 -0
- package/tests/_pending_fix/Stepper.test.d.ts +14 -0
- package/tests/_pending_fix/Switch.test.d.ts +13 -0
- package/tests/_pending_fix/Table.test.d.ts +13 -0
- package/tests/_pending_fix/Tabs.test.d.ts +13 -0
- package/tests/_pending_fix/Textarea.test.d.ts +13 -0
- package/tests/_pending_fix/Timeline.test.d.ts +13 -0
- package/tests/_pending_fix/Toast.test.d.ts +14 -0
- package/tests/_pending_fix/Tooltip.test.d.ts +14 -0
- package/tests/_pending_fix/VStack.test.d.ts +13 -0
- package/tests/alert.test.d.ts +13 -0
- package/tests/badge.test.d.ts +13 -0
- package/tests/benchmarks/factor-resolution.bench.d.ts +41 -0
- package/tests/button.test.d.ts +16 -0
- package/tests/card.test.d.ts +19 -0
- package/tests/checkbox.test.d.ts +13 -0
- package/tests/component-16-factor-types.test.d.ts +13 -0
- package/tests/component-5level-integration.test.d.ts +14 -0
- package/tests/component-registry-ui.test.d.ts +13 -0
- package/tests/e2e/16-factor-visual.test.d.ts +14 -0
- package/tests/edge-cases.test.d.ts +14 -0
- package/tests/factor-17-24-integration.test.d.ts +14 -0
- package/tests/factor-17-24-performance.test.d.ts +14 -0
- package/tests/factor-validators.test.d.ts +13 -0
- package/tests/factors-1-6.test.d.ts +13 -0
- package/tests/factors-12-16.test.d.ts +13 -0
- package/tests/factors-17-24.test.d.ts +21 -0
- package/tests/factors-all.test.d.ts +13 -0
- package/tests/factors-registry.test.d.ts +11 -0
- package/tests/factors.test.d.ts +13 -0
- package/tests/granularity-types.test.d.ts +18 -0
- package/tests/groups.test.d.ts +14 -0
- package/tests/input.test.d.ts +16 -0
- package/tests/intents.test.d.ts +14 -0
- package/tests/memory-leak.test.d.ts +14 -0
- package/tests/modal.test.d.ts +19 -0
- package/tests/presets.test.d.ts +14 -0
- package/tests/radio.test.d.ts +13 -0
- package/tests/resolution-intents.test.d.ts +13 -0
- package/tests/resolution-presets.test.d.ts +13 -0
- package/tests/resolveProps.test.d.ts +14 -0
- package/tests/section-integration.test.d.ts +16 -0
- package/tests/section-types.test.d.ts +11 -0
- package/tests/setup.d.ts +13 -0
- package/tests/shorthands.test.d.ts +14 -0
- package/tests/switch.test.d.ts +13 -0
- package/tests/tabs.test.d.ts +13 -0
- package/tests/tiers-registry.test.d.ts +11 -0
- package/tests/useComponentStyles.test.d.ts +11 -0
- package/tests/useFactors.test.d.ts +13 -0
- package/tests/validators-invalid-input.test.d.ts +13 -0
- package/tsup.config.d.ts +11 -0
- package/vitest.config.d.ts +3 -0
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GranularityGenerator - Base abstract class for granularity-based generation
|
|
3
|
+
*
|
|
4
|
+
* This is the foundation for the Unified Granularity Architecture's recursive
|
|
5
|
+
* generation pipeline. All granularity-specific generators extend this base class.
|
|
6
|
+
*
|
|
7
|
+
* Key Features:
|
|
8
|
+
* - Generic type parameter G for type-safe granularity level
|
|
9
|
+
* - Abstract generate() method for level-specific implementation
|
|
10
|
+
* - Common utility methods shared across all generators
|
|
11
|
+
* - Factor resolution support
|
|
12
|
+
*
|
|
13
|
+
* @packageDocumentation
|
|
14
|
+
* @module generators
|
|
15
|
+
* @since 4.0.0
|
|
16
|
+
*
|
|
17
|
+
* Powered by Nikkory
|
|
18
|
+
*/
|
|
19
|
+
import type { DesignSystem } from '../types';
|
|
20
|
+
import type { GranularityLevel, GranularityConfig, GranularityFactorValues, GranularityFactorDefinition } from '../../types/granularity';
|
|
21
|
+
/**
|
|
22
|
+
* Output from a granularity generation operation
|
|
23
|
+
*
|
|
24
|
+
* @category types
|
|
25
|
+
* @since 4.0.0
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* const output: GeneratedOutput = {
|
|
30
|
+
* code: '<Section>...</Section>',
|
|
31
|
+
* styles: 'section { ... }',
|
|
32
|
+
* metadata: { granularity: 'section', childCount: 3 },
|
|
33
|
+
* children: [...childOutputs]
|
|
34
|
+
* };
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* Powered by Nikkory
|
|
38
|
+
*/
|
|
39
|
+
export interface GeneratedOutput {
|
|
40
|
+
/** Generated code (JSX/TSX) */
|
|
41
|
+
readonly code: string;
|
|
42
|
+
/** Generated styles (CSS/Tailwind classes) */
|
|
43
|
+
readonly styles?: string;
|
|
44
|
+
/** Generation metadata */
|
|
45
|
+
readonly metadata: GenerationMetadata;
|
|
46
|
+
/** Child outputs (for recursive generation) */
|
|
47
|
+
readonly children?: readonly GeneratedOutput[];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Metadata about the generation operation
|
|
51
|
+
*
|
|
52
|
+
* @category types
|
|
53
|
+
* @since 4.0.0
|
|
54
|
+
*
|
|
55
|
+
* Powered by Nikkory
|
|
56
|
+
*/
|
|
57
|
+
export interface GenerationMetadata {
|
|
58
|
+
/** Config ID that was generated */
|
|
59
|
+
readonly configId: string;
|
|
60
|
+
/** Granularity level of the generated output */
|
|
61
|
+
readonly granularity: GranularityLevel;
|
|
62
|
+
/** Design system used */
|
|
63
|
+
readonly designSystem: DesignSystem;
|
|
64
|
+
/** Number of children generated */
|
|
65
|
+
readonly childCount: number;
|
|
66
|
+
/** Factors applied at this level */
|
|
67
|
+
readonly appliedFactors: readonly string[];
|
|
68
|
+
/** Generation timestamp */
|
|
69
|
+
readonly generatedAt: Date;
|
|
70
|
+
/** Generation duration in milliseconds */
|
|
71
|
+
readonly durationMs?: number;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Options for granularity generation
|
|
75
|
+
*
|
|
76
|
+
* @category types
|
|
77
|
+
* @since 4.0.0
|
|
78
|
+
*
|
|
79
|
+
* Powered by Nikkory
|
|
80
|
+
*/
|
|
81
|
+
export interface GranularityGeneratorOptions {
|
|
82
|
+
/** Whether to include children in generation */
|
|
83
|
+
readonly includeChildren?: boolean;
|
|
84
|
+
/** Maximum depth for recursive generation */
|
|
85
|
+
readonly maxDepth?: number;
|
|
86
|
+
/** Whether to enable verbose logging */
|
|
87
|
+
readonly verbose?: boolean;
|
|
88
|
+
/** Custom factor overrides */
|
|
89
|
+
readonly factorOverrides?: GranularityFactorValues;
|
|
90
|
+
/** Config lookup function for resolving references */
|
|
91
|
+
readonly configLookup?: (id: string) => GranularityConfig<GranularityLevel> | undefined;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* GranularityGenerator - Abstract base class for all granularity generators
|
|
95
|
+
*
|
|
96
|
+
* This class provides the foundation for the recursive generation pipeline.
|
|
97
|
+
* Concrete implementations must implement the generate() method for their
|
|
98
|
+
* specific granularity level.
|
|
99
|
+
*
|
|
100
|
+
* @category generators
|
|
101
|
+
* @since 4.0.0
|
|
102
|
+
*
|
|
103
|
+
* @typeParam G - The granularity level this generator handles
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```typescript
|
|
107
|
+
* class SectionGranularityGenerator extends GranularityGenerator<'section'> {
|
|
108
|
+
* async generate(
|
|
109
|
+
* config: GranularityConfig<'section'>
|
|
110
|
+
* ): Promise<GeneratedOutput> {
|
|
111
|
+
* // Section-specific generation logic
|
|
112
|
+
* const factors = this.getFactorsForLevel('section');
|
|
113
|
+
* const resolvedFactors = this.resolveFactors(factors, config);
|
|
114
|
+
* // ...generate code
|
|
115
|
+
* }
|
|
116
|
+
* }
|
|
117
|
+
* ```
|
|
118
|
+
*
|
|
119
|
+
* Powered by Nikkory
|
|
120
|
+
*/
|
|
121
|
+
export declare abstract class GranularityGenerator<G extends GranularityLevel> {
|
|
122
|
+
/** Generator options */
|
|
123
|
+
protected readonly options: GranularityGeneratorOptions;
|
|
124
|
+
/**
|
|
125
|
+
* Create a new GranularityGenerator
|
|
126
|
+
*
|
|
127
|
+
* @param options - Generator options
|
|
128
|
+
*/
|
|
129
|
+
constructor(options?: GranularityGeneratorOptions);
|
|
130
|
+
/**
|
|
131
|
+
* Generate output for a granularity config
|
|
132
|
+
*
|
|
133
|
+
* This is the main generation method that subclasses must implement.
|
|
134
|
+
* It takes a config and produces the generated output (code, styles, metadata).
|
|
135
|
+
*
|
|
136
|
+
* @param config - The granularity config to generate from
|
|
137
|
+
* @param parentFactors - Factors inherited from parent (for cascade)
|
|
138
|
+
* @returns Promise resolving to generated output
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```typescript
|
|
142
|
+
* const output = await generator.generate(sectionConfig, { spacing: 'lg' });
|
|
143
|
+
* console.log(output.code);
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
abstract generate(config: GranularityConfig<G>, parentFactors?: GranularityFactorValues): Promise<GeneratedOutput>;
|
|
147
|
+
/**
|
|
148
|
+
* Get all factors applicable at a given granularity level
|
|
149
|
+
*
|
|
150
|
+
* Includes factors defined at this level AND factors from higher
|
|
151
|
+
* levels that have cascadeDown enabled.
|
|
152
|
+
*
|
|
153
|
+
* @param level - The granularity level to query
|
|
154
|
+
* @returns Array of factor definitions applicable at this level
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* ```typescript
|
|
158
|
+
* const pageFactors = this.getFactorsForLevel('page');
|
|
159
|
+
* // Returns factors from template (cascaded) + page level
|
|
160
|
+
* ```
|
|
161
|
+
*
|
|
162
|
+
* Powered by Nikkory
|
|
163
|
+
*/
|
|
164
|
+
protected getFactorsForLevel(level: GranularityLevel): readonly GranularityFactorDefinition[];
|
|
165
|
+
/**
|
|
166
|
+
* Resolve factor values for a config
|
|
167
|
+
*
|
|
168
|
+
* Priority order (highest to lowest):
|
|
169
|
+
* 1. Config's explicit factors
|
|
170
|
+
* 2. Parent's cascading factors
|
|
171
|
+
* 3. Design system defaults
|
|
172
|
+
*
|
|
173
|
+
* @param factors - Factor definitions to resolve
|
|
174
|
+
* @param config - The config containing factor values
|
|
175
|
+
* @param parentFactors - Factors from parent (optional)
|
|
176
|
+
* @returns Resolved factor values
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ```typescript
|
|
180
|
+
* const factors = this.getFactorsForLevel('section');
|
|
181
|
+
* const resolved = this.resolveFactors(factors, sectionConfig, parentFactors);
|
|
182
|
+
* console.log(resolved.spacing); // 'lg'
|
|
183
|
+
* ```
|
|
184
|
+
*
|
|
185
|
+
* Powered by Nikkory
|
|
186
|
+
*/
|
|
187
|
+
protected resolveFactors(factors: readonly GranularityFactorDefinition[], config: GranularityConfig<G>, parentFactors?: GranularityFactorValues): GranularityFactorValues;
|
|
188
|
+
/**
|
|
189
|
+
* Get factor definition by ID
|
|
190
|
+
*
|
|
191
|
+
* @param factorId - The factor ID
|
|
192
|
+
* @returns Factor definition or undefined
|
|
193
|
+
*
|
|
194
|
+
* Powered by Nikkory
|
|
195
|
+
*/
|
|
196
|
+
protected getFactorDefinition(factorId: string): GranularityFactorDefinition | undefined;
|
|
197
|
+
/**
|
|
198
|
+
* Check if one granularity level is higher than another
|
|
199
|
+
*
|
|
200
|
+
* @param a - First level
|
|
201
|
+
* @param b - Second level
|
|
202
|
+
* @returns True if a is higher than b
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* ```typescript
|
|
206
|
+
* this.isHigherGranularity('page', 'section'); // true
|
|
207
|
+
* this.isHigherGranularity('atom', 'component'); // false
|
|
208
|
+
* ```
|
|
209
|
+
*
|
|
210
|
+
* Powered by Nikkory
|
|
211
|
+
*/
|
|
212
|
+
protected isHigherGranularity(a: GranularityLevel, b: GranularityLevel): boolean;
|
|
213
|
+
/**
|
|
214
|
+
* Get child granularity levels for a given level
|
|
215
|
+
*
|
|
216
|
+
* @param level - The parent level
|
|
217
|
+
* @returns Array of valid child levels
|
|
218
|
+
*
|
|
219
|
+
* @example
|
|
220
|
+
* ```typescript
|
|
221
|
+
* this.getChildGranularities('page'); // ['section', 'component', 'atom']
|
|
222
|
+
* this.getChildGranularities('atom'); // []
|
|
223
|
+
* ```
|
|
224
|
+
*
|
|
225
|
+
* Powered by Nikkory
|
|
226
|
+
*/
|
|
227
|
+
protected getChildGranularities(level: GranularityLevel): readonly GranularityLevel[];
|
|
228
|
+
/**
|
|
229
|
+
* Check if a child granularity is valid for a parent
|
|
230
|
+
*
|
|
231
|
+
* @param parent - Parent granularity level
|
|
232
|
+
* @param child - Child granularity level
|
|
233
|
+
* @returns True if child can be nested in parent
|
|
234
|
+
*
|
|
235
|
+
* @example
|
|
236
|
+
* ```typescript
|
|
237
|
+
* this.isValidChildGranularity('page', 'section'); // true
|
|
238
|
+
* this.isValidChildGranularity('component', 'page'); // false
|
|
239
|
+
* ```
|
|
240
|
+
*
|
|
241
|
+
* Powered by Nikkory
|
|
242
|
+
*/
|
|
243
|
+
protected isValidChildGranularity(parent: GranularityLevel, child: GranularityLevel): boolean;
|
|
244
|
+
/**
|
|
245
|
+
* Create generation metadata
|
|
246
|
+
*
|
|
247
|
+
* @param config - The config being generated
|
|
248
|
+
* @param appliedFactors - IDs of factors applied
|
|
249
|
+
* @param childCount - Number of children generated
|
|
250
|
+
* @param durationMs - Generation duration
|
|
251
|
+
* @returns Generation metadata object
|
|
252
|
+
*
|
|
253
|
+
* Powered by Nikkory
|
|
254
|
+
*/
|
|
255
|
+
protected createMetadata(config: GranularityConfig<G>, appliedFactors: readonly string[], childCount: number, durationMs?: number): GenerationMetadata;
|
|
256
|
+
/**
|
|
257
|
+
* Log message if verbose mode is enabled
|
|
258
|
+
*
|
|
259
|
+
* @param message - Message to log
|
|
260
|
+
* @param data - Optional data to include
|
|
261
|
+
*
|
|
262
|
+
* Powered by Nikkory
|
|
263
|
+
*/
|
|
264
|
+
protected log(message: string, data?: unknown): void;
|
|
265
|
+
}
|
|
266
|
+
//# sourceMappingURL=GranularityGenerator.d.ts.map
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RecursiveGenerator - Recursive generation pipeline implementation
|
|
3
|
+
*
|
|
4
|
+
* This generator implements the recursive generation pipeline for the
|
|
5
|
+
* Unified Granularity Architecture. It generates parent configs by
|
|
6
|
+
* recursively generating their children.
|
|
7
|
+
*
|
|
8
|
+
* Key Features:
|
|
9
|
+
* - Recursive generation: Page → Sections → Components → Atoms
|
|
10
|
+
* - Factor cascade: Parent factors cascade down to children
|
|
11
|
+
* - Enterprise safeguards: Circular reference detection, max depth check
|
|
12
|
+
* - Factor override priority: Child overrides > Parent cascade > Defaults
|
|
13
|
+
*
|
|
14
|
+
* Enterprise Safeguards:
|
|
15
|
+
* 1. CircularReferenceError - Detects A → B → A cycles
|
|
16
|
+
* 2. MaxDepthExceededError - Prevents stack overflow (MAX_DEPTH = 10)
|
|
17
|
+
* 3. try/finally cleanup - Ensures visited set is cleaned up
|
|
18
|
+
*
|
|
19
|
+
* @packageDocumentation
|
|
20
|
+
* @module generators
|
|
21
|
+
* @since 4.0.0
|
|
22
|
+
*
|
|
23
|
+
* Powered by Nikkory
|
|
24
|
+
*/
|
|
25
|
+
import { GranularityGenerator } from './GranularityGenerator';
|
|
26
|
+
import type { GeneratedOutput, GranularityGeneratorOptions } from './GranularityGenerator';
|
|
27
|
+
import type { GranularityLevel, GranularityConfig, GranularityFactorValues } from '../../types/granularity';
|
|
28
|
+
import type { ChildReference } from '../../types/granularity/config.types';
|
|
29
|
+
/**
|
|
30
|
+
* Error thrown when a circular reference is detected in the config hierarchy
|
|
31
|
+
*
|
|
32
|
+
* This prevents infinite recursion when configs reference each other in a cycle.
|
|
33
|
+
* For example: Page A → Section B → Page A
|
|
34
|
+
*
|
|
35
|
+
* @category errors
|
|
36
|
+
* @since 4.0.0
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* try {
|
|
41
|
+
* await generator.generate(circularConfig);
|
|
42
|
+
* } catch (error) {
|
|
43
|
+
* if (error instanceof CircularReferenceError) {
|
|
44
|
+
* console.log(`Circular at: ${error.configId}`);
|
|
45
|
+
* console.log(`Path: ${error.visitedPath.join(' → ')}`);
|
|
46
|
+
* }
|
|
47
|
+
* }
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* Powered by Nikkory
|
|
51
|
+
*/
|
|
52
|
+
export declare class CircularReferenceError extends Error {
|
|
53
|
+
/** The config ID that caused the circular reference */
|
|
54
|
+
readonly configId: string;
|
|
55
|
+
/** The path of visited configs leading to the circular reference */
|
|
56
|
+
readonly visitedPath: readonly string[];
|
|
57
|
+
constructor(configId: string, visitedPath: readonly string[]);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Error thrown when the maximum recursion depth is exceeded
|
|
61
|
+
*
|
|
62
|
+
* This prevents stack overflow from deeply nested configs.
|
|
63
|
+
* Default MAX_DEPTH is 10 levels.
|
|
64
|
+
*
|
|
65
|
+
* @category errors
|
|
66
|
+
* @since 4.0.0
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* try {
|
|
71
|
+
* await generator.generate(deeplyNestedConfig);
|
|
72
|
+
* } catch (error) {
|
|
73
|
+
* if (error instanceof MaxDepthExceededError) {
|
|
74
|
+
* console.log(`Depth ${error.currentDepth} > ${error.maxDepth}`);
|
|
75
|
+
* console.log(`At config: ${error.configId}`);
|
|
76
|
+
* }
|
|
77
|
+
* }
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
* Powered by Nikkory
|
|
81
|
+
*/
|
|
82
|
+
export declare class MaxDepthExceededError extends Error {
|
|
83
|
+
/** Current recursion depth */
|
|
84
|
+
readonly currentDepth: number;
|
|
85
|
+
/** Maximum allowed depth */
|
|
86
|
+
readonly maxDepth: number;
|
|
87
|
+
/** Config ID where depth was exceeded */
|
|
88
|
+
readonly configId: string;
|
|
89
|
+
constructor(currentDepth: number, maxDepth: number, configId: string);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Options for RecursiveGenerator
|
|
93
|
+
*
|
|
94
|
+
* @category types
|
|
95
|
+
* @since 4.0.0
|
|
96
|
+
*
|
|
97
|
+
* Powered by Nikkory
|
|
98
|
+
*/
|
|
99
|
+
export interface RecursiveGeneratorOptions extends GranularityGeneratorOptions {
|
|
100
|
+
/** Custom code composer function */
|
|
101
|
+
readonly codeComposer?: (parent: string, children: readonly string[]) => string;
|
|
102
|
+
/** Custom style composer function */
|
|
103
|
+
readonly styleComposer?: (parent: string, children: readonly string[]) => string;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Maximum recursion depth to prevent stack overflow
|
|
107
|
+
*
|
|
108
|
+
* Template(1) → Layout(2) → Page(3) → Section(4) → Component(5) → Atom(6)
|
|
109
|
+
* Buffer of 4 levels for nested components = 10 total
|
|
110
|
+
*
|
|
111
|
+
* @category constants
|
|
112
|
+
* @since 4.0.0
|
|
113
|
+
*
|
|
114
|
+
* Powered by Nikkory
|
|
115
|
+
*/
|
|
116
|
+
export declare const MAX_DEPTH = 10;
|
|
117
|
+
/**
|
|
118
|
+
* RecursiveGenerator - Generates configs recursively with factor cascade
|
|
119
|
+
*
|
|
120
|
+
* This is the main generator for the Unified Granularity Architecture.
|
|
121
|
+
* It handles recursive generation of parent configs through their children,
|
|
122
|
+
* with proper factor cascade and enterprise safeguards.
|
|
123
|
+
*
|
|
124
|
+
* @category generators
|
|
125
|
+
* @since 4.0.0
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```typescript
|
|
129
|
+
* const generator = new RecursiveGenerator({
|
|
130
|
+
* configLookup: (id) => configRegistry.get(id),
|
|
131
|
+
* verbose: true,
|
|
132
|
+
* });
|
|
133
|
+
*
|
|
134
|
+
* const output = await generator.generate(pageConfig);
|
|
135
|
+
* console.log(output.code);
|
|
136
|
+
* console.log(output.children?.length); // Section outputs
|
|
137
|
+
* ```
|
|
138
|
+
*
|
|
139
|
+
* Powered by Nikkory
|
|
140
|
+
*/
|
|
141
|
+
export declare class RecursiveGenerator extends GranularityGenerator<GranularityLevel> {
|
|
142
|
+
protected readonly options: RecursiveGeneratorOptions;
|
|
143
|
+
constructor(options?: RecursiveGeneratorOptions);
|
|
144
|
+
/**
|
|
145
|
+
* Generate output for a granularity config recursively
|
|
146
|
+
*
|
|
147
|
+
* This method implements the recursive generation pipeline with
|
|
148
|
+
* enterprise safeguards for circular references and max depth.
|
|
149
|
+
*
|
|
150
|
+
* @param config - The granularity config to generate
|
|
151
|
+
* @param parentFactors - Factors inherited from parent (for cascade)
|
|
152
|
+
* @param visited - Set of visited config IDs (for circular detection)
|
|
153
|
+
* @param depth - Current recursion depth (for max depth check)
|
|
154
|
+
* @returns Promise resolving to generated output with children
|
|
155
|
+
*
|
|
156
|
+
* @throws CircularReferenceError - When same config is visited twice in path
|
|
157
|
+
* @throws MaxDepthExceededError - When recursion exceeds MAX_DEPTH
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```typescript
|
|
161
|
+
* const generator = new RecursiveGenerator();
|
|
162
|
+
*
|
|
163
|
+
* // Simple usage - safeguards handled internally
|
|
164
|
+
* const output = await generator.generate(pageConfig);
|
|
165
|
+
*
|
|
166
|
+
* // With explicit tracking (for debugging)
|
|
167
|
+
* const output = await generator.generate(pageConfig, {}, new Set(), 0);
|
|
168
|
+
* ```
|
|
169
|
+
*
|
|
170
|
+
* Powered by Nikkory
|
|
171
|
+
*/
|
|
172
|
+
generate(config: GranularityConfig<GranularityLevel>, parentFactors?: GranularityFactorValues, visited?: Set<string>, depth?: number): Promise<GeneratedOutput>;
|
|
173
|
+
/**
|
|
174
|
+
* Resolve child reference to full config with cascaded factors
|
|
175
|
+
*
|
|
176
|
+
* This method handles both string references (ID lookups) and inline configs.
|
|
177
|
+
* It also applies factor cascade with proper priority:
|
|
178
|
+
* 1. Child's explicit factorOverrides (HIGHEST - always wins)
|
|
179
|
+
* 2. Parent's cascading factors (filtered by cascadeDown=true)
|
|
180
|
+
* 3. Design system defaults (LOWEST - fallback)
|
|
181
|
+
*
|
|
182
|
+
* @param child - Child reference to resolve
|
|
183
|
+
* @param parentFactors - Factors from parent to cascade
|
|
184
|
+
* @returns Full child config with cascaded factors
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* ```typescript
|
|
188
|
+
* const childConfig = this.resolveChild(
|
|
189
|
+
* { childGranularity: 'section', ref: 'hero-section', slot: 'main' },
|
|
190
|
+
* { spacing: 'lg', colorPrimary: '#3B82F6' }
|
|
191
|
+
* );
|
|
192
|
+
* ```
|
|
193
|
+
*
|
|
194
|
+
* Powered by Nikkory
|
|
195
|
+
*/
|
|
196
|
+
protected resolveChild(child: ChildReference<GranularityLevel>, parentFactors: GranularityFactorValues): GranularityConfig<GranularityLevel>;
|
|
197
|
+
/**
|
|
198
|
+
* Filter factors that should cascade to child level
|
|
199
|
+
*
|
|
200
|
+
* Only factors with cascadeDown=true that are defined at or above
|
|
201
|
+
* the child's level are included.
|
|
202
|
+
*
|
|
203
|
+
* @param factors - Parent's resolved factors
|
|
204
|
+
* @param childLevel - Target child granularity level
|
|
205
|
+
* @returns Factors that cascade to the child level
|
|
206
|
+
*
|
|
207
|
+
* Powered by Nikkory
|
|
208
|
+
*/
|
|
209
|
+
protected filterCascadingFactors(factors: GranularityFactorValues, childLevel: GranularityLevel): GranularityFactorValues;
|
|
210
|
+
/**
|
|
211
|
+
* Compose parent output with child outputs
|
|
212
|
+
*
|
|
213
|
+
* This method creates the final GeneratedOutput by combining the
|
|
214
|
+
* parent's code/styles with all children's code/styles.
|
|
215
|
+
*
|
|
216
|
+
* @param config - Parent config being composed
|
|
217
|
+
* @param factors - Resolved factors for this level
|
|
218
|
+
* @param children - Array of child GeneratedOutputs
|
|
219
|
+
* @returns Composed GeneratedOutput
|
|
220
|
+
*
|
|
221
|
+
* @example
|
|
222
|
+
* ```typescript
|
|
223
|
+
* const output = this.compose(pageConfig, resolvedFactors, sectionOutputs);
|
|
224
|
+
* console.log(output.code); // Page code with sections
|
|
225
|
+
* ```
|
|
226
|
+
*
|
|
227
|
+
* Powered by Nikkory
|
|
228
|
+
*/
|
|
229
|
+
protected compose(config: GranularityConfig<GranularityLevel>, factors: GranularityFactorValues, children: readonly GeneratedOutput[]): GeneratedOutput;
|
|
230
|
+
/**
|
|
231
|
+
* Default code composer - wraps children in parent container
|
|
232
|
+
*
|
|
233
|
+
* @param parentCode - Parent's generated code
|
|
234
|
+
* @param childCodes - Children's generated codes
|
|
235
|
+
* @param config - Parent config for context
|
|
236
|
+
* @returns Composed code string
|
|
237
|
+
*
|
|
238
|
+
* Powered by Nikkory
|
|
239
|
+
*/
|
|
240
|
+
protected defaultCodeComposer(parentCode: string, childCodes: readonly string[], config: GranularityConfig<GranularityLevel>): string;
|
|
241
|
+
/**
|
|
242
|
+
* Default style composer - concatenates styles
|
|
243
|
+
*
|
|
244
|
+
* @param parentStyles - Parent's generated styles
|
|
245
|
+
* @param childStyles - Children's generated styles
|
|
246
|
+
* @returns Composed styles string
|
|
247
|
+
*
|
|
248
|
+
* Powered by Nikkory
|
|
249
|
+
*/
|
|
250
|
+
protected defaultStyleComposer(parentStyles: string, childStyles: readonly string[]): string;
|
|
251
|
+
/**
|
|
252
|
+
* Generate code for a config (simplified implementation)
|
|
253
|
+
*
|
|
254
|
+
* @param config - Config to generate code for
|
|
255
|
+
* @param factors - Resolved factors
|
|
256
|
+
* @returns Generated code string
|
|
257
|
+
*
|
|
258
|
+
* Powered by Nikkory
|
|
259
|
+
*/
|
|
260
|
+
protected generateCode(config: GranularityConfig<GranularityLevel>, factors: GranularityFactorValues): string;
|
|
261
|
+
/**
|
|
262
|
+
* Generate styles for a config (simplified implementation)
|
|
263
|
+
*
|
|
264
|
+
* @param config - Config to generate styles for
|
|
265
|
+
* @param factors - Resolved factors
|
|
266
|
+
* @returns Generated styles string
|
|
267
|
+
*
|
|
268
|
+
* Powered by Nikkory
|
|
269
|
+
*/
|
|
270
|
+
protected generateStyles(config: GranularityConfig<GranularityLevel>, factors: GranularityFactorValues): string;
|
|
271
|
+
/**
|
|
272
|
+
* Get component name from config
|
|
273
|
+
*
|
|
274
|
+
* @param config - Config to get name from
|
|
275
|
+
* @returns PascalCase component name
|
|
276
|
+
*
|
|
277
|
+
* Powered by Nikkory
|
|
278
|
+
*/
|
|
279
|
+
protected getComponentName(config: GranularityConfig<GranularityLevel>): string;
|
|
280
|
+
/**
|
|
281
|
+
* Get CSS class name from config
|
|
282
|
+
*
|
|
283
|
+
* @param config - Config to get class from
|
|
284
|
+
* @returns kebab-case class name
|
|
285
|
+
*
|
|
286
|
+
* Powered by Nikkory
|
|
287
|
+
*/
|
|
288
|
+
protected getClassName(config: GranularityConfig<GranularityLevel>): string;
|
|
289
|
+
/**
|
|
290
|
+
* Generate props string from factors
|
|
291
|
+
*
|
|
292
|
+
* @param factors - Resolved factors
|
|
293
|
+
* @returns Props string for JSX
|
|
294
|
+
*
|
|
295
|
+
* Powered by Nikkory
|
|
296
|
+
*/
|
|
297
|
+
protected generateProps(factors: GranularityFactorValues): string;
|
|
298
|
+
/**
|
|
299
|
+
* Generate CSS variables from factors
|
|
300
|
+
*
|
|
301
|
+
* @param factors - Resolved factors
|
|
302
|
+
* @returns CSS variables string
|
|
303
|
+
*
|
|
304
|
+
* Powered by Nikkory
|
|
305
|
+
*/
|
|
306
|
+
protected generateCssVariables(factors: GranularityFactorValues): string;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Create a new RecursiveGenerator instance
|
|
310
|
+
*
|
|
311
|
+
* @param options - Generator options
|
|
312
|
+
* @returns RecursiveGenerator instance
|
|
313
|
+
*
|
|
314
|
+
* @example
|
|
315
|
+
* ```typescript
|
|
316
|
+
* const generator = createRecursiveGenerator({
|
|
317
|
+
* configLookup: (id) => configRegistry.get(id),
|
|
318
|
+
* maxDepth: 5,
|
|
319
|
+
* verbose: true,
|
|
320
|
+
* });
|
|
321
|
+
*
|
|
322
|
+
* const output = await generator.generate(pageConfig);
|
|
323
|
+
* ```
|
|
324
|
+
*
|
|
325
|
+
* Powered by Nikkory
|
|
326
|
+
*/
|
|
327
|
+
export declare function createRecursiveGenerator(options?: RecursiveGeneratorOptions): RecursiveGenerator;
|
|
328
|
+
//# sourceMappingURL=RecursiveGenerator.d.ts.map
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UI Studio - Nikkory Component Generation Engine
|
|
3
|
+
* Single entry point for all code generation functionality
|
|
4
|
+
*
|
|
5
|
+
* @packageDocumentation
|
|
6
|
+
* @module ui-studio
|
|
7
|
+
* @since 5.0.0
|
|
8
|
+
*
|
|
9
|
+
* Powered by Nikkory
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* ComponentGenerator - Main orchestrator for component generation
|
|
13
|
+
*/
|
|
14
|
+
export { ComponentGenerator, createComponentGenerator, generateComponent, generateComponentOutput, } from './ComponentGenerator';
|
|
15
|
+
export type { StyleOutput, CodeOutput, ComponentGenerationResult, } from './ComponentGenerator';
|
|
16
|
+
/**
|
|
17
|
+
* Factor resolution system - resolves factor values
|
|
18
|
+
*/
|
|
19
|
+
export { FactorResolver, createFactorResolver, resolveFactors, getTailwindClassesForComponent, getCssVariablesForComponent, } from './resolution/FactorResolver';
|
|
20
|
+
/**
|
|
21
|
+
* Matrix multiplication system - class mapping and configuration resolution
|
|
22
|
+
*/
|
|
23
|
+
export { MatrixResolver } from './matrix/MatrixResolver';
|
|
24
|
+
export { ClassMapper } from './matrix/ClassMapper';
|
|
25
|
+
export type * from './matrix/types';
|
|
26
|
+
/**
|
|
27
|
+
* Tier-based template generation
|
|
28
|
+
*/
|
|
29
|
+
export { TierGenerator } from './templates/TierGenerator';
|
|
30
|
+
/**
|
|
31
|
+
* Section and page composition system
|
|
32
|
+
*/
|
|
33
|
+
export { SectionGenerator } from './composition/SectionGenerator';
|
|
34
|
+
export { PageGenerator } from './composition/PageGenerator';
|
|
35
|
+
export { SlotResolver, createSlotResolver, resolveSlot, resolveSlots, isComponentAllowedInSlot, } from './composition/SlotResolver';
|
|
36
|
+
export { FactorPropagator, createFactorPropagator, propagateFactors, getFactorTailwindClasses as getSectionFactorTailwindClasses, getFactorCssVariables as getSectionFactorCssVariables, mapFactorsToProps, SECTION_FACTOR_MAPPINGS, } from './composition/FactorPropagator';
|
|
37
|
+
export { SectionGenerator as SectionOrchestratorGenerator, createSectionGenerator, generateSectionComponents, } from './composition/section-orchestrator';
|
|
38
|
+
/**
|
|
39
|
+
* Granularity-based generation system
|
|
40
|
+
*/
|
|
41
|
+
export { GranularityGenerator } from './granularity/GranularityGenerator';
|
|
42
|
+
export { RecursiveGenerator } from './granularity/RecursiveGenerator';
|
|
43
|
+
export { FactorCascade } from './granularity/FactorCascade';
|
|
44
|
+
/**
|
|
45
|
+
* Algorithm Engine registries - tier, factors, components, design systems
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* import { TIER_REGISTRY, getTierEntry } from '@nikkory/vibe-engine/ui-studio';
|
|
50
|
+
*
|
|
51
|
+
* const entry = getTierEntry('enterprise');
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export { TIER_REGISTRY, getTierEntry, getFactorsForTier, getCodeFeaturesForTier, getLocRangeForTier, isFactorEnabledForTier, getMinimumTierForFactor, getTiersSupportingFactor, compareTierLevels, getAllTiers, getTierDisplayName, } from './registries/tiers-registry';
|
|
55
|
+
export { FACTOR_REGISTRY as ALGORITHM_FACTOR_REGISTRY, getFactorDefinition, getAllFactorDefinitions, getFactorsByGroup, getFactorIdsByGroup, getFactorName, getFactorDefaultValue, getFactorPossibleValues, isValidFactorValue, getFactorCssProperty, getFactorDataAttribute, getAllFactorGroups, getFactorCountByGroup, getFactorsInRange, searchFactors, } from './registries/factors-registry';
|
|
56
|
+
export { COMPONENT_REGISTRY as ALGORITHM_COMPONENT_REGISTRY, getComponentEntry, getAllComponentTypes, getComponentsByCategory, getComponentIdsByCategory, getAllComponentCategories, getComponentCountByCategory, getApplicableFactors, getSkippedFactors, getFactorApplicability, isFactorApplicable, getFactorOverride, getComponentsSupportingFactor, getComponentsForDesignSystem, getComponentsForTier, componentSupportsDesignSystem, componentSupportsTier, searchComponents, getTotalComponentCount, getComponentElementType, } from './registries/components-registry';
|
|
57
|
+
export { DESIGN_SYSTEM_REGISTRY, getDesignSystemEntry, getAllDesignSystems, getFactorValue, getAllFactorValues, getFactorTailwindClasses, getFactorCssVariables, getDesignSystemCssVariables, getDesignSystemName, getDesignSystemDescription, searchDesignSystems, getTotalDesignSystemCount, hasFactorValue, getDesignSystemsWithFactor, generateThemeCss, mergeFactorValues, } from './registries/design-systems-registry';
|
|
58
|
+
/**
|
|
59
|
+
* Presets - granularity factors, component registry, sections, pages, etc.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```typescript
|
|
63
|
+
* import { ALL_COMPONENTS, getComponent } from '@nikkory/vibe-engine/ui-studio';
|
|
64
|
+
*
|
|
65
|
+
* const button = getComponent('button');
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export { FACTOR_REGISTRY as GRANULARITY_FACTOR_REGISTRY, colorPrimaryFactor, colorSecondaryFactor, typographyScaleFactor, borderRadiusFactor, shadowStyleFactor, themeModeFactor, iconStyleFactor, surfaceStyleFactor, spacingScaleFactor, containerWidthFactor, gridColumnsFactor, gapSizeFactor, alignmentFactor, layoutTypeFactor, aspectRatioFactor, animationDurationFactor, animationEasingFactor, hoverEffectFactor, loadingStyleFactor, breakpointStrategyFactor, mobileBehaviorFactor, touchTargetSizeFactor, focusStyleFactor, reducedMotionFactor, getFactorById, getFactorsByCategory as getGranularityFactorsByCategory, getAllFactorIds, isValidFactorId, getFactorRegistryStats, } from './presets/factor-registry';
|
|
69
|
+
export { getRegistryFor, getDefinitionById, getDefinitionIds, isValidDefinitionId, filterByCategory, filterByStatus, searchDefinitions, getRegistryStats as getGranularityRegistryStats, getAllRegistryStats, getDefinitionCounts, getTotalDefinitionCount, } from './presets/granularity-registry';
|
|
70
|
+
export type { RegistryDefinition, RegistryForLevel } from './presets/granularity-registry';
|
|
71
|
+
export { ALL_COMPONENTS as UI_COMPONENTS, COMPONENT_REGISTRY as UI_COMPONENT_REGISTRY, getAllComponentIds, getComponent, isValidComponentId, getComponentsByCategory as getUIComponentsByCategory, getComponentsByStatus, getComponentsByPhase, getStableComponents, getPlannedComponents, searchComponents as searchUIComponents, getComponentDependencies, getComponentDependents, getRegistryStats, getPopularComponents, getNewComponents, getComponentsByDesignSystem, getComponentsByTier, getComponentsByIcon, getAllIcons, getAllEmojis, getComponentsGroupedByCategory, getUIStats, } from './presets/component-registry';
|
|
72
|
+
export type { ComponentId, ComponentCategory, ComponentComplexity, ComponentStatus, RegistryComponentDefinition, ComponentDefinition, } from './presets/component-registry';
|
|
73
|
+
export type { BaseSectionDefinition, SectionCategoryDefaults } from './presets/section-registry.types';
|
|
74
|
+
export { SECTION_CATEGORY_ICONS, SECTION_CATEGORY_EMOJIS, SECTION_CATEGORY_DEFAULTS, getCategoryDefaults, getCategoryIcon, getCategoryEmoji, getAllSectionCategories, } from './presets/section-registry.defaults';
|
|
75
|
+
export { withSectionDefaults, withSectionDefaultsArray, validateBaseSectionDefinition, validateBaseSectionDefinitions, isBaseSectionDefinition, isRegistrySectionDefinition, } from './presets/section-registry.helpers';
|
|
76
|
+
export { ALL_SECTIONS } from './presets/section-registry';
|
|
77
|
+
export { ALL_LAYOUTS } from './presets/layout-registry';
|
|
78
|
+
export { ALL_PAGES } from './presets/page-registry';
|
|
79
|
+
export { ALL_TEMPLATES } from './presets/template-registry';
|
|
80
|
+
export * from './presets/registry.types';
|
|
81
|
+
export * from './presets/registry.constants';
|
|
82
|
+
export { INDUSTRY_PRESETS, getIndustryIds, getIndustryPreset, getPresetsByCategory, getPresetsByTier, getPresetsByDesignSystem, financePreset, healthcarePreset, ecommercePreset, saasPreset, educationPreset, gamingPreset, socialPreset, governmentPreset, creativePreset, realEstatePreset, travelPreset, foodPreset, fitnessPreset, newsPreset, nonprofitPreset, } from './presets/industries';
|
|
83
|
+
export type { IndustryCategory, DesignSystemId, ColorPaletteId, TierRecommendation, IndustryPreset, } from './presets/industries';
|
|
84
|
+
export { IndustryDetector, detectIndustry, detectMultipleIndustries, getIndustryRecommendation, getRecommendationFromInput, getAvailableIndustries, getIndustriesByCategory, searchIndustries as searchIndustryPresets, isValidIndustry, getAggregatedDesignSystems, } from './presets/IndustryDetector';
|
|
85
|
+
export type { DetectionConfidence, DetectionResult, AlternativeMatch, IndustryRecommendation, } from './presets/IndustryDetector';
|
|
86
|
+
export { MATRIX_GROUPS, getMatrixGroupIds, getMatrixGroup, getGroupsByCategory as getMatrixGroupsByCategory, getCommonBundles, getGroupsByComponent, calculateBundleSize, getRecommendedGroupsForIndustry, validateMatrixGroup, validateAllMatrixGroups, getStableComponentsInGroup, getAvailableComponentsInGroup, createMatrixGroup, formGroup, feedbackGroup, navigationGroup, dataDisplayGroup, overlayGroup, actionGroup, dateTimeGroup, mediaGroup, utilityGroup, starterBundle, dashboardBundle, ecommerceBundle, formHeavyBundle, contentRichBundle, mobileFirstBundle, } from './presets/matrix-groups';
|
|
87
|
+
export type { MatrixGroup, MatrixGroupCategory } from './presets/matrix-groups';
|
|
88
|
+
export * from './presets/variants';
|
|
89
|
+
export * from './presets/section-defaults';
|
|
90
|
+
/**
|
|
91
|
+
* Shared type definitions for UI Studio
|
|
92
|
+
*/
|
|
93
|
+
export type * from './types';
|
|
94
|
+
//# sourceMappingURL=index.d.ts.map
|