@dxos/plugin-debug 0.8.4-main.ead640a → 0.8.4-main.effb148878

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 (234) hide show
  1. package/LICENSE +102 -5
  2. package/README.md +1 -1
  3. package/dist/lib/neutral/DebugGraph-G4FWS57E.mjs +15 -0
  4. package/dist/lib/neutral/DebugGraph-G4FWS57E.mjs.map +7 -0
  5. package/dist/lib/neutral/DebugObjectPanel-UJ63CV25.mjs +59 -0
  6. package/dist/lib/neutral/DebugObjectPanel-UJ63CV25.mjs.map +7 -0
  7. package/dist/lib/neutral/DebugPlugin.mjs +47 -0
  8. package/dist/lib/neutral/DebugPlugin.mjs.map +7 -0
  9. package/dist/lib/neutral/DebugPlugin.node.mjs +18 -0
  10. package/dist/lib/neutral/DebugPlugin.node.mjs.map +7 -0
  11. package/dist/lib/neutral/DebugPlugin.workerd.mjs +12 -0
  12. package/dist/lib/neutral/DebugPlugin.workerd.mjs.map +7 -0
  13. package/dist/lib/neutral/DebugSettings-Z3XADRNK.mjs +224 -0
  14. package/dist/lib/neutral/DebugSettings-Z3XADRNK.mjs.map +7 -0
  15. package/dist/lib/neutral/DebugSpaceObjectsPanel-NISULU6U.mjs +34 -0
  16. package/dist/lib/neutral/DebugSpaceObjectsPanel-NISULU6U.mjs.map +7 -0
  17. package/dist/lib/neutral/DebugStatus-YB3KFP7G.mjs +121 -0
  18. package/dist/lib/neutral/DebugStatus-YB3KFP7G.mjs.map +7 -0
  19. package/dist/lib/neutral/DevtoolsOverviewContainer-YX7Z3D2H.mjs +23 -0
  20. package/dist/lib/neutral/DevtoolsOverviewContainer-YX7Z3D2H.mjs.map +7 -0
  21. package/dist/lib/neutral/GithubPanel-QJKDJRVQ.mjs +177 -0
  22. package/dist/lib/neutral/GithubPanel-QJKDJRVQ.mjs.map +7 -0
  23. package/dist/lib/neutral/SpaceGenerator-IQLBDY6R.mjs +143 -0
  24. package/dist/lib/neutral/SpaceGenerator-IQLBDY6R.mjs.map +7 -0
  25. package/dist/lib/neutral/Wireframe-WD7S2AUU.mjs +52 -0
  26. package/dist/lib/neutral/Wireframe-WD7S2AUU.mjs.map +7 -0
  27. package/dist/lib/neutral/app-graph-builder-ZNMWIDDF.mjs +598 -0
  28. package/dist/lib/neutral/app-graph-builder-ZNMWIDDF.mjs.map +7 -0
  29. package/dist/lib/neutral/capabilities/index.mjs +15 -0
  30. package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
  31. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
  32. package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
  33. package/dist/lib/{browser/chunk-SRV2AIGJ.mjs → neutral/chunk-NFIOTQRZ.mjs} +30 -9
  34. package/dist/lib/neutral/chunk-NFIOTQRZ.mjs.map +7 -0
  35. package/dist/lib/neutral/chunk-SAJFZGX5.mjs +41 -0
  36. package/dist/lib/neutral/chunk-SAJFZGX5.mjs.map +7 -0
  37. package/dist/lib/{browser/SpaceGenerator-VMWHGAJZ.mjs → neutral/components/index.mjs} +347 -527
  38. package/dist/lib/neutral/components/index.mjs.map +7 -0
  39. package/dist/lib/neutral/containers/index.mjs +23 -0
  40. package/dist/lib/neutral/containers/index.mjs.map +7 -0
  41. package/dist/lib/neutral/index.mjs +18 -0
  42. package/dist/lib/neutral/index.mjs.map +7 -0
  43. package/dist/lib/neutral/meta.json +1 -0
  44. package/dist/lib/neutral/meta.mjs +8 -0
  45. package/dist/lib/neutral/meta.mjs.map +7 -0
  46. package/dist/lib/neutral/plugin.mjs +12 -0
  47. package/dist/lib/neutral/plugin.mjs.map +7 -0
  48. package/dist/lib/neutral/react-context-MUZ3KVLU.mjs +17 -0
  49. package/dist/lib/neutral/react-context-MUZ3KVLU.mjs.map +7 -0
  50. package/dist/lib/neutral/react-surface-T4NYONZ7.mjs +419 -0
  51. package/dist/lib/neutral/react-surface-T4NYONZ7.mjs.map +7 -0
  52. package/dist/lib/neutral/settings-MPM6YUP4.mjs +28 -0
  53. package/dist/lib/neutral/settings-MPM6YUP4.mjs.map +7 -0
  54. package/dist/lib/neutral/translations.mjs +90 -0
  55. package/dist/lib/neutral/translations.mjs.map +7 -0
  56. package/dist/lib/neutral/types/index.mjs +14 -0
  57. package/dist/lib/neutral/types/index.mjs.map +7 -0
  58. package/dist/types/src/DebugPlugin.d.ts +4 -1
  59. package/dist/types/src/DebugPlugin.d.ts.map +1 -1
  60. package/dist/types/src/DebugPlugin.node.d.ts +5 -0
  61. package/dist/types/src/DebugPlugin.node.d.ts.map +1 -0
  62. package/dist/types/src/DebugPlugin.test.d.ts +2 -0
  63. package/dist/types/src/DebugPlugin.test.d.ts.map +1 -0
  64. package/dist/types/src/DebugPlugin.workerd.d.ts +5 -0
  65. package/dist/types/src/DebugPlugin.workerd.d.ts.map +1 -0
  66. package/dist/types/src/capabilities/app-graph-builder.d.ts +4 -2
  67. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  68. package/dist/types/src/capabilities/index.d.ts +8 -5
  69. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  70. package/dist/types/src/capabilities/react-context.d.ts +4 -2
  71. package/dist/types/src/capabilities/react-context.d.ts.map +1 -1
  72. package/dist/types/src/capabilities/react-surface.d.ts +7 -2
  73. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  74. package/dist/types/src/capabilities/settings.d.ts +5 -2
  75. package/dist/types/src/capabilities/settings.d.ts.map +1 -1
  76. package/dist/types/src/components/DebugSettings/DebugSettings.d.ts +11 -0
  77. package/dist/types/src/components/DebugSettings/DebugSettings.d.ts.map +1 -0
  78. package/dist/types/src/components/DebugSettings/DebugSettings.stories.d.ts +105 -0
  79. package/dist/types/src/components/DebugSettings/DebugSettings.stories.d.ts.map +1 -0
  80. package/dist/types/src/components/DebugSettings/index.d.ts +2 -0
  81. package/dist/types/src/components/DebugSettings/index.d.ts.map +1 -0
  82. package/dist/types/src/components/SchemaTable/SchemaTable.d.ts.map +1 -0
  83. package/dist/types/src/components/SchemaTable/index.d.ts +2 -0
  84. package/dist/types/src/components/SchemaTable/index.d.ts.map +1 -0
  85. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts +4 -5
  86. package/dist/types/src/components/SpaceGenerator/ObjectGenerator.d.ts.map +1 -1
  87. package/dist/types/src/components/SpaceGenerator/draw-util.d.ts.map +1 -1
  88. package/dist/types/src/components/SpaceGenerator/index.d.ts +2 -2
  89. package/dist/types/src/components/SpaceGenerator/index.d.ts.map +1 -1
  90. package/dist/types/src/components/SpaceGenerator/presets.d.ts +2 -5
  91. package/dist/types/src/components/SpaceGenerator/presets.d.ts.map +1 -1
  92. package/dist/types/src/components/index.d.ts +4 -10
  93. package/dist/types/src/components/index.d.ts.map +1 -1
  94. package/dist/types/src/containers/DebugGraph/DebugGraph.d.ts +8 -0
  95. package/dist/types/src/containers/DebugGraph/DebugGraph.d.ts.map +1 -0
  96. package/dist/types/src/containers/DebugGraph/index.d.ts +2 -0
  97. package/dist/types/src/containers/DebugGraph/index.d.ts.map +1 -0
  98. package/dist/types/src/containers/DebugObjectPanel/DebugObjectPanel.d.ts +6 -0
  99. package/dist/types/src/containers/DebugObjectPanel/DebugObjectPanel.d.ts.map +1 -0
  100. package/dist/types/src/containers/DebugObjectPanel/index.d.ts +2 -0
  101. package/dist/types/src/containers/DebugObjectPanel/index.d.ts.map +1 -0
  102. package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts +5 -0
  103. package/dist/types/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.d.ts.map +1 -0
  104. package/dist/types/src/containers/DebugSpaceObjectsPanel/index.d.ts +2 -0
  105. package/dist/types/src/containers/DebugSpaceObjectsPanel/index.d.ts.map +1 -0
  106. package/dist/types/src/containers/DebugStatus/DebugStatus.d.ts.map +1 -0
  107. package/dist/types/src/containers/DebugStatus/index.d.ts +2 -0
  108. package/dist/types/src/containers/DebugStatus/index.d.ts.map +1 -0
  109. package/dist/types/src/{components → containers/DevtoolsOverviewContainer}/DevtoolsOverviewContainer.d.ts +0 -1
  110. package/dist/types/src/containers/DevtoolsOverviewContainer/DevtoolsOverviewContainer.d.ts.map +1 -0
  111. package/dist/types/src/containers/DevtoolsOverviewContainer/index.d.ts +2 -0
  112. package/dist/types/src/containers/DevtoolsOverviewContainer/index.d.ts.map +1 -0
  113. package/dist/types/src/containers/GithubPanel/GithubComponent.d.ts +15 -0
  114. package/dist/types/src/containers/GithubPanel/GithubComponent.d.ts.map +1 -0
  115. package/dist/types/src/containers/GithubPanel/GithubComponent.stories.d.ts +105 -0
  116. package/dist/types/src/containers/GithubPanel/GithubComponent.stories.d.ts.map +1 -0
  117. package/dist/types/src/containers/GithubPanel/GithubPanel.d.ts +3 -0
  118. package/dist/types/src/containers/GithubPanel/GithubPanel.d.ts.map +1 -0
  119. package/dist/types/src/containers/GithubPanel/index.d.ts +2 -0
  120. package/dist/types/src/containers/GithubPanel/index.d.ts.map +1 -0
  121. package/dist/types/src/containers/SpaceGenerator/SpaceGenerator.d.ts +11 -0
  122. package/dist/types/src/containers/SpaceGenerator/SpaceGenerator.d.ts.map +1 -0
  123. package/dist/types/src/containers/SpaceGenerator/index.d.ts +2 -0
  124. package/dist/types/src/containers/SpaceGenerator/index.d.ts.map +1 -0
  125. package/dist/types/src/{components → containers/Wireframe}/Wireframe.d.ts +2 -2
  126. package/dist/types/src/containers/Wireframe/Wireframe.d.ts.map +1 -0
  127. package/dist/types/src/containers/Wireframe/index.d.ts +2 -0
  128. package/dist/types/src/containers/Wireframe/index.d.ts.map +1 -0
  129. package/dist/types/src/containers/index.d.ts +10 -0
  130. package/dist/types/src/containers/index.d.ts.map +1 -0
  131. package/dist/types/src/index.d.ts +1 -1
  132. package/dist/types/src/index.d.ts.map +1 -1
  133. package/dist/types/src/meta.d.ts +2 -2
  134. package/dist/types/src/meta.d.ts.map +1 -1
  135. package/dist/types/src/plugin.d.ts +4 -0
  136. package/dist/types/src/plugin.d.ts.map +1 -0
  137. package/dist/types/src/translations.d.ts +86 -59
  138. package/dist/types/src/translations.d.ts.map +1 -1
  139. package/dist/types/src/types/Settings.d.ts +8 -0
  140. package/dist/types/src/types/Settings.d.ts.map +1 -0
  141. package/dist/types/src/types/index.d.ts +69 -0
  142. package/dist/types/src/types/index.d.ts.map +1 -0
  143. package/dist/types/tsconfig.tsbuildinfo +1 -1
  144. package/package.json +134 -75
  145. package/src/DebugPlugin.node.ts +18 -0
  146. package/src/DebugPlugin.test.ts +29 -0
  147. package/src/DebugPlugin.tsx +28 -34
  148. package/src/DebugPlugin.workerd.ts +12 -0
  149. package/src/capabilities/app-graph-builder.ts +381 -388
  150. package/src/capabilities/index.ts +5 -5
  151. package/src/capabilities/react-context.tsx +16 -7
  152. package/src/capabilities/react-surface.tsx +378 -339
  153. package/src/capabilities/settings.ts +24 -12
  154. package/src/components/DebugSettings/DebugSettings.stories.tsx +36 -0
  155. package/src/components/DebugSettings/DebugSettings.tsx +262 -0
  156. package/src/components/DebugSettings/index.ts +5 -0
  157. package/src/components/SchemaTable/index.ts +5 -0
  158. package/src/components/SpaceGenerator/ObjectGenerator.tsx +34 -44
  159. package/src/components/SpaceGenerator/draw-util.ts +8 -8
  160. package/src/components/SpaceGenerator/index.ts +2 -3
  161. package/src/components/SpaceGenerator/presets.ts +241 -139
  162. package/src/components/index.ts +4 -8
  163. package/src/containers/DebugGraph/DebugGraph.tsx +14 -0
  164. package/src/containers/DebugGraph/index.ts +5 -0
  165. package/src/containers/DebugObjectPanel/DebugObjectPanel.tsx +76 -0
  166. package/src/containers/DebugObjectPanel/index.ts +5 -0
  167. package/src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.tsx +47 -0
  168. package/src/containers/DebugSpaceObjectsPanel/index.ts +5 -0
  169. package/src/{components → containers/DebugStatus}/DebugStatus.tsx +41 -19
  170. package/src/containers/DebugStatus/index.ts +5 -0
  171. package/src/containers/DevtoolsOverviewContainer/DevtoolsOverviewContainer.tsx +25 -0
  172. package/src/containers/DevtoolsOverviewContainer/index.ts +5 -0
  173. package/src/containers/GithubPanel/GithubComponent.stories.tsx +38 -0
  174. package/src/containers/GithubPanel/GithubComponent.tsx +192 -0
  175. package/src/containers/GithubPanel/GithubPanel.tsx +17 -0
  176. package/src/containers/GithubPanel/index.ts +5 -0
  177. package/src/containers/SpaceGenerator/SpaceGenerator.tsx +126 -0
  178. package/src/containers/SpaceGenerator/index.ts +5 -0
  179. package/src/{components → containers/Wireframe}/Wireframe.tsx +7 -12
  180. package/src/containers/Wireframe/index.ts +5 -0
  181. package/src/containers/index.ts +14 -0
  182. package/src/index.ts +1 -1
  183. package/src/meta.ts +27 -5
  184. package/src/plugin.ts +10 -0
  185. package/src/translations.ts +82 -58
  186. package/src/types/Settings.ts +16 -0
  187. package/src/{types.ts → types/index.ts} +20 -11
  188. package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs +0 -20
  189. package/dist/lib/browser/DebugGraph-EDOH6R2G.mjs.map +0 -7
  190. package/dist/lib/browser/DevtoolsOverviewContainer-EPD6EWT5.mjs +0 -25
  191. package/dist/lib/browser/DevtoolsOverviewContainer-EPD6EWT5.mjs.map +0 -7
  192. package/dist/lib/browser/SpaceGenerator-VMWHGAJZ.mjs.map +0 -7
  193. package/dist/lib/browser/app-graph-builder-I4IHBKKN.mjs +0 -588
  194. package/dist/lib/browser/app-graph-builder-I4IHBKKN.mjs.map +0 -7
  195. package/dist/lib/browser/chunk-SRV2AIGJ.mjs.map +0 -7
  196. package/dist/lib/browser/chunk-SVCKCXCL.mjs +0 -16
  197. package/dist/lib/browser/chunk-SVCKCXCL.mjs.map +0 -7
  198. package/dist/lib/browser/index.mjs +0 -131
  199. package/dist/lib/browser/index.mjs.map +0 -7
  200. package/dist/lib/browser/meta.json +0 -1
  201. package/dist/lib/browser/react-context-QLZE7VSQ.mjs +0 -16
  202. package/dist/lib/browser/react-context-QLZE7VSQ.mjs.map +0 -7
  203. package/dist/lib/browser/react-surface-GFORPA3A.mjs +0 -772
  204. package/dist/lib/browser/react-surface-GFORPA3A.mjs.map +0 -7
  205. package/dist/lib/browser/settings-EBVICEEW.mjs +0 -22
  206. package/dist/lib/browser/settings-EBVICEEW.mjs.map +0 -7
  207. package/dist/types/src/components/Container.d.ts +0 -5
  208. package/dist/types/src/components/Container.d.ts.map +0 -1
  209. package/dist/types/src/components/DebugGraph.d.ts +0 -8
  210. package/dist/types/src/components/DebugGraph.d.ts.map +0 -1
  211. package/dist/types/src/components/DebugObjectPanel.d.ts +0 -7
  212. package/dist/types/src/components/DebugObjectPanel.d.ts.map +0 -1
  213. package/dist/types/src/components/DebugSettings.d.ts +0 -6
  214. package/dist/types/src/components/DebugSettings.d.ts.map +0 -1
  215. package/dist/types/src/components/DebugStatus.d.ts.map +0 -1
  216. package/dist/types/src/components/DevtoolsOverviewContainer.d.ts.map +0 -1
  217. package/dist/types/src/components/SpaceGenerator/SchemaTable.d.ts.map +0 -1
  218. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts +0 -9
  219. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.d.ts.map +0 -1
  220. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts +0 -15
  221. package/dist/types/src/components/SpaceGenerator/SpaceGenerator.stories.d.ts.map +0 -1
  222. package/dist/types/src/components/Wireframe.d.ts.map +0 -1
  223. package/dist/types/src/types.d.ts +0 -63
  224. package/dist/types/src/types.d.ts.map +0 -1
  225. package/src/components/Container.tsx +0 -15
  226. package/src/components/DebugGraph.tsx +0 -14
  227. package/src/components/DebugObjectPanel.tsx +0 -33
  228. package/src/components/DebugSettings.tsx +0 -159
  229. package/src/components/DevtoolsOverviewContainer.tsx +0 -20
  230. package/src/components/SpaceGenerator/SpaceGenerator.stories.tsx +0 -52
  231. package/src/components/SpaceGenerator/SpaceGenerator.tsx +0 -122
  232. /package/dist/types/src/components/{SpaceGenerator → SchemaTable}/SchemaTable.d.ts +0 -0
  233. /package/dist/types/src/{components → containers/DebugStatus}/DebugStatus.d.ts +0 -0
  234. /package/src/components/{SpaceGenerator → SchemaTable}/SchemaTable.tsx +0 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/containers/DebugSpaceObjectsPanel/DebugSpaceObjectsPanel.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useState } from 'react';\n\nimport { type AppSurface } from '@dxos/app-toolkit/ui';\nimport { ObjectsTree } from '@dxos/devtools';\nimport { Filter, Query } from '@dxos/echo';\nimport { type ObjectId } from '@dxos/keys';\nimport { useQuery } from '@dxos/react-client/echo';\nimport { Clipboard, Grid, Input, Panel, ScrollArea, Toolbar } from '@dxos/react-ui';\nimport { JsonHighlighter } from '@dxos/react-ui-syntax-highlighter';\n\nexport type DebugSpaceObjectsPanelProps = AppSurface.SpaceArticleProps;\n\nexport const DebugSpaceObjectsPanel = ({ space }: DebugSpaceObjectsPanelProps) => {\n const [selectedId, setSelectedId] = useState<ObjectId | null>(null);\n const [selectedObject] = useQuery(\n space.db,\n selectedId ? Query.select(Filter.id(selectedId)) : Query.select(Filter.nothing()),\n );\n\n return (\n <Clipboard.Provider>\n <Panel.Root>\n <Panel.Toolbar asChild>\n <Toolbar.Root>\n <Input.Root>\n <Input.TextInput disabled placeholder='Search...' />\n </Input.Root>\n </Toolbar.Root>\n </Panel.Toolbar>\n <Panel.Content asChild>\n <Grid rows={2} classNames='divide-y divide-separator'>\n <ScrollArea.Root>\n <ScrollArea.Viewport>\n <ObjectsTree db={space.db} onSelect={(entity) => setSelectedId(entity.id)} />\n </ScrollArea.Viewport>\n </ScrollArea.Root>\n {selectedObject && <JsonHighlighter classNames='p-1' data={selectedObject} />}\n </Grid>\n </Panel.Content>\n </Panel.Root>\n </Clipboard.Provider>\n );\n};\n"],
5
+ "mappings": ";;;AAIA,OAAOA,SAASC,gBAAgB;AAGhC,SAASC,mBAAmB;AAC5B,SAASC,QAAQC,aAAa;AAE9B,SAASC,gBAAgB;AACzB,SAASC,WAAWC,MAAMC,OAAOC,OAAOC,YAAYC,eAAe;AACnE,SAASC,uBAAuB;AAIzB,IAAMC,yBAAyB,CAAC,EAAEC,MAAK,MAA+B;AAC3E,QAAM,CAACC,YAAYC,aAAAA,IAAiBf,SAA0B,IAAA;AAC9D,QAAM,CAACgB,cAAAA,IAAkBZ,SACvBS,MAAMI,IACNH,aAAaX,MAAMe,OAAOhB,OAAOiB,GAAGL,UAAAA,CAAAA,IAAeX,MAAMe,OAAOhB,OAAOkB,QAAO,CAAA,CAAA;AAGhF,SACE,sBAAA,cAACf,UAAUgB,UAAQ,MACjB,sBAAA,cAACb,MAAMc,MAAI,MACT,sBAAA,cAACd,MAAME,SAAO;IAACa,SAAAA;KACb,sBAAA,cAACb,QAAQY,MAAI,MACX,sBAAA,cAACf,MAAMe,MAAI,MACT,sBAAA,cAACf,MAAMiB,WAAS;IAACC,UAAAA;IAASC,aAAY;SAI5C,sBAAA,cAAClB,MAAMmB,SAAO;IAACJ,SAAAA;KACb,sBAAA,cAACjB,MAAAA;IAAKsB,MAAM;IAAGC,YAAW;KACxB,sBAAA,cAACpB,WAAWa,MAAI,MACd,sBAAA,cAACb,WAAWqB,UAAQ,MAClB,sBAAA,cAAC7B,aAAAA;IAAYgB,IAAIJ,MAAMI;IAAIc,UAAU,CAACC,WAAWjB,cAAciB,OAAOb,EAAE;QAG3EH,kBAAkB,sBAAA,cAACL,iBAAAA;IAAgBkB,YAAW;IAAMI,MAAMjB;;AAMvE;",
6
+ "names": ["React", "useState", "ObjectsTree", "Filter", "Query", "useQuery", "Clipboard", "Grid", "Input", "Panel", "ScrollArea", "Toolbar", "JsonHighlighter", "DebugSpaceObjectsPanel", "space", "selectedId", "setSelectedId", "selectedObject", "db", "select", "id", "nothing", "Provider", "Root", "asChild", "TextInput", "disabled", "placeholder", "Content", "rows", "classNames", "Viewport", "onSelect", "entity", "data"]
7
+ }
@@ -0,0 +1,121 @@
1
+ import "./chunk-J5LGTIGS.mjs";
2
+
3
+ // src/containers/DebugStatus/DebugStatus.tsx
4
+ import React, { useEffect, useRef, useState } from "react";
5
+ import { TimeoutError } from "@dxos/async";
6
+ import { StatusBar } from "@dxos/plugin-status-bar/components";
7
+ import { ConnectionState } from "@dxos/protocols/proto/dxos/client/services";
8
+ import { useNetworkStatus } from "@dxos/react-client/mesh";
9
+ import { IconButton } from "@dxos/react-ui";
10
+ var styles = {
11
+ success: "text-sky-300 dark:text-green-700",
12
+ warning: "text-orange-300 dark:text-orange-600",
13
+ error: "text-red-300 dark:text-red-600"
14
+ };
15
+ var ErrorIndicator = () => {
16
+ const [, forceUpdate] = useState({});
17
+ const errorRef = useRef(null);
18
+ useEffect(() => {
19
+ const errorListener = (event) => {
20
+ const error = event.error ?? event.reason;
21
+ if (errorRef.current !== error) {
22
+ errorRef.current = error;
23
+ forceUpdate({});
24
+ }
25
+ };
26
+ window.addEventListener("error", errorListener);
27
+ window.addEventListener("unhandledrejection", errorListener);
28
+ return () => {
29
+ window.removeEventListener("error", errorListener);
30
+ window.removeEventListener("unhandledrejection", errorListener);
31
+ };
32
+ }, []);
33
+ const handleReset = () => {
34
+ errorRef.current = null;
35
+ forceUpdate({});
36
+ };
37
+ if (errorRef.current) {
38
+ return /* @__PURE__ */ React.createElement(StatusBar.Item, null, /* @__PURE__ */ React.createElement(IconButton, {
39
+ icon: "ph--warning-circle--duotone",
40
+ iconOnly: true,
41
+ label: errorRef.current.message,
42
+ classNames: styles.error,
43
+ onClick: handleReset
44
+ }));
45
+ } else {
46
+ return /* @__PURE__ */ React.createElement(StatusBar.Item, null, /* @__PURE__ */ React.createElement(IconButton, {
47
+ variant: "ghost",
48
+ icon: "ph--check--regular",
49
+ iconOnly: true,
50
+ label: "No errors."
51
+ }));
52
+ }
53
+ };
54
+ var SwarmIndicator = () => {
55
+ const [state, setState] = useState(0);
56
+ const { swarm } = useNetworkStatus();
57
+ useEffect(() => {
58
+ setState(swarm === ConnectionState.ONLINE ? 0 : 1);
59
+ }, [
60
+ swarm
61
+ ]);
62
+ if (state === 0) {
63
+ return /* @__PURE__ */ React.createElement(StatusBar.Item, null, /* @__PURE__ */ React.createElement(IconButton, {
64
+ variant: "ghost",
65
+ icon: "ph--lightning--regular",
66
+ iconOnly: true,
67
+ label: "Connected to swarm."
68
+ }));
69
+ } else {
70
+ return /* @__PURE__ */ React.createElement(StatusBar.Item, null, /* @__PURE__ */ React.createElement(IconButton, {
71
+ variant: "ghost",
72
+ icon: "ph--lightning-slash--regular",
73
+ iconOnly: true,
74
+ label: "Disconnected from swarm.",
75
+ classNames: styles.warning
76
+ }));
77
+ }
78
+ };
79
+ var SavingIndicator = () => {
80
+ const [state, _setState] = useState(0);
81
+ switch (state) {
82
+ case 2:
83
+ return /* @__PURE__ */ React.createElement(StatusBar.Item, null, /* @__PURE__ */ React.createElement(IconButton, {
84
+ variant: "ghost",
85
+ icon: "ph--circle--duotone",
86
+ iconOnly: true,
87
+ label: "Edit not saved.",
88
+ classNames: styles.warning
89
+ }));
90
+ case 1:
91
+ return /* @__PURE__ */ React.createElement(StatusBar.Item, null, /* @__PURE__ */ React.createElement(IconButton, {
92
+ variant: "ghost",
93
+ icon: "ph--circle--duotone",
94
+ iconOnly: true,
95
+ label: "Saving...",
96
+ classNames: styles.success
97
+ }));
98
+ case 0:
99
+ default:
100
+ return /* @__PURE__ */ React.createElement(StatusBar.Item, null, /* @__PURE__ */ React.createElement(IconButton, {
101
+ variant: "ghost",
102
+ icon: "ph--circle--duotone",
103
+ iconOnly: true,
104
+ label: "Modified indicator."
105
+ }));
106
+ }
107
+ };
108
+ var indicators = [
109
+ SavingIndicator,
110
+ SwarmIndicator,
111
+ ErrorIndicator
112
+ ];
113
+ var DebugStatus = () => {
114
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, indicators.map((Indicator) => /* @__PURE__ */ React.createElement(Indicator, {
115
+ key: Indicator.name
116
+ })));
117
+ };
118
+ export {
119
+ DebugStatus as default
120
+ };
121
+ //# sourceMappingURL=DebugStatus-YB3KFP7G.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/containers/DebugStatus/DebugStatus.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { useEffect, useRef, useState } from 'react';\n\nimport { TimeoutError } from '@dxos/async';\nimport { StatusBar } from '@dxos/plugin-status-bar/components';\nimport { ConnectionState } from '@dxos/protocols/proto/dxos/client/services';\nimport { useNetworkStatus } from '@dxos/react-client/mesh';\nimport { IconButton } from '@dxos/react-ui';\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>(null);\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 = null;\n forceUpdate({});\n };\n\n if (errorRef.current) {\n return (\n <StatusBar.Item>\n <IconButton\n icon='ph--warning-circle--duotone'\n iconOnly\n label={errorRef.current.message}\n classNames={styles.error}\n onClick={handleReset}\n />\n </StatusBar.Item>\n );\n } else {\n return (\n <StatusBar.Item>\n <IconButton variant='ghost' icon='ph--check--regular' iconOnly label='No errors.' />\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>\n <IconButton variant='ghost' icon='ph--lightning--regular' iconOnly label='Connected to swarm.' />\n </StatusBar.Item>\n );\n } else {\n return (\n <StatusBar.Item>\n <IconButton\n variant='ghost'\n icon='ph--lightning-slash--regular'\n iconOnly\n label='Disconnected from swarm.'\n classNames={styles.warning}\n />\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 // 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>\n <IconButton\n variant='ghost'\n icon='ph--circle--duotone'\n iconOnly\n label='Edit not saved.'\n classNames={styles.warning}\n />\n </StatusBar.Item>\n );\n case 1:\n return (\n <StatusBar.Item>\n <IconButton\n variant='ghost'\n icon='ph--circle--duotone'\n iconOnly\n label='Saving...'\n classNames={styles.success}\n />\n </StatusBar.Item>\n );\n case 0:\n default:\n return (\n <StatusBar.Item>\n <IconButton variant='ghost' icon='ph--circle--duotone' iconOnly label='Modified indicator.' />\n </StatusBar.Item>\n );\n }\n};\n\nconst indicators = [SavingIndicator, SwarmIndicator, ErrorIndicator];\n\nexport const DebugStatus = () => {\n return (\n <>\n {indicators.map((Indicator) => (\n <Indicator key={Indicator.name} />\n ))}\n </>\n );\n};\n"],
5
+ "mappings": ";;;AAIA,OAAOA,SAASC,WAAWC,QAAQC,gBAAgB;AAEnD,SAASC,oBAAoB;AAC7B,SAASC,iBAAiB;AAC1B,SAASC,uBAAuB;AAChC,SAASC,wBAAwB;AACjC,SAASC,kBAAkB;AAE3B,IAAMC,SAAS;EACbC,SAAS;EACTC,SAAS;EACTC,OAAO;AACT;AA0CA,IAAMC,iBAAiB,MAAA;AACrB,QAAM,CAAA,EAAGC,WAAAA,IAAeC,SAAS,CAAC,CAAA;AAClC,QAAMC,WAAWC,OAAc,IAAA;AAC/BC,YAAU,MAAA;AACR,UAAMC,gBAAgB,CAACC,UAAAA;AACrB,YAAMC,QAAeD,MAAMC,SAASD,MAAME;AAC1C,UAAIN,SAASO,YAAYF,OAAO;AAC9BL,iBAASO,UAAUF;AACnBP,oBAAY,CAAC,CAAA;MACf;IACF;AAIAU,WAAOC,iBAAiB,SAASN,aAAAA;AAGjCK,WAAOC,iBAAiB,sBAAsBN,aAAAA;AAE9C,WAAO,MAAA;AACLK,aAAOE,oBAAoB,SAASP,aAAAA;AACpCK,aAAOE,oBAAoB,sBAAsBP,aAAAA;IACnD;EACF,GAAG,CAAA,CAAE;AAEL,QAAMQ,cAAc,MAAA;AAClBX,aAASO,UAAU;AACnBT,gBAAY,CAAC,CAAA;EACf;AAEA,MAAI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;IAI3B,KAAK;IACL;AACE,aACE,sBAAA,cAACrB,UAAUC,MAAI,MACb,sBAAA,cAACC,YAAAA;QAAWQ,SAAQ;QAAQP,MAAK;QAAsBC,UAAAA;QAASC,OAAM;;EAG9E;AACF;AAEA,IAAMiB,aAAa;EAACH;EAAiBR;EAAgB1B;;AAE9C,IAAMsC,cAAc,MAAA;AACzB,SACE,sBAAA,cAAA,MAAA,UAAA,MACGD,WAAWE,IAAI,CAACC,cACf,sBAAA,cAACA,WAAAA;IAAUC,KAAKD,UAAUE;;AAIlC;",
6
+ "names": ["React", "useEffect", "useRef", "useState", "TimeoutError", "StatusBar", "ConnectionState", "useNetworkStatus", "IconButton", "styles", "success", "warning", "error", "ErrorIndicator", "forceUpdate", "useState", "errorRef", "useRef", "useEffect", "errorListener", "event", "error", "reason", "current", "window", "addEventListener", "removeEventListener", "handleReset", "StatusBar", "Item", "IconButton", "icon", "iconOnly", "label", "message", "classNames", "styles", "onClick", "variant", "SwarmIndicator", "state", "setState", "swarm", "useNetworkStatus", "ConnectionState", "ONLINE", "warning", "SavingIndicator", "_setState", "success", "indicators", "DebugStatus", "map", "Indicator", "key", "name"]
7
+ }
@@ -0,0 +1,23 @@
1
+ import "./chunk-J5LGTIGS.mjs";
2
+
3
+ // src/containers/DevtoolsOverviewContainer/DevtoolsOverviewContainer.tsx
4
+ import React from "react";
5
+ import { Surface } from "@dxos/app-framework/ui";
6
+ import { StatsPanel, useStats } from "@dxos/devtools";
7
+ var DevtoolsOverviewContainer = () => {
8
+ const [stats, refreshStats] = useStats();
9
+ const surfaceProfilerStats = Surface.useProfilerStats();
10
+ const clearSurfaceProfiler = Surface.useProfilerClear();
11
+ return /* @__PURE__ */ React.createElement(StatsPanel, {
12
+ stats,
13
+ surfaceProfilerStats,
14
+ onRefresh: refreshStats,
15
+ onClearSurfaceProfiler: clearSurfaceProfiler
16
+ }, /* @__PURE__ */ React.createElement(Surface.Surface, {
17
+ role: "devtools-overview"
18
+ }));
19
+ };
20
+ export {
21
+ DevtoolsOverviewContainer as default
22
+ };
23
+ //# sourceMappingURL=DevtoolsOverviewContainer-YX7Z3D2H.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/containers/DevtoolsOverviewContainer/DevtoolsOverviewContainer.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Surface } from '@dxos/app-framework/ui';\nimport { StatsPanel, useStats } from '@dxos/devtools';\n\nexport const DevtoolsOverviewContainer = () => {\n const [stats, refreshStats] = useStats();\n const surfaceProfilerStats = Surface.useProfilerStats();\n const clearSurfaceProfiler = Surface.useProfilerClear();\n\n return (\n <StatsPanel\n stats={stats}\n surfaceProfilerStats={surfaceProfilerStats}\n onRefresh={refreshStats}\n onClearSurfaceProfiler={clearSurfaceProfiler}\n >\n <Surface.Surface role='devtools-overview' />\n </StatsPanel>\n );\n};\n"],
5
+ "mappings": ";;;AAIA,OAAOA,WAAW;AAElB,SAASC,eAAe;AACxB,SAASC,YAAYC,gBAAgB;AAE9B,IAAMC,4BAA4B,MAAA;AACvC,QAAM,CAACC,OAAOC,YAAAA,IAAgBH,SAAAA;AAC9B,QAAMI,uBAAuBN,QAAQO,iBAAgB;AACrD,QAAMC,uBAAuBR,QAAQS,iBAAgB;AAErD,SACE,sBAAA,cAACR,YAAAA;IACCG;IACAE;IACAI,WAAWL;IACXM,wBAAwBH;KAExB,sBAAA,cAACR,QAAQA,SAAO;IAACY,MAAK;;AAG5B;",
6
+ "names": ["React", "Surface", "StatsPanel", "useStats", "DevtoolsOverviewContainer", "stats", "refreshStats", "surfaceProfilerStats", "useProfilerStats", "clearSurfaceProfiler", "useProfilerClear", "onRefresh", "onClearSurfaceProfiler", "role"]
7
+ }
@@ -0,0 +1,177 @@
1
+ import "./chunk-J5LGTIGS.mjs";
2
+
3
+ // src/containers/GithubPanel/GithubPanel.tsx
4
+ import React2 from "react";
5
+
6
+ // src/containers/GithubPanel/GithubComponent.tsx
7
+ import React, { createContext, useContext, useEffect, useState } from "react";
8
+ import { IconButton, ScrollArea, useTranslation } from "@dxos/react-ui";
9
+ import { meta } from "#meta";
10
+ var DEFAULT_REPO = "dxos/dxos";
11
+ var DEFAULT_LIMIT = 20;
12
+ var ComponentContext = /* @__PURE__ */ createContext(null);
13
+ var useComponentContext = () => {
14
+ const ctx = useContext(ComponentContext);
15
+ if (!ctx) {
16
+ throw new Error("GithubComponent.* parts must be rendered inside GithubComponent.Root.");
17
+ }
18
+ return ctx;
19
+ };
20
+ var Root = ({ repo = DEFAULT_REPO, limit = DEFAULT_LIMIT, children }) => {
21
+ const [pulls, setPulls] = useState([]);
22
+ const [unavailable, setUnavailable] = useState(false);
23
+ useEffect(() => {
24
+ const controller = new AbortController();
25
+ setPulls([]);
26
+ setUnavailable(false);
27
+ void (async () => {
28
+ try {
29
+ const url = new URL(`https://api.github.com/repos/${repo}/pulls`);
30
+ url.searchParams.set("state", "closed");
31
+ url.searchParams.set("sort", "updated");
32
+ url.searchParams.set("direction", "desc");
33
+ url.searchParams.set("per_page", String(limit * 2));
34
+ const response = await fetch(url.toString(), {
35
+ signal: controller.signal,
36
+ headers: {
37
+ Accept: "application/vnd.github+json"
38
+ }
39
+ });
40
+ if (!response.ok) {
41
+ setUnavailable(true);
42
+ return;
43
+ }
44
+ const items = await response.json();
45
+ setPulls(items.filter((pull) => pull.merged_at !== null).slice(0, limit));
46
+ setUnavailable(false);
47
+ } catch {
48
+ if (controller.signal.aborted) {
49
+ return;
50
+ }
51
+ setPulls([]);
52
+ setUnavailable(true);
53
+ }
54
+ })();
55
+ return () => controller.abort();
56
+ }, [
57
+ repo,
58
+ limit
59
+ ]);
60
+ return /* @__PURE__ */ React.createElement(ComponentContext.Provider, {
61
+ value: {
62
+ repo,
63
+ pulls,
64
+ unavailable
65
+ }
66
+ }, children);
67
+ };
68
+ var Header = () => {
69
+ const { t } = useTranslation(meta.id);
70
+ const { repo, pulls, unavailable } = useComponentContext();
71
+ return /* @__PURE__ */ React.createElement("header", {
72
+ className: "flex items-center justify-between gap-1 px-4 py-3 bg-modal-surface border-b border-subdued-separator"
73
+ }, /* @__PURE__ */ React.createElement("a", {
74
+ href: `https://github.com/${repo}`,
75
+ target: "_blank",
76
+ rel: "noopener noreferrer",
77
+ className: "text-sm font-medium truncate"
78
+ }, "@", repo), /* @__PURE__ */ React.createElement("div", {
79
+ className: "text-xs text-description"
80
+ }, unavailable ? t("github-unavailable.message") : pulls.length > 0 ? t("recent-prs.label", {
81
+ count: pulls.length
82
+ }) : t("github-loading.message")));
83
+ };
84
+ var RELATIVE_UNITS = [
85
+ [
86
+ "year",
87
+ 60 * 60 * 24 * 365
88
+ ],
89
+ [
90
+ "month",
91
+ 60 * 60 * 24 * 30
92
+ ],
93
+ [
94
+ "week",
95
+ 60 * 60 * 24 * 7
96
+ ],
97
+ [
98
+ "day",
99
+ 60 * 60 * 24
100
+ ],
101
+ [
102
+ "hour",
103
+ 60 * 60
104
+ ],
105
+ [
106
+ "minute",
107
+ 60
108
+ ]
109
+ ];
110
+ var formatRelative = (iso) => {
111
+ const formatter = new Intl.RelativeTimeFormat(void 0, {
112
+ numeric: "auto"
113
+ });
114
+ const diffSeconds = (Date.parse(iso) - Date.now()) / 1e3;
115
+ const absDiff = Math.abs(diffSeconds);
116
+ for (const [unit, secondsInUnit] of RELATIVE_UNITS) {
117
+ if (absDiff >= secondsInUnit) {
118
+ return formatter.format(Math.round(diffSeconds / secondsInUnit), unit);
119
+ }
120
+ }
121
+ return formatter.format(Math.round(diffSeconds), "second");
122
+ };
123
+ var PullRow = ({ pull }) => /* @__PURE__ */ React.createElement("li", null, /* @__PURE__ */ React.createElement("a", {
124
+ href: pull.html_url,
125
+ target: "_blank",
126
+ rel: "noopener noreferrer",
127
+ className: "flex items-start gap-2 px-2 py-1 rounded-sm hover:bg-hover-surface"
128
+ }, /* @__PURE__ */ React.createElement("img", {
129
+ src: pull.user.avatar_url,
130
+ alt: "",
131
+ className: "w-6 h-6 rounded-full shrink-0 mt-0.5"
132
+ }), /* @__PURE__ */ React.createElement("div", {
133
+ className: "flex flex-col min-w-0 flex-1"
134
+ }, /* @__PURE__ */ React.createElement("span", {
135
+ className: "text-sm truncate"
136
+ }, pull.title), /* @__PURE__ */ React.createElement("span", {
137
+ className: "text-xs text-description truncate"
138
+ }, "#", pull.number, " \xB7 ", pull.user.login, " \xB7 ", pull.merged_at ? formatRelative(pull.merged_at) : ""))));
139
+ var Content = () => {
140
+ const { pulls } = useComponentContext();
141
+ return /* @__PURE__ */ React.createElement(ScrollArea.Root, {
142
+ orientation: "vertical"
143
+ }, /* @__PURE__ */ React.createElement(ScrollArea.Viewport, null, /* @__PURE__ */ React.createElement("ul", {
144
+ className: "flex flex-col p-1"
145
+ }, pulls.map((pull) => /* @__PURE__ */ React.createElement(PullRow, {
146
+ key: pull.number,
147
+ pull
148
+ })))));
149
+ };
150
+ var StatusBar = () => {
151
+ const { t } = useTranslation(meta.id);
152
+ const { repo } = useComponentContext();
153
+ return /* @__PURE__ */ React.createElement(IconButton, {
154
+ icon: "ph--github-logo--regular",
155
+ label: t("view-on-github.button"),
156
+ variant: "primary",
157
+ classNames: "w-full",
158
+ onClick: () => {
159
+ window.open(`https://github.com/${repo}`, "_blank", "noopener,noreferrer");
160
+ }
161
+ });
162
+ };
163
+ var GithubComponent = {
164
+ Root,
165
+ Header,
166
+ Content,
167
+ StatusBar
168
+ };
169
+
170
+ // src/containers/GithubPanel/GithubPanel.tsx
171
+ var GithubPanel = () => /* @__PURE__ */ React2.createElement(GithubComponent.Root, null, /* @__PURE__ */ React2.createElement("div", {
172
+ className: "h-full grid grid-rows-[auto_minmax(0,1fr)_auto] overflow-hidden h-full is-full"
173
+ }, /* @__PURE__ */ React2.createElement(GithubComponent.Header, null), /* @__PURE__ */ React2.createElement(GithubComponent.Content, null), /* @__PURE__ */ React2.createElement(GithubComponent.StatusBar, null)));
174
+ export {
175
+ GithubPanel as default
176
+ };
177
+ //# sourceMappingURL=GithubPanel-QJKDJRVQ.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/containers/GithubPanel/GithubPanel.tsx", "../../../src/containers/GithubPanel/GithubComponent.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport React from 'react';\n\nimport { GithubComponent } from './GithubComponent';\n\nexport const GithubPanel = () => (\n <GithubComponent.Root>\n <div className='h-full grid grid-rows-[auto_minmax(0,1fr)_auto] overflow-hidden h-full is-full'>\n <GithubComponent.Header />\n <GithubComponent.Content />\n <GithubComponent.StatusBar />\n </div>\n </GithubComponent.Root>\n);\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport React, { type ReactNode, createContext, useContext, useEffect, useState } from 'react';\n\nimport { IconButton, ScrollArea, useTranslation } from '@dxos/react-ui';\n\nimport { meta } from '#meta';\n\nconst DEFAULT_REPO = 'dxos/dxos';\nconst DEFAULT_LIMIT = 20;\n\ntype GithubUser = {\n login: string;\n avatar_url: string;\n html_url: string;\n};\n\ntype GithubPullRequest = {\n number: number;\n title: string;\n html_url: string;\n merged_at: string | null;\n user: GithubUser;\n};\n\ntype ComponentContextValue = {\n repo: string;\n pulls: GithubPullRequest[];\n unavailable: boolean;\n};\n\nconst ComponentContext = createContext<ComponentContextValue | null>(null);\n\nconst useComponentContext = () => {\n const ctx = useContext(ComponentContext);\n if (!ctx) {\n throw new Error('GithubComponent.* parts must be rendered inside GithubComponent.Root.');\n }\n return ctx;\n};\n\nexport type GithubComponentRootProps = {\n /** `<owner>/<name>`. Defaults to `dxos/dxos`. */\n repo?: string;\n /** Maximum number of merged PRs to fetch. */\n limit?: number;\n children?: ReactNode;\n};\n\nconst Root = ({ repo = DEFAULT_REPO, limit = DEFAULT_LIMIT, children }: GithubComponentRootProps) => {\n const [pulls, setPulls] = useState<GithubPullRequest[]>([]);\n const [unavailable, setUnavailable] = useState(false);\n\n useEffect(() => {\n const controller = new AbortController();\n setPulls([]);\n setUnavailable(false);\n void (async () => {\n try {\n const url = new URL(`https://api.github.com/repos/${repo}/pulls`);\n url.searchParams.set('state', 'closed');\n url.searchParams.set('sort', 'updated');\n url.searchParams.set('direction', 'desc');\n url.searchParams.set('per_page', String(limit * 2));\n const response = await fetch(url.toString(), {\n signal: controller.signal,\n headers: { Accept: 'application/vnd.github+json' },\n });\n if (!response.ok) {\n setUnavailable(true);\n return;\n }\n const items = (await response.json()) as GithubPullRequest[];\n setPulls(items.filter((pull) => pull.merged_at !== null).slice(0, limit));\n setUnavailable(false);\n } catch {\n if (controller.signal.aborted) {\n return;\n }\n setPulls([]);\n setUnavailable(true);\n }\n })();\n return () => controller.abort();\n }, [repo, limit]);\n\n return <ComponentContext.Provider value={{ repo, pulls, unavailable }}>{children}</ComponentContext.Provider>;\n};\n\nconst Header = () => {\n const { t } = useTranslation(meta.id);\n const { repo, pulls, unavailable } = useComponentContext();\n return (\n <header className='flex items-center justify-between gap-1 px-4 py-3 bg-modal-surface border-b border-subdued-separator'>\n <a\n href={`https://github.com/${repo}`}\n target='_blank'\n rel='noopener noreferrer'\n className='text-sm font-medium truncate'\n >\n @{repo}\n </a>\n <div className='text-xs text-description'>\n {unavailable\n ? t('github-unavailable.message')\n : pulls.length > 0\n ? t('recent-prs.label', { count: pulls.length })\n : t('github-loading.message')}\n </div>\n </header>\n );\n};\n\nconst RELATIVE_UNITS: Array<[Intl.RelativeTimeFormatUnit, number]> = [\n ['year', 60 * 60 * 24 * 365],\n ['month', 60 * 60 * 24 * 30],\n ['week', 60 * 60 * 24 * 7],\n ['day', 60 * 60 * 24],\n ['hour', 60 * 60],\n ['minute', 60],\n];\n\nconst formatRelative = (iso: string): string => {\n const formatter = new Intl.RelativeTimeFormat(undefined, { numeric: 'auto' });\n const diffSeconds = (Date.parse(iso) - Date.now()) / 1000;\n const absDiff = Math.abs(diffSeconds);\n for (const [unit, secondsInUnit] of RELATIVE_UNITS) {\n if (absDiff >= secondsInUnit) {\n return formatter.format(Math.round(diffSeconds / secondsInUnit), unit);\n }\n }\n return formatter.format(Math.round(diffSeconds), 'second');\n};\n\nconst PullRow = ({ pull }: { pull: GithubPullRequest }) => (\n <li>\n <a\n href={pull.html_url}\n target='_blank'\n rel='noopener noreferrer'\n className='flex items-start gap-2 px-2 py-1 rounded-sm hover:bg-hover-surface'\n >\n <img src={pull.user.avatar_url} alt='' className='w-6 h-6 rounded-full shrink-0 mt-0.5' />\n <div className='flex flex-col min-w-0 flex-1'>\n <span className='text-sm truncate'>{pull.title}</span>\n <span className='text-xs text-description truncate'>\n #{pull.number} · {pull.user.login} · {pull.merged_at ? formatRelative(pull.merged_at) : ''}\n </span>\n </div>\n </a>\n </li>\n);\n\nconst Content = () => {\n const { pulls } = useComponentContext();\n return (\n <ScrollArea.Root orientation='vertical'>\n <ScrollArea.Viewport>\n <ul className='flex flex-col p-1'>\n {pulls.map((pull) => (\n <PullRow key={pull.number} pull={pull} />\n ))}\n </ul>\n </ScrollArea.Viewport>\n </ScrollArea.Root>\n );\n};\n\nconst StatusBar = () => {\n const { t } = useTranslation(meta.id);\n const { repo } = useComponentContext();\n return (\n <IconButton\n icon='ph--github-logo--regular'\n label={t('view-on-github.button')}\n variant='primary'\n classNames='w-full'\n onClick={() => {\n window.open(`https://github.com/${repo}`, '_blank', 'noopener,noreferrer');\n }}\n />\n );\n};\n\nexport const GithubComponent = {\n Root,\n Header,\n Content,\n StatusBar,\n};\n"],
5
+ "mappings": ";;;AAIA,OAAOA,YAAW;;;ACAlB,OAAOC,SAAyBC,eAAeC,YAAYC,WAAWC,gBAAgB;AAEtF,SAASC,YAAYC,YAAYC,sBAAsB;AAEvD,SAASC,YAAY;AAErB,IAAMC,eAAe;AACrB,IAAMC,gBAAgB;AAsBtB,IAAMC,mBAAmBV,8BAA4C,IAAA;AAErE,IAAMW,sBAAsB,MAAA;AAC1B,QAAMC,MAAMX,WAAWS,gBAAAA;AACvB,MAAI,CAACE,KAAK;AACR,UAAM,IAAIC,MAAM,uEAAA;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cAACC,gBAAgBI,QAAM,IAAA,GACvB,gBAAAL,OAAA,cAACC,gBAAgBK,SAAO,IAAA,GACxB,gBAAAN,OAAA,cAACC,gBAAgBM,WAAS,IAAA,CAAA,CAAA;",
6
+ "names": ["React", "React", "createContext", "useContext", "useEffect", "useState", "IconButton", "ScrollArea", "useTranslation", "meta", "DEFAULT_REPO", "DEFAULT_LIMIT", "ComponentContext", "useComponentContext", "ctx", "Error", "Root", "repo", "limit", "children", "pulls", "setPulls", "unavailable", "setUnavailable", "controller", "AbortController", "url", "URL", "searchParams", "set", "String", "response", "fetch", "toString", "signal", "headers", "Accept", "ok", "items", "json", "filter", "pull", "merged_at", "slice", "aborted", "abort", "Provider", "value", "Header", "t", "id", "header", "className", "a", "href", "target", "rel", "div", "length", "count", "RELATIVE_UNITS", "formatRelative", "iso", "formatter", "Intl", "RelativeTimeFormat", "undefined", "numeric", "diffSeconds", "Date", "parse", "now", "absDiff", "Math", "abs", "unit", "secondsInUnit", "format", "round", "PullRow", "li", "html_url", "img", "src", "user", "avatar_url", "alt", "span", "title", "number", "login", "Content", "orientation", "Viewport", "ul", "map", "key", "StatusBar", "icon", "label", "variant", "classNames", "onClick", "window", "open", "GithubComponent", "GithubPanel", "React", "GithubComponent", "Root", "div", "className", "Header", "Content", "StatusBar"]
7
+ }
@@ -0,0 +1,143 @@
1
+ import "./chunk-J5LGTIGS.mjs";
2
+
3
+ // src/containers/SpaceGenerator/SpaceGenerator.tsx
4
+ import React, { useCallback, useMemo, useState } from "react";
5
+ import { useOperationInvoker } from "@dxos/app-framework/ui";
6
+ import { ComputeGraph } from "@dxos/conductor";
7
+ import { Filter, Obj, Type } from "@dxos/echo";
8
+ import { Markdown } from "@dxos/plugin-markdown";
9
+ import { Sheet } from "@dxos/plugin-sheet";
10
+ import { Sketch } from "@dxos/plugin-sketch";
11
+ import { useClient } from "@dxos/react-client";
12
+ import { IconButton, Input, Panel, ScrollArea, Toolbar, useAsyncEffect } from "@dxos/react-ui";
13
+ import { composable, composableProps } from "@dxos/react-ui";
14
+ import { Organization, Person, Task } from "@dxos/types";
15
+ import { sortKeys } from "@dxos/util";
16
+ import { SchemaTable, createGenerator, generator, staticGenerators } from "#components";
17
+ var staticTypes = [
18
+ Markdown.Document,
19
+ Sketch.Sketch,
20
+ Sheet.Sheet,
21
+ ComputeGraph
22
+ ];
23
+ var recordTypes = [
24
+ Organization.Organization,
25
+ Person.Person,
26
+ Task.Task
27
+ ];
28
+ var SpaceGenerator = composable(({ space, onCreateObjects, children, ...props }, forwardedRef) => {
29
+ const { invokePromise } = useOperationInvoker();
30
+ const client = useClient();
31
+ const [count, setCount] = useState(1);
32
+ const [info, setInfo] = useState({});
33
+ const presets = useMemo(() => generator(), []);
34
+ useAsyncEffect(async () => {
35
+ await client.addTypes([
36
+ ...staticTypes,
37
+ ...recordTypes,
38
+ ...presets.schemas
39
+ ]);
40
+ }, [
41
+ client,
42
+ presets
43
+ ]);
44
+ const typeMap = useMemo(() => {
45
+ const recordGenerators = new Map(recordTypes.map((type) => [
46
+ Type.getTypename(type),
47
+ createGenerator(client, invokePromise, type)
48
+ ]));
49
+ return new Map([
50
+ ...staticGenerators,
51
+ ...presets.items,
52
+ ...recordGenerators
53
+ ]);
54
+ }, [
55
+ client,
56
+ invokePromise,
57
+ presets
58
+ ]);
59
+ const updateInfo = useCallback(async () => {
60
+ const echoSchema = await space.db.schemaRegistry.query().run();
61
+ const staticSchema = await space.db.graph.schemaRegistry.query().run();
62
+ const objects = await space.db.query(Filter.everything()).run();
63
+ const objectMap = sortKeys(objects.reduce((map, obj) => {
64
+ const type = Obj.getTypename(obj);
65
+ if (type) {
66
+ const count2 = map[type] ?? 0;
67
+ map[type] = count2 + 1;
68
+ }
69
+ return map;
70
+ }, {}));
71
+ setInfo({
72
+ schema: {
73
+ static: staticSchema.length,
74
+ mutable: echoSchema.length
75
+ },
76
+ objects: objectMap
77
+ });
78
+ }, [
79
+ space
80
+ ]);
81
+ useAsyncEffect(updateInfo, [
82
+ updateInfo
83
+ ]);
84
+ const handleCreateData = useCallback(async (typename) => {
85
+ const constructor = typeMap.get(typename);
86
+ if (constructor) {
87
+ await constructor(space, count, onCreateObjects);
88
+ await updateInfo();
89
+ }
90
+ }, [
91
+ typeMap,
92
+ count,
93
+ space,
94
+ onCreateObjects,
95
+ updateInfo
96
+ ]);
97
+ return /* @__PURE__ */ React.createElement(Panel.Root, {
98
+ ...composableProps(props),
99
+ ref: forwardedRef
100
+ }, /* @__PURE__ */ React.createElement(Panel.Toolbar, {
101
+ asChild: true
102
+ }, /* @__PURE__ */ React.createElement(Toolbar.Root, null, /* @__PURE__ */ React.createElement(IconButton, {
103
+ icon: "ph--arrow-clockwise--regular",
104
+ iconOnly: true,
105
+ label: "Refresh",
106
+ onClick: updateInfo
107
+ }), /* @__PURE__ */ React.createElement(Toolbar.Separator, null), /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement(Input.TextInput, {
108
+ type: "number",
109
+ placeholder: "Count",
110
+ classNames: "w-[4rem] text-right",
111
+ min: 1,
112
+ max: 100,
113
+ size: 8,
114
+ value: count,
115
+ onChange: (event) => setCount(parseInt(event.target.value))
116
+ })))), /* @__PURE__ */ React.createElement(Panel.Content, {
117
+ asChild: true
118
+ }, /* @__PURE__ */ React.createElement(ScrollArea.Root, {
119
+ thin: true,
120
+ orientation: "vertical"
121
+ }, /* @__PURE__ */ React.createElement(ScrollArea.Viewport, {
122
+ classNames: "dx-document gap-4 divide-y divide-subdued-separator"
123
+ }, /* @__PURE__ */ React.createElement(SchemaTable, {
124
+ types: staticTypes,
125
+ objects: info.objects,
126
+ label: "Static Types",
127
+ onClick: handleCreateData
128
+ }), /* @__PURE__ */ React.createElement(SchemaTable, {
129
+ types: recordTypes,
130
+ objects: info.objects,
131
+ label: "Record Types",
132
+ onClick: handleCreateData
133
+ }), /* @__PURE__ */ React.createElement(SchemaTable, {
134
+ types: presets.types,
135
+ objects: info.objects,
136
+ label: "Presets",
137
+ onClick: handleCreateData
138
+ })))));
139
+ });
140
+ export {
141
+ SpaceGenerator as default
142
+ };
143
+ //# sourceMappingURL=SpaceGenerator-IQLBDY6R.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/containers/SpaceGenerator/SpaceGenerator.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useCallback, useMemo, useState } from 'react';\n\nimport { useOperationInvoker } from '@dxos/app-framework/ui';\nimport { ComputeGraph } from '@dxos/conductor';\nimport { Filter, Obj, Type } from '@dxos/echo';\nimport { Markdown } from '@dxos/plugin-markdown';\nimport { Sheet } from '@dxos/plugin-sheet';\nimport { Sketch } from '@dxos/plugin-sketch';\nimport { useClient } from '@dxos/react-client';\nimport { type Space } from '@dxos/react-client/echo';\nimport { IconButton, Input, Panel, ScrollArea, Toolbar, useAsyncEffect } from '@dxos/react-ui';\nimport { composable, composableProps } from '@dxos/react-ui';\nimport { Organization, Person, Task } from '@dxos/types';\nimport { sortKeys } from '@dxos/util';\n\nimport { type ObjectGenerator, SchemaTable, createGenerator, generator, staticGenerators } from '#components';\n\n// TODO(burdon): Make extensible.\nconst staticTypes = [Markdown.Document, Sketch.Sketch, Sheet.Sheet, ComputeGraph];\nconst recordTypes: Type.AnyObj[] = [Organization.Organization, Person.Person, Task.Task];\n\nexport type SpaceGeneratorProps = {\n space: Space;\n onCreateObjects?: (objects: Obj.Unknown[]) => void;\n};\n\nexport const SpaceGenerator = composable<HTMLDivElement, SpaceGeneratorProps>(\n ({ space, onCreateObjects, children, ...props }, forwardedRef) => {\n const { invokePromise } = useOperationInvoker();\n const client = useClient();\n const [count, setCount] = useState(1);\n const [info, setInfo] = useState<any>({});\n const presets = useMemo(() => generator(), []);\n\n // Register types.\n useAsyncEffect(async () => {\n await client.addTypes([...staticTypes, ...recordTypes, ...presets.schemas]);\n }, [client, presets]);\n\n // Create type generators.\n const typeMap = useMemo(() => {\n const recordGenerators = new Map<string, ObjectGenerator<any>>(\n recordTypes.map((type) => [Type.getTypename(type), createGenerator(client, invokePromise, type)]),\n );\n\n return new Map([...staticGenerators, ...presets.items, ...recordGenerators]);\n }, [client, invokePromise, presets]);\n\n // Query space to get info.\n const updateInfo = useCallback(async () => {\n const echoSchema = await space.db.schemaRegistry.query().run();\n const staticSchema = await space.db.graph.schemaRegistry.query().run();\n\n const objects = await space.db.query(Filter.everything()).run();\n const objectMap = sortKeys(\n objects.reduce<Record<string, number>>((map, obj) => {\n const type = Obj.getTypename(obj);\n if (type) {\n const count = map[type] ?? 0;\n map[type] = count + 1;\n }\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 }, [space]);\n\n useAsyncEffect(updateInfo, [updateInfo]);\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, space, onCreateObjects, updateInfo],\n );\n\n return (\n <Panel.Root {...composableProps(props)} ref={forwardedRef}>\n <Panel.Toolbar asChild>\n <Toolbar.Root>\n <IconButton icon='ph--arrow-clockwise--regular' iconOnly label='Refresh' onClick={updateInfo} />\n <Toolbar.Separator />\n <Input.Root>\n <Input.TextInput\n type='number'\n placeholder='Count'\n classNames='w-[4rem] text-right'\n min={1}\n max={100}\n size={8}\n value={count}\n onChange={(event) => setCount(parseInt(event.target.value))}\n />\n </Input.Root>\n </Toolbar.Root>\n </Panel.Toolbar>\n <Panel.Content asChild>\n <ScrollArea.Root thin orientation='vertical'>\n <ScrollArea.Viewport classNames='dx-document gap-4 divide-y divide-subdued-separator'>\n <SchemaTable types={staticTypes} objects={info.objects} label='Static Types' onClick={handleCreateData} />\n <SchemaTable types={recordTypes} objects={info.objects} label='Record Types' onClick={handleCreateData} />\n <SchemaTable types={presets.types} objects={info.objects} label='Presets' onClick={handleCreate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0D,MAAI,MACX,sBAAA,cAAC9D,YAAAA;IAAWiE,MAAK;IAA+BC,UAAAA;IAASC,OAAM;IAAUC,SAAS3B;MAClF,sBAAA,cAACrC,QAAQiE,WAAS,IAAA,GAClB,sBAAA,cAACpE,MAAM6D,MAAI,MACT,sBAAA,cAAC7D,MAAMqE,WAAS;IACdhC,MAAK;IACLiC,aAAY;IACZC,YAAW;IACXC,KAAK;IACLC,KAAK;IACLC,MAAM;IACNC,OAAOjD;IACPkD,UAAU,CAACC,UAAUlD,SAASmD,SAASD,MAAME,OAAOJ,KAAK,CAAA;SAKjE,sBAAA,cAAC1E,MAAM+E,SAAO;IAACjB,SAAAA;KACb,sBAAA,cAAC7D,WAAW2D,MAAI;IAACoB,MAAAA;IAAKC,aAAY;KAChC,sBAAA,cAAChF,WAAWiF,UAAQ;IAACZ,YAAW;KAC9B,sBAAA,cAAC5D,aAAAA;IAAYyE,OAAOrE;IAAaiC,SAASpB,KAAKoB;IAASkB,OAAM;IAAeC,SAASV;MACtF,sBAAA,cAAC9C,aAAAA;IAAYyE,OAAOnE;IAAa+B,SAASpB,KAAKoB;IAASkB,OAAM;IAAeC,SAASV;MACtF,sBAAA,cAAC9C,aAAAA;IAAYyE,OAAOtD,QAAQsD;IAAOpC,SAASpB,KAAKoB;IAASkB,OAAM;IAAUC,SAASV;;AAM/F,CAAA;",
6
+ "names": ["React", "useCallback", "useMemo", "useState", "useOperationInvoker", "ComputeGraph", "Filter", "Obj", "Type", "Markdown", "Sheet", "Sketch", "useClient", "IconButton", "Input", "Panel", "ScrollArea", "Toolbar", "useAsyncEffect", "composable", "composableProps", "Organization", "Person", "Task", "sortKeys", "SchemaTable", "createGenerator", "generator", "staticGenerators", "staticTypes", "Document", "recordTypes", "SpaceGenerator", "space", "onCreateObjects", "children", "props", "forwardedRef", "invokePromise", "client", "count", "setCount", "info", "setInfo", "presets", "addTypes", "schemas", "typeMap", "recordGenerators", "Map", "map", "type", "getTypename", "items", "updateInfo", "echoSchema", "db", "schemaRegistry", "query", "run", "staticSchema", "graph", "objects", "everything", "objectMap", "reduce", "obj", "schema", "static", "length", "mutable", "handleCreateData", "typename", "constructor", "get", "Root", "ref", "asChild", "icon", "iconOnly", "label", "onClick", "Separator", "TextInput", "placeholder", "classNames", "min", "max", "size", "value", "onChange", "event", "parseInt", "target", "Content", "thin", "orientation", "Viewport", "types"]
7
+ }
@@ -0,0 +1,52 @@
1
+ import "./chunk-J5LGTIGS.mjs";
2
+
3
+ // src/containers/Wireframe/Wireframe.tsx
4
+ import React from "react";
5
+ import { useResizeDetector } from "react-resize-detector";
6
+ import { Obj } from "@dxos/echo";
7
+ import { useAttentionAttributes } from "@dxos/react-ui-attention";
8
+ import { JsonHighlighter } from "@dxos/react-ui-syntax-highlighter";
9
+ import { mx } from "@dxos/ui-theme";
10
+ var Wireframe = ({ classNames, label, object }) => {
11
+ const attentionAttrs = useAttentionAttributes(Obj.getURI(object));
12
+ const { width, height, ref } = useResizeDetector();
13
+ return /* @__PURE__ */ React.createElement("div", {
14
+ ref,
15
+ className: mx("relative grow min-h-96", classNames),
16
+ ...attentionAttrs
17
+ }, /* @__PURE__ */ React.createElement("div", {
18
+ className: "absolute inset-2 flex flex-col gap-2 overflow-hidden font-mono"
19
+ }, /* @__PURE__ */ React.createElement("div", {
20
+ className: "flex justify-between"
21
+ }, /* @__PURE__ */ React.createElement("div", null, label), /* @__PURE__ */ React.createElement("div", null, `[${width}x${height}]`)), object && /* @__PURE__ */ React.createElement(JsonHighlighter, {
22
+ data: object,
23
+ classNames: "text-xs opacity-75 rounded-sm"
24
+ })), /* @__PURE__ */ React.createElement("svg", {
25
+ width,
26
+ height,
27
+ className: "bg-transparent *:text-subdued"
28
+ }, /* @__PURE__ */ React.createElement("rect", {
29
+ x: 0,
30
+ y: 0,
31
+ width,
32
+ height,
33
+ strokeWidth: 1,
34
+ fill: "none"
35
+ }), /* @__PURE__ */ React.createElement("line", {
36
+ x1: 0,
37
+ y1: 0,
38
+ x2: width,
39
+ y2: height,
40
+ strokeWidth: 1
41
+ }), /* @__PURE__ */ React.createElement("line", {
42
+ x1: 0,
43
+ y1: height,
44
+ x2: width,
45
+ y2: 0,
46
+ strokeWidth: 1
47
+ })));
48
+ };
49
+ export {
50
+ Wireframe as default
51
+ };
52
+ //# sourceMappingURL=Wireframe-WD7S2AUU.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/containers/Wireframe/Wireframe.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport React from 'react';\nimport { useResizeDetector } from 'react-resize-detector';\n\nimport { Obj } from '@dxos/echo';\nimport { type ThemedClassName } from '@dxos/react-ui';\nimport { useAttentionAttributes } from '@dxos/react-ui-attention';\nimport { JsonHighlighter } from '@dxos/react-ui-syntax-highlighter';\nimport { mx } from '@dxos/ui-theme';\n\n// TODO(burdon): Create generic container with wireframe mode.\nexport type WireframeProps = ThemedClassName<{\n object: Obj.Unknown;\n label?: string;\n}>;\n\n// TODO(burdon): Make focusable and attendable with input.\nexport const Wireframe = ({ classNames, label, object }: WireframeProps) => {\n const attentionAttrs = useAttentionAttributes(Obj.getURI(object));\n const { width, height, ref } = useResizeDetector();\n\n return (\n <div ref={ref} className={mx('relative grow min-h-96', classNames)} {...attentionAttrs}>\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 && <JsonHighlighter data={object} classNames='text-xs opacity-75 rounded-sm' />}\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,WAAW;AAClB,SAASC,yBAAyB;AAElC,SAASC,WAAW;AAEpB,SAASC,8BAA8B;AACvC,SAASC,uBAAuB;AAChC,SAASC,UAAU;AASZ,IAAMC,YAAY,CAAC,EAAEC,YAAYC,OAAOC,OAAM,MAAkB;AACrE,QAAMC,iBAAiBP,uBAAuBD,IAAIS,OAAOF,MAAAA,CAAAA;AACzD,QAAM,EAAEG,OAAOC,QAAQC,IAAG,IAAKb,kBAAAA;AAE/B,SACE,sBAAA,cAACc,OAAAA;IAAID;IAAUE,WAAWX,GAAG,0BAA0BE,UAAAA;IAAc,GAAGG;KACtE,sBAAA,cAACK,OAAAA;IAAIC,WAAU;KACb,sBAAA,cAACD,OAAAA;IAAIC,WAAU;KACb,sBAAA,cAACD,OAAAA,MAAKP,KAAAA,GACN,sBAAA,cAACO,OAAAA,MAAK,IAAIH,KAAAA,IAASC,MAAAA,GAAS,CAAA,GAE7BJ,UAAU,sBAAA,cAACL,iBAAAA;IAAgBa,MAAMR;IAAQF,YAAW;OAEvD,sBAAA,cAACW,OAAAA;IAAIN;IAAcC;IAAgBG,WAAU;KAC3C,sBAAA,cAACG,QAAAA;IAAKC,GAAG;IAAGC,GAAG;IAAGT;IAAcC;IAAgBS,aAAa;IAAGC,MAAK;MACrE,sBAAA,cAACC,QAAAA;IAAKC,IAAI;IAAGC,IAAI;IAAGC,IAAIf;IAAOgB,IAAIf;IAAQS,aAAa;MACxD,sBAAA,cAACE,QAAAA;IAAKC,IAAI;IAAGC,IAAIb;IAAQc,IAAIf;IAAOgB,IAAI;IAAGN,aAAa;;AAIhE;",
6
+ "names": ["React", "useResizeDetector", "Obj", "useAttentionAttributes", "JsonHighlighter", "mx", "Wireframe", "classNames", "label", "object", "attentionAttrs", "getURI", "width", "height", "ref", "div", "className", "data", "svg", "rect", "x", "y", "strokeWidth", "fill", "line", "x1", "y1", "x2", "y2"]
7
+ }