@almadar/ui 2.48.6 → 2.48.9

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.
@@ -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
- init_useEventBus();
19357
- var defaultIcon = L__default.default.icon({
19358
- iconUrl: "https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png",
19359
- iconRetinaUrl: "https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon-2x.png",
19360
- shadowUrl: "https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png",
19361
- iconSize: [25, 41],
19362
- iconAnchor: [12, 41],
19363
- popupAnchor: [1, -34],
19364
- shadowSize: [41, 41]
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 ? '&copy; <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
- L__default.default.Marker.prototype.options.icon = defaultIcon;
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
- Box,
19502
+ React125.Suspense,
19426
19503
  {
19427
- className: cn("relative w-full overflow-hidden rounded-lg", className),
19428
- style: { height },
19429
- "data-testid": "map-view",
19430
- children: /* @__PURE__ */ jsxRuntime.jsxs(
19431
- reactLeaflet.MapContainer,
19504
+ fallback: /* @__PURE__ */ jsxRuntime.jsx(
19505
+ Box,
19432
19506
  {
19433
- center: [centerLat, centerLng],
19434
- zoom,
19435
- style: { height: "100%", width: "100%" },
19436
- attributionControl: showAttribution,
19437
- children: [
19438
- /* @__PURE__ */ jsxRuntime.jsx(
19439
- reactLeaflet.TileLayer,
19440
- {
19441
- url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
19442
- attribution: showAttribution ? '&copy; <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
  }
@@ -47057,8 +47102,6 @@ function ServerBridgeProvider({
47057
47102
  }, [schema, registerSchema, unregisterSchema]);
47058
47103
  return /* @__PURE__ */ jsxRuntime.jsx(ServerBridgeContext.Provider, { value: { connected, sendEvent }, children });
47059
47104
  }
47060
-
47061
- // runtime/prepareSchemaForPreview.ts
47062
47105
  function generateEntityRow(entity, idx) {
47063
47106
  const row = { id: String(idx) };
47064
47107
  for (const f3 of entity.fields) {
@@ -47087,6 +47130,7 @@ function buildMockData(schema) {
47087
47130
  for (const orbital of schema.orbitals) {
47088
47131
  const entity = orbital.entity;
47089
47132
  if (!entity || typeof entity === "string") continue;
47133
+ if (core.isEntityCall(entity)) continue;
47090
47134
  const entityName = entity.name;
47091
47135
  if (!entityName) continue;
47092
47136
  if (entity.instances && entity.instances.length > 0) {