@jirathip-dev/blocks 0.0.0-stage → 2.2.0

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 (191) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +67 -2
  3. package/package.json +46 -4
  4. package/web/dist/blocks.css +1 -0
  5. package/web/dist/blocks.js +10 -0
  6. package/web/dist/blocks.scoped.css +1 -0
  7. package/web/dist/core.js +9749 -0
  8. package/web/dist/import.js +2 -0
  9. package/web/dist/react.js +4073 -0
  10. package/web/dist/scan.js +22 -0
  11. package/web/dist/types/react/src/act.d.ts +71 -0
  12. package/web/dist/types/react/src/arrange.d.ts +10 -0
  13. package/web/dist/types/react/src/block.d.ts +41 -0
  14. package/web/dist/types/react/src/draw.d.ts +34 -0
  15. package/web/dist/types/react/src/fields/_input.d.ts +16 -0
  16. package/web/dist/types/react/src/fields/_view.d.ts +27 -0
  17. package/web/dist/types/react/src/fields/picker.d.ts +3 -0
  18. package/web/dist/types/react/src/fields/scan.d.ts +3 -0
  19. package/web/dist/types/react/src/fields/search.d.ts +14 -0
  20. package/web/dist/types/react/src/fields/secret.d.ts +3 -0
  21. package/web/dist/types/react/src/fields/slider.d.ts +5 -0
  22. package/web/dist/types/react/src/fields/text.d.ts +3 -0
  23. package/web/dist/types/react/src/fields/toggle.d.ts +3 -0
  24. package/web/dist/types/react/src/fields/upload.d.ts +7 -0
  25. package/web/dist/types/react/src/gen/fields.d.ts +2 -0
  26. package/web/dist/types/react/src/gen/views.d.ts +2 -0
  27. package/web/dist/types/react/src/h.d.ts +7 -0
  28. package/web/dist/types/react/src/index.d.ts +3 -0
  29. package/web/dist/types/react/src/island.d.ts +7 -0
  30. package/web/dist/types/react/src/kinds/button.d.ts +5 -0
  31. package/web/dist/types/react/src/kinds/card.d.ts +5 -0
  32. package/web/dist/types/react/src/kinds/chips.d.ts +5 -0
  33. package/web/dist/types/react/src/kinds/choice.d.ts +5 -0
  34. package/web/dist/types/react/src/kinds/composer.d.ts +5 -0
  35. package/web/dist/types/react/src/kinds/config.d.ts +5 -0
  36. package/web/dist/types/react/src/kinds/diagram.d.ts +7 -0
  37. package/web/dist/types/react/src/kinds/diff.d.ts +7 -0
  38. package/web/dist/types/react/src/kinds/editor.d.ts +5 -0
  39. package/web/dist/types/react/src/kinds/form.d.ts +22 -0
  40. package/web/dist/types/react/src/kinds/hero.d.ts +5 -0
  41. package/web/dist/types/react/src/kinds/images.d.ts +5 -0
  42. package/web/dist/types/react/src/kinds/import.d.ts +5 -0
  43. package/web/dist/types/react/src/kinds/list.d.ts +6 -0
  44. package/web/dist/types/react/src/kinds/media.d.ts +6 -0
  45. package/web/dist/types/react/src/kinds/message.d.ts +5 -0
  46. package/web/dist/types/react/src/kinds/modal.d.ts +5 -0
  47. package/web/dist/types/react/src/kinds/nav.d.ts +5 -0
  48. package/web/dist/types/react/src/kinds/pages.d.ts +5 -0
  49. package/web/dist/types/react/src/kinds/prose.d.ts +5 -0
  50. package/web/dist/types/react/src/kinds/row.d.ts +5 -0
  51. package/web/dist/types/react/src/kinds/run.d.ts +5 -0
  52. package/web/dist/types/react/src/kinds/scene.d.ts +5 -0
  53. package/web/dist/types/react/src/kinds/screen.d.ts +5 -0
  54. package/web/dist/types/react/src/kinds/secret.d.ts +5 -0
  55. package/web/dist/types/react/src/kinds/section.d.ts +5 -0
  56. package/web/dist/types/react/src/kinds/sheet.d.ts +1 -0
  57. package/web/dist/types/react/src/kinds/sidebar.d.ts +5 -0
  58. package/web/dist/types/react/src/kinds/stat.d.ts +5 -0
  59. package/web/dist/types/react/src/kinds/steps.d.ts +7 -0
  60. package/web/dist/types/react/src/kinds/table.d.ts +5 -0
  61. package/web/dist/types/react/src/kinds/text.d.ts +5 -0
  62. package/web/dist/types/react/src/kinds/timeline.d.ts +5 -0
  63. package/web/dist/types/react/src/kinds/tool.d.ts +5 -0
  64. package/web/dist/types/react/src/kinds/web.d.ts +5 -0
  65. package/web/dist/types/react/src/view.d.ts +14 -0
  66. package/web/dist/types/src/arrange.d.ts +8 -0
  67. package/web/dist/types/src/behave.d.ts +1 -0
  68. package/web/dist/types/src/core/apply.d.ts +7 -0
  69. package/web/dist/types/src/core/built.d.ts +7 -0
  70. package/web/dist/types/src/core/check.d.ts +5 -0
  71. package/web/dist/types/src/core/code.d.ts +7 -0
  72. package/web/dist/types/src/core/eval.d.ts +25 -0
  73. package/web/dist/types/src/core/field/files.d.ts +53 -0
  74. package/web/dist/types/src/core/field/match.d.ts +15 -0
  75. package/web/dist/types/src/core/field/slider.d.ts +3 -0
  76. package/web/dist/types/src/core/gate.d.ts +7 -0
  77. package/web/dist/types/src/core/gesture.d.ts +53 -0
  78. package/web/dist/types/src/core/index.d.ts +21 -0
  79. package/web/dist/types/src/core/kind/boxplot.d.ts +7 -0
  80. package/web/dist/types/src/core/kind/chart.d.ts +18 -0
  81. package/web/dist/types/src/core/kind/diagram.d.ts +44 -0
  82. package/web/dist/types/src/core/kind/import.d.ts +40 -0
  83. package/web/dist/types/src/core/kind/list.d.ts +3 -0
  84. package/web/dist/types/src/core/kind/media.d.ts +36 -0
  85. package/web/dist/types/src/core/kind/message.d.ts +4 -0
  86. package/web/dist/types/src/core/kind/modal.d.ts +23 -0
  87. package/web/dist/types/src/core/kind/plot.d.ts +22 -0
  88. package/web/dist/types/src/core/kind/prose.d.ts +5 -0
  89. package/web/dist/types/src/core/kind/sidebar.d.ts +7 -0
  90. package/web/dist/types/src/core/kind/table.d.ts +26 -0
  91. package/web/dist/types/src/core/kind/timeline.d.ts +28 -0
  92. package/web/dist/types/src/core/layout.d.ts +9 -0
  93. package/web/dist/types/src/core/look.d.ts +11 -0
  94. package/web/dist/types/src/core/nonce.d.ts +1 -0
  95. package/web/dist/types/src/core/share.d.ts +1 -0
  96. package/web/dist/types/src/core/table.d.ts +6 -0
  97. package/web/dist/types/src/core/text.d.ts +6 -0
  98. package/web/dist/types/src/core/tree.d.ts +12 -0
  99. package/web/dist/types/src/dump.d.ts +2 -0
  100. package/web/dist/types/src/edits.d.ts +18 -0
  101. package/web/dist/types/src/gen/builders.d.ts +64 -0
  102. package/web/dist/types/src/gen/fields.d.ts +2 -0
  103. package/web/dist/types/src/gen/hooks.d.ts +11 -0
  104. package/web/dist/types/src/gen/kinds.d.ts +9 -0
  105. package/web/dist/types/src/gen/layout.d.ts +19 -0
  106. package/web/dist/types/src/gen/schemes.d.ts +73 -0
  107. package/web/dist/types/src/gen/shapes.d.ts +61 -0
  108. package/web/dist/types/src/gen/types.d.ts +1517 -0
  109. package/web/dist/types/src/gen/words-import.d.ts +1 -0
  110. package/web/dist/types/src/gen/words.d.ts +1 -0
  111. package/web/dist/types/src/gesture.d.ts +54 -0
  112. package/web/dist/types/src/island.d.ts +3 -0
  113. package/web/dist/types/src/lazy/import.d.ts +13 -0
  114. package/web/dist/types/src/modal.d.ts +14 -0
  115. package/web/dist/types/src/motion.d.ts +2 -0
  116. package/web/dist/types/src/paging.d.ts +2 -0
  117. package/web/dist/types/src/patch.d.ts +17 -0
  118. package/web/dist/types/src/render/act.d.ts +9 -0
  119. package/web/dist/types/src/render/block.d.ts +5 -0
  120. package/web/dist/types/src/render/ctx.d.ts +34 -0
  121. package/web/dist/types/src/render/dom.d.ts +16 -0
  122. package/web/dist/types/src/render/field/_input.d.ts +3 -0
  123. package/web/dist/types/src/render/field/_view.d.ts +26 -0
  124. package/web/dist/types/src/render/field/picker.d.ts +3 -0
  125. package/web/dist/types/src/render/field/scan.d.ts +3 -0
  126. package/web/dist/types/src/render/field/search.d.ts +5 -0
  127. package/web/dist/types/src/render/field/secret.d.ts +3 -0
  128. package/web/dist/types/src/render/field/slider.d.ts +5 -0
  129. package/web/dist/types/src/render/field/text.d.ts +3 -0
  130. package/web/dist/types/src/render/field/toggle.d.ts +3 -0
  131. package/web/dist/types/src/render/field/upload.d.ts +5 -0
  132. package/web/dist/types/src/render/kind/boxplot.d.ts +3 -0
  133. package/web/dist/types/src/render/kind/button.d.ts +3 -0
  134. package/web/dist/types/src/render/kind/card.d.ts +3 -0
  135. package/web/dist/types/src/render/kind/chart.d.ts +4 -0
  136. package/web/dist/types/src/render/kind/chips.d.ts +3 -0
  137. package/web/dist/types/src/render/kind/choice.d.ts +3 -0
  138. package/web/dist/types/src/render/kind/composer.d.ts +3 -0
  139. package/web/dist/types/src/render/kind/config.d.ts +3 -0
  140. package/web/dist/types/src/render/kind/diagram.d.ts +3 -0
  141. package/web/dist/types/src/render/kind/diff.d.ts +3 -0
  142. package/web/dist/types/src/render/kind/editor.d.ts +3 -0
  143. package/web/dist/types/src/render/kind/form.d.ts +14 -0
  144. package/web/dist/types/src/render/kind/heat.d.ts +3 -0
  145. package/web/dist/types/src/render/kind/hero.d.ts +3 -0
  146. package/web/dist/types/src/render/kind/images.d.ts +3 -0
  147. package/web/dist/types/src/render/kind/import.d.ts +3 -0
  148. package/web/dist/types/src/render/kind/island.d.ts +3 -0
  149. package/web/dist/types/src/render/kind/lines.d.ts +5 -0
  150. package/web/dist/types/src/render/kind/list.d.ts +3 -0
  151. package/web/dist/types/src/render/kind/media.d.ts +4 -0
  152. package/web/dist/types/src/render/kind/message.d.ts +3 -0
  153. package/web/dist/types/src/render/kind/modal.d.ts +9 -0
  154. package/web/dist/types/src/render/kind/nav.d.ts +2 -0
  155. package/web/dist/types/src/render/kind/pages.d.ts +2 -0
  156. package/web/dist/types/src/render/kind/plot.d.ts +3 -0
  157. package/web/dist/types/src/render/kind/prose.d.ts +4 -0
  158. package/web/dist/types/src/render/kind/row.d.ts +3 -0
  159. package/web/dist/types/src/render/kind/run.d.ts +3 -0
  160. package/web/dist/types/src/render/kind/scene.d.ts +3 -0
  161. package/web/dist/types/src/render/kind/screen.d.ts +3 -0
  162. package/web/dist/types/src/render/kind/secret.d.ts +3 -0
  163. package/web/dist/types/src/render/kind/section.d.ts +3 -0
  164. package/web/dist/types/src/render/kind/sheet.d.ts +1 -0
  165. package/web/dist/types/src/render/kind/sidebar.d.ts +3 -0
  166. package/web/dist/types/src/render/kind/stat.d.ts +2 -0
  167. package/web/dist/types/src/render/kind/steps.d.ts +3 -0
  168. package/web/dist/types/src/render/kind/table.d.ts +3 -0
  169. package/web/dist/types/src/render/kind/text.d.ts +3 -0
  170. package/web/dist/types/src/render/kind/timeline.d.ts +3 -0
  171. package/web/dist/types/src/render/kind/toast.d.ts +4 -0
  172. package/web/dist/types/src/render/kind/tool.d.ts +3 -0
  173. package/web/dist/types/src/render/kind/web.d.ts +2 -0
  174. package/web/dist/types/src/render/more.d.ts +11 -0
  175. package/web/dist/types/src/render/text.d.ts +5 -0
  176. package/web/dist/types/src/scan/index.d.ts +26 -0
  177. package/web/dist/types/src/scan/page.d.ts +18 -0
  178. package/web/dist/types/src/shell/adopt.d.ts +8 -0
  179. package/web/dist/types/src/shell/host.d.ts +30 -0
  180. package/web/dist/types/src/shell/layout.d.ts +29 -0
  181. package/web/dist/types/src/shell/local.d.ts +10 -0
  182. package/web/dist/types/src/shell/look.d.ts +15 -0
  183. package/web/dist/types/src/shell/mount.d.ts +34 -0
  184. package/web/dist/types/src/shell/sheet.d.ts +17 -0
  185. package/web/dist/types/src/shell/source.d.ts +12 -0
  186. package/web/dist/types/src/shell/store.d.ts +2 -0
  187. package/web/dist/types/src/shell.d.ts +26 -0
  188. package/web/dist/types/src/sidebar.d.ts +2 -0
  189. package/web/dist/types/src/stream.d.ts +28 -0
  190. package/web/dist/types/src/theme.d.ts +24 -0
  191. package/web/dist/types/src/toasts.d.ts +7 -0
@@ -0,0 +1,22 @@
1
+ var ae=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function re(e,t,n){let a=e.at==="pressed"||e.at==="dragging"||e.at==="previewing";return e.at==="idle"&&t.on==="press"?[{at:"pressed"},null]:e.at==="pressed"&&t.on==="release"?[{at:"idle"},"tap"]:a&&t.on==="move"?t.c==null?[{at:"dragging"},null]:[{at:"previewing",c:t.c},null]:a&&t.on==="cancel"||e.at==="dragging"&&t.on==="release"?[{at:"idle"},null]:e.at==="previewing"&&t.on==="release"?ae(e.c,n)?[{at:"idle"},null]:[{at:"sent",c:e.c},{send:e.c}]:e.at==="sent"&&t.on==="answer"?t.ok?[{at:"confirmed"},null]:[{at:"refused",why:t.why??""},null]:(e.at==="confirmed"||e.at==="refused")&&t.on==="settled"?[{at:"idle"},null]:[e,null]}var be={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down"},we=(e,t)=>`${e.id??""}
2
+ ${t}`,O;function T(e){O?.isConnected||(O=Object.assign(document.createElement("div"),{className:"b-sr"}),O.setAttribute("aria-live","polite"),document.body.append(O)),O.textContent=e}var ve=(e,t,n)=>e.parentElement?.append(...t.map(([a,i])=>{let o=Object.assign(document.createElement("button"),{type:"button",className:"b-sr",tabIndex:-1,textContent:a});return o.onclick=()=>n(i),o}));function ie(e,t,n){let a=n.rules.word(n.block,n.grab)?n.rules.start(n.block,n.grab):null;if(a===null)return()=>{};let i=we(n.block,n.item);e.dataset.grab=JSON.stringify(n.grab);let o=t.held?.get(i),r=o?{at:"sent",c:a}:{at:"idle"},s=0,d=0,u=()=>{e.dataset.phase=r.at,e.setAttribute("aria-pressed",String(r.at==="pressed"||r.at==="dragging"||r.at==="previewing"))},l=c=>{g({on:"answer",ok:c}),g({on:"settled"})};o&&(o.back=l);let v=async c=>{let f={start:a,c,back:l};t.held?.set(i,f),T("sending");let m=await t.act({action:n.gesture.action,block:n.block.id,values:{[n.gesture.name]:c}},e).catch(()=>!1);t.held?.delete(i),f.back(m),T(m?n.rules.says(n.block,n.grab,c):"not changed")},g=c=>{let[f,m]=re(r,c,a);f.at===r.at&&c.on!=="move"||(r=f,u(),r.at==="previewing"&&n.show(r.c),(r.at==="idle"||r.at==="dragging")&&n.show(null),r.at==="pressed"&&T(`${e.getAttribute("aria-label")??""}, grabbed, ${n.rules.says(n.block,n.grab,a)}. Arrows move, Enter drops, Escape cancels`),r.at==="dragging"&&T("no drop here"),r.at==="previewing"&&T(n.rules.says(n.block,n.grab,r.c)),m&&m!=="tap"&&v(m.send))},y=()=>r.at,k=()=>r.at==="pressed"||r.at==="dragging"||r.at==="previewing",w=c=>{let f=n.rules.nudge(n.block,n.grab,r.at==="previewing"?r.c:a,c);f!==null&&g({on:"move",c:f})};e.style.touchAction="none",e.addEventListener("pointerdown",c=>{r.at!=="idle"||c.button!==0||(e.setPointerCapture(c.pointerId),[s,d]=[c.clientX,c.clientY],g({on:"press"}))}),e.addEventListener("pointermove",c=>{let[f,m]=[c.clientX-s,c.clientY-d];k()&&(r.at!=="pressed"||Math.hypot(f,m)>=4)&&g({on:"move",c:n.rules.candidate(n.block,n.grab,n.reach(f,m,s,d))})}),e.addEventListener("pointerup",()=>k()&&g({on:"release"})),e.addEventListener("pointercancel",()=>g({on:"cancel"})),e.addEventListener("blur",()=>g({on:"cancel"})),e.addEventListener("keydown",c=>{let f=be[c.key];if(r.at==="idle"&&c.key===" ")g({on:"press"});else if(k())if(f)w({dir:f,big:c.shiftKey});else if(c.key==="Enter"||c.key===" ")g({on:r.at==="pressed"?"cancel":"release"});else if(c.key==="Escape")g({on:"cancel"});else return;else return;c.preventDefault()});let h=c=>{r.at==="idle"&&(g({on:"press"}),w(c),g({on:y()==="pressed"?"cancel":"release"}))};return ve(e,n.rules.steps(n.block,n.grab),h),u(),h}var S=[1240,1754];function ye(e){let t=e.width*e.height,n=new Uint8Array(t),a=e.data;for(let r=0;r<t;r++)n[r]=(a[r*4]??0)*77+(a[r*4+1]??0)*150+(a[r*4+2]??0)*29>>8;let i=new Uint8Array(t),o=e.width;for(let r=0;r<t;r++){let s=r%o,d=s?r-1:r,u=s<o-1?r+1:r,l=r>=o?o:0,v=r+o<t?o:0;i[r]=((n[d-l]??0)+(n[r-l]??0)+(n[u-l]??0)+(n[d]??0)+(n[r]??0)+(n[u]??0)+(n[d+v]??0)+(n[r+v]??0)+(n[u+v]??0))/9}return i}function ke(e){let t=new Array(256).fill(0);for(let s of e)t[s]=(t[s]??0)+1;let n=t.reduce((s,d,u)=>s+d*u,0),a=0,i=0,o=0,r=128;for(let s=0;s<256;s++){a+=t[s]??0,i+=s*(t[s]??0);let d=e.length-a;if(!a||!d)continue;let u=a*d*(i/a-(n-i)/d)**2;u>o&&([o,r]=[u,s])}return r}function oe(e){let{width:t,height:n}=e,a=ye(e),i=ke(a),o=new Uint8Array(t*n),r=new Int32Array(t*n),s,d=t*n/10;for(let y=0;y<t*n;y++){if(o[y]||(a[y]??0)<=i)continue;let k=0,w=0,h=[[0,0],[0,0],[0,0],[0,0]],c=[-1/0,-1/0,-1/0,-1/0];for(r[w++]=y,o[y]=1;w;){let f=r[--w]??0,m=f%t,x=(f-m)/t;k++;for(let M=0;M<4;M++){let b=M===0?-m-x:M===1?m-x:M===2?m+x:x-m;b>(c[M]??0)&&([c[M],h[M]]=[b,[m,x]])}for(let M=0;M<4;M++){let b=M===0?m?f-1:-1:M===1?m<t-1?f+1:-1:M===2?f-t:f+t;b<0||b>=t*n||o[b]||(a[b]??0)<=i||(o[b]=1,r[w++]=b)}}k>d&&([d,s]=[k,h])}if(!s)return;let[u,l,v,g]=s.map(([y,k])=>[y+.5,k+.5]);return u&&l&&v&&g?[u,l,v,g]:void 0}function xe(e){let[[t,n],[a,i],[o,r],[s,d]]=e,u=a-o,l=s-o,v=t-a+o-s,g=i-r,y=d-r,k=n-i+r-d,w=u*y-l*g||1e-9,h=(v*y-l*k)/w,c=(u*k-v*g)/w;return{a:a-t+h*a,b:s-t+c*s,c:t,d:i-n+h*i,e:d-n+c*d,f:n,g:h,h:c}}function se(e,t,[n,a]=S){let{a:i,b:o,c:r,d:s,e:d,f:u,g:l,h:v}=xe(t),g=e.data,y=e.width,k=new Uint8ClampedArray(n*a*4),w=e.width-1.001,h=e.height-1.001,c=1/n;for(let f=0,m=0;f<a;f++){let x=(f+.5)/a,M=i*c*.5+o*x+r,b=s*c*.5+d*x+u,P=l*c*.5+v*x+1;for(let A=0;A<n;A++,m+=4,M+=i*c,b+=s*c,P+=l*c){let R=M/P-.5,B=b/P-.5;R=R<0?0:R>w?w:R,B=B<0?0:B>h?h:B;let te=R|0,ne=B|0,H=R-te,G=B-ne,I=(ne*y+te)*4,$=I+y*4,U=(1-H)*(1-G),z=H*(1-G),W=(1-H)*G,X=H*G;k[m]=(g[I]??0)*U+(g[I+4]??0)*z+(g[$]??0)*W+(g[$+4]??0)*X,k[m+1]=(g[I+1]??0)*U+(g[I+5]??0)*z+(g[$+1]??0)*W+(g[$+5]??0)*X,k[m+2]=(g[I+2]??0)*U+(g[I+6]??0)*z+(g[$+2]??0)*W+(g[$+6]??0)*X,k[m+3]=255}}return{width:n,height:a,data:k}}var de=([e,t,n,a])=>[a,e,t,n],Y=(e,t)=>[[e*.1,t*.1],[e*.9,t*.1],[e*.9,t*.9],[e*.1,t*.9]];function ce(e){let t=[],n=[],a=0,i=d=>{let u=typeof d=="string"?new TextEncoder().encode(d):new Uint8Array(d);t.push(u),a+=u.length},o=(d,...u)=>{n[d]=a,i(`${d} 0 obj
3
+ `),u.forEach(i),i(`
4
+ endobj
5
+ `)};i(`%PDF-1.4
6
+ %\xE2\xE3
7
+ `),o(1,"<< /Type /Catalog /Pages 2 0 R >>"),o(2,`<< /Type /Pages /Kids [${e.map((d,u)=>`${3+u*3} 0 R`).join(" ")}] /Count ${e.length} >>`),e.forEach((d,u)=>{let l=3+u*3,v="q 595.28 0 0 841.89 0 0 cm /I Do Q";o(l,`<< /Type /Page /Parent 2 0 R /MediaBox [0 0 595.28 841.89] /Resources << /XObject << /I ${l+1} 0 R >> >> /Contents ${l+2} 0 R >>`),o(l+1,`<< /Type /XObject /Subtype /Image /Width ${d.width} /Height ${d.height} /ColorSpace /DeviceRGB /BitsPerComponent 8 /Filter /DCTDecode /Length ${d.bytes.length} >>
8
+ stream
9
+ `,d.bytes,`
10
+ endstream`),o(l+2,`<< /Length ${v.length} >>
11
+ stream
12
+ ${v}
13
+ endstream`)});let r=3+e.length*3,s=a;return i(`xref
14
+ 0 ${r}
15
+ 0000000000 65535 f
16
+ ${n.slice(1).map(d=>`${String(d).padStart(10,"0")} 00000 n
17
+ `).join("")}`),i(`trailer
18
+ << /Size ${r} /Root 1 0 R >>
19
+ startxref
20
+ ${s}
21
+ %%EOF
22
+ `),new Blob(t,{type:"application/pdf"})}var ge=(e,t)=>{let n=([a,i])=>[a/t,i/t];return[n(e[0]),n(e[1]),n(e[2]),n(e[3])]},Me=(e,t=1/0)=>{let n=Math.min(1,t/Math.max(e.width,e.height)),a=new OffscreenCanvas(Math.round(e.width*n),Math.round(e.height*n)),i=a.getContext("2d",{willReadFrequently:!0});return i?.drawImage(e,0,0,a.width,a.height),{k:n,img:i?.getImageData(0,0,a.width,a.height)??new ImageData(1,1)}},Ee=2560;async function me(e){let t=await createImageBitmap(e),n=Ee/Math.max(t.width,t.height);if(n>=1)return t;let a=await createImageBitmap(t,{resizeWidth:Math.round(t.width*n),resizeHeight:Math.round(t.height*n),resizeQuality:"high"});return t.close(),a}var D;async function ue(e){if(e instanceof ImageBitmap)return e;if(D?.n===e.n)return D.photo;D?.photo.close();let t=await me(e.src);return D={n:e.n,photo:t},t}async function Ce(e,t){if(e.op==="find"){let{k:a,img:i}=Me(await ue(e.pic),640),o=oe(i);return{quad:o?ge(o,a):null}}if(e.op==="page"){let a=await ue(e.pic),i=e.quad.map(([x])=>x),o=e.quad.map(([,x])=>x),r=Math.max(0,Math.floor(Math.min(...i))),s=Math.max(0,Math.floor(Math.min(...o))),d=Math.min(a.width,Math.ceil(Math.max(...i)))-r,u=Math.min(a.height,Math.ceil(Math.max(...o)))-s,l=Math.min(1,Math.max(...S)/Math.max(d,u,1)),v=new OffscreenCanvas(Math.max(1,Math.round(d*l)),Math.max(1,Math.round(u*l))),g=v.getContext("2d",{willReadFrequently:!0});g?.drawImage(a,r,s,d,u,0,0,v.width,v.height);let y=([x,M])=>[(x-r)*l,(M-s)*l],[k,w,h,c]=e.quad,f=new OffscreenCanvas(S[0],S[1]),m=se(g?.getImageData(0,0,v.width,v.height)??new ImageData(1,1),[y(k),y(w),y(h),y(c)]);return f.getContext("2d")?.putImageData(new ImageData(m.data,S[0],S[1]),0,0),{jpeg:await f.convertToBlob({type:"image/jpeg",quality:.8})}}let n=[];for(let a of e.pages)t(n.push({bytes:a,width:S[0],height:S[1]}));return{pdf:ce(n)}}typeof document>"u"&&addEventListener("message",e=>{let t=e.data.id;Ce(e.data,n=>postMessage({id:t,made:n})).then(n=>postMessage({id:t,...n}))});var N,F=0,le=new WeakMap,fe=e=>({src:e,n:le.get(e)??(le.set(e,++F),F)}),_=new Map;function Q(e,t){N||(N=new Worker(import.meta.url,{type:"module"}),N.onmessage=a=>{let i=_.get(a.data.id);if(a.data.made)return i?.made?.(a.data.made);_.delete(a.data.id),i?.done(a.data)});let n=++F;return N.postMessage({...e,id:n}),new Promise(a=>_.set(n,{done:a,made:t}))}var Pe=async e=>{let[t,n]=await Promise.all([me(e),Q({op:"find",pic:fe(e)})]);return{src:e,photo:t,quad:n.quad??Y(t.width,t.height)}},he=async({src:e,photo:t},n,a)=>{let i=new Uint8Array(await(await Q({op:"page",pic:fe(e),quad:n})).jpeg?.arrayBuffer()??new ArrayBuffer(0));return{src:e,photo:t,quad:n,auto:a,jpeg:i,url:URL.createObjectURL(new Blob([i],{type:"image/jpeg"}))}},p=(e,t="",...n)=>{let a=document.createElement(e);return a.className=t,a.append(...n),a},q=(e,t)=>{let n=document.createElementNS("http://www.w3.org/2000/svg",e);for(let[a,i]of Object.entries(t))n.setAttribute(a,i);return n},E=(e,t,n="",a="",i=!1)=>{let o=Object.assign(p("button",n,...e?[p("span","",e)]:[]),{type:"button",disabled:i,onclick:t});return a&&o.setAttribute("aria-label",a),o},J=(e="")=>{let t=Object.assign(p("img"),{alt:e});return e||t.setAttribute("aria-hidden","true"),t},V=e=>e.map(t=>t.join(",")).join(" "),pe=([e,t],n,a)=>`${Math.round(e/n*100)} %, ${Math.round(t/a*100)} %`,L=(e,t,n={})=>e.o.w(t).replace(/\{(\w+)\}/g,(a,i)=>String(n[i]??"")),j=e=>e.pages.length>=e.o.max,C=(e,t)=>(Object.assign(e,t),Z(e)),K=["tl","tr","br","bl"],Be={left:[-1,0],right:[1,0],up:[0,-1],down:[0,1]};function Ae(e,t){let{photo:n}=t,[a,i]=[n.width,n.height],o=p("div","snv adjust");o.style.aspectRatio=`${a} / ${i}`;let r=Object.assign(p("canvas"),{width:Math.min(a,1280),height:Math.round(i*Math.min(a,1280)/a)});r.setAttribute("aria-hidden","true"),r.getContext("2d")?.drawImage(n,0,0,r.width,r.height);let s=q("svg",{viewBox:`0 0 ${a} ${i}`,preserveAspectRatio:"none","aria-hidden":"true"}),d=q("path",{class:"snm"}),u=q("polygon",{class:"snq"}),l=Object.assign(p("canvas","snl"),{width:240,height:240,hidden:!0});l.setAttribute("aria-hidden","true"),s.append(d,u);let v=([w,h])=>[Math.min(a,Math.max(0,w)),Math.min(i,Math.max(0,h))],g=K.map(w=>{let h=E("",()=>{},"snc",e.o.w(w));return h.setAttribute("role","slider"),h}),y=(w,h=-1)=>{u.setAttribute("points",V(w)),d.setAttribute("d",`M0 0H${a}V${i}H0Z M${w.map(x=>x.join(" ")).join("L")}Z`),g.forEach((x,M)=>{let b=w[M]??[0,0];Object.assign(x.style,{left:`${b[0]/a*100}%`,top:`${b[1]/i*100}%`}),x.setAttribute("aria-valuetext",pe(b,a,i))});let c=w[h],f=o.getBoundingClientRect(),m=l.clientWidth*a/(3*(f.width||1));l.hidden=!c,c&&(l.getContext("2d")?.drawImage(n,c[0]-m/2,c[1]-m/2,m,m,0,0,l.width,l.height),Object.assign(l.style,{left:`${c[0]/a*100}%`,top:`${c[1]/i*100}%`}),l.classList.toggle("low",c[1]>i/2))},k=null;return g.forEach((w,h)=>{w.append(p("i")),o.append(w);let c=(b,P)=>(Be[b.dir]?.[P]??0)*(P?i:a)*(b.big?10:1)/100,f={word:()=>"move",start:()=>t.quad[h]??null,candidate:(b,P,A)=>v(A),nudge:(b,P,[A,R],B)=>v([A+c(B,0),R+c(B,1)]),steps:()=>[],says:(b,P,A)=>`${e.o.w(K[h]??"")} ${pe(A,a,i)}`},m=(b,P,A,R)=>{let B=o.getBoundingClientRect();return[(A+b-B.left)/B.width*a,(R+P-B.top)/B.height*i]},x=b=>{k=b;let P=[t.quad[0],t.quad[1],t.quad[2],t.quad[3]];b&&(P[h]=b),y(P,b?h:-1)};ie(w,{act:async()=>(k&&(t.quad[h]=k),C(e,{focus:h}),!0)},{block:{id:"corners"},gesture:{action:"corner",name:"at"},rules:f,grab:h,item:K[h]??"",reach:m,show:x})}),o.prepend(r,s),o.append(l),y(t.quad),o}function Re(e){let[t,n]=[e.video.videoWidth||3,e.video.videoHeight||4],a=p("div",`snv ${e.live?"found":"seek"}`);a.style.aspectRatio=`${t} / ${n}`;let i=q("svg",{viewBox:`0 0 ${t} ${n}`,preserveAspectRatio:"none","aria-hidden":"true"});return i.append(q("polygon",{class:"snq",points:V(e.live??Y(t,n))})),a.append(e.video,i),a}function Se(e){let t=p("ol","snr");return t.setAttribute("aria-label",e.o.w("strip")),e.pages.forEach((n,a)=>{let i=E("",()=>C(e,{sel:a,step:"review"}),"pg",`${L(e,"pageN",{n:a+1})}${e.sel===a&&e.step==="review"?`, ${e.o.w("review")}`:""}`);i.append(Object.assign(J(),{src:n.url})),e.sel===a&&i.setAttribute("aria-current","true");let o=p("li",e.sel===a?"sel":"",i,p("span","",String(a+1)));o.draggable=e.step==="review",o.ondragstart=r=>r.dataTransfer?.setData("text/plain",String(a)),o.ondragover=r=>r.preventDefault(),o.ondrop=r=>{let[s]=e.pages.splice(Number(r.dataTransfer?.getData("text/plain")),1);s&&e.pages.splice(a,0,s),C(e,{sel:a})},t.append(o)}),j(e)||t.append(p("li","add",E(e.o.w("addPage"),()=>C(e,{step:"capture",at:e.pages.length}),"pg","",e.step==="pdf"),p("span","","+"))),t}function Le(e,t){let n=e.step==="pdf",a=e.pages.length,i=u=>{let[l]=e.pages.splice(e.sel,1);l&&e.pages.splice(e.sel+u,0,l),C(e,{sel:e.sel+u})},o=async()=>{e.pages[e.sel]=await he(t,de(t.quad),t.auto),C(e,{})},r=()=>{e.pages.splice(e.sel,1),C(e,{sel:Math.max(0,e.sel-1),step:e.pages.length?"review":"capture",at:e.pages.length})},s=()=>{C(e,{step:"capture",at:e.sel}),e.cam!=="on"&&e.input.click()},d=p("div","sna",E(e.o.w("retake"),s,"","",n),E(e.o.w("corners"),()=>C(e,{edit:{src:t.src,photo:t.photo,quad:[...t.quad],auto:t.auto,at:e.sel},step:"corners"}),"","",n),E(e.o.w("rotate"),o,"","",n),E(e.o.w("earlier"),()=>i(-1),"","",n||!e.sel),E(e.o.w("later"),()=>i(1),"","",n||e.sel===a-1),E(e.o.w("delete"),r,"bad","",n));return[Object.assign(J(L(e,"pageN",{n:e.sel+1})),{className:"snp",src:t.url}),d]}function Ie(e){let t=e.pages.length,n=L(e,t>1?"doneN":"done1",{n:t});if(e.step==="capture"){let r=e.pages[t-1],s=E("",()=>C(e,{step:"review"}),"snk",`${e.o.w("review")}: ${n}`);r&&s.append(Object.assign(J(),{src:r.url}),p("b","",String(t)));let d=E("",()=>Oe(e),"sno",L(e,"take",{n:e.at+1}),j(e)||e.cam!=="on");return d.append(p("i")),[r?s:p("span"),d,E(n,()=>C(e,{step:"review"}),"","",!t)]}if(e.step==="corners")return[E(e.o.w("retake"),()=>C(e,{edit:void 0,step:"capture"})),p("span"),E(e.o.w("usePage"),()=>Te(e))];if(e.step==="review")return[E(e.o.w("addPage"),()=>C(e,{step:"capture",at:t}),"","",j(e)),p("span"),E(n,()=>qe(e),"","",!t)];let a=L(e,"making",{n:e.made,of:t}),i=p("span","pgt",p("b"));for(let[r,s]of[["role","progressbar"],["aria-valuemin","0"],["aria-valuemax",String(t)],["aria-valuenow",String(e.made)],["aria-label",a]])i.setAttribute(r,s);i.style.setProperty("--v",String(Math.round(e.made/t*100)));let o=E(n,()=>{},"","",!0);return o.setAttribute("aria-busy","true"),[p("span"),p("span"),p("div","snx",o,i,p("span","",a))]}function $e(e){let t=p("div","sns"),n=e.pages[e.sel];if(e.step==="capture"&&(e.cam==="none"||e.cam==="denied")){let[r,s]=e.cam==="denied"?["denied","deniedWhy"]:["noCam","noCamWhy"];return t.append(p("div","sne",p("b","",e.o.w(r)),p("span","",e.o.w(s)),E(e.o.w("pickImages"),()=>e.input.click(),"","",j(e)))),t}if((e.step==="review"||e.step==="pdf")&&n)return t.append(...Le(e,n)),t;t.append(e.step==="corners"&&e.edit?Ae(e,e.edit):Re(e));let[a,i]=e.step==="corners"?["","drag"]:j(e)?[" warn","limit"]:e.live===void 0?["","seek"]:e.live?[" ok","found"]:[" warn","noEdge"],o=p("div",`snt${a}`,L(e,i,{n:e.pages.length}));return o.setAttribute("role","status"),t.append(o),t}function Z(e){if(!e.open)return;let t=e.step==="review"||e.step==="pdf";e.box.className=`scn${t?" review":""}`;let n=t?L(e,"pageOf",{n:e.sel+1,of:e.pages.length}):L(e,"pageN",{n:(e.edit?.at??e.at)+1}),a=p("div","snh",E(e.o.w("cancel"),()=>e.close()),p("span","tw",`${e.o.label} `,p("small","",`\xB7 ${n}`)));e.step==="capture"&&a.append(E(e.o.w("pickImages"),()=>e.input.click(),"","",j(e)));let i=e.edit;e.step==="corners"&&i&&a.append(E(e.o.w("reset"),()=>C(e,{edit:{...i,quad:[...i.auto]}}))),e.box.replaceChildren(a,$e(e),Se(e),p("div","snb",...Ie(e))),e.focus>=0&&e.box.querySelectorAll(".snc")[e.focus]?.focus(),e.focus=-1}async function ee(e,t=!1){let n=e.queue.shift();if(!n)return C(e,{step:t||e.pages.length&&e.cam!=="on"?"review":"capture"});let a=await Pe(n);C(e,{edit:{...a,auto:a.quad,at:e.at},step:"corners"})}function je(e){let t=Object.assign(document.createElement("canvas"),{width:e.videoWidth,height:e.videoHeight});return t.getContext("2d")?.drawImage(e,0,0),new Promise(n=>t.toBlob(a=>n(a??new Blob),"image/jpeg",.92))}async function Oe(e){let t=e.video.srcObject instanceof MediaStream?e.video.srcObject.getVideoTracks()[0]:void 0,n=t&&typeof ImageCapture=="function"?await new ImageCapture(t).takePhoto().catch(()=>{}):void 0;return e.queue.push(n??await je(e.video)),ee(e)}async function Te(e){let t=e.edit;if(!t)return;let n=await he(t,t.quad,t.auto),a=t.at<e.pages.length;return e.pages.splice(t.at,a?1:0,n),Object.assign(e,{sel:t.at,at:e.pages.length,edit:void 0}),ee(e,a)}async function qe(e){C(e,{step:"pdf"});let t=await Q({op:"pdf",pages:e.pages.map(n=>n.jpeg)},n=>C(e,{made:n}));e.close({pdf:t.pdf??new Blob,pages:e.pages})}async function He(e){for(;e.open&&e.cam==="on";){let t=performance.now(),[n,a]=[e.video.videoWidth,e.video.videoHeight];if(e.step==="capture"&&n){let i=640/Math.max(n,a),o=await createImageBitmap(e.video,{resizeWidth:Math.round(n*i),resizeHeight:Math.round(a*i)}),r=(await Q({op:"find",pic:o})).quad,s=!!e.live;e.live=r?ge(r,i):null;let d=e.box.querySelector(".snv.found .snq, .snv.seek .snq");s!==!!e.live?Z(e):d&&e.live&&d.setAttribute("points",V(e.live))}await new Promise(i=>setTimeout(i,Math.max(0,100-(performance.now()-t))))}}function We(e){let t=p("dialog","scd"),n=Object.assign(p("video"),{muted:!0,playsInline:!0,autoplay:!0}),a=Object.assign(p("input"),{type:"file",accept:"image/*",multiple:!0,hidden:!0});return n.setAttribute("aria-hidden","true"),new Promise(i=>{let o=[...e.pages??[]],r={o:e,pages:o,step:o.length?"review":"capture",sel:0,made:0,cam:"wait",at:o.length,open:!0,queue:[],box:p("div","scn"),video:n,input:a,focus:-1,close:()=>{}},s;if(r.close=u=>{r.open=!1,s?.getTracks().forEach(l=>l.stop()),t.close(),t.remove(),i(u)},t.setAttribute("aria-label",e.label),t.append(p("div","scw",r.box),a),t.addEventListener("cancel",u=>(u.preventDefault(),r.close())),document.body.append(t),t.showModal(),a.onchange=async()=>{let u=Array.from(a.files??[]).slice(0,e.max-r.pages.length);a.value="",r.queue.push(...u),ee(r)},Z(r),!navigator.mediaDevices?.getUserMedia)return C(r,{cam:"none"});let d=u=>{s=u,n.srcObject=u,C(r,{cam:"on"}),He(r)};navigator.mediaDevices.getUserMedia({video:{facingMode:"environment",width:{ideal:2560},height:{ideal:1920}}}).then(d,u=>C(r,{cam:u instanceof DOMException&&u.name==="NotAllowedError"?"denied":"none"}))})}export{he as pageOf,Pe as quadOf,We as scan};
@@ -0,0 +1,71 @@
1
+ import { type ReactNode } from "react";
2
+ import { type Action, type Built, type Confirm, type Fault, type Lit, type Locale, type OnFile, type Seek, type State, type Tap, type View } from "../../src/core/index.ts";
3
+ export type Go = {
4
+ open: string;
5
+ } | {
6
+ sheet: string;
7
+ } | {
8
+ thread: string;
9
+ };
10
+ export type Report = {
11
+ what: "fault";
12
+ fault: Fault;
13
+ } | {
14
+ what: "dropped";
15
+ block: string;
16
+ event: string;
17
+ } | {
18
+ what: "failed";
19
+ action: string;
20
+ error: unknown;
21
+ } | {
22
+ what: "threw";
23
+ block: string;
24
+ error: unknown;
25
+ };
26
+ export type Post = {
27
+ action: string;
28
+ block?: string | null | undefined;
29
+ values?: Record<string, unknown> | null | undefined;
30
+ confirm?: Confirm | null | undefined;
31
+ };
32
+ export type KindProps = {
33
+ block: Record<string, unknown> & {
34
+ type: string;
35
+ };
36
+ act: (a: Omit<Post, "block">) => Promise<boolean>;
37
+ };
38
+ export type IslandProps = {
39
+ props: Record<string, unknown>;
40
+ emit: (name: string, values?: Record<string, unknown>) => void;
41
+ };
42
+ export type Islands = Record<string, (p: IslandProps) => ReactNode>;
43
+ export type Ctx = {
44
+ screen: string;
45
+ locale: Locale;
46
+ v: View;
47
+ state: State;
48
+ edits: State;
49
+ put: (key: string, to: Lit | undefined) => void;
50
+ busy: ReadonlySet<string>;
51
+ act: (a: Post) => Promise<boolean>;
52
+ tap: (t: Tap) => void;
53
+ report: (r: Report) => void;
54
+ kinds: Record<string, (p: KindProps) => ReactNode>;
55
+ islands: Islands;
56
+ file?: OnFile | undefined;
57
+ seek: Record<string, Seek>;
58
+ };
59
+ export type Props = {
60
+ onAction: (a: Action) => Promise<boolean | void> | boolean | void;
61
+ onOpen?: (go: Go) => void;
62
+ kinds?: Record<string, (p: KindProps) => ReactNode>;
63
+ islands?: Islands;
64
+ onReport?: (r: Report) => void;
65
+ onFile?: OnFile;
66
+ };
67
+ export declare const Cx: import("react").Context<Ctx>;
68
+ export declare function useCx(p: Props, screen: Built): {
69
+ cx: Ctx;
70
+ ask: ReactNode;
71
+ };
@@ -0,0 +1,10 @@
1
+ import { type ReactNode } from "react";
2
+ import { type Editing, type Placed } from "../../src/edits.ts";
3
+ import type { SizeClass } from "../../src/gen/layout.ts";
4
+ export type ArrangeProps = {
5
+ tree: Placed;
6
+ size: SizeClass;
7
+ edit: Editing;
8
+ onDone?: () => void;
9
+ };
10
+ export declare function Arrange(p: ArrangeProps): ReactNode;
@@ -0,0 +1,41 @@
1
+ import { Component, type ReactNode } from "react";
2
+ import { type Fallback, type Kind, type Of } from "../../src/core/index.ts";
3
+ import { type Ctx } from "./act.ts";
4
+ import { type Attrs } from "./h.ts";
5
+ export type Blk = Record<string, unknown>;
6
+ export type Views = {
7
+ [K in Kind]?: (p: {
8
+ b: Of<K>;
9
+ hooks: Attrs;
10
+ }) => ReactNode;
11
+ };
12
+ export declare function hooksOf(b: Blk, cx: Ctx, fallback: boolean, cont?: boolean): Attrs;
13
+ export declare function row(f: Fallback, cx: Ctx): ReactNode;
14
+ export declare const kids: (bs: unknown) => ReactNode[];
15
+ export declare function Fallen({ b }: {
16
+ b: Blk;
17
+ }): ReactNode;
18
+ type Caught = {
19
+ b: Blk;
20
+ report: Ctx["report"];
21
+ fallback: ReactNode;
22
+ children?: ReactNode;
23
+ };
24
+ export declare class Boundary extends Component<Caught, {
25
+ threw: boolean;
26
+ }> {
27
+ state: {
28
+ threw: boolean;
29
+ };
30
+ static getDerivedStateFromError(): {
31
+ threw: boolean;
32
+ };
33
+ componentDidCatch(error: unknown): void;
34
+ componentDidUpdate(was: Caught): void;
35
+ render(): ReactNode;
36
+ }
37
+ export declare const Block: import("react").MemoExoticComponent<({ b, cont }: {
38
+ b: Blk;
39
+ cont?: boolean;
40
+ }) => ReactNode>;
41
+ export {};
@@ -0,0 +1,34 @@
1
+ import type { ReactNode } from "react";
2
+ import { type Act, type Figure, type Tap } from "../../src/core/index.ts";
3
+ import type { Ctx } from "./act.ts";
4
+ import { type Attrs } from "./h.ts";
5
+ export type V<T> = {
6
+ b: T;
7
+ hooks: Attrs;
8
+ };
9
+ export declare const urlOf: (t?: Tap | null) => string | undefined;
10
+ export declare const sends: (t?: Tap | null, action?: unknown) => string | undefined;
11
+ export declare const out: (url: string) => {
12
+ href: string;
13
+ target: string;
14
+ rel: string;
15
+ };
16
+ export declare const press: (go: () => void) => {
17
+ role: string;
18
+ tabIndex: number;
19
+ onClick: () => void;
20
+ onKeyDown: (e: {
21
+ key: string;
22
+ }) => void | false;
23
+ };
24
+ export declare const btn: (label: unknown, cls: string, url: string | undefined, action: unknown, attrs: Attrs, off?: boolean, part?: string) => import("react").ReactElement<{
25
+ className: string | undefined;
26
+ }, string | import("react").JSXElementConstructor<any>>;
27
+ export declare const act: (a: Act, cls: string, cx: Ctx, url: string | undefined, go: (() => void) | undefined) => import("react").ReactElement<{
28
+ className: string | undefined;
29
+ }, string | import("react").JSXElementConstructor<any>>;
30
+ export declare function ticked(v: unknown, cx: Ctx): ReactNode;
31
+ export declare const figure: (f: Figure, cls: string) => import("react").ReactElement<{
32
+ className: string | undefined;
33
+ }, string | import("react").JSXElementConstructor<any>>;
34
+ export declare function md(s: unknown, refs: boolean): ReactNode[];
@@ -0,0 +1,16 @@
1
+ import type { TextField } from "../../../src/core/index.ts";
2
+ import type { FieldCx } from "./_view.ts";
3
+ export declare function input(x: TextField, c: FieldCx, attrs: Record<string, unknown>, password: boolean, placeholder: string): import("react").ReactElement<{
4
+ type: string;
5
+ inputMode: string | undefined;
6
+ value: string;
7
+ placeholder: string;
8
+ autoComplete: string;
9
+ "data-was": string;
10
+ "data-draft": string | undefined;
11
+ onChange: (e: {
12
+ target: {
13
+ value: string;
14
+ };
15
+ }) => void;
16
+ }, string | import("react").JSXElementConstructor<any>>;
@@ -0,0 +1,27 @@
1
+ import type { ReactNode } from "react";
2
+ import type { Field, Lit, Locale, OnFile, Seek } from "../../../src/core/index.ts";
3
+ export type FieldCx = {
4
+ locale: Locale;
5
+ key: string;
6
+ value: Lit;
7
+ put(value: Lit): void;
8
+ screen: string;
9
+ block?: string | undefined;
10
+ file?: OnFile | undefined;
11
+ hold(sent: unknown, wait: {
12
+ up: number;
13
+ failed: number;
14
+ }): void;
15
+ send?: ((value: unknown) => unknown) | undefined;
16
+ found?: Seek | undefined;
17
+ };
18
+ export type FieldView<F = Field> = {
19
+ row?: string;
20
+ group?: boolean;
21
+ waits?: boolean;
22
+ draw(field: F, c: FieldCx, attrs: Record<string, unknown>): ReactNode;
23
+ sent?(field: F, value: Lit): unknown;
24
+ };
25
+ export declare const word: (c: {
26
+ locale: Locale;
27
+ }, key: string) => string;
@@ -0,0 +1,3 @@
1
+ import type { PickerField } from "../../../src/core/index.ts";
2
+ import type { FieldView } from "./_view.ts";
3
+ export declare const picker: FieldView<PickerField>;
@@ -0,0 +1,3 @@
1
+ import { type ScanField } from "../../../src/core/index.ts";
2
+ import { type FieldView } from "./_view.ts";
3
+ export declare const scan: FieldView<ScanField>;
@@ -0,0 +1,14 @@
1
+ import { type SearchField } from "../../../src/core/index.ts";
2
+ import { type FieldCx, type FieldView } from "./_view.ts";
3
+ type Search = Omit<SearchField, "value"> & {
4
+ value?: unknown;
5
+ };
6
+ declare function Search({ x, c, attrs }: {
7
+ x: Search;
8
+ c: FieldCx;
9
+ attrs: Record<string, unknown>;
10
+ }): import("react").ReactElement<{
11
+ className: string | undefined;
12
+ }, string | import("react").JSXElementConstructor<any>>;
13
+ export declare const search: FieldView<Search>;
14
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { SecretField } from "../../../src/core/index.ts";
2
+ import { type FieldView } from "./_view.ts";
3
+ export declare const secret: FieldView<Omit<SecretField, "value">>;
@@ -0,0 +1,5 @@
1
+ import { type Field } from "../../../src/core/index.ts";
2
+ import type { FieldView } from "./_view.ts";
3
+ export declare const slider: FieldView<Extract<Field, {
4
+ type: "slider";
5
+ }>>;
@@ -0,0 +1,3 @@
1
+ import type { TextField } from "../../../src/core/index.ts";
2
+ import type { FieldView } from "./_view.ts";
3
+ export declare const text: FieldView<TextField>;
@@ -0,0 +1,3 @@
1
+ import type { ToggleField } from "../../../src/core/index.ts";
2
+ import type { FieldView } from "./_view.ts";
3
+ export declare const toggle: FieldView<ToggleField>;
@@ -0,0 +1,7 @@
1
+ import { type ReactNode } from "react";
2
+ import { type FileRow, type UploadField } from "../../../src/core/index.ts";
3
+ import { type FieldView } from "./_view.ts";
4
+ export declare function item(line: string, r: FileRow, w: (k: string) => string, drop: (r: FileRow) => void, again: (r: FileRow) => void, more?: ReactNode[]): import("react").ReactElement<{
5
+ className: string | undefined;
6
+ }, string | import("react").JSXElementConstructor<any>>;
7
+ export declare const upload: FieldView<UploadField>;
@@ -0,0 +1,2 @@
1
+ import type { FieldView } from "../fields/_view.ts";
2
+ export declare const views: Record<string, FieldView | undefined>;
@@ -0,0 +1,2 @@
1
+ import type { Views } from "../block.ts";
2
+ export declare const views: Views;
@@ -0,0 +1,7 @@
1
+ import { type ReactNode } from "react";
2
+ export type Attrs = Record<string, unknown> & {
3
+ className?: string | undefined;
4
+ };
5
+ export declare const h: (tag: string, cls: string, attrs: Attrs | null, ...kids: ReactNode[]) => import("react").ReactElement<{
6
+ className: string | undefined;
7
+ }, string | import("react").JSXElementConstructor<any>>;
@@ -0,0 +1,3 @@
1
+ export { Arrange, type ArrangeProps } from "./arrange.ts";
2
+ export { BlocksView, native, type AppKinds, type BlocksViewProps } from "./view.ts";
3
+ export type { Go, IslandProps, Islands, KindProps, Post, Report } from "./act.ts";
@@ -0,0 +1,7 @@
1
+ import { type ReactNode } from "react";
2
+ import type { Of } from "../../src/core/index.ts";
3
+ import { type Attrs } from "./h.ts";
4
+ export declare function Isle({ b, attrs }: {
5
+ b: Of<"island">;
6
+ attrs: Attrs;
7
+ }): ReactNode;
@@ -0,0 +1,5 @@
1
+ import type { Button } from "../../../src/core/index.ts";
2
+ import { type V } from "../draw.ts";
3
+ export declare function button({ b, hooks }: V<Button>): import("react").ReactElement<{
4
+ className: string | undefined;
5
+ }, string | import("react").JSXElementConstructor<any>>;
@@ -0,0 +1,5 @@
1
+ import type { Card } from "../../../src/core/index.ts";
2
+ import { type V } from "../draw.ts";
3
+ export declare function card({ b, hooks }: V<Card>): import("react").ReactElement<{
4
+ className: string | undefined;
5
+ }, string | import("react").JSXElementConstructor<any>>;
@@ -0,0 +1,5 @@
1
+ import type { Chips } from "../../../src/core/index.ts";
2
+ import { type V } from "../draw.ts";
3
+ export declare function chips({ b, hooks }: V<Chips>): import("react").ReactElement<{
4
+ className: string | undefined;
5
+ }, string | import("react").JSXElementConstructor<any>>;
@@ -0,0 +1,5 @@
1
+ import type { Choice } from "../../../src/core/index.ts";
2
+ import { type V } from "../draw.ts";
3
+ export declare function choice({ b, hooks }: V<Choice>): import("react").ReactElement<{
4
+ className: string | undefined;
5
+ }, string | import("react").JSXElementConstructor<any>>;
@@ -0,0 +1,5 @@
1
+ import { type Composer } from "../../../src/core/index.ts";
2
+ import { type V } from "../draw.ts";
3
+ export declare function composer({ b, hooks }: V<Composer>): import("react").ReactElement<{
4
+ className: string | undefined;
5
+ }, string | import("react").JSXElementConstructor<any>>;
@@ -0,0 +1,5 @@
1
+ import type { Form } from "../../../src/core/index.ts";
2
+ import { type V } from "../draw.ts";
3
+ export declare function config({ b, hooks }: V<Form>): import("react").ReactElement<{
4
+ className: string | undefined;
5
+ }, string | import("react").JSXElementConstructor<any>>;
@@ -0,0 +1,7 @@
1
+ import type { Diagram } from "../../../src/core/index.ts";
2
+ import { type V } from "../draw.ts";
3
+ export declare function diagram({ b, hooks }: V<Diagram>): import("react").FunctionComponentElement<{
4
+ b: import("../block.ts").Blk;
5
+ }> | import("react").ReactElement<{
6
+ className: string | undefined;
7
+ }, string | import("react").JSXElementConstructor<any>>;
@@ -0,0 +1,7 @@
1
+ import type { Diff } from "../../../src/core/index.ts";
2
+ import type { V } from "../draw.ts";
3
+ export declare function diff({ b, hooks }: V<Diff>): import("react").FunctionComponentElement<{
4
+ b: import("../block.ts").Blk;
5
+ }> | import("react").ReactElement<{
6
+ className: string | undefined;
7
+ }, string | import("react").JSXElementConstructor<any>>;
@@ -0,0 +1,5 @@
1
+ import type { Editor } from "../../../src/core/index.ts";
2
+ import type { V } from "../draw.ts";
3
+ export declare function editor({ b, hooks }: V<Editor>): import("react").ReactElement<{
4
+ className: string | undefined;
5
+ }, string | import("react").JSXElementConstructor<any>>;
@@ -0,0 +1,22 @@
1
+ import { type Field, type Form } from "../../../src/core/index.ts";
2
+ import { type Ctx } from "../act.ts";
3
+ import { type V } from "../draw.ts";
4
+ type Wait = {
5
+ up: number;
6
+ failed: number;
7
+ };
8
+ export type Held = {
9
+ sent: Record<string, unknown>;
10
+ wait(name: string, w: Wait): void;
11
+ block?: string | undefined;
12
+ send?: ((name: string, v: unknown) => unknown) | undefined;
13
+ solo?: boolean;
14
+ };
15
+ export declare function field(x: Field, key: string, cx: Ctx, held: Held, shown?: [string, string]): import("react").ReactElement<{
16
+ className: string | undefined;
17
+ }, string | import("react").JSXElementConstructor<any>>;
18
+ export declare function values(fields: Field[], sent: Record<string, unknown>, cx: Ctx): Record<string, unknown>;
19
+ export declare function form({ b, hooks }: V<Form>): import("react").ReactElement<{
20
+ className: string | undefined;
21
+ }, string | import("react").JSXElementConstructor<any>>;
22
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { Hero } from "../../../src/core/index.ts";
2
+ import { type V } from "../draw.ts";
3
+ export declare function hero({ b, hooks }: V<Hero>): import("react").ReactElement<{
4
+ className: string | undefined;
5
+ }, string | import("react").JSXElementConstructor<any>>;
@@ -0,0 +1,5 @@
1
+ import { type Images } from "../../../src/core/index.ts";
2
+ import { type V } from "../draw.ts";
3
+ export declare function images({ b, hooks }: V<Images>): import("react").ReactElement<{
4
+ className: string | undefined;
5
+ }, string | import("react").JSXElementConstructor<any>>;
@@ -0,0 +1,5 @@
1
+ import type { Import } from "../../../src/core/index.ts";
2
+ import type { V } from "../draw.ts";
3
+ export declare function import_({ b, hooks }: V<Import>): import("react").ReactElement<{
4
+ className: string | undefined;
5
+ }, string | import("react").JSXElementConstructor<any>>;
@@ -0,0 +1,6 @@
1
+ import { type List } from "../../../src/core/index.ts";
2
+ import { type V } from "../draw.ts";
3
+ export declare const Tiles: import("react").Context<readonly unknown[]>;
4
+ export declare function list({ b, hooks }: V<List>): import("react").ReactElement<{
5
+ className: string | undefined;
6
+ }, string | import("react").JSXElementConstructor<any>>;
@@ -0,0 +1,6 @@
1
+ import { type ReactNode } from "react";
2
+ import type { Media } from "../../../src/core/index.ts";
3
+ import type { V } from "../draw.ts";
4
+ import { type Attrs } from "../h.ts";
5
+ export declare function still(b: Media, hooks: Attrs): ReactNode;
6
+ export declare function media({ b, hooks }: V<Media>): ReactNode;
@@ -0,0 +1,5 @@
1
+ import { type Message } from "../../../src/core/index.ts";
2
+ import { type V } from "../draw.ts";
3
+ export declare function message({ b, hooks }: V<Message>): import("react").ReactElement<{
4
+ className: string | undefined;
5
+ }, string | import("react").JSXElementConstructor<any>>;
@@ -0,0 +1,5 @@
1
+ import type { Modal } from "../../../src/core/index.ts";
2
+ import { type V } from "../draw.ts";
3
+ export declare function modal({ b, hooks }: V<Modal>): import("react").ReactElement<{
4
+ className: string | undefined;
5
+ }, string | import("react").JSXElementConstructor<any>>;
@@ -0,0 +1,5 @@
1
+ import { type Nav } from "../../../src/core/index.ts";
2
+ import type { V } from "../draw.ts";
3
+ export declare function nav({ b, hooks }: V<Nav>): import("react").ReactElement<{
4
+ className: string | undefined;
5
+ }, string | import("react").JSXElementConstructor<any>>;
@@ -0,0 +1,5 @@
1
+ import { type Pages } from "../../../src/core/index.ts";
2
+ import { type V } from "../draw.ts";
3
+ export declare function pages({ b, hooks }: V<Pages>): import("react").ReactElement<{
4
+ className: string | undefined;
5
+ }, string | import("react").JSXElementConstructor<any>>;
@@ -0,0 +1,5 @@
1
+ import { type Prose } from "../../../src/core/index.ts";
2
+ import type { V } from "../draw.ts";
3
+ export declare function prose({ b, hooks }: V<Prose>): import("react").ReactElement<{
4
+ className: string | undefined;
5
+ }, string | import("react").JSXElementConstructor<any>>;
@@ -0,0 +1,5 @@
1
+ import type { Row } from "../../../src/core/index.ts";
2
+ import { type V } from "../draw.ts";
3
+ export declare function row({ b, hooks }: V<Row>): import("react").ReactElement<{
4
+ className: string | undefined;
5
+ }, string | import("react").JSXElementConstructor<any>>;
@@ -0,0 +1,5 @@
1
+ import type { Run } from "../../../src/core/index.ts";
2
+ import { type V } from "../draw.ts";
3
+ export declare function run({ b, hooks }: V<Run>): import("react").ReactElement<{
4
+ className: string | undefined;
5
+ }, string | import("react").JSXElementConstructor<any>>;
@@ -0,0 +1,5 @@
1
+ import type { Scene } from "../../../src/core/index.ts";
2
+ import { type V } from "../draw.ts";
3
+ export declare function scene({ b, hooks }: V<Scene>): import("react").ReactElement<{
4
+ className: string | undefined;
5
+ }, string | import("react").JSXElementConstructor<any>>;
@@ -0,0 +1,5 @@
1
+ import { type Screen } from "../../../src/core/index.ts";
2
+ import { type V } from "../draw.ts";
3
+ export declare function screen({ b, hooks }: V<Screen>): import("react").ReactElement<{
4
+ className: string | undefined;
5
+ }, string | import("react").JSXElementConstructor<any>>;
@@ -0,0 +1,5 @@
1
+ import type { Secret } from "../../../src/core/index.ts";
2
+ import { type V } from "../draw.ts";
3
+ export declare function secret({ b, hooks }: V<Secret>): import("react").ReactElement<{
4
+ className: string | undefined;
5
+ }, string | import("react").JSXElementConstructor<any>>;
@@ -0,0 +1,5 @@
1
+ import type { Section } from "../../../src/core/index.ts";
2
+ import type { V } from "../draw.ts";
3
+ export declare function section({ b, hooks }: V<Section>): import("react").ReactElement<{
4
+ className: string | undefined;
5
+ }, string | import("react").JSXElementConstructor<any>>;
@@ -0,0 +1 @@
1
+ export { modal as sheet } from "./modal.ts";
@@ -0,0 +1,5 @@
1
+ import { type Sidebar } from "../../../src/core/index.ts";
2
+ import type { V } from "../draw.ts";
3
+ export declare function sidebar({ b, hooks }: V<Sidebar>): import("react").ReactElement<{
4
+ className: string | undefined;
5
+ }, string | import("react").JSXElementConstructor<any>>;
@@ -0,0 +1,5 @@
1
+ import type { Stat } from "../../../src/core/index.ts";
2
+ import { type V } from "../draw.ts";
3
+ export declare function stat({ b, hooks }: V<Stat>): import("react").ReactElement<{
4
+ className: string | undefined;
5
+ }, string | import("react").JSXElementConstructor<any>>;
@@ -0,0 +1,7 @@
1
+ import type { Steps } from "../../../src/core/index.ts";
2
+ import { type V } from "../draw.ts";
3
+ export declare function steps({ b, hooks }: V<Steps>): import("react").FunctionComponentElement<{
4
+ b: import("../block.ts").Blk;
5
+ }> | import("react").ReactElement<{
6
+ className: string | undefined;
7
+ }, string | import("react").JSXElementConstructor<any>>;
@@ -0,0 +1,5 @@
1
+ import type { Table } from "../../../src/core/index.ts";
2
+ import { type V } from "../draw.ts";
3
+ export declare function table({ b, hooks }: V<Table>): import("react").ReactElement<{
4
+ className: string | undefined;
5
+ }, string | import("react").JSXElementConstructor<any>>;
@@ -0,0 +1,5 @@
1
+ import type { Text } from "../../../src/core/index.ts";
2
+ import { type V } from "../draw.ts";
3
+ export declare function text({ b, hooks }: V<Text>): import("react").ReactElement<{
4
+ className: string | undefined;
5
+ }, string | import("react").JSXElementConstructor<any>>;