@vitus-labs/rocketstyle 1.4.1 → 1.4.2
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 +21 -10
- package/package.json +5 -5
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Provider as Provider$1, compose, config, context, get, hoistNonReactStatics, isEmpty, merge, omit, pick, render, set } from "@vitus-labs/core";
|
|
1
|
+
import { Provider as Provider$1, compose, config, context, get, hoistNonReactStatics, isEmpty, merge, omit, pick, render, set, useStableValue } from "@vitus-labs/core";
|
|
2
2
|
import { createContext, forwardRef, useCallback, useContext, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
@@ -145,19 +145,30 @@ const usePseudoState = ({ onBlur, onFocus, onMouseDown, onMouseEnter, onMouseLea
|
|
|
145
145
|
if (onBlur) onBlur(e);
|
|
146
146
|
}, [onBlur]);
|
|
147
147
|
return {
|
|
148
|
-
state: {
|
|
148
|
+
state: useMemo(() => ({
|
|
149
149
|
hover,
|
|
150
150
|
focus,
|
|
151
151
|
pressed
|
|
152
|
-
},
|
|
153
|
-
|
|
152
|
+
}), [
|
|
153
|
+
hover,
|
|
154
|
+
focus,
|
|
155
|
+
pressed
|
|
156
|
+
]),
|
|
157
|
+
events: useMemo(() => ({
|
|
154
158
|
onMouseEnter: handleOnMouseEnter,
|
|
155
159
|
onMouseLeave: handleOnMouseLeave,
|
|
156
160
|
onMouseDown: handleOnMouseDown,
|
|
157
161
|
onMouseUp: handleOnMouseUp,
|
|
158
162
|
onFocus: handleOnFocus,
|
|
159
163
|
onBlur: handleOnBlur
|
|
160
|
-
}
|
|
164
|
+
}), [
|
|
165
|
+
handleOnMouseEnter,
|
|
166
|
+
handleOnMouseLeave,
|
|
167
|
+
handleOnMouseDown,
|
|
168
|
+
handleOnMouseUp,
|
|
169
|
+
handleOnFocus,
|
|
170
|
+
handleOnBlur
|
|
171
|
+
])
|
|
161
172
|
};
|
|
162
173
|
};
|
|
163
174
|
|
|
@@ -220,7 +231,7 @@ const LocalProvider = context$1.Provider;
|
|
|
220
231
|
* and broadcasting them through local context to child rocketstyle components.
|
|
221
232
|
*/
|
|
222
233
|
const RocketStyleProviderComponent = (WrappedComponent) => forwardRef(({ onMouseEnter, onMouseLeave, onMouseUp, onMouseDown, onFocus, onBlur, $rocketstate, ...props }, ref) => {
|
|
223
|
-
const
|
|
234
|
+
const { state: pseudoState, events: pseudoEvents } = usePseudoState({
|
|
224
235
|
onMouseEnter,
|
|
225
236
|
onMouseLeave,
|
|
226
237
|
onMouseUp,
|
|
@@ -228,18 +239,18 @@ const RocketStyleProviderComponent = (WrappedComponent) => forwardRef(({ onMouse
|
|
|
228
239
|
onFocus,
|
|
229
240
|
onBlur
|
|
230
241
|
});
|
|
231
|
-
const updatedState =
|
|
242
|
+
const updatedState = useStableValue({
|
|
232
243
|
...$rocketstate,
|
|
233
244
|
pseudo: {
|
|
234
245
|
...$rocketstate.pseudo,
|
|
235
|
-
...
|
|
246
|
+
...pseudoState
|
|
236
247
|
}
|
|
237
|
-
})
|
|
248
|
+
});
|
|
238
249
|
return /* @__PURE__ */ jsx(LocalProvider, {
|
|
239
250
|
value: updatedState,
|
|
240
251
|
children: /* @__PURE__ */ jsx(WrappedComponent, {
|
|
241
252
|
...props,
|
|
242
|
-
...
|
|
253
|
+
...pseudoEvents,
|
|
243
254
|
ref,
|
|
244
255
|
$rocketstate: updatedState
|
|
245
256
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitus-labs/rocketstyle",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Vit Bokisch <vit@bokisch.cz>",
|
|
6
6
|
"maintainers": [
|
|
@@ -66,12 +66,12 @@
|
|
|
66
66
|
"react": ">= 19"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@vitus-labs/core": "1.4.
|
|
70
|
-
"@vitus-labs/elements": "1.4.
|
|
69
|
+
"@vitus-labs/core": "1.4.2",
|
|
70
|
+
"@vitus-labs/elements": "1.4.2",
|
|
71
71
|
"@vitus-labs/tools-rolldown": "^1.6.0",
|
|
72
72
|
"@vitus-labs/tools-storybook": "^1.6.0",
|
|
73
73
|
"@vitus-labs/tools-typescript": "^1.6.0",
|
|
74
|
-
"@vitus-labs/unistyle": "1.4.
|
|
74
|
+
"@vitus-labs/unistyle": "1.4.2"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "f12f43c61149964ff4f3f4b80cb6f92da2825915"
|
|
77
77
|
}
|