@dxos/react-ui-canvas-compute 0.8.4-main.bc674ce → 0.8.4-main.bcb3aa67d6

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 (54) hide show
  1. package/dist/lib/browser/index.mjs +394 -384
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node-esm/index.mjs +394 -384
  5. package/dist/lib/node-esm/index.mjs.map +4 -4
  6. package/dist/lib/node-esm/meta.json +1 -1
  7. package/dist/types/src/compute.stories.d.ts.map +1 -1
  8. package/dist/types/src/graph/controller.d.ts +2 -2
  9. package/dist/types/src/graph/controller.d.ts.map +1 -1
  10. package/dist/types/src/hooks/useGraphMonitor.d.ts +2 -2
  11. package/dist/types/src/hooks/useGraphMonitor.d.ts.map +1 -1
  12. package/dist/types/src/shapes/{Queue.d.ts → Feed.d.ts} +8 -8
  13. package/dist/types/src/shapes/Feed.d.ts.map +1 -0
  14. package/dist/types/src/shapes/Function.d.ts.map +1 -1
  15. package/dist/types/src/shapes/Gpt.d.ts.map +1 -1
  16. package/dist/types/src/shapes/Json.d.ts.map +1 -1
  17. package/dist/types/src/shapes/Surface.d.ts.map +1 -1
  18. package/dist/types/src/shapes/Thread.d.ts.map +1 -1
  19. package/dist/types/src/shapes/Trigger.d.ts +2 -1
  20. package/dist/types/src/shapes/Trigger.d.ts.map +1 -1
  21. package/dist/types/src/shapes/common/Box.d.ts +3 -3
  22. package/dist/types/src/shapes/common/Box.d.ts.map +1 -1
  23. package/dist/types/src/shapes/common/FunctionBody.d.ts +2 -2
  24. package/dist/types/src/shapes/common/FunctionBody.d.ts.map +1 -1
  25. package/dist/types/src/shapes/index.d.ts +2 -2
  26. package/dist/types/src/shapes/index.d.ts.map +1 -1
  27. package/dist/types/tsconfig.tsbuildinfo +1 -1
  28. package/package.json +50 -48
  29. package/src/README.md +0 -3
  30. package/src/compute.stories.tsx +17 -9
  31. package/src/graph/controller.ts +5 -1
  32. package/src/graph/node-defs.ts +28 -28
  33. package/src/hooks/useGraphMonitor.ts +5 -5
  34. package/src/registry.ts +2 -2
  35. package/src/schema.test.ts +3 -3
  36. package/src/shapes/Audio.tsx +2 -2
  37. package/src/shapes/Beacon.tsx +1 -1
  38. package/src/shapes/Boolean.tsx +2 -2
  39. package/src/shapes/{Queue.tsx → Feed.tsx} +21 -19
  40. package/src/shapes/Function.tsx +3 -2
  41. package/src/shapes/Gpt.tsx +6 -1
  42. package/src/shapes/GptRealtime.tsx +1 -1
  43. package/src/shapes/Json.tsx +7 -2
  44. package/src/shapes/Scope.tsx +1 -1
  45. package/src/shapes/Surface.tsx +4 -2
  46. package/src/shapes/Switch.tsx +1 -1
  47. package/src/shapes/Thread.tsx +14 -8
  48. package/src/shapes/Trigger.tsx +7 -7
  49. package/src/shapes/common/Box.tsx +7 -10
  50. package/src/shapes/common/FunctionBody.tsx +4 -4
  51. package/src/shapes/common/TypeSelect.tsx +1 -1
  52. package/src/shapes/index.ts +2 -2
  53. package/src/testing/circuits.ts +2 -2
  54. package/dist/types/src/shapes/Queue.d.ts.map +0 -1
@@ -5,8 +5,9 @@
5
5
  import * as Schema from 'effect/Schema';
6
6
  import React from 'react';
7
7
 
8
- import { Surface } from '@dxos/app-framework/react';
8
+ import { Surface } from '@dxos/app-framework/ui';
9
9
  import { DEFAULT_INPUT } from '@dxos/conductor';
10
+ import { Card } from '@dxos/react-ui';
10
11
  import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
11
12
  import { createAnchorMap } from '@dxos/react-ui-canvas-editor';
12
13
 
@@ -44,9 +45,10 @@ export const SurfaceComponent = ({ shape }: ShapeComponentProps<SurfaceShape>) =
44
45
  }
45
46
  };
46
47
 
48
+ // TODO(burdon): Subject property?
47
49
  return (
48
50
  <Box shape={shape} onAction={handleAction}>
49
- {value !== null && <Surface role='card--extrinsic' data={{ value }} limit={1} />}
51
+ <Card.Root>{value !== null && <Surface.Surface role='card--content' data={{ value }} limit={1} />}</Card.Root>
50
52
  </Box>
51
53
  );
52
54
  };
@@ -36,7 +36,7 @@ export const SwitchComponent = ({ shape }: ShapeComponentProps<SwitchShape>) =>
36
36
  }, [value]);
37
37
 
38
38
  return (
39
- <div className='flex is-full justify-center items-center' onClick={(ev) => ev.stopPropagation()}>
39
+ <div className='flex w-full justify-center items-center' onClick={(ev) => ev.stopPropagation()}>
40
40
  <Input.Root>
41
41
  <Input.Switch checked={value} onCheckedChange={(value) => setValue(value)} />
42
42
  </Input.Root>
@@ -6,7 +6,7 @@ import * as Schema from 'effect/Schema';
6
6
  import React, { useEffect, useRef } from 'react';
7
7
 
8
8
  import { createInputSchema, createOutputSchema } from '@dxos/conductor';
9
- import { type ThemedClassName } from '@dxos/react-ui';
9
+ import { ScrollArea, type ThemedClassName } from '@dxos/react-ui';
10
10
  import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
11
11
  import { Message } from '@dxos/types';
12
12
  import { mx } from '@dxos/ui-theme';
@@ -42,18 +42,24 @@ export const ThreadComponent = ({ shape }: ShapeComponentProps<ThreadShape>) =>
42
42
 
43
43
  return (
44
44
  <Box shape={shape}>
45
- <div ref={scrollRef} className='flex flex-col is-full overflow-y-auto gap-2 p-2'>
46
- {[...items].map((item, i) => (
47
- <ThreadItem key={i} item={item} />
48
- ))}
49
- </div>
45
+ <ScrollArea.Root orientation='vertical'>
46
+ <ScrollArea.Viewport classNames='gap-2 p-2' ref={scrollRef}>
47
+ {[...items].map((item, i) => (
48
+ <ThreadItem key={i} item={item} />
49
+ ))}
50
+ </ScrollArea.Viewport>
51
+ </ScrollArea.Root>
50
52
  </Box>
51
53
  );
52
54
  };
53
55
 
54
56
  export const ThreadItem = ({ classNames, item }: ThemedClassName<{ item: any }>) => {
55
57
  if (typeof item !== 'object') {
56
- return <div className={mx(classNames)}>{item}</div>;
58
+ return (
59
+ <div role='none' className={mx(classNames)}>
60
+ {item}
61
+ </div>
62
+ );
57
63
  }
58
64
 
59
65
  // TODO(burdon): Hack; introspect type.
@@ -63,7 +69,7 @@ export const ThreadItem = ({ classNames, item }: ThemedClassName<{ item: any }>)
63
69
  <div className={mx('flex', classNames, role === 'user' && 'justify-end')}>
64
70
  <div
65
71
  className={mx(
66
- 'block rounded-md p-1 pli-2 text-sm',
72
+ 'block rounded-md p-1 px-2 text-sm',
67
73
  role === 'user'
68
74
  ? 'bg-blue-100 dark:bg-blue-800'
69
75
  : role === 'system'
@@ -6,7 +6,7 @@ import * as Schema from 'effect/Schema';
6
6
  import React, { useEffect } from 'react';
7
7
 
8
8
  import { VoidInput } from '@dxos/conductor';
9
- import { Filter, Obj, Query, Ref, Type } from '@dxos/echo';
9
+ import { Filter, Obj, Query, Ref } from '@dxos/echo';
10
10
  import { type Mutable } from '@dxos/echo/internal';
11
11
  import { Trigger, TriggerEvent } from '@dxos/functions';
12
12
  import { DXN, SpaceId } from '@dxos/keys';
@@ -21,7 +21,7 @@ export const TriggerShape = Schema.extend(
21
21
  ComputeShape,
22
22
  Schema.Struct({
23
23
  type: Schema.Literal('trigger'),
24
- functionTrigger: Schema.optional(Type.Ref(Trigger.Trigger)),
24
+ functionTrigger: Schema.optional(Ref.Ref(Trigger.Trigger)),
25
25
  }),
26
26
  );
27
27
 
@@ -53,8 +53,8 @@ export const TriggerComponent = ({ shape }: TriggerComponentProps) => {
53
53
 
54
54
  useEffect(() => {
55
55
  if (functionTrigger && !functionTrigger.spec) {
56
- Obj.change(functionTrigger, (t) => {
57
- t.spec = createTriggerSpec({ triggerKind: 'email', spaceId: space?.id }) as Mutable<Trigger.Spec>;
56
+ Obj.change(functionTrigger, (obj) => {
57
+ obj.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.change(functionTrigger!, (t) => {
69
- t.spec = createTriggerSpec({ triggerKind: kind, spaceId: space?.id }) as Mutable<Trigger.Spec>;
68
+ Obj.change(functionTrigger!, (obj) => {
69
+ obj.spec = createTriggerSpec({ triggerKind: kind, spaceId: space?.id }) as Mutable<Trigger.Spec>;
70
70
  });
71
71
  }
72
72
  };
@@ -91,7 +91,7 @@ export const TriggerComponent = ({ shape }: TriggerComponentProps) => {
91
91
  const TriggerKindSelect = ({ value, onValueChange }: Pick<SelectRootProps, 'value' | 'onValueChange'>) => {
92
92
  return (
93
93
  <Select.Root value={value} onValueChange={onValueChange}>
94
- <Select.TriggerButton variant='ghost' classNames='is-full !pli-0' />
94
+ <Select.TriggerButton variant='ghost' classNames='w-full px-0!' />
95
95
  <Select.Portal>
96
96
  <Select.Content>
97
97
  <Select.ScrollUpButton />
@@ -6,8 +6,7 @@ import React, { type PropsWithChildren, type ReactNode, forwardRef } from 'react
6
6
 
7
7
  import { invariant } from '@dxos/invariant';
8
8
  import { Icon, IconButton, type ThemedClassName } from '@dxos/react-ui';
9
- import { useEditorContext, useShapeDef } from '@dxos/react-ui-canvas-editor';
10
- import { type Shape } from '@dxos/react-ui-canvas-editor';
9
+ import { type CanvasBoard, useEditorContext, useShapeDef } from '@dxos/react-ui-canvas-editor';
11
10
  import { mx } from '@dxos/ui-theme';
12
11
 
13
12
  export const headerHeight = 32;
@@ -17,7 +16,7 @@ export type BoxActionHandler = (action: 'run' | 'open' | 'close') => void;
17
16
 
18
17
  export type BoxProps = PropsWithChildren<
19
18
  ThemedClassName<{
20
- shape: Shape;
19
+ shape: CanvasBoard.Shape;
21
20
  title?: string;
22
21
  status?: string | ReactNode;
23
22
  open?: boolean;
@@ -32,15 +31,14 @@ export const Box = forwardRef<HTMLDivElement, BoxProps>(
32
31
  const { debug } = useEditorContext();
33
32
 
34
33
  return (
35
- <div ref={forwardedRef} className='flex flex-col bs-full is-full justify-between'>
36
- <div className='flex shrink-0 is-full justify-between items-center bs-[32px] bg-hoverSurface'>
34
+ <div ref={forwardedRef} className='flex flex-col h-full w-full justify-between'>
35
+ <div className='flex shrink-0 w-full justify-between items-center h-[32px] bg-input-surface'>
37
36
  <Icon icon={icon} classNames='mx-2' />
38
37
  <div className='grow text-sm truncate'>{debug ? shape.type : (name ?? shape.text ?? title)}</div>
39
38
  <IconButton
40
39
  classNames='p-1 text-green-500'
41
40
  variant='ghost'
42
41
  icon='ph--play--regular'
43
- size={4}
44
42
  label='run'
45
43
  iconOnly
46
44
  onDoubleClick={(ev) => ev.stopPropagation()}
@@ -50,15 +48,14 @@ export const Box = forwardRef<HTMLDivElement, BoxProps>(
50
48
  }}
51
49
  />
52
50
  </div>
53
- <div className={mx('flex flex-col bs-full grow overflow-hidden', classNames)}>{children}</div>
54
- <div className='flex shrink-0 is-full justify-between items-center bs-[32px] bg-hoverSurface'>
55
- <div className='grow pli-2 text-sm truncate'>{debug ? shape.id : status}</div>
51
+ <div className={mx('flex flex-col h-full grow overflow-hidden', classNames)}>{children}</div>
52
+ <div className='flex shrink-0 w-full justify-between items-center h-[32px] bg-input-surface'>
53
+ <div className='grow px-2 text-sm truncate'>{debug ? shape.id : status}</div>
56
54
  {openable && (
57
55
  <IconButton
58
56
  classNames='p-1'
59
57
  variant='ghost'
60
58
  icon={open ? 'ph--caret-up--regular' : 'ph--caret-down--regular'}
61
- size={4}
62
59
  label={open ? 'close' : 'open'}
63
60
  iconOnly
64
61
  onClick={(ev) => {
@@ -8,7 +8,7 @@ import React, { type JSX, useRef, useState } from 'react';
8
8
 
9
9
  import { VoidInput, VoidOutput } from '@dxos/conductor';
10
10
  import { useCanvasContext } from '@dxos/react-ui-canvas';
11
- import { type Polygon, type Shape } from '@dxos/react-ui-canvas-editor';
11
+ import { type CanvasBoard, type Polygon } from '@dxos/react-ui-canvas-editor';
12
12
  import { createAnchors, getParentShapeElement, rowHeight } from '@dxos/react-ui-canvas-editor';
13
13
 
14
14
  import { Box, type BoxProps, footerHeight, headerHeight } from '../common';
@@ -18,7 +18,7 @@ const bodyPadding = 8;
18
18
  const expandedHeight = 200;
19
19
 
20
20
  export type FunctionBodyProps = {
21
- shape: Shape;
21
+ shape: CanvasBoard.Shape;
22
22
  name?: string;
23
23
  content?: JSX.Element;
24
24
  inputSchema?: Schema.Schema.Any;
@@ -82,7 +82,7 @@ export const FunctionBody = ({
82
82
  {(inputs?.length ?? 0) > 0 && (
83
83
  <div className='flex flex-col'>
84
84
  {inputs?.map(({ name }) => (
85
- <div key={name} className='pli-2 truncate text-sm font-mono items-center' style={{ height: rowHeight }}>
85
+ <div key={name} className='px-2 truncate text-sm font-mono items-center' style={{ height: rowHeight }}>
86
86
  {name}
87
87
  </div>
88
88
  ))}
@@ -93,7 +93,7 @@ export const FunctionBody = ({
93
93
  {outputs?.map(({ name }) => (
94
94
  <div
95
95
  key={name}
96
- className='pli-2 truncate text-sm font-mono items-center text-right'
96
+ className='px-2 truncate text-sm font-mono items-center text-right'
97
97
  style={{ height: rowHeight }}
98
98
  >
99
99
  {name}
@@ -11,7 +11,7 @@ import { Select, type SelectRootProps } from '@dxos/react-ui';
11
11
  export const TypeSelect = ({ value, onValueChange }: Pick<SelectRootProps, 'value' | 'onValueChange'>) => {
12
12
  return (
13
13
  <Select.Root value={value} onValueChange={onValueChange}>
14
- <Select.TriggerButton variant='ghost' classNames='is-full !pli-0' />
14
+ <Select.TriggerButton variant='ghost' classNames='w-full px-0!' />
15
15
  <Select.Portal>
16
16
  <Select.Content>
17
17
  <Select.ScrollUpButton />
@@ -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';
@@ -24,7 +24,7 @@ import {
24
24
  createJsonTransform,
25
25
  createNot,
26
26
  createOr,
27
- createQueue,
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(createQueue(position({ x: -3, y: 3, width: 14, height: 10 })));
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,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,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,sBAmBxE,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"}