@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/dist/react.d.cts CHANGED
@@ -1,9 +1,9 @@
1
- import { c as KindDefinitionSource, C as ContentIrHost } from './host-types-a0XEr5b3.cjs';
2
- import { d as ComponentResolutionSource } from './component-resolution.types-C1MzCf2s.cjs';
1
+ import { c as KindDefinitionSource, C as ContentIrHost } from './host-types-CKu4ap5K.cjs';
2
+ import { d as ComponentResolutionSource } from './component-resolution.types-DwKSF64x.cjs';
3
3
  import * as react from 'react';
4
4
  import react__default, { ReactNode } from 'react';
5
5
  import '@ai-matrx/content-ir';
6
- import './directive-host-C4TcPpxX.cjs';
6
+ import './directive-host-BOML4BQ7.cjs';
7
7
 
8
8
  /**
9
9
  * The two registries this hook watches. Passed explicitly by a host whose
@@ -87,7 +87,7 @@ declare function KindInstanceRender(props: KindInstanceRenderProps): react.JSX.E
87
87
  /**
88
88
  * The safety net + the "still arriving" affordance for a provisional kind
89
89
  * render (streaming partial kinds — see `route/partial-kind-route.ts` and
90
- * `common-docs/systems/content-ir-system/STREAMING_PARTIAL_KINDS.md`).
90
+ * `common-docs/systems/architecture/content-ir/STREAMING_PARTIAL_KINDS.md`).
91
91
  *
92
92
  * TWO JOBS
93
93
  * --------
package/dist/react.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { c as KindDefinitionSource, C as ContentIrHost } from './host-types-CEc86R-v.js';
2
- import { d as ComponentResolutionSource } from './component-resolution.types-C1MzCf2s.js';
1
+ import { c as KindDefinitionSource, C as ContentIrHost } from './host-types-CQ2oIzUy.js';
2
+ import { d as ComponentResolutionSource } from './component-resolution.types-DwKSF64x.js';
3
3
  import * as react from 'react';
4
4
  import react__default, { ReactNode } from 'react';
5
5
  import '@ai-matrx/content-ir';
6
- import './directive-host-C4TcPpxX.js';
6
+ import './directive-host-BOML4BQ7.js';
7
7
 
8
8
  /**
9
9
  * The two registries this hook watches. Passed explicitly by a host whose
@@ -87,7 +87,7 @@ declare function KindInstanceRender(props: KindInstanceRenderProps): react.JSX.E
87
87
  /**
88
88
  * The safety net + the "still arriving" affordance for a provisional kind
89
89
  * render (streaming partial kinds — see `route/partial-kind-route.ts` and
90
- * `common-docs/systems/content-ir-system/STREAMING_PARTIAL_KINDS.md`).
90
+ * `common-docs/systems/architecture/content-ir/STREAMING_PARTIAL_KINDS.md`).
91
91
  *
92
92
  * TWO JOBS
93
93
  * --------
package/dist/react.js CHANGED
@@ -170,6 +170,30 @@ function itemChanges(item, current, options = {}) {
170
170
  return out;
171
171
  }
172
172
 
173
+ // directives/failure-words.ts
174
+ var PAST = {
175
+ create: "created",
176
+ update: "updated",
177
+ delete: "deleted"
178
+ };
179
+ function defaultFailureWords(failure) {
180
+ const verbed = PAST[failure.directiveClass] ?? "applied";
181
+ const noun = failure.nounLabel.trim().toLowerCase() || "item";
182
+ if (failure.failed && failure.total && failure.total > 1) {
183
+ return {
184
+ what: `${failure.failed} of ${failure.total} weren't ${verbed}.`,
185
+ next: "Retry to try those again."
186
+ };
187
+ }
188
+ return {
189
+ what: `The ${noun} wasn't ${verbed}.`,
190
+ next: "Try again in a moment."
191
+ };
192
+ }
193
+ function failureWords(failure, explain) {
194
+ return explain?.(failure) ?? defaultFailureWords(failure);
195
+ }
196
+
173
197
  // directives/icons.tsx
174
198
  import { jsx as jsx3, jsxs } from "react/jsx-runtime";
175
199
  function Svg({ children, ...props }) {
@@ -427,10 +451,23 @@ function ApplyDirectiveButton({
427
451
  children: [
428
452
  /* @__PURE__ */ jsxs2("span", { className: "inline-flex min-w-0 items-start gap-1", children: [
429
453
  bad ? /* @__PURE__ */ jsx4(AlertIcon, { className: "mt-px h-3.5 w-3.5 shrink-0" }) : /* @__PURE__ */ jsx4(CheckCircleIcon, { className: "mt-px h-3.5 w-3.5 shrink-0" }),
430
- /* @__PURE__ */ jsxs2("span", { className: "min-w-0", children: [
431
- state.message ?? `Applied ${state.applied}`,
432
- bad && !state.message ? ` \xB7 ${state.failed} failed` : ""
433
- ] })
454
+ bad ? /* @__PURE__ */ jsx4(
455
+ FailureNotice,
456
+ {
457
+ words: failureWords(
458
+ {
459
+ raw: state.message ?? `${state.failed} failed`,
460
+ directiveClass: directive.directiveClass,
461
+ noun: directive.noun,
462
+ nounLabel: nounText,
463
+ failed: state.failed,
464
+ total: state.applied + state.failed
465
+ },
466
+ host.explainFailure
467
+ ),
468
+ raw: state.message
469
+ }
470
+ ) : /* @__PURE__ */ jsx4("span", { className: "min-w-0", children: state.message ?? `Applied ${state.applied}` })
434
471
  ] }),
435
472
  state.copies > 1 ? /* @__PURE__ */ jsx4(
436
473
  "span",
@@ -507,10 +544,64 @@ function ApplyDirectiveButton({
507
544
  ]
508
545
  }
509
546
  ),
510
- state.status === "error" ? /* @__PURE__ */ jsxs2("span", { className: "inline-flex max-w-sm items-start gap-1 text-xs text-destructive", children: [
511
- /* @__PURE__ */ jsx4(AlertIcon, { className: "mt-0.5 h-3.5 w-3.5 shrink-0" }),
512
- /* @__PURE__ */ jsx4("span", { children: state.message })
513
- ] }) : null
547
+ state.status === "error" ? /* @__PURE__ */ jsxs2(
548
+ "span",
549
+ {
550
+ className: "inline-flex max-w-sm items-start gap-1 text-xs text-destructive",
551
+ "data-apply-state": "error",
552
+ children: [
553
+ /* @__PURE__ */ jsx4(AlertIcon, { className: "mt-0.5 h-3.5 w-3.5 shrink-0" }),
554
+ /* @__PURE__ */ jsx4(
555
+ FailureNotice,
556
+ {
557
+ words: failureWords(
558
+ {
559
+ raw: state.message,
560
+ directiveClass: directive.directiveClass,
561
+ noun: directive.noun,
562
+ nounLabel: nounText
563
+ },
564
+ host.explainFailure
565
+ ),
566
+ raw: state.message
567
+ }
568
+ )
569
+ ]
570
+ }
571
+ ) : null
572
+ ] });
573
+ }
574
+ function FailureNotice({
575
+ words,
576
+ raw
577
+ }) {
578
+ const [open, setOpen] = useState(false);
579
+ const detail = raw?.trim() ?? "";
580
+ return /* @__PURE__ */ jsxs2("span", { className: "flex min-w-0 flex-col gap-0.5", "data-apply-failure": true, children: [
581
+ /* @__PURE__ */ jsxs2("span", { className: "min-w-0", children: [
582
+ words.what,
583
+ " ",
584
+ words.next,
585
+ detail ? /* @__PURE__ */ jsx4(
586
+ "button",
587
+ {
588
+ type: "button",
589
+ onClick: () => setOpen((v) => !v),
590
+ "aria-expanded": open,
591
+ className: "ml-1 underline underline-offset-2 hover:no-underline",
592
+ "data-apply-failure-details-toggle": true,
593
+ children: open ? "Hide details" : "Details"
594
+ }
595
+ ) : null
596
+ ] }),
597
+ open && detail ? /* @__PURE__ */ jsx4(
598
+ "span",
599
+ {
600
+ className: "block max-w-sm select-text break-words font-mono text-[11px] text-muted-foreground",
601
+ "data-apply-failure-details": true,
602
+ children: detail
603
+ }
604
+ ) : null
514
605
  ] });
515
606
  }
516
607