lido-player 0.0.2-alpha-13 → 0.0.2-alpha-15
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 +0 -0
- package/dist/cjs/app-globals-3a1e7e63.js +0 -2
- package/dist/cjs/{index-0d28e716.js → index-fe562525.js} +44 -6
- package/dist/cjs/index.cjs.js +2 -4
- package/dist/cjs/{lido-avatar_13.cjs.entry.js → lido-avatar_17.cjs.entry.js} +3853 -277
- package/dist/cjs/lido-player.cjs.js +2 -4
- package/dist/cjs/loader.cjs.js +2 -4
- package/dist/cjs/utils-cd5d227c.js +68588 -0
- package/dist/collection/collection-manifest.json +4 -0
- package/dist/collection/components/avatar/lido-avatar.css +0 -0
- package/dist/collection/components/avatar/lido-avatar.js +79 -41
- package/dist/collection/components/cell/lido-cell.css +100 -0
- package/dist/collection/components/cell/lido-cell.js +750 -0
- package/dist/collection/components/column/lido-col.css +0 -0
- package/dist/collection/components/column/lido-col.js +123 -4
- package/dist/collection/components/container/lido-container.css +1 -1
- package/dist/collection/components/container/lido-container.js +193 -47
- package/dist/collection/components/flashCard/lido-flash-card.css +28 -0
- package/dist/collection/components/flashCard/lido-flash-card.js +535 -0
- package/dist/collection/components/float/lido-float.css +18 -0
- package/dist/collection/components/float/lido-float.js +257 -0
- package/dist/collection/components/home/lido-home.css +75 -5
- package/dist/collection/components/home/lido-home.js +125 -21
- package/dist/collection/components/image/lido-image.css +10 -2
- package/dist/collection/components/image/lido-image.js +261 -9
- package/dist/collection/components/position/lido-pos.css +0 -0
- package/dist/collection/components/position/lido-pos.js +113 -38
- package/dist/collection/components/random/lido-random.css +4 -5
- package/dist/collection/components/random/lido-random.js +161 -47
- package/dist/collection/components/root/lido-root.js +22 -3
- package/dist/collection/components/row/lido-row.css +0 -0
- package/dist/collection/components/row/lido-row.js +104 -5
- package/dist/collection/components/shape/lido-shape.css +0 -0
- package/dist/collection/components/shape/lido-shape.js +137 -41
- package/dist/collection/components/slideFill/lido-slide-fill.css +4 -0
- package/dist/collection/components/slideFill/lido-slide-fill.js +391 -0
- package/dist/collection/components/text/lido-text.css +44 -3
- package/dist/collection/components/text/lido-text.js +266 -69
- package/dist/collection/components/trace/lido-trace.css +26 -6
- package/dist/collection/components/trace/lido-trace.js +370 -70
- package/dist/collection/components/wrap/lido-wrap.css +7 -0
- package/dist/collection/components/wrap/lido-wrap.js +106 -5
- package/dist/collection/css/animation.css +174 -0
- package/dist/collection/css/index.css +229 -0
- package/dist/collection/index.js +0 -1
- package/dist/collection/stories/Templates/Fill-Up/fill-up.stories.js +115 -0
- package/dist/collection/stories/Templates/LetterPairing/LetterPairing.stories.js +203 -0
- package/dist/collection/stories/Templates/RocketGame/rocketGame.stories.js +207 -0
- package/dist/collection/stories/Templates/Tag/tagGame.stories.js +64 -0
- package/dist/collection/stories/Templates/balloonPop/balloonPop.stories.js +74 -0
- package/dist/collection/stories/Templates/categorize/categorize.stories.js +72 -0
- package/dist/collection/stories/Templates/categorize2/categorize2.stories.js +117 -0
- package/dist/collection/stories/Templates/create-sentence/createSentence.stories.js +109 -0
- package/dist/collection/stories/Templates/dragAndDrop/drag-drop.stories.js +105 -0
- package/dist/collection/stories/Templates/fillBlank/fill-blank.stories.js +316 -0
- package/dist/collection/stories/Templates/flashCard/flashCard.stories.js +74 -0
- package/dist/collection/stories/Templates/grid/grid.stories.js +153 -0
- package/dist/collection/stories/Templates/gridGame/grid-game.stories.js +99 -0
- package/dist/collection/stories/Templates/letterboard/letterboard.stories.js +124 -0
- package/dist/collection/stories/Templates/makeSentence/make-sentence.stories.js +63 -0
- package/dist/collection/stories/Templates/multipleOption/mcqWithQuestionImage.stories.js +92 -0
- package/dist/collection/stories/Templates/multipleOption/multiple-option.stories.js +93 -0
- package/dist/collection/stories/Templates/openwindow/openwindow.stories.js +99 -0
- package/dist/collection/stories/Templates/phonic-tractor/phonic-tractor.stories.js +94 -0
- package/dist/collection/stories/Templates/picturemeaning/picturemeaning.stories.js +159 -0
- package/dist/collection/stories/Templates/puzzleGame/puzzleGame.stories.js +60 -0
- package/dist/collection/stories/Templates/reorder/reorder.stories.js +113 -0
- package/dist/collection/stories/Templates/spellDoor/spellDoor.stories.js +74 -0
- package/dist/collection/stories/Templates/storyTale/storyTale.stories.js +57 -0
- package/dist/collection/stories/Templates/writeCard/writeCard.stories.js +107 -0
- package/dist/collection/stories/Templates/writeWord/writeWord.stories.js +89 -0
- package/dist/collection/stories/components/flash-card.stories.js +85 -0
- package/dist/collection/stories/components/slider.stories.js +40 -0
- package/dist/collection/stories/components/trace.stories.js +30 -0
- package/dist/collection/utils/audioPlayer.js +9 -4
- package/dist/collection/utils/constants.js +25 -6
- package/dist/collection/utils/customEvents.js +4 -2
- package/dist/collection/utils/rive-service.js +0 -1
- package/dist/collection/utils/utils.js +516 -845
- package/dist/collection/utils/utilsHandlers/clickHandler.js +153 -0
- package/dist/collection/utils/utilsHandlers/dragDropHandler.js +799 -0
- package/dist/collection/utils/utilsHandlers/floatHandler.js +77 -0
- package/dist/collection/utils/utilsHandlers/highlightHandler.js +103 -0
- package/dist/collection/utils/utilsHandlers/slideHandler.js +231 -0
- package/dist/collection/utils/utilsHandlers/sortHandler.js +435 -0
- package/dist/components/index.d.ts +0 -0
- package/dist/components/index.js +1 -4
- package/dist/components/lido-avatar.d.ts +0 -0
- package/dist/components/lido-avatar.js +1 -3
- package/dist/components/lido-cell.d.ts +11 -0
- package/dist/components/lido-cell.js +6 -0
- package/dist/components/lido-col.d.ts +0 -0
- package/dist/components/lido-col.js +1 -3
- package/dist/components/lido-container.d.ts +0 -0
- package/dist/components/lido-container.js +1 -3
- package/dist/components/lido-flash-card.d.ts +11 -0
- package/dist/components/lido-flash-card.js +6 -0
- package/dist/components/lido-float.d.ts +11 -0
- package/dist/components/lido-float.js +6 -0
- package/dist/components/lido-home.d.ts +0 -0
- package/dist/components/lido-home.js +1 -3
- package/dist/components/lido-image.d.ts +0 -0
- package/dist/components/lido-image.js +1 -3
- package/dist/components/lido-pos.d.ts +0 -0
- package/dist/components/lido-pos.js +1 -3
- package/dist/components/lido-random.d.ts +0 -0
- package/dist/components/lido-random.js +1 -3
- package/dist/components/lido-root.d.ts +0 -0
- package/dist/components/lido-root.js +49 -25
- package/dist/components/lido-row.d.ts +0 -0
- package/dist/components/lido-row.js +1 -3
- package/dist/components/lido-shape.d.ts +0 -0
- package/dist/components/lido-shape.js +1 -3
- package/dist/components/lido-slide-fill.d.ts +11 -0
- package/dist/components/lido-slide-fill.js +6 -0
- package/dist/components/lido-text.d.ts +0 -0
- package/dist/components/lido-text.js +1 -3
- package/dist/components/lido-trace.d.ts +0 -0
- package/dist/components/lido-trace.js +1 -3
- package/dist/components/lido-wrap.d.ts +0 -0
- package/dist/components/lido-wrap.js +1 -3
- package/dist/components/p-012b96db.js +177 -0
- package/dist/components/p-21de2b04.js +129 -0
- package/dist/components/{p-cba45af3.js → p-24f25f8b.js} +23 -8
- package/dist/components/p-2c7bc6d4.js +69959 -0
- package/dist/components/{p-522c0ec0.js → p-2e94fbf7.js} +27 -23
- package/dist/components/p-3acc9aba.js +205 -0
- package/dist/components/p-48c5d815.js +122 -0
- package/dist/components/{p-27c1a9f0.js → p-61b53309.js} +227 -60
- package/dist/components/{p-0e6c1da3.js → p-67b3e70c.js} +32 -25
- package/dist/components/p-7e11b6d4.js +2856 -0
- package/dist/components/{p-762c2b34.js → p-85f4ab08.js} +51 -30
- package/dist/components/{p-48e9e250.js → p-900b1941.js} +23 -6
- package/dist/components/{p-b25a268c.js → p-976693ee.js} +25 -27
- package/dist/components/p-9c863339.js +413 -0
- package/dist/components/{p-5e0011f1.js → p-c3aa4e0c.js} +20 -7
- package/dist/components/p-c811c93d.js +92 -0
- package/dist/components/p-cd464196.js +186 -0
- package/dist/esm/app-globals-0f993ce5.js +0 -2
- package/dist/esm/{index-3e194609.js → index-f47852d4.js} +44 -6
- package/dist/esm/index.js +2 -4
- package/dist/esm/{lido-avatar_13.entry.js → lido-avatar_17.entry.js} +3849 -277
- package/dist/esm/lido-player.js +3 -5
- package/dist/esm/loader.js +3 -5
- package/dist/esm/utils-cf6f1c94.js +68561 -0
- package/dist/index.cjs.js +0 -0
- package/dist/index.js +0 -0
- package/dist/lido-player/index.esm.js +1 -2
- package/dist/lido-player/lido-player.css +1 -1
- package/dist/lido-player/lido-player.esm.js +1 -2
- package/dist/lido-player/p-2728333c.js +9 -0
- package/dist/lido-player/p-46f22f88.entry.js +1 -0
- package/dist/lido-player/p-ddf627b0.js +2 -0
- package/dist/lido-player/p-e1255160.js +1 -2
- package/dist/types/components/avatar/lido-avatar.d.ts +4 -0
- package/dist/types/components/cell/lido-cell.d.ts +183 -0
- package/dist/types/components/column/lido-col.d.ts +27 -0
- package/dist/types/components/container/lido-container.d.ts +25 -0
- package/dist/types/components/flashCard/lido-flash-card.d.ts +112 -0
- package/dist/types/components/float/lido-float.d.ts +59 -0
- package/dist/types/components/home/lido-home.d.ts +16 -2
- package/dist/types/components/image/lido-image.d.ts +55 -1
- package/dist/types/components/position/lido-pos.d.ts +13 -0
- package/dist/types/components/random/lido-random.d.ts +17 -0
- package/dist/types/components/root/lido-root.d.ts +5 -0
- package/dist/types/components/row/lido-row.d.ts +22 -0
- package/dist/types/components/shape/lido-shape.d.ts +17 -0
- package/dist/types/components/slideFill/lido-slide-fill.d.ts +65 -0
- package/dist/types/components/text/lido-text.d.ts +38 -7
- package/dist/types/components/trace/lido-trace.d.ts +57 -2
- package/dist/types/components/wrap/lido-wrap.d.ts +23 -0
- package/dist/types/components.d.ts +1259 -71
- package/dist/types/index.d.ts +0 -0
- package/dist/types/stencil-public-runtime.d.ts +0 -0
- package/dist/types/stories/Templates/Fill-Up/fill-up.stories.d.ts +4 -0
- package/dist/types/stories/Templates/LetterPairing/LetterPairing.stories.d.ts +4 -0
- package/dist/types/stories/Templates/RocketGame/rocketGame.stories.d.ts +16 -0
- package/dist/types/stories/Templates/Tag/tagGame.stories.d.ts +4 -0
- package/dist/types/stories/Templates/balloonPop/balloonPop.stories.d.ts +4 -0
- package/dist/types/stories/Templates/categorize/categorize.stories.d.ts +4 -0
- package/dist/types/stories/Templates/categorize2/categorize2.stories.d.ts +4 -0
- package/dist/types/stories/Templates/create-sentence/createSentence.stories.d.ts +4 -0
- package/dist/types/stories/Templates/dragAndDrop/drag-drop.stories.d.ts +4 -0
- package/dist/types/stories/Templates/fillBlank/fill-blank.stories.d.ts +4 -0
- package/dist/types/stories/Templates/flashCard/flashCard.stories.d.ts +11 -0
- package/dist/types/stories/Templates/grid/grid.stories.d.ts +4 -0
- package/dist/types/stories/Templates/gridGame/grid-game.stories.d.ts +4 -0
- package/dist/types/stories/Templates/letterboard/letterboard.stories.d.ts +4 -0
- package/dist/types/stories/Templates/makeSentence/make-sentence.stories.d.ts +4 -0
- package/dist/types/stories/Templates/multipleOption/mcqWithQuestionImage.stories.d.ts +4 -0
- package/dist/types/stories/Templates/multipleOption/multiple-option.stories.d.ts +4 -0
- package/dist/types/stories/Templates/openwindow/openwindow.stories.d.ts +14 -0
- package/dist/types/stories/Templates/phonic-tractor/phonic-tractor.stories.d.ts +4 -0
- package/dist/types/stories/Templates/picturemeaning/picturemeaning.stories.d.ts +4 -0
- package/dist/types/stories/Templates/puzzleGame/puzzleGame.stories.d.ts +21 -0
- package/dist/types/stories/Templates/reorder/reorder.stories.d.ts +4 -0
- package/dist/types/stories/Templates/spellDoor/spellDoor.stories.d.ts +4 -0
- package/dist/types/stories/Templates/storyTale/storyTale.stories.d.ts +4 -0
- package/dist/types/stories/Templates/writeCard/writeCard.stories.d.ts +13 -0
- package/dist/types/stories/Templates/writeWord/writeWord.stories.d.ts +14 -0
- package/dist/types/stories/components/flash-card.stories.d.ts +7 -0
- package/dist/types/stories/components/slider.stories.d.ts +4 -0
- package/dist/types/stories/components/trace.stories.d.ts +4 -0
- package/dist/types/utils/audioPlayer.d.ts +0 -0
- package/dist/types/utils/constants.d.ts +23 -5
- package/dist/types/utils/customEvents.d.ts +1 -0
- package/dist/types/utils/rive-service.d.ts +0 -0
- package/dist/types/utils/utils.d.ts +21 -5
- package/dist/types/utils/utilsHandlers/clickHandler.d.ts +2 -0
- package/dist/types/utils/utilsHandlers/dragDropHandler.d.ts +14 -0
- package/dist/types/utils/utilsHandlers/floatHandler.d.ts +3 -0
- package/dist/types/utils/utilsHandlers/highlightHandler.d.ts +4 -0
- package/dist/types/utils/utilsHandlers/slideHandler.d.ts +2 -0
- package/dist/types/utils/utilsHandlers/sortHandler.d.ts +1 -0
- package/loader/cdn.js +0 -0
- package/loader/index.cjs.js +0 -0
- package/loader/index.d.ts +0 -0
- package/loader/index.es2017.js +0 -0
- package/loader/index.js +0 -0
- package/loader/package.json +0 -0
- package/package.json +21 -6
- package/readme.md +0 -0
- package/dist/cjs/app-globals-3a1e7e63.js.map +0 -1
- package/dist/cjs/index-0d28e716.js.map +0 -1
- package/dist/cjs/index.cjs.js.map +0 -1
- package/dist/cjs/lido-avatar_13.cjs.entry.js.map +0 -1
- package/dist/cjs/lido-player.cjs.js.map +0 -1
- package/dist/cjs/loader.cjs.js.map +0 -1
- package/dist/cjs/utils-6cf81db6.js +0 -1238
- package/dist/cjs/utils-6cf81db6.js.map +0 -1
- package/dist/collection/components/avatar/lido-avatar.js.map +0 -1
- package/dist/collection/components/column/lido-col.js.map +0 -1
- package/dist/collection/components/container/lido-container.js.map +0 -1
- package/dist/collection/components/home/lido-home.js.map +0 -1
- package/dist/collection/components/image/lido-image.js.map +0 -1
- package/dist/collection/components/position/lido-pos.js.map +0 -1
- package/dist/collection/components/random/lido-random.js.map +0 -1
- package/dist/collection/components/root/assets/images/HIimage.png +0 -0
- package/dist/collection/components/root/assets/images/MultipleOptionImages/MultipleOptionBg.png +0 -0
- package/dist/collection/components/root/assets/images/MultipleOptionImages/Shadow.png +0 -0
- package/dist/collection/components/root/assets/images/MultipleOptionImages/giraffe.png +0 -0
- package/dist/collection/components/root/assets/images/MultipleOptionImages/leopard.png +0 -0
- package/dist/collection/components/root/assets/images/MultipleOptionImages/lion.png +0 -0
- package/dist/collection/components/root/assets/images/MultipleOptionImages/optionsBg.png +0 -0
- package/dist/collection/components/root/assets/images/MultipleOptionImages/questionBg.png +0 -0
- package/dist/collection/components/root/assets/images/MultipleOptionImages/tiger.png +0 -0
- package/dist/collection/components/root/assets/images/VIimage.png +0 -0
- package/dist/collection/components/root/assets/images/animals/giraffe.png +0 -0
- package/dist/collection/components/root/assets/images/animals/leopard.png +0 -0
- package/dist/collection/components/root/assets/images/animals/lion.png +0 -0
- package/dist/collection/components/root/assets/images/animals/tiger.png +0 -0
- package/dist/collection/components/root/assets/images/bodyParts/ear.png +0 -0
- package/dist/collection/components/root/assets/images/bodyParts/eyes.png +0 -0
- package/dist/collection/components/root/assets/images/bodyParts/nose.png +0 -0
- package/dist/collection/components/root/assets/images/dragAndDrop/Vector.png +0 -0
- package/dist/collection/components/root/assets/images/dragAndDrop/bgForDrag.png +0 -0
- package/dist/collection/components/root/assets/images/dragAndDrop/dragBg.png +0 -0
- package/dist/collection/components/root/assets/images/dragAndDrop/dragElementBg.png +0 -0
- package/dist/collection/components/root/assets/images/dragAndDrop/dropImages/drop1.png +0 -0
- package/dist/collection/components/root/assets/images/dragAndDrop/dropImages/drop2.png +0 -0
- package/dist/collection/components/root/assets/images/dragAndDrop/dropImages/drop3.png +0 -0
- package/dist/collection/components/root/assets/images/dragAndDrop/dropImages/drop4.png +0 -0
- package/dist/collection/components/root/assets/images/dragAndDrop/dropImages/drop5.png +0 -0
- package/dist/collection/components/root/assets/images/dragAndDrop/dropImages/drop6.png +0 -0
- package/dist/collection/components/root/assets/images/girl.png +0 -0
- package/dist/collection/components/root/assets/images/icons/access.png +0 -0
- package/dist/collection/components/root/assets/images/icons/brightness.png +0 -0
- package/dist/collection/components/root/assets/images/icons/cancel.png +0 -0
- package/dist/collection/components/root/assets/images/icons/contrast.png +0 -0
- package/dist/collection/components/root/assets/images/icons/dropDown.png +0 -0
- package/dist/collection/components/root/assets/images/icons/exit.png +0 -0
- package/dist/collection/components/root/assets/images/icons/hide.png +0 -0
- package/dist/collection/components/root/assets/images/icons/invert.png +0 -0
- package/dist/collection/components/root/assets/images/icons/lineSpacing.png +0 -0
- package/dist/collection/components/root/assets/images/icons/sound.png +0 -0
- package/dist/collection/components/root/assets/images/icons/zoom.png +0 -0
- package/dist/collection/components/root/assets/images/truck/blueTruck.png +0 -0
- package/dist/collection/components/root/assets/images/truck/dashedBox.png +0 -0
- package/dist/collection/components/root/assets/images/truck/face.png +0 -0
- package/dist/collection/components/root/assets/images/truck/road.jpg +0 -0
- package/dist/collection/components/root/assets/images/truck/seeing.png +0 -0
- package/dist/collection/components/root/assets/images/truck/truck.png +0 -0
- package/dist/collection/components/root/assets/images/twoColorBg.jpg +0 -0
- package/dist/collection/components/root/assets/lido-animation/chimplecharacter.riv +0 -0
- package/dist/collection/components/root/assets/xmlData.xml +0 -440
- package/dist/collection/components/root/lido-root.js.map +0 -1
- package/dist/collection/components/row/lido-row.js.map +0 -1
- package/dist/collection/components/shape/lido-shape.js.map +0 -1
- package/dist/collection/components/text/lido-text.js.map +0 -1
- package/dist/collection/components/trace/lido-trace.js.map +0 -1
- package/dist/collection/components/wrap/lido-wrap.js.map +0 -1
- package/dist/collection/index.css +0 -20
- package/dist/collection/index.js.map +0 -1
- package/dist/collection/utils/audioPlayer.js.map +0 -1
- package/dist/collection/utils/constants.js.map +0 -1
- package/dist/collection/utils/css/animation.css +0 -112
- package/dist/collection/utils/customEvents.js.map +0 -1
- package/dist/collection/utils/rive-service.js.map +0 -1
- package/dist/collection/utils/utils.js.map +0 -1
- package/dist/components/index.js.map +0 -1
- package/dist/components/lido-avatar.js.map +0 -1
- package/dist/components/lido-col.js.map +0 -1
- package/dist/components/lido-container.js.map +0 -1
- package/dist/components/lido-home.js.map +0 -1
- package/dist/components/lido-image.js.map +0 -1
- package/dist/components/lido-pos.js.map +0 -1
- package/dist/components/lido-random.js.map +0 -1
- package/dist/components/lido-root.js.map +0 -1
- package/dist/components/lido-row.js.map +0 -1
- package/dist/components/lido-shape.js.map +0 -1
- package/dist/components/lido-text.js.map +0 -1
- package/dist/components/lido-trace.js.map +0 -1
- package/dist/components/lido-wrap.js.map +0 -1
- package/dist/components/p-0e6c1da3.js.map +0 -1
- package/dist/components/p-10530dff.js +0 -108
- package/dist/components/p-10530dff.js.map +0 -1
- package/dist/components/p-27c1a9f0.js.map +0 -1
- package/dist/components/p-3a3a5d05.js +0 -96
- package/dist/components/p-3a3a5d05.js.map +0 -1
- package/dist/components/p-44db2553.js +0 -1295
- package/dist/components/p-44db2553.js.map +0 -1
- package/dist/components/p-48e9e250.js.map +0 -1
- package/dist/components/p-522c0ec0.js.map +0 -1
- package/dist/components/p-526fd8d3.js +0 -125
- package/dist/components/p-526fd8d3.js.map +0 -1
- package/dist/components/p-57c32539.js +0 -1297
- package/dist/components/p-57c32539.js.map +0 -1
- package/dist/components/p-5e0011f1.js.map +0 -1
- package/dist/components/p-762c2b34.js.map +0 -1
- package/dist/components/p-b25a268c.js.map +0 -1
- package/dist/components/p-cba45af3.js.map +0 -1
- package/dist/components/p-f7703d6d.js +0 -292
- package/dist/components/p-f7703d6d.js.map +0 -1
- package/dist/esm/app-globals-0f993ce5.js.map +0 -1
- package/dist/esm/index-3e194609.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/lido-avatar_13.entry.js.map +0 -1
- package/dist/esm/lido-player.js.map +0 -1
- package/dist/esm/loader.js.map +0 -1
- package/dist/esm/utils-6a1afb35.js +0 -1225
- package/dist/esm/utils-6a1afb35.js.map +0 -1
- package/dist/lido-player/assets/images/HIimage.png +0 -0
- package/dist/lido-player/assets/images/MultipleOptionImages/MultipleOptionBg.png +0 -0
- package/dist/lido-player/assets/images/MultipleOptionImages/Shadow.png +0 -0
- package/dist/lido-player/assets/images/MultipleOptionImages/giraffe.png +0 -0
- package/dist/lido-player/assets/images/MultipleOptionImages/leopard.png +0 -0
- package/dist/lido-player/assets/images/MultipleOptionImages/lion.png +0 -0
- package/dist/lido-player/assets/images/MultipleOptionImages/optionsBg.png +0 -0
- package/dist/lido-player/assets/images/MultipleOptionImages/questionBg.png +0 -0
- package/dist/lido-player/assets/images/MultipleOptionImages/tiger.png +0 -0
- package/dist/lido-player/assets/images/VIimage.png +0 -0
- package/dist/lido-player/assets/images/animals/giraffe.png +0 -0
- package/dist/lido-player/assets/images/animals/leopard.png +0 -0
- package/dist/lido-player/assets/images/animals/lion.png +0 -0
- package/dist/lido-player/assets/images/animals/tiger.png +0 -0
- package/dist/lido-player/assets/images/bodyParts/ear.png +0 -0
- package/dist/lido-player/assets/images/bodyParts/eyes.png +0 -0
- package/dist/lido-player/assets/images/bodyParts/nose.png +0 -0
- package/dist/lido-player/assets/images/dragAndDrop/Vector.png +0 -0
- package/dist/lido-player/assets/images/dragAndDrop/bgForDrag.png +0 -0
- package/dist/lido-player/assets/images/dragAndDrop/dragBg.png +0 -0
- package/dist/lido-player/assets/images/dragAndDrop/dragElementBg.png +0 -0
- package/dist/lido-player/assets/images/dragAndDrop/dropImages/drop1.png +0 -0
- package/dist/lido-player/assets/images/dragAndDrop/dropImages/drop2.png +0 -0
- package/dist/lido-player/assets/images/dragAndDrop/dropImages/drop3.png +0 -0
- package/dist/lido-player/assets/images/dragAndDrop/dropImages/drop4.png +0 -0
- package/dist/lido-player/assets/images/dragAndDrop/dropImages/drop5.png +0 -0
- package/dist/lido-player/assets/images/dragAndDrop/dropImages/drop6.png +0 -0
- package/dist/lido-player/assets/images/girl.png +0 -0
- package/dist/lido-player/assets/images/icons/access.png +0 -0
- package/dist/lido-player/assets/images/icons/brightness.png +0 -0
- package/dist/lido-player/assets/images/icons/cancel.png +0 -0
- package/dist/lido-player/assets/images/icons/contrast.png +0 -0
- package/dist/lido-player/assets/images/icons/dropDown.png +0 -0
- package/dist/lido-player/assets/images/icons/exit.png +0 -0
- package/dist/lido-player/assets/images/icons/hide.png +0 -0
- package/dist/lido-player/assets/images/icons/invert.png +0 -0
- package/dist/lido-player/assets/images/icons/lineSpacing.png +0 -0
- package/dist/lido-player/assets/images/icons/sound.png +0 -0
- package/dist/lido-player/assets/images/icons/zoom.png +0 -0
- package/dist/lido-player/assets/images/truck/blueTruck.png +0 -0
- package/dist/lido-player/assets/images/truck/dashedBox.png +0 -0
- package/dist/lido-player/assets/images/truck/face.png +0 -0
- package/dist/lido-player/assets/images/truck/road.jpg +0 -0
- package/dist/lido-player/assets/images/truck/seeing.png +0 -0
- package/dist/lido-player/assets/images/truck/truck.png +0 -0
- package/dist/lido-player/assets/images/twoColorBg.jpg +0 -0
- package/dist/lido-player/assets/lido-animation/chimplecharacter.riv +0 -0
- package/dist/lido-player/assets/xmlData.xml +0 -440
- package/dist/lido-player/index.esm.js.map +0 -1
- package/dist/lido-player/lido-player.esm.js.map +0 -1
- package/dist/lido-player/p-37351245.js +0 -3
- package/dist/lido-player/p-37351245.js.map +0 -1
- package/dist/lido-player/p-50c7c31f.js +0 -2
- package/dist/lido-player/p-50c7c31f.js.map +0 -1
- package/dist/lido-player/p-be5b4489.entry.js +0 -2
- package/dist/lido-player/p-be5b4489.entry.js.map +0 -1
- package/dist/lido-player/p-e1255160.js.map +0 -1
|
@@ -2,17 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
6
|
-
const utils = require('./utils-
|
|
7
|
-
|
|
8
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
5
|
+
const index = require('./index-fe562525.js');
|
|
6
|
+
const utils = require('./utils-cd5d227c.js');
|
|
9
7
|
|
|
10
8
|
var rive = {exports: {}};
|
|
11
9
|
|
|
12
10
|
(function (module, exports) {
|
|
13
11
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
14
12
|
module.exports = factory();
|
|
15
|
-
})(commonjsGlobal, () => {
|
|
13
|
+
})(utils.commonjsGlobal, () => {
|
|
16
14
|
return /******/ (() => { // webpackBootstrap
|
|
17
15
|
/******/ var __webpack_modules__ = ([
|
|
18
16
|
/* 0 */,
|
|
@@ -6547,31 +6545,33 @@ const LidoAvatar = class {
|
|
|
6547
6545
|
},
|
|
6548
6546
|
});
|
|
6549
6547
|
};
|
|
6550
|
-
this.id =
|
|
6551
|
-
this.value =
|
|
6552
|
-
this.height =
|
|
6553
|
-
this.width =
|
|
6554
|
-
this.ariaLabel =
|
|
6555
|
-
this.ariaHidden =
|
|
6556
|
-
this.x =
|
|
6557
|
-
this.y =
|
|
6558
|
-
this.z =
|
|
6559
|
-
this.bgColor =
|
|
6560
|
-
this.type =
|
|
6561
|
-
this.tabIndex =
|
|
6562
|
-
this.visible =
|
|
6563
|
-
this.audio =
|
|
6564
|
-
this.src =
|
|
6565
|
-
this.onTouch =
|
|
6566
|
-
this.onInCorrect =
|
|
6567
|
-
this.onCorrect =
|
|
6568
|
-
this.onEntry =
|
|
6548
|
+
this.id = '';
|
|
6549
|
+
this.value = '';
|
|
6550
|
+
this.height = '';
|
|
6551
|
+
this.width = 'auto';
|
|
6552
|
+
this.ariaLabel = '';
|
|
6553
|
+
this.ariaHidden = '';
|
|
6554
|
+
this.x = '0px';
|
|
6555
|
+
this.y = '0px';
|
|
6556
|
+
this.z = '0';
|
|
6557
|
+
this.bgColor = '';
|
|
6558
|
+
this.type = '';
|
|
6559
|
+
this.tabIndex = 0;
|
|
6560
|
+
this.visible = false;
|
|
6561
|
+
this.audio = '';
|
|
6562
|
+
this.src = '';
|
|
6563
|
+
this.onTouch = '';
|
|
6564
|
+
this.onInCorrect = '';
|
|
6565
|
+
this.onCorrect = '';
|
|
6566
|
+
this.onEntry = '';
|
|
6567
|
+
this.delayVisible = '';
|
|
6569
6568
|
}
|
|
6570
6569
|
/**
|
|
6571
6570
|
* This lifecycle hook is called after the component is rendered in the DOM.
|
|
6572
6571
|
* It initializes events for the column based on the provided type.
|
|
6573
6572
|
*/
|
|
6574
6573
|
async componentDidLoad() {
|
|
6574
|
+
utils.setVisibilityWithDelay(this.el, this.delayVisible);
|
|
6575
6575
|
utils.initEventsForElement(this.el, this.type);
|
|
6576
6576
|
// const resolvedPath = this.src.startsWith('http')
|
|
6577
6577
|
// ? this.src // Use the provided URL if it's an HTTP/HTTPS link
|
|
@@ -6589,18 +6589,152 @@ const LidoAvatar = class {
|
|
|
6589
6589
|
display: this.visible ? 'flex' : 'none',
|
|
6590
6590
|
zIndex: this.z,
|
|
6591
6591
|
};
|
|
6592
|
-
return (index.h(index.Host, { key: '
|
|
6592
|
+
return (index.h(index.Host, { key: '54b86b9154855e156b6dd67c71eb4107b317b480', id: this.id, type: this.type, "tab-index": this.tabIndex, value: this.value, style: style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, audio: this.audio, onTouch: this.onTouch, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, onEntry: this.onEntry }, index.h("canvas", { key: 'f9d352ac0f0ef41b155a1cfc7659bb44f628beb3', class: "lido-canvas" })));
|
|
6593
6593
|
}
|
|
6594
6594
|
get el() { return index.getElement(this); }
|
|
6595
6595
|
};
|
|
6596
6596
|
LidoAvatar.style = LidoAvatarStyle0;
|
|
6597
6597
|
|
|
6598
|
+
const lidoCellCss = ".lido-col{top:var(--y, 0);left:var(--x, 0);height:var(--height, 100%);width:var(--width, 100%);background-color:var(--bgColor, #eeeeee);padding:15px;border-radius:10px;display:flex;justify-content:space-around;flex-direction:column;align-items:center}.lido-col>*{}.lido-row{display:flex;justify-content:space-around;align-items:center;}.lido-row>*{}.lido-wrap{display:grid;grid-gap:10px;grid-template-columns:repeat(auto-fill, minmax(186px, auto))}.lido-wrap>*{padding:10px;box-sizing:border-box}.lido-flex{display:flex;flex-wrap:wrap;align-content:flex-start;gap:10px}.lido-pos{top:var(--y, 0);left:var(--x, 0);height:var(--height, 100%);width:var(--width, 100%);background-color:var(--bgColor, #eeeeee);display:flex;justify-content:space-around;flex-direction:column;position:fixed}.lido-pos>*{position:absolute}.lido-random{position:relative;width:100%;height:100%}.lido-random>*{position:absolute}.lido-col::-webkit-scrollbar,.lido-wrap::-webkit-scrollbar,.lido-flex::-webkit-scrollbar{width:var(--scrollbar-width);height:var(--scrollbar-width)}.lido-col::-webkit-scrollbar-thumb,.lido-wrap::-webkit-scrollbar-thumb,.lido-flex::-webkit-scrollbar-thumb{background-color:#888;border-radius:10px;border:3px solid transparent;background-clip:content-box}.lido-col::-webkit-scrollbar-track,.lido-wrap::-webkit-scrollbar-track,.lido-flex::-webkit-scrollbar-track{background:#f1f1f1}";
|
|
6599
|
+
const LidoCellStyle0 = lidoCellCss;
|
|
6600
|
+
|
|
6601
|
+
const LidoCell = class {
|
|
6602
|
+
constructor(hostRef) {
|
|
6603
|
+
index.registerInstance(this, hostRef);
|
|
6604
|
+
this.showSpeakIcon = false;
|
|
6605
|
+
this.scrollbarWidth = '';
|
|
6606
|
+
this.id = '';
|
|
6607
|
+
this.value = '';
|
|
6608
|
+
this.height = 'auto';
|
|
6609
|
+
this.width = 'auto';
|
|
6610
|
+
this.ariaLabel = '';
|
|
6611
|
+
this.ariaHidden = '';
|
|
6612
|
+
this.x = '0px';
|
|
6613
|
+
this.y = '0px';
|
|
6614
|
+
this.z = '0';
|
|
6615
|
+
this.gap = '0';
|
|
6616
|
+
this.bgColor = '';
|
|
6617
|
+
this.type = '';
|
|
6618
|
+
this.tabIndex = 0;
|
|
6619
|
+
this.visible = 'false';
|
|
6620
|
+
this.audio = '';
|
|
6621
|
+
this.onTouch = '';
|
|
6622
|
+
this.onInCorrect = '';
|
|
6623
|
+
this.onCorrect = '';
|
|
6624
|
+
this.onEntry = '';
|
|
6625
|
+
this.childElementsLength = 9999;
|
|
6626
|
+
this.minLength = 0;
|
|
6627
|
+
this.maxLength = 9999;
|
|
6628
|
+
this.layout = 'wrap';
|
|
6629
|
+
this.minDrops = 1;
|
|
6630
|
+
this.maxDrops = 1;
|
|
6631
|
+
this.margin = '';
|
|
6632
|
+
this.padding = '';
|
|
6633
|
+
this.alignItems = '';
|
|
6634
|
+
this.borderRadius = '0px';
|
|
6635
|
+
this.flexDirection = '';
|
|
6636
|
+
this.style = {};
|
|
6637
|
+
this.delayVisible = '';
|
|
6638
|
+
}
|
|
6639
|
+
/**
|
|
6640
|
+
* This lifecycle hook is called after the component is rendered in the DOM.
|
|
6641
|
+
* It initializes events for the column based on the provided type.
|
|
6642
|
+
*/
|
|
6643
|
+
componentDidLoad() {
|
|
6644
|
+
utils.setVisibilityWithDelay(this.el, this.delayVisible);
|
|
6645
|
+
utils.initEventsForElement(this.el, this.type);
|
|
6646
|
+
utils.handlingChildElements(this.el, this.minLength, this.maxLength, this.childElementsLength);
|
|
6647
|
+
// Select all direct child elements of the component
|
|
6648
|
+
// const slotElements = this.el.querySelectorAll('.lido-random > *');
|
|
6649
|
+
// if (!slotElements) return;
|
|
6650
|
+
// // Iterate over each child and apply random positions
|
|
6651
|
+
// slotElements.forEach((child: HTMLElement) => {
|
|
6652
|
+
// const randomTop = Math.random() * 100; // Random value between 0 and 100 for vertical position
|
|
6653
|
+
// const randomLeft = Math.random() * 100; // Random value between 0 and 100 for horizontal position
|
|
6654
|
+
// child.style.top = `${randomTop}%`;
|
|
6655
|
+
// child.style.left = `${randomLeft}%`;
|
|
6656
|
+
// });
|
|
6657
|
+
setTimeout(() => {
|
|
6658
|
+
const check_random_attr = this.el.className.includes('lido-random') ? this.el : null;
|
|
6659
|
+
if (check_random_attr) {
|
|
6660
|
+
const parentcontainer = check_random_attr.parentElement;
|
|
6661
|
+
if (!parentcontainer)
|
|
6662
|
+
return;
|
|
6663
|
+
// Get parent size
|
|
6664
|
+
const parentWidth = parentcontainer.offsetWidth;
|
|
6665
|
+
const parentHeight = parentcontainer.offsetHeight;
|
|
6666
|
+
// Place child elements randomly inside parent
|
|
6667
|
+
const children = Array.from(check_random_attr.children);
|
|
6668
|
+
children.forEach(child => {
|
|
6669
|
+
const childWidth = child.offsetWidth;
|
|
6670
|
+
const childHeight = child.offsetHeight;
|
|
6671
|
+
const maxLeft = parentWidth - childWidth;
|
|
6672
|
+
const maxTop = parentHeight - childHeight;
|
|
6673
|
+
const randLeft = Math.random() * maxLeft;
|
|
6674
|
+
const randTop = Math.random() * maxTop;
|
|
6675
|
+
child.style.position = 'absolute';
|
|
6676
|
+
child.style.left = `${randLeft}px`;
|
|
6677
|
+
child.style.top = `${randTop}px`;
|
|
6678
|
+
});
|
|
6679
|
+
}
|
|
6680
|
+
}, 50);
|
|
6681
|
+
if (this.showSpeakIcon) {
|
|
6682
|
+
utils.attachSpeakIcon(this.el, this.x, this.y);
|
|
6683
|
+
}
|
|
6684
|
+
}
|
|
6685
|
+
/**
|
|
6686
|
+
* Lifecycle method that runs before the component is rendered.
|
|
6687
|
+
* Initializes styles and sets up event listeners for resize and load events.
|
|
6688
|
+
*/
|
|
6689
|
+
componentWillLoad() {
|
|
6690
|
+
this.updateStyles();
|
|
6691
|
+
window.addEventListener('resize', this.updateStyles.bind(this));
|
|
6692
|
+
window.addEventListener('load', this.updateStyles.bind(this));
|
|
6693
|
+
}
|
|
6694
|
+
disconnectedCallback() {
|
|
6695
|
+
window.removeEventListener('resize', this.updateStyles.bind(this));
|
|
6696
|
+
window.removeEventListener('load', this.updateStyles.bind(this));
|
|
6697
|
+
}
|
|
6698
|
+
updateStyles() {
|
|
6699
|
+
const orientation = window.innerHeight > window.innerWidth ? 'portrait' : 'landscape';
|
|
6700
|
+
this.style = {
|
|
6701
|
+
'height': utils.parseProp(this.height, orientation),
|
|
6702
|
+
'width': utils.parseProp(this.width, orientation),
|
|
6703
|
+
'backgroundColor': utils.parseProp(this.bgColor, orientation),
|
|
6704
|
+
'top': utils.parseProp(this.y, orientation),
|
|
6705
|
+
'left': utils.parseProp(this.x, orientation),
|
|
6706
|
+
'zIndex': this.z,
|
|
6707
|
+
'margin': utils.parseProp(this.margin, orientation),
|
|
6708
|
+
'padding': utils.parseProp(this.padding, orientation),
|
|
6709
|
+
'borderRadius': utils.parseProp(this.borderRadius, orientation),
|
|
6710
|
+
'gap': utils.parseProp(this.gap, orientation),
|
|
6711
|
+
'--scrollbar-width': utils.parseProp(this.scrollbarWidth || '0px', orientation),
|
|
6712
|
+
'display': JSON.parse(utils.parseProp(`${this.visible}`, orientation))
|
|
6713
|
+
? utils.parseProp(this.layout, orientation) === 'wrap'
|
|
6714
|
+
? 'grid'
|
|
6715
|
+
: utils.parseProp(this.layout, orientation) === 'pos' || utils.parseProp(this.layout, orientation) === 'random'
|
|
6716
|
+
? 'block'
|
|
6717
|
+
: 'flex'
|
|
6718
|
+
: 'none',
|
|
6719
|
+
'flexDirection': this.flexDirection ? utils.parseProp(this.flexDirection, orientation) : '',
|
|
6720
|
+
'alignItems': this.alignItems ? utils.parseProp(this.alignItems, orientation) : '',
|
|
6721
|
+
};
|
|
6722
|
+
this.el.className = `lido-${utils.parseProp(this.layout, orientation)}`;
|
|
6723
|
+
}
|
|
6724
|
+
render() {
|
|
6725
|
+
return (index.h(index.Host, { key: 'bfe66118617e201c5539c90f36baafb5f3a6f4d0', id: this.id, class: "lido-cell", value: this.value, type: this.type, "tab-index": this.tabIndex, style: this.style, minDrops: this.minDrops, maxDrops: this.maxDrops, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, audio: this.audio, onTouch: this.onTouch, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, onEntry: this.onEntry, "flex-direction": this.flexDirection }, index.h("slot", { key: 'b3ea80bf41ea813681e35ac5704e770c5f05dcc6' })));
|
|
6726
|
+
}
|
|
6727
|
+
get el() { return index.getElement(this); }
|
|
6728
|
+
};
|
|
6729
|
+
LidoCell.style = LidoCellStyle0;
|
|
6730
|
+
|
|
6598
6731
|
const lidoColCss = ".lido-col{top:var(--y, 0);left:var(--x, 0);height:var(--height, 100%);width:var(--width, 100%);background-color:var(--bgColor, #eeeeee);padding:15px;border-radius:10px;display:flex;justify-content:space-around;flex-direction:column;align-items:center}.lido-col>*{}";
|
|
6599
6732
|
const LidoColStyle0 = lidoColCss;
|
|
6600
6733
|
|
|
6601
6734
|
const LidoCol = class {
|
|
6602
6735
|
constructor(hostRef) {
|
|
6603
6736
|
index.registerInstance(this, hostRef);
|
|
6737
|
+
this.showSpeakIcon = false;
|
|
6604
6738
|
this.id = undefined;
|
|
6605
6739
|
this.value = undefined;
|
|
6606
6740
|
this.height = undefined;
|
|
@@ -6623,6 +6757,11 @@ const LidoCol = class {
|
|
|
6623
6757
|
this.minLength = undefined;
|
|
6624
6758
|
this.maxLength = undefined;
|
|
6625
6759
|
this.direction = undefined;
|
|
6760
|
+
this.borderImage = undefined;
|
|
6761
|
+
this.boxShadow = undefined;
|
|
6762
|
+
this.minDrops = 1;
|
|
6763
|
+
this.maxDrops = 1;
|
|
6764
|
+
this.margin = '';
|
|
6626
6765
|
this.style = {};
|
|
6627
6766
|
}
|
|
6628
6767
|
/**
|
|
@@ -6631,7 +6770,10 @@ const LidoCol = class {
|
|
|
6631
6770
|
*/
|
|
6632
6771
|
componentDidLoad() {
|
|
6633
6772
|
utils.initEventsForElement(this.el, this.type);
|
|
6634
|
-
utils.handlingChildElements(this.el, this.minLength, this.maxLength, this.childElementsLength
|
|
6773
|
+
utils.handlingChildElements(this.el, this.minLength, this.maxLength, this.childElementsLength);
|
|
6774
|
+
if (this.showSpeakIcon) {
|
|
6775
|
+
utils.attachSpeakIcon(this.el, this.x, this.y);
|
|
6776
|
+
}
|
|
6635
6777
|
}
|
|
6636
6778
|
/**
|
|
6637
6779
|
* Lifecycle method that runs before the component is rendered.
|
|
@@ -6647,6 +6789,7 @@ const LidoCol = class {
|
|
|
6647
6789
|
window.removeEventListener('load', this.updateStyles.bind(this));
|
|
6648
6790
|
}
|
|
6649
6791
|
updateStyles() {
|
|
6792
|
+
const borderImg = this.borderImage ? utils.convertUrlToRelative(this.borderImage) : '';
|
|
6650
6793
|
const orientation = window.innerHeight > window.innerWidth ? 'portrait' : 'landscape';
|
|
6651
6794
|
this.style = {
|
|
6652
6795
|
height: utils.parseProp(this.height, orientation),
|
|
@@ -6657,47 +6800,57 @@ const LidoCol = class {
|
|
|
6657
6800
|
zIndex: this.z,
|
|
6658
6801
|
display: this.visible ? 'flex' : 'none', // Toggle visibility
|
|
6659
6802
|
flexDirection: !this.direction ? 'column' : utils.parseProp(this.direction, orientation),
|
|
6803
|
+
borderImage: `url(${borderImg})`,
|
|
6804
|
+
borderImageSlice: borderImg ? '0 fill' : '',
|
|
6805
|
+
boxShadow: this.boxShadow ? this.boxShadow : 'unset',
|
|
6806
|
+
margin: utils.parseProp(this.margin, orientation),
|
|
6660
6807
|
};
|
|
6661
6808
|
}
|
|
6662
6809
|
render() {
|
|
6663
|
-
return (index.h(index.Host, { key: '
|
|
6810
|
+
return (index.h(index.Host, { key: 'cb6eb9e4851477c3392469bc52115a796c48b9e0', id: this.id, class: "lido-col", type: this.type, "tab-index": this.tabIndex, value: this.value, style: this.style, minDrops: this.minDrops, maxDrops: this.maxDrops, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, audio: this.audio, onTouch: this.onTouch, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, onEntry: this.onEntry }, index.h("slot", { key: '71ea9bb8da2874d4127dcaf9eecb99d936be3391' })));
|
|
6664
6811
|
}
|
|
6665
6812
|
get el() { return index.getElement(this); }
|
|
6666
6813
|
};
|
|
6667
6814
|
LidoCol.style = LidoColStyle0;
|
|
6668
6815
|
|
|
6669
|
-
const lidoContainerCss = ".lido-container{position:relative;height:100%;width:100%;background-color:var(--bgColor,
|
|
6816
|
+
const lidoContainerCss = ".lido-container{position:relative;height:100%;width:100%;background-color:var(--bgColor, transparent);display:flex;flex-direction:column;justify-content:center;align-items:center}";
|
|
6670
6817
|
const LidoContainerStyle0 = lidoContainerCss;
|
|
6671
6818
|
|
|
6672
6819
|
const LidoContainer = class {
|
|
6673
6820
|
constructor(hostRef) {
|
|
6674
6821
|
index.registerInstance(this, hostRef);
|
|
6675
|
-
this.
|
|
6676
|
-
this.
|
|
6677
|
-
this.
|
|
6678
|
-
this.
|
|
6679
|
-
this.
|
|
6680
|
-
this.
|
|
6681
|
-
this.
|
|
6682
|
-
this.
|
|
6683
|
-
this.
|
|
6684
|
-
this.
|
|
6685
|
-
this.
|
|
6686
|
-
this.
|
|
6687
|
-
this.
|
|
6688
|
-
this.
|
|
6689
|
-
this.
|
|
6690
|
-
this.
|
|
6691
|
-
this.
|
|
6692
|
-
this.
|
|
6693
|
-
this.
|
|
6694
|
-
this.
|
|
6695
|
-
this.
|
|
6822
|
+
this.showDropBorder = true;
|
|
6823
|
+
this.appendToDropOnCompletion = false;
|
|
6824
|
+
this.id = '';
|
|
6825
|
+
this.objective = '';
|
|
6826
|
+
this.customStyle = '';
|
|
6827
|
+
this.value = '';
|
|
6828
|
+
this.height = 'auto';
|
|
6829
|
+
this.width = 'auto';
|
|
6830
|
+
this.ariaLabel = 'auto';
|
|
6831
|
+
this.ariaHidden = '';
|
|
6832
|
+
this.x = '0px';
|
|
6833
|
+
this.y = '0px';
|
|
6834
|
+
this.z = '0';
|
|
6835
|
+
this.bgColor = '';
|
|
6836
|
+
this.bgImage = '';
|
|
6837
|
+
this.type = '';
|
|
6838
|
+
this.tabIndex = 0;
|
|
6839
|
+
this.visible = false;
|
|
6840
|
+
this.audio = '';
|
|
6841
|
+
this.onTouch = '';
|
|
6842
|
+
this.onInCorrect = '';
|
|
6843
|
+
this.onCorrect = '';
|
|
6844
|
+
this.onEntry = '';
|
|
6696
6845
|
this.canplay = true;
|
|
6697
6846
|
this.showCheck = false;
|
|
6698
6847
|
this.isContinueOnCorrect = false;
|
|
6699
6848
|
this.isAllowOnlyCorrect = false;
|
|
6700
6849
|
this.baseUrl = '';
|
|
6850
|
+
this.margin = '';
|
|
6851
|
+
this.showPrevButton = "false";
|
|
6852
|
+
this.showNextButton = "false";
|
|
6853
|
+
this.delayVisible = '';
|
|
6701
6854
|
}
|
|
6702
6855
|
convertToPixels(height, parentElement = document.body) {
|
|
6703
6856
|
if (!height)
|
|
@@ -6745,12 +6898,21 @@ const LidoContainer = class {
|
|
|
6745
6898
|
scaleX = width / 1600;
|
|
6746
6899
|
scaleY = height / 900;
|
|
6747
6900
|
}
|
|
6748
|
-
const scale = Math.min(scaleX, scaleY); // Ensure uniform scaling
|
|
6901
|
+
const scale = Math.min(scaleX, scaleY); // Ensure uniform scaling
|
|
6749
6902
|
// Center the container and apply scaling
|
|
6750
6903
|
container.style.transform = `translate(-50%, -50%) scale(${scale})`;
|
|
6751
6904
|
container.style.left = '50%';
|
|
6752
6905
|
container.style.top = '50%';
|
|
6753
6906
|
container.style.position = 'absolute'; // Ensure proper positioning
|
|
6907
|
+
setTimeout(() => {
|
|
6908
|
+
const navBar = document.querySelector('.lido-dot-container');
|
|
6909
|
+
console.log('navBar', navBar);
|
|
6910
|
+
if (navBar) {
|
|
6911
|
+
navBar.style.width = `${container.offsetWidth - 25}px`;
|
|
6912
|
+
navBar.style.transform = `translate(-50%, -50%) scale(${scale})`; //ensure proper scaling
|
|
6913
|
+
navBar.style.visibility = 'visible';
|
|
6914
|
+
}
|
|
6915
|
+
}, 100);
|
|
6754
6916
|
this.screenOrientation();
|
|
6755
6917
|
}
|
|
6756
6918
|
screenOrientation() {
|
|
@@ -6770,10 +6932,12 @@ const LidoContainer = class {
|
|
|
6770
6932
|
* - Adds event listeners for `resize` and `load` to rescale the container on window size changes.
|
|
6771
6933
|
*/
|
|
6772
6934
|
componentDidLoad() {
|
|
6935
|
+
utils.setVisibilityWithDelay(this.el, this.delayVisible);
|
|
6773
6936
|
this.scaleContainer(this.el);
|
|
6774
6937
|
const backGroundImage = this.bgImage ? utils.convertUrlToRelative(this.bgImage) : '';
|
|
6775
6938
|
document.body.style.backgroundColor = this.bgColor;
|
|
6776
|
-
document.body.style.backgroundImage = `url(${backGroundImage})
|
|
6939
|
+
document.body.style.backgroundImage = backGroundImage ? `url(${backGroundImage})` : 'none';
|
|
6940
|
+
document.body.style.backgroundPosition = backGroundImage ? `bottom` : 'none';
|
|
6777
6941
|
// Re-scale the container on window resize or load events
|
|
6778
6942
|
window.addEventListener('resize', () => this.scaleContainer(this.el));
|
|
6779
6943
|
window.addEventListener('load', () => this.scaleContainer(this.el));
|
|
@@ -6798,21 +6962,167 @@ const LidoContainer = class {
|
|
|
6798
6962
|
top: '50%',
|
|
6799
6963
|
left: '50%',
|
|
6800
6964
|
transform: 'translate(-50%, -50%)', // Centering the container
|
|
6965
|
+
margin: this.margin,
|
|
6801
6966
|
};
|
|
6802
6967
|
console.log('🚀 ~ LidoContainer ~ canplay:', this.canplay);
|
|
6803
|
-
return (index.h(index.Host, { key: '
|
|
6968
|
+
return (index.h(index.Host, { key: '05134957ee5bf6f8b454428d60024642e68972ff', id: "lido-container", "tab-index": 0, class: "lido-container", objective: this.objective, baseUrl: this.baseUrl, style: style, "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 }, index.h("slot", { key: '15c335e91ed5345170d6fc6ca6221b9221a055f1' })));
|
|
6804
6969
|
}
|
|
6805
6970
|
get el() { return index.getElement(this); }
|
|
6806
6971
|
};
|
|
6807
6972
|
LidoContainer.style = LidoContainerStyle0;
|
|
6808
6973
|
|
|
6809
|
-
const
|
|
6974
|
+
const lidoFlashCardCss = ".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)}";
|
|
6975
|
+
const LidoFlashCardStyle0 = lidoFlashCardCss;
|
|
6976
|
+
|
|
6977
|
+
const LidoFlash = class {
|
|
6978
|
+
constructor(hostRef) {
|
|
6979
|
+
index.registerInstance(this, hostRef);
|
|
6980
|
+
/* ---------- Internal helpers ---------- */
|
|
6981
|
+
/** Compute responsive inline styles. */
|
|
6982
|
+
this.updateStyles = () => {
|
|
6983
|
+
const o = window.innerHeight > window.innerWidth ? 'portrait' : 'landscape';
|
|
6984
|
+
this.style = {
|
|
6985
|
+
height: utils.parseProp(this.height, o) || '200px',
|
|
6986
|
+
width: utils.parseProp(this.width, o) || '200px',
|
|
6987
|
+
backgroundColor: utils.parseProp(this.bgColor, o),
|
|
6988
|
+
top: utils.parseProp(this.y, o),
|
|
6989
|
+
left: utils.parseProp(this.x, o),
|
|
6990
|
+
zIndex: this.z,
|
|
6991
|
+
display: this.visible ? (this.display ? utils.parseProp(this.display, o) : 'inline-block') : 'none',
|
|
6992
|
+
flexDirection: this.direction ? utils.parseProp(this.direction, o) : undefined,
|
|
6993
|
+
margin: utils.parseProp(this.margin, o),
|
|
6994
|
+
};
|
|
6995
|
+
};
|
|
6996
|
+
/** Toggle the card when it is clicked. */
|
|
6997
|
+
this.handleFlip = () => {
|
|
6998
|
+
this.flipped = !this.flipped;
|
|
6999
|
+
};
|
|
7000
|
+
this.value = '';
|
|
7001
|
+
this.height = 'auto';
|
|
7002
|
+
this.width = 'auto';
|
|
7003
|
+
this.ariaLabel = '';
|
|
7004
|
+
this.ariaHidden = '';
|
|
7005
|
+
this.x = '0px';
|
|
7006
|
+
this.y = '0px';
|
|
7007
|
+
this.z = '0';
|
|
7008
|
+
this.bgColor = '';
|
|
7009
|
+
this.type = '';
|
|
7010
|
+
this.tabIndex = 0;
|
|
7011
|
+
this.visible = true;
|
|
7012
|
+
this.audio = '';
|
|
7013
|
+
this.onTouch = '';
|
|
7014
|
+
this.onInCorrect = '';
|
|
7015
|
+
this.onCorrect = '';
|
|
7016
|
+
this.onEntry = '';
|
|
7017
|
+
this.direction = undefined;
|
|
7018
|
+
this.display = undefined;
|
|
7019
|
+
this.front = undefined;
|
|
7020
|
+
this.back = undefined;
|
|
7021
|
+
this.flipped = false;
|
|
7022
|
+
this.margin = '';
|
|
7023
|
+
this.style = {};
|
|
7024
|
+
this.delayVisible = '';
|
|
7025
|
+
}
|
|
7026
|
+
/* ---------- Watches ---------- */
|
|
7027
|
+
/** React to external changes if you need side‑effects. */
|
|
7028
|
+
handleFlippedChange() {
|
|
7029
|
+
/* No side‑effects for now; re‑render happens automatically. */
|
|
7030
|
+
}
|
|
7031
|
+
/* ---------- Lifecycle ---------- */
|
|
7032
|
+
componentWillLoad() {
|
|
7033
|
+
this.updateStyles();
|
|
7034
|
+
window.addEventListener('resize', this.updateStyles);
|
|
7035
|
+
window.addEventListener('load', this.updateStyles);
|
|
7036
|
+
}
|
|
7037
|
+
componentDidLoad() {
|
|
7038
|
+
utils.setVisibilityWithDelay(this.el, this.delayVisible);
|
|
7039
|
+
utils.initEventsForElement(this.el, this.type);
|
|
7040
|
+
// handlingChildElements(this.el, this.minLength, this.maxLength, this.childElementsLength, 'inline-block');
|
|
7041
|
+
}
|
|
7042
|
+
disconnectedCallback() {
|
|
7043
|
+
window.removeEventListener('resize', this.updateStyles);
|
|
7044
|
+
window.removeEventListener('load', this.updateStyles);
|
|
7045
|
+
}
|
|
7046
|
+
/* ---------- Render ---------- */
|
|
7047
|
+
render() {
|
|
7048
|
+
return (index.h(index.Host, { key: 'ab4549fc6dd8fcbd7d67e21433827bc87c1f2dbe', 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 }, index.h("div", { key: 'c8981d2f7c3f71b26402bfdab79f5da765b20e02', class: `card ${this.flipped ? 'flipped' : ''}` }, index.h("div", { key: '78608648e93d368577a7c7c5a058ced227eafa44', class: "card-face card-front" }, this.front != null ? this.front : index.h("slot", { name: "front" })), index.h("div", { key: '7eabba27269fb0cd827310cf4aab2d03c8031de1', class: "card-face card-back" }, this.back != null ? this.back : index.h("slot", { name: "back" })))));
|
|
7049
|
+
}
|
|
7050
|
+
get el() { return index.getElement(this); }
|
|
7051
|
+
static get watchers() { return {
|
|
7052
|
+
"flipped": ["handleFlippedChange"]
|
|
7053
|
+
}; }
|
|
7054
|
+
};
|
|
7055
|
+
LidoFlash.style = LidoFlashCardStyle0;
|
|
7056
|
+
|
|
7057
|
+
const lidoFloatCss = ".lido-float{position:relative}.lido-float>*{position:absolute;cursor:pointer}@keyframes float-up{from{top:900px}to{top:-400px;}}";
|
|
7058
|
+
const LidoFloatStyle0 = lidoFloatCss;
|
|
7059
|
+
|
|
7060
|
+
const LidoFloat = class {
|
|
7061
|
+
constructor(hostRef) {
|
|
7062
|
+
index.registerInstance(this, hostRef);
|
|
7063
|
+
this.id = '';
|
|
7064
|
+
this.value = '';
|
|
7065
|
+
this.z = '0';
|
|
7066
|
+
this.tabIndex = 0;
|
|
7067
|
+
this.visible = false;
|
|
7068
|
+
this.onEntry = '';
|
|
7069
|
+
this.width = undefined;
|
|
7070
|
+
this.height = undefined;
|
|
7071
|
+
this.bgColor = undefined;
|
|
7072
|
+
this.delayVisible = '';
|
|
7073
|
+
this.style = undefined;
|
|
7074
|
+
}
|
|
7075
|
+
componentDidLoad() {
|
|
7076
|
+
utils.setVisibilityWithDelay(this.el, this.delayVisible);
|
|
7077
|
+
this.initializeFloatElement();
|
|
7078
|
+
}
|
|
7079
|
+
/**
|
|
7080
|
+
* Lifecycle method that runs before the component is rendered.
|
|
7081
|
+
* Initializes styles and sets up event listeners for resize and load events.
|
|
7082
|
+
*/
|
|
7083
|
+
componentWillLoad() {
|
|
7084
|
+
this.updateStyles();
|
|
7085
|
+
window.addEventListener('resize', this.updateStyles.bind(this));
|
|
7086
|
+
window.addEventListener('load', this.updateStyles.bind(this));
|
|
7087
|
+
}
|
|
7088
|
+
disconnectedCallback() {
|
|
7089
|
+
window.removeEventListener('resize', this.updateStyles.bind(this));
|
|
7090
|
+
window.removeEventListener('load', this.updateStyles.bind(this));
|
|
7091
|
+
}
|
|
7092
|
+
initializeFloatElement() {
|
|
7093
|
+
const floatElements = this.el.children;
|
|
7094
|
+
Array.from(floatElements).forEach((el) => {
|
|
7095
|
+
const element = el;
|
|
7096
|
+
utils.handleFloatElementPosition(element);
|
|
7097
|
+
el.addEventListener('click', () => {
|
|
7098
|
+
utils.handleElementClick(element);
|
|
7099
|
+
});
|
|
7100
|
+
});
|
|
7101
|
+
}
|
|
7102
|
+
updateStyles() {
|
|
7103
|
+
const orientation = window.innerHeight > window.innerWidth ? 'portrait' : 'landscape';
|
|
7104
|
+
this.style = {
|
|
7105
|
+
height: utils.parseProp(this.height, orientation),
|
|
7106
|
+
width: utils.parseProp(this.width, orientation),
|
|
7107
|
+
backgroundColor: utils.parseProp(this.bgColor, orientation),
|
|
7108
|
+
zIndex: this.z,
|
|
7109
|
+
display: this.visible ? 'flex' : 'none',
|
|
7110
|
+
};
|
|
7111
|
+
}
|
|
7112
|
+
render() {
|
|
7113
|
+
return (index.h(index.Host, { key: 'a0ff5cd4fad7b37b183bd555207ad54a9a03d26b', class: "lido-float", id: this.id, "tab-index": this.tabIndex, style: this.style }, index.h("slot", { key: '994b173de0002b0438a84d35ad5143a83822b4e9' })));
|
|
7114
|
+
}
|
|
7115
|
+
get el() { return index.getElement(this); }
|
|
7116
|
+
};
|
|
7117
|
+
LidoFloat.style = LidoFloatStyle0;
|
|
7118
|
+
|
|
7119
|
+
const indexCss = "@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap'); @import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@400..800&display=swap'); @import url('https://fonts.googleapis.com/css2?family=Baloo+Bhai+2:wght@400..800&display=swap'); body{overflow:hidden;background-position:center;background-size:cover;background-repeat:no-repeat;height:100vh}.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:0 2px 4px rgba(151, 150, 150, 0.1) !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;padding-right:20px}.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;gap:145px}.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-image:url(\"https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/template/audioIcon.png\");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}";
|
|
6810
7120
|
const LidoHomeStyle0 = indexCss;
|
|
6811
7121
|
|
|
6812
|
-
const animationCss = "@keyframes rightToPlace{from{transform:translateX(2000px)}to{transform:translateX(0)}}@keyframes topToPlace{from{transform:translateY(-1000px)}to{transform:translateY(0)}}@keyframes bottomToPlace{from{transform:translateY(1000px)}to{transform:translateY(0)}}@keyframes placeToLeft{from{}to{transform:translateX(-2000px)}}@keyframes leftToPlace{from{transform:translateX(-2000px)}to{transform:translateX(0)}}@keyframes shake{0%{transform:translateX(0)}10%{transform:translateX(-5px)}20%{transform:translateX(5px)}30%{transform:translateX(-5px)}40%{transform:translateX(5px)}50%{transform:translateX(-5px)}60%{transform:translateX(5px)}70%{transform:translateX(-5px)}80%{transform:translateX(5px)}90%{transform:translateX(-5px)}100%{transform:translateX(0)}}@keyframes fallAndBounce{0%{transform:translateY(-1000px)}25%{transform:translateY(0px)}50%{transform:translateY(-200px)}75%{transform:translateY(0)}90%{transform:translateY(-100px)}100%{transform:translateY(0)}}@keyframes placeToDown{0%{transform:translateY(0)}100%{transform:translateY(1000px)}}";
|
|
7122
|
+
const animationCss = "@keyframes rightToPlace{from{transform:translateX(2000px)}to{transform:translateX(0)}}@keyframes topToPlace{from{transform:translateY(-1000px)}to{transform:translateY(0)}}@keyframes bottomToPlace{from{transform:translateY(1000px)}to{transform:translateY(0)}}@keyframes placeToLeft{from{}to{transform:translateX(-2000px)}}@keyframes leftToPlace{from{transform:translateX(-2000px)}to{transform:translateX(0)}}@keyframes shake{0%{transform:translateX(0)}10%{transform:translateX(-5px)}20%{transform:translateX(5px)}30%{transform:translateX(-5px)}40%{transform:translateX(5px)}50%{transform:translateX(-5px)}60%{transform:translateX(5px)}70%{transform:translateX(-5px)}80%{transform:translateX(5px)}90%{transform:translateX(-5px)}100%{transform:translateX(0)}}@keyframes fallAndBounce{0%{transform:translateY(-1000px)}25%{transform:translateY(0px)}50%{transform:translateY(-200px)}75%{transform:translateY(0)}90%{transform:translateY(-100px)}100%{transform:translateY(0)}}@keyframes placeToDown{0%{transform:translateY(0)}100%{transform:translateY(1000px)}}@keyframes strongShake{0%{transform:translateX(0)}20%{transform:translateX(-8px)}40%{transform:translateX(8px)}60%{transform:translateX(-6px)}80%{transform:translateX(6px)}100%{transform:translateX(0)}}@keyframes scaledShake{0%{transform:scale(1) translateX(0);box-shadow:0 0 0 transparent}20%{transform:scale(1.10) translateX(-12px);box-shadow:0 0 10px red}40%{transform:scale(1.10) translateX(12px);box-shadow:0 0 12px red}60%{transform:scale(1.10) translateX(-8px);box-shadow:0 0 10px red}80%{transform:scale(1.10) translateX(8px);box-shadow:0 0 12px red}100%{transform:scale(1) translateX(0);box-shadow:none}}@keyframes horizontalShake{0%{transform:scale(1) translateX(0);background-color:transparent}20%{transform:translateX(-20px);background-color:rgba(255, 0, 0, 0.2)}40%{transform:translateX(20px);background-color:rgba(255, 0, 0, 0.4)}60%{transform:translateX(-10px);background-color:rgba(255, 0, 0, 0.3)}80%{transform:translateX(10px);background-color:rgba(255, 0, 0, 0.2)}100%{transform:translateX(0);background-color:transparent}}@keyframes verticalShake{0%{transform:translateY(0);background-color:transparent}20%{transform:translateY(-20px);background-color:rgba(255, 0, 0, 0.2)}40%{transform:translateY(0);background-color:rgba(255, 0, 0, 0.4)}60%{transform:translateY(20px);background-color:rgba(255, 0, 0, 0.2)}80%{transform:translateY(0);background-color:rgba(255, 0, 0, 0.1)}100%{transform:translateY(0);background-color:transparent}}@keyframes diagonalShake{0%{transform:translate(0, 0);background-color:transparent}25%{transform:translate(20px, -20px);background-color:rgba(255, 0, 0, 0.2)}50%{transform:translate(-20px, 20px);background-color:rgba(255, 0, 0, 0.3)}75%{transform:translate(10px, -10px);background-color:rgba(255, 0, 0, 0.2)}100%{transform:translate(0, 0);background-color:transparent}}";
|
|
6813
7123
|
const LidoHomeStyle1 = animationCss;
|
|
6814
7124
|
|
|
6815
|
-
const lidoHomeCss = ".lido-snackbar{visibility:visible;min-width:250px;background-color:#333;color:#fff;text-align:center;border-radius:2px;padding:16px;position:fixed;z-index:1;bottom:30px;left:50%;transform:translateX(-50%);font-size:17px}.lido-dot-container{text-align:center;position:fixed;z-index:1;
|
|
7125
|
+
const lidoHomeCss = ".lido-snackbar{visibility:visible;min-width:250px;background-color:#333;color:#fff;text-align:center;border-radius:2px;padding:16px;position:fixed;z-index:1;bottom:30px;left:50%;transform:translateX(-50%);font-size:17px}.lido-dot-container{display:flex;justify-content:space-between;align-items:center;text-align:center;position:fixed;z-index:1;top:6.5%;left:50%;visibility:hidden}.lido-dot{height:18px;width:18px;margin:0 4px;background-color:#bbb;border-radius:50%;display:inline-block;transition:background-color 0.3s;cursor:pointer;z-index:1;}.lido-btn-dot-container{width:auto;display:flex;justify-content:center;align-items:center;text-align:center;z-index:1}.lido-dot.completed{background-color:grey}.lido-dot.current{background-color:green}.lido-dot:not(.completed):not(.current){background-color:#bbb}#lido-arrow-left,#lido-arrow-right{width:88px;height:88px;display:flex;align-items:center;justify-content:center;margin:0 12px 0px 12px;border-radius:12px;z-index:1000;box-shadow:0px 8px 0px 0px #8B310F;background-color:#F34D08;cursor:pointer;visibility:hidden}#lido-arrow-left:active,#lido-arrow-right:active{transform:translateY(8px);box-shadow:0px 0px 0px 0px}.navbar{display:flex;justify-content:center}.lido-exit-button,#main-audio{width:80px;height:80px;z-index:1000;cursor:pointer;background-color:white;display:flex;align-items:center;justify-content:center;border:4px solid #F34D08;border-radius:16px;box-shadow:0px 8px #F34D08}#main-audio:active,.lido-exit-button:active{transform:translateY(8px);box-shadow:0px 0px 0px 0px !important}.lido-alert-popup{position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0, 0, 0, 0.5);display:flex;align-items:center;justify-content:center;z-index:1000}";
|
|
6816
7126
|
const LidoHomeStyle2 = lidoHomeCss;
|
|
6817
7127
|
|
|
6818
7128
|
const LidoHome = class {
|
|
@@ -6823,11 +7133,11 @@ const LidoHome = class {
|
|
|
6823
7133
|
* If the last container is reached, it shows a completion message.
|
|
6824
7134
|
*/
|
|
6825
7135
|
this.NextContainerKey = (index) => {
|
|
7136
|
+
// console.log("👉 NextContainerKey CALLED with index:", index);
|
|
6826
7137
|
if (index != undefined && index == this.currentContainerIndex)
|
|
6827
7138
|
return;
|
|
6828
7139
|
// Clear selected values from localStorage on container transition
|
|
6829
|
-
|
|
6830
|
-
localStorage.removeItem(utils.DragSelectedMapKey);
|
|
7140
|
+
utils.clearLocalStorage();
|
|
6831
7141
|
if (index != undefined && index < this.containers.length) {
|
|
6832
7142
|
// Move to the next container
|
|
6833
7143
|
this.currentContainerIndex = index;
|
|
@@ -6854,15 +7164,68 @@ const LidoHome = class {
|
|
|
6854
7164
|
}
|
|
6855
7165
|
// Reset the containers array to trigger a re-render
|
|
6856
7166
|
this.containers = [...this.containers];
|
|
7167
|
+
this.updateArrowVisibility();
|
|
6857
7168
|
};
|
|
6858
|
-
this.
|
|
7169
|
+
this.PrevContainerKey = (index) => {
|
|
7170
|
+
console.log('👉 PrevContainerKey CALLED with index:', index);
|
|
7171
|
+
if (this.currentContainerIndex <= 0)
|
|
7172
|
+
return;
|
|
7173
|
+
// Clear selected values from localStorage on container transition
|
|
7174
|
+
utils.clearLocalStorage();
|
|
7175
|
+
// Move to the previous container
|
|
7176
|
+
this.currentContainerIndex--;
|
|
7177
|
+
// Dispatch event to update the UI or state
|
|
7178
|
+
utils.dispatchActivityChangeEvent(this.currentContainerIndex);
|
|
7179
|
+
// Refresh container array and update button visibility
|
|
7180
|
+
this.containers = [...this.containers];
|
|
7181
|
+
this.updateArrowVisibility();
|
|
7182
|
+
};
|
|
7183
|
+
// update arrow visibility
|
|
7184
|
+
this.updateArrowVisibility = () => {
|
|
7185
|
+
setTimeout(() => {
|
|
7186
|
+
const containerElement = this.el.querySelector('lido-container');
|
|
7187
|
+
const prevbtn = containerElement.getAttribute('show-prev-button');
|
|
7188
|
+
const nextbtn = containerElement.getAttribute('show-next-button');
|
|
7189
|
+
const rightbtn = this.el.querySelector('#lido-arrow-right');
|
|
7190
|
+
const leftbtn = this.el.querySelector('#lido-arrow-left');
|
|
7191
|
+
if (prevbtn !== 'true') {
|
|
7192
|
+
leftbtn.style.visibility = 'hidden';
|
|
7193
|
+
}
|
|
7194
|
+
else {
|
|
7195
|
+
leftbtn.style.visibility = 'visible';
|
|
7196
|
+
}
|
|
7197
|
+
if (nextbtn !== 'true') {
|
|
7198
|
+
rightbtn.style.visibility = 'hidden';
|
|
7199
|
+
}
|
|
7200
|
+
else {
|
|
7201
|
+
rightbtn.style.visibility = 'visible';
|
|
7202
|
+
}
|
|
7203
|
+
}, 100);
|
|
7204
|
+
};
|
|
7205
|
+
this.popUpClick = (comment) => {
|
|
7206
|
+
const alertElement = this.el.querySelector('.lido-alert-popup');
|
|
7207
|
+
this.exitFlag = false;
|
|
7208
|
+
if (alertElement) {
|
|
7209
|
+
if (comment === 'cancel') {
|
|
7210
|
+
alertElement.remove();
|
|
7211
|
+
}
|
|
7212
|
+
else {
|
|
7213
|
+
utils.dispatchGameExitEvent();
|
|
7214
|
+
utils.clearLocalStorage();
|
|
7215
|
+
alertElement.remove();
|
|
7216
|
+
}
|
|
7217
|
+
}
|
|
7218
|
+
};
|
|
7219
|
+
this.xmlData = '';
|
|
6859
7220
|
this.initialIndex = 0;
|
|
6860
7221
|
this.canplay = true;
|
|
6861
7222
|
this.baseUrl = '';
|
|
6862
7223
|
this.height = '';
|
|
6863
7224
|
this.currentContainerIndex = this.initialIndex;
|
|
6864
7225
|
this.showCompletionMessage = false;
|
|
7226
|
+
this.exitFlag = false;
|
|
6865
7227
|
this.containers = [];
|
|
7228
|
+
this.showDotsandbtn = false;
|
|
6866
7229
|
}
|
|
6867
7230
|
/**
|
|
6868
7231
|
* Lifecycle method that runs before the component is loaded. It sets up event listeners for transitioning
|
|
@@ -6873,6 +7236,9 @@ const LidoHome = class {
|
|
|
6873
7236
|
window.addEventListener(utils.NextContainerKey, () => {
|
|
6874
7237
|
this.NextContainerKey();
|
|
6875
7238
|
});
|
|
7239
|
+
window.addEventListener(utils.PrevContainerKey, () => {
|
|
7240
|
+
this.PrevContainerKey();
|
|
7241
|
+
});
|
|
6876
7242
|
window.addEventListener('changeContainer', (e) => {
|
|
6877
7243
|
this.NextContainerKey(e.detail.index);
|
|
6878
7244
|
});
|
|
@@ -6880,10 +7246,25 @@ const LidoHome = class {
|
|
|
6880
7246
|
this.parseXMLData(this.xmlData);
|
|
6881
7247
|
// Remove stored values in localStorage when the page is about to be unloaded
|
|
6882
7248
|
window.addEventListener('beforeunload', () => {
|
|
6883
|
-
|
|
6884
|
-
localStorage.removeItem(utils.DragSelectedMapKey);
|
|
7249
|
+
utils.clearLocalStorage();
|
|
6885
7250
|
});
|
|
6886
7251
|
}
|
|
7252
|
+
componentDidLoad() {
|
|
7253
|
+
setTimeout(() => {
|
|
7254
|
+
this.showDotsandbtn = true;
|
|
7255
|
+
}, 10);
|
|
7256
|
+
this.updateArrowVisibility();
|
|
7257
|
+
if (this.height != '') {
|
|
7258
|
+
this.updateBackgroundImage();
|
|
7259
|
+
}
|
|
7260
|
+
}
|
|
7261
|
+
updateBackgroundImage() {
|
|
7262
|
+
const container = document.querySelector(utils.LidoContainer);
|
|
7263
|
+
const bgImageSrc = container.getAttribute('bg-image');
|
|
7264
|
+
document.body.style.background = 'none';
|
|
7265
|
+
container.style.backgroundImage = bgImageSrc ? `url(${bgImageSrc})` : 'none';
|
|
7266
|
+
container.style.backgroundPosition = bgImageSrc ? `bottom` : 'none';
|
|
7267
|
+
}
|
|
6887
7268
|
/**
|
|
6888
7269
|
* Lifecycle method that cleans up event listeners when the component is removed from the DOM.
|
|
6889
7270
|
*/
|
|
@@ -6894,6 +7275,9 @@ const LidoHome = class {
|
|
|
6894
7275
|
window.removeEventListener('changeContainer', (e) => {
|
|
6895
7276
|
this.NextContainerKey(e.detail.index);
|
|
6896
7277
|
});
|
|
7278
|
+
window.removeEventListener(utils.PrevContainerKey, () => {
|
|
7279
|
+
this.PrevContainerKey();
|
|
7280
|
+
});
|
|
6897
7281
|
}
|
|
6898
7282
|
/**
|
|
6899
7283
|
* Parses the provided XML string into an XML DOM object and extracts the containers from it.
|
|
@@ -6909,6 +7293,9 @@ const LidoHome = class {
|
|
|
6909
7293
|
this.parseContainers(rootElement);
|
|
6910
7294
|
}
|
|
6911
7295
|
}
|
|
7296
|
+
onXmlDataChange(newValue) {
|
|
7297
|
+
this.parseXMLData(newValue);
|
|
7298
|
+
}
|
|
6912
7299
|
/**
|
|
6913
7300
|
* Recursively parses an XML element and its children, converting them into corresponding Stencil components.
|
|
6914
7301
|
*
|
|
@@ -6937,6 +7324,7 @@ const LidoHome = class {
|
|
|
6937
7324
|
// Map XML tags to Stencil components
|
|
6938
7325
|
const componentMapping = {
|
|
6939
7326
|
'lido-container': (index.h("lido-container", Object.assign({}, props, { canplay: this.canplay, baseUrl: this.baseUrl, height: this.height }), children)),
|
|
7327
|
+
'lido-flash-card': index.h("lido-flash-card", Object.assign({}, props), children),
|
|
6940
7328
|
'lido-col': index.h("lido-col", Object.assign({}, props), children),
|
|
6941
7329
|
'lido-trace': index.h("lido-trace", Object.assign({}, props), children),
|
|
6942
7330
|
'lido-image': index.h("lido-image", Object.assign({}, props), children),
|
|
@@ -6947,6 +7335,9 @@ const LidoHome = class {
|
|
|
6947
7335
|
'lido-wrap': index.h("lido-wrap", Object.assign({}, props), children),
|
|
6948
7336
|
'lido-random': index.h("lido-random", Object.assign({}, props), children),
|
|
6949
7337
|
'lido-avatar': index.h("lido-avatar", Object.assign({}, props), children),
|
|
7338
|
+
'lido-cell': index.h("lido-cell", Object.assign({}, props), children),
|
|
7339
|
+
'lido-slide-fill': index.h("lido-slide-fill", Object.assign({}, props), children),
|
|
7340
|
+
'lido-float': index.h("lido-float", Object.assign({}, props), children),
|
|
6950
7341
|
};
|
|
6951
7342
|
// If the tag is known, return the corresponding Stencil component, otherwise log a warning
|
|
6952
7343
|
if (componentMapping[tagName]) {
|
|
@@ -6963,24 +7354,33 @@ const LidoHome = class {
|
|
|
6963
7354
|
* @param rootElement - The root element of the parsed XML document.
|
|
6964
7355
|
*/
|
|
6965
7356
|
parseContainers(rootElement) {
|
|
6966
|
-
const containers = [];
|
|
6967
7357
|
const containerElements = rootElement.querySelectorAll('lido-container');
|
|
6968
|
-
|
|
6969
|
-
|
|
6970
|
-
|
|
6971
|
-
if (parsedElement) {
|
|
6972
|
-
containers.push(parsedElement);
|
|
6973
|
-
}
|
|
7358
|
+
const containers = Array.from(containerElements).map(container => {
|
|
7359
|
+
// Return a factory function that generates a fresh JSX node each time
|
|
7360
|
+
return () => this.parseElement(container);
|
|
6974
7361
|
});
|
|
6975
7362
|
this.containers = containers;
|
|
6976
7363
|
}
|
|
7364
|
+
async btnpopup() {
|
|
7365
|
+
await utils.AudioPlayer.getI().stop();
|
|
7366
|
+
const container = document.getElementById(utils.LidoContainer);
|
|
7367
|
+
const allele = container.querySelectorAll('*');
|
|
7368
|
+
for (const el of Array.from(allele)) {
|
|
7369
|
+
const tabIndex = el.getAttribute('tab-index');
|
|
7370
|
+
const htmlel = el;
|
|
7371
|
+
if (tabIndex && utils.number(tabIndex) > 0) {
|
|
7372
|
+
await utils.AudioPlayer.getI().play(htmlel);
|
|
7373
|
+
await new Promise(resolve => setTimeout(resolve, 300));
|
|
7374
|
+
}
|
|
7375
|
+
}
|
|
7376
|
+
}
|
|
6977
7377
|
/**
|
|
6978
7378
|
* Renders navigation dots for each container, indicating the progress of the user.
|
|
6979
7379
|
* Clicking on a dot allows the user to jump to a specific container.
|
|
6980
7380
|
*/
|
|
6981
7381
|
renderDots() {
|
|
6982
7382
|
const style = { pointerEvents: this.canplay ? 'none' : '' };
|
|
6983
|
-
return (index.h("div", { id: "lido-dot-indicator", class: "lido-dot-container",
|
|
7383
|
+
return (index.h("div", { id: "lido-dot-indicator", class: "lido-dot-container" }, index.h("div", { class: "lido-exit-button", onClick: () => (this.exitFlag = true) }, index.h("lido-image", { src: "https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/Navbar-buttons/Close.svg" })), index.h("div", { class: "lido-btn-dot-container" }, index.h("div", { id: "lido-arrow-left" }, index.h("lido-image", { src: "https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/Navbar-buttons/Previous.svg", onTouch: "this.prevBtn='true';" })), this.containers.map((_, index$1) => (index.h("span", { class: `lido-dot ${index$1 < this.currentContainerIndex ? 'completed' : index$1 === this.currentContainerIndex ? 'current' : ''}`, onClick: () => this.jumpToContainer(index$1), style: style }))), index.h("div", { id: "lido-arrow-right" }, index.h("lido-image", { src: "https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/Navbar-buttons/Next.svg", onTouch: "this.nextBtn='true';" }))), index.h("div", { id: "main-audio", onClick: () => this.btnpopup() }, index.h("lido-image", { visible: "true", src: "https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/Navbar-buttons/Audio%20icon.svg" }))));
|
|
6984
7384
|
}
|
|
6985
7385
|
/**
|
|
6986
7386
|
* Jumps to a specific container based on the index of the dot clicked.
|
|
@@ -6993,88 +7393,2730 @@ const LidoHome = class {
|
|
|
6993
7393
|
// this.containers = [...this.containers]; // Trigger re-render
|
|
6994
7394
|
}
|
|
6995
7395
|
render() {
|
|
7396
|
+
var _a, _b;
|
|
7397
|
+
console.log('🚀 ~ LidoHome ~ render ~ this.containers:', this);
|
|
6996
7398
|
if (!this.xmlData) {
|
|
6997
7399
|
// If no XML data is provided, prompt the user to provide it
|
|
6998
7400
|
return index.h("div", null, "Please provide XML data.");
|
|
6999
7401
|
}
|
|
7000
|
-
return (index.h(index.Host, { index: this.currentContainerIndex, totalIndex: this.containers.length }, index.h("div", { key: this.currentContainerIndex }, this.containers[this.currentContainerIndex]), this.renderDots(), this.showCompletionMessage && index.h("div", { class: "lido-snackbar" }, "All containers have been displayed!")));
|
|
7402
|
+
return (index.h(index.Host, { class: "lido-home", index: this.currentContainerIndex, totalIndex: this.containers.length }, index.h("div", { key: this.currentContainerIndex }, (_b = (_a = this.containers)[this.currentContainerIndex]) === null || _b === void 0 ? void 0 : _b.call(_a)), this.showDotsandbtn && this.renderDots(), this.exitFlag && (index.h("div", { class: "lido-alert-popup" }, index.h("lido-cell", { class: "lido-alert-content", visible: "true", layout: "col", width: "400px", height: "300px", "bg-color": "#fff", "border-radius": "30px", onEntry: "this.border='4px solid #F34D08';" }, index.h("lido-text", { visible: "true", string: "Are you sure you want to exit the game?", width: "90%", "font-size": "36px" }), index.h("lido-cell", { visible: "true", layout: "row", width: "80%" }, index.h("lido-text", { visible: "true", string: "Cancel", "font-size": "36px", class: "cancel-btn", onClick: () => this.popUpClick('cancel') }), index.h("lido-text", { visible: "true", string: "Yes", "font-size": "36px", class: "yes-btn", onClick: () => this.popUpClick('cancel') }))))), this.showCompletionMessage && index.h("div", { class: "lido-snackbar" }, "All containers have been displayed!")));
|
|
7001
7403
|
}
|
|
7404
|
+
get el() { return index.getElement(this); }
|
|
7405
|
+
static get watchers() { return {
|
|
7406
|
+
"xmlData": ["onXmlDataChange"]
|
|
7407
|
+
}; }
|
|
7002
7408
|
};
|
|
7003
7409
|
LidoHome.style = LidoHomeStyle0 + (LidoHomeStyle1 + LidoHomeStyle2);
|
|
7004
7410
|
|
|
7005
|
-
|
|
7006
|
-
const LidoImageStyle0 = lidoImageCss;
|
|
7411
|
+
var lib = {exports: {}};
|
|
7007
7412
|
|
|
7008
|
-
|
|
7009
|
-
|
|
7010
|
-
|
|
7011
|
-
|
|
7012
|
-
|
|
7013
|
-
|
|
7014
|
-
|
|
7015
|
-
|
|
7016
|
-
|
|
7017
|
-
|
|
7018
|
-
|
|
7019
|
-
|
|
7020
|
-
|
|
7021
|
-
|
|
7022
|
-
|
|
7023
|
-
|
|
7024
|
-
|
|
7025
|
-
|
|
7026
|
-
|
|
7027
|
-
|
|
7028
|
-
|
|
7029
|
-
|
|
7413
|
+
var colorToFilter = {};
|
|
7414
|
+
|
|
7415
|
+
var errorHandling = {};
|
|
7416
|
+
|
|
7417
|
+
var errors = {};
|
|
7418
|
+
|
|
7419
|
+
(function (exports) {
|
|
7420
|
+
// if there are too many new issues being created, change the below variables to the following:
|
|
7421
|
+
// export const UNEXPECTED_ERROR_MESSAGE_PREFIX =
|
|
7422
|
+
// 'Unexpected error has occurred, please report this by creating a new issue in the following link: ';
|
|
7423
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7424
|
+
exports.MUST_INSTALL_PUPPETEER = exports.DEFAULT_CONVERSION_ERROR_MESSAGE = exports.UNEXPECTED_ERROR_MESSAGE_INTRODUCTION = exports.UNEXPECTED_ERROR_MESSAGE_LINK = exports.UNEXPECTED_ERROR_MESSAGE_PREFIX = void 0;
|
|
7425
|
+
// export const UNEXPECTED_ERROR_MESSAGE_LINK = 'https://github.com/OvidijusParsiunas/css-filter-converter/issues';
|
|
7426
|
+
exports.UNEXPECTED_ERROR_MESSAGE_PREFIX = 'Unexpected error has occurred, please report this by using the following link: ';
|
|
7427
|
+
exports.UNEXPECTED_ERROR_MESSAGE_LINK = 'https://github.com/OvidijusParsiunas/css-filter-converter/issues/new';
|
|
7428
|
+
exports.UNEXPECTED_ERROR_MESSAGE_INTRODUCTION = exports.UNEXPECTED_ERROR_MESSAGE_PREFIX + exports.UNEXPECTED_ERROR_MESSAGE_LINK;
|
|
7429
|
+
exports.DEFAULT_CONVERSION_ERROR_MESSAGE = 'Input value is invalid';
|
|
7430
|
+
exports.MUST_INSTALL_PUPPETEER = "To convert filter values to color in Node - you will first need to install 'puppeteer' by running:" +
|
|
7431
|
+
' \n npm install puppeteer';
|
|
7432
|
+
}(errors));
|
|
7433
|
+
|
|
7434
|
+
Object.defineProperty(errorHandling, "__esModule", { value: true });
|
|
7435
|
+
errorHandling.ErrorHandling = void 0;
|
|
7436
|
+
const errors_1$1 = errors;
|
|
7437
|
+
class ErrorHandling {
|
|
7438
|
+
static generateErrorResult(message) {
|
|
7439
|
+
return { color: null, error: { message } };
|
|
7440
|
+
}
|
|
7441
|
+
static generateInputErrorMessage(colorType, colorString, format) {
|
|
7442
|
+
const errorPrefix = `Input ${colorType} color string could not be parsed.`;
|
|
7443
|
+
const actualStringReceived = `String received: ${colorString}.`;
|
|
7444
|
+
const messageStrings = [errorPrefix, actualStringReceived];
|
|
7445
|
+
if (format) {
|
|
7446
|
+
const expectedFormat = `Expected format: ${format}.`;
|
|
7447
|
+
messageStrings.splice(1, 0, expectedFormat);
|
|
7448
|
+
}
|
|
7449
|
+
return messageStrings.join(' ');
|
|
7450
|
+
}
|
|
7451
|
+
static generateUnexpectedError(error) {
|
|
7452
|
+
const errorMessage = `${errors_1$1.UNEXPECTED_ERROR_MESSAGE_INTRODUCTION}: \n${error.message}`;
|
|
7453
|
+
return ErrorHandling.generateErrorResult(errorMessage);
|
|
7454
|
+
}
|
|
7455
|
+
static hasError(param) {
|
|
7456
|
+
return !!param.errorMessage;
|
|
7030
7457
|
}
|
|
7031
|
-
|
|
7032
|
-
|
|
7033
|
-
|
|
7034
|
-
|
|
7035
|
-
|
|
7036
|
-
|
|
7458
|
+
}
|
|
7459
|
+
errorHandling.ErrorHandling = ErrorHandling;
|
|
7460
|
+
|
|
7461
|
+
var sheenUtil = {};
|
|
7462
|
+
|
|
7463
|
+
Object.defineProperty(sheenUtil, "__esModule", { value: true });
|
|
7464
|
+
sheenUtil.SheenUtil = void 0;
|
|
7465
|
+
class SheenUtil {
|
|
7466
|
+
static parseSheenFromOptions(options) {
|
|
7467
|
+
if (options) {
|
|
7468
|
+
if (typeof options.sheen === 'boolean')
|
|
7469
|
+
return options.sheen;
|
|
7470
|
+
}
|
|
7471
|
+
return true;
|
|
7037
7472
|
}
|
|
7038
|
-
|
|
7039
|
-
|
|
7040
|
-
|
|
7041
|
-
|
|
7042
|
-
|
|
7043
|
-
|
|
7044
|
-
|
|
7045
|
-
|
|
7473
|
+
}
|
|
7474
|
+
sheenUtil.SheenUtil = SheenUtil;
|
|
7475
|
+
SheenUtil.SHEEN_FILTER_PREFIX = 'brightness(0) saturate(100%)';
|
|
7476
|
+
|
|
7477
|
+
var colorTypes = {};
|
|
7478
|
+
|
|
7479
|
+
(function (exports) {
|
|
7480
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7481
|
+
exports.ColorTypes = void 0;
|
|
7482
|
+
(function (ColorTypes) {
|
|
7483
|
+
ColorTypes["HEX"] = "hex";
|
|
7484
|
+
ColorTypes["RGB"] = "rgb";
|
|
7485
|
+
ColorTypes["HSL"] = "hsl";
|
|
7486
|
+
ColorTypes["KEYWORD"] = "keyword";
|
|
7487
|
+
ColorTypes["FILTER"] = "filter";
|
|
7488
|
+
})(exports.ColorTypes || (exports.ColorTypes = {}));
|
|
7489
|
+
}(colorTypes));
|
|
7490
|
+
|
|
7491
|
+
var rgbToFilter = {};
|
|
7492
|
+
|
|
7493
|
+
var rgbToFilterWorker = {};
|
|
7494
|
+
|
|
7495
|
+
var rgbColor = {};
|
|
7496
|
+
|
|
7497
|
+
Object.defineProperty(rgbColor, "__esModule", { value: true });
|
|
7498
|
+
rgbColor.RgbColor = void 0;
|
|
7499
|
+
class RgbColor {
|
|
7500
|
+
constructor(rgb = [0, 0, 0]) {
|
|
7501
|
+
this.r = this.clamp(rgb[0]);
|
|
7502
|
+
this.g = this.clamp(rgb[1]);
|
|
7503
|
+
this.b = this.clamp(rgb[2]);
|
|
7504
|
+
}
|
|
7505
|
+
clamp(value) {
|
|
7506
|
+
if (value > 255) {
|
|
7507
|
+
value = 255;
|
|
7508
|
+
}
|
|
7509
|
+
else if (value < 0) {
|
|
7510
|
+
value = 0;
|
|
7511
|
+
}
|
|
7512
|
+
return value;
|
|
7513
|
+
}
|
|
7514
|
+
setRgb(r, g, b) {
|
|
7515
|
+
this.r = this.clamp(r);
|
|
7516
|
+
this.g = this.clamp(g);
|
|
7517
|
+
this.b = this.clamp(b);
|
|
7518
|
+
}
|
|
7519
|
+
multiply(matrix) {
|
|
7520
|
+
const newR = this.clamp(this.r * matrix[0] + this.g * matrix[1] + this.b * matrix[2]);
|
|
7521
|
+
const newG = this.clamp(this.r * matrix[3] + this.g * matrix[4] + this.b * matrix[5]);
|
|
7522
|
+
const newB = this.clamp(this.r * matrix[6] + this.g * matrix[7] + this.b * matrix[8]);
|
|
7523
|
+
this.r = newR;
|
|
7524
|
+
this.g = newG;
|
|
7525
|
+
this.b = newB;
|
|
7526
|
+
}
|
|
7527
|
+
hueRotate(angle = 0) {
|
|
7528
|
+
angle = (angle / 180) * Math.PI;
|
|
7529
|
+
const sin = Math.sin(angle);
|
|
7530
|
+
const cos = Math.cos(angle);
|
|
7531
|
+
this.multiply([
|
|
7532
|
+
0.213 + cos * 0.787 - sin * 0.213,
|
|
7533
|
+
0.715 - cos * 0.715 - sin * 0.715,
|
|
7534
|
+
0.072 - cos * 0.072 + sin * 0.928,
|
|
7535
|
+
0.213 - cos * 0.213 + sin * 0.143,
|
|
7536
|
+
0.715 + cos * 0.285 + sin * 0.14,
|
|
7537
|
+
0.072 - cos * 0.072 - sin * 0.283,
|
|
7538
|
+
0.213 - cos * 0.213 - sin * 0.787,
|
|
7539
|
+
0.715 - cos * 0.715 + sin * 0.715,
|
|
7540
|
+
0.072 + cos * 0.928 + sin * 0.072,
|
|
7541
|
+
]);
|
|
7542
|
+
}
|
|
7543
|
+
sepia(value = 1) {
|
|
7544
|
+
this.multiply([
|
|
7545
|
+
0.393 + 0.607 * (1 - value),
|
|
7546
|
+
0.769 - 0.769 * (1 - value),
|
|
7547
|
+
0.189 - 0.189 * (1 - value),
|
|
7548
|
+
0.349 - 0.349 * (1 - value),
|
|
7549
|
+
0.686 + 0.314 * (1 - value),
|
|
7550
|
+
0.168 - 0.168 * (1 - value),
|
|
7551
|
+
0.272 - 0.272 * (1 - value),
|
|
7552
|
+
0.534 - 0.534 * (1 - value),
|
|
7553
|
+
0.131 + 0.869 * (1 - value),
|
|
7554
|
+
]);
|
|
7555
|
+
}
|
|
7556
|
+
saturate(value = 1) {
|
|
7557
|
+
this.multiply([
|
|
7558
|
+
0.213 + 0.787 * value,
|
|
7559
|
+
0.715 - 0.715 * value,
|
|
7560
|
+
0.072 - 0.072 * value,
|
|
7561
|
+
0.213 - 0.213 * value,
|
|
7562
|
+
0.715 + 0.285 * value,
|
|
7563
|
+
0.072 - 0.072 * value,
|
|
7564
|
+
0.213 - 0.213 * value,
|
|
7565
|
+
0.715 - 0.715 * value,
|
|
7566
|
+
0.072 + 0.928 * value,
|
|
7567
|
+
]);
|
|
7568
|
+
}
|
|
7569
|
+
linear(slope = 1, intercept = 0) {
|
|
7570
|
+
this.r = this.clamp(this.r * slope + intercept * 255);
|
|
7571
|
+
this.g = this.clamp(this.g * slope + intercept * 255);
|
|
7572
|
+
this.b = this.clamp(this.b * slope + intercept * 255);
|
|
7573
|
+
}
|
|
7574
|
+
brightness(value = 1) {
|
|
7575
|
+
this.linear(value);
|
|
7576
|
+
}
|
|
7577
|
+
contrast(value = 1) {
|
|
7578
|
+
this.linear(value, -(0.5 * value) + 0.5);
|
|
7579
|
+
}
|
|
7580
|
+
invert(value = 1) {
|
|
7581
|
+
this.r = this.clamp((value + (this.r / 255) * (1 - 2 * value)) * 255);
|
|
7582
|
+
this.g = this.clamp((value + (this.g / 255) * (1 - 2 * value)) * 255);
|
|
7583
|
+
this.b = this.clamp((value + (this.b / 255) * (1 - 2 * value)) * 255);
|
|
7046
7584
|
}
|
|
7047
|
-
|
|
7048
|
-
|
|
7049
|
-
|
|
7585
|
+
}
|
|
7586
|
+
rgbColor.RgbColor = RgbColor;
|
|
7587
|
+
|
|
7588
|
+
// the code used within this class has been taken and modified from the following codepen owned by Barrett Sonntag:
|
|
7589
|
+
// https://codepen.io/sosuke/pen/Pjoqqp
|
|
7590
|
+
Object.defineProperty(rgbToFilterWorker, "__esModule", { value: true });
|
|
7591
|
+
rgbToFilterWorker.RgbToFilterWorker = void 0;
|
|
7592
|
+
const sheenUtil_1$1 = sheenUtil;
|
|
7593
|
+
const rgbColor_1$1 = rgbColor;
|
|
7594
|
+
class RgbToFilterWorker {
|
|
7595
|
+
constructor(targetRgbColor, addSheen) {
|
|
7596
|
+
this.targetRgbColor = targetRgbColor;
|
|
7597
|
+
this.reusedRgbColor = new rgbColor_1$1.RgbColor();
|
|
7598
|
+
this.addSheen = addSheen;
|
|
7599
|
+
}
|
|
7600
|
+
static fmt(filters, idx, multiplier = 1) {
|
|
7601
|
+
return Math.round(filters[idx] * multiplier);
|
|
7602
|
+
}
|
|
7603
|
+
generateCss(filters) {
|
|
7604
|
+
const prefix = this.addSheen ? `${sheenUtil_1$1.SheenUtil.SHEEN_FILTER_PREFIX} ` : '';
|
|
7605
|
+
// prettier-ignore
|
|
7606
|
+
// eslint-disable-next-line max-len
|
|
7607
|
+
return `${prefix}invert(${RgbToFilterWorker.fmt(filters, 0)}%) sepia(${RgbToFilterWorker.fmt(filters, 1)}%) saturate(${RgbToFilterWorker.fmt(filters, 2)}%) hue-rotate(${RgbToFilterWorker.fmt(filters, 3, 3.6)}deg) brightness(${RgbToFilterWorker.fmt(filters, 4)}%) contrast(${RgbToFilterWorker.fmt(filters, 5)}%)`;
|
|
7608
|
+
}
|
|
7609
|
+
loss(filters) {
|
|
7610
|
+
this.reusedRgbColor.setRgb(0, 0, 0);
|
|
7611
|
+
this.reusedRgbColor.invert(filters[0] / 100);
|
|
7612
|
+
this.reusedRgbColor.sepia(filters[1] / 100);
|
|
7613
|
+
this.reusedRgbColor.saturate(filters[2] / 100);
|
|
7614
|
+
this.reusedRgbColor.hueRotate(filters[3] * 3.6);
|
|
7615
|
+
this.reusedRgbColor.brightness(filters[4] / 100);
|
|
7616
|
+
this.reusedRgbColor.contrast(filters[5] / 100);
|
|
7617
|
+
return (Math.abs(this.reusedRgbColor.r - this.targetRgbColor.r) +
|
|
7618
|
+
Math.abs(this.reusedRgbColor.g - this.targetRgbColor.g) +
|
|
7619
|
+
Math.abs(this.reusedRgbColor.b - this.targetRgbColor.b));
|
|
7620
|
+
}
|
|
7621
|
+
static fixSpsa(value, idx) {
|
|
7622
|
+
let max = 100;
|
|
7623
|
+
if (idx === 2 /* saturate */) {
|
|
7624
|
+
max = 7500;
|
|
7625
|
+
}
|
|
7626
|
+
else if (idx === 4 /* brightness */ || idx === 5 /* contrast */) {
|
|
7627
|
+
max = 200;
|
|
7628
|
+
}
|
|
7629
|
+
if (idx === 3 /* hue-rotate */) {
|
|
7630
|
+
if (value > max) {
|
|
7631
|
+
value %= max;
|
|
7632
|
+
}
|
|
7633
|
+
else if (value < 0) {
|
|
7634
|
+
value = max + (value % max);
|
|
7635
|
+
}
|
|
7636
|
+
}
|
|
7637
|
+
else if (value < 0) {
|
|
7638
|
+
value = 0;
|
|
7639
|
+
}
|
|
7640
|
+
else if (value > max) {
|
|
7641
|
+
value = max;
|
|
7642
|
+
}
|
|
7643
|
+
return value;
|
|
7644
|
+
}
|
|
7645
|
+
spsa(A, a, c, values, iters) {
|
|
7646
|
+
const alpha = 1;
|
|
7647
|
+
const gamma = 0.16666666666666666;
|
|
7648
|
+
let best = [];
|
|
7649
|
+
let bestLoss = Infinity;
|
|
7650
|
+
const deltas = new Array(6);
|
|
7651
|
+
const highArgs = new Array(6);
|
|
7652
|
+
const lowArgs = new Array(6);
|
|
7653
|
+
for (let k = 0; k < iters; k += 1) {
|
|
7654
|
+
const ck = c / Math.pow(k + 1, gamma);
|
|
7655
|
+
for (let i = 0; i < 6; i += 1) {
|
|
7656
|
+
deltas[i] = Math.random() > 0.5 ? 1 : -1;
|
|
7657
|
+
highArgs[i] = values[i] + ck * deltas[i];
|
|
7658
|
+
lowArgs[i] = values[i] - ck * deltas[i];
|
|
7659
|
+
}
|
|
7660
|
+
const lossDiff = this.loss(highArgs) - this.loss(lowArgs);
|
|
7661
|
+
for (let i = 0; i < 6; i += 1) {
|
|
7662
|
+
const g = (lossDiff / (2 * ck)) * deltas[i];
|
|
7663
|
+
const ak = a[i] / Math.pow(A + k + 1, alpha);
|
|
7664
|
+
values[i] = RgbToFilterWorker.fixSpsa(values[i] - ak * g, i);
|
|
7665
|
+
}
|
|
7666
|
+
const loss = this.loss(values);
|
|
7667
|
+
if (loss < bestLoss) {
|
|
7668
|
+
best = values.slice(0);
|
|
7669
|
+
bestLoss = loss;
|
|
7670
|
+
}
|
|
7671
|
+
}
|
|
7672
|
+
return { values: best, loss: bestLoss };
|
|
7673
|
+
}
|
|
7674
|
+
solveNarrow(wide) {
|
|
7675
|
+
const A = wide.loss;
|
|
7676
|
+
const c = 2;
|
|
7677
|
+
const A1 = A + 1;
|
|
7678
|
+
const a = [0.25 * A1, 0.25 * A1, A1, 0.25 * A1, 0.2 * A1, 0.2 * A1];
|
|
7679
|
+
return this.spsa(A, a, c, wide.values, 500);
|
|
7680
|
+
}
|
|
7681
|
+
solveWide() {
|
|
7682
|
+
const A = 5;
|
|
7683
|
+
const c = 15;
|
|
7684
|
+
const a = [60, 180, 18000, 600, 1.2, 1.2];
|
|
7685
|
+
let best = { values: [], loss: Infinity };
|
|
7686
|
+
for (let i = 0; best.loss > 25 && i < 3; i += 1) {
|
|
7687
|
+
const initial = [50, 20, 3750, 50, 100, 100];
|
|
7688
|
+
const result = this.spsa(A, a, c, initial, 1000);
|
|
7689
|
+
if (result.loss < best.loss) {
|
|
7690
|
+
best = result;
|
|
7691
|
+
}
|
|
7692
|
+
}
|
|
7693
|
+
return best;
|
|
7050
7694
|
}
|
|
7051
|
-
|
|
7052
|
-
const
|
|
7053
|
-
|
|
7054
|
-
|
|
7055
|
-
|
|
7056
|
-
backgroundColor: utils.parseProp(this.bgColor, orientation),
|
|
7057
|
-
top: utils.parseProp(this.y, orientation),
|
|
7058
|
-
left: utils.parseProp(this.x, orientation),
|
|
7059
|
-
zIndex: this.z,
|
|
7060
|
-
display: JSON.parse(utils.parseProp(`${this.visible}`, orientation)) ? 'flex' : 'none', // Toggle visibility
|
|
7061
|
-
alignItems: 'center', // Vertically center the image
|
|
7062
|
-
justifyContent: 'center', // Horizontally center the image
|
|
7695
|
+
convert() {
|
|
7696
|
+
const result = this.solveNarrow(this.solveWide());
|
|
7697
|
+
return {
|
|
7698
|
+
loss: result.loss,
|
|
7699
|
+
color: this.generateCss(result.values),
|
|
7063
7700
|
};
|
|
7064
7701
|
}
|
|
7065
|
-
|
|
7066
|
-
|
|
7067
|
-
}
|
|
7068
|
-
get el() { return index.getElement(this); }
|
|
7069
|
-
};
|
|
7070
|
-
LidoImage.style = LidoImageStyle0;
|
|
7702
|
+
}
|
|
7703
|
+
rgbToFilterWorker.RgbToFilterWorker = RgbToFilterWorker;
|
|
7071
7704
|
|
|
7072
|
-
|
|
7073
|
-
|
|
7705
|
+
Object.defineProperty(rgbToFilter, "__esModule", { value: true });
|
|
7706
|
+
rgbToFilter.RgbToFilter = void 0;
|
|
7707
|
+
const errorHandling_1$5 = errorHandling;
|
|
7708
|
+
const errors_1 = errors;
|
|
7709
|
+
const rgbToFilterWorker_1 = rgbToFilterWorker;
|
|
7710
|
+
const rgbColor_1 = rgbColor;
|
|
7711
|
+
class RgbToFilter {
|
|
7712
|
+
static generateConversionError(conversionErrorMessage) {
|
|
7713
|
+
const errorMessage = conversionErrorMessage || errors_1.DEFAULT_CONVERSION_ERROR_MESSAGE;
|
|
7714
|
+
return errorHandling_1$5.ErrorHandling.generateErrorResult(errorMessage);
|
|
7715
|
+
}
|
|
7716
|
+
static generateValidateAndParseError(errorMessage) {
|
|
7717
|
+
return errorHandling_1$5.ErrorHandling.generateErrorResult(errorMessage);
|
|
7718
|
+
}
|
|
7719
|
+
static execute(rgb, addSheen) {
|
|
7720
|
+
const rgbColor = new rgbColor_1.RgbColor(rgb);
|
|
7721
|
+
const rgbToFilter = new rgbToFilterWorker_1.RgbToFilterWorker(rgbColor, addSheen);
|
|
7722
|
+
return rgbToFilter.convert();
|
|
7723
|
+
}
|
|
7724
|
+
static convertToRGB(parseResultColor, convertToRgb) {
|
|
7725
|
+
if (parseResultColor && convertToRgb) {
|
|
7726
|
+
return convertToRgb(parseResultColor);
|
|
7727
|
+
}
|
|
7728
|
+
return null;
|
|
7729
|
+
}
|
|
7730
|
+
static convert(conversionProps) {
|
|
7731
|
+
try {
|
|
7732
|
+
const { colorString, validateAndParse, convertToRgb, conversionErrorMessage, addSheen } = conversionProps;
|
|
7733
|
+
const trimmedString = colorString.trim().toLocaleLowerCase();
|
|
7734
|
+
const parseResult = (validateAndParse === null || validateAndParse === void 0 ? void 0 : validateAndParse(trimmedString)) || { color: trimmedString };
|
|
7735
|
+
if (errorHandling_1$5.ErrorHandling.hasError(parseResult))
|
|
7736
|
+
return RgbToFilter.generateValidateAndParseError(parseResult.errorMessage);
|
|
7737
|
+
const rgbColor = RgbToFilter.convertToRGB(parseResult.color, convertToRgb) || parseResult.color;
|
|
7738
|
+
if (!rgbColor)
|
|
7739
|
+
return RgbToFilter.generateConversionError(conversionErrorMessage);
|
|
7740
|
+
return RgbToFilter.execute(rgbColor, addSheen);
|
|
7741
|
+
}
|
|
7742
|
+
catch (error) {
|
|
7743
|
+
return errorHandling_1$5.ErrorHandling.generateUnexpectedError(error);
|
|
7744
|
+
}
|
|
7745
|
+
}
|
|
7746
|
+
}
|
|
7747
|
+
rgbToFilter.RgbToFilter = RgbToFilter;
|
|
7748
|
+
|
|
7749
|
+
var colorParser = {};
|
|
7750
|
+
|
|
7751
|
+
var regex = {};
|
|
7752
|
+
|
|
7753
|
+
Object.defineProperty(regex, "__esModule", { value: true });
|
|
7754
|
+
regex.MATCH_HEXADECIMAL = regex.MATCH_INTEGER_AND_FLOAT_NUMBERS = void 0;
|
|
7755
|
+
regex.MATCH_INTEGER_AND_FLOAT_NUMBERS = /(-?\d+(?:\.\d+)?)/g;
|
|
7756
|
+
regex.MATCH_HEXADECIMAL = /^#[0-9a-f]{3}([0-9a-f]{3})?$/i;
|
|
7757
|
+
|
|
7758
|
+
var inputLimits = {};
|
|
7759
|
+
|
|
7760
|
+
Object.defineProperty(inputLimits, "__esModule", { value: true });
|
|
7761
|
+
inputLimits.MAX_COLOR_INPUT_STRING_LENGTH = void 0;
|
|
7762
|
+
// this is used to prevent regex matcher from evaluating a long string that can be assumed to be incorrect
|
|
7763
|
+
// currently not applied to filter
|
|
7764
|
+
inputLimits.MAX_COLOR_INPUT_STRING_LENGTH = 25;
|
|
7765
|
+
|
|
7766
|
+
var colorFormats = {};
|
|
7767
|
+
|
|
7768
|
+
(function (exports) {
|
|
7769
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7770
|
+
exports.ColorFormats = void 0;
|
|
7771
|
+
(function (ColorFormats) {
|
|
7772
|
+
ColorFormats["HEX"] = "#ffffff or #fff";
|
|
7773
|
+
ColorFormats["RGB"] = "rgb([0-255], [0-255], [0-255]) or rgb([0-255], [0-255], [0-255], [0-1]) or rgb([0-100%], [0-100%], [0-100%]) or rgb([0-100%], [0-100%], [0-100%], [0-100%]) or [0-255], [0-255], [0-255] or [0-255] [0-255] [0-255]";
|
|
7774
|
+
ColorFormats["HSL"] = "hsl([0-360], [0-100], [0-100]) or hsl([0-360], [0-100%], [0-100%]) or [0-360], [0-100], [0-100] or [0-360] [0-100] [0-100]";
|
|
7775
|
+
ColorFormats["FILTER"] = "blur(), brightness(), contrast(), drop-shadow(), grayscale(), hue-rotate(), invert(), saturate(), sepia() with each parameter populated with %, px or deg where approriate e.g. contrast(101%)";
|
|
7776
|
+
ColorFormats["KEYWORD"] = "Generic color string. See the following link for all available colors: https://github.com/colorjs/color-name/blob/master/index.js";
|
|
7777
|
+
})(exports.ColorFormats || (exports.ColorFormats = {}));
|
|
7778
|
+
}(colorFormats));
|
|
7779
|
+
|
|
7780
|
+
var colorName = {
|
|
7781
|
+
"aliceblue": [240, 248, 255],
|
|
7782
|
+
"antiquewhite": [250, 235, 215],
|
|
7783
|
+
"aqua": [0, 255, 255],
|
|
7784
|
+
"aquamarine": [127, 255, 212],
|
|
7785
|
+
"azure": [240, 255, 255],
|
|
7786
|
+
"beige": [245, 245, 220],
|
|
7787
|
+
"bisque": [255, 228, 196],
|
|
7788
|
+
"black": [0, 0, 0],
|
|
7789
|
+
"blanchedalmond": [255, 235, 205],
|
|
7790
|
+
"blue": [0, 0, 255],
|
|
7791
|
+
"blueviolet": [138, 43, 226],
|
|
7792
|
+
"brown": [165, 42, 42],
|
|
7793
|
+
"burlywood": [222, 184, 135],
|
|
7794
|
+
"cadetblue": [95, 158, 160],
|
|
7795
|
+
"chartreuse": [127, 255, 0],
|
|
7796
|
+
"chocolate": [210, 105, 30],
|
|
7797
|
+
"coral": [255, 127, 80],
|
|
7798
|
+
"cornflowerblue": [100, 149, 237],
|
|
7799
|
+
"cornsilk": [255, 248, 220],
|
|
7800
|
+
"crimson": [220, 20, 60],
|
|
7801
|
+
"cyan": [0, 255, 255],
|
|
7802
|
+
"darkblue": [0, 0, 139],
|
|
7803
|
+
"darkcyan": [0, 139, 139],
|
|
7804
|
+
"darkgoldenrod": [184, 134, 11],
|
|
7805
|
+
"darkgray": [169, 169, 169],
|
|
7806
|
+
"darkgreen": [0, 100, 0],
|
|
7807
|
+
"darkgrey": [169, 169, 169],
|
|
7808
|
+
"darkkhaki": [189, 183, 107],
|
|
7809
|
+
"darkmagenta": [139, 0, 139],
|
|
7810
|
+
"darkolivegreen": [85, 107, 47],
|
|
7811
|
+
"darkorange": [255, 140, 0],
|
|
7812
|
+
"darkorchid": [153, 50, 204],
|
|
7813
|
+
"darkred": [139, 0, 0],
|
|
7814
|
+
"darksalmon": [233, 150, 122],
|
|
7815
|
+
"darkseagreen": [143, 188, 143],
|
|
7816
|
+
"darkslateblue": [72, 61, 139],
|
|
7817
|
+
"darkslategray": [47, 79, 79],
|
|
7818
|
+
"darkslategrey": [47, 79, 79],
|
|
7819
|
+
"darkturquoise": [0, 206, 209],
|
|
7820
|
+
"darkviolet": [148, 0, 211],
|
|
7821
|
+
"deeppink": [255, 20, 147],
|
|
7822
|
+
"deepskyblue": [0, 191, 255],
|
|
7823
|
+
"dimgray": [105, 105, 105],
|
|
7824
|
+
"dimgrey": [105, 105, 105],
|
|
7825
|
+
"dodgerblue": [30, 144, 255],
|
|
7826
|
+
"firebrick": [178, 34, 34],
|
|
7827
|
+
"floralwhite": [255, 250, 240],
|
|
7828
|
+
"forestgreen": [34, 139, 34],
|
|
7829
|
+
"fuchsia": [255, 0, 255],
|
|
7830
|
+
"gainsboro": [220, 220, 220],
|
|
7831
|
+
"ghostwhite": [248, 248, 255],
|
|
7832
|
+
"gold": [255, 215, 0],
|
|
7833
|
+
"goldenrod": [218, 165, 32],
|
|
7834
|
+
"gray": [128, 128, 128],
|
|
7835
|
+
"green": [0, 128, 0],
|
|
7836
|
+
"greenyellow": [173, 255, 47],
|
|
7837
|
+
"grey": [128, 128, 128],
|
|
7838
|
+
"honeydew": [240, 255, 240],
|
|
7839
|
+
"hotpink": [255, 105, 180],
|
|
7840
|
+
"indianred": [205, 92, 92],
|
|
7841
|
+
"indigo": [75, 0, 130],
|
|
7842
|
+
"ivory": [255, 255, 240],
|
|
7843
|
+
"khaki": [240, 230, 140],
|
|
7844
|
+
"lavender": [230, 230, 250],
|
|
7845
|
+
"lavenderblush": [255, 240, 245],
|
|
7846
|
+
"lawngreen": [124, 252, 0],
|
|
7847
|
+
"lemonchiffon": [255, 250, 205],
|
|
7848
|
+
"lightblue": [173, 216, 230],
|
|
7849
|
+
"lightcoral": [240, 128, 128],
|
|
7850
|
+
"lightcyan": [224, 255, 255],
|
|
7851
|
+
"lightgoldenrodyellow": [250, 250, 210],
|
|
7852
|
+
"lightgray": [211, 211, 211],
|
|
7853
|
+
"lightgreen": [144, 238, 144],
|
|
7854
|
+
"lightgrey": [211, 211, 211],
|
|
7855
|
+
"lightpink": [255, 182, 193],
|
|
7856
|
+
"lightsalmon": [255, 160, 122],
|
|
7857
|
+
"lightseagreen": [32, 178, 170],
|
|
7858
|
+
"lightskyblue": [135, 206, 250],
|
|
7859
|
+
"lightslategray": [119, 136, 153],
|
|
7860
|
+
"lightslategrey": [119, 136, 153],
|
|
7861
|
+
"lightsteelblue": [176, 196, 222],
|
|
7862
|
+
"lightyellow": [255, 255, 224],
|
|
7863
|
+
"lime": [0, 255, 0],
|
|
7864
|
+
"limegreen": [50, 205, 50],
|
|
7865
|
+
"linen": [250, 240, 230],
|
|
7866
|
+
"magenta": [255, 0, 255],
|
|
7867
|
+
"maroon": [128, 0, 0],
|
|
7868
|
+
"mediumaquamarine": [102, 205, 170],
|
|
7869
|
+
"mediumblue": [0, 0, 205],
|
|
7870
|
+
"mediumorchid": [186, 85, 211],
|
|
7871
|
+
"mediumpurple": [147, 112, 219],
|
|
7872
|
+
"mediumseagreen": [60, 179, 113],
|
|
7873
|
+
"mediumslateblue": [123, 104, 238],
|
|
7874
|
+
"mediumspringgreen": [0, 250, 154],
|
|
7875
|
+
"mediumturquoise": [72, 209, 204],
|
|
7876
|
+
"mediumvioletred": [199, 21, 133],
|
|
7877
|
+
"midnightblue": [25, 25, 112],
|
|
7878
|
+
"mintcream": [245, 255, 250],
|
|
7879
|
+
"mistyrose": [255, 228, 225],
|
|
7880
|
+
"moccasin": [255, 228, 181],
|
|
7881
|
+
"navajowhite": [255, 222, 173],
|
|
7882
|
+
"navy": [0, 0, 128],
|
|
7883
|
+
"oldlace": [253, 245, 230],
|
|
7884
|
+
"olive": [128, 128, 0],
|
|
7885
|
+
"olivedrab": [107, 142, 35],
|
|
7886
|
+
"orange": [255, 165, 0],
|
|
7887
|
+
"orangered": [255, 69, 0],
|
|
7888
|
+
"orchid": [218, 112, 214],
|
|
7889
|
+
"palegoldenrod": [238, 232, 170],
|
|
7890
|
+
"palegreen": [152, 251, 152],
|
|
7891
|
+
"paleturquoise": [175, 238, 238],
|
|
7892
|
+
"palevioletred": [219, 112, 147],
|
|
7893
|
+
"papayawhip": [255, 239, 213],
|
|
7894
|
+
"peachpuff": [255, 218, 185],
|
|
7895
|
+
"peru": [205, 133, 63],
|
|
7896
|
+
"pink": [255, 192, 203],
|
|
7897
|
+
"plum": [221, 160, 221],
|
|
7898
|
+
"powderblue": [176, 224, 230],
|
|
7899
|
+
"purple": [128, 0, 128],
|
|
7900
|
+
"rebeccapurple": [102, 51, 153],
|
|
7901
|
+
"red": [255, 0, 0],
|
|
7902
|
+
"rosybrown": [188, 143, 143],
|
|
7903
|
+
"royalblue": [65, 105, 225],
|
|
7904
|
+
"saddlebrown": [139, 69, 19],
|
|
7905
|
+
"salmon": [250, 128, 114],
|
|
7906
|
+
"sandybrown": [244, 164, 96],
|
|
7907
|
+
"seagreen": [46, 139, 87],
|
|
7908
|
+
"seashell": [255, 245, 238],
|
|
7909
|
+
"sienna": [160, 82, 45],
|
|
7910
|
+
"silver": [192, 192, 192],
|
|
7911
|
+
"skyblue": [135, 206, 235],
|
|
7912
|
+
"slateblue": [106, 90, 205],
|
|
7913
|
+
"slategray": [112, 128, 144],
|
|
7914
|
+
"slategrey": [112, 128, 144],
|
|
7915
|
+
"snow": [255, 250, 250],
|
|
7916
|
+
"springgreen": [0, 255, 127],
|
|
7917
|
+
"steelblue": [70, 130, 180],
|
|
7918
|
+
"tan": [210, 180, 140],
|
|
7919
|
+
"teal": [0, 128, 128],
|
|
7920
|
+
"thistle": [216, 191, 216],
|
|
7921
|
+
"tomato": [255, 99, 71],
|
|
7922
|
+
"turquoise": [64, 224, 208],
|
|
7923
|
+
"violet": [238, 130, 238],
|
|
7924
|
+
"wheat": [245, 222, 179],
|
|
7925
|
+
"white": [255, 255, 255],
|
|
7926
|
+
"whitesmoke": [245, 245, 245],
|
|
7927
|
+
"yellow": [255, 255, 0],
|
|
7928
|
+
"yellowgreen": [154, 205, 50]
|
|
7929
|
+
};
|
|
7930
|
+
|
|
7931
|
+
var __importDefault$2 = (utils.commonjsGlobal && utils.commonjsGlobal.__importDefault) || function (mod) {
|
|
7932
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7933
|
+
};
|
|
7934
|
+
Object.defineProperty(colorParser, "__esModule", { value: true });
|
|
7935
|
+
colorParser.ColorParser = void 0;
|
|
7936
|
+
const regex_1 = regex;
|
|
7937
|
+
const errorHandling_1$4 = errorHandling;
|
|
7938
|
+
const inputLimits_1 = inputLimits;
|
|
7939
|
+
const colorFormats_1$1 = colorFormats;
|
|
7940
|
+
const colorTypes_1$2 = colorTypes;
|
|
7941
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
7942
|
+
const color_name_1 = __importDefault$2(colorName);
|
|
7943
|
+
class ColorParser {
|
|
7944
|
+
static validateAndParseHex(hexString) {
|
|
7945
|
+
if (hexString.length < inputLimits_1.MAX_COLOR_INPUT_STRING_LENGTH) {
|
|
7946
|
+
const isValid = hexString.match(regex_1.MATCH_HEXADECIMAL);
|
|
7947
|
+
if (isValid)
|
|
7948
|
+
return { color: hexString };
|
|
7949
|
+
}
|
|
7950
|
+
return { errorMessage: errorHandling_1$4.ErrorHandling.generateInputErrorMessage(colorTypes_1$2.ColorTypes.HEX, hexString, colorFormats_1$1.ColorFormats.HEX) };
|
|
7951
|
+
}
|
|
7952
|
+
// the reason why this is simply parsing the first three digits instead of the tailored format is because the number
|
|
7953
|
+
// of variations of different inputs is very high. E.g. these are valid RGB values:
|
|
7954
|
+
// rgb(1,2,3)
|
|
7955
|
+
// rgb(1%,2%,3%)
|
|
7956
|
+
// rgb(1,2,3,0.5)
|
|
7957
|
+
// rgb(1 2 3 / 0.5)
|
|
7958
|
+
// rgb(1 2 3 / 50%)
|
|
7959
|
+
// Hence because the first three values are always consistent integers and the fourth is irrelevant, it is simpler to
|
|
7960
|
+
// parse the first three integers and use them accordingly
|
|
7961
|
+
static parseFirstThreeIntegersFromString(color) {
|
|
7962
|
+
if (color.length < inputLimits_1.MAX_COLOR_INPUT_STRING_LENGTH) {
|
|
7963
|
+
const regexResult = color.match(regex_1.MATCH_INTEGER_AND_FLOAT_NUMBERS);
|
|
7964
|
+
regex_1.MATCH_INTEGER_AND_FLOAT_NUMBERS.lastIndex = 0;
|
|
7965
|
+
if (regexResult && regexResult.length >= 3) {
|
|
7966
|
+
return regexResult.slice(0, 3).map((numberString) => Number.parseInt(numberString));
|
|
7967
|
+
}
|
|
7968
|
+
}
|
|
7969
|
+
return null;
|
|
7970
|
+
}
|
|
7971
|
+
static validateAndParseRgb(rgbString) {
|
|
7972
|
+
const rgb = ColorParser.parseFirstThreeIntegersFromString(rgbString);
|
|
7973
|
+
if (rgb && rgb[0] >= 0 && rgb[0] <= 255 && rgb[1] >= 0 && rgb[1] <= 255 && rgb[2] >= 0 && rgb[2] <= 255) {
|
|
7974
|
+
return { color: rgb };
|
|
7975
|
+
}
|
|
7976
|
+
return { errorMessage: errorHandling_1$4.ErrorHandling.generateInputErrorMessage(colorTypes_1$2.ColorTypes.RGB, rgbString, colorFormats_1$1.ColorFormats.RGB) };
|
|
7977
|
+
}
|
|
7978
|
+
static validateAndParseHsl(hslString) {
|
|
7979
|
+
const hsl = ColorParser.parseFirstThreeIntegersFromString(hslString);
|
|
7980
|
+
if (hsl && hsl[0] >= 0 && hsl[0] <= 360 && hsl[1] >= 0 && hsl[1] <= 100 && hsl[2] >= 0 && hsl[2] <= 100) {
|
|
7981
|
+
return { color: hsl };
|
|
7982
|
+
}
|
|
7983
|
+
return { errorMessage: errorHandling_1$4.ErrorHandling.generateInputErrorMessage(colorTypes_1$2.ColorTypes.HSL, hslString, colorFormats_1$1.ColorFormats.HSL) };
|
|
7984
|
+
}
|
|
7985
|
+
static validateAndParseKeyword(keyword) {
|
|
7986
|
+
if (keyword.length < inputLimits_1.MAX_COLOR_INPUT_STRING_LENGTH) {
|
|
7987
|
+
const isValid = color_name_1.default[keyword];
|
|
7988
|
+
if (isValid)
|
|
7989
|
+
return { color: keyword };
|
|
7990
|
+
}
|
|
7991
|
+
return { errorMessage: errorHandling_1$4.ErrorHandling.generateInputErrorMessage(colorTypes_1$2.ColorTypes.KEYWORD, keyword, colorFormats_1$1.ColorFormats.KEYWORD) };
|
|
7992
|
+
}
|
|
7993
|
+
}
|
|
7994
|
+
colorParser.ColorParser = ColorParser;
|
|
7995
|
+
|
|
7996
|
+
/* MIT license */
|
|
7997
|
+
|
|
7998
|
+
/* eslint-disable no-mixed-operators */
|
|
7999
|
+
const cssKeywords = colorName;
|
|
8000
|
+
|
|
8001
|
+
// NOTE: conversions should only return primitive values (i.e. arrays, or
|
|
8002
|
+
// values that give correct `typeof` results).
|
|
8003
|
+
// do not use box values types (i.e. Number(), String(), etc.)
|
|
8004
|
+
|
|
8005
|
+
const reverseKeywords = {};
|
|
8006
|
+
for (const key of Object.keys(cssKeywords)) {
|
|
8007
|
+
reverseKeywords[cssKeywords[key]] = key;
|
|
8008
|
+
}
|
|
8009
|
+
|
|
8010
|
+
const convert$1 = {
|
|
8011
|
+
rgb: {channels: 3, labels: 'rgb'},
|
|
8012
|
+
hsl: {channels: 3, labels: 'hsl'},
|
|
8013
|
+
hsv: {channels: 3, labels: 'hsv'},
|
|
8014
|
+
hwb: {channels: 3, labels: 'hwb'},
|
|
8015
|
+
cmyk: {channels: 4, labels: 'cmyk'},
|
|
8016
|
+
xyz: {channels: 3, labels: 'xyz'},
|
|
8017
|
+
lab: {channels: 3, labels: 'lab'},
|
|
8018
|
+
lch: {channels: 3, labels: 'lch'},
|
|
8019
|
+
hex: {channels: 1, labels: ['hex']},
|
|
8020
|
+
keyword: {channels: 1, labels: ['keyword']},
|
|
8021
|
+
ansi16: {channels: 1, labels: ['ansi16']},
|
|
8022
|
+
ansi256: {channels: 1, labels: ['ansi256']},
|
|
8023
|
+
hcg: {channels: 3, labels: ['h', 'c', 'g']},
|
|
8024
|
+
apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
|
|
8025
|
+
gray: {channels: 1, labels: ['gray']}
|
|
8026
|
+
};
|
|
8027
|
+
|
|
8028
|
+
var conversions$2 = convert$1;
|
|
8029
|
+
|
|
8030
|
+
// Hide .channels and .labels properties
|
|
8031
|
+
for (const model of Object.keys(convert$1)) {
|
|
8032
|
+
if (!('channels' in convert$1[model])) {
|
|
8033
|
+
throw new Error('missing channels property: ' + model);
|
|
8034
|
+
}
|
|
8035
|
+
|
|
8036
|
+
if (!('labels' in convert$1[model])) {
|
|
8037
|
+
throw new Error('missing channel labels property: ' + model);
|
|
8038
|
+
}
|
|
8039
|
+
|
|
8040
|
+
if (convert$1[model].labels.length !== convert$1[model].channels) {
|
|
8041
|
+
throw new Error('channel and label counts mismatch: ' + model);
|
|
8042
|
+
}
|
|
8043
|
+
|
|
8044
|
+
const {channels, labels} = convert$1[model];
|
|
8045
|
+
delete convert$1[model].channels;
|
|
8046
|
+
delete convert$1[model].labels;
|
|
8047
|
+
Object.defineProperty(convert$1[model], 'channels', {value: channels});
|
|
8048
|
+
Object.defineProperty(convert$1[model], 'labels', {value: labels});
|
|
8049
|
+
}
|
|
8050
|
+
|
|
8051
|
+
convert$1.rgb.hsl = function (rgb) {
|
|
8052
|
+
const r = rgb[0] / 255;
|
|
8053
|
+
const g = rgb[1] / 255;
|
|
8054
|
+
const b = rgb[2] / 255;
|
|
8055
|
+
const min = Math.min(r, g, b);
|
|
8056
|
+
const max = Math.max(r, g, b);
|
|
8057
|
+
const delta = max - min;
|
|
8058
|
+
let h;
|
|
8059
|
+
let s;
|
|
8060
|
+
|
|
8061
|
+
if (max === min) {
|
|
8062
|
+
h = 0;
|
|
8063
|
+
} else if (r === max) {
|
|
8064
|
+
h = (g - b) / delta;
|
|
8065
|
+
} else if (g === max) {
|
|
8066
|
+
h = 2 + (b - r) / delta;
|
|
8067
|
+
} else if (b === max) {
|
|
8068
|
+
h = 4 + (r - g) / delta;
|
|
8069
|
+
}
|
|
8070
|
+
|
|
8071
|
+
h = Math.min(h * 60, 360);
|
|
8072
|
+
|
|
8073
|
+
if (h < 0) {
|
|
8074
|
+
h += 360;
|
|
8075
|
+
}
|
|
8076
|
+
|
|
8077
|
+
const l = (min + max) / 2;
|
|
8078
|
+
|
|
8079
|
+
if (max === min) {
|
|
8080
|
+
s = 0;
|
|
8081
|
+
} else if (l <= 0.5) {
|
|
8082
|
+
s = delta / (max + min);
|
|
8083
|
+
} else {
|
|
8084
|
+
s = delta / (2 - max - min);
|
|
8085
|
+
}
|
|
8086
|
+
|
|
8087
|
+
return [h, s * 100, l * 100];
|
|
8088
|
+
};
|
|
8089
|
+
|
|
8090
|
+
convert$1.rgb.hsv = function (rgb) {
|
|
8091
|
+
let rdif;
|
|
8092
|
+
let gdif;
|
|
8093
|
+
let bdif;
|
|
8094
|
+
let h;
|
|
8095
|
+
let s;
|
|
8096
|
+
|
|
8097
|
+
const r = rgb[0] / 255;
|
|
8098
|
+
const g = rgb[1] / 255;
|
|
8099
|
+
const b = rgb[2] / 255;
|
|
8100
|
+
const v = Math.max(r, g, b);
|
|
8101
|
+
const diff = v - Math.min(r, g, b);
|
|
8102
|
+
const diffc = function (c) {
|
|
8103
|
+
return (v - c) / 6 / diff + 1 / 2;
|
|
8104
|
+
};
|
|
8105
|
+
|
|
8106
|
+
if (diff === 0) {
|
|
8107
|
+
h = 0;
|
|
8108
|
+
s = 0;
|
|
8109
|
+
} else {
|
|
8110
|
+
s = diff / v;
|
|
8111
|
+
rdif = diffc(r);
|
|
8112
|
+
gdif = diffc(g);
|
|
8113
|
+
bdif = diffc(b);
|
|
8114
|
+
|
|
8115
|
+
if (r === v) {
|
|
8116
|
+
h = bdif - gdif;
|
|
8117
|
+
} else if (g === v) {
|
|
8118
|
+
h = (1 / 3) + rdif - bdif;
|
|
8119
|
+
} else if (b === v) {
|
|
8120
|
+
h = (2 / 3) + gdif - rdif;
|
|
8121
|
+
}
|
|
8122
|
+
|
|
8123
|
+
if (h < 0) {
|
|
8124
|
+
h += 1;
|
|
8125
|
+
} else if (h > 1) {
|
|
8126
|
+
h -= 1;
|
|
8127
|
+
}
|
|
8128
|
+
}
|
|
8129
|
+
|
|
8130
|
+
return [
|
|
8131
|
+
h * 360,
|
|
8132
|
+
s * 100,
|
|
8133
|
+
v * 100
|
|
8134
|
+
];
|
|
8135
|
+
};
|
|
8136
|
+
|
|
8137
|
+
convert$1.rgb.hwb = function (rgb) {
|
|
8138
|
+
const r = rgb[0];
|
|
8139
|
+
const g = rgb[1];
|
|
8140
|
+
let b = rgb[2];
|
|
8141
|
+
const h = convert$1.rgb.hsl(rgb)[0];
|
|
8142
|
+
const w = 1 / 255 * Math.min(r, Math.min(g, b));
|
|
8143
|
+
|
|
8144
|
+
b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
|
|
8145
|
+
|
|
8146
|
+
return [h, w * 100, b * 100];
|
|
8147
|
+
};
|
|
8148
|
+
|
|
8149
|
+
convert$1.rgb.cmyk = function (rgb) {
|
|
8150
|
+
const r = rgb[0] / 255;
|
|
8151
|
+
const g = rgb[1] / 255;
|
|
8152
|
+
const b = rgb[2] / 255;
|
|
8153
|
+
|
|
8154
|
+
const k = Math.min(1 - r, 1 - g, 1 - b);
|
|
8155
|
+
const c = (1 - r - k) / (1 - k) || 0;
|
|
8156
|
+
const m = (1 - g - k) / (1 - k) || 0;
|
|
8157
|
+
const y = (1 - b - k) / (1 - k) || 0;
|
|
8158
|
+
|
|
8159
|
+
return [c * 100, m * 100, y * 100, k * 100];
|
|
8160
|
+
};
|
|
8161
|
+
|
|
8162
|
+
function comparativeDistance(x, y) {
|
|
8163
|
+
/*
|
|
8164
|
+
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
|
8165
|
+
*/
|
|
8166
|
+
return (
|
|
8167
|
+
((x[0] - y[0]) ** 2) +
|
|
8168
|
+
((x[1] - y[1]) ** 2) +
|
|
8169
|
+
((x[2] - y[2]) ** 2)
|
|
8170
|
+
);
|
|
8171
|
+
}
|
|
8172
|
+
|
|
8173
|
+
convert$1.rgb.keyword = function (rgb) {
|
|
8174
|
+
const reversed = reverseKeywords[rgb];
|
|
8175
|
+
if (reversed) {
|
|
8176
|
+
return reversed;
|
|
8177
|
+
}
|
|
8178
|
+
|
|
8179
|
+
let currentClosestDistance = Infinity;
|
|
8180
|
+
let currentClosestKeyword;
|
|
8181
|
+
|
|
8182
|
+
for (const keyword of Object.keys(cssKeywords)) {
|
|
8183
|
+
const value = cssKeywords[keyword];
|
|
8184
|
+
|
|
8185
|
+
// Compute comparative distance
|
|
8186
|
+
const distance = comparativeDistance(rgb, value);
|
|
8187
|
+
|
|
8188
|
+
// Check if its less, if so set as closest
|
|
8189
|
+
if (distance < currentClosestDistance) {
|
|
8190
|
+
currentClosestDistance = distance;
|
|
8191
|
+
currentClosestKeyword = keyword;
|
|
8192
|
+
}
|
|
8193
|
+
}
|
|
8194
|
+
|
|
8195
|
+
return currentClosestKeyword;
|
|
8196
|
+
};
|
|
8197
|
+
|
|
8198
|
+
convert$1.keyword.rgb = function (keyword) {
|
|
8199
|
+
return cssKeywords[keyword];
|
|
8200
|
+
};
|
|
8201
|
+
|
|
8202
|
+
convert$1.rgb.xyz = function (rgb) {
|
|
8203
|
+
let r = rgb[0] / 255;
|
|
8204
|
+
let g = rgb[1] / 255;
|
|
8205
|
+
let b = rgb[2] / 255;
|
|
8206
|
+
|
|
8207
|
+
// Assume sRGB
|
|
8208
|
+
r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92);
|
|
8209
|
+
g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92);
|
|
8210
|
+
b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92);
|
|
8211
|
+
|
|
8212
|
+
const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
|
|
8213
|
+
const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
|
|
8214
|
+
const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
|
|
8215
|
+
|
|
8216
|
+
return [x * 100, y * 100, z * 100];
|
|
8217
|
+
};
|
|
8218
|
+
|
|
8219
|
+
convert$1.rgb.lab = function (rgb) {
|
|
8220
|
+
const xyz = convert$1.rgb.xyz(rgb);
|
|
8221
|
+
let x = xyz[0];
|
|
8222
|
+
let y = xyz[1];
|
|
8223
|
+
let z = xyz[2];
|
|
8224
|
+
|
|
8225
|
+
x /= 95.047;
|
|
8226
|
+
y /= 100;
|
|
8227
|
+
z /= 108.883;
|
|
8228
|
+
|
|
8229
|
+
x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
|
|
8230
|
+
y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
|
|
8231
|
+
z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
|
|
8232
|
+
|
|
8233
|
+
const l = (116 * y) - 16;
|
|
8234
|
+
const a = 500 * (x - y);
|
|
8235
|
+
const b = 200 * (y - z);
|
|
8236
|
+
|
|
8237
|
+
return [l, a, b];
|
|
8238
|
+
};
|
|
8239
|
+
|
|
8240
|
+
convert$1.hsl.rgb = function (hsl) {
|
|
8241
|
+
const h = hsl[0] / 360;
|
|
8242
|
+
const s = hsl[1] / 100;
|
|
8243
|
+
const l = hsl[2] / 100;
|
|
8244
|
+
let t2;
|
|
8245
|
+
let t3;
|
|
8246
|
+
let val;
|
|
8247
|
+
|
|
8248
|
+
if (s === 0) {
|
|
8249
|
+
val = l * 255;
|
|
8250
|
+
return [val, val, val];
|
|
8251
|
+
}
|
|
8252
|
+
|
|
8253
|
+
if (l < 0.5) {
|
|
8254
|
+
t2 = l * (1 + s);
|
|
8255
|
+
} else {
|
|
8256
|
+
t2 = l + s - l * s;
|
|
8257
|
+
}
|
|
8258
|
+
|
|
8259
|
+
const t1 = 2 * l - t2;
|
|
8260
|
+
|
|
8261
|
+
const rgb = [0, 0, 0];
|
|
8262
|
+
for (let i = 0; i < 3; i++) {
|
|
8263
|
+
t3 = h + 1 / 3 * -(i - 1);
|
|
8264
|
+
if (t3 < 0) {
|
|
8265
|
+
t3++;
|
|
8266
|
+
}
|
|
8267
|
+
|
|
8268
|
+
if (t3 > 1) {
|
|
8269
|
+
t3--;
|
|
8270
|
+
}
|
|
8271
|
+
|
|
8272
|
+
if (6 * t3 < 1) {
|
|
8273
|
+
val = t1 + (t2 - t1) * 6 * t3;
|
|
8274
|
+
} else if (2 * t3 < 1) {
|
|
8275
|
+
val = t2;
|
|
8276
|
+
} else if (3 * t3 < 2) {
|
|
8277
|
+
val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
|
|
8278
|
+
} else {
|
|
8279
|
+
val = t1;
|
|
8280
|
+
}
|
|
8281
|
+
|
|
8282
|
+
rgb[i] = val * 255;
|
|
8283
|
+
}
|
|
8284
|
+
|
|
8285
|
+
return rgb;
|
|
8286
|
+
};
|
|
8287
|
+
|
|
8288
|
+
convert$1.hsl.hsv = function (hsl) {
|
|
8289
|
+
const h = hsl[0];
|
|
8290
|
+
let s = hsl[1] / 100;
|
|
8291
|
+
let l = hsl[2] / 100;
|
|
8292
|
+
let smin = s;
|
|
8293
|
+
const lmin = Math.max(l, 0.01);
|
|
8294
|
+
|
|
8295
|
+
l *= 2;
|
|
8296
|
+
s *= (l <= 1) ? l : 2 - l;
|
|
8297
|
+
smin *= lmin <= 1 ? lmin : 2 - lmin;
|
|
8298
|
+
const v = (l + s) / 2;
|
|
8299
|
+
const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
|
|
8300
|
+
|
|
8301
|
+
return [h, sv * 100, v * 100];
|
|
8302
|
+
};
|
|
8303
|
+
|
|
8304
|
+
convert$1.hsv.rgb = function (hsv) {
|
|
8305
|
+
const h = hsv[0] / 60;
|
|
8306
|
+
const s = hsv[1] / 100;
|
|
8307
|
+
let v = hsv[2] / 100;
|
|
8308
|
+
const hi = Math.floor(h) % 6;
|
|
8309
|
+
|
|
8310
|
+
const f = h - Math.floor(h);
|
|
8311
|
+
const p = 255 * v * (1 - s);
|
|
8312
|
+
const q = 255 * v * (1 - (s * f));
|
|
8313
|
+
const t = 255 * v * (1 - (s * (1 - f)));
|
|
8314
|
+
v *= 255;
|
|
8315
|
+
|
|
8316
|
+
switch (hi) {
|
|
8317
|
+
case 0:
|
|
8318
|
+
return [v, t, p];
|
|
8319
|
+
case 1:
|
|
8320
|
+
return [q, v, p];
|
|
8321
|
+
case 2:
|
|
8322
|
+
return [p, v, t];
|
|
8323
|
+
case 3:
|
|
8324
|
+
return [p, q, v];
|
|
8325
|
+
case 4:
|
|
8326
|
+
return [t, p, v];
|
|
8327
|
+
case 5:
|
|
8328
|
+
return [v, p, q];
|
|
8329
|
+
}
|
|
8330
|
+
};
|
|
8331
|
+
|
|
8332
|
+
convert$1.hsv.hsl = function (hsv) {
|
|
8333
|
+
const h = hsv[0];
|
|
8334
|
+
const s = hsv[1] / 100;
|
|
8335
|
+
const v = hsv[2] / 100;
|
|
8336
|
+
const vmin = Math.max(v, 0.01);
|
|
8337
|
+
let sl;
|
|
8338
|
+
let l;
|
|
8339
|
+
|
|
8340
|
+
l = (2 - s) * v;
|
|
8341
|
+
const lmin = (2 - s) * vmin;
|
|
8342
|
+
sl = s * vmin;
|
|
8343
|
+
sl /= (lmin <= 1) ? lmin : 2 - lmin;
|
|
8344
|
+
sl = sl || 0;
|
|
8345
|
+
l /= 2;
|
|
8346
|
+
|
|
8347
|
+
return [h, sl * 100, l * 100];
|
|
8348
|
+
};
|
|
8349
|
+
|
|
8350
|
+
// http://dev.w3.org/csswg/css-color/#hwb-to-rgb
|
|
8351
|
+
convert$1.hwb.rgb = function (hwb) {
|
|
8352
|
+
const h = hwb[0] / 360;
|
|
8353
|
+
let wh = hwb[1] / 100;
|
|
8354
|
+
let bl = hwb[2] / 100;
|
|
8355
|
+
const ratio = wh + bl;
|
|
8356
|
+
let f;
|
|
8357
|
+
|
|
8358
|
+
// Wh + bl cant be > 1
|
|
8359
|
+
if (ratio > 1) {
|
|
8360
|
+
wh /= ratio;
|
|
8361
|
+
bl /= ratio;
|
|
8362
|
+
}
|
|
8363
|
+
|
|
8364
|
+
const i = Math.floor(6 * h);
|
|
8365
|
+
const v = 1 - bl;
|
|
8366
|
+
f = 6 * h - i;
|
|
8367
|
+
|
|
8368
|
+
if ((i & 0x01) !== 0) {
|
|
8369
|
+
f = 1 - f;
|
|
8370
|
+
}
|
|
8371
|
+
|
|
8372
|
+
const n = wh + f * (v - wh); // Linear interpolation
|
|
8373
|
+
|
|
8374
|
+
let r;
|
|
8375
|
+
let g;
|
|
8376
|
+
let b;
|
|
8377
|
+
/* eslint-disable max-statements-per-line,no-multi-spaces */
|
|
8378
|
+
switch (i) {
|
|
8379
|
+
default:
|
|
8380
|
+
case 6:
|
|
8381
|
+
case 0: r = v; g = n; b = wh; break;
|
|
8382
|
+
case 1: r = n; g = v; b = wh; break;
|
|
8383
|
+
case 2: r = wh; g = v; b = n; break;
|
|
8384
|
+
case 3: r = wh; g = n; b = v; break;
|
|
8385
|
+
case 4: r = n; g = wh; b = v; break;
|
|
8386
|
+
case 5: r = v; g = wh; b = n; break;
|
|
8387
|
+
}
|
|
8388
|
+
/* eslint-enable max-statements-per-line,no-multi-spaces */
|
|
8389
|
+
|
|
8390
|
+
return [r * 255, g * 255, b * 255];
|
|
8391
|
+
};
|
|
8392
|
+
|
|
8393
|
+
convert$1.cmyk.rgb = function (cmyk) {
|
|
8394
|
+
const c = cmyk[0] / 100;
|
|
8395
|
+
const m = cmyk[1] / 100;
|
|
8396
|
+
const y = cmyk[2] / 100;
|
|
8397
|
+
const k = cmyk[3] / 100;
|
|
8398
|
+
|
|
8399
|
+
const r = 1 - Math.min(1, c * (1 - k) + k);
|
|
8400
|
+
const g = 1 - Math.min(1, m * (1 - k) + k);
|
|
8401
|
+
const b = 1 - Math.min(1, y * (1 - k) + k);
|
|
8402
|
+
|
|
8403
|
+
return [r * 255, g * 255, b * 255];
|
|
8404
|
+
};
|
|
8405
|
+
|
|
8406
|
+
convert$1.xyz.rgb = function (xyz) {
|
|
8407
|
+
const x = xyz[0] / 100;
|
|
8408
|
+
const y = xyz[1] / 100;
|
|
8409
|
+
const z = xyz[2] / 100;
|
|
8410
|
+
let r;
|
|
8411
|
+
let g;
|
|
8412
|
+
let b;
|
|
8413
|
+
|
|
8414
|
+
r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
|
|
8415
|
+
g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
|
|
8416
|
+
b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
|
|
8417
|
+
|
|
8418
|
+
// Assume sRGB
|
|
8419
|
+
r = r > 0.0031308
|
|
8420
|
+
? ((1.055 * (r ** (1.0 / 2.4))) - 0.055)
|
|
8421
|
+
: r * 12.92;
|
|
8422
|
+
|
|
8423
|
+
g = g > 0.0031308
|
|
8424
|
+
? ((1.055 * (g ** (1.0 / 2.4))) - 0.055)
|
|
8425
|
+
: g * 12.92;
|
|
8426
|
+
|
|
8427
|
+
b = b > 0.0031308
|
|
8428
|
+
? ((1.055 * (b ** (1.0 / 2.4))) - 0.055)
|
|
8429
|
+
: b * 12.92;
|
|
8430
|
+
|
|
8431
|
+
r = Math.min(Math.max(0, r), 1);
|
|
8432
|
+
g = Math.min(Math.max(0, g), 1);
|
|
8433
|
+
b = Math.min(Math.max(0, b), 1);
|
|
8434
|
+
|
|
8435
|
+
return [r * 255, g * 255, b * 255];
|
|
8436
|
+
};
|
|
8437
|
+
|
|
8438
|
+
convert$1.xyz.lab = function (xyz) {
|
|
8439
|
+
let x = xyz[0];
|
|
8440
|
+
let y = xyz[1];
|
|
8441
|
+
let z = xyz[2];
|
|
8442
|
+
|
|
8443
|
+
x /= 95.047;
|
|
8444
|
+
y /= 100;
|
|
8445
|
+
z /= 108.883;
|
|
8446
|
+
|
|
8447
|
+
x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
|
|
8448
|
+
y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
|
|
8449
|
+
z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
|
|
8450
|
+
|
|
8451
|
+
const l = (116 * y) - 16;
|
|
8452
|
+
const a = 500 * (x - y);
|
|
8453
|
+
const b = 200 * (y - z);
|
|
8454
|
+
|
|
8455
|
+
return [l, a, b];
|
|
8456
|
+
};
|
|
8457
|
+
|
|
8458
|
+
convert$1.lab.xyz = function (lab) {
|
|
8459
|
+
const l = lab[0];
|
|
8460
|
+
const a = lab[1];
|
|
8461
|
+
const b = lab[2];
|
|
8462
|
+
let x;
|
|
8463
|
+
let y;
|
|
8464
|
+
let z;
|
|
8465
|
+
|
|
8466
|
+
y = (l + 16) / 116;
|
|
8467
|
+
x = a / 500 + y;
|
|
8468
|
+
z = y - b / 200;
|
|
8469
|
+
|
|
8470
|
+
const y2 = y ** 3;
|
|
8471
|
+
const x2 = x ** 3;
|
|
8472
|
+
const z2 = z ** 3;
|
|
8473
|
+
y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
|
|
8474
|
+
x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
|
|
8475
|
+
z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
|
|
8476
|
+
|
|
8477
|
+
x *= 95.047;
|
|
8478
|
+
y *= 100;
|
|
8479
|
+
z *= 108.883;
|
|
8480
|
+
|
|
8481
|
+
return [x, y, z];
|
|
8482
|
+
};
|
|
8483
|
+
|
|
8484
|
+
convert$1.lab.lch = function (lab) {
|
|
8485
|
+
const l = lab[0];
|
|
8486
|
+
const a = lab[1];
|
|
8487
|
+
const b = lab[2];
|
|
8488
|
+
let h;
|
|
8489
|
+
|
|
8490
|
+
const hr = Math.atan2(b, a);
|
|
8491
|
+
h = hr * 360 / 2 / Math.PI;
|
|
8492
|
+
|
|
8493
|
+
if (h < 0) {
|
|
8494
|
+
h += 360;
|
|
8495
|
+
}
|
|
8496
|
+
|
|
8497
|
+
const c = Math.sqrt(a * a + b * b);
|
|
8498
|
+
|
|
8499
|
+
return [l, c, h];
|
|
8500
|
+
};
|
|
8501
|
+
|
|
8502
|
+
convert$1.lch.lab = function (lch) {
|
|
8503
|
+
const l = lch[0];
|
|
8504
|
+
const c = lch[1];
|
|
8505
|
+
const h = lch[2];
|
|
8506
|
+
|
|
8507
|
+
const hr = h / 360 * 2 * Math.PI;
|
|
8508
|
+
const a = c * Math.cos(hr);
|
|
8509
|
+
const b = c * Math.sin(hr);
|
|
8510
|
+
|
|
8511
|
+
return [l, a, b];
|
|
8512
|
+
};
|
|
8513
|
+
|
|
8514
|
+
convert$1.rgb.ansi16 = function (args, saturation = null) {
|
|
8515
|
+
const [r, g, b] = args;
|
|
8516
|
+
let value = saturation === null ? convert$1.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization
|
|
8517
|
+
|
|
8518
|
+
value = Math.round(value / 50);
|
|
8519
|
+
|
|
8520
|
+
if (value === 0) {
|
|
8521
|
+
return 30;
|
|
8522
|
+
}
|
|
8523
|
+
|
|
8524
|
+
let ansi = 30
|
|
8525
|
+
+ ((Math.round(b / 255) << 2)
|
|
8526
|
+
| (Math.round(g / 255) << 1)
|
|
8527
|
+
| Math.round(r / 255));
|
|
8528
|
+
|
|
8529
|
+
if (value === 2) {
|
|
8530
|
+
ansi += 60;
|
|
8531
|
+
}
|
|
8532
|
+
|
|
8533
|
+
return ansi;
|
|
8534
|
+
};
|
|
8535
|
+
|
|
8536
|
+
convert$1.hsv.ansi16 = function (args) {
|
|
8537
|
+
// Optimization here; we already know the value and don't need to get
|
|
8538
|
+
// it converted for us.
|
|
8539
|
+
return convert$1.rgb.ansi16(convert$1.hsv.rgb(args), args[2]);
|
|
8540
|
+
};
|
|
8541
|
+
|
|
8542
|
+
convert$1.rgb.ansi256 = function (args) {
|
|
8543
|
+
const r = args[0];
|
|
8544
|
+
const g = args[1];
|
|
8545
|
+
const b = args[2];
|
|
8546
|
+
|
|
8547
|
+
// We use the extended greyscale palette here, with the exception of
|
|
8548
|
+
// black and white. normal palette only has 4 greyscale shades.
|
|
8549
|
+
if (r === g && g === b) {
|
|
8550
|
+
if (r < 8) {
|
|
8551
|
+
return 16;
|
|
8552
|
+
}
|
|
8553
|
+
|
|
8554
|
+
if (r > 248) {
|
|
8555
|
+
return 231;
|
|
8556
|
+
}
|
|
8557
|
+
|
|
8558
|
+
return Math.round(((r - 8) / 247) * 24) + 232;
|
|
8559
|
+
}
|
|
8560
|
+
|
|
8561
|
+
const ansi = 16
|
|
8562
|
+
+ (36 * Math.round(r / 255 * 5))
|
|
8563
|
+
+ (6 * Math.round(g / 255 * 5))
|
|
8564
|
+
+ Math.round(b / 255 * 5);
|
|
8565
|
+
|
|
8566
|
+
return ansi;
|
|
8567
|
+
};
|
|
8568
|
+
|
|
8569
|
+
convert$1.ansi16.rgb = function (args) {
|
|
8570
|
+
let color = args % 10;
|
|
8571
|
+
|
|
8572
|
+
// Handle greyscale
|
|
8573
|
+
if (color === 0 || color === 7) {
|
|
8574
|
+
if (args > 50) {
|
|
8575
|
+
color += 3.5;
|
|
8576
|
+
}
|
|
8577
|
+
|
|
8578
|
+
color = color / 10.5 * 255;
|
|
8579
|
+
|
|
8580
|
+
return [color, color, color];
|
|
8581
|
+
}
|
|
8582
|
+
|
|
8583
|
+
const mult = (~~(args > 50) + 1) * 0.5;
|
|
8584
|
+
const r = ((color & 1) * mult) * 255;
|
|
8585
|
+
const g = (((color >> 1) & 1) * mult) * 255;
|
|
8586
|
+
const b = (((color >> 2) & 1) * mult) * 255;
|
|
8587
|
+
|
|
8588
|
+
return [r, g, b];
|
|
8589
|
+
};
|
|
8590
|
+
|
|
8591
|
+
convert$1.ansi256.rgb = function (args) {
|
|
8592
|
+
// Handle greyscale
|
|
8593
|
+
if (args >= 232) {
|
|
8594
|
+
const c = (args - 232) * 10 + 8;
|
|
8595
|
+
return [c, c, c];
|
|
8596
|
+
}
|
|
8597
|
+
|
|
8598
|
+
args -= 16;
|
|
8599
|
+
|
|
8600
|
+
let rem;
|
|
8601
|
+
const r = Math.floor(args / 36) / 5 * 255;
|
|
8602
|
+
const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
|
|
8603
|
+
const b = (rem % 6) / 5 * 255;
|
|
8604
|
+
|
|
8605
|
+
return [r, g, b];
|
|
8606
|
+
};
|
|
8607
|
+
|
|
8608
|
+
convert$1.rgb.hex = function (args) {
|
|
8609
|
+
const integer = ((Math.round(args[0]) & 0xFF) << 16)
|
|
8610
|
+
+ ((Math.round(args[1]) & 0xFF) << 8)
|
|
8611
|
+
+ (Math.round(args[2]) & 0xFF);
|
|
8612
|
+
|
|
8613
|
+
const string = integer.toString(16).toUpperCase();
|
|
8614
|
+
return '000000'.substring(string.length) + string;
|
|
8615
|
+
};
|
|
8616
|
+
|
|
8617
|
+
convert$1.hex.rgb = function (args) {
|
|
8618
|
+
const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
|
|
8619
|
+
if (!match) {
|
|
8620
|
+
return [0, 0, 0];
|
|
8621
|
+
}
|
|
8622
|
+
|
|
8623
|
+
let colorString = match[0];
|
|
8624
|
+
|
|
8625
|
+
if (match[0].length === 3) {
|
|
8626
|
+
colorString = colorString.split('').map(char => {
|
|
8627
|
+
return char + char;
|
|
8628
|
+
}).join('');
|
|
8629
|
+
}
|
|
8630
|
+
|
|
8631
|
+
const integer = parseInt(colorString, 16);
|
|
8632
|
+
const r = (integer >> 16) & 0xFF;
|
|
8633
|
+
const g = (integer >> 8) & 0xFF;
|
|
8634
|
+
const b = integer & 0xFF;
|
|
8635
|
+
|
|
8636
|
+
return [r, g, b];
|
|
8637
|
+
};
|
|
8638
|
+
|
|
8639
|
+
convert$1.rgb.hcg = function (rgb) {
|
|
8640
|
+
const r = rgb[0] / 255;
|
|
8641
|
+
const g = rgb[1] / 255;
|
|
8642
|
+
const b = rgb[2] / 255;
|
|
8643
|
+
const max = Math.max(Math.max(r, g), b);
|
|
8644
|
+
const min = Math.min(Math.min(r, g), b);
|
|
8645
|
+
const chroma = (max - min);
|
|
8646
|
+
let grayscale;
|
|
8647
|
+
let hue;
|
|
8648
|
+
|
|
8649
|
+
if (chroma < 1) {
|
|
8650
|
+
grayscale = min / (1 - chroma);
|
|
8651
|
+
} else {
|
|
8652
|
+
grayscale = 0;
|
|
8653
|
+
}
|
|
8654
|
+
|
|
8655
|
+
if (chroma <= 0) {
|
|
8656
|
+
hue = 0;
|
|
8657
|
+
} else
|
|
8658
|
+
if (max === r) {
|
|
8659
|
+
hue = ((g - b) / chroma) % 6;
|
|
8660
|
+
} else
|
|
8661
|
+
if (max === g) {
|
|
8662
|
+
hue = 2 + (b - r) / chroma;
|
|
8663
|
+
} else {
|
|
8664
|
+
hue = 4 + (r - g) / chroma;
|
|
8665
|
+
}
|
|
8666
|
+
|
|
8667
|
+
hue /= 6;
|
|
8668
|
+
hue %= 1;
|
|
8669
|
+
|
|
8670
|
+
return [hue * 360, chroma * 100, grayscale * 100];
|
|
8671
|
+
};
|
|
8672
|
+
|
|
8673
|
+
convert$1.hsl.hcg = function (hsl) {
|
|
8674
|
+
const s = hsl[1] / 100;
|
|
8675
|
+
const l = hsl[2] / 100;
|
|
8676
|
+
|
|
8677
|
+
const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l));
|
|
8678
|
+
|
|
8679
|
+
let f = 0;
|
|
8680
|
+
if (c < 1.0) {
|
|
8681
|
+
f = (l - 0.5 * c) / (1.0 - c);
|
|
8682
|
+
}
|
|
8683
|
+
|
|
8684
|
+
return [hsl[0], c * 100, f * 100];
|
|
8685
|
+
};
|
|
8686
|
+
|
|
8687
|
+
convert$1.hsv.hcg = function (hsv) {
|
|
8688
|
+
const s = hsv[1] / 100;
|
|
8689
|
+
const v = hsv[2] / 100;
|
|
8690
|
+
|
|
8691
|
+
const c = s * v;
|
|
8692
|
+
let f = 0;
|
|
8693
|
+
|
|
8694
|
+
if (c < 1.0) {
|
|
8695
|
+
f = (v - c) / (1 - c);
|
|
8696
|
+
}
|
|
8697
|
+
|
|
8698
|
+
return [hsv[0], c * 100, f * 100];
|
|
8699
|
+
};
|
|
8700
|
+
|
|
8701
|
+
convert$1.hcg.rgb = function (hcg) {
|
|
8702
|
+
const h = hcg[0] / 360;
|
|
8703
|
+
const c = hcg[1] / 100;
|
|
8704
|
+
const g = hcg[2] / 100;
|
|
8705
|
+
|
|
8706
|
+
if (c === 0.0) {
|
|
8707
|
+
return [g * 255, g * 255, g * 255];
|
|
8708
|
+
}
|
|
8709
|
+
|
|
8710
|
+
const pure = [0, 0, 0];
|
|
8711
|
+
const hi = (h % 1) * 6;
|
|
8712
|
+
const v = hi % 1;
|
|
8713
|
+
const w = 1 - v;
|
|
8714
|
+
let mg = 0;
|
|
8715
|
+
|
|
8716
|
+
/* eslint-disable max-statements-per-line */
|
|
8717
|
+
switch (Math.floor(hi)) {
|
|
8718
|
+
case 0:
|
|
8719
|
+
pure[0] = 1; pure[1] = v; pure[2] = 0; break;
|
|
8720
|
+
case 1:
|
|
8721
|
+
pure[0] = w; pure[1] = 1; pure[2] = 0; break;
|
|
8722
|
+
case 2:
|
|
8723
|
+
pure[0] = 0; pure[1] = 1; pure[2] = v; break;
|
|
8724
|
+
case 3:
|
|
8725
|
+
pure[0] = 0; pure[1] = w; pure[2] = 1; break;
|
|
8726
|
+
case 4:
|
|
8727
|
+
pure[0] = v; pure[1] = 0; pure[2] = 1; break;
|
|
8728
|
+
default:
|
|
8729
|
+
pure[0] = 1; pure[1] = 0; pure[2] = w;
|
|
8730
|
+
}
|
|
8731
|
+
/* eslint-enable max-statements-per-line */
|
|
8732
|
+
|
|
8733
|
+
mg = (1.0 - c) * g;
|
|
8734
|
+
|
|
8735
|
+
return [
|
|
8736
|
+
(c * pure[0] + mg) * 255,
|
|
8737
|
+
(c * pure[1] + mg) * 255,
|
|
8738
|
+
(c * pure[2] + mg) * 255
|
|
8739
|
+
];
|
|
8740
|
+
};
|
|
8741
|
+
|
|
8742
|
+
convert$1.hcg.hsv = function (hcg) {
|
|
8743
|
+
const c = hcg[1] / 100;
|
|
8744
|
+
const g = hcg[2] / 100;
|
|
8745
|
+
|
|
8746
|
+
const v = c + g * (1.0 - c);
|
|
8747
|
+
let f = 0;
|
|
8748
|
+
|
|
8749
|
+
if (v > 0.0) {
|
|
8750
|
+
f = c / v;
|
|
8751
|
+
}
|
|
8752
|
+
|
|
8753
|
+
return [hcg[0], f * 100, v * 100];
|
|
8754
|
+
};
|
|
8755
|
+
|
|
8756
|
+
convert$1.hcg.hsl = function (hcg) {
|
|
8757
|
+
const c = hcg[1] / 100;
|
|
8758
|
+
const g = hcg[2] / 100;
|
|
8759
|
+
|
|
8760
|
+
const l = g * (1.0 - c) + 0.5 * c;
|
|
8761
|
+
let s = 0;
|
|
8762
|
+
|
|
8763
|
+
if (l > 0.0 && l < 0.5) {
|
|
8764
|
+
s = c / (2 * l);
|
|
8765
|
+
} else
|
|
8766
|
+
if (l >= 0.5 && l < 1.0) {
|
|
8767
|
+
s = c / (2 * (1 - l));
|
|
8768
|
+
}
|
|
8769
|
+
|
|
8770
|
+
return [hcg[0], s * 100, l * 100];
|
|
8771
|
+
};
|
|
8772
|
+
|
|
8773
|
+
convert$1.hcg.hwb = function (hcg) {
|
|
8774
|
+
const c = hcg[1] / 100;
|
|
8775
|
+
const g = hcg[2] / 100;
|
|
8776
|
+
const v = c + g * (1.0 - c);
|
|
8777
|
+
return [hcg[0], (v - c) * 100, (1 - v) * 100];
|
|
8778
|
+
};
|
|
8779
|
+
|
|
8780
|
+
convert$1.hwb.hcg = function (hwb) {
|
|
8781
|
+
const w = hwb[1] / 100;
|
|
8782
|
+
const b = hwb[2] / 100;
|
|
8783
|
+
const v = 1 - b;
|
|
8784
|
+
const c = v - w;
|
|
8785
|
+
let g = 0;
|
|
8786
|
+
|
|
8787
|
+
if (c < 1) {
|
|
8788
|
+
g = (v - c) / (1 - c);
|
|
8789
|
+
}
|
|
8790
|
+
|
|
8791
|
+
return [hwb[0], c * 100, g * 100];
|
|
8792
|
+
};
|
|
8793
|
+
|
|
8794
|
+
convert$1.apple.rgb = function (apple) {
|
|
8795
|
+
return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
|
|
8796
|
+
};
|
|
8797
|
+
|
|
8798
|
+
convert$1.rgb.apple = function (rgb) {
|
|
8799
|
+
return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
|
|
8800
|
+
};
|
|
8801
|
+
|
|
8802
|
+
convert$1.gray.rgb = function (args) {
|
|
8803
|
+
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
|
|
8804
|
+
};
|
|
8805
|
+
|
|
8806
|
+
convert$1.gray.hsl = function (args) {
|
|
8807
|
+
return [0, 0, args[0]];
|
|
8808
|
+
};
|
|
8809
|
+
|
|
8810
|
+
convert$1.gray.hsv = convert$1.gray.hsl;
|
|
8811
|
+
|
|
8812
|
+
convert$1.gray.hwb = function (gray) {
|
|
8813
|
+
return [0, 100, gray[0]];
|
|
8814
|
+
};
|
|
8815
|
+
|
|
8816
|
+
convert$1.gray.cmyk = function (gray) {
|
|
8817
|
+
return [0, 0, 0, gray[0]];
|
|
8818
|
+
};
|
|
8819
|
+
|
|
8820
|
+
convert$1.gray.lab = function (gray) {
|
|
8821
|
+
return [gray[0], 0, 0];
|
|
8822
|
+
};
|
|
8823
|
+
|
|
8824
|
+
convert$1.gray.hex = function (gray) {
|
|
8825
|
+
const val = Math.round(gray[0] / 100 * 255) & 0xFF;
|
|
8826
|
+
const integer = (val << 16) + (val << 8) + val;
|
|
8827
|
+
|
|
8828
|
+
const string = integer.toString(16).toUpperCase();
|
|
8829
|
+
return '000000'.substring(string.length) + string;
|
|
8830
|
+
};
|
|
8831
|
+
|
|
8832
|
+
convert$1.rgb.gray = function (rgb) {
|
|
8833
|
+
const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
|
|
8834
|
+
return [val / 255 * 100];
|
|
8835
|
+
};
|
|
8836
|
+
|
|
8837
|
+
const conversions$1 = conversions$2;
|
|
8838
|
+
|
|
8839
|
+
/*
|
|
8840
|
+
This function routes a model to all other models.
|
|
8841
|
+
|
|
8842
|
+
all functions that are routed have a property `.conversion` attached
|
|
8843
|
+
to the returned synthetic function. This property is an array
|
|
8844
|
+
of strings, each with the steps in between the 'from' and 'to'
|
|
8845
|
+
color models (inclusive).
|
|
8846
|
+
|
|
8847
|
+
conversions that are not possible simply are not included.
|
|
8848
|
+
*/
|
|
8849
|
+
|
|
8850
|
+
function buildGraph() {
|
|
8851
|
+
const graph = {};
|
|
8852
|
+
// https://jsperf.com/object-keys-vs-for-in-with-closure/3
|
|
8853
|
+
const models = Object.keys(conversions$1);
|
|
8854
|
+
|
|
8855
|
+
for (let len = models.length, i = 0; i < len; i++) {
|
|
8856
|
+
graph[models[i]] = {
|
|
8857
|
+
// http://jsperf.com/1-vs-infinity
|
|
8858
|
+
// micro-opt, but this is simple.
|
|
8859
|
+
distance: -1,
|
|
8860
|
+
parent: null
|
|
8861
|
+
};
|
|
8862
|
+
}
|
|
8863
|
+
|
|
8864
|
+
return graph;
|
|
8865
|
+
}
|
|
8866
|
+
|
|
8867
|
+
// https://en.wikipedia.org/wiki/Breadth-first_search
|
|
8868
|
+
function deriveBFS(fromModel) {
|
|
8869
|
+
const graph = buildGraph();
|
|
8870
|
+
const queue = [fromModel]; // Unshift -> queue -> pop
|
|
8871
|
+
|
|
8872
|
+
graph[fromModel].distance = 0;
|
|
8873
|
+
|
|
8874
|
+
while (queue.length) {
|
|
8875
|
+
const current = queue.pop();
|
|
8876
|
+
const adjacents = Object.keys(conversions$1[current]);
|
|
8877
|
+
|
|
8878
|
+
for (let len = adjacents.length, i = 0; i < len; i++) {
|
|
8879
|
+
const adjacent = adjacents[i];
|
|
8880
|
+
const node = graph[adjacent];
|
|
8881
|
+
|
|
8882
|
+
if (node.distance === -1) {
|
|
8883
|
+
node.distance = graph[current].distance + 1;
|
|
8884
|
+
node.parent = current;
|
|
8885
|
+
queue.unshift(adjacent);
|
|
8886
|
+
}
|
|
8887
|
+
}
|
|
8888
|
+
}
|
|
8889
|
+
|
|
8890
|
+
return graph;
|
|
8891
|
+
}
|
|
8892
|
+
|
|
8893
|
+
function link(from, to) {
|
|
8894
|
+
return function (args) {
|
|
8895
|
+
return to(from(args));
|
|
8896
|
+
};
|
|
8897
|
+
}
|
|
8898
|
+
|
|
8899
|
+
function wrapConversion(toModel, graph) {
|
|
8900
|
+
const path = [graph[toModel].parent, toModel];
|
|
8901
|
+
let fn = conversions$1[graph[toModel].parent][toModel];
|
|
8902
|
+
|
|
8903
|
+
let cur = graph[toModel].parent;
|
|
8904
|
+
while (graph[cur].parent) {
|
|
8905
|
+
path.unshift(graph[cur].parent);
|
|
8906
|
+
fn = link(conversions$1[graph[cur].parent][cur], fn);
|
|
8907
|
+
cur = graph[cur].parent;
|
|
8908
|
+
}
|
|
8909
|
+
|
|
8910
|
+
fn.conversion = path;
|
|
8911
|
+
return fn;
|
|
8912
|
+
}
|
|
8913
|
+
|
|
8914
|
+
var route$1 = function (fromModel) {
|
|
8915
|
+
const graph = deriveBFS(fromModel);
|
|
8916
|
+
const conversion = {};
|
|
8917
|
+
|
|
8918
|
+
const models = Object.keys(graph);
|
|
8919
|
+
for (let len = models.length, i = 0; i < len; i++) {
|
|
8920
|
+
const toModel = models[i];
|
|
8921
|
+
const node = graph[toModel];
|
|
8922
|
+
|
|
8923
|
+
if (node.parent === null) {
|
|
8924
|
+
// No possible conversion, or this node is the source model.
|
|
8925
|
+
continue;
|
|
8926
|
+
}
|
|
8927
|
+
|
|
8928
|
+
conversion[toModel] = wrapConversion(toModel, graph);
|
|
8929
|
+
}
|
|
8930
|
+
|
|
8931
|
+
return conversion;
|
|
8932
|
+
};
|
|
8933
|
+
|
|
8934
|
+
const conversions = conversions$2;
|
|
8935
|
+
const route = route$1;
|
|
8936
|
+
|
|
8937
|
+
const convert = {};
|
|
8938
|
+
|
|
8939
|
+
const models = Object.keys(conversions);
|
|
8940
|
+
|
|
8941
|
+
function wrapRaw(fn) {
|
|
8942
|
+
const wrappedFn = function (...args) {
|
|
8943
|
+
const arg0 = args[0];
|
|
8944
|
+
if (arg0 === undefined || arg0 === null) {
|
|
8945
|
+
return arg0;
|
|
8946
|
+
}
|
|
8947
|
+
|
|
8948
|
+
if (arg0.length > 1) {
|
|
8949
|
+
args = arg0;
|
|
8950
|
+
}
|
|
8951
|
+
|
|
8952
|
+
return fn(args);
|
|
8953
|
+
};
|
|
8954
|
+
|
|
8955
|
+
// Preserve .conversion property if there is one
|
|
8956
|
+
if ('conversion' in fn) {
|
|
8957
|
+
wrappedFn.conversion = fn.conversion;
|
|
8958
|
+
}
|
|
8959
|
+
|
|
8960
|
+
return wrappedFn;
|
|
8961
|
+
}
|
|
8962
|
+
|
|
8963
|
+
function wrapRounded(fn) {
|
|
8964
|
+
const wrappedFn = function (...args) {
|
|
8965
|
+
const arg0 = args[0];
|
|
8966
|
+
|
|
8967
|
+
if (arg0 === undefined || arg0 === null) {
|
|
8968
|
+
return arg0;
|
|
8969
|
+
}
|
|
8970
|
+
|
|
8971
|
+
if (arg0.length > 1) {
|
|
8972
|
+
args = arg0;
|
|
8973
|
+
}
|
|
8974
|
+
|
|
8975
|
+
const result = fn(args);
|
|
8976
|
+
|
|
8977
|
+
// We're assuming the result is an array here.
|
|
8978
|
+
// see notice in conversions.js; don't use box types
|
|
8979
|
+
// in conversion functions.
|
|
8980
|
+
if (typeof result === 'object') {
|
|
8981
|
+
for (let len = result.length, i = 0; i < len; i++) {
|
|
8982
|
+
result[i] = Math.round(result[i]);
|
|
8983
|
+
}
|
|
8984
|
+
}
|
|
8985
|
+
|
|
8986
|
+
return result;
|
|
8987
|
+
};
|
|
8988
|
+
|
|
8989
|
+
// Preserve .conversion property if there is one
|
|
8990
|
+
if ('conversion' in fn) {
|
|
8991
|
+
wrappedFn.conversion = fn.conversion;
|
|
8992
|
+
}
|
|
8993
|
+
|
|
8994
|
+
return wrappedFn;
|
|
8995
|
+
}
|
|
8996
|
+
|
|
8997
|
+
models.forEach(fromModel => {
|
|
8998
|
+
convert[fromModel] = {};
|
|
8999
|
+
|
|
9000
|
+
Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
|
|
9001
|
+
Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
|
|
9002
|
+
|
|
9003
|
+
const routes = route(fromModel);
|
|
9004
|
+
const routeModels = Object.keys(routes);
|
|
9005
|
+
|
|
9006
|
+
routeModels.forEach(toModel => {
|
|
9007
|
+
const fn = routes[toModel];
|
|
9008
|
+
|
|
9009
|
+
convert[fromModel][toModel] = wrapRounded(fn);
|
|
9010
|
+
convert[fromModel][toModel].raw = wrapRaw(fn);
|
|
9011
|
+
});
|
|
9012
|
+
});
|
|
9013
|
+
|
|
9014
|
+
var colorConvert = convert;
|
|
9015
|
+
|
|
9016
|
+
var __importDefault$1 = (utils.commonjsGlobal && utils.commonjsGlobal.__importDefault) || function (mod) {
|
|
9017
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9018
|
+
};
|
|
9019
|
+
Object.defineProperty(colorToFilter, "__esModule", { value: true });
|
|
9020
|
+
colorToFilter.ColorToFilter = void 0;
|
|
9021
|
+
const errorHandling_1$3 = errorHandling;
|
|
9022
|
+
const sheenUtil_1 = sheenUtil;
|
|
9023
|
+
const colorTypes_1$1 = colorTypes;
|
|
9024
|
+
const rgbToFilter_1 = rgbToFilter;
|
|
9025
|
+
const colorParser_1 = colorParser;
|
|
9026
|
+
const color_convert_1$1 = __importDefault$1(colorConvert);
|
|
9027
|
+
class ColorToFilter {
|
|
9028
|
+
static rgbToFilter(rgbString, options) {
|
|
9029
|
+
return rgbToFilter_1.RgbToFilter.convert({
|
|
9030
|
+
colorString: rgbString,
|
|
9031
|
+
validateAndParse: colorParser_1.ColorParser.validateAndParseRgb,
|
|
9032
|
+
addSheen: sheenUtil_1.SheenUtil.parseSheenFromOptions(options),
|
|
9033
|
+
});
|
|
9034
|
+
}
|
|
9035
|
+
static hexToFilter(hexString, options) {
|
|
9036
|
+
return rgbToFilter_1.RgbToFilter.convert({
|
|
9037
|
+
colorString: hexString,
|
|
9038
|
+
validateAndParse: colorParser_1.ColorParser.validateAndParseHex,
|
|
9039
|
+
convertToRgb: color_convert_1$1.default.hex.rgb,
|
|
9040
|
+
addSheen: sheenUtil_1.SheenUtil.parseSheenFromOptions(options),
|
|
9041
|
+
});
|
|
9042
|
+
}
|
|
9043
|
+
static hslToFilter(hslString, options) {
|
|
9044
|
+
return rgbToFilter_1.RgbToFilter.convert({
|
|
9045
|
+
colorString: hslString,
|
|
9046
|
+
validateAndParse: colorParser_1.ColorParser.validateAndParseHsl,
|
|
9047
|
+
convertToRgb: color_convert_1$1.default.hsl.rgb,
|
|
9048
|
+
addSheen: sheenUtil_1.SheenUtil.parseSheenFromOptions(options),
|
|
9049
|
+
});
|
|
9050
|
+
}
|
|
9051
|
+
static keywordToFilter(keyword, options) {
|
|
9052
|
+
return rgbToFilter_1.RgbToFilter.convert({
|
|
9053
|
+
colorString: keyword,
|
|
9054
|
+
validateAndParse: colorParser_1.ColorParser.validateAndParseKeyword,
|
|
9055
|
+
convertToRgb: color_convert_1$1.default.keyword.rgb,
|
|
9056
|
+
conversionErrorMessage: errorHandling_1$3.ErrorHandling.generateInputErrorMessage(colorTypes_1$1.ColorTypes.KEYWORD, keyword),
|
|
9057
|
+
addSheen: sheenUtil_1.SheenUtil.parseSheenFromOptions(options),
|
|
9058
|
+
});
|
|
9059
|
+
}
|
|
9060
|
+
}
|
|
9061
|
+
colorToFilter.ColorToFilter = ColorToFilter;
|
|
9062
|
+
|
|
9063
|
+
var filterToColor = {};
|
|
9064
|
+
|
|
9065
|
+
var filterToHex = {};
|
|
9066
|
+
|
|
9067
|
+
var browser = {};
|
|
9068
|
+
|
|
9069
|
+
var shared = {};
|
|
9070
|
+
|
|
9071
|
+
Object.defineProperty(shared, "__esModule", { value: true });
|
|
9072
|
+
shared.FilterToHexShared = void 0;
|
|
9073
|
+
const errorHandling_1$2 = errorHandling;
|
|
9074
|
+
const colorFormats_1 = colorFormats;
|
|
9075
|
+
const colorTypes_1 = colorTypes;
|
|
9076
|
+
class FilterToHexShared {
|
|
9077
|
+
static generateInputErrorMessage(filterString) {
|
|
9078
|
+
return errorHandling_1$2.ErrorHandling.generateInputErrorMessage(colorTypes_1.ColorTypes.FILTER, filterString, colorFormats_1.ColorFormats.FILTER);
|
|
9079
|
+
}
|
|
9080
|
+
// functions are encapsulated within a single method in order to allow them to be executed within the same context
|
|
9081
|
+
// of the puppeteer evaluate method
|
|
9082
|
+
static addSVGElementsToDOMAndValidateFilter(filterString, svgSideLength = 1) {
|
|
9083
|
+
function createSVGElement() {
|
|
9084
|
+
const xmlns = 'http://www.w3.org/2000/svg';
|
|
9085
|
+
const svgElement = document.createElementNS(xmlns, 'svg');
|
|
9086
|
+
svgElement.style.height = 'inherit';
|
|
9087
|
+
svgElement.style.width = 'inherit';
|
|
9088
|
+
svgElement.style.float = 'left';
|
|
9089
|
+
svgElement.style.filter = filterString;
|
|
9090
|
+
const rect = document.createElementNS(xmlns, 'rect');
|
|
9091
|
+
rect.setAttributeNS(null, 'width', svgSideLength.toString());
|
|
9092
|
+
rect.setAttributeNS(null, 'height', svgSideLength.toString());
|
|
9093
|
+
svgElement.appendChild(rect);
|
|
9094
|
+
return svgElement;
|
|
9095
|
+
}
|
|
9096
|
+
function createSVGContainerElement() {
|
|
9097
|
+
const svgContainerElement = document.createElement('div');
|
|
9098
|
+
svgContainerElement.style.height = `${svgSideLength}px`;
|
|
9099
|
+
svgContainerElement.style.width = `${svgSideLength}px`;
|
|
9100
|
+
svgContainerElement.style.position = 'absolute';
|
|
9101
|
+
svgContainerElement.style.top = '0px';
|
|
9102
|
+
svgContainerElement.style.left = '0px';
|
|
9103
|
+
return svgContainerElement;
|
|
9104
|
+
}
|
|
9105
|
+
const svgContainerElement = createSVGContainerElement();
|
|
9106
|
+
const svgElement = createSVGElement();
|
|
9107
|
+
if (svgElement.style.filter === '')
|
|
9108
|
+
return { errorMessage: 'error indicator', svgContainerElement };
|
|
9109
|
+
svgContainerElement.appendChild(svgElement);
|
|
9110
|
+
document.body.appendChild(svgContainerElement);
|
|
9111
|
+
return { svgContainerElement };
|
|
9112
|
+
}
|
|
9113
|
+
// functions are encapsulated within a single method in order to allow them to be executed within the same context
|
|
9114
|
+
// of the puppeteer evaluate method
|
|
9115
|
+
static async getColorViaImageDataURL(base64EncodedDataURL) {
|
|
9116
|
+
function rgbToHex(r, g, b) {
|
|
9117
|
+
if (r > 255 || g > 255 || b > 255)
|
|
9118
|
+
throw new Error('Invalid color component');
|
|
9119
|
+
return ((r << 16) | (g << 8) | b).toString(16);
|
|
9120
|
+
}
|
|
9121
|
+
function getData(canvasElement) {
|
|
9122
|
+
const canvasStartCoordinate = 0;
|
|
9123
|
+
const canvasFinalCoordinate = canvasElement.width;
|
|
9124
|
+
return canvasElement.getContext('2d').getImageData(canvasStartCoordinate, canvasStartCoordinate, canvasFinalCoordinate, canvasFinalCoordinate).data;
|
|
9125
|
+
}
|
|
9126
|
+
function getCanvasHexColor(canvasElement) {
|
|
9127
|
+
const data = getData(canvasElement);
|
|
9128
|
+
const hex = rgbToHex(data[0], data[1], data[2]);
|
|
9129
|
+
return `#${`000000${hex}`.slice(-6)}`;
|
|
9130
|
+
}
|
|
9131
|
+
function createCanvasElement(imageElement) {
|
|
9132
|
+
const canvasElement = document.createElement('canvas');
|
|
9133
|
+
canvasElement.width = imageElement.width;
|
|
9134
|
+
canvasElement.height = imageElement.height;
|
|
9135
|
+
canvasElement.getContext('2d').drawImage(imageElement, 0, 0, imageElement.width, imageElement.height);
|
|
9136
|
+
return canvasElement;
|
|
9137
|
+
}
|
|
9138
|
+
async function createImage() {
|
|
9139
|
+
const imageElement = new Image();
|
|
9140
|
+
imageElement.src = base64EncodedDataURL;
|
|
9141
|
+
return new Promise((resolve) => {
|
|
9142
|
+
setTimeout(() => resolve(imageElement));
|
|
9143
|
+
});
|
|
9144
|
+
}
|
|
9145
|
+
const imageElement = await createImage();
|
|
9146
|
+
const canvasElement = createCanvasElement(imageElement);
|
|
9147
|
+
return getCanvasHexColor(canvasElement);
|
|
9148
|
+
}
|
|
9149
|
+
}
|
|
9150
|
+
shared.FilterToHexShared = FilterToHexShared;
|
|
9151
|
+
|
|
9152
|
+
var domToImage = {exports: {}};
|
|
9153
|
+
|
|
9154
|
+
(function (module) {
|
|
9155
|
+
(function (global) {
|
|
9156
|
+
|
|
9157
|
+
var util = newUtil();
|
|
9158
|
+
var inliner = newInliner();
|
|
9159
|
+
var fontFaces = newFontFaces();
|
|
9160
|
+
var images = newImages();
|
|
9161
|
+
|
|
9162
|
+
// Default impl options
|
|
9163
|
+
var defaultOptions = {
|
|
9164
|
+
// Default is to fail on error, no placeholder
|
|
9165
|
+
imagePlaceholder: undefined,
|
|
9166
|
+
// Default cache bust is false, it will use the cache
|
|
9167
|
+
cacheBust: false
|
|
9168
|
+
};
|
|
9169
|
+
|
|
9170
|
+
var domtoimage = {
|
|
9171
|
+
toSvg: toSvg,
|
|
9172
|
+
toPng: toPng,
|
|
9173
|
+
toJpeg: toJpeg,
|
|
9174
|
+
toBlob: toBlob,
|
|
9175
|
+
toPixelData: toPixelData,
|
|
9176
|
+
impl: {
|
|
9177
|
+
fontFaces: fontFaces,
|
|
9178
|
+
images: images,
|
|
9179
|
+
util: util,
|
|
9180
|
+
inliner: inliner,
|
|
9181
|
+
options: {}
|
|
9182
|
+
}
|
|
9183
|
+
};
|
|
9184
|
+
|
|
9185
|
+
module.exports = domtoimage;
|
|
9186
|
+
|
|
9187
|
+
|
|
9188
|
+
/**
|
|
9189
|
+
* @param {Node} node - The DOM Node object to render
|
|
9190
|
+
* @param {Object} options - Rendering options
|
|
9191
|
+
* @param {Function} options.filter - Should return true if passed node should be included in the output
|
|
9192
|
+
* (excluding node means excluding it's children as well). Not called on the root node.
|
|
9193
|
+
* @param {String} options.bgcolor - color for the background, any valid CSS color value.
|
|
9194
|
+
* @param {Number} options.width - width to be applied to node before rendering.
|
|
9195
|
+
* @param {Number} options.height - height to be applied to node before rendering.
|
|
9196
|
+
* @param {Object} options.style - an object whose properties to be copied to node's style before rendering.
|
|
9197
|
+
* @param {Number} options.quality - a Number between 0 and 1 indicating image quality (applicable to JPEG only),
|
|
9198
|
+
defaults to 1.0.
|
|
9199
|
+
* @param {String} options.imagePlaceholder - dataURL to use as a placeholder for failed images, default behaviour is to fail fast on images we can't fetch
|
|
9200
|
+
* @param {Boolean} options.cacheBust - set to true to cache bust by appending the time to the request url
|
|
9201
|
+
* @return {Promise} - A promise that is fulfilled with a SVG image data URL
|
|
9202
|
+
* */
|
|
9203
|
+
function toSvg(node, options) {
|
|
9204
|
+
options = options || {};
|
|
9205
|
+
copyOptions(options);
|
|
9206
|
+
return Promise.resolve(node)
|
|
9207
|
+
.then(function (node) {
|
|
9208
|
+
return cloneNode(node, options.filter, true);
|
|
9209
|
+
})
|
|
9210
|
+
.then(embedFonts)
|
|
9211
|
+
.then(inlineImages)
|
|
9212
|
+
.then(applyOptions)
|
|
9213
|
+
.then(function (clone) {
|
|
9214
|
+
return makeSvgDataUri(clone,
|
|
9215
|
+
options.width || util.width(node),
|
|
9216
|
+
options.height || util.height(node)
|
|
9217
|
+
);
|
|
9218
|
+
});
|
|
9219
|
+
|
|
9220
|
+
function applyOptions(clone) {
|
|
9221
|
+
if (options.bgcolor) clone.style.backgroundColor = options.bgcolor;
|
|
9222
|
+
|
|
9223
|
+
if (options.width) clone.style.width = options.width + 'px';
|
|
9224
|
+
if (options.height) clone.style.height = options.height + 'px';
|
|
9225
|
+
|
|
9226
|
+
if (options.style)
|
|
9227
|
+
Object.keys(options.style).forEach(function (property) {
|
|
9228
|
+
clone.style[property] = options.style[property];
|
|
9229
|
+
});
|
|
9230
|
+
|
|
9231
|
+
return clone;
|
|
9232
|
+
}
|
|
9233
|
+
}
|
|
9234
|
+
|
|
9235
|
+
/**
|
|
9236
|
+
* @param {Node} node - The DOM Node object to render
|
|
9237
|
+
* @param {Object} options - Rendering options, @see {@link toSvg}
|
|
9238
|
+
* @return {Promise} - A promise that is fulfilled with a Uint8Array containing RGBA pixel data.
|
|
9239
|
+
* */
|
|
9240
|
+
function toPixelData(node, options) {
|
|
9241
|
+
return draw(node, options || {})
|
|
9242
|
+
.then(function (canvas) {
|
|
9243
|
+
return canvas.getContext('2d').getImageData(
|
|
9244
|
+
0,
|
|
9245
|
+
0,
|
|
9246
|
+
util.width(node),
|
|
9247
|
+
util.height(node)
|
|
9248
|
+
).data;
|
|
9249
|
+
});
|
|
9250
|
+
}
|
|
9251
|
+
|
|
9252
|
+
/**
|
|
9253
|
+
* @param {Node} node - The DOM Node object to render
|
|
9254
|
+
* @param {Object} options - Rendering options, @see {@link toSvg}
|
|
9255
|
+
* @return {Promise} - A promise that is fulfilled with a PNG image data URL
|
|
9256
|
+
* */
|
|
9257
|
+
function toPng(node, options) {
|
|
9258
|
+
return draw(node, options || {})
|
|
9259
|
+
.then(function (canvas) {
|
|
9260
|
+
return canvas.toDataURL();
|
|
9261
|
+
});
|
|
9262
|
+
}
|
|
9263
|
+
|
|
9264
|
+
/**
|
|
9265
|
+
* @param {Node} node - The DOM Node object to render
|
|
9266
|
+
* @param {Object} options - Rendering options, @see {@link toSvg}
|
|
9267
|
+
* @return {Promise} - A promise that is fulfilled with a JPEG image data URL
|
|
9268
|
+
* */
|
|
9269
|
+
function toJpeg(node, options) {
|
|
9270
|
+
options = options || {};
|
|
9271
|
+
return draw(node, options)
|
|
9272
|
+
.then(function (canvas) {
|
|
9273
|
+
return canvas.toDataURL('image/jpeg', options.quality || 1.0);
|
|
9274
|
+
});
|
|
9275
|
+
}
|
|
9276
|
+
|
|
9277
|
+
/**
|
|
9278
|
+
* @param {Node} node - The DOM Node object to render
|
|
9279
|
+
* @param {Object} options - Rendering options, @see {@link toSvg}
|
|
9280
|
+
* @return {Promise} - A promise that is fulfilled with a PNG image blob
|
|
9281
|
+
* */
|
|
9282
|
+
function toBlob(node, options) {
|
|
9283
|
+
return draw(node, options || {})
|
|
9284
|
+
.then(util.canvasToBlob);
|
|
9285
|
+
}
|
|
9286
|
+
|
|
9287
|
+
function copyOptions(options) {
|
|
9288
|
+
// Copy options to impl options for use in impl
|
|
9289
|
+
if(typeof(options.imagePlaceholder) === 'undefined') {
|
|
9290
|
+
domtoimage.impl.options.imagePlaceholder = defaultOptions.imagePlaceholder;
|
|
9291
|
+
} else {
|
|
9292
|
+
domtoimage.impl.options.imagePlaceholder = options.imagePlaceholder;
|
|
9293
|
+
}
|
|
9294
|
+
|
|
9295
|
+
if(typeof(options.cacheBust) === 'undefined') {
|
|
9296
|
+
domtoimage.impl.options.cacheBust = defaultOptions.cacheBust;
|
|
9297
|
+
} else {
|
|
9298
|
+
domtoimage.impl.options.cacheBust = options.cacheBust;
|
|
9299
|
+
}
|
|
9300
|
+
}
|
|
9301
|
+
|
|
9302
|
+
function draw(domNode, options) {
|
|
9303
|
+
return toSvg(domNode, options)
|
|
9304
|
+
.then(util.makeImage)
|
|
9305
|
+
.then(util.delay(100))
|
|
9306
|
+
.then(function (image) {
|
|
9307
|
+
var canvas = newCanvas(domNode);
|
|
9308
|
+
canvas.getContext('2d').drawImage(image, 0, 0);
|
|
9309
|
+
return canvas;
|
|
9310
|
+
});
|
|
9311
|
+
|
|
9312
|
+
function newCanvas(domNode) {
|
|
9313
|
+
var canvas = document.createElement('canvas');
|
|
9314
|
+
canvas.width = options.width || util.width(domNode);
|
|
9315
|
+
canvas.height = options.height || util.height(domNode);
|
|
9316
|
+
|
|
9317
|
+
if (options.bgcolor) {
|
|
9318
|
+
var ctx = canvas.getContext('2d');
|
|
9319
|
+
ctx.fillStyle = options.bgcolor;
|
|
9320
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
9321
|
+
}
|
|
9322
|
+
|
|
9323
|
+
return canvas;
|
|
9324
|
+
}
|
|
9325
|
+
}
|
|
9326
|
+
|
|
9327
|
+
function cloneNode(node, filter, root) {
|
|
9328
|
+
if (!root && filter && !filter(node)) return Promise.resolve();
|
|
9329
|
+
|
|
9330
|
+
return Promise.resolve(node)
|
|
9331
|
+
.then(makeNodeCopy)
|
|
9332
|
+
.then(function (clone) {
|
|
9333
|
+
return cloneChildren(node, clone, filter);
|
|
9334
|
+
})
|
|
9335
|
+
.then(function (clone) {
|
|
9336
|
+
return processClone(node, clone);
|
|
9337
|
+
});
|
|
9338
|
+
|
|
9339
|
+
function makeNodeCopy(node) {
|
|
9340
|
+
if (node instanceof HTMLCanvasElement) return util.makeImage(node.toDataURL());
|
|
9341
|
+
return node.cloneNode(false);
|
|
9342
|
+
}
|
|
9343
|
+
|
|
9344
|
+
function cloneChildren(original, clone, filter) {
|
|
9345
|
+
var children = original.childNodes;
|
|
9346
|
+
if (children.length === 0) return Promise.resolve(clone);
|
|
9347
|
+
|
|
9348
|
+
return cloneChildrenInOrder(clone, util.asArray(children), filter)
|
|
9349
|
+
.then(function () {
|
|
9350
|
+
return clone;
|
|
9351
|
+
});
|
|
9352
|
+
|
|
9353
|
+
function cloneChildrenInOrder(parent, children, filter) {
|
|
9354
|
+
var done = Promise.resolve();
|
|
9355
|
+
children.forEach(function (child) {
|
|
9356
|
+
done = done
|
|
9357
|
+
.then(function () {
|
|
9358
|
+
return cloneNode(child, filter);
|
|
9359
|
+
})
|
|
9360
|
+
.then(function (childClone) {
|
|
9361
|
+
if (childClone) parent.appendChild(childClone);
|
|
9362
|
+
});
|
|
9363
|
+
});
|
|
9364
|
+
return done;
|
|
9365
|
+
}
|
|
9366
|
+
}
|
|
9367
|
+
|
|
9368
|
+
function processClone(original, clone) {
|
|
9369
|
+
if (!(clone instanceof Element)) return clone;
|
|
9370
|
+
|
|
9371
|
+
return Promise.resolve()
|
|
9372
|
+
.then(cloneStyle)
|
|
9373
|
+
.then(clonePseudoElements)
|
|
9374
|
+
.then(copyUserInput)
|
|
9375
|
+
.then(fixSvg)
|
|
9376
|
+
.then(function () {
|
|
9377
|
+
return clone;
|
|
9378
|
+
});
|
|
9379
|
+
|
|
9380
|
+
function cloneStyle() {
|
|
9381
|
+
copyStyle(window.getComputedStyle(original), clone.style);
|
|
9382
|
+
|
|
9383
|
+
function copyStyle(source, target) {
|
|
9384
|
+
if (source.cssText) target.cssText = source.cssText;
|
|
9385
|
+
else copyProperties(source, target);
|
|
9386
|
+
|
|
9387
|
+
function copyProperties(source, target) {
|
|
9388
|
+
util.asArray(source).forEach(function (name) {
|
|
9389
|
+
target.setProperty(
|
|
9390
|
+
name,
|
|
9391
|
+
source.getPropertyValue(name),
|
|
9392
|
+
source.getPropertyPriority(name)
|
|
9393
|
+
);
|
|
9394
|
+
});
|
|
9395
|
+
}
|
|
9396
|
+
}
|
|
9397
|
+
}
|
|
9398
|
+
|
|
9399
|
+
function clonePseudoElements() {
|
|
9400
|
+
[':before', ':after'].forEach(function (element) {
|
|
9401
|
+
clonePseudoElement(element);
|
|
9402
|
+
});
|
|
9403
|
+
|
|
9404
|
+
function clonePseudoElement(element) {
|
|
9405
|
+
var style = window.getComputedStyle(original, element);
|
|
9406
|
+
var content = style.getPropertyValue('content');
|
|
9407
|
+
|
|
9408
|
+
if (content === '' || content === 'none') return;
|
|
9409
|
+
|
|
9410
|
+
var className = util.uid();
|
|
9411
|
+
clone.className = clone.className + ' ' + className;
|
|
9412
|
+
var styleElement = document.createElement('style');
|
|
9413
|
+
styleElement.appendChild(formatPseudoElementStyle(className, element, style));
|
|
9414
|
+
clone.appendChild(styleElement);
|
|
9415
|
+
|
|
9416
|
+
function formatPseudoElementStyle(className, element, style) {
|
|
9417
|
+
var selector = '.' + className + ':' + element;
|
|
9418
|
+
var cssText = style.cssText ? formatCssText(style) : formatCssProperties(style);
|
|
9419
|
+
return document.createTextNode(selector + '{' + cssText + '}');
|
|
9420
|
+
|
|
9421
|
+
function formatCssText(style) {
|
|
9422
|
+
var content = style.getPropertyValue('content');
|
|
9423
|
+
return style.cssText + ' content: ' + content + ';';
|
|
9424
|
+
}
|
|
9425
|
+
|
|
9426
|
+
function formatCssProperties(style) {
|
|
9427
|
+
|
|
9428
|
+
return util.asArray(style)
|
|
9429
|
+
.map(formatProperty)
|
|
9430
|
+
.join('; ') + ';';
|
|
9431
|
+
|
|
9432
|
+
function formatProperty(name) {
|
|
9433
|
+
return name + ': ' +
|
|
9434
|
+
style.getPropertyValue(name) +
|
|
9435
|
+
(style.getPropertyPriority(name) ? ' !important' : '');
|
|
9436
|
+
}
|
|
9437
|
+
}
|
|
9438
|
+
}
|
|
9439
|
+
}
|
|
9440
|
+
}
|
|
9441
|
+
|
|
9442
|
+
function copyUserInput() {
|
|
9443
|
+
if (original instanceof HTMLTextAreaElement) clone.innerHTML = original.value;
|
|
9444
|
+
if (original instanceof HTMLInputElement) clone.setAttribute("value", original.value);
|
|
9445
|
+
}
|
|
9446
|
+
|
|
9447
|
+
function fixSvg() {
|
|
9448
|
+
if (!(clone instanceof SVGElement)) return;
|
|
9449
|
+
clone.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
|
|
9450
|
+
|
|
9451
|
+
if (!(clone instanceof SVGRectElement)) return;
|
|
9452
|
+
['width', 'height'].forEach(function (attribute) {
|
|
9453
|
+
var value = clone.getAttribute(attribute);
|
|
9454
|
+
if (!value) return;
|
|
9455
|
+
|
|
9456
|
+
clone.style.setProperty(attribute, value);
|
|
9457
|
+
});
|
|
9458
|
+
}
|
|
9459
|
+
}
|
|
9460
|
+
}
|
|
9461
|
+
|
|
9462
|
+
function embedFonts(node) {
|
|
9463
|
+
return fontFaces.resolveAll()
|
|
9464
|
+
.then(function (cssText) {
|
|
9465
|
+
var styleNode = document.createElement('style');
|
|
9466
|
+
node.appendChild(styleNode);
|
|
9467
|
+
styleNode.appendChild(document.createTextNode(cssText));
|
|
9468
|
+
return node;
|
|
9469
|
+
});
|
|
9470
|
+
}
|
|
9471
|
+
|
|
9472
|
+
function inlineImages(node) {
|
|
9473
|
+
return images.inlineAll(node)
|
|
9474
|
+
.then(function () {
|
|
9475
|
+
return node;
|
|
9476
|
+
});
|
|
9477
|
+
}
|
|
9478
|
+
|
|
9479
|
+
function makeSvgDataUri(node, width, height) {
|
|
9480
|
+
return Promise.resolve(node)
|
|
9481
|
+
.then(function (node) {
|
|
9482
|
+
node.setAttribute('xmlns', 'http://www.w3.org/1999/xhtml');
|
|
9483
|
+
return new XMLSerializer().serializeToString(node);
|
|
9484
|
+
})
|
|
9485
|
+
.then(util.escapeXhtml)
|
|
9486
|
+
.then(function (xhtml) {
|
|
9487
|
+
return '<foreignObject x="0" y="0" width="100%" height="100%">' + xhtml + '</foreignObject>';
|
|
9488
|
+
})
|
|
9489
|
+
.then(function (foreignObject) {
|
|
9490
|
+
return '<svg xmlns="http://www.w3.org/2000/svg" width="' + width + '" height="' + height + '">' +
|
|
9491
|
+
foreignObject + '</svg>';
|
|
9492
|
+
})
|
|
9493
|
+
.then(function (svg) {
|
|
9494
|
+
return 'data:image/svg+xml;charset=utf-8,' + svg;
|
|
9495
|
+
});
|
|
9496
|
+
}
|
|
9497
|
+
|
|
9498
|
+
function newUtil() {
|
|
9499
|
+
return {
|
|
9500
|
+
escape: escape,
|
|
9501
|
+
parseExtension: parseExtension,
|
|
9502
|
+
mimeType: mimeType,
|
|
9503
|
+
dataAsUrl: dataAsUrl,
|
|
9504
|
+
isDataUrl: isDataUrl,
|
|
9505
|
+
canvasToBlob: canvasToBlob,
|
|
9506
|
+
resolveUrl: resolveUrl,
|
|
9507
|
+
getAndEncode: getAndEncode,
|
|
9508
|
+
uid: uid(),
|
|
9509
|
+
delay: delay,
|
|
9510
|
+
asArray: asArray,
|
|
9511
|
+
escapeXhtml: escapeXhtml,
|
|
9512
|
+
makeImage: makeImage,
|
|
9513
|
+
width: width,
|
|
9514
|
+
height: height
|
|
9515
|
+
};
|
|
9516
|
+
|
|
9517
|
+
function mimes() {
|
|
9518
|
+
/*
|
|
9519
|
+
* Only WOFF and EOT mime types for fonts are 'real'
|
|
9520
|
+
* see http://www.iana.org/assignments/media-types/media-types.xhtml
|
|
9521
|
+
*/
|
|
9522
|
+
var WOFF = 'application/font-woff';
|
|
9523
|
+
var JPEG = 'image/jpeg';
|
|
9524
|
+
|
|
9525
|
+
return {
|
|
9526
|
+
'woff': WOFF,
|
|
9527
|
+
'woff2': WOFF,
|
|
9528
|
+
'ttf': 'application/font-truetype',
|
|
9529
|
+
'eot': 'application/vnd.ms-fontobject',
|
|
9530
|
+
'png': 'image/png',
|
|
9531
|
+
'jpg': JPEG,
|
|
9532
|
+
'jpeg': JPEG,
|
|
9533
|
+
'gif': 'image/gif',
|
|
9534
|
+
'tiff': 'image/tiff',
|
|
9535
|
+
'svg': 'image/svg+xml'
|
|
9536
|
+
};
|
|
9537
|
+
}
|
|
9538
|
+
|
|
9539
|
+
function parseExtension(url) {
|
|
9540
|
+
var match = /\.([^\.\/]*?)$/g.exec(url);
|
|
9541
|
+
if (match) return match[1];
|
|
9542
|
+
else return '';
|
|
9543
|
+
}
|
|
9544
|
+
|
|
9545
|
+
function mimeType(url) {
|
|
9546
|
+
var extension = parseExtension(url).toLowerCase();
|
|
9547
|
+
return mimes()[extension] || '';
|
|
9548
|
+
}
|
|
9549
|
+
|
|
9550
|
+
function isDataUrl(url) {
|
|
9551
|
+
return url.search(/^(data:)/) !== -1;
|
|
9552
|
+
}
|
|
9553
|
+
|
|
9554
|
+
function toBlob(canvas) {
|
|
9555
|
+
return new Promise(function (resolve) {
|
|
9556
|
+
var binaryString = window.atob(canvas.toDataURL().split(',')[1]);
|
|
9557
|
+
var length = binaryString.length;
|
|
9558
|
+
var binaryArray = new Uint8Array(length);
|
|
9559
|
+
|
|
9560
|
+
for (var i = 0; i < length; i++)
|
|
9561
|
+
binaryArray[i] = binaryString.charCodeAt(i);
|
|
9562
|
+
|
|
9563
|
+
resolve(new Blob([binaryArray], {
|
|
9564
|
+
type: 'image/png'
|
|
9565
|
+
}));
|
|
9566
|
+
});
|
|
9567
|
+
}
|
|
9568
|
+
|
|
9569
|
+
function canvasToBlob(canvas) {
|
|
9570
|
+
if (canvas.toBlob)
|
|
9571
|
+
return new Promise(function (resolve) {
|
|
9572
|
+
canvas.toBlob(resolve);
|
|
9573
|
+
});
|
|
9574
|
+
|
|
9575
|
+
return toBlob(canvas);
|
|
9576
|
+
}
|
|
9577
|
+
|
|
9578
|
+
function resolveUrl(url, baseUrl) {
|
|
9579
|
+
var doc = document.implementation.createHTMLDocument();
|
|
9580
|
+
var base = doc.createElement('base');
|
|
9581
|
+
doc.head.appendChild(base);
|
|
9582
|
+
var a = doc.createElement('a');
|
|
9583
|
+
doc.body.appendChild(a);
|
|
9584
|
+
base.href = baseUrl;
|
|
9585
|
+
a.href = url;
|
|
9586
|
+
return a.href;
|
|
9587
|
+
}
|
|
9588
|
+
|
|
9589
|
+
function uid() {
|
|
9590
|
+
var index = 0;
|
|
9591
|
+
|
|
9592
|
+
return function () {
|
|
9593
|
+
return 'u' + fourRandomChars() + index++;
|
|
9594
|
+
|
|
9595
|
+
function fourRandomChars() {
|
|
9596
|
+
/* see http://stackoverflow.com/a/6248722/2519373 */
|
|
9597
|
+
return ('0000' + (Math.random() * Math.pow(36, 4) << 0).toString(36)).slice(-4);
|
|
9598
|
+
}
|
|
9599
|
+
};
|
|
9600
|
+
}
|
|
9601
|
+
|
|
9602
|
+
function makeImage(uri) {
|
|
9603
|
+
return new Promise(function (resolve, reject) {
|
|
9604
|
+
var image = new Image();
|
|
9605
|
+
image.onload = function () {
|
|
9606
|
+
resolve(image);
|
|
9607
|
+
};
|
|
9608
|
+
image.onerror = reject;
|
|
9609
|
+
image.src = uri;
|
|
9610
|
+
});
|
|
9611
|
+
}
|
|
9612
|
+
|
|
9613
|
+
function getAndEncode(url) {
|
|
9614
|
+
var TIMEOUT = 30000;
|
|
9615
|
+
if(domtoimage.impl.options.cacheBust) {
|
|
9616
|
+
// Cache bypass so we dont have CORS issues with cached images
|
|
9617
|
+
// Source: https://developer.mozilla.org/en/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest#Bypassing_the_cache
|
|
9618
|
+
url += ((/\?/).test(url) ? "&" : "?") + (new Date()).getTime();
|
|
9619
|
+
}
|
|
9620
|
+
|
|
9621
|
+
return new Promise(function (resolve) {
|
|
9622
|
+
var request = new XMLHttpRequest();
|
|
9623
|
+
|
|
9624
|
+
request.onreadystatechange = done;
|
|
9625
|
+
request.ontimeout = timeout;
|
|
9626
|
+
request.responseType = 'blob';
|
|
9627
|
+
request.timeout = TIMEOUT;
|
|
9628
|
+
request.open('GET', url, true);
|
|
9629
|
+
request.send();
|
|
9630
|
+
|
|
9631
|
+
var placeholder;
|
|
9632
|
+
if(domtoimage.impl.options.imagePlaceholder) {
|
|
9633
|
+
var split = domtoimage.impl.options.imagePlaceholder.split(/,/);
|
|
9634
|
+
if(split && split[1]) {
|
|
9635
|
+
placeholder = split[1];
|
|
9636
|
+
}
|
|
9637
|
+
}
|
|
9638
|
+
|
|
9639
|
+
function done() {
|
|
9640
|
+
if (request.readyState !== 4) return;
|
|
9641
|
+
|
|
9642
|
+
if (request.status !== 200) {
|
|
9643
|
+
if(placeholder) {
|
|
9644
|
+
resolve(placeholder);
|
|
9645
|
+
} else {
|
|
9646
|
+
fail('cannot fetch resource: ' + url + ', status: ' + request.status);
|
|
9647
|
+
}
|
|
9648
|
+
|
|
9649
|
+
return;
|
|
9650
|
+
}
|
|
9651
|
+
|
|
9652
|
+
var encoder = new FileReader();
|
|
9653
|
+
encoder.onloadend = function () {
|
|
9654
|
+
var content = encoder.result.split(/,/)[1];
|
|
9655
|
+
resolve(content);
|
|
9656
|
+
};
|
|
9657
|
+
encoder.readAsDataURL(request.response);
|
|
9658
|
+
}
|
|
9659
|
+
|
|
9660
|
+
function timeout() {
|
|
9661
|
+
if(placeholder) {
|
|
9662
|
+
resolve(placeholder);
|
|
9663
|
+
} else {
|
|
9664
|
+
fail('timeout of ' + TIMEOUT + 'ms occured while fetching resource: ' + url);
|
|
9665
|
+
}
|
|
9666
|
+
}
|
|
9667
|
+
|
|
9668
|
+
function fail(message) {
|
|
9669
|
+
console.error(message);
|
|
9670
|
+
resolve('');
|
|
9671
|
+
}
|
|
9672
|
+
});
|
|
9673
|
+
}
|
|
9674
|
+
|
|
9675
|
+
function dataAsUrl(content, type) {
|
|
9676
|
+
return 'data:' + type + ';base64,' + content;
|
|
9677
|
+
}
|
|
9678
|
+
|
|
9679
|
+
function escape(string) {
|
|
9680
|
+
return string.replace(/([.*+?^${}()|\[\]\/\\])/g, '\\$1');
|
|
9681
|
+
}
|
|
9682
|
+
|
|
9683
|
+
function delay(ms) {
|
|
9684
|
+
return function (arg) {
|
|
9685
|
+
return new Promise(function (resolve) {
|
|
9686
|
+
setTimeout(function () {
|
|
9687
|
+
resolve(arg);
|
|
9688
|
+
}, ms);
|
|
9689
|
+
});
|
|
9690
|
+
};
|
|
9691
|
+
}
|
|
9692
|
+
|
|
9693
|
+
function asArray(arrayLike) {
|
|
9694
|
+
var array = [];
|
|
9695
|
+
var length = arrayLike.length;
|
|
9696
|
+
for (var i = 0; i < length; i++) array.push(arrayLike[i]);
|
|
9697
|
+
return array;
|
|
9698
|
+
}
|
|
9699
|
+
|
|
9700
|
+
function escapeXhtml(string) {
|
|
9701
|
+
return string.replace(/#/g, '%23').replace(/\n/g, '%0A');
|
|
9702
|
+
}
|
|
9703
|
+
|
|
9704
|
+
function width(node) {
|
|
9705
|
+
var leftBorder = px(node, 'border-left-width');
|
|
9706
|
+
var rightBorder = px(node, 'border-right-width');
|
|
9707
|
+
return node.scrollWidth + leftBorder + rightBorder;
|
|
9708
|
+
}
|
|
9709
|
+
|
|
9710
|
+
function height(node) {
|
|
9711
|
+
var topBorder = px(node, 'border-top-width');
|
|
9712
|
+
var bottomBorder = px(node, 'border-bottom-width');
|
|
9713
|
+
return node.scrollHeight + topBorder + bottomBorder;
|
|
9714
|
+
}
|
|
9715
|
+
|
|
9716
|
+
function px(node, styleProperty) {
|
|
9717
|
+
var value = window.getComputedStyle(node).getPropertyValue(styleProperty);
|
|
9718
|
+
return parseFloat(value.replace('px', ''));
|
|
9719
|
+
}
|
|
9720
|
+
}
|
|
9721
|
+
|
|
9722
|
+
function newInliner() {
|
|
9723
|
+
var URL_REGEX = /url\(['"]?([^'"]+?)['"]?\)/g;
|
|
9724
|
+
|
|
9725
|
+
return {
|
|
9726
|
+
inlineAll: inlineAll,
|
|
9727
|
+
shouldProcess: shouldProcess,
|
|
9728
|
+
impl: {
|
|
9729
|
+
readUrls: readUrls,
|
|
9730
|
+
inline: inline
|
|
9731
|
+
}
|
|
9732
|
+
};
|
|
9733
|
+
|
|
9734
|
+
function shouldProcess(string) {
|
|
9735
|
+
return string.search(URL_REGEX) !== -1;
|
|
9736
|
+
}
|
|
9737
|
+
|
|
9738
|
+
function readUrls(string) {
|
|
9739
|
+
var result = [];
|
|
9740
|
+
var match;
|
|
9741
|
+
while ((match = URL_REGEX.exec(string)) !== null) {
|
|
9742
|
+
result.push(match[1]);
|
|
9743
|
+
}
|
|
9744
|
+
return result.filter(function (url) {
|
|
9745
|
+
return !util.isDataUrl(url);
|
|
9746
|
+
});
|
|
9747
|
+
}
|
|
9748
|
+
|
|
9749
|
+
function inline(string, url, baseUrl, get) {
|
|
9750
|
+
return Promise.resolve(url)
|
|
9751
|
+
.then(function (url) {
|
|
9752
|
+
return baseUrl ? util.resolveUrl(url, baseUrl) : url;
|
|
9753
|
+
})
|
|
9754
|
+
.then(get || util.getAndEncode)
|
|
9755
|
+
.then(function (data) {
|
|
9756
|
+
return util.dataAsUrl(data, util.mimeType(url));
|
|
9757
|
+
})
|
|
9758
|
+
.then(function (dataUrl) {
|
|
9759
|
+
return string.replace(urlAsRegex(url), '$1' + dataUrl + '$3');
|
|
9760
|
+
});
|
|
9761
|
+
|
|
9762
|
+
function urlAsRegex(url) {
|
|
9763
|
+
return new RegExp('(url\\([\'"]?)(' + util.escape(url) + ')([\'"]?\\))', 'g');
|
|
9764
|
+
}
|
|
9765
|
+
}
|
|
9766
|
+
|
|
9767
|
+
function inlineAll(string, baseUrl, get) {
|
|
9768
|
+
if (nothingToInline()) return Promise.resolve(string);
|
|
9769
|
+
|
|
9770
|
+
return Promise.resolve(string)
|
|
9771
|
+
.then(readUrls)
|
|
9772
|
+
.then(function (urls) {
|
|
9773
|
+
var done = Promise.resolve(string);
|
|
9774
|
+
urls.forEach(function (url) {
|
|
9775
|
+
done = done.then(function (string) {
|
|
9776
|
+
return inline(string, url, baseUrl, get);
|
|
9777
|
+
});
|
|
9778
|
+
});
|
|
9779
|
+
return done;
|
|
9780
|
+
});
|
|
9781
|
+
|
|
9782
|
+
function nothingToInline() {
|
|
9783
|
+
return !shouldProcess(string);
|
|
9784
|
+
}
|
|
9785
|
+
}
|
|
9786
|
+
}
|
|
9787
|
+
|
|
9788
|
+
function newFontFaces() {
|
|
9789
|
+
return {
|
|
9790
|
+
resolveAll: resolveAll,
|
|
9791
|
+
impl: {
|
|
9792
|
+
readAll: readAll
|
|
9793
|
+
}
|
|
9794
|
+
};
|
|
9795
|
+
|
|
9796
|
+
function resolveAll() {
|
|
9797
|
+
return readAll()
|
|
9798
|
+
.then(function (webFonts) {
|
|
9799
|
+
return Promise.all(
|
|
9800
|
+
webFonts.map(function (webFont) {
|
|
9801
|
+
return webFont.resolve();
|
|
9802
|
+
})
|
|
9803
|
+
);
|
|
9804
|
+
})
|
|
9805
|
+
.then(function (cssStrings) {
|
|
9806
|
+
return cssStrings.join('\n');
|
|
9807
|
+
});
|
|
9808
|
+
}
|
|
9809
|
+
|
|
9810
|
+
function readAll() {
|
|
9811
|
+
return Promise.resolve(util.asArray(document.styleSheets))
|
|
9812
|
+
.then(getCssRules)
|
|
9813
|
+
.then(selectWebFontRules)
|
|
9814
|
+
.then(function (rules) {
|
|
9815
|
+
return rules.map(newWebFont);
|
|
9816
|
+
});
|
|
9817
|
+
|
|
9818
|
+
function selectWebFontRules(cssRules) {
|
|
9819
|
+
return cssRules
|
|
9820
|
+
.filter(function (rule) {
|
|
9821
|
+
return rule.type === CSSRule.FONT_FACE_RULE;
|
|
9822
|
+
})
|
|
9823
|
+
.filter(function (rule) {
|
|
9824
|
+
return inliner.shouldProcess(rule.style.getPropertyValue('src'));
|
|
9825
|
+
});
|
|
9826
|
+
}
|
|
9827
|
+
|
|
9828
|
+
function getCssRules(styleSheets) {
|
|
9829
|
+
var cssRules = [];
|
|
9830
|
+
styleSheets.forEach(function (sheet) {
|
|
9831
|
+
try {
|
|
9832
|
+
util.asArray(sheet.cssRules || []).forEach(cssRules.push.bind(cssRules));
|
|
9833
|
+
} catch (e) {
|
|
9834
|
+
console.log('Error while reading CSS rules from ' + sheet.href, e.toString());
|
|
9835
|
+
}
|
|
9836
|
+
});
|
|
9837
|
+
return cssRules;
|
|
9838
|
+
}
|
|
9839
|
+
|
|
9840
|
+
function newWebFont(webFontRule) {
|
|
9841
|
+
return {
|
|
9842
|
+
resolve: function resolve() {
|
|
9843
|
+
var baseUrl = (webFontRule.parentStyleSheet || {}).href;
|
|
9844
|
+
return inliner.inlineAll(webFontRule.cssText, baseUrl);
|
|
9845
|
+
},
|
|
9846
|
+
src: function () {
|
|
9847
|
+
return webFontRule.style.getPropertyValue('src');
|
|
9848
|
+
}
|
|
9849
|
+
};
|
|
9850
|
+
}
|
|
9851
|
+
}
|
|
9852
|
+
}
|
|
9853
|
+
|
|
9854
|
+
function newImages() {
|
|
9855
|
+
return {
|
|
9856
|
+
inlineAll: inlineAll,
|
|
9857
|
+
impl: {
|
|
9858
|
+
newImage: newImage
|
|
9859
|
+
}
|
|
9860
|
+
};
|
|
9861
|
+
|
|
9862
|
+
function newImage(element) {
|
|
9863
|
+
return {
|
|
9864
|
+
inline: inline
|
|
9865
|
+
};
|
|
9866
|
+
|
|
9867
|
+
function inline(get) {
|
|
9868
|
+
if (util.isDataUrl(element.src)) return Promise.resolve();
|
|
9869
|
+
|
|
9870
|
+
return Promise.resolve(element.src)
|
|
9871
|
+
.then(get || util.getAndEncode)
|
|
9872
|
+
.then(function (data) {
|
|
9873
|
+
return util.dataAsUrl(data, util.mimeType(element.src));
|
|
9874
|
+
})
|
|
9875
|
+
.then(function (dataUrl) {
|
|
9876
|
+
return new Promise(function (resolve, reject) {
|
|
9877
|
+
element.onload = resolve;
|
|
9878
|
+
element.onerror = reject;
|
|
9879
|
+
element.src = dataUrl;
|
|
9880
|
+
});
|
|
9881
|
+
});
|
|
9882
|
+
}
|
|
9883
|
+
}
|
|
9884
|
+
|
|
9885
|
+
function inlineAll(node) {
|
|
9886
|
+
if (!(node instanceof Element)) return Promise.resolve(node);
|
|
9887
|
+
|
|
9888
|
+
return inlineBackground(node)
|
|
9889
|
+
.then(function () {
|
|
9890
|
+
if (node instanceof HTMLImageElement)
|
|
9891
|
+
return newImage(node).inline();
|
|
9892
|
+
else
|
|
9893
|
+
return Promise.all(
|
|
9894
|
+
util.asArray(node.childNodes).map(function (child) {
|
|
9895
|
+
return inlineAll(child);
|
|
9896
|
+
})
|
|
9897
|
+
);
|
|
9898
|
+
});
|
|
9899
|
+
|
|
9900
|
+
function inlineBackground(node) {
|
|
9901
|
+
var background = node.style.getPropertyValue('background');
|
|
9902
|
+
|
|
9903
|
+
if (!background) return Promise.resolve(node);
|
|
9904
|
+
|
|
9905
|
+
return inliner.inlineAll(background)
|
|
9906
|
+
.then(function (inlined) {
|
|
9907
|
+
node.style.setProperty(
|
|
9908
|
+
'background',
|
|
9909
|
+
inlined,
|
|
9910
|
+
node.style.getPropertyPriority('background')
|
|
9911
|
+
);
|
|
9912
|
+
})
|
|
9913
|
+
.then(function () {
|
|
9914
|
+
return node;
|
|
9915
|
+
});
|
|
9916
|
+
}
|
|
9917
|
+
}
|
|
9918
|
+
}
|
|
9919
|
+
})();
|
|
9920
|
+
}(domToImage));
|
|
9921
|
+
|
|
9922
|
+
var __createBinding$1 = (utils.commonjsGlobal && utils.commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9923
|
+
if (k2 === undefined) k2 = k;
|
|
9924
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9925
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9926
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
9927
|
+
}
|
|
9928
|
+
Object.defineProperty(o, k2, desc);
|
|
9929
|
+
}) : (function(o, m, k, k2) {
|
|
9930
|
+
if (k2 === undefined) k2 = k;
|
|
9931
|
+
o[k2] = m[k];
|
|
9932
|
+
}));
|
|
9933
|
+
var __setModuleDefault$1 = (utils.commonjsGlobal && utils.commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
9934
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
9935
|
+
}) : function(o, v) {
|
|
9936
|
+
o["default"] = v;
|
|
9937
|
+
});
|
|
9938
|
+
var __importStar$1 = (utils.commonjsGlobal && utils.commonjsGlobal.__importStar) || function (mod) {
|
|
9939
|
+
if (mod && mod.__esModule) return mod;
|
|
9940
|
+
var result = {};
|
|
9941
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding$1(result, mod, k);
|
|
9942
|
+
__setModuleDefault$1(result, mod);
|
|
9943
|
+
return result;
|
|
9944
|
+
};
|
|
9945
|
+
Object.defineProperty(browser, "__esModule", { value: true });
|
|
9946
|
+
browser.FilterToHexBrowser = void 0;
|
|
9947
|
+
const errorHandling_1$1 = errorHandling;
|
|
9948
|
+
const shared_1 = shared;
|
|
9949
|
+
class FilterToHexBrowser extends shared_1.FilterToHexShared {
|
|
9950
|
+
static cleanup(svgContainerElement) {
|
|
9951
|
+
svgContainerElement.remove();
|
|
9952
|
+
}
|
|
9953
|
+
static returnInputError(filterString, svgContainerElement) {
|
|
9954
|
+
const errorMessage = shared_1.FilterToHexShared.generateInputErrorMessage(filterString);
|
|
9955
|
+
const errorResult = errorHandling_1$1.ErrorHandling.generateErrorResult(errorMessage);
|
|
9956
|
+
FilterToHexBrowser.cleanup(svgContainerElement);
|
|
9957
|
+
return errorResult;
|
|
9958
|
+
}
|
|
9959
|
+
static async getImageBase64ViaSVG(svgContainerElement) {
|
|
9960
|
+
const domToImage$1 = (await Promise.resolve().then(() => __importStar$1(domToImage.exports)));
|
|
9961
|
+
return domToImage$1.toPng(svgContainerElement);
|
|
9962
|
+
}
|
|
9963
|
+
static async convert(filterString) {
|
|
9964
|
+
const { errorMessage, svgContainerElement } = shared_1.FilterToHexShared.addSVGElementsToDOMAndValidateFilter(filterString);
|
|
9965
|
+
if (errorMessage)
|
|
9966
|
+
return FilterToHexBrowser.returnInputError(filterString, svgContainerElement);
|
|
9967
|
+
const base64EncodedDataURL = await FilterToHexBrowser.getImageBase64ViaSVG(svgContainerElement);
|
|
9968
|
+
const hexColor = await shared_1.FilterToHexShared.getColorViaImageDataURL(base64EncodedDataURL);
|
|
9969
|
+
FilterToHexBrowser.cleanup(svgContainerElement);
|
|
9970
|
+
return { color: hexColor };
|
|
9971
|
+
}
|
|
9972
|
+
}
|
|
9973
|
+
browser.FilterToHexBrowser = FilterToHexBrowser;
|
|
7074
9974
|
|
|
7075
|
-
|
|
9975
|
+
var __createBinding = (utils.commonjsGlobal && utils.commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9976
|
+
if (k2 === undefined) k2 = k;
|
|
9977
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9978
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9979
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
9980
|
+
}
|
|
9981
|
+
Object.defineProperty(o, k2, desc);
|
|
9982
|
+
}) : (function(o, m, k, k2) {
|
|
9983
|
+
if (k2 === undefined) k2 = k;
|
|
9984
|
+
o[k2] = m[k];
|
|
9985
|
+
}));
|
|
9986
|
+
var __setModuleDefault = (utils.commonjsGlobal && utils.commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
9987
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
9988
|
+
}) : function(o, v) {
|
|
9989
|
+
o["default"] = v;
|
|
9990
|
+
});
|
|
9991
|
+
var __importStar = (utils.commonjsGlobal && utils.commonjsGlobal.__importStar) || function (mod) {
|
|
9992
|
+
if (mod && mod.__esModule) return mod;
|
|
9993
|
+
var result = {};
|
|
9994
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
9995
|
+
__setModuleDefault(result, mod);
|
|
9996
|
+
return result;
|
|
9997
|
+
};
|
|
9998
|
+
Object.defineProperty(filterToHex, "__esModule", { value: true });
|
|
9999
|
+
filterToHex.FilterToHex = void 0;
|
|
10000
|
+
const errorHandling_1 = errorHandling;
|
|
10001
|
+
const browser_1 = browser;
|
|
10002
|
+
class FilterToHex {
|
|
10003
|
+
static async convert(filterString, convertFromHex, options) {
|
|
10004
|
+
try {
|
|
10005
|
+
let result;
|
|
10006
|
+
if (typeof window === 'undefined') {
|
|
10007
|
+
const { FilterToHexNode } = await Promise.resolve().then(() => __importStar(require('./workers/node')));
|
|
10008
|
+
result = await FilterToHexNode.convert(filterString);
|
|
10009
|
+
}
|
|
10010
|
+
else {
|
|
10011
|
+
result = await browser_1.FilterToHexBrowser.convert(filterString);
|
|
10012
|
+
}
|
|
10013
|
+
if (result.color && convertFromHex && typeof result.color === 'string') {
|
|
10014
|
+
result.color = convertFromHex(result.color, options);
|
|
10015
|
+
}
|
|
10016
|
+
return result;
|
|
10017
|
+
}
|
|
10018
|
+
catch (error) {
|
|
10019
|
+
return errorHandling_1.ErrorHandling.generateUnexpectedError(error);
|
|
10020
|
+
}
|
|
10021
|
+
}
|
|
10022
|
+
}
|
|
10023
|
+
filterToHex.FilterToHex = FilterToHex;
|
|
10024
|
+
|
|
10025
|
+
var hexToColor = {};
|
|
10026
|
+
|
|
10027
|
+
var colorFormatter = {};
|
|
10028
|
+
|
|
10029
|
+
Object.defineProperty(colorFormatter, "__esModule", { value: true });
|
|
10030
|
+
colorFormatter.ColorFormatter = void 0;
|
|
10031
|
+
class ColorFormatter {
|
|
10032
|
+
static arrayToRgbString(rgbArray) {
|
|
10033
|
+
return `rgb(${rgbArray[0]}, ${rgbArray[1]}, ${rgbArray[2]})`;
|
|
10034
|
+
}
|
|
10035
|
+
static arrayToHslString(hslArray) {
|
|
10036
|
+
return `hsl(${hslArray[0]}deg, ${hslArray[1]}%, ${hslArray[2]}%)`;
|
|
10037
|
+
}
|
|
10038
|
+
}
|
|
10039
|
+
colorFormatter.ColorFormatter = ColorFormatter;
|
|
10040
|
+
|
|
10041
|
+
var __importDefault = (utils.commonjsGlobal && utils.commonjsGlobal.__importDefault) || function (mod) {
|
|
10042
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10043
|
+
};
|
|
10044
|
+
Object.defineProperty(hexToColor, "__esModule", { value: true });
|
|
10045
|
+
hexToColor.HexToColor = void 0;
|
|
10046
|
+
const colorFormatter_1 = colorFormatter;
|
|
10047
|
+
const color_convert_1 = __importDefault(colorConvert);
|
|
10048
|
+
class HexToColor {
|
|
10049
|
+
static convertToRgb(color, options) {
|
|
10050
|
+
const result = color_convert_1.default.hex.rgb(color);
|
|
10051
|
+
return (options === null || options === void 0 ? void 0 : options.resultType) === 'string' ? colorFormatter_1.ColorFormatter.arrayToRgbString(result) : result;
|
|
10052
|
+
}
|
|
10053
|
+
static convertToHsl(color, options) {
|
|
10054
|
+
const result = color_convert_1.default.hex.hsl(color);
|
|
10055
|
+
return (options === null || options === void 0 ? void 0 : options.resultType) === 'string' ? colorFormatter_1.ColorFormatter.arrayToHslString(result) : result;
|
|
10056
|
+
}
|
|
10057
|
+
}
|
|
10058
|
+
hexToColor.HexToColor = HexToColor;
|
|
10059
|
+
|
|
10060
|
+
Object.defineProperty(filterToColor, "__esModule", { value: true });
|
|
10061
|
+
filterToColor.FilterToColor = void 0;
|
|
10062
|
+
const filterToHex_1 = filterToHex;
|
|
10063
|
+
const hexToColor_1 = hexToColor;
|
|
10064
|
+
class FilterToColor {
|
|
10065
|
+
static async filterToHex(filterString) {
|
|
10066
|
+
const result = await filterToHex_1.FilterToHex.convert(filterString);
|
|
10067
|
+
if (result.color)
|
|
10068
|
+
result.color = result.color.toUpperCase();
|
|
10069
|
+
return result;
|
|
10070
|
+
}
|
|
10071
|
+
static async filterToRgb(filterString, options) {
|
|
10072
|
+
return filterToHex_1.FilterToHex.convert(filterString, hexToColor_1.HexToColor.convertToRgb, options);
|
|
10073
|
+
}
|
|
10074
|
+
static async filterToHsl(filterString, options) {
|
|
10075
|
+
return filterToHex_1.FilterToHex.convert(filterString, hexToColor_1.HexToColor.convertToHsl, options);
|
|
10076
|
+
}
|
|
10077
|
+
}
|
|
10078
|
+
filterToColor.FilterToColor = FilterToColor;
|
|
10079
|
+
|
|
10080
|
+
(function (module, exports) {
|
|
10081
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10082
|
+
const colorToFilter_1 = colorToFilter;
|
|
10083
|
+
const filterToColor_1 = filterToColor;
|
|
10084
|
+
class CssFilterConverter {
|
|
10085
|
+
static rgbToFilter(rgbString, options) {
|
|
10086
|
+
return colorToFilter_1.ColorToFilter.rgbToFilter(rgbString, options);
|
|
10087
|
+
}
|
|
10088
|
+
static hexToFilter(hexString, options) {
|
|
10089
|
+
return colorToFilter_1.ColorToFilter.hexToFilter(hexString, options);
|
|
10090
|
+
}
|
|
10091
|
+
static hslToFilter(hslString, options) {
|
|
10092
|
+
return colorToFilter_1.ColorToFilter.hslToFilter(hslString, options);
|
|
10093
|
+
}
|
|
10094
|
+
static keywordToFilter(keyword, options) {
|
|
10095
|
+
return colorToFilter_1.ColorToFilter.keywordToFilter(keyword, options);
|
|
10096
|
+
}
|
|
10097
|
+
static async filterToHex(filterString) {
|
|
10098
|
+
return filterToColor_1.FilterToColor.filterToHex(filterString);
|
|
10099
|
+
}
|
|
10100
|
+
static async filterToRgb(filterString, options) {
|
|
10101
|
+
return filterToColor_1.FilterToColor.filterToRgb(filterString, options);
|
|
10102
|
+
}
|
|
10103
|
+
static async filterToHsl(filterString, options) {
|
|
10104
|
+
return filterToColor_1.FilterToColor.filterToHsl(filterString, options);
|
|
10105
|
+
}
|
|
10106
|
+
}
|
|
10107
|
+
exports.default = CssFilterConverter;
|
|
10108
|
+
module.exports = CssFilterConverter;
|
|
10109
|
+
}(lib, lib.exports));
|
|
10110
|
+
|
|
10111
|
+
const CssFilter = /*@__PURE__*/utils.getDefaultExportFromCjs(lib.exports);
|
|
10112
|
+
|
|
10113
|
+
const lidoImageCss = ".lido-image{user-select:none;-webkit-user-drag:none;object-fit:contain;width:100% !important;height:100% !important;aspect-ratio:1 / 1;transform:rotate(0) !important;margin:0 !important}.slice{background-repeat:no-repeat;background-position:center;background-size:100% 100%}";
|
|
10114
|
+
const LidoImageStyle0 = lidoImageCss;
|
|
10115
|
+
|
|
10116
|
+
const LidoImage = class {
|
|
7076
10117
|
constructor(hostRef) {
|
|
7077
10118
|
index.registerInstance(this, hostRef);
|
|
10119
|
+
this.showSpeakIcon = false;
|
|
7078
10120
|
this.id = undefined;
|
|
7079
10121
|
this.value = undefined;
|
|
7080
10122
|
this.height = undefined;
|
|
@@ -7093,6 +10135,112 @@ const LidoPos = class {
|
|
|
7093
10135
|
this.onInCorrect = undefined;
|
|
7094
10136
|
this.onCorrect = undefined;
|
|
7095
10137
|
this.onEntry = undefined;
|
|
10138
|
+
this.src = undefined;
|
|
10139
|
+
this.isSlice = undefined;
|
|
10140
|
+
this.sliceWidth = '30px';
|
|
10141
|
+
this.minDrops = 1;
|
|
10142
|
+
this.maxDrops = 1;
|
|
10143
|
+
this.margin = '';
|
|
10144
|
+
this.padding = '';
|
|
10145
|
+
this.filter = '';
|
|
10146
|
+
this.borderRadius = '0px';
|
|
10147
|
+
this.transform = '';
|
|
10148
|
+
this.style = undefined;
|
|
10149
|
+
this.delayVisible = '';
|
|
10150
|
+
}
|
|
10151
|
+
/**
|
|
10152
|
+
* Lifecycle method that runs after the component has been loaded into the DOM.
|
|
10153
|
+
* It initializes custom events based on the `type` of the image component.
|
|
10154
|
+
*/
|
|
10155
|
+
componentDidLoad() {
|
|
10156
|
+
utils.setVisibilityWithDelay(this.el, this.delayVisible);
|
|
10157
|
+
utils.initEventsForElement(this.el, this.type);
|
|
10158
|
+
if (this.filter !== '') {
|
|
10159
|
+
const img = this.el.getElementsByTagName('img')[0];
|
|
10160
|
+
if (img) {
|
|
10161
|
+
img.style.filter = `${CssFilter.hexToFilter(utils.tinyColor(this.filter).toHexString()).color}`;
|
|
10162
|
+
}
|
|
10163
|
+
}
|
|
10164
|
+
if (this.showSpeakIcon) {
|
|
10165
|
+
utils.attachSpeakIcon(this.el, this.x, this.y);
|
|
10166
|
+
}
|
|
10167
|
+
}
|
|
10168
|
+
/**
|
|
10169
|
+
* Lifecycle method that runs before the component is rendered.
|
|
10170
|
+
* Initializes styles and sets up event listeners for resize and load events.
|
|
10171
|
+
*/
|
|
10172
|
+
componentWillLoad() {
|
|
10173
|
+
this.updateStyles();
|
|
10174
|
+
window.addEventListener('resize', this.updateStyles.bind(this)); // Update on screen rotation
|
|
10175
|
+
window.addEventListener('load', this.updateStyles.bind(this)); // Update on screen rotation
|
|
10176
|
+
}
|
|
10177
|
+
disconnectedCallback() {
|
|
10178
|
+
window.removeEventListener('resize', this.updateStyles.bind(this));
|
|
10179
|
+
window.removeEventListener('load', this.updateStyles.bind(this));
|
|
10180
|
+
}
|
|
10181
|
+
updateStyles() {
|
|
10182
|
+
const orientation = window.innerHeight > window.innerWidth ? 'portrait' : 'landscape';
|
|
10183
|
+
this.style = {
|
|
10184
|
+
height: utils.parseProp(this.height, orientation),
|
|
10185
|
+
width: utils.parseProp(this.width, orientation),
|
|
10186
|
+
backgroundColor: utils.parseProp(this.bgColor, orientation),
|
|
10187
|
+
top: utils.parseProp(this.y, orientation),
|
|
10188
|
+
left: utils.parseProp(this.x, orientation),
|
|
10189
|
+
zIndex: this.z,
|
|
10190
|
+
display: utils.parseProp(`${this.visible}`, orientation) ? 'flex' : 'none',
|
|
10191
|
+
alignItems: 'center',
|
|
10192
|
+
justifyContent: 'center',
|
|
10193
|
+
margin: utils.parseProp(this.margin, orientation),
|
|
10194
|
+
padding: utils.parseProp(this.padding, orientation),
|
|
10195
|
+
transform: utils.parseProp(this.transform, orientation),
|
|
10196
|
+
borderRadius: this.borderRadius,
|
|
10197
|
+
// Slice Style
|
|
10198
|
+
borderImageSource: this.isSlice === 'true' ? `url(${utils.convertUrlToRelative(this.src)})` : 'none',
|
|
10199
|
+
borderImageSlice: this.isSlice === 'true' ? `${parseInt(this.sliceWidth)} fill` : 'unset',
|
|
10200
|
+
borderImageRepeat: this.isSlice === 'true' ? 'round' : 'unset',
|
|
10201
|
+
borderImageWidth: this.isSlice === 'true' ? `${this.sliceWidth}` : 'unset',
|
|
10202
|
+
backgroundImage: this.isSlice === 'true' ? `url(${utils.convertUrlToRelative(this.src)})` : 'none',
|
|
10203
|
+
};
|
|
10204
|
+
}
|
|
10205
|
+
render() {
|
|
10206
|
+
if (this.isSlice === 'true') {
|
|
10207
|
+
return (index.h(index.Host, { class: "slice", id: this.id, type: this.type, "tab-index": this.tabIndex, style: this.style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, value: this.value, minDrops: this.minDrops, maxDrops: this.maxDrops, audio: this.audio, onTouch: this.onTouch, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, onEntry: this.onEntry }));
|
|
10208
|
+
}
|
|
10209
|
+
else {
|
|
10210
|
+
return (index.h(index.Host, { id: this.id, type: this.type, "tab-index": this.tabIndex, style: this.style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, value: this.value, minDrops: this.minDrops, maxDrops: this.maxDrops, audio: this.audio, onTouch: this.onTouch, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, onEntry: this.onEntry }, index.h("img", { class: "lido-image", src: utils.convertUrlToRelative(this.src), alt: "", style: this.style })));
|
|
10211
|
+
}
|
|
10212
|
+
}
|
|
10213
|
+
get el() { return index.getElement(this); }
|
|
10214
|
+
};
|
|
10215
|
+
LidoImage.style = LidoImageStyle0;
|
|
10216
|
+
|
|
10217
|
+
const lidoPosCss = ".lido-pos{top:var(--y, 0);left:var(--x, 0);height:var(--height, 100%);width:var(--width, 100%);background-color:var(--bgColor, #eeeeee);display:flex;justify-content:space-around;flex-direction:column;position:fixed}.lido-pos>*{position:absolute}";
|
|
10218
|
+
const LidoPosStyle0 = lidoPosCss;
|
|
10219
|
+
|
|
10220
|
+
const LidoPos = class {
|
|
10221
|
+
constructor(hostRef) {
|
|
10222
|
+
index.registerInstance(this, hostRef);
|
|
10223
|
+
this.id = '';
|
|
10224
|
+
this.value = '';
|
|
10225
|
+
this.height = 'auto';
|
|
10226
|
+
this.width = 'auto';
|
|
10227
|
+
this.ariaLabel = '';
|
|
10228
|
+
this.ariaHidden = '';
|
|
10229
|
+
this.x = '0px';
|
|
10230
|
+
this.y = '0px';
|
|
10231
|
+
this.z = '0';
|
|
10232
|
+
this.bgColor = '';
|
|
10233
|
+
this.type = '';
|
|
10234
|
+
this.tabIndex = 0;
|
|
10235
|
+
this.visible = false;
|
|
10236
|
+
this.audio = '';
|
|
10237
|
+
this.onTouch = '';
|
|
10238
|
+
this.onInCorrect = '';
|
|
10239
|
+
this.onCorrect = '';
|
|
10240
|
+
this.onEntry = '';
|
|
10241
|
+
this.minDrops = 1;
|
|
10242
|
+
this.maxDrops = 1;
|
|
10243
|
+
this.margin = '';
|
|
7096
10244
|
this.style = undefined;
|
|
7097
10245
|
}
|
|
7098
10246
|
/**
|
|
@@ -7125,54 +10273,78 @@ const LidoPos = class {
|
|
|
7125
10273
|
left: utils.parseProp(this.x, orientation),
|
|
7126
10274
|
zIndex: this.z,
|
|
7127
10275
|
display: JSON.parse(utils.parseProp(`${this.visible}`, orientation)) ? 'block' : 'none', // Toggle visibility
|
|
10276
|
+
margin: utils.parseProp(this.margin, orientation),
|
|
7128
10277
|
};
|
|
7129
10278
|
}
|
|
7130
10279
|
render() {
|
|
7131
|
-
return (index.h(index.Host, { key: '
|
|
10280
|
+
return (index.h(index.Host, { key: '35e70ef17d6b0b3fa77c34b5d5eacc62408aa772', id: this.id, class: "lido-pos", type: this.type, "tab-index": this.tabIndex, style: this.style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, minDrops: this.minDrops, maxDrops: this.maxDrops, value: this.value, audio: this.audio, onTouch: this.onTouch, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, onEntry: this.onEntry }, index.h("slot", { key: '37deeb60c7d5b8e5edf954f33ea0207deed93695' })));
|
|
7132
10281
|
}
|
|
7133
10282
|
get el() { return index.getElement(this); }
|
|
7134
10283
|
};
|
|
7135
10284
|
LidoPos.style = LidoPosStyle0;
|
|
7136
10285
|
|
|
7137
|
-
const lidoRandomCss = ".lido-random{
|
|
10286
|
+
const lidoRandomCss = ".lido-random{position:relative;width:100%;height:100%}.lido-random>*{position:absolute}";
|
|
7138
10287
|
const LidoRandomStyle0 = lidoRandomCss;
|
|
7139
10288
|
|
|
7140
10289
|
const LidoRandom = class {
|
|
7141
10290
|
constructor(hostRef) {
|
|
7142
10291
|
index.registerInstance(this, hostRef);
|
|
7143
|
-
this.
|
|
7144
|
-
this.
|
|
7145
|
-
this.
|
|
7146
|
-
this.
|
|
7147
|
-
this.
|
|
7148
|
-
this.
|
|
7149
|
-
this.
|
|
7150
|
-
this.
|
|
7151
|
-
this.
|
|
7152
|
-
this.
|
|
7153
|
-
this.
|
|
7154
|
-
this.
|
|
7155
|
-
this.
|
|
7156
|
-
this.
|
|
7157
|
-
this.
|
|
7158
|
-
this.
|
|
7159
|
-
this.
|
|
7160
|
-
this.
|
|
10292
|
+
this.showSpeakIcon = false;
|
|
10293
|
+
this.id = '';
|
|
10294
|
+
this.value = '';
|
|
10295
|
+
this.height = 'auto';
|
|
10296
|
+
this.width = 'auto';
|
|
10297
|
+
this.ariaLabel = '';
|
|
10298
|
+
this.ariaHidden = '';
|
|
10299
|
+
this.x = '0px';
|
|
10300
|
+
this.y = '0px';
|
|
10301
|
+
this.z = '0';
|
|
10302
|
+
this.bgColor = '';
|
|
10303
|
+
this.type = '';
|
|
10304
|
+
this.tabIndex = 0;
|
|
10305
|
+
this.visible = false;
|
|
10306
|
+
this.audio = '';
|
|
10307
|
+
this.onTouch = '';
|
|
10308
|
+
this.onInCorrect = '';
|
|
10309
|
+
this.onCorrect = '';
|
|
10310
|
+
this.onEntry = '';
|
|
10311
|
+
this.minDrops = 1;
|
|
10312
|
+
this.maxDrops = 1;
|
|
10313
|
+
this.margin = '';
|
|
7161
10314
|
}
|
|
7162
10315
|
/**
|
|
7163
10316
|
* Lifecycle hook that runs after the component is rendered in the DOM.
|
|
7164
10317
|
* It randomly positions all child elements within the container using CSS `top` and `left` percentages.
|
|
7165
10318
|
*/
|
|
7166
10319
|
componentDidLoad() {
|
|
7167
|
-
|
|
7168
|
-
|
|
7169
|
-
|
|
7170
|
-
|
|
7171
|
-
|
|
7172
|
-
|
|
7173
|
-
|
|
7174
|
-
|
|
7175
|
-
|
|
10320
|
+
setTimeout(() => {
|
|
10321
|
+
// Select all direct child elements of the component
|
|
10322
|
+
const parentcontainer = this.el.parentElement;
|
|
10323
|
+
if (!parentcontainer)
|
|
10324
|
+
return;
|
|
10325
|
+
// Get parent size
|
|
10326
|
+
const parentWidth = parentcontainer.offsetWidth;
|
|
10327
|
+
const parentHeight = parentcontainer.offsetHeight;
|
|
10328
|
+
// Place child elements randomly inside parent
|
|
10329
|
+
const children = Array.from(this.el.children);
|
|
10330
|
+
children.forEach(child => {
|
|
10331
|
+
const childWidth = child.offsetWidth;
|
|
10332
|
+
const childHeight = child.offsetHeight;
|
|
10333
|
+
console.log('child width', childWidth);
|
|
10334
|
+
const maxLeft = parentWidth - childWidth;
|
|
10335
|
+
const maxTop = parentHeight - childHeight;
|
|
10336
|
+
const randLeft = Math.random() * maxLeft;
|
|
10337
|
+
const randTop = Math.random() * maxTop;
|
|
10338
|
+
console.log('randomleft', randLeft);
|
|
10339
|
+
console.log('randomtop', randTop);
|
|
10340
|
+
child.style.position = 'absolute';
|
|
10341
|
+
child.style.left = `${randLeft}px`;
|
|
10342
|
+
child.style.top = `${randTop}px`;
|
|
10343
|
+
});
|
|
10344
|
+
}, 50);
|
|
10345
|
+
if (this.showSpeakIcon) {
|
|
10346
|
+
utils.attachSpeakIcon(this.el, this.x, this.y);
|
|
10347
|
+
}
|
|
7176
10348
|
}
|
|
7177
10349
|
render() {
|
|
7178
10350
|
// Inline styles for the container, including dimensions, positioning, and visibility
|
|
@@ -7184,8 +10356,9 @@ const LidoRandom = class {
|
|
|
7184
10356
|
display: this.visible ? 'block' : 'none', // Toggle visibility
|
|
7185
10357
|
zIndex: this.z,
|
|
7186
10358
|
backgroundColor: this.bgColor,
|
|
10359
|
+
margin: this.margin,
|
|
7187
10360
|
};
|
|
7188
|
-
return (index.h(index.Host, { key: '
|
|
10361
|
+
return (index.h(index.Host, { key: 'a4bbd44f0ff8058b808d9118b8c22a0545de6632', class: "lido-random", type: this.type, "tab-index": this.tabIndex, value: this.value, style: style, "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 }, index.h("slot", { key: '421469c42d2f015cc4bf7e26b6f8e2f56d29abbe' })));
|
|
7189
10362
|
}
|
|
7190
10363
|
get el() { return index.getElement(this); }
|
|
7191
10364
|
};
|
|
@@ -7194,8 +10367,9 @@ LidoRandom.style = LidoRandomStyle0;
|
|
|
7194
10367
|
const LidoRoot = class {
|
|
7195
10368
|
constructor(hostRef) {
|
|
7196
10369
|
index.registerInstance(this, hostRef);
|
|
7197
|
-
this.xmlPath =
|
|
10370
|
+
this.xmlPath = '';
|
|
7198
10371
|
this.initialIndex = 0;
|
|
10372
|
+
this.margin = '';
|
|
7199
10373
|
this.canplay = true;
|
|
7200
10374
|
this.baseUrl = '';
|
|
7201
10375
|
this.xmlData = undefined;
|
|
@@ -7254,6 +10428,7 @@ const LidoRowStyle0 = lidoRowCss;
|
|
|
7254
10428
|
const LidoRow = class {
|
|
7255
10429
|
constructor(hostRef) {
|
|
7256
10430
|
index.registerInstance(this, hostRef);
|
|
10431
|
+
this.showSpeakIcon = false;
|
|
7257
10432
|
this.value = undefined;
|
|
7258
10433
|
this.height = undefined;
|
|
7259
10434
|
this.width = undefined;
|
|
@@ -7275,7 +10450,11 @@ const LidoRow = class {
|
|
|
7275
10450
|
this.minLength = undefined;
|
|
7276
10451
|
this.maxLength = undefined;
|
|
7277
10452
|
this.direction = undefined;
|
|
10453
|
+
this.minDrops = 1;
|
|
10454
|
+
this.maxDrops = 1;
|
|
7278
10455
|
this.style = {};
|
|
10456
|
+
this.display = undefined;
|
|
10457
|
+
this.margin = '';
|
|
7279
10458
|
}
|
|
7280
10459
|
/**
|
|
7281
10460
|
* Lifecycle hook that runs after the component is loaded into the DOM.
|
|
@@ -7283,7 +10462,10 @@ const LidoRow = class {
|
|
|
7283
10462
|
*/
|
|
7284
10463
|
componentDidLoad() {
|
|
7285
10464
|
utils.initEventsForElement(this.el, this.type);
|
|
7286
|
-
utils.handlingChildElements(this.el, this.minLength, this.maxLength, this.childElementsLength
|
|
10465
|
+
utils.handlingChildElements(this.el, this.minLength, this.maxLength, this.childElementsLength);
|
|
10466
|
+
if (this.showSpeakIcon) {
|
|
10467
|
+
utils.attachSpeakIcon(this.el, this.x, this.y);
|
|
10468
|
+
}
|
|
7287
10469
|
}
|
|
7288
10470
|
/**
|
|
7289
10471
|
* Lifecycle method that runs before the component is rendered.
|
|
@@ -7307,12 +10489,15 @@ const LidoRow = class {
|
|
|
7307
10489
|
top: utils.parseProp(this.y, orientation),
|
|
7308
10490
|
left: utils.parseProp(this.x, orientation),
|
|
7309
10491
|
zIndex: this.z,
|
|
7310
|
-
display: this.visible ? 'flex' : 'none', // Toggle visibility
|
|
10492
|
+
display: this.visible ? (this.display ? utils.parseProp(this.display, orientation) : 'flex') : 'none', // Toggle visibility
|
|
7311
10493
|
flexDirection: !this.direction ? 'row' : utils.parseProp(this.direction, orientation),
|
|
10494
|
+
gridTemplateColumns: this.display && utils.parseProp(this.display, orientation) === 'grid' ? 'repeat(auto-fill, minmax(186px, auto))' : undefined,
|
|
10495
|
+
gap: this.display && utils.parseProp(this.display, orientation) === 'grid' ? '20px' : undefined,
|
|
10496
|
+
margin: utils.parseProp(this.margin, orientation),
|
|
7312
10497
|
};
|
|
7313
10498
|
}
|
|
7314
10499
|
render() {
|
|
7315
|
-
return (index.h(index.Host, { key: '
|
|
10500
|
+
return (index.h(index.Host, { key: 'bea2b6a6be9168f1854075ff0d61dffb3469f1f5', class: "lido-row", type: this.type, "tab-index": this.tabIndex, value: this.value, style: this.style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, minDrops: this.minDrops, maxDrops: this.maxDrops, audio: this.audio, onTouch: this.onTouch, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, onEntry: this.onEntry }, index.h("slot", { key: 'ba5ef737a961749412dfa91523381b7193fdbde7' })));
|
|
7316
10501
|
}
|
|
7317
10502
|
get el() { return index.getElement(this); }
|
|
7318
10503
|
};
|
|
@@ -7324,31 +10509,36 @@ const LidoShapeStyle0 = lidoShapeCss;
|
|
|
7324
10509
|
const LidoShape = class {
|
|
7325
10510
|
constructor(hostRef) {
|
|
7326
10511
|
index.registerInstance(this, hostRef);
|
|
7327
|
-
this.id =
|
|
7328
|
-
this.value =
|
|
7329
|
-
this.height =
|
|
7330
|
-
this.width =
|
|
7331
|
-
this.ariaLabel =
|
|
7332
|
-
this.ariaHidden =
|
|
7333
|
-
this.x =
|
|
7334
|
-
this.y =
|
|
7335
|
-
this.z =
|
|
7336
|
-
this.bgColor =
|
|
7337
|
-
this.type =
|
|
7338
|
-
this.tabIndex =
|
|
7339
|
-
this.shapeType =
|
|
7340
|
-
this.visible =
|
|
7341
|
-
this.audio =
|
|
7342
|
-
this.onTouch =
|
|
7343
|
-
this.onInCorrect =
|
|
7344
|
-
this.onCorrect =
|
|
7345
|
-
this.onEntry =
|
|
10512
|
+
this.id = '';
|
|
10513
|
+
this.value = '';
|
|
10514
|
+
this.height = 'auto';
|
|
10515
|
+
this.width = 'auto';
|
|
10516
|
+
this.ariaLabel = '';
|
|
10517
|
+
this.ariaHidden = '';
|
|
10518
|
+
this.x = '0px';
|
|
10519
|
+
this.y = '0px';
|
|
10520
|
+
this.z = '0';
|
|
10521
|
+
this.bgColor = '';
|
|
10522
|
+
this.type = '';
|
|
10523
|
+
this.tabIndex = 0;
|
|
10524
|
+
this.shapeType = 'circle';
|
|
10525
|
+
this.visible = false;
|
|
10526
|
+
this.audio = '';
|
|
10527
|
+
this.onTouch = '';
|
|
10528
|
+
this.onInCorrect = '';
|
|
10529
|
+
this.onCorrect = '';
|
|
10530
|
+
this.onEntry = '';
|
|
10531
|
+
this.minDrops = 1;
|
|
10532
|
+
this.maxDrops = 1;
|
|
10533
|
+
this.margin = '';
|
|
10534
|
+
this.delayVisible = '';
|
|
7346
10535
|
}
|
|
7347
10536
|
/**
|
|
7348
10537
|
* Lifecycle hook that runs after the component is loaded into the DOM.
|
|
7349
10538
|
* It initializes custom events based on the `type` of the shape component.
|
|
7350
10539
|
*/
|
|
7351
10540
|
componentDidLoad() {
|
|
10541
|
+
utils.setVisibilityWithDelay(this.el, this.delayVisible);
|
|
7352
10542
|
utils.initEventsForElement(this.el, this.type);
|
|
7353
10543
|
}
|
|
7354
10544
|
render() {
|
|
@@ -7361,52 +10551,234 @@ const LidoShape = class {
|
|
|
7361
10551
|
display: this.visible ? 'block' : 'none', // Toggle visibility
|
|
7362
10552
|
zIndex: this.z,
|
|
7363
10553
|
backgroundColor: this.shapeType !== 'polygon' ? this.bgColor : 'transparent', // Apply background only if not a polygon
|
|
10554
|
+
margin: this.margin,
|
|
7364
10555
|
};
|
|
7365
|
-
return (index.h(index.Host, { key: '
|
|
10556
|
+
return (index.h(index.Host, { key: 'a70c88433f7024f327b7d3746fd705c75fa776f6', class: `lido-shape ${this.shapeType}`, value: this.value, type: this.type, "tab-index": this.tabIndex, style: style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, audio: this.audio, minDrops: this.minDrops, maxDrops: this.maxDrops, onTouch: this.onTouch, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, onEntry: this.onEntry }));
|
|
7366
10557
|
}
|
|
7367
10558
|
get el() { return index.getElement(this); }
|
|
7368
10559
|
};
|
|
7369
10560
|
LidoShape.style = LidoShapeStyle0;
|
|
7370
10561
|
|
|
7371
|
-
const
|
|
10562
|
+
const lidoSlideFillCss = ".svg-element,svg{width:100%;height:100%}";
|
|
10563
|
+
const LidoSlideFillStyle0 = lidoSlideFillCss;
|
|
10564
|
+
|
|
10565
|
+
const LidoSlideFill = class {
|
|
10566
|
+
constructor(hostRef) {
|
|
10567
|
+
index.registerInstance(this, hostRef);
|
|
10568
|
+
this.originalHeight = null;
|
|
10569
|
+
this.originalY = null;
|
|
10570
|
+
this.id = 'lido-slide-fill';
|
|
10571
|
+
this.width = undefined;
|
|
10572
|
+
this.fill = undefined;
|
|
10573
|
+
this.numberType = 'integer';
|
|
10574
|
+
this.min = 0;
|
|
10575
|
+
this.division = 5;
|
|
10576
|
+
this.max = 10;
|
|
10577
|
+
this.slider = undefined;
|
|
10578
|
+
this.src = undefined;
|
|
10579
|
+
this.fillDirection = undefined;
|
|
10580
|
+
this.svgContent = '';
|
|
10581
|
+
this.delayVisible = '';
|
|
10582
|
+
}
|
|
10583
|
+
async componentWillLoad() {
|
|
10584
|
+
await this.renderSVG();
|
|
10585
|
+
}
|
|
10586
|
+
async onSrcChange() {
|
|
10587
|
+
await this.renderSVG();
|
|
10588
|
+
this.onPropChange();
|
|
10589
|
+
}
|
|
10590
|
+
async renderSVG() {
|
|
10591
|
+
const response = await fetch(utils.convertUrlToRelative(this.src));
|
|
10592
|
+
if (response.ok) {
|
|
10593
|
+
let svgText = await response.text();
|
|
10594
|
+
let pathIndex = 0;
|
|
10595
|
+
svgText = svgText.replace(/<path([^>]*)>/g, (match, attrs) => {
|
|
10596
|
+
pathIndex++;
|
|
10597
|
+
const id = pathIndex === 1 ? 'glassPath' : pathIndex === 2 ? 'rulerPath' : `path${pathIndex}`;
|
|
10598
|
+
return `<path id="${id}"${attrs}>`;
|
|
10599
|
+
});
|
|
10600
|
+
const clipPathDef = `
|
|
10601
|
+
<clipPath id="clipGlass">
|
|
10602
|
+
<use xlink:href="#glassPath" />
|
|
10603
|
+
</clipPath>
|
|
10604
|
+
`;
|
|
10605
|
+
svgText = svgText.replace(/<svg([^>]*)>/, `<svg$1>
|
|
10606
|
+
${clipPathDef}
|
|
10607
|
+
`);
|
|
10608
|
+
svgText = svgText.replace(/<rect([^>]*)\/?>/, `<rect id="fillArea" $1 clip-path="url(#clipGlass)" />`);
|
|
10609
|
+
this.svgContent = svgText;
|
|
10610
|
+
}
|
|
10611
|
+
}
|
|
10612
|
+
componentDidLoad() {
|
|
10613
|
+
utils.setVisibilityWithDelay(this.el, this.delayVisible);
|
|
10614
|
+
this.updateFill();
|
|
10615
|
+
this.addRulerNumbers();
|
|
10616
|
+
}
|
|
10617
|
+
onPropChange() {
|
|
10618
|
+
this.updateFill();
|
|
10619
|
+
this.addRulerNumbers();
|
|
10620
|
+
}
|
|
10621
|
+
updateFill() {
|
|
10622
|
+
var _a;
|
|
10623
|
+
const svgEl = (_a = this.el.querySelector('.svg-element')) === null || _a === void 0 ? void 0 : _a.querySelector('svg');
|
|
10624
|
+
if (!svgEl)
|
|
10625
|
+
return;
|
|
10626
|
+
const rect = svgEl.querySelector('#fillArea');
|
|
10627
|
+
if (!rect)
|
|
10628
|
+
return;
|
|
10629
|
+
const fillDirection = this.fillDirection;
|
|
10630
|
+
let originalSize;
|
|
10631
|
+
let originalOffset;
|
|
10632
|
+
if (this.fillDirection === 'vertical') {
|
|
10633
|
+
if (this.originalHeight === null || this.originalY === null) {
|
|
10634
|
+
this.originalHeight = +rect.getAttribute('height') || 100;
|
|
10635
|
+
this.originalY = +rect.getAttribute('y') || 0;
|
|
10636
|
+
}
|
|
10637
|
+
originalSize = this.originalHeight;
|
|
10638
|
+
originalOffset = this.originalY;
|
|
10639
|
+
}
|
|
10640
|
+
else {
|
|
10641
|
+
if (this.originalHeight === null || this.originalY === null) {
|
|
10642
|
+
this.originalHeight = +rect.getAttribute('width') || 100;
|
|
10643
|
+
this.originalY = +rect.getAttribute('x') || 0;
|
|
10644
|
+
}
|
|
10645
|
+
originalSize = this.originalHeight;
|
|
10646
|
+
originalOffset = this.originalY;
|
|
10647
|
+
}
|
|
10648
|
+
const fullSize = originalSize;
|
|
10649
|
+
const start = originalOffset;
|
|
10650
|
+
// Parse fill ("30%" or "30")
|
|
10651
|
+
let fillPercent = 0;
|
|
10652
|
+
if (typeof this.fill === 'string') {
|
|
10653
|
+
const percentMatch = this.fill.match(/^(\d+(?:\.\d+)?)%$/);
|
|
10654
|
+
if (percentMatch) {
|
|
10655
|
+
fillPercent = Math.min(Math.max(parseFloat(percentMatch[1]) / 100, 0), 1);
|
|
10656
|
+
}
|
|
10657
|
+
else {
|
|
10658
|
+
const numericMatch = this.fill.match(/^(\d+(?:\.\d+)?)$/);
|
|
10659
|
+
if (numericMatch) {
|
|
10660
|
+
fillPercent = Math.min(Math.max(parseFloat(numericMatch[1]) / 100, 0), 1);
|
|
10661
|
+
}
|
|
10662
|
+
}
|
|
10663
|
+
}
|
|
10664
|
+
const newSize = fullSize * fillPercent;
|
|
10665
|
+
const newOffset = fillDirection === 'vertical' ? start + (fullSize - newSize) : start;
|
|
10666
|
+
if (fillDirection === 'vertical') {
|
|
10667
|
+
rect.setAttribute('height', newSize.toString());
|
|
10668
|
+
rect.setAttribute('y', newOffset.toString());
|
|
10669
|
+
}
|
|
10670
|
+
else {
|
|
10671
|
+
rect.setAttribute('width', newSize.toString());
|
|
10672
|
+
rect.setAttribute('x', '0');
|
|
10673
|
+
}
|
|
10674
|
+
}
|
|
10675
|
+
addRulerNumbers() {
|
|
10676
|
+
var _a;
|
|
10677
|
+
const svgEl = (_a = this.el.querySelector('.svg-element')) === null || _a === void 0 ? void 0 : _a.querySelector('svg');
|
|
10678
|
+
if (!svgEl)
|
|
10679
|
+
return;
|
|
10680
|
+
const rulerPath = svgEl.querySelector('#rulerPath');
|
|
10681
|
+
if (!rulerPath)
|
|
10682
|
+
return;
|
|
10683
|
+
// Clear old numbers
|
|
10684
|
+
const oldNumbers = svgEl.querySelectorAll('.ruler-number');
|
|
10685
|
+
oldNumbers.forEach(node => node.remove());
|
|
10686
|
+
const divisions = this.division;
|
|
10687
|
+
const pointsCount = divisions + 1;
|
|
10688
|
+
const pathLength = rulerPath.getTotalLength();
|
|
10689
|
+
const stepValue = (this.max - this.min) / divisions;
|
|
10690
|
+
for (let i = 0; i < pointsCount; i++) {
|
|
10691
|
+
let value = 0;
|
|
10692
|
+
if (this.fillDirection === 'vertical') {
|
|
10693
|
+
value = this.max - i * stepValue;
|
|
10694
|
+
}
|
|
10695
|
+
else if (this.fillDirection === 'horizontal') {
|
|
10696
|
+
value = this.min + i * stepValue;
|
|
10697
|
+
}
|
|
10698
|
+
const pointAtLength = rulerPath.getPointAtLength((pathLength / divisions) * i);
|
|
10699
|
+
const textElem = document.createElementNS('http://www.w3.org/2000/svg', 'text');
|
|
10700
|
+
const fraction = utils.fraction(value / this.max);
|
|
10701
|
+
value = this.numberType === 'integer' ? Math.round(value) : this.numberType === 'decimal' ? parseFloat(value.toFixed(1)) : fraction.toFraction(true);
|
|
10702
|
+
textElem.classList.add('ruler-number');
|
|
10703
|
+
textElem.setAttribute('x', pointAtLength.x.toString());
|
|
10704
|
+
textElem.setAttribute('y', (pointAtLength.y + 15).toString());
|
|
10705
|
+
textElem.setAttribute('text-anchor', 'end');
|
|
10706
|
+
textElem.setAttribute('font-size', '40');
|
|
10707
|
+
textElem.setAttribute('fill', '#333');
|
|
10708
|
+
textElem.textContent = value.toString();
|
|
10709
|
+
svgEl.appendChild(textElem);
|
|
10710
|
+
}
|
|
10711
|
+
}
|
|
10712
|
+
render() {
|
|
10713
|
+
return (index.h(index.Host, { key: '8fbcce15c7af9525e912d10f504b192d4c2d325a', id: this.id, class: "lido-slide-fill", src: this.src, fill: this.fill, fillDirection: this.fillDirection, slider: this.slider, style: { width: this.width }, min: this.min, max: this.max, division: this.division, numberType: this.numberType }, index.h("div", { key: '294026ccc09d0145537c44f558dcfc8538ce2953', innerHTML: this.svgContent, class: "svg-element" })));
|
|
10714
|
+
}
|
|
10715
|
+
get el() { return index.getElement(this); }
|
|
10716
|
+
static get watchers() { return {
|
|
10717
|
+
"src": ["onSrcChange"],
|
|
10718
|
+
"fill": ["onPropChange"],
|
|
10719
|
+
"division": ["onPropChange"],
|
|
10720
|
+
"fillDirection": ["onPropChange"],
|
|
10721
|
+
"numberType": ["onPropChange"],
|
|
10722
|
+
"min": ["onPropChange"],
|
|
10723
|
+
"max": ["onPropChange"]
|
|
10724
|
+
}; }
|
|
10725
|
+
};
|
|
10726
|
+
LidoSlideFill.style = LidoSlideFillStyle0;
|
|
10727
|
+
|
|
10728
|
+
const lidoTextCss = ".lido-text{transition:background-color 0.3s ease;user-select:none;align-items:center;justify-content:center;text-align:center;border-radius:24px;color:#333;cursor:pointer;font-family:'Baloo 2', serif}.lido-text:hover{background-color:#f0f0f0}.text-letters{transition:color 0.3s, text-shadow 0.3s;display:inline-block;padding:0 2px}.text-letters.letter-highlight{color:#8e24aa;background:none;border-radius:0;text-shadow:0 2px 8px #8e24aa88;animation:text-letter-bounce 0.4s}.text-words{transition:color 0.3s, text-shadow 0.3s;display:inline-block;padding:0 2px}.text-words.word-highlight{color:#8e24aa;background:none;border-radius:0;text-shadow:0 2px 8px #8e24aa88;animation:text-word-bounce 0.4s}@keyframes text-letter-bounce{0%{transform:scale(1)}60%{transform:scale(1.4)}100%{transform:scale(1)}}@keyframes text-word-bounce{0%{transform:scale(1)}60%{transform:scale(1.3)}100%{transform:scale(1)}}";
|
|
7372
10729
|
const LidoTextStyle0 = lidoTextCss;
|
|
7373
10730
|
|
|
7374
10731
|
const LidoText = class {
|
|
7375
10732
|
constructor(hostRef) {
|
|
7376
10733
|
index.registerInstance(this, hostRef);
|
|
7377
|
-
this.
|
|
7378
|
-
this.
|
|
7379
|
-
this.
|
|
7380
|
-
this.
|
|
7381
|
-
this.
|
|
7382
|
-
this.
|
|
7383
|
-
this.
|
|
7384
|
-
this.
|
|
7385
|
-
this.
|
|
7386
|
-
this.
|
|
7387
|
-
this.
|
|
7388
|
-
this.
|
|
7389
|
-
this.
|
|
7390
|
-
this.
|
|
7391
|
-
this.
|
|
7392
|
-
this.
|
|
7393
|
-
this.
|
|
7394
|
-
this.
|
|
7395
|
-
this.
|
|
7396
|
-
this.
|
|
7397
|
-
this.
|
|
7398
|
-
this.
|
|
7399
|
-
this.
|
|
7400
|
-
this.
|
|
7401
|
-
this.
|
|
10734
|
+
this.showSpeakIcon = false;
|
|
10735
|
+
this.id = '';
|
|
10736
|
+
this.value = '';
|
|
10737
|
+
this.string = '';
|
|
10738
|
+
this.fontFamily = '';
|
|
10739
|
+
this.fontSize = '20px';
|
|
10740
|
+
this.fontColor = '';
|
|
10741
|
+
this.highlightWhileSpeaking = false;
|
|
10742
|
+
this.height = 'auto';
|
|
10743
|
+
this.width = 'auto';
|
|
10744
|
+
this.ariaLabel = '';
|
|
10745
|
+
this.ariaHidden = '';
|
|
10746
|
+
this.x = '0px';
|
|
10747
|
+
this.y = '0px';
|
|
10748
|
+
this.z = '0';
|
|
10749
|
+
this.bgColor = '';
|
|
10750
|
+
this.borderImage = '';
|
|
10751
|
+
this.type = '';
|
|
10752
|
+
this.tabIndex = 0;
|
|
10753
|
+
this.visible = false;
|
|
10754
|
+
this.audio = '';
|
|
10755
|
+
this.onTouch = '';
|
|
10756
|
+
this.onInCorrect = '';
|
|
10757
|
+
this.onCorrect = '';
|
|
10758
|
+
this.minDrops = 1;
|
|
10759
|
+
this.maxDrops = 1;
|
|
10760
|
+
this.onEntry = '';
|
|
10761
|
+
this.margin = '';
|
|
10762
|
+
this.padding = '';
|
|
10763
|
+
this.borderRadius = '0px';
|
|
10764
|
+
this.spanType = '';
|
|
7402
10765
|
this.style = {};
|
|
10766
|
+
this.delayVisible = '';
|
|
7403
10767
|
}
|
|
7404
10768
|
/**
|
|
7405
10769
|
* Lifecycle hook that runs after the component is rendered in the DOM.
|
|
7406
10770
|
* It initializes custom events based on the `type` of the text component.
|
|
7407
10771
|
*/
|
|
7408
10772
|
componentDidLoad() {
|
|
10773
|
+
utils.setVisibilityWithDelay(this.el, this.delayVisible);
|
|
7409
10774
|
utils.initEventsForElement(this.el, this.type);
|
|
10775
|
+
// only create span element if requested
|
|
10776
|
+
if (this.spanType === 'words' || this.spanType === 'letters') {
|
|
10777
|
+
this.addSpanToText();
|
|
10778
|
+
}
|
|
10779
|
+
if (this.showSpeakIcon) {
|
|
10780
|
+
utils.attachSpeakIcon(this.el, this.x, this.y);
|
|
10781
|
+
}
|
|
7410
10782
|
}
|
|
7411
10783
|
/**
|
|
7412
10784
|
* Lifecycle method that runs before the component is rendered.
|
|
@@ -7422,7 +10794,7 @@ const LidoText = class {
|
|
|
7422
10794
|
window.removeEventListener('load', this.updateStyles.bind(this));
|
|
7423
10795
|
}
|
|
7424
10796
|
updateStyles() {
|
|
7425
|
-
const
|
|
10797
|
+
const borderImg = this.borderImage ? utils.convertUrlToRelative(this.borderImage) : '';
|
|
7426
10798
|
const orientation = window.innerHeight > window.innerWidth ? 'portrait' : 'landscape';
|
|
7427
10799
|
this.style = {
|
|
7428
10800
|
height: utils.parseProp(this.height, orientation),
|
|
@@ -7432,40 +10804,85 @@ const LidoText = class {
|
|
|
7432
10804
|
left: utils.parseProp(this.x, orientation),
|
|
7433
10805
|
zIndex: this.z,
|
|
7434
10806
|
fontSize: utils.parseProp(this.fontSize, orientation),
|
|
7435
|
-
fontFamily: this.
|
|
10807
|
+
fontFamily: this.fontFamily,
|
|
7436
10808
|
color: utils.parseProp(this.fontColor, orientation),
|
|
7437
|
-
display:
|
|
7438
|
-
|
|
10809
|
+
display: utils.parseProp(`${this.visible}`, orientation) ? 'flex' : 'none', // Toggle visibility
|
|
10810
|
+
borderImage: `url(${borderImg})`,
|
|
10811
|
+
borderImageSlice: borderImg ? '0 fill' : '',
|
|
10812
|
+
margin: utils.parseProp(this.margin, orientation),
|
|
10813
|
+
padding: utils.parseProp(this.padding, orientation),
|
|
10814
|
+
borderRadius: utils.parseProp(this.borderRadius, orientation),
|
|
7439
10815
|
};
|
|
7440
10816
|
}
|
|
10817
|
+
async addSpanToText() {
|
|
10818
|
+
const content = this.el.querySelector('.lido-text-content');
|
|
10819
|
+
if (!content)
|
|
10820
|
+
return;
|
|
10821
|
+
const text = content.textContent || '';
|
|
10822
|
+
content.innerHTML = '';
|
|
10823
|
+
// Wrap each letters in a span inside .lido-text-content
|
|
10824
|
+
if (this.spanType === 'letters') {
|
|
10825
|
+
text.split('').forEach((letter, idx) => {
|
|
10826
|
+
// Skip spaces
|
|
10827
|
+
if (letter.trim() === '')
|
|
10828
|
+
return;
|
|
10829
|
+
// Create a span for each letter
|
|
10830
|
+
const letterSpan = document.createElement('span');
|
|
10831
|
+
letterSpan.textContent = letter;
|
|
10832
|
+
letterSpan.className = 'text-letters';
|
|
10833
|
+
content.appendChild(letterSpan);
|
|
10834
|
+
});
|
|
10835
|
+
}
|
|
10836
|
+
// Wrap each words in a span inside .lido-text-content
|
|
10837
|
+
if (this.spanType === 'words') {
|
|
10838
|
+
text.split(' ').forEach((word, idx) => {
|
|
10839
|
+
const wordSpan = document.createElement('span');
|
|
10840
|
+
wordSpan.textContent = word;
|
|
10841
|
+
wordSpan.className = 'text-words';
|
|
10842
|
+
content.appendChild(wordSpan);
|
|
10843
|
+
});
|
|
10844
|
+
}
|
|
10845
|
+
}
|
|
7441
10846
|
render() {
|
|
7442
|
-
return (index.h(index.Host, { key: '
|
|
10847
|
+
return (index.h(index.Host, { key: '77cc78e6a7228c771d78fe2ef8926ad15f474f7a', class: "lido-text", value: this.value, type: this.type, "tab-index": this.tabIndex, audio: this.audio, onTouch: this.onTouch, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, onEntry: this.onEntry, minDrops: this.minDrops, maxDrops: this.maxDrops, id: this.id, style: this.style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, "span-type": this.spanType }, this.spanType !== '' ? index.h("div", { class: "lido-text-content" }, this.string) : this.string));
|
|
7443
10848
|
}
|
|
7444
10849
|
get el() { return index.getElement(this); }
|
|
7445
10850
|
};
|
|
7446
10851
|
LidoText.style = LidoTextStyle0;
|
|
7447
10852
|
|
|
7448
|
-
const lidoTraceCss = ":host{display:block;position:relative}#lido-svgContainer{
|
|
10853
|
+
const lidoTraceCss = ":host{display:block;position:relative}#lido-svgContainer{display:flex;justify-content:center;align-items:center;overflow:hidden}svg{width:100%;height:100%;max-height:calc(100vh - 50px);touch-action:none}#lido-draggableCircle{cursor:pointer;fill:red;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-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)}}";
|
|
7449
10854
|
const LidoTraceStyle0 = lidoTraceCss;
|
|
7450
10855
|
|
|
7451
10856
|
const LidoTrace = class {
|
|
7452
10857
|
constructor(hostRef) {
|
|
7453
10858
|
index.registerInstance(this, hostRef);
|
|
7454
|
-
this.
|
|
7455
|
-
this.
|
|
7456
|
-
this.
|
|
7457
|
-
this.
|
|
7458
|
-
this.
|
|
7459
|
-
this.
|
|
7460
|
-
this.
|
|
7461
|
-
this.
|
|
7462
|
-
this.
|
|
7463
|
-
this.
|
|
7464
|
-
this.
|
|
7465
|
-
this.
|
|
10859
|
+
this.moving = false;
|
|
10860
|
+
this.showSpeakIcon = false;
|
|
10861
|
+
this.id = '';
|
|
10862
|
+
this.svgSource = '';
|
|
10863
|
+
this.svgUrls = [];
|
|
10864
|
+
this.currentSvgIndex = 0;
|
|
10865
|
+
this.value = '';
|
|
10866
|
+
this.height = 'auto';
|
|
10867
|
+
this.width = 'auto';
|
|
10868
|
+
this.x = '0px';
|
|
10869
|
+
this.y = '0px';
|
|
10870
|
+
this.z = '0';
|
|
10871
|
+
this.ariaLabel = '';
|
|
10872
|
+
this.ariaHidden = '';
|
|
10873
|
+
this.tabIndex = 0;
|
|
10874
|
+
this.mode = utils.TraceMode.ShowFlow;
|
|
10875
|
+
this.fingerHintUrl = 'https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/trace/finger.png';
|
|
10876
|
+
this.onInCorrect = undefined;
|
|
10877
|
+
this.onCorrect = undefined;
|
|
10878
|
+
this.highlightTextId = '';
|
|
10879
|
+
this.animationTrace = false;
|
|
10880
|
+
this.delayVisible = '';
|
|
7466
10881
|
this.fileIndex = -1;
|
|
7467
10882
|
this.isDragging = false;
|
|
7468
10883
|
this.activePointerId = null;
|
|
10884
|
+
this.idleTimer = null;
|
|
10885
|
+
this.fingerImg = null;
|
|
7469
10886
|
}
|
|
7470
10887
|
// MODES = ['noFlow', 'showFlow', 'freeTrace', 'blindTracing', 'blindFreeTrace'];
|
|
7471
10888
|
// Handle the pointermove event with optimizations
|
|
@@ -7488,11 +10905,73 @@ const LidoTrace = class {
|
|
|
7488
10905
|
mode: this.mode,
|
|
7489
10906
|
flowMarkers: [],
|
|
7490
10907
|
freeTraceLines: [],
|
|
10908
|
+
currentFreePath: [],
|
|
10909
|
+
lastPointerPos: null,
|
|
7491
10910
|
};
|
|
10911
|
+
const url = this.svgUrls[this.currentSvgIndex];
|
|
10912
|
+
await this.fetchSVG(url);
|
|
7492
10913
|
await this.loadAnotherSVG(state, true); // Load the first SVG
|
|
7493
10914
|
}
|
|
10915
|
+
componentDidLoad() {
|
|
10916
|
+
utils.setVisibilityWithDelay(this.el, this.delayVisible);
|
|
10917
|
+
}
|
|
7494
10918
|
componentWillLoad() {
|
|
10919
|
+
this.svgUrls = this.svgSource.split(';').map(s => s.trim());
|
|
10920
|
+
this.currentSvgIndex = 0;
|
|
7495
10921
|
this.initializeSVG();
|
|
10922
|
+
if (this.showSpeakIcon) {
|
|
10923
|
+
utils.speakIcon(this.el);
|
|
10924
|
+
this.el.append(utils.speakIcon(this.el));
|
|
10925
|
+
}
|
|
10926
|
+
}
|
|
10927
|
+
/** ───────────────────────────────────────────────────────────
|
|
10928
|
+
* Idle‑timer helpers
|
|
10929
|
+
* ─────────────────────────────────────────────────────────── */
|
|
10930
|
+
resetIdleTimer(state) {
|
|
10931
|
+
if (this.idleTimer !== null) {
|
|
10932
|
+
clearTimeout(this.idleTimer);
|
|
10933
|
+
this.idleTimer = null;
|
|
10934
|
+
}
|
|
10935
|
+
this.idleTimer = window.setTimeout(() => {
|
|
10936
|
+
this.showFingerHint(state);
|
|
10937
|
+
}, 3000);
|
|
10938
|
+
}
|
|
10939
|
+
showFingerHint(state) {
|
|
10940
|
+
var _a;
|
|
10941
|
+
if (this.fingerImg)
|
|
10942
|
+
return; // already showing
|
|
10943
|
+
const currentPath = state.paths[state.currentPathIndex];
|
|
10944
|
+
if (!currentPath)
|
|
10945
|
+
return;
|
|
10946
|
+
/** FIX: centre the image on the path (was offset down‑right) **/
|
|
10947
|
+
const IMG_SIZE = 40; // width & height of finger.png
|
|
10948
|
+
const img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
|
|
10949
|
+
img.setAttributeNS('http://www.w3.org/1999/xlink', 'href', utils.convertUrlToRelative(this.fingerHintUrl));
|
|
10950
|
+
img.setAttribute('width', `${IMG_SIZE}`);
|
|
10951
|
+
img.setAttribute('height', `${IMG_SIZE}`);
|
|
10952
|
+
img.setAttribute('id', 'lido-finger-hint');
|
|
10953
|
+
img.style.pointerEvents = 'none';
|
|
10954
|
+
img.style.opacity = '0.8';
|
|
10955
|
+
// place the image so its centre aligns with the path’s start point
|
|
10956
|
+
// const start = currentPath.getPointAtLength(0);
|
|
10957
|
+
img.setAttribute('x', '0');
|
|
10958
|
+
img.setAttribute('y', '0');
|
|
10959
|
+
// animateMotion
|
|
10960
|
+
const motion = document.createElementNS('http://www.w3.org/2000/svg', 'animateMotion');
|
|
10961
|
+
motion.setAttribute('dur', '2s');
|
|
10962
|
+
motion.setAttribute('repeatCount', 'indefinite');
|
|
10963
|
+
const mpath = document.createElementNS('http://www.w3.org/2000/svg', 'mpath');
|
|
10964
|
+
mpath.setAttributeNS('http://www.w3.org/1999/xlink', 'href', `#${currentPath.id}`);
|
|
10965
|
+
motion.appendChild(mpath);
|
|
10966
|
+
img.appendChild(motion);
|
|
10967
|
+
(_a = state.svg) === null || _a === void 0 ? void 0 : _a.appendChild(img);
|
|
10968
|
+
this.fingerImg = img;
|
|
10969
|
+
}
|
|
10970
|
+
hideFingerHint() {
|
|
10971
|
+
if (this.fingerImg && this.fingerImg.parentNode) {
|
|
10972
|
+
this.fingerImg.parentNode.removeChild(this.fingerImg);
|
|
10973
|
+
}
|
|
10974
|
+
this.fingerImg = null;
|
|
7496
10975
|
}
|
|
7497
10976
|
// Fetch the SVG file asynchronously
|
|
7498
10977
|
async fetchSVG(url) {
|
|
@@ -7529,7 +11008,9 @@ const LidoTrace = class {
|
|
|
7529
11008
|
}
|
|
7530
11009
|
// Insert the fetched SVG into the container and adjust viewBox
|
|
7531
11010
|
insertSVG(svgText) {
|
|
7532
|
-
const svgContainer = document.getElementById('svgContainer');
|
|
11011
|
+
const svgContainer = document.getElementById('lido-svgContainer');
|
|
11012
|
+
if (!svgContainer)
|
|
11013
|
+
return;
|
|
7533
11014
|
svgContainer.innerHTML = svgText;
|
|
7534
11015
|
// After inserting, get the SVG element
|
|
7535
11016
|
const svgElement = svgContainer.querySelector('svg');
|
|
@@ -7547,7 +11028,7 @@ const LidoTrace = class {
|
|
|
7547
11028
|
}
|
|
7548
11029
|
// Retrieve the SVG element from the container
|
|
7549
11030
|
getSVGElement() {
|
|
7550
|
-
const svgContainer = document.getElementById('svgContainer');
|
|
11031
|
+
const svgContainer = document.getElementById('lido-svgContainer');
|
|
7551
11032
|
return svgContainer.querySelector('svg');
|
|
7552
11033
|
}
|
|
7553
11034
|
// Get all path and line elements from the SVG
|
|
@@ -7591,10 +11072,15 @@ const LidoTrace = class {
|
|
|
7591
11072
|
setupDrawingPath(state) {
|
|
7592
11073
|
state.paths.forEach((path, index) => {
|
|
7593
11074
|
const pathLength = path.getTotalLength();
|
|
11075
|
+
// /** give every path an id so <mpath> can follow it */
|
|
11076
|
+
path.setAttribute('id', 'lido-path-' + index); // ← NEW
|
|
7594
11077
|
// Create green path for tracing effect
|
|
7595
11078
|
const greenPath = path.cloneNode();
|
|
7596
|
-
greenPath.
|
|
7597
|
-
greenPath.
|
|
11079
|
+
greenPath.style.opacity = '100';
|
|
11080
|
+
greenPath.style['stroke-opacity'] = '100';
|
|
11081
|
+
// greenPath.setAttribute('stroke', 'green');
|
|
11082
|
+
const strokeWidth = path.style['stroke-width'] || path.getAttribute('stroke-width');
|
|
11083
|
+
greenPath.setAttribute('stroke-width', strokeWidth);
|
|
7598
11084
|
greenPath.setAttribute('stroke-dasharray', pathLength.toString());
|
|
7599
11085
|
greenPath.setAttribute('stroke-dashoffset', pathLength.toString()); // Hidden initially
|
|
7600
11086
|
path.parentNode.appendChild(greenPath, path);
|
|
@@ -7610,7 +11096,7 @@ const LidoTrace = class {
|
|
|
7610
11096
|
else {
|
|
7611
11097
|
// In other modes, show the black path
|
|
7612
11098
|
path.setAttribute('stroke', '#000');
|
|
7613
|
-
path.setAttribute('stroke-width',
|
|
11099
|
+
path.setAttribute('stroke-width', strokeWidth);
|
|
7614
11100
|
path.setAttribute('fill', 'none');
|
|
7615
11101
|
path.setAttribute('stroke-dasharray', pathLength.toString());
|
|
7616
11102
|
path.setAttribute('stroke-dashoffset', '0'); // Fully visible initially
|
|
@@ -7627,13 +11113,15 @@ const LidoTrace = class {
|
|
|
7627
11113
|
var _a;
|
|
7628
11114
|
const firstPathStart = state.paths[0].getPointAtLength(0);
|
|
7629
11115
|
const circle = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
|
|
11116
|
+
const strokeWidth = state.paths[state.currentPathIndex].style['stroke-width'] || state.paths[state.currentPathIndex].getAttribute('stroke-width');
|
|
7630
11117
|
circle.setAttribute('id', 'lido-draggableCircle');
|
|
7631
11118
|
circle.setAttribute('cx', firstPathStart.x.toString());
|
|
7632
11119
|
circle.setAttribute('cy', firstPathStart.y.toString());
|
|
7633
|
-
circle.setAttribute('r',
|
|
11120
|
+
circle.setAttribute('r', `calc(${strokeWidth || 10} / 2)`); // Radius of the draggable circle
|
|
7634
11121
|
circle.setAttribute('fill', 'red');
|
|
7635
11122
|
(_a = state.svg) === null || _a === void 0 ? void 0 : _a.appendChild(circle);
|
|
7636
11123
|
state.circle = circle;
|
|
11124
|
+
this.resetIdleTimer(state); // ← start idle timer once the SVG is ready
|
|
7637
11125
|
}
|
|
7638
11126
|
// Add necessary event listeners using Pointer Events
|
|
7639
11127
|
addEventListeners(state) {
|
|
@@ -7653,9 +11141,10 @@ const LidoTrace = class {
|
|
|
7653
11141
|
if (distance <= state.proximityThreshold * state.proximityThreshold) {
|
|
7654
11142
|
state.isDragging = true;
|
|
7655
11143
|
state.activePointerId = evt.pointerId;
|
|
7656
|
-
// Capture the pointer to continue receiving events even if it leaves the element
|
|
7657
11144
|
state.circle.setPointerCapture(evt.pointerId);
|
|
7658
11145
|
}
|
|
11146
|
+
this.hideFingerHint(); // ← NEW
|
|
11147
|
+
this.resetIdleTimer(state); // ← NEW
|
|
7659
11148
|
});
|
|
7660
11149
|
// Handle pointermove on the SVG to update the circle position
|
|
7661
11150
|
(_a = state.svg) === null || _a === void 0 ? void 0 : _a.addEventListener('pointermove', (evt) => {
|
|
@@ -7670,18 +11159,16 @@ const LidoTrace = class {
|
|
|
7670
11159
|
}
|
|
7671
11160
|
});
|
|
7672
11161
|
// Handle pointerup and pointercancel on the SVG to stop dragging
|
|
7673
|
-
|
|
7674
|
-
if (evt.pointerId === state.activePointerId) {
|
|
7675
|
-
state.isDragging = false;
|
|
7676
|
-
state.activePointerId = null;
|
|
7677
|
-
}
|
|
7678
|
-
});
|
|
7679
|
-
(_c = state.svg) === null || _c === void 0 ? void 0 : _c.addEventListener('pointercancel', (evt) => {
|
|
11162
|
+
const endDrag = (evt) => {
|
|
7680
11163
|
if (evt.pointerId === state.activePointerId) {
|
|
7681
11164
|
state.isDragging = false;
|
|
7682
11165
|
state.activePointerId = null;
|
|
11166
|
+
this.hideFingerHint(); // ← NEW
|
|
11167
|
+
this.resetIdleTimer(state); // ← NEW
|
|
7683
11168
|
}
|
|
7684
|
-
}
|
|
11169
|
+
};
|
|
11170
|
+
(_b = state.svg) === null || _b === void 0 ? void 0 : _b.addEventListener('pointerup', endDrag);
|
|
11171
|
+
(_c = state.svg) === null || _c === void 0 ? void 0 : _c.addEventListener('pointercancel', endDrag);
|
|
7685
11172
|
// Optional: Prevent context menu on long press
|
|
7686
11173
|
(_d = state.svg) === null || _d === void 0 ? void 0 : _d.addEventListener('contextmenu', (evt) => {
|
|
7687
11174
|
evt.preventDefault();
|
|
@@ -7694,6 +11181,7 @@ const LidoTrace = class {
|
|
|
7694
11181
|
return;
|
|
7695
11182
|
if (!state.circle || !state.paths || state.paths.length === 0)
|
|
7696
11183
|
return;
|
|
11184
|
+
this.hideFingerHint(); // user is active, remove hint
|
|
7697
11185
|
const evt = state.pointerMoveEvent;
|
|
7698
11186
|
const pointerPos = this.getPointerPosition(evt, state.svg);
|
|
7699
11187
|
const circlePos = {
|
|
@@ -7734,9 +11222,12 @@ const LidoTrace = class {
|
|
|
7734
11222
|
// Create a new path element if it's the first trace for the current path index
|
|
7735
11223
|
if (!state.currentFreePath[state.currentPathIndex]) {
|
|
7736
11224
|
const newPath = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
7737
|
-
newPath.setAttribute('stroke', 'green');
|
|
7738
|
-
|
|
11225
|
+
// newPath.setAttribute('stroke', 'green');
|
|
11226
|
+
const strokeWidth = state.paths[state.currentPathIndex].style['stroke-width'] || state.paths[state.currentPathIndex].getAttribute('stroke-width');
|
|
11227
|
+
newPath.setAttribute('stroke-width', strokeWidth);
|
|
7739
11228
|
newPath.setAttribute('fill', 'none');
|
|
11229
|
+
newPath.setAttribute('stroke-linecap', 'round');
|
|
11230
|
+
newPath.setAttribute('stroke', 'lightgreen');
|
|
7740
11231
|
// Start the new path at the current pointer position
|
|
7741
11232
|
newPath.setAttribute('d', `M${pointerPos.x},${pointerPos.y}`);
|
|
7742
11233
|
(_a = state.svg) === null || _a === void 0 ? void 0 : _a.appendChild(newPath);
|
|
@@ -7767,6 +11258,7 @@ const LidoTrace = class {
|
|
|
7767
11258
|
this.moveToNextPath(state);
|
|
7768
11259
|
state.currentFreePath[state.currentPathIndex] = null; // Reset free path for next path
|
|
7769
11260
|
}
|
|
11261
|
+
// this.resetIdleTimer(state); // ← keep timer alive
|
|
7770
11262
|
return; // Exit early since we're in free trace or blind free trace mode
|
|
7771
11263
|
}
|
|
7772
11264
|
// In normal modes, allow movement and drawing only within the general proximity threshold
|
|
@@ -7784,8 +11276,32 @@ const LidoTrace = class {
|
|
|
7784
11276
|
}
|
|
7785
11277
|
else if (state.totalPathLength - 1 - state.lastLength < 5 && state.currentPathIndex === state.paths.length - 1) {
|
|
7786
11278
|
// this.loadAnotherSVG(state, true);
|
|
7787
|
-
|
|
11279
|
+
this.moveToNextContainer();
|
|
7788
11280
|
}
|
|
11281
|
+
// this.resetIdleTimer(state); // ← keep timer alive
|
|
11282
|
+
}
|
|
11283
|
+
// Move to the next container after completing the current SVG
|
|
11284
|
+
async moveToNextContainer() {
|
|
11285
|
+
if (this.moving)
|
|
11286
|
+
return; // Prevent multiple calls
|
|
11287
|
+
this.moving = true; // Set moving to true to prevent re-entrance
|
|
11288
|
+
if (this.highlightTextId) {
|
|
11289
|
+
this.highlightLetter(this.currentSvgIndex);
|
|
11290
|
+
}
|
|
11291
|
+
if (this.animationTrace) {
|
|
11292
|
+
await this.playTraceAnimation();
|
|
11293
|
+
}
|
|
11294
|
+
if (this.currentSvgIndex < this.svgUrls.length - 1) {
|
|
11295
|
+
this.currentSvgIndex++;
|
|
11296
|
+
await this.initializeSVG();
|
|
11297
|
+
this.moving = false;
|
|
11298
|
+
return;
|
|
11299
|
+
}
|
|
11300
|
+
const container = document.getElementById(utils.LidoContainer);
|
|
11301
|
+
if (container && this.onCorrect) {
|
|
11302
|
+
await utils.executeActions(this.onCorrect, container);
|
|
11303
|
+
}
|
|
11304
|
+
utils.triggerNextContainer();
|
|
7789
11305
|
}
|
|
7790
11306
|
// Get the pointer position relative to the SVG
|
|
7791
11307
|
getPointerPosition(evt, svg) {
|
|
@@ -7840,28 +11356,19 @@ const LidoTrace = class {
|
|
|
7840
11356
|
// Load the next or previous SVG based on the isNext flag
|
|
7841
11357
|
async loadAnotherSVG(state, isNext) {
|
|
7842
11358
|
state.isDragging = false;
|
|
7843
|
-
// Update fileIndex based on whether isNext is true or false
|
|
7844
|
-
// if (isNext) {
|
|
7845
|
-
// state.fileIndex++;
|
|
7846
|
-
// if (state.fileIndex >= this.svgFiles.length) {
|
|
7847
|
-
// state.fileIndex = this.svgFiles.length - 1; // Stay at the last file
|
|
7848
|
-
// return;
|
|
7849
|
-
// }
|
|
7850
|
-
// } else {
|
|
7851
|
-
// state.fileIndex--;
|
|
7852
|
-
// if (state.fileIndex < 0) {
|
|
7853
|
-
// state.fileIndex = 0; // Stay at the first file
|
|
7854
|
-
// return;
|
|
7855
|
-
// }
|
|
7856
|
-
// }
|
|
7857
11359
|
try {
|
|
7858
11360
|
if (state.svg) {
|
|
7859
11361
|
this.cleanupPreviousSVG(state);
|
|
7860
11362
|
}
|
|
7861
|
-
|
|
7862
|
-
const svgText = await this.fetchSVG(this.svgSource);
|
|
11363
|
+
const svgText = await this.fetchSVG(utils.convertUrlToRelative(this.svgSource));
|
|
7863
11364
|
this.insertSVG(svgText);
|
|
7864
11365
|
state.svg = this.getSVGElement();
|
|
11366
|
+
if (this.mode === utils.TraceMode.BlindTracing || this.mode === utils.TraceMode.BlindFreeTrace) {
|
|
11367
|
+
//make image in the svg style as display none
|
|
11368
|
+
state.svg.querySelectorAll('image').forEach(img => {
|
|
11369
|
+
img.style.display = 'none';
|
|
11370
|
+
});
|
|
11371
|
+
}
|
|
7865
11372
|
state.paths = this.getPaths(state.svg);
|
|
7866
11373
|
this.setupDrawingPath(state);
|
|
7867
11374
|
this.setupDraggableCircle(state);
|
|
@@ -7885,16 +11392,18 @@ const LidoTrace = class {
|
|
|
7885
11392
|
state.currentPathIndex = 0;
|
|
7886
11393
|
state.lastLength = 0;
|
|
7887
11394
|
state.totalPathLength = state.paths[0].getTotalLength();
|
|
11395
|
+
this.hideFingerHint();
|
|
11396
|
+
this.resetIdleTimer(state);
|
|
7888
11397
|
}
|
|
7889
11398
|
// Move to the next path in the SVG
|
|
7890
|
-
moveToNextPath(state) {
|
|
11399
|
+
async moveToNextPath(state) {
|
|
7891
11400
|
var _a, _b;
|
|
7892
11401
|
state.isDragging = false;
|
|
7893
11402
|
state.currentPathIndex++;
|
|
7894
11403
|
state.lastLength = 0;
|
|
11404
|
+
this.hideFingerHint(); // remove hint when changing path
|
|
7895
11405
|
if (state.currentPathIndex >= state.paths.length) {
|
|
7896
|
-
|
|
7897
|
-
utils.triggerNextContainer();
|
|
11406
|
+
this.moveToNextContainer();
|
|
7898
11407
|
return;
|
|
7899
11408
|
}
|
|
7900
11409
|
const nextPath = state.paths[state.currentPathIndex];
|
|
@@ -7909,6 +11418,55 @@ const LidoTrace = class {
|
|
|
7909
11418
|
if (state.mode === utils.TraceMode.ShowFlow) {
|
|
7910
11419
|
state.flowMarkers = this.createFlowMarkersForPath(nextPath);
|
|
7911
11420
|
}
|
|
11421
|
+
this.resetIdleTimer(state);
|
|
11422
|
+
}
|
|
11423
|
+
async playTraceAnimation() {
|
|
11424
|
+
const el = document.getElementById(this.id);
|
|
11425
|
+
if (!el)
|
|
11426
|
+
return;
|
|
11427
|
+
el.classList.add('trace-animate');
|
|
11428
|
+
// Wait for the animation to finish (500ms)
|
|
11429
|
+
await new Promise(resolve => setTimeout(resolve, 500));
|
|
11430
|
+
el.classList.remove('trace-animate');
|
|
11431
|
+
}
|
|
11432
|
+
async highlightLetter(index) {
|
|
11433
|
+
const container = document.getElementById(utils.LidoContainer);
|
|
11434
|
+
if (!container)
|
|
11435
|
+
return;
|
|
11436
|
+
// Ensure highlightTextId is set
|
|
11437
|
+
const textId = this.highlightTextId;
|
|
11438
|
+
if (!textId)
|
|
11439
|
+
return;
|
|
11440
|
+
// Find the lido-text element by id
|
|
11441
|
+
const textElem = document.getElementById(textId);
|
|
11442
|
+
if (!textElem)
|
|
11443
|
+
return;
|
|
11444
|
+
// Check if the textElem has a span-type attribute
|
|
11445
|
+
const spanType = textElem.getAttribute('span-type');
|
|
11446
|
+
if (!spanType)
|
|
11447
|
+
return;
|
|
11448
|
+
// Find the .lido-text-content container inside lido-text
|
|
11449
|
+
const content = textElem.querySelector('.lido-text-content');
|
|
11450
|
+
if (!content)
|
|
11451
|
+
return;
|
|
11452
|
+
if (spanType === 'letters') {
|
|
11453
|
+
const letters = content.querySelectorAll('.text-letters');
|
|
11454
|
+
if (index < 0 || index >= letters.length)
|
|
11455
|
+
return;
|
|
11456
|
+
// Highlight the current letter keeping the previous ones highlighted
|
|
11457
|
+
const letter = letters[index];
|
|
11458
|
+
if (letter)
|
|
11459
|
+
letter.classList.add('letter-highlight');
|
|
11460
|
+
}
|
|
11461
|
+
if (spanType === 'words') {
|
|
11462
|
+
const words = content.querySelectorAll('.text-words');
|
|
11463
|
+
if (index < 0 || index >= words.length)
|
|
11464
|
+
return;
|
|
11465
|
+
// Highlight the current word keeping the previous ones highlighted
|
|
11466
|
+
const word = words[index];
|
|
11467
|
+
if (word)
|
|
11468
|
+
word.classList.add('word-highlight');
|
|
11469
|
+
}
|
|
7912
11470
|
}
|
|
7913
11471
|
render() {
|
|
7914
11472
|
const style = {
|
|
@@ -7917,22 +11475,26 @@ const LidoTrace = class {
|
|
|
7917
11475
|
top: this.y,
|
|
7918
11476
|
left: this.x,
|
|
7919
11477
|
zIndex: this.z,
|
|
7920
|
-
position: 'absolute',
|
|
11478
|
+
// position: 'absolute' as const,
|
|
7921
11479
|
};
|
|
7922
|
-
|
|
7923
|
-
// const svgFiles = ['A_test.svg', 'B_test.svg', 'C_test.svg', 'D_test.svg', 'अ_test.svg', 'ट_test.svg', 'क_test.svg', 'ख_test.svg', 'ग_test.svg']; // Add more SVG file names as needed
|
|
7924
|
-
return (index.h(index.Host, { key: '0de3d964cbd15ba6a8964c7ba14174643d0fed7b', class: "lido-trace", id: this.id, style: style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, tabindex: this.tabIndex }, index.h("div", { key: '2826b49767f2c5f781be2106c3fb05cd14bfe8dc', id: "lido-svgContainer" })));
|
|
11480
|
+
return (index.h(index.Host, { key: '363897475f678b89b72bf19d76fcafcab8e1fd97', class: "lido-trace", id: this.id, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, style: style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, tabindex: this.tabIndex }, index.h("div", { key: 'db92cddb2e7cf888a747c33b22a39c261beba7f4', style: { height: this.height, width: this.width }, id: "lido-svgContainer" })));
|
|
7925
11481
|
}
|
|
7926
|
-
static get assetsDirs() { return ["svg"]; }
|
|
11482
|
+
static get assetsDirs() { return ["svg", "images"]; }
|
|
11483
|
+
get el() { return index.getElement(this); }
|
|
11484
|
+
static get watchers() { return {
|
|
11485
|
+
"svgSource": ["initializeSVG"],
|
|
11486
|
+
"mode": ["initializeSVG"]
|
|
11487
|
+
}; }
|
|
7927
11488
|
};
|
|
7928
11489
|
LidoTrace.style = LidoTraceStyle0;
|
|
7929
11490
|
|
|
7930
|
-
const lidoWrapCss = ".lido-wrap{display:grid;grid-gap:10px;grid-template-columns:repeat(auto-fill, minmax(186px, auto))}.lido-wrap>*{padding:10px;background-color:var(--child-bg-color, #f0f0f0);box-sizing:border-box}";
|
|
11491
|
+
const lidoWrapCss = ".lido-wrap{display:grid;grid-gap:10px;grid-template-columns:repeat(auto-fill, minmax(186px, auto))}.lido-wrap>*{padding:10px;background-color:var(--child-bg-color, #f0f0f0);box-sizing:border-box}.lido-flex{display:flex;flex-wrap:wrap;align-content:flex-start;gap:10px}";
|
|
7931
11492
|
const LidoWrapStyle0 = lidoWrapCss;
|
|
7932
11493
|
|
|
7933
11494
|
const LidoWrap = class {
|
|
7934
11495
|
constructor(hostRef) {
|
|
7935
11496
|
index.registerInstance(this, hostRef);
|
|
11497
|
+
this.showSpeakIcon = false;
|
|
7936
11498
|
this.id = undefined;
|
|
7937
11499
|
this.value = undefined;
|
|
7938
11500
|
this.height = undefined;
|
|
@@ -7954,6 +11516,10 @@ const LidoWrap = class {
|
|
|
7954
11516
|
this.childElementsLength = undefined;
|
|
7955
11517
|
this.minLength = undefined;
|
|
7956
11518
|
this.maxLength = undefined;
|
|
11519
|
+
this.flex = undefined;
|
|
11520
|
+
this.minDrops = 1;
|
|
11521
|
+
this.maxDrops = 1;
|
|
11522
|
+
this.margin = '';
|
|
7957
11523
|
this.style = undefined;
|
|
7958
11524
|
}
|
|
7959
11525
|
/**
|
|
@@ -7962,7 +11528,14 @@ const LidoWrap = class {
|
|
|
7962
11528
|
*/
|
|
7963
11529
|
componentDidLoad() {
|
|
7964
11530
|
utils.initEventsForElement(this.el, this.type);
|
|
7965
|
-
utils.handlingChildElements(this.el, this.minLength, this.maxLength, this.childElementsLength
|
|
11531
|
+
utils.handlingChildElements(this.el, this.minLength, this.maxLength, this.childElementsLength);
|
|
11532
|
+
if (this.flex === 'true') {
|
|
11533
|
+
this.el.classList.remove('lido-wrap');
|
|
11534
|
+
this.el.classList.add('lido-flex');
|
|
11535
|
+
}
|
|
11536
|
+
if (this.showSpeakIcon) {
|
|
11537
|
+
utils.attachSpeakIcon(this.el, this.x, this.y);
|
|
11538
|
+
}
|
|
7966
11539
|
}
|
|
7967
11540
|
/**
|
|
7968
11541
|
* Lifecycle method that runs before the component is rendered.
|
|
@@ -7986,19 +11559,23 @@ const LidoWrap = class {
|
|
|
7986
11559
|
top: utils.parseProp(this.y, orientation),
|
|
7987
11560
|
left: utils.parseProp(this.x, orientation),
|
|
7988
11561
|
zIndex: this.z,
|
|
7989
|
-
display: JSON.parse(utils.parseProp(`${this.visible}`, orientation)) ? 'grid' : 'none', // Toggle visibility
|
|
11562
|
+
display: JSON.parse(utils.parseProp(`${this.visible}`, orientation)) ? (this.flex === 'true' ? 'flex' : 'grid') : 'none', // Toggle visibility
|
|
11563
|
+
margin: utils.parseProp(this.margin, orientation),
|
|
7990
11564
|
};
|
|
7991
11565
|
}
|
|
7992
11566
|
render() {
|
|
7993
|
-
return (index.h(index.Host, { key: '
|
|
11567
|
+
return (index.h(index.Host, { key: '396ad713cde9f794c740975daee6587f4166394a', class: "lido-wrap", value: this.value, type: this.type, "tab-index": this.tabIndex, style: this.style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, audio: this.audio, minDrops: this.minDrops, maxDrops: this.maxDrops, onTouch: this.onTouch, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, onEntry: this.onEntry }, index.h("slot", { key: '2016d52840e7d3db136680f4969d66e5b4d156d7' })));
|
|
7994
11568
|
}
|
|
7995
11569
|
get el() { return index.getElement(this); }
|
|
7996
11570
|
};
|
|
7997
11571
|
LidoWrap.style = LidoWrapStyle0;
|
|
7998
11572
|
|
|
7999
11573
|
exports.lido_avatar = LidoAvatar;
|
|
11574
|
+
exports.lido_cell = LidoCell;
|
|
8000
11575
|
exports.lido_col = LidoCol;
|
|
8001
11576
|
exports.lido_container = LidoContainer;
|
|
11577
|
+
exports.lido_flash_card = LidoFlash;
|
|
11578
|
+
exports.lido_float = LidoFloat;
|
|
8002
11579
|
exports.lido_home = LidoHome;
|
|
8003
11580
|
exports.lido_image = LidoImage;
|
|
8004
11581
|
exports.lido_pos = LidoPos;
|
|
@@ -8006,8 +11583,7 @@ exports.lido_random = LidoRandom;
|
|
|
8006
11583
|
exports.lido_root = LidoRoot;
|
|
8007
11584
|
exports.lido_row = LidoRow;
|
|
8008
11585
|
exports.lido_shape = LidoShape;
|
|
11586
|
+
exports.lido_slide_fill = LidoSlideFill;
|
|
8009
11587
|
exports.lido_text = LidoText;
|
|
8010
11588
|
exports.lido_trace = LidoTrace;
|
|
8011
11589
|
exports.lido_wrap = LidoWrap;
|
|
8012
|
-
|
|
8013
|
-
//# sourceMappingURL=lido-avatar_13.cjs.entry.js.map
|