@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,486 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Design Token Schema
|
|
3
|
+
*
|
|
4
|
+
* Defines the complete structure for design system tokens.
|
|
5
|
+
* This schema is the foundation of the Dynamic Matrix architecture,
|
|
6
|
+
* enabling infinite design system variations from a single token configuration.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
* @module tokens/schema
|
|
10
|
+
* @since 2.0.0
|
|
11
|
+
*
|
|
12
|
+
* Powered by Nikkory
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Color scale with 10 shades from lightest (50) to darkest (900/950)
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const primaryColor: ColorScale = {
|
|
20
|
+
* 50: '#F3E5F5',
|
|
21
|
+
* 100: '#E1BEE7',
|
|
22
|
+
* // ...
|
|
23
|
+
* 500: '#6750A4', // Primary shade
|
|
24
|
+
* // ...
|
|
25
|
+
* 900: '#4527A0',
|
|
26
|
+
* };
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export interface ColorScale {
|
|
30
|
+
readonly 50: string;
|
|
31
|
+
readonly 100: string;
|
|
32
|
+
readonly 200: string;
|
|
33
|
+
readonly 300: string;
|
|
34
|
+
readonly 400: string;
|
|
35
|
+
readonly 500: string;
|
|
36
|
+
readonly 600: string;
|
|
37
|
+
readonly 700: string;
|
|
38
|
+
readonly 800: string;
|
|
39
|
+
readonly 900: string;
|
|
40
|
+
readonly 950?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Semantic color palette for consistent meaning across the application
|
|
44
|
+
*/
|
|
45
|
+
export interface SemanticColors {
|
|
46
|
+
/** Primary brand color */
|
|
47
|
+
readonly primary: ColorScale;
|
|
48
|
+
/** Secondary brand color */
|
|
49
|
+
readonly secondary: ColorScale;
|
|
50
|
+
/** Accent color for highlights */
|
|
51
|
+
readonly accent: ColorScale;
|
|
52
|
+
/** Neutral gray tones */
|
|
53
|
+
readonly neutral: ColorScale;
|
|
54
|
+
/** Success/positive states */
|
|
55
|
+
readonly success: ColorScale;
|
|
56
|
+
/** Warning states */
|
|
57
|
+
readonly warning: ColorScale;
|
|
58
|
+
/** Error/destructive states */
|
|
59
|
+
readonly error: ColorScale;
|
|
60
|
+
/** Informational states */
|
|
61
|
+
readonly info: ColorScale;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Surface colors for backgrounds, text, and borders
|
|
65
|
+
*/
|
|
66
|
+
export interface SurfaceColors {
|
|
67
|
+
/** Background color variants */
|
|
68
|
+
readonly background: {
|
|
69
|
+
readonly default: string;
|
|
70
|
+
readonly paper: string;
|
|
71
|
+
readonly elevated: string;
|
|
72
|
+
readonly overlay: string;
|
|
73
|
+
};
|
|
74
|
+
/** Foreground/text color variants */
|
|
75
|
+
readonly foreground: {
|
|
76
|
+
readonly default: string;
|
|
77
|
+
readonly muted: string;
|
|
78
|
+
readonly subtle: string;
|
|
79
|
+
readonly disabled: string;
|
|
80
|
+
readonly inverse: string;
|
|
81
|
+
};
|
|
82
|
+
/** Border color variants */
|
|
83
|
+
readonly border: {
|
|
84
|
+
readonly default: string;
|
|
85
|
+
readonly muted: string;
|
|
86
|
+
readonly strong: string;
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Complete color token structure
|
|
91
|
+
*/
|
|
92
|
+
export interface ColorTokens {
|
|
93
|
+
readonly semantic: SemanticColors;
|
|
94
|
+
readonly surface: SurfaceColors;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Spacing scale following Tailwind-like conventions
|
|
98
|
+
* Keys are numeric multipliers (1 = 0.25rem = 4px)
|
|
99
|
+
*/
|
|
100
|
+
export interface SpacingScale {
|
|
101
|
+
readonly 0: string;
|
|
102
|
+
readonly px: string;
|
|
103
|
+
readonly 0.5: string;
|
|
104
|
+
readonly 1: string;
|
|
105
|
+
readonly 1.5: string;
|
|
106
|
+
readonly 2: string;
|
|
107
|
+
readonly 2.5: string;
|
|
108
|
+
readonly 3: string;
|
|
109
|
+
readonly 3.5: string;
|
|
110
|
+
readonly 4: string;
|
|
111
|
+
readonly 5: string;
|
|
112
|
+
readonly 6: string;
|
|
113
|
+
readonly 7: string;
|
|
114
|
+
readonly 8: string;
|
|
115
|
+
readonly 9: string;
|
|
116
|
+
readonly 10: string;
|
|
117
|
+
readonly 11: string;
|
|
118
|
+
readonly 12: string;
|
|
119
|
+
readonly 14: string;
|
|
120
|
+
readonly 16: string;
|
|
121
|
+
readonly 20: string;
|
|
122
|
+
readonly 24: string;
|
|
123
|
+
readonly 28: string;
|
|
124
|
+
readonly 32: string;
|
|
125
|
+
readonly 36: string;
|
|
126
|
+
readonly 40: string;
|
|
127
|
+
readonly 44: string;
|
|
128
|
+
readonly 48: string;
|
|
129
|
+
readonly 52: string;
|
|
130
|
+
readonly 56: string;
|
|
131
|
+
readonly 60: string;
|
|
132
|
+
readonly 64: string;
|
|
133
|
+
readonly 72: string;
|
|
134
|
+
readonly 80: string;
|
|
135
|
+
readonly 96: string;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Component size tokens (xs to 3xl)
|
|
139
|
+
*/
|
|
140
|
+
export interface SizeTokens {
|
|
141
|
+
readonly xs: string;
|
|
142
|
+
readonly sm: string;
|
|
143
|
+
readonly md: string;
|
|
144
|
+
readonly lg: string;
|
|
145
|
+
readonly xl: string;
|
|
146
|
+
readonly '2xl'?: string;
|
|
147
|
+
readonly '3xl'?: string;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Font family definitions
|
|
151
|
+
*/
|
|
152
|
+
export interface FontFamilyTokens {
|
|
153
|
+
/** Sans-serif font stack */
|
|
154
|
+
readonly sans: string;
|
|
155
|
+
/** Serif font stack */
|
|
156
|
+
readonly serif: string;
|
|
157
|
+
/** Monospace font stack */
|
|
158
|
+
readonly mono: string;
|
|
159
|
+
/** Display/heading font (optional) */
|
|
160
|
+
readonly display?: string;
|
|
161
|
+
/** Handwriting/script font (optional) */
|
|
162
|
+
readonly handwriting?: string;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Font size scale
|
|
166
|
+
*/
|
|
167
|
+
export interface FontSizeTokens {
|
|
168
|
+
readonly xs: string;
|
|
169
|
+
readonly sm: string;
|
|
170
|
+
readonly base: string;
|
|
171
|
+
readonly lg: string;
|
|
172
|
+
readonly xl: string;
|
|
173
|
+
readonly '2xl': string;
|
|
174
|
+
readonly '3xl': string;
|
|
175
|
+
readonly '4xl': string;
|
|
176
|
+
readonly '5xl': string;
|
|
177
|
+
readonly '6xl': string;
|
|
178
|
+
readonly '7xl': string;
|
|
179
|
+
readonly '8xl': string;
|
|
180
|
+
readonly '9xl': string;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Font weight scale (100-900)
|
|
184
|
+
*/
|
|
185
|
+
export interface FontWeightTokens {
|
|
186
|
+
readonly thin: number;
|
|
187
|
+
readonly extralight: number;
|
|
188
|
+
readonly light: number;
|
|
189
|
+
readonly normal: number;
|
|
190
|
+
readonly medium: number;
|
|
191
|
+
readonly semibold: number;
|
|
192
|
+
readonly bold: number;
|
|
193
|
+
readonly extrabold: number;
|
|
194
|
+
readonly black: number;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Line height scale
|
|
198
|
+
*/
|
|
199
|
+
export interface LineHeightTokens {
|
|
200
|
+
readonly none: number;
|
|
201
|
+
readonly tight: number;
|
|
202
|
+
readonly snug: number;
|
|
203
|
+
readonly normal: number;
|
|
204
|
+
readonly relaxed: number;
|
|
205
|
+
readonly loose: number;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Letter spacing scale
|
|
209
|
+
*/
|
|
210
|
+
export interface LetterSpacingTokens {
|
|
211
|
+
readonly tighter: string;
|
|
212
|
+
readonly tight: string;
|
|
213
|
+
readonly normal: string;
|
|
214
|
+
readonly wide: string;
|
|
215
|
+
readonly wider: string;
|
|
216
|
+
readonly widest: string;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Complete typography token structure
|
|
220
|
+
*/
|
|
221
|
+
export interface TypographyTokens {
|
|
222
|
+
readonly fontFamily: FontFamilyTokens;
|
|
223
|
+
readonly fontSize: FontSizeTokens;
|
|
224
|
+
readonly fontWeight: FontWeightTokens;
|
|
225
|
+
readonly lineHeight: LineHeightTokens;
|
|
226
|
+
readonly letterSpacing: LetterSpacingTokens;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Border radius scale
|
|
230
|
+
*/
|
|
231
|
+
export interface BorderRadiusTokens {
|
|
232
|
+
readonly none: string;
|
|
233
|
+
readonly sm: string;
|
|
234
|
+
readonly base: string;
|
|
235
|
+
readonly md: string;
|
|
236
|
+
readonly lg: string;
|
|
237
|
+
readonly xl: string;
|
|
238
|
+
readonly '2xl': string;
|
|
239
|
+
readonly '3xl': string;
|
|
240
|
+
readonly full: string;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Border width scale
|
|
244
|
+
*/
|
|
245
|
+
export interface BorderWidthTokens {
|
|
246
|
+
readonly 0: string;
|
|
247
|
+
readonly 1: string;
|
|
248
|
+
readonly 2: string;
|
|
249
|
+
readonly 4: string;
|
|
250
|
+
readonly 8: string;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Border style type
|
|
254
|
+
*/
|
|
255
|
+
export type BorderStyle = 'solid' | 'dashed' | 'dotted' | 'double' | 'none';
|
|
256
|
+
/**
|
|
257
|
+
* Complete border token structure
|
|
258
|
+
*/
|
|
259
|
+
export interface BorderTokens {
|
|
260
|
+
readonly radius: BorderRadiusTokens;
|
|
261
|
+
readonly width: BorderWidthTokens;
|
|
262
|
+
readonly style: BorderStyle;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Shadow token scale with design-system-specific variants
|
|
266
|
+
*/
|
|
267
|
+
export interface ShadowTokens {
|
|
268
|
+
readonly none: string;
|
|
269
|
+
readonly sm: string;
|
|
270
|
+
readonly base: string;
|
|
271
|
+
readonly md: string;
|
|
272
|
+
readonly lg: string;
|
|
273
|
+
readonly xl: string;
|
|
274
|
+
readonly '2xl': string;
|
|
275
|
+
readonly inner: string;
|
|
276
|
+
/** Glow effect shadow (Cyberpunk) */
|
|
277
|
+
readonly glow?: string;
|
|
278
|
+
/** Sharp offset shadow (Brutalism) */
|
|
279
|
+
readonly sharp?: string;
|
|
280
|
+
/** Soft outer shadow (Neumorphism) */
|
|
281
|
+
readonly soft?: string;
|
|
282
|
+
/** Soft inset shadow for pressed state (Neumorphism) */
|
|
283
|
+
readonly softInset?: string;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Animation duration scale
|
|
287
|
+
*/
|
|
288
|
+
export interface DurationTokens {
|
|
289
|
+
readonly 0: string;
|
|
290
|
+
readonly 75: string;
|
|
291
|
+
readonly 100: string;
|
|
292
|
+
readonly 150: string;
|
|
293
|
+
readonly 200: string;
|
|
294
|
+
readonly 300: string;
|
|
295
|
+
readonly 500: string;
|
|
296
|
+
readonly 700: string;
|
|
297
|
+
readonly 1000: string;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Animation easing functions
|
|
301
|
+
*/
|
|
302
|
+
export interface EasingTokens {
|
|
303
|
+
readonly linear: string;
|
|
304
|
+
readonly in: string;
|
|
305
|
+
readonly out: string;
|
|
306
|
+
readonly inOut: string;
|
|
307
|
+
readonly bounce?: string;
|
|
308
|
+
readonly elastic?: string;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Complete animation token structure
|
|
312
|
+
*/
|
|
313
|
+
export interface AnimationTokens {
|
|
314
|
+
readonly duration: DurationTokens;
|
|
315
|
+
readonly easing: EasingTokens;
|
|
316
|
+
/** Whether to respect prefers-reduced-motion */
|
|
317
|
+
readonly respectMotionPreference: boolean;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Blur effect scale
|
|
321
|
+
*/
|
|
322
|
+
export interface BlurTokens {
|
|
323
|
+
readonly none: string;
|
|
324
|
+
readonly sm: string;
|
|
325
|
+
readonly base: string;
|
|
326
|
+
readonly md: string;
|
|
327
|
+
readonly lg: string;
|
|
328
|
+
readonly xl: string;
|
|
329
|
+
readonly '2xl': string;
|
|
330
|
+
readonly '3xl': string;
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Opacity scale (0-100)
|
|
334
|
+
*/
|
|
335
|
+
export interface OpacityTokens {
|
|
336
|
+
readonly 0: number;
|
|
337
|
+
readonly 5: number;
|
|
338
|
+
readonly 10: number;
|
|
339
|
+
readonly 20: number;
|
|
340
|
+
readonly 25: number;
|
|
341
|
+
readonly 30: number;
|
|
342
|
+
readonly 40: number;
|
|
343
|
+
readonly 50: number;
|
|
344
|
+
readonly 60: number;
|
|
345
|
+
readonly 70: number;
|
|
346
|
+
readonly 75: number;
|
|
347
|
+
readonly 80: number;
|
|
348
|
+
readonly 90: number;
|
|
349
|
+
readonly 95: number;
|
|
350
|
+
readonly 100: number;
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Backdrop filter settings (for glassmorphism)
|
|
354
|
+
*/
|
|
355
|
+
export interface BackdropTokens {
|
|
356
|
+
readonly blur: string;
|
|
357
|
+
readonly saturate: string;
|
|
358
|
+
readonly brightness: string;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Gradient definitions
|
|
362
|
+
*/
|
|
363
|
+
export interface GradientTokens {
|
|
364
|
+
readonly primary: string;
|
|
365
|
+
readonly secondary: string;
|
|
366
|
+
readonly accent: string;
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Complete effect token structure
|
|
370
|
+
*/
|
|
371
|
+
export interface EffectTokens {
|
|
372
|
+
readonly blur: BlurTokens;
|
|
373
|
+
readonly opacity: OpacityTokens;
|
|
374
|
+
readonly backdrop?: BackdropTokens;
|
|
375
|
+
readonly gradient?: GradientTokens;
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Z-index scale for layering
|
|
379
|
+
*/
|
|
380
|
+
export interface ZIndexTokens {
|
|
381
|
+
readonly auto: string;
|
|
382
|
+
readonly 0: number;
|
|
383
|
+
readonly 10: number;
|
|
384
|
+
readonly 20: number;
|
|
385
|
+
readonly 30: number;
|
|
386
|
+
readonly 40: number;
|
|
387
|
+
readonly 50: number;
|
|
388
|
+
readonly dropdown: number;
|
|
389
|
+
readonly sticky: number;
|
|
390
|
+
readonly fixed: number;
|
|
391
|
+
readonly modalBackdrop: number;
|
|
392
|
+
readonly modal: number;
|
|
393
|
+
readonly popover: number;
|
|
394
|
+
readonly tooltip: number;
|
|
395
|
+
readonly toast: number;
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Component-specific token overrides
|
|
399
|
+
*/
|
|
400
|
+
export interface ComponentTokens {
|
|
401
|
+
readonly background?: string;
|
|
402
|
+
readonly border?: string;
|
|
403
|
+
readonly shadow?: string;
|
|
404
|
+
readonly textColor?: string;
|
|
405
|
+
readonly padding?: Record<string, string>;
|
|
406
|
+
readonly borderRadius?: string;
|
|
407
|
+
readonly transition?: string;
|
|
408
|
+
readonly hover?: Partial<ComponentTokens>;
|
|
409
|
+
readonly active?: Partial<ComponentTokens>;
|
|
410
|
+
readonly disabled?: Partial<ComponentTokens>;
|
|
411
|
+
readonly focus?: Partial<ComponentTokens>;
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Complete Design Token Structure
|
|
415
|
+
*
|
|
416
|
+
* This interface defines all tokens for a design system.
|
|
417
|
+
* Each design system (Material, iOS, Glassmorphism, etc.) implements this interface.
|
|
418
|
+
*
|
|
419
|
+
* @example
|
|
420
|
+
* ```typescript
|
|
421
|
+
* const myTokens: DesignTokens = {
|
|
422
|
+
* id: 'my-brand',
|
|
423
|
+
* name: 'My Brand Design System',
|
|
424
|
+
* version: '1.0.0',
|
|
425
|
+
* description: 'Custom design system for My Brand',
|
|
426
|
+
* colors: { ... },
|
|
427
|
+
* spacing: { ... },
|
|
428
|
+
* // ... all other tokens
|
|
429
|
+
* };
|
|
430
|
+
* ```
|
|
431
|
+
*/
|
|
432
|
+
export interface DesignTokens {
|
|
433
|
+
/** Unique identifier for this design system */
|
|
434
|
+
readonly id: string;
|
|
435
|
+
/** Human-readable display name */
|
|
436
|
+
readonly name: string;
|
|
437
|
+
/** Semantic version */
|
|
438
|
+
readonly version: string;
|
|
439
|
+
/** Description of the design system */
|
|
440
|
+
readonly description: string;
|
|
441
|
+
/** Color tokens */
|
|
442
|
+
readonly colors: ColorTokens;
|
|
443
|
+
/** Spacing scale */
|
|
444
|
+
readonly spacing: SpacingScale;
|
|
445
|
+
/** Component sizing */
|
|
446
|
+
readonly sizes: SizeTokens;
|
|
447
|
+
/** Typography tokens */
|
|
448
|
+
readonly typography: TypographyTokens;
|
|
449
|
+
/** Border tokens */
|
|
450
|
+
readonly borders: BorderTokens;
|
|
451
|
+
/** Shadow tokens */
|
|
452
|
+
readonly shadows: ShadowTokens;
|
|
453
|
+
/** Animation tokens */
|
|
454
|
+
readonly animations: AnimationTokens;
|
|
455
|
+
/** Effect tokens */
|
|
456
|
+
readonly effects: EffectTokens;
|
|
457
|
+
/** Z-index tokens */
|
|
458
|
+
readonly zIndex: ZIndexTokens;
|
|
459
|
+
/** Component-specific overrides (optional) */
|
|
460
|
+
readonly components?: Record<string, Partial<ComponentTokens>>;
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* Type guard to check if a value is a valid ColorScale
|
|
464
|
+
*
|
|
465
|
+
* @param value - Value to check
|
|
466
|
+
* @returns True if value is a valid ColorScale
|
|
467
|
+
*/
|
|
468
|
+
export declare function isColorScale(value: unknown): value is ColorScale;
|
|
469
|
+
/**
|
|
470
|
+
* Type guard to check if a value is a valid DesignTokens object
|
|
471
|
+
*
|
|
472
|
+
* @param value - Value to check
|
|
473
|
+
* @returns True if value is a valid DesignTokens object
|
|
474
|
+
*/
|
|
475
|
+
export declare function isDesignTokens(value: unknown): value is DesignTokens;
|
|
476
|
+
/**
|
|
477
|
+
* Deep partial type for token overrides
|
|
478
|
+
*/
|
|
479
|
+
export type DeepPartial<T> = {
|
|
480
|
+
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
481
|
+
};
|
|
482
|
+
/**
|
|
483
|
+
* Partial design tokens for overrides
|
|
484
|
+
*/
|
|
485
|
+
export type PartialDesignTokens = DeepPartial<DesignTokens>;
|
|
486
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Option Type - Null Safety
|
|
3
|
+
*
|
|
4
|
+
* Represents a value that may or may not exist.
|
|
5
|
+
* Eliminates null/undefined errors at compile time.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* function findUser(id: string): Option<User> {
|
|
10
|
+
* const user = database.find(id);
|
|
11
|
+
* return Option.of(user);
|
|
12
|
+
* }
|
|
13
|
+
*
|
|
14
|
+
* const userOption = findUser('123');
|
|
15
|
+
* const userName = userOption
|
|
16
|
+
* .map(user => user.name)
|
|
17
|
+
* .getOrElse('Anonymous');
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* Powered by Nikkory
|
|
21
|
+
*/
|
|
22
|
+
export declare class Option<T> {
|
|
23
|
+
private readonly value?;
|
|
24
|
+
private constructor();
|
|
25
|
+
/**
|
|
26
|
+
* Create Option from value
|
|
27
|
+
* Returns Some if value exists, None if null/undefined
|
|
28
|
+
*
|
|
29
|
+
* @param value - Value to wrap
|
|
30
|
+
* @returns Option containing the value or None
|
|
31
|
+
*/
|
|
32
|
+
static of<T>(value?: T | null): Option<T>;
|
|
33
|
+
/**
|
|
34
|
+
* Create Some (value exists)
|
|
35
|
+
*
|
|
36
|
+
* @param value - The value
|
|
37
|
+
* @returns Option containing the value
|
|
38
|
+
*/
|
|
39
|
+
static some<T>(value: T): Option<T>;
|
|
40
|
+
/**
|
|
41
|
+
* Create None (no value)
|
|
42
|
+
*
|
|
43
|
+
* @returns Empty Option
|
|
44
|
+
*/
|
|
45
|
+
static none<T>(): Option<T>;
|
|
46
|
+
/**
|
|
47
|
+
* Check if value exists (Some)
|
|
48
|
+
*/
|
|
49
|
+
isSome(): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Check if value doesn't exist (None)
|
|
52
|
+
*/
|
|
53
|
+
isNone(): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Get the value (throws if None)
|
|
56
|
+
*
|
|
57
|
+
* @throws {Error} If Option is None
|
|
58
|
+
*/
|
|
59
|
+
get(): T;
|
|
60
|
+
/**
|
|
61
|
+
* Get value or default
|
|
62
|
+
*
|
|
63
|
+
* @param defaultValue - Value to return if None
|
|
64
|
+
*/
|
|
65
|
+
getOrElse(defaultValue: T): T;
|
|
66
|
+
/**
|
|
67
|
+
* Get value or compute default
|
|
68
|
+
*
|
|
69
|
+
* @param fn - Function to compute default value
|
|
70
|
+
*/
|
|
71
|
+
getOrElseCompute(fn: () => T): T;
|
|
72
|
+
/**
|
|
73
|
+
* Get value or throw custom error
|
|
74
|
+
*
|
|
75
|
+
* @param error - Error to throw if None
|
|
76
|
+
* @throws {E} If Option is None
|
|
77
|
+
*/
|
|
78
|
+
getOrThrow<E extends Error>(error: E): T;
|
|
79
|
+
/**
|
|
80
|
+
* Get value or null
|
|
81
|
+
*/
|
|
82
|
+
getOrNull(): T | null;
|
|
83
|
+
/**
|
|
84
|
+
* Get value or undefined
|
|
85
|
+
*/
|
|
86
|
+
getOrUndefined(): T | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* Map value if exists
|
|
89
|
+
*
|
|
90
|
+
* @param fn - Mapping function
|
|
91
|
+
* @returns New Option with mapped value or None
|
|
92
|
+
*/
|
|
93
|
+
map<U>(fn: (value: T) => U): Option<U>;
|
|
94
|
+
/**
|
|
95
|
+
* Flat map (chain) operations
|
|
96
|
+
*
|
|
97
|
+
* @param fn - Function returning an Option
|
|
98
|
+
* @returns Flattened Option
|
|
99
|
+
*/
|
|
100
|
+
flatMap<U>(fn: (value: T) => Option<U>): Option<U>;
|
|
101
|
+
/**
|
|
102
|
+
* Filter by predicate
|
|
103
|
+
*
|
|
104
|
+
* @param predicate - Test function
|
|
105
|
+
* @returns This Option if predicate passes, None otherwise
|
|
106
|
+
*/
|
|
107
|
+
filter(predicate: (value: T) => boolean): Option<T>;
|
|
108
|
+
/**
|
|
109
|
+
* Execute callback if Some
|
|
110
|
+
*
|
|
111
|
+
* @param fn - Callback function
|
|
112
|
+
* @returns This Option for chaining
|
|
113
|
+
*/
|
|
114
|
+
onSome(fn: (value: T) => void): Option<T>;
|
|
115
|
+
/**
|
|
116
|
+
* Execute callback if None
|
|
117
|
+
*
|
|
118
|
+
* @param fn - Callback function
|
|
119
|
+
* @returns This Option for chaining
|
|
120
|
+
*/
|
|
121
|
+
onNone(fn: () => void): Option<T>;
|
|
122
|
+
/**
|
|
123
|
+
* Match pattern for Option
|
|
124
|
+
*
|
|
125
|
+
* @param patterns - Some and None handlers
|
|
126
|
+
* @returns Result of the matched pattern
|
|
127
|
+
*/
|
|
128
|
+
match<U>(patterns: {
|
|
129
|
+
some: (value: T) => U;
|
|
130
|
+
none: () => U;
|
|
131
|
+
}): U;
|
|
132
|
+
/**
|
|
133
|
+
* Provide alternative Option if None
|
|
134
|
+
*
|
|
135
|
+
* @param alternative - Alternative Option
|
|
136
|
+
* @returns This Option if Some, alternative if None
|
|
137
|
+
*/
|
|
138
|
+
or(alternative: Option<T>): Option<T>;
|
|
139
|
+
/**
|
|
140
|
+
* Provide alternative Option computed lazily
|
|
141
|
+
*
|
|
142
|
+
* @param fn - Function returning alternative Option
|
|
143
|
+
* @returns This Option if Some, computed alternative if None
|
|
144
|
+
*/
|
|
145
|
+
orElse(fn: () => Option<T>): Option<T>;
|
|
146
|
+
/**
|
|
147
|
+
* Zip two Options together
|
|
148
|
+
*
|
|
149
|
+
* @param other - Other Option
|
|
150
|
+
* @returns Option containing tuple of both values or None
|
|
151
|
+
*/
|
|
152
|
+
zip<U>(other: Option<U>): Option<[T, U]>;
|
|
153
|
+
/**
|
|
154
|
+
* Convert Option to array
|
|
155
|
+
*
|
|
156
|
+
* @returns Array with value if Some, empty array if None
|
|
157
|
+
*/
|
|
158
|
+
toArray(): T[];
|
|
159
|
+
/**
|
|
160
|
+
* Convert Option to JSON
|
|
161
|
+
*/
|
|
162
|
+
toJSON(): object;
|
|
163
|
+
/**
|
|
164
|
+
* Try to execute a function and wrap result
|
|
165
|
+
*
|
|
166
|
+
* @param fn - Function to execute
|
|
167
|
+
* @returns Option containing result or None if error
|
|
168
|
+
*/
|
|
169
|
+
static try<T>(fn: () => T): Option<T>;
|
|
170
|
+
/**
|
|
171
|
+
* Combine multiple Options
|
|
172
|
+
*
|
|
173
|
+
* @param options - Array of Options
|
|
174
|
+
* @returns Option containing array of values or None if any is None
|
|
175
|
+
*/
|
|
176
|
+
static combine<T>(options: Option<T>[]): Option<T[]>;
|
|
177
|
+
}
|
|
178
|
+
//# sourceMappingURL=Option.d.ts.map
|