@cleanweb/react 1.1.1-beta.17 → 1.1.1-beta.19
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/build/base/methods.js +16 -76
- package/build/classy/class.d.ts +17 -15
- package/build/classy/class.js +0 -17
- package/build/classy/instance.js +18 -17
- package/build/classy/logic.js +23 -46
- package/build/globals.js +0 -10
- package/package.json +1 -1
package/build/base/methods.js
CHANGED
@@ -1,55 +1,4 @@
|
|
1
1
|
"use strict";
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
3
|
-
var extendStatics = function (d, b) {
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
7
|
-
return extendStatics(d, b);
|
8
|
-
};
|
9
|
-
return function (d, b) {
|
10
|
-
if (typeof b !== "function" && b !== null)
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
12
|
-
extendStatics(d, b);
|
13
|
-
function __() { this.constructor = d; }
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15
|
-
};
|
16
|
-
})();
|
17
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
24
|
-
});
|
25
|
-
};
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
28
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
30
|
-
function step(op) {
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
32
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
33
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
35
|
-
switch (op[0]) {
|
36
|
-
case 0: case 1: t = op; break;
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
40
|
-
default:
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
45
|
-
if (t[2]) _.ops.pop();
|
46
|
-
_.trys.pop(); continue;
|
47
|
-
}
|
48
|
-
op = body.call(thisArg, _);
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
51
|
-
}
|
52
|
-
};
|
53
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
54
3
|
exports.useMethods = exports.ComponentMethods = void 0;
|
55
4
|
// Values
|
@@ -97,28 +46,19 @@ var useMethods = function () {
|
|
97
46
|
return methods;
|
98
47
|
};
|
99
48
|
exports.useMethods = useMethods;
|
100
|
-
testing: {
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
case 1:
|
117
|
-
useCleanState = (_a.sent()).useCleanState;
|
118
|
-
self = useMethods(MyMethods, {});
|
119
|
-
self.state;
|
120
|
-
return [2 /*return*/];
|
121
|
-
}
|
122
|
-
});
|
123
|
-
}); };
|
124
|
-
}
|
49
|
+
/*testing: {
|
50
|
+
let a = async () => {
|
51
|
+
const a: object = {b: ''};
|
52
|
+
|
53
|
+
type t = keyof typeof a;
|
54
|
+
|
55
|
+
class MyMethods extends ComponentMethods<WeakEmptyObject, null> {
|
56
|
+
// static getInitialState = () => ({});
|
57
|
+
};
|
58
|
+
|
59
|
+
const { useCleanState } = (await import('./state.js'));
|
60
|
+
|
61
|
+
const self = useMethods(MyMethods, {});
|
62
|
+
self.state;
|
63
|
+
}
|
64
|
+
}*/
|
package/build/classy/class.d.ts
CHANGED
@@ -33,24 +33,25 @@ export declare class ClassComponent<TProps extends o = WeakEmptyObject, TState e
|
|
33
33
|
*/
|
34
34
|
Render?: VoidFunctionComponent<{}>;
|
35
35
|
/**
|
36
|
-
*
|
37
|
-
*
|
36
|
+
* Analogous to {@link React.Component.render}. A function that returns
|
37
|
+
* your component's JSX template.
|
38
38
|
*
|
39
|
-
*
|
40
|
-
*
|
41
|
-
*
|
39
|
+
* You should place most logic that would usually go here
|
40
|
+
* in {@link ComponentInstance.beforeRender | `beforeRender`} instead.
|
41
|
+
* This helps to separate concerns and keep the template itself clean.
|
42
42
|
*
|
43
|
-
*
|
44
|
-
* in order to separate concerns and keep the template itself clean.
|
43
|
+
* ******
|
45
44
|
*
|
46
|
-
*
|
47
|
-
*
|
48
|
-
*
|
49
|
-
*
|
50
|
-
* </h1>
|
51
|
-
* );
|
45
|
+
* Ideally the template method should only be concerned with defining the HTML/JSX structure of
|
46
|
+
* your component's UI. This may include destructuring nested instance members
|
47
|
+
* into more easily accessible local variables, or some simple transformation of data from props/state
|
48
|
+
* into a more appropriate format for display.
|
52
49
|
*
|
53
|
-
*
|
50
|
+
* ******
|
51
|
+
*
|
52
|
+
* @example < caption>Using a template function that returns JSX.</ caption>
|
53
|
+
*
|
54
|
+
* ```tsx
|
54
55
|
* template = () => {
|
55
56
|
* const { title } = this.props;
|
56
57
|
*
|
@@ -60,8 +61,9 @@ export declare class ClassComponent<TProps extends o = WeakEmptyObject, TState e
|
|
60
61
|
* </h1>
|
61
62
|
* );
|
62
63
|
* }
|
64
|
+
* ```
|
63
65
|
*/
|
64
|
-
template?:
|
66
|
+
template?: () => ReactTemplate;
|
65
67
|
/**
|
66
68
|
* Manually trigger a rerender of your component.
|
67
69
|
* You should rarely ever need this. But if you are migrating
|
package/build/classy/class.js
CHANGED
@@ -155,20 +155,3 @@ var Use = function (params) {
|
|
155
155
|
return null;
|
156
156
|
};
|
157
157
|
exports.Use = Use;
|
158
|
-
testing: {
|
159
|
-
var a = { b: '' };
|
160
|
-
var MyComponentLogic = /** @class */ (function (_super) {
|
161
|
-
__extends(MyComponentLogic, _super);
|
162
|
-
function MyComponentLogic() {
|
163
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
164
|
-
// a = () => this.hooks.a = '';
|
165
|
-
_this.useHooks = function () {
|
166
|
-
};
|
167
|
-
return _this;
|
168
|
-
}
|
169
|
-
MyComponentLogic.getInitialState = function () { return ({ a: '' }); };
|
170
|
-
return MyComponentLogic;
|
171
|
-
}(ClassComponent));
|
172
|
-
;
|
173
|
-
var Template = MyComponentLogic.FC();
|
174
|
-
}
|
package/build/classy/instance.js
CHANGED
@@ -156,20 +156,21 @@ var useInstance = function () {
|
|
156
156
|
return instance;
|
157
157
|
};
|
158
158
|
exports.useInstance = useInstance;
|
159
|
-
testing: {
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
159
|
+
/*testing: {
|
160
|
+
class A extends ComponentInstance {
|
161
|
+
static getInitialState: (p?: object) => ({putan: ''});
|
162
|
+
// k = this.props.o
|
163
|
+
a = this.state['_initialValues_']
|
164
|
+
|
165
|
+
// hard empty has every key
|
166
|
+
// weak empty has no key
|
167
|
+
// weak empty is not assignable to hard empty
|
168
|
+
}
|
169
|
+
|
170
|
+
const p = {k: ''}
|
171
|
+
const a = useInstance(A, {o: ''});
|
172
|
+
|
173
|
+
// a.props['o'];
|
174
|
+
type bbbb = A['state'];
|
175
|
+
type ttt = bbbb['put'];
|
176
|
+
}*/
|
package/build/classy/logic.js
CHANGED
@@ -1,20 +1,4 @@
|
|
1
1
|
"use strict";
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
3
|
-
var extendStatics = function (d, b) {
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
7
|
-
return extendStatics(d, b);
|
8
|
-
};
|
9
|
-
return function (d, b) {
|
10
|
-
if (typeof b !== "function" && b !== null)
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
12
|
-
extendStatics(d, b);
|
13
|
-
function __() { this.constructor = d; }
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15
|
-
};
|
16
|
-
})();
|
17
|
-
var _a;
|
18
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
19
3
|
exports.useLogic = exports.ComponentLogic = void 0;
|
20
4
|
var react_1 = require("react");
|
@@ -68,37 +52,30 @@ var useLogic = function () {
|
|
68
52
|
return self;
|
69
53
|
};
|
70
54
|
exports.useLogic = useLogic;
|
71
|
-
testing: {
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
}
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
;
|
82
|
-
|
55
|
+
/*testing: {
|
56
|
+
const a: object = {b: ''};
|
57
|
+
|
58
|
+
type t = keyof typeof a;
|
59
|
+
|
60
|
+
class MyComponentLogic extends ComponentLogic<{a: string}> {
|
61
|
+
static getInitialState = () => ({a: '' as const});
|
62
|
+
// b = this.state.put[''] + this.props.b;
|
63
|
+
};
|
64
|
+
|
65
|
+
type tt = keyof {};
|
66
|
+
|
67
|
+
MyComponentLogic.getInitialState
|
83
68
|
// const self = useLogic(MyComponentLogic);
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
return C;
|
92
|
-
}(ComponentLogic));
|
69
|
+
|
70
|
+
|
71
|
+
const A = class C extends ComponentLogic {
|
72
|
+
// static getInitialState = () => ({a: 'l'});
|
73
|
+
// a = () => this.state.yyy = '';
|
74
|
+
}
|
75
|
+
|
93
76
|
A.getInitialState();
|
77
|
+
|
94
78
|
// const oa = {['a' as unknown as symbol]: 'boo'};
|
95
|
-
|
79
|
+
const oa = {['a']: 'boo'};
|
96
80
|
// const self = useLogic(A, oa);
|
97
|
-
}
|
98
|
-
// export type ComponentClassStatics<Instance extends ComponentLogic<object, object, object>> = {
|
99
|
-
// getInitialState: (props?: Instance['props']) => TState<Instance['state']>;
|
100
|
-
// }
|
101
|
-
// export type TComponentClass<
|
102
|
-
// Instance extends ComponentLogic<object, object, object>,
|
103
|
-
// Params extends CnstPrm = CnstPrm
|
104
|
-
// > = ComponentClassStatics<Instance> & Constructor<Instance, Params>;
|
81
|
+
}*/
|
package/build/globals.js
CHANGED
@@ -2,13 +2,3 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
/////////////
|
4
4
|
var UniqueSecretSymbolKey = Symbol('asdfghjkliuytrewqaxcvb,nb');
|
5
|
-
testing: {
|
6
|
-
var mySymbol = Symbol('asdfgh');
|
7
|
-
var tt = {
|
8
|
-
// [mySymbol]: '' as never,
|
9
|
-
// [UniqueSecretSymbolKey]: '',
|
10
|
-
// '': '',
|
11
|
-
};
|
12
|
-
var TT = {};
|
13
|
-
TT = tt;
|
14
|
-
}
|