Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
{
"version": 3,
"sources": ["../../../src/util/InvisibleMessage.ts"],
"sourcesContent": ["import InvisibleMessageMode from \"../types/InvisibleMessageMode.js\";\nimport getSingletonElementInstance from \"./getSingletonElementInstance.js\";\nimport { attachBoot } from \"../Boot.js\";\n\nlet politeSpan: HTMLElement;\nlet assertiveSpan: HTMLElement;\n\nconst setOutOfViewportStyles = (el: HTMLElement) => {\n\tel.style.position = \"absolute\";\n\tel.style.clip = \"rect(1px,1px,1px,1px)\";\n\tel.style.userSelect = \"none\";\n\tel.style.left = \"-1000px\";\n\tel.style.top = \"-1000px\";\n\tel.style.pointerEvents = \"none\";\n};\n\nattachBoot(() => {\n\tif (politeSpan && assertiveSpan) {\n\t\treturn;\n\t}\n\n\tpoliteSpan = document.createElement(\"span\");\n\tassertiveSpan = document.createElement(\"span\");\n\n\tpoliteSpan.classList.add(\"ui5-invisiblemessage-polite\");\n\tassertiveSpan.classList.add(\"ui5-invisiblemessage-assertive\");\n\n\tpoliteSpan.setAttribute(\"aria-live\", \"polite\");\n\tassertiveSpan.setAttribute(\"aria-live\", \"assertive\");\n\n\tpoliteSpan.setAttribute(\"role\", \"alert\");\n\tassertiveSpan.setAttribute(\"role\", \"alert\");\n\n\tsetOutOfViewportStyles(politeSpan);\n\tsetOutOfViewportStyles(assertiveSpan);\n\n\tgetSingletonElementInstance(\"ui5-announcement-area\").appendChild(politeSpan);\n\tgetSingletonElementInstance(\"ui5-announcement-area\").appendChild(assertiveSpan);\n});\n\n/**\n * Inserts the string into the respective span, depending on the mode provided.\n *\n * @param { string } message String to be announced by the screen reader.\n * @param { InvisibleMessageMode } mode The mode to be inserted in the aria-live attribute.\n * @public\n */\nconst announce = (message: string, mode: InvisibleMessageMode) => {\n\t// If no type is presented, fallback to polite announcement.\n\tconst span = mode === InvisibleMessageMode.Assertive ? assertiveSpan : politeSpan;\n\n\t// Set textContent to empty string in order to trigger screen reader's announcement.\n\tspan.textContent = \"\";\n\tspan.textContent = message;\n\n\tif (mode !== InvisibleMessageMode.Assertive && mode !== InvisibleMessageMode.Polite) {\n\t\tconsole.warn(`You have entered an invalid mode. Valid values are: \"Polite\" and \"Assertive\". The framework will automatically set the mode to \"Polite\".`); // eslint-disable-line\n\t}\n\n\t// clear the span in order to avoid reading it out while in JAWS reading node\n\tsetTimeout(() => {\n\t\t// ensure that we clear the text node only if no announce is made in the meantime\n\t\tif (span.textContent === message) {\n\t\t\tspan.textContent = \"\";\n\t\t}\n\t}, 3000);\n};\n\nexport default announce;\n"],
"mappings": "aAAA,OAAOA,MAA0B,mCACjC,OAAOC,MAAiC,mCACxC,OAAS,cAAAC,MAAkB,aAE3B,IAAIC,EACAC,EAEJ,MAAMC,EAA0BC,GAAoB,CACnDA,EAAG,MAAM,SAAW,WACpBA,EAAG,MAAM,KAAO,wBAChBA,EAAG,MAAM,WAAa,OACtBA,EAAG,MAAM,KAAO,UAChBA,EAAG,MAAM,IAAM,UACfA,EAAG,MAAM,cAAgB,MAC1B,EAEAJ,EAAW,IAAM,CACZC,GAAcC,IAIlBD,EAAa,SAAS,cAAc,MAAM,EAC1CC,EAAgB,SAAS,cAAc,MAAM,EAE7CD,EAAW,UAAU,IAAI,6BAA6B,EACtDC,EAAc,UAAU,IAAI,gCAAgC,EAE5DD,EAAW,aAAa,YAAa,QAAQ,EAC7CC,EAAc,aAAa,YAAa,WAAW,EAEnDD,EAAW,aAAa,OAAQ,OAAO,EACvCC,EAAc,aAAa,OAAQ,OAAO,EAE1CC,EAAuBF,CAAU,EACjCE,EAAuBD,CAAa,EAEpCH,EAA4B,uBAAuB,EAAE,YAAYE,CAAU,EAC3EF,EAA4B,uBAAuB,EAAE,YAAYG,CAAa,EAC/E,CAAC,EASD,MAAMG,EAAW,CAACC,EAAiBC,IAA+B,CAEjE,MAAMC,EAAOD,IAAST,EAAqB,UAAYI,EAAgBD,EAGvEO,EAAK,YAAc,GACnBA,EAAK,YAAcF,EAEfC,IAAST,EAAqB,WAAaS,IAAST,EAAqB,QAC5E,QAAQ,KAAK,0IAA0I,EAIxJ,WAAW,IAAM,CAEZU,EAAK,cAAgBF,IACxBE,EAAK,YAAc,GAErB,EAAG,GAAI,CACR,EAEA,eAAeH",
"names": ["InvisibleMessageMode", "getSingletonElementInstance", "attachBoot", "politeSpan", "assertiveSpan", "setOutOfViewportStyles", "el", "announce", "message", "mode", "span"]
}