@ai-matrx/detail 0.1.165 → 0.1.167

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.cjs CHANGED
@@ -584,14 +584,6 @@ var AlertCircleIcon = glyph(
584
584
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "12", x2: "12.01", y1: "16", y2: "16" })
585
585
  ] })
586
586
  );
587
- var ExternalLinkIcon = glyph(
588
- "external-link",
589
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
590
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M15 3h6v6" }),
591
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M10 14 21 3" }),
592
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" })
593
- ] })
594
- );
595
587
  var HistoryIcon = glyph(
596
588
  "history",
597
589
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
@@ -608,15 +600,6 @@ var Link2Icon = glyph(
608
600
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "8", x2: "16", y1: "12", y2: "12" })
609
601
  ] })
610
602
  );
611
- var RefreshCwIcon = glyph(
612
- "refresh-cw",
613
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
614
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" }),
615
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M21 3v5h-5" }),
616
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16" }),
617
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M8 16H3v5" })
618
- ] })
619
- );
620
603
  var SHIELD = "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z";
621
604
  var ShieldAlertIcon = glyph(
622
605
  "shield-alert",
@@ -633,25 +616,6 @@ var ShieldCheckIcon = glyph(
633
616
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m9 12 2 2 4-4" })
634
617
  ] })
635
618
  );
636
- var AppWindowIcon = glyph(
637
- "app-window",
638
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
639
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("rect", { x: "2", y: "4", width: "20", height: "16", rx: "2" }),
640
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M10 4v4" }),
641
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M2 8h20" }),
642
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M6 4v4" })
643
- ] })
644
- );
645
- var CheckIcon = glyph("check", /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M20 6 9 17l-5-5" }));
646
- var ChevronLeftIcon = glyph("chevron-left", /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m15 18-6-6 6-6" }));
647
- var ChevronRightIcon = glyph("chevron-right", /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m9 18 6-6-6-6" }));
648
- var CopyIcon = glyph(
649
- "copy",
650
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
651
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" }),
652
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })
653
- ] })
654
- );
655
619
  var ExpandIcon = glyph(
656
620
  "expand",
657
621
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
@@ -665,21 +629,6 @@ var ExpandIcon = glyph(
665
629
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M9 9 3 3" })
666
630
  ] })
667
631
  );
668
- var MoreHorizontalIcon = glyph(
669
- "more-horizontal",
670
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
671
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "12", cy: "12", r: "1" }),
672
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "19", cy: "12", r: "1" }),
673
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "5", cy: "12", r: "1" })
674
- ] })
675
- );
676
- var PanelRightIcon = glyph(
677
- "panel-right",
678
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
679
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }),
680
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M15 3v18" })
681
- ] })
682
- );
683
632
  var LoaderIcon = glyph("loader", /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" }));
684
633
  var Settings2Icon = glyph(
685
634
  "settings-2",
@@ -692,40 +641,49 @@ var Settings2Icon = glyph(
692
641
  );
693
642
 
694
643
  // src/react/DetailHeader.tsx
644
+ var import_icons2 = require("@ai-matrx/design-system/icons");
695
645
  var import_design_system = require("@ai-matrx/design-system");
696
646
  var import_jsx_runtime3 = require("react/jsx-runtime");
697
647
  var ICON_BUTTON = "inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-40 disabled:hover:bg-transparent pointer-coarse:h-10 pointer-coarse:w-10";
698
648
  var MENU_ITEM = "flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring pointer-coarse:py-2.5";
699
649
  var TYPE_CHIP = "shrink-0 rounded-full px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide ring-1 ring-inset";
700
650
  var PRESENTATIONS = [
701
- { value: "window", label: "Open as window", Icon: AppWindowIcon },
702
- { value: "docked", label: "Open docked to the side", Icon: PanelRightIcon },
651
+ { value: "window", label: "Open as window", Icon: import_icons2.AppWindowIcon },
652
+ { value: "docked", label: "Open docked to the side", Icon: import_icons2.PanelRightIcon },
703
653
  { value: "page", label: "Open as page", Icon: ExpandIcon }
704
654
  ];
705
655
  function TypeChip({ core, className }) {
706
- const accent = core.recordType?.accent ?? null;
656
+ const color = identityColor(core.recordType?.color);
657
+ const accent = color ? null : core.recordType?.accent ?? null;
707
658
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
708
659
  "span",
709
660
  {
710
661
  className: (0, import_design_system.cn)(
711
662
  TYPE_CHIP,
712
- accent?.bg ?? "bg-muted",
713
- accent?.text ?? "text-muted-foreground",
714
- accent?.ring ?? "ring-border",
663
+ color ? "text-foreground" : [accent?.bg ?? "bg-muted", accent?.text ?? "text-muted-foreground", accent?.ring ?? "ring-border"],
715
664
  className
716
665
  ),
666
+ style: color ? {
667
+ backgroundColor: `color-mix(in oklab, ${color} 14%, transparent)`,
668
+ ["--tw-ring-color"]: `color-mix(in oklab, ${color} 30%, transparent)`
669
+ } : void 0,
717
670
  "data-detail-type-chip": true,
718
671
  children: core.recordLabel
719
672
  }
720
673
  );
721
674
  }
675
+ var IDENTITY_HEX = /^#[0-9a-f]{6}$/i;
676
+ function identityColor(c) {
677
+ return c && IDENTITY_HEX.test(c) ? c : null;
678
+ }
722
679
  function DetailTitle({ core }) {
723
680
  const host = useDetailHost();
724
681
  const Icon = core.recordType?.icon ?? null;
682
+ const color = identityColor(core.recordType?.color);
725
683
  const accent = core.recordType?.accent ?? null;
726
684
  const RecordDoors = host.doors.RecordDoors;
727
685
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
728
- Icon ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon, { className: (0, import_design_system.cn)("h-4 w-4 shrink-0", accent?.text) }) : null,
686
+ Icon ? color ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "inline-flex shrink-0", style: { color }, "data-detail-identity-color": color, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon, { className: "h-4 w-4 shrink-0" }) }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon, { className: (0, import_design_system.cn)("h-4 w-4 shrink-0", accent?.text) }) : null,
729
687
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
730
688
  "span",
731
689
  {
@@ -823,7 +781,7 @@ function DetailActions({ core, optional = "inline" }) {
823
781
  disabled: !list.hasPrev,
824
782
  "aria-label": "Previous record (Up arrow, or left bracket)",
825
783
  title: "Previous record \u2191 or [",
826
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChevronLeftIcon, { className: "h-4 w-4" })
784
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons2.ChevronLeftIcon, { className: "h-4 w-4" })
827
785
  }
828
786
  ),
829
787
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "px-1 text-[11px] tabular-nums text-muted-foreground", children: [
@@ -840,7 +798,7 @@ function DetailActions({ core, optional = "inline" }) {
840
798
  disabled: !list.hasNext,
841
799
  "aria-label": "Next record (Down arrow, or right bracket)",
842
800
  title: "Next record \u2193 or ]",
843
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChevronRightIcon, { className: "h-4 w-4" })
801
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons2.ChevronRightIcon, { className: "h-4 w-4" })
844
802
  }
845
803
  ),
846
804
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "mx-1 h-4 w-px bg-border", "aria-hidden": true })
@@ -873,7 +831,7 @@ function DetailActions({ core, optional = "inline" }) {
873
831
  "aria-label": "Copy record id",
874
832
  title: "Copy record id",
875
833
  "data-detail-copy-id": true,
876
- children: copied ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CheckIcon, { className: "h-3.5 w-3.5 text-primary" }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CopyIcon, { className: "h-3.5 w-3.5" })
834
+ children: copied ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons2.CheckIcon, { className: "h-3.5 w-3.5 text-primary" }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons2.CopyIcon, { className: "h-3.5 w-3.5" })
877
835
  }
878
836
  )
879
837
  ]
@@ -891,7 +849,7 @@ function DetailActions({ core, optional = "inline" }) {
891
849
  "aria-haspopup": "menu",
892
850
  "aria-expanded": menuOpen,
893
851
  "data-detail-actions-overflow": true,
894
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(MoreHorizontalIcon, { className: "h-4 w-4" })
852
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons2.MoreHorizontalIcon, { className: "h-4 w-4" })
895
853
  }
896
854
  ),
897
855
  menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
@@ -930,7 +888,7 @@ function DetailActions({ core, optional = "inline" }) {
930
888
  void copyId();
931
889
  },
932
890
  children: [
933
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CopyIcon, { className: "h-3.5 w-3.5 shrink-0" }),
891
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons2.CopyIcon, { className: "h-3.5 w-3.5 shrink-0" }),
934
892
  "Copy record id"
935
893
  ]
936
894
  }
@@ -961,6 +919,7 @@ function formatWhen(iso) {
961
919
  // src/react/DetailPresentationPane.tsx
962
920
  var import_react8 = require("react");
963
921
  var import_design_system2 = require("@ai-matrx/design-system");
922
+ var import_icons4 = require("@ai-matrx/design-system/icons");
964
923
  var import_jsx_runtime4 = require("react/jsx-runtime");
965
924
  var WORD = {
966
925
  window: "a window",
@@ -1123,7 +1082,7 @@ function DetailPresentationPane({ core }) {
1123
1082
  disabled: state.status === "saving",
1124
1083
  className: "inline-flex items-center gap-1 rounded-md bg-primary px-2.5 py-1 text-xs text-primary-foreground transition-colors hover:bg-primary/90 disabled:opacity-60 pointer-coarse:py-2",
1125
1084
  children: [
1126
- state.status === "saving" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(LoaderIcon, { className: "h-3 w-3 animate-spin" }) : state.status === "saved" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CheckIcon, { className: "h-3 w-3" }) : null,
1085
+ state.status === "saving" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(LoaderIcon, { className: "h-3 w-3 animate-spin" }) : state.status === "saved" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons4.CheckIcon, { className: "h-3 w-3" }) : null,
1127
1086
  "Save"
1128
1087
  ]
1129
1088
  }
@@ -1155,6 +1114,7 @@ function DetailPresentationPane({ core }) {
1155
1114
  }
1156
1115
 
1157
1116
  // src/react/DetailBody.tsx
1117
+ var import_icons6 = require("@ai-matrx/design-system/icons");
1158
1118
  var import_outbound_react = require("@ai-matrx/kit/outbound-react");
1159
1119
  var import_jsx_runtime5 = require("react/jsx-runtime");
1160
1120
  var SLOW_LOAD_NOTICE_MS = 6e3;
@@ -1262,7 +1222,7 @@ function HealthStrip({ health }) {
1262
1222
  disabled: refreshing,
1263
1223
  className: "inline-flex h-6 items-center gap-1 rounded px-1.5 hover:bg-accent hover:text-foreground disabled:opacity-50 pointer-coarse:h-10",
1264
1224
  children: [
1265
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RefreshCwIcon, { className: (0, import_design_system3.cn)("h-3 w-3", refreshing && "animate-spin") }),
1225
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_icons6.RefreshCwIcon, { className: (0, import_design_system3.cn)("h-3 w-3", refreshing && "animate-spin") }),
1266
1226
  "Refresh"
1267
1227
  ]
1268
1228
  }
@@ -1282,7 +1242,7 @@ function HealthStrip({ health }) {
1282
1242
  href: health.openAtSourceHref,
1283
1243
  className: "inline-flex h-6 items-center gap-1 rounded px-1.5 hover:bg-accent hover:text-foreground pointer-coarse:h-10",
1284
1244
  children: [
1285
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ExternalLinkIcon, { className: "h-3 w-3" }),
1245
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_icons6.ExternalLinkIcon, { className: "h-3 w-3" }),
1286
1246
  health.openAtSourceLabel ?? deriveOpenAtSourceLabel(health.source)
1287
1247
  ]
1288
1248
  }