@ai-matrx/content-ir-react 0.16.1 → 0.17.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.
Files changed (43) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +1 -1
  3. package/dist/{component-resolution.types-DLO2w-0n.d.cts → component-resolution.types-DY4pGymy.d.cts} +1 -1
  4. package/dist/{component-resolution.types-DLO2w-0n.d.ts → component-resolution.types-DY4pGymy.d.ts} +1 -1
  5. package/dist/{component-resolution.types-C1MzCf2s.d.cts → component-resolution.types-DwKSF64x.d.cts} +1 -1
  6. package/dist/{component-resolution.types-C1MzCf2s.d.ts → component-resolution.types-DwKSF64x.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/{directive-host-C4TcPpxX.d.cts → directive-host-BOML4BQ7.d.cts} +27 -1
  10. package/dist/{directive-host-C4TcPpxX.d.ts → directive-host-BOML4BQ7.d.ts} +27 -1
  11. package/dist/directives.cjs +101 -8
  12. package/dist/directives.cjs.map +1 -1
  13. package/dist/directives.d.cts +19 -3
  14. package/dist/directives.d.ts +19 -3
  15. package/dist/directives.js +101 -8
  16. package/dist/directives.js.map +1 -1
  17. package/dist/{host-types-a0XEr5b3.d.cts → host-types-CKu4ap5K.d.cts} +2 -2
  18. package/dist/{host-types-CEc86R-v.d.ts → host-types-CQ2oIzUy.d.ts} +2 -2
  19. package/dist/host.cjs.map +1 -1
  20. package/dist/host.d.cts +4 -4
  21. package/dist/host.d.ts +4 -4
  22. package/dist/host.js.map +1 -1
  23. package/dist/index.cjs +101 -8
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.cts +22 -6
  26. package/dist/index.d.ts +22 -6
  27. package/dist/index.js +101 -8
  28. package/dist/index.js.map +1 -1
  29. package/dist/react.cjs +99 -8
  30. package/dist/react.cjs.map +1 -1
  31. package/dist/react.d.cts +4 -4
  32. package/dist/react.d.ts +4 -4
  33. package/dist/react.js +99 -8
  34. package/dist/react.js.map +1 -1
  35. package/dist/resolver.d.cts +2 -2
  36. package/dist/resolver.d.ts +2 -2
  37. package/dist/{route-De9c5YgW.d.ts → route-D0f5H63n.d.ts} +29 -3
  38. package/dist/{route-YcoyR3Fj.d.cts → route-D2Yz3El4.d.cts} +29 -3
  39. package/dist/route.cjs.map +1 -1
  40. package/dist/route.d.cts +2 -2
  41. package/dist/route.d.ts +2 -2
  42. package/dist/route.js.map +1 -1
  43. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.17.1
4
+
5
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
6
+ `git diff npm/content-ir-react/v0.17.0..npm/content-ir-react/v0.17.1 -- apps/shared/content-ir-react`).
7
+ No source changes intended and no consumer action required.
8
+
9
+ ## 0.17.0 — 2026-10-02
10
+
11
+ - **A failed apply speaks plainly.** The card no longer prints the server's text as its
12
+ sentence (G5 review: "unknown / non-writable noun 'task'. Writable: [...]"). It says what
13
+ failed and what to do — "The task wasn't created. Try again in a moment." / "1 of 2 weren't
14
+ created. Retry to try those again." — and keeps the raw text behind a **Details** toggle
15
+ (`data-apply-failure`, `data-apply-failure-details`). New host seam
16
+ `DirectiveHost.explainFailure(failure) → { what, next } | null` names failures the host
17
+ recognises; `defaultFailureWords` / `failureWords` are exported. Guard:
18
+ `__tests__/directive-failure-words.test.tsx` (3 red on 0.16.1).
19
+
20
+ Consumer action: a host whose `confirm` rejected with a person-ready sentence should map it
21
+ in `explainFailure`; otherwise that sentence now sits behind Details under the default words.
22
+
3
23
  ## 0.16.1 — 2026-10-02
4
24
 
5
25
  - **A record's title column reads "Title" everywhere.** `itemChanges(item, current,
package/README.md CHANGED
@@ -74,5 +74,5 @@ cannot express what your host needs, add a seam; never fork the route.
74
74
  ## Docs
75
75
 
76
76
  - Package internals and boundary: `FEATURE.md` beside this file.
77
- - Cross-repo system-of-record: `common-docs/systems/content-ir-twin/FEATURE.md`.
77
+ - Cross-repo system-of-record: `common-docs/systems/architecture/content-ir/content-ir-twin-FEATURE.md`.
78
78
  - Shape System semantics: `matrx-frontend/features/content-ir/docs/SHAPE_SYSTEM.md`.
@@ -29,7 +29,7 @@ declare const consoleErrorReporter: ContentIrErrorReporter;
29
29
  * resolver contract (rulings R1 + R6), stated once for every UI.
30
30
  *
31
31
  * Cross-repo system-of-record:
32
- * `common-docs/systems/content-ir-twin/FEATURE.md` (package boundary) and
32
+ * `common-docs/systems/architecture/content-ir/content-ir-twin-FEATURE.md` (package boundary) and
33
33
  * `matrx-frontend/features/content-ir/docs/SHAPE_SYSTEM.md` (the semantics).
34
34
  *
35
35
  * Nothing here knows where a row comes from. A host supplies rows from
@@ -29,7 +29,7 @@ declare const consoleErrorReporter: ContentIrErrorReporter;
29
29
  * resolver contract (rulings R1 + R6), stated once for every UI.
30
30
  *
31
31
  * Cross-repo system-of-record:
32
- * `common-docs/systems/content-ir-twin/FEATURE.md` (package boundary) and
32
+ * `common-docs/systems/architecture/content-ir/content-ir-twin-FEATURE.md` (package boundary) and
33
33
  * `matrx-frontend/features/content-ir/docs/SHAPE_SYSTEM.md` (the semantics).
34
34
  *
35
35
  * Nothing here knows where a row comes from. A host supplies rows from
@@ -29,7 +29,7 @@ declare const consoleErrorReporter: ContentIrErrorReporter;
29
29
  * resolver contract (rulings R1 + R6), stated once for every UI.
30
30
  *
31
31
  * Cross-repo system-of-record:
32
- * `common-docs/systems/content-ir-twin/FEATURE.md` (package boundary) and
32
+ * `common-docs/systems/architecture/content-ir/content-ir-twin-FEATURE.md` (package boundary) and
33
33
  * `matrx-frontend/features/content-ir/docs/SHAPE_SYSTEM.md` (the semantics).
34
34
  *
35
35
  * Nothing here knows where a row comes from. A host supplies rows from
@@ -29,7 +29,7 @@ declare const consoleErrorReporter: ContentIrErrorReporter;
29
29
  * resolver contract (rulings R1 + R6), stated once for every UI.
30
30
  *
31
31
  * Cross-repo system-of-record:
32
- * `common-docs/systems/content-ir-twin/FEATURE.md` (package boundary) and
32
+ * `common-docs/systems/architecture/content-ir/content-ir-twin-FEATURE.md` (package boundary) and
33
33
  * `matrx-frontend/features/content-ir/docs/SHAPE_SYSTEM.md` (the semantics).
34
34
  *
35
35
  * Nothing here knows where a row comes from. A host supplies rows from
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { C as ComponentResolution, a as ContentIrErrorReporter } from './component-resolution.types-C1MzCf2s.cjs';
2
+ import { C as ComponentResolution, a as ContentIrErrorReporter } from './component-resolution.types-DwKSF64x.cjs';
3
3
 
4
4
  /**
5
5
  * The DB-component COMPILE CACHE — session-scoped, keyed per winning row
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { C as ComponentResolution, a as ContentIrErrorReporter } from './component-resolution.types-C1MzCf2s.js';
2
+ import { C as ComponentResolution, a as ContentIrErrorReporter } from './component-resolution.types-DwKSF64x.js';
3
3
 
4
4
  /**
5
5
  * The DB-component COMPILE CACHE — session-scoped, keyed per winning row
@@ -166,6 +166,32 @@ interface DirectiveHost {
166
166
  itemKind?: DirectiveItemKindLookup;
167
167
  /** Where a decode failure or an unhonourable shell is reported. Default: console.error. */
168
168
  reportError?: (message: string) => void;
169
+ /**
170
+ * Plain words for a failed apply the host recognises ("This button can't
171
+ * create a task yet." + "Create it from Tasks instead."). The card never shows
172
+ * the server's raw text as its sentence: it shows these words — or its own
173
+ * verb-aware default — and keeps the raw text behind "Details". Return null
174
+ * to use the default.
175
+ */
176
+ explainFailure?: (failure: DirectiveFailure) => DirectiveFailureWords | null;
177
+ }
178
+ /** One failed apply, as the card knows it. */
179
+ interface DirectiveFailure {
180
+ /** The server's / host's own text — technical; shown only behind Details. */
181
+ raw: string;
182
+ directiveClass: string;
183
+ noun: string;
184
+ /** The noun's display label ("Task"). */
185
+ nounLabel: string;
186
+ /** Items that failed, when some applied and some did not. */
187
+ failed?: number;
188
+ /** Items in the block. */
189
+ total?: number;
190
+ }
191
+ /** What failed and what to do — each one short sentence. */
192
+ interface DirectiveFailureWords {
193
+ what: string;
194
+ next: string;
169
195
  }
170
196
  /** Where a directive renders — today, the conversation it sits in (if any). */
171
197
  interface DirectiveScope {
@@ -193,4 +219,4 @@ declare function DirectiveHostProvider({ host, children }: DirectiveHostProvider
193
219
  */
194
220
  declare function useDirectiveHost(): DirectiveHost;
195
221
 
196
- export { type DirectiveRecordRef as D, type DirectiveApplyResult as a, type DirectiveApplyState as b, type DirectiveAskRequest as c, type DirectiveCopyProps as d, type DirectiveHost as e, DirectiveHostProvider as f, type DirectiveHostProviderProps as g, type DirectiveOpenItemOptions as h, type DirectiveRecordProps as i, type DirectiveScope as j, DirectiveScopeProvider as k, type DirectiveShell as l, useDirectiveScope as m, useDirectiveHost as u };
222
+ export { type DirectiveFailure as D, type DirectiveFailureWords as a, type DirectiveRecordRef as b, type DirectiveApplyResult as c, type DirectiveApplyState as d, type DirectiveAskRequest as e, type DirectiveCopyProps as f, type DirectiveHost as g, DirectiveHostProvider as h, type DirectiveHostProviderProps as i, type DirectiveOpenItemOptions as j, type DirectiveRecordProps as k, type DirectiveScope as l, DirectiveScopeProvider as m, type DirectiveShell as n, useDirectiveScope as o, useDirectiveHost as u };
@@ -166,6 +166,32 @@ interface DirectiveHost {
166
166
  itemKind?: DirectiveItemKindLookup;
167
167
  /** Where a decode failure or an unhonourable shell is reported. Default: console.error. */
168
168
  reportError?: (message: string) => void;
169
+ /**
170
+ * Plain words for a failed apply the host recognises ("This button can't
171
+ * create a task yet." + "Create it from Tasks instead."). The card never shows
172
+ * the server's raw text as its sentence: it shows these words — or its own
173
+ * verb-aware default — and keeps the raw text behind "Details". Return null
174
+ * to use the default.
175
+ */
176
+ explainFailure?: (failure: DirectiveFailure) => DirectiveFailureWords | null;
177
+ }
178
+ /** One failed apply, as the card knows it. */
179
+ interface DirectiveFailure {
180
+ /** The server's / host's own text — technical; shown only behind Details. */
181
+ raw: string;
182
+ directiveClass: string;
183
+ noun: string;
184
+ /** The noun's display label ("Task"). */
185
+ nounLabel: string;
186
+ /** Items that failed, when some applied and some did not. */
187
+ failed?: number;
188
+ /** Items in the block. */
189
+ total?: number;
190
+ }
191
+ /** What failed and what to do — each one short sentence. */
192
+ interface DirectiveFailureWords {
193
+ what: string;
194
+ next: string;
169
195
  }
170
196
  /** Where a directive renders — today, the conversation it sits in (if any). */
171
197
  interface DirectiveScope {
@@ -193,4 +219,4 @@ declare function DirectiveHostProvider({ host, children }: DirectiveHostProvider
193
219
  */
194
220
  declare function useDirectiveHost(): DirectiveHost;
195
221
 
196
- export { type DirectiveRecordRef as D, type DirectiveApplyResult as a, type DirectiveApplyState as b, type DirectiveAskRequest as c, type DirectiveCopyProps as d, type DirectiveHost as e, DirectiveHostProvider as f, type DirectiveHostProviderProps as g, type DirectiveOpenItemOptions as h, type DirectiveRecordProps as i, type DirectiveScope as j, DirectiveScopeProvider as k, type DirectiveShell as l, useDirectiveScope as m, useDirectiveHost as u };
222
+ export { type DirectiveFailure as D, type DirectiveFailureWords as a, type DirectiveRecordRef as b, type DirectiveApplyResult as c, type DirectiveApplyState as d, type DirectiveAskRequest as e, type DirectiveCopyProps as f, type DirectiveHost as g, DirectiveHostProvider as h, type DirectiveHostProviderProps as i, type DirectiveOpenItemOptions as j, type DirectiveRecordProps as k, type DirectiveScope as l, DirectiveScopeProvider as m, type DirectiveShell as n, useDirectiveScope as o, useDirectiveHost as u };
@@ -31,7 +31,9 @@ __export(directives_exports, {
31
31
  DirectiveScopeProvider: () => DirectiveScopeProvider,
32
32
  SideEffectDirectiveCard: () => SideEffectDirectiveCard,
33
33
  TARGETING_CLASSES: () => TARGETING_CLASSES,
34
+ defaultFailureWords: () => defaultFailureWords,
34
35
  describeChangeValue: () => describeChangeValue,
36
+ failureWords: () => failureWords,
35
37
  fieldLabel: () => fieldLabel,
36
38
  getDirectiveRenderer: () => getDirectiveRenderer,
37
39
  itemChanges: () => itemChanges,
@@ -167,6 +169,30 @@ function itemChanges(item, current, options = {}) {
167
169
  return out;
168
170
  }
169
171
 
172
+ // directives/failure-words.ts
173
+ var PAST = {
174
+ create: "created",
175
+ update: "updated",
176
+ delete: "deleted"
177
+ };
178
+ function defaultFailureWords(failure) {
179
+ const verbed = PAST[failure.directiveClass] ?? "applied";
180
+ const noun = failure.nounLabel.trim().toLowerCase() || "item";
181
+ if (failure.failed && failure.total && failure.total > 1) {
182
+ return {
183
+ what: `${failure.failed} of ${failure.total} weren't ${verbed}.`,
184
+ next: "Retry to try those again."
185
+ };
186
+ }
187
+ return {
188
+ what: `The ${noun} wasn't ${verbed}.`,
189
+ next: "Try again in a moment."
190
+ };
191
+ }
192
+ function failureWords(failure, explain) {
193
+ return explain?.(failure) ?? defaultFailureWords(failure);
194
+ }
195
+
170
196
  // directives/icons.tsx
171
197
  var import_jsx_runtime2 = require("react/jsx-runtime");
172
198
  function Svg({ children, ...props }) {
@@ -424,10 +450,23 @@ function ApplyDirectiveButton({
424
450
  children: [
425
451
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "inline-flex min-w-0 items-start gap-1", children: [
426
452
  bad ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(AlertIcon, { className: "mt-px h-3.5 w-3.5 shrink-0" }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CheckCircleIcon, { className: "mt-px h-3.5 w-3.5 shrink-0" }),
427
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "min-w-0", children: [
428
- state.message ?? `Applied ${state.applied}`,
429
- bad && !state.message ? ` \xB7 ${state.failed} failed` : ""
430
- ] })
453
+ bad ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
454
+ FailureNotice,
455
+ {
456
+ words: failureWords(
457
+ {
458
+ raw: state.message ?? `${state.failed} failed`,
459
+ directiveClass: directive.directiveClass,
460
+ noun: directive.noun,
461
+ nounLabel: nounText,
462
+ failed: state.failed,
463
+ total: state.applied + state.failed
464
+ },
465
+ host.explainFailure
466
+ ),
467
+ raw: state.message
468
+ }
469
+ ) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "min-w-0", children: state.message ?? `Applied ${state.applied}` })
431
470
  ] }),
432
471
  state.copies > 1 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
433
472
  "span",
@@ -504,10 +543,64 @@ function ApplyDirectiveButton({
504
543
  ]
505
544
  }
506
545
  ),
507
- state.status === "error" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "inline-flex max-w-sm items-start gap-1 text-xs text-destructive", children: [
508
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(AlertIcon, { className: "mt-0.5 h-3.5 w-3.5 shrink-0" }),
509
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: state.message })
510
- ] }) : null
546
+ state.status === "error" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
547
+ "span",
548
+ {
549
+ className: "inline-flex max-w-sm items-start gap-1 text-xs text-destructive",
550
+ "data-apply-state": "error",
551
+ children: [
552
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(AlertIcon, { className: "mt-0.5 h-3.5 w-3.5 shrink-0" }),
553
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
554
+ FailureNotice,
555
+ {
556
+ words: failureWords(
557
+ {
558
+ raw: state.message,
559
+ directiveClass: directive.directiveClass,
560
+ noun: directive.noun,
561
+ nounLabel: nounText
562
+ },
563
+ host.explainFailure
564
+ ),
565
+ raw: state.message
566
+ }
567
+ )
568
+ ]
569
+ }
570
+ ) : null
571
+ ] });
572
+ }
573
+ function FailureNotice({
574
+ words,
575
+ raw
576
+ }) {
577
+ const [open, setOpen] = (0, import_react2.useState)(false);
578
+ const detail = raw?.trim() ?? "";
579
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "flex min-w-0 flex-col gap-0.5", "data-apply-failure": true, children: [
580
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "min-w-0", children: [
581
+ words.what,
582
+ " ",
583
+ words.next,
584
+ detail ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
585
+ "button",
586
+ {
587
+ type: "button",
588
+ onClick: () => setOpen((v) => !v),
589
+ "aria-expanded": open,
590
+ className: "ml-1 underline underline-offset-2 hover:no-underline",
591
+ "data-apply-failure-details-toggle": true,
592
+ children: open ? "Hide details" : "Details"
593
+ }
594
+ ) : null
595
+ ] }),
596
+ open && detail ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
597
+ "span",
598
+ {
599
+ className: "block max-w-sm select-text break-words font-mono text-[11px] text-muted-foreground",
600
+ "data-apply-failure-details": true,
601
+ children: detail
602
+ }
603
+ ) : null
511
604
  ] });
512
605
  }
513
606