@salty-css/core 0.0.1-alpha.147 → 0.0.1-alpha.149

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 (44) hide show
  1. package/README.md +1 -1
  2. package/bin/main.cjs +1 -1
  3. package/bin/main.js +1 -1
  4. package/compiler/index.cjs +1 -1
  5. package/compiler/index.d.ts +23 -1
  6. package/compiler/index.js +12 -10
  7. package/config/define-config.d.ts +1 -1
  8. package/config/index.d.ts +1 -1
  9. package/css/index.cjs +1 -1
  10. package/css/index.d.ts +4 -1
  11. package/css/index.js +121 -2
  12. package/css/keyframes.d.ts +22 -0
  13. package/css/media.d.ts +87 -0
  14. package/css/merge.d.ts +6 -0
  15. package/css/token.d.ts +1 -0
  16. package/factories/define-global-styles.d.ts +7 -0
  17. package/factories/define-variables.d.ts +15 -0
  18. package/factories/index.cjs +1 -0
  19. package/factories/index.d.ts +2 -0
  20. package/factories/index.js +27 -0
  21. package/generator/index.cjs +1 -1
  22. package/generator/index.js +7 -6
  23. package/generator/parse-modifiers.d.ts +1 -1
  24. package/generator/parse-styles.d.ts +1 -1
  25. package/index-BixulVRN.js +397 -0
  26. package/index-C6uCnypW.cjs +29 -0
  27. package/merge-BVm9us1A.js +4 -0
  28. package/merge-DxGoJDHv.cjs +1 -0
  29. package/package.json +1 -1
  30. package/parse-styles-3zK35muR.cjs +7 -0
  31. package/parse-styles-DrLhKtqW.js +75 -0
  32. package/parse-templates-BKvQLGeN.cjs +2 -0
  33. package/parse-templates-BdcpkXBG.js +27 -0
  34. package/server/index.cjs +1 -0
  35. package/server/index.d.ts +1 -0
  36. package/server/index.js +11 -0
  37. package/server/should-restart.d.ts +1 -0
  38. package/templates/salty-reset.d.ts +1 -1
  39. package/types/index.d.ts +1 -1
  40. package/index-CLCze-Xg.cjs +0 -29
  41. package/index-ChBlB_DP.js +0 -376
  42. package/parse-templates-CgZo0YA1.js +0 -97
  43. package/parse-templates-DD4hQEpv.cjs +0 -8
  44. /package/{config → types}/config-types.d.ts +0 -0
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- ![Salty CSS Banner](https://raw.githubusercontent.com/gist/tremppu/ef2b867907cbf262ab7373f41558a403/raw/a2137de136ee2296e386682beb4487bba0f58a2f/salty-logo-svg-dvd.svg)
1
+ ![Salty CSS Banner](https://salty-css.dev/assets/banners/dvd.svg)
2
2
 
3
3
  # Salty CSS - CSS-in-JS library that is kinda sweet
4
4
 
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-CLCze-Xg.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-C6uCnypW.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-ChBlB_DP.js";
6
+ import { l as t, a as h, g as te } from "../index-BixulVRN.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-templates-DD4hQEpv.cjs");const e=require("../index-CLCze-Xg.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");require("../parse-templates-BKvQLGeN.cjs");const e=require("../index-C6uCnypW.cjs");require("../merge-DxGoJDHv.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,38 @@
1
1
  import { StyleComponentGenerator } from '../generator/style-generator';
2
+ import { MediaQueryFactory } from '../css/media';
3
+ import { GlobalStylesFactory, VariablesFactory } from '../factories';
4
+ interface GeneratorResult<V extends object> {
5
+ value: V;
6
+ src: string;
7
+ name: string;
8
+ }
9
+ interface GenerationResults {
10
+ components: GeneratorResult<StyleComponentGenerator>[];
11
+ keyframes: GeneratorResult<{
12
+ animationName: string;
13
+ css: string;
14
+ }>[];
15
+ mediaQueries: MediaQueryFactory[];
16
+ globalStyles: GlobalStylesFactory[];
17
+ variables: VariablesFactory[];
18
+ }
2
19
  export declare const saltyFileExtensions: string[];
3
20
  export declare const saltyFileRegExp: (additional?: string[]) => RegExp;
4
21
  export declare const isSaltyFile: (file: string, additional?: string[]) => boolean;
5
- export declare const generateConfigStyles: (dirname: string) => Promise<void>;
22
+ export declare const generateConfigStyles: (dirname: string, generationResults: GenerationResults) => Promise<void>;
6
23
  export declare const compileSaltyFile: (dirname: string, sourceFilePath: string, outputDirectory: string) => Promise<{
7
24
  [key: string]: {
8
25
  generator: StyleComponentGenerator;
26
+ isMedia?: boolean;
27
+ isGlobalDefine?: boolean;
28
+ isDefineVariables?: boolean;
9
29
  isKeyframes?: boolean;
10
30
  animationName?: string;
11
31
  css?: string;
32
+ styles?: any;
12
33
  };
13
34
  }>;
14
35
  export declare const generateCss: (dirname: string, prod?: boolean) => Promise<void>;
15
36
  export declare const generateFile: (dirname: string, file: string) => Promise<void>;
16
37
  export declare const minimizeFile: (dirname: string, file: string, prod?: boolean) => Promise<string | undefined>;
38
+ export {};
package/compiler/index.js CHANGED
@@ -4,15 +4,17 @@ import "../dash-case-DBThphLm.js";
4
4
  import "path";
5
5
  import "fs";
6
6
  import "fs/promises";
7
- import "../parse-templates-CgZo0YA1.js";
8
- import { d as p, c as n, g, e as F, i as y, m as x, s as S, b as c } from "../index-ChBlB_DP.js";
7
+ import "../parse-styles-DrLhKtqW.js";
8
+ import "../parse-templates-BdcpkXBG.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-BixulVRN.js";
10
+ import "../merge-BVm9us1A.js";
9
11
  export {
10
- p as compileSaltyFile,
11
- n as generateConfigStyles,
12
- g as generateCss,
13
- F as generateFile,
14
- y as isSaltyFile,
15
- x as minimizeFile,
16
- S as saltyFileExtensions,
17
- c as saltyFileRegExp
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
18
20
  };
@@ -1,2 +1,2 @@
1
- import { SaltyConfig } from './config-types';
1
+ import { SaltyConfig } from '../types/config-types';
2
2
  export declare const defineConfig: <T extends SaltyConfig>(config: T) => T;
package/config/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from './config-types';
1
+ export * from '../types/config-types';
2
2
  export * from './define-config';
package/css/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=e=>`{${e}}`;exports.token=t;
1
+ "use strict";var v=Object.defineProperty;var C=(n,e,t)=>e in n?v(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var g=(n,e,t)=>C(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("../parse-styles-3zK35muR.cjs"),w=require("../dash-case-BJEkFEGQ.cjs"),j=require("../merge-DxGoJDHv.cjs"),k=({animationName:n,params:e,appendInitialStyles:t,...s})=>{const u=n||w.toHash(s),c=(o={})=>{const{duration:r="500ms",easing:a="ease-in-out",delay:h="0s",iterationCount:$="1",direction:x="normal",fillMode:f="forwards",playState:y="running"}={...e,...o},l=`${u} ${r} ${a} ${h} ${$} ${x} ${f} ${y}`;if(!t)return l;const m=s.from||s["0%"];if(!m)return l;const S=p.parseStyles(m,"");return`${l};${S}`},d=Object.entries(s).reduce((o,[r,a])=>{if(!a)return o;const h=p.parseStyles(a,""),$=typeof r=="number"?`${r}%`:r;return`${o}${$}{${h}}`},""),b=`@keyframes ${u} {${d}}`;return Object.assign(c,{toString:c,isKeyframes:!0,animationName:u,css:b,keyframes:s}),c};class i{constructor(e="@media"){g(this,"next",e=>{const t=new String(e);return Object.assign(t,{get isMedia(){return!0},get and(){return new i(`${e} and`)},get or(){return new i(`${e},`)}}),t});this.base=e}custom(e){return this.next(`${this.base} ${e}`)}minWidth(e){const t=typeof e=="number"?`${e}px`:e,s=`${this.base} (min-width: ${t})`;return this.next(s)}maxWidth(e){const t=typeof e=="number"?`${e}px`:e,s=`${this.base} (max-width: ${t})`;return this.next(s)}minHeight(e){const t=typeof e=="number"?`${e}px`:e,s=`${this.base} (min-height: ${t})`;return this.next(s)}maxHeight(e){const t=typeof e=="number"?`${e}px`:e,s=`${this.base} (max-height: ${t})`;return this.next(s)}get portrait(){const e=`${this.base} (orientation: portrait)`;return this.next(e)}get landscape(){const e=`${this.base} (orientation: landscape)`;return this.next(e)}prefersColorScheme(e){const t=`${this.base} (prefers-color-scheme: ${e})`;return this.next(t)}get dark(){return this.prefersColorScheme("dark")}get light(){return this.prefersColorScheme("light")}get print(){const e=`${this.base} print`;return this.next(e)}get screen(){const e=`${this.base} screen`;return this.next(e)}get speech(){const e=`${this.base} speech`;return this.next(e)}get all(){const e=`${this.base} all`;return this.next(e)}get not(){const e=`${this.base} not`;return this.next(e)}get reducedMotion(){const e=`${this.base} (prefers-reduced-motion: reduce)`;return this.next(e)}}const M=new i,O=n=>`{${n}}`;exports.mergeStyles=j.mergeStyles;exports.MediaQueryFactory=i;exports.keyframes=k;exports.media=M;exports.token=O;
package/css/index.d.ts CHANGED
@@ -1 +1,4 @@
1
- export declare const token: <T extends VariableTokens>(token: T) => string;
1
+ export * from './keyframes';
2
+ export * from './media';
3
+ export * from './token';
4
+ export * from './merge';
package/css/index.js CHANGED
@@ -1,4 +1,123 @@
1
- const t = (o) => `{${o}}`;
1
+ var y = Object.defineProperty;
2
+ var w = (s, t, e) => t in s ? y(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
+ var p = (s, t, e) => w(s, typeof t != "symbol" ? t + "" : t, e);
4
+ import { p as g } from "../parse-styles-DrLhKtqW.js";
5
+ import { t as C } from "../dash-case-DBThphLm.js";
6
+ import { m as K } from "../merge-BVm9us1A.js";
7
+ const k = ({ animationName: s, params: t, appendInitialStyles: e, ...n }) => {
8
+ const c = s || C(n), u = (o = {}) => {
9
+ const {
10
+ duration: r = "500ms",
11
+ easing: i = "ease-in-out",
12
+ delay: h = "0s",
13
+ iterationCount: $ = "1",
14
+ direction: d = "normal",
15
+ fillMode: f = "forwards",
16
+ playState: v = "running"
17
+ } = { ...t, ...o }, m = `${c} ${r} ${i} ${h} ${$} ${d} ${f} ${v}`;
18
+ if (!e) return m;
19
+ const l = n.from || n["0%"];
20
+ if (!l) return m;
21
+ const S = g(l, "");
22
+ return `${m};${S}`;
23
+ }, x = Object.entries(n).reduce((o, [r, i]) => {
24
+ if (!i) return o;
25
+ const h = g(i, ""), $ = typeof r == "number" ? `${r}%` : r;
26
+ return `${o}${$}{${h}}`;
27
+ }, ""), b = `@keyframes ${c} {${x}}`;
28
+ return Object.assign(u, {
29
+ toString: u,
30
+ isKeyframes: !0,
31
+ animationName: c,
32
+ css: b,
33
+ keyframes: n
34
+ }), u;
35
+ };
36
+ class a {
37
+ constructor(t = "@media") {
38
+ p(this, "next", (t) => {
39
+ const e = new String(t);
40
+ return Object.assign(e, {
41
+ get isMedia() {
42
+ return !0;
43
+ },
44
+ get and() {
45
+ return new a(`${t} and`);
46
+ },
47
+ get or() {
48
+ return new a(`${t},`);
49
+ }
50
+ }), e;
51
+ });
52
+ this.base = t;
53
+ }
54
+ custom(t) {
55
+ return this.next(`${this.base} ${t}`);
56
+ }
57
+ minWidth(t) {
58
+ const e = typeof t == "number" ? `${t}px` : t, n = `${this.base} (min-width: ${e})`;
59
+ return this.next(n);
60
+ }
61
+ maxWidth(t) {
62
+ const e = typeof t == "number" ? `${t}px` : t, n = `${this.base} (max-width: ${e})`;
63
+ return this.next(n);
64
+ }
65
+ minHeight(t) {
66
+ const e = typeof t == "number" ? `${t}px` : t, n = `${this.base} (min-height: ${e})`;
67
+ return this.next(n);
68
+ }
69
+ maxHeight(t) {
70
+ const e = typeof t == "number" ? `${t}px` : t, n = `${this.base} (max-height: ${e})`;
71
+ return this.next(n);
72
+ }
73
+ get portrait() {
74
+ const t = `${this.base} (orientation: portrait)`;
75
+ return this.next(t);
76
+ }
77
+ get landscape() {
78
+ const t = `${this.base} (orientation: landscape)`;
79
+ return this.next(t);
80
+ }
81
+ prefersColorScheme(t) {
82
+ const e = `${this.base} (prefers-color-scheme: ${t})`;
83
+ return this.next(e);
84
+ }
85
+ get dark() {
86
+ return this.prefersColorScheme("dark");
87
+ }
88
+ get light() {
89
+ return this.prefersColorScheme("light");
90
+ }
91
+ get print() {
92
+ const t = `${this.base} print`;
93
+ return this.next(t);
94
+ }
95
+ get screen() {
96
+ const t = `${this.base} screen`;
97
+ return this.next(t);
98
+ }
99
+ get speech() {
100
+ const t = `${this.base} speech`;
101
+ return this.next(t);
102
+ }
103
+ get all() {
104
+ const t = `${this.base} all`;
105
+ return this.next(t);
106
+ }
107
+ get not() {
108
+ const t = `${this.base} not`;
109
+ return this.next(t);
110
+ }
111
+ get reducedMotion() {
112
+ const t = `${this.base} (prefers-reduced-motion: reduce)`;
113
+ return this.next(t);
114
+ }
115
+ }
116
+ const M = new a(), N = (s) => `{${s}}`;
2
117
  export {
3
- t as token
118
+ a as MediaQueryFactory,
119
+ k as keyframes,
120
+ M as media,
121
+ K as mergeStyles,
122
+ N as token
4
123
  };
@@ -0,0 +1,22 @@
1
+ import { CssStyles, StyleValue } from '../types';
2
+ type KeyframeKeys = number | 'from' | 'to' | `${number}%`;
3
+ type Keyframes = {
4
+ [key in KeyframeKeys]?: CssStyles;
5
+ };
6
+ interface KeyframesConfig {
7
+ animationName?: string;
8
+ appendInitialStyles?: boolean;
9
+ params?: KeyframesParams;
10
+ }
11
+ interface KeyframesParams {
12
+ duration?: string;
13
+ delay?: string;
14
+ iterationCount?: string | number;
15
+ easing?: StyleValue<'animationTimingFunction'>;
16
+ direction?: StyleValue<'animationDirection'>;
17
+ fillMode?: StyleValue<'animationFillMode'>;
18
+ playState?: StyleValue<'animationPlayState'>;
19
+ }
20
+ type KeyframesProps = Keyframes & KeyframesConfig;
21
+ export declare const keyframes: ({ animationName: _name, params: _params, appendInitialStyles, ...keyframes }: KeyframesProps) => (params?: KeyframesParams) => string;
22
+ export {};
package/css/media.d.ts ADDED
@@ -0,0 +1,87 @@
1
+ import { OrString, OrNumber } from '../types/util-types';
2
+ export declare class MediaQueryFactory {
3
+ private base;
4
+ constructor(base?: string);
5
+ private next;
6
+ custom(value: string): string & {
7
+ isMedia: boolean;
8
+ and: MediaQueryFactory;
9
+ or: MediaQueryFactory;
10
+ };
11
+ minWidth(width: OrString | OrNumber): string & {
12
+ isMedia: boolean;
13
+ and: MediaQueryFactory;
14
+ or: MediaQueryFactory;
15
+ };
16
+ maxWidth(width: OrString | OrNumber): string & {
17
+ isMedia: boolean;
18
+ and: MediaQueryFactory;
19
+ or: MediaQueryFactory;
20
+ };
21
+ minHeight(height: OrString | OrNumber): string & {
22
+ isMedia: boolean;
23
+ and: MediaQueryFactory;
24
+ or: MediaQueryFactory;
25
+ };
26
+ maxHeight(height: OrString | OrNumber): string & {
27
+ isMedia: boolean;
28
+ and: MediaQueryFactory;
29
+ or: MediaQueryFactory;
30
+ };
31
+ get portrait(): string & {
32
+ isMedia: boolean;
33
+ and: MediaQueryFactory;
34
+ or: MediaQueryFactory;
35
+ };
36
+ get landscape(): string & {
37
+ isMedia: boolean;
38
+ and: MediaQueryFactory;
39
+ or: MediaQueryFactory;
40
+ };
41
+ prefersColorScheme(scheme: 'dark' | 'light' | OrString): string & {
42
+ isMedia: boolean;
43
+ and: MediaQueryFactory;
44
+ or: MediaQueryFactory;
45
+ };
46
+ get dark(): string & {
47
+ isMedia: boolean;
48
+ and: MediaQueryFactory;
49
+ or: MediaQueryFactory;
50
+ };
51
+ get light(): string & {
52
+ isMedia: boolean;
53
+ and: MediaQueryFactory;
54
+ or: MediaQueryFactory;
55
+ };
56
+ get print(): string & {
57
+ isMedia: boolean;
58
+ and: MediaQueryFactory;
59
+ or: MediaQueryFactory;
60
+ };
61
+ get screen(): string & {
62
+ isMedia: boolean;
63
+ and: MediaQueryFactory;
64
+ or: MediaQueryFactory;
65
+ };
66
+ get speech(): string & {
67
+ isMedia: boolean;
68
+ and: MediaQueryFactory;
69
+ or: MediaQueryFactory;
70
+ };
71
+ get all(): string & {
72
+ isMedia: boolean;
73
+ and: MediaQueryFactory;
74
+ or: MediaQueryFactory;
75
+ };
76
+ get not(): string & {
77
+ isMedia: boolean;
78
+ and: MediaQueryFactory;
79
+ or: MediaQueryFactory;
80
+ };
81
+ get reducedMotion(): string & {
82
+ isMedia: boolean;
83
+ and: MediaQueryFactory;
84
+ or: MediaQueryFactory;
85
+ };
86
+ }
87
+ export declare const media: MediaQueryFactory;
package/css/merge.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import { CSSinJS } from '../types';
2
+ interface StyleFactory {
3
+ _current: Record<string, any>;
4
+ }
5
+ export declare const mergeStyles: <T extends StyleFactory | CSSinJS>(...styles: T[]) => {};
6
+ export {};
package/css/token.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const token: <T extends VariableTokens>(token: T) => string;
@@ -0,0 +1,7 @@
1
+ import { GlobalStyles } from '../types/config-types';
2
+ export declare class GlobalStylesFactory {
3
+ _current: GlobalStyles;
4
+ constructor(_current: GlobalStyles);
5
+ get isGlobalDefine(): boolean;
6
+ }
7
+ export declare const defineGlobalStyles: (styles: GlobalStyles) => GlobalStylesFactory;
@@ -0,0 +1,15 @@
1
+ import { CssConditionalVariables, CssResponsiveVariables, CssVariables } from '../types/config-types';
2
+ export interface VariablesFactoryParams {
3
+ variables?: CssVariables;
4
+ responsiveVariables?: CssResponsiveVariables;
5
+ conditionalVariables?: CssConditionalVariables;
6
+ }
7
+ export declare class VariablesFactory {
8
+ _current: VariablesFactoryParams;
9
+ constructor(_current: VariablesFactoryParams);
10
+ get isDefineVariables(): boolean;
11
+ }
12
+ export declare const defineVariables: (variables: VariablesFactoryParams) => VariablesFactory;
13
+ export declare const defineStaticVariables: (variables: CssVariables) => VariablesFactory;
14
+ export declare const defineResponsiveVariables: (responsiveVariables: CssResponsiveVariables) => VariablesFactory;
15
+ export declare const defineConditionalVariables: (conditionalVariables: CssConditionalVariables) => VariablesFactory;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class n{constructor(r){this._current=r}get isGlobalDefine(){return!0}}const a=e=>new n(e);class t{constructor(r){this._current=r}get isDefineVariables(){return!0}}const i=e=>new t(e),s=e=>new t({variables:e}),l=e=>new t({responsiveVariables:e}),o=e=>new t({conditionalVariables:e});exports.GlobalStylesFactory=n;exports.VariablesFactory=t;exports.defineConditionalVariables=o;exports.defineGlobalStyles=a;exports.defineResponsiveVariables=l;exports.defineStaticVariables=s;exports.defineVariables=i;
@@ -0,0 +1,2 @@
1
+ export * from './define-global-styles';
2
+ export * from './define-variables';
@@ -0,0 +1,27 @@
1
+ class n {
2
+ constructor(t) {
3
+ this._current = t;
4
+ }
5
+ get isGlobalDefine() {
6
+ return !0;
7
+ }
8
+ }
9
+ const s = (e) => new n(e);
10
+ class r {
11
+ constructor(t) {
12
+ this._current = t;
13
+ }
14
+ get isDefineVariables() {
15
+ return !0;
16
+ }
17
+ }
18
+ const a = (e) => new r(e), i = (e) => new r({ variables: e }), o = (e) => new r({ responsiveVariables: e }), l = (e) => new r({ conditionalVariables: e });
19
+ export {
20
+ n as GlobalStylesFactory,
21
+ r as VariablesFactory,
22
+ l as defineConditionalVariables,
23
+ s as defineGlobalStyles,
24
+ o as defineResponsiveVariables,
25
+ i as defineStaticVariables,
26
+ a as defineVariables
27
+ };
@@ -1 +1 @@
1
- "use strict";var f=Object.defineProperty;var y=(a,s,t)=>s in a?f(a,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[s]=t;var c=(a,s,t)=>y(a,typeof s!="symbol"?s+"":s,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../dash-case-BJEkFEGQ.cjs"),g=require("../parse-templates-DD4hQEpv.cjs");class N{constructor(s,t){c(this,"_isProd");c(this,"_callerName");c(this,"_context");this.tagName=s,this.params=t}get hash(){return u.toHash(this.params.base||this.params)}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 classNames(){const s=[this.hash],{className:t}=this.params;return t&&s.push(t),s.join(" ")}get cssClassName(){return this.hash}get cssDisplayNameVar(){return`--${this.hash}-display-name: ${this._callerName};`}get cssFileName(){return this._callerName?`c_${u.dashCase(this._callerName)}-${this.hash}-${this.priority}.css`:`${this.hash}-${this.priority}.css`}get templateKeys(){var s;return(s=this._context)!=null&&s.config.templates?g.getTemplateKeys(this._context.config.templates):[]}get css(){var n;const{base:s={},variants:t={},compoundVariants:i=[]}=this.params,r={...s,variants:t,compoundVariants:i};return g.parseStyles(r,`.${this.cssClassName}`,(n=this._context)==null?void 0:n.config)}get props(){const{element:s,variants:t={},compoundVariants:i=[],defaultVariants:r={},defaultProps:p={},passProps:n}=this.params,h=new Set([]),l=e=>{const o=r[e];o!==void 0?h.add(`${e}=${String(o)}`):h.add(e)};Object.keys(t).forEach(l),i.map(e=>Object.keys(e).forEach(l));const m=new Set([]);if(this.params.base){const e=JSON.stringify(this.params.base).match(/\{props\.([\w\d]+)\}/gi);e&&e.forEach(o=>{const d=o.replace(/\{props\.([\w\d]+)\}/gi,"$1");d&&m.add(d)})}return{element:s,variantKeys:[...h],propValueKeys:[...m],passProps:n,defaultProps:p,attr:{"data-component-name":this._isProd?void 0:this._callerName}}}_withBuildContext(s){this._context=s;const{name:t,config:i,prod:r}=s;return this._isProd=r,this._callerName=t,this}}exports.StyleComponentGenerator=N;
1
+ "use strict";var g=Object.defineProperty;var y=(a,s,t)=>s in a?g(a,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[s]=t;var c=(a,s,t)=>y(a,typeof s!="symbol"?s+"":s,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../dash-case-BJEkFEGQ.cjs"),f=require("../parse-templates-BKvQLGeN.cjs"),N=require("../parse-styles-3zK35muR.cjs");class _{constructor(s,t){c(this,"_isProd");c(this,"_callerName");c(this,"_context");this.tagName=s,this.params=t}get hash(){return u.toHash(this.params.base||this.params)}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 classNames(){const s=[this.hash],{className:t}=this.params;return t&&s.push(t),s.join(" ")}get cssClassName(){return this.hash}get cssDisplayNameVar(){return`--${this.hash}-display-name: ${this._callerName};`}get cssFileName(){return this._callerName?`c_${u.dashCase(this._callerName)}-${this.hash}-${this.priority}.css`:`${this.hash}-${this.priority}.css`}get templateKeys(){var s;return(s=this._context)!=null&&s.config.templates?f.getTemplateKeys(this._context.config.templates):[]}get css(){var n;const{base:s={},variants:t={},compoundVariants:i=[]}=this.params,r={...s,variants:t,compoundVariants:i};return N.parseStyles(r,`.${this.cssClassName}`,(n=this._context)==null?void 0:n.config)}get props(){const{element:s,variants:t={},compoundVariants:i=[],defaultVariants:r={},defaultProps:p={},passProps:n}=this.params,h=new Set([]),l=e=>{const o=r[e];o!==void 0?h.add(`${e}=${String(o)}`):h.add(e)};Object.keys(t).forEach(l),i.map(e=>Object.keys(e).forEach(l));const m=new Set([]);if(this.params.base){const e=JSON.stringify(this.params.base).match(/\{props\.([\w\d]+)\}/gi);e&&e.forEach(o=>{const d=o.replace(/\{props\.([\w\d]+)\}/gi,"$1");d&&m.add(d)})}return{element:s,variantKeys:[...h],propValueKeys:[...m],passProps:n,defaultProps:p,attr:{"data-component-name":this._isProd?void 0:this._callerName}}}_withBuildContext(s){this._context=s;const{name:t,config:i,prod:r}=s;return this._isProd=r,this._callerName=t,this}}exports.StyleComponentGenerator=_;
@@ -1,9 +1,10 @@
1
- var u = Object.defineProperty;
2
- var f = (a, s, t) => s in a ? u(a, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[s] = t;
3
- var c = (a, s, t) => f(a, typeof s != "symbol" ? s + "" : s, t);
1
+ var f = Object.defineProperty;
2
+ var u = (a, s, t) => s in a ? f(a, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[s] = t;
3
+ var c = (a, s, t) => u(a, typeof s != "symbol" ? s + "" : s, t);
4
4
  import { t as g, d as y } from "../dash-case-DBThphLm.js";
5
- import { g as N, p as _ } from "../parse-templates-CgZo0YA1.js";
6
- class v {
5
+ import { g as N } from "../parse-templates-BdcpkXBG.js";
6
+ import { p as _ } from "../parse-styles-DrLhKtqW.js";
7
+ class K {
7
8
  constructor(s, t) {
8
9
  c(this, "_isProd");
9
10
  c(this, "_callerName");
@@ -71,5 +72,5 @@ class v {
71
72
  }
72
73
  }
73
74
  export {
74
- v as StyleComponentGenerator
75
+ K as StyleComponentGenerator
75
76
  };
@@ -1,3 +1,3 @@
1
- import { CssModifiers } from '../config/config-types';
1
+ import { CssModifiers } from '../types/config-types';
2
2
  import { ValueParserReturnValue } from './parser-types';
3
3
  export declare const parseValueModifiers: (value: string, modifiers?: CssModifiers) => ValueParserReturnValue;
@@ -1,2 +1,2 @@
1
- import { SaltyConfig } from '../config/config-types';
1
+ import { SaltyConfig } from '../types/config-types';
2
2
  export declare const parseStyles: <T extends object>(styles: T, currentClass: string, config?: SaltyConfig | undefined) => string;