graview 0.1.66 → 0.1.68

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 (197) hide show
  1. package/dist/preview/{chunk.OJY7VJ7D.js → chunk.2BMZPALF.js} +1 -1
  2. package/dist/preview/{chunk.OTV5XTBB.js → chunk.2KCDLCB2.js} +1 -1
  3. package/dist/preview/{chunk.WVLEGCRI.js → chunk.2ME4DVBI.js} +1 -1
  4. package/dist/preview/chunk.2TUEBU7X.js +8 -0
  5. package/dist/preview/{chunk.QHMHUL6B.js → chunk.2U6HB4XU.js} +1 -1
  6. package/dist/preview/{chunk.ZQR2SN65.js → chunk.32JE2WS7.js} +1 -1
  7. package/dist/preview/{chunk.OEIWIZCP.js → chunk.3DEWQDP7.js} +1 -1
  8. package/dist/preview/{chunk.2VR7YEJ6.js → chunk.3JMQKANL.js} +1 -1
  9. package/dist/preview/chunk.3VEZ5MOC.js +25 -0
  10. package/dist/preview/chunk.3WPCS6KP.js +1 -0
  11. package/dist/preview/{chunk.FXT5CN32.js → chunk.42C3FIKK.js} +1 -1
  12. package/dist/preview/{chunk.QQAZQDRW.js → chunk.42KHFGN6.js} +1 -1
  13. package/dist/preview/{chunk.ANS2IEEV.js → chunk.4DXPPM6T.js} +1 -1
  14. package/dist/preview/chunk.4GVKKBQL.js +1 -0
  15. package/dist/preview/{chunk.5CXIEYHY.js → chunk.4TT3ZHSJ.js} +2 -2
  16. package/dist/preview/{chunk.OMT4QUZY.js → chunk.4YAO3A5Q.js} +4 -4
  17. package/dist/preview/{chunk.M2JCFNHJ.js → chunk.5JKUT2OM.js} +1 -1
  18. package/dist/preview/chunk.5L4ADKTW.js +1 -0
  19. package/dist/preview/{chunk.YNEHJWJV.js → chunk.64LCHHZB.js} +1 -1
  20. package/dist/preview/{chunk.6HY6ZGEE.js → chunk.6AANHELP.js} +1 -1
  21. package/dist/preview/{chunk.6TLXFMX2.js → chunk.6DMCEBSO.js} +1 -1
  22. package/dist/preview/{chunk.IWYMKGZZ.js → chunk.6IR5LBJU.js} +1 -1
  23. package/dist/preview/{chunk.YIPXZUTT.js → chunk.6WB2TYK7.js} +1 -1
  24. package/dist/preview/chunk.6ZENHSTQ.js +1 -0
  25. package/dist/preview/{chunk.7ZKBYXUM.js → chunk.7K2V5FUB.js} +1 -1
  26. package/dist/preview/chunk.7OL6H4LF.js +1 -0
  27. package/dist/preview/{chunk.FBILPNGH.js → chunk.7TDML5YU.js} +1 -1
  28. package/dist/preview/{chunk.45JP6VGJ.js → chunk.7WPVLEX2.js} +2 -2
  29. package/dist/preview/{chunk.W4YDPHCQ.js → chunk.7ZTGB4O7.js} +1 -1
  30. package/dist/preview/{chunk.4FDVINRJ.js → chunk.ACNOP2IU.js} +1 -1
  31. package/dist/preview/{chunk.AK7NGFEX.js → chunk.AENP662H.js} +1 -1
  32. package/dist/preview/{chunk.MWGZKZD6.js → chunk.AQ2PI6MR.js} +1 -1
  33. package/dist/preview/chunk.ARS4HJD2.js +1 -0
  34. package/dist/preview/{chunk.FDZE5LTJ.js → chunk.AWV57UBJ.js} +2 -2
  35. package/dist/preview/{chunk.C2C3AXGI.js → chunk.AYZL3LCR.js} +3 -3
  36. package/dist/preview/{chunk.FIFUMX5X.js → chunk.BHJRT57H.js} +1 -1
  37. package/dist/preview/{chunk.IAEHUSQQ.js → chunk.BPNW5KCP.js} +1 -1
  38. package/dist/preview/{chunk.HOCD7KIR.js → chunk.BQAFFEOA.js} +1 -1
  39. package/dist/preview/chunk.C2QKA6XY.js +1 -0
  40. package/dist/preview/{chunk.NJRLJEJY.js → chunk.CE3NKAF7.js} +1 -1
  41. package/dist/preview/{chunk.5LJVOLKR.js → chunk.CFE3MHWZ.js} +1 -1
  42. package/dist/preview/{chunk.DQFHIJFN.js → chunk.CGBOPPNL.js} +1 -1
  43. package/dist/preview/{chunk.V7W5AQKL.js → chunk.CNN32262.js} +1 -1
  44. package/dist/preview/{chunk.6EHHMWPP.js → chunk.DCLF4WWZ.js} +1 -1
  45. package/dist/preview/{chunk.OO2OP76C.js → chunk.DGDW54KE.js} +1 -1
  46. package/dist/preview/{chunk.XMQG2PSM.js → chunk.DLSS56EU.js} +1 -1
  47. package/dist/preview/{chunk.WSO7JOW5.js → chunk.DMZRFXH7.js} +1 -1
  48. package/dist/preview/{chunk.DEHIR4EG.js → chunk.DPHH5ZVL.js} +1 -1
  49. package/dist/preview/{chunk.XOE4KNP2.js → chunk.DZ6UDZOB.js} +2 -2
  50. package/dist/preview/{chunk.WAB3L3ZI.js → chunk.E423JCOS.js} +1 -1
  51. package/dist/preview/{chunk.CTASTRQN.js → chunk.EB7PZJEO.js} +1 -1
  52. package/dist/preview/{chunk.QPF4KSAW.js → chunk.ECNGVD25.js} +1 -1
  53. package/dist/preview/{chunk.JXNVNFV4.js → chunk.EGSOHTZZ.js} +1 -1
  54. package/dist/preview/{chunk.CEVGND3Y.js → chunk.EGVM24ND.js} +3 -3
  55. package/dist/preview/{chunk.6LXIEM6B.js → chunk.ENLIIZF2.js} +1 -1
  56. package/dist/preview/{chunk.GME63ZHI.js → chunk.EP5JS7ZH.js} +1 -1
  57. package/dist/preview/{chunk.QGIM2WAY.js → chunk.F5GNNVSQ.js} +1 -1
  58. package/dist/preview/chunk.FHQ25SWY.js +1 -0
  59. package/dist/preview/{chunk.OOSIKCOS.js → chunk.FSW535EA.js} +1 -1
  60. package/dist/preview/{chunk.ZD7T234N.js → chunk.FZELUSK5.js} +1 -1
  61. package/dist/preview/{chunk.LINSO5PN.js → chunk.G2BDEWJC.js} +1 -1
  62. package/dist/preview/chunk.GF3ZCX46.js +2 -0
  63. package/dist/preview/{chunk.J7W2OFHY.js → chunk.GJTEV6CK.js} +1 -1
  64. package/dist/preview/{chunk.VKZIEZ5C.js → chunk.GKTQ5CZA.js} +2 -2
  65. package/dist/preview/{chunk.GEFXU4VO.js → chunk.GONZB3J3.js} +1 -1
  66. package/dist/preview/{chunk.VGHO3VCB.js → chunk.GRBWXTST.js} +1 -1
  67. package/dist/preview/{chunk.YXEO3Y65.js → chunk.GRTBEA7O.js} +1 -1
  68. package/dist/preview/chunk.H3IGXHZR.js +93 -0
  69. package/dist/preview/{chunk.QFHWG4LN.js → chunk.H3W5C3XQ.js} +1 -1
  70. package/dist/preview/{chunk.TGEL6EUA.js → chunk.H4VNIAHN.js} +1 -1
  71. package/dist/preview/{chunk.IGK7EZCX.js → chunk.HH4D3JEI.js} +1 -1
  72. package/dist/preview/{chunk.F4VB6Q2W.js → chunk.HWFJQ42Y.js} +1 -1
  73. package/dist/preview/{chunk.OWFS2YDQ.js → chunk.HXTKBISQ.js} +1 -1
  74. package/dist/preview/{chunk.ZR2TP3BF.js → chunk.I34BWUB4.js} +1 -1
  75. package/dist/preview/{chunk.EXYCN4WI.js → chunk.I63462I3.js} +1 -1
  76. package/dist/preview/{chunk.7VADSNPZ.js → chunk.IKKKHHRN.js} +1 -1
  77. package/dist/preview/{chunk.FK722SHI.js → chunk.IPGLITWA.js} +1 -1
  78. package/dist/preview/{chunk.BXBEGMPO.js → chunk.IT5DVKXY.js} +2 -2
  79. package/dist/preview/{chunk.LLIURXFP.js → chunk.IXMIU4D4.js} +1 -1
  80. package/dist/preview/{chunk.INHS3KTK.js → chunk.JCETQQ7J.js} +1 -1
  81. package/dist/preview/{chunk.PPSYUOH7.js → chunk.JGRSUTPJ.js} +1 -1
  82. package/dist/preview/{chunk.4U4D7WOI.js → chunk.JLDJZET2.js} +1 -1
  83. package/dist/preview/{chunk.Z7Y3R3YR.js → chunk.JULD4XFB.js} +1 -1
  84. package/dist/preview/{chunk.PAGEGBUD.js → chunk.JV432T4Q.js} +1 -1
  85. package/dist/preview/{chunk.4FCFNAA4.js → chunk.KAM73WVF.js} +1 -1
  86. package/dist/preview/{chunk.6P6NGZ6D.js → chunk.KUCBNMIY.js} +1 -1
  87. package/dist/preview/{chunk.I2737CPF.js → chunk.L7XKYGV7.js} +1 -1
  88. package/dist/preview/{chunk.7VP6Y6D2.js → chunk.LFFJB6D3.js} +1 -1
  89. package/dist/preview/{chunk.BFAFCVL4.js → chunk.LMTG5NPG.js} +1 -1
  90. package/dist/preview/{chunk.QOS5T46W.js → chunk.LOKGUALC.js} +1 -1
  91. package/dist/preview/chunk.LZ6MSQ5O.js +1 -0
  92. package/dist/preview/chunk.MBTEOF4R.js +1 -0
  93. package/dist/preview/{chunk.PFQBCHQA.js → chunk.MIOLBZBS.js} +1 -1
  94. package/dist/preview/{chunk.PDDIQ6PK.js → chunk.MK5RPEB2.js} +1 -1
  95. package/dist/preview/{chunk.FV72U33M.js → chunk.MKL4THIV.js} +1 -1
  96. package/dist/preview/{chunk.2MHNPBHC.js → chunk.MPWLDQOG.js} +1 -1
  97. package/dist/preview/chunk.MSUZAJ2K.js +4 -0
  98. package/dist/preview/{chunk.EMFOMSMI.js → chunk.N5Z34V7U.js} +1 -1
  99. package/dist/preview/chunk.N64RVSH3.js +1 -0
  100. package/dist/preview/{chunk.5B5SRTUK.js → chunk.ND3DEDWB.js} +1 -1
  101. package/dist/preview/{chunk.3L4JMM3P.js → chunk.NFTPJAMJ.js} +1 -1
  102. package/dist/preview/{chunk.J2MM6BUW.js → chunk.NRCWMYLH.js} +1 -1
  103. package/dist/preview/{chunk.OPTYYIGC.js → chunk.O2VXTYUJ.js} +1 -1
  104. package/dist/preview/{chunk.4AC2QM7T.js → chunk.O32F6LGK.js} +1 -1
  105. package/dist/preview/{chunk.W53YNBSM.js → chunk.O5FTWXA2.js} +1 -1
  106. package/dist/preview/{chunk.U6TEW6YD.js → chunk.ODYJEDIW.js} +1 -1
  107. package/dist/preview/{chunk.E7EWNWAN.js → chunk.OQ4ZO3YY.js} +1 -1
  108. package/dist/preview/chunk.PI4RFOBU.js +1 -0
  109. package/dist/preview/{chunk.BMENTGDC.js → chunk.PIMAG4WT.js} +2 -2
  110. package/dist/preview/{chunk.DTCAUPLC.js → chunk.PLIV3IQK.js} +1 -1
  111. package/dist/preview/{chunk.4JULYKGD.js → chunk.PPCDPYYU.js} +1 -1
  112. package/dist/preview/{chunk.BGAC3B7X.js → chunk.PZQ5P6WK.js} +1 -1
  113. package/dist/preview/chunk.Q42R2KW4.js +1 -0
  114. package/dist/preview/{chunk.2KFZHUAC.js → chunk.Q4VFLLUT.js} +1 -1
  115. package/dist/preview/{chunk.ONYBW45K.js → chunk.Q6H5HESF.js} +1 -1
  116. package/dist/preview/chunk.QM54TGU6.js +3 -0
  117. package/dist/preview/{chunk.6MQ5NT7S.js → chunk.QOQ26NXM.js} +1 -1
  118. package/dist/preview/{chunk.FFOD5B4B.js → chunk.QUETLFBJ.js} +1 -1
  119. package/dist/preview/{chunk.DSYP43NN.js → chunk.QWLK3GKG.js} +1 -1
  120. package/dist/preview/{chunk.RWIN3POV.js → chunk.QYPU444Y.js} +1 -1
  121. package/dist/preview/{chunk.ES63XSIM.js → chunk.QZP3ARLH.js} +1 -1
  122. package/dist/preview/{chunk.CVPMSPCH.js → chunk.R3GE37OI.js} +1 -1
  123. package/dist/preview/chunk.R66ZVMWB.js +1 -0
  124. package/dist/preview/chunk.RD2FSSLV.js +1 -0
  125. package/dist/preview/{chunk.72ZCLEQC.js → chunk.RQG672MJ.js} +1 -1
  126. package/dist/preview/chunk.RYA7A4NA.js +1 -0
  127. package/dist/preview/{chunk.BUVTUAB5.js → chunk.SADR3MQI.js} +1 -1
  128. package/dist/preview/{chunk.EQ4OODGO.js → chunk.SS6KL5NT.js} +1 -1
  129. package/dist/preview/chunk.SUG6LIOX.js +1 -0
  130. package/dist/preview/{chunk.WSDJPXJD.js → chunk.TFJA4QV4.js} +1 -1
  131. package/dist/preview/{chunk.3PBTN7RO.js → chunk.TOUSIUJF.js} +1 -1
  132. package/dist/preview/{chunk.CU2WCYMK.js → chunk.TR4YFVZN.js} +1 -1
  133. package/dist/preview/{chunk.GNEOSHQ6.js → chunk.TRNJKHIA.js} +1 -1
  134. package/dist/preview/{chunk.72XP2ARZ.js → chunk.TVWK3SGD.js} +1 -1
  135. package/dist/preview/chunk.U7PAFLUM.js +1 -0
  136. package/dist/preview/{chunk.QU52E5RG.js → chunk.UAMPR4MD.js} +1 -1
  137. package/dist/preview/{chunk.KBPJ7X7W.js → chunk.UD7VLXPM.js} +1 -1
  138. package/dist/preview/{chunk.M6ZN2KUO.js → chunk.UFURYU4R.js} +1 -1
  139. package/dist/preview/{chunk.6FQW6FNL.js → chunk.UODTUBQ7.js} +1 -1
  140. package/dist/preview/{chunk.KHRS2SKB.js → chunk.VBHV4TLG.js} +1 -1
  141. package/dist/preview/{chunk.KSIEO5W7.js → chunk.VES4XMZX.js} +1 -1
  142. package/dist/preview/chunk.VLXLBGMY.js +90 -0
  143. package/dist/preview/{chunk.QWNSHISU.js → chunk.VTDOWXCP.js} +1 -1
  144. package/dist/preview/{chunk.5FNFRVTL.js → chunk.VV5JAM5W.js} +1 -1
  145. package/dist/preview/{chunk.DZFM6GSY.js → chunk.VW632VNJ.js} +1 -1
  146. package/dist/preview/{chunk.LSN2IPAI.js → chunk.WC5WE34A.js} +1 -1
  147. package/dist/preview/chunk.WN7SAAH6.js +1 -0
  148. package/dist/preview/{chunk.B6JRTW3A.js → chunk.WV45KLXC.js} +1 -1
  149. package/dist/preview/{chunk.TXHYGFIZ.js → chunk.XDZDNZ7B.js} +1 -1
  150. package/dist/preview/{chunk.7BIPZTJB.js → chunk.XFH6GHBQ.js} +1 -1
  151. package/dist/preview/{chunk.HSSIMVVM.js → chunk.XRE7SHLD.js} +1 -1
  152. package/dist/preview/{chunk.LETAQTLJ.js → chunk.XXCHO2A5.js} +1 -1
  153. package/dist/preview/{chunk.KACSYPEV.js → chunk.Y7OGJOPA.js} +1 -1
  154. package/dist/preview/{chunk.LGRVEHXT.js → chunk.YBQ5GVAX.js} +2 -2
  155. package/dist/preview/{chunk.PSQYDCVM.js → chunk.YL2RBZFE.js} +1 -1
  156. package/dist/preview/{chunk.BZ7QWHAE.js → chunk.YM6SWEUI.js} +1 -1
  157. package/dist/preview/{chunk.CBXS23YH.js → chunk.Z2X7BFCB.js} +2 -2
  158. package/dist/preview/{chunk.U3ED7W2U.js → chunk.Z67LBSQO.js} +1 -1
  159. package/dist/preview/chunk.ZKXIZBCN.js +1 -0
  160. package/dist/preview/{chunk.E3UL4MCD.js → chunk.ZLEBOR5T.js} +1 -1
  161. package/dist/preview/{chunk.5BX66FBP.js → chunk.ZLNUZ6LR.js} +1 -1
  162. package/dist/preview/chunk.ZMADWPJO.js +1 -0
  163. package/dist/preview/chunk.ZO6VMEPP.js +1 -0
  164. package/dist/preview/chunk.ZUG7U7AT.js +1 -0
  165. package/dist/preview/index.html +56 -56
  166. package/dist/preview/page.js +2 -2
  167. package/package.json +6 -6
  168. package/dist/preview/chunk.4WGYUYWU.js +0 -2
  169. package/dist/preview/chunk.5EMIWORS.js +0 -1
  170. package/dist/preview/chunk.6EVMXBNB.js +0 -1
  171. package/dist/preview/chunk.BCQWAFGD.js +0 -1
  172. package/dist/preview/chunk.BOCVLC7X.js +0 -1
  173. package/dist/preview/chunk.DPJNGFEZ.js +0 -4
  174. package/dist/preview/chunk.E4VRRWFP.js +0 -1
  175. package/dist/preview/chunk.EUAO4QNV.js +0 -1
  176. package/dist/preview/chunk.F7672TKJ.js +0 -1
  177. package/dist/preview/chunk.FA42HCPW.js +0 -1
  178. package/dist/preview/chunk.FBJAQPZ6.js +0 -1
  179. package/dist/preview/chunk.GAFMWOME.js +0 -1
  180. package/dist/preview/chunk.I4Z7HVRT.js +0 -1
  181. package/dist/preview/chunk.JMXXA4YG.js +0 -1
  182. package/dist/preview/chunk.JMYUQNXN.js +0 -6
  183. package/dist/preview/chunk.K6DFXDPZ.js +0 -1
  184. package/dist/preview/chunk.KF27ME27.js +0 -1
  185. package/dist/preview/chunk.L25DCT5S.js +0 -1
  186. package/dist/preview/chunk.MODLZJD4.js +0 -25
  187. package/dist/preview/chunk.OJGHDWI6.js +0 -1
  188. package/dist/preview/chunk.SSF47GUY.js +0 -1
  189. package/dist/preview/chunk.T6DPWW2K.js +0 -3
  190. package/dist/preview/chunk.TA36WBHK.js +0 -1
  191. package/dist/preview/chunk.TTGKX7LT.js +0 -1
  192. package/dist/preview/chunk.U3HERHAI.js +0 -88
  193. package/dist/preview/chunk.V5I4GZEY.js +0 -1
  194. package/dist/preview/chunk.VT2YGDK2.js +0 -1
  195. package/dist/preview/chunk.XK65Y2KX.js +0 -1
  196. package/dist/preview/chunk.Z274CL7J.js +0 -1
  197. package/dist/preview/chunk.ZBVYD4OX.js +0 -90
@@ -1,90 +0,0 @@
1
- import{a as k,b as A,c as L,d as _,e as E,r as B,s as V,t as H,u as N,v as q}from"./chunk.OJGHDWI6.js";import"./chunk.6HY6ZGEE.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var W=["drawElementImageToTexture","copyElementImageToTexture"],S=null,P=(r,e)=>r==="texture"?{texture:e}:{destination:{texture:e}};function Z(){return typeof globalThis>"u"?void 0:globalThis}function v(r,e){let t=[],n=Z(),o=!!(n?.navigator&&"gpu"in n.navigator);o||t.push("navigator.gpu is absent \u2014 WebGPU is unavailable.");let i=r??n?.GPUQueue?.prototype??void 0,a=null;if(i){for(let d of W)if(typeof i[d]=="function"){a=d;break}}a||t.push("No element-capture method on GPUQueue. Run Chromium 147+ with --enable-blink-features=CanvasDrawElement.");let c=e??n?.HTMLCanvasElement?.prototype??void 0,l=typeof c?.updateElementGeometry=="function";l||t.push("canvas.updateElementGeometry is absent \u2014 geometry cannot be reported.");let p=typeof c?.requestPaint=="function";p||t.push("canvas.requestPaint is absent \u2014 there is no capture-safe moment to hook.");let w=!1,h="unknown";if(typeof document<"u"){let d=document.createElement("canvas");w="layoutSubtree"in d||typeof d.captureElementImage=="function","layoutSubtree"in d?h="no":typeof d.captureElementImage=="function"&&(h="yes")}return{available:a!==null,captureMethod:a,geometrySync:l,hitTestFollowsGeometry:l?h:"no",layoutSubtree:w,paintEvents:p,webgpu:o,usable:o&&a!==null,notes:t}}var g=class extends Error{constructor(t){super(`HTML-in-Canvas is unavailable:
2
- ${t.notes.join(`
3
- `)}`);this.capabilities=t;this.name="PlatformUnavailableError"}};function G(r,e,t){let n=r;for(let o of W){let i=n[o];if(typeof i=="function"){if(S){i.call(n,{source:e},P(S,t));return}try{i.call(n,{source:e},P("texture",t)),S="texture"}catch(a){if(!(a instanceof TypeError)||!/texture/i.test(a.message))throw a;i.call(n,{source:e},P("destination",t)),S="destination"}return}}throw new g(v(r))}function M(r,e=!0){e?r.setAttribute("drawable",""):r.removeAttribute("drawable")}function F(r){let e=r.changedElements;return e?new Set(Array.from(e)):null}function ee(r,e){let t=r;if(typeof t.captureElementImage!="function")throw new g(v(void 0,r));return t.captureElementImage(e)}function O(r,e,t){let n=r;if(typeof n.updateElementGeometry!="function")throw new g(v(void 0,r));n.updateElementGeometry(e,t)}function te(r,e){r.clearElementGeometry?.(e)}function m(r){r.requestPaint?.()}function D(r,e=!0){let t=r;e?t.setAttribute("content","drawable"):t.removeAttribute("content"),"layoutSubtree"in t?t.layoutSubtree=e:e?t.setAttribute("layoutsubtree",""):t.removeAttribute("layoutsubtree")}var I=`
4
- struct Plane {
5
- // x, y, width, height in canvas pixels, after the plane transform.
6
- rect: vec4f,
7
- // blur radius in texels, contrast falloff 0..1, shadow strength (cast by
8
- // the view's own panel, so unused here), and the view's own opacity \u2014 which is how a node entering or leaving the scene
9
- // fades rather than popping.
10
- style: vec4f,
11
- // canvas size in pixels, and the ground color's rgb packed as xyz.
12
- canvas: vec4f,
13
- ground: vec4f,
14
- }
15
-
16
- @group(0) @binding(0) var<uniform> plane: Plane;
17
- @group(0) @binding(1) var view_texture: texture_2d<f32>;
18
- @group(0) @binding(2) var view_sampler: sampler;
19
-
20
- struct VertexOut {
21
- @builtin(position) position: vec4f,
22
- @location(0) uv: vec2f,
23
- }
24
-
25
- @vertex
26
- fn vs_main(@builtin(vertex_index) index: u32) -> VertexOut {
27
- // Two triangles, no vertex buffer: the quad is entirely a function of the
28
- // plane rect, so nothing has to be uploaded per frame except the uniform.
29
- var corners = array<vec2f, 6>(
30
- vec2f(0.0, 0.0), vec2f(1.0, 0.0), vec2f(0.0, 1.0),
31
- vec2f(0.0, 1.0), vec2f(1.0, 0.0), vec2f(1.0, 1.0),
32
- );
33
- let corner = corners[index];
34
- let pixel = plane.rect.xy + corner * plane.rect.zw;
35
- // Canvas pixels to clip space, y down.
36
- let ndc = vec2f(
37
- pixel.x / plane.canvas.x * 2.0 - 1.0,
38
- 1.0 - pixel.y / plane.canvas.y * 2.0,
39
- );
40
- var out: VertexOut;
41
- out.position = vec4f(ndc, 0.0, 1.0);
42
- out.uv = corner;
43
- return out;
44
- }
45
-
46
- fn blurred(uv: vec2f, radius: f32) -> vec4f {
47
- if (radius <= 0.0) {
48
- return textureSample(view_texture, view_sampler, uv);
49
- }
50
- let size = vec2f(textureDimensions(view_texture, 0));
51
- let step = radius / size;
52
- var sum = vec4f(0.0);
53
- var weight = 0.0;
54
- // A 9-tap kernel: enough to read as depth-of-field at plane scale, cheap
55
- // enough to run on every capture every frame.
56
- for (var y = -1; y <= 1; y = y + 1) {
57
- for (var x = -1; x <= 1; x = x + 1) {
58
- let offset = vec2f(f32(x), f32(y)) * step;
59
- let w = select(1.0, 2.0, x == 0 && y == 0);
60
- sum = sum + textureSample(view_texture, view_sampler, uv + offset) * w;
61
- weight = weight + w;
62
- }
63
- }
64
- return sum / weight;
65
- }
66
-
67
- @fragment
68
- fn fs_main(in: VertexOut) -> @location(0) vec4f {
69
- let radius = plane.style.x;
70
- let falloff = plane.style.y;
71
- let opacity = plane.style.w;
72
-
73
- let color = blurred(in.uv, radius);
74
-
75
- // Recession dims the view toward whatever is under it \u2014 the ground \u2014 by
76
- // the same share the DOM path's \`opacity\` does (\`recededOpacity\`), and
77
- // the plane's shadow is the view's own panel, captured with it. Mixing
78
- // toward a fixed ground color and darkening the quad's edges here drew a
79
- // different picture from the DOM path's: gray bands down a light card,
80
- // and haze of the wrong color in the other scheme.
81
- let alpha = opacity * (1.0 - falloff * 0.55);
82
-
83
- // A capture arrives with STRAIGHT alpha and the canvas composites
84
- // premultiplied, so the color is multiplied by its own alpha here, once.
85
- // Without it a panel's soft shadow \u2014 dark at a low alpha \u2014 came out
86
- // lighter than the ground it fell on.
87
- let a = color.a * alpha;
88
- return vec4f(color.rgb * a, a);
89
- }
90
- `;var j=64,T=256,z=T/4,Q=64,b=class{constructor(e,t,n={}){this.canvas=e;this.deps=t;this.options=n;D(e,!0),this.blur=n.blur??!0,this.scheme=n.scheme??"dark",this.capabilities=v(t.gpu.device.gpu.queue,e);let o=n.platformHandlesHitTesting??this.capabilities.hitTestFollowsGeometry==="yes";this.router=new N(e,{platformHandlesHitTesting:o}),e.setAttribute("data-graview-hit",o?"platform":"router")}views=new Map;idOf=new WeakMap;resources=new Map;capturedAt={};uniforms=null;staging=new Float32Array(0);slotCount=0;nextSlot=0;freeSlots=[];reported=new Map;router;pipeline=null;sampler=null;frame=0;detachRouter=null;connectors=[];lastPlan=null;lastPlacements=[];blur;scheme;capabilities;attach(){return this.detachRouter=this.router.attach(),()=>this.detach()}detach(){this.detachRouter?.(),this.detachRouter=null}reconcile(e){let t=new Map(e.map(n=>[n.id,n]));for(let n of[...this.views.keys()])t.has(n)||this.remove(n);for(let n of e){let o=this.views.get(n.id);if(!o){this.add(n);continue}let i=o.width!==n.width||o.height!==n.height,a=o.element!==n.element||(o.dom??!1)!==(n.dom??!1);a&&this.track(n);let c=(o.opacity??1)!==(n.opacity??1),l=o.dirty||n.dirty===!0||i||a||c;this.views.set(n.id,{...n,dirty:l}),(a||i)&&delete this.capturedAt[n.id]}}add(e){if(!e.dom&&e.element.parentElement!==this.canvas)throw new Error(`View "${e.id}" must be an immediate child of the scene canvas \u2014 the capture API rejects deeper descendants. Nest inside a view, never between views.`);this.track(e),this.views.set(e.id,{...e,dirty:!0})}track(e){this.idOf.set(e.element,e.id),e.dom||M(e.element)}remove(e){let t=this.resources.get(e);t?.texture.destroy(),t&&this.freeSlots.push(t.slot),this.resources.delete(e),this.reported.delete(e),this.views.delete(e),delete this.capturedAt[e]}setBlur(e){this.blur=e}setScheme(e){this.scheme=e}setConnectors(e){this.connectors=e}invalidate(e){let t=this.views.get(e);t&&this.views.set(e,{...t,dirty:!0})}all(){return[...this.views.values()]}plan(){return this.lastPlan}placements(){return this.lastPlacements}deviceForProbe(){return this.deps.gpu.device.gpu}scheduleFrame(){m(this.canvas)}paint(e){return this.render(F(e))}render(e){let t=this.deps.gpu.device.gpu,n=t.queue;this.frame+=1;let o=this.canvas.width,i=this.canvas.height,a;if(e){a=new Set;for(let u of e){let s=this.idOf.get(u);s!==void 0&&a.add(s)}}let c=a?new Set(a):null,l=V([...this.views.values()],this.connectors,{canvasWidth:o,canvasHeight:i,capturedAt:this.capturedAt,captureBudget:this.options.captureBudget??B,scheme:this.scheme,...a?{changed:a}:{},...this.options.connectorOverrides?{connectorOverrides:this.options.connectorOverrides}:{}});this.lastPlan=l;let p=[];for(let u of l.captures){let s=this.views.get(u.viewId);if(!s)continue;let y=this.ensureResources(t,s);try{G(n,s.element,y.texture)}catch(f){if(!(f instanceof DOMException&&f.name==="InvalidStateError"))throw f;this.capturedAt[s.id]===void 0&&p.push(s.id),s.dirty||this.views.set(s.id,{...s,dirty:!0});continue}this.capturedAt[s.id]=this.frame,this.views.set(s.id,{...s,dirty:!1}),a?.delete(s.id)}for(let u of[...a??[],...l.deferred]){let s=this.views.get(u);s&&!s.dirty&&this.views.set(u,{...s,dirty:!0})}let w=t.createCommandEncoder({label:"graview-compositor"}),h=w.beginRenderPass({colorAttachments:[{view:this.deps.surface.context.getCurrentTexture().createView(),clearValue:this.options.transparent?{r:0,g:0,b:0,a:0}:this.groundColor(),loadOp:"clear",storeOp:"store"}]});h.setPipeline(this.ensurePipeline(t));let d=this.options.ground??[.957,.949,.933],U=[],x=-1;for(let u of l.draws){if(p.includes(u.viewId))continue;let s=this.resources.get(u.viewId);!s||!this.views.has(u.viewId)||(Y(this.staging,s.slot*z,u,o,i,d,this.blur),s.slot>x&&(x=s.slot),U.push(s))}x>=0&&this.uniforms&&n.writeBuffer(this.uniforms,0,this.staging.buffer,0,(x+1)*T);for(let u of U)h.setBindGroup(0,this.ensureBindGroup(t,u)),h.draw(6);let C=[];for(let u of l.placements){let s=this.views.get(u.viewId);s&&C.push({element:s.element,transform:u.transform,width:u.width,height:u.height,depth:u.depth})}if(h.end(),n.submit([w.finish()]),this.capabilities.geometrySync){let u=[];for(let s of[...l.geometry,...l.offCanvas]){let y=this.views.get(s.viewId);if(!y)continue;let f=s.transform.join(",");this.reported.get(s.viewId)!==f&&u.push({element:y.element,id:s.viewId,key:f,transform:s.transform})}for(let{element:s,id:y,key:f,transform:K}of u.slice(0,Q))O(this.canvas,s,{canvasTransform:E(K)}),this.reported.set(y,f);u.length>Q&&m(this.canvas)}return this.lastPlacements=C,this.router.setPlacements(C),p.length===0?{...l,missed:p,changed:c}:{...l,draws:l.draws.filter(u=>!p.includes(u.viewId)),missed:p,changed:c}}groundColor(){let[e,t,n]=this.options.ground??[.957,.949,.933];return{r:e,g:t,b:n,a:1}}ensurePipeline(e){if(this.pipeline)return this.pipeline;let t=e.createShaderModule({code:I,label:"graview-compositor"});return this.pipeline=e.createRenderPipeline({layout:"auto",vertex:{module:t,entryPoint:"vs_main"},fragment:{module:t,entryPoint:"fs_main",targets:[{format:navigator.gpu.getPreferredCanvasFormat(),blend:{color:{srcFactor:"one",dstFactor:"one-minus-src-alpha"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha"}}}]},primitive:{topology:"triangle-list"}}),this.pipeline}ensureResources(e,t){let n=Math.max(1,Math.ceil(t.width)),o=Math.max(1,Math.ceil(t.height)),i=this.resources.get(t.id);if(i&&i.width===n&&i.height===o)return i;i?.texture.destroy();let a=i?.slot??this.takeSlot(e),l={texture:e.createTexture({size:[n,o],format:"rgba8unorm",usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.RENDER_ATTACHMENT,label:`graview-view-${t.id}`}),width:n,height:o,bindGroup:null,slot:a};return this.resources.set(t.id,l),l}takeSlot(e){let t=this.freeSlots.pop();if(t!==void 0)return t;let n=this.nextSlot++;if(n>=this.slotCount){let o=Math.max(64,this.slotCount*2);this.uniforms?.destroy(),this.uniforms=e.createBuffer({size:o*T,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,label:"graview-planes"});let i=new Float32Array(o*z);i.set(this.staging),this.staging=i,this.slotCount=o;for(let a of this.resources.values())a.bindGroup=null}return n}ensureBindGroup(e,t){return t.bindGroup||(this.sampler??=e.createSampler({magFilter:"linear",minFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}),t.bindGroup=e.createBindGroup({layout:this.ensurePipeline(e).getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:this.uniforms,offset:t.slot*T,size:j}},{binding:1,resource:t.texture.createView()},{binding:2,resource:this.sampler}]})),t.bindGroup}dispose(){this.detach(),this.canvas.removeAttribute("data-graview-hit");for(let e of[...this.resources.keys()])this.remove(e);this.uniforms?.destroy(),this.uniforms=null}};function ne(r,e,t,n,o=!0){let i=new Float32Array(j/4);return Y(i,0,r,e,t,n,o),i}function Y(r,e,t,n,o,i,a){r[e]=t.transform[12],r[e+1]=t.transform[13],r[e+2]=t.width,r[e+3]=t.height,r[e+4]=a?t.blur:0,r[e+5]=t.style.falloff,r[e+6]=t.style.shadow,r[e+7]=t.opacity,r[e+8]=n,r[e+9]=o,r[e+10]=0,r[e+11]=0,r[e+12]=i[0],r[e+13]=i[1],r[e+14]=i[2],r[e+15]=1}var re=3,$=4,X=1500,J=q*.75;function ie(r={}){let e=new WeakMap;return t=>{let n=e.get(t.canvas);(!n||n.disposed)&&(n=new R(t.canvas,r),e.set(t.canvas,n)),n.show(t);let o=n;return()=>o.release()}}var R=class{constructor(e,t){this.canvas=e;this.options=t;this.observer=typeof MutationObserver>"u"?null:new MutationObserver(()=>{this.stale=!0,m(this.canvas)}),this.observer?.observe(e,{childList:!0}),this.start()}disposed=!1;scene=null;compositor=null;ownDevice=null;stale=!0;onDom=new Set;lateFor=new Map;releasing=null;waiting=null;firstFrames=[];gone=!1;observer;onPaint=e=>this.paint(e);show(e){if(this.releasing&&clearTimeout(this.releasing),this.releasing=null,this.scene=e,this.stale=!0,this.compositor?.setBlur(e.blur??!0),e.scheme&&this.compositor?.setScheme(e.scheme),this.gone){e.fallBack?.();return}m(this.canvas)}release(){this.releasing&&clearTimeout(this.releasing),this.releasing=setTimeout(()=>this.dispose(),0)}async start(){try{let e=this.options.gpu;if(!e){let o=await navigator.gpu?.requestAdapter();if(!o)throw new Error("No WebGPU adapter.");let i=await o.requestDevice();this.ownDevice=i,i.lost.then(()=>{this.disposed||this.fallBack()}),e={device:{gpu:i}}}if(this.disposed)return;let t=e.device.gpu;if(!v(t.queue,this.canvas).usable)throw new Error("No element capture.");let n=this.canvas.getContext("webgpu");if(!n)throw new Error("No WebGPU context on the scene canvas.");n.configure({device:t,format:navigator.gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),this.compositor=new b(this.canvas,{gpu:e,surface:{context:n}},{transparent:!0,...this.options,blur:this.scene?.blur??this.options.blur??!0,...this.scene?.scheme?{scheme:this.scene.scheme}:{}}),this.compositor.attach(),this.canvas.addEventListener("paint",this.onPaint),this.stale=!0,this.waiting=setTimeout(()=>this.fallBack(),X),m(this.canvas)}catch{this.fallBack()}}fallBack(){if(this.gone)return;this.gone=!0,this.waiting&&clearTimeout(this.waiting),this.waiting=null,this.canvas.removeEventListener("paint",this.onPaint),this.compositor?.dispose(),this.compositor=null;let e=this.scene;e&&(e.fallBack?e.fallBack():e.drawOnDom?.(new Set(e.layout.nodes.map(t=>t.id))))}checkFirstFrame(e){let t=this.firstFrames;if(!t||(this.waiting&&clearTimeout(this.waiting),this.waiting=null,t.push(e),t.length<$))return;let n=[...t].sort((o,i)=>o-i)[Math.floor(t.length/2)];this.firstFrames=null,n>J&&this.fallBack()}paint(e){let t=this.compositor,n=this.scene;if(!t||!n)return;let o=performance.now(),i;try{this.stale&&(this.stale=!1,t.reconcile(this.views(n))),i=t.paint(e)}catch{this.fallBack();return}if(this.checkFirstFrame(performance.now()-o),this.gone)return;this.options.onFrame?.(i,t);let a=!1,c=new Set(i.deferred);for(let l of[...this.lateFor.keys()])c.has(l)||this.lateFor.delete(l);for(let l of c){if(i.changed&&!i.changed.has(l))continue;let p=(this.lateFor.get(l)??0)+1;this.lateFor.set(l,p),p>=re&&!this.onDom.has(l)&&(this.onDom.add(l),this.lateFor.delete(l),a=!0)}a&&n.drawOnDom?.(new Set(this.onDom)),(i.deferred.length>0||i.missed.length>0)&&m(this.canvas)}views(e){let t=new Map;for(let a of this.canvas.children){let c=a.getAttribute("data-graview-view");c!==null&&t.set(c,a)}let n=new Set,o=[];for(let a of H(e.layout,e.dirty).views){n.add(a.id);let c=t.get(a.id)??e.hostOf(a.id);c&&o.push({...a,element:c,...c.parentElement===this.canvas?{}:{dom:!0}})}let i=!1;for(let a of this.onDom)n.has(a)||(this.onDom.delete(a),i=!0);return i&&e.drawOnDom?.(new Set(this.onDom)),o}dispose(){this.disposed=!0,this.waiting&&clearTimeout(this.waiting),this.waiting=null,this.observer?.disconnect(),this.canvas.removeEventListener("paint",this.onPaint),this.compositor?.dispose(),this.compositor=null,this.ownDevice?.destroy(),this.ownDevice=null}};export{I as COMPOSITOR_WGSL,b as Compositor,$ as FIRST_FRAMES,J as FIRST_FRAME_BUDGET_MS,X as FIRST_PAINT_WAIT_MS,A as IDENTITY,g as PlatformUnavailableError,ie as attachGpu,G as captureElement,ee as captureElementImage,F as changedElementsOf,te as clearElementGeometry,v as detectCapabilities,k as isAffine,M as markDrawable,ne as packUniform,_ as perspectiveProbeMatrix,L as planeTransform,m as requestPaint,D as setLayoutSubtree,E as toDOMMatrix,O as updateElementGeometry};