@expressive/react 0.21.0 → 0.21.1
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.d.ts +1 -1
- package/lib/index.esm.js +3 -6
- package/lib/index.js +7 -41
- package/package.json +2 -2
package/lib/index.d.ts
CHANGED
package/lib/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Context,
|
|
2
|
-
export
|
|
1
|
+
import { Context, Model, Control } from '@expressive/mvc';
|
|
2
|
+
export * from '@expressive/mvc';
|
|
3
3
|
import React, { createContext, useContext, useState, useMemo, useLayoutEffect, Suspense } from 'react';
|
|
4
4
|
|
|
5
5
|
const LookupContext = createContext(new Context());
|
|
@@ -48,9 +48,6 @@ const useModel = (adapter) => {
|
|
|
48
48
|
return hook.render;
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
const Oops = issues({
|
|
52
|
-
BadProps: () => `Provider expects either a render function, 'get' or 'has' props.`
|
|
53
|
-
});
|
|
54
51
|
function Consumer(props) {
|
|
55
52
|
const { children, has, get, for: Type } = props;
|
|
56
53
|
if (typeof children == "function")
|
|
@@ -59,7 +56,7 @@ function Consumer(props) {
|
|
|
59
56
|
if (typeof callback == "function")
|
|
60
57
|
callback(Type.get(!!has));
|
|
61
58
|
else
|
|
62
|
-
throw
|
|
59
|
+
throw new Error("Provider expects either a render function, 'get' or 'has' props.");
|
|
63
60
|
return null;
|
|
64
61
|
}
|
|
65
62
|
|
package/lib/index.js
CHANGED
|
@@ -7,7 +7,6 @@ var React = require('react');
|
|
|
7
7
|
|
|
8
8
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
9
|
|
|
10
|
-
var mvc__default = /*#__PURE__*/_interopDefaultLegacy(mvc);
|
|
11
10
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
12
11
|
|
|
13
12
|
const LookupContext = React.createContext(new mvc.Context());
|
|
@@ -56,9 +55,6 @@ const useModel = (adapter) => {
|
|
|
56
55
|
return hook.render;
|
|
57
56
|
};
|
|
58
57
|
|
|
59
|
-
const Oops = mvc.issues({
|
|
60
|
-
BadProps: () => `Provider expects either a render function, 'get' or 'has' props.`
|
|
61
|
-
});
|
|
62
58
|
function Consumer(props) {
|
|
63
59
|
const { children, has, get, for: Type } = props;
|
|
64
60
|
if (typeof children == "function")
|
|
@@ -67,7 +63,7 @@ function Consumer(props) {
|
|
|
67
63
|
if (typeof callback == "function")
|
|
68
64
|
callback(Type.get(!!has));
|
|
69
65
|
else
|
|
70
|
-
throw
|
|
66
|
+
throw new Error("Provider expects either a render function, 'get' or 'has' props.");
|
|
71
67
|
return null;
|
|
72
68
|
}
|
|
73
69
|
|
|
@@ -96,41 +92,11 @@ mvc.Control.get = getModel;
|
|
|
96
92
|
mvc.Control.use = useModel;
|
|
97
93
|
mvc.Control.has = hasModel;
|
|
98
94
|
|
|
99
|
-
Object.defineProperty(exports, 'Control', {
|
|
100
|
-
enumerable: true,
|
|
101
|
-
get: function () { return mvc.Control; }
|
|
102
|
-
});
|
|
103
|
-
Object.defineProperty(exports, 'Debug', {
|
|
104
|
-
enumerable: true,
|
|
105
|
-
get: function () { return mvc.Debug; }
|
|
106
|
-
});
|
|
107
|
-
Object.defineProperty(exports, 'Model', {
|
|
108
|
-
enumerable: true,
|
|
109
|
-
get: function () { return mvc.Model; }
|
|
110
|
-
});
|
|
111
|
-
Object.defineProperty(exports, 'default', {
|
|
112
|
-
enumerable: true,
|
|
113
|
-
get: function () { return mvc__default["default"]; }
|
|
114
|
-
});
|
|
115
|
-
Object.defineProperty(exports, 'get', {
|
|
116
|
-
enumerable: true,
|
|
117
|
-
get: function () { return mvc.get; }
|
|
118
|
-
});
|
|
119
|
-
Object.defineProperty(exports, 'ref', {
|
|
120
|
-
enumerable: true,
|
|
121
|
-
get: function () { return mvc.ref; }
|
|
122
|
-
});
|
|
123
|
-
Object.defineProperty(exports, 'run', {
|
|
124
|
-
enumerable: true,
|
|
125
|
-
get: function () { return mvc.run; }
|
|
126
|
-
});
|
|
127
|
-
Object.defineProperty(exports, 'set', {
|
|
128
|
-
enumerable: true,
|
|
129
|
-
get: function () { return mvc.set; }
|
|
130
|
-
});
|
|
131
|
-
Object.defineProperty(exports, 'use', {
|
|
132
|
-
enumerable: true,
|
|
133
|
-
get: function () { return mvc.use; }
|
|
134
|
-
});
|
|
135
95
|
exports.Consumer = Consumer;
|
|
136
96
|
exports.Provider = Provider;
|
|
97
|
+
Object.keys(mvc).forEach(function (k) {
|
|
98
|
+
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
|
|
99
|
+
enumerable: true,
|
|
100
|
+
get: function () { return mvc[k]; }
|
|
101
|
+
});
|
|
102
|
+
});
|
package/package.json
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"postversion": "git push & npm publish"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@expressive/mvc": "^0.21.
|
|
33
|
+
"@expressive/mvc": "^0.21.1"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"react": ">=16.8.0 <19.0.0"
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"react": ">=17.0.2",
|
|
43
43
|
"react-test-renderer": "^17.0.2"
|
|
44
44
|
},
|
|
45
|
-
"version": "0.21.
|
|
45
|
+
"version": "0.21.1"
|
|
46
46
|
}
|