Skip to content

Commit

Permalink
ProjectionDefinition
Browse files Browse the repository at this point in the history
  • Loading branch information
birkskyum committed Nov 13, 2024
1 parent d4e7a02 commit 5ffbdb5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/expression/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ export function createPropertyExpression(expressionInput: unknown, propertySpec:
}

import {isFunction, createFunction} from '../function';
import {Color, Projection, VariableAnchorOffsetCollection} from './values';
import {Color, ProjectionDefinition, VariableAnchorOffsetCollection} from './values';

// serialization wrapper for old-style stop functions normalized to the
// expression interface
Expand Down Expand Up @@ -480,7 +480,7 @@ function getDefaultValue(spec: StylePropertySpecification): Value {
} else if (spec.type === 'variableAnchorOffsetCollection') {
return VariableAnchorOffsetCollection.parse(spec.default) || null;
} else if (spec.type === 'projectionDefinition') {
return Projection.parse(spec.default) || null;
return ProjectionDefinition.parse(spec.default) || null;
} else if (spec.default === undefined) {
return null;
} else {
Expand Down
12 changes: 6 additions & 6 deletions src/expression/values.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import ResolvedImage from './types/resolved_image';
import {NullType, NumberType, StringType, BooleanType, ColorType, ObjectType, ValueType, CollatorType, FormattedType, ResolvedImageType, array, PaddingType, VariableAnchorOffsetCollectionType, ProjectionDefinitionType} from './types';

import type {Type} from './types';
import Projection from '../util/projection';
import ProjectionDefinition from '../util/projection';

export function validateRGBA(r: unknown, g: unknown, b: unknown, a?: unknown): string | null {
if (!(
Expand All @@ -29,7 +29,7 @@ export function validateRGBA(r: unknown, g: unknown, b: unknown, a?: unknown): s
return null;
}

export type Value = null | string | boolean | number | Color | Projection | Collator | Formatted | Padding | ResolvedImage | VariableAnchorOffsetCollection | ReadonlyArray<Value> | {
export type Value = null | string | boolean | number | Color | ProjectionDefinition | Collator | Formatted | Padding | ResolvedImage | VariableAnchorOffsetCollection | ReadonlyArray<Value> | {
readonly [x: string]: Value;
};

Expand All @@ -38,7 +38,7 @@ export function isValue(mixed: unknown): boolean {
typeof mixed === 'string' ||
typeof mixed === 'boolean' ||
typeof mixed === 'number' ||
mixed instanceof Projection ||
mixed instanceof ProjectionDefinition ||
mixed instanceof Color ||
mixed instanceof Collator ||
mixed instanceof Formatted ||
Expand Down Expand Up @@ -76,7 +76,7 @@ export function typeOf(value: Value): Type {
return NumberType;
} else if (value instanceof Color) {
return ColorType;
} else if (value instanceof Projection) {
} else if (value instanceof ProjectionDefinition) {
return ProjectionDefinitionType;
} else if (value instanceof Collator) {
return CollatorType;
Expand Down Expand Up @@ -116,11 +116,11 @@ export function toString(value: Value) {
return '';
} else if (type === 'string' || type === 'number' || type === 'boolean') {
return String(value);
} else if (value instanceof Color || value instanceof Projection || value instanceof Formatted || value instanceof Padding || value instanceof VariableAnchorOffsetCollection || value instanceof ResolvedImage) {
} else if (value instanceof Color || value instanceof ProjectionDefinition || value instanceof Formatted || value instanceof Padding || value instanceof VariableAnchorOffsetCollection || value instanceof ResolvedImage) {
return value.toString();
} else {
return JSON.stringify(value);
}
}

export {Color, Collator, Projection, Padding, VariableAnchorOffsetCollection};
export {Color, Collator, ProjectionDefinition, Padding, VariableAnchorOffsetCollection};

0 comments on commit 5ffbdb5

Please sign in to comment.