@ai-matrx/detail 0.1.67 → 0.1.69

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/react.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { D as DetailRef, a as DetailInstanceData, b as DetailPresentation, c as DetailRecordType, d as DetailStatus, e as DetailRow, f as DetailField, g as DetailSourceHealth, h as DetailFrameContext, i as DetailListContext, j as DetailLoadState, k as DetailOpenRequest } from './host-DdaWXBin.cjs';
2
- export { l as DetailDockedShellProps, m as DetailEffectivePresentation, n as DetailHostPorts, o as DetailHostProvider, p as DetailPageShellProps, q as DetailPresentationSetting, r as DetailShellSlots, s as DetailShells, t as DetailWindowShellProps, u as requireResolveType, v as requireShell, w as useDetailHost } from './host-DdaWXBin.cjs';
1
+ import { D as DetailRef, a as DetailInstanceData, b as DetailPresentation, c as DetailRecordType, d as DetailStatus, e as DetailRow, f as DetailField, g as DetailSourceHealth, h as DetailFrameContext, i as DetailListContext, j as DetailLoadState, k as DetailOpenRequest, l as DetailMenuAction } from './host-DrnEXBfp.cjs';
2
+ export { m as DetailDockedShellProps, n as DetailEffectivePresentation, o as DetailHostPorts, p as DetailHostProvider, q as DetailPageShellProps, r as DetailPresentationSetting, s as DetailShellSlots, t as DetailShells, u as DetailWindowShellProps, v as requireResolveType, w as requireShell, x as useDetailHost } from './host-DrnEXBfp.cjs';
3
3
  import * as react from 'react';
4
4
  import { KeyboardEvent } from 'react';
5
5
 
@@ -148,8 +148,19 @@ declare function DetailTitle({ core }: {
148
148
  declare function DetailRecordMeta({ core }: {
149
149
  core: DetailCore;
150
150
  }): react.JSX.Element;
151
- declare function DetailActions({ core }: {
151
+ /**
152
+ * The optional controls as data — the same actions the overflow menu offers —
153
+ * for a shell whose chrome has its own menu (a canvas tab's one "⋮").
154
+ */
155
+ declare function useDetailMenuActions(core: DetailCore): DetailMenuAction[];
156
+ /**
157
+ * Previous / next, the counter, and — unless `optional="none"` (the shell
158
+ * offers `menuActions` in its own menu) — the optional controls, which fold
159
+ * into one overflow button in a narrow header.
160
+ */
161
+ declare function DetailActions({ core, optional }: {
152
162
  core: DetailCore;
163
+ optional?: "inline" | "none";
153
164
  }): react.JSX.Element;
154
165
 
155
166
  declare function DetailBody({ core }: {
@@ -188,4 +199,4 @@ declare const DETAIL_HEADER_COMPACT_BELOW = "@max-[26rem]/window-header";
188
199
  /** The floor under the record's name: ~96px, enough for a readable fragment. */
189
200
  declare const DETAIL_TITLE_MIN_WIDTH_CLASS = "min-w-[6rem]";
190
201
 
191
- export { DETAIL_HEADER_COMPACT_BELOW, DETAIL_HEADER_CONTAINER, DETAIL_TITLE_MIN_WIDTH_CLASS, DetailActions, DetailBody, type DetailCore, DetailDockedPresentation, type DetailKeyboard, type DetailKeyboardHandlers, DetailPagePresentation, DetailPresentationPane, type DetailPresentationProps, DetailRecordMeta, DetailTitle, DetailWindowPresentation, type OpenDetail, type UseDetailHealthArgs, reconnectFor, useDetailCore, useDetailHealth, useDetailKeyboard, useDetailRecord, useOpenDetail };
202
+ export { DETAIL_HEADER_COMPACT_BELOW, DETAIL_HEADER_CONTAINER, DETAIL_TITLE_MIN_WIDTH_CLASS, DetailActions, DetailBody, type DetailCore, DetailDockedPresentation, type DetailKeyboard, type DetailKeyboardHandlers, DetailMenuAction, DetailPagePresentation, DetailPresentationPane, type DetailPresentationProps, DetailRecordMeta, DetailTitle, DetailWindowPresentation, type OpenDetail, type UseDetailHealthArgs, reconnectFor, useDetailCore, useDetailHealth, useDetailKeyboard, useDetailMenuActions, useDetailRecord, useOpenDetail };
package/dist/react.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { D as DetailRef, a as DetailInstanceData, b as DetailPresentation, c as DetailRecordType, d as DetailStatus, e as DetailRow, f as DetailField, g as DetailSourceHealth, h as DetailFrameContext, i as DetailListContext, j as DetailLoadState, k as DetailOpenRequest } from './host-DdaWXBin.js';
2
- export { l as DetailDockedShellProps, m as DetailEffectivePresentation, n as DetailHostPorts, o as DetailHostProvider, p as DetailPageShellProps, q as DetailPresentationSetting, r as DetailShellSlots, s as DetailShells, t as DetailWindowShellProps, u as requireResolveType, v as requireShell, w as useDetailHost } from './host-DdaWXBin.js';
1
+ import { D as DetailRef, a as DetailInstanceData, b as DetailPresentation, c as DetailRecordType, d as DetailStatus, e as DetailRow, f as DetailField, g as DetailSourceHealth, h as DetailFrameContext, i as DetailListContext, j as DetailLoadState, k as DetailOpenRequest, l as DetailMenuAction } from './host-DrnEXBfp.js';
2
+ export { m as DetailDockedShellProps, n as DetailEffectivePresentation, o as DetailHostPorts, p as DetailHostProvider, q as DetailPageShellProps, r as DetailPresentationSetting, s as DetailShellSlots, t as DetailShells, u as DetailWindowShellProps, v as requireResolveType, w as requireShell, x as useDetailHost } from './host-DrnEXBfp.js';
3
3
  import * as react from 'react';
4
4
  import { KeyboardEvent } from 'react';
5
5
 
@@ -148,8 +148,19 @@ declare function DetailTitle({ core }: {
148
148
  declare function DetailRecordMeta({ core }: {
149
149
  core: DetailCore;
150
150
  }): react.JSX.Element;
151
- declare function DetailActions({ core }: {
151
+ /**
152
+ * The optional controls as data — the same actions the overflow menu offers —
153
+ * for a shell whose chrome has its own menu (a canvas tab's one "⋮").
154
+ */
155
+ declare function useDetailMenuActions(core: DetailCore): DetailMenuAction[];
156
+ /**
157
+ * Previous / next, the counter, and — unless `optional="none"` (the shell
158
+ * offers `menuActions` in its own menu) — the optional controls, which fold
159
+ * into one overflow button in a narrow header.
160
+ */
161
+ declare function DetailActions({ core, optional }: {
152
162
  core: DetailCore;
163
+ optional?: "inline" | "none";
153
164
  }): react.JSX.Element;
154
165
 
155
166
  declare function DetailBody({ core }: {
@@ -188,4 +199,4 @@ declare const DETAIL_HEADER_COMPACT_BELOW = "@max-[26rem]/window-header";
188
199
  /** The floor under the record's name: ~96px, enough for a readable fragment. */
189
200
  declare const DETAIL_TITLE_MIN_WIDTH_CLASS = "min-w-[6rem]";
190
201
 
191
- export { DETAIL_HEADER_COMPACT_BELOW, DETAIL_HEADER_CONTAINER, DETAIL_TITLE_MIN_WIDTH_CLASS, DetailActions, DetailBody, type DetailCore, DetailDockedPresentation, type DetailKeyboard, type DetailKeyboardHandlers, DetailPagePresentation, DetailPresentationPane, type DetailPresentationProps, DetailRecordMeta, DetailTitle, DetailWindowPresentation, type OpenDetail, type UseDetailHealthArgs, reconnectFor, useDetailCore, useDetailHealth, useDetailKeyboard, useDetailRecord, useOpenDetail };
202
+ export { DETAIL_HEADER_COMPACT_BELOW, DETAIL_HEADER_CONTAINER, DETAIL_TITLE_MIN_WIDTH_CLASS, DetailActions, DetailBody, type DetailCore, DetailDockedPresentation, type DetailKeyboard, type DetailKeyboardHandlers, DetailMenuAction, DetailPagePresentation, DetailPresentationPane, type DetailPresentationProps, DetailRecordMeta, DetailTitle, DetailWindowPresentation, type OpenDetail, type UseDetailHealthArgs, reconnectFor, useDetailCore, useDetailHealth, useDetailKeyboard, useDetailMenuActions, useDetailRecord, useOpenDetail };
package/dist/react.js CHANGED
@@ -714,7 +714,27 @@ function DetailRecordMeta({ core }) {
714
714
  }
715
715
  );
716
716
  }
717
- function DetailActions({ core }) {
717
+ function useDetailMenuActions(core) {
718
+ const host = useDetailHost();
719
+ return [
720
+ ...PRESENTATIONS.filter((p) => p.value !== core.presentation).map(({ value, label }) => ({
721
+ id: `detail-open-${value}`,
722
+ label,
723
+ onSelect: () => core.switchTo(value)
724
+ })),
725
+ {
726
+ id: "detail-copy-id",
727
+ label: "Copy record id",
728
+ onSelect: () => {
729
+ void host.copyText(core.ref.id).then((ok) => {
730
+ if (ok) host.notify.success("Record id copied");
731
+ else host.notify.error("Could not copy the record id to the clipboard.");
732
+ });
733
+ }
734
+ }
735
+ ];
736
+ }
737
+ function DetailActions({ core, optional = "inline" }) {
718
738
  const host = useDetailHost();
719
739
  const [copied, setCopied] = useState3(false);
720
740
  const [menuOpen, setMenuOpen] = useState3(false);
@@ -779,98 +799,100 @@ function DetailActions({ core }) {
779
799
  ),
780
800
  /* @__PURE__ */ jsx3("span", { className: "mx-1 h-4 w-px bg-border", "aria-hidden": true })
781
801
  ] }) : null,
782
- /* @__PURE__ */ jsxs2(
783
- "span",
784
- {
785
- className: "flex items-center gap-0.5 @max-[26rem]/window-header:hidden",
786
- "data-detail-actions-collapsible": true,
787
- children: [
788
- others.map(({ value, label, Icon }) => /* @__PURE__ */ jsx3(
789
- "button",
790
- {
791
- type: "button",
792
- className: ICON_BUTTON,
793
- onClick: () => core.switchTo(value),
794
- "aria-label": label,
795
- title: label,
796
- children: /* @__PURE__ */ jsx3(Icon, { className: "h-4 w-4" })
797
- },
798
- value
799
- )),
800
- /* @__PURE__ */ jsx3(
801
- "button",
802
- {
803
- type: "button",
804
- onClick: () => void copyId(),
805
- className: ICON_BUTTON,
806
- "aria-label": "Copy record id",
807
- title: "Copy record id",
808
- "data-detail-copy-id": true,
809
- children: copied ? /* @__PURE__ */ jsx3(CheckIcon, { className: "h-3.5 w-3.5 text-primary" }) : /* @__PURE__ */ jsx3(CopyIcon, { className: "h-3.5 w-3.5" })
810
- }
811
- )
812
- ]
813
- }
814
- ),
815
- /* @__PURE__ */ jsxs2("span", { className: "relative hidden @max-[26rem]/window-header:inline-flex", ref: menuRef, children: [
816
- /* @__PURE__ */ jsx3(
817
- "button",
802
+ optional === "none" ? null : /* @__PURE__ */ jsxs2(Fragment2, { children: [
803
+ /* @__PURE__ */ jsxs2(
804
+ "span",
818
805
  {
819
- type: "button",
820
- className: cn(ICON_BUTTON, "hidden @max-[26rem]/window-header:inline-flex"),
821
- onClick: () => setMenuOpen((wasOpen) => !wasOpen),
822
- "aria-label": "More record actions",
823
- title: "More record actions",
824
- "aria-haspopup": "menu",
825
- "aria-expanded": menuOpen,
826
- "data-detail-actions-overflow": true,
827
- children: /* @__PURE__ */ jsx3(MoreHorizontalIcon, { className: "h-4 w-4" })
828
- }
829
- ),
830
- menuOpen ? /* @__PURE__ */ jsxs2(
831
- "div",
832
- {
833
- role: "menu",
834
- "aria-label": "Record actions",
835
- className: "absolute right-0 top-full z-50 mt-1 min-w-44 rounded-md border border-border bg-card p-1 shadow-md",
836
- "data-detail-actions-menu": true,
806
+ className: "flex items-center gap-0.5 @max-[26rem]/window-header:hidden",
807
+ "data-detail-actions-collapsible": true,
837
808
  children: [
838
- others.map(({ value, label, Icon }) => /* @__PURE__ */ jsxs2(
809
+ others.map(({ value, label, Icon }) => /* @__PURE__ */ jsx3(
839
810
  "button",
840
811
  {
841
812
  type: "button",
842
- role: "menuitem",
843
- className: MENU_ITEM,
844
- onClick: () => {
845
- setMenuOpen(false);
846
- core.switchTo(value);
847
- },
848
- children: [
849
- /* @__PURE__ */ jsx3(Icon, { className: "h-3.5 w-3.5 shrink-0" }),
850
- label
851
- ]
813
+ className: ICON_BUTTON,
814
+ onClick: () => core.switchTo(value),
815
+ "aria-label": label,
816
+ title: label,
817
+ children: /* @__PURE__ */ jsx3(Icon, { className: "h-4 w-4" })
852
818
  },
853
819
  value
854
820
  )),
855
- /* @__PURE__ */ jsxs2(
821
+ /* @__PURE__ */ jsx3(
856
822
  "button",
857
823
  {
858
824
  type: "button",
859
- role: "menuitem",
860
- className: MENU_ITEM,
861
- onClick: () => {
862
- setMenuOpen(false);
863
- void copyId();
864
- },
865
- children: [
866
- /* @__PURE__ */ jsx3(CopyIcon, { className: "h-3.5 w-3.5 shrink-0" }),
867
- "Copy record id"
868
- ]
825
+ onClick: () => void copyId(),
826
+ className: ICON_BUTTON,
827
+ "aria-label": "Copy record id",
828
+ title: "Copy record id",
829
+ "data-detail-copy-id": true,
830
+ children: copied ? /* @__PURE__ */ jsx3(CheckIcon, { className: "h-3.5 w-3.5 text-primary" }) : /* @__PURE__ */ jsx3(CopyIcon, { className: "h-3.5 w-3.5" })
869
831
  }
870
832
  )
871
833
  ]
872
834
  }
873
- ) : null
835
+ ),
836
+ /* @__PURE__ */ jsxs2("span", { className: "relative hidden @max-[26rem]/window-header:inline-flex", ref: menuRef, children: [
837
+ /* @__PURE__ */ jsx3(
838
+ "button",
839
+ {
840
+ type: "button",
841
+ className: cn(ICON_BUTTON, "hidden @max-[26rem]/window-header:inline-flex"),
842
+ onClick: () => setMenuOpen((wasOpen) => !wasOpen),
843
+ "aria-label": "More record actions",
844
+ title: "More record actions",
845
+ "aria-haspopup": "menu",
846
+ "aria-expanded": menuOpen,
847
+ "data-detail-actions-overflow": true,
848
+ children: /* @__PURE__ */ jsx3(MoreHorizontalIcon, { className: "h-4 w-4" })
849
+ }
850
+ ),
851
+ menuOpen ? /* @__PURE__ */ jsxs2(
852
+ "div",
853
+ {
854
+ role: "menu",
855
+ "aria-label": "Record actions",
856
+ className: "absolute right-0 top-full z-50 mt-1 min-w-44 rounded-md border border-border bg-card p-1 shadow-md",
857
+ "data-detail-actions-menu": true,
858
+ children: [
859
+ others.map(({ value, label, Icon }) => /* @__PURE__ */ jsxs2(
860
+ "button",
861
+ {
862
+ type: "button",
863
+ role: "menuitem",
864
+ className: MENU_ITEM,
865
+ onClick: () => {
866
+ setMenuOpen(false);
867
+ core.switchTo(value);
868
+ },
869
+ children: [
870
+ /* @__PURE__ */ jsx3(Icon, { className: "h-3.5 w-3.5 shrink-0" }),
871
+ label
872
+ ]
873
+ },
874
+ value
875
+ )),
876
+ /* @__PURE__ */ jsxs2(
877
+ "button",
878
+ {
879
+ type: "button",
880
+ role: "menuitem",
881
+ className: MENU_ITEM,
882
+ onClick: () => {
883
+ setMenuOpen(false);
884
+ void copyId();
885
+ },
886
+ children: [
887
+ /* @__PURE__ */ jsx3(CopyIcon, { className: "h-3.5 w-3.5 shrink-0" }),
888
+ "Copy record id"
889
+ ]
890
+ }
891
+ )
892
+ ]
893
+ }
894
+ ) : null
895
+ ] })
874
896
  ] })
875
897
  ] });
876
898
  }
@@ -1411,6 +1433,13 @@ function HistorySection({ core }) {
1411
1433
  )) })
1412
1434
  ] });
1413
1435
  }
1436
+ function CustomFieldsPort({ core }) {
1437
+ const host = useDetailHost();
1438
+ const Section = host.customFields?.Section;
1439
+ const token = core.entityToken;
1440
+ if (!Section || !token) return null;
1441
+ return /* @__PURE__ */ jsx5(Section, { token, id: core.ref.id });
1442
+ }
1414
1443
  function DetailBody({ core }) {
1415
1444
  const extra = core.recordType?.extraSections && core.frameCtx ? core.recordType.extraSections(core.row, core.frameCtx) : [];
1416
1445
  const Frame = core.recordType?.Frame ?? null;
@@ -1424,6 +1453,7 @@ function DetailBody({ core }) {
1424
1453
  /* @__PURE__ */ jsxs4("div", { className: "space-y-6 p-4", children: [
1425
1454
  /* @__PURE__ */ jsx5(FieldsSection, { core }),
1426
1455
  core.status === "ready" || core.status === "none" ? /* @__PURE__ */ jsxs4(Fragment3, { children: [
1456
+ /* @__PURE__ */ jsx5(CustomFieldsPort, { core }),
1427
1457
  /* @__PURE__ */ jsx5(AssociationsSection, { core }),
1428
1458
  /* @__PURE__ */ jsx5(HistorySection, { core }),
1429
1459
  extra.map((section) => /* @__PURE__ */ jsxs4("section", { className: "space-y-2", "data-detail-section": section.id, children: [
@@ -1503,6 +1533,7 @@ function KeyboardRoot({ core, children }) {
1503
1533
  function DetailWindowPresentation({ data, onClose }) {
1504
1534
  const host = useDetailHost();
1505
1535
  const core = useDetailCore(data, "window", { onClose });
1536
+ const menuActions = useDetailMenuActions(core);
1506
1537
  const Shell = requireShell(host.shells, "Window");
1507
1538
  return /* @__PURE__ */ jsx6(
1508
1539
  Shell,
@@ -1513,6 +1544,8 @@ function DetailWindowPresentation({ data, onClose }) {
1513
1544
  title: core.title,
1514
1545
  titleNode: /* @__PURE__ */ jsx6(KeyboardSlot, { core, children: /* @__PURE__ */ jsx6(DetailTitle, { core }) }),
1515
1546
  actions: /* @__PURE__ */ jsx6(KeyboardActionsSlot, { core, children: /* @__PURE__ */ jsx6(DetailActions, { core }) }),
1547
+ navActions: /* @__PURE__ */ jsx6(KeyboardActionsSlot, { core, children: /* @__PURE__ */ jsx6(DetailActions, { core, optional: "none" }) }),
1548
+ menuActions,
1516
1549
  onClose: core.close,
1517
1550
  children: /* @__PURE__ */ jsx6(KeyboardRoot, { core, children: /* @__PURE__ */ jsx6(DetailBody, { core }) })
1518
1551
  }
@@ -1521,6 +1554,7 @@ function DetailWindowPresentation({ data, onClose }) {
1521
1554
  function DetailDockedPresentation({ data, onClose }) {
1522
1555
  const host = useDetailHost();
1523
1556
  const core = useDetailCore(data, "docked", { onClose });
1557
+ const menuActions = useDetailMenuActions(core);
1524
1558
  const Shell = requireShell(host.shells, "Docked");
1525
1559
  return /* @__PURE__ */ jsx6(
1526
1560
  Shell,
@@ -1530,6 +1564,8 @@ function DetailDockedPresentation({ data, onClose }) {
1530
1564
  title: core.title,
1531
1565
  titleNode: /* @__PURE__ */ jsx6(KeyboardSlot, { core, children: /* @__PURE__ */ jsx6(DetailTitle, { core }) }),
1532
1566
  actions: /* @__PURE__ */ jsx6(KeyboardActionsSlot, { core, children: /* @__PURE__ */ jsx6(DetailActions, { core }) }),
1567
+ navActions: /* @__PURE__ */ jsx6(KeyboardActionsSlot, { core, children: /* @__PURE__ */ jsx6(DetailActions, { core, optional: "none" }) }),
1568
+ menuActions,
1533
1569
  onClose: core.close,
1534
1570
  children: /* @__PURE__ */ jsx6(KeyboardRoot, { core, children: /* @__PURE__ */ jsx6(DetailBody, { core }) })
1535
1571
  }
@@ -1538,6 +1574,7 @@ function DetailDockedPresentation({ data, onClose }) {
1538
1574
  function DetailPagePresentation({ data }) {
1539
1575
  const host = useDetailHost();
1540
1576
  const core = useDetailCore(data, "page", {});
1577
+ const menuActions = useDetailMenuActions(core);
1541
1578
  const Shell = requireShell(host.shells, "Page");
1542
1579
  return /* @__PURE__ */ jsx6(
1543
1580
  Shell,
@@ -1546,6 +1583,8 @@ function DetailPagePresentation({ data }) {
1546
1583
  title: core.title,
1547
1584
  titleNode: /* @__PURE__ */ jsx6(KeyboardSlot, { core, children: /* @__PURE__ */ jsx6(DetailTitle, { core }) }),
1548
1585
  actions: /* @__PURE__ */ jsx6(KeyboardActionsSlot, { core, children: /* @__PURE__ */ jsx6(DetailActions, { core }) }),
1586
+ navActions: /* @__PURE__ */ jsx6(KeyboardActionsSlot, { core, children: /* @__PURE__ */ jsx6(DetailActions, { core, optional: "none" }) }),
1587
+ menuActions,
1549
1588
  onClose: core.close,
1550
1589
  onBack: core.leave,
1551
1590
  children: /* @__PURE__ */ jsx6(KeyboardRoot, { core, children: /* @__PURE__ */ jsx6(DetailBody, { core }) })
@@ -1577,6 +1616,7 @@ export {
1577
1616
  useDetailHealth,
1578
1617
  useDetailHost,
1579
1618
  useDetailKeyboard,
1619
+ useDetailMenuActions,
1580
1620
  useDetailRecord,
1581
1621
  useOpenDetail
1582
1622
  };