salty-css 0.0.1-alpha.27 → 0.0.1-test.1
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/package.json +5 -45
- package/README.md +0 -111
- package/bin/bin-util.d.ts +0 -2
- package/bin/index.cjs +0 -9
- package/bin/index.d.ts +0 -2
- package/bin/index.js +0 -132
- package/bin/logger.d.ts +0 -1
- package/bin/prettier.d.ts +0 -1
- package/compiler/index.cjs +0 -11
- package/compiler/index.d.ts +0 -16
- package/compiler/index.js +0 -174
- package/config/config-types.d.ts +0 -59
- package/config/define-config.d.ts +0 -2
- package/config/index.cjs +0 -1
- package/config/index.d.ts +0 -2
- package/config/index.js +0 -4
- package/css/index.cjs +0 -1
- package/css/index.d.ts +0 -1
- package/css/index.js +0 -4
- package/dash-case-DKzpenwY.cjs +0 -1
- package/dash-case-DMQMcCO6.js +0 -19
- package/generator/index.cjs +0 -1
- package/generator/index.d.ts +0 -1
- package/generator/index.js +0 -61
- package/generator/parse-modifiers.d.ts +0 -3
- package/generator/parse-styles.d.ts +0 -2
- package/generator/parse-templates.d.ts +0 -2
- package/generator/parse-tokens.d.ts +0 -2
- package/generator/parser-types.d.ts +0 -4
- package/generator/style-generator.d.ts +0 -28
- package/index-84Wroia-.cjs +0 -1
- package/index-D_732b92.js +0 -4
- package/parse-templates-D4p3pgQR.js +0 -92
- package/parse-templates-W0YfTmOT.cjs +0 -8
- package/pascal-case-BQpR5PdN.js +0 -6
- package/pascal-case-iWoaJWwT.cjs +0 -1
- package/react-styled-file-CGVf5n1B.js +0 -11
- package/react-styled-file-Dkubsz-U.cjs +0 -8
- package/salty.config-BupieCfE.cjs +0 -6
- package/salty.config-D9ANEDiH.js +0 -9
- package/types/index.cjs +0 -1
- package/types/index.d.ts +0 -63
- package/types/index.js +0 -1
- package/types/util-types.d.ts +0 -13
- package/util/camel-case.d.ts +0 -1
- package/util/dash-case.d.ts +0 -1
- package/util/index.cjs +0 -1
- package/util/index.d.ts +0 -4
- package/util/index.js +0 -11
- package/util/pascal-case.d.ts +0 -1
- package/util/to-hash.d.ts +0 -4
package/package.json
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "salty-css",
|
|
3
|
-
"version": "0.0.1-
|
|
4
|
-
"main": "./dist/index.js",
|
|
5
|
-
"module": "./dist/index.mjs",
|
|
6
|
-
"typings": "./dist/index.d.ts",
|
|
3
|
+
"version": "0.0.1-test.1",
|
|
7
4
|
"type": "module",
|
|
8
5
|
"license": "MIT",
|
|
9
6
|
"private": false,
|
|
@@ -19,47 +16,10 @@
|
|
|
19
16
|
"!**/*.tsbuildinfo"
|
|
20
17
|
],
|
|
21
18
|
"nx": {
|
|
22
|
-
"sourceRoot": "libs/
|
|
23
|
-
"name": "
|
|
19
|
+
"sourceRoot": "libs/cli",
|
|
20
|
+
"name": "cli"
|
|
24
21
|
},
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"ejs": ">=3.x",
|
|
28
|
-
"esbuild": ">=0.21.x",
|
|
29
|
-
"ora": ">=8.x",
|
|
30
|
-
"react": ">=18.x || >=19.x",
|
|
31
|
-
"winston": ">=3.x"
|
|
32
|
-
},
|
|
33
|
-
"exports": {
|
|
34
|
-
"./compiler": {
|
|
35
|
-
"import": "./compiler/index.js",
|
|
36
|
-
"require": "./compiler/index.cjs"
|
|
37
|
-
},
|
|
38
|
-
"./css": {
|
|
39
|
-
"import": "./css/index.js",
|
|
40
|
-
"require": "./css/index.cjs"
|
|
41
|
-
},
|
|
42
|
-
"./generator": {
|
|
43
|
-
"import": "./generator/index.js",
|
|
44
|
-
"require": "./generator/index.cjs"
|
|
45
|
-
},
|
|
46
|
-
"./config": {
|
|
47
|
-
"import": "./config/index.js",
|
|
48
|
-
"require": "./config/index.cjs"
|
|
49
|
-
},
|
|
50
|
-
"./types": {
|
|
51
|
-
"import": "./types/index.js",
|
|
52
|
-
"require": "./types/index.cjs"
|
|
53
|
-
},
|
|
54
|
-
"./util": {
|
|
55
|
-
"import": "./util/index.js",
|
|
56
|
-
"require": "./util/index.cjs"
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
"bin": {
|
|
60
|
-
"salty": "./bin/index.js",
|
|
61
|
-
"salty-css": "./bin/index.js",
|
|
62
|
-
"salty-css-cjs": "./bin/index.cjs",
|
|
63
|
-
"@salty-css/core": "./bin/index.js"
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@salty-css/core": "^0.0.1-alpha.27"
|
|
64
24
|
}
|
|
65
25
|
}
|
package/README.md
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
# Salty Css
|
|
2
|
-
|
|
3
|
-
## Basic usage example with Button
|
|
4
|
-
|
|
5
|
-
### Initial requirements
|
|
6
|
-
|
|
7
|
-
1. Add `saltyPlugin` to vite or webpack config from `@salty-css/vite` or `@salty-css/webpack`
|
|
8
|
-
2. Create `salty.config.ts` to the root of your project
|
|
9
|
-
3. Import global styles to any regular .css file from `saltygen/index.css` (does not exist during first run, cli command coming later)
|
|
10
|
-
4. Create salty components with styled only inside files that end with `.css.ts`, `.salty.ts` `.styled.ts` or `.styles.ts`
|
|
11
|
-
|
|
12
|
-
### Code examples
|
|
13
|
-
|
|
14
|
-
**Salty config**
|
|
15
|
-
|
|
16
|
-
```tsx
|
|
17
|
-
import { defineConfig } from '@salty-css/core/config';
|
|
18
|
-
|
|
19
|
-
export const config = defineConfig({
|
|
20
|
-
variables: {
|
|
21
|
-
colors: {
|
|
22
|
-
brand: '#111',
|
|
23
|
-
highlight: 'yellow',
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
global: {
|
|
27
|
-
html: {
|
|
28
|
-
backgroundColor: '#f8f8f8',
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
**Your React component file**
|
|
35
|
-
|
|
36
|
-
```tsx
|
|
37
|
-
import { Wrapper } from '../components/wrapper/wrapper.css';
|
|
38
|
-
import { Button } from '../components/button/button.css';
|
|
39
|
-
|
|
40
|
-
export const IndexPage = () => {
|
|
41
|
-
return (
|
|
42
|
-
<Wrapper>
|
|
43
|
-
<Button variant="solid" onClick={() => alert('It is a button.')}>
|
|
44
|
-
Outlined
|
|
45
|
-
</Button>
|
|
46
|
-
</Wrapper>
|
|
47
|
-
);
|
|
48
|
-
};
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
**Wrapper** (`components/wrapper/wrapper.css.ts`)
|
|
52
|
-
|
|
53
|
-
```tsx
|
|
54
|
-
import { styled } from '@salty-css/react/styled';
|
|
55
|
-
|
|
56
|
-
export const Wrapper = styled('div', {
|
|
57
|
-
base: {
|
|
58
|
-
display: 'block',
|
|
59
|
-
padding: '2vw',
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
**Button** (`components/button/button.css.ts`)
|
|
65
|
-
|
|
66
|
-
```tsx
|
|
67
|
-
import { styled } from '@salty-css/react/styled';
|
|
68
|
-
|
|
69
|
-
export const Button = styled('button', {
|
|
70
|
-
base: {
|
|
71
|
-
display: 'block',
|
|
72
|
-
padding: `0.6em 1.2em`,
|
|
73
|
-
border: '1px solid currentColor',
|
|
74
|
-
background: 'transparent',
|
|
75
|
-
color: 'currentColor/40',
|
|
76
|
-
cursor: 'pointer',
|
|
77
|
-
transition: '200ms',
|
|
78
|
-
textDecoration: 'none',
|
|
79
|
-
'&:hover': {
|
|
80
|
-
background: 'black',
|
|
81
|
-
borderColor: 'black',
|
|
82
|
-
color: 'white',
|
|
83
|
-
},
|
|
84
|
-
'&:disabled': {
|
|
85
|
-
opacity: 0.25,
|
|
86
|
-
pointerEvents: 'none',
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
variants: {
|
|
90
|
-
variant: {
|
|
91
|
-
outlined: {
|
|
92
|
-
// same as default styles
|
|
93
|
-
},
|
|
94
|
-
solid: {
|
|
95
|
-
'&:not(:hover)': {
|
|
96
|
-
background: 'black',
|
|
97
|
-
borderColor: 'black',
|
|
98
|
-
color: 'white',
|
|
99
|
-
},
|
|
100
|
-
'&:hover': {
|
|
101
|
-
background: 'transparent',
|
|
102
|
-
borderColor: 'currentColor',
|
|
103
|
-
color: 'currentColor',
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
});
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
More examples coming soon
|
package/bin/bin-util.d.ts
DELETED
package/bin/index.cjs
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";const R=require("commander"),i=require("fs/promises"),t=require("path"),O=require("ejs"),T=require("../compiler/index.cjs"),U=require("../pascal-case-iWoaJWwT.cjs"),S=require("winston"),z=require("fs"),A=require("child_process"),H=require("ora");var _=typeof document<"u"?document.currentScript:null;const o=S.createLogger({level:"debug",format:S.format.combine(S.format.colorize(),S.format.cli()),transports:[new S.transports.Console({})]}),E=n=>new Promise((l,u)=>{A.exec(n,m=>{if(m)return u(m);l()})}),D=async(...n)=>{const l=n.map(I=>I.replace("-D","").split("@").slice(0,-1).join("@").trim()),u=H(`Installing packages: ${l.join(", ")}`).start(),m=n.join(" ");await E(`npm install ${m}`),u.succeed(`Installed packages: ${l.join(",")}`)},W=()=>z.existsSync(t.join(process.cwd(),"node_modules",".bin","prettier"));async function x(n){try{if(!W())return;await E(`./node_modules/.bin/prettier --write "${n}"`),o.info(`Formatted ${n} with Prettier`)}catch(l){o.error(`Error formatting ${n} with Prettier:`,l)}}async function B(){const n=new R.Command;n.name("salty-css").description("Salty-CSS CLI tool to help with annoying configuration tasks.");const l={"salty.config.ts":Promise.resolve().then(()=>require("../salty.config-BupieCfE.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"))},u=async(s,d)=>{const{default:g}=await l[s],y=O.render(g,d);return{fileName:s,content:y}},m=async()=>{const s=t.join(process.cwd(),".saltyrc");return await i.readFile(s,"utf-8").then(JSON.parse).catch(()=>({}))},I=async()=>{const s=new URL("../package.json",typeof document>"u"?require("url").pathToFileURL(__filename).href:_&&_.tagName.toUpperCase()==="SCRIPT"&&_.src||new URL("bin/index.cjs",document.baseURI).href);return await i.readFile(s,"utf-8").then(JSON.parse).catch(()=>({}))},N=await(async()=>(await m()).defaultProject)(),P=await I(),v={core:`@salty-css/core@${P.version}`,react:`@salty-css/react@${P.version}`,eslintPluginCore:`@salty-css/eslint-plugin-core@${P.version}`,vite:`@salty-css/vite@${P.version}`};n.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(s){o.info("Initializing a new Salty-CSS project!");const{dir:d=s,cssFile:g,skipInstall:y}=this.opts();y||(await D(v.core,v.react),await D(`-D ${v.eslintPluginCore}`));const w=process.cwd(),p=t.join(w,d),$=await Promise.all([u("salty.config.ts"),u("saltygen/index.css")]);await i.mkdir(p,{recursive:!0});const k=$.map(async({fileName:e,content:r})=>{const f=t.join(p,e);if(await i.readFile(f,"utf-8").catch(()=>{})!==void 0){o.debug("File already exists: "+f);return}const J=e.split("/").slice(0,-1).join("/");J&&await i.mkdir(t.join(p,J),{recursive:!0}),o.info("Writing file: "+f),await i.writeFile(f,r),await x(f)});await Promise.all(k);const a=t.relative(w,p),c=t.join(w,".saltyrc"),b=await i.readFile(c,"utf-8").catch(()=>{});if(b===void 0){o.info("Creating file: "+c);const r=JSON.stringify({defaultProject:a,projects:[a]},null,2);await i.writeFile(c,r)}else{o.info("Edit file: "+c);const e=JSON.parse(b),r=new Set((e==null?void 0:e.projects)||[]);r.add(a),e.projects=[...r];const f=JSON.stringify(e,null,2);await i.writeFile(c,f)}const h=t.join(w,".gitignore"),j=await i.readFile(h,"utf-8").catch(()=>{});if(j!==void 0&&(j.includes("saltygen")||(o.info("Edit file: "+h),await i.writeFile(h,j+`
|
|
3
|
-
|
|
4
|
-
# Salty-CSS
|
|
5
|
-
saltygen
|
|
6
|
-
`))),g){const e=t.join(p,g),r=await i.readFile(e,"utf-8").catch(()=>{});if(r!==void 0&&!r.includes("saltygen")){const F=t.join(e,".."),L=`@import '${t.relative(F,t.join(p,"saltygen/index.css"))}';`;o.info("Edit file: "+e),await i.writeFile(e,L+`
|
|
7
|
-
`+r),await x(e)}}const C=t.join(p,"vite.config.ts"),q=await i.readFile(C,"utf-8").catch(()=>{});if(q!==void 0&&!q.includes("saltyPlugin")){o.info("Edit file: "+C);const r=`import { saltyPlugin } from '@salty-css/vite';
|
|
8
|
-
`,F=q.replace(/(plugins: \[)/,`$1
|
|
9
|
-
saltyPlugin(__dirname),`);o.info("Installing @salty-css/vite"),y||await D(`-D ${v.vite}`),o.info("Adding Salty-CSS plugin to Vite config..."),await i.writeFile(C,r+F),await x(C)}}),n.command("build [directory]").alias("b").description("Build the Salty-CSS project.").option("-d, --dir <dir>","Project directory to build the project in.").action(async function(s=N){o.info("Building the Salty-CSS project...");const{dir:d=s}=this.opts(),g=t.join(process.cwd(),d);await T.generateCss(g)}),n.command("generate [file]").alias("g").description("Generate a new component file.").option("-f, --file <file>","File to generate.").option("-d, --dir <dir>","Project directory to generate the file in.",N).option("-t, --tag <tag>","HTML tag of the component.","div").option("-n, --name <name>","Name of the component.").option("-c, --className <className>","CSS class of the component.").action(async function(s){const{file:d=s,dir:g,tag:y,name:w,className:p}=this.opts(),$=t.join(process.cwd(),g),k=t.join($,d),a=t.parse(k);a.ext||(a.ext=".ts"),a.name.endsWith(".css")||(a.name=a.name+".css"),a.base=a.name+a.ext;const c=t.format(a);if(await i.readFile(c,"utf-8").catch(()=>{})!==void 0){o.error("File already exists:",c);return}o.info("Generating a new file: "+c);const h=U.pascalCase(w||a.base.replace(/\.css\.\w+$/,"")),{content:j}=await u("react/react-styled-file.ts",{tag:y,name:h,className:p});await i.writeFile(c,j),await x(c)}),n.parseAsync(process.argv)}B().catch(n=>console.error(n));
|
package/bin/index.d.ts
DELETED
package/bin/index.js
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { Command as H } from "commander";
|
|
3
|
-
import { mkdir as _, readFile as g, writeFile as y } from "fs/promises";
|
|
4
|
-
import { join as o, relative as z, parse as T, format as W } from "path";
|
|
5
|
-
import { render as B } from "ejs";
|
|
6
|
-
import { generateCss as G } from "../compiler/index.js";
|
|
7
|
-
import { p as R } from "../pascal-case-BQpR5PdN.js";
|
|
8
|
-
import { createLogger as M, format as E, transports as U } from "winston";
|
|
9
|
-
import { existsSync as V } from "fs";
|
|
10
|
-
import { exec as q } from "child_process";
|
|
11
|
-
import K from "ora";
|
|
12
|
-
const n = M({
|
|
13
|
-
level: "debug",
|
|
14
|
-
format: E.combine(E.colorize(), E.cli()),
|
|
15
|
-
transports: [new U.Console({})]
|
|
16
|
-
}), L = (e) => new Promise((c, m) => {
|
|
17
|
-
q(e, (u) => {
|
|
18
|
-
if (u) return m(u);
|
|
19
|
-
c();
|
|
20
|
-
});
|
|
21
|
-
}), N = async (...e) => {
|
|
22
|
-
const c = e.map(($) => $.replace("-D", "").split("@").slice(0, -1).join("@").trim()), m = K(`Installing packages: ${c.join(", ")}`).start(), u = e.join(" ");
|
|
23
|
-
await L(`npm install ${u}`), m.succeed(`Installed packages: ${c.join(",")}`);
|
|
24
|
-
}, Q = () => V(o(process.cwd(), "node_modules", ".bin", "prettier"));
|
|
25
|
-
async function F(e) {
|
|
26
|
-
try {
|
|
27
|
-
if (!Q()) return;
|
|
28
|
-
await L(`./node_modules/.bin/prettier --write "${e}"`), n.info(`Formatted ${e} with Prettier`);
|
|
29
|
-
} catch (c) {
|
|
30
|
-
n.error(`Error formatting ${e} with Prettier:`, c);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
async function X() {
|
|
34
|
-
const e = new H();
|
|
35
|
-
e.name("salty-css").description("Salty-CSS CLI tool to help with annoying configuration tasks.");
|
|
36
|
-
const c = {
|
|
37
|
-
// Core files
|
|
38
|
-
"salty.config.ts": import("../salty.config-D9ANEDiH.js"),
|
|
39
|
-
"saltygen/index.css": import("../index-D_732b92.js"),
|
|
40
|
-
// React
|
|
41
|
-
"react/react-styled-file.ts": import("../react-styled-file-CGVf5n1B.js")
|
|
42
|
-
}, m = async (a, l) => {
|
|
43
|
-
const { default: f } = await c[a], w = B(f, l);
|
|
44
|
-
return { fileName: a, content: w };
|
|
45
|
-
}, u = async () => {
|
|
46
|
-
const a = o(process.cwd(), ".saltyrc");
|
|
47
|
-
return await g(a, "utf-8").then(JSON.parse).catch(() => ({}));
|
|
48
|
-
}, $ = async () => {
|
|
49
|
-
const a = new URL("../package.json", import.meta.url);
|
|
50
|
-
return await g(a, "utf-8").then(JSON.parse).catch(() => ({}));
|
|
51
|
-
}, O = await (async () => (await u()).defaultProject)(), v = await $(), C = {
|
|
52
|
-
core: `@salty-css/core@${v.version}`,
|
|
53
|
-
react: `@salty-css/react@${v.version}`,
|
|
54
|
-
eslintPluginCore: `@salty-css/eslint-plugin-core@${v.version}`,
|
|
55
|
-
vite: `@salty-css/vite@${v.version}`
|
|
56
|
-
};
|
|
57
|
-
e.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(a) {
|
|
58
|
-
n.info("Initializing a new Salty-CSS project!");
|
|
59
|
-
const { dir: l = a, cssFile: f, skipInstall: w } = this.opts();
|
|
60
|
-
w || (await N(C.core, C.react), await N(`-D ${C.eslintPluginCore}`));
|
|
61
|
-
const h = process.cwd(), d = o(h, l), I = await Promise.all([m("salty.config.ts"), m("saltygen/index.css")]);
|
|
62
|
-
await _(d, { recursive: !0 });
|
|
63
|
-
const k = I.map(async ({ fileName: t, content: s }) => {
|
|
64
|
-
const p = o(d, t);
|
|
65
|
-
if (await g(p, "utf-8").catch(() => {
|
|
66
|
-
}) !== void 0) {
|
|
67
|
-
n.debug("File already exists: " + p);
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
const D = t.split("/").slice(0, -1).join("/");
|
|
71
|
-
D && await _(o(d, D), { recursive: !0 }), n.info("Writing file: " + p), await y(p, s), await F(p);
|
|
72
|
-
});
|
|
73
|
-
await Promise.all(k);
|
|
74
|
-
const i = z(h, d), r = o(h, ".saltyrc"), b = await g(r, "utf-8").catch(() => {
|
|
75
|
-
});
|
|
76
|
-
if (b === void 0) {
|
|
77
|
-
n.info("Creating file: " + r);
|
|
78
|
-
const s = JSON.stringify({
|
|
79
|
-
defaultProject: i,
|
|
80
|
-
projects: [i]
|
|
81
|
-
}, null, 2);
|
|
82
|
-
await y(r, s);
|
|
83
|
-
} else {
|
|
84
|
-
n.info("Edit file: " + r);
|
|
85
|
-
const t = JSON.parse(b), s = new Set((t == null ? void 0 : t.projects) || []);
|
|
86
|
-
s.add(i), t.projects = [...s];
|
|
87
|
-
const p = JSON.stringify(t, null, 2);
|
|
88
|
-
await y(r, p);
|
|
89
|
-
}
|
|
90
|
-
const S = o(h, ".gitignore"), P = await g(S, "utf-8").catch(() => {
|
|
91
|
-
});
|
|
92
|
-
if (P !== void 0 && (P.includes("saltygen") || (n.info("Edit file: " + S), await y(S, P + `
|
|
93
|
-
|
|
94
|
-
# Salty-CSS
|
|
95
|
-
saltygen
|
|
96
|
-
`))), f) {
|
|
97
|
-
const t = o(d, f), s = await g(t, "utf-8").catch(() => {
|
|
98
|
-
});
|
|
99
|
-
if (s !== void 0 && !s.includes("saltygen")) {
|
|
100
|
-
const x = o(t, ".."), A = `@import '${z(x, o(d, "saltygen/index.css"))}';`;
|
|
101
|
-
n.info("Edit file: " + t), await y(t, A + `
|
|
102
|
-
` + s), await F(t);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
const j = o(d, "vite.config.ts"), J = await g(j, "utf-8").catch(() => {
|
|
106
|
-
});
|
|
107
|
-
if (J !== void 0 && !J.includes("saltyPlugin")) {
|
|
108
|
-
n.info("Edit file: " + j);
|
|
109
|
-
const s = `import { saltyPlugin } from '@salty-css/vite';
|
|
110
|
-
`, x = J.replace(/(plugins: \[)/, `$1
|
|
111
|
-
saltyPlugin(__dirname),`);
|
|
112
|
-
n.info("Installing @salty-css/vite"), w || await N(`-D ${C.vite}`), n.info("Adding Salty-CSS plugin to Vite config..."), await y(j, s + x), await F(j);
|
|
113
|
-
}
|
|
114
|
-
}), e.command("build [directory]").alias("b").description("Build the Salty-CSS project.").option("-d, --dir <dir>", "Project directory to build the project in.").action(async function(a = O) {
|
|
115
|
-
n.info("Building the Salty-CSS project...");
|
|
116
|
-
const { dir: l = a } = this.opts(), f = o(process.cwd(), l);
|
|
117
|
-
await G(f);
|
|
118
|
-
}), e.command("generate [file]").alias("g").description("Generate a new component file.").option("-f, --file <file>", "File to generate.").option("-d, --dir <dir>", "Project directory to generate the file in.", O).option("-t, --tag <tag>", "HTML tag of the component.", "div").option("-n, --name <name>", "Name of the component.").option("-c, --className <className>", "CSS class of the component.").action(async function(a) {
|
|
119
|
-
const { file: l = a, dir: f, tag: w, name: h, className: d } = this.opts(), I = o(process.cwd(), f), k = o(I, l), i = T(k);
|
|
120
|
-
i.ext || (i.ext = ".ts"), i.name.endsWith(".css") || (i.name = i.name + ".css"), i.base = i.name + i.ext;
|
|
121
|
-
const r = W(i);
|
|
122
|
-
if (await g(r, "utf-8").catch(() => {
|
|
123
|
-
}) !== void 0) {
|
|
124
|
-
n.error("File already exists:", r);
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
n.info("Generating a new file: " + r);
|
|
128
|
-
const S = R(h || i.base.replace(/\.css\.\w+$/, "")), { content: P } = await m("react/react-styled-file.ts", { tag: w, name: S, className: d });
|
|
129
|
-
await y(r, P), await F(r);
|
|
130
|
-
}), e.parseAsync(process.argv);
|
|
131
|
-
}
|
|
132
|
-
X().catch((e) => console.error(e));
|
package/bin/logger.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const logger: import('winston').Logger;
|
package/bin/prettier.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function formatWithPrettier(filePath: string): Promise<void>;
|
package/compiler/index.cjs
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const z=require("esbuild"),B=require("child_process"),P=require("../dash-case-DKzpenwY.cjs"),o=require("path"),r=require("fs"),K=require("fs/promises"),V=require("../parse-templates-W0YfTmOT.cjs");function G(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,s.get?s:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const R=G(z),N=t=>o.join(t,"./saltygen"),_=["salty","css","styles","styled"],q=(t=[])=>new RegExp(`\\.(${[..._,...t].join("|")})\\.`),O=(t,e=[])=>q(e).test(t),J=async t=>{const e=N(t),n=o.join(t,"salty.config.ts"),s=o.join(e,"salty.config.js");await R.build({entryPoints:[n],minify:!0,treeShaking:!0,bundle:!0,outfile:s,format:"esm",external:["react"]});const a=Date.now(),{config:w}=await import(`${s}?t=${a}`);return w},M=async t=>{const e=await J(t),n=new Set,s=(d,y=[])=>d?Object.entries(d).flatMap(([p,c])=>{if(!c)return;if(typeof c=="object")return s(c,[...y,p]);const C=[...y,p].join(".");n.add(`"${C}"`);const x=[...y.map(P.dashCase),P.dashCase(p)].join("-"),{result:D}=V.parseValueTokens(c);return`--${x}: ${D};`}):[],a=d=>d?Object.entries(d).flatMap(([y,p])=>{const c=s(p);return y==="base"?c.join(""):`${y} { ${c.join("")} }`}):[],w=d=>d?Object.entries(d).flatMap(([y,p])=>Object.entries(p).flatMap(([c,C])=>{const x=s(C,[y]),D=`.${y}-${c}, [data-${y}="${c}"]`,k=x.join("");return`${D} { ${k} }`})):[],j=s(e.variables),S=a(e.responsiveVariables),l=w(e.conditionalVariables),b=N(t),f=o.join(b,"css/variables.css"),i=`:root { ${j.join("")} ${S.join("")} } ${l.join("")}`;r.writeFileSync(f,i);const g=o.join(b,"types/css-tokens.d.ts"),m=`type VariableTokens = ${[...n].join("|")}; type PropertyValueToken = \`{\${VariableTokens}}\``;r.writeFileSync(g,m);const u=o.join(b,"css/global.css"),h=V.parseStyles(e.global,"");r.writeFileSync(u,h);const F=o.join(b,"css/templates.css"),v=V.parseTemplates(e.templates);r.writeFileSync(F,v)},T=async(t,e)=>{const n=P.toHash(t),s=o.join(e,"js",n+".js");await R.build({entryPoints:[t],minify:!0,treeShaking:!0,bundle:!0,outfile:s,format:"esm",target:["es2022"],keepNames:!0,external:["react"]});const a=Date.now();return await import(`${s}?t=${a}`)},E=async t=>{const e=N(t),n=o.join(e,"salty.config.js"),{config:s}=await import(n);return s},A=async t=>{try{const e=[],n=[],s=N(t),a=o.join(s,"index.css");(()=>{r.existsSync(s)&&B.execSync("rm -rf "+s),r.mkdirSync(s),r.mkdirSync(o.join(s,"css")),r.mkdirSync(o.join(s,"types"))})(),await M(t);const j=await E(t);async function S(i,g){const $=r.statSync(i);if($.isDirectory()){const m=r.readdirSync(i);await Promise.all(m.map(u=>S(o.join(i,u),o.join(g,u))))}else if($.isFile()&&O(i)){const u=await T(i,s),h=[];Object.entries(u).forEach(([y,p])=>{if(p.isKeyframes&&p.css){const k=`${p.animationName}.css`,H=`css/${k}`,I=o.join(s,H);e.push(k),r.writeFileSync(I,p.css);return}if(!p.generator)return;const c=p.generator._withBuildContext({name:y,config:j}),C=`${c.hash}-${c.priority}.css`;n[c.priority]||(n[c.priority]=[]),n[c.priority].push(C),h.push(C);const x=`css/${C}`,D=o.join(s,x);r.writeFileSync(D,c.css)});const F=h.map(y=>`@import url('./${y}');`).join(`
|
|
2
|
-
`),v=P.toHash(i,6),d=o.join(s,`css/${v}.css`);r.writeFileSync(d,F)}}await S(t,s);const l=e.map(i=>`@import url('./css/${i}');`).join(`
|
|
3
|
-
`);let f=`@layer l0, l1, l2, l3, l4, l5, l6, l7, l8;
|
|
4
|
-
|
|
5
|
-
${["@import url('./css/variables.css');","@import url('./css/global.css');","@import url('./css/templates.css');"].join(`
|
|
6
|
-
`)}
|
|
7
|
-
${l}`;if(j.importStrategy!=="component"){const i=n.flat().map(g=>`@import url('./css/${g}');`).join(`
|
|
8
|
-
`);f+=i}r.writeFileSync(a,f)}catch(e){console.error(e)}},L=async(t,e)=>{try{const n=[],s=o.join(t,"./saltygen"),a=o.join(s,"index.css");if(O(e)){const j=await E(t),S=await T(e,s);Object.entries(S).forEach(([g,$])=>{if(!$.generator)return;const m=$.generator._withBuildContext({name:g,config:j}),u=`${m.hash}-${m.priority}.css`,h=`css/${u}`,F=o.join(s,h);n.push(u),r.writeFileSync(F,m.css)});const l=r.readFileSync(a,"utf8").split(`
|
|
9
|
-
`),b=n.map(g=>`@import url('../saltygen/css/${g}');`),i=[...new Set([...l,...b])].join(`
|
|
10
|
-
`);r.writeFileSync(a,i)}}catch(n){console.error(n)}},U=async(t,e)=>{try{const n=o.join(t,"./saltygen");if(O(e)){const a=r.readFileSync(e,"utf8");a.replace(/^(?!export\s)const\s.*/gm,f=>`export ${f}`)!==a&&await K.writeFile(e,a);const j=await E(t),S=await T(e,n);let l=a;Object.entries(S).forEach(([f,i])=>{var F;if(i.isKeyframes){console.log("value",i);return}if(!i.generator)return;const g=i.generator._withBuildContext({name:f,config:j}),$=new RegExp(`${f}[=\\s]+[^()]+styled\\(([^,]+),`,"g").exec(a);if(!$)return console.error("Could not find the original declaration");const m=(F=$.at(1))==null?void 0:F.trim(),u=`${f} = styled(${m}, "${g.classNames}", "${g._callerName}", ${JSON.stringify(g.props)});`,h=new RegExp(`${f}[=\\s]+[^()]+styled\\(([^,]+),[^;]+;`,"g");l=l.replace(h,u)});const b=P.toHash(e,6);return j.importStrategy==="component"&&(l=`import '../../saltygen/css/${b}.css';
|
|
11
|
-
${l}`),l=l.replace("{ styled }","{ styledClient as styled }"),l=l.replace("@salty-css/react/styled","@salty-css/react/styled-client"),l}}catch(n){console.error(n)}};exports.compileSaltyFile=T;exports.generateConfigStyles=M;exports.generateCss=A;exports.generateFile=L;exports.isSaltyFile=O;exports.minimizeFile=U;exports.saltyFileExtensions=_;exports.saltyFileRegExp=q;
|
package/compiler/index.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { StyleComponentGenerator } from '../generator/style-generator';
|
|
2
|
-
export declare const saltyFileExtensions: string[];
|
|
3
|
-
export declare const saltyFileRegExp: (additional?: string[]) => RegExp;
|
|
4
|
-
export declare const isSaltyFile: (file: string, additional?: string[]) => boolean;
|
|
5
|
-
export declare const generateConfigStyles: (dirname: string) => Promise<void>;
|
|
6
|
-
export declare const compileSaltyFile: (sourceFilePath: string, outputDirectory: string) => Promise<{
|
|
7
|
-
[key: string]: {
|
|
8
|
-
generator: StyleComponentGenerator;
|
|
9
|
-
isKeyframes?: boolean;
|
|
10
|
-
animationName?: string;
|
|
11
|
-
css?: string;
|
|
12
|
-
};
|
|
13
|
-
}>;
|
|
14
|
-
export declare const generateCss: (dirname: string) => Promise<void>;
|
|
15
|
-
export declare const generateFile: (dirname: string, file: string) => Promise<void>;
|
|
16
|
-
export declare const minimizeFile: (dirname: string, file: string) => Promise<string | undefined>;
|
package/compiler/index.js
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import * as I from "esbuild";
|
|
2
|
-
import { execSync as H } from "child_process";
|
|
3
|
-
import { t as T, d as R } from "../dash-case-DMQMcCO6.js";
|
|
4
|
-
import { join as o } from "path";
|
|
5
|
-
import { writeFileSync as $, existsSync as K, mkdirSync as V, statSync as z, readdirSync as G, readFileSync as M } from "fs";
|
|
6
|
-
import { writeFile as J } from "fs/promises";
|
|
7
|
-
import { p as q, a as A, b as L } from "../parse-templates-D4p3pgQR.js";
|
|
8
|
-
const N = (s) => o(s, "./saltygen"), U = ["salty", "css", "styles", "styled"], W = (s = []) => new RegExp(`\\.(${[...U, ...s].join("|")})\\.`), v = (s, e = []) => W(e).test(s), X = async (s) => {
|
|
9
|
-
const e = N(s), n = o(s, "salty.config.ts"), t = o(e, "salty.config.js");
|
|
10
|
-
await I.build({
|
|
11
|
-
entryPoints: [n],
|
|
12
|
-
minify: !0,
|
|
13
|
-
treeShaking: !0,
|
|
14
|
-
bundle: !0,
|
|
15
|
-
outfile: t,
|
|
16
|
-
format: "esm",
|
|
17
|
-
external: ["react"]
|
|
18
|
-
});
|
|
19
|
-
const c = Date.now(), { config: S } = await import(`${t}?t=${c}`);
|
|
20
|
-
return S;
|
|
21
|
-
}, Y = async (s) => {
|
|
22
|
-
const e = await X(s), n = /* @__PURE__ */ new Set(), t = (u, l = []) => u ? Object.entries(u).flatMap(([p, r]) => {
|
|
23
|
-
if (!r) return;
|
|
24
|
-
if (typeof r == "object") return t(r, [...l, p]);
|
|
25
|
-
const x = [...l, p].join(".");
|
|
26
|
-
n.add(`"${x}"`);
|
|
27
|
-
const C = [...l.map(R), R(p)].join("-"), { result: D } = L(r);
|
|
28
|
-
return `--${C}: ${D};`;
|
|
29
|
-
}) : [], c = (u) => u ? Object.entries(u).flatMap(([l, p]) => {
|
|
30
|
-
const r = t(p);
|
|
31
|
-
return l === "base" ? r.join("") : `${l} { ${r.join("")} }`;
|
|
32
|
-
}) : [], S = (u) => u ? Object.entries(u).flatMap(([l, p]) => Object.entries(p).flatMap(([r, x]) => {
|
|
33
|
-
const C = t(x, [l]), D = `.${l}-${r}, [data-${l}="${r}"]`, P = C.join("");
|
|
34
|
-
return `${D} { ${P} }`;
|
|
35
|
-
})) : [], d = t(e.variables), w = c(e.responsiveVariables), a = S(e.conditionalVariables), b = N(s), f = o(b, "css/variables.css"), i = `:root { ${d.join("")} ${w.join("")} } ${a.join("")}`;
|
|
36
|
-
$(f, i);
|
|
37
|
-
const y = o(b, "types/css-tokens.d.ts"), m = `type VariableTokens = ${[...n].join("|")}; type PropertyValueToken = \`{\${VariableTokens}}\``;
|
|
38
|
-
$(y, m);
|
|
39
|
-
const g = o(b, "css/global.css"), F = q(e.global, "");
|
|
40
|
-
$(g, F);
|
|
41
|
-
const j = o(b, "css/templates.css"), k = A(e.templates);
|
|
42
|
-
$(j, k);
|
|
43
|
-
}, E = async (s, e) => {
|
|
44
|
-
const n = T(s), t = o(e, "js", n + ".js");
|
|
45
|
-
await I.build({
|
|
46
|
-
entryPoints: [s],
|
|
47
|
-
minify: !0,
|
|
48
|
-
treeShaking: !0,
|
|
49
|
-
bundle: !0,
|
|
50
|
-
outfile: t,
|
|
51
|
-
format: "esm",
|
|
52
|
-
target: ["es2022"],
|
|
53
|
-
keepNames: !0,
|
|
54
|
-
external: ["react"]
|
|
55
|
-
});
|
|
56
|
-
const c = Date.now();
|
|
57
|
-
return await import(`${t}?t=${c}`);
|
|
58
|
-
}, O = async (s) => {
|
|
59
|
-
const e = N(s), n = o(e, "salty.config.js"), { config: t } = await import(n);
|
|
60
|
-
return t;
|
|
61
|
-
}, ot = async (s) => {
|
|
62
|
-
try {
|
|
63
|
-
const e = [], n = [], t = N(s), c = o(t, "index.css");
|
|
64
|
-
(() => {
|
|
65
|
-
K(t) && H("rm -rf " + t), V(t), V(o(t, "css")), V(o(t, "types"));
|
|
66
|
-
})(), await Y(s);
|
|
67
|
-
const d = await O(s);
|
|
68
|
-
async function w(i, y) {
|
|
69
|
-
const h = z(i);
|
|
70
|
-
if (h.isDirectory()) {
|
|
71
|
-
const m = G(i);
|
|
72
|
-
await Promise.all(m.map((g) => w(o(i, g), o(y, g))));
|
|
73
|
-
} else if (h.isFile() && v(i)) {
|
|
74
|
-
const g = await E(i, t), F = [];
|
|
75
|
-
Object.entries(g).forEach(([l, p]) => {
|
|
76
|
-
if (p.isKeyframes && p.css) {
|
|
77
|
-
const P = `${p.animationName}.css`, _ = `css/${P}`, B = o(t, _);
|
|
78
|
-
e.push(P), $(B, p.css);
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
if (!p.generator) return;
|
|
82
|
-
const r = p.generator._withBuildContext({
|
|
83
|
-
name: l,
|
|
84
|
-
config: d
|
|
85
|
-
}), x = `${r.hash}-${r.priority}.css`;
|
|
86
|
-
n[r.priority] || (n[r.priority] = []), n[r.priority].push(x), F.push(x);
|
|
87
|
-
const C = `css/${x}`, D = o(t, C);
|
|
88
|
-
$(D, r.css);
|
|
89
|
-
});
|
|
90
|
-
const j = F.map((l) => `@import url('./${l}');`).join(`
|
|
91
|
-
`), k = T(i, 6), u = o(t, `css/${k}.css`);
|
|
92
|
-
$(u, j);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
await w(s, t);
|
|
96
|
-
const a = e.map((i) => `@import url('./css/${i}');`).join(`
|
|
97
|
-
`);
|
|
98
|
-
let f = `@layer l0, l1, l2, l3, l4, l5, l6, l7, l8;
|
|
99
|
-
|
|
100
|
-
${["@import url('./css/variables.css');", "@import url('./css/global.css');", "@import url('./css/templates.css');"].join(`
|
|
101
|
-
`)}
|
|
102
|
-
${a}`;
|
|
103
|
-
if (d.importStrategy !== "component") {
|
|
104
|
-
const i = n.flat().map((y) => `@import url('./css/${y}');`).join(`
|
|
105
|
-
`);
|
|
106
|
-
f += i;
|
|
107
|
-
}
|
|
108
|
-
$(c, f);
|
|
109
|
-
} catch (e) {
|
|
110
|
-
console.error(e);
|
|
111
|
-
}
|
|
112
|
-
}, it = async (s, e) => {
|
|
113
|
-
try {
|
|
114
|
-
const n = [], t = o(s, "./saltygen"), c = o(t, "index.css");
|
|
115
|
-
if (v(e)) {
|
|
116
|
-
const d = await O(s), w = await E(e, t);
|
|
117
|
-
Object.entries(w).forEach(([y, h]) => {
|
|
118
|
-
if (!h.generator) return;
|
|
119
|
-
const m = h.generator._withBuildContext({
|
|
120
|
-
name: y,
|
|
121
|
-
config: d
|
|
122
|
-
}), g = `${m.hash}-${m.priority}.css`, F = `css/${g}`, j = o(t, F);
|
|
123
|
-
n.push(g), $(j, m.css);
|
|
124
|
-
});
|
|
125
|
-
const a = M(c, "utf8").split(`
|
|
126
|
-
`), b = n.map((y) => `@import url('../saltygen/css/${y}');`), i = [.../* @__PURE__ */ new Set([...a, ...b])].join(`
|
|
127
|
-
`);
|
|
128
|
-
$(c, i);
|
|
129
|
-
}
|
|
130
|
-
} catch (n) {
|
|
131
|
-
console.error(n);
|
|
132
|
-
}
|
|
133
|
-
}, rt = async (s, e) => {
|
|
134
|
-
try {
|
|
135
|
-
const n = o(s, "./saltygen");
|
|
136
|
-
if (v(e)) {
|
|
137
|
-
const c = M(e, "utf8");
|
|
138
|
-
c.replace(/^(?!export\s)const\s.*/gm, (f) => `export ${f}`) !== c && await J(e, c);
|
|
139
|
-
const d = await O(s), w = await E(e, n);
|
|
140
|
-
let a = c;
|
|
141
|
-
Object.entries(w).forEach(([f, i]) => {
|
|
142
|
-
var j;
|
|
143
|
-
if (i.isKeyframes) {
|
|
144
|
-
console.log("value", i);
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
if (!i.generator) return;
|
|
148
|
-
const y = i.generator._withBuildContext({
|
|
149
|
-
name: f,
|
|
150
|
-
config: d
|
|
151
|
-
}), h = new RegExp(`${f}[=\\s]+[^()]+styled\\(([^,]+),`, "g").exec(c);
|
|
152
|
-
if (!h)
|
|
153
|
-
return console.error("Could not find the original declaration");
|
|
154
|
-
const m = (j = h.at(1)) == null ? void 0 : j.trim(), g = `${f} = styled(${m}, "${y.classNames}", "${y._callerName}", ${JSON.stringify(y.props)});`, F = new RegExp(`${f}[=\\s]+[^()]+styled\\(([^,]+),[^;]+;`, "g");
|
|
155
|
-
a = a.replace(F, g);
|
|
156
|
-
});
|
|
157
|
-
const b = T(e, 6);
|
|
158
|
-
return d.importStrategy === "component" && (a = `import '../../saltygen/css/${b}.css';
|
|
159
|
-
${a}`), a = a.replace("{ styled }", "{ styledClient as styled }"), a = a.replace("@salty-css/react/styled", "@salty-css/react/styled-client"), a;
|
|
160
|
-
}
|
|
161
|
-
} catch (n) {
|
|
162
|
-
console.error(n);
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
export {
|
|
166
|
-
E as compileSaltyFile,
|
|
167
|
-
Y as generateConfigStyles,
|
|
168
|
-
ot as generateCss,
|
|
169
|
-
it as generateFile,
|
|
170
|
-
v as isSaltyFile,
|
|
171
|
-
rt as minimizeFile,
|
|
172
|
-
U as saltyFileExtensions,
|
|
173
|
-
W as saltyFileRegExp
|
|
174
|
-
};
|
package/config/config-types.d.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { CssStyles } from '../types';
|
|
2
|
-
type CssTemplate = CssStyles | {
|
|
3
|
-
[key: PropertyKey]: CssTemplate;
|
|
4
|
-
};
|
|
5
|
-
export type CssVariables = Record<string, unknown>;
|
|
6
|
-
export interface CssResponsiveVariables {
|
|
7
|
-
[key: string]: CssVariables;
|
|
8
|
-
}
|
|
9
|
-
export interface CssConditionalVariables {
|
|
10
|
-
[key: PropertyKey]: {
|
|
11
|
-
[key: PropertyKey]: CssVariables;
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
export interface CssTemplates {
|
|
15
|
-
[key: PropertyKey]: {
|
|
16
|
-
[key: PropertyKey]: CssTemplate;
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
export interface CssModifier {
|
|
20
|
-
pattern: RegExp;
|
|
21
|
-
transform: (regexMatch: string) => {
|
|
22
|
-
css?: CssStyles;
|
|
23
|
-
value: string;
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
export type CssModifiers = Record<string, CssModifier>;
|
|
27
|
-
export interface SaltyConfig {
|
|
28
|
-
/**
|
|
29
|
-
* The import strategy to use when importing css files.
|
|
30
|
-
* - `root` will import the css file from the root of the project.
|
|
31
|
-
* - `component` will import the css file from the component's directory.
|
|
32
|
-
*/
|
|
33
|
-
importStrategy?: 'root' | 'component';
|
|
34
|
-
/**
|
|
35
|
-
* Base variables that can be used in all styles as they are applied globally to :root.
|
|
36
|
-
*/
|
|
37
|
-
variables?: CssVariables;
|
|
38
|
-
/**
|
|
39
|
-
* Variables that are defined for different media queries.
|
|
40
|
-
*/
|
|
41
|
-
responsiveVariables?: CssResponsiveVariables;
|
|
42
|
-
/**
|
|
43
|
-
* Variables that are defined for different parent selectors (classes or data attributes).
|
|
44
|
-
*/
|
|
45
|
-
conditionalVariables?: CssConditionalVariables;
|
|
46
|
-
/**
|
|
47
|
-
* The global styles that are imported in the root of the project.
|
|
48
|
-
*/
|
|
49
|
-
global?: CssStyles;
|
|
50
|
-
/**
|
|
51
|
-
* The templates that can be used in styles to create reusable css.
|
|
52
|
-
*/
|
|
53
|
-
templates?: CssTemplates;
|
|
54
|
-
/**
|
|
55
|
-
* The modifiers that can transform css values.
|
|
56
|
-
*/
|
|
57
|
-
modifiers?: CssModifiers;
|
|
58
|
-
}
|
|
59
|
-
export {};
|
package/config/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=e=>e;exports.defineConfig=n;
|
package/config/index.d.ts
DELETED
package/config/index.js
DELETED
package/css/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=e=>`{${e}}`;exports.token=t;
|
package/css/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const token: <T extends VariableTokens>(token: T) => string;
|
package/css/index.js
DELETED
package/dash-case-DKzpenwY.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const n=e=>String.fromCharCode(e+(e>25?39:97)),i=(e,r)=>{let t="",a;for(a=Math.abs(e);a>52;a=a/52|0)t=n(a%52)+t;return t=n(a%52)+t,t.length<r?t=t.padStart(r,"a"):t.length>r&&(t=t.slice(-r)),t},o=(e,r)=>{let t=r.length;for(;t;)e=e*33^r.charCodeAt(--t);return e},c=(e,r=3)=>{const t=o(5381,JSON.stringify(e))>>>0;return i(t,r)};function s(e){return e?typeof e!="string"?s(String(e)):e.replace(/\s/g,"-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g,(r,t)=>(t>0?"-":"")+r.toLowerCase()):""}exports.dashCase=s;exports.toHash=c;
|
package/dash-case-DMQMcCO6.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
const n = (e) => String.fromCharCode(e + (e > 25 ? 39 : 97)), o = (e, r) => {
|
|
2
|
-
let t = "", a;
|
|
3
|
-
for (a = Math.abs(e); a > 52; a = a / 52 | 0) t = n(a % 52) + t;
|
|
4
|
-
return t = n(a % 52) + t, t.length < r ? t = t.padStart(r, "a") : t.length > r && (t = t.slice(-r)), t;
|
|
5
|
-
}, i = (e, r) => {
|
|
6
|
-
let t = r.length;
|
|
7
|
-
for (; t; ) e = e * 33 ^ r.charCodeAt(--t);
|
|
8
|
-
return e;
|
|
9
|
-
}, c = (e, r = 3) => {
|
|
10
|
-
const t = i(5381, JSON.stringify(e)) >>> 0;
|
|
11
|
-
return o(t, r);
|
|
12
|
-
};
|
|
13
|
-
function s(e) {
|
|
14
|
-
return e ? typeof e != "string" ? s(String(e)) : e.replace(/\s/g, "-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g, (r, t) => (t > 0 ? "-" : "") + r.toLowerCase()) : "";
|
|
15
|
-
}
|
|
16
|
-
export {
|
|
17
|
-
s as d,
|
|
18
|
-
c as t
|
|
19
|
-
};
|
package/generator/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var m=Object.defineProperty;var l=(a,t,s)=>t in a?m(a,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[t]=s;var c=(a,t,s)=>l(a,typeof t!="symbol"?t+"":t,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../dash-case-DKzpenwY.cjs"),p=require("../parse-templates-W0YfTmOT.cjs");class g{constructor(t,s){c(this,"_callerName");c(this,"_context");this.tagName=t,this.params=s}get hash(){return u.toHash(this.params.base||this.params)}get priority(){var t;return typeof this.tagName=="function"||typeof this.tagName=="object"?(((t=this.tagName.generator)==null?void 0:t.priority)||0)+1:0}get classNames(){const t=[this.hash],{className:s}=this.params;return s&&t.push(s),t.join(" ")}get cssClassName(){return this.hash}get cssDisplayNameVar(){return`--${this.hash}-display-name: ${this._callerName};`}get templateKeys(){var t;return(t=this._context)!=null&&t.config.templates?p.getTemplateKeys(this._context.config.templates):[]}get css(){var e;const{base:t={},variants:s={},compoundVariants:r=[]}=this.params,i={...t,variants:s,compoundVariants:r};return p.parseStyles(i,`.${this.cssClassName}`,this.priority,(e=this._context)==null?void 0:e.config)}get props(){const{element:t}=this.params,s=this.params.variants?Object.keys(this.params.variants).map(e=>{var n;const o=(n=this.params.defaultVariants)==null?void 0:n[e];return o!==void 0?`${e}=${String(o)}`:e}):void 0,r=new Set([]),i=/\{props\.([\w\d]+)\}/gi.exec(JSON.stringify(this.params.base));return i&&i.forEach((e,o,n)=>{const h=n.at(1);h&&r.add(h)}),{element:t,variantKeys:s,propValueKeys:[...r]}}_withBuildContext(t){this._context=t;const{name:s,config:r}=t;return this._callerName=s,this}}exports.StyleComponentGenerator=g;
|
package/generator/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './style-generator';
|
package/generator/index.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
var h = Object.defineProperty;
|
|
2
|
-
var m = (e, t, s) => t in e ? h(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
|
|
3
|
-
var c = (e, t, s) => m(e, typeof t != "symbol" ? t + "" : t, s);
|
|
4
|
-
import { t as l } from "../dash-case-DMQMcCO6.js";
|
|
5
|
-
import { g, p as u } from "../parse-templates-D4p3pgQR.js";
|
|
6
|
-
class d {
|
|
7
|
-
constructor(t, s) {
|
|
8
|
-
c(this, "_callerName");
|
|
9
|
-
c(this, "_context");
|
|
10
|
-
this.tagName = t, this.params = s;
|
|
11
|
-
}
|
|
12
|
-
get hash() {
|
|
13
|
-
return l(this.params.base || this.params);
|
|
14
|
-
}
|
|
15
|
-
get priority() {
|
|
16
|
-
var t;
|
|
17
|
-
return typeof this.tagName == "function" || typeof this.tagName == "object" ? (((t = this.tagName.generator) == null ? void 0 : t.priority) || 0) + 1 : 0;
|
|
18
|
-
}
|
|
19
|
-
get classNames() {
|
|
20
|
-
const t = [this.hash], { className: s } = this.params;
|
|
21
|
-
return s && t.push(s), t.join(" ");
|
|
22
|
-
}
|
|
23
|
-
get cssClassName() {
|
|
24
|
-
return this.hash;
|
|
25
|
-
}
|
|
26
|
-
get cssDisplayNameVar() {
|
|
27
|
-
return `--${this.hash}-display-name: ${this._callerName};`;
|
|
28
|
-
}
|
|
29
|
-
get templateKeys() {
|
|
30
|
-
var t;
|
|
31
|
-
return (t = this._context) != null && t.config.templates ? g(this._context.config.templates) : [];
|
|
32
|
-
}
|
|
33
|
-
get css() {
|
|
34
|
-
var a;
|
|
35
|
-
const { base: t = {}, variants: s = {}, compoundVariants: r = [] } = this.params, i = { ...t, variants: s, compoundVariants: r };
|
|
36
|
-
return u(i, `.${this.cssClassName}`, this.priority, (a = this._context) == null ? void 0 : a.config);
|
|
37
|
-
}
|
|
38
|
-
get props() {
|
|
39
|
-
const { element: t } = this.params, s = this.params.variants ? Object.keys(this.params.variants).map((a) => {
|
|
40
|
-
var n;
|
|
41
|
-
const o = (n = this.params.defaultVariants) == null ? void 0 : n[a];
|
|
42
|
-
return o !== void 0 ? `${a}=${String(o)}` : a;
|
|
43
|
-
}) : void 0, r = /* @__PURE__ */ new Set([]), i = /\{props\.([\w\d]+)\}/gi.exec(JSON.stringify(this.params.base));
|
|
44
|
-
return i && i.forEach((a, o, n) => {
|
|
45
|
-
const p = n.at(1);
|
|
46
|
-
p && r.add(p);
|
|
47
|
-
}), {
|
|
48
|
-
element: t,
|
|
49
|
-
variantKeys: s,
|
|
50
|
-
propValueKeys: [...r]
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
_withBuildContext(t) {
|
|
54
|
-
this._context = t;
|
|
55
|
-
const { name: s, config: r } = t;
|
|
56
|
-
return this._callerName = s, this;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
export {
|
|
60
|
-
d as StyleComponentGenerator
|
|
61
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { StyledParams, Tag } from '../types';
|
|
2
|
-
export interface GeneratorProps {
|
|
3
|
-
element?: string;
|
|
4
|
-
variantKeys?: string[];
|
|
5
|
-
propValueKeys?: string[];
|
|
6
|
-
}
|
|
7
|
-
export declare class StyleComponentGenerator {
|
|
8
|
-
tagName: Tag<any>;
|
|
9
|
-
params: StyledParams;
|
|
10
|
-
_callerName: string | undefined;
|
|
11
|
-
_context: {
|
|
12
|
-
name: string;
|
|
13
|
-
config: any;
|
|
14
|
-
} | undefined;
|
|
15
|
-
constructor(tagName: Tag<any>, params: StyledParams);
|
|
16
|
-
get hash(): string;
|
|
17
|
-
get priority(): number;
|
|
18
|
-
get classNames(): string;
|
|
19
|
-
get cssClassName(): string;
|
|
20
|
-
get cssDisplayNameVar(): string;
|
|
21
|
-
get templateKeys(): string[];
|
|
22
|
-
get css(): string;
|
|
23
|
-
get props(): GeneratorProps;
|
|
24
|
-
_withBuildContext(context: {
|
|
25
|
-
name: string;
|
|
26
|
-
config: any;
|
|
27
|
-
}): this;
|
|
28
|
-
}
|
package/index-84Wroia-.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="/* Empty */";exports.default=e;
|
package/index-D_732b92.js
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { d as O } from "./dash-case-DMQMcCO6.js";
|
|
2
|
-
const N = (t, r) => {
|
|
3
|
-
if (typeof t != "string") return { result: t };
|
|
4
|
-
if (!r) return { result: t };
|
|
5
|
-
const e = [];
|
|
6
|
-
return Object.values(r).forEach((n) => {
|
|
7
|
-
const { pattern: o, transform: c } = n;
|
|
8
|
-
t = t.replace(o, (h) => {
|
|
9
|
-
const { value: i, css: m } = c(h);
|
|
10
|
-
return m && e.push(m), i;
|
|
11
|
-
});
|
|
12
|
-
}), { result: t, additionalCss: e };
|
|
13
|
-
}, P = (t) => typeof t != "string" ? { result: t } : /\{[^{}]+\}/g.test(t) ? { result: t.replace(/\{([^{}]+)\}/g, (...n) => `var(--${O(n[1].replaceAll(".", "-"))})`) } : { result: t }, d = (t, r, e, n) => {
|
|
14
|
-
if (!t) return "";
|
|
15
|
-
const o = [], c = Object.entries(t).reduce((i, [m, s]) => {
|
|
16
|
-
const p = m.trim();
|
|
17
|
-
if (typeof s == "function" && (s = s()), typeof s == "object") {
|
|
18
|
-
if (!s) return i;
|
|
19
|
-
if (p === "variants")
|
|
20
|
-
return Object.entries(s).forEach(([u, f]) => {
|
|
21
|
-
f && Object.entries(f).forEach(([b, j]) => {
|
|
22
|
-
if (!j) return;
|
|
23
|
-
const l = `${r}.${u}-${b}`, y = d(j, l, e);
|
|
24
|
-
o.push(y);
|
|
25
|
-
});
|
|
26
|
-
}), i;
|
|
27
|
-
if (p === "defaultVariants")
|
|
28
|
-
return i;
|
|
29
|
-
if (p === "compoundVariants")
|
|
30
|
-
return s.forEach((u) => {
|
|
31
|
-
const { css: f, ...b } = u, j = Object.entries(b).reduce((y, [V, W]) => `${y}.${V}-${W}`, r), l = d(f, j, e);
|
|
32
|
-
o.push(l);
|
|
33
|
-
}), i;
|
|
34
|
-
if (p.startsWith("@")) {
|
|
35
|
-
const u = d(s, r, e), f = `${p} {
|
|
36
|
-
${u.replace(`
|
|
37
|
-
`, `
|
|
38
|
-
`)}
|
|
39
|
-
}`;
|
|
40
|
-
return o.push(f), i;
|
|
41
|
-
}
|
|
42
|
-
const $ = m.includes("&") ? p.replace("&", r) : p.startsWith(":") ? `${r}${p}` : `${r} ${p}`, a = d(s, $, e);
|
|
43
|
-
return o.push(a), i;
|
|
44
|
-
}
|
|
45
|
-
if (n != null && n.templates && n.templates[p]) {
|
|
46
|
-
const a = s.split(".").reduce((f, b) => f[b], n.templates[p]), u = d(a, "");
|
|
47
|
-
return `${i}${u}`;
|
|
48
|
-
}
|
|
49
|
-
const g = p.startsWith("-") ? p : O(p), E = ($, a = ";") => i = `${i}${$}${a}`, S = ($) => E(`${g}:${$}`);
|
|
50
|
-
if (typeof s == "number") return S(s);
|
|
51
|
-
if (typeof s != "string")
|
|
52
|
-
if ("toString" in s) s = s.toString();
|
|
53
|
-
else return i;
|
|
54
|
-
const { modifiers: k } = n || {}, T = function* () {
|
|
55
|
-
yield P(s), yield N(s, k);
|
|
56
|
-
}();
|
|
57
|
-
for (const { result: $, additionalCss: a = [] } of T)
|
|
58
|
-
s = $, a.forEach((u) => {
|
|
59
|
-
const f = d(u, "");
|
|
60
|
-
E(f, "");
|
|
61
|
-
});
|
|
62
|
-
return S(s);
|
|
63
|
-
}, "");
|
|
64
|
-
if (!c) return o.join(`
|
|
65
|
-
`);
|
|
66
|
-
if (!r) return c;
|
|
67
|
-
let h = "";
|
|
68
|
-
return e !== void 0 ? h = `@layer l${e} { ${r} { ${c} } }` : h = `${r} { ${c} }`, [h, ...o].join(`
|
|
69
|
-
`);
|
|
70
|
-
}, _ = (t, r = []) => {
|
|
71
|
-
if (!t) return "";
|
|
72
|
-
const e = [], n = {};
|
|
73
|
-
if (Object.entries(t).forEach(([o, c]) => {
|
|
74
|
-
if (typeof c == "object") {
|
|
75
|
-
if (!c) return;
|
|
76
|
-
const h = o.trim(), i = _(c, [...r, h]);
|
|
77
|
-
e.push(i);
|
|
78
|
-
} else
|
|
79
|
-
n[o] = c;
|
|
80
|
-
}), Object.keys(n).length) {
|
|
81
|
-
const o = r.map(O).join("-"), c = d(n, `.${o}`);
|
|
82
|
-
e.push(c);
|
|
83
|
-
}
|
|
84
|
-
return e.join(`
|
|
85
|
-
`);
|
|
86
|
-
}, A = (t) => Object.keys(t);
|
|
87
|
-
export {
|
|
88
|
-
_ as a,
|
|
89
|
-
P as b,
|
|
90
|
-
A as g,
|
|
91
|
-
d as p
|
|
92
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";const O=require("./dash-case-DKzpenwY.cjs"),N=(t,e)=>{if(typeof t!="string")return{result:t};if(!e)return{result:t};const r=[];return Object.values(e).forEach(n=>{const{pattern:o,transform:c}=n;t=t.replace(o,a=>{const{value:i,css:l}=c(a);return l&&r.push(l),i})}),{result:t,additionalCss:r}},k=t=>typeof t!="string"?{result:t}:/\{[^{}]+\}/g.test(t)?{result:t.replace(/\{([^{}]+)\}/g,(...n)=>`var(--${O.dashCase(n[1].replaceAll(".","-"))})`)}:{result:t},h=(t,e,r,n)=>{if(!t)return"";const o=[],c=Object.entries(t).reduce((i,[l,s])=>{const p=l.trim();if(typeof s=="function"&&(s=s()),typeof s=="object"){if(!s)return i;if(p==="variants")return Object.entries(s).forEach(([u,f])=>{f&&Object.entries(f).forEach(([m,j])=>{if(!j)return;const y=`${e}.${u}-${m}`,b=h(j,y,r);o.push(b)})}),i;if(p==="defaultVariants")return i;if(p==="compoundVariants")return s.forEach(u=>{const{css:f,...m}=u,j=Object.entries(m).reduce((b,[q,K])=>`${b}.${q}-${K}`,e),y=h(f,j,r);o.push(y)}),i;if(p.startsWith("@")){const u=h(s,e,r),f=`${p} {
|
|
2
|
-
${u.replace(`
|
|
3
|
-
`,`
|
|
4
|
-
`)}
|
|
5
|
-
}`;return o.push(f),i}const $=l.includes("&")?p.replace("&",e):p.startsWith(":")?`${e}${p}`:`${e} ${p}`,d=h(s,$,r);return o.push(d),i}if(n!=null&&n.templates&&n.templates[p]){const d=s.split(".").reduce((f,m)=>f[m],n.templates[p]),u=h(d,"");return`${i}${u}`}const V=p.startsWith("-")?p:O.dashCase(p),T=($,d=";")=>i=`${i}${$}${d}`,S=$=>T(`${V}:${$}`);if(typeof s=="number")return S(s);if(typeof s!="string")if("toString"in s)s=s.toString();else return i;const{modifiers:g}=n||{},W=function*(){yield k(s),yield N(s,g)}();for(const{result:$,additionalCss:d=[]}of W)s=$,d.forEach(u=>{const f=h(u,"");T(f,"")});return S(s)},"");if(!c)return o.join(`
|
|
6
|
-
`);if(!e)return c;let a="";return r!==void 0?a=`@layer l${r} { ${e} { ${c} } }`:a=`${e} { ${c} }`,[a,...o].join(`
|
|
7
|
-
`)},E=(t,e=[])=>{if(!t)return"";const r=[],n={};if(Object.entries(t).forEach(([o,c])=>{if(typeof c=="object"){if(!c)return;const a=o.trim(),i=E(c,[...e,a]);r.push(i)}else n[o]=c}),Object.keys(n).length){const o=e.map(O.dashCase).join("-"),c=h(n,`.${o}`);r.push(c)}return r.join(`
|
|
8
|
-
`)},P=t=>Object.keys(t);exports.getTemplateKeys=P;exports.parseStyles=h;exports.parseTemplates=E;exports.parseValueTokens=k;
|
package/pascal-case-BQpR5PdN.js
DELETED
package/pascal-case-iWoaJWwT.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";function r(e){return e?typeof e!="string"?r(String(e)):e.replace(/\s/g,"-").replace(/[-_]([a-z0-9])/g,a=>a[1].toUpperCase()).replace(/^[a-z]/,a=>a.toUpperCase()):""}exports.pascalCase=r;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=`import { styled } from "@salty-css/react/styled";
|
|
2
|
-
|
|
3
|
-
export const <%- name %> = styled('<%- tag %>', {
|
|
4
|
-
<% if(className) { %>className: '<%- className %>',<% } %>
|
|
5
|
-
base: {
|
|
6
|
-
// Add your styles here
|
|
7
|
-
}
|
|
8
|
-
})`;exports.default=e;
|
package/salty.config-D9ANEDiH.js
DELETED
package/types/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
package/types/index.d.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { AllHTMLAttributes, ReactDOM, ReactNode } from 'react';
|
|
2
|
-
import { StyleComponentGenerator } from '../generator';
|
|
3
|
-
import { OrString } from './util-types';
|
|
4
|
-
export type CreateElementProps = {
|
|
5
|
-
extend?: Tag<any>;
|
|
6
|
-
children?: ReactNode;
|
|
7
|
-
className?: string;
|
|
8
|
-
element?: string;
|
|
9
|
-
passVariantProps?: boolean;
|
|
10
|
-
style?: any;
|
|
11
|
-
/** vks = Variant key set */
|
|
12
|
-
_vks?: Set<string>;
|
|
13
|
-
};
|
|
14
|
-
export type StyledComponentProps = Record<string, unknown> & CreateElementProps;
|
|
15
|
-
type FnComponent<PROPS extends StyledComponentProps> = {
|
|
16
|
-
(props: PROPS): ReactNode;
|
|
17
|
-
generator?: StyleComponentGenerator;
|
|
18
|
-
};
|
|
19
|
-
export type Tag<PROPS extends StyledComponentProps> = OrString | keyof ReactDOM | FnComponent<PROPS>;
|
|
20
|
-
export type CompoundVariant = {
|
|
21
|
-
[key: PropertyKey]: any;
|
|
22
|
-
css: CssStyles;
|
|
23
|
-
};
|
|
24
|
-
type InvalidVariantKeys = keyof AllHTMLAttributes<HTMLElement>;
|
|
25
|
-
type StyleKeys = keyof Required<AllHTMLAttributes<HTMLElement>>['style'];
|
|
26
|
-
export type StyleValue<K extends string> = K extends StyleKeys ? Required<AllHTMLAttributes<HTMLElement>>['style'][K] : never;
|
|
27
|
-
type VariantOptions = {
|
|
28
|
-
[key in InvalidVariantKeys]?: never;
|
|
29
|
-
};
|
|
30
|
-
type Variants = {
|
|
31
|
-
variants?: VariantOptions & {
|
|
32
|
-
[key: PropertyKey]: {
|
|
33
|
-
[key: string]: Styles;
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
defaultVariants?: {
|
|
37
|
-
[key: PropertyKey]: any;
|
|
38
|
-
};
|
|
39
|
-
compoundVariants?: CompoundVariant[];
|
|
40
|
-
};
|
|
41
|
-
type VariantPropValue<T> = T extends 'true' ? 'true' | true : T;
|
|
42
|
-
export type VariantProps<STYLES extends StyledParams> = STYLES['variants'] extends undefined ? object : {
|
|
43
|
-
[K in keyof STYLES['variants']]?: VariantPropValue<keyof STYLES['variants'][K]> | '';
|
|
44
|
-
};
|
|
45
|
-
type CssValuePropKey = `props-${string}`;
|
|
46
|
-
export type ValueProps = {
|
|
47
|
-
[key: CssValuePropKey]: string;
|
|
48
|
-
};
|
|
49
|
-
export type ParentComponentProps<TAG extends Tag<any>> = TAG extends (props: infer P) => ReactNode ? P : unknown;
|
|
50
|
-
type StylePropertyValue = Record<never, never> & unknown;
|
|
51
|
-
export type CssStyles = {
|
|
52
|
-
[key in StyleKeys | OrString]?: StyleValue<key> | StylePropertyValue | PropertyValueToken | CssStyles;
|
|
53
|
-
};
|
|
54
|
-
export type Styles = CssStyles & Variants;
|
|
55
|
-
export interface GeneratorOptions {
|
|
56
|
-
className?: string;
|
|
57
|
-
displayName?: string;
|
|
58
|
-
element?: string;
|
|
59
|
-
}
|
|
60
|
-
export interface StyledParams extends GeneratorOptions, Variants {
|
|
61
|
-
base?: CssStyles;
|
|
62
|
-
}
|
|
63
|
-
export {};
|
package/types/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
package/types/util-types.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export type CommonRecord<TYPE = unknown> = Record<PropertyKey, TYPE>;
|
|
2
|
-
export type IsUnion<T, U extends T = T> = T extends unknown ? ([U] extends [T] ? false : true) : false;
|
|
3
|
-
export type IsSpecifiedString<T> = T extends string ? (string extends T ? false : true) : false;
|
|
4
|
-
export type NeverObj = Record<never, never>;
|
|
5
|
-
export type OrAny = any & NeverObj;
|
|
6
|
-
export type NotFunction = string | number | boolean | object | null | undefined | CommonRecord;
|
|
7
|
-
export type OrT<T> = T & NeverObj;
|
|
8
|
-
export type OrString = OrT<string>;
|
|
9
|
-
export type OrNumber = OrT<number>;
|
|
10
|
-
export type ReplaceAny<TYPE, WITH = unknown> = TYPE extends any ? WITH : TYPE;
|
|
11
|
-
export type BothTrue<T, U> = T extends true ? (U extends true ? true : false) : false;
|
|
12
|
-
export type EitherTrue<T, U> = T extends true ? true : U extends true ? true : false;
|
|
13
|
-
export type Tail<T extends any[]> = ((...args: T) => any) extends (arg: any, ...rest: infer R) => any ? R : never;
|
package/util/camel-case.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function camelCase(str: PropertyKey): string;
|
package/util/dash-case.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function dashCase(str: PropertyKey): string;
|
package/util/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../dash-case-DKzpenwY.cjs"),t=require("../pascal-case-iWoaJWwT.cjs");function s(e){return e?typeof e!="string"?s(String(e)):e.replace(/\s/g,"-").replace(/-([a-z])/g,r=>r[1].toUpperCase()):""}exports.dashCase=a.dashCase;exports.toHash=a.toHash;exports.pascalCase=t.pascalCase;exports.camelCase=s;
|
package/util/index.d.ts
DELETED
package/util/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { d as o, t as s } from "../dash-case-DMQMcCO6.js";
|
|
2
|
-
import { p as f } from "../pascal-case-BQpR5PdN.js";
|
|
3
|
-
function r(e) {
|
|
4
|
-
return e ? typeof e != "string" ? r(String(e)) : e.replace(/\s/g, "-").replace(/-([a-z])/g, (a) => a[1].toUpperCase()) : "";
|
|
5
|
-
}
|
|
6
|
-
export {
|
|
7
|
-
r as camelCase,
|
|
8
|
-
o as dashCase,
|
|
9
|
-
f as pascalCase,
|
|
10
|
-
s as toHash
|
|
11
|
-
};
|
package/util/pascal-case.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function pascalCase(str: PropertyKey): string;
|
package/util/to-hash.d.ts
DELETED