solid-map-gl 1.12.0 → 2.0.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.
Files changed (62) hide show
  1. package/README.md +157 -30
  2. package/dist/index.d.ts +489 -0
  3. package/dist/index.js +11 -0
  4. package/dist/index.jsx +2320 -0
  5. package/package.json +46 -35
  6. package/dist/esm/index.js +0 -2
  7. package/dist/esm/index.js.map +0 -1
  8. package/dist/source/components/Atmosphere/index.jsx +0 -13
  9. package/dist/source/components/Camera/index.jsx +0 -108
  10. package/dist/source/components/Control/index.jsx +0 -33
  11. package/dist/source/components/Draw/drawingStyles.js +0 -225
  12. package/dist/source/components/Draw/index.jsx +0 -55
  13. package/dist/source/components/Draw/modes/index.js +0 -9
  14. package/dist/source/components/Draw/modes/line_string.js +0 -43
  15. package/dist/source/components/Draw/modes/measurements.js +0 -76
  16. package/dist/source/components/Draw/modes/multi_point.js +0 -37
  17. package/dist/source/components/Draw/modes/point.js +0 -25
  18. package/dist/source/components/Draw/modes/polygon.js +0 -25
  19. package/dist/source/components/Draw/modes/radius.js +0 -138
  20. package/dist/source/components/Draw/modes/rectangle.js +0 -118
  21. package/dist/source/components/Draw/modes/rectangle_assisted.js +0 -233
  22. package/dist/source/components/Image/index.jsx +0 -135
  23. package/dist/source/components/Layer/index.jsx +0 -125
  24. package/dist/source/components/Layer3D/index.jsx +0 -330
  25. package/dist/source/components/Light/index.jsx +0 -10
  26. package/dist/source/components/MapGL/index.jsx +0 -272
  27. package/dist/source/components/MapProvider/index.jsx +0 -9
  28. package/dist/source/components/Marker/index.jsx +0 -57
  29. package/dist/source/components/Popup/index.jsx +0 -38
  30. package/dist/source/components/Source/index.jsx +0 -89
  31. package/dist/source/components/Terrain/index.jsx +0 -30
  32. package/dist/source/events.js +0 -78
  33. package/dist/source/index.jsx +0 -14
  34. package/dist/source/mapStyles.js +0 -116
  35. package/dist/source/styles.js +0 -62
  36. package/dist/types/components/Atmosphere/index.d.ts +0 -8
  37. package/dist/types/components/Camera/index.d.ts +0 -54
  38. package/dist/types/components/Control/index.d.ts +0 -15
  39. package/dist/types/components/Draw/drawingStyles.d.ts +0 -20
  40. package/dist/types/components/Draw/index.d.ts +0 -16
  41. package/dist/types/components/Draw/modes/index.d.ts +0 -6
  42. package/dist/types/components/Draw/modes/line_string.d.ts +0 -2
  43. package/dist/types/components/Draw/modes/multi_point.d.ts +0 -2
  44. package/dist/types/components/Draw/modes/point.d.ts +0 -2
  45. package/dist/types/components/Draw/modes/polygon.d.ts +0 -2
  46. package/dist/types/components/Draw/modes/radius.d.ts +0 -2
  47. package/dist/types/components/Draw/modes/rectangle.d.ts +0 -2
  48. package/dist/types/components/Draw/modes/rectangle_assisted.d.ts +0 -18
  49. package/dist/types/components/Image/index.d.ts +0 -28
  50. package/dist/types/components/Layer/index.d.ts +0 -32
  51. package/dist/types/components/Layer3D/index.d.ts +0 -22
  52. package/dist/types/components/Light/index.d.ts +0 -8
  53. package/dist/types/components/MapGL/index.d.ts +0 -95
  54. package/dist/types/components/MapProvider/index.d.ts +0 -11
  55. package/dist/types/components/Marker/index.d.ts +0 -28
  56. package/dist/types/components/Popup/index.d.ts +0 -18
  57. package/dist/types/components/Source/index.d.ts +0 -13
  58. package/dist/types/components/Terrain/index.d.ts +0 -7
  59. package/dist/types/events.d.ts +0 -103
  60. package/dist/types/index.d.ts +0 -16
  61. package/dist/types/mapStyles.d.ts +0 -2
  62. package/dist/types/styles.d.ts +0 -2
@@ -1,28 +0,0 @@
1
- import { VoidComponent } from 'solid-js';
2
- import type { StyleImageInterface, StyleImageMetadata } from 'mapbox-gl/src/style/style_image';
3
- export declare const patternList: string[];
4
- export type Color = `#${string}` | `rgb(${number}, ${number}, ${number})` | `rgba(${number}, ${number}, ${number}, ${number})` | `hsl(${number}, ${number}%, ${number}%)` | `hsla(${number}, ${number}%, ${number}%, ${number})`;
5
- type Props = {
6
- id: string;
7
- /** The unique identifier for the image. */
8
- source?: HTMLImageElement | ImageBitmap | ImageData | SVGElement | {
9
- width: number;
10
- height: number;
11
- data: Uint8Array | Uint8ClampedArray;
12
- } | StyleImageInterface | string;
13
- /** The image to be used for the image component. */
14
- options?: StyleImageMetadata & {
15
- fill?: Color;
16
- stroke?: Color;
17
- transform?: string;
18
- };
19
- /** The options for the image */
20
- pattern?: {
21
- type: string;
22
- color: Color;
23
- background: Color;
24
- lineWith: number;
25
- };
26
- };
27
- export declare const MGL_Image: VoidComponent<Props>;
28
- export {};
@@ -1,32 +0,0 @@
1
- import { Component } from "solid-js";
2
- import type { layerEventTypes } from "../../events";
3
- import type { FilterSpecification, StyleSpecification } from "mapbox-gl/src/style-spec/types.js";
4
- import type { CustomLayerInterface } from "mapbox-gl/src/style/style_layer/custom_style_layer";
5
- type Props = {
6
- id?: string;
7
- /** A string that uniquely identifies the layer. If not provided, a unique ID will be generated. */
8
- style?: StyleSpecification;
9
- /** A Mapbox Style Specification object that defines the visual appearance of the layer. */
10
- customLayer?: CustomLayerInterface;
11
- /** An object that implements the `CustomLayerInterface` interface, which allows you to create custom layers using WebGL. */
12
- filter?: FilterSpecification;
13
- /** A Mapbox filter specification that defines which features of the layer to include or exclude from the layer. */
14
- visible?: boolean;
15
- /** A boolean that determines whether the layer is visible or not. */
16
- sourceId?: string;
17
- /** A string that specifies the ID of the source that the layer uses for its data. */
18
- slot?: "bottom" | "middle" | "top" | string;
19
- /** A string that specifies the slot to which the layer belongs. */
20
- beforeType?: "background" | "fill" | "line" | "symbol" | "raster" | "circle" | "fill-extrusion" | "heatmap" | "hillshade" | "sky" | string;
21
- /** A string that specifies the type of layer before which the current layer should be inserted. */
22
- beforeId?: string;
23
- /** A string that specifies the ID of the layer before which the current layer should be inserted. */
24
- featureState?: {
25
- id: number | string;
26
- state: object;
27
- };
28
- /** An object that specifies the state of a feature in the layer. The object consists of an ID (either a number or a string) and an object containing the state. */
29
- children?: any;
30
- } & layerEventTypes;
31
- export declare const Layer: Component<Props>;
32
- export {};
@@ -1,22 +0,0 @@
1
- import { Component, JSX } from "solid-js";
2
- declare global {
3
- interface Window {
4
- BABYLON?: any;
5
- THREE?: any;
6
- }
7
- }
8
- type Props = {
9
- id?: string;
10
- origin?: [number, number, number?];
11
- defaultLight?: boolean;
12
- babylon?: boolean;
13
- onAdd?: (scene: any, map: any, gl: any) => void;
14
- onRender?: (gl: any, matrix: any) => void;
15
- children?: JSX.Element | JSX.Element[];
16
- /** A string that specifies the type of layer before which the current layer should be inserted. */
17
- beforeId?: string;
18
- disableProjectionMatrix?: boolean;
19
- };
20
- export declare const useScene: () => any;
21
- export declare const Layer3D: Component<Props>;
22
- export {};
@@ -1,8 +0,0 @@
1
- import { VoidComponent } from 'solid-js';
2
- import type { Light as LightSpecification } from 'mapbox-gl';
3
- type Props = {
4
- /** Light Specifications */
5
- style: LightSpecification;
6
- };
7
- export declare const Light: VoidComponent<Props>;
8
- export {};
@@ -1,95 +0,0 @@
1
- import { Component } from "solid-js";
2
- import type { mapEventTypes } from "../../events";
3
- import type mapboxgl from "mapbox-gl";
4
- import type { MapboxOptions } from "mapbox-gl/src/ui/map";
5
- import type { LngLatLike } from "mapbox-gl/src/geo/lng_lat.js";
6
- import type { LngLatBounds } from "mapbox-gl/src/geo/lng_lat_bounds.js";
7
- import type { PaddingOptions } from "mapbox-gl/src/geo/edge_insets.js";
8
- import type { StyleSpecification } from "mapbox-gl/src/style-spec/types.js";
9
- import type { JSX } from "solid-js";
10
- declare global {
11
- interface Window {
12
- MapLib?: any;
13
- }
14
- }
15
- export type Map = mapboxgl.Map & {
16
- debug: boolean;
17
- debugEvents: boolean;
18
- sourceIdList: string[];
19
- layerIdList: string[];
20
- };
21
- export type Viewport = {
22
- id?: string;
23
- point?: {
24
- x: number;
25
- y: number;
26
- };
27
- center?: LngLatLike;
28
- bounds?: LngLatBounds;
29
- zoom?: number;
30
- pitch?: number;
31
- bearing?: number;
32
- padding?: PaddingOptions;
33
- inTransit?: boolean;
34
- };
35
- type Props = {
36
- /** ID for the map container element */
37
- id?: string;
38
- /** Map Container CSS Style */
39
- style?: JSX.CSSProperties;
40
- /** Map Container CSS Class */
41
- class?: string;
42
- /** SolidJS Class List for Map Container */
43
- classList?: {
44
- [k: string]: boolean | undefined;
45
- };
46
- /** Current Map View */
47
- viewport?: Viewport;
48
- /** Mapbox Options
49
- * @see https://docs.mapbox.com/mapbox-gl-js/api/map/#map-parameters
50
- */
51
- options?: MapboxOptions;
52
- /** Mapbox Style Configuration
53
- * @see https://docs.mapbox.com/mapbox-gl-js/guides/styles/#configure-a-style
54
- */
55
- config?: {
56
- id?: string;
57
- lightPreset?: "dawn" | "day" | "dusk" | "night" | string;
58
- showPlaceLabels?: boolean;
59
- showRoadLabels?: boolean;
60
- showPointOfInterestLabels?: boolean;
61
- showTransitLabels?: boolean;
62
- font?: string[];
63
- [key: string]: boolean | string | string[];
64
- };
65
- /** Type for pan, move and zoom transitions */
66
- transitionType?: "flyTo" | "easeTo" | "jumpTo" | string;
67
- /** Event listener for Viewport updates */
68
- onViewportChange?: (viewport: Viewport) => void;
69
- /** Event listener for User Interaction */
70
- onUserInteraction?: (user: boolean) => void;
71
- /** Displays Map Tile Borders */
72
- showTileBoundaries?: boolean;
73
- /** Displays Wireframe if Terrain is visible */
74
- showTerrainWireframe?: boolean;
75
- /** Displays Borders if Padding is set */
76
- showPadding?: boolean;
77
- /** Displays Label Collision Boxes */
78
- showCollisionBoxes?: boolean;
79
- /** Displays all feature outlines even if normally not drawn by style rules */
80
- showOverdrawInspector?: boolean;
81
- /** Mouse Cursor Style */
82
- cursorStyle?: string;
83
- darkStyle?: StyleSpecification | string;
84
- disableResize?: boolean;
85
- mapLib?: any;
86
- apikey?: string;
87
- debug?: boolean;
88
- debugEvents?: boolean;
89
- ref?: HTMLDivElement;
90
- /** Children within the Map Container */
91
- children?: any;
92
- } & mapEventTypes;
93
- /** Creates a new Map Container */
94
- export declare const MapGL: Component<Props>;
95
- export {};
@@ -1,11 +0,0 @@
1
- import { ParentComponent } from 'solid-js';
2
- import type { Map } from '../MapGL';
3
- export declare const MapContext: import("solid-js").Context<{
4
- map: any;
5
- }[]>;
6
- export declare const useMapContext: () => {
7
- map: any;
8
- }[];
9
- export declare const MapProvider: ParentComponent<{
10
- map?: Map;
11
- }>;
@@ -1,28 +0,0 @@
1
- import { Component } from 'solid-js';
2
- import type { PopupOptions, MarkerOptions, LngLatLike } from 'mapbox-gl';
3
- type Props = {
4
- /** The geographical location to place the marker */
5
- lngLat: LngLatLike;
6
- /** Options for the Mapbox GL JS marker */
7
- options?: MarkerOptions;
8
- /** Options for the Mapbox GL JS popup that is associated with the marker */
9
- popup?: PopupOptions;
10
- /** Whether the marker's associated popup should be open */
11
- showPopup?: boolean;
12
- /** Whether the marker is draggable */
13
- draggable?: boolean;
14
- /** A function that is called when the marker's associated popup is opened */
15
- onOpen?: () => void;
16
- /** A function that is called when the marker's associated popup is closed */
17
- onClose?: () => void;
18
- /** A function that is called when the marker starts being dragged */
19
- onDragStart?: () => void;
20
- /** A function that is called when the marker stops being dragged */
21
- onDragEnd?: () => void;
22
- /** A function that is called when the marker is being dragged */
23
- onDrag?: (lngLat: number[]) => void;
24
- /** The content to be displayed in the marker's associated popup */
25
- children?: any;
26
- };
27
- export declare const Marker: Component<Props>;
28
- export {};
@@ -1,18 +0,0 @@
1
- import { Component } from "solid-js";
2
- import type { PopupOptions, LngLatLike } from "mapbox-gl";
3
- type Props = {
4
- /** Options for configuring the popup */
5
- options?: PopupOptions;
6
- /** Flag for tracking the mouse pointer */
7
- trackPointer?: boolean;
8
- /** Longitude and latitude for the popup */
9
- lngLat?: LngLatLike;
10
- /** Callback for when the popup is opened */
11
- onOpen?: () => void;
12
- /** Callback for when the popup is closed */
13
- onClose?: () => void;
14
- /** Children to display within the popup */
15
- children?: any;
16
- };
17
- export declare const Popup: Component<Props>;
18
- export {};
@@ -1,13 +0,0 @@
1
- import { Component } from 'solid-js';
2
- import type { SourceSpecification } from 'mapbox-gl/src/style-spec/types.js';
3
- export declare const useSourceId: () => string;
4
- type Props = {
5
- /** @optional Source ID for referencing non nexted Layers */
6
- id?: string;
7
- /** @see https://docs.mapbox.com/mapbox-gl-js/style-spec/sources/ */
8
- source: SourceSpecification;
9
- /** The map layers associated with this source */
10
- children?: any;
11
- };
12
- export declare const Source: Component<Props>;
13
- export {};
@@ -1,7 +0,0 @@
1
- import { VoidComponent } from 'solid-js';
2
- interface TerrainSpecification {
3
- source?: string;
4
- exaggeration?: number | undefined;
5
- }
6
- export declare const Terrain: VoidComponent<TerrainSpecification>;
7
- export {};
@@ -1,103 +0,0 @@
1
- import type { MapMouseEvent, MapTouchEvent, MapWheelEvent, MapDataEvent, MapBoxZoomEvent } from 'mapbox-gl';
2
- type mapEventTypes = {
3
- onMouseDown?: (event: MapMouseEvent) => void;
4
- onMouseUp?: (event: MapMouseEvent) => void;
5
- onMouseOver?: (event: MapMouseEvent) => void;
6
- onMouseOut?: (event: MapMouseEvent) => void;
7
- onMouseMove?: (event: MapMouseEvent) => void;
8
- onMouseEnter?: (event: MapMouseEvent) => void;
9
- onMouseLeave?: (event: MapMouseEvent) => void;
10
- onPreClick?: (event: MapMouseEvent) => void;
11
- onClick?: (event: MapMouseEvent) => void;
12
- onDblClick?: (event: MapMouseEvent) => void;
13
- onContextMenu?: (event: MapMouseEvent) => void;
14
- onTouchStart?: (event: MapTouchEvent) => void;
15
- onTouchEnd?: (event: MapTouchEvent) => void;
16
- onTouchCancel?: (event: MapTouchEvent) => void;
17
- onTouchMove?: (event: MapTouchEvent) => void;
18
- onWheel?: (event: MapWheelEvent) => void;
19
- onResize?: () => void;
20
- onRemove?: () => void;
21
- onMoveStart?: (event: DragEvent) => void;
22
- onMove?: (event: MapMouseEvent | MapTouchEvent) => void;
23
- onMoveEnd?: (event: DragEvent) => void;
24
- onDragStart?: (event: DragEvent) => void;
25
- onDrag?: (event: MapMouseEvent | MapTouchEvent) => void;
26
- onDragEnd?: (event: DragEvent) => void;
27
- onZoomStart?: (event: MapMouseEvent | MapTouchEvent) => void;
28
- onZoom?: (event: MapMouseEvent | MapTouchEvent) => void;
29
- onZoomEnd?: (event: MapMouseEvent | MapTouchEvent) => void;
30
- onRotateStart?: (event: MapMouseEvent | MapTouchEvent) => void;
31
- onRotate?: (event: MapMouseEvent | MapTouchEvent) => void;
32
- onRotatEnd?: (event: MapMouseEvent | MapTouchEvent) => void;
33
- onPitchStart?: (event: MapDataEvent) => void;
34
- onPitch?: (event: MapDataEvent) => void;
35
- onPitchEnd?: (event: MapDataEvent) => void;
36
- onBoxZoomStart?: (event: MapBoxZoomEvent) => void;
37
- onBoxZoomEnd?: (event: MapBoxZoomEvent) => void;
38
- onBoxZoomCancel?: (event: MapBoxZoomEvent) => void;
39
- onWebglContextLost?: () => void;
40
- onWebglContextRestored?: () => void;
41
- onLoad?: (event: any) => void;
42
- onRender?: () => void;
43
- onIdle?: () => void;
44
- onError?: (error: string) => void;
45
- onData?: (event: MapDataEvent) => void;
46
- onStyleData?: (event: MapDataEvent) => void;
47
- onSourceData?: (event: MapDataEvent) => void;
48
- onDataLoading?: (event: MapDataEvent) => void;
49
- onStyleDataLoading?: (event: MapDataEvent) => void;
50
- onSourceDataLoading?: (event: MapDataEvent) => void;
51
- onStyleImageMissing?: (event: MapDataEvent) => void;
52
- };
53
- declare const mapEvents: string[];
54
- type layerEventTypes = {
55
- onMouseDown?: (event: MapMouseEvent) => void;
56
- /** called when the mouse button is pressed down on the layer */
57
- onMouseUp?: (event: MapMouseEvent) => void;
58
- /** called when the mouse button is released after a mouse down event on the layer */
59
- onMouseOver?: (event: MapMouseEvent) => void;
60
- /** called when the mouse enters the layer */
61
- onMouseOut?: (event: MapMouseEvent) => void;
62
- /** called when the mouse leaves the layer */
63
- onMouseMove?: (event: MapMouseEvent) => void;
64
- /** called when the mouse is moved over the layer */
65
- onMouseEnter?: (event: MapMouseEvent) => void;
66
- /** called when the mouse enters the layer */
67
- onMouseLeave?: (event: MapMouseEvent) => void;
68
- /** called when the mouse leaves the layer */
69
- onClick?: (event: MapMouseEvent) => void;
70
- /** called when the layer is clicked */
71
- onDblClick?: (event: MapMouseEvent) => void;
72
- /** called when the layer is double-clicked */
73
- onContextMenu?: (event: MapMouseEvent) => void;
74
- /** called when the context menu is triggered on the layer */
75
- onTouchStart?: (event: MapTouchEvent) => void;
76
- /** called when a touch event is started on the layer */
77
- onTouchEnd?: (event: MapTouchEvent) => void;
78
- /** called when a touch event is ended on the layer */
79
- onTouchCancel?: (event: MapTouchEvent) => void;
80
- };
81
- declare const layerEvents: any[];
82
- declare const drawEvents: any[];
83
- type drawEventTypes = {
84
- onCreate?: (event: Object) => void;
85
- /** called when a feature is created */
86
- onDelete?: (event: Object) => void;
87
- /** called when a feature is deleted */
88
- onCombine?: (event: Object) => void;
89
- /** called when features are combined */
90
- onUncombine?: (event: Object) => void;
91
- /** called when features are uncombined */
92
- onUpdate?: (event: Object) => void;
93
- /** called when a feature is updated */
94
- onSelectionchange?: (event: Object) => void;
95
- /** called when the selected features change */
96
- onModechange?: (event: Object) => void;
97
- /** called when the draw mode changes */
98
- onRender?: (event: Object) => void;
99
- /** called when the draw canvas is re-rendered */
100
- onActionable?: (event: Object) => void;
101
- };
102
- export { mapEvents, layerEvents, drawEvents };
103
- export type { mapEventTypes, layerEventTypes, drawEventTypes };
@@ -1,16 +0,0 @@
1
- export { MapGL as default } from "./components/MapGL";
2
- export { MapProvider, useMapContext } from "./components/MapProvider";
3
- export { Source, useSourceId } from "./components/Source";
4
- export { Layer } from "./components/Layer";
5
- export { Layer3D, useScene } from "./components/Layer3D";
6
- export { Atmosphere } from "./components/Atmosphere";
7
- export { Terrain } from "./components/Terrain";
8
- export { Control } from "./components/Control";
9
- export { Marker } from "./components/Marker";
10
- export { Popup } from "./components/Popup";
11
- export { MGL_Image as Image, patternList } from "./components/Image";
12
- export { Camera } from "./components/Camera";
13
- export { Light } from "./components/Light";
14
- export { Draw } from "./components/Draw";
15
- export type { Viewport } from "./components/MapGL";
16
- export type { Color } from "./components/Image";
@@ -1,2 +0,0 @@
1
- export declare const vectorStyleList: object;
2
- export declare const rasterStyleList: object;
@@ -1,2 +0,0 @@
1
- export declare const baseStyle: string[];
2
- export declare const layoutStyles: string[];