@plumeria/core 17.0.1 → 18.0.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
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
14
|
-
`@plumeria/core` contains type definitions only. Which JSX prop carries styles is declared in your project — one line for the default `
|
|
14
|
+
`@plumeria/core` contains type definitions only. Which JSX prop carries styles is declared in your project — one line for the default `classStyle`, see [Declaring the styling prop](#declaring-the-styling-prop). Styles are compiled away at build time by a bundler integration — [`@plumeria/next-plugin`](https://www.npmjs.com/package/@plumeria/next-plugin) for Next.js, or [`@plumeria/unplugin`](https://www.npmjs.com/package/@plumeria/unplugin) for Vite, Webpack, and others.
|
|
15
15
|
|
|
16
16
|
```sh
|
|
17
17
|
pnpm add -D @plumeria/core
|
|
@@ -21,7 +21,7 @@ See the [installation guide](https://plumeria.dev/docs/getting-started/installat
|
|
|
21
21
|
|
|
22
22
|
## Example
|
|
23
23
|
|
|
24
|
-
Styles can be passed to the `
|
|
24
|
+
Styles can be passed to the `classStyle` prop. That prop accepts static and dynamic styles as an array. At build time, the compiler resolves `classStyle` into a static `className`; dynamic values are passed as CSS variables through the `style` attribute — no runtime library is involved.
|
|
25
25
|
|
|
26
26
|
```tsx
|
|
27
27
|
import * as css from '@plumeria/core';
|
|
@@ -42,7 +42,7 @@ export default function App({ cond }) {
|
|
|
42
42
|
const scale = useScale(); // from your own hook
|
|
43
43
|
return (
|
|
44
44
|
<div
|
|
45
|
-
|
|
45
|
+
classStyle={[
|
|
46
46
|
styles.text,
|
|
47
47
|
cond && styles.cond,
|
|
48
48
|
styles.scale(scale)
|
|
@@ -79,11 +79,11 @@ export default function App({ cond }) {
|
|
|
79
79
|
|
|
80
80
|
The prop name is a build-time setting — `styleProp` on the bundler plugin — so `@plumeria/core` declares no prop of its own. Baking one in would let the types and the compiler disagree. Add one file to your project naming the prop you compile with.
|
|
81
81
|
|
|
82
|
-
For the default, `
|
|
82
|
+
For the default, `classStyle`, reference the declaration that ships with the package:
|
|
83
83
|
|
|
84
84
|
```ts
|
|
85
85
|
// plumeria.d.ts
|
|
86
|
-
/// <reference types="@plumeria/core/style
|
|
86
|
+
/// <reference types="@plumeria/core/class-style" />
|
|
87
87
|
```
|
|
88
88
|
|
|
89
89
|
If you renamed the prop, declare that name on React's attribute interfaces instead. `Style` is the type of anything the prop accepts — a style, a conditional, or an array of them:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plumeria/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "18.0.0",
|
|
4
4
|
"description": "Zero-cost abstraction layer for styling React components.",
|
|
5
5
|
"author": "Refirst 11",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
".": {
|
|
29
29
|
"types": "./lib/css.d.ts"
|
|
30
30
|
},
|
|
31
|
-
"./style
|
|
32
|
-
"types": "./lib/style
|
|
31
|
+
"./class-style": {
|
|
32
|
+
"types": "./lib/class-style.d.ts"
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"types": "./lib/css.d.ts",
|