@zonsh/ui 0.0.0-stage → 0.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 (388) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +76 -2
  3. package/assets/illustrations/drawing/bracket-construction-dark.svg +77 -0
  4. package/assets/illustrations/drawing/bracket-construction-filled-dark.svg +50 -0
  5. package/assets/illustrations/drawing/bracket-construction-filled.svg +50 -0
  6. package/assets/illustrations/drawing/bracket-construction.svg +77 -0
  7. package/assets/illustrations/drawing/crescent-dark.svg +28 -0
  8. package/assets/illustrations/drawing/crescent-guides-dark.svg +33 -0
  9. package/assets/illustrations/drawing/crescent-guides.svg +33 -0
  10. package/assets/illustrations/drawing/crescent.svg +28 -0
  11. package/assets/illustrations/drawing/eclipse-dark.svg +187 -0
  12. package/assets/illustrations/drawing/eclipse-guides-dark.svg +191 -0
  13. package/assets/illustrations/drawing/eclipse-guides.svg +191 -0
  14. package/assets/illustrations/drawing/eclipse.svg +187 -0
  15. package/assets/illustrations/drawing/elevation-guides-dark.svg +31 -0
  16. package/assets/illustrations/drawing/elevation-guides-plain-dark.svg +9 -0
  17. package/assets/illustrations/drawing/elevation-guides-plain.svg +9 -0
  18. package/assets/illustrations/drawing/elevation-guides.svg +31 -0
  19. package/assets/illustrations/drawing/horizon-dark.svg +30 -0
  20. package/assets/illustrations/drawing/horizon.svg +30 -0
  21. package/assets/illustrations/drawing/nib-study-dark.svg +107 -0
  22. package/assets/illustrations/drawing/nib-study-plain-dark.svg +93 -0
  23. package/assets/illustrations/drawing/nib-study-plain.svg +93 -0
  24. package/assets/illustrations/drawing/nib-study.svg +107 -0
  25. package/assets/illustrations/editorial/assistant-640.webp +0 -0
  26. package/assets/illustrations/editorial/assistant.webp +0 -0
  27. package/assets/illustrations/editorial/automation-640.webp +0 -0
  28. package/assets/illustrations/editorial/automation.webp +0 -0
  29. package/assets/illustrations/editorial/bracket-left-640.webp +0 -0
  30. package/assets/illustrations/editorial/bracket-left.webp +0 -0
  31. package/assets/illustrations/editorial/bracket-right-640.webp +0 -0
  32. package/assets/illustrations/editorial/bracket-right.webp +0 -0
  33. package/assets/illustrations/editorial/custom-software-640.webp +0 -0
  34. package/assets/illustrations/editorial/custom-software.webp +0 -0
  35. package/assets/illustrations/editorial/digitalization-640.webp +0 -0
  36. package/assets/illustrations/editorial/digitalization.webp +0 -0
  37. package/assets/illustrations/editorial/integration-640.webp +0 -0
  38. package/assets/illustrations/editorial/integration.webp +0 -0
  39. package/assets/illustrations/editorial/problem-640.webp +0 -0
  40. package/assets/illustrations/editorial/problem.webp +0 -0
  41. package/assets/illustrations/editorial/process-analysis-640.webp +0 -0
  42. package/assets/illustrations/editorial/process-analysis.webp +0 -0
  43. package/assets/illustrations/editorial/process-concept-640.webp +0 -0
  44. package/assets/illustrations/editorial/process-concept.webp +0 -0
  45. package/assets/illustrations/editorial/process-development-640.webp +0 -0
  46. package/assets/illustrations/editorial/process-development.webp +0 -0
  47. package/assets/illustrations/editorial/process-discovery-640.webp +0 -0
  48. package/assets/illustrations/editorial/process-discovery.webp +0 -0
  49. package/assets/illustrations/editorial/process-maintenance-640.webp +0 -0
  50. package/assets/illustrations/editorial/process-maintenance.webp +0 -0
  51. package/assets/illustrations/editorial/process-prototype-640.webp +0 -0
  52. package/assets/illustrations/editorial/process-prototype.webp +0 -0
  53. package/assets/illustrations/editorial/process-testing-640.webp +0 -0
  54. package/assets/illustrations/editorial/process-testing.webp +0 -0
  55. package/assets/illustrations/iso/automation-dark.svg +6 -0
  56. package/assets/illustrations/iso/automation.svg +6 -0
  57. package/assets/illustrations/iso/bar-chart-dark.svg +6 -0
  58. package/assets/illustrations/iso/bar-chart.svg +6 -0
  59. package/assets/illustrations/iso/brackets-classic-dark.svg +6 -0
  60. package/assets/illustrations/iso/brackets-classic.svg +6 -0
  61. package/assets/illustrations/iso/brackets-dark.svg +6 -0
  62. package/assets/illustrations/iso/brackets.svg +6 -0
  63. package/assets/illustrations/iso/city-dark.svg +6 -0
  64. package/assets/illustrations/iso/city.svg +6 -0
  65. package/assets/illustrations/iso/conveyor-dark.svg +6 -0
  66. package/assets/illustrations/iso/conveyor.svg +6 -0
  67. package/assets/illustrations/iso/database-dark.svg +6 -0
  68. package/assets/illustrations/iso/database.svg +6 -0
  69. package/assets/illustrations/iso/documents-dark.svg +6 -0
  70. package/assets/illustrations/iso/documents.svg +6 -0
  71. package/assets/illustrations/iso/inbox-dark.svg +6 -0
  72. package/assets/illustrations/iso/inbox.svg +6 -0
  73. package/assets/illustrations/iso/laptop-dark.svg +6 -0
  74. package/assets/illustrations/iso/laptop.svg +6 -0
  75. package/assets/illustrations/iso/monitor-dark.svg +6 -0
  76. package/assets/illustrations/iso/monitor.svg +6 -0
  77. package/assets/illustrations/iso/pipeline-dark.svg +6 -0
  78. package/assets/illustrations/iso/pipeline.svg +6 -0
  79. package/assets/illustrations/iso/platform-dark.svg +6 -0
  80. package/assets/illustrations/iso/platform.svg +6 -0
  81. package/assets/illustrations/iso/server-dark.svg +6 -0
  82. package/assets/illustrations/iso/server.svg +6 -0
  83. package/assets/illustrations/iso/spreadsheet-dark.svg +6 -0
  84. package/assets/illustrations/iso/spreadsheet.svg +6 -0
  85. package/assets/illustrations/iso/timeline-dark.svg +6 -0
  86. package/assets/illustrations/iso/timeline.svg +6 -0
  87. package/assets/illustrations/sheet/construction.svg +115 -0
  88. package/assets/illustrations/sheet/crescent.svg +40 -0
  89. package/assets/illustrations/sheet/limb.svg +42 -0
  90. package/assets/illustrations/sheet/stress-axis.svg +119 -0
  91. package/assets/illustrations/sheet/totality.svg +215 -0
  92. package/assets/illustrations/sheet/vertical-metrics.svg +43 -0
  93. package/assets/logo-left.svg +1 -0
  94. package/assets/logo-right.svg +1 -0
  95. package/assets/logo.svg +1 -0
  96. package/dist/components/_overlay.d.ts +47 -0
  97. package/dist/components/_overlay.js +59 -0
  98. package/dist/components/accordion.d.ts +32 -0
  99. package/dist/components/accordion.js +39 -0
  100. package/dist/components/alert-dialog.d.ts +45 -0
  101. package/dist/components/alert-dialog.js +56 -0
  102. package/dist/components/alert.d.ts +35 -0
  103. package/dist/components/alert.js +42 -0
  104. package/dist/components/ascii-field.d.ts +34 -0
  105. package/dist/components/ascii-field.js +410 -0
  106. package/dist/components/aspect-ratio.d.ts +14 -0
  107. package/dist/components/aspect-ratio.js +17 -0
  108. package/dist/components/avatar.d.ts +42 -0
  109. package/dist/components/avatar.js +55 -0
  110. package/dist/components/badge.d.ts +70 -0
  111. package/dist/components/badge.js +62 -0
  112. package/dist/components/breadcrumb.d.ts +22 -0
  113. package/dist/components/breadcrumb.js +32 -0
  114. package/dist/components/button-group.d.ts +30 -0
  115. package/dist/components/button-group.js +47 -0
  116. package/dist/components/button.d.ts +53 -0
  117. package/dist/components/button.js +130 -0
  118. package/dist/components/calendar.d.ts +26 -0
  119. package/dist/components/calendar.js +164 -0
  120. package/dist/components/card.d.ts +42 -0
  121. package/dist/components/card.js +76 -0
  122. package/dist/components/carousel.d.ts +90 -0
  123. package/dist/components/carousel.js +213 -0
  124. package/dist/components/chart.d.ts +180 -0
  125. package/dist/components/chart.js +286 -0
  126. package/dist/components/checkbox.d.ts +23 -0
  127. package/dist/components/checkbox.js +43 -0
  128. package/dist/components/code-block.d.ts +45 -0
  129. package/dist/components/code-block.js +58 -0
  130. package/dist/components/code-highlight.d.ts +13 -0
  131. package/dist/components/code-highlight.js +107 -0
  132. package/dist/components/collapsible.d.ts +20 -0
  133. package/dist/components/collapsible.js +32 -0
  134. package/dist/components/color-picker.d.ts +85 -0
  135. package/dist/components/color-picker.js +407 -0
  136. package/dist/components/combobox.d.ts +81 -0
  137. package/dist/components/combobox.js +100 -0
  138. package/dist/components/command.d.ts +112 -0
  139. package/dist/components/command.js +212 -0
  140. package/dist/components/context-menu.d.ts +29 -0
  141. package/dist/components/context-menu.js +35 -0
  142. package/dist/components/conversation.d.ts +27 -0
  143. package/dist/components/conversation.js +293 -0
  144. package/dist/components/copy-button.d.ts +46 -0
  145. package/dist/components/copy-button.js +118 -0
  146. package/dist/components/data-table.d.ts +175 -0
  147. package/dist/components/data-table.js +302 -0
  148. package/dist/components/date-picker.d.ts +91 -0
  149. package/dist/components/date-picker.js +207 -0
  150. package/dist/components/dialog.d.ts +48 -0
  151. package/dist/components/dialog.js +92 -0
  152. package/dist/components/direction.d.ts +16 -0
  153. package/dist/components/direction.js +18 -0
  154. package/dist/components/drawer.d.ts +60 -0
  155. package/dist/components/drawer.js +76 -0
  156. package/dist/components/empty.d.ts +31 -0
  157. package/dist/components/empty.js +50 -0
  158. package/dist/components/feature-list.d.ts +54 -0
  159. package/dist/components/feature-list.js +43 -0
  160. package/dist/components/field.d.ts +15 -0
  161. package/dist/components/field.js +36 -0
  162. package/dist/components/file-drop.d.ts +55 -0
  163. package/dist/components/file-drop.js +197 -0
  164. package/dist/components/filter-bar.d.ts +106 -0
  165. package/dist/components/filter-bar.js +296 -0
  166. package/dist/components/form.d.ts +33 -0
  167. package/dist/components/form.js +34 -0
  168. package/dist/components/graph.d.ts +105 -0
  169. package/dist/components/graph.js +786 -0
  170. package/dist/components/illustration.d.ts +85 -0
  171. package/dist/components/illustration.js +165 -0
  172. package/dist/components/input-group.d.ts +127 -0
  173. package/dist/components/input-group.js +292 -0
  174. package/dist/components/input.d.ts +16 -0
  175. package/dist/components/input.js +25 -0
  176. package/dist/components/item.d.ts +64 -0
  177. package/dist/components/item.js +116 -0
  178. package/dist/components/kbd.d.ts +33 -0
  179. package/dist/components/kbd.js +38 -0
  180. package/dist/components/label.d.ts +12 -0
  181. package/dist/components/label.js +24 -0
  182. package/dist/components/layout.d.ts +136 -0
  183. package/dist/components/layout.js +162 -0
  184. package/dist/components/logo.d.ts +54 -0
  185. package/dist/components/logo.js +96 -0
  186. package/dist/components/menu.d.ts +60 -0
  187. package/dist/components/menu.js +138 -0
  188. package/dist/components/menubar.d.ts +62 -0
  189. package/dist/components/menubar.js +223 -0
  190. package/dist/components/message.d.ts +42 -0
  191. package/dist/components/message.js +56 -0
  192. package/dist/components/meter.d.ts +31 -0
  193. package/dist/components/meter.js +25 -0
  194. package/dist/components/native-select.d.ts +26 -0
  195. package/dist/components/native-select.js +35 -0
  196. package/dist/components/navigation-menu.d.ts +42 -0
  197. package/dist/components/navigation-menu.js +97 -0
  198. package/dist/components/number-field.d.ts +36 -0
  199. package/dist/components/number-field.js +153 -0
  200. package/dist/components/otp-field.d.ts +35 -0
  201. package/dist/components/otp-field.js +94 -0
  202. package/dist/components/pagination.d.ts +31 -0
  203. package/dist/components/pagination.js +70 -0
  204. package/dist/components/pdf-viewer.d.ts +69 -0
  205. package/dist/components/pdf-viewer.js +929 -0
  206. package/dist/components/popover.d.ts +33 -0
  207. package/dist/components/popover.js +48 -0
  208. package/dist/components/preview-card.d.ts +25 -0
  209. package/dist/components/preview-card.js +22 -0
  210. package/dist/components/progress.d.ts +27 -0
  211. package/dist/components/progress.js +23 -0
  212. package/dist/components/prompt-input.d.ts +131 -0
  213. package/dist/components/prompt-input.js +403 -0
  214. package/dist/components/quote.d.ts +22 -0
  215. package/dist/components/quote.js +15 -0
  216. package/dist/components/radio-group.d.ts +18 -0
  217. package/dist/components/radio-group.js +34 -0
  218. package/dist/components/reasoning.d.ts +31 -0
  219. package/dist/components/reasoning.js +70 -0
  220. package/dist/components/resizable.d.ts +38 -0
  221. package/dist/components/resizable.js +41 -0
  222. package/dist/components/response.d.ts +30 -0
  223. package/dist/components/response.js +538 -0
  224. package/dist/components/scroll-area.d.ts +33 -0
  225. package/dist/components/scroll-area.js +31 -0
  226. package/dist/components/select.d.ts +35 -0
  227. package/dist/components/select.js +60 -0
  228. package/dist/components/separator.d.ts +14 -0
  229. package/dist/components/separator.js +17 -0
  230. package/dist/components/sidebar.d.ts +147 -0
  231. package/dist/components/sidebar.js +489 -0
  232. package/dist/components/site-header.d.ts +59 -0
  233. package/dist/components/site-header.js +67 -0
  234. package/dist/components/skeleton.d.ts +31 -0
  235. package/dist/components/skeleton.js +29 -0
  236. package/dist/components/slider.d.ts +24 -0
  237. package/dist/components/slider.js +129 -0
  238. package/dist/components/sources.d.ts +25 -0
  239. package/dist/components/sources.js +35 -0
  240. package/dist/components/spinner.d.ts +36 -0
  241. package/dist/components/spinner.js +72 -0
  242. package/dist/components/suggestions.d.ts +20 -0
  243. package/dist/components/suggestions.js +18 -0
  244. package/dist/components/switch.d.ts +14 -0
  245. package/dist/components/switch.js +26 -0
  246. package/dist/components/table.d.ts +162 -0
  247. package/dist/components/table.js +758 -0
  248. package/dist/components/tabs.d.ts +25 -0
  249. package/dist/components/tabs.js +162 -0
  250. package/dist/components/tag.d.ts +41 -0
  251. package/dist/components/tag.js +88 -0
  252. package/dist/components/tags-input.d.ts +40 -0
  253. package/dist/components/tags-input.js +239 -0
  254. package/dist/components/textarea.d.ts +13 -0
  255. package/dist/components/textarea.js +16 -0
  256. package/dist/components/theme.d.ts +41 -0
  257. package/dist/components/theme.js +112 -0
  258. package/dist/components/time-field.d.ts +51 -0
  259. package/dist/components/time-field.js +437 -0
  260. package/dist/components/timeline.d.ts +76 -0
  261. package/dist/components/timeline.js +99 -0
  262. package/dist/components/toast.d.ts +72 -0
  263. package/dist/components/toast.js +196 -0
  264. package/dist/components/toggle-group.d.ts +41 -0
  265. package/dist/components/toggle-group.js +140 -0
  266. package/dist/components/toggle.d.ts +23 -0
  267. package/dist/components/toggle.js +35 -0
  268. package/dist/components/tool-call.d.ts +52 -0
  269. package/dist/components/tool-call.js +57 -0
  270. package/dist/components/toolbar.d.ts +17 -0
  271. package/dist/components/toolbar.js +34 -0
  272. package/dist/components/tooltip.d.ts +42 -0
  273. package/dist/components/tooltip.js +47 -0
  274. package/dist/components/tree.d.ts +75 -0
  275. package/dist/components/tree.js +636 -0
  276. package/dist/components/typography.d.ts +134 -0
  277. package/dist/components/typography.js +176 -0
  278. package/dist/components/video-player.d.ts +276 -0
  279. package/dist/components/video-player.js +1352 -0
  280. package/dist/components/whiteboard.d.ts +80 -0
  281. package/dist/components/whiteboard.js +389 -0
  282. package/dist/index.d.ts +85 -0
  283. package/dist/index.js +86 -0
  284. package/dist/lib/cn.d.ts +20 -0
  285. package/dist/lib/cn.js +38 -0
  286. package/dist/lib/code-highlight.d.ts +31 -0
  287. package/dist/lib/code-highlight.js +24 -0
  288. package/dist/lib/code-theme.d.ts +19 -0
  289. package/dist/lib/code-theme.js +140 -0
  290. package/dist/lib/collapse-row.d.ts +9 -0
  291. package/dist/lib/collapse-row.js +129 -0
  292. package/dist/lib/digit-roll.d.ts +21 -0
  293. package/dist/lib/digit-roll.js +31 -0
  294. package/dist/lib/editorial-assets.d.ts +16 -0
  295. package/dist/lib/editorial-assets.js +56 -0
  296. package/dist/lib/figure/catalog.d.ts +127 -0
  297. package/dist/lib/figure/catalog.js +130 -0
  298. package/dist/lib/figure/figures/automation.d.ts +7 -0
  299. package/dist/lib/figure/figures/automation.js +143 -0
  300. package/dist/lib/figure/figures/bar-chart.d.ts +7 -0
  301. package/dist/lib/figure/figures/bar-chart.js +99 -0
  302. package/dist/lib/figure/figures/brackets-classic.d.ts +11 -0
  303. package/dist/lib/figure/figures/brackets-classic.js +170 -0
  304. package/dist/lib/figure/figures/brackets.d.ts +8 -0
  305. package/dist/lib/figure/figures/brackets.js +84 -0
  306. package/dist/lib/figure/figures/city.d.ts +7 -0
  307. package/dist/lib/figure/figures/city.js +93 -0
  308. package/dist/lib/figure/figures/conveyor.d.ts +7 -0
  309. package/dist/lib/figure/figures/conveyor.js +97 -0
  310. package/dist/lib/figure/figures/database.d.ts +7 -0
  311. package/dist/lib/figure/figures/database.js +65 -0
  312. package/dist/lib/figure/figures/documents.d.ts +7 -0
  313. package/dist/lib/figure/figures/documents.js +83 -0
  314. package/dist/lib/figure/figures/inbox.d.ts +7 -0
  315. package/dist/lib/figure/figures/inbox.js +92 -0
  316. package/dist/lib/figure/figures/laptop.d.ts +7 -0
  317. package/dist/lib/figure/figures/laptop.js +67 -0
  318. package/dist/lib/figure/figures/monitor.d.ts +7 -0
  319. package/dist/lib/figure/figures/monitor.js +59 -0
  320. package/dist/lib/figure/figures/pipeline.d.ts +8 -0
  321. package/dist/lib/figure/figures/pipeline.js +117 -0
  322. package/dist/lib/figure/figures/platform.d.ts +7 -0
  323. package/dist/lib/figure/figures/platform.js +117 -0
  324. package/dist/lib/figure/figures/server.d.ts +7 -0
  325. package/dist/lib/figure/figures/server.js +115 -0
  326. package/dist/lib/figure/figures/spreadsheet.d.ts +7 -0
  327. package/dist/lib/figure/figures/spreadsheet.js +87 -0
  328. package/dist/lib/figure/figures/timeline.d.ts +7 -0
  329. package/dist/lib/figure/figures/timeline.js +65 -0
  330. package/dist/lib/figure/kernel.d.ts +152 -0
  331. package/dist/lib/figure/kernel.js +576 -0
  332. package/dist/lib/figure/parts.d.ts +42 -0
  333. package/dist/lib/figure/parts.js +126 -0
  334. package/dist/lib/form-reset.d.ts +11 -0
  335. package/dist/lib/form-reset.js +22 -0
  336. package/dist/lib/glide.d.ts +53 -0
  337. package/dist/lib/glide.js +138 -0
  338. package/dist/lib/graph-layout.d.ts +58 -0
  339. package/dist/lib/graph-layout.js +200 -0
  340. package/dist/lib/illustration-drawings.d.ts +89 -0
  341. package/dist/lib/illustration-drawings.js +539 -0
  342. package/dist/lib/illustration-info.d.ts +37 -0
  343. package/dist/lib/illustration-info.js +22 -0
  344. package/dist/lib/illustration-library.d.ts +87 -0
  345. package/dist/lib/illustration-library.js +352 -0
  346. package/dist/lib/logo-geometry.d.ts +29 -0
  347. package/dist/lib/logo-geometry.js +67 -0
  348. package/dist/lib/markdown-guard.d.ts +16 -0
  349. package/dist/lib/markdown-guard.js +123 -0
  350. package/dist/lib/merge-refs.d.ts +10 -0
  351. package/dist/lib/merge-refs.js +26 -0
  352. package/dist/lib/motion.d.ts +6 -0
  353. package/dist/lib/motion.js +12 -0
  354. package/dist/lib/pdf-worker.d.ts +1 -0
  355. package/dist/lib/pdf-worker.js +6 -0
  356. package/dist/lib/pdf.d.ts +19 -0
  357. package/dist/lib/pdf.js +58 -0
  358. package/dist/lib/platform.d.ts +33 -0
  359. package/dist/lib/platform.js +68 -0
  360. package/dist/lib/room.d.ts +25 -0
  361. package/dist/lib/room.js +46 -0
  362. package/dist/lib/table-fit.d.ts +143 -0
  363. package/dist/lib/table-fit.js +577 -0
  364. package/dist/lib/theme-script.d.ts +18 -0
  365. package/dist/lib/theme-script.js +29 -0
  366. package/dist/styles/expressive.css +188 -0
  367. package/dist/styles/fonts.css +145 -0
  368. package/dist/styles/index.css +206 -0
  369. package/dist/styles/material.css +313 -0
  370. package/dist/styles/parts/ai.css +360 -0
  371. package/dist/styles/parts/brand.css +75 -0
  372. package/dist/styles/parts/controls.css +725 -0
  373. package/dist/styles/parts/data.css +222 -0
  374. package/dist/styles/parts/editorial.css +120 -0
  375. package/dist/styles/parts/feedback.css +273 -0
  376. package/dist/styles/parts/foundations.css +166 -0
  377. package/dist/styles/parts/graph.css +214 -0
  378. package/dist/styles/parts/inputs.css +261 -0
  379. package/dist/styles/parts/isometric.css +124 -0
  380. package/dist/styles/parts/navigation.css +232 -0
  381. package/dist/styles/parts/overlays.css +250 -0
  382. package/dist/styles/parts/pdf.css +154 -0
  383. package/dist/styles/parts/react-flow.css +519 -0
  384. package/dist/styles/parts/whiteboard.css +855 -0
  385. package/dist/styles/tokens.css +290 -0
  386. package/dist/vite.d.ts +116 -0
  387. package/dist/vite.js +129 -0
  388. package/package.json +189 -3
@@ -0,0 +1,576 @@
1
+ /*
2
+ * The figure kernel: isometric line figures that answer the pointer.
3
+ *
4
+ * A figure is a small instrument drawn in one hairline stroke. Its solids are rounded — the hull
5
+ * of two rounded rings, a bright silhouette and one dim crease inside it — and its plates are
6
+ * filled with the page colour, so a near plate hides what is behind it. It listens the whole time:
7
+ * the pointer is projected back onto the ground, parts answer by their distance to it through a
8
+ * clamped falloff, a spring follows where the pointer is and a long ease settles which part is
9
+ * chosen. When the pointer leaves, the figure returns to a rest pose that was drawn on purpose.
10
+ *
11
+ * This file has no DOM at import time: the same figure code draws into the page (mountFigure) or
12
+ * into a small virtual tree for static SVG files (renderStill).
13
+ *
14
+ * The rules every figure is held to (after the study behind @lucasmarkes/hairline, MIT):
15
+ * 01 hit areas don't move — pick against rest or target poses, never the pose on screen;
16
+ * 02 stagger by distance — delay = |i − a| × 30–60ms, spreading from the pointer;
17
+ * 03 clamp the reach — a falloff with a floor, every lift and gap clamped, fit to the extreme pose;
18
+ * 04 the stroke is the only highlight — one bright place at a time, no fills or glows;
19
+ * 05 rest is designed — never flat, never empty; one bright mark says where to look;
20
+ * 06 construction stays honest — plates are opaque, drawn back to front;
21
+ * 07 loops sleep — only ambient figures move without input, and only on screen;
22
+ * 08 two clocks — a spring for where the pointer is, a 700ms ease for which part is chosen;
23
+ * 09 round every corner, then draw less — silhouette bright, one crease dim, no vertical corners;
24
+ * 10 no words inside the figure.
25
+ */
26
+ /* ── Camera ─────────────────────────────────────────────────────────────────── */
27
+ /** The frame every figure shares. */
28
+ export const VIEW = { w: 400, h: 320, cx: 200, cy: 166 };
29
+ const CA = Math.SQRT1_2;
30
+ const SA = Math.SQRT1_2;
31
+ /** Elevation 30°: the 2:1 view. */
32
+ const SE = 0.5;
33
+ const CE = Math.sqrt(3) / 2;
34
+ /** The isometric camera: azimuth 45°, elevation 30°, scale S, centred on (ox, oy). */
35
+ export class Cam {
36
+ S;
37
+ ox;
38
+ oy;
39
+ constructor(S = 10, ox = VIEW.cx, oy = VIEW.cy) {
40
+ this.S = S;
41
+ this.ox = ox;
42
+ this.oy = oy;
43
+ }
44
+ /** World → frame. */
45
+ P(x, y, z = 0) {
46
+ return [this.ox + this.S * (x * CA - y * SA), this.oy + this.S * ((x * SA + y * CA) * SE - z * CE)];
47
+ }
48
+ /** A frame point back onto the plane at height z, in world x, y. */
49
+ unproj(sx, sy, z = 0) {
50
+ const a = (sx - this.ox) / this.S;
51
+ const b = ((sy - this.oy) / this.S + z * CE) / SE;
52
+ return [a * CA + b * SA, b * CA - a * SA];
53
+ }
54
+ }
55
+ /**
56
+ * A camera that fits these world points in the frame, with `pad` to spare (rule 03: fit the
57
+ * extreme pose). It fits all eight corners of their bounding box, so no corner can be missed.
58
+ */
59
+ export function fit(points, pad = 28) {
60
+ const lo = [0, 1, 2].map((k) => Math.min(...points.map((p) => p[k])));
61
+ const hi = [0, 1, 2].map((k) => Math.max(...points.map((p) => p[k])));
62
+ const corners = [];
63
+ for (const x of [lo[0], hi[0]])
64
+ for (const y of [lo[1], hi[1]])
65
+ for (const z of [lo[2], hi[2]])
66
+ corners.push([x, y, z]);
67
+ return fitPoints(corners, pad);
68
+ }
69
+ /**
70
+ * A camera that fits exactly these world points, for a figure whose footprint is not a box — a
71
+ * cross, a ring, an L — where the box's empty corners would only shrink it. Pass every corner
72
+ * that matters, in the extreme pose: nothing between the points is checked.
73
+ */
74
+ export function fitPoints(points, pad = 28) {
75
+ const unit = new Cam(1, 0, 0);
76
+ let minX = Infinity;
77
+ let minY = Infinity;
78
+ let maxX = -Infinity;
79
+ let maxY = -Infinity;
80
+ for (const [x, y, z] of points) {
81
+ const [sx, sy] = unit.P(x, y, z);
82
+ minX = Math.min(minX, sx);
83
+ maxX = Math.max(maxX, sx);
84
+ minY = Math.min(minY, sy);
85
+ maxY = Math.max(maxY, sy);
86
+ }
87
+ const S = Math.min((VIEW.w - pad * 2) / (maxX - minX), (VIEW.h - pad * 2) / (maxY - minY));
88
+ return new Cam(S, VIEW.cx - S * ((minX + maxX) / 2), VIEW.cy - S * ((minY + maxY) / 2));
89
+ }
90
+ /* ── Geometry ───────────────────────────────────────────────────────────────── */
91
+ /** A rounded rectangle on the ground, counter-clockwise: `steps` segments round each corner. */
92
+ export function rrect(x0, y0, x1, y1, r, steps = 4) {
93
+ const rr = Math.max(0, Math.min(r, (x1 - x0) / 2, (y1 - y0) / 2));
94
+ const corners = [
95
+ [x1 - rr, y1 - rr, 0],
96
+ [x0 + rr, y1 - rr, 90],
97
+ [x0 + rr, y0 + rr, 180],
98
+ [x1 - rr, y0 + rr, 270],
99
+ ];
100
+ const out = [];
101
+ for (const [cx, cy, a0] of corners)
102
+ for (let k = 0; k <= steps; k++) {
103
+ const a = ((a0 + (k / steps) * 90) * Math.PI) / 180;
104
+ out.push([cx + rr * Math.cos(a), cy + rr * Math.sin(a)]);
105
+ }
106
+ return out;
107
+ }
108
+ /** A circle on the ground. */
109
+ export const circle = (cx, cy, r, steps = 28) => Array.from({ length: steps }, (_, k) => {
110
+ const a = (k / steps) * Math.PI * 2;
111
+ return [cx + r * Math.cos(a), cy + r * Math.sin(a)];
112
+ });
113
+ /** The convex hull of frame points. */
114
+ export function hull(pts) {
115
+ const p = [...pts].sort((a, b) => a[0] - b[0] || a[1] - b[1]);
116
+ if (p.length < 3)
117
+ return p;
118
+ const cross = (o, a, b) => (a[0] - o[0]) * (b[1] - o[1]) - (a[1] - o[1]) * (b[0] - o[0]);
119
+ const lower = [];
120
+ for (const q of p) {
121
+ while (lower.length >= 2 && cross(lower[lower.length - 2], lower[lower.length - 1], q) <= 0)
122
+ lower.pop();
123
+ lower.push(q);
124
+ }
125
+ const upper = [];
126
+ for (let i = p.length - 1; i >= 0; i--) {
127
+ const q = p[i];
128
+ while (upper.length >= 2 && cross(upper[upper.length - 2], upper[upper.length - 1], q) <= 0)
129
+ upper.pop();
130
+ upper.push(q);
131
+ }
132
+ return lower.slice(0, -1).concat(upper.slice(0, -1));
133
+ }
134
+ /** The run of a counter-clockwise ring that faces the viewer (its outward normals point to +x, +y). */
135
+ export function front(ring) {
136
+ const n = ring.length;
137
+ const faces = ring.map((a, i) => {
138
+ const b = ring[(i + 1) % n];
139
+ return b[1] - a[1] + (a[0] - b[0]) > 1e-9;
140
+ });
141
+ let start = faces.findIndex((f, i) => f && !faces[(i - 1 + n) % n]);
142
+ if (start < 0)
143
+ return faces[0] ? [...ring, ring[0]] : [];
144
+ const out = [ring[start]];
145
+ for (let k = 0; k < n && faces[(start + k) % n]; k++)
146
+ out.push(ring[(start + k + 1) % n]);
147
+ return out;
148
+ }
149
+ const f2 = (n) => (Math.round(n * 100) / 100).toString();
150
+ /** Path data through frame points. */
151
+ export const line = (pts, closed = false) => pts.length ? `M${pts.map(([x, y]) => `${f2(x)} ${f2(y)}`).join("L")}${closed ? "Z" : ""}` : "";
152
+ /* ── Motion ─────────────────────────────────────────────────────────────────── */
153
+ /** A spring for where the pointer is (rule 08): k 100 · c 18 · m 1. */
154
+ export class Spring {
155
+ x;
156
+ v = 0;
157
+ t;
158
+ k;
159
+ c;
160
+ /** k and c default to the rule's 100 and 18; a lower c lets it bounce, for things that land. */
161
+ constructor(x = 0, k = 100, c = 18) {
162
+ this.x = x;
163
+ this.t = x;
164
+ this.k = k;
165
+ this.c = c;
166
+ }
167
+ /** Advance; false once it has settled. */
168
+ step(dt, snap = false) {
169
+ if (snap) {
170
+ this.x = this.t;
171
+ this.v = 0;
172
+ return false;
173
+ }
174
+ const n = Math.max(1, Math.ceil(dt * 240));
175
+ const h = dt / n;
176
+ for (let i = 0; i < n; i++) {
177
+ this.v += (this.k * (this.t - this.x) - this.c * this.v) * h;
178
+ this.x += this.v * h;
179
+ }
180
+ if (Math.abs(this.t - this.x) < 1e-3 && Math.abs(this.v) < 1e-3) {
181
+ this.x = this.t;
182
+ this.v = 0;
183
+ return false;
184
+ }
185
+ return true;
186
+ }
187
+ }
188
+ /** cubic-bezier(.32, .72, 0, 1): the long ease-out for which part is chosen (rule 08). */
189
+ export function settle(p) {
190
+ // Past the end, or undefined (a tween set at -Infinity, for a still): finished.
191
+ if (!(p < 1))
192
+ return 1;
193
+ if (p <= 0)
194
+ return 0;
195
+ const [x1, y1, x2, y2] = [0.32, 0.72, 0, 1];
196
+ let t = p;
197
+ for (let i = 0; i < 6; i++) {
198
+ const x = 3 * (1 - t) ** 2 * t * x1 + 3 * (1 - t) * t ** 2 * x2 + t ** 3 - p;
199
+ const dx = 3 * (1 - t) ** 2 * x1 + 6 * (1 - t) * t * (x2 - x1) + 3 * t ** 2 * (1 - x2);
200
+ if (Math.abs(dx) < 1e-6)
201
+ break;
202
+ t = Math.min(1, Math.max(0, t - x / dx));
203
+ }
204
+ return 3 * (1 - t) ** 2 * t * y1 + 3 * (1 - t) * t ** 2 * y2 + t ** 3;
205
+ }
206
+ /** A tween for which part is chosen: 700ms on `settle`, with an optional delay (rule 02). */
207
+ export class Tween {
208
+ from;
209
+ to;
210
+ start = -Infinity;
211
+ dur;
212
+ constructor(x = 0, dur = 700) {
213
+ this.from = x;
214
+ this.to = x;
215
+ this.dur = dur;
216
+ }
217
+ set(to, now, delay = 0) {
218
+ if (to === this.to)
219
+ return;
220
+ this.from = this.value(now);
221
+ this.to = to;
222
+ this.start = now + delay;
223
+ }
224
+ value(now) {
225
+ return this.from + (this.to - this.from) * settle((now - this.start) / this.dur);
226
+ }
227
+ moving(now) {
228
+ return now < this.start + this.dur;
229
+ }
230
+ }
231
+ /** How strongly a part answers at distance d from the pointer, for reach R (rule 03): 1 → .31 at 42% → .09 at R → 0. */
232
+ export function falloff(d, R) {
233
+ const k = d / R;
234
+ if (k <= 0)
235
+ return 1;
236
+ if (k < 0.42)
237
+ return 1 - (0.69 * k) / 0.42;
238
+ if (k < 1)
239
+ return 0.31 - (0.22 * (k - 0.42)) / 0.58;
240
+ if (k < 1.6)
241
+ return 0.09 * (1 - (k - 1) / 0.6);
242
+ return 0;
243
+ }
244
+ export const clamp = (v, lo, hi) => (v < lo ? lo : v > hi ? hi : v);
245
+ export const lerp = (a, b, t) => a + (b - a) * t;
246
+ export const hash = (n) => {
247
+ const v = Math.sin(n * 127.1 + 311.7) * 43758.5453;
248
+ return v - Math.floor(v);
249
+ };
250
+ /** A rounded solid: a filled silhouette and one crease. */
251
+ export class Solid {
252
+ g;
253
+ sil;
254
+ crease;
255
+ constructor(make, parent) {
256
+ this.g = parent.append(make("g"));
257
+ this.sil = this.g.append(make("path")).attr("class", "sil");
258
+ this.crease = this.g.append(make("path")).attr("class", "crease");
259
+ }
260
+ /** Draw it from its rings: the silhouette is the hull of both, the crease the top ring's inner front. */
261
+ draw(cam, ring, inner, z0, z1, d = [0, 0, 0]) {
262
+ const [dx, dy, dz] = d;
263
+ const at = (r, z) => r.map(([x, y]) => cam.P(x + dx, y + dy, z + dz));
264
+ this.sil.attr("d", line(hull(at(ring, z0).concat(at(ring, z1))), true));
265
+ this.crease.attr("d", inner ? line(at(front(inner), z1)) : null);
266
+ return this;
267
+ }
268
+ /** Draw it from any two faces in the frame (a hinged lid, a tilted plate): hull, plus a crease you pass. */
269
+ drawFaces(a, b, crease) {
270
+ this.sil.attr("d", line(hull(a.concat(b)), true));
271
+ this.crease.attr("d", crease ? line(crease) : null);
272
+ return this;
273
+ }
274
+ hi(on) {
275
+ this.sil.cls("hi", on);
276
+ return this;
277
+ }
278
+ }
279
+ /** A rounded box from its footprint: ring and inner ring (inset by b) precomputed. */
280
+ export class Box {
281
+ solid;
282
+ ring;
283
+ inner;
284
+ z0;
285
+ z1;
286
+ constructor(make, parent, x0, y0, x1, y1, z0, z1, r = 0.6, b = 0.35, steps = 4) {
287
+ this.solid = new Solid(make, parent);
288
+ this.ring = rrect(x0, y0, x1, y1, r, steps);
289
+ this.inner = b > 0 ? rrect(x0 + b, y0 + b, x1 - b, y1 - b, Math.max(0, r - b), steps) : this.ring;
290
+ this.z0 = z0;
291
+ this.z1 = z1;
292
+ }
293
+ draw(cam, d = [0, 0, 0], h) {
294
+ this.solid.draw(cam, this.ring, this.inner, this.z0, h === undefined ? this.z1 : this.z0 + h, d);
295
+ return this;
296
+ }
297
+ hi(on) {
298
+ this.solid.hi(on);
299
+ return this;
300
+ }
301
+ get g() {
302
+ return this.solid.g;
303
+ }
304
+ }
305
+ /* ── Stills (no DOM) ────────────────────────────────────────────────────────── */
306
+ class VNode {
307
+ tag;
308
+ attrs = new Map();
309
+ classes = new Set();
310
+ children = [];
311
+ parent = null;
312
+ constructor(tag) {
313
+ this.tag = tag;
314
+ }
315
+ attr(name, value) {
316
+ if (name === "class") {
317
+ this.classes = new Set((value ?? "").split(/\s+/).filter(Boolean));
318
+ return this;
319
+ }
320
+ if (value === null)
321
+ this.attrs.delete(name);
322
+ else
323
+ this.attrs.set(name, value);
324
+ return this;
325
+ }
326
+ cls(name, on) {
327
+ if (on)
328
+ this.classes.add(name);
329
+ else
330
+ this.classes.delete(name);
331
+ return this;
332
+ }
333
+ append(child) {
334
+ const c = child;
335
+ // Moving a node takes it out of where it was, as in the DOM.
336
+ if (c.parent)
337
+ c.parent.children = c.parent.children.filter((x) => x !== c);
338
+ c.parent = this;
339
+ this.children.push(c);
340
+ return child;
341
+ }
342
+ order(children) {
343
+ const set = new Set(children);
344
+ this.children = [...this.children.filter((c) => !set.has(c)), ...children];
345
+ }
346
+ toString() {
347
+ const esc = (s) => s.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
348
+ const attrs = [...this.attrs].map(([k, v]) => ` ${k}="${esc(v)}"`).join("");
349
+ const cls = this.classes.size ? ` class="${[...this.classes].join(" ")}"` : "";
350
+ if (this.tag === "path" && !this.attrs.get("d"))
351
+ return "";
352
+ return `<${this.tag}${cls}${attrs}>${this.children.map(String).join("")}</${this.tag}>`;
353
+ }
354
+ }
355
+ function baseCtx(make, root, live, reduced) {
356
+ const ctx = {
357
+ live,
358
+ reduced,
359
+ make,
360
+ root,
361
+ pointer: { x: VIEW.cx, y: VIEW.cy, over: false },
362
+ ticks: [],
363
+ clicks: [],
364
+ waker: () => undefined,
365
+ g: (parent) => (parent ?? root).append(make("g")),
366
+ path: (cls, parent) => (parent ?? root).append(make("path")).attr("class", cls),
367
+ box: (x0, y0, x1, y1, z0, z1, o = {}) => new Box(make, o.parent ?? root, x0, y0, x1, y1, z0, z1, o.r, o.b, o.steps),
368
+ solid: (parent) => new Solid(make, parent ?? root),
369
+ loop(tick) {
370
+ ctx.ticks.push(tick);
371
+ },
372
+ wake: () => ctx.waker(),
373
+ onClick(fn) {
374
+ ctx.clicks.push(fn);
375
+ },
376
+ };
377
+ return ctx;
378
+ }
379
+ /** A figure at rest, as the inside of an <svg viewBox="0 0 400 320"> (for static files). */
380
+ export function renderStill(figure) {
381
+ const root = new VNode("g");
382
+ figure.mount(baseCtx((tag) => new VNode(tag), root, false, true));
383
+ return root.children.map(String).join("");
384
+ }
385
+ /* ── Live (DOM) ─────────────────────────────────────────────────────────────── */
386
+ const NS = "http://www.w3.org/2000/svg";
387
+ class DNode {
388
+ el;
389
+ last = new Map();
390
+ constructor(el) {
391
+ this.el = el;
392
+ }
393
+ attr(name, value) {
394
+ if (this.last.get(name) === value)
395
+ return this;
396
+ this.last.set(name, value);
397
+ if (value === null)
398
+ this.el.removeAttribute(name);
399
+ else
400
+ this.el.setAttribute(name, value);
401
+ return this;
402
+ }
403
+ cls(name, on) {
404
+ this.el.classList.toggle(name, on);
405
+ return this;
406
+ }
407
+ append(child) {
408
+ this.el.appendChild(child.el);
409
+ return child;
410
+ }
411
+ order(children) {
412
+ let prev = null;
413
+ for (const c of children) {
414
+ const want = prev ? prev.nextElementSibling : null;
415
+ if (prev && want !== c.el)
416
+ prev.after(c.el);
417
+ prev = c.el;
418
+ }
419
+ }
420
+ }
421
+ const running = new Set();
422
+ let raf = 0;
423
+ function schedule() {
424
+ if (raf || typeof requestAnimationFrame === "undefined")
425
+ return;
426
+ raf = requestAnimationFrame(frame);
427
+ }
428
+ function frame(now) {
429
+ raf = 0;
430
+ let any = false;
431
+ for (const r of running) {
432
+ if (!r.awake || !r.visible)
433
+ continue;
434
+ const dt = Math.min(0.05, Math.max(0, (now - (r.last || now)) / 1000));
435
+ r.last = now;
436
+ r.awake = r.tick(dt, now);
437
+ if (r.awake)
438
+ any = true;
439
+ else
440
+ r.last = 0;
441
+ }
442
+ if (any)
443
+ schedule();
444
+ }
445
+ /**
446
+ * Draw a figure into an <svg> and let it answer the pointer. The pointer is read on `trigger`
447
+ * (an ancestor with `data-iso-trigger`, or the svg); `data-active` on the svg holds it over the
448
+ * figure's centre. Returns a function that stops it and empties the svg.
449
+ */
450
+ export function mountFigure(svg, figure, opts) {
451
+ const reduced = typeof matchMedia !== "undefined" && matchMedia("(prefers-reduced-motion: reduce)").matches;
452
+ const root = new DNode(document.createElementNS(NS, "g"));
453
+ svg.replaceChildren(root.el);
454
+ const ctx = baseCtx((tag) => new DNode(document.createElementNS(NS, tag)), root, opts.live, reduced);
455
+ figure.mount(ctx);
456
+ if (!opts.live)
457
+ return () => svg.replaceChildren();
458
+ const state = {
459
+ awake: true,
460
+ visible: true,
461
+ last: 0,
462
+ tick: (dt, now) => {
463
+ let moving = false;
464
+ for (const t of ctx.ticks)
465
+ if (t(dt, now))
466
+ moving = true;
467
+ return moving;
468
+ },
469
+ };
470
+ ctx.waker = () => {
471
+ state.awake = true;
472
+ schedule();
473
+ };
474
+ running.add(state);
475
+ const trigger = svg.closest("[data-iso-trigger]") ?? svg;
476
+ // On its own, a figure answers only while the pointer is on a drawn part (every part is a
477
+ // painted shape, so the event target says so), not anywhere in its 400 × 320 frame. A
478
+ // `data-iso-trigger` ancestor keeps answering across its whole area. Parts lift as they answer,
479
+ // so leaving a part waits a moment before the figure lets go: no flicker at an edge.
480
+ const wholeArea = trigger !== svg;
481
+ const GRACE = 140;
482
+ let letGo = 0;
483
+ let hovering = false;
484
+ const toFrame = (e) => {
485
+ const m = svg.getScreenCTM();
486
+ if (!m)
487
+ return;
488
+ const p = new DOMPoint(e.clientX, e.clientY).matrixTransform(m.inverse());
489
+ ctx.pointer.x = p.x;
490
+ ctx.pointer.y = p.y;
491
+ };
492
+ const syncActive = () => {
493
+ if (hovering)
494
+ return;
495
+ const active = svg.hasAttribute("data-active");
496
+ ctx.pointer.over = active;
497
+ if (active) {
498
+ ctx.pointer.x = VIEW.cx;
499
+ ctx.pointer.y = VIEW.cy;
500
+ }
501
+ ctx.wake();
502
+ };
503
+ const release = () => {
504
+ clearTimeout(letGo);
505
+ letGo = 0;
506
+ hovering = false;
507
+ ctx.pointer.over = false;
508
+ syncActive();
509
+ };
510
+ const onMove = (e) => {
511
+ toFrame(e);
512
+ const target = e.target;
513
+ const onPart = wholeArea || (target instanceof Element && target !== svg && root.el.contains(target));
514
+ if (onPart) {
515
+ clearTimeout(letGo);
516
+ letGo = 0;
517
+ hovering = true;
518
+ ctx.pointer.over = true;
519
+ }
520
+ else if (hovering && !letGo) {
521
+ letGo = window.setTimeout(release, GRACE);
522
+ }
523
+ if (hovering)
524
+ ctx.wake();
525
+ };
526
+ const onLeave = (e) => {
527
+ if (e.pointerType === "touch")
528
+ return;
529
+ release();
530
+ };
531
+ const onClick = (e) => {
532
+ if (!ctx.clicks.length)
533
+ return;
534
+ toFrame(e);
535
+ for (const fn of ctx.clicks)
536
+ fn(ctx.pointer.x, ctx.pointer.y, e);
537
+ ctx.wake();
538
+ };
539
+ const onMenu = (e) => {
540
+ if (!ctx.clicks.length)
541
+ return;
542
+ e.preventDefault();
543
+ onClick(e);
544
+ };
545
+ trigger.addEventListener("pointermove", onMove);
546
+ trigger.addEventListener("pointerdown", onMove);
547
+ trigger.addEventListener("pointerleave", onLeave);
548
+ svg.addEventListener("click", onClick);
549
+ svg.addEventListener("contextmenu", onMenu);
550
+ if (ctx.clicks.length)
551
+ svg.style.cursor = "pointer";
552
+ const mo = new MutationObserver(syncActive);
553
+ mo.observe(svg, { attributes: true, attributeFilter: ["data-active"] });
554
+ const io = typeof IntersectionObserver === "undefined"
555
+ ? null
556
+ : new IntersectionObserver((entries) => {
557
+ state.visible = entries.some((e) => e.isIntersecting);
558
+ if (state.visible)
559
+ ctx.wake();
560
+ });
561
+ io?.observe(svg);
562
+ syncActive();
563
+ ctx.wake();
564
+ return () => {
565
+ clearTimeout(letGo);
566
+ running.delete(state);
567
+ trigger.removeEventListener("pointermove", onMove);
568
+ trigger.removeEventListener("pointerdown", onMove);
569
+ trigger.removeEventListener("pointerleave", onLeave);
570
+ svg.removeEventListener("click", onClick);
571
+ svg.removeEventListener("contextmenu", onMenu);
572
+ mo.disconnect();
573
+ io?.disconnect();
574
+ svg.replaceChildren();
575
+ };
576
+ }
@@ -0,0 +1,42 @@
1
+ import { type Cam, type V2, type V3 } from "./kernel.js";
2
+ /** The mark's height and width. */
3
+ export declare const MARK_H: number;
4
+ export declare const MARK_W: number;
5
+ /** The brackets as boxes in the x–z plane: [x0, x1, z0, z1] — a stem and an arm each. */
6
+ export declare const BRACKETS: {
7
+ readonly left: {
8
+ readonly stem: readonly [number, number, 0, number];
9
+ readonly arm: readonly [0, number, number, number];
10
+ };
11
+ readonly right: {
12
+ readonly stem: readonly [number, number, number, number];
13
+ readonly arm: readonly [number, number, number, number];
14
+ };
15
+ };
16
+ /** The mark as a relief on a flat face: two bracket outlines, `size` tall, from (u0, v0) in face units. */
17
+ export declare function markOutline(size: number): V2[][];
18
+ /** A face of a box as a map from face units to the frame. */
19
+ export type Face = (u: number, v: number) => V2;
20
+ /** The +y face (the front, lower left) at y, from x0 and base z0: u along x, v up. */
21
+ export declare const frontFace: (cam: Cam, x0: number, y: number, z0: number) => Face;
22
+ /** The +x face (lower right) at x, from y0 and base z0: u along y, v up. */
23
+ export declare const sideFace: (cam: Cam, x: number, y0: number, z0: number) => Face;
24
+ /** A top face at height z, from (x0, y0): u along x, v along y. */
25
+ export declare const topFace: (cam: Cam, x0: number, y0: number, z: number) => Face;
26
+ /** A rounded rectangle on a face, as closed path data. */
27
+ export declare const faceRect: (face: Face, u0: number, v0: number, w: number, h: number, r?: number) => string;
28
+ /** A straight line on a face. */
29
+ export declare const faceLine: (face: Face, a: V2, b: V2) => string;
30
+ /** A polyline through world points. */
31
+ export declare const poly: (cam: Cam, pts: V3[], closed?: boolean) => string;
32
+ /** A short dash centred at fraction t along a world segment: a pulse of light on a cable. */
33
+ export declare function dash(cam: Cam, a: V3, b: V3, t: number, len: number): string;
34
+ /** A point at fraction t along a polyline of world points (by length). */
35
+ export declare function along(pts: V3[], t: number): V3;
36
+ /** A pulse along a polyline: the stretch [t − len, t] of its length, as path data. */
37
+ export declare function pulse(cam: Cam, pts: V3[], t: number, len: number): string;
38
+ /**
39
+ * Where a value sits among band centres, as a fractional index (rule 01: the bands are rest
40
+ * positions and never move). Centres may run either way; the result is clamped half a band out.
41
+ */
42
+ export declare function bandIndex(v: number, centres: number[]): number;