@plumeria/core 0.8.0 → 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.
Files changed (2) hide show
  1. package/package.json +14 -10
  2. package/readme.md +29 -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.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",
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,27 +7,28 @@ 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
+ 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)
18
17
 
19
18
  ```sh
20
19
  npm install --save-dev @plumeria/compiler
21
20
  ```
22
21
 
22
+ For more information on compiler commnads, please see the documentation
23
+ [API reference/css](https://plumeria.dev/docs/reference/css).
24
+
23
25
  ### Static StyleSheet
24
26
 
25
27
  Import stylesheet in your application's entry point.
26
- CSS for all APIs is collected here.
27
-
28
28
  Applies the static stylesheet for production environments.
29
29
 
30
30
  ```ts
31
+ // eg: main.ts or layout.tsx
31
32
  import '@plumeria/core/stylesheet';
32
33
  ```
33
34
 
@@ -35,7 +36,7 @@ import '@plumeria/core/stylesheet';
35
36
 
36
37
  ### css.create()
37
38
 
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.
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.
39
40
 
40
41
  ```ts
41
42
  import { css } from '@plumeria/core';
@@ -51,7 +52,8 @@ const styles = css.create({
51
52
  });
52
53
  ```
53
54
 
54
- 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.
55
57
 
56
58
  ```ts
57
59
  const styles = css.create({
@@ -62,8 +64,9 @@ const styles = css.create({
62
64
  },
63
65
  },
64
66
  text: {
67
+ color: '#333' // standard properties of that className
65
68
  [css.pseudo.hover]: {
66
- color: 'yellow',
69
+ color: 'skyblue',
67
70
  opacity: 0.9,
68
71
  },
69
72
  },
@@ -77,11 +80,24 @@ This API lets you define global CSS.
77
80
 
78
81
  ```ts
79
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
+ },
80
96
  h2: {
81
97
  fontSize: 24,
82
98
  },
83
99
  h3: {
84
- fontSize: 34,
100
+ fontSize: 16,
85
101
  },
86
102
  });
87
103
  ```
@@ -101,37 +117,6 @@ const styles = css.create({
101
117
  });
102
118
  ```
103
119
 
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
120
  ### css.keyframes()
136
121
 
137
122
  Define @keyframes and set the return value directly to animationName.
@@ -160,7 +145,7 @@ Define data-theme and regular variables as objects.
160
145
  A default compile to :root, and the rest as a string compile to data-theme, You can also use media and container here.
161
146
 
162
147
  ```ts
163
- const colors = css.defineThemeVars({
148
+ const preset = css.defineThemeVars({
164
149
  normal: 'white',
165
150
  text_primary: {
166
151
  default: 'rgb(60,60,60)',
@@ -175,7 +160,7 @@ const colors = css.defineThemeVars({
175
160
  });
176
161
  ```
177
162
 
178
- ### css.colors.darken()
163
+ ### css.colors
179
164
 
180
165
  Mixes #000 or #FFF into the color.
181
166
  The first argument takes the color and the second argument takes the same value as opacity (string % or number).