knobkit 0.0.1

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 (361) hide show
  1. package/LICENSE +21 -0
  2. package/dist/assets/cell-renderer-CLTRlCa5-DIlwS99c.js +1 -0
  3. package/dist/assets/chart-D8ctp-_1.js +36 -0
  4. package/dist/assets/code-BMuLQBYq.js +2 -0
  5. package/dist/assets/column.service-C6hByxPy-XG9X0y3N.js +1 -0
  6. package/dist/assets/debounce-PCRWZliA-BjJpj_P7.js +32 -0
  7. package/dist/assets/dimension.helpers-CGKwSvw6-D_czicbS.js +1 -0
  8. package/dist/assets/dist-1hsZpGRf.js +23 -0
  9. package/dist/assets/dist-B-y4Etc5.js +1 -0
  10. package/dist/assets/dist-B8BXgMDk.js +10 -0
  11. package/dist/assets/dist-BJlXPLNt.js +1 -0
  12. package/dist/assets/dist-ByhR2UY_.js +1 -0
  13. package/dist/assets/dist-C0bxYHYH.js +2 -0
  14. package/dist/assets/dist-C8dagUDy.js +6 -0
  15. package/dist/assets/dist-CtLpohkg.js +1 -0
  16. package/dist/assets/dist-D00mNtIr.js +1 -0
  17. package/dist/assets/dist-Dh1Dvy3h.js +1 -0
  18. package/dist/assets/dist-DlwQ1Qqm.js +1 -0
  19. package/dist/assets/dist-DtZDI7jp.js +1 -0
  20. package/dist/assets/dist-thZFs69d.js +9 -0
  21. package/dist/assets/edit.utils-Dnnbd0xG-OAxDw8WC.js +1 -0
  22. package/dist/assets/events-BvSmBueA-4kqQ57iN.js +1 -0
  23. package/dist/assets/filter.button-BFwo1uvz-CyvQhOO5.js +1 -0
  24. package/dist/assets/header-cell-renderer-BMmXRsd_-BHbC7fao.js +1 -0
  25. package/dist/assets/index-Db3qZoW5-peeY7EGw.js +1 -0
  26. package/dist/assets/markdown-dDCgur7g.js +29 -0
  27. package/dist/assets/revo-grid.entry-CfI6s-uT.js +1 -0
  28. package/dist/assets/revogr-attribution_7.entry-6fUjzImt.js +1 -0
  29. package/dist/assets/revogr-clipboard_3.entry-DmI7LkER.js +2 -0
  30. package/dist/assets/revogr-data_4.entry-CYZIiXNw.js +1 -0
  31. package/dist/assets/revogr-filter-panel.entry-TmQHTQxw.js +1 -0
  32. package/dist/assets/table-Zn7rpfG-.js +1 -0
  33. package/dist/assets/text-editor-C3RUSwH5-DuDr9wKc.js +1 -0
  34. package/dist/assets/theme.service-BmnDvr6P-DftEgmbe.js +3 -0
  35. package/dist/assets/throttle-CaUDyxyU-Djj__DCp.js +1 -0
  36. package/dist/assets/viewport.helpers-CoCAvmZs-ByVRjjkF.js +1 -0
  37. package/dist/assets/viewport.store-_c579YyM-B_ZSqqka.js +1 -0
  38. package/dist/cli/config.d.ts +5 -0
  39. package/dist/cli/config.js +82 -0
  40. package/dist/cli/index.d.ts +2 -0
  41. package/dist/cli/index.js +77 -0
  42. package/dist/cli/mount.d.ts +2 -0
  43. package/dist/cli/mount.js +26 -0
  44. package/dist/cli/serve.d.ts +1 -0
  45. package/dist/cli/serve.js +21 -0
  46. package/dist/client/app.d.ts +8 -0
  47. package/dist/client/app.js +40 -0
  48. package/dist/client/context.d.ts +2 -0
  49. package/dist/client/context.js +16 -0
  50. package/dist/client/mount.d.ts +3 -0
  51. package/dist/client/mount.js +42 -0
  52. package/dist/client/runtime.d.ts +19 -0
  53. package/dist/client/runtime.js +88 -0
  54. package/dist/client/view.d.ts +12 -0
  55. package/dist/client/view.js +1 -0
  56. package/dist/client/widgets/accordion/index.d.ts +5 -0
  57. package/dist/client/widgets/accordion/index.js +8 -0
  58. package/dist/client/widgets/annotated-image/index.d.ts +8 -0
  59. package/dist/client/widgets/annotated-image/index.js +34 -0
  60. package/dist/client/widgets/audio/index.d.ts +5 -0
  61. package/dist/client/widgets/audio/index.js +5 -0
  62. package/dist/client/widgets/button/index.d.ts +4 -0
  63. package/dist/client/widgets/button/index.js +5 -0
  64. package/dist/client/widgets/chart/index.d.ts +5 -0
  65. package/dist/client/widgets/chart/index.js +23 -0
  66. package/dist/client/widgets/chart/lazy.d.ts +3 -0
  67. package/dist/client/widgets/chart/lazy.js +9 -0
  68. package/dist/client/widgets/chat/index.d.ts +6 -0
  69. package/dist/client/widgets/chat/index.js +77 -0
  70. package/dist/client/widgets/checkbox/index.d.ts +6 -0
  71. package/dist/client/widgets/checkbox/index.js +9 -0
  72. package/dist/client/widgets/checkbox-group/index.d.ts +6 -0
  73. package/dist/client/widgets/checkbox-group/index.js +12 -0
  74. package/dist/client/widgets/code/index.d.ts +5 -0
  75. package/dist/client/widgets/code/index.js +101 -0
  76. package/dist/client/widgets/code/lazy.d.ts +3 -0
  77. package/dist/client/widgets/code/lazy.js +10 -0
  78. package/dist/client/widgets/dropdown/index.d.ts +5 -0
  79. package/dist/client/widgets/dropdown/index.js +9 -0
  80. package/dist/client/widgets/file/index.d.ts +6 -0
  81. package/dist/client/widgets/file/index.js +7 -0
  82. package/dist/client/widgets/frame/index.d.ts +6 -0
  83. package/dist/client/widgets/frame/index.js +11 -0
  84. package/dist/client/widgets/gallery/index.d.ts +6 -0
  85. package/dist/client/widgets/gallery/index.js +8 -0
  86. package/dist/client/widgets/highlighted-text/index.d.ts +7 -0
  87. package/dist/client/widgets/highlighted-text/index.js +20 -0
  88. package/dist/client/widgets/html/index.d.ts +4 -0
  89. package/dist/client/widgets/html/index.js +8 -0
  90. package/dist/client/widgets/image/index.d.ts +4 -0
  91. package/dist/client/widgets/image/index.js +4 -0
  92. package/dist/client/widgets/json/index.d.ts +4 -0
  93. package/dist/client/widgets/json/index.js +4 -0
  94. package/dist/client/widgets/label/index.d.ts +7 -0
  95. package/dist/client/widgets/label/index.js +8 -0
  96. package/dist/client/widgets/layout/index.d.ts +4 -0
  97. package/dist/client/widgets/layout/index.js +7 -0
  98. package/dist/client/widgets/log/index.d.ts +4 -0
  99. package/dist/client/widgets/log/index.js +4 -0
  100. package/dist/client/widgets/mic/index.d.ts +6 -0
  101. package/dist/client/widgets/mic/index.js +70 -0
  102. package/dist/client/widgets/number/index.d.ts +5 -0
  103. package/dist/client/widgets/number/index.js +8 -0
  104. package/dist/client/widgets/output/index.d.ts +6 -0
  105. package/dist/client/widgets/output/index.js +13 -0
  106. package/dist/client/widgets/output/markdown.d.ts +3 -0
  107. package/dist/client/widgets/output/markdown.js +8 -0
  108. package/dist/client/widgets/progress/index.d.ts +6 -0
  109. package/dist/client/widgets/progress/index.js +6 -0
  110. package/dist/client/widgets/radio/index.d.ts +6 -0
  111. package/dist/client/widgets/radio/index.js +10 -0
  112. package/dist/client/widgets/registry.d.ts +2 -0
  113. package/dist/client/widgets/registry.js +69 -0
  114. package/dist/client/widgets/slider/index.d.ts +6 -0
  115. package/dist/client/widgets/slider/index.js +9 -0
  116. package/dist/client/widgets/table/index.d.ts +6 -0
  117. package/dist/client/widgets/table/index.js +72 -0
  118. package/dist/client/widgets/table/lazy.d.ts +3 -0
  119. package/dist/client/widgets/table/lazy.js +16 -0
  120. package/dist/client/widgets/tabs/index.d.ts +5 -0
  121. package/dist/client/widgets/tabs/index.js +10 -0
  122. package/dist/client/widgets/text/index.d.ts +6 -0
  123. package/dist/client/widgets/text/index.js +10 -0
  124. package/dist/client/widgets/upload/index.d.ts +6 -0
  125. package/dist/client/widgets/upload/index.js +16 -0
  126. package/dist/client/widgets/video/index.d.ts +5 -0
  127. package/dist/client/widgets/video/index.js +5 -0
  128. package/dist/client/widgets/webcam/index.d.ts +6 -0
  129. package/dist/client/widgets/webcam/index.js +62 -0
  130. package/dist/client.css +1 -0
  131. package/dist/client.js +11 -0
  132. package/dist/knobkit.browser.css +2 -0
  133. package/dist/knobkit.browser.js +151 -0
  134. package/dist/lib/bound.d.ts +12 -0
  135. package/dist/lib/bound.js +10 -0
  136. package/dist/lib/controls.d.ts +9 -0
  137. package/dist/lib/controls.js +35 -0
  138. package/dist/lib/ctx.d.ts +9 -0
  139. package/dist/lib/ctx.js +22 -0
  140. package/dist/lib/declare.d.ts +18 -0
  141. package/dist/lib/declare.js +43 -0
  142. package/dist/lib/event.d.ts +2 -0
  143. package/dist/lib/event.js +9 -0
  144. package/dist/lib/index.d.ts +10 -0
  145. package/dist/lib/index.js +6 -0
  146. package/dist/lib/knobkit.d.ts +19 -0
  147. package/dist/lib/knobkit.js +48 -0
  148. package/dist/lib/on.d.ts +2 -0
  149. package/dist/lib/on.js +1 -0
  150. package/dist/lib/stream.d.ts +1 -0
  151. package/dist/lib/stream.js +33 -0
  152. package/dist/lib/types.d.ts +48 -0
  153. package/dist/lib/types.js +1 -0
  154. package/dist/lib/widget.d.ts +7 -0
  155. package/dist/lib/widget.js +4 -0
  156. package/dist/lib/widgets/annotated-image.d.ts +14 -0
  157. package/dist/lib/widgets/annotated-image.js +16 -0
  158. package/dist/lib/widgets/audio.d.ts +10 -0
  159. package/dist/lib/widgets/audio.js +13 -0
  160. package/dist/lib/widgets/button.d.ts +11 -0
  161. package/dist/lib/widgets/button.js +17 -0
  162. package/dist/lib/widgets/chart.d.ts +20 -0
  163. package/dist/lib/widgets/chart.js +24 -0
  164. package/dist/lib/widgets/chat.d.ts +26 -0
  165. package/dist/lib/widgets/chat.js +24 -0
  166. package/dist/lib/widgets/checkbox-group.d.ts +4 -0
  167. package/dist/lib/widgets/checkbox-group.js +5 -0
  168. package/dist/lib/widgets/checkbox.d.ts +4 -0
  169. package/dist/lib/widgets/checkbox.js +4 -0
  170. package/dist/lib/widgets/code.d.ts +5 -0
  171. package/dist/lib/widgets/code.js +10 -0
  172. package/dist/lib/widgets/dropdown.d.ts +4 -0
  173. package/dist/lib/widgets/dropdown.js +4 -0
  174. package/dist/lib/widgets/embed.d.ts +5 -0
  175. package/dist/lib/widgets/embed.js +23 -0
  176. package/dist/lib/widgets/file.d.ts +11 -0
  177. package/dist/lib/widgets/file.js +15 -0
  178. package/dist/lib/widgets/frame.d.ts +18 -0
  179. package/dist/lib/widgets/frame.js +25 -0
  180. package/dist/lib/widgets/gallery.d.ts +12 -0
  181. package/dist/lib/widgets/gallery.js +17 -0
  182. package/dist/lib/widgets/highlighted-text.d.ts +12 -0
  183. package/dist/lib/widgets/highlighted-text.js +15 -0
  184. package/dist/lib/widgets/html.d.ts +9 -0
  185. package/dist/lib/widgets/html.js +12 -0
  186. package/dist/lib/widgets/image.d.ts +7 -0
  187. package/dist/lib/widgets/image.js +12 -0
  188. package/dist/lib/widgets/index.d.ts +31 -0
  189. package/dist/lib/widgets/index.js +31 -0
  190. package/dist/lib/widgets/json.d.ts +7 -0
  191. package/dist/lib/widgets/json.js +12 -0
  192. package/dist/lib/widgets/label.d.ts +15 -0
  193. package/dist/lib/widgets/label.js +18 -0
  194. package/dist/lib/widgets/layout.d.ts +21 -0
  195. package/dist/lib/widgets/layout.js +29 -0
  196. package/dist/lib/widgets/log.d.ts +8 -0
  197. package/dist/lib/widgets/log.js +15 -0
  198. package/dist/lib/widgets/mic.d.ts +19 -0
  199. package/dist/lib/widgets/mic.js +28 -0
  200. package/dist/lib/widgets/number.d.ts +5 -0
  201. package/dist/lib/widgets/number.js +4 -0
  202. package/dist/lib/widgets/output.d.ts +10 -0
  203. package/dist/lib/widgets/output.js +13 -0
  204. package/dist/lib/widgets/progress.d.ts +10 -0
  205. package/dist/lib/widgets/progress.js +15 -0
  206. package/dist/lib/widgets/radio.d.ts +4 -0
  207. package/dist/lib/widgets/radio.js +5 -0
  208. package/dist/lib/widgets/slider.d.ts +6 -0
  209. package/dist/lib/widgets/slider.js +6 -0
  210. package/dist/lib/widgets/table.d.ts +32 -0
  211. package/dist/lib/widgets/table.js +36 -0
  212. package/dist/lib/widgets/text.d.ts +4 -0
  213. package/dist/lib/widgets/text.js +4 -0
  214. package/dist/lib/widgets/upload.d.ts +3 -0
  215. package/dist/lib/widgets/upload.js +5 -0
  216. package/dist/lib/widgets/value.d.ts +9 -0
  217. package/dist/lib/widgets/value.js +20 -0
  218. package/dist/lib/widgets/video.d.ts +12 -0
  219. package/dist/lib/widgets/video.js +14 -0
  220. package/dist/lib/widgets/webcam.d.ts +21 -0
  221. package/dist/lib/widgets/webcam.js +29 -0
  222. package/dist/server/context.d.ts +2 -0
  223. package/dist/server/context.js +10 -0
  224. package/dist/server/serve.d.ts +5 -0
  225. package/dist/server/serve.js +131 -0
  226. package/package.json +71 -0
  227. package/src/cli/config.ts +83 -0
  228. package/src/cli/index.ts +82 -0
  229. package/src/cli/mount.ts +25 -0
  230. package/src/cli/serve.ts +22 -0
  231. package/src/client/app.test.tsx +70 -0
  232. package/src/client/app.tsx +62 -0
  233. package/src/client/browser-runtime.test.ts +22 -0
  234. package/src/client/browser.ts +3 -0
  235. package/src/client/context.ts +17 -0
  236. package/src/client/embed.test.tsx +58 -0
  237. package/src/client/entry.tsx +25 -0
  238. package/src/client/mount.test.tsx +36 -0
  239. package/src/client/mount.tsx +48 -0
  240. package/src/client/runtime.test.ts +64 -0
  241. package/src/client/runtime.ts +112 -0
  242. package/src/client/serve-stub.ts +3 -0
  243. package/src/client/styles.css +131 -0
  244. package/src/client/view.ts +16 -0
  245. package/src/client/widgets/accordion/accordion.css +35 -0
  246. package/src/client/widgets/accordion/index.tsx +17 -0
  247. package/src/client/widgets/annotated-image/annotated-image.css +62 -0
  248. package/src/client/widgets/annotated-image/index.tsx +73 -0
  249. package/src/client/widgets/audio/audio.css +6 -0
  250. package/src/client/widgets/audio/index.tsx +6 -0
  251. package/src/client/widgets/button/button.css +25 -0
  252. package/src/client/widgets/button/index.tsx +11 -0
  253. package/src/client/widgets/chart/chart.css +12 -0
  254. package/src/client/widgets/chart/index.tsx +63 -0
  255. package/src/client/widgets/chart/lazy.tsx +15 -0
  256. package/src/client/widgets/chat/chat.css +97 -0
  257. package/src/client/widgets/chat/index.tsx +121 -0
  258. package/src/client/widgets/checkbox/checkbox.css +15 -0
  259. package/src/client/widgets/checkbox/index.tsx +15 -0
  260. package/src/client/widgets/checkbox-group/checkbox-group.css +20 -0
  261. package/src/client/widgets/checkbox-group/index.tsx +22 -0
  262. package/src/client/widgets/code/code.css +31 -0
  263. package/src/client/widgets/code/index.tsx +108 -0
  264. package/src/client/widgets/code/lazy.tsx +16 -0
  265. package/src/client/widgets/dropdown/dropdown.css +0 -0
  266. package/src/client/widgets/dropdown/index.tsx +19 -0
  267. package/src/client/widgets/file/file.css +26 -0
  268. package/src/client/widgets/file/index.tsx +12 -0
  269. package/src/client/widgets/frame/frame.css +17 -0
  270. package/src/client/widgets/frame/index.tsx +15 -0
  271. package/src/client/widgets/gallery/gallery.css +26 -0
  272. package/src/client/widgets/gallery/index.tsx +18 -0
  273. package/src/client/widgets/highlighted-text/highlighted-text.css +21 -0
  274. package/src/client/widgets/highlighted-text/index.tsx +42 -0
  275. package/src/client/widgets/html/index.tsx +8 -0
  276. package/src/client/widgets/image/index.tsx +5 -0
  277. package/src/client/widgets/json/index.tsx +5 -0
  278. package/src/client/widgets/json/json.css +0 -0
  279. package/src/client/widgets/label/index.tsx +20 -0
  280. package/src/client/widgets/label/label.css +39 -0
  281. package/src/client/widgets/layout/index.tsx +14 -0
  282. package/src/client/widgets/log/index.tsx +5 -0
  283. package/src/client/widgets/log/log.css +0 -0
  284. package/src/client/widgets/mic/index.tsx +85 -0
  285. package/src/client/widgets/mic/mic.css +8 -0
  286. package/src/client/widgets/number/index.tsx +10 -0
  287. package/src/client/widgets/number/number.css +0 -0
  288. package/src/client/widgets/output/index.tsx +19 -0
  289. package/src/client/widgets/output/markdown.tsx +12 -0
  290. package/src/client/widgets/output/output.css +75 -0
  291. package/src/client/widgets/progress/index.tsx +14 -0
  292. package/src/client/widgets/progress/progress.css +26 -0
  293. package/src/client/widgets/radio/index.tsx +20 -0
  294. package/src/client/widgets/radio/radio.css +20 -0
  295. package/src/client/widgets/registry.tsx +71 -0
  296. package/src/client/widgets/slider/index.tsx +23 -0
  297. package/src/client/widgets/slider/slider.css +18 -0
  298. package/src/client/widgets/table/index.tsx +95 -0
  299. package/src/client/widgets/table/lazy.tsx +23 -0
  300. package/src/client/widgets/table/table.css +15 -0
  301. package/src/client/widgets/tabs/index.tsx +28 -0
  302. package/src/client/widgets/tabs/tabs.css +30 -0
  303. package/src/client/widgets/text/index.tsx +16 -0
  304. package/src/client/widgets/text/text.css +21 -0
  305. package/src/client/widgets/upload/index.tsx +30 -0
  306. package/src/client/widgets/upload/upload.css +30 -0
  307. package/src/client/widgets/video/index.tsx +10 -0
  308. package/src/client/widgets/video/video.css +8 -0
  309. package/src/client/widgets/webcam/index.tsx +81 -0
  310. package/src/client/widgets/webcam/webcam.css +46 -0
  311. package/src/css.d.ts +1 -0
  312. package/src/env.d.ts +1 -0
  313. package/src/lib/bound.ts +30 -0
  314. package/src/lib/controls.ts +36 -0
  315. package/src/lib/ctx.ts +31 -0
  316. package/src/lib/declare.test.ts +46 -0
  317. package/src/lib/declare.ts +74 -0
  318. package/src/lib/event.ts +12 -0
  319. package/src/lib/index.ts +21 -0
  320. package/src/lib/knobkit.ts +57 -0
  321. package/src/lib/on.ts +3 -0
  322. package/src/lib/stream.ts +38 -0
  323. package/src/lib/types.ts +63 -0
  324. package/src/lib/widget.ts +11 -0
  325. package/src/lib/widgets/annotated-image.ts +34 -0
  326. package/src/lib/widgets/audio.ts +20 -0
  327. package/src/lib/widgets/button.ts +27 -0
  328. package/src/lib/widgets/chart.ts +44 -0
  329. package/src/lib/widgets/chat.ts +43 -0
  330. package/src/lib/widgets/checkbox-group.ts +6 -0
  331. package/src/lib/widgets/checkbox.ts +5 -0
  332. package/src/lib/widgets/code.ts +11 -0
  333. package/src/lib/widgets/dropdown.ts +5 -0
  334. package/src/lib/widgets/embed.ts +26 -0
  335. package/src/lib/widgets/file.ts +23 -0
  336. package/src/lib/widgets/frame.ts +36 -0
  337. package/src/lib/widgets/gallery.ts +29 -0
  338. package/src/lib/widgets/highlighted-text.ts +29 -0
  339. package/src/lib/widgets/html.ts +18 -0
  340. package/src/lib/widgets/image.ts +18 -0
  341. package/src/lib/widgets/index.ts +31 -0
  342. package/src/lib/widgets/json.ts +18 -0
  343. package/src/lib/widgets/label.ts +29 -0
  344. package/src/lib/widgets/layout.ts +47 -0
  345. package/src/lib/widgets/log.ts +22 -0
  346. package/src/lib/widgets/mic.ts +42 -0
  347. package/src/lib/widgets/number.ts +5 -0
  348. package/src/lib/widgets/output.ts +20 -0
  349. package/src/lib/widgets/progress.ts +21 -0
  350. package/src/lib/widgets/radio.ts +6 -0
  351. package/src/lib/widgets/slider.ts +7 -0
  352. package/src/lib/widgets/table.ts +58 -0
  353. package/src/lib/widgets/text.ts +5 -0
  354. package/src/lib/widgets/upload.ts +6 -0
  355. package/src/lib/widgets/value.ts +28 -0
  356. package/src/lib/widgets/video.ts +22 -0
  357. package/src/lib/widgets/webcam.ts +46 -0
  358. package/src/server/context.ts +12 -0
  359. package/src/server/serve.test.ts +121 -0
  360. package/src/server/serve.ts +130 -0
  361. package/tsconfig.base.json +14 -0
@@ -0,0 +1,5 @@
1
+ import type { ViewProps } from "../../view.js";
2
+ import type { ValueWidget } from "../../../lib/widgets/value.js";
3
+ export declare function CodeView({ widget, state, emit, set }: ViewProps<ValueWidget<string>, {
4
+ value: string;
5
+ }>): import("react").JSX.Element;
@@ -0,0 +1,101 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ // note: code.css is imported by ./lazy.tsx (the static entry wrapper), not here, so it lands in
3
+ // client.css rather than a split css chunk serve() wouldn't route.
4
+ import { useEffect, useRef } from "react";
5
+ import { EditorState, Compartment, Annotation } from "@codemirror/state";
6
+ import { EditorView, keymap, lineNumbers, highlightActiveLine, highlightActiveLineGutter } from "@codemirror/view";
7
+ import { defaultKeymap, history, historyKeymap, indentWithTab } from "@codemirror/commands";
8
+ import { syntaxHighlighting, defaultHighlightStyle, indentOnInput, bracketMatching } from "@codemirror/language";
9
+ // Each grammar is a dynamic import() so Vite splits it into its own chunk under /assets, served on
10
+ // demand — only the languages an app actually uses are ever sent to the browser. (js/ts/jsx/tsx share
11
+ // one chunk since they're the same package.)
12
+ const LANGS = {
13
+ javascript: () => import("@codemirror/lang-javascript").then((m) => m.javascript()),
14
+ typescript: () => import("@codemirror/lang-javascript").then((m) => m.javascript({ typescript: true })),
15
+ jsx: () => import("@codemirror/lang-javascript").then((m) => m.javascript({ jsx: true })),
16
+ tsx: () => import("@codemirror/lang-javascript").then((m) => m.javascript({ jsx: true, typescript: true })),
17
+ python: () => import("@codemirror/lang-python").then((m) => m.python()),
18
+ html: () => import("@codemirror/lang-html").then((m) => m.html()),
19
+ css: () => import("@codemirror/lang-css").then((m) => m.css()),
20
+ json: () => import("@codemirror/lang-json").then((m) => m.json()),
21
+ markdown: () => import("@codemirror/lang-markdown").then((m) => m.markdown()),
22
+ sql: () => import("@codemirror/lang-sql").then((m) => m.sql()),
23
+ rust: () => import("@codemirror/lang-rust").then((m) => m.rust()),
24
+ cpp: () => import("@codemirror/lang-cpp").then((m) => m.cpp()),
25
+ xml: () => import("@codemirror/lang-xml").then((m) => m.xml()),
26
+ };
27
+ // marks our own doc-replacing dispatches so the update listener doesn't echo them back as edits
28
+ const External = Annotation.define();
29
+ const langOf = (name) => LANGS[name]?.() ?? Promise.resolve([]);
30
+ const editOf = (editable) => [EditorView.editable.of(editable), EditorState.readOnly.of(!editable)];
31
+ export function CodeView({ widget, state, emit, set }) {
32
+ const host = useRef(null);
33
+ const view = useRef(null);
34
+ const lang = useRef(new Compartment());
35
+ const edit = useRef(new Compartment());
36
+ // the editor is built once; route edits through a ref so it always sees the current props
37
+ const onChange = useRef(() => { });
38
+ onChange.current = (v) => {
39
+ set(["value"], v); // local, so reads and the controlled doc reflect typing with no round-trip
40
+ emit(widget.changed(v));
41
+ };
42
+ const language = widget.language ?? "";
43
+ const editable = widget.editable ?? true;
44
+ useEffect(() => {
45
+ const v = new EditorView({
46
+ parent: host.current,
47
+ state: EditorState.create({
48
+ doc: state.value,
49
+ extensions: [
50
+ lineNumbers(),
51
+ highlightActiveLineGutter(),
52
+ highlightActiveLine(),
53
+ history(),
54
+ indentOnInput(),
55
+ bracketMatching(),
56
+ syntaxHighlighting(defaultHighlightStyle, { fallback: true }),
57
+ keymap.of([...defaultKeymap, ...historyKeymap, indentWithTab]),
58
+ lang.current.of([]), // grammar loads async via the [language] effect below
59
+ edit.current.of(editOf(editable)),
60
+ EditorView.updateListener.of((u) => {
61
+ if (!u.docChanged)
62
+ return;
63
+ if (u.transactions.some((tr) => tr.annotation(External)))
64
+ return; // our own sync, not a user edit
65
+ onChange.current(u.state.doc.toString());
66
+ }),
67
+ ],
68
+ }),
69
+ });
70
+ view.current = v;
71
+ return () => v.destroy();
72
+ // mount once; external state / language / editable are synced by the effects below
73
+ // eslint-disable-next-line react-hooks/exhaustive-deps
74
+ }, []);
75
+ // push programmatic value changes (set()/server edit) into the doc without echoing back an edit
76
+ useEffect(() => {
77
+ const v = view.current;
78
+ if (!v)
79
+ return;
80
+ const cur = v.state.doc.toString();
81
+ if (state.value !== cur) {
82
+ v.dispatch({ changes: { from: 0, to: cur.length, insert: state.value }, annotations: External.of(true) });
83
+ }
84
+ }, [state.value]);
85
+ // load the grammar chunk, then swap it into the language compartment; guard against a stale load
86
+ // resolving after the language changed again or the editor unmounted
87
+ useEffect(() => {
88
+ let cancelled = false;
89
+ void langOf(language).then((ext) => {
90
+ if (!cancelled)
91
+ view.current?.dispatch({ effects: lang.current.reconfigure(ext) });
92
+ });
93
+ return () => {
94
+ cancelled = true;
95
+ };
96
+ }, [language]);
97
+ useEffect(() => {
98
+ view.current?.dispatch({ effects: edit.current.reconfigure(editOf(editable)) });
99
+ }, [editable]);
100
+ return _jsx("div", { ref: host, className: `pu-code${editable ? "" : " pu-code-ro"}` });
101
+ }
@@ -0,0 +1,3 @@
1
+ import "./code.css";
2
+ import type { ViewProps } from "../../view.js";
3
+ export declare function CodeView(props: ViewProps): import("react").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "./code.css"; // kept in the entry bundle (client.css) so no /assets css chunk to serve
3
+ import { lazy, Suspense } from "react";
4
+ // CodeMirror (~300KB core + grammar chunks) loads only when an app actually renders a code widget.
5
+ // The registry points at this thin wrapper; the real view + CodeMirror live in a separate chunk.
6
+ // CodeView narrows ViewProps internally; the registry hands it the generic shape, so widen here.
7
+ const Impl = lazy(async () => ({ default: (await import("./index.js")).CodeView }));
8
+ export function CodeView(props) {
9
+ return (_jsx(Suspense, { fallback: _jsx("div", { className: "pu-code" }), children: _jsx(Impl, { ...props }) }));
10
+ }
@@ -0,0 +1,5 @@
1
+ import type { ViewProps } from "../../view.js";
2
+ import type { ValueWidget } from "../../../lib/widgets/value.js";
3
+ export declare function DropdownView({ widget, state, emit, set }: ViewProps<ValueWidget<string>, {
4
+ value: string;
5
+ }>): import("react").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ export function DropdownView({ widget, state, emit, set }) {
3
+ const choices = widget.choices ?? [];
4
+ const update = (v) => {
5
+ set(["value"], v);
6
+ emit(widget.changed(v));
7
+ };
8
+ return (_jsx("select", { className: "pu-input", value: state.value, onChange: (e) => update(e.currentTarget.value), children: choices.map((c) => (_jsx("option", { value: c, children: c }, c))) }));
9
+ }
@@ -0,0 +1,6 @@
1
+ import "./file.css";
2
+ import type { ViewProps } from "../../view.js";
3
+ export declare function FileView({ state }: ViewProps<any, {
4
+ name: string;
5
+ url: string;
6
+ }>): import("react").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import "./file.css";
3
+ export function FileView({ state }) {
4
+ if (!state.url)
5
+ return _jsx("div", { className: "pu-output", children: "\u2014" });
6
+ return (_jsxs("a", { className: "pu-file", href: state.url, download: state.name || true, children: [_jsx("span", { className: "pu-file-icon", children: "\u2B73" }), _jsx("span", { className: "pu-file-name", children: state.name || "Download" })] }));
7
+ }
@@ -0,0 +1,6 @@
1
+ import "./frame.css";
2
+ import type { ViewProps } from "../../view.js";
3
+ export declare function FrameView({ widget, state, emit }: ViewProps<any, {
4
+ src: string;
5
+ doc: string;
6
+ }>): import("react").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "./frame.css";
3
+ export function FrameView({ widget, state, emit }) {
4
+ const { src, doc } = state;
5
+ if (!src && !doc)
6
+ return _jsx("div", { className: "pu-frame pu-frame-empty", children: "\u2014" });
7
+ const onLoad = () => emit(widget.loaded());
8
+ const sandbox = widget.sandbox;
9
+ const title = widget.title;
10
+ return doc ? (_jsx("iframe", { className: "pu-frame", title: title, sandbox: sandbox, srcDoc: doc, onLoad: onLoad })) : (_jsx("iframe", { className: "pu-frame", title: title, sandbox: sandbox, src: src, onLoad: onLoad }));
11
+ }
@@ -0,0 +1,6 @@
1
+ import "./gallery.css";
2
+ import type { ViewProps } from "../../view.js";
3
+ import type { GalleryItem } from "../../../lib/widgets/gallery.js";
4
+ export declare function GalleryView({ state }: ViewProps<any, {
5
+ items: GalleryItem[];
6
+ }>): import("react").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import "./gallery.css";
3
+ export function GalleryView({ state }) {
4
+ const items = state.items ?? [];
5
+ if (items.length === 0)
6
+ return _jsx("div", { className: "pu-output", children: "\u2014" });
7
+ return (_jsx("div", { className: "pu-gallery", children: items.map((it, i) => (_jsxs("figure", { className: "pu-gallery-cell", children: [_jsx("img", { src: it.src, alt: it.caption ?? "" }), it.caption && _jsx("figcaption", { children: it.caption })] }, i))) }));
8
+ }
@@ -0,0 +1,7 @@
1
+ import "./highlighted-text.css";
2
+ import type { ViewProps } from "../../view.js";
3
+ import type { HighlightSpan } from "../../../lib/widgets/highlighted-text.js";
4
+ export declare function HighlightedTextView({ state, }: ViewProps<any, {
5
+ value: HighlightSpan[];
6
+ colorMap: Record<string, string>;
7
+ }>): import("react").JSX.Element;
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import "./highlighted-text.css";
3
+ // A fixed palette; a label with no entry in `colorMap` gets a stable color by hashing its name, so
4
+ // the same label keeps the same color across renders without the author having to pick one.
5
+ const PALETTE = ["#2563eb", "#16a34a", "#dc2626", "#d97706", "#7c3aed", "#0891b2", "#db2777", "#65a30d"];
6
+ function colorFor(label, colorMap) {
7
+ if (colorMap[label])
8
+ return colorMap[label];
9
+ let h = 0;
10
+ for (let i = 0; i < label.length; i++)
11
+ h = (h * 31 + label.charCodeAt(i)) | 0;
12
+ return PALETTE[Math.abs(h) % PALETTE.length];
13
+ }
14
+ export function HighlightedTextView({ state, }) {
15
+ const spans = state.value ?? [];
16
+ const colorMap = state.colorMap ?? {};
17
+ if (spans.length === 0)
18
+ return _jsx("div", { className: "pu-output", children: "\u2014" });
19
+ return (_jsx("div", { className: "pu-hltext", children: spans.map((s, i) => s.label ? (_jsxs("span", { className: "pu-hltext-span", style: { background: `${colorFor(s.label, colorMap)}22`, borderColor: colorFor(s.label, colorMap) }, children: [s.text, _jsx("span", { className: "pu-hltext-label", style: { color: colorFor(s.label, colorMap) }, children: s.label })] }, i)) : (_jsx("span", { children: s.text }, i))) }));
20
+ }
@@ -0,0 +1,4 @@
1
+ import type { ViewProps } from "../../view.js";
2
+ export declare function HtmlView({ state }: ViewProps<any, {
3
+ value: string;
4
+ }>): import("react").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ // The deliberate escape hatch: render author-supplied markup as-is. Trust is on the author (the same
3
+ // code that runs handlers), so this is no broader than what they already control.
4
+ export function HtmlView({ state }) {
5
+ if (!state.value)
6
+ return _jsx("div", { className: "pu-output", children: "\u2014" });
7
+ return _jsx("div", { className: "pu-html", dangerouslySetInnerHTML: { __html: state.value } });
8
+ }
@@ -0,0 +1,4 @@
1
+ import type { ViewProps } from "../../view.js";
2
+ export declare function ImageView({ state }: ViewProps<any, {
3
+ src: string;
4
+ }>): import("react").JSX.Element;
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ export function ImageView({ state }) {
3
+ return state.src ? _jsx("img", { className: "pu-image", src: state.src, alt: "" }) : _jsx("div", { className: "pu-output", children: "\u2014" });
4
+ }
@@ -0,0 +1,4 @@
1
+ import type { ViewProps } from "../../view.js";
2
+ export declare function JsonView({ state }: ViewProps<any, {
3
+ value: unknown;
4
+ }>): import("react").JSX.Element;
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ export function JsonView({ state }) {
3
+ return _jsx("pre", { className: "pu-output", children: JSON.stringify(state.value, null, 2) });
4
+ }
@@ -0,0 +1,7 @@
1
+ import "./label.css";
2
+ import type { ViewProps } from "../../view.js";
3
+ import type { LabelClass } from "../../../lib/widgets/label.js";
4
+ export declare function LabelView({ state }: ViewProps<any, {
5
+ label: string;
6
+ confidences: LabelClass[];
7
+ }>): import("react").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import "./label.css";
3
+ export function LabelView({ state }) {
4
+ const confidences = [...(state.confidences ?? [])].sort((a, b) => b.score - a.score);
5
+ if (!state.label && confidences.length === 0)
6
+ return _jsx("div", { className: "pu-output", children: "\u2014" });
7
+ return (_jsxs("div", { className: "pu-label", children: [state.label && _jsx("div", { className: "pu-label-top", children: state.label }), confidences.map((c) => (_jsxs("div", { className: "pu-label-row", children: [_jsx("div", { className: "pu-label-bar", style: { width: `${Math.round(Math.max(0, Math.min(1, c.score)) * 100)}%` } }), _jsx("span", { className: "pu-label-name", children: c.label }), _jsxs("span", { className: "pu-label-score", children: [(c.score * 100).toFixed(1), "%"] })] }, c.label)))] }));
8
+ }
@@ -0,0 +1,4 @@
1
+ import type { ViewProps } from "../../view.js";
2
+ export declare function LayoutView({ widget, state, slot }: ViewProps<any, {
3
+ items: string[];
4
+ }>): import("react").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ export function LayoutView({ widget, state, slot }) {
3
+ const dir = widget.type ?? "col";
4
+ const items = state.items ?? [];
5
+ const style = dir === "grid" ? { gridTemplateColumns: `repeat(${widget.cols ?? 2}, minmax(0, 1fr))` } : undefined;
6
+ return (_jsx("div", { className: `pu-layout pu-layout-${dir}`, style: style, children: items.map((key) => slot(key)) }));
7
+ }
@@ -0,0 +1,4 @@
1
+ import type { ViewProps } from "../../view.js";
2
+ export declare function LogView({ state }: ViewProps<any, {
3
+ lines: string[];
4
+ }>): import("react").JSX.Element;
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ export function LogView({ state }) {
3
+ return _jsx("pre", { className: "pu-output", children: state.lines.join("\n") });
4
+ }
@@ -0,0 +1,6 @@
1
+ import "./mic.css";
2
+ import type { ViewProps } from "../../view.js";
3
+ import type { MicWidget } from "../../../lib/widgets/mic.js";
4
+ export declare function MicView({ widget, state, enabled, emit, set }: ViewProps<MicWidget, {
5
+ live: boolean;
6
+ }>): import("react").JSX.Element | null;
@@ -0,0 +1,70 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "./mic.css";
3
+ import { useEffect, useRef } from "react";
4
+ export function MicView({ widget, state, enabled, emit, set }) {
5
+ const streamRef = useRef(null);
6
+ const recRef = useRef(null);
7
+ const startingRef = useRef(false);
8
+ // capture follows `live`; the view sets `live` locally so it starts/stops without a round-trip
9
+ const toggle = (live) => {
10
+ set(["live"], live);
11
+ emit(widget.toggled(live));
12
+ };
13
+ useEffect(() => {
14
+ let cancelled = false;
15
+ if (state.live && enabled && !streamRef.current && !startingRef.current && navigator.mediaDevices?.getUserMedia) {
16
+ startingRef.current = true;
17
+ void (async () => {
18
+ try {
19
+ const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
20
+ if (cancelled)
21
+ return stream.getTracks().forEach((t) => t.stop());
22
+ streamRef.current = stream;
23
+ const ac = new AudioContext({ sampleRate: 16000 });
24
+ const record = () => {
25
+ if (streamRef.current !== stream)
26
+ return;
27
+ const chunks = [];
28
+ const rec = new MediaRecorder(stream);
29
+ recRef.current = rec;
30
+ rec.ondataavailable = (e) => chunks.push(e.data);
31
+ rec.onstop = async () => {
32
+ const a = await ac.decodeAudioData(await new Blob(chunks).arrayBuffer());
33
+ emit(widget.clip(a.getChannelData(0)));
34
+ if (widget.every > 0 && streamRef.current === stream)
35
+ record();
36
+ };
37
+ rec.start();
38
+ if (widget.every > 0)
39
+ setTimeout(() => rec.stop(), widget.every);
40
+ };
41
+ record();
42
+ }
43
+ catch (err) {
44
+ console.error(err);
45
+ }
46
+ finally {
47
+ startingRef.current = false;
48
+ }
49
+ })();
50
+ }
51
+ else if ((!state.live || !enabled) && streamRef.current) {
52
+ if (recRef.current?.state === "recording")
53
+ recRef.current.stop();
54
+ streamRef.current.getTracks().forEach((t) => t.stop());
55
+ streamRef.current = null;
56
+ recRef.current = null;
57
+ }
58
+ return () => {
59
+ cancelled = true;
60
+ };
61
+ }, [state.live, enabled]);
62
+ if (!widget.control)
63
+ return null;
64
+ const streaming = widget.every > 0;
65
+ const cls = `pu-submit${state.live ? " pu-rec" : ""}`;
66
+ if (!streaming && widget.hold) {
67
+ return (_jsx("button", { className: cls, disabled: !enabled, onPointerDown: () => toggle(true), onPointerUp: () => toggle(false), onPointerLeave: () => state.live && toggle(false), children: state.live ? "● Recording…" : "Hold to talk" }));
68
+ }
69
+ return (_jsx("button", { className: cls, disabled: !enabled, onClick: () => toggle(!state.live), children: state.live ? (streaming ? "● Live" : "● Recording…") : streaming ? "Go live" : "Record" }));
70
+ }
@@ -0,0 +1,5 @@
1
+ import type { ViewProps } from "../../view.js";
2
+ import type { ValueWidget } from "../../../lib/widgets/value.js";
3
+ export declare function NumberView({ widget, state, emit, set }: ViewProps<ValueWidget<number>, {
4
+ value: number;
5
+ }>): import("react").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ export function NumberView({ widget, state, emit, set }) {
3
+ const update = (v) => {
4
+ set(["value"], v);
5
+ emit(widget.changed(v));
6
+ };
7
+ return _jsx("input", { className: "pu-input", type: "number", min: widget.min, max: widget.max, value: state.value, onChange: (e) => update(e.currentTarget.valueAsNumber) });
8
+ }
@@ -0,0 +1,6 @@
1
+ import "./output.css";
2
+ import type { ViewProps } from "../../view.js";
3
+ import type { OutputWidget } from "../../../lib/widgets/output.js";
4
+ export declare function OutputView({ widget, state }: ViewProps<OutputWidget, {
5
+ value: string;
6
+ }>): import("react").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "./output.css";
3
+ import { lazy, Suspense } from "react";
4
+ // The markdown renderer (react-markdown + remark-gfm) loads as its own /assets chunk, only when an
5
+ // output actually uses format="markdown" — plain text output stays weightless in the entry bundle.
6
+ const Markdown = lazy(() => import("./markdown.js"));
7
+ export function OutputView({ widget, state }) {
8
+ const format = widget.format ?? "text";
9
+ const plain = _jsx("div", { className: "pu-output", children: state.value || "—" });
10
+ if (format !== "markdown")
11
+ return plain;
12
+ return (_jsx(Suspense, { fallback: plain, children: _jsx(Markdown, { value: state.value }) }));
13
+ }
@@ -0,0 +1,3 @@
1
+ export default function Markdown({ value }: {
2
+ value: string;
3
+ }): import("react").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import ReactMarkdown from "react-markdown";
3
+ import remarkGfm from "remark-gfm";
4
+ // Lazy-loaded render path for output({ format: "markdown" }). react-markdown escapes raw HTML by
5
+ // default, so this is XSS-safe; an html format would be a separate, deliberate opt-in.
6
+ export default function Markdown({ value }) {
7
+ return (_jsx("div", { className: "pu-md", children: _jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], children: value }) }));
8
+ }
@@ -0,0 +1,6 @@
1
+ import "./progress.css";
2
+ import type { ViewProps } from "../../view.js";
3
+ export declare function ProgressView({ state }: ViewProps<any, {
4
+ value: number;
5
+ label: string;
6
+ }>): import("react").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import "./progress.css";
3
+ export function ProgressView({ state }) {
4
+ const pct = Math.round(Math.max(0, Math.min(1, state.value ?? 0)) * 100);
5
+ return (_jsxs("div", { className: "pu-progress", children: [_jsx("div", { className: "pu-progress-track", children: _jsx("div", { className: "pu-progress-fill", style: { width: `${pct}%` } }) }), _jsx("span", { className: "pu-progress-label", children: state.label || `${pct}%` })] }));
6
+ }
@@ -0,0 +1,6 @@
1
+ import "./radio.css";
2
+ import type { ViewProps } from "../../view.js";
3
+ import type { ValueWidget } from "../../../lib/widgets/value.js";
4
+ export declare function RadioView({ widget, state, emit, set }: ViewProps<ValueWidget<string>, {
5
+ value: string;
6
+ }>): import("react").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import "./radio.css";
3
+ export function RadioView({ widget, state, emit, set }) {
4
+ const choices = widget.choices ?? [];
5
+ const update = (v) => {
6
+ set(["value"], v);
7
+ emit(widget.changed(v));
8
+ };
9
+ return (_jsx("div", { className: "pu-radio", children: choices.map((c) => (_jsxs("label", { className: "pu-radio-opt", children: [_jsx("input", { type: "radio", checked: state.value === c, onChange: () => update(c) }), " ", c] }, c))) }));
10
+ }
@@ -0,0 +1,2 @@
1
+ import type { WidgetView } from "../view.js";
2
+ export declare const VIEWS: Record<string, WidgetView>;
@@ -0,0 +1,69 @@
1
+ import { TextView } from "./text/index.js";
2
+ import { NumberView } from "./number/index.js";
3
+ import { SliderView } from "./slider/index.js";
4
+ import { CodeView } from "./code/lazy.js";
5
+ import { TableView } from "./table/lazy.js";
6
+ import { ChartView } from "./chart/lazy.js";
7
+ import { DropdownView } from "./dropdown/index.js";
8
+ import { CheckboxView } from "./checkbox/index.js";
9
+ import { CheckboxGroupView } from "./checkbox-group/index.js";
10
+ import { RadioView } from "./radio/index.js";
11
+ import { GalleryView } from "./gallery/index.js";
12
+ import { VideoView } from "./video/index.js";
13
+ import { LabelView } from "./label/index.js";
14
+ import { HighlightedTextView } from "./highlighted-text/index.js";
15
+ import { AnnotatedImageView } from "./annotated-image/index.js";
16
+ import { FileView } from "./file/index.js";
17
+ import { ProgressView } from "./progress/index.js";
18
+ import { HtmlView } from "./html/index.js";
19
+ import { FrameView } from "./frame/index.js";
20
+ import { UploadView } from "./upload/index.js";
21
+ import { ImageView } from "./image/index.js";
22
+ import { ButtonView } from "./button/index.js";
23
+ import { MicView } from "./mic/index.js";
24
+ import { ChatView } from "./chat/index.js";
25
+ import { OutputView } from "./output/index.js";
26
+ import { JsonView } from "./json/index.js";
27
+ import { LogView } from "./log/index.js";
28
+ import { AudioView } from "./audio/index.js";
29
+ import { WebcamView } from "./webcam/index.js";
30
+ import { LayoutView } from "./layout/index.js";
31
+ import { TabsView } from "./tabs/index.js";
32
+ import { AccordionView } from "./accordion/index.js";
33
+ // the only place that maps a widget's `type` to its React view
34
+ export const VIEWS = {
35
+ text: TextView,
36
+ number: NumberView,
37
+ slider: SliderView,
38
+ code: CodeView,
39
+ table: TableView,
40
+ chart: ChartView,
41
+ dropdown: DropdownView,
42
+ checkbox: CheckboxView,
43
+ checkboxGroup: CheckboxGroupView,
44
+ radio: RadioView,
45
+ gallery: GalleryView,
46
+ video: VideoView,
47
+ label: LabelView,
48
+ highlightedText: HighlightedTextView,
49
+ annotatedImage: AnnotatedImageView,
50
+ file: FileView,
51
+ progress: ProgressView,
52
+ html: HtmlView,
53
+ frame: FrameView,
54
+ upload: UploadView,
55
+ image: ImageView,
56
+ button: ButtonView,
57
+ mic: MicView,
58
+ chat: ChatView,
59
+ output: OutputView,
60
+ json: JsonView,
61
+ log: LogView,
62
+ audio: AudioView,
63
+ webcam: WebcamView,
64
+ row: LayoutView,
65
+ col: LayoutView,
66
+ grid: LayoutView,
67
+ tabs: TabsView,
68
+ accordion: AccordionView,
69
+ };
@@ -0,0 +1,6 @@
1
+ import "./slider.css";
2
+ import type { ViewProps } from "../../view.js";
3
+ import type { ValueWidget } from "../../../lib/widgets/value.js";
4
+ export declare function SliderView({ widget, state, emit, set }: ViewProps<ValueWidget<number>, {
5
+ value: number;
6
+ }>): import("react").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import "./slider.css";
3
+ export function SliderView({ widget, state, emit, set }) {
4
+ const update = (v) => {
5
+ set(["value"], v); // local, so the track and read-back reflect the drag with no round-trip
6
+ emit(widget.changed(v));
7
+ };
8
+ return (_jsxs("div", { className: "pu-slider", children: [_jsx("input", { type: "range", min: widget.min, max: widget.max, step: widget.step, value: state.value, onChange: (e) => update(e.currentTarget.valueAsNumber) }), _jsx("output", { className: "pu-slider-val", children: state.value })] }));
9
+ }
@@ -0,0 +1,6 @@
1
+ import type { ViewProps } from "../../view.js";
2
+ import type { TableWidget, Column, Row } from "../../../lib/widgets/table.js";
3
+ export declare function TableView({ widget, state, emit, set }: ViewProps<TableWidget, {
4
+ columns: Column[];
5
+ rows: Row[];
6
+ }>): import("react").JSX.Element;