@davidsouther/jiffies 1.1.0 → 2.0.2

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 (384) hide show
  1. package/build/pico.css +2466 -0
  2. package/build/pico.css.map +1 -0
  3. package/{build → lib/cjs}/assert.d.ts +23 -23
  4. package/lib/cjs/assert.js +40 -0
  5. package/{build → lib/cjs}/case.d.ts +1 -1
  6. package/lib/cjs/case.js +9 -0
  7. package/{build → lib/cjs}/components/button_bar.d.ts +8 -8
  8. package/lib/cjs/components/button_bar.js +29 -0
  9. package/{build → lib/cjs}/components/inline_edit.d.ts +12 -12
  10. package/lib/cjs/components/inline_edit.js +51 -0
  11. package/{build → lib/cjs}/components/logger.d.ts +6 -6
  12. package/lib/cjs/components/logger.js +27 -0
  13. package/lib/cjs/components/select.d.ts +10 -0
  14. package/lib/cjs/components/select.js +6 -0
  15. package/lib/cjs/components/test.d.ts +1 -0
  16. package/lib/cjs/components/test.js +7 -0
  17. package/{build → lib/cjs}/components/virtual_scroll.d.ts +40 -40
  18. package/lib/cjs/components/virtual_scroll.js +102 -0
  19. package/{build → lib/cjs}/components/virtual_scroll.test.d.ts +1 -1
  20. package/lib/cjs/components/virtual_scroll.test.js +22 -0
  21. package/{build → lib/cjs}/context.d.ts +15 -15
  22. package/lib/cjs/context.js +48 -0
  23. package/{build → lib/cjs}/context.test.d.ts +1 -1
  24. package/lib/cjs/context.test.js +48 -0
  25. package/lib/cjs/debounce.d.ts +1 -0
  26. package/lib/cjs/debounce.js +12 -0
  27. package/lib/cjs/diff.d.ts +15 -0
  28. package/lib/cjs/diff.js +58 -0
  29. package/{build/components/test.d.ts → lib/cjs/diff.test.d.ts} +1 -1
  30. package/lib/cjs/diff.test.js +41 -0
  31. package/{build → lib/cjs}/display.d.ts +5 -5
  32. package/lib/cjs/display.js +16 -0
  33. package/{build → lib/cjs}/dom/css/border.d.ts +11 -11
  34. package/lib/cjs/dom/css/border.js +33 -0
  35. package/{build → lib/cjs}/dom/css/constants.d.ts +31 -31
  36. package/lib/cjs/dom/css/constants.js +31 -0
  37. package/{build → lib/cjs}/dom/css/core.d.ts +5 -5
  38. package/lib/cjs/dom/css/core.js +31 -0
  39. package/{build → lib/cjs}/dom/css/fstyle.d.ts +5 -5
  40. package/lib/cjs/dom/css/fstyle.js +36 -0
  41. package/{build → lib/cjs}/dom/css/sizing.d.ts +5 -5
  42. package/lib/cjs/dom/css/sizing.js +14 -0
  43. package/{build → lib/cjs}/dom/dom.d.ts +27 -26
  44. package/lib/cjs/dom/dom.js +110 -0
  45. package/{build → lib/cjs}/dom/fc.d.ts +14 -14
  46. package/lib/cjs/dom/fc.js +39 -0
  47. package/{build → lib/cjs}/dom/fc.test.d.ts +1 -1
  48. package/lib/cjs/dom/fc.test.js +23 -0
  49. package/{build → lib/cjs}/dom/form/form.app.d.ts +1 -1
  50. package/lib/cjs/dom/form/form.app.js +27 -0
  51. package/{build → lib/cjs}/dom/form/form.d.ts +26 -26
  52. package/lib/cjs/dom/form/form.js +49 -0
  53. package/{build → lib/cjs}/dom/form/form.test.d.ts +0 -0
  54. package/{build → lib/cjs}/dom/form/form.test.js +1 -1
  55. package/{build → lib/cjs}/dom/html.d.ts +113 -113
  56. package/lib/cjs/dom/html.js +119 -0
  57. package/{build → lib/cjs}/dom/html.test.d.ts +1 -1
  58. package/lib/cjs/dom/html.test.js +60 -0
  59. package/lib/cjs/dom/observable.d.ts +2 -0
  60. package/lib/cjs/dom/observable.js +10 -0
  61. package/{build/observable → lib/cjs/dom}/observable.test.d.ts +1 -1
  62. package/lib/cjs/dom/observable.test.js +35 -0
  63. package/{build → lib/cjs}/dom/provide.d.ts +3 -3
  64. package/lib/cjs/dom/provide.js +12 -0
  65. package/{build → lib/cjs}/dom/router/link.d.ts +6 -6
  66. package/lib/cjs/dom/router/link.js +7 -0
  67. package/{build → lib/cjs}/dom/router/router.d.ts +12 -12
  68. package/lib/cjs/dom/router/router.js +52 -0
  69. package/{build → lib/cjs}/dom/svg.d.ts +64 -64
  70. package/lib/cjs/dom/svg.js +69 -0
  71. package/lib/cjs/dom/test.d.ts +1 -0
  72. package/lib/cjs/dom/test.js +13 -0
  73. package/{build → lib/cjs}/dom/types/css.d.ts +6612 -6612
  74. package/lib/cjs/dom/types/css.js +24 -0
  75. package/{build → lib/cjs}/dom/types/dom.d.ts +0 -0
  76. package/{build → lib/cjs}/dom/types/dom.js +1 -1
  77. package/{build → lib/cjs}/dom/types/html.d.ts +616 -616
  78. package/lib/cjs/dom/types/html.js +2 -0
  79. package/{build → lib/cjs}/dom/xml.d.ts +1 -1
  80. package/lib/cjs/dom/xml.js +8 -0
  81. package/{build → lib/cjs}/equal.d.ts +5 -5
  82. package/lib/cjs/equal.js +43 -0
  83. package/{build → lib/cjs}/equal.test.d.ts +1 -1
  84. package/lib/cjs/equal.test.js +22 -0
  85. package/{build → lib/cjs}/flags.d.ts +7 -7
  86. package/lib/cjs/flags.js +52 -0
  87. package/{build → lib/cjs}/flags.test.d.ts +1 -1
  88. package/lib/cjs/flags.test.js +37 -0
  89. package/{build → lib/cjs}/fs.d.ts +48 -48
  90. package/lib/cjs/fs.js +152 -0
  91. package/{build → lib/cjs}/fs.test.d.ts +1 -1
  92. package/lib/cjs/fs.test.js +45 -0
  93. package/{build → lib/cjs}/generator.d.ts +1 -1
  94. package/lib/cjs/generator.js +14 -0
  95. package/{build → lib/cjs}/generator.test.d.ts +1 -1
  96. package/lib/cjs/generator.test.js +26 -0
  97. package/{build → lib/cjs}/is_browser.d.ts +1 -1
  98. package/lib/cjs/is_browser.js +4 -0
  99. package/{build → lib/cjs}/loader.d.mts +22 -22
  100. package/lib/cjs/loader.mjs +40 -0
  101. package/{build → lib/cjs}/lock.d.ts +1 -1
  102. package/lib/cjs/lock.js +27 -0
  103. package/{build → lib/cjs}/lock.test.d.ts +1 -1
  104. package/lib/cjs/lock.test.js +18 -0
  105. package/{build → lib/cjs}/log.d.ts +26 -26
  106. package/lib/cjs/log.js +54 -0
  107. package/lib/cjs/observable/event.d.ts +35 -0
  108. package/lib/cjs/observable/event.js +61 -0
  109. package/lib/cjs/observable/observable.d.ts +132 -0
  110. package/lib/cjs/observable/observable.js +363 -0
  111. package/lib/cjs/observable/observable.test.d.ts +1 -0
  112. package/lib/cjs/observable/observable.test.js +65 -0
  113. package/{build → lib/cjs}/range.d.ts +1 -1
  114. package/lib/cjs/range.js +11 -0
  115. package/{build → lib/cjs}/result.d.ts +31 -31
  116. package/lib/cjs/result.js +80 -0
  117. package/{build → lib/cjs}/result.test.d.ts +1 -1
  118. package/lib/cjs/result.test.js +73 -0
  119. package/{build → lib/cjs}/safe.d.ts +1 -1
  120. package/lib/cjs/safe.js +14 -0
  121. package/{build → lib/cjs}/scope/describe.d.ts +18 -18
  122. package/lib/cjs/scope/describe.js +73 -0
  123. package/{build → lib/cjs}/scope/display/console.d.ts +2 -2
  124. package/lib/cjs/scope/display/console.js +25 -0
  125. package/{build → lib/cjs}/scope/display/dom.d.ts +3 -3
  126. package/lib/cjs/scope/display/dom.js +30 -0
  127. package/{build → lib/cjs}/scope/display/junit.d.ts +2 -2
  128. package/lib/cjs/scope/display/junit.js +21 -0
  129. package/{build → lib/cjs}/scope/execute.d.ts +12 -12
  130. package/lib/cjs/scope/execute.js +91 -0
  131. package/{build → lib/cjs}/scope/expect.d.ts +23 -23
  132. package/lib/cjs/scope/expect.js +114 -0
  133. package/{build → lib/cjs}/scope/fix.d.ts +4 -4
  134. package/lib/cjs/scope/fix.js +26 -0
  135. package/{build → lib/cjs}/scope/index.d.ts +3 -3
  136. package/lib/cjs/scope/index.js +15 -0
  137. package/{build → lib/cjs}/scope/scope.d.ts +17 -17
  138. package/lib/cjs/scope/scope.js +2 -0
  139. package/lib/cjs/scope/state.d.ts +1 -0
  140. package/lib/cjs/scope/state.js +11 -0
  141. package/{build → lib/cjs}/server/http/apps.d.ts +5 -5
  142. package/lib/cjs/server/http/apps.js +27 -0
  143. package/{build → lib/cjs}/server/http/css.d.ts +5 -5
  144. package/lib/cjs/server/http/css.js +54 -0
  145. package/{build → lib/cjs}/server/http/index.d.ts +21 -21
  146. package/lib/cjs/server/http/index.js +77 -0
  147. package/{build → lib/cjs}/server/http/response.d.ts +4 -4
  148. package/lib/cjs/server/http/response.js +45 -0
  149. package/{build → lib/cjs}/server/http/sitemap.d.ts +2 -2
  150. package/lib/cjs/server/http/sitemap.js +46 -0
  151. package/{build → lib/cjs}/server/http/static.d.ts +2 -2
  152. package/lib/cjs/server/http/static.js +25 -0
  153. package/{build → lib/cjs}/server/http/typescript.d.ts +5 -5
  154. package/lib/cjs/server/http/typescript.js +44 -0
  155. package/{build → lib/cjs}/server/main.d.ts +2 -2
  156. package/lib/cjs/server/main.js +14 -0
  157. package/{build → lib/cjs}/test.d.mts +2 -2
  158. package/lib/cjs/test.mjs +28 -0
  159. package/{build → lib/cjs}/test_all.d.ts +9 -7
  160. package/lib/cjs/test_all.js +30 -0
  161. package/{build → lib/cjs}/transpile.d.mts +3 -3
  162. package/lib/cjs/transpile.mjs +22 -0
  163. package/lib/cjs/tsconfig.tsbuildinfo +1 -0
  164. package/lib/esm/assert.d.ts +23 -0
  165. package/{build → lib/esm}/assert.js +33 -33
  166. package/lib/esm/case.d.ts +1 -0
  167. package/{build → lib/esm}/case.js +5 -5
  168. package/lib/esm/components/button_bar.d.ts +8 -0
  169. package/{build → lib/esm}/components/button_bar.js +27 -27
  170. package/lib/esm/components/inline_edit.d.ts +12 -0
  171. package/{build → lib/esm}/components/inline_edit.js +48 -48
  172. package/lib/esm/components/logger.d.ts +6 -0
  173. package/{build → lib/esm}/components/logger.js +22 -22
  174. package/lib/esm/components/select.d.ts +10 -0
  175. package/{build → lib/esm}/components/select.js +3 -3
  176. package/lib/esm/components/test.d.ts +1 -0
  177. package/lib/esm/components/test.js +3 -0
  178. package/lib/esm/components/virtual_scroll.d.ts +40 -0
  179. package/{build → lib/esm}/components/virtual_scroll.js +94 -94
  180. package/lib/esm/components/virtual_scroll.test.d.ts +1 -0
  181. package/{build → lib/esm}/components/virtual_scroll.test.js +20 -21
  182. package/lib/esm/context.d.ts +15 -0
  183. package/{build → lib/esm}/context.js +43 -43
  184. package/lib/esm/context.test.d.ts +1 -0
  185. package/{build → lib/esm}/context.test.js +46 -46
  186. package/lib/esm/debounce.d.ts +1 -0
  187. package/{build → lib/esm}/debounce.js +8 -7
  188. package/lib/esm/diff.d.ts +15 -0
  189. package/lib/esm/diff.js +54 -0
  190. package/lib/esm/diff.test.d.ts +1 -0
  191. package/lib/esm/diff.test.js +39 -0
  192. package/lib/esm/display.d.ts +5 -0
  193. package/{build → lib/esm}/display.js +11 -11
  194. package/lib/esm/dom/css/border.d.ts +11 -0
  195. package/{build → lib/esm}/dom/css/border.js +27 -27
  196. package/lib/esm/dom/css/constants.d.ts +31 -0
  197. package/{build → lib/esm}/dom/css/constants.js +28 -28
  198. package/lib/esm/dom/css/core.d.ts +5 -0
  199. package/{build → lib/esm}/dom/css/core.js +24 -24
  200. package/lib/esm/dom/css/fstyle.d.ts +5 -0
  201. package/{build → lib/esm}/dom/css/fstyle.js +32 -32
  202. package/lib/esm/dom/css/sizing.d.ts +5 -0
  203. package/{build → lib/esm}/dom/css/sizing.js +10 -10
  204. package/lib/esm/dom/dom.d.ts +27 -0
  205. package/{build → lib/esm}/dom/dom.js +104 -95
  206. package/lib/esm/dom/fc.d.ts +14 -0
  207. package/{build → lib/esm}/dom/fc.js +35 -36
  208. package/lib/esm/dom/fc.test.d.ts +1 -0
  209. package/{build → lib/esm}/dom/fc.test.js +21 -21
  210. package/lib/esm/dom/form/form.app.d.ts +1 -0
  211. package/{build → lib/esm}/dom/form/form.app.js +23 -23
  212. package/lib/esm/dom/form/form.d.ts +26 -0
  213. package/{build → lib/esm}/dom/form/form.js +34 -34
  214. package/lib/esm/dom/form/form.test.d.ts +0 -0
  215. package/lib/esm/dom/form/form.test.js +1 -0
  216. package/lib/esm/dom/html.d.ts +113 -0
  217. package/{build → lib/esm}/dom/html.js +114 -114
  218. package/lib/esm/dom/html.test.d.ts +1 -0
  219. package/{build → lib/esm}/dom/html.test.js +58 -58
  220. package/lib/esm/dom/observable.d.ts +2 -0
  221. package/lib/esm/dom/observable.js +6 -0
  222. package/lib/esm/dom/observable.test.d.ts +1 -0
  223. package/lib/esm/dom/observable.test.js +33 -0
  224. package/lib/esm/dom/provide.d.ts +3 -0
  225. package/{build → lib/esm}/dom/provide.js +7 -7
  226. package/lib/esm/dom/router/link.d.ts +6 -0
  227. package/{build → lib/esm}/dom/router/link.js +3 -3
  228. package/lib/esm/dom/router/router.d.ts +12 -0
  229. package/{build → lib/esm}/dom/router/router.js +49 -49
  230. package/lib/esm/dom/svg.d.ts +64 -0
  231. package/{build → lib/esm}/dom/svg.js +65 -65
  232. package/lib/esm/dom/test.d.ts +1 -0
  233. package/lib/esm/dom/test.js +9 -0
  234. package/lib/esm/dom/types/css.d.ts +6612 -0
  235. package/{build → lib/esm}/dom/types/css.js +23 -23
  236. package/lib/esm/dom/types/dom.d.ts +0 -0
  237. package/lib/esm/dom/types/dom.js +1 -0
  238. package/lib/esm/dom/types/html.d.ts +616 -0
  239. package/{build → lib/esm}/dom/types/html.js +1 -1
  240. package/lib/esm/dom/xml.d.ts +1 -0
  241. package/{build → lib/esm}/dom/xml.js +4 -4
  242. package/lib/esm/equal.d.ts +5 -0
  243. package/{build → lib/esm}/equal.js +37 -37
  244. package/lib/esm/equal.test.d.ts +1 -0
  245. package/{build → lib/esm}/equal.test.js +20 -20
  246. package/lib/esm/flags.d.ts +7 -0
  247. package/{build → lib/esm}/flags.js +48 -48
  248. package/lib/esm/flags.test.d.ts +1 -0
  249. package/{build → lib/esm}/flags.test.js +35 -35
  250. package/lib/esm/fs.d.ts +48 -0
  251. package/{build → lib/esm}/fs.js +145 -144
  252. package/lib/esm/fs.test.d.ts +1 -0
  253. package/{build → lib/esm}/fs.test.js +43 -43
  254. package/lib/esm/generator.d.ts +1 -0
  255. package/{build → lib/esm}/generator.js +10 -10
  256. package/lib/esm/generator.test.d.ts +1 -0
  257. package/{build → lib/esm}/generator.test.js +24 -24
  258. package/lib/esm/is_browser.d.ts +1 -0
  259. package/{build → lib/esm}/is_browser.js +1 -1
  260. package/lib/esm/loader.d.mts +22 -0
  261. package/{build → lib/esm}/loader.mjs +35 -35
  262. package/lib/esm/lock.d.ts +1 -0
  263. package/{build → lib/esm}/lock.js +23 -23
  264. package/lib/esm/lock.test.d.ts +1 -0
  265. package/{build → lib/esm}/lock.test.js +16 -16
  266. package/lib/esm/log.d.ts +26 -0
  267. package/{build → lib/esm}/log.js +46 -46
  268. package/lib/esm/observable/event.d.ts +35 -0
  269. package/lib/esm/observable/event.js +46 -0
  270. package/lib/esm/observable/observable.d.ts +132 -0
  271. package/lib/esm/observable/observable.js +343 -0
  272. package/lib/esm/observable/observable.test.d.ts +1 -0
  273. package/lib/esm/observable/observable.test.js +63 -0
  274. package/lib/esm/range.d.ts +1 -0
  275. package/{build → lib/esm}/range.js +7 -7
  276. package/lib/esm/result.d.ts +31 -0
  277. package/{build → lib/esm}/result.js +65 -65
  278. package/lib/esm/result.test.d.ts +1 -0
  279. package/{build → lib/esm}/result.test.js +71 -71
  280. package/lib/esm/safe.d.ts +1 -0
  281. package/{build → lib/esm}/safe.js +10 -10
  282. package/lib/esm/scope/describe.d.ts +18 -0
  283. package/{build → lib/esm}/scope/describe.js +60 -61
  284. package/lib/esm/scope/display/console.d.ts +2 -0
  285. package/{build → lib/esm}/scope/display/console.js +21 -21
  286. package/lib/esm/scope/display/dom.d.ts +3 -0
  287. package/{build → lib/esm}/scope/display/dom.js +26 -26
  288. package/lib/esm/scope/display/junit.d.ts +2 -0
  289. package/{build → lib/esm}/scope/display/junit.js +17 -17
  290. package/lib/esm/scope/execute.d.ts +12 -0
  291. package/{build → lib/esm}/scope/execute.js +85 -85
  292. package/lib/esm/scope/expect.d.ts +23 -0
  293. package/{build → lib/esm}/scope/expect.js +108 -108
  294. package/lib/esm/scope/fix.d.ts +4 -0
  295. package/{build → lib/esm}/scope/fix.js +22 -22
  296. package/lib/esm/scope/index.d.ts +3 -0
  297. package/{build → lib/esm}/scope/index.js +3 -3
  298. package/lib/esm/scope/scope.d.ts +17 -0
  299. package/{build → lib/esm}/scope/scope.js +1 -1
  300. package/lib/esm/scope/state.d.ts +1 -0
  301. package/lib/esm/scope/state.js +7 -0
  302. package/lib/esm/server/http/apps.d.ts +5 -0
  303. package/{build → lib/esm}/server/http/apps.js +23 -23
  304. package/lib/esm/server/http/css.d.ts +5 -0
  305. package/{build → lib/esm}/server/http/css.js +50 -50
  306. package/lib/esm/server/http/index.d.ts +21 -0
  307. package/{build → lib/esm}/server/http/index.js +73 -73
  308. package/lib/esm/server/http/response.d.ts +4 -0
  309. package/{build → lib/esm}/server/http/response.js +40 -40
  310. package/lib/esm/server/http/sitemap.d.ts +2 -0
  311. package/{build → lib/esm}/server/http/sitemap.js +42 -42
  312. package/lib/esm/server/http/static.d.ts +2 -0
  313. package/{build → lib/esm}/server/http/static.js +21 -21
  314. package/lib/esm/server/http/typescript.d.ts +5 -0
  315. package/{build → lib/esm}/server/http/typescript.js +40 -40
  316. package/lib/esm/server/main.d.ts +2 -0
  317. package/{build → lib/esm}/server/main.js +12 -9
  318. package/lib/esm/test.d.mts +2 -0
  319. package/lib/esm/test.mjs +26 -0
  320. package/lib/esm/test_all.d.ts +9 -0
  321. package/{build → lib/esm}/test_all.js +28 -18
  322. package/lib/esm/transpile.d.mts +3 -0
  323. package/{build → lib/esm}/transpile.mjs +18 -18
  324. package/lib/esm/tsconfig.tsbuildinfo +1 -0
  325. package/package.json +16 -17
  326. package/src/assert.ts +1 -1
  327. package/src/components/button_bar.ts +3 -3
  328. package/src/components/inline_edit.ts +3 -3
  329. package/src/components/logger.ts +3 -3
  330. package/src/components/select.ts +3 -3
  331. package/src/components/test.js +3 -2
  332. package/src/context.ts +3 -3
  333. package/src/debounce.ts +2 -1
  334. package/src/diff.ts +2 -2
  335. package/src/display.ts +2 -2
  336. package/src/dom/css/border.ts +3 -3
  337. package/src/dom/css/core.ts +1 -1
  338. package/src/dom/css/fstyle.ts +2 -2
  339. package/src/dom/css/sizing.ts +1 -1
  340. package/src/dom/dom.ts +1 -1
  341. package/src/dom/fc.test.ts +3 -3
  342. package/src/dom/fc.ts +1 -1
  343. package/src/dom/form/form.app.ts +2 -2
  344. package/src/dom/form/form.ts +3 -3
  345. package/src/dom/html.test.ts +3 -3
  346. package/src/dom/html.ts +1 -1
  347. package/src/dom/observable.test.ts +6 -6
  348. package/src/dom/observable.ts +1 -1
  349. package/src/dom/provide.ts +1 -1
  350. package/src/dom/router/link.ts +2 -2
  351. package/src/dom/router/router.ts +2 -2
  352. package/src/dom/svg.ts +1 -1
  353. package/src/dom/test.ts +8 -6
  354. package/src/dom/types/html.ts +1 -1
  355. package/src/equal.ts +1 -1
  356. package/src/flags.ts +1 -1
  357. package/src/fs.ts +5 -4
  358. package/src/index.html +6 -6
  359. package/src/observable/event.ts +2 -2
  360. package/src/observable/observable.test.ts +2 -2
  361. package/src/observable/observable.ts +72 -12
  362. package/src/pico/_variables.scss +1 -1
  363. package/src/pico/layout/_sectioning.scss +2 -0
  364. package/src/result.ts +1 -1
  365. package/src/scope/describe.ts +2 -5
  366. package/src/scope/display/console.ts +4 -4
  367. package/src/scope/display/dom.ts +6 -6
  368. package/src/scope/display/junit.ts +3 -3
  369. package/src/scope/execute.ts +2 -2
  370. package/src/scope/expect.ts +3 -3
  371. package/src/scope/state.ts +10 -0
  372. package/src/server/http/sitemap.ts +1 -1
  373. package/src/server/main.ts +9 -2
  374. package/src/test.mjs +22 -18
  375. package/src/test_all.ts +10 -0
  376. package/build/components/select.d.ts +0 -13
  377. package/build/components/test.js +0 -2
  378. package/build/debounce.d.ts +0 -1
  379. package/build/dom/test.d.ts +0 -1
  380. package/build/dom/test.js +0 -2
  381. package/build/observable/observable.d.ts +0 -83
  382. package/build/observable/observable.js +0 -148
  383. package/build/observable/observable.test.js +0 -21
  384. package/build/test.mjs +0 -23
@@ -1,10 +1,10 @@
1
- import { Widths } from "./constants.js";
2
- export function width(amount, block) {
3
- if (amount === undefined && Widths[block] !== undefined) {
4
- amount = block;
5
- }
6
- return {
7
- ...(block === "inline" ? { display: "inline-block" } : {}),
8
- width: Widths[amount] ?? "0",
9
- };
10
- }
1
+ import { Widths } from "./constants.js";
2
+ export function width(amount, block) {
3
+ if (amount === undefined && Widths[block] !== undefined) {
4
+ amount = block;
5
+ }
6
+ return {
7
+ ...(block === "inline" ? { display: "inline-block" } : {}),
8
+ width: Widths[amount] ?? "0",
9
+ };
10
+ }
@@ -0,0 +1,27 @@
1
+ import { Properties } from "./types/css.js";
2
+ declare const Events: unique symbol;
3
+ export declare const CLEAR: unique symbol;
4
+ export declare type EventHandler = EventListenerOrEventListenerObject;
5
+ export declare type DenormChildren = Node | string | typeof CLEAR;
6
+ export declare type DOMElement = Element & DocumentAndElementEventHandlers & ElementCSSInlineStyle;
7
+ export declare type DomAttrs = {
8
+ class: string | string[];
9
+ style: Partial<Properties> | string;
10
+ role: "button" | "list" | "listbox";
11
+ events: Partial<{
12
+ [K in keyof HTMLElementEventMap]: EventHandler | null;
13
+ }>;
14
+ };
15
+ export declare type Attrs<E extends Omit<Element, "update">, S = {}> = Partial<Omit<E, "style"> & S & DomAttrs>;
16
+ export declare type DenormAttrs<E extends Omit<Element, "update">, S = {}> = Attrs<E, S> | DenormChildren;
17
+ declare global {
18
+ interface Element {
19
+ [Events]: Map<string, EventHandler>;
20
+ update(attrs?: DenormAttrs<Element>, ...children: DenormChildren[]): this;
21
+ }
22
+ }
23
+ export declare type DOMUpdates<E extends Element = Element> = [DenormAttrs<E>, ...DenormChildren[]] | DenormChildren[];
24
+ export declare function normalizeArguments<E extends Element>(attrs?: DenormAttrs<E>, children?: DenormChildren[], defaultAttrs?: Attrs<E>): [Attrs<E>, DenormChildren[]];
25
+ export declare function up<E extends Element>(element: Omit<E, "update">, attrs?: DenormAttrs<E>, ...children: DenormChildren[]): E;
26
+ export declare function update(element: Omit<Element, "update">, attrs: Attrs<Element>, children: DenormChildren[]): Element;
27
+ export {};
@@ -1,95 +1,104 @@
1
- const Events = Symbol("events");
2
- export const CLEAR = Symbol("Clear children");
3
- function isAttrs(attrs) {
4
- if (!attrs) {
5
- return false;
6
- }
7
- if (typeof attrs === "string") {
8
- return false;
9
- }
10
- return !attrs.nodeType;
11
- }
12
- export function normalizeArguments(attrs, children = [], defaultAttrs = {}) {
13
- let attributes;
14
- if (isAttrs(attrs)) {
15
- attributes = attrs;
16
- }
17
- else {
18
- if (attrs !== undefined) {
19
- children.unshift(attrs);
20
- }
21
- attributes = defaultAttrs;
22
- }
23
- return [attributes, children.flat()];
24
- }
25
- export function up(element, attrs, ...children) {
26
- return update(element, ...normalizeArguments(attrs, children));
27
- }
28
- export function update(element, attrs, children) {
29
- // Track events, to remove later
30
- const $events = (element[Events] ??= new Map());
31
- const { style = {}, events = {}, ...rest } = attrs;
32
- Object.entries(events).forEach(([k, v]) => {
33
- if (v === null && $events.has(k)) {
34
- const listener = $events.get(k);
35
- element.removeEventListener(k, listener);
36
- }
37
- else if (!$events.has(k)) {
38
- element.addEventListener(k, v);
39
- $events.set(k, v);
40
- }
41
- });
42
- const _style = element.style;
43
- if (_style) {
44
- if (typeof style === "string") {
45
- _style.cssText = style;
46
- }
47
- else {
48
- Object.entries(style).forEach(([k, v]) => {
49
- // @ts-ignore Object.entries is unable to statically look into args
50
- _style[k] = v;
51
- });
52
- }
53
- }
54
- Object.entries(rest).forEach(([k, v]) => {
55
- if (k === "class" && typeof v === "string") {
56
- v.split(/\s+/m)
57
- .filter((s) => s !== "")
58
- .forEach((c) => element.classList.add(c));
59
- }
60
- let useAttributes = k.startsWith("aria-") ||
61
- k == "role" ||
62
- element.namespaceURI != "http://www.w3.org/1999/xhtml";
63
- if (useAttributes) {
64
- switch (v) {
65
- case false:
66
- element.removeAttributeNS(element.namespaceURI, k);
67
- break;
68
- case true:
69
- element.setAttributeNS(element.namespaceURI, k, k);
70
- break;
71
- default:
72
- if (v === "") {
73
- element.removeAttributeNS(element.namespaceURI, k);
74
- }
75
- else {
76
- element.setAttributeNS(element.namespaceURI, k, v);
77
- }
78
- }
79
- }
80
- else {
81
- // @ts-ignore Object.entries is unable to statically look into args
82
- element[k] = v;
83
- }
84
- });
85
- if (children?.length > 0) {
86
- if (children[0] === CLEAR) {
87
- element.replaceChildren();
88
- }
89
- else {
90
- element.replaceChildren(...children);
91
- }
92
- }
93
- element.update ??= (attrs, ...children) => update(element, ...normalizeArguments(attrs, children));
94
- return element;
95
- }
1
+ const Events = Symbol("events");
2
+ export const CLEAR = Symbol("Clear children");
3
+ function isAttrs(attrs) {
4
+ if (!attrs) {
5
+ return false;
6
+ }
7
+ if (typeof attrs === "object") {
8
+ return !attrs.nodeType;
9
+ }
10
+ return false;
11
+ }
12
+ export function normalizeArguments(attrs, children = [], defaultAttrs = {}) {
13
+ let attributes;
14
+ if (isAttrs(attrs)) {
15
+ attributes = attrs;
16
+ }
17
+ else {
18
+ if (attrs !== undefined) {
19
+ children.unshift(attrs);
20
+ }
21
+ attributes = defaultAttrs;
22
+ }
23
+ return [attributes, children.flat()];
24
+ }
25
+ export function up(element, attrs, ...children) {
26
+ return update(element, ...normalizeArguments(attrs, children));
27
+ }
28
+ export function update(element, attrs, children) {
29
+ // Track events, to remove later
30
+ const $events = (element[Events] ??= new Map());
31
+ const { style = {}, events = {}, ...rest } = attrs;
32
+ Object.entries(events).forEach(([k, v]) => {
33
+ if (v === null) {
34
+ if ($events.has(k)) {
35
+ const listener = $events.get(k);
36
+ element.removeEventListener(k, listener);
37
+ }
38
+ }
39
+ else if (v !== undefined) {
40
+ element.addEventListener(k, v);
41
+ $events.set(k, v);
42
+ }
43
+ });
44
+ const _style = element.style;
45
+ if (_style) {
46
+ if (typeof style === "string") {
47
+ _style.cssText = style;
48
+ }
49
+ else {
50
+ Object.entries(style).forEach(([k, v]) => {
51
+ // @ts-ignore Object.entries is unable to statically look into args
52
+ _style[k] = v;
53
+ });
54
+ }
55
+ }
56
+ Object.entries(rest).forEach(([k, v]) => {
57
+ if (k === "class") {
58
+ v = Array.isArray(v)
59
+ ? v
60
+ : (typeof v === "string" ? v : `${v}`).split(/\s+/m);
61
+ v
62
+ .filter((s) => s !== "")
63
+ .forEach((c) => {
64
+ if (c.startsWith("!")) {
65
+ element.classList.remove(c.substring(1));
66
+ }
67
+ else {
68
+ element.classList.add(c);
69
+ }
70
+ });
71
+ return;
72
+ }
73
+ const useNamespace = element.namespaceURI &&
74
+ element.namespaceURI != "http://www.w3.org/1999/xhtml";
75
+ const remove = !v;
76
+ if (useNamespace) {
77
+ if (remove) {
78
+ element.removeAttributeNS(element.namespaceURI, k);
79
+ }
80
+ else if (v === true) {
81
+ element.setAttributeNS(element.namespaceURI, k, k);
82
+ }
83
+ else {
84
+ element.setAttributeNS(element.namespaceURI, k, v);
85
+ }
86
+ }
87
+ else {
88
+ if (remove) {
89
+ element.removeAttribute(k);
90
+ }
91
+ else if (v === true) {
92
+ element.setAttribute(k, k);
93
+ }
94
+ else {
95
+ element.setAttribute(k, v);
96
+ }
97
+ }
98
+ });
99
+ if (children?.length > 0) {
100
+ element.replaceChildren(...(children[0] === CLEAR ? [] : children));
101
+ }
102
+ element.update ??= (attrs, ...children) => update(element, ...normalizeArguments(attrs, children));
103
+ return element;
104
+ }
@@ -0,0 +1,14 @@
1
+ import { DenormChildren, DomAttrs } from "./dom.js";
2
+ export declare type Attrs<S> = S & Partial<DomAttrs>;
3
+ export declare const State: unique symbol;
4
+ export interface FCComponent<P extends object, S extends object> extends Element {
5
+ [State]?: Partial<S>;
6
+ update(attrs?: Partial<Attrs<P> & DomAttrs> | DenormChildren, ...children: DenormChildren[]): this;
7
+ }
8
+ export interface RenderFn<P extends object, S extends object> {
9
+ (el: FCComponent<P, S>, attrs: Attrs<P>, children: DenormChildren[]): Element | Element[];
10
+ }
11
+ export interface FCComponentCtor<P extends object, S extends object> {
12
+ (attrs?: Attrs<P> | DenormChildren, ...children: DenormChildren[]): FCComponent<P, S>;
13
+ }
14
+ export declare function FC<P extends object, S extends object = {}>(name: string, component: RenderFn<P, S>): FCComponentCtor<P, S>;
@@ -1,36 +1,35 @@
1
- import { CLEAR, normalizeArguments, update, } from "./dom.js";
2
- export const State = Symbol();
3
- export function FC(name, component) {
4
- class FCImpl extends HTMLElement {
5
- constructor() {
6
- super();
7
- }
8
- [State] = {};
9
- #attrs = {};
10
- #children = [];
11
- update(attrs, ...children) {
12
- [attrs, children] = normalizeArguments(attrs, children);
13
- if (children[0] === CLEAR) {
14
- this.#children = [];
15
- }
16
- else if (children.length > 0) {
17
- this.#children = children;
18
- }
19
- this.#attrs = { ...this.#attrs, ...attrs };
20
- // Apply updates from the attrs to the dom node itself
21
- // @ts-ignore
22
- update(this, this.#attrs, []);
23
- // Re-run the component function using new element, attrs, and children.
24
- const replace = [component(this, this.#attrs, this.#children)];
25
- this.replaceChildren(...replace.flat());
26
- return this;
27
- }
28
- }
29
- customElements.define(name, FCImpl);
30
- const ctor = (attrs, ...children) => {
31
- const element = document.createElement(name);
32
- element.update(attrs, ...children);
33
- return element;
34
- };
35
- return ctor;
36
- }
1
+ import { CLEAR, normalizeArguments, update, } from "./dom.js";
2
+ export const State = Symbol();
3
+ export function FC(name, component) {
4
+ class FCImpl extends HTMLElement {
5
+ constructor() {
6
+ super();
7
+ }
8
+ [State] = {};
9
+ #attrs = {};
10
+ #children = [];
11
+ update(attrs, ...children) {
12
+ [attrs, children] = normalizeArguments(attrs, children);
13
+ if (children[0] === CLEAR) {
14
+ this.#children = [];
15
+ }
16
+ else if (children.length > 0) {
17
+ this.#children = children;
18
+ }
19
+ this.#attrs = { ...this.#attrs, ...attrs };
20
+ // Apply updates from the attrs to the dom node itself
21
+ update(this, this.#attrs, []);
22
+ // Re-run the component function using new element, attrs, and children.
23
+ const replace = [component(this, this.#attrs, this.#children)];
24
+ this.replaceChildren(...replace.flat());
25
+ return this;
26
+ }
27
+ }
28
+ customElements.define(name, FCImpl);
29
+ const ctor = (attrs, ...children) => {
30
+ const element = document.createElement(name);
31
+ element.update(attrs, ...children);
32
+ return element;
33
+ };
34
+ return ctor;
35
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,21 +1,21 @@
1
- import { describe, it, expect } from "../scope/index.js";
2
- import { FC } from "./fc.js";
3
- import { button, div, form, input, label, small } from "./html.js";
4
- describe("FC", () => {
5
- it("creates FCs", () => {
6
- const Input = FC("fc-input", (el, attrs, children) => label(attrs.placeholder ?? attrs.name, input(attrs), ...children));
7
- const f = form({ action: "#", method: "POST" }, div({ class: "grid" }, Input({
8
- name: "firstName",
9
- placeholder: "First Name",
10
- required: true,
11
- }), Input({
12
- name: "lastName",
13
- placeholder: "Last Name",
14
- required: true,
15
- })), Input({ name: "email", type: "email", placeholder: "E-Mail" }, small("We'll never share your information.")), button({ type: "submit" }, "Submit"));
16
- // document.body.appendChild(f);
17
- expect(f.children.length).toBe(3);
18
- expect(f.querySelectorAll("input[required]").length).toBe(2);
19
- expect(f.querySelectorAll('input[name="firstName"]').length).toBe(1);
20
- });
21
- });
1
+ import { describe, it, expect } from "../scope/index.js";
2
+ import { FC } from "./fc.js";
3
+ import { button, div, form, input, label, small } from "./html.js";
4
+ describe("FC", () => {
5
+ it("creates FCs", () => {
6
+ const Input = FC("fc-input", (el, attrs, children) => label(attrs.placeholder ?? attrs.name, input(attrs), ...children));
7
+ const f = form({ action: "#", method: "POST" }, div({ class: "grid" }, Input({
8
+ name: "firstName",
9
+ placeholder: "First Name",
10
+ required: true,
11
+ }), Input({
12
+ name: "lastName",
13
+ placeholder: "Last Name",
14
+ required: true,
15
+ })), Input({ name: "email", type: "email", placeholder: "E-Mail" }, small("We'll never share your information.")), button({ type: "submit" }, "Submit"));
16
+ // document.body.appendChild(f);
17
+ expect(f.children.length).toBe(3);
18
+ expect(f.querySelectorAll("input[required]").length).toBe(2);
19
+ expect(f.querySelectorAll('input[name="firstName"]').length).toBe(1);
20
+ });
21
+ });
@@ -0,0 +1 @@
1
+ export declare const App: () => HTMLElement;
@@ -1,23 +1,23 @@
1
- import { article, button, div, main, small } from "../html.js";
2
- import { Form, Input } from "./form.js";
3
- export const App = () => main({ class: "container" }, article(Form({
4
- events: {
5
- submit(event) {
6
- console.log("Should see fields for firstname, lastname, email, etc");
7
- console.log(event);
8
- },
9
- },
10
- }, div({ class: "grid" }, Input({ id: "firstname", placeholder: "First name" }), Input({ id: "lastname", placeholder: "Last name" })), Input({
11
- id: "email",
12
- type: "email",
13
- placeholder: "Email address",
14
- required: true,
15
- }, small("We will never share your email with anyone.")), button({ type: "submit" }, "Submit"), div({ class: "grid" }, Input({ id: "valid", placeholder: "Valid", "aria-invalid": "false" }), Input({
16
- id: "invalid",
17
- placeholder: "Invalid",
18
- "aria-invalid": "true",
19
- }), Input({ id: "disabled", placeholder: "Disabled", disabled: true }), Input({ id: "readonly", value: "Readonly", readOnly: true }))
20
- // Dropdown({id: 'fruit', label: "Fruit", placeholder: "Select a fruit...", options: ['Banana', 'Watermelon', 'Apple', 'Orange', 'Mango']}),
21
- // Radios({legend: 'Size', options: {small: 'Small', medium: 'Medium', large: 'Large', extralarge: "Extra Large"}, checked: 'small'}),
22
- // Checkboxes({options: {terms: 'I agree to the Terms and Conditions', termsSharing: {label: 'I agree to share my information with partners', disabled: true, checked: true}}),
23
- )));
1
+ import { article, button, div, main, small } from "../html.js";
2
+ import { Form, Input } from "./form.js";
3
+ export const App = () => main({ class: "container" }, article(Form({
4
+ events: {
5
+ submit(event) {
6
+ console.log("Should see fields for firstname, lastname, email, etc");
7
+ console.log(event);
8
+ },
9
+ },
10
+ }, div({ class: "grid" }, Input({ id: "firstname", placeholder: "First name" }), Input({ id: "lastname", placeholder: "Last name" })), Input({
11
+ id: "email",
12
+ type: "email",
13
+ placeholder: "Email address",
14
+ required: true,
15
+ }, small("We will never share your email with anyone.")), button({ type: "submit" }, "Submit"), div({ class: "grid" }, Input({ id: "valid", placeholder: "Valid", "aria-invalid": "false" }), Input({
16
+ id: "invalid",
17
+ placeholder: "Invalid",
18
+ "aria-invalid": "true",
19
+ }), Input({ id: "disabled", placeholder: "Disabled", disabled: true }), Input({ id: "readonly", value: "Readonly", readOnly: true }))
20
+ // Dropdown({id: 'fruit', label: "Fruit", placeholder: "Select a fruit...", options: ['Banana', 'Watermelon', 'Apple', 'Orange', 'Mango']}),
21
+ // Radios({legend: 'Size', options: {small: 'Small', medium: 'Medium', large: 'Large', extralarge: "Extra Large"}, checked: 'small'}),
22
+ // Checkboxes({options: {terms: 'I agree to the Terms and Conditions', termsSharing: {label: 'I agree to share my information with partners', disabled: true, checked: true}}),
23
+ )));
@@ -0,0 +1,26 @@
1
+ import { DenormChildren } from "../dom.js";
2
+ import { label } from "../html.js";
3
+ import { FormAttributes, InputAttributes, LabelAttributes, OptionAttributes, SelectAttributes } from "../types/html";
4
+ export declare const Form: (attrs: FormAttributes, ...children: DenormChildren[]) => HTMLFormElement;
5
+ export declare const Input: (attrs: InputAttributes, ...children: DenormChildren[]) => HTMLLabelElement;
6
+ export declare const Select: (attrs: {
7
+ options: string[] | {};
8
+ selected?: string;
9
+ } & SelectAttributes & LabelAttributes) => HTMLLabelElement;
10
+ export declare const Button: () => void;
11
+ declare const prepareOptions: (attrs: string[] | Record<string, string | {
12
+ label: string;
13
+ disabled?: boolean | undefined;
14
+ selected?: boolean | undefined;
15
+ }>, selected?: string) => Parameters<typeof Option>[0][];
16
+ export declare const Option: (attrs: OptionAttributes) => HTMLOptionElement;
17
+ export declare const Dropdown: (attrs: SelectAttributes | {
18
+ selected?: string;
19
+ }, ...options: Parameters<typeof prepareOptions>[0][]) => HTMLLabelElement;
20
+ export declare const Radios: () => void;
21
+ export declare const Checks: () => void;
22
+ export declare const Switches: () => void;
23
+ export declare const Radio: (attrs: Omit<InputAttributes, "type">) => HTMLLabelElement;
24
+ export declare const Checkbox: (attrs: Omit<InputAttributes, "type">) => HTMLLabelElement;
25
+ export declare const Switch: () => HTMLLabelElement;
26
+ export {};
@@ -1,34 +1,34 @@
1
- import { form, input, label, option, select } from "../html.js";
2
- export const Form = (attrs, ...children) => {
3
- if (attrs.events?.submit) {
4
- const submit = attrs.events.submit;
5
- attrs.events.submit = (event) => {
6
- event.preventDefault();
7
- submit(event);
8
- };
9
- }
10
- return form(attrs, ...children);
11
- };
12
- export const Input = (attrs, ...children) => label(input(attrs), ...children);
13
- export const Select = (attrs) => label({ style: attrs.style ?? {} }, select({ events: attrs.events ?? {} }, ...prepareOptions(attrs.options, attrs.selected).map(Option)));
14
- export const Button = () => { };
15
- const prepareOptions = (attrs, selected) => Array.isArray(attrs)
16
- ? attrs.map((value) => ({
17
- value,
18
- label: value,
19
- selected: selected == value,
20
- }))
21
- : Object.entries(attrs).map(([value, label]) => typeof label === "string"
22
- ? { value, label, selected: selected === value }
23
- : { value, ...label });
24
- export const Option = (attrs) => option(attrs);
25
- export const Dropdown = (attrs, ...options) => Select({
26
- ...attrs,
27
- options: typeof options[0] == "string" ? options : options[0],
28
- });
29
- export const Radios = () => { };
30
- export const Checks = () => { };
31
- export const Switches = () => { };
32
- export const Radio = (attrs) => Input({ type: "radio" });
33
- export const Checkbox = (attrs) => Input({ type: "checkbox" });
34
- export const Switch = () => Checkbox({ role: "switch" });
1
+ import { form, input, label, option, select } from "../html.js";
2
+ export const Form = (attrs, ...children) => {
3
+ if (attrs.events?.submit) {
4
+ const submit = attrs.events.submit;
5
+ attrs.events.submit = (event) => {
6
+ event.preventDefault();
7
+ submit(event);
8
+ };
9
+ }
10
+ return form(attrs, ...children);
11
+ };
12
+ export const Input = (attrs, ...children) => label(input(attrs), ...children);
13
+ export const Select = (attrs) => label({ style: attrs.style ?? {} }, select({ events: attrs.events ?? {} }, ...prepareOptions(attrs.options, attrs.selected).map(Option)));
14
+ export const Button = () => { };
15
+ const prepareOptions = (attrs, selected) => Array.isArray(attrs)
16
+ ? attrs.map((value) => ({
17
+ value,
18
+ label: value,
19
+ selected: selected == value,
20
+ }))
21
+ : Object.entries(attrs).map(([value, label]) => typeof label === "string"
22
+ ? { value, label, selected: selected === value }
23
+ : { value, ...label });
24
+ export const Option = (attrs) => option(attrs);
25
+ export const Dropdown = (attrs, ...options) => Select({
26
+ ...attrs,
27
+ options: typeof options[0] == "string" ? options : options[0],
28
+ });
29
+ export const Radios = () => { };
30
+ export const Checks = () => { };
31
+ export const Switches = () => { };
32
+ export const Radio = (attrs) => Input({ type: "radio" });
33
+ export const Checkbox = (attrs) => Input({ type: "checkbox" });
34
+ export const Switch = () => Checkbox({ role: "switch" });
File without changes
@@ -0,0 +1 @@
1
+ "use strict";