@cleanweb/oore 2.0.0-alpha.21 → 2.0.0-alpha.23
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/_cjs/base/index.d.ts +3 -3
- package/build/_cjs/base/index.js +3 -3
- package/build/_cjs/base/state/class-types.d.ts +2 -2
- package/build/_cjs/base/state/class.d.ts +1 -1
- package/build/_cjs/base/state/hook-types.d.ts +1 -1
- package/build/_cjs/base/state/hooks.d.ts +1 -1
- package/build/_cjs/base/state/hooks.js +1 -1
- package/build/_cjs/base/state/index.d.ts +5 -5
- package/build/_cjs/base/state/index.js +3 -3
- package/build/_cjs/classy/class/index.d.ts +3 -3
- package/build/_cjs/classy/class/index.js +3 -3
- package/build/_cjs/classy/class/types/extractor.d.ts +1 -1
- package/build/_cjs/classy/index.d.ts +3 -3
- package/build/_cjs/classy/index.js +3 -3
- package/build/_cjs/classy/instance/index.d.ts +3 -3
- package/build/_cjs/classy/instance/index.js +3 -3
- package/build/_cjs/classy/instance/mount-callbacks.d.ts +1 -1
- package/build/_cjs/classy/instance/mount-callbacks.js +1 -1
- package/build/_cjs/classy/instance/types/hook.d.ts +1 -1
- package/build/_cjs/classy/logic/index.d.ts +2 -2
- package/build/_cjs/classy/logic/index.js +1 -1
- package/build/_cjs/classy/logic/types/hook.d.ts +1 -1
- package/build/_cjs/docs-src/api/base-classes.d.ts +3 -3
- package/build/_cjs/docs-src/api/base-classes.js +3 -3
- package/build/_cjs/docs-src/api/index.d.ts +8 -8
- package/build/_cjs/docs-src/api/index.js +8 -8
- package/build/_cjs/docs-src/api/references.d.ts +5 -5
- package/build/_cjs/docs-src/api/references.js +5 -5
- package/build/_cjs/helpers/index.d.ts +4 -4
- package/build/_cjs/helpers/index.js +4 -4
- package/build/_cjs/helpers/rerender.js +1 -1
- package/build/_cjs/helpers/use-component/index.d.ts +1 -1
- package/build/_cjs/index.d.ts +3 -3
- package/build/_cjs/index.js +3 -3
- package/build/_cjs/slots/hook.d.ts +2 -2
- package/build/_cjs/slots/hook.js +1 -1
- package/build/_cjs/slots/index.d.ts +1 -1
- package/build/_cjs/slots/index.js +1 -1
- package/build/base/index.d.ts +3 -3
- package/build/base/index.js +3 -19
- package/build/base/merged-state.js +4 -8
- package/build/base/methods.js +5 -9
- package/build/base/state/class-types.d.ts +2 -2
- package/build/base/state/class-types.js +1 -2
- package/build/base/state/class.d.ts +1 -1
- package/build/base/state/class.js +5 -9
- package/build/base/state/hook-types.d.ts +1 -1
- package/build/base/state/hook-types.js +1 -2
- package/build/base/state/hooks.d.ts +1 -1
- package/build/base/state/hooks.js +7 -11
- package/build/base/state/index.d.ts +5 -5
- package/build/base/state/index.js +3 -31
- package/build/classy/class/index.d.ts +3 -3
- package/build/classy/class/index.js +16 -20
- package/build/classy/class/types/extractor.d.ts +1 -1
- package/build/classy/class/types/extractor.js +1 -2
- package/build/classy/class/utils/function-name.js +1 -5
- package/build/classy/index.d.ts +3 -3
- package/build/classy/index.js +3 -19
- package/build/classy/instance/index.d.ts +3 -3
- package/build/classy/instance/index.js +11 -16
- package/build/classy/instance/mount-callbacks.d.ts +1 -1
- package/build/classy/instance/mount-callbacks.js +5 -9
- package/build/classy/instance/types/hook.d.ts +1 -1
- package/build/classy/instance/types/hook.js +1 -2
- package/build/classy/logic/index.d.ts +2 -2
- package/build/classy/logic/index.js +7 -12
- package/build/classy/logic/types/hook.d.ts +1 -1
- package/build/classy/logic/types/hook.js +1 -2
- package/build/docs-src/api/base-classes.d.ts +3 -3
- package/build/docs-src/api/base-classes.js +3 -9
- package/build/docs-src/api/index.d.ts +8 -8
- package/build/docs-src/api/index.js +8 -39
- package/build/docs-src/api/references.d.ts +5 -5
- package/build/docs-src/api/references.js +5 -31
- package/build/helpers/errors.js +1 -5
- package/build/helpers/index.d.ts +4 -4
- package/build/helpers/index.js +5 -23
- package/build/helpers/mount-state.js +4 -8
- package/build/helpers/rerender.js +7 -11
- package/build/helpers/type-guards.js +1 -5
- package/build/helpers/use-component/index.d.ts +1 -1
- package/build/helpers/use-component/index.js +3 -7
- package/build/helpers/use-component/types.js +1 -2
- package/build/index.d.ts +3 -3
- package/build/index.js +3 -19
- package/build/slots/hook.d.ts +2 -2
- package/build/slots/hook.js +15 -45
- package/build/slots/index.d.ts +1 -1
- package/build/slots/index.js +1 -17
- package/build/slots/types.js +1 -2
- package/build/tsconfig.json +6 -2
- package/package.json +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './state';
|
|
2
|
-
export * from './methods';
|
|
3
|
-
export * from './merged-state';
|
|
1
|
+
export * from './state/index.js';
|
|
2
|
+
export * from './methods.js';
|
|
3
|
+
export * from './merged-state.js';
|
package/build/_cjs/base/index.js
CHANGED
|
@@ -14,6 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./state"), exports);
|
|
18
|
-
__exportStar(require("./methods"), exports);
|
|
19
|
-
__exportStar(require("./merged-state"), exports);
|
|
17
|
+
__exportStar(require("./state/index.js"), exports);
|
|
18
|
+
__exportStar(require("./methods.js"), exports);
|
|
19
|
+
__exportStar(require("./merged-state.js"), exports);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CleanStateBase } from './class';
|
|
2
|
-
import { TCleanState, TStateData } from './hook-types';
|
|
1
|
+
import { CleanStateBase } from './class.js';
|
|
2
|
+
import { TCleanState, TStateData } from './hook-types.js';
|
|
3
3
|
export type TCleanStateBase = typeof CleanStateBase;
|
|
4
4
|
export type TCleanStateBaseKeys = keyof TCleanStateBase;
|
|
5
5
|
export type PutState<TState extends TStateData> = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ICleanStateClass, ICleanStateConstructor, PutManyPayload, PutState } from './class-types';
|
|
1
|
+
import type { ICleanStateClass, ICleanStateConstructor, PutManyPayload, PutState } from './class-types.js';
|
|
2
2
|
/** @internal */
|
|
3
3
|
export declare class CleanStateBase<TState extends Record<string, any>> {
|
|
4
4
|
readonly reservedKeys: string[];
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useCleanState = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
-
const class_1 = require("./class");
|
|
5
|
+
const class_1 = require("./class.js");
|
|
6
6
|
/**
|
|
7
7
|
* Creates a state object, which includes the provided values,
|
|
8
8
|
* as well as helper methods for updating those values and automatically
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module CleanState
|
|
3
3
|
*/
|
|
4
|
-
export { CleanState } from './class';
|
|
5
|
-
export { useCleanState } from './hooks';
|
|
6
|
-
export type { TCleanState, TStateData, ExtractCleanStateData } from './hook-types';
|
|
7
|
-
export type { SF, StateFragment } from './class-types';
|
|
8
|
-
export * as MergedState from '../../base/merged-state';
|
|
4
|
+
export { CleanState } from './class.js';
|
|
5
|
+
export { useCleanState } from './hooks.js';
|
|
6
|
+
export type { TCleanState, TStateData, ExtractCleanStateData } from './hook-types.js';
|
|
7
|
+
export type { SF, StateFragment } from './class-types.js';
|
|
8
|
+
export * as MergedState from '../../base/merged-state.js';
|
|
@@ -27,8 +27,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.MergedState = exports.useCleanState = exports.CleanState = void 0;
|
|
30
|
-
var class_1 = require("./class");
|
|
30
|
+
var class_1 = require("./class.js");
|
|
31
31
|
Object.defineProperty(exports, "CleanState", { enumerable: true, get: function () { return class_1.CleanState; } });
|
|
32
|
-
var hooks_1 = require("./hooks");
|
|
32
|
+
var hooks_1 = require("./hooks.js");
|
|
33
33
|
Object.defineProperty(exports, "useCleanState", { enumerable: true, get: function () { return hooks_1.useCleanState; } });
|
|
34
|
-
exports.MergedState = __importStar(require("../../base/merged-state"));
|
|
34
|
+
exports.MergedState = __importStar(require("../../base/merged-state.js"));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import type { TPropsBase } from '../logic';
|
|
3
|
-
import type { Extractor } from './types/extractor';
|
|
4
|
-
import { ComponentInstance } from '../instance';
|
|
2
|
+
import type { TPropsBase } from '../logic/index.js';
|
|
3
|
+
import type { Extractor } from './types/extractor.js';
|
|
4
|
+
import { ComponentInstance } from '../instance/index.js';
|
|
5
5
|
/**
|
|
6
6
|
* @summary
|
|
7
7
|
* A modern class component for React that is fully compatible with
|
|
@@ -3,9 +3,9 @@ var _a;
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.Component = exports.ClassComponent = void 0;
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
-
const instance_1 = require("../instance");
|
|
7
|
-
const function_name_1 = require("./utils/function-name");
|
|
8
|
-
const rerender_1 = require("../../helpers/rerender");
|
|
6
|
+
const instance_1 = require("../instance/index.js");
|
|
7
|
+
const function_name_1 = require("./utils/function-name.js");
|
|
8
|
+
const rerender_1 = require("../../helpers/rerender.js");
|
|
9
9
|
/**
|
|
10
10
|
* @summary
|
|
11
11
|
* A modern class component for React that is fully compatible with
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { VoidFunctionComponent } from 'react';
|
|
2
|
-
import type { ClassComponent } from '
|
|
2
|
+
import type { ClassComponent } from '../index.js';
|
|
3
3
|
type BaseCCConstructor = typeof ClassComponent<object>;
|
|
4
4
|
export type Extractor = <TComponentClass extends BaseCCConstructor, TProperties extends {} = {}>(this: TComponentClass, Component?: TComponentClass | null, properties?: TProperties) => NonNullable<TProperties> & VoidFunctionComponent<InstanceType<TComponentClass>['props']>;
|
|
5
5
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './logic';
|
|
2
|
-
export * from './instance';
|
|
3
|
-
export * from './class';
|
|
1
|
+
export * from './logic/index.js';
|
|
2
|
+
export * from './instance/index.js';
|
|
3
|
+
export * from './class/index.js';
|
|
@@ -14,6 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./logic"), exports);
|
|
18
|
-
__exportStar(require("./instance"), exports);
|
|
19
|
-
__exportStar(require("./class"), exports);
|
|
17
|
+
__exportStar(require("./logic/index.js"), exports);
|
|
18
|
+
__exportStar(require("./instance/index.js"), exports);
|
|
19
|
+
__exportStar(require("./class/index.js"), exports);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { UseInstance } from './types/hook';
|
|
2
|
-
import type { TPropsBase } from '../../classy/logic';
|
|
3
|
-
import { ComponentLogic } from '../../classy/logic';
|
|
1
|
+
import type { UseInstance } from './types/hook.js';
|
|
2
|
+
import type { TPropsBase } from '../../classy/logic/index.js';
|
|
3
|
+
import { ComponentLogic } from '../../classy/logic/index.js';
|
|
4
4
|
type AsyncAllowedEffectCallback = () => Awaitable<IVoidFunction | void>;
|
|
5
5
|
/**
|
|
6
6
|
* A superset of {@link ComponentLogic} that adds support for lifecycle methods.
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useInstance = exports.ComponentInstance = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
-
const logic_1 = require("../../classy/logic");
|
|
6
|
-
const mount_callbacks_1 = require("./mount-callbacks");
|
|
7
|
-
const helpers_1 = require("../../helpers");
|
|
5
|
+
const logic_1 = require("../../classy/logic/index.js");
|
|
6
|
+
const mount_callbacks_1 = require("./mount-callbacks.js");
|
|
7
|
+
const helpers_1 = require("../../helpers/index.js");
|
|
8
8
|
/**
|
|
9
9
|
* A superset of {@link ComponentLogic} that adds support for lifecycle methods.
|
|
10
10
|
* This provides a declarative API for working with your React function component's lifecycle,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useMountCallbacks = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
-
const mount_state_1 = require("../../helpers/mount-state");
|
|
5
|
+
const mount_state_1 = require("../../helpers/mount-state.js");
|
|
6
6
|
/** @internal */
|
|
7
7
|
const useMountCallbacks = (instance) => {
|
|
8
8
|
var _a;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { TCleanState } from '../../base/state';
|
|
2
|
-
import type { UseLogic } from './types/hook';
|
|
1
|
+
import type { TCleanState } from '../../base/state/index.js';
|
|
2
|
+
import type { UseLogic } from './types/hook.js';
|
|
3
3
|
/**
|
|
4
4
|
* The base type for the `props` type argument.
|
|
5
5
|
*
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useLogic = exports.ComponentLogic = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
-
const state_1 = require("../../base/state");
|
|
5
|
+
const state_1 = require("../../base/state/index.js");
|
|
6
6
|
/**
|
|
7
7
|
* Base class for a class that holds methods to be used in a function component.
|
|
8
8
|
*
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { ComponentMethods } from '../../base/methods';
|
|
2
|
-
export { ComponentLogic } from '../../classy/logic';
|
|
3
|
-
export { ComponentInstance } from '../../classy/instance';
|
|
1
|
+
export { ComponentMethods } from '../../base/methods.js';
|
|
2
|
+
export { ComponentLogic } from '../../classy/logic/index.js';
|
|
3
|
+
export { ComponentInstance } from '../../classy/instance/index.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ComponentInstance = exports.ComponentLogic = exports.ComponentMethods = void 0;
|
|
4
|
-
var methods_1 = require("../../base/methods");
|
|
4
|
+
var methods_1 = require("../../base/methods.js");
|
|
5
5
|
Object.defineProperty(exports, "ComponentMethods", { enumerable: true, get: function () { return methods_1.ComponentMethods; } });
|
|
6
|
-
var logic_1 = require("../../classy/logic");
|
|
6
|
+
var logic_1 = require("../../classy/logic/index.js");
|
|
7
7
|
Object.defineProperty(exports, "ComponentLogic", { enumerable: true, get: function () { return logic_1.ComponentLogic; } });
|
|
8
|
-
var instance_1 = require("../../classy/instance");
|
|
8
|
+
var instance_1 = require("../../classy/instance/index.js");
|
|
9
9
|
Object.defineProperty(exports, "ComponentInstance", { enumerable: true, get: function () { return instance_1.ComponentInstance; } });
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* API Reference
|
|
3
3
|
* @module API
|
|
4
4
|
*/
|
|
5
|
-
export { useCleanState } from '../../base/state';
|
|
6
|
-
export { useMethods } from '../../base/methods';
|
|
7
|
-
export { useLogic } from '../../classy/logic';
|
|
8
|
-
export { useInstance } from '../../classy/instance';
|
|
9
|
-
export { ClassComponent } from '../../classy/class';
|
|
5
|
+
export { useCleanState } from '../../base/state/index.js';
|
|
6
|
+
export { useMethods } from '../../base/methods.js';
|
|
7
|
+
export { useLogic } from '../../classy/logic/index.js';
|
|
8
|
+
export { useInstance } from '../../classy/instance/index.js';
|
|
9
|
+
export { ClassComponent } from '../../classy/class/index.js';
|
|
10
10
|
/** @namespace */
|
|
11
|
-
export * as BaseClasses from './base-classes';
|
|
12
|
-
export * as Helpers from '../../helpers';
|
|
13
|
-
export * as References from './references';
|
|
11
|
+
export * as BaseClasses from './base-classes.js';
|
|
12
|
+
export * as Helpers from '../../helpers/index.js';
|
|
13
|
+
export * as References from './references.js';
|
|
@@ -28,17 +28,17 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
28
28
|
};
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
30
|
exports.References = exports.Helpers = exports.BaseClasses = exports.ClassComponent = exports.useInstance = exports.useLogic = exports.useMethods = exports.useCleanState = void 0;
|
|
31
|
-
var state_1 = require("../../base/state");
|
|
31
|
+
var state_1 = require("../../base/state/index.js");
|
|
32
32
|
Object.defineProperty(exports, "useCleanState", { enumerable: true, get: function () { return state_1.useCleanState; } });
|
|
33
|
-
var methods_1 = require("../../base/methods");
|
|
33
|
+
var methods_1 = require("../../base/methods.js");
|
|
34
34
|
Object.defineProperty(exports, "useMethods", { enumerable: true, get: function () { return methods_1.useMethods; } });
|
|
35
|
-
var logic_1 = require("../../classy/logic");
|
|
35
|
+
var logic_1 = require("../../classy/logic/index.js");
|
|
36
36
|
Object.defineProperty(exports, "useLogic", { enumerable: true, get: function () { return logic_1.useLogic; } });
|
|
37
|
-
var instance_1 = require("../../classy/instance");
|
|
37
|
+
var instance_1 = require("../../classy/instance/index.js");
|
|
38
38
|
Object.defineProperty(exports, "useInstance", { enumerable: true, get: function () { return instance_1.useInstance; } });
|
|
39
|
-
var class_1 = require("../../classy/class");
|
|
39
|
+
var class_1 = require("../../classy/class/index.js");
|
|
40
40
|
Object.defineProperty(exports, "ClassComponent", { enumerable: true, get: function () { return class_1.ClassComponent; } });
|
|
41
41
|
/** @namespace */
|
|
42
|
-
exports.BaseClasses = __importStar(require("./base-classes"));
|
|
43
|
-
exports.Helpers = __importStar(require("../../helpers"));
|
|
44
|
-
exports.References = __importStar(require("./references"));
|
|
42
|
+
exports.BaseClasses = __importStar(require("./base-classes.js"));
|
|
43
|
+
exports.Helpers = __importStar(require("../../helpers/index.js"));
|
|
44
|
+
exports.References = __importStar(require("./references.js"));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * as $CleanState from '../../base/state';
|
|
2
|
-
export * as $ComponentMethods from '../../base/methods';
|
|
3
|
-
export * as ComponentLogic from '../../classy/logic';
|
|
4
|
-
export * as ComponentInstance from '../../classy/instance';
|
|
5
|
-
export * as ClassComponent from '../../classy/class';
|
|
1
|
+
export * as $CleanState from '../../base/state/index.js';
|
|
2
|
+
export * as $ComponentMethods from '../../base/methods.js';
|
|
3
|
+
export * as ComponentLogic from '../../classy/logic/index.js';
|
|
4
|
+
export * as ComponentInstance from '../../classy/instance/index.js';
|
|
5
|
+
export * as ClassComponent from '../../classy/class/index.js';
|
|
@@ -24,8 +24,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.ClassComponent = exports.ComponentInstance = exports.ComponentLogic = exports.$ComponentMethods = exports.$CleanState = void 0;
|
|
27
|
-
exports.$CleanState = __importStar(require("../../base/state"));
|
|
28
|
-
exports.$ComponentMethods = __importStar(require("../../base/methods"));
|
|
29
|
-
exports.ComponentLogic = __importStar(require("../../classy/logic"));
|
|
30
|
-
exports.ComponentInstance = __importStar(require("../../classy/instance"));
|
|
31
|
-
exports.ClassComponent = __importStar(require("../../classy/class"));
|
|
27
|
+
exports.$CleanState = __importStar(require("../../base/state/index.js"));
|
|
28
|
+
exports.$ComponentMethods = __importStar(require("../../base/methods.js"));
|
|
29
|
+
exports.ComponentLogic = __importStar(require("../../classy/logic/index.js"));
|
|
30
|
+
exports.ComponentInstance = __importStar(require("../../classy/instance/index.js"));
|
|
31
|
+
exports.ClassComponent = __importStar(require("../../classy/class/index.js"));
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* <!-- @ mergeModuleWith API -->
|
|
3
3
|
* @module Helpers
|
|
4
4
|
*/
|
|
5
|
-
export * from './mount-state';
|
|
6
|
-
export * from './rerender';
|
|
7
|
-
export * from './use-component';
|
|
8
|
-
export * from './type-guards';
|
|
5
|
+
export * from './mount-state.js';
|
|
6
|
+
export * from './rerender.js';
|
|
7
|
+
export * from './use-component/index.js';
|
|
8
|
+
export * from './type-guards.js';
|
|
9
9
|
/**
|
|
10
10
|
* An empty function.
|
|
11
11
|
* It returns (void) without performing any operations.
|
|
@@ -19,10 +19,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
19
19
|
};
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.noOp = void 0;
|
|
22
|
-
__exportStar(require("./mount-state"), exports);
|
|
23
|
-
__exportStar(require("./rerender"), exports);
|
|
24
|
-
__exportStar(require("./use-component"), exports);
|
|
25
|
-
__exportStar(require("./type-guards"), exports);
|
|
22
|
+
__exportStar(require("./mount-state.js"), exports);
|
|
23
|
+
__exportStar(require("./rerender.js"), exports);
|
|
24
|
+
__exportStar(require("./use-component/index.js"), exports);
|
|
25
|
+
__exportStar(require("./type-guards.js"), exports);
|
|
26
26
|
/**
|
|
27
27
|
* An empty function.
|
|
28
28
|
* It returns (void) without performing any operations.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useRerender = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
-
const mount_state_1 = require("../helpers/mount-state");
|
|
5
|
+
const mount_state_1 = require("../helpers/mount-state.js");
|
|
6
6
|
;
|
|
7
7
|
/**
|
|
8
8
|
* Returns a function that can be called to manually trigger
|
package/build/_cjs/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './classy';
|
|
2
|
-
export * from './base';
|
|
3
|
-
export * from './helpers';
|
|
1
|
+
export * from './classy/index.js';
|
|
2
|
+
export * from './base/index.js';
|
|
3
|
+
export * from './helpers/index.js';
|
package/build/_cjs/index.js
CHANGED
|
@@ -14,6 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./classy"), exports);
|
|
18
|
-
__exportStar(require("./base"), exports);
|
|
19
|
-
__exportStar(require("./helpers"), exports);
|
|
17
|
+
__exportStar(require("./classy/index.js"), exports);
|
|
18
|
+
__exportStar(require("./base/index.js"), exports);
|
|
19
|
+
__exportStar(require("./helpers/index.js"), exports);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactElement, ReactNode, ReactPortal } from 'react';
|
|
2
|
-
import type { IUseSlots, PotentialSlotComponent } from './types';
|
|
2
|
+
import type { IUseSlots, PotentialSlotComponent } from './types.js';
|
|
3
3
|
export declare const isElementChild: (child: ReactNode) => child is ReactElement<any, any>;
|
|
4
4
|
interface IGetSlotName {
|
|
5
5
|
(TargetComponent: PotentialSlotComponent, child?: ReactElement): string | undefined;
|
|
@@ -17,4 +17,4 @@ export declare const isPortalChild: (child: ReactNode) => child is ReactPortal;
|
|
|
17
17
|
* @see {@link SlotComponent} for more on how to use the returned slot nodes.
|
|
18
18
|
*/
|
|
19
19
|
export declare const useSlots: IUseSlots;
|
|
20
|
-
export type { SlottedComponent, TSlotsRecord, SlotComponent, PotentialSlotComponent, } from './types';
|
|
20
|
+
export type { SlottedComponent, TSlotsRecord, SlotComponent, PotentialSlotComponent, } from './types.js';
|
package/build/_cjs/slots/hook.js
CHANGED
|
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.useSlots = exports.isPortalChild = exports.getComponentSlotName = exports.isElementChild = void 0;
|
|
27
|
-
const errors_1 = require("../helpers/errors");
|
|
27
|
+
const errors_1 = require("../helpers/errors.js");
|
|
28
28
|
const react_1 = __importStar(require("react"));
|
|
29
29
|
const isElementChild = (child) => {
|
|
30
30
|
if (child && typeof child === 'object' && 'type' in child) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './hook';
|
|
1
|
+
export * from './hook.js';
|
|
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./hook"), exports);
|
|
17
|
+
__exportStar(require("./hook.js"), exports);
|
package/build/base/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './state';
|
|
2
|
-
export * from './methods';
|
|
3
|
-
export * from './merged-state';
|
|
1
|
+
export * from './state/index.js';
|
|
2
|
+
export * from './methods.js';
|
|
3
|
+
export * from './merged-state.js';
|
package/build/base/index.js
CHANGED
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./state"), exports);
|
|
18
|
-
__exportStar(require("./methods"), exports);
|
|
19
|
-
__exportStar(require("./merged-state"), exports);
|
|
1
|
+
export * from './state/index.js';
|
|
2
|
+
export * from './methods.js';
|
|
3
|
+
export * from './merged-state.js';
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useMergedState = void 0;
|
|
4
|
-
const react_1 = require("react");
|
|
1
|
+
import { useMemo, useRef, useState } from 'react';
|
|
5
2
|
class MergedState {
|
|
6
3
|
static useRefresh() {
|
|
7
|
-
[this._values_, this.setState] =
|
|
4
|
+
[this._values_, this.setState] = useState(this.initialState);
|
|
8
5
|
}
|
|
9
6
|
get put() {
|
|
10
7
|
return Object.assign({}, this._setters_);
|
|
@@ -50,11 +47,10 @@ class MergedState {
|
|
|
50
47
|
* Similar to {@link useCleanState},
|
|
51
48
|
* but uses a single `useState` call for the entire state object.
|
|
52
49
|
*/
|
|
53
|
-
const useMergedState = (initialState) => {
|
|
54
|
-
const cleanState =
|
|
50
|
+
export const useMergedState = (initialState) => {
|
|
51
|
+
const cleanState = useRef(useMemo(() => {
|
|
55
52
|
return new MergedState(initialState);
|
|
56
53
|
}, [])).current;
|
|
57
54
|
MergedState.useRefresh.call(cleanState);
|
|
58
55
|
return cleanState;
|
|
59
56
|
};
|
|
60
|
-
exports.useMergedState = useMergedState;
|
package/build/base/methods.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* @module ComponentMethods
|
|
4
3
|
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.useMethods = exports.ComponentMethods = void 0;
|
|
7
4
|
// Values
|
|
8
|
-
|
|
5
|
+
import { useMemo, useRef } from 'react';
|
|
9
6
|
/**
|
|
10
7
|
* @summary
|
|
11
8
|
* Base class for a class that holds methods for a function component.
|
|
@@ -16,7 +13,7 @@ const react_1 = require("react");
|
|
|
16
13
|
*
|
|
17
14
|
* Call the {@link useMethods} hook inside your function component to instantiate the class.
|
|
18
15
|
*/
|
|
19
|
-
class ComponentMethods {
|
|
16
|
+
export class ComponentMethods {
|
|
20
17
|
constructor() {
|
|
21
18
|
/**
|
|
22
19
|
* Persist class members during HMR. {@include ../classy/logic/hrm-preserve-keys.md}
|
|
@@ -26,7 +23,6 @@ class ComponentMethods {
|
|
|
26
23
|
this._hmrPreserveKeys = []; // @todo Keep undefined. Update to empty array after instantiation in dev env.
|
|
27
24
|
}
|
|
28
25
|
}
|
|
29
|
-
exports.ComponentMethods = ComponentMethods;
|
|
30
26
|
;
|
|
31
27
|
/**
|
|
32
28
|
* Returns an instance of the provided class,
|
|
@@ -44,8 +40,8 @@ const useMethods = (...args) => {
|
|
|
44
40
|
// In production, we only use the latestInstance the first time, and it's ignored every other time.
|
|
45
41
|
// This means changing the class at runtime will have no effect in production.
|
|
46
42
|
// latestInstance is only extracted into a separate variable for use in dev mode during HMR.
|
|
47
|
-
const latestInstance =
|
|
48
|
-
const instanceRef =
|
|
43
|
+
const latestInstance = useMemo(() => new Methods(), [Methods]);
|
|
44
|
+
const instanceRef = useRef(latestInstance);
|
|
49
45
|
const refreshState = () => {
|
|
50
46
|
// @ts-expect-error
|
|
51
47
|
instanceRef.current.props = props;
|
|
@@ -76,7 +72,7 @@ const useMethods = (...args) => {
|
|
|
76
72
|
refreshState();
|
|
77
73
|
return instanceRef.current;
|
|
78
74
|
};
|
|
79
|
-
|
|
75
|
+
export { useMethods };
|
|
80
76
|
/** /type_testing: {
|
|
81
77
|
let a = async () => {
|
|
82
78
|
const a: object = {b: ''};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CleanStateBase } from './class';
|
|
2
|
-
import { TCleanState, TStateData } from './hook-types';
|
|
1
|
+
import { CleanStateBase } from './class.js';
|
|
2
|
+
import { TCleanState, TStateData } from './hook-types.js';
|
|
3
3
|
export type TCleanStateBase = typeof CleanStateBase;
|
|
4
4
|
export type TCleanStateBaseKeys = keyof TCleanStateBase;
|
|
5
5
|
export type PutState<TState extends TStateData> = {
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ICleanStateClass, ICleanStateConstructor, PutManyPayload, PutState } from './class-types';
|
|
1
|
+
import type { ICleanStateClass, ICleanStateConstructor, PutManyPayload, PutState } from './class-types.js';
|
|
2
2
|
/** @internal */
|
|
3
3
|
export declare class CleanStateBase<TState extends Record<string, any>> {
|
|
4
4
|
readonly reservedKeys: string[];
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CleanState = exports.CleanStateBase = void 0;
|
|
4
|
-
const react_1 = require("react");
|
|
1
|
+
import { useState } from 'react';
|
|
5
2
|
/** @internal */
|
|
6
|
-
class CleanStateBase {
|
|
3
|
+
export class CleanStateBase {
|
|
7
4
|
constructor(initialState) {
|
|
8
5
|
this._values_ = {};
|
|
9
6
|
this._setters_ = {};
|
|
@@ -100,9 +97,8 @@ class CleanStateBase {
|
|
|
100
97
|
return Object.assign({}, this._initialValues_);
|
|
101
98
|
}
|
|
102
99
|
}
|
|
103
|
-
exports.CleanStateBase = CleanStateBase;
|
|
104
100
|
CleanStateBase.update = function update() {
|
|
105
|
-
if (!(this instanceof
|
|
101
|
+
if (!(this instanceof CleanState))
|
|
106
102
|
throw new Error('CleanState.update must be called with `this` value set to a CleanState instance. Did you forget to use `.call` or `.apply`? Example: CleanState.update.call(cleanState);');
|
|
107
103
|
/**
|
|
108
104
|
* Linters complain about the use of a React hook within a loop because:
|
|
@@ -113,7 +109,7 @@ CleanStateBase.update = function update() {
|
|
|
113
109
|
* and it guarantees that the same useState calls will be made on every render in the exact same order.
|
|
114
110
|
* Therefore, it is safe to silence the linters, and required for this implementation to work smoothly.
|
|
115
111
|
*/
|
|
116
|
-
const retrieveState =
|
|
112
|
+
const retrieveState = useState;
|
|
117
113
|
this.valueKeys.forEach((key) => {
|
|
118
114
|
// @todo Make state updates accessible immediately. Use state.staged to access the scheduled updates.
|
|
119
115
|
let setter;
|
|
@@ -126,4 +122,4 @@ CleanStateBase.update = function update() {
|
|
|
126
122
|
};
|
|
127
123
|
;
|
|
128
124
|
/** @internal */
|
|
129
|
-
|
|
125
|
+
export const CleanState = (CleanStateBase);
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|