@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,65 +1,65 @@
1
- export const isNone = (s) => s == null;
2
- export const isSome = (s) => s != null;
3
- export function None(_) {
4
- return null;
5
- }
6
- export function Some(t) {
7
- return t;
8
- }
9
- export const isOk = (t) => t.ok !== undefined;
10
- export const isErr = (e) => e.err !== undefined;
11
- export const isResult = (t) => isOk(t) || isErr(t);
12
- export function Ok(t) {
13
- return t.ok
14
- ? t.ok
15
- : {
16
- ok: t,
17
- map(fn) {
18
- return fn(Ok(this));
19
- },
20
- };
21
- }
22
- export function Err(e) {
23
- return (e.err ?? {
24
- err: e,
25
- map(_fn) {
26
- return this;
27
- },
28
- });
29
- }
30
- export function unwrap(t) {
31
- if (isNone(t)) {
32
- throw new Error(`Attempted to unwrap None`);
33
- }
34
- if (isErr(t)) {
35
- throw Err(t);
36
- }
37
- if (isOk(t)) {
38
- return Ok(t);
39
- }
40
- return t;
41
- }
42
- export function unwrapOr(t, def) {
43
- if (isNone(t)) {
44
- return def;
45
- }
46
- if (isErr(t)) {
47
- return def;
48
- }
49
- if (isOk(t)) {
50
- return Ok(t);
51
- }
52
- return t;
53
- }
54
- export function unwrapOrElse(t, def) {
55
- if (isNone(t)) {
56
- return def();
57
- }
58
- if (isErr(t)) {
59
- return def();
60
- }
61
- if (isOk(t)) {
62
- return Ok(t);
63
- }
64
- return t;
65
- }
1
+ export const isNone = (s) => s === null;
2
+ export const isSome = (s) => s != null;
3
+ export function None(_) {
4
+ return null;
5
+ }
6
+ export function Some(t) {
7
+ return t;
8
+ }
9
+ export const isOk = (t) => t.ok !== undefined;
10
+ export const isErr = (e) => e.err !== undefined;
11
+ export const isResult = (t) => isOk(t) || isErr(t);
12
+ export function Ok(t) {
13
+ return t.ok
14
+ ? t.ok
15
+ : {
16
+ ok: t,
17
+ map(fn) {
18
+ return fn(Ok(this));
19
+ },
20
+ };
21
+ }
22
+ export function Err(e) {
23
+ return (e.err ?? {
24
+ err: e,
25
+ map(_fn) {
26
+ return this;
27
+ },
28
+ });
29
+ }
30
+ export function unwrap(t) {
31
+ if (isNone(t)) {
32
+ throw new Error(`Attempted to unwrap None`);
33
+ }
34
+ if (isErr(t)) {
35
+ throw Err(t);
36
+ }
37
+ if (isOk(t)) {
38
+ return Ok(t);
39
+ }
40
+ return t;
41
+ }
42
+ export function unwrapOr(t, def) {
43
+ if (isNone(t)) {
44
+ return def;
45
+ }
46
+ if (isErr(t)) {
47
+ return def;
48
+ }
49
+ if (isOk(t)) {
50
+ return Ok(t);
51
+ }
52
+ return t;
53
+ }
54
+ export function unwrapOrElse(t, def) {
55
+ if (isNone(t)) {
56
+ return def();
57
+ }
58
+ if (isErr(t)) {
59
+ return def();
60
+ }
61
+ if (isOk(t)) {
62
+ return Ok(t);
63
+ }
64
+ return t;
65
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,71 +1,71 @@
1
- import { Err, None, Ok, Some, unwrap, unwrapOr, unwrapOrElse, } from "./result.js";
2
- import { describe, it } from "./scope/describe.js";
3
- import { expect } from "./scope/expect.js";
4
- describe("Result", () => {
5
- it("converts Nones", () => {
6
- const a = None();
7
- expect(a).toBeNull();
8
- const b = None();
9
- expect(b).toBeNull();
10
- const c = Some(a);
11
- expect(c).toBeNull();
12
- const d = Some(b);
13
- expect(d).toBeNull();
14
- });
15
- it("converts Somes", () => {
16
- const a = Some("a");
17
- expect(a).toBe("a");
18
- const b = Some(a);
19
- expect(b).toBe("a");
20
- });
21
- it("converts Errs", () => {
22
- const a = Err(new Error("a error"));
23
- const b = Err(a);
24
- expect(b).toMatchObject({ message: "a error" });
25
- // Assign Err to Result
26
- const c = a;
27
- });
28
- it("converts Oks", () => {
29
- const a = Ok("a ok");
30
- const b = Ok(a);
31
- expect(b).toBe("a ok");
32
- // Assign ok to Result
33
- const c = a;
34
- });
35
- it("unwraps", () => {
36
- const a = Some("some");
37
- const b = None();
38
- const c = Ok("ok");
39
- const d = Err(new Error("err"));
40
- const e = "else";
41
- expect(unwrap(a)).toBe("some");
42
- expect(unwrap(c)).toBe("ok");
43
- expect(() => unwrap(b)).toThrow("Attempted to unwrap None");
44
- expect(() => unwrap(d)).toThrow("err");
45
- expect(unwrap(e)).toBe("else");
46
- });
47
- it("unwrapsOrs", () => {
48
- const a = Some("some");
49
- const b = None();
50
- const c = Ok("ok");
51
- const d = Err(new Error("err"));
52
- const e = "else";
53
- expect(unwrapOr(a, "z")).toBe("some");
54
- expect(unwrapOr(c, "z")).toBe("ok");
55
- expect(unwrapOr(b, "z")).toBe("z");
56
- expect(unwrapOr(d, "z")).toBe("z");
57
- expect(unwrapOr(e, "z")).toBe("else");
58
- });
59
- it("unwrapsOrElse", () => {
60
- const a = Some("some");
61
- const b = None();
62
- const c = Ok("ok");
63
- const d = Err(new Error("err"));
64
- const e = "else";
65
- expect(unwrapOrElse(a, () => "z")).toBe("some");
66
- expect(unwrapOrElse(c, () => "z")).toBe("ok");
67
- expect(unwrapOrElse(b, () => "z")).toBe("z");
68
- expect(unwrapOrElse(d, () => "z")).toBe("z");
69
- expect(unwrapOrElse(e, () => "z")).toBe("else");
70
- });
71
- });
1
+ import { Err, None, Ok, Some, unwrap, unwrapOr, unwrapOrElse, } from "./result.js";
2
+ import { describe, it } from "./scope/describe.js";
3
+ import { expect } from "./scope/expect.js";
4
+ describe("Result", () => {
5
+ it("converts Nones", () => {
6
+ const a = None();
7
+ expect(a).toBeNull();
8
+ const b = None();
9
+ expect(b).toBeNull();
10
+ const c = Some(a);
11
+ expect(c).toBeNull();
12
+ const d = Some(b);
13
+ expect(d).toBeNull();
14
+ });
15
+ it("converts Somes", () => {
16
+ const a = Some("a");
17
+ expect(a).toBe("a");
18
+ const b = Some(a);
19
+ expect(b).toBe("a");
20
+ });
21
+ it("converts Errs", () => {
22
+ const a = Err(new Error("a error"));
23
+ const b = Err(a);
24
+ expect(b).toMatchObject({ message: "a error" });
25
+ // Assign Err to Result
26
+ const c = a;
27
+ });
28
+ it("converts Oks", () => {
29
+ const a = Ok("a ok");
30
+ const b = Ok(a);
31
+ expect(b).toBe("a ok");
32
+ // Assign ok to Result
33
+ const c = a;
34
+ });
35
+ it("unwraps", () => {
36
+ const a = Some("some");
37
+ const b = None();
38
+ const c = Ok("ok");
39
+ const d = Err(new Error("err"));
40
+ const e = "else";
41
+ expect(unwrap(a)).toBe("some");
42
+ expect(unwrap(c)).toBe("ok");
43
+ expect(() => unwrap(b)).toThrow("Attempted to unwrap None");
44
+ expect(() => unwrap(d)).toThrow("err");
45
+ expect(unwrap(e)).toBe("else");
46
+ });
47
+ it("unwrapsOrs", () => {
48
+ const a = Some("some");
49
+ const b = None();
50
+ const c = Ok("ok");
51
+ const d = Err(new Error("err"));
52
+ const e = "else";
53
+ expect(unwrapOr(a, "z")).toBe("some");
54
+ expect(unwrapOr(c, "z")).toBe("ok");
55
+ expect(unwrapOr(b, "z")).toBe("z");
56
+ expect(unwrapOr(d, "z")).toBe("z");
57
+ expect(unwrapOr(e, "z")).toBe("else");
58
+ });
59
+ it("unwrapsOrElse", () => {
60
+ const a = Some("some");
61
+ const b = None();
62
+ const c = Ok("ok");
63
+ const d = Err(new Error("err"));
64
+ const e = "else";
65
+ expect(unwrapOrElse(a, () => "z")).toBe("some");
66
+ expect(unwrapOrElse(c, () => "z")).toBe("ok");
67
+ expect(unwrapOrElse(b, () => "z")).toBe("z");
68
+ expect(unwrapOrElse(d, () => "z")).toBe("z");
69
+ expect(unwrapOrElse(e, () => "z")).toBe("else");
70
+ });
71
+ });
@@ -0,0 +1 @@
1
+ export declare const safe: <A extends unknown[], R>(fn: (...args: A) => R, r: R) => (...args: A) => R;
@@ -1,10 +1,10 @@
1
- import { error } from "./log.js";
2
- export const safe = (fn, r) => (...args) => {
3
- try {
4
- return fn(...args);
5
- }
6
- catch (e) {
7
- error(`${e}`);
8
- return r;
9
- }
10
- };
1
+ import { error } from "./log.js";
2
+ export const safe = (fn, r) => (...args) => {
3
+ try {
4
+ return fn(...args);
5
+ }
6
+ catch (e) {
7
+ error(`${e}`);
8
+ return r;
9
+ }
10
+ };
@@ -0,0 +1,18 @@
1
+ import { TestCase } from "./scope.js";
2
+ export declare const beforeall: unique symbol;
3
+ export declare const beforeeach: unique symbol;
4
+ export declare const afterall: unique symbol;
5
+ export declare const aftereach: unique symbol;
6
+ export declare function rootCases(): TestCase;
7
+ export declare function getTotalCases(): number;
8
+ export declare function getSkippedCases(): number;
9
+ export declare function describe(title: string, block: Function): void;
10
+ export declare function it(title: string, block: Function): void;
11
+ export declare namespace it {
12
+ var skip: (title: string, _block: Function) => void;
13
+ }
14
+ export declare function beforeEach(fn: () => void): void;
15
+ export declare function beforeAll(fn: () => void): void;
16
+ export declare function afterEach(fn: () => void): void;
17
+ export declare function afterAll(fn: () => void): void;
18
+ export declare function cleanState<State extends {}>(init: () => State, runner?: (action: () => void) => void): State;
@@ -1,61 +1,60 @@
1
- import { getLogger } from "../log.js";
2
- export const beforeall = Symbol("beforeAll");
3
- export const beforeeach = Symbol("beforeEach");
4
- export const afterall = Symbol("afterAll");
5
- export const aftereach = Symbol("afterEach");
6
- const logger = getLogger("scope");
7
- const CASES = {};
8
- let cases = [CASES];
9
- let totalCases = 0;
10
- let skippedCases = 0;
11
- function push(title) {
12
- const next = (cases[0][title] = {});
13
- cases.unshift(next);
14
- }
15
- function pop() {
16
- cases.shift();
17
- }
18
- export function rootCases() {
19
- return CASES;
20
- }
21
- export function getTotalCases() {
22
- return totalCases;
23
- }
24
- export function getSkippedCases() {
25
- return skippedCases;
26
- }
27
- export function describe(title, block) {
28
- logger.debug(`describe(${title})`);
29
- push(title);
30
- block();
31
- pop();
32
- }
33
- export function it(title, block) {
34
- logger.debug(`it(${title})`);
35
- totalCases += 1;
36
- cases[0][title] = block;
37
- }
38
- it.skip = (title, _block) => {
39
- logger.debug(`it.skip(${title})`);
40
- totalCases += 1;
41
- skippedCases += 1;
42
- };
43
- export function beforeEach(fn) {
44
- cases[0][beforeeach] = fn;
45
- }
46
- export function beforeAll(fn) {
47
- cases[0][beforeall] = fn;
48
- }
49
- export function afterEach(fn) {
50
- cases[0][aftereach] = fn;
51
- }
52
- export function afterAll(fn) {
53
- cases[0][afterall] = fn;
54
- }
55
- export function cleanState(init, runner = beforeEach) {
56
- const state = {};
57
- runner(() => {
58
- Object.assign(state, init());
59
- });
60
- return state;
61
- }
1
+ import { assert } from "../assert.js";
2
+ import { getLogger } from "../log.js";
3
+ import * as state from "./state.js";
4
+ export const beforeall = Symbol("beforeAll");
5
+ export const beforeeach = Symbol("beforeEach");
6
+ export const afterall = Symbol("afterAll");
7
+ export const aftereach = Symbol("afterEach");
8
+ const logger = getLogger("scope");
9
+ const CASES = {};
10
+ let cases = [CASES];
11
+ let totalCases = 0;
12
+ let skippedCases = 0;
13
+ function push(title) {
14
+ const next = (cases[0][title] = cases[0][title] ?? {});
15
+ cases.unshift(next);
16
+ }
17
+ function pop() {
18
+ cases.shift();
19
+ }
20
+ export function rootCases() {
21
+ return CASES;
22
+ }
23
+ export function getTotalCases() {
24
+ return totalCases;
25
+ }
26
+ export function getSkippedCases() {
27
+ return skippedCases;
28
+ }
29
+ export function describe(title, block) {
30
+ logger.debug(`describe(${title})`);
31
+ push(title);
32
+ block();
33
+ pop();
34
+ }
35
+ export function it(title, block) {
36
+ logger.debug(`it(${title})`);
37
+ assert(cases[0][title] == undefined, `Block already has test ${title}`);
38
+ totalCases += 1;
39
+ cases[0][title] = block;
40
+ }
41
+ it.skip = (title, _block) => {
42
+ logger.debug(`it.skip(${title})`);
43
+ totalCases += 1;
44
+ skippedCases += 1;
45
+ };
46
+ export function beforeEach(fn) {
47
+ cases[0][beforeeach] = fn;
48
+ }
49
+ export function beforeAll(fn) {
50
+ cases[0][beforeall] = fn;
51
+ }
52
+ export function afterEach(fn) {
53
+ cases[0][aftereach] = fn;
54
+ }
55
+ export function afterAll(fn) {
56
+ cases[0][afterall] = fn;
57
+ }
58
+ export function cleanState(init, runner = beforeEach) {
59
+ return state.cleanState(init, runner);
60
+ }
@@ -0,0 +1,2 @@
1
+ import { TestResult } from "../scope.js";
2
+ export declare function onConsole(results: TestResult): void;
@@ -1,21 +1,21 @@
1
- import { getLogger } from "../../log.js";
2
- import { getTotalCases } from "../describe.js";
3
- import { flattenResults } from "../execute.js";
4
- const logger = getLogger("Scope Test Runner");
5
- export function onConsole(results) {
6
- const { executed, failed } = results;
7
- logger.info("Executed test suite.", {
8
- executed,
9
- total: getTotalCases(),
10
- failed,
11
- });
12
- const flat = flattenResults(results);
13
- for (const { test } of flat) {
14
- logger.debug(test);
15
- }
16
- for (const { test, stack } of flat) {
17
- if (stack) {
18
- logger.error(test, { stack });
19
- }
20
- }
21
- }
1
+ import { getLogger } from "../../log.js";
2
+ import { getTotalCases } from "../describe.js";
3
+ import { flattenResults } from "../execute.js";
4
+ const logger = getLogger("Scope Test Runner");
5
+ export function onConsole(results) {
6
+ const { executed, failed } = results;
7
+ logger.info("Executed test suite.", {
8
+ executed,
9
+ total: getTotalCases(),
10
+ failed,
11
+ });
12
+ const flat = flattenResults(results);
13
+ for (const { test } of flat) {
14
+ logger.debug(test);
15
+ }
16
+ for (const { test, stack } of flat) {
17
+ if (stack) {
18
+ logger.error(test, { stack });
19
+ }
20
+ }
21
+ }
@@ -0,0 +1,3 @@
1
+ import { DOMElement } from "../../dom/dom.js";
2
+ import { TestResult } from "../scope.js";
3
+ export declare function displayStatistics(results: TestResult, root?: DOMElement): void;
@@ -1,26 +1,26 @@
1
- import { isHTMLLogger, makeHTMLLogger } from "../../components/logger.js";
2
- import { DEFAULT_LOGGER, LEVEL } from "../../log.js";
3
- import { getTotalCases } from "../describe.js";
4
- import { flattenResults } from "../execute.js";
5
- export function displayStatistics(results, root = document.body) {
6
- const { executed, failed } = results;
7
- const logger = (() => {
8
- try {
9
- return makeHTMLLogger(`Executed ${executed} of ${getTotalCases()}; ${failed} failed.`);
10
- }
11
- catch (e) {
12
- return DEFAULT_LOGGER;
13
- }
14
- })();
15
- logger.level = LEVEL.DEBUG;
16
- const flat = flattenResults(results);
17
- for (const { test, stack } of flat) {
18
- if (stack) {
19
- logger.info(test);
20
- logger.debug(`${stack}`);
21
- }
22
- }
23
- if (isHTMLLogger(logger)) {
24
- root.appendChild(logger.root);
25
- }
26
- }
1
+ import { isHTMLLogger, makeHTMLLogger } from "../../components/logger.js";
2
+ import { DEFAULT_LOGGER, LEVEL } from "../../log.js";
3
+ import { getTotalCases } from "../describe.js";
4
+ import { flattenResults } from "../execute.js";
5
+ export function displayStatistics(results, root = document.body) {
6
+ const { executed, failed } = results;
7
+ const logger = (() => {
8
+ try {
9
+ return makeHTMLLogger(`Executed ${executed} of ${getTotalCases()}; ${failed} failed.`);
10
+ }
11
+ catch (e) {
12
+ return DEFAULT_LOGGER;
13
+ }
14
+ })();
15
+ logger.level = LEVEL.DEBUG;
16
+ const flat = flattenResults(results);
17
+ for (const { test, stack } of flat) {
18
+ if (stack) {
19
+ logger.info(test);
20
+ logger.debug(`${stack}`);
21
+ }
22
+ }
23
+ if (isHTMLLogger(logger)) {
24
+ root.appendChild(logger.root);
25
+ }
26
+ }
@@ -0,0 +1,2 @@
1
+ import { TestResult } from "../scope.js";
2
+ export declare function asXML(results: TestResult): string;
@@ -1,17 +1,17 @@
1
- import { xml } from "../../dom/xml.js";
2
- import { flattenResults } from "../execute.js";
3
- const cases = (results) => Object.entries(results).filter(([key]) => !["executed", "passed", "failed"].includes(key));
4
- export function asXML(results) {
5
- return (`<?xml version="1.0" encoding="UTF-8" ?>` +
6
- xml("testsuites", { tests: results.executed, failures: results.failed }, cases(results).map(([title, children]) => testsuite(title, children.executed, children.failed, flattenResults(children)))));
7
- }
8
- function testsuite(name, tests, failures, cases) {
9
- const id = name.replace("s+", "_");
10
- return xml("testsuite", { id, name, tests, failures }, cases.map(({ test, stack }) => testcase({ name: `${name} ${test}` }, stack ? [stack] : [])));
11
- }
12
- function testcase({ name, id = name.replace(/\s+/g, "_"), time = "0.00", }, failures) {
13
- return xml("testcase", { id, name, time }, failures.map((stack) => failure({ text: stack })));
14
- }
15
- function failure({ text, message = text.split("\n")[0], }) {
16
- return xml("failure", { message }, [`<![CDATA[${text}]]>`]);
17
- }
1
+ import { xml } from "../../dom/xml.js";
2
+ import { flattenResults } from "../execute.js";
3
+ const cases = (results) => Object.entries(results).filter(([key]) => !["executed", "passed", "failed"].includes(key));
4
+ export function asXML(results) {
5
+ return (`<?xml version="1.0" encoding="UTF-8" ?>` +
6
+ xml("testsuites", { tests: results.executed, failures: results.failed }, cases(results).map(([title, children]) => testsuite(title, children.executed, children.failed, flattenResults(children)))));
7
+ }
8
+ function testsuite(name, tests, failures, cases) {
9
+ const id = name.replace("s+", "_");
10
+ return xml("testsuite", { id, name, tests, failures }, cases.map(({ test, stack }) => testcase({ name: `${name} ${test}` }, stack ? [stack] : [])));
11
+ }
12
+ function testcase({ name, id = name.replace(/\s+/g, "_"), time = "0.00", }, failures) {
13
+ return xml("testcase", { id, name, time }, failures.map((stack) => failure({ text: stack })));
14
+ }
15
+ function failure({ text, message = text.split("\n")[0], }) {
16
+ return xml("failure", { message }, [`<![CDATA[${text}]]>`]);
17
+ }
@@ -0,0 +1,12 @@
1
+ import { TestResult, TestSummary } from "./scope.js";
2
+ export declare function execute(cases?: import("./scope.js").TestCase): Promise<TestResult>;
3
+ export declare function getError({ error }: TestResult): number | TestResult | TestSummary | "unknown error";
4
+ export interface FlatResult {
5
+ test: string;
6
+ stack?: string | number | TestResult | TestSummary;
7
+ stats: {
8
+ executed: number;
9
+ failed: number;
10
+ };
11
+ }
12
+ export declare function flattenResults(results: TestResult, prefix?: string): FlatResult[];