@object-ui/layout 17.7.0 → 18.0.0

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/index.js CHANGED
@@ -3,15 +3,15 @@ import { ComponentRegistry as a } from "@object-ui/core";
3
3
  import { Badge as o, Button as s, Collapsible as c, CollapsibleContent as l, CollapsibleTrigger as u, Input as d, LazyIcon as f, Separator as p, Sidebar as m, SidebarContent as h, SidebarFooter as g, SidebarGroup as _, SidebarGroupContent as v, SidebarGroupLabel as y, SidebarHeader as b, SidebarInput as x, SidebarInset as S, SidebarMenu as C, SidebarMenuAction as w, SidebarMenuButton as T, SidebarMenuItem as E, SidebarMenuSub as D, SidebarMenuSubButton as O, SidebarMenuSubItem as k, SidebarProvider as A, cn as j, getLazyIcon as M, useIsMobile as N } from "@object-ui/components";
4
4
  import { Fragment as P, jsx as F, jsxs as I } from "react/jsx-runtime";
5
5
  import { Link as L, NavLink as R, useLocation as z } from "react-router-dom";
6
- import { ArrowLeft as ee, ChevronRight as te, FileText as B, GripVertical as ne, Layers as re, Pin as ie, PinOff as ae, Search as V, Star as oe } from "lucide-react";
7
- import { menuItemToNavigationItem as H } from "@object-ui/types";
8
- import { resolveI18nLabel as se } from "@objectstack/spec/ui";
9
- import { DndContext as ce, KeyboardSensor as U, PointerSensor as W, closestCenter as le, useSensor as ue, useSensors as de } from "@dnd-kit/core";
10
- import { SortableContext as fe, arrayMove as pe, useSortable as me, verticalListSortingStrategy as he } from "@dnd-kit/sortable";
11
- import { CSS as ge } from "@dnd-kit/utilities";
12
- import { SchemaRenderer as _e, useRecordContext as ve } from "@object-ui/react";
6
+ import { ArrowLeft as B, ChevronRight as ee, FileText as te, Layers as V, Pin as ne, PinOff as re, Search as ie, Star as H } from "lucide-react";
7
+ import { menuItemToNavigationItem as ae } from "@object-ui/types";
8
+ import { resolveI18nLabel as U } from "@objectstack/spec/ui";
9
+ import { DndContext as oe, KeyboardSensor as W, PointerSensor as G, closestCenter as se, useDndContext as K, useSensor as q, useSensors as ce } from "@dnd-kit/core";
10
+ import { SortableContext as le, arrayMove as ue, sortableKeyboardCoordinates as de, useSortable as fe } from "@dnd-kit/sortable";
11
+ import { CSS as pe } from "@dnd-kit/utilities";
12
+ import { SchemaRenderer as me, isElementApiDataSourceShape as he, useRecordContext as ge } from "@object-ui/react";
13
13
  //#region src/PageCard.tsx
14
- function ye({ className: e, children: t, ...n }) {
14
+ function _e({ className: e, children: t, ...n }) {
15
15
  return /* @__PURE__ */ F("div", {
16
16
  className: j("rounded-xl border bg-card text-card-foreground shadow", e),
17
17
  ...n,
@@ -23,7 +23,7 @@ function ye({ className: e, children: t, ...n }) {
23
23
  }
24
24
  //#endregion
25
25
  //#region src/AppShell.tsx
26
- function be(e) {
26
+ function ve(e) {
27
27
  let t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
28
28
  if (!t) return null;
29
29
  let n = parseInt(t[1], 16) / 255, r = parseInt(t[2], 16) / 255, i = parseInt(t[3], 16) / 255, a = Math.max(n, r, i), o = Math.min(n, r, i), s = 0, c = 0, l = (a + o) / 2;
@@ -45,17 +45,17 @@ function be(e) {
45
45
  l: l * 100
46
46
  };
47
47
  }
48
- function xe(e) {
49
- let t = be(e);
48
+ function ye(e) {
49
+ let t = ve(e);
50
50
  return t ? `${Math.round(t.h)} ${Math.round(t.s)}% ${Math.round(t.l)}%` : null;
51
51
  }
52
- function Se(e) {
53
- let t = be(e);
52
+ function be(e) {
53
+ let t = ve(e);
54
54
  if (!t) return null;
55
55
  let n = Math.max(t.l, 65), r = t.s > 80 ? Math.max(t.s - 10, 70) : t.s;
56
56
  return `${Math.round(t.h)} ${Math.round(r)}% ${Math.round(n)}%`;
57
57
  }
58
- function Ce(e) {
58
+ function xe(e) {
59
59
  let t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
60
60
  if (!t) return "0 0% 100%";
61
61
  let n = (e) => {
@@ -64,16 +64,16 @@ function Ce(e) {
64
64
  }, r = n(parseInt(t[1], 16)), i = n(parseInt(t[2], 16)), a = n(parseInt(t[3], 16));
65
65
  return .2126 * r + .7152 * i + .0722 * a > .6 ? "222 47% 11%" : "0 0% 100%";
66
66
  }
67
- function we(e, t) {
67
+ function Se(e, t) {
68
68
  n(() => {
69
69
  let n = document.documentElement, r = () => n.classList.contains("dark"), i = () => {
70
70
  if (e?.primaryColor) {
71
- let t = xe(e.primaryColor), i = Se(e.primaryColor), a = r() && i || t;
72
- a && (n.style.setProperty("--brand-primary", e.primaryColor), n.style.setProperty("--brand-primary-hsl", t || a), n.style.setProperty("--primary", a), n.style.setProperty("--primary-foreground", r() ? "222 47% 11%" : Ce(e.primaryColor)), n.style.setProperty("--ring", a), n.style.setProperty("--sidebar-primary", a), n.style.setProperty("--sidebar-ring", a));
71
+ let t = ye(e.primaryColor), i = be(e.primaryColor), a = r() && i || t;
72
+ a && (n.style.setProperty("--brand-primary", e.primaryColor), n.style.setProperty("--brand-primary-hsl", t || a), n.style.setProperty("--primary", a), n.style.setProperty("--primary-foreground", r() ? "222 47% 11%" : xe(e.primaryColor)), n.style.setProperty("--ring", a), n.style.setProperty("--sidebar-primary", a), n.style.setProperty("--sidebar-ring", a));
73
73
  } else n.style.removeProperty("--brand-primary"), n.style.removeProperty("--brand-primary-hsl"), n.style.removeProperty("--primary"), n.style.removeProperty("--primary-foreground"), n.style.removeProperty("--ring"), n.style.removeProperty("--sidebar-primary"), n.style.removeProperty("--sidebar-ring");
74
74
  if (e?.accentColor) {
75
- let t = xe(e.accentColor), i = Se(e.accentColor), a = r() && i || t;
76
- a && (n.style.setProperty("--brand-accent", e.accentColor), n.style.setProperty("--brand-accent-hsl", t || a), n.style.setProperty("--accent", a), n.style.setProperty("--accent-foreground", r() ? "222 47% 11%" : Ce(e.accentColor)));
75
+ let t = ye(e.accentColor), i = be(e.accentColor), a = r() && i || t;
76
+ a && (n.style.setProperty("--brand-accent", e.accentColor), n.style.setProperty("--brand-accent-hsl", t || a), n.style.setProperty("--accent", a), n.style.setProperty("--accent-foreground", r() ? "222 47% 11%" : xe(e.accentColor)));
77
77
  } else n.style.removeProperty("--brand-accent"), n.style.removeProperty("--brand-accent-hsl"), n.style.removeProperty("--accent"), n.style.removeProperty("--accent-foreground");
78
78
  };
79
79
  i();
@@ -103,12 +103,12 @@ function we(e, t) {
103
103
  t
104
104
  ]);
105
105
  }
106
- function Te({ sidebar: e, navbar: t, children: n, className: r, defaultOpen: i = !0, branding: a, rightRail: o }) {
107
- return we(a, a?.title), /* @__PURE__ */ I(A, {
106
+ function Ce({ sidebar: e, navbar: t, children: n, className: r, defaultOpen: i = !0, branding: a, rightRail: o }) {
107
+ return Se(a, a?.title), /* @__PURE__ */ I(A, {
108
108
  defaultOpen: i,
109
109
  className: "!flex-col h-svh overflow-hidden",
110
110
  children: [/* @__PURE__ */ F("header", {
111
- className: "sticky top-0 z-30 flex h-14 w-full shrink-0 items-center gap-2 border-b bg-background px-2 sm:px-4",
111
+ className: "sticky top-0 z-30 flex h-12 w-full shrink-0 items-center gap-2 border-b bg-background px-2 sm:px-4",
112
112
  children: t
113
113
  }), /* @__PURE__ */ I("div", {
114
114
  className: "flex flex-1 min-h-0 w-full",
@@ -128,15 +128,16 @@ function Te({ sidebar: e, navbar: t, children: n, className: r, defaultOpen: i =
128
128
  }
129
129
  //#endregion
130
130
  //#region src/navOrder.ts
131
- function G(e, t) {
131
+ function we(e, t) {
132
132
  return (e.order ?? 0) - (t.order ?? 0);
133
133
  }
134
134
  //#endregion
135
135
  //#region src/NavigationRenderer.tsx
136
- function K(e) {
137
- return e ? M(e) : B;
136
+ var Te = "group-data-[state=collapsed]:group-data-[collapsible=icon]:pointer-events-none", Ee = "group-data-[state=collapsed]:group-data-[collapsible=icon]:invisible group-data-[state=collapsed]:group-data-[collapsible=icon]:transition-[margin,opacity,visibility]";
137
+ function J(e) {
138
+ return e ? M(e) : te;
138
139
  }
139
- function Ee(e, t) {
140
+ function De(e, t) {
140
141
  if (typeof e == "string") return e;
141
142
  if (t) {
142
143
  let n = t(e.key, {
@@ -147,16 +148,16 @@ function Ee(e, t) {
147
148
  }
148
149
  return e.defaultValue || e.key;
149
150
  }
150
- function q(e, t, n, r) {
151
- return e.type === "separator" ? "" : e.label === void 0 ? ke(e, n) : De(e.label, t, r);
151
+ function Y(e, t, n, r) {
152
+ return e.type === "separator" ? "" : e.label === void 0 ? Ae(e, n) : Oe(e.label, t, r);
152
153
  }
153
- function De(e, t, n) {
154
- return typeof e == "string" ? e : Oe(e) ? Ee(e, t) : se(e, n) ?? "";
154
+ function Oe(e, t, n) {
155
+ return typeof e == "string" ? e : ke(e) ? De(e, t) : U(e, n) ?? "";
155
156
  }
156
- function Oe(e) {
157
+ function ke(e) {
157
158
  return typeof e == "object" && !!e && ("key" in e || "defaultValue" in e);
158
159
  }
159
- function ke(e, t) {
160
+ function Ae(e, t) {
160
161
  let n = (e) => {
161
162
  let n = t?.(e);
162
163
  return typeof n == "string" && n.trim() !== "" ? n : void 0;
@@ -202,51 +203,51 @@ function ke(e, t) {
202
203
  }
203
204
  return e.id;
204
205
  }
205
- var Ae = (e) => e !== !1 && e !== "false", je = () => !0, Me = () => !0;
206
- function J(e, t) {
207
- let { evaluateVisibility: n = Ae, checkPermission: r = je, checkCapability: i = Me, checkDocTarget: a } = t;
208
- if (!n(e.visible) || e.requiredPermissions?.length && !r(e.requiredPermissions)) return !1;
206
+ var je = (e, t) => !(t && he(t.dataSource) || e === !1 || e === "false"), Me = () => !0, Ne = () => !0;
207
+ function Pe(e, t) {
208
+ let { evaluateVisibility: n = je, checkPermission: r = Me, checkCapability: i = Ne, checkDocTarget: a } = t;
209
+ if (!n(e.visible, e) || e.requiredPermissions?.length && !r(e.requiredPermissions)) return !1;
209
210
  let o = e.requiresObject, s = e.requiresService;
210
211
  return !(o && !i("object", o) || s && !i("service", s) || e.type === "doc" && a && !a({
211
212
  book: e.book,
212
213
  doc: e.doc
213
214
  }));
214
215
  }
215
- function Y(e, t = {}) {
216
+ function X(e, t = {}) {
216
217
  let { hasActionHandler: n = !1 } = t;
217
- for (let r of e) if (J(r, t) && r.type !== "separator") {
218
+ for (let r of e) if (Pe(r, t) && r.type !== "separator") {
218
219
  if (r.type === "group") {
219
- if (Y(r.children ?? [], t)) return !0;
220
+ if (X(r.children ?? [], t)) return !0;
220
221
  continue;
221
222
  }
222
223
  if (r.type !== "action" || n) return !0;
223
224
  }
224
225
  return !1;
225
226
  }
226
- var Ne = /\{(current_user_id|current_org_id|[a-z][a-z0-9_]*)\}/g;
227
- function X(e, t) {
227
+ var Fe = /\{(current_user_id|current_org_id|[a-z][a-z0-9_]*)\}/g;
228
+ function Z(e, t) {
228
229
  if (!e.includes("{")) return e;
229
- let n = !1, r = e.replace(Ne, (e, r) => {
230
+ let n = !1, r = e.replace(Fe, (e, r) => {
230
231
  let i;
231
232
  return i = r === "current_user_id" ? t?.currentUserId : r === "current_org_id" ? t?.currentOrgId : t?.contextValues?.[r], i || (n = !0, "");
232
233
  });
233
234
  return n ? null : r;
234
235
  }
235
- var Pe = "runAction";
236
- function Fe(e, t) {
236
+ var Ie = "runAction";
237
+ function Le(e, t) {
237
238
  let n = t.runAction;
238
- return typeof n != "string" || n === "" ? e : `${e}${e.includes("?") ? "&" : "?"}${Pe}=${encodeURIComponent(n)}`;
239
+ return typeof n != "string" || n === "" ? e : `${e}${e.includes("?") ? "&" : "?"}${Ie}=${encodeURIComponent(n)}`;
239
240
  }
240
- function Ie(e, t, n) {
241
+ function Re(e, t, n) {
241
242
  let r = (e) => encodeURIComponent(e);
242
243
  return e && t ? `${n}/docs/${r(e)}/${r(t)}` : t ? `${n}/docs/${r(t)}` : e ? `${n}/docs/${r(e)}` : "#";
243
244
  }
244
- function Z(e, t, n) {
245
+ function Q(e, t, n) {
245
246
  switch (e.type) {
246
247
  case "object": {
247
248
  let r = `${t}/${e.objectName ?? ""}`, i = e.recordId;
248
249
  if (i) {
249
- let t = X(i, n);
250
+ let t = Z(i, n);
250
251
  if (t) {
251
252
  let n = `${r}/record/${encodeURIComponent(t)}`;
252
253
  return {
@@ -260,17 +261,17 @@ function Z(e, t, n) {
260
261
  let t = new URLSearchParams();
261
262
  for (let [e, r] of Object.entries(a)) {
262
263
  if (r == null || e === "") continue;
263
- let i = X(String(r), n);
264
+ let i = Z(String(r), n);
264
265
  i !== null && t.set(`filter[${e}]`, i);
265
266
  }
266
267
  let i = t.toString();
267
268
  return {
268
- href: Fe(i ? `${r}/data?${i}` : `${r}/data`, e),
269
+ href: Le(i ? `${r}/data?${i}` : `${r}/data`, e),
269
270
  external: !1
270
271
  };
271
272
  }
272
273
  return {
273
- href: Fe(e.viewName ? `${r}/view/${e.viewName}` : r, e),
274
+ href: Le(e.viewName ? `${r}/view/${e.viewName}` : r, e),
274
275
  external: !1
275
276
  };
276
277
  }
@@ -288,7 +289,7 @@ function Z(e, t, n) {
288
289
  let e = new URLSearchParams();
289
290
  for (let [t, i] of Object.entries(r)) if (i != null) {
290
291
  if (typeof i == "string") {
291
- let r = X(i, n);
292
+ let r = Z(i, n);
292
293
  r !== null && e.set(t, r);
293
294
  } else e.set(t, JSON.stringify(i));
294
295
  }
@@ -326,7 +327,7 @@ function Z(e, t, n) {
326
327
  let e = new URLSearchParams();
327
328
  for (let [t, r] of Object.entries(a)) if (t !== "type" && t !== "name" && r != null) {
328
329
  if (typeof r == "string") {
329
- let i = X(r, n);
330
+ let i = Z(r, n);
330
331
  i && e.set(t, i);
331
332
  } else e.set(t, JSON.stringify(r));
332
333
  }
@@ -357,7 +358,7 @@ function Z(e, t, n) {
357
358
  };
358
359
  }
359
360
  case "doc": return {
360
- href: Ie(e.book, e.doc, t),
361
+ href: Re(e.book, e.doc, t),
361
362
  external: !1
362
363
  };
363
364
  default: return {
@@ -366,27 +367,27 @@ function Z(e, t, n) {
366
367
  };
367
368
  }
368
369
  }
369
- var Le = 50, Re = 40, ze = 30, Be = 25, Ve = 10, He = 5;
370
- function Ue(e) {
370
+ var ze = 50, Be = 40, Ve = 30, He = 25, Ue = 10, We = 5;
371
+ function Ge(e) {
371
372
  let t = /* @__PURE__ */ new Map();
372
373
  return new URLSearchParams(e).forEach((e, n) => {
373
374
  let r = /^filter\[(.+)\]$/.exec(n);
374
375
  r && r[1] && e !== "" && t.set(r[1], e);
375
376
  }), t;
376
377
  }
377
- function We(e, t) {
378
+ function Ke(e, t) {
378
379
  return t.startsWith(`${e}.`) ? t.slice(e.length + 1) : t;
379
380
  }
380
- function Ge(e, t, n, r, i) {
381
- let { href: a, external: o } = Z(e, r, i);
381
+ function qe(e, t, n, r, i) {
382
+ let { href: a, external: o } = Q(e, r, i);
382
383
  if (o || a === "#") return 0;
383
384
  if (e.type === "object" && e.objectName) {
384
385
  let a = `${r}/${e.objectName}`;
385
386
  if (t !== a && !t.startsWith(`${a}/`)) return 0;
386
387
  let o = t === a ? [] : t.slice(a.length + 1).split("/"), s = e.recordId;
387
388
  if (s) {
388
- let e = X(s, i);
389
- if (e) return o[0] === "record" && decodeURIComponent(o[1] ?? "") === e ? Le : 0;
389
+ let e = Z(s, i);
390
+ if (e) return o[0] === "record" && decodeURIComponent(o[1] ?? "") === e ? ze : 0;
390
391
  }
391
392
  let c = e.filters;
392
393
  if (c && typeof c == "object" && !Array.isArray(c)) {
@@ -394,41 +395,41 @@ function Ge(e, t, n, r, i) {
394
395
  let e = /* @__PURE__ */ new Map();
395
396
  for (let [t, n] of Object.entries(c)) {
396
397
  if (n == null || t === "") continue;
397
- let r = X(String(n), i);
398
+ let r = Z(String(n), i);
398
399
  r !== null && e.set(t, r);
399
400
  }
400
401
  if (e.size !== n.size) return 0;
401
402
  for (let [t, r] of e) if (n.get(t) !== r) return 0;
402
- return Re;
403
+ return Be;
403
404
  }
404
- return e.viewName ? o[0] !== "view" || !o[1] ? 0 : We(e.objectName, decodeURIComponent(o[1])) === We(e.objectName, e.viewName) ? ze : 0 : o.length === 0 ? Be : Ve;
405
+ return e.viewName ? o[0] !== "view" || !o[1] ? 0 : Ke(e.objectName, decodeURIComponent(o[1])) === Ke(e.objectName, e.viewName) ? Ve : 0 : o.length === 0 ? He : Ue;
405
406
  }
406
407
  let s = a.split("?")[0];
407
- if (t === s) return Be;
408
+ if (t === s) return He;
408
409
  let c = e.componentRef;
409
- return c && c.split(":")[1] === "directory" ? 0 : t.startsWith(`${s}/`) ? He : 0;
410
+ return c && c.split(":")[1] === "directory" ? 0 : t.startsWith(`${s}/`) ? We : 0;
410
411
  }
411
- function Q(e, t, n, r, i) {
412
- let a = Ue(n), o = null, s = 0, c = (e) => {
412
+ function Je(e, t, n, r, i) {
413
+ let a = Ge(n), o = null, s = 0, c = (e) => {
413
414
  if (e) for (let n of e) {
414
415
  if (n.type === "group") {
415
416
  c(n.children);
416
417
  continue;
417
418
  }
418
- let e = Ge(n, t, a, r, i);
419
+ let e = qe(n, t, a, r, i);
419
420
  e > s && (o = n, s = e);
420
421
  }
421
422
  };
422
423
  return c(e), o;
423
424
  }
424
- var Ke = e.createContext(null);
425
- function qe(e, t, n = (e) => q(e)) {
425
+ var Ye = e.createContext(null);
426
+ function Xe(e, t, n = (e) => Y(e)) {
426
427
  if (!t.trim()) return e;
427
428
  let r = t.toLowerCase().trim();
428
429
  return e.reduce((e, i) => {
429
430
  if (i.type === "separator") return e;
430
431
  if (i.type === "group" && i.children?.length) {
431
- let r = qe(i.children, t, n);
432
+ let r = Xe(i.children, t, n);
432
433
  return r.length > 0 && e.push({
433
434
  ...i,
434
435
  children: r
@@ -437,272 +438,330 @@ function qe(e, t, n = (e) => q(e)) {
437
438
  return n(i).toLowerCase().includes(r) && e.push(i), e;
438
439
  }, []);
439
440
  }
440
- var Je = 5;
441
- function Ye({ item: e, basePath: t, evalVis: n, checkPerm: r, checkCap: i, checkDocTarget: a, onAction: o, enablePinning: s, onPinToggle: c, enableReorder: l, resolveTargetLabel: u, locale: d, t: f, templateContext: p }) {
442
- let { attributes: m, listeners: h, setNodeRef: g, transform: _, transition: v, isDragging: y } = me({
443
- id: e.id,
444
- disabled: !l
445
- }), b = {
446
- transform: ge.Transform.toString(_),
447
- transition: v,
448
- opacity: y ? .5 : void 0,
449
- zIndex: y ? 10 : void 0
450
- };
451
- return /* @__PURE__ */ F("div", {
452
- ref: g,
453
- style: b,
454
- ...m,
455
- children: /* @__PURE__ */ F($, {
456
- item: e,
457
- basePath: t,
458
- evalVis: n,
459
- checkPerm: r,
460
- checkCap: i,
461
- checkDocTarget: a,
462
- onAction: o,
463
- enablePinning: s,
464
- onPinToggle: c,
465
- dragListeners: l ? h : void 0,
466
- resolveTargetLabel: u,
467
- locale: d,
468
- t: f,
469
- templateContext: p
441
+ var Ze = 5, Qe = {
442
+ coordinateGetter: de,
443
+ keyboardCodes: {
444
+ start: ["Space"],
445
+ cancel: ["Escape"],
446
+ end: ["Space"]
447
+ }
448
+ }, $e = () => null, et = (e) => e.activatorEvent?.type === "keydown";
449
+ function tt() {
450
+ let e = (e) => e.preventDefault();
451
+ window.addEventListener("click", e, { capture: !0 }), window.setTimeout(() => window.removeEventListener("click", e, { capture: !0 }), 50);
452
+ }
453
+ function nt({ items: e, onReorder: t, rowProps: n }) {
454
+ let r = ce(q(G, { activationConstraint: { distance: Ze } }), q(W, Qe)), i = e.map((e) => e.id);
455
+ return /* @__PURE__ */ F(oe, {
456
+ id: "nav-pinned",
457
+ sensors: r,
458
+ collisionDetection: se,
459
+ onDragEnd: (e) => {
460
+ et(e) || tt();
461
+ let { active: n, over: r } = e;
462
+ if (!r || n.id === r.id) return;
463
+ let a = i.indexOf(String(n.id)), o = i.indexOf(String(r.id));
464
+ a !== -1 && o !== -1 && t(ue(i, a, o));
465
+ },
466
+ onDragCancel: (e) => {
467
+ et(e) || tt();
468
+ },
469
+ children: /* @__PURE__ */ F(le, {
470
+ items: i,
471
+ strategy: $e,
472
+ children: /* @__PURE__ */ F(C, { children: e.map((e) => /* @__PURE__ */ F(it, {
473
+ item: e,
474
+ rowProps: n
475
+ }, `fav-${e.id}`)) })
470
476
  })
471
477
  });
472
478
  }
473
- function $({ item: t, basePath: n, evalVis: r, checkPerm: a, checkCap: s, checkDocTarget: d, onAction: f, enablePinning: m, onPinToggle: h, dragListeners: g, resolveTargetLabel: b, locale: x, t: S, templateContext: D }) {
474
- let O = N(), k = O ? "min-h-[44px] text-[15px] gap-3 rounded-xl" : void 0, A = j("shrink-0", O ? "h-5 w-5" : "h-4 w-4"), M = (() => {
479
+ function rt(e) {
480
+ return {
481
+ ref: e.ref,
482
+ ...e.listeners,
483
+ "aria-describedby": e.describedBy,
484
+ onKeyUp: (e) => {
485
+ e.code === "Space" && e.preventDefault();
486
+ }
487
+ };
488
+ }
489
+ function it({ item: e, rowProps: t }) {
490
+ let { attributes: n, listeners: r, setNodeRef: i, setActivatorNodeRef: a, transform: o, transition: s, isDragging: c, isOver: l, activeIndex: u, index: d } = fe({ id: e.id }), { activatorEvent: f } = K(), p = {
491
+ transform: c && f?.type === "keydown" ? void 0 : pe.Transform.toString(o),
492
+ transition: s,
493
+ opacity: c ? .5 : void 0,
494
+ zIndex: c ? 10 : void 0
495
+ }, m = l && !c && u !== -1 ? u < d ? "after" : "before" : null;
496
+ return /* @__PURE__ */ F($, {
497
+ item: e,
498
+ ...t,
499
+ dragActivator: {
500
+ ref: a,
501
+ listeners: r,
502
+ describedBy: n["aria-describedby"]
503
+ },
504
+ row: {
505
+ ref: i,
506
+ style: p,
507
+ dropIndicator: m
508
+ }
509
+ });
510
+ }
511
+ function at({ at: e }) {
512
+ return /* @__PURE__ */ F("span", {
513
+ "aria-hidden": "true",
514
+ "data-drop-indicator": e,
515
+ className: j("pointer-events-none absolute inset-x-2 h-0.5 rounded-full bg-primary", e === "before" ? "-top-px" : "-bottom-px")
516
+ });
517
+ }
518
+ function $({ item: t, basePath: n, evalVis: r, checkPerm: a, checkCap: s, checkDocTarget: d, onAction: f, enablePinning: m, onPinToggle: h, renderItemAction: g, dragActivator: b, row: x, inList: S = !0, resolveTargetLabel: D, locale: O, t: k, templateContext: A }) {
519
+ let M = N(), R = M ? "min-h-[44px] text-[15px] gap-3 rounded-xl" : void 0, z = j("shrink-0", M ? "h-5 w-5" : "h-4 w-4"), B = (() => {
475
520
  if (typeof t.expanded == "boolean") return t.expanded;
476
521
  if (typeof t.defaultOpen == "boolean") return t.defaultOpen;
477
- })(), R = t.type === "group" ? t.children?.length ?? 0 : 0, z = e.useContext(Ke), ee = e.useMemo(() => {
478
- if (t.type !== "group" || !z) return !1;
479
- let e = (t) => !!t?.some((t) => t.id === z || t.type === "group" && e(t.children));
522
+ })(), te = t.type === "group" ? t.children?.length ?? 0 : 0, V = e.useContext(Ye), ie = e.useMemo(() => {
523
+ if (t.type !== "group" || !V) return !1;
524
+ let e = (t) => !!t?.some((t) => t.id === V || t.type === "group" && e(t.children));
480
525
  return e(t.children);
481
- }, [t, z]) ? !0 : M ?? !(R >= 8), [B, re] = i(ee), V = {
526
+ }, [t, V]) ? !0 : B ?? !(te >= 8), [H, ae] = i(ie), U = {
482
527
  evaluateVisibility: r,
483
528
  checkPermission: a,
484
529
  checkCapability: s,
485
530
  checkDocTarget: d,
486
531
  hasActionHandler: !!f
487
532
  };
488
- if (!J(t, V)) return null;
489
- if (t.type === "separator") return /* @__PURE__ */ F(p, { className: "my-2" });
533
+ if (!Pe(t, U)) return null;
534
+ if (t.type === "separator") return /* @__PURE__ */ F("li", {
535
+ "aria-hidden": "true",
536
+ children: /* @__PURE__ */ F(p, { className: "my-2" })
537
+ });
490
538
  if (t.type === "group") {
491
- let e = (t.children ?? []).slice().sort(G);
492
- if (!Y(e, V)) return null;
493
- let i = q(t, S, b, x);
494
- return /* @__PURE__ */ F(c, {
495
- open: B,
496
- onOpenChange: re,
539
+ let e = (t.children ?? []).slice().sort(we);
540
+ if (!X(e, U)) return null;
541
+ let i = Y(t, k, D, O), o = {
542
+ basePath: n,
543
+ evalVis: r,
544
+ checkPerm: a,
545
+ checkCap: s,
546
+ checkDocTarget: d,
547
+ onAction: f,
548
+ enablePinning: m,
549
+ onPinToggle: h,
550
+ renderItemAction: g,
551
+ resolveTargetLabel: D,
552
+ locale: O,
553
+ t: k,
554
+ templateContext: A
555
+ }, p = /* @__PURE__ */ F(c, {
556
+ open: H,
557
+ onOpenChange: ae,
497
558
  children: /* @__PURE__ */ I(_, { children: [/* @__PURE__ */ F(y, {
498
559
  asChild: !0,
560
+ className: j(Te, Ee),
499
561
  children: /* @__PURE__ */ I(u, {
500
- className: j("flex w-full items-center justify-between", O && "min-h-[44px] text-[15px] rounded-xl"),
501
- children: [i, /* @__PURE__ */ F(te, { className: j("ml-auto transition-transform", O ? "h-5 w-5" : "h-4 w-4", B && "rotate-90") })]
562
+ className: j("flex w-full items-center justify-between", M && "min-h-[44px] text-[15px] rounded-xl"),
563
+ children: [i, /* @__PURE__ */ F(ee, { className: j("ml-auto transition-transform", M ? "h-5 w-5" : "h-4 w-4", H && "rotate-90") })]
502
564
  })
503
565
  }), /* @__PURE__ */ F(l, { children: /* @__PURE__ */ F(v, { children: /* @__PURE__ */ F(C, { children: e.map((e) => /* @__PURE__ */ F($, {
504
566
  item: e,
505
- basePath: n,
506
- evalVis: r,
507
- checkPerm: a,
508
- checkCap: s,
509
- checkDocTarget: d,
510
- onAction: f,
511
- enablePinning: m,
512
- onPinToggle: h,
513
- resolveTargetLabel: b,
514
- locale: x,
515
- t: S,
516
- templateContext: D
567
+ ...o
517
568
  }, e.id)) }) }) })] })
518
569
  });
570
+ return S ? /* @__PURE__ */ F("li", { children: p }) : p;
519
571
  }
520
572
  if (t.type === "action") {
521
573
  if (!f) return null;
522
- let e = K(t.icon), r = q(t, S, b, x);
523
- return /* @__PURE__ */ I(E, { children: [
524
- g && /* @__PURE__ */ F("span", {
525
- className: "absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground",
526
- "aria-label": S ? S("console.nav.dragToReorder", { defaultValue: "Drag to reorder" }) : "Drag to reorder",
527
- ...g,
528
- children: /* @__PURE__ */ F(ne, { className: "h-3.5 w-3.5" })
529
- }),
530
- /* @__PURE__ */ I(T, {
531
- tooltip: r,
532
- onClick: () => f?.(t),
533
- className: k,
534
- children: [
535
- /* @__PURE__ */ F(e, { className: A }),
536
- /* @__PURE__ */ F("span", { children: r }),
537
- t.badge != null && /* @__PURE__ */ F(o, {
538
- variant: t.badgeVariant ?? "default",
539
- className: "ml-auto text-[10px] px-1.5 py-0",
540
- children: t.badge
541
- })
542
- ]
543
- }),
544
- m && h && /* @__PURE__ */ F(w, {
545
- showOnHover: !0,
546
- onClick: () => h(t.id, !t.pinned, t, n),
547
- "aria-label": S ? S(t.pinned ? "console.nav.unpinItem" : "console.nav.pinItem", {
548
- defaultValue: t.pinned ? `Unpin ${r}` : `Pin ${r}`,
549
- name: r
550
- }) : t.pinned ? `Unpin ${r}` : `Pin ${r}`,
551
- children: t.pinned ? /* @__PURE__ */ F(ae, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ F(ie, { className: "h-3.5 w-3.5" })
552
- })
553
- ] });
574
+ let e = J(t.icon), r = Y(t, k, D, O);
575
+ return /* @__PURE__ */ I(E, {
576
+ ref: x?.ref,
577
+ style: x?.style,
578
+ children: [
579
+ x?.dropIndicator && /* @__PURE__ */ F(at, { at: x.dropIndicator }),
580
+ /* @__PURE__ */ I(T, {
581
+ tooltip: r,
582
+ onClick: () => f?.(t),
583
+ className: j(R, b && "cursor-grab"),
584
+ ...b ? rt(b) : {},
585
+ children: [
586
+ /* @__PURE__ */ F(e, { className: z }),
587
+ /* @__PURE__ */ F("span", { children: r }),
588
+ t.badge != null && /* @__PURE__ */ F(o, {
589
+ variant: t.badgeVariant ?? "default",
590
+ className: "ml-auto text-[10px] px-1.5 py-0",
591
+ children: t.badge
592
+ })
593
+ ]
594
+ }),
595
+ g ? g(t, {
596
+ external: !1,
597
+ label: r,
598
+ basePath: n
599
+ }) : m && h && /* @__PURE__ */ F(w, {
600
+ showOnHover: !0,
601
+ onClick: () => h(t.id, !t.pinned, t, n),
602
+ "aria-label": k ? k(t.pinned ? "console.nav.unpinItem" : "console.nav.pinItem", {
603
+ defaultValue: t.pinned ? `Unpin ${r}` : `Pin ${r}`,
604
+ name: r
605
+ }) : t.pinned ? `Unpin ${r}` : `Pin ${r}`,
606
+ children: t.pinned ? /* @__PURE__ */ F(re, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ F(ne, { className: "h-3.5 w-3.5" })
607
+ })
608
+ ]
609
+ });
554
610
  }
555
- let oe = K(t.icon), { href: H, external: se } = Z(t, n, D), ce = z !== null && t.id === z, U = q(t, S, b, x), W = /* @__PURE__ */ I(P, { children: [
556
- /* @__PURE__ */ F(oe, { className: A }),
557
- /* @__PURE__ */ F("span", { children: U }),
611
+ let oe = J(t.icon), { href: W, external: G } = Q(t, n, A), se = V !== null && t.id === V, K = Y(t, k, D, O), q = /* @__PURE__ */ I(P, { children: [
612
+ /* @__PURE__ */ F(oe, { className: z }),
613
+ /* @__PURE__ */ F("span", { children: K }),
558
614
  t.badge != null && /* @__PURE__ */ F(o, {
559
615
  variant: t.badgeVariant ?? "default",
560
616
  className: "ml-auto text-[10px] px-1.5 py-0",
561
617
  children: t.badge
562
618
  })
563
- ] });
564
- return /* @__PURE__ */ I(E, { children: [
565
- g && /* @__PURE__ */ F("span", {
566
- className: "absolute left-0.5 top-1/2 -translate-y-1/2 cursor-grab text-muted-foreground",
567
- "aria-label": S ? S("console.nav.dragToReorder", { defaultValue: "Drag to reorder" }) : "Drag to reorder",
568
- ...g,
569
- children: /* @__PURE__ */ F(ne, { className: "h-3.5 w-3.5" })
570
- }),
571
- /* @__PURE__ */ F(T, {
572
- asChild: !0,
573
- isActive: ce,
574
- tooltip: U,
575
- className: k,
576
- children: se ? /* @__PURE__ */ F("a", {
577
- href: H,
578
- target: "_blank",
579
- rel: "noopener noreferrer",
580
- children: W
581
- }) : /* @__PURE__ */ F(L, {
582
- to: H,
583
- children: W
619
+ ] }), ce = b ? rt(b) : {};
620
+ return /* @__PURE__ */ I(E, {
621
+ ref: x?.ref,
622
+ style: x?.style,
623
+ children: [
624
+ x?.dropIndicator && /* @__PURE__ */ F(at, { at: x.dropIndicator }),
625
+ /* @__PURE__ */ F(T, {
626
+ asChild: !0,
627
+ isActive: se,
628
+ tooltip: K,
629
+ className: j(R, b && "cursor-grab"),
630
+ children: G ? /* @__PURE__ */ F("a", {
631
+ href: W,
632
+ target: "_blank",
633
+ rel: "noopener noreferrer",
634
+ ...ce,
635
+ children: q
636
+ }) : /* @__PURE__ */ F(L, {
637
+ to: W,
638
+ ...ce,
639
+ children: q
640
+ })
641
+ }),
642
+ g ? g(t, {
643
+ href: W === "#" ? void 0 : W,
644
+ external: G,
645
+ label: K,
646
+ basePath: n
647
+ }) : m && h && /* @__PURE__ */ F(w, {
648
+ showOnHover: !0,
649
+ onClick: () => h(t.id, !t.pinned, t, n),
650
+ "aria-label": k ? k(t.pinned ? "console.nav.unpinItem" : "console.nav.pinItem", {
651
+ defaultValue: t.pinned ? `Unpin ${K}` : `Pin ${K}`,
652
+ name: K
653
+ }) : t.pinned ? `Unpin ${K}` : `Pin ${K}`,
654
+ children: t.pinned ? /* @__PURE__ */ F(re, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ F(ne, { className: "h-3.5 w-3.5" })
584
655
  })
585
- }),
586
- m && h && /* @__PURE__ */ F(w, {
587
- showOnHover: !0,
588
- onClick: () => h(t.id, !t.pinned, t, n),
589
- "aria-label": S ? S(t.pinned ? "console.nav.unpinItem" : "console.nav.pinItem", {
590
- defaultValue: t.pinned ? `Unpin ${U}` : `Pin ${U}`,
591
- name: U
592
- }) : t.pinned ? `Unpin ${U}` : `Pin ${U}`,
593
- children: t.pinned ? /* @__PURE__ */ F(ae, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ F(ie, { className: "h-3.5 w-3.5" })
594
- })
595
- ] });
656
+ ]
657
+ });
596
658
  }
597
- function Xe({ items: e, basePath: t = "", evaluateVisibility: n = Ae, checkPermission: i = je, checkCapability: a = Me, checkDocTarget: o, onAction: s, searchQuery: c, enablePinning: l, onPinToggle: u, enableReorder: d, onReorder: f, resolveTargetLabel: p, locale: m, t: h, templateContext: g }) {
598
- let b = z(), x = r(() => Q(e, b.pathname, b.search, t, g)?.id ?? null, [
599
- e,
600
- b.pathname,
601
- b.search,
659
+ function ot({ items: t, basePath: n = "", evaluateVisibility: i = je, checkPermission: a = Me, checkCapability: o = Ne, checkDocTarget: s, onAction: c, searchQuery: l, enablePinning: u, onPinToggle: d, renderItemAction: f, extraFavorites: p, pinnedOrder: m, onPinnedReorder: h, resolveTargetLabel: g, locale: b, t: x, templateContext: S }) {
660
+ let w = z(), T = r(() => Je(t, w.pathname, w.search, n, S)?.id ?? null, [
602
661
  t,
603
- g
604
- ]), S = r(() => c ? qe(e, c, (e) => q(e, h, p, m)) : e, [
605
- e,
606
- c,
607
- h,
608
- p,
609
- m
610
- ]), w = r(() => Ze(S, {
611
- evaluateVisibility: n,
612
- checkPermission: i,
613
- checkCapability: a,
614
- checkDocTarget: o
615
- }), [
616
- S,
662
+ w.pathname,
663
+ w.search,
617
664
  n,
665
+ S
666
+ ]), E = r(() => l ? Xe(t, l, (e) => Y(e, x, g, b)) : t, [
667
+ t,
668
+ l,
669
+ x,
670
+ g,
671
+ b
672
+ ]), D = r(() => st(ct(E, {
673
+ evaluateVisibility: i,
674
+ checkPermission: a,
675
+ checkCapability: o,
676
+ checkDocTarget: s
677
+ }), m), [
678
+ E,
618
679
  i,
619
680
  a,
620
- o
621
- ]), T = S.slice().sort(G), E = de(ue(W, { activationConstraint: { distance: Je } }), ue(U)), D = (e) => {
622
- let { active: t, over: n } = e;
623
- if (!n || t.id === n.id || !f) return;
624
- let r = T.findIndex((e) => e.id === t.id), i = T.findIndex((e) => e.id === n.id);
625
- r !== -1 && i !== -1 && f(pe(T, r, i).map((e, t) => ({
626
- ...e,
627
- order: t
628
- })));
629
- }, O = {
630
- basePath: t,
631
- evalVis: n,
632
- checkPerm: i,
633
- checkCap: a,
634
- checkDocTarget: o,
635
- onAction: s,
636
- enablePinning: l,
637
- onPinToggle: u,
638
- resolveTargetLabel: p,
639
- locale: m,
640
- t: h,
641
- templateContext: g
642
- }, k = T.some((e) => e.type === "group"), A = w.length > 0 && l ? /* @__PURE__ */ I(_, { children: [/* @__PURE__ */ I(y, {
643
- className: "flex items-center gap-1.5",
644
- children: [/* @__PURE__ */ F(oe, { className: "h-3.5 w-3.5" }), h ? h("console.nav.favorites", { defaultValue: "Favorites" }) : "Favorites"]
645
- }), /* @__PURE__ */ F(v, { children: /* @__PURE__ */ F(C, { children: w.map((e) => /* @__PURE__ */ F($, {
681
+ o,
682
+ s,
683
+ m
684
+ ]), O = E.slice().sort(we), k = {
685
+ basePath: n,
686
+ evalVis: i,
687
+ checkPerm: a,
688
+ checkCap: o,
689
+ checkDocTarget: s,
690
+ onAction: c,
691
+ enablePinning: u,
692
+ onPinToggle: d,
693
+ renderItemAction: f,
694
+ resolveTargetLabel: g,
695
+ locale: b,
696
+ t: x,
697
+ templateContext: S
698
+ }, A = O.some((e) => e.type === "group"), M = !!u && D.length > 0, N = e.Children.toArray(p).length > 0, P = M || N ? /* @__PURE__ */ I(_, { children: [/* @__PURE__ */ I(y, {
699
+ className: j("flex items-center gap-1.5", Te, Ee),
700
+ children: [/* @__PURE__ */ F(H, { className: "h-3.5 w-3.5" }), x ? x("console.nav.favorites", { defaultValue: "Favorites" }) : "Favorites"]
701
+ }), /* @__PURE__ */ I(v, { children: [M && (h ? /* @__PURE__ */ F(nt, {
702
+ items: D,
703
+ onReorder: h,
704
+ rowProps: k
705
+ }) : /* @__PURE__ */ F(C, { children: D.map((e) => /* @__PURE__ */ F($, {
646
706
  item: e,
647
- ...O
648
- }, `fav-${e.id}`)) }) })] }) : null;
649
- if (!k) {
650
- let e = T.filter((e) => e.type !== "group").map((e) => e.id), t = d ? /* @__PURE__ */ F(ce, {
651
- sensors: E,
652
- collisionDetection: le,
653
- onDragEnd: D,
654
- children: /* @__PURE__ */ F(fe, {
655
- items: e,
656
- strategy: he,
657
- children: /* @__PURE__ */ F(C, { children: T.map((e) => /* @__PURE__ */ F(Ye, {
658
- item: e,
659
- enableReorder: d,
660
- ...O
661
- }, e.id)) })
662
- })
663
- }) : /* @__PURE__ */ F(C, { children: T.map((e) => /* @__PURE__ */ F($, {
707
+ ...k
708
+ }, `fav-${e.id}`)) })), N && /* @__PURE__ */ F(C, {
709
+ className: j(M && "mt-1"),
710
+ children: p
711
+ })] })] }) : null;
712
+ if (!A) return /* @__PURE__ */ I(Ye.Provider, {
713
+ value: T,
714
+ children: [P, /* @__PURE__ */ F(_, { children: /* @__PURE__ */ F(v, { children: /* @__PURE__ */ F(C, { children: O.map((e) => /* @__PURE__ */ F($, {
664
715
  item: e,
665
- ...O
666
- }, e.id)) });
667
- return /* @__PURE__ */ I(Ke.Provider, {
668
- value: x,
669
- children: [A, /* @__PURE__ */ F(_, { children: /* @__PURE__ */ F(v, { children: t }) })]
670
- });
671
- }
672
- let j = [], M = [], N = (e) => {
673
- if (M.length === 0) return;
674
- let t = M;
675
- M = [], j.push(/* @__PURE__ */ F(_, { children: /* @__PURE__ */ F(v, { children: /* @__PURE__ */ F(C, { children: t.map((e) => /* @__PURE__ */ F($, {
716
+ ...k
717
+ }, e.id)) }) }) })]
718
+ });
719
+ let L = [], R = [], B = (e) => {
720
+ if (R.length === 0) return;
721
+ let t = R;
722
+ R = [], L.push(/* @__PURE__ */ F(_, { children: /* @__PURE__ */ F(v, { children: /* @__PURE__ */ F(C, { children: t.map((e) => /* @__PURE__ */ F($, {
676
723
  item: e,
677
- ...O
724
+ ...k
678
725
  }, e.id)) }) }) }, e));
679
726
  };
680
- return T.forEach((e, t) => {
681
- e.type === "group" ? (N(`leaf-${t}`), j.push(/* @__PURE__ */ F($, {
727
+ return O.forEach((e, t) => {
728
+ e.type === "group" ? (B(`leaf-${t}`), L.push(/* @__PURE__ */ F($, {
682
729
  item: e,
683
- ...O
684
- }, e.id))) : M.push(e);
685
- }), N("leaf-end"), /* @__PURE__ */ I(Ke.Provider, {
686
- value: x,
687
- children: [A, j]
730
+ inList: !1,
731
+ ...k
732
+ }, e.id))) : R.push(e);
733
+ }), B("leaf-end"), /* @__PURE__ */ I(Ye.Provider, {
734
+ value: T,
735
+ children: [P, L]
688
736
  });
689
737
  }
690
- function Ze(e, t) {
738
+ function st(e, t) {
739
+ let n = [], r = /* @__PURE__ */ new Set();
740
+ for (let t of e) r.has(t.id) || (r.add(t.id), n.push(t));
741
+ if (!t?.length) return n;
742
+ let i = new Map(t.map((e, t) => [e, t]));
743
+ return n.map((e, n) => ({
744
+ item: e,
745
+ key: i.get(e.id) ?? t.length + n
746
+ })).sort((e, t) => e.key - t.key).map(({ item: e }) => e);
747
+ }
748
+ function ct(e, t) {
691
749
  let n = [];
692
- for (let r of e) J(r, t) && (r.type !== "group" && r.type !== "separator" && r.pinned && n.push(r), r.children?.length && n.push(...Ze(r.children, t)));
750
+ for (let r of e) Pe(r, t) && (r.type !== "group" && r.type !== "separator" && r.pinned && n.push(r), r.children?.length && n.push(...ct(r.children, t)));
693
751
  return n;
694
752
  }
695
753
  //#endregion
696
754
  //#region src/AppSchemaRenderer.tsx
697
- function Qe(e) {
698
- return se(e, void 0) ?? "";
755
+ var lt = "group-data-[state=collapsed]:group-data-[collapsible=icon]:invisible group-data-[state=collapsed]:group-data-[collapsible=icon]:transition-[margin,opacity,visibility]";
756
+ function ut(e) {
757
+ return U(e, void 0) ?? "";
699
758
  }
700
- function $e({ areas: e, activeAreaId: t, onAreaChange: n }) {
759
+ function dt({ areas: e, activeAreaId: t, onAreaChange: n }) {
701
760
  return e.length <= 1 ? null : /* @__PURE__ */ I(_, { children: [/* @__PURE__ */ I(y, {
702
- className: "flex items-center gap-1.5",
703
- children: [/* @__PURE__ */ F(re, { className: "h-3.5 w-3.5" }), "Area"]
761
+ className: `flex items-center gap-1.5 ${lt}`,
762
+ children: [/* @__PURE__ */ F(V, { className: "h-3.5 w-3.5" }), "Area"]
704
763
  }), /* @__PURE__ */ F(v, { children: /* @__PURE__ */ F(C, { children: e.map((e) => {
705
- let r = K(e.icon), i = Qe(e.label);
764
+ let r = J(e.icon), i = ut(e.label);
706
765
  return /* @__PURE__ */ F(E, { children: /* @__PURE__ */ I(T, {
707
766
  isActive: e.id === t,
708
767
  tooltip: i,
@@ -711,24 +770,24 @@ function $e({ areas: e, activeAreaId: t, onAreaChange: n }) {
711
770
  }) }, e.id);
712
771
  }) }) })] });
713
772
  }
714
- function et({ items: e, basePath: t, guards: n, onAction: r }) {
773
+ function ft({ items: e, basePath: t, guards: n, onAction: r }) {
715
774
  let i = z(), a = (e) => {
716
775
  let t = [];
717
- for (let r of e.slice().sort(G)) Y([r], n) && r.type !== "separator" && (r.type === "group" ? t.push(...a(r.children || [])) : t.push(r));
776
+ for (let r of e.slice().sort(we)) X([r], n) && r.type !== "separator" && (r.type === "group" ? t.push(...a(r.children || [])) : t.push(r));
718
777
  return t;
719
778
  }, s = a(e).slice(0, 5);
720
779
  if (s.length === 0) return null;
721
- let c = Q(e, i.pathname, i.search, t)?.id ?? null;
780
+ let c = Je(e, i.pathname, i.search, t)?.id ?? null;
722
781
  return /* @__PURE__ */ F("div", {
723
782
  className: "fixed bottom-0 left-0 right-0 z-50 flex items-center justify-around border-t bg-background/95 backdrop-blur-sm px-2 py-1 sm:hidden safe-area-bottom",
724
783
  role: "navigation",
725
784
  "aria-label": "Mobile navigation",
726
785
  children: s.map((e) => {
727
- let n = K(e.icon), { href: i, external: a } = Z(e, t), s = `relative flex flex-col items-center gap-0.5 px-2 py-1.5 transition-colors min-w-[44px] min-h-[44px] justify-center ${e.id === c ? "text-primary" : "text-muted-foreground hover:text-foreground"}`, l = /* @__PURE__ */ I(P, { children: [
786
+ let n = J(e.icon), { href: i, external: a } = Q(e, t), s = `relative flex flex-col items-center gap-0.5 px-2 py-1.5 transition-colors min-w-[44px] min-h-[44px] justify-center ${e.id === c ? "text-primary" : "text-muted-foreground hover:text-foreground"}`, l = /* @__PURE__ */ I(P, { children: [
728
787
  /* @__PURE__ */ F(n, { className: "h-5 w-5" }),
729
788
  /* @__PURE__ */ F("span", {
730
789
  className: "text-[10px] truncate max-w-[60px]",
731
- children: q(e)
790
+ children: Y(e)
732
791
  }),
733
792
  e.badge != null && /* @__PURE__ */ F(o, {
734
793
  variant: e.badgeVariant,
@@ -755,8 +814,8 @@ function et({ items: e, basePath: t, guards: n, onAction: r }) {
755
814
  })
756
815
  });
757
816
  }
758
- function tt({ schema: e, basePath: t, evalVis: n, checkPerm: r, checkCap: a, checkDocTarget: o, onAction: s, sidebarHeader: c, sidebarFooter: l, sidebarExtra: u, visibleAreas: d, activeAreaId: f, setActiveAreaId: p, resolvedNavigation: _, enableSearch: v, enablePinning: y, onPinToggle: S, enableReorder: w, onReorder: D }) {
759
- let O = e.branding?.logo, k = K(e.icon), [A, j] = i("");
817
+ function pt({ schema: e, basePath: t, evalVis: n, checkPerm: r, checkCap: a, checkDocTarget: o, onAction: s, sidebarHeader: c, sidebarFooter: l, sidebarExtra: u, visibleAreas: d, activeAreaId: f, setActiveAreaId: p, resolvedNavigation: _, enableSearch: v, enablePinning: y, onPinToggle: S }) {
818
+ let w = e.branding?.logo, D = J(e.icon), [O, k] = i("");
760
819
  return /* @__PURE__ */ I(m, {
761
820
  collapsible: "icon",
762
821
  children: [
@@ -765,11 +824,11 @@ function tt({ schema: e, basePath: t, evalVis: n, checkPerm: r, checkCap: a, che
765
824
  tooltip: e.title ?? e.name,
766
825
  children: [/* @__PURE__ */ F("div", {
767
826
  className: "flex aspect-square size-8 items-center justify-center rounded-lg bg-primary text-primary-foreground",
768
- children: O ? /* @__PURE__ */ F("img", {
769
- src: O,
827
+ children: w ? /* @__PURE__ */ F("img", {
828
+ src: w,
770
829
  alt: e.title ?? "",
771
830
  className: "size-6 object-contain"
772
- }) : /* @__PURE__ */ F(k, { className: "size-4" })
831
+ }) : /* @__PURE__ */ F(D, { className: "size-4" })
773
832
  }), /* @__PURE__ */ I("div", {
774
833
  className: "grid flex-1 text-left text-sm leading-tight",
775
834
  children: [/* @__PURE__ */ F("span", {
@@ -782,17 +841,17 @@ function tt({ schema: e, basePath: t, evalVis: n, checkPerm: r, checkCap: a, che
782
841
  })]
783
842
  }) }) }), v && /* @__PURE__ */ F(x, {
784
843
  placeholder: "Search navigation…",
785
- value: A,
786
- onChange: (e) => j(e.target.value),
844
+ value: O,
845
+ onChange: (e) => k(e.target.value),
787
846
  "aria-label": "Search navigation"
788
847
  })] }),
789
848
  /* @__PURE__ */ I(h, { children: [
790
- d.length > 1 && f && /* @__PURE__ */ F($e, {
849
+ d.length > 1 && f && /* @__PURE__ */ F(dt, {
791
850
  areas: d,
792
851
  activeAreaId: f,
793
852
  onAreaChange: p
794
853
  }),
795
- /* @__PURE__ */ F(Xe, {
854
+ /* @__PURE__ */ F(ot, {
796
855
  items: _,
797
856
  basePath: t,
798
857
  evaluateVisibility: n,
@@ -800,11 +859,9 @@ function tt({ schema: e, basePath: t, evalVis: n, checkPerm: r, checkCap: a, che
800
859
  checkCapability: a,
801
860
  checkDocTarget: o,
802
861
  onAction: s,
803
- searchQuery: A,
862
+ searchQuery: O,
804
863
  enablePinning: y,
805
- onPinToggle: S,
806
- enableReorder: w,
807
- onReorder: D
864
+ onPinToggle: S
808
865
  }),
809
866
  u
810
867
  ] }),
@@ -812,74 +869,72 @@ function tt({ schema: e, basePath: t, evalVis: n, checkPerm: r, checkCap: a, che
812
869
  ]
813
870
  });
814
871
  }
815
- function nt({ schema: e, basePath: t = "", mobileNavMode: a = "drawer", evaluateVisibility: o, checkPermission: s, checkCapability: c, checkDocTarget: l, onAction: u, navbar: d, sidebarHeader: f, sidebarFooter: p, sidebarExtra: m, children: h, className: g, defaultOpen: _ = !0, enableSearch: v, enablePinning: y, onPinToggle: b, enableReorder: x, onReorder: S }) {
816
- let C = o ?? ((e) => e !== !1 && e !== "false"), w = s ?? (() => !0), T = c ?? (() => !0), E = r(() => (e.menu ?? []).map((e, t) => H(e, t)), [e.menu]), D = e.navigation ?? E, O = {
817
- evaluateVisibility: C,
818
- checkPermission: w,
819
- checkCapability: T,
872
+ function mt({ schema: e, basePath: t = "", mobileNavMode: a = "drawer", evaluateVisibility: o, checkPermission: s, checkCapability: c, checkDocTarget: l, onAction: u, navbar: d, sidebarHeader: f, sidebarFooter: p, sidebarExtra: m, children: h, className: g, defaultOpen: _ = !0, enableSearch: v, enablePinning: y, onPinToggle: b }) {
873
+ let x = o ?? ((e) => e !== !1 && e !== "false"), S = s ?? (() => !0), C = c ?? (() => !0), w = r(() => (e.menu ?? []).map((e, t) => ae(e, t)), [e.menu]), T = e.navigation ?? w, E = {
874
+ evaluateVisibility: x,
875
+ checkPermission: S,
876
+ checkCapability: C,
820
877
  checkDocTarget: l,
821
878
  hasActionHandler: !!u
822
- }, k = (e.areas ?? []).filter((e) => Y(e.navigation, O)), [A, j] = i(() => k.length > 0 ? k[0].id : null), M = k.map((e) => e.id).join(",");
879
+ }, D = (e.areas ?? []).filter((e) => X(e.navigation, E)), [O, k] = i(() => D.length > 0 ? D[0].id : null), A = D.map((e) => e.id).join(",");
823
880
  n(() => {
824
- k.length > 0 ? j((e) => k.some((t) => t.id === e) ? e : k[0].id) : j(null);
825
- }, [e.name, M]);
826
- let N = k.find((e) => e.id === A) ?? k[0], L = N?.navigation ?? D, R = {
881
+ D.length > 0 ? k((e) => D.some((t) => t.id === e) ? e : D[0].id) : k(null);
882
+ }, [e.name, A]);
883
+ let j = D.find((e) => e.id === O) ?? D[0], M = j?.navigation ?? T, N = {
827
884
  title: e.title,
828
885
  favicon: e.branding?.favicon
829
- }, z = /* @__PURE__ */ F(tt, {
886
+ }, L = /* @__PURE__ */ F(pt, {
830
887
  schema: e,
831
888
  basePath: t,
832
- evalVis: C,
833
- checkPerm: w,
834
- checkCap: T,
889
+ evalVis: x,
890
+ checkPerm: S,
891
+ checkCap: C,
835
892
  checkDocTarget: l,
836
893
  onAction: u,
837
894
  sidebarHeader: f,
838
895
  sidebarFooter: p,
839
896
  sidebarExtra: m,
840
- visibleAreas: k,
841
- activeAreaId: N?.id ?? null,
842
- setActiveAreaId: j,
843
- resolvedNavigation: L,
897
+ visibleAreas: D,
898
+ activeAreaId: j?.id ?? null,
899
+ setActiveAreaId: k,
900
+ resolvedNavigation: M,
844
901
  enableSearch: v,
845
902
  enablePinning: y,
846
- onPinToggle: b,
847
- enableReorder: x,
848
- onReorder: S
903
+ onPinToggle: b
849
904
  });
850
- return /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F(Te, {
851
- sidebar: z,
905
+ return /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F(Ce, {
906
+ sidebar: L,
852
907
  navbar: d,
853
908
  className: g,
854
909
  defaultOpen: _,
855
- branding: R,
910
+ branding: N,
856
911
  children: h
857
- }), a === "bottom_nav" && /* @__PURE__ */ F(et, {
858
- items: L,
912
+ }), a === "bottom_nav" && /* @__PURE__ */ F(ft, {
913
+ items: M,
859
914
  basePath: t,
860
- guards: O,
915
+ guards: E,
861
916
  onAction: u
862
917
  })] });
863
918
  }
864
919
  //#endregion
865
920
  //#region src/PageHeader.tsx
866
- var rt = (e) => {
921
+ var ht = (e) => {
867
922
  let t = e?.name ?? e?.full_name ?? e?.display_name ?? e?.label ?? e?.title ?? e?.subject;
868
923
  return t != null && String(t).trim() ? String(t) : [
869
924
  e?.salutation,
870
925
  e?.first_name,
871
926
  e?.last_name
872
927
  ].filter((e) => typeof e == "string" && e.trim()).map((e) => e.trim()).join(" ") || (typeof e?.email == "string" && e.email.trim() ? e.email.trim() : null);
873
- }, it = (e, t) => !e || typeof e != "string" ? e ?? "" : e.includes("{") ? e.replace(/\{([a-zA-Z0-9_.]+)\}/g, (e, n) => {
928
+ }, gt = (e, t) => !e || typeof e != "string" ? e ?? "" : e.includes("{") ? e.replace(/\{([a-zA-Z0-9_.]+)\}/g, (e, n) => {
874
929
  let r = n.split(".").reduce((e, t) => e == null ? e : e[t], t);
875
- return r == null ? "" : typeof r == "object" ? rt(r) ?? "" : String(r);
930
+ return r == null ? "" : typeof r == "object" ? ht(r) ?? "" : String(r);
876
931
  }).replace(/\s*[-–—|/·,:]\s*(?=\s*[-–—|/·,:]|$)/g, "").replace(/^\s*[-–—|/·,:]\s*/, "").replace(/\s+/g, " ").trim() : e;
877
- function at({ title: t, subtitle: n, icon: r, action: i, actions: a, showBack: o, schema: c, className: l, children: u, ...d }) {
878
- let p = ve(), m = typeof t == "string" && /\{[a-zA-Z0-9_.]+\}/.test(t), h = it(t, p?.data) || (m ? "" : t), g = n, _ = typeof g == "string" && /\{[a-zA-Z0-9_.]+\}/.test(g), v = it(g, p?.data) || (_ ? "" : g), y = !!p?.recordId, b = !!p?.embedded, x = o ?? (y && !b), S = e.useCallback(() => {
932
+ function _t({ title: t, subtitle: n, icon: r, action: i, actions: a, showBack: o, schema: c, className: l, children: u, ...d }) {
933
+ let p = ge(), m = typeof t == "string" && /\{[a-zA-Z0-9_.]+\}/.test(t), h = gt(t, p?.data) || (m ? "" : t), g = n, _ = typeof g == "string" && /\{[a-zA-Z0-9_.]+\}/.test(g), v = gt(g, p?.data) || (_ ? "" : g), y = !!p?.recordId, b = !!p?.embedded, x = o ?? (y && !b), S = e.useCallback(() => {
879
934
  if (typeof window > "u") return;
880
935
  let e = window.location.pathname, t = e.replace(/\/record\/[^/]+\/?$/, "");
881
936
  t === e ? window.history.length > 1 && window.history.back() : (window.history.pushState({}, "", t + window.location.search), window.dispatchEvent(new PopStateEvent("popstate")));
882
- }, []), C = Array.isArray(c?.children) ? c.children.filter(Boolean).map((e, t) => /* @__PURE__ */ F(_e, { schema: e }, e?.id || `pgh-child-${t}`)) : null, w = Array.isArray(a) && a.length > 0 && a || Array.isArray(c?.actions) && c.actions.length > 0 && c.actions || Array.isArray(c?.properties?.actions) && c.properties.actions.length > 0 && c.properties.actions || null, T = i || u || (w ? /* @__PURE__ */ F(_e, { schema: {
937
+ }, []), C = Array.isArray(c?.children) ? c.children.filter(Boolean).map((e, t) => /* @__PURE__ */ F(me, { schema: e }, e?.id || `pgh-child-${t}`)) : null, w = Array.isArray(a) && a.length > 0 && a || Array.isArray(c?.actions) && c.actions.length > 0 && c.actions || Array.isArray(c?.properties?.actions) && c.properties.actions.length > 0 && c.properties.actions || null, T = i || u || (w ? /* @__PURE__ */ F(me, { schema: {
883
938
  type: "record:quick_actions",
884
939
  properties: {
885
940
  actions: w,
@@ -901,7 +956,7 @@ function at({ title: t, subtitle: n, icon: r, action: i, actions: a, showBack: o
901
956
  onClick: S,
902
957
  "aria-label": "Back to list",
903
958
  className: "flex-shrink-0 -ml-2",
904
- children: /* @__PURE__ */ F(ee, { className: "size-4" })
959
+ children: /* @__PURE__ */ F(B, { className: "size-4" })
905
960
  }),
906
961
  r && (h || v) && /* @__PURE__ */ F("div", {
907
962
  className: "flex-shrink-0 grid place-items-center size-10 rounded-md bg-primary/10 text-primary",
@@ -930,10 +985,11 @@ function at({ title: t, subtitle: n, icon: r, action: i, actions: a, showBack: o
930
985
  }
931
986
  //#endregion
932
987
  //#region src/SidebarNav.tsx
933
- function ot(e) {
988
+ var vt = "group-data-[state=collapsed]:group-data-[collapsible=icon]:invisible group-data-[state=collapsed]:group-data-[collapsible=icon]:transition-[margin,opacity,visibility]";
989
+ function yt(e) {
934
990
  return "items" in e && !("href" in e);
935
991
  }
936
- function st({ item: e, pathname: t }) {
992
+ function bt({ item: e, pathname: t }) {
937
993
  return e.children && e.children.length > 0 ? /* @__PURE__ */ F(c, {
938
994
  asChild: !0,
939
995
  defaultOpen: !0,
@@ -951,7 +1007,7 @@ function st({ item: e, pathname: t }) {
951
1007
  className: "ml-auto mr-1 h-5 min-w-5 px-1 text-xs",
952
1008
  children: e.badge
953
1009
  }),
954
- /* @__PURE__ */ F(te, { className: "ml-auto h-4 w-4 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90" })
1010
+ /* @__PURE__ */ F(ee, { className: "ml-auto h-4 w-4 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90" })
955
1011
  ]
956
1012
  })
957
1013
  }), /* @__PURE__ */ F(l, {
@@ -993,8 +1049,8 @@ function st({ item: e, pathname: t }) {
993
1049
  })
994
1050
  }) });
995
1051
  }
996
- function ct({ items: t, title: n = "Application", className: r, collapsible: i = "icon", searchEnabled: a = !1, searchPlaceholder: o = "Search…" }) {
997
- let s = z(), [c, l] = e.useState(""), u = e.useMemo(() => t.length === 0 ? [] : ot(t[0]) ? t.map((e) => ({
1052
+ function xt({ items: t, title: n = "Application", className: r, collapsible: i = "icon", searchEnabled: a = !1, searchPlaceholder: o = "Search…" }) {
1053
+ let s = z(), [c, l] = e.useState(""), u = e.useMemo(() => t.length === 0 ? [] : yt(t[0]) ? t.map((e) => ({
998
1054
  groupLabel: e.label,
999
1055
  items: e.items
1000
1056
  })) : [{ items: t }], [t]), f = e.useMemo(() => {
@@ -1012,7 +1068,7 @@ function ct({ items: t, title: n = "Application", className: r, collapsible: i =
1012
1068
  className: "px-3 py-2",
1013
1069
  children: /* @__PURE__ */ I("div", {
1014
1070
  className: "relative",
1015
- children: [/* @__PURE__ */ F(V, { className: "absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" }), /* @__PURE__ */ F(d, {
1071
+ children: [/* @__PURE__ */ F(ie, { className: "absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" }), /* @__PURE__ */ F(d, {
1016
1072
  type: "search",
1017
1073
  placeholder: o,
1018
1074
  value: c,
@@ -1026,10 +1082,10 @@ function ct({ items: t, title: n = "Application", className: r, collapsible: i =
1026
1082
  "aria-hidden": !0
1027
1083
  }),
1028
1084
  /* @__PURE__ */ F(y, {
1029
- className: "text-[10px] font-semibold uppercase tracking-wider text-sidebar-foreground/60",
1085
+ className: `text-[10px] font-semibold uppercase tracking-wider text-sidebar-foreground/60 ${vt}`,
1030
1086
  children: e.groupLabel || n
1031
1087
  }),
1032
- /* @__PURE__ */ F(v, { children: /* @__PURE__ */ F(C, { children: e.items.map((e) => /* @__PURE__ */ F(st, {
1088
+ /* @__PURE__ */ F(v, { children: /* @__PURE__ */ F(C, { children: e.items.map((e) => /* @__PURE__ */ F(bt, {
1033
1089
  item: e,
1034
1090
  pathname: s.pathname
1035
1091
  }, e.href)) }) })
@@ -1038,7 +1094,7 @@ function ct({ items: t, title: n = "Application", className: r, collapsible: i =
1038
1094
  }
1039
1095
  //#endregion
1040
1096
  //#region src/ResponsiveGrid.tsx
1041
- var lt = {
1097
+ var St = {
1042
1098
  xs: {
1043
1099
  1: "grid-cols-1",
1044
1100
  2: "grid-cols-2",
@@ -1088,11 +1144,11 @@ var lt = {
1088
1144
  12: "2xl:grid-cols-12"
1089
1145
  }
1090
1146
  };
1091
- function ut(e) {
1147
+ function Ct(e) {
1092
1148
  if (!e) return "grid-cols-1";
1093
1149
  let t = [];
1094
1150
  for (let [n, r] of Object.entries(e)) {
1095
- let e = lt[n];
1151
+ let e = St[n];
1096
1152
  if (e && r) {
1097
1153
  let n = Object.keys(e).map(Number).reduce((e, t) => Math.abs(t - r) < Math.abs(e - r) ? t : e);
1098
1154
  t.push(e[n]);
@@ -1100,7 +1156,7 @@ function ut(e) {
1100
1156
  }
1101
1157
  return t.join(" ") || "grid-cols-1";
1102
1158
  }
1103
- var dt = {
1159
+ var wt = {
1104
1160
  0: "gap-0",
1105
1161
  1: "gap-1",
1106
1162
  2: "gap-2",
@@ -1109,25 +1165,25 @@ var dt = {
1109
1165
  5: "gap-5",
1110
1166
  6: "gap-6",
1111
1167
  8: "gap-8"
1112
- }, ft = ({ columns: e, gap: t = 4, className: n, children: r }) => {
1113
- let i = ut(e), a = typeof t == "number" ? dt[t] || `gap-${t}` : "";
1168
+ }, Tt = ({ columns: e, gap: t = 4, className: n, children: r }) => {
1169
+ let i = Ct(e), a = typeof t == "number" ? wt[t] || `gap-${t}` : "";
1114
1170
  return /* @__PURE__ */ F("div", {
1115
1171
  className: j("grid", i, a, n),
1116
1172
  children: r
1117
1173
  });
1118
- }, pt = { type: "app" }, mt = ({ schema: e, children: n, ...r }) => t(nt, {
1174
+ }, Et = { type: "app" }, Dt = ({ schema: e, children: n, ...r }) => t(mt, {
1119
1175
  ...r,
1120
- schema: e?.schema ?? pt,
1176
+ schema: e?.schema ?? Et,
1121
1177
  children: n
1122
1178
  });
1123
- function ht() {
1124
- a.register("page:card", ye, {
1179
+ function Ot() {
1180
+ a.register("page:card", _e, {
1125
1181
  namespace: "layout",
1126
1182
  skipFallback: !0,
1127
1183
  label: "Page Card",
1128
1184
  category: "Layout",
1129
1185
  isContainer: !0
1130
- }), a.register("app-schema-renderer", mt, {
1186
+ }), a.register("app-schema-renderer", Dt, {
1131
1187
  namespace: "layout",
1132
1188
  label: "App Schema Renderer",
1133
1189
  category: "Layout",
@@ -1151,7 +1207,7 @@ function ht() {
1151
1207
  });
1152
1208
  }
1153
1209
  try {
1154
- ht();
1210
+ Ot();
1155
1211
  } catch {}
1156
1212
  //#endregion
1157
- export { nt as AppSchemaRenderer, Te as AppShell, Pe as NAV_RUN_ACTION_PARAM, Xe as NavigationRenderer, ye as PageCard, at as PageHeader, ft as ResponsiveGrid, ct as SidebarNav, qe as filterNavigationItems, Y as hasVisibleNavigationItems, ht as registerLayout, Q as resolveActiveNavItem, Z as resolveHref, K as resolveIcon, Ee as resolveLabel, q as resolveNavItemLabel, we as useAppShellBranding };
1213
+ export { mt as AppSchemaRenderer, Ce as AppShell, Ie as NAV_RUN_ACTION_PARAM, ot as NavigationRenderer, _e as PageCard, _t as PageHeader, Tt as ResponsiveGrid, xt as SidebarNav, Xe as filterNavigationItems, X as hasVisibleNavigationItems, Ot as registerLayout, Je as resolveActiveNavItem, Q as resolveHref, J as resolveIcon, De as resolveLabel, Y as resolveNavItemLabel, Se as useAppShellBranding };