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

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 (79) hide show
  1. package/.saltyrc.schema.json +1 -1
  2. package/bin/index.cjs +3 -1
  3. package/bin/index.js +2 -2
  4. package/bin/main.cjs +445 -11
  5. package/bin/main.js +405 -224
  6. package/cache/resolve-dynamic-config-cache.cjs +13 -1
  7. package/cache/resolve-dynamic-config-cache.js +10 -8
  8. package/compiler/index.cjs +774 -1
  9. package/compiler/index.d.ts +3 -0
  10. package/compiler/index.js +754 -20
  11. package/config/index.cjs +16 -1
  12. package/config/index.js +14 -12
  13. package/css/index.cjs +12 -1
  14. package/css/index.js +10 -10
  15. package/css/keyframes.cjs +49 -1
  16. package/css/keyframes.js +44 -34
  17. package/css/media.cjs +93 -1
  18. package/css/media.js +54 -49
  19. package/css/merge.cjs +15 -1
  20. package/css/merge.js +13 -3
  21. package/css/token.cjs +4 -1
  22. package/css/token.js +2 -2
  23. package/dash-case-Cz8wwE9a.cjs +32 -0
  24. package/dash-case-NMk0mXyT.js +33 -0
  25. package/define-templates-CVhhgPnd.js +60 -0
  26. package/define-templates-Deq1aCbN.cjs +59 -0
  27. package/factories/index.cjs +37 -1
  28. package/factories/index.js +27 -20
  29. package/generators/index.cjs +121 -1
  30. package/generators/index.js +82 -49
  31. package/helpers/index.cjs +53 -1
  32. package/helpers/index.js +40 -1170
  33. package/helpers-DM2fbDDz.js +18 -0
  34. package/helpers-wv74jTRI.cjs +18 -0
  35. package/index-ByR0nfaf.cjs +4 -0
  36. package/index-DKz1QXqs.js +4 -0
  37. package/package.json +1 -1
  38. package/parse-styles-CqBQc3eQ.js +232 -0
  39. package/parse-styles-D-p_guRO.cjs +231 -0
  40. package/parsers/index.cjs +57 -2
  41. package/parsers/index.js +55 -30
  42. package/pascal-case-By_l58S-.cjs +7 -0
  43. package/pascal-case-F3Usi5Wf.js +8 -0
  44. package/{react-styled-file-CGVf5n1B.js → react-styled-file-B99mwk0w.js} +2 -2
  45. package/react-styled-file-U02jek-B.cjs +11 -0
  46. package/react-vanilla-file-Bj6XC8GS.cjs +18 -0
  47. package/{react-vanilla-file-CCXbsjIb.js → react-vanilla-file-D9px70iK.js} +2 -2
  48. package/salty.config-DjosWdPw.js +4 -0
  49. package/salty.config-cqavVm2t.cjs +4 -0
  50. package/server/index.cjs +4 -1
  51. package/server/index.js +2 -2
  52. package/should-restart-5jI-bzz0.js +18 -0
  53. package/should-restart-DoaGoD5T.cjs +17 -0
  54. package/util/index.cjs +13 -1
  55. package/util/index.js +10 -8
  56. package/viewport-clamp-CEmzmcSj.cjs +10 -0
  57. package/viewport-clamp-K553uXu3.js +11 -0
  58. package/dash-case-BJEkFEGQ.cjs +0 -1
  59. package/dash-case-DBThphLm.js +0 -19
  60. package/define-templates-4A2yHcMF.js +0 -52
  61. package/define-templates-Cunsb_Tr.cjs +0 -1
  62. package/helpers-CC5pFyba.cjs +0 -1
  63. package/helpers-nHqH4L9L.js +0 -11
  64. package/index-84Wroia-.cjs +0 -1
  65. package/index-CituHO0U.js +0 -524
  66. package/index-D_732b92.js +0 -4
  67. package/index-ol1Q_xul.cjs +0 -41
  68. package/parse-styles-B1E0JeC7.cjs +0 -5
  69. package/parse-styles-y_-drahL.js +0 -161
  70. package/pascal-case-BQpR5PdN.js +0 -6
  71. package/pascal-case-iWoaJWwT.cjs +0 -1
  72. package/react-styled-file-Dkubsz-U.cjs +0 -8
  73. package/react-vanilla-file-CG_WJLam.cjs +0 -15
  74. package/salty.config-BhBY_oOk.js +0 -10
  75. package/salty.config-Dk6ZcCxI.cjs +0 -7
  76. package/should-restart-C6VJ-qaY.js +0 -12
  77. package/should-restart-DAhvRrtu.cjs +0 -1
  78. package/viewport-clamp-CaYwREKc.js +0 -7
  79. package/viewport-clamp-mq_DFtRR.cjs +0 -1
package/config/index.cjs CHANGED
@@ -1 +1,16 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../factories/index.cjs"),a=require("../define-templates-Cunsb_Tr.cjs"),i=t=>t;exports.GlobalStylesFactory=e.GlobalStylesFactory;exports.VariablesFactory=e.VariablesFactory;exports.defineGlobalStyles=e.defineGlobalStyles;exports.defineMediaQuery=e.defineMediaQuery;exports.defineVariables=e.defineVariables;exports.TemplateFactory=a.TemplateFactory;exports.TemplatesFactory=a.TemplatesFactory;exports.defineTemplates=a.defineTemplates;exports.defineConfig=i;
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const factories_index = require("../factories/index.cjs");
4
+ const defineTemplates = require("../define-templates-Deq1aCbN.cjs");
5
+ const defineConfig = (config) => {
6
+ return config;
7
+ };
8
+ exports.GlobalStylesFactory = factories_index.GlobalStylesFactory;
9
+ exports.VariablesFactory = factories_index.VariablesFactory;
10
+ exports.defineGlobalStyles = factories_index.defineGlobalStyles;
11
+ exports.defineMediaQuery = factories_index.defineMediaQuery;
12
+ exports.defineVariables = factories_index.defineVariables;
13
+ exports.TemplateFactory = defineTemplates.TemplateFactory;
14
+ exports.TemplatesFactory = defineTemplates.TemplatesFactory;
15
+ exports.defineTemplates = defineTemplates.defineTemplates;
16
+ exports.defineConfig = defineConfig;
package/config/index.js CHANGED
@@ -1,14 +1,16 @@
1
- import { GlobalStylesFactory as o, VariablesFactory as l, defineGlobalStyles as s, defineMediaQuery as i, defineVariables as f } from "../factories/index.js";
2
- import { T as d, a as y, d as p } from "../define-templates-4A2yHcMF.js";
3
- const a = (e) => e;
1
+ import { GlobalStylesFactory, VariablesFactory, defineGlobalStyles, defineMediaQuery, defineVariables } from "../factories/index.js";
2
+ import { T, a, d } from "../define-templates-CVhhgPnd.js";
3
+ const defineConfig = (config) => {
4
+ return config;
5
+ };
4
6
  export {
5
- o as GlobalStylesFactory,
6
- d as TemplateFactory,
7
- y as TemplatesFactory,
8
- l as VariablesFactory,
9
- a as defineConfig,
10
- s as defineGlobalStyles,
11
- i as defineMediaQuery,
12
- p as defineTemplates,
13
- f as defineVariables
7
+ GlobalStylesFactory,
8
+ T as TemplateFactory,
9
+ a as TemplatesFactory,
10
+ VariablesFactory,
11
+ defineConfig,
12
+ defineGlobalStyles,
13
+ defineMediaQuery,
14
+ d as defineTemplates,
15
+ defineVariables
14
16
  };
package/css/index.cjs CHANGED
@@ -1 +1,12 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./keyframes.cjs"),e=require("./media.cjs"),t=require("./token.cjs"),r=require("./merge.cjs");exports.keyframes=s.keyframes;exports.MediaQueryFactory=e.MediaQueryFactory;exports.media=e.media;exports.token=t.token;exports.mergeFactories=r.mergeFactories;exports.mergeObjects=r.mergeObjects;
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const css_keyframes = require("./keyframes.cjs");
4
+ const css_media = require("./media.cjs");
5
+ const css_token = require("./token.cjs");
6
+ const css_merge = require("./merge.cjs");
7
+ exports.keyframes = css_keyframes.keyframes;
8
+ exports.MediaQueryFactory = css_media.MediaQueryFactory;
9
+ exports.media = css_media.media;
10
+ exports.token = css_token.token;
11
+ exports.mergeFactories = css_merge.mergeFactories;
12
+ exports.mergeObjects = css_merge.mergeObjects;
package/css/index.js CHANGED
@@ -1,12 +1,12 @@
1
- import { keyframes as o } from "./keyframes.js";
2
- import { MediaQueryFactory as t, media as a } from "./media.js";
3
- import { token as p } from "./token.js";
4
- import { mergeFactories as c, mergeObjects as i } from "./merge.js";
1
+ import { keyframes } from "./keyframes.js";
2
+ import { MediaQueryFactory, media } from "./media.js";
3
+ import { token } from "./token.js";
4
+ import { mergeFactories, mergeObjects } from "./merge.js";
5
5
  export {
6
- t as MediaQueryFactory,
7
- o as keyframes,
8
- a as media,
9
- c as mergeFactories,
10
- i as mergeObjects,
11
- p as token
6
+ MediaQueryFactory,
7
+ keyframes,
8
+ media,
9
+ mergeFactories,
10
+ mergeObjects,
11
+ token
12
12
  };
package/css/keyframes.cjs CHANGED
@@ -1 +1,49 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../parse-styles-B1E0JeC7.cjs"),O=require("../dash-case-BJEkFEGQ.cjs"),h=({animationName:l,params:y,appendInitialStyles:$,...t})=>{const i=async(d={})=>{const n=l||O.toHash(t),r=async()=>{const{duration:s="500ms",easing:e="ease-in-out",delay:o="0s",iterationCount:c="1",direction:g="normal",fillMode:b="forwards",playState:j="running"}={...y,...d},a=`${n} ${s} ${e} ${o} ${c} ${g} ${b} ${j}`;if(!$)return a;const m=t.from||t["0%"];if(!m)return a;const w=await u.parseAndJoinStyles(m,"");return`${a};${w}`},f=Object.entries(t).map(async([s,e])=>{if(!e)return"";const o=await u.parseAndJoinStyles(e,"");return`${typeof s=="number"?`${s}%`:s}{${o}}`}),S=(await Promise.all(f)).join(""),p=`@keyframes ${n} {${S}}`;return Object.assign(r,{toString:r,isKeyframes:!0,animationName:n,css:p,keyframes:t}),r};return Object.assign(i,{_shouldResolve:!0}),i};exports.keyframes=h;
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const parseStyles = require("../parse-styles-D-p_guRO.cjs");
4
+ const dashCase = require("../dash-case-Cz8wwE9a.cjs");
5
+ const keyframes = ({ animationName: _name, params: _params, appendInitialStyles, ...keyframes2 }) => {
6
+ const modifyKeyframes = async (params = {}) => {
7
+ const animationName = _name || dashCase.toHash(keyframes2);
8
+ const fn = async () => {
9
+ const {
10
+ duration = "500ms",
11
+ easing = "ease-in-out",
12
+ delay = "0s",
13
+ iterationCount = "1",
14
+ direction = "normal",
15
+ fillMode = "forwards",
16
+ playState = "running"
17
+ } = { ..._params, ...params };
18
+ const animation = `${animationName} ${duration} ${easing} ${delay} ${iterationCount} ${direction} ${fillMode} ${playState}`;
19
+ if (!appendInitialStyles) return animation;
20
+ const startingFrom = keyframes2.from || keyframes2["0%"];
21
+ if (!startingFrom) return animation;
22
+ const startStyles = await parseStyles.parseAndJoinStyles(startingFrom, "");
23
+ return `${animation};${startStyles}`;
24
+ };
25
+ const entries = Object.entries(keyframes2);
26
+ const promises = entries.map(async ([key, value]) => {
27
+ if (!value) return "";
28
+ const styles = await parseStyles.parseAndJoinStyles(value, "");
29
+ const keyStr = typeof key === "number" ? `${key}%` : key;
30
+ return `${keyStr}{${styles}}`;
31
+ });
32
+ const resolved = await Promise.all(promises);
33
+ const keyframesCss = resolved.join("");
34
+ const css = `@keyframes ${animationName} {${keyframesCss}}`;
35
+ Object.assign(fn, {
36
+ toString: fn,
37
+ isKeyframes: true,
38
+ animationName,
39
+ css,
40
+ keyframes: keyframes2
41
+ });
42
+ return fn;
43
+ };
44
+ Object.assign(modifyKeyframes, {
45
+ _shouldResolve: true
46
+ });
47
+ return modifyKeyframes;
48
+ };
49
+ exports.keyframes = keyframes;
package/css/keyframes.js CHANGED
@@ -1,39 +1,49 @@
1
- import { p as $ } from "../parse-styles-y_-drahL.js";
2
- import { t as O } from "../dash-case-DBThphLm.js";
3
- const N = ({ animationName: u, params: f, appendInitialStyles: l, ...t }) => {
4
- const i = async (y = {}) => {
5
- const r = u || O(t), e = async () => {
1
+ import { p as parseAndJoinStyles } from "../parse-styles-CqBQc3eQ.js";
2
+ import { t as toHash } from "../dash-case-NMk0mXyT.js";
3
+ const keyframes = ({ animationName: _name, params: _params, appendInitialStyles, ...keyframes2 }) => {
4
+ const modifyKeyframes = async (params = {}) => {
5
+ const animationName = _name || toHash(keyframes2);
6
+ const fn = async () => {
6
7
  const {
7
- duration: s = "500ms",
8
- easing: n = "ease-in-out",
9
- delay: o = "0s",
10
- iterationCount: c = "1",
11
- direction: S = "normal",
12
- fillMode: b = "forwards",
13
- playState: j = "running"
14
- } = { ...f, ...y }, a = `${r} ${s} ${n} ${o} ${c} ${S} ${b} ${j}`;
15
- if (!l) return a;
16
- const m = t.from || t["0%"];
17
- if (!m) return a;
18
- const w = await $(m, "");
19
- return `${a};${w}`;
20
- }, d = Object.entries(t).map(async ([s, n]) => {
21
- if (!n) return "";
22
- const o = await $(n, "");
23
- return `${typeof s == "number" ? `${s}%` : s}{${o}}`;
24
- }), p = (await Promise.all(d)).join(""), g = `@keyframes ${r} {${p}}`;
25
- return Object.assign(e, {
26
- toString: e,
27
- isKeyframes: !0,
28
- animationName: r,
29
- css: g,
30
- keyframes: t
31
- }), e;
8
+ duration = "500ms",
9
+ easing = "ease-in-out",
10
+ delay = "0s",
11
+ iterationCount = "1",
12
+ direction = "normal",
13
+ fillMode = "forwards",
14
+ playState = "running"
15
+ } = { ..._params, ...params };
16
+ const animation = `${animationName} ${duration} ${easing} ${delay} ${iterationCount} ${direction} ${fillMode} ${playState}`;
17
+ if (!appendInitialStyles) return animation;
18
+ const startingFrom = keyframes2.from || keyframes2["0%"];
19
+ if (!startingFrom) return animation;
20
+ const startStyles = await parseAndJoinStyles(startingFrom, "");
21
+ return `${animation};${startStyles}`;
22
+ };
23
+ const entries = Object.entries(keyframes2);
24
+ const promises = entries.map(async ([key, value]) => {
25
+ if (!value) return "";
26
+ const styles = await parseAndJoinStyles(value, "");
27
+ const keyStr = typeof key === "number" ? `${key}%` : key;
28
+ return `${keyStr}{${styles}}`;
29
+ });
30
+ const resolved = await Promise.all(promises);
31
+ const keyframesCss = resolved.join("");
32
+ const css = `@keyframes ${animationName} {${keyframesCss}}`;
33
+ Object.assign(fn, {
34
+ toString: fn,
35
+ isKeyframes: true,
36
+ animationName,
37
+ css,
38
+ keyframes: keyframes2
39
+ });
40
+ return fn;
32
41
  };
33
- return Object.assign(i, {
34
- _shouldResolve: !0
35
- }), i;
42
+ Object.assign(modifyKeyframes, {
43
+ _shouldResolve: true
44
+ });
45
+ return modifyKeyframes;
36
46
  };
37
47
  export {
38
- N as keyframes
48
+ keyframes
39
49
  };
package/css/media.cjs CHANGED
@@ -1 +1,93 @@
1
- "use strict";var a=Object.defineProperty;var o=(s,e,t)=>e in s?a(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var i=(s,e,t)=>o(s,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class r{constructor(e="@media"){i(this,"next",e=>{const t=new String(e);return Object.assign(t,{get isMedia(){return!0},get and(){return new r(`${e} and`)},get or(){return new r(`${e},`)}}),t});this.base=e}custom(e){return this.next(`${this.base} ${e}`)}minWidth(e){const t=typeof e=="number"?`${e}px`:e,n=`${this.base} (min-width: ${t})`;return this.next(n)}maxWidth(e){const t=typeof e=="number"?`${e}px`:e,n=`${this.base} (max-width: ${t})`;return this.next(n)}minHeight(e){const t=typeof e=="number"?`${e}px`:e,n=`${this.base} (min-height: ${t})`;return this.next(n)}maxHeight(e){const t=typeof e=="number"?`${e}px`:e,n=`${this.base} (max-height: ${t})`;return this.next(n)}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 u=new r;exports.MediaQueryFactory=r;exports.media=u;
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
6
+ class MediaQueryFactory {
7
+ constructor(base = "@media") {
8
+ __publicField(this, "next", (value) => {
9
+ const str = new String(value);
10
+ Object.assign(str, {
11
+ get isMedia() {
12
+ return true;
13
+ },
14
+ get and() {
15
+ return new MediaQueryFactory(`${value} and`);
16
+ },
17
+ get or() {
18
+ return new MediaQueryFactory(`${value},`);
19
+ }
20
+ });
21
+ return str;
22
+ });
23
+ this.base = base;
24
+ }
25
+ custom(value) {
26
+ return this.next(`${this.base} ${value}`);
27
+ }
28
+ minWidth(width) {
29
+ const _width = typeof width === "number" ? `${width}px` : width;
30
+ const value = `${this.base} (min-width: ${_width})`;
31
+ return this.next(value);
32
+ }
33
+ maxWidth(width) {
34
+ const _width = typeof width === "number" ? `${width}px` : width;
35
+ const value = `${this.base} (max-width: ${_width})`;
36
+ return this.next(value);
37
+ }
38
+ minHeight(height) {
39
+ const _height = typeof height === "number" ? `${height}px` : height;
40
+ const value = `${this.base} (min-height: ${_height})`;
41
+ return this.next(value);
42
+ }
43
+ maxHeight(height) {
44
+ const _height = typeof height === "number" ? `${height}px` : height;
45
+ const value = `${this.base} (max-height: ${_height})`;
46
+ return this.next(value);
47
+ }
48
+ get portrait() {
49
+ const value = `${this.base} (orientation: portrait)`;
50
+ return this.next(value);
51
+ }
52
+ get landscape() {
53
+ const value = `${this.base} (orientation: landscape)`;
54
+ return this.next(value);
55
+ }
56
+ prefersColorScheme(scheme) {
57
+ const value = `${this.base} (prefers-color-scheme: ${scheme})`;
58
+ return this.next(value);
59
+ }
60
+ get dark() {
61
+ return this.prefersColorScheme("dark");
62
+ }
63
+ get light() {
64
+ return this.prefersColorScheme("light");
65
+ }
66
+ get print() {
67
+ const value = `${this.base} print`;
68
+ return this.next(value);
69
+ }
70
+ get screen() {
71
+ const value = `${this.base} screen`;
72
+ return this.next(value);
73
+ }
74
+ get speech() {
75
+ const value = `${this.base} speech`;
76
+ return this.next(value);
77
+ }
78
+ get all() {
79
+ const value = `${this.base} all`;
80
+ return this.next(value);
81
+ }
82
+ get not() {
83
+ const value = `${this.base} not`;
84
+ return this.next(value);
85
+ }
86
+ get reducedMotion() {
87
+ const value = `${this.base} (prefers-reduced-motion: reduce)`;
88
+ return this.next(value);
89
+ }
90
+ }
91
+ const media = new MediaQueryFactory();
92
+ exports.MediaQueryFactory = MediaQueryFactory;
93
+ exports.media = media;
package/css/media.js CHANGED
@@ -1,54 +1,59 @@
1
- var a = Object.defineProperty;
2
- var o = (s, t, e) => t in s ? a(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
- var i = (s, t, e) => o(s, typeof t != "symbol" ? t + "" : t, e);
4
- class r {
5
- constructor(t = "@media") {
6
- i(this, "next", (t) => {
7
- const e = new String(t);
8
- return Object.assign(e, {
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+ class MediaQueryFactory {
5
+ constructor(base = "@media") {
6
+ __publicField(this, "next", (value) => {
7
+ const str = new String(value);
8
+ Object.assign(str, {
9
9
  get isMedia() {
10
- return !0;
10
+ return true;
11
11
  },
12
12
  get and() {
13
- return new r(`${t} and`);
13
+ return new MediaQueryFactory(`${value} and`);
14
14
  },
15
15
  get or() {
16
- return new r(`${t},`);
16
+ return new MediaQueryFactory(`${value},`);
17
17
  }
18
- }), e;
18
+ });
19
+ return str;
19
20
  });
20
- this.base = t;
21
+ this.base = base;
21
22
  }
22
- custom(t) {
23
- return this.next(`${this.base} ${t}`);
23
+ custom(value) {
24
+ return this.next(`${this.base} ${value}`);
24
25
  }
25
- minWidth(t) {
26
- const e = typeof t == "number" ? `${t}px` : t, n = `${this.base} (min-width: ${e})`;
27
- return this.next(n);
26
+ minWidth(width) {
27
+ const _width = typeof width === "number" ? `${width}px` : width;
28
+ const value = `${this.base} (min-width: ${_width})`;
29
+ return this.next(value);
28
30
  }
29
- maxWidth(t) {
30
- const e = typeof t == "number" ? `${t}px` : t, n = `${this.base} (max-width: ${e})`;
31
- return this.next(n);
31
+ maxWidth(width) {
32
+ const _width = typeof width === "number" ? `${width}px` : width;
33
+ const value = `${this.base} (max-width: ${_width})`;
34
+ return this.next(value);
32
35
  }
33
- minHeight(t) {
34
- const e = typeof t == "number" ? `${t}px` : t, n = `${this.base} (min-height: ${e})`;
35
- return this.next(n);
36
+ minHeight(height) {
37
+ const _height = typeof height === "number" ? `${height}px` : height;
38
+ const value = `${this.base} (min-height: ${_height})`;
39
+ return this.next(value);
36
40
  }
37
- maxHeight(t) {
38
- const e = typeof t == "number" ? `${t}px` : t, n = `${this.base} (max-height: ${e})`;
39
- return this.next(n);
41
+ maxHeight(height) {
42
+ const _height = typeof height === "number" ? `${height}px` : height;
43
+ const value = `${this.base} (max-height: ${_height})`;
44
+ return this.next(value);
40
45
  }
41
46
  get portrait() {
42
- const t = `${this.base} (orientation: portrait)`;
43
- return this.next(t);
47
+ const value = `${this.base} (orientation: portrait)`;
48
+ return this.next(value);
44
49
  }
45
50
  get landscape() {
46
- const t = `${this.base} (orientation: landscape)`;
47
- return this.next(t);
51
+ const value = `${this.base} (orientation: landscape)`;
52
+ return this.next(value);
48
53
  }
49
- prefersColorScheme(t) {
50
- const e = `${this.base} (prefers-color-scheme: ${t})`;
51
- return this.next(e);
54
+ prefersColorScheme(scheme) {
55
+ const value = `${this.base} (prefers-color-scheme: ${scheme})`;
56
+ return this.next(value);
52
57
  }
53
58
  get dark() {
54
59
  return this.prefersColorScheme("dark");
@@ -57,32 +62,32 @@ class r {
57
62
  return this.prefersColorScheme("light");
58
63
  }
59
64
  get print() {
60
- const t = `${this.base} print`;
61
- return this.next(t);
65
+ const value = `${this.base} print`;
66
+ return this.next(value);
62
67
  }
63
68
  get screen() {
64
- const t = `${this.base} screen`;
65
- return this.next(t);
69
+ const value = `${this.base} screen`;
70
+ return this.next(value);
66
71
  }
67
72
  get speech() {
68
- const t = `${this.base} speech`;
69
- return this.next(t);
73
+ const value = `${this.base} speech`;
74
+ return this.next(value);
70
75
  }
71
76
  get all() {
72
- const t = `${this.base} all`;
73
- return this.next(t);
77
+ const value = `${this.base} all`;
78
+ return this.next(value);
74
79
  }
75
80
  get not() {
76
- const t = `${this.base} not`;
77
- return this.next(t);
81
+ const value = `${this.base} not`;
82
+ return this.next(value);
78
83
  }
79
84
  get reducedMotion() {
80
- const t = `${this.base} (prefers-reduced-motion: reduce)`;
81
- return this.next(t);
85
+ const value = `${this.base} (prefers-reduced-motion: reduce)`;
86
+ return this.next(value);
82
87
  }
83
88
  }
84
- const u = new r();
89
+ const media = new MediaQueryFactory();
85
90
  export {
86
- r as MediaQueryFactory,
87
- u as media
91
+ MediaQueryFactory,
92
+ media
88
93
  };
package/css/merge.cjs CHANGED
@@ -1 +1,15 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=(...t)=>t.flat().reduce((e,r)=>r!=null&&r._current?{...e,...r._current}:{...e,...r},{}),u=(...t)=>t.flat().reduce((e,r)=>({...e,...r._children}),{});exports.mergeFactories=u;exports.mergeObjects=n;
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const mergeObjects = (...styles) => {
4
+ return styles.flat().reduce((acc, style) => {
5
+ if (style == null ? void 0 : style._current) return { ...acc, ...style._current };
6
+ return { ...acc, ...style };
7
+ }, {});
8
+ };
9
+ const mergeFactories = (...factories) => {
10
+ return factories.flat().reduce((acc, factory) => {
11
+ return { ...acc, ...factory._children };
12
+ }, {});
13
+ };
14
+ exports.mergeFactories = mergeFactories;
15
+ exports.mergeObjects = mergeObjects;
package/css/merge.js CHANGED
@@ -1,5 +1,15 @@
1
- const u = (...n) => n.flat().reduce((e, r) => r != null && r._current ? { ...e, ...r._current } : { ...e, ...r }, {}), t = (...n) => n.flat().reduce((e, r) => ({ ...e, ...r._children }), {});
1
+ const mergeObjects = (...styles) => {
2
+ return styles.flat().reduce((acc, style) => {
3
+ if (style == null ? void 0 : style._current) return { ...acc, ...style._current };
4
+ return { ...acc, ...style };
5
+ }, {});
6
+ };
7
+ const mergeFactories = (...factories) => {
8
+ return factories.flat().reduce((acc, factory) => {
9
+ return { ...acc, ...factory._children };
10
+ }, {});
11
+ };
2
12
  export {
3
- t as mergeFactories,
4
- u as mergeObjects
13
+ mergeFactories,
14
+ mergeObjects
5
15
  };
package/css/token.cjs CHANGED
@@ -1 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=e=>`{${e}}`;exports.token=t;
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const token = (token2) => `{${token2}}`;
4
+ exports.token = token;
package/css/token.js CHANGED
@@ -1,4 +1,4 @@
1
- const t = (o) => `{${o}}`;
1
+ const token = (token2) => `{${token2}}`;
2
2
  export {
3
- t as token
3
+ token
4
4
  };
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ const toAlphabeticChar = (code) => String.fromCharCode(code + (code > 25 ? 39 : 97));
3
+ const toAlphabeticName = (code, length) => {
4
+ let name = "";
5
+ let x;
6
+ for (x = Math.abs(code); x > 52; x = x / 52 | 0) name = toAlphabeticChar(x % 52) + name;
7
+ name = toAlphabeticChar(x % 52) + name;
8
+ if (name.length < length) {
9
+ name = name.padStart(length, "a");
10
+ } else if (name.length > length) {
11
+ name = name.slice(-length);
12
+ }
13
+ return name;
14
+ };
15
+ const toPhash = (h, x) => {
16
+ let i = x.length;
17
+ while (i) h = h * 33 ^ x.charCodeAt(--i);
18
+ return h;
19
+ };
20
+ const toHash = (value, length = 5) => {
21
+ const numericHash = toPhash(5381, JSON.stringify(value)) >>> 0;
22
+ return toAlphabeticName(numericHash, length);
23
+ };
24
+ function dashCase(str) {
25
+ if (!str) return "";
26
+ if (typeof str !== "string") return dashCase(String(str));
27
+ return str.replace(/[\s.]/g, "-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g, (s, i) => {
28
+ return (i > 0 ? "-" : "") + s.toLowerCase();
29
+ });
30
+ }
31
+ exports.dashCase = dashCase;
32
+ exports.toHash = toHash;
@@ -0,0 +1,33 @@
1
+ const toAlphabeticChar = (code) => String.fromCharCode(code + (code > 25 ? 39 : 97));
2
+ const toAlphabeticName = (code, length) => {
3
+ let name = "";
4
+ let x;
5
+ for (x = Math.abs(code); x > 52; x = x / 52 | 0) name = toAlphabeticChar(x % 52) + name;
6
+ name = toAlphabeticChar(x % 52) + name;
7
+ if (name.length < length) {
8
+ name = name.padStart(length, "a");
9
+ } else if (name.length > length) {
10
+ name = name.slice(-length);
11
+ }
12
+ return name;
13
+ };
14
+ const toPhash = (h, x) => {
15
+ let i = x.length;
16
+ while (i) h = h * 33 ^ x.charCodeAt(--i);
17
+ return h;
18
+ };
19
+ const toHash = (value, length = 5) => {
20
+ const numericHash = toPhash(5381, JSON.stringify(value)) >>> 0;
21
+ return toAlphabeticName(numericHash, length);
22
+ };
23
+ function dashCase(str) {
24
+ if (!str) return "";
25
+ if (typeof str !== "string") return dashCase(String(str));
26
+ return str.replace(/[\s.]/g, "-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g, (s, i) => {
27
+ return (i > 0 ? "-" : "") + s.toLowerCase();
28
+ });
29
+ }
30
+ export {
31
+ dashCase as d,
32
+ toHash as t
33
+ };
@@ -0,0 +1,60 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+ class TemplateFactory {
5
+ constructor(params) {
6
+ __publicField(this, "_path");
7
+ this.params = params;
8
+ }
9
+ get _current() {
10
+ return this.params.template;
11
+ }
12
+ get isDefineTemplate() {
13
+ return true;
14
+ }
15
+ _setPath(path) {
16
+ this._path = path;
17
+ return this;
18
+ }
19
+ }
20
+ class TemplatesFactory {
21
+ constructor(params) {
22
+ __publicField(this, "_path");
23
+ __publicField(this, "templates", []);
24
+ this.params = params;
25
+ Object.entries(params).forEach(([name, template]) => {
26
+ this.templates.push(
27
+ new TemplateFactory({
28
+ name,
29
+ template
30
+ })
31
+ );
32
+ });
33
+ }
34
+ get _current() {
35
+ return this.params;
36
+ }
37
+ get _children() {
38
+ return Object.fromEntries(
39
+ this.templates.map((template) => {
40
+ return [template.params.name, template];
41
+ })
42
+ );
43
+ }
44
+ get isDefineTemplates() {
45
+ return true;
46
+ }
47
+ _setPath(path) {
48
+ this._path = path;
49
+ this.templates.forEach((template) => template._setPath(path));
50
+ return this;
51
+ }
52
+ }
53
+ const defineTemplates = (templates) => {
54
+ return new TemplatesFactory(templates);
55
+ };
56
+ export {
57
+ TemplateFactory as T,
58
+ TemplatesFactory as a,
59
+ defineTemplates as d
60
+ };