@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.
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, lazy, useContext, Suspense, useSyncExternalStore, useId, forwardRef, useImperativeHandle, useReducer, Component } from 'react';
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';
@@ -44,7 +41,7 @@ import langDiff from 'react-syntax-highlighter/dist/esm/languages/prism/diff';
44
41
  import langToml from 'react-syntax-highlighter/dist/esm/languages/prism/toml';
45
42
  import langGo from 'react-syntax-highlighter/dist/esm/languages/prism/go';
46
43
  import langGraphql from 'react-syntax-highlighter/dist/esm/languages/prism/graphql';
47
- import { FieldTypeSchema, schemaToIR, getPage, isCircuitEvent } from '@almadar/core';
44
+ import { FieldTypeSchema, isEntityCall, schemaToIR, getPage, isCircuitEvent } from '@almadar/core';
48
45
  import '@tanstack/react-query';
49
46
  import { StateMachineManager, createContextFromBindings, interpolateValue, EffectExecutor } from '@almadar/runtime';
50
47
 
@@ -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
- init_useEventBus();
19310
- var defaultIcon = L.icon({
19311
- iconUrl: "https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png",
19312
- iconRetinaUrl: "https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon-2x.png",
19313
- shadowUrl: "https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png",
19314
- iconSize: [25, 41],
19315
- iconAnchor: [12, 41],
19316
- popupAnchor: [1, -34],
19317
- shadowSize: [41, 41]
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 ? '&copy; <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
- L.Marker.prototype.options.icon = defaultIcon;
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
- Box,
19456
+ Suspense,
19379
19457
  {
19380
- className: cn("relative w-full overflow-hidden rounded-lg", className),
19381
- style: { height },
19382
- "data-testid": "map-view",
19383
- children: /* @__PURE__ */ jsxs(
19384
- MapContainer,
19458
+ fallback: /* @__PURE__ */ jsx(
19459
+ Box,
19385
19460
  {
19386
- center: [centerLat, centerLng],
19387
- zoom,
19388
- style: { height: "100%", width: "100%" },
19389
- attributionControl: showAttribution,
19390
- children: [
19391
- /* @__PURE__ */ jsx(
19392
- TileLayer,
19393
- {
19394
- url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
19395
- attribution: showAttribution ? '&copy; <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
  }
@@ -47010,8 +47056,6 @@ function ServerBridgeProvider({
47010
47056
  }, [schema, registerSchema, unregisterSchema]);
47011
47057
  return /* @__PURE__ */ jsx(ServerBridgeContext.Provider, { value: { connected, sendEvent }, children });
47012
47058
  }
47013
-
47014
- // runtime/prepareSchemaForPreview.ts
47015
47059
  function generateEntityRow(entity, idx) {
47016
47060
  const row = { id: String(idx) };
47017
47061
  for (const f3 of entity.fields) {
@@ -47040,6 +47084,7 @@ function buildMockData(schema) {
47040
47084
  for (const orbital of schema.orbitals) {
47041
47085
  const entity = orbital.entity;
47042
47086
  if (!entity || typeof entity === "string") continue;
47087
+ if (isEntityCall(entity)) continue;
47043
47088
  const entityName = entity.name;
47044
47089
  if (!entityName) continue;
47045
47090
  if (entity.instances && entity.instances.length > 0) {