@dxos/solid-ui-geo 0.8.4-main.3eb6e50203 → 0.8.4-main.3fbcb4aa9b
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/lib/browser/chunk-RMZP4JBX.mjs +9 -0
- package/dist/lib/browser/{countries-110m-6FO6R2F2.mjs → countries-110m-MXSNZ6PF.mjs} +1 -1
- package/dist/lib/browser/data.mjs +1 -1
- package/dist/lib/browser/index.mjs +241 -196
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/translations.mjs +19 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-KNEGK7HI.mjs → chunk-ICM52DKE.mjs} +2 -2
- package/dist/lib/node-esm/{countries-110m-UQ4O6NQR.mjs → countries-110m-HEHEK3AV.mjs} +1 -1
- package/dist/lib/node-esm/data.mjs +1 -1
- package/dist/lib/node-esm/index.mjs +241 -196
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/translations.mjs +21 -0
- package/dist/lib/node-esm/translations.mjs.map +7 -0
- package/dist/types/data/airports.d.ts +4 -4
- package/dist/types/data/airports.d.ts.map +1 -1
- package/dist/types/data/countries-110m.d.ts.map +1 -1
- package/dist/types/data/countries-dots-3.d.ts.map +1 -1
- package/dist/types/src/components/Globe/Globe.d.ts.map +1 -1
- package/dist/types/src/components/Globe/Globe.solid-stories.d.ts +3 -3
- package/dist/types/src/components/Globe/Globe.solid-stories.d.ts.map +1 -1
- package/dist/types/src/components/Map/Map.d.ts +1 -1
- package/dist/types/src/components/Map/Map.d.ts.map +1 -1
- package/dist/types/src/components/Map/Map.solid-stories.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Controls.d.ts.map +1 -1
- package/dist/types/src/hooks/context.d.ts.map +1 -1
- package/dist/types/src/hooks/useDrag.d.ts.map +1 -1
- package/dist/types/src/hooks/useGlobeZoomHandler.d.ts +1 -1
- package/dist/types/src/hooks/useGlobeZoomHandler.d.ts.map +1 -1
- package/dist/types/src/hooks/useMapZoomHandler.d.ts +1 -1
- package/dist/types/src/hooks/useMapZoomHandler.d.ts.map +1 -1
- package/dist/types/src/hooks/useSpinner.d.ts.map +1 -1
- package/dist/types/src/hooks/useTour.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +0 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +4 -4
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/util/debug.d.ts.map +1 -1
- package/dist/types/src/util/inertia.d.ts.map +1 -1
- package/dist/types/src/util/path.d.ts.map +1 -1
- package/dist/types/src/util/render.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +24 -22
- package/src/components/Globe/Globe.solid-stories.tsx +2 -3
- package/src/components/Globe/Globe.tsx +7 -5
- package/src/components/Map/Map.solid-stories.tsx +0 -1
- package/src/components/Map/Map.tsx +18 -7
- package/src/components/Toolbar/Controls.tsx +4 -4
- package/src/hooks/useSpinner.ts +0 -1
- package/src/index.ts +0 -1
- package/src/util/render.ts +0 -1
- package/dist/lib/browser/chunk-KONL6N4F.mjs +0 -9
- /package/dist/lib/browser/{chunk-KONL6N4F.mjs.map → chunk-RMZP4JBX.mjs.map} +0 -0
- /package/dist/lib/browser/{countries-110m-6FO6R2F2.mjs.map → countries-110m-MXSNZ6PF.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-KNEGK7HI.mjs.map → chunk-ICM52DKE.mjs.map} +0 -0
- /package/dist/lib/node-esm/{countries-110m-UQ4O6NQR.mjs.map → countries-110m-HEHEK3AV.mjs.map} +0 -0
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
loadTopology
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ICM52DKE.mjs";
|
|
5
5
|
|
|
6
6
|
// src/components/Globe/Globe.tsx
|
|
7
|
-
import {
|
|
7
|
+
import { template as _$template2 } from "solid-js/web";
|
|
8
|
+
import { className as _$className2 } from "solid-js/web";
|
|
9
|
+
import { setAttribute as _$setAttribute } from "solid-js/web";
|
|
10
|
+
import { effect as _$effect2 } from "solid-js/web";
|
|
11
|
+
import { memo as _$memo } from "solid-js/web";
|
|
12
|
+
import { createComponent as _$createComponent2 } from "solid-js/web";
|
|
13
|
+
import { insert as _$insert } from "solid-js/web";
|
|
14
|
+
import { use as _$use } from "solid-js/web";
|
|
15
|
+
import { spread as _$spread } from "solid-js/web";
|
|
16
|
+
import { mergeProps as _$mergeProps } from "solid-js/web";
|
|
8
17
|
import { createResizeObserver } from "@solid-primitives/resize-observer";
|
|
9
18
|
import { easeLinear, easeSinOut, geoMercator, geoOrthographic, geoPath as geoPath2, geoTransverseMercator, interpolateNumber, transition } from "d3";
|
|
10
19
|
import { Show, createEffect as createEffect5, createMemo, createSignal as createSignal4 } from "solid-js";
|
|
20
|
+
import { mx } from "@dxos/ui-theme";
|
|
11
21
|
|
|
12
22
|
// src/hooks/context.tsx
|
|
13
|
-
import {
|
|
23
|
+
import { createComponent as _$createComponent } from "solid-js/web";
|
|
14
24
|
import { createContext, createEffect, createSignal, useContext } from "solid-js";
|
|
15
25
|
import { raise } from "@dxos/debug";
|
|
16
26
|
var defaults = {
|
|
@@ -35,7 +45,7 @@ var GlobeContextProvider = (props) => {
|
|
|
35
45
|
setSize(props.size);
|
|
36
46
|
}
|
|
37
47
|
});
|
|
38
|
-
return
|
|
48
|
+
return _$createComponent(GlobeContext.Provider, {
|
|
39
49
|
value: {
|
|
40
50
|
size,
|
|
41
51
|
center,
|
|
@@ -47,7 +57,9 @@ var GlobeContextProvider = (props) => {
|
|
|
47
57
|
setTranslation,
|
|
48
58
|
setRotation
|
|
49
59
|
},
|
|
50
|
-
children
|
|
60
|
+
get children() {
|
|
61
|
+
return props.children;
|
|
62
|
+
}
|
|
51
63
|
});
|
|
52
64
|
};
|
|
53
65
|
var useGlobeContext = () => {
|
|
@@ -618,7 +630,12 @@ var useTour = (controller, points, options = {}) => {
|
|
|
618
630
|
};
|
|
619
631
|
|
|
620
632
|
// src/components/Toolbar/Controls.tsx
|
|
621
|
-
import {
|
|
633
|
+
import { template as _$template } from "solid-js/web";
|
|
634
|
+
import { delegateEvents as _$delegateEvents } from "solid-js/web";
|
|
635
|
+
import { className as _$className } from "solid-js/web";
|
|
636
|
+
import { effect as _$effect } from "solid-js/web";
|
|
637
|
+
var _tmpl$ = /* @__PURE__ */ _$template(`<div><button type=button class="dx-button dx-focus-ring w-10 h-10 min-h-[2.5rem] px-3 rounded-xs flex items-center justify-center"title="Zoom in"><span class=text-xl>+</span></button><button type=button class="dx-button dx-focus-ring w-10 h-10 min-h-[2.5rem] px-3 rounded-xs flex items-center justify-center"title="Zoom out"><span class=text-xl>\u2212`);
|
|
638
|
+
var _tmpl$2 = /* @__PURE__ */ _$template(`<div><button type=button class="dx-button dx-focus-ring w-10 h-10 min-h-[2.5rem] px-3 rounded-xs flex items-center justify-center"title=Start><span class=text-xl>\u25B6</span></button><button type=button class="dx-button dx-focus-ring w-10 h-10 min-h-[2.5rem] px-3 rounded-xs flex items-center justify-center"title=Toggle><span class=text-xl>\u{1F30D}`);
|
|
622
639
|
var controlPositions = {
|
|
623
640
|
topleft: "top-2 left-2",
|
|
624
641
|
topright: "top-2 right-2",
|
|
@@ -626,61 +643,29 @@ var controlPositions = {
|
|
|
626
643
|
bottomright: "bottom-2 right-2"
|
|
627
644
|
};
|
|
628
645
|
var ZoomControls = (props) => {
|
|
629
|
-
return
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
title: "Zoom in",
|
|
637
|
-
children: /* @__PURE__ */ _jsx2("span", {
|
|
638
|
-
class: "text-xl",
|
|
639
|
-
children: "+"
|
|
640
|
-
})
|
|
641
|
-
}),
|
|
642
|
-
/* @__PURE__ */ _jsx2("button", {
|
|
643
|
-
type: "button",
|
|
644
|
-
class: "dx-button dx-focus-ring w-10 h-10 min-bs-[2.5rem] pli-3 rounded-sm flex items-center justify-center",
|
|
645
|
-
onClick: () => props.onAction?.("zoom-out"),
|
|
646
|
-
title: "Zoom out",
|
|
647
|
-
children: /* @__PURE__ */ _jsx2("span", {
|
|
648
|
-
class: "text-xl",
|
|
649
|
-
children: "\u2212"
|
|
650
|
-
})
|
|
651
|
-
})
|
|
652
|
-
]
|
|
653
|
-
});
|
|
646
|
+
return (() => {
|
|
647
|
+
var _el$ = _tmpl$(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling;
|
|
648
|
+
_el$2.$$click = () => props.onAction?.("zoom-in");
|
|
649
|
+
_el$3.$$click = () => props.onAction?.("zoom-out");
|
|
650
|
+
_$effect(() => _$className(_el$, `flex flex-row gap-2 ${props.class ?? ""}`));
|
|
651
|
+
return _el$;
|
|
652
|
+
})();
|
|
654
653
|
};
|
|
655
654
|
var ActionControls = (props) => {
|
|
656
|
-
return
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
title: "Start",
|
|
664
|
-
children: /* @__PURE__ */ _jsx2("span", {
|
|
665
|
-
class: "text-xl",
|
|
666
|
-
children: "\u25B6"
|
|
667
|
-
})
|
|
668
|
-
}),
|
|
669
|
-
/* @__PURE__ */ _jsx2("button", {
|
|
670
|
-
type: "button",
|
|
671
|
-
class: "dx-button dx-focus-ring w-10 h-10 min-bs-[2.5rem] pli-3 rounded-sm flex items-center justify-center",
|
|
672
|
-
onClick: () => props.onAction?.("toggle"),
|
|
673
|
-
title: "Toggle",
|
|
674
|
-
children: /* @__PURE__ */ _jsx2("span", {
|
|
675
|
-
class: "text-xl",
|
|
676
|
-
children: "\u{1F30D}"
|
|
677
|
-
})
|
|
678
|
-
})
|
|
679
|
-
]
|
|
680
|
-
});
|
|
655
|
+
return (() => {
|
|
656
|
+
var _el$4 = _tmpl$2(), _el$5 = _el$4.firstChild, _el$6 = _el$5.nextSibling;
|
|
657
|
+
_el$5.$$click = () => props.onAction?.("start");
|
|
658
|
+
_el$6.$$click = () => props.onAction?.("toggle");
|
|
659
|
+
_$effect(() => _$className(_el$4, `flex flex-row gap-2 ${props.class ?? ""}`));
|
|
660
|
+
return _el$4;
|
|
661
|
+
})();
|
|
681
662
|
};
|
|
663
|
+
_$delegateEvents(["click"]);
|
|
682
664
|
|
|
683
665
|
// src/components/Globe/Globe.tsx
|
|
666
|
+
var _tmpl$3 = /* @__PURE__ */ _$template2(`<div>`);
|
|
667
|
+
var _tmpl$22 = /* @__PURE__ */ _$template2(`<canvas>`);
|
|
668
|
+
var _tmpl$32 = /* @__PURE__ */ _$template2(`<div><pre class="font-mono text-xs text-green-700">`);
|
|
684
669
|
var defaultStyles = {
|
|
685
670
|
light: {
|
|
686
671
|
background: {
|
|
@@ -741,22 +726,33 @@ var GlobeRoot = (props) => {
|
|
|
741
726
|
width: 0,
|
|
742
727
|
height: 0
|
|
743
728
|
});
|
|
744
|
-
createResizeObserver(() => containerRef, ({
|
|
729
|
+
createResizeObserver(() => containerRef, ({
|
|
730
|
+
width,
|
|
731
|
+
height
|
|
732
|
+
}) => {
|
|
745
733
|
setSize({
|
|
746
734
|
width,
|
|
747
735
|
height
|
|
748
736
|
});
|
|
749
737
|
});
|
|
750
|
-
return
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
738
|
+
return _$createComponent2(GlobeContextProvider, _$mergeProps({
|
|
739
|
+
get size() {
|
|
740
|
+
return size();
|
|
741
|
+
}
|
|
742
|
+
}, props, {
|
|
743
|
+
get children() {
|
|
744
|
+
var _el$ = _tmpl$3();
|
|
745
|
+
var _ref$ = containerRef;
|
|
746
|
+
typeof _ref$ === "function" ? _$use(_ref$, _el$) : containerRef = _el$;
|
|
747
|
+
_$spread(_el$, _$mergeProps({
|
|
748
|
+
get ["class"]() {
|
|
749
|
+
return mx("relative dx-container");
|
|
750
|
+
}
|
|
751
|
+
}, props), false, true);
|
|
752
|
+
_$insert(_el$, () => props.children);
|
|
753
|
+
return _el$;
|
|
754
|
+
}
|
|
755
|
+
}));
|
|
760
756
|
};
|
|
761
757
|
var GlobeCanvas = (props) => {
|
|
762
758
|
const themeMode = "dark";
|
|
@@ -766,7 +762,17 @@ var GlobeCanvas = (props) => {
|
|
|
766
762
|
const layers = createMemo(() => {
|
|
767
763
|
return timer(() => createLayers(props.topology, props.features, styles()));
|
|
768
764
|
});
|
|
769
|
-
const {
|
|
765
|
+
const {
|
|
766
|
+
size,
|
|
767
|
+
center,
|
|
768
|
+
zoom,
|
|
769
|
+
translation,
|
|
770
|
+
rotation,
|
|
771
|
+
setCenter,
|
|
772
|
+
setZoom,
|
|
773
|
+
setTranslation,
|
|
774
|
+
setRotation
|
|
775
|
+
} = useGlobeContext();
|
|
770
776
|
let zoomValue = zoom();
|
|
771
777
|
let zooming = false;
|
|
772
778
|
createEffect5(() => {
|
|
@@ -827,65 +833,89 @@ var GlobeCanvas = (props) => {
|
|
|
827
833
|
const s = size();
|
|
828
834
|
if (canvasEl && proj && gen) {
|
|
829
835
|
timer(() => {
|
|
830
|
-
proj.scale(Math.min(s.width, s.height) / 2 * z).translate([
|
|
831
|
-
s.width / 2 + (t?.x ?? 0),
|
|
832
|
-
s.height / 2 + (t?.y ?? 0)
|
|
833
|
-
]).rotate(r ?? [
|
|
834
|
-
0,
|
|
835
|
-
0,
|
|
836
|
-
0
|
|
837
|
-
]);
|
|
836
|
+
proj.scale(Math.min(s.width, s.height) / 2 * z).translate([s.width / 2 + (t?.x ?? 0), s.height / 2 + (t?.y ?? 0)]).rotate(r ?? [0, 0, 0]);
|
|
838
837
|
renderLayers(gen, layers(), z, styles());
|
|
839
838
|
});
|
|
840
839
|
}
|
|
841
840
|
});
|
|
842
|
-
return
|
|
843
|
-
when
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
841
|
+
return _$createComponent2(Show, {
|
|
842
|
+
get when() {
|
|
843
|
+
return _$memo(() => size().width > 0)() && size().height > 0;
|
|
844
|
+
},
|
|
845
|
+
get children() {
|
|
846
|
+
var _el$2 = _tmpl$22();
|
|
847
|
+
_$use(setCanvas, _el$2);
|
|
848
|
+
_$effect2((_p$) => {
|
|
849
|
+
var _v$ = size().width, _v$2 = size().height;
|
|
850
|
+
_v$ !== _p$.e && _$setAttribute(_el$2, "width", _p$.e = _v$);
|
|
851
|
+
_v$2 !== _p$.t && _$setAttribute(_el$2, "height", _p$.t = _v$2);
|
|
852
|
+
return _p$;
|
|
853
|
+
}, {
|
|
854
|
+
e: void 0,
|
|
855
|
+
t: void 0
|
|
856
|
+
});
|
|
857
|
+
return _el$2;
|
|
858
|
+
}
|
|
849
859
|
});
|
|
850
860
|
};
|
|
851
861
|
var GlobeDebug = (props) => {
|
|
852
|
-
const {
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
862
|
+
const {
|
|
863
|
+
size,
|
|
864
|
+
zoom,
|
|
865
|
+
translation,
|
|
866
|
+
rotation
|
|
867
|
+
} = useGlobeContext();
|
|
868
|
+
return (() => {
|
|
869
|
+
var _el$3 = _tmpl$32(), _el$4 = _el$3.firstChild;
|
|
870
|
+
_$insert(_el$4, () => JSON.stringify({
|
|
871
|
+
size,
|
|
872
|
+
zoom: zoom(),
|
|
873
|
+
translation: translation(),
|
|
874
|
+
rotation: rotation()
|
|
875
|
+
}, null, 2));
|
|
876
|
+
_$effect2(() => _$className2(_el$3, `z-10 absolute w-96 p-2 overflow-hidden border border-green-700 rounded-sm ${controlPositions[props.position ?? "topleft"]}`));
|
|
877
|
+
return _el$3;
|
|
878
|
+
})();
|
|
865
879
|
};
|
|
866
880
|
var GlobePanel = (props) => {
|
|
867
|
-
return
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
881
|
+
return (() => {
|
|
882
|
+
var _el$5 = _tmpl$3();
|
|
883
|
+
_$insert(_el$5, () => props.children);
|
|
884
|
+
_$effect2(() => _$className2(_el$5, `z-10 absolute overflow-hidden ${controlPositions[props.position ?? "topleft"]} ${props.class ?? ""}`));
|
|
885
|
+
return _el$5;
|
|
886
|
+
})();
|
|
871
887
|
};
|
|
872
888
|
var CustomControl = (props) => {
|
|
873
|
-
return
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
889
|
+
return (() => {
|
|
890
|
+
var _el$6 = _tmpl$3();
|
|
891
|
+
_$insert(_el$6, () => props.children);
|
|
892
|
+
_$effect2(() => _$className2(_el$6, `z-10 absolute overflow-hidden ${controlPositions[props.position]}`));
|
|
893
|
+
return _el$6;
|
|
894
|
+
})();
|
|
877
895
|
};
|
|
878
|
-
var GlobeZoom = (props) =>
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
896
|
+
var GlobeZoom = (props) => _$createComponent2(CustomControl, {
|
|
897
|
+
get position() {
|
|
898
|
+
return props.position ?? "bottomleft";
|
|
899
|
+
},
|
|
900
|
+
get children() {
|
|
901
|
+
return _$createComponent2(ZoomControls, {
|
|
902
|
+
get onAction() {
|
|
903
|
+
return props.onAction;
|
|
904
|
+
}
|
|
905
|
+
});
|
|
906
|
+
}
|
|
883
907
|
});
|
|
884
|
-
var GlobeAction = (props) =>
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
908
|
+
var GlobeAction = (props) => _$createComponent2(CustomControl, {
|
|
909
|
+
get position() {
|
|
910
|
+
return props.position ?? "bottomright";
|
|
911
|
+
},
|
|
912
|
+
get children() {
|
|
913
|
+
return _$createComponent2(ActionControls, {
|
|
914
|
+
get onAction() {
|
|
915
|
+
return props.onAction;
|
|
916
|
+
}
|
|
917
|
+
});
|
|
918
|
+
}
|
|
889
919
|
});
|
|
890
920
|
var Globe = {
|
|
891
921
|
Root: GlobeRoot,
|
|
@@ -897,10 +927,18 @@ var Globe = {
|
|
|
897
927
|
};
|
|
898
928
|
|
|
899
929
|
// src/components/Map/Map.tsx
|
|
900
|
-
import {
|
|
930
|
+
import { template as _$template3 } from "solid-js/web";
|
|
931
|
+
import { memo as _$memo2 } from "solid-js/web";
|
|
932
|
+
import { insert as _$insert2 } from "solid-js/web";
|
|
933
|
+
import { createComponent as _$createComponent3 } from "solid-js/web";
|
|
934
|
+
import { className as _$className3 } from "solid-js/web";
|
|
935
|
+
import { effect as _$effect3 } from "solid-js/web";
|
|
936
|
+
import { use as _$use2 } from "solid-js/web";
|
|
901
937
|
import "leaflet/dist/leaflet.css";
|
|
902
938
|
import L, { latLngBounds } from "leaflet";
|
|
903
939
|
import { Show as Show2, createContext as createContext2, createEffect as createEffect6, createSignal as createSignal5, onCleanup as onCleanup4, onMount, useContext as useContext2 } from "solid-js";
|
|
940
|
+
var _tmpl$4 = /* @__PURE__ */ _$template3(`<div style=z-index:0>`);
|
|
941
|
+
var _tmpl$23 = /* @__PURE__ */ _$template3(`<div style=display:contents>`);
|
|
904
942
|
var defaults2 = {
|
|
905
943
|
center: {
|
|
906
944
|
lat: 51,
|
|
@@ -921,7 +959,9 @@ var MapRoot = (props) => {
|
|
|
921
959
|
const [map, setMap] = createSignal5(null);
|
|
922
960
|
const [attention, setAttention] = createSignal5(false);
|
|
923
961
|
onMount(() => {
|
|
924
|
-
if (!mapContainer)
|
|
962
|
+
if (!mapContainer) {
|
|
963
|
+
return;
|
|
964
|
+
}
|
|
925
965
|
const leafletMap = L.map(mapContainer, {
|
|
926
966
|
center: props.center ?? defaults2.center,
|
|
927
967
|
zoom: props.zoom ?? defaults2.zoom,
|
|
@@ -948,41 +988,54 @@ var MapRoot = (props) => {
|
|
|
948
988
|
});
|
|
949
989
|
createEffect6(() => {
|
|
950
990
|
const leafletMap = map();
|
|
951
|
-
if (!leafletMap)
|
|
991
|
+
if (!leafletMap) {
|
|
992
|
+
return;
|
|
993
|
+
}
|
|
952
994
|
if (attention()) {
|
|
953
995
|
leafletMap.scrollWheelZoom.enable();
|
|
954
996
|
} else {
|
|
955
997
|
leafletMap.scrollWheelZoom.disable();
|
|
956
998
|
}
|
|
957
999
|
});
|
|
958
|
-
return
|
|
959
|
-
value
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
1000
|
+
return _$createComponent3(MapContext.Provider, {
|
|
1001
|
+
get value() {
|
|
1002
|
+
return {
|
|
1003
|
+
map,
|
|
1004
|
+
attention,
|
|
1005
|
+
setAttention,
|
|
1006
|
+
onChange: props.onChange
|
|
1007
|
+
};
|
|
964
1008
|
},
|
|
965
|
-
children
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
1009
|
+
get children() {
|
|
1010
|
+
return [(() => {
|
|
1011
|
+
var _el$ = _tmpl$4();
|
|
1012
|
+
var _ref$ = mapContainer;
|
|
1013
|
+
typeof _ref$ === "function" ? _$use2(_ref$, _el$) : mapContainer = _el$;
|
|
1014
|
+
_$effect3(() => _$className3(_el$, `group relative grid h-full w-full bg-gray-100 dark:bg-gray-900 ${props.class ?? ""}`));
|
|
1015
|
+
return _el$;
|
|
1016
|
+
})(), _$createComponent3(Show2, {
|
|
1017
|
+
get when() {
|
|
1018
|
+
return map();
|
|
1019
|
+
},
|
|
1020
|
+
get children() {
|
|
1021
|
+
return props.children;
|
|
971
1022
|
}
|
|
972
|
-
})
|
|
973
|
-
|
|
974
|
-
when: map(),
|
|
975
|
-
children: props.children
|
|
976
|
-
})
|
|
977
|
-
]
|
|
1023
|
+
})];
|
|
1024
|
+
}
|
|
978
1025
|
});
|
|
979
1026
|
};
|
|
980
1027
|
var MapTiles = () => {
|
|
981
|
-
const {
|
|
1028
|
+
const {
|
|
1029
|
+
map,
|
|
1030
|
+
onChange,
|
|
1031
|
+
attention
|
|
1032
|
+
} = useMapContext(MapTiles.name);
|
|
982
1033
|
let tileLayer = null;
|
|
983
1034
|
createEffect6(() => {
|
|
984
1035
|
const leafletMap = map();
|
|
985
|
-
if (!leafletMap)
|
|
1036
|
+
if (!leafletMap) {
|
|
1037
|
+
return;
|
|
1038
|
+
}
|
|
986
1039
|
const att = attention();
|
|
987
1040
|
tileLayer = L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
|
|
988
1041
|
detectRetina: true,
|
|
@@ -1015,7 +1068,9 @@ var MapTiles = () => {
|
|
|
1015
1068
|
return null;
|
|
1016
1069
|
};
|
|
1017
1070
|
var MapMarkers = (props) => {
|
|
1018
|
-
const {
|
|
1071
|
+
const {
|
|
1072
|
+
map
|
|
1073
|
+
} = useMapContext(MapMarkers.name);
|
|
1019
1074
|
const leafletMarkers = [];
|
|
1020
1075
|
let lastMarkerIds = /* @__PURE__ */ new Set();
|
|
1021
1076
|
onCleanup4(() => {
|
|
@@ -1024,12 +1079,12 @@ var MapMarkers = (props) => {
|
|
|
1024
1079
|
});
|
|
1025
1080
|
createEffect6(() => {
|
|
1026
1081
|
const leafletMap = map();
|
|
1027
|
-
if (!leafletMap)
|
|
1082
|
+
if (!leafletMap) {
|
|
1083
|
+
return;
|
|
1084
|
+
}
|
|
1028
1085
|
const markerList = props.markers?.() ?? [];
|
|
1029
1086
|
const currentIds = new Set(markerList.map((m) => m.id));
|
|
1030
|
-
if (currentIds.size === lastMarkerIds.size && [
|
|
1031
|
-
...currentIds
|
|
1032
|
-
].every((id) => lastMarkerIds.has(id)) && leafletMarkers.length > 0) {
|
|
1087
|
+
if (currentIds.size === lastMarkerIds.size && [...currentIds].every((id) => lastMarkerIds.has(id)) && leafletMarkers.length > 0) {
|
|
1033
1088
|
return;
|
|
1034
1089
|
}
|
|
1035
1090
|
leafletMarkers.forEach((marker) => marker.remove());
|
|
@@ -1038,28 +1093,19 @@ var MapMarkers = (props) => {
|
|
|
1038
1093
|
if (markerList.length > 0) {
|
|
1039
1094
|
const bounds = latLngBounds(markerList.map((marker) => marker.location));
|
|
1040
1095
|
leafletMap.fitBounds(bounds);
|
|
1041
|
-
markerList.forEach(({
|
|
1096
|
+
markerList.forEach(({
|
|
1097
|
+
title,
|
|
1098
|
+
location
|
|
1099
|
+
}) => {
|
|
1042
1100
|
const marker = L.marker(location, {
|
|
1043
1101
|
icon: new L.Icon({
|
|
1044
1102
|
iconUrl: "https://dxos.network/marker-icon.png",
|
|
1045
1103
|
iconRetinaUrl: "https://dxos.network/marker-icon-2x.png",
|
|
1046
1104
|
shadowUrl: "https://dxos.network/marker-shadow.png",
|
|
1047
|
-
iconSize: [
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
]
|
|
1051
|
-
iconAnchor: [
|
|
1052
|
-
12,
|
|
1053
|
-
41
|
|
1054
|
-
],
|
|
1055
|
-
popupAnchor: [
|
|
1056
|
-
1,
|
|
1057
|
-
-34
|
|
1058
|
-
],
|
|
1059
|
-
shadowSize: [
|
|
1060
|
-
41,
|
|
1061
|
-
41
|
|
1062
|
-
]
|
|
1105
|
+
iconSize: [25, 41],
|
|
1106
|
+
iconAnchor: [12, 41],
|
|
1107
|
+
popupAnchor: [1, -34],
|
|
1108
|
+
shadowSize: [41, 41]
|
|
1063
1109
|
})
|
|
1064
1110
|
});
|
|
1065
1111
|
if (title) {
|
|
@@ -1075,14 +1121,18 @@ var MapMarkers = (props) => {
|
|
|
1075
1121
|
return null;
|
|
1076
1122
|
};
|
|
1077
1123
|
var CustomControl2 = (props) => {
|
|
1078
|
-
const {
|
|
1124
|
+
const {
|
|
1125
|
+
map: mapAccessor
|
|
1126
|
+
} = useMapContext(CustomControl2.name);
|
|
1079
1127
|
let controlContainer;
|
|
1080
1128
|
createEffect6(() => {
|
|
1081
1129
|
const map = mapAccessor();
|
|
1082
|
-
if (!map || !controlContainer)
|
|
1130
|
+
if (!map || !controlContainer) {
|
|
1131
|
+
return;
|
|
1132
|
+
}
|
|
1083
1133
|
const Control = L.Control.extend({
|
|
1084
1134
|
onAdd: () => {
|
|
1085
|
-
const container = L.DomUtil.create("div", `${controlPositions[props.position]}
|
|
1135
|
+
const container = L.DomUtil.create("div", `${controlPositions[props.position]} m-0!`);
|
|
1086
1136
|
L.DomEvent.disableClickPropagation(container);
|
|
1087
1137
|
L.DomEvent.disableScrollPropagation(container);
|
|
1088
1138
|
if (controlContainer) {
|
|
@@ -1099,25 +1149,37 @@ var CustomControl2 = (props) => {
|
|
|
1099
1149
|
control.remove();
|
|
1100
1150
|
});
|
|
1101
1151
|
});
|
|
1102
|
-
return
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
});
|
|
1152
|
+
return (() => {
|
|
1153
|
+
var _el$2 = _tmpl$23();
|
|
1154
|
+
var _ref$2 = controlContainer;
|
|
1155
|
+
typeof _ref$2 === "function" ? _$use2(_ref$2, _el$2) : controlContainer = _el$2;
|
|
1156
|
+
_$insert2(_el$2, () => props.children);
|
|
1157
|
+
return _el$2;
|
|
1158
|
+
})();
|
|
1109
1159
|
};
|
|
1110
|
-
var MapZoom = (props) =>
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1160
|
+
var MapZoom = (props) => _$createComponent3(CustomControl2, {
|
|
1161
|
+
get position() {
|
|
1162
|
+
return props.position ?? "bottomleft";
|
|
1163
|
+
},
|
|
1164
|
+
get children() {
|
|
1165
|
+
return _$createComponent3(ZoomControls, {
|
|
1166
|
+
get onAction() {
|
|
1167
|
+
return props.onAction;
|
|
1168
|
+
}
|
|
1169
|
+
});
|
|
1170
|
+
}
|
|
1115
1171
|
});
|
|
1116
|
-
var MapAction = (props) =>
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1172
|
+
var MapAction = (props) => _$createComponent3(CustomControl2, {
|
|
1173
|
+
get position() {
|
|
1174
|
+
return props.position ?? "bottomright";
|
|
1175
|
+
},
|
|
1176
|
+
get children() {
|
|
1177
|
+
return _$createComponent3(ActionControls, {
|
|
1178
|
+
get onAction() {
|
|
1179
|
+
return props.onAction;
|
|
1180
|
+
}
|
|
1181
|
+
});
|
|
1182
|
+
}
|
|
1121
1183
|
});
|
|
1122
1184
|
var Map = {
|
|
1123
1185
|
Root: MapRoot,
|
|
@@ -1126,21 +1188,6 @@ var Map = {
|
|
|
1126
1188
|
Zoom: MapZoom,
|
|
1127
1189
|
Action: MapAction
|
|
1128
1190
|
};
|
|
1129
|
-
|
|
1130
|
-
// src/translations.ts
|
|
1131
|
-
var translationKey = "@dxos/react-ui-geo";
|
|
1132
|
-
var translations = [
|
|
1133
|
-
{
|
|
1134
|
-
"en-US": {
|
|
1135
|
-
[translationKey]: {
|
|
1136
|
-
"zoom in icon button": "Zoom in",
|
|
1137
|
-
"zoom out icon button": "Zoom out",
|
|
1138
|
-
"start icon button": "Start",
|
|
1139
|
-
"toggle icon button": "Toggle"
|
|
1140
|
-
}
|
|
1141
|
-
}
|
|
1142
|
-
}
|
|
1143
|
-
];
|
|
1144
1191
|
export {
|
|
1145
1192
|
ActionControls,
|
|
1146
1193
|
Globe,
|
|
@@ -1161,8 +1208,6 @@ export {
|
|
|
1161
1208
|
renderLayers,
|
|
1162
1209
|
restrictAxis,
|
|
1163
1210
|
timer,
|
|
1164
|
-
translationKey,
|
|
1165
|
-
translations,
|
|
1166
1211
|
useDrag,
|
|
1167
1212
|
useGlobeContext,
|
|
1168
1213
|
useGlobeZoomHandler,
|