@intellectif/lk-react 23.1.0 → 23.1.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/CHANGELOG.md +23 -0
- package/README.md +9 -5
- package/dist/ActivityErrorBoundary-B379hvtL.cjs +39 -0
- package/dist/ActivityErrorBoundary-B379hvtL.cjs.map +1 -0
- package/dist/ActivityErrorBoundary-Dw6SbWv3.js +34 -0
- package/dist/ActivityErrorBoundary-Dw6SbWv3.js.map +1 -0
- package/dist/ActivityMedia-CQQTRNl7.cjs +641 -0
- package/dist/ActivityMedia-CQQTRNl7.cjs.map +1 -0
- package/dist/ActivityMedia-vDiP-Psa.js +636 -0
- package/dist/ActivityMedia-vDiP-Psa.js.map +1 -0
- package/dist/ActivityPreview-1hhTkYuj.js +240 -0
- package/dist/ActivityPreview-1hhTkYuj.js.map +1 -0
- package/dist/ActivityPreview-BKr34exz.cjs +245 -0
- package/dist/ActivityPreview-BKr34exz.cjs.map +1 -0
- package/dist/ActivitySequence-CkX87pfB.js +839 -0
- package/dist/ActivitySequence-CkX87pfB.js.map +1 -0
- package/dist/ActivitySequence-CmoSyDnp.cjs +844 -0
- package/dist/ActivitySequence-CmoSyDnp.cjs.map +1 -0
- package/dist/Dictation-BlxRp-3k.js +926 -0
- package/dist/Dictation-BlxRp-3k.js.map +1 -0
- package/dist/Dictation-jECzL88E.cjs +931 -0
- package/dist/Dictation-jECzL88E.cjs.map +1 -0
- package/dist/FeedbackRegion-BNNMtTY-.cjs +108 -0
- package/dist/FeedbackRegion-BNNMtTY-.cjs.map +1 -0
- package/dist/FeedbackRegion-CyPSp8bA.js +85 -0
- package/dist/FeedbackRegion-CyPSp8bA.js.map +1 -0
- package/dist/FillInTheBlanks-B6xzqYXx.js +474 -0
- package/dist/FillInTheBlanks-B6xzqYXx.js.map +1 -0
- package/dist/FillInTheBlanks-BpKhdHg2.cjs +479 -0
- package/dist/FillInTheBlanks-BpKhdHg2.cjs.map +1 -0
- package/dist/GapSelect-DUSiaEQH.js +441 -0
- package/dist/GapSelect-DUSiaEQH.js.map +1 -0
- package/dist/GapSelect-payTq_Zn.cjs +446 -0
- package/dist/GapSelect-payTq_Zn.cjs.map +1 -0
- package/dist/InteractiveVideo-BguGv-HA.cjs +2955 -0
- package/dist/InteractiveVideo-BguGv-HA.cjs.map +1 -0
- package/dist/InteractiveVideo-Cg2jbU3j.js +2944 -0
- package/dist/InteractiveVideo-Cg2jbU3j.js.map +1 -0
- package/dist/LkAiProvider-DAPpA3PQ.d.cts +84 -0
- package/dist/LkAiProvider-DAPpA3PQ.d.cts.map +1 -0
- package/dist/LkAiProvider-QdEcIhoo.d.ts +84 -0
- package/dist/LkAiProvider-QdEcIhoo.d.ts.map +1 -0
- package/dist/LkIntlProvider-D_FdYXjQ.js +375 -0
- package/dist/LkIntlProvider-D_FdYXjQ.js.map +1 -0
- package/dist/LkIntlProvider-oi57lYB0.cjs +410 -0
- package/dist/LkIntlProvider-oi57lYB0.cjs.map +1 -0
- package/dist/MultipleChoice-COn5MtKY.cjs +433 -0
- package/dist/MultipleChoice-COn5MtKY.cjs.map +1 -0
- package/dist/MultipleChoice-Dra0_KYD.js +428 -0
- package/dist/MultipleChoice-Dra0_KYD.js.map +1 -0
- package/dist/PronunciationFeedback-DlMPGjkR.cjs +831 -0
- package/dist/PronunciationFeedback-DlMPGjkR.cjs.map +1 -0
- package/dist/PronunciationFeedback-Dxd6XPkO.js +772 -0
- package/dist/PronunciationFeedback-Dxd6XPkO.js.map +1 -0
- package/dist/ReadAloud-C8RhaUqV.js +1092 -0
- package/dist/{chunk-DC4CQCK5.js.map → ReadAloud-C8RhaUqV.js.map} +1 -1
- package/dist/ReadAloud-akDehitT.cjs +1103 -0
- package/dist/ReadAloud-akDehitT.cjs.map +1 -0
- package/dist/StimulusPanel-BgzByfkb.js +74 -0
- package/dist/StimulusPanel-BgzByfkb.js.map +1 -0
- package/dist/StimulusPanel-b66gaN3i.cjs +79 -0
- package/dist/StimulusPanel-b66gaN3i.cjs.map +1 -0
- package/dist/ThemeProvider-B6DyGqzh.d.cts +62 -0
- package/dist/ThemeProvider-B6DyGqzh.d.cts.map +1 -0
- package/dist/ThemeProvider-BCrxBaY-.d.ts +62 -0
- package/dist/ThemeProvider-BCrxBaY-.d.ts.map +1 -0
- package/dist/ThemeProvider-BRN1tj4n.cjs +187 -0
- package/dist/ThemeProvider-BRN1tj4n.cjs.map +1 -0
- package/dist/ThemeProvider-C7K9iMLX.js +158 -0
- package/dist/ThemeProvider-C7K9iMLX.js.map +1 -0
- package/dist/WrittenResponse-Bj3eFmGl.cjs +491 -0
- package/dist/WrittenResponse-Bj3eFmGl.cjs.map +1 -0
- package/dist/WrittenResponse-Cl8G6nO_.js +486 -0
- package/dist/WrittenResponse-Cl8G6nO_.js.map +1 -0
- package/dist/ai/LkAiProvider.cjs +34 -14
- package/dist/ai/LkAiProvider.cjs.map +1 -1
- package/dist/ai/LkAiProvider.d.cts +2 -83
- package/dist/ai/LkAiProvider.d.ts +2 -83
- package/dist/ai/LkAiProvider.js +33 -2
- package/dist/ai/LkAiProvider.js.map +1 -1
- package/dist/ai/useAiHelp.cjs +7 -25
- package/dist/ai/useAiHelp.d.cts +175 -177
- package/dist/ai/useAiHelp.d.cts.map +1 -0
- package/dist/ai/useAiHelp.d.ts +175 -177
- package/dist/ai/useAiHelp.d.ts.map +1 -0
- package/dist/ai/useAiHelp.js +3 -4
- package/dist/components/ActivityPreview.cjs +3 -29
- package/dist/components/ActivityPreview.d.cts +2 -81
- package/dist/components/ActivityPreview.d.ts +2 -81
- package/dist/components/ActivityPreview.js +2 -20
- package/dist/components/ActivitySequence.cjs +3 -30
- package/dist/components/ActivitySequence.d.cts +2 -432
- package/dist/components/ActivitySequence.d.ts +2 -432
- package/dist/components/ActivitySequence.js +2 -21
- package/dist/components/Dictation.cjs +4 -21
- package/dist/components/Dictation.d.cts +2 -19
- package/dist/components/Dictation.d.ts +2 -19
- package/dist/components/Dictation.js +3 -12
- package/dist/components/FillInTheBlanks.cjs +4 -20
- package/dist/components/FillInTheBlanks.d.cts +2 -30
- package/dist/components/FillInTheBlanks.d.ts +2 -30
- package/dist/components/FillInTheBlanks.js +3 -11
- package/dist/components/GapSelect.cjs +4 -20
- package/dist/components/GapSelect.d.cts +2 -27
- package/dist/components/GapSelect.d.ts +2 -27
- package/dist/components/GapSelect.js +3 -11
- package/dist/components/InteractiveVideo.cjs +5 -32
- package/dist/components/InteractiveVideo.d.cts +3 -291
- package/dist/components/InteractiveVideo.d.ts +3 -291
- package/dist/components/InteractiveVideo.js +3 -19
- package/dist/components/MultipleChoice.cjs +4 -20
- package/dist/components/MultipleChoice.d.cts +2 -26
- package/dist/components/MultipleChoice.d.ts +2 -26
- package/dist/components/MultipleChoice.js +3 -11
- package/dist/components/PronunciationFeedback.cjs +4 -17
- package/dist/components/PronunciationFeedback.d.cts +2 -90
- package/dist/components/PronunciationFeedback.d.ts +2 -90
- package/dist/components/PronunciationFeedback.js +3 -8
- package/dist/components/ReadAloud.cjs +4 -22
- package/dist/components/ReadAloud.d.cts +7 -11
- package/dist/components/ReadAloud.d.cts.map +1 -0
- package/dist/components/ReadAloud.d.ts +7 -11
- package/dist/components/ReadAloud.d.ts.map +1 -0
- package/dist/components/ReadAloud.js +3 -13
- package/dist/components/StimulusPanel.cjs +3 -14
- package/dist/components/StimulusPanel.d.cts +2 -51
- package/dist/components/StimulusPanel.d.ts +2 -51
- package/dist/components/StimulusPanel.js +2 -5
- package/dist/components/WrittenResponse.cjs +4 -19
- package/dist/components/WrittenResponse.d.cts +3 -18
- package/dist/components/WrittenResponse.d.ts +3 -18
- package/dist/components/WrittenResponse.js +3 -10
- package/dist/direction-Dq0_HtA5.js +183 -0
- package/dist/direction-Dq0_HtA5.js.map +1 -0
- package/dist/direction-K1pj0HCA.cjs +200 -0
- package/dist/direction-K1pj0HCA.cjs.map +1 -0
- package/dist/hooks/useActivityState.cjs +28 -10
- package/dist/hooks/useActivityState.cjs.map +1 -1
- package/dist/hooks/useActivityState.d.cts +25 -24
- package/dist/hooks/useActivityState.d.cts.map +1 -0
- package/dist/hooks/useActivityState.d.ts +25 -24
- package/dist/hooks/useActivityState.d.ts.map +1 -0
- package/dist/hooks/useActivityState.js +28 -2
- package/dist/hooks/useActivityState.js.map +1 -1
- package/dist/hooks/useSpeechRecorder.cjs +5 -16
- package/dist/hooks/useSpeechRecorder.d.cts +2 -127
- package/dist/hooks/useSpeechRecorder.d.ts +2 -127
- package/dist/hooks/useSpeechRecorder.js +3 -3
- package/dist/hooks/useXAPI.cjs +126 -10
- package/dist/hooks/useXAPI.cjs.map +1 -1
- package/dist/hooks/useXAPI.d.cts +14 -14
- package/dist/hooks/useXAPI.d.cts.map +1 -0
- package/dist/hooks/useXAPI.d.ts +14 -14
- package/dist/hooks/useXAPI.d.ts.map +1 -0
- package/dist/hooks/useXAPI.js +126 -2
- package/dist/hooks/useXAPI.js.map +1 -1
- package/dist/i18n/LkIntlProvider.cjs +9 -32
- package/dist/i18n/LkIntlProvider.d.cts +34 -38
- package/dist/i18n/LkIntlProvider.d.cts.map +1 -0
- package/dist/i18n/LkIntlProvider.d.ts +34 -38
- package/dist/i18n/LkIntlProvider.d.ts.map +1 -0
- package/dist/i18n/LkIntlProvider.js +3 -3
- package/dist/index-6P4rJHrJ.d.cts +432 -0
- package/dist/index-6P4rJHrJ.d.cts.map +1 -0
- package/dist/index-90CX504k.d.ts +90 -0
- package/dist/index-90CX504k.d.ts.map +1 -0
- package/dist/index-B_SgnjsC.d.cts +291 -0
- package/dist/index-B_SgnjsC.d.cts.map +1 -0
- package/dist/index-BavVW5z5.d.cts +25 -0
- package/dist/index-BavVW5z5.d.cts.map +1 -0
- package/dist/index-BhHv6Fiu.d.cts +28 -0
- package/dist/index-BhHv6Fiu.d.cts.map +1 -0
- package/dist/index-Bsu8VciA.d.ts +432 -0
- package/dist/index-Bsu8VciA.d.ts.map +1 -0
- package/dist/index-C1KGpD1k.d.ts +49 -0
- package/dist/index-C1KGpD1k.d.ts.map +1 -0
- package/dist/index-CKTpYTCC.d.cts +49 -0
- package/dist/index-CKTpYTCC.d.cts.map +1 -0
- package/dist/index-CO_SRFJj.d.ts +16 -0
- package/dist/index-CO_SRFJj.d.ts.map +1 -0
- package/dist/index-CSsuUsP7.d.cts +124 -0
- package/dist/index-CSsuUsP7.d.cts.map +1 -0
- package/dist/index-CunUyeuN.d.cts +78 -0
- package/dist/index-CunUyeuN.d.cts.map +1 -0
- package/dist/index-CzfRzks6.d.cts +90 -0
- package/dist/index-CzfRzks6.d.cts.map +1 -0
- package/dist/index-D14xtpBS.d.cts +24 -0
- package/dist/index-D14xtpBS.d.cts.map +1 -0
- package/dist/index-DHRPAPZf.d.ts +291 -0
- package/dist/index-DHRPAPZf.d.ts.map +1 -0
- package/dist/index-DLV6cK26.d.cts +16 -0
- package/dist/index-DLV6cK26.d.cts.map +1 -0
- package/dist/index-DbCCQ9cP.d.ts +124 -0
- package/dist/index-DbCCQ9cP.d.ts.map +1 -0
- package/dist/index-DeV5B2m5.d.ts +24 -0
- package/dist/index-DeV5B2m5.d.ts.map +1 -0
- package/dist/index-TZCJVSge.d.ts +28 -0
- package/dist/index-TZCJVSge.d.ts.map +1 -0
- package/dist/index-ZVvLHsd3.d.ts +25 -0
- package/dist/index-ZVvLHsd3.d.ts.map +1 -0
- package/dist/index-eQwBgpSw.d.ts +78 -0
- package/dist/index-eQwBgpSw.d.ts.map +1 -0
- package/dist/index.cjs +118 -163
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -24
- package/dist/index.d.ts +20 -24
- package/dist/index.js +84 -29
- package/dist/index.js.map +1 -1
- package/dist/theme/ThemeProvider.cjs +8 -28
- package/dist/theme/ThemeProvider.d.cts +2 -59
- package/dist/theme/ThemeProvider.d.ts +2 -59
- package/dist/theme/ThemeProvider.js +3 -3
- package/dist/tries-CbbtZkdG.cjs +363 -0
- package/dist/tries-CbbtZkdG.cjs.map +1 -0
- package/dist/tries-DTHSrLCm.js +310 -0
- package/dist/tries-DTHSrLCm.js.map +1 -0
- package/dist/types-BOQd93x3.d.cts +994 -0
- package/dist/types-BOQd93x3.d.cts.map +1 -0
- package/dist/types-HIrgF_mS.d.ts +994 -0
- package/dist/types-HIrgF_mS.d.ts.map +1 -0
- package/dist/useAiHelp-B-ccDL5Q.js +906 -0
- package/dist/useAiHelp-B-ccDL5Q.js.map +1 -0
- package/dist/useAiHelp-h9yOLFqt.cjs +995 -0
- package/dist/useAiHelp-h9yOLFqt.cjs.map +1 -0
- package/dist/useSpeechRecorder--O_f-xvt.cjs +720 -0
- package/dist/useSpeechRecorder--O_f-xvt.cjs.map +1 -0
- package/dist/useSpeechRecorder-DtAYvl02.d.cts +154 -0
- package/dist/useSpeechRecorder-DtAYvl02.d.cts.map +1 -0
- package/dist/useSpeechRecorder-DtAYvl02.d.ts +154 -0
- package/dist/useSpeechRecorder-DtAYvl02.d.ts.map +1 -0
- package/dist/useSpeechRecorder-zIi9Dlw8.js +709 -0
- package/dist/useSpeechRecorder-zIi9Dlw8.js.map +1 -0
- package/package.json +10 -11
- package/dist/WrittenResponse-B7A5gHMj.d.ts +0 -115
- package/dist/WrittenResponse-BpL9p2Hn.d.cts +0 -115
- package/dist/ai/useAiHelp.cjs.map +0 -1
- package/dist/ai/useAiHelp.js.map +0 -1
- package/dist/chunk-2PNSVBLQ.cjs +0 -54
- package/dist/chunk-2PNSVBLQ.cjs.map +0 -1
- package/dist/chunk-2TW6WLBC.js +0 -80
- package/dist/chunk-2TW6WLBC.js.map +0 -1
- package/dist/chunk-4ZZWZSWI.js +0 -61
- package/dist/chunk-4ZZWZSWI.js.map +0 -1
- package/dist/chunk-6N43WDVG.js +0 -29
- package/dist/chunk-6N43WDVG.js.map +0 -1
- package/dist/chunk-7ALBSPYR.cjs +0 -436
- package/dist/chunk-7ALBSPYR.cjs.map +0 -1
- package/dist/chunk-7NFY3M3W.js +0 -234
- package/dist/chunk-7NFY3M3W.js.map +0 -1
- package/dist/chunk-7SB2MJA4.js +0 -29
- package/dist/chunk-7SB2MJA4.js.map +0 -1
- package/dist/chunk-ABJJ3LII.js +0 -434
- package/dist/chunk-ABJJ3LII.js.map +0 -1
- package/dist/chunk-BIGGXHAW.cjs +0 -342
- package/dist/chunk-BIGGXHAW.cjs.map +0 -1
- package/dist/chunk-C7QZE5BI.js +0 -430
- package/dist/chunk-C7QZE5BI.js.map +0 -1
- package/dist/chunk-CWTUWNV3.cjs +0 -2937
- package/dist/chunk-CWTUWNV3.cjs.map +0 -1
- package/dist/chunk-DC4CQCK5.js +0 -915
- package/dist/chunk-DS6HN3YR.cjs +0 -496
- package/dist/chunk-DS6HN3YR.cjs.map +0 -1
- package/dist/chunk-FDQR4GAZ.js +0 -240
- package/dist/chunk-FDQR4GAZ.js.map +0 -1
- package/dist/chunk-FKGMSOJF.js +0 -394
- package/dist/chunk-FKGMSOJF.js.map +0 -1
- package/dist/chunk-G6PXJ2SA.js +0 -823
- package/dist/chunk-G6PXJ2SA.js.map +0 -1
- package/dist/chunk-HNLRVRQR.js +0 -335
- package/dist/chunk-HNLRVRQR.js.map +0 -1
- package/dist/chunk-J3C72RPK.cjs +0 -31
- package/dist/chunk-J3C72RPK.cjs.map +0 -1
- package/dist/chunk-K63VPFOV.cjs +0 -134
- package/dist/chunk-K63VPFOV.cjs.map +0 -1
- package/dist/chunk-KFLIDTDU.cjs +0 -825
- package/dist/chunk-KFLIDTDU.cjs.map +0 -1
- package/dist/chunk-KHKH5LCT.cjs +0 -250
- package/dist/chunk-KHKH5LCT.cjs.map +0 -1
- package/dist/chunk-LBEKRN6Y.cjs +0 -664
- package/dist/chunk-LBEKRN6Y.cjs.map +0 -1
- package/dist/chunk-LPUWXIPR.cjs +0 -578
- package/dist/chunk-LPUWXIPR.cjs.map +0 -1
- package/dist/chunk-MCO52PV5.js +0 -520
- package/dist/chunk-MCO52PV5.js.map +0 -1
- package/dist/chunk-MKXEM2C5.cjs +0 -396
- package/dist/chunk-MKXEM2C5.cjs.map +0 -1
- package/dist/chunk-MXNC5UNO.js +0 -563
- package/dist/chunk-MXNC5UNO.js.map +0 -1
- package/dist/chunk-NAK55BYU.cjs +0 -859
- package/dist/chunk-NAK55BYU.cjs.map +0 -1
- package/dist/chunk-NDBMKGQ5.cjs +0 -599
- package/dist/chunk-NDBMKGQ5.cjs.map +0 -1
- package/dist/chunk-OD65OZIW.cjs +0 -159
- package/dist/chunk-OD65OZIW.cjs.map +0 -1
- package/dist/chunk-ORT3KLGI.js +0 -50
- package/dist/chunk-ORT3KLGI.js.map +0 -1
- package/dist/chunk-PNNUPUH4.cjs +0 -82
- package/dist/chunk-PNNUPUH4.cjs.map +0 -1
- package/dist/chunk-PWHECW6N.js +0 -2934
- package/dist/chunk-PWHECW6N.js.map +0 -1
- package/dist/chunk-RBS5A2DF.js +0 -857
- package/dist/chunk-RBS5A2DF.js.map +0 -1
- package/dist/chunk-RPWUDXG5.cjs +0 -63
- package/dist/chunk-RPWUDXG5.cjs.map +0 -1
- package/dist/chunk-TCDJY3H6.js +0 -494
- package/dist/chunk-TCDJY3H6.js.map +0 -1
- package/dist/chunk-TP5UMRAU.cjs +0 -918
- package/dist/chunk-TP5UMRAU.cjs.map +0 -1
- package/dist/chunk-TS7J6DTY.js +0 -597
- package/dist/chunk-TS7J6DTY.js.map +0 -1
- package/dist/chunk-TUVENMXB.cjs +0 -20
- package/dist/chunk-TUVENMXB.cjs.map +0 -1
- package/dist/chunk-UDCQTOVU.cjs +0 -523
- package/dist/chunk-UDCQTOVU.cjs.map +0 -1
- package/dist/chunk-UHKZXOXD.js +0 -128
- package/dist/chunk-UHKZXOXD.js.map +0 -1
- package/dist/chunk-V6BA44DS.cjs +0 -236
- package/dist/chunk-V6BA44DS.cjs.map +0 -1
- package/dist/chunk-XO5R73Y4.js +0 -653
- package/dist/chunk-XO5R73Y4.js.map +0 -1
- package/dist/chunk-XOR4MPEN.cjs +0 -31
- package/dist/chunk-XOR4MPEN.cjs.map +0 -1
- package/dist/chunk-YORQQXGO.js +0 -155
- package/dist/chunk-YORQQXGO.js.map +0 -1
- package/dist/chunk-YY4PFR3Z.cjs +0 -432
- package/dist/chunk-YY4PFR3Z.cjs.map +0 -1
- package/dist/chunk-ZPI6Q42R.js +0 -17
- package/dist/chunk-ZPI6Q42R.js.map +0 -1
- package/dist/components/ActivityPreview.cjs.map +0 -1
- package/dist/components/ActivityPreview.js.map +0 -1
- package/dist/components/ActivitySequence.cjs.map +0 -1
- package/dist/components/ActivitySequence.js.map +0 -1
- package/dist/components/Dictation.cjs.map +0 -1
- package/dist/components/Dictation.js.map +0 -1
- package/dist/components/FillInTheBlanks.cjs.map +0 -1
- package/dist/components/FillInTheBlanks.js.map +0 -1
- package/dist/components/GapSelect.cjs.map +0 -1
- package/dist/components/GapSelect.js.map +0 -1
- package/dist/components/InteractiveVideo.cjs.map +0 -1
- package/dist/components/InteractiveVideo.js.map +0 -1
- package/dist/components/MultipleChoice.cjs.map +0 -1
- package/dist/components/MultipleChoice.js.map +0 -1
- package/dist/components/PronunciationFeedback.cjs.map +0 -1
- package/dist/components/PronunciationFeedback.js.map +0 -1
- package/dist/components/ReadAloud.cjs.map +0 -1
- package/dist/components/ReadAloud.js.map +0 -1
- package/dist/components/StimulusPanel.cjs.map +0 -1
- package/dist/components/StimulusPanel.js.map +0 -1
- package/dist/components/WrittenResponse.cjs.map +0 -1
- package/dist/components/WrittenResponse.js.map +0 -1
- package/dist/hooks/useSpeechRecorder.cjs.map +0 -1
- package/dist/hooks/useSpeechRecorder.js.map +0 -1
- package/dist/i18n/LkIntlProvider.cjs.map +0 -1
- package/dist/i18n/LkIntlProvider.js.map +0 -1
- package/dist/machine-CuwKqWXC.d.cts +0 -26
- package/dist/machine-CuwKqWXC.d.ts +0 -26
- package/dist/theme/ThemeProvider.cjs.map +0 -1
- package/dist/theme/ThemeProvider.js.map +0 -1
- package/dist/types-C4IsUQsK.d.ts +0 -989
- package/dist/types-CJgZWtl4.d.cts +0 -989
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
//#region src/i18n/direction.ts
|
|
3
|
+
/**
|
|
4
|
+
* The writing direction of authored content. A language tag is read from the
|
|
5
|
+
* tag alone, so a server rendering and the browser that hydrates it agree on
|
|
6
|
+
* it. Text is read by the runtime's Unicode tables, which agree on every
|
|
7
|
+
* character both runtimes' Unicode versions know.
|
|
8
|
+
*/
|
|
9
|
+
/** ISO 15924 codes of the scripts written right to left. */
|
|
10
|
+
const RTL_SCRIPT_CODES = /* @__PURE__ */ new Set([
|
|
11
|
+
"phlv",
|
|
12
|
+
"adlm",
|
|
13
|
+
"arab",
|
|
14
|
+
"aran",
|
|
15
|
+
"armi",
|
|
16
|
+
"avst",
|
|
17
|
+
"chrs",
|
|
18
|
+
"cprt",
|
|
19
|
+
"elym",
|
|
20
|
+
"gara",
|
|
21
|
+
"hatr",
|
|
22
|
+
"hebr",
|
|
23
|
+
"hung",
|
|
24
|
+
"khar",
|
|
25
|
+
"lydi",
|
|
26
|
+
"mand",
|
|
27
|
+
"mani",
|
|
28
|
+
"mend",
|
|
29
|
+
"merc",
|
|
30
|
+
"mero",
|
|
31
|
+
"narb",
|
|
32
|
+
"nbat",
|
|
33
|
+
"nkoo",
|
|
34
|
+
"orkh",
|
|
35
|
+
"ougr",
|
|
36
|
+
"palm",
|
|
37
|
+
"phli",
|
|
38
|
+
"phlp",
|
|
39
|
+
"phnx",
|
|
40
|
+
"prti",
|
|
41
|
+
"rohg",
|
|
42
|
+
"samr",
|
|
43
|
+
"sarb",
|
|
44
|
+
"sidt",
|
|
45
|
+
"sogd",
|
|
46
|
+
"sogo",
|
|
47
|
+
"syrc",
|
|
48
|
+
"syre",
|
|
49
|
+
"syrj",
|
|
50
|
+
"syrn",
|
|
51
|
+
"thaa",
|
|
52
|
+
"yezi"
|
|
53
|
+
]);
|
|
54
|
+
/**
|
|
55
|
+
* Languages written right to left in every script they are commonly written
|
|
56
|
+
* in, including the deprecated tags `iw` and `ji` and the Arabic varieties
|
|
57
|
+
* with tags of their own. A language also written left to right — Kurdish,
|
|
58
|
+
* Sindhi, Uyghur — is not listed: its own text decides.
|
|
59
|
+
*/
|
|
60
|
+
const RTL_LANGUAGES = /* @__PURE__ */ new Set([
|
|
61
|
+
"acm",
|
|
62
|
+
"aeb",
|
|
63
|
+
"aii",
|
|
64
|
+
"ajp",
|
|
65
|
+
"apc",
|
|
66
|
+
"ar",
|
|
67
|
+
"arc",
|
|
68
|
+
"ars",
|
|
69
|
+
"ary",
|
|
70
|
+
"arz",
|
|
71
|
+
"azb",
|
|
72
|
+
"bqi",
|
|
73
|
+
"ckb",
|
|
74
|
+
"dv",
|
|
75
|
+
"fa",
|
|
76
|
+
"glk",
|
|
77
|
+
"hbo",
|
|
78
|
+
"he",
|
|
79
|
+
"iw",
|
|
80
|
+
"ji",
|
|
81
|
+
"jrb",
|
|
82
|
+
"khw",
|
|
83
|
+
"lrc",
|
|
84
|
+
"mzn",
|
|
85
|
+
"nqo",
|
|
86
|
+
"ota",
|
|
87
|
+
"pnb",
|
|
88
|
+
"prs",
|
|
89
|
+
"ps",
|
|
90
|
+
"sdh",
|
|
91
|
+
"skr",
|
|
92
|
+
"syc",
|
|
93
|
+
"syr",
|
|
94
|
+
"ur",
|
|
95
|
+
"yi"
|
|
96
|
+
]);
|
|
97
|
+
/**
|
|
98
|
+
* The code-point blocks Unicode reserves for right-to-left scripts (their
|
|
99
|
+
* default bidirectional class is R or AL): Hebrew through Arabic Extended-A,
|
|
100
|
+
* the Hebrew and Arabic presentation forms, the historic right-to-left scripts
|
|
101
|
+
* of the Supplementary Multilingual Plane, and Mende Kikakui through the Arabic
|
|
102
|
+
* mathematical letters. A letter in one of them is written right to left.
|
|
103
|
+
*/
|
|
104
|
+
const RTL_BLOCKS = [
|
|
105
|
+
[1424, 2303],
|
|
106
|
+
[64285, 65023],
|
|
107
|
+
[65136, 65279],
|
|
108
|
+
[67584, 69631],
|
|
109
|
+
[124928, 126975]
|
|
110
|
+
];
|
|
111
|
+
/** Digits whose bidirectional class is R: N'Ko, Mende Kikakui and Adlam. */
|
|
112
|
+
const RTL_DIGITS = [
|
|
113
|
+
[1984, 1993],
|
|
114
|
+
[125127, 125135],
|
|
115
|
+
[125264, 125273]
|
|
116
|
+
];
|
|
117
|
+
const LETTER_RE = /^\p{L}$/u;
|
|
118
|
+
const NUMBER_RE = /^\p{N}$/u;
|
|
119
|
+
function within(point, ranges) {
|
|
120
|
+
return ranges.some(([first, last]) => point >= first && point <= last);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* The script subtag of a BCP 47 tag's lowercased subtags, if it names a
|
|
124
|
+
* direction: not in a private-use or grandfathered tag (`x-arab`, `i-klingon`),
|
|
125
|
+
* and not one of the codes for no particular script — Common, Inherited,
|
|
126
|
+
* Unwritten, Unknown and the like (`Z` codes) or private use (`Qaaa`–`Qabx`).
|
|
127
|
+
*/
|
|
128
|
+
function scriptSubtagOf(subtags) {
|
|
129
|
+
if (subtags[0].length === 1) return;
|
|
130
|
+
let index = 1;
|
|
131
|
+
while (index < subtags.length && index <= 3 && /^[a-z]{3}$/.test(subtags[index])) index += 1;
|
|
132
|
+
const candidate = subtags[index];
|
|
133
|
+
if (candidate === void 0 || !/^[a-z]{4}$/.test(candidate)) return;
|
|
134
|
+
return /^z/.test(candidate) || candidate >= "qaaa" && candidate <= "qabx" ? void 0 : candidate;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* The direction a language tag names, or `undefined` when it names none: its
|
|
138
|
+
* script subtag when it has one (`ku-Arab` is right-to-left, `ar-Latn` is not),
|
|
139
|
+
* then the languages above. `-` and `_` both separate subtags. Anything that is
|
|
140
|
+
* not a string names none.
|
|
141
|
+
*/
|
|
142
|
+
function localeDirectionOf(locale) {
|
|
143
|
+
if (typeof locale !== "string") return;
|
|
144
|
+
const subtags = locale.toLowerCase().split(/[-_]/);
|
|
145
|
+
const script = scriptSubtagOf(subtags);
|
|
146
|
+
if (script !== void 0) return RTL_SCRIPT_CODES.has(script) ? "rtl" : "ltr";
|
|
147
|
+
return RTL_LANGUAGES.has(subtags[0]) ? "rtl" : void 0;
|
|
148
|
+
}
|
|
149
|
+
const LEFT_TO_RIGHT_MARK = String.fromCodePoint(8206);
|
|
150
|
+
/** RIGHT-TO-LEFT MARK and ARABIC LETTER MARK. */
|
|
151
|
+
const RIGHT_TO_LEFT_MARKS = /* @__PURE__ */ new Set([String.fromCodePoint(8207), String.fromCodePoint(1564)]);
|
|
152
|
+
/**
|
|
153
|
+
* The direction of `text`'s first letter or directional mark — an author can
|
|
154
|
+
* start a transcript with a right-to-left mark to lay it out right to left — or
|
|
155
|
+
* `undefined` when it has neither. Other characters with a strong direction,
|
|
156
|
+
* such as a Hebrew punctuation mark or an N'Ko digit, are not read, so this is
|
|
157
|
+
* the first strong character the Unicode bidirectional algorithm finds only
|
|
158
|
+
* where the text starts with a letter or a mark. Letters are read by the
|
|
159
|
+
* runtime's Unicode tables: a letter added in a later Unicode version than a
|
|
160
|
+
* server's is not one to that server.
|
|
161
|
+
*/
|
|
162
|
+
function textDirectionOf(text) {
|
|
163
|
+
for (const character of text) {
|
|
164
|
+
if (character === LEFT_TO_RIGHT_MARK) return "ltr";
|
|
165
|
+
if (RIGHT_TO_LEFT_MARKS.has(character)) return "rtl";
|
|
166
|
+
if (LETTER_RE.test(character)) return within(character.codePointAt(0), RTL_BLOCKS) ? "rtl" : "ltr";
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* The direction a single character is laid out in, for a mark standing in for
|
|
171
|
+
* it: a digit runs left to right unless it is one of the right-to-left digits,
|
|
172
|
+
* a letter runs in its script's direction, and anything else has none of its
|
|
173
|
+
* own.
|
|
174
|
+
*/
|
|
175
|
+
function characterDirectionOf(character) {
|
|
176
|
+
const point = character.codePointAt(0);
|
|
177
|
+
if (NUMBER_RE.test(character)) return within(point, RTL_DIGITS) ? "rtl" : "ltr";
|
|
178
|
+
if (LETTER_RE.test(character)) return within(point, RTL_BLOCKS) ? "rtl" : "ltr";
|
|
179
|
+
}
|
|
180
|
+
//#endregion
|
|
181
|
+
Object.defineProperty(exports, "characterDirectionOf", {
|
|
182
|
+
enumerable: true,
|
|
183
|
+
get: function() {
|
|
184
|
+
return characterDirectionOf;
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
Object.defineProperty(exports, "localeDirectionOf", {
|
|
188
|
+
enumerable: true,
|
|
189
|
+
get: function() {
|
|
190
|
+
return localeDirectionOf;
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
Object.defineProperty(exports, "textDirectionOf", {
|
|
194
|
+
enumerable: true,
|
|
195
|
+
get: function() {
|
|
196
|
+
return textDirectionOf;
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
//# sourceMappingURL=direction-K1pj0HCA.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"direction-K1pj0HCA.cjs","names":[],"sources":["../src/i18n/direction.ts"],"sourcesContent":["/**\n * The writing direction of authored content. A language tag is read from the\n * tag alone, so a server rendering and the browser that hydrates it agree on\n * it. Text is read by the runtime's Unicode tables, which agree on every\n * character both runtimes' Unicode versions know.\n */\n\n/** ISO 15924 codes of the scripts written right to left. */\nconst RTL_SCRIPT_CODES = new Set([\n 'phlv',\n 'adlm',\n 'arab',\n 'aran',\n 'armi',\n 'avst',\n 'chrs',\n 'cprt',\n 'elym',\n 'gara',\n 'hatr',\n 'hebr',\n 'hung',\n 'khar',\n 'lydi',\n 'mand',\n 'mani',\n 'mend',\n 'merc',\n 'mero',\n 'narb',\n 'nbat',\n 'nkoo',\n 'orkh',\n 'ougr',\n 'palm',\n 'phli',\n 'phlp',\n 'phnx',\n 'prti',\n 'rohg',\n 'samr',\n 'sarb',\n 'sidt',\n 'sogd',\n 'sogo',\n 'syrc',\n 'syre',\n 'syrj',\n 'syrn',\n 'thaa',\n 'yezi',\n]);\n\n/**\n * Languages written right to left in every script they are commonly written\n * in, including the deprecated tags `iw` and `ji` and the Arabic varieties\n * with tags of their own. A language also written left to right — Kurdish,\n * Sindhi, Uyghur — is not listed: its own text decides.\n */\nconst RTL_LANGUAGES = new Set([\n 'acm',\n 'aeb',\n 'aii',\n 'ajp',\n 'apc',\n 'ar',\n 'arc',\n 'ars',\n 'ary',\n 'arz',\n 'azb',\n 'bqi',\n 'ckb',\n 'dv',\n 'fa',\n 'glk',\n 'hbo',\n 'he',\n 'iw',\n 'ji',\n 'jrb',\n 'khw',\n 'lrc',\n 'mzn',\n 'nqo',\n 'ota',\n 'pnb',\n 'prs',\n 'ps',\n 'sdh',\n 'skr',\n 'syc',\n 'syr',\n 'ur',\n 'yi',\n]);\n\n/**\n * The code-point blocks Unicode reserves for right-to-left scripts (their\n * default bidirectional class is R or AL): Hebrew through Arabic Extended-A,\n * the Hebrew and Arabic presentation forms, the historic right-to-left scripts\n * of the Supplementary Multilingual Plane, and Mende Kikakui through the Arabic\n * mathematical letters. A letter in one of them is written right to left.\n */\nconst RTL_BLOCKS: readonly (readonly [number, number])[] = [\n [0x0590, 0x08ff],\n [0xfb1d, 0xfdff],\n [0xfe70, 0xfeff],\n [0x10800, 0x10fff],\n [0x1e800, 0x1efff],\n];\n\n/** Digits whose bidirectional class is R: N'Ko, Mende Kikakui and Adlam. */\nconst RTL_DIGITS: readonly (readonly [number, number])[] = [\n [0x07c0, 0x07c9],\n [0x1e8c7, 0x1e8cf],\n [0x1e950, 0x1e959],\n];\n\nconst LETTER_RE = /^\\p{L}$/u;\nconst NUMBER_RE = /^\\p{N}$/u;\n\nfunction within(point: number, ranges: readonly (readonly [number, number])[]): boolean {\n return ranges.some(([first, last]) => point >= first && point <= last);\n}\n\n/**\n * The script subtag of a BCP 47 tag's lowercased subtags, if it names a\n * direction: not in a private-use or grandfathered tag (`x-arab`, `i-klingon`),\n * and not one of the codes for no particular script — Common, Inherited,\n * Unwritten, Unknown and the like (`Z` codes) or private use (`Qaaa`–`Qabx`).\n */\nfunction scriptSubtagOf(subtags: readonly string[]): string | undefined {\n if ((subtags[0] as string).length === 1) {\n return undefined;\n }\n let index = 1;\n // Up to three extended language subtags may come between language and script.\n while (index < subtags.length && index <= 3 && /^[a-z]{3}$/.test(subtags[index] as string)) {\n index += 1;\n }\n const candidate = subtags[index];\n if (candidate === undefined || !/^[a-z]{4}$/.test(candidate)) {\n return undefined;\n }\n return /^z/.test(candidate) || (candidate >= 'qaaa' && candidate <= 'qabx')\n ? undefined\n : candidate;\n}\n\n/**\n * The direction a language tag names, or `undefined` when it names none: its\n * script subtag when it has one (`ku-Arab` is right-to-left, `ar-Latn` is not),\n * then the languages above. `-` and `_` both separate subtags. Anything that is\n * not a string names none.\n */\nexport function localeDirectionOf(locale: unknown): 'ltr' | 'rtl' | undefined {\n if (typeof locale !== 'string') {\n return undefined;\n }\n const subtags = locale.toLowerCase().split(/[-_]/);\n const script = scriptSubtagOf(subtags);\n if (script !== undefined) {\n return RTL_SCRIPT_CODES.has(script) ? 'rtl' : 'ltr';\n }\n return RTL_LANGUAGES.has(subtags[0] as string) ? 'rtl' : undefined;\n}\n\nconst LEFT_TO_RIGHT_MARK = String.fromCodePoint(0x200e);\n/** RIGHT-TO-LEFT MARK and ARABIC LETTER MARK. */\nconst RIGHT_TO_LEFT_MARKS = new Set([String.fromCodePoint(0x200f), String.fromCodePoint(0x61c)]);\n\n/**\n * The direction of `text`'s first letter or directional mark — an author can\n * start a transcript with a right-to-left mark to lay it out right to left — or\n * `undefined` when it has neither. Other characters with a strong direction,\n * such as a Hebrew punctuation mark or an N'Ko digit, are not read, so this is\n * the first strong character the Unicode bidirectional algorithm finds only\n * where the text starts with a letter or a mark. Letters are read by the\n * runtime's Unicode tables: a letter added in a later Unicode version than a\n * server's is not one to that server.\n */\nexport function textDirectionOf(text: string): 'ltr' | 'rtl' | undefined {\n for (const character of text) {\n if (character === LEFT_TO_RIGHT_MARK) {\n return 'ltr';\n }\n if (RIGHT_TO_LEFT_MARKS.has(character)) {\n return 'rtl';\n }\n if (LETTER_RE.test(character)) {\n return within(character.codePointAt(0) as number, RTL_BLOCKS) ? 'rtl' : 'ltr';\n }\n }\n return undefined;\n}\n\n/**\n * The direction a single character is laid out in, for a mark standing in for\n * it: a digit runs left to right unless it is one of the right-to-left digits,\n * a letter runs in its script's direction, and anything else has none of its\n * own.\n */\nexport function characterDirectionOf(character: string): 'ltr' | 'rtl' | undefined {\n const point = character.codePointAt(0) as number;\n if (NUMBER_RE.test(character)) {\n return within(point, RTL_DIGITS) ? 'rtl' : 'ltr';\n }\n if (LETTER_RE.test(character)) {\n return within(point, RTL_BLOCKS) ? 'rtl' : 'ltr';\n }\n return undefined;\n}\n"],"mappings":";;;;;;;;AAQA,MAAM,mCAAmB,IAAI,IAAI;CAC/B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;;;;;;AAQD,MAAM,gCAAgB,IAAI,IAAI;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;;;;;;;AASD,MAAM,aAAqD;CACzD,CAAC,MAAQ,IAAM;CACf,CAAC,OAAQ,KAAM;CACf,CAAC,OAAQ,KAAM;CACf,CAAC,OAAS,KAAO;CACjB,CAAC,QAAS,MAAO;AACnB;;AAGA,MAAM,aAAqD;CACzD,CAAC,MAAQ,IAAM;CACf,CAAC,QAAS,MAAO;CACjB,CAAC,QAAS,MAAO;AACnB;AAEA,MAAM,YAAY;AAClB,MAAM,YAAY;AAElB,SAAS,OAAO,OAAe,QAAyD;CACtF,OAAO,OAAO,MAAM,CAAC,OAAO,UAAU,SAAS,SAAS,SAAS,IAAI;AACvE;;;;;;;AAQA,SAAS,eAAe,SAAgD;CACtE,IAAK,QAAQ,EAAE,CAAY,WAAW,GACpC;CAEF,IAAI,QAAQ;CAEZ,OAAO,QAAQ,QAAQ,UAAU,SAAS,KAAK,aAAa,KAAK,QAAQ,MAAgB,GACvF,SAAS;CAEX,MAAM,YAAY,QAAQ;CAC1B,IAAI,cAAc,KAAA,KAAa,CAAC,aAAa,KAAK,SAAS,GACzD;CAEF,OAAO,KAAK,KAAK,SAAS,KAAM,aAAa,UAAU,aAAa,SAChE,KAAA,IACA;AACN;;;;;;;AAQA,SAAgB,kBAAkB,QAA4C;CAC5E,IAAI,OAAO,WAAW,UACpB;CAEF,MAAM,UAAU,OAAO,YAAY,CAAC,CAAC,MAAM,MAAM;CACjD,MAAM,SAAS,eAAe,OAAO;CACrC,IAAI,WAAW,KAAA,GACb,OAAO,iBAAiB,IAAI,MAAM,IAAI,QAAQ;CAEhD,OAAO,cAAc,IAAI,QAAQ,EAAY,IAAI,QAAQ,KAAA;AAC3D;AAEA,MAAM,qBAAqB,OAAO,cAAc,IAAM;;AAEtD,MAAM,sCAAsB,IAAI,IAAI,CAAC,OAAO,cAAc,IAAM,GAAG,OAAO,cAAc,IAAK,CAAC,CAAC;;;;;;;;;;;AAY/F,SAAgB,gBAAgB,MAAyC;CACvE,KAAK,MAAM,aAAa,MAAM;EAC5B,IAAI,cAAc,oBAChB,OAAO;EAET,IAAI,oBAAoB,IAAI,SAAS,GACnC,OAAO;EAET,IAAI,UAAU,KAAK,SAAS,GAC1B,OAAO,OAAO,UAAU,YAAY,CAAC,GAAa,UAAU,IAAI,QAAQ;CAE5E;AAEF;;;;;;;AAQA,SAAgB,qBAAqB,WAA8C;CACjF,MAAM,QAAQ,UAAU,YAAY,CAAC;CACrC,IAAI,UAAU,KAAK,SAAS,GAC1B,OAAO,OAAO,OAAO,UAAU,IAAI,QAAQ;CAE7C,IAAI,UAAU,KAAK,SAAS,GAC1B,OAAO,OAAO,OAAO,UAAU,IAAI,QAAQ;AAG/C"}
|
|
@@ -1,13 +1,31 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
+
let react = require("react");
|
|
5
|
+
//#region src/hooks/useActivityState.ts
|
|
6
|
+
/**
|
|
7
|
+
* Tracks an activity's lifecycle state and elapsed time. Timing is held in a
|
|
8
|
+
* ref (no re-render) and `getTimeSpent()` is read imperatively at submission.
|
|
9
|
+
*/
|
|
10
|
+
function useActivityState(initialState = "idle") {
|
|
11
|
+
const [state, setState] = (0, react.useState)(initialState);
|
|
12
|
+
const startTimeRef = (0, react.useRef)(null);
|
|
13
|
+
return {
|
|
14
|
+
state,
|
|
15
|
+
start: (0, react.useCallback)(() => {
|
|
16
|
+
if (startTimeRef.current === null) startTimeRef.current = Date.now();
|
|
17
|
+
setState((prev) => prev === "idle" ? "in-progress" : prev);
|
|
18
|
+
}, []),
|
|
19
|
+
complete: (0, react.useCallback)(() => setState("completed"), []),
|
|
20
|
+
review: (0, react.useCallback)(() => setState("reviewing"), []),
|
|
21
|
+
reset: (0, react.useCallback)((to = "idle") => {
|
|
22
|
+
startTimeRef.current = null;
|
|
23
|
+
setState(to);
|
|
24
|
+
}, []),
|
|
25
|
+
getTimeSpent: (0, react.useCallback)(() => startTimeRef.current === null ? 0 : Date.now() - startTimeRef.current, [])
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
exports.useActivityState = useActivityState;
|
|
3
30
|
|
|
4
|
-
var chunkXOR4MPEN_cjs = require('../chunk-XOR4MPEN.cjs');
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Object.defineProperty(exports, "useActivityState", {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: function () { return chunkXOR4MPEN_cjs.useActivityState; }
|
|
11
|
-
});
|
|
12
|
-
//# sourceMappingURL=useActivityState.cjs.map
|
|
13
31
|
//# sourceMappingURL=useActivityState.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"useActivityState.cjs","names":["useState","useRef","useCallback"],"sources":["../../src/hooks/useActivityState.ts"],"sourcesContent":["'use client';\n\nimport { useCallback, useRef, useState } from 'react';\n\nexport type ActivityState = 'idle' | 'in-progress' | 'completed' | 'reviewing';\n\nexport interface UseActivityStateResult {\n state: ActivityState;\n /** idle → in-progress; records start time once. Idempotent: repeated calls\n * (e.g. every learner interaction) neither restart timing nor regress state. */\n start: () => void;\n /** → completed. */\n complete: () => void;\n /** → reviewing (e.g. when showing correct answers). */\n review: () => void;\n /**\n * Clears timing and returns to `to`, defaulting to `idle`. Call when the\n * activity `data` prop changes.\n *\n * The target is a parameter because \"reset\" for a RESTORED item does not\n * mean idle: an item the learner had already submitted must come back\n * submitted, or a data-prop change quietly unlocks committed work.\n */\n reset: (to?: ActivityState) => void;\n /** Elapsed ms since `start()`; 0 when not started (or after `reset()`). */\n getTimeSpent: () => number;\n}\n\n/**\n * Tracks an activity's lifecycle state and elapsed time. Timing is held in a\n * ref (no re-render) and `getTimeSpent()` is read imperatively at submission.\n */\nexport function useActivityState(initialState: ActivityState = 'idle'): UseActivityStateResult {\n // `initialState` seeds the MOUNT only, like any `default*` value. It exists\n // so a resumed attempt can reopen a question the learner had already\n // submitted as submitted — without it, an exam that locks each question on\n // submit silently unlocks every one of them after a crash, and the learner\n // can answer and submit the same question twice.\n const [state, setState] = useState<ActivityState>(initialState);\n const startTimeRef = useRef<number | null>(null);\n\n const start = useCallback(() => {\n // Ref guard makes timing idempotent without a side effect in the updater\n // (StrictMode double-invokes updaters); the updater itself stays pure.\n if (startTimeRef.current === null) {\n startTimeRef.current = Date.now();\n }\n setState((prev) => (prev === 'idle' ? 'in-progress' : prev));\n }, []);\n\n const complete = useCallback(() => setState('completed'), []);\n\n const review = useCallback(() => setState('reviewing'), []);\n\n const reset = useCallback((to: ActivityState = 'idle') => {\n startTimeRef.current = null;\n setState(to);\n }, []);\n\n const getTimeSpent = useCallback(\n () => (startTimeRef.current === null ? 0 : Date.now() - startTimeRef.current),\n [],\n );\n\n return { state, start, complete, review, reset, getTimeSpent };\n}\n"],"mappings":";;;;;;;;AAgCA,SAAgB,iBAAiB,eAA8B,QAAgC;CAM7F,MAAM,CAAC,OAAO,aAAA,GAAYA,MAAAA,SAAAA,CAAwB,YAAY;CAC9D,MAAM,gBAAA,GAAeC,MAAAA,OAAAA,CAAsB,IAAI;CAyB/C,OAAO;EAAE;EAAO,QAAA,GAvBFC,MAAAA,YAAAA,OAAkB;GAG9B,IAAI,aAAa,YAAY,MAC3B,aAAa,UAAU,KAAK,IAAI;GAElC,UAAU,SAAU,SAAS,SAAS,gBAAgB,IAAK;EAC7D,GAAG,CAAC,CAgBgB;EAAG,WAAA,GAdNA,MAAAA,YAAAA,OAAkB,SAAS,WAAW,GAAG,CAAC,CAc7B;EAAG,SAAA,GAZlBA,MAAAA,YAAAA,OAAkB,SAAS,WAAW,GAAG,CAAC,CAYnB;EAAG,QAAA,GAV3BA,MAAAA,YAAAA,EAAa,KAAoB,WAAW;GACxD,aAAa,UAAU;GACvB,SAAS,EAAE;EACb,GAAG,CAAC,CAOyC;EAAG,eAAA,GAL3BA,MAAAA,YAAAA,OACZ,aAAa,YAAY,OAAO,IAAI,KAAK,IAAI,IAAI,aAAa,SACrE,CAAC,CAGwD;CAAE;AAC/D"}
|
|
@@ -1,29 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
//#region src/hooks/useActivityState.d.ts
|
|
2
|
+
export type ActivityState = 'idle' | 'in-progress' | 'completed' | 'reviewing';
|
|
3
|
+
export interface UseActivityStateResult {
|
|
4
|
+
state: ActivityState;
|
|
5
|
+
/** idle → in-progress; records start time once. Idempotent: repeated calls
|
|
6
|
+
* (e.g. every learner interaction) neither restart timing nor regress state. */
|
|
7
|
+
start: () => void;
|
|
8
|
+
/** → completed. */
|
|
9
|
+
complete: () => void;
|
|
10
|
+
/** → reviewing (e.g. when showing correct answers). */
|
|
11
|
+
review: () => void;
|
|
12
|
+
/**
|
|
13
|
+
* Clears timing and returns to `to`, defaulting to `idle`. Call when the
|
|
14
|
+
* activity `data` prop changes.
|
|
15
|
+
*
|
|
16
|
+
* The target is a parameter because "reset" for a RESTORED item does not
|
|
17
|
+
* mean idle: an item the learner had already submitted must come back
|
|
18
|
+
* submitted, or a data-prop change quietly unlocks committed work.
|
|
19
|
+
*/
|
|
20
|
+
reset: (to?: ActivityState) => void;
|
|
21
|
+
/** Elapsed ms since `start()`; 0 when not started (or after `reset()`). */
|
|
22
|
+
getTimeSpent: () => number;
|
|
22
23
|
}
|
|
23
24
|
/**
|
|
24
25
|
* Tracks an activity's lifecycle state and elapsed time. Timing is held in a
|
|
25
26
|
* ref (no re-render) and `getTimeSpent()` is read imperatively at submission.
|
|
26
27
|
*/
|
|
27
|
-
declare function useActivityState(initialState?: ActivityState): UseActivityStateResult;
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
export declare function useActivityState(initialState?: ActivityState): UseActivityStateResult;
|
|
29
|
+
//#endregion
|
|
30
|
+
//# sourceMappingURL=useActivityState.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useActivityState.d.cts","names":[],"sources":["../../src/hooks/useActivityState.ts"],"mappings":";YAIY;iBAEK;EACf,OAAO;;;EAGP;;EAEA;;EAEA;;;;;;;;;EASA,QAAQ,KAAK;;EAEb;;;;;;wBAOc,iBAAiB,eAAc,gBAAyB"}
|
|
@@ -1,29 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
//#region src/hooks/useActivityState.d.ts
|
|
2
|
+
export type ActivityState = 'idle' | 'in-progress' | 'completed' | 'reviewing';
|
|
3
|
+
export interface UseActivityStateResult {
|
|
4
|
+
state: ActivityState;
|
|
5
|
+
/** idle → in-progress; records start time once. Idempotent: repeated calls
|
|
6
|
+
* (e.g. every learner interaction) neither restart timing nor regress state. */
|
|
7
|
+
start: () => void;
|
|
8
|
+
/** → completed. */
|
|
9
|
+
complete: () => void;
|
|
10
|
+
/** → reviewing (e.g. when showing correct answers). */
|
|
11
|
+
review: () => void;
|
|
12
|
+
/**
|
|
13
|
+
* Clears timing and returns to `to`, defaulting to `idle`. Call when the
|
|
14
|
+
* activity `data` prop changes.
|
|
15
|
+
*
|
|
16
|
+
* The target is a parameter because "reset" for a RESTORED item does not
|
|
17
|
+
* mean idle: an item the learner had already submitted must come back
|
|
18
|
+
* submitted, or a data-prop change quietly unlocks committed work.
|
|
19
|
+
*/
|
|
20
|
+
reset: (to?: ActivityState) => void;
|
|
21
|
+
/** Elapsed ms since `start()`; 0 when not started (or after `reset()`). */
|
|
22
|
+
getTimeSpent: () => number;
|
|
22
23
|
}
|
|
23
24
|
/**
|
|
24
25
|
* Tracks an activity's lifecycle state and elapsed time. Timing is held in a
|
|
25
26
|
* ref (no re-render) and `getTimeSpent()` is read imperatively at submission.
|
|
26
27
|
*/
|
|
27
|
-
declare function useActivityState(initialState?: ActivityState): UseActivityStateResult;
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
export declare function useActivityState(initialState?: ActivityState): UseActivityStateResult;
|
|
29
|
+
//#endregion
|
|
30
|
+
//# sourceMappingURL=useActivityState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useActivityState.d.ts","names":[],"sources":["../../src/hooks/useActivityState.ts"],"mappings":";YAIY;iBAEK;EACf,OAAO;;;EAGP;;EAEA;;EAEA;;;;;;;;;EASA,QAAQ,KAAK;;EAEb;;;;;;wBAOc,iBAAiB,eAAc,gBAAyB"}
|
|
@@ -1,4 +1,30 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
"use client";
|
|
3
|
+
import { useCallback, useRef, useState } from "react";
|
|
4
|
+
//#region src/hooks/useActivityState.ts
|
|
5
|
+
/**
|
|
6
|
+
* Tracks an activity's lifecycle state and elapsed time. Timing is held in a
|
|
7
|
+
* ref (no re-render) and `getTimeSpent()` is read imperatively at submission.
|
|
8
|
+
*/
|
|
9
|
+
function useActivityState(initialState = "idle") {
|
|
10
|
+
const [state, setState] = useState(initialState);
|
|
11
|
+
const startTimeRef = useRef(null);
|
|
12
|
+
return {
|
|
13
|
+
state,
|
|
14
|
+
start: useCallback(() => {
|
|
15
|
+
if (startTimeRef.current === null) startTimeRef.current = Date.now();
|
|
16
|
+
setState((prev) => prev === "idle" ? "in-progress" : prev);
|
|
17
|
+
}, []),
|
|
18
|
+
complete: useCallback(() => setState("completed"), []),
|
|
19
|
+
review: useCallback(() => setState("reviewing"), []),
|
|
20
|
+
reset: useCallback((to = "idle") => {
|
|
21
|
+
startTimeRef.current = null;
|
|
22
|
+
setState(to);
|
|
23
|
+
}, []),
|
|
24
|
+
getTimeSpent: useCallback(() => startTimeRef.current === null ? 0 : Date.now() - startTimeRef.current, [])
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { useActivityState };
|
|
29
|
+
|
|
4
30
|
//# sourceMappingURL=useActivityState.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"useActivityState.js","names":[],"sources":["../../src/hooks/useActivityState.ts"],"sourcesContent":["'use client';\n\nimport { useCallback, useRef, useState } from 'react';\n\nexport type ActivityState = 'idle' | 'in-progress' | 'completed' | 'reviewing';\n\nexport interface UseActivityStateResult {\n state: ActivityState;\n /** idle → in-progress; records start time once. Idempotent: repeated calls\n * (e.g. every learner interaction) neither restart timing nor regress state. */\n start: () => void;\n /** → completed. */\n complete: () => void;\n /** → reviewing (e.g. when showing correct answers). */\n review: () => void;\n /**\n * Clears timing and returns to `to`, defaulting to `idle`. Call when the\n * activity `data` prop changes.\n *\n * The target is a parameter because \"reset\" for a RESTORED item does not\n * mean idle: an item the learner had already submitted must come back\n * submitted, or a data-prop change quietly unlocks committed work.\n */\n reset: (to?: ActivityState) => void;\n /** Elapsed ms since `start()`; 0 when not started (or after `reset()`). */\n getTimeSpent: () => number;\n}\n\n/**\n * Tracks an activity's lifecycle state and elapsed time. Timing is held in a\n * ref (no re-render) and `getTimeSpent()` is read imperatively at submission.\n */\nexport function useActivityState(initialState: ActivityState = 'idle'): UseActivityStateResult {\n // `initialState` seeds the MOUNT only, like any `default*` value. It exists\n // so a resumed attempt can reopen a question the learner had already\n // submitted as submitted — without it, an exam that locks each question on\n // submit silently unlocks every one of them after a crash, and the learner\n // can answer and submit the same question twice.\n const [state, setState] = useState<ActivityState>(initialState);\n const startTimeRef = useRef<number | null>(null);\n\n const start = useCallback(() => {\n // Ref guard makes timing idempotent without a side effect in the updater\n // (StrictMode double-invokes updaters); the updater itself stays pure.\n if (startTimeRef.current === null) {\n startTimeRef.current = Date.now();\n }\n setState((prev) => (prev === 'idle' ? 'in-progress' : prev));\n }, []);\n\n const complete = useCallback(() => setState('completed'), []);\n\n const review = useCallback(() => setState('reviewing'), []);\n\n const reset = useCallback((to: ActivityState = 'idle') => {\n startTimeRef.current = null;\n setState(to);\n }, []);\n\n const getTimeSpent = useCallback(\n () => (startTimeRef.current === null ? 0 : Date.now() - startTimeRef.current),\n [],\n );\n\n return { state, start, complete, review, reset, getTimeSpent };\n}\n"],"mappings":";;;;;;;AAgCA,SAAgB,iBAAiB,eAA8B,QAAgC;CAM7F,MAAM,CAAC,OAAO,YAAY,SAAwB,YAAY;CAC9D,MAAM,eAAe,OAAsB,IAAI;CAyB/C,OAAO;EAAE;EAAO,OAvBF,kBAAkB;GAG9B,IAAI,aAAa,YAAY,MAC3B,aAAa,UAAU,KAAK,IAAI;GAElC,UAAU,SAAU,SAAS,SAAS,gBAAgB,IAAK;EAC7D,GAAG,CAAC,CAgBgB;EAAG,UAdN,kBAAkB,SAAS,WAAW,GAAG,CAAC,CAc7B;EAAG,QAZlB,kBAAkB,SAAS,WAAW,GAAG,CAAC,CAYnB;EAAG,OAV3B,aAAa,KAAoB,WAAW;GACxD,aAAa,UAAU;GACvB,SAAS,EAAE;EACb,GAAG,CAAC,CAOyC;EAAG,cAL3B,kBACZ,aAAa,YAAY,OAAO,IAAI,KAAK,IAAI,IAAI,aAAa,SACrE,CAAC,CAGwD;CAAE;AAC/D"}
|
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Object.defineProperty(exports, "CAPTURE_PROCESSOR_SOURCE", {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: function () { return chunkUDCQTOVU_cjs.CAPTURE_PROCESSOR_SOURCE; }
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "useSpeechRecorder", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () { return chunkUDCQTOVU_cjs.useSpeechRecorder; }
|
|
15
|
-
});
|
|
16
|
-
//# sourceMappingURL=useSpeechRecorder.cjs.map
|
|
17
|
-
//# sourceMappingURL=useSpeechRecorder.cjs.map
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
+
const require_useSpeechRecorder = require("../useSpeechRecorder--O_f-xvt.cjs");
|
|
5
|
+
exports.CAPTURE_PROCESSOR_SOURCE = require_useSpeechRecorder.CAPTURE_PROCESSOR_SOURCE;
|
|
6
|
+
exports.useSpeechRecorder = require_useSpeechRecorder.useSpeechRecorder;
|
|
@@ -1,127 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* The audio worklet module `useSpeechRecorder` captures through, as source
|
|
5
|
-
* text — exported so an application with a strict Content-Security-Policy can
|
|
6
|
-
* serve it itself.
|
|
7
|
-
*
|
|
8
|
-
* By default the hook loads this text from a `blob:` URL. A worklet module is
|
|
9
|
-
* loaded as a script, so it is `script-src` that must allow `blob:` —
|
|
10
|
-
* `worker-src` does not govern it. Where that is refused, write this string to
|
|
11
|
-
* a file your policy's `script-src` does allow, at build time and from the
|
|
12
|
-
* installed package so it moves with the version you run, and pass that file's
|
|
13
|
-
* URL as `workletUrl`:
|
|
14
|
-
*
|
|
15
|
-
* ```ts
|
|
16
|
-
* import { writeFileSync } from 'node:fs';
|
|
17
|
-
* import { CAPTURE_PROCESSOR_SOURCE } from '@intellectif/lk-react/hooks/useSpeechRecorder';
|
|
18
|
-
*
|
|
19
|
-
* writeFileSync('public/lk-speech-capture.js', CAPTURE_PROCESSOR_SOURCE);
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* **The contract** a module at `workletUrl` must meet, which this source does:
|
|
23
|
-
* register an `AudioWorkletProcessor` under the name `lk-speech-capture`, and
|
|
24
|
-
* from its `process(inputs)` post the first input's channels to its `port` as
|
|
25
|
-
* an array with one `Float32Array` per channel, **copied** — the render
|
|
26
|
-
* quantum's buffers belong to the audio thread and are overwritten on the next
|
|
27
|
-
* quantum, so a block posted without copying arrives as whatever the
|
|
28
|
-
* microphone heard some milliseconds later. Return `true`, which keeps the
|
|
29
|
-
* processor alive while its source is silent. Anything else changes what is
|
|
30
|
-
* recorded, so serve this text unchanged rather than a copy of your own.
|
|
31
|
-
*/
|
|
32
|
-
declare const CAPTURE_PROCESSOR_SOURCE: string;
|
|
33
|
-
|
|
34
|
-
interface SpeechRecorderOptions {
|
|
35
|
-
/** The longest a take may be. Reached, the recording stops itself. */
|
|
36
|
-
maxDurationMs: number;
|
|
37
|
-
/** Shorter than this and the take is refused as `too-short`. */
|
|
38
|
-
minDurationMs?: number;
|
|
39
|
-
/** How many takes the learner may make. Unbounded when absent. */
|
|
40
|
-
maxTakes?: number;
|
|
41
|
-
/**
|
|
42
|
-
* The URL of a self-hosted copy of {@link CAPTURE_PROCESSOR_SOURCE}, for an
|
|
43
|
-
* application whose Content-Security-Policy does not allow `blob:` in
|
|
44
|
-
* `script-src`. Serve that string unchanged; the contract a module here must
|
|
45
|
-
* meet is written on it.
|
|
46
|
-
*
|
|
47
|
-
* **A URL that does not work is not reported.** If the module fails to load,
|
|
48
|
-
* or loads without registering `lk-speech-capture`, the hook records through
|
|
49
|
-
* the deprecated `ScriptProcessorNode` on the main thread instead — the
|
|
50
|
-
* fallback it keeps for engines without audio worklets — and a recorder with
|
|
51
|
-
* a broken `workletUrl` looks like a working one. Only an engine with neither
|
|
52
|
-
* path reports `error: 'unsupported'`. Check that the module is actually
|
|
53
|
-
* fetched.
|
|
54
|
-
*/
|
|
55
|
-
workletUrl?: string;
|
|
56
|
-
}
|
|
57
|
-
interface SpeechRecorder {
|
|
58
|
-
status: SpeechRecorderStatus;
|
|
59
|
-
error: SpeechRecorderError | null;
|
|
60
|
-
/** The loudest block since the last update, 0..1. */
|
|
61
|
-
level: number;
|
|
62
|
-
/** How much audio has been captured, from the sample count. */
|
|
63
|
-
elapsedMs: number;
|
|
64
|
-
take: RecordedTake | null;
|
|
65
|
-
takesUsed: number;
|
|
66
|
-
/** Whether a take remains. Not whether a `start()` would be accepted now. */
|
|
67
|
-
canRecord: boolean;
|
|
68
|
-
/** Opens the microphone and begins capturing. **Never rejects.** */
|
|
69
|
-
start(): Promise<void>;
|
|
70
|
-
/** Ends the capture and encodes the take. */
|
|
71
|
-
stop(): void;
|
|
72
|
-
/** Throws the take away and releases the microphone. */
|
|
73
|
-
discard(): void;
|
|
74
|
-
/**
|
|
75
|
-
* Starts over: releases the microphone, throws the take away **and gives the
|
|
76
|
-
* budget back**.
|
|
77
|
-
*
|
|
78
|
-
* That last part is the whole difference from {@link SpeechRecorder.discard},
|
|
79
|
-
* which deliberately refunds nothing — a budget a re-record gave back would
|
|
80
|
-
* bound nothing. A reset is for a recorder that has been handed a different
|
|
81
|
-
* reading while it stayed mounted: the takes belong to the activity, so the
|
|
82
|
-
* next activity's are its own. Calling it for the same reading hands a
|
|
83
|
-
* learner takes they have already spent.
|
|
84
|
-
*/
|
|
85
|
-
reset(): void;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Records a take of speech as mono 16-bit PCM WAV at 16 kHz.
|
|
89
|
-
*
|
|
90
|
-
* That is the one format the SDK measures directly: `inspectWav` reads it
|
|
91
|
-
* without a decoding library, and it is what every mainstream pronunciation
|
|
92
|
-
* assessor accepts. A take is captured at whatever rate the device runs at,
|
|
93
|
-
* downmixed to mono, low-pass filtered and resampled, then encoded — so what a
|
|
94
|
-
* server measures is what this hook produced, not a claim about it.
|
|
95
|
-
*
|
|
96
|
-
* **Server rendering.** `status`, `error` and `canRecord` are derived from the
|
|
97
|
-
* take count alone and never from a browser global, so the markup a server
|
|
98
|
-
* produces is the markup the browser's first render produces. Support is
|
|
99
|
-
* discovered inside {@link SpeechRecorder.start} and reported as
|
|
100
|
-
* `error: 'unsupported'`; the obvious `!!navigator.mediaDevices` guard at
|
|
101
|
-
* render time would make a server render and its hydration disagree.
|
|
102
|
-
*
|
|
103
|
-
* **Identity.** `start`, `stop`, `discard` and `reset` keep one identity for the
|
|
104
|
-
* life of the hook, so they are safe in a dependency array. The returned object keeps
|
|
105
|
-
* one identity for as long as none of its values changes, so a render caused
|
|
106
|
-
* by something else does not invalidate an effect that depends on it.
|
|
107
|
-
*
|
|
108
|
-
* `start()` does nothing when no take remains, so `canRecord` is presentation:
|
|
109
|
-
* mark the control `aria-disabled` rather than `disabled`, which would take it
|
|
110
|
-
* out of the tab order and leave a learner nothing to read.
|
|
111
|
-
*
|
|
112
|
-
* ```tsx
|
|
113
|
-
* const recorder = useSpeechRecorder({ maxDurationMs: 20_000, maxTakes: 3 });
|
|
114
|
-
* <button
|
|
115
|
-
* type="button"
|
|
116
|
-
* aria-disabled={!recorder.canRecord}
|
|
117
|
-
* onClick={() => {
|
|
118
|
-
* void recorder.start();
|
|
119
|
-
* }}
|
|
120
|
-
* >
|
|
121
|
-
* Record
|
|
122
|
-
* </button>
|
|
123
|
-
* ```
|
|
124
|
-
*/
|
|
125
|
-
declare function useSpeechRecorder(options: SpeechRecorderOptions): SpeechRecorder;
|
|
126
|
-
|
|
127
|
-
export { CAPTURE_PROCESSOR_SOURCE, RecordedTake, type SpeechRecorder, SpeechRecorderError, type SpeechRecorderOptions, SpeechRecorderStatus, useSpeechRecorder };
|
|
1
|
+
import { a as RecordedTake, i as CAPTURE_PROCESSOR_SOURCE, n as SpeechRecorderOptions, o as SpeechRecorderError, r as useSpeechRecorder, s as SpeechRecorderStatus, t as SpeechRecorder } from "../useSpeechRecorder-DtAYvl02.cjs";
|
|
2
|
+
export { CAPTURE_PROCESSOR_SOURCE, type RecordedTake, SpeechRecorder, type SpeechRecorderError, SpeechRecorderOptions, type SpeechRecorderStatus, useSpeechRecorder };
|