bernova 1.7.8 → 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,17 @@
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
+
9
+ ## 1.7.9
10
+
11
+ ### Patch Changes
12
+
13
+ - Merge pull request #38 from kubit-ui/fix/prevent-process-js-logic-fixed
14
+
3
15
  ## 1.7.8
4
16
 
5
17
  ### Patch Changes
@@ -1 +1 @@
1
- const o=require("path"),{getBernovaBuildArgs:e,getBaseOutDir:t}=require("./getFx"),{readConfigData:s}=require("../../src/lib"),{copyCssFiles:i,embedCssForProvider:r,rewriteCssPathInStats:n,writeStatsinBuild:a,writeToolsInBuild:c,rewriteProviderTemplate:l}=require("./writeFx"),{isIterableArray:p,buildCustomOutDirs:u}=require("./utils");async function d(){console.log("Reading configuration...");const d=process.cwd(),{themes:f,provider:v,compilerOptions:y}=await s(o.resolve(d,"bernova.config.json")),{minifyCss:g,minifyJS:m,...h}=y,{css:w,tools:S,provider:C,...b}=e(["--base-out-dir","--root-dir","--prevent-process-js","--prevent-move-js","--prevent-move-dts","--types","--css","--tools","--provider","--embed-css"]),D=(()=>{const o={};return w&&(o.css=w),S&&(o.tools=S),C&&(o.provider=C),Object.keys(o).length>0?o:void 0})(),{baseOutDir:P="",rootDir:O,preventMoveJS:j,preventMoveDTS:B,preventProcessJs:T,types:J,embedCss:q,customOutDirs:M}=u({jsonConfig:h,cliConfig:{...b,customOutDirs:D}}),F=p(J)?J:[""];async function x(){const o=M?.css;if(p(f)){for(const e of f)q?await r({dir:d,theme:e,provider:v}):o&&await n({dir:d,theme:e,css:o,provider:v});await l({dir:d,embedCss:q,provider:v})}}async function I(){const e=M?.css;if(p(f))for(const t of f){const s=e??t.stylesPath??"",r=o.join(P,s);await i({dir:d,cssPath:r,theme:t})}}async function A(){let e=M?.provider??v.path??"";O&&(e=o.relative(O,e));for(const s of F){const i=t({baseOutDir:P,type:s}),r=o.join(i,e,"stats");await a({dir:d,providerPath:v.path,outPath:r,type:s,preventMoveDTS:B,minifyJS:m})}}async function k(){let e=M?.provider??v.path??"";O&&(e=o.relative(O,e));for(const s of F){const i=t({baseOutDir:P,type:s}),r=o.join(i,e);T&&await x(),await c({dir:d,toolsPath:v.path,outPath:r,preventMoveDTS:B,type:s,minifyJS:m})}}return console.log("Configuration read successfully"),{preBuildStyles:x,copyCss:I,copyStats:A,copyProvider:k,fullBuild:async function(){console.log("Copying CSS files..."),await I(),console.log("CSS files copied successfully"),j||(console.log("Copying tools files..."),await async function(){if(p(f))for(const e of f){const{bvTools:s}=e,i=s?.path;if(i){let e=M?.tools??i??"";O&&(e=o.relative(O,e));for(const s of F){const r=t({baseOutDir:P,type:s}),n=o.join(r,e);await c({dir:d,toolsPath:i,outPath:n,preventMoveDTS:B,type:s,minifyJS:m})}}}}(),console.log("Tools files copied successfully"),console.log("Copying provider and stats files..."),await k(),await A(),console.log("Provider and stats files copied successfully"))}}}module.exports={bvBuildScript:d};
1
+ const o=require("path"),{getBernovaBuildArgs:e,getBaseOutDir:t}=require("./getFx"),{readConfigData:s}=require("../../src/lib"),{copyCssFiles:i,embedCssForProvider:r,rewriteCssPathInStats:n,writeStatsinBuild:a,writeToolsInBuild:c,rewriteProviderTemplate:l}=require("./writeFx"),{isIterableArray:p,buildCustomOutDirs:u}=require("./utils");async function d(){console.log("Reading configuration...");const d=process.cwd(),{themes:f,provider:v,compilerOptions:y}=await s(o.resolve(d,"bernova.config.json")),{minifyCss:g,minifyJS:m,...h}=y,{css:w,tools:S,provider:C,...b}=e(["--base-out-dir","--root-dir","--prevent-process-js","--prevent-move-js","--prevent-move-dts","--types","--css","--tools","--provider","--embed-css"]),D=(()=>{const o={};return w&&(o.css=w),S&&(o.tools=S),C&&(o.provider=C),Object.keys(o).length>0?o:void 0})(),{baseOutDir:P="",rootDir:O,preventMoveJS:j,preventMoveDTS:B,preventProcessJs:T,types:J,embedCss:q,customOutDirs:M}=u({jsonConfig:h,cliConfig:{...b,customOutDirs:D}}),F=p(J)?J:[""];async function x(){const o=M?.css;if(p(f)){for(const e of f)q?await r({dir:d,theme:e,provider:v}):o&&await n({dir:d,theme:e,css:o,provider:v});await l({dir:d,embedCss:q,provider:v})}}async function I(){const e=M?.css;if(p(f))for(const t of f){const s=e??t.stylesPath??"",r=o.join(P,s);await i({dir:d,cssPath:r,theme:t})}}async function A(){let e=M?.provider??v.path??"";O&&(e=o.relative(O,e));for(const s of F){const i=t({baseOutDir:P,type:s}),r=o.join(i,e,"stats");await a({dir:d,providerPath:v.path,outPath:r,type:s,preventMoveDTS:B,minifyJS:m})}}async function k(){let e=M?.provider??v.path??"";O&&(e=o.relative(O,e));for(const s of F){const i=t({baseOutDir:P,type:s}),r=o.join(i,e);T||await x(),await c({dir:d,toolsPath:v.path,outPath:r,preventMoveDTS:B,type:s,minifyJS:m})}}return console.log("Configuration read successfully"),{preBuildStyles:x,copyCss:I,copyStats:A,copyProvider:k,fullBuild:async function(){console.log("Copying CSS files..."),await I(),console.log("CSS files copied successfully"),j||(console.log("Copying tools files..."),await async function(){if(p(f))for(const e of f){const{bvTools:s}=e,i=s?.path;if(i){let e=M?.tools??i??"";O&&(e=o.relative(O,e));for(const s of F){const r=t({baseOutDir:P,type:s}),n=o.join(r,e);await c({dir:d,toolsPath:i,outPath:n,preventMoveDTS:B,type:s,minifyJS:m})}}}}(),console.log("Tools files copied successfully"),console.log("Copying provider and stats files..."),await k(),await A(),console.log("Provider and stats files copied successfully"))}}}module.exports={bvBuildScript:d};
@@ -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.8",
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;