@ai-matrx/rich-content 0.2.49 → 0.2.50

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,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+
4
+ ## 0.2.50
5
+
6
+ - `utils/client-lazy` re-exports `@ai-matrx/kit/client-lazy` (`clientLazy`, `useIsClient`) — one home
7
+ for the host-neutral lazy loader; chat's identical copy points there too (architecture step 3).
8
+
9
+ Consumer action: none. Needs `@ai-matrx/kit` ≥ 0.38.0.
10
+
3
11
  ## 0.2.49
4
12
 
5
13
  - The code block's HTML "Preview" button opens the `html` canvas kind with the source
@@ -1,13 +1 @@
1
- /**
2
- * `clientLazy` — the package's replacement for `next/dynamic(..., { ssr: false })`: a lazily
3
- * loaded component that renders only on the client. On the server and during hydration it
4
- * renders `loading` (hydration-safe through `useSyncExternalStore`); on the client it renders
5
- * the loaded component inside a Suspense boundary with the same `loading` as the fallback.
6
- */
7
- import { type ComponentType } from "react";
8
- export declare function useIsClient(): boolean;
9
- export declare function clientLazy<P extends object>(load: () => Promise<{
10
- default: ComponentType<P>;
11
- } | ComponentType<P>>, options?: {
12
- loading?: ComponentType;
13
- }): ComponentType<P>;
1
+ export { clientLazy, useIsClient } from "@ai-matrx/kit/client-lazy";
@@ -1,26 +1,5 @@
1
1
  "use client";
2
- import { createElement, lazy, Suspense, useSyncExternalStore } from "react";
3
- const subscribe = () => () => {
4
- };
5
- const onClient = () => true;
6
- const onServer = () => false;
7
- function useIsClient() {
8
- return useSyncExternalStore(subscribe, onClient, onServer);
9
- }
10
- function clientLazy(load, options = {}) {
11
- const Lazy = lazy(async () => {
12
- const m = await load();
13
- return typeof m === "function" || !("default" in m) ? { default: m } : m;
14
- });
15
- const Loading = options.loading;
16
- function ClientLazy(props) {
17
- const client = useIsClient();
18
- const fallback = Loading ? createElement(Loading) : null;
19
- if (!client) return fallback;
20
- return createElement(Suspense, { fallback }, createElement(Lazy, props));
21
- }
22
- return ClientLazy;
23
- }
2
+ import { clientLazy, useIsClient } from "@ai-matrx/kit/client-lazy";
24
3
  export {
25
4
  clientLazy,
26
5
  useIsClient
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-matrx/rich-content",
3
- "version": "0.2.49",
3
+ "version": "0.2.50",
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",
@@ -132,19 +132,19 @@
132
132
  "yaml": "^2.9.1",
133
133
  "@ai-matrx/agents": "latest",
134
134
  "@ai-matrx/alchemy": "latest",
135
- "@ai-matrx/canvas": "latest",
136
135
  "@ai-matrx/content-ir": "latest",
137
136
  "@ai-matrx/content-ir-react": "latest",
138
137
  "@ai-matrx/data": "latest",
139
138
  "@ai-matrx/design-system": "latest",
140
- "@ai-matrx/diff": "latest",
139
+ "@ai-matrx/canvas": "latest",
141
140
  "@ai-matrx/icons": "latest",
142
- "@ai-matrx/media": "latest",
141
+ "@ai-matrx/kit": "latest",
143
142
  "@ai-matrx/print": "latest",
144
143
  "@ai-matrx/records": "latest",
144
+ "@ai-matrx/media": "latest",
145
145
  "@ai-matrx/records-ui": "latest",
146
- "@ai-matrx/tap-target": "latest",
147
- "@ai-matrx/kit": "latest"
146
+ "@ai-matrx/diff": "latest",
147
+ "@ai-matrx/tap-target": "latest"
148
148
  },
149
149
  "peerDependencies": {
150
150
  "react": ">=19.0.0",