@dxos/react-ui-geo 0.7.5-labs.f5080a1 → 0.7.5-main.b19bfc8
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/index.mjs +151 -86
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +127 -62
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +151 -86
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/Globe/Globe.d.ts +5 -5
- package/dist/types/src/components/Globe/Globe.d.ts.map +1 -1
- package/dist/types/src/components/Globe/Globe.stories.d.ts +9 -10
- package/dist/types/src/components/Globe/Globe.stories.d.ts.map +1 -1
- package/dist/types/src/components/Map/Map.d.ts +9 -10
- package/dist/types/src/components/Map/Map.d.ts.map +1 -1
- package/dist/types/src/components/Map/Map.stories.d.ts +6 -2
- package/dist/types/src/components/Map/Map.stories.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Controls.d.ts +2 -3
- package/dist/types/src/components/Toolbar/Controls.d.ts.map +1 -1
- package/dist/types/src/components/types.d.ts +2 -1
- package/dist/types/src/components/types.d.ts.map +1 -1
- package/dist/types/src/hooks/context.d.ts +2 -2
- package/dist/types/src/hooks/context.d.ts.map +1 -1
- package/dist/types/src/hooks/useTour.d.ts +8 -3
- package/dist/types/src/hooks/useTour.d.ts.map +1 -1
- package/dist/types/src/util/debug.d.ts.map +1 -1
- package/dist/types/src/util/render.d.ts +2 -2
- package/dist/types/src/util/render.d.ts.map +1 -1
- package/package.json +12 -10
- package/src/components/Globe/Globe.stories.tsx +8 -11
- package/src/components/Globe/Globe.tsx +56 -32
- package/src/components/Map/Map.stories.tsx +28 -6
- package/src/components/Map/Map.tsx +93 -82
- package/src/components/types.ts +2 -1
- package/src/hooks/context.tsx +5 -5
- package/src/hooks/useDrag.ts +1 -1
- package/src/hooks/useTour.ts +31 -19
- package/src/util/debug.ts +1 -0
- package/src/util/render.ts +18 -4
|
@@ -4,22 +4,22 @@ import {
|
|
|
4
4
|
|
|
5
5
|
// packages/ui/react-ui-geo/src/components/Globe/Globe.tsx
|
|
6
6
|
import * as d37 from "d3";
|
|
7
|
-
import
|
|
7
|
+
import React4, { forwardRef, useEffect as useEffect4, useImperativeHandle, useMemo, useRef, useState as useState3 } from "react";
|
|
8
8
|
import { useResizeDetector } from "react-resize-detector";
|
|
9
|
-
import { useDynamicRef } from "@dxos/react-ui";
|
|
9
|
+
import { useDynamicRef, useThemeContext } from "@dxos/react-ui";
|
|
10
10
|
import { mx } from "@dxos/react-ui-theme";
|
|
11
11
|
|
|
12
12
|
// packages/ui/react-ui-geo/src/hooks/context.tsx
|
|
13
|
-
import
|
|
13
|
+
import React2, { createContext, useContext } from "react";
|
|
14
14
|
import { raise } from "@dxos/debug";
|
|
15
|
-
import {
|
|
15
|
+
import { useControlledState } from "@dxos/react-ui";
|
|
16
16
|
var GlobeContext = /* @__PURE__ */ createContext(void 0);
|
|
17
17
|
var GlobeContextProvider = ({ children, size, center: _center, scale: _scale, translation: _translation, rotation: _rotation }) => {
|
|
18
|
-
const [center, setCenter] =
|
|
19
|
-
const [scale, setScale] =
|
|
20
|
-
const [translation, setTranslation] =
|
|
21
|
-
const [rotation, setRotation] =
|
|
22
|
-
return /* @__PURE__ */
|
|
18
|
+
const [center, setCenter] = useControlledState(_center);
|
|
19
|
+
const [scale, setScale] = useControlledState(_scale);
|
|
20
|
+
const [translation, setTranslation] = useControlledState(_translation);
|
|
21
|
+
const [rotation, setRotation] = useControlledState(_rotation);
|
|
22
|
+
return /* @__PURE__ */ React2.createElement(GlobeContext.Provider, {
|
|
23
23
|
value: {
|
|
24
24
|
size,
|
|
25
25
|
center,
|
|
@@ -349,17 +349,22 @@ var createLayers = (topology, features, styles) => {
|
|
|
349
349
|
}
|
|
350
350
|
return layers;
|
|
351
351
|
};
|
|
352
|
-
var renderLayers = (generator, layers = [], scale) => {
|
|
352
|
+
var renderLayers = (generator, layers = [], scale, styles) => {
|
|
353
353
|
const context = generator.context();
|
|
354
354
|
const { canvas: { width, height } } = context;
|
|
355
355
|
context.reset();
|
|
356
|
-
|
|
357
|
-
|
|
356
|
+
if (styles.background) {
|
|
357
|
+
context.fillStyle = styles.background.fillStyle;
|
|
358
|
+
context.fillRect(0, 0, width, height);
|
|
359
|
+
} else {
|
|
360
|
+
context.clearRect(0, 0, width, height);
|
|
361
|
+
}
|
|
362
|
+
layers.forEach(({ path, styles: styles2 }) => {
|
|
358
363
|
context.save();
|
|
359
364
|
let fill = false;
|
|
360
365
|
let stroke = false;
|
|
361
|
-
if (
|
|
362
|
-
Object.entries(
|
|
366
|
+
if (styles2) {
|
|
367
|
+
Object.entries(styles2).forEach(([key, value]) => {
|
|
363
368
|
if (key === "pointRadius") {
|
|
364
369
|
generator.pointRadius(value * scale);
|
|
365
370
|
} else {
|
|
@@ -408,7 +413,7 @@ var useDrag = (controller, options = {}) => {
|
|
|
408
413
|
};
|
|
409
414
|
}, [
|
|
410
415
|
controller,
|
|
411
|
-
options
|
|
416
|
+
JSON.stringify(options)
|
|
412
417
|
]);
|
|
413
418
|
};
|
|
414
419
|
var cancelDrag = (node) => node.on(".drag", null);
|
|
@@ -514,11 +519,13 @@ var useSpinner = (controller, options = {}) => {
|
|
|
514
519
|
import * as d36 from "d3";
|
|
515
520
|
import { useEffect as useEffect3, useState as useState2 } from "react";
|
|
516
521
|
import versor2 from "versor";
|
|
522
|
+
import { log } from "@dxos/log";
|
|
523
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/ui/react-ui-geo/src/hooks/useTour.ts";
|
|
517
524
|
var TRANSITION_NAME = "globe-tour";
|
|
518
525
|
var defaultDuration = 1500;
|
|
519
|
-
var useTour = (controller,
|
|
526
|
+
var useTour = (controller, points, options = {}) => {
|
|
520
527
|
const selection2 = d36.selection();
|
|
521
|
-
const [running, setRunning] = useState2(false);
|
|
528
|
+
const [running, setRunning] = useState2(options.running ?? false);
|
|
522
529
|
useEffect3(() => {
|
|
523
530
|
if (!running) {
|
|
524
531
|
selection2.interrupt(TRANSITION_NAME);
|
|
@@ -532,10 +539,16 @@ var useTour = (controller, features, options = {}) => {
|
|
|
532
539
|
alpha: false
|
|
533
540
|
});
|
|
534
541
|
const path = d36.geoPath(projection, context).pointRadius(2);
|
|
535
|
-
const tilt = 0;
|
|
542
|
+
const tilt = options.tilt ?? 0;
|
|
536
543
|
let last;
|
|
537
544
|
try {
|
|
538
|
-
|
|
545
|
+
const p = [
|
|
546
|
+
...points
|
|
547
|
+
];
|
|
548
|
+
if (options.loop) {
|
|
549
|
+
p.push(p[0]);
|
|
550
|
+
}
|
|
551
|
+
for (const next of p) {
|
|
539
552
|
if (!running) {
|
|
540
553
|
break;
|
|
541
554
|
}
|
|
@@ -573,13 +586,22 @@ var useTour = (controller, features, options = {}) => {
|
|
|
573
586
|
context.fill();
|
|
574
587
|
}
|
|
575
588
|
context.restore();
|
|
576
|
-
|
|
577
|
-
|
|
589
|
+
if (options.autoRotate) {
|
|
590
|
+
projection.rotate(iv(t2));
|
|
591
|
+
setRotation(projection.rotate());
|
|
592
|
+
}
|
|
578
593
|
});
|
|
579
594
|
await transition2.end();
|
|
580
595
|
last = next;
|
|
581
596
|
}
|
|
582
597
|
} catch (err) {
|
|
598
|
+
log.catch(err, void 0, {
|
|
599
|
+
F: __dxlog_file,
|
|
600
|
+
L: 112,
|
|
601
|
+
S: void 0,
|
|
602
|
+
C: (f, a) => f(...a)
|
|
603
|
+
});
|
|
604
|
+
} finally {
|
|
583
605
|
setRunning(false);
|
|
584
606
|
}
|
|
585
607
|
});
|
|
@@ -590,20 +612,17 @@ var useTour = (controller, features, options = {}) => {
|
|
|
590
612
|
}
|
|
591
613
|
}, [
|
|
592
614
|
controller,
|
|
593
|
-
running
|
|
615
|
+
running,
|
|
616
|
+
JSON.stringify(options)
|
|
594
617
|
]);
|
|
595
618
|
return [
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
setRunning(true);
|
|
599
|
-
}
|
|
600
|
-
},
|
|
601
|
-
() => setRunning(false)
|
|
619
|
+
running,
|
|
620
|
+
setRunning
|
|
602
621
|
];
|
|
603
622
|
};
|
|
604
623
|
|
|
605
624
|
// packages/ui/react-ui-geo/src/components/Toolbar/Controls.tsx
|
|
606
|
-
import
|
|
625
|
+
import React3 from "react";
|
|
607
626
|
import { IconButton, Toolbar } from "@dxos/react-ui";
|
|
608
627
|
var controlPositions = {
|
|
609
628
|
topleft: "top-2 left-2",
|
|
@@ -612,12 +631,12 @@ var controlPositions = {
|
|
|
612
631
|
bottomright: "bottom-2 right-2"
|
|
613
632
|
};
|
|
614
633
|
var ZoomControls = ({ classNames, onAction }) => {
|
|
615
|
-
return /* @__PURE__ */
|
|
634
|
+
return /* @__PURE__ */ React3.createElement(Toolbar.Root, {
|
|
616
635
|
classNames: [
|
|
617
636
|
"gap-1",
|
|
618
637
|
classNames
|
|
619
638
|
]
|
|
620
|
-
}, /* @__PURE__ */
|
|
639
|
+
}, /* @__PURE__ */ React3.createElement(IconButton, {
|
|
621
640
|
//
|
|
622
641
|
icon: "ph--plus--regular",
|
|
623
642
|
label: "zoom in",
|
|
@@ -625,7 +644,7 @@ var ZoomControls = ({ classNames, onAction }) => {
|
|
|
625
644
|
size: 5,
|
|
626
645
|
classNames: "px-0 aspect-square",
|
|
627
646
|
onClick: () => onAction?.("zoom-in")
|
|
628
|
-
}), /* @__PURE__ */
|
|
647
|
+
}), /* @__PURE__ */ React3.createElement(IconButton, {
|
|
629
648
|
//
|
|
630
649
|
icon: "ph--minus--regular",
|
|
631
650
|
label: "zoom out",
|
|
@@ -636,12 +655,12 @@ var ZoomControls = ({ classNames, onAction }) => {
|
|
|
636
655
|
}));
|
|
637
656
|
};
|
|
638
657
|
var ActionControls = ({ classNames, onAction }) => {
|
|
639
|
-
return /* @__PURE__ */
|
|
658
|
+
return /* @__PURE__ */ React3.createElement(Toolbar.Root, {
|
|
640
659
|
classNames: [
|
|
641
660
|
"gap-1",
|
|
642
661
|
classNames
|
|
643
662
|
]
|
|
644
|
-
}, /* @__PURE__ */
|
|
663
|
+
}, /* @__PURE__ */ React3.createElement(IconButton, {
|
|
645
664
|
//
|
|
646
665
|
icon: "ph--play--regular",
|
|
647
666
|
label: "start",
|
|
@@ -649,7 +668,7 @@ var ActionControls = ({ classNames, onAction }) => {
|
|
|
649
668
|
size: 5,
|
|
650
669
|
classNames: "px-0 aspect-square",
|
|
651
670
|
onClick: () => onAction?.("start")
|
|
652
|
-
}), /* @__PURE__ */
|
|
671
|
+
}), /* @__PURE__ */ React3.createElement(IconButton, {
|
|
653
672
|
//
|
|
654
673
|
icon: "ph--globe-hemisphere-west--regular",
|
|
655
674
|
label: "toggle",
|
|
@@ -662,28 +681,45 @@ var ActionControls = ({ classNames, onAction }) => {
|
|
|
662
681
|
|
|
663
682
|
// packages/ui/react-ui-geo/src/components/Globe/Globe.tsx
|
|
664
683
|
var defaultStyles = {
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
684
|
+
light: {
|
|
685
|
+
background: {
|
|
686
|
+
fillStyle: "#EEE"
|
|
687
|
+
},
|
|
688
|
+
water: {
|
|
689
|
+
fillStyle: "#555"
|
|
690
|
+
},
|
|
691
|
+
land: {
|
|
692
|
+
fillStyle: "#999"
|
|
693
|
+
},
|
|
694
|
+
line: {
|
|
695
|
+
strokeStyle: "darkred"
|
|
696
|
+
},
|
|
697
|
+
point: {
|
|
698
|
+
fillStyle: "#111111",
|
|
699
|
+
strokeStyle: "#111111",
|
|
700
|
+
strokeWidth: 1,
|
|
701
|
+
pointRadius: 0.5
|
|
702
|
+
}
|
|
681
703
|
},
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
704
|
+
dark: {
|
|
705
|
+
background: {
|
|
706
|
+
fillStyle: "#111111"
|
|
707
|
+
},
|
|
708
|
+
water: {
|
|
709
|
+
fillStyle: "#123E6A"
|
|
710
|
+
},
|
|
711
|
+
land: {
|
|
712
|
+
fillStyle: "#032153"
|
|
713
|
+
},
|
|
714
|
+
line: {
|
|
715
|
+
strokeStyle: "#111111"
|
|
716
|
+
},
|
|
717
|
+
point: {
|
|
718
|
+
fillStyle: "#111111",
|
|
719
|
+
strokeStyle: "#111111",
|
|
720
|
+
strokeWidth: 1,
|
|
721
|
+
pointRadius: 0.5
|
|
722
|
+
}
|
|
687
723
|
}
|
|
688
724
|
};
|
|
689
725
|
var projectionMap = {
|
|
@@ -700,10 +736,10 @@ var getProjection = (type = "orthographic") => {
|
|
|
700
736
|
};
|
|
701
737
|
var GlobeRoot = ({ classNames, children, ...props }) => {
|
|
702
738
|
const { ref, width, height } = useResizeDetector();
|
|
703
|
-
return /* @__PURE__ */
|
|
739
|
+
return /* @__PURE__ */ React4.createElement("div", {
|
|
704
740
|
ref,
|
|
705
741
|
className: mx("relative flex grow overflow-hidden", classNames)
|
|
706
|
-
}, /* @__PURE__ */
|
|
742
|
+
}, /* @__PURE__ */ React4.createElement(GlobeContextProvider, {
|
|
707
743
|
size: {
|
|
708
744
|
width,
|
|
709
745
|
height
|
|
@@ -711,7 +747,12 @@ var GlobeRoot = ({ classNames, children, ...props }) => {
|
|
|
711
747
|
...props
|
|
712
748
|
}, children));
|
|
713
749
|
};
|
|
714
|
-
var GlobeCanvas = /* @__PURE__ */ forwardRef(({ projection: _projection, topology, features, styles
|
|
750
|
+
var GlobeCanvas = /* @__PURE__ */ forwardRef(({ projection: _projection, topology, features, styles: _styles }, forwardRef3) => {
|
|
751
|
+
const { themeMode } = useThemeContext();
|
|
752
|
+
const styles = useMemo(() => _styles ?? defaultStyles[themeMode], [
|
|
753
|
+
_styles,
|
|
754
|
+
themeMode
|
|
755
|
+
]);
|
|
715
756
|
const [canvas, setCanvas] = useState3(null);
|
|
716
757
|
const canvasRef = (canvas2) => setCanvas(canvas2);
|
|
717
758
|
const projection = useMemo(() => getProjection(_projection), [
|
|
@@ -779,7 +820,7 @@ var GlobeCanvas = /* @__PURE__ */ forwardRef(({ projection: _projection, topolog
|
|
|
779
820
|
0,
|
|
780
821
|
0
|
|
781
822
|
]);
|
|
782
|
-
renderLayers(generator, layers, scale);
|
|
823
|
+
renderLayers(generator, layers, scale, styles);
|
|
783
824
|
});
|
|
784
825
|
}
|
|
785
826
|
}, [
|
|
@@ -793,7 +834,7 @@ var GlobeCanvas = /* @__PURE__ */ forwardRef(({ projection: _projection, topolog
|
|
|
793
834
|
if (!size.width || !size.height) {
|
|
794
835
|
return null;
|
|
795
836
|
}
|
|
796
|
-
return /* @__PURE__ */
|
|
837
|
+
return /* @__PURE__ */ React4.createElement("canvas", {
|
|
797
838
|
ref: canvasRef,
|
|
798
839
|
width: size.width,
|
|
799
840
|
height: size.height
|
|
@@ -801,9 +842,9 @@ var GlobeCanvas = /* @__PURE__ */ forwardRef(({ projection: _projection, topolog
|
|
|
801
842
|
});
|
|
802
843
|
var GlobeDebug = ({ position = "topleft" }) => {
|
|
803
844
|
const { size, scale, translation, rotation } = useGlobeContext();
|
|
804
|
-
return /* @__PURE__ */
|
|
845
|
+
return /* @__PURE__ */ React4.createElement("div", {
|
|
805
846
|
className: mx("z-10 absolute w-96 p-2 overflow-hidden border border-green-700 rounded", controlPositions[position])
|
|
806
|
-
}, /* @__PURE__ */
|
|
847
|
+
}, /* @__PURE__ */ React4.createElement("pre", {
|
|
807
848
|
className: "font-mono text-xs text-green-700"
|
|
808
849
|
}, JSON.stringify({
|
|
809
850
|
size,
|
|
@@ -813,28 +854,28 @@ var GlobeDebug = ({ position = "topleft" }) => {
|
|
|
813
854
|
}, null, 2)));
|
|
814
855
|
};
|
|
815
856
|
var GlobePanel = ({ position, classNames, children }) => {
|
|
816
|
-
return /* @__PURE__ */
|
|
857
|
+
return /* @__PURE__ */ React4.createElement("div", {
|
|
817
858
|
className: mx("z-10 absolute overflow-hidden", controlPositions[position], classNames)
|
|
818
859
|
}, children);
|
|
819
860
|
};
|
|
820
861
|
var CustomControl = ({ position, children }) => {
|
|
821
|
-
return /* @__PURE__ */
|
|
862
|
+
return /* @__PURE__ */ React4.createElement("div", {
|
|
822
863
|
className: mx("z-10 absolute overflow-hidden", controlPositions[position])
|
|
823
864
|
}, children);
|
|
824
865
|
};
|
|
825
866
|
var Globe = {
|
|
826
867
|
Root: GlobeRoot,
|
|
827
868
|
Canvas: GlobeCanvas,
|
|
828
|
-
Zoom: ({ onAction, position = "bottomleft", ...props }) => /* @__PURE__ */
|
|
869
|
+
Zoom: ({ onAction, position = "bottomleft", ...props }) => /* @__PURE__ */ React4.createElement(CustomControl, {
|
|
829
870
|
position,
|
|
830
871
|
...props
|
|
831
|
-
}, /* @__PURE__ */
|
|
872
|
+
}, /* @__PURE__ */ React4.createElement(ZoomControls, {
|
|
832
873
|
onAction
|
|
833
874
|
})),
|
|
834
|
-
Action: ({ onAction, position = "bottomright", ...props }) => /* @__PURE__ */
|
|
875
|
+
Action: ({ onAction, position = "bottomright", ...props }) => /* @__PURE__ */ React4.createElement(CustomControl, {
|
|
835
876
|
position,
|
|
836
877
|
...props
|
|
837
|
-
}, /* @__PURE__ */
|
|
878
|
+
}, /* @__PURE__ */ React4.createElement(ActionControls, {
|
|
838
879
|
onAction
|
|
839
880
|
})),
|
|
840
881
|
Debug: GlobeDebug,
|
|
@@ -843,13 +884,13 @@ var Globe = {
|
|
|
843
884
|
|
|
844
885
|
// packages/ui/react-ui-geo/src/components/Map/Map.tsx
|
|
845
886
|
import "leaflet/dist/leaflet.css";
|
|
846
|
-
import { Control, DomEvent, DomUtil, latLngBounds } from "leaflet";
|
|
847
|
-
import
|
|
887
|
+
import L, { Control, DomEvent, DomUtil, latLngBounds } from "leaflet";
|
|
888
|
+
import { forwardRef as forwardRef2, useEffect as useEffect5, useImperativeHandle as useImperativeHandle2 } from "react";
|
|
848
889
|
import { createRoot } from "react-dom/client";
|
|
849
890
|
import { MapContainer, Marker, Popup, TileLayer, useMap } from "react-leaflet";
|
|
850
891
|
import { useResizeDetector as useResizeDetector2 } from "react-resize-detector";
|
|
851
892
|
import { debounce } from "@dxos/async";
|
|
852
|
-
import {
|
|
893
|
+
import { ThemeProvider, Tooltip } from "@dxos/react-ui";
|
|
853
894
|
import { defaultTx, mx as mx2 } from "@dxos/react-ui-theme";
|
|
854
895
|
var defaults = {
|
|
855
896
|
// TODO(burdon): Guess location.
|
|
@@ -860,7 +901,7 @@ var defaults = {
|
|
|
860
901
|
zoom: 4
|
|
861
902
|
};
|
|
862
903
|
var MapRoot = ({ classNames, center = defaults.center, zoom = defaults.zoom, ...props }) => {
|
|
863
|
-
return /* @__PURE__ */
|
|
904
|
+
return /* @__PURE__ */ React.createElement(MapContainer, {
|
|
864
905
|
className: mx2("relative flex w-full h-full grow bg-baseSurface", classNames),
|
|
865
906
|
attributionControl: false,
|
|
866
907
|
// TODO(burdon): Only if attention.
|
|
@@ -871,7 +912,7 @@ var MapRoot = ({ classNames, center = defaults.center, zoom = defaults.zoom, ...
|
|
|
871
912
|
...props
|
|
872
913
|
});
|
|
873
914
|
};
|
|
874
|
-
var MapCanvas = /* @__PURE__ */ forwardRef2(({ markers
|
|
915
|
+
var MapCanvas = /* @__PURE__ */ forwardRef2(({ markers, center, zoom, onChange }, forwardedRef) => {
|
|
875
916
|
const { ref, width, height } = useResizeDetector2({
|
|
876
917
|
refreshRate: 200
|
|
877
918
|
});
|
|
@@ -931,20 +972,44 @@ var MapCanvas = /* @__PURE__ */ forwardRef2(({ markers = [], center, zoom, onCha
|
|
|
931
972
|
}, [
|
|
932
973
|
markers
|
|
933
974
|
]);
|
|
934
|
-
return /* @__PURE__ */
|
|
975
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
935
976
|
ref,
|
|
936
977
|
className: "flex w-full h-full overflow-hidden bg-baseSurface"
|
|
937
|
-
}, /* @__PURE__ */
|
|
978
|
+
}, /* @__PURE__ */ React.createElement(TileLayer, {
|
|
938
979
|
className: "dark:filter dark:grayscale dark:invert",
|
|
939
980
|
url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
|
940
|
-
}), markers
|
|
941
|
-
return /* @__PURE__ */
|
|
981
|
+
}), markers?.map(({ id, title, location: { lat, lng } }) => {
|
|
982
|
+
return /* @__PURE__ */ React.createElement(Marker, {
|
|
942
983
|
key: id,
|
|
943
984
|
position: {
|
|
944
985
|
lat,
|
|
945
986
|
lng
|
|
946
|
-
}
|
|
947
|
-
|
|
987
|
+
},
|
|
988
|
+
icon: (
|
|
989
|
+
// TODO(burdon): Create custom icon from bundled assets.
|
|
990
|
+
new L.Icon({
|
|
991
|
+
iconUrl: "https://dxos.network/marker-icon.png",
|
|
992
|
+
iconRetinaUrl: "https://dxos.network/marker-icon-2x.png",
|
|
993
|
+
shadowUrl: "https://dxos.network/marker-shadow.png",
|
|
994
|
+
iconSize: [
|
|
995
|
+
25,
|
|
996
|
+
41
|
|
997
|
+
],
|
|
998
|
+
iconAnchor: [
|
|
999
|
+
12,
|
|
1000
|
+
41
|
|
1001
|
+
],
|
|
1002
|
+
popupAnchor: [
|
|
1003
|
+
1,
|
|
1004
|
+
-34
|
|
1005
|
+
],
|
|
1006
|
+
shadowSize: [
|
|
1007
|
+
41,
|
|
1008
|
+
41
|
|
1009
|
+
]
|
|
1010
|
+
})
|
|
1011
|
+
)
|
|
1012
|
+
}, title && /* @__PURE__ */ React.createElement(Popup, null, title));
|
|
948
1013
|
}));
|
|
949
1014
|
});
|
|
950
1015
|
var CustomControl2 = ({ position, children }) => {
|
|
@@ -958,9 +1023,9 @@ var CustomControl2 = ({ position, children }) => {
|
|
|
958
1023
|
DomEvent.disableClickPropagation(container);
|
|
959
1024
|
DomEvent.disableScrollPropagation(container);
|
|
960
1025
|
const root = createRoot(container);
|
|
961
|
-
root.render(/* @__PURE__ */
|
|
1026
|
+
root.render(/* @__PURE__ */ React.createElement(ThemeProvider, {
|
|
962
1027
|
tx: defaultTx
|
|
963
|
-
}, /* @__PURE__ */
|
|
1028
|
+
}, /* @__PURE__ */ React.createElement(Tooltip.Provider, null, children)));
|
|
964
1029
|
return container;
|
|
965
1030
|
};
|
|
966
1031
|
control.addTo(map);
|
|
@@ -977,16 +1042,16 @@ var CustomControl2 = ({ position, children }) => {
|
|
|
977
1042
|
var Map = {
|
|
978
1043
|
Root: MapRoot,
|
|
979
1044
|
Canvas: MapCanvas,
|
|
980
|
-
Zoom: ({ onAction, position = "bottomleft", ...props }) => /* @__PURE__ */
|
|
1045
|
+
Zoom: ({ onAction, position = "bottomleft", ...props }) => /* @__PURE__ */ React.createElement(CustomControl2, {
|
|
981
1046
|
position,
|
|
982
1047
|
...props
|
|
983
|
-
}, /* @__PURE__ */
|
|
1048
|
+
}, /* @__PURE__ */ React.createElement(ZoomControls, {
|
|
984
1049
|
onAction
|
|
985
1050
|
})),
|
|
986
|
-
Action: ({ onAction, position = "bottomright", ...props }) => /* @__PURE__ */
|
|
1051
|
+
Action: ({ onAction, position = "bottomright", ...props }) => /* @__PURE__ */ React.createElement(CustomControl2, {
|
|
987
1052
|
position,
|
|
988
1053
|
...props
|
|
989
|
-
}, /* @__PURE__ */
|
|
1054
|
+
}, /* @__PURE__ */ React.createElement(ActionControls, {
|
|
990
1055
|
onAction
|
|
991
1056
|
}))
|
|
992
1057
|
};
|