@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.
- package/CHANGELOG.md +29 -0
- package/README.md +1 -1
- package/dist/{component-resolution.types-DwKSF64x.d.cts → component-resolution.types-BQa2ik3i.d.cts} +1 -1
- package/dist/{component-resolution.types-DwKSF64x.d.ts → component-resolution.types-BQa2ik3i.d.ts} +1 -1
- package/dist/{component-resolution.types-DY4pGymy.d.cts → component-resolution.types-C_irCaHc.d.cts} +1 -1
- package/dist/{component-resolution.types-DY4pGymy.d.ts → component-resolution.types-C_irCaHc.d.ts} +1 -1
- package/dist/db-component.d.cts +1 -1
- package/dist/db-component.d.ts +1 -1
- package/dist/directives.cjs +57 -28
- package/dist/directives.cjs.map +1 -1
- package/dist/directives.d.cts +18 -3
- package/dist/directives.d.ts +18 -3
- package/dist/directives.js +38 -10
- package/dist/directives.js.map +1 -1
- package/dist/{host-types-BpcRcZ48.d.ts → host-types-CGcK8Nib.d.ts} +1 -1
- package/dist/{host-types-BRLk_J_3.d.cts → host-types-mMFt5-hQ.d.cts} +1 -1
- package/dist/host.d.cts +3 -3
- package/dist/host.d.ts +3 -3
- package/dist/index.cjs +72 -43
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -8
- package/dist/index.d.ts +23 -8
- package/dist/index.js +38 -10
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +71 -44
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +3 -3
- package/dist/react.d.ts +3 -3
- package/dist/react.js +36 -10
- package/dist/react.js.map +1 -1
- package/dist/resolver.d.cts +2 -2
- package/dist/resolver.d.ts +2 -2
- package/dist/{route-CiCUQGAB.d.ts → route-Bq6db_zH.d.cts} +2 -2
- package/dist/{route-DMTBn8w4.d.cts → route-DStinBoZ.d.ts} +2 -2
- package/dist/route.cjs.map +1 -1
- package/dist/route.d.cts +2 -2
- package/dist/route.d.ts +2 -2
- package/dist/route.js.map +1 -1
- package/package.json +1 -1
package/dist/directives.d.cts
CHANGED
|
@@ -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
|
-
/**
|
|
125
|
-
|
|
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 };
|
package/dist/directives.d.ts
CHANGED
|
@@ -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
|
-
/**
|
|
125
|
-
|
|
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 };
|
package/dist/directives.js
CHANGED
|
@@ -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
|
|
70
|
-
|
|
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
|
|
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
|
|
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(
|
|
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?.({
|
|
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)
|
|
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,
|