@salty-css/core 0.0.1-alpha.189 → 0.0.1-alpha.190

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 (39) hide show
  1. package/bin/main.cjs +1 -1
  2. package/bin/main.js +1 -1
  3. package/compiler/index.cjs +1 -1
  4. package/compiler/index.d.ts +12 -7
  5. package/compiler/index.js +9 -10
  6. package/config/index.cjs +1 -1
  7. package/config/index.js +1 -1
  8. package/css/index.cjs +1 -1
  9. package/css/index.d.ts +0 -1
  10. package/css/index.js +9 -43
  11. package/generators/class-name-generator.d.ts +6 -0
  12. package/generators/index.cjs +1 -0
  13. package/generators/index.d.ts +2 -0
  14. package/generators/index.js +75 -0
  15. package/generators/styled-generator.d.ts +19 -0
  16. package/generators/styles-generator.d.ts +18 -0
  17. package/index-BiZBc7HK.js +452 -0
  18. package/index-ptxZPIoq.cjs +31 -0
  19. package/package.json +1 -1
  20. package/parsers/index.d.ts +5 -0
  21. package/{generator → parsers}/parser-types.d.ts +1 -1
  22. package/server/index.cjs +1 -1
  23. package/server/index.js +1 -1
  24. package/types/index.d.ts +2 -2
  25. package/css/class-name.d.ts +0 -16
  26. package/generator/index.cjs +0 -1
  27. package/generator/index.d.ts +0 -1
  28. package/generator/index.js +0 -76
  29. package/generator/style-generator.d.ts +0 -36
  30. package/index-D9fpGzLy.cjs +0 -30
  31. package/index-_9I4QIPW.js +0 -433
  32. package/parse-templates-DRKlN-pP.js +0 -27
  33. package/parse-templates-VIvmVb52.cjs +0 -2
  34. /package/{factories → parsers}/index.cjs +0 -0
  35. /package/{factories → parsers}/index.js +0 -0
  36. /package/{generator → parsers}/parse-modifiers.d.ts +0 -0
  37. /package/{generator → parsers}/parse-styles.d.ts +0 -0
  38. /package/{generator → parsers}/parse-templates.d.ts +0 -0
  39. /package/{generator → parsers}/parse-tokens.d.ts +0 -0
package/bin/main.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const te=require("commander"),G=require("fs"),s=require("fs/promises"),n=require("path"),ne=require("ejs"),t=require("../index-D9fpGzLy.cjs"),ie=require("../pascal-case-iWoaJWwT.cjs"),se=require("child_process"),oe=require("ora");var z=typeof document<"u"?document.currentScript:null;const X=y=>new Promise((C,P)=>{se.exec(y,F=>{if(F)return P(F);C()})}),I=async(...y)=>{const C=y.map(b=>b.replace("-D","").split("@").slice(0,-1).join("@").trim()).join(", "),P=oe(`Installing packages: ${C}`).start(),F=y.join(" ");await X(`npm install ${F}`),P.succeed(`Installed packages: ${C}`)},ae=()=>G.existsSync(n.join(process.cwd(),"node_modules",".bin","prettier"));async function S(y){try{if(!ae())return;await X(`./node_modules/.bin/prettier --write "${y}"`),t.logger.info(`Formatted ${y} with Prettier`)}catch(C){t.logger.error(`Error formatting ${y} with Prettier:`,C)}}async function re(){const y=new te.Command;y.name("salty-css").description("Salty-CSS CLI tool to help with annoying configuration tasks.");const C={"salty.config.ts":Promise.resolve().then(()=>require("../salty.config-Dk6ZcCxI.cjs")),"saltygen/index.css":Promise.resolve().then(()=>require("../index-84Wroia-.cjs")),"react/react-styled-file.ts":Promise.resolve().then(()=>require("../react-styled-file-Dkubsz-U.cjs")),"react/react-vanilla-file.ts":Promise.resolve().then(()=>require("../react-vanilla-file-CG_WJLam.cjs"))},P=async(i,a)=>{const{default:l}=await C[i],u=ne.render(l,a);return{fileName:i,content:u}},F=async()=>{const i=n.join(process.cwd(),".saltyrc.json");return await s.readFile(i,"utf-8").then(JSON.parse).catch(()=>({}))},b=n.join(process.cwd(),"package.json"),N=async(i=b)=>{const a=await s.readFile(i,"utf-8").then(JSON.parse).catch(()=>{});if(!a)throw"Could not read package.json file!";return a},Y=async(i,a=b)=>{typeof i=="object"&&(i=JSON.stringify(i,null,2)),await s.writeFile(a,i)},B=async()=>{const i=new URL("../package.json",typeof document>"u"?require("url").pathToFileURL(__filename).href:z&&z.tagName.toUpperCase()==="SCRIPT"&&z.src||new URL("bin/main.cjs",document.baseURI).href);return N(i)},V=await(async()=>(await F()).defaultProject)(),$=await B(),D={core:`@salty-css/core@${$.version}`,react:`@salty-css/react@${$.version}`,eslintConfigCore:`@salty-css/eslint-config-core@${$.version}`,vite:`@salty-css/vite@${$.version}`,next:`@salty-css/next@${$.version}`},R=i=>{const a=i==="."?"":i,l=process.cwd();return n.join(l,a)};y.command("init [directory]").description("Initialize a new Salty-CSS project.").option("-d, --dir <dir>","Project directory to initialize the project in.").option("--css-file <css-file>","Existing CSS file where to import the generated CSS. Path must be relative to the given project directory.").option("--skip-install","Skip installing dependencies.").action(async function(i="."){if(!await N().catch(()=>{}))return t.logError("Salty CSS project must be initialized in a directory with a package.json file.");t.logger.info("Initializing a new Salty-CSS project!");const{dir:l=i,cssFile:u,skipInstall:p}=this.opts();if(!l)return t.logError("Project directory must be provided. Add it as the first argument after init command or use the --dir option.");p||await I(D.core,D.react);const f=process.cwd(),r=R(l),T=await Promise.all([P("salty.config.ts"),P("saltygen/index.css")]);await s.mkdir(r,{recursive:!0});const m=T.map(async({fileName:e,content:g})=>{const c=n.join(r,e);if(await s.readFile(c,"utf-8").catch(()=>{})!==void 0){t.logger.debug("File already exists: "+c);return}const k=e.split("/").slice(0,-1).join("/");k&&await s.mkdir(n.join(r,k),{recursive:!0}),t.logger.info("Creating file: "+c),await s.writeFile(c,g),await S(c)});await Promise.all(m);const w=n.relative(f,r)||".",h=n.join(f,".saltyrc.json"),d=await s.readFile(h,"utf-8").catch(()=>{});if(d===void 0){t.logger.info("Creating file: "+h);const g=JSON.stringify({$schema:"./node_modules/@salty-css/core/.saltyrc.schema.json",info:"This file is used to define projects and their configurations for Salty CSS cli. Do not delete, modify or add this file to .gitignore.",defaultProject:w,projects:[{dir:w,framework:"react"}]},null,2);await s.writeFile(h,g),await S(h)}else{const e=JSON.parse(d),g=(e==null?void 0:e.projects)||[];if(g.findIndex(o=>o.dir===w)===-1){g.push({dir:w,framework:"react"}),e.projects=[...g];const o=JSON.stringify(e,null,2);o!==d&&(t.logger.info("Edit file: "+h),await s.writeFile(h,o),await S(h))}}const j=n.join(f,".gitignore"),U=await s.readFile(j,"utf-8").catch(()=>{});U!==void 0&&(U.includes("saltygen")||(t.logger.info("Edit file: "+j),await s.writeFile(j,U+`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const te=require("commander"),G=require("fs"),s=require("fs/promises"),n=require("path"),ne=require("ejs"),t=require("../index-ptxZPIoq.cjs"),ie=require("../pascal-case-iWoaJWwT.cjs"),se=require("child_process"),oe=require("ora");var z=typeof document<"u"?document.currentScript:null;const X=y=>new Promise((C,P)=>{se.exec(y,F=>{if(F)return P(F);C()})}),I=async(...y)=>{const C=y.map(b=>b.replace("-D","").split("@").slice(0,-1).join("@").trim()).join(", "),P=oe(`Installing packages: ${C}`).start(),F=y.join(" ");await X(`npm install ${F}`),P.succeed(`Installed packages: ${C}`)},ae=()=>G.existsSync(n.join(process.cwd(),"node_modules",".bin","prettier"));async function S(y){try{if(!ae())return;await X(`./node_modules/.bin/prettier --write "${y}"`),t.logger.info(`Formatted ${y} with Prettier`)}catch(C){t.logger.error(`Error formatting ${y} with Prettier:`,C)}}async function re(){const y=new te.Command;y.name("salty-css").description("Salty-CSS CLI tool to help with annoying configuration tasks.");const C={"salty.config.ts":Promise.resolve().then(()=>require("../salty.config-Dk6ZcCxI.cjs")),"saltygen/index.css":Promise.resolve().then(()=>require("../index-84Wroia-.cjs")),"react/react-styled-file.ts":Promise.resolve().then(()=>require("../react-styled-file-Dkubsz-U.cjs")),"react/react-vanilla-file.ts":Promise.resolve().then(()=>require("../react-vanilla-file-CG_WJLam.cjs"))},P=async(i,a)=>{const{default:l}=await C[i],u=ne.render(l,a);return{fileName:i,content:u}},F=async()=>{const i=n.join(process.cwd(),".saltyrc.json");return await s.readFile(i,"utf-8").then(JSON.parse).catch(()=>({}))},b=n.join(process.cwd(),"package.json"),N=async(i=b)=>{const a=await s.readFile(i,"utf-8").then(JSON.parse).catch(()=>{});if(!a)throw"Could not read package.json file!";return a},Y=async(i,a=b)=>{typeof i=="object"&&(i=JSON.stringify(i,null,2)),await s.writeFile(a,i)},B=async()=>{const i=new URL("../package.json",typeof document>"u"?require("url").pathToFileURL(__filename).href:z&&z.tagName.toUpperCase()==="SCRIPT"&&z.src||new URL("bin/main.cjs",document.baseURI).href);return N(i)},V=await(async()=>(await F()).defaultProject)(),$=await B(),D={core:`@salty-css/core@${$.version}`,react:`@salty-css/react@${$.version}`,eslintConfigCore:`@salty-css/eslint-config-core@${$.version}`,vite:`@salty-css/vite@${$.version}`,next:`@salty-css/next@${$.version}`},R=i=>{const a=i==="."?"":i,l=process.cwd();return n.join(l,a)};y.command("init [directory]").description("Initialize a new Salty-CSS project.").option("-d, --dir <dir>","Project directory to initialize the project in.").option("--css-file <css-file>","Existing CSS file where to import the generated CSS. Path must be relative to the given project directory.").option("--skip-install","Skip installing dependencies.").action(async function(i="."){if(!await N().catch(()=>{}))return t.logError("Salty CSS project must be initialized in a directory with a package.json file.");t.logger.info("Initializing a new Salty-CSS project!");const{dir:l=i,cssFile:u,skipInstall:p}=this.opts();if(!l)return t.logError("Project directory must be provided. Add it as the first argument after init command or use the --dir option.");p||await I(D.core,D.react);const f=process.cwd(),r=R(l),T=await Promise.all([P("salty.config.ts"),P("saltygen/index.css")]);await s.mkdir(r,{recursive:!0});const m=T.map(async({fileName:e,content:g})=>{const c=n.join(r,e);if(await s.readFile(c,"utf-8").catch(()=>{})!==void 0){t.logger.debug("File already exists: "+c);return}const k=e.split("/").slice(0,-1).join("/");k&&await s.mkdir(n.join(r,k),{recursive:!0}),t.logger.info("Creating file: "+c),await s.writeFile(c,g),await S(c)});await Promise.all(m);const w=n.relative(f,r)||".",h=n.join(f,".saltyrc.json"),d=await s.readFile(h,"utf-8").catch(()=>{});if(d===void 0){t.logger.info("Creating file: "+h);const g=JSON.stringify({$schema:"./node_modules/@salty-css/core/.saltyrc.schema.json",info:"This file is used to define projects and their configurations for Salty CSS cli. Do not delete, modify or add this file to .gitignore.",defaultProject:w,projects:[{dir:w,framework:"react"}]},null,2);await s.writeFile(h,g),await S(h)}else{const e=JSON.parse(d),g=(e==null?void 0:e.projects)||[];if(g.findIndex(o=>o.dir===w)===-1){g.push({dir:w,framework:"react"}),e.projects=[...g];const o=JSON.stringify(e,null,2);o!==d&&(t.logger.info("Edit file: "+h),await s.writeFile(h,o),await S(h))}}const j=n.join(f,".gitignore"),U=await s.readFile(j,"utf-8").catch(()=>{});U!==void 0&&(U.includes("saltygen")||(t.logger.info("Edit file: "+j),await s.writeFile(j,U+`
2
2
 
3
3
  # Salty-CSS
4
4
  saltygen
package/bin/main.js CHANGED
@@ -3,7 +3,7 @@ import { existsSync as K } from "fs";
3
3
  import { mkdir as q, readFile as C, writeFile as w } from "fs/promises";
4
4
  import { join as i, relative as z, parse as re, format as ee } from "path";
5
5
  import { render as ce } from "ejs";
6
- import { l as t, a as h, g as te } from "../index-_9I4QIPW.js";
6
+ import { l as t, a as h, g as te } from "../index-BiZBc7HK.js";
7
7
  import { p as le } from "../pascal-case-BQpR5PdN.js";
8
8
  import { exec as de } from "child_process";
9
9
  import fe from "ora";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("esbuild");require("child_process");require("../dash-case-BJEkFEGQ.cjs");require("path");require("fs");require("fs/promises");require("../parse-styles-3zK35muR.cjs");require("../parse-templates-VIvmVb52.cjs");const e=require("../index-D9fpGzLy.cjs");require("../css/merge.cjs");exports.compileSaltyFile=e.compileSaltyFile;exports.generateConfigStyles=e.generateConfigStyles;exports.generateCss=e.generateCss;exports.generateFile=e.generateFile;exports.isSaltyFile=e.isSaltyFile;exports.minimizeFile=e.minimizeFile;exports.saltyFileExtensions=e.saltyFileExtensions;exports.saltyFileRegExp=e.saltyFileRegExp;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("esbuild");require("child_process");require("../dash-case-BJEkFEGQ.cjs");require("path");require("fs");require("fs/promises");require("../parse-styles-3zK35muR.cjs");const e=require("../index-ptxZPIoq.cjs");require("../css/merge.cjs");exports.compileSaltyFile=e.compileSaltyFile;exports.generateConfigStyles=e.generateConfigStyles;exports.generateCss=e.generateCss;exports.generateFile=e.generateFile;exports.isSaltyFile=e.isSaltyFile;exports.minimizeFile=e.minimizeFile;exports.saltyFileExtensions=e.saltyFileExtensions;exports.saltyFileRegExp=e.saltyFileRegExp;
@@ -1,16 +1,21 @@
1
- import { StyleComponentGenerator } from '../generator/style-generator';
2
1
  import { MediaQueryFactory } from '../css/media';
3
- import { ClassNameFactory } from '../css';
4
2
  import { GlobalStylesFactory, TemplatesFactory, VariablesFactory } from '../factories';
5
- interface GeneratorResult<V extends object> {
3
+ import { StyledGenerator, ClassNameGenerator } from '../generators';
4
+ import { StylesGenerator } from '../generators/styles-generator';
5
+ interface GeneratorResult<V extends StylesGenerator> {
6
+ generator: V;
7
+ src: string;
8
+ name: string;
9
+ }
10
+ interface FunctionResult<V extends object> {
6
11
  value: V;
7
12
  src: string;
8
13
  name: string;
9
14
  }
10
15
  interface GenerationResults {
11
- components: GeneratorResult<StyleComponentGenerator>[];
12
- classNames: GeneratorResult<ClassNameFactory>[];
13
- keyframes: GeneratorResult<{
16
+ components: GeneratorResult<StyledGenerator>[];
17
+ classNames: GeneratorResult<ClassNameGenerator>[];
18
+ keyframes: FunctionResult<{
14
19
  animationName: string;
15
20
  css: string;
16
21
  }>[];
@@ -25,7 +30,7 @@ export declare const isSaltyFile: (file: string, additional?: string[]) => boole
25
30
  export declare const generateConfigStyles: (dirname: string, generationResults: GenerationResults) => Promise<void>;
26
31
  export declare const compileSaltyFile: (dirname: string, sourceFilePath: string, outputDirectory: string) => Promise<{
27
32
  [key: string]: {
28
- generator: StyleComponentGenerator;
33
+ generator: any;
29
34
  isClassName?: boolean;
30
35
  isMedia?: boolean;
31
36
  isGlobalDefine?: boolean;
package/compiler/index.js CHANGED
@@ -5,16 +5,15 @@ import "path";
5
5
  import "fs";
6
6
  import "fs/promises";
7
7
  import "../parse-styles-DrLhKtqW.js";
8
- import "../parse-templates-DRKlN-pP.js";
9
- import { d as g, c as F, g as y, e as x, i as S, m as c, s as f, b as C } from "../index-_9I4QIPW.js";
8
+ import { d as n, c as g, g as F, e as y, i as x, m as S, s as c, b as f } from "../index-BiZBc7HK.js";
10
9
  import "../css/merge.js";
11
10
  export {
12
- g as compileSaltyFile,
13
- F as generateConfigStyles,
14
- y as generateCss,
15
- x as generateFile,
16
- S as isSaltyFile,
17
- c as minimizeFile,
18
- f as saltyFileExtensions,
19
- C as saltyFileRegExp
11
+ n as compileSaltyFile,
12
+ g as generateConfigStyles,
13
+ F as generateCss,
14
+ y as generateFile,
15
+ x as isSaltyFile,
16
+ S as minimizeFile,
17
+ c as saltyFileExtensions,
18
+ f as saltyFileRegExp
20
19
  };
package/config/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../factories/index.cjs"),t=a=>a;exports.GlobalStylesFactory=e.GlobalStylesFactory;exports.TemplatesFactory=e.TemplatesFactory;exports.VariablesFactory=e.VariablesFactory;exports.defineGlobalStyles=e.defineGlobalStyles;exports.defineTemplates=e.defineTemplates;exports.defineVariables=e.defineVariables;exports.defineConfig=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../parsers/index.cjs"),l=a=>a;exports.GlobalStylesFactory=e.GlobalStylesFactory;exports.TemplatesFactory=e.TemplatesFactory;exports.VariablesFactory=e.VariablesFactory;exports.defineGlobalStyles=e.defineGlobalStyles;exports.defineTemplates=e.defineTemplates;exports.defineVariables=e.defineVariables;exports.defineConfig=l;
package/config/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { GlobalStylesFactory as o, TemplatesFactory as r, VariablesFactory as i, defineGlobalStyles as n, defineTemplates as s, defineVariables as f } from "../factories/index.js";
1
+ import { GlobalStylesFactory as o, TemplatesFactory as r, VariablesFactory as i, defineGlobalStyles as n, defineTemplates as s, defineVariables as f } from "../parsers/index.js";
2
2
  const a = (e) => e;
3
3
  export {
4
4
  o as GlobalStylesFactory,
package/css/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var n=Object.defineProperty;var h=(a,s,e)=>s in a?n(a,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[s]=e;var r=(a,s,e)=>h(a,typeof s!="symbol"?s+"":s,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./keyframes.cjs"),i=require("./media.cjs"),l=require("./token.cjs"),u=require("./merge.cjs"),d=require("../parse-styles-3zK35muR.cjs"),c=require("../dash-case-BJEkFEGQ.cjs");class y{constructor(s){r(this,"_isProd");r(this,"_callerName");this.params=s}get hash(){return c.toHash(this.params.base||this.params)}get cssClassName(){return this.hash}get classNames(){const s=[this.hash],{className:e}=this.params;return e&&s.push(e),s.join(" ")}get cssFileName(){return this._callerName?`cl_${c.dashCase(this._callerName)}-${this.hash}.css`:`${this.hash}.css`}get css(){const{base:s={},variants:e={},compoundVariants:t=[]}=this.params,o={...s,variants:e,compoundVariants:t};return d.parseStyles(o,`.${this.cssClassName}`)}_withBuildContext(s){const{name:e,prod:t}=s;return this._isProd=t,this._callerName=e,this}}exports.keyframes=m.keyframes;exports.MediaQueryFactory=i.MediaQueryFactory;exports.media=i.media;exports.token=l.token;exports.mergeStyles=u.mergeStyles;exports.ClassNameFactory=y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./keyframes.cjs"),e=require("./media.cjs"),s=require("./token.cjs"),t=require("./merge.cjs");exports.keyframes=r.keyframes;exports.MediaQueryFactory=e.MediaQueryFactory;exports.media=e.media;exports.token=s.token;exports.mergeStyles=t.mergeStyles;
package/css/index.d.ts CHANGED
@@ -2,4 +2,3 @@ export * from './keyframes';
2
2
  export * from './media';
3
3
  export * from './token';
4
4
  export * from './merge';
5
- export * from './class-name';
package/css/index.js CHANGED
@@ -1,45 +1,11 @@
1
- var i = Object.defineProperty;
2
- var h = (t, s, a) => s in t ? i(t, s, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[s] = a;
3
- var r = (t, s, a) => h(t, typeof s != "symbol" ? s + "" : s, a);
4
- import { keyframes as y } from "./keyframes.js";
5
- import { MediaQueryFactory as x, media as C } from "./media.js";
6
- import { token as b } from "./token.js";
7
- import { mergeStyles as S } from "./merge.js";
8
- import { p as c } from "../parse-styles-DrLhKtqW.js";
9
- import { t as m, d as n } from "../dash-case-DBThphLm.js";
10
- class N {
11
- constructor(s) {
12
- r(this, "_isProd");
13
- r(this, "_callerName");
14
- this.params = s;
15
- }
16
- get hash() {
17
- return m(this.params.base || this.params);
18
- }
19
- get cssClassName() {
20
- return this.hash;
21
- }
22
- get classNames() {
23
- const s = [this.hash], { className: a } = this.params;
24
- return a && s.push(a), s.join(" ");
25
- }
26
- get cssFileName() {
27
- return this._callerName ? `cl_${n(this._callerName)}-${this.hash}.css` : `${this.hash}.css`;
28
- }
29
- get css() {
30
- const { base: s = {}, variants: a = {}, compoundVariants: e = [] } = this.params, o = { ...s, variants: a, compoundVariants: e };
31
- return c(o, `.${this.cssClassName}`);
32
- }
33
- _withBuildContext(s) {
34
- const { name: a, prod: e } = s;
35
- return this._isProd = e, this._callerName = a, this;
36
- }
37
- }
1
+ import { keyframes as o } from "./keyframes.js";
2
+ import { MediaQueryFactory as t, media as f } from "./media.js";
3
+ import { token as p } from "./token.js";
4
+ import { mergeStyles as y } from "./merge.js";
38
5
  export {
39
- N as ClassNameFactory,
40
- x as MediaQueryFactory,
41
- y as keyframes,
42
- C as media,
43
- S as mergeStyles,
44
- b as token
6
+ t as MediaQueryFactory,
7
+ o as keyframes,
8
+ f as media,
9
+ y as mergeStyles,
10
+ p as token
45
11
  };
@@ -0,0 +1,6 @@
1
+ import { StylesGenerator } from './styles-generator';
2
+ import { StyledParams } from '../types';
3
+ export declare class ClassNameGenerator<const STYLE_PARAMS extends StyledParams = StyledParams> extends StylesGenerator<STYLE_PARAMS> {
4
+ _params: STYLE_PARAMS;
5
+ constructor(_params: STYLE_PARAMS);
6
+ }
@@ -0,0 +1 @@
1
+ "use strict";var b=Object.defineProperty;var N=(e,s,t)=>s in e?b(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t;var u=(e,s,t)=>N(e,typeof s!="symbol"?s+"":s,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("../parse-styles-3zK35muR.cjs"),m=require("../dash-case-BJEkFEGQ.cjs");class f{constructor(s){u(this,"buildContext",{});this.params=s}get hash(){return m.toHash(this.params.base||this.params)}get cssClassName(){return this.hash}get classNames(){const s=[this.hash],{className:t}=this.params;return typeof t=="string"&&s.push(t),typeof t=="object"&&s.push(...t),s.join(" ")}get cssFileName(){const{callerName:s}=this.buildContext;return s?`cl_${m.dashCase(s)}-${this.hash}.css`:`${this.hash}.css`}get css(){const{base:s={},variants:t={},compoundVariants:n=[]}=this.params,{config:i}=this.buildContext,o={...s,variants:t,compoundVariants:n};return C.parseStyles(o,`.${this.cssClassName}`,i)}_withBuildContext(s){return this.buildContext=s,this}}class S extends f{constructor(s){super(s),this._params=s}}class v extends f{constructor(s,t){super(t),this.tagName=s,this._params=t}get priority(){var s;return typeof this.tagName=="function"||typeof this.tagName=="object"?(((s=this.tagName.generator)==null?void 0:s.priority)||0)+1:0}get clientProps(){const{element:s,variants:t={},compoundVariants:n=[],defaultVariants:i={},defaultProps:o={},passProps:h}=this.params,{callerName:y,isProduction:g}=this.buildContext,c=new Set([]),l=a=>{const r=i[a];r!==void 0?c.add(`${a}=${String(r)}`):c.add(a)};Object.keys(t).forEach(l),n.map(a=>Object.keys(a).forEach(l));const d=new Set([]);if(this.params.base){const a=JSON.stringify(this.params.base).match(/\{props\.([\w\d]+)\}/gi);a&&a.forEach(r=>{const p=r.replace(/\{props\.([\w\d]+)\}/gi,"$1");p&&d.add(p)})}return{element:s,variantKeys:[...c],propValueKeys:[...d],passProps:h,defaultProps:o,attr:{"data-component-name":g?void 0:y}}}}exports.ClassNameGenerator=S;exports.StyledGenerator=v;
@@ -0,0 +1,2 @@
1
+ export * from './class-name-generator';
2
+ export * from './styled-generator';
@@ -0,0 +1,75 @@
1
+ var y = Object.defineProperty;
2
+ var b = (e, s, t) => s in e ? y(e, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[s] = t;
3
+ var u = (e, s, t) => b(e, typeof s != "symbol" ? s + "" : s, t);
4
+ import { p as N } from "../parse-styles-DrLhKtqW.js";
5
+ import { t as C, d as x } from "../dash-case-DBThphLm.js";
6
+ class m {
7
+ constructor(s) {
8
+ u(this, "buildContext", {});
9
+ this.params = s;
10
+ }
11
+ get hash() {
12
+ return C(this.params.base || this.params);
13
+ }
14
+ get cssClassName() {
15
+ return this.hash;
16
+ }
17
+ get classNames() {
18
+ const s = [this.hash], { className: t } = this.params;
19
+ return typeof t == "string" && s.push(t), typeof t == "object" && s.push(...t), s.join(" ");
20
+ }
21
+ get cssFileName() {
22
+ const { callerName: s } = this.buildContext;
23
+ return s ? `cl_${x(s)}-${this.hash}.css` : `${this.hash}.css`;
24
+ }
25
+ get css() {
26
+ const { base: s = {}, variants: t = {}, compoundVariants: i = [] } = this.params, { config: n } = this.buildContext, o = { ...s, variants: t, compoundVariants: i };
27
+ return N(o, `.${this.cssClassName}`, n);
28
+ }
29
+ _withBuildContext(s) {
30
+ return this.buildContext = s, this;
31
+ }
32
+ }
33
+ class $ extends m {
34
+ constructor(s) {
35
+ super(s), this._params = s;
36
+ }
37
+ }
38
+ class j extends m {
39
+ constructor(s, t) {
40
+ super(t), this.tagName = s, this._params = t;
41
+ }
42
+ get priority() {
43
+ var s;
44
+ return typeof this.tagName == "function" || typeof this.tagName == "object" ? (((s = this.tagName.generator) == null ? void 0 : s.priority) || 0) + 1 : 0;
45
+ }
46
+ get clientProps() {
47
+ const { element: s, variants: t = {}, compoundVariants: i = [], defaultVariants: n = {}, defaultProps: o = {}, passProps: h } = this.params, { callerName: f, isProduction: g } = this.buildContext, c = /* @__PURE__ */ new Set([]), p = (a) => {
48
+ const r = n[a];
49
+ r !== void 0 ? c.add(`${a}=${String(r)}`) : c.add(a);
50
+ };
51
+ Object.keys(t).forEach(p), i.map((a) => Object.keys(a).forEach(p));
52
+ const d = /* @__PURE__ */ new Set([]);
53
+ if (this.params.base) {
54
+ const a = JSON.stringify(this.params.base).match(/\{props\.([\w\d]+)\}/gi);
55
+ a && a.forEach((r) => {
56
+ const l = r.replace(/\{props\.([\w\d]+)\}/gi, "$1");
57
+ l && d.add(l);
58
+ });
59
+ }
60
+ return {
61
+ element: s,
62
+ variantKeys: [...c],
63
+ propValueKeys: [...d],
64
+ passProps: h,
65
+ defaultProps: o,
66
+ attr: {
67
+ "data-component-name": g ? void 0 : f
68
+ }
69
+ };
70
+ }
71
+ }
72
+ export {
73
+ $ as ClassNameGenerator,
74
+ j as StyledGenerator
75
+ };
@@ -0,0 +1,19 @@
1
+ import { StylesGenerator } from './styles-generator';
2
+ import { StyledParams, Tag } from '../types';
3
+ export interface StyledGeneratorClientProps {
4
+ element?: string;
5
+ variantKeys?: string[];
6
+ propValueKeys?: string[];
7
+ passProps?: boolean | string | string[];
8
+ defaultProps?: Record<PropertyKey, unknown>;
9
+ attr: {
10
+ [key: string]: any;
11
+ };
12
+ }
13
+ export declare class StyledGenerator<const STYLE_PARAMS extends StyledParams = StyledParams> extends StylesGenerator<STYLE_PARAMS> {
14
+ tagName: Tag<any>;
15
+ _params: STYLE_PARAMS;
16
+ constructor(tagName: Tag<any>, _params: STYLE_PARAMS);
17
+ get priority(): number;
18
+ get clientProps(): StyledGeneratorClientProps;
19
+ }
@@ -0,0 +1,18 @@
1
+ import { StyledParams } from '../types';
2
+ import { SaltyConfig } from '../types/config-types';
3
+ export interface StylesGeneratorBuildTimeProps {
4
+ callerName?: string;
5
+ isProduction?: boolean;
6
+ config?: SaltyConfig;
7
+ }
8
+ export declare class StylesGenerator<const STYLE_PARAMS extends StyledParams = StyledParams> {
9
+ params: STYLE_PARAMS;
10
+ buildContext: StylesGeneratorBuildTimeProps;
11
+ constructor(params: STYLE_PARAMS);
12
+ get hash(): string;
13
+ get cssClassName(): string;
14
+ get classNames(): string;
15
+ get cssFileName(): string;
16
+ get css(): string;
17
+ _withBuildContext(context: StylesGeneratorBuildTimeProps): this;
18
+ }