@plumeria/core 9.1.2 → 10.0.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 +18 -21
- package/lib/{style.d.ts → css.d.ts} +13 -6
- package/lib/types.d.ts +12 -6
- package/package.json +3 -11
- /package/lib/{style.js → css.js} +0 -0
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# @plumeria/core
|
|
2
2
|
|
|
3
|
-
A styling system that disappears
|
|
3
|
+
**A styling system that disappears.**
|
|
4
4
|
|
|
5
|
-
```
|
|
6
|
-
import * as
|
|
5
|
+
```tsx
|
|
6
|
+
import * as css from '@plumeria/core';
|
|
7
7
|
|
|
8
|
-
const styles =
|
|
8
|
+
const styles = css.create({
|
|
9
9
|
text: {
|
|
10
10
|
fontSize: 12,
|
|
11
11
|
color: 'navy',
|
|
@@ -15,27 +15,23 @@ const styles = style.create({
|
|
|
15
15
|
},
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
export default function App(props) {
|
|
19
|
+
return (
|
|
20
|
+
<div
|
|
21
|
+
{...props}
|
|
22
|
+
styleName={[
|
|
23
|
+
styles.text,
|
|
24
|
+
styles.size
|
|
25
|
+
]}
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
19
29
|
```
|
|
20
30
|
|
|
21
31
|
**Compiled:**
|
|
22
32
|
|
|
23
33
|
```tsx
|
|
24
|
-
className="xhrr6ses xvbwmxqp xhk51flp"
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
**Generated CSS:**
|
|
28
|
-
|
|
29
|
-
```css
|
|
30
|
-
.xhrr6ses:not(#\#) {
|
|
31
|
-
font-size: 12px;
|
|
32
|
-
}
|
|
33
|
-
.xvbwmxqp {
|
|
34
|
-
color: navy;
|
|
35
|
-
}
|
|
36
|
-
.xhk51flp {
|
|
37
|
-
width: 120px;
|
|
38
|
-
}
|
|
34
|
+
<div className="xhrr6ses xvbwmxqp xhk51flp" />
|
|
39
35
|
```
|
|
40
36
|
|
|
41
37
|
## Documentation
|
|
@@ -58,9 +54,10 @@ Plumeria is made possible thanks to the inspirations from the following projects
|
|
|
58
54
|
- [Linaria](https://linaria.dev/)
|
|
59
55
|
- [React Native](https://reactnative.dev/docs/stylesheet)
|
|
60
56
|
- [React Native for Web](https://necolas.github.io/react-native-web/)
|
|
57
|
+
- [React Strict DOM](https://facebook.github.io/react-strict-dom/)
|
|
61
58
|
- [StyleX](https://stylexjs.com/)
|
|
62
59
|
- [Tailwind CSS](https://tailwindcss.com/)
|
|
63
|
-
|
|
60
|
+
|
|
64
61
|
|
|
65
62
|
## License
|
|
66
63
|
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
* Type definitions only. No runtime implementation provided.
|
|
3
3
|
* Configure the bundler plugin to extract and implement these APIs.
|
|
4
4
|
* ```ts
|
|
5
|
-
* type create = <const T extends Record<string,
|
|
6
|
-
* type use = (...rules: (false | CSSProperties | null | undefined)[])=> string;
|
|
5
|
+
* type create = <const T extends Record<string, CreateStyleValue>>(rule: CreateStyleType<T>)=> CreateReturnType<T>;
|
|
7
6
|
* type createTheme = <const T extends CreateTheme>(rule: T)=> ReturnVariableType<T>;
|
|
8
7
|
* type createStatic = <const T extends CreateStatic>(rule: T)=> T;
|
|
9
8
|
* type keyframes = (rule: Keyframes) => string;
|
|
@@ -15,6 +14,7 @@
|
|
|
15
14
|
*/
|
|
16
15
|
declare module '@plumeria/core' {
|
|
17
16
|
import type {
|
|
17
|
+
CreateStyleValue,
|
|
18
18
|
CreateStyleType,
|
|
19
19
|
CreateReturnType,
|
|
20
20
|
CreateStatic,
|
|
@@ -30,8 +30,7 @@ declare module '@plumeria/core' {
|
|
|
30
30
|
export type CSSProperties = import('./types').CSSProperties;
|
|
31
31
|
export type CreateStyle = import('./types').CreateStyle;
|
|
32
32
|
|
|
33
|
-
export type create = <const T extends Record<string,
|
|
34
|
-
export type use = (...rules: (false | CSSProperties | null | undefined)[])=> string;
|
|
33
|
+
export type create = <const T extends Record<string, CreateStyleValue>>(rule: CreateStyleType<T>)=> CreateReturnType<T>;
|
|
35
34
|
export type createTheme = <const T extends CreateTheme>(rule: T)=> ReturnVariableType<T>;
|
|
36
35
|
export type createStatic = <const T extends CreateStatic>(rule: T)=> T;
|
|
37
36
|
export type keyframes = (rule: Keyframes) => string;
|
|
@@ -40,8 +39,7 @@ declare module '@plumeria/core' {
|
|
|
40
39
|
export type marker = (id: string, pseudo: string) => Marker;
|
|
41
40
|
export type extended = <I extends string, P extends string>(id: I, pseudo: P) => Extended<I, P>;
|
|
42
41
|
|
|
43
|
-
export const create: create;
|
|
44
|
-
export const use: use;
|
|
42
|
+
export const create: create;
|
|
45
43
|
export const createTheme: createTheme;
|
|
46
44
|
export const createStatic: createStatic;
|
|
47
45
|
export const keyframes: keyframes;
|
|
@@ -49,4 +47,13 @@ declare module '@plumeria/core' {
|
|
|
49
47
|
export const variants: variants;
|
|
50
48
|
export const marker: marker;
|
|
51
49
|
export const extended: extended;
|
|
50
|
+
|
|
51
|
+
declare global {
|
|
52
|
+
namespace React {
|
|
53
|
+
import type { StyleName } from './types';
|
|
54
|
+
interface HTMLAttributes<T> {
|
|
55
|
+
styleName?: StyleName;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
52
59
|
}
|
package/lib/types.d.ts
CHANGED
|
@@ -113,14 +113,18 @@ type CreateStyleType<T> = {
|
|
|
113
113
|
readonly [K in keyof T]: T[K] extends CSSProperties ? CSSProperties : T[K];
|
|
114
114
|
};
|
|
115
115
|
|
|
116
|
-
type
|
|
117
|
-
[
|
|
116
|
+
type CreateReturnType<T> = {
|
|
117
|
+
[K in keyof T]: T[K] extends (...args: infer A) => infer R
|
|
118
|
+
? (...args: A) => Readonly<{ [P in keyof R]: R[P] }>
|
|
119
|
+
: Readonly<{ [P in keyof T[K]]: T[K][P] }>;
|
|
118
120
|
};
|
|
119
121
|
|
|
120
|
-
type
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
type CreateStyleValue = CSSProperties | ((...args: never) => CSSProperties)
|
|
123
|
+
|
|
124
|
+
type StyleName = CSSProperties | (false | CSSProperties | null | undefined)[];
|
|
125
|
+
|
|
126
|
+
type CreateStyle = {
|
|
127
|
+
[key: string]: CSSProperties;
|
|
124
128
|
};
|
|
125
129
|
|
|
126
130
|
type CreateStatic = Record<string, string | number>;
|
|
@@ -152,7 +156,9 @@ type Extended<I extends string, P extends string> = `@container style(--${I}-${S
|
|
|
152
156
|
|
|
153
157
|
export type {
|
|
154
158
|
CSSProperties,
|
|
159
|
+
StyleName,
|
|
155
160
|
CreateStyle,
|
|
161
|
+
CreateStyleValue,
|
|
156
162
|
CreateStyleType,
|
|
157
163
|
CreateReturnType,
|
|
158
164
|
CreateStatic,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plumeria/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.1",
|
|
4
4
|
"description": "A styling system that disappears.",
|
|
5
5
|
"author": "Refirst 11",
|
|
6
6
|
"license": "MIT",
|
|
@@ -14,20 +14,12 @@
|
|
|
14
14
|
"bugs": {
|
|
15
15
|
"url": "https://github.com/zss-in-js/plumeria/issues"
|
|
16
16
|
},
|
|
17
|
-
"keywords": [
|
|
18
|
-
"atomic-css",
|
|
19
|
-
"css-in-js",
|
|
20
|
-
"zero-runtime",
|
|
21
|
-
"stylex",
|
|
22
|
-
"pigment-css",
|
|
23
|
-
"vanilla-extract"
|
|
24
|
-
],
|
|
25
17
|
"sideEffects": false,
|
|
26
18
|
"type": "module",
|
|
27
19
|
"exports": {
|
|
28
20
|
".": {
|
|
29
|
-
"types": "./lib/
|
|
30
|
-
"import": "./lib/
|
|
21
|
+
"types": "./lib/css.d.ts",
|
|
22
|
+
"import": "./lib/css.js"
|
|
31
23
|
}
|
|
32
24
|
},
|
|
33
25
|
"files": [
|
/package/lib/{style.js → css.js}
RENAMED
|
File without changes
|