@jbrowse/render-core 5.0.0-beta.1 → 5.0.0-beta.10

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 (352) hide show
  1. package/esm/RenderCanvas.d.ts +2 -2
  2. package/esm/RenderLifecycleMixin.d.ts +52 -20
  3. package/esm/RenderLifecycleMixin.js +89 -23
  4. package/esm/canvas2dUtils.d.ts +90 -23
  5. package/esm/canvas2dUtils.js +119 -36
  6. package/esm/colorRampLut.d.ts +5 -5
  7. package/esm/colorRampLut.js +6 -6
  8. package/esm/computePipeline.d.ts +14 -0
  9. package/esm/computePipeline.js +62 -0
  10. package/esm/contractReports.d.ts +54 -0
  11. package/esm/contractReports.js +112 -0
  12. package/esm/coverageBand.d.ts +13 -8
  13. package/esm/coverageBand.js +15 -5
  14. package/esm/coverageBandBuffers.d.ts +2 -9
  15. package/esm/coverageBandBuffers.js +1 -13
  16. package/esm/createRenderingBackend.d.ts +14 -18
  17. package/esm/createRenderingBackend.js +4 -2
  18. package/esm/displayPhase.d.ts +83 -104
  19. package/esm/displayPhase.js +42 -82
  20. package/esm/encodeMemo.d.ts +14 -0
  21. package/esm/encodeMemo.js +48 -0
  22. package/esm/gpuContextLostError.d.ts +30 -0
  23. package/esm/gpuContextLostError.js +40 -0
  24. package/esm/gpuDevice.d.ts +29 -10
  25. package/esm/gpuDevice.js +35 -16
  26. package/esm/graphicsCapabilities.d.ts +27 -19
  27. package/esm/graphicsCapabilities.js +40 -18
  28. package/esm/hal/createHal.d.ts +4 -5
  29. package/esm/hal/createHal.js +14 -4
  30. package/esm/hal/deviceGpuCache.d.ts +25 -30
  31. package/esm/hal/deviceGpuCache.js +88 -97
  32. package/esm/hal/gpuHalBase.d.ts +5 -4
  33. package/esm/hal/gpuHalBase.js +25 -14
  34. package/esm/hal/index.d.ts +2 -2
  35. package/esm/hal/index.js +1 -1
  36. package/esm/hal/mockHal.d.ts +15 -10
  37. package/esm/hal/mockHal.js +31 -18
  38. package/esm/hal/oomReporter.d.ts +7 -0
  39. package/esm/hal/oomReporter.js +10 -0
  40. package/esm/hal/passIds.d.ts +8 -7
  41. package/esm/hal/passIds.js +11 -10
  42. package/esm/hal/regionRegistry.d.ts +0 -1
  43. package/esm/hal/regionRegistry.js +3 -15
  44. package/esm/hal/types.d.ts +55 -18
  45. package/esm/hal/webgl2Hal.d.ts +23 -6
  46. package/esm/hal/webgl2Hal.js +161 -155
  47. package/esm/hal/webgpuHal.d.ts +29 -13
  48. package/esm/hal/webgpuHal.js +221 -153
  49. package/esm/installUpload.d.ts +16 -3
  50. package/esm/installUpload.js +13 -41
  51. package/esm/instanceCache.d.ts +10 -7
  52. package/esm/instanceCache.js +14 -15
  53. package/esm/instancePass.d.ts +2 -1
  54. package/esm/mapUploadSync.d.ts +2 -10
  55. package/esm/mapUploadSync.js +2 -3
  56. package/esm/marks/barMark.d.ts +30 -0
  57. package/esm/marks/barMark.js +149 -0
  58. package/esm/marks/colorFill.d.ts +17 -0
  59. package/esm/marks/colorFill.js +26 -0
  60. package/esm/marks/drawAgainstHit.d.ts +113 -0
  61. package/esm/marks/drawAgainstHit.js +407 -0
  62. package/esm/marks/ellipseDistance.d.ts +10 -0
  63. package/esm/marks/ellipseDistance.js +136 -0
  64. package/esm/marks/glyphPaint.d.ts +36 -0
  65. package/esm/marks/glyphPaint.js +77 -0
  66. package/esm/marks/index.d.ts +33 -0
  67. package/esm/marks/index.js +20 -0
  68. package/esm/marks/lineMark.d.ts +37 -0
  69. package/esm/marks/lineMark.js +416 -0
  70. package/esm/marks/linkMark.d.ts +76 -0
  71. package/esm/marks/linkMark.js +585 -0
  72. package/esm/marks/markBackend.d.ts +118 -0
  73. package/esm/marks/markBackend.js +196 -0
  74. package/esm/marks/markHit.d.ts +32 -0
  75. package/esm/marks/markHit.js +61 -0
  76. package/esm/marks/markInk.d.ts +18 -0
  77. package/esm/marks/markInk.js +71 -0
  78. package/esm/marks/markPaint.d.ts +14 -0
  79. package/esm/marks/markPaint.js +32 -0
  80. package/esm/marks/markPlan.d.ts +25 -0
  81. package/esm/marks/markPlan.js +20 -0
  82. package/esm/marks/markRamp.d.ts +72 -0
  83. package/esm/marks/markRamp.js +197 -0
  84. package/esm/marks/nearestMarkHit.d.ts +55 -0
  85. package/esm/marks/nearestMarkHit.js +158 -0
  86. package/esm/marks/pathRecorder.d.ts +14 -0
  87. package/esm/marks/pathRecorder.js +80 -0
  88. package/esm/marks/pointMark.d.ts +42 -0
  89. package/esm/marks/pointMark.js +125 -0
  90. package/esm/marks/rowLane.d.ts +39 -0
  91. package/esm/marks/rowLane.js +41 -0
  92. package/esm/marks/rowSpanIndex.d.ts +29 -0
  93. package/esm/marks/rowSpanIndex.js +141 -0
  94. package/esm/marks/rowTable.d.ts +41 -0
  95. package/esm/marks/rowTable.js +75 -0
  96. package/esm/marks/ruleMark.d.ts +21 -0
  97. package/esm/marks/ruleMark.js +91 -0
  98. package/esm/marks/spanMark.d.ts +42 -0
  99. package/esm/marks/spanMark.js +81 -0
  100. package/esm/marks/types.d.ts +261 -0
  101. package/esm/marks/types.js +175 -0
  102. package/esm/marks/valueScale.d.ts +23 -0
  103. package/esm/marks/valueScale.js +11 -0
  104. package/esm/namedReactions.d.ts +3 -4
  105. package/esm/namedReactions.js +3 -4
  106. package/esm/perRegionRenderingBackend.d.ts +21 -3
  107. package/esm/perRegionRenderingBackend.js +37 -3
  108. package/esm/regionDataMap.d.ts +2 -2
  109. package/esm/regionDataMap.js +25 -23
  110. package/esm/renderBlock.d.ts +14 -0
  111. package/esm/renderBlock.js +25 -0
  112. package/esm/renderingBackendBase.d.ts +20 -14
  113. package/esm/renderingBackendBase.js +12 -7
  114. package/esm/scoreScale.d.ts +27 -0
  115. package/esm/scoreScale.js +88 -0
  116. package/esm/shaders/barMark.generated.d.ts +3 -0
  117. package/esm/shaders/barMark.generated.js +7 -0
  118. package/esm/shaders/barMark.glsl.generated.d.ts +2 -0
  119. package/esm/shaders/barMark.glsl.generated.js +4 -0
  120. package/esm/shaders/barMark.iface.generated.d.ts +90 -0
  121. package/esm/shaders/barMark.iface.generated.js +205 -0
  122. package/esm/shaders/barMark.wgsl.generated.d.ts +1 -0
  123. package/esm/shaders/barMark.wgsl.generated.js +3 -0
  124. package/esm/shaders/capsule.js.generated.d.ts +1 -0
  125. package/esm/shaders/capsule.js.generated.js +11 -0
  126. package/esm/shaders/clipStrip.generated.d.ts +2 -0
  127. package/esm/shaders/clipStrip.generated.js +4 -0
  128. package/esm/shaders/clipStrip.js.generated.d.ts +1 -0
  129. package/esm/shaders/clipStrip.js.generated.js +21 -0
  130. package/esm/shaders/colorRampLut.js.generated.d.ts +1 -0
  131. package/esm/shaders/colorRampLut.js.generated.js +17 -0
  132. package/esm/shaders/coverageBar.generated.d.ts +2 -3
  133. package/esm/shaders/coverageBar.generated.js +4 -3
  134. package/esm/shaders/coverageBar.glsl.generated.d.ts +2 -0
  135. package/esm/shaders/coverageBar.glsl.generated.js +4 -0
  136. package/esm/shaders/coverageBar.iface.generated.js +1 -1
  137. package/esm/shaders/coverageBar.wgsl.generated.d.ts +1 -0
  138. package/esm/shaders/coverageBar.wgsl.generated.js +3 -0
  139. package/esm/shaders/coverageClip.generated.d.ts +3 -0
  140. package/esm/shaders/coverageClip.generated.js +7 -0
  141. package/esm/shaders/coverageClip.glsl.generated.d.ts +2 -0
  142. package/esm/shaders/coverageClip.glsl.generated.js +4 -0
  143. package/esm/shaders/coverageClip.iface.generated.d.ts +85 -0
  144. package/esm/shaders/coverageClip.iface.generated.js +114 -0
  145. package/esm/shaders/coverageClip.wgsl.generated.d.ts +1 -0
  146. package/esm/shaders/coverageClip.wgsl.generated.js +3 -0
  147. package/esm/shaders/coverageIndicator.generated.d.ts +2 -3
  148. package/esm/shaders/coverageIndicator.generated.js +4 -3
  149. package/esm/shaders/coverageIndicator.glsl.generated.d.ts +2 -0
  150. package/esm/shaders/coverageIndicator.glsl.generated.js +4 -0
  151. package/esm/shaders/coverageIndicator.iface.generated.js +1 -1
  152. package/esm/shaders/coverageIndicator.wgsl.generated.d.ts +1 -0
  153. package/esm/shaders/coverageIndicator.wgsl.generated.js +3 -0
  154. package/esm/shaders/coverageInterbase.generated.d.ts +2 -3
  155. package/esm/shaders/coverageInterbase.generated.js +4 -3
  156. package/esm/shaders/coverageInterbase.glsl.generated.d.ts +2 -0
  157. package/esm/shaders/coverageInterbase.glsl.generated.js +4 -0
  158. package/esm/shaders/coverageInterbase.iface.generated.js +1 -1
  159. package/esm/shaders/coverageInterbase.wgsl.generated.d.ts +1 -0
  160. package/esm/shaders/coverageInterbase.wgsl.generated.js +3 -0
  161. package/esm/shaders/coverageMod.generated.d.ts +2 -3
  162. package/esm/shaders/coverageMod.generated.js +4 -3
  163. package/esm/shaders/coverageMod.glsl.generated.d.ts +2 -0
  164. package/esm/shaders/coverageMod.glsl.generated.js +4 -0
  165. package/esm/shaders/coverageMod.iface.generated.js +1 -1
  166. package/esm/shaders/coverageMod.wgsl.generated.d.ts +1 -0
  167. package/esm/shaders/coverageMod.wgsl.generated.js +3 -0
  168. package/esm/shaders/coverageSnp.generated.d.ts +2 -3
  169. package/esm/shaders/coverageSnp.generated.js +4 -3
  170. package/esm/shaders/coverageSnp.glsl.generated.d.ts +2 -0
  171. package/esm/shaders/coverageSnp.glsl.generated.js +4 -0
  172. package/esm/shaders/coverageSnp.iface.generated.js +1 -1
  173. package/esm/shaders/coverageSnp.wgsl.generated.d.ts +1 -0
  174. package/esm/shaders/coverageSnp.wgsl.generated.js +3 -0
  175. package/esm/shaders/curveDistance.js.generated.d.ts +5 -0
  176. package/esm/shaders/curveDistance.js.generated.js +87 -0
  177. package/esm/shaders/hpmath.js.generated.d.ts +2 -1
  178. package/esm/shaders/hpmath.js.generated.js +5 -2
  179. package/esm/shaders/lineCenterMark.generated.d.ts +3 -0
  180. package/esm/shaders/lineCenterMark.generated.js +7 -0
  181. package/esm/shaders/lineCenterMark.glsl.generated.d.ts +2 -0
  182. package/esm/shaders/lineCenterMark.glsl.generated.js +4 -0
  183. package/esm/shaders/lineCenterMark.iface.generated.d.ts +104 -0
  184. package/esm/shaders/lineCenterMark.iface.generated.js +237 -0
  185. package/esm/shaders/lineCenterMark.wgsl.generated.d.ts +1 -0
  186. package/esm/shaders/lineCenterMark.wgsl.generated.js +3 -0
  187. package/esm/shaders/lineCommon.generated.d.ts +2 -0
  188. package/esm/shaders/lineCommon.generated.js +4 -0
  189. package/esm/shaders/lineStepMark.generated.d.ts +3 -0
  190. package/esm/shaders/lineStepMark.generated.js +7 -0
  191. package/esm/shaders/lineStepMark.glsl.generated.d.ts +2 -0
  192. package/esm/shaders/lineStepMark.glsl.generated.js +4 -0
  193. package/esm/shaders/lineStepMark.iface.generated.d.ts +98 -0
  194. package/esm/shaders/lineStepMark.iface.generated.js +225 -0
  195. package/esm/shaders/lineStepMark.wgsl.generated.d.ts +1 -0
  196. package/esm/shaders/lineStepMark.wgsl.generated.js +3 -0
  197. package/esm/shaders/linkMark.consts.generated.d.ts +14 -0
  198. package/esm/shaders/linkMark.consts.generated.js +16 -0
  199. package/esm/shaders/linkMark.generated.d.ts +4 -0
  200. package/esm/shaders/linkMark.generated.js +8 -0
  201. package/esm/shaders/linkMark.glsl.generated.d.ts +2 -0
  202. package/esm/shaders/linkMark.glsl.generated.js +4 -0
  203. package/esm/shaders/linkMark.iface.generated.d.ts +142 -0
  204. package/esm/shaders/linkMark.iface.generated.js +1829 -0
  205. package/esm/shaders/linkMark.js.generated.d.ts +7 -0
  206. package/esm/shaders/linkMark.js.generated.js +159 -0
  207. package/esm/shaders/linkMark.wgsl.generated.d.ts +1 -0
  208. package/esm/shaders/linkMark.wgsl.generated.js +3 -0
  209. package/esm/shaders/markColor.generated.d.ts +9 -0
  210. package/esm/shaders/markColor.generated.js +11 -0
  211. package/esm/shaders/pointGlyph.js.generated.d.ts +2 -0
  212. package/esm/shaders/pointGlyph.js.generated.js +15 -0
  213. package/esm/shaders/pointMark.consts.generated.d.ts +7 -0
  214. package/esm/shaders/pointMark.consts.generated.js +9 -0
  215. package/esm/shaders/pointMark.generated.d.ts +4 -0
  216. package/esm/shaders/pointMark.generated.js +8 -0
  217. package/esm/shaders/pointMark.glsl.generated.d.ts +2 -0
  218. package/esm/shaders/pointMark.glsl.generated.js +4 -0
  219. package/esm/shaders/pointMark.iface.generated.d.ts +98 -0
  220. package/esm/shaders/pointMark.iface.generated.js +219 -0
  221. package/esm/shaders/pointMark.js.generated.d.ts +3 -0
  222. package/esm/shaders/pointMark.js.generated.js +93 -0
  223. package/esm/shaders/pointMark.wgsl.generated.d.ts +1 -0
  224. package/esm/shaders/pointMark.wgsl.generated.js +3 -0
  225. package/esm/shaders/rowRect.generated.d.ts +0 -1
  226. package/esm/shaders/rowRect.generated.js +0 -1
  227. package/esm/shaders/rowTable.generated.d.ts +1 -0
  228. package/esm/shaders/rowTable.generated.js +3 -0
  229. package/esm/shaders/rowTable.js.generated.d.ts +5 -0
  230. package/esm/shaders/rowTable.js.generated.js +29 -0
  231. package/esm/shaders/scoreScale.generated.d.ts +2 -0
  232. package/esm/shaders/scoreScale.generated.js +4 -0
  233. package/esm/shaders/scoreScale.js.generated.d.ts +1 -0
  234. package/esm/shaders/scoreScale.js.generated.js +50 -23
  235. package/esm/shaders/spanMark.generated.d.ts +3 -0
  236. package/esm/shaders/spanMark.generated.js +7 -0
  237. package/esm/shaders/spanMark.glsl.generated.d.ts +2 -0
  238. package/esm/shaders/spanMark.glsl.generated.js +4 -0
  239. package/esm/shaders/spanMark.iface.generated.d.ts +81 -0
  240. package/esm/shaders/spanMark.iface.generated.js +215 -0
  241. package/esm/shaders/spanMark.wgsl.generated.d.ts +1 -0
  242. package/esm/shaders/spanMark.wgsl.generated.js +3 -0
  243. package/esm/sharedBackendKey.d.ts +18 -0
  244. package/esm/{keyedRenderingBackend.js → sharedBackendKey.js} +5 -0
  245. package/esm/slangPass.d.ts +18 -11
  246. package/esm/slangPass.js +12 -4
  247. package/esm/useGraphicsCapabilities.d.ts +1 -1
  248. package/esm/useGraphicsCapabilities.js +1 -1
  249. package/esm/useRenderingBackend.d.ts +13 -13
  250. package/esm/useRenderingBackend.js +58 -20
  251. package/esm/webgpuUtils.d.ts +3 -11
  252. package/esm/webgpuUtils.js +12 -33
  253. package/package.json +32 -7
  254. package/src/shaders/antialias.slang +46 -0
  255. package/src/shaders/arcHull.test.ts +267 -0
  256. package/src/shaders/barMark.generated.ts +11 -0
  257. package/src/shaders/barMark.glsl.generated.ts +6 -0
  258. package/src/shaders/barMark.iface.generated.ts +285 -0
  259. package/src/shaders/barMark.slang +167 -0
  260. package/src/shaders/barMark.wgsl.generated.ts +4 -0
  261. package/src/shaders/capsule.js.generated.ts +14 -0
  262. package/src/shaders/capsule.slang +12 -4
  263. package/src/shaders/clipStrip.generated.ts +6 -0
  264. package/src/shaders/clipStrip.js.generated.ts +22 -0
  265. package/src/shaders/clipStrip.slang +34 -0
  266. package/src/shaders/clipStrip.test.ts +39 -0
  267. package/src/shaders/colorPack.slang +5 -1
  268. package/src/shaders/colorRampLut.js.generated.ts +22 -0
  269. package/src/shaders/colorRampLut.slang +15 -1
  270. package/src/shaders/coverageBand.slang +64 -32
  271. package/src/shaders/coverageBar.generated.ts +6 -5
  272. package/src/shaders/coverageBar.glsl.generated.ts +6 -0
  273. package/src/shaders/coverageBar.iface.generated.ts +1 -1
  274. package/src/shaders/coverageBar.slang +10 -10
  275. package/src/shaders/coverageBar.wgsl.generated.ts +4 -0
  276. package/src/shaders/coverageClip.generated.ts +11 -0
  277. package/src/shaders/coverageClip.glsl.generated.ts +6 -0
  278. package/src/shaders/coverageClip.iface.generated.ts +172 -0
  279. package/src/shaders/coverageClip.slang +38 -0
  280. package/src/shaders/coverageClip.wgsl.generated.ts +4 -0
  281. package/src/shaders/coverageIndicator.generated.ts +6 -5
  282. package/src/shaders/coverageIndicator.glsl.generated.ts +6 -0
  283. package/src/shaders/coverageIndicator.iface.generated.ts +1 -1
  284. package/src/shaders/coverageIndicator.wgsl.generated.ts +4 -0
  285. package/src/shaders/coverageInterbase.generated.ts +6 -5
  286. package/src/shaders/coverageInterbase.glsl.generated.ts +6 -0
  287. package/src/shaders/coverageInterbase.iface.generated.ts +1 -1
  288. package/src/shaders/coverageInterbase.wgsl.generated.ts +4 -0
  289. package/src/shaders/coverageMod.generated.ts +6 -5
  290. package/src/shaders/coverageMod.glsl.generated.ts +6 -0
  291. package/src/shaders/coverageMod.iface.generated.ts +1 -1
  292. package/src/shaders/coverageMod.wgsl.generated.ts +4 -0
  293. package/src/shaders/coverageSnp.generated.ts +6 -5
  294. package/src/shaders/coverageSnp.glsl.generated.ts +6 -0
  295. package/src/shaders/coverageSnp.iface.generated.ts +1 -1
  296. package/src/shaders/coverageSnp.wgsl.generated.ts +4 -0
  297. package/src/shaders/curveDistance.js.generated.ts +91 -0
  298. package/src/shaders/curveDistance.slang +265 -0
  299. package/src/shaders/hpClampFloor.test.ts +87 -0
  300. package/src/shaders/hpmath.js.generated.ts +6 -2
  301. package/src/shaders/hpmath.slang +100 -48
  302. package/src/shaders/insetValueScale.test.ts +67 -0
  303. package/src/shaders/lineCenterMark.generated.ts +11 -0
  304. package/src/shaders/lineCenterMark.glsl.generated.ts +6 -0
  305. package/src/shaders/lineCenterMark.iface.generated.ts +328 -0
  306. package/src/shaders/lineCenterMark.slang +127 -0
  307. package/src/shaders/lineCenterMark.wgsl.generated.ts +4 -0
  308. package/src/shaders/lineCommon.generated.ts +6 -0
  309. package/src/shaders/lineCommon.slang +102 -0
  310. package/src/shaders/lineStepMark.generated.ts +11 -0
  311. package/src/shaders/lineStepMark.glsl.generated.ts +6 -0
  312. package/src/shaders/lineStepMark.iface.generated.ts +311 -0
  313. package/src/shaders/lineStepMark.slang +125 -0
  314. package/src/shaders/lineStepMark.wgsl.generated.ts +4 -0
  315. package/src/shaders/linkMark.consts.generated.ts +30 -0
  316. package/src/shaders/linkMark.generated.ts +12 -0
  317. package/src/shaders/linkMark.glsl.generated.ts +6 -0
  318. package/src/shaders/linkMark.iface.generated.ts +1954 -0
  319. package/src/shaders/linkMark.js.generated.ts +167 -0
  320. package/src/shaders/linkMark.slang +439 -0
  321. package/src/shaders/linkMark.wgsl.generated.ts +4 -0
  322. package/src/shaders/markColor.generated.ts +20 -0
  323. package/src/shaders/markColor.slang +128 -0
  324. package/src/shaders/pointGlyph.js.generated.ts +20 -0
  325. package/src/shaders/pointGlyph.slang +23 -7
  326. package/src/shaders/pointGlyphPad.test.ts +242 -0
  327. package/src/shaders/pointMark.consts.generated.ts +16 -0
  328. package/src/shaders/pointMark.generated.ts +12 -0
  329. package/src/shaders/pointMark.glsl.generated.ts +6 -0
  330. package/src/shaders/pointMark.iface.generated.ts +304 -0
  331. package/src/shaders/pointMark.js.generated.ts +99 -0
  332. package/src/shaders/pointMark.slang +227 -0
  333. package/src/shaders/pointMark.wgsl.generated.ts +4 -0
  334. package/src/shaders/rowRect.generated.ts +0 -2
  335. package/src/shaders/rowRect.slang +39 -58
  336. package/src/shaders/rowTable.generated.ts +4 -0
  337. package/src/shaders/rowTable.js.generated.ts +37 -0
  338. package/src/shaders/rowTable.slang +98 -0
  339. package/src/shaders/scoreScale.generated.ts +6 -0
  340. package/src/shaders/scoreScale.js.generated.ts +48 -23
  341. package/src/shaders/scoreScale.slang +49 -55
  342. package/src/shaders/sdEllipse.test.ts +211 -0
  343. package/src/shaders/spanMark.generated.ts +11 -0
  344. package/src/shaders/spanMark.glsl.generated.ts +6 -0
  345. package/src/shaders/spanMark.iface.generated.ts +289 -0
  346. package/src/shaders/spanMark.slang +77 -0
  347. package/src/shaders/spanMark.wgsl.generated.ts +4 -0
  348. package/src/shaders/valueScale.slang +26 -0
  349. package/src/shaders/wideCircleLeg.test.ts +85 -0
  350. package/esm/globalRenderingBackend.d.ts +0 -90
  351. package/esm/globalRenderingBackend.js +0 -53
  352. package/esm/keyedRenderingBackend.d.ts +0 -41
@@ -7,31 +7,27 @@ import type { GpuHal, PipelineDescriptor, SampleCount } from './hal/types.ts';
7
7
  */
8
8
  export interface RenderingBackendOptions<TRenderingBackend> {
9
9
  passes: PipelineDescriptor[];
10
- uniformByteSize: number;
11
10
  /**
12
- * Samples per pixel this display's WebGPU target is allocated at — 4 unless
13
- * stated, which is what every display asked for while this was a build-time
14
- * constant.
11
+ * Samples per pixel this display's WebGPU target is allocated at. Omitted, it
12
+ * is derived from `passes`: 1 when every registered pass declares
13
+ * `//! coverage: analytic`, else 4. Registered, not drawn — an inactive pass
14
+ * that leans on MSAA holds its display at 4. Passing it overrides the
15
+ * derivation in either direction.
15
16
  *
16
- * **It is a property of the display, not of the build**, because what it buys
17
- * differs per display and what it costs does not. The cost is one colour
18
- * attachment the size of the canvas, so an empty 600px track pays what a full
19
- * one does and eight ordinary tracks on a retina panel hold 109.7 MiB nothing
20
- * counts (ARCHITECTURAL_LIMITS.md §"The MSAA target is the largest
21
- * per-display allocation"). What it buys is nothing at all for a display
22
- * whose fragments compute their own coverage, and the one fix there is for
23
- * conflation at the shared edges of tiled cells, which is Hi-C and LD.
24
- *
25
- * Setting it to 1 allocates **no** target rather than a smaller one. Which
26
- * displays should is a look-at-the-pixels decision taken one display at a
27
- * time; `ideas/arc-antialiasing-without-msaa.md` is the survey and the
28
- * captures.
17
+ * The cost is one colour attachment the size of the canvas — an empty 600px
18
+ * track pays what a full one does, and eight ordinary tracks on a retina
19
+ * panel hold 109.7 MiB nothing counts (ARCHITECTURAL_LIMITS.md §"The MSAA
20
+ * target is the largest per-display allocation"); 1 allocates none. Whether a
21
+ * display's pixels survive the flip is a look-at-the-pixels decision taken
22
+ * one display at a time; `ideas/waiting-on-a-number/arc-antialiasing-without-msaa.md` is the
23
+ * survey and the captures.
29
24
  */
30
25
  sampleCount?: SampleCount;
31
26
  createGpuBackend: (hal: GpuHal) => TRenderingBackend;
32
27
  createCanvas2DBackend: (canvas: HTMLCanvasElement) => TRenderingBackend;
33
28
  }
34
- export declare function createRenderingBackend<TRenderingBackend>(canvas: HTMLCanvasElement, { passes, uniformByteSize, sampleCount, createGpuBackend, createCanvas2DBackend, }: RenderingBackendOptions<TRenderingBackend>): Promise<TRenderingBackend>;
29
+ export declare function deriveSampleCount(passes: readonly PipelineDescriptor[]): SampleCount;
30
+ export declare function createRenderingBackend<TRenderingBackend>(canvas: HTMLCanvasElement, { passes, sampleCount, createGpuBackend, createCanvas2DBackend, }: RenderingBackendOptions<TRenderingBackend>): Promise<TRenderingBackend>;
35
31
  /**
36
32
  * Factory for a **Canvas2D-only** display — one that ships no GPU shader path.
37
33
  *
@@ -1,5 +1,8 @@
1
1
  import { assertUniquePassIds, createGpuHal } from './hal/index.js';
2
- export async function createRenderingBackend(canvas, { passes, uniformByteSize, sampleCount = 4, createGpuBackend, createCanvas2DBackend, }) {
2
+ export function deriveSampleCount(passes) {
3
+ return passes.every(p => p.coverage === 'analytic') ? 1 : 4;
4
+ }
5
+ export async function createRenderingBackend(canvas, { passes, sampleCount = deriveSampleCount(passes), createGpuBackend, createCanvas2DBackend, }) {
3
6
  // Before the ladder, so a duplicate id is reported on every machine rather
4
7
  // than only the ones that reach a GPU rung — the bug it prevents is silent
5
8
  // and GPU-only, which is precisely why a developer on the Canvas2D fallback
@@ -15,7 +18,6 @@ export async function createRenderingBackend(canvas, { passes, uniformByteSize,
15
18
  const ladderFailures = [];
16
19
  const hal = await createGpuHal(canvas, {
17
20
  passes,
18
- uniformByteSize,
19
21
  sampleCount,
20
22
  failures: ladderFailures,
21
23
  });
@@ -1,16 +1,20 @@
1
1
  /**
2
2
  * The mutually-exclusive visual state of a GPU display. Computing it in one
3
- * place means the precedence — renderError > tooLarge > error > loading > ready
4
- * — lives in a single function instead of being re-encoded by subtraction
5
- * (`&& !regionTooLarge && !error && !renderError`) in every display model AND
6
- * mirrored a second time by `DisplayChrome`'s JSX order. `DisplayChrome`
7
- * switches on it; the loading scrim's visibility is just
8
- * `displayPhase === 'loading'`, computed once in the chrome.
3
+ * place means the precedence — renderError > tooLarge > error > canceled >
4
+ * loading > ready — lives in a single function instead of being re-encoded by
5
+ * subtraction (`&& !regionTooLarge && !error && !renderError`) in every display
6
+ * model AND mirrored a second time by `DisplayChrome`'s JSX order.
9
7
  *
10
8
  * `renderError` and `tooLarge` replace the whole display subtree (their own
11
9
  * root element, so the transition unmounts the canvas → `canvasRef(null)` →
12
- * `backend.dispose()`). `error` and `loading` are overlays rendered *over* the
13
- * still-mounted canvas, so they share the `ready` branch's root.
10
+ * `backend.dispose()`). `error`, `canceled` and `loading` are overlays rendered
11
+ * *over* the still-mounted canvas, so they share the `ready` branch's root.
12
+ *
13
+ * `loading` is the one phase that means work is outstanding: every reader
14
+ * asking "is it finished" (`AppReadyMarker`, `jb.waitReady`, the capture waits)
15
+ * treats every other phase as finished. `canceled` is the user's standing stop,
16
+ * durable until Retry (or, on the LGV families, a viewport change); the chrome
17
+ * draws it as the loading overlay in its canceled state, which carries Retry.
14
18
  */
15
19
  export type DisplayPhase = 'renderError' | DisplayStatusPhase;
16
20
  /**
@@ -20,10 +24,14 @@ export type DisplayPhase = 'renderError' | DisplayStatusPhase;
20
24
  * (the backend hook's `retry()`), which is exactly the line between the shared
21
25
  * status chrome and the GPU chrome wrapped around it: `DisplayStatusChrome`
22
26
  * takes this, `DisplayChrome` takes the wider union and peels off `renderError`
23
- * before delegating. A main-thread SVG display (arc) computes this one and is
24
- * then *unable* to claim a phase whose banner has no retry to offer.
27
+ * before delegating.
28
+ */
29
+ export type DisplayStatusPhase = 'tooLarge' | 'error' | DisplayActivityPhase;
30
+ /**
31
+ * What is left once no failure terminal holds, as `computeActivityPhase`
32
+ * answers it for every fetching family.
25
33
  */
26
- export type DisplayStatusPhase = 'tooLarge' | 'error' | 'loading' | 'ready';
34
+ export type DisplayActivityPhase = 'canceled' | 'loading' | 'ready';
27
35
  export interface DisplayStatusPhaseInputs {
28
36
  regionTooLarge: boolean;
29
37
  error: unknown;
@@ -32,124 +40,95 @@ export interface DisplayPhaseInputs extends DisplayStatusPhaseInputs {
32
40
  renderError: unknown;
33
41
  }
34
42
  /**
35
- * `loading` is the only display-specific axis: MultiRegion passes
36
- * "!isReady || stale viewport", Global passes "fetch in flight", sequence
37
- * layers a zoom gate on top. The terminal precedence above it is identical for
38
- * every display, so it lives here — pass the display's loading condition and
39
- * get the resolved phase back.
43
+ * The terminal precedence shared by every display, over the display's own
44
+ * activity phase.
40
45
  *
41
- * `loading` is a **thunk**, evaluated only after the three terminal states are
42
- * ruled out. This is load-bearing for MobX, not a micro-optimization: the
43
- * loading condition typically reads the containing view (`visibleRegions`,
44
- * `loadedRegions`, …), a large reactive dependency set. Evaluating it eagerly
45
- * would make every reader of `displayPhase` subscribe to all of it even while a
46
- * banner is up — and `DisplayChrome`'s observer, re-firing on that churn during
47
- * a terminal state, then fails to commit the banner subtree to the DOM (the
48
- * React-reconciliation hazard documented in DisplayChrome.tsx). Short-circuiting
49
- * keeps the tracked set to just the terminal flags when one is active, matching
50
- * the old direct-read early-returns.
46
+ * `activity` is a **thunk**, evaluated only after the three failure terminals
47
+ * are ruled out. Load-bearing for MobX: the activity condition typically reads
48
+ * the containing view (`visibleRegions`, `loadedRegions`, …), and evaluating it
49
+ * eagerly would subscribe every reader of `displayPhase` to that churn even
50
+ * while a banner is up — and `DisplayChrome`'s observer, re-firing during a
51
+ * terminal state, then fails to commit the banner subtree (see
52
+ * DisplayChrome.tsx).
51
53
  */
52
- export declare function computeDisplayPhase({ renderError, regionTooLarge, error }: DisplayPhaseInputs, loading: () => boolean): DisplayPhase;
54
+ export declare function computeDisplayPhase({ renderError, regionTooLarge, error }: DisplayPhaseInputs, activity: () => DisplayActivityPhase): DisplayPhase;
53
55
  /**
54
- * The five terms the `loading` condition is built from, minus the one that is a
55
- * thunk. All cheap flags on the display itself, so they are read eagerly the
56
- * same way `computeDisplayPhase` reads its terminals.
56
+ * The terms the activity phase is built from, minus the thunks. All cheap flags
57
+ * on the display itself, so they are read eagerly the same way
58
+ * `computeDisplayPhase` reads its terminals.
57
59
  */
58
- export interface DisplayLoadingInputs {
60
+ export interface DisplayActivityInputs {
61
+ /**
62
+ * The containing track is minimized. Every fetch gate skips a minimized
63
+ * track and its canvas is unmounted, so nothing the terms below wait on can
64
+ * arrive. Suppresses them all, like `fetchInert`, which a subclass overrides
65
+ * outright and so cannot carry it.
66
+ */
67
+ isMinimized: boolean;
59
68
  /**
60
69
  * The display is deliberately showing a static message instead of data
61
- * (sequence past base resolution, LD with the triangle off), so no scrim at
62
- * all. Suppresses every term below — which is why `rendersCanvas: false` is
63
- * not a substitute: that one drops the pre-first-paint term alone, leaving the
64
- * fetch terms free to scrim over the placeholder, and `isLoadingOrCanceled`
65
- * includes a cancel that is deliberately durable.
70
+ * (sequence past base resolution, LD with the triangle off). Suppresses every
71
+ * term below, a standing cancel included — which is why `rendersCanvas: false`
72
+ * is not a substitute: that one drops the pre-first-paint term alone.
66
73
  */
67
74
  fetchInert: boolean;
68
75
  /**
69
- * The view holds no content block, so there is nothing to fetch and nothing
70
- * to paint: `showAllRegions` over a region set whose every member falls under
71
- * `minimumBlockWidth`, which is a scaffold-level assembly and little else (see
72
- * `viewportEmpty`). Suppresses every term below for the same reason
73
- * `fetchInert` does, and it is the pre-first-paint one that makes it
74
- * necessary: no fetch is issued, so `canvasDrawn` is never set and the scrim
75
- * would sit there for as long as the viewport stays off content.
76
+ * The view holds no content block (`showAllRegions` over a region set whose
77
+ * every member falls under `minimumBlockWidth`; see `viewportEmpty`), so no
78
+ * fetch is issued and `canvasDrawn` is never set. Suppresses every term below.
76
79
  */
77
80
  viewportEmpty: boolean;
81
+ /** a fetch is in flight */
82
+ isLoading: boolean;
83
+ /**
84
+ * The user canceled a fetch and has not retried. Outranks every loading term,
85
+ * since what those wait on is the fetch the user stopped. Kept apart from
86
+ * `isLoading` because a cancel is finished, not pending: folded into the
87
+ * loading term, a canceled display read `loading` until Retry and parked every
88
+ * readiness gate on it.
89
+ */
90
+ fetchCanceled: boolean;
78
91
  /**
79
- * A fetch is in flight, or the user canceled one. **Never a bare
80
- * `isLoading`**: cancel drops the stop token synchronously, so without the
81
- * second term the phase falls to `ready` and the overlay carrying the Retry
82
- * button unmounts, leaving the display stopped and empty with nothing to
83
- * click.
92
+ * A load this display depends on beyond its primary fetch has not landed for
93
+ * the first time (multi-way synteny's lane genes and links). A loading term
94
+ * rather than a `dataSuperseded` fold: that flag holds the export through
95
+ * every later refetch too, and a scrim over lanes already drawn is the thing
96
+ * a display saying this wants to avoid.
84
97
  */
85
- isLoadingOrCanceled: boolean;
98
+ awaitingDependentData: boolean;
86
99
  /**
87
100
  * Whether this display paints a canvas in its current configuration. Gates
88
- * the pre-first-paint term alone, because a display that is showing a
89
- * deliberate non-canvas placeholder (LD with the triangle off) never flips
90
- * `canvasDrawn` and would sit under the scrim forever.
101
+ * the pre-first-paint term alone, because a display showing a deliberate
102
+ * non-canvas placeholder (LD with the triangle off) never flips `canvasDrawn`.
91
103
  */
92
104
  rendersCanvas: boolean;
93
105
  /** first paint has happened */
94
106
  canvasDrawn: boolean;
95
107
  }
96
108
  /**
97
- * The `loading` term itself — the one axis `computeDisplayPhase` leaves to its
98
- * caller — expressed once for both LGV display families.
99
- *
100
- * It was two hand-written expressions, and they had already drifted apart in
101
- * three ways that were equivalent only by accident: the per-region family spelled
102
- * the cancel term out by hand (`!isReady || … || fetchCanceled`, over a bare
103
- * `isLoading`) rather than reading `isLoadingOrCanceled`, and each family carried
104
- * exactly one of the two suppression hooks — `fetchInert` on per-region,
105
- * `rendersCanvas` on global — so a display in the other family could express its
106
- * case only by overriding `displayPhase`, which is the thing both hooks exist to
107
- * prevent. Single-sourcing the expression is the same argument the precedence
108
- * above already won, one level down: a term added here reaches every display,
109
- * instead of reaching whichever family the author happened to be reading.
110
- *
111
- * The four inputs all now live on a mixin every foundation composes —
112
- * `fetchInert` / `isLoadingOrCanceled` on `FetchMixin`, `rendersCanvas` /
113
- * `canvasDrawn` on `RenderLifecycleMixin` — so `foundationDisplayPhase` passes
114
- * the model straight through and the only thing a family supplies is
115
- * `viewportCurrent`: per-region its staleness predicate, global `() => true` (it
116
- * keeps the last frame up through a refetch rather than scrimming). Two hooks
117
- * used to be hard-coded per family instead, which is how the second drift
118
- * happened after the first was fixed — LD needed `fetchInert` and the
119
- * global family did not have it.
109
+ * The activity phase, expressed once for every fetching display family, so a
110
+ * term added here reaches every display. The two LGV families hand-wrote it
111
+ * until they had drifted on the cancel term and on which suppression hook each
112
+ * carried.
120
113
  *
121
- * `viewportCurrent` is a **thunk** for the same MobX reason `computeDisplayPhase`'s
122
- * `loading` is: it reads the containing view (`visibleRegions`, `loadedRegions`),
123
- * while the flag inputs above are on the display itself. Short-circuiting keeps a
124
- * suppressed or already-loading display from subscribing to viewport churn.
114
+ * `viewportCurrent` is a **thunk** for the MobX reason `computeDisplayPhase`'s
115
+ * `activity` is: it reads the containing view, while the flags above are on the
116
+ * display. Per-region passes its staleness predicate, global `() => true` (it
117
+ * keeps the last frame up through a refetch rather than scrimming).
125
118
  *
126
119
  * `hostMounted` is a thunk for the same reason, and gates the **pre-first-paint
127
- * term only**. A container that mounts a view's body lazily — `ViewContainer`
128
- * does, to stay under the WebGL2 context ceiling — leaves an off-screen view
129
- * with no canvas, so `markCanvasDrawn` is never called and `!canvasDrawn` stays
130
- * true with nothing able to resolve it. That parked `[data-app-phase="ready"]`
131
- * for the whole app on a view the user could not see, and every capture and e2e
132
- * gate waiting on it burned its full timeout.
133
- *
134
- * It is a required flag on every view and on the duck-typed host contracts, not
135
- * an optional one defaulted here: a stand-in that forgot it would silently
136
- * excuse the first paint and let a readiness gate fire over a view that had not
137
- * started.
138
- *
139
- * The fetch terms deliberately stay live while unmounted: an off-screen display
140
- * still fetches, so reporting it idle would let a readiness gate fire over work
141
- * genuinely in flight — and during cold load `visible` is false until the
142
- * IntersectionObserver's first callback, which is exactly when a display must
143
- * not flash `ready`. Only the paint it will never do is excused.
120
+ * term only**. `ViewContainer` mounts an off-screen view's body lazily, so its
121
+ * display has no canvas and `!canvasDrawn` could never resolve — which parked
122
+ * `[data-app-phase="ready"]` for the whole app. It is required on every view and
123
+ * host contract rather than defaulted there, so a stand-in has to state it and
124
+ * cannot excuse the first paint by omission. The fetch terms stay live while unmounted: an
125
+ * off-screen display still fetches, and during cold load `visible` is false
126
+ * until the IntersectionObserver's first callback.
144
127
  */
145
- export declare function computeLoadingTerm({ fetchInert, viewportEmpty, isLoadingOrCanceled, rendersCanvas, canvasDrawn, }: DisplayLoadingInputs, viewportCurrent: () => boolean, hostMounted?: () => boolean): boolean;
128
+ export declare function computeActivityPhase({ isMinimized, fetchInert, viewportEmpty, isLoading, fetchCanceled, awaitingDependentData, rendersCanvas, canvasDrawn, }: DisplayActivityInputs, viewportCurrent: () => boolean, hostMounted?: () => boolean): DisplayActivityPhase;
146
129
  /**
147
130
  * The same ranking minus `renderError`, for a display with no rendering backend
148
- * to fail (arc's main-thread SVG). `computeDisplayPhase` delegates here rather
149
- * than restating the tail, so there is still exactly one place the order lives —
150
- * and the narrower return type is what lets `DisplayStatusChrome` accept a
151
- * backend-less display without either a cast or a dead branch.
152
- *
153
- * `loading` is a thunk here for the same reason as above.
131
+ * to fail (arc's main-thread SVG). `computeDisplayPhase` delegates here, so the
132
+ * order lives in one place.
154
133
  */
155
- export declare function computeDisplayStatusPhase({ regionTooLarge, error }: DisplayStatusPhaseInputs, loading: () => boolean): DisplayStatusPhase;
134
+ export declare function computeDisplayStatusPhase({ regionTooLarge, error }: DisplayStatusPhaseInputs, activity: () => DisplayActivityPhase): DisplayStatusPhase;
@@ -1,97 +1,57 @@
1
1
  /**
2
- * `loading` is the only display-specific axis: MultiRegion passes
3
- * "!isReady || stale viewport", Global passes "fetch in flight", sequence
4
- * layers a zoom gate on top. The terminal precedence above it is identical for
5
- * every display, so it lives here — pass the display's loading condition and
6
- * get the resolved phase back.
7
- *
8
- * `loading` is a **thunk**, evaluated only after the three terminal states are
9
- * ruled out. This is load-bearing for MobX, not a micro-optimization: the
10
- * loading condition typically reads the containing view (`visibleRegions`,
11
- * `loadedRegions`, …), a large reactive dependency set. Evaluating it eagerly
12
- * would make every reader of `displayPhase` subscribe to all of it even while a
13
- * banner is up — and `DisplayChrome`'s observer, re-firing on that churn during
14
- * a terminal state, then fails to commit the banner subtree to the DOM (the
15
- * React-reconciliation hazard documented in DisplayChrome.tsx). Short-circuiting
16
- * keeps the tracked set to just the terminal flags when one is active, matching
17
- * the old direct-read early-returns.
2
+ * The terminal precedence shared by every display, over the display's own
3
+ * activity phase.
4
+ *
5
+ * `activity` is a **thunk**, evaluated only after the three failure terminals
6
+ * are ruled out. Load-bearing for MobX: the activity condition typically reads
7
+ * the containing view (`visibleRegions`, `loadedRegions`, …), and evaluating it
8
+ * eagerly would subscribe every reader of `displayPhase` to that churn even
9
+ * while a banner is up — and `DisplayChrome`'s observer, re-firing during a
10
+ * terminal state, then fails to commit the banner subtree (see
11
+ * DisplayChrome.tsx).
18
12
  */
19
- export function computeDisplayPhase({ renderError, regionTooLarge, error }, loading) {
13
+ export function computeDisplayPhase({ renderError, regionTooLarge, error }, activity) {
20
14
  return renderError
21
15
  ? 'renderError'
22
- : computeDisplayStatusPhase({ regionTooLarge, error }, loading);
16
+ : computeDisplayStatusPhase({ regionTooLarge, error }, activity);
23
17
  }
24
18
  /**
25
- * The `loading` term itself — the one axis `computeDisplayPhase` leaves to its
26
- * caller — expressed once for both LGV display families.
27
- *
28
- * It was two hand-written expressions, and they had already drifted apart in
29
- * three ways that were equivalent only by accident: the per-region family spelled
30
- * the cancel term out by hand (`!isReady || … || fetchCanceled`, over a bare
31
- * `isLoading`) rather than reading `isLoadingOrCanceled`, and each family carried
32
- * exactly one of the two suppression hooks — `fetchInert` on per-region,
33
- * `rendersCanvas` on global — so a display in the other family could express its
34
- * case only by overriding `displayPhase`, which is the thing both hooks exist to
35
- * prevent. Single-sourcing the expression is the same argument the precedence
36
- * above already won, one level down: a term added here reaches every display,
37
- * instead of reaching whichever family the author happened to be reading.
38
- *
39
- * The four inputs all now live on a mixin every foundation composes —
40
- * `fetchInert` / `isLoadingOrCanceled` on `FetchMixin`, `rendersCanvas` /
41
- * `canvasDrawn` on `RenderLifecycleMixin` — so `foundationDisplayPhase` passes
42
- * the model straight through and the only thing a family supplies is
43
- * `viewportCurrent`: per-region its staleness predicate, global `() => true` (it
44
- * keeps the last frame up through a refetch rather than scrimming). Two hooks
45
- * used to be hard-coded per family instead, which is how the second drift
46
- * happened after the first was fixed — LD needed `fetchInert` and the
47
- * global family did not have it.
19
+ * The activity phase, expressed once for every fetching display family, so a
20
+ * term added here reaches every display. The two LGV families hand-wrote it
21
+ * until they had drifted on the cancel term and on which suppression hook each
22
+ * carried.
48
23
  *
49
- * `viewportCurrent` is a **thunk** for the same MobX reason `computeDisplayPhase`'s
50
- * `loading` is: it reads the containing view (`visibleRegions`, `loadedRegions`),
51
- * while the flag inputs above are on the display itself. Short-circuiting keeps a
52
- * suppressed or already-loading display from subscribing to viewport churn.
24
+ * `viewportCurrent` is a **thunk** for the MobX reason `computeDisplayPhase`'s
25
+ * `activity` is: it reads the containing view, while the flags above are on the
26
+ * display. Per-region passes its staleness predicate, global `() => true` (it
27
+ * keeps the last frame up through a refetch rather than scrimming).
53
28
  *
54
29
  * `hostMounted` is a thunk for the same reason, and gates the **pre-first-paint
55
- * term only**. A container that mounts a view's body lazily — `ViewContainer`
56
- * does, to stay under the WebGL2 context ceiling — leaves an off-screen view
57
- * with no canvas, so `markCanvasDrawn` is never called and `!canvasDrawn` stays
58
- * true with nothing able to resolve it. That parked `[data-app-phase="ready"]`
59
- * for the whole app on a view the user could not see, and every capture and e2e
60
- * gate waiting on it burned its full timeout.
61
- *
62
- * It is a required flag on every view and on the duck-typed host contracts, not
63
- * an optional one defaulted here: a stand-in that forgot it would silently
64
- * excuse the first paint and let a readiness gate fire over a view that had not
65
- * started.
66
- *
67
- * The fetch terms deliberately stay live while unmounted: an off-screen display
68
- * still fetches, so reporting it idle would let a readiness gate fire over work
69
- * genuinely in flight — and during cold load `visible` is false until the
70
- * IntersectionObserver's first callback, which is exactly when a display must
71
- * not flash `ready`. Only the paint it will never do is excused.
30
+ * term only**. `ViewContainer` mounts an off-screen view's body lazily, so its
31
+ * display has no canvas and `!canvasDrawn` could never resolve — which parked
32
+ * `[data-app-phase="ready"]` for the whole app. It is required on every view and
33
+ * host contract rather than defaulted there, so a stand-in has to state it and
34
+ * cannot excuse the first paint by omission. The fetch terms stay live while unmounted: an
35
+ * off-screen display still fetches, and during cold load `visible` is false
36
+ * until the IntersectionObserver's first callback.
72
37
  */
73
- export function computeLoadingTerm({ fetchInert, viewportEmpty, isLoadingOrCanceled, rendersCanvas, canvasDrawn, }, viewportCurrent, hostMounted = () => true) {
74
- return (!fetchInert &&
75
- !viewportEmpty &&
76
- (isLoadingOrCanceled ||
77
- (rendersCanvas && hostMounted() && !canvasDrawn) ||
78
- !viewportCurrent()));
38
+ export function computeActivityPhase({ isMinimized, fetchInert, viewportEmpty, isLoading, fetchCanceled, awaitingDependentData, rendersCanvas, canvasDrawn, }, viewportCurrent, hostMounted = () => true) {
39
+ return isMinimized || fetchInert || viewportEmpty
40
+ ? 'ready'
41
+ : fetchCanceled
42
+ ? 'canceled'
43
+ : isLoading ||
44
+ awaitingDependentData ||
45
+ (rendersCanvas && hostMounted() && !canvasDrawn) ||
46
+ !viewportCurrent()
47
+ ? 'loading'
48
+ : 'ready';
79
49
  }
80
50
  /**
81
51
  * The same ranking minus `renderError`, for a display with no rendering backend
82
- * to fail (arc's main-thread SVG). `computeDisplayPhase` delegates here rather
83
- * than restating the tail, so there is still exactly one place the order lives —
84
- * and the narrower return type is what lets `DisplayStatusChrome` accept a
85
- * backend-less display without either a cast or a dead branch.
86
- *
87
- * `loading` is a thunk here for the same reason as above.
52
+ * to fail (arc's main-thread SVG). `computeDisplayPhase` delegates here, so the
53
+ * order lives in one place.
88
54
  */
89
- export function computeDisplayStatusPhase({ regionTooLarge, error }, loading) {
90
- return regionTooLarge
91
- ? 'tooLarge'
92
- : error
93
- ? 'error'
94
- : loading()
95
- ? 'loading'
96
- : 'ready';
55
+ export function computeDisplayStatusPhase({ regionTooLarge, error }, activity) {
56
+ return regionTooLarge ? 'tooLarge' : error ? 'error' : activity();
97
57
  }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * A per-key encode memo over a display's cell map: `encode` runs for a key
3
+ * when its data reference moves, every key re-encodes when `inputs` yields a
4
+ * new identity, and a departed key is dropped. `inputs` runs through a
5
+ * `computed`, so a getter that allocates a fresh object per read re-encodes
6
+ * only when what it read changed.
7
+ *
8
+ * The returned map is a new instance whenever an entry moved and the same one
9
+ * otherwise, so an MST view holding it invalidates its observers exactly when
10
+ * a cell did. `installUpload` runs its `encode` path on this; a display that
11
+ * needs the encoded map itself — for a hit test, an SVG export — holds one in
12
+ * a `.views` closure and hands the installer identity cells.
13
+ */
14
+ export declare function createEncodeMemo<K, Data, Props, Encoded>(cells: () => ReadonlyMap<K, Data>, inputs: (() => Props) | undefined, encode: (data: Data, props: Props, key: K) => Encoded): () => ReadonlyMap<K, Encoded>;
@@ -0,0 +1,48 @@
1
+ import { computed } from 'mobx';
2
+ /**
3
+ * A per-key encode memo over a display's cell map: `encode` runs for a key
4
+ * when its data reference moves, every key re-encodes when `inputs` yields a
5
+ * new identity, and a departed key is dropped. `inputs` runs through a
6
+ * `computed`, so a getter that allocates a fresh object per read re-encodes
7
+ * only when what it read changed.
8
+ *
9
+ * The returned map is a new instance whenever an entry moved and the same one
10
+ * otherwise, so an MST view holding it invalidates its observers exactly when
11
+ * a cell did. `installUpload` runs its `encode` path on this; a display that
12
+ * needs the encoded map itself — for a hit test, an SVG export — holds one in
13
+ * a `.views` closure and hands the installer identity cells.
14
+ */
15
+ export function createEncodeMemo(cells, inputs, encode) {
16
+ const encoded = new Map();
17
+ const encodedFrom = new Map();
18
+ const props = inputs && computed(inputs);
19
+ let lastProps;
20
+ let snapshot = encoded;
21
+ return () => {
22
+ const current = cells();
23
+ const p = props ? props.get() : undefined;
24
+ if (p !== lastProps) {
25
+ lastProps = p;
26
+ encodedFrom.clear();
27
+ }
28
+ let changed = false;
29
+ for (const [key, data] of current) {
30
+ if (encodedFrom.get(key) !== data) {
31
+ encoded.set(key, encode(data, p, key));
32
+ encodedFrom.set(key, data);
33
+ changed = true;
34
+ }
35
+ }
36
+ for (const key of encoded.keys()) {
37
+ if (!current.has(key)) {
38
+ encoded.delete(key);
39
+ encodedFrom.delete(key);
40
+ changed = true;
41
+ }
42
+ }
43
+ if (changed) {
44
+ snapshot = new Map(encoded);
45
+ }
46
+ return snapshot;
47
+ };
48
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Flagged rather than matched by message or `instanceof`, so the error UI can
3
+ * offer the remedy specific to a loss (switch the page to Canvas2D) without
4
+ * offering it for render errors whose remedy differs (an over-allocation says to
5
+ * zoom in).
6
+ *
7
+ * A lost WebGPU device carries the same flag deliberately: the two causes
8
+ * differ, but the remedy on offer — take the page off the GPU — is the same one.
9
+ *
10
+ * React-free, and split out of `useRenderingBackend` for that reason: the HAL
11
+ * raises the surface error below and must not import a hook to do it.
12
+ * `useRenderingBackend` re-exports these, so every existing import site keeps
13
+ * working.
14
+ */
15
+ export declare function createGpuContextLostError(message?: string): Error & {
16
+ gpuContextLost: true;
17
+ };
18
+ export declare function createGpuDeviceLostError(): Error & {
19
+ gpuContextLost: true;
20
+ };
21
+ /**
22
+ * A canvas whose swap-chain image the driver refuses. Distinct from a device
23
+ * loss, because the device is fine and still renders offscreen, and distinct
24
+ * from an over-limit allocation, because zooming in does not fix it. Canvas2D
25
+ * does, which is why this carries the flag that puts that button on the banner.
26
+ */
27
+ export declare function createGpuSurfaceLostError(detail: string): Error & {
28
+ gpuContextLost: true;
29
+ };
30
+ export declare function isGpuContextLostError(error: unknown): error is object & Record<"gpuContextLost", unknown>;
@@ -0,0 +1,40 @@
1
+ const CONTEXT_LOST_MESSAGE = 'WebGL context lost. The browser reclaimed the GPU context for this display, ' +
2
+ 'usually because too many GPU-rendered views are open at once.';
3
+ const DEVICE_LOST_MESSAGE = 'WebGPU device lost. The GPU device backing this display went away and kept ' +
4
+ 'going away after several attempts to rebuild on a fresh one.';
5
+ const SURFACE_LOST_MESSAGE = 'WebGPU could not give this display a drawable surface. The GPU driver ' +
6
+ 'rejected the canvas image, so every frame this display submits is discarded.';
7
+ /**
8
+ * Flagged rather than matched by message or `instanceof`, so the error UI can
9
+ * offer the remedy specific to a loss (switch the page to Canvas2D) without
10
+ * offering it for render errors whose remedy differs (an over-allocation says to
11
+ * zoom in).
12
+ *
13
+ * A lost WebGPU device carries the same flag deliberately: the two causes
14
+ * differ, but the remedy on offer — take the page off the GPU — is the same one.
15
+ *
16
+ * React-free, and split out of `useRenderingBackend` for that reason: the HAL
17
+ * raises the surface error below and must not import a hook to do it.
18
+ * `useRenderingBackend` re-exports these, so every existing import site keeps
19
+ * working.
20
+ */
21
+ export function createGpuContextLostError(message = CONTEXT_LOST_MESSAGE) {
22
+ return Object.assign(new Error(message), {
23
+ gpuContextLost: true,
24
+ });
25
+ }
26
+ export function createGpuDeviceLostError() {
27
+ return createGpuContextLostError(DEVICE_LOST_MESSAGE);
28
+ }
29
+ /**
30
+ * A canvas whose swap-chain image the driver refuses. Distinct from a device
31
+ * loss, because the device is fine and still renders offscreen, and distinct
32
+ * from an over-limit allocation, because zooming in does not fix it. Canvas2D
33
+ * does, which is why this carries the flag that puts that button on the banner.
34
+ */
35
+ export function createGpuSurfaceLostError(detail) {
36
+ return createGpuContextLostError(`${SURFACE_LOST_MESSAGE} (${detail})`);
37
+ }
38
+ export function isGpuContextLostError(error) {
39
+ return (typeof error === 'object' && error !== null && 'gpuContextLost' in error);
40
+ }