@dxos/solid-ui-geo 0.8.4-main.422d1c7879 → 0.8.4-main.4f23b4e393
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 +239 -195
- 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 +239 -195
- 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.map +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 +22 -13
- package/src/components/Map/Map.tsx +15 -5
- package/src/index.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,17 +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";
|
|
11
20
|
import { mx } from "@dxos/ui-theme";
|
|
12
21
|
|
|
13
22
|
// src/hooks/context.tsx
|
|
14
|
-
import {
|
|
23
|
+
import { createComponent as _$createComponent } from "solid-js/web";
|
|
15
24
|
import { createContext, createEffect, createSignal, useContext } from "solid-js";
|
|
16
25
|
import { raise } from "@dxos/debug";
|
|
17
26
|
var defaults = {
|
|
@@ -36,7 +45,7 @@ var GlobeContextProvider = (props) => {
|
|
|
36
45
|
setSize(props.size);
|
|
37
46
|
}
|
|
38
47
|
});
|
|
39
|
-
return
|
|
48
|
+
return _$createComponent(GlobeContext.Provider, {
|
|
40
49
|
value: {
|
|
41
50
|
size,
|
|
42
51
|
center,
|
|
@@ -48,7 +57,9 @@ var GlobeContextProvider = (props) => {
|
|
|
48
57
|
setTranslation,
|
|
49
58
|
setRotation
|
|
50
59
|
},
|
|
51
|
-
children
|
|
60
|
+
get children() {
|
|
61
|
+
return props.children;
|
|
62
|
+
}
|
|
52
63
|
});
|
|
53
64
|
};
|
|
54
65
|
var useGlobeContext = () => {
|
|
@@ -619,7 +630,12 @@ var useTour = (controller, points, options = {}) => {
|
|
|
619
630
|
};
|
|
620
631
|
|
|
621
632
|
// src/components/Toolbar/Controls.tsx
|
|
622
|
-
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}`);
|
|
623
639
|
var controlPositions = {
|
|
624
640
|
topleft: "top-2 left-2",
|
|
625
641
|
topright: "top-2 right-2",
|
|
@@ -627,61 +643,29 @@ var controlPositions = {
|
|
|
627
643
|
bottomright: "bottom-2 right-2"
|
|
628
644
|
};
|
|
629
645
|
var ZoomControls = (props) => {
|
|
630
|
-
return
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
title: "Zoom in",
|
|
638
|
-
children: /* @__PURE__ */ _jsx2("span", {
|
|
639
|
-
class: "text-xl",
|
|
640
|
-
children: "+"
|
|
641
|
-
})
|
|
642
|
-
}),
|
|
643
|
-
/* @__PURE__ */ _jsx2("button", {
|
|
644
|
-
type: "button",
|
|
645
|
-
class: "dx-button dx-focus-ring w-10 h-10 min-h-[2.5rem] px-3 rounded-xs flex items-center justify-center",
|
|
646
|
-
onClick: () => props.onAction?.("zoom-out"),
|
|
647
|
-
title: "Zoom out",
|
|
648
|
-
children: /* @__PURE__ */ _jsx2("span", {
|
|
649
|
-
class: "text-xl",
|
|
650
|
-
children: "\u2212"
|
|
651
|
-
})
|
|
652
|
-
})
|
|
653
|
-
]
|
|
654
|
-
});
|
|
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
|
+
})();
|
|
655
653
|
};
|
|
656
654
|
var ActionControls = (props) => {
|
|
657
|
-
return
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
title: "Start",
|
|
665
|
-
children: /* @__PURE__ */ _jsx2("span", {
|
|
666
|
-
class: "text-xl",
|
|
667
|
-
children: "\u25B6"
|
|
668
|
-
})
|
|
669
|
-
}),
|
|
670
|
-
/* @__PURE__ */ _jsx2("button", {
|
|
671
|
-
type: "button",
|
|
672
|
-
class: "dx-button dx-focus-ring w-10 h-10 min-h-[2.5rem] px-3 rounded-xs flex items-center justify-center",
|
|
673
|
-
onClick: () => props.onAction?.("toggle"),
|
|
674
|
-
title: "Toggle",
|
|
675
|
-
children: /* @__PURE__ */ _jsx2("span", {
|
|
676
|
-
class: "text-xl",
|
|
677
|
-
children: "\u{1F30D}"
|
|
678
|
-
})
|
|
679
|
-
})
|
|
680
|
-
]
|
|
681
|
-
});
|
|
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
|
+
})();
|
|
682
662
|
};
|
|
663
|
+
_$delegateEvents(["click"]);
|
|
683
664
|
|
|
684
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">`);
|
|
685
669
|
var defaultStyles = {
|
|
686
670
|
light: {
|
|
687
671
|
background: {
|
|
@@ -742,22 +726,33 @@ var GlobeRoot = (props) => {
|
|
|
742
726
|
width: 0,
|
|
743
727
|
height: 0
|
|
744
728
|
});
|
|
745
|
-
createResizeObserver(() => containerRef, ({
|
|
729
|
+
createResizeObserver(() => containerRef, ({
|
|
730
|
+
width,
|
|
731
|
+
height
|
|
732
|
+
}) => {
|
|
746
733
|
setSize({
|
|
747
734
|
width,
|
|
748
735
|
height
|
|
749
736
|
});
|
|
750
737
|
});
|
|
751
|
-
return
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
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
|
+
}));
|
|
761
756
|
};
|
|
762
757
|
var GlobeCanvas = (props) => {
|
|
763
758
|
const themeMode = "dark";
|
|
@@ -767,7 +762,17 @@ var GlobeCanvas = (props) => {
|
|
|
767
762
|
const layers = createMemo(() => {
|
|
768
763
|
return timer(() => createLayers(props.topology, props.features, styles()));
|
|
769
764
|
});
|
|
770
|
-
const {
|
|
765
|
+
const {
|
|
766
|
+
size,
|
|
767
|
+
center,
|
|
768
|
+
zoom,
|
|
769
|
+
translation,
|
|
770
|
+
rotation,
|
|
771
|
+
setCenter,
|
|
772
|
+
setZoom,
|
|
773
|
+
setTranslation,
|
|
774
|
+
setRotation
|
|
775
|
+
} = useGlobeContext();
|
|
771
776
|
let zoomValue = zoom();
|
|
772
777
|
let zooming = false;
|
|
773
778
|
createEffect5(() => {
|
|
@@ -828,65 +833,89 @@ var GlobeCanvas = (props) => {
|
|
|
828
833
|
const s = size();
|
|
829
834
|
if (canvasEl && proj && gen) {
|
|
830
835
|
timer(() => {
|
|
831
|
-
proj.scale(Math.min(s.width, s.height) / 2 * z).translate([
|
|
832
|
-
s.width / 2 + (t?.x ?? 0),
|
|
833
|
-
s.height / 2 + (t?.y ?? 0)
|
|
834
|
-
]).rotate(r ?? [
|
|
835
|
-
0,
|
|
836
|
-
0,
|
|
837
|
-
0
|
|
838
|
-
]);
|
|
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]);
|
|
839
837
|
renderLayers(gen, layers(), z, styles());
|
|
840
838
|
});
|
|
841
839
|
}
|
|
842
840
|
});
|
|
843
|
-
return
|
|
844
|
-
when
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
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
|
+
}
|
|
850
859
|
});
|
|
851
860
|
};
|
|
852
861
|
var GlobeDebug = (props) => {
|
|
853
|
-
const {
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
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
|
+
})();
|
|
866
879
|
};
|
|
867
880
|
var GlobePanel = (props) => {
|
|
868
|
-
return
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
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
|
+
})();
|
|
872
887
|
};
|
|
873
888
|
var CustomControl = (props) => {
|
|
874
|
-
return
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
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
|
+
})();
|
|
878
895
|
};
|
|
879
|
-
var GlobeZoom = (props) =>
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
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
|
+
}
|
|
884
907
|
});
|
|
885
|
-
var GlobeAction = (props) =>
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
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
|
+
}
|
|
890
919
|
});
|
|
891
920
|
var Globe = {
|
|
892
921
|
Root: GlobeRoot,
|
|
@@ -898,10 +927,18 @@ var Globe = {
|
|
|
898
927
|
};
|
|
899
928
|
|
|
900
929
|
// src/components/Map/Map.tsx
|
|
901
|
-
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";
|
|
902
937
|
import "leaflet/dist/leaflet.css";
|
|
903
938
|
import L, { latLngBounds } from "leaflet";
|
|
904
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>`);
|
|
905
942
|
var defaults2 = {
|
|
906
943
|
center: {
|
|
907
944
|
lat: 51,
|
|
@@ -922,7 +959,9 @@ var MapRoot = (props) => {
|
|
|
922
959
|
const [map, setMap] = createSignal5(null);
|
|
923
960
|
const [attention, setAttention] = createSignal5(false);
|
|
924
961
|
onMount(() => {
|
|
925
|
-
if (!mapContainer)
|
|
962
|
+
if (!mapContainer) {
|
|
963
|
+
return;
|
|
964
|
+
}
|
|
926
965
|
const leafletMap = L.map(mapContainer, {
|
|
927
966
|
center: props.center ?? defaults2.center,
|
|
928
967
|
zoom: props.zoom ?? defaults2.zoom,
|
|
@@ -949,41 +988,54 @@ var MapRoot = (props) => {
|
|
|
949
988
|
});
|
|
950
989
|
createEffect6(() => {
|
|
951
990
|
const leafletMap = map();
|
|
952
|
-
if (!leafletMap)
|
|
991
|
+
if (!leafletMap) {
|
|
992
|
+
return;
|
|
993
|
+
}
|
|
953
994
|
if (attention()) {
|
|
954
995
|
leafletMap.scrollWheelZoom.enable();
|
|
955
996
|
} else {
|
|
956
997
|
leafletMap.scrollWheelZoom.disable();
|
|
957
998
|
}
|
|
958
999
|
});
|
|
959
|
-
return
|
|
960
|
-
value
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
1000
|
+
return _$createComponent3(MapContext.Provider, {
|
|
1001
|
+
get value() {
|
|
1002
|
+
return {
|
|
1003
|
+
map,
|
|
1004
|
+
attention,
|
|
1005
|
+
setAttention,
|
|
1006
|
+
onChange: props.onChange
|
|
1007
|
+
};
|
|
965
1008
|
},
|
|
966
|
-
children
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
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;
|
|
972
1022
|
}
|
|
973
|
-
})
|
|
974
|
-
|
|
975
|
-
when: map(),
|
|
976
|
-
children: props.children
|
|
977
|
-
})
|
|
978
|
-
]
|
|
1023
|
+
})];
|
|
1024
|
+
}
|
|
979
1025
|
});
|
|
980
1026
|
};
|
|
981
1027
|
var MapTiles = () => {
|
|
982
|
-
const {
|
|
1028
|
+
const {
|
|
1029
|
+
map,
|
|
1030
|
+
onChange,
|
|
1031
|
+
attention
|
|
1032
|
+
} = useMapContext(MapTiles.name);
|
|
983
1033
|
let tileLayer = null;
|
|
984
1034
|
createEffect6(() => {
|
|
985
1035
|
const leafletMap = map();
|
|
986
|
-
if (!leafletMap)
|
|
1036
|
+
if (!leafletMap) {
|
|
1037
|
+
return;
|
|
1038
|
+
}
|
|
987
1039
|
const att = attention();
|
|
988
1040
|
tileLayer = L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
|
|
989
1041
|
detectRetina: true,
|
|
@@ -1016,7 +1068,9 @@ var MapTiles = () => {
|
|
|
1016
1068
|
return null;
|
|
1017
1069
|
};
|
|
1018
1070
|
var MapMarkers = (props) => {
|
|
1019
|
-
const {
|
|
1071
|
+
const {
|
|
1072
|
+
map
|
|
1073
|
+
} = useMapContext(MapMarkers.name);
|
|
1020
1074
|
const leafletMarkers = [];
|
|
1021
1075
|
let lastMarkerIds = /* @__PURE__ */ new Set();
|
|
1022
1076
|
onCleanup4(() => {
|
|
@@ -1025,12 +1079,12 @@ var MapMarkers = (props) => {
|
|
|
1025
1079
|
});
|
|
1026
1080
|
createEffect6(() => {
|
|
1027
1081
|
const leafletMap = map();
|
|
1028
|
-
if (!leafletMap)
|
|
1082
|
+
if (!leafletMap) {
|
|
1083
|
+
return;
|
|
1084
|
+
}
|
|
1029
1085
|
const markerList = props.markers?.() ?? [];
|
|
1030
1086
|
const currentIds = new Set(markerList.map((m) => m.id));
|
|
1031
|
-
if (currentIds.size === lastMarkerIds.size && [
|
|
1032
|
-
...currentIds
|
|
1033
|
-
].every((id) => lastMarkerIds.has(id)) && leafletMarkers.length > 0) {
|
|
1087
|
+
if (currentIds.size === lastMarkerIds.size && [...currentIds].every((id) => lastMarkerIds.has(id)) && leafletMarkers.length > 0) {
|
|
1034
1088
|
return;
|
|
1035
1089
|
}
|
|
1036
1090
|
leafletMarkers.forEach((marker) => marker.remove());
|
|
@@ -1039,28 +1093,19 @@ var MapMarkers = (props) => {
|
|
|
1039
1093
|
if (markerList.length > 0) {
|
|
1040
1094
|
const bounds = latLngBounds(markerList.map((marker) => marker.location));
|
|
1041
1095
|
leafletMap.fitBounds(bounds);
|
|
1042
|
-
markerList.forEach(({
|
|
1096
|
+
markerList.forEach(({
|
|
1097
|
+
title,
|
|
1098
|
+
location
|
|
1099
|
+
}) => {
|
|
1043
1100
|
const marker = L.marker(location, {
|
|
1044
1101
|
icon: new L.Icon({
|
|
1045
1102
|
iconUrl: "https://dxos.network/marker-icon.png",
|
|
1046
1103
|
iconRetinaUrl: "https://dxos.network/marker-icon-2x.png",
|
|
1047
1104
|
shadowUrl: "https://dxos.network/marker-shadow.png",
|
|
1048
|
-
iconSize: [
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
]
|
|
1052
|
-
iconAnchor: [
|
|
1053
|
-
12,
|
|
1054
|
-
41
|
|
1055
|
-
],
|
|
1056
|
-
popupAnchor: [
|
|
1057
|
-
1,
|
|
1058
|
-
-34
|
|
1059
|
-
],
|
|
1060
|
-
shadowSize: [
|
|
1061
|
-
41,
|
|
1062
|
-
41
|
|
1063
|
-
]
|
|
1105
|
+
iconSize: [25, 41],
|
|
1106
|
+
iconAnchor: [12, 41],
|
|
1107
|
+
popupAnchor: [1, -34],
|
|
1108
|
+
shadowSize: [41, 41]
|
|
1064
1109
|
})
|
|
1065
1110
|
});
|
|
1066
1111
|
if (title) {
|
|
@@ -1076,11 +1121,15 @@ var MapMarkers = (props) => {
|
|
|
1076
1121
|
return null;
|
|
1077
1122
|
};
|
|
1078
1123
|
var CustomControl2 = (props) => {
|
|
1079
|
-
const {
|
|
1124
|
+
const {
|
|
1125
|
+
map: mapAccessor
|
|
1126
|
+
} = useMapContext(CustomControl2.name);
|
|
1080
1127
|
let controlContainer;
|
|
1081
1128
|
createEffect6(() => {
|
|
1082
1129
|
const map = mapAccessor();
|
|
1083
|
-
if (!map || !controlContainer)
|
|
1130
|
+
if (!map || !controlContainer) {
|
|
1131
|
+
return;
|
|
1132
|
+
}
|
|
1084
1133
|
const Control = L.Control.extend({
|
|
1085
1134
|
onAdd: () => {
|
|
1086
1135
|
const container = L.DomUtil.create("div", `${controlPositions[props.position]} m-0!`);
|
|
@@ -1100,25 +1149,37 @@ var CustomControl2 = (props) => {
|
|
|
1100
1149
|
control.remove();
|
|
1101
1150
|
});
|
|
1102
1151
|
});
|
|
1103
|
-
return
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
});
|
|
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
|
+
})();
|
|
1110
1159
|
};
|
|
1111
|
-
var MapZoom = (props) =>
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
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
|
+
}
|
|
1116
1171
|
});
|
|
1117
|
-
var MapAction = (props) =>
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
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
|
+
}
|
|
1122
1183
|
});
|
|
1123
1184
|
var Map = {
|
|
1124
1185
|
Root: MapRoot,
|
|
@@ -1127,21 +1188,6 @@ var Map = {
|
|
|
1127
1188
|
Zoom: MapZoom,
|
|
1128
1189
|
Action: MapAction
|
|
1129
1190
|
};
|
|
1130
|
-
|
|
1131
|
-
// src/translations.ts
|
|
1132
|
-
var translationKey = "@dxos/react-ui-geo";
|
|
1133
|
-
var translations = [
|
|
1134
|
-
{
|
|
1135
|
-
"en-US": {
|
|
1136
|
-
[translationKey]: {
|
|
1137
|
-
"zoom in icon button": "Zoom in",
|
|
1138
|
-
"zoom out icon button": "Zoom out",
|
|
1139
|
-
"start icon button": "Start",
|
|
1140
|
-
"toggle icon button": "Toggle"
|
|
1141
|
-
}
|
|
1142
|
-
}
|
|
1143
|
-
}
|
|
1144
|
-
];
|
|
1145
1191
|
export {
|
|
1146
1192
|
ActionControls,
|
|
1147
1193
|
Globe,
|
|
@@ -1162,8 +1208,6 @@ export {
|
|
|
1162
1208
|
renderLayers,
|
|
1163
1209
|
restrictAxis,
|
|
1164
1210
|
timer,
|
|
1165
|
-
translationKey,
|
|
1166
|
-
translations,
|
|
1167
1211
|
useDrag,
|
|
1168
1212
|
useGlobeContext,
|
|
1169
1213
|
useGlobeZoomHandler,
|