@almadar/ui 4.50.13 → 4.50.14

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.
@@ -13697,7 +13697,7 @@ var init_MapView = __esm({
13697
13697
  shadowSize: [41, 41]
13698
13698
  });
13699
13699
  L.Marker.prototype.options.icon = defaultIcon;
13700
- const { useEffect: useEffect87, useRef: useRef87, useCallback: useCallback127, useState: useState121 } = React93__namespace.default;
13700
+ const { useEffect: useEffect87, useRef: useRef87, useCallback: useCallback128, useState: useState122 } = React93__namespace.default;
13701
13701
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
13702
13702
  const { useEventBus: useEventBus3 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
13703
13703
  function MapUpdater({ centerLat, centerLng, zoom }) {
@@ -13742,8 +13742,8 @@ var init_MapView = __esm({
13742
13742
  showAttribution = true
13743
13743
  }) {
13744
13744
  const eventBus = useEventBus3();
13745
- const [clickedPosition, setClickedPosition] = useState121(null);
13746
- const handleMapClick = useCallback127((lat, lng) => {
13745
+ const [clickedPosition, setClickedPosition] = useState122(null);
13746
+ const handleMapClick = useCallback128((lat, lng) => {
13747
13747
  if (showClickedPin) {
13748
13748
  setClickedPosition({ lat, lng });
13749
13749
  }
@@ -13752,7 +13752,7 @@ var init_MapView = __esm({
13752
13752
  eventBus.emit(`UI:${mapClickEvent}`, { latitude: lat, longitude: lng });
13753
13753
  }
13754
13754
  }, [onMapClick, mapClickEvent, eventBus, showClickedPin]);
13755
- const handleMarkerClick = useCallback127((marker) => {
13755
+ const handleMarkerClick = useCallback128((marker) => {
13756
13756
  onMarkerClick?.(marker);
13757
13757
  if (markerClickEvent) {
13758
13758
  eventBus.emit(`UI:${markerClickEvent}`, { ...marker });
@@ -57373,6 +57373,66 @@ function convertFnFormLambdasInProps(props) {
57373
57373
  // hooks/index.ts
57374
57374
  init_useEventBus();
57375
57375
  var ALMADAR_DND_MIME = "application/x-almadar-dnd";
57376
+
57377
+ // hooks/useDropZone.ts
57378
+ init_useEventBus();
57379
+ function parsePayload(e) {
57380
+ try {
57381
+ const raw = e.dataTransfer.getData(ALMADAR_DND_MIME);
57382
+ if (!raw) return null;
57383
+ const parsed = JSON.parse(raw);
57384
+ if (typeof parsed.kind !== "string" || !parsed.data) return null;
57385
+ return parsed;
57386
+ } catch {
57387
+ return null;
57388
+ }
57389
+ }
57390
+ function hasAlmadarPayload(e) {
57391
+ return e.dataTransfer.types.includes(ALMADAR_DND_MIME);
57392
+ }
57393
+ function useDropZone({ accepts, onDrop, disabled = false }) {
57394
+ const [isOver, setIsOver] = React93.useState(false);
57395
+ const eventBus = useEventBus();
57396
+ const handleDragOver = React93.useCallback(
57397
+ (e) => {
57398
+ if (disabled) return;
57399
+ if (!hasAlmadarPayload(e)) return;
57400
+ e.preventDefault();
57401
+ e.dataTransfer.dropEffect = "copy";
57402
+ setIsOver(true);
57403
+ },
57404
+ [disabled]
57405
+ );
57406
+ const handleDragLeave = React93.useCallback(
57407
+ (e) => {
57408
+ setIsOver(false);
57409
+ },
57410
+ []
57411
+ );
57412
+ const handleDrop = React93.useCallback(
57413
+ (e) => {
57414
+ e.preventDefault();
57415
+ setIsOver(false);
57416
+ if (disabled) return;
57417
+ const payload = parsePayload(e);
57418
+ if (!payload) return;
57419
+ if (!accepts.includes(payload.kind)) return;
57420
+ const position = { x: e.clientX, y: e.clientY };
57421
+ onDrop(payload, position);
57422
+ eventBus.emit("UI:DROP", { kind: payload.kind, data: payload.data, ...position });
57423
+ },
57424
+ [disabled, accepts, onDrop, eventBus]
57425
+ );
57426
+ const dropProps = React93.useMemo(
57427
+ () => ({
57428
+ onDragOver: handleDragOver,
57429
+ onDragLeave: handleDragLeave,
57430
+ onDrop: handleDrop
57431
+ }),
57432
+ [handleDragOver, handleDragLeave, handleDrop]
57433
+ );
57434
+ return { dropProps, isOver };
57435
+ }
57376
57436
  var log16 = logger.createLogger("almadar:ui:effects:client-handlers");
57377
57437
  function createClientEffectHandlers(options) {
57378
57438
  const { eventBus, slotSetter, navigate, notify, callService } = options;
@@ -59331,19 +59391,98 @@ var OrbPreviewNodeInner = (props) => {
59331
59391
  const statusBorder = isRunning ? "var(--color-primary)" : isError ? "var(--color-danger)" : isSuccess ? "var(--color-success)" : null;
59332
59392
  const borderWidth = isRunning || isError || isSuccess ? "2px" : "1.5px";
59333
59393
  const borderColor = statusBorder ?? (hovered ? "var(--color-primary)" : colors.border);
59394
+ const handleL1Drop = React93.useCallback(
59395
+ (payload) => {
59396
+ if (payload.kind !== "pattern") return;
59397
+ if (typeof payload.data.type !== "string") return;
59398
+ eventBus.emit("UI:PATTERN_DROP", {
59399
+ patternType: payload.data.type,
59400
+ containerNode: { orbitalName: data.orbitalName }
59401
+ });
59402
+ },
59403
+ [eventBus, data.orbitalName]
59404
+ );
59405
+ const { dropProps: l1DropProps, isOver: l1IsOver } = useDropZone({
59406
+ accepts: ["pattern"],
59407
+ onDrop: handleL1Drop,
59408
+ disabled: isExpanded
59409
+ });
59334
59410
  return /* @__PURE__ */ jsxRuntime.jsxs(
59335
59411
  Box,
59336
59412
  {
59413
+ ...isExpanded ? {} : l1DropProps,
59337
59414
  className: `rounded-lg border shadow-sm bg-card transition-all duration-200 overflow-hidden relative${isRunning ? " orb-preview-running" : ""}`,
59338
59415
  style: {
59339
- borderColor,
59340
- borderWidth,
59341
- width: preset.width
59416
+ borderColor: l1IsOver ? "var(--color-primary)" : borderColor,
59417
+ borderWidth: l1IsOver ? "2px" : borderWidth,
59418
+ width: preset.width,
59419
+ boxShadow: l1IsOver ? "0 0 0 3px var(--color-primary), 0 0 12px var(--color-primary)" : void 0
59342
59420
  },
59343
59421
  onMouseEnter: handleMouseEnter,
59344
59422
  onMouseLeave: handleMouseLeave,
59345
59423
  children: [
59346
59424
  /* @__PURE__ */ jsxRuntime.jsx("style", { children: SELECTION_STYLES }),
59425
+ !isExpanded && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
59426
+ /* @__PURE__ */ jsxRuntime.jsx(
59427
+ Box,
59428
+ {
59429
+ className: "absolute top-1.5 left-1.5 rounded px-1 py-[1px] text-[8px] font-mono uppercase tracking-wider pointer-events-none",
59430
+ style: {
59431
+ backgroundColor: "var(--color-muted)",
59432
+ color: "var(--color-muted-foreground)",
59433
+ zIndex: 3
59434
+ },
59435
+ children: "Preview"
59436
+ }
59437
+ ),
59438
+ hovered && !dragActive && !l1IsOver && /* @__PURE__ */ jsxRuntime.jsx(
59439
+ Box,
59440
+ {
59441
+ className: "absolute inset-0 flex items-center justify-center pointer-events-none",
59442
+ style: {
59443
+ backgroundColor: "rgba(0,0,0,0.04)",
59444
+ zIndex: 2
59445
+ },
59446
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
59447
+ Box,
59448
+ {
59449
+ className: "rounded-md px-2 py-1 text-[11px] font-medium flex items-center gap-1",
59450
+ style: {
59451
+ backgroundColor: "var(--color-card)",
59452
+ color: "var(--color-foreground)",
59453
+ boxShadow: "var(--shadow-main)"
59454
+ },
59455
+ children: [
59456
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 12 }, children: "\u279E" }),
59457
+ "Click to open"
59458
+ ]
59459
+ }
59460
+ )
59461
+ }
59462
+ ),
59463
+ (dragActive || l1IsOver) && /* @__PURE__ */ jsxRuntime.jsx(
59464
+ Box,
59465
+ {
59466
+ className: "absolute inset-0 flex items-center justify-center pointer-events-none",
59467
+ style: {
59468
+ backgroundColor: l1IsOver ? "rgba(20,184,166,0.15)" : "rgba(20,184,166,0.06)",
59469
+ zIndex: 2
59470
+ },
59471
+ children: /* @__PURE__ */ jsxRuntime.jsx(
59472
+ Box,
59473
+ {
59474
+ className: "rounded-md px-2 py-1 text-[11px] font-semibold",
59475
+ style: {
59476
+ backgroundColor: "var(--color-primary)",
59477
+ color: "var(--color-primary-foreground)",
59478
+ boxShadow: "var(--shadow-lg)"
59479
+ },
59480
+ children: "Drop to add and open"
59481
+ }
59482
+ )
59483
+ }
59484
+ )
59485
+ ] }),
59347
59486
  isRunning && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
59348
59487
  /* @__PURE__ */ jsxRuntime.jsx("style", { children: `
59349
59488
  @keyframes orb-preview-running-pulse {
@@ -60525,13 +60664,14 @@ function FlowCanvasInner({
60525
60664
  transition: nodeData.transitionEvent
60526
60665
  });
60527
60666
  } else {
60528
- onNodeClick?.({
60529
- level: "overview",
60530
- orbital: nodeData.orbitalName ?? node.id
60531
- });
60532
- onNodeSelect?.(nodeData.orbitalName ?? node.id);
60667
+ const orbitalName = nodeData.orbitalName ?? node.id;
60668
+ onNodeClick?.({ level: "overview", orbital: orbitalName });
60669
+ onNodeSelect?.(orbitalName);
60670
+ setExpandedOrbital(orbitalName);
60671
+ setLevel("expanded");
60672
+ onLevelChange?.("expanded", orbitalName);
60533
60673
  }
60534
- }, [level, expandedOrbital, onNodeClick]);
60674
+ }, [level, expandedOrbital, onNodeClick, onNodeSelect, onLevelChange]);
60535
60675
  const handleClosePanel = React93.useCallback(() => {
60536
60676
  setSelectedNode(null);
60537
60677
  }, []);
package/dist/avl/index.js CHANGED
@@ -13651,7 +13651,7 @@ var init_MapView = __esm({
13651
13651
  shadowSize: [41, 41]
13652
13652
  });
13653
13653
  L.Marker.prototype.options.icon = defaultIcon;
13654
- const { useEffect: useEffect87, useRef: useRef87, useCallback: useCallback127, useState: useState121 } = React93__default;
13654
+ const { useEffect: useEffect87, useRef: useRef87, useCallback: useCallback128, useState: useState122 } = React93__default;
13655
13655
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
13656
13656
  const { useEventBus: useEventBus3 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
13657
13657
  function MapUpdater({ centerLat, centerLng, zoom }) {
@@ -13696,8 +13696,8 @@ var init_MapView = __esm({
13696
13696
  showAttribution = true
13697
13697
  }) {
13698
13698
  const eventBus = useEventBus3();
13699
- const [clickedPosition, setClickedPosition] = useState121(null);
13700
- const handleMapClick = useCallback127((lat, lng) => {
13699
+ const [clickedPosition, setClickedPosition] = useState122(null);
13700
+ const handleMapClick = useCallback128((lat, lng) => {
13701
13701
  if (showClickedPin) {
13702
13702
  setClickedPosition({ lat, lng });
13703
13703
  }
@@ -13706,7 +13706,7 @@ var init_MapView = __esm({
13706
13706
  eventBus.emit(`UI:${mapClickEvent}`, { latitude: lat, longitude: lng });
13707
13707
  }
13708
13708
  }, [onMapClick, mapClickEvent, eventBus, showClickedPin]);
13709
- const handleMarkerClick = useCallback127((marker) => {
13709
+ const handleMarkerClick = useCallback128((marker) => {
13710
13710
  onMarkerClick?.(marker);
13711
13711
  if (markerClickEvent) {
13712
13712
  eventBus.emit(`UI:${markerClickEvent}`, { ...marker });
@@ -57327,6 +57327,66 @@ function convertFnFormLambdasInProps(props) {
57327
57327
  // hooks/index.ts
57328
57328
  init_useEventBus();
57329
57329
  var ALMADAR_DND_MIME = "application/x-almadar-dnd";
57330
+
57331
+ // hooks/useDropZone.ts
57332
+ init_useEventBus();
57333
+ function parsePayload(e) {
57334
+ try {
57335
+ const raw = e.dataTransfer.getData(ALMADAR_DND_MIME);
57336
+ if (!raw) return null;
57337
+ const parsed = JSON.parse(raw);
57338
+ if (typeof parsed.kind !== "string" || !parsed.data) return null;
57339
+ return parsed;
57340
+ } catch {
57341
+ return null;
57342
+ }
57343
+ }
57344
+ function hasAlmadarPayload(e) {
57345
+ return e.dataTransfer.types.includes(ALMADAR_DND_MIME);
57346
+ }
57347
+ function useDropZone({ accepts, onDrop, disabled = false }) {
57348
+ const [isOver, setIsOver] = useState(false);
57349
+ const eventBus = useEventBus();
57350
+ const handleDragOver = useCallback(
57351
+ (e) => {
57352
+ if (disabled) return;
57353
+ if (!hasAlmadarPayload(e)) return;
57354
+ e.preventDefault();
57355
+ e.dataTransfer.dropEffect = "copy";
57356
+ setIsOver(true);
57357
+ },
57358
+ [disabled]
57359
+ );
57360
+ const handleDragLeave = useCallback(
57361
+ (e) => {
57362
+ setIsOver(false);
57363
+ },
57364
+ []
57365
+ );
57366
+ const handleDrop = useCallback(
57367
+ (e) => {
57368
+ e.preventDefault();
57369
+ setIsOver(false);
57370
+ if (disabled) return;
57371
+ const payload = parsePayload(e);
57372
+ if (!payload) return;
57373
+ if (!accepts.includes(payload.kind)) return;
57374
+ const position = { x: e.clientX, y: e.clientY };
57375
+ onDrop(payload, position);
57376
+ eventBus.emit("UI:DROP", { kind: payload.kind, data: payload.data, ...position });
57377
+ },
57378
+ [disabled, accepts, onDrop, eventBus]
57379
+ );
57380
+ const dropProps = useMemo(
57381
+ () => ({
57382
+ onDragOver: handleDragOver,
57383
+ onDragLeave: handleDragLeave,
57384
+ onDrop: handleDrop
57385
+ }),
57386
+ [handleDragOver, handleDragLeave, handleDrop]
57387
+ );
57388
+ return { dropProps, isOver };
57389
+ }
57330
57390
  var log16 = createLogger("almadar:ui:effects:client-handlers");
57331
57391
  function createClientEffectHandlers(options) {
57332
57392
  const { eventBus, slotSetter, navigate, notify, callService } = options;
@@ -59285,19 +59345,98 @@ var OrbPreviewNodeInner = (props) => {
59285
59345
  const statusBorder = isRunning ? "var(--color-primary)" : isError ? "var(--color-danger)" : isSuccess ? "var(--color-success)" : null;
59286
59346
  const borderWidth = isRunning || isError || isSuccess ? "2px" : "1.5px";
59287
59347
  const borderColor = statusBorder ?? (hovered ? "var(--color-primary)" : colors.border);
59348
+ const handleL1Drop = useCallback(
59349
+ (payload) => {
59350
+ if (payload.kind !== "pattern") return;
59351
+ if (typeof payload.data.type !== "string") return;
59352
+ eventBus.emit("UI:PATTERN_DROP", {
59353
+ patternType: payload.data.type,
59354
+ containerNode: { orbitalName: data.orbitalName }
59355
+ });
59356
+ },
59357
+ [eventBus, data.orbitalName]
59358
+ );
59359
+ const { dropProps: l1DropProps, isOver: l1IsOver } = useDropZone({
59360
+ accepts: ["pattern"],
59361
+ onDrop: handleL1Drop,
59362
+ disabled: isExpanded
59363
+ });
59288
59364
  return /* @__PURE__ */ jsxs(
59289
59365
  Box,
59290
59366
  {
59367
+ ...isExpanded ? {} : l1DropProps,
59291
59368
  className: `rounded-lg border shadow-sm bg-card transition-all duration-200 overflow-hidden relative${isRunning ? " orb-preview-running" : ""}`,
59292
59369
  style: {
59293
- borderColor,
59294
- borderWidth,
59295
- width: preset.width
59370
+ borderColor: l1IsOver ? "var(--color-primary)" : borderColor,
59371
+ borderWidth: l1IsOver ? "2px" : borderWidth,
59372
+ width: preset.width,
59373
+ boxShadow: l1IsOver ? "0 0 0 3px var(--color-primary), 0 0 12px var(--color-primary)" : void 0
59296
59374
  },
59297
59375
  onMouseEnter: handleMouseEnter,
59298
59376
  onMouseLeave: handleMouseLeave,
59299
59377
  children: [
59300
59378
  /* @__PURE__ */ jsx("style", { children: SELECTION_STYLES }),
59379
+ !isExpanded && /* @__PURE__ */ jsxs(Fragment, { children: [
59380
+ /* @__PURE__ */ jsx(
59381
+ Box,
59382
+ {
59383
+ className: "absolute top-1.5 left-1.5 rounded px-1 py-[1px] text-[8px] font-mono uppercase tracking-wider pointer-events-none",
59384
+ style: {
59385
+ backgroundColor: "var(--color-muted)",
59386
+ color: "var(--color-muted-foreground)",
59387
+ zIndex: 3
59388
+ },
59389
+ children: "Preview"
59390
+ }
59391
+ ),
59392
+ hovered && !dragActive && !l1IsOver && /* @__PURE__ */ jsx(
59393
+ Box,
59394
+ {
59395
+ className: "absolute inset-0 flex items-center justify-center pointer-events-none",
59396
+ style: {
59397
+ backgroundColor: "rgba(0,0,0,0.04)",
59398
+ zIndex: 2
59399
+ },
59400
+ children: /* @__PURE__ */ jsxs(
59401
+ Box,
59402
+ {
59403
+ className: "rounded-md px-2 py-1 text-[11px] font-medium flex items-center gap-1",
59404
+ style: {
59405
+ backgroundColor: "var(--color-card)",
59406
+ color: "var(--color-foreground)",
59407
+ boxShadow: "var(--shadow-main)"
59408
+ },
59409
+ children: [
59410
+ /* @__PURE__ */ jsx("span", { style: { fontSize: 12 }, children: "\u279E" }),
59411
+ "Click to open"
59412
+ ]
59413
+ }
59414
+ )
59415
+ }
59416
+ ),
59417
+ (dragActive || l1IsOver) && /* @__PURE__ */ jsx(
59418
+ Box,
59419
+ {
59420
+ className: "absolute inset-0 flex items-center justify-center pointer-events-none",
59421
+ style: {
59422
+ backgroundColor: l1IsOver ? "rgba(20,184,166,0.15)" : "rgba(20,184,166,0.06)",
59423
+ zIndex: 2
59424
+ },
59425
+ children: /* @__PURE__ */ jsx(
59426
+ Box,
59427
+ {
59428
+ className: "rounded-md px-2 py-1 text-[11px] font-semibold",
59429
+ style: {
59430
+ backgroundColor: "var(--color-primary)",
59431
+ color: "var(--color-primary-foreground)",
59432
+ boxShadow: "var(--shadow-lg)"
59433
+ },
59434
+ children: "Drop to add and open"
59435
+ }
59436
+ )
59437
+ }
59438
+ )
59439
+ ] }),
59301
59440
  isRunning && /* @__PURE__ */ jsxs(Fragment, { children: [
59302
59441
  /* @__PURE__ */ jsx("style", { children: `
59303
59442
  @keyframes orb-preview-running-pulse {
@@ -60479,13 +60618,14 @@ function FlowCanvasInner({
60479
60618
  transition: nodeData.transitionEvent
60480
60619
  });
60481
60620
  } else {
60482
- onNodeClick?.({
60483
- level: "overview",
60484
- orbital: nodeData.orbitalName ?? node.id
60485
- });
60486
- onNodeSelect?.(nodeData.orbitalName ?? node.id);
60621
+ const orbitalName = nodeData.orbitalName ?? node.id;
60622
+ onNodeClick?.({ level: "overview", orbital: orbitalName });
60623
+ onNodeSelect?.(orbitalName);
60624
+ setExpandedOrbital(orbitalName);
60625
+ setLevel("expanded");
60626
+ onLevelChange?.("expanded", orbitalName);
60487
60627
  }
60488
- }, [level, expandedOrbital, onNodeClick]);
60628
+ }, [level, expandedOrbital, onNodeClick, onNodeSelect, onLevelChange]);
60489
60629
  const handleClosePanel = useCallback(() => {
60490
60630
  setSelectedNode(null);
60491
60631
  }, []);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/ui",
3
- "version": "4.50.13",
3
+ "version": "4.50.14",
4
4
  "description": "React UI components, hooks, and providers for Almadar",
5
5
  "type": "module",
6
6
  "sideEffects": [