react-three-map 0.3.2 → 0.3.3
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/CHANGELOG.md +6 -0
- package/dist/maplibre/types/core/coords-to-matrix.d.ts +8 -0
- package/dist/maplibre/types/core/create-events.d.ts +3 -0
- package/dist/maplibre/types/core/generic-map.d.ts +47 -0
- package/{src/core/state-ref.ts → dist/maplibre/types/core/state-ref.d.ts} +4 -5
- package/dist/maplibre/types/core/use-canvas.d.ts +13 -0
- package/dist/maplibre/types/core/use-function.d.ts +1 -0
- package/dist/maplibre/types/core/use-on-add.d.ts +8 -0
- package/dist/maplibre/types/core/use-render.d.ts +3 -0
- package/dist/maplibre/types/maplibre/canvas.d.ts +10 -0
- package/dist/maplibre/types/maplibre.index.d.ts +1 -0
- package/dist/types/core/coords-to-matrix.d.ts +8 -0
- package/dist/types/core/create-events.d.ts +3 -0
- package/dist/types/core/generic-map.d.ts +47 -0
- package/dist/types/core/state-ref.d.ts +8 -0
- package/dist/types/core/use-canvas.d.ts +13 -0
- package/dist/types/core/use-function.d.ts +1 -0
- package/dist/types/core/use-on-add.d.ts +8 -0
- package/dist/types/core/use-render.d.ts +3 -0
- package/dist/types/mapbox/canvas.d.ts +10 -0
- package/dist/types/mapbox.index.d.ts +1 -0
- package/maplibre/package.json +1 -1
- package/package.json +4 -3
- package/docs/basic-app.gif +0 -0
- package/example-mapbox/package.json +0 -29
- package/example-mapbox/sandbox.config.json +0 -3
- package/example-mapbox/src/canvas.basic.stories.tsx +0 -84
- package/example-mapbox/src/comparison.stories.tsx +0 -37
- package/example-mapbox/src/html-on-top.stories.tsx +0 -24
- package/example-mapbox/src/my-scene.tsx +0 -89
- package/example-mapbox/src/render-on-demand.stories.tsx +0 -32
- package/example-mapbox/src/story-map.tsx +0 -61
- package/example-mapbox/src/vite-env.d.ts +0 -1
- package/example-mapbox/tsconfig.json +0 -27
- package/example-mapbox/tsconfig.node.json +0 -10
- package/example-mapbox/yarn.lock +0 -4154
- package/example-maplibre/package.json +0 -29
- package/example-maplibre/sandbox.config.json +0 -3
- package/example-maplibre/src/canvas.basic.stories.tsx +0 -61
- package/example-maplibre/src/comparison.stories.tsx +0 -35
- package/example-maplibre/src/html-on-top.stories.tsx +0 -24
- package/example-maplibre/src/my-scene.tsx +0 -89
- package/example-maplibre/src/render-on-demand.stories.tsx +0 -32
- package/example-maplibre/src/story-map.tsx +0 -38
- package/example-maplibre/src/vite-env.d.ts +0 -1
- package/example-maplibre/tsconfig.json +0 -25
- package/example-maplibre/tsconfig.node.json +0 -10
- package/example-maplibre/yarn.lock +0 -4181
- package/src/core/coords-to-matrix.ts +0 -20
- package/src/core/create-events.ts +0 -73
- package/src/core/generic-map.test.ts +0 -2
- package/src/core/generic-map.ts +0 -57
- package/src/core/use-canvas.tsx +0 -31
- package/src/core/use-function.ts +0 -10
- package/src/core/use-on-add.ts +0 -90
- package/src/core/use-render.ts +0 -25
- package/src/mapbox/canvas.tsx +0 -38
- package/src/mapbox/index.ts +0 -1
- package/src/maplibre/canvas.tsx +0 -38
- package/src/maplibre/index.ts +0 -1
- package/src/stories/comparison.stories.tsx +0 -38
- package/src/stories/html-on-top.stories.tsx +0 -21
- package/src/stories/mapbox/story-mapbox.tsx +0 -58
- package/src/stories/mapbox-example.stories.tsx +0 -84
- package/src/stories/maplibre/story-maplibre.tsx +0 -32
- package/src/stories/maplibre-example.stories.tsx +0 -61
- package/src/stories/my-scene.tsx +0 -88
- package/src/stories/render-on-demand.stories.tsx +0 -34
- package/src/stories/story-map.tsx +0 -35
- package/src/vite-env.d.ts +0 -1
- package/tsconfig.json +0 -30
- package/tsconfig.node.json +0 -10
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { ThemeState, useLadleContext } from '@ladle/react';
|
|
2
|
-
import { useControls } from 'leva';
|
|
3
|
-
import Mapbox from "mapbox-gl";
|
|
4
|
-
import 'mapbox-gl/dist/mapbox-gl.css';
|
|
5
|
-
import { FC, PropsWithChildren } from "react";
|
|
6
|
-
import Map from 'react-map-gl';
|
|
7
|
-
|
|
8
|
-
export interface StoryMapProps extends PropsWithChildren {
|
|
9
|
-
latitude: number,
|
|
10
|
-
longitude: number,
|
|
11
|
-
zoom?: number,
|
|
12
|
-
pitch?: number,
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/** `<Map>` styled for stories */
|
|
16
|
-
export const StoryMap: FC<StoryMapProps> = ({
|
|
17
|
-
latitude, longitude, zoom = 18, pitch = 60, children
|
|
18
|
-
}) => {
|
|
19
|
-
|
|
20
|
-
const { mapboxToken } = useControls({
|
|
21
|
-
mapboxToken: {
|
|
22
|
-
value: import.meta.env.VITE_MAPBOX_TOKEN || '',
|
|
23
|
-
label: 'mapbox token',
|
|
24
|
-
}
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
const theme = useLadleContext().globalState.theme;
|
|
28
|
-
|
|
29
|
-
const mapStyle = theme === ThemeState.Dark
|
|
30
|
-
? "mapbox://styles/mapbox/dark-v11"
|
|
31
|
-
: "mapbox://styles/mapbox/streets-v12";
|
|
32
|
-
|
|
33
|
-
Mapbox.accessToken = mapboxToken;
|
|
34
|
-
|
|
35
|
-
return <div style={{ height: '100vh', position: 'relative' }}>
|
|
36
|
-
{!mapboxToken && <Center>Add a mapbox token to load this component</Center>}
|
|
37
|
-
{mapboxToken && <Map
|
|
38
|
-
antialias
|
|
39
|
-
initialViewState={{
|
|
40
|
-
latitude,
|
|
41
|
-
longitude,
|
|
42
|
-
zoom,
|
|
43
|
-
pitch,
|
|
44
|
-
}}
|
|
45
|
-
mapStyle={mapStyle}
|
|
46
|
-
mapboxAccessToken={mapboxToken}
|
|
47
|
-
>
|
|
48
|
-
{children}
|
|
49
|
-
</Map>}
|
|
50
|
-
</div>
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const Center = ({ children }: PropsWithChildren) => (
|
|
54
|
-
<div style={{
|
|
55
|
-
display: 'flex',
|
|
56
|
-
height: '100%',
|
|
57
|
-
width: '100%',
|
|
58
|
-
alignItems: 'center',
|
|
59
|
-
justifyContent: 'center',
|
|
60
|
-
}}>{children}</div>
|
|
61
|
-
)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/// <reference types="vite/client" />
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2020",
|
|
4
|
-
"useDefineForClassFields": true,
|
|
5
|
-
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
6
|
-
"module": "ESNext",
|
|
7
|
-
"skipLibCheck": true,
|
|
8
|
-
|
|
9
|
-
/* Bundler mode */
|
|
10
|
-
"moduleResolution": "Node",
|
|
11
|
-
"allowImportingTsExtensions": true,
|
|
12
|
-
"resolveJsonModule": true,
|
|
13
|
-
"isolatedModules": true,
|
|
14
|
-
"noEmit": true,
|
|
15
|
-
"jsx": "react-jsx",
|
|
16
|
-
|
|
17
|
-
/* Linting */
|
|
18
|
-
"strict": true,
|
|
19
|
-
"noUnusedLocals": true,
|
|
20
|
-
"noUnusedParameters": true,
|
|
21
|
-
"noFallthroughCasesInSwitch": true,
|
|
22
|
-
|
|
23
|
-
"allowSyntheticDefaultImports": true
|
|
24
|
-
},
|
|
25
|
-
"include": ["src"],
|
|
26
|
-
"references": [{ "path": "./tsconfig.node.json" }]
|
|
27
|
-
}
|