lido-player 0.0.2-beta-13 → 0.0.2-beta-14

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.
Files changed (219) hide show
  1. package/LICENSE +21 -21
  2. package/dist/cjs/{decode-BunxKYHJ.js → decode-BLUeYhas.js} +1 -1
  3. package/dist/cjs/{index-1rmY-0pT.js → index-CNWniNnt.js} +60 -60
  4. package/dist/cjs/{index-Dy19zuTX.js → index-CS8kGcZo.js} +1 -1
  5. package/dist/cjs/index.cjs.js +2 -2
  6. package/dist/cjs/lido-avatar_22.cjs.entry.js +33 -33
  7. package/dist/cjs/lido-player.cjs.js +1 -1
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/collection/components/avatar/lido-avatar.css +4 -4
  10. package/dist/collection/components/avatar/lido-avatar.js +1 -1
  11. package/dist/collection/components/avatar/lido-avatar.tsx +207 -207
  12. package/dist/collection/components/avatar/readme.md +49 -49
  13. package/dist/collection/components/calculator/lido-calculator.css +77 -77
  14. package/dist/collection/components/calculator/lido-calculator.js +2 -2
  15. package/dist/collection/components/canvas/lido-canvas.css +1 -1
  16. package/dist/collection/components/canvas/lido-canvas.js +1 -1
  17. package/dist/collection/components/cell/lido-cell.css +100 -100
  18. package/dist/collection/components/cell/lido-cell.js +12 -12
  19. package/dist/collection/components/column/lido-col.css +19 -19
  20. package/dist/collection/components/column/lido-col.js +6 -6
  21. package/dist/collection/components/container/lido-container.css +10 -10
  22. package/dist/collection/components/container/lido-container.js +8 -8
  23. package/dist/collection/components/flashCard/lido-flash-card.css +28 -28
  24. package/dist/collection/components/flashCard/lido-flash-card.js +4 -4
  25. package/dist/collection/components/float/lido-float.css +30 -30
  26. package/dist/collection/components/float/lido-float.js +2 -2
  27. package/dist/collection/components/home/lido-home.css +309 -309
  28. package/dist/collection/components/home/lido-home.js +5 -5
  29. package/dist/collection/components/image/lido-image.css +17 -17
  30. package/dist/collection/components/image/lido-image.js +6 -6
  31. package/dist/collection/components/keyboard/lido-keyboard.css +38 -38
  32. package/dist/collection/components/keyboard/lido-keyboard.js +3 -3
  33. package/dist/collection/components/mathMatrix/lido-math-matrix.css +56 -56
  34. package/dist/collection/components/mathMatrix/lido-math-matrix.js +1 -1
  35. package/dist/collection/components/position/lido-pos.css +16 -16
  36. package/dist/collection/components/position/lido-pos.js +2 -2
  37. package/dist/collection/components/random/lido-random.css +8 -8
  38. package/dist/collection/components/random/lido-random.js +2 -2
  39. package/dist/collection/components/root/lido-root.js +5 -5
  40. package/dist/collection/components/row/lido-row.css +10 -10
  41. package/dist/collection/components/row/lido-row.js +6 -6
  42. package/dist/collection/components/scale/lido-balance.css +145 -145
  43. package/dist/collection/components/scale/lido-balance.js +13 -13
  44. package/dist/collection/components/shape/lido-shape.css +216 -185
  45. package/dist/collection/components/shape/lido-shape.js +6 -6
  46. package/dist/collection/components/slideFill/lido-slide-fill.css +3 -3
  47. package/dist/collection/components/slideFill/lido-slide-fill.js +13 -13
  48. package/dist/collection/components/text/lido-text.css +53 -53
  49. package/dist/collection/components/text/lido-text.js +5 -5
  50. package/dist/collection/components/trace/lido-trace.css +97 -97
  51. package/dist/collection/components/trace/lido-trace.js +2 -2
  52. package/dist/collection/components/wrap/lido-wrap.css +18 -18
  53. package/dist/collection/components/wrap/lido-wrap.js +6 -6
  54. package/dist/collection/css/animation.css +211 -211
  55. package/dist/collection/css/index.css +312 -312
  56. package/dist/collection/stories/Templates/Fill-Up/fill-up.stories.js +61 -61
  57. package/dist/collection/stories/Templates/LetterPairing/LetterPairing.stories.js +123 -123
  58. package/dist/collection/stories/Templates/RocketGame/rocketGame.stories.js +48 -48
  59. package/dist/collection/stories/Templates/Tag/tagGame.stories.js +39 -39
  60. package/dist/collection/stories/Templates/arrangeLetters/arrangeLetters.stories.js +44 -44
  61. package/dist/collection/stories/Templates/balancing/balancing.stories.js +35 -35
  62. package/dist/collection/stories/Templates/balloonPop/balloonPop.stories.js +38 -38
  63. package/dist/collection/stories/Templates/blender/blender.stories.js +58 -58
  64. package/dist/collection/stories/Templates/bubbleType/bubbleType.stories.js +42 -42
  65. package/dist/collection/stories/Templates/calculator/calculator.stories.js +28 -28
  66. package/dist/collection/stories/Templates/categorize/categorize.stories.js +37 -37
  67. package/dist/collection/stories/Templates/categorize2/categorize2.stories.js +67 -67
  68. package/dist/collection/stories/Templates/checker-block/checkerBlock.stories.js +29 -29
  69. package/dist/collection/stories/Templates/checkerBlock/checkerBlock.stories.js +13 -13
  70. package/dist/collection/stories/Templates/create-sentence/createSentence.stories.js +74 -74
  71. package/dist/collection/stories/Templates/dragAndDrop/drag-drop.stories.js +69 -69
  72. package/dist/collection/stories/Templates/fillAnswer/fill-answer.stories.js +43 -43
  73. package/dist/collection/stories/Templates/fillBlank/fill-blank.stories.js +282 -282
  74. package/dist/collection/stories/Templates/foodJar/food-jar.stories.js +35 -35
  75. package/dist/collection/stories/Templates/grid/grid.stories.js +118 -118
  76. package/dist/collection/stories/Templates/gridGame/grid-game.stories.js +57 -57
  77. package/dist/collection/stories/Templates/imageMatch/imageMatch.stories.js +44 -44
  78. package/dist/collection/stories/Templates/jumpSentence/jumpSentence.stories.js +41 -41
  79. package/dist/collection/stories/Templates/letterboard/letterboard.stories.js +183 -183
  80. package/dist/collection/stories/Templates/makeSentence/make-sentence.stories.js +36 -36
  81. package/dist/collection/stories/Templates/matchBox/matchBox.stories.js +69 -69
  82. package/dist/collection/stories/Templates/matchBox/matchBox2.stories.js +84 -84
  83. package/dist/collection/stories/Templates/matchingCard/matching-card.stories.js +31 -31
  84. package/dist/collection/stories/Templates/multipleOption/mcqWithQuestionImage.stories.js +112 -112
  85. package/dist/collection/stories/Templates/multipleOption/multiple-option.stories.js +47 -47
  86. package/dist/collection/stories/Templates/multiplyBeeds/multiplyBeeds.stories.js +57 -57
  87. package/dist/collection/stories/Templates/nimbleTable/nimbleTable.stories.js +53 -53
  88. package/dist/collection/stories/Templates/numberBoard/numberBoard.stories.js +46 -46
  89. package/dist/collection/stories/Templates/numberBoardTwo/numberBoardTwo.stories.js +45 -45
  90. package/dist/collection/stories/Templates/numberIdentification/numberIdentificationimageTotext.stories.js +56 -56
  91. package/dist/collection/stories/Templates/numberIdentification/numberIdentificationtextTotext.stories.js +53 -53
  92. package/dist/collection/stories/Templates/numberPair/numberPair.stories.js +127 -127
  93. package/dist/collection/stories/Templates/openwindow/openwindow.stories.js +47 -47
  94. package/dist/collection/stories/Templates/openwindow/openwindow2.stories.js +38 -38
  95. package/dist/collection/stories/Templates/order-tractor/order-tractor-ascending-order.stories.js +97 -97
  96. package/dist/collection/stories/Templates/order-tractor/order-tractor.stories.js +90 -90
  97. package/dist/collection/stories/Templates/palEgmaCalculateSum/palEgmaMultiOption.stories.js +63 -63
  98. package/dist/collection/stories/Templates/palEgmaCalculateSum/palEgmaSumTogether.stories.js +45 -45
  99. package/dist/collection/stories/Templates/palEgmaPatternMatching/palEgmaPatternMatching.stories.js +63 -63
  100. package/dist/collection/stories/Templates/palEgmaWordProblem/palEgmaWordProblem.stories.js +79 -79
  101. package/dist/collection/stories/Templates/palEgraInventedSpelling/pal_egra_invented_spelling_schema.stories.js +32 -32
  102. package/dist/collection/stories/Templates/palEgraMCQWithImage/palEgraMCQWithImage.stories.js +42 -42
  103. package/dist/collection/stories/Templates/palEgraOptionWithAudio/palEgraOptionWithAudio.stories.js +63 -63
  104. package/dist/collection/stories/Templates/palEgraStoryMaking/pal_egra_story_making.stories.js +44 -44
  105. package/dist/collection/stories/Templates/palEgraTemplate1/palEgraLetterIdentification.stories.js +34 -34
  106. package/dist/collection/stories/Templates/palEgraWordMatch/palEgraWordMatch.stories.js +52 -52
  107. package/dist/collection/stories/Templates/palEgra_OddOneOut/palEgra_oddOneOut.stories.js +33 -33
  108. package/dist/collection/stories/Templates/palEgra_arrange_pictures/palEgra_arrange_pictures.stories.js +40 -40
  109. package/dist/collection/stories/Templates/palEgra_build_word/palEgra_build_word.stories.js +48 -48
  110. package/dist/collection/stories/Templates/palEgra_word_formation/palEgra_WordFormation.stories.js +48 -48
  111. package/dist/collection/stories/Templates/palStorytale/palStorytale.stories.js +18 -18
  112. package/dist/collection/stories/Templates/phonic-tractor/phonic-tractor.stories.js +44 -44
  113. package/dist/collection/stories/Templates/pictureClues/pictureClues.stories.js +34 -34
  114. package/dist/collection/stories/Templates/pictureWordMatch/pictureWordMatch1.stories.js +36 -36
  115. package/dist/collection/stories/Templates/pictureWordMatch/pictureWordMatch2.stories.js +30 -30
  116. package/dist/collection/stories/Templates/picturemeaning/pictureMeaningCocos.stories.js +20 -20
  117. package/dist/collection/stories/Templates/puzzleGame/puzzleGame.stories.js +17 -17
  118. package/dist/collection/stories/Templates/questionBoard/questionBoard.stories.js +58 -58
  119. package/dist/collection/stories/Templates/quizLiteracy/quizLiteracy.stories.js +50 -50
  120. package/dist/collection/stories/Templates/quizLiteracy/quizLiteracyImageWithText.stories.js +36 -36
  121. package/dist/collection/stories/Templates/quizLiteracy/quizLiteracyImageWord.stories.js +43 -43
  122. package/dist/collection/stories/Templates/quizMaths/quizMaths.stories.js +631 -631
  123. package/dist/collection/stories/Templates/reorder/reorder.stories.js +63 -63
  124. package/dist/collection/stories/Templates/rowBlocks/rowBlocks.stories.js +47 -47
  125. package/dist/collection/stories/Templates/sentenceMatch/sentenceMatch.stories.js +29 -29
  126. package/dist/collection/stories/Templates/sequenceBox/sequenceBox1.stories.js +64 -64
  127. package/dist/collection/stories/Templates/sequenceBox/sequenceBox2.stories.js +62 -62
  128. package/dist/collection/stories/Templates/shapePair/shape-pair.stories.js +106 -106
  129. package/dist/collection/stories/Templates/shapeTractor/shape-tractor.stories.js +50 -50
  130. package/dist/collection/stories/Templates/spellDoor/spellDoor.stories.js +41 -41
  131. package/dist/collection/stories/Templates/storyTale/storyTale.stories.js +39 -39
  132. package/dist/collection/stories/Templates/substraction/substractionWithimg.stories.js +62 -62
  133. package/dist/collection/stories/Templates/substraction/substractionWithoutImg.stories.js +42 -42
  134. package/dist/collection/stories/Templates/sumTogether/sumTogether.stories.js +50 -50
  135. package/dist/collection/stories/Templates/tenBox/tenBox.stories.js +88 -88
  136. package/dist/collection/stories/Templates/total/total.stories.js +28 -28
  137. package/dist/collection/stories/Templates/wordBuilding/wordBuildingwithimg.stories.js +35 -35
  138. package/dist/collection/stories/Templates/wordBuilding/wordBuildingwithoutimg.stories.js +34 -34
  139. package/dist/collection/stories/Templates/writeCard/writeCard.stories.js +31 -31
  140. package/dist/collection/stories/Templates/writeLetter/writeLetter.stories.js +58 -58
  141. package/dist/collection/stories/Templates/writeNumber/writeNumber.stories.js +44 -44
  142. package/dist/collection/stories/Templates/writeSet/writeSet.stories.js +31 -31
  143. package/dist/collection/stories/Templates/writeWord/writeWord.stories.js +34 -34
  144. package/dist/collection/stories/components/flash-card.stories.js +48 -48
  145. package/dist/collection/stories/components/keyboard.stories.js +10 -10
  146. package/dist/collection/stories/components/slider.stories.js +4 -4
  147. package/dist/collection/stories/components/trace.stories.js +5 -5
  148. package/dist/collection/utils/utils.js +5 -5
  149. package/dist/collection/utils/utilsHandlers/dragDropHandler.js +8 -8
  150. package/dist/collection/utils/utilsHandlers/highlightHandler.js +54 -54
  151. package/dist/collection/utils/utilsHandlers/lidoCalculatorHandler.js +8 -8
  152. package/dist/collection/utils/utilsHandlers/sortHandler.js +10 -10
  153. package/dist/components/index.js +1 -1
  154. package/dist/components/lido-avatar.js +1 -1
  155. package/dist/components/lido-balance.js +1 -1
  156. package/dist/components/lido-calculator.js +1 -1
  157. package/dist/components/lido-canvas.js +1 -1
  158. package/dist/components/lido-cell.js +1 -1
  159. package/dist/components/lido-col.js +1 -1
  160. package/dist/components/lido-container.js +1 -1
  161. package/dist/components/lido-flash-card.js +1 -1
  162. package/dist/components/lido-float.js +1 -1
  163. package/dist/components/lido-home.js +1 -1
  164. package/dist/components/lido-keyboard.js +1 -1
  165. package/dist/components/lido-math-matrix.js +1 -1
  166. package/dist/components/lido-pos.js +1 -1
  167. package/dist/components/lido-random.js +1 -1
  168. package/dist/components/lido-root.js +1 -1
  169. package/dist/components/lido-row.js +1 -1
  170. package/dist/components/lido-shape.js +1 -1
  171. package/dist/components/lido-slide-fill.js +1 -1
  172. package/dist/components/lido-text.js +1 -1
  173. package/dist/components/lido-trace.js +1 -1
  174. package/dist/components/lido-wrap.js +1 -1
  175. package/dist/components/{p-D2RiLzSu.js → p-BBHM059l.js} +1 -1
  176. package/dist/components/{p-CwDTdXe5.js → p-BeRr8u5m.js} +1 -1
  177. package/dist/components/{p-CFNRhdZZ.js → p-C5WmmkI6.js} +1 -1
  178. package/dist/components/{p-CLX-8DBk.js → p-C70ykycD.js} +1 -1
  179. package/dist/components/{p-kmKkLN_7.js → p-CCR42e0i.js} +1 -1
  180. package/dist/components/{p-BP79Al--.js → p-CRzTmKDJ.js} +1 -1
  181. package/dist/components/p-CTlcpv4a.js +1 -0
  182. package/dist/components/{p-DflRPD3L.js → p-CXHPZN3m.js} +1 -1
  183. package/dist/components/{p-DYs8s-uh.js → p-CayICx4g.js} +1 -1
  184. package/dist/components/{p-CDhOF-lb.js → p-CgsPIpg0.js} +1 -1
  185. package/dist/components/p-CwIlwnQk.js +1 -0
  186. package/dist/components/{p-DPAlnts-.js → p-D4s9ZWCB.js} +1 -1
  187. package/dist/components/{p-BiNO9454.js → p-DLyacZap.js} +1 -1
  188. package/dist/components/p-DONbWJGn.js +1 -0
  189. package/dist/components/p-DVTigdH_.js +1 -0
  190. package/dist/components/{p-B8USa8EO.js → p-DaMpzrMk.js} +1 -1
  191. package/dist/components/{p-D_Q6Oy7S.js → p-DbZeFECr.js} +2 -2
  192. package/dist/components/{p-C7U1h9gI.js → p-MkbxS5lW.js} +1 -1
  193. package/dist/components/{p-DVn4BL1l.js → p-NHusmM9J.js} +1 -1
  194. package/dist/components/{p-DH6lvh19.js → p-fBjZoiLo.js} +1 -1
  195. package/dist/esm/{decode-BbicjSTs.js → decode-DpcU-915.js} +1 -1
  196. package/dist/esm/{index-Dq-Z8Dx0.js → index-Dfj4noku.js} +1 -1
  197. package/dist/esm/{index-CpcvWGPL.js → index-Dki_0kla.js} +60 -60
  198. package/dist/esm/index.js +2 -2
  199. package/dist/esm/lido-avatar_22.entry.js +33 -33
  200. package/dist/esm/lido-player.js +2 -2
  201. package/dist/esm/loader.js +2 -2
  202. package/dist/lido-player/index.esm.js +1 -1
  203. package/dist/lido-player/lido-avatar.css +4 -4
  204. package/dist/lido-player/lido-avatar.tsx +207 -207
  205. package/dist/lido-player/lido-player.css +7 -7
  206. package/dist/lido-player/lido-player.esm.js +1 -1
  207. package/dist/lido-player/{p-db425c95.entry.js → p-476aaf0e.entry.js} +2 -2
  208. package/dist/lido-player/{p-CuR9-3Sm.js → p-BZv5PD3F.js} +1 -1
  209. package/dist/lido-player/p-Dfj4noku.js +2 -0
  210. package/dist/lido-player/{p-B1uwYUL1.js → p-pxe3GMFr.js} +1 -1
  211. package/dist/lido-player/readme.md +49 -49
  212. package/dist/types/types/json.d.ts +3 -3
  213. package/package.json +73 -73
  214. package/readme.md +113 -113
  215. package/dist/components/p-BJ4H1UxZ.js +0 -1
  216. package/dist/components/p-D-B1groh.js +0 -1
  217. package/dist/components/p-Dy_6oCxD.js +0 -1
  218. package/dist/components/p-leIEepjl.js +0 -1
  219. package/dist/lido-player/p-Dq-Z8Dx0.js +0 -2
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-Dy19zuTX.js');
3
+ var index = require('./index-CS8kGcZo.js');
4
4
 
5
5
  const defineCustomElements = async (win, options) => {
6
6
  if (typeof window === 'undefined') return undefined;
@@ -1,4 +1,4 @@
1
- .lido-canvas {
2
- height: 100%;
3
- width: 100%;
4
- }
1
+ .lido-canvas {
2
+ height: 100%;
3
+ width: 100%;
4
+ }
@@ -138,7 +138,7 @@ export class LidoAvatar {
138
138
  display: this.visible ? 'flex' : 'none',
139
139
  zIndex: this.z,
140
140
  };
141
- return (h(Host, { key: '14599bbd626e766d35b9611f80dd401ee76717b4', 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, src: this.src }, h("canvas", { key: '6f128e61bee6797c0cf83c15b3fd3ba4d1d7b1ea', class: "lido-canvas" })));
141
+ return (h(Host, { key: 'bb967cb7f353a454adce62c2bb18590f47697110', 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, src: this.src }, h("canvas", { key: '09824386b4f1c3622111abc86d66ddedb5980bc6', class: "lido-canvas" })));
142
142
  }
143
143
  static get is() { return "lido-avatar"; }
144
144
  static get originalStyleUrls() {
@@ -1,207 +1,207 @@
1
- import { Component, Host, h, Prop, Element } from '@stencil/core';
2
- import { Rive, RuntimeLoader } from '@rive-app/canvas';
3
- import { RiveService } from '../../utils/rive-service';
4
- import { convertUrlToRelative, initEventsForElement, setVisibilityWithDelay} from '../../utils/utils';
5
-
6
- /**
7
- * @component LidoAvatar
8
- *
9
- * The `LidoAvatar` component is a customizable avatar that integrates with Rive animations.
10
- * It allows for configurable properties such as size, position, visibility, background color,
11
- * and event handlers. The component supports accessibility attributes and can trigger various
12
- * events based on user interactions.
13
- *
14
- * This component initializes and manages a Rive animation inside a canvas element.
15
- */
16
-
17
- @Component({
18
- tag: 'lido-avatar',
19
- styleUrl: 'lido-avatar.css',
20
- shadow: false,
21
- assetsDirs: ['.'],
22
- })
23
- export class LidoAvatar {
24
- private static readonly RIVE_WASM_URL = 'https://unpkg.com/@rive-app/canvas@2.32.0/rive.wasm';
25
-
26
- /**
27
- * The unique identifier for the column component.
28
- */
29
- @Prop() id: string = '';
30
-
31
- /**
32
- * The value associated with the column component. Typically used for internal logic.
33
- */
34
- @Prop() value: string = '';
35
-
36
- /**
37
- * The height of the column component (CSS value, e.g., '100px', '50%').
38
- */
39
- @Prop() height: string = '';
40
-
41
- /**
42
- * The width of the column component (CSS value, e.g., '100px', '50%').
43
- */
44
- @Prop() width: string = 'auto';
45
-
46
- /**
47
- * The ARIA label of the container. Used for accessibility to indicate the purpose of the element.
48
- */
49
- @Prop() ariaLabel: string = '';
50
-
51
- /**
52
- * The ARIA hidden attribute of the container. Used for accessibility to hide the element.
53
- */
54
- @Prop() ariaHidden: string = '';
55
-
56
- /**
57
- * The x-coordinate (left position) of the column within its container (CSS value, e.g., '10px', '5vw').
58
- */
59
- @Prop() x: string = '0px';
60
-
61
- /**
62
- * The y-coordinate (top position) of the column within its container (CSS value, e.g., '10px', '5vh').
63
- */
64
- @Prop() y: string = '0px';
65
-
66
- /**
67
- * The z-index of the column to control stacking order.
68
- */
69
- @Prop() z: string = '0';
70
-
71
- /**
72
- * The background color of the column (CSS color value, e.g., '#FFFFFF', 'blue').
73
- */
74
- @Prop() bgColor: string = '';
75
-
76
- /**
77
- * Defines the type of the column, which can be used for styling or specific logic handling.
78
- */
79
- @Prop() type: string = '';
80
-
81
- /**
82
- * The tab index value, used to set the tab order of the column for keyboard navigation.
83
- */
84
- @Prop() tabIndex: number = 0;
85
-
86
- /**
87
- * A boolean that controls whether the column is visible (`true`) or hidden (`false`).
88
- */
89
- @Prop() visible: boolean = false;
90
-
91
- /**
92
- * Audio file URL or identifier for sound that will be associated with the column.
93
- */
94
- @Prop() audio: string = '';
95
-
96
- /**
97
- * Instance of the Rive animation
98
- */
99
- private riveInstance: any;
100
-
101
- /**
102
- * Source URL of the Rive (.riv) file
103
- */
104
- @Prop() src: string = '';
105
-
106
- /**
107
- * Event handler for a touch event, where a custom function can be triggered when the column is touched.
108
- */
109
- @Prop() onTouch: string = '';
110
-
111
- /**
112
- * Event handler for an Incorrect matching action, which can be used to trigger custom logic when the action is incorrect.
113
- */
114
- @Prop() onInCorrect: string = '';
115
-
116
- /**
117
- * Event handler for a Correct matching action, which can be used to hide the column or trigger other custom logic.
118
- */
119
- @Prop() onCorrect: string = '';
120
-
121
-
122
- /**
123
- * Event handler for when the column is entered, which can be used to initiate specific behaviors on entry.
124
- */
125
- @Prop() onEntry: string = '';
126
-
127
- /**
128
- * Reference to the HTML element that represents this component.
129
- */
130
- @Element() el: HTMLElement;
131
-
132
- /**
133
- * Delay in milliseconds to make the cell visible after mount.
134
- */
135
- @Prop() delayVisible: string = '';
136
-
137
- /**
138
- * This lifecycle hook is called after the component is rendered in the DOM.
139
- * It initializes events for the column based on the provided type.
140
- */
141
- async componentDidLoad() {
142
- RuntimeLoader.setWasmUrl(LidoAvatar.RIVE_WASM_URL);
143
-
144
- setVisibilityWithDelay(this.el, this.delayVisible);
145
-
146
- initEventsForElement(this.el, this.type);
147
-
148
- // const resolvedPath = this.src.startsWith('http')
149
- // ? this.src // Use the provided URL if it's an HTTP/HTTPS link
150
- // : getAssetPath(this.src); // Otherwise, resolve it as an asset path
151
-
152
- this.initializeRive(convertUrlToRelative(this.src));
153
- }
154
-
155
- /**
156
- * Initializes the Rive animation instance after the component is rendered.
157
- * It selects the canvas element, loads the Rive file, and starts the animation.
158
- * The animation surface is resized to fit the canvas, and the instance is stored in the service.
159
- */
160
- initializeRive = rivSrc => {
161
- const riveService = RiveService.getInstance();
162
- const canvas = this.el.querySelector('canvas');
163
- this.riveInstance = new Rive({
164
- src: rivSrc,
165
- canvas: canvas,
166
- stateMachines: 'Idle',
167
- autoplay: true,
168
- onLoad: () => {
169
- this.riveInstance.resizeDrawingSurfaceToCanvas();
170
- riveService.setRiveInstance(this.riveInstance);
171
- },
172
- });
173
- };
174
-
175
- render() {
176
- // Inline styles applied to the column, mainly for positioning and background.
177
- const style = {
178
- height: this.height,
179
- width: this.width,
180
- backgroundColor: this.bgColor,
181
- top: this.y,
182
- left: this.x,
183
- display: this.visible ? 'flex' : 'none',
184
- zIndex: this.z,
185
- };
186
-
187
- return (
188
- <Host
189
- id={this.id}
190
- type={this.type}
191
- tab-index={this.tabIndex}
192
- value={this.value}
193
- style={style}
194
- aria-label={this.ariaLabel}
195
- aria-hidden={this.ariaHidden}
196
- audio={this.audio}
197
- onTouch={this.onTouch}
198
- onCorrect={this.onCorrect}
199
- onInCorrect={this.onInCorrect}
200
- onEntry={this.onEntry}
201
- src={this.src}
202
- >
203
- <canvas class="lido-canvas"></canvas>
204
- </Host>
205
- );
206
- }
207
- }
1
+ import { Component, Host, h, Prop, Element } from '@stencil/core';
2
+ import { Rive, RuntimeLoader } from '@rive-app/canvas';
3
+ import { RiveService } from '../../utils/rive-service';
4
+ import { convertUrlToRelative, initEventsForElement, setVisibilityWithDelay} from '../../utils/utils';
5
+
6
+ /**
7
+ * @component LidoAvatar
8
+ *
9
+ * The `LidoAvatar` component is a customizable avatar that integrates with Rive animations.
10
+ * It allows for configurable properties such as size, position, visibility, background color,
11
+ * and event handlers. The component supports accessibility attributes and can trigger various
12
+ * events based on user interactions.
13
+ *
14
+ * This component initializes and manages a Rive animation inside a canvas element.
15
+ */
16
+
17
+ @Component({
18
+ tag: 'lido-avatar',
19
+ styleUrl: 'lido-avatar.css',
20
+ shadow: false,
21
+ assetsDirs: ['.'],
22
+ })
23
+ export class LidoAvatar {
24
+ private static readonly RIVE_WASM_URL = 'https://unpkg.com/@rive-app/canvas@2.32.0/rive.wasm';
25
+
26
+ /**
27
+ * The unique identifier for the column component.
28
+ */
29
+ @Prop() id: string = '';
30
+
31
+ /**
32
+ * The value associated with the column component. Typically used for internal logic.
33
+ */
34
+ @Prop() value: string = '';
35
+
36
+ /**
37
+ * The height of the column component (CSS value, e.g., '100px', '50%').
38
+ */
39
+ @Prop() height: string = '';
40
+
41
+ /**
42
+ * The width of the column component (CSS value, e.g., '100px', '50%').
43
+ */
44
+ @Prop() width: string = 'auto';
45
+
46
+ /**
47
+ * The ARIA label of the container. Used for accessibility to indicate the purpose of the element.
48
+ */
49
+ @Prop() ariaLabel: string = '';
50
+
51
+ /**
52
+ * The ARIA hidden attribute of the container. Used for accessibility to hide the element.
53
+ */
54
+ @Prop() ariaHidden: string = '';
55
+
56
+ /**
57
+ * The x-coordinate (left position) of the column within its container (CSS value, e.g., '10px', '5vw').
58
+ */
59
+ @Prop() x: string = '0px';
60
+
61
+ /**
62
+ * The y-coordinate (top position) of the column within its container (CSS value, e.g., '10px', '5vh').
63
+ */
64
+ @Prop() y: string = '0px';
65
+
66
+ /**
67
+ * The z-index of the column to control stacking order.
68
+ */
69
+ @Prop() z: string = '0';
70
+
71
+ /**
72
+ * The background color of the column (CSS color value, e.g., '#FFFFFF', 'blue').
73
+ */
74
+ @Prop() bgColor: string = '';
75
+
76
+ /**
77
+ * Defines the type of the column, which can be used for styling or specific logic handling.
78
+ */
79
+ @Prop() type: string = '';
80
+
81
+ /**
82
+ * The tab index value, used to set the tab order of the column for keyboard navigation.
83
+ */
84
+ @Prop() tabIndex: number = 0;
85
+
86
+ /**
87
+ * A boolean that controls whether the column is visible (`true`) or hidden (`false`).
88
+ */
89
+ @Prop() visible: boolean = false;
90
+
91
+ /**
92
+ * Audio file URL or identifier for sound that will be associated with the column.
93
+ */
94
+ @Prop() audio: string = '';
95
+
96
+ /**
97
+ * Instance of the Rive animation
98
+ */
99
+ private riveInstance: any;
100
+
101
+ /**
102
+ * Source URL of the Rive (.riv) file
103
+ */
104
+ @Prop() src: string = '';
105
+
106
+ /**
107
+ * Event handler for a touch event, where a custom function can be triggered when the column is touched.
108
+ */
109
+ @Prop() onTouch: string = '';
110
+
111
+ /**
112
+ * Event handler for an Incorrect matching action, which can be used to trigger custom logic when the action is incorrect.
113
+ */
114
+ @Prop() onInCorrect: string = '';
115
+
116
+ /**
117
+ * Event handler for a Correct matching action, which can be used to hide the column or trigger other custom logic.
118
+ */
119
+ @Prop() onCorrect: string = '';
120
+
121
+
122
+ /**
123
+ * Event handler for when the column is entered, which can be used to initiate specific behaviors on entry.
124
+ */
125
+ @Prop() onEntry: string = '';
126
+
127
+ /**
128
+ * Reference to the HTML element that represents this component.
129
+ */
130
+ @Element() el: HTMLElement;
131
+
132
+ /**
133
+ * Delay in milliseconds to make the cell visible after mount.
134
+ */
135
+ @Prop() delayVisible: string = '';
136
+
137
+ /**
138
+ * This lifecycle hook is called after the component is rendered in the DOM.
139
+ * It initializes events for the column based on the provided type.
140
+ */
141
+ async componentDidLoad() {
142
+ RuntimeLoader.setWasmUrl(LidoAvatar.RIVE_WASM_URL);
143
+
144
+ setVisibilityWithDelay(this.el, this.delayVisible);
145
+
146
+ initEventsForElement(this.el, this.type);
147
+
148
+ // const resolvedPath = this.src.startsWith('http')
149
+ // ? this.src // Use the provided URL if it's an HTTP/HTTPS link
150
+ // : getAssetPath(this.src); // Otherwise, resolve it as an asset path
151
+
152
+ this.initializeRive(convertUrlToRelative(this.src));
153
+ }
154
+
155
+ /**
156
+ * Initializes the Rive animation instance after the component is rendered.
157
+ * It selects the canvas element, loads the Rive file, and starts the animation.
158
+ * The animation surface is resized to fit the canvas, and the instance is stored in the service.
159
+ */
160
+ initializeRive = rivSrc => {
161
+ const riveService = RiveService.getInstance();
162
+ const canvas = this.el.querySelector('canvas');
163
+ this.riveInstance = new Rive({
164
+ src: rivSrc,
165
+ canvas: canvas,
166
+ stateMachines: 'Idle',
167
+ autoplay: true,
168
+ onLoad: () => {
169
+ this.riveInstance.resizeDrawingSurfaceToCanvas();
170
+ riveService.setRiveInstance(this.riveInstance);
171
+ },
172
+ });
173
+ };
174
+
175
+ render() {
176
+ // Inline styles applied to the column, mainly for positioning and background.
177
+ const style = {
178
+ height: this.height,
179
+ width: this.width,
180
+ backgroundColor: this.bgColor,
181
+ top: this.y,
182
+ left: this.x,
183
+ display: this.visible ? 'flex' : 'none',
184
+ zIndex: this.z,
185
+ };
186
+
187
+ return (
188
+ <Host
189
+ id={this.id}
190
+ type={this.type}
191
+ tab-index={this.tabIndex}
192
+ value={this.value}
193
+ style={style}
194
+ aria-label={this.ariaLabel}
195
+ aria-hidden={this.ariaHidden}
196
+ audio={this.audio}
197
+ onTouch={this.onTouch}
198
+ onCorrect={this.onCorrect}
199
+ onInCorrect={this.onInCorrect}
200
+ onEntry={this.onEntry}
201
+ src={this.src}
202
+ >
203
+ <canvas class="lido-canvas"></canvas>
204
+ </Host>
205
+ );
206
+ }
207
+ }
@@ -1,49 +1,49 @@
1
- # lido-avatar
2
-
3
-
4
-
5
- <!-- Auto Generated Below -->
6
-
7
-
8
- ## Properties
9
-
10
- | Property | Attribute | Description | Type | Default |
11
- | -------------- | --------------- | ----------------------------------------------------------------------------------------------------------------------- | --------- | -------- |
12
- | `ariaHidden` | `aria-hidden` | The ARIA hidden attribute of the container. Used for accessibility to hide the element. | `string` | `''` |
13
- | `ariaLabel` | `aria-label` | The ARIA label of the container. Used for accessibility to indicate the purpose of the element. | `string` | `''` |
14
- | `audio` | `audio` | Audio file URL or identifier for sound that will be associated with the column. | `string` | `''` |
15
- | `bgColor` | `bg-color` | The background color of the column (CSS color value, e.g., '#FFFFFF', 'blue'). | `string` | `''` |
16
- | `delayVisible` | `delay-visible` | Delay in milliseconds to make the cell visible after mount. | `string` | `''` |
17
- | `height` | `height` | The height of the column component (CSS value, e.g., '100px', '50%'). | `string` | `''` |
18
- | `id` | `id` | The unique identifier for the column component. | `string` | `''` |
19
- | `onCorrect` | `on-correct` | Event handler for a Correct matching action, which can be used to hide the column or trigger other custom logic. | `string` | `''` |
20
- | `onEntry` | `on-entry` | Event handler for when the column is entered, which can be used to initiate specific behaviors on entry. | `string` | `''` |
21
- | `onInCorrect` | `on-in-correct` | Event handler for an Incorrect matching action, which can be used to trigger custom logic when the action is incorrect. | `string` | `''` |
22
- | `onTouch` | `on-touch` | Event handler for a touch event, where a custom function can be triggered when the column is touched. | `string` | `''` |
23
- | `src` | `src` | Source URL of the Rive (.riv) file | `string` | `''` |
24
- | `tabIndex` | `tab-index` | The tab index value, used to set the tab order of the column for keyboard navigation. | `number` | `0` |
25
- | `type` | `type` | Defines the type of the column, which can be used for styling or specific logic handling. | `string` | `''` |
26
- | `value` | `value` | The value associated with the column component. Typically used for internal logic. | `string` | `''` |
27
- | `visible` | `visible` | A boolean that controls whether the column is visible (`true`) or hidden (`false`). | `boolean` | `false` |
28
- | `width` | `width` | The width of the column component (CSS value, e.g., '100px', '50%'). | `string` | `'auto'` |
29
- | `x` | `x` | The x-coordinate (left position) of the column within its container (CSS value, e.g., '10px', '5vw'). | `string` | `'0px'` |
30
- | `y` | `y` | The y-coordinate (top position) of the column within its container (CSS value, e.g., '10px', '5vh'). | `string` | `'0px'` |
31
- | `z` | `z` | The z-index of the column to control stacking order. | `string` | `'0'` |
32
-
33
-
34
- ## Dependencies
35
-
36
- ### Used by
37
-
38
- - [lido-home](../home)
39
-
40
- ### Graph
41
- ```mermaid
42
- graph TD;
43
- lido-home --> lido-avatar
44
- style lido-avatar fill:#f9f,stroke:#333,stroke-width:4px
45
- ```
46
-
47
- ----------------------------------------------
48
-
49
- *Built with [StencilJS](https://stenciljs.com/)*
1
+ # lido-avatar
2
+
3
+
4
+
5
+ <!-- Auto Generated Below -->
6
+
7
+
8
+ ## Properties
9
+
10
+ | Property | Attribute | Description | Type | Default |
11
+ | -------------- | --------------- | ----------------------------------------------------------------------------------------------------------------------- | --------- | -------- |
12
+ | `ariaHidden` | `aria-hidden` | The ARIA hidden attribute of the container. Used for accessibility to hide the element. | `string` | `''` |
13
+ | `ariaLabel` | `aria-label` | The ARIA label of the container. Used for accessibility to indicate the purpose of the element. | `string` | `''` |
14
+ | `audio` | `audio` | Audio file URL or identifier for sound that will be associated with the column. | `string` | `''` |
15
+ | `bgColor` | `bg-color` | The background color of the column (CSS color value, e.g., '#FFFFFF', 'blue'). | `string` | `''` |
16
+ | `delayVisible` | `delay-visible` | Delay in milliseconds to make the cell visible after mount. | `string` | `''` |
17
+ | `height` | `height` | The height of the column component (CSS value, e.g., '100px', '50%'). | `string` | `''` |
18
+ | `id` | `id` | The unique identifier for the column component. | `string` | `''` |
19
+ | `onCorrect` | `on-correct` | Event handler for a Correct matching action, which can be used to hide the column or trigger other custom logic. | `string` | `''` |
20
+ | `onEntry` | `on-entry` | Event handler for when the column is entered, which can be used to initiate specific behaviors on entry. | `string` | `''` |
21
+ | `onInCorrect` | `on-in-correct` | Event handler for an Incorrect matching action, which can be used to trigger custom logic when the action is incorrect. | `string` | `''` |
22
+ | `onTouch` | `on-touch` | Event handler for a touch event, where a custom function can be triggered when the column is touched. | `string` | `''` |
23
+ | `src` | `src` | Source URL of the Rive (.riv) file | `string` | `''` |
24
+ | `tabIndex` | `tab-index` | The tab index value, used to set the tab order of the column for keyboard navigation. | `number` | `0` |
25
+ | `type` | `type` | Defines the type of the column, which can be used for styling or specific logic handling. | `string` | `''` |
26
+ | `value` | `value` | The value associated with the column component. Typically used for internal logic. | `string` | `''` |
27
+ | `visible` | `visible` | A boolean that controls whether the column is visible (`true`) or hidden (`false`). | `boolean` | `false` |
28
+ | `width` | `width` | The width of the column component (CSS value, e.g., '100px', '50%'). | `string` | `'auto'` |
29
+ | `x` | `x` | The x-coordinate (left position) of the column within its container (CSS value, e.g., '10px', '5vw'). | `string` | `'0px'` |
30
+ | `y` | `y` | The y-coordinate (top position) of the column within its container (CSS value, e.g., '10px', '5vh'). | `string` | `'0px'` |
31
+ | `z` | `z` | The z-index of the column to control stacking order. | `string` | `'0'` |
32
+
33
+
34
+ ## Dependencies
35
+
36
+ ### Used by
37
+
38
+ - [lido-home](../home)
39
+
40
+ ### Graph
41
+ ```mermaid
42
+ graph TD;
43
+ lido-home --> lido-avatar
44
+ style lido-avatar fill:#f9f,stroke:#333,stroke-width:4px
45
+ ```
46
+
47
+ ----------------------------------------------
48
+
49
+ *Built with [StencilJS](https://stenciljs.com/)*