@ai-matrx/rich-content 0.2.85 → 0.2.86

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,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.86
4
+
5
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
6
+ `git diff npm/rich-content/v0.2.85..npm/rich-content/v0.2.86 -- apps/shared/rich-content`).
7
+ No source changes intended and no consumer action required.
8
+
3
9
  ## 0.2.85
4
10
 
5
11
  Automatic changed-only republish (docs/metadata drift since the last tag — see
@@ -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,37 @@
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
+ },
19
+ [durationMs]
20
+ );
21
+ }
4
22
  function ShimmerText({ text, className }) {
23
+ const ref = useShimmerSweep();
5
24
  return /* @__PURE__ */ jsx(
6
25
  "span",
7
26
  {
8
- className: cn(
9
- "inline-block bg-clip-text text-transparent bg-[length:200%_100%] animate-shimmer",
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
- },
27
+ ref,
28
+ className: cn("inline-block bg-clip-text text-transparent", SHIMMER_GRADIENT_CLASSES, className),
15
29
  children: text
16
30
  }
17
31
  );
18
32
  }
19
33
  export {
20
- ShimmerText
34
+ SHIMMER_GRADIENT_CLASSES,
35
+ ShimmerText,
36
+ useShimmerSweep
21
37
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-matrx/rich-content",
3
- "version": "0.2.85",
3
+ "version": "0.2.86",
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",
@@ -131,19 +131,19 @@
131
131
  "unist-util-visit-parents": "^6.0.2",
132
132
  "yaml": "^2.9.1",
133
133
  "@ai-matrx/agents": "latest",
134
- "@ai-matrx/alchemy": "latest",
135
134
  "@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
- "@ai-matrx/design-system": "latest",
138
+ "@ai-matrx/alchemy": "latest",
140
139
  "@ai-matrx/diff": "latest",
141
- "@ai-matrx/icons": "latest",
142
140
  "@ai-matrx/kit": "latest",
143
- "@ai-matrx/media": "latest",
144
141
  "@ai-matrx/records": "latest",
145
142
  "@ai-matrx/records-ui": "latest",
146
- "@ai-matrx/print": "latest"
143
+ "@ai-matrx/media": "latest",
144
+ "@ai-matrx/icons": "latest",
145
+ "@ai-matrx/print": "latest",
146
+ "@ai-matrx/design-system": "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": "733bfce3e3c27f189228edf916f8774f047d79b9"
207
+ "gitHead": "c3f5a4597249b6dff691e3d76c972874b8aa8ec4"
208
208
  }