|
|
|
@ -7,6 +7,11 @@ import {
|
|
|
|
CONTAINER_WIDTH_KEYS,
|
|
|
|
CONTAINER_WIDTH_KEYS,
|
|
|
|
CONTENT_WIDTH_KEYS,
|
|
|
|
CONTENT_WIDTH_KEYS,
|
|
|
|
DENSITY_KEYS,
|
|
|
|
DENSITY_KEYS,
|
|
|
|
|
|
|
|
DURATION_KEYS,
|
|
|
|
|
|
|
|
EASE_KEYS,
|
|
|
|
|
|
|
|
ICON_STROKE_WIDTH_KEYS,
|
|
|
|
|
|
|
|
MOTION_DISTANCE_KEYS,
|
|
|
|
|
|
|
|
MOTION_SCALE_KEYS,
|
|
|
|
OPACITY_KEYS,
|
|
|
|
OPACITY_KEYS,
|
|
|
|
SHADOW_KEYS,
|
|
|
|
SHADOW_KEYS,
|
|
|
|
SIZE_PRIMITIVE_KEYS,
|
|
|
|
SIZE_PRIMITIVE_KEYS,
|
|
|
|
@ -45,6 +50,11 @@ const BORDER_STYLE_KEY_SET = new Set<string>(BORDER_STYLE_KEYS)
|
|
|
|
const CONTAINER_WIDTH_KEY_SET = new Set<string>(CONTAINER_WIDTH_KEYS)
|
|
|
|
const CONTAINER_WIDTH_KEY_SET = new Set<string>(CONTAINER_WIDTH_KEYS)
|
|
|
|
const CONTENT_WIDTH_KEY_SET = new Set<string>(CONTENT_WIDTH_KEYS)
|
|
|
|
const CONTENT_WIDTH_KEY_SET = new Set<string>(CONTENT_WIDTH_KEYS)
|
|
|
|
const DENSITY_KEY_SET = new Set<string>(DENSITY_KEYS)
|
|
|
|
const DENSITY_KEY_SET = new Set<string>(DENSITY_KEYS)
|
|
|
|
|
|
|
|
const DURATION_KEY_SET = new Set<string>(DURATION_KEYS)
|
|
|
|
|
|
|
|
const EASE_KEY_SET = new Set<string>(EASE_KEYS)
|
|
|
|
|
|
|
|
const ICON_STROKE_WIDTH_KEY_SET = new Set<string>(ICON_STROKE_WIDTH_KEYS)
|
|
|
|
|
|
|
|
const MOTION_DISTANCE_KEY_SET = new Set<string>(MOTION_DISTANCE_KEYS)
|
|
|
|
|
|
|
|
const MOTION_SCALE_KEY_SET = new Set<string>(MOTION_SCALE_KEYS)
|
|
|
|
const OPACITY_KEY_SET = new Set<string>(OPACITY_KEYS)
|
|
|
|
const OPACITY_KEY_SET = new Set<string>(OPACITY_KEYS)
|
|
|
|
const SHADOW_KEY_SET = new Set<string>(SHADOW_KEYS)
|
|
|
|
const SHADOW_KEY_SET = new Set<string>(SHADOW_KEYS)
|
|
|
|
const SIZE_PRIMITIVE_KEY_SET = new Set<string>(SIZE_PRIMITIVE_KEYS)
|
|
|
|
const SIZE_PRIMITIVE_KEY_SET = new Set<string>(SIZE_PRIMITIVE_KEYS)
|
|
|
|
@ -96,6 +106,8 @@ export function validateEidosConfig(options: EidosConfig): EidosValidationReport
|
|
|
|
validateBorderPrimitives(options, issues)
|
|
|
|
validateBorderPrimitives(options, issues)
|
|
|
|
validateLayoutPrimitives(options, issues)
|
|
|
|
validateLayoutPrimitives(options, issues)
|
|
|
|
validateDensityPrimitives(options, issues)
|
|
|
|
validateDensityPrimitives(options, issues)
|
|
|
|
|
|
|
|
validateMotionPrimitives(options, issues)
|
|
|
|
|
|
|
|
validateIconPrimitives(options, issues)
|
|
|
|
validateRecipeTokens(options, issues)
|
|
|
|
validateRecipeTokens(options, issues)
|
|
|
|
validateRecordPrimitive(
|
|
|
|
validateRecordPrimitive(
|
|
|
|
'primitives.opacity',
|
|
|
|
'primitives.opacity',
|
|
|
|
@ -629,6 +641,55 @@ function validateDensityPrimitives(options: EidosConfig, issues: EidosValidation
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function validateMotionPrimitives(options: EidosConfig, issues: EidosValidationIssue[]): void {
|
|
|
|
|
|
|
|
const motion = options.primitives.motion
|
|
|
|
|
|
|
|
if (!motion) return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
validateRecordPrimitive(
|
|
|
|
|
|
|
|
'primitives.motion.duration',
|
|
|
|
|
|
|
|
motion.duration,
|
|
|
|
|
|
|
|
DURATION_KEYS,
|
|
|
|
|
|
|
|
DURATION_KEY_SET,
|
|
|
|
|
|
|
|
issues
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
validateRecordPrimitive('primitives.motion.ease', motion.ease, EASE_KEYS, EASE_KEY_SET, issues)
|
|
|
|
|
|
|
|
validateRecordPrimitive(
|
|
|
|
|
|
|
|
'primitives.motion.distance',
|
|
|
|
|
|
|
|
motion.distance,
|
|
|
|
|
|
|
|
MOTION_DISTANCE_KEYS,
|
|
|
|
|
|
|
|
MOTION_DISTANCE_KEY_SET,
|
|
|
|
|
|
|
|
issues
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
validateRecordPrimitive(
|
|
|
|
|
|
|
|
'primitives.motion.scale',
|
|
|
|
|
|
|
|
motion.scale,
|
|
|
|
|
|
|
|
MOTION_SCALE_KEYS,
|
|
|
|
|
|
|
|
MOTION_SCALE_KEY_SET,
|
|
|
|
|
|
|
|
issues
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
validateNonEmptyCssValue('primitives.motion.stagger', motion.stagger, issues)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function validateIconPrimitives(options: EidosConfig, issues: EidosValidationIssue[]): void {
|
|
|
|
|
|
|
|
const icon = options.primitives.icon
|
|
|
|
|
|
|
|
if (!icon) return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
validateRecordPrimitive(
|
|
|
|
|
|
|
|
'primitives.icon.size',
|
|
|
|
|
|
|
|
icon.size,
|
|
|
|
|
|
|
|
SIZE_PRIMITIVE_KEYS,
|
|
|
|
|
|
|
|
SIZE_PRIMITIVE_KEY_SET,
|
|
|
|
|
|
|
|
issues
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
validateRecordPrimitive(
|
|
|
|
|
|
|
|
'primitives.icon.strokeWidth',
|
|
|
|
|
|
|
|
icon.strokeWidth,
|
|
|
|
|
|
|
|
ICON_STROKE_WIDTH_KEYS,
|
|
|
|
|
|
|
|
ICON_STROKE_WIDTH_KEY_SET,
|
|
|
|
|
|
|
|
issues
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function validateRecipeTokens(options: EidosConfig, issues: EidosValidationIssue[]): void {
|
|
|
|
function validateRecipeTokens(options: EidosConfig, issues: EidosValidationIssue[]): void {
|
|
|
|
for (const [component, tokens] of Object.entries(options.recipes ?? {})) {
|
|
|
|
for (const [component, tokens] of Object.entries(options.recipes ?? {})) {
|
|
|
|
if (!isCssTokenSegment(component)) {
|
|
|
|
if (!isCssTokenSegment(component)) {
|
|
|
|
|