@salty-css/core 0.0.1-alpha.3 → 0.0.1-alpha.31

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 (63) hide show
  1. package/README.md +23 -19
  2. package/bin/bin-util.d.ts +2 -0
  3. package/bin/index.cjs +2 -0
  4. package/bin/index.d.ts +2 -0
  5. package/bin/index.js +3 -0
  6. package/bin/logger.d.ts +2 -0
  7. package/bin/main.cjs +8 -0
  8. package/bin/main.d.ts +1 -0
  9. package/bin/main.js +156 -0
  10. package/bin/prettier.d.ts +1 -0
  11. package/compiler/index.cjs +11 -0
  12. package/{dist/compiler → compiler}/index.d.ts +4 -4
  13. package/compiler/index.js +174 -0
  14. package/{dist/config → config}/config-types.d.ts +3 -3
  15. package/dash-case-DKzpenwY.cjs +1 -0
  16. package/{dist/util/index.js → dash-case-DMQMcCO6.js} +5 -5
  17. package/generator/index.cjs +1 -0
  18. package/generator/index.js +61 -0
  19. package/{dist/generator → generator}/style-generator.d.ts +9 -8
  20. package/index-84Wroia-.cjs +1 -0
  21. package/index-D_732b92.js +4 -0
  22. package/package.json +39 -20
  23. package/{dist/parse-templates-BOSK0Tb6.js → parse-templates-D4p3pgQR.js} +26 -24
  24. package/parse-templates-W0YfTmOT.cjs +8 -0
  25. package/pascal-case-BQpR5PdN.js +6 -0
  26. package/pascal-case-iWoaJWwT.cjs +1 -0
  27. package/react-styled-file-CGVf5n1B.js +11 -0
  28. package/react-styled-file-Dkubsz-U.cjs +8 -0
  29. package/salty.config-BupieCfE.cjs +6 -0
  30. package/salty.config-D9ANEDiH.js +9 -0
  31. package/{dist/types → types}/index.d.ts +7 -2
  32. package/util/camel-case.d.ts +1 -0
  33. package/util/index.cjs +1 -0
  34. package/util/index.d.ts +4 -0
  35. package/util/index.js +11 -0
  36. package/util/pascal-case.d.ts +1 -0
  37. package/dist/README.md +0 -107
  38. package/dist/compiler/index.cjs +0 -11
  39. package/dist/compiler/index.js +0 -180
  40. package/dist/generator/index.cjs +0 -1
  41. package/dist/generator/index.js +0 -51
  42. package/dist/package.json +0 -50
  43. package/dist/parse-templates-BY1Xai-_.cjs +0 -8
  44. package/dist/util/index.cjs +0 -1
  45. package/dist/util/index.d.ts +0 -2
  46. /package/{dist/config → config}/define-config.d.ts +0 -0
  47. /package/{dist/config → config}/index.cjs +0 -0
  48. /package/{dist/config → config}/index.d.ts +0 -0
  49. /package/{dist/config → config}/index.js +0 -0
  50. /package/{dist/css → css}/index.cjs +0 -0
  51. /package/{dist/css → css}/index.d.ts +0 -0
  52. /package/{dist/css → css}/index.js +0 -0
  53. /package/{dist/generator → generator}/index.d.ts +0 -0
  54. /package/{dist/generator → generator}/parse-modifiers.d.ts +0 -0
  55. /package/{dist/generator → generator}/parse-styles.d.ts +0 -0
  56. /package/{dist/generator → generator}/parse-templates.d.ts +0 -0
  57. /package/{dist/generator → generator}/parse-tokens.d.ts +0 -0
  58. /package/{dist/generator → generator}/parser-types.d.ts +0 -0
  59. /package/{dist/types → types}/index.cjs +0 -0
  60. /package/{dist/types → types}/index.js +0 -0
  61. /package/{dist/types → types}/util-types.d.ts +0 -0
  62. /package/{dist/util → util}/dash-case.d.ts +0 -0
  63. /package/{dist/util → util}/to-hash.d.ts +0 -0
@@ -1,51 +0,0 @@
1
- import { toHash as a } from "../util/index.js";
2
- import { g as n, p as o } from "../parse-templates-BOSK0Tb6.js";
3
- class p {
4
- constructor(t, s, e) {
5
- this.tagName = t, this.styles = s, this.options = e;
6
- }
7
- get hash() {
8
- return a(this.styles);
9
- }
10
- get priority() {
11
- var t;
12
- return typeof this.tagName == "function" ? (((t = this.tagName.generator) == null ? void 0 : t.priority) || 0) + 1 : 0;
13
- }
14
- get classNames() {
15
- const t = [this.hash], { className: s } = this.options;
16
- return s && t.push(s), t.join(" ");
17
- }
18
- get cssClassName() {
19
- return this.hash;
20
- }
21
- get cssDisplayNameVar() {
22
- return `--${this.hash}-display-name: ${this._callerName};`;
23
- }
24
- get templateKeys() {
25
- var t;
26
- return (t = this._context) != null && t.config.templates ? n(this._context.config.templates) : [];
27
- }
28
- get css() {
29
- var t;
30
- return o(this.styles, `.${this.cssClassName}`, this.priority, (t = this._context) == null ? void 0 : t.config);
31
- }
32
- get props() {
33
- const { element: t } = this.options, s = this.styles.variants ? Object.keys(this.styles.variants).map((e) => {
34
- var r;
35
- const i = (r = this.styles.defaultVariants) == null ? void 0 : r[e];
36
- return i !== void 0 ? `${e}=${String(i)}` : e;
37
- }) : void 0;
38
- return {
39
- element: t,
40
- variantKeys: s
41
- };
42
- }
43
- _withBuildContext(t) {
44
- this._context = t;
45
- const { name: s, config: e } = t;
46
- return this._callerName = s, this;
47
- }
48
- }
49
- export {
50
- p as StyleComponentGenerator
51
- };
package/dist/package.json DELETED
@@ -1,50 +0,0 @@
1
- {
2
- "name": "@salty-css/core",
3
- "version": "0.0.1-alpha.3",
4
- "main": "./dist/index.js",
5
- "module": "./dist/index.mjs",
6
- "typings": "./dist/index.d.ts",
7
- "type": "module",
8
- "license": "MIT",
9
- "private": false,
10
- "publishConfig": {
11
- "access": "public"
12
- },
13
- "homepage": "https://github.com/margarita-form/salty-css",
14
- "bugs": {
15
- "url": "https://github.com/margarita-form/salty-css/issues"
16
- },
17
- "files": [
18
- "dist",
19
- "!**/*.tsbuildinfo"
20
- ],
21
- "nx": {
22
- "name": "core"
23
- },
24
- "exports": {
25
- ".": {
26
- "import": "./index.js",
27
- "require": "./index.cjs"
28
- },
29
- "./react/styled": {
30
- "import": "./react/styled.js",
31
- "require": "./react/styled.cjs"
32
- },
33
- "./react/styled-client": {
34
- "import": "./react/styled-client.js",
35
- "require": "./react/styled-client.cjs"
36
- },
37
- "./react/css-helpers": {
38
- "import": "./react/css-helpers.js",
39
- "require": "./react/css-helpers.cjs"
40
- },
41
- "./vite": {
42
- "import": "./vite/index.js",
43
- "require": "./vite/index.cjs"
44
- },
45
- "./webpack/salty-loader": {
46
- "import": "./webpack/salty-loader.js",
47
- "require": "./webpack/salty-loader.cjs"
48
- }
49
- }
50
- }
@@ -1,8 +0,0 @@
1
- "use strict";const O=require("./util/index.cjs"),K=(s,e)=>{if(typeof s!="string")return{result:s};if(!e)return{result:s};const r=[];return Object.values(e).forEach(n=>{const{pattern:o,transform:c}=n;s=s.replace(o,a=>{const{value:i,css:l}=c(a);return l&&r.push(l),i})}),{result:s,additionalCss:r}},k=s=>typeof s!="string"?{result:s}:/\{[^{}]+\}/g.test(s)?{result:s.replace(/\{([^{}]+)\}/g,(...n)=>`var(--${O.dashCase(n[1].replaceAll(".","-"))})`)}:{result:s},h=(s,e,r,n)=>{const o=[],c=Object.entries(s).reduce((i,[l,t])=>{const p=l.trim();if(typeof t=="function"&&(t=t()),typeof t=="object"){if(!t)return i;if(p==="variants")return Object.entries(t).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 t.forEach(u=>{const{css:f,...m}=u,j=Object.entries(m).reduce((b,[_,q])=>`${b}.${_}-${q}`,e),y=h(f,j,r);o.push(y)}),i;if(p.startsWith("@")){const u=h(t,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(t,$,r);return o.push(d),i}if(n!=null&&n.templates&&n.templates[p]){const d=t.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 t=="number")return S(t);if(typeof t!="string")if("toString"in t)t=t.toString();else return i;const{modifiers:g}=n||{},W=function*(){yield k(t),yield K(t,g)}();for(const{result:$,additionalCss:d=[]}of W)t=$,d.forEach(u=>{const f=h(u,"");T(f,"")});return S(t)},"");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=(s,e=[])=>{const r=[],n={};if(Object.entries(s).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
- `)},N=s=>Object.keys(s);exports.getTemplateKeys=N;exports.parseStyles=h;exports.parseTemplates=E;exports.parseValueTokens=k;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=t=>String.fromCharCode(t+(t>25?39:97)),o=(t,r)=>{let e="",a;for(a=Math.abs(t);a>52;a=a/52|0)e=n(a%52)+e;return e=n(a%52)+e,e.length<r?e=e.padStart(r,"a"):e.length>r&&(e=e.slice(-r)),e},i=(t,r)=>{let e=r.length;for(;e;)t=t*33^r.charCodeAt(--e);return t},s=(t,r=3)=>{const e=i(5381,JSON.stringify(t))>>>0;return o(e,r)};function c(t){return t?typeof t!="string"?String(t):t.replace(/\s/g,"-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g,(r,e)=>(e>0?"-":"")+r.toLowerCase()):""}exports.dashCase=c;exports.toHash=s;
@@ -1,2 +0,0 @@
1
- export * from './dash-case';
2
- export * from './to-hash';
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes