@dxos/plugin-debug 0.7.5-main.9d2a38b → 0.7.5-main.ff8607b

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 (38) hide show
  1. package/dist/lib/browser/{app-graph-builder-FXELWOFS.mjs → app-graph-builder-66ZVNTDI.mjs} +8 -3
  2. package/dist/lib/browser/app-graph-builder-66ZVNTDI.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-EF3UVAVI.mjs +21 -0
  4. package/dist/lib/browser/chunk-EF3UVAVI.mjs.map +7 -0
  5. package/dist/lib/browser/index.mjs +5 -11
  6. package/dist/lib/browser/index.mjs.map +3 -3
  7. package/dist/lib/browser/meta.json +1 -1
  8. package/dist/lib/browser/{react-surface-5GNO6NWP.mjs → react-surface-VEEFOGIM.mjs} +53 -50
  9. package/dist/lib/browser/react-surface-VEEFOGIM.mjs.map +7 -0
  10. package/dist/lib/browser/{settings-JCZUA643.mjs → settings-OIMSBZUC.mjs} +2 -2
  11. package/dist/types/src/DebugPlugin.d.ts.map +1 -1
  12. package/dist/types/src/capabilities/app-graph-builder.d.ts +22 -22
  13. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  14. package/dist/types/src/capabilities/index.d.ts +26 -31
  15. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  16. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  17. package/dist/types/src/components/DebugSettings.d.ts.map +1 -1
  18. package/dist/types/src/components/DebugStatus.d.ts.map +1 -1
  19. package/dist/types/src/meta.d.ts +1 -0
  20. package/dist/types/src/meta.d.ts.map +1 -1
  21. package/package.json +43 -42
  22. package/src/DebugPlugin.tsx +2 -7
  23. package/src/capabilities/app-graph-builder.ts +6 -1
  24. package/src/capabilities/index.ts +0 -1
  25. package/src/capabilities/react-surface.tsx +7 -15
  26. package/src/components/DebugSettings.tsx +7 -9
  27. package/src/components/DebugStatus.tsx +17 -21
  28. package/src/meta.ts +3 -1
  29. package/dist/lib/browser/app-graph-builder-FXELWOFS.mjs.map +0 -7
  30. package/dist/lib/browser/chunk-I3ON45JK.mjs +0 -18
  31. package/dist/lib/browser/chunk-I3ON45JK.mjs.map +0 -7
  32. package/dist/lib/browser/react-context-OZU6J7G3.mjs +0 -37
  33. package/dist/lib/browser/react-context-OZU6J7G3.mjs.map +0 -7
  34. package/dist/lib/browser/react-surface-5GNO6NWP.mjs.map +0 -7
  35. package/dist/types/src/capabilities/react-context.d.ts +0 -8
  36. package/dist/types/src/capabilities/react-context.d.ts.map +0 -1
  37. package/src/capabilities/react-context.tsx +0 -38
  38. /package/dist/lib/browser/{settings-JCZUA643.mjs.map → settings-OIMSBZUC.mjs.map} +0 -0
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/app-graph-builder.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { contributes, Capabilities, type PluginsContext } from '@dxos/app-framework';\nimport { ClientCapabilities } from '@dxos/plugin-client';\nimport { createExtension, toSignal, type Node } from '@dxos/plugin-graph';\nimport { memoizeQuery } from '@dxos/plugin-space';\nimport { CollectionType } from '@dxos/plugin-space/types';\nimport { getTypename, parseId, SpaceState } from '@dxos/react-client/echo';\nimport { isSpace, type Space } from '@dxos/react-client/echo';\n\nimport { DEBUG_PLUGIN } from '../meta';\nimport { type DebugSettingsProps } from '../types';\n\nexport default (context: PluginsContext) => {\n const resolve = (typename: string) =>\n context.requestCapabilities(Capabilities.Metadata).find(({ id }) => id === typename)?.metadata ?? {};\n\n return contributes(Capabilities.AppGraphBuilder, [\n // Devtools node.\n createExtension({\n id: 'dxos.org/plugin/debug/devtools',\n filter: (node): node is Node<null> => {\n const settings = context\n .requestCapabilities(Capabilities.SettingsStore)[0]\n ?.getStore<DebugSettingsProps>(DEBUG_PLUGIN)?.value;\n return !!settings?.devtools && node.id === 'root';\n },\n connector: () => [\n {\n // TODO(zan): Removed `/` because it breaks deck layout reload. Fix?\n id: 'dxos.org.plugin.debug.devtools',\n data: 'devtools',\n type: 'dxos.org/plugin/debug/devtools',\n properties: {\n label: ['devtools label', { ns: DEBUG_PLUGIN }],\n icon: 'ph--hammer--regular',\n },\n },\n ],\n }),\n\n // Debug node.\n createExtension({\n id: 'dxos.org/plugin/debug/debug',\n filter: (node): node is Node<null> => {\n const settings = context\n .requestCapabilities(Capabilities.SettingsStore)[0]\n ?.getStore<DebugSettingsProps>(DEBUG_PLUGIN)?.value;\n return !!settings?.debug && node.id === 'root';\n },\n connector: () => {\n const graph = context.requestCapability(Capabilities.AppGraph);\n\n return [\n {\n id: 'dxos.org/plugin/debug/debug',\n type: 'dxos.org/plugin/debug/debug',\n data: { graph },\n properties: {\n label: ['debug label', { ns: DEBUG_PLUGIN }],\n icon: 'ph--bug--regular',\n },\n },\n ];\n },\n }),\n\n // Space debug nodes.\n createExtension({\n id: 'dxos.org/plugin/debug/spaces',\n filter: (node): node is Node<Space> => {\n const settings = context\n .requestCapabilities(Capabilities.SettingsStore)[0]\n ?.getStore<DebugSettingsProps>(DEBUG_PLUGIN)?.value;\n return !!settings?.debug && isSpace(node.data);\n },\n connector: ({ node }) => {\n const space = node.data;\n const state = toSignal(\n (onChange) => space.state.subscribe(() => onChange()).unsubscribe,\n () => space.state.get(),\n space.id,\n );\n if (state !== SpaceState.SPACE_READY) {\n return;\n }\n\n // Not adding the debug node until the root collection is available aligns the behaviour of this\n // extension with that of the space plugin adding objects. This ensures that the debug node is added at\n // the same time as objects and prevents order from changing as the nodes are added.\n const collection = space.properties[CollectionType.typename]?.target as CollectionType | undefined;\n if (!collection) {\n return;\n }\n\n return [\n {\n id: `${space.id}-debug`, // TODO(burdon): Change to slashes consistently.\n type: 'dxos.org/plugin/debug/space',\n data: { space, type: 'dxos.org/plugin/debug/space' },\n properties: {\n label: ['debug label', { ns: DEBUG_PLUGIN }],\n icon: 'ph--bug--regular',\n },\n },\n ];\n },\n }),\n\n // Create nodes for debug sidebar.\n createExtension({\n id: `${DEBUG_PLUGIN}/debug-for-subject`,\n resolver: ({ id }) => {\n // TODO(Zan): Find util (or make one).\n if (!id.endsWith('~debug')) {\n return;\n }\n\n const type = 'orphan-settings-for-subject';\n const icon = 'ph--bug--regular';\n\n const client = context.requestCapability(ClientCapabilities.Client);\n const [subjectId] = id.split('~');\n const { spaceId, objectId } = parseId(subjectId);\n const spaces = toSignal(\n (onChange) => client.spaces.subscribe(() => onChange()).unsubscribe,\n () => client.spaces.get(),\n );\n const space = spaces?.find((space) => space.state.get() === SpaceState.SPACE_READY && space.id === spaceId);\n if (!objectId) {\n // TODO(burdon): Ref SPACE_PLUGIN ns.\n const label = space\n ? space.properties.name || ['unnamed space label', { ns: DEBUG_PLUGIN }]\n : ['unnamed object settings label', { ns: DEBUG_PLUGIN }];\n\n // TODO(wittjosiah): Support comments for arbitrary subjects.\n // This is to ensure that the comments panel is not stuck on an old object.\n return {\n id,\n type,\n data: null,\n properties: {\n icon,\n label,\n showResolvedThreads: false,\n object: null,\n space,\n },\n };\n }\n\n const [object] = memoizeQuery(space, { id: objectId });\n if (!object || !subjectId) {\n return;\n }\n\n const meta = resolve(getTypename(object) ?? '');\n const label = meta.label?.(object) ||\n object.name ||\n meta.placeholder || ['unnamed object settings label', { ns: DEBUG_PLUGIN }];\n\n return {\n id,\n type,\n data: null,\n properties: {\n icon,\n label,\n object,\n },\n };\n },\n }),\n ]);\n};\n"],
5
- "mappings": ";;;;;AAIA,SAASA,aAAaC,oBAAyC;AAC/D,SAASC,0BAA0B;AACnC,SAASC,iBAAiBC,gBAA2B;AACrD,SAASC,oBAAoB;AAC7B,SAASC,sBAAsB;AAC/B,SAASC,aAAaC,SAASC,kBAAkB;AACjD,SAASC,eAA2B;AAKpC,IAAA,4BAAe,CAACC,YAAAA;AACd,QAAMC,UAAU,CAACC,aACfF,QAAQG,oBAAoBC,aAAaC,QAAQ,EAAEC,KAAK,CAAC,EAAEC,GAAE,MAAOA,OAAOL,QAAAA,GAAWM,YAAY,CAAC;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ACAgC,qBAAqB;cACrBC,QAAQ;cACRzB;YACF;UACF;QACF;AAEA,cAAM,CAACyB,MAAAA,IAAUC,aAAa1B,OAAO;UAAEzB,IAAI6C;QAAS,CAAA;AACpD,YAAI,CAACK,UAAU,CAACR,WAAW;AACzB;QACF;AAEA,cAAMU,OAAO1D,QAAQ2D,YAAYH,MAAAA,KAAW,EAAA;AAC5C,cAAMjC,QAAQmC,KAAKnC,QAAQiC,MAAAA,KACzBA,OAAOF,QACPI,KAAKE,eAAe;UAAC;UAAiC;YAAEpC,IAAIR;UAAa;;AAE3E,eAAO;UACLV;UACAe;UACAD,MAAM;UACNE,YAAY;YACVG;YACAF;YACAiC;UACF;QACF;MACF;IACF,CAAA;GACD;AACH;",
6
- "names": ["contributes", "Capabilities", "ClientCapabilities", "createExtension", "toSignal", "memoizeQuery", "CollectionType", "getTypename", "parseId", "SpaceState", "isSpace", "context", "resolve", "typename", "requestCapabilities", "Capabilities", "Metadata", "find", "id", "metadata", "contributes", "AppGraphBuilder", "createExtension", "filter", "node", "settings", "SettingsStore", "getStore", "DEBUG_PLUGIN", "value", "devtools", "connector", "data", "type", "properties", "label", "ns", "icon", "debug", "graph", "requestCapability", "AppGraph", "isSpace", "space", "state", "toSignal", "onChange", "subscribe", "unsubscribe", "get", "SpaceState", "SPACE_READY", "collection", "CollectionType", "target", "resolver", "endsWith", "client", "ClientCapabilities", "Client", "subjectId", "split", "spaceId", "objectId", "parseId", "spaces", "name", "showResolvedThreads", "object", "memoizeQuery", "meta", "getTypename", "placeholder"]
7
- }
@@ -1,18 +0,0 @@
1
- // packages/plugins/plugin-debug/src/meta.ts
2
- var DEBUG_PLUGIN = "dxos.org/plugin/debug";
3
- var meta = {
4
- id: DEBUG_PLUGIN,
5
- name: "Debug",
6
- description: "DXOS debugging tools.",
7
- icon: "ph--bug--regular",
8
- source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-debug",
9
- tags: [
10
- "experimental"
11
- ]
12
- };
13
-
14
- export {
15
- DEBUG_PLUGIN,
16
- meta
17
- };
18
- //# sourceMappingURL=chunk-I3ON45JK.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/meta.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const DEBUG_PLUGIN = 'dxos.org/plugin/debug';\n\nexport const meta = {\n id: DEBUG_PLUGIN,\n name: 'Debug',\n description: 'DXOS debugging tools.',\n icon: 'ph--bug--regular',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-debug',\n tags: ['experimental'],\n} satisfies PluginMeta;\n"],
5
- "mappings": ";AAMO,IAAMA,eAAe;AAErB,IAAMC,OAAO;EAClBC,IAAIF;EACJG,MAAM;EACNC,aAAa;EACbC,MAAM;EACNC,QAAQ;EACRC,MAAM;IAAC;;AACT;",
6
- "names": ["DEBUG_PLUGIN", "meta", "id", "name", "description", "icon", "source", "tags"]
7
- }
@@ -1,37 +0,0 @@
1
- import {
2
- DebugContext
3
- } from "./chunk-P7GHHMDB.mjs";
4
- import {
5
- DEBUG_PLUGIN
6
- } from "./chunk-I3ON45JK.mjs";
7
-
8
- // packages/plugins/plugin-debug/src/capabilities/react-context.tsx
9
- import React, { useEffect, useState } from "react";
10
- import { Capabilities, contributes } from "@dxos/app-framework";
11
- import { Timer } from "@dxos/async";
12
- var react_context_default = () => contributes(Capabilities.ReactContext, {
13
- id: DEBUG_PLUGIN,
14
- context: ({ children }) => {
15
- const [timer, setTimer] = useState();
16
- useEffect(() => timer?.state.on((value) => !value && setTimer(void 0)), [
17
- timer
18
- ]);
19
- useEffect(() => {
20
- timer?.stop();
21
- }, []);
22
- return /* @__PURE__ */ React.createElement(DebugContext.Provider, {
23
- value: {
24
- running: !!timer,
25
- start: (cb, options) => {
26
- timer?.stop();
27
- setTimer(new Timer(cb).start(options));
28
- },
29
- stop: () => timer?.stop()
30
- }
31
- }, children);
32
- }
33
- });
34
- export {
35
- react_context_default as default
36
- };
37
- //# sourceMappingURL=react-context-OZU6J7G3.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/react-context.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { useEffect, useState } from 'react';\n\nimport { Capabilities, contributes } from '@dxos/app-framework';\nimport { Timer } from '@dxos/async';\n\nimport { DEBUG_PLUGIN } from '../meta';\nimport { DebugContext } from '../types';\n\nexport default () =>\n contributes(Capabilities.ReactContext, {\n id: DEBUG_PLUGIN,\n context: ({ children }) => {\n const [timer, setTimer] = useState<Timer>();\n useEffect(() => timer?.state.on((value) => !value && setTimer(undefined)), [timer]);\n useEffect(() => {\n timer?.stop();\n }, []);\n\n return (\n <DebugContext.Provider\n value={{\n running: !!timer,\n start: (cb, options) => {\n timer?.stop();\n setTimer(new Timer(cb).start(options));\n },\n stop: () => timer?.stop(),\n }}\n >\n {children}\n </DebugContext.Provider>\n );\n },\n });\n"],
5
- "mappings": ";;;;;;;;AAIA,OAAOA,SAASC,WAAWC,gBAAgB;AAE3C,SAASC,cAAcC,mBAAmB;AAC1C,SAASC,aAAa;AAKtB,IAAA,wBAAe,MACbC,YAAYC,aAAaC,cAAc;EACrCC,IAAIC;EACJC,SAAS,CAAC,EAAEC,SAAQ,MAAE;AACpB,UAAM,CAACC,OAAOC,QAAAA,IAAYC,SAAAA;AAC1BC,cAAU,MAAMH,OAAOI,MAAMC,GAAG,CAACC,UAAU,CAACA,SAASL,SAASM,MAAAA,CAAAA,GAAa;MAACP;KAAM;AAClFG,cAAU,MAAA;AACRH,aAAOQ,KAAAA;IACT,GAAG,CAAA,CAAE;AAEL,WACE,sBAAA,cAACC,aAAaC,UAAQ;MACpBJ,OAAO;QACLK,SAAS,CAAC,CAACX;QACXY,OAAO,CAACC,IAAIC,YAAAA;AACVd,iBAAOQ,KAAAA;AACPP,mBAAS,IAAIc,MAAMF,EAAAA,EAAID,MAAME,OAAAA,CAAAA;QAC/B;QACAN,MAAM,MAAMR,OAAOQ,KAAAA;MACrB;OAECT,QAAAA;EAGP;AACF,CAAA;",
6
- "names": ["React", "useEffect", "useState", "Capabilities", "contributes", "Timer", "contributes", "Capabilities", "ReactContext", "id", "DEBUG_PLUGIN", "context", "children", "timer", "setTimer", "useState", "useEffect", "state", "on", "value", "undefined", "stop", "DebugContext", "Provider", "running", "start", "cb", "options", "Timer"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/react-surface.tsx", "../../../src/components/index.ts", "../../../src/components/DebugObjectPanel.tsx", "../../../src/components/DebugSettings.tsx", "../../../src/components/DebugStatus.tsx", "../../../src/components/Wireframe.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { useCallback } from 'react';\n\nimport {\n Capabilities,\n contributes,\n createIntent,\n createSurface,\n useCapability,\n type PluginsContext,\n} from '@dxos/app-framework';\nimport { Devtools } from '@dxos/devtools';\nimport { Graph } from '@dxos/plugin-graph';\nimport { SpaceAction, CollectionType } from '@dxos/plugin-space/types';\nimport {\n SpaceState,\n isSpace,\n isEchoObject,\n type ReactiveEchoObject,\n type ReactiveObject,\n type Space,\n} from '@dxos/react-client/echo';\n\nimport {\n DebugApp,\n DebugObjectPanel,\n DebugSettings,\n DebugSpace,\n DebugStatus,\n SpaceGenerator,\n Wireframe,\n} from '../components';\nimport { DEBUG_PLUGIN } from '../meta';\nimport { type DebugSettingsProps } from '../types';\n\ntype SpaceDebug = {\n type: string;\n space: Space;\n};\n\ntype GraphDebug = {\n graph: Graph;\n};\n\nconst isSpaceDebug = (data: any): data is SpaceDebug => data.type === `${DEBUG_PLUGIN}/space` && isSpace(data.space);\nconst isGraphDebug = (data: any): data is GraphDebug => data.graph instanceof Graph;\n\nexport default (context: PluginsContext) =>\n contributes(Capabilities.ReactSurface, [\n createSurface({\n id: `${DEBUG_PLUGIN}/settings`,\n role: 'settings',\n filter: (data): data is any => data.subject === DEBUG_PLUGIN,\n component: () => {\n const settings = useCapability(Capabilities.SettingsStore).getStore<DebugSettingsProps>(DEBUG_PLUGIN)!.value;\n return <DebugSettings settings={settings} />;\n },\n }),\n createSurface({\n id: `${DEBUG_PLUGIN}/status`,\n role: 'status',\n component: () => <DebugStatus />,\n }),\n createSurface({\n id: `${DEBUG_PLUGIN}/complementary`,\n role: 'complementary--debug',\n filter: (data): data is { subject: ReactiveEchoObject<any> } => isEchoObject(data.subject),\n component: ({ data }) => <DebugObjectPanel object={data.subject} />,\n }),\n createSurface({\n id: `${DEBUG_PLUGIN}/devtools`,\n role: 'article',\n filter: (data): data is any => {\n const settings = context\n .requestCapability(Capabilities.SettingsStore)\n .getStore<DebugSettingsProps>(DEBUG_PLUGIN)!.value;\n return data.subject === 'devtools' && !!settings.devtools;\n },\n component: () => <Devtools />,\n }),\n createSurface({\n id: `${DEBUG_PLUGIN}/space`,\n role: 'article',\n filter: (data): data is { subject: SpaceDebug } => isSpaceDebug(data.subject),\n component: ({ data }) => {\n const handleCreateObject = useCallback(\n (objects: ReactiveObject<any>[]) => {\n if (!isSpace(data.subject.space)) {\n return;\n }\n\n const collection =\n data.subject.space.state.get() === SpaceState.SPACE_READY &&\n data.subject.space.properties[CollectionType.typename]?.target;\n if (!(collection instanceof CollectionType)) {\n return;\n }\n\n const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);\n objects.forEach((object) => {\n void dispatch(createIntent(SpaceAction.AddObject, { target: collection, object }));\n });\n },\n [data.subject.space],\n );\n\n const deprecated = false;\n return deprecated ? (\n <DebugSpace space={data.subject.space} onAddObjects={handleCreateObject} />\n ) : (\n <SpaceGenerator space={data.subject.space} onCreateObjects={handleCreateObject} />\n );\n },\n }),\n createSurface({\n id: `${DEBUG_PLUGIN}/graph`,\n role: 'article',\n filter: (data): data is { subject: GraphDebug } => isGraphDebug(data.subject),\n component: ({ data }) => <DebugApp graph={data.subject.graph} />,\n }),\n createSurface({\n id: `${DEBUG_PLUGIN}/wireframe`,\n role: ['article', 'section'],\n disposition: 'hoist',\n filter: (data): data is { subject: ReactiveEchoObject<any> } => {\n const settings = context\n .requestCapability(Capabilities.SettingsStore)\n .getStore<DebugSettingsProps>(DEBUG_PLUGIN)!.value;\n return isEchoObject(data.subject) && !!settings.wireframe;\n },\n component: ({ data, role }) => (\n <Wireframe label={`${role}:${name}`} object={data.subject} classNames='row-span-2 overflow-hidden' />\n ),\n }),\n ]);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { lazy } from 'react';\n\nexport const DebugApp = lazy(() => import('./DebugApp'));\nexport const DebugSpace = lazy(() => import('./DebugSpace'));\nexport const SpaceGenerator = lazy(() => import('./SpaceGenerator'));\n\nexport * from './DebugObjectPanel';\nexport * from './DebugSettings';\nexport * from './DebugStatus';\nexport * from './Wireframe';\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type ReactiveEchoObject } from '@dxos/client/echo';\nimport { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';\n\nexport type DebugObjectPanelProps = {\n object: ReactiveEchoObject<any>;\n};\n\n// TODO(burdon): Get schema and traverse references.\nexport const DebugObjectPanel = ({ object }: DebugObjectPanelProps) => {\n return (\n <div className='flex flex-col'>\n <SyntaxHighlighter classNames='flex text-xs' language='json'>\n {JSON.stringify(object, null, 2)}\n </SyntaxHighlighter>\n </div>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { Gift, DownloadSimple, FirstAidKit } from '@phosphor-icons/react';\nimport React, { useEffect, useState } from 'react';\n\nimport { Capabilities, useCapabilities } from '@dxos/app-framework';\nimport { type ConfigProto, defs, SaveConfig, Storage } from '@dxos/config';\nimport { log } from '@dxos/log';\nimport { useClient } from '@dxos/react-client';\nimport { useTranslation, Button, Toast, Input, useFileDownload, Select } from '@dxos/react-ui';\nimport { DeprecatedFormInput } from '@dxos/react-ui-form';\nimport { getSize, mx } from '@dxos/react-ui-theme';\nimport { setDeep } from '@dxos/util';\n\nimport { DEBUG_PLUGIN } from '../meta';\nimport { type DebugSettingsProps } from '../types';\n\ntype Toast = {\n title: string;\n description?: string;\n};\n\nconst StorageAdapters = {\n opfs: defs.Runtime.Client.Storage.StorageDriver.WEBFS,\n idb: defs.Runtime.Client.Storage.StorageDriver.IDB,\n} as const;\n\nexport const DebugSettings = ({ settings }: { settings: DebugSettingsProps }) => {\n const { t } = useTranslation(DEBUG_PLUGIN);\n const [toast, setToast] = useState<Toast>();\n const client = useClient();\n const download = useFileDownload();\n // TODO(mykola): Get updates from other places that change Config.\n const [storageConfig, setStorageConfig] = useState<ConfigProto>({});\n const [upload] = useCapabilities(Capabilities.FileUploader);\n\n useEffect(() => {\n void Storage().then((config) => setStorageConfig(config));\n }, []);\n\n const handleToast = (toast: Toast) => {\n setToast(toast);\n const t = setTimeout(() => setToast(undefined), 5_000);\n return () => clearTimeout(t);\n };\n\n const handleDownload = async () => {\n const data = await client.diagnostics();\n const file = new Blob([JSON.stringify(data, undefined, 2)], { type: 'text/plain' });\n const fileName = `composer-${new Date().toISOString().replace(/\\W/g, '-')}.json`;\n download(file, fileName);\n\n if (upload) {\n const info = await upload(new File([file], fileName), client.spaces.default);\n if (!info) {\n log.error('diagnostics failed to upload to IPFS');\n return;\n }\n handleToast({ title: t('settings uploaded'), description: t('settings uploaded to clipboard') });\n\n // TODO(nf): move to IpfsPlugin?\n const url = client.config.values.runtime!.services!.ipfs!.gateway + '/' + info.cid;\n void navigator.clipboard.writeText(url);\n handleToast({ title: t('settings uploaded'), description: t('settings uploaded to clipboard') });\n log.info('diagnostics', { url });\n }\n };\n\n const handleRepair = async () => {\n try {\n const info = await client.repair();\n setStorageConfig(await Storage());\n handleToast({ title: t('settings repair success'), description: JSON.stringify(info, undefined, 2) });\n } catch (err: any) {\n handleToast({ title: t('settings repair failed'), description: err.message });\n }\n };\n\n return (\n <>\n <DeprecatedFormInput label={t('settings show debug panel')}>\n <Input.Switch checked={settings.debug} onCheckedChange={(checked) => (settings.debug = !!checked)} />\n </DeprecatedFormInput>\n <DeprecatedFormInput label={t('settings show devtools panel')}>\n <Input.Switch checked={settings.devtools} onCheckedChange={(checked) => (settings.devtools = !!checked)} />\n </DeprecatedFormInput>\n <DeprecatedFormInput label={t('settings wireframe')}>\n <Input.Switch checked={settings.wireframe} onCheckedChange={(checked) => (settings.wireframe = !!checked)} />\n </DeprecatedFormInput>\n <DeprecatedFormInput label={t('settings download diagnostics')}>\n <Button onClick={handleDownload}>\n <DownloadSimple className={getSize(5)} />\n </Button>\n </DeprecatedFormInput>\n <DeprecatedFormInput label={t('settings repair')}>\n <Button onClick={handleRepair}>\n <FirstAidKit className={getSize(5)} />\n </Button>\n </DeprecatedFormInput>\n\n {/* TODO(burdon): Move to layout? */}\n {toast && (\n <Toast.Root>\n <Toast.Body>\n <Toast.Title>\n <Gift className={mx(getSize(5), 'inline mr-1')} weight='duotone' />\n <span>{toast.title}</span>\n </Toast.Title>\n {toast.description && <Toast.Description>{toast.description}</Toast.Description>}\n </Toast.Body>\n </Toast.Root>\n )}\n\n <DeprecatedFormInput label={t('settings choose storage adaptor')}>\n <Select.Root\n value={\n Object.entries(StorageAdapters).find(\n ([name, value]) => value === storageConfig?.runtime?.client?.storage?.dataStore,\n )?.[0]\n }\n onValueChange={(value) => {\n if (confirm(t('settings storage adapter changed alert'))) {\n updateConfig(\n storageConfig,\n setStorageConfig,\n ['runtime', 'client', 'storage', 'dataStore'],\n StorageAdapters[value as keyof typeof StorageAdapters],\n );\n }\n }}\n >\n <Select.TriggerButton placeholder={t('settings data store label')} />\n <Select.Portal>\n <Select.Content>\n <Select.Viewport>\n {Object.keys(StorageAdapters).map((key) => (\n <Select.Option key={key} value={key}>\n {t(`settings storage adaptor ${key} label`)}\n </Select.Option>\n ))}\n </Select.Viewport>\n </Select.Content>\n </Select.Portal>\n </Select.Root>\n </DeprecatedFormInput>\n </>\n );\n};\n\nconst updateConfig = (config: ConfigProto, setConfig: (newConfig: ConfigProto) => void, path: string[], value: any) => {\n const storageConfigCopy = JSON.parse(JSON.stringify(config ?? {}));\n setDeep(storageConfigCopy, path, value);\n setConfig(storageConfigCopy);\n queueMicrotask(async () => {\n await SaveConfig(storageConfigCopy);\n });\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { useEffect, useRef, useState } from 'react';\n\nimport { Capabilities, firstIdInPart, useCapability } from '@dxos/app-framework';\nimport { TimeoutError } from '@dxos/async';\nimport { StatsPanel, useStats } from '@dxos/devtools';\nimport { getActiveSpace } from '@dxos/plugin-space';\nimport { StatusBar } from '@dxos/plugin-status-bar';\nimport { ConnectionState } from '@dxos/protocols/proto/dxos/client/services';\nimport { useNetworkStatus } from '@dxos/react-client/mesh';\nimport { Icon } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\nconst styles = {\n success: 'text-sky-300 dark:text-green-700',\n warning: 'text-orange-300 dark:text-orange-600',\n error: 'text-red-300 dark:text-red-600',\n};\n\n// TODO(burdon): Move out of debug plugin.\n// TODO(burdon): Make pluggable (move indicators to relevant plugins).\n// TODO(burdon): Vault heartbeat indicator (global scope)?\n\n/**\n * Ensure light doesn't flicker immediately after start.\n */\n// TODO(burdon): Move to @dxos/async (debounce?)\nconst _timer = (cb: (err?: Error) => void, options?: { min?: number; max?: number }) => {\n const min = options?.min ?? 500;\n let start: number;\n let pending: NodeJS.Timeout;\n let timeout: NodeJS.Timeout;\n return {\n start: () => {\n start = Date.now();\n clearTimeout(pending);\n if (options?.max) {\n clearTimeout(timeout);\n timeout = setTimeout(() => {\n cb(new TimeoutError(options.max));\n }, options.max);\n }\n },\n stop: () => {\n clearTimeout(timeout);\n const delta = Date.now() - start;\n if (delta < min) {\n pending = setTimeout(() => {\n cb();\n }, min - delta);\n }\n },\n };\n};\n\n/**\n * Global error handler.\n */\n// TODO(burdon): Integrate with Sentry?\nconst ErrorIndicator = () => {\n const [, forceUpdate] = useState({});\n const errorRef = useRef<Error>();\n useEffect(() => {\n const errorListener = (event: any) => {\n const error: Error = event.error ?? event.reason;\n if (errorRef.current !== error) {\n errorRef.current = error;\n forceUpdate({});\n }\n };\n\n // TODO(burdon): Register globally?\n // https://developer.mozilla.org/en-US/docs/Web/API/Window/error_event\n window.addEventListener('error', errorListener);\n\n // https://developer.mozilla.org/en-US/docs/Web/API/Window/unhandledrejection_event\n window.addEventListener('unhandledrejection', errorListener);\n\n return () => {\n window.removeEventListener('error', errorListener);\n window.removeEventListener('unhandledrejection', errorListener);\n };\n }, []);\n\n const handleReset = () => {\n errorRef.current = undefined;\n forceUpdate({});\n };\n\n if (errorRef.current) {\n return (\n <StatusBar.Button title={errorRef.current.message} onClick={handleReset}>\n <Icon icon='ph--warning-circle--duotone' size={4} classNames={styles.error} />\n </StatusBar.Button>\n );\n } else {\n return (\n <StatusBar.Item title='No errors.'>\n <Icon icon='ph--check--regular' size={4} />\n </StatusBar.Item>\n );\n }\n};\n\n/**\n * Swarm connection handler.\n */\nconst SwarmIndicator = () => {\n const [state, setState] = useState(0);\n const { swarm } = useNetworkStatus();\n useEffect(() => {\n setState(swarm === ConnectionState.ONLINE ? 0 : 1);\n }, [swarm]);\n\n if (state === 0) {\n return (\n <StatusBar.Item title='Connected to swarm.'>\n <Icon icon='ph--lightning--regular' size={4} />\n </StatusBar.Item>\n );\n } else {\n return (\n <StatusBar.Item title='Disconnected from swarm.'>\n <Icon icon='ph--lightning-slash--regular' size={4} classNames={styles.warning} />\n </StatusBar.Item>\n );\n }\n};\n\n/**\n * Data saving indicator.\n */\n// TODO(burdon): Merge with SaveStatus.\nconst SavingIndicator = () => {\n const [state, _setState] = useState(0);\n const location = useCapability(Capabilities.Location);\n const { graph } = useCapability(Capabilities.AppGraph);\n const _space = location && graph ? getActiveSpace(graph, firstIdInPart(location.active, 'main')) : undefined;\n // TODO(dmaretskyi): Fix this when we have save status for automerge.\n // useEffect(() => {\n // if (!space) {\n // return;\n // }\n // const { start, stop } = timer(() => setState(0), { min: 250 });\n // return space.db.pendingBatch.on(({ duration, error }) => {\n // if (error) {\n // setState(2);\n // stop();\n // } else if (duration === undefined) {\n // setState(1);\n // start();\n // } else {\n // stop();\n // }\n // });\n // }, [space]);\n\n switch (state) {\n case 2:\n return (\n <StatusBar.Item title='Edit not saved.'>\n <Icon icon='ph--circle--duotone' size={4} classNames={styles.warning} />\n </StatusBar.Item>\n );\n case 1:\n return (\n <StatusBar.Item title='Saving...'>\n <Icon icon='ph--circle--duotone' size={4} classNames={styles.success} />\n </StatusBar.Item>\n );\n case 0:\n default:\n return (\n <StatusBar.Item title='Modified indicator.'>\n <Icon icon='ph--circle--duotone' size={4} />\n </StatusBar.Item>\n );\n }\n};\n\nconst PerformanceIndicator = () => {\n const [visible, setVisible] = useState(false);\n const [stats, refreshStats] = useStats();\n\n return (\n <>\n <StatusBar.Button onClick={() => setVisible((visible) => !visible)} title='Performance panels'>\n <Icon icon='ph--chart-bar--regular' size={4} />\n </StatusBar.Button>\n {visible && (\n <div\n className={mx(\n 'z-20 absolute bottom-[--statusbar-size] right-4 w-[450px]',\n 'overflow-x-hidden overflow-y-auto scrollbar-thin',\n 'border-x border-y border-separator',\n )}\n >\n <StatsPanel stats={stats} onRefresh={refreshStats} />\n </div>\n )}\n </>\n );\n};\n\nconst indicators = [SavingIndicator, SwarmIndicator, PerformanceIndicator, ErrorIndicator];\n\nexport const DebugStatus = () => {\n return (\n <>\n {indicators.map((Indicator) => (\n <Indicator key={Indicator.name} />\n ))}\n </>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React from 'react';\nimport { useResizeDetector } from 'react-resize-detector';\n\nimport { fullyQualifiedId, type ReactiveEchoObject } from '@dxos/react-client/echo';\nimport { type ThemedClassName } from '@dxos/react-ui';\nimport { useAttendableAttributes } from '@dxos/react-ui-attention';\nimport { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';\nimport { mx } from '@dxos/react-ui-theme';\n\n// TODO(burdon): Create generic container with wireframe mode.\nexport type WireframeProps = ThemedClassName<{\n label?: string;\n object: ReactiveEchoObject<any>;\n}>;\n\n// TODO(burdon): Make focusable and attendable with input.\nexport const Wireframe = ({ classNames, label, object }: WireframeProps) => {\n const attendableAttrs = useAttendableAttributes(fullyQualifiedId(object));\n const { width, height, ref } = useResizeDetector();\n return (\n <div ref={ref} className={mx('relative grow min-bs-96', classNames)} {...attendableAttrs}>\n <div className='absolute inset-2 flex flex-col gap-2 overflow-hidden font-mono'>\n <div className='flex justify-between'>\n <div>{label}</div>\n <div>{`[${width}x${height}]`}</div>\n </div>\n {object && (\n <SyntaxHighlighter language='json' classNames='flex w-full text-xs opacity-75 rounded'>\n {JSON.stringify(object, undefined, 2)}\n </SyntaxHighlighter>\n )}\n </div>\n <svg width={width} height={height} className='bg-transparent [&>*]:text-subdued'>\n <rect x={0} y={0} width={width} height={height} strokeWidth={1} fill='none' />\n <line x1={0} y1={0} x2={width} y2={height} strokeWidth={1} />\n <line x1={0} y1={height} x2={width} y2={0} strokeWidth={1} />\n </svg>\n </div>\n );\n};\n"],
5
- "mappings": ";;;;;AAIA,OAAOA,UAASC,mBAAmB;AAEnC,SACEC,gBAAAA,eACAC,aACAC,cACAC,eACAC,iBAAAA,sBAEK;AACP,SAASC,gBAAgB;AACzB,SAASC,aAAa;AACtB,SAASC,aAAaC,sBAAsB;AAC5C,SACEC,YACAC,SACAC,oBAIK;;;ACpBP,SAASC,YAAY;;;ACArB,OAAOC,WAAW;AAGlB,SAASC,yBAAyB;AAO3B,IAAMC,mBAAmB,CAAC,EAAEC,OAAM,MAAyB;AAChE,SACE,sBAAA,cAACC,OAAAA;IAAIC,WAAU;KACb,sBAAA,cAACC,mBAAAA;IAAkBC,YAAW;IAAeC,UAAS;KACnDC,KAAKC,UAAUP,QAAQ,MAAM,CAAA,CAAA,CAAA;AAItC;;;AClBA,SAASQ,MAAMC,gBAAgBC,mBAAmB;AAClD,OAAOC,UAASC,WAAWC,gBAAgB;AAE3C,SAASC,cAAcC,uBAAuB;AAC9C,SA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,iBAAiBvB;;IAEhE;EACF,CAAA;EACApB,cAAc;IACZC,IAAI,GAAGX,YAAAA;IACPY,MAAM;IACNC,QAAQ,CAACf,SAA0CK,aAAaL,KAAKgB,OAAO;IAC5EC,WAAW,CAAC,EAAEjB,KAAI,MAAO,gBAAAuB,OAAA,cAACiC,UAAAA;MAASlD,OAAON,KAAKgB,QAAQV;;EACzD,CAAA;EACAM,cAAc;IACZC,IAAI,GAAGX,YAAAA;IACPY,MAAM;MAAC;MAAW;;IAClB2C,aAAa;IACb1C,QAAQ,CAACf,SAAAA;AACP,YAAMkB,WAAWV,QACdqB,kBAAkBnB,cAAaU,aAAa,EAC5CC,SAA6BnB,YAAAA,EAAeoB;AAC/C,aAAOI,aAAa1B,KAAKgB,OAAO,KAAK,CAAC,CAACE,SAASwC;IAClD;IACAzC,WAAW,CAAC,EAAEjB,MAAMc,KAAI,MACtB,gBAAAS,OAAA,cAACoC,WAAAA;MAAUC,OAAO,GAAG9C,IAAAA,IAAQ+C,IAAAA;MAAQjC,QAAQ5B,KAAKgB;MAAS8C,YAAW;;EAE1E,CAAA;CACD;",
6
- "names": ["React", "useCallback", "Capabilities", "contributes", "createIntent", "createSurface", "useCapability", "Devtools", "Graph", "SpaceAction", "CollectionType", "SpaceState", "isSpace", "isEchoObject", "lazy", "React", "SyntaxHighlighter", "DebugObjectPanel", "object", "div", "className", "SyntaxHighlighter", "classNames", "language", "JSON", "stringify", "Gift", "DownloadSimple", "FirstAidKit", "React", "useEffect", "useState", "Capabilities", "useCapabilities", "defs", "SaveConfig", "Storage", "log", "useClient", "useTranslation", "Button", "Toast", "Input", "useFileDownload", "Select", "DeprecatedFormInput", "getSize", "mx", "setDeep", "StorageAdapters", "opfs", "defs", "Runtime", "Client", "Storage", "StorageDriver", "WEBFS", "idb", "IDB", "DebugSettings", "settings", "t", "useTranslation", "DEBUG_PLUGIN", "toast", "setToast", "useState", "client", "useClient", "download", "useFileDownload", "storageConfig", "setStorageConfig", "upload", "useCapabilities", "Capabilities", "FileUploader", "useEffect", "then", "config", "handleToast", "setTimeout", "undefined", "clearTimeout", "handleDownload", "data", "diagnostics", "file", "Blob", "JSON", "stringify", "type", "fileName", "Date", "toISOString", "replace", "info", "File", "spaces", "default", "log", "error", "title", "description", "url", "values", "runtime", "services", "ipfs", "gateway", "cid", "navigator", "clipboard", "writeText", "handleRepair", "repair", "err", "message", "React", "DeprecatedFormInput", "label", "Input", "Switch", "checked", "debug", "onCheckedChange", "devtools", "wireframe", "Button", "onClick", "DownloadSimple", "className", "getSize", "FirstAidKit", "Toast", "Root", "Body", "Title", "Gift", "mx", "weight", "span", "Description", "Select", "value", "Object", "entries", "find", "name", "storage", "dataStore", "onValueChange", "confirm", "updateConfig", "TriggerButton", "placeholder", "Portal", "Content", "Viewport", "keys", "map", "key", "Option", "setConfig", "path", "storageConfigCopy", "parse", "setDeep", "queueMicrotask", "SaveConfig", "React", "useEffect", "useRef", "useState", "Capabilities", "firstIdInPart", "useCapability", "TimeoutError", "StatsPanel", "useStats", "getActiveSpace", "StatusBar", "ConnectionState", "useNetworkStatus", "Icon", "mx", "styles", "success", "warning", "error", "ErrorIndicator", "forceUpdate", "useState", "errorRef", "useRef", "useEffect", "errorListener", "event", "error", "reason", "current", "window", "addEventListener", "removeEventListener", "handleReset", "undefined", "React", "StatusBar", "Button", "title", "message", "onClick", "Icon", "icon", "size", "classNames", "styles", "Item", "SwarmIndicator", "state", "setState", "swarm", "useNetworkStatus", "ConnectionState", "ONLINE", "warning", "SavingIndicator", "_setState", "location", "useCapability", "Capabilities", "Location", "graph", "AppGraph", "_space", "getActiveSpace", "firstIdInPart", "active", "success", "PerformanceIndicator", "visible", "setVisible", "stats", "refreshStats", "useStats", "div", "className", "mx", "StatsPanel", "onRefresh", "indicators", "DebugStatus", "map", "Indicator", "key", "name", "React", "useResizeDetector", "fullyQualifiedId", "useAttendableAttributes", "SyntaxHighlighter", "mx", "Wireframe", "classNames", "label", "object", "attendableAttrs", "useAttendableAttributes", "fullyQualifiedId", "width", "height", "ref", "useResizeDetector", "React", "div", "className", "mx", "SyntaxHighlighter", "language", "JSON", "stringify", "undefined", "svg", "rect", "x", "y", "strokeWidth", "fill", "line", "x1", "y1", "x2", "y2", "DebugApp", "lazy", "DebugSpace", "SpaceGenerator", "isSpaceDebug", "data", "type", "DEBUG_PLUGIN", "isSpace", "space", "isGraphDebug", "graph", "Graph", "context", "contributes", "Capabilities", "ReactSurface", "createSurface", "id", "role", "filter", "subject", "component", "settings", "useCapability", "SettingsStore", "getStore", "value", "React", "DebugSettings", "DebugStatus", "isEchoObject", "DebugObjectPanel", "object", "requestCapability", "devtools", "Devtools", "handleCreateObject", "useCallback", "objects", "collection", "state", "get", "SpaceState", "SPACE_READY", "properties", "CollectionType", "typename", "target", "dispatchPromise", "dispatch", "IntentDispatcher", "forEach", "createIntent", "SpaceAction", "AddObject", "deprecated", "DebugSpace", "onAddObjects", "SpaceGenerator", "onCreateObjects", "DebugApp", "disposition", "wireframe", "Wireframe", "label", "name", "classNames"]
7
- }
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- declare const _default: () => import("@dxos/app-framework").Capability<Readonly<{
3
- id: string;
4
- dependsOn?: string[];
5
- context: React.FC<React.PropsWithChildren>;
6
- }>>;
7
- export default _default;
8
- //# sourceMappingURL=react-context.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"react-context.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/react-context.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA8B,MAAM,OAAO,CAAC;;;;;;AAQnD,wBAyBK"}
@@ -1,38 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import React, { useEffect, useState } from 'react';
6
-
7
- import { Capabilities, contributes } from '@dxos/app-framework';
8
- import { Timer } from '@dxos/async';
9
-
10
- import { DEBUG_PLUGIN } from '../meta';
11
- import { DebugContext } from '../types';
12
-
13
- export default () =>
14
- contributes(Capabilities.ReactContext, {
15
- id: DEBUG_PLUGIN,
16
- context: ({ children }) => {
17
- const [timer, setTimer] = useState<Timer>();
18
- useEffect(() => timer?.state.on((value) => !value && setTimer(undefined)), [timer]);
19
- useEffect(() => {
20
- timer?.stop();
21
- }, []);
22
-
23
- return (
24
- <DebugContext.Provider
25
- value={{
26
- running: !!timer,
27
- start: (cb, options) => {
28
- timer?.stop();
29
- setTimer(new Timer(cb).start(options));
30
- },
31
- stop: () => timer?.stop(),
32
- }}
33
- >
34
- {children}
35
- </DebugContext.Provider>
36
- );
37
- },
38
- });