@ai-matrx/content-ir-react 0.20.2 → 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 +23 -0
- 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/index.cjs +72 -43
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -3
- package/dist/index.d.ts +18 -3
- 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.js +36 -10
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -326,10 +326,25 @@ declare function directiveFieldLabel(key: string, titleColumn: string | null | u
|
|
|
326
326
|
* fields; null → the value as stored.
|
|
327
327
|
*/
|
|
328
328
|
type DirectiveValueWord = (field: string, value: string) => string | null;
|
|
329
|
+
/**
|
|
330
|
+
* The name a NEW item carries, or null when it has none — the one rule the card
|
|
331
|
+
* and a host's confirm share. `itemTitle`'s last resort ("Item", "Item 2 of 3")
|
|
332
|
+
* is a placeholder, never a name: a create with an empty title used to ask
|
|
333
|
+
* "Create project Item?" and its card row read "Item" (G10B review, 2026-10-02).
|
|
334
|
+
*/
|
|
335
|
+
declare function itemOwnName(item: Record<string, unknown>, titleColumn: string | null): string | null;
|
|
336
|
+
/** What a nameless new item is called — said as such, never a placeholder name. */
|
|
337
|
+
declare const NO_TITLE_WORD = "No title";
|
|
329
338
|
/** How an empty value reads — before or after, on the card and in the confirm. */
|
|
330
339
|
declare const EMPTY_VALUE_WORD = "None";
|
|
331
|
-
/**
|
|
332
|
-
|
|
340
|
+
/**
|
|
341
|
+
* What a record is called when its name cannot be read: its TYPE ("Task").
|
|
342
|
+
* Never its id, in any slot — text, tooltip or screen-reader label. It used to
|
|
343
|
+
* be "Task a8a00001", and a link to a record that no longer exists hovered
|
|
344
|
+
* "Open Task a8a00001" (G10B review, 2026-10-02). The host says WHY the name is
|
|
345
|
+
* missing (not found, no access) beside it.
|
|
346
|
+
*/
|
|
347
|
+
declare function recordFallbackName(nounLabel: string): string;
|
|
333
348
|
/** One value as a row reads it: shortened, the whole of it, and whether it is empty. */
|
|
334
349
|
interface ChangeValue {
|
|
335
350
|
value: string;
|
|
@@ -733,4 +748,4 @@ declare class DbKindComponentErrorBoundary extends react.Component<DbKindCompone
|
|
|
733
748
|
render(): react.ReactNode;
|
|
734
749
|
}
|
|
735
750
|
|
|
736
|
-
export { ApplyDirectiveButton, type ApplyDirectiveButtonProps, CHANGE_VALUE_MAX, type ChangeValue, type CompiledDbKindComponent, ComponentResolution, ComponentResolutionSource, ContentIrErrorReporter, ContentIrHost, ContentIrRenderProvider, type ContentIrRenderProviderProps, type DbKindActionResult, type DbKindCompileResult, type DbKindComponentCache, type DbKindComponentCachePorts, type DbKindComponentCompiler, DbKindComponentErrorBoundary, type DbKindComponentErrorBoundaryProps, type DbKindComponentIncident, type DbKindComponentIncidentSink, type DbKindComponentIncidentType, type DbKindComponentRenderProps, DelegatedOutput, type DelegatedOutputProps, 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, GenericStructuredView, type GenericStructuredViewProps, type ItemChange, type ItemChangesOptions, type KindComponentUiOptions, KindDefinitionSource, KindInstanceRender, type KindInstanceRenderProps, KindRouteEnv, type KindVersionSources, NodeOutcomeView, type NodeOutcomeViewProps, ProvisionalKindBoundary, ProvisionalKindFrame, type RecordReader, type RecordValues, type RecordValuesStatus, type ResolveKindValue, type RunDbKindAction, RunResultView, type RunResultViewProps, SideEffectDirectiveCard, type SideEffectDirectiveCardProps, TARGETING_CLASSES, createDbKindComponentCache, defaultFailureWords, describeChangeValue, directiveFieldLabel, directiveValueWord, failureWords, fieldLabel, getDirectiveRenderer, isDbKindComponentBodyPending, isRecordValue, itemChanges, itemRecordId, kindIsRoutable, noteRecordChanged, provisionalDirectiveSlug, readsApplyLedger, recordFallbackName, recordRevision, registerDirectiveRenderer, resetDirectiveRenderers, useContentIrHost, useContentIrHostOrNull, useContentIrKindVersion, useKindRouteEnv, useRecordRevision, useRecordValues };
|
|
751
|
+
export { ApplyDirectiveButton, type ApplyDirectiveButtonProps, CHANGE_VALUE_MAX, type ChangeValue, type CompiledDbKindComponent, ComponentResolution, ComponentResolutionSource, ContentIrErrorReporter, ContentIrHost, ContentIrRenderProvider, type ContentIrRenderProviderProps, type DbKindActionResult, type DbKindCompileResult, type DbKindComponentCache, type DbKindComponentCachePorts, type DbKindComponentCompiler, DbKindComponentErrorBoundary, type DbKindComponentErrorBoundaryProps, type DbKindComponentIncident, type DbKindComponentIncidentSink, type DbKindComponentIncidentType, type DbKindComponentRenderProps, DelegatedOutput, type DelegatedOutputProps, 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, GenericStructuredView, type GenericStructuredViewProps, type ItemChange, type ItemChangesOptions, type KindComponentUiOptions, KindDefinitionSource, KindInstanceRender, type KindInstanceRenderProps, KindRouteEnv, type KindVersionSources, NO_TITLE_WORD, NodeOutcomeView, type NodeOutcomeViewProps, ProvisionalKindBoundary, ProvisionalKindFrame, type RecordReader, type RecordValues, type RecordValuesStatus, type ResolveKindValue, type RunDbKindAction, RunResultView, type RunResultViewProps, SideEffectDirectiveCard, type SideEffectDirectiveCardProps, TARGETING_CLASSES, createDbKindComponentCache, defaultFailureWords, describeChangeValue, directiveFieldLabel, directiveValueWord, failureWords, fieldLabel, getDirectiveRenderer, isDbKindComponentBodyPending, isRecordValue, itemChanges, itemOwnName, itemRecordId, kindIsRoutable, noteRecordChanged, provisionalDirectiveSlug, readsApplyLedger, recordFallbackName, recordRevision, registerDirectiveRenderer, resetDirectiveRenderers, useContentIrHost, useContentIrHostOrNull, useContentIrKindVersion, useKindRouteEnv, useRecordRevision, useRecordValues };
|
package/dist/index.d.ts
CHANGED
|
@@ -326,10 +326,25 @@ declare function directiveFieldLabel(key: string, titleColumn: string | null | u
|
|
|
326
326
|
* fields; null → the value as stored.
|
|
327
327
|
*/
|
|
328
328
|
type DirectiveValueWord = (field: string, value: string) => string | null;
|
|
329
|
+
/**
|
|
330
|
+
* The name a NEW item carries, or null when it has none — the one rule the card
|
|
331
|
+
* and a host's confirm share. `itemTitle`'s last resort ("Item", "Item 2 of 3")
|
|
332
|
+
* is a placeholder, never a name: a create with an empty title used to ask
|
|
333
|
+
* "Create project Item?" and its card row read "Item" (G10B review, 2026-10-02).
|
|
334
|
+
*/
|
|
335
|
+
declare function itemOwnName(item: Record<string, unknown>, titleColumn: string | null): string | null;
|
|
336
|
+
/** What a nameless new item is called — said as such, never a placeholder name. */
|
|
337
|
+
declare const NO_TITLE_WORD = "No title";
|
|
329
338
|
/** How an empty value reads — before or after, on the card and in the confirm. */
|
|
330
339
|
declare const EMPTY_VALUE_WORD = "None";
|
|
331
|
-
/**
|
|
332
|
-
|
|
340
|
+
/**
|
|
341
|
+
* What a record is called when its name cannot be read: its TYPE ("Task").
|
|
342
|
+
* Never its id, in any slot — text, tooltip or screen-reader label. It used to
|
|
343
|
+
* be "Task a8a00001", and a link to a record that no longer exists hovered
|
|
344
|
+
* "Open Task a8a00001" (G10B review, 2026-10-02). The host says WHY the name is
|
|
345
|
+
* missing (not found, no access) beside it.
|
|
346
|
+
*/
|
|
347
|
+
declare function recordFallbackName(nounLabel: string): string;
|
|
333
348
|
/** One value as a row reads it: shortened, the whole of it, and whether it is empty. */
|
|
334
349
|
interface ChangeValue {
|
|
335
350
|
value: string;
|
|
@@ -733,4 +748,4 @@ declare class DbKindComponentErrorBoundary extends react.Component<DbKindCompone
|
|
|
733
748
|
render(): react.ReactNode;
|
|
734
749
|
}
|
|
735
750
|
|
|
736
|
-
export { ApplyDirectiveButton, type ApplyDirectiveButtonProps, CHANGE_VALUE_MAX, type ChangeValue, type CompiledDbKindComponent, ComponentResolution, ComponentResolutionSource, ContentIrErrorReporter, ContentIrHost, ContentIrRenderProvider, type ContentIrRenderProviderProps, type DbKindActionResult, type DbKindCompileResult, type DbKindComponentCache, type DbKindComponentCachePorts, type DbKindComponentCompiler, DbKindComponentErrorBoundary, type DbKindComponentErrorBoundaryProps, type DbKindComponentIncident, type DbKindComponentIncidentSink, type DbKindComponentIncidentType, type DbKindComponentRenderProps, DelegatedOutput, type DelegatedOutputProps, 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, GenericStructuredView, type GenericStructuredViewProps, type ItemChange, type ItemChangesOptions, type KindComponentUiOptions, KindDefinitionSource, KindInstanceRender, type KindInstanceRenderProps, KindRouteEnv, type KindVersionSources, NodeOutcomeView, type NodeOutcomeViewProps, ProvisionalKindBoundary, ProvisionalKindFrame, type RecordReader, type RecordValues, type RecordValuesStatus, type ResolveKindValue, type RunDbKindAction, RunResultView, type RunResultViewProps, SideEffectDirectiveCard, type SideEffectDirectiveCardProps, TARGETING_CLASSES, createDbKindComponentCache, defaultFailureWords, describeChangeValue, directiveFieldLabel, directiveValueWord, failureWords, fieldLabel, getDirectiveRenderer, isDbKindComponentBodyPending, isRecordValue, itemChanges, itemRecordId, kindIsRoutable, noteRecordChanged, provisionalDirectiveSlug, readsApplyLedger, recordFallbackName, recordRevision, registerDirectiveRenderer, resetDirectiveRenderers, useContentIrHost, useContentIrHostOrNull, useContentIrKindVersion, useKindRouteEnv, useRecordRevision, useRecordValues };
|
|
751
|
+
export { ApplyDirectiveButton, type ApplyDirectiveButtonProps, CHANGE_VALUE_MAX, type ChangeValue, type CompiledDbKindComponent, ComponentResolution, ComponentResolutionSource, ContentIrErrorReporter, ContentIrHost, ContentIrRenderProvider, type ContentIrRenderProviderProps, type DbKindActionResult, type DbKindCompileResult, type DbKindComponentCache, type DbKindComponentCachePorts, type DbKindComponentCompiler, DbKindComponentErrorBoundary, type DbKindComponentErrorBoundaryProps, type DbKindComponentIncident, type DbKindComponentIncidentSink, type DbKindComponentIncidentType, type DbKindComponentRenderProps, DelegatedOutput, type DelegatedOutputProps, 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, GenericStructuredView, type GenericStructuredViewProps, type ItemChange, type ItemChangesOptions, type KindComponentUiOptions, KindDefinitionSource, KindInstanceRender, type KindInstanceRenderProps, KindRouteEnv, type KindVersionSources, NO_TITLE_WORD, NodeOutcomeView, type NodeOutcomeViewProps, ProvisionalKindBoundary, ProvisionalKindFrame, type RecordReader, type RecordValues, type RecordValuesStatus, type ResolveKindValue, type RunDbKindAction, RunResultView, type RunResultViewProps, SideEffectDirectiveCard, type SideEffectDirectiveCardProps, TARGETING_CLASSES, createDbKindComponentCache, defaultFailureWords, describeChangeValue, directiveFieldLabel, directiveValueWord, failureWords, fieldLabel, getDirectiveRenderer, isDbKindComponentBodyPending, isRecordValue, itemChanges, itemOwnName, itemRecordId, kindIsRoutable, noteRecordChanged, provisionalDirectiveSlug, readsApplyLedger, recordFallbackName, recordRevision, registerDirectiveRenderer, resetDirectiveRenderers, useContentIrHost, useContentIrHostOrNull, useContentIrKindVersion, useKindRouteEnv, useRecordRevision, useRecordValues };
|
package/dist/index.js
CHANGED
|
@@ -757,8 +757,8 @@ import { useEffect as useEffect2, useRef, useState as useState2, useSyncExternal
|
|
|
757
757
|
import { nounLabel } from "@ai-matrx/content-ir";
|
|
758
758
|
|
|
759
759
|
// directives/item-changes.ts
|
|
760
|
-
import { isUuidShape } from "@ai-matrx/kit/uuid";
|
|
761
760
|
import { humanizeIdentifier } from "@ai-matrx/kit/text-case";
|
|
761
|
+
import { itemTitle } from "@ai-matrx/content-ir";
|
|
762
762
|
var TARGETING_CLASSES = /* @__PURE__ */ new Set(["update", "delete"]);
|
|
763
763
|
var NOT_A_CHANGE = /* @__PURE__ */ new Set(["__kind", "id"]);
|
|
764
764
|
var CHANGE_VALUE_MAX = 280;
|
|
@@ -774,10 +774,14 @@ function fieldLabel(key) {
|
|
|
774
774
|
function directiveFieldLabel(key, titleColumn) {
|
|
775
775
|
return titleColumn && key === titleColumn ? "Title" : fieldLabel(key);
|
|
776
776
|
}
|
|
777
|
+
function itemOwnName(item, titleColumn) {
|
|
778
|
+
const probe = itemTitle(item, titleColumn, 0, 2);
|
|
779
|
+
return probe === "Item 1 of 2" ? null : probe;
|
|
780
|
+
}
|
|
781
|
+
var NO_TITLE_WORD = "No title";
|
|
777
782
|
var EMPTY_VALUE_WORD = "None";
|
|
778
|
-
function recordFallbackName(nounLabel3
|
|
779
|
-
|
|
780
|
-
return `${nounLabel3} ${short}`;
|
|
783
|
+
function recordFallbackName(nounLabel3) {
|
|
784
|
+
return nounLabel3.trim() || "Record";
|
|
781
785
|
}
|
|
782
786
|
function describeChangeValue(value, word) {
|
|
783
787
|
return describeValue(value, word);
|
|
@@ -1279,7 +1283,7 @@ function ApplyDirectiveButton({
|
|
|
1279
1283
|
) : null,
|
|
1280
1284
|
records.map((record) => /* @__PURE__ */ jsx4("span", { className: "inline-flex min-w-0 items-center", children: host.renderRecord?.({
|
|
1281
1285
|
...record,
|
|
1282
|
-
fallback: recordFallbackName(label2
|
|
1286
|
+
fallback: recordFallbackName(label2),
|
|
1283
1287
|
context: "applied",
|
|
1284
1288
|
trashed
|
|
1285
1289
|
}) }, `${record.noun}:${record.id}`)),
|
|
@@ -1327,6 +1331,14 @@ function ApplyDirectiveButton({
|
|
|
1327
1331
|
}
|
|
1328
1332
|
);
|
|
1329
1333
|
}
|
|
1334
|
+
const warm = () => {
|
|
1335
|
+
const read2 = host.readRecord;
|
|
1336
|
+
if (!read2 || !TARGETING_CLASSES.has(directive.directiveClass)) return;
|
|
1337
|
+
for (const item of items) {
|
|
1338
|
+
const id = itemRecordId(item);
|
|
1339
|
+
if (id) void read2({ noun: directive.noun, id }).catch(() => null);
|
|
1340
|
+
}
|
|
1341
|
+
};
|
|
1330
1342
|
const destructive = directive.directiveClass === "delete";
|
|
1331
1343
|
const muted = nothingToChange && view.status === "idle";
|
|
1332
1344
|
return /* @__PURE__ */ jsxs2("span", { className: "flex min-w-0 flex-wrap items-center justify-end gap-x-2 gap-y-1", children: [
|
|
@@ -1336,6 +1348,8 @@ function ApplyDirectiveButton({
|
|
|
1336
1348
|
{
|
|
1337
1349
|
type: "button",
|
|
1338
1350
|
onClick: () => void handleApply(),
|
|
1351
|
+
onPointerEnter: warm,
|
|
1352
|
+
onFocus: warm,
|
|
1339
1353
|
disabled: view.status === "applying" || view.status === "asking" || items.length === 0,
|
|
1340
1354
|
"data-apply-tone": muted ? "muted" : destructive ? "destructive" : "default",
|
|
1341
1355
|
title: muted ? "It sets no fields, so applying it changes nothing." : void 0,
|
|
@@ -1502,7 +1516,6 @@ import {
|
|
|
1502
1516
|
directiveDisplay as directiveDisplay3,
|
|
1503
1517
|
itemFacts,
|
|
1504
1518
|
itemSubtitle,
|
|
1505
|
-
itemTitle,
|
|
1506
1519
|
nounLabel as nounLabel2,
|
|
1507
1520
|
nounTitleColumn
|
|
1508
1521
|
} from "@ai-matrx/content-ir";
|
|
@@ -1529,7 +1542,8 @@ function ItemRow({
|
|
|
1529
1542
|
return /* @__PURE__ */ jsx7(TargetRow, { directive, item, recordId, index, phase });
|
|
1530
1543
|
}
|
|
1531
1544
|
const titleColumn = nounTitleColumn(directive.noun, host.nouns);
|
|
1532
|
-
const
|
|
1545
|
+
const ownName = itemOwnName(item, titleColumn);
|
|
1546
|
+
const title = ownName ?? NO_TITLE_WORD;
|
|
1533
1547
|
const subtitle = itemSubtitle(item);
|
|
1534
1548
|
const valueWord = directiveValueWord(host, directive.noun);
|
|
1535
1549
|
const facts = itemFacts(titleColumn ? omitKey(item, titleColumn) : item).map((fact) => ({
|
|
@@ -1541,7 +1555,14 @@ function ItemRow({
|
|
|
1541
1555
|
const display = directiveDisplay3(directive.directiveClass, directive.noun, host.nouns);
|
|
1542
1556
|
const openItem = host.openItem;
|
|
1543
1557
|
const body = /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
1544
|
-
/* @__PURE__ */ jsx7(
|
|
1558
|
+
/* @__PURE__ */ jsx7(
|
|
1559
|
+
"span",
|
|
1560
|
+
{
|
|
1561
|
+
className: `min-w-0 shrink-0 truncate font-medium ${ownName ? "text-foreground" : "italic text-muted-foreground"}`,
|
|
1562
|
+
"data-item-untitled": ownName ? void 0 : "",
|
|
1563
|
+
children: title
|
|
1564
|
+
}
|
|
1565
|
+
),
|
|
1545
1566
|
/* @__PURE__ */ jsx7("span", { className: "hidden min-w-0 flex-1 items-baseline gap-2 overflow-hidden sm:flex", children: facts.map((fact) => /* @__PURE__ */ jsxs5("span", { className: "truncate text-[11px] text-muted-foreground", "data-item-fact": fact.key, children: [
|
|
1546
1567
|
fact.label,
|
|
1547
1568
|
" ",
|
|
@@ -1570,7 +1591,12 @@ function ItemRow({
|
|
|
1570
1591
|
children: body
|
|
1571
1592
|
}
|
|
1572
1593
|
) : /* @__PURE__ */ jsx7("span", { className: "flex min-w-0 flex-1 items-center gap-2 px-1 py-0.5", children: body }),
|
|
1573
|
-
host.renderCopy?.({
|
|
1594
|
+
host.renderCopy?.({
|
|
1595
|
+
label: ownName ?? `this ${nounLabel2(directive.noun, host.nouns)}`,
|
|
1596
|
+
value: item,
|
|
1597
|
+
kind,
|
|
1598
|
+
size: "xs"
|
|
1599
|
+
})
|
|
1574
1600
|
] });
|
|
1575
1601
|
}
|
|
1576
1602
|
function DirectiveChangeList({
|
|
@@ -1624,7 +1650,7 @@ function TargetRow({
|
|
|
1624
1650
|
phase
|
|
1625
1651
|
}) {
|
|
1626
1652
|
const host = useDirectiveHost();
|
|
1627
|
-
const fallback = recordFallbackName(nounLabel2(directive.noun, host.nouns)
|
|
1653
|
+
const fallback = recordFallbackName(nounLabel2(directive.noun, host.nouns));
|
|
1628
1654
|
const isUpdate = directive.directiveClass === "update";
|
|
1629
1655
|
const readsLive = isUpdate && phase.phase === "open";
|
|
1630
1656
|
const live = useRecordValues(
|
|
@@ -2191,6 +2217,7 @@ export {
|
|
|
2191
2217
|
IR_PROVISIONAL_KEY,
|
|
2192
2218
|
IR_ROUTE_KEY,
|
|
2193
2219
|
KindInstanceRender,
|
|
2220
|
+
NO_TITLE_WORD,
|
|
2194
2221
|
NodeOutcomeView,
|
|
2195
2222
|
ProvisionalKindBoundary,
|
|
2196
2223
|
ProvisionalKindFrame,
|
|
@@ -2214,6 +2241,7 @@ export {
|
|
|
2214
2241
|
isProvisionalBlock,
|
|
2215
2242
|
isRecordValue,
|
|
2216
2243
|
itemChanges,
|
|
2244
|
+
itemOwnName,
|
|
2217
2245
|
itemRecordId,
|
|
2218
2246
|
kindIsRoutable,
|
|
2219
2247
|
kindServerDataFromStoredValue,
|