@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,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* String Utilities
|
|
3
|
+
*
|
|
4
|
+
* Safe stringification for any value type.
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
* @module utils/stringify
|
|
8
|
+
* @since 4.0.0
|
|
9
|
+
*
|
|
10
|
+
* Powered by Nikkory
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Safely convert any value to string.
|
|
14
|
+
* Handles objects, arrays, primitives.
|
|
15
|
+
*
|
|
16
|
+
* @param value - Value to stringify
|
|
17
|
+
* @returns String representation
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* safeStringify({ foo: 'bar' }) // '{"foo":"bar"}'
|
|
22
|
+
* safeStringify('hello') // 'hello'
|
|
23
|
+
* safeStringify(123) // '123'
|
|
24
|
+
* safeStringify(undefined) // 'undefined'
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function safeStringify(value: unknown): string;
|
|
28
|
+
//# sourceMappingURL=stringify.d.ts.map
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component Validator
|
|
3
|
+
* Input validation for component type parameters
|
|
4
|
+
*
|
|
5
|
+
* @packageDocumentation
|
|
6
|
+
* @module validators/component-validator
|
|
7
|
+
* @since 4.0.0
|
|
8
|
+
*
|
|
9
|
+
* Powered by Nikkory
|
|
10
|
+
*/
|
|
11
|
+
import type { ComponentType } from '../types';
|
|
12
|
+
import type { ValidationResult } from '../types/algorithm-engine.types';
|
|
13
|
+
/**
|
|
14
|
+
* All valid component types
|
|
15
|
+
*/
|
|
16
|
+
export declare const VALID_COMPONENT_TYPES: readonly ComponentType[];
|
|
17
|
+
/**
|
|
18
|
+
* Check if a value is a valid component type
|
|
19
|
+
*
|
|
20
|
+
* @param value - Value to check
|
|
21
|
+
* @returns True if value is a valid component type
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* isValidComponentType('button') // true
|
|
26
|
+
* isValidComponentType('invalid') // false
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare function isValidComponentType(value: unknown): value is ComponentType;
|
|
30
|
+
/**
|
|
31
|
+
* Validate component type input
|
|
32
|
+
*
|
|
33
|
+
* @param componentType - Component type to validate
|
|
34
|
+
* @returns Validation result
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* validateComponentType('button')
|
|
39
|
+
* // { valid: true, errors: [], warnings: [] }
|
|
40
|
+
*
|
|
41
|
+
* validateComponentType('invalid')
|
|
42
|
+
* // { valid: false, errors: ['Invalid component type...'], warnings: [] }
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare function validateComponentType(componentType: unknown): ValidationResult;
|
|
46
|
+
/**
|
|
47
|
+
* Assert that a value is a valid component type
|
|
48
|
+
*
|
|
49
|
+
* @param value - Value to check
|
|
50
|
+
* @throws Error if value is not a valid component type
|
|
51
|
+
*/
|
|
52
|
+
export declare function assertValidComponentType(value: unknown): asserts value is ComponentType;
|
|
53
|
+
/**
|
|
54
|
+
* Parse and validate component type
|
|
55
|
+
*
|
|
56
|
+
* @param value - Value to parse
|
|
57
|
+
* @returns Valid component type or undefined
|
|
58
|
+
*/
|
|
59
|
+
export declare function parseComponentType(value: unknown): ComponentType | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Get component type with fallback
|
|
62
|
+
*
|
|
63
|
+
* @param value - Value to check
|
|
64
|
+
* @param defaultType - Default component type
|
|
65
|
+
* @returns Valid component type
|
|
66
|
+
*/
|
|
67
|
+
export declare function getComponentTypeOrDefault(value: unknown, defaultType: ComponentType): ComponentType;
|
|
68
|
+
/**
|
|
69
|
+
* Suggest similar component type for typos
|
|
70
|
+
*
|
|
71
|
+
* @param input - User input
|
|
72
|
+
* @returns Suggested component type or undefined
|
|
73
|
+
*/
|
|
74
|
+
export declare function suggestComponentType(input: string): ComponentType | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* Get component types by category
|
|
77
|
+
*
|
|
78
|
+
* @param category - Category to filter by
|
|
79
|
+
* @returns Array of component types in the category
|
|
80
|
+
*/
|
|
81
|
+
export declare function getComponentTypesByCategory(category: 'basic' | 'feedback' | 'navigation' | 'data-display' | 'overlay' | 'date-time' | 'media'): ComponentType[];
|
|
82
|
+
/**
|
|
83
|
+
* Get all component type categories
|
|
84
|
+
*/
|
|
85
|
+
export declare function getAllComponentCategories(): string[];
|
|
86
|
+
//# sourceMappingURL=component-validator.d.ts.map
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Design System Validator
|
|
3
|
+
* Input validation for design system parameters
|
|
4
|
+
*
|
|
5
|
+
* @packageDocumentation
|
|
6
|
+
* @module validators/design-system-validator
|
|
7
|
+
* @since 4.0.0
|
|
8
|
+
*
|
|
9
|
+
* Powered by Nikkory
|
|
10
|
+
*/
|
|
11
|
+
import type { DesignSystem } from '../types';
|
|
12
|
+
import type { ValidationResult } from '../types/algorithm-engine.types';
|
|
13
|
+
/**
|
|
14
|
+
* All valid design systems (12 total)
|
|
15
|
+
*/
|
|
16
|
+
export declare const VALID_DESIGN_SYSTEMS: readonly DesignSystem[];
|
|
17
|
+
/**
|
|
18
|
+
* Check if a value is a valid design system
|
|
19
|
+
*
|
|
20
|
+
* @param value - Value to check
|
|
21
|
+
* @returns True if value is a valid design system
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* isValidDesignSystem('material-design') // true
|
|
26
|
+
* isValidDesignSystem('invalid') // false
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare function isValidDesignSystem(value: unknown): value is DesignSystem;
|
|
30
|
+
/**
|
|
31
|
+
* Validate design system input
|
|
32
|
+
*
|
|
33
|
+
* @param designSystem - Design system to validate
|
|
34
|
+
* @returns Validation result
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* validateDesignSystem('material-design')
|
|
39
|
+
* // { valid: true, errors: [], warnings: [] }
|
|
40
|
+
*
|
|
41
|
+
* validateDesignSystem('invalid')
|
|
42
|
+
* // { valid: false, errors: ['Invalid design system...'], warnings: [] }
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare function validateDesignSystem(designSystem: unknown): ValidationResult;
|
|
46
|
+
/**
|
|
47
|
+
* Assert that a value is a valid design system
|
|
48
|
+
*
|
|
49
|
+
* @param value - Value to check
|
|
50
|
+
* @throws Error if value is not a valid design system
|
|
51
|
+
*/
|
|
52
|
+
export declare function assertValidDesignSystem(value: unknown): asserts value is DesignSystem;
|
|
53
|
+
/**
|
|
54
|
+
* Parse and validate design system
|
|
55
|
+
*
|
|
56
|
+
* @param value - Value to parse
|
|
57
|
+
* @returns Valid design system or undefined
|
|
58
|
+
*/
|
|
59
|
+
export declare function parseDesignSystem(value: unknown): DesignSystem | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Get design system with fallback
|
|
62
|
+
*
|
|
63
|
+
* @param value - Value to check
|
|
64
|
+
* @param defaultDs - Default design system
|
|
65
|
+
* @returns Valid design system
|
|
66
|
+
*/
|
|
67
|
+
export declare function getDesignSystemOrDefault(value: unknown, defaultDs: DesignSystem): DesignSystem;
|
|
68
|
+
/**
|
|
69
|
+
* Suggest similar design system for typos
|
|
70
|
+
*
|
|
71
|
+
* @param input - User input
|
|
72
|
+
* @returns Suggested design system or undefined
|
|
73
|
+
*/
|
|
74
|
+
export declare function suggestDesignSystem(input: string): DesignSystem | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* Get design system display name
|
|
77
|
+
*
|
|
78
|
+
* @param designSystem - Design system ID
|
|
79
|
+
* @returns Human-readable display name
|
|
80
|
+
*/
|
|
81
|
+
export declare function getDesignSystemDisplayName(designSystem: DesignSystem): string;
|
|
82
|
+
/**
|
|
83
|
+
* Get design system company/origin
|
|
84
|
+
*
|
|
85
|
+
* @param designSystem - Design system ID
|
|
86
|
+
* @returns Company or origin of the design system
|
|
87
|
+
*/
|
|
88
|
+
export declare function getDesignSystemOrigin(designSystem: DesignSystem): string;
|
|
89
|
+
/**
|
|
90
|
+
* Get all design system IDs
|
|
91
|
+
*
|
|
92
|
+
* @returns Array of all design system IDs
|
|
93
|
+
*/
|
|
94
|
+
export declare function getAllDesignSystems(): DesignSystem[];
|
|
95
|
+
//# sourceMappingURL=design-system-validator.d.ts.map
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Factor Validator
|
|
3
|
+
* Input validation for factor parameters
|
|
4
|
+
*
|
|
5
|
+
* @packageDocumentation
|
|
6
|
+
* @module validators/factor-validator
|
|
7
|
+
* @since 4.0.0
|
|
8
|
+
*
|
|
9
|
+
* Powered by Nikkory
|
|
10
|
+
*/
|
|
11
|
+
import type { FactorId, ValidationResult } from '../types/algorithm-engine.types';
|
|
12
|
+
/**
|
|
13
|
+
* All valid factor IDs (1-24)
|
|
14
|
+
*/
|
|
15
|
+
export declare const VALID_FACTOR_IDS: readonly FactorId[];
|
|
16
|
+
/**
|
|
17
|
+
* Check if a value is a valid factor ID
|
|
18
|
+
*
|
|
19
|
+
* @param value - Value to check
|
|
20
|
+
* @returns True if value is a valid factor ID (1-24)
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* isValidFactorId(1) // true
|
|
25
|
+
* isValidFactorId(24) // true
|
|
26
|
+
* isValidFactorId(0) // false
|
|
27
|
+
* isValidFactorId(25) // false
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare function isValidFactorId(value: unknown): value is FactorId;
|
|
31
|
+
/**
|
|
32
|
+
* Validate factor ID input
|
|
33
|
+
*
|
|
34
|
+
* @param factorId - Factor ID to validate
|
|
35
|
+
* @returns Validation result
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* validateFactorId(1)
|
|
40
|
+
* // { valid: true, errors: [], warnings: [] }
|
|
41
|
+
*
|
|
42
|
+
* validateFactorId(25)
|
|
43
|
+
* // { valid: false, errors: ['Invalid factor ID...'], warnings: [] }
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare function validateFactorId(factorId: unknown): ValidationResult;
|
|
47
|
+
/**
|
|
48
|
+
* Validate a factor value for a specific factor ID
|
|
49
|
+
*
|
|
50
|
+
* @param factorId - Factor ID to validate value for
|
|
51
|
+
* @param value - Value to validate
|
|
52
|
+
* @returns Validation result
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```typescript
|
|
56
|
+
* validateFactorValueInput(1, 'primary')
|
|
57
|
+
* // { valid: true, errors: [], warnings: [] }
|
|
58
|
+
*
|
|
59
|
+
* validateFactorValueInput(1, 'invalid')
|
|
60
|
+
* // { valid: false, errors: ['Invalid value...'], warnings: [] }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export declare function validateFactorValueInput(factorId: unknown, value: unknown): ValidationResult;
|
|
64
|
+
/**
|
|
65
|
+
* Validate factor overrides object
|
|
66
|
+
*
|
|
67
|
+
* @param overrides - Factor overrides to validate
|
|
68
|
+
* @returns Validation result
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```typescript
|
|
72
|
+
* validateFactorOverrides({ 1: 'secondary', 2: 'lg' })
|
|
73
|
+
* // { valid: true, errors: [], warnings: [] }
|
|
74
|
+
*
|
|
75
|
+
* validateFactorOverrides({ 1: 'invalid', 99: 'value' })
|
|
76
|
+
* // { valid: false, errors: [...], warnings: [] }
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
export declare function validateFactorOverrides(overrides: unknown): ValidationResult;
|
|
80
|
+
/**
|
|
81
|
+
* Assert that a value is a valid factor ID
|
|
82
|
+
*
|
|
83
|
+
* @param value - Value to check
|
|
84
|
+
* @throws Error if value is not a valid factor ID
|
|
85
|
+
*/
|
|
86
|
+
export declare function assertValidFactorId(value: unknown): asserts value is FactorId;
|
|
87
|
+
/**
|
|
88
|
+
* Parse and validate factor ID
|
|
89
|
+
*
|
|
90
|
+
* @param value - Value to parse
|
|
91
|
+
* @returns Valid factor ID or undefined
|
|
92
|
+
*/
|
|
93
|
+
export declare function parseFactorId(value: unknown): FactorId | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* Suggest similar factor names for typos
|
|
96
|
+
*
|
|
97
|
+
* @param input - User input
|
|
98
|
+
* @returns Array of suggested factor names
|
|
99
|
+
*/
|
|
100
|
+
export declare function suggestFactorName(input: string): string[];
|
|
101
|
+
//# sourceMappingURL=factor-validator.d.ts.map
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Algorithm Engine Validators
|
|
3
|
+
* Barrel export for all validator modules
|
|
4
|
+
*
|
|
5
|
+
* @packageDocumentation
|
|
6
|
+
* @module validators
|
|
7
|
+
* @since 4.0.0
|
|
8
|
+
*
|
|
9
|
+
* Powered by Nikkory
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Tier validation utilities
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* import { isValidTier, validateTier, parseTier } from '@nikkory/vibe-engine/validators';
|
|
17
|
+
*
|
|
18
|
+
* // Type guard
|
|
19
|
+
* if (isValidTier(input)) {
|
|
20
|
+
* // input is Tier
|
|
21
|
+
* }
|
|
22
|
+
*
|
|
23
|
+
* // Validation with errors
|
|
24
|
+
* const result = validateTier('basic');
|
|
25
|
+
* if (!result.valid) {
|
|
26
|
+
* console.error(result.errors);
|
|
27
|
+
* }
|
|
28
|
+
*
|
|
29
|
+
* // Parse with fallback
|
|
30
|
+
* const tier = parseTier('basci') ?? 'basic';
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export {
|
|
34
|
+
/** All valid tier values: 'basic', 'standard', 'enterprise' */
|
|
35
|
+
VALID_TIERS,
|
|
36
|
+
/** Type guard to check if value is a valid Tier */
|
|
37
|
+
isValidTier,
|
|
38
|
+
/** Validate tier with detailed error messages */
|
|
39
|
+
validateTier,
|
|
40
|
+
/** Assert tier is valid, throws if invalid */
|
|
41
|
+
assertValidTier,
|
|
42
|
+
/** Parse and validate tier, returns undefined if invalid */
|
|
43
|
+
parseTier,
|
|
44
|
+
/** Get tier or fallback to default */
|
|
45
|
+
getTierOrDefault,
|
|
46
|
+
/** Suggest correct tier for typos */
|
|
47
|
+
suggestTier, } from './tier-validator';
|
|
48
|
+
/**
|
|
49
|
+
* Factor validation utilities for 24-Factor system
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* import { isValidFactorId, validateFactorOverrides } from '@nikkory/vibe-engine/validators';
|
|
54
|
+
*
|
|
55
|
+
* // Validate factor ID (1-24)
|
|
56
|
+
* if (isValidFactorId(5)) {
|
|
57
|
+
* // factorId is FactorId type
|
|
58
|
+
* }
|
|
59
|
+
*
|
|
60
|
+
* // Validate factor overrides object
|
|
61
|
+
* const result = validateFactorOverrides({ 1: 'primary', 2: 'lg' });
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export {
|
|
65
|
+
/** All valid factor IDs (1-24) */
|
|
66
|
+
VALID_FACTOR_IDS,
|
|
67
|
+
/** Type guard for valid factor ID */
|
|
68
|
+
isValidFactorId,
|
|
69
|
+
/** Validate factor ID with detailed errors */
|
|
70
|
+
validateFactorId,
|
|
71
|
+
/** Validate factor value for a specific factor */
|
|
72
|
+
validateFactorValueInput,
|
|
73
|
+
/** Validate factor overrides object */
|
|
74
|
+
validateFactorOverrides,
|
|
75
|
+
/** Assert factor ID is valid, throws if invalid */
|
|
76
|
+
assertValidFactorId,
|
|
77
|
+
/** Parse factor ID from string or number */
|
|
78
|
+
parseFactorId,
|
|
79
|
+
/** Suggest factor names for typos */
|
|
80
|
+
suggestFactorName, } from './factor-validator';
|
|
81
|
+
/**
|
|
82
|
+
* Component type validation utilities
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```typescript
|
|
86
|
+
* import { isValidComponentType, validateComponentType } from '@nikkory/vibe-engine/validators';
|
|
87
|
+
*
|
|
88
|
+
* // Type guard
|
|
89
|
+
* if (isValidComponentType('button')) {
|
|
90
|
+
* // type is ComponentType
|
|
91
|
+
* }
|
|
92
|
+
*
|
|
93
|
+
* // Get components by category
|
|
94
|
+
* const formComponents = getComponentTypesByCategory('form');
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
export {
|
|
98
|
+
/** All valid component types (32 types) */
|
|
99
|
+
VALID_COMPONENT_TYPES,
|
|
100
|
+
/** Type guard for valid component type */
|
|
101
|
+
isValidComponentType,
|
|
102
|
+
/** Validate component type with detailed errors */
|
|
103
|
+
validateComponentType,
|
|
104
|
+
/** Assert component type is valid, throws if invalid */
|
|
105
|
+
assertValidComponentType,
|
|
106
|
+
/** Parse component type from string */
|
|
107
|
+
parseComponentType,
|
|
108
|
+
/** Get component type or fallback to default */
|
|
109
|
+
getComponentTypeOrDefault,
|
|
110
|
+
/** Suggest component types for typos */
|
|
111
|
+
suggestComponentType,
|
|
112
|
+
/** Get component types by category */
|
|
113
|
+
getComponentTypesByCategory,
|
|
114
|
+
/** Get all component categories */
|
|
115
|
+
getAllComponentCategories, } from './component-validator';
|
|
116
|
+
/**
|
|
117
|
+
* Design system validation utilities
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```typescript
|
|
121
|
+
* import { isValidDesignSystem, validateDesignSystem } from '@nikkory/vibe-engine/validators';
|
|
122
|
+
*
|
|
123
|
+
* // Type guard
|
|
124
|
+
* if (isValidDesignSystem('material-design')) {
|
|
125
|
+
* // ds is DesignSystem type
|
|
126
|
+
* }
|
|
127
|
+
*
|
|
128
|
+
* // Get display info
|
|
129
|
+
* const name = getDesignSystemDisplayName('ios-hig'); // "iOS HIG"
|
|
130
|
+
* const origin = getDesignSystemOrigin('material-design'); // "Google"
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
export {
|
|
134
|
+
/** All valid design system identifiers (12 systems) */
|
|
135
|
+
VALID_DESIGN_SYSTEMS,
|
|
136
|
+
/** Type guard for valid design system */
|
|
137
|
+
isValidDesignSystem,
|
|
138
|
+
/** Validate design system with detailed errors */
|
|
139
|
+
validateDesignSystem,
|
|
140
|
+
/** Assert design system is valid, throws if invalid */
|
|
141
|
+
assertValidDesignSystem,
|
|
142
|
+
/** Parse design system from string */
|
|
143
|
+
parseDesignSystem,
|
|
144
|
+
/** Get design system or fallback to default */
|
|
145
|
+
getDesignSystemOrDefault,
|
|
146
|
+
/** Suggest design systems for typos */
|
|
147
|
+
suggestDesignSystem,
|
|
148
|
+
/** Get human-readable display name */
|
|
149
|
+
getDesignSystemDisplayName,
|
|
150
|
+
/** Get design system origin/company */
|
|
151
|
+
getDesignSystemOrigin,
|
|
152
|
+
/** Get all design system identifiers */
|
|
153
|
+
getAllDesignSystems, } from './design-system-validator';
|
|
154
|
+
/**
|
|
155
|
+
* Section configuration validation utilities
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* ```typescript
|
|
159
|
+
* import { validateSectionConfig, validateSectionFactors } from '@nikkory/vibe-engine/validators';
|
|
160
|
+
*
|
|
161
|
+
* // Validate SectionConfig
|
|
162
|
+
* const result = validateSectionConfig({
|
|
163
|
+
* sectionId: 'hero-1',
|
|
164
|
+
* sectionType: 'hero',
|
|
165
|
+
* title: 'Welcome',
|
|
166
|
+
* designSystem: 'material-design',
|
|
167
|
+
* tier: 'enterprise',
|
|
168
|
+
* layout: 'flex',
|
|
169
|
+
* columns: 2,
|
|
170
|
+
* spacing: 'lg',
|
|
171
|
+
* });
|
|
172
|
+
*
|
|
173
|
+
* if (!result.valid) {
|
|
174
|
+
* console.error(result.errors);
|
|
175
|
+
* }
|
|
176
|
+
*
|
|
177
|
+
* // Validate SectionFactors
|
|
178
|
+
* const factorsResult = validateSectionFactors({
|
|
179
|
+
* colorPrimary: '#6750a4',
|
|
180
|
+
* // ... other factors
|
|
181
|
+
* });
|
|
182
|
+
* ```
|
|
183
|
+
*/
|
|
184
|
+
export {
|
|
185
|
+
/** Validate SectionConfig object */
|
|
186
|
+
validateSectionConfig,
|
|
187
|
+
/** Validate SectionFactors object */
|
|
188
|
+
validateSectionFactors,
|
|
189
|
+
/** Create validated SectionConfig (throws on error) */
|
|
190
|
+
createValidatedConfig,
|
|
191
|
+
/** Create validated SectionFactors (throws on error) */
|
|
192
|
+
createValidatedFactors,
|
|
193
|
+
/** Type guard for SectionCategory */
|
|
194
|
+
isSectionCategory,
|
|
195
|
+
/** Type guard for LayoutType */
|
|
196
|
+
isLayoutType,
|
|
197
|
+
/** Type guard for SpacingLevel */
|
|
198
|
+
isSpacingLevel,
|
|
199
|
+
/** Type guard for DesignSystem (from section-validator) */
|
|
200
|
+
isValidDesignSystem as isSectionDesignSystem,
|
|
201
|
+
/** Type guard for Tier (from section-validator) */
|
|
202
|
+
isValidTier as isSectionTier, } from './section-validator';
|
|
203
|
+
/**
|
|
204
|
+
* Slot configuration validation utilities
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* ```typescript
|
|
208
|
+
* import { validateSlotConfig, validateStoredComponent } from '@nikkory/vibe-engine/validators';
|
|
209
|
+
*
|
|
210
|
+
* // Validate SlotConfig
|
|
211
|
+
* const result = validateSlotConfig({
|
|
212
|
+
* slotId: 'header-slot',
|
|
213
|
+
* position: 'header',
|
|
214
|
+
* allowedComponents: ['button', 'badge'],
|
|
215
|
+
* maxComponents: 5,
|
|
216
|
+
* });
|
|
217
|
+
*
|
|
218
|
+
* // Validate StoredComponentInSlot
|
|
219
|
+
* const componentResult = validateStoredComponent({
|
|
220
|
+
* componentRef: 'button',
|
|
221
|
+
* instanceId: 'btn-1',
|
|
222
|
+
* propOverrides: { variant: 'primary' },
|
|
223
|
+
* order: 0,
|
|
224
|
+
* visible: true,
|
|
225
|
+
* });
|
|
226
|
+
* ```
|
|
227
|
+
*/
|
|
228
|
+
export {
|
|
229
|
+
/** Validate SlotConfig object */
|
|
230
|
+
validateSlotConfig,
|
|
231
|
+
/** Validate multiple SlotConfig objects */
|
|
232
|
+
validateSlotConfigs,
|
|
233
|
+
/** Validate StoredComponentInSlot object */
|
|
234
|
+
validateStoredComponent,
|
|
235
|
+
/** Validate component placement in slot */
|
|
236
|
+
validateComponentInSlot,
|
|
237
|
+
/** Validate multiple components in a slot */
|
|
238
|
+
validateComponentsInSlot,
|
|
239
|
+
/** Create validated SlotConfig (throws on error) */
|
|
240
|
+
createValidatedSlotConfig,
|
|
241
|
+
/** Create validated StoredComponentInSlot (throws on error) */
|
|
242
|
+
createValidatedStoredComponent,
|
|
243
|
+
/** Type guard for SlotPosition */
|
|
244
|
+
isSlotPosition,
|
|
245
|
+
/** Type guard for ComponentType */
|
|
246
|
+
isComponentType,
|
|
247
|
+
/** Type guard for valid SlotConfig */
|
|
248
|
+
isValidSlotConfig,
|
|
249
|
+
/** Type guard for valid StoredComponentInSlot */
|
|
250
|
+
isValidStoredComponent,
|
|
251
|
+
/** Default header slot config */
|
|
252
|
+
DEFAULT_HEADER_SLOT,
|
|
253
|
+
/** Default content slot config */
|
|
254
|
+
DEFAULT_CONTENT_SLOT,
|
|
255
|
+
/** Default footer slot config */
|
|
256
|
+
DEFAULT_FOOTER_SLOT,
|
|
257
|
+
/** Default sidebar slot config */
|
|
258
|
+
DEFAULT_SIDEBAR_SLOT,
|
|
259
|
+
/** Default overlay slot config */
|
|
260
|
+
DEFAULT_OVERLAY_SLOT,
|
|
261
|
+
/** Get default slot config by position */
|
|
262
|
+
getDefaultSlotConfig, } from './slot-validator';
|
|
263
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Section Validator - Validates SectionConfig objects
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
* @module validators/section-validator
|
|
6
|
+
* @since 4.0.0
|
|
7
|
+
*
|
|
8
|
+
* Powered by Nikkory
|
|
9
|
+
*/
|
|
10
|
+
import type { DesignSystem } from '../constants/DesignSystems';
|
|
11
|
+
import type { Tier } from '../constants/Tiers';
|
|
12
|
+
import type { ValidationResult } from '../types/algorithm-engine.types';
|
|
13
|
+
import type { SectionConfig, SectionCategory, LayoutType, SpacingLevel, SectionFactors } from '../types/section.types';
|
|
14
|
+
/**
|
|
15
|
+
* Validate a SectionConfig object
|
|
16
|
+
*
|
|
17
|
+
* @param config - The SectionConfig to validate
|
|
18
|
+
* @returns ValidationResult indicating success or failure with error messages
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const result = validateSectionConfig({
|
|
23
|
+
* sectionId: 'hero-1',
|
|
24
|
+
* sectionType: 'hero',
|
|
25
|
+
* title: 'Welcome',
|
|
26
|
+
* designSystem: 'material-design',
|
|
27
|
+
* tier: 'enterprise',
|
|
28
|
+
* layout: 'flex',
|
|
29
|
+
* columns: 2,
|
|
30
|
+
* spacing: 'lg',
|
|
31
|
+
* });
|
|
32
|
+
*
|
|
33
|
+
* if (result.valid) {
|
|
34
|
+
* console.log('Config is valid');
|
|
35
|
+
* } else {
|
|
36
|
+
* console.log('Errors:', result.errors);
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function validateSectionConfig(config: unknown): ValidationResult;
|
|
41
|
+
/**
|
|
42
|
+
* Validate SectionFactors object
|
|
43
|
+
*
|
|
44
|
+
* @param factors - The SectionFactors to validate
|
|
45
|
+
* @returns ValidationResult indicating success or failure with error messages
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* const result = validateSectionFactors({
|
|
50
|
+
* colorPrimary: '#6750a4',
|
|
51
|
+
* colorText: '#1c1b1f',
|
|
52
|
+
* colorBackground: '#fffbfe',
|
|
53
|
+
* typography: 'default',
|
|
54
|
+
* borderRadius: 'lg',
|
|
55
|
+
* elevation: 'sm',
|
|
56
|
+
* padding: 'lg',
|
|
57
|
+
* gap: 'md',
|
|
58
|
+
* alignment: 'center',
|
|
59
|
+
* maxWidth: 'xl',
|
|
60
|
+
* animation: 'smooth',
|
|
61
|
+
* responsive: { mobile: 'stack', tablet: 'grid', desktop: 'grid' },
|
|
62
|
+
* a11yLevel: 'enhanced',
|
|
63
|
+
* });
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export declare function validateSectionFactors(factors: unknown): ValidationResult;
|
|
67
|
+
/**
|
|
68
|
+
* Create a validated SectionConfig
|
|
69
|
+
*
|
|
70
|
+
* @param config - Partial config to validate and return
|
|
71
|
+
* @returns The validated SectionConfig or throws on invalid
|
|
72
|
+
* @throws Error if validation fails
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```typescript
|
|
76
|
+
* const config = createValidatedConfig({
|
|
77
|
+
* sectionId: 'hero-1',
|
|
78
|
+
* sectionType: 'hero',
|
|
79
|
+
* // ... other fields
|
|
80
|
+
* });
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
export declare function createValidatedConfig(config: unknown): SectionConfig;
|
|
84
|
+
/**
|
|
85
|
+
* Create validated SectionFactors
|
|
86
|
+
*
|
|
87
|
+
* @param factors - Factors to validate and return
|
|
88
|
+
* @returns The validated SectionFactors or throws on invalid
|
|
89
|
+
* @throws Error if validation fails
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```typescript
|
|
93
|
+
* const factors = createValidatedFactors({
|
|
94
|
+
* colorPrimary: '#6750a4',
|
|
95
|
+
* // ... other fields
|
|
96
|
+
* });
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
export declare function createValidatedFactors(factors: unknown): SectionFactors;
|
|
100
|
+
/**
|
|
101
|
+
* Type guard to check if a value is a valid SectionCategory
|
|
102
|
+
*/
|
|
103
|
+
export declare function isSectionCategory(value: unknown): value is SectionCategory;
|
|
104
|
+
/**
|
|
105
|
+
* Type guard to check if a value is a valid LayoutType
|
|
106
|
+
*/
|
|
107
|
+
export declare function isLayoutType(value: unknown): value is LayoutType;
|
|
108
|
+
/**
|
|
109
|
+
* Type guard to check if a value is a valid SpacingLevel
|
|
110
|
+
*/
|
|
111
|
+
export declare function isSpacingLevel(value: unknown): value is SpacingLevel;
|
|
112
|
+
/**
|
|
113
|
+
* Type guard to check if a value is a valid DesignSystem
|
|
114
|
+
*/
|
|
115
|
+
export declare function isValidDesignSystem(value: unknown): value is DesignSystem;
|
|
116
|
+
/**
|
|
117
|
+
* Type guard to check if a value is a valid Tier
|
|
118
|
+
*/
|
|
119
|
+
export declare function isValidTier(value: unknown): value is Tier;
|
|
120
|
+
//# sourceMappingURL=section-validator.d.ts.map
|