@ai-matrx/detail 0.1.176 → 0.1.178

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, l as DetailMenuAction } from './host-DTqudYIw.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-DTqudYIw.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-B6yGRMky.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-B6yGRMky.cjs';
3
3
  import * as react from 'react';
4
4
  import { KeyboardEvent } from 'react';
5
5
 
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, l as DetailMenuAction } from './host-DTqudYIw.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-DTqudYIw.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-B6yGRMky.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-B6yGRMky.js';
3
3
  import * as react from 'react';
4
4
  import { KeyboardEvent } from 'react';
5
5
 
package/dist/react.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  requireResolveType,
5
5
  requireShell,
6
6
  useDetailHost
7
- } from "./chunk-D62JZJMB.js";
7
+ } from "./chunk-OZZG6JAG.js";
8
8
 
9
9
  // src/react/useDetailCore.ts
10
10
  import { useEffect as useEffect3 } from "react";
@@ -363,9 +363,7 @@ function useDetailCore(data, presentation, options) {
363
363
  onNext: hasNext ? () => openNeighbour(1) : null,
364
364
  // 🚨 NEW-22 — Cmd+Enter is one of the three promised bindings; on a record
365
365
  // with no editor open it ANSWERS rather than doing nothing in silence.
366
- onSaveUnavailable: () => host.notify.error(
367
- `There is nothing to save on this ${typeLabel.toLowerCase()} \u2014 nothing here is being edited. Changes to the record are made where it lives.`
368
- )
366
+ onSaveUnavailable: () => host.notify.error("Nothing to save", { description: `Edit this ${typeLabel.toLowerCase()} where it lives` })
369
367
  });
370
368
  return {
371
369
  ref,
@@ -429,9 +427,7 @@ function useOpenDetail(warmType) {
429
427
  } catch (error) {
430
428
  const message = error instanceof Error ? error.message : String(error);
431
429
  console.error(`[detail] ${DETAIL_PRESENTATION_KNOB} could not be resolved`, error);
432
- host.notify.error(
433
- `Your detail presentation setting could not be read (${DETAIL_PRESENTATION_KNOB}: ${message}). Opening as a window until it can be read; an administrator can register or repair the setting.`
434
- );
430
+ host.notify.error("Opened as a window", { description: "Detail setting couldn't be read" });
435
431
  presentation = "window";
436
432
  }
437
433
  }
@@ -561,7 +557,7 @@ function useDetailMenuActions(core) {
561
557
  onSelect: () => {
562
558
  void host.copyText(core.ref.id).then((ok) => {
563
559
  if (ok) host.notify.success("Record id copied");
564
- else host.notify.error("Could not copy the record id to the clipboard.");
560
+ else host.notify.error("Record id not copied");
565
561
  });
566
562
  }
567
563
  }
@@ -574,7 +570,7 @@ function DetailActions({ core, optional = "inline" }) {
574
570
  const copyId = async () => {
575
571
  const ok = await host.copyText(core.ref.id);
576
572
  if (!ok) {
577
- host.notify.error("Could not copy the record id to the clipboard.");
573
+ host.notify.error("Record id not copied");
578
574
  return;
579
575
  }
580
576
  host.notify.success("Record id copied");
@@ -718,13 +714,9 @@ function DetailActions({ core, optional = "inline" }) {
718
714
  }
719
715
 
720
716
  // src/react/DetailBody.tsx
721
- import { useEffect as useEffect7, useRef as useRef6, useState as useState5 } from "react";
717
+ import { lazy, Suspense, useEffect as useEffect7, useRef as useRef6, useState as useState5 } from "react";
722
718
  import { cn as cn3, ErrorActions as ErrorActions2, Skeleton } from "@ai-matrx/design-system";
723
- import {
724
- ASSOCIATION_TARGET_TYPES,
725
- isEntityTypeToken
726
- } from "@ai-matrx/associations";
727
- import { AssociationCardGrid, PrimaryEntityProvider } from "@ai-matrx/associations/react";
719
+ import { ASSOCIATION_TARGET_TYPES } from "@ai-matrx/associations/contracts";
728
720
  import { formatDurationMs } from "@ai-matrx/kit/format";
729
721
 
730
722
  // src/format.ts
@@ -771,9 +763,9 @@ function DetailPresentationPane({ core }) {
771
763
  });
772
764
  if (result.ok) {
773
765
  setState({ status: "saved" });
774
- host.notify.success(
775
- forThisType ? `Every ${core.typeLabel.toLowerCase()} now opens as ${WORD[pending]} for you.` : `Record details now open as ${WORD[pending]} for you.`
776
- );
766
+ host.notify.success("Saved", {
767
+ description: forThisType ? `Every ${core.typeLabel.toLowerCase()} opens as ${WORD[pending]}` : `Details open as ${WORD[pending]}`
768
+ });
777
769
  } else {
778
770
  setState({ status: "refused", reason: result.reason });
779
771
  }
@@ -935,6 +927,7 @@ function DetailPresentationPane({ core }) {
935
927
  // src/react/DetailBody.tsx
936
928
  import { ExternalLinkIcon, RefreshCwIcon } from "@ai-matrx/design-system/icons";
937
929
  import { OutboundLink } from "@ai-matrx/kit/outbound-react";
930
+ import { peopleErrorSentence } from "@ai-matrx/design-system/error-sentence";
938
931
  import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
939
932
  var SLOW_LOAD_NOTICE_MS = 6e3;
940
933
  function useSlowLoadNotice(active, key) {
@@ -1001,9 +994,7 @@ function HealthStrip({ health }) {
1001
994
  try {
1002
995
  await health.onRefresh();
1003
996
  } catch (error) {
1004
- host.notify.error(
1005
- `Refresh from ${health.source} failed: ${error instanceof Error ? error.message : String(error)}`
1006
- );
997
+ host.notify.error("Not refreshed", { description: `${health.source}: ${peopleErrorSentence(error, null, { card: true })}` });
1007
998
  } finally {
1008
999
  setRefreshing(false);
1009
1000
  }
@@ -1166,18 +1157,28 @@ function LoadingFields({ core, label }) {
1166
1157
  function isAssociationTarget(token) {
1167
1158
  return ASSOCIATION_TARGET_TYPES.includes(token);
1168
1159
  }
1160
+ var loadDetailLinked = () => import("./DetailLinked-57SRZLYJ.js");
1161
+ var DetailLinked = lazy(loadDetailLinked);
1169
1162
  function AssociationsSection({ core }) {
1170
1163
  const host = useDetailHost();
1171
1164
  const token = core.entityToken;
1172
1165
  if (!token || !isAssociationTarget(token) || !host.associations.canAnchor(token)) return null;
1173
1166
  if (core.recordType?.associationTokens === null) return null;
1174
- const wanted = core.recordType?.associationTokens ?? host.associations.defaultTokens;
1175
- const tokens = wanted.filter((t) => t !== token).filter(isEntityTypeToken);
1176
- if (tokens.length === 0) return null;
1177
- return /* @__PURE__ */ jsxs3("section", { className: "space-y-2", "data-detail-section": "associations", children: [
1178
- /* @__PURE__ */ jsx3(SectionHeading, { icon: /* @__PURE__ */ jsx3(Link2Icon, { className: "h-3 w-3" }), children: "Linked" }),
1179
- /* @__PURE__ */ jsx3(PrimaryEntityProvider, { value: { type: token, id: core.ref.id, label: core.title }, children: /* @__PURE__ */ jsx3(AssociationCardGrid, { tokens }) })
1180
- ] });
1167
+ const wanted = (core.recordType?.associationTokens ?? host.associations.defaultTokens).filter(
1168
+ (t) => t !== token
1169
+ );
1170
+ if (wanted.length === 0) return null;
1171
+ const heading = /* @__PURE__ */ jsx3(SectionHeading, { icon: /* @__PURE__ */ jsx3(Link2Icon, { className: "h-3 w-3" }), children: "Linked" });
1172
+ return /* @__PURE__ */ jsx3(
1173
+ Suspense,
1174
+ {
1175
+ fallback: /* @__PURE__ */ jsxs3("section", { className: "space-y-2", "data-detail-section": "associations", "aria-busy": "true", children: [
1176
+ heading,
1177
+ /* @__PURE__ */ jsx3(Skeleton, { className: "h-16 w-full" })
1178
+ ] }),
1179
+ children: /* @__PURE__ */ jsx3(DetailLinked, { token, id: core.ref.id, label: core.title, wanted, heading })
1180
+ }
1181
+ );
1181
1182
  }
1182
1183
  var ACTOR_COLUMNS = ["actor_id", "user_id", "person_id", "created_by_id"];
1183
1184
  function HistorySection({ core }) {
@@ -1262,6 +1263,9 @@ function CustomFieldsPort({ core }) {
1262
1263
  return /* @__PURE__ */ jsx3(Section, { token, id: core.ref.id });
1263
1264
  }
1264
1265
  function DetailBody({ core }) {
1266
+ useEffect7(() => {
1267
+ loadDetailLinked().catch(() => void 0);
1268
+ }, []);
1265
1269
  const extra = core.recordType?.extraSections && core.frameCtx ? core.recordType.extraSections(core.row, core.frameCtx) : [];
1266
1270
  const Frame = core.recordType?.Frame ?? null;
1267
1271
  const body = (