matterviz 0.3.1 → 0.3.3

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 (358) hide show
  1. package/dist/EmptyState.svelte +10 -2
  2. package/dist/FilePicker.svelte +154 -96
  3. package/dist/Icon.svelte +20 -14
  4. package/dist/MillerIndexInput.svelte +27 -21
  5. package/dist/api/optimade.js +6 -6
  6. package/dist/app.css +216 -178
  7. package/dist/brillouin/BrillouinZone.svelte +299 -198
  8. package/dist/brillouin/BrillouinZone.svelte.d.ts +1 -1
  9. package/dist/brillouin/BrillouinZoneControls.svelte +32 -5
  10. package/dist/brillouin/BrillouinZoneExportPane.svelte +74 -55
  11. package/dist/brillouin/BrillouinZoneExportPane.svelte.d.ts +1 -1
  12. package/dist/brillouin/BrillouinZoneInfoPane.svelte +99 -68
  13. package/dist/brillouin/BrillouinZoneScene.svelte +277 -165
  14. package/dist/brillouin/BrillouinZoneScene.svelte.d.ts +1 -1
  15. package/dist/brillouin/BrillouinZoneTooltip.svelte +17 -7
  16. package/dist/brillouin/compute.js +11 -6
  17. package/dist/chempot-diagram/ChemPotDiagram.svelte +327 -0
  18. package/dist/chempot-diagram/ChemPotDiagram.svelte.d.ts +13 -0
  19. package/dist/chempot-diagram/ChemPotDiagram2D.svelte +847 -0
  20. package/dist/chempot-diagram/ChemPotDiagram2D.svelte.d.ts +16 -0
  21. package/dist/chempot-diagram/ChemPotDiagram3D.svelte +3194 -0
  22. package/dist/chempot-diagram/ChemPotDiagram3D.svelte.d.ts +16 -0
  23. package/dist/chempot-diagram/ChemPotScene3D.svelte +11 -0
  24. package/dist/chempot-diagram/ChemPotScene3D.svelte.d.ts +7 -0
  25. package/dist/chempot-diagram/async-compute.svelte.d.ts +3 -0
  26. package/dist/chempot-diagram/async-compute.svelte.js +77 -0
  27. package/dist/chempot-diagram/chempot-worker.d.ts +1 -0
  28. package/dist/chempot-diagram/chempot-worker.js +11 -0
  29. package/dist/chempot-diagram/color.d.ts +10 -0
  30. package/dist/chempot-diagram/color.js +32 -0
  31. package/dist/chempot-diagram/compute.d.ts +48 -0
  32. package/dist/chempot-diagram/compute.js +812 -0
  33. package/dist/chempot-diagram/index.d.ts +6 -0
  34. package/dist/chempot-diagram/index.js +6 -0
  35. package/dist/chempot-diagram/pointer.d.ts +16 -0
  36. package/dist/chempot-diagram/pointer.js +40 -0
  37. package/dist/chempot-diagram/temperature.d.ts +15 -0
  38. package/dist/chempot-diagram/temperature.js +36 -0
  39. package/dist/chempot-diagram/types.d.ts +86 -0
  40. package/dist/chempot-diagram/types.js +28 -0
  41. package/dist/colors/index.d.ts +3 -1
  42. package/dist/colors/index.js +9 -3
  43. package/dist/composition/BarChart.svelte +141 -77
  44. package/dist/composition/BubbleChart.svelte +107 -52
  45. package/dist/composition/Composition.svelte +100 -79
  46. package/dist/composition/Formula.svelte +108 -62
  47. package/dist/composition/FormulaFilter.svelte +973 -353
  48. package/dist/composition/FormulaFilter.svelte.d.ts +35 -1
  49. package/dist/composition/PieChart.svelte +199 -99
  50. package/dist/composition/PieChart.svelte.d.ts +1 -1
  51. package/dist/composition/format.d.ts +5 -0
  52. package/dist/composition/format.js +20 -3
  53. package/dist/composition/parse.js +14 -9
  54. package/dist/convex-hull/ConvexHull.svelte +93 -38
  55. package/dist/convex-hull/ConvexHull2D.svelte +551 -393
  56. package/dist/convex-hull/ConvexHull3D.svelte +1303 -825
  57. package/dist/convex-hull/ConvexHull4D.svelte +1012 -686
  58. package/dist/convex-hull/ConvexHullControls.svelte +115 -28
  59. package/dist/convex-hull/ConvexHullInfoPane.svelte +29 -3
  60. package/dist/convex-hull/ConvexHullStats.svelte +821 -249
  61. package/dist/convex-hull/ConvexHullStats.svelte.d.ts +6 -1
  62. package/dist/convex-hull/ConvexHullTooltip.svelte +41 -16
  63. package/dist/convex-hull/GasPressureControls.svelte +104 -61
  64. package/dist/convex-hull/StructurePopup.svelte +25 -4
  65. package/dist/convex-hull/TemperatureSlider.svelte +45 -25
  66. package/dist/convex-hull/barycentric-coords.js +13 -7
  67. package/dist/convex-hull/demo-temperature.d.ts +6 -0
  68. package/dist/convex-hull/demo-temperature.js +40 -0
  69. package/dist/convex-hull/gas-thermodynamics.js +17 -12
  70. package/dist/convex-hull/helpers.d.ts +10 -1
  71. package/dist/convex-hull/helpers.js +79 -38
  72. package/dist/convex-hull/index.d.ts +1 -0
  73. package/dist/convex-hull/index.js +1 -0
  74. package/dist/convex-hull/thermodynamics.d.ts +8 -21
  75. package/dist/convex-hull/thermodynamics.js +163 -69
  76. package/dist/convex-hull/types.d.ts +12 -12
  77. package/dist/convex-hull/types.js +0 -12
  78. package/dist/coordination/CoordinationBarPlot.svelte +232 -176
  79. package/dist/element/BohrAtom.svelte +56 -13
  80. package/dist/element/ElementHeading.svelte +7 -2
  81. package/dist/element/ElementPhoto.svelte +15 -9
  82. package/dist/element/ElementStats.svelte +10 -4
  83. package/dist/element/ElementTile.svelte +137 -73
  84. package/dist/element/Nucleus.svelte +39 -11
  85. package/dist/element/data.js +2 -14
  86. package/dist/element/data.json.gz +0 -0
  87. package/dist/element/types.d.ts +1 -0
  88. package/dist/feedback/ClickFeedback.svelte +16 -5
  89. package/dist/feedback/DragOverlay.svelte +10 -2
  90. package/dist/feedback/Spinner.svelte +4 -2
  91. package/dist/feedback/StatusMessage.svelte +8 -2
  92. package/dist/fermi-surface/FermiSlice.svelte +118 -88
  93. package/dist/fermi-surface/FermiSurface.svelte +336 -239
  94. package/dist/fermi-surface/FermiSurface.svelte.d.ts +1 -1
  95. package/dist/fermi-surface/FermiSurfaceControls.svelte +113 -46
  96. package/dist/fermi-surface/FermiSurfaceScene.svelte +536 -343
  97. package/dist/fermi-surface/FermiSurfaceScene.svelte.d.ts +1 -1
  98. package/dist/fermi-surface/FermiSurfaceTooltip.svelte +14 -5
  99. package/dist/fermi-surface/compute.js +16 -20
  100. package/dist/fermi-surface/parse.js +37 -33
  101. package/dist/fermi-surface/symmetry.js +2 -7
  102. package/dist/fermi-surface/types.d.ts +3 -5
  103. package/dist/heatmap-matrix/HeatmapMatrix.svelte +1527 -0
  104. package/dist/heatmap-matrix/HeatmapMatrix.svelte.d.ts +110 -0
  105. package/dist/heatmap-matrix/HeatmapMatrixControls.svelte +225 -0
  106. package/dist/heatmap-matrix/HeatmapMatrixControls.svelte.d.ts +30 -0
  107. package/dist/heatmap-matrix/index.d.ts +53 -0
  108. package/dist/heatmap-matrix/index.js +100 -0
  109. package/dist/heatmap-matrix/shared.d.ts +2 -0
  110. package/dist/heatmap-matrix/shared.js +4 -0
  111. package/dist/icons.d.ts +111 -0
  112. package/dist/icons.js +158 -0
  113. package/dist/index.d.ts +5 -2
  114. package/dist/index.js +5 -2
  115. package/dist/io/decompress.js +1 -1
  116. package/dist/io/export.d.ts +3 -0
  117. package/dist/io/export.js +138 -140
  118. package/dist/io/file-drop.d.ts +7 -0
  119. package/dist/io/file-drop.js +43 -0
  120. package/dist/io/index.d.ts +2 -2
  121. package/dist/io/index.js +2 -112
  122. package/dist/io/is-binary.js +2 -3
  123. package/dist/io/types.d.ts +1 -0
  124. package/dist/io/url-drop.d.ts +2 -0
  125. package/dist/io/url-drop.js +117 -0
  126. package/dist/isosurface/Isosurface.svelte +220 -110
  127. package/dist/isosurface/IsosurfaceControls.svelte +65 -28
  128. package/dist/isosurface/parse.js +104 -56
  129. package/dist/isosurface/slice.d.ts +2 -1
  130. package/dist/isosurface/slice.js +8 -13
  131. package/dist/isosurface/types.d.ts +14 -1
  132. package/dist/isosurface/types.js +152 -5
  133. package/dist/labels.d.ts +2 -1
  134. package/dist/labels.js +12 -8
  135. package/dist/layout/FullscreenToggle.svelte +11 -2
  136. package/dist/layout/InfoCard.svelte +38 -6
  137. package/dist/layout/InfoTag.svelte +125 -94
  138. package/dist/layout/PropertyFilter.svelte +82 -37
  139. package/dist/layout/SettingsSection.svelte +85 -55
  140. package/dist/layout/SubpageGrid.svelte +82 -0
  141. package/dist/layout/SubpageGrid.svelte.d.ts +14 -0
  142. package/dist/layout/index.d.ts +1 -0
  143. package/dist/layout/index.js +1 -0
  144. package/dist/layout/json-tree/JsonNode.svelte +266 -223
  145. package/dist/layout/json-tree/JsonTree.svelte +516 -429
  146. package/dist/layout/json-tree/JsonTree.svelte.d.ts +1 -1
  147. package/dist/layout/json-tree/JsonValue.svelte +281 -173
  148. package/dist/layout/json-tree/types.d.ts +10 -2
  149. package/dist/layout/json-tree/utils.d.ts +2 -0
  150. package/dist/layout/json-tree/utils.js +37 -2
  151. package/dist/marching-cubes.js +25 -2
  152. package/dist/math.d.ts +20 -17
  153. package/dist/math.js +474 -57
  154. package/dist/overlays/ContextMenu.svelte +66 -40
  155. package/dist/overlays/DraggablePane.svelte +331 -154
  156. package/dist/overlays/DraggablePane.svelte.d.ts +2 -0
  157. package/dist/periodic-table/PeriodicTable.svelte +278 -145
  158. package/dist/periodic-table/PeriodicTableControls.svelte +178 -128
  159. package/dist/periodic-table/PropertySelect.svelte +25 -7
  160. package/dist/periodic-table/TableInset.svelte +8 -3
  161. package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte +559 -267
  162. package/dist/phase-diagram/IsobaricBinaryPhaseDiagram.svelte.d.ts +6 -2
  163. package/dist/phase-diagram/PhaseDiagramControls.svelte +131 -51
  164. package/dist/phase-diagram/PhaseDiagramControls.svelte.d.ts +3 -2
  165. package/dist/phase-diagram/PhaseDiagramEditorPane.svelte +126 -0
  166. package/dist/phase-diagram/PhaseDiagramEditorPane.svelte.d.ts +15 -0
  167. package/dist/phase-diagram/PhaseDiagramExportPane.svelte +160 -110
  168. package/dist/phase-diagram/PhaseDiagramExportPane.svelte.d.ts +8 -1
  169. package/dist/phase-diagram/PhaseDiagramTooltip.svelte +217 -86
  170. package/dist/phase-diagram/PhaseDiagramTooltip.svelte.d.ts +6 -3
  171. package/dist/phase-diagram/TdbInfoPanel.svelte +28 -4
  172. package/dist/phase-diagram/build-diagram.js +9 -9
  173. package/dist/phase-diagram/colors.js +1 -3
  174. package/dist/phase-diagram/index.d.ts +2 -0
  175. package/dist/phase-diagram/index.js +2 -0
  176. package/dist/phase-diagram/parse.js +10 -9
  177. package/dist/phase-diagram/svg-to-diagram.d.ts +2 -0
  178. package/dist/phase-diagram/svg-to-diagram.js +869 -0
  179. package/dist/phase-diagram/types.d.ts +10 -0
  180. package/dist/phase-diagram/utils.d.ts +8 -4
  181. package/dist/phase-diagram/utils.js +219 -74
  182. package/dist/plot/AxisLabel.svelte +51 -0
  183. package/dist/plot/AxisLabel.svelte.d.ts +16 -0
  184. package/dist/plot/BarPlot.svelte +1461 -768
  185. package/dist/plot/BarPlot.svelte.d.ts +3 -3
  186. package/dist/plot/BarPlotControls.svelte +33 -6
  187. package/dist/plot/BarPlotControls.svelte.d.ts +1 -1
  188. package/dist/plot/ColorBar.svelte +533 -383
  189. package/dist/plot/ColorBar.svelte.d.ts +1 -1
  190. package/dist/plot/ColorScaleSelect.svelte +28 -7
  191. package/dist/plot/ElementScatter.svelte +38 -16
  192. package/dist/plot/FillArea.svelte +152 -92
  193. package/dist/plot/Histogram.svelte +1162 -709
  194. package/dist/plot/Histogram.svelte.d.ts +1 -1
  195. package/dist/plot/HistogramControls.svelte +81 -18
  196. package/dist/plot/HistogramControls.svelte.d.ts +6 -2
  197. package/dist/plot/InteractiveAxisLabel.svelte +34 -11
  198. package/dist/plot/InteractiveAxisLabel.svelte.d.ts +1 -1
  199. package/dist/plot/Line.svelte +63 -28
  200. package/dist/plot/PlotControls.svelte +221 -96
  201. package/dist/plot/PlotControls.svelte.d.ts +1 -1
  202. package/dist/plot/PlotLegend.svelte +174 -91
  203. package/dist/plot/PlotTooltip.svelte +45 -6
  204. package/dist/plot/PortalSelect.svelte +175 -146
  205. package/dist/plot/ReferenceLine.svelte +77 -22
  206. package/dist/plot/ReferenceLine.svelte.d.ts +1 -0
  207. package/dist/plot/ReferenceLine3D.svelte +132 -107
  208. package/dist/plot/ReferencePlane.svelte +146 -123
  209. package/dist/plot/ScatterPlot.svelte +1880 -1156
  210. package/dist/plot/ScatterPlot.svelte.d.ts +3 -3
  211. package/dist/plot/ScatterPlot3D.svelte +256 -131
  212. package/dist/plot/ScatterPlot3D.svelte.d.ts +2 -2
  213. package/dist/plot/ScatterPlot3DControls.svelte +300 -297
  214. package/dist/plot/ScatterPlot3DControls.svelte.d.ts +2 -1
  215. package/dist/plot/ScatterPlot3DScene.svelte +608 -406
  216. package/dist/plot/ScatterPlot3DScene.svelte.d.ts +2 -2
  217. package/dist/plot/ScatterPlotControls.svelte +150 -70
  218. package/dist/plot/ScatterPlotControls.svelte.d.ts +1 -1
  219. package/dist/plot/ScatterPoint.svelte +98 -26
  220. package/dist/plot/ScatterPoint.svelte.d.ts +1 -0
  221. package/dist/plot/SpacegroupBarPlot.svelte +142 -85
  222. package/dist/plot/Surface3D.svelte +159 -108
  223. package/dist/plot/ZeroLines.svelte +96 -0
  224. package/dist/plot/ZeroLines.svelte.d.ts +32 -0
  225. package/dist/plot/ZoomRect.svelte +23 -0
  226. package/dist/plot/ZoomRect.svelte.d.ts +8 -0
  227. package/dist/plot/axis-utils.d.ts +1 -1
  228. package/dist/plot/axis-utils.js +1 -3
  229. package/dist/plot/data-cleaning.js +12 -28
  230. package/dist/plot/data-transform.js +2 -1
  231. package/dist/plot/fill-utils.js +2 -0
  232. package/dist/plot/index.d.ts +6 -2
  233. package/dist/plot/index.js +6 -2
  234. package/dist/plot/interactions.d.ts +8 -10
  235. package/dist/plot/interactions.js +2 -3
  236. package/dist/plot/layout.d.ts +11 -2
  237. package/dist/plot/layout.js +44 -17
  238. package/dist/plot/reference-line.d.ts +5 -22
  239. package/dist/plot/reference-line.js +12 -84
  240. package/dist/plot/scales.js +24 -36
  241. package/dist/plot/types.d.ts +53 -40
  242. package/dist/plot/types.js +12 -7
  243. package/dist/plot/utils/label-placement.d.ts +32 -15
  244. package/dist/plot/utils/label-placement.js +227 -63
  245. package/dist/plot/utils/series-visibility.js +2 -3
  246. package/dist/plot/utils.d.ts +1 -0
  247. package/dist/plot/utils.js +14 -0
  248. package/dist/rdf/RdfPlot.svelte +173 -132
  249. package/dist/rdf/calc-rdf.js +4 -5
  250. package/dist/sanitize.d.ts +4 -0
  251. package/dist/sanitize.js +107 -0
  252. package/dist/settings.d.ts +21 -6
  253. package/dist/settings.js +63 -19
  254. package/dist/spectral/Bands.svelte +963 -412
  255. package/dist/spectral/Bands.svelte.d.ts +22 -2
  256. package/dist/spectral/BandsAndDos.svelte +90 -49
  257. package/dist/spectral/BrillouinBandsDos.svelte +151 -93
  258. package/dist/spectral/Dos.svelte +389 -258
  259. package/dist/spectral/helpers.d.ts +23 -1
  260. package/dist/spectral/helpers.js +119 -51
  261. package/dist/spectral/types.d.ts +2 -0
  262. package/dist/state.svelte.d.ts +1 -1
  263. package/dist/state.svelte.js +3 -2
  264. package/dist/structure/Arrow.svelte +59 -20
  265. package/dist/structure/AtomLegend.svelte +231 -129
  266. package/dist/structure/AtomLegend.svelte.d.ts +1 -1
  267. package/dist/structure/Bond.svelte +73 -47
  268. package/dist/structure/CanvasTooltip.svelte +10 -2
  269. package/dist/structure/CellSelect.svelte +148 -51
  270. package/dist/structure/Cylinder.svelte +33 -17
  271. package/dist/structure/Lattice.svelte +88 -33
  272. package/dist/structure/Structure.svelte +1077 -821
  273. package/dist/structure/Structure.svelte.d.ts +1 -1
  274. package/dist/structure/StructureControls.svelte +373 -139
  275. package/dist/structure/StructureControls.svelte.d.ts +1 -1
  276. package/dist/structure/StructureExportPane.svelte +124 -89
  277. package/dist/structure/StructureExportPane.svelte.d.ts +1 -1
  278. package/dist/structure/StructureInfoPane.svelte +304 -231
  279. package/dist/structure/StructureScene.svelte +919 -445
  280. package/dist/structure/StructureScene.svelte.d.ts +16 -7
  281. package/dist/structure/atom-properties.d.ts +6 -2
  282. package/dist/structure/atom-properties.js +42 -29
  283. package/dist/structure/bonding.js +6 -7
  284. package/dist/structure/export.js +22 -34
  285. package/dist/structure/ferrox-wasm-types.d.ts +3 -2
  286. package/dist/structure/ferrox-wasm-types.js +0 -3
  287. package/dist/structure/ferrox-wasm.d.ts +3 -2
  288. package/dist/structure/ferrox-wasm.js +2 -3
  289. package/dist/structure/index.d.ts +16 -0
  290. package/dist/structure/index.js +88 -6
  291. package/dist/structure/measure.d.ts +2 -2
  292. package/dist/structure/measure.js +4 -44
  293. package/dist/structure/parse.js +130 -155
  294. package/dist/structure/partial-occupancy.d.ts +25 -0
  295. package/dist/structure/partial-occupancy.js +99 -0
  296. package/dist/structure/pbc.d.ts +1 -0
  297. package/dist/structure/pbc.js +16 -6
  298. package/dist/structure/supercell.d.ts +2 -2
  299. package/dist/structure/supercell.js +12 -22
  300. package/dist/structure/validation.js +5 -3
  301. package/dist/symmetry/SymmetryStats.svelte +94 -37
  302. package/dist/symmetry/WyckoffTable.svelte +42 -14
  303. package/dist/symmetry/cell-transform.js +5 -3
  304. package/dist/symmetry/index.d.ts +7 -4
  305. package/dist/symmetry/index.js +87 -21
  306. package/dist/symmetry/spacegroups.js +148 -148
  307. package/dist/table/HeatmapTable.svelte +1112 -516
  308. package/dist/table/HeatmapTable.svelte.d.ts +12 -1
  309. package/dist/table/ToggleMenu.svelte +125 -90
  310. package/dist/table/index.d.ts +2 -0
  311. package/dist/table/index.js +2 -4
  312. package/dist/theme/ThemeControl.svelte +21 -12
  313. package/dist/time.js +4 -1
  314. package/dist/tooltip/TooltipContent.svelte +33 -8
  315. package/dist/trajectory/Trajectory.svelte +889 -687
  316. package/dist/trajectory/TrajectoryError.svelte +14 -3
  317. package/dist/trajectory/TrajectoryExportPane.svelte +148 -90
  318. package/dist/trajectory/TrajectoryExportPane.svelte.d.ts +1 -1
  319. package/dist/trajectory/TrajectoryInfoPane.svelte +272 -143
  320. package/dist/trajectory/constants.d.ts +6 -0
  321. package/dist/trajectory/constants.js +7 -0
  322. package/dist/trajectory/extract.js +13 -31
  323. package/dist/trajectory/format-detect.d.ts +9 -0
  324. package/dist/trajectory/format-detect.js +76 -0
  325. package/dist/trajectory/frame-reader.d.ts +17 -0
  326. package/dist/trajectory/frame-reader.js +332 -0
  327. package/dist/trajectory/helpers.d.ts +14 -0
  328. package/dist/trajectory/helpers.js +172 -0
  329. package/dist/trajectory/index.d.ts +1 -0
  330. package/dist/trajectory/index.js +23 -14
  331. package/dist/trajectory/parse/ase.d.ts +2 -0
  332. package/dist/trajectory/parse/ase.js +77 -0
  333. package/dist/trajectory/parse/hdf5.d.ts +2 -0
  334. package/dist/trajectory/parse/hdf5.js +129 -0
  335. package/dist/trajectory/parse/index.d.ts +12 -0
  336. package/dist/trajectory/parse/index.js +299 -0
  337. package/dist/trajectory/parse/lammps.d.ts +5 -0
  338. package/dist/trajectory/parse/lammps.js +179 -0
  339. package/dist/trajectory/parse/vasp.d.ts +2 -0
  340. package/dist/trajectory/parse/vasp.js +68 -0
  341. package/dist/trajectory/parse/xyz.d.ts +2 -0
  342. package/dist/trajectory/parse/xyz.js +110 -0
  343. package/dist/trajectory/plotting.js +13 -8
  344. package/dist/trajectory/types.d.ts +11 -0
  345. package/dist/trajectory/types.js +1 -0
  346. package/dist/utils.d.ts +3 -0
  347. package/dist/utils.js +17 -0
  348. package/dist/xrd/XrdPlot.svelte +337 -245
  349. package/dist/xrd/broadening.js +14 -9
  350. package/dist/xrd/calc-xrd.js +12 -19
  351. package/dist/xrd/parse.d.ts +1 -1
  352. package/dist/xrd/parse.js +17 -17
  353. package/package.json +103 -101
  354. package/readme.md +4 -4
  355. package/dist/trajectory/parse.d.ts +0 -42
  356. package/dist/trajectory/parse.js +0 -1267
  357. /package/dist/element/{data.json.d.ts → data.json.gz.d.ts} +0 -0
  358. /package/dist/theme/{themes.js → themes.mjs} +0 -0
@@ -1,6 +1,6 @@
1
1
  import type { HTMLAttributes } from 'svelte/elements';
2
2
  import type { JsonTreeProps } from './types';
3
- type $$ComponentProps = JsonTreeProps & Omit<HTMLAttributes<HTMLDivElement>, `onselect`>;
3
+ type $$ComponentProps = JsonTreeProps & Omit<HTMLAttributes<HTMLDivElement>, `onselect` | `onchange`>;
4
4
  declare const JsonTree: import("svelte").Component<$$ComponentProps, {}, "collapsed_paths" | "show_data_types" | "show_array_indices">;
5
5
  type JsonTree = ReturnType<typeof JsonTree>;
6
6
  export default JsonTree;
@@ -1,182 +1,282 @@
1
- <script lang="ts">import { getContext } from 'svelte';
2
- import { JSON_TREE_CONTEXT_KEY } from './types';
3
- import { format_preview, is_css_color, is_url, values_equal } from './utils';
4
- let { value, value_type, path, } = $props();
5
- const ctx = getContext(JSON_TREE_CONTEXT_KEY);
6
- // Track if value just changed for animation
7
- let just_changed = $state(false);
8
- let change_timeout;
9
- // Expanded state for long strings
10
- let is_expanded = $state(false);
11
- // Extract max_string_length threshold for reuse
12
- let max_len = $derived(ctx?.settings.max_string_length ?? 200);
13
- let is_long_string = $derived(value_type === `string` && value.length > max_len);
14
- // Check for changes on mount and when value changes
15
- $effect(() => {
16
- if (!ctx?.settings.highlight_changes)
17
- return;
18
- const prev = ctx.previous_values.get(path);
1
+ <script lang="ts">
2
+ import { getContext, tick } from 'svelte'
3
+ import type { JsonTreeContext, JsonValueType } from './types'
4
+ import { JSON_TREE_CONTEXT_KEY } from './types'
5
+ import {
6
+ format_preview,
7
+ is_css_color,
8
+ is_url,
9
+ parse_edited_value,
10
+ values_equal,
11
+ } from './utils'
12
+
13
+ let {
14
+ value,
15
+ value_type,
16
+ path,
17
+ }: {
18
+ value: unknown
19
+ value_type: JsonValueType
20
+ path: string
21
+ } = $props()
22
+
23
+ const ctx = getContext<JsonTreeContext>(JSON_TREE_CONTEXT_KEY)
24
+
25
+ // Track if value just changed for animation
26
+ let just_changed = $state(false)
27
+ let change_timeout: ReturnType<typeof setTimeout> | undefined
28
+
29
+ // Expanded state for long strings
30
+ let is_expanded = $state(false)
31
+
32
+ // Extract max_string_length threshold for reuse
33
+ let max_len = $derived(ctx?.settings.max_string_length ?? 200)
34
+ let is_long_string = $derived(
35
+ value_type === `string` && (value as string).length > max_len,
36
+ )
37
+
38
+ // Check for changes on mount and when value changes
39
+ $effect(() => {
40
+ if (!ctx?.settings.highlight_changes) return
41
+
42
+ const prev = ctx.previous_values.get(path)
19
43
  if (prev !== undefined && !values_equal(prev, value)) {
20
- just_changed = true;
21
- if (change_timeout)
22
- clearTimeout(change_timeout);
23
- change_timeout = setTimeout(() => {
24
- just_changed = false;
25
- }, 1000);
26
- }
27
- ctx.previous_values.set(path, value);
44
+ just_changed = true
45
+ if (change_timeout) clearTimeout(change_timeout)
46
+ change_timeout = setTimeout(() => {
47
+ just_changed = false
48
+ }, 1000)
49
+ }
50
+ ctx.previous_values.set(path, value)
51
+
28
52
  return () => {
29
- if (change_timeout)
30
- clearTimeout(change_timeout);
31
- };
32
- });
33
- // Trimmed string for URL/color detection (avoids using raw whitespace in href/style)
34
- let trimmed_str = $derived(value_type === `string` ? value.trim() : ``);
35
- // Auto-detect URLs in string values
36
- let url_detected = $derived(value_type === `string` && is_url(trimmed_str));
37
- // Auto-detect CSS colors in string values
38
- let color_detected = $derived(value_type === `string` && is_css_color(trimmed_str) ? trimmed_str : null);
39
- // Handle click to copy
40
- async function handle_click(event) {
41
- event.stopPropagation();
42
- if (ctx) {
43
- await ctx.copy_value(path, value, event);
44
- }
45
- }
46
- // Format display value - strings use custom truncation, others use format_preview
47
- let display_value = $derived.by(() => {
48
- if (value_type === `circular`)
49
- return `[Circular]`;
53
+ if (change_timeout) clearTimeout(change_timeout)
54
+ }
55
+ })
56
+
57
+ // Trimmed string for URL/color detection (avoids using raw whitespace in href/style)
58
+ let trimmed_str = $derived(value_type === `string` ? (value as string).trim() : ``)
59
+
60
+ // Auto-detect URLs in string values
61
+ let url_detected = $derived(value_type === `string` && is_url(trimmed_str))
62
+
63
+ // Auto-detect CSS colors in string values
64
+ let color_detected = $derived(
65
+ value_type === `string` && is_css_color(trimmed_str) ? trimmed_str : null,
66
+ )
67
+
68
+ // Handle click to copy (delayed to avoid firing on double-click-to-edit)
69
+ let click_timer: ReturnType<typeof setTimeout> | undefined
70
+ $effect(() => () => {
71
+ if (click_timer) clearTimeout(click_timer)
72
+ })
73
+
74
+ async function handle_click(event: MouseEvent) {
75
+ event.stopPropagation()
76
+ if (!ctx) return
77
+ // When editable, delay copy so double-click can cancel it
78
+ if (ctx.settings.editable && ctx.onchange) {
79
+ if (click_timer) clearTimeout(click_timer)
80
+ const copy_pos = { clientX: event.clientX, clientY: event.clientY }
81
+ click_timer = setTimeout(() => ctx.copy_value(path, value, copy_pos), 250)
82
+ } else {
83
+ await ctx.copy_value(path, value, event)
84
+ }
85
+ }
86
+
87
+ // Format display value - strings use custom truncation, others use format_preview
88
+ let display_value = $derived.by(() => {
89
+ if (value_type === `circular`) return `[Circular]`
50
90
  if (value_type === `string`) {
51
- const str = value;
52
- return is_long_string && !is_expanded
53
- ? `"${str.slice(0, max_len)}..."`
54
- : `"${str}"`;
55
- }
56
- return format_preview(value);
57
- });
58
- // Check if string is truncated
59
- let is_truncated = $derived(is_long_string && !is_expanded);
60
- // Toggle string expansion
61
- function toggle_expand(event) {
62
- event.stopPropagation();
63
- is_expanded = !is_expanded;
64
- }
65
- </script>
91
+ const str = value as string
92
+ return is_long_string && !is_expanded
93
+ ? `"${str.slice(0, max_len)}..."`
94
+ : `"${str}"`
95
+ }
96
+ return format_preview(value)
97
+ })
98
+
99
+ // Check if string is truncated
100
+ let is_truncated = $derived(is_long_string && !is_expanded)
101
+
102
+ // Toggle string expansion
103
+ function toggle_expand(event: MouseEvent) {
104
+ event.stopPropagation()
105
+ is_expanded = !is_expanded
106
+ }
66
107
 
67
- <span
68
- class="json-value {value_type}"
69
- class:changed={just_changed}
70
- onclick={handle_click}
71
- oncontextmenu={(event) => {
72
- ctx?.show_context_menu(event, path, value, false, false)
73
- }}
74
- onkeydown={(event) => {
75
- if (event.key === `Enter` || event.key === ` `) {
108
+ // === Inline Editing ===
109
+ let editing = $state(false)
110
+ let edit_text = $state(``)
111
+ let edit_input = $state<HTMLInputElement | null>(null)
112
+
113
+ function start_edit(event: MouseEvent) {
114
+ if (!ctx?.settings.editable || !ctx.onchange) return
115
+ event.stopPropagation()
116
+ // Cancel pending click-to-copy
117
+ if (click_timer) clearTimeout(click_timer)
118
+ // Pre-fill with raw value (strings without quotes)
119
+ edit_text = value_type === `string` ? (value as string) : String(value)
120
+ editing = true
121
+ tick().then(() => edit_input?.select())
122
+ }
123
+
124
+ function commit_edit() {
125
+ if (!editing) return
126
+ editing = false
127
+ const new_value = parse_edited_value(edit_text)
128
+ if (!values_equal(new_value, value)) {
129
+ ctx?.onchange?.(path, new_value, value)
130
+ }
131
+ }
132
+
133
+ function handle_edit_keydown(event: KeyboardEvent) {
134
+ if (event.key === `Enter`) {
76
135
  event.preventDefault()
77
- ctx?.copy_value(path, value)
78
- }
79
- }}
80
- role="button"
81
- tabindex="-1"
82
- title="Click to copy"
83
- >
84
- {#if color_detected}
85
- <span class="color-swatch" style:background={color_detected}></span>
86
- {/if}
87
- {#if url_detected}
88
- <a
89
- href={encodeURI(trimmed_str)}
90
- class="url-link"
91
- target="_blank"
92
- rel="noopener noreferrer"
93
- onclick={(event) => event.stopPropagation()}
94
- title="Open URL in new tab"
95
- >
136
+ commit_edit()
137
+ } else if (event.key === `Escape`) {
138
+ event.preventDefault()
139
+ editing = false
140
+ }
141
+ }
142
+ </script>
143
+
144
+ {#if editing}
145
+ <!-- svelte-ignore a11y_autofocus -->
146
+ <input
147
+ bind:this={edit_input}
148
+ type="text"
149
+ class="edit-input {value_type}"
150
+ bind:value={edit_text}
151
+ onkeydown={handle_edit_keydown}
152
+ onblur={commit_edit}
153
+ style:width="{Math.max(edit_text.length + 2, 6)}ch"
154
+ autofocus
155
+ />
156
+ {:else}
157
+ <span
158
+ class="json-value {value_type}"
159
+ class:changed={just_changed}
160
+ class:editable={ctx?.settings.editable}
161
+ onclick={handle_click}
162
+ ondblclick={start_edit}
163
+ oncontextmenu={(event) => {
164
+ ctx?.show_context_menu(event, path, value, false, false)
165
+ }}
166
+ onkeydown={(event) => {
167
+ if (event.key === `Enter` || event.key === ` `) {
168
+ event.preventDefault()
169
+ ctx?.copy_value(path, value)
170
+ }
171
+ }}
172
+ role="button"
173
+ tabindex="-1"
174
+ title={ctx?.settings.editable ? `Double-click to edit` : undefined}
175
+ >
176
+ {#if color_detected}
177
+ <span class="color-swatch" style:background={color_detected}></span>
178
+ {/if}
179
+ {#if url_detected}
180
+ <a
181
+ href={encodeURI(trimmed_str)}
182
+ class="url-link"
183
+ target="_blank"
184
+ rel="noopener noreferrer"
185
+ onclick={(event) => event.stopPropagation()}
186
+ title="Open URL in new tab"
187
+ >
188
+ {display_value}
189
+ </a>
190
+ {:else}
96
191
  {display_value}
97
- </a>
98
- {:else}
99
- {display_value}
100
- {/if}
101
- {#if is_truncated}
102
- <button
103
- type="button"
104
- class="expand-btn"
105
- onclick={toggle_expand}
106
- title="Show full string"
107
- >
108
- ...
109
- </button>
110
- {:else if is_long_string && is_expanded}
111
- <button
112
- type="button"
113
- class="expand-btn"
114
- onclick={toggle_expand}
115
- title="Collapse string"
116
- >
117
-
118
- </button>
119
- {/if}
120
- {#if ctx?.settings.show_data_types && value_type !== `null` &&
192
+ {/if}
193
+ {#if is_truncated}
194
+ <button
195
+ type="button"
196
+ class="expand-btn"
197
+ onclick={toggle_expand}
198
+ title="Show full string"
199
+ >
200
+ ...
201
+ </button>
202
+ {:else if is_long_string && is_expanded}
203
+ <button
204
+ type="button"
205
+ class="expand-btn"
206
+ onclick={toggle_expand}
207
+ title="Collapse string"
208
+ >
209
+
210
+ </button>
211
+ {/if}
212
+ {#if ctx?.settings.show_data_types && value_type !== `null` &&
121
213
  value_type !== `undefined`}
122
- <span class="type-annotation">{value_type}</span>
123
- {/if}
124
- </span>
214
+ <span class="type-annotation">{value_type}</span>
215
+ {/if}
216
+ </span>
217
+ {/if}
125
218
 
126
219
  <style>
220
+ /* Type-specific colors shared between display and edit input */
221
+ :is(.json-value, .edit-input) {
222
+ &.string {
223
+ color: var(--jt-string, light-dark(#a31515, #ce9178));
224
+ }
225
+ &.number {
226
+ color: var(--jt-number, light-dark(#098658, #b5cea8));
227
+ }
228
+ &.boolean {
229
+ color: var(--jt-boolean, light-dark(#0000ff, #569cd6));
230
+ }
231
+ &.null {
232
+ color: var(--jt-null, light-dark(#808080, #808080));
233
+ }
234
+ }
127
235
  .json-value {
128
236
  cursor: pointer;
129
237
  border-radius: 2px;
130
238
  transition: background-color 0.15s, color 0.15s;
131
- }
132
- .json-value:hover {
133
- background: var(
134
- --jt-hover-bg,
135
- light-dark(rgba(0, 0, 0, 0.05), rgba(255, 255, 255, 0.08))
136
- );
137
- }
138
- /* Type-specific colors */
139
- .json-value.string {
140
- color: var(--jt-string, light-dark(#a31515, #ce9178));
141
- word-break: break-word;
142
- }
143
- .json-value.number {
144
- color: var(--jt-number, light-dark(#098658, #b5cea8));
145
- }
146
- .json-value.boolean {
147
- color: var(--jt-boolean, light-dark(#0000ff, #569cd6));
148
- }
149
- .json-value.null,
150
- .json-value.undefined {
151
- color: var(--jt-null, light-dark(#808080, #808080));
152
- font-style: italic;
153
- }
154
- .json-value.date {
155
- color: var(--jt-date, light-dark(#098658, #dcdcaa));
156
- }
157
- .json-value.regexp {
158
- color: var(--jt-regexp, light-dark(#811f3f, #d16969));
159
- }
160
- .json-value.symbol {
161
- color: var(--jt-symbol, light-dark(#267f99, #4ec9b0));
162
- }
163
- .json-value.bigint {
164
- color: var(--jt-bigint, light-dark(#098658, #b5cea8));
165
- }
166
- .json-value.function {
167
- color: var(--jt-function, light-dark(#795e26, #dcdcaa));
168
- font-style: italic;
169
- }
170
- .json-value.error {
171
- color: var(--jt-error, light-dark(#a31515, #f48771));
172
- }
173
- .json-value.circular {
174
- color: var(--jt-circular, light-dark(#808080, #808080));
175
- font-style: italic;
176
- }
177
- /* Change animation */
178
- .json-value.changed {
179
- animation: value-change 1s ease-out;
239
+ &:hover {
240
+ background: var(
241
+ --jt-hover-bg,
242
+ light-dark(rgba(0, 0, 0, 0.05), rgba(255, 255, 255, 0.08))
243
+ );
244
+ }
245
+ &.string {
246
+ word-break: break-word;
247
+ }
248
+ &:is(.null, .undefined) {
249
+ font-style: italic;
250
+ }
251
+ &.date {
252
+ color: var(--jt-date, light-dark(#098658, #dcdcaa));
253
+ }
254
+ &.regexp {
255
+ color: var(--jt-regexp, light-dark(#811f3f, #d16969));
256
+ }
257
+ &.symbol {
258
+ color: var(--jt-symbol, light-dark(#267f99, #4ec9b0));
259
+ }
260
+ &.bigint {
261
+ color: var(--jt-bigint, light-dark(#098658, #b5cea8));
262
+ }
263
+ &.function {
264
+ color: var(--jt-function, light-dark(#795e26, #dcdcaa));
265
+ font-style: italic;
266
+ }
267
+ &.error {
268
+ color: var(--jt-error, light-dark(#a31515, #f48771));
269
+ }
270
+ &.circular {
271
+ color: var(--jt-circular, light-dark(#808080, #808080));
272
+ font-style: italic;
273
+ }
274
+ &.changed {
275
+ animation: value-change 1s ease-out;
276
+ }
277
+ &.editable {
278
+ cursor: default;
279
+ }
180
280
  }
181
281
  @keyframes value-change {
182
282
  0% {
@@ -186,7 +286,6 @@ function toggle_expand(event) {
186
286
  background: transparent;
187
287
  }
188
288
  }
189
- /* Expand/collapse button for long strings */
190
289
  .expand-btn {
191
290
  display: inline;
192
291
  background: none;
@@ -196,11 +295,10 @@ function toggle_expand(event) {
196
295
  font-size: 0.85em;
197
296
  padding: 0 2px;
198
297
  margin-left: 2px;
298
+ &:hover {
299
+ text-decoration: underline;
300
+ }
199
301
  }
200
- .expand-btn:hover {
201
- text-decoration: underline;
202
- }
203
- /* Type annotation */
204
302
  .type-annotation {
205
303
  font-size: 0.7em;
206
304
  color: var(--jt-type-annotation, light-dark(#808080, #6a6a6a));
@@ -210,9 +308,19 @@ function toggle_expand(event) {
210
308
  .url-link {
211
309
  color: var(--jt-url, light-dark(#0066cc, #4fc3f7));
212
310
  text-decoration: none;
311
+ &:hover {
312
+ text-decoration: underline;
313
+ }
213
314
  }
214
- .url-link:hover {
215
- text-decoration: underline;
315
+ .edit-input {
316
+ font: inherit;
317
+ font-family: var(--jt-font-family, 'SF Mono', Monaco, 'Courier New', monospace);
318
+ padding: 0 2px;
319
+ border: 1px solid var(--jt-edit-border, light-dark(#4a90d9, #4a90d9));
320
+ border-radius: 2px;
321
+ background: var(--jt-edit-bg, light-dark(#fff, #1a1a2e));
322
+ outline: none;
323
+ min-width: 4ch;
216
324
  }
217
325
  .color-swatch {
218
326
  display: inline-block;
@@ -16,6 +16,8 @@ export interface JsonTreeProps {
16
16
  oncopy?: (path: string, value: string) => void;
17
17
  download_filename?: string;
18
18
  compare_value?: unknown;
19
+ editable?: boolean;
20
+ onchange?: (path: string, new_value: unknown, old_value: unknown) => void;
19
21
  }
20
22
  export interface JsonTreeContext {
21
23
  settings: {
@@ -27,6 +29,7 @@ export interface JsonTreeContext {
27
29
  sort_keys: boolean;
28
30
  max_string_length: number;
29
31
  highlight_changes: boolean;
32
+ editable: boolean;
30
33
  };
31
34
  collapsed: Set<string>;
32
35
  force_expanded: Set<string>;
@@ -41,8 +44,8 @@ export interface JsonTreeContext {
41
44
  collapse_all: () => void;
42
45
  collapse_to_level: (level: number) => void;
43
46
  set_focused: (path: string | null) => void;
44
- copy_value: (path: string, value: unknown, event?: MouseEvent) => Promise<void>;
45
- copy_path: (path: string, event?: MouseEvent) => Promise<void>;
47
+ copy_value: (path: string, value: unknown, event?: CopyEventPosition) => Promise<void>;
48
+ copy_path: (path: string, event?: CopyEventPosition) => Promise<void>;
46
49
  register_path: (path: string) => void;
47
50
  unregister_path: (path: string) => void;
48
51
  show_context_menu: (event: MouseEvent, path: string, value: unknown, expandable: boolean, is_collapsed: boolean) => void;
@@ -54,7 +57,12 @@ export interface JsonTreeContext {
54
57
  diff_map: Map<string, DiffEntry> | null;
55
58
  ghost_map: Map<string, import('./utils').GhostEntry[]>;
56
59
  collapse_children_only: (path: string) => void;
60
+ onchange?: (path: string, new_value: unknown, old_value: unknown) => void;
57
61
  }
62
+ export type CopyEventPosition = {
63
+ clientX: number;
64
+ clientY: number;
65
+ };
58
66
  export declare const JSON_TREE_CONTEXT_KEY: unique symbol;
59
67
  export type DiffStatus = `added` | `removed` | `changed`;
60
68
  export interface DiffEntry {
@@ -14,6 +14,8 @@ export declare function find_matching_paths(value: unknown, query: string, curre
14
14
  export declare function get_ancestor_paths(path: string): string[];
15
15
  export declare function parse_path(path: string): (string | number)[];
16
16
  export declare function values_equal(val_a: unknown, val_b: unknown): boolean;
17
+ export declare function parse_edited_value(text: string): unknown;
18
+ export declare function set_at_path(root: unknown, path_str: string, new_value: unknown, root_label?: string): unknown;
17
19
  export declare function is_url(str: string): boolean;
18
20
  export declare function is_css_color(str: string): boolean;
19
21
  export declare function estimate_byte_size(value: unknown, max_depth?: number, current_depth?: number): number;
@@ -390,6 +390,39 @@ export function values_equal(val_a, val_b) {
390
390
  }
391
391
  return false;
392
392
  }
393
+ // Parse a raw edited string into a typed JSON value
394
+ // Numbers, booleans, and null are auto-detected; everything else stays as string
395
+ export function parse_edited_value(text) {
396
+ const trimmed = text.trim();
397
+ if (trimmed === `null`)
398
+ return null;
399
+ if (trimmed === `true`)
400
+ return true;
401
+ if (trimmed === `false`)
402
+ return false;
403
+ const num = Number(trimmed);
404
+ if (trimmed !== `` && Number.isFinite(num))
405
+ return num;
406
+ return text;
407
+ }
408
+ // Set a value at a dot/bracket path in a deep-cloned copy of root
409
+ // root_label is stripped from the path prefix if present
410
+ export function set_at_path(root, path_str, new_value, root_label) {
411
+ const segments = parse_path(path_str);
412
+ const start = root_label && segments[0] === root_label ? 1 : 0;
413
+ if (start >= segments.length)
414
+ return new_value;
415
+ const cloned = JSON.parse(JSON.stringify(root));
416
+ let current = cloned;
417
+ for (let idx = start; idx < segments.length - 1; idx++) {
418
+ const next = current[segments[idx]];
419
+ if (next === undefined || next === null)
420
+ return root; // bail — path no longer valid
421
+ current = next;
422
+ }
423
+ current[segments[segments.length - 1]] = new_value;
424
+ return cloned;
425
+ }
393
426
  // URL regex for auto-detection in string values
394
427
  const URL_RE = /^https?:\/\/\S+$/;
395
428
  // CSS color patterns for swatch rendering
@@ -507,8 +540,10 @@ export function compute_diff(old_val, new_val, current_path = ``, result = new M
507
540
  }
508
541
  // Both primitive: compare values (with NaN === NaN special case)
509
542
  if (is_primitive_type(old_type)) {
510
- const both_nan = typeof old_val === `number` && typeof new_val === `number` &&
511
- Number.isNaN(old_val) && Number.isNaN(new_val);
543
+ const both_nan = typeof old_val === `number` &&
544
+ typeof new_val === `number` &&
545
+ Number.isNaN(old_val) &&
546
+ Number.isNaN(new_val);
512
547
  if (!both_nan && old_val !== new_val) {
513
548
  result.set(current_path, {
514
549
  status: `changed`,
@@ -1,7 +1,30 @@
1
1
  // Edge table: for each cube configuration (256 cases), which edges are intersected
2
2
  // Each bit indicates whether that edge has an intersection
3
- // deno-fmt-ignore
4
- const EDGE_TABLE = [0x0, 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c, 0x80c, 0x905, 0xa0f, 0xb06, 0xc0a, 0xd03, 0xe09, 0xf00, 0x190, 0x99, 0x393, 0x29a, 0x596, 0x49f, 0x795, 0x69c, 0x99c, 0x895, 0xb9f, 0xa96, 0xd9a, 0xc93, 0xf99, 0xe90, 0x230, 0x339, 0x33, 0x13a, 0x636, 0x73f, 0x435, 0x53c, 0xa3c, 0xb35, 0x83f, 0x936, 0xe3a, 0xf33, 0xc39, 0xd30, 0x3a0, 0x2a9, 0x1a3, 0xaa, 0x7a6, 0x6af, 0x5a5, 0x4ac, 0xbac, 0xaa5, 0x9af, 0x8a6, 0xfaa, 0xea3, 0xda9, 0xca0, 0x460, 0x569, 0x663, 0x76a, 0x66, 0x16f, 0x265, 0x36c, 0xc6c, 0xd65, 0xe6f, 0xf66, 0x86a, 0x963, 0xa69, 0xb60, 0x5f0, 0x4f9, 0x7f3, 0x6fa, 0x1f6, 0xff, 0x3f5, 0x2fc, 0xdfc, 0xcf5, 0xfff, 0xef6, 0x9fa, 0x8f3, 0xbf9, 0xaf0, 0x650, 0x759, 0x453, 0x55a, 0x256, 0x35f, 0x55, 0x15c, 0xe5c, 0xf55, 0xc5f, 0xd56, 0xa5a, 0xb53, 0x859, 0x950, 0x7c0, 0x6c9, 0x5c3, 0x4ca, 0x3c6, 0x2cf, 0x1c5, 0xcc, 0xfcc, 0xec5, 0xdcf, 0xcc6, 0xbca, 0xac3, 0x9c9, 0x8c0, 0x8c0, 0x9c9, 0xac3, 0xbca, 0xcc6, 0xdcf, 0xec5, 0xfcc, 0xcc, 0x1c5, 0x2cf, 0x3c6, 0x4ca, 0x5c3, 0x6c9, 0x7c0, 0x950, 0x859, 0xb53, 0xa5a, 0xd56, 0xc5f, 0xf55, 0xe5c, 0x15c, 0x55, 0x35f, 0x256, 0x55a, 0x453, 0x759, 0x650, 0xaf0, 0xbf9, 0x8f3, 0x9fa, 0xef6, 0xfff, 0xcf5, 0xdfc, 0x2fc, 0x3f5, 0xff, 0x1f6, 0x6fa, 0x7f3, 0x4f9, 0x5f0, 0xb60, 0xa69, 0x963, 0x86a, 0xf66, 0xe6f, 0xd65, 0xc6c, 0x36c, 0x265, 0x16f, 0x66, 0x76a, 0x663, 0x569, 0x460, 0xca0, 0xda9, 0xea3, 0xfaa, 0x8a6, 0x9af, 0xaa5, 0xbac, 0x4ac, 0x5a5, 0x6af, 0x7a6, 0xaa, 0x1a3, 0x2a9, 0x3a0, 0xd30, 0xc39, 0xf33, 0xe3a, 0x936, 0x83f, 0xb35, 0xa3c, 0x53c, 0x435, 0x73f, 0x636, 0x13a, 0x33, 0x339, 0x230, 0xe90, 0xf99, 0xc93, 0xd9a, 0xa96, 0xb9f, 0x895, 0x99c, 0x69c, 0x795, 0x49f, 0x596, 0x29a, 0x393, 0x99, 0x190, 0xf00, 0xe09, 0xd03, 0xc0a, 0xb06, 0xa0f, 0x905, 0x80c, 0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x0];
3
+ // oxfmt-ignore
4
+ const EDGE_TABLE = [
5
+ 0x0, 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c, 0x80c, 0x905, 0xa0f, 0xb06, 0xc0a,
6
+ 0xd03, 0xe09, 0xf00, 0x190, 0x99, 0x393, 0x29a, 0x596, 0x49f, 0x795, 0x69c, 0x99c,
7
+ 0x895, 0xb9f, 0xa96, 0xd9a, 0xc93, 0xf99, 0xe90, 0x230, 0x339, 0x33, 0x13a, 0x636,
8
+ 0x73f, 0x435, 0x53c, 0xa3c, 0xb35, 0x83f, 0x936, 0xe3a, 0xf33, 0xc39, 0xd30, 0x3a0,
9
+ 0x2a9, 0x1a3, 0xaa, 0x7a6, 0x6af, 0x5a5, 0x4ac, 0xbac, 0xaa5, 0x9af, 0x8a6, 0xfaa,
10
+ 0xea3, 0xda9, 0xca0, 0x460, 0x569, 0x663, 0x76a, 0x66, 0x16f, 0x265, 0x36c, 0xc6c,
11
+ 0xd65, 0xe6f, 0xf66, 0x86a, 0x963, 0xa69, 0xb60, 0x5f0, 0x4f9, 0x7f3, 0x6fa, 0x1f6,
12
+ 0xff, 0x3f5, 0x2fc, 0xdfc, 0xcf5, 0xfff, 0xef6, 0x9fa, 0x8f3, 0xbf9, 0xaf0, 0x650,
13
+ 0x759, 0x453, 0x55a, 0x256, 0x35f, 0x55, 0x15c, 0xe5c, 0xf55, 0xc5f, 0xd56, 0xa5a,
14
+ 0xb53, 0x859, 0x950, 0x7c0, 0x6c9, 0x5c3, 0x4ca, 0x3c6, 0x2cf, 0x1c5, 0xcc, 0xfcc,
15
+ 0xec5, 0xdcf, 0xcc6, 0xbca, 0xac3, 0x9c9, 0x8c0, 0x8c0, 0x9c9, 0xac3, 0xbca, 0xcc6,
16
+ 0xdcf, 0xec5, 0xfcc, 0xcc, 0x1c5, 0x2cf, 0x3c6, 0x4ca, 0x5c3, 0x6c9, 0x7c0, 0x950,
17
+ 0x859, 0xb53, 0xa5a, 0xd56, 0xc5f, 0xf55, 0xe5c, 0x15c, 0x55, 0x35f, 0x256, 0x55a,
18
+ 0x453, 0x759, 0x650, 0xaf0, 0xbf9, 0x8f3, 0x9fa, 0xef6, 0xfff, 0xcf5, 0xdfc, 0x2fc,
19
+ 0x3f5, 0xff, 0x1f6, 0x6fa, 0x7f3, 0x4f9, 0x5f0, 0xb60, 0xa69, 0x963, 0x86a, 0xf66,
20
+ 0xe6f, 0xd65, 0xc6c, 0x36c, 0x265, 0x16f, 0x66, 0x76a, 0x663, 0x569, 0x460, 0xca0,
21
+ 0xda9, 0xea3, 0xfaa, 0x8a6, 0x9af, 0xaa5, 0xbac, 0x4ac, 0x5a5, 0x6af, 0x7a6, 0xaa,
22
+ 0x1a3, 0x2a9, 0x3a0, 0xd30, 0xc39, 0xf33, 0xe3a, 0x936, 0x83f, 0xb35, 0xa3c, 0x53c,
23
+ 0x435, 0x73f, 0x636, 0x13a, 0x33, 0x339, 0x230, 0xe90, 0xf99, 0xc93, 0xd9a, 0xa96,
24
+ 0xb9f, 0x895, 0x99c, 0x69c, 0x795, 0x49f, 0x596, 0x29a, 0x393, 0x99, 0x190, 0xf00,
25
+ 0xe09, 0xd03, 0xc0a, 0xb06, 0xa0f, 0x905, 0x80c, 0x70c, 0x605, 0x50f, 0x406, 0x30a,
26
+ 0x203, 0x109, 0x0,
27
+ ];
5
28
  // Triangle table: for each cube configuration, list of edge triplets forming triangles
6
29
  // -1 marks the end of the triangle list for that configuration
7
30
  const TRI_TABLE = [