@plumeria/core 0.8.0 → 0.8.2

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 (2) hide show
  1. package/package.json +14 -10
  2. package/readme.md +27 -44
package/package.json CHANGED
@@ -1,30 +1,34 @@
1
1
  {
2
2
  "name": "@plumeria/core",
3
- "version": "0.8.0",
4
- "description": "Near Zero-runtime CSS-in-JS for efficient design systems.",
3
+ "version": "0.8.2",
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",
package/readme.md CHANGED
@@ -1,4 +1,4 @@
1
- # @plumeria/core
1
+ # 💐 Plumeria
2
2
 
3
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
 
@@ -7,14 +7,14 @@ Plumeria is a CSS-in-JS built with [**zss-utils**](https://www.npmjs.com/package
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.
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(`css &&`) into the build process.
18
18
 
19
19
  ```sh
20
20
  npm install --save-dev @plumeria/compiler
@@ -23,8 +23,7 @@ npm install --save-dev @plumeria/compiler
23
23
  ### Static StyleSheet
24
24
 
25
25
  Import stylesheet in your application's entry point.
26
- CSS for all APIs is collected here.
27
-
26
+ CSS for all APIs is collected here.
28
27
  Applies the static stylesheet for production environments.
29
28
 
30
29
  ```ts
@@ -35,7 +34,7 @@ import '@plumeria/core/stylesheet';
35
34
 
36
35
  ### css.create()
37
36
 
38
- 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.
37
+ 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.
39
38
 
40
39
  ```ts
41
40
  import { css } from '@plumeria/core';
@@ -51,7 +50,8 @@ const styles = css.create({
51
50
  });
52
51
  ```
53
52
 
54
- Pseudo and media queries can be wrapped in property style definitions:
53
+ Pseudo and media queries can be wrapped in property style definitions:
54
+ Also, any properties that are not wrapped will conform to that className.
55
55
 
56
56
  ```ts
57
57
  const styles = css.create({
@@ -62,8 +62,9 @@ const styles = css.create({
62
62
  },
63
63
  },
64
64
  text: {
65
+ color: '#333' // standard properties of that className
65
66
  [css.pseudo.hover]: {
66
- color: 'yellow',
67
+ color: 'skyblue',
67
68
  opacity: 0.9,
68
69
  },
69
70
  },
@@ -77,11 +78,24 @@ This API lets you define global CSS.
77
78
 
78
79
  ```ts
79
80
  css.global({
81
+ html: {
82
+ width: '100%',
83
+ height: '100%',
84
+ padding: 0,
85
+ margin: 0,
86
+ },
87
+ body: {
88
+ position: 'relative',
89
+ width: 600,
90
+ },
91
+ h1: {
92
+ fontSize: 32,
93
+ },
80
94
  h2: {
81
95
  fontSize: 24,
82
96
  },
83
97
  h3: {
84
- fontSize: 34,
98
+ fontSize: 16,
85
99
  },
86
100
  });
87
101
  ```
@@ -101,37 +115,6 @@ const styles = css.create({
101
115
  });
102
116
  ```
103
117
 
104
- ### rx
105
-
106
- ### React JSX only features
107
-
108
- React `inline-style` are **offloaded** using only static sheet the css variables.
109
- It is can pass states to multiple variables at once.
110
-
111
- ```ts
112
- 'use client';
113
-
114
- import { useState } from 'react';
115
- import { css, rx } from '@plumeria/core';
116
-
117
- const styles = css.create({
118
- bar: {
119
- width: 'var(--width)',
120
- background: 'aqua',
121
- },
122
- });
123
-
124
- export const Component = () => {
125
- const [state, setState] = useState(0);
126
- return (
127
- <di>
128
- <button onClick={() => setState((prev) => prev + 10)}>count</button>
129
- <div {...rx(styles.bar, { '--width': state + 'px' })} />
130
- </di>
131
- );
132
- };
133
- ```
134
-
135
118
  ### css.keyframes()
136
119
 
137
120
  Define @keyframes and set the return value directly to animationName.
@@ -160,7 +143,7 @@ Define data-theme and regular variables as objects.
160
143
  A default compile to :root, and the rest as a string compile to data-theme, You can also use media and container here.
161
144
 
162
145
  ```ts
163
- const colors = css.defineThemeVars({
146
+ const preset = css.defineThemeVars({
164
147
  normal: 'white',
165
148
  text_primary: {
166
149
  default: 'rgb(60,60,60)',
@@ -175,7 +158,7 @@ const colors = css.defineThemeVars({
175
158
  });
176
159
  ```
177
160
 
178
- ### css.colors.darken()
161
+ ### css.colors
179
162
 
180
163
  Mixes #000 or #FFF into the color.
181
164
  The first argument takes the color and the second argument takes the same value as opacity (string % or number).