@verbb/formie-browser 1.0.1 → 1.0.3

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 (361) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/chunks/address-finder-BjMuEiwF.js +37 -0
  3. package/dist/chunks/bpoint-KudsBCo2.js +26 -0
  4. package/dist/chunks/calculations-DlGSkQ3W.js +147 -0
  5. package/dist/chunks/captcha-eu-CterYFok.js +34 -0
  6. package/dist/chunks/checkbox-radio-CBvgk3hR.js +136 -0
  7. package/dist/chunks/conditions-DYy1-Hwt.js +459 -0
  8. package/dist/chunks/date-picker-BlD--zfe.js +4994 -0
  9. package/dist/chunks/eway-qwc-B5Us.js +74 -0
  10. package/dist/chunks/file-upload-CIgHrXfp.js +316 -0
  11. package/dist/chunks/friendly-captcha-v1-EDFac33c.js +33 -0
  12. package/dist/chunks/friendly-captcha-v2-BDpSvFGR.js +38 -0
  13. package/dist/chunks/go-cardless-DuDMVsnz.js +24 -0
  14. package/dist/chunks/google-address-Bmjp01pH.js +181 -0
  15. package/dist/chunks/hcaptcha-BTQ6An6g.js +56 -0
  16. package/dist/chunks/hidden-DbPdOxKb.js +31 -0
  17. package/dist/chunks/index-BEsfee-D.js +1839 -0
  18. package/dist/chunks/index-BP7Unm5Y.js +863 -0
  19. package/dist/chunks/index-BcqwpPNE.js +4314 -0
  20. package/dist/chunks/loqate-BdNGv93o.js +55 -0
  21. package/dist/chunks/mollie-DFOjTuGX.js +24 -0
  22. package/dist/chunks/moneris-BbFfl-EL.js +101 -0
  23. package/dist/chunks/opayo-CmgYa9ya.js +122 -0
  24. package/dist/chunks/paddle-BUi7w1_o.js +60 -0
  25. package/dist/chunks/paypal-A-ePfh6k.js +100 -0
  26. package/dist/chunks/payway-BqFCbhyo.js +56 -0
  27. package/dist/chunks/phone-country-DPMiqk4L.js +3765 -0
  28. package/dist/chunks/place-kit-CX7tamAg.js +42 -0
  29. package/dist/chunks/placekit-autocomplete.esm-LAwfbPZl.js +1299 -0
  30. package/dist/chunks/recaptcha-enterprise-DxF6cW95.js +71 -0
  31. package/dist/chunks/recaptcha-shared-DhGcbiaq.js +15 -0
  32. package/dist/chunks/recaptcha-v2-checkbox-R9EfbZ4k.js +41 -0
  33. package/dist/chunks/recaptcha-v2-invisible-DV9hswAp.js +59 -0
  34. package/dist/chunks/recaptcha-v3-V0xc-Edh.js +28 -0
  35. package/dist/chunks/repeater-DKUT6TGI.js +124 -0
  36. package/dist/chunks/rich-text-SH7KiaKH.js +304 -0
  37. package/dist/chunks/scripts-D9N2d5rN.js +36 -0
  38. package/dist/chunks/sdk-3SicTWby.js +1559 -0
  39. package/dist/chunks/shared-BmntPmnW.js +80 -0
  40. package/dist/chunks/signature-BA3tQsGT.js +550 -0
  41. package/dist/chunks/snaptcha-DV7p6J9k.js +8 -0
  42. package/dist/chunks/square-Bs-ndqYK.js +46 -0
  43. package/dist/chunks/stripe-DkZAHxtn.js +202 -0
  44. package/dist/chunks/styles-C3aqgtek.js +21 -0
  45. package/dist/chunks/summary-Dq2i9TQk.js +126 -0
  46. package/dist/chunks/table-Cu4WfVcw.js +95 -0
  47. package/dist/chunks/text-limit-2ycmB-Ae.js +135 -0
  48. package/dist/chunks/turnstile-CId90tRr.js +59 -0
  49. package/dist/chunks/utils-BntI3W4S.js +6149 -0
  50. package/dist/css/theme/forms/_form.css +28 -0
  51. package/dist/index.d.ts +30 -0
  52. package/dist/index.d.ts.map +1 -0
  53. package/dist/index.js +39 -3205
  54. package/dist/js/compatibility/dom-adapter.d.ts +12 -0
  55. package/dist/js/compatibility/dom-adapter.d.ts.map +1 -0
  56. package/dist/js/compatibility/event-map.d.ts +25 -0
  57. package/dist/js/compatibility/event-map.d.ts.map +1 -0
  58. package/dist/js/compatibility/validator-adapter.d.ts +17 -0
  59. package/dist/js/compatibility/validator-adapter.d.ts.map +1 -0
  60. package/dist/js/contracts/client.d.ts +40 -0
  61. package/dist/js/contracts/client.d.ts.map +1 -0
  62. package/dist/js/contracts/common.d.ts +5 -0
  63. package/dist/js/contracts/common.d.ts.map +1 -0
  64. package/dist/js/contracts/modules.d.ts +47 -0
  65. package/dist/js/contracts/modules.d.ts.map +1 -0
  66. package/dist/js/contracts/schema.d.ts +79 -0
  67. package/dist/js/contracts/schema.d.ts.map +1 -0
  68. package/dist/js/contracts/theme.d.ts +2 -0
  69. package/dist/js/contracts/theme.d.ts.map +1 -0
  70. package/dist/js/core/create-formie-client.d.ts +3 -0
  71. package/dist/js/core/create-formie-client.d.ts.map +1 -0
  72. package/dist/js/core/dom-events.d.ts +2 -0
  73. package/dist/js/core/dom-events.d.ts.map +1 -0
  74. package/dist/js/core/formie.d.ts +27 -0
  75. package/dist/js/core/formie.d.ts.map +1 -0
  76. package/dist/js/core/hydrate-modules.d.ts +22 -0
  77. package/dist/js/core/hydrate-modules.d.ts.map +1 -0
  78. package/dist/js/core/page-client-event.d.ts +9 -0
  79. package/dist/js/core/page-client-event.d.ts.map +1 -0
  80. package/dist/js/core/page-tab-errors.d.ts +2 -0
  81. package/dist/js/core/page-tab-errors.d.ts.map +1 -0
  82. package/dist/js/core/submit-flow.d.ts +21 -0
  83. package/dist/js/core/submit-flow.d.ts.map +1 -0
  84. package/dist/js/core/submit-result-state.d.ts +8 -0
  85. package/dist/js/core/submit-result-state.d.ts.map +1 -0
  86. package/dist/js/core/submit-result-ui.d.ts +10 -0
  87. package/dist/js/core/submit-result-ui.d.ts.map +1 -0
  88. package/dist/js/events/event-bus.d.ts +21 -0
  89. package/dist/js/events/event-bus.d.ts.map +1 -0
  90. package/dist/js/modules/address/address-finder.d.ts +2 -0
  91. package/dist/js/modules/address/address-finder.d.ts.map +1 -0
  92. package/dist/js/modules/address/api.d.ts +8 -0
  93. package/dist/js/modules/address/api.d.ts.map +1 -0
  94. package/dist/js/modules/address/constants.d.ts +15 -0
  95. package/dist/js/modules/address/constants.d.ts.map +1 -0
  96. package/dist/js/modules/address/factories.d.ts +35 -0
  97. package/dist/js/modules/address/factories.d.ts.map +1 -0
  98. package/dist/js/modules/address/google-address.d.ts +9 -0
  99. package/dist/js/modules/address/google-address.d.ts.map +1 -0
  100. package/dist/js/modules/address/host.d.ts +30 -0
  101. package/dist/js/modules/address/host.d.ts.map +1 -0
  102. package/dist/js/modules/address/index.d.ts +3 -0
  103. package/dist/js/modules/address/index.d.ts.map +1 -0
  104. package/dist/js/modules/address/loqate.d.ts +2 -0
  105. package/dist/js/modules/address/loqate.d.ts.map +1 -0
  106. package/dist/js/modules/address/place-kit.d.ts +2 -0
  107. package/dist/js/modules/address/place-kit.d.ts.map +1 -0
  108. package/dist/js/modules/captchas/api.d.ts +9 -0
  109. package/dist/js/modules/captchas/api.d.ts.map +1 -0
  110. package/dist/js/modules/captchas/captcha-eu.d.ts +2 -0
  111. package/dist/js/modules/captchas/captcha-eu.d.ts.map +1 -0
  112. package/dist/js/modules/captchas/constants.d.ts +5 -0
  113. package/dist/js/modules/captchas/constants.d.ts.map +1 -0
  114. package/dist/js/modules/captchas/factories.d.ts +63 -0
  115. package/dist/js/modules/captchas/factories.d.ts.map +1 -0
  116. package/dist/js/modules/captchas/friendly-captcha-v1.d.ts +2 -0
  117. package/dist/js/modules/captchas/friendly-captcha-v1.d.ts.map +1 -0
  118. package/dist/js/modules/captchas/friendly-captcha-v2.d.ts +2 -0
  119. package/dist/js/modules/captchas/friendly-captcha-v2.d.ts.map +1 -0
  120. package/dist/js/modules/captchas/hcaptcha.d.ts +2 -0
  121. package/dist/js/modules/captchas/hcaptcha.d.ts.map +1 -0
  122. package/dist/js/modules/captchas/host.d.ts +78 -0
  123. package/dist/js/modules/captchas/host.d.ts.map +1 -0
  124. package/dist/js/modules/captchas/index.d.ts +3 -0
  125. package/dist/js/modules/captchas/index.d.ts.map +1 -0
  126. package/dist/js/modules/captchas/recaptcha-enterprise.d.ts +2 -0
  127. package/dist/js/modules/captchas/recaptcha-enterprise.d.ts.map +1 -0
  128. package/dist/js/modules/captchas/recaptcha-shared.d.ts +26 -0
  129. package/dist/js/modules/captchas/recaptcha-shared.d.ts.map +1 -0
  130. package/dist/js/modules/captchas/recaptcha-v2-checkbox.d.ts +2 -0
  131. package/dist/js/modules/captchas/recaptcha-v2-checkbox.d.ts.map +1 -0
  132. package/dist/js/modules/captchas/recaptcha-v2-invisible.d.ts +2 -0
  133. package/dist/js/modules/captchas/recaptcha-v2-invisible.d.ts.map +1 -0
  134. package/dist/js/modules/captchas/recaptcha-v3.d.ts +2 -0
  135. package/dist/js/modules/captchas/recaptcha-v3.d.ts.map +1 -0
  136. package/dist/js/modules/captchas/snaptcha.d.ts +2 -0
  137. package/dist/js/modules/captchas/snaptcha.d.ts.map +1 -0
  138. package/dist/js/modules/captchas/turnstile.d.ts +2 -0
  139. package/dist/js/modules/captchas/turnstile.d.ts.map +1 -0
  140. package/dist/js/modules/captchas/utils.d.ts +13 -0
  141. package/dist/js/modules/captchas/utils.d.ts.map +1 -0
  142. package/dist/js/modules/fields/calculations.d.ts +3 -0
  143. package/dist/js/modules/fields/calculations.d.ts.map +1 -0
  144. package/dist/js/modules/fields/checkbox-radio.d.ts +3 -0
  145. package/dist/js/modules/fields/checkbox-radio.d.ts.map +1 -0
  146. package/dist/js/modules/fields/conditions/config.d.ts +5 -0
  147. package/dist/js/modules/fields/conditions/config.d.ts.map +1 -0
  148. package/dist/js/modules/fields/conditions/effects.d.ts +4 -0
  149. package/dist/js/modules/fields/conditions/effects.d.ts.map +1 -0
  150. package/dist/js/modules/fields/conditions/evaluator.d.ts +6 -0
  151. package/dist/js/modules/fields/conditions/evaluator.d.ts.map +1 -0
  152. package/dist/js/modules/fields/conditions/references.d.ts +5 -0
  153. package/dist/js/modules/fields/conditions/references.d.ts.map +1 -0
  154. package/dist/js/modules/fields/conditions/transforms.d.ts +3 -0
  155. package/dist/js/modules/fields/conditions/transforms.d.ts.map +1 -0
  156. package/dist/js/modules/fields/conditions/types.d.ts +30 -0
  157. package/dist/js/modules/fields/conditions/types.d.ts.map +1 -0
  158. package/dist/js/modules/fields/conditions/values.d.ts +5 -0
  159. package/dist/js/modules/fields/conditions/values.d.ts.map +1 -0
  160. package/dist/js/modules/fields/conditions.d.ts +3 -0
  161. package/dist/js/modules/fields/conditions.d.ts.map +1 -0
  162. package/dist/js/modules/fields/date-picker.d.ts +3 -0
  163. package/dist/js/modules/fields/date-picker.d.ts.map +1 -0
  164. package/dist/js/modules/fields/file-upload.d.ts +3 -0
  165. package/dist/js/modules/fields/file-upload.d.ts.map +1 -0
  166. package/dist/js/modules/fields/hidden.d.ts +3 -0
  167. package/dist/js/modules/fields/hidden.d.ts.map +1 -0
  168. package/dist/js/modules/fields/index.d.ts +3 -0
  169. package/dist/js/modules/fields/index.d.ts.map +1 -0
  170. package/dist/js/modules/fields/phone-country.d.ts +3 -0
  171. package/dist/js/modules/fields/phone-country.d.ts.map +1 -0
  172. package/dist/js/modules/fields/repeater.d.ts +3 -0
  173. package/dist/js/modules/fields/repeater.d.ts.map +1 -0
  174. package/dist/js/modules/fields/rich-text.d.ts +3 -0
  175. package/dist/js/modules/fields/rich-text.d.ts.map +1 -0
  176. package/dist/js/modules/fields/shared.d.ts +20 -0
  177. package/dist/js/modules/fields/shared.d.ts.map +1 -0
  178. package/dist/js/modules/fields/signature.d.ts +3 -0
  179. package/dist/js/modules/fields/signature.d.ts.map +1 -0
  180. package/dist/js/modules/fields/summary.d.ts +3 -0
  181. package/dist/js/modules/fields/summary.d.ts.map +1 -0
  182. package/dist/js/modules/fields/table.d.ts +3 -0
  183. package/dist/js/modules/fields/table.d.ts.map +1 -0
  184. package/dist/js/modules/fields/text-limit.d.ts +3 -0
  185. package/dist/js/modules/fields/text-limit.d.ts.map +1 -0
  186. package/dist/js/modules/loader.d.ts +11 -0
  187. package/dist/js/modules/loader.d.ts.map +1 -0
  188. package/dist/js/modules/payments/api.d.ts +8 -0
  189. package/dist/js/modules/payments/api.d.ts.map +1 -0
  190. package/dist/js/modules/payments/bpoint.d.ts +2 -0
  191. package/dist/js/modules/payments/bpoint.d.ts.map +1 -0
  192. package/dist/js/modules/payments/constants.d.ts +5 -0
  193. package/dist/js/modules/payments/constants.d.ts.map +1 -0
  194. package/dist/js/modules/payments/eway.d.ts +9 -0
  195. package/dist/js/modules/payments/eway.d.ts.map +1 -0
  196. package/dist/js/modules/payments/factories.d.ts +54 -0
  197. package/dist/js/modules/payments/factories.d.ts.map +1 -0
  198. package/dist/js/modules/payments/go-cardless.d.ts +2 -0
  199. package/dist/js/modules/payments/go-cardless.d.ts.map +1 -0
  200. package/dist/js/modules/payments/host.d.ts +70 -0
  201. package/dist/js/modules/payments/host.d.ts.map +1 -0
  202. package/dist/js/modules/payments/index.d.ts +3 -0
  203. package/dist/js/modules/payments/index.d.ts.map +1 -0
  204. package/dist/js/modules/payments/mollie.d.ts +2 -0
  205. package/dist/js/modules/payments/mollie.d.ts.map +1 -0
  206. package/dist/js/modules/payments/moneris.d.ts +2 -0
  207. package/dist/js/modules/payments/moneris.d.ts.map +1 -0
  208. package/dist/js/modules/payments/opayo.d.ts +25 -0
  209. package/dist/js/modules/payments/opayo.d.ts.map +1 -0
  210. package/dist/js/modules/payments/paddle.d.ts +2 -0
  211. package/dist/js/modules/payments/paddle.d.ts.map +1 -0
  212. package/dist/js/modules/payments/paypal.d.ts +2 -0
  213. package/dist/js/modules/payments/paypal.d.ts.map +1 -0
  214. package/dist/js/modules/payments/payway.d.ts +2 -0
  215. package/dist/js/modules/payments/payway.d.ts.map +1 -0
  216. package/dist/js/modules/payments/square.d.ts +2 -0
  217. package/dist/js/modules/payments/square.d.ts.map +1 -0
  218. package/dist/js/modules/payments/stripe.d.ts +2 -0
  219. package/dist/js/modules/payments/stripe.d.ts.map +1 -0
  220. package/dist/js/modules/payments/utils.d.ts +17 -0
  221. package/dist/js/modules/payments/utils.d.ts.map +1 -0
  222. package/dist/js/modules/registry.d.ts +9 -0
  223. package/dist/js/modules/registry.d.ts.map +1 -0
  224. package/dist/js/modules/styles.d.ts +2 -0
  225. package/dist/js/modules/styles.d.ts.map +1 -0
  226. package/dist/js/submit/pipeline.d.ts +18 -0
  227. package/dist/js/submit/pipeline.d.ts.map +1 -0
  228. package/dist/js/theme/theme-classes.d.ts +10 -0
  229. package/dist/js/theme/theme-classes.d.ts.map +1 -0
  230. package/dist/js/transport/forms-api.d.ts +11 -0
  231. package/dist/js/transport/forms-api.d.ts.map +1 -0
  232. package/dist/js/utils/async.d.ts +8 -0
  233. package/dist/js/utils/async.d.ts.map +1 -0
  234. package/dist/js/utils/debug.d.ts +10 -0
  235. package/dist/js/utils/debug.d.ts.map +1 -0
  236. package/dist/js/utils/event-names.d.ts +13 -0
  237. package/dist/js/utils/event-names.d.ts.map +1 -0
  238. package/dist/js/utils/field-references.d.ts +6 -0
  239. package/dist/js/utils/field-references.d.ts.map +1 -0
  240. package/dist/js/utils/field-references.keys.d.ts +4 -0
  241. package/dist/js/utils/field-references.keys.d.ts.map +1 -0
  242. package/dist/js/utils/field-references.parser.d.ts +3 -0
  243. package/dist/js/utils/field-references.parser.d.ts.map +1 -0
  244. package/dist/js/utils/field-references.registry.d.ts +3 -0
  245. package/dist/js/utils/field-references.registry.d.ts.map +1 -0
  246. package/dist/js/utils/field-references.resolver.d.ts +4 -0
  247. package/dist/js/utils/field-references.resolver.d.ts.map +1 -0
  248. package/dist/js/utils/field-references.types.d.ts +27 -0
  249. package/dist/js/utils/field-references.types.d.ts.map +1 -0
  250. package/dist/js/utils/fields.d.ts +5 -0
  251. package/dist/js/utils/fields.d.ts.map +1 -0
  252. package/dist/js/utils/http.d.ts +9 -0
  253. package/dist/js/utils/http.d.ts.map +1 -0
  254. package/dist/js/utils/i18n.d.ts +7 -0
  255. package/dist/js/utils/i18n.d.ts.map +1 -0
  256. package/dist/js/utils/scripts.d.ts +13 -0
  257. package/dist/js/utils/scripts.d.ts.map +1 -0
  258. package/dist/js/utils/unload-warning.d.ts +10 -0
  259. package/dist/js/utils/unload-warning.d.ts.map +1 -0
  260. package/dist/js/validation/rules/email.d.ts +4 -0
  261. package/dist/js/validation/rules/email.d.ts.map +1 -0
  262. package/dist/js/validation/rules/match.d.ts +4 -0
  263. package/dist/js/validation/rules/match.d.ts.map +1 -0
  264. package/dist/js/validation/rules/number.d.ts +4 -0
  265. package/dist/js/validation/rules/number.d.ts.map +1 -0
  266. package/dist/js/validation/rules/required.d.ts +4 -0
  267. package/dist/js/validation/rules/required.d.ts.map +1 -0
  268. package/dist/js/validation/rules/shared.d.ts +7 -0
  269. package/dist/js/validation/rules/shared.d.ts.map +1 -0
  270. package/dist/js/validation/rules/url.d.ts +4 -0
  271. package/dist/js/validation/rules/url.d.ts.map +1 -0
  272. package/dist/js/validation/rules.d.ts +10 -0
  273. package/dist/js/validation/rules.d.ts.map +1 -0
  274. package/dist/js/validation/scope.d.ts +6 -0
  275. package/dist/js/validation/scope.d.ts.map +1 -0
  276. package/dist/js/validation/submit-readiness.d.ts +4 -0
  277. package/dist/js/validation/submit-readiness.d.ts.map +1 -0
  278. package/dist/js/validation/types.d.ts +44 -0
  279. package/dist/js/validation/types.d.ts.map +1 -0
  280. package/dist/js/validation/validator.d.ts +54 -0
  281. package/dist/js/validation/validator.d.ts.map +1 -0
  282. package/package.json +3 -2
  283. package/src/css/theme/forms/_form.css +28 -0
  284. package/src/js/core/create-formie-client.ts +6 -0
  285. package/src/js/core/submit-result-state.ts +17 -0
  286. package/src/js/modules/address/google-address.ts +33 -1
  287. package/src/js/modules/fields/conditions/effects.ts +79 -2
  288. package/src/js/modules/fields/conditions.ts +53 -11
  289. package/src/js/modules/fields/file-upload.ts +189 -97
  290. package/src/js/modules/fields/repeater.ts +1 -1
  291. package/src/js/modules/fields/rich-text.ts +2 -2
  292. package/src/js/modules/fields/signature.ts +1 -1
  293. package/src/js/modules/fields/summary.ts +1 -1
  294. package/src/js/modules/fields/table.ts +1 -1
  295. package/src/js/modules/fields/text-limit.ts +1 -1
  296. package/src/js/modules/payments/paypal.ts +1 -1
  297. package/src/js/modules/payments/payway.ts +1 -1
  298. package/src/js/modules/payments/stripe.ts +1 -1
  299. package/src/js/submit/pipeline.ts +3 -28
  300. package/src/js/validation/scope.ts +25 -0
  301. package/src/js/validation/submit-readiness.ts +157 -0
  302. package/src/js/validation/validator.ts +4 -0
  303. package/dist/chunks/address-finder-DfMCiW89.js +0 -47
  304. package/dist/chunks/api-CbqEMQT5.js +0 -181
  305. package/dist/chunks/api-DE7LfK-R.js +0 -960
  306. package/dist/chunks/api-DOfDzYC_.js +0 -538
  307. package/dist/chunks/async-B3DUf1GZ.js +0 -26
  308. package/dist/chunks/bpoint-Ciy3yY9Q.js +0 -34
  309. package/dist/chunks/calculations-CkYAqO_-.js +0 -197
  310. package/dist/chunks/captcha-eu-DnOWhMwr.js +0 -43
  311. package/dist/chunks/checkbox-radio-0x7Tc0br.js +0 -197
  312. package/dist/chunks/chunk-K6L4z4UQ.js +0 -24
  313. package/dist/chunks/conditions-4fXKhEJS.js +0 -609
  314. package/dist/chunks/date-picker-B6iZkjHS.js +0 -6204
  315. package/dist/chunks/debug-KnZeKYBI.js +0 -39
  316. package/dist/chunks/dist-D09GnXMW.js +0 -2663
  317. package/dist/chunks/event-names-DamGPtXR.js +0 -51
  318. package/dist/chunks/eway-DEAYcwT0.js +0 -86
  319. package/dist/chunks/field-references.keys-BpBZ_quS.js +0 -24
  320. package/dist/chunks/field-references.resolver-Ba6xhiJC.js +0 -183
  321. package/dist/chunks/file-upload-BIj85NFH.js +0 -428
  322. package/dist/chunks/friendly-captcha-v1-CqO4WVre.js +0 -40
  323. package/dist/chunks/friendly-captcha-v2-CyykcJcM.js +0 -47
  324. package/dist/chunks/friendly-challenge-Dg8XkStd.js +0 -1101
  325. package/dist/chunks/go-cardless-CuND59rR.js +0 -26
  326. package/dist/chunks/google-address--uR8WDSm.js +0 -208
  327. package/dist/chunks/hcaptcha-CmaFUesv.js +0 -72
  328. package/dist/chunks/hidden-CYnZYple.js +0 -36
  329. package/dist/chunks/http-18nn97DZ.js +0 -29
  330. package/dist/chunks/i18n-vUh-KGiH.js +0 -55
  331. package/dist/chunks/loqate-BICNJlVK.js +0 -97
  332. package/dist/chunks/mollie-DwlsgHZ1.js +0 -26
  333. package/dist/chunks/moneris-B_IFZFTx.js +0 -159
  334. package/dist/chunks/opayo-U2x_TOII.js +0 -192
  335. package/dist/chunks/paddle-BqXFrc79.js +0 -75
  336. package/dist/chunks/paypal-VowQ3ilP.js +0 -121
  337. package/dist/chunks/payway-VOO-ajyg.js +0 -75
  338. package/dist/chunks/phone-country-B6Me4lK0.js +0 -3317
  339. package/dist/chunks/place-kit-ldUl-u9w.js +0 -56
  340. package/dist/chunks/placekit-autocomplete.esm-D-lGeaZl.js +0 -1771
  341. package/dist/chunks/recaptcha-enterprise-DPJNyv1X.js +0 -72
  342. package/dist/chunks/recaptcha-shared-DTI4qWVR.js +0 -22
  343. package/dist/chunks/recaptcha-v2-checkbox-zFjpvJ5c.js +0 -49
  344. package/dist/chunks/recaptcha-v2-invisible-CnYtkNvz.js +0 -62
  345. package/dist/chunks/recaptcha-v3-EAlWhnkX.js +0 -33
  346. package/dist/chunks/repeater-BPm7Mkyn.js +0 -149
  347. package/dist/chunks/rich-text-CHSly1Hq.js +0 -438
  348. package/dist/chunks/scripts-BGD_iU_6.js +0 -41
  349. package/dist/chunks/sdk-B7u9fTlP.js +0 -2103
  350. package/dist/chunks/shared-DC6_1u8X.js +0 -85
  351. package/dist/chunks/signature-DNMCgrMd.js +0 -763
  352. package/dist/chunks/snaptcha-CCDunGeb.js +0 -8
  353. package/dist/chunks/square-BLqK51rS.js +0 -61
  354. package/dist/chunks/stripe-B6ZcDQdx.js +0 -273
  355. package/dist/chunks/styles-BIh6g7V_.js +0 -22
  356. package/dist/chunks/summary-BTG0uIOt.js +0 -189
  357. package/dist/chunks/table-BTYc0Qm8.js +0 -122
  358. package/dist/chunks/text-limit-CgBMu4sJ.js +0 -177
  359. package/dist/chunks/theme-classes-vSHpdCUO.js +0 -59
  360. package/dist/chunks/turnstile-DP0bdR7T.js +0 -68
  361. package/dist/chunks/utils-ByrEVYrJ.js +0 -49584
@@ -1,763 +0,0 @@
1
- import { t as ensureModuleStyles } from "./styles-BIh6g7V_.js";
2
- import { r as getModuleFieldContainers, t as dispatchFieldEvent } from "./shared-DC6_1u8X.js";
3
- import signatureCss from "#theme/fields/_signature.css?inline";
4
- //#region ../../node_modules/signature_pad/dist/signature_pad.js
5
- /*!
6
- * Signature Pad v5.1.3 | https://github.com/szimek/signature_pad
7
- * (c) 2025 Szymon Nowak | Released under the MIT license
8
- */
9
- var Point = class {
10
- x;
11
- y;
12
- pressure;
13
- time;
14
- constructor(x, y, pressure, time) {
15
- if (isNaN(x) || isNaN(y)) throw new Error(`Point is invalid: (${x}, ${y})`);
16
- this.x = +x;
17
- this.y = +y;
18
- this.pressure = pressure || 0;
19
- this.time = time || Date.now();
20
- }
21
- distanceTo(start) {
22
- return Math.sqrt(Math.pow(this.x - start.x, 2) + Math.pow(this.y - start.y, 2));
23
- }
24
- equals(other) {
25
- return this.x === other.x && this.y === other.y && this.pressure === other.pressure && this.time === other.time;
26
- }
27
- velocityFrom(start) {
28
- return this.time !== start.time ? this.distanceTo(start) / (this.time - start.time) : 0;
29
- }
30
- };
31
- var Bezier = class _Bezier {
32
- constructor(startPoint, control2, control1, endPoint, startWidth, endWidth) {
33
- this.startPoint = startPoint;
34
- this.control2 = control2;
35
- this.control1 = control1;
36
- this.endPoint = endPoint;
37
- this.startWidth = startWidth;
38
- this.endWidth = endWidth;
39
- }
40
- static fromPoints(points, widths) {
41
- const c2 = this.calculateControlPoints(points[0], points[1], points[2]).c2;
42
- const c3 = this.calculateControlPoints(points[1], points[2], points[3]).c1;
43
- return new _Bezier(points[1], c2, c3, points[2], widths.start, widths.end);
44
- }
45
- static calculateControlPoints(s1, s2, s3) {
46
- const dx1 = s1.x - s2.x;
47
- const dy1 = s1.y - s2.y;
48
- const dx2 = s2.x - s3.x;
49
- const dy2 = s2.y - s3.y;
50
- const m1 = {
51
- x: (s1.x + s2.x) / 2,
52
- y: (s1.y + s2.y) / 2
53
- };
54
- const m2 = {
55
- x: (s2.x + s3.x) / 2,
56
- y: (s2.y + s3.y) / 2
57
- };
58
- const l1 = Math.sqrt(dx1 * dx1 + dy1 * dy1);
59
- const l2 = Math.sqrt(dx2 * dx2 + dy2 * dy2);
60
- const dxm = m1.x - m2.x;
61
- const dym = m1.y - m2.y;
62
- const k = l1 + l2 == 0 ? 0 : l2 / (l1 + l2);
63
- const cm = {
64
- x: m2.x + dxm * k,
65
- y: m2.y + dym * k
66
- };
67
- const tx = s2.x - cm.x;
68
- const ty = s2.y - cm.y;
69
- return {
70
- c1: new Point(m1.x + tx, m1.y + ty),
71
- c2: new Point(m2.x + tx, m2.y + ty)
72
- };
73
- }
74
- length() {
75
- const steps = 10;
76
- let length = 0;
77
- let px;
78
- let py;
79
- for (let i = 0; i <= steps; i += 1) {
80
- const t = i / steps;
81
- const cx = this.point(t, this.startPoint.x, this.control1.x, this.control2.x, this.endPoint.x);
82
- const cy = this.point(t, this.startPoint.y, this.control1.y, this.control2.y, this.endPoint.y);
83
- if (i > 0) {
84
- const xdiff = cx - px;
85
- const ydiff = cy - py;
86
- length += Math.sqrt(xdiff * xdiff + ydiff * ydiff);
87
- }
88
- px = cx;
89
- py = cy;
90
- }
91
- return length;
92
- }
93
- point(t, start, c1, c2, end) {
94
- return start * (1 - t) * (1 - t) * (1 - t) + 3 * c1 * (1 - t) * (1 - t) * t + 3 * c2 * (1 - t) * t * t + end * t * t * t;
95
- }
96
- };
97
- var SignatureEventTarget = class {
98
- _et;
99
- constructor() {
100
- try {
101
- this._et = new EventTarget();
102
- } catch {
103
- this._et = document;
104
- }
105
- }
106
- addEventListener(type, listener, options) {
107
- this._et.addEventListener(type, listener, options);
108
- }
109
- dispatchEvent(event) {
110
- return this._et.dispatchEvent(event);
111
- }
112
- removeEventListener(type, callback, options) {
113
- this._et.removeEventListener(type, callback, options);
114
- }
115
- };
116
- function throttle(fn, wait = 250) {
117
- let previous = 0;
118
- let timeout = null;
119
- let result;
120
- let storedContext;
121
- let storedArgs;
122
- const later = () => {
123
- previous = Date.now();
124
- timeout = null;
125
- result = fn.apply(storedContext, storedArgs);
126
- if (!timeout) {
127
- storedContext = null;
128
- storedArgs = [];
129
- }
130
- };
131
- return function wrapper(...args) {
132
- const now = Date.now();
133
- const remaining = wait - (now - previous);
134
- storedContext = this;
135
- storedArgs = args;
136
- if (remaining <= 0 || remaining > wait) {
137
- if (timeout) {
138
- clearTimeout(timeout);
139
- timeout = null;
140
- }
141
- previous = now;
142
- result = fn.apply(storedContext, storedArgs);
143
- if (!timeout) {
144
- storedContext = null;
145
- storedArgs = [];
146
- }
147
- } else if (!timeout) timeout = window.setTimeout(later, remaining);
148
- return result;
149
- };
150
- }
151
- var SignaturePad = class _SignaturePad extends SignatureEventTarget {
152
- constructor(canvas, options = {}) {
153
- super();
154
- this.canvas = canvas;
155
- this.velocityFilterWeight = options.velocityFilterWeight || .7;
156
- this.minWidth = options.minWidth || .5;
157
- this.maxWidth = options.maxWidth || 2.5;
158
- this.throttle = options.throttle ?? 16;
159
- this.minDistance = options.minDistance ?? 5;
160
- this.dotSize = options.dotSize || 0;
161
- this.penColor = options.penColor || "black";
162
- this.backgroundColor = options.backgroundColor || "rgba(0,0,0,0)";
163
- this.compositeOperation = options.compositeOperation || "source-over";
164
- this.canvasContextOptions = options.canvasContextOptions ?? {};
165
- this._strokeMoveUpdate = this.throttle ? throttle(_SignaturePad.prototype._strokeUpdate, this.throttle) : _SignaturePad.prototype._strokeUpdate;
166
- this._handleMouseDown = this._handleMouseDown.bind(this);
167
- this._handleMouseMove = this._handleMouseMove.bind(this);
168
- this._handleMouseUp = this._handleMouseUp.bind(this);
169
- this._handleTouchStart = this._handleTouchStart.bind(this);
170
- this._handleTouchMove = this._handleTouchMove.bind(this);
171
- this._handleTouchEnd = this._handleTouchEnd.bind(this);
172
- this._handlePointerDown = this._handlePointerDown.bind(this);
173
- this._handlePointerMove = this._handlePointerMove.bind(this);
174
- this._handlePointerUp = this._handlePointerUp.bind(this);
175
- this._handlePointerCancel = this._handlePointerCancel.bind(this);
176
- this._handleTouchCancel = this._handleTouchCancel.bind(this);
177
- this._ctx = canvas.getContext("2d", this.canvasContextOptions);
178
- this.clear();
179
- this.on();
180
- }
181
- dotSize;
182
- minWidth;
183
- maxWidth;
184
- penColor;
185
- minDistance;
186
- velocityFilterWeight;
187
- compositeOperation;
188
- backgroundColor;
189
- throttle;
190
- canvasContextOptions;
191
- _ctx;
192
- _drawingStroke = false;
193
- _isEmpty = true;
194
- _dataUrl;
195
- _dataUrlOptions;
196
- _lastPoints = [];
197
- _data = [];
198
- _lastVelocity = 0;
199
- _lastWidth = 0;
200
- _strokeMoveUpdate;
201
- _strokePointerId;
202
- clear() {
203
- const { _ctx: ctx, canvas } = this;
204
- ctx.fillStyle = this.backgroundColor;
205
- ctx.clearRect(0, 0, canvas.width, canvas.height);
206
- ctx.fillRect(0, 0, canvas.width, canvas.height);
207
- this._data = [];
208
- this._reset(this._getPointGroupOptions());
209
- this._isEmpty = true;
210
- this._dataUrl = void 0;
211
- this._dataUrlOptions = void 0;
212
- this._strokePointerId = void 0;
213
- }
214
- redraw() {
215
- const data = this._data;
216
- const dataUrl = this._dataUrl;
217
- const dataUrlOptions = this._dataUrlOptions;
218
- this.clear();
219
- if (dataUrl) this.fromDataURL(dataUrl, dataUrlOptions);
220
- this.fromData(data, { clear: false });
221
- }
222
- fromDataURL(dataUrl, options = {}) {
223
- return new Promise((resolve, reject) => {
224
- const image = new Image();
225
- const ratio = options.ratio || window.devicePixelRatio || 1;
226
- const width = options.width || this.canvas.width / ratio;
227
- const height = options.height || this.canvas.height / ratio;
228
- const xOffset = options.xOffset || 0;
229
- const yOffset = options.yOffset || 0;
230
- this._reset(this._getPointGroupOptions());
231
- image.onload = () => {
232
- this._ctx.drawImage(image, xOffset, yOffset, width, height);
233
- resolve();
234
- };
235
- image.onerror = (error) => {
236
- reject(error);
237
- };
238
- image.crossOrigin = "anonymous";
239
- image.src = dataUrl;
240
- this._isEmpty = false;
241
- this._dataUrl = dataUrl;
242
- this._dataUrlOptions = { ...options };
243
- });
244
- }
245
- toDataURL(type = "image/png", encoderOptions) {
246
- switch (type) {
247
- case "image/svg+xml":
248
- if (typeof encoderOptions !== "object") encoderOptions = void 0;
249
- return `data:image/svg+xml;base64,${btoa(this.toSVG(encoderOptions))}`;
250
- default:
251
- if (typeof encoderOptions !== "number") encoderOptions = void 0;
252
- return this.canvas.toDataURL(type, encoderOptions);
253
- }
254
- }
255
- on() {
256
- this.canvas.style.touchAction = "none";
257
- this.canvas.style.msTouchAction = "none";
258
- this.canvas.style.userSelect = "none";
259
- this.canvas.style.webkitUserSelect = "none";
260
- const isIOS = /Macintosh/.test(navigator.userAgent) && "ontouchstart" in document;
261
- if (window.PointerEvent && !isIOS) this._handlePointerEvents();
262
- else {
263
- this._handleMouseEvents();
264
- if ("ontouchstart" in window) this._handleTouchEvents();
265
- }
266
- }
267
- off() {
268
- this.canvas.style.touchAction = "auto";
269
- this.canvas.style.msTouchAction = "auto";
270
- this.canvas.style.userSelect = "auto";
271
- this.canvas.style.webkitUserSelect = "auto";
272
- this.canvas.removeEventListener("pointerdown", this._handlePointerDown);
273
- this.canvas.removeEventListener("mousedown", this._handleMouseDown);
274
- this.canvas.removeEventListener("touchstart", this._handleTouchStart);
275
- this._removeMoveUpEventListeners();
276
- }
277
- _getListenerFunctions() {
278
- const canvasWindow = window.document === this.canvas.ownerDocument ? window : this.canvas.ownerDocument.defaultView ?? this.canvas.ownerDocument;
279
- return {
280
- addEventListener: canvasWindow.addEventListener.bind(canvasWindow),
281
- removeEventListener: canvasWindow.removeEventListener.bind(canvasWindow)
282
- };
283
- }
284
- _removeMoveUpEventListeners() {
285
- const { removeEventListener } = this._getListenerFunctions();
286
- removeEventListener("pointermove", this._handlePointerMove);
287
- removeEventListener("pointerup", this._handlePointerUp);
288
- removeEventListener("pointercancel", this._handlePointerCancel);
289
- removeEventListener("mousemove", this._handleMouseMove);
290
- removeEventListener("mouseup", this._handleMouseUp);
291
- removeEventListener("touchmove", this._handleTouchMove);
292
- removeEventListener("touchend", this._handleTouchEnd);
293
- removeEventListener("touchcancel", this._handleTouchCancel);
294
- }
295
- isEmpty() {
296
- return this._isEmpty;
297
- }
298
- fromData(pointGroups, { clear = true } = {}) {
299
- if (clear) this.clear();
300
- this._fromData(pointGroups, this._drawCurve.bind(this), this._drawDot.bind(this));
301
- this._data = this._data.concat(pointGroups);
302
- }
303
- toData() {
304
- return this._data;
305
- }
306
- _isLeftButtonPressed(event, only) {
307
- if (only) return event.buttons === 1;
308
- return (event.buttons & 1) === 1;
309
- }
310
- _pointerEventToSignatureEvent(event) {
311
- return {
312
- event,
313
- type: event.type,
314
- x: event.clientX,
315
- y: event.clientY,
316
- pressure: "pressure" in event ? event.pressure : 0
317
- };
318
- }
319
- _touchEventToSignatureEvent(event) {
320
- const touch = event.changedTouches[0];
321
- return {
322
- event,
323
- type: event.type,
324
- x: touch.clientX,
325
- y: touch.clientY,
326
- pressure: touch.force
327
- };
328
- }
329
- _handleMouseDown(event) {
330
- if (!this._isLeftButtonPressed(event, true) || this._drawingStroke) return;
331
- this._strokeBegin(this._pointerEventToSignatureEvent(event));
332
- }
333
- _handleMouseMove(event) {
334
- if (!this._isLeftButtonPressed(event, true) || !this._drawingStroke) {
335
- this._strokeEnd(this._pointerEventToSignatureEvent(event), false);
336
- return;
337
- }
338
- this._strokeMoveUpdate(this._pointerEventToSignatureEvent(event));
339
- }
340
- _handleMouseUp(event) {
341
- if (this._isLeftButtonPressed(event)) return;
342
- this._strokeEnd(this._pointerEventToSignatureEvent(event));
343
- }
344
- _handleTouchStart(event) {
345
- if (event.targetTouches.length !== 1 || this._drawingStroke) return;
346
- if (event.cancelable) event.preventDefault();
347
- this._strokeBegin(this._touchEventToSignatureEvent(event));
348
- }
349
- _handleTouchMove(event) {
350
- if (event.targetTouches.length !== 1) return;
351
- if (event.cancelable) event.preventDefault();
352
- if (!this._drawingStroke) {
353
- this._strokeEnd(this._touchEventToSignatureEvent(event), false);
354
- return;
355
- }
356
- this._strokeMoveUpdate(this._touchEventToSignatureEvent(event));
357
- }
358
- _handleTouchEnd(event) {
359
- if (event.targetTouches.length !== 0) return;
360
- if (event.cancelable) event.preventDefault();
361
- this._strokeEnd(this._touchEventToSignatureEvent(event));
362
- }
363
- _handlePointerCancel(event) {
364
- if (!this._allowPointerId(event)) return;
365
- event.preventDefault();
366
- this._strokeEnd(this._pointerEventToSignatureEvent(event), false);
367
- }
368
- _handleTouchCancel(event) {
369
- if (event.cancelable) event.preventDefault();
370
- this._strokeEnd(this._touchEventToSignatureEvent(event), false);
371
- }
372
- _getPointerId(event) {
373
- return event.persistentDeviceId || event.pointerId;
374
- }
375
- _allowPointerId(event, allowUndefined = false) {
376
- if (typeof this._strokePointerId === "undefined") return allowUndefined;
377
- return this._getPointerId(event) === this._strokePointerId;
378
- }
379
- _handlePointerDown(event) {
380
- if (this._drawingStroke || !this._isLeftButtonPressed(event) || !this._allowPointerId(event, true)) return;
381
- this._strokePointerId = this._getPointerId(event);
382
- event.preventDefault();
383
- this._strokeBegin(this._pointerEventToSignatureEvent(event));
384
- }
385
- _handlePointerMove(event) {
386
- if (!this._allowPointerId(event)) return;
387
- if (!this._isLeftButtonPressed(event, true) || !this._drawingStroke) {
388
- this._strokeEnd(this._pointerEventToSignatureEvent(event), false);
389
- return;
390
- }
391
- event.preventDefault();
392
- this._strokeMoveUpdate(this._pointerEventToSignatureEvent(event));
393
- }
394
- _handlePointerUp(event) {
395
- if (this._isLeftButtonPressed(event) || !this._allowPointerId(event)) return;
396
- event.preventDefault();
397
- this._strokeEnd(this._pointerEventToSignatureEvent(event));
398
- }
399
- _getPointGroupOptions(group) {
400
- return {
401
- penColor: group && "penColor" in group ? group.penColor : this.penColor,
402
- dotSize: group && "dotSize" in group ? group.dotSize : this.dotSize,
403
- minWidth: group && "minWidth" in group ? group.minWidth : this.minWidth,
404
- maxWidth: group && "maxWidth" in group ? group.maxWidth : this.maxWidth,
405
- velocityFilterWeight: group && "velocityFilterWeight" in group ? group.velocityFilterWeight : this.velocityFilterWeight,
406
- compositeOperation: group && "compositeOperation" in group ? group.compositeOperation : this.compositeOperation
407
- };
408
- }
409
- _strokeBegin(event) {
410
- if (!this.dispatchEvent(new CustomEvent("beginStroke", {
411
- detail: event,
412
- cancelable: true
413
- }))) return;
414
- const { addEventListener } = this._getListenerFunctions();
415
- switch (event.event.type) {
416
- case "mousedown":
417
- addEventListener("mousemove", this._handleMouseMove, { passive: false });
418
- addEventListener("mouseup", this._handleMouseUp, { passive: false });
419
- break;
420
- case "touchstart":
421
- addEventListener("touchmove", this._handleTouchMove, { passive: false });
422
- addEventListener("touchend", this._handleTouchEnd, { passive: false });
423
- addEventListener("touchcancel", this._handleTouchCancel, { passive: false });
424
- break;
425
- case "pointerdown":
426
- addEventListener("pointermove", this._handlePointerMove, { passive: false });
427
- addEventListener("pointerup", this._handlePointerUp, { passive: false });
428
- addEventListener("pointercancel", this._handlePointerCancel, { passive: false });
429
- break;
430
- default:
431
- }
432
- this._drawingStroke = true;
433
- const pointGroupOptions = this._getPointGroupOptions();
434
- const newPointGroup = {
435
- ...pointGroupOptions,
436
- points: []
437
- };
438
- this._data.push(newPointGroup);
439
- this._reset(pointGroupOptions);
440
- this._strokeUpdate(event);
441
- }
442
- _strokeUpdate(event) {
443
- if (!this._drawingStroke) return;
444
- if (this._data.length === 0) {
445
- this._strokeBegin(event);
446
- return;
447
- }
448
- this.dispatchEvent(new CustomEvent("beforeUpdateStroke", { detail: event }));
449
- const point = this._createPoint(event.x, event.y, event.pressure);
450
- const lastPointGroup = this._data[this._data.length - 1];
451
- const lastPoints = lastPointGroup.points;
452
- const lastPoint = lastPoints.length > 0 && lastPoints[lastPoints.length - 1];
453
- const isLastPointTooClose = lastPoint ? point.distanceTo(lastPoint) <= this.minDistance : false;
454
- const pointGroupOptions = this._getPointGroupOptions(lastPointGroup);
455
- if (!lastPoint || !(lastPoint && isLastPointTooClose)) {
456
- const curve = this._addPoint(point, pointGroupOptions);
457
- if (!lastPoint) this._drawDot(point, pointGroupOptions);
458
- else if (curve) this._drawCurve(curve, pointGroupOptions);
459
- lastPoints.push({
460
- time: point.time,
461
- x: point.x,
462
- y: point.y,
463
- pressure: point.pressure
464
- });
465
- }
466
- this.dispatchEvent(new CustomEvent("afterUpdateStroke", { detail: event }));
467
- }
468
- _strokeEnd(event, shouldUpdate = true) {
469
- this._removeMoveUpEventListeners();
470
- if (!this._drawingStroke) return;
471
- if (shouldUpdate) this._strokeUpdate(event);
472
- this._drawingStroke = false;
473
- this._strokePointerId = void 0;
474
- this.dispatchEvent(new CustomEvent("endStroke", { detail: event }));
475
- }
476
- _handlePointerEvents() {
477
- this._drawingStroke = false;
478
- this.canvas.addEventListener("pointerdown", this._handlePointerDown, { passive: false });
479
- }
480
- _handleMouseEvents() {
481
- this._drawingStroke = false;
482
- this.canvas.addEventListener("mousedown", this._handleMouseDown, { passive: false });
483
- }
484
- _handleTouchEvents() {
485
- this.canvas.addEventListener("touchstart", this._handleTouchStart, { passive: false });
486
- }
487
- _reset(options) {
488
- this._lastPoints = [];
489
- this._lastVelocity = 0;
490
- this._lastWidth = (options.minWidth + options.maxWidth) / 2;
491
- this._ctx.fillStyle = options.penColor;
492
- this._ctx.globalCompositeOperation = options.compositeOperation;
493
- }
494
- _createPoint(x, y, pressure) {
495
- const rect = this.canvas.getBoundingClientRect();
496
- return new Point(x - rect.left, y - rect.top, pressure, (/* @__PURE__ */ new Date()).getTime());
497
- }
498
- _addPoint(point, options) {
499
- const { _lastPoints } = this;
500
- _lastPoints.push(point);
501
- if (_lastPoints.length > 2) {
502
- if (_lastPoints.length === 3) _lastPoints.unshift(_lastPoints[0]);
503
- const widths = this._calculateCurveWidths(_lastPoints[1], _lastPoints[2], options);
504
- const curve = Bezier.fromPoints(_lastPoints, widths);
505
- _lastPoints.shift();
506
- return curve;
507
- }
508
- return null;
509
- }
510
- _calculateCurveWidths(startPoint, endPoint, options) {
511
- const velocity = options.velocityFilterWeight * endPoint.velocityFrom(startPoint) + (1 - options.velocityFilterWeight) * this._lastVelocity;
512
- const newWidth = this._strokeWidth(velocity, options);
513
- const widths = {
514
- end: newWidth,
515
- start: this._lastWidth
516
- };
517
- this._lastVelocity = velocity;
518
- this._lastWidth = newWidth;
519
- return widths;
520
- }
521
- _strokeWidth(velocity, options) {
522
- return Math.max(options.maxWidth / (velocity + 1), options.minWidth);
523
- }
524
- _drawCurveSegment(x, y, width) {
525
- const ctx = this._ctx;
526
- ctx.moveTo(x, y);
527
- ctx.arc(x, y, width, 0, 2 * Math.PI, false);
528
- this._isEmpty = false;
529
- }
530
- _drawCurve(curve, options) {
531
- const ctx = this._ctx;
532
- const widthDelta = curve.endWidth - curve.startWidth;
533
- const drawSteps = Math.ceil(curve.length()) * 2;
534
- ctx.beginPath();
535
- ctx.fillStyle = options.penColor;
536
- for (let i = 0; i < drawSteps; i += 1) {
537
- const t = i / drawSteps;
538
- const tt = t * t;
539
- const ttt = tt * t;
540
- const u = 1 - t;
541
- const uu = u * u;
542
- const uuu = uu * u;
543
- let x = uuu * curve.startPoint.x;
544
- x += 3 * uu * t * curve.control1.x;
545
- x += 3 * u * tt * curve.control2.x;
546
- x += ttt * curve.endPoint.x;
547
- let y = uuu * curve.startPoint.y;
548
- y += 3 * uu * t * curve.control1.y;
549
- y += 3 * u * tt * curve.control2.y;
550
- y += ttt * curve.endPoint.y;
551
- const width = Math.min(curve.startWidth + ttt * widthDelta, options.maxWidth);
552
- this._drawCurveSegment(x, y, width);
553
- }
554
- ctx.closePath();
555
- ctx.fill();
556
- }
557
- _drawDot(point, options) {
558
- const ctx = this._ctx;
559
- const width = options.dotSize > 0 ? options.dotSize : (options.minWidth + options.maxWidth) / 2;
560
- ctx.beginPath();
561
- this._drawCurveSegment(point.x, point.y, width);
562
- ctx.closePath();
563
- ctx.fillStyle = options.penColor;
564
- ctx.fill();
565
- }
566
- _fromData(pointGroups, drawCurve, drawDot) {
567
- for (const group of pointGroups) {
568
- const { points } = group;
569
- const pointGroupOptions = this._getPointGroupOptions(group);
570
- if (points.length > 1) for (let j = 0; j < points.length; j += 1) {
571
- const basicPoint = points[j];
572
- const point = new Point(basicPoint.x, basicPoint.y, basicPoint.pressure, basicPoint.time);
573
- if (j === 0) this._reset(pointGroupOptions);
574
- const curve = this._addPoint(point, pointGroupOptions);
575
- if (curve) drawCurve(curve, pointGroupOptions);
576
- }
577
- else {
578
- this._reset(pointGroupOptions);
579
- drawDot(points[0], pointGroupOptions);
580
- }
581
- }
582
- }
583
- toSVG({ includeBackgroundColor = false, includeDataUrl = false } = {}) {
584
- const pointGroups = this._data;
585
- const ratio = Math.max(window.devicePixelRatio || 1, 1);
586
- const minX = 0;
587
- const minY = 0;
588
- const maxX = this.canvas.width / ratio;
589
- const maxY = this.canvas.height / ratio;
590
- const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
591
- svg.setAttribute("xmlns", "http://www.w3.org/2000/svg");
592
- svg.setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink");
593
- svg.setAttribute("viewBox", `${minX} ${minY} ${maxX} ${maxY}`);
594
- svg.setAttribute("width", maxX.toString());
595
- svg.setAttribute("height", maxY.toString());
596
- if (includeBackgroundColor && this.backgroundColor) {
597
- const rect = document.createElement("rect");
598
- rect.setAttribute("width", "100%");
599
- rect.setAttribute("height", "100%");
600
- rect.setAttribute("fill", this.backgroundColor);
601
- svg.appendChild(rect);
602
- }
603
- if (includeDataUrl && this._dataUrl) {
604
- const ratio2 = this._dataUrlOptions?.ratio || window.devicePixelRatio || 1;
605
- const width = this._dataUrlOptions?.width || this.canvas.width / ratio2;
606
- const height = this._dataUrlOptions?.height || this.canvas.height / ratio2;
607
- const xOffset = this._dataUrlOptions?.xOffset || 0;
608
- const yOffset = this._dataUrlOptions?.yOffset || 0;
609
- const image = document.createElement("image");
610
- image.setAttribute("x", xOffset.toString());
611
- image.setAttribute("y", yOffset.toString());
612
- image.setAttribute("width", width.toString());
613
- image.setAttribute("height", height.toString());
614
- image.setAttribute("preserveAspectRatio", "none");
615
- image.setAttribute("href", this._dataUrl);
616
- svg.appendChild(image);
617
- }
618
- this._fromData(pointGroups, (curve, { penColor }) => {
619
- const path = document.createElement("path");
620
- if (!isNaN(curve.control1.x) && !isNaN(curve.control1.y) && !isNaN(curve.control2.x) && !isNaN(curve.control2.y)) {
621
- const attr = `M ${curve.startPoint.x.toFixed(3)},${curve.startPoint.y.toFixed(3)} C ${curve.control1.x.toFixed(3)},${curve.control1.y.toFixed(3)} ${curve.control2.x.toFixed(3)},${curve.control2.y.toFixed(3)} ${curve.endPoint.x.toFixed(3)},${curve.endPoint.y.toFixed(3)}`;
622
- path.setAttribute("d", attr);
623
- path.setAttribute("stroke-width", (curve.endWidth * 2.25).toFixed(3));
624
- path.setAttribute("stroke", penColor);
625
- path.setAttribute("fill", "none");
626
- path.setAttribute("stroke-linecap", "round");
627
- svg.appendChild(path);
628
- }
629
- }, (point, { penColor, dotSize, minWidth, maxWidth }) => {
630
- const circle = document.createElement("circle");
631
- const size = dotSize > 0 ? dotSize : (minWidth + maxWidth) / 2;
632
- circle.setAttribute("r", size.toString());
633
- circle.setAttribute("cx", point.x.toString());
634
- circle.setAttribute("cy", point.y.toString());
635
- circle.setAttribute("fill", penColor);
636
- svg.appendChild(circle);
637
- });
638
- return svg.outerHTML;
639
- }
640
- };
641
- //#endregion
642
- //#region src/js/modules/fields/signature.ts
643
- var INPUT_SELECTOR = "input[data-formie-signature-input]";
644
- var CANVAS_SELECTOR = "canvas[data-formie-signature-canvas]";
645
- var CLEAR_SELECTOR = "[data-formie-signature-clear]";
646
- var MODULE_ID = "signature";
647
- ensureModuleStyles(MODULE_ID, [signatureCss]);
648
- function getCanvasSize(canvas) {
649
- const rect = canvas.getBoundingClientRect();
650
- return {
651
- width: Math.round(rect.width),
652
- height: Math.round(rect.height)
653
- };
654
- }
655
- function drawValueOnCanvas(canvas, value) {
656
- if (!value) return;
657
- const image = new Image();
658
- image.src = value;
659
- image.onload = () => {
660
- const ratio = Math.max(window.devicePixelRatio || 1, 1);
661
- const context = canvas.getContext("2d");
662
- if (!context) return;
663
- context.drawImage(image, 0, 0, canvas.width / ratio, canvas.height / ratio);
664
- };
665
- }
666
- function initSignatureField(root, field, input, canvas, clearButton, options) {
667
- const penWeight = parseFloat(options.penWeight || "2") || 2;
668
- const resizeTarget = canvas.parentElement instanceof HTMLElement ? canvas.parentElement : field;
669
- const signaturePad = new SignaturePad(canvas, {
670
- backgroundColor: options.backgroundColor || "rgba(255, 255, 255, 0)",
671
- penColor: options.penColor || "#000000",
672
- dotSize: penWeight,
673
- minWidth: penWeight,
674
- maxWidth: penWeight
675
- });
676
- const resizeCanvas = () => {
677
- const { width, height } = getCanvasSize(canvas);
678
- if (!(width > 0) || !(height > 0)) return;
679
- const ratio = Math.max(window.devicePixelRatio || 1, 1);
680
- const context = canvas.getContext("2d");
681
- if (!context) return;
682
- const existingValue = input.value || (signaturePad.isEmpty() ? "" : signaturePad.toDataURL());
683
- canvas.width = width * ratio;
684
- canvas.height = height * ratio;
685
- context.setTransform(1, 0, 0, 1, 0, 0);
686
- context.scale(ratio, ratio);
687
- signaturePad.clear();
688
- drawValueOnCanvas(canvas, existingValue);
689
- };
690
- const scheduleResize = (delay = 0) => {
691
- window.setTimeout(() => {
692
- window.requestAnimationFrame(() => {
693
- resizeCanvas();
694
- });
695
- }, delay);
696
- };
697
- const resizeHandler = () => {
698
- scheduleResize();
699
- };
700
- const pageNavigateHandler = () => {
701
- scheduleResize(100);
702
- };
703
- const resizeObserver = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(() => {
704
- scheduleResize();
705
- });
706
- const syncInputValue = (nextValue) => {
707
- const valueChanged = input.value !== nextValue;
708
- input.value = nextValue;
709
- if (!valueChanged) return;
710
- input.dispatchEvent(new Event("input", { bubbles: true }));
711
- input.dispatchEvent(new Event("change", { bubbles: true }));
712
- };
713
- const syncValue = () => {
714
- syncInputValue(signaturePad.isEmpty() ? "" : signaturePad.toDataURL());
715
- };
716
- const clearSignature = () => {
717
- signaturePad.clear();
718
- syncInputValue("");
719
- };
720
- signaturePad.addEventListener("endStroke", syncValue);
721
- window.addEventListener("resize", resizeHandler);
722
- root.addEventListener("formie:page:navigate:after", pageNavigateHandler);
723
- resizeObserver?.observe(resizeTarget);
724
- scheduleResize();
725
- if (clearButton) clearButton.addEventListener("click", clearSignature);
726
- dispatchFieldEvent(field, MODULE_ID, "init", { signature: signaturePad });
727
- return () => {
728
- signaturePad.removeEventListener("endStroke", syncValue);
729
- window.removeEventListener("resize", resizeHandler);
730
- root.removeEventListener("formie:page:navigate:after", pageNavigateHandler);
731
- resizeObserver?.disconnect();
732
- if (clearButton) clearButton.removeEventListener("click", clearSignature);
733
- signaturePad.clear();
734
- };
735
- }
736
- var signatureModule = {
737
- id: MODULE_ID,
738
- kind: "field",
739
- match: (ctx) => {
740
- return !!ctx.target.querySelector(CANVAS_SELECTOR);
741
- },
742
- setup: async (ctx) => {
743
- const options = ctx.options || {};
744
- const root = ctx.root instanceof HTMLElement ? ctx.root : ctx.target instanceof HTMLElement ? ctx.target : null;
745
- if (!root) return;
746
- const cleanups = getModuleFieldContainers(ctx).map((field) => {
747
- const input = field.querySelector(INPUT_SELECTOR);
748
- const canvas = field.querySelector(CANVAS_SELECTOR);
749
- const clearButton = field.querySelector(CLEAR_SELECTOR);
750
- if (!(input instanceof HTMLInputElement) || !(canvas instanceof HTMLCanvasElement)) return () => {};
751
- return initSignatureField(root, field, input, canvas, clearButton instanceof HTMLElement ? clearButton : null, options);
752
- });
753
- await ctx.emit("formie:module:signature:init", { count: cleanups.length });
754
- return { destroy: () => {
755
- cleanups.forEach((cleanup) => {
756
- cleanup();
757
- });
758
- ctx.emit("formie:module:signature:destroy", {});
759
- } };
760
- }
761
- };
762
- //#endregion
763
- export { signatureModule };