reca 0.0.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.
Files changed (38) hide show
  1. package/README.md +1 -0
  2. package/dist/__fixtures__/components/TestUseStoreComponent.d.ts +2 -0
  3. package/dist/__fixtures__/components/TestUseStoreComponent.js +8 -0
  4. package/dist/__fixtures__/components/TestUseStoreComponent.js.map +1 -0
  5. package/dist/__fixtures__/components/TestWithStoreComponent.d.ts +2 -0
  6. package/dist/__fixtures__/components/TestWithStoreComponent.js +5 -0
  7. package/dist/__fixtures__/components/TestWithStoreComponent.js.map +1 -0
  8. package/dist/__fixtures__/stores/LiveCycleStore.d.ts +12 -0
  9. package/dist/__fixtures__/stores/LiveCycleStore.js +18 -0
  10. package/dist/__fixtures__/stores/LiveCycleStore.js.map +1 -0
  11. package/dist/__tests__/livecycle.spec.d.ts +1 -0
  12. package/dist/__tests__/livecycle.spec.js +30 -0
  13. package/dist/__tests__/livecycle.spec.js.map +1 -0
  14. package/dist/config.d.ts +7 -0
  15. package/dist/config.js +12 -0
  16. package/dist/config.js.map +1 -0
  17. package/dist/decorators/reflesction.d.ts +1 -0
  18. package/dist/decorators/reflesction.js +2 -0
  19. package/dist/decorators/reflesction.js.map +1 -0
  20. package/dist/functions/WithStore.d.ts +2 -0
  21. package/dist/functions/WithStore.js +9 -0
  22. package/dist/functions/WithStore.js.map +1 -0
  23. package/dist/hooks/UseStore.d.ts +10 -0
  24. package/dist/hooks/UseStore.js +37 -0
  25. package/dist/hooks/UseStore.js.map +1 -0
  26. package/dist/index.d.ts +4 -0
  27. package/dist/index.js +5 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/interfaces/IClassCostructor.d.ts +3 -0
  30. package/dist/interfaces/IClassCostructor.js +2 -0
  31. package/dist/interfaces/IClassCostructor.js.map +1 -0
  32. package/dist/interfaces/IWithStore.d.ts +8 -0
  33. package/dist/interfaces/IWithStore.js +2 -0
  34. package/dist/interfaces/IWithStore.js.map +1 -0
  35. package/dist/stores/Store.d.ts +49 -0
  36. package/dist/stores/Store.js +64 -0
  37. package/dist/stores/Store.js.map +1 -0
  38. package/package.json +39 -0
package/README.md ADDED
@@ -0,0 +1 @@
1
+ ..in progress
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const TestUseStoreComponent: (props: Record<string, unknown>) => JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useStore } from "../../hooks/UseStore";
3
+ import { LiveCycleStore } from "../stores/LiveCycleStore";
4
+ export const TestUseStoreComponent = (props) => {
5
+ const store = useStore(LiveCycleStore, props);
6
+ return (_jsx("div", { children: store.state }));
7
+ };
8
+ //# sourceMappingURL=TestUseStoreComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TestUseStoreComponent.js","sourceRoot":"","sources":["../../../src/__fixtures__/components/TestUseStoreComponent.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAC,cAAc,EAAC,MAAM,0BAA0B,CAAC;AAExD,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,KAA8B,EAAE,EAAE;IAEpE,MAAM,KAAK,GAAG,QAAQ,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IAE9C,OAAO,CACH,wBACK,KAAK,CAAC,KAAK,GACV,CACT,CAAC;AACN,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const TestWithStoreComponent: (props?: {} | undefined) => JSX.Element | null;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { withStore } from "../../index";
3
+ import { LiveCycleStore } from "../stores/LiveCycleStore";
4
+ export const TestWithStoreComponent = withStore(LiveCycleStore, (lcStore, props) => (_jsx("div", { children: lcStore.state })));
5
+ //# sourceMappingURL=TestWithStoreComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TestWithStoreComponent.js","sourceRoot":"","sources":["../../../src/__fixtures__/components/TestWithStoreComponent.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,cAAc,EAAC,MAAM,0BAA0B,CAAC;AAExD,MAAM,CAAC,MAAM,sBAAsB,GAAG,SAAS,CAAC,cAAc,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,CAChF,wBACK,OAAO,CAAC,KAAK,GACZ,CACT,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { Store } from "../../stores/Store";
2
+ declare type ILiveCycleStoreProps = {
3
+ val?: string;
4
+ };
5
+ export declare class LiveCycleStore extends Store<ILiveCycleStoreProps> {
6
+ state: string;
7
+ constructor();
8
+ activate(): void;
9
+ update(): void;
10
+ dispose(): void;
11
+ }
12
+ export {};
@@ -0,0 +1,18 @@
1
+ import { Store } from "../../stores/Store";
2
+ export class LiveCycleStore extends Store {
3
+ constructor() {
4
+ super();
5
+ this.state = "init";
6
+ this.state = "constructor";
7
+ }
8
+ activate() {
9
+ this.state = "activate";
10
+ }
11
+ update() {
12
+ this.state = "update";
13
+ }
14
+ dispose() {
15
+ this.state = "dispose";
16
+ }
17
+ }
18
+ //# sourceMappingURL=LiveCycleStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LiveCycleStore.js","sourceRoot":"","sources":["../../../src/__fixtures__/stores/LiveCycleStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,oBAAoB,CAAC;AAMzC,MAAM,OAAO,cAAe,SAAQ,KAA2B;IAI3D;QACI,KAAK,EAAE,CAAC;QAHL,UAAK,GAAW,MAAM,CAAC;QAI1B,IAAI,CAAC,KAAK,GAAG,aAAa,CAAC;IAC/B,CAAC;IAEM,QAAQ;QACX,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC;IAC5B,CAAC;IAEM,MAAM;QACT,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC;IAC1B,CAAC;IAEM,OAAO;QACV,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;IAC3B,CAAC;CACJ"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,30 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ import { mount } from 'enzyme';
12
+ import { TestUseStoreComponent } from "../__fixtures__/components/TestUseStoreComponent";
13
+ import { TestWithStoreComponent } from "../__fixtures__/components/TestWithStoreComponent";
14
+ describe("Livecycles must work", () => {
15
+ test('useStore livecycle', () => __awaiter(void 0, void 0, void 0, function* () {
16
+ const testComponent = mount(_jsx(TestUseStoreComponent, {}));
17
+ expect(testComponent.html()).toEqual(`<div>constructor</div>`);
18
+ testComponent.setProps({});
19
+ expect(testComponent.html()).toEqual(`<div>activate</div>`);
20
+ testComponent.unmount();
21
+ }));
22
+ test('withStore livecycle', () => __awaiter(void 0, void 0, void 0, function* () {
23
+ const testComponent = mount(_jsx(TestWithStoreComponent, {}));
24
+ expect(testComponent.html()).toEqual(`<div>constructor</div>`);
25
+ testComponent.setProps({});
26
+ expect(testComponent.html()).toEqual(`<div>activate</div>`);
27
+ testComponent.unmount();
28
+ }));
29
+ });
30
+ //# sourceMappingURL=livecycle.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"livecycle.spec.js","sourceRoot":"","sources":["../../src/__tests__/livecycle.spec.tsx"],"names":[],"mappings":";;;;;;;;;;AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAC,qBAAqB,EAAC,MAAM,kDAAkD,CAAC;AACvF,OAAO,EAAC,sBAAsB,EAAC,MAAM,mDAAmD,CAAC;AAEzF,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IAClC,IAAI,CAAC,oBAAoB,EAAE,GAAS,EAAE;QAElC,MAAM,aAAa,GAAG,KAAK,CAAC,KAAC,qBAAqB,KAAG,CAAC,CAAC;QACvD,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC;QAE/D,aAAa,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAC3B,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;QAE5D,aAAa,CAAC,OAAO,EAAE,CAAC;IAE5B,CAAC,CAAA,CAAC,CAAC;IAEH,IAAI,CAAC,qBAAqB,EAAE,GAAS,EAAE;QAEnC,MAAM,aAAa,GAAG,KAAK,CAAC,KAAC,sBAAsB,KAAG,CAAC,CAAC;QACxD,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC;QAE/D,aAAa,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAC3B,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;QAE5D,aAAa,CAAC,OAAO,EAAE,CAAC;IAE5B,CAAC,CAAA,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ export declare class DiConfig {
2
+ resolver: string;
3
+ }
4
+ export declare class Config {
5
+ di: DiConfig;
6
+ }
7
+ export declare const config: Config;
package/dist/config.js ADDED
@@ -0,0 +1,12 @@
1
+ export class DiConfig {
2
+ constructor() {
3
+ this.resolver = "insert di resolver here";
4
+ }
5
+ }
6
+ export class Config {
7
+ constructor() {
8
+ this.di = new DiConfig();
9
+ }
10
+ }
11
+ export const config = new Config();
12
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,MAAM,OAAO,QAAQ;IAArB;QACW,aAAQ,GAAW,yBAAyB,CAAC;IACxD,CAAC;CAAA;AAED,MAAM,OAAO,MAAM;IAAnB;QACW,OAAE,GAAa,IAAI,QAAQ,EAAE,CAAC;IACzC,CAAC;CAAA;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const reflection: () => undefined;
@@ -0,0 +1,2 @@
1
+ export const reflection = () => void 0;
2
+ //# sourceMappingURL=reflesction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reflesction.js","sourceRoot":"","sources":["../../src/decorators/reflesction.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { IWithStore } from "./../interfaces/IWithStore";
2
+ export declare const withStore: IWithStore;
@@ -0,0 +1,9 @@
1
+ import { useStore } from "../hooks/UseStore";
2
+ export const withStore = (...storeOrView) => (props) => {
3
+ const stores = storeOrView
4
+ .slice(0, -1)
5
+ .map((storeConstructor) => useStore(storeConstructor, props));
6
+ const view = storeOrView[storeOrView.length - 1];
7
+ return view(...stores, props);
8
+ };
9
+ //# sourceMappingURL=WithStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WithStore.js","sourceRoot":"","sources":["../../src/functions/WithStore.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAQ3C,MAAM,CAAC,MAAM,SAAS,GAAe,CACjC,GAAG,WAAsB,EAC3B,EAAE,CAAC,CAAC,KAAS,EAAE,EAAE;IAEf,MAAM,MAAM,GAAG,WAAW;SACrB,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SACZ,GAAG,CAAC,CAAC,gBAAgB,EAAE,EAAE,CAAC,QAAQ,CAAC,gBAAwC,EAAE,KAAK,CAAC,CAAC,CAAC;IAE1F,MAAM,IAAI,GAAG,WAAW,CAAC,WAAW,CAAC,MAAM,GAAE,CAAC,CAAoD,CAAC;IACnG,OAAO,IAAI,CAAC,GAAG,MAAM,EAAE,KAAK,CAAC,CAAC;AAClC,CAAC,CAAA"}
@@ -0,0 +1,10 @@
1
+ import { IDiClassCostructor } from "../interfaces/IClassCostructor";
2
+ import { Store } from "../stores/Store";
3
+ /**
4
+ * todo: add DI here
5
+ *
6
+ * @param store
7
+ * @param props
8
+ * @returns
9
+ */
10
+ export declare const useStore: <P extends Record<string, unknown>, T extends Store<P>>(store: new (...params: IDiClassCostructor[]) => T, props?: P | undefined) => T;
@@ -0,0 +1,37 @@
1
+ import { useEffect, useState } from "react";
2
+ /**
3
+ * todo: add DI here
4
+ *
5
+ * @param store
6
+ * @param props
7
+ * @returns
8
+ */
9
+ export const useStore = (store, props) => {
10
+ // Render function
11
+ const [, setSeed] = useState(0);
12
+ // Constructor
13
+ let isInit = false;
14
+ const [stateStore] = useState(() => {
15
+ isInit = true;
16
+ const stateStore = new store();
17
+ stateStore.setRedrawFunction(() => {
18
+ setSeed(Math.random());
19
+ });
20
+ return stateStore;
21
+ });
22
+ // Activate and Update methods
23
+ useEffect(() => {
24
+ if (isInit) {
25
+ stateStore.activate(props !== null && props !== void 0 ? props : {});
26
+ }
27
+ else {
28
+ stateStore.update(props !== null && props !== void 0 ? props : {});
29
+ }
30
+ });
31
+ // Destructor
32
+ useEffect(() => {
33
+ return () => stateStore.dispose();
34
+ }, []);
35
+ return stateStore;
36
+ };
37
+ //# sourceMappingURL=UseStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UseStore.js","sourceRoot":"","sources":["../../src/hooks/UseStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAI5C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CACpB,KAAiD,EACjD,KAAS,EACR,EAAE;IAEH,kBAAkB;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAEhC,cAAc;IACd,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,MAAM,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE;QAC/B,MAAM,GAAG,IAAI,CAAC;QAEd,MAAM,UAAU,GAAG,IAAI,KAAK,EAAE,CAAC;QAE/B,UAAU,CAAC,iBAAiB,CAAC,GAAG,EAAE;YAC9B,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;QAEH,OAAO,UAAU,CAAC;IACtB,CAAC,CAAC,CAAC;IAEH,8BAA8B;IAC9B,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,MAAM,EAAE;YACR,UAAU,CAAC,QAAQ,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAO,CAAC,CAAC;SACzC;aAAM;YACH,UAAU,CAAC,MAAM,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAO,CAAC,CAAC;SACvC;IACL,CAAC,CAAC,CAAC;IAEH,aAAa;IACb,SAAS,CAAC,GAAG,EAAE;QACX,OAAO,GAAG,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;IACtC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,UAAU,CAAC;AACtB,CAAC,CAAA"}
@@ -0,0 +1,4 @@
1
+ export * from "./hooks/UseStore";
2
+ export * from "./functions/WithStore";
3
+ export * from "./decorators/reflesction";
4
+ export * from "./config";
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ export * from "./hooks/UseStore";
2
+ export * from "./functions/WithStore";
3
+ export * from "./decorators/reflesction";
4
+ export * from "./config";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AAEtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,UAAU,CAAC"}
@@ -0,0 +1,3 @@
1
+ export interface IDiClassCostructor {
2
+ new (...params: (new (...params: IDiClassCostructor[]) => this)[]): this;
3
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IClassCostructor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IClassCostructor.js","sourceRoot":"","sources":["../../src/interfaces/IClassCostructor.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { Store } from "../stores/Store";
3
+ import { IDiClassCostructor } from "./IClassCostructor";
4
+ export interface IWithStore<P extends Record<string, unknown> = {}> {
5
+ (view: (props?: P) => JSX.Element | null): (props?: P) => JSX.Element | null;
6
+ <T1 extends Store<P>>(store1: new (...params: IDiClassCostructor[]) => T1, view: (store1: T1, props?: P) => JSX.Element | null): (props?: P) => JSX.Element | null;
7
+ <T1 extends Store<P>, T2 extends Store<P>>(store1: new (...params: IDiClassCostructor[]) => T1, store2: new (...params: IDiClassCostructor[]) => T2, view: (store1: T1, store2: T2, props?: P) => JSX.Element | null): (props?: P) => JSX.Element | null;
8
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IWithStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IWithStore.js","sourceRoot":"","sources":["../../src/interfaces/IWithStore.ts"],"names":[],"mappings":""}
@@ -0,0 +1,49 @@
1
+ export declare class Store<T extends Record<string, unknown> = {}> {
2
+ private redrawFunction;
3
+ /**
4
+ * Method for override in nested store.
5
+ * Run after first rendering component in DOM.
6
+ *
7
+ * @description
8
+ * Encapsulate:
9
+ * useEffect(() => {
10
+ * if (isInit) {
11
+ * store.activate(props);
12
+ * }
13
+ * });
14
+ */
15
+ activate(props: T): void;
16
+ /**
17
+ * Method for override in nested store.
18
+ * Run after second and others rendering component in DOM.
19
+ *
20
+ * @description
21
+ * Encapsulate:
22
+ * useEffect(() => {
23
+ * if (!isInit) {
24
+ * store.activate(props);
25
+ * }
26
+ * });
27
+ */
28
+ update(props: T): void;
29
+ /**
30
+ * Method for override in nested store.
31
+ * Run after second and others rendering component in DOM.
32
+ *
33
+ * @description
34
+ * Encapsulate:
35
+ * useEffect(() => {
36
+ * return () => store.dispose();
37
+ * }, []);
38
+ */
39
+ dispose(): void;
40
+ setRedrawFunction(updateFunction: () => void): void;
41
+ /**
42
+ * Update view on next requestAnimationFrame
43
+ */
44
+ redraw(): void;
45
+ /**
46
+ * Update view component immediately
47
+ */
48
+ forceRedraw(): void;
49
+ }
@@ -0,0 +1,64 @@
1
+ export class Store {
2
+ constructor() {
3
+ this.redrawFunction = () => void 0;
4
+ }
5
+ /**
6
+ * Method for override in nested store.
7
+ * Run after first rendering component in DOM.
8
+ *
9
+ * @description
10
+ * Encapsulate:
11
+ * useEffect(() => {
12
+ * if (isInit) {
13
+ * store.activate(props);
14
+ * }
15
+ * });
16
+ */
17
+ activate(props) {
18
+ // override
19
+ }
20
+ /**
21
+ * Method for override in nested store.
22
+ * Run after second and others rendering component in DOM.
23
+ *
24
+ * @description
25
+ * Encapsulate:
26
+ * useEffect(() => {
27
+ * if (!isInit) {
28
+ * store.activate(props);
29
+ * }
30
+ * });
31
+ */
32
+ update(props) {
33
+ // override
34
+ }
35
+ /**
36
+ * Method for override in nested store.
37
+ * Run after second and others rendering component in DOM.
38
+ *
39
+ * @description
40
+ * Encapsulate:
41
+ * useEffect(() => {
42
+ * return () => store.dispose();
43
+ * }, []);
44
+ */
45
+ dispose() {
46
+ // override
47
+ }
48
+ setRedrawFunction(updateFunction) {
49
+ this.redrawFunction = updateFunction;
50
+ }
51
+ /**
52
+ * Update view on next requestAnimationFrame
53
+ */
54
+ redraw() {
55
+ requestAnimationFrame(() => this.redrawFunction());
56
+ }
57
+ /**
58
+ * Update view component immediately
59
+ */
60
+ forceRedraw() {
61
+ this.redrawFunction();
62
+ }
63
+ }
64
+ //# sourceMappingURL=Store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Store.js","sourceRoot":"","sources":["../../src/stores/Store.ts"],"names":[],"mappings":"AACA,MAAM,OAAO,KAAK;IAAlB;QAEY,mBAAc,GAAe,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;IAkEtD,CAAC;IAhEG;;;;;;;;;;;OAWG;IACI,QAAQ,CAAC,KAAQ;QACpB,WAAW;IACf,CAAC;IAED;;;;;;;;;;;OAWG;IACI,MAAM,CAAC,KAAQ;QAClB,WAAW;IACf,CAAC;IAED;;;;;;;;;OASG;IACI,OAAO;QACV,WAAW;IACf,CAAC;IAEM,iBAAiB,CAAC,cAA0B;QAC/C,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACzC,CAAC;IAED;;OAEG;IACI,MAAM;QACT,qBAAqB,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;IACvD,CAAC;IAED;;OAEG;IACI,WAAW;QACd,IAAI,CAAC,cAAc,EAAE,CAAC;IAC1B,CAAC;CAEJ"}
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "reca",
3
+ "version": "0.0.1",
4
+ "description": "ReCA - React Clean Architecture state manager",
5
+ "main": "dist/index.js",
6
+ "type": "module",
7
+ "scripts": {
8
+ "build": "npm run clean && tsc",
9
+ "clean":"rimraf ./dist",
10
+ "test": "jest",
11
+ "test:watch": "jest --watch"
12
+ },
13
+ "keywords": [
14
+ "react",
15
+ "state manager"
16
+ ],
17
+ "author": "LabEG",
18
+ "license": "MIT",
19
+ "peerDependencies": {
20
+ "react": ">=17.0.0"
21
+ },
22
+ "devDependencies": {
23
+ "@babel/preset-env": "^7.16.11",
24
+ "@babel/preset-react": "^7.16.7",
25
+ "@babel/preset-typescript": "^7.16.7",
26
+ "@labeg/code-style": "^2.0.31",
27
+ "@types/enzyme": "^3.10.12",
28
+ "@types/jest": "^27.4.1",
29
+ "@types/react": "^17.0.39",
30
+ "@wojtekmaj/enzyme-adapter-react-17": "^0.6.7",
31
+ "babel-jest": "^27.5.1",
32
+ "enzyme": "^3.11.0",
33
+ "jest": "^27.5.1",
34
+ "react": "^17.0.2",
35
+ "react-dom": "^17.0.2",
36
+ "rimraf": "^3.0.2",
37
+ "typescript": "^4.6.3"
38
+ }
39
+ }