@davidsouther/jiffies 1.0.0-beta.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (447) hide show
  1. package/{build → lib/cjs}/assert.d.ts +0 -0
  2. package/lib/cjs/assert.js +40 -0
  3. package/{build → lib/cjs}/case.d.ts +0 -0
  4. package/lib/cjs/case.js +9 -0
  5. package/{build → lib/cjs}/components/button_bar.d.ts +1 -1
  6. package/lib/cjs/components/button_bar.js +29 -0
  7. package/{build → lib/cjs}/components/inline_edit.d.ts +1 -1
  8. package/lib/cjs/components/inline_edit.js +51 -0
  9. package/{build → lib/cjs}/components/logger.d.ts +2 -3
  10. package/lib/cjs/components/logger.js +27 -0
  11. package/lib/cjs/components/select.d.ts +10 -0
  12. package/lib/cjs/components/select.js +6 -0
  13. package/lib/cjs/components/test.d.ts +1 -0
  14. package/lib/cjs/components/test.js +7 -0
  15. package/{build → lib/cjs}/components/virtual_scroll.d.ts +3 -4
  16. package/lib/cjs/components/virtual_scroll.js +102 -0
  17. package/{build → lib/cjs}/components/virtual_scroll.test.d.ts +0 -0
  18. package/lib/cjs/components/virtual_scroll.test.js +22 -0
  19. package/{build → lib/cjs}/context.d.ts +0 -0
  20. package/lib/cjs/context.js +48 -0
  21. package/{build → lib/cjs}/context.test.d.ts +0 -0
  22. package/lib/cjs/context.test.js +48 -0
  23. package/{build → lib/cjs}/debounce.d.ts +0 -0
  24. package/lib/cjs/debounce.js +11 -0
  25. package/lib/cjs/diff.d.ts +15 -0
  26. package/lib/cjs/diff.js +58 -0
  27. package/{build/components/index.d.ts → lib/cjs/diff.test.d.ts} +0 -0
  28. package/lib/cjs/diff.test.js +41 -0
  29. package/{build → lib/cjs}/display.d.ts +0 -0
  30. package/lib/cjs/display.js +16 -0
  31. package/{build → lib/cjs}/dom/css/border.d.ts +0 -0
  32. package/lib/cjs/dom/css/border.js +33 -0
  33. package/{build → lib/cjs}/dom/css/constants.d.ts +0 -0
  34. package/lib/cjs/dom/css/constants.js +31 -0
  35. package/{build → lib/cjs}/dom/css/core.d.ts +0 -0
  36. package/lib/cjs/dom/css/core.js +31 -0
  37. package/{build → lib/cjs}/dom/css/fstyle.d.ts +0 -0
  38. package/lib/cjs/dom/css/fstyle.js +36 -0
  39. package/{build → lib/cjs}/dom/css/sizing.d.ts +0 -0
  40. package/lib/cjs/dom/css/sizing.js +14 -0
  41. package/lib/cjs/dom/dom.d.ts +27 -0
  42. package/lib/cjs/dom/dom.js +110 -0
  43. package/{build → lib/cjs}/dom/fc.d.ts +5 -5
  44. package/lib/cjs/dom/fc.js +39 -0
  45. package/{build → lib/cjs}/dom/fc.test.d.ts +0 -0
  46. package/lib/cjs/dom/fc.test.js +23 -0
  47. package/lib/cjs/dom/form/form.app.d.ts +1 -0
  48. package/lib/cjs/dom/form/form.app.js +27 -0
  49. package/lib/cjs/dom/form/form.d.ts +26 -0
  50. package/lib/cjs/dom/form/form.js +49 -0
  51. package/{build → lib/cjs}/dom/form/form.test.d.ts +0 -0
  52. package/{build → lib/cjs}/dom/form/form.test.js +0 -0
  53. package/lib/cjs/dom/html.d.ts +113 -0
  54. package/lib/cjs/dom/html.js +119 -0
  55. package/{build → lib/cjs}/dom/html.test.d.ts +0 -0
  56. package/lib/cjs/dom/html.test.js +60 -0
  57. package/lib/cjs/dom/observable.d.ts +2 -0
  58. package/lib/cjs/dom/observable.js +10 -0
  59. package/{build/components/index.js → lib/cjs/dom/observable.test.d.ts} +0 -0
  60. package/lib/cjs/dom/observable.test.js +35 -0
  61. package/lib/cjs/dom/provide.d.ts +3 -0
  62. package/lib/cjs/dom/provide.js +12 -0
  63. package/lib/cjs/dom/router/link.d.ts +6 -0
  64. package/lib/cjs/dom/router/link.js +7 -0
  65. package/{build → lib/cjs}/dom/router/router.d.ts +3 -3
  66. package/lib/cjs/dom/router/router.js +52 -0
  67. package/lib/cjs/dom/svg.d.ts +64 -0
  68. package/lib/cjs/dom/svg.js +69 -0
  69. package/lib/cjs/dom/test.d.ts +1 -0
  70. package/lib/cjs/dom/test.js +13 -0
  71. package/{build → lib/cjs}/dom/types/css.d.ts +0 -0
  72. package/lib/cjs/dom/types/css.js +24 -0
  73. package/{build → lib/cjs}/dom/types/dom.d.ts +0 -0
  74. package/{build → lib/cjs}/dom/types/dom.js +0 -0
  75. package/{build → lib/cjs}/dom/types/html.d.ts +1 -1
  76. package/lib/cjs/dom/types/html.js +2 -0
  77. package/{build → lib/cjs}/dom/xml.d.ts +0 -0
  78. package/lib/cjs/dom/xml.js +8 -0
  79. package/lib/cjs/equal.d.ts +5 -0
  80. package/lib/cjs/equal.js +43 -0
  81. package/{build → lib/cjs}/equal.test.d.ts +0 -0
  82. package/lib/cjs/equal.test.js +22 -0
  83. package/{build → lib/cjs}/flags.d.ts +0 -0
  84. package/lib/cjs/flags.js +52 -0
  85. package/{build → lib/cjs}/flags.test.d.ts +0 -0
  86. package/lib/cjs/flags.test.js +37 -0
  87. package/lib/cjs/fs.d.ts +48 -0
  88. package/lib/cjs/fs.js +151 -0
  89. package/{build/components/test.d.ts → lib/cjs/fs.test.d.ts} +0 -0
  90. package/lib/cjs/fs.test.js +45 -0
  91. package/{build → lib/cjs}/generator.d.ts +0 -0
  92. package/lib/cjs/generator.js +14 -0
  93. package/{build → lib/cjs}/generator.test.d.ts +0 -0
  94. package/lib/cjs/generator.test.js +26 -0
  95. package/{build → lib/cjs}/is_browser.d.ts +0 -0
  96. package/lib/cjs/is_browser.js +4 -0
  97. package/{build → lib/cjs}/loader.d.mts +0 -0
  98. package/lib/cjs/loader.mjs +40 -0
  99. package/{build → lib/cjs}/lock.d.ts +0 -0
  100. package/lib/cjs/lock.js +27 -0
  101. package/{build → lib/cjs}/lock.test.d.ts +0 -0
  102. package/lib/cjs/lock.test.js +18 -0
  103. package/{build → lib/cjs}/log.d.ts +0 -0
  104. package/lib/cjs/log.js +54 -0
  105. package/lib/cjs/observable/event.d.ts +35 -0
  106. package/lib/cjs/observable/event.js +61 -0
  107. package/lib/cjs/observable/observable.d.ts +132 -0
  108. package/lib/cjs/observable/observable.js +363 -0
  109. package/{build/dom/test.d.ts → lib/cjs/observable/observable.test.d.ts} +0 -0
  110. package/lib/cjs/observable/observable.test.js +65 -0
  111. package/{build → lib/cjs}/range.d.ts +0 -0
  112. package/lib/cjs/range.js +11 -0
  113. package/{build → lib/cjs}/result.d.ts +11 -11
  114. package/lib/cjs/result.js +80 -0
  115. package/{build → lib/cjs}/result.test.d.ts +0 -0
  116. package/lib/cjs/result.test.js +73 -0
  117. package/{build → lib/cjs}/safe.d.ts +0 -0
  118. package/lib/cjs/safe.js +14 -0
  119. package/{build → lib/cjs}/scope/describe.d.ts +4 -0
  120. package/lib/cjs/scope/describe.js +73 -0
  121. package/{build → lib/cjs}/scope/display/console.d.ts +0 -0
  122. package/lib/cjs/scope/display/console.js +25 -0
  123. package/{build → lib/cjs}/scope/display/dom.d.ts +2 -2
  124. package/lib/cjs/scope/display/dom.js +30 -0
  125. package/{build → lib/cjs}/scope/display/junit.d.ts +0 -0
  126. package/lib/cjs/scope/display/junit.js +21 -0
  127. package/{build → lib/cjs}/scope/execute.d.ts +1 -1
  128. package/lib/cjs/scope/execute.js +91 -0
  129. package/{build → lib/cjs}/scope/expect.d.ts +1 -1
  130. package/lib/cjs/scope/expect.js +114 -0
  131. package/{build → lib/cjs}/scope/fix.d.ts +0 -0
  132. package/lib/cjs/scope/fix.js +26 -0
  133. package/{build → lib/cjs}/scope/index.d.ts +0 -0
  134. package/lib/cjs/scope/index.js +15 -0
  135. package/{build → lib/cjs}/scope/scope.d.ts +0 -0
  136. package/lib/cjs/scope/scope.js +2 -0
  137. package/lib/cjs/scope/state.d.ts +1 -0
  138. package/lib/cjs/scope/state.js +11 -0
  139. package/{build → lib/cjs}/server/http/apps.d.ts +0 -0
  140. package/lib/cjs/server/http/apps.js +27 -0
  141. package/lib/cjs/server/http/css.d.ts +5 -0
  142. package/lib/cjs/server/http/css.js +54 -0
  143. package/{build → lib/cjs}/server/http/index.d.ts +0 -0
  144. package/lib/cjs/server/http/index.js +77 -0
  145. package/{build → lib/cjs}/server/http/response.d.ts +0 -0
  146. package/lib/cjs/server/http/response.js +45 -0
  147. package/{build → lib/cjs}/server/http/sitemap.d.ts +0 -0
  148. package/lib/cjs/server/http/sitemap.js +46 -0
  149. package/{build → lib/cjs}/server/http/static.d.ts +0 -0
  150. package/lib/cjs/server/http/static.js +25 -0
  151. package/{build → lib/cjs}/server/http/typescript.d.ts +0 -0
  152. package/lib/cjs/server/http/typescript.js +44 -0
  153. package/{build → lib/cjs}/server/main.d.ts +0 -0
  154. package/lib/cjs/server/main.js +14 -0
  155. package/{build → lib/cjs}/test.d.mts +0 -0
  156. package/lib/cjs/test.mjs +28 -0
  157. package/lib/cjs/test_all.d.ts +9 -0
  158. package/lib/cjs/test_all.js +30 -0
  159. package/{build → lib/cjs}/transpile.d.mts +0 -0
  160. package/lib/cjs/transpile.mjs +22 -0
  161. package/lib/cjs/tsconfig.tsbuildinfo +1 -0
  162. package/lib/esm/assert.d.ts +23 -0
  163. package/{build → lib/esm}/assert.js +1 -1
  164. package/lib/esm/case.d.ts +1 -0
  165. package/{build → lib/esm}/case.js +0 -0
  166. package/lib/esm/components/button_bar.d.ts +8 -0
  167. package/lib/esm/components/button_bar.js +27 -0
  168. package/lib/esm/components/inline_edit.d.ts +12 -0
  169. package/{build → lib/esm}/components/inline_edit.js +3 -3
  170. package/lib/esm/components/logger.d.ts +6 -0
  171. package/{build → lib/esm}/components/logger.js +3 -3
  172. package/lib/esm/components/select.d.ts +10 -0
  173. package/{build → lib/esm}/components/select.js +2 -2
  174. package/lib/esm/components/test.d.ts +1 -0
  175. package/lib/esm/components/test.js +3 -0
  176. package/lib/esm/components/virtual_scroll.d.ts +40 -0
  177. package/{build → lib/esm}/components/virtual_scroll.js +3 -3
  178. package/{build/dom/types/html.js → lib/esm/components/virtual_scroll.test.d.ts} +0 -0
  179. package/{build → lib/esm}/components/virtual_scroll.test.js +3 -4
  180. package/lib/esm/context.d.ts +15 -0
  181. package/{build → lib/esm}/context.js +3 -3
  182. package/{build/scope/scope.js → lib/esm/context.test.d.ts} +0 -0
  183. package/{build → lib/esm}/context.test.js +0 -0
  184. package/lib/esm/debounce.d.ts +1 -0
  185. package/{build → lib/esm}/debounce.js +0 -0
  186. package/lib/esm/diff.d.ts +15 -0
  187. package/lib/esm/diff.js +54 -0
  188. package/{build/test_all.d.ts → lib/esm/diff.test.d.ts} +0 -0
  189. package/lib/esm/diff.test.js +39 -0
  190. package/lib/esm/display.d.ts +5 -0
  191. package/lib/esm/display.js +11 -0
  192. package/lib/esm/dom/css/border.d.ts +11 -0
  193. package/{build → lib/esm}/dom/css/border.js +0 -0
  194. package/lib/esm/dom/css/constants.d.ts +31 -0
  195. package/{build → lib/esm}/dom/css/constants.js +0 -0
  196. package/lib/esm/dom/css/core.d.ts +5 -0
  197. package/{build → lib/esm}/dom/css/core.js +0 -0
  198. package/lib/esm/dom/css/fstyle.d.ts +5 -0
  199. package/{build → lib/esm}/dom/css/fstyle.js +0 -0
  200. package/lib/esm/dom/css/sizing.d.ts +5 -0
  201. package/{build → lib/esm}/dom/css/sizing.js +0 -0
  202. package/lib/esm/dom/dom.d.ts +27 -0
  203. package/{build → lib/esm}/dom/dom.js +44 -34
  204. package/lib/esm/dom/fc.d.ts +14 -0
  205. package/{build → lib/esm}/dom/fc.js +1 -1
  206. package/lib/esm/dom/fc.test.d.ts +1 -0
  207. package/{build → lib/esm}/dom/fc.test.js +0 -0
  208. package/lib/esm/dom/form/form.app.d.ts +1 -0
  209. package/{build → lib/esm}/dom/form/form.app.js +0 -0
  210. package/lib/esm/dom/form/form.d.ts +26 -0
  211. package/{build → lib/esm}/dom/form/form.js +14 -5
  212. package/lib/esm/dom/form/form.test.d.ts +0 -0
  213. package/lib/esm/dom/form/form.test.js +1 -0
  214. package/lib/esm/dom/html.d.ts +113 -0
  215. package/{build → lib/esm}/dom/html.js +0 -0
  216. package/lib/esm/dom/html.test.d.ts +1 -0
  217. package/{build → lib/esm}/dom/html.test.js +4 -4
  218. package/lib/esm/dom/observable.d.ts +2 -0
  219. package/lib/esm/dom/observable.js +6 -0
  220. package/lib/esm/dom/observable.test.d.ts +1 -0
  221. package/lib/esm/dom/observable.test.js +33 -0
  222. package/lib/esm/dom/provide.d.ts +3 -0
  223. package/lib/esm/dom/provide.js +7 -0
  224. package/lib/esm/dom/router/link.d.ts +6 -0
  225. package/{build → lib/esm}/dom/router/link.js +0 -0
  226. package/lib/esm/dom/router/router.d.ts +12 -0
  227. package/{build → lib/esm}/dom/router/router.js +0 -0
  228. package/lib/esm/dom/svg.d.ts +64 -0
  229. package/{build → lib/esm}/dom/svg.js +0 -0
  230. package/lib/esm/dom/test.d.ts +1 -0
  231. package/lib/esm/dom/test.js +9 -0
  232. package/lib/esm/dom/types/css.d.ts +6612 -0
  233. package/{build → lib/esm}/dom/types/css.js +0 -0
  234. package/lib/esm/dom/types/dom.d.ts +0 -0
  235. package/lib/esm/dom/types/dom.js +1 -0
  236. package/lib/esm/dom/types/html.d.ts +616 -0
  237. package/lib/esm/dom/types/html.js +1 -0
  238. package/lib/esm/dom/xml.d.ts +1 -0
  239. package/{build → lib/esm}/dom/xml.js +1 -2
  240. package/lib/esm/equal.d.ts +5 -0
  241. package/lib/esm/equal.js +37 -0
  242. package/lib/esm/equal.test.d.ts +1 -0
  243. package/{build → lib/esm}/equal.test.js +0 -0
  244. package/lib/esm/flags.d.ts +7 -0
  245. package/{build → lib/esm}/flags.js +1 -1
  246. package/lib/esm/flags.test.d.ts +1 -0
  247. package/{build → lib/esm}/flags.test.js +0 -0
  248. package/lib/esm/fs.d.ts +48 -0
  249. package/lib/esm/fs.js +144 -0
  250. package/lib/esm/fs.test.d.ts +1 -0
  251. package/lib/esm/fs.test.js +43 -0
  252. package/lib/esm/generator.d.ts +1 -0
  253. package/{build → lib/esm}/generator.js +0 -0
  254. package/lib/esm/generator.test.d.ts +1 -0
  255. package/{build → lib/esm}/generator.test.js +0 -0
  256. package/lib/esm/is_browser.d.ts +1 -0
  257. package/{build → lib/esm}/is_browser.js +0 -0
  258. package/lib/esm/loader.d.mts +22 -0
  259. package/{build → lib/esm}/loader.mjs +0 -0
  260. package/lib/esm/lock.d.ts +1 -0
  261. package/{build → lib/esm}/lock.js +0 -0
  262. package/lib/esm/lock.test.d.ts +1 -0
  263. package/{build → lib/esm}/lock.test.js +0 -0
  264. package/lib/esm/log.d.ts +26 -0
  265. package/{build → lib/esm}/log.js +16 -4
  266. package/lib/esm/observable/event.d.ts +35 -0
  267. package/lib/esm/observable/event.js +46 -0
  268. package/lib/esm/observable/observable.d.ts +132 -0
  269. package/lib/esm/observable/observable.js +343 -0
  270. package/lib/esm/observable/observable.test.d.ts +1 -0
  271. package/lib/esm/observable/observable.test.js +63 -0
  272. package/lib/esm/range.d.ts +1 -0
  273. package/{build → lib/esm}/range.js +0 -0
  274. package/lib/esm/result.d.ts +31 -0
  275. package/{build → lib/esm}/result.js +3 -3
  276. package/lib/esm/result.test.d.ts +1 -0
  277. package/{build → lib/esm}/result.test.js +0 -0
  278. package/lib/esm/safe.d.ts +1 -0
  279. package/{build → lib/esm}/safe.js +0 -0
  280. package/lib/esm/scope/describe.d.ts +18 -0
  281. package/{build → lib/esm}/scope/describe.js +14 -6
  282. package/lib/esm/scope/display/console.d.ts +2 -0
  283. package/{build → lib/esm}/scope/display/console.js +0 -0
  284. package/lib/esm/scope/display/dom.d.ts +3 -0
  285. package/{build → lib/esm}/scope/display/dom.js +0 -0
  286. package/lib/esm/scope/display/junit.d.ts +2 -0
  287. package/{build → lib/esm}/scope/display/junit.js +0 -0
  288. package/lib/esm/scope/execute.d.ts +12 -0
  289. package/{build → lib/esm}/scope/execute.js +3 -3
  290. package/lib/esm/scope/expect.d.ts +23 -0
  291. package/{build → lib/esm}/scope/expect.js +4 -3
  292. package/lib/esm/scope/fix.d.ts +4 -0
  293. package/{build → lib/esm}/scope/fix.js +0 -0
  294. package/{build/scope/index.js → lib/esm/scope/index.d.ts} +0 -0
  295. package/lib/esm/scope/index.js +3 -0
  296. package/lib/esm/scope/scope.d.ts +17 -0
  297. package/lib/esm/scope/scope.js +1 -0
  298. package/lib/esm/scope/state.d.ts +1 -0
  299. package/lib/esm/scope/state.js +7 -0
  300. package/lib/esm/server/http/apps.d.ts +5 -0
  301. package/{build → lib/esm}/server/http/apps.js +0 -0
  302. package/lib/esm/server/http/css.d.ts +5 -0
  303. package/lib/esm/server/http/css.js +50 -0
  304. package/lib/esm/server/http/index.d.ts +21 -0
  305. package/{build → lib/esm}/server/http/index.js +4 -2
  306. package/lib/esm/server/http/response.d.ts +4 -0
  307. package/{build → lib/esm}/server/http/response.js +6 -3
  308. package/lib/esm/server/http/sitemap.d.ts +2 -0
  309. package/{build → lib/esm}/server/http/sitemap.js +0 -0
  310. package/lib/esm/server/http/static.d.ts +2 -0
  311. package/{build → lib/esm}/server/http/static.js +0 -0
  312. package/lib/esm/server/http/typescript.d.ts +5 -0
  313. package/{build → lib/esm}/server/http/typescript.js +0 -0
  314. package/lib/esm/server/main.d.ts +2 -0
  315. package/{build → lib/esm}/server/main.js +5 -2
  316. package/lib/esm/test.d.mts +2 -0
  317. package/lib/esm/test.mjs +26 -0
  318. package/lib/esm/test_all.d.ts +9 -0
  319. package/lib/esm/test_all.js +28 -0
  320. package/lib/esm/transpile.d.mts +3 -0
  321. package/{build → lib/esm}/transpile.mjs +0 -0
  322. package/lib/esm/tsconfig.tsbuildinfo +1 -0
  323. package/package.json +18 -16
  324. package/src/assert.ts +1 -1
  325. package/src/components/button_bar.ts +33 -27
  326. package/src/components/inline_edit.ts +3 -3
  327. package/src/components/logger.ts +5 -6
  328. package/src/components/select.ts +3 -3
  329. package/src/components/test.js +3 -2
  330. package/src/components/virtual_scroll.test.ts +4 -4
  331. package/src/components/virtual_scroll.ts +8 -8
  332. package/src/context.ts +3 -3
  333. package/src/diff.test.ts +48 -0
  334. package/src/diff.ts +84 -0
  335. package/src/display.ts +8 -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 +73 -60
  341. package/src/dom/fc.test.ts +3 -3
  342. package/src/dom/fc.ts +11 -10
  343. package/src/dom/form/form.app.ts +2 -2
  344. package/src/dom/form/form.ts +33 -10
  345. package/src/dom/html.test.ts +8 -8
  346. package/src/dom/html.ts +7 -10
  347. package/src/dom/observable.test.ts +43 -0
  348. package/src/dom/observable.ts +11 -0
  349. package/src/dom/provide.ts +11 -0
  350. package/src/dom/router/link.ts +2 -2
  351. package/src/dom/router/router.ts +5 -5
  352. package/src/dom/svg.ts +1 -1
  353. package/src/dom/test.ts +8 -2
  354. package/src/dom/types/html.ts +1 -1
  355. package/src/dom/xml.ts +1 -2
  356. package/src/equal.ts +22 -11
  357. package/src/flags.ts +1 -1
  358. package/src/fs.test.ts +53 -0
  359. package/src/fs.ts +180 -0
  360. package/src/index.html +16 -13
  361. package/src/log.ts +8 -4
  362. package/src/observable/_notes +21 -8
  363. package/src/observable/event.ts +93 -0
  364. package/src/observable/observable.test.ts +73 -0
  365. package/src/observable/observable.ts +463 -0
  366. package/src/pico/_variables.scss +66 -0
  367. package/src/pico/components/_accordion.scss +112 -0
  368. package/src/pico/components/_button-group.scss +51 -0
  369. package/src/pico/components/_card.scss +47 -0
  370. package/src/pico/components/_dropdown.scss +203 -0
  371. package/src/pico/components/_modal.scss +181 -0
  372. package/src/pico/components/_nav.scss +79 -0
  373. package/src/pico/components/_progress.scss +70 -0
  374. package/src/pico/components/_property.scss +34 -0
  375. package/src/pico/content/_button.scss +152 -0
  376. package/src/pico/content/_code.scss +63 -0
  377. package/src/pico/content/_embedded.scss +0 -0
  378. package/src/pico/content/_form-alt.scss +276 -0
  379. package/src/pico/content/_form.scss +259 -0
  380. package/src/pico/content/_misc.scss +0 -0
  381. package/src/pico/content/_table.scss +28 -0
  382. package/src/pico/content/_toggle.scss +132 -0
  383. package/src/pico/content/_typography.scss +232 -0
  384. package/src/pico/layout/_container.scss +40 -0
  385. package/src/pico/layout/_document.scss +0 -0
  386. package/src/pico/layout/_flex.scss +46 -0
  387. package/src/pico/layout/_grid.scss +24 -0
  388. package/src/pico/layout/_scroller.scss +16 -0
  389. package/src/pico/layout/_section.scss +8 -0
  390. package/src/pico/layout/_sectioning.scss +55 -0
  391. package/src/pico/pico.scss +60 -0
  392. package/src/pico/reset/_accessibility.scss +34 -0
  393. package/src/pico/reset/_button.scss +17 -0
  394. package/src/pico/reset/_code.scss +15 -0
  395. package/src/pico/reset/_document.scss +48 -0
  396. package/src/pico/reset/_embedded.scss +39 -0
  397. package/src/pico/reset/_form.scss +97 -0
  398. package/src/pico/reset/_misc.scss +23 -0
  399. package/src/pico/reset/_nav.scss +5 -0
  400. package/src/pico/reset/_progress.scss +4 -0
  401. package/src/pico/reset/_table.scss +8 -0
  402. package/src/pico/reset/_typography.scss +25 -0
  403. package/src/pico/themes/default/_colors.scss +65 -0
  404. package/src/pico/themes/default/_dark.scss +148 -0
  405. package/src/pico/themes/default/_light.scss +149 -0
  406. package/src/pico/themes/default/_styles.scss +272 -0
  407. package/src/pico/themes/default.scss +34 -0
  408. package/src/pico/utilities/_accessibility.scss +3 -0
  409. package/src/pico/utilities/_loading.scss +52 -0
  410. package/src/pico/utilities/_reduce-motion.scss +27 -0
  411. package/src/pico/utilities/_tooltip.scss +101 -0
  412. package/src/result.ts +17 -21
  413. package/src/scope/describe.ts +16 -6
  414. package/src/scope/display/console.ts +4 -4
  415. package/src/scope/display/dom.ts +7 -7
  416. package/src/scope/display/junit.ts +3 -3
  417. package/src/scope/execute.ts +5 -8
  418. package/src/scope/expect.ts +12 -11
  419. package/src/scope/state.ts +10 -0
  420. package/src/server/http/css.ts +65 -0
  421. package/src/server/http/index.ts +4 -2
  422. package/src/server/http/response.ts +7 -4
  423. package/src/server/http/sitemap.ts +1 -1
  424. package/src/server/main.ts +9 -2
  425. package/src/test.mjs +22 -18
  426. package/src/test_all.ts +20 -9
  427. package/src/zip/spec.txt +3260 -0
  428. package/build/components/button_bar.js +0 -16
  429. package/build/components/select.d.ts +0 -13
  430. package/build/components/test.js +0 -2
  431. package/build/display.js +0 -3
  432. package/build/dom/dom.d.ts +0 -27
  433. package/build/dom/form/form.app.d.ts +0 -1
  434. package/build/dom/form/form.d.ts +0 -25
  435. package/build/dom/html.d.ts +0 -117
  436. package/build/dom/router/link.d.ts +0 -6
  437. package/build/dom/svg.d.ts +0 -64
  438. package/build/dom/test.js +0 -2
  439. package/build/equal.d.ts +0 -4
  440. package/build/equal.js +0 -22
  441. package/build/index.d.ts +0 -13
  442. package/build/index.js +0 -13
  443. package/build/parcel_resolver.d.ts +0 -3
  444. package/build/parcel_resolver.js +0 -19
  445. package/build/test.mjs +0 -23
  446. package/build/test_all.js +0 -19
  447. package/src/observable/observable._js +0 -175
File without changes
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.checkExhaustive = exports.assertString = exports.assertExists = exports.assert = void 0;
4
+ /**
5
+ * Throw an error when a condition is not met.
6
+ */
7
+ function assert(condition, message = "Assertion failed") {
8
+ if (!condition) {
9
+ throw new Error(message instanceof Function ? message() : message);
10
+ }
11
+ }
12
+ exports.assert = assert;
13
+ /**
14
+ * Given a value, return it if it is not null nor undefined. Otherwise throw an
15
+ * error.
16
+ *
17
+ * @template T
18
+ * @returns {NonNullable<T>}
19
+ */
20
+ function assertExists(t, message = "Assertion failed: value does not exist") {
21
+ assert(t != null, message);
22
+ return t;
23
+ }
24
+ exports.assertExists = assertExists;
25
+ /**
26
+ * @param {*} n
27
+ * @returns string
28
+ */
29
+ function assertString(n, message = () => `Assertion failed: ${n} is not a string`) {
30
+ assert(typeof n === "string", message);
31
+ return n;
32
+ }
33
+ exports.assertString = assertString;
34
+ /**
35
+ * Compile time assertion that no value will used at this point in control flow.
36
+ */
37
+ function checkExhaustive(value, message = `Unexpected value ${value}`) {
38
+ throw new Error(message instanceof Function ? message() : message);
39
+ }
40
+ exports.checkExhaustive = checkExhaustive;
File without changes
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dashCase = void 0;
4
+ function dashCase(identifier) {
5
+ return identifier
6
+ .replace(/([a-z])([A-Z])/g, (_, a, b) => `${a}-${b.toLowerCase()}`)
7
+ .replace(/ ([A-Z])/g, (_, b) => `-${b.toLowerCase()}`);
8
+ }
9
+ exports.dashCase = dashCase;
@@ -1,4 +1,4 @@
1
- declare const ButtonBar: import("../dom/fc.js").FCComponentCtor<{
1
+ declare const ButtonBar: import("../dom/fc").FCComponentCtor<{
2
2
  value: T;
3
3
  values: T[];
4
4
  events: {
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const display_1 = require("../display");
4
+ const fc_1 = require("../dom/fc");
5
+ const html_1 = require("../dom/html");
6
+ let buttonBarId = 1;
7
+ let nextId = () => buttonBarId++;
8
+ const ButtonBar = (0, fc_1.FC)("button-bar", (el, { value, values, events }) => {
9
+ const name = `button-bar-${nextId()}`;
10
+ return (0, html_1.fieldset)({ class: "input-group" }, ...values
11
+ .map((option) => {
12
+ const opt = `${option}`.replace(/\s+/g, "_").toLowerCase();
13
+ const id = `${name}-${opt}`;
14
+ return [
15
+ (0, html_1.label)({ role: "button", htmlFor: id }, (0, html_1.input)({
16
+ type: "radio",
17
+ id,
18
+ name,
19
+ value: option,
20
+ checked: option === value,
21
+ events: {
22
+ change: () => events.onSelect(option),
23
+ },
24
+ }), (0, display_1.display)(option)),
25
+ ];
26
+ })
27
+ .flat());
28
+ });
29
+ exports.default = ButtonBar;
@@ -2,7 +2,7 @@ export interface InlineEditState {
2
2
  mode: number;
3
3
  value: string;
4
4
  }
5
- export declare const InlineEdit: import("../dom/fc.js").FCComponentCtor<{
5
+ export declare const InlineEdit: import("../dom/fc").FCComponentCtor<{
6
6
  mode?: number | undefined;
7
7
  value: string;
8
8
  events: {
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InlineEdit = void 0;
4
+ const sizing_1 = require("../dom/css/sizing");
5
+ const fc_1 = require("../dom/fc");
6
+ const html_1 = require("../dom/html");
7
+ const Mode = { VIEW: 0, EDIT: 1 };
8
+ exports.InlineEdit = (0, fc_1.FC)("inline-edit", (el, { mode = Mode.VIEW, value, events }) => {
9
+ const state = (el[fc_1.State] ??= { mode, value });
10
+ const render = () => {
11
+ switch (state.mode) {
12
+ case Mode.EDIT:
13
+ return edit();
14
+ case Mode.VIEW:
15
+ return view();
16
+ default:
17
+ return (0, html_1.span)();
18
+ }
19
+ };
20
+ const view = () => (0, html_1.span)({
21
+ style: { cursor: "text", ...(0, sizing_1.width)("full", "inline") },
22
+ events: {
23
+ click: () => {
24
+ state.mode = Mode.EDIT;
25
+ el.update(render());
26
+ },
27
+ },
28
+ }, state.value ?? "");
29
+ const edit = () => {
30
+ const edit = (0, html_1.span)({ style: { display: "block", position: "relative" } }, (0, html_1.input)({
31
+ style: {
32
+ zIndex: "10",
33
+ position: "absolute",
34
+ left: "0",
35
+ marginTop: "-0.375rem",
36
+ },
37
+ events: {
38
+ blur: ({ target }) => events.change(target?.value ?? ""),
39
+ },
40
+ type: "text",
41
+ value: state.value,
42
+ }), "\u00a0" // Hack to get the span to take up space
43
+ );
44
+ setTimeout(() => {
45
+ edit.dispatchEvent(new Event("focus"));
46
+ });
47
+ return edit;
48
+ };
49
+ return render();
50
+ });
51
+ exports.default = exports.InlineEdit;
@@ -1,7 +1,6 @@
1
- import { DOMElement, Updatable } from "../dom/dom.js";
2
- import { Logger } from "../log.js";
1
+ import { Logger } from "../log";
3
2
  export interface HTMLLogger extends Logger {
4
- root: Updatable<DOMElement>;
3
+ root: Element;
5
4
  }
6
5
  export declare function isHTMLLogger(logger: Logger): logger is HTMLLogger;
7
6
  export declare function makeHTMLLogger(name: string): HTMLLogger;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeHTMLLogger = exports.isHTMLLogger = void 0;
4
+ const display_1 = require("../display");
5
+ const html_1 = require("../dom/html");
6
+ const log_1 = require("../log");
7
+ function isHTMLLogger(logger) {
8
+ return logger.root != undefined;
9
+ }
10
+ exports.isHTMLLogger = isHTMLLogger;
11
+ function makeHTMLLogger(name) {
12
+ let log;
13
+ const root = (0, html_1.div)((0, html_1.div)((0, html_1.span)(name)), (log = (0, html_1.ul)()));
14
+ const logger = { level: log_1.LEVEL.INFO, root };
15
+ function append(message) {
16
+ log.appendChild((0, html_1.li)((0, html_1.pre)((0, html_1.code)(message))));
17
+ }
18
+ const logAt = (level) => (message) => level >= (logger.level ?? log_1.LEVEL.ERROR)
19
+ ? append((0, display_1.display)(message))
20
+ : undefined;
21
+ logger.debug = logAt(log_1.LEVEL.VERBOSE);
22
+ logger.info = logAt(log_1.LEVEL.INFO);
23
+ logger.warn = logAt(log_1.LEVEL.WARN);
24
+ logger.error = logAt(log_1.LEVEL.ERROR);
25
+ return logger;
26
+ }
27
+ exports.makeHTMLLogger = makeHTMLLogger;
@@ -0,0 +1,10 @@
1
+ import { EventHandler } from "../dom/dom";
2
+ export declare const Select: import("../dom/fc").FCComponentCtor<{
3
+ name: string;
4
+ value: string;
5
+ events: {
6
+ change: EventHandler;
7
+ };
8
+ disabled: boolean;
9
+ options: [string, string][];
10
+ }, {}>;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Select = void 0;
4
+ const fc_1 = require("../dom/fc");
5
+ const html_1 = require("../dom/html");
6
+ exports.Select = (0, fc_1.FC)("jiffies-select", (el, { name, events: { change }, disabled, value, options }) => (0, html_1.select)({ name, events: { change }, disabled }, ...options.map(([v, name]) => (0, html_1.option)({ value: v, selected: value === v }, `${name}`))));
@@ -0,0 +1 @@
1
+ export function loadTests(): Promise<void>;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadTests = void 0;
4
+ async function loadTests() {
5
+ await Promise.resolve().then(() => require("./virtual_scroll.test.js"));
6
+ }
7
+ exports.loadTests = loadTests;
@@ -1,4 +1,3 @@
1
- import { UHTMLElement } from "../dom/html.js";
2
1
  export interface VirtualScrollSettings {
3
2
  minIndex: number;
4
3
  maxIndex: number;
@@ -14,7 +13,7 @@ export declare function arrayAdapter<T>(data: T[]): VirtualScrollDataAdapter<T>;
14
13
  export interface VirtualScrollProps<T, U extends HTMLElement> {
15
14
  settings: Partial<VirtualScrollSettings>;
16
15
  get: VirtualScrollDataAdapter<T>;
17
- row: (t: T) => UHTMLElement<U>;
16
+ row: (t: T) => U;
18
17
  }
19
18
  export declare function fillVirtualScrollSettings(settings: Partial<VirtualScrollSettings>): VirtualScrollSettings;
20
19
  export declare function initialState<T>(settings: VirtualScrollSettings): VirtualScrollState<T>;
@@ -35,7 +34,7 @@ interface VirtualScrollState<T, U extends HTMLElement = HTMLElement> {
35
34
  bottomPaddingHeight: number;
36
35
  toleranceHeight: number;
37
36
  data: T[];
38
- rows: UHTMLElement<U>[];
37
+ rows: U[];
39
38
  }
40
- export declare const VirtualScroll: import("../dom/fc.js").FCComponentCtor<VirtualScrollProps<unknown, HTMLElement>, VirtualScrollState<unknown, HTMLElement>>;
39
+ export declare const VirtualScroll: import("../dom/fc.js").FCComponentCtor<VirtualScrollProps<any, HTMLElement>, VirtualScrollState<any, HTMLElement>>;
41
40
  export default VirtualScroll;
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VirtualScroll = exports.doScroll = exports.getData = exports.initialState = exports.fillVirtualScrollSettings = exports.arrayAdapter = void 0;
4
+ const debounce_js_1 = require("../debounce.js");
5
+ const fc_js_1 = require("../dom/fc.js");
6
+ const html_js_1 = require("../dom/html.js");
7
+ function arrayAdapter(data) {
8
+ return (offset, limit) => data.slice(offset, offset + limit);
9
+ }
10
+ exports.arrayAdapter = arrayAdapter;
11
+ function fillVirtualScrollSettings(settings) {
12
+ const { minIndex = 0, maxIndex = Number.MAX_SAFE_INTEGER, startIndex = 0, itemHeight = 20, count = maxIndex - minIndex + 1, tolerance = count, } = settings;
13
+ return { minIndex, maxIndex, startIndex, itemHeight, count, tolerance };
14
+ }
15
+ exports.fillVirtualScrollSettings = fillVirtualScrollSettings;
16
+ function initialState(settings) {
17
+ // From Denis Hilt, https://blog.logrocket.com/virtual-scrolling-core-principles-and-basic-implementation-in-react/
18
+ const { minIndex, maxIndex, startIndex, itemHeight, count, tolerance } = settings;
19
+ const bufferedItems = count + 2 * tolerance;
20
+ const itemsAbove = Math.max(0, startIndex - tolerance - minIndex);
21
+ const viewportHeight = count * itemHeight;
22
+ const totalHeight = (maxIndex - minIndex + 1) * itemHeight;
23
+ const toleranceHeight = tolerance * itemHeight;
24
+ const bufferHeight = viewportHeight + 2 * toleranceHeight;
25
+ const topPaddingHeight = itemsAbove * itemHeight;
26
+ const bottomPaddingHeight = totalHeight - (topPaddingHeight + bufferHeight);
27
+ return {
28
+ scrollTop: 0,
29
+ settings,
30
+ viewportHeight,
31
+ totalHeight,
32
+ toleranceHeight,
33
+ bufferedItems,
34
+ topPaddingHeight,
35
+ bottomPaddingHeight,
36
+ data: [],
37
+ rows: [],
38
+ };
39
+ }
40
+ exports.initialState = initialState;
41
+ function getData(minIndex, maxIndex, offset, limit, get) {
42
+ const start = Math.max(0, minIndex, offset);
43
+ const end = Math.min(maxIndex, offset + limit - 1);
44
+ const data = get(start, end - start);
45
+ return [...data];
46
+ }
47
+ exports.getData = getData;
48
+ function doScroll(scrollTop, state, get) {
49
+ const { totalHeight, toleranceHeight, bufferedItems, settings: { itemHeight, minIndex, maxIndex }, } = state;
50
+ const index = minIndex + Math.floor((scrollTop - toleranceHeight) / itemHeight);
51
+ const data = getData(minIndex, maxIndex, index, bufferedItems, get);
52
+ const topPaddingHeight = Math.max((index - minIndex) * itemHeight, 0);
53
+ const bottomPaddingHeight = Math.max(totalHeight - (topPaddingHeight + data.length * itemHeight), 0);
54
+ return { scrollTop, topPaddingHeight, bottomPaddingHeight, data };
55
+ }
56
+ exports.doScroll = doScroll;
57
+ // export interface VirtualScroll<T, U extends HTMLElement> {
58
+ // state: VirtualScrollState<T>;
59
+ // rows: UHTMLElement<U>[];
60
+ // }
61
+ exports.VirtualScroll = (0, fc_js_1.FC)("virtual-scroll", (element, props) => {
62
+ const settings = fillVirtualScrollSettings(props.settings);
63
+ const state = (element[fc_js_1.State] = {
64
+ ...initialState(settings),
65
+ ...element[fc_js_1.State],
66
+ });
67
+ const scrollTo = ({ target } = { target: state }) => {
68
+ const scrollTop = target?.scrollTop ?? state.topPaddingHeight;
69
+ const updatedSate = {
70
+ ...state,
71
+ ...doScroll(scrollTop, state, props.get),
72
+ };
73
+ setState(updatedSate);
74
+ };
75
+ const viewportElement = (0, html_js_1.div)({
76
+ style: { height: `${state.viewportHeight}px`, overflowY: "scroll" },
77
+ events: { scroll: (0, debounce_js_1.debounce)(scrollTo, 0) },
78
+ });
79
+ setTimeout(() => {
80
+ viewportElement.scroll({ top: state.scrollTop });
81
+ });
82
+ const setState = (newState) => {
83
+ state.scrollTop = newState.scrollTop;
84
+ state.topPaddingHeight = newState.topPaddingHeight;
85
+ state.bottomPaddingHeight = newState.bottomPaddingHeight;
86
+ state.data = newState.data;
87
+ state.rows = state.data.map(props.row);
88
+ viewportElement.update((0, html_js_1.div)({
89
+ class: "VirtualScroll__topPadding",
90
+ style: { height: `${state.topPaddingHeight}px` },
91
+ }), ...(state.rows ?? []).map((row, i) => (0, html_js_1.div)({
92
+ class: `VirtualScroll__item_${i}`,
93
+ style: { height: `${settings.itemHeight}px` },
94
+ }, row)), (0, html_js_1.div)({
95
+ class: "VirtualScroll__bottomPadding",
96
+ style: { height: `${state.bottomPaddingHeight}px` },
97
+ }));
98
+ };
99
+ scrollTo();
100
+ return viewportElement;
101
+ });
102
+ exports.default = exports.VirtualScroll;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const fc_js_1 = require("../dom/fc.js");
4
+ const html_js_1 = require("../dom/html.js");
5
+ const index_js_1 = require("../scope/index.js");
6
+ const virtual_scroll_js_1 = require("./virtual_scroll.js");
7
+ (0, index_js_1.describe)("VirtualScroll", () => {
8
+ (0, index_js_1.it)("tracks scroll position", () => {
9
+ const data = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
10
+ const props = {
11
+ settings: { count: 3, startIndex: 2 },
12
+ get: (0, virtual_scroll_js_1.arrayAdapter)(data),
13
+ row: (i) => (0, html_js_1.div)(`${i}`),
14
+ };
15
+ const scroll = (0, virtual_scroll_js_1.default)(props);
16
+ (0, index_js_1.expect)(scroll[fc_js_1.State]?.bufferedItems).toBe(9);
17
+ (0, index_js_1.expect)(scroll[fc_js_1.State]?.data).toEqual([0, 1, 2, 3, 4]);
18
+ //expect(scroll.state.topPaddingHeight).toBe(0);
19
+ (0, index_js_1.expect)(scroll[fc_js_1.State]?.viewportHeight).toBe(60);
20
+ //expect(scroll.state.totalHeight).toBe(200);
21
+ });
22
+ });
File without changes
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.asyncUsing = exports.using = exports.Exit = exports.Enter = void 0;
4
+ const result_js_1 = require("./result.js");
5
+ exports.Enter = Symbol("Context Enter");
6
+ exports.Exit = Symbol("Context Exit");
7
+ function using(context, operation, normalizeError = (e) => (0, result_js_1.Err)(e)) {
8
+ if (typeof context === "function") {
9
+ if (context.length === 1) {
10
+ operation = context;
11
+ context = {};
12
+ }
13
+ else {
14
+ context = context();
15
+ }
16
+ }
17
+ let result;
18
+ try {
19
+ context[exports.Enter]();
20
+ const op = operation(context);
21
+ result = (0, result_js_1.isResult)(op) ? op : (0, result_js_1.Ok)(op);
22
+ }
23
+ catch (e) {
24
+ result = normalizeError(e);
25
+ }
26
+ finally {
27
+ context[exports.Exit]();
28
+ }
29
+ return result;
30
+ }
31
+ exports.using = using;
32
+ async function asyncUsing(context, operation, normalizeError = (e) => (0, result_js_1.Err)(e)) {
33
+ context = typeof context === "function" ? await context() : context;
34
+ let result;
35
+ try {
36
+ context[exports.Enter]();
37
+ const op = await operation(context);
38
+ result = (0, result_js_1.isResult)(op) ? op : (0, result_js_1.Ok)(op);
39
+ }
40
+ catch (e) {
41
+ result = normalizeError(e);
42
+ }
43
+ finally {
44
+ context[exports.Exit]();
45
+ }
46
+ return result;
47
+ }
48
+ exports.asyncUsing = asyncUsing;
File without changes
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const context_js_1 = require("./context.js");
4
+ const result_js_1 = require("./result.js");
5
+ const describe_js_1 = require("./scope/describe.js");
6
+ const expect_js_1 = require("./scope/expect.js");
7
+ (0, describe_js_1.describe)("Context", () => {
8
+ (0, describe_js_1.it)("performs an operation using a context", () => {
9
+ const context = TestContext();
10
+ const result = (0, context_js_1.using)(context, () => (0, result_js_1.Ok)(5));
11
+ (0, expect_js_1.expect)((0, result_js_1.unwrap)(result)).toBe(5);
12
+ (0, expect_js_1.expect)(context.initialized).toBe(true);
13
+ (0, expect_js_1.expect)(context.completed).toBe(true);
14
+ });
15
+ (0, describe_js_1.it)("reports the result of a thrown error", () => {
16
+ const context = TestContext();
17
+ const result = (0, context_js_1.using)(context, () => {
18
+ throw new Error("Failed");
19
+ });
20
+ (0, expect_js_1.expect)((0, result_js_1.isErr)(result)).toBe(true);
21
+ (0, expect_js_1.expect)((0, result_js_1.Err)(result)).toMatchObject({
22
+ message: "Failed",
23
+ });
24
+ });
25
+ (0, describe_js_1.it)("passes the context to the operation", () => {
26
+ const op = (0, context_js_1.using)(TestContext, ({ initialized, completed }) => ({
27
+ initialized,
28
+ completed,
29
+ }));
30
+ (0, expect_js_1.expect)((0, result_js_1.isOk)(op)).toBe(true);
31
+ const { completed, initialized } = (0, result_js_1.unwrap)(op);
32
+ (0, expect_js_1.expect)(initialized).toBe(true);
33
+ (0, expect_js_1.expect)(completed).toBe(false);
34
+ });
35
+ });
36
+ function TestContext() {
37
+ const context = {
38
+ [context_js_1.Enter]: () => {
39
+ context.initialized = true;
40
+ },
41
+ [context_js_1.Exit]: () => {
42
+ context.completed = true;
43
+ },
44
+ initialized: false,
45
+ completed: false,
46
+ };
47
+ return context;
48
+ }
File without changes
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.debounce = void 0;
4
+ function debounce(fn, ms = 32) {
5
+ let timer;
6
+ return (...args) => {
7
+ clearTimeout(timer);
8
+ timer = setTimeout(() => (clearTimeout(timer), fn(...args)), ms);
9
+ };
10
+ }
11
+ exports.debounce = debounce;
@@ -0,0 +1,15 @@
1
+ export declare const DiffA: unique symbol;
2
+ export declare const DiffB: unique symbol;
3
+ export declare type DiffIndex = string | number;
4
+ export declare type DiffPrimitive = string | number | boolean | null | undefined;
5
+ interface DiffEntry {
6
+ key: DiffIndex;
7
+ left: DiffPrimitive;
8
+ right: DiffPrimitive;
9
+ }
10
+ interface DiffList {
11
+ key: DiffIndex;
12
+ children: (DiffEntry | DiffList)[];
13
+ }
14
+ export declare function diff<T>(a: Partial<T>, b: Partial<T>): (DiffEntry | DiffList)[];
15
+ export {};
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.diff = exports.DiffB = exports.DiffA = void 0;
4
+ const range_js_1 = require("./range.js");
5
+ const result_js_1 = require("./result.js");
6
+ exports.DiffA = Symbol("A");
7
+ exports.DiffB = Symbol("B");
8
+ function doDiff(va, vb, k) {
9
+ if (Array.isArray(va)) {
10
+ // @ts-ignore
11
+ return diffArray(va, vb, k);
12
+ }
13
+ if (typeof va === "object") {
14
+ const d = diffObject(va, vb, k);
15
+ if (d.children.length === 0) {
16
+ return (0, result_js_1.None)();
17
+ }
18
+ else {
19
+ return (0, result_js_1.Some)(d);
20
+ }
21
+ }
22
+ if (Object.is(va, vb)) {
23
+ return (0, result_js_1.None)();
24
+ }
25
+ else {
26
+ // @ts-ignore
27
+ return { key: k, left: va, right: vb };
28
+ }
29
+ }
30
+ function diffArray(a, b, key) {
31
+ const indexes = Math.max(a.length, b.length);
32
+ const children = (0, range_js_1.range)(0, indexes)
33
+ .map((i) => doDiff(a[i], b[i], i))
34
+ .filter(result_js_1.isSome);
35
+ return children.length > 0 ? { key, children } : (0, result_js_1.None)();
36
+ }
37
+ function diffObject(a, b, key = "") {
38
+ const keys = new Set([...Object.keys(a), ...Object.keys(b)]);
39
+ const children = [...keys]
40
+ // @ts-ignore
41
+ .map((k) => doDiff(a[k], b[k], k))
42
+ .filter(result_js_1.isSome);
43
+ return {
44
+ key,
45
+ children,
46
+ };
47
+ }
48
+ function diff(a, b) {
49
+ if (typeof a != "object" && !Object.is(a, b)) {
50
+ // @ts-ignore
51
+ return [{ key: "", left: a, right: b }];
52
+ }
53
+ return (Array.isArray(a)
54
+ ? // @ts-ignore
55
+ diffArray(a, b, "") ?? { children: [] }
56
+ : diffObject(a, b, "")).children;
57
+ }
58
+ exports.diff = diff;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const diff_js_1 = require("./diff.js");
4
+ const describe_js_1 = require("./scope/describe.js");
5
+ const expect_js_1 = require("./scope/expect.js");
6
+ (0, describe_js_1.describe)("diff", () => {
7
+ (0, describe_js_1.it)("diffs primitives", () => {
8
+ const diffed = (0, diff_js_1.diff)(1, 2);
9
+ (0, expect_js_1.expect)(diffed).toEqual([{ key: "", left: 1, right: 2 }]);
10
+ });
11
+ (0, describe_js_1.it)("diffs objects", () => {
12
+ const diffed = (0, diff_js_1.diff)({ a: 1, b: 2 }, { a: 2, b: 2 });
13
+ (0, expect_js_1.expect)(diffed).toEqual([{ key: "a", left: 1, right: 2 }]);
14
+ });
15
+ (0, describe_js_1.it)("diffs nested objects", () => {
16
+ const diffed = (0, diff_js_1.diff)({ a: { c: 1 }, b: 2 }, { a: { c: 2 }, b: 2 });
17
+ (0, expect_js_1.expect)(diffed).toEqual([
18
+ { key: "a", children: [{ key: "c", left: 1, right: 2 }] },
19
+ ]);
20
+ });
21
+ (0, describe_js_1.it)("diffs missing sides", () => {
22
+ const diffed = (0, diff_js_1.diff)({ a: 1 }, { b: 2 });
23
+ (0, expect_js_1.expect)(diffed).toEqual([
24
+ { key: "a", left: 1, right: undefined },
25
+ { key: "b", left: undefined, right: 2 },
26
+ ]);
27
+ });
28
+ (0, describe_js_1.it)("diffs arrays", () => {
29
+ const diffed = (0, diff_js_1.diff)([1, 2, 3], [1, 4, 3]);
30
+ (0, expect_js_1.expect)(diffed).toEqual([{ key: 1, left: 2, right: 4 }]);
31
+ });
32
+ (0, describe_js_1.it)("diffs objects in an array", () => {
33
+ const diffed = (0, diff_js_1.diff)([{ a: { b: 1 } }, { a: { b: 2 } }, { a: { b: 3 } }], [{ a: { b: 1 } }, { a: { b: 4 } }, { a: { b: 3 } }]);
34
+ (0, expect_js_1.expect)(diffed).toEqual([
35
+ {
36
+ key: 1,
37
+ children: [{ key: "a", children: [{ key: "b", left: 2, right: 4 }] }],
38
+ },
39
+ ]);
40
+ });
41
+ });
File without changes
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.display = exports.isDisplay = void 0;
4
+ const isDisplay = (/** @type unknown */ a) => typeof a.toString === "function" ||
5
+ typeof a === "string";
6
+ exports.isDisplay = isDisplay;
7
+ const display = (a) => {
8
+ if ((0, exports.isDisplay)(a)) {
9
+ const str = a.toString();
10
+ if (str === "[object Object]")
11
+ return JSON.stringify(a);
12
+ return str;
13
+ }
14
+ return JSON.stringify(a);
15
+ };
16
+ exports.display = display;
File without changes