@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.
Files changed (44) hide show
  1. package/dist/components/MessageContent.d.ts +20 -0
  2. package/dist/components/MessageContent.parser.d.ts +12 -0
  3. package/dist/components/MessageContent.test.d.ts +1 -0
  4. package/dist/elements.cjs +1 -1
  5. package/dist/elements.css +1 -1
  6. package/dist/elements.js +14 -13
  7. package/dist/{index-C4bFBGfl.cjs → index-COzPF-WM.cjs} +45 -45
  8. package/dist/index-COzPF-WM.cjs.map +1 -0
  9. package/dist/{index-D93pV0_o.js → index-CRhpKl-G.js} +5218 -5201
  10. package/dist/index-CRhpKl-G.js.map +1 -0
  11. package/dist/{index-BzA55RRF.js → index-QUz5guSg.js} +7835 -7788
  12. package/dist/index-QUz5guSg.js.map +1 -0
  13. package/dist/{index-CgO7wXs-.cjs → index-fVcTljYT.cjs} +49 -49
  14. package/dist/index-fVcTljYT.cjs.map +1 -0
  15. package/dist/index.d.ts +2 -0
  16. package/dist/plugins/index.d.ts +4 -1
  17. package/dist/plugins/index.test.d.ts +1 -0
  18. package/dist/plugins.cjs +1 -1
  19. package/dist/plugins.js +1 -1
  20. package/dist/{profiler-BPCxiY-X.js → profiler-DifNjGGB.js} +2 -2
  21. package/dist/{profiler-BPCxiY-X.js.map → profiler-DifNjGGB.js.map} +1 -1
  22. package/dist/{profiler-BmAwBXpj.cjs → profiler-KLtVMM14.cjs} +2 -2
  23. package/dist/{profiler-BmAwBXpj.cjs.map → profiler-KLtVMM14.cjs.map} +1 -1
  24. package/dist/{startRecording-DXGt4fON.js → startRecording-C6xu9UA9.js} +2 -2
  25. package/dist/{startRecording-DXGt4fON.js.map → startRecording-C6xu9UA9.js.map} +1 -1
  26. package/dist/{startRecording-B0Xe2DOI.cjs → startRecording-YENzw_0G.cjs} +2 -2
  27. package/dist/{startRecording-B0Xe2DOI.cjs.map → startRecording-YENzw_0G.cjs.map} +1 -1
  28. package/dist/types/plugins.d.ts +5 -0
  29. package/package.json +2 -2
  30. package/src/components/MessageContent.parser.ts +39 -0
  31. package/src/components/MessageContent.test.ts +110 -0
  32. package/src/components/MessageContent.tsx +82 -0
  33. package/src/contexts/ElementsProvider.tsx +7 -2
  34. package/src/index.ts +2 -0
  35. package/src/plugins/chart/index.ts +1 -0
  36. package/src/plugins/chart/ui/bar-chart.tsx +9 -1
  37. package/src/plugins/generative-ui/index.ts +1 -0
  38. package/src/plugins/index.test.ts +62 -0
  39. package/src/plugins/index.ts +14 -1
  40. package/src/types/plugins.ts +6 -0
  41. package/dist/index-BzA55RRF.js.map +0 -1
  42. package/dist/index-C4bFBGfl.cjs.map +0 -1
  43. package/dist/index-CgO7wXs-.cjs.map +0 -1
  44. package/dist/index-D93pV0_o.js.map +0 -1
@@ -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 const recommended: Plugin[] = [chart, generativeUI];
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
 
@@ -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.