@jean-is/render 0.13.0-r9bbebfbc9ca0 → 0.15.0-rb27e39338b6f

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 (529) hide show
  1. package/caps/charts/charts.js +13 -0
  2. package/caps/interactive/alive.js +96 -0
  3. package/caps/interactive/alone.js +191 -0
  4. package/caps/interactive/apps.js +15 -5
  5. package/caps/interactive/live.js +17 -9
  6. package/caps/interactive/parts.js +8 -0
  7. package/caps/interactive/view-parts.js +20 -28
  8. package/caps/made/paper.js +5 -2
  9. package/caps/skills/directory.js +20 -1
  10. package/caps/slides/edit.js +17 -0
  11. package/caps/slides/save.js +3 -3
  12. package/caps/slides/slides.css +13 -9
  13. package/caps/slides/slides.js +10 -6
  14. package/core/llm.js +7 -2
  15. package/locales/am.json +1 -1
  16. package/locales/ar.json +1 -1
  17. package/locales/bg.json +1 -1
  18. package/locales/bn.json +1 -1
  19. package/locales/br.json +1 -1
  20. package/locales/brains/am.json +2 -0
  21. package/locales/brains/ar.json +2 -0
  22. package/locales/brains/bg.json +2 -0
  23. package/locales/brains/bn.json +2 -0
  24. package/locales/brains/br.json +2 -0
  25. package/locales/brains/co.json +2 -0
  26. package/locales/brains/cs.json +2 -0
  27. package/locales/brains/da.json +2 -0
  28. package/locales/brains/de.json +2 -0
  29. package/locales/brains/el.json +2 -0
  30. package/locales/brains/en.json +2 -0
  31. package/locales/brains/es.json +2 -0
  32. package/locales/brains/fa.json +2 -0
  33. package/locales/brains/fi.json +2 -0
  34. package/locales/brains/fr-CA.json +2 -0
  35. package/locales/brains/fr.json +2 -0
  36. package/locales/brains/ha.json +2 -0
  37. package/locales/brains/he.json +2 -0
  38. package/locales/brains/hi.json +2 -0
  39. package/locales/brains/hr.json +2 -0
  40. package/locales/brains/hu.json +2 -0
  41. package/locales/brains/id.json +2 -0
  42. package/locales/brains/it.json +2 -0
  43. package/locales/brains/ja.json +2 -0
  44. package/locales/brains/ko.json +2 -0
  45. package/locales/brains/mr.json +2 -0
  46. package/locales/brains/ms.json +2 -0
  47. package/locales/brains/nl.json +2 -0
  48. package/locales/brains/pl.json +2 -0
  49. package/locales/brains/pt.json +2 -0
  50. package/locales/brains/ro.json +2 -0
  51. package/locales/brains/ru.json +2 -0
  52. package/locales/brains/sk.json +2 -0
  53. package/locales/brains/sv.json +2 -0
  54. package/locales/brains/sw.json +2 -0
  55. package/locales/brains/ta.json +2 -0
  56. package/locales/brains/te.json +2 -0
  57. package/locales/brains/th.json +2 -0
  58. package/locales/brains/tl.json +2 -0
  59. package/locales/brains/tr.json +2 -0
  60. package/locales/brains/uk.json +2 -0
  61. package/locales/brains/ur.json +2 -0
  62. package/locales/brains/vi.json +2 -0
  63. package/locales/brains/yo.json +2 -0
  64. package/locales/brains/zh-Hans.json +2 -0
  65. package/locales/brains/zh-Hant.json +2 -0
  66. package/locales/co.json +1 -1
  67. package/locales/connections/am.json +6 -0
  68. package/locales/connections/ar.json +6 -0
  69. package/locales/connections/bg.json +6 -0
  70. package/locales/connections/bn.json +6 -0
  71. package/locales/connections/br.json +6 -0
  72. package/locales/connections/co.json +6 -0
  73. package/locales/connections/cs.json +6 -0
  74. package/locales/connections/da.json +6 -0
  75. package/locales/connections/de.json +6 -0
  76. package/locales/connections/el.json +6 -0
  77. package/locales/connections/en.json +6 -0
  78. package/locales/connections/es.json +6 -0
  79. package/locales/connections/fa.json +6 -0
  80. package/locales/connections/fi.json +6 -0
  81. package/locales/connections/fr-CA.json +6 -0
  82. package/locales/connections/fr.json +6 -0
  83. package/locales/connections/ha.json +6 -0
  84. package/locales/connections/he.json +6 -0
  85. package/locales/connections/hi.json +6 -0
  86. package/locales/connections/hr.json +6 -0
  87. package/locales/connections/hu.json +6 -0
  88. package/locales/connections/id.json +6 -0
  89. package/locales/connections/it.json +6 -0
  90. package/locales/connections/ja.json +6 -0
  91. package/locales/connections/ko.json +6 -0
  92. package/locales/connections/mr.json +6 -0
  93. package/locales/connections/ms.json +6 -0
  94. package/locales/connections/nl.json +6 -0
  95. package/locales/connections/pl.json +6 -0
  96. package/locales/connections/pt.json +6 -0
  97. package/locales/connections/ro.json +6 -0
  98. package/locales/connections/ru.json +6 -0
  99. package/locales/connections/sk.json +6 -0
  100. package/locales/connections/sv.json +6 -0
  101. package/locales/connections/sw.json +6 -0
  102. package/locales/connections/ta.json +6 -0
  103. package/locales/connections/te.json +6 -0
  104. package/locales/connections/th.json +6 -0
  105. package/locales/connections/tl.json +6 -0
  106. package/locales/connections/tr.json +6 -0
  107. package/locales/connections/uk.json +6 -0
  108. package/locales/connections/ur.json +6 -0
  109. package/locales/connections/vi.json +6 -0
  110. package/locales/connections/yo.json +6 -0
  111. package/locales/connections/zh-Hans.json +6 -0
  112. package/locales/connections/zh-Hant.json +6 -0
  113. package/locales/creations/am.json +3 -0
  114. package/locales/creations/ar.json +3 -0
  115. package/locales/creations/bg.json +3 -0
  116. package/locales/creations/bn.json +3 -0
  117. package/locales/creations/br.json +3 -0
  118. package/locales/creations/co.json +3 -0
  119. package/locales/creations/cs.json +3 -0
  120. package/locales/creations/da.json +3 -0
  121. package/locales/creations/de.json +3 -0
  122. package/locales/creations/el.json +3 -0
  123. package/locales/creations/en.json +3 -0
  124. package/locales/creations/es.json +3 -0
  125. package/locales/creations/fa.json +3 -0
  126. package/locales/creations/fi.json +3 -0
  127. package/locales/creations/fr-CA.json +3 -0
  128. package/locales/creations/fr.json +3 -0
  129. package/locales/creations/ha.json +3 -0
  130. package/locales/creations/he.json +3 -0
  131. package/locales/creations/hi.json +3 -0
  132. package/locales/creations/hr.json +3 -0
  133. package/locales/creations/hu.json +3 -0
  134. package/locales/creations/id.json +3 -0
  135. package/locales/creations/it.json +3 -0
  136. package/locales/creations/ja.json +3 -0
  137. package/locales/creations/ko.json +3 -0
  138. package/locales/creations/mr.json +3 -0
  139. package/locales/creations/ms.json +3 -0
  140. package/locales/creations/nl.json +3 -0
  141. package/locales/creations/pl.json +3 -0
  142. package/locales/creations/pt.json +3 -0
  143. package/locales/creations/ro.json +3 -0
  144. package/locales/creations/ru.json +3 -0
  145. package/locales/creations/sk.json +3 -0
  146. package/locales/creations/sv.json +3 -0
  147. package/locales/creations/sw.json +3 -0
  148. package/locales/creations/ta.json +3 -0
  149. package/locales/creations/te.json +3 -0
  150. package/locales/creations/th.json +3 -0
  151. package/locales/creations/tl.json +3 -0
  152. package/locales/creations/tr.json +3 -0
  153. package/locales/creations/uk.json +3 -0
  154. package/locales/creations/ur.json +3 -0
  155. package/locales/creations/vi.json +3 -0
  156. package/locales/creations/yo.json +3 -0
  157. package/locales/creations/zh-Hans.json +3 -0
  158. package/locales/creations/zh-Hant.json +3 -0
  159. package/locales/cs.json +1 -1
  160. package/locales/da.json +1 -1
  161. package/locales/de.json +1 -1
  162. package/locales/designs/am.json +4 -0
  163. package/locales/designs/ar.json +4 -0
  164. package/locales/designs/bg.json +4 -0
  165. package/locales/designs/bn.json +4 -0
  166. package/locales/designs/br.json +4 -0
  167. package/locales/designs/co.json +4 -0
  168. package/locales/designs/cs.json +4 -0
  169. package/locales/designs/da.json +4 -0
  170. package/locales/designs/de.json +4 -0
  171. package/locales/designs/el.json +4 -0
  172. package/locales/designs/en.json +4 -0
  173. package/locales/designs/es.json +4 -0
  174. package/locales/designs/fa.json +4 -0
  175. package/locales/designs/fi.json +4 -0
  176. package/locales/designs/fr-CA.json +4 -0
  177. package/locales/designs/fr.json +4 -0
  178. package/locales/designs/ha.json +4 -0
  179. package/locales/designs/he.json +4 -0
  180. package/locales/designs/hi.json +4 -0
  181. package/locales/designs/hr.json +4 -0
  182. package/locales/designs/hu.json +4 -0
  183. package/locales/designs/id.json +4 -0
  184. package/locales/designs/it.json +4 -0
  185. package/locales/designs/ja.json +4 -0
  186. package/locales/designs/ko.json +4 -0
  187. package/locales/designs/mr.json +4 -0
  188. package/locales/designs/ms.json +4 -0
  189. package/locales/designs/nl.json +4 -0
  190. package/locales/designs/pl.json +4 -0
  191. package/locales/designs/pt.json +4 -0
  192. package/locales/designs/ro.json +4 -0
  193. package/locales/designs/ru.json +4 -0
  194. package/locales/designs/sk.json +4 -0
  195. package/locales/designs/sv.json +4 -0
  196. package/locales/designs/sw.json +4 -0
  197. package/locales/designs/ta.json +4 -0
  198. package/locales/designs/te.json +4 -0
  199. package/locales/designs/th.json +4 -0
  200. package/locales/designs/tl.json +4 -0
  201. package/locales/designs/tr.json +4 -0
  202. package/locales/designs/uk.json +4 -0
  203. package/locales/designs/ur.json +4 -0
  204. package/locales/designs/vi.json +4 -0
  205. package/locales/designs/yo.json +4 -0
  206. package/locales/designs/zh-Hans.json +4 -0
  207. package/locales/designs/zh-Hant.json +4 -0
  208. package/locales/devices/am.json +7 -5
  209. package/locales/devices/ar.json +7 -5
  210. package/locales/devices/bg.json +7 -5
  211. package/locales/devices/bn.json +7 -5
  212. package/locales/devices/br.json +7 -5
  213. package/locales/devices/co.json +7 -5
  214. package/locales/devices/cs.json +7 -5
  215. package/locales/devices/da.json +7 -5
  216. package/locales/devices/de.json +7 -5
  217. package/locales/devices/el.json +7 -5
  218. package/locales/devices/en.json +7 -5
  219. package/locales/devices/es.json +7 -5
  220. package/locales/devices/fa.json +7 -5
  221. package/locales/devices/fi.json +7 -5
  222. package/locales/devices/fr-CA.json +7 -5
  223. package/locales/devices/fr.json +7 -5
  224. package/locales/devices/ha.json +7 -5
  225. package/locales/devices/he.json +7 -5
  226. package/locales/devices/hi.json +7 -5
  227. package/locales/devices/hr.json +7 -5
  228. package/locales/devices/hu.json +7 -5
  229. package/locales/devices/id.json +7 -5
  230. package/locales/devices/it.json +7 -5
  231. package/locales/devices/ja.json +7 -5
  232. package/locales/devices/ko.json +7 -5
  233. package/locales/devices/mr.json +7 -5
  234. package/locales/devices/ms.json +7 -5
  235. package/locales/devices/nl.json +7 -5
  236. package/locales/devices/pl.json +7 -5
  237. package/locales/devices/pt.json +7 -5
  238. package/locales/devices/ro.json +7 -5
  239. package/locales/devices/ru.json +7 -5
  240. package/locales/devices/sk.json +7 -5
  241. package/locales/devices/sv.json +7 -5
  242. package/locales/devices/sw.json +7 -5
  243. package/locales/devices/ta.json +7 -5
  244. package/locales/devices/te.json +7 -5
  245. package/locales/devices/th.json +7 -5
  246. package/locales/devices/tl.json +7 -5
  247. package/locales/devices/tr.json +7 -5
  248. package/locales/devices/uk.json +7 -5
  249. package/locales/devices/ur.json +7 -5
  250. package/locales/devices/vi.json +7 -5
  251. package/locales/devices/yo.json +7 -5
  252. package/locales/devices/zh-Hans.json +7 -5
  253. package/locales/devices/zh-Hant.json +7 -5
  254. package/locales/dialogs/am.json +1 -1
  255. package/locales/dialogs/ar.json +1 -1
  256. package/locales/dialogs/bg.json +1 -1
  257. package/locales/dialogs/bn.json +1 -1
  258. package/locales/dialogs/br.json +1 -1
  259. package/locales/dialogs/co.json +1 -1
  260. package/locales/dialogs/cs.json +1 -1
  261. package/locales/dialogs/da.json +1 -1
  262. package/locales/dialogs/de.json +1 -1
  263. package/locales/dialogs/el.json +1 -1
  264. package/locales/dialogs/en.json +1 -1
  265. package/locales/dialogs/es.json +1 -1
  266. package/locales/dialogs/fa.json +1 -1
  267. package/locales/dialogs/fi.json +1 -1
  268. package/locales/dialogs/fr-CA.json +1 -1
  269. package/locales/dialogs/fr.json +1 -1
  270. package/locales/dialogs/ha.json +1 -1
  271. package/locales/dialogs/he.json +1 -1
  272. package/locales/dialogs/hi.json +1 -1
  273. package/locales/dialogs/hr.json +1 -1
  274. package/locales/dialogs/hu.json +1 -1
  275. package/locales/dialogs/id.json +1 -1
  276. package/locales/dialogs/it.json +1 -1
  277. package/locales/dialogs/ja.json +1 -1
  278. package/locales/dialogs/ko.json +1 -1
  279. package/locales/dialogs/mr.json +1 -1
  280. package/locales/dialogs/ms.json +1 -1
  281. package/locales/dialogs/nl.json +1 -1
  282. package/locales/dialogs/pl.json +1 -1
  283. package/locales/dialogs/pt.json +1 -1
  284. package/locales/dialogs/ro.json +1 -1
  285. package/locales/dialogs/ru.json +1 -1
  286. package/locales/dialogs/sk.json +1 -1
  287. package/locales/dialogs/sv.json +1 -1
  288. package/locales/dialogs/sw.json +1 -1
  289. package/locales/dialogs/ta.json +1 -1
  290. package/locales/dialogs/te.json +1 -1
  291. package/locales/dialogs/th.json +1 -1
  292. package/locales/dialogs/tl.json +1 -1
  293. package/locales/dialogs/tr.json +1 -1
  294. package/locales/dialogs/uk.json +1 -1
  295. package/locales/dialogs/ur.json +1 -1
  296. package/locales/dialogs/vi.json +1 -1
  297. package/locales/dialogs/yo.json +1 -1
  298. package/locales/dialogs/zh-Hans.json +1 -1
  299. package/locales/dialogs/zh-Hant.json +1 -1
  300. package/locales/el.json +1 -1
  301. package/locales/en.json +1 -1
  302. package/locales/es.json +1 -1
  303. package/locales/fa.json +1 -1
  304. package/locales/fi.json +1 -1
  305. package/locales/fr-CA.json +1 -1
  306. package/locales/fr.json +1 -1
  307. package/locales/ha.json +1 -1
  308. package/locales/he.json +1 -1
  309. package/locales/hi.json +1 -1
  310. package/locales/hr.json +1 -1
  311. package/locales/hu.json +1 -1
  312. package/locales/id.json +1 -1
  313. package/locales/it.json +1 -1
  314. package/locales/ja.json +1 -1
  315. package/locales/ko.json +1 -1
  316. package/locales/mr.json +1 -1
  317. package/locales/ms.json +1 -1
  318. package/locales/nl.json +1 -1
  319. package/locales/pl.json +1 -1
  320. package/locales/pt.json +1 -1
  321. package/locales/ro.json +1 -1
  322. package/locales/ru.json +1 -1
  323. package/locales/sites/am.json +7 -0
  324. package/locales/sites/ar.json +11 -0
  325. package/locales/sites/bg.json +7 -0
  326. package/locales/sites/bn.json +7 -0
  327. package/locales/sites/br.json +10 -0
  328. package/locales/sites/co.json +8 -0
  329. package/locales/sites/cs.json +9 -0
  330. package/locales/sites/da.json +7 -0
  331. package/locales/sites/de.json +7 -0
  332. package/locales/sites/el.json +7 -0
  333. package/locales/sites/en.json +7 -0
  334. package/locales/sites/es.json +8 -0
  335. package/locales/sites/fa.json +7 -0
  336. package/locales/sites/fi.json +7 -0
  337. package/locales/sites/fr-CA.json +8 -0
  338. package/locales/sites/fr.json +8 -0
  339. package/locales/sites/ha.json +7 -0
  340. package/locales/sites/he.json +8 -0
  341. package/locales/sites/hi.json +7 -0
  342. package/locales/sites/hr.json +8 -0
  343. package/locales/sites/hu.json +7 -0
  344. package/locales/sites/id.json +6 -0
  345. package/locales/sites/it.json +8 -0
  346. package/locales/sites/ja.json +6 -0
  347. package/locales/sites/ko.json +6 -0
  348. package/locales/sites/mr.json +7 -0
  349. package/locales/sites/ms.json +6 -0
  350. package/locales/sites/nl.json +7 -0
  351. package/locales/sites/pl.json +9 -0
  352. package/locales/sites/pt.json +8 -0
  353. package/locales/sites/ro.json +8 -0
  354. package/locales/sites/ru.json +9 -0
  355. package/locales/sites/sk.json +9 -0
  356. package/locales/sites/sv.json +7 -0
  357. package/locales/sites/sw.json +7 -0
  358. package/locales/sites/ta.json +7 -0
  359. package/locales/sites/te.json +7 -0
  360. package/locales/sites/th.json +6 -0
  361. package/locales/sites/tl.json +7 -0
  362. package/locales/sites/tr.json +7 -0
  363. package/locales/sites/uk.json +9 -0
  364. package/locales/sites/ur.json +7 -0
  365. package/locales/sites/vi.json +6 -0
  366. package/locales/sites/yo.json +6 -0
  367. package/locales/sites/zh-Hans.json +6 -0
  368. package/locales/sites/zh-Hant.json +6 -0
  369. package/locales/sk.json +1 -1
  370. package/locales/slides/am.json +1 -1
  371. package/locales/slides/ar.json +1 -1
  372. package/locales/slides/bg.json +1 -1
  373. package/locales/slides/bn.json +1 -1
  374. package/locales/slides/br.json +1 -1
  375. package/locales/slides/co.json +1 -1
  376. package/locales/slides/cs.json +1 -1
  377. package/locales/slides/da.json +1 -1
  378. package/locales/slides/de.json +1 -1
  379. package/locales/slides/el.json +1 -1
  380. package/locales/slides/en.json +1 -1
  381. package/locales/slides/es.json +1 -1
  382. package/locales/slides/fa.json +1 -1
  383. package/locales/slides/fi.json +1 -1
  384. package/locales/slides/fr-CA.json +1 -1
  385. package/locales/slides/fr.json +1 -1
  386. package/locales/slides/ha.json +1 -1
  387. package/locales/slides/he.json +1 -1
  388. package/locales/slides/hi.json +1 -1
  389. package/locales/slides/hr.json +1 -1
  390. package/locales/slides/hu.json +1 -1
  391. package/locales/slides/id.json +1 -1
  392. package/locales/slides/it.json +1 -1
  393. package/locales/slides/ja.json +1 -1
  394. package/locales/slides/ko.json +1 -1
  395. package/locales/slides/mr.json +1 -1
  396. package/locales/slides/ms.json +1 -1
  397. package/locales/slides/nl.json +1 -1
  398. package/locales/slides/pl.json +1 -1
  399. package/locales/slides/pt.json +1 -1
  400. package/locales/slides/ro.json +1 -1
  401. package/locales/slides/ru.json +1 -1
  402. package/locales/slides/sk.json +1 -1
  403. package/locales/slides/sv.json +1 -1
  404. package/locales/slides/sw.json +1 -1
  405. package/locales/slides/ta.json +1 -1
  406. package/locales/slides/te.json +1 -1
  407. package/locales/slides/th.json +1 -1
  408. package/locales/slides/tl.json +1 -1
  409. package/locales/slides/tr.json +1 -1
  410. package/locales/slides/uk.json +1 -1
  411. package/locales/slides/ur.json +1 -1
  412. package/locales/slides/vi.json +1 -1
  413. package/locales/slides/yo.json +1 -1
  414. package/locales/slides/zh-Hans.json +1 -1
  415. package/locales/slides/zh-Hant.json +1 -1
  416. package/locales/sv.json +1 -1
  417. package/locales/sw.json +1 -1
  418. package/locales/ta.json +1 -1
  419. package/locales/tables/am.json +50 -9
  420. package/locales/tables/ar.json +58 -17
  421. package/locales/tables/bg.json +50 -9
  422. package/locales/tables/bn.json +50 -9
  423. package/locales/tables/br.json +56 -15
  424. package/locales/tables/co.json +52 -11
  425. package/locales/tables/cs.json +54 -13
  426. package/locales/tables/da.json +50 -9
  427. package/locales/tables/de.json +50 -9
  428. package/locales/tables/el.json +50 -9
  429. package/locales/tables/en.json +50 -9
  430. package/locales/tables/es.json +52 -11
  431. package/locales/tables/fa.json +50 -9
  432. package/locales/tables/fi.json +50 -9
  433. package/locales/tables/fr-CA.json +52 -11
  434. package/locales/tables/fr.json +52 -11
  435. package/locales/tables/ha.json +50 -9
  436. package/locales/tables/he.json +52 -11
  437. package/locales/tables/hi.json +50 -9
  438. package/locales/tables/hr.json +52 -11
  439. package/locales/tables/hu.json +50 -9
  440. package/locales/tables/id.json +48 -7
  441. package/locales/tables/it.json +52 -11
  442. package/locales/tables/ja.json +48 -7
  443. package/locales/tables/ko.json +48 -7
  444. package/locales/tables/mr.json +50 -9
  445. package/locales/tables/ms.json +48 -7
  446. package/locales/tables/nl.json +50 -9
  447. package/locales/tables/pl.json +54 -13
  448. package/locales/tables/pt.json +52 -11
  449. package/locales/tables/ro.json +52 -11
  450. package/locales/tables/ru.json +54 -13
  451. package/locales/tables/sk.json +54 -13
  452. package/locales/tables/sv.json +50 -9
  453. package/locales/tables/sw.json +50 -9
  454. package/locales/tables/ta.json +50 -9
  455. package/locales/tables/te.json +50 -9
  456. package/locales/tables/th.json +48 -7
  457. package/locales/tables/tl.json +50 -9
  458. package/locales/tables/tr.json +50 -9
  459. package/locales/tables/uk.json +54 -13
  460. package/locales/tables/ur.json +50 -9
  461. package/locales/tables/vi.json +48 -7
  462. package/locales/tables/yo.json +48 -7
  463. package/locales/tables/zh-Hans.json +48 -7
  464. package/locales/tables/zh-Hant.json +48 -7
  465. package/locales/te.json +1 -1
  466. package/locales/th.json +1 -1
  467. package/locales/tl.json +1 -1
  468. package/locales/tr.json +1 -1
  469. package/locales/uk.json +1 -1
  470. package/locales/ur.json +1 -1
  471. package/locales/vi.json +1 -1
  472. package/locales/whiteboards/am.json +125 -0
  473. package/locales/whiteboards/ar.json +149 -0
  474. package/locales/whiteboards/bg.json +125 -0
  475. package/locales/whiteboards/bn.json +125 -0
  476. package/locales/whiteboards/br.json +143 -0
  477. package/locales/whiteboards/co.json +131 -0
  478. package/locales/whiteboards/cs.json +137 -0
  479. package/locales/whiteboards/da.json +125 -0
  480. package/locales/whiteboards/de.json +125 -0
  481. package/locales/whiteboards/el.json +125 -0
  482. package/locales/whiteboards/en.json +125 -0
  483. package/locales/whiteboards/es.json +131 -0
  484. package/locales/whiteboards/fa.json +125 -0
  485. package/locales/whiteboards/fi.json +125 -0
  486. package/locales/whiteboards/fr-CA.json +131 -0
  487. package/locales/whiteboards/fr.json +131 -0
  488. package/locales/whiteboards/ha.json +125 -0
  489. package/locales/whiteboards/he.json +131 -0
  490. package/locales/whiteboards/hi.json +125 -0
  491. package/locales/whiteboards/hr.json +131 -0
  492. package/locales/whiteboards/hu.json +125 -0
  493. package/locales/whiteboards/id.json +119 -0
  494. package/locales/whiteboards/it.json +131 -0
  495. package/locales/whiteboards/ja.json +119 -0
  496. package/locales/whiteboards/ko.json +119 -0
  497. package/locales/whiteboards/mr.json +125 -0
  498. package/locales/whiteboards/ms.json +119 -0
  499. package/locales/whiteboards/nl.json +125 -0
  500. package/locales/whiteboards/pl.json +137 -0
  501. package/locales/whiteboards/pt.json +131 -0
  502. package/locales/whiteboards/ro.json +131 -0
  503. package/locales/whiteboards/ru.json +137 -0
  504. package/locales/whiteboards/sk.json +137 -0
  505. package/locales/whiteboards/sv.json +125 -0
  506. package/locales/whiteboards/sw.json +125 -0
  507. package/locales/whiteboards/ta.json +125 -0
  508. package/locales/whiteboards/te.json +125 -0
  509. package/locales/whiteboards/th.json +119 -0
  510. package/locales/whiteboards/tl.json +125 -0
  511. package/locales/whiteboards/tr.json +125 -0
  512. package/locales/whiteboards/uk.json +137 -0
  513. package/locales/whiteboards/ur.json +125 -0
  514. package/locales/whiteboards/vi.json +119 -0
  515. package/locales/whiteboards/yo.json +119 -0
  516. package/locales/whiteboards/zh-Hans.json +119 -0
  517. package/locales/whiteboards/zh-Hant.json +119 -0
  518. package/locales/yo.json +1 -1
  519. package/locales/zh-Hans.json +1 -1
  520. package/locales/zh-Hant.json +1 -1
  521. package/package.json +1 -1
  522. package/ui/caps.js +1 -0
  523. package/ui/kit.js +2 -2
  524. package/ui/looks/human.css +1 -1
  525. package/ui/looks.js +7 -7
  526. package/ui/markdown.js +6 -5
  527. package/ui/style.css +2 -2
  528. package/ui/view.css +4 -3
  529. package/vendor/LICENSES/readable-stream.txt +47 -0
@@ -176,6 +176,19 @@ class AppChart extends HTMLElement {
176
176
  paper.dispose()
177
177
  }
178
178
  }
179
+
180
+ /** The chart as it shows, in SVG at its size, for a page that leaves Jean drawn (../interactive/alone.js); '' while none is drawn. */
181
+ svg() {
182
+ const { option } = this, box = this.querySelector('.chart')
183
+ if (!option || !box) return ''
184
+ const copy = echarts.init(null, theme.peek() === 'dark' ? 'dark' : undefined, { renderer: 'svg', ssr: true, width: box.clientWidth, height: box.clientHeight })
185
+ try {
186
+ copy.setOption({ ...dressed(option, getComputedStyle(this).fontFamily), animation: false })
187
+ return copy.renderToSVGString()
188
+ } finally {
189
+ copy.dispose()
190
+ }
191
+ }
179
192
  }
180
193
 
181
194
  // A canvas draws its words in the one direction it is given: each is given its own, for the box's `dir="ltr"` not to flip a mixed one (in SVG: charts.css).
@@ -0,0 +1,96 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // A page of parts on its own, live where it lands (./alone.js): never loaded by Jean, it runs in the page that left it, which holds its parts
3
+ // drawn as Jean drew them, each marked by its place among them. At each change of a field, a row a form adds to a table of the page or a head
4
+ // pressed, what they share is worked out again (./live.js) and written into the parts that show it: the figures, the cards' headings and
5
+ // words, the tables' rows, sorted by the head pressed, and the charts, drawn again by ECharts where the page holds it. Nothing is sent.
6
+ import { parse, all, figures, table, chart, number, option } from './parts.js'
7
+ import { shared } from './live.js'
8
+ import { localize } from '../charts/option.js'
9
+
10
+ /** @import { Part } from './parts.js' */
11
+
12
+ const root = /** @type {HTMLElement} */ (document.querySelector('app-parts')), lang = document.documentElement.lang
13
+ const { source = '', locales = [lang], dark = false, still = false } = JSON.parse(document.getElementById('parts')?.textContent ?? '{}')
14
+ const parts = parse(source) ?? [], list = all(parts), tables = list.filter((part) => part.tag === 'app-table')
15
+ /** What the user set in the fields, by label; the rows the forms added, by table; how each table is sorted, by its place. */
16
+ const [given, added, sorted] = [/** @type {Map<string, string | boolean>} */ (new Map()), /** @type {Map<string, string[][]>} */ (new Map()), /** @type {Map<number, { column: number, down: boolean }>} */ (new Map())]
17
+ const collator = new Intl.Collator(locales, { numeric: true })
18
+ /** @type {Promise<any> | null} */
19
+ let echarts = null
20
+
21
+ /** A row of cells, the first its row's head where the table names its rows, each in the class its column's head has. @param {unknown[]} cells @param {Element[]} heads @param {boolean} named */
22
+ function row(cells, heads, named) {
23
+ const tr = document.createElement('tr')
24
+ cells.forEach((cell, i) => {
25
+ const one = tr.appendChild(document.createElement(i || !named ? 'td' : 'th'))
26
+ if (!i && named) one.setAttribute('scope', 'row')
27
+ one.className = /align-\S+/.exec(heads[i]?.className ?? '')?.[0] ?? ''
28
+ one.append(Object.assign(document.createElement('bdi'), { textContent: String(cell ?? '') }))
29
+ })
30
+ return tr
31
+ }
32
+
33
+ /** A table's rows, sorted as its head says: an amount by its value, any other cell as the language sorts words. @param {Element} node @param {Part} part @param {number} at */
34
+ function rows(node, part, at) {
35
+ const made = table(part), heads = [...node.querySelectorAll('thead th')], sort = sorted.get(at), named = node.querySelector('tbody th') !== null
36
+ const amount = sort && /align-/.test(heads[sort.column]?.className ?? ''), by = (/** @type {string} */ a, /** @type {string} */ b) => (amount ? ((x, y) => (Number.isNaN(x) ? 1 : Number.isNaN(y) ? -1 : x - y))(number(a, lang), number(b, lang)) : collator.compare(a, b))
37
+ heads.forEach((head, i) => { const words = head.querySelector('button') ?? head; words.textContent = made.heads[i] ?? ''; sort?.column === i ? head.setAttribute('aria-sort', sort.down ? 'descending' : 'ascending') : head.removeAttribute('aria-sort') })
38
+ node.querySelector('tbody')?.replaceChildren(...(sort ? [...made.rows].sort((a, b) => by(a[sort.column], b[sort.column]) * (sort.down ? -1 : 1)) : made.rows).map((cells) => row(cells, heads, named)))
39
+ }
40
+
41
+ /** A chart drawn again by ECharts, the same one at each change, in the page's type and its language's numbers, still where Jean's Motion was; its numbers as a table under it. @param {HTMLElement & { chart?: any }} node @param {Part} part */
42
+ async function drawChart(node, part) {
43
+ const box = /** @type {HTMLElement | null} */ (node.querySelector('.chart')), made = /** @type {any} */ (option(chart(part, lang)))
44
+ const values = [made.series].flat(), axis = [made.xAxis, made.yAxis].flat().find((one) => Array.isArray(one?.data))?.data, body = node.querySelector('.chart-data tbody')
45
+ body?.replaceChildren(...Array.from({ length: Math.max(0, ...values.map((one) => one.data.length)) }, (_, i) => row([axis?.[i] ?? values[0].data[i]?.name ?? i + 1, ...values.map((/** @type {any} */ one) => one.data[i]?.value ?? one.data[i])], [], true)))
46
+ if (!box) return
47
+ const { init } = await (echarts ??= import('echarts'))
48
+ if (!node.chart) (box.replaceChildren(), (node.chart = init(box, dark ? 'dark' : null, { renderer: 'svg' })), new ResizeObserver(() => node.chart.resize()).observe(box))
49
+ node.chart.setOption({ ...localize(made, new Intl.NumberFormat(locales).format), textStyle: { fontFamily: getComputedStyle(box).fontFamily }, backgroundColor: 'transparent', animation: !still })
50
+ }
51
+
52
+ /** Each part that shows what the page shares, as it now stands. */
53
+ function draw() {
54
+ const state = shared(parts, { given, added, lang, locales })
55
+ list.forEach((part, at) => {
56
+ const nodes = [...root.querySelectorAll(`[data-part="${at}"]`)], [node] = nodes, shown = state.filled(part)
57
+ if (!node) return
58
+ if (part.tag === 'app-figures') figures(shown).forEach(([value, words], i) => { const [strong, span] = node.children[i]?.children ?? []; if (strong && span) (strong.textContent = value, span.textContent = words) })
59
+ else if (part.tag === 'app-card') { const head = node.querySelector(':scope > h4'); if (head) head.textContent = shown.attrs.heading ?? '' }
60
+ else if (part.tag === '#text') shown.text.trim().split(/\n\s*\n/).forEach((said, i) => { if (nodes[i]) nodes[i].textContent = said.replace(/\s*\n\s*/g, ' ') })
61
+ else if (part.tag === 'app-table') rows(node, shown, at)
62
+ else if (part.tag === 'app-chart' && state.live) void drawChart(/** @type {HTMLElement} */ (node), shown)
63
+ })
64
+ }
65
+
66
+ /** The form a field is in, and its part. @param {EventTarget | null} target */
67
+ const formOf = (target) => ((form) => ({ form, part: form ? list[Number(form.getAttribute('data-part'))] : undefined }))(/** @type {HTMLFormElement | null | undefined} */ (/** @type {Element} */ (target).closest?.('form[data-part]')))
68
+ /** Whether a form adds a row to a table of the page. @param {Part | undefined} part */
69
+ const adds = (part) => Boolean(part?.attrs.to) && tables.some((one) => one.attrs.id === part?.attrs.to)
70
+
71
+ root.addEventListener('input', ({ target }) => {
72
+ const field = /** @type {HTMLInputElement} */ (target), { form, part } = formOf(target)
73
+ if (!form || adds(part) || !field.name) return
74
+ // A slider and its number are one field.
75
+ for (const twin of form.querySelectorAll(`[name="${CSS.escape(field.name)}"]`)) if (twin !== field) /** @type {HTMLInputElement} */ (twin).value = field.value
76
+ given.set(field.name, field.type === 'checkbox' ? field.checked : field.value)
77
+ draw()
78
+ })
79
+ root.addEventListener('submit', (event) => {
80
+ event.preventDefault()
81
+ const { form, part } = formOf(event.target), to = part?.attrs.to ?? ''
82
+ if (!form || !adds(part)) return
83
+ const values = [.../** @type {NodeListOf<HTMLInputElement>} */ (form.querySelectorAll('input:not([type=range]), select, textarea'))].map((input) => (input.type === 'checkbox' ? (input.checked ? '✓' : '') : input.value.trim()))
84
+ added.set(to, [...(added.get(to) ?? []), values])
85
+ form.reset()
86
+ draw()
87
+ })
88
+ root.addEventListener('click', ({ target }) => {
89
+ const button = /** @type {Element} */ (target).closest?.('th .sorts'), node = button?.closest('[data-part]'), head = button?.closest('th')
90
+ if (!button || !node || !head) return
91
+ const at = Number(node.getAttribute('data-part')), column = [...(head.parentElement?.children ?? [])].indexOf(head), sort = sorted.get(at)
92
+ sorted.set(at, { column, down: sort?.column === column && !sort.down })
93
+ draw()
94
+ })
95
+ // Its charts, drawn by ECharts at once where the page holds it: their tips, and their size following the page's.
96
+ if (shared(parts, { given, added, lang, locales }).live) draw()
@@ -0,0 +1,191 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // A page of parts on its own (D670): how one leaves Jean, downloaded, sent to another app or published as a site, drawn as Jean draws it
3
+ // and live wherever it lands. Jean draws it out of sight from its source, what it shows of the project's collections written in (./parts.js's
4
+ // frozen()), and writes down what it drew: its parts, its fields as they start, each chart an SVG of itself, each picture inside it, and the
5
+ // rules of the room's style sheets that style them, as they are written, with the colours, type and face they read now. Where scripts run,
6
+ // ./alive.js keeps it live: on a page of its own, its modules ride inside it, inert, each made a module and named in an import map before it
7
+ // starts, as a game's engine does (../games/page.js); on a site, whose host runs its own files alone, they are files beside it. Jean's own
8
+ // buttons stay behind, and a form's that would ask the brain, as nothing is sent from such a page.
9
+ import { unlock } from '../../ui/caps.js'
10
+ import { theme } from '../../ui/state.js'
11
+ import { pagePolicy } from '../../ui/csp.js'
12
+ import { still } from '../../ui/sheet.js'
13
+ import { BRAND } from '../../brand.js'
14
+ import { locale, dir, intlLocales } from '../../core/i18n.js'
15
+ import { library } from './interactive.js'
16
+ import { parse, all } from './parts.js'
17
+ import { shared } from './live.js'
18
+
19
+ /** What keeps it live, by the name each goes by in the page, and where each is beside this module. */
20
+ const MODULES = /** @type {Record<string, string>} */ ({ alive: './alive.js', parts: './parts.js', live: './live.js', formula: '../tables/formula.js', option: '../charts/option.js' })
21
+ /** Each read once. @type {Map<string, Promise<string>>} */
22
+ const read = new Map()
23
+ /** @param {string} path */
24
+ const text = (path) => read.get(path) ?? /** @type {Promise<string>} */ (read.set(path, fetch(new URL(path, import.meta.url)).then((response) => response.text())).get(path))
25
+ /**
26
+ * A module, the others it imports named as the page finds them: by name, which its import map gives, or as a file beside it (`site`).
27
+ * @param {string} code @param {boolean} [site]
28
+ */
29
+ const named = (code, site = false) => code.replace(/(\b(?:from|import)\s*\(?\s*)(['"])(?:\.{1,2}\/(?:[\w-]+\/)*)?([\w-]+)(?:\.m?js)?\2/g,
30
+ (whole, lead, quote, name) => (Object.hasOwn(MODULES, name) || name === 'echarts' ? `${lead}${quote}${site ? `./${name}.js` : name}${quote}` : whole))
31
+
32
+ /** States a rule may style that the page isn't in as it is drawn, and its pseudo-elements, which no element matches: left out to find whether a rule styles it. */
33
+ const STATES = /::?(?:hover|focus(?:-visible|-within)?|active|visited|link|target|checked|indeterminate|disabled|enabled|placeholder-shown|popover-open|open|(?:user-)?(?:in)?valid|autofill|before|after|marker|placeholder|selection|backdrop|first-line|first-letter|file-selector-button|-(?:webkit|moz)-[\w-]+)(?![\w-])/g
34
+ /** Whether a selector styles the holder or what it holds. @param {Element} holder @param {string} selector */
35
+ const styles = (holder, selector) => [selector, selector.replace(STATES, '')].some((one) => { try { return holder.matches(one) || holder.querySelector(one) !== null } catch { return false } })
36
+
37
+ /**
38
+ * A style sheet's text as its rules, or a block's: each one's prelude and the block it opens, or null for a statement (`@import …;`), its
39
+ * comments and strings passed over. Read from the text, as Chromium's own text of a rule loses a shorthand that reads a variable once a
40
+ * longhand of it follows. @param {string} css @returns {{ prelude: string, block: string | null }[]}
41
+ */
42
+ function rulesIn(css) {
43
+ const found = /** @type {{ prelude: string, block: string | null }[]} */ ([])
44
+ for (let i = 0, start = 0, depth = 0, open = 0; i < css.length; i++) {
45
+ const c = css[i]
46
+ if (c === '/' && css[i + 1] === '*') i = css.indexOf('*/', i + 2) < 0 ? css.length : css.indexOf('*/', i + 2) + 1
47
+ else if (c === '"' || c === "'") for (i++; i < css.length && css[i] !== c; i += css[i] === '\\' ? 2 : 1);
48
+ else if (c === '{' && !depth++) open = i
49
+ else if (c === '}' && depth && !--depth) (found.push({ prelude: css.slice(start, open), block: css.slice(open + 1, i) }), (start = i + 1))
50
+ else if (c === ';' && !depth) (found.push({ prelude: css.slice(start, i), block: null }), (start = i + 1))
51
+ }
52
+ return found.map(({ prelude, block }) => ({ prelude: prelude.replace(/\/\*[\s\S]*?\*\//g, '').trim(), block }))
53
+ }
54
+
55
+ /**
56
+ * Of a style sheet's text, the rules that style what a holder holds, as they are written, inside their @media, @container and the rest,
57
+ * their addresses made whole from the sheet's; each face it declares put in `faces`. @param {Element} holder @param {string} css @param {string} base
58
+ * @param {string[]} faces @returns {string}
59
+ */
60
+ const rulesOf = (holder, css, base, faces) => rulesIn(css).map(({ prelude, block }) => {
61
+ const name = /^@([\w-]+)/.exec(prelude)?.[1], whole = (/** @type {string} */ rule) => rule.replace(/url\((["']?)([^"')]+)\1\)/g, (_, __, url) => `url(${new URL(url, base).href})`)
62
+ if (block === null || (name && !/^(media|supports|container|layer|scope|font-face)$/.test(name))) return ''
63
+ if (name === 'font-face') return void faces.push(whole(`${prelude}{${block}}`)), ''
64
+ if (name) return ((inner) => inner && `${prelude}{${inner}}`)(rulesOf(holder, block, base, faces))
65
+ return styles(holder, prelude) ? whole(`${prelude}{${block}}`) : ''
66
+ }).filter(Boolean).join('\n')
67
+
68
+ /** A file of Jean's as a `data:` address. @param {string} url @returns {Promise<string>} */
69
+ const dataOf = (url) => fetch(url).then((response) => response.blob()).then((blob) => new Promise((resolve, reject) => { const reader = Object.assign(new FileReader(), { onload: () => resolve(String(reader.result)), onerror: reject }); reader.readAsDataURL(blob) }))
70
+ /** Each file of Jean's a text names, inside it. @param {string} css */
71
+ async function inside(css) {
72
+ let done = css
73
+ for (const url of new Set([...css.matchAll(/url\((https?:[^)]+)\)/g)].map(([, url]) => url))) done = done.replaceAll(`url(${url})`, `url(${await dataOf(url).catch(() => '')})`)
74
+ return done
75
+ }
76
+
77
+ /**
78
+ * What the holder's page needs to look as it does here: the rules of the room's style sheets that style it, as written, the room's variables
79
+ * they read as they are now, its type, colour and paper, and the pictures they name, inside it; its faces too with `faced`, as a site's
80
+ * host serves no face from elsewhere. @param {HTMLElement} holder @param {boolean} faced
81
+ */
82
+ async function sheetOf(holder, faced) {
83
+ const faces = /** @type {string[]} */ ([]), sheets = [...document.styleSheets, ...document.adoptedStyleSheets].filter((sheet) => !sheet.disabled)
84
+ const texts = await Promise.all(sheets.map(async (sheet) => ({ base: sheet.href ?? location.href, media: sheet.media.mediaText,
85
+ css: sheet.href ? await fetch(sheet.href).then((response) => response.text()).catch(() => '') : sheet.ownerNode?.textContent ?? [...sheet.cssRules].map((rule) => rule.cssText).join('\n') })))
86
+ const own = texts.map(({ css, base, media }) => ((kept) => (kept && media && media !== 'all' ? `@media ${media}{${kept}}` : kept))(rulesOf(holder, css, base, faces))).filter(Boolean).join('\n')
87
+ const style = getComputedStyle(holder), names = new Set([...own.matchAll(/var\(\s*(--[\w-]+)/g)].map(([, name]) => name))
88
+ const variables = [...names].map((name) => `${name}: ${style.getPropertyValue(name).trim()};`).join(' ')
89
+ const paper = [document.body, document.documentElement].map((one) => getComputedStyle(one).backgroundColor).find((color) => !/^(transparent|rgba\(0, 0, 0, 0\))$/.test(color)) ?? 'Canvas'
90
+ const used = faced ? faces.filter((face) => ((family) => Boolean(family) && (own + variables).includes(String(family)))(/font-family:\s*["']?([^"';]+)/.exec(face)?.[1])) : []
91
+ return inside(`${used.join('\n')}\n:root { color-scheme: ${theme.peek()}; ${variables} }
92
+ body { margin: 0; padding: 1.25rem; background: ${paper}; color: ${style.color}; font: ${style.fontSize} / ${style.lineHeight} ${style.fontFamily}; }
93
+ main { max-inline-size: 64rem; margin-inline: auto; } app-chart .chart > svg { display: block; inline-size: 100%; block-size: 100%; }
94
+ ${own}`)
95
+ }
96
+
97
+ /**
98
+ * The page drawn out of sight as Jean draws it, and written down: its fields as they start, each chart an SVG of itself, each picture inside it,
99
+ * without Jean's buttons, nor a form's that would ask the brain; with what it needs to look so, and whether it holds anything that works.
100
+ * @param {string} source with what it shows of the project's collections written in @param {boolean} faced
101
+ */
102
+ async function drawn(source, faced) {
103
+ const list = all(parse(source) ?? []), lang = locale.peek()
104
+ if (list.some((part) => part.tag === 'app-chart')) await unlock('charts')
105
+ await import('./view-parts.js')
106
+ const holder = Object.assign(document.createElement('div'), { className: 'prose', inert: true }), page = document.createElement('app-parts')
107
+ holder.style.cssText = 'position: fixed; inset-block-start: 0; inset-inline-start: -300vw; inline-size: min(64rem, 100vw)'
108
+ page.setAttribute('source', source)
109
+ holder.append(page)
110
+ document.body.append(holder)
111
+ try {
112
+ const charts = /** @type {(HTMLElement & { chart?: unknown, svg: () => string })[]} */ ([...page.querySelectorAll('app-chart')])
113
+ for (let wait = 0; wait < 60 && charts.some((one) => !one.chart); wait++) await new Promise((resolve) => setTimeout(resolve, 50))
114
+ const copy = /** @type {HTMLElement} */ (document.createElement('app-parts'))
115
+ copy.append(...[...page.children].map((child) => child.cloneNode(true)))
116
+ // Its fields as they start, which the page set as properties, written as attributes.
117
+ const [was, now] = [page, copy].map((one) => [...one.querySelectorAll('input, select, textarea')])
118
+ was.forEach((field, i) => {
119
+ const twin = now[i]
120
+ if (field instanceof HTMLInputElement) (field.type === 'checkbox' ? twin.toggleAttribute('checked', field.checked) : twin.setAttribute('value', field.value))
121
+ else if (field instanceof HTMLTextAreaElement) twin.textContent = field.value
122
+ else if (field instanceof HTMLSelectElement) [.../** @type {HTMLSelectElement} */ (twin).options].forEach((option, n) => option.toggleAttribute('selected', n === field.selectedIndex))
123
+ })
124
+ copy.querySelectorAll('.drawn-foot').forEach((foot) => foot.remove())
125
+ for (const form of copy.querySelectorAll('form[data-part]')) {
126
+ const to = list[Number(form.getAttribute('data-part'))]?.attrs.to
127
+ if (!list.some((part) => part.tag === 'app-table' && to && part.attrs.id === to)) form.querySelector('button[type="submit"]')?.remove()
128
+ }
129
+ // Each chart's SVG, ECharts' own markup, goes in its box's place once the page is written down.
130
+ const boxes = [...copy.querySelectorAll('app-chart')], pictures = charts.map((chart) => (chart.chart ? chart.svg() : ''))
131
+ pictures.forEach((picture, i) => { if (picture) boxes[i]?.querySelector('.chart')?.replaceChildren(Object.assign(document.createElement('app-svg'), { id: `svg-${i}` })) })
132
+ // What else drew on a canvas, a picture of it; a picture the page holds by a blob, inside it.
133
+ const [canvases, twins] = [page, copy].map((one) => [...one.querySelectorAll('canvas:not(app-chart *)')]), drew = /** @type {HTMLCanvasElement[]} */ (canvases)
134
+ drew.forEach((canvas, i) => { try { twins[i]?.replaceWith(Object.assign(document.createElement('img'), { src: canvas.toDataURL(), alt: '' })) } catch {} })
135
+ for (const image of copy.querySelectorAll('img[src^="blob:"]')) image.setAttribute('src', await dataOf(image.getAttribute('src') ?? '').catch(() => ''))
136
+ const walker = document.createTreeWalker(copy, NodeFilter.SHOW_COMMENT), notes = /** @type {ChildNode[]} */ ([])
137
+ while (walker.nextNode()) notes.push(/** @type {ChildNode} */ (walker.currentNode))
138
+ notes.forEach((note) => note.remove())
139
+ const state = shared(parse(source) ?? [], { given: new Map(), added: new Map(), lang, locales: intlLocales(lang) })
140
+ const html = new XMLSerializer().serializeToString(copy).replace(/ xmlns="http:\/\/www\.w3\.org\/1999\/xhtml"/, '')
141
+ .replace(/<app-svg id="svg-(\d+)"><\/app-svg>/g, (_, i) => ((svg) => (/<svg[^>]*\sviewBox=/.test(svg) ? svg : svg.replace(/<svg([^>]*)\swidth="([\d.]+)"\s+height="([\d.]+)"/, '<svg$1 width="$2" height="$3" viewBox="0 0 $2 $3"')))(pictures[Number(i)]))
142
+ return { html, css: await sheetOf(holder, faced),
143
+ works: state.live || list.some((part) => /^app-(table|form)$/.test(part.tag)), charted: state.live && charts.some((one) => one.chart) }
144
+ } finally {
145
+ holder.remove()
146
+ }
147
+ }
148
+
149
+ /** Text as HTML. @param {string} words */
150
+ const escaped = (words) => words.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/"/g, '&quot;')
151
+ /** A module or data inert in a script block, whatever it holds: "</script" and "<!--" written as JavaScript reads them the same. @param {string} code */
152
+ const inert = (code) => code.replace(/<(\/script|!--)/gi, '\\x3C$1')
153
+ /** What the page's script reads: its source, its language's ways with numbers, whether it is dark and whether it moves, as Motion says here. @param {string} source */
154
+ const given = (source) => `<script type="application/json" id="parts">${JSON.stringify({ source, locales: intlLocales(locale.peek()), dark: theme.peek() === 'dark', still: still() }).replace(/</g, '\\u003c')}</script>`
155
+
156
+ /**
157
+ * The page around what was drawn: the user's language and direction, the room's light or dark and look, its title and styles.
158
+ * @param {string} title @param {{ html: string, css: string }} drawing @param {string} head more of its head @param {string} end what follows it
159
+ */
160
+ const pageAround = (title, { html, css }, head, end) => ((lang) => /* html */ `<!doctype html>
161
+ <html lang="${lang}" dir="${dir(lang)}" data-theme="${theme.peek()}" data-look="${escaped(document.documentElement.dataset.look ?? '')}">
162
+ <meta charset="utf-8">
163
+ <meta name="viewport" content="width=device-width, initial-scale=1">
164
+ <meta name="generator" content="${escaped(BRAND.name)}">${head}
165
+ <title>${escaped(title)}</title>
166
+ <style>${css.replace(/<\/(style)/gi, '<\\/$1')}</style>
167
+ <main class="prose">${html}</main>
168
+ ${end}`)(locale.peek())
169
+
170
+ /**
171
+ * A page of parts as a page of its own, for Download and another app: drawn, its styles and faces inside it, and where scripts run, live,
172
+ * its modules inert in it until a few lines make each one a module and name it in an import map. @param {string} source frozen @param {string} title
173
+ */
174
+ export async function pageOf(source, title) {
175
+ const drawing = await drawn(source, true), names = [...Object.keys(MODULES), ...(drawing.charted ? ['echarts'] : [])]
176
+ const modules = drawing.works ? await Promise.all(names.map(async (name) => `<script type="text/x-module" data-name="${name}">${inert(name === 'echarts' ? (await library()).text : named(await text(MODULES[name])))}</script>`)) : []
177
+ const boot = `(()=>{const imports={};for(const s of document.querySelectorAll('script[type="text/x-module"]'))imports[s.dataset.name]=URL.createObjectURL(new Blob([s.textContent],{type:'text/javascript'}))
178
+ document.head.append(Object.assign(document.createElement('script'),{type:'importmap',textContent:JSON.stringify({imports})}));import('alive')})()`
179
+ const policy = pagePolicy({ scripts: drawing.works, web: false, network: false, downloads: false, fullscreen: false, maps: false }, [], true)
180
+ return pageAround(title, drawing, `\n<meta http-equiv="Content-Security-Policy" content="${policy}">`, drawing.works ? `${given(source)}\n${modules.join('\n')}\n<script>${boot}</script>\n` : '')
181
+ }
182
+
183
+ /**
184
+ * A page of parts as the files of a site (D720), whose host runs its own files alone: the page drawn, and where it holds anything that works,
185
+ * its modules beside it, importing each other by path. @param {string} source frozen @param {string} title @returns {Promise<Map<string, string>>}
186
+ */
187
+ export async function siteOf(source, title) {
188
+ const drawing = await drawn(source, false), files = new Map()
189
+ if (drawing.works) for (const name of [...Object.keys(MODULES), ...(drawing.charted ? ['echarts'] : [])]) files.set(`${name}.js`, name === 'echarts' ? (await library()).text : named(await text(MODULES[name]), true))
190
+ return files.set('index.html', pageAround(title, drawing, '', drawing.works ? `${given(source)}\n<script type="module" src="alive.js"></script>\n` : ''))
191
+ }
@@ -14,14 +14,24 @@ import { t } from '../../core/i18n.js'
14
14
  import { ask, page } from '../../ui/creations.js'
15
15
  import { held } from '../../ui/held.js'
16
16
  import { capability, named, page as drawn } from './interactive.js'
17
- import { frozen } from './parts.js'
17
+ import { frozen, parse } from './parts.js'
18
18
 
19
19
  /** Four tiles, the last turned on its corner: what is made to be used. */
20
20
  const GLYPH = icon(svg`<rect x="4" y="4" width="6.5" height="6.5" rx="1.5"/><rect x="4" y="13.5" width="6.5" height="6.5" rx="1.5"/><rect x="13.5" y="13.5" width="6.5" height="6.5" rx="1.5"/><g transform="rotate(45 16.75 7.25)"><rect x="14" y="4.5" width="5.5" height="5.5" rx="1.5"/></g>`, 'flip-rtl')
21
21
 
22
22
  const { kept, find, metaOf, pin, rename, hide } = held({ fence: 'html', record: 'app', at: 'app-', latest: true, named, extension: 'html', mimeType: 'text/html' })
23
- /** An app's page as the pane's Download gives it, what it shows of the project's collections written in (D633). @param {string} uri */
24
- const bytesOf = async (uri) => ((source) => import('./view-parts.js').then(async (parts) => new TextEncoder().encode(frozen(source, await parts.snapshot(source)))))((await find(uri))?.source ?? '')
23
+ /**
24
+ * An app as it leaves Jean, by its page on its own (`as`) or as a site's files: a page of parts drawn and live without Jean (./alone.js), what it
25
+ * shows of the project's collections written in (D633); any other, its page. @param {string} uri @param {'pageOf' | 'siteOf'} as
26
+ */
27
+ const out = async (uri, as) => {
28
+ const one = await find(uri), source = one?.source ?? ''
29
+ if (!parse(source)) return source
30
+ const [parts, alone] = await Promise.all([import('./view-parts.js'), import('./alone.js')])
31
+ return alone[as](frozen(source, await parts.snapshot(source)), one?.name ?? '')
32
+ }
33
+ /** An app's page as the pane's Download and the system's sheet give it. @param {string} uri */
34
+ const bytesOf = async (uri) => new TextEncoder().encode(/** @type {string} */ (await out(uri, 'pageOf')))
25
35
  export { metaOf, bytesOf }
26
36
 
27
37
  /** Its view in its pane: the page itself, which works beside the task as in its answer. @param {{ uri: string }} file */
@@ -39,9 +49,9 @@ export const apps = { id: 'apps', at: 6, draw: () => GLYPH, kept,
39
49
  * What an app can do (ui/out.js): a link holds its page as an answer's does, the system's sheet and Download its page on its own, and paper what it shows now.
40
50
  * @param {{ uri: string, name: string, title: string }} file @param {Element} pane @returns {import('../../ui/out.js').Ways}
41
51
  */
42
- const ways = (file, pane) => ({ share: async () => ({ text: `\`\`\`html\n${(await find(file.uri))?.source ?? ''}\n\`\`\`` }), page: () => bytesOf(file.uri),
52
+ const ways = (file, pane) => ({ share: async () => ({ text: `\`\`\`html\n${(await find(file.uri))?.source ?? ''}\n\`\`\`` }), page: () => out(file.uri, 'siteOf'),
43
53
  send: { file: file.name, type: 'text/html', make: async () => ({ title: file.title, files: [new File([await bytesOf(file.uri)], file.name, { type: 'text/html' })] }) },
44
- files: [{ id: '', glyph: icons.download, label: t('out.webPage'), run: async () => (await import('../../ui/preview.js')).download(file) }],
54
+ files: [{ id: '', glyph: icons.globe, label: t('out.webPage'), run: async () => (await import('../../ui/preview.js')).download(file) }],
45
55
  print: { id: 'print', run: async () => (await import('../made/paper.js')).printPage(/** @type {HTMLElement} */ (pane.querySelector('.view .prose'))) } })
46
56
 
47
57
  /** Its slots, Creations' page among them, once the project holds an app; until then only its card to start one, on the page another kind opens (D553). */
@@ -2,7 +2,8 @@
2
2
  // What a page of parts shares (D670), so that what the user changes reaches all it touches at once, with nothing sent to a brain:
3
3
  // its form's fields, by their labels; the values worked out from them (<app-values>, a line each, `Name = formula`), in Tables' formulas,
4
4
  // which Jean reads itself, never with eval; `{formula}` in figures, a table's lines, a chart's, a card's heading and words, `{formula:2}`
5
- // with that many decimals, said in the language; a table's `each="Year = 1..Years"`, which repeats the lines that hold one; `{sum Column}`
5
+ // with that many decimals, said in the language, an amount beside its currency's symbol (`€{formula}`, `{formula} $`) as the language writes one;
6
+ // a table's `each="Year = 1..Years"`, which repeats the lines that hold one; `{sum Column}`
6
7
  // and `{count}`, what a table of the page adds up to as it stands, the rows its forms added too; a chart's `from="its id"`, drawn from it by
7
8
  // `by` and `sum`; a choice named as a table's column, which keeps the rows that hold it, one no row holds (All) keeping them all.
8
9
  // What can't be worked out is a dash. A page with none of these stays as it was written. Pure, so Node's tests run it.
@@ -12,15 +13,18 @@ import { all, form, lines, number, split, table } from './parts.js'
12
13
  /** @import { Part } from './parts.js' */
13
14
  /** What a form's fields, what they work out and a table's sums hold, by their names. @typedef {Record<string, unknown>} Cells */
14
15
 
15
- const FORMULA = /\{([^{}]+)\}/g, HOLDS = /\{[^{}]+\}/, LIST = /\s*[,،、]\s*/
16
+ const FORMULA = /(?<![\p{L}\p{N}])(\p{Sc})\s?\{([^{}]+)\}|\{([^{}]+)\}(?:\s?(\p{Sc})(?![\p{L}\p{N}]))?/gu, HOLDS = /\{[^{}]+\}/, LIST = /\s*[,،、]\s*/
16
17
  /** The parts whose lines may hold a formula: a diagram's braces are its own. */
17
18
  const SPELLED = ['app-figures', 'app-table', 'app-chart', '#text']
18
19
  /** The rows an `each` makes at most. */
19
20
  const MOST = 600
20
21
  /** A number as a chart's lines, and the brain, read one: a few decimals, whatever the language; none for what is no number. @param {number} value @param {string} [digits] */
21
22
  const plain = (value, digits) => (Number.isFinite(value) ? String(Number(value.toFixed(digits ? Number(digits) : Math.abs(value) < 1 ? 4 : 2))) : '')
22
- /** A line with what `say` makes of each formula's words and the decimals it asks for. @param {string} line @param {(text: string, digits?: string) => string} say */
23
- const spelled = (line, say) => line.replace(FORMULA, (_, inner) => ((found) => say(found[1], found[2]))(/** @type {RegExpExecArray} */ (/^(.*?)(?::\s*(\d))?\s*$/s.exec(inner))))
23
+ /**
24
+ * A line with what `say` makes of each formula's words, the decimals it asks for and the currency's symbol beside it, given what was written.
25
+ * @param {string} line @param {(text: string, digits: string | undefined, symbol: string | undefined, whole: string) => string} say
26
+ */
27
+ const spelled = (line, say) => line.replace(FORMULA, (whole, before, inner, alone, after) => ((found) => say(found[1], found[2], before ?? after, whole))(/** @type {RegExpExecArray} */ (/^(.*?)(?::\s*(\d))?\s*$/s.exec(inner ?? alone))))
24
28
  /** @param {string} raw */
25
29
  const read = (raw) => (raw.trim() !== '' && Number.isFinite(Number(raw)) ? Number(raw) : raw)
26
30
 
@@ -42,11 +46,15 @@ export function shared(parts, { given, added, lang, locales }) {
42
46
  const reader = (/** @type {string} */ text) => { try { return compile(text.replace(/[{}]/g, ''), columns) } catch { return () => NaN } }
43
47
  /** What a formula comes to; NaN where it can't be read or worked out. @param {string} text @param {Cells} cells */
44
48
  const value = (text, cells) => /** @type {(cells: Cells) => any} */ (readers.get(text) ?? readers.set(text, reader(text)).get(text))(cells)
45
- /** A result in the page's words. @param {unknown} got @param {string} [digits] @param {boolean} [bare] with no marks between thousands */
46
- const said = (got, digits, bare) => (typeof got === 'boolean' ? (got ? '✓' : '') : typeof got !== 'number' ? String(got) : !Number.isFinite(got) ? '—' : /** @type {Intl.NumberFormat} */ (formats.get(`${digits}${bare}`)
47
- ?? formats.set(`${digits}${bare}`, new Intl.NumberFormat(locales, { maximumFractionDigits: digits ? Number(digits) : 2, minimumFractionDigits: digits ? Number(digits) : 0, useGrouping: !bare, signDisplay: 'negative' })).get(`${digits}${bare}`)).format(got))
48
- /** A line with each formula worked out, an `each`'s own name as it is written. @param {string} line @param {Cells} cells @param {string} [name] */
49
- const spell = (line, cells, name) => (live ? spelled(line, (text, digits) => said(value(text, cells), digits, text.trim() === name)) : line)
49
+ /** The language's numbers with these decimals: with no marks between thousands, or as an amount, which a symbol takes the place of the currency in. @param {string} [digits] @param {'' | 'bare' | 'money'} [as] */
50
+ const writer = (digits, as = '') => /** @type {Intl.NumberFormat} */ (formats.get(`${digits}${as}`) ?? formats.set(`${digits}${as}`, new Intl.NumberFormat(locales, { maximumFractionDigits: digits ? Number(digits) : 2,
51
+ minimumFractionDigits: digits ? Number(digits) : 0, useGrouping: as !== 'bare', signDisplay: 'negative', ...(as === 'money' && { style: 'currency', currency: 'EUR', currencyDisplay: 'narrowSymbol' }) })).get(`${digits}${as}`))
52
+ /** A result in the page's words; a number beside a currency's symbol, the amount as the language writes one, sign and symbol in their places. @param {unknown} got @param {string} [digits] @param {boolean} [bare] with no marks between thousands @param {string} [symbol] */
53
+ const said = (got, digits, bare, symbol) => (typeof got === 'boolean' ? (got ? '✓' : '') : typeof got !== 'number' ? String(got) : !Number.isFinite(got) ? '—'
54
+ : symbol ? writer(digits, 'money').formatToParts(got).map((part) => (part.type === 'currency' ? symbol : part.value)).join('') : writer(digits, bare ? 'bare' : '').format(got))
55
+ /** A line with each formula worked out, an `each`'s own name as it is written; what is no amount beside its symbol as it was written. @param {string} line @param {Cells} cells @param {string} [name] */
56
+ const spell = (line, cells, name) => (live ? spelled(line, (text, digits, symbol, whole) => ((got) => (symbol && typeof got === 'number' && Number.isFinite(got) ? said(got, digits, false, symbol)
57
+ : whole.replace(HOLDS, () => said(got, digits, text.trim() === name))))(value(text, cells))) : line)
50
58
  const base = /** @type {Cells} */ (Object.fromEntries(fields.map(({ label, kind, start, choices }) => ((raw) => [label, typeof raw === 'boolean' ? raw : /^(yes|no)$/.test(kind) ? (raw ? /^(yes|on|true|✓)$/i.test(raw) : kind === 'yes')
51
59
  : /^(number|range)$/.test(kind) ? (raw === '' ? NaN : number(raw, lang, true)) : read(raw)])(given.get(label) ?? (start || choices?.[0] || '')))))
52
60
  /** The fields, the tables' sums, and each value worked out, as often as there are values, so that one written before what it reads sees it. @param {Cells} [extra] */
@@ -91,6 +91,14 @@ export const table = (part) => (([heads = [], ...rows]) => ({ heads, rows: rows.
91
91
  /** A chart: its kind, its labels, then each series by its name, its values by commas, in the language's digits or not. @param {Part} part @param {string} [lang] */
92
92
  export const chart = (part, lang) => (([labels = '', ...series]) => ({ kind: part.attrs.kind || 'bar', labels: cells(labels),
93
93
  series: series.map((line) => split(line, ':')).map(([name, values]) => ({ name, data: values.split(/[,;،、]/).map((value) => number(value, lang, true)) })) }))(lines(part))
94
+ /** A chart's option for ECharts: bars, lines, areas, bars across or a pie, by its labels and series. @param {ReturnType<typeof chart>} drawing */
95
+ export function option({ kind, labels, series }) {
96
+ const values = (/** @type {number[]} */ data) => data.map((value) => (Number.isFinite(value) ? value : null))
97
+ if (kind === 'pie') return { tooltip: { trigger: 'item' }, legend: { bottom: 0 }, series: [{ type: 'pie', radius: ['38%', '62%'], data: labels.map((name, i) => ({ name, value: values(series[0]?.data ?? [])[i] ?? 0 })) }] }
98
+ const [across, along] = kind === 'hbar' ? ['yAxis', 'xAxis'] : ['xAxis', 'yAxis']
99
+ return { tooltip: { trigger: 'axis' }, ...(series.length > 1 && { legend: {} }), [across]: { type: 'category', data: labels }, [along]: { type: 'value' },
100
+ series: series.map(({ name, data }) => ({ name, data: values(data), type: /^(line|area)$/.test(kind) ? 'line' : 'bar', ...(kind === 'area' && { areaStyle: {} }) })) }
101
+ }
94
102
 
95
103
  const KINDS = ['number', 'date', 'month', 'time', 'long', 'yes', 'no', 'email', 'tel', 'url']
96
104
  const RANGE = /^(-?[\d.]+?)\s*\.\.\s*(-?[\d.]+?)(?:\s*\.\.\s*([\d.]+))?$/
@@ -3,7 +3,7 @@
3
3
  // cards side by side, a table whose heads sort it, a chart drawn by Charts (D196), unlocked on sight, a form that adds a row to a
4
4
  // table of the page for this visit or sends its fields as the user's next message, a map or a diagram as the answers' own, and
5
5
  // an aside beside the rest where there is room. Copy gives its source. It grows as the answer writes it.
6
- // A part that names a collection (D633) shows it as it is and follows each change: Jean fills its lines from it (../tables/fill.js),
6
+ // A part that names a collection (D633) shows it as it is and follows each change: Jean fills its lines from it (../fill/fill.js),
7
7
  // so the page never reads it, and a form adds a row to it as the user's own change. Only in a task of the project's own, never one
8
8
  // brought in from someone else's (D361, D378); there, and in a copy saved or shared, it shows what was kept of it then. Its `where`
9
9
  // keeps only some of the rows; one that can't be read says so. What its parts share (D670, ./live.js) is worked out anew at each draw from
@@ -19,7 +19,7 @@ import { t, locale, intlLocales } from '../../core/i18n.js'
19
19
  import { foldTurns } from '../../core/events.js'
20
20
  import { loadConversation } from '../../core/conversations.js'
21
21
  import { aligned } from '../layouts/shapes.js'
22
- import { parse, all, bound, key, frozen, figures, table, chart, form, number, changed } from './parts.js'
22
+ import { parse, all, bound, key, frozen, figures, table, chart, form, number, option, changed } from './parts.js'
23
23
  import { shared } from './live.js'
24
24
 
25
25
  /** @import { Part } from './parts.js' */
@@ -28,15 +28,6 @@ import { shared } from './live.js'
28
28
  /** @import { Property } from '../tables/table.js' */
29
29
  /** A part as it is drawn: one that shows a collection with its lines filled, the collection followed, and a form's columns; or the name of one not here, or of one its `where` can't filter. @typedef {Part & { live?: Signal<Loaded | null>, columns?: Property[], missing?: string, unread?: string }} Shown */
30
30
 
31
- /** A chart's option for ECharts: bars, lines, areas, bars across or a pie, by its labels and series. @param {ReturnType<typeof chart>} drawing */
32
- function option({ kind, labels, series }) {
33
- const values = (/** @type {number[]} */ data) => data.map((value) => (Number.isFinite(value) ? value : null))
34
- if (kind === 'pie') return { tooltip: { trigger: 'item' }, legend: { bottom: 0 }, series: [{ type: 'pie', radius: ['38%', '62%'], data: labels.map((name, i) => ({ name, value: values(series[0]?.data ?? [])[i] ?? 0 })) }] }
35
- const [across, along] = kind === 'hbar' ? ['yAxis', 'xAxis'] : ['xAxis', 'yAxis']
36
- return { tooltip: { trigger: 'axis' }, ...(series.length > 1 && { legend: {} }), [across]: { type: 'category', data: labels }, [along]: { type: 'value' },
37
- series: series.map(({ name, data }) => ({ name, data: values(data), type: /^(line|area)$/.test(kind) ? 'line' : 'bar', ...(kind === 'area' && { areaStyle: {} }) })) }
38
- }
39
-
40
31
  const FENCE = /^ {0,3}(`{3,}|~{3,})html[^\n]*\n([\s\S]*?)\n {0,3}\1/gim
41
32
  /**
42
33
  * What the pages a text holds show of the project's collections now, by each part's key (D633), for a copy that keeps it: a share, a
@@ -92,23 +83,23 @@ customElements.define('app-parts', class extends HTMLElement {
92
83
 
93
84
  draw() {
94
85
  const source = this.getAttribute('source') ?? '', open = this.hasAttribute('open'), parts = parse(source, open) ?? []
95
- const tables = all(parts).filter((part) => part.tag === 'app-table'), asides = parts.filter((part) => part.tag === 'aside')
86
+ const every = all(parts), tables = every.filter((part) => part.tag === 'app-table'), asides = parts.filter((part) => part.tag === 'aside')
96
87
  this.fills = {}
97
88
  const state = shared(parts, { given: this.given, added: this.added, lang: locale.peek(), locales: intlLocales(locale.peek()) })
98
89
  this.told = state.now
99
90
  /** @param {Part} given @returns {unknown} */
100
91
  const piece = (given) => {
101
- const name = bound(given, tables), part = /** @type {Shown} */ (name === undefined ? state.filled(given) : this.bound(given, name))
92
+ const name = bound(given, tables), part = /** @type {Shown} */ (name === undefined ? state.filled(given) : this.bound(given, name)), place = every.indexOf(given)
102
93
  if (part.missing || part.unread) return html`<p class="muted small" dir="auto">${part.unread ? t('interactive.unread', { name: part.unread, where: part.attrs.where ?? '' }) : t('interactive.noCollection', { name: part.missing ?? '' })}</p>`
103
94
  switch (part.tag) {
104
- case 'app-figures': return html`<ul class="figures" aria-live=${state.live ? 'polite' : nothing}>${figures(part).map(([value, words]) => html`<li><strong>${value}</strong><span>${words}</span></li>`)}</ul>`
95
+ case 'app-figures': return html`<ul class="figures" data-part=${place} aria-live=${state.live ? 'polite' : nothing}>${figures(part).map(([value, words]) => html`<li><strong>${value}</strong><span>${words}</span></li>`)}</ul>`
105
96
  case 'app-cards': return html`<div class="part-cards">${part.kids.map(piece)}</div>`
106
- case 'app-card': return html`<section class=${'wide' in part.attrs ? 'part-card wide' : 'part-card'}>${part.attrs.heading ? html`<h4 dir="auto">${part.attrs.heading}</h4>` : nothing}${part.kids.map(piece)}</section>`
97
+ case 'app-card': return html`<section class=${'wide' in part.attrs ? 'part-card wide' : 'part-card'} data-part=${place}>${part.attrs.heading ? html`<h4 dir="auto">${part.attrs.heading}</h4>` : nothing}${part.kids.map(piece)}</section>`
107
98
  case 'aside': return html`<aside>${part.kids.map(piece)}</aside>`
108
- case '#text': return part.text.trim().split(/\n\s*\n/).map((said) => html`<p dir="auto">${said.replace(/\s*\n\s*/g, ' ')}</p>`)
109
- case 'app-table': return this.table(part, tables.indexOf(given))
110
- case 'app-chart': return this.chart(part, state.live)
111
- case 'app-form': return this.form(part, tables, state)
99
+ case '#text': return part.text.trim().split(/\n\s*\n/).map((said) => html`<p dir="auto" data-part=${place}>${said.replace(/\s*\n\s*/g, ' ')}</p>`)
100
+ case 'app-table': return this.table(part, tables.indexOf(given), place)
101
+ case 'app-chart': return this.chart(part, state.live, place)
102
+ case 'app-form': return this.form(part, tables, state, place)
112
103
  case 'app-map': return drawn.value.geojson?.(part.text, open) ?? nothing
113
104
  case 'app-diagram': return drawn.value.mermaid?.(part.text, open) ?? nothing
114
105
  }
@@ -155,27 +146,28 @@ customElements.define('app-parts', class extends HTMLElement {
155
146
  /**
156
147
  * A table, its amounts at the end, sorted by a head once one is pressed; each cell's words in their own
157
148
  * direction, as a date the user's language writes, filled in a page in another. @param {Part} part @param {number} n its place among the page's tables
149
+ * @param {number} [place] the part's among the page's, which a page that leaves Jean finds it by (./alone.js)
158
150
  */
159
- table(part, n) {
151
+ table(part, n, place = -1) {
160
152
  const { heads, rows } = table(part), lang = locale.peek(), sort = this.sorted.get(n), named = namesRows(heads[0] ?? '', rows.map((row) => String(row[0] ?? '').trim()))
161
153
  const align = aligned({ align: heads.map(() => null), rows: rows.map((row) => row.map((text) => ({ text }))) }).map((side) => side && `align-${side}`), collator = new Intl.Collator(intlLocales(lang), { numeric: true })
162
154
  /** An amount by its value, one with none after the others; any other cell as the language sorts words. @param {string} a @param {string} b */
163
155
  const compare = (a, b) => (sort && align[sort.column] ? ((x, y) => (Number.isNaN(x) ? 1 : Number.isNaN(y) ? -1 : x - y))(number(a, lang), number(b, lang)) : collator.compare(a, b))
164
156
  const shown = sort ? [...rows].sort((a, b) => compare(a[sort.column], b[sort.column]) * (sort.down ? -1 : 1)) : rows
165
157
  const by = (/** @type {number} */ column) => () => { this.sorted.set(n, { column, down: sort?.column === column && !sort.down }); this.tick.value++ }
166
- return html`<div class="table" tabindex="0"><table>
158
+ return html`<div class="table" tabindex="0" data-part=${place}><table>
167
159
  <thead><tr>${heads.map((head, i) => html`<th scope="col" class=${align[i] || ''} aria-sort=${sort?.column === i ? (sort.down ? 'descending' : 'ascending') : nothing}>${head ? html`<button type="button" class="sorts" @click=${by(i)}>${head}</button>` : nothing}</th>`)}</tr></thead>
168
160
  <tbody>${shown.map((row) => html`<tr>${row.map((cell, i) => (i || !named ? html`<td class=${align[i] || ''}><bdi>${cell}</bdi></td>`
169
161
  : html`<th scope="row" class=${align[i] || ''}><bdi>${cell}</bdi></th>`))}</tr>`)}</tbody>
170
162
  </table></div>`
171
163
  }
172
164
 
173
- /** A chart, drawn by Charts once it has come, the same one as what it shows changes on a page that shares (`live`); until then, or where it can't come, its numbers as a table. @param {Part} part @param {boolean} live */
174
- chart(part, live) {
165
+ /** A chart, drawn by Charts once it has come, the same one as what it shows changes on a page that shares (`live`); until then, or where it can't come, its numbers as a table. @param {Part} part @param {boolean} live @param {number} [place] */
166
+ chart(part, live, place = -1) {
175
167
  const drawing = chart(part, locale.peek())
176
- if (customElements.get('app-chart')) return html`<app-chart ?live=${live} source=${JSON.stringify(option(drawing))}></app-chart>`
168
+ if (customElements.get('app-chart')) return html`<app-chart ?live=${live} data-part=${place} source=${JSON.stringify(option(drawing))}></app-chart>`
177
169
  void unlock('charts').then((come) => come && this.isConnected && this.tick.value++)
178
- return this.table({ ...part, text: [['', ...drawing.labels], ...drawing.series.map(({ name, data }) => [name, ...data])].map((row) => row.join(' | ')).join('\n') }, -1)
170
+ return this.table({ ...part, text: [['', ...drawing.labels], ...drawing.series.map(({ name, data }) => [name, ...data])].map((row) => row.join(' | ')).join('\n') }, -1, place)
179
171
  }
180
172
 
181
173
  /** What the user set or added: drawn again, and told to the brain with their next message. */
@@ -185,9 +177,9 @@ customElements.define('app-parts', class extends HTMLElement {
185
177
  * A form: a field for each of its lines, and its button, which adds what was filled in as a row to the collection it shows, as the
186
178
  * user's own change, or to the page's table it names, for this visit, or else sends it as the user's next message: what it asks,
187
179
  * then each field and its value. On a page that shares (`live`), a form that adds no row has its fields read at once, and a button only if it asks something.
188
- * @param {Shown} part @param {Part[]} tables the page's @param {ReturnType<typeof shared>} state
180
+ * @param {Shown} part @param {Part[]} tables the page's @param {ReturnType<typeof shared>} state @param {number} [place]
189
181
  */
190
- form(part, tables, state) {
182
+ form(part, tables, state, place = -1) {
191
183
  const fields = form(part), { ask = '', to = '' } = part.attrs, label = ask || t('action.send'), button = ask || to || !state.live, at = ++forms
192
184
  /** A field the user changed: all that reads it follows. @param {any} event */
193
185
  const changes = ({ target }) => { this.given.set(target.name, target.type === 'checkbox' ? target.checked : target.value); this.changed() }
@@ -207,7 +199,7 @@ customElements.define('app-parts', class extends HTMLElement {
207
199
  : field.kind === 'yes' || field.kind === 'no' ? html`<input id=${id} type="checkbox" name=${field.label} ?checked=${field.start ? /^(yes|on|true|✓)$/i.test(field.start) : field.kind === 'yes'}>`
208
200
  : field.kind === 'range' ? ((now) => html`<input id=${id} type="range" name=${field.label} min=${field.min ?? nothing} max=${field.max ?? nothing} step=${field.step ?? nothing} .value=${now}><input type="number" name=${field.label} title=${field.label} step=${field.step ?? nothing} .value=${now}>`)(String(this.given.get(field.label) ?? field.start))
209
201
  : html`<input id=${id} type=${field.kind === 'text' ? 'text' : field.kind} name=${field.label} step=${field.kind === 'number' ? 'any' : nothing} value=${field.start}>`)
210
- return html`<form class="part-form" @submit=${submit} @input=${state.live && !to ? changes : nothing}>${fields.map((field, i) => html`<label class=${field.kind === 'yes' || field.kind === 'no' ? 'tick' : field.kind === 'range' ? 'slides' : ''} for=${`part-${at}-${i}`}><span dir="auto">${field.label}</span>${input(field, `part-${at}-${i}`)}</label>`)}
202
+ return html`<form class="part-form" data-part=${place} @submit=${submit} @input=${state.live && !to ? changes : nothing}>${fields.map((field, i) => html`<label class=${field.kind === 'yes' || field.kind === 'no' ? 'tick' : field.kind === 'range' ? 'slides' : ''} for=${`part-${at}-${i}`}><span dir="auto">${field.label}</span>${input(field, `part-${at}-${i}`)}</label>`)}
211
203
  ${button ? html`<button type="submit" class="button primary">${label}</button>` : nothing}</form>`
212
204
  }
213
205
  })
@@ -93,7 +93,9 @@ export async function withRows(source) {
93
93
  let words = source
94
94
  for (const [block, folder] of source.matchAll(/^```table\n(collections\/[^\n]+)\n```$/gm)) {
95
95
  const grid = await (await import('../tables/tables.js')).gridIn(folder), line = (/** @type {string[]} */ cells) => `| ${cells.map((cell) => cell.replace(/[\\`*_[\]<>|~$&]/g, '\\$&').replace(/\s*\n\s*/g, ' ')).join(' | ')} |`
96
- if (grid) words = words.replace(block, () => [`### ${grid.name}`, '', line(grid.rows[0]), `| ${grid.right.map((right) => (right ? '---:' : '---')).join(' | ')} |`, ...grid.rows.slice(1).map(line)].join('\n'))
96
+ // A group's head and the foot, bold (D752).
97
+ const bold = (/** @type {string} */ row) => row.replace(/\| ([^|]+?) (?=\|)/g, (all, cell) => (cell.trim() ? `| **${cell.trim()}** ` : all))
98
+ if (grid) words = words.replace(block, () => [`### ${grid.name}`, '', line(grid.rows[0]), `| ${grid.right.map((right) => (right ? '---:' : '---')).join(' | ')} |`, ...grid.rows.slice(1).map((row, i) => (grid.heads.includes(i + 1) ? bold(line(row)) : line(row))), ...(grid.foot ? [bold(line(grid.foot))] : [])].join('\n'))
97
99
  }
98
100
  return words
99
101
  }
@@ -114,7 +116,8 @@ export async function rowsOf(folder) {
114
116
  const grid = await (await import('../tables/tables.js')).gridIn(folder), box = Object.assign(document.createElement('div'), { className: 'paper-rows' })
115
117
  const cells = (/** @type {string[]} */ row, /** @type {(cell: string, right: boolean) => unknown} */ draw) => row.map((cell, i) => draw(cell, Boolean(grid?.right[i])))
116
118
  if (grid) render(html`<h3 dir="auto">${grid.name}</h3><table><thead><tr>${cells(grid.rows[0], (cell, right) => html`<th dir="auto" class=${right ? 'paper-end' : nothing}>${cell}</th>`)}</tr></thead>
117
- <tbody>${grid.rows.slice(1).map((row) => html`<tr>${cells(row, (cell, right) => html`<td dir="auto" class=${right ? 'paper-end' : nothing}>${cell}</td>`)}</tr>`)}</tbody></table>`, box)
119
+ <tbody>${grid.rows.slice(1).map((row, i) => html`<tr class=${grid.heads.includes(i + 1) ? 'paper-group' : nothing}>${cells(row, (cell, right) => html`<td dir="auto" class=${right ? 'paper-end' : nothing}>${cell}</td>`)}</tr>`)}</tbody>
120
+ ${grid.foot ? html`<tfoot><tr>${cells(grid.foot, (cell, right) => html`<td dir="auto" class=${right ? 'paper-end' : nothing}>${cell}</td>`)}</tr></tfoot>` : nothing}</table>`, box)
118
121
  return box
119
122
  }
120
123