@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.
@@ -1,2 +1,2 @@
1
- export * from "./state";
2
- export * from "./methods";
1
+ export * from './state';
2
+ export * from './methods';
@@ -1,2 +1,2 @@
1
- export * from "./state";
2
- export * from "./methods";
1
+ export * from './state';
2
+ export * from './methods';
@@ -1,4 +1,4 @@
1
- import type { CleanState } from "./state";
1
+ import type { CleanState } from './state';
2
2
  export declare class ComponentMethods<TState extends object, TProps extends object> {
3
3
  state: CleanState<TState>;
4
4
  props: TProps;
@@ -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 "react";
12
+ import { useMemo } from 'react';
13
13
  var ComponentMethods = /** @class */ (function () {
14
14
  function ComponentMethods() {
15
15
  }
@@ -1,4 +1,4 @@
1
- import { useEffect, useRef, useState } from "react";
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
- _this.put[key] = _this._setters_[key];
21
+ // this.put[key] = this._setters_[key];
22
22
  var self = _this;
23
23
  Object.defineProperty(_this, key, {
24
24
  get: function () {
@@ -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"]) => import("react").JSX.Element;
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 { useMemo } from "react";
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 <Render />;
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);
@@ -1,3 +1,3 @@
1
- export * from "./logic";
2
- export * from "./instance";
3
- export * from "./class";
1
+ export * from './logic';
2
+ export * from './instance';
3
+ export * from './class';
@@ -1,3 +1,3 @@
1
- export * from "./logic";
2
- export * from "./instance";
3
- export * from "./class";
1
+ export * from './logic';
2
+ export * from './instance';
3
+ export * from './class';
@@ -1,4 +1,5 @@
1
- import { ComponentLogic, ComponentLogicConstructor } from "./logic";
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;
@@ -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 "react";
17
- import { useMountState } from "../base/state";
18
- import { ComponentLogic, useLogic } from "./logic";
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);
@@ -1,4 +1,4 @@
1
- import type { CleanState } from "../base/state";
1
+ import type { CleanState } from '../base/state';
2
2
  export declare class ComponentLogic<TState extends object, TProps extends object, THooks extends object> {
3
3
  state: CleanState<TState>;
4
4
  props: TProps;
@@ -1,5 +1,5 @@
1
- import { useMemo } from "react";
2
- import { useCleanState } from "../base/state";
1
+ import { useMemo } from 'react';
2
+ import { useCleanState } from '../base/state';
3
3
  var ComponentLogic = /** @class */ (function () {
4
4
  function ComponentLogic() {
5
5
  }
@@ -18,7 +18,6 @@ type Constructor<
18
18
  * @example
19
19
  * ```js
20
20
  * const getNumber: AsyncFunction<number> = async () => {
21
- * await oneTickDelay();
22
21
  * return 5;
23
22
  * }
24
23
  * ```
@@ -27,7 +27,7 @@
27
27
  "moduleResolution": "node",
28
28
  "resolveJsonModule": true,
29
29
  "isolatedModules": true,
30
- "jsx": "preserve",
30
+ "jsx": "react-jsx",
31
31
  "strictNullChecks": true
32
32
  },
33
33
  "include": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cleanweb/react",
3
- "version": "1.0.2",
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",