@plumeria/core 0.14.10 → 0.15.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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @plumeria/core
2
2
 
3
- Plumeria is a JavaScript library for Scalable and optimized styling.
3
+ Plumeria is a JavaScript library for scalable and optimized styling.
4
4
 
5
5
  ## Installation
6
6
 
@@ -10,16 +10,14 @@ To get started with Plumeria, install the core package:
10
10
  npm install @plumeria/core
11
11
  ```
12
12
 
13
- ### Compiler (for static extraction)
13
+ ### Compiler
14
14
 
15
- If you want to extract styles at build time using commands like `npx css`, install:
15
+ Install the `css` command to extract styles at build time:
16
16
 
17
17
  ```sh
18
18
  npm install --save-dev @plumeria/compiler
19
19
  ```
20
20
 
21
- More at: [@plumeria/compiler on npm](https://www.npmjs.com/package/@plumeria/compiler)
22
-
23
21
  ### Stylesheet Import
24
22
 
25
23
  In your app entry point, import the compiled CSS file:
@@ -51,28 +49,31 @@ const styles = css.create({
51
49
  ### css.props()
52
50
 
53
51
  Use `css.props()` to combine multiple styles or switch between them conditionally.
54
- css.props is compiled and style properties to the right take precedence.
55
- The same goes for shorthand and longhand rules.
52
+ css.props is compiled and style properties to the right take precedence.
56
53
 
57
54
  ```jsx
58
55
  <div className={css.props(styles.text, styles.box)} />
59
56
  // className="zxxxxxx1 zxxxxxx2 zxxxxxx3"
60
57
  ```
61
58
 
62
- Supports pseudo/media queries inline:
59
+ Shorthand and longhand property rules follow the same principles as CSS rules.
60
+
61
+ ---
62
+
63
+ It supports media query pseudo-classes and elements in a familiar syntax.
63
64
 
64
65
  ```ts
65
- import { css, ps, media } from '@plumeria/core';
66
+ import { css } from '@plumeria/core';
66
67
 
67
68
  const styles = css.create({
68
69
  box: {
69
- [media.maxWidth(768)]: {
70
+ '@media (max-width: 768px)': {
70
71
  width: '100%',
71
72
  },
72
73
  },
73
74
  text: {
74
75
  color: '#333',
75
- [ps.hover]: {
76
+ ':hover': {
76
77
  color: 'skyblue',
77
78
  opacity: 0.9,
78
79
  },
@@ -82,7 +83,7 @@ const styles = css.create({
82
83
 
83
84
  ## ESLint Support
84
85
 
85
- Use [@plumeria/eslint-plugin](https://www.npmjs.com/package/@plumeria/eslint-plugin) for recommended rules:
86
+ The [@plumeria/eslint-plugin](https://www.npmjs.com/package/@plumeria/eslint-plugin) provides recommended rules:
86
87
 
87
88
  ### Rules: recommended
88
89
 
@@ -94,7 +95,7 @@ Use [@plumeria/eslint-plugin](https://www.npmjs.com/package/@plumeria/eslint-plu
94
95
  - validate-values: warn
95
96
  ```
96
97
 
97
- Plumeria is best used alongside TypeScript for excellent autocomplete and validation support.
98
+ It plugin provides autocomplete and validation support.
98
99
 
99
100
  ## License
100
101
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { CSSHTML, CSSProperties, CreateKeyframes, CreateStyle, CreateStyleType, CreateTheme, CreateValues, Join, ReturnType, ReturnVariableType, RxVariableSet } from "zss-engine";
2
- import { color, container, media, ps } from "zss-utils";
1
+ import { CSSHTML, CSSProperties, CreateKeyframes, CreateStyle, CreateStyleType, CreateTheme, CreateValues, ReturnType, ReturnVariableType, RxVariableSet } from "zss-engine";
3
2
 
4
3
  declare const rx: (className: string, varSet: RxVariableSet) => {
5
4
  className: string;
@@ -8,8 +7,6 @@ declare const rx: (className: string, varSet: RxVariableSet) => {
8
7
  };
9
8
  };
10
9
 
11
- declare const px: <T extends readonly string[]>(...pseudos: T) => Join<T>;
12
-
13
10
  declare class StyleSheet {
14
11
  private constructor();
15
12
  static create<const T extends Record<string, CSSProperties>>(object: CreateStyleType<T>): ReturnType<T>;
@@ -22,4 +19,4 @@ declare class StyleSheet {
22
19
  }
23
20
  declare const css: typeof StyleSheet;
24
21
 
25
- export { CSSHTML, CSSProperties, CreateStyle, color, container, css, media, ps, px, rx };
22
+ export { CSSHTML, CSSProperties, CreateStyle, css, rx };
package/dist/index.js CHANGED
@@ -1,17 +1,7 @@
1
1
  "use strict";
2
2
  const require_css = require('./css.js');
3
- const zss_utils = require_css.__toESM(require("zss-utils"));
4
3
  const zss_engine = require_css.__toESM(require("zss-engine"));
5
4
 
6
- const rx = (className, varSet) => ({
7
- className,
8
- style: Object.fromEntries(Object.entries(varSet).map(([key, value]) => [key, value]))
9
- });
10
-
11
- const px = (...pseudos) => {
12
- return pseudos.filter(Boolean).join("");
13
- };
14
-
15
5
  const styleAtomMap = new WeakMap();
16
6
  function create(object) {
17
7
  const result = {};
@@ -61,7 +51,6 @@ function props(...objects) {
61
51
  const seenSheets = new Set();
62
52
  const allStyleSheets = [];
63
53
  const classList = [];
64
- const injectIfNeeded = zss_engine.isServer ? zss_engine.injectServerCSS : zss_engine.injectClientCSS;
65
54
  const chosen = new Map();
66
55
  const rightmostKeys = [];
67
56
  const orderedKeys = [];
@@ -107,24 +96,23 @@ function props(...objects) {
107
96
  uniqueStyleSheets.forEach((sheet) => injectedStyleSheets.add(sheet));
108
97
  if (typeof require_css.globalPromise_1 === "undefined") require_css.initPromise_1();
109
98
  require_css.resolvePromise_1(uniqueStyleSheets.join(""));
110
- if (zss_engine.isTestingDevelopment) {
111
- for (const { hash, sheet } of [...orderedKeys, ...rightmostKeys]) if (uniqueStyleSheets.includes(sheet)) injectIfNeeded(hash, sheet);
99
+ if (zss_engine.isTestingDevelopment && !zss_engine.isServer) {
100
+ for (const { hash, sheet } of [...orderedKeys, ...rightmostKeys]) if (uniqueStyleSheets.includes(sheet)) (0, zss_engine.injectClientCSS)(hash, sheet);
112
101
  }
113
102
  return classList.join(" ");
114
103
  }
115
104
 
116
105
  function global(object) {
117
- const base36Hash = (0, zss_engine.genBase36Hash)(object, 1, 8);
118
106
  const { styleSheet } = (0, zss_engine.transpile)(object, void 0, "--global");
119
107
  if (typeof require_css.globalPromise_2 === "undefined") require_css.initPromise_2();
120
108
  require_css.resolvePromise_2(styleSheet);
121
- if (zss_engine.isTestingDevelopment) zss_engine.isServer ? (0, zss_engine.injectServerCSS)(base36Hash, styleSheet) : (0, zss_engine.injectClientGlobalCSS)(styleSheet);
109
+ if (zss_engine.isTestingDevelopment && !zss_engine.isServer) (0, zss_engine.injectClientGlobalCSS)(styleSheet);
122
110
  }
123
111
 
124
112
  const keyframes = (object) => {
125
- const prefix = (0, zss_engine.genBase36Hash)(object, 1, 8);
126
- global({ [`@keyframes ${prefix}`]: object });
127
- return prefix;
113
+ const hash = (0, zss_engine.genBase36Hash)(object, 1, 8);
114
+ global({ [`@keyframes ${hash}`]: object });
115
+ return hash;
128
116
  };
129
117
 
130
118
  const defineVars = (object) => {
@@ -165,6 +153,11 @@ const defineConsts = (constants) => {
165
153
  return constants;
166
154
  };
167
155
 
156
+ const rx = (className, varSet) => ({
157
+ className,
158
+ style: Object.fromEntries(Object.entries(varSet).map(([key, value]) => [key, value]))
159
+ });
160
+
168
161
  var StyleSheet = class {
169
162
  constructor() {}
170
163
  static create(object) {
@@ -191,30 +184,5 @@ var StyleSheet = class {
191
184
  };
192
185
  const css = StyleSheet;
193
186
 
194
- Object.defineProperty(exports, 'color', {
195
- enumerable: true,
196
- get: function () {
197
- return zss_utils.color;
198
- }
199
- });
200
- Object.defineProperty(exports, 'container', {
201
- enumerable: true,
202
- get: function () {
203
- return zss_utils.container;
204
- }
205
- });
206
187
  exports.css = css;
207
- Object.defineProperty(exports, 'media', {
208
- enumerable: true,
209
- get: function () {
210
- return zss_utils.media;
211
- }
212
- });
213
- Object.defineProperty(exports, 'ps', {
214
- enumerable: true,
215
- get: function () {
216
- return zss_utils.ps;
217
- }
218
- });
219
- exports.px = px;
220
188
  exports.rx = rx;
package/dist/index.mjs CHANGED
@@ -1,15 +1,5 @@
1
1
  import { globalPromise_1, globalPromise_2, initPromise_1, initPromise_2, resolvePromise_1, resolvePromise_2 } from "./css.mjs";
2
- import { color, container, media, ps } from "zss-utils";
3
- import { camelToKebabCase, genBase36Hash, injectClientCSS, injectClientGlobalCSS, injectServerCSS, isServer, isTestingDevelopment, processAtomicProps, splitAtomicAndNested, transpile } from "zss-engine";
4
-
5
- const rx = (className, varSet) => ({
6
- className,
7
- style: Object.fromEntries(Object.entries(varSet).map(([key, value]) => [key, value]))
8
- });
9
-
10
- const px = (...pseudos) => {
11
- return pseudos.filter(Boolean).join("");
12
- };
2
+ import { camelToKebabCase, genBase36Hash, injectClientCSS, injectClientGlobalCSS, isServer, isTestingDevelopment, processAtomicProps, splitAtomicAndNested, transpile } from "zss-engine";
13
3
 
14
4
  const styleAtomMap = new WeakMap();
15
5
  function create(object) {
@@ -60,7 +50,6 @@ function props(...objects) {
60
50
  const seenSheets = new Set();
61
51
  const allStyleSheets = [];
62
52
  const classList = [];
63
- const injectIfNeeded = isServer ? injectServerCSS : injectClientCSS;
64
53
  const chosen = new Map();
65
54
  const rightmostKeys = [];
66
55
  const orderedKeys = [];
@@ -106,24 +95,23 @@ function props(...objects) {
106
95
  uniqueStyleSheets.forEach((sheet) => injectedStyleSheets.add(sheet));
107
96
  if (typeof globalPromise_1 === "undefined") initPromise_1();
108
97
  resolvePromise_1(uniqueStyleSheets.join(""));
109
- if (isTestingDevelopment) {
110
- for (const { hash, sheet } of [...orderedKeys, ...rightmostKeys]) if (uniqueStyleSheets.includes(sheet)) injectIfNeeded(hash, sheet);
98
+ if (isTestingDevelopment && !isServer) {
99
+ for (const { hash, sheet } of [...orderedKeys, ...rightmostKeys]) if (uniqueStyleSheets.includes(sheet)) injectClientCSS(hash, sheet);
111
100
  }
112
101
  return classList.join(" ");
113
102
  }
114
103
 
115
104
  function global(object) {
116
- const base36Hash = genBase36Hash(object, 1, 8);
117
105
  const { styleSheet } = transpile(object, void 0, "--global");
118
106
  if (typeof globalPromise_2 === "undefined") initPromise_2();
119
107
  resolvePromise_2(styleSheet);
120
- if (isTestingDevelopment) isServer ? injectServerCSS(base36Hash, styleSheet) : injectClientGlobalCSS(styleSheet);
108
+ if (isTestingDevelopment && !isServer) injectClientGlobalCSS(styleSheet);
121
109
  }
122
110
 
123
111
  const keyframes = (object) => {
124
- const prefix = genBase36Hash(object, 1, 8);
125
- global({ [`@keyframes ${prefix}`]: object });
126
- return prefix;
112
+ const hash = genBase36Hash(object, 1, 8);
113
+ global({ [`@keyframes ${hash}`]: object });
114
+ return hash;
127
115
  };
128
116
 
129
117
  const defineVars = (object) => {
@@ -164,6 +152,11 @@ const defineConsts = (constants) => {
164
152
  return constants;
165
153
  };
166
154
 
155
+ const rx = (className, varSet) => ({
156
+ className,
157
+ style: Object.fromEntries(Object.entries(varSet).map(([key, value]) => [key, value]))
158
+ });
159
+
167
160
  var StyleSheet = class {
168
161
  constructor() {}
169
162
  static create(object) {
@@ -190,4 +183,4 @@ var StyleSheet = class {
190
183
  };
191
184
  const css = StyleSheet;
192
185
 
193
- export { color, container, css, media, ps, px, rx };
186
+ export { css, rx };
package/package.json CHANGED
@@ -1,15 +1,7 @@
1
1
  {
2
2
  "name": "@plumeria/core",
3
- "version": "0.14.10",
4
- "description": "A library for Scalable and optimized styling",
5
- "keywords": [
6
- "css",
7
- "css-in-js",
8
- "plumeria",
9
- "react",
10
- "next",
11
- "vite"
12
- ],
3
+ "version": "0.15.1",
4
+ "description": "A library for scalable and optimized styling",
13
5
  "repository": {
14
6
  "type": "git",
15
7
  "url": "git+https://github.com/zss-in-js/plumeria.git",
@@ -39,8 +31,7 @@
39
31
  "stylesheet.css"
40
32
  ],
41
33
  "dependencies": {
42
- "zss-engine": "0.2.72",
43
- "zss-utils": "0.2.4"
34
+ "zss-engine": "0.2.75"
44
35
  },
45
36
  "publishConfig": {
46
37
  "access": "public"