@mapbox/mapbox-gl-style-spec 14.10.0 → 14.11.0-beta.2
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/composite.ts +1 -0
- package/dist/index.cjs +467 -191
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +76 -39
- package/dist/index.es.js +467 -191
- package/dist/index.es.js.map +1 -1
- package/expression/compound_expression.ts +5 -7
- package/expression/definitions/at.ts +5 -19
- package/expression/definitions/at_interpolated.ts +80 -0
- package/expression/definitions/coercion.ts +1 -5
- package/expression/definitions/comparison.ts +2 -8
- package/expression/definitions/config.ts +1 -4
- package/expression/definitions/distance.ts +28 -43
- package/expression/definitions/format.ts +4 -9
- package/expression/definitions/image.ts +126 -73
- package/expression/definitions/index.ts +3 -2
- package/expression/definitions/interpolate.ts +28 -80
- package/expression/definitions/let.ts +2 -7
- package/expression/definitions/literal.ts +1 -2
- package/expression/definitions/match.ts +3 -12
- package/expression/definitions/step.ts +1 -5
- package/expression/evaluation_context.ts +3 -3
- package/expression/index.ts +12 -18
- package/expression/parsing_context.ts +3 -7
- package/expression/types/formatted.ts +7 -3
- package/expression/types/image_id.ts +61 -0
- package/expression/types/image_variant.ts +79 -0
- package/expression/types/resolved_image.ts +44 -53
- package/format.ts +1 -0
- package/function/index.ts +1 -0
- package/migrate/v8.ts +1 -0
- package/migrate/v9.ts +1 -0
- package/migrate.ts +1 -0
- package/package.json +1 -1
- package/read_style.ts +1 -0
- package/reference/v8.json +154 -7
- package/types/brand.ts +4 -0
- package/types.ts +30 -2
- package/util/color.ts +1 -1
- package/validate/validate.ts +6 -1
- package/validate/validate_iconset.ts +40 -0
- package/validate/validate_layer.ts +1 -5
- package/validate/validate_lights.ts +3 -2
- package/validate/validate_object.ts +2 -0
- package/validate/validate_style.ts +0 -1
- package/expression/types/image_id_with_options.ts +0 -58
package/dist/index.d.ts
CHANGED
|
@@ -209,6 +209,10 @@ type StyleSpecification = {
|
|
|
209
209
|
*/
|
|
210
210
|
"indoor"?: IndoorSpecification;
|
|
211
211
|
"imports"?: Array<ImportSpecification>;
|
|
212
|
+
/**
|
|
213
|
+
* @experimental This property is experimental and subject to change in future versions.
|
|
214
|
+
*/
|
|
215
|
+
"iconsets"?: IconsetsSpecification;
|
|
212
216
|
"schema"?: SchemaSpecification;
|
|
213
217
|
"sources": SourcesSpecification;
|
|
214
218
|
"sprite"?: string;
|
|
@@ -228,6 +232,9 @@ type SourcesSpecification = {
|
|
|
228
232
|
type ModelsSpecification = {
|
|
229
233
|
[_: string]: ModelSpecification;
|
|
230
234
|
};
|
|
235
|
+
type IconsetsSpecification = {
|
|
236
|
+
[_: string]: IconsetSpecification;
|
|
237
|
+
};
|
|
231
238
|
type LightSpecification = {
|
|
232
239
|
"anchor"?: PropertyValueSpecification<"map" | "viewport">;
|
|
233
240
|
"position"?: PropertyValueSpecification<[
|
|
@@ -557,6 +564,13 @@ type ModelSourceSpecification = {
|
|
|
557
564
|
"tiles"?: Array<string>;
|
|
558
565
|
};
|
|
559
566
|
type SourceSpecification = VectorSourceSpecification | RasterSourceSpecification | RasterDEMSourceSpecification | RasterArraySourceSpecification | GeoJSONSourceSpecification | VideoSourceSpecification | ImageSourceSpecification | ModelSourceSpecification;
|
|
567
|
+
type IconsetSpecification = {
|
|
568
|
+
"type": "sprite";
|
|
569
|
+
"url": string;
|
|
570
|
+
} | {
|
|
571
|
+
"type": "source";
|
|
572
|
+
"source": string;
|
|
573
|
+
};
|
|
560
574
|
type ModelSpecification = string;
|
|
561
575
|
type AmbientLightSpecification = {
|
|
562
576
|
"id": string;
|
|
@@ -628,6 +642,10 @@ type FillLayerSpecification = {
|
|
|
628
642
|
* @experimental This property is experimental and subject to change in future versions.
|
|
629
643
|
*/
|
|
630
644
|
"fill-elevation-reference"?: "none" | "hd-road-base" | "hd-road-markup" | ExpressionSpecification;
|
|
645
|
+
/**
|
|
646
|
+
* @experimental This property is experimental and subject to change in future versions.
|
|
647
|
+
*/
|
|
648
|
+
"fill-construct-bridge-guard-rail"?: DataDrivenPropertyValueSpecification<boolean>;
|
|
631
649
|
};
|
|
632
650
|
"paint"?: {
|
|
633
651
|
"fill-antialias"?: PropertyValueSpecification<boolean>;
|
|
@@ -650,6 +668,12 @@ type FillLayerSpecification = {
|
|
|
650
668
|
"fill-emissive-strength-transition"?: TransitionSpecification;
|
|
651
669
|
"fill-z-offset"?: DataDrivenPropertyValueSpecification<number>;
|
|
652
670
|
"fill-z-offset-transition"?: TransitionSpecification;
|
|
671
|
+
"fill-bridge-guard-rail-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>;
|
|
672
|
+
"fill-bridge-guard-rail-color-transition"?: TransitionSpecification;
|
|
673
|
+
"fill-bridge-guard-rail-color-use-theme"?: PropertyValueSpecification<string>;
|
|
674
|
+
"fill-tunnel-structure-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>;
|
|
675
|
+
"fill-tunnel-structure-color-transition"?: TransitionSpecification;
|
|
676
|
+
"fill-tunnel-structure-color-use-theme"?: PropertyValueSpecification<string>;
|
|
653
677
|
};
|
|
654
678
|
};
|
|
655
679
|
type LineLayerSpecification = {
|
|
@@ -1376,7 +1400,7 @@ export declare class Color {
|
|
|
1376
1400
|
* Parses valid CSS color strings and returns a `Color` instance.
|
|
1377
1401
|
* @returns A `Color` instance, or `undefined` if the input is not a valid color string.
|
|
1378
1402
|
*/
|
|
1379
|
-
static parse(input?: string | Color | null): Color |
|
|
1403
|
+
static parse(input?: string | Color | null): Color | undefined;
|
|
1380
1404
|
/**
|
|
1381
1405
|
* Returns an RGBA string representing the color value.
|
|
1382
1406
|
*
|
|
@@ -1474,39 +1498,52 @@ declare class Collator {
|
|
|
1474
1498
|
compare(lhs: string, rhs: string): number;
|
|
1475
1499
|
resolvedLocale(): string;
|
|
1476
1500
|
}
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
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;
|
|
1485
1519
|
}
|
|
1520
|
+
type StringifiedImageVariant = Brand<string, "ImageVariant">;
|
|
1486
1521
|
type RasterizationOptions = {
|
|
1487
|
-
params
|
|
1522
|
+
params?: Record<string, Color>;
|
|
1488
1523
|
transform?: DOMMatrix;
|
|
1489
1524
|
};
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
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
|
+
}
|
|
1497
1533
|
declare class ResolvedImage {
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1534
|
+
primaryId: ImageId;
|
|
1535
|
+
primaryOptions?: RasterizationOptions;
|
|
1536
|
+
secondaryId?: ImageId;
|
|
1537
|
+
secondaryOptions?: RasterizationOptions;
|
|
1502
1538
|
available: boolean;
|
|
1503
|
-
constructor(
|
|
1539
|
+
constructor(primaryId: string | ImageIdSpec, primaryOptions?: RasterizationOptions, secondaryId?: string | ImageIdSpec, secondaryOptions?: RasterizationOptions, available?: boolean);
|
|
1504
1540
|
toString(): string;
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1541
|
+
hasPrimary(): boolean;
|
|
1542
|
+
getPrimary(): ImageVariant;
|
|
1543
|
+
hasSecondary(): boolean;
|
|
1544
|
+
getSecondary(): ImageVariant | null;
|
|
1508
1545
|
static from(image: string | ResolvedImage): ResolvedImage;
|
|
1509
|
-
static build(
|
|
1546
|
+
static build(primaryId: string | ImageIdSpec, secondaryId?: string | ImageIdSpec, primaryOptions?: RasterizationOptions, secondaryOptions?: RasterizationOptions): ResolvedImage | null;
|
|
1510
1547
|
}
|
|
1511
1548
|
declare class FormattedSection {
|
|
1512
1549
|
text: string;
|
|
@@ -1632,7 +1669,7 @@ declare class EvaluationContext {
|
|
|
1632
1669
|
feature: Feature | null | undefined;
|
|
1633
1670
|
featureState: FeatureState | null | undefined;
|
|
1634
1671
|
formattedSection: FormattedSection | null | undefined;
|
|
1635
|
-
availableImages:
|
|
1672
|
+
availableImages: ImageId[] | null | undefined;
|
|
1636
1673
|
canonical: null | CanonicalTileID;
|
|
1637
1674
|
featureTileCoord: Point | null | undefined;
|
|
1638
1675
|
featureDistanceData: FeatureDistanceData | null | undefined;
|
|
@@ -1651,7 +1688,7 @@ declare class EvaluationContext {
|
|
|
1651
1688
|
};
|
|
1652
1689
|
measureLight(_: string): number;
|
|
1653
1690
|
distanceFromCenter(): number;
|
|
1654
|
-
parseColor(input: string): Color |
|
|
1691
|
+
parseColor(input: string): Color | undefined;
|
|
1655
1692
|
getConfig(id: string): ConfigOptionValue | null | undefined;
|
|
1656
1693
|
}
|
|
1657
1694
|
type Result<T, E> = {
|
|
@@ -1713,8 +1750,8 @@ declare class StyleExpression {
|
|
|
1713
1750
|
};
|
|
1714
1751
|
configDependencies: Set<string>;
|
|
1715
1752
|
constructor(expression: Expression, propertySpec?: StylePropertySpecification, scope?: string, options?: ConfigOptions);
|
|
1716
|
-
evaluateWithoutErrorHandling(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?:
|
|
1717
|
-
evaluate(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?:
|
|
1753
|
+
evaluateWithoutErrorHandling(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[], formattedSection?: FormattedSection, featureTileCoord?: Point, featureDistanceData?: FeatureDistanceData): any;
|
|
1754
|
+
evaluate(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[], formattedSection?: FormattedSection, featureTileCoord?: Point, featureDistanceData?: FeatureDistanceData): any;
|
|
1718
1755
|
}
|
|
1719
1756
|
declare function isExpression(expression: unknown): boolean;
|
|
1720
1757
|
declare function createExpression(expression: unknown, propertySpec?: StylePropertySpecification | null, scope?: string | null, options?: ConfigOptions | null): Result<StyleExpression, Array<ParsingError$1>>;
|
|
@@ -1726,8 +1763,8 @@ declare class ZoomConstantExpression<Kind extends EvaluationKind> {
|
|
|
1726
1763
|
isLightConstant: boolean | null | undefined;
|
|
1727
1764
|
isLineProgressConstant: boolean | null | undefined;
|
|
1728
1765
|
constructor(kind: Kind, expression: StyleExpression, isLightConstant?: boolean | null, isLineProgressConstant?: boolean | null);
|
|
1729
|
-
evaluateWithoutErrorHandling(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?:
|
|
1730
|
-
evaluate(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?:
|
|
1766
|
+
evaluateWithoutErrorHandling(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[], formattedSection?: FormattedSection): any;
|
|
1767
|
+
evaluate(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[], formattedSection?: FormattedSection): any;
|
|
1731
1768
|
}
|
|
1732
1769
|
declare class ZoomDependentExpression<Kind extends EvaluationKind> {
|
|
1733
1770
|
kind: Kind;
|
|
@@ -1739,14 +1776,14 @@ declare class ZoomDependentExpression<Kind extends EvaluationKind> {
|
|
|
1739
1776
|
_styleExpression: StyleExpression;
|
|
1740
1777
|
interpolationType: InterpolationType | null | undefined;
|
|
1741
1778
|
constructor(kind: Kind, expression: StyleExpression, zoomStops: Array<number>, interpolationType?: InterpolationType, isLightConstant?: boolean | null, isLineProgressConstant?: boolean | null);
|
|
1742
|
-
evaluateWithoutErrorHandling(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?:
|
|
1743
|
-
evaluate(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?:
|
|
1779
|
+
evaluateWithoutErrorHandling(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[], formattedSection?: FormattedSection): any;
|
|
1780
|
+
evaluate(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[], formattedSection?: FormattedSection): any;
|
|
1744
1781
|
interpolationFactor(input: number, lower: number, upper: number): number;
|
|
1745
1782
|
}
|
|
1746
1783
|
type ConstantExpression = {
|
|
1747
1784
|
kind: "constant";
|
|
1748
1785
|
configDependencies: Set<string>;
|
|
1749
|
-
readonly evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?:
|
|
1786
|
+
readonly evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[]) => any;
|
|
1750
1787
|
};
|
|
1751
1788
|
type SourceExpression = {
|
|
1752
1789
|
kind: "source";
|
|
@@ -1754,13 +1791,13 @@ type SourceExpression = {
|
|
|
1754
1791
|
isLightConstant: boolean | null | undefined;
|
|
1755
1792
|
isLineProgressConstant: boolean | null | undefined;
|
|
1756
1793
|
configDependencies: Set<string>;
|
|
1757
|
-
readonly evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?:
|
|
1794
|
+
readonly evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[], formattedSection?: FormattedSection) => any;
|
|
1758
1795
|
};
|
|
1759
1796
|
type CameraExpression = {
|
|
1760
1797
|
kind: "camera";
|
|
1761
1798
|
isStateDependent: boolean;
|
|
1762
1799
|
configDependencies: Set<string>;
|
|
1763
|
-
readonly evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?:
|
|
1800
|
+
readonly evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[]) => any;
|
|
1764
1801
|
readonly interpolationFactor: (input: number, lower: number, upper: number) => number;
|
|
1765
1802
|
zoomStops: Array<number>;
|
|
1766
1803
|
interpolationType: InterpolationType | null | undefined;
|
|
@@ -1771,13 +1808,13 @@ interface CompositeExpression {
|
|
|
1771
1808
|
isLightConstant: boolean | null | undefined;
|
|
1772
1809
|
isLineProgressConstant: boolean | null | undefined;
|
|
1773
1810
|
configDependencies: Set<string>;
|
|
1774
|
-
readonly evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?:
|
|
1811
|
+
readonly evaluate: (globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: ImageId[], formattedSection?: FormattedSection) => any;
|
|
1775
1812
|
readonly interpolationFactor: (input: number, lower: number, upper: number) => number;
|
|
1776
1813
|
zoomStops: Array<number>;
|
|
1777
1814
|
interpolationType: InterpolationType | null | undefined;
|
|
1778
1815
|
}
|
|
1779
1816
|
type StylePropertyExpression = ConstantExpression | SourceExpression | CameraExpression | CompositeExpression;
|
|
1780
|
-
declare function createPropertyExpression(expression:
|
|
1817
|
+
declare function createPropertyExpression(expression: any, propertySpec: StylePropertySpecification, scope?: string | null, options?: ConfigOptions | null): Result<StylePropertyExpression, Array<ParsingError$1>>;
|
|
1781
1818
|
declare class StylePropertyFunction<T> {
|
|
1782
1819
|
_parameters: PropertyValueSpecification<T>;
|
|
1783
1820
|
_specification: StylePropertySpecification;
|