@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.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
- declare class ImageIdWithOptions {
1502
- id: string;
1503
- options: RasterizationOptions;
1504
- constructor(id: string, options?: RasterizationOptions);
1505
- static deserializeId(serialized: string): string;
1506
- static deserializeFromString(serialized: string): ImageIdWithOptions;
1507
- scaleSelf(factor: number): this;
1508
- serialize(): string;
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: Record<string, Color>;
1522
+ params?: Record<string, Color>;
1512
1523
  transform?: DOMMatrix;
1513
1524
  };
1514
- type ResolvedImageOptions = {
1515
- namePrimary: string;
1516
- optionsPrimary: RasterizationOptions | null | undefined;
1517
- nameSecondary: string | null | undefined;
1518
- optionsSecondary: RasterizationOptions | null | undefined;
1519
- available: boolean;
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
- namePrimary: string;
1523
- optionsPrimary: RasterizationOptions | null | undefined;
1524
- nameSecondary: string | null | undefined;
1525
- optionsSecondary: RasterizationOptions | null | undefined;
1534
+ primaryId: ImageId;
1535
+ primaryOptions?: RasterizationOptions;
1536
+ secondaryId?: ImageId;
1537
+ secondaryOptions?: RasterizationOptions;
1526
1538
  available: boolean;
1527
- constructor(options: ResolvedImageOptions);
1539
+ constructor(primaryId: string | ImageIdSpec, primaryOptions?: RasterizationOptions, secondaryId?: string | ImageIdSpec, secondaryOptions?: RasterizationOptions, available?: boolean);
1528
1540
  toString(): string;
1529
- getPrimary(): ImageIdWithOptions;
1530
- getSerializedPrimary(): string;
1531
- getSecondary(): ImageIdWithOptions | null;
1541
+ hasPrimary(): boolean;
1542
+ getPrimary(): ImageVariant;
1543
+ hasSecondary(): boolean;
1544
+ getSecondary(): ImageVariant | null;
1532
1545
  static from(image: string | ResolvedImage): ResolvedImage;
1533
- static build(namePrimary: string, nameSecondary?: string | null, optionsPrimary?: RasterizationOptions | null, optionsSecondary?: RasterizationOptions | null): ResolvedImage | null;
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 | // eslint-disable-line no-use-before-define
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: Array<string> | null | undefined;
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?: Array<string>, formattedSection?: FormattedSection, featureTileCoord?: Point, featureDistanceData?: FeatureDistanceData): any;
1741
- evaluate(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: Array<string>, formattedSection?: FormattedSection, featureTileCoord?: Point, featureDistanceData?: FeatureDistanceData): any;
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?: Array<string>, formattedSection?: FormattedSection): any;
1754
- evaluate(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: Array<string>, formattedSection?: FormattedSection): any;
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?: Array<string>, formattedSection?: FormattedSection): any;
1767
- evaluate(globals: GlobalProperties, feature?: Feature, featureState?: FeatureState, canonical?: CanonicalTileID, availableImages?: Array<string>, formattedSection?: FormattedSection): any;
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?: Array<string>) => any;
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?: Array<string>, formattedSection?: FormattedSection) => any;
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?: Array<string>) => any;
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?: Array<string>, formattedSection?: FormattedSection) => any;
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?: any): ValidationErrors;
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.