@plumeria/core 0.8.12 → 0.8.13

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 (38) hide show
  1. package/README.md +13 -29
  2. package/dist/cjs/css.js +27 -0
  3. package/dist/cjs/cx.js +23 -0
  4. package/dist/cjs/index.js +6 -22
  5. package/dist/cjs/methods/build-helper.js +7 -0
  6. package/dist/cjs/methods/create-build-helper.js +34 -0
  7. package/dist/cjs/methods/create.js +24 -0
  8. package/dist/cjs/methods/define-theme-vars.js +29 -0
  9. package/dist/cjs/methods/global-build-helper.js +34 -0
  10. package/dist/cjs/methods/global.js +16 -0
  11. package/dist/cjs/methods/keyframes.js +11 -0
  12. package/dist/cjs/rx.js +8 -0
  13. package/dist/esm/css.js +23 -0
  14. package/dist/esm/cx.js +19 -0
  15. package/dist/esm/index.js +3 -20
  16. package/dist/esm/methods/build-helper.js +2 -0
  17. package/dist/esm/methods/create-build-helper.js +30 -0
  18. package/dist/esm/methods/create.js +21 -0
  19. package/dist/esm/methods/define-theme-vars.js +25 -0
  20. package/dist/esm/methods/global-build-helper.js +30 -0
  21. package/dist/esm/methods/global.js +13 -0
  22. package/dist/esm/methods/keyframes.js +7 -0
  23. package/dist/esm/rx.js +4 -0
  24. package/package.json +8 -7
  25. package/types/css.d.ts +120 -0
  26. package/types/cx.d.ts +1 -0
  27. package/types/index.d.ts +3 -132
  28. package/types/methods/build-helper.d.ts +2 -0
  29. package/types/methods/create-build-helper.d.ts +5 -0
  30. package/types/methods/create.d.ts +2 -0
  31. package/types/methods/define-theme-vars.d.ts +2 -0
  32. package/types/methods/global-build-helper.d.ts +5 -0
  33. package/types/methods/global.d.ts +2 -0
  34. package/types/methods/keyframes.d.ts +2 -0
  35. package/types/rx.d.ts +8 -0
  36. package/dist/cjs/build-helper.js +0 -6
  37. package/dist/esm/build-helper.js +0 -1
  38. package/types/build-helper.d.ts +0 -1
package/README.md CHANGED
@@ -99,7 +99,7 @@ css.global({
99
99
 
100
100
  ### cx
101
101
 
102
- Merges strings such as class names and pseudos.
102
+ Merges strings such as class names and pseudo.
103
103
 
104
104
  ```tsx
105
105
  const styles = css.create({
@@ -140,8 +140,8 @@ Define data-theme and regular variables as objects.
140
140
  A default compile to :root, and the rest as a string compile to data-theme, You can also use media and container here.
141
141
 
142
142
  ```ts
143
- const preset = css.defineThemeVars({
144
- normal: 'white',
143
+ const tokens = css.defineThemeVars({
144
+ white: 'white',
145
145
  text_primary: {
146
146
  default: 'rgb(60,60,60)',
147
147
  light: 'black',
@@ -165,35 +165,19 @@ color: css.colors.darken('skyblue', 0.12),
165
165
  color: css.colors.lighten('navy', 0.6),
166
166
  ```
167
167
 
168
- ## Linter
168
+ ## ESLint
169
169
 
170
- [eslint-plugin-zss-lint](https://www.npmjs.com/package/eslint-plugin-zss-lint) is a linter built for CSS-in-JS libraries built with zss-engine.
170
+ [@plumeria/eslint-plugin](https://www.npmjs.com/package/@plumeria/eslint-plugin)
171
171
 
172
- Rules:
173
- \- sort-properties
174
- \- validate-values
175
- \- no-unused-keys
172
+ ### Rules: recommended
176
173
 
177
- Type safety relies on this eslint-plugin. It includes all properties, excluding deprecated and experimental.
174
+ \- no-inner-call:(error)
175
+ \- no-unused-keys:(warn)
176
+ \- sort-properties:(warn)
177
+ \- validate-values:(warn)
178
178
 
179
- ## How Plumeria works
179
+ It is recommended to use it in conjunction with TypeScript completion, which is one of the big advantages of using plumeria.
180
180
 
181
- Plumeria complies with Semantic HTML, which means that it uses one style for each class name.
181
+ ## License
182
182
 
183
- ```ts
184
- import { css } from '@plumeria/core';
185
-
186
- const styles = css.create({
187
- box: {
188
- width: '100%',
189
- color: 'rgb(60,60,60)',
190
- },
191
- text: {
192
- color: 'yellow',
193
- },
194
- });
195
- ```
196
-
197
- This is necessary to preserve the CSS syntax and the concept of keeping track of classes.
198
- In this code, box and text are converted to class names with a prefix that makes the object a hash: .box_ybg34i .text_ybg34i
199
- These classes are designed to be used in CSS syntax.
183
+ plumeria is [MIT licensed](https://github.com/refirst11/rscute/blob/main/LICENSE).
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.css = void 0;
4
+ 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");
9
+ class css {
10
+ static create(object) {
11
+ return (0, create_1.create)(object);
12
+ }
13
+ static global(object) {
14
+ return (0, global_1.global)(object);
15
+ }
16
+ static defineThemeVars(object) {
17
+ return (0, define_theme_vars_1.defineThemeVars)(object);
18
+ }
19
+ static keyframes(object) {
20
+ return (0, keyframes_1.keyframes)(object);
21
+ }
22
+ static media = zss_utils_1.media;
23
+ static container = zss_utils_1.container;
24
+ static pseudo = zss_utils_1.pseudo;
25
+ static color = zss_utils_1.color;
26
+ }
27
+ exports.css = css;
package/dist/cjs/cx.js ADDED
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cx = void 0;
4
+ const cx = (...strings) => {
5
+ let result = '';
6
+ let isFirst = true;
7
+ strings.filter(Boolean).forEach((str) => {
8
+ if (str?.toString().startsWith(':')) {
9
+ result += str.toString();
10
+ }
11
+ else if (typeof str === 'string') {
12
+ if (isFirst) {
13
+ result += str;
14
+ isFirst = false;
15
+ }
16
+ else {
17
+ result += ` ${str}`;
18
+ }
19
+ }
20
+ });
21
+ return result;
22
+ };
23
+ exports.cx = cx;
package/dist/cjs/index.js CHANGED
@@ -1,25 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.rx = exports.cx = exports.css = void 0;
4
- const zss_utils_1 = require("zss-utils");
5
- Object.defineProperty(exports, "cx", { enumerable: true, get: function () { return zss_utils_1.cx; } });
6
- Object.defineProperty(exports, "rx", { enumerable: true, get: function () { return zss_utils_1.rx; } });
7
- class css {
8
- static create(object) {
9
- return (0, zss_utils_1.create)(object);
10
- }
11
- static global(object) {
12
- return (0, zss_utils_1.global)(object);
13
- }
14
- static defineThemeVars(object) {
15
- return (0, zss_utils_1.defineThemeVars)(object);
16
- }
17
- static keyframes(object) {
18
- return (0, zss_utils_1.keyframes)(object);
19
- }
20
- static media = zss_utils_1.media;
21
- static pseudo = zss_utils_1.pseudo;
22
- static colors = zss_utils_1.colors;
23
- static container = zss_utils_1.container;
24
- }
25
- exports.css = css;
4
+ var css_1 = require("./css");
5
+ Object.defineProperty(exports, "css", { enumerable: true, get: function () { return css_1.css; } });
6
+ var cx_1 = require("./cx");
7
+ Object.defineProperty(exports, "cx", { enumerable: true, get: function () { return cx_1.cx; } });
8
+ var rx_1 = require("./rx");
9
+ Object.defineProperty(exports, "rx", { enumerable: true, get: function () { return rx_1.rx; } });
@@ -0,0 +1,7 @@
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; } });
@@ -0,0 +1,34 @@
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
+ }
@@ -0,0 +1,24 @@
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
+ }
@@ -0,0 +1,29 @@
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;
@@ -0,0 +1,34 @@
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
+ }
@@ -0,0 +1,16 @@
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
+ }
@@ -0,0 +1,11 @@
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;
package/dist/cjs/rx.js ADDED
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.rx = void 0;
4
+ const rx = (className, varSet) => ({
5
+ className,
6
+ style: Object.fromEntries(Object.entries(varSet).map(([key, value]) => [key, value])),
7
+ });
8
+ exports.rx = rx;
@@ -0,0 +1,23 @@
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 {
7
+ static create(object) {
8
+ return create(object);
9
+ }
10
+ static global(object) {
11
+ return global(object);
12
+ }
13
+ static defineThemeVars(object) {
14
+ return defineThemeVars(object);
15
+ }
16
+ static keyframes(object) {
17
+ return keyframes(object);
18
+ }
19
+ static media = media;
20
+ static container = container;
21
+ static pseudo = pseudo;
22
+ static color = color;
23
+ }
package/dist/esm/cx.js ADDED
@@ -0,0 +1,19 @@
1
+ export const cx = (...strings) => {
2
+ let result = '';
3
+ let isFirst = true;
4
+ strings.filter(Boolean).forEach((str) => {
5
+ if (str?.toString().startsWith(':')) {
6
+ result += str.toString();
7
+ }
8
+ else if (typeof str === 'string') {
9
+ if (isFirst) {
10
+ result += str;
11
+ isFirst = false;
12
+ }
13
+ else {
14
+ result += ` ${str}`;
15
+ }
16
+ }
17
+ });
18
+ return result;
19
+ };
package/dist/esm/index.js CHANGED
@@ -1,20 +1,3 @@
1
- import { create, global, keyframes, defineThemeVars, media, pseudo, colors, container, cx, rx, } from 'zss-utils';
2
- class css {
3
- static create(object) {
4
- return create(object);
5
- }
6
- static global(object) {
7
- return global(object);
8
- }
9
- static defineThemeVars(object) {
10
- return defineThemeVars(object);
11
- }
12
- static keyframes(object) {
13
- return keyframes(object);
14
- }
15
- static media = media;
16
- static pseudo = pseudo;
17
- static colors = colors;
18
- static container = container;
19
- }
20
- export { css, cx, rx };
1
+ export { css } from './css';
2
+ export { cx } from './cx';
3
+ export { rx } from './rx';
@@ -0,0 +1,2 @@
1
+ export { buildCreate } from './create-build-helper.js';
2
+ export { buildGlobal } from './global-build-helper.js';
@@ -0,0 +1,30 @@
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 };
@@ -0,0 +1,21 @@
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
+ }
@@ -0,0 +1,25 @@
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
+ };
@@ -0,0 +1,30 @@
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 };
@@ -0,0 +1,13 @@
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
+ }
@@ -0,0 +1,7 @@
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
+ };
package/dist/esm/rx.js ADDED
@@ -0,0 +1,4 @@
1
+ export const rx = (className, varSet) => ({
2
+ className,
3
+ style: Object.fromEntries(Object.entries(varSet).map(([key, value]) => [key, value])),
4
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/core",
3
- "version": "0.8.12",
3
+ "version": "0.8.13",
4
4
  "description": "Near Zero-runtime CSS-in-JS for efficient design systems.",
5
5
  "keywords": [
6
6
  "css",
@@ -20,15 +20,15 @@
20
20
  "exports": {
21
21
  "./package.json": "./package.json",
22
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
+ },
23
28
  ".": {
24
29
  "types": "./types/index.d.ts",
25
30
  "import": "./dist/esm/index.js",
26
31
  "default": "./dist/cjs/index.js"
27
- },
28
- "./build-helper": {
29
- "types": "./types/build-helper.d.ts",
30
- "import": "./dist/esm/build-helper.js",
31
- "default": "./dist/cjs/build-helper.js"
32
32
  }
33
33
  },
34
34
  "main": "dist/cjs/index.js",
@@ -40,7 +40,8 @@
40
40
  "stylesheet/"
41
41
  ],
42
42
  "dependencies": {
43
- "zss-utils": "0.1.1"
43
+ "zss-engine": "^0.2.27",
44
+ "zss-utils": "0.2.0"
44
45
  },
45
46
  "publishConfig": {
46
47
  "access": "public"
package/types/css.d.ts ADDED
@@ -0,0 +1,120 @@
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;
7
+ 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
+ };
15
+ };
16
+ static container: {
17
+ range: (range: string) => "@container ()";
18
+ max: (str: string) => "@container (max-)";
19
+ min: (str: string) => "@container (min-)";
20
+ };
21
+ static pseudo: {
22
+ 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()";
44
+ };
45
+ active: ":active";
46
+ anyLink: ":any-link";
47
+ autoFill: ":autofill";
48
+ buffering: ":buffering";
49
+ checked: ":checked";
50
+ default: ":default";
51
+ defined: ":defined";
52
+ disabled: ":disabled";
53
+ empty: ":empty";
54
+ enabled: ":enabled";
55
+ first: ":first";
56
+ firstChild: ":first-child";
57
+ firstOfType: ":first-of-type";
58
+ focus: ":focus";
59
+ focusVisible: ":focus-visible";
60
+ focusWithin: ":focus-within";
61
+ fullscreen: ":fullscreen";
62
+ future: ":future";
63
+ hasSlotted: ":has-slotted";
64
+ host: ":host";
65
+ hover: ":hover";
66
+ inRange: ":in-range";
67
+ indeterminate: ":indeterminate";
68
+ invalid: ":invalid";
69
+ lastChild: ":last-child";
70
+ lastOfType: ":last-of-type";
71
+ left: ":left";
72
+ link: ":link";
73
+ modal: ":modal";
74
+ muted: ":muted";
75
+ onlyChild: ":only-child";
76
+ onlyOfType: ":only-of-type";
77
+ open: ":open";
78
+ optional: ":optional";
79
+ outOfRange: ":out-of-range";
80
+ past: ":past";
81
+ paused: ":paused";
82
+ pictureInPicture: ":picture-in-picture";
83
+ placeholderShown: ":placeholder-shown";
84
+ playing: ":playing";
85
+ popoverOpen: ":popover-open";
86
+ readOnly: ":read-only";
87
+ readWrite: ":read-write";
88
+ required: ":required";
89
+ right: ":right";
90
+ root: "root";
91
+ scope: ":scope";
92
+ seeking: ":seeking";
93
+ stalled: ":stalled";
94
+ target: ":target";
95
+ userInvalid: ":user-invalid";
96
+ userValid: ":user-valid";
97
+ valid: ":valid";
98
+ visited: ":visited";
99
+ volumeLocked: ":volume-locked";
100
+ after: "::after";
101
+ backdrop: "::backdrop";
102
+ before: "::before";
103
+ cue: "::cue";
104
+ detailsContent: "::details-content";
105
+ firstSelectorButton: "::first-selector-button";
106
+ firstLetter: "::first-letter";
107
+ firstLine: "::first-line";
108
+ grammarError: "::grammar-error";
109
+ marker: "::marker";
110
+ placeholder: "::placeholder";
111
+ selection: "::selection";
112
+ spellingError: "::spellingError";
113
+ targetText: "::target-text";
114
+ viewTransition: "::view-transition";
115
+ };
116
+ static color: {
117
+ lighten: (color: string, amount: string | number) => string;
118
+ darken: (color: string, amount: string | number) => string;
119
+ };
120
+ }
package/types/cx.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const cx: (...strings: Array<string | null | undefined | false>) => string & ":";
package/types/index.d.ts CHANGED
@@ -1,132 +1,3 @@
1
- import type { CreateStyle, CustomHTMLType, CustomProperties, KeyframesDefinition, ReturnType, VarsDefinition } from 'zss-utils';
2
- import { cx, rx } from 'zss-utils';
3
- declare class css {
4
- static create<T extends Record<string, CustomProperties>>(object: CreateStyle<T>): ReturnType<T>;
5
- static global(object: CustomHTMLType): void;
6
- static defineThemeVars<const T extends VarsDefinition>(object: T): { [K in keyof T]: `var(--${string & K})`; };
7
- static keyframes(object: KeyframesDefinition): string;
8
- static media: {
9
- readonly min_sm: "@media (min-width: 640px)";
10
- readonly min_md: "@media (min-width: 768px)";
11
- readonly min_lg: "@media (min-width: 1024px)";
12
- readonly min_xl: "@media (min-width: 1280px)";
13
- readonly min_2xl: "@media (min-width: 1536px)";
14
- readonly max_sm: "@media (max-width: 640px)";
15
- readonly max_md: "@media (max-width: 768px)";
16
- readonly max_lg: "@media (max-width: 1024px)";
17
- readonly max_xl: "@media (max-width: 1280px)";
18
- readonly max_2xl: "@media (max-width: 1536px)";
19
- readonly range: (range: string) => "@media ()";
20
- readonly max: (str: string) => "@media (max-)";
21
- readonly min: (str: string) => "@media (min-)";
22
- readonly scheme: {
23
- readonly dark: "@media (prefers-color-scheme: dark)";
24
- readonly light: "@media (prefers-color-scheme: light)";
25
- };
26
- };
27
- static pseudo: {
28
- readonly active: ":active";
29
- readonly anyLink: ":any-link";
30
- readonly autoFill: ":autofill";
31
- readonly buffering: ":buffering";
32
- readonly checked: ":checked";
33
- readonly default: ":default";
34
- readonly defined: ":defined";
35
- readonly disabled: ":disabled";
36
- readonly empty: ":empty";
37
- readonly enabled: ":enabled";
38
- readonly first: ":first";
39
- readonly firstChild: ":first-child";
40
- readonly firstOfType: ":first-of-type";
41
- readonly focus: ":focus";
42
- readonly focusVisible: ":focus-visible";
43
- readonly focusWithin: ":focus-within";
44
- readonly fullscreen: ":fullscreen";
45
- readonly future: ":future";
46
- readonly hasSlotted: ":has-slotted";
47
- readonly host: ":host";
48
- readonly hover: ":hover";
49
- readonly inRange: ":in-range";
50
- readonly indeterminate: ":indeterminate";
51
- readonly invalid: ":invalid";
52
- readonly lastChild: ":last-child";
53
- readonly lastOfType: ":last-of-type";
54
- readonly left: ":left";
55
- readonly link: ":link";
56
- readonly modal: ":modal";
57
- readonly muted: ":muted";
58
- readonly onlyChild: ":only-child";
59
- readonly onlyOfType: ":only-of-type";
60
- readonly open: ":open";
61
- readonly optional: ":optional";
62
- readonly outOfRange: ":out-of-range";
63
- readonly past: ":past";
64
- readonly paused: ":paused";
65
- readonly pictureInPicture: ":picture-in-picture";
66
- readonly placeholderShown: ":placeholder-shown";
67
- readonly playing: ":playing";
68
- readonly popoverOpen: ":popover-open";
69
- readonly readOnly: ":read-only";
70
- readonly readWrite: ":read-write";
71
- readonly required: ":required";
72
- readonly right: ":right";
73
- readonly root: "root";
74
- readonly scope: ":scope";
75
- readonly seeking: ":seeking";
76
- readonly stalled: ":stalled";
77
- readonly target: ":target";
78
- readonly userInvalid: ":user-invalid";
79
- readonly userValid: ":user-valid";
80
- readonly valid: ":valid";
81
- readonly visited: ":visited";
82
- readonly volumeLocked: ":volume-locked";
83
- readonly after: "::after";
84
- readonly backdrop: "::backdrop";
85
- readonly before: "::before";
86
- readonly cue: "::cue";
87
- readonly detailsContent: "::details-content";
88
- readonly firstSelectorButton: "::first-selector-button";
89
- readonly firstLetter: "::first-letter";
90
- readonly firstLine: "::first-line";
91
- readonly grammarError: "::grammar-error";
92
- readonly marker: "::marker";
93
- readonly placeholder: "::placeholder";
94
- readonly selection: "::selection";
95
- readonly spellingError: "::spellingError";
96
- readonly targetText: "::target-text";
97
- readonly viewTransition: "::view-transition";
98
- readonly fn: {
99
- readonly cue: (str: string) => "::cue()";
100
- readonly dir: (str: string) => ":dir()";
101
- readonly has: (str: string) => ":has()";
102
- readonly host: (str: string) => ":host()";
103
- readonly hostContext: (str: string) => ":host-context()";
104
- readonly is: (str: string) => ":is()";
105
- readonly lang: (str: string) => ":lang()";
106
- readonly nthChild: (str: string) => ":nth-child()";
107
- readonly nthLastChild: (str: string) => ":nth-last-child()";
108
- readonly nthLastOfType: (str: string) => ":nth-last-of-type()";
109
- readonly nthOfType: (str: string) => ":nth-of-type()";
110
- readonly not: (str: string) => ":not()";
111
- readonly state: (str: string) => ":state()";
112
- readonly where: (str: string) => ":where()";
113
- readonly highlight: (str: string) => "::highlight()";
114
- readonly part: (str: string) => "::part()";
115
- readonly slotted: (str: string) => "::slotted()";
116
- readonly viewTransitionImagePair: (str: string) => "::view-transition-image-pair()";
117
- readonly viewTransitionGroup: (str: string) => "::view-transition-group()";
118
- readonly viewTransitionOld: (str: string) => "::view-transition-old()";
119
- readonly viewTransitionNew: (str: string) => "::view-transition-new()";
120
- };
121
- };
122
- static colors: {
123
- lighten: (color: string, amount: string | number) => string;
124
- darken: (color: string, amount: string | number) => string;
125
- };
126
- static container: {
127
- range: (range: string) => "@container ()";
128
- max: (str: string) => "@container (max-)";
129
- min: (str: string) => "@container (min-)";
130
- };
131
- }
132
- export { css, cx, rx };
1
+ export { css } from './css';
2
+ export { cx } from './cx';
3
+ export { rx } from './rx';
@@ -0,0 +1,2 @@
1
+ export { buildCreate } from './create-build-helper.js';
2
+ export { buildGlobal } from './global-build-helper.js';
@@ -0,0 +1,5 @@
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 };
@@ -0,0 +1,2 @@
1
+ import type { ReturnType, CreateStyle, CustomProperties } from 'zss-engine';
2
+ export declare function create<T extends Record<string, CustomProperties>>(object: CreateStyle<T>): ReturnType<T>;
@@ -0,0 +1,2 @@
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})`; };
@@ -0,0 +1,5 @@
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 };
@@ -0,0 +1,2 @@
1
+ import type { CustomHTMLType, VarsDefinition } from 'zss-engine';
2
+ export declare function global(object: CustomHTMLType | VarsDefinition): void;
@@ -0,0 +1,2 @@
1
+ import { type KeyframesDefinition } from 'zss-engine';
2
+ export declare const keyframes: (object: KeyframesDefinition) => string;
package/types/rx.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ export declare const rx: (className: string, varSet: {
2
+ [key: `--${string}`]: string;
3
+ }) => {
4
+ className: string;
5
+ style: {
6
+ [k: string]: string;
7
+ };
8
+ };
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildGlobal = exports.buildCreate = void 0;
4
- var zss_utils_1 = require("zss-utils");
5
- Object.defineProperty(exports, "buildCreate", { enumerable: true, get: function () { return zss_utils_1.buildCreate; } });
6
- Object.defineProperty(exports, "buildGlobal", { enumerable: true, get: function () { return zss_utils_1.buildGlobal; } });
@@ -1 +0,0 @@
1
- export { buildCreate, buildGlobal } from 'zss-utils';
@@ -1 +0,0 @@
1
- export { buildCreate, buildGlobal } from 'zss-utils';