@plumeria/core 0.18.3 → 0.19.0
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 +32 -47
- package/dist/index.d.ts +3 -3
- package/dist/index.js +16 -17
- package/dist/index.mjs +16 -17
- package/package.json +9 -3
- package/stylesheet.css +3 -0
package/README.md
CHANGED
|
@@ -30,76 +30,61 @@ import '@plumeria/core/stylesheet.css';
|
|
|
30
30
|
|
|
31
31
|
### css.create()
|
|
32
32
|
|
|
33
|
-
Define a set of atomic styles:
|
|
34
|
-
|
|
35
33
|
```ts
|
|
36
34
|
import { css } from '@plumeria/core';
|
|
37
35
|
|
|
38
36
|
const styles = css.create({
|
|
39
37
|
text: {
|
|
40
|
-
color: 'yellow',
|
|
38
|
+
color: 'yellow',
|
|
41
39
|
},
|
|
42
40
|
box: {
|
|
43
|
-
width: '100%',
|
|
44
|
-
background: 'rgb(60,60,60)',
|
|
41
|
+
width: '100%',
|
|
42
|
+
background: 'rgb(60,60,60)',
|
|
45
43
|
},
|
|
46
44
|
});
|
|
45
|
+
|
|
46
|
+
const className = css.props(styles.text, styles.box);
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
Plumeria compiles each style property into a unique, **atomic**, and **hashed** class name. This prevents style collisions and maximizes reusability.
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
css.props is compiled and style properties to the right take precedence.
|
|
51
|
+
**Generated CSS:**
|
|
53
52
|
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
```css
|
|
54
|
+
.xxr7afjw {
|
|
55
|
+
color: yellow;
|
|
56
|
+
}
|
|
57
|
+
.xq97ksf4 {
|
|
58
|
+
width: 100%;
|
|
59
|
+
}
|
|
60
|
+
.xk450ff8 {
|
|
61
|
+
background: rgb(60, 60, 60);
|
|
62
|
+
}
|
|
57
63
|
```
|
|
58
64
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
---
|
|
65
|
+
**Resulting:**
|
|
62
66
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
```ts
|
|
66
|
-
import { css } from '@plumeria/core';
|
|
67
|
-
|
|
68
|
-
const styles = css.create({
|
|
69
|
-
box: {
|
|
70
|
-
'@media (max-width: 768px)': {
|
|
71
|
-
width: '100%',
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
text: {
|
|
75
|
-
color: '#333',
|
|
76
|
-
':hover': {
|
|
77
|
-
color: 'skyblue',
|
|
78
|
-
opacity: 0.9,
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
});
|
|
67
|
+
```
|
|
68
|
+
className: "xxr7afjw xq97ksf4 xk450ff8"
|
|
82
69
|
```
|
|
83
70
|
|
|
84
|
-
##
|
|
85
|
-
|
|
86
|
-
The [@plumeria/eslint-plugin](https://www.npmjs.com/package/@plumeria/eslint-plugin) provides recommended rules:
|
|
71
|
+
## Documentation
|
|
87
72
|
|
|
88
|
-
|
|
73
|
+
Read the [documentation](https://plumeria.dev/) for more details.
|
|
89
74
|
|
|
90
|
-
|
|
91
|
-
- no-destructure: error
|
|
92
|
-
- no-inner-call: error
|
|
93
|
-
- no-unused-keys: warn
|
|
94
|
-
- sort-properties: warn
|
|
95
|
-
- validate-values: warn
|
|
96
|
-
```
|
|
75
|
+
## Integration
|
|
97
76
|
|
|
98
|
-
|
|
77
|
+
- [Vite](https://plumeria.dev/docs/integration/vite)
|
|
78
|
+
- [Next](https://plumeria.dev/docs/integration/next)
|
|
79
|
+
- [Webpack](https://plumeria.dev/docs/integration/webpack)
|
|
80
|
+
- [CLI](https://plumeria.dev/docs/integration/cli)
|
|
81
|
+
- [ESLint](https://plumeria.dev/docs/integration/eslint)
|
|
99
82
|
|
|
100
83
|
## Acknowledgement
|
|
101
84
|
|
|
102
|
-
Plumeria is made possible thanks to the
|
|
85
|
+
Plumeria is made possible thanks to the inspirations from the following projects:
|
|
86
|
+
|
|
87
|
+
> in alphabetical order
|
|
103
88
|
|
|
104
89
|
- [Linaria](https://linaria.dev/)
|
|
105
90
|
- [React Native](https://reactnative.dev/docs/stylesheet)
|
|
@@ -110,4 +95,4 @@ Plumeria is made possible thanks to the valuable inspirations from the following
|
|
|
110
95
|
|
|
111
96
|
## License
|
|
112
97
|
|
|
113
|
-
|
|
98
|
+
[MIT](https://github.com/zss-in-js/plumeria/blob/main/LICENSE) License © 2023-PRESENT [Refirst 11](https://github.com/refirst11)
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CSSProperties, CreateKeyframes, CreateStyle, CreateStyleType,
|
|
1
|
+
import { CSSProperties, CreateKeyframes, CreateStyle, CreateStyleType, CreateTokens, CreateValues, ReturnType, ReturnVariableType, RxVariableSet, ViewTransitionOptions } from "zss-engine";
|
|
2
2
|
|
|
3
3
|
declare const rx: (className: string, varSet: RxVariableSet) => {
|
|
4
4
|
className: string;
|
|
@@ -12,9 +12,9 @@ declare class StyleSheet {
|
|
|
12
12
|
static create<const T extends Record<string, CSSProperties>>(object: CreateStyleType<T>): ReturnType<T>;
|
|
13
13
|
static props(...objects: (false | Readonly<CSSProperties> | null | undefined)[]): string;
|
|
14
14
|
static keyframes(object: CreateKeyframes): string;
|
|
15
|
+
static viewTransition(object: ViewTransitionOptions): string;
|
|
15
16
|
static defineConsts<const T extends CreateValues>(object: T): T;
|
|
16
|
-
static
|
|
17
|
-
static defineTheme<const T extends CreateTheme>(object: T): ReturnVariableType<T>;
|
|
17
|
+
static defineTokens<const T extends CreateTokens>(object: T): ReturnVariableType<T>;
|
|
18
18
|
}
|
|
19
19
|
declare const css: typeof StyleSheet;
|
|
20
20
|
|
package/dist/index.js
CHANGED
|
@@ -144,23 +144,22 @@ function global(object) {
|
|
|
144
144
|
|
|
145
145
|
const keyframes = (object) => {
|
|
146
146
|
const hash = (0, zss_engine.genBase36Hash)(object, 1, 8);
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
const animationName = `kf-${hash}`;
|
|
148
|
+
global({ [`@keyframes ${animationName}`]: object });
|
|
149
|
+
return animationName;
|
|
149
150
|
};
|
|
150
151
|
|
|
151
|
-
const
|
|
152
|
-
const
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
styles[":root"][`--${key}`] = value;
|
|
152
|
+
const viewTransition = (object) => {
|
|
153
|
+
const hash = (0, zss_engine.genBase36Hash)(object, 1, 8);
|
|
154
|
+
const transitionName = `vt-${hash}`;
|
|
155
|
+
global({
|
|
156
|
+
[`::view-transition-old(${transitionName})`]: object.old,
|
|
157
|
+
[`::view-transition-new(${transitionName})`]: object.new
|
|
158
158
|
});
|
|
159
|
-
|
|
160
|
-
return result;
|
|
159
|
+
return transitionName;
|
|
161
160
|
};
|
|
162
161
|
|
|
163
|
-
const
|
|
162
|
+
const defineTokens = (object) => {
|
|
164
163
|
const styles = {};
|
|
165
164
|
const result = {};
|
|
166
165
|
Object.entries(object).forEach(([key, value]) => {
|
|
@@ -202,14 +201,14 @@ var StyleSheet = class {
|
|
|
202
201
|
static keyframes(object) {
|
|
203
202
|
return keyframes(object);
|
|
204
203
|
}
|
|
204
|
+
static viewTransition(object) {
|
|
205
|
+
return viewTransition(object);
|
|
206
|
+
}
|
|
205
207
|
static defineConsts(object) {
|
|
206
208
|
return defineConsts(object);
|
|
207
209
|
}
|
|
208
|
-
static
|
|
209
|
-
return
|
|
210
|
-
}
|
|
211
|
-
static defineTheme(object) {
|
|
212
|
-
return defineTheme(object);
|
|
210
|
+
static defineTokens(object) {
|
|
211
|
+
return defineTokens(object);
|
|
213
212
|
}
|
|
214
213
|
};
|
|
215
214
|
const css = StyleSheet;
|
package/dist/index.mjs
CHANGED
|
@@ -144,23 +144,22 @@ function global(object) {
|
|
|
144
144
|
|
|
145
145
|
const keyframes = (object) => {
|
|
146
146
|
const hash = genBase36Hash(object, 1, 8);
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
const animationName = `kf-${hash}`;
|
|
148
|
+
global({ [`@keyframes ${animationName}`]: object });
|
|
149
|
+
return animationName;
|
|
149
150
|
};
|
|
150
151
|
|
|
151
|
-
const
|
|
152
|
-
const
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
styles[":root"][`--${key}`] = value;
|
|
152
|
+
const viewTransition = (object) => {
|
|
153
|
+
const hash = genBase36Hash(object, 1, 8);
|
|
154
|
+
const transitionName = `vt-${hash}`;
|
|
155
|
+
global({
|
|
156
|
+
[`::view-transition-old(${transitionName})`]: object.old,
|
|
157
|
+
[`::view-transition-new(${transitionName})`]: object.new
|
|
158
158
|
});
|
|
159
|
-
|
|
160
|
-
return result;
|
|
159
|
+
return transitionName;
|
|
161
160
|
};
|
|
162
161
|
|
|
163
|
-
const
|
|
162
|
+
const defineTokens = (object) => {
|
|
164
163
|
const styles = {};
|
|
165
164
|
const result = {};
|
|
166
165
|
Object.entries(object).forEach(([key, value]) => {
|
|
@@ -202,14 +201,14 @@ var StyleSheet = class {
|
|
|
202
201
|
static keyframes(object) {
|
|
203
202
|
return keyframes(object);
|
|
204
203
|
}
|
|
204
|
+
static viewTransition(object) {
|
|
205
|
+
return viewTransition(object);
|
|
206
|
+
}
|
|
205
207
|
static defineConsts(object) {
|
|
206
208
|
return defineConsts(object);
|
|
207
209
|
}
|
|
208
|
-
static
|
|
209
|
-
return
|
|
210
|
-
}
|
|
211
|
-
static defineTheme(object) {
|
|
212
|
-
return defineTheme(object);
|
|
210
|
+
static defineTokens(object) {
|
|
211
|
+
return defineTokens(object);
|
|
213
212
|
}
|
|
214
213
|
};
|
|
215
214
|
const css = StyleSheet;
|
package/package.json
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plumeria/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"description": "A library for scalable and optimized styling.",
|
|
5
|
+
"author": "Refirst 11",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"funding": "https://github.com/sponsors/refirst11",
|
|
8
|
+
"homepage": "https://plumeria.dev",
|
|
5
9
|
"repository": {
|
|
6
10
|
"type": "git",
|
|
7
11
|
"url": "git+https://github.com/zss-in-js/plumeria.git",
|
|
8
12
|
"directory": "packages/core"
|
|
9
13
|
},
|
|
10
|
-
"
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/zss-in-js/plumeria/issues"
|
|
16
|
+
},
|
|
11
17
|
"keywords": [
|
|
12
18
|
"plumeria",
|
|
13
19
|
"atomic-css",
|
|
@@ -39,7 +45,7 @@
|
|
|
39
45
|
"stylesheet.css"
|
|
40
46
|
],
|
|
41
47
|
"dependencies": {
|
|
42
|
-
"zss-engine": "0.2.
|
|
48
|
+
"zss-engine": "0.2.87"
|
|
43
49
|
},
|
|
44
50
|
"publishConfig": {
|
|
45
51
|
"access": "public"
|
package/stylesheet.css
CHANGED