@dxos/solid-ui-geo 0.8.4-staging.ac66bdf99f → 0.9.1-main.c7dcc2e112
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 +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 +2 -2
- 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 +23 -21
- package/src/components/Globe/Globe.solid-stories.tsx +2 -2
- 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,16 +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";
|
|
10
19
|
import { mx } from "@dxos/ui-theme";
|
|
11
20
|
|
|
12
21
|
// src/hooks/context.tsx
|
|
13
|
-
import {
|
|
22
|
+
import { createComponent as _$createComponent } from "solid-js/web";
|
|
14
23
|
import { createContext, createEffect, createSignal, useContext } from "solid-js";
|
|
15
24
|
import { raise } from "@dxos/debug";
|
|
16
25
|
var defaults = {
|
|
@@ -35,7 +44,7 @@ var GlobeContextProvider = (props) => {
|
|
|
35
44
|
setSize(props.size);
|
|
36
45
|
}
|
|
37
46
|
});
|
|
38
|
-
return
|
|
47
|
+
return _$createComponent(GlobeContext.Provider, {
|
|
39
48
|
value: {
|
|
40
49
|
size,
|
|
41
50
|
center,
|
|
@@ -47,7 +56,9 @@ var GlobeContextProvider = (props) => {
|
|
|
47
56
|
setTranslation,
|
|
48
57
|
setRotation
|
|
49
58
|
},
|
|
50
|
-
children
|
|
59
|
+
get children() {
|
|
60
|
+
return props.children;
|
|
61
|
+
}
|
|
51
62
|
});
|
|
52
63
|
};
|
|
53
64
|
var useGlobeContext = () => {
|
|
@@ -618,7 +629,12 @@ var useTour = (controller, points, options = {}) => {
|
|
|
618
629
|
};
|
|
619
630
|
|
|
620
631
|
// src/components/Toolbar/Controls.tsx
|
|
621
|
-
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}`);
|
|
622
638
|
var controlPositions = {
|
|
623
639
|
topleft: "top-2 left-2",
|
|
624
640
|
topright: "top-2 right-2",
|
|
@@ -626,61 +642,29 @@ var controlPositions = {
|
|
|
626
642
|
bottomright: "bottom-2 right-2"
|
|
627
643
|
};
|
|
628
644
|
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-h-[2.5rem] px-3 rounded-xs 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
|
-
});
|
|
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
|
+
})();
|
|
654
652
|
};
|
|
655
653
|
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-h-[2.5rem] px-3 rounded-xs 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
|
-
});
|
|
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
|
+
})();
|
|
681
661
|
};
|
|
662
|
+
_$delegateEvents(["click"]);
|
|
682
663
|
|
|
683
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">`);
|
|
684
668
|
var defaultStyles = {
|
|
685
669
|
light: {
|
|
686
670
|
background: {
|
|
@@ -741,22 +725,33 @@ var GlobeRoot = (props) => {
|
|
|
741
725
|
width: 0,
|
|
742
726
|
height: 0
|
|
743
727
|
});
|
|
744
|
-
createResizeObserver(() => containerRef, ({
|
|
728
|
+
createResizeObserver(() => containerRef, ({
|
|
729
|
+
width,
|
|
730
|
+
height
|
|
731
|
+
}) => {
|
|
745
732
|
setSize({
|
|
746
733
|
width,
|
|
747
734
|
height
|
|
748
735
|
});
|
|
749
736
|
});
|
|
750
|
-
return
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
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
|
+
}));
|
|
760
755
|
};
|
|
761
756
|
var GlobeCanvas = (props) => {
|
|
762
757
|
const themeMode = "dark";
|
|
@@ -766,7 +761,17 @@ var GlobeCanvas = (props) => {
|
|
|
766
761
|
const layers = createMemo(() => {
|
|
767
762
|
return timer(() => createLayers(props.topology, props.features, styles()));
|
|
768
763
|
});
|
|
769
|
-
const {
|
|
764
|
+
const {
|
|
765
|
+
size,
|
|
766
|
+
center,
|
|
767
|
+
zoom,
|
|
768
|
+
translation,
|
|
769
|
+
rotation,
|
|
770
|
+
setCenter,
|
|
771
|
+
setZoom,
|
|
772
|
+
setTranslation,
|
|
773
|
+
setRotation
|
|
774
|
+
} = useGlobeContext();
|
|
770
775
|
let zoomValue = zoom();
|
|
771
776
|
let zooming = false;
|
|
772
777
|
createEffect5(() => {
|
|
@@ -827,65 +832,89 @@ var GlobeCanvas = (props) => {
|
|
|
827
832
|
const s = size();
|
|
828
833
|
if (canvasEl && proj && gen) {
|
|
829
834
|
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
|
-
]);
|
|
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]);
|
|
838
836
|
renderLayers(gen, layers(), z, styles());
|
|
839
837
|
});
|
|
840
838
|
}
|
|
841
839
|
});
|
|
842
|
-
return
|
|
843
|
-
when
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
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
|
+
}
|
|
849
858
|
});
|
|
850
859
|
};
|
|
851
860
|
var GlobeDebug = (props) => {
|
|
852
|
-
const {
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
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
|
+
})();
|
|
865
878
|
};
|
|
866
879
|
var GlobePanel = (props) => {
|
|
867
|
-
return
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
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
|
+
})();
|
|
871
886
|
};
|
|
872
887
|
var CustomControl = (props) => {
|
|
873
|
-
return
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
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
|
+
})();
|
|
877
894
|
};
|
|
878
|
-
var GlobeZoom = (props) =>
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
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
|
+
}
|
|
883
906
|
});
|
|
884
|
-
var GlobeAction = (props) =>
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
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
|
+
}
|
|
889
918
|
});
|
|
890
919
|
var Globe = {
|
|
891
920
|
Root: GlobeRoot,
|
|
@@ -897,10 +926,18 @@ var Globe = {
|
|
|
897
926
|
};
|
|
898
927
|
|
|
899
928
|
// src/components/Map/Map.tsx
|
|
900
|
-
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";
|
|
901
936
|
import "leaflet/dist/leaflet.css";
|
|
902
937
|
import L, { latLngBounds } from "leaflet";
|
|
903
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>`);
|
|
904
941
|
var defaults2 = {
|
|
905
942
|
center: {
|
|
906
943
|
lat: 51,
|
|
@@ -921,7 +958,9 @@ var MapRoot = (props) => {
|
|
|
921
958
|
const [map, setMap] = createSignal5(null);
|
|
922
959
|
const [attention, setAttention] = createSignal5(false);
|
|
923
960
|
onMount(() => {
|
|
924
|
-
if (!mapContainer)
|
|
961
|
+
if (!mapContainer) {
|
|
962
|
+
return;
|
|
963
|
+
}
|
|
925
964
|
const leafletMap = L.map(mapContainer, {
|
|
926
965
|
center: props.center ?? defaults2.center,
|
|
927
966
|
zoom: props.zoom ?? defaults2.zoom,
|
|
@@ -948,41 +987,54 @@ var MapRoot = (props) => {
|
|
|
948
987
|
});
|
|
949
988
|
createEffect6(() => {
|
|
950
989
|
const leafletMap = map();
|
|
951
|
-
if (!leafletMap)
|
|
990
|
+
if (!leafletMap) {
|
|
991
|
+
return;
|
|
992
|
+
}
|
|
952
993
|
if (attention()) {
|
|
953
994
|
leafletMap.scrollWheelZoom.enable();
|
|
954
995
|
} else {
|
|
955
996
|
leafletMap.scrollWheelZoom.disable();
|
|
956
997
|
}
|
|
957
998
|
});
|
|
958
|
-
return
|
|
959
|
-
value
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
999
|
+
return _$createComponent3(MapContext.Provider, {
|
|
1000
|
+
get value() {
|
|
1001
|
+
return {
|
|
1002
|
+
map,
|
|
1003
|
+
attention,
|
|
1004
|
+
setAttention,
|
|
1005
|
+
onChange: props.onChange
|
|
1006
|
+
};
|
|
964
1007
|
},
|
|
965
|
-
children
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
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;
|
|
971
1021
|
}
|
|
972
|
-
})
|
|
973
|
-
|
|
974
|
-
when: map(),
|
|
975
|
-
children: props.children
|
|
976
|
-
})
|
|
977
|
-
]
|
|
1022
|
+
})];
|
|
1023
|
+
}
|
|
978
1024
|
});
|
|
979
1025
|
};
|
|
980
1026
|
var MapTiles = () => {
|
|
981
|
-
const {
|
|
1027
|
+
const {
|
|
1028
|
+
map,
|
|
1029
|
+
onChange,
|
|
1030
|
+
attention
|
|
1031
|
+
} = useMapContext(MapTiles.name);
|
|
982
1032
|
let tileLayer = null;
|
|
983
1033
|
createEffect6(() => {
|
|
984
1034
|
const leafletMap = map();
|
|
985
|
-
if (!leafletMap)
|
|
1035
|
+
if (!leafletMap) {
|
|
1036
|
+
return;
|
|
1037
|
+
}
|
|
986
1038
|
const att = attention();
|
|
987
1039
|
tileLayer = L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
|
|
988
1040
|
detectRetina: true,
|
|
@@ -1015,7 +1067,9 @@ var MapTiles = () => {
|
|
|
1015
1067
|
return null;
|
|
1016
1068
|
};
|
|
1017
1069
|
var MapMarkers = (props) => {
|
|
1018
|
-
const {
|
|
1070
|
+
const {
|
|
1071
|
+
map
|
|
1072
|
+
} = useMapContext(MapMarkers.name);
|
|
1019
1073
|
const leafletMarkers = [];
|
|
1020
1074
|
let lastMarkerIds = /* @__PURE__ */ new Set();
|
|
1021
1075
|
onCleanup4(() => {
|
|
@@ -1024,12 +1078,12 @@ var MapMarkers = (props) => {
|
|
|
1024
1078
|
});
|
|
1025
1079
|
createEffect6(() => {
|
|
1026
1080
|
const leafletMap = map();
|
|
1027
|
-
if (!leafletMap)
|
|
1081
|
+
if (!leafletMap) {
|
|
1082
|
+
return;
|
|
1083
|
+
}
|
|
1028
1084
|
const markerList = props.markers?.() ?? [];
|
|
1029
1085
|
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) {
|
|
1086
|
+
if (currentIds.size === lastMarkerIds.size && [...currentIds].every((id) => lastMarkerIds.has(id)) && leafletMarkers.length > 0) {
|
|
1033
1087
|
return;
|
|
1034
1088
|
}
|
|
1035
1089
|
leafletMarkers.forEach((marker) => marker.remove());
|
|
@@ -1038,28 +1092,19 @@ var MapMarkers = (props) => {
|
|
|
1038
1092
|
if (markerList.length > 0) {
|
|
1039
1093
|
const bounds = latLngBounds(markerList.map((marker) => marker.location));
|
|
1040
1094
|
leafletMap.fitBounds(bounds);
|
|
1041
|
-
markerList.forEach(({
|
|
1095
|
+
markerList.forEach(({
|
|
1096
|
+
title,
|
|
1097
|
+
location
|
|
1098
|
+
}) => {
|
|
1042
1099
|
const marker = L.marker(location, {
|
|
1043
1100
|
icon: new L.Icon({
|
|
1044
1101
|
iconUrl: "https://dxos.network/marker-icon.png",
|
|
1045
1102
|
iconRetinaUrl: "https://dxos.network/marker-icon-2x.png",
|
|
1046
1103
|
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
|
-
]
|
|
1104
|
+
iconSize: [25, 41],
|
|
1105
|
+
iconAnchor: [12, 41],
|
|
1106
|
+
popupAnchor: [1, -34],
|
|
1107
|
+
shadowSize: [41, 41]
|
|
1063
1108
|
})
|
|
1064
1109
|
});
|
|
1065
1110
|
if (title) {
|
|
@@ -1075,11 +1120,15 @@ var MapMarkers = (props) => {
|
|
|
1075
1120
|
return null;
|
|
1076
1121
|
};
|
|
1077
1122
|
var CustomControl2 = (props) => {
|
|
1078
|
-
const {
|
|
1123
|
+
const {
|
|
1124
|
+
map: mapAccessor
|
|
1125
|
+
} = useMapContext(CustomControl2.name);
|
|
1079
1126
|
let controlContainer;
|
|
1080
1127
|
createEffect6(() => {
|
|
1081
1128
|
const map = mapAccessor();
|
|
1082
|
-
if (!map || !controlContainer)
|
|
1129
|
+
if (!map || !controlContainer) {
|
|
1130
|
+
return;
|
|
1131
|
+
}
|
|
1083
1132
|
const Control = L.Control.extend({
|
|
1084
1133
|
onAdd: () => {
|
|
1085
1134
|
const container = L.DomUtil.create("div", `${controlPositions[props.position]} m-0!`);
|
|
@@ -1099,25 +1148,37 @@ var CustomControl2 = (props) => {
|
|
|
1099
1148
|
control.remove();
|
|
1100
1149
|
});
|
|
1101
1150
|
});
|
|
1102
|
-
return
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
});
|
|
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
|
+
})();
|
|
1109
1158
|
};
|
|
1110
|
-
var MapZoom = (props) =>
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
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
|
+
}
|
|
1115
1170
|
});
|
|
1116
|
-
var MapAction = (props) =>
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
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
|
+
}
|
|
1121
1182
|
});
|
|
1122
1183
|
var Map = {
|
|
1123
1184
|
Root: MapRoot,
|
|
@@ -1126,21 +1187,6 @@ var Map = {
|
|
|
1126
1187
|
Zoom: MapZoom,
|
|
1127
1188
|
Action: MapAction
|
|
1128
1189
|
};
|
|
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
1190
|
export {
|
|
1145
1191
|
ActionControls,
|
|
1146
1192
|
Globe,
|
|
@@ -1161,8 +1207,6 @@ export {
|
|
|
1161
1207
|
renderLayers,
|
|
1162
1208
|
restrictAxis,
|
|
1163
1209
|
timer,
|
|
1164
|
-
translationKey,
|
|
1165
|
-
translations,
|
|
1166
1210
|
useDrag,
|
|
1167
1211
|
useGlobeContext,
|
|
1168
1212
|
useGlobeZoomHandler,
|