@almadar/ui 2.48.6 → 2.48.7
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/avl/index.cjs +159 -114
- package/dist/avl/index.js +160 -114
- package/dist/components/index.cjs +1845 -892
- package/dist/components/index.js +1289 -332
- package/dist/components/molecules/MapView.d.ts +6 -2
- package/dist/providers/index.cjs +1315 -253
- package/dist/providers/index.js +1316 -253
- package/dist/runtime/index.cjs +1260 -295
- package/dist/runtime/index.js +1261 -295
- package/package.json +1 -1
package/dist/avl/index.cjs
CHANGED
|
@@ -16,9 +16,6 @@ var reactDom = require('react-dom');
|
|
|
16
16
|
var LucideIcons = require('lucide-react');
|
|
17
17
|
var evaluator = require('@almadar/evaluator');
|
|
18
18
|
var patterns = require('@almadar/patterns');
|
|
19
|
-
var reactLeaflet = require('react-leaflet');
|
|
20
|
-
var L = require('leaflet');
|
|
21
|
-
require('leaflet/dist/leaflet.css');
|
|
22
19
|
var reactRouterDom = require('react-router-dom');
|
|
23
20
|
var ReactMarkdown = require('react-markdown');
|
|
24
21
|
var remarkGfm = require('remark-gfm');
|
|
@@ -71,7 +68,6 @@ var React125__namespace = /*#__PURE__*/_interopNamespace(React125);
|
|
|
71
68
|
var THREE6__namespace = /*#__PURE__*/_interopNamespace(THREE6);
|
|
72
69
|
var ELK__default = /*#__PURE__*/_interopDefault(ELK);
|
|
73
70
|
var LucideIcons__namespace = /*#__PURE__*/_interopNamespace(LucideIcons);
|
|
74
|
-
var L__default = /*#__PURE__*/_interopDefault(L);
|
|
75
71
|
var ReactMarkdown__default = /*#__PURE__*/_interopDefault(ReactMarkdown);
|
|
76
72
|
var remarkGfm__default = /*#__PURE__*/_interopDefault(remarkGfm);
|
|
77
73
|
var remarkMath__default = /*#__PURE__*/_interopDefault(remarkMath);
|
|
@@ -2669,6 +2665,14 @@ var init_cn = __esm({
|
|
|
2669
2665
|
init_bundle_mjs();
|
|
2670
2666
|
}
|
|
2671
2667
|
});
|
|
2668
|
+
|
|
2669
|
+
// components/atoms/Typography.tsx
|
|
2670
|
+
var Typography_exports = {};
|
|
2671
|
+
__export(Typography_exports, {
|
|
2672
|
+
Heading: () => Heading,
|
|
2673
|
+
Text: () => Text,
|
|
2674
|
+
Typography: () => Typography
|
|
2675
|
+
});
|
|
2672
2676
|
var variantStyles, colorStyles, weightStyles, defaultElements, typographySizeStyles, overflowStyles, Typography, sizeStyles, Heading, Text;
|
|
2673
2677
|
var init_Typography = __esm({
|
|
2674
2678
|
"components/atoms/Typography.tsx"() {
|
|
@@ -3048,6 +3052,18 @@ var init_EventBusProvider = __esm({
|
|
|
3048
3052
|
EventBusContext = React125.createContext(null);
|
|
3049
3053
|
}
|
|
3050
3054
|
});
|
|
3055
|
+
|
|
3056
|
+
// hooks/useEventBus.ts
|
|
3057
|
+
var useEventBus_exports = {};
|
|
3058
|
+
__export(useEventBus_exports, {
|
|
3059
|
+
default: () => useEventBus_default,
|
|
3060
|
+
getGlobalEventBus: () => getGlobalEventBus,
|
|
3061
|
+
setGlobalEventBus: () => setGlobalEventBus,
|
|
3062
|
+
useEmitEvent: () => useEmitEvent,
|
|
3063
|
+
useEventBus: () => useEventBus,
|
|
3064
|
+
useEventListener: () => useEventListener,
|
|
3065
|
+
useEventSubscription: () => useEventSubscription
|
|
3066
|
+
});
|
|
3051
3067
|
function setGlobalEventBus(bus) {
|
|
3052
3068
|
if (typeof window !== "undefined") {
|
|
3053
3069
|
window.__kflowEventBus = bus;
|
|
@@ -3086,7 +3102,7 @@ function useEmitEvent() {
|
|
|
3086
3102
|
[eventBus]
|
|
3087
3103
|
);
|
|
3088
3104
|
}
|
|
3089
|
-
var log, subLog2, fallbackListeners, fallbackAnyListeners, fallbackEventBus;
|
|
3105
|
+
var log, subLog2, fallbackListeners, fallbackAnyListeners, fallbackEventBus, useEventSubscription, useEventBus_default;
|
|
3090
3106
|
var init_useEventBus = __esm({
|
|
3091
3107
|
"hooks/useEventBus.ts"() {
|
|
3092
3108
|
"use client";
|
|
@@ -3157,6 +3173,8 @@ var init_useEventBus = __esm({
|
|
|
3157
3173
|
};
|
|
3158
3174
|
}
|
|
3159
3175
|
};
|
|
3176
|
+
useEventSubscription = useEventListener;
|
|
3177
|
+
useEventBus_default = useEventBus;
|
|
3160
3178
|
}
|
|
3161
3179
|
});
|
|
3162
3180
|
var paddingStyles, paddingXStyles, paddingYStyles, marginStyles, marginXStyles, marginYStyles, bgStyles, roundedStyles, shadowStyles, displayStyles, overflowStyles2, positionStyles, Box;
|
|
@@ -19351,120 +19369,147 @@ FloatingActionButton.displayName = "FloatingActionButton";
|
|
|
19351
19369
|
|
|
19352
19370
|
// components/molecules/MapView.tsx
|
|
19353
19371
|
init_Box();
|
|
19354
|
-
init_Typography();
|
|
19355
19372
|
init_cn();
|
|
19356
|
-
|
|
19357
|
-
|
|
19358
|
-
|
|
19359
|
-
|
|
19360
|
-
|
|
19361
|
-
|
|
19362
|
-
|
|
19363
|
-
|
|
19364
|
-
|
|
19373
|
+
var MapViewImpl = React125.lazy(async () => {
|
|
19374
|
+
const [reactLeaflet, leafletMod] = await Promise.all([
|
|
19375
|
+
import('react-leaflet'),
|
|
19376
|
+
import('leaflet')
|
|
19377
|
+
]);
|
|
19378
|
+
await import('leaflet/dist/leaflet.css');
|
|
19379
|
+
const { MapContainer, TileLayer, Marker, Popup, useMap } = reactLeaflet;
|
|
19380
|
+
const L = leafletMod.default;
|
|
19381
|
+
const defaultIcon = L.icon({
|
|
19382
|
+
iconUrl: "https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png",
|
|
19383
|
+
iconRetinaUrl: "https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon-2x.png",
|
|
19384
|
+
shadowUrl: "https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png",
|
|
19385
|
+
iconSize: [25, 41],
|
|
19386
|
+
iconAnchor: [12, 41],
|
|
19387
|
+
popupAnchor: [1, -34],
|
|
19388
|
+
shadowSize: [41, 41]
|
|
19389
|
+
});
|
|
19390
|
+
L.Marker.prototype.options.icon = defaultIcon;
|
|
19391
|
+
const { useEffect: useEffect87, useRef: useRef87, useCallback: useCallback123, useState: useState123 } = React125__namespace.default;
|
|
19392
|
+
const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
|
|
19393
|
+
const { useEventBus: useEventBus3 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
|
|
19394
|
+
function MapUpdater({ centerLat, centerLng, zoom }) {
|
|
19395
|
+
const map = useMap();
|
|
19396
|
+
const prevRef = useRef87({ centerLat, centerLng, zoom });
|
|
19397
|
+
useEffect87(() => {
|
|
19398
|
+
const prev = prevRef.current;
|
|
19399
|
+
if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
|
|
19400
|
+
map.setView([centerLat, centerLng], zoom);
|
|
19401
|
+
prevRef.current = { centerLat, centerLng, zoom };
|
|
19402
|
+
}
|
|
19403
|
+
}, [map, centerLat, centerLng, zoom]);
|
|
19404
|
+
return null;
|
|
19405
|
+
}
|
|
19406
|
+
function MapClickHandler({ onMapClick }) {
|
|
19407
|
+
const map = useMap();
|
|
19408
|
+
useEffect87(() => {
|
|
19409
|
+
if (!onMapClick) return;
|
|
19410
|
+
const handler = (e) => {
|
|
19411
|
+
onMapClick(e.latlng.lat, e.latlng.lng);
|
|
19412
|
+
};
|
|
19413
|
+
map.on("click", handler);
|
|
19414
|
+
return () => {
|
|
19415
|
+
map.off("click", handler);
|
|
19416
|
+
};
|
|
19417
|
+
}, [map, onMapClick]);
|
|
19418
|
+
return null;
|
|
19419
|
+
}
|
|
19420
|
+
function MapViewInner({
|
|
19421
|
+
markers = [],
|
|
19422
|
+
centerLat = 51.505,
|
|
19423
|
+
centerLng = -0.09,
|
|
19424
|
+
zoom = 13,
|
|
19425
|
+
height = "400px",
|
|
19426
|
+
onMarkerClick,
|
|
19427
|
+
onMapClick,
|
|
19428
|
+
mapClickEvent,
|
|
19429
|
+
markerClickEvent,
|
|
19430
|
+
showClickedPin = false,
|
|
19431
|
+
className,
|
|
19432
|
+
showAttribution = true
|
|
19433
|
+
}) {
|
|
19434
|
+
const eventBus = useEventBus3();
|
|
19435
|
+
const [clickedPosition, setClickedPosition] = useState123(null);
|
|
19436
|
+
const handleMapClick = useCallback123((lat, lng) => {
|
|
19437
|
+
if (showClickedPin) {
|
|
19438
|
+
setClickedPosition({ lat, lng });
|
|
19439
|
+
}
|
|
19440
|
+
onMapClick?.(lat, lng);
|
|
19441
|
+
if (mapClickEvent) {
|
|
19442
|
+
eventBus.emit(`UI:${mapClickEvent}`, { latitude: lat, longitude: lng });
|
|
19443
|
+
}
|
|
19444
|
+
}, [onMapClick, mapClickEvent, eventBus, showClickedPin]);
|
|
19445
|
+
const handleMarkerClick = useCallback123((marker) => {
|
|
19446
|
+
onMarkerClick?.(marker);
|
|
19447
|
+
if (markerClickEvent) {
|
|
19448
|
+
eventBus.emit(`UI:${markerClickEvent}`, { ...marker });
|
|
19449
|
+
}
|
|
19450
|
+
}, [onMarkerClick, markerClickEvent, eventBus]);
|
|
19451
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
19452
|
+
Box,
|
|
19453
|
+
{
|
|
19454
|
+
className: cn("relative w-full overflow-hidden rounded-lg", className),
|
|
19455
|
+
style: { height },
|
|
19456
|
+
"data-testid": "map-view",
|
|
19457
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
19458
|
+
MapContainer,
|
|
19459
|
+
{
|
|
19460
|
+
center: [centerLat, centerLng],
|
|
19461
|
+
zoom,
|
|
19462
|
+
style: { height: "100%", width: "100%" },
|
|
19463
|
+
attributionControl: showAttribution,
|
|
19464
|
+
children: [
|
|
19465
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19466
|
+
TileLayer,
|
|
19467
|
+
{
|
|
19468
|
+
url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
|
19469
|
+
attribution: showAttribution ? '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>' : void 0
|
|
19470
|
+
}
|
|
19471
|
+
),
|
|
19472
|
+
/* @__PURE__ */ jsxRuntime.jsx(MapUpdater, { centerLat, centerLng, zoom }),
|
|
19473
|
+
/* @__PURE__ */ jsxRuntime.jsx(MapClickHandler, { onMapClick: handleMapClick }),
|
|
19474
|
+
showClickedPin && clickedPosition && /* @__PURE__ */ jsxRuntime.jsx(Marker, { position: [clickedPosition.lat, clickedPosition.lng], children: /* @__PURE__ */ jsxRuntime.jsx(Popup, { children: /* @__PURE__ */ jsxRuntime.jsxs(Typography2, { variant: "body2", children: [
|
|
19475
|
+
clickedPosition.lat.toFixed(5),
|
|
19476
|
+
", ",
|
|
19477
|
+
clickedPosition.lng.toFixed(5)
|
|
19478
|
+
] }) }) }),
|
|
19479
|
+
markers.map((marker) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
19480
|
+
Marker,
|
|
19481
|
+
{
|
|
19482
|
+
position: [marker.lat, marker.lng],
|
|
19483
|
+
eventHandlers: onMarkerClick || markerClickEvent ? { click: () => handleMarkerClick(marker) } : void 0,
|
|
19484
|
+
children: marker.label ? /* @__PURE__ */ jsxRuntime.jsxs(Popup, { children: [
|
|
19485
|
+
/* @__PURE__ */ jsxRuntime.jsx(Typography2, { variant: "body2", children: marker.label }),
|
|
19486
|
+
marker.category ? /* @__PURE__ */ jsxRuntime.jsx(Typography2, { variant: "caption", className: "text-muted-foreground", children: marker.category }) : null
|
|
19487
|
+
] }) : null
|
|
19488
|
+
},
|
|
19489
|
+
marker.id
|
|
19490
|
+
))
|
|
19491
|
+
]
|
|
19492
|
+
},
|
|
19493
|
+
`map-${centerLat}-${centerLng}-${zoom}`
|
|
19494
|
+
)
|
|
19495
|
+
}
|
|
19496
|
+
);
|
|
19497
|
+
}
|
|
19498
|
+
return { default: MapViewInner };
|
|
19365
19499
|
});
|
|
19366
|
-
|
|
19367
|
-
function MapUpdater({ centerLat, centerLng, zoom }) {
|
|
19368
|
-
const map = reactLeaflet.useMap();
|
|
19369
|
-
const prevRef = React125.useRef({ centerLat, centerLng, zoom });
|
|
19370
|
-
React125.useEffect(() => {
|
|
19371
|
-
const prev = prevRef.current;
|
|
19372
|
-
if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
|
|
19373
|
-
map.setView([centerLat, centerLng], zoom);
|
|
19374
|
-
prevRef.current = { centerLat, centerLng, zoom };
|
|
19375
|
-
}
|
|
19376
|
-
}, [map, centerLat, centerLng, zoom]);
|
|
19377
|
-
return null;
|
|
19378
|
-
}
|
|
19379
|
-
function MapClickHandler({ onMapClick }) {
|
|
19380
|
-
const map = reactLeaflet.useMap();
|
|
19381
|
-
React125.useEffect(() => {
|
|
19382
|
-
if (!onMapClick) return;
|
|
19383
|
-
const handler = (e) => {
|
|
19384
|
-
onMapClick(e.latlng.lat, e.latlng.lng);
|
|
19385
|
-
};
|
|
19386
|
-
map.on("click", handler);
|
|
19387
|
-
return () => {
|
|
19388
|
-
map.off("click", handler);
|
|
19389
|
-
};
|
|
19390
|
-
}, [map, onMapClick]);
|
|
19391
|
-
return null;
|
|
19392
|
-
}
|
|
19393
|
-
function MapView({
|
|
19394
|
-
markers = [],
|
|
19395
|
-
centerLat = 51.505,
|
|
19396
|
-
centerLng = -0.09,
|
|
19397
|
-
zoom = 13,
|
|
19398
|
-
height = "400px",
|
|
19399
|
-
onMarkerClick,
|
|
19400
|
-
onMapClick,
|
|
19401
|
-
mapClickEvent,
|
|
19402
|
-
markerClickEvent,
|
|
19403
|
-
showClickedPin = false,
|
|
19404
|
-
className,
|
|
19405
|
-
showAttribution = true
|
|
19406
|
-
}) {
|
|
19407
|
-
const eventBus = useEventBus();
|
|
19408
|
-
const [clickedPosition, setClickedPosition] = React125.useState(null);
|
|
19409
|
-
const handleMapClick = React125.useCallback((lat, lng) => {
|
|
19410
|
-
if (showClickedPin) {
|
|
19411
|
-
setClickedPosition({ lat, lng });
|
|
19412
|
-
}
|
|
19413
|
-
onMapClick?.(lat, lng);
|
|
19414
|
-
if (mapClickEvent) {
|
|
19415
|
-
eventBus.emit(`UI:${mapClickEvent}`, { latitude: lat, longitude: lng });
|
|
19416
|
-
}
|
|
19417
|
-
}, [onMapClick, mapClickEvent, eventBus, showClickedPin]);
|
|
19418
|
-
const handleMarkerClick = React125.useCallback((marker) => {
|
|
19419
|
-
onMarkerClick?.(marker);
|
|
19420
|
-
if (markerClickEvent) {
|
|
19421
|
-
eventBus.emit(`UI:${markerClickEvent}`, { ...marker });
|
|
19422
|
-
}
|
|
19423
|
-
}, [onMarkerClick, markerClickEvent, eventBus]);
|
|
19500
|
+
function MapView(props) {
|
|
19424
19501
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
19425
|
-
|
|
19502
|
+
React125.Suspense,
|
|
19426
19503
|
{
|
|
19427
|
-
|
|
19428
|
-
|
|
19429
|
-
"data-testid": "map-view",
|
|
19430
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
19431
|
-
reactLeaflet.MapContainer,
|
|
19504
|
+
fallback: /* @__PURE__ */ jsxRuntime.jsx(
|
|
19505
|
+
Box,
|
|
19432
19506
|
{
|
|
19433
|
-
|
|
19434
|
-
|
|
19435
|
-
|
|
19436
|
-
|
|
19437
|
-
|
|
19438
|
-
|
|
19439
|
-
reactLeaflet.TileLayer,
|
|
19440
|
-
{
|
|
19441
|
-
url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
|
19442
|
-
attribution: showAttribution ? '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>' : void 0
|
|
19443
|
-
}
|
|
19444
|
-
),
|
|
19445
|
-
/* @__PURE__ */ jsxRuntime.jsx(MapUpdater, { centerLat, centerLng, zoom }),
|
|
19446
|
-
/* @__PURE__ */ jsxRuntime.jsx(MapClickHandler, { onMapClick: handleMapClick }),
|
|
19447
|
-
showClickedPin && clickedPosition && /* @__PURE__ */ jsxRuntime.jsx(reactLeaflet.Marker, { position: [clickedPosition.lat, clickedPosition.lng], children: /* @__PURE__ */ jsxRuntime.jsx(reactLeaflet.Popup, { children: /* @__PURE__ */ jsxRuntime.jsxs(Typography, { variant: "body2", children: [
|
|
19448
|
-
clickedPosition.lat.toFixed(5),
|
|
19449
|
-
", ",
|
|
19450
|
-
clickedPosition.lng.toFixed(5)
|
|
19451
|
-
] }) }) }),
|
|
19452
|
-
markers.map((marker) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
19453
|
-
reactLeaflet.Marker,
|
|
19454
|
-
{
|
|
19455
|
-
position: [marker.lat, marker.lng],
|
|
19456
|
-
eventHandlers: onMarkerClick || markerClickEvent ? { click: () => handleMarkerClick(marker) } : void 0,
|
|
19457
|
-
children: marker.label ? /* @__PURE__ */ jsxRuntime.jsxs(reactLeaflet.Popup, { children: [
|
|
19458
|
-
/* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "body2", children: marker.label }),
|
|
19459
|
-
marker.category ? /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: marker.category }) : null
|
|
19460
|
-
] }) : null
|
|
19461
|
-
},
|
|
19462
|
-
marker.id
|
|
19463
|
-
))
|
|
19464
|
-
]
|
|
19465
|
-
},
|
|
19466
|
-
`map-${centerLat}-${centerLng}-${zoom}`
|
|
19467
|
-
)
|
|
19507
|
+
className: cn("relative w-full overflow-hidden rounded-lg bg-muted/20", props.className),
|
|
19508
|
+
style: { height: props.height ?? "400px" },
|
|
19509
|
+
"data-testid": "map-view"
|
|
19510
|
+
}
|
|
19511
|
+
),
|
|
19512
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(MapViewImpl, { ...props })
|
|
19468
19513
|
}
|
|
19469
19514
|
);
|
|
19470
19515
|
}
|
package/dist/avl/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { OrbitControls, Grid as Grid$1, Stars, Sparkles, Html, RoundedBox } from '@react-three/drei';
|
|
3
3
|
import * as React125 from 'react';
|
|
4
|
-
import React125__default, { createContext, useState, useRef, useCallback, useEffect, useMemo, useLayoutEffect,
|
|
4
|
+
import React125__default, { createContext, useState, useRef, useCallback, useEffect, lazy, useMemo, useLayoutEffect, useContext, Suspense, useSyncExternalStore, useId, forwardRef, useImperativeHandle, useReducer, Component } from 'react';
|
|
5
5
|
import { useThree, useFrame, Canvas } from '@react-three/fiber';
|
|
6
6
|
import * as THREE6 from 'three';
|
|
7
7
|
import { MathUtils, Vector3, Quaternion, QuadraticBezierCurve3 } from 'three';
|
|
@@ -17,9 +17,6 @@ import * as LucideIcons from 'lucide-react';
|
|
|
17
17
|
import { Loader2, ChevronDown, X, ArrowRight, TrendingDown, TrendingUp, Check, Copy, AlertCircle, AlertTriangle, Info, CheckCircle, ChevronLeft, ChevronRight, FileWarning, Upload, Circle, Clock, CheckCircle2, Sun, Moon, ArrowUp, ArrowDown, MoreVertical, Minus, Star, XCircle, Play, RotateCcw, Pause, SkipForward, Eraser, Search, HelpCircle, ChevronUp, ArrowLeft, Plus, Image as Image$1, ZoomIn, Package, Menu as Menu$1, ZoomOut, Filter, FileQuestion, Inbox, FileText, Download, Printer, Bug, Send, MoreHorizontal, Settings, Bell, LogOut, Trash2, Zap, Sword, Move, Heart, Shield, Code, WrapText, Wrench, List, Calendar, Pencil, Eye, User, Tag, DollarSign } from 'lucide-react';
|
|
18
18
|
import { evaluate, createMinimalContext } from '@almadar/evaluator';
|
|
19
19
|
import { getComponentForPattern as getComponentForPattern$1, getPatternDefinition, isEntityAwarePattern } from '@almadar/patterns';
|
|
20
|
-
import { MapContainer, TileLayer, Marker, Popup, useMap } from 'react-leaflet';
|
|
21
|
-
import L from 'leaflet';
|
|
22
|
-
import 'leaflet/dist/leaflet.css';
|
|
23
20
|
import { useLocation, Link, Outlet } from 'react-router-dom';
|
|
24
21
|
import ReactMarkdown from 'react-markdown';
|
|
25
22
|
import remarkGfm from 'remark-gfm';
|
|
@@ -2622,6 +2619,14 @@ var init_cn = __esm({
|
|
|
2622
2619
|
init_bundle_mjs();
|
|
2623
2620
|
}
|
|
2624
2621
|
});
|
|
2622
|
+
|
|
2623
|
+
// components/atoms/Typography.tsx
|
|
2624
|
+
var Typography_exports = {};
|
|
2625
|
+
__export(Typography_exports, {
|
|
2626
|
+
Heading: () => Heading,
|
|
2627
|
+
Text: () => Text,
|
|
2628
|
+
Typography: () => Typography
|
|
2629
|
+
});
|
|
2625
2630
|
var variantStyles, colorStyles, weightStyles, defaultElements, typographySizeStyles, overflowStyles, Typography, sizeStyles, Heading, Text;
|
|
2626
2631
|
var init_Typography = __esm({
|
|
2627
2632
|
"components/atoms/Typography.tsx"() {
|
|
@@ -3001,6 +3006,18 @@ var init_EventBusProvider = __esm({
|
|
|
3001
3006
|
EventBusContext = createContext(null);
|
|
3002
3007
|
}
|
|
3003
3008
|
});
|
|
3009
|
+
|
|
3010
|
+
// hooks/useEventBus.ts
|
|
3011
|
+
var useEventBus_exports = {};
|
|
3012
|
+
__export(useEventBus_exports, {
|
|
3013
|
+
default: () => useEventBus_default,
|
|
3014
|
+
getGlobalEventBus: () => getGlobalEventBus,
|
|
3015
|
+
setGlobalEventBus: () => setGlobalEventBus,
|
|
3016
|
+
useEmitEvent: () => useEmitEvent,
|
|
3017
|
+
useEventBus: () => useEventBus,
|
|
3018
|
+
useEventListener: () => useEventListener,
|
|
3019
|
+
useEventSubscription: () => useEventSubscription
|
|
3020
|
+
});
|
|
3004
3021
|
function setGlobalEventBus(bus) {
|
|
3005
3022
|
if (typeof window !== "undefined") {
|
|
3006
3023
|
window.__kflowEventBus = bus;
|
|
@@ -3039,7 +3056,7 @@ function useEmitEvent() {
|
|
|
3039
3056
|
[eventBus]
|
|
3040
3057
|
);
|
|
3041
3058
|
}
|
|
3042
|
-
var log, subLog2, fallbackListeners, fallbackAnyListeners, fallbackEventBus;
|
|
3059
|
+
var log, subLog2, fallbackListeners, fallbackAnyListeners, fallbackEventBus, useEventSubscription, useEventBus_default;
|
|
3043
3060
|
var init_useEventBus = __esm({
|
|
3044
3061
|
"hooks/useEventBus.ts"() {
|
|
3045
3062
|
"use client";
|
|
@@ -3110,6 +3127,8 @@ var init_useEventBus = __esm({
|
|
|
3110
3127
|
};
|
|
3111
3128
|
}
|
|
3112
3129
|
};
|
|
3130
|
+
useEventSubscription = useEventListener;
|
|
3131
|
+
useEventBus_default = useEventBus;
|
|
3113
3132
|
}
|
|
3114
3133
|
});
|
|
3115
3134
|
var paddingStyles, paddingXStyles, paddingYStyles, marginStyles, marginXStyles, marginYStyles, bgStyles, roundedStyles, shadowStyles, displayStyles, overflowStyles2, positionStyles, Box;
|
|
@@ -19304,120 +19323,147 @@ FloatingActionButton.displayName = "FloatingActionButton";
|
|
|
19304
19323
|
|
|
19305
19324
|
// components/molecules/MapView.tsx
|
|
19306
19325
|
init_Box();
|
|
19307
|
-
init_Typography();
|
|
19308
19326
|
init_cn();
|
|
19309
|
-
|
|
19310
|
-
|
|
19311
|
-
|
|
19312
|
-
|
|
19313
|
-
|
|
19314
|
-
|
|
19315
|
-
|
|
19316
|
-
|
|
19317
|
-
|
|
19327
|
+
var MapViewImpl = lazy(async () => {
|
|
19328
|
+
const [reactLeaflet, leafletMod] = await Promise.all([
|
|
19329
|
+
import('react-leaflet'),
|
|
19330
|
+
import('leaflet')
|
|
19331
|
+
]);
|
|
19332
|
+
await import('leaflet/dist/leaflet.css');
|
|
19333
|
+
const { MapContainer, TileLayer, Marker, Popup, useMap } = reactLeaflet;
|
|
19334
|
+
const L = leafletMod.default;
|
|
19335
|
+
const defaultIcon = L.icon({
|
|
19336
|
+
iconUrl: "https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png",
|
|
19337
|
+
iconRetinaUrl: "https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon-2x.png",
|
|
19338
|
+
shadowUrl: "https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png",
|
|
19339
|
+
iconSize: [25, 41],
|
|
19340
|
+
iconAnchor: [12, 41],
|
|
19341
|
+
popupAnchor: [1, -34],
|
|
19342
|
+
shadowSize: [41, 41]
|
|
19343
|
+
});
|
|
19344
|
+
L.Marker.prototype.options.icon = defaultIcon;
|
|
19345
|
+
const { useEffect: useEffect87, useRef: useRef87, useCallback: useCallback123, useState: useState123 } = React125__default;
|
|
19346
|
+
const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
|
|
19347
|
+
const { useEventBus: useEventBus3 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
|
|
19348
|
+
function MapUpdater({ centerLat, centerLng, zoom }) {
|
|
19349
|
+
const map = useMap();
|
|
19350
|
+
const prevRef = useRef87({ centerLat, centerLng, zoom });
|
|
19351
|
+
useEffect87(() => {
|
|
19352
|
+
const prev = prevRef.current;
|
|
19353
|
+
if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
|
|
19354
|
+
map.setView([centerLat, centerLng], zoom);
|
|
19355
|
+
prevRef.current = { centerLat, centerLng, zoom };
|
|
19356
|
+
}
|
|
19357
|
+
}, [map, centerLat, centerLng, zoom]);
|
|
19358
|
+
return null;
|
|
19359
|
+
}
|
|
19360
|
+
function MapClickHandler({ onMapClick }) {
|
|
19361
|
+
const map = useMap();
|
|
19362
|
+
useEffect87(() => {
|
|
19363
|
+
if (!onMapClick) return;
|
|
19364
|
+
const handler = (e) => {
|
|
19365
|
+
onMapClick(e.latlng.lat, e.latlng.lng);
|
|
19366
|
+
};
|
|
19367
|
+
map.on("click", handler);
|
|
19368
|
+
return () => {
|
|
19369
|
+
map.off("click", handler);
|
|
19370
|
+
};
|
|
19371
|
+
}, [map, onMapClick]);
|
|
19372
|
+
return null;
|
|
19373
|
+
}
|
|
19374
|
+
function MapViewInner({
|
|
19375
|
+
markers = [],
|
|
19376
|
+
centerLat = 51.505,
|
|
19377
|
+
centerLng = -0.09,
|
|
19378
|
+
zoom = 13,
|
|
19379
|
+
height = "400px",
|
|
19380
|
+
onMarkerClick,
|
|
19381
|
+
onMapClick,
|
|
19382
|
+
mapClickEvent,
|
|
19383
|
+
markerClickEvent,
|
|
19384
|
+
showClickedPin = false,
|
|
19385
|
+
className,
|
|
19386
|
+
showAttribution = true
|
|
19387
|
+
}) {
|
|
19388
|
+
const eventBus = useEventBus3();
|
|
19389
|
+
const [clickedPosition, setClickedPosition] = useState123(null);
|
|
19390
|
+
const handleMapClick = useCallback123((lat, lng) => {
|
|
19391
|
+
if (showClickedPin) {
|
|
19392
|
+
setClickedPosition({ lat, lng });
|
|
19393
|
+
}
|
|
19394
|
+
onMapClick?.(lat, lng);
|
|
19395
|
+
if (mapClickEvent) {
|
|
19396
|
+
eventBus.emit(`UI:${mapClickEvent}`, { latitude: lat, longitude: lng });
|
|
19397
|
+
}
|
|
19398
|
+
}, [onMapClick, mapClickEvent, eventBus, showClickedPin]);
|
|
19399
|
+
const handleMarkerClick = useCallback123((marker) => {
|
|
19400
|
+
onMarkerClick?.(marker);
|
|
19401
|
+
if (markerClickEvent) {
|
|
19402
|
+
eventBus.emit(`UI:${markerClickEvent}`, { ...marker });
|
|
19403
|
+
}
|
|
19404
|
+
}, [onMarkerClick, markerClickEvent, eventBus]);
|
|
19405
|
+
return /* @__PURE__ */ jsx(
|
|
19406
|
+
Box,
|
|
19407
|
+
{
|
|
19408
|
+
className: cn("relative w-full overflow-hidden rounded-lg", className),
|
|
19409
|
+
style: { height },
|
|
19410
|
+
"data-testid": "map-view",
|
|
19411
|
+
children: /* @__PURE__ */ jsxs(
|
|
19412
|
+
MapContainer,
|
|
19413
|
+
{
|
|
19414
|
+
center: [centerLat, centerLng],
|
|
19415
|
+
zoom,
|
|
19416
|
+
style: { height: "100%", width: "100%" },
|
|
19417
|
+
attributionControl: showAttribution,
|
|
19418
|
+
children: [
|
|
19419
|
+
/* @__PURE__ */ jsx(
|
|
19420
|
+
TileLayer,
|
|
19421
|
+
{
|
|
19422
|
+
url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
|
19423
|
+
attribution: showAttribution ? '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>' : void 0
|
|
19424
|
+
}
|
|
19425
|
+
),
|
|
19426
|
+
/* @__PURE__ */ jsx(MapUpdater, { centerLat, centerLng, zoom }),
|
|
19427
|
+
/* @__PURE__ */ jsx(MapClickHandler, { onMapClick: handleMapClick }),
|
|
19428
|
+
showClickedPin && clickedPosition && /* @__PURE__ */ jsx(Marker, { position: [clickedPosition.lat, clickedPosition.lng], children: /* @__PURE__ */ jsx(Popup, { children: /* @__PURE__ */ jsxs(Typography2, { variant: "body2", children: [
|
|
19429
|
+
clickedPosition.lat.toFixed(5),
|
|
19430
|
+
", ",
|
|
19431
|
+
clickedPosition.lng.toFixed(5)
|
|
19432
|
+
] }) }) }),
|
|
19433
|
+
markers.map((marker) => /* @__PURE__ */ jsx(
|
|
19434
|
+
Marker,
|
|
19435
|
+
{
|
|
19436
|
+
position: [marker.lat, marker.lng],
|
|
19437
|
+
eventHandlers: onMarkerClick || markerClickEvent ? { click: () => handleMarkerClick(marker) } : void 0,
|
|
19438
|
+
children: marker.label ? /* @__PURE__ */ jsxs(Popup, { children: [
|
|
19439
|
+
/* @__PURE__ */ jsx(Typography2, { variant: "body2", children: marker.label }),
|
|
19440
|
+
marker.category ? /* @__PURE__ */ jsx(Typography2, { variant: "caption", className: "text-muted-foreground", children: marker.category }) : null
|
|
19441
|
+
] }) : null
|
|
19442
|
+
},
|
|
19443
|
+
marker.id
|
|
19444
|
+
))
|
|
19445
|
+
]
|
|
19446
|
+
},
|
|
19447
|
+
`map-${centerLat}-${centerLng}-${zoom}`
|
|
19448
|
+
)
|
|
19449
|
+
}
|
|
19450
|
+
);
|
|
19451
|
+
}
|
|
19452
|
+
return { default: MapViewInner };
|
|
19318
19453
|
});
|
|
19319
|
-
|
|
19320
|
-
function MapUpdater({ centerLat, centerLng, zoom }) {
|
|
19321
|
-
const map = useMap();
|
|
19322
|
-
const prevRef = useRef({ centerLat, centerLng, zoom });
|
|
19323
|
-
useEffect(() => {
|
|
19324
|
-
const prev = prevRef.current;
|
|
19325
|
-
if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
|
|
19326
|
-
map.setView([centerLat, centerLng], zoom);
|
|
19327
|
-
prevRef.current = { centerLat, centerLng, zoom };
|
|
19328
|
-
}
|
|
19329
|
-
}, [map, centerLat, centerLng, zoom]);
|
|
19330
|
-
return null;
|
|
19331
|
-
}
|
|
19332
|
-
function MapClickHandler({ onMapClick }) {
|
|
19333
|
-
const map = useMap();
|
|
19334
|
-
useEffect(() => {
|
|
19335
|
-
if (!onMapClick) return;
|
|
19336
|
-
const handler = (e) => {
|
|
19337
|
-
onMapClick(e.latlng.lat, e.latlng.lng);
|
|
19338
|
-
};
|
|
19339
|
-
map.on("click", handler);
|
|
19340
|
-
return () => {
|
|
19341
|
-
map.off("click", handler);
|
|
19342
|
-
};
|
|
19343
|
-
}, [map, onMapClick]);
|
|
19344
|
-
return null;
|
|
19345
|
-
}
|
|
19346
|
-
function MapView({
|
|
19347
|
-
markers = [],
|
|
19348
|
-
centerLat = 51.505,
|
|
19349
|
-
centerLng = -0.09,
|
|
19350
|
-
zoom = 13,
|
|
19351
|
-
height = "400px",
|
|
19352
|
-
onMarkerClick,
|
|
19353
|
-
onMapClick,
|
|
19354
|
-
mapClickEvent,
|
|
19355
|
-
markerClickEvent,
|
|
19356
|
-
showClickedPin = false,
|
|
19357
|
-
className,
|
|
19358
|
-
showAttribution = true
|
|
19359
|
-
}) {
|
|
19360
|
-
const eventBus = useEventBus();
|
|
19361
|
-
const [clickedPosition, setClickedPosition] = useState(null);
|
|
19362
|
-
const handleMapClick = useCallback((lat, lng) => {
|
|
19363
|
-
if (showClickedPin) {
|
|
19364
|
-
setClickedPosition({ lat, lng });
|
|
19365
|
-
}
|
|
19366
|
-
onMapClick?.(lat, lng);
|
|
19367
|
-
if (mapClickEvent) {
|
|
19368
|
-
eventBus.emit(`UI:${mapClickEvent}`, { latitude: lat, longitude: lng });
|
|
19369
|
-
}
|
|
19370
|
-
}, [onMapClick, mapClickEvent, eventBus, showClickedPin]);
|
|
19371
|
-
const handleMarkerClick = useCallback((marker) => {
|
|
19372
|
-
onMarkerClick?.(marker);
|
|
19373
|
-
if (markerClickEvent) {
|
|
19374
|
-
eventBus.emit(`UI:${markerClickEvent}`, { ...marker });
|
|
19375
|
-
}
|
|
19376
|
-
}, [onMarkerClick, markerClickEvent, eventBus]);
|
|
19454
|
+
function MapView(props) {
|
|
19377
19455
|
return /* @__PURE__ */ jsx(
|
|
19378
|
-
|
|
19456
|
+
Suspense,
|
|
19379
19457
|
{
|
|
19380
|
-
|
|
19381
|
-
|
|
19382
|
-
"data-testid": "map-view",
|
|
19383
|
-
children: /* @__PURE__ */ jsxs(
|
|
19384
|
-
MapContainer,
|
|
19458
|
+
fallback: /* @__PURE__ */ jsx(
|
|
19459
|
+
Box,
|
|
19385
19460
|
{
|
|
19386
|
-
|
|
19387
|
-
|
|
19388
|
-
|
|
19389
|
-
|
|
19390
|
-
|
|
19391
|
-
|
|
19392
|
-
TileLayer,
|
|
19393
|
-
{
|
|
19394
|
-
url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
|
19395
|
-
attribution: showAttribution ? '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>' : void 0
|
|
19396
|
-
}
|
|
19397
|
-
),
|
|
19398
|
-
/* @__PURE__ */ jsx(MapUpdater, { centerLat, centerLng, zoom }),
|
|
19399
|
-
/* @__PURE__ */ jsx(MapClickHandler, { onMapClick: handleMapClick }),
|
|
19400
|
-
showClickedPin && clickedPosition && /* @__PURE__ */ jsx(Marker, { position: [clickedPosition.lat, clickedPosition.lng], children: /* @__PURE__ */ jsx(Popup, { children: /* @__PURE__ */ jsxs(Typography, { variant: "body2", children: [
|
|
19401
|
-
clickedPosition.lat.toFixed(5),
|
|
19402
|
-
", ",
|
|
19403
|
-
clickedPosition.lng.toFixed(5)
|
|
19404
|
-
] }) }) }),
|
|
19405
|
-
markers.map((marker) => /* @__PURE__ */ jsx(
|
|
19406
|
-
Marker,
|
|
19407
|
-
{
|
|
19408
|
-
position: [marker.lat, marker.lng],
|
|
19409
|
-
eventHandlers: onMarkerClick || markerClickEvent ? { click: () => handleMarkerClick(marker) } : void 0,
|
|
19410
|
-
children: marker.label ? /* @__PURE__ */ jsxs(Popup, { children: [
|
|
19411
|
-
/* @__PURE__ */ jsx(Typography, { variant: "body2", children: marker.label }),
|
|
19412
|
-
marker.category ? /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: marker.category }) : null
|
|
19413
|
-
] }) : null
|
|
19414
|
-
},
|
|
19415
|
-
marker.id
|
|
19416
|
-
))
|
|
19417
|
-
]
|
|
19418
|
-
},
|
|
19419
|
-
`map-${centerLat}-${centerLng}-${zoom}`
|
|
19420
|
-
)
|
|
19461
|
+
className: cn("relative w-full overflow-hidden rounded-lg bg-muted/20", props.className),
|
|
19462
|
+
style: { height: props.height ?? "400px" },
|
|
19463
|
+
"data-testid": "map-view"
|
|
19464
|
+
}
|
|
19465
|
+
),
|
|
19466
|
+
children: /* @__PURE__ */ jsx(MapViewImpl, { ...props })
|
|
19421
19467
|
}
|
|
19422
19468
|
);
|
|
19423
19469
|
}
|