lido-player 0.0.2-alpha-57-dev → 0.0.2-alpha-59-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/lido-avatar_22.cjs.entry.js +94 -34
- package/dist/cjs/lido-player.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{utils-a61cfc6b.js → utils-03573882.js} +160 -124
- package/dist/collection/components/container/lido-container.js +60 -3
- package/dist/collection/components/flashCard/lido-flash-card.js +10 -1
- package/dist/collection/components/float/lido-float.js +1 -1
- package/dist/collection/components/home/lido-home.js +22 -12
- package/dist/collection/components/keyboard/lido-keyboard.js +2 -2
- package/dist/collection/components/mathMatrix/lido-math-matrix.js +1 -1
- package/dist/collection/components/position/lido-pos.js +1 -1
- package/dist/collection/components/random/lido-random.js +1 -1
- package/dist/collection/components/row/lido-row.js +1 -1
- package/dist/collection/components/scale/lido-balance.js +1 -1
- package/dist/collection/components/shape/lido-shape.js +2 -2
- package/dist/collection/components/slideFill/lido-slide-fill.js +1 -1
- package/dist/collection/components/text/lido-text.js +1 -1
- package/dist/collection/components/trace/lido-trace.js +18 -7
- package/dist/collection/components/wrap/lido-wrap.js +1 -1
- package/dist/collection/css/animation.css +17 -0
- package/dist/collection/css/index.css +1 -1
- package/dist/collection/stories/Templates/LetterPairing/LetterPairing.stories.js +3 -3
- package/dist/collection/stories/Templates/balancing/balancing.stories.js +1 -1
- package/dist/collection/stories/Templates/matchBox/matchBox2.stories.js +74 -44
- package/dist/collection/stories/Templates/matchingCard/matching-card.stories.js +4 -4
- package/dist/collection/stories/Templates/numberBoardTwo/numberBoardTwo.stories.js +2 -2
- package/dist/collection/stories/Templates/numberIdentification/numberIdentificationimageTotext.stories.js +91 -0
- package/dist/collection/stories/Templates/numberIdentification/numberIdentificationtextTotext.stories.js +84 -0
- package/dist/collection/stories/Templates/openwindow/openwindow.stories.js +0 -2
- package/dist/collection/stories/Templates/openwindow/openwindow2.stories.js +0 -2
- package/dist/collection/stories/Templates/order-tractor/order-tractor-ascending-order.stories.js +6 -5
- package/dist/collection/stories/Templates/order-tractor/order-tractor.stories.js +6 -6
- package/dist/collection/stories/Templates/palEgmaCalculateSum/palEgmaMultiOption.stories.js +106 -0
- package/dist/collection/stories/Templates/palEgmaCalculateSum/palEgmaSumTogether.stories.js +91 -0
- package/dist/collection/stories/Templates/palEgmaPatternMatching/palEgmaPatternMatching.stories.js +86 -0
- package/dist/collection/stories/Templates/palEgmaWordProblem/palEgmaWordProblem.stories.js +131 -0
- package/dist/collection/stories/Templates/palEgraInventedSpelling/pal_egra_invented_spelling_schema.stories.js +61 -0
- package/dist/collection/stories/Templates/palEgraMCQWithImage/palEgraMCQWithImage.stories.js +87 -0
- package/dist/collection/stories/Templates/palEgraStoryMaking/pal_egra_story_making.stories.js +72 -0
- package/dist/collection/stories/Templates/palEgraTemplate1/palEgraLetterIdentification.stories.js +61 -0
- package/dist/collection/stories/Templates/palEgra_OddOneOut/palEgra_oddOneOut.stories.js +60 -0
- package/dist/collection/stories/Templates/palEgra_word_formation/palEgra_WordFormation.stories.js +73 -0
- package/dist/collection/stories/Templates/pictureClues/pictureClues.stories.js +88 -0
- package/dist/collection/stories/Templates/pictureWordMatch/pictureWordMatch1.stories.js +88 -0
- package/dist/collection/stories/Templates/pictureWordMatch/pictureWordMatch2.stories.js +66 -0
- package/dist/collection/stories/Templates/picturemeaning/pictureMeaningCocos.stories.js +1 -1
- package/dist/collection/stories/Templates/quizMaths/quizMaths.stories.js +7 -7
- package/dist/collection/stories/Templates/rowBlocks/rowBlocks.stories.js +1 -1
- package/dist/collection/stories/Templates/sequenceBox/sequenceBox1.stories.js +16 -13
- package/dist/collection/stories/Templates/sequenceBox/sequenceBox2.stories.js +17 -14
- package/dist/collection/stories/Templates/substraction/substractionWithimg.stories.js +111 -0
- package/dist/collection/stories/Templates/substraction/substractionWithoutImg.stories.js +70 -0
- package/dist/collection/stories/Templates/sumTogether/sumTogether.stories.js +11 -10
- package/dist/collection/stories/Templates/total/total.stories.js +2 -0
- package/dist/collection/stories/Templates/wordBuilding/wordBuildingwithimg.stories.js +76 -0
- package/dist/collection/stories/Templates/wordBuilding/wordBuildingwithoutimg.stories.js +74 -0
- package/dist/collection/stories/Templates/writeSet/writeSet.stories.js +1 -1
- package/dist/collection/utils/constants.js +2 -1
- package/dist/collection/utils/utils.js +29 -20
- package/dist/collection/utils/utilsHandlers/clickHandler.js +2 -0
- package/dist/collection/utils/utilsHandlers/dragDropHandler.js +24 -20
- package/dist/collection/utils/utilsHandlers/highlightHandler.js +50 -2
- package/dist/collection/utils/utilsHandlers/lidoBalanceHandler.js +5 -4
- package/dist/components/index.js +1 -1
- package/dist/components/lido-avatar.js +1 -1
- package/dist/components/lido-balance.js +1 -1
- package/dist/components/lido-calculator.js +1 -1
- package/dist/components/lido-canvas.js +1 -1
- package/dist/components/lido-cell.js +1 -1
- package/dist/components/lido-col.js +1 -1
- package/dist/components/lido-container.js +1 -1
- package/dist/components/lido-flash-card.js +1 -1
- package/dist/components/lido-float.js +1 -1
- package/dist/components/lido-home.js +1 -1
- package/dist/components/lido-image.js +1 -1
- package/dist/components/lido-keyboard.js +1 -1
- package/dist/components/lido-math-matrix.js +1 -1
- package/dist/components/lido-pos.js +1 -1
- package/dist/components/lido-random.js +1 -1
- package/dist/components/lido-root.js +22 -23
- package/dist/components/lido-row.js +1 -1
- package/dist/components/lido-shape.js +1 -1
- package/dist/components/lido-slide-fill.js +1 -1
- package/dist/components/lido-text.js +1 -1
- package/dist/components/lido-trace.js +1 -1
- package/dist/components/lido-wrap.js +1 -1
- package/dist/components/{p-73e3f0f4.js → p-2bb1f74d.js} +203 -1
- package/dist/components/{p-f3bc4577.js → p-33b83222.js} +1 -1
- package/dist/components/{p-0712a27e.js → p-3513b1f3.js} +159 -125
- package/dist/components/{p-f2b53e8e.js → p-356e56bd.js} +2 -2
- package/dist/components/{p-b9875116.js → p-49ccf573.js} +18 -7
- package/dist/components/{p-330caab8.js → p-4d9462ab.js} +4 -4
- package/dist/components/{p-4d332eab.js → p-5aa24314.js} +2 -2
- package/dist/components/{p-d1b5079b.js → p-5c990168.js} +45 -6
- package/dist/components/{p-21852d55.js → p-5eeaccab.js} +2 -2
- package/dist/components/{p-480f708a.js → p-6819005f.js} +11 -2
- package/dist/components/{p-ffc40642.js → p-6bbad90f.js} +2 -2
- package/dist/components/{p-e1ba0c44.js → p-73e4bb01.js} +41 -33
- package/dist/components/{p-ff801ba1.js → p-84302365.js} +1 -1
- package/dist/components/{p-0a41b2f8.js → p-99fcbae4.js} +1 -1
- package/dist/components/{p-9104d427.js → p-9b35082a.js} +2 -2
- package/dist/components/{p-882b291d.js → p-ad0f335e.js} +2 -2
- package/dist/components/{p-c4739621.js → p-aff68c41.js} +3 -3
- package/dist/components/{p-2829c82c.js → p-d9b17242.js} +2 -2
- package/dist/components/{p-cca36777.js → p-de62d08e.js} +3 -3
- package/dist/components/{p-4e041807.js → p-e8e9250e.js} +2 -2
- package/dist/components/{p-17f84b2f.js → p-f238004e.js} +2 -2
- package/dist/components/{p-eab0ebb7.js → p-f9426cbe.js} +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/lido-avatar_22.entry.js +94 -34
- package/dist/esm/lido-player.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{utils-7ed76799.js → utils-3995d2d5.js} +159 -125
- package/dist/lido-player/index.esm.js +1 -1
- package/dist/lido-player/lido-player.css +1 -1
- package/dist/lido-player/lido-player.esm.js +1 -1
- package/dist/lido-player/p-75daccb0.entry.js +1 -0
- package/dist/lido-player/{p-17d93181.js → p-aee89fba.js} +2 -2
- package/dist/types/components/container/lido-container.d.ts +15 -2
- package/dist/types/components/trace/lido-trace.d.ts +3 -3
- package/dist/types/components.d.ts +10 -2
- package/dist/types/stories/Templates/numberIdentification/numberIdentificationimageTotext.stories.d.ts +4 -0
- package/dist/types/stories/Templates/numberIdentification/numberIdentificationtextTotext.stories.d.ts +4 -0
- package/dist/types/stories/Templates/palEgmaCalculateSum/palEgmaMultiOption.stories.d.ts +11 -0
- package/dist/types/stories/Templates/palEgmaCalculateSum/palEgmaSumTogether.stories.d.ts +12 -0
- package/dist/types/stories/Templates/palEgmaPatternMatching/palEgmaPatternMatching.stories.d.ts +4 -0
- package/dist/types/stories/Templates/palEgmaWordProblem/palEgmaWordProblem.stories.d.ts +5 -0
- package/dist/types/stories/Templates/palEgraInventedSpelling/pal_egra_invented_spelling_schema.stories.d.ts +4 -0
- package/dist/types/stories/Templates/palEgraMCQWithImage/palEgraMCQWithImage.stories.d.ts +4 -0
- package/dist/types/stories/Templates/palEgraStoryMaking/pal_egra_story_making.stories.d.ts +4 -0
- package/dist/types/stories/Templates/palEgraTemplate1/palEgraLetterIdentification.stories.d.ts +4 -0
- package/dist/types/stories/Templates/palEgra_OddOneOut/palEgra_oddOneOut.stories.d.ts +4 -0
- package/dist/types/stories/Templates/palEgra_word_formation/palEgra_WordFormation.stories.d.ts +4 -0
- package/dist/types/stories/Templates/pictureClues/pictureClues.stories.d.ts +4 -0
- package/dist/types/stories/Templates/pictureWordMatch/pictureWordMatch1.stories.d.ts +4 -0
- package/dist/types/stories/Templates/pictureWordMatch/pictureWordMatch2.stories.d.ts +4 -0
- package/dist/types/stories/Templates/substraction/substractionWithimg.stories.d.ts +4 -0
- package/dist/types/stories/Templates/substraction/substractionWithoutImg.stories.d.ts +4 -0
- package/dist/types/stories/Templates/wordBuilding/wordBuildingwithimg.stories.d.ts +4 -0
- package/dist/types/stories/Templates/wordBuilding/wordBuildingwithoutimg.stories.d.ts +4 -0
- package/dist/types/utils/constants.d.ts +9 -1
- package/dist/types/utils/utils.d.ts +1 -0
- package/dist/types/utils/utilsHandlers/highlightHandler.d.ts +1 -0
- package/package.json +1 -1
- package/dist/components/p-7ab0a273.js +0 -204
- package/dist/lido-player/p-fa9dfdf8.entry.js +0 -1
|
@@ -164,11 +164,24 @@ export declare class LidoContainer {
|
|
|
164
164
|
*/
|
|
165
165
|
delayVisible: string;
|
|
166
166
|
/**
|
|
167
|
-
|
|
168
|
-
|
|
167
|
+
* When set to true, disables the speak functionality of long press for this component and all its child components.
|
|
168
|
+
*/
|
|
169
169
|
disableSpeak: boolean;
|
|
170
|
+
/**
|
|
171
|
+
* Identifies the template type used by this component (e.g., mcq, flashcard, tracing, dragAndDrop).
|
|
172
|
+
*/
|
|
173
|
+
templateId: string;
|
|
174
|
+
/**
|
|
175
|
+
* Stores the instruction audio/text key based on the current template.
|
|
176
|
+
*/
|
|
177
|
+
instructName: string;
|
|
178
|
+
/**
|
|
179
|
+
* Indicates whether the speak action is currently active or in progress.
|
|
180
|
+
*/
|
|
181
|
+
speakFlag: boolean;
|
|
170
182
|
languageChanged(newLang: string): void;
|
|
171
183
|
componentWillLoad(): void;
|
|
184
|
+
private resolveInstructionAudio;
|
|
172
185
|
private resolveLanguage;
|
|
173
186
|
convertToPixels(height: string, parentElement?: HTMLElement): number;
|
|
174
187
|
/**
|
|
@@ -22,7 +22,7 @@ export declare class LidoTrace {
|
|
|
22
22
|
/**
|
|
23
23
|
* Array of audio URLs to be played when tracing is completed, separated by semicolons.
|
|
24
24
|
* This allows multiple audio files to be loaded and played in sequence.
|
|
25
|
-
|
|
25
|
+
*/
|
|
26
26
|
audioUrls: string[];
|
|
27
27
|
/**
|
|
28
28
|
* Index of the currently active SVG in the `svgUrls` array.
|
|
@@ -105,8 +105,8 @@ export declare class LidoTrace {
|
|
|
105
105
|
*/
|
|
106
106
|
delayVisible: string;
|
|
107
107
|
/**
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
* When set to true, disables the speak functionality of long press for this component and its children.
|
|
109
|
+
*/
|
|
110
110
|
disableSpeak: boolean;
|
|
111
111
|
el: HTMLElement;
|
|
112
112
|
style: {
|
|
@@ -533,7 +533,7 @@ export namespace Components {
|
|
|
533
533
|
*/
|
|
534
534
|
"delayVisible": string;
|
|
535
535
|
/**
|
|
536
|
-
* When set to true, disables the speak functionality of long press for this component and its
|
|
536
|
+
* When set to true, disables the speak functionality of long press for this component and all its child components.
|
|
537
537
|
*/
|
|
538
538
|
"disableSpeak": boolean;
|
|
539
539
|
/**
|
|
@@ -616,6 +616,10 @@ export namespace Components {
|
|
|
616
616
|
* TabIndex for keyboard navigation.
|
|
617
617
|
*/
|
|
618
618
|
"tabIndex": number;
|
|
619
|
+
/**
|
|
620
|
+
* Identifies the template type used by this component (e.g., mcq, flashcard, tracing, dragAndDrop).
|
|
621
|
+
*/
|
|
622
|
+
"templateId": string;
|
|
619
623
|
/**
|
|
620
624
|
* Type of the container, which can be used for conditional logic or styling purposes.
|
|
621
625
|
*/
|
|
@@ -2863,7 +2867,7 @@ declare namespace LocalJSX {
|
|
|
2863
2867
|
*/
|
|
2864
2868
|
"delayVisible"?: string;
|
|
2865
2869
|
/**
|
|
2866
|
-
* When set to true, disables the speak functionality of long press for this component and its
|
|
2870
|
+
* When set to true, disables the speak functionality of long press for this component and all its child components.
|
|
2867
2871
|
*/
|
|
2868
2872
|
"disableSpeak"?: boolean;
|
|
2869
2873
|
/**
|
|
@@ -2946,6 +2950,10 @@ declare namespace LocalJSX {
|
|
|
2946
2950
|
* TabIndex for keyboard navigation.
|
|
2947
2951
|
*/
|
|
2948
2952
|
"tabIndex"?: number;
|
|
2953
|
+
/**
|
|
2954
|
+
* Identifies the template type used by this component (e.g., mcq, flashcard, tracing, dragAndDrop).
|
|
2955
|
+
*/
|
|
2956
|
+
"templateId"?: string;
|
|
2949
2957
|
/**
|
|
2950
2958
|
* Type of the container, which can be used for conditional logic or styling purposes.
|
|
2951
2959
|
*/
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/web-components';
|
|
2
|
+
type PalEgma2Args = {
|
|
3
|
+
number1: string;
|
|
4
|
+
number2: string;
|
|
5
|
+
options: string[];
|
|
6
|
+
sign?: string;
|
|
7
|
+
isAllowOnlyCorrect?: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare const meta: Meta<PalEgma2Args>;
|
|
10
|
+
export default meta;
|
|
11
|
+
export declare const PalEgmaMultiOption: StoryObj;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/web-components';
|
|
2
|
+
type PalEgma1Args = {
|
|
3
|
+
missingNumber: string;
|
|
4
|
+
number1: string;
|
|
5
|
+
number2: string;
|
|
6
|
+
options: string[];
|
|
7
|
+
sign?: string;
|
|
8
|
+
isAllowOnlyCorrect?: boolean;
|
|
9
|
+
};
|
|
10
|
+
declare const meta: Meta<PalEgma1Args>;
|
|
11
|
+
export default meta;
|
|
12
|
+
export declare const PalEgmaSumTogether: StoryObj;
|
|
@@ -19,6 +19,7 @@ export declare const LidoContainer = "lido-container";
|
|
|
19
19
|
export declare const LangChangeEvent = "languageChanged";
|
|
20
20
|
export declare const LIDO_COMMON_AUDIO_PATH = "__LIDO_COMMON_AUDIO_PATH__";
|
|
21
21
|
export declare const LIDO_COMMON_AUDIO_READY_EVENT = "lidoCommonAudioPathReady";
|
|
22
|
+
export declare const TemplateID = "template-id";
|
|
22
23
|
export declare enum TraceMode {
|
|
23
24
|
NoFlow = "noFlow",
|
|
24
25
|
ShowFlow = "showFlow",
|
|
@@ -45,5 +46,12 @@ export declare enum DropAction {
|
|
|
45
46
|
export declare const exitUrl = "https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/Navbar-buttons/Close.svg";
|
|
46
47
|
export declare const prevUrl = "https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/Navbar-buttons/Previous.svg";
|
|
47
48
|
export declare const nextUrl = "https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/Navbar-buttons/Next.svg";
|
|
48
|
-
export declare const speakUrl = "https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/Navbar-buttons/
|
|
49
|
+
export declare const speakUrl = "https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/Navbar-buttons/audio.png";
|
|
49
50
|
export declare const fingerUrl = "https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/trace/Tracing-hand.svg";
|
|
51
|
+
export declare const enum templateAudio {
|
|
52
|
+
dragAndDrop = "Match the items by dragging and dropping them into the correct places.",
|
|
53
|
+
mcq = "Select the correct answer from the options provided.",
|
|
54
|
+
tracing = "Trace the shape by following the outline carefully.",
|
|
55
|
+
flashcards = "Review the flashcards to reinforce your learning.",
|
|
56
|
+
hello = "hello"
|
|
57
|
+
}
|
|
@@ -5,6 +5,7 @@ export declare const initEventsForElement: (element: HTMLElement, type?: string)
|
|
|
5
5
|
export declare const executeActions: (actionsString: string, thisElement: HTMLElement, element?: HTMLElement) => Promise<void>;
|
|
6
6
|
export declare const matchStringPattern: (pattern: string, arr: string[]) => boolean;
|
|
7
7
|
export declare const countPatternWords: (pattern: string) => number;
|
|
8
|
+
export declare let countOfMistakes: number;
|
|
8
9
|
export declare const storingEachActivityScore: (flag: boolean) => void;
|
|
9
10
|
export declare const calculateScore: () => void;
|
|
10
11
|
export declare function onActivityComplete(dragElement?: HTMLElement, dropElement?: HTMLElement): Promise<void>;
|
|
@@ -2,3 +2,4 @@ export declare function showWrongAnswerAnimation(elements: HTMLElement[]): void;
|
|
|
2
2
|
export declare function removeHighlight(element: HTMLElement): void;
|
|
3
3
|
export declare function highlightSpeakingElement(element: HTMLElement): void;
|
|
4
4
|
export declare function stopHighlightForSpeakingElement(element: HTMLElement): void;
|
|
5
|
+
export declare function highlightElement(): void;
|
package/package.json
CHANGED
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
import { p as proxyCustomElement, H, d as setVisibilityWithDelay, i as initEventsForElement, t as attachSpeakIcon, L as LIDO_COMMON_AUDIO_READY_EVENT, e as convertUrlToRelative, k as parseProp, h, j as Host, u as LIDO_COMMON_AUDIO_PATH } from './p-0712a27e.js';
|
|
2
|
-
import { i as instance } from './p-73e3f0f4.js';
|
|
3
|
-
|
|
4
|
-
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 Bhai 2', serif}.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)}}";
|
|
5
|
-
const LidoTextStyle0 = lidoTextCss;
|
|
6
|
-
|
|
7
|
-
const LidoText = /*@__PURE__*/ proxyCustomElement(class LidoText extends H {
|
|
8
|
-
constructor() {
|
|
9
|
-
super();
|
|
10
|
-
this.__registerHost();
|
|
11
|
-
this.showSpeakIcon = false;
|
|
12
|
-
this.id = '';
|
|
13
|
-
this.value = '';
|
|
14
|
-
this.string = '';
|
|
15
|
-
this.fontFamily = '';
|
|
16
|
-
this.fontSize = '20px';
|
|
17
|
-
this.fontColor = '';
|
|
18
|
-
this.highlightWhileSpeaking = false;
|
|
19
|
-
this.height = 'auto';
|
|
20
|
-
this.width = 'auto';
|
|
21
|
-
this.ariaLabel = '';
|
|
22
|
-
this.ariaHidden = '';
|
|
23
|
-
this.x = '0px';
|
|
24
|
-
this.y = '0px';
|
|
25
|
-
this.z = '0';
|
|
26
|
-
this.bgColor = '';
|
|
27
|
-
this.borderImage = '';
|
|
28
|
-
this.type = '';
|
|
29
|
-
this.tabIndex = 0;
|
|
30
|
-
this.visible = false;
|
|
31
|
-
this.audio = '';
|
|
32
|
-
this.onTouch = '';
|
|
33
|
-
this.onInCorrect = '';
|
|
34
|
-
this.onCorrect = '';
|
|
35
|
-
this.minDrops = 1;
|
|
36
|
-
this.maxDrops = 1;
|
|
37
|
-
this.onEntry = '';
|
|
38
|
-
this.margin = '';
|
|
39
|
-
this.padding = '';
|
|
40
|
-
this.borderRadius = '0px';
|
|
41
|
-
this.spanType = '';
|
|
42
|
-
this.style = {};
|
|
43
|
-
this.delayVisible = '';
|
|
44
|
-
this.disableSpeak = false;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Lifecycle hook that runs after the component is rendered in the DOM.
|
|
48
|
-
* It initializes custom events based on the `type` of the text component.
|
|
49
|
-
*/
|
|
50
|
-
componentDidLoad() {
|
|
51
|
-
setVisibilityWithDelay(this.el, this.delayVisible);
|
|
52
|
-
initEventsForElement(this.el, this.type);
|
|
53
|
-
// only create span element if requested
|
|
54
|
-
if (this.spanType === 'words' || this.spanType === 'letters') {
|
|
55
|
-
this.addSpanToText();
|
|
56
|
-
}
|
|
57
|
-
if (this.showSpeakIcon) {
|
|
58
|
-
attachSpeakIcon(this.el);
|
|
59
|
-
}
|
|
60
|
-
if (!this.audio || this.audio.trim() === "") {
|
|
61
|
-
const applyAutoAudio = () => {
|
|
62
|
-
const autoAudio = this.resolveAutoAudio();
|
|
63
|
-
if (autoAudio) {
|
|
64
|
-
this.audio = autoAudio;
|
|
65
|
-
console.log("[LidoText] Auto audio applied:", autoAudio);
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
// If path is already available, apply immediately
|
|
69
|
-
if (window.__LIDO_COMMON_AUDIO_PATH__) {
|
|
70
|
-
applyAutoAudio();
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
// Otherwise, wait for it
|
|
74
|
-
window.addEventListener(LIDO_COMMON_AUDIO_READY_EVENT, applyAutoAudio, { once: true });
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
resolveAutoAudio() {
|
|
79
|
-
const base = window[LIDO_COMMON_AUDIO_PATH];
|
|
80
|
-
if (!base || !this.string)
|
|
81
|
-
return null;
|
|
82
|
-
const fileName = this.string.toLowerCase().trim().replace(/\s+/g, "_").replace(/[^\w-]/g, "");
|
|
83
|
-
return `${base}/${fileName}.mp3`;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Lifecycle method that runs before the component is rendered.
|
|
87
|
-
* Initializes styles and sets up event listeners for resize and load events.
|
|
88
|
-
*/
|
|
89
|
-
componentWillLoad() {
|
|
90
|
-
this.updateStyles();
|
|
91
|
-
window.addEventListener('resize', this.updateStyles.bind(this));
|
|
92
|
-
window.addEventListener('load', this.updateStyles.bind(this));
|
|
93
|
-
}
|
|
94
|
-
disconnectedCallback() {
|
|
95
|
-
window.removeEventListener('resize', this.updateStyles.bind(this));
|
|
96
|
-
window.removeEventListener('load', this.updateStyles.bind(this));
|
|
97
|
-
}
|
|
98
|
-
updateStyles() {
|
|
99
|
-
const borderImg = this.borderImage ? convertUrlToRelative(this.borderImage) : '';
|
|
100
|
-
const orientation = window.innerHeight > window.innerWidth ? 'portrait' : 'landscape';
|
|
101
|
-
this.style = {
|
|
102
|
-
height: parseProp(this.height, orientation),
|
|
103
|
-
width: parseProp(this.width, orientation),
|
|
104
|
-
backgroundColor: parseProp(this.bgColor, orientation),
|
|
105
|
-
top: parseProp(this.y, orientation),
|
|
106
|
-
left: parseProp(this.x, orientation),
|
|
107
|
-
zIndex: this.z,
|
|
108
|
-
fontSize: parseProp(this.fontSize, orientation),
|
|
109
|
-
fontFamily: this.fontFamily,
|
|
110
|
-
color: parseProp(this.fontColor, orientation),
|
|
111
|
-
display: parseProp(`${this.visible}`, orientation) === "true" ? 'flex' : 'none', // Toggle visibility
|
|
112
|
-
borderImage: `url(${borderImg})`,
|
|
113
|
-
borderImageSlice: borderImg ? '0 fill' : '',
|
|
114
|
-
margin: parseProp(this.margin, orientation),
|
|
115
|
-
padding: parseProp(this.padding, orientation),
|
|
116
|
-
borderRadius: parseProp(this.borderRadius, orientation),
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
async addSpanToText() {
|
|
120
|
-
const content = this.el.querySelector('.lido-text-content');
|
|
121
|
-
if (!content)
|
|
122
|
-
return;
|
|
123
|
-
const text = content.textContent || '';
|
|
124
|
-
content.innerHTML = '';
|
|
125
|
-
// Wrap each letters in a span inside .lido-text-content
|
|
126
|
-
if (this.spanType === 'letters') {
|
|
127
|
-
text.split('').forEach((letter, idx) => {
|
|
128
|
-
// Skip spaces
|
|
129
|
-
if (letter.trim() === '')
|
|
130
|
-
return;
|
|
131
|
-
// Create a span for each letter
|
|
132
|
-
const letterSpan = document.createElement('span');
|
|
133
|
-
letterSpan.textContent = letter;
|
|
134
|
-
letterSpan.className = 'text-letters';
|
|
135
|
-
content.appendChild(letterSpan);
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
// Wrap each words in a span inside .lido-text-content
|
|
139
|
-
if (this.spanType === 'words') {
|
|
140
|
-
text.split(' ').forEach((word, idx) => {
|
|
141
|
-
const wordSpan = document.createElement('span');
|
|
142
|
-
wordSpan.textContent = word;
|
|
143
|
-
wordSpan.className = 'text-words';
|
|
144
|
-
content.appendChild(wordSpan);
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
render() {
|
|
149
|
-
return (h(Host, { key: '87d82cc0bf52e1eaba8f44d1bdd80c98e896ddbf', 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, "disable-speak": this.disableSpeak }, this.spanType !== '' ? h("div", { class: "lido-text-content" }, " ", instance.t(this.string)) : instance.t(this.string)));
|
|
150
|
-
}
|
|
151
|
-
get el() { return this; }
|
|
152
|
-
static get style() { return LidoTextStyle0; }
|
|
153
|
-
}, [0, "lido-text", {
|
|
154
|
-
"showSpeakIcon": [4, "show-speak-icon"],
|
|
155
|
-
"id": [1],
|
|
156
|
-
"value": [1],
|
|
157
|
-
"string": [1],
|
|
158
|
-
"fontFamily": [1, "font-family"],
|
|
159
|
-
"fontSize": [1, "font-size"],
|
|
160
|
-
"fontColor": [1, "font-color"],
|
|
161
|
-
"highlightWhileSpeaking": [4, "highlight-while-speaking"],
|
|
162
|
-
"height": [1],
|
|
163
|
-
"width": [1],
|
|
164
|
-
"ariaLabel": [1, "aria-label"],
|
|
165
|
-
"ariaHidden": [1, "aria-hidden"],
|
|
166
|
-
"x": [1],
|
|
167
|
-
"y": [1],
|
|
168
|
-
"z": [1],
|
|
169
|
-
"bgColor": [1, "bg-color"],
|
|
170
|
-
"borderImage": [1, "border-image"],
|
|
171
|
-
"type": [1],
|
|
172
|
-
"tabIndex": [2, "tab-index"],
|
|
173
|
-
"visible": [8],
|
|
174
|
-
"audio": [1],
|
|
175
|
-
"onTouch": [1, "on-touch"],
|
|
176
|
-
"onInCorrect": [1, "on-in-correct"],
|
|
177
|
-
"onCorrect": [1, "on-correct"],
|
|
178
|
-
"minDrops": [2, "min-drops"],
|
|
179
|
-
"maxDrops": [2, "max-drops"],
|
|
180
|
-
"onEntry": [1, "on-entry"],
|
|
181
|
-
"margin": [1],
|
|
182
|
-
"padding": [1],
|
|
183
|
-
"borderRadius": [1, "border-radius"],
|
|
184
|
-
"spanType": [1, "span-type"],
|
|
185
|
-
"delayVisible": [1, "delay-visible"],
|
|
186
|
-
"disableSpeak": [4, "disable-speak"],
|
|
187
|
-
"style": [32]
|
|
188
|
-
}]);
|
|
189
|
-
function defineCustomElement() {
|
|
190
|
-
if (typeof customElements === "undefined") {
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
193
|
-
const components = ["lido-text"];
|
|
194
|
-
components.forEach(tagName => { switch (tagName) {
|
|
195
|
-
case "lido-text":
|
|
196
|
-
if (!customElements.get(tagName)) {
|
|
197
|
-
customElements.define(tagName, LidoText);
|
|
198
|
-
}
|
|
199
|
-
break;
|
|
200
|
-
} });
|
|
201
|
-
}
|
|
202
|
-
defineCustomElement();
|
|
203
|
-
|
|
204
|
-
export { LidoText as L, defineCustomElement as d };
|