@mapbox/mapbox-gl-style-spec 14.11.0-beta.1 → 14.11.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/index.cjs +212 -134
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +51 -39
- package/dist/index.es.js +212 -134
- package/dist/index.es.js.map +1 -1
- package/expression/definitions/image.ts +126 -82
- package/expression/definitions/interpolate.ts +1 -1
- package/expression/evaluation_context.ts +2 -1
- package/expression/index.ts +11 -10
- package/expression/types/formatted.ts +7 -3
- package/expression/types/image_id.ts +59 -0
- package/expression/types/image_variant.ts +79 -0
- package/expression/types/resolved_image.ts +44 -53
- package/expression/types.ts +1 -1
- package/function/index.ts +3 -3
- package/package.json +1 -1
- package/read_style.ts +4 -6
- package/reference/v8.json +2 -1
- package/test.js +0 -1
- package/types/brand.ts +4 -0
- package/util/interpolate.ts +4 -0
- package/validate/validate_style.ts +2 -1
- package/validate_style.min.ts +17 -15
- package/validate_style.ts +3 -3
- package/expression/types/image_id_with_options.ts +0 -58
package/dist/index.d.ts
CHANGED
|
@@ -1498,39 +1498,52 @@ declare class Collator {
|
|
|
1498
1498
|
compare(lhs: string, rhs: string): number;
|
|
1499
1499
|
resolvedLocale(): string;
|
|
1500
1500
|
}
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1501
|
+
type Brand<T, U> = T & {
|
|
1502
|
+
__brand: U;
|
|
1503
|
+
};
|
|
1504
|
+
type ImageIdSpec = {
|
|
1505
|
+
name: string;
|
|
1506
|
+
iconsetId?: string;
|
|
1507
|
+
};
|
|
1508
|
+
type StringifiedImageId = Brand<string, "ImageId">;
|
|
1509
|
+
declare class ImageId {
|
|
1510
|
+
name: string;
|
|
1511
|
+
iconsetId?: string;
|
|
1512
|
+
constructor(id: string | ImageId | ImageIdSpec);
|
|
1513
|
+
static from(id: string | ImageId | ImageIdSpec): ImageId;
|
|
1514
|
+
static toString(id: ImageId | ImageIdSpec): StringifiedImageId;
|
|
1515
|
+
static parse(str: StringifiedImageId): ImageId | null;
|
|
1516
|
+
static isEqual(a: ImageId | ImageIdSpec, b: ImageId | ImageIdSpec): boolean;
|
|
1517
|
+
toString(): StringifiedImageId;
|
|
1518
|
+
serialize(): ImageIdSpec;
|
|
1509
1519
|
}
|
|
1520
|
+
type StringifiedImageVariant = Brand<string, "ImageVariant">;
|
|
1510
1521
|
type RasterizationOptions = {
|
|
1511
|
-
params
|
|
1522
|
+
params?: Record<string, Color>;
|
|
1512
1523
|
transform?: DOMMatrix;
|
|
1513
1524
|
};
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1525
|
+
declare class ImageVariant {
|
|
1526
|
+
id: ImageId;
|
|
1527
|
+
options: RasterizationOptions;
|
|
1528
|
+
constructor(id: string | ImageIdSpec, options?: RasterizationOptions);
|
|
1529
|
+
toString(): StringifiedImageVariant;
|
|
1530
|
+
static parse(str: StringifiedImageVariant): ImageVariant | null;
|
|
1531
|
+
scaleSelf(factor: number): this;
|
|
1532
|
+
}
|
|
1521
1533
|
declare class ResolvedImage {
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1534
|
+
primaryId: ImageId;
|
|
1535
|
+
primaryOptions?: RasterizationOptions;
|
|
1536
|
+
secondaryId?: ImageId;
|
|
1537
|
+
secondaryOptions?: RasterizationOptions;
|
|
1526
1538
|
available: boolean;
|
|
1527
|
-
constructor(
|
|
1539
|
+
constructor(primaryId: string | ImageIdSpec, primaryOptions?: RasterizationOptions, secondaryId?: string | ImageIdSpec, secondaryOptions?: RasterizationOptions, available?: boolean);
|
|
1528
1540
|
toString(): string;
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1541
|
+
hasPrimary(): boolean;
|
|
1542
|
+
getPrimary(): ImageVariant;
|
|
1543
|
+
hasSecondary(): boolean;
|
|
1544
|
+
getSecondary(): ImageVariant | null;
|
|
1532
1545
|
static from(image: string | ResolvedImage): ResolvedImage;
|
|
1533
|
-
static build(
|
|
1546
|
+
static build(primaryId: string | ImageIdSpec, secondaryId?: string | ImageIdSpec, primaryOptions?: RasterizationOptions, secondaryOptions?: RasterizationOptions): ResolvedImage | null;
|
|
1534
1547
|
}
|
|
1535
1548
|
declare class FormattedSection {
|
|
1536
1549
|
text: string;
|
|
@@ -1583,8 +1596,7 @@ type ResolvedImageTypeT = {
|
|
|
1583
1596
|
kind: "resolvedImage";
|
|
1584
1597
|
};
|
|
1585
1598
|
type EvaluationKind = "constant" | "source" | "camera" | "composite";
|
|
1586
|
-
type Type = NullTypeT | NumberTypeT | StringTypeT | BooleanTypeT | ColorTypeT | ObjectTypeT | ValueTypeT |
|
|
1587
|
-
ArrayType | ErrorTypeT | CollatorTypeT | FormattedTypeT | ResolvedImageTypeT;
|
|
1599
|
+
type Type = NullTypeT | NumberTypeT | StringTypeT | BooleanTypeT | ColorTypeT | ObjectTypeT | ValueTypeT | ArrayType | ErrorTypeT | CollatorTypeT | FormattedTypeT | ResolvedImageTypeT;
|
|
1588
1600
|
type ArrayType = {
|
|
1589
1601
|
kind: "array";
|
|
1590
1602
|
itemType: Type;
|
|
@@ -1656,7 +1668,7 @@ declare class EvaluationContext {
|
|
|
1656
1668
|
feature: Feature | null | undefined;
|
|
1657
1669
|
featureState: FeatureState | null | undefined;
|
|
1658
1670
|
formattedSection: FormattedSection | null | undefined;
|
|
1659
|
-
availableImages:
|
|
1671
|
+
availableImages: ImageId[] | null | undefined;
|
|
1660
1672
|
canonical: null | CanonicalTileID;
|
|
1661
1673
|
featureTileCoord: Point | null | undefined;
|
|
1662
1674
|
featureDistanceData: FeatureDistanceData | null | undefined;
|
|
@@ -1737,8 +1749,8 @@ declare class StyleExpression {
|
|
|
1737
1749
|
};
|
|
1738
1750
|
configDependencies: Set<string>;
|
|
1739
1751
|
constructor(expression: Expression, propertySpec?: StylePropertySpecification, scope?: string, options?: ConfigOptions);
|
|
1740
|
-
evaluateWithoutErrorHandling(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?:
|
|
1741
|
-
evaluate(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?:
|
|
1752
|
+
evaluateWithoutErrorHandling(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[], formattedSection?: FormattedSection, featureTileCoord?: Point, featureDistanceData?: FeatureDistanceData): any;
|
|
1753
|
+
evaluate(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[], formattedSection?: FormattedSection, featureTileCoord?: Point, featureDistanceData?: FeatureDistanceData): any;
|
|
1742
1754
|
}
|
|
1743
1755
|
declare function isExpression(expression: unknown): boolean;
|
|
1744
1756
|
declare function createExpression(expression: unknown, propertySpec?: StylePropertySpecification | null, scope?: string | null, options?: ConfigOptions | null): Result<StyleExpression, Array<ParsingError$1>>;
|
|
@@ -1750,8 +1762,8 @@ declare class ZoomConstantExpression<Kind extends EvaluationKind> {
|
|
|
1750
1762
|
isLightConstant: boolean | null | undefined;
|
|
1751
1763
|
isLineProgressConstant: boolean | null | undefined;
|
|
1752
1764
|
constructor(kind: Kind, expression: StyleExpression, isLightConstant?: boolean | null, isLineProgressConstant?: boolean | null);
|
|
1753
|
-
evaluateWithoutErrorHandling(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?:
|
|
1754
|
-
evaluate(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?:
|
|
1765
|
+
evaluateWithoutErrorHandling(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[], formattedSection?: FormattedSection): any;
|
|
1766
|
+
evaluate(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[], formattedSection?: FormattedSection): any;
|
|
1755
1767
|
}
|
|
1756
1768
|
declare class ZoomDependentExpression<Kind extends EvaluationKind> {
|
|
1757
1769
|
kind: Kind;
|
|
@@ -1763,14 +1775,14 @@ declare class ZoomDependentExpression<Kind extends EvaluationKind> {
|
|
|
1763
1775
|
_styleExpression: StyleExpression;
|
|
1764
1776
|
interpolationType: InterpolationType | null | undefined;
|
|
1765
1777
|
constructor(kind: Kind, expression: StyleExpression, zoomStops: Array<number>, interpolationType?: InterpolationType, isLightConstant?: boolean | null, isLineProgressConstant?: boolean | null);
|
|
1766
|
-
evaluateWithoutErrorHandling(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?:
|
|
1767
|
-
evaluate(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?:
|
|
1778
|
+
evaluateWithoutErrorHandling(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[], formattedSection?: FormattedSection): any;
|
|
1779
|
+
evaluate(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[], formattedSection?: FormattedSection): any;
|
|
1768
1780
|
interpolationFactor(input: number, lower: number, upper: number): number;
|
|
1769
1781
|
}
|
|
1770
1782
|
type ConstantExpression = {
|
|
1771
1783
|
kind: "constant";
|
|
1772
1784
|
configDependencies: Set<string>;
|
|
1773
|
-
readonly evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?:
|
|
1785
|
+
readonly evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[]) => any;
|
|
1774
1786
|
};
|
|
1775
1787
|
type SourceExpression = {
|
|
1776
1788
|
kind: "source";
|
|
@@ -1778,13 +1790,13 @@ type SourceExpression = {
|
|
|
1778
1790
|
isLightConstant: boolean | null | undefined;
|
|
1779
1791
|
isLineProgressConstant: boolean | null | undefined;
|
|
1780
1792
|
configDependencies: Set<string>;
|
|
1781
|
-
readonly evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?:
|
|
1793
|
+
readonly evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[], formattedSection?: FormattedSection) => any;
|
|
1782
1794
|
};
|
|
1783
1795
|
type CameraExpression = {
|
|
1784
1796
|
kind: "camera";
|
|
1785
1797
|
isStateDependent: boolean;
|
|
1786
1798
|
configDependencies: Set<string>;
|
|
1787
|
-
readonly evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?:
|
|
1799
|
+
readonly evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[]) => any;
|
|
1788
1800
|
readonly interpolationFactor: (input: number, lower: number, upper: number) => number;
|
|
1789
1801
|
zoomStops: Array<number>;
|
|
1790
1802
|
interpolationType: InterpolationType | null | undefined;
|
|
@@ -1795,7 +1807,7 @@ interface CompositeExpression {
|
|
|
1795
1807
|
isLightConstant: boolean | null | undefined;
|
|
1796
1808
|
isLineProgressConstant: boolean | null | undefined;
|
|
1797
1809
|
configDependencies: Set<string>;
|
|
1798
|
-
readonly evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?:
|
|
1810
|
+
readonly evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[], formattedSection?: FormattedSection) => any;
|
|
1799
1811
|
readonly interpolationFactor: (input: number, lower: number, upper: number) => number;
|
|
1800
1812
|
zoomStops: Array<number>;
|
|
1801
1813
|
interpolationType: InterpolationType | null | undefined;
|
|
@@ -1894,7 +1906,7 @@ type ValidationErrors = ReadonlyArray<ValidationError$1>;
|
|
|
1894
1906
|
* var style = fs.readFileSync('./style.json', 'utf8');
|
|
1895
1907
|
* var errors = validate(style);
|
|
1896
1908
|
*/
|
|
1897
|
-
declare function validateStyle(style: StyleSpecification | string | Buffer, styleSpec?:
|
|
1909
|
+
declare function validateStyle(style: StyleSpecification | string | Buffer, styleSpec?: StyleReference): ValidationErrors;
|
|
1898
1910
|
/**
|
|
1899
1911
|
* Validate a Mapbox GL style against the style specification and check for
|
|
1900
1912
|
* compatibility with the Mapbox Styles API.
|