@dxos/solid-ui-geo 0.8.4-main.abd8ff62ef → 0.8.4-main.bc2380dfbc
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/index.mjs +223 -172
- package/dist/lib/browser/index.mjs.map +2 -2
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +223 -172
- package/dist/lib/node-esm/index.mjs.map +2 -2
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
package/LICENSE
CHANGED
|
@@ -1,8 +1,105 @@
|
|
|
1
|
-
|
|
2
|
-
Copyright (c) 2022 DXOS
|
|
1
|
+
# Functional Source License, Version 1.1, ALv2 Future License
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
## Abbreviation
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
FSL-1.1-Apache-2.0
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2026 DXOS
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the Apache License, Version 2.0 that is effective on the second anniversary of
|
|
91
|
+
the date we make the Software available. On or after that date, you may use the
|
|
92
|
+
Software under the Apache License, Version 2.0, in which case the following
|
|
93
|
+
will apply:
|
|
94
|
+
|
|
95
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
96
|
+
this file except in compliance with the License.
|
|
97
|
+
|
|
98
|
+
You may obtain a copy of the License at
|
|
99
|
+
|
|
100
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
101
|
+
|
|
102
|
+
Unless required by applicable law or agreed to in writing, software distributed
|
|
103
|
+
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
|
+
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
|
+
specific language governing permissions and limitations under the License.
|
|
@@ -3,14 +3,23 @@ import {
|
|
|
3
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,
|
|
@@ -959,30 +996,39 @@ var MapRoot = (props) => {
|
|
|
959
996
|
leafletMap.scrollWheelZoom.disable();
|
|
960
997
|
}
|
|
961
998
|
});
|
|
962
|
-
return
|
|
963
|
-
value
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
999
|
+
return _$createComponent3(MapContext.Provider, {
|
|
1000
|
+
get value() {
|
|
1001
|
+
return {
|
|
1002
|
+
map,
|
|
1003
|
+
attention,
|
|
1004
|
+
setAttention,
|
|
1005
|
+
onChange: props.onChange
|
|
1006
|
+
};
|
|
968
1007
|
},
|
|
969
|
-
children
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
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;
|
|
975
1021
|
}
|
|
976
|
-
})
|
|
977
|
-
|
|
978
|
-
when: map(),
|
|
979
|
-
children: props.children
|
|
980
|
-
})
|
|
981
|
-
]
|
|
1022
|
+
})];
|
|
1023
|
+
}
|
|
982
1024
|
});
|
|
983
1025
|
};
|
|
984
1026
|
var MapTiles = () => {
|
|
985
|
-
const {
|
|
1027
|
+
const {
|
|
1028
|
+
map,
|
|
1029
|
+
onChange,
|
|
1030
|
+
attention
|
|
1031
|
+
} = useMapContext(MapTiles.name);
|
|
986
1032
|
let tileLayer = null;
|
|
987
1033
|
createEffect6(() => {
|
|
988
1034
|
const leafletMap = map();
|
|
@@ -1021,7 +1067,9 @@ var MapTiles = () => {
|
|
|
1021
1067
|
return null;
|
|
1022
1068
|
};
|
|
1023
1069
|
var MapMarkers = (props) => {
|
|
1024
|
-
const {
|
|
1070
|
+
const {
|
|
1071
|
+
map
|
|
1072
|
+
} = useMapContext(MapMarkers.name);
|
|
1025
1073
|
const leafletMarkers = [];
|
|
1026
1074
|
let lastMarkerIds = /* @__PURE__ */ new Set();
|
|
1027
1075
|
onCleanup4(() => {
|
|
@@ -1035,9 +1083,7 @@ var MapMarkers = (props) => {
|
|
|
1035
1083
|
}
|
|
1036
1084
|
const markerList = props.markers?.() ?? [];
|
|
1037
1085
|
const currentIds = new Set(markerList.map((m) => m.id));
|
|
1038
|
-
if (currentIds.size === lastMarkerIds.size && [
|
|
1039
|
-
...currentIds
|
|
1040
|
-
].every((id) => lastMarkerIds.has(id)) && leafletMarkers.length > 0) {
|
|
1086
|
+
if (currentIds.size === lastMarkerIds.size && [...currentIds].every((id) => lastMarkerIds.has(id)) && leafletMarkers.length > 0) {
|
|
1041
1087
|
return;
|
|
1042
1088
|
}
|
|
1043
1089
|
leafletMarkers.forEach((marker) => marker.remove());
|
|
@@ -1046,28 +1092,19 @@ var MapMarkers = (props) => {
|
|
|
1046
1092
|
if (markerList.length > 0) {
|
|
1047
1093
|
const bounds = latLngBounds(markerList.map((marker) => marker.location));
|
|
1048
1094
|
leafletMap.fitBounds(bounds);
|
|
1049
|
-
markerList.forEach(({
|
|
1095
|
+
markerList.forEach(({
|
|
1096
|
+
title,
|
|
1097
|
+
location
|
|
1098
|
+
}) => {
|
|
1050
1099
|
const marker = L.marker(location, {
|
|
1051
1100
|
icon: new L.Icon({
|
|
1052
1101
|
iconUrl: "https://dxos.network/marker-icon.png",
|
|
1053
1102
|
iconRetinaUrl: "https://dxos.network/marker-icon-2x.png",
|
|
1054
1103
|
shadowUrl: "https://dxos.network/marker-shadow.png",
|
|
1055
|
-
iconSize: [
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
]
|
|
1059
|
-
iconAnchor: [
|
|
1060
|
-
12,
|
|
1061
|
-
41
|
|
1062
|
-
],
|
|
1063
|
-
popupAnchor: [
|
|
1064
|
-
1,
|
|
1065
|
-
-34
|
|
1066
|
-
],
|
|
1067
|
-
shadowSize: [
|
|
1068
|
-
41,
|
|
1069
|
-
41
|
|
1070
|
-
]
|
|
1104
|
+
iconSize: [25, 41],
|
|
1105
|
+
iconAnchor: [12, 41],
|
|
1106
|
+
popupAnchor: [1, -34],
|
|
1107
|
+
shadowSize: [41, 41]
|
|
1071
1108
|
})
|
|
1072
1109
|
});
|
|
1073
1110
|
if (title) {
|
|
@@ -1083,7 +1120,9 @@ var MapMarkers = (props) => {
|
|
|
1083
1120
|
return null;
|
|
1084
1121
|
};
|
|
1085
1122
|
var CustomControl2 = (props) => {
|
|
1086
|
-
const {
|
|
1123
|
+
const {
|
|
1124
|
+
map: mapAccessor
|
|
1125
|
+
} = useMapContext(CustomControl2.name);
|
|
1087
1126
|
let controlContainer;
|
|
1088
1127
|
createEffect6(() => {
|
|
1089
1128
|
const map = mapAccessor();
|
|
@@ -1109,25 +1148,37 @@ var CustomControl2 = (props) => {
|
|
|
1109
1148
|
control.remove();
|
|
1110
1149
|
});
|
|
1111
1150
|
});
|
|
1112
|
-
return
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
});
|
|
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
|
+
})();
|
|
1119
1158
|
};
|
|
1120
|
-
var MapZoom = (props) =>
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
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
|
+
}
|
|
1125
1170
|
});
|
|
1126
|
-
var MapAction = (props) =>
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
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
|
+
}
|
|
1131
1182
|
});
|
|
1132
1183
|
var Map = {
|
|
1133
1184
|
Root: MapRoot,
|