@ai-matrx/content-ir-react 0.20.1 → 0.21.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.
Files changed (39) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +1 -1
  3. package/dist/{component-resolution.types-DwKSF64x.d.cts → component-resolution.types-BQa2ik3i.d.cts} +1 -1
  4. package/dist/{component-resolution.types-DwKSF64x.d.ts → component-resolution.types-BQa2ik3i.d.ts} +1 -1
  5. package/dist/{component-resolution.types-DY4pGymy.d.cts → component-resolution.types-C_irCaHc.d.cts} +1 -1
  6. package/dist/{component-resolution.types-DY4pGymy.d.ts → component-resolution.types-C_irCaHc.d.ts} +1 -1
  7. package/dist/db-component.d.cts +1 -1
  8. package/dist/db-component.d.ts +1 -1
  9. package/dist/directives.cjs +57 -28
  10. package/dist/directives.cjs.map +1 -1
  11. package/dist/directives.d.cts +18 -3
  12. package/dist/directives.d.ts +18 -3
  13. package/dist/directives.js +38 -10
  14. package/dist/directives.js.map +1 -1
  15. package/dist/{host-types-BpcRcZ48.d.ts → host-types-CGcK8Nib.d.ts} +1 -1
  16. package/dist/{host-types-BRLk_J_3.d.cts → host-types-mMFt5-hQ.d.cts} +1 -1
  17. package/dist/host.d.cts +3 -3
  18. package/dist/host.d.ts +3 -3
  19. package/dist/index.cjs +72 -43
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.d.cts +23 -8
  22. package/dist/index.d.ts +23 -8
  23. package/dist/index.js +38 -10
  24. package/dist/index.js.map +1 -1
  25. package/dist/react.cjs +71 -44
  26. package/dist/react.cjs.map +1 -1
  27. package/dist/react.d.cts +3 -3
  28. package/dist/react.d.ts +3 -3
  29. package/dist/react.js +36 -10
  30. package/dist/react.js.map +1 -1
  31. package/dist/resolver.d.cts +2 -2
  32. package/dist/resolver.d.ts +2 -2
  33. package/dist/{route-CiCUQGAB.d.ts → route-Bq6db_zH.d.cts} +2 -2
  34. package/dist/{route-DMTBn8w4.d.cts → route-DStinBoZ.d.ts} +2 -2
  35. package/dist/route.cjs.map +1 -1
  36. package/dist/route.d.cts +2 -2
  37. package/dist/route.d.ts +2 -2
  38. package/dist/route.js.map +1 -1
  39. package/package.json +1 -1
@@ -119,10 +119,25 @@ declare function directiveFieldLabel(key: string, titleColumn: string | null | u
119
119
  * fields; null → the value as stored.
120
120
  */
121
121
  type DirectiveValueWord = (field: string, value: string) => string | null;
122
+ /**
123
+ * The name a NEW item carries, or null when it has none — the one rule the card
124
+ * and a host's confirm share. `itemTitle`'s last resort ("Item", "Item 2 of 3")
125
+ * is a placeholder, never a name: a create with an empty title used to ask
126
+ * "Create project Item?" and its card row read "Item" (G10B review, 2026-10-02).
127
+ */
128
+ declare function itemOwnName(item: Record<string, unknown>, titleColumn: string | null): string | null;
129
+ /** What a nameless new item is called — said as such, never a placeholder name. */
130
+ declare const NO_TITLE_WORD = "No title";
122
131
  /** How an empty value reads — before or after, on the card and in the confirm. */
123
132
  declare const EMPTY_VALUE_WORD = "None";
124
- /** A short, honest name for a record we could not look up: "Task 1a2b3c4d". */
125
- declare function recordFallbackName(nounLabel: string, id: string): string;
133
+ /**
134
+ * What a record is called when its name cannot be read: its TYPE ("Task").
135
+ * Never its id, in any slot — text, tooltip or screen-reader label. It used to
136
+ * be "Task a8a00001", and a link to a record that no longer exists hovered
137
+ * "Open Task a8a00001" (G10B review, 2026-10-02). The host says WHY the name is
138
+ * missing (not found, no access) beside it.
139
+ */
140
+ declare function recordFallbackName(nounLabel: string): string;
126
141
  /** One value as a row reads it: shortened, the whole of it, and whether it is empty. */
127
142
  interface ChangeValue {
128
143
  value: string;
@@ -263,4 +278,4 @@ declare function noteRecordChanged(id: string): void;
263
278
  declare function useRecordRevision(id: string): number;
264
279
  declare function useRecordValues(read: RecordReader | undefined, ref: DirectiveRecordRef | null): RecordValues;
265
280
 
266
- export { ApplyDirectiveButton, type ApplyDirectiveButtonProps, CHANGE_VALUE_MAX, type ChangeValue, type DirectiveApplyPhase, DirectiveChangeList, DirectiveFailure, DirectiveFailureWords, DirectiveFallbackCard, type DirectiveFallbackCardProps, DirectiveHost, DirectiveProvisionalCard, type DirectiveProvisionalCardProps, DirectiveRecordRef, DirectiveRender, type DirectiveRenderProps, type DirectiveRenderer, type DirectiveRendererProps, type DirectiveValueWord, EMPTY_VALUE_WORD, type ItemChange, type ItemChangesOptions, type RecordReader, type RecordValues, type RecordValuesStatus, SideEffectDirectiveCard, type SideEffectDirectiveCardProps, TARGETING_CLASSES, defaultFailureWords, describeChangeValue, directiveFieldLabel, directiveValueWord, failureWords, fieldLabel, getDirectiveRenderer, itemChanges, itemRecordId, noteRecordChanged, provisionalDirectiveSlug, readsApplyLedger, recordFallbackName, recordRevision, registerDirectiveRenderer, resetDirectiveRenderers, useRecordRevision, useRecordValues };
281
+ export { ApplyDirectiveButton, type ApplyDirectiveButtonProps, CHANGE_VALUE_MAX, type ChangeValue, type DirectiveApplyPhase, DirectiveChangeList, DirectiveFailure, DirectiveFailureWords, DirectiveFallbackCard, type DirectiveFallbackCardProps, DirectiveHost, DirectiveProvisionalCard, type DirectiveProvisionalCardProps, DirectiveRecordRef, DirectiveRender, type DirectiveRenderProps, type DirectiveRenderer, type DirectiveRendererProps, type DirectiveValueWord, EMPTY_VALUE_WORD, type ItemChange, type ItemChangesOptions, NO_TITLE_WORD, type RecordReader, type RecordValues, type RecordValuesStatus, SideEffectDirectiveCard, type SideEffectDirectiveCardProps, TARGETING_CLASSES, defaultFailureWords, describeChangeValue, directiveFieldLabel, directiveValueWord, failureWords, fieldLabel, getDirectiveRenderer, itemChanges, itemOwnName, itemRecordId, noteRecordChanged, provisionalDirectiveSlug, readsApplyLedger, recordFallbackName, recordRevision, registerDirectiveRenderer, resetDirectiveRenderers, useRecordRevision, useRecordValues };
@@ -119,10 +119,25 @@ declare function directiveFieldLabel(key: string, titleColumn: string | null | u
119
119
  * fields; null → the value as stored.
120
120
  */
121
121
  type DirectiveValueWord = (field: string, value: string) => string | null;
122
+ /**
123
+ * The name a NEW item carries, or null when it has none — the one rule the card
124
+ * and a host's confirm share. `itemTitle`'s last resort ("Item", "Item 2 of 3")
125
+ * is a placeholder, never a name: a create with an empty title used to ask
126
+ * "Create project Item?" and its card row read "Item" (G10B review, 2026-10-02).
127
+ */
128
+ declare function itemOwnName(item: Record<string, unknown>, titleColumn: string | null): string | null;
129
+ /** What a nameless new item is called — said as such, never a placeholder name. */
130
+ declare const NO_TITLE_WORD = "No title";
122
131
  /** How an empty value reads — before or after, on the card and in the confirm. */
123
132
  declare const EMPTY_VALUE_WORD = "None";
124
- /** A short, honest name for a record we could not look up: "Task 1a2b3c4d". */
125
- declare function recordFallbackName(nounLabel: string, id: string): string;
133
+ /**
134
+ * What a record is called when its name cannot be read: its TYPE ("Task").
135
+ * Never its id, in any slot — text, tooltip or screen-reader label. It used to
136
+ * be "Task a8a00001", and a link to a record that no longer exists hovered
137
+ * "Open Task a8a00001" (G10B review, 2026-10-02). The host says WHY the name is
138
+ * missing (not found, no access) beside it.
139
+ */
140
+ declare function recordFallbackName(nounLabel: string): string;
126
141
  /** One value as a row reads it: shortened, the whole of it, and whether it is empty. */
127
142
  interface ChangeValue {
128
143
  value: string;
@@ -263,4 +278,4 @@ declare function noteRecordChanged(id: string): void;
263
278
  declare function useRecordRevision(id: string): number;
264
279
  declare function useRecordValues(read: RecordReader | undefined, ref: DirectiveRecordRef | null): RecordValues;
265
280
 
266
- export { ApplyDirectiveButton, type ApplyDirectiveButtonProps, CHANGE_VALUE_MAX, type ChangeValue, type DirectiveApplyPhase, DirectiveChangeList, DirectiveFailure, DirectiveFailureWords, DirectiveFallbackCard, type DirectiveFallbackCardProps, DirectiveHost, DirectiveProvisionalCard, type DirectiveProvisionalCardProps, DirectiveRecordRef, DirectiveRender, type DirectiveRenderProps, type DirectiveRenderer, type DirectiveRendererProps, type DirectiveValueWord, EMPTY_VALUE_WORD, type ItemChange, type ItemChangesOptions, type RecordReader, type RecordValues, type RecordValuesStatus, SideEffectDirectiveCard, type SideEffectDirectiveCardProps, TARGETING_CLASSES, defaultFailureWords, describeChangeValue, directiveFieldLabel, directiveValueWord, failureWords, fieldLabel, getDirectiveRenderer, itemChanges, itemRecordId, noteRecordChanged, provisionalDirectiveSlug, readsApplyLedger, recordFallbackName, recordRevision, registerDirectiveRenderer, resetDirectiveRenderers, useRecordRevision, useRecordValues };
281
+ export { ApplyDirectiveButton, type ApplyDirectiveButtonProps, CHANGE_VALUE_MAX, type ChangeValue, type DirectiveApplyPhase, DirectiveChangeList, DirectiveFailure, DirectiveFailureWords, DirectiveFallbackCard, type DirectiveFallbackCardProps, DirectiveHost, DirectiveProvisionalCard, type DirectiveProvisionalCardProps, DirectiveRecordRef, DirectiveRender, type DirectiveRenderProps, type DirectiveRenderer, type DirectiveRendererProps, type DirectiveValueWord, EMPTY_VALUE_WORD, type ItemChange, type ItemChangesOptions, NO_TITLE_WORD, type RecordReader, type RecordValues, type RecordValuesStatus, SideEffectDirectiveCard, type SideEffectDirectiveCardProps, TARGETING_CLASSES, defaultFailureWords, describeChangeValue, directiveFieldLabel, directiveValueWord, failureWords, fieldLabel, getDirectiveRenderer, itemChanges, itemOwnName, itemRecordId, noteRecordChanged, provisionalDirectiveSlug, readsApplyLedger, recordFallbackName, recordRevision, registerDirectiveRenderer, resetDirectiveRenderers, useRecordRevision, useRecordValues };
@@ -48,8 +48,8 @@ import { useEffect as useEffect2, useRef, useState as useState2, useSyncExternal
48
48
  import { nounLabel } from "@ai-matrx/content-ir";
49
49
 
50
50
  // directives/item-changes.ts
51
- import { isUuidShape } from "@ai-matrx/kit/uuid";
52
51
  import { humanizeIdentifier } from "@ai-matrx/kit/text-case";
52
+ import { itemTitle } from "@ai-matrx/content-ir";
53
53
  var TARGETING_CLASSES = /* @__PURE__ */ new Set(["update", "delete"]);
54
54
  var NOT_A_CHANGE = /* @__PURE__ */ new Set(["__kind", "id"]);
55
55
  var CHANGE_VALUE_MAX = 280;
@@ -65,10 +65,14 @@ function fieldLabel(key) {
65
65
  function directiveFieldLabel(key, titleColumn) {
66
66
  return titleColumn && key === titleColumn ? "Title" : fieldLabel(key);
67
67
  }
68
+ function itemOwnName(item, titleColumn) {
69
+ const probe = itemTitle(item, titleColumn, 0, 2);
70
+ return probe === "Item 1 of 2" ? null : probe;
71
+ }
72
+ var NO_TITLE_WORD = "No title";
68
73
  var EMPTY_VALUE_WORD = "None";
69
- function recordFallbackName(nounLabel3, id) {
70
- const short = isUuidShape(id) ? id.slice(0, 8) : id.length > 12 ? `${id.slice(0, 12)}\u2026` : id;
71
- return `${nounLabel3} ${short}`;
74
+ function recordFallbackName(nounLabel3) {
75
+ return nounLabel3.trim() || "Record";
72
76
  }
73
77
  function describeChangeValue(value, word) {
74
78
  return describeValue(value, word);
@@ -570,7 +574,7 @@ function ApplyDirectiveButton({
570
574
  ) : null,
571
575
  records.map((record) => /* @__PURE__ */ jsx3("span", { className: "inline-flex min-w-0 items-center", children: host.renderRecord?.({
572
576
  ...record,
573
- fallback: recordFallbackName(label2, record.id),
577
+ fallback: recordFallbackName(label2),
574
578
  context: "applied",
575
579
  trashed
576
580
  }) }, `${record.noun}:${record.id}`)),
@@ -618,6 +622,14 @@ function ApplyDirectiveButton({
618
622
  }
619
623
  );
620
624
  }
625
+ const warm = () => {
626
+ const read2 = host.readRecord;
627
+ if (!read2 || !TARGETING_CLASSES.has(directive.directiveClass)) return;
628
+ for (const item of items) {
629
+ const id = itemRecordId(item);
630
+ if (id) void read2({ noun: directive.noun, id }).catch(() => null);
631
+ }
632
+ };
621
633
  const destructive = directive.directiveClass === "delete";
622
634
  const muted = nothingToChange && view.status === "idle";
623
635
  return /* @__PURE__ */ jsxs2("span", { className: "flex min-w-0 flex-wrap items-center justify-end gap-x-2 gap-y-1", children: [
@@ -627,6 +639,8 @@ function ApplyDirectiveButton({
627
639
  {
628
640
  type: "button",
629
641
  onClick: () => void handleApply(),
642
+ onPointerEnter: warm,
643
+ onFocus: warm,
630
644
  disabled: view.status === "applying" || view.status === "asking" || items.length === 0,
631
645
  "data-apply-tone": muted ? "muted" : destructive ? "destructive" : "default",
632
646
  title: muted ? "It sets no fields, so applying it changes nothing." : void 0,
@@ -705,7 +719,6 @@ import {
705
719
  directiveDisplay,
706
720
  itemFacts,
707
721
  itemSubtitle,
708
- itemTitle,
709
722
  nounLabel as nounLabel2,
710
723
  nounTitleColumn
711
724
  } from "@ai-matrx/content-ir";
@@ -732,7 +745,8 @@ function ItemRow({
732
745
  return /* @__PURE__ */ jsx4(TargetRow, { directive, item, recordId, index, phase });
733
746
  }
734
747
  const titleColumn = nounTitleColumn(directive.noun, host.nouns);
735
- const title = itemTitle(item, titleColumn, index, total);
748
+ const ownName = itemOwnName(item, titleColumn);
749
+ const title = ownName ?? NO_TITLE_WORD;
736
750
  const subtitle = itemSubtitle(item);
737
751
  const valueWord = directiveValueWord(host, directive.noun);
738
752
  const facts = itemFacts(titleColumn ? omitKey(item, titleColumn) : item).map((fact) => ({
@@ -744,7 +758,14 @@ function ItemRow({
744
758
  const display = directiveDisplay(directive.directiveClass, directive.noun, host.nouns);
745
759
  const openItem = host.openItem;
746
760
  const body = /* @__PURE__ */ jsxs3(Fragment, { children: [
747
- /* @__PURE__ */ jsx4("span", { className: "min-w-0 shrink-0 truncate font-medium text-foreground", children: title }),
761
+ /* @__PURE__ */ jsx4(
762
+ "span",
763
+ {
764
+ className: `min-w-0 shrink-0 truncate font-medium ${ownName ? "text-foreground" : "italic text-muted-foreground"}`,
765
+ "data-item-untitled": ownName ? void 0 : "",
766
+ children: title
767
+ }
768
+ ),
748
769
  /* @__PURE__ */ jsx4("span", { className: "hidden min-w-0 flex-1 items-baseline gap-2 overflow-hidden sm:flex", children: facts.map((fact) => /* @__PURE__ */ jsxs3("span", { className: "truncate text-[11px] text-muted-foreground", "data-item-fact": fact.key, children: [
749
770
  fact.label,
750
771
  " ",
@@ -773,7 +794,12 @@ function ItemRow({
773
794
  children: body
774
795
  }
775
796
  ) : /* @__PURE__ */ jsx4("span", { className: "flex min-w-0 flex-1 items-center gap-2 px-1 py-0.5", children: body }),
776
- host.renderCopy?.({ label: title, value: item, kind, size: "xs" })
797
+ host.renderCopy?.({
798
+ label: ownName ?? `this ${nounLabel2(directive.noun, host.nouns)}`,
799
+ value: item,
800
+ kind,
801
+ size: "xs"
802
+ })
777
803
  ] });
778
804
  }
779
805
  function DirectiveChangeList({
@@ -827,7 +853,7 @@ function TargetRow({
827
853
  phase
828
854
  }) {
829
855
  const host = useDirectiveHost();
830
- const fallback = recordFallbackName(nounLabel2(directive.noun, host.nouns), recordId);
856
+ const fallback = recordFallbackName(nounLabel2(directive.noun, host.nouns));
831
857
  const isUpdate = directive.directiveClass === "update";
832
858
  const readsLive = isUpdate && phase.phase === "open";
833
859
  const live = useRecordValues(
@@ -1026,6 +1052,7 @@ export {
1026
1052
  DirectiveRender,
1027
1053
  DirectiveScopeProvider,
1028
1054
  EMPTY_VALUE_WORD,
1055
+ NO_TITLE_WORD,
1029
1056
  SideEffectDirectiveCard,
1030
1057
  TARGETING_CLASSES,
1031
1058
  defaultFailureWords,
@@ -1036,6 +1063,7 @@ export {
1036
1063
  fieldLabel,
1037
1064
  getDirectiveRenderer,
1038
1065
  itemChanges,
1066
+ itemOwnName,
1039
1067
  itemRecordId,
1040
1068
  noteRecordChanged,
1041
1069
  provisionalDirectiveSlug,