@salty-css/core 0.0.1-alpha.201 → 0.0.1-alpha.202

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/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-BtsgjRXm.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-CTYuOIyS.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-DVzNO1Qt.js";
6
+ import { l as t, a as h, g as te } from "../index-B-fI-Hqk.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-D_gL6efj.cjs");const e=require("../index-BtsgjRXm.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-DhDStS4F.cjs");const e=require("../index-CTYuOIyS.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;
@@ -3,18 +3,21 @@ export declare const saltyFileRegExp: (additional?: string[]) => RegExp;
3
3
  export declare const isSaltyFile: (file: string, additional?: string[]) => boolean;
4
4
  export declare const generateConfigStyles: (dirname: string, configFiles: Set<string>) => Promise<void>;
5
5
  export declare const compileSaltyFile: (dirname: string, sourceFilePath: string, outputDirectory: string) => Promise<{
6
- [key: string]: {
7
- generator: any;
8
- isClassName?: boolean;
9
- isMedia?: boolean;
10
- isGlobalDefine?: boolean;
11
- isDefineVariables?: boolean;
12
- isDefineTemplates?: boolean;
13
- isKeyframes?: boolean;
14
- animationName?: string;
15
- css?: string;
16
- styles?: any;
6
+ contents: {
7
+ [key: string]: {
8
+ generator: any;
9
+ isClassName?: boolean;
10
+ isMedia?: boolean;
11
+ isGlobalDefine?: boolean;
12
+ isDefineVariables?: boolean;
13
+ isDefineTemplates?: boolean;
14
+ isKeyframes?: boolean;
15
+ animationName?: string;
16
+ css?: Promise<string>;
17
+ styles?: any;
18
+ };
17
19
  };
20
+ outputFilePath: string;
18
21
  }>;
19
22
  export declare const generateCss: (dirname: string, prod?: boolean, clean?: boolean) => Promise<void>;
20
23
  export declare const generateFile: (dirname: string, file: string) => Promise<void>;
package/compiler/index.js CHANGED
@@ -4,8 +4,8 @@ import "../dash-case-DBThphLm.js";
4
4
  import "path";
5
5
  import "fs";
6
6
  import "fs/promises";
7
- import "../parse-styles-Bjxh8lZv.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-DVzNO1Qt.js";
7
+ import "../parse-styles-CbYzTfwr.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-B-fI-Hqk.js";
9
9
  import "../css/merge.js";
10
10
  export {
11
11
  n as compileSaltyFile,
package/config/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../parsers/index.cjs"),i=a=>a;exports.GlobalStylesFactory=e.GlobalStylesFactory;exports.TemplatesFactory=e.TemplatesFactory;exports.VariablesFactory=e.VariablesFactory;exports.defineGlobalStyles=e.defineGlobalStyles;exports.defineMediaQuery=e.defineMediaQuery;exports.defineTemplates=e.defineTemplates;exports.defineVariables=e.defineVariables;exports.defineConfig=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../parsers/index.cjs"),t=a=>a;exports.GlobalStylesFactory=e.GlobalStylesFactory;exports.TemplateFactory=e.TemplateFactory;exports.TemplatesFactory=e.TemplatesFactory;exports.VariablesFactory=e.VariablesFactory;exports.defineGlobalStyles=e.defineGlobalStyles;exports.defineMediaQuery=e.defineMediaQuery;exports.defineTemplates=e.defineTemplates;exports.defineVariables=e.defineVariables;exports.defineConfig=t;
package/config/index.js CHANGED
@@ -1,12 +1,13 @@
1
- import { GlobalStylesFactory as l, TemplatesFactory as o, VariablesFactory as i, defineGlobalStyles as n, defineMediaQuery as f, defineTemplates as s, defineVariables as d } from "../parsers/index.js";
1
+ import { GlobalStylesFactory as l, TemplateFactory as o, TemplatesFactory as i, VariablesFactory as n, defineGlobalStyles as f, defineMediaQuery as s, defineTemplates as y, defineVariables as d } from "../parsers/index.js";
2
2
  const a = (e) => e;
3
3
  export {
4
4
  l as GlobalStylesFactory,
5
- o as TemplatesFactory,
6
- i as VariablesFactory,
5
+ o as TemplateFactory,
6
+ i as TemplatesFactory,
7
+ n as VariablesFactory,
7
8
  a as defineConfig,
8
- n as defineGlobalStyles,
9
- f as defineMediaQuery,
10
- s as defineTemplates,
9
+ f as defineGlobalStyles,
10
+ s as defineMediaQuery,
11
+ y as defineTemplates,
11
12
  d as defineVariables
12
13
  };
package/css/index.cjs CHANGED
@@ -1 +1 @@
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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./keyframes.cjs"),e=require("./media.cjs"),t=require("./token.cjs"),r=require("./merge.cjs");exports.keyframes=s.keyframes;exports.MediaQueryFactory=e.MediaQueryFactory;exports.media=e.media;exports.token=t.token;exports.mergeFactories=r.mergeFactories;exports.mergeStyles=r.mergeStyles;
package/css/index.js CHANGED
@@ -1,11 +1,12 @@
1
1
  import { keyframes as o } from "./keyframes.js";
2
- import { MediaQueryFactory as t, media as f } from "./media.js";
2
+ import { MediaQueryFactory as t, media as a } from "./media.js";
3
3
  import { token as p } from "./token.js";
4
- import { mergeStyles as y } from "./merge.js";
4
+ import { mergeFactories as y, mergeStyles as i } from "./merge.js";
5
5
  export {
6
6
  t as MediaQueryFactory,
7
7
  o as keyframes,
8
- f as media,
9
- y as mergeStyles,
8
+ a as media,
9
+ y as mergeFactories,
10
+ i as mergeStyles,
10
11
  p as token
11
12
  };
package/css/keyframes.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $=require("../parse-styles-D_gL6efj.cjs"),j=require("../dash-case-BJEkFEGQ.cjs"),C=({animationName:m,params:l,appendInitialStyles:f,...t})=>{const r=m||j.toHash(t),o=(s={})=>{const{duration:e="500ms",easing:n="ease-in-out",delay:a="0s",iterationCount:i="1",direction:S="normal",fillMode:g="forwards",playState:p="running"}={...l,...s},c=`${r} ${e} ${n} ${a} ${i} ${S} ${g} ${p}`;if(!f)return c;const u=t.from||t["0%"];if(!u)return c;const b=$.parseStyles(u,"");return`${c};${b}`},y=Object.entries(t).reduce((s,[e,n])=>{if(!n)return s;const a=$.parseStyles(n,""),i=typeof e=="number"?`${e}%`:e;return`${s}${i}{${a}}`},""),d=`@keyframes ${r} {${y}}`;return Object.assign(o,{toString:o,isKeyframes:!0,animationName:r,css:d,keyframes:t}),o};exports.keyframes=C;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("../parse-styles-DhDStS4F.cjs"),w=require("../dash-case-BJEkFEGQ.cjs"),C=async({animationName:l,params:u,appendInitialStyles:y,...t})=>{const n=l||w.toHash(t),r=async(s={})=>{const{duration:e="500ms",easing:o="ease-in-out",delay:i="0s",iterationCount:S="1",direction:p="normal",fillMode:g="forwards",playState:b="running"}={...u,...s},a=`${n} ${e} ${o} ${i} ${S} ${p} ${g} ${b}`;if(!y)return a;const c=t.from||t["0%"];if(!c)return a;const j=await m.parseAndJoinStyles(c,"");return`${a};${j}`},$=Object.entries(t).map(async([s,e])=>{if(!e)return"";const o=await m.parseAndJoinStyles(e,"");return`${typeof s=="number"?`${s}%`:s}{${o}}`}),d=(await Promise.all($)).join(""),f=`@keyframes ${n} {${d}}`;return Object.assign(r,{toString:r,isKeyframes:!0,animationName:n,css:f,keyframes:t}),r};exports.keyframes=C;
@@ -18,5 +18,5 @@ interface KeyframesParams {
18
18
  playState?: StyleValue<'animationPlayState'>;
19
19
  }
20
20
  type KeyframesProps = Keyframes & KeyframesConfig;
21
- export declare const keyframes: ({ animationName: _name, params: _params, appendInitialStyles, ...keyframes }: KeyframesProps) => (params?: KeyframesParams) => string;
21
+ export declare const keyframes: ({ animationName: _name, params: _params, appendInitialStyles, ...keyframes }: KeyframesProps) => Promise<(params?: KeyframesParams) => Promise<string>>;
22
22
  export {};
package/css/keyframes.js CHANGED
@@ -1,34 +1,34 @@
1
- import { p as c } from "../parse-styles-Bjxh8lZv.js";
1
+ import { p as m } from "../parse-styles-CbYzTfwr.js";
2
2
  import { t as j } from "../dash-case-DBThphLm.js";
3
- const O = ({ animationName: u, params: f, appendInitialStyles: p, ...t }) => {
4
- const o = u || j(t), e = (r = {}) => {
3
+ const v = async ({ animationName: $, params: f, appendInitialStyles: l, ...t }) => {
4
+ const r = $ || j(t), o = async (n = {}) => {
5
5
  const {
6
- duration: n = "500ms",
7
- easing: s = "ease-in-out",
8
- delay: a = "0s",
9
- iterationCount: i = "1",
10
- direction: y = "normal",
6
+ duration: s = "500ms",
7
+ easing: e = "ease-in-out",
8
+ delay: i = "0s",
9
+ iterationCount: d = "1",
10
+ direction: S = "normal",
11
11
  fillMode: g = "forwards",
12
- playState: S = "running"
13
- } = { ...f, ...r }, m = `${o} ${n} ${s} ${a} ${i} ${y} ${g} ${S}`;
14
- if (!p) return m;
15
- const $ = t.from || t["0%"];
16
- if (!$) return m;
17
- const b = c($, "");
18
- return `${m};${b}`;
19
- }, l = Object.entries(t).reduce((r, [n, s]) => {
20
- if (!s) return r;
21
- const a = c(s, ""), i = typeof n == "number" ? `${n}%` : n;
22
- return `${r}${i}{${a}}`;
23
- }, ""), d = `@keyframes ${o} {${l}}`;
24
- return Object.assign(e, {
25
- toString: e,
12
+ playState: w = "running"
13
+ } = { ...f, ...n }, a = `${r} ${s} ${e} ${i} ${d} ${S} ${g} ${w}`;
14
+ if (!l) return a;
15
+ const c = t.from || t["0%"];
16
+ if (!c) return a;
17
+ const b = await m(c, "");
18
+ return `${a};${b}`;
19
+ }, u = Object.entries(t).map(async ([n, s]) => {
20
+ if (!s) return "";
21
+ const e = await m(s, "");
22
+ return `${typeof n == "number" ? `${n}%` : n}{${e}}`;
23
+ }), p = (await Promise.all(u)).join(""), y = `@keyframes ${r} {${p}}`;
24
+ return Object.assign(o, {
25
+ toString: o,
26
26
  isKeyframes: !0,
27
- animationName: o,
28
- css: d,
27
+ animationName: r,
28
+ css: y,
29
29
  keyframes: t
30
- }), e;
30
+ }), o;
31
31
  };
32
32
  export {
33
- O as keyframes
33
+ v as keyframes
34
34
  };
package/css/merge.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=(...t)=>t.flat().reduce((e,r)=>r!=null&&r._current?{...e,...r._current}:{...e,...r},{});exports.mergeStyles=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=(...t)=>t.flat().reduce((e,r)=>r!=null&&r._current?{...e,...r._current}:{...e,...r},{}),u=(...t)=>t.flat().reduce((e,r)=>({...e,...r._children}),{});exports.mergeFactories=u;exports.mergeStyles=n;
package/css/merge.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { CSSinJS } from '../types';
2
2
  interface StyleFactory {
3
3
  _current: Record<string, any>;
4
+ _children: Record<string, any>[];
4
5
  }
5
6
  export declare const mergeStyles: <T extends StyleFactory | CSSinJS>(...styles: T[]) => T;
7
+ export declare const mergeFactories: <T extends StyleFactory>(...factories: T[][]) => T;
6
8
  export {};
package/css/merge.js CHANGED
@@ -1,4 +1,5 @@
1
- const e = (...u) => u.flat().reduce((n, r) => r != null && r._current ? { ...n, ...r._current } : { ...n, ...r }, {});
1
+ const u = (...n) => n.flat().reduce((e, r) => r != null && r._current ? { ...e, ...r._current } : { ...e, ...r }, {}), t = (...n) => n.flat().reduce((e, r) => ({ ...e, ...r._children }), {});
2
2
  export {
3
- e as mergeStyles
3
+ t as mergeFactories,
4
+ u as mergeStyles
4
5
  };
@@ -1,10 +1,27 @@
1
- import { CssTemplates } from '../types/config-types';
2
- export interface TemplatesFactoryParams {
3
- templates?: CssTemplates;
1
+ import { CssTemplateFunction, CssTemplateObject, CssTemplates } from '../types/config-types';
2
+ export interface TemplateFactoryParams {
3
+ name: string;
4
+ template: CssTemplateObject | CssTemplateFunction;
4
5
  }
6
+ export declare class TemplateFactory {
7
+ params: TemplateFactoryParams;
8
+ _path?: string;
9
+ constructor(params: TemplateFactoryParams);
10
+ get _current(): CssTemplateObject | CssTemplateFunction;
11
+ get isDefineTemplate(): boolean;
12
+ _setPath(path: string): this;
13
+ }
14
+ export type TemplatesFactoryParams = CssTemplates;
5
15
  export declare class TemplatesFactory {
6
- _current: TemplatesFactoryParams;
7
- constructor(_current: TemplatesFactoryParams);
16
+ params: TemplatesFactoryParams;
17
+ _path?: string;
18
+ private templates;
19
+ constructor(params: TemplatesFactoryParams);
20
+ get _current(): CssTemplates;
21
+ get _children(): {
22
+ [k: string]: TemplateFactory;
23
+ };
8
24
  get isDefineTemplates(): boolean;
25
+ _setPath(path: string): this;
9
26
  }
10
- export declare const defineTemplates: (templates: CssTemplates) => TemplatesFactory;
27
+ export declare const defineTemplates: (templates: TemplatesFactoryParams) => TemplatesFactory;
@@ -1 +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-D_gL6efj.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;
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-DhDStS4F.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.parseAndJoinStyles(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([]),d=a=>{const r=i[a];r!==void 0?c.add(`${a}=${String(r)}`):c.add(a)};Object.keys(t).forEach(d),n.map(a=>Object.keys(a).forEach(d));const l=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&&l.add(p)})}return{element:s,variantKeys:[...c],propValueKeys:[...l],passProps:h,defaultProps:o,attr:{"data-component-name":g?void 0:y}}}}exports.ClassNameGenerator=S;exports.StyledGenerator=v;
@@ -1,7 +1,7 @@
1
1
  var y = Object.defineProperty;
2
2
  var b = (e, s, t) => s in e ? y(e, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[s] = t;
3
3
  var u = (e, s, t) => b(e, typeof s != "symbol" ? s + "" : s, t);
4
- import { p as N } from "../parse-styles-Bjxh8lZv.js";
4
+ import { p as N } from "../parse-styles-CbYzTfwr.js";
5
5
  import { t as C, d as x } from "../dash-case-DBThphLm.js";
6
6
  class m {
7
7
  constructor(s) {
@@ -13,6 +13,6 @@ export declare class StylesGenerator<const STYLE_PARAMS extends StyledParams = S
13
13
  get cssClassName(): string;
14
14
  get classNames(): string;
15
15
  get cssFileName(): string;
16
- get css(): string;
16
+ get css(): Promise<string>;
17
17
  _withBuildContext(context: StylesGeneratorBuildTimeProps): this;
18
18
  }