@gram-ai/elements 1.29.0 → 1.30.0
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/MessageContent.d.ts +20 -0
- package/dist/components/MessageContent.parser.d.ts +12 -0
- package/dist/components/MessageContent.test.d.ts +1 -0
- package/dist/elements.cjs +1 -1
- package/dist/elements.css +1 -1
- package/dist/elements.js +14 -13
- package/dist/{index-C4bFBGfl.cjs → index-COzPF-WM.cjs} +45 -45
- package/dist/index-COzPF-WM.cjs.map +1 -0
- package/dist/{index-D93pV0_o.js → index-CRhpKl-G.js} +5218 -5201
- package/dist/index-CRhpKl-G.js.map +1 -0
- package/dist/{index-BzA55RRF.js → index-QUz5guSg.js} +7835 -7788
- package/dist/index-QUz5guSg.js.map +1 -0
- package/dist/{index-CgO7wXs-.cjs → index-fVcTljYT.cjs} +49 -49
- package/dist/index-fVcTljYT.cjs.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/plugins/index.d.ts +4 -1
- package/dist/plugins/index.test.d.ts +1 -0
- package/dist/plugins.cjs +1 -1
- package/dist/plugins.js +1 -1
- package/dist/{profiler-BPCxiY-X.js → profiler-DifNjGGB.js} +2 -2
- package/dist/{profiler-BPCxiY-X.js.map → profiler-DifNjGGB.js.map} +1 -1
- package/dist/{profiler-BmAwBXpj.cjs → profiler-KLtVMM14.cjs} +2 -2
- package/dist/{profiler-BmAwBXpj.cjs.map → profiler-KLtVMM14.cjs.map} +1 -1
- package/dist/{startRecording-DXGt4fON.js → startRecording-C6xu9UA9.js} +2 -2
- package/dist/{startRecording-DXGt4fON.js.map → startRecording-C6xu9UA9.js.map} +1 -1
- package/dist/{startRecording-B0Xe2DOI.cjs → startRecording-YENzw_0G.cjs} +2 -2
- package/dist/{startRecording-B0Xe2DOI.cjs.map → startRecording-YENzw_0G.cjs.map} +1 -1
- package/dist/types/plugins.d.ts +5 -0
- package/package.json +2 -2
- package/src/components/MessageContent.parser.ts +39 -0
- package/src/components/MessageContent.test.ts +110 -0
- package/src/components/MessageContent.tsx +82 -0
- package/src/contexts/ElementsProvider.tsx +7 -2
- package/src/index.ts +2 -0
- package/src/plugins/chart/index.ts +1 -0
- package/src/plugins/chart/ui/bar-chart.tsx +9 -1
- package/src/plugins/generative-ui/index.ts +1 -0
- package/src/plugins/index.test.ts +62 -0
- package/src/plugins/index.ts +14 -1
- package/src/types/plugins.ts +6 -0
- package/dist/index-BzA55RRF.js.map +0 -1
- package/dist/index-C4bFBGfl.cjs.map +0 -1
- package/dist/index-CgO7wXs-.cjs.map +0 -1
- package/dist/index-D93pV0_o.js.map +0 -1
package/src/plugins/index.ts
CHANGED
|
@@ -2,7 +2,20 @@ import type { Plugin } from "@/types/plugins";
|
|
|
2
2
|
import { chart } from "./chart";
|
|
3
3
|
import { generativeUI } from "./generative-ui";
|
|
4
4
|
|
|
5
|
-
export
|
|
5
|
+
export type PluginList = Plugin[] & {
|
|
6
|
+
except(...ids: string[]): Plugin[];
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
function createPluginList(plugins: Plugin[]): PluginList {
|
|
10
|
+
const arr = [...plugins] as PluginList;
|
|
11
|
+
arr.except = (...ids: string[]) => {
|
|
12
|
+
const excluded = new Set(ids);
|
|
13
|
+
return arr.filter((p) => !excluded.has(p.id ?? p.language));
|
|
14
|
+
};
|
|
15
|
+
return arr;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const recommended: PluginList = createPluginList([chart, generativeUI]);
|
|
6
19
|
export { chart } from "./chart";
|
|
7
20
|
export { generativeUI } from "./generative-ui";
|
|
8
21
|
|
package/src/types/plugins.ts
CHANGED
|
@@ -15,6 +15,12 @@ import { ComponentType } from "react";
|
|
|
15
15
|
* 3. The code fence is rendered using the custom renderer
|
|
16
16
|
*/
|
|
17
17
|
export interface Plugin {
|
|
18
|
+
/**
|
|
19
|
+
* Unique identifier for the plugin. Used by `recommended.except()` to
|
|
20
|
+
* selectively exclude plugins. Defaults to `language` if not set.
|
|
21
|
+
*/
|
|
22
|
+
id?: string;
|
|
23
|
+
|
|
18
24
|
/**
|
|
19
25
|
* Any prompt that the plugin may need to add to the system prompt.
|
|
20
26
|
* Will be appended to the built-in system prompt.
|