@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,268 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base Types for Unified Granularity Architecture
|
|
3
|
+
*
|
|
4
|
+
* This file defines the core types for the 6-level granularity system,
|
|
5
|
+
* replacing duplicate Section/Page/Layout/Template patterns with a
|
|
6
|
+
* unified generic approach.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
* @module types/granularity
|
|
10
|
+
* @since 4.0.0
|
|
11
|
+
*
|
|
12
|
+
* Powered by Nikkory
|
|
13
|
+
*/
|
|
14
|
+
import type { DesignSystem, Tier } from '../../../types';
|
|
15
|
+
/**
|
|
16
|
+
* 6 Granularity Levels - Component hierarchy from smallest to largest
|
|
17
|
+
*
|
|
18
|
+
* @category types
|
|
19
|
+
* @since 4.0.0
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* const level: GranularityLevel = 'section';
|
|
24
|
+
* const config: GranularityConfig<'page'> = { ... };
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* Powered by Nikkory
|
|
28
|
+
*/
|
|
29
|
+
export type GranularityLevel = 'atom' | 'component' | 'section' | 'page' | 'layout' | 'template';
|
|
30
|
+
/**
|
|
31
|
+
* Granularity hierarchy for cascade - ordered from highest to lowest
|
|
32
|
+
*
|
|
33
|
+
* Higher levels cascade factors DOWN to lower levels.
|
|
34
|
+
* Template is the highest level (6), Atom is the lowest (1).
|
|
35
|
+
*
|
|
36
|
+
* @category constants
|
|
37
|
+
* @since 4.0.0
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* // Iterate from highest to lowest
|
|
42
|
+
* for (const level of GRANULARITY_HIERARCHY) {
|
|
43
|
+
* console.log(level); // template, layout, page, section, component, atom
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* Powered by Nikkory
|
|
48
|
+
*/
|
|
49
|
+
export declare const GRANULARITY_HIERARCHY: readonly GranularityLevel[];
|
|
50
|
+
/**
|
|
51
|
+
* Get numeric rank for a granularity level
|
|
52
|
+
*
|
|
53
|
+
* Returns a number where:
|
|
54
|
+
* - template = 6 (highest)
|
|
55
|
+
* - layout = 5
|
|
56
|
+
* - page = 4
|
|
57
|
+
* - section = 3
|
|
58
|
+
* - component = 2
|
|
59
|
+
* - atom = 1 (lowest)
|
|
60
|
+
*
|
|
61
|
+
* @category utils
|
|
62
|
+
* @since 4.0.0
|
|
63
|
+
*
|
|
64
|
+
* @param level - The granularity level to get rank for
|
|
65
|
+
* @returns Numeric rank (1-6)
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```typescript
|
|
69
|
+
* getGranularityRank('template'); // 6
|
|
70
|
+
* getGranularityRank('atom'); // 1
|
|
71
|
+
* getGranularityRank('section'); // 3
|
|
72
|
+
*
|
|
73
|
+
* // Use for comparison
|
|
74
|
+
* if (getGranularityRank(a) > getGranularityRank(b)) {
|
|
75
|
+
* // a is higher level than b
|
|
76
|
+
* }
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* Powered by Nikkory
|
|
80
|
+
*/
|
|
81
|
+
export declare function getGranularityRank(level: GranularityLevel): number;
|
|
82
|
+
/**
|
|
83
|
+
* Factor categories for grouping related factors
|
|
84
|
+
*
|
|
85
|
+
* @category types
|
|
86
|
+
* @since 4.0.0
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```typescript
|
|
90
|
+
* const category: FactorCategory = 'visual';
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* Powered by Nikkory
|
|
94
|
+
*/
|
|
95
|
+
export type GranularityFactorCategory = 'visual' | 'layout' | 'behavior' | 'responsive' | 'a11y';
|
|
96
|
+
/**
|
|
97
|
+
* Factor definition with level and cascade behavior
|
|
98
|
+
*
|
|
99
|
+
* This REPLACES hardcoded 8/13/24 factor arrays with a dynamic
|
|
100
|
+
* registry-based approach where each factor specifies its minimum
|
|
101
|
+
* level and whether it cascades down to child granularities.
|
|
102
|
+
*
|
|
103
|
+
* @category types
|
|
104
|
+
* @since 4.0.0
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```typescript
|
|
108
|
+
* const spacingFactor: GranularityFactorDefinition = {
|
|
109
|
+
* id: 'spacing',
|
|
110
|
+
* name: 'Spacing',
|
|
111
|
+
* category: 'layout',
|
|
112
|
+
* level: 'template',
|
|
113
|
+
* cascadeDown: true,
|
|
114
|
+
* defaults: {
|
|
115
|
+
* 'material-design': 'md',
|
|
116
|
+
* 'ios-hig': 'sm'
|
|
117
|
+
* },
|
|
118
|
+
* options: ['xs', 'sm', 'md', 'lg', 'xl'],
|
|
119
|
+
* description: 'Controls spacing between elements'
|
|
120
|
+
* };
|
|
121
|
+
* ```
|
|
122
|
+
*
|
|
123
|
+
* Powered by Nikkory
|
|
124
|
+
*/
|
|
125
|
+
export interface GranularityFactorDefinition {
|
|
126
|
+
/** Factor unique identifier */
|
|
127
|
+
readonly id: string;
|
|
128
|
+
/** Human-readable name */
|
|
129
|
+
readonly name: string;
|
|
130
|
+
/** Factor category */
|
|
131
|
+
readonly category: GranularityFactorCategory;
|
|
132
|
+
/** Minimum granularity level where this factor applies */
|
|
133
|
+
readonly level: GranularityLevel;
|
|
134
|
+
/** Whether factor cascades DOWN to child granularities */
|
|
135
|
+
readonly cascadeDown: boolean;
|
|
136
|
+
/** Default value per design system */
|
|
137
|
+
readonly defaults: Partial<Record<DesignSystem, unknown>>;
|
|
138
|
+
/** Possible values */
|
|
139
|
+
readonly options?: readonly unknown[];
|
|
140
|
+
/** Description for documentation */
|
|
141
|
+
readonly description: string;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Template visibility levels for sharing
|
|
145
|
+
*
|
|
146
|
+
* @category types
|
|
147
|
+
* @since 4.0.0
|
|
148
|
+
*
|
|
149
|
+
* Powered by Nikkory
|
|
150
|
+
*/
|
|
151
|
+
export type GranularityTemplateVisibility = 'private' | 'team' | 'public';
|
|
152
|
+
/**
|
|
153
|
+
* Layout configuration for slot arrangements
|
|
154
|
+
*
|
|
155
|
+
* @category types
|
|
156
|
+
* @since 4.0.0
|
|
157
|
+
*
|
|
158
|
+
* @example
|
|
159
|
+
* ```typescript
|
|
160
|
+
* const layout: LayoutConfig = {
|
|
161
|
+
* type: 'grid',
|
|
162
|
+
* columns: 3,
|
|
163
|
+
* gap: 'md',
|
|
164
|
+
* alignment: 'center'
|
|
165
|
+
* };
|
|
166
|
+
* ```
|
|
167
|
+
*
|
|
168
|
+
* Powered by Nikkory
|
|
169
|
+
*/
|
|
170
|
+
export interface GranularityLayoutConfig {
|
|
171
|
+
readonly type: 'grid' | 'flex' | 'stack' | 'masonry' | 'carousel';
|
|
172
|
+
readonly columns?: 1 | 2 | 3 | 4 | 6;
|
|
173
|
+
readonly gap?: GranularitySpacingLevel;
|
|
174
|
+
readonly alignment?: GranularityAlignmentType;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Spacing levels for consistent spacing scale
|
|
178
|
+
*
|
|
179
|
+
* @category types
|
|
180
|
+
* @since 4.0.0
|
|
181
|
+
*
|
|
182
|
+
* Powered by Nikkory
|
|
183
|
+
*/
|
|
184
|
+
export type GranularitySpacingLevel = 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
|
|
185
|
+
/**
|
|
186
|
+
* Alignment types for layout positioning
|
|
187
|
+
*
|
|
188
|
+
* @category types
|
|
189
|
+
* @since 4.0.0
|
|
190
|
+
*
|
|
191
|
+
* Powered by Nikkory
|
|
192
|
+
*/
|
|
193
|
+
export type GranularityAlignmentType = 'start' | 'center' | 'end' | 'stretch' | 'between';
|
|
194
|
+
/**
|
|
195
|
+
* Style overrides for customization
|
|
196
|
+
*
|
|
197
|
+
* @category types
|
|
198
|
+
* @since 4.0.0
|
|
199
|
+
*
|
|
200
|
+
* @example
|
|
201
|
+
* ```typescript
|
|
202
|
+
* const styles: StyleOverrides = {
|
|
203
|
+
* className: 'custom-section',
|
|
204
|
+
* tailwindClasses: 'bg-gray-100 p-4 rounded-lg'
|
|
205
|
+
* };
|
|
206
|
+
* ```
|
|
207
|
+
*
|
|
208
|
+
* Powered by Nikkory
|
|
209
|
+
*/
|
|
210
|
+
export interface GranularityStyleOverrides {
|
|
211
|
+
readonly className?: string;
|
|
212
|
+
readonly style?: Record<string, string>;
|
|
213
|
+
readonly tailwindClasses?: string;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Factor values map - key-value pairs for resolved factors
|
|
217
|
+
*
|
|
218
|
+
* @category types
|
|
219
|
+
* @since 4.0.0
|
|
220
|
+
*
|
|
221
|
+
* @example
|
|
222
|
+
* ```typescript
|
|
223
|
+
* const factors: FactorValues = {
|
|
224
|
+
* spacing: 'md',
|
|
225
|
+
* colorPrimary: '#3B82F6',
|
|
226
|
+
* borderRadius: 'lg'
|
|
227
|
+
* };
|
|
228
|
+
* ```
|
|
229
|
+
*
|
|
230
|
+
* Powered by Nikkory
|
|
231
|
+
*/
|
|
232
|
+
export type GranularityFactorValues = Record<string, unknown>;
|
|
233
|
+
/**
|
|
234
|
+
* Base fields shared by ALL granularity levels
|
|
235
|
+
*
|
|
236
|
+
* This interface defines the common fields that every granularity
|
|
237
|
+
* config must have, regardless of whether it's an atom, component,
|
|
238
|
+
* section, page, layout, or template.
|
|
239
|
+
*
|
|
240
|
+
* @category types
|
|
241
|
+
* @since 4.0.0
|
|
242
|
+
*
|
|
243
|
+
* @typeParam G - The granularity level this config is for
|
|
244
|
+
*
|
|
245
|
+
* @example
|
|
246
|
+
* ```typescript
|
|
247
|
+
* interface MySectionConfig extends GranularityBaseFields<'section'> {
|
|
248
|
+
* customField: string;
|
|
249
|
+
* }
|
|
250
|
+
* ```
|
|
251
|
+
*
|
|
252
|
+
* Powered by Nikkory
|
|
253
|
+
*/
|
|
254
|
+
export interface GranularityBaseFields<G extends GranularityLevel> {
|
|
255
|
+
/** Unique identifier */
|
|
256
|
+
readonly id: string;
|
|
257
|
+
/** Granularity level */
|
|
258
|
+
readonly granularity: G;
|
|
259
|
+
/** Design system */
|
|
260
|
+
readonly designSystem: DesignSystem;
|
|
261
|
+
/** Quality tier */
|
|
262
|
+
readonly tier: Tier;
|
|
263
|
+
/** Display title */
|
|
264
|
+
readonly title: string;
|
|
265
|
+
/** Optional subtitle/description */
|
|
266
|
+
readonly subtitle?: string;
|
|
267
|
+
}
|
|
268
|
+
//# sourceMappingURL=base.types.d.ts.map
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Granularity Configuration Types
|
|
3
|
+
*
|
|
4
|
+
* This file defines the GranularityConfig<G> generic interface that replaces
|
|
5
|
+
* separate SectionConfig, PageConfig, LayoutConfig, and TemplateConfig types.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
* @module types/granularity
|
|
9
|
+
* @since 4.0.0
|
|
10
|
+
*
|
|
11
|
+
* Powered by Nikkory
|
|
12
|
+
*/
|
|
13
|
+
import type { GranularityLevel, GranularityBaseFields, GranularityLayoutConfig, GranularityStyleOverrides, GranularityFactorValues } from './base.types';
|
|
14
|
+
import type { GranularitySlotConfig } from './slot.types';
|
|
15
|
+
/**
|
|
16
|
+
* Child reference for recursive generation
|
|
17
|
+
*
|
|
18
|
+
* Allows a parent granularity to reference child granularities,
|
|
19
|
+
* enabling recursive generation: Page → Sections → Components.
|
|
20
|
+
*
|
|
21
|
+
* @category types
|
|
22
|
+
* @since 4.0.0
|
|
23
|
+
*
|
|
24
|
+
* @typeParam _G - The parent granularity level (prefixed with _ as intentionally unused)
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
* // Page referencing sections
|
|
29
|
+
* const child: ChildReference<'page'> = {
|
|
30
|
+
* childGranularity: 'section',
|
|
31
|
+
* ref: 'hero-section-id',
|
|
32
|
+
* slot: 'main',
|
|
33
|
+
* factorOverrides: { spacing: 'lg' }
|
|
34
|
+
* };
|
|
35
|
+
*
|
|
36
|
+
* // Inline config instead of reference
|
|
37
|
+
* const inlineChild: ChildReference<'page'> = {
|
|
38
|
+
* childGranularity: 'section',
|
|
39
|
+
* ref: {
|
|
40
|
+
* id: 'inline-section',
|
|
41
|
+
* granularity: 'section',
|
|
42
|
+
* designSystem: 'material-design',
|
|
43
|
+
* tier: 'standard',
|
|
44
|
+
* title: 'Inline Section'
|
|
45
|
+
* },
|
|
46
|
+
* slot: 'main'
|
|
47
|
+
* };
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* Powered by Nikkory
|
|
51
|
+
*/
|
|
52
|
+
export interface ChildReference<_G extends GranularityLevel> {
|
|
53
|
+
/** Child granularity level */
|
|
54
|
+
readonly childGranularity: GranularityLevel;
|
|
55
|
+
/** Child ID (string) or inline config */
|
|
56
|
+
readonly ref: string | GranularityConfig<GranularityLevel>;
|
|
57
|
+
/** Slot to place child in */
|
|
58
|
+
readonly slot: string;
|
|
59
|
+
/** Factor overrides for this child (highest priority) */
|
|
60
|
+
readonly factorOverrides?: GranularityFactorValues;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* GranularityConfig<G> - THE unified generic config interface
|
|
64
|
+
*
|
|
65
|
+
* This interface replaces separate SectionConfig, PageConfig, LayoutConfig,
|
|
66
|
+
* and TemplateConfig types with a single generic that works for all 6
|
|
67
|
+
* granularity levels.
|
|
68
|
+
*
|
|
69
|
+
* @category types
|
|
70
|
+
* @since 4.0.0
|
|
71
|
+
*
|
|
72
|
+
* @typeParam G - The granularity level this config is for
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```typescript
|
|
76
|
+
* // Section configuration
|
|
77
|
+
* const sectionConfig: GranularityConfig<'section'> = {
|
|
78
|
+
* id: 'hero-section',
|
|
79
|
+
* granularity: 'section',
|
|
80
|
+
* designSystem: 'material-design',
|
|
81
|
+
* tier: 'enterprise',
|
|
82
|
+
* title: 'Hero Section',
|
|
83
|
+
* subtitle: 'Main landing hero with CTA',
|
|
84
|
+
* layout: { type: 'flex', alignment: 'center' },
|
|
85
|
+
* factors: { spacing: 'lg', colorPrimary: '#3B82F6' }
|
|
86
|
+
* };
|
|
87
|
+
*
|
|
88
|
+
* // Page configuration with children
|
|
89
|
+
* const pageConfig: GranularityConfig<'page'> = {
|
|
90
|
+
* id: 'landing-page',
|
|
91
|
+
* granularity: 'page',
|
|
92
|
+
* designSystem: 'material-design',
|
|
93
|
+
* tier: 'enterprise',
|
|
94
|
+
* title: 'Landing Page',
|
|
95
|
+
* children: [
|
|
96
|
+
* { childGranularity: 'section', ref: 'hero-section', slot: 'main' },
|
|
97
|
+
* { childGranularity: 'section', ref: 'features-section', slot: 'main' }
|
|
98
|
+
* ]
|
|
99
|
+
* };
|
|
100
|
+
* ```
|
|
101
|
+
*
|
|
102
|
+
* Powered by Nikkory
|
|
103
|
+
*/
|
|
104
|
+
export interface GranularityConfig<G extends GranularityLevel> extends GranularityBaseFields<G> {
|
|
105
|
+
/** Layout configuration for arranging children */
|
|
106
|
+
readonly layout?: GranularityLayoutConfig;
|
|
107
|
+
/** Slots for child granularities (level-specific positions) */
|
|
108
|
+
readonly slots?: readonly GranularitySlotConfig<G>[];
|
|
109
|
+
/** Factors applicable at this level (resolved dynamically) */
|
|
110
|
+
readonly factors?: GranularityFactorValues;
|
|
111
|
+
/** Children references (for recursive generation) */
|
|
112
|
+
readonly children?: readonly ChildReference<G>[];
|
|
113
|
+
/** Style overrides for customization */
|
|
114
|
+
readonly styleOverrides?: GranularityStyleOverrides;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* AtomConfig - Configuration for atom-level components
|
|
118
|
+
*
|
|
119
|
+
* @category types
|
|
120
|
+
* @since 4.0.0
|
|
121
|
+
*
|
|
122
|
+
* Powered by Nikkory
|
|
123
|
+
*/
|
|
124
|
+
export type AtomConfig = GranularityConfig<'atom'>;
|
|
125
|
+
/**
|
|
126
|
+
* ComponentConfig - Configuration for component-level elements
|
|
127
|
+
*
|
|
128
|
+
* @category types
|
|
129
|
+
* @since 4.0.0
|
|
130
|
+
*
|
|
131
|
+
* Powered by Nikkory
|
|
132
|
+
*/
|
|
133
|
+
export type ComponentConfig = GranularityConfig<'component'>;
|
|
134
|
+
/**
|
|
135
|
+
* SectionGranularityConfig - Configuration for section-level elements
|
|
136
|
+
*
|
|
137
|
+
* Note: Named SectionGranularityConfig to avoid conflict with
|
|
138
|
+
* existing SectionConfig in section.types.ts. Use GranularityConfig<'section'>
|
|
139
|
+
* for the unified approach.
|
|
140
|
+
*
|
|
141
|
+
* @category types
|
|
142
|
+
* @since 4.0.0
|
|
143
|
+
*
|
|
144
|
+
* Powered by Nikkory
|
|
145
|
+
*/
|
|
146
|
+
export type SectionGranularityConfig = GranularityConfig<'section'>;
|
|
147
|
+
/**
|
|
148
|
+
* PageConfig - Configuration for page-level elements
|
|
149
|
+
*
|
|
150
|
+
* @category types
|
|
151
|
+
* @since 4.0.0
|
|
152
|
+
*
|
|
153
|
+
* Powered by Nikkory
|
|
154
|
+
*/
|
|
155
|
+
export type PageConfig = GranularityConfig<'page'>;
|
|
156
|
+
/**
|
|
157
|
+
* LayoutGranularityConfig - Configuration for layout-level elements
|
|
158
|
+
*
|
|
159
|
+
* Note: Named LayoutGranularityConfig to avoid conflict with
|
|
160
|
+
* existing LayoutConfig in base.types.ts.
|
|
161
|
+
*
|
|
162
|
+
* @category types
|
|
163
|
+
* @since 4.0.0
|
|
164
|
+
*
|
|
165
|
+
* Powered by Nikkory
|
|
166
|
+
*/
|
|
167
|
+
export type LayoutGranularityConfig = GranularityConfig<'layout'>;
|
|
168
|
+
/**
|
|
169
|
+
* TemplateConfig - Configuration for template-level elements
|
|
170
|
+
*
|
|
171
|
+
* @category types
|
|
172
|
+
* @since 4.0.0
|
|
173
|
+
*
|
|
174
|
+
* Powered by Nikkory
|
|
175
|
+
*/
|
|
176
|
+
export type TemplateConfig = GranularityConfig<'template'>;
|
|
177
|
+
//# sourceMappingURL=config.types.d.ts.map
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Factor Types for Unified Granularity Architecture
|
|
3
|
+
*
|
|
4
|
+
* This file defines additional factor-related types that support
|
|
5
|
+
* the dynamic factor resolution and cascade system.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
* @module types/granularity
|
|
9
|
+
* @since 4.0.0
|
|
10
|
+
*
|
|
11
|
+
* Powered by Nikkory
|
|
12
|
+
*/
|
|
13
|
+
import type { GranularityLevel, GranularityFactorCategory, GranularityFactorDefinition } from './base.types';
|
|
14
|
+
import type { DesignSystem } from '../../../types';
|
|
15
|
+
/**
|
|
16
|
+
* Factor resolution result from getFactorsForLevel()
|
|
17
|
+
*
|
|
18
|
+
* Contains both the factor definitions and resolved values
|
|
19
|
+
* for a specific granularity level.
|
|
20
|
+
*
|
|
21
|
+
* @category types
|
|
22
|
+
* @since 4.0.0
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* const result: FactorResolutionResult = {
|
|
27
|
+
* level: 'section',
|
|
28
|
+
* factors: [spacingFactor, colorFactor, ...],
|
|
29
|
+
* resolvedValues: {
|
|
30
|
+
* spacing: 'md',
|
|
31
|
+
* colorPrimary: '#3B82F6'
|
|
32
|
+
* },
|
|
33
|
+
* cascadedFrom: ['template', 'page']
|
|
34
|
+
* };
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* Powered by Nikkory
|
|
38
|
+
*/
|
|
39
|
+
export interface GranularityFactorResolutionResult {
|
|
40
|
+
/** The granularity level these factors are for */
|
|
41
|
+
readonly level: GranularityLevel;
|
|
42
|
+
/** All applicable factor definitions */
|
|
43
|
+
readonly factors: readonly GranularityFactorDefinition[];
|
|
44
|
+
/** Resolved factor values */
|
|
45
|
+
readonly resolvedValues: Record<string, unknown>;
|
|
46
|
+
/** Levels from which factors were cascaded */
|
|
47
|
+
readonly cascadedFrom: readonly GranularityLevel[];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Factor override configuration
|
|
51
|
+
*
|
|
52
|
+
* Allows specifying overrides that take priority over
|
|
53
|
+
* cascaded or default factor values.
|
|
54
|
+
*
|
|
55
|
+
* @category types
|
|
56
|
+
* @since 4.0.0
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```typescript
|
|
60
|
+
* const override: FactorOverride = {
|
|
61
|
+
* factorId: 'spacing',
|
|
62
|
+
* value: 'xl',
|
|
63
|
+
* priority: 100,
|
|
64
|
+
* source: 'user'
|
|
65
|
+
* };
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* Powered by Nikkory
|
|
69
|
+
*/
|
|
70
|
+
export interface GranularityFactorOverride {
|
|
71
|
+
/** Factor identifier */
|
|
72
|
+
readonly factorId: string;
|
|
73
|
+
/** Override value */
|
|
74
|
+
readonly value: unknown;
|
|
75
|
+
/** Priority (higher wins) */
|
|
76
|
+
readonly priority: number;
|
|
77
|
+
/** Source of override */
|
|
78
|
+
readonly source: 'default' | 'cascade' | 'config' | 'user';
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Options for querying factors
|
|
82
|
+
*
|
|
83
|
+
* @category types
|
|
84
|
+
* @since 4.0.0
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```typescript
|
|
88
|
+
* const options: FactorQueryOptions = {
|
|
89
|
+
* level: 'section',
|
|
90
|
+
* designSystem: 'material-design',
|
|
91
|
+
* includeInherited: true,
|
|
92
|
+
* categories: ['visual', 'layout']
|
|
93
|
+
* };
|
|
94
|
+
* ```
|
|
95
|
+
*
|
|
96
|
+
* Powered by Nikkory
|
|
97
|
+
*/
|
|
98
|
+
export interface GranularityFactorQueryOptions {
|
|
99
|
+
/** Target granularity level */
|
|
100
|
+
readonly level: GranularityLevel;
|
|
101
|
+
/** Design system for default values */
|
|
102
|
+
readonly designSystem?: DesignSystem;
|
|
103
|
+
/** Whether to include inherited factors from higher levels */
|
|
104
|
+
readonly includeInherited?: boolean;
|
|
105
|
+
/** Filter by specific categories */
|
|
106
|
+
readonly categories?: readonly GranularityFactorCategory[];
|
|
107
|
+
/** Filter by specific factor IDs */
|
|
108
|
+
readonly factorIds?: readonly string[];
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Factor cascade configuration
|
|
112
|
+
*
|
|
113
|
+
* Controls how factors cascade from parent to child levels.
|
|
114
|
+
*
|
|
115
|
+
* @category types
|
|
116
|
+
* @since 4.0.0
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```typescript
|
|
120
|
+
* const cascade: FactorCascadeConfig = {
|
|
121
|
+
* parentLevel: 'page',
|
|
122
|
+
* childLevel: 'section',
|
|
123
|
+
* parentFactors: { spacing: 'lg', theme: 'dark' },
|
|
124
|
+
* overrides: { spacing: 'md' }
|
|
125
|
+
* };
|
|
126
|
+
* ```
|
|
127
|
+
*
|
|
128
|
+
* Powered by Nikkory
|
|
129
|
+
*/
|
|
130
|
+
export interface GranularityFactorCascadeConfig {
|
|
131
|
+
/** Parent granularity level */
|
|
132
|
+
readonly parentLevel: GranularityLevel;
|
|
133
|
+
/** Child granularity level */
|
|
134
|
+
readonly childLevel: GranularityLevel;
|
|
135
|
+
/** Factor values from parent */
|
|
136
|
+
readonly parentFactors: Record<string, unknown>;
|
|
137
|
+
/** Child-specific overrides (highest priority) */
|
|
138
|
+
readonly overrides?: Record<string, unknown>;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Create a factor definition with type safety
|
|
142
|
+
*
|
|
143
|
+
* @category utils
|
|
144
|
+
* @since 4.0.0
|
|
145
|
+
*
|
|
146
|
+
* @param definition - Partial factor definition
|
|
147
|
+
* @returns Complete factor definition with defaults
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```typescript
|
|
151
|
+
* const factor = createFactorDefinition({
|
|
152
|
+
* id: 'spacing',
|
|
153
|
+
* name: 'Spacing',
|
|
154
|
+
* category: 'layout',
|
|
155
|
+
* level: 'template',
|
|
156
|
+
* cascadeDown: true,
|
|
157
|
+
* options: ['xs', 'sm', 'md', 'lg', 'xl'],
|
|
158
|
+
* description: 'Controls spacing between elements'
|
|
159
|
+
* });
|
|
160
|
+
* ```
|
|
161
|
+
*
|
|
162
|
+
* Powered by Nikkory
|
|
163
|
+
*/
|
|
164
|
+
export declare function createGranularityFactorDefinition(definition: Omit<GranularityFactorDefinition, 'defaults'> & {
|
|
165
|
+
defaults?: Partial<Record<DesignSystem, unknown>>;
|
|
166
|
+
}): GranularityFactorDefinition;
|
|
167
|
+
/**
|
|
168
|
+
* Standard priority levels for factor resolution
|
|
169
|
+
*
|
|
170
|
+
* @category constants
|
|
171
|
+
* @since 4.0.0
|
|
172
|
+
*
|
|
173
|
+
* Powered by Nikkory
|
|
174
|
+
*/
|
|
175
|
+
export declare const FACTOR_PRIORITY: {
|
|
176
|
+
/** Default values from design system */
|
|
177
|
+
readonly DEFAULT: 0;
|
|
178
|
+
/** Values cascaded from parent levels */
|
|
179
|
+
readonly CASCADE: 25;
|
|
180
|
+
/** Values from config/template */
|
|
181
|
+
readonly CONFIG: 50;
|
|
182
|
+
/** Values explicitly set by user */
|
|
183
|
+
readonly USER: 100;
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* Factor priority type
|
|
187
|
+
*
|
|
188
|
+
* @category types
|
|
189
|
+
* @since 4.0.0
|
|
190
|
+
*
|
|
191
|
+
* Powered by Nikkory
|
|
192
|
+
*/
|
|
193
|
+
export type GranularityFactorPriority = (typeof FACTOR_PRIORITY)[keyof typeof FACTOR_PRIORITY];
|
|
194
|
+
//# sourceMappingURL=factors.types.d.ts.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified Granularity Architecture Types
|
|
3
|
+
*
|
|
4
|
+
* This module exports all types for the 6-level granularity system:
|
|
5
|
+
* - GranularityLevel: atom, component, section, page, layout, template
|
|
6
|
+
* - GranularityConfig<G>: Generic config for any level
|
|
7
|
+
* - GranularityTemplate<G>: Config + 8 metadata fields
|
|
8
|
+
* - GranularitySlotConfig<G>: Child placement configuration
|
|
9
|
+
* - GranularityFactorDefinition: Factor with level and cascadeDown
|
|
10
|
+
*
|
|
11
|
+
* @packageDocumentation
|
|
12
|
+
* @module types/granularity
|
|
13
|
+
* @since 4.0.0
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import type {
|
|
18
|
+
* GranularityLevel,
|
|
19
|
+
* GranularityConfig,
|
|
20
|
+
* GranularityTemplate,
|
|
21
|
+
* GranularitySlotConfig,
|
|
22
|
+
* GranularityFactorDefinition
|
|
23
|
+
* } from '@nikkory/engine';
|
|
24
|
+
*
|
|
25
|
+
* // Create a section config
|
|
26
|
+
* const section: GranularityConfig<'section'> = {
|
|
27
|
+
* id: 'hero',
|
|
28
|
+
* granularity: 'section',
|
|
29
|
+
* designSystem: 'material-design',
|
|
30
|
+
* tier: 'enterprise',
|
|
31
|
+
* title: 'Hero Section'
|
|
32
|
+
* };
|
|
33
|
+
*
|
|
34
|
+
* // Create a page template
|
|
35
|
+
* const template: GranularityTemplate<'page'> = {
|
|
36
|
+
* ...pageConfig,
|
|
37
|
+
* templateId: 'landing-v1',
|
|
38
|
+
* templateName: 'Landing Page',
|
|
39
|
+
* description: 'Modern landing page template',
|
|
40
|
+
* author: 'Nikkory',
|
|
41
|
+
* version: '1.0.0',
|
|
42
|
+
* tags: ['landing', 'marketing'],
|
|
43
|
+
* visibility: 'public'
|
|
44
|
+
* };
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* Powered by Nikkory
|
|
48
|
+
*/
|
|
49
|
+
export type { GranularityLevel, GranularityFactorCategory, GranularityFactorDefinition, GranularityBaseFields, GranularityTemplateVisibility, GranularityLayoutConfig, GranularitySpacingLevel, GranularityAlignmentType, GranularityStyleOverrides, GranularityFactorValues, } from './base.types';
|
|
50
|
+
export { GRANULARITY_HIERARCHY, getGranularityRank } from './base.types';
|
|
51
|
+
export type { ChildReference, GranularityConfig, AtomConfig, ComponentConfig, SectionGranularityConfig, PageConfig, LayoutGranularityConfig, TemplateConfig, } from './config.types';
|
|
52
|
+
export type { GranularityTemplateMetadata, GranularityTemplate, AtomTemplate, ComponentTemplate, SectionGranularityTemplate, PageTemplate, LayoutTemplate, TemplateGranularityTemplate, } from './template.types';
|
|
53
|
+
export type { GranularitySlotPosition, GranularitySlotConfig } from './slot.types';
|
|
54
|
+
export { DEFAULT_PAGE_SLOTS, DEFAULT_SECTION_SLOTS, getDefaultSlots } from './slot.types';
|
|
55
|
+
export type { GranularityFactorResolutionResult, GranularityFactorOverride, GranularityFactorQueryOptions, GranularityFactorCascadeConfig, GranularityFactorPriority, } from './factors.types';
|
|
56
|
+
export { FACTOR_PRIORITY, createGranularityFactorDefinition } from './factors.types';
|
|
57
|
+
//# sourceMappingURL=index.d.ts.map
|