@internetarchive/elements 1.1.7-webdev-9378.0 → 1.1.7-webdev-9054.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/dist/src/elements/ia-donation-form/analytics.d.ts +12 -0
- package/dist/src/elements/ia-donation-form/analytics.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/analytics.js +2 -0
- package/dist/src/elements/ia-donation-form/analytics.js.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/braintree-manager-interface.d.ts +79 -0
- package/dist/src/elements/ia-donation-form/braintree/braintree-manager-interface.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/braintree-manager-interface.js +2 -0
- package/dist/src/elements/ia-donation-form/braintree/braintree-manager-interface.js.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/braintree-manager.d.ts +73 -0
- package/dist/src/elements/ia-donation-form/braintree/braintree-manager.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/braintree-manager.js +126 -0
- package/dist/src/elements/ia-donation-form/braintree/braintree-manager.js.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/hosting-environment.d.ts +10 -0
- package/dist/src/elements/ia-donation-form/braintree/hosting-environment.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/hosting-environment.js +9 -0
- package/dist/src/elements/ia-donation-form/braintree/hosting-environment.js.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-clients.d.ts +47 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-clients.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-clients.js +104 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-clients.js.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/apple-pay/apple-pay-interface.d.ts +11 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/apple-pay/apple-pay-interface.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/apple-pay/apple-pay-interface.js +2 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/apple-pay/apple-pay-interface.js.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/apple-pay/apple-pay-session-datasource-interface.d.ts +20 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/apple-pay/apple-pay-session-datasource-interface.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/apple-pay/apple-pay-session-datasource-interface.js +2 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/apple-pay/apple-pay-session-datasource-interface.js.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/apple-pay/apple-pay-session-datasource.d.ts +21 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/apple-pay/apple-pay-session-datasource.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/apple-pay/apple-pay-session-datasource.js +83 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/apple-pay/apple-pay-session-datasource.js.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/apple-pay/apple-pay-session-manager.d.ts +11 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/apple-pay/apple-pay-session-manager.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/apple-pay/apple-pay-session-manager.js +13 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/apple-pay/apple-pay-session-manager.js.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/apple-pay/apple-pay.d.ts +27 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/apple-pay/apple-pay.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/apple-pay/apple-pay.js +67 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/apple-pay/apple-pay.js.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/credit-card/credit-card-interface.d.ts +19 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/credit-card/credit-card-interface.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/credit-card/credit-card-interface.js +2 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/credit-card/credit-card-interface.js.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/credit-card/credit-card.d.ts +42 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/credit-card/credit-card.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/credit-card/credit-card.js +99 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/credit-card/credit-card.js.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/credit-card/hosted-field-configuration.d.ts +14 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/credit-card/hosted-field-configuration.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/credit-card/hosted-field-configuration.js +9 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/credit-card/hosted-field-configuration.js.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/credit-card/hosted-field-container.d.ts +40 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/credit-card/hosted-field-container.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/credit-card/hosted-field-container.js +58 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/credit-card/hosted-field-container.js.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/google-pay/google-pay-interface.d.ts +8 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/google-pay/google-pay-interface.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/google-pay/google-pay-interface.js +2 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/google-pay/google-pay-interface.js.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/google-pay/google-pay.d.ts +19 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/google-pay/google-pay.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/google-pay/google-pay.js +45 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/google-pay/google-pay.js.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/paypal/paypal-button-datasource.d.ts +57 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/paypal/paypal-button-datasource.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/paypal/paypal-button-datasource.js +44 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/paypal/paypal-button-datasource.js.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/paypal/paypal-interface.d.ts +14 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/paypal/paypal-interface.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/paypal/paypal-interface.js +2 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/paypal/paypal-interface.js.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/paypal/paypal.d.ts +27 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/paypal/paypal.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/paypal/paypal.js +44 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/paypal/paypal.js.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/venmo/venmo-interface.d.ts +8 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/venmo/venmo-interface.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/venmo/venmo-interface.js +2 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/venmo/venmo-interface.js.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/venmo/venmo-restoration-state-handler.d.ts +44 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/venmo/venmo-restoration-state-handler.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/venmo/venmo-restoration-state-handler.js +65 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/venmo/venmo-restoration-state-handler.js.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/venmo/venmo.d.ts +25 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/venmo/venmo.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/venmo/venmo.js +42 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers/venmo/venmo.js.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers-interface.d.ts +18 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers-interface.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers-interface.js +2 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers-interface.js.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers.d.ts +42 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers.js +99 -0
- package/dist/src/elements/ia-donation-form/braintree/payment-providers.js.map +1 -0
- package/dist/src/elements/ia-donation-form/donation-form-error.d.ts +5 -0
- package/dist/src/elements/ia-donation-form/donation-form-error.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/donation-form-error.js +8 -0
- package/dist/src/elements/ia-donation-form/donation-form-error.js.map +1 -0
- package/dist/src/elements/ia-donation-form/flow-handlers/donation-flow-modal-manager.d.ts +118 -0
- package/dist/src/elements/ia-donation-form/flow-handlers/donation-flow-modal-manager.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/flow-handlers/donation-flow-modal-manager.js +194 -0
- package/dist/src/elements/ia-donation-form/flow-handlers/donation-flow-modal-manager.js.map +1 -0
- package/dist/src/elements/ia-donation-form/flow-handlers/handlers/apple-pay-flow-handler.d.ts +24 -0
- package/dist/src/elements/ia-donation-form/flow-handlers/handlers/apple-pay-flow-handler.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/flow-handlers/handlers/apple-pay-flow-handler.js +70 -0
- package/dist/src/elements/ia-donation-form/flow-handlers/handlers/apple-pay-flow-handler.js.map +1 -0
- package/dist/src/elements/ia-donation-form/flow-handlers/handlers/credit-card-flow-handler.d.ts +44 -0
- package/dist/src/elements/ia-donation-form/flow-handlers/handlers/credit-card-flow-handler.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/flow-handlers/handlers/credit-card-flow-handler.js +116 -0
- package/dist/src/elements/ia-donation-form/flow-handlers/handlers/credit-card-flow-handler.js.map +1 -0
- package/dist/src/elements/ia-donation-form/flow-handlers/handlers/google-pay-flow-handler.d.ts +24 -0
- package/dist/src/elements/ia-donation-form/flow-handlers/handlers/google-pay-flow-handler.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/flow-handlers/handlers/google-pay-flow-handler.js +74 -0
- package/dist/src/elements/ia-donation-form/flow-handlers/handlers/google-pay-flow-handler.js.map +1 -0
- package/dist/src/elements/ia-donation-form/flow-handlers/handlers/paypal-flow-handler.d.ts +47 -0
- package/dist/src/elements/ia-donation-form/flow-handlers/handlers/paypal-flow-handler.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/flow-handlers/handlers/paypal-flow-handler.js +204 -0
- package/dist/src/elements/ia-donation-form/flow-handlers/handlers/paypal-flow-handler.js.map +1 -0
- package/dist/src/elements/ia-donation-form/flow-handlers/handlers/venmo-flow-handler.d.ts +30 -0
- package/dist/src/elements/ia-donation-form/flow-handlers/handlers/venmo-flow-handler.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/flow-handlers/handlers/venmo-flow-handler.js +77 -0
- package/dist/src/elements/ia-donation-form/flow-handlers/handlers/venmo-flow-handler.js.map +1 -0
- package/dist/src/elements/ia-donation-form/flow-handlers/payment-flow-handlers.d.ts +80 -0
- package/dist/src/elements/ia-donation-form/flow-handlers/payment-flow-handlers.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/flow-handlers/payment-flow-handlers.js +72 -0
- package/dist/src/elements/ia-donation-form/flow-handlers/payment-flow-handlers.js.map +1 -0
- package/dist/src/elements/ia-donation-form/form-elements/contact-form/autocomplete-field-options.d.ts +2 -0
- package/dist/src/elements/ia-donation-form/form-elements/contact-form/autocomplete-field-options.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/form-elements/contact-form/autocomplete-field-options.js +2 -0
- package/dist/src/elements/ia-donation-form/form-elements/contact-form/autocomplete-field-options.js.map +1 -0
- package/dist/src/elements/ia-donation-form/form-elements/contact-form/countries.d.ts +3 -0
- package/dist/src/elements/ia-donation-form/form-elements/contact-form/countries.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/form-elements/contact-form/countries.js +254 -0
- package/dist/src/elements/ia-donation-form/form-elements/contact-form/countries.js.map +1 -0
- package/dist/src/elements/ia-donation-form/form-elements/contact-form/ia-donation-contact-form.d.ts +68 -0
- package/dist/src/elements/ia-donation-form/form-elements/contact-form/ia-donation-contact-form.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/form-elements/contact-form/ia-donation-contact-form.js +483 -0
- package/dist/src/elements/ia-donation-form/form-elements/contact-form/ia-donation-contact-form.js.map +1 -0
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-badged-input.d.ts +26 -0
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-badged-input.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-badged-input.js +163 -0
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-badged-input.js.map +1 -0
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-credit-card-fields.d.ts +39 -0
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-credit-card-fields.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-credit-card-fields.js +212 -0
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-credit-card-fields.js.map +1 -0
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-edit-donation.d.ts +118 -0
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-edit-donation.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-edit-donation.js +774 -0
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-edit-donation.js.map +1 -0
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-header.d.ts +31 -0
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-header.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-header.js +93 -0
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-header.js.map +1 -0
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-payment-selector.d.ts +33 -0
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-payment-selector.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-payment-selector.js +380 -0
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-payment-selector.js.map +1 -0
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-summary.d.ts +11 -0
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-summary.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-summary.js +59 -0
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-summary.js.map +1 -0
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-total-amount.d.ts +10 -0
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-total-amount.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-total-amount.js +75 -0
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-total-amount.js.map +1 -0
- package/dist/src/elements/ia-donation-form/ia-donation-form-controller.d.ts +111 -0
- package/dist/src/elements/ia-donation-form/ia-donation-form-controller.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/ia-donation-form-controller.js +522 -0
- package/dist/src/elements/ia-donation-form/ia-donation-form-controller.js.map +1 -0
- package/dist/src/elements/ia-donation-form/ia-donation-form.d.ts +95 -0
- package/dist/src/elements/ia-donation-form/ia-donation-form.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/ia-donation-form.js +522 -0
- package/dist/src/elements/ia-donation-form/ia-donation-form.js.map +1 -0
- package/dist/src/elements/ia-donation-form/icons/apple-pay.svg +22 -0
- package/dist/src/elements/ia-donation-form/icons/calendar.svg +12 -0
- package/dist/src/elements/ia-donation-form/icons/credit-card.svg +7 -0
- package/dist/src/elements/ia-donation-form/icons/google-pay.svg +38 -0
- package/dist/src/elements/ia-donation-form/icons/lock.svg +6 -0
- package/dist/src/elements/ia-donation-form/icons/paypal.svg +39 -0
- package/dist/src/elements/ia-donation-form/icons/venmo.svg +9 -0
- package/dist/src/elements/ia-donation-form/icons.d.ts +9 -0
- package/dist/src/elements/ia-donation-form/icons.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/icons.js +27 -0
- package/dist/src/elements/ia-donation-form/icons.js.map +1 -0
- package/dist/src/elements/ia-donation-form/modals/ia-donation-confirm-modal.d.ts +27 -0
- package/dist/src/elements/ia-donation-form/modals/ia-donation-confirm-modal.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/modals/ia-donation-confirm-modal.js +195 -0
- package/dist/src/elements/ia-donation-form/modals/ia-donation-confirm-modal.js.map +1 -0
- package/dist/src/elements/ia-donation-form/modals/ia-donation-error-modal-content.d.ts +7 -0
- package/dist/src/elements/ia-donation-form/modals/ia-donation-error-modal-content.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/modals/ia-donation-error-modal-content.js +63 -0
- package/dist/src/elements/ia-donation-form/modals/ia-donation-error-modal-content.js.map +1 -0
- package/dist/src/elements/ia-donation-form/modals/ia-donation-upsell-modal-content.d.ts +28 -0
- package/dist/src/elements/ia-donation-form/modals/ia-donation-upsell-modal-content.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/modals/ia-donation-upsell-modal-content.js +313 -0
- package/dist/src/elements/ia-donation-form/modals/ia-donation-upsell-modal-content.js.map +1 -0
- package/dist/src/elements/ia-donation-form/recaptcha-manager.d.ts +36 -0
- package/dist/src/elements/ia-donation-form/recaptcha-manager.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/recaptcha-manager.js +76 -0
- package/dist/src/elements/ia-donation-form/recaptcha-manager.js.map +1 -0
- package/dist/src/elements/ia-image-viewer/image-viewer-gestures.d.ts.map +1 -1
- package/dist/src/elements/ia-image-viewer/image-viewer-gestures.js +2 -4
- package/dist/src/elements/ia-image-viewer/image-viewer-gestures.js.map +1 -1
- package/package.json +12 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-viewer-gestures.js","sourceRoot":"","sources":["../../../../src/elements/ia-image-viewer/image-viewer-gestures.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAiCxE,0EAA0E;AAC1E,MAAM,eAAe,GAAG,EAAE,CAAC;AAE3B,sEAAsE;AACtE,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAEnC,4EAA4E;AAC5E,MAAM,oBAAoB,GAAG,GAAG,CAAC;AAEjC,+DAA+D;AAC/D,MAAM,aAAa,GAAG,GAAG,CAAC;AAE1B,qEAAqE;AACrE,MAAM,YAAY,GAAG,GAAG,CAAC;AAEzB,6DAA6D;AAC7D,MAAM,eAAe,GAAG,EAAE,CAAC;AAE3B,iEAAiE;AACjE,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAE9B,yEAAyE;AACzE,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAE/B;;;;;;;GAOG;AACH,MAAM,OAAO,mBAAmB;IAkC9B,YAAY,IAA4B;QAjCxC,4EAA4E;QAC5E,aAAQ,GAAG,KAAK,CAAC;QAIjB;;;;;WAKG;QACK,gBAAW,GAAuB,IAAI,CAAC;QAEvC,gBAAW,GAAkB,IAAI,CAAC;QAElC,gBAAW,GAAkB,IAAI,CAAC;QA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CAAC;IAC5E,CAAC;CAuCF","sourcesContent":["import type { ReactiveController, ReactiveControllerHost } from 'lit';\n\nimport { prefersReducedMotion } from '@src/util/prefers-reduced-motion';\nimport type { SlideDirection } from './models';\n\n/** What the gesture controller needs from the viewer it drives. */\nexport type ImageViewerGestureHost = ReactiveControllerHost & {\n readonly imageCount: number;\n\n readonly currentIndex: number;\n\n /** The element gestures are tracked against, once it has rendered. */\n readonly imageArea?: HTMLElement;\n\n /** The element a drag translates. */\n readonly slideTrack?: HTMLElement;\n\n /** Commits an in-flight slide animation so a new one starts from rest. */\n settleIfAnimating(): void;\n\n showNext(): void;\n\n showPrevious(): void;\n\n preloadAroundIndex(index: number): void;\n\n /** Adds the neighbouring slides a drag reveals on either side. */\n insertDragSlides(): void;\n\n removeDragSlides(): void;\n\n /** Advances to the neighbouring image a completed drag landed on. */\n commitDrag(direction: SlideDirection): void;\n};\n\n/** Minimum horizontal travel before a gesture counts as a swipe at all */\nconst SWIPE_THRESHOLD = 30;\n\n/** Minimum swipe distance (fraction of width) to commit navigation */\nconst SWIPE_COMMIT_FRACTION = 0.25;\n\n/** Minimum velocity (px/ms) for a flick to commit regardless of distance */\nconst SWIPE_FLICK_VELOCITY = 0.3;\n\n/** Longest the track takes to settle after the finger lifts */\nconst SETTLE_MAX_MS = 300;\n\n/** How long a snap-back takes when the swipe didn't go far enough */\nconst SNAP_BACK_MS = 200;\n\n/** Horizontal wheel travel that adds up to one navigation */\nconst WHEEL_THRESHOLD = 80;\n\n/** How long after an animation to keep ignoring wheel inertia */\nconst WHEEL_COOLDOWN_MS = 300;\n\n/** How far a finger travels before the gesture locks in as horizontal */\nconst SWIPE_LOCK_DISTANCE = 10;\n\n/**\n * Touch, wheel and keyboard navigation for the image viewer.\n *\n * A drag is driven imperatively: it translates the track directly and asks the\n * viewer to insert neighbouring slides by hand, because a re-render mid-gesture\n * would replace the element the touch started on and the browser would fire\n * touchcancel.\n */\nexport class ImageViewerGestures implements ReactiveController {\n /** Whether a drag is in progress. The viewer reads this while rendering. */\n dragging = false;\n\n private host: ImageViewerGestureHost;\n\n /**\n * The element the touch and wheel listeners are currently on, so they can\n * follow the image area when it's replaced. A boolean wouldn't: the area is\n * removed whenever the image list empties, and a later refill renders a\n * different element.\n */\n private listeningTo: HTMLElement | null = null;\n\n private touchStartX: number | null = null;\n\n private touchStartY: number | null = null;\n\n private touchStartTime = 0;\n\n /** Whether the current gesture has locked in as a horizontal swipe */\n private swiping = false;\n\n /** Set when a swipe completes, so the tap it ends on doesn't open the image */\n private swipeHandled = false;\n\n private dragOffsetX = 0;\n\n private wheelDeltaX = 0;\n\n private wheelAnimating = false;\n\n private wheelAnimationEndTime = 0;\n\n constructor(host: ImageViewerGestureHost) {\n this.host = host;\n host.addController(this);\n }\n\n hostConnected(): void {\n document.addEventListener('keydown', this.onKeydown);\n // Reconnecting doesn't schedule an update, so the gesture listeners have\n // to be put back here rather than waiting for one.\n this.attachListeners();\n }\n\n hostUpdated(): void {\n this.attachListeners();\n }\n\n hostDisconnected(): void {\n document.removeEventListener('keydown', this.onKeydown);\n this.detachListeners();\n }\n\n /**\n * Whether a swipe just ended on this tap, meaning the click that follows it\n * should be ignored rather than treated as opening the image.\n */\n consumeSwipeTap(): boolean {\n if (!this.swipeHandled) return false;\n this.swipeHandled = false;\n return true;\n }\n\n /** Lets wheel navigation resume once a slide animation has finished. */\n animationSettled(): void {\n this.wheelAnimating = false;\n this.wheelAnimationEndTime = performance.now();\n this.wheelDeltaX = 0;\n }\n\n /**\n * Points the gesture listeners at the current image area, moving them off\n * the previous one. The area isn't rendered until there are images to show,\n * and it's torn down and rebuilt whenever the list empties and refills, so\n * this runs on every update and re-attaches whenever the element changes.\n */\n private attachListeners(): void {\n const area = this.host.imageArea;\n if (area === this.listeningTo) return;\n this.detachListeners();\n if (!area) return;\n\n this.listeningTo = area;\n area.addEventListener('touchstart', this.onTouchStart, { passive: true });\n area.addEventListener('touchmove', this.onTouchMove, { passive: false });\n area.addEventListener('touchend', this.onTouchEnd, { passive: true });\n area.addEventListener('wheel', this.onWheel, { passive: false });\n }\n\n private detachListeners(): void {\n const area = this.listeningTo;\n if (!area) return;\n area.removeEventListener('touchstart', this.onTouchStart);\n area.removeEventListener('touchmove', this.onTouchMove);\n area.removeEventListener('touchend', this.onTouchEnd);\n area.removeEventListener('wheel', this.onWheel);\n this.listeningTo = null;\n }\n\n private onTouchStart = (e: TouchEvent): void => {\n if (this.host.imageCount <= 1) return;\n this.host.settleIfAnimating();\n const touch = e.touches[0];\n this.touchStartX = touch.clientX;\n this.touchStartY = touch.clientY;\n this.touchStartTime = e.timeStamp;\n this.swiping = false;\n this.dragOffsetX = 0;\n };\n\n private onTouchMove = (e: TouchEvent): void => {\n if (this.touchStartX === null || this.touchStartY === null) return;\n const dx = e.touches[0].clientX - this.touchStartX;\n const dy = e.touches[0].clientY - this.touchStartY;\n\n const locksHorizontal =\n Math.abs(dx) > Math.abs(dy) && Math.abs(dx) > SWIPE_LOCK_DISTANCE;\n if (!this.swiping && locksHorizontal) {\n this.swiping = true;\n this.dragging = true;\n this.host.preloadAroundIndex(this.host.currentIndex);\n this.host.insertDragSlides();\n }\n\n if (!this.swiping) return;\n e.preventDefault();\n\n this.dragOffsetX = dx;\n this.applyDragTransform();\n };\n\n private onTouchEnd = (e: TouchEvent): void => {\n if (this.touchStartX === null) return;\n const dx = e.changedTouches[0].clientX - this.touchStartX;\n const elapsed = e.timeStamp - this.touchStartTime;\n this.touchStartX = null;\n this.touchStartY = null;\n\n if (!this.swiping) return;\n this.swiping = false;\n\n const track = this.host.slideTrack;\n const area = this.host.imageArea;\n if (!track || !area) {\n this.dragging = false;\n return;\n }\n\n const width = area.offsetWidth;\n const velocity = Math.abs(dx) / Math.max(elapsed, 1);\n const pastThreshold = Math.abs(dx) > width * SWIPE_COMMIT_FRACTION;\n const flicked = velocity > SWIPE_FLICK_VELOCITY;\n const shouldCommit =\n (pastThreshold || flicked) && Math.abs(dx) >= SWIPE_THRESHOLD;\n const direction: SlideDirection = dx < 0 ? 'next' : 'prev';\n\n this.swipeHandled = true;\n\n // The rest of the way is proportional to how far the finger already got,\n // so a nearly complete swipe finishes almost instantly.\n const remainingFraction = (width - Math.abs(dx)) / width;\n const completionDuration = shouldCommit\n ? Math.round(\n Math.max(\n 100,\n Math.min(SETTLE_MAX_MS, remainingFraction * SETTLE_MAX_MS),\n ),\n )\n : SNAP_BACK_MS;\n\n const finalTransform = !shouldCommit\n ? 'translateX(-100%)'\n : direction === 'next'\n ? 'translateX(-200%)'\n : 'translateX(0%)';\n\n const finish = (): void => {\n track.style.transition = '';\n track.style.transform = '';\n\n if (shouldCommit) this.host.commitDrag(direction);\n\n this.dragging = false;\n this.dragOffsetX = 0;\n // Remove the hand-inserted slides before the viewer renders, since it\n // doesn't track them and would leave them in the track.\n this.host.removeDragSlides();\n this.host.preloadAroundIndex(this.host.currentIndex);\n this.host.requestUpdate();\n };\n\n // With reduced motion there's nothing to transition, and a zero-duration\n // transition doesn't fire transitionend, so settle straight away rather\n // than waiting on the timeout that would otherwise cover for it.\n if (prefersReducedMotion()) {\n track.style.transform = finalTransform;\n finish();\n return;\n }\n\n track.style.transition = `transform ${completionDuration}ms ease-out`;\n track.style.transform = finalTransform;\n\n let settled = false;\n const onTransitionDone = (): void => {\n if (settled) return;\n settled = true;\n track.removeEventListener('transitionend', onTransitionDone);\n finish();\n };\n\n track.addEventListener('transitionend', onTransitionDone);\n // Fallback in case transitionend doesn't fire\n setTimeout(onTransitionDone, completionDuration + 50);\n };\n\n /** Applies the drag offset to the track during touch gestures. */\n private applyDragTransform(): void {\n const track = this.host.slideTrack;\n if (!this.dragging || !track) return;\n track.style.transform = `translateX(calc(-100% + ${this.dragOffsetX}px))`;\n }\n\n private onWheel = (e: WheelEvent): void => {\n if (this.host.imageCount <= 1) return;\n\n // Ignore vertical-dominant scrolls\n if (Math.abs(e.deltaY) > Math.abs(e.deltaX)) return;\n if (e.deltaX === 0) return;\n\n e.preventDefault();\n\n // Block during animation and for a brief cooldown after to absorb inertia\n const inCooldown =\n performance.now() - this.wheelAnimationEndTime < WHEEL_COOLDOWN_MS;\n if (this.wheelAnimating || inCooldown) {\n this.wheelDeltaX = 0;\n return;\n }\n\n this.wheelDeltaX += e.deltaX;\n if (Math.abs(this.wheelDeltaX) < WHEEL_THRESHOLD) return;\n\n const forward = this.wheelDeltaX > 0;\n this.wheelDeltaX = 0;\n this.wheelAnimating = true;\n if (forward) this.host.showNext();\n else this.host.showPrevious();\n };\n\n private onKeydown = (e: KeyboardEvent): void => {\n if (this.host.imageCount <= 1) return;\n // A listener on `document` sees a shadow-DOM event retargeted to its\n // outermost host, so the focused field is the first entry in the path.\n const target = (e.composedPath()[0] ?? e.target) as HTMLElement;\n if (['INPUT', 'TEXTAREA', 'SELECT'].includes(target.tagName)) return;\n if (target.isContentEditable) return;\n if (e.key === 'ArrowLeft') this.host.showPrevious();\n else if (e.key === 'ArrowRight') this.host.showNext();\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"image-viewer-gestures.js","sourceRoot":"","sources":["../../../../src/elements/ia-image-viewer/image-viewer-gestures.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAiCxE,0EAA0E;AAC1E,MAAM,eAAe,GAAG,EAAE,CAAC;AAE3B,sEAAsE;AACtE,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAEnC,4EAA4E;AAC5E,MAAM,oBAAoB,GAAG,GAAG,CAAC;AAEjC,+DAA+D;AAC/D,MAAM,aAAa,GAAG,GAAG,CAAC;AAE1B,qEAAqE;AACrE,MAAM,YAAY,GAAG,GAAG,CAAC;AAEzB,6DAA6D;AAC7D,MAAM,eAAe,GAAG,EAAE,CAAC;AAE3B,iEAAiE;AACjE,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAE9B,yEAAyE;AACzE,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAE/B;;;;;;;GAOG;AACH,MAAM,OAAO,mBAAmB;IAkC9B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rC,KAAK,CAAC,KAAK,CAAC,SAAS,GAAG,2BAA2B,IAAI,CAAC,WAAW,MAAM,CAAC;IAC5E,CAAC;CAqCF","sourcesContent":["import type { ReactiveController, ReactiveControllerHost } from 'lit';\n\nimport { prefersReducedMotion } from '@src/util/prefers-reduced-motion';\nimport type { SlideDirection } from './models';\n\n/** What the gesture controller needs from the viewer it drives. */\nexport type ImageViewerGestureHost = ReactiveControllerHost & {\n readonly imageCount: number;\n\n readonly currentIndex: number;\n\n /** The element gestures are tracked against, once it has rendered. */\n readonly imageArea?: HTMLElement;\n\n /** The element a drag translates. */\n readonly slideTrack?: HTMLElement;\n\n /** Commits an in-flight slide animation so a new one starts from rest. */\n settleIfAnimating(): void;\n\n showNext(): void;\n\n showPrevious(): void;\n\n preloadAroundIndex(index: number): void;\n\n /** Adds the neighbouring slides a drag reveals on either side. */\n insertDragSlides(): void;\n\n removeDragSlides(): void;\n\n /** Advances to the neighbouring image a completed drag landed on. */\n commitDrag(direction: SlideDirection): void;\n};\n\n/** Minimum horizontal travel before a gesture counts as a swipe at all */\nconst SWIPE_THRESHOLD = 30;\n\n/** Minimum swipe distance (fraction of width) to commit navigation */\nconst SWIPE_COMMIT_FRACTION = 0.25;\n\n/** Minimum velocity (px/ms) for a flick to commit regardless of distance */\nconst SWIPE_FLICK_VELOCITY = 0.3;\n\n/** Longest the track takes to settle after the finger lifts */\nconst SETTLE_MAX_MS = 300;\n\n/** How long a snap-back takes when the swipe didn't go far enough */\nconst SNAP_BACK_MS = 200;\n\n/** Horizontal wheel travel that adds up to one navigation */\nconst WHEEL_THRESHOLD = 80;\n\n/** How long after an animation to keep ignoring wheel inertia */\nconst WHEEL_COOLDOWN_MS = 300;\n\n/** How far a finger travels before the gesture locks in as horizontal */\nconst SWIPE_LOCK_DISTANCE = 10;\n\n/**\n * Touch, wheel and keyboard navigation for the image viewer.\n *\n * A drag is driven imperatively: it translates the track directly and asks the\n * viewer to insert neighbouring slides by hand, because a re-render mid-gesture\n * would replace the element the touch started on and the browser would fire\n * touchcancel.\n */\nexport class ImageViewerGestures implements ReactiveController {\n /** Whether a drag is in progress. The viewer reads this while rendering. */\n dragging = false;\n\n private host: ImageViewerGestureHost;\n\n /**\n * The element the touch and wheel listeners are currently on, so they can\n * follow the image area when it's replaced. A boolean wouldn't: the area is\n * removed whenever the image list empties, and a later refill renders a\n * different element.\n */\n private listeningTo: HTMLElement | null = null;\n\n private touchStartX: number | null = null;\n\n private touchStartY: number | null = null;\n\n private touchStartTime = 0;\n\n /** Whether the current gesture has locked in as a horizontal swipe */\n private swiping = false;\n\n /** Set when a swipe completes, so the tap it ends on doesn't open the image */\n private swipeHandled = false;\n\n private dragOffsetX = 0;\n\n private wheelDeltaX = 0;\n\n private wheelAnimating = false;\n\n private wheelAnimationEndTime = 0;\n\n constructor(host: ImageViewerGestureHost) {\n this.host = host;\n host.addController(this);\n }\n\n hostConnected(): void {\n document.addEventListener('keydown', this.onKeydown);\n // Reconnecting doesn't schedule an update, so the gesture listeners have\n // to be put back here rather than waiting for one.\n this.attachListeners();\n }\n\n hostUpdated(): void {\n this.attachListeners();\n }\n\n hostDisconnected(): void {\n document.removeEventListener('keydown', this.onKeydown);\n this.detachListeners();\n }\n\n /**\n * Whether a swipe just ended on this tap, meaning the click that follows it\n * should be ignored rather than treated as opening the image.\n */\n consumeSwipeTap(): boolean {\n if (!this.swipeHandled) return false;\n this.swipeHandled = false;\n return true;\n }\n\n /** Lets wheel navigation resume once a slide animation has finished. */\n animationSettled(): void {\n this.wheelAnimating = false;\n this.wheelAnimationEndTime = performance.now();\n this.wheelDeltaX = 0;\n }\n\n /**\n * Points the gesture listeners at the current image area, moving them off\n * the previous one. The area isn't rendered until there are images to show,\n * and it's torn down and rebuilt whenever the list empties and refills, so\n * this runs on every update and re-attaches whenever the element changes.\n */\n private attachListeners(): void {\n const area = this.host.imageArea;\n if (area === this.listeningTo) return;\n this.detachListeners();\n if (!area) return;\n\n this.listeningTo = area;\n area.addEventListener('touchstart', this.onTouchStart, { passive: true });\n area.addEventListener('touchmove', this.onTouchMove, { passive: false });\n area.addEventListener('touchend', this.onTouchEnd, { passive: true });\n area.addEventListener('wheel', this.onWheel, { passive: false });\n }\n\n private detachListeners(): void {\n const area = this.listeningTo;\n if (!area) return;\n area.removeEventListener('touchstart', this.onTouchStart);\n area.removeEventListener('touchmove', this.onTouchMove);\n area.removeEventListener('touchend', this.onTouchEnd);\n area.removeEventListener('wheel', this.onWheel);\n this.listeningTo = null;\n }\n\n private onTouchStart = (e: TouchEvent): void => {\n if (this.host.imageCount <= 1) return;\n this.host.settleIfAnimating();\n const touch = e.touches[0];\n this.touchStartX = touch.clientX;\n this.touchStartY = touch.clientY;\n this.touchStartTime = e.timeStamp;\n this.swiping = false;\n this.dragOffsetX = 0;\n };\n\n private onTouchMove = (e: TouchEvent): void => {\n if (this.touchStartX === null || this.touchStartY === null) return;\n const dx = e.touches[0].clientX - this.touchStartX;\n const dy = e.touches[0].clientY - this.touchStartY;\n\n const locksHorizontal =\n Math.abs(dx) > Math.abs(dy) && Math.abs(dx) > SWIPE_LOCK_DISTANCE;\n if (!this.swiping && locksHorizontal) {\n this.swiping = true;\n this.dragging = true;\n this.host.preloadAroundIndex(this.host.currentIndex);\n this.host.insertDragSlides();\n }\n\n if (!this.swiping) return;\n e.preventDefault();\n\n this.dragOffsetX = dx;\n this.applyDragTransform();\n };\n\n private onTouchEnd = (e: TouchEvent): void => {\n if (this.touchStartX === null) return;\n const dx = e.changedTouches[0].clientX - this.touchStartX;\n const elapsed = e.timeStamp - this.touchStartTime;\n this.touchStartX = null;\n this.touchStartY = null;\n\n if (!this.swiping) return;\n this.swiping = false;\n\n const track = this.host.slideTrack;\n const area = this.host.imageArea;\n if (!track || !area) {\n this.dragging = false;\n return;\n }\n\n const width = area.offsetWidth;\n const velocity = Math.abs(dx) / Math.max(elapsed, 1);\n const pastThreshold = Math.abs(dx) > width * SWIPE_COMMIT_FRACTION;\n const flicked = velocity > SWIPE_FLICK_VELOCITY;\n const shouldCommit =\n (pastThreshold || flicked) && Math.abs(dx) >= SWIPE_THRESHOLD;\n const direction: SlideDirection = dx < 0 ? 'next' : 'prev';\n\n this.swipeHandled = true;\n\n // The rest of the way is proportional to how far the finger already got,\n // so a nearly complete swipe finishes almost instantly.\n const remainingFraction = (width - Math.abs(dx)) / width;\n const completionDuration = shouldCommit\n ? Math.round(\n Math.max(\n 100,\n Math.min(SETTLE_MAX_MS, remainingFraction * SETTLE_MAX_MS),\n ),\n )\n : SNAP_BACK_MS;\n\n const finalTransform = !shouldCommit\n ? 'translateX(-100%)'\n : direction === 'next'\n ? 'translateX(-200%)'\n : 'translateX(0%)';\n\n const finish = (): void => {\n track.style.transition = '';\n track.style.transform = '';\n\n if (shouldCommit) this.host.commitDrag(direction);\n\n this.dragging = false;\n this.dragOffsetX = 0;\n // Remove the hand-inserted slides before the viewer renders, since it\n // doesn't track them and would leave them in the track.\n this.host.removeDragSlides();\n this.host.preloadAroundIndex(this.host.currentIndex);\n this.host.requestUpdate();\n };\n\n // With reduced motion there's nothing to transition, and a zero-duration\n // transition doesn't fire transitionend, so settle straight away rather\n // than waiting on the timeout that would otherwise cover for it.\n if (prefersReducedMotion()) {\n track.style.transform = finalTransform;\n finish();\n return;\n }\n\n track.style.transition = `transform ${completionDuration}ms ease-out`;\n track.style.transform = finalTransform;\n\n let settled = false;\n const onTransitionDone = (): void => {\n if (settled) return;\n settled = true;\n track.removeEventListener('transitionend', onTransitionDone);\n finish();\n };\n\n track.addEventListener('transitionend', onTransitionDone);\n // Fallback in case transitionend doesn't fire\n setTimeout(onTransitionDone, completionDuration + 50);\n };\n\n /** Applies the drag offset to the track during touch gestures. */\n private applyDragTransform(): void {\n const track = this.host.slideTrack;\n if (!this.dragging || !track) return;\n track.style.transform = `translateX(calc(-100% + ${this.dragOffsetX}px))`;\n }\n\n private onWheel = (e: WheelEvent): void => {\n if (this.host.imageCount <= 1) return;\n\n // Ignore vertical-dominant scrolls\n if (Math.abs(e.deltaY) > Math.abs(e.deltaX)) return;\n if (e.deltaX === 0) return;\n\n e.preventDefault();\n\n // Block during animation and for a brief cooldown after to absorb inertia\n const inCooldown =\n performance.now() - this.wheelAnimationEndTime < WHEEL_COOLDOWN_MS;\n if (this.wheelAnimating || inCooldown) {\n this.wheelDeltaX = 0;\n return;\n }\n\n this.wheelDeltaX += e.deltaX;\n if (Math.abs(this.wheelDeltaX) < WHEEL_THRESHOLD) return;\n\n const forward = this.wheelDeltaX > 0;\n this.wheelDeltaX = 0;\n this.wheelAnimating = true;\n if (forward) this.host.showNext();\n else this.host.showPrevious();\n };\n\n private onKeydown = (e: KeyboardEvent): void => {\n if (this.host.imageCount <= 1) return;\n const target = e.target as HTMLElement;\n if (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA') return;\n if (target.isContentEditable) return;\n if (e.key === 'ArrowLeft') this.host.showPrevious();\n else if (e.key === 'ArrowRight') this.host.showNext();\n };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@internetarchive/elements",
|
|
3
|
-
"version": "1.1.7-webdev-
|
|
3
|
+
"version": "1.1.7-webdev-9054.1",
|
|
4
4
|
"description": "A web component library from the Internet Archive.",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"type": "module",
|
|
@@ -34,12 +34,23 @@
|
|
|
34
34
|
"strings:build": "wireit"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
+
"@internetarchive/analytics-manager": "^0.1.5",
|
|
37
38
|
"@internetarchive/ia-clearable-text-input": "^1.1.1",
|
|
38
39
|
"@internetarchive/ia-dropdown": "^2.2.0",
|
|
40
|
+
"@internetarchive/lazy-loader-service": "^0.2.0",
|
|
41
|
+
"@internetarchive/modal-manager": "^2.0.6",
|
|
42
|
+
"@internetarchive/promised-singleton": "^0.2.1",
|
|
39
43
|
"@lit/localize": "^0.12.2",
|
|
44
|
+
"@types/applepayjs": "^14.0.9",
|
|
45
|
+
"@types/braintree-web": "^3.143.0",
|
|
46
|
+
"@types/googlepay": "^0.7.12",
|
|
47
|
+
"@types/grecaptcha": "^3.0.9",
|
|
48
|
+
"@types/paypal-checkout-components": "^4.0.8",
|
|
49
|
+
"currency.js": "^2.0.4",
|
|
40
50
|
"dayjs": "^1.11.23",
|
|
41
51
|
"lit": "^2.8.0 || ^3.3.2",
|
|
42
52
|
"magic-snowflakes": "^7.0.2",
|
|
53
|
+
"nanoevents": "^9.1.0",
|
|
43
54
|
"tslib": "^2.8.1"
|
|
44
55
|
},
|
|
45
56
|
"devDependencies": {
|