@ai-matrx/rich-content 0.2.99 → 0.2.100

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 CHANGED
@@ -1,11 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.100
4
+ ### Unreleased
5
+
6
+ - Fix: a hook binding (`app.use*`) is chosen once per component, never per render. A component that
7
+ rendered on the bare fallback before the app's lazy bindings landed, then re-rendered with the app's
8
+ hook, changed its hook count and threw React #310/#311 (live: the Applet builder's first send,
9
+ `useDocumentDialogsHost` from the assistant footer, "This section could not be displayed"). Such a
10
+ component keeps the bare behaviour until it remounts. Consumer action: none.
11
+
3
12
  ## 0.2.99
4
13
 
5
14
  Automatic changed-only republish (docs/metadata drift since the last tag — see
6
15
  `git diff npm/rich-content/v0.2.98..npm/rich-content/v0.2.99 -- apps/shared/rich-content`).
7
16
  No source changes intended and no consumer action required.
8
17
 
18
+ ## 0.2.98
19
+
20
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
21
+ `git diff npm/rich-content/v0.2.97..npm/rich-content/v0.2.98 -- apps/shared/rich-content`).
22
+ No source changes intended and no consumer action required.
23
+
9
24
  ## 0.2.97
10
25
 
11
26
  Automatic changed-only republish (docs/metadata drift since the last tag — see
@@ -1,18 +1,25 @@
1
1
  "use client";
2
2
  import { ConfirmDialog as DesignSystemConfirmDialog } from "@ai-matrx/design-system";
3
- import { createElement, lazy, Suspense } from "react";
3
+ import { createElement, lazy, Suspense, useRef } from "react";
4
4
  import { GenericStructuredView } from "@ai-matrx/content-ir-react";
5
5
  import { ContentIrHostBoundary } from "./ContentIrHostBoundary.js";
6
6
  import { announceBareHost, BARE_HOST_ATTR, hostCapability } from "./registry.js";
7
7
  function binding(key) {
8
8
  return hostCapability("app")?.[key];
9
9
  }
10
+ const HOOK_KEY = /^use[A-Z]/;
10
11
  function fn(key, fallback, degraded) {
11
- return (...args) => {
12
+ const pick = () => {
12
13
  const impl = binding(key);
13
- if (impl) return impl(...args);
14
+ if (impl) return impl;
14
15
  announceBareHost(`app.${String(key)}`, degraded);
15
- return fallback(...args);
16
+ return fallback;
17
+ };
18
+ if (!HOOK_KEY.test(String(key))) return (...args) => pick()(...args);
19
+ return function useHostBinding(...args) {
20
+ const chosen = useRef(null);
21
+ chosen.current ??= pick();
22
+ return chosen.current(...args);
16
23
  };
17
24
  }
18
25
  function component(key, Fallback, degraded) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-matrx/rich-content",
3
- "version": "0.2.99",
3
+ "version": "0.2.100",
4
4
  "description": "The AI Matrx formatted-text engine: the one markdown renderer, streaming markdown, the block splitter and renderer, the generic blocks, <RichContent> levels, the rich-document action registry and menus, copy, and the selection toolbar — as portable React.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -130,20 +130,20 @@
130
130
  "unist-util-visit": "^5.1.0",
131
131
  "unist-util-visit-parents": "^6.0.2",
132
132
  "yaml": "^2.9.1",
133
- "@ai-matrx/agents": "latest",
134
133
  "@ai-matrx/alchemy": "latest",
134
+ "@ai-matrx/canvas": "latest",
135
135
  "@ai-matrx/content-ir": "latest",
136
136
  "@ai-matrx/data": "latest",
137
137
  "@ai-matrx/design-system": "latest",
138
- "@ai-matrx/canvas": "latest",
138
+ "@ai-matrx/agents": "latest",
139
139
  "@ai-matrx/content-ir-react": "latest",
140
140
  "@ai-matrx/diff": "latest",
141
141
  "@ai-matrx/icons": "latest",
142
- "@ai-matrx/kit": "latest",
143
142
  "@ai-matrx/media": "latest",
143
+ "@ai-matrx/print": "latest",
144
144
  "@ai-matrx/records": "latest",
145
145
  "@ai-matrx/records-ui": "latest",
146
- "@ai-matrx/print": "latest"
146
+ "@ai-matrx/kit": "latest"
147
147
  },
148
148
  "peerDependencies": {
149
149
  "react": ">=19.0.0",
@@ -204,5 +204,5 @@
204
204
  "verify:modules-tarball": "node ./scripts/verify-modules-tarball.mjs",
205
205
  "verify:tarball": "node ./scripts/verify-tarball.mjs"
206
206
  },
207
- "gitHead": "ec969cf6169fd1c376feb4eb7e4ec3e5aa07e607"
207
+ "gitHead": "63010c3e5654507e4dc53a59213abcc2c6b354ec"
208
208
  }