@plumeria/core 0.8.0-beta.2 → 0.8.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/dist/cjs/css.js CHANGED
@@ -2,34 +2,24 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.rx = exports.cx = exports.css = void 0;
4
4
  const zss_utils_1 = require("zss-utils");
5
- const zss_utils_2 = require("zss-utils");
6
- const zss_utils_3 = require("zss-utils");
7
- const zss_utils_4 = require("zss-utils");
8
- const zss_utils_5 = require("zss-utils");
9
- Object.defineProperty(exports, "cx", { enumerable: true, get: function () { return zss_utils_5.cx; } });
10
- Object.defineProperty(exports, "rx", { enumerable: true, get: function () { return zss_utils_5.rx; } });
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; } });
11
7
  class css {
12
8
  static create(object) {
13
9
  return (0, zss_utils_1.create)(object);
14
10
  }
15
- static global = ((called = false) => {
16
- return (object) => {
17
- if (called) {
18
- throw new Error('css.global() must be one');
19
- }
20
- called = true;
21
- return (0, zss_utils_2.global)(object);
22
- };
23
- })();
11
+ static global(object) {
12
+ return (0, zss_utils_1.global)(object);
13
+ }
24
14
  static defineThemeVars(object) {
25
- return (0, zss_utils_3.defineThemeVars)(object);
15
+ return (0, zss_utils_1.defineThemeVars)(object);
26
16
  }
27
17
  static keyframes(object) {
28
- return (0, zss_utils_4.keyframes)(object);
18
+ return (0, zss_utils_1.keyframes)(object);
29
19
  }
30
- static media = zss_utils_5.media;
31
- static pseudo = zss_utils_5.pseudo;
32
- static colors = zss_utils_5.colors;
33
- static container = zss_utils_5.container;
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;
34
24
  }
35
25
  exports.css = css;
package/dist/esm/css.js CHANGED
@@ -1,21 +1,11 @@
1
- import { create } from 'zss-utils';
2
- import { global } from 'zss-utils';
3
- import { defineThemeVars } from 'zss-utils';
4
- import { keyframes } from 'zss-utils';
5
- import { media, pseudo, colors, container, cx, rx } from 'zss-utils';
1
+ import { create, global, keyframes, defineThemeVars, media, pseudo, colors, container, cx, rx, } from 'zss-utils';
6
2
  class css {
7
3
  static create(object) {
8
4
  return create(object);
9
5
  }
10
- static global = ((called = false) => {
11
- return (object) => {
12
- if (called) {
13
- throw new Error('css.global() must be one');
14
- }
15
- called = true;
16
- return global(object);
17
- };
18
- })();
6
+ static global(object) {
7
+ return global(object);
8
+ }
19
9
  static defineThemeVars(object) {
20
10
  return defineThemeVars(object);
21
11
  }
package/package.json CHANGED
@@ -1,30 +1,34 @@
1
1
  {
2
2
  "name": "@plumeria/core",
3
- "version": "0.8.0-beta.2",
4
- "description": "Near Zero-runtime CSS-in-JS for efficient design systems.",
3
+ "version": "0.8.1",
4
+ "description": "Zero-runtime StyleSheet for speedy development cycle",
5
5
  "keywords": [
6
6
  "css",
7
7
  "css-in-js",
8
8
  "plumeria",
9
9
  "react",
10
- "vite",
11
- "next"
10
+ "next",
11
+ "vite"
12
12
  ],
13
- "repository": "github:zss-in-js/plumeria",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/zss-in-js/plumeria.git",
16
+ "directory": "packages/core"
17
+ },
14
18
  "license": "MIT",
15
19
  "sideEffects": false,
16
20
  "exports": {
17
21
  "./package.json": "./package.json",
18
22
  "./stylesheet": "./stylesheet/core.css",
19
- "./build-helper": {
20
- "import": "./dist/esm/build-helper.js",
21
- "require": "./dist/cjs/build-helper.js",
22
- "types": "./types/build-helper.d.ts"
23
- },
24
23
  ".": {
25
24
  "types": "./types/index.d.ts",
26
25
  "import": "./dist/esm/index.js",
27
26
  "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"
28
32
  }
29
33
  },
30
34
  "main": "dist/cjs/index.js",
@@ -44,7 +48,7 @@
44
48
  "zss-utils": "0.0.8"
45
49
  },
46
50
  "peerDependencies": {
47
- "@plumeria/compiler": ">=0.7.7"
51
+ "@plumeria/compiler": ">=0.8.2"
48
52
  },
49
53
  "publishConfig": {
50
54
  "access": "public"
package/readme.md CHANGED
@@ -1,35 +1,34 @@
1
- # @plumeria/core
1
+ # 💐 Plumeria
2
2
 
3
- Plumeria is a CSS-in-JS built using [**zss-engine**](https://www.npmjs.com/package/zss-engine) and [**zss-utils**](https://www.npmjs.com/package/zss-utils) that provides a speedy development cycle.
3
+ Plumeria is a CSS-in-JS built with [**zss-utils**](https://www.npmjs.com/package/zss-utils) that provides a speedy development cycle.
4
4
 
5
5
  ## Installation
6
6
 
7
7
  To start using Plumeria, install the following two packages:
8
8
 
9
9
  ```sh
10
- npm install --save @plumeria/core
10
+ npm install @plumeria/core
11
11
  ```
12
12
 
13
13
  ### Compiler
14
14
 
15
- To compile `@plumeria/core`, for example, to use `npx css`, install
16
- [`@plumeria/compiler`](https://www.npmjs.com/package/@plumeria/compiler) for static extraction through the Command Line.
17
- Also, it can be easily integrated into the build process.
18
-
19
- The compiler is built using [**SWC**](https://swc.rs/) and performs high-speed transpilation in memory.
15
+ Plumeria is designed to extract styles into static CSS stylesheets using the CLI.
16
+ Install the following libraries to enable CLI commands: [`@plumeria/compiler`](https://www.npmjs.com/package/@plumeria/compiler)
20
17
 
21
18
  ```sh
22
19
  npm install --save-dev @plumeria/compiler
23
20
  ```
24
21
 
22
+ For more information on compiler commnads, please see the documentation
23
+ [API reference/css](https://plumeria.dev/docs/reference/css).
24
+
25
25
  ### Static StyleSheet
26
26
 
27
27
  Import stylesheet in your application's entry point.
28
- CSS for all APIs is collected here.
29
-
30
28
  Applies the static stylesheet for production environments.
31
29
 
32
30
  ```ts
31
+ // eg: main.ts or layout.tsx
33
32
  import '@plumeria/core/stylesheet';
34
33
  ```
35
34
 
@@ -37,7 +36,7 @@ import '@plumeria/core/stylesheet';
37
36
 
38
37
  ### css.create()
39
38
 
40
- Styles are defined as a map of CSS rules using css.create(). In the example below, there are 2 different CSS rules. The names "box" and "text" are arbitrary names given to the rules.
39
+ Styles are defined as a map of CSS rules using css.create(). In the example below, there are 2 different CSS className. The className `styles.box` and `styles.text` are arbitrary names given to the rules.
41
40
 
42
41
  ```ts
43
42
  import { css } from '@plumeria/core';
@@ -53,7 +52,8 @@ const styles = css.create({
53
52
  });
54
53
  ```
55
54
 
56
- Pseudo and media queries can be wrapped in property style definitions:
55
+ Pseudo and media queries can be wrapped in property style definitions:
56
+ Also, any properties that are not wrapped will conform to that className.
57
57
 
58
58
  ```ts
59
59
  const styles = css.create({
@@ -64,8 +64,9 @@ const styles = css.create({
64
64
  },
65
65
  },
66
66
  text: {
67
+ color: '#333' // standard properties of that className
67
68
  [css.pseudo.hover]: {
68
- color: 'yellow',
69
+ color: 'skyblue',
69
70
  opacity: 0.9,
70
71
  },
71
72
  },
@@ -75,21 +76,32 @@ const styles = css.create({
75
76
  ### css.global()
76
77
 
77
78
  This API lets you define global CSS.
78
- Due to restrictions on avoiding collisions in HTML selectors, css.global() is designed to throw a compilation error if written more than once.
79
+ \*Please be careful not to create selectors that conflict by creating more than one global object.
79
80
 
80
81
  ```ts
81
82
  css.global({
83
+ html: {
84
+ width: '100%',
85
+ height: '100%',
86
+ padding: 0,
87
+ margin: 0,
88
+ },
89
+ body: {
90
+ position: 'relative',
91
+ width: 600,
92
+ },
93
+ h1: {
94
+ fontSize: 32,
95
+ },
82
96
  h2: {
83
97
  fontSize: 24,
84
98
  },
85
99
  h3: {
86
- fontSize: 34,
100
+ fontSize: 16,
87
101
  },
88
102
  });
89
103
  ```
90
104
 
91
- The compiler extracts the CSS rules, replacing the rules in the source code with the compiled CSS.
92
-
93
105
  ### cx
94
106
 
95
107
  Merges strings such as class names and pseudos.
@@ -105,37 +117,6 @@ const styles = css.create({
105
117
  });
106
118
  ```
107
119
 
108
- ### rx
109
-
110
- ### React JSX only features
111
-
112
- React `inline-style` are **offloaded** using only static sheet the css variables.
113
- It is can pass states to multiple variables at once.
114
-
115
- ```ts
116
- 'use client';
117
-
118
- import { useState } from 'react';
119
- import { css, rx } from '@plumeria/core';
120
-
121
- const styles = css.create({
122
- bar: {
123
- width: 'var(--width)',
124
- background: 'aqua',
125
- },
126
- });
127
-
128
- export const Component = () => {
129
- const [state, setState] = useState(0);
130
- return (
131
- <di>
132
- <button onClick={() => setState((prev) => prev + 10)}>count</button>
133
- <div {...rx(styles.bar, { '--width': state + 'px' })} />
134
- </di>
135
- );
136
- };
137
- ```
138
-
139
120
  ### css.keyframes()
140
121
 
141
122
  Define @keyframes and set the return value directly to animationName.
@@ -164,7 +145,7 @@ Define data-theme and regular variables as objects.
164
145
  A default compile to :root, and the rest as a string compile to data-theme, You can also use media and container here.
165
146
 
166
147
  ```ts
167
- const colors = css.defineThemeVars({
148
+ const preset = css.defineThemeVars({
168
149
  normal: 'white',
169
150
  text_primary: {
170
151
  default: 'rgb(60,60,60)',
@@ -179,7 +160,7 @@ const colors = css.defineThemeVars({
179
160
  });
180
161
  ```
181
162
 
182
- ### css.colors.darken()
163
+ ### css.colors
183
164
 
184
165
  Mixes #000 or #FFF into the color.
185
166
  The first argument takes the color and the second argument takes the same value as opacity (string % or number).
package/types/css.d.ts CHANGED
@@ -2,7 +2,7 @@ import type { CreateStyle, CustomHTMLType, CustomProperties, KeyframesDefinition
2
2
  import { cx, rx } from 'zss-utils';
3
3
  declare class css {
4
4
  static create<T extends Record<string, CustomProperties>>(object: CreateStyle<T>): ReturnType<T>;
5
- static global: (object: CustomHTMLType) => void;
5
+ static global(object: CustomHTMLType): void;
6
6
  static defineThemeVars<const T extends VarsDefinition>(object: T): { [K in keyof T]: `var(--${string & K})`; };
7
7
  static keyframes(object: KeyframesDefinition): string;
8
8
  static media: {