@dxos/plugin-debug 0.7.2 → 0.7.3-main.2dd075e

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 (39) hide show
  1. package/dist/lib/browser/{DebugSpace-ZLGGNDAR.mjs → DebugSpace-DHKEAMIC.mjs} +3 -3
  2. package/dist/lib/browser/{DebugSpace-ZLGGNDAR.mjs.map → DebugSpace-DHKEAMIC.mjs.map} +2 -2
  3. package/dist/lib/browser/SpaceGenerator-P7ZPQ4N7.mjs +429 -0
  4. package/dist/lib/browser/SpaceGenerator-P7ZPQ4N7.mjs.map +7 -0
  5. package/dist/lib/browser/index.mjs +35 -34
  6. package/dist/lib/browser/index.mjs.map +3 -3
  7. package/dist/lib/browser/meta.json +1 -1
  8. package/dist/types/src/DebugPlugin.d.ts.map +1 -1
  9. package/dist/types/src/components/DebugObjectPanel.d.ts.map +1 -1
  10. package/dist/types/src/components/DebugSpace/DebugSpace.d.ts +1 -1
  11. package/dist/types/src/components/{SurfaceDebug.d.ts → DebugSurface.d.ts} +2 -2
  12. package/dist/types/src/components/{SurfaceDebug.d.ts.map → DebugSurface.d.ts.map} +1 -1
  13. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +7 -0
  14. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -0
  15. package/dist/types/src/components/SpaceGenerator/SchemaTable.d.ts +9 -0
  16. package/dist/types/src/components/SpaceGenerator/SchemaTable.d.ts.map +1 -0
  17. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts +9 -0
  18. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts.map +1 -0
  19. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts +6 -0
  20. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts.map +1 -0
  21. package/dist/types/src/components/SpaceGenerator/draw-util.d.ts +8 -0
  22. package/dist/types/src/components/SpaceGenerator/draw-util.d.ts.map +1 -0
  23. package/dist/types/src/components/SpaceGenerator/index.d.ts +3 -0
  24. package/dist/types/src/components/SpaceGenerator/index.d.ts.map +1 -0
  25. package/dist/types/src/components/index.d.ts +2 -1
  26. package/dist/types/src/components/index.d.ts.map +1 -1
  27. package/package.json +45 -38
  28. package/src/DebugPlugin.tsx +58 -39
  29. package/src/components/DebugObjectPanel.tsx +2 -1
  30. package/src/components/DebugSpace/DebugSpace.tsx +2 -2
  31. package/src/components/DebugSpace/ObjectCreator.tsx +1 -1
  32. package/src/components/{SurfaceDebug.tsx → DebugSurface.tsx} +1 -1
  33. package/src/components/SpaceGenerator/ObjectGenerator.tsx +178 -0
  34. package/src/components/SpaceGenerator/SchemaTable.tsx +38 -0
  35. package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +37 -0
  36. package/src/components/SpaceGenerator/SpaceGenerator.tsx +113 -0
  37. package/src/components/SpaceGenerator/draw-util.ts +124 -0
  38. package/src/components/SpaceGenerator/index.ts +7 -0
  39. package/src/components/index.ts +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"DebugPlugin.d.ts","sourceRoot":"","sources":["../../../src/DebugPlugin.tsx"],"names":[],"mappings":"AAkCA,OAAO,EAGL,KAAK,mBAAmB,EAGzB,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,WAAW,2EAuTtB,CAAC"}
1
+ {"version":3,"file":"DebugPlugin.d.ts","sourceRoot":"","sources":["../../../src/DebugPlugin.tsx"],"names":[],"mappings":"AAmDA,OAAO,EAGL,KAAK,mBAAmB,EAGzB,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,WAAW,2EAyTtB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"DebugObjectPanel.d.ts","sourceRoot":"","sources":["../../../../src/components/DebugObjectPanel.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAG5D,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,kBAAkB,CAAC,GAAG,CAAC,CAAC;CACjC,CAAC;AAEF,eAAO,MAAM,gBAAgB,eAAgB,qBAAqB,sBAQjE,CAAC"}
1
+ {"version":3,"file":"DebugObjectPanel.d.ts","sourceRoot":"","sources":["../../../../src/components/DebugObjectPanel.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAG5D,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,kBAAkB,CAAC,GAAG,CAAC,CAAC;CACjC,CAAC;AAGF,eAAO,MAAM,gBAAgB,eAAgB,qBAAqB,sBAQjE,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { type FC } from 'react';
2
- import { type ReactiveObject } from '@dxos/echo-schema';
2
+ import { type ReactiveObject } from '@dxos/live-object';
3
3
  import { type Space } from '@dxos/react-client/echo';
4
4
  export declare const DebugSpace: FC<{
5
5
  space: Space;
@@ -5,5 +5,5 @@ export type SurfaceDebugProps = ThemedClassName<{}>;
5
5
  * Show surface info.
6
6
  * NOTE: Remove from @dxos/app-framework if removing this.
7
7
  */
8
- export declare const SurfaceDebug: ({ classNames }: SurfaceDebugProps) => React.JSX.Element;
9
- //# sourceMappingURL=SurfaceDebug.d.ts.map
8
+ export declare const DebugSurface: ({ classNames }: SurfaceDebugProps) => React.JSX.Element;
9
+ //# sourceMappingURL=DebugSurface.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SurfaceDebug.d.ts","sourceRoot":"","sources":["../../../../src/components/SurfaceDebug.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAGjD,OAAO,EAAgB,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAKpE,MAAM,MAAM,iBAAiB,GAAG,eAAe,CAAC,EAAE,CAAC,CAAC;AAEpD;;;GAGG;AACH,eAAO,MAAM,YAAY,mBAAoB,iBAAiB,sBAoC7D,CAAC"}
1
+ {"version":3,"file":"DebugSurface.d.ts","sourceRoot":"","sources":["../../../../src/components/DebugSurface.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAGjD,OAAO,EAAgB,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAKpE,MAAM,MAAM,iBAAiB,GAAG,eAAe,CAAC,EAAE,CAAC,CAAC;AAEpD;;;GAGG;AACH,eAAO,MAAM,YAAY,mBAAoB,iBAAiB,sBAoC7D,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { type AbstractSchema, type BaseObject } from '@dxos/echo-schema';
2
+ import { type ReactiveObject } from '@dxos/live-object';
3
+ import { type Space } from '@dxos/react-client/echo';
4
+ export type ObjectGenerator<T extends BaseObject> = (space: Space, n: number, cb?: (objects: ReactiveObject<any>[]) => void) => Promise<ReactiveObject<T>[]>;
5
+ export declare const staticGenerators: Map<string, ObjectGenerator<any>>;
6
+ export declare const createGenerator: <T extends BaseObject>(type: AbstractSchema<T>) => ObjectGenerator<T>;
7
+ //# sourceMappingURL=ObjectGenerator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ObjectGenerator.d.ts","sourceRoot":"","sources":["../../../../../src/components/SpaceGenerator/ObjectGenerator.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAU,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAOhE,OAAO,EAAU,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAe7D,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,UAAU,IAAI,CAClD,KAAK,EAAE,KAAK,EACZ,CAAC,EAAE,MAAM,EACT,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,CAAC,GAAG,CAAC,EAAE,KAAK,IAAI,KAC1C,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AAGlC,eAAO,MAAM,gBAAgB,mCAwG3B,CAAC;AAEH,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,UAAU,QAAQ,cAAc,CAAC,CAAC,CAAC,KAAG,eAAe,CAAC,CAAC,CA2BhG,CAAC"}
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ export type SchemaTableProps = {
3
+ types: any[];
4
+ objects?: Record<string, number | undefined>;
5
+ label: string;
6
+ onClick: (typename: string) => void;
7
+ };
8
+ export declare const SchemaTable: ({ types, objects, label, onClick }: SchemaTableProps) => React.JSX.Element;
9
+ //# sourceMappingURL=SchemaTable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaTable.d.ts","sourceRoot":"","sources":["../../../../../src/components/SpaceGenerator/SchemaTable.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,GAAG,EAAE,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC,CAAC;AAEF,eAAO,MAAM,WAAW,uCAA6C,gBAAgB,sBAsBpF,CAAC"}
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { type ReactiveObject } from '@dxos/live-object';
3
+ import { type Space } from '@dxos/react-client/echo';
4
+ export type SpaceGeneratorProps = {
5
+ space: Space;
6
+ onCreateObjects?: (objects: ReactiveObject<any>[]) => void;
7
+ };
8
+ export declare const SpaceGenerator: ({ space, onCreateObjects }: SpaceGeneratorProps) => React.JSX.Element;
9
+ //# sourceMappingURL=SpaceGenerator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SpaceGenerator.d.ts","sourceRoot":"","sources":["../../../../../src/components/SpaceGenerator/SpaceGenerator.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAKxD,OAAO,EAAe,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAC;AASlE,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,KAAK,CAAC;IACb,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,CAAC,GAAG,CAAC,EAAE,KAAK,IAAI,CAAC;CAC5D,CAAC;AAEF,eAAO,MAAM,cAAc,+BAAgC,mBAAmB,sBAuF7E,CAAC"}
@@ -0,0 +1,6 @@
1
+ import '@dxos-theme';
2
+ import { type Meta } from '@storybook/react';
3
+ declare const meta: Meta;
4
+ export default meta;
5
+ export declare const Default: {};
6
+ //# sourceMappingURL=SpaceGenerator.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SpaceGenerator.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/SpaceGenerator/SpaceGenerator.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAkB7C,QAAA,MAAM,IAAI,EAAE,IAQX,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,OAAO,IAAK,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { Graph, type PlainObject } from '@antv/graphlib';
2
+ import { type Editor, type SerializedStore, type TLRecord } from '@tldraw/tldraw';
3
+ /**
4
+ * https://github.com/antvis/graphlib/blob/master/docs/classes/Graph.md
5
+ */
6
+ export declare const generateGraph: () => Graph<PlainObject, PlainObject>;
7
+ export declare const drawGraph: (editor: Editor, graph: Graph<PlainObject, PlainObject>) => Promise<SerializedStore<TLRecord>>;
8
+ //# sourceMappingURL=draw-util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"draw-util.d.ts","sourceRoot":"","sources":["../../../../../src/components/SpaceGenerator/draw-util.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,EAAa,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAEpE,OAAO,EAAkC,KAAK,MAAM,EAAE,KAAK,eAAe,EAAE,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAclH;;GAEG;AAGH,eAAO,MAAM,aAAa,QAAO,KAAK,CAAC,WAAW,EAAE,WAAW,CAyB9D,CAAC;AAEF,eAAO,MAAM,SAAS,WACZ,MAAM,SACP,KAAK,CAAC,WAAW,EAAE,WAAW,CAAC,KACrC,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,CAmEnC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { SpaceGenerator } from './SpaceGenerator';
2
+ export default SpaceGenerator;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/SpaceGenerator/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,eAAe,cAAc,CAAC"}
@@ -3,8 +3,9 @@ export declare const DebugApp: import("react").LazyExoticComponent<import("react
3
3
  }>>;
4
4
  export declare const DebugSpace: import("react").LazyExoticComponent<import("react").FC<{
5
5
  space: import("packages/sdk/client-protocol/dist/types/src").Space;
6
- onAddObjects?: (objects: import("packages/core/echo/echo-schema/dist/types/src").ReactiveObject<any>[]) => void;
6
+ onAddObjects?: (objects: import("packages/core/echo/live-object/dist/types/src").ReactiveObject<any>[]) => void;
7
7
  }>>;
8
+ export declare const SpaceGenerator: import("react").LazyExoticComponent<({ space, onCreateObjects }: import("./SpaceGenerator/SpaceGenerator").SpaceGeneratorProps) => import("react").JSX.Element>;
8
9
  export * from './DebugObjectPanel';
9
10
  export * from './DebugSettings';
10
11
  export * from './DebugStatus';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,QAAQ;;GAAmC,CAAC;AACzD,eAAO,MAAM,UAAU;;;GAAqC,CAAC;AAE7D,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,QAAQ;;GAAmC,CAAC;AACzD,eAAO,MAAM,UAAU;;;GAAqC,CAAC;AAC7D,eAAO,MAAM,cAAc,iKAAyC,CAAC;AAErE,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/plugin-debug",
3
- "version": "0.7.2",
3
+ "version": "0.7.3-main.2dd075e",
4
4
  "description": "DXOS Surface plugin for testing.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -30,43 +30,50 @@
30
30
  "src"
31
31
  ],
32
32
  "dependencies": {
33
+ "@antv/graphlib": "^2.0.4",
34
+ "@antv/layout": "^1.2.13",
33
35
  "@preact/signals-core": "^1.6.0",
34
36
  "@tldraw/tldraw": "^3.0.0",
35
37
  "date-fns": "^3.3.1",
38
+ "effect": "^3.9.2",
36
39
  "lodash.get": "^4.4.2",
37
40
  "react-json-tree": "^0.18.0",
38
41
  "react-resize-detector": "^11.0.1",
39
- "@dxos/app-framework": "0.7.2",
40
- "@dxos/async": "0.7.2",
41
- "@dxos/automerge": "0.7.2",
42
- "@dxos/client-services": "0.7.2",
43
- "@dxos/config": "0.7.2",
44
- "@dxos/echo-generator": "0.7.2",
45
- "@dxos/echo-pipeline": "0.7.2",
46
- "@dxos/invariant": "0.7.2",
47
- "@dxos/devtools": "0.7.2",
48
- "@dxos/keys": "0.7.2",
49
- "@dxos/echo-schema": "0.7.2",
50
- "@dxos/local-storage": "0.7.2",
51
- "@dxos/log": "0.7.2",
52
- "@dxos/plugin-client": "0.7.2",
53
- "@dxos/plugin-deck": "0.7.2",
54
- "@dxos/plugin-graph": "0.7.2",
55
- "@dxos/plugin-sketch": "0.7.2",
56
- "@dxos/plugin-markdown": "0.7.2",
57
- "@dxos/plugin-space": "0.7.2",
58
- "@dxos/plugin-status-bar": "0.7.2",
59
- "@dxos/protocols": "0.7.2",
60
- "@dxos/plugin-theme": "0.7.2",
61
- "@dxos/react-client": "0.7.2",
62
- "@dxos/plugin-table": "0.7.2",
63
- "@dxos/react-hooks": "0.7.2",
64
- "@dxos/random": "0.7.2",
65
- "@dxos/react-ui-attention": "0.7.2",
66
- "@dxos/react-ui-form": "0.7.2",
67
- "@dxos/react-ui-syntax-highlighter": "0.7.2",
68
- "@dxos/react-ui-table": "0.7.2",
69
- "@dxos/util": "0.7.2"
42
+ "workerize-loader": "^2.0.2",
43
+ "@dxos/async": "0.7.3-main.2dd075e",
44
+ "@dxos/app-framework": "0.7.3-main.2dd075e",
45
+ "@dxos/automerge": "0.7.3-main.2dd075e",
46
+ "@dxos/config": "0.7.3-main.2dd075e",
47
+ "@dxos/client-services": "0.7.3-main.2dd075e",
48
+ "@dxos/devtools": "0.7.3-main.2dd075e",
49
+ "@dxos/echo-generator": "0.7.3-main.2dd075e",
50
+ "@dxos/echo-pipeline": "0.7.3-main.2dd075e",
51
+ "@dxos/echo-schema": "0.7.3-main.2dd075e",
52
+ "@dxos/keys": "0.7.3-main.2dd075e",
53
+ "@dxos/invariant": "0.7.3-main.2dd075e",
54
+ "@dxos/live-object": "0.7.3-main.2dd075e",
55
+ "@dxos/local-storage": "0.7.3-main.2dd075e",
56
+ "@dxos/plugin-client": "0.7.3-main.2dd075e",
57
+ "@dxos/log": "0.7.3-main.2dd075e",
58
+ "@dxos/plugin-graph": "0.7.3-main.2dd075e",
59
+ "@dxos/plugin-deck": "0.7.3-main.2dd075e",
60
+ "@dxos/plugin-markdown": "0.7.3-main.2dd075e",
61
+ "@dxos/plugin-sheet": "0.7.3-main.2dd075e",
62
+ "@dxos/plugin-space": "0.7.3-main.2dd075e",
63
+ "@dxos/plugin-sketch": "0.7.3-main.2dd075e",
64
+ "@dxos/plugin-status-bar": "0.7.3-main.2dd075e",
65
+ "@dxos/plugin-table": "0.7.3-main.2dd075e",
66
+ "@dxos/plugin-theme": "0.7.3-main.2dd075e",
67
+ "@dxos/protocols": "0.7.3-main.2dd075e",
68
+ "@dxos/random": "0.7.3-main.2dd075e",
69
+ "@dxos/react-client": "0.7.3-main.2dd075e",
70
+ "@dxos/react-hooks": "0.7.3-main.2dd075e",
71
+ "@dxos/react-ui-form": "0.7.3-main.2dd075e",
72
+ "@dxos/react-ui-syntax-highlighter": "0.7.3-main.2dd075e",
73
+ "@dxos/react-ui-attention": "0.7.3-main.2dd075e",
74
+ "@dxos/react-ui-table": "0.7.3-main.2dd075e",
75
+ "@dxos/util": "0.7.3-main.2dd075e",
76
+ "@dxos/schema": "0.7.3-main.2dd075e"
70
77
  },
71
78
  "devDependencies": {
72
79
  "@phosphor-icons/react": "^2.1.5",
@@ -76,17 +83,17 @@
76
83
  "react": "~18.2.0",
77
84
  "react-dom": "~18.2.0",
78
85
  "vite": "5.4.7",
79
- "@dxos/storybook-utils": "0.7.2",
80
- "@dxos/react-ui": "0.7.2",
81
- "@dxos/react-ui-theme": "0.7.2"
86
+ "@dxos/react-ui": "0.7.3-main.2dd075e",
87
+ "@dxos/storybook-utils": "0.7.3-main.2dd075e",
88
+ "@dxos/react-ui-theme": "0.7.3-main.2dd075e"
82
89
  },
83
90
  "peerDependencies": {
84
91
  "@phosphor-icons/react": "^2.1.5",
85
92
  "react": "~18.2.0",
86
93
  "react-dom": "~18.2.0",
87
- "@dxos/random": "0.7.2",
88
- "@dxos/react-ui": "0.7.2",
89
- "@dxos/react-ui-theme": "0.7.2"
94
+ "@dxos/random": "0.7.3-main.2dd075e",
95
+ "@dxos/react-ui": "0.7.3-main.2dd075e",
96
+ "@dxos/react-ui-theme": "0.7.3-main.2dd075e"
90
97
  },
91
98
  "publishConfig": {
92
99
  "access": "public"
@@ -17,10 +17,19 @@ import { Devtools } from '@dxos/devtools';
17
17
  import { invariant } from '@dxos/invariant';
18
18
  import { type ClientPluginProvides, parseClientPlugin } from '@dxos/plugin-client';
19
19
  import { createExtension, Graph, type Node, toSignal } from '@dxos/plugin-graph';
20
- import { SpaceAction } from '@dxos/plugin-space';
20
+ import { memoizeQuery, SpaceAction } from '@dxos/plugin-space';
21
21
  import { CollectionType } from '@dxos/plugin-space/types';
22
22
  import { type Client } from '@dxos/react-client';
23
- import { create, getTypename, isEchoObject, isSpace, parseId, type Space, SpaceState } from '@dxos/react-client/echo';
23
+ import {
24
+ create,
25
+ getTypename,
26
+ isEchoObject,
27
+ isSpace,
28
+ parseId,
29
+ type ReactiveObject,
30
+ type Space,
31
+ SpaceState,
32
+ } from '@dxos/react-client/echo';
24
33
  import { Main } from '@dxos/react-ui';
25
34
  import {
26
35
  baseSurface,
@@ -29,7 +38,15 @@ import {
29
38
  topbarBlockPaddingStart,
30
39
  } from '@dxos/react-ui-theme';
31
40
 
32
- import { DebugApp, DebugObjectPanel, DebugSettings, DebugSpace, DebugStatus, Wireframe } from './components';
41
+ import {
42
+ DebugApp,
43
+ DebugObjectPanel,
44
+ DebugSettings,
45
+ DebugSpace,
46
+ DebugStatus,
47
+ SpaceGenerator,
48
+ Wireframe,
49
+ } from './components';
33
50
  import meta, { DEBUG_PLUGIN } from './meta';
34
51
  import translations from './translations';
35
52
  import {
@@ -157,7 +174,7 @@ export const DebugPlugin = definePlugin<DebugPluginProvides>((context) => {
157
174
  {
158
175
  id: `${space.id}-debug`, // TODO(burdon): Change to slashes consistently.
159
176
  type: 'dxos.org/plugin/debug/space',
160
- data: { space },
177
+ data: { space, type: 'dxos.org/plugin/debug/space' },
161
178
  properties: {
162
179
  label: ['debug label', { ns: DEBUG_PLUGIN }],
163
180
  icon: 'ph--bug--regular',
@@ -181,7 +198,13 @@ export const DebugPlugin = definePlugin<DebugPluginProvides>((context) => {
181
198
 
182
199
  const [subjectId] = id.split('~');
183
200
  const { spaceId, objectId } = parseId(subjectId);
184
- const space = client.spaces.get().find((space) => space.id === spaceId);
201
+ const spaces = toSignal(
202
+ (onChange) => client.spaces.subscribe(() => onChange()).unsubscribe,
203
+ () => client.spaces.get(),
204
+ );
205
+ const space = spaces?.find(
206
+ (space) => space.state.get() === SpaceState.SPACE_READY && space.id === spaceId,
207
+ );
185
208
  if (!objectId) {
186
209
  // TODO(burdon): Ref SPACE_PLUGIN ns.
187
210
  const label = space
@@ -204,18 +227,7 @@ export const DebugPlugin = definePlugin<DebugPluginProvides>((context) => {
204
227
  };
205
228
  }
206
229
 
207
- const object = toSignal(
208
- (onChange) => {
209
- const timeout = setTimeout(async () => {
210
- await space?.db.query({ id: objectId }).first();
211
- onChange();
212
- });
213
-
214
- return () => clearTimeout(timeout);
215
- },
216
- () => space?.db.getObjectById(objectId),
217
- subjectId,
218
- );
230
+ const [object] = memoizeQuery(space, { id: objectId });
219
231
  if (!object || !subjectId) {
220
232
  return;
221
233
  }
@@ -283,30 +295,37 @@ export const DebugPlugin = definePlugin<DebugPluginProvides>((context) => {
283
295
  component = <Devtools />;
284
296
  } else if (!primary || typeof primary !== 'object' || !settings.debug) {
285
297
  component = null;
286
- } else if ('space' in primary && isSpace(primary.space)) {
287
- component = (
288
- <DebugSpace
289
- space={primary.space}
290
- onAddObjects={(objects) => {
291
- if (!isSpace(primary.space)) {
292
- return;
293
- }
298
+ } else if (
299
+ 'type' in primary &&
300
+ primary.type === 'dxos.org/plugin/debug/space' &&
301
+ 'space' in primary &&
302
+ isSpace(primary.space)
303
+ ) {
304
+ const handleCreateObject = (objects: ReactiveObject<any>[]) => {
305
+ if (!isSpace(primary.space)) {
306
+ return;
307
+ }
308
+
309
+ const collection =
310
+ primary.space.state.get() === SpaceState.SPACE_READY &&
311
+ primary.space.properties[CollectionType.typename];
312
+ if (!(collection instanceof CollectionType)) {
313
+ return;
314
+ }
294
315
 
295
- const collection =
296
- primary.space.state.get() === SpaceState.SPACE_READY &&
297
- primary.space.properties[CollectionType.typename];
298
- if (!(collection instanceof CollectionType)) {
299
- return;
300
- }
316
+ void context.resolvePlugin(parseIntentPlugin).provides.intent.dispatch(
317
+ objects.map((object) => ({
318
+ action: SpaceAction.ADD_OBJECT,
319
+ data: { target: collection, object },
320
+ })),
321
+ );
322
+ };
301
323
 
302
- void context.resolvePlugin(parseIntentPlugin).provides.intent.dispatch(
303
- objects.map((object) => ({
304
- action: SpaceAction.ADD_OBJECT,
305
- data: { target: collection, object },
306
- })),
307
- );
308
- }}
309
- />
324
+ const deprecated = false;
325
+ component = deprecated ? (
326
+ <DebugSpace space={primary.space} onAddObjects={handleCreateObject} />
327
+ ) : (
328
+ <SpaceGenerator space={primary.space} onCreateObjects={handleCreateObject} />
310
329
  );
311
330
  } else if ('graph' in primary && primary.graph instanceof Graph) {
312
331
  component = <DebugApp graph={primary.graph} />;
@@ -11,9 +11,10 @@ export type DebugObjectPanelProps = {
11
11
  object: ReactiveEchoObject<any>;
12
12
  };
13
13
 
14
+ // TODO(burdon): Get schema and traverse references.
14
15
  export const DebugObjectPanel = ({ object }: DebugObjectPanelProps) => {
15
16
  return (
16
- <div role='form' className='flex flex-col'>
17
+ <div className='flex flex-col'>
17
18
  <SyntaxHighlighter classNames='flex text-xs' language='json'>
18
19
  {JSON.stringify(object, null, 2)}
19
20
  </SyntaxHighlighter>
@@ -5,7 +5,7 @@
5
5
  import React, { type FC, useContext, useMemo, useState } from 'react';
6
6
 
7
7
  import { createSpaceObjectGenerator } from '@dxos/echo-generator';
8
- import { type ReactiveObject } from '@dxos/echo-schema';
8
+ import { type ReactiveObject } from '@dxos/live-object';
9
9
  import { DocumentType } from '@dxos/plugin-markdown/types';
10
10
  import { Invitation } from '@dxos/protocols/proto/dxos/client/services';
11
11
  import { faker } from '@dxos/random';
@@ -149,7 +149,7 @@ export const DebugSpace: FC<{
149
149
  />
150
150
 
151
151
  <IconButton
152
- icon={running ? 'ph--hand-palm--regular' : 'ph--play--regular'}
152
+ icon={running ? 'ph--pause-circle--regular' : 'ph--play-circle--regular'}
153
153
  iconOnly
154
154
  label='Start/stop'
155
155
  size={5}
@@ -92,7 +92,7 @@ export const ObjectCreator = ({ space, onAddObjects }: ObjectCreatorProps) => {
92
92
  <Table.Main<CreateObjectsParams> columns={columns} data={objects} />
93
93
  </Table.Viewport>
94
94
  </Table.Root>
95
- <Toolbar.Root classNames='p-2'>
95
+ <Toolbar.Root classNames='p-1'>
96
96
  <IconButton icon='ph--plus--regular' label='Create' onClick={handleCreate} />
97
97
  </Toolbar.Root>
98
98
  </>
@@ -16,7 +16,7 @@ export type SurfaceDebugProps = ThemedClassName<{}>;
16
16
  * Show surface info.
17
17
  * NOTE: Remove from @dxos/app-framework if removing this.
18
18
  */
19
- export const SurfaceDebug = ({ classNames }: SurfaceDebugProps) => {
19
+ export const DebugSurface = ({ classNames }: SurfaceDebugProps) => {
20
20
  const context = useSurfaceRoot();
21
21
  const [surfaces, setSurfaces] = useState<DebugInfo[]>([]);
22
22
  const renderMap = useMemo(() => new Map<string, { last: number; delta: number }>(), []);
@@ -0,0 +1,178 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import {
6
+ createTLStore,
7
+ defaultBindingUtils,
8
+ defaultShapeUtils,
9
+ defaultShapeTools,
10
+ defaultTools,
11
+ Editor,
12
+ type TLEditorOptions,
13
+ } from '@tldraw/tldraw';
14
+
15
+ import { type AbstractSchema, type BaseObject } from '@dxos/echo-schema';
16
+ import { create, type ReactiveObject } from '@dxos/live-object';
17
+ import { DocumentType, TextType } from '@dxos/plugin-markdown/types';
18
+ import { addressToA1Notation, createSheet } from '@dxos/plugin-sheet';
19
+ import { type CellValue } from '@dxos/plugin-sheet/types';
20
+ import { SheetType } from '@dxos/plugin-sheet/types';
21
+ import { TLDRAW_SCHEMA, CanvasType, DiagramType } from '@dxos/plugin-sketch/types';
22
+ import { faker } from '@dxos/random';
23
+ import { Filter, type Space } from '@dxos/react-client/echo';
24
+ import { TableType } from '@dxos/react-ui-table';
25
+ import { createView } from '@dxos/schema';
26
+ import { createAsyncGenerator, type ValueGenerator } from '@dxos/schema/testing';
27
+ import { range } from '@dxos/util';
28
+
29
+ import { drawGraph, generateGraph } from './draw-util';
30
+
31
+ const generator: ValueGenerator = faker as any;
32
+
33
+ // TODO(burdon): Add objects to collections.
34
+ // TODO(burdon): Create comments.
35
+ // TODO(burdon): Reuse in testbench-app.
36
+ // TODO(burdon): Mutator running in background (factor out): from echo-generator.
37
+
38
+ export type ObjectGenerator<T extends BaseObject> = (
39
+ space: Space,
40
+ n: number,
41
+ cb?: (objects: ReactiveObject<any>[]) => void,
42
+ ) => Promise<ReactiveObject<T>[]>;
43
+
44
+ // TODO(burdon): Factor out and create unit tests. See "fuzz" patterns.
45
+ export const staticGenerators = new Map<string, ObjectGenerator<any>>([
46
+ //
47
+ // DocumentType
48
+ //
49
+ [
50
+ DocumentType.typename,
51
+ async (space, n, cb) => {
52
+ const objects = range(n).map(() => {
53
+ const content = range(faker.number.int({ min: 3, max: 8 }))
54
+ .map(() => faker.lorem.sentences(faker.number.int({ min: 3, max: 16 })))
55
+ .join('\n\n');
56
+
57
+ const obj = space.db.add(
58
+ create(DocumentType, {
59
+ name: faker.commerce.productName(),
60
+ content: create(TextType, { content }),
61
+ threads: [],
62
+ }),
63
+ );
64
+
65
+ return obj;
66
+ });
67
+
68
+ cb?.(objects);
69
+ return objects;
70
+ },
71
+ ],
72
+ //
73
+ // DiagramType
74
+ //
75
+ [
76
+ DiagramType.typename,
77
+ async (space, n, cb) => {
78
+ const options: Pick<TLEditorOptions, 'bindingUtils' | 'shapeUtils' | 'tools' | 'getContainer'> = {
79
+ bindingUtils: defaultBindingUtils,
80
+ shapeUtils: defaultShapeUtils,
81
+ tools: [...defaultTools, ...defaultShapeTools],
82
+ getContainer: () => document.body, // TODO(burdon): Fake via JSDOM?
83
+ };
84
+
85
+ const objects = await Promise.all(
86
+ range(n).map(async () => {
87
+ const store = createTLStore();
88
+ const editor = new Editor({ ...options, store });
89
+ const graph = generateGraph();
90
+ const content = await drawGraph(editor, graph);
91
+ editor.dispose();
92
+ store.dispose();
93
+
94
+ const obj = space.db.add(
95
+ create(DiagramType, {
96
+ name: faker.commerce.productName(),
97
+ canvas: create(CanvasType, { schema: TLDRAW_SCHEMA, content }),
98
+ }),
99
+ );
100
+
101
+ return obj;
102
+ }),
103
+ );
104
+
105
+ cb?.(objects);
106
+ return objects;
107
+ },
108
+ ],
109
+ //
110
+ // SheetType
111
+ //
112
+ [
113
+ SheetType.typename,
114
+ async (space, n, cb) => {
115
+ const objects = range(n).map(() => {
116
+ // TODO(burdon): Reconcile with plugin-sheet/testing
117
+ const year = new Date().getFullYear();
118
+ const cols = 4;
119
+ const rows = 20;
120
+ const cells: Record<string, CellValue> = {};
121
+ for (let col = 1; col <= cols; col++) {
122
+ for (let row = 1; row <= 10; row++) {
123
+ const cell = addressToA1Notation({ col, row });
124
+ if (row === 1) {
125
+ cells[cell] = { value: `${year} Q${col}` };
126
+ } else if (row === rows) {
127
+ const from = addressToA1Notation({ col, row: 2 });
128
+ const to = addressToA1Notation({ col, row: rows - 1 });
129
+ cells[cell] = { value: `=SUM(${from}:${to})` };
130
+ } else if (row > 2 && row < rows - 1) {
131
+ cells[cell] = { value: Math.floor(Math.random() * 10_000) };
132
+ }
133
+ }
134
+ }
135
+
136
+ // TODO(burdon): Set width.
137
+ return space.db.add(
138
+ createSheet({
139
+ name: faker.commerce.productName(),
140
+ cells,
141
+ }),
142
+ );
143
+ });
144
+
145
+ cb?.(objects);
146
+ return objects;
147
+ },
148
+ ],
149
+ ]);
150
+
151
+ export const createGenerator = <T extends BaseObject>(type: AbstractSchema<T>): ObjectGenerator<T> => {
152
+ return async (
153
+ space: Space,
154
+ n: number,
155
+ cb?: (objects: ReactiveObject<any>[]) => void,
156
+ ): Promise<ReactiveObject<T>[]> => {
157
+ // Find or create mutable schema.
158
+ const mutableSchema = await space.db.schemaRegistry.query();
159
+ const schema =
160
+ mutableSchema.find((schema) => schema.typename === type.typename) ?? space.db.schemaRegistry.addSchema(type);
161
+
162
+ // Create objects.
163
+ const generate = createAsyncGenerator(generator, schema.schema, space.db);
164
+ const objects = await generate.createObjects(n);
165
+
166
+ // Find or create table and view.
167
+ const { objects: tables } = await space.db.query(Filter.schema(TableType)).run();
168
+ const table = tables.find((table) => table.view?.query?.typename === type.typename);
169
+ if (!table) {
170
+ const name = type.typename.split('/').pop() ?? type.typename;
171
+ const view = createView({ name, typename: type.typename, jsonSchema: schema.jsonSchema });
172
+ const table = space.db.add(create(TableType, { name, view }));
173
+ cb?.([table]);
174
+ }
175
+
176
+ return objects;
177
+ };
178
+ };