Skip to content

Commit

Permalink
refactor: align casing on MapLibre and MapLibreRN usages
Browse files Browse the repository at this point in the history
  • Loading branch information
KiwiKilian committed Nov 18, 2024
1 parent fc2e2e8 commit c911a9d
Show file tree
Hide file tree
Showing 26 changed files with 39 additions and 41 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ package.tgz
.vs

# project specific
ios/Mapbox.framework
ios/Maplibre.framework
ios/temp.zip
ios/.framework_version
ios/Pods/
Expand Down
2 changes: 1 addition & 1 deletion __tests__/interface.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import MapLibreGL from "../src";

// Assert that all required Maplibre modules are accessible and exported
// Assert that all required MapLibre modules are accessible and exported
describe("Public Interface", () => {
it("should contain all expected components and utils", () => {
const actualKeys = Object.keys(MapLibreGL);
Expand Down
2 changes: 1 addition & 1 deletion docs/Style.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ Style is a component that automatically adds sources / layers to the map using M
## Props
| Prop | Type | Default | Required | Description |
| ---- | :--: | :-----: | :------: | :----------: |
| json | `MaplibreJSON \| URL` | `none` | `false` | A JSON object conforming to the schema described in the MapLibre Style Specification, or a URL to such JSON. |
| json | `MapLibreJSON \| URL` | `none` | `false` | A JSON object conforming to the schema described in the MapLibre Style Specification, or a URL to such JSON. |


2 changes: 1 addition & 1 deletion docs/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3356,7 +3356,7 @@
{
"name": "json",
"required": false,
"type": "MaplibreJSON \\| URL",
"type": "MapLibreJSON \\| URL",
"default": "none",
"description": "A JSON object conforming to the schema described in the MapLibre Style Specification, or a URL to such JSON."
}
Expand Down
4 changes: 2 additions & 2 deletions scripts/codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ const TEMPLATE_MAPPINGS = [
output: path.join(IOS_OUTPUT_PATH, "RCTMLNStyle.h"),
},
{
input: path.join(TMPL_PATH, "MaplibreStyles.ts.ejs"),
output: path.join(JS_OUTPUT_PATH, "MaplibreStyles.d.ts"),
input: path.join(TMPL_PATH, "MapLibreRNStyles.ts.ejs"),
output: path.join(JS_OUTPUT_PATH, "MapLibreRNStyles.d.ts"),
},
{
input: path.join(TMPL_PATH, "RCTMLNStyle.m.ejs"),
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/MapLibreRN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export type {
HillshadeLayerStyleProps as HillshadeLayerStyle,
BackgroundLayerStyleProps as BackgroundLayerStyle,
LightLayerStyleProps as LightLayerStyle,
} from "./utils/MaplibreStyles";
} from "./utils/MapLibreRNStyles";

/** @deprecated UserTrackingModes is deprecated use UserTrackingMode */
export const UserTrackingModes = UserTrackingMode;
2 changes: 1 addition & 1 deletion src/components/Annotation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Animated as RNAnimated, Easing } from "react-native";

import SymbolLayer from "./SymbolLayer";
import { type OnPressEvent } from "../types/OnPressEvent";
import { type SymbolLayerStyleProps } from "../utils/MaplibreStyles";
import { type SymbolLayerStyleProps } from "../utils/MapLibreRNStyles";
import { AnimatedShapeSource } from "../utils/animated/Animated";
import AnimatedMapPoint from "../utils/animated/AnimatedPoint";

Expand Down
2 changes: 1 addition & 1 deletion src/components/BackgroundLayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import useAbstractLayer, {
type NativeBaseProps,
} from "../hooks/useAbstractLayer";
import { type BaseProps } from "../types/BaseProps";
import { type BackgroundLayerStyleProps } from "../utils/MaplibreStyles";
import { type BackgroundLayerStyleProps } from "../utils/MapLibreRNStyles";

const MapLibreGL = NativeModules.MLNModule;

Expand Down
2 changes: 1 addition & 1 deletion src/components/CircleLayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import useAbstractLayer, {
type NativeBaseProps,
} from "../hooks/useAbstractLayer";
import { type BaseProps } from "../types/BaseProps";
import { type CircleLayerStyleProps } from "../utils/MaplibreStyles";
import { type CircleLayerStyleProps } from "../utils/MapLibreRNStyles";

const MapLibreGL = NativeModules.MLNModule;

Expand Down
2 changes: 1 addition & 1 deletion src/components/FillExtrusionLayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import useAbstractLayer, {
type NativeBaseProps,
} from "../hooks/useAbstractLayer";
import { type BaseProps } from "../types/BaseProps";
import { type FillExtrusionLayerStyleProps } from "../utils/MaplibreStyles";
import { type FillExtrusionLayerStyleProps } from "../utils/MapLibreRNStyles";

const MapLibreGL = NativeModules.MLNModule;

Expand Down
2 changes: 1 addition & 1 deletion src/components/FillLayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import useAbstractLayer, {
type NativeBaseProps,
} from "../hooks/useAbstractLayer";
import { type BaseProps } from "../types/BaseProps";
import { type FillLayerStyleProps } from "../utils/MaplibreStyles";
import { type FillLayerStyleProps } from "../utils/MapLibreRNStyles";

const MapLibreGL = NativeModules.MLNModule;

Expand Down
2 changes: 1 addition & 1 deletion src/components/HeatmapLayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import useAbstractLayer, {
type NativeBaseProps,
} from "../hooks/useAbstractLayer";
import { type BaseProps } from "../types/BaseProps";
import { type HeatmapLayerStyleProps } from "../utils/MaplibreStyles";
import { type HeatmapLayerStyleProps } from "../utils/MapLibreRNStyles";

const MapLibreGL = NativeModules.MLNModule;

Expand Down
2 changes: 1 addition & 1 deletion src/components/Light.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import useAbstractLayer, {
type BaseLayerProps,
} from "../hooks/useAbstractLayer";
import { type BaseProps } from "../types/BaseProps";
import { type LightLayerStyleProps } from "../utils/MaplibreStyles";
import { type LightLayerStyleProps } from "../utils/MapLibreRNStyles";
import { type StyleValue } from "../utils/StyleValue";

export const NATIVE_MODULE_NAME = "RCTMLNLight";
Expand Down
2 changes: 1 addition & 1 deletion src/components/LineLayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import useAbstractLayer, {
type NativeBaseProps,
} from "../hooks/useAbstractLayer";
import { type BaseProps } from "../types/BaseProps";
import { type LineLayerStyleProps } from "../utils/MaplibreStyles";
import { type LineLayerStyleProps } from "../utils/MapLibreRNStyles";

const MapLibreGL = NativeModules.MLNModule;

Expand Down
2 changes: 1 addition & 1 deletion src/components/MapView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { type Location } from "../modules/location/locationManager";
import { type BaseProps } from "../types/BaseProps";
import { isFunction, isAndroid } from "../utils";
import Logger from "../utils/Logger";
import { type FilterExpression } from "../utils/MaplibreStyles";
import { type FilterExpression } from "../utils/MapLibreRNStyles";
import { getFilter } from "../utils/filterUtils";

const MapLibreGL = NativeModules.MLNModule;
Expand Down
2 changes: 1 addition & 1 deletion src/components/RasterLayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import useAbstractLayer, {
type NativeBaseProps,
} from "../hooks/useAbstractLayer";
import { type BaseProps } from "../types/BaseProps";
import { type RasterLayerStyleProps } from "../utils/MaplibreStyles";
import { type RasterLayerStyleProps } from "../utils/MapLibreRNStyles";

const MapLibreGL = NativeModules.MLNModule;

Expand Down
2 changes: 1 addition & 1 deletion src/components/ShapeSource.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
import {
type ExpressionField,
type FilterExpression,
} from "../utils/MaplibreStyles";
} from "../utils/MapLibreRNStyles";
import { copyPropertiesAsDeprecated } from "../utils/deprecation";
import { getFilter } from "../utils/filterUtils";

Expand Down
32 changes: 16 additions & 16 deletions src/components/Style.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import VectorSource from "./VectorSource";
import {
type ExpressionField,
type FilterExpression,
} from "../utils/MaplibreStyles";
} from "../utils/MapLibreRNStyles";

function toCamelCase(s: string): string {
return s.replace(/([-_][a-z])/gi, ($1) => {
Expand Down Expand Up @@ -62,7 +62,7 @@ type LayerProps =
| HeatmapLayerProps;

function getLayerComponentType(
layer: MaplibreJSONLayer,
layer: MapLibreJSONLayer,
): ComponentType<LayerProps> | null {
const { type } = layer;

Expand Down Expand Up @@ -90,7 +90,7 @@ function getLayerComponentType(
return null;
}

interface MaplibreJSONLayer {
interface MapLibreJSONLayer {
type: string;
paint: { [k: string]: unknown };
layout: { [k: string]: unknown };
Expand All @@ -103,7 +103,7 @@ interface MaplibreJSONLayer {
}

function asLayerComponent(
layer: MaplibreJSONLayer,
layer: MapLibreJSONLayer,
): ReactElement<LayerProps> | null {
const LayerComponent = getLayerComponentType(layer);

Expand Down Expand Up @@ -140,7 +140,7 @@ function asLayerComponent(
return <LayerComponent key={layer.id} id={layer.id} {...layerProps} />;
}

interface MaplibreJSONSource {
interface MapLibreJSONSource {
type: string;
url?: string;
tiles?: string[];
Expand Down Expand Up @@ -178,7 +178,7 @@ type SourceProps = {
tms?: boolean;
};

function getTileSourceProps(source: MaplibreJSONSource): SourceProps {
function getTileSourceProps(source: MapLibreJSONSource): SourceProps {
const sourceProps: Partial<SourceProps> = {};
if (source.url) {
sourceProps.url = source.url;
Expand All @@ -201,12 +201,12 @@ function getTileSourceProps(source: MaplibreJSONSource): SourceProps {
return sourceProps;
}

function getVectorSource(id: string, source: MaplibreJSONSource): ReactElement {
function getVectorSource(id: string, source: MapLibreJSONSource): ReactElement {
const sourceProps = { ...getTileSourceProps(source) };
return <VectorSource key={id} id={id} {...sourceProps} />;
}

function getRasterSource(id: string, source: MaplibreJSONSource): ReactElement {
function getRasterSource(id: string, source: MapLibreJSONSource): ReactElement {
const sourceProps: SourceProps & { tileSize?: number } = {
...getTileSourceProps(source),
};
Expand All @@ -216,7 +216,7 @@ function getRasterSource(id: string, source: MaplibreJSONSource): ReactElement {
return <RasterSource key={id} id={id} {...sourceProps} />;
}

function getImageSource(id: string, source: MaplibreJSONSource): ReactElement {
function getImageSource(id: string, source: MapLibreJSONSource): ReactElement {
const sourceProps = {
url: source.url,
coordinates: source.coordinates,
Expand All @@ -226,7 +226,7 @@ function getImageSource(id: string, source: MaplibreJSONSource): ReactElement {

type ShapeSourceShape = (typeof ShapeSource.prototype.props)["shape"];

function getShapeSource(id: string, source: MaplibreJSONSource): ReactElement {
function getShapeSource(id: string, source: MapLibreJSONSource): ReactElement {
const sourceProps: SourceProps & {
shape?: ShapeSourceShape;
cluster?: boolean;
Expand Down Expand Up @@ -271,7 +271,7 @@ function getShapeSource(id: string, source: MaplibreJSONSource): ReactElement {

function asSourceComponent(
id: string,
source: MaplibreJSONSource,
source: MapLibreJSONSource,
): ReactElement | null {
switch (source.type) {
case "vector":
Expand All @@ -289,16 +289,16 @@ function asSourceComponent(
return null;
}

interface MaplibreJSON {
layers?: MaplibreJSONLayer[];
sources?: { [key: string]: MaplibreJSONSource };
interface MapLibreJSON {
layers?: MapLibreJSONLayer[];
sources?: { [key: string]: MapLibreJSONSource };
}

interface StyleProps {
/**
* A JSON object conforming to the schema described in the MapLibre Style Specification, or a URL to such JSON.
*/
json?: MaplibreJSON | URL;
json?: MapLibreJSON | URL;
}

/**
Expand All @@ -310,7 +310,7 @@ interface StyleProps {
*/
const Style = (props: StyleProps): ReactElement => {
const [fetchedJson, setFetchedJson] = useState({});
const json: MaplibreJSON =
const json: MapLibreJSON =
typeof props.json === "object" ? props.json : fetchedJson;

// Fetch style when props.json is a URL
Expand Down
2 changes: 1 addition & 1 deletion src/components/SymbolLayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import useAbstractLayer, {
type NativeBaseProps,
} from "../hooks/useAbstractLayer";
import { type BaseProps } from "../types/BaseProps";
import { type SymbolLayerStyleProps } from "../utils/MaplibreStyles";
import { type SymbolLayerStyleProps } from "../utils/MapLibreRNStyles";

const MapLibreGL = NativeModules.MLNModule;

Expand Down
2 changes: 1 addition & 1 deletion src/components/UserLocation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import NativeUserLocation from "./NativeUserLocation";
import locationManager, {
type Location,
} from "../modules/location/locationManager";
import { type CircleLayerStyleProps } from "../utils/MaplibreStyles";
import { type CircleLayerStyleProps } from "../utils/MapLibreRNStyles";

const mapboxBlue = "rgba(51, 181, 229, 100)";

Expand Down
2 changes: 1 addition & 1 deletion src/components/VectorSource.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import useNativeBridge from "../hooks/useNativeBridge";
import { type BaseProps } from "../types/BaseProps";
import { type OnPressEvent } from "../types/OnPressEvent";
import { cloneReactChildrenWithProps, isFunction, isAndroid } from "../utils";
import { type FilterExpression } from "../utils/MaplibreStyles";
import { type FilterExpression } from "../utils/MapLibreRNStyles";
import { copyPropertiesAsDeprecated } from "../utils/deprecation";
import { getFilter } from "../utils/filterUtils";

Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useAbstractLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
type ExpressionField,
type ExpressionName,
type FilterExpression,
} from "../utils/MaplibreStyles";
} from "../utils/MapLibreRNStyles";
import { type StyleValue, transformStyle } from "../utils/StyleValue";
import { getFilter } from "../utils/filterUtils";

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/utils/StyleValue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import BridgeValue, {
type RawValueType,
type StyleValueJSON,
} from "./BridgeValue";
import { type AllLayerStyleProps } from "./MaplibreStyles";
import { type AllLayerStyleProps } from "./MapLibreRNStyles";
import { getStyleType } from "./styleMap";

export type StyleValue = {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/filterUtils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type FilterExpression } from "./MaplibreStyles";
import { type FilterExpression } from "./MapLibreRNStyles";

export function getFilter(filter: FilterExpression | undefined): string[] {
if (!Array.isArray(filter) || filter.length === 0) {
Expand Down

0 comments on commit c911a9d

Please sign in to comment.