lido-player 0.0.2-beta-15-dev → 0.0.2-beta-17
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/LICENSE +21 -21
- package/dist/cjs/{decode-Xh5IDmFh.js → decode-BPWgujpW.js} +1 -1
- package/dist/cjs/{index-B9AON0kM.js → index-BnfJD-Dp.js} +145 -96
- package/dist/cjs/{index-Dy19zuTX.js → index-CACb9dlg.js} +1 -1
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/lido-avatar_22.cjs.entry.js +56 -43
- package/dist/cjs/lido-player.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/avatar/lido-avatar.css +4 -4
- package/dist/collection/components/avatar/lido-avatar.js +1 -1
- package/dist/collection/components/avatar/lido-avatar.tsx +207 -207
- package/dist/collection/components/avatar/readme.md +49 -49
- package/dist/collection/components/calculator/lido-calculator.css +89 -89
- package/dist/collection/components/calculator/lido-calculator.js +4 -4
- package/dist/collection/components/canvas/lido-canvas.css +33 -33
- package/dist/collection/components/canvas/lido-canvas.js +1 -1
- package/dist/collection/components/cell/lido-cell.css +100 -100
- package/dist/collection/components/cell/lido-cell.js +12 -12
- package/dist/collection/components/column/lido-col.css +19 -19
- package/dist/collection/components/column/lido-col.js +6 -6
- package/dist/collection/components/container/lido-container.css +10 -10
- package/dist/collection/components/container/lido-container.js +8 -8
- package/dist/collection/components/flashCard/lido-flash-card.css +28 -28
- package/dist/collection/components/flashCard/lido-flash-card.js +4 -4
- package/dist/collection/components/float/lido-float.css +30 -30
- package/dist/collection/components/float/lido-float.js +2 -2
- package/dist/collection/components/home/lido-home.css +309 -309
- package/dist/collection/components/home/lido-home.js +5 -5
- package/dist/collection/components/image/lido-image.css +17 -17
- package/dist/collection/components/image/lido-image.js +6 -6
- package/dist/collection/components/keyboard/lido-keyboard.css +38 -38
- package/dist/collection/components/keyboard/lido-keyboard.js +3 -3
- package/dist/collection/components/mathMatrix/lido-math-matrix.css +56 -56
- package/dist/collection/components/mathMatrix/lido-math-matrix.js +12 -2
- package/dist/collection/components/position/lido-pos.css +16 -16
- package/dist/collection/components/position/lido-pos.js +2 -2
- package/dist/collection/components/random/lido-random.css +8 -8
- package/dist/collection/components/random/lido-random.js +2 -2
- package/dist/collection/components/root/lido-root.js +5 -5
- package/dist/collection/components/row/lido-row.css +10 -10
- package/dist/collection/components/row/lido-row.js +6 -6
- package/dist/collection/components/scale/assets/Shadow.svg +9 -0
- package/dist/collection/components/scale/lido-balance.css +145 -145
- package/dist/collection/components/scale/lido-balance.js +25 -23
- package/dist/collection/components/shape/lido-shape.css +216 -216
- package/dist/collection/components/shape/lido-shape.js +6 -6
- package/dist/collection/components/slideFill/lido-slide-fill.css +3 -3
- package/dist/collection/components/slideFill/lido-slide-fill.js +13 -13
- package/dist/collection/components/text/lido-text.css +53 -53
- package/dist/collection/components/text/lido-text.js +6 -5
- package/dist/collection/components/trace/assets/Tracing-hand.svg +8 -0
- package/dist/collection/components/trace/lido-trace.css +97 -97
- package/dist/collection/components/trace/lido-trace.js +6 -6
- package/dist/collection/components/wrap/lido-wrap.css +18 -18
- package/dist/collection/components/wrap/lido-wrap.js +6 -6
- package/dist/collection/css/animation.css +211 -211
- package/dist/collection/css/index.css +315 -312
- package/dist/collection/stories/Templates/Fill-Up/fill-up.stories.js +61 -61
- package/dist/collection/stories/Templates/LetterPairing/LetterPairing.stories.js +123 -123
- package/dist/collection/stories/Templates/RocketGame/rocketGame.stories.js +48 -48
- package/dist/collection/stories/Templates/Tag/tagGame.stories.js +39 -39
- package/dist/collection/stories/Templates/arrangeLetters/arrangeLetters.stories.js +44 -44
- package/dist/collection/stories/Templates/balancing/balancing.stories.js +35 -35
- package/dist/collection/stories/Templates/balloonPop/balloonPop.stories.js +38 -38
- package/dist/collection/stories/Templates/blender/blender.stories.js +58 -58
- package/dist/collection/stories/Templates/bubbleType/bubbleType.stories.js +42 -42
- package/dist/collection/stories/Templates/calculator/calculator.stories.js +28 -28
- package/dist/collection/stories/Templates/categorize/categorize.stories.js +37 -37
- package/dist/collection/stories/Templates/categorize2/categorize2.stories.js +67 -67
- package/dist/collection/stories/Templates/checker-block/checkerBlock.stories.js +29 -29
- package/dist/collection/stories/Templates/checkerBlock/checkerBlock.stories.js +13 -13
- package/dist/collection/stories/Templates/create-sentence/createSentence.stories.js +74 -74
- package/dist/collection/stories/Templates/dragAndDrop/drag-drop.stories.js +69 -69
- package/dist/collection/stories/Templates/fillAnswer/fill-answer.stories.js +43 -43
- package/dist/collection/stories/Templates/fillBlank/fill-blank.stories.js +282 -282
- package/dist/collection/stories/Templates/foodJar/food-jar.stories.js +35 -35
- package/dist/collection/stories/Templates/grid/grid.stories.js +118 -118
- package/dist/collection/stories/Templates/gridGame/grid-game.stories.js +57 -57
- package/dist/collection/stories/Templates/imageMatch/imageMatch.stories.js +44 -44
- package/dist/collection/stories/Templates/jumpSentence/jumpSentence.stories.js +41 -41
- package/dist/collection/stories/Templates/letterboard/letterboard.stories.js +183 -183
- package/dist/collection/stories/Templates/makeSentence/make-sentence.stories.js +36 -36
- package/dist/collection/stories/Templates/matchBox/matchBox.stories.js +69 -69
- package/dist/collection/stories/Templates/matchBox/matchBox2.stories.js +84 -84
- package/dist/collection/stories/Templates/matchingCard/matching-card.stories.js +31 -31
- package/dist/collection/stories/Templates/multipleOption/mcqWithQuestionImage.stories.js +112 -112
- package/dist/collection/stories/Templates/multipleOption/multiple-option.stories.js +47 -47
- package/dist/collection/stories/Templates/multiplyBeeds/multiplyBeeds.stories.js +57 -57
- package/dist/collection/stories/Templates/nimbleTable/nimbleTable.stories.js +53 -53
- package/dist/collection/stories/Templates/numberBoard/numberBoard.stories.js +46 -46
- package/dist/collection/stories/Templates/numberBoardTwo/numberBoardTwo.stories.js +45 -45
- package/dist/collection/stories/Templates/numberIdentification/numberIdentificationimageTotext.stories.js +56 -56
- package/dist/collection/stories/Templates/numberIdentification/numberIdentificationtextTotext.stories.js +53 -53
- package/dist/collection/stories/Templates/numberPair/numberPair.stories.js +127 -127
- package/dist/collection/stories/Templates/openwindow/openwindow.stories.js +47 -47
- package/dist/collection/stories/Templates/openwindow/openwindow2.stories.js +38 -38
- package/dist/collection/stories/Templates/order-tractor/order-tractor-ascending-order.stories.js +97 -97
- package/dist/collection/stories/Templates/order-tractor/order-tractor.stories.js +90 -90
- package/dist/collection/stories/Templates/palEgmaCalculateSum/palEgmaMultiOption.stories.js +63 -63
- package/dist/collection/stories/Templates/palEgmaCalculateSum/palEgmaSumTogether.stories.js +45 -45
- package/dist/collection/stories/Templates/palEgmaPatternMatching/palEgmaPatternMatching.stories.js +63 -63
- package/dist/collection/stories/Templates/palEgmaWordProblem/palEgmaWordProblem.stories.js +79 -79
- package/dist/collection/stories/Templates/palEgraInventedSpelling/pal_egra_invented_spelling_schema.stories.js +32 -32
- package/dist/collection/stories/Templates/palEgraMCQWithImage/palEgraMCQWithImage.stories.js +42 -42
- package/dist/collection/stories/Templates/palEgraOptionWithAudio/palEgraOptionWithAudio.stories.js +63 -63
- package/dist/collection/stories/Templates/palEgraStoryMaking/pal_egra_story_making.stories.js +44 -44
- package/dist/collection/stories/Templates/palEgraTemplate1/palEgraLetterIdentification.stories.js +34 -34
- package/dist/collection/stories/Templates/palEgraWordMatch/palEgraWordMatch.stories.js +52 -52
- package/dist/collection/stories/Templates/palEgra_OddOneOut/palEgra_oddOneOut.stories.js +33 -33
- package/dist/collection/stories/Templates/palEgra_arrange_pictures/palEgra_arrange_pictures.stories.js +40 -40
- package/dist/collection/stories/Templates/palEgra_build_word/palEgra_build_word.stories.js +48 -48
- package/dist/collection/stories/Templates/palEgra_word_formation/palEgra_WordFormation.stories.js +48 -48
- package/dist/collection/stories/Templates/palStorytale/palStorytale.stories.js +18 -18
- package/dist/collection/stories/Templates/phonic-tractor/phonic-tractor.stories.js +44 -44
- package/dist/collection/stories/Templates/pictureClues/pictureClues.stories.js +34 -34
- package/dist/collection/stories/Templates/pictureWordMatch/pictureWordMatch1.stories.js +36 -36
- package/dist/collection/stories/Templates/pictureWordMatch/pictureWordMatch2.stories.js +30 -30
- package/dist/collection/stories/Templates/picturemeaning/pictureMeaningCocos.stories.js +20 -20
- package/dist/collection/stories/Templates/puzzleGame/puzzleGame.stories.js +17 -17
- package/dist/collection/stories/Templates/questionBoard/questionBoard.stories.js +58 -58
- package/dist/collection/stories/Templates/quizLiteracy/quizLiteracy.stories.js +50 -50
- package/dist/collection/stories/Templates/quizLiteracy/quizLiteracyImageWithText.stories.js +36 -36
- package/dist/collection/stories/Templates/quizLiteracy/quizLiteracyImageWord.stories.js +43 -43
- package/dist/collection/stories/Templates/quizMaths/quizMaths.stories.js +631 -631
- package/dist/collection/stories/Templates/reorder/reorder.stories.js +63 -63
- package/dist/collection/stories/Templates/rowBlocks/rowBlocks.stories.js +47 -47
- package/dist/collection/stories/Templates/sentenceMatch/sentenceMatch.stories.js +29 -29
- package/dist/collection/stories/Templates/sequenceBox/sequenceBox1.stories.js +64 -64
- package/dist/collection/stories/Templates/sequenceBox/sequenceBox2.stories.js +62 -62
- package/dist/collection/stories/Templates/shapePair/shape-pair.stories.js +106 -106
- package/dist/collection/stories/Templates/shapeTractor/shape-tractor.stories.js +50 -50
- package/dist/collection/stories/Templates/spellDoor/spellDoor.stories.js +41 -41
- package/dist/collection/stories/Templates/storyTale/storyTale.stories.js +39 -39
- package/dist/collection/stories/Templates/substraction/substractionWithimg.stories.js +62 -62
- package/dist/collection/stories/Templates/substraction/substractionWithoutImg.stories.js +42 -42
- package/dist/collection/stories/Templates/sumTogether/sumTogether.stories.js +50 -50
- package/dist/collection/stories/Templates/tenBox/tenBox.stories.js +88 -88
- package/dist/collection/stories/Templates/total/total.stories.js +28 -28
- package/dist/collection/stories/Templates/wordBuilding/wordBuildingwithimg.stories.js +35 -35
- package/dist/collection/stories/Templates/wordBuilding/wordBuildingwithoutimg.stories.js +34 -34
- package/dist/collection/stories/Templates/writeCard/writeCard.stories.js +31 -31
- package/dist/collection/stories/Templates/writeLetter/writeLetter.stories.js +58 -58
- package/dist/collection/stories/Templates/writeNumber/writeNumber.stories.js +44 -44
- package/dist/collection/stories/Templates/writeSet/writeSet.stories.js +31 -31
- package/dist/collection/stories/Templates/writeWord/writeWord.stories.js +34 -34
- package/dist/collection/stories/components/flash-card.stories.js +48 -48
- package/dist/collection/stories/components/keyboard.stories.js +10 -10
- package/dist/collection/stories/components/slider.stories.js +4 -4
- package/dist/collection/stories/components/trace.stories.js +5 -5
- package/dist/collection/utils/audioPlayer.js +31 -9
- package/dist/collection/utils/constants.js +1 -0
- package/dist/collection/utils/utils.js +8 -7
- package/dist/collection/utils/utilsHandlers/animationHandler.js +29 -11
- package/dist/collection/utils/utilsHandlers/clickHandler.js +8 -0
- package/dist/collection/utils/utilsHandlers/dragDropHandler.js +8 -8
- package/dist/collection/utils/utilsHandlers/highlightHandler.js +54 -54
- package/dist/collection/utils/utilsHandlers/lidoCalculatorHandler.js +12 -15
- package/dist/collection/utils/utilsHandlers/slideHandler.js +10 -8
- package/dist/collection/utils/utilsHandlers/sortHandler.js +10 -10
- package/dist/components/index.js +1 -1
- package/dist/components/lido-avatar.js +1 -1
- package/dist/components/lido-balance.js +1 -1
- package/dist/components/lido-calculator.js +1 -1
- package/dist/components/lido-canvas.js +1 -1
- package/dist/components/lido-cell.js +1 -1
- package/dist/components/lido-col.js +1 -1
- package/dist/components/lido-container.js +1 -1
- package/dist/components/lido-flash-card.js +1 -1
- package/dist/components/lido-float.js +1 -1
- package/dist/components/lido-home.js +1 -1
- package/dist/components/lido-keyboard.js +1 -1
- package/dist/components/lido-math-matrix.js +1 -1
- package/dist/components/lido-pos.js +1 -1
- package/dist/components/lido-random.js +1 -1
- package/dist/components/lido-root.js +1 -1
- package/dist/components/lido-row.js +1 -1
- package/dist/components/lido-shape.js +1 -1
- package/dist/components/lido-slide-fill.js +1 -1
- package/dist/components/lido-text.js +1 -1
- package/dist/components/lido-trace.js +1 -1
- package/dist/components/lido-wrap.js +1 -1
- package/dist/components/p-B8nzzM8c.js +1 -0
- package/dist/components/{p-Sl9R-E6h.js → p-BBHM059l.js} +1 -1
- package/dist/components/p-BXvoOUIv.js +1 -0
- package/dist/components/{p-CwDTdXe5.js → p-BeRr8u5m.js} +1 -1
- package/dist/components/p-BfqihbR6.js +1 -0
- package/dist/components/{p-CPYnt0P-.js → p-C5WmmkI6.js} +1 -1
- package/dist/components/{p-useuhkjH.js → p-C70ykycD.js} +1 -1
- package/dist/components/{p-BE25wHoo.js → p-CCR42e0i.js} +1 -1
- package/dist/components/{p-C2p0KZh4.js → p-CIbBOu51.js} +1 -1
- package/dist/components/{p-BfwUqpXc.js → p-CTlcpv4a.js} +1 -1
- package/dist/components/{p-CyGxEcn7.js → p-CXHPZN3m.js} +1 -1
- package/dist/components/{p-Bw-OC9iR.js → p-CgsPIpg0.js} +1 -1
- package/dist/components/p-CwIlwnQk.js +1 -0
- package/dist/components/{p-D-IYWSAa.js → p-CxkH5UIf.js} +1 -1
- package/dist/components/{p-DGvzMlyn.js → p-DBbLGy4y.js} +2 -2
- package/dist/components/p-DLyacZap.js +1 -0
- package/dist/components/p-DONbWJGn.js +1 -0
- package/dist/components/p-DVTigdH_.js +1 -0
- package/dist/components/{p-Uluc7jQ7.js → p-DuvxecDX.js} +1 -1
- package/dist/components/p-Dv1cIsyS.js +1 -0
- package/dist/esm/{decode-C-vVYHke.js → decode-To5V_Qqp.js} +1 -1
- package/dist/esm/{index-BswlHnsY.js → index-CEJsA_x_.js} +145 -96
- package/dist/esm/{index-Dq-Z8Dx0.js → index-Dnvog_Mm.js} +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/lido-avatar_22.entry.js +56 -43
- package/dist/esm/lido-player.js +2 -2
- package/dist/esm/loader.js +2 -2
- package/dist/lido-player/assets/Shadow.svg +9 -0
- package/dist/lido-player/assets/Tracing-hand.svg +8 -0
- package/dist/lido-player/index.esm.js +1 -1
- package/dist/lido-player/lido-avatar.css +4 -4
- package/dist/lido-player/lido-avatar.tsx +207 -207
- package/dist/lido-player/lido-player.css +7 -7
- package/dist/lido-player/lido-player.esm.js +1 -1
- package/dist/lido-player/p-3b6e3b51.entry.js +12 -0
- package/dist/lido-player/{p-CYMdg2_E.js → p-DUx4nii8.js} +1 -1
- package/dist/lido-player/p-Dnvog_Mm.js +2 -0
- package/dist/lido-player/p-gkKsw3a6.js +1 -0
- package/dist/lido-player/readme.md +49 -49
- package/dist/types/components/scale/lido-balance.d.ts +2 -2
- package/dist/types/components.d.ts +10 -10
- package/dist/types/types/json.d.ts +3 -3
- package/dist/types/utils/audioPlayer.d.ts +2 -0
- package/dist/types/utils/constants.d.ts +1 -0
- package/package.json +73 -74
- package/readme.md +113 -113
- package/dist/components/p-BSV5U72F.js +0 -1
- package/dist/components/p-C7U1h9gI.js +0 -1
- package/dist/components/p-CS6iRQJh.js +0 -1
- package/dist/components/p-D-B1groh.js +0 -1
- package/dist/components/p-DPAlnts-.js +0 -1
- package/dist/components/p-DYs8s-uh.js +0 -1
- package/dist/components/p-DbR5sNOj.js +0 -1
- package/dist/components/p-leIEepjl.js +0 -1
- package/dist/lido-player/p-0l6uR1lH.js +0 -1
- package/dist/lido-player/p-Dq-Z8Dx0.js +0 -2
- package/dist/lido-player/p-b2c60372.entry.js +0 -12
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t,p as i,H as s,k as o,i as e,u as a,v as l,a as n,h,b as d}from"./index.js";const r=i(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.id="",this.value="",this.z="0",this.tabIndex=0,this.visible=!1,this.onEntry="",this.delayVisible="",this.floatDirection="bottomToTop",this.handleWindowResize=()=>this.updateStyles(),this.handleWindowLoad=()=>this.updateStyles()}componentDidLoad(){o(this.el,this.delayVisible),e(this.el,this.type),this.initializeFloatElement()}componentWillLoad(){this.updateStyles(),window.addEventListener("resize",this.handleWindowResize),window.addEventListener("load",this.handleWindowLoad)}disconnectedCallback(){window.removeEventListener("resize",this.handleWindowResize),window.removeEventListener("load",this.handleWindowLoad)}initializeFloatElement(){let t=0;Array.from(this.el.children).forEach((i=>{const s=i;s.style.visibility="hidden",setTimeout((()=>{s.style.visibility="visible",a(s)}),t),t+=1e3,i.addEventListener("click",(()=>{l(s)}))}))}updateStyles(){const t=window.innerHeight>window.innerWidth?"portrait":"landscape";this.style={height:"leftToRight"!==this.floatDirection?"100%":n(this.height,t),width:"leftToRight"===this.floatDirection?"100%":n(this.width,t),backgroundColor:n(this.bgColor,t),zIndex:this.z,display:this.visible?"flex":"none"}}render(){return h(d,{key:"26ada4c2834a58fe1f45348a32f9d1dcecb79a14",class:"lido-float","float-direction":this.floatDirection,id:this.id,"tab-index":this.tabIndex,style:this.style,onEntry:this.onEntry},h("slot",{key:"6f4ca358f564e268390f221cc1f84af1f303761b"}))}get el(){return this}static get style(){return".lido-float{position:relative}.lido-float>*{position:absolute;cursor:pointer}@keyframes float-up{from{top:var(--el-top)}to{top:-500px}}#removeShadow{box-shadow:unset !important}@keyframes float-lr{from{right:var(--el-left)}to{right:-500px}}"}},[260,"lido-float",{id:[1],value:[1],z:[1],tabIndex:[2,"tab-index"],visible:[4],onEntry:[1,"on-entry"],width:[1],height:[1],bgColor:[1,"bg-color"],type:[1],delayVisible:[1,"delay-visible"],floatDirection:[1,"float-direction"],style:[32]}]);function c(){"undefined"!=typeof customElements&&["lido-float"].forEach((i=>{"lido-float"===i&&(customElements.get(t(i))||customElements.define(t(i),r))}))}c();export{r as L,c as d}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t,p as i,H as s,m as o,h as e,b as h}from"./index.js";const n=i(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.showSpeakIcon=!1,this.id="",this.value="",this.height="auto",this.width="auto",this.ariaLabel="",this.ariaHidden="",this.x="0px",this.y="0px",this.z="0",this.bgColor="",this.type="",this.tabIndex=0,this.visible=!1,this.audio="",this.onTouch="",this.onInCorrect="",this.onCorrect="",this.onEntry="",this.minDrops=1,this.maxDrops=1,this.margin=""}componentDidLoad(){setTimeout((()=>{const t=this.el.parentElement;if(!t)return;const i=t.offsetWidth,s=t.offsetHeight;Array.from(this.el.children).forEach((t=>{const o=i-t.offsetWidth,e=s-t.offsetHeight,h=Math.random()*o,n=Math.random()*e;t.style.position="absolute",t.style.left=`${h}px`,t.style.top=`${n}px`}))}),50),this.showSpeakIcon&&o(this.el)}render(){return e(h,{key:"e0ed354e54ea3c5112d0e068b2a94356ef437874",class:"lido-random",type:this.type,"tab-index":this.tabIndex,value:this.value,style:{height:this.height,width:this.width,top:this.y,left:this.x,display:this.visible?"block":"none",zIndex:this.z,backgroundColor:this.bgColor,margin:this.margin},"aria-label":this.ariaLabel,"aria-hidden":this.ariaHidden,audio:this.audio,onTouch:this.onTouch,onCorrect:this.onCorrect,minDrops:this.minDrops,maxDrops:this.maxDrops,onInCorrect:this.onInCorrect,onEntry:this.onEntry},e("slot",{key:"ed0386cda3ba55d89fb08607775a49a4180f08b3"}))}get el(){return this}static get style(){return".lido-random{position:relative;width:100%;height:100%}.lido-random>*{position:absolute}"}},[260,"lido-random",{showSpeakIcon:[4,"show-speak-icon"],id:[1],value:[1],height:[1],width:[1],ariaLabel:[1,"aria-label"],ariaHidden:[1,"aria-hidden"],x:[1],y:[1],z:[1],bgColor:[1,"bg-color"],type:[1],tabIndex:[2,"tab-index"],visible:[4],audio:[1],onTouch:[1,"on-touch"],onInCorrect:[1,"on-in-correct"],onCorrect:[1,"on-correct"],onEntry:[1,"on-entry"],minDrops:[2,"min-drops"],maxDrops:[2,"max-drops"],margin:[1]}]);function a(){"undefined"!=typeof customElements&&["lido-random"].forEach((i=>{"lido-random"===i&&(customElements.get(t(i))||customElements.define(t(i),n))}))}a();export{n as L,a as d}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as i,p as t,H as e,a as s,k as a,i as d,h,b as n}from"./index.js";const o=t(class extends e{constructor(i){super(),!1!==i&&this.__registerHost(),this.value="",this.height="auto",this.width="auto",this.ariaLabel="",this.ariaHidden="",this.x="0px",this.y="0px",this.z="0",this.bgColor="",this.type="",this.tabIndex=0,this.visible=!0,this.audio="",this.onTouch="",this.onInCorrect="",this.onCorrect="",this.onEntry="",this.flipped=!1,this.margin="",this.disableSpeak=!1,this.style={},this.delayVisible="",this.updateStyles=()=>{const i=window.innerHeight>window.innerWidth?"portrait":"landscape";this.style={height:s(this.height,i)||"200px",width:s(this.width,i)||"200px",backgroundColor:s(this.bgColor,i),top:s(this.y,i),left:s(this.x,i),zIndex:this.z,display:this.visible?this.display?s(this.display,i):"inline-block":"none",flexDirection:this.direction?s(this.direction,i):void 0,margin:s(this.margin,i)}},this.handleFlip=()=>{this.flipped=!this.flipped}}handleFlippedChange(){}componentWillLoad(){this.updateStyles(),window.addEventListener("resize",this.updateStyles),window.addEventListener("load",this.updateStyles)}componentDidLoad(){a(this.el,this.delayVisible);const i=this.el.querySelector(".card");i&&setTimeout((()=>{i.classList.add("flipped"),setTimeout((()=>{i.classList.remove("flipped")}),500)}),500),d(this.el,this.type)}disconnectedCallback(){window.removeEventListener("resize",this.updateStyles),window.removeEventListener("load",this.updateStyles)}render(){return h(n,{key:"cd0d8539f24de1fd7805b271de839ee8efeb4287",value:this.value,"tab-index":this.tabIndex,style:this.style,"aria-label":this.ariaLabel,"aria-hidden":this.ariaHidden,audio:this.audio,onTouch:this.onTouch,onCorrect:this.onCorrect,onInCorrect:this.onInCorrect,onEntry:this.onEntry,type:this.type,onClick:this.handleFlip,"disable-speak":this.disableSpeak},h("div",{key:"a97eaa100216652cc4deaf8b6f73e9ea07a125f2",class:"card "+(this.flipped?"flipped":"")},h("div",{key:"7a6f94b89da76b2c7fc911c44d2aaa63a3d2164d",class:"card-face card-front"},null!=this.front?this.front:h("slot",{name:"front"})),h("div",{key:"15936f96d44db217c042584cc225a42dc3f74e98",class:"card-face card-back"},null!=this.back?this.back:h("slot",{name:"back"}))))}get el(){return this}static get watchers(){return{flipped:[{handleFlippedChange:0}]}}static get style(){return".card{position:relative;width:100%;height:100%;transform-style:preserve-3d;transition:transform 0.6s ease;cursor:pointer}.card.flipped{transform:rotateY(180deg)}.card-face{position:absolute;width:100%;height:100%;backface-visibility:hidden;display:flex;align-items:center;justify-content:center}.card-back{transform:rotateY(180deg)}"}},[260,"lido-flash-card",{value:[1],height:[1],width:[1],ariaLabel:[1,"aria-label"],ariaHidden:[1,"aria-hidden"],x:[1],y:[1],z:[1],bgColor:[1,"bg-color"],type:[1],tabIndex:[2,"tab-index"],visible:[4],audio:[1],onTouch:[1,"on-touch"],onInCorrect:[1,"on-in-correct"],onCorrect:[1,"on-correct"],onEntry:[1,"on-entry"],direction:[1],display:[1],front:[8],back:[8],flipped:[1540],margin:[1],disableSpeak:[4,"disable-speak"],delayVisible:[1,"delay-visible"],style:[32]},void 0,{flipped:[{handleFlippedChange:0}]}]);function r(){"undefined"!=typeof customElements&&["lido-flash-card"].forEach((t=>{"lido-flash-card"===t&&(customElements.get(i(t))||customElements.define(i(t),o))}))}r();export{o as L,r as d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t,p as e,H as i,L as a,T as o,n,c as r,i as s,o as l,q as u,h,b as d,r as c}from"./index.js";import{d as g,i as m}from"./p-C2p0KZh4.js";const p=e(class extends i{constructor(t){super(),!1!==t&&this.__registerHost(),this.Lang="",this.showDropBorder=!0,this.appendToDropOnCompletion=!1,this.id="",this.objective="",this.customStyle="",this.value="",this.height="auto",this.width="auto",this.ariaLabel="auto",this.ariaHidden="",this.x="0px",this.y="0px",this.z="0",this.bgColor="",this.bgImage="",this.type="",this.tabIndex=0,this.visible=!1,this.audio="",this.onTouch="",this.onInCorrect="",this.onCorrect="",this.onEntry="",this.canplay=!0,this.showCheck=!1,this.isContinueOnCorrect=!1,this.isAllowOnlyCorrect=!1,this.baseUrl="",this.margin="",this.showPrevButton="false",this.showNextButton="false",this.delayVisible="",this.disableSpeak=!1,this.templateId="",this.highlightWordByWord=!1,this.instructName="",this.speakFlag=!1,this.handleWindowResize=()=>this.scaleContainer(this.el),this.handleWindowLoad=()=>this.scaleContainer(this.el)}cleanupInteractionHandlers(){this.el.querySelectorAll('[type="drag"], [type="slide"], [move="true"]').forEach((t=>{t.dispatchEvent(new Event(a))}))}languageChanged(t){const e=t||this.resolveLanguage();this.updateChildTextLanguage(e)}componentWillLoad(){const t=this.resolveLanguage();this.updateChildTextLanguage(t),this.resolveInstructionAudio()}resolveInstructionAudio(){var t;this.instructName=null!==(t={flashcard:"instruction.flashcards",mcq:"instruction.mcq",tracing:"instruction.tracing",dragAndDrop:"instruction.dragAndDrop",arrangeLetters:"arrangeLetters",balancing:"balancing",balloonPop:"balloonPop",blender:"blender",bubbleType:"bubbleType",calculator:"calculator",categorize:"categorize",checkerBlocks:"checkerBlocks",createSentence:"createSentence",fillAnswer:"fillAnswer",fillBlank:"fillBlank",fillUp:"fillUp",flashcardtemplate:"flashcard",foodJar:"foodJar",grid:"grid",imageMatchWithQuestionImageAndMultiOption:"imageMatchWithQuestionImageAndMultiOption",inventedSpelling:"inventedSpelling",jumpSentence:"jumpSentence",letterBoard:"letterBoard",letterIdentification:"letterIdentification",letterPairing:"letterPairing",makeSentence:"makeSentence",matchingCard:"matchingCard",multiplyBeeds:"multiplyBeeds",nimbleTable:"nimbleTable",numberBoardOneTwo:"numberBoardOneTwo",numberPair:"numberPair",openWindow:"openWindow",orderTractor:"orderTractor",phonicTractor:"phonicTractor",pictureMeaningCocos:"pictureMeaningCocos",pictureWordMatch1:"pictureWordMatch1",pictureWordMatch2:"pictureWordMatch2",puzzleGame:"puzzleGame",questionBoard:"questionBoard",quizLiteracySentenceSentence:"quizLiteracySentenceSentence",quizLiteracySoundOnlyImage:"quizLiteracySoundOnlyImage",quizLiteracySoundOnlySentence:"quizLiteracySoundOnlySentence",quizLiteracySoundOnlyWord:"quizLiteracySoundonlyWord",quizLiteracyAndShapes1:"quizLiteracyAndShapes1",quizLiteracyImageWithText:"quizLiteracyImageWithText",quizliteracyImageWord:"quizliteracyImageWord",quizMathBiggerAndSmaller:"quizMathBiggerAndSmaller",quizMathBiggestAndSmallest:"quizMathBiggestAndSmallest",quizmathCustomNumberMagnitude:"quizmathCustomNumberMagnitude",quizMathHowMany:"quizMathHowMany",quizmathMissingnumberDrag:"quizmathMissingnumberDrag",quizMathNumberIdentification:"quizMathNumberIdentification",quizMathOperationWithobjects:"quizMathOperationWithobjects",quizMathoperationWithoutObjects:"quizMathoperationWithoutObjects",quizMathRecognizeNumber:"quizMathRecognizeNumber",quizMathShapes:"quizMathShapes",reorder:"reorder",rocketGame:"rocketGame",rowBlock:"rowBlock",sequenceBox1:"sequenceBox1",shapeTractor:"shapeTractor",spellDoor:"spellDoor",storyMaking:"storyMaking",storyTale:"storyTale",sumTogether:"sumTogether",tag:"tag",total:"total",writeCard:"writeCard",writeLetter:"writeLetter",writeNumber:"writeNumber",writeSet:"writeSet",writeWord:"writeWord",numberIdentification:"numberIdentification",wordBuildingWithAndWithoutImage:"wordBuildingWithAndWithoutImage",subsWithAndWithoutImage:"subsWithAndWithoutImage",sentenceMatchTemplate:"sentenceMatch",pictureClues:"pictureClues",palEgmaCalculateSumAndSumTogether:"palEgmaCalculateSumAndSumTogether",palEgmaPatternMatching:"palEgmaPatternMatchingAudio",palEgmaWordProblem:"palEgmaWordProblem",palEgraArrangePictures:"palEgraArrangePicturesAudio",palEgraBuildWord:"palEgraBuildWordAudio",palEgraMCQWithImage:"palEgraMCQWithImage",palEgraOddOneOut:"palEgraOddOneOutAudio",palEgraOptionWithAudio:"palEgraOptionWithAudio",palEgraWordFormation:"palEgraWordFormationAudio",palEgraWordMatch:"palEgraWordMatch",substractionWithImage:"substractionWithImageAudio",substractionWithoutImage:"substractionWithoutImageAudio",numberIdentificationWithImage:"numberIdentificationWithImageAudio",numberIdentificationWithoutImage:"numberIdentificationWithoutImageAudio",wordBuildingWithImage:"wordBuildingWithImageAudio",wordBuildingWithoutImage:"wordBuildingWithoutImageAudio",pictureWordMatchMultipleImages:"pictureWordMatchMultipleImagesAudio",pictureWordMatchSingleImage:"pictureWordMatchSingleImageAudio",sentenceMatch:"sentenceMatchAudio",imageMatch:"imageMatchAudio",palStoryTale:"palStoryTaleAudio",palEgmaWordProblemDragnDrop:"palEgmaWordProblemDragnDropAudio",palEgmaWordProblemClick:"palEgmaWordProblemClickAudio",palInventedSpelling:"palInventedSpellingAudio",palLetterIdentification:"palLetterIdentificationAudio",palStoryMaking:"palStoryMakingAudio",palegmasumtogether:"palegmasumtogetherAudio",palegmamultioption:"palegmamultioptionAudio",palegraoptionaudio:"palegraoptionAudio",palegrawordmatch:"palegrawordmatchAudio",palegramcqimages:"palegramcqimagesAudio",drawShape:"drawshape",drawshape:"drawshape"}[this.templateId])&&void 0!==t?t:"";const e=document.querySelector("lido-home");if(!e)return;const i=e.getAttribute(o)||"";this.speakFlag=i.includes(this.templateId),this.speakFlag||e.setAttribute(o,[i,this.templateId].filter(Boolean).join(","))}resolveLanguage(){var t,e;const i=this.el.closest("lido-root"),a=(null==i?void 0:i.Lang)||"";if(null==a?void 0:a.trim())return a;if(null===(t=this.Lang)||void 0===t?void 0:t.trim())return this.Lang;const o=this.el.getAttribute("Lang");return(null==o?void 0:o.trim())?o:null===(e=this.el.textContent)||void 0===e?void 0:e.trim()}convertToPixels(t,e=document.body){if(!t)return 0;if(t.endsWith("px"))return parseFloat(t);const i=document.createElement("div");i.style.position="absolute",i.style.visibility="hidden",i.style.height=t,e.appendChild(i);const a=i.offsetHeight;return e.removeChild(i),a}scaleContainer(t){const e=this.getClosestParentWithWidth();let i=0;e&&(i=Math.min(e.clientWidth/1600,e.clientHeight/900)),t.style.transform=`translate(-50%, -50%) scale(${0!=i?i:n()})`,t.style.left="50%",t.style.top="50%",t.style.position="absolute",this.screenOrientation()}getClosestParentWithWidth(){let t=this.el.parentElement;for(;t;){if(t.offsetWidth>0)return t;t=t.parentElement}return null}screenOrientation(){window.innerHeight>window.innerWidth?(this.el.style.height="1600px",this.el.style.width="900px"):(this.el.style.height="900px",this.el.style.width="1600px")}updateChildTextLanguage(t){const e=t||m.language||"en";m.changeLanguage(e),this.el.querySelectorAll("lido-text").forEach((t=>{t.Lang=e,t.dispatchEvent(new CustomEvent("languageChanged",{bubbles:!0}))}))}componentDidLoad(){this.scaleContainer(this.el);const t=this.bgImage?r(this.bgImage):"",e=this.el.closest("lido-standalone"),i="true"===(null==e?void 0:e.getAttribute("bg-image"))?e:document.body;if(i.style.backgroundColor=this.bgColor,i.style.backgroundImage=t?`url(${t})`:"none",i.style.backgroundPosition=t?"bottom":"none",document.body.style.pointerEvents="auto",window.addEventListener("resize",this.handleWindowResize),window.addEventListener("load",this.handleWindowLoad),this.templateId?setTimeout((()=>{this.el.setAttribute("onEntry",`${this.templateId}.speak='${!this.speakFlag}'; `+this.el.getAttribute("onEntry")),s(this.el,this.type)}),100):s(this.el,this.type),this.customStyle){const t=document.createElement("style");t.innerHTML=this.customStyle,document.head.appendChild(t)}const a=this.resolveLanguage();this.updateChildTextLanguage(a),setTimeout((()=>{l()}),100),c(),u.getI().start()}disconnectedCallback(){this.cleanupInteractionHandlers(),window.removeEventListener("resize",this.handleWindowResize),window.removeEventListener("load",this.handleWindowLoad),document.body.style.backgroundColor="",document.body.style.backgroundImage="",c(),u.getI().stop()}render(){return h(d,{key:"1862e30fedda58726edc107f81fae1f63e96d009",id:"lido-container",Lang:this.Lang,"tab-index":0,class:"lido-container",objective:this.objective,baseUrl:this.baseUrl,style:{backgroundColor:this.bgColor,position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",margin:this.margin,userSelect:"none"},"aria-label":this.ariaLabel,"aria-hidden":this.ariaHidden,onTouch:this.onTouch,onInCorrect:this.onInCorrect,onCorrect:this.onCorrect,onEntry:this.onEntry,"show-check":`${this.showCheck}`,"is-continue-on-correct":`${this.isContinueOnCorrect}`,"is-allow-only-correct":`${this.isAllowOnlyCorrect}`,canplay:`${this.canplay}`,appendToDropOnCompletion:`${this.appendToDropOnCompletion}`,"show-prev-button":`${this.showPrevButton}`,"show-next-button":`${this.showNextButton}`,"show-drop-border":`${this.showDropBorder}`,"bg-image":this.bgImage,"exit-button-url":this.exitButtonUrl,"prev-button-url":this.prevButtonUrl,"next-button-url":this.nextButtonUrl,"speaker-button-url":this.speakerButtonUrl,"disable-speak":`${this.disableSpeak}`,"template-id":this.templateId,audio:this.audio,"highlight-word-by-word":`${this.highlightWordByWord}`},h("lido-text",{key:"86fd014a61ba9cba6d67e2d921b2d8a8a289dbc7",visible:"false",id:this.templateId,audio:"",string:this.instructName}),h("slot",{key:"c3128ea2164892757b32cb076d717436947f9a4c"}))}get el(){return this}static get watchers(){return{Lang:[{languageChanged:0}]}}static get style(){return".lido-container{position:relative;height:100%;width:100%;background-color:var(--bgColor, transparent);display:flex;flex-direction:column;justify-content:center;align-items:center}"}},[260,"lido-container",{Lang:[1,"lang"],showDropBorder:[4,"show-drop-border"],appendToDropOnCompletion:[4,"append-to-drop-on-completion"],id:[1],objective:[1],customStyle:[1,"custom-style"],value:[1],height:[1],width:[1],ariaLabel:[1,"aria-label"],ariaHidden:[1,"aria-hidden"],x:[1],y:[1],z:[1],bgColor:[1,"bg-color"],bgImage:[1,"bg-image"],type:[1],tabIndex:[2,"tab-index"],visible:[4],audio:[1],onTouch:[1,"on-touch"],onInCorrect:[1,"on-in-correct"],onCorrect:[1,"on-correct"],onEntry:[1,"on-entry"],canplay:[4],showCheck:[4,"show-check"],isContinueOnCorrect:[4,"is-continue-on-correct"],isAllowOnlyCorrect:[4,"is-allow-only-correct"],baseUrl:[1,"base-url"],margin:[1],exitButtonUrl:[1,"exit-button-url"],prevButtonUrl:[1,"prev-button-url"],nextButtonUrl:[1,"next-button-url"],speakerButtonUrl:[1,"speaker-button-url"],showPrevButton:[1,"show-prev-button"],showNextButton:[1,"show-next-button"],delayVisible:[1,"delay-visible"],disableSpeak:[4,"disable-speak"],templateId:[1,"template-id"],highlightWordByWord:[4,"highlight-word-by-word"],instructName:[32],speakFlag:[32]},void 0,{Lang:[{languageChanged:0}]}]);function b(){"undefined"!=typeof customElements&&["lido-container","lido-text"].forEach((e=>{switch(e){case"lido-container":customElements.get(t(e))||customElements.define(t(e),p);break;case"lido-text":customElements.get(t(e))||g()}}))}b();export{p as L,b as d}
|
|
1
|
+
import{t,p as e,H as i,L as a,T as o,n,c as r,i as s,o as l,q as u,h,b as d,r as c}from"./index.js";import{d as g,i as m}from"./p-CIbBOu51.js";const p=e(class extends i{constructor(t){super(),!1!==t&&this.__registerHost(),this.Lang="",this.showDropBorder=!0,this.appendToDropOnCompletion=!1,this.id="",this.objective="",this.customStyle="",this.value="",this.height="auto",this.width="auto",this.ariaLabel="auto",this.ariaHidden="",this.x="0px",this.y="0px",this.z="0",this.bgColor="",this.bgImage="",this.type="",this.tabIndex=0,this.visible=!1,this.audio="",this.onTouch="",this.onInCorrect="",this.onCorrect="",this.onEntry="",this.canplay=!0,this.showCheck=!1,this.isContinueOnCorrect=!1,this.isAllowOnlyCorrect=!1,this.baseUrl="",this.margin="",this.showPrevButton="false",this.showNextButton="false",this.delayVisible="",this.disableSpeak=!1,this.templateId="",this.highlightWordByWord=!1,this.instructName="",this.speakFlag=!1,this.handleWindowResize=()=>this.scaleContainer(this.el),this.handleWindowLoad=()=>this.scaleContainer(this.el)}cleanupInteractionHandlers(){this.el.querySelectorAll('[type="drag"], [type="slide"], [move="true"]').forEach((t=>{t.dispatchEvent(new Event(a))}))}languageChanged(t){const e=t||this.resolveLanguage();this.updateChildTextLanguage(e)}componentWillLoad(){const t=this.resolveLanguage();this.updateChildTextLanguage(t),this.resolveInstructionAudio()}resolveInstructionAudio(){var t;this.instructName=null!==(t={flashcard:"instruction.flashcards",mcq:"instruction.mcq",tracing:"instruction.tracing",dragAndDrop:"instruction.dragAndDrop",arrangeLetters:"arrangeLetters",balancing:"balancing",balloonPop:"balloonPop",blender:"blender",bubbleType:"bubbleType",calculator:"calculator",categorize:"categorize",checkerBlocks:"checkerBlocks",createSentence:"createSentence",fillAnswer:"fillAnswer",fillBlank:"fillBlank",fillUp:"fillUp",flashcardtemplate:"flashcard",foodJar:"foodJar",grid:"grid",imageMatchWithQuestionImageAndMultiOption:"imageMatchWithQuestionImageAndMultiOption",inventedSpelling:"inventedSpelling",jumpSentence:"jumpSentence",letterBoard:"letterBoard",letterIdentification:"letterIdentification",letterPairing:"letterPairing",makeSentence:"makeSentence",matchingCard:"matchingCard",multiplyBeeds:"multiplyBeeds",nimbleTable:"nimbleTable",numberBoardOneTwo:"numberBoardOneTwo",numberPair:"numberPair",openWindow:"openWindow",orderTractor:"orderTractor",phonicTractor:"phonicTractor",pictureMeaningCocos:"pictureMeaningCocos",pictureWordMatch1:"pictureWordMatch1",pictureWordMatch2:"pictureWordMatch2",puzzleGame:"puzzleGame",questionBoard:"questionBoard",quizLiteracySentenceSentence:"quizLiteracySentenceSentence",quizLiteracySoundOnlyImage:"quizLiteracySoundOnlyImage",quizLiteracySoundOnlySentence:"quizLiteracySoundOnlySentence",quizLiteracySoundOnlyWord:"quizLiteracySoundonlyWord",quizLiteracyAndShapes1:"quizLiteracyAndShapes1",quizLiteracyImageWithText:"quizLiteracyImageWithText",quizliteracyImageWord:"quizliteracyImageWord",quizMathBiggerAndSmaller:"quizMathBiggerAndSmaller",quizMathBiggestAndSmallest:"quizMathBiggestAndSmallest",quizmathCustomNumberMagnitude:"quizmathCustomNumberMagnitude",quizMathHowMany:"quizMathHowMany",quizmathMissingnumberDrag:"quizmathMissingnumberDrag",quizMathNumberIdentification:"quizMathNumberIdentification",quizMathOperationWithobjects:"quizMathOperationWithobjects",quizMathoperationWithoutObjects:"quizMathoperationWithoutObjects",quizMathRecognizeNumber:"quizMathRecognizeNumber",quizMathShapes:"quizMathShapes",reorder:"reorder",rocketGame:"rocketGame",rowBlock:"rowBlock",sequenceBox1:"sequenceBox1",shapeTractor:"shapeTractor",spellDoor:"spellDoor",storyMaking:"storyMaking",storyTale:"storyTale",sumTogether:"sumTogether",tag:"tag",total:"total",writeCard:"writeCard",writeLetter:"writeLetter",writeNumber:"writeNumber",writeSet:"writeSet",writeWord:"writeWord",numberIdentification:"numberIdentification",wordBuildingWithAndWithoutImage:"wordBuildingWithAndWithoutImage",subsWithAndWithoutImage:"subsWithAndWithoutImage",sentenceMatchTemplate:"sentenceMatch",pictureClues:"pictureClues",palEgmaCalculateSumAndSumTogether:"palEgmaCalculateSumAndSumTogether",palEgmaPatternMatching:"palEgmaPatternMatchingAudio",palEgmaWordProblem:"palEgmaWordProblem",palEgraArrangePictures:"palEgraArrangePicturesAudio",palEgraBuildWord:"palEgraBuildWordAudio",palEgraMCQWithImage:"palEgraMCQWithImage",palEgraOddOneOut:"palEgraOddOneOutAudio",palEgraOptionWithAudio:"palEgraOptionWithAudio",palEgraWordFormation:"palEgraWordFormationAudio",palEgraWordMatch:"palEgraWordMatch",substractionWithImage:"substractionWithImageAudio",substractionWithoutImage:"substractionWithoutImageAudio",numberIdentificationWithImage:"numberIdentificationWithImageAudio",numberIdentificationWithoutImage:"numberIdentificationWithoutImageAudio",wordBuildingWithImage:"wordBuildingWithImageAudio",wordBuildingWithoutImage:"wordBuildingWithoutImageAudio",pictureWordMatchMultipleImages:"pictureWordMatchMultipleImagesAudio",pictureWordMatchSingleImage:"pictureWordMatchSingleImageAudio",sentenceMatch:"sentenceMatchAudio",imageMatch:"imageMatchAudio",palStoryTale:"palStoryTaleAudio",palEgmaWordProblemDragnDrop:"palEgmaWordProblemDragnDropAudio",palEgmaWordProblemClick:"palEgmaWordProblemClickAudio",palInventedSpelling:"palInventedSpellingAudio",palLetterIdentification:"palLetterIdentificationAudio",palStoryMaking:"palStoryMakingAudio",palegmasumtogether:"palegmasumtogetherAudio",palegmamultioption:"palegmamultioptionAudio",palegraoptionaudio:"palegraoptionAudio",palegrawordmatch:"palegrawordmatchAudio",palegramcqimages:"palegramcqimagesAudio",drawShape:"drawshape",drawshape:"drawshape"}[this.templateId])&&void 0!==t?t:"";const e=document.querySelector("lido-home");if(!e)return;const i=e.getAttribute(o)||"";this.speakFlag=i.includes(this.templateId),this.speakFlag||e.setAttribute(o,[i,this.templateId].filter(Boolean).join(","))}resolveLanguage(){var t,e;const i=this.el.closest("lido-root"),a=(null==i?void 0:i.Lang)||"";if(null==a?void 0:a.trim())return a;if(null===(t=this.Lang)||void 0===t?void 0:t.trim())return this.Lang;const o=this.el.getAttribute("Lang");return(null==o?void 0:o.trim())?o:null===(e=this.el.textContent)||void 0===e?void 0:e.trim()}convertToPixels(t,e=document.body){if(!t)return 0;if(t.endsWith("px"))return parseFloat(t);const i=document.createElement("div");i.style.position="absolute",i.style.visibility="hidden",i.style.height=t,e.appendChild(i);const a=i.offsetHeight;return e.removeChild(i),a}scaleContainer(t){const e=this.getClosestParentWithWidth();let i=0;e&&(i=Math.min(e.clientWidth/1600,e.clientHeight/900)),t.style.transform=`translate(-50%, -50%) scale(${0!=i?i:n()})`,t.style.left="50%",t.style.top="50%",t.style.position="absolute",this.screenOrientation()}getClosestParentWithWidth(){let t=this.el.parentElement;for(;t;){if(t.offsetWidth>0)return t;t=t.parentElement}return null}screenOrientation(){window.innerHeight>window.innerWidth?(this.el.style.height="1600px",this.el.style.width="900px"):(this.el.style.height="900px",this.el.style.width="1600px")}updateChildTextLanguage(t){const e=t||m.language||"en";m.changeLanguage(e),this.el.querySelectorAll("lido-text").forEach((t=>{t.Lang=e,t.dispatchEvent(new CustomEvent("languageChanged",{bubbles:!0}))}))}componentDidLoad(){this.scaleContainer(this.el);const t=this.bgImage?r(this.bgImage):"",e=this.el.closest("lido-standalone"),i="true"===(null==e?void 0:e.getAttribute("bg-image"))?e:document.body;if(i.style.backgroundColor=this.bgColor,i.style.backgroundImage=t?`url(${t})`:"none",i.style.backgroundPosition=t?"bottom":"none",document.body.style.pointerEvents="auto",window.addEventListener("resize",this.handleWindowResize),window.addEventListener("load",this.handleWindowLoad),this.templateId?setTimeout((()=>{this.el.setAttribute("onEntry",`${this.templateId}.speak='${!this.speakFlag}'; `+this.el.getAttribute("onEntry")),s(this.el,this.type)}),100):s(this.el,this.type),this.customStyle){const t=document.createElement("style");t.innerHTML=this.customStyle,document.head.appendChild(t)}const a=this.resolveLanguage();this.updateChildTextLanguage(a),setTimeout((()=>{l()}),100),c(),u.getI().start()}disconnectedCallback(){this.cleanupInteractionHandlers(),window.removeEventListener("resize",this.handleWindowResize),window.removeEventListener("load",this.handleWindowLoad),document.body.style.backgroundColor="",document.body.style.backgroundImage="",c(),u.getI().stop()}render(){return h(d,{key:"9dd374c6cdfcc88a5b18e7dc7fec527c853a4719",id:"lido-container",Lang:this.Lang,"tab-index":0,class:"lido-container",objective:this.objective,baseUrl:this.baseUrl,style:{backgroundColor:this.bgColor,position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",margin:this.margin,userSelect:"none"},"aria-label":this.ariaLabel,"aria-hidden":this.ariaHidden,onTouch:this.onTouch,onInCorrect:this.onInCorrect,onCorrect:this.onCorrect,onEntry:this.onEntry,"show-check":`${this.showCheck}`,"is-continue-on-correct":`${this.isContinueOnCorrect}`,"is-allow-only-correct":`${this.isAllowOnlyCorrect}`,canplay:`${this.canplay}`,appendToDropOnCompletion:`${this.appendToDropOnCompletion}`,"show-prev-button":`${this.showPrevButton}`,"show-next-button":`${this.showNextButton}`,"show-drop-border":`${this.showDropBorder}`,"bg-image":this.bgImage,"exit-button-url":this.exitButtonUrl,"prev-button-url":this.prevButtonUrl,"next-button-url":this.nextButtonUrl,"speaker-button-url":this.speakerButtonUrl,"disable-speak":`${this.disableSpeak}`,"template-id":this.templateId,audio:this.audio,"highlight-word-by-word":`${this.highlightWordByWord}`},h("lido-text",{key:"8295782a74ce6ef8ca9a623de8a28b539d9f6d4f",visible:"false",id:this.templateId,audio:"",string:this.instructName}),h("slot",{key:"eb3c995b777986e07dcb6aa935ef38d41aa1e7e7"}))}get el(){return this}static get watchers(){return{Lang:[{languageChanged:0}]}}static get style(){return".lido-container{position:relative;height:100%;width:100%;background-color:var(--bgColor, transparent);display:flex;flex-direction:column;justify-content:center;align-items:center}"}},[260,"lido-container",{Lang:[1,"lang"],showDropBorder:[4,"show-drop-border"],appendToDropOnCompletion:[4,"append-to-drop-on-completion"],id:[1],objective:[1],customStyle:[1,"custom-style"],value:[1],height:[1],width:[1],ariaLabel:[1,"aria-label"],ariaHidden:[1,"aria-hidden"],x:[1],y:[1],z:[1],bgColor:[1,"bg-color"],bgImage:[1,"bg-image"],type:[1],tabIndex:[2,"tab-index"],visible:[4],audio:[1],onTouch:[1,"on-touch"],onInCorrect:[1,"on-in-correct"],onCorrect:[1,"on-correct"],onEntry:[1,"on-entry"],canplay:[4],showCheck:[4,"show-check"],isContinueOnCorrect:[4,"is-continue-on-correct"],isAllowOnlyCorrect:[4,"is-allow-only-correct"],baseUrl:[1,"base-url"],margin:[1],exitButtonUrl:[1,"exit-button-url"],prevButtonUrl:[1,"prev-button-url"],nextButtonUrl:[1,"next-button-url"],speakerButtonUrl:[1,"speaker-button-url"],showPrevButton:[1,"show-prev-button"],showNextButton:[1,"show-next-button"],delayVisible:[1,"delay-visible"],disableSpeak:[4,"disable-speak"],templateId:[1,"template-id"],highlightWordByWord:[4,"highlight-word-by-word"],instructName:[32],speakFlag:[32]},void 0,{Lang:[{languageChanged:0}]}]);function b(){"undefined"!=typeof customElements&&["lido-container","lido-text"].forEach((e=>{switch(e){case"lido-container":customElements.get(t(e))||customElements.define(t(e),p);break;case"lido-text":customElements.get(t(e))||g()}}))}b();export{p as L,b as d}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t,p as i,H as e,B as s,getAssetPath as n,c as o,k as r,E as a,F as h,s as l,f as c,w as d,g as u,j as f,a as w,h as g,b as m}from"./index.js";const p=i(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.showSpeakIcon=!1,this.id="",this.svgSource="",this.svgUrls=[],this.audioUrls=[],this.currentSvgIndex=0,this.moving=!1,this.value="",this.height="auto",this.width="auto",this.audio="",this.x="0px",this.y="0px",this.z="0",this.ariaLabel="",this.ariaHidden="",this.tabIndex=0,this.mode=s.ShowFlow,this.fingerHintUrl=n("assets/Tracing-hand.svg"),this.highlightTextId="",this.animationTrace=!1,this.delayVisible="",this.disableSpeak=!1,this.style={},this.handleWindowResize=()=>this.updateStyles(),this.handleWindowLoad=()=>this.updateStyles(),this.fileIndex=-1,this.isDragging=!1,this.activePointerId=null,this.freeTraceUpdateCounter=0,this.idleTimer=null,this.fingerImg=null}async initializeSVG(){let t={fileIndex:-1,currentPathIndex:0,lastLength:0,totalPathLength:0,isDragging:!1,circle:null,paths:[],svg:null,proximityThreshold:60,freeTraceProximityThreshold:350,rafId:null,pointerMoveEvent:null,activePointerId:null,mode:this.mode,flowMarkers:[],freeTraceLines:[],currentFreePath:[],lastPointerPos:null,dragOffset:null,isCompletingPath:!1};const i=this.svgUrls[this.currentSvgIndex];i&&""!==i.trim()?(await this.fetchSVG(o(i)),await this.loadAnotherSVG(t,!0)):console.error("No SVG URL provided or index out of bounds.")}componentDidLoad(){r(this.el,this.delayVisible)}componentWillLoad(){this.updateStyles(),window.addEventListener("resize",this.handleWindowResize),window.addEventListener("load",this.handleWindowLoad),this.svgUrls=this.svgSource.split(";").map((t=>t.trim())),this.currentSvgIndex=0,this.showSpeakIcon&&(a(this.el),this.el.append(a(this.el))),this.initializeSVG()}disconnectedCallback(){window.removeEventListener("resize",this.handleWindowResize),window.removeEventListener("load",this.handleWindowLoad)}resetIdleTimer(t){null!==this.idleTimer&&(clearTimeout(this.idleTimer),this.idleTimer=null),this.idleTimer=window.setTimeout((()=>{this.showFingerHint(t)}),3e3)}showFingerHint(t){var i;if(this.fingerImg)return;const e=t.paths[t.currentPathIndex];if(!e)return;const s=document.createElementNS("http://www.w3.org/2000/svg","image"),n=new Image;n.onload=()=>{s.setAttributeNS("http://www.w3.org/1999/xlink","href",o(this.fingerHintUrl))},n.onerror=()=>{s.setAttributeNS("http://www.w3.org/1999/xlink","href",o(h))},n.src=o(this.fingerHintUrl||h),s.setAttribute("width","40"),s.setAttribute("height","40"),s.setAttribute("id","lido-finger-hint"),s.style.pointerEvents="none",s.style.opacity="0.8",s.setAttribute("x","0"),s.setAttribute("y","0");const r=document.createElementNS("http://www.w3.org/2000/svg","animateMotion");r.setAttribute("dur","2s"),r.setAttribute("repeatCount","indefinite");const a=document.createElementNS("http://www.w3.org/2000/svg","mpath");a.setAttributeNS("http://www.w3.org/1999/xlink","href",`#${e.id}`),r.appendChild(a),s.appendChild(r),null===(i=t.svg)||void 0===i||i.appendChild(s),this.fingerImg=s}hideFingerHint(){this.fingerImg&&this.fingerImg.parentNode&&this.fingerImg.parentNode.removeChild(this.fingerImg),this.fingerImg=null}async fetchSVG(t){const i=await fetch(t);if(!i.ok)throw new Error(`Failed to fetch SVG (${t}): ${i.statusText}`);return await i.text()}calculateBoundingBox(t,i=22){let e=1/0,s=1/0,n=-1/0,o=-1/0;return t.forEach((t=>{const i=t.getTotalLength();for(let r=0;r<=100;r++){const a=t.getPointAtLength(r/100*i);a.x<e&&(e=a.x),a.y<s&&(s=a.y),a.x>n&&(n=a.x),a.y>o&&(o=a.y)}})),e-=i,s-=i,n+=i,o+=i,{minX:e,minY:s,maxX:n,maxY:o}}insertSVG(t){const i=document.getElementById("lido-svgContainer");if(!i)return;i.innerHTML=t;const e=i.querySelector("svg");e.classList.add("lido-trace-svg"),e.removeAttribute("width"),e.removeAttribute("height");const s=e.querySelectorAll("path, line"),n=this.calculateBoundingBox(Array.from(s));e.setAttribute("viewBox",`${n.minX} ${n.minY} ${n.maxX-n.minX} ${n.maxY-n.minY}`)}getSVGElement(){return document.getElementById("lido-svgContainer").querySelector("svg")}getPaths(t){return Array.from(t.querySelectorAll("path, line"))}createFlowMarkersForPath(t){var i;if(!t)return;const e=t.ownerSVGElement;if(!e)return;const s=document.createElementNS("http://www.w3.org/2000/svg","path");s.setAttribute("d",t.getAttribute("d")||""),s.setAttribute("stroke","blue"),s.setAttribute("stroke-width","2"),s.setAttribute("stroke-dasharray","6,6"),s.setAttribute("fill","none"),s.setAttribute("class","lido-flow-indicator"),null===(i=t.parentNode)||void 0===i||i.appendChild(s);let n=e.querySelector("defs#lido-flow-defs");n||(n=document.createElementNS("http://www.w3.org/2000/svg","defs"),n.setAttribute("id","lido-flow-defs"),e.insertBefore(n,e.firstChild));const o=`arrow-${Math.random().toString(36)}`,r=document.createElementNS("http://www.w3.org/2000/svg","marker");r.setAttribute("id",o),r.setAttribute("markerWidth","10"),r.setAttribute("markerHeight","10"),r.setAttribute("refX","5"),r.setAttribute("refY","5"),r.setAttribute("orient","auto"),r.setAttribute("markerUnits","strokeWidth");const a=document.createElementNS("http://www.w3.org/2000/svg","path");return a.setAttribute("d","M0,0 L10,5 L0,10 L2,5 Z"),a.setAttribute("fill","blue"),r.appendChild(a),n.appendChild(r),s.setAttribute("marker-end",`url(#${o})`),s}updateFlowIndicators(t){t.svg.querySelectorAll(".lido-flow-indicator").forEach((i=>{t.mode===s.NoFlow?i.style.display="none":t.mode===s.ShowFlow&&(i.style.display="block")}))}setupDrawingPath(t){t.paths.forEach(((i,e)=>{const n=i.getTotalLength();i.setAttribute("id","lido-path-"+e);const o=i.cloneNode();o.style.opacity="100",o.style["stroke-opacity"]="100";const r=i.style["stroke-width"]||i.getAttribute("stroke-width");o.setAttribute("stroke-width",r),o.setAttribute("stroke-dasharray",n.toString()),o.setAttribute("stroke-dashoffset",n.toString()),i.parentNode.appendChild(o,i),i.setAttribute("class","lido-trace-path"),o.setAttribute("class","lido-trace-path-green"),i.greenPath=o,i.classList.add(t.mode),t.mode===s.BlindTracing||t.mode===s.BlindFreeTrace?i.setAttribute("stroke","none"):(i.setAttribute("stroke","#000"),i.setAttribute("stroke-width",r),i.setAttribute("fill","none"),i.setAttribute("stroke-dasharray",n.toString()),i.setAttribute("stroke-dashoffset","0")),e===t.currentPathIndex&&t.mode===s.ShowFlow&&(t.flowMarkers=this.createFlowMarkersForPath(i))})),t.totalPathLength=t.paths[t.currentPathIndex].getTotalLength()}setupDraggableCircle(t){var i;const e=t.paths[0].getPointAtLength(0),s=document.createElementNS("http://www.w3.org/2000/svg","circle");t.paths[t.currentPathIndex].style["stroke-width"]||t.paths[t.currentPathIndex].getAttribute("stroke-width"),s.setAttribute("id","lido-draggableCircle"),s.setAttribute("cx",e.x.toString()),s.setAttribute("cy",e.y.toString()),s.setAttribute("r","20"),s.setAttribute("fill","#CF1565"),null===(i=t.svg)||void 0===i||i.appendChild(s),t.circle=s,this.resetIdleTimer(t)}addEventListeners(t){var i,e,s,n;if(!t.circle||!t.paths||0===t.paths.length)return;t.svg.style.touchAction="none",t.circle.style.touchAction="none",t.circle.addEventListener("pointerdown",(i=>{i.preventDefault();const e=this.getPointerPosition(i,t.svg),s={x:parseFloat(t.circle.getAttribute("cx")),y:parseFloat(t.circle.getAttribute("cy"))},n=this.getDistanceSquared(e,s),o=this.getProximityThresholdForEvent(t,i);if(n<=o*o||"touch"===i.pointerType){t.isDragging=!0,t.activePointerId=i.pointerId,t.dragOffset={x:e.x-s.x,y:e.y-s.y};try{t.circle.setPointerCapture(i.pointerId)}catch(t){}t.lastPointerPos=s}this.hideFingerHint(),this.resetIdleTimer(t)}),{passive:!1}),null===(i=t.svg)||void 0===i||i.addEventListener("pointermove",(i=>{t.isDragging&&i.pointerId===t.activePointerId&&(i.preventDefault(),t.pointerMoveEvent=i,t.rafId||(t.rafId=requestAnimationFrame((()=>{this.handlePointerMove(t),t.rafId=null}))))}));const o=i=>{i.pointerId===t.activePointerId&&(t.isDragging=!1,t.activePointerId=null,t.lastPointerPos=null,t.dragOffset=null,this.hideFingerHint(),this.resetIdleTimer(t))};null===(e=t.svg)||void 0===e||e.addEventListener("pointerup",o),null===(s=t.svg)||void 0===s||s.addEventListener("pointercancel",o),null===(n=t.svg)||void 0===n||n.addEventListener("contextmenu",(t=>{t.preventDefault()}))}async handlePointerMove(t){var i,e,n,o,r,a;if(!t.isDragging)return;if(!t.circle||!t.paths||0===t.paths.length)return;if(t.isCompletingPath)return;this.hideFingerHint();const h=t.pointerMoveEvent,l=this.getPointerPosition(h,t.svg),c=t.dragOffset?{x:l.x-t.dragOffset.x,y:l.y-t.dragOffset.y}:l,d={x:parseFloat(t.circle.getAttribute("cx")),y:parseFloat(t.circle.getAttribute("cy"))};let u=1/0;if(t.lastPointerPos){const i=c.x-t.lastPointerPos.x,e=c.y-t.lastPointerPos.y;if(u=i*i+e*e,u<1)return}const f=t.paths[t.currentPathIndex];if(!f)return void console.error("No valid path found at the current index");const w=this.getProximityThresholdForEvent(t,h),g=w*w;if(this.getDistanceSquared(c,d)>g)return;const m=t.mode===s.FreeTrace||t.mode===s.BlindFreeTrace,p=this.getClosestPointOnPath(f,c,m?void 0:t.lastLength);if(this.getDistanceSquared(c,p)>g)return;if(m){if(this.freeTraceUpdateCounter=(this.freeTraceUpdateCounter||0)+1,this.freeTraceUpdateCounter%2!=0)return;if(t.currentFreePath||(t.currentFreePath=[]),!t.currentFreePath[t.currentPathIndex]){const e=document.createElementNS("http://www.w3.org/2000/svg","polyline"),s=t.paths[t.currentPathIndex].style["stroke-width"]||t.paths[t.currentPathIndex].getAttribute("stroke-width");e.setAttribute("stroke-width",s),e.setAttribute("fill","none"),e.setAttribute("stroke-linecap","round"),e.setAttribute("stroke","lightgreen"),e.setAttribute("points",`${c.x},${c.y}`),null===(i=t.svg)||void 0===i||i.appendChild(e),t.currentFreePath[t.currentPathIndex]=e,t.currentFreePolylinePoints=t.currentFreePolylinePoints||[],t.currentFreePolylinePoints[t.currentPathIndex]=[{x:c.x,y:c.y}],t.lastPointerPos=c,t.freeTracePointsCount=1}const s=10;if(t.freeTracePointsCount=(t.freeTracePointsCount||1)+1,t.freeTracePointsCount>s)return;t.currentFreePolylinePoints=t.currentFreePolylinePoints||[];let o=t.currentFreePolylinePoints[t.currentPathIndex]||[];o.push({x:c.x,y:c.y}),t.currentFreePolylinePoints[t.currentPathIndex]=o;const r=o.map((t=>`${t.x},${t.y}`)).join(" ");t.currentFreePath[t.currentPathIndex].setAttribute("points",r),t.circle.setAttribute("cx",c.x.toString()),t.circle.setAttribute("cy",c.y.toString());const a=null===(e=t.svg)||void 0===e?void 0:e.childNodes;let h=!1;for(let t=0;t<((null==a?void 0:a.length)||0);t++){const i=null==a?void 0:a.item(t);if(i&&"circle"===i.tagName){h=!0;break}}return!h&&t.circle&&(null===(n=t.svg)||void 0===n||n.appendChild(t.circle)),t.lastPointerPos=c,void(o.length>=s&&(this.moveToNextPath(t),t.currentFreePath[t.currentPathIndex]=null,t.currentFreePolylinePoints[t.currentPathIndex]=[],t.freeTracePointsCount=0))}const v=Math.min(320,Math.max(160,.45*t.totalPathLength)),x=Math.min(60,Math.max(24,.12*t.totalPathLength));let y=p,k=y.length>=t.lastLength-20&&y.length-t.lastLength<=80;if(!k){const i=this.getClosestPointOnPath(f,c),e=this.getDistanceSquared(c,i);u>=64&&e<=g&&i.length>=t.lastLength-20&&i.length-t.lastLength<=v&&i.length<t.totalPathLength-x&&(y=i,k=!0)}if(t.isDragging&&k){t.lastLength=Math.max(t.lastLength,y.length),t.lastPointerPos=c,(Math.abs(y.x-d.x)>1||Math.abs(y.y-d.y)>1)&&(t.circle.setAttribute("cx",y.x.toString()),t.circle.setAttribute("cy",y.y.toString()));const i=null===(o=t.svg)||void 0===o?void 0:o.childNodes;let e=!1;for(let t=0;t<((null==i?void 0:i.length)||0);t++){const s=null==i?void 0:i.item(t);if(s&&"circle"===s.tagName){e=!0;break}}!e&&t.circle&&(null===(r=t.svg)||void 0===r||r.appendChild(t.circle)),null===(a=f.greenPath)||void 0===a||a.setAttribute("stroke-dashoffset",(t.totalPathLength-t.lastLength).toString());const s=.95;let n=t.lastLength/t.totalPathLength,h=f.getPointAtLength(0),l=f.getPointAtLength(f.getTotalLength());if(this.getDistanceSquared(h,l)<200&&t.totalPathLength>50){if(n>=s){if(t.isCompletingPath)return;t.isCompletingPath=!0,await this.animatePathToEnd(t,f),t.currentPathIndex<t.paths.length-1?this.moveToNextPath(t):t.currentPathIndex===t.paths.length-1&&this.moveToNextContainer()}}else if(t.totalPathLength-1-t.lastLength<5&&t.currentPathIndex<t.paths.length-1){if(t.isCompletingPath)return;t.isCompletingPath=!0,this.moveToNextPath(t)}else if(t.totalPathLength-1-t.lastLength<5&&t.currentPathIndex===t.paths.length-1){if(t.isCompletingPath)return;t.isCompletingPath=!0,this.moveToNextContainer()}}}animatePathToEnd(t,i,e=300){if(!i||!t.svg)return Promise.resolve();if(t._animatingToEnd)return Promise.resolve();t._animatingToEnd=!0;const s=t.lastLength||0,n=i.getTotalLength(),o=performance.now(),r=i.greenPath||i.parentNode&&i.parentNode.querySelector(".lido-trace-path-green");return new Promise((a=>{const h=l=>{const c=Math.min(1,(l-o)/e),d=s+(n-s)*c;t.lastLength=d;const u=i.getPointAtLength(d);if(t.circle&&(t.circle.setAttribute("cx",u.x.toString()),t.circle.setAttribute("cy",u.y.toString())),r&&r.setAttribute("stroke-dashoffset",(t.totalPathLength-d).toString()),c<1)requestAnimationFrame(h);else{if(t.lastLength=n,t.circle){const e=i.getPointAtLength(n);t.circle.setAttribute("cx",e.x.toString()),t.circle.setAttribute("cy",e.y.toString())}r&&r.setAttribute("stroke-dashoffset","0"),t._animatingToEnd=!1,a()}};requestAnimationFrame(h)}))}async moveToNextContainer(){if(this.isDragging=!1,this.moving)return;if(this.moving=!0,this.highlightTextId&&this.highlightLetter(this.currentSvgIndex),this.animationTrace&&await this.playTraceAnimation(),l(!0),this.currentSvgIndex<this.svgUrls.length-1)return await new Promise((t=>setTimeout(t,1e3))),this.currentSvgIndex++,await this.initializeSVG(),document.getElementById("lido-svgContainer").style.visibility="visible",this.moving=!1,void(this.el&&this.onCorrect&&await c(this.onCorrect,this.el));const t=document.querySelector(d),i=t.getAttribute("onCorrect");t&&i&&(await new Promise((t=>setTimeout(t,1e3))),await c(i,this.el)),u(),f()}getPointerPosition(t,i){var e;const s=this.getPointerPositionFromViewBox(t,i);if(s)return s;const n=i.createSVGPoint();n.x=t.clientX,n.y=t.clientY;const o=null===(e=i.getScreenCTM())||void 0===e?void 0:e.inverse();return o?n.matrixTransform(o):{x:t.clientX,y:t.clientY}}getPointerPositionFromViewBox(t,i){const e=i.getBoundingClientRect(),s=i.viewBox.baseVal;if(!(e.width&&e.height&&s.width&&s.height))return null;const{offsetX:n,offsetY:o,scaleX:r,scaleY:a}=this.getSvgViewBoxTransform(i,e);return{x:s.x+(t.clientX-e.left-n)/r,y:s.y+(t.clientY-e.top-o)/a}}getSvgViewBoxTransform(t,i=t.getBoundingClientRect()){const e=t.viewBox.baseVal,s=t.preserveAspectRatio.baseVal,n=i.width/e.width,o=i.height/e.height;if(1===s.align)return{offsetX:0,offsetY:0,scaleX:n,scaleY:o};const r=2===s.meetOrSlice?Math.max(n,o):Math.min(n,o),a=e.width*r,h=e.height*r;let l=0,c=0;const d=s.align;return 3===d||6===d||9===d?l=(i.width-a)/2:4!==d&&7!==d&&10!==d||(l=i.width-a),5===d||6===d||7===d?c=(i.height-h)/2:8!==d&&9!==d&&10!==d||(c=i.height-h),{offsetX:l,offsetY:c,scaleX:r,scaleY:r}}getProximityThresholdForEvent(t,i){const e=t.mode===s.FreeTrace||t.mode===s.BlindFreeTrace?t.freeTraceProximityThreshold:t.proximityThreshold;if("touch"!==(null==i?void 0:i.pointerType)||!t.svg)return e;const n=t.svg.getBoundingClientRect(),o=t.svg.viewBox.baseVal;if(!(n.width&&n.height&&o.width&&o.height))return e;const{scaleX:r,scaleY:a}=this.getSvgViewBoxTransform(t.svg,n),h=44*Math.max(1/r,1/a);return Math.max(e,h)}getDistanceSquared(t,i){const e=t.x-i.x,s=t.y-i.y;return e*e+s*s}getClosestPointOnPath(t,i,e){const s=t.getTotalLength();let n={x:0,y:0,length:0},o=1/0,r=0,a=s;void 0!==e&&(r=Math.max(0,e-150),a=Math.min(s,e+150));let h={length:r};for(let e=r;e<=a;e+=40){const s=t.getPointAtLength(e),n=this.getDistanceSquared(i,s);n<o&&(o=n,h={x:s.x,y:s.y,length:e})}const l=Math.max(0,h.length-40),c=Math.min(s,h.length+40);o=1/0;for(let e=l;e<=c;e+=6){const s=t.getPointAtLength(e),r=this.getDistanceSquared(i,s);r<o&&(o=r,n={x:s.x,y:s.y,length:e})}return n}async loadAnotherSVG(t,i){t.isDragging=!1;try{t.svg&&this.cleanupPreviousSVG(t);const i=await this.fetchSVG(o(this.svgSource.split(";").map((t=>t.trim()))[this.currentSvgIndex]));this.insertSVG(i),t.svg=this.getSVGElement(),this.mode!==s.BlindTracing&&this.mode!==s.BlindFreeTrace||t.svg.querySelectorAll("image").forEach((t=>{t.style.display="none"})),t.paths=this.getPaths(t.svg),this.setupDrawingPath(t),this.setupDraggableCircle(t),this.addEventListeners(t)}catch(t){console.error(`Error loading SVG (${this.svgSource}):`,t)}}cleanupPreviousSVG(t){var i,e;t.circle&&(null===(i=t.svg)||void 0===i||i.removeChild(t.circle),t.circle=null),(null===(e=t.svg)||void 0===e?void 0:e.querySelectorAll(".lido-flow-indicator")).forEach((t=>{t.remove()})),t.currentPathIndex=0,t.lastLength=0,t.totalPathLength=t.paths[0].getTotalLength(),this.hideFingerHint(),this.resetIdleTimer(t)}async moveToNextPath(t){var i,e;if(t.isDragging=!1,t.currentPathIndex++,t.lastLength=0,t.isCompletingPath=!1,this.hideFingerHint(),t.currentPathIndex>=t.paths.length)return void this.moveToNextContainer();const n=t.paths[t.currentPathIndex];if(!n)return void console.error("No valid path found at the next index");t.totalPathLength=n.getTotalLength();const o=n.getPointAtLength(0);null===(i=t.circle)||void 0===i||i.setAttribute("cx",o.x.toString()),null===(e=t.circle)||void 0===e||e.setAttribute("cy",o.y.toString()),t.mode===s.ShowFlow&&(t.flowMarkers=this.createFlowMarkersForPath(n)),this.resetIdleTimer(t)}async playTraceAnimation(){const t=document.getElementById(this.id);t&&(t.classList.add("trace-animate"),await new Promise((t=>setTimeout(t,500))),t.classList.remove("trace-animate"))}async highlightLetter(t){if(!document.getElementById(d))return;const i=this.el;if(!i)return;const e=this.highlightTextId;if(!e)return;const s=document.getElementById(e);if(!s)return;const n=this.audio;if(!n)return;this.audioUrls=n.split(";").map((t=>t.trim()));const r=s.getAttribute("span-type");if(!r)return;const a=s.querySelector(".lido-text-content");if(a){if("letters"===r){const e=a.querySelectorAll(".text-letters");if(t<0||t>=e.length)return;const n=e[t];if(n){const t=i.querySelector("#lido-svgContainer");if(await c("this.alignMatch='true';",s,t),t.style.animation="trace-animation 0.4s forwards",t.style.setProperty("--trace-width",n.offsetWidth-5+"px"),t.style.setProperty("--trace-height",n.offsetHeight-5+"px"),await c("this.alignMatch='true';",n,t),setTimeout((()=>{n.classList.add("letter-highlight"),t.style.transform="",t.style.animation="",t.style.visibility="hidden"}),500),this.audioUrls[this.currentSvgIndex]){const t=new Audio(o(this.audioUrls[this.currentSvgIndex]));await t.play()}}}if("words"===r){const i=a.querySelectorAll(".text-words");if(t<0||t>=i.length)return;const e=i[t];if(e&&(e.classList.add("word-highlight"),this.audioUrls[this.currentSvgIndex])){const t=new Audio(o(this.audioUrls[this.currentSvgIndex]));await t.play()}}}}updateStyles(){const t=window.innerHeight>window.innerWidth?"portrait":"landscape";this.style={height:w(this.height,t),width:w(this.width,t),top:w(this.y,t),left:w(this.x,t),zIndex:this.z}}render(){return g(m,{key:"0877050db2c93ff5ca0795ea8a209e2bb2c3e1b3",class:"lido-trace",id:this.id,audio:this.audio,onCorrect:this.onCorrect,onInCorrect:this.onInCorrect,style:this.style,"aria-label":this.ariaLabel,"aria-hidden":this.ariaHidden,tabindex:this.tabIndex,"disable-speak":this.disableSpeak},g("div",{key:"c0fa2b7c825a4bbbb3b0a95cc700a6f01b873943",style:this.style,id:"lido-svgContainer"}))}static get assetsDirs(){return["assets"]}get el(){return this}static get watchers(){return{svgSource:[{initializeSVG:0}],mode:[{initializeSVG:0}]}}static get style(){return":host{display:block;position:relative}#lido-svgContainer{display:flex;justify-content:center;align-items:center;overflow:hidden}.lido-trace-svg{width:100%;height:100%;touch-action:none}#lido-draggableCircle{cursor:pointer;fill:#CF1565;transition:fill 0.2s, r 0.2s}.lido-blindTracing{stroke:none !important}.lido-blindFreeTrace{stroke:none !important}.lido-hovered{cursor:grab;fill:darkred}#lido-controls{position:fixed;bottom:0;left:0;right:0;display:flex;justify-content:space-between;padding:10px;background-color:#f0f0f0;border-top:1px solid #ccc}button{padding:10px;font-size:16px}@media (max-width: 600px){button{padding:8px;font-size:14px}}.lido-trace-path-green{}.lido-flow-indicator{stroke:blue;stroke-width:2;stroke-dasharray:6, 6;fill:none}.lido-trace{height:700px;width:700px;z-index:1;justify-items:center;align-content:center}.trace-animate{animation:trace-bounce 0.5s}@keyframes trace-bounce{0%{transform:scale(1)}30%{transform:scale(1.05)}60%{transform:scale(0.95)}100%{transform:scale(1)}}"}},[0,"lido-trace",{showSpeakIcon:[4,"show-speak-icon"],id:[1],svgSource:[1,"svg-source"],value:[1],height:[1],width:[1],audio:[1],x:[1],y:[1],z:[1],ariaLabel:[1,"aria-label"],ariaHidden:[1,"aria-hidden"],tabIndex:[2,"tab-index"],mode:[1],fingerHintUrl:[1,"finger-hint-url"],onInCorrect:[1,"on-in-correct"],onCorrect:[1,"on-correct"],highlightTextId:[1,"highlight-text-id"],animationTrace:[4,"animation-trace"],delayVisible:[1,"delay-visible"],disableSpeak:[4,"disable-speak"],svgUrls:[32],audioUrls:[32],currentSvgIndex:[32],moving:[32],style:[32],fileIndex:[32],isDragging:[32],activePointerId:[32],freeTraceUpdateCounter:[32],idleTimer:[32],fingerImg:[32]},void 0,{svgSource:[{initializeSVG:0}],mode:[{initializeSVG:0}]}]);function v(){"undefined"!=typeof customElements&&["lido-trace"].forEach((i=>{"lido-trace"===i&&(customElements.get(t(i))||customElements.define(t(i),p))}))}v();export{p as L,v as d}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as getAssetPath } from './index-Dnvog_Mm.js';
|
|
2
2
|
|
|
3
3
|
const DragMapKey = 'lidoDragMap';
|
|
4
4
|
const SelectedValuesKey = 'lidoSelectedValues';
|
|
5
|
+
const AnimationVanishedValuesKey = 'data-animation-vanished-values';
|
|
5
6
|
const ActivityScoreKey = 'lidoActivityScore';
|
|
6
7
|
const ActivityEndKey = 'lidoActivityEnd';
|
|
7
8
|
const LessonEndKey = 'lidoLessonEnd';
|
|
@@ -258,11 +259,20 @@ function balanceResult(container, objectiveString) {
|
|
|
258
259
|
return res;
|
|
259
260
|
}
|
|
260
261
|
|
|
261
|
-
const
|
|
262
|
+
const readVanishedValues = (container) => {
|
|
263
|
+
var _a;
|
|
264
|
+
try {
|
|
265
|
+
const values = JSON.parse((_a = container.getAttribute(AnimationVanishedValuesKey)) !== null && _a !== void 0 ? _a : '[]');
|
|
266
|
+
return Array.isArray(values) ? values : [];
|
|
267
|
+
}
|
|
268
|
+
catch (_b) {
|
|
269
|
+
return [];
|
|
270
|
+
}
|
|
271
|
+
};
|
|
262
272
|
function dragDropAnimation(container, dragElement, dropElement) {
|
|
263
273
|
container.style.pointerEvents = "none";
|
|
264
274
|
setTimeout(async () => {
|
|
265
|
-
var _a, _b
|
|
275
|
+
var _a, _b;
|
|
266
276
|
const div = document.createElement('div');
|
|
267
277
|
container.append(div);
|
|
268
278
|
div.classList.add('after-drop-popup-container');
|
|
@@ -271,10 +281,11 @@ function dragDropAnimation(container, dragElement, dropElement) {
|
|
|
271
281
|
const allDragElements = container.querySelectorAll('[type="drag"]');
|
|
272
282
|
const dragParents = Array.from(allDragElements).map(el => el.parentElement);
|
|
273
283
|
const allSameParent = dragParents.every(parent => parent === dragElement.parentElement);
|
|
274
|
-
|
|
275
|
-
const vanishedValue = (
|
|
284
|
+
const vanishedValues = readVanishedValues(container);
|
|
285
|
+
const vanishedValue = (_a = dragElement.getAttribute('value')) !== null && _a !== void 0 ? _a : (_b = dragElement.textContent) === null || _b === void 0 ? void 0 : _b.trim();
|
|
276
286
|
if (vanishedValue) {
|
|
277
|
-
|
|
287
|
+
vanishedValues.push(vanishedValue);
|
|
288
|
+
container.setAttribute(AnimationVanishedValuesKey, JSON.stringify(vanishedValues));
|
|
278
289
|
}
|
|
279
290
|
// Remove from old parents
|
|
280
291
|
if (allSameParent) {
|
|
@@ -292,9 +303,10 @@ function dragDropAnimation(container, dragElement, dropElement) {
|
|
|
292
303
|
div.appendChild(dropElement);
|
|
293
304
|
dropElement.classList.remove('empty');
|
|
294
305
|
const objective = container.getAttribute('objective');
|
|
306
|
+
const normalizedVanishedValues = vanishedValues.map(v => v.trim()).sort().join(',');
|
|
307
|
+
const normalizedObjective = objective === null || objective === void 0 ? void 0 : objective.split(',').map(v => v.trim()).sort().join(',');
|
|
295
308
|
const isObjectiveComplete = !!objective &&
|
|
296
|
-
|
|
297
|
-
objective.split(',').map(v => v.trim()).sort().join(',');
|
|
309
|
+
normalizedVanishedValues === normalizedObjective;
|
|
298
310
|
if (dropElement.getAttribute('type') === 'drop') {
|
|
299
311
|
const dropOnCorrect = dropElement.getAttribute('onCorrect') || '';
|
|
300
312
|
await executeActions(dropOnCorrect, dropElement, dragElement);
|
|
@@ -307,15 +319,22 @@ function dragDropAnimation(container, dragElement, dropElement) {
|
|
|
307
319
|
dropElement.classList.remove('zoom-fade-in');
|
|
308
320
|
dragElement.classList.add('zoom-fade-out');
|
|
309
321
|
dropElement.classList.add('zoom-fade-out');
|
|
310
|
-
|
|
322
|
+
const cleanup = () => {
|
|
311
323
|
div.remove();
|
|
312
324
|
container.style.pointerEvents = 'auto';
|
|
313
325
|
if (isObjectiveComplete) {
|
|
314
326
|
calculateScore();
|
|
315
327
|
triggerNextContainer();
|
|
316
|
-
|
|
328
|
+
container.removeAttribute(AnimationVanishedValuesKey);
|
|
317
329
|
}
|
|
318
|
-
}
|
|
330
|
+
};
|
|
331
|
+
const templateId = (container.getAttribute('template-id') || '').toLowerCase();
|
|
332
|
+
if (templateId === 'letterpairing' || templateId === 'numberpair') {
|
|
333
|
+
cleanup();
|
|
334
|
+
}
|
|
335
|
+
else {
|
|
336
|
+
setTimeout(cleanup, 800); // match animation duration
|
|
337
|
+
}
|
|
319
338
|
}, 250);
|
|
320
339
|
}
|
|
321
340
|
|
|
@@ -1138,14 +1157,14 @@ async function onClickDropOrDragElement(element, type) {
|
|
|
1138
1157
|
if (!document.querySelector('#dynamic-highlight-style')) {
|
|
1139
1158
|
const style = document.createElement('style');
|
|
1140
1159
|
style.id = 'dynamic-highlight-style';
|
|
1141
|
-
style.innerHTML = `
|
|
1142
|
-
.highlight {
|
|
1143
|
-
// border: 4px solid #e74c3c; /* Thicker red border for more visibility */
|
|
1144
|
-
// border-radius: 12px; /* Larger rounded corners */
|
|
1145
|
-
// background-color: rgba(231, 76, 60, 0.3); /* Stronger, more noticeable background */
|
|
1146
|
-
// box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2), 0 12px 40px rgba(0, 0, 0, 0.2); /* Stronger shadow */
|
|
1147
|
-
// outline: 4px solid rgba(231, 76, 60, 0.6); /* Glow effect */
|
|
1148
|
-
}
|
|
1160
|
+
style.innerHTML = `
|
|
1161
|
+
.highlight {
|
|
1162
|
+
// border: 4px solid #e74c3c; /* Thicker red border for more visibility */
|
|
1163
|
+
// border-radius: 12px; /* Larger rounded corners */
|
|
1164
|
+
// background-color: rgba(231, 76, 60, 0.3); /* Stronger, more noticeable background */
|
|
1165
|
+
// box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2), 0 12px 40px rgba(0, 0, 0, 0.2); /* Stronger shadow */
|
|
1166
|
+
// outline: 4px solid rgba(231, 76, 60, 0.6); /* Glow effect */
|
|
1167
|
+
}
|
|
1149
1168
|
`;
|
|
1150
1169
|
document.head.appendChild(style);
|
|
1151
1170
|
}
|
|
@@ -1333,34 +1352,34 @@ function highlightSpeakingElement(element) {
|
|
|
1333
1352
|
if (!document.getElementById(styleId)) {
|
|
1334
1353
|
const style = document.createElement('style');
|
|
1335
1354
|
style.id = styleId;
|
|
1336
|
-
style.innerHTML = `
|
|
1337
|
-
.speaking-highlight {
|
|
1338
|
-
--base-transform: ${element.style.transform};
|
|
1339
|
-
box-shadow: 0 0 20px 10px rgba(255, 165, 0, 0.9) !important; /* Stronger orange glow effect */
|
|
1340
|
-
// border: 3px solid green !important;
|
|
1341
|
-
// transition: box-shadow 0.5s ease-in-out, transform 0.5s ease-in-out;
|
|
1342
|
-
// transform: scale(1.05); /* Subtle scale effect to pop the element */
|
|
1343
|
-
// animation: pulseEffect 1.5s infinite; /* Pulsing animation */
|
|
1344
|
-
|
|
1345
|
-
}
|
|
1346
|
-
|
|
1347
|
-
@keyframes pulseEffect {
|
|
1348
|
-
0% {
|
|
1349
|
-
box-shadow: 0 0 20px 10px rgba(255, 165, 0, 0.9);
|
|
1350
|
-
// transform: var(--base-transform) scale(1.05);
|
|
1351
|
-
// background-color: #FFFF0B;
|
|
1352
|
-
}
|
|
1353
|
-
50% {
|
|
1354
|
-
box-shadow: 0 0 30px 15px rgba(255, 165, 0, 1);
|
|
1355
|
-
// transform: var(--base-transform) scale(1.1);
|
|
1356
|
-
// background-color: #FFFF0B;
|
|
1357
|
-
}
|
|
1358
|
-
100% {
|
|
1359
|
-
box-shadow: 0 0 20px 10px rgba(255, 165, 0, 0.9);
|
|
1360
|
-
// transform: var(--base-transform) scale(1.05);
|
|
1361
|
-
// background-color: #FFFF0B;
|
|
1362
|
-
}
|
|
1363
|
-
}
|
|
1355
|
+
style.innerHTML = `
|
|
1356
|
+
.speaking-highlight {
|
|
1357
|
+
--base-transform: ${element.style.transform};
|
|
1358
|
+
box-shadow: 0 0 20px 10px rgba(255, 165, 0, 0.9) !important; /* Stronger orange glow effect */
|
|
1359
|
+
// border: 3px solid green !important;
|
|
1360
|
+
// transition: box-shadow 0.5s ease-in-out, transform 0.5s ease-in-out;
|
|
1361
|
+
// transform: scale(1.05); /* Subtle scale effect to pop the element */
|
|
1362
|
+
// animation: pulseEffect 1.5s infinite; /* Pulsing animation */
|
|
1363
|
+
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
@keyframes pulseEffect {
|
|
1367
|
+
0% {
|
|
1368
|
+
box-shadow: 0 0 20px 10px rgba(255, 165, 0, 0.9);
|
|
1369
|
+
// transform: var(--base-transform) scale(1.05);
|
|
1370
|
+
// background-color: #FFFF0B;
|
|
1371
|
+
}
|
|
1372
|
+
50% {
|
|
1373
|
+
box-shadow: 0 0 30px 15px rgba(255, 165, 0, 1);
|
|
1374
|
+
// transform: var(--base-transform) scale(1.1);
|
|
1375
|
+
// background-color: #FFFF0B;
|
|
1376
|
+
}
|
|
1377
|
+
100% {
|
|
1378
|
+
box-shadow: 0 0 20px 10px rgba(255, 165, 0, 0.9);
|
|
1379
|
+
// transform: var(--base-transform) scale(1.05);
|
|
1380
|
+
// background-color: #FFFF0B;
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1364
1383
|
`;
|
|
1365
1384
|
document.head.appendChild(style);
|
|
1366
1385
|
}
|
|
@@ -1425,9 +1444,18 @@ function highlightElement() {
|
|
|
1425
1444
|
}
|
|
1426
1445
|
|
|
1427
1446
|
class AudioPlayer {
|
|
1447
|
+
resolvePlaybackWait() {
|
|
1448
|
+
if (!this.endPromiseResolve) {
|
|
1449
|
+
return;
|
|
1450
|
+
}
|
|
1451
|
+
const resolve = this.endPromiseResolve;
|
|
1452
|
+
this.endPromiseResolve = null;
|
|
1453
|
+
resolve();
|
|
1454
|
+
}
|
|
1428
1455
|
constructor() {
|
|
1429
1456
|
this.currentTargetElement = null;
|
|
1430
1457
|
this.pendingReplayElement = null;
|
|
1458
|
+
this.playbackHasStarted = false;
|
|
1431
1459
|
this.highlightOverlay = null;
|
|
1432
1460
|
this.wordRects = [];
|
|
1433
1461
|
this.activeWordIndex = -1;
|
|
@@ -1485,15 +1513,12 @@ class AudioPlayer {
|
|
|
1485
1513
|
window.speechSynthesis.cancel();
|
|
1486
1514
|
}
|
|
1487
1515
|
// Resolve any pending "ended" wait so callers can continue.
|
|
1488
|
-
|
|
1489
|
-
const resolve = this.endPromiseResolve;
|
|
1490
|
-
this.endPromiseResolve = null;
|
|
1491
|
-
resolve();
|
|
1492
|
-
}
|
|
1516
|
+
this.resolvePlaybackWait();
|
|
1493
1517
|
if (!preserveReplay) {
|
|
1494
1518
|
this.pendingReplayElement = null;
|
|
1495
1519
|
}
|
|
1496
1520
|
this.currentTargetElement = null;
|
|
1521
|
+
this.playbackHasStarted = false;
|
|
1497
1522
|
this.audioElement.pause();
|
|
1498
1523
|
this.audioElement.currentTime = 0;
|
|
1499
1524
|
this.audioElement.src = '';
|
|
@@ -1531,6 +1556,7 @@ class AudioPlayer {
|
|
|
1531
1556
|
}
|
|
1532
1557
|
async play(targetElement) {
|
|
1533
1558
|
this.registerVisibilityEvents();
|
|
1559
|
+
this.playbackHasStarted = false;
|
|
1534
1560
|
if (!this.isWindowVisible()) {
|
|
1535
1561
|
this.pendingReplayElement = targetElement;
|
|
1536
1562
|
await this.stop(true);
|
|
@@ -1584,6 +1610,24 @@ class AudioPlayer {
|
|
|
1584
1610
|
if (audioUrl) {
|
|
1585
1611
|
audioUrl = convertUrlToRelative(audioUrl);
|
|
1586
1612
|
this.audioElement.src = audioUrl;
|
|
1613
|
+
this.audioElement.onplaying = () => {
|
|
1614
|
+
this.playbackHasStarted = true;
|
|
1615
|
+
};
|
|
1616
|
+
this.audioElement.onpause = () => {
|
|
1617
|
+
if (this.playbackHasStarted && !this.audioElement.ended) {
|
|
1618
|
+
this.resolvePlaybackWait();
|
|
1619
|
+
}
|
|
1620
|
+
};
|
|
1621
|
+
this.audioElement.onstalled = () => {
|
|
1622
|
+
if (this.playbackHasStarted) {
|
|
1623
|
+
this.resolvePlaybackWait();
|
|
1624
|
+
}
|
|
1625
|
+
};
|
|
1626
|
+
this.audioElement.onerror = () => {
|
|
1627
|
+
if (this.playbackHasStarted) {
|
|
1628
|
+
this.resolvePlaybackWait();
|
|
1629
|
+
}
|
|
1630
|
+
};
|
|
1587
1631
|
try {
|
|
1588
1632
|
// setDraggingDisabled(true);
|
|
1589
1633
|
const language = container.getAttribute('Lang') || 'en';
|
|
@@ -1613,10 +1657,7 @@ class AudioPlayer {
|
|
|
1613
1657
|
await new Promise(resolve => {
|
|
1614
1658
|
this.endPromiseResolve = resolve;
|
|
1615
1659
|
this.audioElement.onended = () => {
|
|
1616
|
-
|
|
1617
|
-
this.endPromiseResolve = null;
|
|
1618
|
-
}
|
|
1619
|
-
resolve();
|
|
1660
|
+
this.resolvePlaybackWait();
|
|
1620
1661
|
};
|
|
1621
1662
|
});
|
|
1622
1663
|
}
|
|
@@ -2050,11 +2091,11 @@ function enableReorderDrag(element) {
|
|
|
2050
2091
|
onDropToCategory(element, category);
|
|
2051
2092
|
}
|
|
2052
2093
|
if (divEl) {
|
|
2053
|
-
const keyframes = `
|
|
2054
|
-
@keyframes widthDecrease {
|
|
2055
|
-
0% { width: ${divEl.offsetWidth}px; height: ${divEl.offsetHeight}px; }
|
|
2056
|
-
100% { width: 0px; height: 0px;}
|
|
2057
|
-
}
|
|
2094
|
+
const keyframes = `
|
|
2095
|
+
@keyframes widthDecrease {
|
|
2096
|
+
0% { width: ${divEl.offsetWidth}px; height: ${divEl.offsetHeight}px; }
|
|
2097
|
+
100% { width: 0px; height: 0px;}
|
|
2098
|
+
}
|
|
2058
2099
|
`;
|
|
2059
2100
|
const styleSheet = document.styleSheets[0];
|
|
2060
2101
|
styleSheet.insertRule(keyframes, styleSheet.cssRules.length);
|
|
@@ -2267,11 +2308,11 @@ function moveWithAnimation(target, overlapped) {
|
|
|
2267
2308
|
const dummy = createDummyElement(target);
|
|
2268
2309
|
dummy.style.visibility = 'hidden';
|
|
2269
2310
|
dummy.setAttribute('type', 'dummy');
|
|
2270
|
-
const keyframes = `
|
|
2271
|
-
@keyframes widthIncrease {
|
|
2272
|
-
0% { width: 0px; height: 0px; }
|
|
2273
|
-
100% { width: ${target.offsetWidth}px; height: ${target.offsetHeight}px;}
|
|
2274
|
-
}
|
|
2311
|
+
const keyframes = `
|
|
2312
|
+
@keyframes widthIncrease {
|
|
2313
|
+
0% { width: 0px; height: 0px; }
|
|
2314
|
+
100% { width: ${target.offsetWidth}px; height: ${target.offsetHeight}px;}
|
|
2315
|
+
}
|
|
2275
2316
|
`;
|
|
2276
2317
|
if (!overlapped) {
|
|
2277
2318
|
const overlapCategory = findMostoverlappedElement(target, 'category');
|
|
@@ -2338,6 +2379,12 @@ async function onDropToCategory(dragElement, categoryElement) {
|
|
|
2338
2379
|
}
|
|
2339
2380
|
|
|
2340
2381
|
const delay = (ms) => new Promise(res => setTimeout(res, ms));
|
|
2382
|
+
const syncSlideOrder = (container) => {
|
|
2383
|
+
const slideOrder = Array.from(container.querySelectorAll("[type='slide']"))
|
|
2384
|
+
.map(item => item['value']);
|
|
2385
|
+
container.setAttribute(SelectedValuesKey, JSON.stringify(slideOrder));
|
|
2386
|
+
return slideOrder;
|
|
2387
|
+
};
|
|
2341
2388
|
const slideAnimation = async () => {
|
|
2342
2389
|
const container = document.getElementById(LidoContainer);
|
|
2343
2390
|
if (!container)
|
|
@@ -2398,6 +2445,9 @@ function slidingWithScaling(element) {
|
|
|
2398
2445
|
const container = document.getElementById(LidoContainer);
|
|
2399
2446
|
if (container.getAttribute('canplay') === 'false')
|
|
2400
2447
|
return;
|
|
2448
|
+
// Slide activities can start in the correct order. Keep their initial DOM
|
|
2449
|
+
// order available to the Next/check validation before the first swap occurs.
|
|
2450
|
+
syncSlideOrder(container);
|
|
2401
2451
|
const onStart = (event) => {
|
|
2402
2452
|
removeHighlight(element);
|
|
2403
2453
|
isDragging = true;
|
|
@@ -2571,15 +2621,8 @@ function slidingWithScaling(element) {
|
|
|
2571
2621
|
element.addEventListener(LIDO_INTERACTION_CLEANUP_EVENT, cleanup);
|
|
2572
2622
|
}
|
|
2573
2623
|
const slideCompleted = (slideElement) => {
|
|
2574
|
-
var _a;
|
|
2575
2624
|
const container = document.getElementById(LidoContainer);
|
|
2576
|
-
const slideArr =
|
|
2577
|
-
const allSlideElements = document.querySelectorAll("[type='slide']");
|
|
2578
|
-
let index = 0;
|
|
2579
|
-
allSlideElements.forEach(item => {
|
|
2580
|
-
slideArr[index++] = item['value'];
|
|
2581
|
-
});
|
|
2582
|
-
container.setAttribute(SelectedValuesKey, JSON.stringify(slideArr));
|
|
2625
|
+
const slideArr = syncSlideOrder(container);
|
|
2583
2626
|
const objectiveString = document.getElementById(LidoContainer)['objective'];
|
|
2584
2627
|
const objectiveArray = objectiveString.split(',');
|
|
2585
2628
|
const elementIndex = slideArr.indexOf(slideElement['value']);
|
|
@@ -3943,6 +3986,14 @@ function addClickListenerForClickType(element) {
|
|
|
3943
3986
|
const container = document.getElementById(LidoContainer);
|
|
3944
3987
|
if (container.getAttribute('canplay') === 'false')
|
|
3945
3988
|
return;
|
|
3989
|
+
const isBubbleTypeKeyboardKey = (container === null || container === void 0 ? void 0 : container.getAttribute('template-id')) === 'bubbleType' &&
|
|
3990
|
+
element.closest('lido-keyboard') !== null;
|
|
3991
|
+
// BubbleType manages key clicks and audio in lido-keyboard.tsx directly.
|
|
3992
|
+
// Letting the generic click handler attach here creates a competing stop/play
|
|
3993
|
+
// path that can interrupt the first bubble audio.
|
|
3994
|
+
if (isBubbleTypeKeyboardKey) {
|
|
3995
|
+
return;
|
|
3996
|
+
}
|
|
3946
3997
|
element.style.cursor = 'pointer';
|
|
3947
3998
|
if (!element) {
|
|
3948
3999
|
console.error('No element provided.');
|
|
@@ -72031,27 +72082,24 @@ const wait = (ms) => new Promise(resolve => setTimeout(resolve, ms));
|
|
|
72031
72082
|
/* ------------------ animation ------------------ */
|
|
72032
72083
|
const animationToRemoveEquationSolvedCellForNimbleTable = (activeCell, container) => {
|
|
72033
72084
|
return new Promise((resolve) => {
|
|
72034
|
-
|
|
72035
|
-
|
|
72036
|
-
|
|
72037
|
-
|
|
72038
|
-
|
|
72039
|
-
|
|
72040
|
-
|
|
72041
|
-
|
|
72042
|
-
}`;
|
|
72043
|
-
const styleSheet = document.styleSheets[0];
|
|
72044
|
-
styleSheet.insertRule(keyframes, styleSheet.cssRules.length);
|
|
72045
|
-
activeCell.style.animation = `widthDecrease 0s`;
|
|
72046
|
-
activeCell.addEventListener("animationend", () => {
|
|
72047
|
-
activeCell.remove();
|
|
72085
|
+
let removed = false;
|
|
72086
|
+
const removeActiveCell = () => {
|
|
72087
|
+
if (removed)
|
|
72088
|
+
return;
|
|
72089
|
+
removed = true;
|
|
72090
|
+
if (activeCell.isConnected) {
|
|
72091
|
+
activeCell.remove();
|
|
72092
|
+
}
|
|
72048
72093
|
// Trigger next container only after the last calculate cell is removed
|
|
72049
72094
|
const remainingCalculateTypes = container.querySelectorAll("[type='calculate']");
|
|
72050
72095
|
if (remainingCalculateTypes.length === 0) {
|
|
72051
72096
|
setTimeout(() => triggerNextContainer(), 2000);
|
|
72052
72097
|
}
|
|
72053
72098
|
resolve();
|
|
72054
|
-
}
|
|
72099
|
+
};
|
|
72100
|
+
// Nimble uses a zero-duration removal; remove synchronously so progression
|
|
72101
|
+
// does not depend on a browser animationend event.
|
|
72102
|
+
removeActiveCell();
|
|
72055
72103
|
});
|
|
72056
72104
|
};
|
|
72057
72105
|
/* ------------------ PRACTICE MODE ------------------ */
|
|
@@ -72865,11 +72913,11 @@ const afterDropDragHandling = (dragElement, dropElement) => {
|
|
|
72865
72913
|
}
|
|
72866
72914
|
dummyElement.setAttribute('id', dragElement.getAttribute('id'));
|
|
72867
72915
|
dragElement.replaceWith(dummyElement);
|
|
72868
|
-
const keyframes = `
|
|
72869
|
-
@keyframes widthDecrease {
|
|
72870
|
-
0% { width: ${dragElement.style.width}; height: ${dragElement.style.height}; margin: ${dragElement.style.margin}; }
|
|
72871
|
-
100% { width: 0px; height: 0px; margin: 0px;}
|
|
72872
|
-
}
|
|
72916
|
+
const keyframes = `
|
|
72917
|
+
@keyframes widthDecrease {
|
|
72918
|
+
0% { width: ${dragElement.style.width}; height: ${dragElement.style.height}; margin: ${dragElement.style.margin}; }
|
|
72919
|
+
100% { width: 0px; height: 0px; margin: 0px;}
|
|
72920
|
+
}
|
|
72873
72921
|
`;
|
|
72874
72922
|
if (!isInfinite) {
|
|
72875
72923
|
dummyElement.style.width = element.style.width;
|
|
@@ -73068,6 +73116,7 @@ const calculateScore = () => {
|
|
|
73068
73116
|
gameScore.totalRightMovesCount += rightMoves;
|
|
73069
73117
|
gameScore.totalWrongMovesCount += wrongMoves;
|
|
73070
73118
|
let finalScore = Math.floor((rightMoves / (rightMoves + wrongMoves)) * 100);
|
|
73119
|
+
console.log('[Activity Score]', { rightMoves, wrongMoves, activityScore: finalScore });
|
|
73071
73120
|
storeActivityScore(finalScore);
|
|
73072
73121
|
gameScore.rightMoves = 0;
|
|
73073
73122
|
gameScore.wrongMoves = 0;
|
|
@@ -73176,7 +73225,7 @@ const storeActivityScore = (score) => {
|
|
|
73176
73225
|
activityScore[activityScoreKey] = score;
|
|
73177
73226
|
//send Custom Event to parent
|
|
73178
73227
|
// window.dispatchEvent(new CustomEvent(ActivityEndKey, { detail: { index: index, totalIndex: totalIndex, score: score } }));
|
|
73179
|
-
const actualActivitySeconds =
|
|
73228
|
+
const actualActivitySeconds = Number((Timer.getI().getElapsed() / 1000).toFixed(1));
|
|
73180
73229
|
ACTIVYTY_TIME_SPEND_ARRAY.push(actualActivitySeconds);
|
|
73181
73230
|
console.log(`[Utils][Activity Time] Activity ${index + 1}/${totalIndex} - Time spent: ${actualActivitySeconds}s`);
|
|
73182
73231
|
const lessonTrackingParams = getLessonTrackingParams();
|
|
@@ -73188,7 +73237,7 @@ const storeActivityScore = (score) => {
|
|
|
73188
73237
|
gameScore.finalScore = Math.floor(finalScore);
|
|
73189
73238
|
console.log('Total Score : ', gameScore.finalScore);
|
|
73190
73239
|
// window.dispatchEvent(new CustomEvent(LessonEndKey, { detail: { score: finalScore } }));
|
|
73191
|
-
const timeSpendForLesson = ACTIVYTY_TIME_SPEND_ARRAY.reduce((sum, current) => sum + current, 0);
|
|
73240
|
+
const timeSpendForLesson = Number(ACTIVYTY_TIME_SPEND_ARRAY.reduce((sum, current) => sum + current, 0).toFixed(1));
|
|
73192
73241
|
console.log(`[Utils][Lesson Time] Total lesson time spent: ${timeSpendForLesson}s`);
|
|
73193
73242
|
dispatchLessonEndEvent(totalIndex, gameScore.totalRightMovesCount, gameScore.totalWrongMovesCount, finalScore, timeSpendForLesson, lessonTrackingParams);
|
|
73194
73243
|
gameScore.totalRightMovesCount = 0;
|
|
@@ -2,7 +2,7 @@ const NAMESPACE = 'lido-player';
|
|
|
2
2
|
const BUILD = /* lido-player */ { hotModuleReplacement: false, hydratedSelectorName: "hydrated", lazyLoad: true, propChangeCallback: true, slotRelocation: true, state: true, updatable: true};
|
|
3
3
|
|
|
4
4
|
const globalScripts = () => {};
|
|
5
|
-
const globalStyles = "@
|
|
5
|
+
const globalStyles = "@font-face{font-family:'Baloo Bhai 2';font-style:normal;font-weight:400 800;font-display:swap;src:url('../assets/offline-assets/fonts/Baloo-Bhai-2/Baloo-Bhai-2-Variable.woff2') format('woff2')}body{overflow:hidden;background-position:center;background-size:cover;background-repeat:no-repeat;height:100vh}*{user-select:none}.lido-disable-check-button{pointer-events:none;background-color:#9393935c !important;color:white}.lido-element-selected{border:2px solid;background-color:#ffdf7d !important}.diagonal-target,.diagonal-drop *{transform:scale(0.8) !important;opacity:1 !important}.cloned-element{display:flex !important;position:absolute !important;filter:grayscale(100%);pointer-events:none}.removeShadow{box-shadow:0px 0px 0px 0px #ff8900 !important}.highlight-element{border:2px solid white;box-shadow:rgb(243, 77, 8) 0px 0px 40px !important}.drop-element.empty{border:4px dashed #f34d08 !important}.drop-element.filled{border:'none' !important}.drag-element{box-shadow:0px 15px 11px rgba(43, 0, 0, 0.3) !important}.drag-element.dropped{box-shadow:none !important}.click-element{background-color:var(--btn-bg-color, rgba(255, 172, 76, 1)) !important;box-shadow:var(--btn-shadow-px) var(--btn-shadow-color, rgba(225, 121, 76, 1)) !important;cursor:pointer;transition:box-shadow 0.1s ease-out, transform 0.2s ease-out;}.click-element:active{box-shadow:0px 0px 0px var(--btn-shadow-color, rgba(225, 121, 76, 1)) !important;transform:translateY(var(--btn-active));}.click-element:focus{outline:2px solid dodgerblue;outline-offset:3px}.after-drop-popup-container{width:200%;height:200%;background-color:rgba(0, 0, 0, 0.8);position:absolute;display:flex;flex-direction:row-reverse;align-items:center;justify-content:center !important;gap:80px}.after-drop-popup-drag-element{scale:1.5;border-radius:8px;transform:none !important;position:unset !important}.after-drop-popup-drop-element{scale:1.5;border:unset;border-radius:8px;transform:none !important;position:unset !important}@keyframes zoomFadeIn{0%{transform:scale(0.6);opacity:0}100%{transform:scale(1);opacity:1}}.zoom-fade-in{animation:zoomFadeIn 0.8s ease-out forwards}@keyframes zoomFadeOut{0%{transform:scale(1);opacity:1}100%{transform:scale(0.6);opacity:0}}.zoom-fade-out{animation:zoomFadeOut 0.8s ease-in forwards}.slide-numbers{width:70px;height:70px;border:1px solid #f57139;background-color:white;font-weight:500;color:#f57139;font-size:44px;border-radius:40px;display:flex;align-items:center;justify-content:center;font-family:'Baloo Bhai 2', serif}.slide-numbers-bottom{position:absolute;display:flex;justify-content:space-around;align-items:center;bottom:-25px;width:100%;height:50px}.slide-numbers-left{position:absolute;display:flex;flex-direction:column;justify-content:space-around;height:100%;width:50px;left:-25px;bottom:0px}.lido-speak-icon{width:56px;height:56px;position:absolute;top:-25px;right:-25px;z-index:10;background-color:white;border:4px solid #F34D08;border-radius:16px;box-shadow:0px 4px 0px 0px #F34D08;background-size:contain;background-repeat:no-repeat;cursor:pointer}.lido-speak-icon:active{transform:translateY(8px);box-shadow:0px 0px 0px 0px !important}.lido-strong-shake{animation:strongShake 0.3s ease}.lido-scaled-shake{animation:scaledShake 0.6s ease-in-out}.lido-horizontal-shake{animation:horizontalShake 0.6s ease-in-out;border-radius:20px}.lido-vertical-shake{animation:verticalShake 0.6s ease-in-out;border-radius:20px}.lido-diagonal-shake{animation:diagonalShake 0.5s ease-in-out;border-radius:20px;will-change:transform}.lido-glow{animation:glowPulse 1s infinite alternate;transition:opacity 0.5s ease-in-out}.lido-box-highlight{animation:topToPlace 0.3s linear}.lido-display-hiddenvalue{position:absolute;top:0;left:0;width:100%;height:100%;display:flex;align-items:center;justify-content:center;font-size:80px;font-weight:1000;color:brown;-webkit-text-stroke:2px white;font-family:'Baloo Bhai 2', sans-serif;pointer-events:none}.lido-image-colorize{position:relative;display:inline-block}.lido-image-colorize::after{content:'';position:absolute;inset:0;background:var(--tint-color);mix-blend-mode:multiply;opacity:0.8;pointer-events:none;mask-image:var(--mask-url);mask-size:cover;mask-repeat:no-repeat;mask-position:center}.lido-tts-highlight-overlay{position:fixed;left:0;top:0;pointer-events:none;z-index:9999;background:linear-gradient(\n 180deg,\n rgba(255, 235, 59, 0.95),\n rgba(255, 214, 0, 0.95)\n );border-radius:6px;box-shadow:0 2px 6px rgba(0, 0, 0, 0.18),\n inset 0 -1px 0 rgba(255, 255, 255, 0.25);transition:width 25ms ease-out,\n height 25ms ease-out,\n opacity 80ms ease-out;opacity:0.95;will-change:transform, width, height;contain:layout paint style}";
|
|
6
6
|
|
|
7
7
|
/*
|
|
8
8
|
Stencil Client Platform v4.43.5 | MIT Licensed | https://stenciljs.com
|
|
@@ -2065,4 +2065,4 @@ function transformTag(tag) {
|
|
|
2065
2065
|
return tag;
|
|
2066
2066
|
}
|
|
2067
2067
|
|
|
2068
|
-
export { Host as H, getElement as a, bootstrapLazy as b,
|
|
2068
|
+
export { Host as H, getElement as a, bootstrapLazy as b, getAssetPath as c, createEvent as d, globalScripts as g, h, promiseResolve as p, registerInstance as r, setNonce as s };
|
package/dist/esm/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { $ as format } from './index-
|
|
2
|
-
import './index-
|
|
1
|
+
export { $ as format } from './index-CEJsA_x_.js';
|
|
2
|
+
import './index-Dnvog_Mm.js';
|