@pyreon/styler 0.11.7 → 0.11.9
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/lib/index.js +8 -4
- package/package.json +4 -4
- package/src/styled.tsx +20 -4
package/lib/index.js
CHANGED
|
@@ -799,13 +799,15 @@ const createStyledComponent = (tag, strings, values, options) => {
|
|
|
799
799
|
const DynamicStyled = (rawProps) => {
|
|
800
800
|
const theme = useTheme();
|
|
801
801
|
const $rs = rawProps.$rocketstyle;
|
|
802
|
+
const $rsState = rawProps.$rocketstate;
|
|
802
803
|
const isReactiveRS = typeof $rs === "function";
|
|
804
|
+
const isReactiveState = typeof $rsState === "function";
|
|
803
805
|
const resolvedRS = isReactiveRS ? $rs() : $rs;
|
|
806
|
+
const resolvedState = isReactiveState ? $rsState() : $rsState;
|
|
804
807
|
const cssText = normalizeCSS(resolve(strings, values, {
|
|
805
|
-
...
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
} : rawProps,
|
|
808
|
+
...rawProps,
|
|
809
|
+
...isReactiveRS ? { $rocketstyle: resolvedRS } : {},
|
|
810
|
+
...isReactiveState ? { $rocketstate: resolvedState } : {},
|
|
809
811
|
theme
|
|
810
812
|
}));
|
|
811
813
|
const initialClassName = cssText.length > 0 ? sheet.insert(cssText, boost) : "";
|
|
@@ -827,10 +829,12 @@ const createStyledComponent = (tag, strings, values, options) => {
|
|
|
827
829
|
}, initialClassName, isDOM, customFilter);
|
|
828
830
|
if (isReactiveRS) effect(() => {
|
|
829
831
|
const newRS = $rs();
|
|
832
|
+
const newState = isReactiveState ? $rsState() : $rsState;
|
|
830
833
|
runUntracked(() => {
|
|
831
834
|
const newCss = normalizeCSS(resolve(strings, values, {
|
|
832
835
|
...rawProps,
|
|
833
836
|
$rocketstyle: newRS,
|
|
837
|
+
$rocketstate: newState,
|
|
834
838
|
theme
|
|
835
839
|
}));
|
|
836
840
|
const newClass = newCss.length > 0 ? sheet.insert(newCss, boost) : "";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pyreon/styler",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.9",
|
|
4
4
|
"description": "Lightweight CSS-in-JS engine for Pyreon",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
"typecheck": "tsc --noEmit"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@pyreon/typescript": "^0.11.
|
|
44
|
+
"@pyreon/typescript": "^0.11.9",
|
|
45
45
|
"@vitus-labs/tools-rolldown": "^1.15.3"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@pyreon/core": "^0.11.
|
|
49
|
-
"@pyreon/reactivity": "^0.11.
|
|
48
|
+
"@pyreon/core": "^0.11.9",
|
|
49
|
+
"@pyreon/reactivity": "^0.11.9"
|
|
50
50
|
},
|
|
51
51
|
"engines": {
|
|
52
52
|
"node": ">= 22"
|
package/src/styled.tsx
CHANGED
|
@@ -132,11 +132,22 @@ const createStyledComponent = (
|
|
|
132
132
|
const DynamicStyled: ComponentFn = (rawProps: Record<string, any>): VNode | null => {
|
|
133
133
|
const theme = useTheme()
|
|
134
134
|
const $rs = rawProps.$rocketstyle
|
|
135
|
+
const $rsState = rawProps.$rocketstate
|
|
135
136
|
const isReactiveRS = typeof $rs === 'function'
|
|
137
|
+
const isReactiveState = typeof $rsState === 'function'
|
|
136
138
|
|
|
137
|
-
// Resolve initial $rocketstyle
|
|
139
|
+
// Resolve initial accessor values — both $rocketstyle and $rocketstate
|
|
140
|
+
// must be plain objects when passed to resolve(), because .styles()
|
|
141
|
+
// interpolation functions destructure them directly:
|
|
142
|
+
// const { hover, pressed } = $rocketstate.pseudo
|
|
143
|
+
// const { hover: hoverStyles } = $rocketstyle
|
|
138
144
|
const resolvedRS = isReactiveRS ? $rs() : $rs
|
|
139
|
-
const
|
|
145
|
+
const resolvedState = isReactiveState ? $rsState() : $rsState
|
|
146
|
+
const initialProps = {
|
|
147
|
+
...rawProps,
|
|
148
|
+
...(isReactiveRS ? { $rocketstyle: resolvedRS } : {}),
|
|
149
|
+
...(isReactiveState ? { $rocketstate: resolvedState } : {}),
|
|
150
|
+
}
|
|
140
151
|
const cssText = normalizeCSS(resolve(strings, values, { ...initialProps, theme }))
|
|
141
152
|
const initialClassName = cssText.length > 0 ? sheet.insert(cssText, boost) : ''
|
|
142
153
|
|
|
@@ -172,11 +183,16 @@ const createStyledComponent = (
|
|
|
172
183
|
// cascade across 50+ components on any signal change.
|
|
173
184
|
if (isReactiveRS) {
|
|
174
185
|
effect(() => {
|
|
175
|
-
const newRS = $rs() // TRACKED: subscribes to mode
|
|
186
|
+
const newRS = $rs() // TRACKED: subscribes to mode + dimension signals
|
|
187
|
+
const newState = isReactiveState ? $rsState() : $rsState // TRACKED
|
|
176
188
|
|
|
177
189
|
runUntracked(() => {
|
|
178
190
|
// UNTRACKED: resolve + DOM mutation — no additional subscriptions
|
|
179
|
-
const newResolvedProps = {
|
|
191
|
+
const newResolvedProps = {
|
|
192
|
+
...rawProps,
|
|
193
|
+
$rocketstyle: newRS,
|
|
194
|
+
$rocketstate: newState,
|
|
195
|
+
}
|
|
180
196
|
const newCss = normalizeCSS(
|
|
181
197
|
resolve(strings, values, { ...newResolvedProps, theme }),
|
|
182
198
|
)
|