react-three-map 1.0.0-next.0 → 1.0.0-next.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/CHANGELOG.md +12 -0
- package/dist/cjs/main.js +41 -1263
- package/dist/es/main10.mjs +10 -71
- package/dist/es/main10.mjs.map +1 -1
- package/dist/es/main11.mjs +35 -12
- package/dist/es/main11.mjs.map +1 -1
- package/dist/es/main12.mjs +13 -12
- package/dist/es/main12.mjs.map +1 -1
- package/dist/es/main13.mjs +24 -42
- package/dist/es/main13.mjs.map +1 -1
- package/dist/es/main14.mjs +4 -13
- package/dist/es/main14.mjs.map +1 -1
- package/dist/es/main15.mjs +31 -22
- package/dist/es/main15.mjs.map +1 -1
- package/dist/es/main16.mjs +23 -87
- package/dist/es/main16.mjs.map +1 -1
- package/dist/es/main17.mjs +94 -14
- package/dist/es/main17.mjs.map +1 -1
- package/dist/es/main18.mjs +58 -22
- package/dist/es/main18.mjs.map +1 -1
- package/dist/es/main19.mjs +20 -27
- package/dist/es/main19.mjs.map +1 -1
- package/dist/es/main20.mjs +23 -8
- package/dist/es/main20.mjs.map +1 -1
- package/dist/es/main21.mjs +16 -34
- package/dist/es/main21.mjs.map +1 -1
- package/dist/es/main22.mjs +80 -12
- package/dist/es/main22.mjs.map +1 -1
- package/dist/es/main3.mjs +4 -13
- package/dist/es/main3.mjs.map +1 -1
- package/dist/es/main4.mjs +3 -3
- package/dist/es/main5.mjs +1 -1
- package/dist/es/main6.mjs +1 -1
- package/dist/es/main7.mjs +1 -1
- package/dist/es/main8.mjs +20 -87
- package/dist/es/main8.mjs.map +1 -1
- package/dist/es/main9.mjs +24 -80
- package/dist/es/main9.mjs.map +1 -1
- package/dist/maplibre/cjs/main.js +0 -4
- package/dist/maplibre/es/main18.mjs +0 -4
- package/dist/maplibre/es/main18.mjs.map +1 -1
- package/package.json +1 -1
- package/stories/package.json +1 -1
- package/stories/yarn.lock +19 -14
- package/dist/es/main23.mjs +0 -26
- package/dist/es/main23.mjs.map +0 -1
- package/dist/es/main24.mjs +0 -5
- package/dist/es/main24.mjs.map +0 -1
- package/dist/es/main25.mjs +0 -33
- package/dist/es/main25.mjs.map +0 -1
- package/dist/es/main26.mjs +0 -27
- package/dist/es/main26.mjs.map +0 -1
- package/dist/es/main27.mjs +0 -98
- package/dist/es/main27.mjs.map +0 -1
- package/dist/es/main28.mjs +0 -66
- package/dist/es/main28.mjs.map +0 -1
- package/dist/es/main29.mjs +0 -23
- package/dist/es/main29.mjs.map +0 -1
- package/dist/es/main30.mjs +0 -27
- package/dist/es/main30.mjs.map +0 -1
- package/dist/es/main31.mjs +0 -19
- package/dist/es/main31.mjs.map +0 -1
- package/dist/es/main32.mjs +0 -83
- package/dist/es/main32.mjs.map +0 -1
- package/dist/es/main33.mjs +0 -501
- package/dist/es/main33.mjs.map +0 -1
- package/dist/es/main34.mjs +0 -90
- package/dist/es/main34.mjs.map +0 -1
- package/dist/es/main35.mjs +0 -6
- package/dist/es/main35.mjs.map +0 -1
- package/dist/es/main36.mjs +0 -26
- package/dist/es/main36.mjs.map +0 -1
- package/dist/es/main37.mjs +0 -19
- package/dist/es/main37.mjs.map +0 -1
- package/dist/es/main38.mjs +0 -50
- package/dist/es/main38.mjs.map +0 -1
- package/dist/es/main39.mjs +0 -31
- package/dist/es/main39.mjs.map +0 -1
- package/dist/es/main40.mjs +0 -9
- package/dist/es/main40.mjs.map +0 -1
- package/dist/es/main41.mjs +0 -62
- package/dist/es/main41.mjs.map +0 -1
- package/dist/es/main42.mjs +0 -42
- package/dist/es/main42.mjs.map +0 -1
package/dist/es/main36.mjs
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
const globalSettings = [
|
|
2
|
-
"baseApiUrl",
|
|
3
|
-
"maxParallelImageRequests",
|
|
4
|
-
"workerClass",
|
|
5
|
-
"workerCount",
|
|
6
|
-
"workerUrl"
|
|
7
|
-
];
|
|
8
|
-
function setGlobals(mapLib, props) {
|
|
9
|
-
for (const key of globalSettings) {
|
|
10
|
-
if (key in props) {
|
|
11
|
-
mapLib[key] = props[key];
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
const { RTLTextPlugin = "https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js" } = props;
|
|
15
|
-
if (RTLTextPlugin && mapLib.getRTLTextPluginStatus && mapLib.getRTLTextPluginStatus() === "unavailable") {
|
|
16
|
-
mapLib.setRTLTextPlugin(RTLTextPlugin, (error) => {
|
|
17
|
-
if (error) {
|
|
18
|
-
console.error(error);
|
|
19
|
-
}
|
|
20
|
-
}, true);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
export {
|
|
24
|
-
setGlobals as default
|
|
25
|
-
};
|
|
26
|
-
//# sourceMappingURL=main36.mjs.map
|
package/dist/es/main36.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"main36.mjs","sources":["../../node_modules/@vis.gl/react-mapbox/dist/utils/set-globals.js"],"sourcesContent":["const globalSettings = [\n 'baseApiUrl',\n 'maxParallelImageRequests',\n 'workerClass',\n 'workerCount',\n 'workerUrl'\n];\nexport default function setGlobals(mapLib, props) {\n for (const key of globalSettings) {\n if (key in props) {\n mapLib[key] = props[key];\n }\n }\n const { RTLTextPlugin = 'https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js' } = props;\n if (RTLTextPlugin &&\n mapLib.getRTLTextPluginStatus &&\n mapLib.getRTLTextPluginStatus() === 'unavailable') {\n mapLib.setRTLTextPlugin(RTLTextPlugin, (error) => {\n if (error) {\n // eslint-disable-next-line\n console.error(error);\n }\n }, true);\n }\n}\n//# sourceMappingURL=set-globals.js.map"],"names":[],"mappings":"AAAA,MAAM,iBAAiB;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;AACe,SAAS,WAAW,QAAQ,OAAO;AAC9C,aAAW,OAAO,gBAAgB;AAC9B,QAAI,OAAO,OAAO;AACd,aAAO,GAAG,IAAI,MAAM,GAAG;AAAA,IAC1B;AAAA,EACJ;AACD,QAAM,EAAE,gBAAgB,8FAA+F,IAAG;AAC1H,MAAI,iBACA,OAAO,0BACP,OAAO,uBAAwB,MAAK,eAAe;AACnD,WAAO,iBAAiB,eAAe,CAAC,UAAU;AAC9C,UAAI,OAAO;AAEP,gBAAQ,MAAM,KAAK;AAAA,MACtB;AAAA,IACJ,GAAE,IAAI;AAAA,EACV;AACL;","x_google_ignoreList":[0]}
|
package/dist/es/main37.mjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
const unitlessNumber = /box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;
|
|
2
|
-
function applyReactStyle(element, styles) {
|
|
3
|
-
if (!element || !styles) {
|
|
4
|
-
return;
|
|
5
|
-
}
|
|
6
|
-
const style = element.style;
|
|
7
|
-
for (const key in styles) {
|
|
8
|
-
const value = styles[key];
|
|
9
|
-
if (Number.isFinite(value) && !unitlessNumber.test(key)) {
|
|
10
|
-
style[key] = `${value}px`;
|
|
11
|
-
} else {
|
|
12
|
-
style[key] = value;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
export {
|
|
17
|
-
applyReactStyle
|
|
18
|
-
};
|
|
19
|
-
//# sourceMappingURL=main37.mjs.map
|
package/dist/es/main37.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"main37.mjs","sources":["../../node_modules/@vis.gl/react-mapbox/dist/utils/apply-react-style.js"],"sourcesContent":["// This is a simplified version of\n// https://github.com/facebook/react/blob/4131af3e4bf52f3a003537ec95a1655147c81270/src/renderers/dom/shared/CSSPropertyOperations.js#L62\nconst unitlessNumber = /box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;\nexport function applyReactStyle(element, styles) {\n if (!element || !styles) {\n return;\n }\n const style = element.style;\n for (const key in styles) {\n const value = styles[key];\n if (Number.isFinite(value) && !unitlessNumber.test(key)) {\n style[key] = `${value}px`;\n }\n else {\n style[key] = value;\n }\n }\n}\n//# sourceMappingURL=apply-react-style.js.map"],"names":[],"mappings":"AAEA,MAAM,iBAAiB;AAChB,SAAS,gBAAgB,SAAS,QAAQ;AAC7C,MAAI,CAAC,WAAW,CAAC,QAAQ;AACrB;AAAA,EACH;AACD,QAAM,QAAQ,QAAQ;AACtB,aAAW,OAAO,QAAQ;AACtB,UAAM,QAAQ,OAAO,GAAG;AACxB,QAAI,OAAO,SAAS,KAAK,KAAK,CAAC,eAAe,KAAK,GAAG,GAAG;AACrD,YAAM,GAAG,IAAI,GAAG,KAAK;AAAA,IACxB,OACI;AACD,YAAM,GAAG,IAAI;AAAA,IAChB;AAAA,EACJ;AACL;","x_google_ignoreList":[0]}
|
package/dist/es/main38.mjs
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
function arePointsEqual(a, b) {
|
|
2
|
-
const ax = Array.isArray(a) ? a[0] : a ? a.x : 0;
|
|
3
|
-
const ay = Array.isArray(a) ? a[1] : a ? a.y : 0;
|
|
4
|
-
const bx = Array.isArray(b) ? b[0] : b ? b.x : 0;
|
|
5
|
-
const by = Array.isArray(b) ? b[1] : b ? b.y : 0;
|
|
6
|
-
return ax === bx && ay === by;
|
|
7
|
-
}
|
|
8
|
-
function deepEqual(a, b) {
|
|
9
|
-
if (a === b) {
|
|
10
|
-
return true;
|
|
11
|
-
}
|
|
12
|
-
if (!a || !b) {
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
if (Array.isArray(a)) {
|
|
16
|
-
if (!Array.isArray(b) || a.length !== b.length) {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
for (let i = 0; i < a.length; i++) {
|
|
20
|
-
if (!deepEqual(a[i], b[i])) {
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return true;
|
|
25
|
-
} else if (Array.isArray(b)) {
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
if (typeof a === "object" && typeof b === "object") {
|
|
29
|
-
const aKeys = Object.keys(a);
|
|
30
|
-
const bKeys = Object.keys(b);
|
|
31
|
-
if (aKeys.length !== bKeys.length) {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
for (const key of aKeys) {
|
|
35
|
-
if (!b.hasOwnProperty(key)) {
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
if (!deepEqual(a[key], b[key])) {
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return true;
|
|
43
|
-
}
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
export {
|
|
47
|
-
arePointsEqual,
|
|
48
|
-
deepEqual
|
|
49
|
-
};
|
|
50
|
-
//# sourceMappingURL=main38.mjs.map
|
package/dist/es/main38.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"main38.mjs","sources":["../../node_modules/@vis.gl/react-mapbox/dist/utils/deep-equal.js"],"sourcesContent":["/**\n * Compare two points\n * @param a\n * @param b\n * @returns true if the points are equal\n */\nexport function arePointsEqual(a, b) {\n const ax = Array.isArray(a) ? a[0] : a ? a.x : 0;\n const ay = Array.isArray(a) ? a[1] : a ? a.y : 0;\n const bx = Array.isArray(b) ? b[0] : b ? b.x : 0;\n const by = Array.isArray(b) ? b[1] : b ? b.y : 0;\n return ax === bx && ay === by;\n}\n/* eslint-disable complexity */\n/**\n * Compare any two objects\n * @param a\n * @param b\n * @returns true if the objects are deep equal\n */\nexport function deepEqual(a, b) {\n if (a === b) {\n return true;\n }\n if (!a || !b) {\n return false;\n }\n if (Array.isArray(a)) {\n if (!Array.isArray(b) || a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; i++) {\n if (!deepEqual(a[i], b[i])) {\n return false;\n }\n }\n return true;\n }\n else if (Array.isArray(b)) {\n return false;\n }\n if (typeof a === 'object' && typeof b === 'object') {\n const aKeys = Object.keys(a);\n const bKeys = Object.keys(b);\n if (aKeys.length !== bKeys.length) {\n return false;\n }\n for (const key of aKeys) {\n if (!b.hasOwnProperty(key)) {\n return false;\n }\n if (!deepEqual(a[key], b[key])) {\n return false;\n }\n }\n return true;\n }\n return false;\n}\n//# sourceMappingURL=deep-equal.js.map"],"names":[],"mappings":"AAMO,SAAS,eAAe,GAAG,GAAG;AACjC,QAAM,KAAK,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,IAAI,EAAE,IAAI;AAC/C,QAAM,KAAK,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,IAAI,EAAE,IAAI;AAC/C,QAAM,KAAK,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,IAAI,EAAE,IAAI;AAC/C,QAAM,KAAK,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,IAAI,EAAE,IAAI;AAC/C,SAAO,OAAO,MAAM,OAAO;AAC/B;AAQO,SAAS,UAAU,GAAG,GAAG;AAC5B,MAAI,MAAM,GAAG;AACT,WAAO;AAAA,EACV;AACD,MAAI,CAAC,KAAK,CAAC,GAAG;AACV,WAAO;AAAA,EACV;AACD,MAAI,MAAM,QAAQ,CAAC,GAAG;AAClB,QAAI,CAAC,MAAM,QAAQ,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ;AAC5C,aAAO;AAAA,IACV;AACD,aAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,KAAK;AAC/B,UAAI,CAAC,UAAU,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG;AACxB,eAAO;AAAA,MACV;AAAA,IACJ;AACD,WAAO;AAAA,EACV,WACQ,MAAM,QAAQ,CAAC,GAAG;AACvB,WAAO;AAAA,EACV;AACD,MAAI,OAAO,MAAM,YAAY,OAAO,MAAM,UAAU;AAChD,UAAM,QAAQ,OAAO,KAAK,CAAC;AAC3B,UAAM,QAAQ,OAAO,KAAK,CAAC;AAC3B,QAAI,MAAM,WAAW,MAAM,QAAQ;AAC/B,aAAO;AAAA,IACV;AACD,eAAW,OAAO,OAAO;AACrB,UAAI,CAAC,EAAE,eAAe,GAAG,GAAG;AACxB,eAAO;AAAA,MACV;AACD,UAAI,CAAC,UAAU,EAAE,GAAG,GAAG,EAAE,GAAG,CAAC,GAAG;AAC5B,eAAO;AAAA,MACV;AAAA,IACJ;AACD,WAAO;AAAA,EACV;AACD,SAAO;AACX;","x_google_ignoreList":[0]}
|
package/dist/es/main39.mjs
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { useContext, useMemo, useEffect } from "react";
|
|
2
|
-
import { MapContext } from "./main8.mjs";
|
|
3
|
-
function useControl(onCreate, arg1, arg2, arg3) {
|
|
4
|
-
const context = useContext(MapContext);
|
|
5
|
-
const ctrl = useMemo(() => onCreate(context), []);
|
|
6
|
-
useEffect(() => {
|
|
7
|
-
const opts = arg3 || arg2 || arg1;
|
|
8
|
-
const onAdd = typeof arg1 === "function" && typeof arg2 === "function" ? arg1 : null;
|
|
9
|
-
const onRemove = typeof arg2 === "function" ? arg2 : typeof arg1 === "function" ? arg1 : null;
|
|
10
|
-
const { map } = context;
|
|
11
|
-
if (!map.hasControl(ctrl)) {
|
|
12
|
-
map.addControl(ctrl, opts == null ? void 0 : opts.position);
|
|
13
|
-
if (onAdd) {
|
|
14
|
-
onAdd(context);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return () => {
|
|
18
|
-
if (onRemove) {
|
|
19
|
-
onRemove(context);
|
|
20
|
-
}
|
|
21
|
-
if (map.hasControl(ctrl)) {
|
|
22
|
-
map.removeControl(ctrl);
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
}, []);
|
|
26
|
-
return ctrl;
|
|
27
|
-
}
|
|
28
|
-
export {
|
|
29
|
-
useControl
|
|
30
|
-
};
|
|
31
|
-
//# sourceMappingURL=main39.mjs.map
|
package/dist/es/main39.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"main39.mjs","sources":["../../node_modules/@vis.gl/react-mapbox/dist/components/use-control.js"],"sourcesContent":["import { useContext, useMemo, useEffect } from 'react';\nimport { MapContext } from \"./map.js\";\nexport function useControl(onCreate, arg1, arg2, arg3) {\n const context = useContext(MapContext);\n const ctrl = useMemo(() => onCreate(context), []);\n useEffect(() => {\n const opts = (arg3 || arg2 || arg1);\n const onAdd = typeof arg1 === 'function' && typeof arg2 === 'function' ? arg1 : null;\n const onRemove = typeof arg2 === 'function' ? arg2 : typeof arg1 === 'function' ? arg1 : null;\n const { map } = context;\n if (!map.hasControl(ctrl)) {\n map.addControl(ctrl, opts?.position);\n if (onAdd) {\n onAdd(context);\n }\n }\n return () => {\n if (onRemove) {\n onRemove(context);\n }\n // Map might have been removed (parent effects are destroyed before child ones)\n if (map.hasControl(ctrl)) {\n map.removeControl(ctrl);\n }\n };\n }, []);\n return ctrl;\n}\n//# sourceMappingURL=use-control.js.map"],"names":[],"mappings":";;AAEO,SAAS,WAAW,UAAU,MAAM,MAAM,MAAM;AACnD,QAAM,UAAU,WAAW,UAAU;AACrC,QAAM,OAAO,QAAQ,MAAM,SAAS,OAAO,GAAG,CAAA,CAAE;AAChD,YAAU,MAAM;AACZ,UAAM,OAAQ,QAAQ,QAAQ;AAC9B,UAAM,QAAQ,OAAO,SAAS,cAAc,OAAO,SAAS,aAAa,OAAO;AAChF,UAAM,WAAW,OAAO,SAAS,aAAa,OAAO,OAAO,SAAS,aAAa,OAAO;AACzF,UAAM,EAAE,IAAK,IAAG;AAChB,QAAI,CAAC,IAAI,WAAW,IAAI,GAAG;AACvB,UAAI,WAAW,MAAM,6BAAM,QAAQ;AACnC,UAAI,OAAO;AACP,cAAM,OAAO;AAAA,MAChB;AAAA,IACJ;AACD,WAAO,MAAM;AACT,UAAI,UAAU;AACV,iBAAS,OAAO;AAAA,MACnB;AAED,UAAI,IAAI,WAAW,IAAI,GAAG;AACtB,YAAI,cAAc,IAAI;AAAA,MACzB;AAAA,IACb;AAAA,EACK,GAAE,CAAE,CAAA;AACL,SAAO;AACX;","x_google_ignoreList":[0]}
|
package/dist/es/main40.mjs
DELETED
package/dist/es/main40.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"main40.mjs","sources":["../../node_modules/@vis.gl/react-mapbox/dist/utils/assert.js"],"sourcesContent":["export default function assert(condition, message) {\n if (!condition) {\n throw new Error(message);\n }\n}\n//# sourceMappingURL=assert.js.map"],"names":[],"mappings":"AAAe,SAAS,OAAO,WAAW,SAAS;AAC/C,MAAI,CAAC,WAAW;AACZ,UAAM,IAAI,MAAM,OAAO;AAAA,EAC1B;AACL;","x_google_ignoreList":[0]}
|
package/dist/es/main41.mjs
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { deepEqual } from "./main38.mjs";
|
|
2
|
-
function cloneTransform(tr) {
|
|
3
|
-
const newTransform = tr.clone();
|
|
4
|
-
newTransform.pixelsToGLUnits = tr.pixelsToGLUnits;
|
|
5
|
-
return newTransform;
|
|
6
|
-
}
|
|
7
|
-
function syncProjection(src, dest) {
|
|
8
|
-
if (!src.getProjection) {
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
const srcProjection = src.getProjection();
|
|
12
|
-
const destProjection = dest.getProjection();
|
|
13
|
-
if (!deepEqual(srcProjection, destProjection)) {
|
|
14
|
-
dest.setProjection(srcProjection);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
function transformToViewState(tr) {
|
|
18
|
-
return {
|
|
19
|
-
longitude: tr.center.lng,
|
|
20
|
-
latitude: tr.center.lat,
|
|
21
|
-
zoom: tr.zoom,
|
|
22
|
-
pitch: tr.pitch,
|
|
23
|
-
bearing: tr.bearing,
|
|
24
|
-
padding: tr.padding
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
function applyViewStateToTransform(tr, props) {
|
|
28
|
-
const v = props.viewState || props;
|
|
29
|
-
let changed = false;
|
|
30
|
-
if ("zoom" in v) {
|
|
31
|
-
const zoom = tr.zoom;
|
|
32
|
-
tr.zoom = v.zoom;
|
|
33
|
-
changed = changed || zoom !== tr.zoom;
|
|
34
|
-
}
|
|
35
|
-
if ("bearing" in v) {
|
|
36
|
-
const bearing = tr.bearing;
|
|
37
|
-
tr.bearing = v.bearing;
|
|
38
|
-
changed = changed || bearing !== tr.bearing;
|
|
39
|
-
}
|
|
40
|
-
if ("pitch" in v) {
|
|
41
|
-
const pitch = tr.pitch;
|
|
42
|
-
tr.pitch = v.pitch;
|
|
43
|
-
changed = changed || pitch !== tr.pitch;
|
|
44
|
-
}
|
|
45
|
-
if (v.padding && !tr.isPaddingEqual(v.padding)) {
|
|
46
|
-
changed = true;
|
|
47
|
-
tr.padding = v.padding;
|
|
48
|
-
}
|
|
49
|
-
if ("longitude" in v && "latitude" in v) {
|
|
50
|
-
const center = tr.center;
|
|
51
|
-
tr.center = new center.constructor(v.longitude, v.latitude);
|
|
52
|
-
changed = changed || center !== tr.center;
|
|
53
|
-
}
|
|
54
|
-
return changed;
|
|
55
|
-
}
|
|
56
|
-
export {
|
|
57
|
-
applyViewStateToTransform,
|
|
58
|
-
cloneTransform,
|
|
59
|
-
syncProjection,
|
|
60
|
-
transformToViewState
|
|
61
|
-
};
|
|
62
|
-
//# sourceMappingURL=main41.mjs.map
|
package/dist/es/main41.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"main41.mjs","sources":["../../node_modules/@vis.gl/react-mapbox/dist/utils/transform.js"],"sourcesContent":["import { deepEqual } from \"./deep-equal.js\";\n/**\n * Make a copy of a transform\n * @param tr\n */\nexport function cloneTransform(tr) {\n const newTransform = tr.clone();\n // Work around mapbox bug - this value is not assigned in clone(), only in resize()\n newTransform.pixelsToGLUnits = tr.pixelsToGLUnits;\n return newTransform;\n}\n/**\n * Copy projection from one transform to another. This only applies to mapbox-gl transforms\n * @param src the transform to copy projection settings from\n * @param dest to transform to copy projection settings to\n */\nexport function syncProjection(src, dest) {\n if (!src.getProjection) {\n return;\n }\n const srcProjection = src.getProjection();\n const destProjection = dest.getProjection();\n if (!deepEqual(srcProjection, destProjection)) {\n dest.setProjection(srcProjection);\n }\n}\n/**\n * Capture a transform's current state\n * @param transform\n * @returns descriptor of the view state\n */\nexport function transformToViewState(tr) {\n return {\n longitude: tr.center.lng,\n latitude: tr.center.lat,\n zoom: tr.zoom,\n pitch: tr.pitch,\n bearing: tr.bearing,\n padding: tr.padding\n };\n}\n/* eslint-disable complexity */\n/**\n * Mutate a transform to match the given view state\n * @param transform\n * @param viewState\n * @returns true if the transform has changed\n */\nexport function applyViewStateToTransform(tr, props) {\n const v = props.viewState || props;\n let changed = false;\n if ('zoom' in v) {\n const zoom = tr.zoom;\n tr.zoom = v.zoom;\n changed = changed || zoom !== tr.zoom;\n }\n if ('bearing' in v) {\n const bearing = tr.bearing;\n tr.bearing = v.bearing;\n changed = changed || bearing !== tr.bearing;\n }\n if ('pitch' in v) {\n const pitch = tr.pitch;\n tr.pitch = v.pitch;\n changed = changed || pitch !== tr.pitch;\n }\n if (v.padding && !tr.isPaddingEqual(v.padding)) {\n changed = true;\n tr.padding = v.padding;\n }\n if ('longitude' in v && 'latitude' in v) {\n const center = tr.center;\n // @ts-ignore\n tr.center = new center.constructor(v.longitude, v.latitude);\n changed = changed || center !== tr.center;\n }\n return changed;\n}\n//# sourceMappingURL=transform.js.map"],"names":[],"mappings":";AAKO,SAAS,eAAe,IAAI;AAC/B,QAAM,eAAe,GAAG;AAExB,eAAa,kBAAkB,GAAG;AAClC,SAAO;AACX;AAMO,SAAS,eAAe,KAAK,MAAM;AACtC,MAAI,CAAC,IAAI,eAAe;AACpB;AAAA,EACH;AACD,QAAM,gBAAgB,IAAI;AAC1B,QAAM,iBAAiB,KAAK;AAC5B,MAAI,CAAC,UAAU,eAAe,cAAc,GAAG;AAC3C,SAAK,cAAc,aAAa;AAAA,EACnC;AACL;AAMO,SAAS,qBAAqB,IAAI;AACrC,SAAO;AAAA,IACH,WAAW,GAAG,OAAO;AAAA,IACrB,UAAU,GAAG,OAAO;AAAA,IACpB,MAAM,GAAG;AAAA,IACT,OAAO,GAAG;AAAA,IACV,SAAS,GAAG;AAAA,IACZ,SAAS,GAAG;AAAA,EACpB;AACA;AAQO,SAAS,0BAA0B,IAAI,OAAO;AACjD,QAAM,IAAI,MAAM,aAAa;AAC7B,MAAI,UAAU;AACd,MAAI,UAAU,GAAG;AACb,UAAM,OAAO,GAAG;AAChB,OAAG,OAAO,EAAE;AACZ,cAAU,WAAW,SAAS,GAAG;AAAA,EACpC;AACD,MAAI,aAAa,GAAG;AAChB,UAAM,UAAU,GAAG;AACnB,OAAG,UAAU,EAAE;AACf,cAAU,WAAW,YAAY,GAAG;AAAA,EACvC;AACD,MAAI,WAAW,GAAG;AACd,UAAM,QAAQ,GAAG;AACjB,OAAG,QAAQ,EAAE;AACb,cAAU,WAAW,UAAU,GAAG;AAAA,EACrC;AACD,MAAI,EAAE,WAAW,CAAC,GAAG,eAAe,EAAE,OAAO,GAAG;AAC5C,cAAU;AACV,OAAG,UAAU,EAAE;AAAA,EAClB;AACD,MAAI,eAAe,KAAK,cAAc,GAAG;AACrC,UAAM,SAAS,GAAG;AAElB,OAAG,SAAS,IAAI,OAAO,YAAY,EAAE,WAAW,EAAE,QAAQ;AAC1D,cAAU,WAAW,WAAW,GAAG;AAAA,EACtC;AACD,SAAO;AACX;","x_google_ignoreList":[0]}
|
package/dist/es/main42.mjs
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
const refProps = ["type", "source", "source-layer", "minzoom", "maxzoom", "filter", "layout"];
|
|
2
|
-
function normalizeStyle(style) {
|
|
3
|
-
if (!style) {
|
|
4
|
-
return null;
|
|
5
|
-
}
|
|
6
|
-
if (typeof style === "string") {
|
|
7
|
-
return style;
|
|
8
|
-
}
|
|
9
|
-
if ("toJS" in style) {
|
|
10
|
-
style = style.toJS();
|
|
11
|
-
}
|
|
12
|
-
if (!style.layers) {
|
|
13
|
-
return style;
|
|
14
|
-
}
|
|
15
|
-
const layerIndex = {};
|
|
16
|
-
for (const layer of style.layers) {
|
|
17
|
-
layerIndex[layer.id] = layer;
|
|
18
|
-
}
|
|
19
|
-
const layers = style.layers.map((layer) => {
|
|
20
|
-
let normalizedLayer = null;
|
|
21
|
-
if ("interactive" in layer) {
|
|
22
|
-
normalizedLayer = Object.assign({}, layer);
|
|
23
|
-
delete normalizedLayer.interactive;
|
|
24
|
-
}
|
|
25
|
-
const layerRef = layerIndex[layer.ref];
|
|
26
|
-
if (layerRef) {
|
|
27
|
-
normalizedLayer = normalizedLayer || Object.assign({}, layer);
|
|
28
|
-
delete normalizedLayer.ref;
|
|
29
|
-
for (const propName of refProps) {
|
|
30
|
-
if (propName in layerRef) {
|
|
31
|
-
normalizedLayer[propName] = layerRef[propName];
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return normalizedLayer || layer;
|
|
36
|
-
});
|
|
37
|
-
return { ...style, layers };
|
|
38
|
-
}
|
|
39
|
-
export {
|
|
40
|
-
normalizeStyle
|
|
41
|
-
};
|
|
42
|
-
//# sourceMappingURL=main42.mjs.map
|
package/dist/es/main42.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"main42.mjs","sources":["../../node_modules/@vis.gl/react-mapbox/dist/utils/style-utils.js"],"sourcesContent":["const refProps = ['type', 'source', 'source-layer', 'minzoom', 'maxzoom', 'filter', 'layout'];\n// Prepare a map style object for diffing\n// If immutable - convert to plain object\n// Work around some issues in older styles that would fail Mapbox's diffing\nexport function normalizeStyle(style) {\n if (!style) {\n return null;\n }\n if (typeof style === 'string') {\n return style;\n }\n if ('toJS' in style) {\n style = style.toJS();\n }\n if (!style.layers) {\n return style;\n }\n const layerIndex = {};\n for (const layer of style.layers) {\n layerIndex[layer.id] = layer;\n }\n const layers = style.layers.map(layer => {\n let normalizedLayer = null;\n if ('interactive' in layer) {\n normalizedLayer = Object.assign({}, layer);\n // Breaks style diffing :(\n // @ts-ignore legacy field not typed\n delete normalizedLayer.interactive;\n }\n // Style diffing doesn't work with refs so expand them out manually before diffing.\n // @ts-ignore legacy field not typed\n const layerRef = layerIndex[layer.ref];\n if (layerRef) {\n normalizedLayer = normalizedLayer || Object.assign({}, layer);\n // @ts-ignore\n delete normalizedLayer.ref;\n // https://github.com/mapbox/mapbox-gl-js/blob/master/src/style-spec/deref.js\n for (const propName of refProps) {\n if (propName in layerRef) {\n normalizedLayer[propName] = layerRef[propName];\n }\n }\n }\n return normalizedLayer || layer;\n });\n // Do not mutate the style object provided by the user\n return { ...style, layers };\n}\n//# sourceMappingURL=style-utils.js.map"],"names":[],"mappings":"AAAA,MAAM,WAAW,CAAC,QAAQ,UAAU,gBAAgB,WAAW,WAAW,UAAU,QAAQ;AAIrF,SAAS,eAAe,OAAO;AAClC,MAAI,CAAC,OAAO;AACR,WAAO;AAAA,EACV;AACD,MAAI,OAAO,UAAU,UAAU;AAC3B,WAAO;AAAA,EACV;AACD,MAAI,UAAU,OAAO;AACjB,YAAQ,MAAM;EACjB;AACD,MAAI,CAAC,MAAM,QAAQ;AACf,WAAO;AAAA,EACV;AACD,QAAM,aAAa,CAAA;AACnB,aAAW,SAAS,MAAM,QAAQ;AAC9B,eAAW,MAAM,EAAE,IAAI;AAAA,EAC1B;AACD,QAAM,SAAS,MAAM,OAAO,IAAI,WAAS;AACrC,QAAI,kBAAkB;AACtB,QAAI,iBAAiB,OAAO;AACxB,wBAAkB,OAAO,OAAO,CAAE,GAAE,KAAK;AAGzC,aAAO,gBAAgB;AAAA,IAC1B;AAGD,UAAM,WAAW,WAAW,MAAM,GAAG;AACrC,QAAI,UAAU;AACV,wBAAkB,mBAAmB,OAAO,OAAO,CAAE,GAAE,KAAK;AAE5D,aAAO,gBAAgB;AAEvB,iBAAW,YAAY,UAAU;AAC7B,YAAI,YAAY,UAAU;AACtB,0BAAgB,QAAQ,IAAI,SAAS,QAAQ;AAAA,QAChD;AAAA,MACJ;AAAA,IACJ;AACD,WAAO,mBAAmB;AAAA,EAClC,CAAK;AAED,SAAO,EAAE,GAAG,OAAO;AACvB;","x_google_ignoreList":[0]}
|