@tetrascience-npm/tetrascience-react-ui 1.0.0-beta.158.1 → 1.0.0-beta.160.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.
- package/dist/components/ai/streamdown-plugins.cjs +1 -1
- package/dist/components/ai/streamdown-plugins.cjs.map +1 -1
- package/dist/components/ai/streamdown-plugins.d.ts +5 -1
- package/dist/components/ai/streamdown-plugins.js +22 -11
- package/dist/components/ai/streamdown-plugins.js.map +1 -1
- package/dist/components/ai/use-streamdown-plugins.cjs +1 -1
- package/dist/components/ai/use-streamdown-plugins.cjs.map +1 -1
- package/dist/components/ai/use-streamdown-plugins.js +7 -7
- package/dist/components/ai/use-streamdown-plugins.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("@streamdown/cjk"),c=require("./streamdown-code-plugin.cjs");function o(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}async function a(e){try{return await e()}catch{return}}async function u(){const[e,t]=await Promise.all([a(async()=>(await Promise.resolve().then(()=>o(require("@streamdown/math")))).math),a(async()=>(await Promise.resolve().then(()=>o(require("@streamdown/mermaid")))).mermaid)]);return{cjk:i.cjk,code:c.streamdownCodePlugin,...e?{math:e}:{},...t?{mermaid:t}:{}}}exports.getStreamdownPlugins=u;
|
|
2
2
|
//# sourceMappingURL=streamdown-plugins.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streamdown-plugins.cjs","sources":["../../../src/components/ai/streamdown-plugins.ts"],"sourcesContent":["/**\n * Full streamdown plugin set for `MessageResponse` / `Reasoning` markdown.\n *\n * This module is only ever reached through `useStreamdownPlugins`'s dynamic\n * import (SW-2007): mermaid, KaTeX, and the shiki grammars behind these\n * plugins land in a lazy chunk instead of the consumer's main bundle. Do not\n * import it statically from component code.\n
|
|
1
|
+
{"version":3,"file":"streamdown-plugins.cjs","sources":["../../../src/components/ai/streamdown-plugins.ts"],"sourcesContent":["/**\n * Full streamdown plugin set for `MessageResponse` / `Reasoning` markdown.\n *\n * This module is only ever reached through `useStreamdownPlugins`'s dynamic\n * import (SW-2007): mermaid, KaTeX, and the shiki grammars behind these\n * plugins land in a lazy chunk instead of the consumer's main bundle. Do not\n * import it statically from component code.\n *\n * `@streamdown/math` and `@streamdown/mermaid` are *optional* peer\n * dependencies, so they are resolved with `import()` rather than a static\n * import. A static import forces every consumer that bundles the root barrel\n * to install both — Rollup has to link the named export at build time, and\n * when the package is absent the specifier resolves to an empty\n * `__vite-optional-peer-dep:` stub and the build aborts (#190). Loading them\n * dynamically lets a consumer that omits them degrade at runtime instead:\n * markdown still renders, just without math or mermaid.\n */\nimport { cjk } from \"@streamdown/cjk\";\n\nimport { streamdownCodePlugin } from \"./streamdown-code-plugin\";\n\nimport type { PluginConfig } from \"streamdown\";\n\n/**\n * Resolve one optional peer's plugin export, or `undefined` when the package\n * is not installed. Mirrors how `plotly.js-dist`, `@rdkit/rdkit` and the\n * provider SDKs are loaded elsewhere in the kit.\n */\nasync function optionalPlugin<T>(load: () => Promise<T>): Promise<T | undefined> {\n try {\n return await load();\n } catch {\n return undefined;\n }\n}\n\n/**\n * Build the plugin set, including only the optional plugins that are actually\n * installed. Callers reach this through `useStreamdownPlugins`.\n */\nexport async function getStreamdownPlugins(): Promise<PluginConfig> {\n const [math, mermaid] = await Promise.all([\n optionalPlugin(async () => (await import(\"@streamdown/math\")).math),\n optionalPlugin(async () => (await import(\"@streamdown/mermaid\")).mermaid),\n ]);\n\n return {\n cjk,\n code: streamdownCodePlugin,\n ...(math ? { math } : {}),\n ...(mermaid ? { mermaid } : {}),\n };\n}\n"],"names":["optionalPlugin","load","getStreamdownPlugins","math","mermaid","_interopNamespaceDefault","cjk","streamdownCodePlugin"],"mappings":"0aA4BA,eAAeA,EAAkBC,EAAgD,CAC/E,GAAI,CACF,OAAO,MAAMA,EAAA,CACf,MAAQ,CACN,MACF,CACF,CAMA,eAAsBC,GAA8C,CAClE,KAAM,CAACC,EAAMC,CAAO,EAAI,MAAM,QAAQ,IAAI,CACxCJ,EAAe,UAAa,MAAM,qCAAO,kBAAkB,CAAA,CAAA,GAAG,IAAI,EAClEA,EAAe,UAAa,MAAM,QAAA,QAAA,EAAA,KAAA,IAAAK,EAAA,QAAO,qBAAqB,CAAA,CAAA,GAAG,OAAO,CAAA,CACzE,EAED,MAAO,CAAA,IACLC,EAAAA,IACA,KAAMC,EAAAA,qBACN,GAAIJ,EAAO,CAAE,KAAAA,CAAA,EAAS,CAAA,EACtB,GAAIC,EAAU,CAAE,QAAAA,GAAY,CAAA,CAAC,CAEjC"}
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
import { PluginConfig } from 'streamdown';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Build the plugin set, including only the optional plugins that are actually
|
|
4
|
+
* installed. Callers reach this through `useStreamdownPlugins`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getStreamdownPlugins(): Promise<PluginConfig>;
|
|
@@ -1,14 +1,25 @@
|
|
|
1
|
-
import { cjk as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { cjk as i } from "@streamdown/cjk";
|
|
2
|
+
import { streamdownCodePlugin as n } from "./streamdown-code-plugin.js";
|
|
3
|
+
async function r(t) {
|
|
4
|
+
try {
|
|
5
|
+
return await t();
|
|
6
|
+
} catch {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
async function e() {
|
|
11
|
+
const [t, a] = await Promise.all([
|
|
12
|
+
r(async () => (await import("@streamdown/math")).math),
|
|
13
|
+
r(async () => (await import("@streamdown/mermaid")).mermaid)
|
|
14
|
+
]);
|
|
15
|
+
return {
|
|
16
|
+
cjk: i,
|
|
17
|
+
code: n,
|
|
18
|
+
...t ? { math: t } : {},
|
|
19
|
+
...a ? { mermaid: a } : {}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
11
22
|
export {
|
|
12
|
-
|
|
23
|
+
e as getStreamdownPlugins
|
|
13
24
|
};
|
|
14
25
|
//# sourceMappingURL=streamdown-plugins.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streamdown-plugins.js","sources":["../../../src/components/ai/streamdown-plugins.ts"],"sourcesContent":["/**\n * Full streamdown plugin set for `MessageResponse` / `Reasoning` markdown.\n *\n * This module is only ever reached through `useStreamdownPlugins`'s dynamic\n * import (SW-2007): mermaid, KaTeX, and the shiki grammars behind these\n * plugins land in a lazy chunk instead of the consumer's main bundle. Do not\n * import it statically from component code.\n
|
|
1
|
+
{"version":3,"file":"streamdown-plugins.js","sources":["../../../src/components/ai/streamdown-plugins.ts"],"sourcesContent":["/**\n * Full streamdown plugin set for `MessageResponse` / `Reasoning` markdown.\n *\n * This module is only ever reached through `useStreamdownPlugins`'s dynamic\n * import (SW-2007): mermaid, KaTeX, and the shiki grammars behind these\n * plugins land in a lazy chunk instead of the consumer's main bundle. Do not\n * import it statically from component code.\n *\n * `@streamdown/math` and `@streamdown/mermaid` are *optional* peer\n * dependencies, so they are resolved with `import()` rather than a static\n * import. A static import forces every consumer that bundles the root barrel\n * to install both — Rollup has to link the named export at build time, and\n * when the package is absent the specifier resolves to an empty\n * `__vite-optional-peer-dep:` stub and the build aborts (#190). Loading them\n * dynamically lets a consumer that omits them degrade at runtime instead:\n * markdown still renders, just without math or mermaid.\n */\nimport { cjk } from \"@streamdown/cjk\";\n\nimport { streamdownCodePlugin } from \"./streamdown-code-plugin\";\n\nimport type { PluginConfig } from \"streamdown\";\n\n/**\n * Resolve one optional peer's plugin export, or `undefined` when the package\n * is not installed. Mirrors how `plotly.js-dist`, `@rdkit/rdkit` and the\n * provider SDKs are loaded elsewhere in the kit.\n */\nasync function optionalPlugin<T>(load: () => Promise<T>): Promise<T | undefined> {\n try {\n return await load();\n } catch {\n return undefined;\n }\n}\n\n/**\n * Build the plugin set, including only the optional plugins that are actually\n * installed. Callers reach this through `useStreamdownPlugins`.\n */\nexport async function getStreamdownPlugins(): Promise<PluginConfig> {\n const [math, mermaid] = await Promise.all([\n optionalPlugin(async () => (await import(\"@streamdown/math\")).math),\n optionalPlugin(async () => (await import(\"@streamdown/mermaid\")).mermaid),\n ]);\n\n return {\n cjk,\n code: streamdownCodePlugin,\n ...(math ? { math } : {}),\n ...(mermaid ? { mermaid } : {}),\n };\n}\n"],"names":["optionalPlugin","load","getStreamdownPlugins","math","mermaid","cjk","streamdownCodePlugin"],"mappings":";;AA4BA,eAAeA,EAAkBC,GAAgD;AAC/E,MAAI;AACF,WAAO,MAAMA,EAAA;AAAA,EACf,QAAQ;AACN;AAAA,EACF;AACF;AAMA,eAAsBC,IAA8C;AAClE,QAAM,CAACC,GAAMC,CAAO,IAAI,MAAM,QAAQ,IAAI;AAAA,IACxCJ,EAAe,aAAa,MAAM,OAAO,kBAAkB,GAAG,IAAI;AAAA,IAClEA,EAAe,aAAa,MAAM,OAAO,qBAAqB,GAAG,OAAO;AAAA,EAAA,CACzE;AAED,SAAO;AAAA,IACL,KAAAK;AAAA,IACA,MAAMC;AAAA,IACN,GAAIH,IAAO,EAAE,MAAAA,EAAA,IAAS,CAAA;AAAA,IACtB,GAAIC,IAAU,EAAE,SAAAA,MAAY,CAAA;AAAA,EAAC;AAEjC;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react");let n=null,t=null;function s(){return t??=Promise.resolve().then(()=>require("./streamdown-plugins.cjs")).then(e=>e.getStreamdownPlugins()).then(e=>(n=e,e)).catch(e=>{throw t=null,n=null,e}),t}function o(){const[e,l]=r.useState(n??void 0);return r.useEffect(()=>{if(e)return;let u=!1;return s().then(i=>{u||l(i)}),()=>{u=!0}},[e]),e}exports.useStreamdownPlugins=o;
|
|
2
2
|
//# sourceMappingURL=use-streamdown-plugins.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-streamdown-plugins.cjs","sources":["../../../src/components/ai/use-streamdown-plugins.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\n\nimport type { PluginConfig } from \"streamdown\";\n\n// Module-level cache so the lazy chunk is fetched once and later mounts get\n// the plugins synchronously on first render (no highlight flash).\nlet cachedPlugins: PluginConfig | null = null;\nlet pluginsPromise: Promise<PluginConfig> | null = null;\n\nfunction loadStreamdownPlugins(): Promise<PluginConfig> {\n pluginsPromise ??= import(\"./streamdown-plugins\")\n .then((mod) => {\n cachedPlugins =
|
|
1
|
+
{"version":3,"file":"use-streamdown-plugins.cjs","sources":["../../../src/components/ai/use-streamdown-plugins.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\n\nimport type { PluginConfig } from \"streamdown\";\n\n// Module-level cache so the lazy chunk is fetched once and later mounts get\n// the plugins synchronously on first render (no highlight flash).\nlet cachedPlugins: PluginConfig | null = null;\nlet pluginsPromise: Promise<PluginConfig> | null = null;\n\nfunction loadStreamdownPlugins(): Promise<PluginConfig> {\n pluginsPromise ??= import(\"./streamdown-plugins\")\n .then((mod) => mod.getStreamdownPlugins())\n .then((plugins) => {\n cachedPlugins = plugins;\n return plugins;\n })\n .catch((error) => {\n pluginsPromise = null;\n cachedPlugins = null;\n throw error;\n });\n return pluginsPromise;\n}\n\n/**\n * Lazily loads the streamdown plugin set (SW-2007). Markdown renders\n * immediately without plugins; code highlighting, math, and mermaid upgrade\n * in place once the lazy chunk arrives, keeping shiki/KaTeX/mermaid out of\n * the consumer's main bundle.\n */\nexport function useStreamdownPlugins(): PluginConfig | undefined {\n const [plugins, setPlugins] = useState<PluginConfig | undefined>(\n cachedPlugins ?? undefined,\n );\n\n useEffect(() => {\n if (plugins) return;\n let cancelled = false;\n void loadStreamdownPlugins().then((loaded) => {\n if (!cancelled) setPlugins(loaded);\n });\n return () => {\n cancelled = true;\n };\n }, [plugins]);\n\n return plugins;\n}\n"],"names":["cachedPlugins","pluginsPromise","loadStreamdownPlugins","mod","plugins","error","useStreamdownPlugins","setPlugins","useState","useEffect","cancelled","loaded"],"mappings":"yGAMA,IAAIA,EAAqC,KACrCC,EAA+C,KAEnD,SAASC,GAA+C,CACtD,OAAAD,IAAmB,QAAA,QAAA,EAAA,KAAA,IAAA,QAAO,0BAAsB,GAC7C,KAAME,GAAQA,EAAI,qBAAA,CAAsB,EACxC,KAAMC,IACLJ,EAAgBI,EACTA,EACR,EACA,MAAOC,GAAU,CAChB,MAAAJ,EAAiB,KACjBD,EAAgB,KACVK,CACR,CAAC,EACIJ,CACT,CAQO,SAASK,GAAiD,CAC/D,KAAM,CAACF,EAASG,CAAU,EAAIC,EAAAA,SAC5BR,GAAiB,MAAA,EAGnBS,OAAAA,EAAAA,UAAU,IAAM,CACd,GAAIL,EAAS,OACb,IAAIM,EAAY,GAChB,OAAKR,EAAA,EAAwB,KAAMS,GAAW,CACvCD,GAAWH,EAAWI,CAAM,CACnC,CAAC,EACM,IAAM,CACXD,EAAY,EACd,CACF,EAAG,CAACN,CAAO,CAAC,EAELA,CACT"}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { useState as i, useEffect as o } from "react";
|
|
2
|
-
let
|
|
2
|
+
let n = null, t = null;
|
|
3
3
|
function s() {
|
|
4
|
-
return t ??= import("./streamdown-plugins.js").then((
|
|
5
|
-
throw t = null,
|
|
4
|
+
return t ??= import("./streamdown-plugins.js").then((e) => e.getStreamdownPlugins()).then((e) => (n = e, e)).catch((e) => {
|
|
5
|
+
throw t = null, n = null, e;
|
|
6
6
|
}), t;
|
|
7
7
|
}
|
|
8
8
|
function a() {
|
|
9
|
-
const [
|
|
10
|
-
|
|
9
|
+
const [e, u] = i(
|
|
10
|
+
n ?? void 0
|
|
11
11
|
);
|
|
12
12
|
return o(() => {
|
|
13
|
-
if (
|
|
13
|
+
if (e) return;
|
|
14
14
|
let l = !1;
|
|
15
15
|
return s().then((r) => {
|
|
16
16
|
l || u(r);
|
|
17
17
|
}), () => {
|
|
18
18
|
l = !0;
|
|
19
19
|
};
|
|
20
|
-
}, [
|
|
20
|
+
}, [e]), e;
|
|
21
21
|
}
|
|
22
22
|
export {
|
|
23
23
|
a as useStreamdownPlugins
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-streamdown-plugins.js","sources":["../../../src/components/ai/use-streamdown-plugins.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\n\nimport type { PluginConfig } from \"streamdown\";\n\n// Module-level cache so the lazy chunk is fetched once and later mounts get\n// the plugins synchronously on first render (no highlight flash).\nlet cachedPlugins: PluginConfig | null = null;\nlet pluginsPromise: Promise<PluginConfig> | null = null;\n\nfunction loadStreamdownPlugins(): Promise<PluginConfig> {\n pluginsPromise ??= import(\"./streamdown-plugins\")\n .then((mod) => {\n cachedPlugins =
|
|
1
|
+
{"version":3,"file":"use-streamdown-plugins.js","sources":["../../../src/components/ai/use-streamdown-plugins.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\n\nimport type { PluginConfig } from \"streamdown\";\n\n// Module-level cache so the lazy chunk is fetched once and later mounts get\n// the plugins synchronously on first render (no highlight flash).\nlet cachedPlugins: PluginConfig | null = null;\nlet pluginsPromise: Promise<PluginConfig> | null = null;\n\nfunction loadStreamdownPlugins(): Promise<PluginConfig> {\n pluginsPromise ??= import(\"./streamdown-plugins\")\n .then((mod) => mod.getStreamdownPlugins())\n .then((plugins) => {\n cachedPlugins = plugins;\n return plugins;\n })\n .catch((error) => {\n pluginsPromise = null;\n cachedPlugins = null;\n throw error;\n });\n return pluginsPromise;\n}\n\n/**\n * Lazily loads the streamdown plugin set (SW-2007). Markdown renders\n * immediately without plugins; code highlighting, math, and mermaid upgrade\n * in place once the lazy chunk arrives, keeping shiki/KaTeX/mermaid out of\n * the consumer's main bundle.\n */\nexport function useStreamdownPlugins(): PluginConfig | undefined {\n const [plugins, setPlugins] = useState<PluginConfig | undefined>(\n cachedPlugins ?? undefined,\n );\n\n useEffect(() => {\n if (plugins) return;\n let cancelled = false;\n void loadStreamdownPlugins().then((loaded) => {\n if (!cancelled) setPlugins(loaded);\n });\n return () => {\n cancelled = true;\n };\n }, [plugins]);\n\n return plugins;\n}\n"],"names":["cachedPlugins","pluginsPromise","loadStreamdownPlugins","mod","plugins","error","useStreamdownPlugins","setPlugins","useState","useEffect","cancelled","loaded"],"mappings":";AAMA,IAAIA,IAAqC,MACrCC,IAA+C;AAEnD,SAASC,IAA+C;AACtD,SAAAD,MAAmB,OAAO,yBAAsB,EAC7C,KAAK,CAACE,MAAQA,EAAI,qBAAA,CAAsB,EACxC,KAAK,CAACC,OACLJ,IAAgBI,GACTA,EACR,EACA,MAAM,CAACC,MAAU;AAChB,UAAAJ,IAAiB,MACjBD,IAAgB,MACVK;AAAA,EACR,CAAC,GACIJ;AACT;AAQO,SAASK,IAAiD;AAC/D,QAAM,CAACF,GAASG,CAAU,IAAIC;AAAA,IAC5BR,KAAiB;AAAA,EAAA;AAGnB,SAAAS,EAAU,MAAM;AACd,QAAIL,EAAS;AACb,QAAIM,IAAY;AAChB,WAAKR,EAAA,EAAwB,KAAK,CAACS,MAAW;AAC5C,MAAKD,KAAWH,EAAWI,CAAM;AAAA,IACnC,CAAC,GACM,MAAM;AACX,MAAAD,IAAY;AAAA,IACd;AAAA,EACF,GAAG,CAACN,CAAO,CAAC,GAELA;AACT;"}
|