@digo-org/digo-api 1.0.38 → 1.0.39

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@digo-org/digo-api",
3
3
  "private": false,
4
- "version": "1.0.38",
4
+ "version": "1.0.39",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
7
7
  "types": "src/index.ts",
package/src/digo-asset.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Instance, GlobalParameters } from '@digo-org/digo-api';
1
+ import { Instance, GlobalParameters, VizAssetDefinition, API_MESSAGES, MASTER_INSTANCE } from '@digo-org/digo-api';
2
2
 
3
3
  import { ReactNode } from 'react';
4
4
 
@@ -30,17 +30,16 @@ export abstract class DigoAsset {
30
30
  }
31
31
 
32
32
  private handleMessage(event: MessageEvent): void {
33
- console.log(event);
34
- // const message = event.data;
33
+ const message = event.data;
35
34
 
36
- // if (!message) return;
35
+ if (!message) return;
37
36
 
38
- // switch (message.command) {
39
- // case API_MESSAGES.updateDefinition:
40
- // this.instances = (message.definition as VizAssetDefinition).instances.filter(instance => instance.id !== MASTER_INSTANCE.id);
41
- // this.globalParameters = (message.definition as VizAssetDefinition).globalParameters;
42
- // break;
43
- // }
37
+ switch (message.command) {
38
+ case API_MESSAGES.updateDefinition:
39
+ this.instances = (message.definition as VizAssetDefinition).instances.filter(instance => instance.id !== MASTER_INSTANCE.id);
40
+ this.globalParameters = (message.definition as VizAssetDefinition).globalParameters;
41
+ break;
42
+ }
44
43
 
45
44
  this.updateUI();
46
45
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "VIZ_FILES": {
2
+ "VIZ_ASSET_FILES": {
3
3
  "/asset.tsx": "import { DigoAsset } from '@digo-org/digo-api';\n\nimport { ResponsiveContainer, Cell, BarChart, CartesianGrid, XAxis, YAxis, Legend, Bar, Rectangle, Tooltip } from 'recharts';\n\nexport class Asset extends DigoAsset {\n constructor() {\n super();\n }\n\n override render() {\n return (\n <ResponsiveContainer width=\"100%\" height=\"100%\" key=\"responsive-container\">\n <BarChart\n data={this.instances}\n layout=\"horizontal\"\n margin={{\n top: 120,\n right: 60,\n left: 40,\n bottom: 120,\n }}\n style={{ backgroundColor: this.globalParameters['bg-color'] as string }}\n\n >\n <CartesianGrid strokeDasharray=\"3 3\" />\n\n <XAxis dataKey=\"id\" />\n\n <YAxis />\n\n <Legend />\n\n <Tooltip />\n\n <Bar\n dataKey=\"bar-value\"\n fill=\"#ff\"\n animationEasing=\"ease-in-out\"\n animationDuration={200}\n activeBar={<Rectangle fill=\"pink\" stroke=\"blue\" />}\n >\n {this.instances?.map((instance, index) => {\n const color = instance['bar-color'];\n return <Cell key={`cell-${index}`} fill={color as string} />;\n })}\n </Bar>\n\n </BarChart>\n </ResponsiveContainer>\n );\n }\n}\n",
4
4
  "/styles.css": "body {\n font-family: sans-serif;\n -webkit-font-smoothing: auto;\n -moz-font-smoothing: auto;\n -moz-osx-font-smoothing: grayscale;\n text-rendering: optimizeLegibility;\n font-smooth: always;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n}\n\n.root {\n height: 100vh;\n background-color: 'red';\n display: grid;\n}",
5
5
  "/package.json": "{\n \"dependencies\": {\n \"react\": \"^19.0.0\",\n \"react-dom\": \"^19.0.0\",\n \"react-scripts\": \"^5.0.0\",\n \"@digo-org/digo-api\": \"1.0.28\",\n \"@react-three/drei\": \"^10.0.6\",\n \"@react-three/fiber\": \"^9.1.2\",\n \"recharts\": \"^2.15.1\"\n },\n \"main\": \"/index.tsx\",\n \"devDependencies\": {}\n}",
package/src/index.ts CHANGED
@@ -1,17 +1,17 @@
1
- export * from '@digo-org/digo-api/src/constants';
2
-
3
- export * from '@digo-org/digo-api/src/digo-asset';
4
-
5
1
  export * from '@digo-org/digo-api/src/types-common';
6
2
 
7
- export * from '@digo-org/digo-api/src/types-data';
8
-
9
3
  export * from '@digo-org/digo-api/src/types-misc';
10
4
 
5
+ export * from '@digo-org/digo-api/src/types-data';
6
+
11
7
  export * from '@digo-org/digo-api/src/types-llm';
12
8
 
9
+ export * from '@digo-org/digo-api/src/types-viz';
10
+
13
11
  export * from '@digo-org/digo-api/src/types-viz-files';
14
12
 
15
- export * from '@digo-org/digo-api/src/types-viz';
13
+ export * from '@digo-org/digo-api/src/constants';
14
+
15
+ export * from '@digo-org/digo-api/src/digo-asset';
16
16
 
17
17
  export * from '@digo-org/digo-api/src/examples/data-examples';
package/src/types-llm.ts CHANGED
@@ -19,6 +19,6 @@ export interface MessagePart {
19
19
 
20
20
  export enum MessageType {
21
21
  TEXT = 'TEXT',
22
- ARCTIFACT = 'ARCTIFACT',
22
+ ARTIFACT = 'ARTIFACT',
23
23
  RESOURCE = 'RESOURCE',
24
24
  }
@@ -1,16 +1,9 @@
1
1
  import { Parameter } from '@digo-org/digo-api';
2
2
 
3
- export type VizAssetFiles = Record<string, VizAssetFile>;
4
-
5
- export interface VizAssetFile {
6
- code: string;
7
- hidden?: boolean;
8
- active?: boolean;
9
- readOnly?: boolean;
10
- }
11
-
12
3
  export interface VizParameter extends Parameter {
13
4
  id: string;
14
5
  name: string;
15
6
  isGlobal: boolean;
16
7
  }
8
+
9
+ export type VizAssetFiles = Record<string, string>;