@typestyles/react 0.0.0-unstable.9ce64160b32e → 0.0.0-unstable.9ddc7a7c75fd
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 +16 -16
- package/dist/babel-plugin.cjs +14223 -152
- package/dist/babel-plugin.cjs.map +1 -1
- package/dist/babel-plugin.d.cts +10 -10
- package/dist/babel-plugin.d.cts.map +1 -0
- package/dist/babel-plugin.d.ts +10 -10
- package/dist/babel-plugin.d.ts.map +1 -0
- package/dist/babel-plugin.js +14223 -130
- package/dist/babel-plugin.js.map +1 -1
- package/dist/css-prop-DMDmFKhu.js +21 -0
- package/dist/css-prop-DMDmFKhu.js.map +1 -0
- package/dist/css-prop-DOMoNwJN.cjs +38 -0
- package/dist/css-prop-DOMoNwJN.cjs.map +1 -0
- package/dist/css-prop-runtime-zKybLO8E.d.cts +14 -0
- package/dist/css-prop-runtime-zKybLO8E.d.cts.map +1 -0
- package/dist/css-prop-runtime-zKybLO8E.d.ts +14 -0
- package/dist/css-prop-runtime-zKybLO8E.d.ts.map +1 -0
- package/dist/css-prop-runtime.cjs +7 -7
- package/dist/css-prop-runtime.cjs.map +1 -1
- package/dist/css-prop-runtime.d.cts +2 -7
- package/dist/css-prop-runtime.d.ts +2 -7
- package/dist/css-prop-runtime.js +8 -2
- package/dist/css-prop-runtime.js.map +1 -1
- package/dist/index.cjs +75 -99
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +25 -21
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +25 -21
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +69 -75
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.cjs +20 -38
- package/dist/jsx-dev-runtime.cjs.map +1 -1
- package/dist/jsx-dev-runtime.d.cts +9 -11
- package/dist/jsx-dev-runtime.d.cts.map +1 -0
- package/dist/jsx-dev-runtime.d.ts +9 -11
- package/dist/jsx-dev-runtime.d.ts.map +1 -0
- package/dist/jsx-dev-runtime.js +19 -25
- package/dist/jsx-dev-runtime.js.map +1 -1
- package/dist/jsx-runtime.cjs +23 -41
- package/dist/jsx-runtime.cjs.map +1 -1
- package/dist/jsx-runtime.d.cts +10 -12
- package/dist/jsx-runtime.d.cts.map +1 -0
- package/dist/jsx-runtime.d.ts +10 -12
- package/dist/jsx-runtime.d.ts.map +1 -0
- package/dist/jsx-runtime.js +20 -27
- package/dist/jsx-runtime.js.map +1 -1
- package/dist/resolve-hash-class-DuqLJq6S.cjs +14 -0
- package/dist/resolve-hash-class-DuqLJq6S.cjs.map +1 -0
- package/dist/resolve-hash-class-Rs_7aMMQ.js +9 -0
- package/dist/resolve-hash-class-Rs_7aMMQ.js.map +1 -0
- package/dist/types-DcDsqg2q.d.cts +10 -0
- package/dist/types-DcDsqg2q.d.cts.map +1 -0
- package/dist/types-DcDsqg2q.d.ts +10 -0
- package/dist/types-DcDsqg2q.d.ts.map +1 -0
- package/package.json +9 -11
- package/dist/chunk-3YCUQVCM.js +0 -8
- package/dist/chunk-3YCUQVCM.js.map +0 -1
- package/dist/chunk-4BYX2HZ7.js +0 -22
- package/dist/chunk-4BYX2HZ7.js.map +0 -1
- package/dist/types-_vEO6H8X.d.cts +0 -9
- package/dist/types-_vEO6H8X.d.ts +0 -9
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @typestyles/react
|
|
2
2
|
|
|
3
|
-
React integration for [typestyles](https://github.com/
|
|
3
|
+
React integration for [typestyles](https://github.com/phthalo-dev/typestyles) — migration-friendly **`styled`** API and **`css` prop** for teams coming from Emotion or styled-components.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -10,14 +10,14 @@ npm install @typestyles/react typestyles react react-dom
|
|
|
10
10
|
|
|
11
11
|
## `createStyled` / `styled`
|
|
12
12
|
|
|
13
|
-
Thin React wrapper over `
|
|
13
|
+
Thin React wrapper over `recipe` from `createTypeStyles` with typed variant props via `ComponentVariants`:
|
|
14
14
|
|
|
15
15
|
```tsx
|
|
16
|
-
import {
|
|
16
|
+
import { createTypeStyles } from 'typestyles';
|
|
17
17
|
import { createStyled, TypeStylesProvider } from '@typestyles/react';
|
|
18
18
|
|
|
19
|
-
const
|
|
20
|
-
const styled = createStyled(
|
|
19
|
+
const api = createTypeStyles({ scopeId: 'app' });
|
|
20
|
+
const styled = createStyled(api);
|
|
21
21
|
|
|
22
22
|
const Button = styled('button', {
|
|
23
23
|
base: { padding: '8px 16px', border: 'none', borderRadius: '4px' },
|
|
@@ -32,7 +32,7 @@ const Button = styled('button', {
|
|
|
32
32
|
|
|
33
33
|
function App() {
|
|
34
34
|
return (
|
|
35
|
-
<TypeStylesProvider styles={
|
|
35
|
+
<TypeStylesProvider styles={api}>
|
|
36
36
|
<Button intent="ghost">Click me</Button>
|
|
37
37
|
</TypeStylesProvider>
|
|
38
38
|
);
|
|
@@ -51,12 +51,12 @@ Point JSX at `@typestyles/react` and wrap your app in `TypeStylesProvider`:
|
|
|
51
51
|
|
|
52
52
|
```tsx
|
|
53
53
|
/** @jsxImportSource @typestyles/react */
|
|
54
|
-
import {
|
|
54
|
+
import { api } from './styles';
|
|
55
55
|
import { TypeStylesProvider } from '@typestyles/react';
|
|
56
56
|
|
|
57
57
|
export function App() {
|
|
58
58
|
return (
|
|
59
|
-
<TypeStylesProvider styles={
|
|
59
|
+
<TypeStylesProvider styles={api}>
|
|
60
60
|
<div css={{ color: 'red', padding: '1rem' }}>Hello</div>
|
|
61
61
|
</TypeStylesProvider>
|
|
62
62
|
);
|
|
@@ -73,7 +73,7 @@ Or in `tsconfig.json`:
|
|
|
73
73
|
}
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
-
Inline style objects are converted to deterministic classes via `
|
|
76
|
+
Inline style objects are converted to deterministic classes via `hash` (or `hashClass` on a `createStyles()` instance) at runtime.
|
|
77
77
|
|
|
78
78
|
## Zero-runtime `css` prop (Babel)
|
|
79
79
|
|
|
@@ -102,13 +102,13 @@ Dynamic expressions (e.g. `css={condition && { color: 'red' }}`) are left unchan
|
|
|
102
102
|
|
|
103
103
|
## API
|
|
104
104
|
|
|
105
|
-
| Export | Description
|
|
106
|
-
| ------------------------------- |
|
|
107
|
-
| `createStyled(
|
|
108
|
-
| `TypeStylesProvider` | Supplies
|
|
109
|
-
| `resolveCssPropClass` | Low-level helper: `css` object → merged `className`
|
|
110
|
-
| `@typestyles/react/jsx-runtime` | Drop-in jsx runtime with `css` prop support
|
|
111
|
-
| `@typestyles/react/babel` | Babel plugin for zero-runtime static `css` props
|
|
105
|
+
| Export | Description |
|
|
106
|
+
| ------------------------------- | --------------------------------------------------------------------- |
|
|
107
|
+
| `createStyled(api)` | Returns a `styled(tag, config)` factory backed by `recipe` on the API |
|
|
108
|
+
| `TypeStylesProvider` | Supplies the styles API to the jsx runtime for `css` prop resolution |
|
|
109
|
+
| `resolveCssPropClass` | Low-level helper: `css` object → merged `className` |
|
|
110
|
+
| `@typestyles/react/jsx-runtime` | Drop-in jsx runtime with `css` prop support |
|
|
111
|
+
| `@typestyles/react/babel` | Babel plugin for zero-runtime static `css` props |
|
|
112
112
|
|
|
113
113
|
## Future work
|
|
114
114
|
|