@kubit-ui-web/react-components 2.0.0-beta.31 → 2.0.0-beta.33

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 (31) hide show
  1. package/dist/cjs/lib/provider/cssProvider/provider.d.ts +60 -0
  2. package/dist/cjs/lib/provider/cssProvider/provider.js +1 -1
  3. package/dist/cjs/lib/provider/cssProvider/stats/stats.d.ts +1398 -0
  4. package/dist/cjs/lib/provider/cssProvider/stats/stats.js +1 -1
  5. package/dist/esm/lib/provider/cssProvider/provider.d.ts +60 -0
  6. package/dist/esm/lib/provider/cssProvider/stats/stats.d.ts +1398 -0
  7. package/dist/esm/lib/provider/cssProvider/stats/stats.js +1 -1
  8. package/dist/esm/lib/styles/kubit.css +1492 -0
  9. package/package.json +18 -11
  10. package/dist/cjs/components/image/image.css +0 -1
  11. package/dist/cjs/components/popover/styles/index.css +0 -1
  12. package/dist/cjs/components/popover/styles/keyframes.css +0 -1
  13. package/dist/cjs/components/popover/styles/popover-arrow.css +0 -1
  14. package/dist/cjs/components/popover/styles/popover.css +0 -1
  15. package/dist/cjs/components/skeleton/skeleton.css +0 -1
  16. package/dist/cjs/components/text/text.css +0 -1
  17. package/dist/cjs/components/tooltip/tooltip.css +0 -1
  18. package/dist/cjs/lib/designSystem/kubit/css/kubit.css +0 -1
  19. package/dist/cjs/lib/designSystem/kubit/css/kubit.min.css +0 -1
  20. package/dist/esm/components/image/image.css +0 -1
  21. package/dist/esm/components/popover/styles/index.css +0 -1
  22. package/dist/esm/components/popover/styles/keyframes.css +0 -1
  23. package/dist/esm/components/popover/styles/popover-arrow.css +0 -1
  24. package/dist/esm/components/popover/styles/popover.css +0 -1
  25. package/dist/esm/components/skeleton/skeleton.css +0 -1
  26. package/dist/esm/components/text/text.css +0 -1
  27. package/dist/esm/components/tooltip/tooltip.css +0 -1
  28. package/dist/esm/lib/designSystem/kubit/css/kubit.css +0 -1
  29. package/dist/esm/lib/designSystem/kubit/css/kubit.min.css +0 -1
  30. package/dist/styles/kubit/css/kubit.min.css +0 -1
  31. /package/dist/{styles/kubit/css → cjs/lib/styles}/kubit.css +0 -0
@@ -0,0 +1,60 @@
1
+ import {
2
+ cssThemes,
3
+ cssClasses,
4
+ cssVars,
5
+ cssAvailableComponents,
6
+ cssGlobalStyles,
7
+ cssMediaQueries,
8
+ } from './stats/stats';
9
+
10
+ type ThemesKeys = keyof typeof cssThemes;
11
+ /* Get the types of each variable from the current theme selected */
12
+ type VarFromTheme = (typeof cssVars)[ThemesKeys];
13
+ type ClassNameFromTheme = (typeof cssClasses)[ThemesKeys];
14
+ type ComponentsFromTheme = (typeof cssAvailableComponents)[ThemesKeys];
15
+ type ComponentsKey = keyof ComponentsFromTheme;
16
+ type GlobalStylesFromThemes = (typeof cssGlobalStyles)[ThemesKeys];
17
+ type MediaQueriesFromThemes = (typeof cssMediaQueries)[ThemesKeys];
18
+ /* Get the type of non-variable keys from a component required */
19
+ type NonVariablesKeys<T> = {
20
+ [K in keyof T]: K extends `$${string}` ? never : K;
21
+ }[keyof T];
22
+ type ComponentSelected<T> = Pick<T, NonVariablesKeys<T>>;
23
+
24
+ export declare class Provider {
25
+ private static instance: Provider;
26
+ #currentTheme: ThemesKeys;
27
+ #themes: typeof cssThemes;
28
+ #themesVariables: typeof cssVars;
29
+ #themesClassNames: typeof cssClasses;
30
+ #themesComponents: typeof cssAvailableComponents;
31
+ #themesGlobalStyles: typeof cssGlobalStyles;
32
+ #themesMediaQueries: typeof cssMediaQueries;
33
+ #linkId: string;
34
+ #jsInCss: boolean;
35
+ #linkBuilder: (url: string, id: string) => void;
36
+ #handlerThemes: (data: {
37
+ css: string;
38
+ foreign?: { high?: string[]; low?: string[] };
39
+ }) => void;
40
+ #cleanUpLinks: () => void;
41
+
42
+ constructor(options?: { linkId?: string; jsInCss?: boolean });
43
+
44
+ get themeSelected(): string | null;
45
+ get allThemesNames(): string[];
46
+ get allThemes(): Record<string, string>;
47
+ get variables(): VarFromTheme;
48
+ get classNames(): ClassNameFromTheme;
49
+ get components(): ComponentsFromTheme;
50
+ get globalStyles(): GlobalStylesFromThemes;
51
+ get mediaQueries(): MediaQueriesFromThemes;
52
+
53
+ set themeSelected(themeName: string);
54
+
55
+ getComponentStyles<T extends ComponentsKey>(params: {
56
+ variant?: string;
57
+ component: T;
58
+ additionalClassNames?: Partial<ComponentSelected<ClassNameFromTheme[T]>>;
59
+ }): ComponentSelected<ClassNameFromTheme[T]>;
60
+ }
@@ -1 +1 @@
1
- import{cssThemes as e,cssClasses as t,cssVars as s,cssAvailableComponents as i,cssGlobalStyles as n,cssMediaQueries as h}from"./stats/stats";export class Provider{#e;#t;#s;#i;#n;#r;#h;#o;#a;#c=(e,t)=>{if("undefined"==typeof document)return;let s=document.getElementById(t);s||(s=document.createElement("link"),s.id=t,s.rel="stylesheet",document.head.appendChild(s));const i=new URL(e,import.meta.url).href;s.href=i};#l=e=>{const{css:t,foreign:s}=e,i=s?.before||[],n=s?.after||[];i.forEach((e,t)=>{const s=`${this.#o}-foreign-before-${t+1}`;this.#c(e,s)}),this.#c(t,this.#o),n.forEach((e,t)=>{const s=`${this.#o}-foreign-after-${t+1}`;this.#c(e,s)})};#m=()=>{"undefined"!=typeof document&&document.querySelectorAll(`link[id^="${this.#o}"]`).forEach(e=>e.remove())};constructor({linkId:r,jsInCss:o}={}){this.#t=e,this.#s=s,this.#i=t,this.#n=i,this.#r=n,this.#h=h,this.#o=r||"kb-styled-link",this.#e=Object.keys(e)[0],this.#a=!!o,this.getComponentStyles=this.getComponentStyles.bind(this),"undefined"!=typeof window&&"undefined"!=typeof document&&this.#a&&(this.#m(),this.#l(this.#t[this.#e]))}get themeSelected(){return this.#e}set themeSelected(e){if(!(e in this.#t))throw new Error(`${e} is not exists`);this.#a&&(this.#m(),this.#l(this.#t[e])),this.#e=e}get allThemesNames(){return Object.keys(this.#t)}get allThemes(){return this.#t}get variables(){return this.#s[this.#e]}get classNames(){return this.#i[this.#e]}get components(){return this.#n[this.#e]}get globalStyles(){return this.#r[this.#e]}get mediaQueries(){return this.#h[this.#e]}getComponentStyles({variant:e,component:t,additionalClassNames:s}){const i=this.#i[this.#e][t.toLocaleUpperCase()];if(!i)return{};const n={},r=!!e&&`$_${e.toLocaleLowerCase().replace(/-/g,"_")}`;if(r&&r in i){const e=i[r];Object.entries(e).forEach(([e,t])=>{e in n||(n[e]=t)})}return Object.entries(i).forEach(([e,t])=>{e.startsWith("$_")||e in n||(n[e]=t)}),s&&Object.keys(s).length&&Object.entries(s).forEach(([e,t])=>{e in n||(n[e]=""),n[e]+=` ${t}`}),n}}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Provider=void 0;var _stats=require("./stats/stats");class Provider{#e;#t;#s;#i;#r;#n;#o;#h;#a;#c=(e,t)=>{if("undefined"==typeof document)return;let s=document.getElementById(t);s||(s=document.createElement("link"),s.id=t,s.rel="stylesheet",document.head.appendChild(s));const i=new URL(e,import.meta.url).href;s.href=i};#l=e=>{const{css:t,foreign:s}=e,i=s?.before||[],r=s?.after||[];i.forEach((e,t)=>{const s=`${this.#h}-foreign-before-${t+1}`;this.#c(e,s)}),this.#c(t,this.#h),r.forEach((e,t)=>{const s=`${this.#h}-foreign-after-${t+1}`;this.#c(e,s)})};#d=()=>{"undefined"!=typeof document&&document.querySelectorAll(`link[id^="${this.#h}"]`).forEach(e=>e.remove())};constructor({linkId:e,jsInCss:t}={}){this.#t=_stats.cssThemes,this.#s=_stats.cssVars,this.#i=_stats.cssClasses,this.#r=_stats.cssAvailableComponents,this.#n=_stats.cssGlobalStyles,this.#o=_stats.cssMediaQueries,this.#h=e||"kb-styled-link",this.#e=Object.keys(_stats.cssThemes)[0],this.#a=!!t,this.getComponentStyles=this.getComponentStyles.bind(this),"undefined"!=typeof window&&"undefined"!=typeof document&&this.#a&&(this.#d(),this.#l(this.#t[this.#e]))}get themeSelected(){return this.#e}set themeSelected(e){if(!(e in this.#t))throw new Error(`${e} is not exists`);this.#a&&(this.#d(),this.#l(this.#t[e])),this.#e=e}get allThemesNames(){return Object.keys(this.#t)}get allThemes(){return this.#t}get variables(){return this.#s[this.#e]}get classNames(){return this.#i[this.#e]}get components(){return this.#r[this.#e]}get globalStyles(){return this.#n[this.#e]}get mediaQueries(){return this.#o[this.#e]}getComponentStyles({variant:e,component:t,additionalClassNames:s}){const i=this.#i[this.#e][t.toLocaleUpperCase()];if(!i)return{};const r={},n=!!e&&`$_${e.toLocaleLowerCase().replace(/-/g,"_")}`;if(n&&n in i){const e=i[n];Object.entries(e).forEach(([e,t])=>{e in r||(r[e]=t)})}return Object.entries(i).forEach(([e,t])=>{e.startsWith("$_")||e in r||(r[e]=t)}),s&&Object.keys(s).length&&Object.entries(s).forEach(([e,t])=>{e in r||(r[e]=""),r[e]+=` ${t}`}),r}}exports.Provider=Provider;