@dxos/plugin-debug 0.7.1-staging.8709ba7 → 0.7.2-staging.6d26b2a

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 (65) hide show
  1. package/dist/lib/browser/{DebugGlobal-ZTCBF3XR.mjs → DebugApp-HCHR6GKO.mjs} +18 -16
  2. package/dist/lib/browser/DebugApp-HCHR6GKO.mjs.map +7 -0
  3. package/dist/lib/browser/DebugSpace-ZLGGNDAR.mjs +276 -0
  4. package/dist/lib/browser/DebugSpace-ZLGGNDAR.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-GSJS3HEM.mjs +15 -0
  6. package/dist/lib/browser/chunk-GSJS3HEM.mjs.map +7 -0
  7. package/dist/lib/browser/index.mjs +8 -11
  8. package/dist/lib/browser/index.mjs.map +3 -3
  9. package/dist/lib/browser/meta.json +1 -1
  10. package/dist/types/src/DebugPlugin.d.ts.map +1 -1
  11. package/dist/types/src/components/Container.d.ts +5 -0
  12. package/dist/types/src/components/Container.d.ts.map +1 -0
  13. package/dist/types/src/components/{DebugGlobal.d.ts → DebugApp/DebugApp.d.ts} +2 -3
  14. package/dist/types/src/components/DebugApp/DebugApp.d.ts.map +1 -0
  15. package/dist/types/src/components/DebugApp/Tree.d.ts.map +1 -0
  16. package/dist/types/src/components/DebugApp/index.d.ts +3 -0
  17. package/dist/types/src/components/DebugApp/index.d.ts.map +1 -0
  18. package/dist/types/src/components/DebugObjectPanel.d.ts +2 -2
  19. package/dist/types/src/components/{DebugSpace.d.ts → DebugSpace/DebugSpace.d.ts} +1 -2
  20. package/dist/types/src/components/DebugSpace/DebugSpace.d.ts.map +1 -0
  21. package/dist/types/src/components/{DebugSpace.stories.d.ts → DebugSpace/DebugSpace.stories.d.ts} +1 -1
  22. package/dist/types/src/components/DebugSpace/DebugSpace.stories.d.ts.map +1 -0
  23. package/dist/types/src/components/{ObjectCreator.d.ts → DebugSpace/ObjectCreator.d.ts} +4 -6
  24. package/dist/types/src/components/DebugSpace/ObjectCreator.d.ts.map +1 -0
  25. package/dist/types/src/components/{ObjectCreator.stories.d.ts → DebugSpace/ObjectCreator.stories.d.ts} +1 -1
  26. package/dist/types/src/components/DebugSpace/ObjectCreator.stories.d.ts.map +1 -0
  27. package/dist/types/src/components/DebugSpace/index.d.ts +3 -0
  28. package/dist/types/src/components/DebugSpace/index.d.ts.map +1 -0
  29. package/dist/types/src/components/index.d.ts +1 -1
  30. package/dist/types/src/components/index.d.ts.map +1 -1
  31. package/package.json +38 -38
  32. package/src/DebugPlugin.tsx +5 -11
  33. package/src/components/Container.tsx +15 -0
  34. package/src/components/{DebugGlobal.tsx → DebugApp/DebugApp.tsx} +9 -11
  35. package/src/components/{Tree.tsx → DebugApp/Tree.tsx} +1 -1
  36. package/src/components/DebugApp/index.ts +7 -0
  37. package/src/components/DebugObjectPanel.tsx +2 -2
  38. package/src/components/{DebugSpace.stories.tsx → DebugSpace/DebugSpace.stories.tsx} +8 -6
  39. package/src/components/{DebugSpace.tsx → DebugSpace/DebugSpace.tsx} +70 -82
  40. package/src/components/{ObjectCreator.stories.tsx → DebugSpace/ObjectCreator.stories.tsx} +14 -11
  41. package/src/components/DebugSpace/ObjectCreator.tsx +100 -0
  42. package/src/components/DebugSpace/index.ts +7 -0
  43. package/src/components/index.ts +1 -1
  44. package/dist/lib/browser/DebugGlobal-ZTCBF3XR.mjs.map +0 -7
  45. package/dist/lib/browser/DebugSpace-6TGT3H4I.mjs +0 -411
  46. package/dist/lib/browser/DebugSpace-6TGT3H4I.mjs.map +0 -7
  47. package/dist/lib/browser/chunk-H3BJHVRD.mjs +0 -24
  48. package/dist/lib/browser/chunk-H3BJHVRD.mjs.map +0 -7
  49. package/dist/types/src/components/DebugGlobal.d.ts.map +0 -1
  50. package/dist/types/src/components/DebugPanel.d.ts +0 -5
  51. package/dist/types/src/components/DebugPanel.d.ts.map +0 -1
  52. package/dist/types/src/components/DebugSpace.d.ts.map +0 -1
  53. package/dist/types/src/components/DebugSpace.stories.d.ts.map +0 -1
  54. package/dist/types/src/components/ObjectCreator.d.ts.map +0 -1
  55. package/dist/types/src/components/ObjectCreator.stories.d.ts.map +0 -1
  56. package/dist/types/src/components/Tree.d.ts.map +0 -1
  57. package/dist/types/src/scaffolding/generator.d.ts +0 -11
  58. package/dist/types/src/scaffolding/generator.d.ts.map +0 -1
  59. package/dist/types/src/scaffolding/index.d.ts +0 -2
  60. package/dist/types/src/scaffolding/index.d.ts.map +0 -1
  61. package/src/components/DebugPanel.tsx +0 -29
  62. package/src/components/ObjectCreator.tsx +0 -99
  63. package/src/scaffolding/generator.ts +0 -146
  64. package/src/scaffolding/index.ts +0 -5
  65. /package/dist/types/src/components/{Tree.d.ts → DebugApp/Tree.d.ts} +0 -0
@@ -1,15 +1,15 @@
1
1
  import {
2
- DebugPanel
3
- } from "./chunk-H3BJHVRD.mjs";
2
+ Container
3
+ } from "./chunk-GSJS3HEM.mjs";
4
4
 
5
- // packages/plugins/plugin-debug/src/components/DebugGlobal.tsx
5
+ // packages/plugins/plugin-debug/src/components/DebugApp/DebugApp.tsx
6
6
  import { Gauge, Graph as GraphIcon, Gear, Toolbox, Warning } from "@phosphor-icons/react";
7
7
  import React2, { useEffect, useState as useState2 } from "react";
8
8
  import { useClient, useConfig } from "@dxos/react-client";
9
- import { Button, ToggleGroup, ToggleGroupItem } from "@dxos/react-ui";
9
+ import { Button, ToggleGroup, ToggleGroupItem, Toolbar } from "@dxos/react-ui";
10
10
  import { getSize, mx as mx2 } from "@dxos/react-ui-theme";
11
11
 
12
- // packages/plugins/plugin-debug/src/components/Tree.tsx
12
+ // packages/plugins/plugin-debug/src/components/DebugApp/Tree.tsx
13
13
  import React, { useState } from "react";
14
14
  import { SyntaxHighlighter } from "@dxos/react-ui-syntax-highlighter";
15
15
  import { mx } from "@dxos/react-ui-theme";
@@ -35,7 +35,7 @@ var Json = ({ data }) => {
35
35
  };
36
36
  var Tree = ({ data }) => {
37
37
  return /* @__PURE__ */ React.createElement("div", {
38
- className: "flex overflow-auto ml-2 border-l-2 border-blue-500"
38
+ className: "p-2"
39
39
  }, /* @__PURE__ */ React.createElement(Node, {
40
40
  data,
41
41
  root: true
@@ -92,8 +92,8 @@ var Box = ({ children, className, ...props }) => {
92
92
  }, children);
93
93
  };
94
94
 
95
- // packages/plugins/plugin-debug/src/components/DebugGlobal.tsx
96
- var DebugGlobal = ({ graph }) => {
95
+ // packages/plugins/plugin-debug/src/components/DebugApp/DebugApp.tsx
96
+ var DebugApp = ({ graph }) => {
97
97
  const [view, setView] = useState2("graph");
98
98
  const [data, setData] = useState2({});
99
99
  const client = useClient();
@@ -120,8 +120,10 @@ var DebugGlobal = ({ graph }) => {
120
120
  window.open(`https://devtools.dev.dxos.org/?target=${vaultUrl}`);
121
121
  }
122
122
  };
123
- return /* @__PURE__ */ React2.createElement(DebugPanel, {
124
- menu: /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(ToggleGroup, {
123
+ return /* @__PURE__ */ React2.createElement(Container, {
124
+ toolbar: /* @__PURE__ */ React2.createElement(Toolbar.Root, {
125
+ classNames: "p-1"
126
+ }, /* @__PURE__ */ React2.createElement(ToggleGroup, {
125
127
  type: "single",
126
128
  value: view
127
129
  }, /* @__PURE__ */ React2.createElement(ToggleGroupItem, {
@@ -142,9 +144,7 @@ var DebugGlobal = ({ graph }) => {
142
144
  title: "Config"
143
145
  }, /* @__PURE__ */ React2.createElement(Gear, {
144
146
  className: getSize(5)
145
- }))), /* @__PURE__ */ React2.createElement("div", {
146
- className: "grow"
147
- }), /* @__PURE__ */ React2.createElement(Button, {
147
+ }))), /* @__PURE__ */ React2.createElement(Toolbar.Expander, null), /* @__PURE__ */ React2.createElement(Button, {
148
148
  onClick: (event) => handleResetClient(event.shiftKey),
149
149
  title: "Reset client"
150
150
  }, /* @__PURE__ */ React2.createElement(Warning, {
@@ -164,8 +164,10 @@ var DebugGlobal = ({ graph }) => {
164
164
  data
165
165
  }));
166
166
  };
167
- var DebugGlobal_default = DebugGlobal;
167
+
168
+ // packages/plugins/plugin-debug/src/components/DebugApp/index.ts
169
+ var DebugApp_default = DebugApp;
168
170
  export {
169
- DebugGlobal_default as default
171
+ DebugApp_default as default
170
172
  };
171
- //# sourceMappingURL=DebugGlobal-ZTCBF3XR.mjs.map
173
+ //# sourceMappingURL=DebugApp-HCHR6GKO.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/DebugApp/DebugApp.tsx", "../../../src/components/DebugApp/Tree.tsx", "../../../src/components/DebugApp/index.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Gauge, Graph as GraphIcon, Gear, Toolbox, Warning } from '@phosphor-icons/react';\nimport React, { type FC, useEffect, useState } from 'react';\n\nimport { type Graph } from '@dxos/plugin-graph';\nimport { useClient, useConfig } from '@dxos/react-client';\nimport { Button, ToggleGroup, ToggleGroupItem, Toolbar } from '@dxos/react-ui';\nimport { getSize, mx } from '@dxos/react-ui-theme';\n\nimport { Json, Tree } from './Tree';\nimport { Container } from '../Container';\n\nexport const DebugApp: FC<{ graph: Graph }> = ({ graph }) => {\n const [view, setView] = useState<'config' | 'diagnostics' | 'graph'>('graph');\n const [data, setData] = useState<any>({});\n const client = useClient();\n const config = useConfig();\n const handleRefresh = async () => {\n const data = await client.diagnostics({ truncate: true });\n setData(data);\n };\n useEffect(() => {\n void handleRefresh();\n }, []);\n\n const handleResetClient = async (force = false) => {\n if (!force && !window.confirm('Reset storage?')) {\n return;\n }\n\n // TODO(burdon): Throws exception.\n await client.reset();\n window.location.href = window.location.origin;\n };\n\n const handleOpenDevtools = () => {\n const vaultUrl = config.values?.runtime?.client?.remoteSource;\n if (vaultUrl) {\n window.open(`https://devtools.dev.dxos.org/?target=${vaultUrl}`);\n }\n };\n\n return (\n <Container\n toolbar={\n <Toolbar.Root classNames='p-1'>\n <ToggleGroup type='single' value={view}>\n <ToggleGroupItem value={'graph'} onClick={() => setView('graph')} title={'Plugin graph'}>\n <GraphIcon className={getSize(5)} />\n </ToggleGroupItem>\n <ToggleGroupItem value={'diagnostics'} onClick={() => setView('diagnostics')} title={'Diagnostics'}>\n <Gauge className={getSize(5)} />\n </ToggleGroupItem>\n <ToggleGroupItem value={'config'} onClick={() => setView('config')} title={'Config'}>\n <Gear className={getSize(5)} />\n </ToggleGroupItem>\n </ToggleGroup>\n\n <Toolbar.Expander />\n <Button onClick={(event) => handleResetClient(event.shiftKey)} title='Reset client'>\n <Warning className={mx(getSize(5), 'text-red-700')} />\n </Button>\n <Button onClick={handleOpenDevtools} title='Open Devtools'>\n <Toolbox weight='duotone' className={mx(getSize(5), 'text-700')} />\n </Button>\n </Toolbar.Root>\n }\n >\n {view === 'graph' && <Tree data={graph.toJSON()} />}\n {view === 'config' && <Json data={data.diagnostics?.config} />}\n {view === 'diagnostics' && <Json data={data} />}\n </Container>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { type FC, type HTMLAttributes, useState } from 'react';\n\nimport { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';\nimport { mx } from '@dxos/react-ui-theme';\nimport { arrayToBuffer } from '@dxos/util';\n\n// TODO(burdon): Copied form devtools.\n\nexport const replacer = (key: any, value: any) => {\n if (typeof value === 'object') {\n if (value instanceof Uint8Array) {\n return arrayToBuffer(value).toString('hex');\n }\n\n if (value?.type === 'Buffer') {\n return Buffer.from(value.data).toString('hex');\n }\n\n if (key === 'downloaded') {\n return undefined;\n }\n }\n\n return value;\n};\n\nexport const Json: FC<{ data?: object }> = ({ data }) => {\n return <SyntaxHighlighter language='json'>{JSON.stringify(data, replacer, 2)}</SyntaxHighlighter>;\n};\n\nexport const Tree: FC<{ data?: object }> = ({ data }) => {\n return (\n <div className='p-2'>\n <Node data={data} root />\n </div>\n );\n};\n\nexport const Node: FC<{ data?: any; root?: boolean }> = ({ data, root }) => {\n if (typeof data !== 'object' || data === undefined || data === null) {\n return <Scalar value={data} />;\n }\n\n if (Array.isArray(data)) {\n return (\n <div className='flex flex-col space-y-2'>\n {data.map((value, index) => (\n <KeyValue key={index} label={String(index)} data={value} className='bg-teal-50' />\n ))}\n </div>\n );\n }\n\n return (\n <div className='flex flex-col space-y-2'>\n {Object.entries(data).map(([key, value]) => (\n <KeyValue key={key} label={key} data={value} className='bg-blue-50' />\n ))}\n </div>\n );\n};\n\nexport const KeyValue: FC<{ label: string; data?: any; className?: string }> = ({ label, data, className }) => {\n const [open, setOpen] = useState(true);\n if (data === undefined) {\n return null;\n }\n\n return (\n <div className='flex'>\n <Box\n className={mx('border-blue-200 text-sm select-none cursor-pointer', className)}\n onClick={() => setOpen((open) => !open)}\n >\n {label}\n </Box>\n {open && <Node data={data} />}\n </div>\n );\n};\n\nconst Scalar: FC<{ value: any }> = ({ value }) => {\n return (\n <Box className='bg-green-50 border-green-200 rounded-r text-sm font-thin'>\n {(value === undefined && 'undefined') ||\n (value === null && 'null') ||\n (typeof value === 'string' && value) ||\n JSON.stringify(value)}\n </Box>\n );\n};\n\nconst Box: FC<HTMLAttributes<HTMLDivElement>> = ({ children, className, ...props }) => {\n return (\n <div className={mx('flex px-2 border border-l-0 font-mono truncate', className)} {...props}>\n {children}\n </div>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { DebugApp } from './DebugApp';\n\nexport default DebugApp;\n"],
5
+ "mappings": ";;;;;AAIA,SAASA,OAAOC,SAASC,WAAWC,MAAMC,SAASC,eAAe;AAClE,OAAOC,UAAkBC,WAAWC,YAAAA,iBAAgB;AAGpD,SAASC,WAAWC,iBAAiB;AACrC,SAASC,QAAQC,aAAaC,iBAAiBC,eAAe;AAC9D,SAASC,SAASC,MAAAA,WAAU;;;ACN5B,OAAOC,SAAuCC,gBAAgB;AAE9D,SAASC,yBAAyB;AAClC,SAASC,UAAU;AACnB,SAASC,qBAAqB;AAIvB,IAAMC,WAAW,CAACC,KAAUC,UAAAA;AACjC,MAAI,OAAOA,UAAU,UAA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;KAKzDzC,SAAS,WAAW,gBAAA2B,OAAA,cAACyB,MAAAA;IAAKjD,MAAMJ,MAAMsD,OAAM;MAC5CrD,SAAS,YAAY,gBAAA2B,OAAA,cAAC2B,MAAAA;IAAKnD,MAAMA,KAAKO,aAAaH;MACnDP,SAAS,iBAAiB,gBAAA2B,OAAA,cAAC2B,MAAAA;IAAKnD;;AAGvC;;;AEtEA,IAAA,mBAAeoD;",
6
+ "names": ["Gauge", "Graph", "GraphIcon", "Gear", "Toolbox", "Warning", "React", "useEffect", "useState", "useClient", "useConfig", "Button", "ToggleGroup", "ToggleGroupItem", "Toolbar", "getSize", "mx", "React", "useState", "SyntaxHighlighter", "mx", "arrayToBuffer", "replacer", "key", "value", "Uint8Array", "arrayToBuffer", "toString", "type", "Buffer", "from", "data", "undefined", "Json", "SyntaxHighlighter", "language", "JSON", "stringify", "Tree", "div", "className", "Node", "root", "Scalar", "Array", "isArray", "map", "index", "KeyValue", "label", "String", "Object", "entries", "open", "setOpen", "useState", "Box", "mx", "onClick", "children", "props", "DebugApp", "graph", "view", "setView", "useState", "data", "setData", "client", "useClient", "config", "useConfig", "handleRefresh", "diagnostics", "truncate", "useEffect", "handleResetClient", "force", "window", "confirm", "reset", "location", "href", "origin", "handleOpenDevtools", "vaultUrl", "values", "runtime", "remoteSource", "open", "React", "Container", "toolbar", "Toolbar", "Root", "classNames", "ToggleGroup", "type", "value", "ToggleGroupItem", "onClick", "title", "GraphIcon", "className", "getSize", "Gauge", "Gear", "Expander", "Button", "event", "shiftKey", "Warning", "mx", "Toolbox", "weight", "Tree", "toJSON", "Json", "DebugApp"]
7
+ }
@@ -0,0 +1,276 @@
1
+ import {
2
+ DebugContext
3
+ } from "./chunk-LZEK532R.mjs";
4
+ import "./chunk-CAENAAHY.mjs";
5
+ import {
6
+ Container
7
+ } from "./chunk-GSJS3HEM.mjs";
8
+
9
+ // packages/plugins/plugin-debug/src/components/DebugSpace/DebugSpace.tsx
10
+ import React2, { useContext, useMemo as useMemo2, useState as useState2 } from "react";
11
+ import { createSpaceObjectGenerator as createSpaceObjectGenerator2 } from "@dxos/echo-generator";
12
+ import { DocumentType } from "@dxos/plugin-markdown/types";
13
+ import { Invitation } from "@dxos/protocols/proto/dxos/client/services";
14
+ import { faker } from "@dxos/random";
15
+ import { useClient } from "@dxos/react-client";
16
+ import { Filter, useSpaceInvitation } from "@dxos/react-client/echo";
17
+ import { InvitationEncoder } from "@dxos/react-client/invitations";
18
+ import { useAsyncEffect } from "@dxos/react-hooks";
19
+ import { Icon, IconButton as IconButton2, Input, Toolbar as Toolbar2, useFileDownload } from "@dxos/react-ui";
20
+ import { safeParseInt } from "@dxos/util";
21
+
22
+ // packages/plugins/plugin-debug/src/components/DebugSpace/ObjectCreator.tsx
23
+ import React, { useMemo, useState } from "react";
24
+ import { TestSchemaType, createSpaceObjectGenerator } from "@dxos/echo-generator";
25
+ import { IconButton, Toolbar } from "@dxos/react-ui";
26
+ import { createColumnBuilder, Table } from "@dxos/react-ui-table/deprecated";
27
+ var BATCH_SIZE = 10;
28
+ var ObjectCreator = ({ space, onAddObjects }) => {
29
+ const generator = useMemo(() => createSpaceObjectGenerator(space), [
30
+ space
31
+ ]);
32
+ const [objects, setObjects] = useState(Object.values(TestSchemaType).map((schema) => ({
33
+ schema,
34
+ enabled: true,
35
+ objects: 10,
36
+ mutations: {
37
+ count: 10,
38
+ mutationSize: 10,
39
+ maxContentLength: 1e3
40
+ }
41
+ })));
42
+ const handleCreate = async () => {
43
+ for (const params of objects) {
44
+ if (!params.enabled) {
45
+ continue;
46
+ }
47
+ let objectsCreated = 0;
48
+ while (objectsCreated < params.objects) {
49
+ const objects2 = await generator.createObjects({
50
+ [params.schema]: Math.min(BATCH_SIZE, params.objects - objectsCreated)
51
+ });
52
+ await generator.mutateObjects(objects2, params.mutations);
53
+ objectsCreated += objects2.length;
54
+ onAddObjects?.(objects2);
55
+ }
56
+ }
57
+ await space.db.flush();
58
+ };
59
+ const handleUpdate = (row, key, value) => {
60
+ const newObjects = [
61
+ ...objects
62
+ ];
63
+ Object.assign(newObjects.find((object) => object.schema === row.schema), {
64
+ [key]: value
65
+ });
66
+ setObjects(newObjects);
67
+ };
68
+ const { helper, builder } = createColumnBuilder();
69
+ const columns = [
70
+ helper.accessor("enabled", builder.switch({
71
+ label: "Live",
72
+ onUpdate: handleUpdate
73
+ })),
74
+ helper.accessor("schema", builder.string({
75
+ label: "Schema",
76
+ classNames: "font-mono"
77
+ })),
78
+ helper.accessor("objects", builder.number({
79
+ label: "Objects",
80
+ onUpdate: handleUpdate
81
+ })),
82
+ helper.accessor((obj) => obj.mutations.count, {
83
+ id: "mutations",
84
+ ...builder.number({
85
+ label: "Mutations",
86
+ onUpdate: handleUpdate
87
+ })
88
+ }),
89
+ helper.accessor((obj) => obj.mutations.mutationSize, {
90
+ id: "mutationSize",
91
+ ...builder.number({
92
+ label: "Mut. Size",
93
+ onUpdate: handleUpdate
94
+ })
95
+ }),
96
+ helper.accessor((obj) => obj.mutations.maxContentLength, {
97
+ id: "mutationMaxContentLength",
98
+ ...builder.number({
99
+ label: "Length",
100
+ onUpdate: handleUpdate
101
+ })
102
+ })
103
+ ];
104
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Table.Root, null, /* @__PURE__ */ React.createElement(Table.Viewport, null, /* @__PURE__ */ React.createElement(Table.Main, {
105
+ columns,
106
+ data: objects
107
+ }))), /* @__PURE__ */ React.createElement(Toolbar.Root, {
108
+ classNames: "p-2"
109
+ }, /* @__PURE__ */ React.createElement(IconButton, {
110
+ icon: "ph--plus--regular",
111
+ label: "Create",
112
+ onClick: handleCreate
113
+ })));
114
+ };
115
+
116
+ // packages/plugins/plugin-debug/src/components/DebugSpace/DebugSpace.tsx
117
+ var DEFAULT_COUNT = 100;
118
+ var DEFAULT_PERIOD = 500;
119
+ var DEFAULT_JITTER = 50;
120
+ var useRefresh = () => {
121
+ const [update, setUpdate] = useState2({});
122
+ return [
123
+ update,
124
+ () => setUpdate({})
125
+ ];
126
+ };
127
+ var CustomInput = ({ icon, ...props }) => {
128
+ return /* @__PURE__ */ React2.createElement("div", {
129
+ role: "none",
130
+ className: "relative"
131
+ }, /* @__PURE__ */ React2.createElement(Input.Root, null, /* @__PURE__ */ React2.createElement(Input.TextInput, {
132
+ classNames: "w-[100px] text-right pie-[22px]",
133
+ size: 5,
134
+ ...props
135
+ })), /* @__PURE__ */ React2.createElement(Icon, {
136
+ icon,
137
+ size: 3,
138
+ classNames: "absolute inline-end-1 block-start-1 mt-[6px]"
139
+ }));
140
+ };
141
+ var DebugSpace = ({ space, onAddObjects }) => {
142
+ const { connect } = useSpaceInvitation(space?.key);
143
+ const client = useClient();
144
+ const [data, setData] = useState2({});
145
+ const [update, handleUpdate] = useRefresh();
146
+ useAsyncEffect(async (isMounted) => {
147
+ const data2 = await client.diagnostics({
148
+ truncate: true
149
+ });
150
+ if (isMounted()) {
151
+ setData(data2?.diagnostics?.spaces?.find(({ key }) => {
152
+ return space.key.toHex().startsWith(key);
153
+ }));
154
+ }
155
+ }, [
156
+ space,
157
+ update
158
+ ]);
159
+ const download = useFileDownload();
160
+ const handleDownload = async () => {
161
+ download(new Blob([
162
+ JSON.stringify(data, void 0, 2)
163
+ ], {
164
+ type: "text/plain"
165
+ }), `${(/* @__PURE__ */ new Date()).toISOString().replace(/\W/g, "-")}.json`);
166
+ };
167
+ const [mutationCount, setMutationCount] = useState2(String(DEFAULT_COUNT));
168
+ const [mutationInterval, setMutationInterval] = useState2(String(DEFAULT_PERIOD));
169
+ const [mutationJitter, setMutationJitter] = useState2(String(DEFAULT_JITTER));
170
+ const generator = useMemo2(() => createSpaceObjectGenerator2(space), [
171
+ space
172
+ ]);
173
+ const { running, start, stop } = useContext(DebugContext);
174
+ const handleToggleRunning = () => {
175
+ if (running) {
176
+ stop();
177
+ handleUpdate();
178
+ } else {
179
+ start(async () => {
180
+ const { objects } = await space.db.query(Filter.schema(DocumentType)).run();
181
+ if (objects.length) {
182
+ const object = faker.helpers.arrayElement(objects);
183
+ await generator.mutateObject(object, {
184
+ count: 10,
185
+ mutationSize: 10,
186
+ maxContentLength: 1e3
187
+ });
188
+ }
189
+ }, {
190
+ count: safeParseInt(mutationCount) ?? 0,
191
+ interval: safeParseInt(mutationInterval) ?? 0,
192
+ jitter: safeParseInt(mutationJitter) ?? 0
193
+ });
194
+ }
195
+ };
196
+ const handleCreateInvitation = () => {
197
+ const invitation = space.share({
198
+ type: Invitation.Type.INTERACTIVE,
199
+ authMethod: Invitation.AuthMethod.NONE,
200
+ multiUse: true
201
+ });
202
+ connect(invitation);
203
+ const code = InvitationEncoder.encode(invitation.get());
204
+ new URL(window.origin).searchParams.set("spaceInvitationCode", code);
205
+ const url = `${window.origin}?spaceInvitationCode=${code}`;
206
+ void navigator.clipboard.writeText(url);
207
+ };
208
+ const handleCreateEpoch = async () => {
209
+ await space.internal.createEpoch();
210
+ handleUpdate();
211
+ };
212
+ return /* @__PURE__ */ React2.createElement(Container, {
213
+ toolbar: /* @__PURE__ */ React2.createElement(Toolbar2.Root, {
214
+ classNames: "p-1"
215
+ }, /* @__PURE__ */ React2.createElement(CustomInput, {
216
+ icon: "ph--flag--regular",
217
+ autoComplete: "off",
218
+ placeholder: "Count",
219
+ value: mutationCount,
220
+ onChange: ({ target: { value } }) => setMutationCount(value)
221
+ }), /* @__PURE__ */ React2.createElement(CustomInput, {
222
+ icon: "ph--timer--regular",
223
+ autoComplete: "off",
224
+ placeholder: "Interval",
225
+ value: mutationInterval,
226
+ onChange: ({ target: { value } }) => setMutationInterval(value)
227
+ }), /* @__PURE__ */ React2.createElement(CustomInput, {
228
+ icon: "ph--plus-minus--regular",
229
+ autoComplete: "off",
230
+ placeholder: "Jitter",
231
+ value: mutationJitter,
232
+ onChange: ({ target: { value } }) => setMutationJitter(value)
233
+ }), /* @__PURE__ */ React2.createElement(IconButton2, {
234
+ icon: running ? "ph--hand-palm--regular" : "ph--play--regular",
235
+ iconOnly: true,
236
+ label: "Start/stop",
237
+ size: 5,
238
+ onClick: handleToggleRunning
239
+ }), /* @__PURE__ */ React2.createElement(IconButton2, {
240
+ icon: "ph--arrow-clockwise--regular",
241
+ iconOnly: true,
242
+ label: "Refresh",
243
+ size: 5,
244
+ onClick: handleUpdate
245
+ }), /* @__PURE__ */ React2.createElement(IconButton2, {
246
+ icon: "ph--download-simple--regular",
247
+ iconOnly: true,
248
+ label: "Download",
249
+ size: 5,
250
+ onClick: handleDownload
251
+ }), /* @__PURE__ */ React2.createElement(Toolbar2.Expander, null), /* @__PURE__ */ React2.createElement(IconButton2, {
252
+ icon: "ph--flag-pennant--regular",
253
+ iconOnly: true,
254
+ label: "Create epoch",
255
+ size: 5,
256
+ onClick: handleCreateEpoch
257
+ }), /* @__PURE__ */ React2.createElement(IconButton2, {
258
+ icon: "ph--user-circle-plus--regular",
259
+ iconOnly: true,
260
+ iconClassNames: "text-blue-500",
261
+ label: "Create Invitation",
262
+ size: 5,
263
+ onClick: handleCreateInvitation
264
+ }))
265
+ }, /* @__PURE__ */ React2.createElement(ObjectCreator, {
266
+ space,
267
+ onAddObjects
268
+ }));
269
+ };
270
+
271
+ // packages/plugins/plugin-debug/src/components/DebugSpace/index.ts
272
+ var DebugSpace_default = DebugSpace;
273
+ export {
274
+ DebugSpace_default as default
275
+ };
276
+ //# sourceMappingURL=DebugSpace-ZLGGNDAR.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/DebugSpace/DebugSpace.tsx", "../../../src/components/DebugSpace/ObjectCreator.tsx", "../../../src/components/DebugSpace/index.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { type FC, useContext, useMemo, useState } from 'react';\n\nimport { createSpaceObjectGenerator } from '@dxos/echo-generator';\nimport { type ReactiveObject } from '@dxos/echo-schema';\nimport { DocumentType } from '@dxos/plugin-markdown/types';\nimport { Invitation } from '@dxos/protocols/proto/dxos/client/services';\nimport { faker } from '@dxos/random';\nimport { useClient } from '@dxos/react-client';\nimport { Filter, type Space, useSpaceInvitation } from '@dxos/react-client/echo';\nimport { InvitationEncoder } from '@dxos/react-client/invitations';\nimport { useAsyncEffect } from '@dxos/react-hooks';\nimport { Icon, IconButton, Input, type IconProps, type TextInputProps, Toolbar, useFileDownload } from '@dxos/react-ui';\nimport { safeParseInt } from '@dxos/util';\n\nimport { ObjectCreator } from './ObjectCreator';\nimport { DebugContext } from '../../types';\nimport { Container } from '../Container';\n\nconst DEFAULT_COUNT = 100;\nconst DEFAULT_PERIOD = 500;\nconst DEFAULT_JITTER = 50;\n\nconst useRefresh = (): [any, () => void] => {\n const [update, setUpdate] = useState({});\n return [update, () => setUpdate({})];\n};\n\nconst CustomInput = ({ icon, ...props }: Pick<IconProps, 'icon'> & TextInputProps) => {\n return (\n <div role='none' className='relative'>\n <Input.Root>\n <Input.TextInput classNames='w-[100px] text-right pie-[22px]' size={5} {...props} />\n </Input.Root>\n <Icon icon={icon} size={3} classNames='absolute inline-end-1 block-start-1 mt-[6px]' />\n </div>\n );\n};\n\nexport const DebugSpace: FC<{\n space: Space;\n onAddObjects?: (objects: ReactiveObject<any>[]) => void;\n}> = ({ space, onAddObjects }) => {\n const { connect } = useSpaceInvitation(space?.key);\n const client = useClient();\n const [data, setData] = useState<any>({});\n\n const [update, handleUpdate] = useRefresh();\n useAsyncEffect(\n async (isMounted) => {\n const data = await client.diagnostics({ truncate: true });\n if (isMounted()) {\n setData(\n data?.diagnostics?.spaces?.find(({ key }: any) => {\n return space.key.toHex().startsWith(key);\n }),\n );\n }\n },\n [space, update],\n );\n\n const download = useFileDownload();\n const handleDownload = async () => {\n download(\n new Blob([JSON.stringify(data, undefined, 2)], { type: 'text/plain' }),\n `${new Date().toISOString().replace(/\\W/g, '-')}.json`,\n );\n };\n\n const [mutationCount, setMutationCount] = useState(String(DEFAULT_COUNT));\n const [mutationInterval, setMutationInterval] = useState(String(DEFAULT_PERIOD));\n const [mutationJitter, setMutationJitter] = useState(String(DEFAULT_JITTER));\n\n const generator = useMemo(() => createSpaceObjectGenerator(space), [space]);\n\n // TODO(burdon): Note: this is shared across all spaces!\n const { running, start, stop } = useContext(DebugContext);\n const handleToggleRunning = () => {\n if (running) {\n stop();\n handleUpdate();\n } else {\n start(\n async () => {\n const { objects } = await space.db.query(Filter.schema(DocumentType)).run();\n if (objects.length) {\n const object = faker.helpers.arrayElement(objects);\n await generator.mutateObject(object, { count: 10, mutationSize: 10, maxContentLength: 1000 });\n }\n },\n {\n count: safeParseInt(mutationCount) ?? 0,\n interval: safeParseInt(mutationInterval) ?? 0,\n jitter: safeParseInt(mutationJitter) ?? 0,\n },\n );\n }\n };\n\n const handleCreateInvitation = () => {\n const invitation = space.share({\n type: Invitation.Type.INTERACTIVE,\n authMethod: Invitation.AuthMethod.NONE,\n multiUse: true,\n });\n\n // TODO(burdon): Refactor.\n // TODO(burdon): Unsubscribe?\n connect(invitation);\n const code = InvitationEncoder.encode(invitation.get());\n new URL(window.origin).searchParams.set('spaceInvitationCode', code);\n const url = `${window.origin}?spaceInvitationCode=${code}`;\n void navigator.clipboard.writeText(url);\n };\n\n const handleCreateEpoch = async () => {\n await space.internal.createEpoch();\n handleUpdate();\n };\n\n return (\n <Container\n toolbar={\n <Toolbar.Root classNames='p-1'>\n <CustomInput\n icon='ph--flag--regular'\n autoComplete='off'\n placeholder='Count'\n value={mutationCount}\n onChange={({ target: { value } }) => setMutationCount(value)}\n />\n <CustomInput\n icon='ph--timer--regular'\n autoComplete='off'\n placeholder='Interval'\n value={mutationInterval}\n onChange={({ target: { value } }) => setMutationInterval(value)}\n />\n <CustomInput\n icon='ph--plus-minus--regular'\n autoComplete='off'\n placeholder='Jitter'\n value={mutationJitter}\n onChange={({ target: { value } }) => setMutationJitter(value)}\n />\n\n <IconButton\n icon={running ? 'ph--hand-palm--regular' : 'ph--play--regular'}\n iconOnly\n label='Start/stop'\n size={5}\n onClick={handleToggleRunning}\n />\n <IconButton icon='ph--arrow-clockwise--regular' iconOnly label='Refresh' size={5} onClick={handleUpdate} />\n <IconButton icon='ph--download-simple--regular' iconOnly label='Download' size={5} onClick={handleDownload} />\n\n <Toolbar.Expander />\n <IconButton\n icon='ph--flag-pennant--regular'\n iconOnly\n label='Create epoch'\n size={5}\n onClick={handleCreateEpoch}\n />\n <IconButton\n icon='ph--user-circle-plus--regular'\n iconOnly\n iconClassNames='text-blue-500'\n label='Create Invitation'\n size={5}\n onClick={handleCreateInvitation}\n />\n </Toolbar.Root>\n }\n >\n <ObjectCreator space={space} onAddObjects={onAddObjects} />\n </Container>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { useMemo, useState } from 'react';\n\nimport { type MutationsProviderParams, TestSchemaType, createSpaceObjectGenerator } from '@dxos/echo-generator';\nimport { type ReactiveEchoObject, type ReactiveObject, type Space } from '@dxos/react-client/echo';\nimport { IconButton, Toolbar } from '@dxos/react-ui';\nimport { createColumnBuilder, type TableColumnDef, Table } from '@dxos/react-ui-table/deprecated';\n\nconst BATCH_SIZE = 10;\n\nexport type CreateObjectsParams = {\n schema: string;\n enabled: boolean;\n objects: number;\n mutations: Pick<MutationsProviderParams, 'count' | 'mutationSize' | 'maxContentLength'>;\n};\n\nexport type ObjectCreatorProps = {\n space: Space;\n onAddObjects?: (objects: ReactiveObject<any>[]) => void;\n};\n\nexport const ObjectCreator = ({ space, onAddObjects }: ObjectCreatorProps) => {\n const generator = useMemo(() => createSpaceObjectGenerator(space), [space]);\n\n const [objects, setObjects] = useState<CreateObjectsParams[]>(\n Object.values(TestSchemaType).map((schema) => ({\n schema,\n enabled: true,\n objects: 10,\n mutations: {\n count: 10,\n mutationSize: 10,\n maxContentLength: 1000,\n },\n })),\n );\n\n const handleCreate = async () => {\n for (const params of objects) {\n if (!params.enabled) {\n continue;\n }\n\n let objectsCreated = 0;\n while (objectsCreated < params.objects) {\n const objects = (await generator.createObjects({\n [params.schema]: Math.min(BATCH_SIZE, params.objects - objectsCreated),\n })) as ReactiveEchoObject<any>[];\n\n await generator.mutateObjects(objects, params.mutations);\n objectsCreated += objects.length;\n onAddObjects?.(objects);\n }\n }\n\n await space.db.flush();\n };\n\n const handleUpdate = (row: CreateObjectsParams, key: string, value: any) => {\n const newObjects = [...objects];\n Object.assign(newObjects.find((object) => object.schema === row.schema)!, { [key]: value });\n setObjects(newObjects);\n };\n\n const { helper, builder } = createColumnBuilder<CreateObjectsParams>();\n const columns: TableColumnDef<CreateObjectsParams>[] = [\n helper.accessor('enabled', builder.switch({ label: 'Live', onUpdate: handleUpdate })),\n helper.accessor('schema', builder.string({ label: 'Schema', classNames: 'font-mono' })),\n helper.accessor('objects', builder.number({ label: 'Objects', onUpdate: handleUpdate })),\n helper.accessor((obj) => obj.mutations.count, {\n id: 'mutations',\n ...builder.number({ label: 'Mutations', onUpdate: handleUpdate }),\n }),\n helper.accessor((obj) => obj.mutations.mutationSize, {\n id: 'mutationSize',\n ...builder.number({ label: 'Mut. Size', onUpdate: handleUpdate }),\n }),\n helper.accessor((obj) => obj.mutations.maxContentLength, {\n id: 'mutationMaxContentLength',\n ...builder.number({ label: 'Length', onUpdate: handleUpdate }),\n }),\n ];\n\n return (\n <>\n <Table.Root>\n <Table.Viewport>\n <Table.Main<CreateObjectsParams> columns={columns} data={objects} />\n </Table.Viewport>\n </Table.Root>\n <Toolbar.Root classNames='p-2'>\n <IconButton icon='ph--plus--regular' label='Create' onClick={handleCreate} />\n </Toolbar.Root>\n </>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { DebugSpace } from './DebugSpace';\n\nexport default DebugSpace;\n"],
5
+ "mappings": ";;;;;;;;;AAIA,OAAOA,UAAkBC,YAAYC,WAAAA,UAASC,YAAAA,iBAAgB;AAE9D,SAASC,8BAAAA,mCAAkC;AAE3C,SAASC,oBAAoB;AAC7B,SAASC,kBAAkB;AAC3B,SAASC,aAAa;AACtB,SAASC,iBAAiB;AAC1B,SAASC,QAAoBC,0BAA0B;AACvD,SAASC,yBAAyB;AAClC,SAASC,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AAAA;MACC/G,MAAK;MACLgH,UAAAA;MACAI,gBAAe;MACfH,OAAM;MACNvG,MAAM;MACNwG,SAASrC;;KAKf,gBAAA3E,OAAA,cAACmH,eAAAA;IAAcxG;IAAcC;;AAGnC;;;AEhLA,IAAA,qBAAewG;",
6
+ "names": ["React", "useContext", "useMemo", "useState", "createSpaceObjectGenerator", "DocumentType", "Invitation", "faker", "useClient", "Filter", "useSpaceInvitation", "InvitationEncoder", "useAsyncEffect", "Icon", "IconButton", "Input", "Toolbar", "useFileDownload", "safeParseInt", "React", "useMemo", "useState", "TestSchemaType", "createSpaceObjectGenerator", "IconButton", "Toolbar", "createColumnBuilder", "Table", "BATCH_SIZE", "ObjectCreator", "space", "onAddObjects", "generator", "useMemo", "createSpaceObjectGenerator", "objects", "setObjects", "useState", "Object", "values", "TestSchemaType", "map", "schema", "enabled", "mutations", "count", "mutationSize", "maxContentLength", "handleCreate", "params", "objectsCreated", "createObjects", "Math", "min", "mutateObjects", "length", "db", "flush", "handleUpdate", "row", "key", "value", "newObjects", "assign", "find", "object", "helper", "builder", "createColumnBuilder", "columns", "accessor", "switch", "label", "onUpdate", "string", "classNames", "number", "obj", "id", "Table", "Root", "Viewport", "Main", "data", "Toolbar", "IconButton", "icon", "onClick", "DEFAULT_COUNT", "DEFAULT_PERIOD", "DEFAULT_JITTER", "useRefresh", "update", "setUpdate", "useState", "CustomInput", "icon", "props", "React", "div", "role", "className", "Input", "Root", "TextInput", "classNames", "size", "Icon", "DebugSpace", "space", "onAddObjects", "connect", "useSpaceInvitation", "key", "client", "useClient", "data", "setData", "handleUpdate", "useAsyncEffect", "isMounted", "diagnostics", "truncate", "spaces", "find", "toHex", "startsWith", "download", "useFileDownload", "handleDownload", "Blob", "JSON", "stringify", "undefined", "type", "Date", "toISOString", "replace", "mutationCount", "setMutationCount", "String", "mutationInterval", "setMutationInterval", "mutationJitter", "setMutationJitter", "generator", "useMemo", "createSpaceObjectGenerator", "running", "start", "stop", "useContext", "DebugContext", "handleToggleRunning", "objects", "db", "query", "Filter", "schema", "DocumentType", "run", "length", "object", "faker", "helpers", "arrayElement", "mutateObject", "count", "mutationSize", "maxContentLength", "safeParseInt", "interval", "jitter", "handleCreateInvitation", "invitation", "share", "Invitation", "Type", "INTERACTIVE", "authMethod", "AuthMethod", "NONE", "multiUse", "code", "InvitationEncoder", "encode", "get", "URL", "window", "origin", "searchParams", "set", "url", "navigator", "clipboard", "writeText", "handleCreateEpoch", "internal", "createEpoch", "Container", "toolbar", "Toolbar", "autoComplete", "placeholder", "value", "onChange", "target", "IconButton", "iconOnly", "label", "onClick", "Expander", "iconClassNames", "ObjectCreator", "DebugSpace"]
7
+ }
@@ -0,0 +1,15 @@
1
+ // packages/plugins/plugin-debug/src/components/Container.tsx
2
+ import React from "react";
3
+ var Container = ({ toolbar, children }) => {
4
+ return /* @__PURE__ */ React.createElement("div", {
5
+ role: "none",
6
+ className: "flex flex-col grow overflow-hidden divide-y divide-separator"
7
+ }, toolbar, /* @__PURE__ */ React.createElement("div", {
8
+ className: "flex flex-col grow overflow-auto"
9
+ }, children));
10
+ };
11
+
12
+ export {
13
+ Container
14
+ };
15
+ //# sourceMappingURL=chunk-GSJS3HEM.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/Container.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { type PropsWithChildren, type ReactNode } from 'react';\n\n// TODO(burdon): Convert to grid.\nexport const Container = ({ toolbar, children }: PropsWithChildren<{ toolbar: ReactNode }>) => {\n return (\n <div role='none' className='flex flex-col grow overflow-hidden divide-y divide-separator'>\n {toolbar}\n <div className='flex flex-col grow overflow-auto'>{children}</div>\n </div>\n );\n};\n"],
5
+ "mappings": ";AAIA,OAAOA,WAAuD;AAGvD,IAAMC,YAAY,CAAC,EAAEC,SAASC,SAAQ,MAA6C;AACxF,SACE,sBAAA,cAACC,OAAAA;IAAIC,MAAK;IAAOC,WAAU;KACxBJ,SACD,sBAAA,cAACE,OAAAA;IAAIE,WAAU;KAAoCH,QAAAA,CAAAA;AAGzD;",
6
+ "names": ["React", "Container", "toolbar", "children", "div", "role", "className"]
7
+ }
@@ -387,8 +387,8 @@ var Wireframe = ({ classNames, label, object }) => {
387
387
  };
388
388
 
389
389
  // packages/plugins/plugin-debug/src/components/index.ts
390
- var DebugGlobal = lazy(() => import("./DebugGlobal-ZTCBF3XR.mjs"));
391
- var DebugSpace = lazy(() => import("./DebugSpace-6TGT3H4I.mjs"));
390
+ var DebugApp = lazy(() => import("./DebugApp-HCHR6GKO.mjs"));
391
+ var DebugSpace = lazy(() => import("./DebugSpace-ZLGGNDAR.mjs"));
392
392
 
393
393
  // packages/plugins/plugin-debug/src/translations.ts
394
394
  var translations_default = [
@@ -625,7 +625,9 @@ var DebugPlugin = definePlugin((context) => {
625
625
  }
626
626
  const object = toSignal((onChange) => {
627
627
  const timeout = setTimeout(async () => {
628
- await space?.db.loadObjectById(objectId);
628
+ await space?.db.query({
629
+ id: objectId
630
+ }).first();
629
631
  onChange();
630
632
  });
631
633
  return () => clearTimeout(timeout);
@@ -692,7 +694,7 @@ var DebugPlugin = definePlugin((context) => {
692
694
  }) : null;
693
695
  }
694
696
  const primary = data.active ?? data.object;
695
- let component;
697
+ let component = null;
696
698
  if (role === "main" || role === "article") {
697
699
  if (primary === "devtools" && settings.devtools) {
698
700
  component = /* @__PURE__ */ React5.createElement(Devtools, null);
@@ -719,11 +721,9 @@ var DebugPlugin = definePlugin((context) => {
719
721
  }
720
722
  });
721
723
  } else if ("graph" in primary && primary.graph instanceof Graph) {
722
- component = /* @__PURE__ */ React5.createElement(DebugGlobal, {
724
+ component = /* @__PURE__ */ React5.createElement(DebugApp, {
723
725
  graph: primary.graph
724
726
  });
725
- } else {
726
- component = null;
727
727
  }
728
728
  }
729
729
  if (!component) {
@@ -747,10 +747,7 @@ var DebugPlugin = definePlugin((context) => {
747
747
  }
748
748
  switch (role) {
749
749
  case "article":
750
- return /* @__PURE__ */ React5.createElement("div", {
751
- role: "none",
752
- className: "row-span-2 rounded-t-md overflow-x-auto"
753
- }, component);
750
+ return /* @__PURE__ */ React5.createElement(React5.Fragment, null, component);
754
751
  case "main":
755
752
  return /* @__PURE__ */ React5.createElement(Main.Content, {
756
753
  classNames: [