@incodetech/web 2.3.0-rc.0 → 2.3.0-rc.2
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/ae-signature/ae-signature.es.js +3 -3
- package/dist/{af-ZA-DTqKc5t4.js → af-ZA-DmmrcQP_.js} +3 -0
- package/dist/{am-EGNy2cbo.js → am-SmKt8V4z.js} +3 -0
- package/dist/antifraud/antifraud.es.js +3 -3
- package/dist/{ar-AE-Cb55U6s-.js → ar-AE-DY9xUJr9.js} +4 -1
- package/dist/{ar-EG-C8ucZII6.js → ar-EG-BgrA461G.js} +4 -1
- package/dist/{ar-MUpu33jy.js → ar-WPzC_zpw.js} +4 -1
- package/dist/authentication/authentication.es.js +4 -4
- package/dist/{autoFocusTitle-CIbcUW_x.js → autoFocusTitle-CLL6_ZUS.js} +1 -1
- package/dist/{az-DlXjPSya.js → az-8ilAuTNz.js} +3 -0
- package/dist/{baseTutorial-DkL0vjUa.js → baseTutorial-OhjVzcAt.js} +3 -3
- package/dist/{bn-BuTjJr44.js → bn-BMTIe4X-.js} +3 -0
- package/dist/{bottomSheet-DtUFrIAG.js → bottomSheet-CVZGrdQw.js} +1 -1
- package/dist/{bs-DUzGtLhU.js → bs-8e1MGcBs.js} +3 -0
- package/dist/{ca-B6SY43GQ.js → ca-DiV9W25J.js} +3 -0
- package/dist/cameraOverlay-BuRzkJoF.js +2 -0
- package/dist/{cameraOverlayHeader-CsokPtuL.js → cameraOverlayHeader-BdTPxRY9.js} +2 -2
- package/dist/{cameraView-DrTBPNWX.js → cameraView-Dquo1xOJ.js} +2 -2
- package/dist/{captureFooter-DWCaAdIU.js → captureFooter-DerfRvcS.js} +3 -3
- package/dist/{ceb-DmXy5txv.js → ceb-D8k4G0Uk.js} +3 -0
- package/dist/certificate-issuance/certificate-issuance.es.js +8 -8
- package/dist/{checkbox-D0wfscwg.js → checkbox-CiB15eSu.js} +2 -2
- package/dist/{connectionError-B61O7L3N.js → connectionError-BHmmESyy.js} +3 -3
- package/dist/consent/consent.es.js +6 -6
- package/dist/{countrySelector-C60Cdc5P.js → countrySelector-Dgy0zp0e.js} +2 -2
- package/dist/cross-document-data-match/cross-document-data-match.es.js +3 -3
- package/dist/{cs-dsQ7umNS.js → cs-BtZAKXkI.js} +4 -1
- package/dist/{cs-CZ-Gn3ZmW27.js → cs-CZ-B2enobPu.js} +4 -1
- package/dist/curp-validation/curp-validation.es.js +11 -11
- package/dist/{customFields-BdnLB6L1.js → customFields-t5hWidwA.js} +9 -9
- package/dist/{customWatchlist-DzeHJAa3.js → customWatchlist-Dqrj_ifl.js} +6 -6
- package/dist/{da-DK-CFQaOERk.js → da-DK-Bg0oZ0np.js} +4 -1
- package/dist/{dashboardTheme-BwKtcRSO.js → dashboardTheme-BRfByCop.js} +1 -1
- package/dist/{dateInputComposed-BcmKKwRL.js → dateInputComposed-0sgVTVDS.js} +4 -4
- package/dist/dateInputComposed-DL1Sy-oV.js +1 -0
- package/dist/{de-BqG02U9o.js → de-C2dDH_5u.js} +4 -1
- package/dist/{permissions-DowRodJj.js → denied-5I0K3X1V.js} +154 -212
- package/dist/document-capture/document-capture.es.js +1 -1
- package/dist/documentCapture-BRiSRQud.js +2 -0
- package/dist/{documentCapture-CoMsW_gC.js → documentCapture-DQ20IS1D.js} +15 -15
- package/dist/dropdownComposed-BMGUsBEM.js +1 -0
- package/dist/{dropdownComposed-DYdI3B4r.js → dropdownComposed-Nr4ooxq9.js} +2 -2
- package/dist/dynamic-forms/dynamic-forms.es.js +10 -10
- package/dist/ekyb/ekyb.es.js +1 -1
- package/dist/{ekybModule-BRh9D01p.js → ekybModule-BXiNK957.js} +12 -12
- package/dist/ekybModule-CkgPRkOG.js +2 -0
- package/dist/ekyc/ekyc.es.js +1 -1
- package/dist/ekycModule-BHctZRnI.js +2 -0
- package/dist/{ekycModule-Da6Bl3jg.js → ekycModule-CEZTJeRG.js} +12 -12
- package/dist/{el-BP_RmMeB.js → el-C4tUaDVo.js} +5 -2
- package/dist/{el-GR-9I2fVd-W.js → el-GR-gHmmh1m6.js} +4 -1
- package/dist/electronic-signature/electronic-signature.es.js +1 -1
- package/dist/{electronic-signature-KFF7qbid.js → electronic-signature-DA0424TH.js} +8 -8
- package/dist/email/email.es.js +7 -7
- package/dist/{emailInput-B_qAEKBC.js → emailInput-BOSd36i6.js} +3 -3
- package/dist/{en-DnIfMNS1.js → en-Cv48UBOv.js} +4 -1
- package/dist/{en-DG-poeSJZ7W.js → en-DG-DlWakiDv.js} +4 -1
- package/dist/{errorContent-CMNfCIo_.js → errorContent-BigJWZzO.js} +5 -5
- package/dist/{es-419-DgAnO5DV.js → es-419-B5kyejuM.js} +4 -1
- package/dist/{es-2x55EFTs.js → es-BQocmnOt.js} +4 -1
- package/dist/{es-ES-BSnroYMU.js → es-ES-CV7_24H6.js} +4 -1
- package/dist/{es-MX-CfztSSs4.js → es-MX-CDNiFYB1.js} +4 -1
- package/dist/{et-CPoI8fYI.js → et-DOU37VZj.js} +5 -2
- package/dist/{expiredId-DJYL_--M.js → expiredId-CZRW7Ybn.js} +5 -5
- package/dist/extensibility.es.js +34 -34
- package/dist/{fa-IR-CVf6F8GG.js → fa-IR-CKX4ttr2.js} +3 -0
- package/dist/face-match/face-match.es.js +1 -1
- package/dist/{faceMatch-CwoYbKBB.js → faceMatch-CIOPXTmy.js} +6 -6
- package/dist/faceMatch-DQUlJejg.js +2 -0
- package/dist/{fi-FI-A4oUFztt.js → fi-FI-DjM3a4dh.js} +3 -0
- package/dist/field-comparison/field-comparison.es.js +1 -1
- package/dist/fieldComparison-BTYIFKdx.js +2 -0
- package/dist/{fieldComparison-D2WI5cYb.js → fieldComparison-Bc_Sb5DW.js} +7 -7
- package/dist/{finalSuccessScreen-BtJ5o2pi.js → finalSuccessScreen-C9Mjs8Se.js} +9 -9
- package/dist/fiscal-qr/fiscal-qr.es.js +15 -9
- package/dist/{flipAnimation-Bb5FQVF-.js → flipAnimation-DSbbOoYU.js} +13 -13
- package/dist/flow/flow.es.js +7 -7
- package/dist/{formField-CBwWQ7wD.js → formField-CRTjuNIn.js} +2 -2
- package/dist/{fr-CA-CI4CD8PC.js → fr-CA-DSKVQet1.js} +4 -1
- package/dist/{fr-ON88Zj-c.js → fr-UicwP0Xf.js} +4 -1
- package/dist/geolocation/geolocation.es.js +8 -8
- package/dist/government-validation/government-validation.es.js +3 -3
- package/dist/{he-pbmbYdr4.js → he-4VZRy5s_.js} +3 -0
- package/dist/{hi-DUIfQ6FS.js → hi-BBTNqCra.js} +3 -0
- package/dist/{hmn-DL-aQCTc.js → hmn-Cqq58Jhl.js} +3 -0
- package/dist/{homeScreen-vLMuzGDq.js → homeScreen-DPDkRuUj.js} +6 -6
- package/dist/{hr-DfJZSVnR.js → hr-BkWpIuVF.js} +3 -0
- package/dist/{ht-DkZi3f0t.js → ht-BXinER2s.js} +3 -0
- package/dist/{hu-ClhgOpVy.js → hu-V8Z3BcQL.js} +4 -1
- package/dist/{icons-eIgP34nj.js → icons-ChbeiU1F.js} +1 -1
- package/dist/id/id.es.js +20 -19
- package/dist/{id-DzyWelEE.js → id-BdeD3LRn.js} +4 -1
- package/dist/id-selfie-flow/id-selfie-flow.es.js +8 -8
- package/dist/id-verification/id-verification.es.js +4 -4
- package/dist/{idOcr-C5R3RWuL.js → idOcr-xqxBKhkH.js} +11 -11
- package/dist/identity-reuse/identity-reuse.es.js +5 -5
- package/dist/{incodeComponent-D3_BSWan.js → incodeComponent-BXv-ZUvM.js} +7 -7
- package/dist/{incodeModule-BQgvYKyr.js → incodeModule-D4WcMjSz.js} +1 -1
- package/dist/index.es.js +2 -2
- package/dist/{inputComposed-CTZnsHLi.js → inputComposed-B3HKwHUe.js} +2 -2
- package/dist/inputComposed-DmzpSYEl.js +1 -0
- package/dist/{it-D_u7w6N4.js → it-BdWa4B_R.js} +5 -2
- package/dist/{ja-JP-Pdxq82Pi.js → ja-JP-F94t25a8.js} +4 -1
- package/dist/{ja-Drh4oAoU.js → ja-dPxfcwiw.js} +4 -1
- package/dist/{jv-DFcKF0Jp.js → jv-CJAjqhgV.js} +3 -0
- package/dist/{ka--2y3Ae63.js → ka-D0dS7apI.js} +3 -0
- package/dist/{kk-CAs7inco.js → kk-D72DztAI.js} +3 -0
- package/dist/{km-BlxkLYfw.js → km-BOq5twXe.js} +8 -5
- package/dist/{ko-B1XhW0dx.js → ko-B4FP6-ld.js} +4 -1
- package/dist/{ko-KP-DO1TCCY3.js → ko-KP-CE7rKRI5.js} +4 -1
- package/dist/{ky-BN92RThU.js → ky-D6GXd3uW.js} +3 -0
- package/dist/{lo-DPUo8xJT.js → lo-BzwFkpRV.js} +3 -0
- package/dist/{lt-CYBwI4Sq.js → lt-hYCw2Wxr.js} +5 -2
- package/dist/{lv-eBlwWu05.js → lv-Dzr48SpJ.js} +4 -1
- package/dist/{mandatoryConsent-D96_9XTp.js → mandatoryConsent-DFHk3udM.js} +6 -6
- package/dist/{manualCaptureButton-igyQk3Yb.js → manualCaptureButton-C_xl28Dq.js} +3 -3
- package/dist/{manualCaptureButton-C9H2_SJS.js → manualCaptureButton-iNAMKfNQ.js} +3 -3
- package/dist/{mk-QMUTND8Y.js → mk-BquI4cFU.js} +3 -0
- package/dist/{mn-CCTUOA1D.js → mn-BiuhSfFg.js} +3 -0
- package/dist/{modal-CmF_MYIK.js → modal-DkFsdSC8.js} +2 -2
- package/dist/{ms-BKJgaJfx.js → ms-DtMkDM7f.js} +3 -0
- package/dist/{my-DyLbN8b0.js → my-BUt_VMls.js} +3 -0
- package/dist/{nb-NO-TVHxhuqB.js → nb-NO-CnkqifLA.js} +3 -0
- package/dist/{ne-gBLZraiK.js → ne-B45P09m7.js} +3 -0
- package/dist/{nl-CrO6Mvej.js → nl-sdA7N8LX.js} +4 -1
- package/dist/{optionAccessibleLabel-CqBUOBxK.js → optionAccessibleLabel-Bvxbm3h7.js} +5 -5
- package/dist/{otpInput-tEovwPs7.js → otpInput-BXacbIjj.js} +6 -6
- package/dist/{passwordInputComposed-DNlYgHHW.js → passwordInputComposed-V8PZXj4w.js} +4 -4
- package/dist/pdfViewer-Bd3GuOdX.js +2 -0
- package/dist/{pdfViewer-4u14PDPr.js → pdfViewer-BnNIXkbM.js} +2 -2
- package/dist/permissions-Im1wwvAx.js +212 -0
- package/dist/phone/phone.es.js +8 -8
- package/dist/{phoneInputComposed-B6sv-uB2.js → phoneInputComposed-33AAWge8.js} +3 -3
- package/dist/{pl-Bde7cCcc.js → pl-Ow8xo1iP.js} +4 -1
- package/dist/{processing-s6GfNwuL.js → processing-BvkU2cgP.js} +1 -1
- package/dist/{pt-BR-DFr2fPNi.js → pt-BR-COOIb6-y.js} +4 -1
- package/dist/{pt-DhDCeOLY.js → pt-DcYhKN01.js} +4 -1
- package/dist/{pt-PT-CpiPMuNf.js → pt-PT-DAajD5DI.js} +4 -1
- package/dist/qe-signature/qe-signature.es.js +3 -3
- package/dist/radioGroupComposed-ReViqCTL.js +1 -0
- package/dist/{radioGroupComposed-DmoMukus.js → radioGroupComposed-zFPuAjVe.js} +2 -2
- package/dist/redirect-to-mobile/redirect-to-mobile.es.js +7 -7
- package/dist/{resendTimer-Cskll9rx.js → resendTimer-zjZwgWGg.js} +1 -1
- package/dist/{resolveApiKey-CB1_7ISm.js → resolveApiKey-BMuguJP1.js} +17 -17
- package/dist/{richText-C8-Ny2SD.js → richText-CYUpc36o.js} +1 -1
- package/dist/{ro-B_ITJxYh.js → ro-Bejk1v9i.js} +4 -1
- package/dist/{ru-Cg4U-rYv.js → ru-KP7UT7ZQ.js} +4 -1
- package/dist/{ru-RU-fR_tbAfz.js → ru-RU-CedWTDru.js} +4 -1
- package/dist/selfie/selfie.es.js +9 -9
- package/dist/signature/signature.es.js +6 -6
- package/dist/{sk-DbraxlnX.js → sk-DZ_6nYfa.js} +5 -2
- package/dist/{sl-DXgvmUsz.js → sl-BthoPfrz.js} +4 -1
- package/dist/{smsTabContent-Dado9q8t.js → smsTabContent-D7Pbftyw.js} +6 -6
- package/dist/{so-HI13bXme.js → so-CvMd2jGv.js} +3 -0
- package/dist/{spacer-ayyj5lMa.js → spacer-CPt4HyL0.js} +1 -1
- package/dist/{spinner-Z-5sEEDQ.js → spinner-CfMsNujU.js} +2 -2
- package/dist/{sr-DAb2JkvB.js → sr-D0reHH_x.js} +3 -0
- package/dist/{sr-Latn-DzSc6KyA.js → sr-Latn-B1BVSu4X.js} +8 -5
- package/dist/{sr-YU-C9HskKa8.js → sr-YU-D-Y29iGg.js} +3 -0
- package/dist/{statusPage-Bqz3Ci4f.js → statusPage-Cid6zFEq.js} +3 -3
- package/dist/{sv-SE-B3X2fvQj.js → sv-SE-DGUEps4k.js} +4 -1
- package/dist/{sw-BVL9Boua.js → sw-CQqWEGxr.js} +3 -0
- package/dist/{tabs-B-ERCzA4.js → tabs-nofQVDZH.js} +1 -1
- package/dist/{th-Cq87oDI8.js → th-CHCtn72G.js} +3 -0
- package/dist/{th-TH-CY5gd6Bd.js → th-TH-CYZLwOUf.js} +3 -0
- package/dist/{tl-DUm9tRZ_.js → tl-DlzBzg--.js} +3 -0
- package/dist/{tl-PH-CNYNkY1M.js → tl-PH-CDmXEWrc.js} +3 -0
- package/dist/{tr-Cg3WJqb6.js → tr-CPxhALj2.js} +5 -2
- package/dist/{tutorial-CHNfV-I3.js → tutorial-qTeHmK5f.js} +10 -10
- package/dist/{typography-ikD4-Z8S.js → typography-Bd5_vWx-.js} +1 -1
- package/dist/{uiConfig-C1jdTj-i.js → uiConfig-CDrg5a4l.js} +83 -83
- package/dist/{uk-UA-DRsynQ5S.js → uk-UA-BICmVckA.js} +4 -1
- package/dist/{uk-C7hhE-77.js → uk-xyS0IiQT.js} +4 -1
- package/dist/{ur-BEX50SCe.js → ur-5ji5zzeY.js} +3 -0
- package/dist/{uz-BYlUXaIK.js → uz-DXYcYA-2.js} +3 -0
- package/dist/{verificationResult-B26DDXFT.js → verificationResult-Og71vbzN.js} +6 -6
- package/dist/{vi-DddAM-WF.js → vi-CtRa1sur.js} +3 -0
- package/dist/video-selfie/video-selfie.es.js +10 -10
- package/dist/watchlist/watchlist.es.js +6 -6
- package/dist/{watchlistForBusiness-o4F6Czxp.js → watchlistForBusiness-D_hnbA3-.js} +8 -8
- package/dist/workflow/workflow.es.js +7 -7
- package/dist/{zh-aG_wPYUs.js → zh-C3m48BR9.js} +4 -1
- package/dist/{zh-CN-B8y9prPe.js → zh-CN-DbLERlYY.js} +4 -1
- package/dist/{zh-HANT-ChrXbHBA.js → zh-HANT-Cx-orZcq.js} +4 -1
- package/dist/{zh-TW-DrkMIR_e.js → zh-TW-CSkhn9XP.js} +4 -1
- package/package.json +2 -2
- package/dist/cameraOverlay-Dn0r4NR9.js +0 -2
- package/dist/dateInputComposed-DPM6l_SL.js +0 -1
- package/dist/documentCapture-DMxz9eqT.js +0 -2
- package/dist/dropdownComposed-CXwC9j18.js +0 -1
- package/dist/ekybModule-C5NPsc0F.js +0 -2
- package/dist/ekycModule-DwKPvgA8.js +0 -2
- package/dist/faceMatch-DCkrehin.js +0 -2
- package/dist/fieldComparison-OwqIkMRe.js +0 -2
- package/dist/inputComposed-wy0-orhJ.js +0 -1
- package/dist/pdfViewer-e2o97yIv.js +0 -2
- package/dist/radioGroupComposed-CJkzLiFc.js +0 -1
- package/dist/useCoverMedia-VLw3OYN_.js +0 -149
- /package/dist/{numberedStep-DYznpDKc.js → numberedStep-C8e_uPaz.js} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "./inputComposed-CTZnsHLi.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "./radioGroupComposed-DmoMukus.js";
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { _ as y, h as q } from "./vendor-preact-C0jX1Cbq.js";
|
|
2
|
-
//#region src/hooks/useCoverMedia.ts
|
|
3
|
-
var CONVERGENCE_TIMEOUT_MS = 1e4;
|
|
4
|
-
var CONVERGENCE_INTERVAL_MS = 100;
|
|
5
|
-
var PENDING_CLASS = "IncodeMediaCoverPending";
|
|
6
|
-
/**
|
|
7
|
-
* Returns the explicit box that produces `object-fit: cover` geometry.
|
|
8
|
-
* Kept pure so the visual calculation is independently testable.
|
|
9
|
-
*/
|
|
10
|
-
function calculateCoverMediaGeometry(sourceWidth, sourceHeight, containerWidth, containerHeight) {
|
|
11
|
-
if (!Number.isFinite(sourceWidth) || !Number.isFinite(sourceHeight) || !Number.isFinite(containerWidth) || !Number.isFinite(containerHeight) || sourceWidth <= 0 || sourceHeight <= 0 || containerWidth <= 0 || containerHeight <= 0) return;
|
|
12
|
-
const scale = Math.max(containerWidth / sourceWidth, containerHeight / sourceHeight);
|
|
13
|
-
const width = sourceWidth * scale;
|
|
14
|
-
const height = sourceHeight * scale;
|
|
15
|
-
return {
|
|
16
|
-
width: `${width.toFixed(2)}px`,
|
|
17
|
-
height: `${height.toFixed(2)}px`,
|
|
18
|
-
left: `${((containerWidth - width) / 2).toFixed(2)}px`,
|
|
19
|
-
top: `${((containerHeight - height) / 2).toFixed(2)}px`
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Safari reports `object-fit` support even when its MediaStream paint is
|
|
24
|
-
* incorrect, so CSS.supports cannot detect this bug. Keep the workaround
|
|
25
|
-
* narrowly scoped to the affected iOS/iPadOS 27 WebKit builds instead.
|
|
26
|
-
*/
|
|
27
|
-
function needsExplicitMediaCover(userAgent, platform, maxTouchPoints) {
|
|
28
|
-
const iosDevice = /\b(?:iPhone|iPad|iPod)\b/.test(userAgent);
|
|
29
|
-
const iosVersion = userAgent.match(/CPU (?:iPhone )?OS (\d+)[_.]/)?.[1];
|
|
30
|
-
if (iosDevice && iosVersion === "27") return true;
|
|
31
|
-
const desktopModeIPad = platform === "MacIntel" && maxTouchPoints > 1;
|
|
32
|
-
const safariVersion = userAgent.match(/Version\/(\d+)[._]/)?.[1];
|
|
33
|
-
return desktopModeIPad && safariVersion === "27";
|
|
34
|
-
}
|
|
35
|
-
function isExplicitMediaCoverNeeded() {
|
|
36
|
-
if (typeof navigator === "undefined") return false;
|
|
37
|
-
return needsExplicitMediaCover(navigator.userAgent, navigator.platform, navigator.maxTouchPoints);
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Applies explicit `cover` geometry only to iOS/iPadOS 27 MediaStream media.
|
|
41
|
-
* Compliant browsers retain native `object-fit: cover`, with no observers,
|
|
42
|
-
* event listeners, polling, or inline geometry.
|
|
43
|
-
*
|
|
44
|
-
* `reattachKey` restarts the workaround when the media source changes. Pass a
|
|
45
|
-
* MediaStream for video and the canvas instance for imperative avatar canvases.
|
|
46
|
-
*/
|
|
47
|
-
function useCoverMedia(mediaRef, reattachKey) {
|
|
48
|
-
const explicitCoverNeeded = isExplicitMediaCoverNeeded();
|
|
49
|
-
const applyCover = q(() => {
|
|
50
|
-
const media = mediaRef.current;
|
|
51
|
-
const container = media?.parentElement;
|
|
52
|
-
if (!media || !container) return false;
|
|
53
|
-
const sourceWidth = media instanceof HTMLVideoElement ? media.videoWidth : media.width;
|
|
54
|
-
const sourceHeight = media instanceof HTMLVideoElement ? media.videoHeight : media.height;
|
|
55
|
-
const { width: containerWidth, height: containerHeight } = container.getBoundingClientRect();
|
|
56
|
-
const geometry = calculateCoverMediaGeometry(sourceWidth, sourceHeight, containerWidth, containerHeight);
|
|
57
|
-
if (!geometry) return false;
|
|
58
|
-
if (media.style.width === geometry.width && media.style.height === geometry.height && media.style.left === geometry.left && media.style.top === geometry.top) return true;
|
|
59
|
-
media.style.maxWidth = "none";
|
|
60
|
-
media.style.maxHeight = "none";
|
|
61
|
-
media.style.right = "auto";
|
|
62
|
-
media.style.bottom = "auto";
|
|
63
|
-
media.style.width = geometry.width;
|
|
64
|
-
media.style.height = geometry.height;
|
|
65
|
-
media.style.left = geometry.left;
|
|
66
|
-
media.style.top = geometry.top;
|
|
67
|
-
return true;
|
|
68
|
-
}, [mediaRef]);
|
|
69
|
-
y(() => {
|
|
70
|
-
if (!explicitCoverNeeded) return;
|
|
71
|
-
const media = mediaRef.current;
|
|
72
|
-
if (!media) return;
|
|
73
|
-
const cleanups = [];
|
|
74
|
-
media.classList.add(PENDING_CLASS);
|
|
75
|
-
cleanups.push(() => media.classList.remove(PENDING_CLASS));
|
|
76
|
-
const reveal = () => media.classList.remove(PENDING_CLASS);
|
|
77
|
-
let pollId;
|
|
78
|
-
let timeoutId;
|
|
79
|
-
const stopPolling = () => {
|
|
80
|
-
if (pollId !== void 0) {
|
|
81
|
-
clearInterval(pollId);
|
|
82
|
-
pollId = void 0;
|
|
83
|
-
}
|
|
84
|
-
if (timeoutId !== void 0) {
|
|
85
|
-
clearTimeout(timeoutId);
|
|
86
|
-
timeoutId = void 0;
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
cleanups.push(stopPolling);
|
|
90
|
-
const tryApply = () => {
|
|
91
|
-
const applied = applyCover();
|
|
92
|
-
if (applied) {
|
|
93
|
-
reveal();
|
|
94
|
-
stopPolling();
|
|
95
|
-
}
|
|
96
|
-
return applied;
|
|
97
|
-
};
|
|
98
|
-
let frame1 = 0;
|
|
99
|
-
let frame2 = 0;
|
|
100
|
-
const applyCoverSettled = () => {
|
|
101
|
-
tryApply();
|
|
102
|
-
cancelAnimationFrame(frame1);
|
|
103
|
-
cancelAnimationFrame(frame2);
|
|
104
|
-
frame1 = requestAnimationFrame(() => {
|
|
105
|
-
tryApply();
|
|
106
|
-
frame2 = requestAnimationFrame(tryApply);
|
|
107
|
-
});
|
|
108
|
-
};
|
|
109
|
-
if (media instanceof HTMLVideoElement) for (const event of ["loadedmetadata", "resize"]) {
|
|
110
|
-
media.addEventListener(event, applyCoverSettled);
|
|
111
|
-
cleanups.push(() => media.removeEventListener(event, applyCoverSettled));
|
|
112
|
-
}
|
|
113
|
-
if (typeof ResizeObserver !== "undefined") {
|
|
114
|
-
const observer = new ResizeObserver(() => tryApply());
|
|
115
|
-
const container = media.parentElement;
|
|
116
|
-
if (container) observer.observe(container);
|
|
117
|
-
observer.observe(media);
|
|
118
|
-
cleanups.push(() => observer.disconnect());
|
|
119
|
-
}
|
|
120
|
-
window.addEventListener("resize", applyCoverSettled);
|
|
121
|
-
window.addEventListener("orientationchange", applyCoverSettled);
|
|
122
|
-
cleanups.push(() => {
|
|
123
|
-
window.removeEventListener("resize", applyCoverSettled);
|
|
124
|
-
window.removeEventListener("orientationchange", applyCoverSettled);
|
|
125
|
-
});
|
|
126
|
-
const startPolling = () => {
|
|
127
|
-
pollId = setInterval(tryApply, CONVERGENCE_INTERVAL_MS);
|
|
128
|
-
timeoutId = setTimeout(() => {
|
|
129
|
-
stopPolling();
|
|
130
|
-
reveal();
|
|
131
|
-
}, CONVERGENCE_TIMEOUT_MS);
|
|
132
|
-
};
|
|
133
|
-
if (!tryApply()) startPolling();
|
|
134
|
-
applyCoverSettled();
|
|
135
|
-
return () => {
|
|
136
|
-
cancelAnimationFrame(frame1);
|
|
137
|
-
cancelAnimationFrame(frame2);
|
|
138
|
-
for (const cleanup of cleanups) cleanup();
|
|
139
|
-
};
|
|
140
|
-
}, [
|
|
141
|
-
applyCover,
|
|
142
|
-
explicitCoverNeeded,
|
|
143
|
-
mediaRef,
|
|
144
|
-
reattachKey
|
|
145
|
-
]);
|
|
146
|
-
return applyCover;
|
|
147
|
-
}
|
|
148
|
-
//#endregion
|
|
149
|
-
export { useCoverMedia as t };
|
|
File without changes
|