@ai-matrx/content-ir-react 0.11.11 → 0.12.1

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/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { C as ComponentResolutionSource, a as ComponentResolution, b as ContentIrErrorReporter } from './component-resolution.types-DLO2w-0n.cjs';
2
2
  export { c as ComponentRole, d as ContentIrErrorReport, J as JsonObject, K as KindComponentRow, S as SystemComponentEntry, e as consoleErrorReporter } from './component-resolution.types-DLO2w-0n.cjs';
3
- import { C as ContentIrHost, K as KindRouteEnv, a as KindDefinitionSource } from './route-B9U-9QCw.cjs';
4
- export { b as ContentIrRenderSeams, D as DB_KIND_COMPONENT_KEY, c as DIRECTIVE_BLOCK_TYPE, d as DirectiveApplyResult, e as DirectiveCopyProps, f as DirectiveHost, g as DirectiveHostProvider, h as DirectiveHostProviderProps, i as DirectiveOpenItemOptions, G as GENERIC_STRUCTURED_COMPONENT_KEY, j as GenericFallbackReason, I as IR_PROVISIONAL_KEY, k as IR_ROUTE_KEY, l as IrRenderBlock, m as IrRoutableBlock, n as IrRouteMarker, o as KindRouteBinding, p as KindRouteOptions, P as PartialRenderOptions, q as ProvisionalKindRender, S as StructuredValueRenderProps, r as SupersededKindRender, s as applyIrKindRoute, t as createKindRouteBinding, u as envelopeFromPartialKind, v as isPartialReadyKind, w as isProvisionalBlock, x as kindServerDataFromStoredValue, y as markKindPartialUnsafe, z as readIrRouteMarker, A as resetPartialUnsafeKinds, B as resetSourcelessDbRowReports, E as resolveAnnouncedKindLoading, F as resolveProvisionalKindRender, H as resolveSupersededKindRender, J as routeEnvOf, L as useDirectiveHost } from './route-B9U-9QCw.cjs';
3
+ import { C as ContentIrHost, K as KindRouteEnv, a as KindDefinitionSource } from './route-DxK1SoPh.cjs';
4
+ export { b as ContentIrRenderSeams, D as DB_KIND_COMPONENT_KEY, c as DIRECTIVE_BLOCK_TYPE, d as DirectiveApplyResult, e as DirectiveAskRequest, f as DirectiveCopyProps, g as DirectiveHost, h as DirectiveHostProvider, i as DirectiveHostProviderProps, j as DirectiveOpenItemOptions, k as DirectiveRecordProps, l as DirectiveRecordRef, G as GENERIC_STRUCTURED_COMPONENT_KEY, m as GenericFallbackReason, I as IR_PROVISIONAL_KEY, n as IR_ROUTE_KEY, o as IrRenderBlock, p as IrRoutableBlock, q as IrRouteMarker, r as KindRouteBinding, s as KindRouteOptions, P as PartialRenderOptions, t as ProvisionalKindRender, S as StructuredValueRenderProps, u as SupersededKindRender, v as applyIrKindRoute, w as createKindRouteBinding, x as envelopeFromPartialKind, y as isPartialReadyKind, z as isProvisionalBlock, A as kindServerDataFromStoredValue, B as markKindPartialUnsafe, E as readIrRouteMarker, F as resetPartialUnsafeKinds, H as resetSourcelessDbRowReports, J as resolveAnnouncedKindLoading, L as resolveProvisionalKindRender, M as resolveSupersededKindRender, N as routeEnvOf, O as useDirectiveHost } from './route-DxK1SoPh.cjs';
5
5
  import * as react from 'react';
6
6
  import react__default, { ReactNode, ComponentType } from 'react';
7
7
  export { ComponentResolver, ComponentResolverOptions } from './resolver.cjs';
@@ -295,6 +295,47 @@ interface DirectiveRenderProps {
295
295
  }
296
296
  declare function DirectiveRender({ content, className, streaming }: DirectiveRenderProps): react.JSX.Element;
297
297
 
298
+ /**
299
+ * WHAT A DIRECTIVE ITEM WILL DO TO AN EXISTING RECORD — for the card, the
300
+ * confirm dialog, and anything else that must say it before the click.
301
+ *
302
+ * WHY (reviewer, 2026-09-30): an Update card and a Delete card showed each item
303
+ * as "Item" — they never named the record they would change, and an Update card
304
+ * never said what it would change. The item-summary helpers name a thing to be
305
+ * CREATED from its own fields; an update or delete item carries the TARGET's id
306
+ * and, for an update, the NEW values — so its "title" field is the new title,
307
+ * not the name of the record being changed. Naming the target is the host's
308
+ * live lookup (`DirectiveHost.renderRecord`); what changes is right here.
309
+ *
310
+ * Law: common-docs/policies/destructive-and-expensive-actions.md — the sentence
311
+ * names what changes.
312
+ */
313
+ /** Classes whose items point at an EXISTING record by `id`. */
314
+ declare const TARGETING_CLASSES: ReadonlySet<string>;
315
+ /** How long a changed value may read before it is shortened (full value on hover). */
316
+ declare const CHANGE_VALUE_MAX = 60;
317
+ /** The id of the existing record an update/delete item targets, or null. */
318
+ declare function itemRecordId(item: Record<string, unknown>): string | null;
319
+ /** "due_date" → "Due date". Underscores read as developer output. */
320
+ declare function fieldLabel(key: string): string;
321
+ /** A short, honest name for a record we could not look up: "Task 1a2b3c4d". */
322
+ declare function recordFallbackName(nounLabel: string, id: string): string;
323
+ interface ItemChange {
324
+ key: string;
325
+ /** "Due date". */
326
+ label: string;
327
+ /** What it becomes, shortened for a row; `full` carries the whole value. */
328
+ value: string;
329
+ full: string;
330
+ /** True when the new value empties the field. */
331
+ clears: boolean;
332
+ }
333
+ /**
334
+ * Every field an UPDATE item sets, in the order the item carries them — ALL of
335
+ * them, never a sample: a person approving an overwrite sees the whole of it.
336
+ */
337
+ declare function itemChanges(item: Record<string, unknown>): ItemChange[];
338
+
298
339
  /**
299
340
  * The DB-component COMPILE CACHE — session-scoped, keyed per winning row
300
341
  * VERSION, with the loud-recovery policy built in.
@@ -558,4 +599,4 @@ declare class DbKindComponentErrorBoundary extends react.Component<DbKindCompone
558
599
  render(): react.ReactNode;
559
600
  }
560
601
 
561
- export { ApplyDirectiveButton, type ApplyDirectiveButtonProps, 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, DirectiveFallbackCard, type DirectiveFallbackCardProps, DirectiveProvisionalCard, type DirectiveProvisionalCardProps, DirectiveRender, type DirectiveRenderProps, type DirectiveRenderer, type DirectiveRendererProps, GenericStructuredView, type GenericStructuredViewProps, type KindComponentUiOptions, KindDefinitionSource, KindInstanceRender, type KindInstanceRenderProps, KindRouteEnv, type KindVersionSources, NodeOutcomeView, type NodeOutcomeViewProps, ProvisionalKindBoundary, ProvisionalKindFrame, type ResolveKindValue, type RunDbKindAction, RunResultView, type RunResultViewProps, SideEffectDirectiveCard, type SideEffectDirectiveCardProps, createDbKindComponentCache, getDirectiveRenderer, isDbKindComponentBodyPending, isRecordValue, kindIsRoutable, provisionalDirectiveSlug, registerDirectiveRenderer, resetDirectiveRenderers, useContentIrHost, useContentIrHostOrNull, useContentIrKindVersion, useKindRouteEnv };
602
+ export { ApplyDirectiveButton, type ApplyDirectiveButtonProps, CHANGE_VALUE_MAX, 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, DirectiveFallbackCard, type DirectiveFallbackCardProps, DirectiveProvisionalCard, type DirectiveProvisionalCardProps, DirectiveRender, type DirectiveRenderProps, type DirectiveRenderer, type DirectiveRendererProps, GenericStructuredView, type GenericStructuredViewProps, type ItemChange, type KindComponentUiOptions, KindDefinitionSource, KindInstanceRender, type KindInstanceRenderProps, KindRouteEnv, type KindVersionSources, NodeOutcomeView, type NodeOutcomeViewProps, ProvisionalKindBoundary, ProvisionalKindFrame, type ResolveKindValue, type RunDbKindAction, RunResultView, type RunResultViewProps, SideEffectDirectiveCard, type SideEffectDirectiveCardProps, TARGETING_CLASSES, createDbKindComponentCache, fieldLabel, getDirectiveRenderer, isDbKindComponentBodyPending, isRecordValue, itemChanges, itemRecordId, kindIsRoutable, provisionalDirectiveSlug, recordFallbackName, registerDirectiveRenderer, resetDirectiveRenderers, useContentIrHost, useContentIrHostOrNull, useContentIrKindVersion, useKindRouteEnv };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { C as ComponentResolutionSource, a as ComponentResolution, b as ContentIrErrorReporter } from './component-resolution.types-DLO2w-0n.js';
2
2
  export { c as ComponentRole, d as ContentIrErrorReport, J as JsonObject, K as KindComponentRow, S as SystemComponentEntry, e as consoleErrorReporter } from './component-resolution.types-DLO2w-0n.js';
3
- import { C as ContentIrHost, K as KindRouteEnv, a as KindDefinitionSource } from './route-gNpJ8zzW.js';
4
- export { b as ContentIrRenderSeams, D as DB_KIND_COMPONENT_KEY, c as DIRECTIVE_BLOCK_TYPE, d as DirectiveApplyResult, e as DirectiveCopyProps, f as DirectiveHost, g as DirectiveHostProvider, h as DirectiveHostProviderProps, i as DirectiveOpenItemOptions, G as GENERIC_STRUCTURED_COMPONENT_KEY, j as GenericFallbackReason, I as IR_PROVISIONAL_KEY, k as IR_ROUTE_KEY, l as IrRenderBlock, m as IrRoutableBlock, n as IrRouteMarker, o as KindRouteBinding, p as KindRouteOptions, P as PartialRenderOptions, q as ProvisionalKindRender, S as StructuredValueRenderProps, r as SupersededKindRender, s as applyIrKindRoute, t as createKindRouteBinding, u as envelopeFromPartialKind, v as isPartialReadyKind, w as isProvisionalBlock, x as kindServerDataFromStoredValue, y as markKindPartialUnsafe, z as readIrRouteMarker, A as resetPartialUnsafeKinds, B as resetSourcelessDbRowReports, E as resolveAnnouncedKindLoading, F as resolveProvisionalKindRender, H as resolveSupersededKindRender, J as routeEnvOf, L as useDirectiveHost } from './route-gNpJ8zzW.js';
3
+ import { C as ContentIrHost, K as KindRouteEnv, a as KindDefinitionSource } from './route-JGZfl2nL.js';
4
+ export { b as ContentIrRenderSeams, D as DB_KIND_COMPONENT_KEY, c as DIRECTIVE_BLOCK_TYPE, d as DirectiveApplyResult, e as DirectiveAskRequest, f as DirectiveCopyProps, g as DirectiveHost, h as DirectiveHostProvider, i as DirectiveHostProviderProps, j as DirectiveOpenItemOptions, k as DirectiveRecordProps, l as DirectiveRecordRef, G as GENERIC_STRUCTURED_COMPONENT_KEY, m as GenericFallbackReason, I as IR_PROVISIONAL_KEY, n as IR_ROUTE_KEY, o as IrRenderBlock, p as IrRoutableBlock, q as IrRouteMarker, r as KindRouteBinding, s as KindRouteOptions, P as PartialRenderOptions, t as ProvisionalKindRender, S as StructuredValueRenderProps, u as SupersededKindRender, v as applyIrKindRoute, w as createKindRouteBinding, x as envelopeFromPartialKind, y as isPartialReadyKind, z as isProvisionalBlock, A as kindServerDataFromStoredValue, B as markKindPartialUnsafe, E as readIrRouteMarker, F as resetPartialUnsafeKinds, H as resetSourcelessDbRowReports, J as resolveAnnouncedKindLoading, L as resolveProvisionalKindRender, M as resolveSupersededKindRender, N as routeEnvOf, O as useDirectiveHost } from './route-JGZfl2nL.js';
5
5
  import * as react from 'react';
6
6
  import react__default, { ReactNode, ComponentType } from 'react';
7
7
  export { ComponentResolver, ComponentResolverOptions } from './resolver.js';
@@ -295,6 +295,47 @@ interface DirectiveRenderProps {
295
295
  }
296
296
  declare function DirectiveRender({ content, className, streaming }: DirectiveRenderProps): react.JSX.Element;
297
297
 
298
+ /**
299
+ * WHAT A DIRECTIVE ITEM WILL DO TO AN EXISTING RECORD — for the card, the
300
+ * confirm dialog, and anything else that must say it before the click.
301
+ *
302
+ * WHY (reviewer, 2026-09-30): an Update card and a Delete card showed each item
303
+ * as "Item" — they never named the record they would change, and an Update card
304
+ * never said what it would change. The item-summary helpers name a thing to be
305
+ * CREATED from its own fields; an update or delete item carries the TARGET's id
306
+ * and, for an update, the NEW values — so its "title" field is the new title,
307
+ * not the name of the record being changed. Naming the target is the host's
308
+ * live lookup (`DirectiveHost.renderRecord`); what changes is right here.
309
+ *
310
+ * Law: common-docs/policies/destructive-and-expensive-actions.md — the sentence
311
+ * names what changes.
312
+ */
313
+ /** Classes whose items point at an EXISTING record by `id`. */
314
+ declare const TARGETING_CLASSES: ReadonlySet<string>;
315
+ /** How long a changed value may read before it is shortened (full value on hover). */
316
+ declare const CHANGE_VALUE_MAX = 60;
317
+ /** The id of the existing record an update/delete item targets, or null. */
318
+ declare function itemRecordId(item: Record<string, unknown>): string | null;
319
+ /** "due_date" → "Due date". Underscores read as developer output. */
320
+ declare function fieldLabel(key: string): string;
321
+ /** A short, honest name for a record we could not look up: "Task 1a2b3c4d". */
322
+ declare function recordFallbackName(nounLabel: string, id: string): string;
323
+ interface ItemChange {
324
+ key: string;
325
+ /** "Due date". */
326
+ label: string;
327
+ /** What it becomes, shortened for a row; `full` carries the whole value. */
328
+ value: string;
329
+ full: string;
330
+ /** True when the new value empties the field. */
331
+ clears: boolean;
332
+ }
333
+ /**
334
+ * Every field an UPDATE item sets, in the order the item carries them — ALL of
335
+ * them, never a sample: a person approving an overwrite sees the whole of it.
336
+ */
337
+ declare function itemChanges(item: Record<string, unknown>): ItemChange[];
338
+
298
339
  /**
299
340
  * The DB-component COMPILE CACHE — session-scoped, keyed per winning row
300
341
  * VERSION, with the loud-recovery policy built in.
@@ -558,4 +599,4 @@ declare class DbKindComponentErrorBoundary extends react.Component<DbKindCompone
558
599
  render(): react.ReactNode;
559
600
  }
560
601
 
561
- export { ApplyDirectiveButton, type ApplyDirectiveButtonProps, 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, DirectiveFallbackCard, type DirectiveFallbackCardProps, DirectiveProvisionalCard, type DirectiveProvisionalCardProps, DirectiveRender, type DirectiveRenderProps, type DirectiveRenderer, type DirectiveRendererProps, GenericStructuredView, type GenericStructuredViewProps, type KindComponentUiOptions, KindDefinitionSource, KindInstanceRender, type KindInstanceRenderProps, KindRouteEnv, type KindVersionSources, NodeOutcomeView, type NodeOutcomeViewProps, ProvisionalKindBoundary, ProvisionalKindFrame, type ResolveKindValue, type RunDbKindAction, RunResultView, type RunResultViewProps, SideEffectDirectiveCard, type SideEffectDirectiveCardProps, createDbKindComponentCache, getDirectiveRenderer, isDbKindComponentBodyPending, isRecordValue, kindIsRoutable, provisionalDirectiveSlug, registerDirectiveRenderer, resetDirectiveRenderers, useContentIrHost, useContentIrHostOrNull, useContentIrKindVersion, useKindRouteEnv };
602
+ export { ApplyDirectiveButton, type ApplyDirectiveButtonProps, CHANGE_VALUE_MAX, 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, DirectiveFallbackCard, type DirectiveFallbackCardProps, DirectiveProvisionalCard, type DirectiveProvisionalCardProps, DirectiveRender, type DirectiveRenderProps, type DirectiveRenderer, type DirectiveRendererProps, GenericStructuredView, type GenericStructuredViewProps, type ItemChange, type KindComponentUiOptions, KindDefinitionSource, KindInstanceRender, type KindInstanceRenderProps, KindRouteEnv, type KindVersionSources, NodeOutcomeView, type NodeOutcomeViewProps, ProvisionalKindBoundary, ProvisionalKindFrame, type ResolveKindValue, type RunDbKindAction, RunResultView, type RunResultViewProps, SideEffectDirectiveCard, type SideEffectDirectiveCardProps, TARGETING_CLASSES, createDbKindComponentCache, fieldLabel, getDirectiveRenderer, isDbKindComponentBodyPending, isRecordValue, itemChanges, itemRecordId, kindIsRoutable, provisionalDirectiveSlug, recordFallbackName, registerDirectiveRenderer, resetDirectiveRenderers, useContentIrHost, useContentIrHostOrNull, useContentIrKindVersion, useKindRouteEnv };
package/dist/index.js CHANGED
@@ -715,6 +715,63 @@ import { directiveDisplay } from "@ai-matrx/content-ir";
715
715
 
716
716
  // directives/ApplyDirectiveButton.tsx
717
717
  import { useEffect, useRef, useState } from "react";
718
+ import { nounLabel } from "@ai-matrx/content-ir";
719
+
720
+ // directives/item-changes.ts
721
+ import { isUuidShape } from "@ai-matrx/kit/uuid";
722
+ var TARGETING_CLASSES = /* @__PURE__ */ new Set(["update", "delete"]);
723
+ var NOT_A_CHANGE = /* @__PURE__ */ new Set(["__kind", "id"]);
724
+ var CHANGE_VALUE_MAX = 60;
725
+ function itemRecordId(item) {
726
+ const id = item.id;
727
+ if (typeof id === "string" && id.trim()) return id.trim();
728
+ if (typeof id === "number") return String(id);
729
+ return null;
730
+ }
731
+ function fieldLabel(key) {
732
+ const spaced = key.replace(/_/g, " ").trim();
733
+ return spaced.charAt(0).toUpperCase() + spaced.slice(1);
734
+ }
735
+ function recordFallbackName(nounLabel3, id) {
736
+ const short = isUuidShape(id) ? id.slice(0, 8) : id.length > 12 ? `${id.slice(0, 12)}\u2026` : id;
737
+ return `${nounLabel3} ${short}`;
738
+ }
739
+ function describeValue(value) {
740
+ if (value === null || value === void 0) return { value: "cleared", full: "cleared", clears: true };
741
+ if (typeof value === "string") {
742
+ const trimmed = value.trim();
743
+ if (!trimmed) return { value: "cleared", full: "cleared", clears: true };
744
+ const oneLine = trimmed.replace(/\s+/g, " ");
745
+ const shown = oneLine.length > CHANGE_VALUE_MAX ? `${oneLine.slice(0, CHANGE_VALUE_MAX - 1)}\u2026` : oneLine;
746
+ return { value: shown, full: trimmed, clears: false };
747
+ }
748
+ if (typeof value === "number" || typeof value === "boolean") {
749
+ return { value: String(value), full: String(value), clears: false };
750
+ }
751
+ if (Array.isArray(value)) {
752
+ const n2 = value.length;
753
+ const text2 = n2 === 0 ? "cleared" : `${n2} ${n2 === 1 ? "entry" : "entries"}`;
754
+ return { value: text2, full: safeJson(value), clears: n2 === 0 };
755
+ }
756
+ const n = Object.keys(value).length;
757
+ const text = n === 0 ? "cleared" : `${n} ${n === 1 ? "field" : "fields"}`;
758
+ return { value: text, full: safeJson(value), clears: n === 0 };
759
+ }
760
+ function safeJson(value) {
761
+ try {
762
+ return JSON.stringify(value, null, 2);
763
+ } catch {
764
+ return String(value);
765
+ }
766
+ }
767
+ function itemChanges(item) {
768
+ const out = [];
769
+ for (const [key, raw] of Object.entries(item)) {
770
+ if (NOT_A_CHANGE.has(key)) continue;
771
+ out.push({ key, label: fieldLabel(key), ...describeValue(raw) });
772
+ }
773
+ return out;
774
+ }
718
775
 
719
776
  // directives/icons.tsx
720
777
  import { jsx as jsx3, jsxs } from "react/jsx-runtime";
@@ -832,10 +889,38 @@ function ApplyDirectiveButton({
832
889
  const items = directive.items;
833
890
  async function handleApply() {
834
891
  if (!confirm) return;
892
+ if (host.ask) {
893
+ setState({ status: "asking" });
894
+ let ok = false;
895
+ try {
896
+ ok = await host.ask({
897
+ directive,
898
+ items,
899
+ nounLabel: nounLabel(directive.noun, host.nouns)
900
+ });
901
+ } catch (error) {
902
+ setState({
903
+ status: "error",
904
+ message: error instanceof Error && error.message ? error.message : "We could not ask you to confirm this, so nothing was done."
905
+ });
906
+ return;
907
+ }
908
+ if (!ok) {
909
+ setState({ status: "idle" });
910
+ return;
911
+ }
912
+ }
913
+ setElapsed(0);
835
914
  setState({ status: "applying" });
836
915
  try {
837
916
  const result = await confirm({ __kind: directive.slug, items });
838
- setState({ status: "applied", applied: result.applied, failed: result.failed });
917
+ setState({
918
+ status: "applied",
919
+ applied: result.applied,
920
+ failed: result.failed,
921
+ message: result.message?.trim() ? result.message.trim() : null,
922
+ records: result.records ?? []
923
+ });
839
924
  onApplied?.();
840
925
  } catch (error) {
841
926
  setState({
@@ -846,15 +931,26 @@ function ApplyDirectiveButton({
846
931
  }
847
932
  if (state.status === "applied") {
848
933
  const bad = state.failed > 0;
934
+ const trashed = directive.directiveClass === "delete";
935
+ const label2 = nounLabel(directive.noun, host.nouns);
936
+ const records = host.renderRecord ? state.records : [];
849
937
  return /* @__PURE__ */ jsxs2(
850
938
  "span",
851
939
  {
852
- className: `inline-flex items-center gap-1 text-xs ${bad ? "text-destructive" : "text-primary"}`,
940
+ className: `inline-flex min-w-0 flex-wrap items-center gap-1 text-xs ${bad ? "text-destructive" : "text-primary"}`,
941
+ "data-apply-state": "applied",
853
942
  children: [
854
- bad ? /* @__PURE__ */ jsx4(AlertIcon, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsx4(CheckCircleIcon, { className: "h-3.5 w-3.5" }),
855
- "Applied ",
856
- state.applied,
857
- bad ? ` \xB7 ${state.failed} failed` : ""
943
+ bad ? /* @__PURE__ */ jsx4(AlertIcon, { className: "h-3.5 w-3.5 shrink-0" }) : /* @__PURE__ */ jsx4(CheckCircleIcon, { className: "h-3.5 w-3.5 shrink-0" }),
944
+ /* @__PURE__ */ jsxs2("span", { children: [
945
+ state.message ?? `Applied ${state.applied}`,
946
+ bad && !state.message ? ` \xB7 ${state.failed} failed` : ""
947
+ ] }),
948
+ records.map((record) => /* @__PURE__ */ jsx4("span", { className: "inline-flex min-w-0 items-center", children: host.renderRecord?.({
949
+ ...record,
950
+ fallback: recordFallbackName(label2, record.id),
951
+ context: "applied",
952
+ trashed
953
+ }) }, `${record.noun}:${record.id}`))
858
954
  ]
859
955
  }
860
956
  );
@@ -865,7 +961,7 @@ function ApplyDirectiveButton({
865
961
  {
866
962
  type: "button",
867
963
  onClick: () => void handleApply(),
868
- disabled: state.status === "applying" || items.length === 0,
964
+ disabled: state.status === "applying" || state.status === "asking" || items.length === 0,
869
965
  className: "inline-flex items-center gap-1 rounded-md border border-border bg-background px-2 py-1 text-xs font-medium hover:bg-accent disabled:opacity-50",
870
966
  children: [
871
967
  state.status === "applying" ? /* @__PURE__ */ jsx4(LoaderIcon, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ jsx4(PlayIcon, { className: "h-3.5 w-3.5" }),
@@ -976,6 +1072,7 @@ import {
976
1072
  itemFacts,
977
1073
  itemSubtitle,
978
1074
  itemTitle,
1075
+ nounLabel as nounLabel2,
979
1076
  nounTitleColumn
980
1077
  } from "@ai-matrx/content-ir";
981
1078
  import { Fragment, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
@@ -987,6 +1084,10 @@ function ItemRow({
987
1084
  total
988
1085
  }) {
989
1086
  const host = useDirectiveHost();
1087
+ const recordId = TARGETING_CLASSES.has(directive.directiveClass) ? itemRecordId(item) : null;
1088
+ if (recordId) {
1089
+ return /* @__PURE__ */ jsx7(TargetRow, { directive, item, recordId });
1090
+ }
990
1091
  const titleColumn = nounTitleColumn(directive.noun, host.nouns);
991
1092
  const title = itemTitle(item, titleColumn, index, total);
992
1093
  const subtitle = itemSubtitle(item);
@@ -1027,6 +1128,41 @@ function ItemRow({
1027
1128
  host.renderCopy?.({ label: title, value: item, kind, size: "xs" })
1028
1129
  ] });
1029
1130
  }
1131
+ function TargetRow({
1132
+ directive,
1133
+ item,
1134
+ recordId
1135
+ }) {
1136
+ const host = useDirectiveHost();
1137
+ const fallback = recordFallbackName(nounLabel2(directive.noun, host.nouns), recordId);
1138
+ const changes = directive.directiveClass === "update" ? itemChanges(item) : [];
1139
+ const name = host.renderRecord ? host.renderRecord({ noun: directive.noun, id: recordId, fallback, context: "row" }) : /* @__PURE__ */ jsx7("span", { className: "truncate font-medium text-foreground", children: fallback });
1140
+ return /* @__PURE__ */ jsxs5("div", { className: "py-1 text-xs", "data-directive-target": recordId, children: [
1141
+ /* @__PURE__ */ jsxs5("div", { className: "flex min-w-0 items-center gap-2", children: [
1142
+ /* @__PURE__ */ jsx7("span", { className: "flex min-w-0 flex-1 items-center gap-1 px-1", children: name }),
1143
+ host.renderCopy?.({ label: fallback, value: item, size: "xs" })
1144
+ ] }),
1145
+ directive.directiveClass === "update" ? changes.length === 0 ? /* @__PURE__ */ jsx7("p", { className: "px-1 text-[11px] text-muted-foreground", children: "Sets no fields \u2014 nothing would change." }) : /* @__PURE__ */ jsx7("ul", { className: "mt-0.5 space-y-0.5 px-1", children: changes.map((change) => /* @__PURE__ */ jsxs5(
1146
+ "li",
1147
+ {
1148
+ className: "flex min-w-0 items-baseline gap-1.5 text-[11px]",
1149
+ title: `${change.label} \u2192 ${change.full}`,
1150
+ children: [
1151
+ /* @__PURE__ */ jsx7("span", { className: "shrink-0 text-muted-foreground", children: change.label }),
1152
+ /* @__PURE__ */ jsx7("span", { "aria-hidden": true, className: "shrink-0 text-muted-foreground", children: "\u2192" }),
1153
+ /* @__PURE__ */ jsx7(
1154
+ "span",
1155
+ {
1156
+ className: `min-w-0 truncate ${change.clears ? "italic text-muted-foreground" : "text-foreground"}`,
1157
+ children: change.value
1158
+ }
1159
+ )
1160
+ ]
1161
+ },
1162
+ change.key
1163
+ )) }) : null
1164
+ ] });
1165
+ }
1030
1166
  function SideEffectDirectiveCard({ directive }) {
1031
1167
  const host = useDirectiveHost();
1032
1168
  const [expanded, setExpanded] = useState2(false);
@@ -1533,6 +1669,7 @@ var DbKindComponentErrorBoundary = class extends React2.Component {
1533
1669
  };
1534
1670
  export {
1535
1671
  ApplyDirectiveButton,
1672
+ CHANGE_VALUE_MAX,
1536
1673
  ComponentResolver,
1537
1674
  ContentIrRenderProvider,
1538
1675
  DB_KIND_COMPONENT_KEY,
@@ -1553,21 +1690,26 @@ export {
1553
1690
  ProvisionalKindFrame,
1554
1691
  RunResultView,
1555
1692
  SideEffectDirectiveCard,
1693
+ TARGETING_CLASSES,
1556
1694
  applyIrKindRoute,
1557
1695
  consoleErrorReporter,
1558
1696
  createDbKindComponentCache,
1559
1697
  createKindRouteBinding,
1560
1698
  envelopeFromPartialKind,
1699
+ fieldLabel,
1561
1700
  getDirectiveRenderer,
1562
1701
  isDbKindComponentBodyPending,
1563
1702
  isPartialReadyKind,
1564
1703
  isProvisionalBlock,
1565
1704
  isRecordValue,
1705
+ itemChanges,
1706
+ itemRecordId,
1566
1707
  kindIsRoutable,
1567
1708
  kindServerDataFromStoredValue,
1568
1709
  markKindPartialUnsafe,
1569
1710
  provisionalDirectiveSlug,
1570
1711
  readIrRouteMarker,
1712
+ recordFallbackName,
1571
1713
  registerDirectiveRenderer,
1572
1714
  resetDirectiveRenderers,
1573
1715
  resetPartialUnsafeKinds,