@ai-matrx/records-ui 0.101.31 → 0.101.33

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog — @ai-matrx/records-ui
2
2
 
3
+ ## 0.101.33
4
+
5
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
6
+ `git diff npm/records-ui/v0.101.31..npm/records-ui/v0.101.33 -- apps/shared/records-ui`).
7
+ No source changes intended and no consumer action required.
8
+
9
+ ## 0.101.32
10
+
11
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
12
+ `git diff npm/records-ui/v0.101.31..npm/records-ui/v0.101.32 -- apps/shared/records-ui`).
13
+ No source changes intended and no consumer action required.
14
+
3
15
  ## 0.101.31
4
16
 
5
17
  Automatic changed-only republish (docs/metadata drift since the last tag — see
package/dist/index.cjs CHANGED
@@ -2368,10 +2368,10 @@ function shown(value) {
2368
2368
  if (typeof value === "number" || typeof value === "boolean") return String(value);
2369
2369
  return null;
2370
2370
  }
2371
- function tellApart(rows, nameOf) {
2371
+ function tellApart(rows, nameOf2) {
2372
2372
  const byName = /* @__PURE__ */ new Map();
2373
2373
  for (const row of rows) {
2374
- const name = nameOf(row.id).trim().toLowerCase();
2374
+ const name = nameOf2(row.id).trim().toLowerCase();
2375
2375
  byName.set(name, [...byName.get(name) ?? [], row]);
2376
2376
  }
2377
2377
  const out = /* @__PURE__ */ new Map();
@@ -2979,6 +2979,7 @@ function RecordLabelProvider({ children }) {
2979
2979
  const client = (0, import_react14.useRecordsClient)();
2980
2980
  const [names, setNames] = (0, import_react13.useState)({});
2981
2981
  const [archivedRefs, setArchivedRefs] = (0, import_react13.useState)({});
2982
+ const [iconsOf, setIconsOf] = (0, import_react13.useState)({});
2982
2983
  const [settled, setSettled] = (0, import_react13.useState)({});
2983
2984
  const [waitingLines, setWaitingLines] = (0, import_react13.useState)({});
2984
2985
  const asked3 = (0, import_react13.useRef)(/* @__PURE__ */ new Set());
@@ -3061,6 +3062,7 @@ function RecordLabelProvider({ children }) {
3061
3062
  void (async () => {
3062
3063
  const learned = {};
3063
3064
  const archivedNow = {};
3065
+ const iconsNow = {};
3064
3066
  await Promise.all(
3065
3067
  batch.map(async ({ field: field2, ids }) => {
3066
3068
  const wanted = [...ids];
@@ -3073,10 +3075,12 @@ function RecordLabelProvider({ children }) {
3073
3075
  learned[id] = !result.ok ? UNREAD_RECORD_LABEL : typeof words2 === "string" && words2 !== "" ? words2 : WITHHELD_RECORD_LABEL;
3074
3076
  }
3075
3077
  if (result.ok) for (const id of result.archived ?? []) archivedNow[`${field2.id}:${id}`] = true;
3078
+ if (result.ok) for (const [id, pair] of Object.entries(result.icons ?? {})) iconsNow[id] = pair;
3076
3079
  })
3077
3080
  );
3078
3081
  setNames((current) => ({ ...current, ...learned }));
3079
3082
  if (Object.keys(archivedNow).length > 0) setArchivedRefs((current) => ({ ...current, ...archivedNow }));
3083
+ if (Object.keys(iconsNow).length > 0) setIconsOf((current) => ({ ...current, ...iconsNow }));
3080
3084
  for (const { field: field2 } of batch) stopWaitClock(field2.id);
3081
3085
  })();
3082
3086
  }, [client, stopWaitClock]);
@@ -3124,9 +3128,10 @@ function RecordLabelProvider({ children }) {
3124
3128
  () => {
3125
3129
  const answer = ((field2, id) => lookupWords(field2, id));
3126
3130
  answer.archived = (field2, id) => archivedRefs[`${field2.id}:${id}`] === true;
3131
+ answer.icons = (_field, id) => iconsOf[id];
3127
3132
  return answer;
3128
3133
  },
3129
- [lookupWords, archivedRefs]
3134
+ [lookupWords, archivedRefs, iconsOf]
3130
3135
  );
3131
3136
  const waiting = (0, import_react13.useCallback)((field2) => waitingLines[field2.id] ?? null, [waitingLines]);
3132
3137
  const value = (0, import_react13.useMemo)(() => ({ lookup, want, waiting }), [lookup, want, waiting]);
@@ -5986,6 +5991,20 @@ function kindLabel(kind) {
5986
5991
 
5987
5992
  // src/ReferenceChips.tsx
5988
5993
  var import_jsx_runtime22 = require("react/jsx-runtime");
5994
+ function glyphOf(icon) {
5995
+ const text = (icon ?? "").trim();
5996
+ return text !== "" && text.length <= 8 && /[^\u0000-\u007f]/.test(text) ? text : null;
5997
+ }
5998
+ function nameOf(icon) {
5999
+ const text = (icon ?? "").trim();
6000
+ return /^[A-Za-z][A-Za-z0-9_-]{1,40}$/.test(text) ? text : null;
6001
+ }
6002
+ function iconOf(pair) {
6003
+ const own3 = glyphOf(pair?.icon) ?? nameOf(pair?.icon);
6004
+ const table = glyphOf(pair?.tableIcon) ?? nameOf(pair?.tableIcon);
6005
+ const chosen = own3 ?? table;
6006
+ return chosen ? { icon: chosen } : {};
6007
+ }
5989
6008
  function referencesOf(field2, value, kind, labels) {
5990
6009
  if (kind === "entity_reference") {
5991
6010
  return (0, import_records13.entityRefsOf)(value).map((r) => ({ token: r.token, id: r.id, label: r.label }));
@@ -5997,6 +6016,7 @@ function referencesOf(field2, value, kind, labels) {
5997
6016
  id,
5998
6017
  label: labels?.(field2, id) ?? null,
5999
6018
  tableId,
6019
+ ...iconOf(labels?.icons?.(field2, id)),
6000
6020
  ...labels?.archived?.(field2, id) ? { archived: true } : {}
6001
6021
  }));
6002
6022
  }
@@ -6028,7 +6048,7 @@ function ReferenceChip({ reference, waiting }) {
6028
6048
  "data-records-reference-archived": reference.archived ? "" : void 0,
6029
6049
  title: reference.archived ? ARCHIVED_REFERENCE_TIP : words2,
6030
6050
  children: [
6031
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { "aria-hidden": "true", "data-records-reference-icon": "", className: "inline-flex size-4 shrink-0 items-center justify-center text-muted-foreground", children: reference.icon ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-sm leading-none", children: reference.icon }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(PageGlyph, {}) }),
6051
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { "aria-hidden": "true", "data-records-reference-icon": "", className: "inline-flex size-4 shrink-0 items-center justify-center text-muted-foreground", children: glyphOf(reference.icon) ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-sm leading-none", children: reference.icon }) : reference.icon && host.renderIcon?.(reference.icon) || /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(PageGlyph, {}) }),
6032
6052
  drawn ?? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "truncate", children: words2 }),
6033
6053
  reference.archived ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "shrink-0 text-muted-foreground", children: ARCHIVED_REFERENCE_WORD }) : null
6034
6054
  ]
@@ -16496,7 +16516,7 @@ function opensOnKey(event) {
16496
16516
  }
16497
16517
  return true;
16498
16518
  }
16499
- function withOpenRecord(columns, onOpen, nameOf, place = "end", hrefOf) {
16519
+ function withOpenRecord(columns, onOpen, nameOf2, place = "end", hrefOf) {
16500
16520
  if (!onOpen) return columns;
16501
16521
  return columns.map((column, index) => {
16502
16522
  const original = column.cell;
@@ -16506,8 +16526,8 @@ function withOpenRecord(columns, onOpen, nameOf, place = "end", hrefOf) {
16506
16526
  {
16507
16527
  type: "button",
16508
16528
  "data-records-open-record": row.id,
16509
- "aria-label": openRecordLabel(nameOf(row)),
16510
- title: `${openRecordLabel(nameOf(row))} (Space)`,
16529
+ "aria-label": openRecordLabel(nameOf2(row)),
16530
+ title: `${openRecordLabel(nameOf2(row))} (Space)`,
16511
16531
  className: "shrink-0 rounded px-1 text-xs leading-5 text-muted-foreground opacity-40 hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring group-hover/matrx-row:opacity-100",
16512
16532
  onClick: (event) => {
16513
16533
  event.stopPropagation();
@@ -45899,22 +45919,22 @@ function RailFrame({
45899
45919
  return /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("aside", { "data-rail-column": "", className: "w-[26rem] shrink-0 overflow-y-auto rounded-md border p-3", children });
45900
45920
  }
45901
45921
  function filterInWords(filter, fields) {
45902
- const nameOf = (key) => {
45922
+ const nameOf2 = (key) => {
45903
45923
  const field2 = fields.find((f) => f.key === key);
45904
45924
  return field2 ? fieldName(field2) : (0, import_text_case17.humanizeIdentifier)(key);
45905
45925
  };
45906
45926
  const parts = Object.keys(filter).map((key) => {
45907
45927
  const value = filter[key];
45908
- if (value === null || value === void 0) return `${nameOf(key)} is not filled in`;
45928
+ if (value === null || value === void 0) return `${nameOf2(key)} is not filled in`;
45909
45929
  if (typeof value === "object") {
45910
45930
  const from = (value.from ?? "").toString().trim();
45911
45931
  const to = (value.to ?? "").toString().trim();
45912
- if (from !== "" && to !== "") return `${nameOf(key)} from ${from} up to ${to}`;
45913
- if (from !== "") return `${nameOf(key)} from ${from} onwards`;
45914
- if (to !== "") return `${nameOf(key)} up to ${to}`;
45915
- return `${nameOf(key)} in a period nobody named`;
45932
+ if (from !== "" && to !== "") return `${nameOf2(key)} from ${from} up to ${to}`;
45933
+ if (from !== "") return `${nameOf2(key)} from ${from} onwards`;
45934
+ if (to !== "") return `${nameOf2(key)} up to ${to}`;
45935
+ return `${nameOf2(key)} in a period nobody named`;
45916
45936
  }
45917
- return `${nameOf(key)} is ${String(value)}`;
45937
+ return `${nameOf2(key)} is ${String(value)}`;
45918
45938
  });
45919
45939
  if (parts.length === 0) return "";
45920
45940
  if (parts.length === 1) return parts[0];