@dxos/plugin-debug 0.7.4-staging.f7e8224 → 0.7.5-main.9cb18ac
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/{DebugSpace-DHKEAMIC.mjs → DebugSpace-V3K3PQP6.mjs} +2 -3
- package/dist/lib/browser/{DebugSpace-DHKEAMIC.mjs.map → DebugSpace-V3K3PQP6.mjs.map} +1 -1
- package/dist/lib/browser/{SpaceGenerator-BQ3645OS.mjs → SpaceGenerator-Y2NXBQVR.mjs} +18 -14
- package/dist/lib/browser/SpaceGenerator-Y2NXBQVR.mjs.map +7 -0
- package/dist/lib/browser/{chunk-LZEK532R.mjs → chunk-6CGQHKET.mjs} +1 -11
- package/dist/lib/browser/chunk-6CGQHKET.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +87 -112
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/DebugPlugin.d.ts.map +1 -1
- package/dist/types/src/components/DebugSpace/DebugSpace.stories.d.ts.map +1 -1
- package/dist/types/src/components/DebugSpace/ObjectCreator.stories.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +2 -2
- package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
- package/dist/types/src/components/SpaceGenerator/draw-util.d.ts.map +1 -1
- package/dist/types/src/components/Wireframe.d.ts +2 -1
- package/dist/types/src/components/Wireframe.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +2 -5
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +43 -42
- package/src/DebugPlugin.tsx +93 -126
- package/src/components/DebugSpace/DebugSpace.stories.tsx +4 -3
- package/src/components/DebugSpace/ObjectCreator.stories.tsx +4 -3
- package/src/components/DebugSurface.tsx +2 -2
- package/src/components/SpaceGenerator/ObjectGenerator.tsx +13 -13
- package/src/components/SpaceGenerator/SpaceGenerator.tsx +2 -2
- package/src/components/SpaceGenerator/draw-util.ts +7 -6
- package/src/components/Wireframe.tsx +2 -2
- package/src/types.ts +0 -9
- package/dist/lib/browser/SpaceGenerator-BQ3645OS.mjs.map +0 -7
- package/dist/lib/browser/chunk-LZEK532R.mjs.map +0 -7
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DebugContext
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-CAENAAHY.mjs";
|
|
3
|
+
} from "./chunk-6CGQHKET.mjs";
|
|
5
4
|
import {
|
|
6
5
|
Container
|
|
7
6
|
} from "./chunk-GSJS3HEM.mjs";
|
|
@@ -273,4 +272,4 @@ var DebugSpace_default = DebugSpace;
|
|
|
273
272
|
export {
|
|
274
273
|
DebugSpace_default as default
|
|
275
274
|
};
|
|
276
|
-
//# sourceMappingURL=DebugSpace-
|
|
275
|
+
//# sourceMappingURL=DebugSpace-V3K3PQP6.mjs.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/DebugSpace/DebugSpace.tsx", "../../../src/components/DebugSpace/ObjectCreator.tsx", "../../../src/components/DebugSpace/index.ts"],
|
|
4
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/live-object';\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--pause-circle--regular' : 'ph--play-circle--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-1'>\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": "
|
|
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,sBAAsB;AAC/B,SAASC,MAAMC,cAAAA,aAAYC,OAA4CC,WAAAA,UAASC,uBAAuB;AACvG,SAASC,oBAAoB;;;ACZ7B,OAAOC,SAASC,SAASC,gBAAgB;AAEzC,SAAuCC,gBAAgBC,kCAAkC;AAEzF,SAASC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
6
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
7
|
}
|
|
@@ -11,9 +11,10 @@ import { Testing } from "@dxos/schema/testing";
|
|
|
11
11
|
import { jsonKeyReplacer, sortKeys } from "@dxos/util";
|
|
12
12
|
|
|
13
13
|
// packages/plugins/plugin-debug/src/components/SpaceGenerator/ObjectGenerator.tsx
|
|
14
|
-
import {
|
|
14
|
+
import { addressToA1Notation } from "@dxos/compute";
|
|
15
|
+
import { create, makeRef } from "@dxos/live-object";
|
|
15
16
|
import { DocumentType, TextType } from "@dxos/plugin-markdown/types";
|
|
16
|
-
import {
|
|
17
|
+
import { createSheet } from "@dxos/plugin-sheet";
|
|
17
18
|
import { SheetType } from "@dxos/plugin-sheet/types";
|
|
18
19
|
import { CanvasType, DiagramType } from "@dxos/plugin-sketch/types";
|
|
19
20
|
import { faker } from "@dxos/random";
|
|
@@ -30,9 +31,9 @@ var staticGenerators = /* @__PURE__ */ new Map([
|
|
|
30
31
|
const objects = range(n).map(() => {
|
|
31
32
|
const obj = space.db.add(create(DocumentType, {
|
|
32
33
|
name: faker.commerce.productName(),
|
|
33
|
-
content: create(TextType, {
|
|
34
|
+
content: makeRef(create(TextType, {
|
|
34
35
|
content: faker.lorem.sentences(5)
|
|
35
|
-
}),
|
|
36
|
+
})),
|
|
36
37
|
threads: []
|
|
37
38
|
}));
|
|
38
39
|
return obj;
|
|
@@ -47,9 +48,9 @@ var staticGenerators = /* @__PURE__ */ new Map([
|
|
|
47
48
|
const objects = range(n).map(() => {
|
|
48
49
|
const obj = space.db.add(create(DiagramType, {
|
|
49
50
|
name: faker.commerce.productName(),
|
|
50
|
-
canvas: create(CanvasType, {
|
|
51
|
+
canvas: makeRef(create(CanvasType, {
|
|
51
52
|
content: {}
|
|
52
|
-
})
|
|
53
|
+
}))
|
|
53
54
|
}));
|
|
54
55
|
return obj;
|
|
55
56
|
});
|
|
@@ -107,14 +108,17 @@ var staticGenerators = /* @__PURE__ */ new Map([
|
|
|
107
108
|
]);
|
|
108
109
|
var createGenerator = (type) => {
|
|
109
110
|
return async (space, n, cb) => {
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
const schema = await space.db.schemaRegistry.query({
|
|
112
|
+
typename: type.typename
|
|
113
|
+
}).firstOrUndefined() ?? (await space.db.schemaRegistry.register([
|
|
114
|
+
type
|
|
115
|
+
]))[0];
|
|
116
|
+
const generate = createAsyncGenerator(generator, schema.getSchemaSnapshot(), {
|
|
113
117
|
db: space.db
|
|
114
118
|
});
|
|
115
119
|
const objects = await generate.createObjects(n);
|
|
116
120
|
const { objects: tables } = await space.db.query(Filter.schema(TableType)).run();
|
|
117
|
-
const table = tables.find((table2) => table2.view?.query?.type === type.typename);
|
|
121
|
+
const table = tables.find((table2) => table2.view?.target?.query?.type === type.typename);
|
|
118
122
|
if (!table) {
|
|
119
123
|
const name = type.typename.split("/").pop() ?? type.typename;
|
|
120
124
|
const view = createView({
|
|
@@ -124,7 +128,7 @@ var createGenerator = (type) => {
|
|
|
124
128
|
});
|
|
125
129
|
const table2 = space.db.add(create(TableType, {
|
|
126
130
|
name,
|
|
127
|
-
view
|
|
131
|
+
view: makeRef(view)
|
|
128
132
|
}));
|
|
129
133
|
cb?.([
|
|
130
134
|
table2
|
|
@@ -192,7 +196,7 @@ var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
|
192
196
|
mutableTypes
|
|
193
197
|
]);
|
|
194
198
|
const updateInfo = async () => {
|
|
195
|
-
const
|
|
199
|
+
const echoSchema = await space.db.schemaRegistry.query().run();
|
|
196
200
|
const staticSchema = space.db.graph.schemaRegistry.schemas;
|
|
197
201
|
const { objects } = await space.db.query().run();
|
|
198
202
|
const objectMap = sortKeys(objects.reduce((map, obj) => {
|
|
@@ -206,7 +210,7 @@ var SpaceGenerator = ({ space, onCreateObjects }) => {
|
|
|
206
210
|
setInfo({
|
|
207
211
|
schema: {
|
|
208
212
|
static: staticSchema.length,
|
|
209
|
-
mutable:
|
|
213
|
+
mutable: echoSchema.length
|
|
210
214
|
},
|
|
211
215
|
objects: objectMap
|
|
212
216
|
});
|
|
@@ -270,4 +274,4 @@ var SpaceGenerator_default = SpaceGenerator;
|
|
|
270
274
|
export {
|
|
271
275
|
SpaceGenerator_default as default
|
|
272
276
|
};
|
|
273
|
-
//# sourceMappingURL=SpaceGenerator-
|
|
277
|
+
//# sourceMappingURL=SpaceGenerator-Y2NXBQVR.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/SpaceGenerator/SpaceGenerator.tsx", "../../../src/components/SpaceGenerator/ObjectGenerator.tsx", "../../../src/components/SpaceGenerator/SchemaTable.tsx", "../../../src/components/SpaceGenerator/index.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useCallback, useMemo, useState } from 'react';\n\nimport { type ReactiveObject } from '@dxos/live-object';\nimport { DocumentType } from '@dxos/plugin-markdown/types';\nimport { SheetType } from '@dxos/plugin-sheet/types';\nimport { DiagramType } from '@dxos/plugin-sketch/types';\nimport { useClient } from '@dxos/react-client';\nimport { getTypename, type Space } from '@dxos/react-client/echo';\nimport { IconButton, Input, Toolbar, useAsyncEffect } from '@dxos/react-ui';\nimport { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';\nimport { Testing } from '@dxos/schema/testing';\nimport { jsonKeyReplacer, sortKeys } from '@dxos/util';\n\nimport { type ObjectGenerator, createGenerator, staticGenerators } from './ObjectGenerator';\nimport { SchemaTable } from './SchemaTable';\n\nexport type SpaceGeneratorProps = {\n space: Space;\n onCreateObjects?: (objects: ReactiveObject<any>[]) => void;\n};\n\nexport const SpaceGenerator = ({ space, onCreateObjects }: SpaceGeneratorProps) => {\n const client = useClient();\n const staticTypes = [DocumentType, DiagramType, SheetType]; // TODO(burdon): Make extensible.\n const mutableTypes = [Testing.OrgType, Testing.ProjectType, Testing.ContactType];\n const [count, setCount] = useState(1);\n const [info, setInfo] = useState<any>({});\n\n // Create type generators.\n const typeMap = useMemo(() => {\n client.addTypes(staticTypes);\n const mutableGenerators = new Map<string, ObjectGenerator<any>>(\n mutableTypes.map((type) => [type.typename, createGenerator(type)]),\n );\n\n return new Map([...staticGenerators, ...mutableGenerators]);\n }, [client, mutableTypes]);\n\n // Query space to get info.\n const updateInfo = async () => {\n // Create schema map.\n const echoSchema = await space.db.schemaRegistry.query().run();\n const staticSchema = space.db.graph.schemaRegistry.schemas;\n\n // Create object map.\n const { objects } = await space.db.query().run();\n const objectMap = sortKeys(\n objects.reduce<Record<string, number>>((map, obj) => {\n const type = getTypename(obj);\n if (type) {\n const count = map[type] ?? 0;\n map[type] = count + 1;\n }\n return map;\n }, {}),\n );\n\n setInfo({\n schema: {\n static: staticSchema.length,\n mutable: echoSchema.length,\n },\n objects: objectMap,\n });\n };\n\n useAsyncEffect(updateInfo, [space]);\n\n const handleCreateData = useCallback(\n async (typename: string) => {\n const constructor = typeMap.get(typename);\n if (constructor) {\n // TODO(burdon): Input to specify number of objects.\n await constructor(space, count, onCreateObjects);\n await updateInfo();\n }\n },\n [typeMap, count],\n );\n\n return (\n <div role='none' className='flex flex-col divide-y divide-separator'>\n <Toolbar.Root classNames='p-1'>\n <IconButton icon='ph--arrow-clockwise--regular' iconOnly label='Refresh' onClick={updateInfo} />\n <Toolbar.Expander />\n <div className='flex'>\n <Input.Root>\n <Input.TextInput\n type='number'\n min={1}\n max={100}\n placeholder={'Count'}\n classNames='w-[80px]'\n value={count}\n onChange={(ev) => setCount(parseInt(ev.target.value))}\n />\n </Input.Root>\n </div>\n </Toolbar.Root>\n\n <SchemaTable types={staticTypes} objects={info.objects} label='Static Types' onClick={handleCreateData} />\n <SchemaTable types={mutableTypes} objects={info.objects} label='Mutable Types' onClick={handleCreateData} />\n\n <SyntaxHighlighter classNames='flex text-xs' language='json'>\n {JSON.stringify({ space, ...info }, jsonKeyReplacer({ truncate: true }), 2)}\n </SyntaxHighlighter>\n </div>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { addressToA1Notation } from '@dxos/compute';\nimport { type BaseObject, type TypedObject } from '@dxos/echo-schema';\nimport { create, makeRef, type ReactiveObject } from '@dxos/live-object';\nimport { DocumentType, TextType } from '@dxos/plugin-markdown/types';\nimport { createSheet } from '@dxos/plugin-sheet';\nimport { SheetType, type CellValue } from '@dxos/plugin-sheet/types';\nimport { CanvasType, DiagramType } from '@dxos/plugin-sketch/types';\nimport { faker } from '@dxos/random';\nimport { Filter, type Space } from '@dxos/react-client/echo';\nimport { TableType } from '@dxos/react-ui-table';\nimport { createView } from '@dxos/schema';\nimport { createAsyncGenerator, type ValueGenerator } from '@dxos/schema/testing';\nimport { range } from '@dxos/util';\n\nconst generator: ValueGenerator = faker as any;\n\n// TODO(burdon): Add objects to collections.\n// TODO(burdon): Create docs.\n// TODO(burdon): Create sketches.\n// TODO(burdon): Create sheets.\n// TODO(burdon): Create comments.\n// TODO(burdon): Reuse in testbench-app.\n// TODO(burdon): Mutator running in background (factor out): from echo-generator.\n\nexport type ObjectGenerator<T extends BaseObject> = (\n space: Space,\n n: number,\n cb?: (objects: ReactiveObject<any>[]) => void,\n) => Promise<ReactiveObject<T>[]>;\n\nexport const staticGenerators = new Map<string, ObjectGenerator<any>>([\n [\n DocumentType.typename,\n async (space, n, cb) => {\n const objects = range(n).map(() => {\n const obj = space.db.add(\n create(DocumentType, {\n name: faker.commerce.productName(),\n content: makeRef(create(TextType, { content: faker.lorem.sentences(5) })),\n threads: [],\n }),\n );\n\n return obj;\n });\n\n cb?.(objects);\n return objects;\n },\n ],\n [\n DiagramType.typename,\n async (space, n, cb) => {\n const objects = range(n).map(() => {\n // TODO(burdon): Generate diagram.\n const obj = space.db.add(\n create(DiagramType, {\n name: faker.commerce.productName(),\n canvas: makeRef(create(CanvasType, { content: {} })),\n }),\n );\n\n return obj;\n });\n\n cb?.(objects);\n return objects;\n },\n ],\n // TODO(burdon): Create unit tests.\n [\n SheetType.typename,\n async (space, n, cb) => {\n const objects = range(n).map(() => {\n const cells: Record<string, CellValue> = {};\n const year = new Date().getFullYear();\n const cols = 4;\n const rows = 16;\n for (let col = 1; col <= cols; col++) {\n for (let row = 1; row <= rows; row++) {\n const cell = addressToA1Notation({ col, row });\n if (row === 1) {\n cells[cell] = { value: `${year} Q${col}` };\n } else if (row === rows) {\n const from = addressToA1Notation({ col, row: 2 });\n const to = addressToA1Notation({ col, row: rows - 1 });\n cells[cell] = { value: `=SUM(${from}:${to})` };\n } else if (row > 2 && row < rows - 1) {\n cells[cell] = { value: Math.floor(Math.random() * 10_000) };\n }\n }\n }\n\n // TODO(burdon): Set width.\n // TODO(burdon): Set formatting for columns.\n return space.db.add(\n createSheet({\n name: faker.commerce.productName(),\n cells,\n }),\n );\n });\n\n cb?.(objects);\n return objects;\n },\n ],\n]);\n\nexport const createGenerator = <T extends BaseObject>(type: TypedObject<T>): ObjectGenerator<T> => {\n return async (\n space: Space,\n n: number,\n cb?: (objects: ReactiveObject<any>[]) => void,\n ): Promise<ReactiveObject<T>[]> => {\n // Find or create mutable schema.\n const schema =\n (await space.db.schemaRegistry.query({ typename: type.typename }).firstOrUndefined()) ??\n (await space.db.schemaRegistry.register([type]))[0];\n\n // Create objects.\n const generate = createAsyncGenerator(generator, schema.getSchemaSnapshot(), { db: space.db });\n const objects = await generate.createObjects(n);\n\n // Find or create table and view.\n const { objects: tables } = await space.db.query(Filter.schema(TableType)).run();\n const table = tables.find((table) => table.view?.target?.query?.type === type.typename);\n if (!table) {\n const name = type.typename.split('/').pop() ?? type.typename;\n const view = createView({ name, typename: type.typename, jsonSchema: schema.jsonSchema });\n const table = space.db.add(create(TableType, { name, view: makeRef(view) }));\n cb?.([table]);\n }\n\n return objects;\n };\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React from 'react';\n\nimport { IconButton } from '@dxos/react-ui';\n\nexport type SchemaTableProps = {\n types: any[];\n objects?: Record<string, number | undefined>;\n label: string;\n onClick: (typename: string) => void;\n};\n\nexport const SchemaTable = ({ types, objects = {}, label, onClick }: SchemaTableProps) => {\n return (\n <div className='grid grid-cols-[1fr_80px_40px] gap-1 overflow-hidden'>\n <div className='grid grid-cols-subgrid col-span-3'>\n <div className='px-2 text-sm text-primary-500'>{label}</div>\n <div className='px-2 text-xs text-subdued text-right'>count</div>\n </div>\n {types.map((type) => (\n <div key={type.typename} className='grid grid-cols-subgrid col-span-3 items-center'>\n <div className='px-2 text-sm font-mono text-green-500'>{type.typename}</div>\n <div className='px-2 text-right font-mono'>{objects[type.typename] ?? 0}</div>\n <IconButton\n variant='ghost'\n icon='ph--plus--regular'\n iconOnly\n label='Create data'\n onClick={() => onClick(type.typename)}\n />\n </div>\n ))}\n </div>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { SpaceGenerator } from './SpaceGenerator';\n\nexport default SpaceGenerator;\n"],
|
|
5
|
+
"mappings": ";AAIA,OAAOA,UAASC,aAAaC,SAASC,gBAAgB;AAGtD,SAASC,gBAAAA,qBAAoB;AAC7B,SAASC,aAAAA,kBAAiB;AAC1B,SAASC,eAAAA,oBAAmB;AAC5B,SAASC,iBAAiB;AAC1B,SAASC,mBAA+B;AACxC,SAASC,cAAAA,aAAYC,OAAOC,SAASC,sBAAsB;AAC3D,SAASC,yBAAyB;AAClC,SAASC,eAAe;AACxB,SAASC,iBAAiBC,gBAAgB;;;ACX1C,SAASC,2BAA2B;AAEpC,SAASC,QAAQC,eAAoC;AACrD,SAASC,cAAcC,gBAAgB;AACvC,SAASC,mBAAmB;AAC5B,SAASC,iBAAiC;AAC1C,SAASC,YAAYC,mBAAmB;AACxC,SAAS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;AAEf,YAAMA,YAAYlD,OAAOa,OAAOZ,eAAAA;AAChC,YAAM2B,WAAAA;IACR;EACF,GACA;IAACV;IAASL;GAAM;AAGlB,SACE,gBAAAuC,OAAA,cAACC,OAAAA;IAAIC,MAAK;IAAOC,WAAU;KACzB,gBAAAH,OAAA,cAACI,QAAQC,MAAI;IAACC,YAAW;KACvB,gBAAAN,OAAA,cAACO,aAAAA;IAAWC,MAAK;IAA+BC,UAAAA;IAASC,OAAM;IAAUC,SAASnC;MAClF,gBAAAwB,OAAA,cAACI,QAAQQ,UAAQ,IAAA,GACjB,gBAAAZ,OAAA,cAACC,OAAAA;IAAIE,WAAU;KACb,gBAAAH,OAAA,cAACa,MAAMR,MAAI,MACT,gBAAAL,OAAA,cAACa,MAAMC,WAAS;IACd1C,MAAK;IACL2C,KAAK;IACLC,KAAK;IACLC,aAAa;IACbX,YAAW;IACXY,OAAOzD;IACP0D,UAAU,CAACC,OAAO1D,SAAS2D,SAASD,GAAGE,OAAOJ,KAAK,CAAA;SAM3D,gBAAAlB,OAAA,cAACuB,aAAAA;IAAYC,OAAOxE;IAAaiC,SAASrB,KAAKqB;IAASyB,OAAM;IAAeC,SAASf;MACtF,gBAAAI,OAAA,cAACuB,aAAAA;IAAYC,OAAOpE;IAAc6B,SAASrB,KAAKqB;IAASyB,OAAM;IAAgBC,SAASf;MAExF,gBAAAI,OAAA,cAACyB,mBAAAA;IAAkBnB,YAAW;IAAeoB,UAAS;KACnDC,KAAKC,UAAU;IAAEhF;IAAO,GAAGgB;EAAK,GAAGiE,gBAAgB;IAAEC,UAAU;EAAK,CAAA,GAAI,CAAA,CAAA,CAAA;AAIjF;;;AG1GA,IAAA,yBAAeC;",
|
|
6
|
+
"names": ["React", "useCallback", "useMemo", "useState", "DocumentType", "SheetType", "DiagramType", "useClient", "getTypename", "IconButton", "Input", "Toolbar", "useAsyncEffect", "SyntaxHighlighter", "Testing", "jsonKeyReplacer", "sortKeys", "addressToA1Notation", "create", "makeRef", "DocumentType", "TextType", "createSheet", "SheetType", "CanvasType", "DiagramType", "faker", "Filter", "TableType", "createView", "createAsyncGenerator", "range", "generator", "faker", "staticGenerators", "Map", "DocumentType", "typename", "space", "n", "cb", "objects", "range", "map", "obj", "db", "add", "create", "name", "commerce", "productName", "content", "makeRef", "TextType", "lorem", "sentences", "threads", "DiagramType", "canvas", "CanvasType", "SheetType", "cells", "year", "Date", "getFullYear", "cols", "rows", "col", "row", "cell", "addressToA1Notation", "value", "from", "to", "Math", "floor", "random", "createSheet", "createGenerator", "type", "schema", "schemaRegistry", "query", "firstOrUndefined", "register", "generate", "createAsyncGenerator", "getSchemaSnapshot", "createObjects", "tables", "Filter", "TableType", "run", "table", "find", "view", "target", "split", "pop", "createView", "jsonSchema", "React", "IconButton", "SchemaTable", "types", "objects", "label", "onClick", "div", "className", "map", "type", "key", "typename", "IconButton", "variant", "icon", "iconOnly", "SpaceGenerator", "space", "onCreateObjects", "client", "useClient", "staticTypes", "DocumentType", "DiagramType", "SheetType", "mutableTypes", "Testing", "OrgType", "ProjectType", "ContactType", "count", "setCount", "useState", "info", "setInfo", "typeMap", "useMemo", "addTypes", "mutableGenerators", "Map", "map", "type", "typename", "createGenerator", "staticGenerators", "updateInfo", "echoSchema", "db", "schemaRegistry", "query", "run", "staticSchema", "graph", "schemas", "objects", "objectMap", "sortKeys", "reduce", "obj", "getTypename", "schema", "static", "length", "mutable", "useAsyncEffect", "handleCreateData", "useCallback", "constructor", "get", "React", "div", "role", "className", "Toolbar", "Root", "classNames", "IconButton", "icon", "iconOnly", "label", "onClick", "Expander", "Input", "TextInput", "min", "max", "placeholder", "value", "onChange", "ev", "parseInt", "target", "SchemaTable", "types", "SyntaxHighlighter", "language", "JSON", "stringify", "jsonKeyReplacer", "truncate", "SpaceGenerator"]
|
|
7
|
+
}
|
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DEBUG_PLUGIN
|
|
3
|
-
} from "./chunk-CAENAAHY.mjs";
|
|
4
|
-
|
|
5
1
|
// packages/plugins/plugin-debug/src/types.ts
|
|
6
2
|
import { createContext } from "react";
|
|
7
3
|
import { S } from "@dxos/echo-schema";
|
|
8
|
-
var DEBUG_ACTION = `${DEBUG_PLUGIN}/action`;
|
|
9
|
-
var DebugAction;
|
|
10
|
-
(function(DebugAction2) {
|
|
11
|
-
DebugAction2[DebugAction2["OPEN_DEVTOOLS"] = `${DEBUG_ACTION}/open-devtools`] = "OPEN_DEVTOOLS";
|
|
12
|
-
})(DebugAction || (DebugAction = {}));
|
|
13
4
|
var DebugContext = createContext({
|
|
14
5
|
running: false,
|
|
15
6
|
start: () => {
|
|
@@ -24,8 +15,7 @@ var DebugSettingsSchema = S.mutable(S.Struct({
|
|
|
24
15
|
}));
|
|
25
16
|
|
|
26
17
|
export {
|
|
27
|
-
DebugAction,
|
|
28
18
|
DebugContext,
|
|
29
19
|
DebugSettingsSchema
|
|
30
20
|
};
|
|
31
|
-
//# sourceMappingURL=chunk-
|
|
21
|
+
//# sourceMappingURL=chunk-6CGQHKET.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/types.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Context, createContext } from 'react';\n\nimport type {\n GraphBuilderProvides,\n SettingsProvides,\n SurfaceProvides,\n TranslationsProvides,\n} from '@dxos/app-framework';\nimport type { TimerCallback, TimerOptions } from '@dxos/async';\nimport { S } from '@dxos/echo-schema';\nimport { type PanelProvides } from '@dxos/plugin-deck/types';\n\nexport type DebugContextType = {\n running: boolean;\n start: (cb: TimerCallback, options: TimerOptions) => void;\n stop: () => void;\n};\n\nexport const DebugContext: Context<DebugContextType> = createContext<DebugContextType>({\n running: false,\n start: () => {},\n stop: () => {},\n});\n\nexport const DebugSettingsSchema = S.mutable(\n S.Struct({\n devtools: S.optional(S.Boolean),\n debug: S.optional(S.Boolean),\n wireframe: S.optional(S.Boolean),\n }),\n);\n\nexport interface DebugSettingsProps extends S.Schema.Type<typeof DebugSettingsSchema> {}\n\nexport type DebugPluginProvides = SurfaceProvides &\n GraphBuilderProvides &\n SettingsProvides<DebugSettingsProps> &\n TranslationsProvides &\n PanelProvides;\n"],
|
|
5
|
+
"mappings": ";AAIA,SAAuBA,qBAAqB;AAS5C,SAASC,SAAS;AASX,IAAMC,eAA0CC,cAAgC;EACrFC,SAAS;EACTC,OAAO,MAAA;EAAO;EACdC,MAAM,MAAA;EAAO;AACf,CAAA;AAEO,IAAMC,sBAAsBC,EAAEC,QACnCD,EAAEE,OAAO;EACPC,UAAUH,EAAEI,SAASJ,EAAEK,OAAO;EAC9BC,OAAON,EAAEI,SAASJ,EAAEK,OAAO;EAC3BE,WAAWP,EAAEI,SAASJ,EAAEK,OAAO;AACjC,CAAA,CAAA;",
|
|
6
|
+
"names": ["createContext", "S", "DebugContext", "createContext", "running", "start", "stop", "DebugSettingsSchema", "S", "mutable", "Struct", "devtools", "optional", "Boolean", "debug", "wireframe"]
|
|
7
|
+
}
|
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DebugAction,
|
|
3
|
-
DebugContext,
|
|
4
|
-
DebugSettingsSchema
|
|
5
|
-
} from "./chunk-LZEK532R.mjs";
|
|
6
1
|
import {
|
|
7
2
|
DEBUG_PLUGIN,
|
|
8
3
|
meta_default
|
|
9
4
|
} from "./chunk-CAENAAHY.mjs";
|
|
5
|
+
import {
|
|
6
|
+
DebugContext,
|
|
7
|
+
DebugSettingsSchema
|
|
8
|
+
} from "./chunk-6CGQHKET.mjs";
|
|
10
9
|
|
|
11
10
|
// packages/plugins/plugin-debug/src/DebugPlugin.tsx
|
|
12
|
-
import React5, { useEffect as useEffect3, useState as useState3 } from "react";
|
|
13
|
-
import { definePlugin, parseGraphPlugin as parseGraphPlugin2, parseIntentPlugin, parseMetadataResolverPlugin, parseSettingsPlugin, resolvePlugin } from "@dxos/app-framework";
|
|
11
|
+
import React5, { useCallback, useEffect as useEffect3, useState as useState3 } from "react";
|
|
12
|
+
import { createIntent, createSurface, definePlugin, parseGraphPlugin as parseGraphPlugin2, parseIntentPlugin, parseMetadataResolverPlugin, parseSettingsPlugin, resolvePlugin } from "@dxos/app-framework";
|
|
14
13
|
import { Timer } from "@dxos/async";
|
|
15
14
|
import { Devtools } from "@dxos/devtools";
|
|
16
15
|
import { invariant } from "@dxos/invariant";
|
|
17
|
-
import { parseClientPlugin } from "@dxos/plugin-client";
|
|
16
|
+
import { parseClientPlugin } from "@dxos/plugin-client/types";
|
|
18
17
|
import { createExtension, Graph, toSignal } from "@dxos/plugin-graph";
|
|
19
18
|
import { memoizeQuery, SpaceAction } from "@dxos/plugin-space";
|
|
20
19
|
import { CollectionType } from "@dxos/plugin-space/types";
|
|
21
20
|
import { create, getTypename, isEchoObject, isSpace, parseId, SpaceState } from "@dxos/react-client/echo";
|
|
22
|
-
import { Main } from "@dxos/react-ui";
|
|
23
|
-
import { baseSurface, bottombarBlockPaddingEnd, fixedInsetFlexLayout, topbarBlockPaddingStart } from "@dxos/react-ui-theme";
|
|
24
21
|
|
|
25
22
|
// packages/plugins/plugin-debug/src/components/index.ts
|
|
26
23
|
import { lazy } from "react";
|
|
@@ -158,7 +155,7 @@ var DebugSettings = ({ settings }) => {
|
|
|
158
155
|
}), /* @__PURE__ */ React2.createElement("span", null, toast.title)), toast.description && /* @__PURE__ */ React2.createElement(Toast.Description, null, toast.description))), /* @__PURE__ */ React2.createElement(DeprecatedFormInput, {
|
|
159
156
|
label: t("settings choose storage adaptor")
|
|
160
157
|
}, /* @__PURE__ */ React2.createElement(Select.Root, {
|
|
161
|
-
value: Object.entries(StorageAdapters).find(([
|
|
158
|
+
value: Object.entries(StorageAdapters).find(([name2, value]) => value === storageConfig?.runtime?.client?.storage?.dataStore)?.[0],
|
|
162
159
|
onValueChange: (value) => {
|
|
163
160
|
if (confirm(t("settings storage adapter changed alert"))) {
|
|
164
161
|
updateConfig(storageConfig, setStorageConfig, [
|
|
@@ -387,8 +384,8 @@ var Wireframe = ({ classNames, label, object }) => {
|
|
|
387
384
|
|
|
388
385
|
// packages/plugins/plugin-debug/src/components/index.ts
|
|
389
386
|
var DebugApp = lazy(() => import("./DebugApp-HCHR6GKO.mjs"));
|
|
390
|
-
var DebugSpace = lazy(() => import("./DebugSpace-
|
|
391
|
-
var SpaceGenerator = lazy(() => import("./SpaceGenerator-
|
|
387
|
+
var DebugSpace = lazy(() => import("./DebugSpace-V3K3PQP6.mjs"));
|
|
388
|
+
var SpaceGenerator = lazy(() => import("./SpaceGenerator-Y2NXBQVR.mjs"));
|
|
392
389
|
|
|
393
390
|
// packages/plugins/plugin-debug/src/translations.ts
|
|
394
391
|
var translations_default = [
|
|
@@ -424,6 +421,8 @@ var translations_default = [
|
|
|
424
421
|
|
|
425
422
|
// packages/plugins/plugin-debug/src/DebugPlugin.tsx
|
|
426
423
|
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-debug/src/DebugPlugin.tsx";
|
|
424
|
+
var isSpaceDebug = (data) => data.type === `${DEBUG_PLUGIN}/space` && isSpace(data.space);
|
|
425
|
+
var isGraphDebug = (data) => data.graph instanceof Graph;
|
|
427
426
|
var DebugPlugin = definePlugin((context) => {
|
|
428
427
|
const settings = create({
|
|
429
428
|
debug: true,
|
|
@@ -431,7 +430,7 @@ var DebugPlugin = definePlugin((context) => {
|
|
|
431
430
|
});
|
|
432
431
|
return {
|
|
433
432
|
meta: meta_default,
|
|
434
|
-
ready: async (plugins) => {
|
|
433
|
+
ready: async ({ plugins }) => {
|
|
435
434
|
context.init(plugins);
|
|
436
435
|
context.resolvePlugin(parseSettingsPlugin).provides.settingsStore.createStore({
|
|
437
436
|
schema: DebugSettingsSchema,
|
|
@@ -498,7 +497,7 @@ var DebugPlugin = definePlugin((context) => {
|
|
|
498
497
|
const client = clientPlugin?.provides.client;
|
|
499
498
|
invariant(resolve, void 0, {
|
|
500
499
|
F: __dxlog_file3,
|
|
501
|
-
L:
|
|
500
|
+
L: 130,
|
|
502
501
|
S: void 0,
|
|
503
502
|
A: [
|
|
504
503
|
"resolve",
|
|
@@ -507,7 +506,7 @@ var DebugPlugin = definePlugin((context) => {
|
|
|
507
506
|
});
|
|
508
507
|
invariant(client, void 0, {
|
|
509
508
|
F: __dxlog_file3,
|
|
510
|
-
L:
|
|
509
|
+
L: 131,
|
|
511
510
|
S: void 0,
|
|
512
511
|
A: [
|
|
513
512
|
"client",
|
|
@@ -566,11 +565,11 @@ var DebugPlugin = definePlugin((context) => {
|
|
|
566
565
|
filter: (node) => !!settings.debug && isSpace(node.data),
|
|
567
566
|
connector: ({ node }) => {
|
|
568
567
|
const space = node.data;
|
|
569
|
-
const state = toSignal((onChange) => space.state.subscribe(() => onChange()).unsubscribe, () => space.state.get());
|
|
568
|
+
const state = toSignal((onChange) => space.state.subscribe(() => onChange()).unsubscribe, () => space.state.get(), space.id);
|
|
570
569
|
if (state !== SpaceState.SPACE_READY) {
|
|
571
570
|
return;
|
|
572
571
|
}
|
|
573
|
-
const collection = space.properties[CollectionType.typename];
|
|
572
|
+
const collection = space.properties[CollectionType.typename]?.target;
|
|
574
573
|
if (!collection) {
|
|
575
574
|
return;
|
|
576
575
|
}
|
|
@@ -661,114 +660,90 @@ var DebugPlugin = definePlugin((context) => {
|
|
|
661
660
|
];
|
|
662
661
|
}
|
|
663
662
|
},
|
|
664
|
-
intent: {
|
|
665
|
-
resolver: async (intent, plugins) => {
|
|
666
|
-
switch (intent.action) {
|
|
667
|
-
case DebugAction.OPEN_DEVTOOLS: {
|
|
668
|
-
const clientPlugin = context.getPlugin("dxos.org/plugin/client");
|
|
669
|
-
const client = clientPlugin.provides.client;
|
|
670
|
-
const vaultUrl = client.config.values?.runtime?.client?.remoteSource ?? "https://halo.dxos.org";
|
|
671
|
-
let devtoolsUrl = "http://localhost:5174";
|
|
672
|
-
try {
|
|
673
|
-
await fetch(devtoolsUrl);
|
|
674
|
-
} catch {
|
|
675
|
-
const isDev = window.location.href.includes(".dev.") || window.location.href.includes("localhost");
|
|
676
|
-
devtoolsUrl = `https://devtools${isDev ? ".dev." : "."}dxos.org`;
|
|
677
|
-
}
|
|
678
|
-
window.open(`${devtoolsUrl}?target=${vaultUrl}`, "_blank");
|
|
679
|
-
return {
|
|
680
|
-
data: true
|
|
681
|
-
};
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
},
|
|
686
663
|
surface: {
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
|
|
664
|
+
definitions: () => [
|
|
665
|
+
createSurface({
|
|
666
|
+
id: `${DEBUG_PLUGIN}/settings`,
|
|
667
|
+
role: "settings",
|
|
668
|
+
filter: (data) => data.subject === DEBUG_PLUGIN,
|
|
669
|
+
component: () => /* @__PURE__ */ React5.createElement(DebugSettings, {
|
|
670
|
+
settings
|
|
671
|
+
})
|
|
672
|
+
}),
|
|
673
|
+
createSurface({
|
|
674
|
+
id: `${DEBUG_PLUGIN}/status`,
|
|
675
|
+
role: "status",
|
|
676
|
+
component: () => /* @__PURE__ */ React5.createElement(DebugStatus, null)
|
|
677
|
+
}),
|
|
678
|
+
createSurface({
|
|
679
|
+
id: `${DEBUG_PLUGIN}/complementary`,
|
|
680
|
+
role: "complementary--debug",
|
|
681
|
+
filter: (data) => isEchoObject(data.subject),
|
|
682
|
+
component: ({ data }) => /* @__PURE__ */ React5.createElement(DebugObjectPanel, {
|
|
683
|
+
object: data.subject
|
|
684
|
+
})
|
|
685
|
+
}),
|
|
686
|
+
createSurface({
|
|
687
|
+
id: `${DEBUG_PLUGIN}/devtools`,
|
|
688
|
+
role: "article",
|
|
689
|
+
filter: (data) => data.subject === "devtools" && !!settings.devtools,
|
|
690
|
+
component: () => /* @__PURE__ */ React5.createElement(Devtools, null)
|
|
691
|
+
}),
|
|
692
|
+
createSurface({
|
|
693
|
+
id: `${DEBUG_PLUGIN}/space`,
|
|
694
|
+
role: "article",
|
|
695
|
+
filter: (data) => isSpaceDebug(data.subject),
|
|
696
|
+
component: ({ data }) => {
|
|
697
|
+
const handleCreateObject = useCallback((objects) => {
|
|
698
|
+
if (!isSpace(data.subject.space)) {
|
|
710
699
|
return;
|
|
711
700
|
}
|
|
712
|
-
const collection =
|
|
701
|
+
const collection = data.subject.space.state.get() === SpaceState.SPACE_READY && data.subject.space.properties[CollectionType.typename]?.target;
|
|
713
702
|
if (!(collection instanceof CollectionType)) {
|
|
714
703
|
return;
|
|
715
704
|
}
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
data: {
|
|
705
|
+
objects.forEach((object) => {
|
|
706
|
+
void context.resolvePlugin(parseIntentPlugin).provides.intent.dispatchPromise(createIntent(SpaceAction.AddObject, {
|
|
719
707
|
target: collection,
|
|
720
708
|
object
|
|
721
|
-
}
|
|
722
|
-
})
|
|
723
|
-
}
|
|
709
|
+
}));
|
|
710
|
+
});
|
|
711
|
+
}, [
|
|
712
|
+
data.subject.space
|
|
713
|
+
]);
|
|
724
714
|
const deprecated = false;
|
|
725
|
-
|
|
726
|
-
space:
|
|
715
|
+
return deprecated ? /* @__PURE__ */ React5.createElement(DebugSpace, {
|
|
716
|
+
space: data.subject.space,
|
|
727
717
|
onAddObjects: handleCreateObject
|
|
728
718
|
}) : /* @__PURE__ */ React5.createElement(SpaceGenerator, {
|
|
729
|
-
space:
|
|
719
|
+
space: data.subject.space,
|
|
730
720
|
onCreateObjects: handleCreateObject
|
|
731
721
|
});
|
|
732
|
-
} else if ("graph" in primary && primary.graph instanceof Graph) {
|
|
733
|
-
component = /* @__PURE__ */ React5.createElement(DebugApp, {
|
|
734
|
-
graph: primary.graph
|
|
735
|
-
});
|
|
736
|
-
}
|
|
737
|
-
}
|
|
738
|
-
if (!component) {
|
|
739
|
-
if (settings.wireframe) {
|
|
740
|
-
if (role === "main" || role === "article" || role === "section") {
|
|
741
|
-
const primary2 = data.active ?? data.object;
|
|
742
|
-
const isCollection = primary2 instanceof CollectionType;
|
|
743
|
-
if (!isCollection) {
|
|
744
|
-
return {
|
|
745
|
-
node: /* @__PURE__ */ React5.createElement(Wireframe, {
|
|
746
|
-
label: `${role}:${name}`,
|
|
747
|
-
object: primary2,
|
|
748
|
-
classNames: "row-span-2 overflow-hidden"
|
|
749
|
-
}),
|
|
750
|
-
disposition: "hoist"
|
|
751
|
-
};
|
|
752
|
-
}
|
|
753
|
-
}
|
|
754
722
|
}
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
723
|
+
}),
|
|
724
|
+
createSurface({
|
|
725
|
+
id: `${DEBUG_PLUGIN}/graph`,
|
|
726
|
+
role: "article",
|
|
727
|
+
filter: (data) => isGraphDebug(data.subject),
|
|
728
|
+
component: ({ data }) => /* @__PURE__ */ React5.createElement(DebugApp, {
|
|
729
|
+
graph: data.subject.graph
|
|
730
|
+
})
|
|
731
|
+
}),
|
|
732
|
+
createSurface({
|
|
733
|
+
id: `${DEBUG_PLUGIN}/wireframe`,
|
|
734
|
+
role: [
|
|
735
|
+
"article",
|
|
736
|
+
"section"
|
|
737
|
+
],
|
|
738
|
+
disposition: "hoist",
|
|
739
|
+
filter: (data) => isEchoObject(data.subject) && !!settings.wireframe,
|
|
740
|
+
component: ({ data, role }) => /* @__PURE__ */ React5.createElement(Wireframe, {
|
|
741
|
+
label: `${role}:${name}`,
|
|
742
|
+
object: data.subject,
|
|
743
|
+
classNames: "row-span-2 overflow-hidden"
|
|
744
|
+
})
|
|
745
|
+
})
|
|
746
|
+
]
|
|
772
747
|
}
|
|
773
748
|
}
|
|
774
749
|
};
|