@yahoo/uds-create-config 2.13.6 → 2.15.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/dist/Config.d.ts +1 -0
- package/dist/Config.js +1 -0
- package/dist/config-diagnostics.d.ts +21 -0
- package/dist/config-diagnostics.js +12 -0
- package/dist/factories.d.ts +10 -1
- package/dist/factories.js +6 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2 -1
- package/dist/native/NativeConfig.d.ts +31 -0
- package/dist/native/NativeConfig.js +75 -0
- package/dist/native/assets.d.ts +20 -0
- package/dist/native/assets.js +17 -0
- package/dist/native/index.d.ts +16 -0
- package/dist/native/index.js +15 -0
- package/dist/native/types.d.ts +51 -0
- package/dist/native/types.js +0 -0
- package/dist/native/validation.d.ts +8 -0
- package/dist/native/validation.js +456 -0
- package/dist/native/values.d.ts +7 -0
- package/dist/native/values.js +15 -0
- package/dist/native.d.ts +11 -0
- package/dist/native.js +9 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +15 -8
- package/package.json +7 -3
package/dist/Config.d.ts
CHANGED
package/dist/Config.js
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/config-diagnostics.d.ts
|
|
2
|
+
/** A stable definition locator that UI, CLI, and migration callers can show. */
|
|
3
|
+
interface ConfigDiagnosticDefinition {
|
|
4
|
+
kind: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
}
|
|
7
|
+
/** Platform-neutral structured config diagnostic. */
|
|
8
|
+
interface ConfigDiagnostic<TCode extends string = string> {
|
|
9
|
+
code: TCode;
|
|
10
|
+
severity: 'error' | 'warning';
|
|
11
|
+
path: readonly (string | number)[];
|
|
12
|
+
definition: ConfigDiagnosticDefinition;
|
|
13
|
+
reason: string;
|
|
14
|
+
}
|
|
15
|
+
/** Structured config failure shared by platform validators. */
|
|
16
|
+
declare class ConfigValidationError<TDiagnostic extends ConfigDiagnostic = ConfigDiagnostic> extends Error {
|
|
17
|
+
readonly diagnostics: readonly TDiagnostic[];
|
|
18
|
+
constructor(diagnostics: readonly TDiagnostic[], message?: string);
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { ConfigDiagnostic, ConfigDiagnosticDefinition, ConfigValidationError };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/config-diagnostics.ts
|
|
2
|
+
/** Structured config failure shared by platform validators. */
|
|
3
|
+
var ConfigValidationError = class extends Error {
|
|
4
|
+
diagnostics;
|
|
5
|
+
constructor(diagnostics, message = "Invalid config") {
|
|
6
|
+
super(diagnostics.length === 0 ? message : `${message}: ${diagnostics.map((diagnostic) => diagnostic.reason).join("; ")}`);
|
|
7
|
+
this.name = "ConfigValidationError";
|
|
8
|
+
this.diagnostics = diagnostics;
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { ConfigValidationError };
|
package/dist/factories.d.ts
CHANGED
|
@@ -42,6 +42,15 @@ type DefinedTokenGroup<T extends Record<string, TokenDefinition>> = {
|
|
|
42
42
|
description?: string;
|
|
43
43
|
metadata(meta: TokenGroupMetadata): DefinedTokenGroup<T>;
|
|
44
44
|
};
|
|
45
|
+
/** Shared implementation shape used by platform-specific token definitions. */
|
|
46
|
+
type DefinedTokenGroupValue<T extends Record<string, {
|
|
47
|
+
value: unknown;
|
|
48
|
+
}>> = {
|
|
49
|
+
tokens: T;
|
|
50
|
+
label?: string;
|
|
51
|
+
description?: string;
|
|
52
|
+
metadata(meta: TokenGroupMetadata): DefinedTokenGroupValue<T>;
|
|
53
|
+
};
|
|
45
54
|
declare function defineTokenGroup<const T extends Record<string, TokenDefinition>>(t: T): DefinedTokenGroup<T>;
|
|
46
55
|
declare function defineModifier<const T extends ModifierDefinition>(t: T): T;
|
|
47
56
|
declare function defineMode<const T extends ModeDefinition>(t: T): T;
|
|
@@ -851,4 +860,4 @@ type ProviderComponent<TProps = Record<never, never>> = FC<{
|
|
|
851
860
|
*/
|
|
852
861
|
type DefinedProvider<TContext = unknown, TProps = Record<never, never>> = readonly [ProviderComponent<TProps>, () => TContext];
|
|
853
862
|
//#endregion
|
|
854
|
-
export { BoundComponent, ComponentBuilder, ComponentBuilderMethods, ComponentRenderFn, ConfigCallbackHelpers, DefineComponentFn, DefinedComponent, DefinedMotion, DefinedProvider, DefinedStyleProp, DefinedTokenGroup, PreviewCallbackHelpers, ProviderComponent, ProviderRenderFn, RawToken, TokenGroupMetadata, TokenRawValue, TypedSlotRef, asChild, boolean, defineComponent, defineComponentGroup, defineCompositeStyle, defineMode, defineModifier, defineMotion, defineStyleProp, defineTokenGroup, motion, number, slot, string, variant };
|
|
863
|
+
export { BoundComponent, ComponentBuilder, ComponentBuilderMethods, ComponentRenderFn, ConfigCallbackHelpers, DefineComponentFn, DefinedComponent, DefinedMotion, DefinedProvider, DefinedStyleProp, DefinedTokenGroup, DefinedTokenGroupValue, PreviewCallbackHelpers, ProviderComponent, ProviderRenderFn, RawToken, TokenGroupMetadata, TokenRawValue, TypedSlotRef, asChild, boolean, defineComponent, defineComponentGroup, defineCompositeStyle, defineMode, defineModifier, defineMotion, defineStyleProp, defineTokenGroup, motion, number, slot, string, variant };
|
package/dist/factories.js
CHANGED
|
@@ -3,7 +3,8 @@ import { composite, styleProp, tag, token } from "./refs.js";
|
|
|
3
3
|
import { darken, lighten } from "./colorExpressions.js";
|
|
4
4
|
import "./defineProvider.js";
|
|
5
5
|
//#region src/factories.ts
|
|
6
|
-
|
|
6
|
+
/** @internal Platform-neutral implementation behind web and native factories. */
|
|
7
|
+
function defineTokenGroupValue(t) {
|
|
7
8
|
const out = {
|
|
8
9
|
tokens: t,
|
|
9
10
|
metadata(meta) {
|
|
@@ -21,6 +22,9 @@ function defineTokenGroup(t) {
|
|
|
21
22
|
});
|
|
22
23
|
return out;
|
|
23
24
|
}
|
|
25
|
+
function defineTokenGroup(t) {
|
|
26
|
+
return defineTokenGroupValue(t);
|
|
27
|
+
}
|
|
24
28
|
function defineModifier(t) {
|
|
25
29
|
return attachSourcePath(t, captureCallerPath());
|
|
26
30
|
}
|
|
@@ -468,4 +472,4 @@ defineComponentImpl.layers = function layersEntry(layers) {
|
|
|
468
472
|
};
|
|
469
473
|
const defineComponent = defineComponentImpl;
|
|
470
474
|
//#endregion
|
|
471
|
-
export { asChild, boolean, defineComponent, defineComponentGroup, defineCompositeStyle, defineMode, defineModifier, defineMotion, defineStyleProp, defineTokenGroup, motion, number, slot, string, variant };
|
|
475
|
+
export { asChild, boolean, defineComponent, defineComponentGroup, defineCompositeStyle, defineMode, defineModifier, defineMotion, defineStyleProp, defineTokenGroup, defineTokenGroupValue, motion, number, slot, string, variant };
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { ColorExpression, ColorSpace, ColorValue, GradientStop, GradientValue, L
|
|
|
5
5
|
import { MOTION_CSS_DIRECTIONS, MOTION_CSS_FILL_MODES, MOTION_CSS_PLAY_STATES, MOTION_CSS_PROPERTY_PREFIXES, MOTION_JS_DRAG_AXES, MOTION_JS_LAYOUT_MODES, MOTION_JS_REPEAT_TYPES, MOTION_JS_SPRING_FIELDS, MOTION_JS_TRANSITION_TYPES, MOTION_JS_TWEEN_FIELDS } from "./motion-constants.js";
|
|
6
6
|
import { CSS_GLOBAL_KEYWORDS, CSS_PROPERTY_KEYWORDS, CssPropertyWithKeywords } from "./types/css-property-keywords.js";
|
|
7
7
|
import { ColorCssProperty, CssGlobalKeyword, CssPropertyName, CssPropertyValues } from "./types/css-properties.js";
|
|
8
|
-
import { AnyStylePropDefinition, ArbitrarySpec, BaseStyles, BuildOptions, CanvasRole, CanvasRoleEntry, CanvasRoleEntryInput, CanvasRolesDefinition, CanvasRolesDefinitionInput, CanvasRolesInputConstraint, ComponentDefinition, ComponentGroupDefinition, ComponentMetadata, CompositeStyleDefinition, CompositeStyleObject, CompoundPropsEntry, CssMotionDefinition, CssMotionFields, CssSlotMotion, FontAssetMember, GlobalStylesDef, JsMotionDefinition, JsMotionFields, JsSlotMotion, LayerInput, LinkedComponentsInput, LinkedSystemEntry, LiteralFor, ModeDefinition, ModeOptionDefinition, ModifierDefinition, MotionDefinitionInput, MotionDragBox, MotionKeyframes, MotionMetadata, MotionState, MotionStateKeyframe, MotionTransition, MotionVariants, MotionViewportOptions, OpacityPairSpec, PlaygroundOptions, PlaygroundPage, PlaygroundSpec, PreviewDefinition, PropBinding, SerializedAssetGroup, SerializedComponentGroup, SerializedConfig, SerializedFontAssetGroup, SerializedIconAssetGroup, SerializedPlaygroundOptions, SerializedTokenGroup, SlotMotion, StylePropDefinition, StylePropMetadata, StylePropProperty, SystemLink, TokenDefinition, TokenGroupDefinition, TokenModifierKey, TokenModifierValue, TokenType, TokenValue, ValuesEntry } from "./types.js";
|
|
8
|
+
import { AnyStylePropDefinition, ArbitrarySpec, BaseStyles, BuildOptions, CanvasRole, CanvasRoleEntry, CanvasRoleEntryInput, CanvasRolesDefinition, CanvasRolesDefinitionInput, CanvasRolesInputConstraint, ComponentDefinition, ComponentGroupDefinition, ComponentMetadata, CompositeStyleDefinition, CompositeStyleObject, CompoundPropsEntry, CssMotionDefinition, CssMotionFields, CssSlotMotion, FontAssetMember, GlobalStylesDef, JsMotionDefinition, JsMotionFields, JsSlotMotion, LayerInput, LinkedComponentsInput, LinkedSystemEntry, LiteralFor, ModeDefinition, ModeOptionDefinition, ModifierDefinition, MotionDefinitionInput, MotionDragBox, MotionKeyframes, MotionMetadata, MotionState, MotionStateKeyframe, MotionTransition, MotionVariants, MotionViewportOptions, OpacityPairSpec, PlaygroundOptions, PlaygroundPage, PlaygroundSpec, PreviewDefinition, PropBinding, SerializedAssetGroup, SerializedComponentGroup, SerializedConfig, SerializedFontAssetGroup, SerializedIconAssetGroup, SerializedPlaygroundOptions, SerializedTokenGroup, SlotMotion, StylePropDefinition, StylePropMetadata, StylePropProperty, SystemLink, TokenDefinition, TokenDefinitionFor, TokenGroupDefinition, TokenGroupDefinitionFor, TokenModifierKey, TokenModifierValue, TokenType, TokenValue, ValuesEntry } from "./types.js";
|
|
9
9
|
import { AssetGroupBuilder, AssetGroupConfig, AssetGroupDefinition, FontAssetGroupConfig, FontAssetGroupDefinition, IconAssetGroupConfig, IconAssetGroupDefinition, IconAssetMember, IconAssetMetadata, defineAssetGroup, defineAssetIcon } from "./defineAssetGroup.js";
|
|
10
10
|
import { AssetGroup } from "./AssetGroup.js";
|
|
11
11
|
import { resolveAssetRefCss, resolveFontStack } from "./asset-value.js";
|
|
@@ -28,6 +28,7 @@ import { TokenGroup } from "./TokenGroup.js";
|
|
|
28
28
|
import { Config, DependenciesQuery, DependencyKind, DependencyRef, DependentsQuery, parseRegistryKey } from "./Config.js";
|
|
29
29
|
import { SOURCE_PATH_KEY, attachSourcePath, captureCallerPath, readSourcePath } from "./captureCallerPath.js";
|
|
30
30
|
import { findComponentReferrers } from "./component-referrers.js";
|
|
31
|
+
import { ConfigDiagnostic, ConfigDiagnosticDefinition, ConfigValidationError } from "./config-diagnostics.js";
|
|
31
32
|
import { ELEMENT_MARKER_KIND, ElementMarker, OpaqueLeafPredicate, hasElementMarkerDeep, isElementLikeValue, isElementMarker, reviveElementMarkersDeep, serializeElementsDeep } from "./element-marker.js";
|
|
32
33
|
import { collectFontFaceCss, deriveFontFaceCss, familiesInRawCss } from "./font-face.js";
|
|
33
34
|
import { interpolate } from "./interpolate.js";
|
|
@@ -35,4 +36,4 @@ import { resolveRegistryDir } from "./registry-dir.js";
|
|
|
35
36
|
import { ModeBackedModifierDefinition, ModeBackedModifierInput, ModeBackedModifierLookup, OverrideModeRef, OverrideRow, buildModeBackedModifierLookup, buildNestedModifierUpdate, createModeBackedModifierLookup, mergeModifierUpdates, modifierIdToPath, modifierPathToId, modifierTreeToOverrideRows, overrideRowsToModifierTree, resolveOverrideRowValue } from "./token-override-rows.js";
|
|
36
37
|
import { rem } from "./units.js";
|
|
37
38
|
import { EntityKind } from "@yahoo/uds-create-types/entity";
|
|
38
|
-
export { ASSET_CLASS_CAPABILITIES, type AnyRef, type AnyStylePropDefinition, type ArbitrarySpec, AssetGroup, type AssetGroupBuilder, type AssetGroupConfig, type AssetGroupDefinition, type AssetGroupName, type AssetGroupRef, type AssetKind, type AssetName, type AssetRef, type BaseStyles, type BooleanMarker, type BoundComponent, type BuildOptions, CSS_GLOBAL_KEYWORDS, CSS_PROPERTY_KEYWORDS, type CanvasRole, type CanvasRoleEntry, type CanvasRoleEntryInput, type CanvasRolesDefinition, type CanvasRolesDefinitionInput, type CanvasRolesInputConstraint, type ColorCssProperty, type ColorExpression, type ColorFn, type ColorKeyword, type ColorSpace, type ColorValue, Component, type ComponentBuilder, type ComponentBuilderMethods, type ComponentDefinition, ComponentGroup, type ComponentGroupDefinition, type ComponentKind, type ComponentMetadata, type ComponentName, type ComponentRef, type ComponentRenderFn, type CompositeInfo, type CompositeName, type CompositeRef, type CompositeRefBuilder, CompositeStyle, type CompositeStyleDefinition, type CompositeStyleObject, type CompoundPropsEntry, Config, type ConfigCallbackHelpers, type Css, type CssAngle, type CssClassName, type CssColor, type CssDeclaration, type CssGlobalKeyword, type CssLength, CssMotionDef, type CssMotionDefinition, type CssMotionFields, type CssPercentage, type CssPropertyName, type CssPropertyValues, type CssPropertyWithKeywords, type CssRatio, type CssSelector, type CssSlotMotion, type CssTime, type CssValue, type CssValueTypeName, type CssVar, type CssVarRef, type DataAttrs, type DefineComponentFn, type DefinedComponent, type DefinedMotion, type DefinedProvider, type DefinedStyleProp, type DefinedTokenGroup, type DependenciesQuery, type DependencyKind, type DependencyRef, type DependentsQuery, ELEMENT_MARKER_KIND, type ElementMarker, type EntityKind, type FontAssetGroupConfig, type FontAssetGroupDefinition, type FontAssetMember, type FunctionInfo, type GlobalStylesDef, type GradientStop, type GradientValue, type HexColor, type HslColor, type IconAssetGroupConfig, type IconAssetGroupDefinition, type IconAssetMember, type IconAssetMetadata, JsMotionDef, type JsMotionDefinition, type JsMotionFields, type JsSlotMotion, Layer, type LayerInput, type LayerMarker, type LayerPropsMap, type LengthOrPercent, type LineDirection, type LinearGradientExpr, type LinkedComponentsInput, type LinkedSystemEntry, type LiteralFor, MOTION_CSS_DEFINITION_KEYS, MOTION_CSS_DIRECTIONS, MOTION_CSS_FILL_MODES, MOTION_CSS_PLAY_STATES, MOTION_CSS_PROPERTY_PREFIXES, MOTION_JS_DEFINITION_KEYS, MOTION_JS_DRAG_AXES, MOTION_JS_FIELD_KEYS, MOTION_JS_LAYOUT_MODES, MOTION_JS_REPEAT_TYPES, MOTION_JS_SPRING_FIELDS, MOTION_JS_TRANSITION_TYPES, MOTION_JS_TWEEN_FIELDS, type MixExpr, Mode, type ModeBackedModifierDefinition, type ModeBackedModifierInput, type ModeBackedModifierLookup, type ModeDefinition, type ModeName, ModeOption, type ModeOptionDefinition, type ModeRef, Modifier, type ModifierDefinition, type MotionDef, type MotionDefinitionInput, type MotionDragBox, type MotionKeyframes, type MotionMarker, type MotionMetadata, type MotionName, type MotionState, type MotionStateKeyframe, type MotionTransition, type MotionVariants, type MotionViewportOptions, type NumberMarker, type OpacityPairSpec, type OpaqueLeafPredicate, type OverrideModeRef, type OverrideRow, PREVIEW_SEED_KEY, type PlaygroundOptions, type PlaygroundPage, type PlaygroundSpec, type PreviewAxisMarker, type PreviewCallbackHelpers, type PreviewDefinition, type PreviewPropsRule, type PrimitivePropKind, type PropBase, type PropBinding, type PropInfo, type PropKind, Provider, type RadialGradientExpr, type RadialSize, type RawToken, type RegisteredAssetGroups, type RegisteredComponents, type RegisteredCompositeStyles, type RegisteredModes, type RegisteredModifiers, type RegisteredMotion, type RegisteredStyleProps, type RegisteredTokenGroups, type RequiredBrand, type ResolvedCompoundOverrides, type ResolvedTokenLiteral, type RgbColor, SOURCE_PATH_KEY, type SerializedAssetGroup, type SerializedComponentGroup, type SerializedConfig, type SerializedFontAssetGroup, type SerializedIconAssetGroup, type SerializedPlaygroundOptions, type SerializedTokenGroup, type SlotInfo, type SlotMarker, type SlotMotion, type SlotRef, type SlotValueKind, type SlotValueType, type StringMarker, StyleProp, type StylePropDefinition, type StylePropInfo, type StylePropKeyword, type StylePropMetadata, type StylePropName, type StylePropProperty, type StylePropRef, type StylePropTokenUsage, type SystemLink, type TagName, type TagRef, Token, type TokenDefinition, TokenGroup, type TokenGroupDefinition, type TokenGroupMetadata, type TokenGroupName, type TokenGroupRef, type TokenModifierKey, type TokenModifierValue, type TokenName, type TokenQualifiedName, type TokenRawNameRegistry, type TokenRawValue, type TokenRef, type TokenRefToCss, type TokenType, type TokenValue, type TypedSlotRef, type ValuesEntry, type VariantInfo, type VariantMarker, type VariantMarkerArray, type VariantMarkerObject, alpha, asChild, asset, assetGroup, attachSourcePath, boolean, buildModeBackedModifierLookup, buildNestedModifierUpdate, captureCallerPath, collectFontFaceCss, component, composite, createModeBackedModifierLookup, cssClassName, cssDeclaration, cssSelector, cssVar, defineAssetGroup, defineAssetIcon, defineComponent, defineComponentGroup, defineCompositeStyle, defineMode, defineModifier, defineMotion, defineProvider, defineStyleProp, defineTokenGroup, deriveFontFaceCss, familiesInRawCss, findComponentReferrers, hasElementMarkerDeep, interpolate, isAssetGroupRef, isAssetRef, isBoolMarker, isColorExpression, isComponentRef, isCompositeRef, isElementLikeValue, isElementMarker, isLayerMarker, isLinearGradientExpr, isMixExpr, isModeRef, isMotionMarker, isNumberMarker, isPlaceable, isPreviewAxisMarker, isRadialGradientExpr, isSafeClassNameValue, isSlotMarker, isStringMarker, isStylePropRef, isTagRef, isTokenGroupRef, isTokenRef, isVariantArrayMarker, isVariantMarker, linearGradient, makeTokenRefToCss, matchesPreviewWhen, mergeModifierUpdates, mix, mode, modifierIdToPath, modifierPathToId, modifierTreeToOverrideRows, motion, number, overrideRowsToModifierTree, parseRegistryKey, radialGradient, readSourcePath, rem, resolveAssetRefCss, resolveColorExpression, resolveFontStack, resolveOverrideRowValue, resolvePreviewRules, resolveRegistryDir, reviveElementMarkersDeep, serializeElementsDeep, slot, string, styleProp, tag, token, tokenGroup, variant };
|
|
39
|
+
export { ASSET_CLASS_CAPABILITIES, type AnyRef, type AnyStylePropDefinition, type ArbitrarySpec, AssetGroup, type AssetGroupBuilder, type AssetGroupConfig, type AssetGroupDefinition, type AssetGroupName, type AssetGroupRef, type AssetKind, type AssetName, type AssetRef, type BaseStyles, type BooleanMarker, type BoundComponent, type BuildOptions, CSS_GLOBAL_KEYWORDS, CSS_PROPERTY_KEYWORDS, type CanvasRole, type CanvasRoleEntry, type CanvasRoleEntryInput, type CanvasRolesDefinition, type CanvasRolesDefinitionInput, type CanvasRolesInputConstraint, type ColorCssProperty, type ColorExpression, type ColorFn, type ColorKeyword, type ColorSpace, type ColorValue, Component, type ComponentBuilder, type ComponentBuilderMethods, type ComponentDefinition, ComponentGroup, type ComponentGroupDefinition, type ComponentKind, type ComponentMetadata, type ComponentName, type ComponentRef, type ComponentRenderFn, type CompositeInfo, type CompositeName, type CompositeRef, type CompositeRefBuilder, CompositeStyle, type CompositeStyleDefinition, type CompositeStyleObject, type CompoundPropsEntry, Config, type ConfigCallbackHelpers, type ConfigDiagnostic, type ConfigDiagnosticDefinition, ConfigValidationError, type Css, type CssAngle, type CssClassName, type CssColor, type CssDeclaration, type CssGlobalKeyword, type CssLength, CssMotionDef, type CssMotionDefinition, type CssMotionFields, type CssPercentage, type CssPropertyName, type CssPropertyValues, type CssPropertyWithKeywords, type CssRatio, type CssSelector, type CssSlotMotion, type CssTime, type CssValue, type CssValueTypeName, type CssVar, type CssVarRef, type DataAttrs, type DefineComponentFn, type DefinedComponent, type DefinedMotion, type DefinedProvider, type DefinedStyleProp, type DefinedTokenGroup, type DependenciesQuery, type DependencyKind, type DependencyRef, type DependentsQuery, ELEMENT_MARKER_KIND, type ElementMarker, type EntityKind, type FontAssetGroupConfig, type FontAssetGroupDefinition, type FontAssetMember, type FunctionInfo, type GlobalStylesDef, type GradientStop, type GradientValue, type HexColor, type HslColor, type IconAssetGroupConfig, type IconAssetGroupDefinition, type IconAssetMember, type IconAssetMetadata, JsMotionDef, type JsMotionDefinition, type JsMotionFields, type JsSlotMotion, Layer, type LayerInput, type LayerMarker, type LayerPropsMap, type LengthOrPercent, type LineDirection, type LinearGradientExpr, type LinkedComponentsInput, type LinkedSystemEntry, type LiteralFor, MOTION_CSS_DEFINITION_KEYS, MOTION_CSS_DIRECTIONS, MOTION_CSS_FILL_MODES, MOTION_CSS_PLAY_STATES, MOTION_CSS_PROPERTY_PREFIXES, MOTION_JS_DEFINITION_KEYS, MOTION_JS_DRAG_AXES, MOTION_JS_FIELD_KEYS, MOTION_JS_LAYOUT_MODES, MOTION_JS_REPEAT_TYPES, MOTION_JS_SPRING_FIELDS, MOTION_JS_TRANSITION_TYPES, MOTION_JS_TWEEN_FIELDS, type MixExpr, Mode, type ModeBackedModifierDefinition, type ModeBackedModifierInput, type ModeBackedModifierLookup, type ModeDefinition, type ModeName, ModeOption, type ModeOptionDefinition, type ModeRef, Modifier, type ModifierDefinition, type MotionDef, type MotionDefinitionInput, type MotionDragBox, type MotionKeyframes, type MotionMarker, type MotionMetadata, type MotionName, type MotionState, type MotionStateKeyframe, type MotionTransition, type MotionVariants, type MotionViewportOptions, type NumberMarker, type OpacityPairSpec, type OpaqueLeafPredicate, type OverrideModeRef, type OverrideRow, PREVIEW_SEED_KEY, type PlaygroundOptions, type PlaygroundPage, type PlaygroundSpec, type PreviewAxisMarker, type PreviewCallbackHelpers, type PreviewDefinition, type PreviewPropsRule, type PrimitivePropKind, type PropBase, type PropBinding, type PropInfo, type PropKind, Provider, type RadialGradientExpr, type RadialSize, type RawToken, type RegisteredAssetGroups, type RegisteredComponents, type RegisteredCompositeStyles, type RegisteredModes, type RegisteredModifiers, type RegisteredMotion, type RegisteredStyleProps, type RegisteredTokenGroups, type RequiredBrand, type ResolvedCompoundOverrides, type ResolvedTokenLiteral, type RgbColor, SOURCE_PATH_KEY, type SerializedAssetGroup, type SerializedComponentGroup, type SerializedConfig, type SerializedFontAssetGroup, type SerializedIconAssetGroup, type SerializedPlaygroundOptions, type SerializedTokenGroup, type SlotInfo, type SlotMarker, type SlotMotion, type SlotRef, type SlotValueKind, type SlotValueType, type StringMarker, StyleProp, type StylePropDefinition, type StylePropInfo, type StylePropKeyword, type StylePropMetadata, type StylePropName, type StylePropProperty, type StylePropRef, type StylePropTokenUsage, type SystemLink, type TagName, type TagRef, Token, type TokenDefinition, type TokenDefinitionFor, TokenGroup, type TokenGroupDefinition, type TokenGroupDefinitionFor, type TokenGroupMetadata, type TokenGroupName, type TokenGroupRef, type TokenModifierKey, type TokenModifierValue, type TokenName, type TokenQualifiedName, type TokenRawNameRegistry, type TokenRawValue, type TokenRef, type TokenRefToCss, type TokenType, type TokenValue, type TypedSlotRef, type ValuesEntry, type VariantInfo, type VariantMarker, type VariantMarkerArray, type VariantMarkerObject, alpha, asChild, asset, assetGroup, attachSourcePath, boolean, buildModeBackedModifierLookup, buildNestedModifierUpdate, captureCallerPath, collectFontFaceCss, component, composite, createModeBackedModifierLookup, cssClassName, cssDeclaration, cssSelector, cssVar, defineAssetGroup, defineAssetIcon, defineComponent, defineComponentGroup, defineCompositeStyle, defineMode, defineModifier, defineMotion, defineProvider, defineStyleProp, defineTokenGroup, deriveFontFaceCss, familiesInRawCss, findComponentReferrers, hasElementMarkerDeep, interpolate, isAssetGroupRef, isAssetRef, isBoolMarker, isColorExpression, isComponentRef, isCompositeRef, isElementLikeValue, isElementMarker, isLayerMarker, isLinearGradientExpr, isMixExpr, isModeRef, isMotionMarker, isNumberMarker, isPlaceable, isPreviewAxisMarker, isRadialGradientExpr, isSafeClassNameValue, isSlotMarker, isStringMarker, isStylePropRef, isTagRef, isTokenGroupRef, isTokenRef, isVariantArrayMarker, isVariantMarker, linearGradient, makeTokenRefToCss, matchesPreviewWhen, mergeModifierUpdates, mix, mode, modifierIdToPath, modifierPathToId, modifierTreeToOverrideRows, motion, number, overrideRowsToModifierTree, parseRegistryKey, radialGradient, readSourcePath, rem, resolveAssetRefCss, resolveColorExpression, resolveFontStack, resolveOverrideRowValue, resolvePreviewRules, resolveRegistryDir, reviveElementMarkersDeep, serializeElementsDeep, slot, string, styleProp, tag, token, tokenGroup, variant };
|
package/dist/index.js
CHANGED
|
@@ -21,6 +21,7 @@ import { Token } from "./Token.js";
|
|
|
21
21
|
import { TokenGroup } from "./TokenGroup.js";
|
|
22
22
|
import { Config, parseRegistryKey } from "./Config.js";
|
|
23
23
|
import { findComponentReferrers } from "./component-referrers.js";
|
|
24
|
+
import { ConfigValidationError } from "./config-diagnostics.js";
|
|
24
25
|
import { defineProvider } from "./defineProvider.js";
|
|
25
26
|
import { asChild, boolean, defineComponent, defineComponentGroup, defineCompositeStyle, defineMode, defineModifier, defineMotion, defineStyleProp, defineTokenGroup, motion, number, slot, string, variant } from "./factories.js";
|
|
26
27
|
import { collectFontFaceCss, deriveFontFaceCss, familiesInRawCss } from "./font-face.js";
|
|
@@ -30,4 +31,4 @@ import { resolveRegistryDir } from "./registry-dir.js";
|
|
|
30
31
|
import { buildModeBackedModifierLookup, buildNestedModifierUpdate, createModeBackedModifierLookup, mergeModifierUpdates, modifierIdToPath, modifierPathToId, modifierTreeToOverrideRows, overrideRowsToModifierTree, resolveOverrideRowValue } from "./token-override-rows.js";
|
|
31
32
|
import { CSS_GLOBAL_KEYWORDS, CSS_PROPERTY_KEYWORDS } from "./types/css-property-keywords.js";
|
|
32
33
|
import { rem } from "./units.js";
|
|
33
|
-
export { ASSET_CLASS_CAPABILITIES, AssetGroup, CSS_GLOBAL_KEYWORDS, CSS_PROPERTY_KEYWORDS, Component, ComponentGroup, CompositeStyle, Config, CssMotionDef, ELEMENT_MARKER_KIND, JsMotionDef, Layer, MOTION_CSS_DEFINITION_KEYS, MOTION_CSS_DIRECTIONS, MOTION_CSS_FILL_MODES, MOTION_CSS_PLAY_STATES, MOTION_CSS_PROPERTY_PREFIXES, MOTION_JS_DEFINITION_KEYS, MOTION_JS_DRAG_AXES, MOTION_JS_FIELD_KEYS, MOTION_JS_LAYOUT_MODES, MOTION_JS_REPEAT_TYPES, MOTION_JS_SPRING_FIELDS, MOTION_JS_TRANSITION_TYPES, MOTION_JS_TWEEN_FIELDS, Mode, ModeOption, Modifier, PREVIEW_SEED_KEY, Provider, SOURCE_PATH_KEY, StyleProp, Token, TokenGroup, alpha, asChild, asset, assetGroup, attachSourcePath, boolean, buildModeBackedModifierLookup, buildNestedModifierUpdate, captureCallerPath, collectFontFaceCss, component, composite, createModeBackedModifierLookup, cssClassName, cssDeclaration, cssSelector, cssVar, defineAssetGroup, defineAssetIcon, defineComponent, defineComponentGroup, defineCompositeStyle, defineMode, defineModifier, defineMotion, defineProvider, defineStyleProp, defineTokenGroup, deriveFontFaceCss, familiesInRawCss, findComponentReferrers, hasElementMarkerDeep, interpolate, isAssetGroupRef, isAssetRef, isBoolMarker, isColorExpression, isComponentRef, isCompositeRef, isElementLikeValue, isElementMarker, isLayerMarker, isLinearGradientExpr, isMixExpr, isModeRef, isMotionMarker, isNumberMarker, isPlaceable, isPreviewAxisMarker, isRadialGradientExpr, isSafeClassNameValue, isSlotMarker, isStringMarker, isStylePropRef, isTagRef, isTokenGroupRef, isTokenRef, isVariantArrayMarker, isVariantMarker, linearGradient, makeTokenRefToCss, matchesPreviewWhen, mergeModifierUpdates, mix, mode, modifierIdToPath, modifierPathToId, modifierTreeToOverrideRows, motion, number, overrideRowsToModifierTree, parseRegistryKey, radialGradient, readSourcePath, rem, resolveAssetRefCss, resolveColorExpression, resolveFontStack, resolveOverrideRowValue, resolvePreviewRules, resolveRegistryDir, reviveElementMarkersDeep, serializeElementsDeep, slot, string, styleProp, tag, token, tokenGroup, variant };
|
|
34
|
+
export { ASSET_CLASS_CAPABILITIES, AssetGroup, CSS_GLOBAL_KEYWORDS, CSS_PROPERTY_KEYWORDS, Component, ComponentGroup, CompositeStyle, Config, ConfigValidationError, CssMotionDef, ELEMENT_MARKER_KIND, JsMotionDef, Layer, MOTION_CSS_DEFINITION_KEYS, MOTION_CSS_DIRECTIONS, MOTION_CSS_FILL_MODES, MOTION_CSS_PLAY_STATES, MOTION_CSS_PROPERTY_PREFIXES, MOTION_JS_DEFINITION_KEYS, MOTION_JS_DRAG_AXES, MOTION_JS_FIELD_KEYS, MOTION_JS_LAYOUT_MODES, MOTION_JS_REPEAT_TYPES, MOTION_JS_SPRING_FIELDS, MOTION_JS_TRANSITION_TYPES, MOTION_JS_TWEEN_FIELDS, Mode, ModeOption, Modifier, PREVIEW_SEED_KEY, Provider, SOURCE_PATH_KEY, StyleProp, Token, TokenGroup, alpha, asChild, asset, assetGroup, attachSourcePath, boolean, buildModeBackedModifierLookup, buildNestedModifierUpdate, captureCallerPath, collectFontFaceCss, component, composite, createModeBackedModifierLookup, cssClassName, cssDeclaration, cssSelector, cssVar, defineAssetGroup, defineAssetIcon, defineComponent, defineComponentGroup, defineCompositeStyle, defineMode, defineModifier, defineMotion, defineProvider, defineStyleProp, defineTokenGroup, deriveFontFaceCss, familiesInRawCss, findComponentReferrers, hasElementMarkerDeep, interpolate, isAssetGroupRef, isAssetRef, isBoolMarker, isColorExpression, isComponentRef, isCompositeRef, isElementLikeValue, isElementMarker, isLayerMarker, isLinearGradientExpr, isMixExpr, isModeRef, isMotionMarker, isNumberMarker, isPlaceable, isPreviewAxisMarker, isRadialGradientExpr, isSafeClassNameValue, isSlotMarker, isStringMarker, isStylePropRef, isTagRef, isTokenGroupRef, isTokenRef, isVariantArrayMarker, isVariantMarker, linearGradient, makeTokenRefToCss, matchesPreviewWhen, mergeModifierUpdates, mix, mode, modifierIdToPath, modifierPathToId, modifierTreeToOverrideRows, motion, number, overrideRowsToModifierTree, parseRegistryKey, radialGradient, readSourcePath, rem, resolveAssetRefCss, resolveColorExpression, resolveFontStack, resolveOverrideRowValue, resolvePreviewRules, resolveRegistryDir, reviveElementMarkersDeep, serializeElementsDeep, slot, string, styleProp, tag, token, tokenGroup, variant };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ModeDefinition } from "../types.js";
|
|
2
|
+
import { ConfigValidationError } from "../config-diagnostics.js";
|
|
3
|
+
import { NativeAssetGroupDefinition, NativeFontAssetGroupDefinition, NativeTokenGroupDefinition, SerializedNativeConfig } from "./types.js";
|
|
4
|
+
import { NativeConfigDiagnostic } from "./validation.js";
|
|
5
|
+
|
|
6
|
+
//#region src/native/NativeConfig.d.ts
|
|
7
|
+
declare class NativeConfigValidationError extends ConfigValidationError<NativeConfigDiagnostic> {
|
|
8
|
+
constructor(diagnostics: readonly NativeConfigDiagnostic[]);
|
|
9
|
+
}
|
|
10
|
+
declare class NativeConfig {
|
|
11
|
+
#private;
|
|
12
|
+
static readonly SCHEMA_VERSION = 1;
|
|
13
|
+
readonly platform: "native";
|
|
14
|
+
namespace?: string;
|
|
15
|
+
readonly modes: Map<string, ModeDefinition>;
|
|
16
|
+
readonly tokenGroups: Map<string, NativeTokenGroupDefinition>;
|
|
17
|
+
readonly assetGroups: Map<string, NativeFontAssetGroupDefinition>;
|
|
18
|
+
configure(options: {
|
|
19
|
+
namespace?: string;
|
|
20
|
+
}): this;
|
|
21
|
+
registerModes(modes: Record<string, ModeDefinition>): this;
|
|
22
|
+
registerTokenGroups(groups: Record<string, NativeTokenGroupDefinition>): this;
|
|
23
|
+
registerAssetGroups(groups: Record<string, NativeAssetGroupDefinition>): this;
|
|
24
|
+
validate(): NativeConfigDiagnostic[];
|
|
25
|
+
toJSON(meta?: {
|
|
26
|
+
builtAt?: string;
|
|
27
|
+
}): SerializedNativeConfig;
|
|
28
|
+
static fromJSON(input: unknown): NativeConfig;
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { NativeConfig, NativeConfigValidationError };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { ConfigValidationError } from "../config-diagnostics.js";
|
|
2
|
+
import { validateSerializedNativeConfig } from "./validation.js";
|
|
3
|
+
//#region src/native/NativeConfig.ts
|
|
4
|
+
var NativeConfigValidationError = class extends ConfigValidationError {
|
|
5
|
+
constructor(diagnostics) {
|
|
6
|
+
super(diagnostics, "Invalid native config");
|
|
7
|
+
this.name = "NativeConfigValidationError";
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var NativeConfig = class NativeConfig {
|
|
11
|
+
static SCHEMA_VERSION = 1;
|
|
12
|
+
platform = "native";
|
|
13
|
+
namespace;
|
|
14
|
+
modes = /* @__PURE__ */ new Map();
|
|
15
|
+
tokenGroups = /* @__PURE__ */ new Map();
|
|
16
|
+
assetGroups = /* @__PURE__ */ new Map();
|
|
17
|
+
configure(options) {
|
|
18
|
+
if (options.namespace !== void 0) {
|
|
19
|
+
const diagnostics = validateSerializedNativeConfig({
|
|
20
|
+
schemaVersion: NativeConfig.SCHEMA_VERSION,
|
|
21
|
+
platform: "native",
|
|
22
|
+
namespace: options.namespace
|
|
23
|
+
});
|
|
24
|
+
if (diagnostics.length > 0) throw new NativeConfigValidationError(diagnostics);
|
|
25
|
+
this.namespace = options.namespace;
|
|
26
|
+
}
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
|
+
registerModes(modes) {
|
|
30
|
+
for (const [name, definition] of Object.entries(modes)) this.modes.set(name, definition);
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
registerTokenGroups(groups) {
|
|
34
|
+
for (const [name, definition] of Object.entries(groups)) this.tokenGroups.set(name, definition);
|
|
35
|
+
return this;
|
|
36
|
+
}
|
|
37
|
+
registerAssetGroups(groups) {
|
|
38
|
+
for (const [name, definition] of Object.entries(groups)) this.assetGroups.set(name, definition);
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
validate() {
|
|
42
|
+
return validateSerializedNativeConfig(this.#serialize());
|
|
43
|
+
}
|
|
44
|
+
toJSON(meta) {
|
|
45
|
+
const out = this.#serialize(meta);
|
|
46
|
+
const diagnostics = validateSerializedNativeConfig(out);
|
|
47
|
+
if (diagnostics.length > 0) throw new NativeConfigValidationError(diagnostics);
|
|
48
|
+
return out;
|
|
49
|
+
}
|
|
50
|
+
static fromJSON(input) {
|
|
51
|
+
const diagnostics = validateSerializedNativeConfig(input, NativeConfig.SCHEMA_VERSION);
|
|
52
|
+
if (diagnostics.length > 0) throw new NativeConfigValidationError(diagnostics);
|
|
53
|
+
const json = input;
|
|
54
|
+
const config = new NativeConfig();
|
|
55
|
+
config.namespace = json.namespace;
|
|
56
|
+
for (const [name, mode] of Object.entries(json.modes ?? {})) config.modes.set(name, mode);
|
|
57
|
+
for (const [name, group] of Object.entries(json.tokenGroups ?? {})) config.tokenGroups.set(name, group);
|
|
58
|
+
for (const [name, group] of Object.entries(json.assetGroups ?? {})) config.assetGroups.set(name, group);
|
|
59
|
+
return config;
|
|
60
|
+
}
|
|
61
|
+
#serialize(meta) {
|
|
62
|
+
const out = {
|
|
63
|
+
schemaVersion: NativeConfig.SCHEMA_VERSION,
|
|
64
|
+
platform: "native"
|
|
65
|
+
};
|
|
66
|
+
if (meta?.builtAt !== void 0) out.builtAt = meta.builtAt;
|
|
67
|
+
if (this.namespace !== void 0) out.namespace = this.namespace;
|
|
68
|
+
if (this.modes.size > 0) out.modes = Object.fromEntries(this.modes);
|
|
69
|
+
if (this.tokenGroups.size > 0) out.tokenGroups = Object.fromEntries(this.tokenGroups);
|
|
70
|
+
if (this.assetGroups.size > 0) out.assetGroups = Object.fromEntries(this.assetGroups);
|
|
71
|
+
return out;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
//#endregion
|
|
75
|
+
export { NativeConfig, NativeConfigValidationError };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { NativeFontAssetGroupDefinition, NativeFontAssetMember } from "./types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/native/assets.d.ts
|
|
4
|
+
interface NativeFontAssetGroupConfig {
|
|
5
|
+
readonly type: 'font';
|
|
6
|
+
readonly label?: string;
|
|
7
|
+
readonly description?: string;
|
|
8
|
+
}
|
|
9
|
+
interface NativeAssetGroupBuilder<T extends Record<string, NativeFontAssetMember>> {
|
|
10
|
+
config(config: NativeFontAssetGroupConfig): NativeFontAssetGroupDefinition & {
|
|
11
|
+
members: T;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Native counterpart to the web asset-group factory. The registration and ref
|
|
16
|
+
* model are shared; only the platform member payload differs.
|
|
17
|
+
*/
|
|
18
|
+
declare function defineAssetGroup<const T extends Record<string, NativeFontAssetMember>>(members: T): NativeAssetGroupBuilder<T>;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { NativeAssetGroupBuilder, NativeFontAssetGroupConfig, defineAssetGroup };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/native/assets.ts
|
|
2
|
+
/**
|
|
3
|
+
* Native counterpart to the web asset-group factory. The registration and ref
|
|
4
|
+
* model are shared; only the platform member payload differs.
|
|
5
|
+
*/
|
|
6
|
+
function defineAssetGroup(members) {
|
|
7
|
+
return { config(config) {
|
|
8
|
+
return {
|
|
9
|
+
assetKind: "font",
|
|
10
|
+
members,
|
|
11
|
+
...config.label !== void 0 ? { label: config.label } : {},
|
|
12
|
+
...config.description !== void 0 ? { description: config.description } : {}
|
|
13
|
+
};
|
|
14
|
+
} };
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { defineAssetGroup };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AssetRef, TokenRef, asset, token } from "../refs.js";
|
|
2
|
+
import { ColorSpace, MixExpr, alpha, mix } from "../colorExpressions.js";
|
|
3
|
+
import { ModeDefinition, SystemLink, TokenType } from "../types.js";
|
|
4
|
+
import { DefinedTokenGroupValue, defineMode } from "../factories.js";
|
|
5
|
+
import { NativeAssetGroupDefinition, NativeColorExpression, NativeFontAssetGroupDefinition, NativeFontAssetMember, NativeLiteral, NativeSelectableValue, NativeTokenDefinition, NativeTokenGroupDefinition, NativeTokenValue, OperatingSystemInput, OperatingSystemValue, SerializedNativeConfig } from "./types.js";
|
|
6
|
+
import { NativeAssetGroupBuilder, NativeFontAssetGroupConfig, defineAssetGroup } from "./assets.js";
|
|
7
|
+
import { NativeConfigDiagnostic, NativeConfigDiagnosticCode, validateSerializedNativeConfig } from "./validation.js";
|
|
8
|
+
import { NativeConfig, NativeConfigValidationError } from "./NativeConfig.js";
|
|
9
|
+
import { isOperatingSystemValue, operatingSystem } from "./values.js";
|
|
10
|
+
|
|
11
|
+
//#region src/native/index.d.ts
|
|
12
|
+
type DefinedNativeTokenGroup<T extends Record<string, NativeTokenDefinition>> = DefinedTokenGroupValue<T>;
|
|
13
|
+
/** Native and web use the same token-group factory implementation. */
|
|
14
|
+
declare function defineTokenGroup<const T extends Record<string, NativeTokenDefinition>>(tokens: T): DefinedNativeTokenGroup<T>;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { DefinedNativeTokenGroup, defineTokenGroup };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import "../refs.js";
|
|
2
|
+
import "../colorExpressions.js";
|
|
3
|
+
import { defineTokenGroupValue } from "../factories.js";
|
|
4
|
+
import "./assets.js";
|
|
5
|
+
import "./values.js";
|
|
6
|
+
import "./validation.js";
|
|
7
|
+
import "./NativeConfig.js";
|
|
8
|
+
//#region src/native/index.ts
|
|
9
|
+
/** Native / React Native authoring entry point over shared config concepts. */
|
|
10
|
+
/** Native and web use the same token-group factory implementation. */
|
|
11
|
+
function defineTokenGroup(tokens) {
|
|
12
|
+
return defineTokenGroupValue(tokens);
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { defineTokenGroup };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { AssetRef, TokenRef } from "../refs.js";
|
|
2
|
+
import { MixExpr } from "../colorExpressions.js";
|
|
3
|
+
import { ModeDefinition, TokenDefinitionFor, TokenGroupDefinitionFor } from "../types.js";
|
|
4
|
+
|
|
5
|
+
//#region src/native/types.d.ts
|
|
6
|
+
type NativeLiteral = string | number | boolean;
|
|
7
|
+
/** Shared scalar color expression whose result can be emitted as an RN color. */
|
|
8
|
+
type NativeColorExpression = MixExpr;
|
|
9
|
+
/** A native value that can appear inside one iOS/Android branch. */
|
|
10
|
+
type NativeSelectableValue = NativeLiteral | TokenRef | AssetRef | NativeColorExpression;
|
|
11
|
+
type OperatingSystemInput = {
|
|
12
|
+
default: NativeSelectableValue;
|
|
13
|
+
ios?: NativeSelectableValue;
|
|
14
|
+
android?: NativeSelectableValue;
|
|
15
|
+
} | {
|
|
16
|
+
default?: never;
|
|
17
|
+
ios: NativeSelectableValue;
|
|
18
|
+
android: NativeSelectableValue;
|
|
19
|
+
};
|
|
20
|
+
/** Serializable selection marker; selection occurs in generated app code. */
|
|
21
|
+
interface OperatingSystemValue {
|
|
22
|
+
readonly __kind: 'operatingSystem';
|
|
23
|
+
readonly default?: NativeSelectableValue;
|
|
24
|
+
readonly ios?: NativeSelectableValue;
|
|
25
|
+
readonly android?: NativeSelectableValue;
|
|
26
|
+
}
|
|
27
|
+
type NativeTokenValue = NativeSelectableValue | OperatingSystemValue;
|
|
28
|
+
type NativeTokenDefinition = TokenDefinitionFor<NativeTokenValue>;
|
|
29
|
+
type NativeTokenGroupDefinition = TokenGroupDefinitionFor<NativeTokenDefinition>;
|
|
30
|
+
interface NativeFontAssetMember {
|
|
31
|
+
/** Font-family value React Native consumes after the font is installed. */
|
|
32
|
+
postscriptName: string;
|
|
33
|
+
}
|
|
34
|
+
interface NativeFontAssetGroupDefinition {
|
|
35
|
+
assetKind: 'font';
|
|
36
|
+
members: Record<string, NativeFontAssetMember>;
|
|
37
|
+
label?: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
}
|
|
40
|
+
type NativeAssetGroupDefinition = NativeFontAssetGroupDefinition;
|
|
41
|
+
interface SerializedNativeConfig {
|
|
42
|
+
schemaVersion: number;
|
|
43
|
+
platform: 'native';
|
|
44
|
+
builtAt?: string;
|
|
45
|
+
namespace?: string;
|
|
46
|
+
modes?: Record<string, ModeDefinition>;
|
|
47
|
+
tokenGroups?: Record<string, NativeTokenGroupDefinition>;
|
|
48
|
+
assetGroups?: Record<string, NativeAssetGroupDefinition>;
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
export { NativeAssetGroupDefinition, NativeColorExpression, NativeFontAssetGroupDefinition, NativeFontAssetMember, NativeLiteral, NativeSelectableValue, NativeTokenDefinition, NativeTokenGroupDefinition, NativeTokenValue, OperatingSystemInput, OperatingSystemValue, SerializedNativeConfig };
|
|
File without changes
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ConfigDiagnostic } from "../config-diagnostics.js";
|
|
2
|
+
|
|
3
|
+
//#region src/native/validation.d.ts
|
|
4
|
+
type NativeConfigDiagnosticCode = 'INVALID_SCHEMA' | 'UNSUPPORTED_SCHEMA_VERSION' | 'PLATFORM_MISMATCH' | 'INVALID_NAMESPACE' | 'INVALID_NATIVE_VALUE' | 'UNSUPPORTED_NATIVE_FIELD' | 'INCOMPLETE_OS_VALUE' | 'NESTED_OS_VALUE' | 'INVALID_REFERENCE' | 'UNRESOLVED_TOKEN_REFERENCE' | 'TOKEN_REFERENCE_CYCLE' | 'UNRESOLVED_ASSET_REFERENCE' | 'UNOWNED_MODIFIER' | 'UNSUPPORTED_COLOR_EXPRESSION';
|
|
5
|
+
type NativeConfigDiagnostic = ConfigDiagnostic<NativeConfigDiagnosticCode>;
|
|
6
|
+
declare function validateSerializedNativeConfig(input: unknown, expectedSchemaVersion?: number): NativeConfigDiagnostic[];
|
|
7
|
+
//#endregion
|
|
8
|
+
export { NativeConfigDiagnostic, NativeConfigDiagnosticCode, validateSerializedNativeConfig };
|