@plumeria/core 0.8.13 → 0.9.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.
Files changed (49) hide show
  1. package/README.md +3 -3
  2. package/dist/cjs/css.js +80 -11
  3. package/dist/cjs/css.js.map +1 -0
  4. package/dist/cjs/cx.js +2 -2
  5. package/dist/cjs/cx.js.map +1 -0
  6. package/dist/cjs/index.js +7 -3
  7. package/dist/cjs/index.js.map +1 -0
  8. package/dist/cjs/processors/css.js +65 -0
  9. package/dist/cjs/processors/css.js.map +1 -0
  10. package/dist/cjs/rx.js +2 -2
  11. package/dist/cjs/rx.js.map +1 -0
  12. package/dist/esm/css.js +79 -8
  13. package/dist/esm/css.js.map +1 -0
  14. package/dist/esm/cx.js +3 -1
  15. package/dist/esm/cx.js.map +1 -0
  16. package/dist/esm/index.js +4 -3
  17. package/dist/esm/index.js.map +1 -0
  18. package/dist/esm/processors/css.js +60 -0
  19. package/dist/esm/processors/css.js.map +1 -0
  20. package/dist/esm/rx.js +3 -1
  21. package/dist/esm/rx.js.map +1 -0
  22. package/package.json +10 -10
  23. package/types/css.d.ts +199 -40
  24. package/types/cx.d.ts +2 -1
  25. package/types/index.d.ts +4 -3
  26. package/types/processors/css.d.ts +10 -0
  27. package/types/rx.d.ts +2 -1
  28. package/dist/cjs/methods/build-helper.js +0 -7
  29. package/dist/cjs/methods/create-build-helper.js +0 -34
  30. package/dist/cjs/methods/create.js +0 -24
  31. package/dist/cjs/methods/define-theme-vars.js +0 -29
  32. package/dist/cjs/methods/global-build-helper.js +0 -34
  33. package/dist/cjs/methods/global.js +0 -16
  34. package/dist/cjs/methods/keyframes.js +0 -11
  35. package/dist/esm/methods/build-helper.js +0 -2
  36. package/dist/esm/methods/create-build-helper.js +0 -30
  37. package/dist/esm/methods/create.js +0 -21
  38. package/dist/esm/methods/define-theme-vars.js +0 -25
  39. package/dist/esm/methods/global-build-helper.js +0 -30
  40. package/dist/esm/methods/global.js +0 -13
  41. package/dist/esm/methods/keyframes.js +0 -7
  42. package/types/methods/build-helper.d.ts +0 -2
  43. package/types/methods/create-build-helper.d.ts +0 -5
  44. package/types/methods/create.d.ts +0 -2
  45. package/types/methods/define-theme-vars.d.ts +0 -2
  46. package/types/methods/global-build-helper.d.ts +0 -5
  47. package/types/methods/global.d.ts +0 -2
  48. package/types/methods/keyframes.d.ts +0 -2
  49. /package/{stylesheet/core.css → stylesheet.css} +0 -0
package/README.md CHANGED
@@ -155,14 +155,14 @@ const tokens = css.defineThemeVars({
155
155
  });
156
156
  ```
157
157
 
158
- ### css.colors
158
+ ### css.color
159
159
 
160
160
  Mixes #000 or #FFF into the color.
161
161
  The first argument takes the color and the second argument takes the same value as opacity (string % or number).
162
162
 
163
163
  ```ts
164
- color: css.colors.darken('skyblue', 0.12),
165
- color: css.colors.lighten('navy', 0.6),
164
+ color: css.color.darken('skyblue', 0.12),
165
+ color: css.color.lighten('navy', 0.6),
166
166
  ```
167
167
 
168
168
  ## ESLint
package/dist/cjs/css.js CHANGED
@@ -1,27 +1,96 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.css = void 0;
3
+ const zss_engine_1 = require("zss-engine");
4
+ const css_js_1 = require("./processors/css.js");
4
5
  const zss_utils_1 = require("zss-utils");
5
- const create_1 = require("./methods/create");
6
- const global_1 = require("./methods/global");
7
- const keyframes_1 = require("./methods/keyframes");
8
- const define_theme_vars_1 = require("./methods/define-theme-vars");
6
+ function create(object) {
7
+ const base36Hash = (0, zss_engine_1.genBase36Hash)(object, 6);
8
+ const { styleSheet } = (0, zss_engine_1.transpiler)(object, base36Hash);
9
+ const injectCSS = zss_engine_1.isServer ? zss_engine_1.injectServerCSS : zss_engine_1.injectClientCSS;
10
+ if (typeof css_js_1.globalPromise_1 === 'undefined')
11
+ (0, css_js_1.initPromise_1)();
12
+ (0, css_js_1.resolvePromise_1)(styleSheet);
13
+ Object.keys(object).forEach((key) => {
14
+ Object.defineProperty(object, key, {
15
+ get: () => {
16
+ const className = key + '_' + base36Hash;
17
+ if (zss_engine_1.isDevAndTest)
18
+ injectCSS(base36Hash, styleSheet);
19
+ return className;
20
+ },
21
+ });
22
+ });
23
+ return Object.freeze(object);
24
+ }
25
+ function global(object) {
26
+ const base36Hash = (0, zss_engine_1.genBase36Hash)(object, 8);
27
+ const { styleSheet } = (0, zss_engine_1.transpiler)(object, undefined, '--global');
28
+ if (typeof css_js_1.globalPromise_2 === 'undefined')
29
+ (0, css_js_1.initPromise_2)();
30
+ (0, css_js_1.resolvePromise_2)(styleSheet);
31
+ if (zss_engine_1.isDevAndTest)
32
+ zss_engine_1.isServer
33
+ ? (0, zss_engine_1.injectServerCSS)(base36Hash, styleSheet)
34
+ : (0, zss_engine_1.injectClientGlobalCSS)(styleSheet);
35
+ }
36
+ const defineVars = (object) => {
37
+ const styles = {
38
+ ':root': {},
39
+ };
40
+ const result = {};
41
+ Object.entries(object).forEach(([key, value]) => {
42
+ result[key] = `var(--${key})`;
43
+ styles[':root'][`--${key}`] = value;
44
+ });
45
+ global(styles);
46
+ return result;
47
+ };
48
+ const defineTheme = (object) => {
49
+ const styles = {};
50
+ const result = {};
51
+ Object.entries(object).forEach(([key, value]) => {
52
+ result[key] = `var(--${key})`;
53
+ Object.entries(value).forEach(([subKey, subValue]) => {
54
+ if (subKey.startsWith('@media')) {
55
+ styles[':root'] ||= {};
56
+ styles[':root'][subKey] ||= {};
57
+ styles[':root'][subKey][`--${key}`] = subValue;
58
+ }
59
+ else {
60
+ const themeSelector = subKey === 'default' ? ':root' : `:root[data-theme="${subKey}"]`;
61
+ styles[themeSelector] ||= {};
62
+ styles[themeSelector][`--${key}`] = subValue;
63
+ }
64
+ });
65
+ });
66
+ global(styles);
67
+ return result;
68
+ };
69
+ const keyframes = (object) => {
70
+ const prefix = (0, zss_engine_1.genBase36Hash)(object, 8);
71
+ global({ [`@keyframes ${prefix}`]: object });
72
+ return prefix;
73
+ };
9
74
  class css {
10
75
  static create(object) {
11
- return (0, create_1.create)(object);
76
+ return create(object);
12
77
  }
13
78
  static global(object) {
14
- return (0, global_1.global)(object);
79
+ return global(object);
80
+ }
81
+ static defineVars(object) {
82
+ return defineVars(object);
15
83
  }
16
- static defineThemeVars(object) {
17
- return (0, define_theme_vars_1.defineThemeVars)(object);
84
+ static defineTheme(object) {
85
+ return defineTheme(object);
18
86
  }
19
87
  static keyframes(object) {
20
- return (0, keyframes_1.keyframes)(object);
88
+ return keyframes(object);
21
89
  }
22
90
  static media = zss_utils_1.media;
23
91
  static container = zss_utils_1.container;
24
92
  static pseudo = zss_utils_1.pseudo;
25
93
  static color = zss_utils_1.color;
26
94
  }
27
- exports.css = css;
95
+ exports.default = css;
96
+ //# sourceMappingURL=css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"css.js","sourceRoot":"","sources":["../../src/css.ts"],"names":[],"mappings":";;AAUA,2CAQoB;AACpB,gDAO6B;AAC7B,yCAA4D;AAE5D,SAAS,MAAM,CACb,MAA0B;IAE1B,MAAM,UAAU,GAAG,IAAA,0BAAa,EAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAC5C,MAAM,EAAE,UAAU,EAAE,GAAG,IAAA,uBAAU,EAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACtD,MAAM,SAAS,GAAG,qBAAQ,CAAC,CAAC,CAAC,4BAAe,CAAC,CAAC,CAAC,4BAAe,CAAC;IAC/D,IAAI,OAAO,wBAAe,KAAK,WAAW;QAAE,IAAA,sBAAa,GAAE,CAAC;IAC5D,IAAA,yBAAgB,EAAC,UAAU,CAAC,CAAC;IAE7B,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QAClC,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE;YACjC,GAAG,EAAE,GAAG,EAAE;gBACR,MAAM,SAAS,GAAG,GAAG,GAAG,GAAG,GAAG,UAAU,CAAC;gBACzC,IAA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AAE,CAAC,CAAC;IAC7C,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,GAAG;IACP,MAAM,CAAC,MAAM,CACX,MAA0B;QAE1B,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC;IACxB,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,MAAe;QAC3B,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC;IACxB,CAAC;IAED,MAAM,CAAC,UAAU,CAA6B,MAAS;QACrD,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;IAED,MAAM,CAAC,WAAW,CAA8B,MAAS;QACvD,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC;IAED,MAAM,CAAC,SAAS,CAAC,MAAuB;QACtC,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;IAED,MAAM,CAAC,KAAK,GAAG,iBAAK,CAAC;IACrB,MAAM,CAAC,SAAS,GAAG,qBAAS,CAAC;IAC7B,MAAM,CAAC,MAAM,GAAG,kBAAM,CAAC;IACvB,MAAM,CAAC,KAAK,GAAG,iBAAK,CAAC;;AAGvB,kBAAe,GAAG,CAAC"}
package/dist/cjs/cx.js CHANGED
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cx = void 0;
4
3
  const cx = (...strings) => {
5
4
  let result = '';
6
5
  let isFirst = true;
@@ -20,4 +19,5 @@ const cx = (...strings) => {
20
19
  });
21
20
  return result;
22
21
  };
23
- exports.cx = cx;
22
+ exports.default = cx;
23
+ //# sourceMappingURL=cx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cx.js","sourceRoot":"","sources":["../../src/cx.ts"],"names":[],"mappings":";;AAAA,MAAM,EAAE,GAAG,CACT,GAAG,OAAiD,EACtC,EAAE;IAChB,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAI,OAAO,GAAG,IAAI,CAAC;IACnB,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QACtC,IAAI,GAAG,EAAE,QAAQ,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACpC,MAAM,IAAI,GAAG,CAAC,QAAQ,EAAkB,CAAC;QAC3C,CAAC;aAAM,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;YACnC,IAAI,OAAO,EAAE,CAAC;gBACZ,MAAM,IAAI,GAAG,CAAC;gBACd,OAAO,GAAG,KAAK,CAAC;YAClB,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,IAAI,GAAG,EAAE,CAAC;YACtB,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,MAAsB,CAAC;AAChC,CAAC,CAAC;AAEF,kBAAe,EAAE,CAAC"}
package/dist/cjs/index.js CHANGED
@@ -1,9 +1,13 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.rx = exports.cx = exports.css = void 0;
4
7
  var css_1 = require("./css");
5
- Object.defineProperty(exports, "css", { enumerable: true, get: function () { return css_1.css; } });
8
+ Object.defineProperty(exports, "css", { enumerable: true, get: function () { return __importDefault(css_1).default; } });
6
9
  var cx_1 = require("./cx");
7
- Object.defineProperty(exports, "cx", { enumerable: true, get: function () { return cx_1.cx; } });
10
+ Object.defineProperty(exports, "cx", { enumerable: true, get: function () { return __importDefault(cx_1).default; } });
8
11
  var rx_1 = require("./rx");
9
- Object.defineProperty(exports, "rx", { enumerable: true, get: function () { return rx_1.rx; } });
12
+ Object.defineProperty(exports, "rx", { enumerable: true, get: function () { return __importDefault(rx_1).default; } });
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,6BAAuC;AAA9B,2GAAA,OAAO,OAAO;AACvB,2BAAqC;AAA5B,yGAAA,OAAO,OAAM;AACtB,2BAAqC;AAA5B,yGAAA,OAAO,OAAM"}
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.globalPromise_2 = exports.resolvePromise_2 = exports.globalPromise_1 = exports.resolvePromise_1 = void 0;
4
+ exports.buildCreate = buildCreate;
5
+ exports.initPromise_1 = initPromise_1;
6
+ exports.buildGlobal = buildGlobal;
7
+ exports.initPromise_2 = initPromise_2;
8
+ const zss_engine_1 = require("zss-engine");
9
+ let resolvePromise_1;
10
+ let globalPromise_1;
11
+ const sheetQueue_1 = [];
12
+ let isProcessing_1 = false;
13
+ function initPromise_1() {
14
+ exports.globalPromise_1 = globalPromise_1 = new Promise((resolve) => {
15
+ exports.resolvePromise_1 = resolvePromise_1 = (value) => {
16
+ sheetQueue_1.push(value);
17
+ resolve(value);
18
+ };
19
+ });
20
+ }
21
+ async function processQueue_1(filePath) {
22
+ while (sheetQueue_1.length > 0) {
23
+ const styleSheet = sheetQueue_1.shift();
24
+ if (!zss_engine_1.isDevelopment && styleSheet)
25
+ (0, zss_engine_1.build)(styleSheet, filePath);
26
+ }
27
+ isProcessing_1 = false;
28
+ }
29
+ async function buildCreate(filePath) {
30
+ if (typeof globalPromise_1 === 'undefined')
31
+ initPromise_1();
32
+ if (!isProcessing_1 && sheetQueue_1.length > 0) {
33
+ isProcessing_1 = true;
34
+ processQueue_1(filePath);
35
+ }
36
+ }
37
+ let resolvePromise_2;
38
+ let globalPromise_2;
39
+ const sheetQueue_2 = [];
40
+ let isProcessing_2 = false;
41
+ function initPromise_2() {
42
+ exports.globalPromise_2 = globalPromise_2 = new Promise((resolve) => {
43
+ exports.resolvePromise_2 = resolvePromise_2 = (value) => {
44
+ sheetQueue_2.push(value);
45
+ resolve(value);
46
+ };
47
+ });
48
+ }
49
+ async function processQueue_2(filePath) {
50
+ while (sheetQueue_2.length > 0) {
51
+ const styleSheet = sheetQueue_2.shift();
52
+ if (!zss_engine_1.isDevelopment && styleSheet)
53
+ (0, zss_engine_1.build)(styleSheet, filePath, '--global');
54
+ }
55
+ isProcessing_2 = false;
56
+ }
57
+ async function buildGlobal(filePath) {
58
+ if (typeof globalPromise_2 === 'undefined')
59
+ initPromise_2();
60
+ if (!isProcessing_2 && sheetQueue_2.length > 0) {
61
+ isProcessing_2 = true;
62
+ processQueue_2(filePath);
63
+ }
64
+ }
65
+ //# sourceMappingURL=css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"css.js","sourceRoot":"","sources":["../../../src/processors/css.ts"],"names":[],"mappings":";;;AAwBA,kCAMC;AAE2C,sCAAa;AAwBzD,kCAMC;AAE2C,sCAAa;AAhEzD,2CAAkD;AAElD,IAAI,gBAAyC,CAAC;AAC9C,IAAI,eAAgC,CAAC;AACrC,MAAM,YAAY,GAAa,EAAE,CAAC;AAClC,IAAI,cAAc,GAAG,KAAK,CAAC;AAE3B,SAAS,aAAa;IACpB,0BAAA,eAAe,GAAG,IAAI,OAAO,CAAS,CAAC,OAAO,EAAE,EAAE;QAChD,2BAAA,gBAAgB,GAAG,CAAC,KAAa,EAAE,EAAE;YACnC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACzB,OAAO,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,KAAK,UAAU,cAAc,CAAC,QAAgB;IAC5C,OAAO,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC/B,MAAM,UAAU,GAAG,YAAY,CAAC,KAAK,EAAE,CAAC;QACxC,IAAI,CAAC,0BAAa,IAAI,UAAU;YAAE,IAAA,kBAAK,EAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IAChE,CAAC;IACD,cAAc,GAAG,KAAK,CAAC;AACzB,CAAC;AAEM,KAAK,U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/rx.js CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.rx = void 0;
4
3
  const rx = (className, varSet) => ({
5
4
  className,
6
5
  style: Object.fromEntries(Object.entries(varSet).map(([key, value]) => [key, value])),
7
6
  });
8
- exports.rx = rx;
7
+ exports.default = rx;
8
+ //# sourceMappingURL=rx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rx.js","sourceRoot":"","sources":["../../src/rx.ts"],"names":[],"mappings":";;AAAA,MAAM,EAAE,GAAG,CAAC,SAAiB,EAAE,MAAwC,EAAE,EAAE,CAAC,CAAC;IAC3E,SAAS;IACT,KAAK,EAAE,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAC3D;CACF,CAAC,CAAC;AAEH,kBAAe,EAAE,CAAC"}
package/dist/esm/css.js CHANGED
@@ -1,17 +1,86 @@
1
- import { media, pseudo, color, container } from 'zss-utils';
2
- import { create } from './methods/create';
3
- import { global } from './methods/global';
4
- import { keyframes } from './methods/keyframes';
5
- import { defineThemeVars } from './methods/define-theme-vars';
6
- export class css {
1
+ import { transpiler, isServer, isDevAndTest, injectServerCSS, injectClientCSS, injectClientGlobalCSS, genBase36Hash, } from 'zss-engine';
2
+ import { initPromise_1, globalPromise_1, resolvePromise_1, initPromise_2, globalPromise_2, resolvePromise_2, } from './processors/css.js';
3
+ import { media, container, pseudo, color } from 'zss-utils';
4
+ function create(object) {
5
+ const base36Hash = genBase36Hash(object, 6);
6
+ const { styleSheet } = transpiler(object, base36Hash);
7
+ const injectCSS = isServer ? injectServerCSS : injectClientCSS;
8
+ if (typeof globalPromise_1 === 'undefined')
9
+ initPromise_1();
10
+ resolvePromise_1(styleSheet);
11
+ Object.keys(object).forEach((key) => {
12
+ Object.defineProperty(object, key, {
13
+ get: () => {
14
+ const className = key + '_' + base36Hash;
15
+ if (isDevAndTest)
16
+ injectCSS(base36Hash, styleSheet);
17
+ return className;
18
+ },
19
+ });
20
+ });
21
+ return Object.freeze(object);
22
+ }
23
+ function global(object) {
24
+ const base36Hash = genBase36Hash(object, 8);
25
+ const { styleSheet } = transpiler(object, undefined, '--global');
26
+ if (typeof globalPromise_2 === 'undefined')
27
+ initPromise_2();
28
+ resolvePromise_2(styleSheet);
29
+ if (isDevAndTest)
30
+ isServer
31
+ ? injectServerCSS(base36Hash, styleSheet)
32
+ : injectClientGlobalCSS(styleSheet);
33
+ }
34
+ const defineVars = (object) => {
35
+ const styles = {
36
+ ':root': {},
37
+ };
38
+ const result = {};
39
+ Object.entries(object).forEach(([key, value]) => {
40
+ result[key] = `var(--${key})`;
41
+ styles[':root'][`--${key}`] = value;
42
+ });
43
+ global(styles);
44
+ return result;
45
+ };
46
+ const defineTheme = (object) => {
47
+ const styles = {};
48
+ const result = {};
49
+ Object.entries(object).forEach(([key, value]) => {
50
+ result[key] = `var(--${key})`;
51
+ Object.entries(value).forEach(([subKey, subValue]) => {
52
+ if (subKey.startsWith('@media')) {
53
+ styles[':root'] ||= {};
54
+ styles[':root'][subKey] ||= {};
55
+ styles[':root'][subKey][`--${key}`] = subValue;
56
+ }
57
+ else {
58
+ const themeSelector = subKey === 'default' ? ':root' : `:root[data-theme="${subKey}"]`;
59
+ styles[themeSelector] ||= {};
60
+ styles[themeSelector][`--${key}`] = subValue;
61
+ }
62
+ });
63
+ });
64
+ global(styles);
65
+ return result;
66
+ };
67
+ const keyframes = (object) => {
68
+ const prefix = genBase36Hash(object, 8);
69
+ global({ [`@keyframes ${prefix}`]: object });
70
+ return prefix;
71
+ };
72
+ class css {
7
73
  static create(object) {
8
74
  return create(object);
9
75
  }
10
76
  static global(object) {
11
77
  return global(object);
12
78
  }
13
- static defineThemeVars(object) {
14
- return defineThemeVars(object);
79
+ static defineVars(object) {
80
+ return defineVars(object);
81
+ }
82
+ static defineTheme(object) {
83
+ return defineTheme(object);
15
84
  }
16
85
  static keyframes(object) {
17
86
  return keyframes(object);
@@ -21,3 +90,5 @@ export class css {
21
90
  static pseudo = pseudo;
22
91
  static color = color;
23
92
  }
93
+ export default css;
94
+ //# sourceMappingURL=css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"css.js","sourceRoot":"","sources":["../../src/css.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,eAAe,EACf,eAAe,EACf,qBAAqB,EACrB,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAE5D,SAAS,MAAM,CACb,MAA0B;IAE1B,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAC5C,MAAM,EAAE,UAAU,EAAE,GAAG,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACtD,MAAM,SAAS,GAAG,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,eAAe,CAAC;IAC/D,IAAI,OAAO,eAAe,KAAK,WAAW;QAAE,aAAa,EAAE,CAAC;IAC5D,gBAAgB,CAAC,UAAU,CAAC,CAAC;IAE7B,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QAClC,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE;YACjC,GAAG,EAAE,GAAG,EAAE;gBACR,MAAM,SAAS,GAAG,GAAG,GAAG,GAAG,GAAG,UAAU,CAAC;gBACzC,IAAI,YAAY;oBAAE,SAAS,CAAC,UAA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AAM,CAAC,MAAM,CACX,MAA0B;QAE1B,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC;IACxB,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,MAAe;QAC3B,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC;IACxB,CAAC;IAED,MAAM,CAAC,UAAU,CAA6B,MAAS;QACrD,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;IAED,MAAM,CAAC,WAAW,CAA8B,MAAS;QACvD,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC;IAED,MAAM,CAAC,SAAS,CAAC,MAAuB;QACtC,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;IAED,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;;AAGvB,eAAe,GAAG,CAAC"}
package/dist/esm/cx.js CHANGED
@@ -1,4 +1,4 @@
1
- export const cx = (...strings) => {
1
+ const cx = (...strings) => {
2
2
  let result = '';
3
3
  let isFirst = true;
4
4
  strings.filter(Boolean).forEach((str) => {
@@ -17,3 +17,5 @@ export const cx = (...strings) => {
17
17
  });
18
18
  return result;
19
19
  };
20
+ export default cx;
21
+ //# sourceMappingURL=cx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cx.js","sourceRoot":"","sources":["../../src/cx.ts"],"names":[],"mappings":"AAAA,MAAM,EAAE,GAAG,CACT,GAAG,OAAiD,EACtC,EAAE;IAChB,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAI,OAAO,GAAG,IAAI,CAAC;IACnB,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QACtC,IAAI,GAAG,EAAE,QAAQ,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACpC,MAAM,IAAI,GAAG,CAAC,QAAQ,EAAkB,CAAC;QAC3C,CAAC;aAAM,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;YACnC,IAAI,OAAO,EAAE,CAAC;gBACZ,MAAM,IAAI,GAAG,CAAC;gBACd,OAAO,GAAG,KAAK,CAAC;YAClB,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,IAAI,GAAG,EAAE,CAAC;YACtB,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,MAAsB,CAAC;AAChC,CAAC,CAAC;AAEF,eAAe,EAAE,CAAC"}
package/dist/esm/index.js CHANGED
@@ -1,3 +1,4 @@
1
- export { css } from './css';
2
- export { cx } from './cx';
3
- export { rx } from './rx';
1
+ export { default as css } from './css';
2
+ export { default as cx } from './cx';
3
+ export { default as rx } from './rx';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,OAAO,IAAI,EAAE,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,OAAO,IAAI,EAAE,EAAE,MAAM,MAAM,CAAC"}
@@ -0,0 +1,60 @@
1
+ import { build, isDevelopment } from 'zss-engine';
2
+ let resolvePromise_1;
3
+ let globalPromise_1;
4
+ const sheetQueue_1 = [];
5
+ let isProcessing_1 = false;
6
+ function initPromise_1() {
7
+ globalPromise_1 = new Promise((resolve) => {
8
+ resolvePromise_1 = (value) => {
9
+ sheetQueue_1.push(value);
10
+ resolve(value);
11
+ };
12
+ });
13
+ }
14
+ async function processQueue_1(filePath) {
15
+ while (sheetQueue_1.length > 0) {
16
+ const styleSheet = sheetQueue_1.shift();
17
+ if (!isDevelopment && styleSheet)
18
+ build(styleSheet, filePath);
19
+ }
20
+ isProcessing_1 = false;
21
+ }
22
+ export async function buildCreate(filePath) {
23
+ if (typeof globalPromise_1 === 'undefined')
24
+ initPromise_1();
25
+ if (!isProcessing_1 && sheetQueue_1.length > 0) {
26
+ isProcessing_1 = true;
27
+ processQueue_1(filePath);
28
+ }
29
+ }
30
+ export { resolvePromise_1, globalPromise_1, initPromise_1 };
31
+ let resolvePromise_2;
32
+ let globalPromise_2;
33
+ const sheetQueue_2 = [];
34
+ let isProcessing_2 = false;
35
+ function initPromise_2() {
36
+ globalPromise_2 = new Promise((resolve) => {
37
+ resolvePromise_2 = (value) => {
38
+ sheetQueue_2.push(value);
39
+ resolve(value);
40
+ };
41
+ });
42
+ }
43
+ async function processQueue_2(filePath) {
44
+ while (sheetQueue_2.length > 0) {
45
+ const styleSheet = sheetQueue_2.shift();
46
+ if (!isDevelopment && styleSheet)
47
+ build(styleSheet, filePath, '--global');
48
+ }
49
+ isProcessing_2 = false;
50
+ }
51
+ export async function buildGlobal(filePath) {
52
+ if (typeof globalPromise_2 === 'undefined')
53
+ initPromise_2();
54
+ if (!isProcessing_2 && sheetQueue_2.length > 0) {
55
+ isProcessing_2 = true;
56
+ processQueue_2(filePath);
57
+ }
58
+ }
59
+ export { resolvePromise_2, globalPromise_2, initPromise_2 };
60
+ //# sourceMappingURL=css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"css.js","sourceRoot":"","sources":["../../../src/processors/css.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAElD,IAAI,gBAAyC,CAAC;AAC9C,IAAI,eAAgC,CAAC;AACrC,MAAM,YAAY,GAAa,EAAE,CAAC;AAClC,IAAI,cAAc,GAAG,KAAK,CAAC;AAE3B,SAAS,aAAa;IACpB,eAAe,GAAG,IAAI,OAAO,CAAS,CAAC,OAAO,EAAE,EAAE;QAChD,gBAAgB,GAAG,CAAC,KAAa,EAAE,EAAE;YACnC,YAAY,CAAC,IAAI,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GAAG,YAAY,CAAC,KAAK,EAAE,CAAC;QACxC,IAAI,CAAC,aAAa,IAAI,UAAU;YAAE,KAAK,CAAC,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;IAC5E,CAAC;IACD,cAAc,GAAG,KAAK,CAAC;AACzB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,QAAgB;IAChD,IAAI,OAAO,eAAe,KAAK,WAAW;QAAE,aAAa,EAAE,CAAC;IAC5D,IAAI,CAAC,cAAc,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC/C,cAAc,GAAG,IAAI,CAAC;QACtB,cAAc,CAAC,QAAQ,CAAC,CAAC;IAC3B,CAAC;AACH,CAAC;AAED,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,aAAa,EAAE,CAAC"}
package/dist/esm/rx.js CHANGED
@@ -1,4 +1,6 @@
1
- export const rx = (className, varSet) => ({
1
+ const rx = (className, varSet) => ({
2
2
  className,
3
3
  style: Object.fromEntries(Object.entries(varSet).map(([key, value]) => [key, value])),
4
4
  });
5
+ export default rx;
6
+ //# sourceMappingURL=rx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rx.js","sourceRoot":"","sources":["../../src/rx.ts"],"names":[],"mappings":"AAAA,MAAM,EAAE,GAAG,CAAC,SAAiB,EAAE,MAAwC,EAAE,EAAE,CAAC,CAAC;IAC3E,SAAS;IACT,KAAK,EAAE,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAC3D;CACF,CAAC,CAAC;AAEH,eAAe,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/core",
3
- "version": "0.8.13",
3
+ "version": "0.9.1",
4
4
  "description": "Near Zero-runtime CSS-in-JS for efficient design systems.",
5
5
  "keywords": [
6
6
  "css",
@@ -19,16 +19,16 @@
19
19
  "sideEffects": false,
20
20
  "exports": {
21
21
  "./package.json": "./package.json",
22
- "./stylesheet": "./stylesheet/core.css",
23
- "./build-helper": {
24
- "types": "./types/methods/build-helper.d.ts",
25
- "import": "./dist/esm/methods/build-helper.js",
26
- "default": "./dist/cjs/methods/build-helper.js"
27
- },
22
+ "./stylesheet.css": "./stylesheet.css",
28
23
  ".": {
29
24
  "types": "./types/index.d.ts",
30
25
  "import": "./dist/esm/index.js",
31
26
  "default": "./dist/cjs/index.js"
27
+ },
28
+ "./processors": {
29
+ "types": "./types/processors/css.d.ts",
30
+ "import": "./dist/esm/processors/css.js",
31
+ "default": "./dist/cjs/processors/css.js"
32
32
  }
33
33
  },
34
34
  "main": "dist/cjs/index.js",
@@ -37,11 +37,11 @@
37
37
  "files": [
38
38
  "dist/",
39
39
  "types/",
40
- "stylesheet/"
40
+ "stylesheet.css"
41
41
  ],
42
42
  "dependencies": {
43
- "zss-engine": "^0.2.27",
44
- "zss-utils": "0.2.0"
43
+ "zss-engine": "0.2.32",
44
+ "zss-utils": "0.2.2"
45
45
  },
46
46
  "publishConfig": {
47
47
  "access": "public"
package/types/css.d.ts CHANGED
@@ -1,46 +1,49 @@
1
- import type { CreateStyle, CustomHTMLType, CustomProperties, KeyframesDefinition, ReturnType, VarsDefinition } from 'zss-engine';
2
- export declare class css {
3
- static create<T extends Record<string, CustomProperties>>(object: CreateStyle<T>): ReturnType<T>;
4
- static global(object: CustomHTMLType): void;
5
- static defineThemeVars<const T extends VarsDefinition>(object: T): { [K in keyof T]: `var(--${string & K})`; };
6
- static keyframes(object: KeyframesDefinition): string;
1
+ import type { CSSProperties, CSSHTML, CreateStyleType, CreateTheme, CreateVars, CreateKeyframes, ReturnType, CreateStyle } from 'zss-engine';
2
+ declare class css {
3
+ static create<T extends Record<string, CSSProperties>>(object: CreateStyleType<T>): ReturnType<T>;
4
+ static global(object: CSSHTML): void;
5
+ static defineVars<const T extends CreateVars>(object: T): { [K in keyof T]: `var(--${string & K})`; };
6
+ static defineTheme<const T extends CreateTheme>(object: T): { [K in keyof T]: `var(--${string & K})`; };
7
+ static keyframes(object: CreateKeyframes): string;
7
8
  static media: {
8
- range: (range: string) => "@media ()";
9
- max: (str: string) => "@media (max-)";
10
- min: (str: string) => "@media (min-)";
11
- scheme: {
12
- readonly dark: "@media (prefers-color-scheme: dark)";
13
- readonly light: "@media (prefers-color-scheme: light)";
14
- };
9
+ dark: "@media (prefers-color-scheme: dark)";
10
+ light: "@media (prefers-color-scheme: light)";
11
+ range: <S extends string>(range: S) => `@media (${S})`;
12
+ maxWidth: <V extends string | number>(value: V) => `@media (max-width: ${V}px)`;
13
+ maxHeight: <V extends string | number>(value: V) => `@media (max-height: ${V}px)`;
14
+ minWidth: <V extends string | number>(value: V) => `@media (min-width: ${V}px)`;
15
+ minHeight: <V extends string | number>(value: V) => `@media (min-height: ${V}px)`;
15
16
  };
16
17
  static container: {
17
- range: (range: string) => "@container ()";
18
- max: (str: string) => "@container (max-)";
19
- min: (str: string) => "@container (min-)";
18
+ range: <S extends string>(range: S) => `@container (${S})`;
19
+ maxWidth: <V extends string | number>(value: V) => V extends number ? `@container (max-width: ${V}px)` : `@container (max-width: ${V})`;
20
+ maxHeight: <V extends string | number>(value: V) => V extends number ? `@container (max-height: ${V}px)` : `@container (max-height: ${V})`;
21
+ minWidth: <V extends string | number>(value: V) => V extends number ? `@container (min-width: ${V}px)` : `@container (min-width: ${V})`;
22
+ minHeight: <V extends string | number>(value: V) => V extends number ? `@container (min-height: ${V}px)` : `@container (min-height: ${V})`;
20
23
  };
21
24
  static pseudo: {
22
25
  fn: {
23
- cue: (str: string) => "::cue()";
24
- dir: (str: string) => ":dir()";
25
- has: (str: string) => ":has()";
26
- host: (str: string) => ":host()";
27
- hostContext: (str: string) => ":host-context()";
28
- is: (str: string) => ":is()";
29
- lang: (str: string) => ":lang()";
30
- nthChild: (str: string) => ":nth-child()";
31
- nthLastChild: (str: string) => ":nth-last-child()";
32
- nthLastOfType: (str: string) => ":nth-last-of-type()";
33
- nthOfType: (str: string) => ":nth-of-type()";
34
- not: (str: string) => ":not()";
35
- state: (str: string) => ":state()";
36
- where: (str: string) => ":where()";
37
- highlight: (str: string) => "::highlight()";
38
- part: (str: string) => "::part()";
39
- slotted: (str: string) => "::slotted()";
40
- viewTransitionImagePair: (str: string) => "::view-transition-image-pair()";
41
- viewTransitionGroup: (str: string) => "::view-transition-group()";
42
- viewTransitionOld: (str: string) => "::view-transition-old()";
43
- viewTransitionNew: (str: string) => "::view-transition-new()";
26
+ cue: <S extends string>(str: S) => `::cue(${S})`;
27
+ dir: <S extends string>(str: S) => `:dir(${S})`;
28
+ has: <S extends string>(str: S) => `:has(${S})`;
29
+ host: <S extends string>(str: S) => `:host(${S})`;
30
+ hostContext: <S extends string>(str: S) => `:host-context(${S})`;
31
+ is: <S extends string>(str: S) => `:is(${S})`;
32
+ lang: <S extends string>(str: S) => `:lang(${S})`;
33
+ nthChild: <S extends string>(str: S) => `:nth-child(${S})`;
34
+ nthLastChild: <S extends string>(str: S) => `:nth-last-child(${S})`;
35
+ nthLastOfType: <S extends string>(str: S) => `:nth-last-of-type(${S})`;
36
+ nthOfType: <S extends string>(str: S) => `:nth-of-type(${S})`;
37
+ not: <S extends string>(str: S) => `:not(${S})`;
38
+ state: <S extends string>(str: S) => `:state(${S})`;
39
+ where: <S extends string>(str: S) => `:where(${S})`;
40
+ highlight: <S extends string>(str: S) => `::highlight(${S})`;
41
+ part: <S extends string>(str: S) => `::part(${S})`;
42
+ slotted: <S extends string>(str: S) => `::slotted(${S})`;
43
+ viewTransitionImagePair: <S extends string>(str: S) => `::view-transition-image-pair(${S})`;
44
+ viewTransitionGroup: <S extends string>(str: S) => `::view-transition-group(${S})`;
45
+ viewTransitionOld: <S extends string>(str: S) => `::view-transition-old(${S})`;
46
+ viewTransitionNew: <S extends string>(str: S) => `::view-transition-new(${S})`;
44
47
  };
45
48
  active: ":active";
46
49
  anyLink: ":any-link";
@@ -87,7 +90,7 @@ export declare class css {
87
90
  readWrite: ":read-write";
88
91
  required: ":required";
89
92
  right: ":right";
90
- root: "root";
93
+ root: ":root";
91
94
  scope: ":scope";
92
95
  seeking: ":seeking";
93
96
  stalled: ":stalled";
@@ -114,7 +117,163 @@ export declare class css {
114
117
  viewTransition: "::view-transition";
115
118
  };
116
119
  static color: {
117
- lighten: (color: string, amount: string | number) => string;
118
- darken: (color: string, amount: string | number) => string;
120
+ lighten: (color: string, amount: string | number) => `color-mix(in srgb, ${string}, white ${number}%)`;
121
+ darken: (color: string, amount: string | number) => `color-mix(in srgb, ${string}, black ${number}%)`;
122
+ primary: "#0070f3";
123
+ secondary: "#ff4081";
124
+ success: "#2e7d32";
125
+ warning: "#ed6c02";
126
+ error: "#d32f2f";
127
+ aliceblue: "aliceblue";
128
+ antiquewhite: "antiquewhite";
129
+ aqua: "aqua";
130
+ aquamarine: "aquamarine";
131
+ azure: "azure";
132
+ beige: "beige";
133
+ bisque: "bisque";
134
+ black: "black";
135
+ blanchedalmond: "blanchedalmond";
136
+ blue: "blue";
137
+ blueviolet: "blueviolet";
138
+ brown: "brown";
139
+ burlywood: "burlywood";
140
+ cadetblue: "cadetblue";
141
+ chartreuse: "chartreuse";
142
+ chocolate: "chocolate";
143
+ coral: "coral";
144
+ cornflowerblue: "cornflowerblue";
145
+ cornsilk: "cornsilk";
146
+ crimson: "crimson";
147
+ cyan: "cyan";
148
+ darkblue: "darkblue";
149
+ darkcyan: "darkcyan";
150
+ darkgoldenrod: "darkgoldenrod";
151
+ darkgray: "darkgray";
152
+ darkgreen: "darkgreen";
153
+ darkgrey: "darkgrey";
154
+ darkkhaki: "darkkhaki";
155
+ darkmagenta: "darkmagenta";
156
+ darkolivegreen: "darkolivegreen";
157
+ darkorange: "darkorange";
158
+ darkorchid: "darkorchid";
159
+ darkred: "darkred";
160
+ darksalmon: "darksalmon";
161
+ darkseagreen: "darkseagreen";
162
+ darkslateblue: "darkslateblue";
163
+ darkslategray: "darkslategray";
164
+ darkslategrey: "darkslategrey";
165
+ darkturquoise: "darkturquoise";
166
+ darkviolet: "darkviolet";
167
+ deeppink: "deeppink";
168
+ deepskyblue: "deepskyblue";
169
+ dimgray: "dimgray";
170
+ dimgrey: "dimgrey";
171
+ dodgerblue: "dodgerblue";
172
+ firebrick: "firebrick";
173
+ floralwhite: "floralwhite";
174
+ forestgreen: "forestgreen";
175
+ fuchsia: "fuchsia";
176
+ gainsboro: "gainsboro";
177
+ ghostwhite: "ghostwhite";
178
+ gold: "gold";
179
+ goldenrod: "goldenrod";
180
+ gray: "gray";
181
+ green: "green";
182
+ greenyellow: "greenyellow";
183
+ grey: "grey";
184
+ honeydew: "honeydew";
185
+ hotpink: "hotpink";
186
+ indianred: "indianred";
187
+ indigo: "indigo";
188
+ ivory: "ivory";
189
+ khaki: "khaki";
190
+ lavender: "lavender";
191
+ lavenderblush: "lavenderblush";
192
+ lawngreen: "lawngreen";
193
+ lemonchiffon: "lemonchiffon";
194
+ lightblue: "lightblue";
195
+ lightcoral: "lightcoral";
196
+ lightcyan: "lightcyan";
197
+ lightgoldenrodyellow: "lightgoldenrodyellow";
198
+ lightgray: "lightgray";
199
+ lightgreen: "lightgreen";
200
+ lightgrey: "lightgrey";
201
+ lightpink: "lightpink";
202
+ lightsalmon: "lightsalmon";
203
+ lightseagreen: "lightseagreen";
204
+ lightskyblue: "lightskyblue";
205
+ lightslategray: "lightslategray";
206
+ lightslategrey: "lightslategrey";
207
+ lightsteelblue: "lightsteelblue";
208
+ lightyellow: "lightyellow";
209
+ lime: "lime";
210
+ limegreen: "limegreen";
211
+ linen: "linen";
212
+ magenta: "magenta";
213
+ maroon: "maroon";
214
+ mediumaquamarine: "mediumaquamarine";
215
+ mediumblue: "mediumblue";
216
+ mediumorchid: "mediumorchid";
217
+ mediumpurple: "mediumpurple";
218
+ mediumseagreen: "mediumseagreen";
219
+ mediumslateblue: "mediumslateblue";
220
+ mediumspringgreen: "mediumspringgreen";
221
+ mediumturquoise: "mediumturquoise";
222
+ mediumvioletred: "mediumvioletred";
223
+ midnightblue: "midnightblue";
224
+ mintcream: "mintcream";
225
+ mistyrose: "mistyrose";
226
+ moccasin: "moccasin";
227
+ navajowhite: "navajowhite";
228
+ navy: "navy";
229
+ oldlace: "oldlace";
230
+ olive: "olive";
231
+ olivedrab: "olivedrab";
232
+ orange: "orange";
233
+ orangered: "orangered";
234
+ orchid: "orchid";
235
+ palegoldenrod: "palegoldenrod";
236
+ palegreen: "palegreen";
237
+ paleturquoise: "paleturquoise";
238
+ palevioletred: "palevioletred";
239
+ papayawhip: "papayawhip";
240
+ peachpuff: "peachpuff";
241
+ peru: "peru";
242
+ pink: "pink";
243
+ plum: "plum";
244
+ powderblue: "powderblue";
245
+ purple: "purple";
246
+ rebeccapurple: "rebeccapurple";
247
+ red: "red";
248
+ rosybrown: "rosybrown";
249
+ royalblue: "royalblue";
250
+ saddlebrown: "saddlebrown";
251
+ salmon: "salmon";
252
+ sandybrown: "sandybrown";
253
+ seagreen: "seagreen";
254
+ seashell: "seashell";
255
+ sienna: "sienna";
256
+ silver: "silver";
257
+ skyblue: "skyblue";
258
+ slateblue: "slateblue";
259
+ slategray: "slategray";
260
+ slategrey: "slategrey";
261
+ snow: "snow";
262
+ springgreen: "springgreen";
263
+ steelblue: "steelblue";
264
+ tan: "tan";
265
+ teal: "teal";
266
+ thistle: "thistle";
267
+ tomato: "tomato";
268
+ transparent: "transparent";
269
+ turquoise: "turquoise";
270
+ violet: "violet";
271
+ wheat: "wheat";
272
+ white: "white";
273
+ whitesmoke: "whitesmoke";
274
+ yellow: "yellow";
275
+ yellowgreen: "yellowgreen";
119
276
  };
120
277
  }
278
+ export default css;
279
+ export type { CSSProperties, CSSHTML, CreateStyle };
package/types/cx.d.ts CHANGED
@@ -1 +1,2 @@
1
- export declare const cx: (...strings: Array<string | null | undefined | false>) => string & ":";
1
+ declare const cx: (...strings: Array<string | null | undefined | false>) => string & ":";
2
+ export default cx;
package/types/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
- export { css } from './css';
2
- export { cx } from './cx';
3
- export { rx } from './rx';
1
+ export { default as css } from './css';
2
+ export { default as cx } from './cx';
3
+ export { default as rx } from './rx';
4
+ export type { CreateStyle, CSSProperties, CSSHTML } from './css';
@@ -0,0 +1,10 @@
1
+ declare let resolvePromise_1: (value: string) => void;
2
+ declare let globalPromise_1: Promise<string>;
3
+ declare function initPromise_1(): void;
4
+ export declare function buildCreate(filePath: string): Promise<void>;
5
+ export { resolvePromise_1, globalPromise_1, initPromise_1 };
6
+ declare let resolvePromise_2: (value: string) => void;
7
+ declare let globalPromise_2: Promise<string>;
8
+ declare function initPromise_2(): void;
9
+ export declare function buildGlobal(filePath: string): Promise<void>;
10
+ export { resolvePromise_2, globalPromise_2, initPromise_2 };
package/types/rx.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const rx: (className: string, varSet: {
1
+ declare const rx: (className: string, varSet: {
2
2
  [key: `--${string}`]: string;
3
3
  }) => {
4
4
  className: string;
@@ -6,3 +6,4 @@ export declare const rx: (className: string, varSet: {
6
6
  [k: string]: string;
7
7
  };
8
8
  };
9
+ export default rx;
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildGlobal = exports.buildCreate = void 0;
4
- var create_build_helper_js_1 = require("./create-build-helper.js");
5
- Object.defineProperty(exports, "buildCreate", { enumerable: true, get: function () { return create_build_helper_js_1.buildCreate; } });
6
- var global_build_helper_js_1 = require("./global-build-helper.js");
7
- Object.defineProperty(exports, "buildGlobal", { enumerable: true, get: function () { return global_build_helper_js_1.buildGlobal; } });
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.globalPromise = exports.resolvePromise = void 0;
4
- exports.buildCreate = buildCreate;
5
- exports.initPromise = initPromise;
6
- const zss_engine_1 = require("zss-engine");
7
- let resolvePromise;
8
- let globalPromise;
9
- const sheetQueue = [];
10
- let isProcessing = false;
11
- function initPromise() {
12
- exports.globalPromise = globalPromise = new Promise((resolve) => {
13
- exports.resolvePromise = resolvePromise = (value) => {
14
- sheetQueue.push(value);
15
- resolve(value);
16
- };
17
- });
18
- }
19
- async function processQueue(filePath) {
20
- while (sheetQueue.length > 0) {
21
- const styleSheet = sheetQueue.shift();
22
- if (!zss_engine_1.isDevelopment && styleSheet)
23
- (0, zss_engine_1.build)(styleSheet, filePath);
24
- }
25
- isProcessing = false;
26
- }
27
- async function buildCreate(filePath) {
28
- if (typeof globalPromise === 'undefined')
29
- initPromise();
30
- if (!isProcessing && sheetQueue.length > 0) {
31
- isProcessing = true;
32
- processQueue(filePath);
33
- }
34
- }
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.create = create;
4
- const zss_engine_1 = require("zss-engine");
5
- const create_build_helper_js_1 = require("./create-build-helper.js");
6
- function create(object) {
7
- const base36Hash = (0, zss_engine_1.genBase36Hash)(object, 6);
8
- const { styleSheet } = (0, zss_engine_1.transpiler)(object, base36Hash);
9
- const injectCSS = zss_engine_1.isServer ? zss_engine_1.injectServerCSS : zss_engine_1.injectClientCSS;
10
- if (typeof create_build_helper_js_1.globalPromise === 'undefined')
11
- (0, create_build_helper_js_1.initPromise)();
12
- (0, create_build_helper_js_1.resolvePromise)(styleSheet);
13
- Object.keys(object).forEach((key) => {
14
- Object.defineProperty(object, key, {
15
- get: () => {
16
- const className = key + '_' + base36Hash;
17
- if (zss_engine_1.isDevAndTest)
18
- injectCSS(base36Hash, styleSheet);
19
- return className;
20
- },
21
- });
22
- });
23
- return Object.freeze(object);
24
- }
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.defineThemeVars = void 0;
4
- const global_js_1 = require("./global.js");
5
- const defineThemeVars = (object) => {
6
- const globalStyles = {};
7
- const result = {};
8
- Object.entries(object).forEach(([key, value]) => {
9
- result[key] = `var(--${key})`;
10
- if (typeof value === 'string') {
11
- (globalStyles[':root'] ||= {})[`--${key}`] = value;
12
- }
13
- else if (typeof value === 'object') {
14
- Object.entries(value).forEach(([subKey, subValue]) => {
15
- if (subKey.startsWith('@media')) {
16
- (globalStyles[':root'] ||= {})[subKey] ||= {};
17
- globalStyles[':root'][subKey][`--${key}`] = subValue;
18
- }
19
- else {
20
- const themeSelector = subKey === 'default' ? ':root' : `:root[data-theme="${subKey}"]`;
21
- (globalStyles[themeSelector] ||= {})[`--${key}`] = subValue;
22
- }
23
- });
24
- }
25
- });
26
- (0, global_js_1.global)(globalStyles);
27
- return result;
28
- };
29
- exports.defineThemeVars = defineThemeVars;
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.globalPromise = exports.resolvePromise = void 0;
4
- exports.buildGlobal = buildGlobal;
5
- exports.initPromise = initPromise;
6
- const zss_engine_1 = require("zss-engine");
7
- let resolvePromise;
8
- let globalPromise;
9
- const seetQueue = [];
10
- let isProcessing = false;
11
- function initPromise() {
12
- exports.globalPromise = globalPromise = new Promise((resolve) => {
13
- exports.resolvePromise = resolvePromise = (value) => {
14
- seetQueue.push(value);
15
- resolve(value);
16
- };
17
- });
18
- }
19
- async function processSheets(filePath) {
20
- while (seetQueue.length > 0) {
21
- const [styleSheet, option] = seetQueue.shift();
22
- if (!zss_engine_1.isDevelopment && styleSheet)
23
- (0, zss_engine_1.build)(styleSheet, filePath, option);
24
- }
25
- isProcessing = false;
26
- }
27
- async function buildGlobal(filePath) {
28
- if (typeof globalPromise === 'undefined')
29
- initPromise();
30
- if (!isProcessing && seetQueue.length > 0) {
31
- isProcessing = true;
32
- processSheets(filePath);
33
- }
34
- }
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.global = global;
4
- const zss_engine_1 = require("zss-engine");
5
- const global_build_helper_js_1 = require("./global-build-helper.js");
6
- function global(object) {
7
- const base36Hash = (0, zss_engine_1.genBase36Hash)(object, 8);
8
- const { styleSheet } = (0, zss_engine_1.transpiler)(object, undefined, '--global');
9
- if (typeof global_build_helper_js_1.globalPromise === 'undefined')
10
- (0, global_build_helper_js_1.initPromise)();
11
- (0, global_build_helper_js_1.resolvePromise)([styleSheet, '--global']);
12
- if (zss_engine_1.isDevAndTest)
13
- zss_engine_1.isServer
14
- ? (0, zss_engine_1.injectServerCSS)(base36Hash, styleSheet)
15
- : (0, zss_engine_1.injectClientGlobalCSS)(styleSheet, 'global');
16
- }
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.keyframes = void 0;
4
- const zss_engine_1 = require("zss-engine");
5
- const global_js_1 = require("./global.js");
6
- const keyframes = (object) => {
7
- const prefix = (0, zss_engine_1.genBase36Hash)(object, 8);
8
- (0, global_js_1.global)({ [`@keyframes ${prefix}`]: object });
9
- return prefix;
10
- };
11
- exports.keyframes = keyframes;
@@ -1,2 +0,0 @@
1
- export { buildCreate } from './create-build-helper.js';
2
- export { buildGlobal } from './global-build-helper.js';
@@ -1,30 +0,0 @@
1
- import { build, isDevelopment } from 'zss-engine';
2
- let resolvePromise;
3
- let globalPromise;
4
- const sheetQueue = [];
5
- let isProcessing = false;
6
- function initPromise() {
7
- globalPromise = new Promise((resolve) => {
8
- resolvePromise = (value) => {
9
- sheetQueue.push(value);
10
- resolve(value);
11
- };
12
- });
13
- }
14
- async function processQueue(filePath) {
15
- while (sheetQueue.length > 0) {
16
- const styleSheet = sheetQueue.shift();
17
- if (!isDevelopment && styleSheet)
18
- build(styleSheet, filePath);
19
- }
20
- isProcessing = false;
21
- }
22
- export async function buildCreate(filePath) {
23
- if (typeof globalPromise === 'undefined')
24
- initPromise();
25
- if (!isProcessing && sheetQueue.length > 0) {
26
- isProcessing = true;
27
- processQueue(filePath);
28
- }
29
- }
30
- export { resolvePromise, globalPromise, initPromise };
@@ -1,21 +0,0 @@
1
- import { isDevAndTest, transpiler, genBase36Hash, isServer, injectServerCSS, injectClientCSS, } from 'zss-engine';
2
- import { initPromise, globalPromise, resolvePromise, } from './create-build-helper.js';
3
- export function create(object) {
4
- const base36Hash = genBase36Hash(object, 6);
5
- const { styleSheet } = transpiler(object, base36Hash);
6
- const injectCSS = isServer ? injectServerCSS : injectClientCSS;
7
- if (typeof globalPromise === 'undefined')
8
- initPromise();
9
- resolvePromise(styleSheet);
10
- Object.keys(object).forEach((key) => {
11
- Object.defineProperty(object, key, {
12
- get: () => {
13
- const className = key + '_' + base36Hash;
14
- if (isDevAndTest)
15
- injectCSS(base36Hash, styleSheet);
16
- return className;
17
- },
18
- });
19
- });
20
- return Object.freeze(object);
21
- }
@@ -1,25 +0,0 @@
1
- import { global } from './global.js';
2
- export const defineThemeVars = (object) => {
3
- const globalStyles = {};
4
- const result = {};
5
- Object.entries(object).forEach(([key, value]) => {
6
- result[key] = `var(--${key})`;
7
- if (typeof value === 'string') {
8
- (globalStyles[':root'] ||= {})[`--${key}`] = value;
9
- }
10
- else if (typeof value === 'object') {
11
- Object.entries(value).forEach(([subKey, subValue]) => {
12
- if (subKey.startsWith('@media')) {
13
- (globalStyles[':root'] ||= {})[subKey] ||= {};
14
- globalStyles[':root'][subKey][`--${key}`] = subValue;
15
- }
16
- else {
17
- const themeSelector = subKey === 'default' ? ':root' : `:root[data-theme="${subKey}"]`;
18
- (globalStyles[themeSelector] ||= {})[`--${key}`] = subValue;
19
- }
20
- });
21
- }
22
- });
23
- global(globalStyles);
24
- return result;
25
- };
@@ -1,30 +0,0 @@
1
- import { build, isDevelopment } from 'zss-engine';
2
- let resolvePromise;
3
- let globalPromise;
4
- const seetQueue = [];
5
- let isProcessing = false;
6
- function initPromise() {
7
- globalPromise = new Promise((resolve) => {
8
- resolvePromise = (value) => {
9
- seetQueue.push(value);
10
- resolve(value);
11
- };
12
- });
13
- }
14
- async function processSheets(filePath) {
15
- while (seetQueue.length > 0) {
16
- const [styleSheet, option] = seetQueue.shift();
17
- if (!isDevelopment && styleSheet)
18
- build(styleSheet, filePath, option);
19
- }
20
- isProcessing = false;
21
- }
22
- export async function buildGlobal(filePath) {
23
- if (typeof globalPromise === 'undefined')
24
- initPromise();
25
- if (!isProcessing && seetQueue.length > 0) {
26
- isProcessing = true;
27
- processSheets(filePath);
28
- }
29
- }
30
- export { resolvePromise, globalPromise, initPromise };
@@ -1,13 +0,0 @@
1
- import { isDevAndTest, isServer, injectServerCSS, injectClientGlobalCSS, transpiler, genBase36Hash, } from 'zss-engine';
2
- import { resolvePromise, globalPromise, initPromise, } from './global-build-helper.js';
3
- export function global(object) {
4
- const base36Hash = genBase36Hash(object, 8);
5
- const { styleSheet } = transpiler(object, undefined, '--global');
6
- if (typeof globalPromise === 'undefined')
7
- initPromise();
8
- resolvePromise([styleSheet, '--global']);
9
- if (isDevAndTest)
10
- isServer
11
- ? injectServerCSS(base36Hash, styleSheet)
12
- : injectClientGlobalCSS(styleSheet, 'global');
13
- }
@@ -1,7 +0,0 @@
1
- import { genBase36Hash } from 'zss-engine';
2
- import { global } from './global.js';
3
- export const keyframes = (object) => {
4
- const prefix = genBase36Hash(object, 8);
5
- global({ [`@keyframes ${prefix}`]: object });
6
- return prefix;
7
- };
@@ -1,2 +0,0 @@
1
- export { buildCreate } from './create-build-helper.js';
2
- export { buildGlobal } from './global-build-helper.js';
@@ -1,5 +0,0 @@
1
- declare let resolvePromise: (value: string) => void;
2
- declare let globalPromise: Promise<string>;
3
- declare function initPromise(): void;
4
- export declare function buildCreate(filePath: string): Promise<void>;
5
- export { resolvePromise, globalPromise, initPromise };
@@ -1,2 +0,0 @@
1
- import type { ReturnType, CreateStyle, CustomProperties } from 'zss-engine';
2
- export declare function create<T extends Record<string, CustomProperties>>(object: CreateStyle<T>): ReturnType<T>;
@@ -1,2 +0,0 @@
1
- import type { VarsDefinition } from 'zss-engine';
2
- export declare const defineThemeVars: <const T extends VarsDefinition>(object: T) => { [K in keyof T]: `var(--${string & K})`; };
@@ -1,5 +0,0 @@
1
- declare let resolvePromise: (value: [string, string]) => void;
2
- declare let globalPromise: Promise<[string, string]>;
3
- declare function initPromise(): void;
4
- export declare function buildGlobal(filePath: string): Promise<void>;
5
- export { resolvePromise, globalPromise, initPromise };
@@ -1,2 +0,0 @@
1
- import type { CustomHTMLType, VarsDefinition } from 'zss-engine';
2
- export declare function global(object: CustomHTMLType | VarsDefinition): void;
@@ -1,2 +0,0 @@
1
- import { type KeyframesDefinition } from 'zss-engine';
2
- export declare const keyframes: (object: KeyframesDefinition) => string;
File without changes