@dxos/react-ui-canvas-compute 0.8.4-main.8360d9e660 → 0.8.4-main.8baae0fced
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/LICENSE +102 -5
- package/dist/lib/browser/index.mjs +382 -459
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +382 -459
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/DiagnosticOverlay.d.ts.map +1 -1
- package/dist/types/src/compute-layout.d.ts.map +1 -1
- package/dist/types/src/compute.stories.d.ts +1 -1
- package/dist/types/src/compute.stories.d.ts.map +1 -1
- package/dist/types/src/graph/controller.d.ts +45 -30
- package/dist/types/src/graph/controller.d.ts.map +1 -1
- package/dist/types/src/graph/node-defs.d.ts.map +1 -1
- package/dist/types/src/hooks/useComputeGraphController.d.ts.map +1 -1
- package/dist/types/src/hooks/useComputeNodeState.d.ts +2 -3
- package/dist/types/src/hooks/useComputeNodeState.d.ts.map +1 -1
- package/dist/types/src/hooks/useGraphMonitor.d.ts.map +1 -1
- package/dist/types/src/shapes/Append.d.ts +1 -1
- package/dist/types/src/shapes/Append.d.ts.map +1 -1
- package/dist/types/src/shapes/Array.d.ts +1 -1
- package/dist/types/src/shapes/Array.d.ts.map +1 -1
- package/dist/types/src/shapes/Audio.d.ts +1 -1
- package/dist/types/src/shapes/Audio.d.ts.map +1 -1
- package/dist/types/src/shapes/Beacon.d.ts +1 -1
- package/dist/types/src/shapes/Beacon.d.ts.map +1 -1
- package/dist/types/src/shapes/Boolean.d.ts +7 -7
- package/dist/types/src/shapes/Boolean.d.ts.map +1 -1
- package/dist/types/src/shapes/Chat.d.ts +1 -1
- package/dist/types/src/shapes/Chat.d.ts.map +1 -1
- package/dist/types/src/shapes/Constant.d.ts +1 -1
- package/dist/types/src/shapes/Constant.d.ts.map +1 -1
- package/dist/types/src/shapes/Database.d.ts +1 -1
- package/dist/types/src/shapes/Database.d.ts.map +1 -1
- package/dist/types/src/shapes/{Queue.d.ts → Feed.d.ts} +9 -9
- package/dist/types/src/shapes/Feed.d.ts.map +1 -0
- package/dist/types/src/shapes/Function.d.ts +1 -1
- package/dist/types/src/shapes/Function.d.ts.map +1 -1
- package/dist/types/src/shapes/Gpt.d.ts +1 -1
- package/dist/types/src/shapes/Gpt.d.ts.map +1 -1
- package/dist/types/src/shapes/GptRealtime.d.ts +1 -1
- package/dist/types/src/shapes/GptRealtime.d.ts.map +1 -1
- package/dist/types/src/shapes/Json.d.ts +2 -2
- package/dist/types/src/shapes/Json.d.ts.map +1 -1
- package/dist/types/src/shapes/Logic.d.ts +2 -2
- package/dist/types/src/shapes/Logic.d.ts.map +1 -1
- package/dist/types/src/shapes/RNG.d.ts +2 -2
- package/dist/types/src/shapes/RNG.d.ts.map +1 -1
- package/dist/types/src/shapes/Scope.d.ts +1 -1
- package/dist/types/src/shapes/Scope.d.ts.map +1 -1
- package/dist/types/src/shapes/Surface.d.ts +1 -1
- package/dist/types/src/shapes/Surface.d.ts.map +1 -1
- package/dist/types/src/shapes/Switch.d.ts +1 -1
- package/dist/types/src/shapes/Switch.d.ts.map +1 -1
- package/dist/types/src/shapes/Table.d.ts +1 -1
- package/dist/types/src/shapes/Table.d.ts.map +1 -1
- package/dist/types/src/shapes/Template.d.ts +2 -2
- package/dist/types/src/shapes/Template.d.ts.map +1 -1
- package/dist/types/src/shapes/Text.d.ts +1 -1
- package/dist/types/src/shapes/Text.d.ts.map +1 -1
- package/dist/types/src/shapes/TextToImage.d.ts +1 -1
- package/dist/types/src/shapes/TextToImage.d.ts.map +1 -1
- package/dist/types/src/shapes/Thread.d.ts +1 -1
- package/dist/types/src/shapes/Thread.d.ts.map +1 -1
- package/dist/types/src/shapes/Trigger.d.ts +2 -2
- package/dist/types/src/shapes/Trigger.d.ts.map +1 -1
- package/dist/types/src/shapes/common/Box.d.ts.map +1 -1
- package/dist/types/src/shapes/common/FunctionBody.d.ts.map +1 -1
- package/dist/types/src/shapes/common/TypeSelect.d.ts +1 -1
- package/dist/types/src/shapes/common/TypeSelect.d.ts.map +1 -1
- package/dist/types/src/shapes/defs.d.ts +1 -1
- package/dist/types/src/shapes/defs.d.ts.map +1 -1
- package/dist/types/src/shapes/index.d.ts +2 -2
- package/dist/types/src/shapes/index.d.ts.map +1 -1
- package/dist/types/src/testing/circuits.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +47 -48
- package/src/compute.stories.tsx +26 -10
- package/src/graph/controller.ts +65 -26
- package/src/hooks/useComputeNodeState.ts +3 -5
- package/src/hooks/useGraphMonitor.ts +3 -3
- package/src/registry.ts +2 -2
- package/src/shapes/Audio.tsx +0 -1
- package/src/shapes/Beacon.tsx +0 -1
- package/src/shapes/Boolean.tsx +1 -1
- package/src/shapes/Chat.tsx +0 -1
- package/src/shapes/Constant.tsx +0 -1
- package/src/shapes/{Queue.tsx → Feed.tsx} +13 -14
- package/src/shapes/Function.tsx +5 -4
- package/src/shapes/Gpt.tsx +0 -1
- package/src/shapes/Json.tsx +9 -3
- package/src/shapes/RNG.tsx +0 -1
- package/src/shapes/Scope.tsx +0 -1
- package/src/shapes/Surface.tsx +4 -2
- package/src/shapes/Switch.tsx +0 -1
- package/src/shapes/Template.tsx +0 -1
- package/src/shapes/Text.tsx +0 -1
- package/src/shapes/Thread.tsx +1 -5
- package/src/shapes/Trigger.tsx +12 -17
- package/src/shapes/common/Box.tsx +0 -2
- package/src/shapes/index.ts +2 -2
- package/src/testing/circuits.ts +2 -2
- package/dist/types/src/shapes/Queue.d.ts.map +0 -1
package/src/shapes/RNG.tsx
CHANGED
|
@@ -10,7 +10,6 @@ import { Icon, type IconProps } from '@dxos/react-ui';
|
|
|
10
10
|
import { type ShapeComponentProps, type ShapeDef, createAnchorMap } from '@dxos/react-ui-canvas-editor';
|
|
11
11
|
|
|
12
12
|
import { useComputeNodeState } from '../hooks';
|
|
13
|
-
|
|
14
13
|
import { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';
|
|
15
14
|
|
|
16
15
|
export const RandomShape = Schema.extend(
|
package/src/shapes/Scope.tsx
CHANGED
|
@@ -10,7 +10,6 @@ import { type ShapeComponentProps, type ShapeDef, createAnchorMap } from '@dxos/
|
|
|
10
10
|
import { Chaos, shaderPresets, useAudioStream } from '@dxos/react-ui-sfx';
|
|
11
11
|
|
|
12
12
|
import { useComputeNodeState } from '../hooks';
|
|
13
|
-
|
|
14
13
|
import { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';
|
|
15
14
|
|
|
16
15
|
export const ScopeShape = Schema.extend(
|
package/src/shapes/Surface.tsx
CHANGED
|
@@ -6,13 +6,13 @@ import * as Schema from 'effect/Schema';
|
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
8
|
import { Surface } from '@dxos/app-framework/ui';
|
|
9
|
+
import { AppSurface } from '@dxos/app-toolkit/ui';
|
|
9
10
|
import { DEFAULT_INPUT } from '@dxos/conductor';
|
|
10
11
|
import { Card } from '@dxos/react-ui';
|
|
11
12
|
import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
|
|
12
13
|
import { createAnchorMap } from '@dxos/react-ui-canvas-editor';
|
|
13
14
|
|
|
14
15
|
import { useComputeNodeState } from '../hooks';
|
|
15
|
-
|
|
16
16
|
import { Box, type BoxActionHandler } from './common';
|
|
17
17
|
import { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';
|
|
18
18
|
|
|
@@ -48,7 +48,9 @@ export const SurfaceComponent = ({ shape }: ShapeComponentProps<SurfaceShape>) =
|
|
|
48
48
|
// TODO(burdon): Subject property?
|
|
49
49
|
return (
|
|
50
50
|
<Box shape={shape} onAction={handleAction}>
|
|
51
|
-
<Card.Root>
|
|
51
|
+
<Card.Root>
|
|
52
|
+
{value !== null && <Surface.Surface type={AppSurface.Card} data={{ subject: value }} limit={1} />}
|
|
53
|
+
</Card.Root>
|
|
52
54
|
</Box>
|
|
53
55
|
);
|
|
54
56
|
};
|
package/src/shapes/Switch.tsx
CHANGED
|
@@ -10,7 +10,6 @@ import { Input } from '@dxos/react-ui';
|
|
|
10
10
|
import { type ShapeComponentProps, type ShapeDef, createAnchorMap } from '@dxos/react-ui-canvas-editor';
|
|
11
11
|
|
|
12
12
|
import { useComputeNodeState } from '../hooks';
|
|
13
|
-
|
|
14
13
|
import { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';
|
|
15
14
|
|
|
16
15
|
export const SwitchShape = Schema.extend(
|
package/src/shapes/Template.tsx
CHANGED
package/src/shapes/Text.tsx
CHANGED
|
@@ -10,7 +10,6 @@ import { type ShapeComponentProps, type ShapeDef, TextBox } from '@dxos/react-ui
|
|
|
10
10
|
import { createAnchorMap } from '@dxos/react-ui-canvas-editor';
|
|
11
11
|
|
|
12
12
|
import { useComputeNodeState } from '../hooks';
|
|
13
|
-
|
|
14
13
|
import { Box, type BoxActionHandler } from './common';
|
|
15
14
|
import { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';
|
|
16
15
|
|
package/src/shapes/Thread.tsx
CHANGED
|
@@ -55,11 +55,7 @@ export const ThreadComponent = ({ shape }: ShapeComponentProps<ThreadShape>) =>
|
|
|
55
55
|
|
|
56
56
|
export const ThreadItem = ({ classNames, item }: ThemedClassName<{ item: any }>) => {
|
|
57
57
|
if (typeof item !== 'object') {
|
|
58
|
-
return (
|
|
59
|
-
<div role='none' className={mx(classNames)}>
|
|
60
|
-
{item}
|
|
61
|
-
</div>
|
|
62
|
-
);
|
|
58
|
+
return <div className={mx(classNames)}>{item}</div>;
|
|
63
59
|
}
|
|
64
60
|
|
|
65
61
|
// TODO(burdon): Hack; introspect type.
|
package/src/shapes/Trigger.tsx
CHANGED
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
import React, { useEffect } from 'react';
|
|
7
7
|
|
|
8
|
+
import { Trigger, TriggerEvent } from '@dxos/compute';
|
|
8
9
|
import { VoidInput } from '@dxos/conductor';
|
|
9
10
|
import { Filter, Obj, Query, Ref } from '@dxos/echo';
|
|
10
11
|
import { type Mutable } from '@dxos/echo/internal';
|
|
11
|
-
import { Trigger, TriggerEvent } from '@dxos/functions';
|
|
12
12
|
import { DXN, SpaceId } from '@dxos/keys';
|
|
13
|
-
import {
|
|
13
|
+
import { useSpaces } from '@dxos/react-client/echo';
|
|
14
14
|
import { Select, type SelectRootProps } from '@dxos/react-ui';
|
|
15
15
|
import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
|
|
16
16
|
|
|
@@ -48,13 +48,13 @@ export const createTrigger = (props: CreateTriggerProps): TriggerShape => {
|
|
|
48
48
|
export type TriggerComponentProps = ShapeComponentProps<TriggerShape>;
|
|
49
49
|
|
|
50
50
|
export const TriggerComponent = ({ shape }: TriggerComponentProps) => {
|
|
51
|
-
const space =
|
|
51
|
+
const [space] = useSpaces();
|
|
52
52
|
const functionTrigger = shape.functionTrigger?.target;
|
|
53
53
|
|
|
54
54
|
useEffect(() => {
|
|
55
55
|
if (functionTrigger && !functionTrigger.spec) {
|
|
56
|
-
Obj.
|
|
57
|
-
|
|
56
|
+
Obj.update(functionTrigger, (functionTrigger) => {
|
|
57
|
+
functionTrigger.spec = createTriggerSpec({ triggerKind: 'email', spaceId: space?.id }) as Mutable<Trigger.Spec>;
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
}, [functionTrigger, functionTrigger?.spec]);
|
|
@@ -65,8 +65,8 @@ export const TriggerComponent = ({ shape }: TriggerComponentProps) => {
|
|
|
65
65
|
|
|
66
66
|
const setKind = (kind: Trigger.Kind) => {
|
|
67
67
|
if (functionTrigger?.spec?.kind !== kind) {
|
|
68
|
-
Obj.
|
|
69
|
-
|
|
68
|
+
Obj.update(functionTrigger!, (obj) => {
|
|
69
|
+
obj.spec = createTriggerSpec({ triggerKind: kind, spaceId: space?.id }) as Mutable<Trigger.Spec>;
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
};
|
|
@@ -114,21 +114,16 @@ const createTriggerSpec = (props: { triggerKind?: Trigger.Kind; spaceId?: SpaceI
|
|
|
114
114
|
const kind = props.triggerKind ?? 'email';
|
|
115
115
|
switch (kind) {
|
|
116
116
|
case 'timer':
|
|
117
|
-
return
|
|
117
|
+
return Trigger.specTimer('*/10 * * * * *');
|
|
118
118
|
case 'webhook':
|
|
119
|
-
return {
|
|
119
|
+
return Trigger.specWebhook({ method: 'POST' });
|
|
120
120
|
case 'subscription':
|
|
121
|
-
return
|
|
122
|
-
kind: 'subscription',
|
|
123
|
-
query: {
|
|
124
|
-
ast: Query.select(Filter.nothing()).ast,
|
|
125
|
-
},
|
|
126
|
-
} satisfies Trigger.SubscriptionSpec;
|
|
121
|
+
return Trigger.specSubscription(Query.select(Filter.nothing()));
|
|
127
122
|
case 'email':
|
|
128
|
-
return
|
|
123
|
+
return Trigger.specEmail();
|
|
129
124
|
case 'queue': {
|
|
130
125
|
const dxn = new DXN(DXN.kind.QUEUE, ['data', props.spaceId ?? SpaceId.random(), Obj.ID.random()]).toString();
|
|
131
|
-
return
|
|
126
|
+
return Trigger.specQueue(dxn);
|
|
132
127
|
}
|
|
133
128
|
}
|
|
134
129
|
};
|
|
@@ -39,7 +39,6 @@ export const Box = forwardRef<HTMLDivElement, BoxProps>(
|
|
|
39
39
|
classNames='p-1 text-green-500'
|
|
40
40
|
variant='ghost'
|
|
41
41
|
icon='ph--play--regular'
|
|
42
|
-
size={4}
|
|
43
42
|
label='run'
|
|
44
43
|
iconOnly
|
|
45
44
|
onDoubleClick={(ev) => ev.stopPropagation()}
|
|
@@ -57,7 +56,6 @@ export const Box = forwardRef<HTMLDivElement, BoxProps>(
|
|
|
57
56
|
classNames='p-1'
|
|
58
57
|
variant='ghost'
|
|
59
58
|
icon={open ? 'ph--caret-up--regular' : 'ph--caret-down--regular'}
|
|
60
|
-
size={4}
|
|
61
59
|
label={open ? 'close' : 'open'}
|
|
62
60
|
iconOnly
|
|
63
61
|
onClick={(ev) => {
|
package/src/shapes/index.ts
CHANGED
|
@@ -13,11 +13,12 @@ export * from './Boolean';
|
|
|
13
13
|
export * from './Chat';
|
|
14
14
|
export * from './Constant';
|
|
15
15
|
export * from './Database';
|
|
16
|
+
export * from './Feed';
|
|
16
17
|
export * from './Function';
|
|
17
18
|
export * from './Gpt';
|
|
19
|
+
export * from './GptRealtime';
|
|
18
20
|
export * from './Json';
|
|
19
21
|
export * from './Logic';
|
|
20
|
-
export * from './Queue';
|
|
21
22
|
export * from './RNG';
|
|
22
23
|
export * from './Scope';
|
|
23
24
|
export * from './Surface';
|
|
@@ -28,4 +29,3 @@ export * from './Text';
|
|
|
28
29
|
export * from './Thread';
|
|
29
30
|
export * from './TextToImage';
|
|
30
31
|
export * from './Trigger';
|
|
31
|
-
export * from './GptRealtime';
|
package/src/testing/circuits.ts
CHANGED
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
createJsonTransform,
|
|
25
25
|
createNot,
|
|
26
26
|
createOr,
|
|
27
|
-
|
|
27
|
+
createFeed,
|
|
28
28
|
createRandom,
|
|
29
29
|
createScope,
|
|
30
30
|
createSurface,
|
|
@@ -241,7 +241,7 @@ export const createGptCircuit = (options: {
|
|
|
241
241
|
}),
|
|
242
242
|
);
|
|
243
243
|
|
|
244
|
-
const thread = model.createNode(
|
|
244
|
+
const thread = model.createNode(createFeed(position({ x: -3, y: 3, width: 14, height: 10 })));
|
|
245
245
|
const append = model.createNode(createAppend(position({ x: 10, y: 6 })));
|
|
246
246
|
|
|
247
247
|
builder
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Queue.d.ts","sourceRoot":"","sources":["../../../../src/shapes/Queue.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAOvF,OAAO,EAAgB,KAAK,gBAAgB,EAAe,MAAM,QAAQ,CAAC;AAE1E,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;GAKtB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,UAAU,CAAC,CAAC;AAE/D,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;AAE5D,eAAO,MAAM,WAAW,GAAI,OAAO,gBAAgB;;;;;;;;;;;;;;;;;;;CAK/C,CAAC;AAEL,eAAO,MAAM,cAAc,GAAI,WAAW,mBAAmB,CAAC,UAAU,CAAC,sBAqBxE,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,sBAAsB,eAAe,CAAC;IAAE,IAAI,EAAE,GAAG,CAAA;CAAE,CAAC,sBAe7E,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,UAAU,CAQ3C,CAAC"}
|