@cleanweb/react 1.0.2 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- package/build/base/index.d.ts +2 -2
- package/build/base/index.js +2 -2
- package/build/base/methods.d.ts +1 -1
- package/build/base/methods.js +1 -1
- package/build/base/state.js +2 -2
- package/build/classy/class.d.ts +2 -2
- package/build/classy/{class.jsx → class.js} +3 -2
- package/build/classy/index.d.ts +3 -3
- package/build/classy/index.js +3 -3
- package/build/classy/instance.d.ts +2 -1
- package/build/classy/instance.js +3 -3
- package/build/classy/logic.d.ts +1 -1
- package/build/classy/logic.js +2 -2
- package/build/globals.d.ts +0 -1
- package/build/tsconfig.json +1 -1
- package/package.json +5 -5
package/build/base/index.d.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
export * from
|
2
|
-
export * from
|
1
|
+
export * from './state';
|
2
|
+
export * from './methods';
|
package/build/base/index.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
export * from
|
2
|
-
export * from
|
1
|
+
export * from './state';
|
2
|
+
export * from './methods';
|
package/build/base/methods.d.ts
CHANGED
package/build/base/methods.js
CHANGED
@@ -9,7 +9,7 @@ var __assign = (this && this.__assign) || function () {
|
|
9
9
|
};
|
10
10
|
return __assign.apply(this, arguments);
|
11
11
|
};
|
12
|
-
import { useMemo } from
|
12
|
+
import { useMemo } from 'react';
|
13
13
|
var ComponentMethods = /** @class */ (function () {
|
14
14
|
function ComponentMethods() {
|
15
15
|
}
|
package/build/base/state.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { useEffect, useRef, useState } from
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
2
2
|
var _CleanState_ = /** @class */ (function () {
|
3
3
|
function _CleanState_(stateAndSetters) {
|
4
4
|
var _this = this;
|
@@ -18,7 +18,7 @@ var _CleanState_ = /** @class */ (function () {
|
|
18
18
|
if (reservedKeys.includes(key))
|
19
19
|
throw new Error("The name \"".concat(key, "\" is reserved by CleanState and cannot be used to index state variables. Please use a different key."));
|
20
20
|
_this._values_[key] = responseFromUseState[0], _this._setters_[key] = responseFromUseState[1];
|
21
|
-
|
21
|
+
// this.put[key] = this._setters_[key];
|
22
22
|
var self = _this;
|
23
23
|
Object.defineProperty(_this, key, {
|
24
24
|
get: function () {
|
package/build/classy/class.d.ts
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
+
import type { FunctionComponent } from 'react';
|
1
2
|
import type { ComponentInstanceConstructor } from './instance';
|
2
|
-
import { FunctionComponent } from "react";
|
3
3
|
import { ComponentInstance } from './instance';
|
4
4
|
type Obj = Record<string, any>;
|
5
5
|
type IComponentConstructor = ComponentInstanceConstructor<any, any, any> & typeof ClassComponent<any, any, any>;
|
6
6
|
export declare class ClassComponent<TState extends Obj, TProps extends Obj, THooks extends Obj> extends ComponentInstance<TState, TProps, THooks> {
|
7
7
|
Render: FunctionComponent<TProps>;
|
8
|
-
static FC: <IComponentType extends IComponentConstructor>(this: IComponentType, _Component?: IComponentType) => (props: InstanceType<IComponentType>["props"]) =>
|
8
|
+
static FC: <IComponentType extends IComponentConstructor>(this: IComponentType, _Component?: IComponentType) => (props: InstanceType<IComponentType>["props"]) => JSX.Element;
|
9
9
|
}
|
10
10
|
export {};
|
@@ -13,7 +13,8 @@ var __extends = (this && this.__extends) || (function () {
|
|
13
13
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
14
14
|
};
|
15
15
|
})();
|
16
|
-
import {
|
16
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
17
|
+
import { useMemo } from 'react';
|
17
18
|
import { ComponentInstance, useInstance } from './instance';
|
18
19
|
/** Provide more useful stack traces for otherwise non-specific function names. */
|
19
20
|
var setFunctionName = function (func, newName) {
|
@@ -42,7 +43,7 @@ var ClassComponent = /** @class */ (function (_super) {
|
|
42
43
|
var Render = useInstance(Component, props).Render;
|
43
44
|
// Add calling component name to Render function name in stack traces.
|
44
45
|
useMemo(function () { return setFunctionName(Render, "".concat(Component.name, ".Render")); }, []);
|
45
|
-
return
|
46
|
+
return _jsx(Render, {});
|
46
47
|
};
|
47
48
|
// Include calling component name in wrapper function name on stack traces.
|
48
49
|
var wrapperName = "ClassComponent".concat(Wrapper.name, " > ").concat(Component.name);
|
package/build/classy/index.d.ts
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
export * from
|
2
|
-
export * from
|
3
|
-
export * from
|
1
|
+
export * from './logic';
|
2
|
+
export * from './instance';
|
3
|
+
export * from './class';
|
package/build/classy/index.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
export * from
|
2
|
-
export * from
|
3
|
-
export * from
|
1
|
+
export * from './logic';
|
2
|
+
export * from './instance';
|
3
|
+
export * from './class';
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import {
|
1
|
+
import type { ComponentLogicConstructor } from './logic';
|
2
|
+
import { ComponentLogic } from './logic';
|
2
3
|
type Obj = Record<string, any>;
|
3
4
|
type AsyncAllowedEffectCallback = () => IVoidFunction | Promise<IVoidFunction>;
|
4
5
|
export declare const noOp: () => void;
|
package/build/classy/instance.js
CHANGED
@@ -13,9 +13,9 @@ var __extends = (this && this.__extends) || (function () {
|
|
13
13
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
14
14
|
};
|
15
15
|
})();
|
16
|
-
import { useEffect } from
|
17
|
-
import { useMountState } from
|
18
|
-
import { ComponentLogic, useLogic } from
|
16
|
+
import { useEffect } from 'react';
|
17
|
+
import { useMountState } from '../base/state';
|
18
|
+
import { ComponentLogic, useLogic } from './logic';
|
19
19
|
export var noOp = function () { };
|
20
20
|
var ComponentInstance = /** @class */ (function (_super) {
|
21
21
|
__extends(ComponentInstance, _super);
|
package/build/classy/logic.d.ts
CHANGED
package/build/classy/logic.js
CHANGED
package/build/globals.d.ts
CHANGED
package/build/tsconfig.json
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@cleanweb/react",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.4",
|
4
4
|
"description": "A suite of helpers for writing cleaner React function components.",
|
5
5
|
"engines": {
|
6
6
|
"node": ">=18"
|
@@ -16,10 +16,10 @@
|
|
16
16
|
"./classy": "./build/classy/index.js",
|
17
17
|
"./state": "./build/base/state.js",
|
18
18
|
"./methods": "./build/base/methods.js",
|
19
|
-
"./logic": "./build/classy/logic",
|
20
|
-
"./instance": "./build/classy/instance",
|
21
|
-
"./class-component": "./build/classy/class",
|
22
|
-
"./full-class": "./build/classy/class"
|
19
|
+
"./logic": "./build/classy/logic.js",
|
20
|
+
"./instance": "./build/classy/instance.js",
|
21
|
+
"./class-component": "./build/classy/class.js",
|
22
|
+
"./full-class": "./build/classy/class.js"
|
23
23
|
},
|
24
24
|
"scripts": {
|
25
25
|
"prebuild": "rimraf ./build",
|