@lomray/react-mobx-manager 2.1.0-beta.1 → 2.1.0-beta.2

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/lib/context.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  import React from 'react';
3
3
  import { FC, ReactElement } from "react";
4
4
  import Manager from "./manager.js";
5
- import { TStores } from "./types-199a1271.js";
5
+ import { TStores } from "./types-c7e03f73.js";
6
6
  interface IStoreManagerProvider {
7
7
  storeManager: Manager;
8
8
  shouldInit?: boolean;
package/lib/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export * from "./types-199a1271.js";
1
+ export * from "./types-c7e03f73.js";
2
2
  export * from "./context.js";
3
3
  export { default as Manager } from "./manager.js";
4
4
  export { default as onChangeListener } from "./on-change-listener.js";
package/lib/manager.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import StoreStatus from "./store-status.js";
2
- import { IConstructableStore, IManagerOptions, IManagerParams, IStorage, IStore, IStoreParams, TInitStore, TStoreDefinition, TStores } from "./types-199a1271.js";
2
+ import { IConstructableStore, IManagerOptions, IManagerParams, IStorage, IStore, IStoreParams, TInitStore, TStoreDefinition, TStores } from "./types-c7e03f73.js";
3
3
  /**
4
4
  * Mobx stores manager
5
5
  */
@@ -1,4 +1,4 @@
1
- import { IStorePersisted } from "./types-199a1271.js";
1
+ import { IStorePersisted } from "./types-c7e03f73.js";
2
2
  /**
3
3
  * Listen persist store changes
4
4
  */
@@ -0,0 +1,3 @@
1
+ import Manager from "../../manager.js";
2
+ declare function connectDevExtension(storeManager: Manager): void;
3
+ export { connectDevExtension as default };
@@ -0,0 +1 @@
1
+ "use strict";var e=require("./state-listener.js");module.exports=function(s){window.__MOBX_STORE_MANAGER__=new e(s).subscribe()};
@@ -0,0 +1,55 @@
1
+ import Manager from "../../manager.js";
2
+ declare enum Listeners {
3
+ SPY = "spy"
4
+ }
5
+ /**
6
+ * State listener
7
+ */
8
+ declare class StateListener {
9
+ /**
10
+ * @protected
11
+ */
12
+ protected manager: Manager;
13
+ /**
14
+ * Store global listeners
15
+ * @protected
16
+ */
17
+ protected static listeners: Record<Listeners | string, () => void>;
18
+ /**
19
+ * @constructor
20
+ */
21
+ /**
22
+ * @constructor
23
+ */
24
+ constructor(manager: Manager);
25
+ /**
26
+ * Get context tree key
27
+ * @protected
28
+ */
29
+ /**
30
+ * Get context tree key
31
+ * @protected
32
+ */
33
+ protected getContextKey(contextId: string, nestedKey?: string): string;
34
+ /**
35
+ * Get stores state
36
+ * @protected
37
+ */
38
+ /**
39
+ * Get stores state
40
+ * @protected
41
+ */
42
+ protected getStoresState(): {
43
+ root: Record<string, any>;
44
+ };
45
+ /**
46
+ * Subscribe on stores changes
47
+ * @protected
48
+ */
49
+ /**
50
+ * Subscribe on stores changes
51
+ * @protected
52
+ */
53
+ subscribe(): Manager;
54
+ }
55
+ export { StateListener as default };
@@ -0,0 +1 @@
1
+ "use strict";var e=require("lodash"),t=require("mobx"),r=require("../../manager.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n,a=o(e);!function(e){e.SPY="spy"}(n||(n={}));class s{constructor(e){Object.defineProperty(this,"manager",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.manager=e,Object.values(s.listeners).forEach((e=>{e()}))}getContextKey(e,t){var r;if("root"===e)return e;const{parentId:o}=null!==(r=this.manager.getStoresRelations().get(e))&&void 0!==r?r:{};return o&&"root"!==o?this.getContextKey(o,`${o}.${null!=t?t:e}`):`${null!=o?o:"root"}.${null!=t?t:e}`}getStoresState(){const e={root:{}};try{const t=this.manager.getStores();this.manager.getStoresRelations().forEach((({ids:o,componentName:n},s)=>{const l=this.getContextKey(s);o.forEach((o=>{var s,i;const u=t.get(o);if(u){const t=null!==(i=null===(s=null==u?void 0:u.toJSON)||void 0===s?void 0:s.call(u))&&void 0!==i?i:r.getObservableProps(u);a.default.set(e,`${l}.stores.${o}`,t),a.default.set(e,`${l}.componentName`,n)}}))}))}catch(e){}return e}subscribe(){return s.listeners[n.SPY]=t.spy((e=>{var t,r;["report-end","reaction"].includes(e.type)||null===(r=null===(t=this.manager)||void 0===t?void 0:t.__devOnChange)||void 0===r||r.call(t,{event:a.default.cloneDeep(e),storesState:this.getStoresState()})})),this.manager}}Object.defineProperty(s,"listeners",{enumerable:!0,configurable:!0,writable:!0,value:{}}),module.exports=s;
@@ -1 +1 @@
1
- "use strict";var e=require("node:process"),r=require("./hydration-update-fix.js"),t=require("./id-generator.js");function n(e){if(e&&e.__esModule)return e;var r=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}})),r.default=e,Object.freeze(r)}var o=n(e);const i=e=>"production"===e||"production"===o.env.NODE_ENV;module.exports=function(){let e;return[{...r(),apply:()=>!i()},{name:t().name,configResolved({root:r}){e=t({root:r,isProd:i()})},transform(...r){var t;return null===(t=e.transform)||void 0===t?void 0:t.call(this,...r)},buildEnd(...r){var t;null===(t=e.buildEnd)||void 0===t||t.call(this,...r)}}]};
1
+ "use strict";var e=require("node:process"),r=require("./id-generator.js");function t(e){if(e&&e.__esModule)return e;var r=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}})),r.default=e,Object.freeze(r)}var n=t(e);module.exports=function(){let e;return[{name:r().name,configResolved({root:t}){var o;e=r({root:t,isProd:"production"===o||"production"===n.env.NODE_ENV})},transform(...r){var t;return null===(t=e.transform)||void 0===t?void 0:t.call(this,...r)},buildEnd(...r){var t;null===(t=e.buildEnd)||void 0===t||t.call(this,...r)}}]};
@@ -1,4 +1,4 @@
1
- import { IStorage } from "../types-199a1271.js";
1
+ import { IStorage } from "../types-c7e03f73.js";
2
2
  interface IAsyncStorage {
3
3
  getItem: (key: string) => Promise<string | null>;
4
4
  setItem: (key: string, value: string) => Promise<void>;
@@ -1,4 +1,4 @@
1
- import { IStorage } from "../types-199a1271.js";
1
+ import { IStorage } from "../types-c7e03f73.js";
2
2
  /**
3
3
  * Local storage for mobx store manager
4
4
  */
@@ -1,4 +1,4 @@
1
- import { TInitStore } from "./types-199a1271.js";
1
+ import { TInitStore } from "./types-c7e03f73.js";
2
2
  interface IPromise<TReturn> extends Promise<TReturn> {
3
3
  status?: 'fulfilled' | 'pending' | 'rejected';
4
4
  value?: TReturn;
package/lib/wakeup.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { TStores, TWakeup } from "./types-199a1271.js";
1
+ import { TStores, TWakeup } from "./types-c7e03f73.js";
2
2
  /**
3
3
  * Restore persisted store state
4
4
  */
@@ -1,5 +1,5 @@
1
1
  import { FC } from 'react';
2
- import { TMapStores, IWithStoreOptions } from "./types-199a1271.js";
2
+ import { TMapStores, IWithStoreOptions } from "./types-c7e03f73.js";
3
3
  /**
4
4
  * Make component observable and pass stores as props
5
5
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lomray/react-mobx-manager",
3
- "version": "2.1.0-beta.1",
3
+ "version": "2.1.0-beta.2",
4
4
  "description": "This package provides Mobx stores manager for react.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -55,33 +55,33 @@
55
55
  "@lomray/event-manager": "^2.0.2"
56
56
  },
57
57
  "devDependencies": {
58
- "@commitlint/cli": "^17.7.1",
59
- "@commitlint/config-conventional": "^17.7.0",
58
+ "@commitlint/cli": "^18.4.3",
59
+ "@commitlint/config-conventional": "^18.4.3",
60
60
  "@lomray/eslint-config-react": "^3.0.0",
61
61
  "@lomray/prettier-config": "^1.2.0",
62
- "@rollup/plugin-terser": "^0.4.3",
63
- "@types/hoist-non-react-statics": "^3.3.1",
64
- "@types/lodash": "^4.14.200",
65
- "@types/react": "^18.2.7",
66
- "eslint": "^8.41.0",
67
- "eslint-config-prettier": "^8.8.0",
68
- "eslint-plugin-jsx-a11y": "^6.7.1",
69
- "eslint-plugin-prettier": "^4.2.1",
62
+ "@rollup/plugin-terser": "^0.4.4",
63
+ "@types/hoist-non-react-statics": "^3.3.5",
64
+ "@types/lodash": "^4.14.202",
65
+ "@types/react": "^18.2.38",
66
+ "eslint": "^8.54.0",
67
+ "eslint-config-prettier": "^9.0.0",
68
+ "eslint-plugin-jsx-a11y": "^6.8.0",
69
+ "eslint-plugin-prettier": "^5.0.1",
70
70
  "husky": "^8.0.3",
71
- "lint-staged": "^13.2.2",
72
- "prettier": "^2.8.8",
71
+ "lint-staged": "^15.1.0",
72
+ "prettier": "^3.1.0",
73
73
  "rollup": "2.79.1",
74
- "rollup-plugin-ts": "^3.2.0",
75
- "semantic-release": "^21.0.2",
74
+ "rollup-plugin-ts": "^3.4.5",
75
+ "semantic-release": "^21.1.2",
76
76
  "ttypescript": "^1.5.15",
77
77
  "typescript": "^4.7.4",
78
- "vite": "^4.4.4"
78
+ "vite": "^4.5.0"
79
79
  },
80
80
  "peerDependencies": {
81
81
  "hoist-non-react-statics": "^3.3.2",
82
- "lodash": "^4.17.21",
83
- "mobx": "^6.9.0",
84
- "mobx-react-lite": "^3.4.3",
82
+ "lodash": ">=4.17.21",
83
+ "mobx": ">=6.9.0",
84
+ "mobx-react-lite": "^3 || ^4",
85
85
  "react": "^18 || ^17"
86
86
  }
87
87
  }
@@ -1,128 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- We as members, contributors, and leaders pledge to make participation in our
6
- community a harassment-free experience for everyone, regardless of age, body
7
- size, visible or invisible disability, ethnicity, sex characteristics, gender
8
- identity and expression, level of experience, education, socio-economic status,
9
- nationality, personal appearance, race, religion, or sexual identity
10
- and orientation.
11
-
12
- We pledge to act and interact in ways that contribute to an open, welcoming,
13
- diverse, inclusive, and healthy community.
14
-
15
- ## Our Standards
16
-
17
- Examples of behavior that contributes to a positive environment for our
18
- community include:
19
-
20
- * Demonstrating empathy and kindness toward other people
21
- * Being respectful of differing opinions, viewpoints, and experiences
22
- * Giving and gracefully accepting constructive feedback
23
- * Accepting responsibility and apologizing to those affected by our mistakes,
24
- and learning from the experience
25
- * Focusing on what is best not just for us as individuals, but for the
26
- overall community
27
-
28
- Examples of unacceptable behavior include:
29
-
30
- * The use of sexualized language or imagery, and sexual attention or
31
- advances of any kind
32
- * Trolling, insulting or derogatory comments, and personal or political attacks
33
- * Public or private harassment
34
- * Publishing others' private information, such as a physical or email
35
- address, without their explicit permission
36
- * Other conduct which could reasonably be considered inappropriate in a
37
- professional setting
38
-
39
- ## Enforcement Responsibilities
40
-
41
- Community leaders are responsible for clarifying and enforcing our standards of
42
- acceptable behavior and will take appropriate and fair corrective action in
43
- response to any behavior that they deem inappropriate, threatening, offensive,
44
- or harmful.
45
-
46
- Community leaders have the right and responsibility to remove, edit, or reject
47
- comments, commits, code, wiki edits, issues, and other contributions that are
48
- not aligned to this Code of Conduct, and will communicate reasons for moderation
49
- decisions when appropriate.
50
-
51
- ## Scope
52
-
53
- This Code of Conduct applies within all community spaces, and also applies when
54
- an individual is officially representing the community in public spaces.
55
- Examples of representing our community include using an official e-mail address,
56
- posting via an official social media account, or acting as an appointed
57
- representative at an online or offline event.
58
-
59
- ## Enforcement
60
-
61
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
- reported to the community leaders responsible for enforcement at
63
- Github issues.
64
- All complaints will be reviewed and investigated promptly and fairly.
65
-
66
- All community leaders are obligated to respect the privacy and security of the
67
- reporter of any incident.
68
-
69
- ## Enforcement Guidelines
70
-
71
- Community leaders will follow these Community Impact Guidelines in determining
72
- the consequences for any action they deem in violation of this Code of Conduct:
73
-
74
- ### 1. Correction
75
-
76
- **Community Impact**: Use of inappropriate language or other behavior deemed
77
- unprofessional or unwelcome in the community.
78
-
79
- **Consequence**: A private, written warning from community leaders, providing
80
- clarity around the nature of the violation and an explanation of why the
81
- behavior was inappropriate. A public apology may be requested.
82
-
83
- ### 2. Warning
84
-
85
- **Community Impact**: A violation through a single incident or series
86
- of actions.
87
-
88
- **Consequence**: A warning with consequences for continued behavior. No
89
- interaction with the people involved, including unsolicited interaction with
90
- those enforcing the Code of Conduct, for a specified period of time. This
91
- includes avoiding interactions in community spaces as well as external channels
92
- like social media. Violating these terms may lead to a temporary or
93
- permanent ban.
94
-
95
- ### 3. Temporary Ban
96
-
97
- **Community Impact**: A serious violation of community standards, including
98
- sustained inappropriate behavior.
99
-
100
- **Consequence**: A temporary ban from any sort of interaction or public
101
- communication with the community for a specified period of time. No public or
102
- private interaction with the people involved, including unsolicited interaction
103
- with those enforcing the Code of Conduct, is allowed during this period.
104
- Violating these terms may lead to a permanent ban.
105
-
106
- ### 4. Permanent Ban
107
-
108
- **Community Impact**: Demonstrating a pattern of violation of community
109
- standards, including sustained inappropriate behavior, harassment of an
110
- individual, or aggression toward or disparagement of classes of individuals.
111
-
112
- **Consequence**: A permanent ban from any sort of public interaction within
113
- the community.
114
-
115
- ## Attribution
116
-
117
- This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
- version 2.0, available at
119
- https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120
-
121
- Community Impact Guidelines were inspired by [Mozilla's code of conduct
122
- enforcement ladder](https://github.com/mozilla/diversity).
123
-
124
- [homepage]: https://www.contributor-covenant.org
125
-
126
- For answers to common questions about this code of conduct, see the FAQ at
127
- https://www.contributor-covenant.org/faq. Translations are available at
128
- https://www.contributor-covenant.org/translations.
package/CONTRIBUTING.md DELETED
@@ -1,88 +0,0 @@
1
- # Contributing
2
-
3
- When contributing to this repository, please first discuss the change you wish to make via issue,
4
- email, or any other method with the owners of this repository before making a change.
5
-
6
- Please note we have a code of conduct, please follow it in all your interactions with the project.
7
-
8
- ## Pull Request Process
9
-
10
- 1. Ensure any unused install dependencies are removed before create PR.
11
- 2. Update the README.md with details of changes to the interface.
12
- 3. You may merge the Pull Request in once you have the sign-off of two other developers, or if you
13
- do not have permission to do that, you may request the second reviewer to merge it for you.
14
-
15
- ## Code of Conduct
16
-
17
- ### Our Pledge
18
-
19
- In the interest of fostering an open and welcoming environment, we as
20
- contributors and maintainers pledge to making participation in our project and
21
- our community a harassment-free experience for everyone, regardless of age, body
22
- size, disability, ethnicity, gender identity and expression, level of experience,
23
- nationality, personal appearance, race, religion, or sexual identity and
24
- orientation.
25
-
26
- ### Our Standards
27
-
28
- Examples of behavior that contributes to creating a positive environment
29
- include:
30
-
31
- * Using welcoming and inclusive language
32
- * Being respectful of differing viewpoints and experiences
33
- * Gracefully accepting constructive criticism
34
- * Focusing on what is best for the community
35
- * Showing empathy towards other community members
36
-
37
- Examples of unacceptable behavior by participants include:
38
-
39
- * The use of sexualized language or imagery and unwelcome sexual attention or
40
- advances
41
- * Trolling, insulting/derogatory comments, and personal or political attacks
42
- * Public or private harassment
43
- * Publishing others' private information, such as a physical or electronic
44
- address, without explicit permission
45
- * Other conduct which could reasonably be considered inappropriate in a
46
- professional setting
47
-
48
- ### Our Responsibilities
49
-
50
- Project maintainers are responsible for clarifying the standards of acceptable
51
- behavior and are expected to take appropriate and fair corrective action in
52
- response to any instances of unacceptable behavior.
53
-
54
- Project maintainers have the right and responsibility to remove, edit, or
55
- reject comments, commits, code, wiki edits, issues, and other contributions
56
- that are not aligned to this Code of Conduct, or to ban temporarily or
57
- permanently any contributor for other behaviors that they deem inappropriate,
58
- threatening, offensive, or harmful.
59
-
60
- ### Scope
61
-
62
- This Code of Conduct applies both within project spaces and in public spaces
63
- when an individual is representing the project or its community. Examples of
64
- representing a project or community include using an official project e-mail
65
- address, posting via an official social media account, or acting as an appointed
66
- representative at an online or offline event. Representation of a project may be
67
- further defined and clarified by project maintainers.
68
-
69
- ### Enforcement
70
-
71
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
72
- reported by contacting the project team at [INSERT EMAIL ADDRESS]. All
73
- complaints will be reviewed and investigated and will result in a response that
74
- is deemed necessary and appropriate to the circumstances. The project team is
75
- obligated to maintain confidentiality with regard to the reporter of an incident.
76
- Further details of specific enforcement policies may be posted separately.
77
-
78
- Project maintainers who do not follow or enforce the Code of Conduct in good
79
- faith may face temporary or permanent repercussions as determined by other
80
- members of the project's leadership.
81
-
82
- ### Attribution
83
-
84
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
85
- available at [http://contributor-covenant.org/version/1/4][version]
86
-
87
- [homepage]: http://contributor-covenant.org
88
- [version]: http://contributor-covenant.org/version/1/4/
package/SECURITY.md DELETED
@@ -1,11 +0,0 @@
1
- # Security Policy
2
-
3
- ## Supported Versions
4
-
5
- | Version | Supported |
6
- | ------- | ------------------ |
7
- | 1.1.x | :white_check_mark: |
8
-
9
- ## Reporting a Vulnerability
10
-
11
- Please report (suspected) security vulnerabilities to this repository issues.
@@ -1,7 +0,0 @@
1
- import { Plugin } from 'vite';
2
- /**
3
- * Fix mobx lite suspense hydration
4
- * @constructor
5
- */
6
- declare function HydrationUpdateFix(): Plugin;
7
- export { HydrationUpdateFix as default };
@@ -1 +0,0 @@
1
- "use strict";var e=require("node:path");module.exports=function(){return{name:"@lomray/react-mobx-manager-hydration-fix",transform(r,t){const n=e.extname(t).split("?")[0];if([".js",".ts",".tsx"].includes(n)&&r.includes("function useObserver"))return{code:r.replace(/(}\);[^f]+)(forceUpdate\(\);)/s,"$1/*$2*/"),map:{mappings:""}}}}};
package/logo.png DELETED
Binary file