@e1011/es-kit 1.1.86 → 1.2.1

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 (38) hide show
  1. package/dist/hooks/esm/index.css +151 -151
  2. package/dist/hooks/esm/src/core/hooks/index.js +1 -1
  3. package/dist/hooks/esm/src/core/hooks/useThemePreference.js +1 -1
  4. package/dist/hooks/esm/src/core/hooks/useThemePreference.js.map +1 -1
  5. package/dist/hooks/esm/src/core/utils/helpers/ui.js +1 -1
  6. package/dist/hooks/esm/src/core/utils/helpers/ui.js.map +1 -1
  7. package/dist/hooks/index.css +151 -151
  8. package/dist/hooks/src/core/hooks/index.js +1 -1
  9. package/dist/hooks/src/core/hooks/useThemePreference.js +1 -1
  10. package/dist/hooks/src/core/hooks/useThemePreference.js.map +1 -1
  11. package/dist/hooks/src/core/utils/helpers/ui.js +1 -1
  12. package/dist/hooks/src/core/utils/helpers/ui.js.map +1 -1
  13. package/dist/lib/cjs/src/core/hooks/useThemePreference.js +1 -1
  14. package/dist/lib/cjs/src/core/hooks/useThemePreference.js.map +1 -1
  15. package/dist/lib/cjs/src/core/utils/helpers/ui.js +1 -1
  16. package/dist/lib/cjs/src/core/utils/helpers/ui.js.map +1 -1
  17. package/dist/lib/cjs/src/index.js +1 -1
  18. package/dist/lib/esm/src/core/hooks/useThemePreference.js +1 -1
  19. package/dist/lib/esm/src/core/hooks/useThemePreference.js.map +1 -1
  20. package/dist/lib/esm/src/core/utils/helpers/ui.js +1 -1
  21. package/dist/lib/esm/src/core/utils/helpers/ui.js.map +1 -1
  22. package/dist/lib/esm/src/index.js +1 -1
  23. package/dist/lib/tsconfig.tsbuildinfo +1 -1
  24. package/dist/types/src/core/hooks/useThemePreference.d.ts +0 -41
  25. package/dist/types/src/core/hooks/useThemePreference.d.ts.map +1 -1
  26. package/dist/types/src/core/utils/helpers/ui.d.ts +45 -0
  27. package/dist/types/src/core/utils/helpers/ui.d.ts.map +1 -1
  28. package/dist/ui/esm/src/core/utils/helpers/ui.js.map +1 -1
  29. package/dist/ui/src/core/utils/helpers/ui.js.map +1 -1
  30. package/dist/utils/esm/index.css +151 -151
  31. package/dist/utils/esm/src/core/utils/helpers/ui.js +1 -1
  32. package/dist/utils/esm/src/core/utils/helpers/ui.js.map +1 -1
  33. package/dist/utils/esm/src/core/utils/index.js +1 -1
  34. package/dist/utils/index.css +151 -151
  35. package/dist/utils/src/core/utils/helpers/ui.js +1 -1
  36. package/dist/utils/src/core/utils/helpers/ui.js.map +1 -1
  37. package/dist/utils/src/core/utils/index.js +1 -1
  38. package/package.json +4 -3
@@ -1,2 +1,2 @@
1
- import{useEffect as e}from"react";const o="change",t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>document.body,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>e;const c=o=>{const c=e();null==s||s(o,c),null==t||t(o)},d=e=>{c(e.matches)},l=e=>{c(!e.matches)},r=window.matchMedia("(prefers-color-scheme: dark)");try{window.matchMedia("(prefers-color-scheme: dark)").removeEventListener(o,d),window.matchMedia("(prefers-color-scheme: light)").removeEventListener(o,l)}catch(e){}return c(null==r?void 0:r.matches),window.matchMedia("(prefers-color-scheme: dark)").addEventListener(o,d),window.matchMedia("(prefers-color-scheme: light)").addEventListener(o,l),()=>{window.matchMedia("(prefers-color-scheme: dark)").removeEventListener(o,d),window.matchMedia("(prefers-color-scheme: light)").removeEventListener(o,l)}},c=function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>document.body,c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>e;e((()=>t(o,c)),[o,c])};let d={dark:"theme-dark",light:"theme-light"};const l=()=>d,r=e=>{d=e},s=function(e,o){let t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const c=e?d.light:d.dark,l=e?d.dark:d.light;o&&(o.classList.remove(c),o.classList.remove(l),o.classList.add(l)),"undefined"!=typeof document&&(document.querySelectorAll(".".concat(c)).forEach((e=>{e.classList.add(".".concat(l)),e.classList.remove(".".concat(c))})),t&&(document.querySelectorAll(".shadow-div").forEach((e=>{var o,t;null===(o=e.shadowRoot)||void 0===o||null===(o=o.querySelector(".".concat(c)))||void 0===o||o.classList.add(l),null===(t=e.shadowRoot)||void 0===t||null===(t=t.querySelector(".".concat(c)))||void 0===t||t.classList.remove(c)})),document.querySelectorAll("esmf-wrapper").forEach((e=>{var o,t,d;null===(o=e.shadowRoot)||void 0===o||null===(o=o.querySelector(".".concat(c)))||void 0===o||o.classList.add(l),null===(t=e.shadowRoot)||void 0===t||null===(t=t.querySelector(".".concat(c)))||void 0===t||t.classList.remove(c);const r=null===(d=e.shadowRoot)||void 0===d?void 0:d.childNodes[0];r&&(r.classList.add(l),r.classList.remove(c))}))))},n=(e,o)=>{let t=e||!1;"undefined"!=typeof document&&void 0===e&&(t=document.body.classList.contains(d.dark)),s(t,o||document.body)};export{l as getBaseThemes,t as observeThemePreference,r as setThemeClassNames,s as switchColorTheme,n as updateColorTheme,c as useThemePreference};
1
+ import{useEffect as o}from"react";import{observeThemePreference as t}from"../utils/helpers/ui.js";const e=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>document.body,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o=>o;o((()=>t(e,i)),[e,i])};export{e as useThemePreference};
2
2
  //# sourceMappingURL=useThemePreference.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useThemePreference.js","sources":["../../../../../../src/core/hooks/useThemePreference.ts"],"sourcesContent":["import { useEffect } from 'react'\n\n\nconst windowMatchMediaChangeEventType = 'change'\n\n/**\n * Observes the user's theme preference and applies the appropriate theme.\n * @param {() => HTMLElement} [getHtmlElement] - Function to get the HTML element to which the theme will be applied.\n * @param {(isDark: boolean) => void} [switchCallback] - Callback function to execute when the theme changes.\n * @returns {() => void} Function to stop observing the theme preference.\n */\nexport const observeThemePreference = (\n getHtmlElement: () => HTMLElement = (): HTMLElement => document.body,\n switchCallback: (isDark: boolean) => void = (isDark: boolean): boolean => isDark,\n): () => void => {\n const switchColorThemeHandler = (isDark: boolean): void => {\n const htmlElement = getHtmlElement()\n\n switchColorTheme?.(isDark, htmlElement)\n switchCallback?.(isDark)\n }\n\n const changeDarkColorThemeHandler = (event: MediaQueryListEvent): void => {\n switchColorThemeHandler(event.matches)\n }\n\n const changeLightColorThemeHandler = (event: MediaQueryListEvent): void => {\n switchColorThemeHandler(!event.matches)\n }\n\n const isDark = window.matchMedia('(prefers-color-scheme: dark)')\n\n try {\n window.matchMedia('(prefers-color-scheme: dark)').removeEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').removeEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n } catch (error) {\n console.error(`Error::observeThemePreference::removeEventListener: ${error}`)\n }\n\n switchColorThemeHandler(isDark?.matches)\n window.matchMedia('(prefers-color-scheme: dark)').addEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').addEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n\n return () => {\n window.matchMedia('(prefers-color-scheme: dark)').removeEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').removeEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n }\n}\n\n/**\n * Custom hook to use theme preference in a React component.\n * @param {() => HTMLElement} [getHtmlElement] - Function to get the HTML element to which the theme will be applied.\n * @param {(isDark: boolean) => void} [switchCallback] - Callback function to execute when the theme changes.\n */\nexport const useThemePreference = (\n getHtmlElement: () => HTMLElement = (): HTMLElement => document.body,\n switchCallback: (isDark: boolean) => void = (isDark: boolean): boolean => isDark,\n): void => {\n useEffect(() => observeThemePreference(getHtmlElement, switchCallback), [getHtmlElement, switchCallback])\n}\n\n/**\n * Type definition for theme map.\n * @typedef {Object} ThemeMap\n * @property {string} dark - CSS class for the dark theme.\n * @property {string} light - CSS class for the light theme.\n */\ntype ThemeMap = {\n dark: string\n light: string\n}\n\nlet baseThemes: ThemeMap = {\n dark: 'theme-dark',\n light: 'theme-light',\n}\n\n/**\n * Gets the base themes.\n * @returns {ThemeMap} The current base themes.\n */\nexport const getBaseThemes = (): ThemeMap => baseThemes\n\n/**\n * Sets the base theme class names.\n * @param {ThemeMap} themes - Object containing the CSS classes for dark and light themes.\n */\nexport const setThemeClassNames = (themes: ThemeMap): void => {\n baseThemes = themes\n}\n\n/**\n * Switches the color theme of the document.\n * @param {boolean} isDark - Flag to determine if the dark theme should be applied.\n * @param {HTMLElement} [htmlElement] - The HTML element to which the theme will be applied.\n * @param {boolean} [findShadows=true] - Flag to determine if shadow DOM elements should also be themed.\n */\nexport const switchColorTheme = (isDark: boolean, htmlElement?: HTMLElement, findShadows = true): void => {\n const oldClass = isDark ? baseThemes.light : baseThemes.dark\n const newClass = isDark ? baseThemes.dark : baseThemes.light\n\n if (htmlElement) {\n htmlElement.classList.remove(oldClass)\n htmlElement.classList.remove(newClass)\n htmlElement.classList.add(newClass)\n }\n\n if (typeof document !== 'undefined') {\n document.querySelectorAll(`.${oldClass}`).forEach((element) => {\n element.classList.add(`.${newClass}`)\n element.classList.remove(`.${oldClass}`)\n })\n\n if (findShadows) {\n document.querySelectorAll('.shadow-div').forEach((element) => {\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.add(newClass)\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.remove(oldClass)\n })\n\n document.querySelectorAll('esmf-wrapper').forEach((element) => {\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.add(newClass)\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.remove(oldClass)\n\n const firstChild: HTMLElement = element.shadowRoot?.childNodes[0] as HTMLElement\n\n if (firstChild) {\n firstChild.classList.add(newClass)\n firstChild.classList.remove(oldClass)\n }\n })\n }\n }\n}\n\n/**\n * Updates the color theme of the document.\n * @param {boolean} [isDark] - Optional flag to determine if the dark theme should be applied.\n * @param {HTMLElement} [htmlElement] - The HTML element to which the theme will be applied.\n */\nexport const updateColorTheme = (isDark?: boolean, htmlElement?: HTMLElement): void => {\n let resolvedIsDark: boolean = isDark || false\n\n if (typeof document !== 'undefined' && isDark === undefined) {\n resolvedIsDark = document.body.classList.contains(baseThemes.dark)\n }\n switchColorTheme(resolvedIsDark, htmlElement || document.body)\n}\n"],"names":["windowMatchMediaChangeEventType","observeThemePreference","getHtmlElement","arguments","length","undefined","document","body","switchCallback","isDark","switchColorThemeHandler","htmlElement","switchColorTheme","changeDarkColorThemeHandler","event","matches","changeLightColorThemeHandler","window","matchMedia","removeEventListener","error","addEventListener","useThemePreference","useEffect","baseThemes","dark","light","getBaseThemes","setThemeClassNames","themes","findShadows","oldClass","newClass","classList","remove","add","querySelectorAll","concat","forEach","element","_element$shadowRoot","_element$shadowRoot2","shadowRoot","querySelector","_element$shadowRoot3","_element$shadowRoot4","_element$shadowRoot5","firstChild","childNodes","updateColorTheme","resolvedIsDark","contains"],"mappings":"kCAGA,MAAMA,EAAkC,SAQ3BC,EAAyB,WAGrB,IAFfC,EAAiCC,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAA,GAAG,IAAmBG,SAASC,KAChEC,EAAyCL,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAIM,GAAAA,GAA6BA,EAE1E,MAAMC,EAA2BD,IAC/B,MAAME,EAAcT,IAEpBU,SAAAA,EAAmBH,EAAQE,GAC3BH,SAAAA,EAAiBC,EAAO,EAGpBI,EAA+BC,IACnCJ,EAAwBI,EAAMC,QAAQ,EAGlCC,EAAgCF,IACpCJ,GAAyBI,EAAMC,QAAQ,EAGnCN,EAASQ,OAAOC,WAAW,gCAEjC,IACED,OAAOC,WAAW,gCAAgCC,oBAChDnB,EAAiCa,GAEnCI,OAAOC,WAAW,iCAAiCC,oBACjDnB,EAAiCgB,EAEpC,CAAC,MAAOI,GAAO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AKN,WAAW,IAAAS,GAAjDA,EAAmDP,UAAUE,IAAIH,GAC/C,QAAlBS,EAAAF,EAAQG,kBAAU,IAAAD,GAA+B,QAA/BA,EAAlBA,EAAoBE,cAAa,IAAAN,OAAKN,WAAW,IAAAU,GAAjDA,EAAmDR,UAAUC,OAAOH,EAAS,IAG/EzB,SAAS8B,iBAAiB,gBAAgBE,SAASC,IAAY,IAAAK,EAAAC,EAAAC,EAC3C,QAAlBF,EAAAL,EAAQG,kBAAU,IAAAE,GAA+B,QAA/BA,EAAlBA,EAAoBD,cAAa,IAAAN,OAAKN,WAAW,IAAAa,GAAjDA,EAAmDX,UAAUE,IAAIH,GAC/C,QAAlBa,EAAAN,EAAQG,kBAAU,IAAAG,GAA+B,QAA/BA,EAAlBA,EAAoBF,cAAa,IAAAN,OAAKN,WAAW,IAAAc,GAAjDA,EAAmDZ,UAAUC,OAAOH,GAEpE,MAAMgB,EAA4CD,QAArBA,EAAGP,EAAQG,sBAAUI,SAAlBA,EAAoBE,WAAW,GAE3DD,IACFA,EAAWd,UAAUE,IAAIH,GACzBe,EAAWd,UAAUC,OAAOH,GAC9B,KAIR,EAOakB,EAAmBA,CAACxC,EAAkBE,KACjD,IAAIuC,EAA0BzC,IAAU,EAEhB,oBAAbH,eAAuCD,IAAXI,IACrCyC,EAAiB5C,SAASC,KAAK0B,UAAUkB,SAAS3B,EAAWC,OAE/Db,EAAiBsC,EAAgBvC,GAAeL,SAASC,KAAK"}
1
+ {"version":3,"file":"useThemePreference.js","sources":["../../../../../../src/core/hooks/useThemePreference.ts"],"sourcesContent":["import { useEffect } from 'react'\n\nimport { observeThemePreference } from '../utils/helpers/ui'\n\n/**\n * Custom hook to use theme preference in a React component.\n * @param {() => HTMLElement} [getHtmlElement] - Function to get the HTML element to which the theme will be applied.\n * @param {(isDark: boolean) => void} [switchCallback] - Callback function to execute when the theme changes.\n */\nexport const useThemePreference = (\n getHtmlElement: () => HTMLElement = (): HTMLElement => document.body,\n switchCallback: (isDark: boolean) => void = (isDark: boolean): boolean => isDark,\n): void => {\n useEffect(\n () => observeThemePreference(getHtmlElement, switchCallback),\n [getHtmlElement, switchCallback],\n )\n}\n"],"names":["useThemePreference","getHtmlElement","arguments","length","undefined","document","body","switchCallback","isDark","useEffect","observeThemePreference"],"mappings":"kGASaA,MAAAA,EAAqB,WAGvB,IAFTC,EAAiCC,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAA,GAAG,IAAmBG,SAASC,KAChEC,EAAyCL,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAIM,GAAAA,GAA6BA,EAE1EC,GACE,IAAMC,EAAuBT,EAAgBM,IAC7C,CAACN,EAAgBM,GAErB"}
@@ -1,2 +1,2 @@
1
- import"../../../../node_modules/core-js/modules/web.dom-collections.iterator.js";const t=(t,n)=>n instanceof Map?{dataType:"Map",value:Array.from(n.entries())}:n,n=function(){for(var t=arguments.length,n=new Array(t),e=0;e<t;e++)n[e]=arguments[e];return n.filter((t=>"string"==typeof t&&null!=t)).filter(Boolean).join(" ")},e=t=>{const n={},e={};return Object.entries(t).forEach((t=>{let[o,l]=t;"data-"===o.substr(0,5)||"data"===o.substr(0,4)?n[o]=l:e[o]=l})),{dataProps:n,restProps:e}},o=function(t){var n;let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;var a;if(o.tokens=o.tokens||{},null!=l)return o.tokens[t]=l,"".concat(t).concat(null==o||null===(a=o.tokens)||void 0===a?void 0:a[t]);const r=void 0===(null==o?void 0:o.tokens[t])||null===(null==o?void 0:o.tokens[t]);return o.tokens[t]=o.tokens[t]||0,r?"".concat(t,0):e?(o.tokens[t]+=1,"".concat(t).concat(null==o||null===(i=o.tokens)||void 0===i?void 0:i[t])):"".concat(t).concat(null==o||null===(n=o.tokens)||void 0===n?void 0:n[t]);var i},l=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"_top",e=arguments.length>2&&void 0!==arguments[2]&&arguments[2];l.aElement=l.aElement||document.createElement("a");const{aElement:o}=l;return o.setAttribute("href",t),o.setAttribute("target",n),o.dataset.date="".concat(Date.now()),o.click(),e&&(o.remove(),l.aElement=null),o},a=t=>{var n,e,o;null==t||null===(n=t.preventDefault)||void 0===n||n.call(t),null==t||null===(e=t.stopPropagation)||void 0===e||e.call(t),null==t||null===(o=t.stopImmediatePropagation)||void 0===o||o.call(t)};export{l as anchorClick,n as classNames,o as generateId,t as mapSerReplacer,a as noop,e as parseProps};
1
+ import"../../../../node_modules/core-js/modules/web.dom-collections.iterator.js";const e=(e,t)=>t instanceof Map?{dataType:"Map",value:Array.from(t.entries())}:t,t=function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return t.filter((e=>"string"==typeof e&&null!=e)).filter(Boolean).join(" ")},o=e=>{const t={},o={};return Object.entries(e).forEach((e=>{let[n,l]=e;"data-"===n.substr(0,5)||"data"===n.substr(0,4)?t[n]=l:o[n]=l})),{dataProps:t,restProps:o}},n=function(e){var t;let o=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;var r;if(n.tokens=n.tokens||{},null!=l)return n.tokens[e]=l,"".concat(e).concat(null==n||null===(r=n.tokens)||void 0===r?void 0:r[e]);const a=void 0===(null==n?void 0:n.tokens[e])||null===(null==n?void 0:n.tokens[e]);return n.tokens[e]=n.tokens[e]||0,a?"".concat(e,0):o?(n.tokens[e]+=1,"".concat(e).concat(null==n||null===(c=n.tokens)||void 0===c?void 0:c[e])):"".concat(e).concat(null==n||null===(t=n.tokens)||void 0===t?void 0:t[e]);var c},l=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"_top",o=arguments.length>2&&void 0!==arguments[2]&&arguments[2];l.aElement=l.aElement||document.createElement("a");const{aElement:n}=l;return n.setAttribute("href",e),n.setAttribute("target",t),n.dataset.date="".concat(Date.now()),n.click(),o&&(n.remove(),l.aElement=null),n},r=e=>{var t,o,n;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),null==e||null===(o=e.stopPropagation)||void 0===o||o.call(e),null==e||null===(n=e.stopImmediatePropagation)||void 0===n||n.call(e)},a="__eskit_themes__",c={dark:"theme-dark",light:"theme-light"},s=e=>{var t;return null!==(t=(null!=e?e:document.body)[a])&&void 0!==t?t:c},d=(e,t)=>{(null!=t?t:document.body)[a]=e},i=function(e,t){let o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const n=s(t),l=e?n.light:n.dark,r=e?n.dark:n.light;t&&(t.classList.remove(l),t.classList.remove(r),t.classList.add(r)),"undefined"!=typeof document&&(document.querySelectorAll(".".concat(l)).forEach((e=>{e.classList.add(".".concat(r)),e.classList.remove(".".concat(l))})),o&&(document.querySelectorAll(".shadow-div").forEach((e=>{var t,o;null===(t=e.shadowRoot)||void 0===t||null===(t=t.querySelector(".".concat(l)))||void 0===t||t.classList.add(r),null===(o=e.shadowRoot)||void 0===o||null===(o=o.querySelector(".".concat(l)))||void 0===o||o.classList.remove(l)})),document.querySelectorAll("esmf-wrapper").forEach((e=>{var t,o,n;null===(t=e.shadowRoot)||void 0===t||null===(t=t.querySelector(".".concat(l)))||void 0===t||t.classList.add(r),null===(o=e.shadowRoot)||void 0===o||null===(o=o.querySelector(".".concat(l)))||void 0===o||o.classList.remove(l);const a=null===(n=e.shadowRoot)||void 0===n?void 0:n.childNodes[0];a&&(a.classList.add(r),a.classList.remove(l))}))))},u=(e,t)=>{const o=t||document.body;let n=e||!1;"undefined"!=typeof document&&void 0===e&&(n=document.body.classList.contains(s(o).dark)),i(n,o)},v="change",m=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>document.body,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>e;const o=o=>{const n=e();null==i||i(o,n),null==t||t(o)},n=e=>{o(e.matches)},l=e=>{o(!e.matches)},r=window.matchMedia("(prefers-color-scheme: dark)");try{window.matchMedia("(prefers-color-scheme: dark)").removeEventListener(v,n),window.matchMedia("(prefers-color-scheme: light)").removeEventListener(v,l)}catch(e){}return o(null==r?void 0:r.matches),window.matchMedia("(prefers-color-scheme: dark)").addEventListener(v,n),window.matchMedia("(prefers-color-scheme: light)").addEventListener(v,l),()=>{window.matchMedia("(prefers-color-scheme: dark)").removeEventListener(v,n),window.matchMedia("(prefers-color-scheme: light)").removeEventListener(v,l)}};export{l as anchorClick,t as classNames,n as generateId,s as getBaseThemes,e as mapSerReplacer,r as noop,m as observeThemePreference,o as parseProps,d as setThemeClassNames,i as switchColorTheme,u as updateColorTheme};
2
2
  //# sourceMappingURL=ui.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ui.js","sources":["../../../../../../../src/core/utils/helpers/ui.ts"],"sourcesContent":["export const mapSerReplacer\n= (key: string, value: unknown): unknown | { dataType: string; value: Array<unknown>} => {\n if (value instanceof Map) {\n return {\n dataType: 'Map',\n value: Array.from(value.entries()), // or with spread: value: [...value]\n }\n }\n return value\n}\n\nexport type TClassName = string | boolean | null | undefined\nexport const classNames = (...classes: TClassName[]): string => classes\n .filter((className: TClassName) => (typeof className === 'string' && className !== undefined && className !== null))\n .filter(Boolean).join(' ')\n\n\nexport type PropsCategoriesType = {\n dataProps: Record<string, unknown>\n restProps: Record<string, unknown>\n};\n\nexport const parseProps = (props: Record<string, unknown>):PropsCategoriesType => {\n const dataProps: Record<string, unknown> = {}\n const restProps: Record<string, unknown> = {}\n\n Object.entries(props).forEach(([key, value]) => {\n if (key.substr(0, 5) === 'data-' || key.substr(0, 4) === 'data') {\n dataProps[key] = value\n } else {\n restProps[key] = value\n }\n })\n return { dataProps, restProps }\n}\n\n\n\ntype GeneratorIdCallable = (token: string, increment?: boolean, forcedValue?: number | undefined) => string\ntype GenerateId = { tokens?: Record<string, number | null | undefined> } & GeneratorIdCallable\n\nexport const generateId: GenerateId = (\n token: string,\n increment = true,\n forcedValue: number | undefined = undefined,\n) => {\n generateId.tokens = generateId.tokens || {}\n\n if (forcedValue !== undefined && forcedValue !== null) {\n generateId.tokens[token] = forcedValue\n return `${token}${generateId?.tokens?.[token] as number}`\n }\n\n const noValue = generateId?.tokens[token] === undefined || generateId?.tokens[token] === null\n\n generateId.tokens[token] = generateId.tokens[token] || 0\n\n if (noValue) {\n return `${token}${0}`\n }\n\n if (increment) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n generateId.tokens[token] += 1\n\n return `${token}${generateId?.tokens?.[token] as number}`\n }\n\n return `${token}${generateId?.tokens?.[token] as number}`\n}\n\ntype FAnchorClick = { aElement?: HTMLAnchorElement | null }\n & ((href: string, target?: string, remove?: boolean) => void)\n\nexport const anchorClick: FAnchorClick = (href: string, target = '_top', remove = false): HTMLAnchorElement | null => {\n anchorClick.aElement = anchorClick.aElement || document.createElement('a')\n\n const { aElement } = anchorClick\n\n aElement.setAttribute('href', href)\n aElement.setAttribute('target', target)\n\n aElement.dataset.date = `${Date.now()}`\n aElement.click()\n if (remove) {\n aElement.remove()\n anchorClick.aElement = null\n }\n\n return aElement\n}\n\n\n\nexport type NoopEvent = {\n preventDefault?: () => void\n stopPropagation?: () => void\n stopImmediatePropagation?: () => void\n} | Event\n\nexport const noop = (event?: NoopEvent): void => {\n event?.preventDefault?.()\n event?.stopPropagation?.()\n event?.stopImmediatePropagation?.()\n}\n"],"names":["mapSerReplacer","key","value","Map","dataType","Array","from","entries","classNames","_len","arguments","length","classes","_key","filter","className","Boolean","join","parseProps","props","dataProps","restProps","Object","forEach","_ref","substr","generateId","token","_generateId$tokens3","increment","undefined","forcedValue","_generateId$tokens","tokens","concat","noValue","_generateId$tokens2","anchorClick","href","target","remove","aElement","document","createElement","setAttribute","dataset","date","Date","now","click","noop","event","_event$preventDefault","_event$stopPropagatio","_event$stopImmediateP","preventDefault","call","stopPropagation","stopImmediatePropagation"],"mappings":"uFAAaA,EACXA,CAACC,EAAaC,IACVA,aAAiBC,IACZ,CACLC,SAAU,MACVF,MAAOG,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AAZG,IAAkBA,OAAlBA,EAAAA,EAAqBT,KAGzCO,GAAAA,OAAUP,GAAKO,OAAGR,SAAkB,QAARE,EAAVF,EAAYO,cAAZL,IAAkBA,OAAlBA,EAAAA,EAAqBD,IARxB,IAAAS,CASjB,EAKaC,EAA4B,SAACC,GAA4E,IAA9DC,EAAM7B,UAAAC,OAAA,QAAAmB,IAAApB,UAAA,GAAAA,UAAA,GAAG,OAAQ8B,EAAM9B,UAAAC,OAAA,QAAAmB,IAAApB,UAAA,IAAAA,UAAA,GAC7E2B,EAAYI,SAAWJ,EAAYI,UAAYC,SAASC,cAAc,KAEtE,MAAMF,SAAEA,GAAaJ,EAYrB,OAVAI,EAASG,aAAa,OAAQN,GAC9BG,EAASG,aAAa,SAAUL,GAEhCE,EAASI,QAAQC,KAAIZ,GAAAA,OAAMa,KAAKC,OAChCP,EAASQ,QACLT,IACFC,EAASD,SACTH,EAAYI,SAAW,MAGlBA,CACT,EAUaS,EAAQC,IAA4B,IAAAC,EAAAC,EAAAC,EAC/CH,SAAqBC,QAAhBA,EAALD,EAAOI,0BAAcH,GAArBA,EAAAI,KAAAL,GACAA,SAAsBE,QAAjBA,EAALF,EAAOM,2BAAeJ,GAAtBA,EAAAG,KAAAL,GACAA,SAA+BG,QAA1BA,EAALH,EAAOO,oCAAwBJ,GAA/BA,EAAAE,KAAAL,EAAmC"}
1
+ {"version":3,"file":"ui.js","sources":["../../../../../../../src/core/utils/helpers/ui.ts"],"sourcesContent":["export const mapSerReplacer\n= (key: string, value: unknown): unknown | { dataType: string; value: Array<unknown>} => {\n if (value instanceof Map) {\n return {\n dataType: 'Map',\n value: Array.from(value.entries()), // or with spread: value: [...value]\n }\n }\n return value\n}\n\nexport type TClassName = string | boolean | null | undefined\nexport const classNames = (...classes: TClassName[]): string => classes\n .filter((className: TClassName) => (typeof className === 'string' && className !== undefined && className !== null))\n .filter(Boolean).join(' ')\n\n\nexport type PropsCategoriesType = {\n dataProps: Record<string, unknown>\n restProps: Record<string, unknown>\n};\n\nexport const parseProps = (props: Record<string, unknown>):PropsCategoriesType => {\n const dataProps: Record<string, unknown> = {}\n const restProps: Record<string, unknown> = {}\n\n Object.entries(props).forEach(([key, value]) => {\n if (key.substr(0, 5) === 'data-' || key.substr(0, 4) === 'data') {\n dataProps[key] = value\n } else {\n restProps[key] = value\n }\n })\n return { dataProps, restProps }\n}\n\n\n\ntype GeneratorIdCallable = (token: string, increment?: boolean, forcedValue?: number | undefined) => string\ntype GenerateId = { tokens?: Record<string, number | null | undefined> } & GeneratorIdCallable\n\nexport const generateId: GenerateId = (\n token: string,\n increment = true,\n forcedValue: number | undefined = undefined,\n) => {\n generateId.tokens = generateId.tokens || {}\n\n if (forcedValue !== undefined && forcedValue !== null) {\n generateId.tokens[token] = forcedValue\n return `${token}${generateId?.tokens?.[token] as number}`\n }\n\n const noValue = generateId?.tokens[token] === undefined || generateId?.tokens[token] === null\n\n generateId.tokens[token] = generateId.tokens[token] || 0\n\n if (noValue) {\n return `${token}${0}`\n }\n\n if (increment) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n generateId.tokens[token] += 1\n\n return `${token}${generateId?.tokens?.[token] as number}`\n }\n\n return `${token}${generateId?.tokens?.[token] as number}`\n}\n\ntype FAnchorClick = { aElement?: HTMLAnchorElement | null }\n & ((href: string, target?: string, remove?: boolean) => void)\n\nexport const anchorClick: FAnchorClick = (href: string, target = '_top', remove = false): HTMLAnchorElement | null => {\n anchorClick.aElement = anchorClick.aElement || document.createElement('a')\n\n const { aElement } = anchorClick\n\n aElement.setAttribute('href', href)\n aElement.setAttribute('target', target)\n\n aElement.dataset.date = `${Date.now()}`\n aElement.click()\n if (remove) {\n aElement.remove()\n anchorClick.aElement = null\n }\n\n return aElement\n}\n\n\n\nexport type NoopEvent = {\n preventDefault?: () => void\n stopPropagation?: () => void\n stopImmediatePropagation?: () => void\n} | Event\n\nexport const noop = (event?: NoopEvent): void => {\n event?.preventDefault?.()\n event?.stopPropagation?.()\n event?.stopImmediatePropagation?.()\n}\n\n/**\n * Type definition for theme map.\n * @typedef {Object} ThemeMap\n * @property {string} dark - CSS class for the dark theme.\n * @property {string} light - CSS class for the light theme.\n */\nexport type ThemeMap = {\n dark: string\n light: string\n}\n\nconst THEME_PROP = '__eskit_themes__'\n\nconst defaultThemes: ThemeMap = {\n dark: 'theme-dark',\n light: 'theme-light',\n}\n\n/**\n * Reads the theme config stored on the given element.\n * Falls back to defaultThemes when no config has been set.\n * Scoping to the element means different microfrontends (different roots) are isolated,\n * while all bundles targeting the same element share one config.\n * @param {HTMLElement} [element] - The element to read from. Defaults to document.body.\n * @returns {ThemeMap} The current base themes for the element.\n */\nexport const getBaseThemes = (element?: HTMLElement): ThemeMap => {\n const el = element ?? document.body\n\n return (el as unknown as Record<string, unknown>)[THEME_PROP] as ThemeMap ?? defaultThemes\n}\n\n/**\n * Sets the base theme class names on the given element.\n * @param {ThemeMap} themes - CSS classes for dark and light themes.\n * @param {HTMLElement} [element] - The element to store config on. Defaults to document.body.\n */\nexport const setThemeClassNames = (themes: ThemeMap, element?: HTMLElement): void => {\n const el = element ?? document.body\n const store = el as unknown as Record<string, unknown>\n\n store[THEME_PROP] = themes\n}\n\n/**\n * Switches the color theme of the document.\n * @param {boolean} isDark - Flag to determine if the dark theme should be applied.\n * @param {HTMLElement} [htmlElement] - The HTML element to which the theme will be applied.\n * @param {boolean} [findShadows=true] - Flag to determine if shadow DOM elements should also be themed.\n */\nexport const switchColorTheme = (\n isDark: boolean, htmlElement?: HTMLElement, findShadows = true,\n): void => {\n const themes = getBaseThemes(htmlElement)\n const oldClass = isDark ? themes.light : themes.dark\n const newClass = isDark ? themes.dark : themes.light\n\n if (htmlElement) {\n htmlElement.classList.remove(oldClass)\n htmlElement.classList.remove(newClass)\n htmlElement.classList.add(newClass)\n }\n\n if (typeof document !== 'undefined') {\n document.querySelectorAll(`.${oldClass}`).forEach((element) => {\n element.classList.add(`.${newClass}`)\n element.classList.remove(`.${oldClass}`)\n })\n\n if (findShadows) {\n document.querySelectorAll('.shadow-div').forEach((element) => {\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.add(newClass)\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.remove(oldClass)\n })\n\n document.querySelectorAll('esmf-wrapper').forEach((element) => {\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.add(newClass)\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.remove(oldClass)\n\n const firstChild: HTMLElement = element.shadowRoot?.childNodes[0] as HTMLElement\n\n if (firstChild) {\n firstChild.classList.add(newClass)\n firstChild.classList.remove(oldClass)\n }\n })\n }\n }\n}\n\n/**\n * Updates the color theme of the document.\n * @param {boolean} [isDark] - Optional flag to determine if the dark theme should be applied.\n * @param {HTMLElement} [htmlElement] - The HTML element to which the theme will be applied.\n */\nexport const updateColorTheme = (isDark?: boolean, htmlElement?: HTMLElement): void => {\n const el = htmlElement || document.body\n let resolvedIsDark: boolean = isDark || false\n\n if (typeof document !== 'undefined' && isDark === undefined) {\n resolvedIsDark = document.body.classList.contains(getBaseThemes(el).dark)\n }\n switchColorTheme(resolvedIsDark, el)\n}\n\nconst windowMatchMediaChangeEventType = 'change'\n\n/**\n * Observes the user's theme preference and applies the appropriate theme.\n * @param {() => HTMLElement} [getHtmlElement] - Function to get the HTML element to which the theme will be applied.\n * @param {(isDark: boolean) => void} [switchCallback] - Callback function to execute when the theme changes.\n * @returns {() => void} Function to stop observing the theme preference.\n */\nexport const observeThemePreference = (\n getHtmlElement: () => HTMLElement = (): HTMLElement => document.body,\n switchCallback: (isDark: boolean) => void = (isDark: boolean): boolean => isDark,\n): () => void => {\n const switchColorThemeHandler = (isDark: boolean): void => {\n const htmlElement = getHtmlElement()\n\n switchColorTheme?.(isDark, htmlElement)\n switchCallback?.(isDark)\n }\n\n const changeDarkColorThemeHandler = (event: MediaQueryListEvent): void => {\n switchColorThemeHandler(event.matches)\n }\n\n const changeLightColorThemeHandler = (event: MediaQueryListEvent): void => {\n switchColorThemeHandler(!event.matches)\n }\n\n const isDark = window.matchMedia('(prefers-color-scheme: dark)')\n\n try {\n window.matchMedia('(prefers-color-scheme: dark)').removeEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').removeEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n } catch (error) {\n console.error(`Error::observeThemePreference::removeEventListener: ${error}`)\n }\n\n switchColorThemeHandler(isDark?.matches)\n window.matchMedia('(prefers-color-scheme: dark)').addEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').addEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n\n return () => {\n window.matchMedia('(prefers-color-scheme: dark)').removeEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').removeEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n }\n}\n"],"names":["mapSerReplacer","key","value","Map","dataType","Array","from","entries","classNames","_len","arguments","length","classes","_key","filter","className","Boolean","join","parseProps","props","dataProps","restProps","Object","forEach","_ref","substr","generateId","token","_generateId$tokens3","increment","undefined","forcedValue","_generateId$tokens","tokens","concat","noValue","_generateId$tokens2","anchorClick","href","target","remove","aElement","document","createElement","setAttribute","dataset","date","Date","now","click","noop","event","_event$preventDefault","_event$stopPropagatio","_event$stopImmediateP","preventDefault","call","stopPropagation","stopImmediatePropagation","THEME_PROP","defaultThemes","dark","light","getBaseThemes","element","_ref2","body","setThemeClassNames","themes","switchColorTheme","isDark","htmlElement","findShadows","oldClass","newClass","classList","add","querySelectorAll","_element$shadowRoot","_element$shadowRoot2","shadowRoot","querySelector","_element$shadowRoot3","_element$shadowRoot4","_element$shadowRoot5","firstChild","childNodes","updateColorTheme","el","resolvedIsDark","contains","windowMatchMediaChangeEventType","observeThemePreference","getHtmlElement","switchCallback","switchColorThemeHandler","changeDarkColorThemeHandler","matches","changeLightColorThemeHandler","window","matchMedia","removeEventListener","error","addEventListener"],"mappings":"uFAAaA,EACXA,CAACC,EAAaC,IACVA,aAAiBC,IACZ,CACLC,SAAU,MACVF,MAAOG,MAAMC,KAAKJ,EAAMK,YAGrBL,EAIIM,EAAa,WAAA,IAAA,IAAAC,EAAAC,UAAAC,OAAIC,EAAOP,IAAAA,MAAAI,GAAAI,EAAA,EAAAA,EAAAJ,EAAAI,IAAPD,EAAOC,GAAAH,UAAAG,GAAA,OAA2BD,EAC7DE,QAAQC,GAAgD,iBAAdA,GAAP,MAAiCA,IACpED,OAAOE,SAASC,KAAK,IAAI,EAQfC,EAAcC,IACzB,MAAMC,EAAqC,CAAE,EACvCC,EAAqC,CAAE,EAS7C,OAPAC,OAAOf,QAAQY,GAAOI,SAAQC,IAAkB,IAAhBvB,EAAKC,GAAMsB,EAChB,UAArBvB,EAAIwB,OAAO,EAAG,IAAuC,SAArBxB,EAAIwB,OAAO,EAAG,GAChDL,EAAUnB,GAAOC,EAEjBmB,EAAUpB,GAAOC,CACnB,IAEK,CAAEkB,YAAWC,YAAW,EAQpBK,EAAyB,SACpCC,GAGG,IAAAC,EAAA,IAFHC,IAASnB,UAAAC,OAAA,QAAAmB,IAAApB,UAAA,KAAAA,UAAA,GACTqB,EAA+BrB,UAAAC,OAAA,QAAAmB,IAAApB,UAAA,GAAAA,UAAA,QAAGoB,EAIqB,IAAAE,EAAvD,GAFAN,EAAWO,OAASP,EAAWO,QAAU,CAAE,EAEvCF,QAEF,OADAL,EAAWO,OAAON,GAASI,EAC3BG,GAAAA,OAAUP,GAAKO,OAAGR,SAAkB,QAARM,EAAVN,EAAYO,cAAZD,IAAkBA,OAAlBA,EAAAA,EAAqBL,IAGzC,MAAMQ,OAAwCL,KAA9BJ,aAAAA,EAAAA,EAAYO,OAAON,KAAsD,QAA9BD,aAAAA,EAAAA,EAAYO,OAAON,IAI9E,OAFAD,EAAWO,OAAON,GAASD,EAAW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,EAClC,CAEL"}
@@ -1,2 +1,2 @@
1
- export{useApi}from"./core/hooks/useApi.js";export{useToggle}from"./core/hooks/useToggle.js";export{useToggle2}from"./core/hooks/useToggle2.js";export{outsideClickHandler,useOutsideClick}from"./core/hooks/useOutsideClick.js";export{useResize}from"./core/hooks/useResize.js";export{useClassNames}from"./core/hooks/useClassNames.js";export{useParseProps}from"./core/hooks/useParseProps.js";export{getBaseThemes,observeThemePreference,setThemeClassNames,switchColorTheme,updateColorTheme,useThemePreference}from"./core/hooks/useThemePreference.js";export{useAnimation}from"./core/hooks/useAnimation.js";export{useIntersectionObserver}from"./core/hooks/useIntersectionObserver.js";export{useTimeoutFn}from"./core/hooks/useSetTimeout.js";export{isBirthNumberValid}from"./core/utils/helpers/birthnumber.validator.js";export{getMatch,isValidFormat,isValidModulo11,parse,regex}from"./core/utils/helpers/birthnumberCZSKvalidator.js";export{parseCSVdata,validateCSVFile,validateCSVlines,validateJSONFile,validateLineCellTrimmed,validateLineNumColumns,validateSDFFile}from"./core/utils/helpers/fileValidator.js";export{DATE_FORMAT,DATE_TIME_FORMAT,formatDate,formatDateTime,formatDateToTimestamp,getDate}from"./core/utils/helpers/date.js";export{getDeviceId}from"./core/utils/helpers/deviceInfo.js";export{emailMatch,emailMatcher,regexBuilder}from"./core/utils/helpers/emailMatcher.js";export{cleanCsvLines,formatFilePath}from"./core/utils/helpers/file.js";export{arrayToObjectTree,chunkArray,duplicatesInArray,formatJsonString,formatObj,formatObj2}from"./core/utils/helpers/objectOperations.js";export{AsyncFunctionTemplate,debounce,delay,isFunctionAsync,memoize,memoizeComplex,memoizer,nestedTernary}from"./core/utils/helpers/other.js";export{escapeRegExp,fileNameExt,findStringInText,normalizeString,removeWhitespaces,sanitizeId,sanitizePathId,toLowerCase,toUpperCase,truncateText}from"./core/utils/helpers/textValueOperations.js";export{Operation,decrementValue,incerementValue,numberDefined,numberOperation,restrictNumberInLimits,setValue}from"./core/utils/helpers/valueOperations.js";export{cancelableSetInterval,cancelableSetTimeout}from"./core/utils/helpers/cancelableDelayedFunction.js";export{anchorClick,classNames,generateId,mapSerReplacer,noop,parseProps}from"./core/utils/helpers/ui.js";export{composeId,defaultSanitizeConfig,sanitizeHtml}from"./core/utils/helpers/text.js";export{keyExtractor,keyExtractorFunction}from"./core/utils/keyExtractor.js";export{dateRangeFormat,getDateTime,getTimeFromNow,getTimeFromNowOriginal,getTimeTo}from"./core/utils/date.js";export{ced,createResolveAttribute,customElementDefine,resolveAttributes}from"./core/utils/webComponents/webComponent.utils.js";export{canSetStateMerge,createStore,getSetStateMerge}from"./core/utils/appState/store/store.vanillajs.js";export{createDataStore}from"./core/utils/appState/store/store.vanillajs.templates.js";export{useStore,useStoreApi}from"./core/utils/appState/store/useStore.react.js";export{PeregrineMQ,PeregrineMQClearError}from"./core/utils/appState/peregrineMQ/peregrineMQ.js";export{NON_EXISTENT_CHANNEL}from"./core/utils/appState/peregrineMQ/peregrineMQ.types.js";export{usePeregrineMQ}from"./core/utils/appState/peregrineMQ/usePeregrineMQ.react.js";export{peregrineMQInstance}from"./core/utils/appState/peregrineMQ/index.js";export{TinyStateMachine,TinyStateMachineEvent,TinyStateMachineEventType,TinyStateMachineState,createStates,stateIterator}from"./core/utils/appState/stateMachine/tiny-state-machine.base.js";export{ArrayFirst,ArrayLast}from"./core/utils/array.js";export{Alerts,EventName,KeyCode}from"./core/constants/ui.constants.js";export{calculateColors,calculatePercColor,convertHex,convertRGB,defaultFontSize,pxToRem,resolveStyleValue,setDefaultFontSize,toHex}from"./core/ui/utils/style.js";export{BoxLayout,LayoutBox}from"./core/ui/components/container/layoutBox/LayoutBox.js";export{LayoutDirection}from"./core/ui/components/container/layoutBox/layoutBox.types.js";export{LazyComponent,PendingBoundary,createLazyModule,createLazyModuleWithStore,wrapPromise}from"./core/ui/components/container/lazyComponent/LazyComponent.js";export{CollapsibleContainer}from"./core/ui/components/container/CollapsibleContainer.js";export{ResizableContainer}from"./core/ui/components/container/ResizableContainer.js";export{DefaultErrorComponent,ErrorBoundary}from"./core/ui/components/error/ErrorBoundary.js";export{Field,Select,setIconColor,setIconComponent}from"./core/ui/components/field/Field.js";export{DividerHorizontal,DividerLine,DividerVertical}from"./core/ui/components/dividers/DividerLine.js";export{IconBase}from"./core/ui/components/icon/IconBase.js";export{Icon}from"./core/ui/components/icon/Icon.js";export{ESIcon,ESIconBase}from"./core/ui/components/icon/IconWC.js";export{Button,IconButton,keys}from"./core/ui/components/atoms/button/Button.js";export{Text}from"./core/ui/components/atoms/text/Text.js";export{Headline,HeadlineSecondary,HeadlineTertiary}from"./core/ui/components/atoms/text/Headline.js";export{Paragraph,ParagraphBold,ParagraphBoldSmall,ParagraphSmall}from"./core/ui/components/atoms/text/Paragraph.js";export{Link}from"./core/ui/components/atoms/text/Link.js";export{AnchorLink}from"./core/ui/components/atoms/text/anchor-link/AnchorLink.js";export{TextAndContent,TextAndIcons}from"./core/ui/components/atoms/textAndContent/TextAndContent.js";export{Tag}from"./core/ui/components/atoms/tag/Tag.js";export{TagVariant}from"./core/ui/components/atoms/tag/tag.types.js";export{Toggle}from"./core/ui/components/atoms/toggle/Toggle.js";export{FlowLayout}from"./core/ui/components/molecules/layouts/FlowLayout.js";export{Popover}from"./core/ui/components/molecules/popover/PopoverLite.js";export{Tooltip}from"./core/ui/components/molecules/popover/Tooltip.js";export{PopoverPlacement}from"./core/ui/components/molecules/popover/popover.types.js";export{Popup}from"./core/ui/components/molecules/popup/Popup.js";export{PopupAnimateVariant}from"./core/ui/components/molecules/popup/popup.types.js";
1
+ export{useApi}from"./core/hooks/useApi.js";export{useToggle}from"./core/hooks/useToggle.js";export{useToggle2}from"./core/hooks/useToggle2.js";export{outsideClickHandler,useOutsideClick}from"./core/hooks/useOutsideClick.js";export{useResize}from"./core/hooks/useResize.js";export{useClassNames}from"./core/hooks/useClassNames.js";export{useParseProps}from"./core/hooks/useParseProps.js";export{useThemePreference}from"./core/hooks/useThemePreference.js";export{useAnimation}from"./core/hooks/useAnimation.js";export{useIntersectionObserver}from"./core/hooks/useIntersectionObserver.js";export{useTimeoutFn}from"./core/hooks/useSetTimeout.js";export{isBirthNumberValid}from"./core/utils/helpers/birthnumber.validator.js";export{getMatch,isValidFormat,isValidModulo11,parse,regex}from"./core/utils/helpers/birthnumberCZSKvalidator.js";export{parseCSVdata,validateCSVFile,validateCSVlines,validateJSONFile,validateLineCellTrimmed,validateLineNumColumns,validateSDFFile}from"./core/utils/helpers/fileValidator.js";export{DATE_FORMAT,DATE_TIME_FORMAT,formatDate,formatDateTime,formatDateToTimestamp,getDate}from"./core/utils/helpers/date.js";export{getDeviceId}from"./core/utils/helpers/deviceInfo.js";export{emailMatch,emailMatcher,regexBuilder}from"./core/utils/helpers/emailMatcher.js";export{cleanCsvLines,formatFilePath}from"./core/utils/helpers/file.js";export{arrayToObjectTree,chunkArray,duplicatesInArray,formatJsonString,formatObj,formatObj2}from"./core/utils/helpers/objectOperations.js";export{AsyncFunctionTemplate,debounce,delay,isFunctionAsync,memoize,memoizeComplex,memoizer,nestedTernary}from"./core/utils/helpers/other.js";export{escapeRegExp,fileNameExt,findStringInText,normalizeString,removeWhitespaces,sanitizeId,sanitizePathId,toLowerCase,toUpperCase,truncateText}from"./core/utils/helpers/textValueOperations.js";export{Operation,decrementValue,incerementValue,numberDefined,numberOperation,restrictNumberInLimits,setValue}from"./core/utils/helpers/valueOperations.js";export{cancelableSetInterval,cancelableSetTimeout}from"./core/utils/helpers/cancelableDelayedFunction.js";export{anchorClick,classNames,generateId,getBaseThemes,mapSerReplacer,noop,observeThemePreference,parseProps,setThemeClassNames,switchColorTheme,updateColorTheme}from"./core/utils/helpers/ui.js";export{composeId,defaultSanitizeConfig,sanitizeHtml}from"./core/utils/helpers/text.js";export{keyExtractor,keyExtractorFunction}from"./core/utils/keyExtractor.js";export{dateRangeFormat,getDateTime,getTimeFromNow,getTimeFromNowOriginal,getTimeTo}from"./core/utils/date.js";export{ced,createResolveAttribute,customElementDefine,resolveAttributes}from"./core/utils/webComponents/webComponent.utils.js";export{canSetStateMerge,createStore,getSetStateMerge}from"./core/utils/appState/store/store.vanillajs.js";export{createDataStore}from"./core/utils/appState/store/store.vanillajs.templates.js";export{useStore,useStoreApi}from"./core/utils/appState/store/useStore.react.js";export{PeregrineMQ,PeregrineMQClearError}from"./core/utils/appState/peregrineMQ/peregrineMQ.js";export{NON_EXISTENT_CHANNEL}from"./core/utils/appState/peregrineMQ/peregrineMQ.types.js";export{usePeregrineMQ}from"./core/utils/appState/peregrineMQ/usePeregrineMQ.react.js";export{peregrineMQInstance}from"./core/utils/appState/peregrineMQ/index.js";export{TinyStateMachine,TinyStateMachineEvent,TinyStateMachineEventType,TinyStateMachineState,createStates,stateIterator}from"./core/utils/appState/stateMachine/tiny-state-machine.base.js";export{ArrayFirst,ArrayLast}from"./core/utils/array.js";export{Alerts,EventName,KeyCode}from"./core/constants/ui.constants.js";export{calculateColors,calculatePercColor,convertHex,convertRGB,defaultFontSize,pxToRem,resolveStyleValue,setDefaultFontSize,toHex}from"./core/ui/utils/style.js";export{BoxLayout,LayoutBox}from"./core/ui/components/container/layoutBox/LayoutBox.js";export{LayoutDirection}from"./core/ui/components/container/layoutBox/layoutBox.types.js";export{LazyComponent,PendingBoundary,createLazyModule,createLazyModuleWithStore,wrapPromise}from"./core/ui/components/container/lazyComponent/LazyComponent.js";export{CollapsibleContainer}from"./core/ui/components/container/CollapsibleContainer.js";export{ResizableContainer}from"./core/ui/components/container/ResizableContainer.js";export{DefaultErrorComponent,ErrorBoundary}from"./core/ui/components/error/ErrorBoundary.js";export{Field,Select,setIconColor,setIconComponent}from"./core/ui/components/field/Field.js";export{DividerHorizontal,DividerLine,DividerVertical}from"./core/ui/components/dividers/DividerLine.js";export{IconBase}from"./core/ui/components/icon/IconBase.js";export{Icon}from"./core/ui/components/icon/Icon.js";export{ESIcon,ESIconBase}from"./core/ui/components/icon/IconWC.js";export{Button,IconButton,keys}from"./core/ui/components/atoms/button/Button.js";export{Text}from"./core/ui/components/atoms/text/Text.js";export{Headline,HeadlineSecondary,HeadlineTertiary}from"./core/ui/components/atoms/text/Headline.js";export{Paragraph,ParagraphBold,ParagraphBoldSmall,ParagraphSmall}from"./core/ui/components/atoms/text/Paragraph.js";export{Link}from"./core/ui/components/atoms/text/Link.js";export{AnchorLink}from"./core/ui/components/atoms/text/anchor-link/AnchorLink.js";export{TextAndContent,TextAndIcons}from"./core/ui/components/atoms/textAndContent/TextAndContent.js";export{Tag}from"./core/ui/components/atoms/tag/Tag.js";export{TagVariant}from"./core/ui/components/atoms/tag/tag.types.js";export{Toggle}from"./core/ui/components/atoms/toggle/Toggle.js";export{FlowLayout}from"./core/ui/components/molecules/layouts/FlowLayout.js";export{Popover}from"./core/ui/components/molecules/popover/PopoverLite.js";export{Tooltip}from"./core/ui/components/molecules/popover/Tooltip.js";export{PopoverPlacement}from"./core/ui/components/molecules/popover/popover.types.js";export{Popup}from"./core/ui/components/molecules/popup/Popup.js";export{PopupAnimateVariant}from"./core/ui/components/molecules/popup/popup.types.js";
2
2
  //# sourceMappingURL=index.js.map