@fieldia/core 0.30.1 → 0.31.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 (551) hide show
  1. package/README.md +362 -1
  2. package/package.json +1 -1
  3. package/schema/page.schema.json +758 -1
  4. package/src/index.d.mts +13 -2
  5. package/src/index.d.ts +13 -2
  6. package/src/index.js +45 -2
  7. package/src/index.js.map +1 -1
  8. package/src/index.mjs +18 -2
  9. package/src/index.mjs.map +1 -1
  10. package/src/lib/format/actions.d.mts +16 -16
  11. package/src/lib/format/actions.d.ts +16 -16
  12. package/src/lib/format/actions.js +3 -0
  13. package/src/lib/format/actions.js.map +1 -1
  14. package/src/lib/format/actions.mjs +3 -0
  15. package/src/lib/format/actions.mjs.map +1 -1
  16. package/src/lib/format/address-search.js +3 -0
  17. package/src/lib/format/address-search.js.map +1 -1
  18. package/src/lib/format/address-search.mjs +3 -0
  19. package/src/lib/format/address-search.mjs.map +1 -1
  20. package/src/lib/format/duplicates.js +3 -0
  21. package/src/lib/format/duplicates.js.map +1 -1
  22. package/src/lib/format/duplicates.mjs +3 -0
  23. package/src/lib/format/duplicates.mjs.map +1 -1
  24. package/src/lib/format/endings.js +3 -0
  25. package/src/lib/format/endings.js.map +1 -1
  26. package/src/lib/format/endings.mjs +3 -0
  27. package/src/lib/format/endings.mjs.map +1 -1
  28. package/src/lib/format/field.d.mts +669 -0
  29. package/src/lib/format/field.d.ts +669 -0
  30. package/src/lib/format/field.js +42 -4
  31. package/src/lib/format/field.js.map +1 -1
  32. package/src/lib/format/field.mjs +42 -4
  33. package/src/lib/format/field.mjs.map +1 -1
  34. package/src/lib/format/flow-checks.d.mts +14 -0
  35. package/src/lib/format/flow-checks.d.ts +14 -0
  36. package/src/lib/format/flow-checks.js +61 -0
  37. package/src/lib/format/flow-checks.js.map +1 -0
  38. package/src/lib/format/flow-checks.mjs +58 -0
  39. package/src/lib/format/flow-checks.mjs.map +1 -0
  40. package/src/lib/format/flow.d.mts +43 -0
  41. package/src/lib/format/flow.d.ts +43 -0
  42. package/src/lib/format/flow.js +22 -0
  43. package/src/lib/format/flow.js.map +1 -0
  44. package/src/lib/format/flow.mjs +19 -0
  45. package/src/lib/format/flow.mjs.map +1 -0
  46. package/src/lib/format/from-schema.d.mts +70 -0
  47. package/src/lib/format/from-schema.d.ts +70 -0
  48. package/src/lib/format/from-schema.js +599 -0
  49. package/src/lib/format/from-schema.js.map +1 -0
  50. package/src/lib/format/from-schema.mjs +591 -0
  51. package/src/lib/format/from-schema.mjs.map +1 -0
  52. package/src/lib/format/jitless.d.mts +1 -0
  53. package/src/lib/format/jitless.d.ts +1 -0
  54. package/src/lib/format/jitless.js +27 -0
  55. package/src/lib/format/jitless.js.map +1 -0
  56. package/src/lib/format/jitless.mjs +24 -0
  57. package/src/lib/format/jitless.mjs.map +1 -0
  58. package/src/lib/format/json-schema.js +3 -0
  59. package/src/lib/format/json-schema.js.map +1 -1
  60. package/src/lib/format/json-schema.mjs +3 -0
  61. package/src/lib/format/json-schema.mjs.map +1 -1
  62. package/src/lib/format/json.js +3 -0
  63. package/src/lib/format/json.js.map +1 -1
  64. package/src/lib/format/json.mjs +3 -0
  65. package/src/lib/format/json.mjs.map +1 -1
  66. package/src/lib/format/languages-checks.d.mts +2 -1
  67. package/src/lib/format/languages-checks.d.ts +2 -1
  68. package/src/lib/format/languages-checks.js +8 -2
  69. package/src/lib/format/languages-checks.js.map +1 -1
  70. package/src/lib/format/languages-checks.mjs +8 -2
  71. package/src/lib/format/languages-checks.mjs.map +1 -1
  72. package/src/lib/format/later-checks.d.mts +3 -1
  73. package/src/lib/format/later-checks.d.ts +3 -1
  74. package/src/lib/format/later-checks.js +3 -1
  75. package/src/lib/format/later-checks.js.map +1 -1
  76. package/src/lib/format/later-checks.mjs +3 -1
  77. package/src/lib/format/later-checks.mjs.map +1 -1
  78. package/src/lib/format/layout.d.mts +13192 -7550
  79. package/src/lib/format/layout.d.ts +13192 -7550
  80. package/src/lib/format/layout.js +61 -3
  81. package/src/lib/format/layout.js.map +1 -1
  82. package/src/lib/format/layout.mjs +59 -1
  83. package/src/lib/format/layout.mjs.map +1 -1
  84. package/src/lib/format/layout.types.d.mts +3 -1
  85. package/src/lib/format/layout.types.d.ts +3 -1
  86. package/src/lib/format/limits.js +3 -0
  87. package/src/lib/format/limits.js.map +1 -1
  88. package/src/lib/format/limits.mjs +3 -0
  89. package/src/lib/format/limits.mjs.map +1 -1
  90. package/src/lib/format/list-checks.d.mts +1 -1
  91. package/src/lib/format/list-checks.d.ts +1 -1
  92. package/src/lib/format/list-checks.js +67 -22
  93. package/src/lib/format/list-checks.js.map +1 -1
  94. package/src/lib/format/list-checks.mjs +67 -22
  95. package/src/lib/format/list-checks.mjs.map +1 -1
  96. package/src/lib/format/list-rows-checks.d.mts +11 -0
  97. package/src/lib/format/list-rows-checks.d.ts +11 -0
  98. package/src/lib/format/list-rows-checks.js +62 -0
  99. package/src/lib/format/list-rows-checks.js.map +1 -0
  100. package/src/lib/format/list-rows-checks.mjs +59 -0
  101. package/src/lib/format/list-rows-checks.mjs.map +1 -0
  102. package/src/lib/format/media-options.d.mts +84 -0
  103. package/src/lib/format/media-options.d.ts +84 -0
  104. package/src/lib/format/media-options.js +86 -0
  105. package/src/lib/format/media-options.js.map +1 -0
  106. package/src/lib/format/media-options.mjs +80 -0
  107. package/src/lib/format/media-options.mjs.map +1 -0
  108. package/src/lib/format/outbox-checks.d.mts +11 -0
  109. package/src/lib/format/outbox-checks.d.ts +11 -0
  110. package/src/lib/format/outbox-checks.js +12 -0
  111. package/src/lib/format/outbox-checks.js.map +1 -0
  112. package/src/lib/format/outbox-checks.mjs +9 -0
  113. package/src/lib/format/outbox-checks.mjs.map +1 -0
  114. package/src/lib/format/page.d.mts +3057 -966
  115. package/src/lib/format/page.d.ts +3057 -966
  116. package/src/lib/format/page.js +15 -0
  117. package/src/lib/format/page.js.map +1 -1
  118. package/src/lib/format/page.mjs +15 -0
  119. package/src/lib/format/page.mjs.map +1 -1
  120. package/src/lib/format/part-checks.d.mts +3 -0
  121. package/src/lib/format/part-checks.d.ts +3 -0
  122. package/src/lib/format/payment-checks.d.mts +13 -0
  123. package/src/lib/format/payment-checks.d.ts +13 -0
  124. package/src/lib/format/payment-checks.js +30 -0
  125. package/src/lib/format/payment-checks.js.map +1 -0
  126. package/src/lib/format/payment-checks.mjs +27 -0
  127. package/src/lib/format/payment-checks.mjs.map +1 -0
  128. package/src/lib/format/payment.d.mts +37 -0
  129. package/src/lib/format/payment.d.ts +37 -0
  130. package/src/lib/format/payment.js +15 -0
  131. package/src/lib/format/payment.js.map +1 -0
  132. package/src/lib/format/payment.mjs +12 -0
  133. package/src/lib/format/payment.mjs.map +1 -0
  134. package/src/lib/format/phone.js +3 -0
  135. package/src/lib/format/phone.js.map +1 -1
  136. package/src/lib/format/phone.mjs +3 -0
  137. package/src/lib/format/phone.mjs.map +1 -1
  138. package/src/lib/format/picker-options.d.mts +12 -0
  139. package/src/lib/format/picker-options.d.ts +12 -0
  140. package/src/lib/format/picker-options.js +21 -3
  141. package/src/lib/format/picker-options.js.map +1 -1
  142. package/src/lib/format/picker-options.mjs +20 -2
  143. package/src/lib/format/picker-options.mjs.map +1 -1
  144. package/src/lib/format/prefill-checks.d.mts +13 -0
  145. package/src/lib/format/prefill-checks.d.ts +13 -0
  146. package/src/lib/format/prefill-checks.js +35 -0
  147. package/src/lib/format/prefill-checks.js.map +1 -0
  148. package/src/lib/format/prefill-checks.mjs +32 -0
  149. package/src/lib/format/prefill-checks.mjs.map +1 -0
  150. package/src/lib/format/prefill.d.mts +33 -0
  151. package/src/lib/format/prefill.d.ts +33 -0
  152. package/src/lib/format/prefill.js +20 -0
  153. package/src/lib/format/prefill.js.map +1 -0
  154. package/src/lib/format/prefill.mjs +17 -0
  155. package/src/lib/format/prefill.mjs.map +1 -0
  156. package/src/lib/format/quiz.d.mts +58 -0
  157. package/src/lib/format/quiz.d.ts +58 -0
  158. package/src/lib/format/quiz.js +24 -0
  159. package/src/lib/format/quiz.js.map +1 -0
  160. package/src/lib/format/quiz.mjs +21 -0
  161. package/src/lib/format/quiz.mjs.map +1 -0
  162. package/src/lib/format/records.js +3 -0
  163. package/src/lib/format/records.js.map +1 -1
  164. package/src/lib/format/records.mjs +3 -0
  165. package/src/lib/format/records.mjs.map +1 -1
  166. package/src/lib/format/references.d.mts +1 -1
  167. package/src/lib/format/references.d.ts +1 -1
  168. package/src/lib/format/references.js +56 -7
  169. package/src/lib/format/references.js.map +1 -1
  170. package/src/lib/format/references.mjs +57 -8
  171. package/src/lib/format/references.mjs.map +1 -1
  172. package/src/lib/format/schedule-checks.d.mts +8 -0
  173. package/src/lib/format/schedule-checks.d.ts +8 -0
  174. package/src/lib/format/schedule-checks.js +16 -0
  175. package/src/lib/format/schedule-checks.js.map +1 -0
  176. package/src/lib/format/schedule-checks.mjs +13 -0
  177. package/src/lib/format/schedule-checks.mjs.map +1 -0
  178. package/src/lib/format/signature-checks.d.mts +8 -0
  179. package/src/lib/format/signature-checks.d.ts +8 -0
  180. package/src/lib/format/signature-checks.js +21 -0
  181. package/src/lib/format/signature-checks.js.map +1 -1
  182. package/src/lib/format/signature-checks.mjs +20 -0
  183. package/src/lib/format/signature-checks.mjs.map +1 -1
  184. package/src/lib/format/signature-options.js +3 -0
  185. package/src/lib/format/signature-options.js.map +1 -1
  186. package/src/lib/format/signature-options.mjs +3 -0
  187. package/src/lib/format/signature-options.mjs.map +1 -1
  188. package/src/lib/format/slots-options.js +3 -0
  189. package/src/lib/format/slots-options.js.map +1 -1
  190. package/src/lib/format/slots-options.mjs +3 -0
  191. package/src/lib/format/slots-options.mjs.map +1 -1
  192. package/src/lib/format/templates-checks.d.mts +6 -0
  193. package/src/lib/format/templates-checks.d.ts +6 -0
  194. package/src/lib/format/templates-checks.js +16 -0
  195. package/src/lib/format/templates-checks.js.map +1 -0
  196. package/src/lib/format/templates-checks.mjs +13 -0
  197. package/src/lib/format/templates-checks.mjs.map +1 -0
  198. package/src/lib/format/translate.d.mts +2 -0
  199. package/src/lib/format/translate.d.ts +2 -0
  200. package/src/lib/format/translate.js +6 -2
  201. package/src/lib/format/translate.js.map +1 -1
  202. package/src/lib/format/translate.mjs +4 -2
  203. package/src/lib/format/translate.mjs.map +1 -1
  204. package/src/lib/format/typed-options.d.mts +43 -0
  205. package/src/lib/format/typed-options.d.ts +43 -0
  206. package/src/lib/format/typed-options.js +50 -0
  207. package/src/lib/format/typed-options.js.map +1 -0
  208. package/src/lib/format/typed-options.mjs +46 -0
  209. package/src/lib/format/typed-options.mjs.map +1 -0
  210. package/src/lib/format/upgrade.d.mts +5 -1
  211. package/src/lib/format/upgrade.d.ts +5 -1
  212. package/src/lib/format/upgrade.js +5 -1
  213. package/src/lib/format/upgrade.js.map +1 -1
  214. package/src/lib/format/upgrade.mjs +5 -1
  215. package/src/lib/format/upgrade.mjs.map +1 -1
  216. package/src/lib/format/validate.js +3 -0
  217. package/src/lib/format/validate.js.map +1 -1
  218. package/src/lib/format/validate.mjs +3 -0
  219. package/src/lib/format/validate.mjs.map +1 -1
  220. package/src/lib/format/verify-checks.d.mts +10 -0
  221. package/src/lib/format/verify-checks.d.ts +10 -0
  222. package/src/lib/format/verify-checks.js +44 -0
  223. package/src/lib/format/verify-checks.js.map +1 -0
  224. package/src/lib/format/verify-checks.mjs +41 -0
  225. package/src/lib/format/verify-checks.mjs.map +1 -0
  226. package/src/lib/format/version.d.mts +2 -2
  227. package/src/lib/format/version.d.ts +2 -2
  228. package/src/lib/format/version.js +2 -2
  229. package/src/lib/format/version.js.map +1 -1
  230. package/src/lib/format/version.mjs +2 -2
  231. package/src/lib/format/version.mjs.map +1 -1
  232. package/src/lib/format/week.d.mts +18 -0
  233. package/src/lib/format/week.d.ts +18 -0
  234. package/src/lib/format/week.js +58 -0
  235. package/src/lib/format/week.js.map +1 -0
  236. package/src/lib/format/week.mjs +55 -0
  237. package/src/lib/format/week.mjs.map +1 -0
  238. package/src/lib/record/approvals-part.d.mts +1 -1
  239. package/src/lib/record/approvals-part.d.ts +1 -1
  240. package/src/lib/record/approvals-part.js +2 -2
  241. package/src/lib/record/approvals-part.js.map +1 -1
  242. package/src/lib/record/approvals-part.mjs +1 -1
  243. package/src/lib/record/approvals-part.mjs.map +1 -1
  244. package/src/lib/record/data-source.d.mts +331 -0
  245. package/src/lib/record/data-source.d.ts +331 -0
  246. package/src/lib/record/data-source.js.map +1 -1
  247. package/src/lib/record/data-source.mjs.map +1 -1
  248. package/src/lib/record/day-words.d.mts +22 -1
  249. package/src/lib/record/day-words.d.ts +22 -1
  250. package/src/lib/record/day-words.js +29 -2
  251. package/src/lib/record/day-words.js.map +1 -1
  252. package/src/lib/record/day-words.mjs +24 -2
  253. package/src/lib/record/day-words.mjs.map +1 -1
  254. package/src/lib/record/files-part.d.mts +1 -0
  255. package/src/lib/record/files-part.d.ts +1 -0
  256. package/src/lib/record/files-part.js +7 -1
  257. package/src/lib/record/files-part.js.map +1 -1
  258. package/src/lib/record/files-part.mjs +5 -1
  259. package/src/lib/record/files-part.mjs.map +1 -1
  260. package/src/lib/record/form-approvals.d.mts +12 -17
  261. package/src/lib/record/form-approvals.d.ts +12 -17
  262. package/src/lib/record/form-approvals.js +14 -8
  263. package/src/lib/record/form-approvals.js.map +1 -1
  264. package/src/lib/record/form-approvals.mjs +13 -7
  265. package/src/lib/record/form-approvals.mjs.map +1 -1
  266. package/src/lib/record/form-limits.d.mts +4 -28
  267. package/src/lib/record/form-limits.d.ts +4 -28
  268. package/src/lib/record/form-limits.js +8 -5
  269. package/src/lib/record/form-limits.js.map +1 -1
  270. package/src/lib/record/form-limits.mjs +8 -5
  271. package/src/lib/record/form-limits.mjs.map +1 -1
  272. package/src/lib/record/form.d.mts +115 -3
  273. package/src/lib/record/form.d.ts +115 -3
  274. package/src/lib/record/form.js +262 -65
  275. package/src/lib/record/form.js.map +1 -1
  276. package/src/lib/record/form.mjs +263 -66
  277. package/src/lib/record/form.mjs.map +1 -1
  278. package/src/lib/record/history-steps.d.mts +38 -0
  279. package/src/lib/record/history-steps.d.ts +38 -0
  280. package/src/lib/record/history-steps.js +63 -0
  281. package/src/lib/record/history-steps.js.map +1 -0
  282. package/src/lib/record/history-steps.mjs +58 -0
  283. package/src/lib/record/history-steps.mjs.map +1 -0
  284. package/src/lib/record/history.d.mts +16 -0
  285. package/src/lib/record/history.d.ts +16 -0
  286. package/src/lib/record/history.js +3 -0
  287. package/src/lib/record/history.js.map +1 -0
  288. package/src/lib/record/history.mjs +2 -0
  289. package/src/lib/record/history.mjs.map +1 -0
  290. package/src/lib/record/input-rules.d.mts +2 -0
  291. package/src/lib/record/input-rules.d.ts +2 -0
  292. package/src/lib/record/input-rules.js +4 -1
  293. package/src/lib/record/input-rules.js.map +1 -1
  294. package/src/lib/record/input-rules.mjs +2 -0
  295. package/src/lib/record/input-rules.mjs.map +1 -1
  296. package/src/lib/record/joins.d.mts +143 -0
  297. package/src/lib/record/joins.d.ts +143 -0
  298. package/src/lib/record/joins.js +28 -0
  299. package/src/lib/record/joins.js.map +1 -0
  300. package/src/lib/record/joins.mjs +24 -0
  301. package/src/lib/record/joins.mjs.map +1 -0
  302. package/src/lib/record/limits.js +7 -4
  303. package/src/lib/record/limits.js.map +1 -1
  304. package/src/lib/record/limits.mjs +8 -5
  305. package/src/lib/record/limits.mjs.map +1 -1
  306. package/src/lib/record/link-values.d.mts +31 -0
  307. package/src/lib/record/link-values.d.ts +31 -0
  308. package/src/lib/record/link-values.js +132 -0
  309. package/src/lib/record/link-values.js.map +1 -0
  310. package/src/lib/record/link-values.mjs +125 -0
  311. package/src/lib/record/link-values.mjs.map +1 -0
  312. package/src/lib/record/live-later.d.mts +15 -0
  313. package/src/lib/record/live-later.d.ts +15 -0
  314. package/src/lib/record/live-later.js +10 -0
  315. package/src/lib/record/live-later.js.map +1 -0
  316. package/src/lib/record/live-later.mjs +7 -0
  317. package/src/lib/record/live-later.mjs.map +1 -0
  318. package/src/lib/record/live-part.d.mts +6 -0
  319. package/src/lib/record/live-part.d.ts +6 -0
  320. package/src/lib/record/live-part.js +12 -0
  321. package/src/lib/record/live-part.js.map +1 -0
  322. package/src/lib/record/live-part.mjs +7 -0
  323. package/src/lib/record/live-part.mjs.map +1 -0
  324. package/src/lib/record/live.d.mts +8 -0
  325. package/src/lib/record/live.d.ts +8 -0
  326. package/src/lib/record/live.js +133 -0
  327. package/src/lib/record/live.js.map +1 -0
  328. package/src/lib/record/live.mjs +129 -0
  329. package/src/lib/record/live.mjs.map +1 -0
  330. package/src/lib/record/locales/all.d.mts +5 -5
  331. package/src/lib/record/locales/all.d.ts +5 -5
  332. package/src/lib/record/locales/all.js +3 -3
  333. package/src/lib/record/locales/all.js.map +1 -1
  334. package/src/lib/record/locales/all.mjs +3 -3
  335. package/src/lib/record/locales/all.mjs.map +1 -1
  336. package/src/lib/record/locales/ar.js +8 -0
  337. package/src/lib/record/locales/ar.js.map +1 -1
  338. package/src/lib/record/locales/ar.mjs +8 -0
  339. package/src/lib/record/locales/ar.mjs.map +1 -1
  340. package/src/lib/record/locales/de.js +8 -0
  341. package/src/lib/record/locales/de.js.map +1 -1
  342. package/src/lib/record/locales/de.mjs +8 -0
  343. package/src/lib/record/locales/de.mjs.map +1 -1
  344. package/src/lib/record/locales/es.d.mts +8 -0
  345. package/src/lib/record/locales/es.d.ts +8 -0
  346. package/src/lib/record/locales/es.js +111 -0
  347. package/src/lib/record/locales/es.js.map +1 -0
  348. package/src/lib/record/locales/es.mjs +108 -0
  349. package/src/lib/record/locales/es.mjs.map +1 -0
  350. package/src/lib/record/locales/fa.d.mts +5 -0
  351. package/src/lib/record/locales/fa.d.ts +5 -0
  352. package/src/lib/record/locales/fa.js +117 -0
  353. package/src/lib/record/locales/fa.js.map +1 -0
  354. package/src/lib/record/locales/fa.mjs +114 -0
  355. package/src/lib/record/locales/fa.mjs.map +1 -0
  356. package/src/lib/record/locales/fr.js +8 -0
  357. package/src/lib/record/locales/fr.js.map +1 -1
  358. package/src/lib/record/locales/fr.mjs +8 -0
  359. package/src/lib/record/locales/fr.mjs.map +1 -1
  360. package/src/lib/record/locales/later.d.mts +8 -0
  361. package/src/lib/record/locales/later.d.ts +8 -0
  362. package/src/lib/record/locales/later.js +16 -0
  363. package/src/lib/record/locales/later.js.map +1 -0
  364. package/src/lib/record/locales/later.mjs +13 -0
  365. package/src/lib/record/locales/later.mjs.map +1 -0
  366. package/src/lib/record/locales/tr.d.mts +6 -0
  367. package/src/lib/record/locales/tr.d.ts +6 -0
  368. package/src/lib/record/locales/tr.js +118 -0
  369. package/src/lib/record/locales/tr.js.map +1 -0
  370. package/src/lib/record/locales/tr.mjs +115 -0
  371. package/src/lib/record/locales/tr.mjs.map +1 -0
  372. package/src/lib/record/locales/ur.d.mts +9 -0
  373. package/src/lib/record/locales/ur.d.ts +9 -0
  374. package/src/lib/record/locales/ur.js +118 -0
  375. package/src/lib/record/locales/ur.js.map +1 -0
  376. package/src/lib/record/locales/ur.mjs +115 -0
  377. package/src/lib/record/locales/ur.mjs.map +1 -0
  378. package/src/lib/record/memory-codes.d.mts +37 -0
  379. package/src/lib/record/memory-codes.d.ts +37 -0
  380. package/src/lib/record/memory-codes.js +50 -0
  381. package/src/lib/record/memory-codes.js.map +1 -0
  382. package/src/lib/record/memory-codes.mjs +47 -0
  383. package/src/lib/record/memory-codes.mjs.map +1 -0
  384. package/src/lib/record/memory-data-source.d.mts +56 -2
  385. package/src/lib/record/memory-data-source.d.ts +56 -2
  386. package/src/lib/record/memory-data-source.js +67 -1
  387. package/src/lib/record/memory-data-source.js.map +1 -1
  388. package/src/lib/record/memory-data-source.mjs +67 -1
  389. package/src/lib/record/memory-data-source.mjs.map +1 -1
  390. package/src/lib/record/memory-kept.d.mts +3 -1
  391. package/src/lib/record/memory-kept.d.ts +3 -1
  392. package/src/lib/record/memory-kept.js +7 -2
  393. package/src/lib/record/memory-kept.js.map +1 -1
  394. package/src/lib/record/memory-kept.mjs +7 -2
  395. package/src/lib/record/memory-kept.mjs.map +1 -1
  396. package/src/lib/record/memory-later.d.mts +3 -1
  397. package/src/lib/record/memory-later.d.ts +3 -1
  398. package/src/lib/record/memory-later.js +9 -5
  399. package/src/lib/record/memory-later.js.map +1 -1
  400. package/src/lib/record/memory-later.mjs +8 -4
  401. package/src/lib/record/memory-later.mjs.map +1 -1
  402. package/src/lib/record/memory-live.d.mts +8 -0
  403. package/src/lib/record/memory-live.d.ts +8 -0
  404. package/src/lib/record/memory-live.js +70 -0
  405. package/src/lib/record/memory-live.js.map +1 -0
  406. package/src/lib/record/memory-live.mjs +67 -0
  407. package/src/lib/record/memory-live.mjs.map +1 -0
  408. package/src/lib/record/memory-views.d.mts +11 -0
  409. package/src/lib/record/memory-views.d.ts +11 -0
  410. package/src/lib/record/memory-views.js +60 -0
  411. package/src/lib/record/memory-views.js.map +1 -0
  412. package/src/lib/record/memory-views.mjs +57 -0
  413. package/src/lib/record/memory-views.mjs.map +1 -0
  414. package/src/lib/record/messages.d.mts +21 -3
  415. package/src/lib/record/messages.d.ts +21 -3
  416. package/src/lib/record/messages.js +15 -2
  417. package/src/lib/record/messages.js.map +1 -1
  418. package/src/lib/record/messages.mjs +15 -2
  419. package/src/lib/record/messages.mjs.map +1 -1
  420. package/src/lib/record/order.d.mts +21 -0
  421. package/src/lib/record/order.d.ts +21 -0
  422. package/src/lib/record/order.js +129 -0
  423. package/src/lib/record/order.js.map +1 -0
  424. package/src/lib/record/order.mjs +122 -0
  425. package/src/lib/record/order.mjs.map +1 -0
  426. package/src/lib/record/outbox-form.d.mts +79 -0
  427. package/src/lib/record/outbox-form.d.ts +79 -0
  428. package/src/lib/record/outbox-form.js +291 -0
  429. package/src/lib/record/outbox-form.js.map +1 -0
  430. package/src/lib/record/outbox-form.mjs +286 -0
  431. package/src/lib/record/outbox-form.mjs.map +1 -0
  432. package/src/lib/record/outbox-part.d.mts +6 -0
  433. package/src/lib/record/outbox-part.d.ts +6 -0
  434. package/src/lib/record/outbox-part.js +13 -0
  435. package/src/lib/record/outbox-part.js.map +1 -0
  436. package/src/lib/record/outbox-part.mjs +7 -0
  437. package/src/lib/record/outbox-part.mjs.map +1 -0
  438. package/src/lib/record/pay-part.d.mts +6 -0
  439. package/src/lib/record/pay-part.d.ts +6 -0
  440. package/src/lib/record/pay-part.js +11 -0
  441. package/src/lib/record/pay-part.js.map +1 -0
  442. package/src/lib/record/pay-part.mjs +7 -0
  443. package/src/lib/record/pay-part.mjs.map +1 -0
  444. package/src/lib/record/payment-form.d.mts +25 -0
  445. package/src/lib/record/payment-form.d.ts +25 -0
  446. package/src/lib/record/payment-form.js +98 -0
  447. package/src/lib/record/payment-form.js.map +1 -0
  448. package/src/lib/record/payment-form.mjs +95 -0
  449. package/src/lib/record/payment-form.mjs.map +1 -0
  450. package/src/lib/record/prefill-part.d.mts +7 -0
  451. package/src/lib/record/prefill-part.d.ts +7 -0
  452. package/src/lib/record/prefill-part.js +15 -0
  453. package/src/lib/record/prefill-part.js.map +1 -0
  454. package/src/lib/record/prefill-part.mjs +8 -0
  455. package/src/lib/record/prefill-part.mjs.map +1 -0
  456. package/src/lib/record/press-undo.d.mts +42 -0
  457. package/src/lib/record/press-undo.d.ts +42 -0
  458. package/src/lib/record/press-undo.js +115 -0
  459. package/src/lib/record/press-undo.js.map +1 -0
  460. package/src/lib/record/press-undo.mjs +110 -0
  461. package/src/lib/record/press-undo.mjs.map +1 -0
  462. package/src/lib/record/quiz.d.mts +36 -0
  463. package/src/lib/record/quiz.d.ts +36 -0
  464. package/src/lib/record/quiz.js +90 -0
  465. package/src/lib/record/quiz.js.map +1 -0
  466. package/src/lib/record/quiz.mjs +87 -0
  467. package/src/lib/record/quiz.mjs.map +1 -0
  468. package/src/lib/record/record-words.js +1 -1
  469. package/src/lib/record/record-words.js.map +1 -1
  470. package/src/lib/record/record-words.mjs +1 -1
  471. package/src/lib/record/record-words.mjs.map +1 -1
  472. package/src/lib/record/run.d.mts +54 -2
  473. package/src/lib/record/run.d.ts +54 -2
  474. package/src/lib/record/run.js +30 -6
  475. package/src/lib/record/run.js.map +1 -1
  476. package/src/lib/record/run.mjs +28 -5
  477. package/src/lib/record/run.mjs.map +1 -1
  478. package/src/lib/record/survey-kit.d.mts +37 -0
  479. package/src/lib/record/survey-kit.d.ts +37 -0
  480. package/src/lib/record/survey-kit.js +99 -0
  481. package/src/lib/record/survey-kit.js.map +1 -0
  482. package/src/lib/record/survey-kit.mjs +96 -0
  483. package/src/lib/record/survey-kit.mjs.map +1 -0
  484. package/src/lib/record/survey.d.mts +16 -0
  485. package/src/lib/record/survey.d.ts +16 -0
  486. package/src/lib/record/survey.js +17 -0
  487. package/src/lib/record/survey.js.map +1 -0
  488. package/src/lib/record/survey.mjs +13 -0
  489. package/src/lib/record/survey.mjs.map +1 -0
  490. package/src/lib/record/surveyflow-part.d.mts +9 -0
  491. package/src/lib/record/surveyflow-part.d.ts +9 -0
  492. package/src/lib/record/surveyflow-part.js +20 -0
  493. package/src/lib/record/surveyflow-part.js.map +1 -0
  494. package/src/lib/record/surveyflow-part.mjs +10 -0
  495. package/src/lib/record/surveyflow-part.mjs.map +1 -0
  496. package/src/lib/record/timing.d.mts +76 -0
  497. package/src/lib/record/timing.d.ts +76 -0
  498. package/src/lib/record/timing.js +112 -0
  499. package/src/lib/record/timing.js.map +1 -0
  500. package/src/lib/record/timing.mjs +104 -0
  501. package/src/lib/record/timing.mjs.map +1 -0
  502. package/src/lib/record/undo-later.d.mts +9 -0
  503. package/src/lib/record/undo-later.d.ts +9 -0
  504. package/src/lib/record/undo-later.js +10 -0
  505. package/src/lib/record/undo-later.js.map +1 -0
  506. package/src/lib/record/undo-later.mjs +7 -0
  507. package/src/lib/record/undo-later.mjs.map +1 -0
  508. package/src/lib/record/undo-part.d.mts +8 -0
  509. package/src/lib/record/undo-part.d.ts +8 -0
  510. package/src/lib/record/undo-part.js +17 -0
  511. package/src/lib/record/undo-part.js.map +1 -0
  512. package/src/lib/record/undo-part.mjs +9 -0
  513. package/src/lib/record/undo-part.mjs.map +1 -0
  514. package/src/lib/record/upload-to-later.d.mts +10 -0
  515. package/src/lib/record/upload-to-later.d.ts +10 -0
  516. package/src/lib/record/upload-to-later.js +15 -0
  517. package/src/lib/record/upload-to-later.js.map +1 -0
  518. package/src/lib/record/upload-to-later.mjs +12 -0
  519. package/src/lib/record/upload-to-later.mjs.map +1 -0
  520. package/src/lib/record/uploads.d.mts +5 -0
  521. package/src/lib/record/uploads.d.ts +5 -0
  522. package/src/lib/record/uploads.js.map +1 -1
  523. package/src/lib/record/uploads.mjs.map +1 -1
  524. package/src/lib/record/values.d.mts +6 -0
  525. package/src/lib/record/values.d.ts +6 -0
  526. package/src/lib/record/values.js.map +1 -1
  527. package/src/lib/record/values.mjs.map +1 -1
  528. package/src/lib/record/verify-form.d.mts +24 -0
  529. package/src/lib/record/verify-form.d.ts +24 -0
  530. package/src/lib/record/verify-form.js +65 -0
  531. package/src/lib/record/verify-form.js.map +1 -0
  532. package/src/lib/record/verify-form.mjs +62 -0
  533. package/src/lib/record/verify-form.mjs.map +1 -0
  534. package/src/lib/record/verify-part.d.mts +6 -0
  535. package/src/lib/record/verify-part.d.ts +6 -0
  536. package/src/lib/record/verify-part.js +11 -0
  537. package/src/lib/record/verify-part.js.map +1 -0
  538. package/src/lib/record/verify-part.mjs +7 -0
  539. package/src/lib/record/verify-part.mjs.map +1 -0
  540. package/src/lib/record/words-chunks.d.mts +37 -0
  541. package/src/lib/record/words-chunks.d.ts +37 -0
  542. package/src/lib/record/words-chunks.js +94 -0
  543. package/src/lib/record/words-chunks.js.map +1 -0
  544. package/src/lib/record/words-chunks.mjs +86 -0
  545. package/src/lib/record/words-chunks.mjs.map +1 -0
  546. package/src/runtime.d.mts +28 -6
  547. package/src/runtime.d.ts +28 -6
  548. package/src/runtime.js +35 -6
  549. package/src/runtime.js.map +1 -1
  550. package/src/runtime.mjs +15 -3
  551. package/src/runtime.mjs.map +1 -1
@@ -0,0 +1,96 @@
1
+ import { askedInOrder, drawOrder, drawsOrder } from './order.mjs';
2
+ import { quizResults } from './quiz.mjs';
3
+ import { keepTime, WHOLE_FORM } from './timing.mjs';
4
+ /**
5
+ * The survey flow's side of a form (joins.ts), made as the form is: the draw made where the page draws and the form has
6
+ * none yet — its first step the drawn one's while the person has not moved — and what a response is sent with told
7
+ * (`around`: the order shown, when the page's clock started and whether it ran out).
8
+ */
9
+ export function join(host) {
10
+ const { page, form } = host;
11
+ const drawn = drawsOrder(page);
12
+ const time = keepTime({ page, scheduler: host.scheduler, clock: () => form.now().getTime(), state: () => form.getState(), set: host.set, steps: () => form.steps(), disposed: host.disposed, keep: host.keep });
13
+ const user = form.user()?.id;
14
+ const seed = host.options.seed ?? (user != null ? String(user) : null);
15
+ /** Each part's parts, by its id — what a draw kept in a draft may name — and the part each sits in. */
16
+ const partsOf = new Map();
17
+ const parents = new Map();
18
+ const walk = (node) => {
19
+ const children = Array.isArray(node.children) ? node.children : [];
20
+ if (node.id)
21
+ partsOf.set(node.id, new Set(children.map((child) => child.id ?? '')));
22
+ for (const child of children)
23
+ if (node.id && child.id)
24
+ parents.set(child.id, node.id);
25
+ children.forEach(walk);
26
+ };
27
+ walk(page.layout);
28
+ let undrawn = new Set();
29
+ /** The steps and the parts left out, as an order has them. */
30
+ function take(order) {
31
+ undrawn = new Set();
32
+ for (const [id, list] of Object.entries(order ?? {}))
33
+ for (const part of partsOf.get(id) ?? [])
34
+ if (!list.includes(part))
35
+ undrawn.add(part);
36
+ host.order((page.layout.type === 'wizard' && order?.[page.layout.id]) || null);
37
+ }
38
+ const draw = () => drawOrder(page, seed ?? Math.random().toString(36).slice(2));
39
+ /** An order set, the first step the drawn one's while the person has not moved. */
40
+ function placed(order) {
41
+ const was = form.steps()[0];
42
+ take(order);
43
+ host.set({ order, ...(form.getState().step === was ? { step: form.steps()[0] ?? null } : {}) });
44
+ }
45
+ /** What a response is sent with of them: the order shown, when the page's clock started and whether it ran out. */
46
+ const told = () => {
47
+ const order = form.getState().order;
48
+ return { ...(order ? { order: order } : {}), ...time.told() };
49
+ };
50
+ const kit = {
51
+ hides: (id) => undrawn.has(id),
52
+ locks(id) {
53
+ const up = form.getState().timeUp;
54
+ if (!up.length)
55
+ return false;
56
+ if (up.includes(WHOLE_FORM))
57
+ return true;
58
+ for (let at = id; at; at = parents.get(at))
59
+ if (up.includes(at))
60
+ return true;
61
+ return false;
62
+ },
63
+ kept() {
64
+ const state = form.getState();
65
+ return {
66
+ ...(state.order ? { order: state.order } : {}),
67
+ ...(Object.keys(state.timers).length ? { timers: Object.fromEntries(Object.entries(state.timers).map(([scope, at]) => [scope, new Date(at).toISOString()])) } : {}),
68
+ };
69
+ },
70
+ lay(draft) {
71
+ // Its draw, where every part it names is still the page's with the parts it lists.
72
+ const kept = Object.entries(draft.order ?? {}).filter(([id, list]) => partsOf.has(id) && Array.isArray(list) && list.every((one) => partsOf.get(id)?.has(one)));
73
+ if (drawn && kept.length)
74
+ placed(Object.fromEntries(kept));
75
+ const timers = Object.entries(draft.timers ?? {}).filter(([, at]) => typeof at === 'string' && !Number.isNaN(Date.parse(at)));
76
+ if (timers.length) {
77
+ host.set({ timers: { ...form.getState().timers, ...Object.fromEntries(timers.map(([scope, at]) => [scope, Date.parse(at)])) } });
78
+ time.arm();
79
+ }
80
+ },
81
+ around: (kind, sent, go) => go(kind === 'submit' ? { ...sent, ...told() } : sent),
82
+ reset() {
83
+ time.reset();
84
+ host.set({ timers: {}, timeUp: [] });
85
+ placed(drawn ? (seed === null ? draw() : form.getState().order ?? draw()) : null);
86
+ },
87
+ entered: (step) => time.entered(step),
88
+ start: () => time.start(),
89
+ countdown: () => time.countdown(),
90
+ marked: (values) => (page.quiz ? quizResults(page, values, askedInOrder(page, (form.getState().order ?? null), values)) ?? undefined : undefined),
91
+ };
92
+ if (drawn && !form.getState().order)
93
+ placed(draw());
94
+ return kit;
95
+ }
96
+ //# sourceMappingURL=survey-kit.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"survey-kit.mjs","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/record/survey-kit.ts"],"names":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AAQ,EAAE,CAAC,KAA2B,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAC3G,CAAC;QACD,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;QACrC,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE;QACzB,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE;QACjC,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,KAAK,IAAI,IAAI,CAAsB,EAAE,MAAM,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;KACvK,CAAC;IACF,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,KAAK;QAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IACpD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { Page } from '../format/page.mjs';
2
+ import { type Part } from '../parts.mjs';
3
+ import type * as SurveyFlowModule from './surveyflow-part.mjs';
4
+ /** The survey flow's form code (surveyflow-part.ts). */
5
+ export type FormSurveyPart = typeof SurveyFlowModule;
6
+ /**
7
+ * A survey's flow, the form's code of it — a quiz's results marked as its answers go, the order drawn for each
8
+ * respondent, a page's time limits (survey-kit.ts) — loaded by a form whose page has any (`surveyFlow`), and before such
9
+ * a page is drawn: in the one-tag script, one script with the viewer's (fieldia.surveyflow.js).
10
+ */
11
+ export declare const formSurveyPart: Part<FormSurveyPart>;
12
+ /**
13
+ * Whether a page goes through a survey's flow: a quiz, a review before sending, one question at a time, a time limit, or
14
+ * a part that draws its order or some of its questions. What each of them asks is the part's to tell.
15
+ */
16
+ export declare const surveyFlow: (page: Page) => boolean;
@@ -0,0 +1,16 @@
1
+ import type { Page } from '../format/page';
2
+ import { type Part } from '../parts';
3
+ import type * as SurveyFlowModule from './surveyflow-part';
4
+ /** The survey flow's form code (surveyflow-part.ts). */
5
+ export type FormSurveyPart = typeof SurveyFlowModule;
6
+ /**
7
+ * A survey's flow, the form's code of it — a quiz's results marked as its answers go, the order drawn for each
8
+ * respondent, a page's time limits (survey-kit.ts) — loaded by a form whose page has any (`surveyFlow`), and before such
9
+ * a page is drawn: in the one-tag script, one script with the viewer's (fieldia.surveyflow.js).
10
+ */
11
+ export declare const formSurveyPart: Part<FormSurveyPart>;
12
+ /**
13
+ * Whether a page goes through a survey's flow: a quiz, a review before sending, one question at a time, a time limit, or
14
+ * a part that draws its order or some of its questions. What each of them asks is the part's to tell.
15
+ */
16
+ export declare const surveyFlow: (page: Page) => boolean;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.surveyFlow = exports.formSurveyPart = void 0;
4
+ const parts_1 = require("../parts");
5
+ /**
6
+ * A survey's flow, the form's code of it — a quiz's results marked as its answers go, the order drawn for each
7
+ * respondent, a page's time limits (survey-kit.ts) — loaded by a form whose page has any (`surveyFlow`), and before such
8
+ * a page is drawn: in the one-tag script, one script with the viewer's (fieldia.surveyflow.js).
9
+ */
10
+ exports.formSurveyPart = (0, parts_1.lazyPart)('surveyflow', () => Promise.resolve().then(() => require('./surveyflow-part')));
11
+ /**
12
+ * Whether a page goes through a survey's flow: a quiz, a review before sending, one question at a time, a time limit, or
13
+ * a part that draws its order or some of its questions. What each of them asks is the part's to tell.
14
+ */
15
+ const surveyFlow = (page) => !!(page.quiz || page.review || page.flow || page.timeLimit) || /"order":"random"|"(draw|timeLimit)":/.test(JSON.stringify(page.layout));
16
+ exports.surveyFlow = surveyFlow;
17
+ //# sourceMappingURL=survey.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"survey.js","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/record/survey.ts"],"names":[],"mappings":";;;AACA,oCAA+C;AAM/C;;;;GAIG;AACU,QAAA,cAAc,GAAyB,IAAA,gBAAQ,EAAC,YAAY,EAAE,GAAG,EAAE,sCAAQ,mBAAmB,EAAC,CAAC,CAAC;AAE9G;;;GAGG;AACI,MAAM,UAAU,GAAG,CAAC,IAAU,EAAW,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,sCAAsC,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;AAA9K,QAAA,UAAU,cAAoK"}
@@ -0,0 +1,13 @@
1
+ import { lazyPart } from '../parts.mjs';
2
+ /**
3
+ * A survey's flow, the form's code of it — a quiz's results marked as its answers go, the order drawn for each
4
+ * respondent, a page's time limits (survey-kit.ts) — loaded by a form whose page has any (`surveyFlow`), and before such
5
+ * a page is drawn: in the one-tag script, one script with the viewer's (fieldia.surveyflow.js).
6
+ */
7
+ export const formSurveyPart = lazyPart('surveyflow', () => import('./surveyflow-part.mjs'));
8
+ /**
9
+ * Whether a page goes through a survey's flow: a quiz, a review before sending, one question at a time, a time limit, or
10
+ * a part that draws its order or some of its questions. What each of them asks is the part's to tell.
11
+ */
12
+ export const surveyFlow = (page) => !!(page.quiz || page.review || page.flow || page.timeLimit) || /"order":"random"|"(draw|timeLimit)":/.test(JSON.stringify(page.layout));
13
+ //# sourceMappingURL=survey.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"survey.mjs","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/record/survey.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAa,MAAM,UAAU,CAAC;AAM/C;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAyB,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC;AAE9G;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAU,EAAW,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,sCAAsC,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * A survey's flow, the form's part of it (survey.ts, `formSurveyPart`): a quiz's results marked as its answers are sent
3
+ * (quiz.ts), the order drawn for each respondent (order.ts), a page's time limits (timing.ts), kept together for a form
4
+ * (survey-kit.ts). In the one-tag script, one script with the viewer's part of it (fieldia.surveyflow.js).
5
+ */
6
+ export { quizResults } from './quiz.mjs';
7
+ export { drawOrder, askedInOrder } from './order.mjs';
8
+ export { limitsOf, countdownNow, keepTime } from './timing.mjs';
9
+ export { join } from './survey-kit.mjs';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * A survey's flow, the form's part of it (survey.ts, `formSurveyPart`): a quiz's results marked as its answers are sent
3
+ * (quiz.ts), the order drawn for each respondent (order.ts), a page's time limits (timing.ts), kept together for a form
4
+ * (survey-kit.ts). In the one-tag script, one script with the viewer's part of it (fieldia.surveyflow.js).
5
+ */
6
+ export { quizResults } from './quiz';
7
+ export { drawOrder, askedInOrder } from './order';
8
+ export { limitsOf, countdownNow, keepTime } from './timing';
9
+ export { join } from './survey-kit';
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.join = exports.keepTime = exports.countdownNow = exports.limitsOf = exports.askedInOrder = exports.drawOrder = exports.quizResults = void 0;
4
+ /**
5
+ * A survey's flow, the form's part of it (survey.ts, `formSurveyPart`): a quiz's results marked as its answers are sent
6
+ * (quiz.ts), the order drawn for each respondent (order.ts), a page's time limits (timing.ts), kept together for a form
7
+ * (survey-kit.ts). In the one-tag script, one script with the viewer's part of it (fieldia.surveyflow.js).
8
+ */
9
+ var quiz_1 = require("./quiz");
10
+ Object.defineProperty(exports, "quizResults", { enumerable: true, get: function () { return quiz_1.quizResults; } });
11
+ var order_1 = require("./order");
12
+ Object.defineProperty(exports, "drawOrder", { enumerable: true, get: function () { return order_1.drawOrder; } });
13
+ Object.defineProperty(exports, "askedInOrder", { enumerable: true, get: function () { return order_1.askedInOrder; } });
14
+ var timing_1 = require("./timing");
15
+ Object.defineProperty(exports, "limitsOf", { enumerable: true, get: function () { return timing_1.limitsOf; } });
16
+ Object.defineProperty(exports, "countdownNow", { enumerable: true, get: function () { return timing_1.countdownNow; } });
17
+ Object.defineProperty(exports, "keepTime", { enumerable: true, get: function () { return timing_1.keepTime; } });
18
+ var survey_kit_1 = require("./survey-kit");
19
+ Object.defineProperty(exports, "join", { enumerable: true, get: function () { return survey_kit_1.join; } });
20
+ //# sourceMappingURL=surveyflow-part.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"surveyflow-part.js","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/record/surveyflow-part.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,+BAAqC;AAA5B,mGAAA,WAAW,OAAA;AACpB,iCAAkD;AAAzC,kGAAA,SAAS,OAAA;AAAE,qGAAA,YAAY,OAAA;AAChC,mCAA4D;AAAnD,kGAAA,QAAQ,OAAA;AAAE,sGAAA,YAAY,OAAA;AAAE,kGAAA,QAAQ,OAAA;AACzC,2CAAoC;AAA3B,kGAAA,IAAI,OAAA"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * A survey's flow, the form's part of it (survey.ts, `formSurveyPart`): a quiz's results marked as its answers are sent
3
+ * (quiz.ts), the order drawn for each respondent (order.ts), a page's time limits (timing.ts), kept together for a form
4
+ * (survey-kit.ts). In the one-tag script, one script with the viewer's part of it (fieldia.surveyflow.js).
5
+ */
6
+ export { quizResults } from './quiz.mjs';
7
+ export { drawOrder, askedInOrder } from './order.mjs';
8
+ export { limitsOf, countdownNow, keepTime } from './timing.mjs';
9
+ export { join } from './survey-kit.mjs';
10
+ //# sourceMappingURL=surveyflow-part.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"surveyflow-part.mjs","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/record/surveyflow-part.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,76 @@
1
+ import type { Page } from '../format/page.mjs';
2
+ import type { FormState } from './form.mjs';
3
+ import type { Scheduler } from './scheduler.mjs';
4
+ /**
5
+ * A page's time limits (`timeLimit` on the page and on a wizard's steps), the survey flow's part's: what each allows, when it
6
+ * warns and what it does as it runs out, and the countdown showing now — the page's while it runs, else the step on
7
+ * screen's. The form keeps when each started (`state.timers`, kept in its drafts) and which ran out (`state.timeUp`).
8
+ */
9
+ /** The page's own limit's scope: a step's is its id. */
10
+ export declare const WHOLE_FORM = "#form";
11
+ /** A time limit as it is kept to: in ms, its warning's too, what it does. */
12
+ export interface Limit {
13
+ scope: string;
14
+ ms: number;
15
+ warnMs: number;
16
+ then: 'send' | 'lock';
17
+ }
18
+ /** The countdown showing now. */
19
+ export interface Countdown extends Limit {
20
+ /** When it started and ends, by the form's clock (ms). */
21
+ started: number;
22
+ ends: number;
23
+ /** What is left, in ms, never below 0. */
24
+ left: number;
25
+ /** Running, past its warning, or run out. */
26
+ stage: 'running' | 'warning' | 'up';
27
+ }
28
+ /** Whether a page of responses has a time limit: its own (`timeLimit`), or a step's. */
29
+ export declare const timed: (page: Page) => boolean;
30
+ /** Every time limit of a page, by scope: the page's (`#form`), each step's by its id. */
31
+ export declare function limitsOf(page: Page): Record<string, Limit>;
32
+ /** A limit's countdown, started then, read now. */
33
+ export declare function countdownOf(limit: Limit, started: number, now: number): Countdown;
34
+ /**
35
+ * The countdown showing now: the page's while it runs (or has run out), else the step's on screen; null where neither
36
+ * has started.
37
+ */
38
+ export declare function countdownNow(page: Page, timers: Readonly<Record<string, number>>, step: string | null, now: number): Countdown | null;
39
+ /** What a form's time limits ask of the form they are kept for. */
40
+ export interface TimeHost {
41
+ readonly page: Page;
42
+ readonly scheduler: Scheduler;
43
+ /** Now, in ms, by the form's clock. */
44
+ clock(): number;
45
+ state(): FormState;
46
+ set(patch: Partial<FormState>): void;
47
+ /** The steps shown now, in their order. */
48
+ steps(): string[];
49
+ disposed(): boolean;
50
+ /** Keep a draft soon, where the form keeps drafts: a clock started is kept at once. */
51
+ keep(): void;
52
+ }
53
+ /** A form's time limits, kept (`keepTime`). */
54
+ export interface TimeKit {
55
+ /** The page's limit started: its Start pressed. */
56
+ start(): void;
57
+ /** A step entered: its own limit, if any, starts the first time. */
58
+ entered(step: string): void;
59
+ /** Each started limit set to run out on time — at once, for one past its end. */
60
+ arm(): void;
61
+ /** Started again: no limit started, none set to run out. */
62
+ reset(): void;
63
+ /** The countdown showing now. */
64
+ countdown(): Countdown | null;
65
+ /** What a send tells of the page's limit: when it started, whether it ran out. */
66
+ told(): {
67
+ started?: string;
68
+ timeUp?: boolean;
69
+ };
70
+ }
71
+ /**
72
+ * A form's time limits: each started limit set to run out on the form's clock; as it does, its answers locked
73
+ * (`state.timeUp`) and — a step's that locks, on screen — the form gone on to the next step. A page's whose answers go
74
+ * as it runs out leaves the send to the viewer (or the app), which watches `timeUp`.
75
+ */
76
+ export declare function keepTime(host: TimeHost): TimeKit;
@@ -0,0 +1,76 @@
1
+ import type { Page } from '../format/page';
2
+ import type { FormState } from './form';
3
+ import type { Scheduler } from './scheduler';
4
+ /**
5
+ * A page's time limits (`timeLimit` on the page and on a wizard's steps), the survey flow's part's: what each allows, when it
6
+ * warns and what it does as it runs out, and the countdown showing now — the page's while it runs, else the step on
7
+ * screen's. The form keeps when each started (`state.timers`, kept in its drafts) and which ran out (`state.timeUp`).
8
+ */
9
+ /** The page's own limit's scope: a step's is its id. */
10
+ export declare const WHOLE_FORM = "#form";
11
+ /** A time limit as it is kept to: in ms, its warning's too, what it does. */
12
+ export interface Limit {
13
+ scope: string;
14
+ ms: number;
15
+ warnMs: number;
16
+ then: 'send' | 'lock';
17
+ }
18
+ /** The countdown showing now. */
19
+ export interface Countdown extends Limit {
20
+ /** When it started and ends, by the form's clock (ms). */
21
+ started: number;
22
+ ends: number;
23
+ /** What is left, in ms, never below 0. */
24
+ left: number;
25
+ /** Running, past its warning, or run out. */
26
+ stage: 'running' | 'warning' | 'up';
27
+ }
28
+ /** Whether a page of responses has a time limit: its own (`timeLimit`), or a step's. */
29
+ export declare const timed: (page: Page) => boolean;
30
+ /** Every time limit of a page, by scope: the page's (`#form`), each step's by its id. */
31
+ export declare function limitsOf(page: Page): Record<string, Limit>;
32
+ /** A limit's countdown, started then, read now. */
33
+ export declare function countdownOf(limit: Limit, started: number, now: number): Countdown;
34
+ /**
35
+ * The countdown showing now: the page's while it runs (or has run out), else the step's on screen; null where neither
36
+ * has started.
37
+ */
38
+ export declare function countdownNow(page: Page, timers: Readonly<Record<string, number>>, step: string | null, now: number): Countdown | null;
39
+ /** What a form's time limits ask of the form they are kept for. */
40
+ export interface TimeHost {
41
+ readonly page: Page;
42
+ readonly scheduler: Scheduler;
43
+ /** Now, in ms, by the form's clock. */
44
+ clock(): number;
45
+ state(): FormState;
46
+ set(patch: Partial<FormState>): void;
47
+ /** The steps shown now, in their order. */
48
+ steps(): string[];
49
+ disposed(): boolean;
50
+ /** Keep a draft soon, where the form keeps drafts: a clock started is kept at once. */
51
+ keep(): void;
52
+ }
53
+ /** A form's time limits, kept (`keepTime`). */
54
+ export interface TimeKit {
55
+ /** The page's limit started: its Start pressed. */
56
+ start(): void;
57
+ /** A step entered: its own limit, if any, starts the first time. */
58
+ entered(step: string): void;
59
+ /** Each started limit set to run out on time — at once, for one past its end. */
60
+ arm(): void;
61
+ /** Started again: no limit started, none set to run out. */
62
+ reset(): void;
63
+ /** The countdown showing now. */
64
+ countdown(): Countdown | null;
65
+ /** What a send tells of the page's limit: when it started, whether it ran out. */
66
+ told(): {
67
+ started?: string;
68
+ timeUp?: boolean;
69
+ };
70
+ }
71
+ /**
72
+ * A form's time limits: each started limit set to run out on the form's clock; as it does, its answers locked
73
+ * (`state.timeUp`) and — a step's that locks, on screen — the form gone on to the next step. A page's whose answers go
74
+ * as it runs out leaves the send to the viewer (or the app), which watches `timeUp`.
75
+ */
76
+ export declare function keepTime(host: TimeHost): TimeKit;
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.timed = exports.WHOLE_FORM = void 0;
4
+ exports.limitsOf = limitsOf;
5
+ exports.countdownOf = countdownOf;
6
+ exports.countdownNow = countdownNow;
7
+ exports.keepTime = keepTime;
8
+ /**
9
+ * A page's time limits (`timeLimit` on the page and on a wizard's steps), the survey flow's part's: what each allows, when it
10
+ * warns and what it does as it runs out, and the countdown showing now — the page's while it runs, else the step on
11
+ * screen's. The form keeps when each started (`state.timers`, kept in its drafts) and which ran out (`state.timeUp`).
12
+ */
13
+ /** The page's own limit's scope: a step's is its id. */
14
+ exports.WHOLE_FORM = '#form';
15
+ const MINUTE = 60_000;
16
+ function limitOf(scope, limit, step) {
17
+ const ms = limit.minutes * MINUTE;
18
+ return { scope, ms, warnMs: (limit.warn ?? Math.min(1, limit.minutes / 5)) * MINUTE, then: limit.then ?? (step ? 'lock' : 'send') };
19
+ }
20
+ /** Whether a page of responses has a time limit: its own (`timeLimit`), or a step's. */
21
+ const timed = (page) => page.data.kind === 'responses' && (!!page.timeLimit || (page.layout.type === 'wizard' && page.layout.children.some((step) => !!step.timeLimit)));
22
+ exports.timed = timed;
23
+ /** Every time limit of a page, by scope: the page's (`#form`), each step's by its id. */
24
+ function limitsOf(page) {
25
+ const out = {};
26
+ if (page.data.kind !== 'responses')
27
+ return out;
28
+ if (page.timeLimit)
29
+ out[exports.WHOLE_FORM] = limitOf(exports.WHOLE_FORM, page.timeLimit, false);
30
+ if (page.layout.type === 'wizard')
31
+ for (const step of page.layout.children)
32
+ if (step.timeLimit)
33
+ out[step.id] = limitOf(step.id, step.timeLimit, true);
34
+ return out;
35
+ }
36
+ /** A limit's countdown, started then, read now. */
37
+ function countdownOf(limit, started, now) {
38
+ const ends = started + limit.ms;
39
+ const left = Math.max(0, ends - now);
40
+ return { ...limit, started, ends, left, stage: left === 0 ? 'up' : left <= limit.warnMs ? 'warning' : 'running' };
41
+ }
42
+ /**
43
+ * The countdown showing now: the page's while it runs (or has run out), else the step's on screen; null where neither
44
+ * has started.
45
+ */
46
+ function countdownNow(page, timers, step, now) {
47
+ const limits = limitsOf(page);
48
+ const whole = limits[exports.WHOLE_FORM];
49
+ if (whole && timers[exports.WHOLE_FORM] !== undefined)
50
+ return countdownOf(whole, timers[exports.WHOLE_FORM], now);
51
+ const own = step ? limits[step] : undefined;
52
+ if (own && timers[own.scope] !== undefined)
53
+ return countdownOf(own, timers[own.scope], now);
54
+ return null;
55
+ }
56
+ /**
57
+ * A form's time limits: each started limit set to run out on the form's clock; as it does, its answers locked
58
+ * (`state.timeUp`) and — a step's that locks, on screen — the form gone on to the next step. A page's whose answers go
59
+ * as it runs out leaves the send to the viewer (or the app), which watches `timeUp`.
60
+ */
61
+ function keepTime(host) {
62
+ const { page, scheduler } = host;
63
+ const limits = limitsOf(page);
64
+ const running = new Map();
65
+ const begin = (scope) => {
66
+ const state = host.state();
67
+ if (!limits[scope] || state.timers[scope] !== undefined)
68
+ return;
69
+ host.set({ timers: { ...state.timers, [scope]: host.clock() } });
70
+ kit.arm();
71
+ host.keep();
72
+ };
73
+ function ranOut(scope) {
74
+ running.delete(scope);
75
+ const state = host.state();
76
+ if (host.disposed() || state.timeUp.includes(scope) || state.sent)
77
+ return;
78
+ const shown = host.steps();
79
+ const following = scope !== exports.WHOLE_FORM && limits[scope].then === 'lock' && state.step === scope ? shown[shown.indexOf(scope) + 1] : undefined;
80
+ host.set({ timeUp: [...state.timeUp, scope], ...(following ? { step: following, errors: {} } : {}) });
81
+ }
82
+ const kit = {
83
+ start: () => begin(exports.WHOLE_FORM),
84
+ entered: (step) => begin(step),
85
+ arm() {
86
+ const state = host.state();
87
+ for (const [scope, limit] of Object.entries(limits)) {
88
+ const started = state.timers[scope];
89
+ if (started === undefined || state.timeUp.includes(scope) || running.has(scope))
90
+ continue;
91
+ running.set(scope, scheduler.setTimeout(() => ranOut(scope), Math.max(0, started + limit.ms - host.clock())));
92
+ }
93
+ },
94
+ reset() {
95
+ for (const timer of running.values())
96
+ scheduler.clearTimeout(timer);
97
+ running.clear();
98
+ },
99
+ countdown() {
100
+ const state = host.state();
101
+ const now = countdownNow(page, state.timers, state.step, host.clock());
102
+ return now && state.timeUp.includes(now.scope) ? { ...now, left: 0, stage: 'up' } : now;
103
+ },
104
+ told() {
105
+ const state = host.state();
106
+ const started = state.timers[exports.WHOLE_FORM];
107
+ return started !== undefined ? { started: new Date(started).toISOString(), timeUp: state.timeUp.includes(exports.WHOLE_FORM) } : state.timeUp.length ? { timeUp: false } : {};
108
+ },
109
+ };
110
+ return kit;
111
+ }
112
+ //# sourceMappingURL=timing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timing.js","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/record/timing.ts"],"names":[],"mappings":";;;AA2CA,4BAMC;AAGD,kCAIC;AAMD,oCAOC;AAsCD,4BA8CC;AApJD;;;;GAIG;AAEH,wDAAwD;AAC3C,QAAA,UAAU,GAAG,OAAO,CAAC;AAClC,MAAM,MAAM,GAAG,MAAM,CAAC;AAqBtB,SAAS,OAAO,CAAC,KAAa,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;QAClB,CAAC;QACD,SAAS;YACP,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;YAC3B,MAAM,GAAG,GAAG,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;YACvE,OAAO,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;QAC1F,CAAC;QACD,IAAI;YACF,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;YAC3B,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,kBAAU,CAAC,CAAC;YACzC,OAAO,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAU,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACxK,CAAC;KACF,CAAC;IACF,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,104 @@
1
+ /**
2
+ * A page's time limits (`timeLimit` on the page and on a wizard's steps), the survey flow's part's: what each allows, when it
3
+ * warns and what it does as it runs out, and the countdown showing now — the page's while it runs, else the step on
4
+ * screen's. The form keeps when each started (`state.timers`, kept in its drafts) and which ran out (`state.timeUp`).
5
+ */
6
+ /** The page's own limit's scope: a step's is its id. */
7
+ export const WHOLE_FORM = '#form';
8
+ const MINUTE = 60_000;
9
+ function limitOf(scope, limit, step) {
10
+ const ms = limit.minutes * MINUTE;
11
+ return { scope, ms, warnMs: (limit.warn ?? Math.min(1, limit.minutes / 5)) * MINUTE, then: limit.then ?? (step ? 'lock' : 'send') };
12
+ }
13
+ /** Whether a page of responses has a time limit: its own (`timeLimit`), or a step's. */
14
+ export const timed = (page) => page.data.kind === 'responses' && (!!page.timeLimit || (page.layout.type === 'wizard' && page.layout.children.some((step) => !!step.timeLimit)));
15
+ /** Every time limit of a page, by scope: the page's (`#form`), each step's by its id. */
16
+ export function limitsOf(page) {
17
+ const out = {};
18
+ if (page.data.kind !== 'responses')
19
+ return out;
20
+ if (page.timeLimit)
21
+ out[WHOLE_FORM] = limitOf(WHOLE_FORM, page.timeLimit, false);
22
+ if (page.layout.type === 'wizard')
23
+ for (const step of page.layout.children)
24
+ if (step.timeLimit)
25
+ out[step.id] = limitOf(step.id, step.timeLimit, true);
26
+ return out;
27
+ }
28
+ /** A limit's countdown, started then, read now. */
29
+ export function countdownOf(limit, started, now) {
30
+ const ends = started + limit.ms;
31
+ const left = Math.max(0, ends - now);
32
+ return { ...limit, started, ends, left, stage: left === 0 ? 'up' : left <= limit.warnMs ? 'warning' : 'running' };
33
+ }
34
+ /**
35
+ * The countdown showing now: the page's while it runs (or has run out), else the step's on screen; null where neither
36
+ * has started.
37
+ */
38
+ export function countdownNow(page, timers, step, now) {
39
+ const limits = limitsOf(page);
40
+ const whole = limits[WHOLE_FORM];
41
+ if (whole && timers[WHOLE_FORM] !== undefined)
42
+ return countdownOf(whole, timers[WHOLE_FORM], now);
43
+ const own = step ? limits[step] : undefined;
44
+ if (own && timers[own.scope] !== undefined)
45
+ return countdownOf(own, timers[own.scope], now);
46
+ return null;
47
+ }
48
+ /**
49
+ * A form's time limits: each started limit set to run out on the form's clock; as it does, its answers locked
50
+ * (`state.timeUp`) and — a step's that locks, on screen — the form gone on to the next step. A page's whose answers go
51
+ * as it runs out leaves the send to the viewer (or the app), which watches `timeUp`.
52
+ */
53
+ export function keepTime(host) {
54
+ const { page, scheduler } = host;
55
+ const limits = limitsOf(page);
56
+ const running = new Map();
57
+ const begin = (scope) => {
58
+ const state = host.state();
59
+ if (!limits[scope] || state.timers[scope] !== undefined)
60
+ return;
61
+ host.set({ timers: { ...state.timers, [scope]: host.clock() } });
62
+ kit.arm();
63
+ host.keep();
64
+ };
65
+ function ranOut(scope) {
66
+ running.delete(scope);
67
+ const state = host.state();
68
+ if (host.disposed() || state.timeUp.includes(scope) || state.sent)
69
+ return;
70
+ const shown = host.steps();
71
+ const following = scope !== WHOLE_FORM && limits[scope].then === 'lock' && state.step === scope ? shown[shown.indexOf(scope) + 1] : undefined;
72
+ host.set({ timeUp: [...state.timeUp, scope], ...(following ? { step: following, errors: {} } : {}) });
73
+ }
74
+ const kit = {
75
+ start: () => begin(WHOLE_FORM),
76
+ entered: (step) => begin(step),
77
+ arm() {
78
+ const state = host.state();
79
+ for (const [scope, limit] of Object.entries(limits)) {
80
+ const started = state.timers[scope];
81
+ if (started === undefined || state.timeUp.includes(scope) || running.has(scope))
82
+ continue;
83
+ running.set(scope, scheduler.setTimeout(() => ranOut(scope), Math.max(0, started + limit.ms - host.clock())));
84
+ }
85
+ },
86
+ reset() {
87
+ for (const timer of running.values())
88
+ scheduler.clearTimeout(timer);
89
+ running.clear();
90
+ },
91
+ countdown() {
92
+ const state = host.state();
93
+ const now = countdownNow(page, state.timers, state.step, host.clock());
94
+ return now && state.timeUp.includes(now.scope) ? { ...now, left: 0, stage: 'up' } : now;
95
+ },
96
+ told() {
97
+ const state = host.state();
98
+ const started = state.timers[WHOLE_FORM];
99
+ return started !== undefined ? { started: new Date(started).toISOString(), timeUp: state.timeUp.includes(WHOLE_FORM) } : state.timeUp.length ? { timeUp: false } : {};
100
+ },
101
+ };
102
+ return kit;
103
+ }
104
+ //# sourceMappingURL=timing.mjs.map