@expressive/react 0.36.0 → 0.36.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/dist/index.js +5 -2
- package/dist/index.mjs +5 -2
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -113,7 +113,8 @@ function useRemote(argument) {
|
|
|
113
113
|
const refresh = () => state[1]((x) => x.bind(null));
|
|
114
114
|
if (!instance)
|
|
115
115
|
if (argument === false)
|
|
116
|
-
return
|
|
116
|
+
return () => {
|
|
117
|
+
};
|
|
117
118
|
else
|
|
118
119
|
throw new Error(`Could not find ${this} in context.`);
|
|
119
120
|
if (typeof argument === "boolean")
|
|
@@ -167,8 +168,10 @@ var import_mvc3 = require("@expressive/mvc");
|
|
|
167
168
|
// src/consumer.ts
|
|
168
169
|
function Consumer(props) {
|
|
169
170
|
const { children, has, get: get2, for: Type } = props;
|
|
171
|
+
if (typeof children == "function")
|
|
172
|
+
return children(Type.get());
|
|
170
173
|
const instance = Type.get(!!has);
|
|
171
|
-
const callback =
|
|
174
|
+
const callback = has || get2;
|
|
172
175
|
if (typeof callback == "function")
|
|
173
176
|
callback(instance);
|
|
174
177
|
return null;
|
package/dist/index.mjs
CHANGED
|
@@ -85,7 +85,8 @@ function useRemote(argument) {
|
|
|
85
85
|
const refresh = () => state[1]((x) => x.bind(null));
|
|
86
86
|
if (!instance)
|
|
87
87
|
if (argument === false)
|
|
88
|
-
return
|
|
88
|
+
return () => {
|
|
89
|
+
};
|
|
89
90
|
else
|
|
90
91
|
throw new Error(`Could not find ${this} in context.`);
|
|
91
92
|
if (typeof argument === "boolean")
|
|
@@ -139,8 +140,10 @@ import { add, get, use, ref, set } from "@expressive/mvc";
|
|
|
139
140
|
// src/consumer.ts
|
|
140
141
|
function Consumer(props) {
|
|
141
142
|
const { children, has, get: get2, for: Type } = props;
|
|
143
|
+
if (typeof children == "function")
|
|
144
|
+
return children(Type.get());
|
|
142
145
|
const instance = Type.get(!!has);
|
|
143
|
-
const callback =
|
|
146
|
+
const callback = has || get2;
|
|
144
147
|
if (typeof callback == "function")
|
|
145
148
|
callback(instance);
|
|
146
149
|
return null;
|
package/package.json
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"preversion": "npm run test && npm run build"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@expressive/mvc": "^0.36.
|
|
34
|
+
"@expressive/mvc": "^0.36.2"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"react": ">=16.8.0 <19.0.0"
|
|
@@ -42,6 +42,6 @@
|
|
|
42
42
|
"react": "^18.2.0",
|
|
43
43
|
"react-test-renderer": "^18.2.0"
|
|
44
44
|
},
|
|
45
|
-
"version": "0.36.
|
|
46
|
-
"gitHead": "
|
|
45
|
+
"version": "0.36.2",
|
|
46
|
+
"gitHead": "6bd9a56d67a2972248ed85a27e22f96d8577495a"
|
|
47
47
|
}
|