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

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 (134) hide show
  1. package/.saltyrc.schema.json +48 -0
  2. package/README.md +490 -43
  3. package/bin/bin-util.d.ts +2 -0
  4. package/bin/index.cjs +2 -0
  5. package/bin/index.d.ts +2 -0
  6. package/bin/index.js +3 -0
  7. package/bin/logger.d.ts +2 -0
  8. package/bin/main.cjs +11 -0
  9. package/bin/main.d.ts +1 -0
  10. package/bin/main.js +263 -0
  11. package/bin/prettier.d.ts +1 -0
  12. package/cache/resolve-dynamic-config-cache.cjs +1 -0
  13. package/cache/resolve-dynamic-config-cache.d.ts +1 -0
  14. package/cache/resolve-dynamic-config-cache.js +11 -0
  15. package/compiler/get-files.d.ts +3 -0
  16. package/compiler/get-function-range.d.ts +1 -0
  17. package/compiler/helpers.d.ts +2 -0
  18. package/compiler/index.cjs +1 -0
  19. package/compiler/index.d.ts +24 -0
  20. package/compiler/index.js +22 -0
  21. package/{dist/config → config}/define-config.d.ts +1 -1
  22. package/config/index.cjs +1 -0
  23. package/config/index.d.ts +3 -0
  24. package/config/index.js +14 -0
  25. package/css/index.cjs +1 -0
  26. package/css/index.d.ts +4 -0
  27. package/css/index.js +12 -0
  28. package/css/keyframes.cjs +1 -0
  29. package/css/keyframes.d.ts +22 -0
  30. package/css/keyframes.js +39 -0
  31. package/css/media.cjs +1 -0
  32. package/css/media.d.ts +87 -0
  33. package/css/media.js +88 -0
  34. package/css/merge.cjs +1 -0
  35. package/css/merge.d.ts +7 -0
  36. package/css/merge.js +5 -0
  37. package/dash-case-BJEkFEGQ.cjs +1 -0
  38. package/{dist/util/index.js → dash-case-DBThphLm.js} +5 -5
  39. package/define-templates-4A2yHcMF.js +52 -0
  40. package/define-templates-Cunsb_Tr.cjs +1 -0
  41. package/factories/define-global-styles.d.ts +7 -0
  42. package/factories/define-media-query.d.ts +8 -0
  43. package/factories/define-templates.d.ts +27 -0
  44. package/factories/define-variables.d.ts +12 -0
  45. package/factories/index.cjs +1 -0
  46. package/factories/index.d.ts +4 -0
  47. package/factories/index.js +30 -0
  48. package/generators/class-name-generator.d.ts +6 -0
  49. package/generators/index.cjs +1 -0
  50. package/generators/index.d.ts +2 -0
  51. package/generators/index.js +88 -0
  52. package/generators/styled-generator.d.ts +20 -0
  53. package/generators/styles-generator.d.ts +22 -0
  54. package/helpers/color.d.ts +18 -0
  55. package/helpers/index.cjs +1 -0
  56. package/helpers/index.d.ts +2 -0
  57. package/helpers/index.js +1183 -0
  58. package/helpers/viewport-clamp.d.ts +9 -0
  59. package/helpers-CC5pFyba.cjs +1 -0
  60. package/helpers-nHqH4L9L.js +11 -0
  61. package/{dist/config/index.cjs → index-84Wroia-.cjs} +1 -1
  62. package/index-CituHO0U.js +524 -0
  63. package/index-D_732b92.js +4 -0
  64. package/index-ol1Q_xul.cjs +41 -0
  65. package/package.json +88 -21
  66. package/parse-styles-B1E0JeC7.cjs +5 -0
  67. package/parse-styles-y_-drahL.js +161 -0
  68. package/parsers/index.cjs +2 -0
  69. package/parsers/index.d.ts +5 -0
  70. package/parsers/index.js +33 -0
  71. package/parsers/parse-modifiers.d.ts +3 -0
  72. package/parsers/parse-styles.d.ts +13 -0
  73. package/parsers/parse-templates.d.ts +4 -0
  74. package/parsers/parse-tokens.d.ts +3 -0
  75. package/parsers/parser-types.d.ts +8 -0
  76. package/parsers/property-name-check.d.ts +1 -0
  77. package/parsers/unit-check.d.ts +7 -0
  78. package/pascal-case-BQpR5PdN.js +6 -0
  79. package/pascal-case-iWoaJWwT.cjs +1 -0
  80. package/react-styled-file-CGVf5n1B.js +11 -0
  81. package/react-styled-file-Dkubsz-U.cjs +8 -0
  82. package/react-vanilla-file-CCXbsjIb.js +18 -0
  83. package/react-vanilla-file-CG_WJLam.cjs +15 -0
  84. package/salty.config-BhBY_oOk.js +10 -0
  85. package/salty.config-Dk6ZcCxI.cjs +7 -0
  86. package/server/index.cjs +1 -0
  87. package/server/index.d.ts +1 -0
  88. package/server/index.js +4 -0
  89. package/server/should-restart.d.ts +1 -0
  90. package/should-restart-C6VJ-qaY.js +12 -0
  91. package/should-restart-DAhvRrtu.cjs +1 -0
  92. package/templates/salty-reset.d.ts +2 -0
  93. package/types/cli-types.d.ts +10 -0
  94. package/types/config-types.d.ts +85 -0
  95. package/types/index.d.ts +97 -0
  96. package/util/camel-case.d.ts +1 -0
  97. package/util/dot-case.d.ts +1 -0
  98. package/util/index.cjs +1 -0
  99. package/util/index.d.ts +4 -0
  100. package/util/index.js +11 -0
  101. package/util/module-type.d.ts +1 -0
  102. package/util/pascal-case.d.ts +1 -0
  103. package/viewport-clamp-CaYwREKc.js +7 -0
  104. package/viewport-clamp-mq_DFtRR.cjs +1 -0
  105. package/dist/README.md +0 -107
  106. package/dist/compiler/index.cjs +0 -11
  107. package/dist/compiler/index.d.ts +0 -16
  108. package/dist/compiler/index.js +0 -180
  109. package/dist/config/config-types.d.ts +0 -59
  110. package/dist/config/index.d.ts +0 -2
  111. package/dist/config/index.js +0 -4
  112. package/dist/generator/index.cjs +0 -1
  113. package/dist/generator/index.d.ts +0 -1
  114. package/dist/generator/index.js +0 -51
  115. package/dist/generator/parse-modifiers.d.ts +0 -3
  116. package/dist/generator/parse-styles.d.ts +0 -2
  117. package/dist/generator/parse-templates.d.ts +0 -2
  118. package/dist/generator/parse-tokens.d.ts +0 -2
  119. package/dist/generator/parser-types.d.ts +0 -4
  120. package/dist/generator/style-generator.d.ts +0 -27
  121. package/dist/package.json +0 -50
  122. package/dist/parse-templates-BOSK0Tb6.js +0 -90
  123. package/dist/parse-templates-BY1Xai-_.cjs +0 -8
  124. package/dist/types/index.d.ts +0 -58
  125. package/dist/util/index.cjs +0 -1
  126. package/dist/util/index.d.ts +0 -2
  127. /package/{dist/css/index.cjs → css/token.cjs} +0 -0
  128. /package/{dist/css/index.d.ts → css/token.d.ts} +0 -0
  129. /package/{dist/css/index.js → css/token.js} +0 -0
  130. /package/{dist/types → types}/index.cjs +0 -0
  131. /package/{dist/types → types}/index.js +0 -0
  132. /package/{dist/types → types}/util-types.d.ts +0 -0
  133. /package/{dist/util → util}/dash-case.d.ts +0 -0
  134. /package/{dist/util → util}/to-hash.d.ts +0 -0
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,90 +0,0 @@
1
- import { dashCase as O } from "./util/index.js";
2
- const N = (s, r) => {
3
- if (typeof s != "string") return { result: s };
4
- if (!r) return { result: s };
5
- const e = [];
6
- return Object.values(r).forEach((n) => {
7
- const { pattern: o, transform: c } = n;
8
- s = s.replace(o, (h) => {
9
- const { value: i, css: m } = c(h);
10
- return m && e.push(m), i;
11
- });
12
- }), { result: s, additionalCss: e };
13
- }, P = (s) => typeof s != "string" ? { result: s } : /\{[^{}]+\}/g.test(s) ? { result: s.replace(/\{([^{}]+)\}/g, (...n) => `var(--${O(n[1].replaceAll(".", "-"))})`) } : { result: s }, d = (s, r, e, n) => {
14
- const o = [], c = Object.entries(s).reduce((i, [m, t]) => {
15
- const p = m.trim();
16
- if (typeof t == "function" && (t = t()), typeof t == "object") {
17
- if (!t) return i;
18
- if (p === "variants")
19
- return Object.entries(t).forEach(([u, f]) => {
20
- f && Object.entries(f).forEach(([b, j]) => {
21
- if (!j) return;
22
- const l = `${r}.${u}-${b}`, y = d(j, l, e);
23
- o.push(y);
24
- });
25
- }), i;
26
- if (p === "defaultVariants")
27
- return i;
28
- if (p === "compoundVariants")
29
- return t.forEach((u) => {
30
- const { css: f, ...b } = u, j = Object.entries(b).reduce((y, [V, W]) => `${y}.${V}-${W}`, r), l = d(f, j, e);
31
- o.push(l);
32
- }), i;
33
- if (p.startsWith("@")) {
34
- const u = d(t, r, e), f = `${p} {
35
- ${u.replace(`
36
- `, `
37
- `)}
38
- }`;
39
- return o.push(f), i;
40
- }
41
- const $ = m.includes("&") ? p.replace("&", r) : p.startsWith(":") ? `${r}${p}` : `${r} ${p}`, a = d(t, $, e);
42
- return o.push(a), i;
43
- }
44
- if (n != null && n.templates && n.templates[p]) {
45
- const a = t.split(".").reduce((f, b) => f[b], n.templates[p]), u = d(a, "");
46
- return `${i}${u}`;
47
- }
48
- const g = p.startsWith("-") ? p : O(p), E = ($, a = ";") => i = `${i}${$}${a}`, S = ($) => E(`${g}:${$}`);
49
- if (typeof t == "number") return S(t);
50
- if (typeof t != "string")
51
- if ("toString" in t) t = t.toString();
52
- else return i;
53
- const { modifiers: k } = n || {}, T = function* () {
54
- yield P(t), yield N(t, k);
55
- }();
56
- for (const { result: $, additionalCss: a = [] } of T)
57
- t = $, a.forEach((u) => {
58
- const f = d(u, "");
59
- E(f, "");
60
- });
61
- return S(t);
62
- }, "");
63
- if (!c) return o.join(`
64
- `);
65
- if (!r) return c;
66
- let h = "";
67
- return e !== void 0 ? h = `@layer l${e} { ${r} { ${c} } }` : h = `${r} { ${c} }`, [h, ...o].join(`
68
- `);
69
- }, _ = (s, r = []) => {
70
- const e = [], n = {};
71
- if (Object.entries(s).forEach(([o, c]) => {
72
- if (typeof c == "object") {
73
- if (!c) return;
74
- const h = o.trim(), i = _(c, [...r, h]);
75
- e.push(i);
76
- } else
77
- n[o] = c;
78
- }), Object.keys(n).length) {
79
- const o = r.map(O).join("-"), c = d(n, `.${o}`);
80
- e.push(c);
81
- }
82
- return e.join(`
83
- `);
84
- }, A = (s) => Object.keys(s);
85
- export {
86
- _ as a,
87
- P as b,
88
- A as g,
89
- d as p
90
- };
@@ -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,58 +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
- /** vks = Variant key set */
11
- _vks?: Set<string>;
12
- };
13
- export type StyledComponentProps = Record<string, unknown> & CreateElementProps;
14
- type FnComponent<PROPS extends StyledComponentProps> = {
15
- (props: PROPS): ReactNode;
16
- generator?: StyleComponentGenerator;
17
- };
18
- export type Tag<PROPS extends StyledComponentProps> = OrString | keyof ReactDOM | FnComponent<PROPS>;
19
- export type CompoundVariant = {
20
- [key: PropertyKey]: any;
21
- css: CssStyles;
22
- };
23
- type InvalidVariantKeys = keyof AllHTMLAttributes<HTMLElement>;
24
- type StyleKeys = keyof Required<AllHTMLAttributes<HTMLElement>>['style'];
25
- export type StyleValue<K extends string> = K extends StyleKeys ? Required<AllHTMLAttributes<HTMLElement>>['style'][K] : never;
26
- type VariantOptions = {
27
- [key in InvalidVariantKeys]?: never;
28
- };
29
- type Variants = {
30
- variants?: VariantOptions & {
31
- [key: PropertyKey]: {
32
- [key: string]: Styles;
33
- };
34
- };
35
- defaultVariants?: {
36
- [key: PropertyKey]: any;
37
- };
38
- compoundVariants?: CompoundVariant[];
39
- };
40
- type VariantPropValue<T> = T extends 'true' ? 'true' | true : T;
41
- export type VariantProps<STYLES extends Styles> = STYLES['variants'] extends undefined ? {} : {
42
- [K in keyof STYLES['variants']]?: VariantPropValue<keyof STYLES['variants'][K]> | '';
43
- };
44
- export type ParentComponentProps<TAG extends Tag<any>> = TAG extends (props: infer P) => ReactNode ? P : unknown;
45
- type StylePropertyValue = Record<never, never> & unknown;
46
- export type CssStyles = {
47
- [key in StyleKeys | OrString]?: StyleValue<key> | StylePropertyValue | PropertyValueToken | CssStyles;
48
- };
49
- export type Styles = CssStyles & Variants;
50
- export interface GeneratorOptions {
51
- className?: string;
52
- displayName?: string;
53
- element?: string;
54
- }
55
- export interface StyledParams extends GeneratorOptions, Variants {
56
- base: CssStyles;
57
- }
58
- export {};
@@ -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