@expressive/react 0.45.0 → 0.46.0

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/dist/index.js CHANGED
@@ -62,15 +62,15 @@ function createContext(value, children) {
62
62
  }
63
63
  function usingContext(from, resolve) {
64
64
  const waiting = Register.get(from);
65
- const context = (context2) => {
66
- resolve(context2.get(this));
65
+ const callback = (context) => {
66
+ resolve(context.get(this));
67
67
  };
68
68
  if (waiting instanceof import_mvc.Context)
69
- context(waiting);
69
+ callback(waiting);
70
70
  else if (waiting)
71
- waiting.push(context);
71
+ waiting.push(callback);
72
72
  else
73
- Register.set(from, [context]);
73
+ Register.set(from, [callback]);
74
74
  }
75
75
  function setContext(model, context) {
76
76
  const waiting = Register.get(model);
@@ -84,7 +84,7 @@ function useLocal(argument, repeat) {
84
84
  const state = (0, import_react2.useState)(() => {
85
85
  let enabled;
86
86
  let local;
87
- const instance = this.new(argument);
87
+ const instance = new this(argument);
88
88
  const release = instance.get((current) => {
89
89
  local = current;
90
90
  if (enabled)
@@ -106,6 +106,8 @@ function useLocal(argument, repeat) {
106
106
  const context = useContext();
107
107
  setContext(instance, context);
108
108
  context.has(instance);
109
+ if (!local)
110
+ instance.set();
109
111
  (0, import_react2.useEffect)(() => {
110
112
  enabled = true;
111
113
  return () => {
@@ -196,8 +198,8 @@ function Provider(props) {
196
198
  let { for: included, use: assign } = props;
197
199
  const ambient = useContext();
198
200
  const context = (0, import_react2.useMemo)(() => ambient.push(), []);
199
- context.include(included).forEach((isExplicit, model) => {
200
- if (assign && isExplicit)
201
+ context.include(included, (model, explicit) => {
202
+ if (assign && explicit)
201
203
  model.set(assign);
202
204
  setContext(model, context);
203
205
  });
package/dist/index.mjs CHANGED
@@ -29,15 +29,15 @@ function createContext(value, children) {
29
29
  }
30
30
  function usingContext(from, resolve) {
31
31
  const waiting = Register.get(from);
32
- const context = (context2) => {
33
- resolve(context2.get(this));
32
+ const callback = (context) => {
33
+ resolve(context.get(this));
34
34
  };
35
35
  if (waiting instanceof Context)
36
- context(waiting);
36
+ callback(waiting);
37
37
  else if (waiting)
38
- waiting.push(context);
38
+ waiting.push(callback);
39
39
  else
40
- Register.set(from, [context]);
40
+ Register.set(from, [callback]);
41
41
  }
42
42
  function setContext(model, context) {
43
43
  const waiting = Register.get(model);
@@ -51,7 +51,7 @@ function useLocal(argument, repeat) {
51
51
  const state = useState(() => {
52
52
  let enabled;
53
53
  let local;
54
- const instance = this.new(argument);
54
+ const instance = new this(argument);
55
55
  const release = instance.get((current) => {
56
56
  local = current;
57
57
  if (enabled)
@@ -73,6 +73,8 @@ function useLocal(argument, repeat) {
73
73
  const context = useContext();
74
74
  setContext(instance, context);
75
75
  context.has(instance);
76
+ if (!local)
77
+ instance.set();
76
78
  useEffect(() => {
77
79
  enabled = true;
78
80
  return () => {
@@ -163,8 +165,8 @@ function Provider(props) {
163
165
  let { for: included, use: assign } = props;
164
166
  const ambient = useContext();
165
167
  const context = useMemo(() => ambient.push(), []);
166
- context.include(included).forEach((isExplicit, model) => {
167
- if (assign && isExplicit)
168
+ context.include(included, (model, explicit) => {
169
+ if (assign && explicit)
168
170
  model.set(assign);
169
171
  setContext(model, context);
170
172
  });
package/package.json CHANGED
@@ -31,7 +31,7 @@
31
31
  "preversion": "npm run test && npm run build"
32
32
  },
33
33
  "dependencies": {
34
- "@expressive/mvc": "^0.45.0"
34
+ "@expressive/mvc": "^0.46.0"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "react": ">=16.8.0 <19.0.0"
@@ -42,6 +42,6 @@
42
42
  "react": "^18.2.0",
43
43
  "react-test-renderer": "^18.2.0"
44
44
  },
45
- "version": "0.45.0",
46
- "gitHead": "011596452831f785cc685c9124adff02176b489f"
45
+ "version": "0.46.0",
46
+ "gitHead": "22ffbbadad0ab45f73c71e178183941e78ed2a56"
47
47
  }