@dxos/plugin-debug 0.8.2-main.fbd8ed0 → 0.8.2-staging.4d6ad0f

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 (30) hide show
  1. package/dist/lib/browser/DebugApp-WSEJPCKY.mjs +225 -0
  2. package/dist/lib/browser/{DebugApp-7PFYN52J.mjs.map → DebugApp-WSEJPCKY.mjs.map} +1 -1
  3. package/dist/lib/browser/DevtoolsOverviewContainer-IIIWO77Q.mjs +25 -0
  4. package/dist/lib/browser/{DevtoolsOverviewContainer-HYNZTH2Z.mjs.map → DevtoolsOverviewContainer-IIIWO77Q.mjs.map} +1 -1
  5. package/dist/lib/browser/{SpaceGenerator-CGRY2M6A.mjs → SpaceGenerator-RHQLPN44.mjs} +216 -205
  6. package/dist/lib/browser/SpaceGenerator-RHQLPN44.mjs.map +7 -0
  7. package/dist/lib/browser/{app-graph-builder-SSTQU7MF.mjs → app-graph-builder-PIPBIN6P.mjs} +3 -3
  8. package/dist/lib/browser/{chunk-RORUXVAC.mjs → chunk-47JOZTT2.mjs} +1 -4
  9. package/dist/lib/browser/{chunk-RORUXVAC.mjs.map → chunk-47JOZTT2.mjs.map} +3 -3
  10. package/dist/lib/browser/chunk-KS3YBEL7.mjs +68 -0
  11. package/dist/lib/browser/{chunk-ZJTKMYOG.mjs.map → chunk-KS3YBEL7.mjs.map} +1 -1
  12. package/dist/lib/browser/index.mjs +5 -5
  13. package/dist/lib/browser/meta.json +1 -1
  14. package/dist/lib/browser/{react-context-ZRLN5KUI.mjs → react-context-ZQRD2WG2.mjs} +2 -2
  15. package/dist/lib/browser/{react-surface-BQSJLXPZ.mjs → react-surface-PHUWS5WD.mjs} +292 -253
  16. package/dist/lib/browser/{react-surface-BQSJLXPZ.mjs.map → react-surface-PHUWS5WD.mjs.map} +1 -1
  17. package/dist/lib/browser/{settings-6SG54GZO.mjs → settings-N4Q6YB7L.mjs} +3 -3
  18. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
  19. package/dist/types/src/meta.d.ts.map +1 -1
  20. package/package.json +54 -55
  21. package/src/components/SpaceGenerator/ObjectGenerator.tsx +0 -1
  22. package/src/components/SpaceGenerator/SpaceGenerator.tsx +5 -5
  23. package/src/meta.ts +0 -1
  24. package/dist/lib/browser/DebugApp-7PFYN52J.mjs +0 -182
  25. package/dist/lib/browser/DevtoolsOverviewContainer-HYNZTH2Z.mjs +0 -19
  26. package/dist/lib/browser/SpaceGenerator-CGRY2M6A.mjs.map +0 -7
  27. package/dist/lib/browser/chunk-ZJTKMYOG.mjs +0 -74
  28. /package/dist/lib/browser/{app-graph-builder-SSTQU7MF.mjs.map → app-graph-builder-PIPBIN6P.mjs.map} +0 -0
  29. /package/dist/lib/browser/{react-context-ZRLN5KUI.mjs.map → react-context-ZQRD2WG2.mjs.map} +0 -0
  30. /package/dist/lib/browser/{settings-6SG54GZO.mjs.map → settings-N4Q6YB7L.mjs.map} +0 -0
@@ -1,8 +1,9 @@
1
1
  // packages/plugins/plugin-debug/src/components/SpaceGenerator/SpaceGenerator.tsx
2
+ import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
2
3
  import React2, { useCallback, useMemo, useState } from "react";
3
4
  import { createIntent, useIntentDispatcher } from "@dxos/app-framework";
4
5
  import { ComputeGraph as ComputeGraph2 } from "@dxos/conductor";
5
- import { toEffectSchema } from "@dxos/echo-schema";
6
+ import { Filter as Filter3, toEffectSchema } from "@dxos/echo-schema";
6
7
  import { live as live3 } from "@dxos/live-object";
7
8
  import { log } from "@dxos/log";
8
9
  import { DocumentType as DocumentType2 } from "@dxos/plugin-markdown/types";
@@ -14,7 +15,7 @@ import { getTypename } from "@dxos/react-client/echo";
14
15
  import { IconButton as IconButton2, Input, Toolbar, useAsyncEffect } from "@dxos/react-ui";
15
16
  import { SyntaxHighlighter } from "@dxos/react-ui-syntax-highlighter";
16
17
  import { initializeTable, TableType as TableType3 } from "@dxos/react-ui-table";
17
- import { Testing } from "@dxos/schema/testing";
18
+ import { DataType as DataType2 } from "@dxos/schema";
18
19
  import { jsonKeyReplacer, sortKeys } from "@dxos/util";
19
20
 
20
21
  // packages/plugins/plugin-debug/src/components/SpaceGenerator/ObjectGenerator.tsx
@@ -43,8 +44,7 @@ var staticGenerators = /* @__PURE__ */ new Map([
43
44
  name: faker.commerce.productName(),
44
45
  content: makeRef(live(DataType.Text, {
45
46
  content: faker.lorem.sentences(5)
46
- })),
47
- threads: []
47
+ }))
48
48
  }));
49
49
  });
50
50
  cb?.(objects);
@@ -210,31 +210,37 @@ var createGenerator = (type) => {
210
210
  };
211
211
 
212
212
  // packages/plugins/plugin-debug/src/components/SpaceGenerator/SchemaTable.tsx
213
+ import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
213
214
  import React from "react";
214
215
  import { IconButton } from "@dxos/react-ui";
215
216
  var SchemaTable = ({ types, objects = {}, label, onClick }) => {
216
- return /* @__PURE__ */ React.createElement("div", {
217
- className: "grid grid-cols-[1fr_80px_40px] gap-1 overflow-none"
218
- }, /* @__PURE__ */ React.createElement("div", {
219
- className: "grid grid-cols-subgrid col-span-3"
220
- }, /* @__PURE__ */ React.createElement("div", {
221
- className: "px-2 text-sm text-primary-500"
222
- }, label), /* @__PURE__ */ React.createElement("div", {
223
- className: "px-2 text-xs text-subdued text-right"
224
- }, "count")), types.map((type) => /* @__PURE__ */ React.createElement("div", {
225
- key: type.typename,
226
- className: "grid grid-cols-subgrid col-span-3 items-center"
227
- }, /* @__PURE__ */ React.createElement("div", {
228
- className: "px-2 text-sm font-mono text-green-500"
229
- }, type.typename), /* @__PURE__ */ React.createElement("div", {
230
- className: "px-2 text-right font-mono"
231
- }, objects[type.typename] ?? 0), /* @__PURE__ */ React.createElement(IconButton, {
232
- variant: "ghost",
233
- icon: "ph--plus--regular",
234
- iconOnly: true,
235
- label: "Create data",
236
- onClick: () => onClick(type.typename)
237
- }))));
217
+ var _effect = _useSignals();
218
+ try {
219
+ return /* @__PURE__ */ React.createElement("div", {
220
+ className: "grid grid-cols-[1fr_80px_40px] gap-1 overflow-none"
221
+ }, /* @__PURE__ */ React.createElement("div", {
222
+ className: "grid grid-cols-subgrid col-span-3"
223
+ }, /* @__PURE__ */ React.createElement("div", {
224
+ className: "px-2 text-sm text-primary-500"
225
+ }, label), /* @__PURE__ */ React.createElement("div", {
226
+ className: "px-2 text-xs text-subdued text-right"
227
+ }, "count")), types.map((type) => /* @__PURE__ */ React.createElement("div", {
228
+ key: type.typename,
229
+ className: "grid grid-cols-subgrid col-span-3 items-center"
230
+ }, /* @__PURE__ */ React.createElement("div", {
231
+ className: "px-2 text-sm font-mono text-green-500"
232
+ }, type.typename), /* @__PURE__ */ React.createElement("div", {
233
+ className: "px-2 text-right font-mono"
234
+ }, objects[type.typename] ?? 0), /* @__PURE__ */ React.createElement(IconButton, {
235
+ variant: "ghost",
236
+ icon: "ph--plus--regular",
237
+ iconOnly: true,
238
+ label: "Create data",
239
+ onClick: () => onClick(type.typename)
240
+ }))));
241
+ } finally {
242
+ _effect.f();
243
+ }
238
244
  };
239
245
 
240
246
  // packages/plugins/plugin-debug/src/components/SpaceGenerator/presets.ts
@@ -252,8 +258,7 @@ import { CanvasBoardType, CanvasGraphModel, pointMultiply, pointsToRect, rectToP
252
258
  import { TableType as TableType2 } from "@dxos/react-ui-table";
253
259
  import { range as range2 } from "@dxos/util";
254
260
  var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-debug/src/components/SpaceGenerator/presets.ts";
255
- var PresetName;
256
- (function(PresetName2) {
261
+ var PresetName = /* @__PURE__ */ function(PresetName2) {
257
262
  PresetName2["EMAIL_TABLE"] = "email-table";
258
263
  PresetName2["GPT_QUEUE"] = "webhook-gpt-queue";
259
264
  PresetName2["CHAT_GPT"] = "chat-gpt-text";
@@ -263,7 +268,8 @@ var PresetName;
263
268
  PresetName2["TIMER_TICK_QUEUE"] = "timerTick-queue";
264
269
  PresetName2["DISCORD_MESSAGES"] = "discord-messages";
265
270
  PresetName2["KANBAN_QUEUE"] = "kanban-queue";
266
- })(PresetName || (PresetName = {}));
271
+ return PresetName2;
272
+ }({});
267
273
  var presets = {
268
274
  schemas: [
269
275
  CanvasBoardType,
@@ -1050,185 +1056,190 @@ var position = (rect) => {
1050
1056
  // packages/plugins/plugin-debug/src/components/SpaceGenerator/SpaceGenerator.tsx
1051
1057
  var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-debug/src/components/SpaceGenerator/SpaceGenerator.tsx";
1052
1058
  var SpaceGenerator = ({ space, onCreateObjects }) => {
1053
- const { dispatchPromise: dispatch } = useIntentDispatcher();
1054
- const client = useClient();
1055
- const staticTypes = [
1056
- DocumentType2,
1057
- DiagramType2,
1058
- SheetType2,
1059
- ComputeGraph2
1060
- ];
1061
- const mutableTypes = [
1062
- Testing.Organization,
1063
- Testing.Project,
1064
- Testing.Contact,
1065
- Testing.Message
1066
- ];
1067
- const [count, setCount] = useState(1);
1068
- const [info, setInfo] = useState({});
1069
- const typeMap = useMemo(() => {
1070
- client.addTypes([
1071
- ...staticTypes,
1072
- ...presets.schemas
1059
+ var _effect = _useSignals2();
1060
+ try {
1061
+ const { dispatchPromise: dispatch } = useIntentDispatcher();
1062
+ const client = useClient();
1063
+ const staticTypes = [
1064
+ DocumentType2,
1065
+ DiagramType2,
1066
+ SheetType2,
1067
+ ComputeGraph2
1068
+ ];
1069
+ const mutableTypes = [
1070
+ DataType2.Organization,
1071
+ DataType2.Project,
1072
+ DataType2.Person,
1073
+ DataType2.Message
1074
+ ];
1075
+ const [count, setCount] = useState(1);
1076
+ const [info, setInfo] = useState({});
1077
+ const typeMap = useMemo(() => {
1078
+ client.addTypes([
1079
+ ...staticTypes,
1080
+ ...presets.schemas
1081
+ ]);
1082
+ const mutableGenerators = new Map(mutableTypes.map((type) => [
1083
+ type.typename,
1084
+ createGenerator(type)
1085
+ ]));
1086
+ return new Map([
1087
+ ...staticGenerators,
1088
+ ...presets.items,
1089
+ ...mutableGenerators
1090
+ ]);
1091
+ }, [
1092
+ client,
1093
+ mutableTypes
1073
1094
  ]);
1074
- const mutableGenerators = new Map(mutableTypes.map((type) => [
1075
- type.typename,
1076
- createGenerator(type)
1077
- ]));
1078
- return new Map([
1079
- ...staticGenerators,
1080
- ...presets.items,
1081
- ...mutableGenerators
1095
+ const updateInfo = async () => {
1096
+ const echoSchema = await space.db.schemaRegistry.query().run();
1097
+ const staticSchema = space.db.graph.schemaRegistry.schemas;
1098
+ const { objects } = await space.db.query(Filter3.everything()).run();
1099
+ const objectMap = sortKeys(objects.reduce((map, obj) => {
1100
+ const type = getTypename(obj);
1101
+ if (type) {
1102
+ const count2 = map[type] ?? 0;
1103
+ map[type] = count2 + 1;
1104
+ }
1105
+ return map;
1106
+ }, {}));
1107
+ setInfo({
1108
+ schema: {
1109
+ static: staticSchema.length,
1110
+ mutable: echoSchema.length
1111
+ },
1112
+ objects: objectMap
1113
+ });
1114
+ };
1115
+ useAsyncEffect(updateInfo, [
1116
+ space
1082
1117
  ]);
1083
- }, [
1084
- client,
1085
- mutableTypes
1086
- ]);
1087
- const updateInfo = async () => {
1088
- const echoSchema = await space.db.schemaRegistry.query().run();
1089
- const staticSchema = space.db.graph.schemaRegistry.schemas;
1090
- const { objects } = await space.db.query().run();
1091
- const objectMap = sortKeys(objects.reduce((map, obj) => {
1092
- const type = getTypename(obj);
1093
- if (type) {
1094
- const count2 = map[type] ?? 0;
1095
- map[type] = count2 + 1;
1096
- }
1097
- return map;
1098
- }, {}));
1099
- setInfo({
1100
- schema: {
1101
- static: staticSchema.length,
1102
- mutable: echoSchema.length
1103
- },
1104
- objects: objectMap
1105
- });
1106
- };
1107
- useAsyncEffect(updateInfo, [
1108
- space
1109
- ]);
1110
- const handleCreateData = useCallback(async (typename) => {
1111
- const constructor = typeMap.get(typename);
1112
- if (constructor) {
1113
- await constructor(space, count, onCreateObjects);
1114
- await updateInfo();
1115
- }
1116
- }, [
1117
- typeMap,
1118
- count
1119
- ]);
1120
- const handleLoadTables = useCallback(async () => {
1121
- const input = document.createElement("input");
1122
- input.type = "file";
1123
- input.accept = ".json";
1124
- input.onchange = async (e) => {
1125
- const file = e.target.files?.[0];
1126
- if (!file) {
1127
- return;
1118
+ const handleCreateData = useCallback(async (typename) => {
1119
+ const constructor = typeMap.get(typename);
1120
+ if (constructor) {
1121
+ await constructor(space, count, onCreateObjects);
1122
+ await updateInfo();
1128
1123
  }
1129
- try {
1130
- const content = await file.text();
1131
- const data = JSON.parse(content);
1132
- const schemas = await space.db.schemaRegistry.register(data.schemas.map(toEffectSchema));
1133
- await Promise.all(schemas.map(async (schema) => {
1134
- const parts = schema.typename.split("/");
1135
- const name = parts[parts.length - 1];
1136
- const table = live3(TableType3, {
1137
- name,
1138
- threads: []
1139
- });
1140
- await initializeTable({
1141
- client,
1142
- space,
1143
- table,
1144
- typename: schema.typename
1145
- });
1146
- await dispatch(createIntent(SpaceAction.AddObject, {
1147
- target: space,
1148
- object: table
1149
- }));
1150
- return table;
1151
- }));
1152
- await Promise.all(data.objects.map(async ({ id, "@type": typename, ...fields }) => {
1153
- const schema = schemas.find((s) => `dxn:type:${s.typename}:${s.version}` === typename);
1154
- if (!schema) {
1155
- log.warn("Missing schema for object", {
1156
- id,
1157
- typename
1158
- }, {
1159
- F: __dxlog_file2,
1160
- L: 125,
1161
- S: void 0,
1162
- C: (f, a) => f(...a)
1124
+ }, [
1125
+ typeMap,
1126
+ count
1127
+ ]);
1128
+ const handleLoadTables = useCallback(async () => {
1129
+ const input = document.createElement("input");
1130
+ input.type = "file";
1131
+ input.accept = ".json";
1132
+ input.onchange = async (e) => {
1133
+ const file = e.target.files?.[0];
1134
+ if (!file) {
1135
+ return;
1136
+ }
1137
+ try {
1138
+ const content = await file.text();
1139
+ const data = JSON.parse(content);
1140
+ const schemas = await space.db.schemaRegistry.register(data.schemas.map(toEffectSchema));
1141
+ await Promise.all(schemas.map(async (schema) => {
1142
+ const parts = schema.typename.split("/");
1143
+ const name = parts[parts.length - 1];
1144
+ const table = live3(TableType3, {
1145
+ name,
1146
+ threads: []
1163
1147
  });
1164
- return;
1165
- }
1166
- const object = live3(schema, fields);
1167
- space.db.add(object);
1168
- return object;
1169
- }));
1170
- } catch (err) {
1171
- log.catch(err, void 0, {
1172
- F: __dxlog_file2,
1173
- L: 134,
1174
- S: void 0,
1175
- C: (f, a) => f(...a)
1176
- });
1177
- }
1178
- };
1179
- input.click();
1180
- }, []);
1181
- return /* @__PURE__ */ React2.createElement("div", {
1182
- role: "none",
1183
- className: "flex flex-col divide-y divide-separator overflow-y-auto"
1184
- }, /* @__PURE__ */ React2.createElement(Toolbar.Root, {
1185
- classNames: "p-1"
1186
- }, /* @__PURE__ */ React2.createElement(IconButton2, {
1187
- icon: "ph--arrow-clockwise--regular",
1188
- iconOnly: true,
1189
- label: "Refresh",
1190
- onClick: updateInfo
1191
- }), /* @__PURE__ */ React2.createElement(IconButton2, {
1192
- icon: "ph--file-arrow-up--regular",
1193
- iconOnly: true,
1194
- label: "Load tables from JSON",
1195
- onClick: handleLoadTables
1196
- }), /* @__PURE__ */ React2.createElement(Toolbar.Separator, {
1197
- variant: "gap"
1198
- }), /* @__PURE__ */ React2.createElement("div", {
1199
- className: "flex"
1200
- }, /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement(Input.TextInput, {
1201
- type: "number",
1202
- min: 1,
1203
- max: 100,
1204
- placeholder: "Count",
1205
- classNames: "w-[80px]",
1206
- value: count,
1207
- onChange: (ev) => setCount(parseInt(ev.target.value))
1208
- })))), /* @__PURE__ */ React2.createElement(SchemaTable, {
1209
- types: staticTypes,
1210
- objects: info.objects,
1211
- label: "Static Types",
1212
- onClick: handleCreateData
1213
- }), /* @__PURE__ */ React2.createElement(SchemaTable, {
1214
- types: mutableTypes,
1215
- objects: info.objects,
1216
- label: "Mutable Types",
1217
- onClick: handleCreateData
1218
- }), /* @__PURE__ */ React2.createElement(SchemaTable, {
1219
- types: presets.types,
1220
- objects: info.objects,
1221
- label: "Presets",
1222
- onClick: handleCreateData
1223
- }), /* @__PURE__ */ React2.createElement(SyntaxHighlighter, {
1224
- classNames: "flex text-xs",
1225
- language: "json"
1226
- }, JSON.stringify({
1227
- space,
1228
- ...info
1229
- }, jsonKeyReplacer({
1230
- truncate: true
1231
- }), 2)));
1148
+ await initializeTable({
1149
+ client,
1150
+ space,
1151
+ table,
1152
+ typename: schema.typename
1153
+ });
1154
+ await dispatch(createIntent(SpaceAction.AddObject, {
1155
+ target: space,
1156
+ object: table
1157
+ }));
1158
+ return table;
1159
+ }));
1160
+ await Promise.all(data.objects.map(async ({ id, "@type": typename, ...fields }) => {
1161
+ const schema = schemas.find((s) => `dxn:type:${s.typename}:${s.version}` === typename);
1162
+ if (!schema) {
1163
+ log.warn("Missing schema for object", {
1164
+ id,
1165
+ typename
1166
+ }, {
1167
+ F: __dxlog_file2,
1168
+ L: 125,
1169
+ S: void 0,
1170
+ C: (f, a) => f(...a)
1171
+ });
1172
+ return;
1173
+ }
1174
+ const object = live3(schema, fields);
1175
+ space.db.add(object);
1176
+ return object;
1177
+ }));
1178
+ } catch (err) {
1179
+ log.catch(err, void 0, {
1180
+ F: __dxlog_file2,
1181
+ L: 134,
1182
+ S: void 0,
1183
+ C: (f, a) => f(...a)
1184
+ });
1185
+ }
1186
+ };
1187
+ input.click();
1188
+ }, []);
1189
+ return /* @__PURE__ */ React2.createElement("div", {
1190
+ role: "none",
1191
+ className: "flex flex-col divide-y divide-separator overflow-y-auto"
1192
+ }, /* @__PURE__ */ React2.createElement(Toolbar.Root, {
1193
+ classNames: "p-1"
1194
+ }, /* @__PURE__ */ React2.createElement(IconButton2, {
1195
+ icon: "ph--arrow-clockwise--regular",
1196
+ iconOnly: true,
1197
+ label: "Refresh",
1198
+ onClick: updateInfo
1199
+ }), /* @__PURE__ */ React2.createElement(IconButton2, {
1200
+ icon: "ph--file-arrow-up--regular",
1201
+ iconOnly: true,
1202
+ label: "Load tables from JSON",
1203
+ onClick: handleLoadTables
1204
+ }), /* @__PURE__ */ React2.createElement(Toolbar.Separator, {
1205
+ variant: "gap"
1206
+ }), /* @__PURE__ */ React2.createElement("div", {
1207
+ className: "flex"
1208
+ }, /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement(Input.TextInput, {
1209
+ type: "number",
1210
+ min: 1,
1211
+ max: 100,
1212
+ placeholder: "Count",
1213
+ classNames: "w-[80px]",
1214
+ value: count,
1215
+ onChange: (ev) => setCount(parseInt(ev.target.value))
1216
+ })))), /* @__PURE__ */ React2.createElement(SchemaTable, {
1217
+ types: staticTypes,
1218
+ objects: info.objects,
1219
+ label: "Static Types",
1220
+ onClick: handleCreateData
1221
+ }), /* @__PURE__ */ React2.createElement(SchemaTable, {
1222
+ types: mutableTypes,
1223
+ objects: info.objects,
1224
+ label: "Mutable Types",
1225
+ onClick: handleCreateData
1226
+ }), /* @__PURE__ */ React2.createElement(SchemaTable, {
1227
+ types: presets.types,
1228
+ objects: info.objects,
1229
+ label: "Presets",
1230
+ onClick: handleCreateData
1231
+ }), /* @__PURE__ */ React2.createElement(SyntaxHighlighter, {
1232
+ classNames: "flex text-xs",
1233
+ language: "json"
1234
+ }, JSON.stringify({
1235
+ space,
1236
+ ...info
1237
+ }, jsonKeyReplacer({
1238
+ truncate: true
1239
+ }), 2)));
1240
+ } finally {
1241
+ _effect.f();
1242
+ }
1232
1243
  };
1233
1244
 
1234
1245
  // packages/plugins/plugin-debug/src/components/SpaceGenerator/index.ts
@@ -1236,4 +1247,4 @@ var SpaceGenerator_default = SpaceGenerator;
1236
1247
  export {
1237
1248
  SpaceGenerator_default as default
1238
1249
  };
1239
- //# sourceMappingURL=SpaceGenerator-CGRY2M6A.mjs.map
1250
+ //# sourceMappingURL=SpaceGenerator-RHQLPN44.mjs.map