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