bernova 1.7.9 → 1.7.10

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.7.10
4
+
5
+ ### Patch Changes
6
+
7
+ - Merge pull request #39 from kubit-ui/fix/prevent-the-unmount-links-unnecesarily
8
+
3
9
  ## 1.7.9
4
10
 
5
11
  ### Patch Changes
@@ -55,7 +55,7 @@ export class $_Provider_$ {
55
55
  };
56
56
  /* Bernova provider methods */
57
57
 
58
- constructor({ linkId, jsInCss } = {}) {
58
+ constructor({ linkId, jsInCss, currentTheme } = {}) {
59
59
  this.#themes = cssThemes;
60
60
  this.#themesVariables = cssVars;
61
61
  this.#themesClassNames = cssClasses;
@@ -63,7 +63,10 @@ export class $_Provider_$ {
63
63
  this.#themesGlobalStyles = cssGlobalStyles;
64
64
  this.#themesMediaQueries = cssMediaQueries;
65
65
  this.#linkId = linkId || 'kb-styled-link';
66
- this.#currentTheme = Object.keys(cssThemes)[0];
66
+ this.#currentTheme =
67
+ currentTheme in this.#themes
68
+ ? currentTheme
69
+ : Object.keys(this.#themes)[0];
67
70
  this.#jsInCss = !!jsInCss;
68
71
  this.getComponentStyles = this.getComponentStyles.bind(this);
69
72
 
@@ -82,7 +85,7 @@ export class $_Provider_$ {
82
85
  return this.#currentTheme;
83
86
  }
84
87
  set themeSelected(themeName) {
85
- if (themeName in this.#themes) {
88
+ if (themeName in this.#themes && themeName !== this.#currentTheme) {
86
89
  if (this.#jsInCss) {
87
90
  this.#cleanUpLinks();
88
91
  this.#handlerThemes(this.#themes[themeName]);
@@ -40,7 +40,7 @@ export class $_Provider_$ {
40
40
  };
41
41
  /* Bernova provider methods */
42
42
 
43
- constructor({ linkId, jsInCss } = {}) {
43
+ constructor({ linkId, jsInCss, currentTheme } = {}) {
44
44
  this.#themes = cssThemes;
45
45
  this.#themesVariables = cssVars;
46
46
  this.#themesClassNames = cssClasses;
@@ -48,7 +48,10 @@ export class $_Provider_$ {
48
48
  this.#themesGlobalStyles = cssGlobalStyles;
49
49
  this.#themesMediaQueries = cssMediaQueries;
50
50
  this.#linkId = linkId || 'kb-styled-link';
51
- this.#currentTheme = Object.keys(cssThemes)[0];
51
+ this.#currentTheme =
52
+ currentTheme in this.#themes
53
+ ? currentTheme
54
+ : Object.keys(this.#themes)[0];
52
55
  this.#jsInCss = !!jsInCss;
53
56
  this.getComponentStyles = this.getComponentStyles.bind(this);
54
57
 
@@ -67,7 +70,7 @@ export class $_Provider_$ {
67
70
  return this.#currentTheme;
68
71
  }
69
72
  set themeSelected(themeName) {
70
- if (themeName in this.#themes) {
73
+ if (themeName in this.#themes && themeName !== this.#currentTheme) {
71
74
  if (this.#jsInCss) {
72
75
  this.#cleanUpLinks();
73
76
  this.#handlerThemes(this.#themes[themeName]);
@@ -41,18 +41,22 @@ export declare class $_Provider_$ {
41
41
  #cleanUpLinks: () => void;
42
42
  /* Bernova provider methods */
43
43
 
44
- constructor(options?: { linkId?: string; jsInCss?: boolean });
44
+ constructor(options?: {
45
+ linkId?: string;
46
+ jsInCss?: boolean;
47
+ currentTheme?: ThemesKeys;
48
+ });
45
49
 
46
50
  get themeSelected(): string | null;
47
51
  get allThemesNames(): string[];
48
- get allThemes(): Record<string, string>;
52
+ get allThemes(): Record<ThemesKeys, string>;
49
53
  get variables(): VarFromTheme;
50
54
  get classNames(): ClassNameFromTheme;
51
55
  get components(): ComponentsFromTheme;
52
56
  get globalStyles(): GlobalStylesFromThemes;
53
57
  get mediaQueries(): MediaQueriesFromThemes;
54
58
 
55
- set themeSelected(themeName: string);
59
+ set themeSelected(themeName: ThemesKeys);
56
60
 
57
61
  getComponentStyles<T extends ComponentsKey>(params: {
58
62
  variant?: string;
@@ -1,12 +1,12 @@
1
1
  export class $_Provider_$ {
2
- constructor({ linkId, jsInCss }?: {});
2
+ constructor({ linkId, jsInCss, currentTheme }?: {});
3
3
  getComponentStyles({ variant, component, additionalClassNames }: {
4
4
  variant: any;
5
5
  component: any;
6
6
  additionalClassNames: any;
7
7
  }): {};
8
- set themeSelected(themeName: string);
9
- get themeSelected(): string;
8
+ set themeSelected(themeName: any);
9
+ get themeSelected(): any;
10
10
  get allThemesNames(): string[];
11
11
  get allThemes(): any;
12
12
  get variables(): any;
@@ -1,12 +1,12 @@
1
1
  export class $_Provider_$ {
2
- constructor({ linkId, jsInCss }?: {});
2
+ constructor({ linkId, jsInCss, currentTheme }?: {});
3
3
  getComponentStyles({ variant, component, additionalClassNames }: {
4
4
  variant: any;
5
5
  component: any;
6
6
  additionalClassNames: any;
7
7
  }): {};
8
- set themeSelected(themeName: string);
9
- get themeSelected(): string;
8
+ set themeSelected(themeName: any);
9
+ get themeSelected(): any;
10
10
  get allThemesNames(): string[];
11
11
  get allThemes(): any;
12
12
  get variables(): any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bernova",
3
- "version": "1.7.9",
3
+ "version": "1.7.10",
4
4
  "description": "The best way to write CSS with Javascript syntax",
5
5
  "main": "./dist/src/index.js",
6
6
  "types": "./dist/src/index.d.ts",
@@ -55,7 +55,7 @@ export class $_Provider_$ {
55
55
  };
56
56
  /* Bernova provider methods */
57
57
 
58
- constructor({ linkId, jsInCss } = {}) {
58
+ constructor({ linkId, jsInCss, currentTheme } = {}) {
59
59
  this.#themes = cssThemes;
60
60
  this.#themesVariables = cssVars;
61
61
  this.#themesClassNames = cssClasses;
@@ -63,7 +63,10 @@ export class $_Provider_$ {
63
63
  this.#themesGlobalStyles = cssGlobalStyles;
64
64
  this.#themesMediaQueries = cssMediaQueries;
65
65
  this.#linkId = linkId || 'kb-styled-link';
66
- this.#currentTheme = Object.keys(cssThemes)[0];
66
+ this.#currentTheme =
67
+ currentTheme in this.#themes
68
+ ? currentTheme
69
+ : Object.keys(this.#themes)[0];
67
70
  this.#jsInCss = !!jsInCss;
68
71
  this.getComponentStyles = this.getComponentStyles.bind(this);
69
72
 
@@ -82,7 +85,7 @@ export class $_Provider_$ {
82
85
  return this.#currentTheme;
83
86
  }
84
87
  set themeSelected(themeName) {
85
- if (themeName in this.#themes) {
88
+ if (themeName in this.#themes && themeName !== this.#currentTheme) {
86
89
  if (this.#jsInCss) {
87
90
  this.#cleanUpLinks();
88
91
  this.#handlerThemes(this.#themes[themeName]);
@@ -40,7 +40,7 @@ export class $_Provider_$ {
40
40
  };
41
41
  /* Bernova provider methods */
42
42
 
43
- constructor({ linkId, jsInCss } = {}) {
43
+ constructor({ linkId, jsInCss, currentTheme } = {}) {
44
44
  this.#themes = cssThemes;
45
45
  this.#themesVariables = cssVars;
46
46
  this.#themesClassNames = cssClasses;
@@ -48,7 +48,10 @@ export class $_Provider_$ {
48
48
  this.#themesGlobalStyles = cssGlobalStyles;
49
49
  this.#themesMediaQueries = cssMediaQueries;
50
50
  this.#linkId = linkId || 'kb-styled-link';
51
- this.#currentTheme = Object.keys(cssThemes)[0];
51
+ this.#currentTheme =
52
+ currentTheme in this.#themes
53
+ ? currentTheme
54
+ : Object.keys(this.#themes)[0];
52
55
  this.#jsInCss = !!jsInCss;
53
56
  this.getComponentStyles = this.getComponentStyles.bind(this);
54
57
 
@@ -67,7 +70,7 @@ export class $_Provider_$ {
67
70
  return this.#currentTheme;
68
71
  }
69
72
  set themeSelected(themeName) {
70
- if (themeName in this.#themes) {
73
+ if (themeName in this.#themes && themeName !== this.#currentTheme) {
71
74
  if (this.#jsInCss) {
72
75
  this.#cleanUpLinks();
73
76
  this.#handlerThemes(this.#themes[themeName]);
@@ -41,18 +41,22 @@ export declare class $_Provider_$ {
41
41
  #cleanUpLinks: () => void;
42
42
  /* Bernova provider methods */
43
43
 
44
- constructor(options?: { linkId?: string; jsInCss?: boolean });
44
+ constructor(options?: {
45
+ linkId?: string;
46
+ jsInCss?: boolean;
47
+ currentTheme?: ThemesKeys;
48
+ });
45
49
 
46
50
  get themeSelected(): string | null;
47
51
  get allThemesNames(): string[];
48
- get allThemes(): Record<string, string>;
52
+ get allThemes(): Record<ThemesKeys, string>;
49
53
  get variables(): VarFromTheme;
50
54
  get classNames(): ClassNameFromTheme;
51
55
  get components(): ComponentsFromTheme;
52
56
  get globalStyles(): GlobalStylesFromThemes;
53
57
  get mediaQueries(): MediaQueriesFromThemes;
54
58
 
55
- set themeSelected(themeName: string);
59
+ set themeSelected(themeName: ThemesKeys);
56
60
 
57
61
  getComponentStyles<T extends ComponentsKey>(params: {
58
62
  variant?: string;