@colixsystems/widget-sdk 0.302.0 → 0.303.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 +5 -1
- package/dist/pressable.js +36 -0
- package/dist/primitives.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -90,7 +90,11 @@ See the design reference for the full architecture: [`docs/architecture/widget-m
|
|
|
90
90
|
|
|
91
91
|
## Status
|
|
92
92
|
|
|
93
|
-
`v0.
|
|
93
|
+
`v0.303.0` — pre-publish. The package surface (types, function names, export paths) is the v1 contract; runtime behaviour for some hooks is stubbed (each hook documents what's wired and what isn't). It is **not yet published to npm**.
|
|
94
|
+
|
|
95
|
+
### What's new in 0.303.0 (contract 1.247.0)
|
|
96
|
+
|
|
97
|
+
**A card keeps its lift while the pointer is over a button inside it (web).** react-native-web ends a `Pressable`'s hover when the pointer enters a pressable nested in it, so a card styled with `pressableLift(state)` dropped back while the pointer sat on its own button. The SDK `Pressable` now reports `hovered` for as long as the pointer is anywhere inside it, as CSS `:hover` does, in both its style function and its children function. A press on the inner button still runs only that button's action, and a touch still never hovers. Native is unchanged: there is no hover there.
|
|
94
98
|
|
|
95
99
|
### What's new in 0.302.0 (contract 1.247.0)
|
|
96
100
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// The web `<Pressable>`: react-native-web's, with `hovered` following the
|
|
2
|
+
// pointer. The native build re-exports React Native's (./primitives.native.js),
|
|
3
|
+
// where no hover exists.
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { ReactNative } from "./text-scale.js";
|
|
6
|
+
|
|
7
|
+
const Base = ReactNative.Pressable;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* react-native-web ends a Pressable's hover when the pointer enters a Pressable
|
|
11
|
+
* nested in it. Here `hovered` stays true while the pointer is anywhere inside,
|
|
12
|
+
* as CSS `:hover` does, so a card keeps its lift over its own button.
|
|
13
|
+
*/
|
|
14
|
+
export const Pressable = React.forwardRef(function Pressable(props, ref) {
|
|
15
|
+
const { style, children, disabled, onPointerEnter, onPointerLeave } = props;
|
|
16
|
+
const [inside, setInside] = React.useState(false);
|
|
17
|
+
const withInside = (state) => ({ ...state, hovered: state.hovered || (inside && !disabled) });
|
|
18
|
+
return React.createElement(
|
|
19
|
+
Base,
|
|
20
|
+
{
|
|
21
|
+
...props,
|
|
22
|
+
ref,
|
|
23
|
+
onPointerEnter: (e) => {
|
|
24
|
+
if (e.pointerType !== "touch") setInside(true);
|
|
25
|
+
onPointerEnter?.(e);
|
|
26
|
+
},
|
|
27
|
+
onPointerLeave: (e) => {
|
|
28
|
+
setInside(false);
|
|
29
|
+
onPointerLeave?.(e);
|
|
30
|
+
},
|
|
31
|
+
style: typeof style === "function" ? (state) => style(withInside(state)) : style,
|
|
32
|
+
},
|
|
33
|
+
typeof children === "function" ? (state) => children(withInside(state)) : children,
|
|
34
|
+
);
|
|
35
|
+
});
|
|
36
|
+
Pressable.displayName = "Pressable";
|
package/dist/primitives.js
CHANGED
|
@@ -44,7 +44,7 @@ import { makeTextInput } from "./text-input-view.js";
|
|
|
44
44
|
|
|
45
45
|
export const Text = ReactNative.Text;
|
|
46
46
|
export const View = ReactNative.View;
|
|
47
|
-
export
|
|
47
|
+
export { Pressable } from "./pressable.js";
|
|
48
48
|
export const Image = ReactNative.Image;
|
|
49
49
|
export const ScrollView = ReactNative.ScrollView;
|
|
50
50
|
export const TextInput = makeTextInput(ReactNative.TextInput);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@colixsystems/widget-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.303.0",
|
|
4
4
|
"description": "Common widget interface for AppStudio. Implements WidgetManifest, WidgetContext, property schema, and helper hooks.",
|
|
5
5
|
"homepage": "https://github.com/Colix-AB/AppStudio",
|
|
6
6
|
"type": "module",
|