@ai-matrx/rich-content 0.2.85 → 0.2.87
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,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.87
|
|
4
|
+
|
|
5
|
+
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
|
6
|
+
`git diff npm/rich-content/v0.2.86..npm/rich-content/v0.2.87 -- apps/shared/rich-content`).
|
|
7
|
+
No source changes intended and no consumer action required.
|
|
8
|
+
|
|
9
|
+
## 0.2.86
|
|
10
|
+
|
|
11
|
+
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
|
12
|
+
`git diff npm/rich-content/v0.2.85..npm/rich-content/v0.2.86 -- apps/shared/rich-content`).
|
|
13
|
+
No source changes intended and no consumer action required.
|
|
14
|
+
|
|
3
15
|
## 0.2.85
|
|
4
16
|
|
|
5
17
|
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { renderMermaid } from "./runtime.js";
|
|
2
|
-
import { closeFence, fenceOpenerOf } from "@ai-matrx/content-ir/source";
|
|
2
|
+
import { closeFence, fenceOpenerOf, soleFence } from "@ai-matrx/content-ir/source";
|
|
3
3
|
const PRINT_OPTIONS = { theme: "default", look: "classic", layout: "dagre" };
|
|
4
4
|
function mermaidFenceSources(markdown) {
|
|
5
5
|
const out = [];
|
|
@@ -21,8 +21,7 @@ function mermaidFenceSources(markdown) {
|
|
|
21
21
|
return out;
|
|
22
22
|
}
|
|
23
23
|
function mermaidSourceOf(body) {
|
|
24
|
-
|
|
25
|
-
return (fenced ? fenced[2] : body).trim();
|
|
24
|
+
return (soleFence(body)?.body ?? body).trim();
|
|
26
25
|
}
|
|
27
26
|
async function drawMermaidForPrint(markdown, extraBodies = []) {
|
|
28
27
|
const pictures = /* @__PURE__ */ new Map();
|
|
@@ -2,4 +2,18 @@ export interface ShimmerTextProps {
|
|
|
2
2
|
text: string;
|
|
3
3
|
className?: string;
|
|
4
4
|
}
|
|
5
|
+
/**
|
|
6
|
+
* The shimmer's colours and size as design-token utility classes — no
|
|
7
|
+
* `hsl(var(--x))` wrap (a host whose theme variables are full colour values
|
|
8
|
+
* would read that as invalid and paint transparent text) and no host-defined
|
|
9
|
+
* `animate-*` utility. Any host that resolves the design-system's colour
|
|
10
|
+
* classes resolves these identically.
|
|
11
|
+
*/
|
|
12
|
+
export declare const SHIMMER_GRADIENT_CLASSES = "bg-gradient-to-r from-muted-foreground/30 via-foreground to-muted-foreground/30 bg-[length:200%_100%]";
|
|
13
|
+
/**
|
|
14
|
+
* Drives the left-to-right sweep with the Web Animations API, so the package
|
|
15
|
+
* ships its own motion: no `@keyframes`, no Tailwind `animate-*` entry, no
|
|
16
|
+
* stylesheet import required of the host. Respects reduced motion.
|
|
17
|
+
*/
|
|
18
|
+
export declare function useShimmerSweep<T extends HTMLElement>(durationMs?: number): (el: T | null) => void;
|
|
5
19
|
export declare function ShimmerText({ text, className }: ShimmerTextProps): import("react").JSX.Element;
|
|
@@ -1,21 +1,39 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { cn } from "@ai-matrx/design-system";
|
|
4
|
+
import { useCallback, useRef } from "react";
|
|
5
|
+
const SHIMMER_GRADIENT_CLASSES = "bg-gradient-to-r from-muted-foreground/30 via-foreground to-muted-foreground/30 bg-[length:200%_100%]";
|
|
6
|
+
function useShimmerSweep(durationMs = 2e3) {
|
|
7
|
+
const animationRef = useRef(null);
|
|
8
|
+
return useCallback(
|
|
9
|
+
(el) => {
|
|
10
|
+
animationRef.current?.cancel();
|
|
11
|
+
animationRef.current = null;
|
|
12
|
+
if (!el || typeof el.animate !== "function") return;
|
|
13
|
+
if (typeof window !== "undefined" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches) return;
|
|
14
|
+
animationRef.current = el.animate(
|
|
15
|
+
[{ backgroundPosition: "0 0" }, { backgroundPosition: "-200% 0" }],
|
|
16
|
+
{ duration: durationMs, iterations: Infinity, easing: "linear" }
|
|
17
|
+
);
|
|
18
|
+
animationRef.current.finished?.catch(() => {
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
[durationMs]
|
|
22
|
+
);
|
|
23
|
+
}
|
|
4
24
|
function ShimmerText({ text, className }) {
|
|
25
|
+
const ref = useShimmerSweep();
|
|
5
26
|
return /* @__PURE__ */ jsx(
|
|
6
27
|
"span",
|
|
7
28
|
{
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
className
|
|
11
|
-
),
|
|
12
|
-
style: {
|
|
13
|
-
backgroundImage: "linear-gradient(90deg, hsl(var(--muted-foreground) / 0.3) 0%, hsl(var(--foreground)) 50%, hsl(var(--muted-foreground) / 0.3) 100%)"
|
|
14
|
-
},
|
|
29
|
+
ref,
|
|
30
|
+
className: cn("inline-block bg-clip-text text-transparent", SHIMMER_GRADIENT_CLASSES, className),
|
|
15
31
|
children: text
|
|
16
32
|
}
|
|
17
33
|
);
|
|
18
34
|
}
|
|
19
35
|
export {
|
|
20
|
-
|
|
36
|
+
SHIMMER_GRADIENT_CLASSES,
|
|
37
|
+
ShimmerText,
|
|
38
|
+
useShimmerSweep
|
|
21
39
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-matrx/rich-content",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.87",
|
|
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",
|
|
@@ -137,13 +137,13 @@
|
|
|
137
137
|
"@ai-matrx/content-ir-react": "latest",
|
|
138
138
|
"@ai-matrx/data": "latest",
|
|
139
139
|
"@ai-matrx/design-system": "latest",
|
|
140
|
-
"@ai-matrx/diff": "latest",
|
|
141
140
|
"@ai-matrx/icons": "latest",
|
|
142
141
|
"@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/
|
|
146
|
+
"@ai-matrx/diff": "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": "
|
|
207
|
+
"gitHead": "e60f07b8e22fef92cbdabc1768cb328bb305bf74"
|
|
208
208
|
}
|