@fieldia/core 0.30.1 → 0.31.1
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.
- package/README.md +373 -1
- package/package.json +1 -1
- package/schema/page.schema.json +758 -1
- package/src/index.d.mts +13 -2
- package/src/index.d.ts +13 -2
- package/src/index.js +45 -2
- package/src/index.js.map +1 -1
- package/src/index.mjs +18 -2
- package/src/index.mjs.map +1 -1
- package/src/lib/format/actions.d.mts +16 -16
- package/src/lib/format/actions.d.ts +16 -16
- package/src/lib/format/actions.js +3 -0
- package/src/lib/format/actions.js.map +1 -1
- package/src/lib/format/actions.mjs +3 -0
- package/src/lib/format/actions.mjs.map +1 -1
- package/src/lib/format/address-search.js +3 -0
- package/src/lib/format/address-search.js.map +1 -1
- package/src/lib/format/address-search.mjs +3 -0
- package/src/lib/format/address-search.mjs.map +1 -1
- package/src/lib/format/duplicates.js +3 -0
- package/src/lib/format/duplicates.js.map +1 -1
- package/src/lib/format/duplicates.mjs +3 -0
- package/src/lib/format/duplicates.mjs.map +1 -1
- package/src/lib/format/endings.js +3 -0
- package/src/lib/format/endings.js.map +1 -1
- package/src/lib/format/endings.mjs +3 -0
- package/src/lib/format/endings.mjs.map +1 -1
- package/src/lib/format/field.d.mts +669 -0
- package/src/lib/format/field.d.ts +669 -0
- package/src/lib/format/field.js +42 -4
- package/src/lib/format/field.js.map +1 -1
- package/src/lib/format/field.mjs +42 -4
- package/src/lib/format/field.mjs.map +1 -1
- package/src/lib/format/flow-checks.d.mts +14 -0
- package/src/lib/format/flow-checks.d.ts +14 -0
- package/src/lib/format/flow-checks.js +61 -0
- package/src/lib/format/flow-checks.js.map +1 -0
- package/src/lib/format/flow-checks.mjs +58 -0
- package/src/lib/format/flow-checks.mjs.map +1 -0
- package/src/lib/format/flow.d.mts +43 -0
- package/src/lib/format/flow.d.ts +43 -0
- package/src/lib/format/flow.js +22 -0
- package/src/lib/format/flow.js.map +1 -0
- package/src/lib/format/flow.mjs +19 -0
- package/src/lib/format/flow.mjs.map +1 -0
- package/src/lib/format/from-schema.d.mts +70 -0
- package/src/lib/format/from-schema.d.ts +70 -0
- package/src/lib/format/from-schema.js +599 -0
- package/src/lib/format/from-schema.js.map +1 -0
- package/src/lib/format/from-schema.mjs +591 -0
- package/src/lib/format/from-schema.mjs.map +1 -0
- package/src/lib/format/jitless.d.mts +1 -0
- package/src/lib/format/jitless.d.ts +1 -0
- package/src/lib/format/jitless.js +27 -0
- package/src/lib/format/jitless.js.map +1 -0
- package/src/lib/format/jitless.mjs +24 -0
- package/src/lib/format/jitless.mjs.map +1 -0
- package/src/lib/format/json-schema.js +3 -0
- package/src/lib/format/json-schema.js.map +1 -1
- package/src/lib/format/json-schema.mjs +3 -0
- package/src/lib/format/json-schema.mjs.map +1 -1
- package/src/lib/format/json.js +3 -0
- package/src/lib/format/json.js.map +1 -1
- package/src/lib/format/json.mjs +3 -0
- package/src/lib/format/json.mjs.map +1 -1
- package/src/lib/format/languages-checks.d.mts +2 -1
- package/src/lib/format/languages-checks.d.ts +2 -1
- package/src/lib/format/languages-checks.js +8 -2
- package/src/lib/format/languages-checks.js.map +1 -1
- package/src/lib/format/languages-checks.mjs +8 -2
- package/src/lib/format/languages-checks.mjs.map +1 -1
- package/src/lib/format/later-checks.d.mts +3 -1
- package/src/lib/format/later-checks.d.ts +3 -1
- package/src/lib/format/later-checks.js +3 -1
- package/src/lib/format/later-checks.js.map +1 -1
- package/src/lib/format/later-checks.mjs +3 -1
- package/src/lib/format/later-checks.mjs.map +1 -1
- package/src/lib/format/layout.d.mts +13192 -7550
- package/src/lib/format/layout.d.ts +13192 -7550
- package/src/lib/format/layout.js +61 -3
- package/src/lib/format/layout.js.map +1 -1
- package/src/lib/format/layout.mjs +59 -1
- package/src/lib/format/layout.mjs.map +1 -1
- package/src/lib/format/layout.types.d.mts +3 -1
- package/src/lib/format/layout.types.d.ts +3 -1
- package/src/lib/format/limits.js +3 -0
- package/src/lib/format/limits.js.map +1 -1
- package/src/lib/format/limits.mjs +3 -0
- package/src/lib/format/limits.mjs.map +1 -1
- package/src/lib/format/list-checks.d.mts +1 -1
- package/src/lib/format/list-checks.d.ts +1 -1
- package/src/lib/format/list-checks.js +67 -22
- package/src/lib/format/list-checks.js.map +1 -1
- package/src/lib/format/list-checks.mjs +67 -22
- package/src/lib/format/list-checks.mjs.map +1 -1
- package/src/lib/format/list-rows-checks.d.mts +11 -0
- package/src/lib/format/list-rows-checks.d.ts +11 -0
- package/src/lib/format/list-rows-checks.js +62 -0
- package/src/lib/format/list-rows-checks.js.map +1 -0
- package/src/lib/format/list-rows-checks.mjs +59 -0
- package/src/lib/format/list-rows-checks.mjs.map +1 -0
- package/src/lib/format/media-options.d.mts +84 -0
- package/src/lib/format/media-options.d.ts +84 -0
- package/src/lib/format/media-options.js +86 -0
- package/src/lib/format/media-options.js.map +1 -0
- package/src/lib/format/media-options.mjs +80 -0
- package/src/lib/format/media-options.mjs.map +1 -0
- package/src/lib/format/outbox-checks.d.mts +11 -0
- package/src/lib/format/outbox-checks.d.ts +11 -0
- package/src/lib/format/outbox-checks.js +12 -0
- package/src/lib/format/outbox-checks.js.map +1 -0
- package/src/lib/format/outbox-checks.mjs +9 -0
- package/src/lib/format/outbox-checks.mjs.map +1 -0
- package/src/lib/format/page.d.mts +3057 -966
- package/src/lib/format/page.d.ts +3057 -966
- package/src/lib/format/page.js +15 -0
- package/src/lib/format/page.js.map +1 -1
- package/src/lib/format/page.mjs +15 -0
- package/src/lib/format/page.mjs.map +1 -1
- package/src/lib/format/part-checks.d.mts +3 -0
- package/src/lib/format/part-checks.d.ts +3 -0
- package/src/lib/format/payment-checks.d.mts +13 -0
- package/src/lib/format/payment-checks.d.ts +13 -0
- package/src/lib/format/payment-checks.js +30 -0
- package/src/lib/format/payment-checks.js.map +1 -0
- package/src/lib/format/payment-checks.mjs +27 -0
- package/src/lib/format/payment-checks.mjs.map +1 -0
- package/src/lib/format/payment.d.mts +37 -0
- package/src/lib/format/payment.d.ts +37 -0
- package/src/lib/format/payment.js +15 -0
- package/src/lib/format/payment.js.map +1 -0
- package/src/lib/format/payment.mjs +12 -0
- package/src/lib/format/payment.mjs.map +1 -0
- package/src/lib/format/phone.js +3 -0
- package/src/lib/format/phone.js.map +1 -1
- package/src/lib/format/phone.mjs +3 -0
- package/src/lib/format/phone.mjs.map +1 -1
- package/src/lib/format/picker-options.d.mts +12 -0
- package/src/lib/format/picker-options.d.ts +12 -0
- package/src/lib/format/picker-options.js +21 -3
- package/src/lib/format/picker-options.js.map +1 -1
- package/src/lib/format/picker-options.mjs +20 -2
- package/src/lib/format/picker-options.mjs.map +1 -1
- package/src/lib/format/prefill-checks.d.mts +13 -0
- package/src/lib/format/prefill-checks.d.ts +13 -0
- package/src/lib/format/prefill-checks.js +35 -0
- package/src/lib/format/prefill-checks.js.map +1 -0
- package/src/lib/format/prefill-checks.mjs +32 -0
- package/src/lib/format/prefill-checks.mjs.map +1 -0
- package/src/lib/format/prefill.d.mts +33 -0
- package/src/lib/format/prefill.d.ts +33 -0
- package/src/lib/format/prefill.js +20 -0
- package/src/lib/format/prefill.js.map +1 -0
- package/src/lib/format/prefill.mjs +17 -0
- package/src/lib/format/prefill.mjs.map +1 -0
- package/src/lib/format/quiz.d.mts +58 -0
- package/src/lib/format/quiz.d.ts +58 -0
- package/src/lib/format/quiz.js +24 -0
- package/src/lib/format/quiz.js.map +1 -0
- package/src/lib/format/quiz.mjs +21 -0
- package/src/lib/format/quiz.mjs.map +1 -0
- package/src/lib/format/records.js +3 -0
- package/src/lib/format/records.js.map +1 -1
- package/src/lib/format/records.mjs +3 -0
- package/src/lib/format/records.mjs.map +1 -1
- package/src/lib/format/references.d.mts +1 -1
- package/src/lib/format/references.d.ts +1 -1
- package/src/lib/format/references.js +56 -7
- package/src/lib/format/references.js.map +1 -1
- package/src/lib/format/references.mjs +57 -8
- package/src/lib/format/references.mjs.map +1 -1
- package/src/lib/format/schedule-checks.d.mts +8 -0
- package/src/lib/format/schedule-checks.d.ts +8 -0
- package/src/lib/format/schedule-checks.js +16 -0
- package/src/lib/format/schedule-checks.js.map +1 -0
- package/src/lib/format/schedule-checks.mjs +13 -0
- package/src/lib/format/schedule-checks.mjs.map +1 -0
- package/src/lib/format/signature-checks.d.mts +8 -0
- package/src/lib/format/signature-checks.d.ts +8 -0
- package/src/lib/format/signature-checks.js +21 -0
- package/src/lib/format/signature-checks.js.map +1 -1
- package/src/lib/format/signature-checks.mjs +20 -0
- package/src/lib/format/signature-checks.mjs.map +1 -1
- package/src/lib/format/signature-options.js +3 -0
- package/src/lib/format/signature-options.js.map +1 -1
- package/src/lib/format/signature-options.mjs +3 -0
- package/src/lib/format/signature-options.mjs.map +1 -1
- package/src/lib/format/slots-options.js +3 -0
- package/src/lib/format/slots-options.js.map +1 -1
- package/src/lib/format/slots-options.mjs +3 -0
- package/src/lib/format/slots-options.mjs.map +1 -1
- package/src/lib/format/templates-checks.d.mts +6 -0
- package/src/lib/format/templates-checks.d.ts +6 -0
- package/src/lib/format/templates-checks.js +16 -0
- package/src/lib/format/templates-checks.js.map +1 -0
- package/src/lib/format/templates-checks.mjs +13 -0
- package/src/lib/format/templates-checks.mjs.map +1 -0
- package/src/lib/format/translate.d.mts +2 -0
- package/src/lib/format/translate.d.ts +2 -0
- package/src/lib/format/translate.js +6 -2
- package/src/lib/format/translate.js.map +1 -1
- package/src/lib/format/translate.mjs +4 -2
- package/src/lib/format/translate.mjs.map +1 -1
- package/src/lib/format/typed-options.d.mts +43 -0
- package/src/lib/format/typed-options.d.ts +43 -0
- package/src/lib/format/typed-options.js +50 -0
- package/src/lib/format/typed-options.js.map +1 -0
- package/src/lib/format/typed-options.mjs +46 -0
- package/src/lib/format/typed-options.mjs.map +1 -0
- package/src/lib/format/upgrade.d.mts +5 -1
- package/src/lib/format/upgrade.d.ts +5 -1
- package/src/lib/format/upgrade.js +5 -1
- package/src/lib/format/upgrade.js.map +1 -1
- package/src/lib/format/upgrade.mjs +5 -1
- package/src/lib/format/upgrade.mjs.map +1 -1
- package/src/lib/format/validate.js +3 -0
- package/src/lib/format/validate.js.map +1 -1
- package/src/lib/format/validate.mjs +3 -0
- package/src/lib/format/validate.mjs.map +1 -1
- package/src/lib/format/verify-checks.d.mts +10 -0
- package/src/lib/format/verify-checks.d.ts +10 -0
- package/src/lib/format/verify-checks.js +44 -0
- package/src/lib/format/verify-checks.js.map +1 -0
- package/src/lib/format/verify-checks.mjs +41 -0
- package/src/lib/format/verify-checks.mjs.map +1 -0
- package/src/lib/format/version.d.mts +2 -2
- package/src/lib/format/version.d.ts +2 -2
- package/src/lib/format/version.js +2 -2
- package/src/lib/format/version.js.map +1 -1
- package/src/lib/format/version.mjs +2 -2
- package/src/lib/format/version.mjs.map +1 -1
- package/src/lib/format/week.d.mts +18 -0
- package/src/lib/format/week.d.ts +18 -0
- package/src/lib/format/week.js +58 -0
- package/src/lib/format/week.js.map +1 -0
- package/src/lib/format/week.mjs +55 -0
- package/src/lib/format/week.mjs.map +1 -0
- package/src/lib/record/approvals-part.d.mts +1 -1
- package/src/lib/record/approvals-part.d.ts +1 -1
- package/src/lib/record/approvals-part.js +2 -2
- package/src/lib/record/approvals-part.js.map +1 -1
- package/src/lib/record/approvals-part.mjs +1 -1
- package/src/lib/record/approvals-part.mjs.map +1 -1
- package/src/lib/record/data-source.d.mts +348 -5
- package/src/lib/record/data-source.d.ts +348 -5
- package/src/lib/record/data-source.js.map +1 -1
- package/src/lib/record/data-source.mjs.map +1 -1
- package/src/lib/record/day-words.d.mts +22 -1
- package/src/lib/record/day-words.d.ts +22 -1
- package/src/lib/record/day-words.js +29 -2
- package/src/lib/record/day-words.js.map +1 -1
- package/src/lib/record/day-words.mjs +24 -2
- package/src/lib/record/day-words.mjs.map +1 -1
- package/src/lib/record/drafts.d.mts +9 -0
- package/src/lib/record/drafts.d.ts +9 -0
- package/src/lib/record/drafts.js +20 -0
- package/src/lib/record/drafts.js.map +1 -1
- package/src/lib/record/drafts.mjs +19 -0
- package/src/lib/record/drafts.mjs.map +1 -1
- package/src/lib/record/files-part.d.mts +1 -0
- package/src/lib/record/files-part.d.ts +1 -0
- package/src/lib/record/files-part.js +7 -1
- package/src/lib/record/files-part.js.map +1 -1
- package/src/lib/record/files-part.mjs +5 -1
- package/src/lib/record/files-part.mjs.map +1 -1
- package/src/lib/record/form-approvals.d.mts +12 -17
- package/src/lib/record/form-approvals.d.ts +12 -17
- package/src/lib/record/form-approvals.js +19 -9
- package/src/lib/record/form-approvals.js.map +1 -1
- package/src/lib/record/form-approvals.mjs +18 -8
- package/src/lib/record/form-approvals.mjs.map +1 -1
- package/src/lib/record/form-limits.d.mts +4 -28
- package/src/lib/record/form-limits.d.ts +4 -28
- package/src/lib/record/form-limits.js +8 -5
- package/src/lib/record/form-limits.js.map +1 -1
- package/src/lib/record/form-limits.mjs +8 -5
- package/src/lib/record/form-limits.mjs.map +1 -1
- package/src/lib/record/form.d.mts +118 -3
- package/src/lib/record/form.d.ts +118 -3
- package/src/lib/record/form.js +283 -75
- package/src/lib/record/form.js.map +1 -1
- package/src/lib/record/form.mjs +285 -77
- package/src/lib/record/form.mjs.map +1 -1
- package/src/lib/record/history-steps.d.mts +38 -0
- package/src/lib/record/history-steps.d.ts +38 -0
- package/src/lib/record/history-steps.js +63 -0
- package/src/lib/record/history-steps.js.map +1 -0
- package/src/lib/record/history-steps.mjs +58 -0
- package/src/lib/record/history-steps.mjs.map +1 -0
- package/src/lib/record/history.d.mts +16 -0
- package/src/lib/record/history.d.ts +16 -0
- package/src/lib/record/history.js +3 -0
- package/src/lib/record/history.js.map +1 -0
- package/src/lib/record/history.mjs +2 -0
- package/src/lib/record/history.mjs.map +1 -0
- package/src/lib/record/input-rules.d.mts +2 -0
- package/src/lib/record/input-rules.d.ts +2 -0
- package/src/lib/record/input-rules.js +4 -1
- package/src/lib/record/input-rules.js.map +1 -1
- package/src/lib/record/input-rules.mjs +2 -0
- package/src/lib/record/input-rules.mjs.map +1 -1
- package/src/lib/record/joins.d.mts +143 -0
- package/src/lib/record/joins.d.ts +143 -0
- package/src/lib/record/joins.js +28 -0
- package/src/lib/record/joins.js.map +1 -0
- package/src/lib/record/joins.mjs +24 -0
- package/src/lib/record/joins.mjs.map +1 -0
- package/src/lib/record/limits.js +7 -4
- package/src/lib/record/limits.js.map +1 -1
- package/src/lib/record/limits.mjs +8 -5
- package/src/lib/record/limits.mjs.map +1 -1
- package/src/lib/record/link-values.d.mts +31 -0
- package/src/lib/record/link-values.d.ts +31 -0
- package/src/lib/record/link-values.js +132 -0
- package/src/lib/record/link-values.js.map +1 -0
- package/src/lib/record/link-values.mjs +125 -0
- package/src/lib/record/link-values.mjs.map +1 -0
- package/src/lib/record/live-later.d.mts +15 -0
- package/src/lib/record/live-later.d.ts +15 -0
- package/src/lib/record/live-later.js +10 -0
- package/src/lib/record/live-later.js.map +1 -0
- package/src/lib/record/live-later.mjs +7 -0
- package/src/lib/record/live-later.mjs.map +1 -0
- package/src/lib/record/live-part.d.mts +6 -0
- package/src/lib/record/live-part.d.ts +6 -0
- package/src/lib/record/live-part.js +12 -0
- package/src/lib/record/live-part.js.map +1 -0
- package/src/lib/record/live-part.mjs +7 -0
- package/src/lib/record/live-part.mjs.map +1 -0
- package/src/lib/record/live.d.mts +8 -0
- package/src/lib/record/live.d.ts +8 -0
- package/src/lib/record/live.js +133 -0
- package/src/lib/record/live.js.map +1 -0
- package/src/lib/record/live.mjs +129 -0
- package/src/lib/record/live.mjs.map +1 -0
- package/src/lib/record/locales/all.d.mts +5 -5
- package/src/lib/record/locales/all.d.ts +5 -5
- package/src/lib/record/locales/all.js +3 -3
- package/src/lib/record/locales/all.js.map +1 -1
- package/src/lib/record/locales/all.mjs +3 -3
- package/src/lib/record/locales/all.mjs.map +1 -1
- package/src/lib/record/locales/ar.js +8 -0
- package/src/lib/record/locales/ar.js.map +1 -1
- package/src/lib/record/locales/ar.mjs +8 -0
- package/src/lib/record/locales/ar.mjs.map +1 -1
- package/src/lib/record/locales/de.js +8 -0
- package/src/lib/record/locales/de.js.map +1 -1
- package/src/lib/record/locales/de.mjs +8 -0
- package/src/lib/record/locales/de.mjs.map +1 -1
- package/src/lib/record/locales/es.d.mts +8 -0
- package/src/lib/record/locales/es.d.ts +8 -0
- package/src/lib/record/locales/es.js +111 -0
- package/src/lib/record/locales/es.js.map +1 -0
- package/src/lib/record/locales/es.mjs +108 -0
- package/src/lib/record/locales/es.mjs.map +1 -0
- package/src/lib/record/locales/fa.d.mts +5 -0
- package/src/lib/record/locales/fa.d.ts +5 -0
- package/src/lib/record/locales/fa.js +117 -0
- package/src/lib/record/locales/fa.js.map +1 -0
- package/src/lib/record/locales/fa.mjs +114 -0
- package/src/lib/record/locales/fa.mjs.map +1 -0
- package/src/lib/record/locales/fr.js +8 -0
- package/src/lib/record/locales/fr.js.map +1 -1
- package/src/lib/record/locales/fr.mjs +8 -0
- package/src/lib/record/locales/fr.mjs.map +1 -1
- package/src/lib/record/locales/later.d.mts +8 -0
- package/src/lib/record/locales/later.d.ts +8 -0
- package/src/lib/record/locales/later.js +16 -0
- package/src/lib/record/locales/later.js.map +1 -0
- package/src/lib/record/locales/later.mjs +13 -0
- package/src/lib/record/locales/later.mjs.map +1 -0
- package/src/lib/record/locales/tr.d.mts +6 -0
- package/src/lib/record/locales/tr.d.ts +6 -0
- package/src/lib/record/locales/tr.js +118 -0
- package/src/lib/record/locales/tr.js.map +1 -0
- package/src/lib/record/locales/tr.mjs +115 -0
- package/src/lib/record/locales/tr.mjs.map +1 -0
- package/src/lib/record/locales/ur.d.mts +9 -0
- package/src/lib/record/locales/ur.d.ts +9 -0
- package/src/lib/record/locales/ur.js +118 -0
- package/src/lib/record/locales/ur.js.map +1 -0
- package/src/lib/record/locales/ur.mjs +115 -0
- package/src/lib/record/locales/ur.mjs.map +1 -0
- package/src/lib/record/memory-approvals.d.mts +4 -1
- package/src/lib/record/memory-approvals.d.ts +4 -1
- package/src/lib/record/memory-approvals.js +29 -0
- package/src/lib/record/memory-approvals.js.map +1 -1
- package/src/lib/record/memory-approvals.mjs +29 -0
- package/src/lib/record/memory-approvals.mjs.map +1 -1
- package/src/lib/record/memory-codes.d.mts +37 -0
- package/src/lib/record/memory-codes.d.ts +37 -0
- package/src/lib/record/memory-codes.js +50 -0
- package/src/lib/record/memory-codes.js.map +1 -0
- package/src/lib/record/memory-codes.mjs +47 -0
- package/src/lib/record/memory-codes.mjs.map +1 -0
- package/src/lib/record/memory-data-source.d.mts +56 -2
- package/src/lib/record/memory-data-source.d.ts +56 -2
- package/src/lib/record/memory-data-source.js +80 -2
- package/src/lib/record/memory-data-source.js.map +1 -1
- package/src/lib/record/memory-data-source.mjs +80 -2
- package/src/lib/record/memory-data-source.mjs.map +1 -1
- package/src/lib/record/memory-kept.d.mts +3 -1
- package/src/lib/record/memory-kept.d.ts +3 -1
- package/src/lib/record/memory-kept.js +7 -2
- package/src/lib/record/memory-kept.js.map +1 -1
- package/src/lib/record/memory-kept.mjs +7 -2
- package/src/lib/record/memory-kept.mjs.map +1 -1
- package/src/lib/record/memory-later.d.mts +3 -1
- package/src/lib/record/memory-later.d.ts +3 -1
- package/src/lib/record/memory-later.js +9 -5
- package/src/lib/record/memory-later.js.map +1 -1
- package/src/lib/record/memory-later.mjs +8 -4
- package/src/lib/record/memory-later.mjs.map +1 -1
- package/src/lib/record/memory-live.d.mts +8 -0
- package/src/lib/record/memory-live.d.ts +8 -0
- package/src/lib/record/memory-live.js +70 -0
- package/src/lib/record/memory-live.js.map +1 -0
- package/src/lib/record/memory-live.mjs +67 -0
- package/src/lib/record/memory-live.mjs.map +1 -0
- package/src/lib/record/memory-views.d.mts +11 -0
- package/src/lib/record/memory-views.d.ts +11 -0
- package/src/lib/record/memory-views.js +68 -0
- package/src/lib/record/memory-views.js.map +1 -0
- package/src/lib/record/memory-views.mjs +65 -0
- package/src/lib/record/memory-views.mjs.map +1 -0
- package/src/lib/record/messages.d.mts +21 -3
- package/src/lib/record/messages.d.ts +21 -3
- package/src/lib/record/messages.js +15 -2
- package/src/lib/record/messages.js.map +1 -1
- package/src/lib/record/messages.mjs +15 -2
- package/src/lib/record/messages.mjs.map +1 -1
- package/src/lib/record/order.d.mts +21 -0
- package/src/lib/record/order.d.ts +21 -0
- package/src/lib/record/order.js +129 -0
- package/src/lib/record/order.js.map +1 -0
- package/src/lib/record/order.mjs +122 -0
- package/src/lib/record/order.mjs.map +1 -0
- package/src/lib/record/outbox-form.d.mts +79 -0
- package/src/lib/record/outbox-form.d.ts +79 -0
- package/src/lib/record/outbox-form.js +291 -0
- package/src/lib/record/outbox-form.js.map +1 -0
- package/src/lib/record/outbox-form.mjs +286 -0
- package/src/lib/record/outbox-form.mjs.map +1 -0
- package/src/lib/record/outbox-part.d.mts +6 -0
- package/src/lib/record/outbox-part.d.ts +6 -0
- package/src/lib/record/outbox-part.js +13 -0
- package/src/lib/record/outbox-part.js.map +1 -0
- package/src/lib/record/outbox-part.mjs +7 -0
- package/src/lib/record/outbox-part.mjs.map +1 -0
- package/src/lib/record/pay-part.d.mts +6 -0
- package/src/lib/record/pay-part.d.ts +6 -0
- package/src/lib/record/pay-part.js +11 -0
- package/src/lib/record/pay-part.js.map +1 -0
- package/src/lib/record/pay-part.mjs +7 -0
- package/src/lib/record/pay-part.mjs.map +1 -0
- package/src/lib/record/payment-form.d.mts +25 -0
- package/src/lib/record/payment-form.d.ts +25 -0
- package/src/lib/record/payment-form.js +98 -0
- package/src/lib/record/payment-form.js.map +1 -0
- package/src/lib/record/payment-form.mjs +95 -0
- package/src/lib/record/payment-form.mjs.map +1 -0
- package/src/lib/record/prefill-part.d.mts +7 -0
- package/src/lib/record/prefill-part.d.ts +7 -0
- package/src/lib/record/prefill-part.js +15 -0
- package/src/lib/record/prefill-part.js.map +1 -0
- package/src/lib/record/prefill-part.mjs +8 -0
- package/src/lib/record/prefill-part.mjs.map +1 -0
- package/src/lib/record/press-undo.d.mts +42 -0
- package/src/lib/record/press-undo.d.ts +42 -0
- package/src/lib/record/press-undo.js +115 -0
- package/src/lib/record/press-undo.js.map +1 -0
- package/src/lib/record/press-undo.mjs +110 -0
- package/src/lib/record/press-undo.mjs.map +1 -0
- package/src/lib/record/quiz.d.mts +36 -0
- package/src/lib/record/quiz.d.ts +36 -0
- package/src/lib/record/quiz.js +90 -0
- package/src/lib/record/quiz.js.map +1 -0
- package/src/lib/record/quiz.mjs +87 -0
- package/src/lib/record/quiz.mjs.map +1 -0
- package/src/lib/record/record-words.js +1 -1
- package/src/lib/record/record-words.js.map +1 -1
- package/src/lib/record/record-words.mjs +1 -1
- package/src/lib/record/record-words.mjs.map +1 -1
- package/src/lib/record/run.d.mts +54 -2
- package/src/lib/record/run.d.ts +54 -2
- package/src/lib/record/run.js +30 -6
- package/src/lib/record/run.js.map +1 -1
- package/src/lib/record/run.mjs +28 -5
- package/src/lib/record/run.mjs.map +1 -1
- package/src/lib/record/survey-kit.d.mts +37 -0
- package/src/lib/record/survey-kit.d.ts +37 -0
- package/src/lib/record/survey-kit.js +110 -0
- package/src/lib/record/survey-kit.js.map +1 -0
- package/src/lib/record/survey-kit.mjs +107 -0
- package/src/lib/record/survey-kit.mjs.map +1 -0
- package/src/lib/record/survey.d.mts +16 -0
- package/src/lib/record/survey.d.ts +16 -0
- package/src/lib/record/survey.js +17 -0
- package/src/lib/record/survey.js.map +1 -0
- package/src/lib/record/survey.mjs +13 -0
- package/src/lib/record/survey.mjs.map +1 -0
- package/src/lib/record/surveyflow-part.d.mts +9 -0
- package/src/lib/record/surveyflow-part.d.ts +9 -0
- package/src/lib/record/surveyflow-part.js +20 -0
- package/src/lib/record/surveyflow-part.js.map +1 -0
- package/src/lib/record/surveyflow-part.mjs +10 -0
- package/src/lib/record/surveyflow-part.mjs.map +1 -0
- package/src/lib/record/timing.d.mts +76 -0
- package/src/lib/record/timing.d.ts +76 -0
- package/src/lib/record/timing.js +112 -0
- package/src/lib/record/timing.js.map +1 -0
- package/src/lib/record/timing.mjs +104 -0
- package/src/lib/record/timing.mjs.map +1 -0
- package/src/lib/record/undo-later.d.mts +9 -0
- package/src/lib/record/undo-later.d.ts +9 -0
- package/src/lib/record/undo-later.js +10 -0
- package/src/lib/record/undo-later.js.map +1 -0
- package/src/lib/record/undo-later.mjs +7 -0
- package/src/lib/record/undo-later.mjs.map +1 -0
- package/src/lib/record/undo-part.d.mts +8 -0
- package/src/lib/record/undo-part.d.ts +8 -0
- package/src/lib/record/undo-part.js +17 -0
- package/src/lib/record/undo-part.js.map +1 -0
- package/src/lib/record/undo-part.mjs +9 -0
- package/src/lib/record/undo-part.mjs.map +1 -0
- package/src/lib/record/upload-to-later.d.mts +10 -0
- package/src/lib/record/upload-to-later.d.ts +10 -0
- package/src/lib/record/upload-to-later.js +15 -0
- package/src/lib/record/upload-to-later.js.map +1 -0
- package/src/lib/record/upload-to-later.mjs +12 -0
- package/src/lib/record/upload-to-later.mjs.map +1 -0
- package/src/lib/record/uploads.d.mts +5 -0
- package/src/lib/record/uploads.d.ts +5 -0
- package/src/lib/record/uploads.js.map +1 -1
- package/src/lib/record/uploads.mjs.map +1 -1
- package/src/lib/record/values.d.mts +6 -0
- package/src/lib/record/values.d.ts +6 -0
- package/src/lib/record/values.js.map +1 -1
- package/src/lib/record/values.mjs.map +1 -1
- package/src/lib/record/verify-form.d.mts +24 -0
- package/src/lib/record/verify-form.d.ts +24 -0
- package/src/lib/record/verify-form.js +65 -0
- package/src/lib/record/verify-form.js.map +1 -0
- package/src/lib/record/verify-form.mjs +62 -0
- package/src/lib/record/verify-form.mjs.map +1 -0
- package/src/lib/record/verify-part.d.mts +6 -0
- package/src/lib/record/verify-part.d.ts +6 -0
- package/src/lib/record/verify-part.js +11 -0
- package/src/lib/record/verify-part.js.map +1 -0
- package/src/lib/record/verify-part.mjs +7 -0
- package/src/lib/record/verify-part.mjs.map +1 -0
- package/src/lib/record/words-chunks.d.mts +37 -0
- package/src/lib/record/words-chunks.d.ts +37 -0
- package/src/lib/record/words-chunks.js +94 -0
- package/src/lib/record/words-chunks.js.map +1 -0
- package/src/lib/record/words-chunks.mjs +86 -0
- package/src/lib/record/words-chunks.mjs.map +1 -0
- package/src/runtime.d.mts +28 -6
- package/src/runtime.d.ts +28 -6
- package/src/runtime.js +35 -6
- package/src/runtime.js.map +1 -1
- package/src/runtime.mjs +15 -3
- package/src/runtime.mjs.map +1 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { StoredDraft } from './data-source';
|
|
2
|
+
import type { FormInner, FormJoin } from './joins';
|
|
3
|
+
import { type QuizResults } from './quiz';
|
|
4
|
+
import type { Values } from './values';
|
|
5
|
+
import { type Countdown } from './timing';
|
|
6
|
+
/**
|
|
7
|
+
* A survey's draw and clocks, kept for a form by the survey flow's part (survey.ts, `formSurveyPart`): the order drawn for each
|
|
8
|
+
* respondent and the parts it leaves out (order.ts), and a page's time limits (timing.ts) — what the form asks of them
|
|
9
|
+
* at its moments: a part hidden or locked, a draft kept and laid, a send told, a response started again, a step entered.
|
|
10
|
+
*/
|
|
11
|
+
/** A form's survey draw and clocks (`join`; `form.joined('surveyflow')`): its hooks into the form, and its own. */
|
|
12
|
+
export interface SurveyKit extends FormJoin {
|
|
13
|
+
/** Whether a part was left out by the draw: never shown, asked, required or sent. */
|
|
14
|
+
hides(id: string): boolean;
|
|
15
|
+
/** Whether a part's time ran out — the page's, or that of the step it is on: locked, its checks refusing nothing. */
|
|
16
|
+
locks(id: string): boolean;
|
|
17
|
+
/** What a draft keeps of them: the draw, the clocks' starts. */
|
|
18
|
+
kept(): Pick<StoredDraft, 'order' | 'timers'>;
|
|
19
|
+
/** A draft laid: its draw where the page still has it, its clocks going on from their starts. */
|
|
20
|
+
lay(draft: StoredDraft): void;
|
|
21
|
+
/** Started again, a new respondent: drawn anew (unless the app or the person's id is the seed), no clock running, on the first step drawn. */
|
|
22
|
+
reset(): void;
|
|
23
|
+
/** A step entered: its own clock starts the first time. */
|
|
24
|
+
entered(step: string): void;
|
|
25
|
+
/** The page's clock started: its Start pressed. */
|
|
26
|
+
start(): void;
|
|
27
|
+
/** The countdown showing now. */
|
|
28
|
+
countdown(): Countdown | null;
|
|
29
|
+
/** A quiz's results for the answers as sent (`quiz` on the page), in the order they were asked; undefined where it has none. */
|
|
30
|
+
marked(values: Values): QuizResults | undefined;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* 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
|
|
34
|
+
* none yet — its first step the drawn one's while the person has not moved — and what a response is sent with told
|
|
35
|
+
* (`around`: the order shown, when the page's clock started and whether it ran out).
|
|
36
|
+
*/
|
|
37
|
+
export declare function join(host: FormInner): SurveyKit;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.join = join;
|
|
4
|
+
const order_1 = require("./order");
|
|
5
|
+
const quiz_1 = require("./quiz");
|
|
6
|
+
const timing_1 = require("./timing");
|
|
7
|
+
/**
|
|
8
|
+
* 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
|
|
9
|
+
* none yet — its first step the drawn one's while the person has not moved — and what a response is sent with told
|
|
10
|
+
* (`around`: the order shown, when the page's clock started and whether it ran out).
|
|
11
|
+
*/
|
|
12
|
+
function join(host) {
|
|
13
|
+
const { page, form } = host;
|
|
14
|
+
const drawn = (0, order_1.drawsOrder)(page);
|
|
15
|
+
const time = (0, timing_1.keepTime)({ page, scheduler: host.scheduler, clock: () => form.now().getTime(), state: () => form.getState(), set: host.set, steps: () => form.steps(), disposed: host.disposed, keep: host.keep });
|
|
16
|
+
const user = form.user()?.id;
|
|
17
|
+
const seed = host.options.seed ?? (user != null ? String(user) : null);
|
|
18
|
+
/** Each part's parts, by its id — what a draw kept in a draft may name — and the part each sits in. */
|
|
19
|
+
const partsOf = new Map();
|
|
20
|
+
const parents = new Map();
|
|
21
|
+
const walk = (node) => {
|
|
22
|
+
const children = Array.isArray(node.children) ? node.children : [];
|
|
23
|
+
if (node.id)
|
|
24
|
+
partsOf.set(node.id, new Set(children.map((child) => child.id ?? '')));
|
|
25
|
+
for (const child of children)
|
|
26
|
+
if (node.id && child.id)
|
|
27
|
+
parents.set(child.id, node.id);
|
|
28
|
+
children.forEach(walk);
|
|
29
|
+
};
|
|
30
|
+
walk(page.layout);
|
|
31
|
+
let undrawn = new Set();
|
|
32
|
+
/** The steps and the parts left out, as an order has them. */
|
|
33
|
+
function take(order) {
|
|
34
|
+
undrawn = new Set();
|
|
35
|
+
for (const [id, list] of Object.entries(order ?? {}))
|
|
36
|
+
for (const part of partsOf.get(id) ?? [])
|
|
37
|
+
if (!list.includes(part))
|
|
38
|
+
undrawn.add(part);
|
|
39
|
+
host.order((page.layout.type === 'wizard' && order?.[page.layout.id]) || null);
|
|
40
|
+
}
|
|
41
|
+
const draw = () => (0, order_1.drawOrder)(page, seed ?? Math.random().toString(36).slice(2));
|
|
42
|
+
/** An order set, the first step the drawn one's while the person has not moved. */
|
|
43
|
+
function placed(order) {
|
|
44
|
+
const was = form.steps()[0];
|
|
45
|
+
take(order);
|
|
46
|
+
host.set({ order, ...(form.getState().step === was ? { step: form.steps()[0] ?? null } : {}) });
|
|
47
|
+
}
|
|
48
|
+
/** What a response is sent with of them: the order shown, when the page's clock started and whether it ran out. */
|
|
49
|
+
const told = () => {
|
|
50
|
+
const order = form.getState().order;
|
|
51
|
+
return { ...(order ? { order: order } : {}), ...time.told() };
|
|
52
|
+
};
|
|
53
|
+
/** The answers and the step last kept while a clock runs. */
|
|
54
|
+
let keptAs = [];
|
|
55
|
+
const kit = {
|
|
56
|
+
hides: (id) => undrawn.has(id),
|
|
57
|
+
locks(id) {
|
|
58
|
+
const up = form.getState().timeUp;
|
|
59
|
+
if (!up.length)
|
|
60
|
+
return false;
|
|
61
|
+
if (up.includes(timing_1.WHOLE_FORM))
|
|
62
|
+
return true;
|
|
63
|
+
for (let at = id; at; at = parents.get(at))
|
|
64
|
+
if (up.includes(at))
|
|
65
|
+
return true;
|
|
66
|
+
return false;
|
|
67
|
+
},
|
|
68
|
+
kept() {
|
|
69
|
+
const state = form.getState();
|
|
70
|
+
return {
|
|
71
|
+
...(state.order ? { order: state.order } : {}),
|
|
72
|
+
...(Object.keys(state.timers).length ? { timers: Object.fromEntries(Object.entries(state.timers).map(([scope, at]) => [scope, new Date(at).toISOString()])) } : {}),
|
|
73
|
+
};
|
|
74
|
+
},
|
|
75
|
+
lay(draft) {
|
|
76
|
+
// Its draw, where every part it names is still the page's with the parts it lists.
|
|
77
|
+
const kept = Object.entries(draft.order ?? {}).filter(([id, list]) => partsOf.has(id) && Array.isArray(list) && list.every((one) => partsOf.get(id)?.has(one)));
|
|
78
|
+
if (drawn && kept.length)
|
|
79
|
+
placed(Object.fromEntries(kept));
|
|
80
|
+
const timers = Object.entries(draft.timers ?? {}).filter(([, at]) => typeof at === 'string' && !Number.isNaN(Date.parse(at)));
|
|
81
|
+
if (timers.length) {
|
|
82
|
+
host.set({ timers: { ...form.getState().timers, ...Object.fromEntries(timers.map(([scope, at]) => [scope, Date.parse(at)])) } });
|
|
83
|
+
time.arm();
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
around: (kind, sent, go) => go(kind === 'submit' ? { ...sent, ...told() } : sent),
|
|
87
|
+
changed() {
|
|
88
|
+
// While a clock runs, each answer given is kept at once, never a moment later: a reload loses nothing typed, nor
|
|
89
|
+
// gains the time it took. Nothing once sent, or started again with nothing given.
|
|
90
|
+
const state = form.getState();
|
|
91
|
+
if (state.sent || !state.dirty.length || !Object.keys(state.timers).length || (state.values === keptAs[0] && state.step === keptAs[1]))
|
|
92
|
+
return;
|
|
93
|
+
keptAs = [state.values, state.step];
|
|
94
|
+
host.keep();
|
|
95
|
+
},
|
|
96
|
+
reset() {
|
|
97
|
+
time.reset();
|
|
98
|
+
host.set({ timers: {}, timeUp: [] });
|
|
99
|
+
placed(drawn ? (seed === null ? draw() : form.getState().order ?? draw()) : null);
|
|
100
|
+
},
|
|
101
|
+
entered: (step) => time.entered(step),
|
|
102
|
+
start: () => time.start(),
|
|
103
|
+
countdown: () => time.countdown(),
|
|
104
|
+
marked: (values) => (page.quiz ? (0, quiz_1.quizResults)(page, values, (0, order_1.askedInOrder)(page, (form.getState().order ?? null), values)) ?? undefined : undefined),
|
|
105
|
+
};
|
|
106
|
+
if (drawn && !form.getState().order)
|
|
107
|
+
placed(draw());
|
|
108
|
+
return kit;
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=survey-kit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"survey-kit.js","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/record/survey-kit.ts"],"names":[],"mappings":";;AAwCA,oBAoFC;AA1HD,mCAA+E;AAC/E,iCAAuD;AAEvD,qCAAgE;AA8BhE;;;;GAIG;AACH,SAAgB,IAAI,CAAC,IAAe;IAClC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IAC5B,MAAM,KAAK,GAAG,IAAA,kBAAU,EAAC,IAAI,CAAC,CAAC;IAC/B,MAAM,IAAI,GAAG,IAAA,iBAAQ,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IAChN,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC;IAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,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C,IAAI,EAAE,MAAM,EAAE,IAAA,oBAAY,EAAC,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,107 @@
|
|
|
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
|
+
/** The answers and the step last kept while a clock runs. */
|
|
51
|
+
let keptAs = [];
|
|
52
|
+
const kit = {
|
|
53
|
+
hides: (id) => undrawn.has(id),
|
|
54
|
+
locks(id) {
|
|
55
|
+
const up = form.getState().timeUp;
|
|
56
|
+
if (!up.length)
|
|
57
|
+
return false;
|
|
58
|
+
if (up.includes(WHOLE_FORM))
|
|
59
|
+
return true;
|
|
60
|
+
for (let at = id; at; at = parents.get(at))
|
|
61
|
+
if (up.includes(at))
|
|
62
|
+
return true;
|
|
63
|
+
return false;
|
|
64
|
+
},
|
|
65
|
+
kept() {
|
|
66
|
+
const state = form.getState();
|
|
67
|
+
return {
|
|
68
|
+
...(state.order ? { order: state.order } : {}),
|
|
69
|
+
...(Object.keys(state.timers).length ? { timers: Object.fromEntries(Object.entries(state.timers).map(([scope, at]) => [scope, new Date(at).toISOString()])) } : {}),
|
|
70
|
+
};
|
|
71
|
+
},
|
|
72
|
+
lay(draft) {
|
|
73
|
+
// Its draw, where every part it names is still the page's with the parts it lists.
|
|
74
|
+
const kept = Object.entries(draft.order ?? {}).filter(([id, list]) => partsOf.has(id) && Array.isArray(list) && list.every((one) => partsOf.get(id)?.has(one)));
|
|
75
|
+
if (drawn && kept.length)
|
|
76
|
+
placed(Object.fromEntries(kept));
|
|
77
|
+
const timers = Object.entries(draft.timers ?? {}).filter(([, at]) => typeof at === 'string' && !Number.isNaN(Date.parse(at)));
|
|
78
|
+
if (timers.length) {
|
|
79
|
+
host.set({ timers: { ...form.getState().timers, ...Object.fromEntries(timers.map(([scope, at]) => [scope, Date.parse(at)])) } });
|
|
80
|
+
time.arm();
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
around: (kind, sent, go) => go(kind === 'submit' ? { ...sent, ...told() } : sent),
|
|
84
|
+
changed() {
|
|
85
|
+
// While a clock runs, each answer given is kept at once, never a moment later: a reload loses nothing typed, nor
|
|
86
|
+
// gains the time it took. Nothing once sent, or started again with nothing given.
|
|
87
|
+
const state = form.getState();
|
|
88
|
+
if (state.sent || !state.dirty.length || !Object.keys(state.timers).length || (state.values === keptAs[0] && state.step === keptAs[1]))
|
|
89
|
+
return;
|
|
90
|
+
keptAs = [state.values, state.step];
|
|
91
|
+
host.keep();
|
|
92
|
+
},
|
|
93
|
+
reset() {
|
|
94
|
+
time.reset();
|
|
95
|
+
host.set({ timers: {}, timeUp: [] });
|
|
96
|
+
placed(drawn ? (seed === null ? draw() : form.getState().order ?? draw()) : null);
|
|
97
|
+
},
|
|
98
|
+
entered: (step) => time.entered(step),
|
|
99
|
+
start: () => time.start(),
|
|
100
|
+
countdown: () => time.countdown(),
|
|
101
|
+
marked: (values) => (page.quiz ? quizResults(page, values, askedInOrder(page, (form.getState().order ?? null), values)) ?? undefined : undefined),
|
|
102
|
+
};
|
|
103
|
+
if (drawn && !form.getState().order)
|
|
104
|
+
placed(draw());
|
|
105
|
+
return kit;
|
|
106
|
+
}
|
|
107
|
+
//# 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":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAmB,MAAM,SAAS,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAoB,MAAM,QAAQ,CAAC;AAEvD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAkB,MAAM,UAAU,CAAC;AA8BhE;;;;GAIG;AACH,MAAM,UAAU,IAAI,CAAC,IAAe;IAClC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IAC5B,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAC/B,MAAM,IAAI,GAAG,QAAQ,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IAChN,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC;IAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,CA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I,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;
|