@almadar/ui 5.14.1 → 5.16.1

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.
@@ -10247,13 +10247,13 @@ var init_MapView = __esm({
10247
10247
  shadowSize: [41, 41]
10248
10248
  });
10249
10249
  L.Marker.prototype.options.icon = defaultIcon;
10250
- const { useEffect: useEffect69, useRef: useRef65, useCallback: useCallback114, useState: useState100 } = React86__namespace.default;
10250
+ const { useEffect: useEffect70, useRef: useRef66, useCallback: useCallback114, useState: useState100 } = React86__namespace.default;
10251
10251
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
10252
10252
  const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
10253
10253
  function MapUpdater({ centerLat, centerLng, zoom }) {
10254
10254
  const map = useMap();
10255
- const prevRef = useRef65({ centerLat, centerLng, zoom });
10256
- useEffect69(() => {
10255
+ const prevRef = useRef66({ centerLat, centerLng, zoom });
10256
+ useEffect70(() => {
10257
10257
  const prev = prevRef.current;
10258
10258
  if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
10259
10259
  map.setView([centerLat, centerLng], zoom);
@@ -10264,7 +10264,7 @@ var init_MapView = __esm({
10264
10264
  }
10265
10265
  function MapClickHandler({ onMapClick }) {
10266
10266
  const map = useMap();
10267
- useEffect69(() => {
10267
+ useEffect70(() => {
10268
10268
  if (!onMapClick) return;
10269
10269
  const handler = (e) => {
10270
10270
  onMapClick(e.latlng.lat, e.latlng.lng);
@@ -22566,6 +22566,21 @@ var init_DashboardLayout = __esm({
22566
22566
  };
22567
22567
  const [sidebarOpen, setSidebarOpen] = React86.useState(false);
22568
22568
  const [userMenuOpen, setUserMenuOpen] = React86.useState(false);
22569
+ const layoutRef = React86.useRef(null);
22570
+ const [isMobile, setIsMobile] = React86.useState(false);
22571
+ React86.useEffect(() => {
22572
+ const el = layoutRef.current;
22573
+ if (!el || typeof ResizeObserver === "undefined") return;
22574
+ const ro = new ResizeObserver((entries) => {
22575
+ const w = entries[0]?.contentRect.width ?? el.clientWidth;
22576
+ setIsMobile(w < 1024);
22577
+ });
22578
+ ro.observe(el);
22579
+ return () => ro.disconnect();
22580
+ }, []);
22581
+ React86.useEffect(() => {
22582
+ if (!isMobile && sidebarOpen) setSidebarOpen(false);
22583
+ }, [isMobile, sidebarOpen]);
22569
22584
  const location = reactRouterDom.useLocation();
22570
22585
  const ctxPagePath = useCurrentPagePath();
22571
22586
  const activePath = currentPath ?? ctxPagePath ?? location.pathname;
@@ -22578,15 +22593,15 @@ var init_DashboardLayout = __esm({
22578
22593
  const showBottomNav = layoutMode === "bottomnav";
22579
22594
  const isTopNav = layoutMode === "topnav";
22580
22595
  return /* @__PURE__ */ jsxRuntime.jsxs(
22581
- HStack,
22596
+ Box,
22582
22597
  {
22583
- gap: "none",
22584
- className: "@container/dashboard min-h-screen w-full bg-background dark:bg-background items-stretch",
22598
+ ref: layoutRef,
22599
+ className: "@container/dashboard min-h-screen w-full bg-background dark:bg-background flex flex-row items-stretch",
22585
22600
  children: [
22586
- showSidebar && sidebarOpen && /* @__PURE__ */ jsxRuntime.jsx(
22601
+ showSidebar && isMobile && sidebarOpen && /* @__PURE__ */ jsxRuntime.jsx(
22587
22602
  Box,
22588
22603
  {
22589
- className: "fixed inset-0 bg-foreground/50 dark:bg-foreground/70 z-20 @lg/dashboard:hidden",
22604
+ className: "fixed inset-0 bg-foreground/50 dark:bg-foreground/70 z-20",
22590
22605
  onClick: () => setSidebarOpen(false)
22591
22606
  }
22592
22607
  ),
@@ -22596,11 +22611,16 @@ var init_DashboardLayout = __esm({
22596
22611
  as: "aside",
22597
22612
  className: cn(
22598
22613
  "z-30 w-64 flex-shrink-0 bg-card dark:bg-card border-r border-border dark:border-border",
22599
- "fixed inset-y-0 left-0 @lg/dashboard:static @lg/dashboard:translate-x-0 @lg/dashboard:h-auto",
22600
- "transform transition-transform duration-200 ease-in-out",
22601
- "flex flex-col",
22602
- sidebarOpen ? "translate-x-0" : "-translate-x-full"
22614
+ "flex flex-col"
22603
22615
  ),
22616
+ style: isMobile ? {
22617
+ position: "fixed",
22618
+ top: 0,
22619
+ bottom: 0,
22620
+ left: 0,
22621
+ transform: sidebarOpen ? "translateX(0)" : "translateX(-100%)",
22622
+ transition: "transform 200ms ease-in-out"
22623
+ } : { position: "static", transform: "none" },
22604
22624
  children: [
22605
22625
  /* @__PURE__ */ jsxRuntime.jsxs(
22606
22626
  HStack,
@@ -22629,11 +22649,11 @@ var init_DashboardLayout = __esm({
22629
22649
  }
22630
22650
  )
22631
22651
  ] }),
22632
- /* @__PURE__ */ jsxRuntime.jsx(
22652
+ isMobile && /* @__PURE__ */ jsxRuntime.jsx(
22633
22653
  Button,
22634
22654
  {
22635
22655
  variant: "ghost",
22636
- className: "@lg/dashboard:hidden p-2 rounded-md hover:bg-muted dark:hover:bg-muted text-muted-foreground dark:text-muted-foreground",
22656
+ className: "p-2 rounded-md hover:bg-muted dark:hover:bg-muted text-muted-foreground dark:text-muted-foreground",
22637
22657
  onClick: () => setSidebarOpen(false),
22638
22658
  children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "x", className: "h-5 w-5" })
22639
22659
  }
@@ -22674,11 +22694,11 @@ var init_DashboardLayout = __esm({
22674
22694
  justify: "between",
22675
22695
  className: "h-full px-3 @sm/dashboard:px-4 gap-2 @sm/dashboard:gap-4",
22676
22696
  children: [
22677
- showSidebar && /* @__PURE__ */ jsxRuntime.jsx(
22697
+ showSidebar && isMobile && /* @__PURE__ */ jsxRuntime.jsx(
22678
22698
  Button,
22679
22699
  {
22680
22700
  variant: "ghost",
22681
- className: "@lg/dashboard:hidden p-2 rounded-md hover:bg-muted dark:hover:bg-muted text-muted-foreground dark:text-muted-foreground touch-manipulation min-h-[44px] min-w-[44px] flex items-center justify-center",
22701
+ className: "p-2 rounded-md hover:bg-muted dark:hover:bg-muted text-muted-foreground dark:text-muted-foreground touch-manipulation min-h-[44px] min-w-[44px] flex items-center justify-center",
22682
22702
  onClick: () => setSidebarOpen(true),
22683
22703
  "aria-label": "Open sidebar",
22684
22704
  children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "menu", className: "h-5 w-5" })
@@ -47666,7 +47686,7 @@ function getToastPosition(position) {
47666
47686
  return "top-4 right-4";
47667
47687
  }
47668
47688
  }
47669
- function renderPatternChildren(children, onDismiss, parentId = "root", parentPath = "root", sourceTrait) {
47689
+ function renderPatternChildren(children, onDismiss, parentId = "root", parentPath = "root", sourceTrait, orbCtx) {
47670
47690
  if (children === void 0 || children === null) return null;
47671
47691
  const childrenArray = Array.isArray(children) ? children : typeof children === "string" || typeof children === "object" && "type" in children ? [children] : [];
47672
47692
  if (childrenArray.length === 0) return null;
@@ -47697,8 +47717,11 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
47697
47717
  nodeId: child._id,
47698
47718
  // Inherit sourceTrait from the parent slot so nested patterns
47699
47719
  // (e.g. form-section inside a stack) can resolve entityDef via
47700
- // the trait's linkedEntity for form-field enrichment.
47701
- ...sourceTrait !== void 0 && { sourceTrait }
47720
+ // the trait's linkedEntity for form-field enrichment. The orbCtx
47721
+ // (slot/transition/state/entity) propagates the same way so every
47722
+ // nested node carries a complete contextual-edit address.
47723
+ ...sourceTrait !== void 0 && { sourceTrait },
47724
+ ...orbCtx ?? {}
47702
47725
  };
47703
47726
  return /* @__PURE__ */ jsxRuntime.jsx(
47704
47727
  SlotContentRenderer,
@@ -47814,7 +47837,12 @@ function SlotContentRenderer({
47814
47837
  const isSingleChild = typeof childrenConfig === "string" || typeof childrenConfig === "object" && childrenConfig !== null && !Array.isArray(childrenConfig) && "type" in childrenConfig;
47815
47838
  const hasChildren = PATTERNS_WITH_CHILDREN.has(content.pattern) || Array.isArray(childrenConfig) && childrenConfig.length > 0 || isSingleChild;
47816
47839
  const myPath = patternPath ?? "root";
47817
- const renderedChildren = hasChildren ? renderPatternChildren(childrenConfig, onDismiss, content.id, myPath, content.sourceTrait) : void 0;
47840
+ const renderedChildren = hasChildren ? renderPatternChildren(childrenConfig, onDismiss, content.id, myPath, content.sourceTrait, {
47841
+ slot: content.slot,
47842
+ transitionEvent: content.transitionEvent,
47843
+ fromState: content.fromState,
47844
+ entity: content.entity
47845
+ }) : void 0;
47818
47846
  const incomingChildren = content.props.children;
47819
47847
  const childrenIsRenderFn = typeof incomingChildren === "function";
47820
47848
  const { children: _childrenConfig, ...restPropsNoChildren } = content.props;
@@ -47861,6 +47889,13 @@ function SlotContentRenderer({
47861
47889
  "data-pattern-path": myPath,
47862
47890
  "data-pattern-type": content.pattern,
47863
47891
  "data-accepts-children": acceptsChildren ? "true" : void 0,
47892
+ "data-orb-trait": content.sourceTrait,
47893
+ "data-orb-slot": content.slot,
47894
+ "data-orb-transition": content.transitionEvent,
47895
+ "data-orb-state": content.fromState,
47896
+ "data-orb-entity": content.entity,
47897
+ "data-orb-path": myPath,
47898
+ "data-orb-pattern": content.pattern,
47864
47899
  children: renderedChildren !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(PatternComponent, { ...finalProps, children: renderedChildren }) : /* @__PURE__ */ jsxRuntime.jsx(PatternComponent, { ...finalProps })
47865
47900
  }
47866
47901
  );
@@ -47873,6 +47908,13 @@ function SlotContentRenderer({
47873
47908
  "data-id": content.id,
47874
47909
  "data-node-id": content.nodeId,
47875
47910
  "data-source-trait": content.sourceTrait,
47911
+ "data-orb-trait": content.sourceTrait,
47912
+ "data-orb-slot": content.slot,
47913
+ "data-orb-transition": content.transitionEvent,
47914
+ "data-orb-state": content.fromState,
47915
+ "data-orb-entity": content.entity,
47916
+ "data-orb-path": patternPath ?? "root",
47917
+ "data-orb-pattern": content.pattern,
47876
47918
  children: content.props.children ?? /* @__PURE__ */ jsxRuntime.jsxs(Box, { className: "p-4 text-sm text-muted-foreground border border-dashed border-border rounded", children: [
47877
47919
  "Unknown pattern: ",
47878
47920
  content.pattern,
@@ -10198,13 +10198,13 @@ var init_MapView = __esm({
10198
10198
  shadowSize: [41, 41]
10199
10199
  });
10200
10200
  L.Marker.prototype.options.icon = defaultIcon;
10201
- const { useEffect: useEffect69, useRef: useRef65, useCallback: useCallback114, useState: useState100 } = React86__default;
10201
+ const { useEffect: useEffect70, useRef: useRef66, useCallback: useCallback114, useState: useState100 } = React86__default;
10202
10202
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
10203
10203
  const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
10204
10204
  function MapUpdater({ centerLat, centerLng, zoom }) {
10205
10205
  const map = useMap();
10206
- const prevRef = useRef65({ centerLat, centerLng, zoom });
10207
- useEffect69(() => {
10206
+ const prevRef = useRef66({ centerLat, centerLng, zoom });
10207
+ useEffect70(() => {
10208
10208
  const prev = prevRef.current;
10209
10209
  if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
10210
10210
  map.setView([centerLat, centerLng], zoom);
@@ -10215,7 +10215,7 @@ var init_MapView = __esm({
10215
10215
  }
10216
10216
  function MapClickHandler({ onMapClick }) {
10217
10217
  const map = useMap();
10218
- useEffect69(() => {
10218
+ useEffect70(() => {
10219
10219
  if (!onMapClick) return;
10220
10220
  const handler = (e) => {
10221
10221
  onMapClick(e.latlng.lat, e.latlng.lng);
@@ -22517,6 +22517,21 @@ var init_DashboardLayout = __esm({
22517
22517
  };
22518
22518
  const [sidebarOpen, setSidebarOpen] = useState(false);
22519
22519
  const [userMenuOpen, setUserMenuOpen] = useState(false);
22520
+ const layoutRef = useRef(null);
22521
+ const [isMobile, setIsMobile] = useState(false);
22522
+ useEffect(() => {
22523
+ const el = layoutRef.current;
22524
+ if (!el || typeof ResizeObserver === "undefined") return;
22525
+ const ro = new ResizeObserver((entries) => {
22526
+ const w = entries[0]?.contentRect.width ?? el.clientWidth;
22527
+ setIsMobile(w < 1024);
22528
+ });
22529
+ ro.observe(el);
22530
+ return () => ro.disconnect();
22531
+ }, []);
22532
+ useEffect(() => {
22533
+ if (!isMobile && sidebarOpen) setSidebarOpen(false);
22534
+ }, [isMobile, sidebarOpen]);
22520
22535
  const location = useLocation();
22521
22536
  const ctxPagePath = useCurrentPagePath();
22522
22537
  const activePath = currentPath ?? ctxPagePath ?? location.pathname;
@@ -22529,15 +22544,15 @@ var init_DashboardLayout = __esm({
22529
22544
  const showBottomNav = layoutMode === "bottomnav";
22530
22545
  const isTopNav = layoutMode === "topnav";
22531
22546
  return /* @__PURE__ */ jsxs(
22532
- HStack,
22547
+ Box,
22533
22548
  {
22534
- gap: "none",
22535
- className: "@container/dashboard min-h-screen w-full bg-background dark:bg-background items-stretch",
22549
+ ref: layoutRef,
22550
+ className: "@container/dashboard min-h-screen w-full bg-background dark:bg-background flex flex-row items-stretch",
22536
22551
  children: [
22537
- showSidebar && sidebarOpen && /* @__PURE__ */ jsx(
22552
+ showSidebar && isMobile && sidebarOpen && /* @__PURE__ */ jsx(
22538
22553
  Box,
22539
22554
  {
22540
- className: "fixed inset-0 bg-foreground/50 dark:bg-foreground/70 z-20 @lg/dashboard:hidden",
22555
+ className: "fixed inset-0 bg-foreground/50 dark:bg-foreground/70 z-20",
22541
22556
  onClick: () => setSidebarOpen(false)
22542
22557
  }
22543
22558
  ),
@@ -22547,11 +22562,16 @@ var init_DashboardLayout = __esm({
22547
22562
  as: "aside",
22548
22563
  className: cn(
22549
22564
  "z-30 w-64 flex-shrink-0 bg-card dark:bg-card border-r border-border dark:border-border",
22550
- "fixed inset-y-0 left-0 @lg/dashboard:static @lg/dashboard:translate-x-0 @lg/dashboard:h-auto",
22551
- "transform transition-transform duration-200 ease-in-out",
22552
- "flex flex-col",
22553
- sidebarOpen ? "translate-x-0" : "-translate-x-full"
22565
+ "flex flex-col"
22554
22566
  ),
22567
+ style: isMobile ? {
22568
+ position: "fixed",
22569
+ top: 0,
22570
+ bottom: 0,
22571
+ left: 0,
22572
+ transform: sidebarOpen ? "translateX(0)" : "translateX(-100%)",
22573
+ transition: "transform 200ms ease-in-out"
22574
+ } : { position: "static", transform: "none" },
22555
22575
  children: [
22556
22576
  /* @__PURE__ */ jsxs(
22557
22577
  HStack,
@@ -22580,11 +22600,11 @@ var init_DashboardLayout = __esm({
22580
22600
  }
22581
22601
  )
22582
22602
  ] }),
22583
- /* @__PURE__ */ jsx(
22603
+ isMobile && /* @__PURE__ */ jsx(
22584
22604
  Button,
22585
22605
  {
22586
22606
  variant: "ghost",
22587
- className: "@lg/dashboard:hidden p-2 rounded-md hover:bg-muted dark:hover:bg-muted text-muted-foreground dark:text-muted-foreground",
22607
+ className: "p-2 rounded-md hover:bg-muted dark:hover:bg-muted text-muted-foreground dark:text-muted-foreground",
22588
22608
  onClick: () => setSidebarOpen(false),
22589
22609
  children: /* @__PURE__ */ jsx(Icon, { name: "x", className: "h-5 w-5" })
22590
22610
  }
@@ -22625,11 +22645,11 @@ var init_DashboardLayout = __esm({
22625
22645
  justify: "between",
22626
22646
  className: "h-full px-3 @sm/dashboard:px-4 gap-2 @sm/dashboard:gap-4",
22627
22647
  children: [
22628
- showSidebar && /* @__PURE__ */ jsx(
22648
+ showSidebar && isMobile && /* @__PURE__ */ jsx(
22629
22649
  Button,
22630
22650
  {
22631
22651
  variant: "ghost",
22632
- className: "@lg/dashboard:hidden p-2 rounded-md hover:bg-muted dark:hover:bg-muted text-muted-foreground dark:text-muted-foreground touch-manipulation min-h-[44px] min-w-[44px] flex items-center justify-center",
22652
+ className: "p-2 rounded-md hover:bg-muted dark:hover:bg-muted text-muted-foreground dark:text-muted-foreground touch-manipulation min-h-[44px] min-w-[44px] flex items-center justify-center",
22633
22653
  onClick: () => setSidebarOpen(true),
22634
22654
  "aria-label": "Open sidebar",
22635
22655
  children: /* @__PURE__ */ jsx(Icon, { name: "menu", className: "h-5 w-5" })
@@ -47617,7 +47637,7 @@ function getToastPosition(position) {
47617
47637
  return "top-4 right-4";
47618
47638
  }
47619
47639
  }
47620
- function renderPatternChildren(children, onDismiss, parentId = "root", parentPath = "root", sourceTrait) {
47640
+ function renderPatternChildren(children, onDismiss, parentId = "root", parentPath = "root", sourceTrait, orbCtx) {
47621
47641
  if (children === void 0 || children === null) return null;
47622
47642
  const childrenArray = Array.isArray(children) ? children : typeof children === "string" || typeof children === "object" && "type" in children ? [children] : [];
47623
47643
  if (childrenArray.length === 0) return null;
@@ -47648,8 +47668,11 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
47648
47668
  nodeId: child._id,
47649
47669
  // Inherit sourceTrait from the parent slot so nested patterns
47650
47670
  // (e.g. form-section inside a stack) can resolve entityDef via
47651
- // the trait's linkedEntity for form-field enrichment.
47652
- ...sourceTrait !== void 0 && { sourceTrait }
47671
+ // the trait's linkedEntity for form-field enrichment. The orbCtx
47672
+ // (slot/transition/state/entity) propagates the same way so every
47673
+ // nested node carries a complete contextual-edit address.
47674
+ ...sourceTrait !== void 0 && { sourceTrait },
47675
+ ...orbCtx ?? {}
47653
47676
  };
47654
47677
  return /* @__PURE__ */ jsx(
47655
47678
  SlotContentRenderer,
@@ -47765,7 +47788,12 @@ function SlotContentRenderer({
47765
47788
  const isSingleChild = typeof childrenConfig === "string" || typeof childrenConfig === "object" && childrenConfig !== null && !Array.isArray(childrenConfig) && "type" in childrenConfig;
47766
47789
  const hasChildren = PATTERNS_WITH_CHILDREN.has(content.pattern) || Array.isArray(childrenConfig) && childrenConfig.length > 0 || isSingleChild;
47767
47790
  const myPath = patternPath ?? "root";
47768
- const renderedChildren = hasChildren ? renderPatternChildren(childrenConfig, onDismiss, content.id, myPath, content.sourceTrait) : void 0;
47791
+ const renderedChildren = hasChildren ? renderPatternChildren(childrenConfig, onDismiss, content.id, myPath, content.sourceTrait, {
47792
+ slot: content.slot,
47793
+ transitionEvent: content.transitionEvent,
47794
+ fromState: content.fromState,
47795
+ entity: content.entity
47796
+ }) : void 0;
47769
47797
  const incomingChildren = content.props.children;
47770
47798
  const childrenIsRenderFn = typeof incomingChildren === "function";
47771
47799
  const { children: _childrenConfig, ...restPropsNoChildren } = content.props;
@@ -47812,6 +47840,13 @@ function SlotContentRenderer({
47812
47840
  "data-pattern-path": myPath,
47813
47841
  "data-pattern-type": content.pattern,
47814
47842
  "data-accepts-children": acceptsChildren ? "true" : void 0,
47843
+ "data-orb-trait": content.sourceTrait,
47844
+ "data-orb-slot": content.slot,
47845
+ "data-orb-transition": content.transitionEvent,
47846
+ "data-orb-state": content.fromState,
47847
+ "data-orb-entity": content.entity,
47848
+ "data-orb-path": myPath,
47849
+ "data-orb-pattern": content.pattern,
47815
47850
  children: renderedChildren !== void 0 ? /* @__PURE__ */ jsx(PatternComponent, { ...finalProps, children: renderedChildren }) : /* @__PURE__ */ jsx(PatternComponent, { ...finalProps })
47816
47851
  }
47817
47852
  );
@@ -47824,6 +47859,13 @@ function SlotContentRenderer({
47824
47859
  "data-id": content.id,
47825
47860
  "data-node-id": content.nodeId,
47826
47861
  "data-source-trait": content.sourceTrait,
47862
+ "data-orb-trait": content.sourceTrait,
47863
+ "data-orb-slot": content.slot,
47864
+ "data-orb-transition": content.transitionEvent,
47865
+ "data-orb-state": content.fromState,
47866
+ "data-orb-entity": content.entity,
47867
+ "data-orb-path": patternPath ?? "root",
47868
+ "data-orb-pattern": content.pattern,
47827
47869
  children: content.props.children ?? /* @__PURE__ */ jsxs(Box, { className: "p-4 text-sm text-muted-foreground border border-dashed border-border rounded", children: [
47828
47870
  "Unknown pattern: ",
47829
47871
  content.pattern,
@@ -10135,13 +10135,13 @@ var init_MapView = __esm({
10135
10135
  shadowSize: [41, 41]
10136
10136
  });
10137
10137
  L.Marker.prototype.options.icon = defaultIcon;
10138
- const { useEffect: useEffect70, useRef: useRef65, useCallback: useCallback114, useState: useState103 } = React85__namespace.default;
10138
+ const { useEffect: useEffect71, useRef: useRef66, useCallback: useCallback114, useState: useState103 } = React85__namespace.default;
10139
10139
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
10140
10140
  const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
10141
10141
  function MapUpdater({ centerLat, centerLng, zoom }) {
10142
10142
  const map = useMap();
10143
- const prevRef = useRef65({ centerLat, centerLng, zoom });
10144
- useEffect70(() => {
10143
+ const prevRef = useRef66({ centerLat, centerLng, zoom });
10144
+ useEffect71(() => {
10145
10145
  const prev = prevRef.current;
10146
10146
  if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
10147
10147
  map.setView([centerLat, centerLng], zoom);
@@ -10152,7 +10152,7 @@ var init_MapView = __esm({
10152
10152
  }
10153
10153
  function MapClickHandler({ onMapClick }) {
10154
10154
  const map = useMap();
10155
- useEffect70(() => {
10155
+ useEffect71(() => {
10156
10156
  if (!onMapClick) return;
10157
10157
  const handler = (e) => {
10158
10158
  onMapClick(e.latlng.lat, e.latlng.lng);
@@ -22335,6 +22335,21 @@ var init_DashboardLayout = __esm({
22335
22335
  };
22336
22336
  const [sidebarOpen, setSidebarOpen] = React85.useState(false);
22337
22337
  const [userMenuOpen, setUserMenuOpen] = React85.useState(false);
22338
+ const layoutRef = React85.useRef(null);
22339
+ const [isMobile, setIsMobile] = React85.useState(false);
22340
+ React85.useEffect(() => {
22341
+ const el = layoutRef.current;
22342
+ if (!el || typeof ResizeObserver === "undefined") return;
22343
+ const ro = new ResizeObserver((entries) => {
22344
+ const w = entries[0]?.contentRect.width ?? el.clientWidth;
22345
+ setIsMobile(w < 1024);
22346
+ });
22347
+ ro.observe(el);
22348
+ return () => ro.disconnect();
22349
+ }, []);
22350
+ React85.useEffect(() => {
22351
+ if (!isMobile && sidebarOpen) setSidebarOpen(false);
22352
+ }, [isMobile, sidebarOpen]);
22338
22353
  const location = reactRouterDom.useLocation();
22339
22354
  const ctxPagePath = useCurrentPagePath();
22340
22355
  const activePath = currentPath ?? ctxPagePath ?? location.pathname;
@@ -22347,15 +22362,15 @@ var init_DashboardLayout = __esm({
22347
22362
  const showBottomNav = layoutMode === "bottomnav";
22348
22363
  const isTopNav = layoutMode === "topnav";
22349
22364
  return /* @__PURE__ */ jsxRuntime.jsxs(
22350
- HStack,
22365
+ Box,
22351
22366
  {
22352
- gap: "none",
22353
- className: "@container/dashboard min-h-screen w-full bg-background dark:bg-background items-stretch",
22367
+ ref: layoutRef,
22368
+ className: "@container/dashboard min-h-screen w-full bg-background dark:bg-background flex flex-row items-stretch",
22354
22369
  children: [
22355
- showSidebar && sidebarOpen && /* @__PURE__ */ jsxRuntime.jsx(
22370
+ showSidebar && isMobile && sidebarOpen && /* @__PURE__ */ jsxRuntime.jsx(
22356
22371
  Box,
22357
22372
  {
22358
- className: "fixed inset-0 bg-foreground/50 dark:bg-foreground/70 z-20 @lg/dashboard:hidden",
22373
+ className: "fixed inset-0 bg-foreground/50 dark:bg-foreground/70 z-20",
22359
22374
  onClick: () => setSidebarOpen(false)
22360
22375
  }
22361
22376
  ),
@@ -22365,11 +22380,16 @@ var init_DashboardLayout = __esm({
22365
22380
  as: "aside",
22366
22381
  className: cn(
22367
22382
  "z-30 w-64 flex-shrink-0 bg-card dark:bg-card border-r border-border dark:border-border",
22368
- "fixed inset-y-0 left-0 @lg/dashboard:static @lg/dashboard:translate-x-0 @lg/dashboard:h-auto",
22369
- "transform transition-transform duration-200 ease-in-out",
22370
- "flex flex-col",
22371
- sidebarOpen ? "translate-x-0" : "-translate-x-full"
22383
+ "flex flex-col"
22372
22384
  ),
22385
+ style: isMobile ? {
22386
+ position: "fixed",
22387
+ top: 0,
22388
+ bottom: 0,
22389
+ left: 0,
22390
+ transform: sidebarOpen ? "translateX(0)" : "translateX(-100%)",
22391
+ transition: "transform 200ms ease-in-out"
22392
+ } : { position: "static", transform: "none" },
22373
22393
  children: [
22374
22394
  /* @__PURE__ */ jsxRuntime.jsxs(
22375
22395
  HStack,
@@ -22398,11 +22418,11 @@ var init_DashboardLayout = __esm({
22398
22418
  }
22399
22419
  )
22400
22420
  ] }),
22401
- /* @__PURE__ */ jsxRuntime.jsx(
22421
+ isMobile && /* @__PURE__ */ jsxRuntime.jsx(
22402
22422
  Button,
22403
22423
  {
22404
22424
  variant: "ghost",
22405
- className: "@lg/dashboard:hidden p-2 rounded-md hover:bg-muted dark:hover:bg-muted text-muted-foreground dark:text-muted-foreground",
22425
+ className: "p-2 rounded-md hover:bg-muted dark:hover:bg-muted text-muted-foreground dark:text-muted-foreground",
22406
22426
  onClick: () => setSidebarOpen(false),
22407
22427
  children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "x", className: "h-5 w-5" })
22408
22428
  }
@@ -22443,11 +22463,11 @@ var init_DashboardLayout = __esm({
22443
22463
  justify: "between",
22444
22464
  className: "h-full px-3 @sm/dashboard:px-4 gap-2 @sm/dashboard:gap-4",
22445
22465
  children: [
22446
- showSidebar && /* @__PURE__ */ jsxRuntime.jsx(
22466
+ showSidebar && isMobile && /* @__PURE__ */ jsxRuntime.jsx(
22447
22467
  Button,
22448
22468
  {
22449
22469
  variant: "ghost",
22450
- className: "@lg/dashboard:hidden p-2 rounded-md hover:bg-muted dark:hover:bg-muted text-muted-foreground dark:text-muted-foreground touch-manipulation min-h-[44px] min-w-[44px] flex items-center justify-center",
22470
+ className: "p-2 rounded-md hover:bg-muted dark:hover:bg-muted text-muted-foreground dark:text-muted-foreground touch-manipulation min-h-[44px] min-w-[44px] flex items-center justify-center",
22451
22471
  onClick: () => setSidebarOpen(true),
22452
22472
  "aria-label": "Open sidebar",
22453
22473
  children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "menu", className: "h-5 w-5" })
@@ -47252,7 +47272,7 @@ function getToastPosition(position) {
47252
47272
  return "top-4 right-4";
47253
47273
  }
47254
47274
  }
47255
- function renderPatternChildren(children, onDismiss, parentId = "root", parentPath = "root", sourceTrait) {
47275
+ function renderPatternChildren(children, onDismiss, parentId = "root", parentPath = "root", sourceTrait, orbCtx) {
47256
47276
  if (children === void 0 || children === null) return null;
47257
47277
  const childrenArray = Array.isArray(children) ? children : typeof children === "string" || typeof children === "object" && "type" in children ? [children] : [];
47258
47278
  if (childrenArray.length === 0) return null;
@@ -47283,8 +47303,11 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
47283
47303
  nodeId: child._id,
47284
47304
  // Inherit sourceTrait from the parent slot so nested patterns
47285
47305
  // (e.g. form-section inside a stack) can resolve entityDef via
47286
- // the trait's linkedEntity for form-field enrichment.
47287
- ...sourceTrait !== void 0 && { sourceTrait }
47306
+ // the trait's linkedEntity for form-field enrichment. The orbCtx
47307
+ // (slot/transition/state/entity) propagates the same way so every
47308
+ // nested node carries a complete contextual-edit address.
47309
+ ...sourceTrait !== void 0 && { sourceTrait },
47310
+ ...orbCtx ?? {}
47288
47311
  };
47289
47312
  return /* @__PURE__ */ jsxRuntime.jsx(
47290
47313
  SlotContentRenderer,
@@ -47400,7 +47423,12 @@ function SlotContentRenderer({
47400
47423
  const isSingleChild = typeof childrenConfig === "string" || typeof childrenConfig === "object" && childrenConfig !== null && !Array.isArray(childrenConfig) && "type" in childrenConfig;
47401
47424
  const hasChildren = PATTERNS_WITH_CHILDREN.has(content.pattern) || Array.isArray(childrenConfig) && childrenConfig.length > 0 || isSingleChild;
47402
47425
  const myPath = patternPath ?? "root";
47403
- const renderedChildren = hasChildren ? renderPatternChildren(childrenConfig, onDismiss, content.id, myPath, content.sourceTrait) : void 0;
47426
+ const renderedChildren = hasChildren ? renderPatternChildren(childrenConfig, onDismiss, content.id, myPath, content.sourceTrait, {
47427
+ slot: content.slot,
47428
+ transitionEvent: content.transitionEvent,
47429
+ fromState: content.fromState,
47430
+ entity: content.entity
47431
+ }) : void 0;
47404
47432
  const incomingChildren = content.props.children;
47405
47433
  const childrenIsRenderFn = typeof incomingChildren === "function";
47406
47434
  const { children: _childrenConfig, ...restPropsNoChildren } = content.props;
@@ -47447,6 +47475,13 @@ function SlotContentRenderer({
47447
47475
  "data-pattern-path": myPath,
47448
47476
  "data-pattern-type": content.pattern,
47449
47477
  "data-accepts-children": acceptsChildren ? "true" : void 0,
47478
+ "data-orb-trait": content.sourceTrait,
47479
+ "data-orb-slot": content.slot,
47480
+ "data-orb-transition": content.transitionEvent,
47481
+ "data-orb-state": content.fromState,
47482
+ "data-orb-entity": content.entity,
47483
+ "data-orb-path": myPath,
47484
+ "data-orb-pattern": content.pattern,
47450
47485
  children: renderedChildren !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(PatternComponent, { ...finalProps, children: renderedChildren }) : /* @__PURE__ */ jsxRuntime.jsx(PatternComponent, { ...finalProps })
47451
47486
  }
47452
47487
  );
@@ -47459,6 +47494,13 @@ function SlotContentRenderer({
47459
47494
  "data-id": content.id,
47460
47495
  "data-node-id": content.nodeId,
47461
47496
  "data-source-trait": content.sourceTrait,
47497
+ "data-orb-trait": content.sourceTrait,
47498
+ "data-orb-slot": content.slot,
47499
+ "data-orb-transition": content.transitionEvent,
47500
+ "data-orb-state": content.fromState,
47501
+ "data-orb-entity": content.entity,
47502
+ "data-orb-path": patternPath ?? "root",
47503
+ "data-orb-pattern": content.pattern,
47462
47504
  children: content.props.children ?? /* @__PURE__ */ jsxRuntime.jsxs(Box, { className: "p-4 text-sm text-muted-foreground border border-dashed border-border rounded", children: [
47463
47505
  "Unknown pattern: ",
47464
47506
  content.pattern,
@@ -47812,7 +47854,7 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
47812
47854
  embeddedTraitsRef.current = options?.embeddedTraits;
47813
47855
  }, [options?.embeddedTraits]);
47814
47856
  const flushSlot = React85.useCallback(
47815
- (traitName, slot, patterns) => {
47857
+ (traitName, slot, patterns, source) => {
47816
47858
  const slots = uiSlotsRef.current;
47817
47859
  const embedded = embeddedTraitsRef.current;
47818
47860
  if (patterns.length === 0) {
@@ -47841,7 +47883,10 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
47841
47883
  pattern: patternType,
47842
47884
  props,
47843
47885
  priority: 0,
47844
- animation: "fade"
47886
+ animation: "fade",
47887
+ transitionEvent: source?.event,
47888
+ fromState: source?.state,
47889
+ entity: source?.entity
47845
47890
  });
47846
47891
  return;
47847
47892
  }
@@ -47855,7 +47900,10 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
47855
47900
  target: slot,
47856
47901
  pattern: patternType,
47857
47902
  props,
47858
- sourceTrait: traitName
47903
+ sourceTrait: traitName,
47904
+ transitionEvent: source?.event,
47905
+ fromState: source?.state,
47906
+ entity: source?.entity
47859
47907
  });
47860
47908
  },
47861
47909
  []
@@ -47988,7 +48036,11 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
47988
48036
  }
47989
48037
  }
47990
48038
  for (const [slot, patterns] of pendingSlots) {
47991
- flushSlot(binding.trait.name, slot, patterns);
48039
+ flushSlot(binding.trait.name, slot, patterns, {
48040
+ event: `tick:${tick.name}`,
48041
+ state: currentState,
48042
+ entity: binding.linkedEntity
48043
+ });
47992
48044
  }
47993
48045
  }, [flushSlot]);
47994
48046
  React85.useEffect(() => {
@@ -48240,7 +48292,11 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
48240
48292
  transition: `${result.previousState}->${result.newState}`,
48241
48293
  cleared: patterns.length === 0
48242
48294
  });
48243
- flushSlot(traitName, slot, patterns);
48295
+ flushSlot(traitName, slot, patterns, {
48296
+ event: eventKey,
48297
+ state: result.previousState,
48298
+ entity: binding.linkedEntity
48299
+ });
48244
48300
  }
48245
48301
  } catch (error) {
48246
48302
  stateLog.error("transition:effect-error", {