esp-js-react 9.0.0-beta.3 → 9.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.
- package/.dist/esp-react.esm.mjs +15 -326
- package/.dist/esp-react.esm.mjs.map +1 -1
- package/.dist/esp-react.js +34 -345
- package/.dist/esp-react.js.map +1 -1
- package/.dist/esp-react.min.js +1 -1
- package/.dist/esp-react.min.js.map +1 -1
- package/.dist/typings/connectableComponent.d.ts +1 -1
- package/.dist/typings/espApp.d.ts +1 -1
- package/.dist/typings/espEventBusContextProvider.d.ts +4 -3
- package/.dist/typings/espStoreContextProvider.d.ts +6 -5
- package/.dist/typings/regionView.d.ts +2 -1
- package/package.json +4 -6
package/.dist/esp-react.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
2
|
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react"), require("esp-js")) : typeof define === "function" && define.amd ? define(["exports", "react", "esp-js"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.espReact = {}, global.React, global.espJs));
|
|
3
|
-
})(this, function(exports2,
|
|
3
|
+
})(this, function(exports2, React, espJs) {
|
|
4
4
|
"use strict";
|
|
5
5
|
function _interopNamespaceDefault(e) {
|
|
6
6
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
@@ -18,321 +18,10 @@
|
|
|
18
18
|
n.default = e;
|
|
19
19
|
return Object.freeze(n);
|
|
20
20
|
}
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
var reactJsxRuntime_production = {};
|
|
24
|
-
/**
|
|
25
|
-
* @license React
|
|
26
|
-
* react-jsx-runtime.production.js
|
|
27
|
-
*
|
|
28
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
29
|
-
*
|
|
30
|
-
* This source code is licensed under the MIT license found in the
|
|
31
|
-
* LICENSE file in the root directory of this source tree.
|
|
32
|
-
*/
|
|
33
|
-
var hasRequiredReactJsxRuntime_production;
|
|
34
|
-
function requireReactJsxRuntime_production() {
|
|
35
|
-
if (hasRequiredReactJsxRuntime_production) return reactJsxRuntime_production;
|
|
36
|
-
hasRequiredReactJsxRuntime_production = 1;
|
|
37
|
-
var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
|
|
38
|
-
function jsxProd(type, config, maybeKey) {
|
|
39
|
-
var key = null;
|
|
40
|
-
void 0 !== maybeKey && (key = "" + maybeKey);
|
|
41
|
-
void 0 !== config.key && (key = "" + config.key);
|
|
42
|
-
if ("key" in config) {
|
|
43
|
-
maybeKey = {};
|
|
44
|
-
for (var propName in config)
|
|
45
|
-
"key" !== propName && (maybeKey[propName] = config[propName]);
|
|
46
|
-
} else maybeKey = config;
|
|
47
|
-
config = maybeKey.ref;
|
|
48
|
-
return {
|
|
49
|
-
$$typeof: REACT_ELEMENT_TYPE,
|
|
50
|
-
type,
|
|
51
|
-
key,
|
|
52
|
-
ref: void 0 !== config ? config : null,
|
|
53
|
-
props: maybeKey
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
reactJsxRuntime_production.Fragment = REACT_FRAGMENT_TYPE;
|
|
57
|
-
reactJsxRuntime_production.jsx = jsxProd;
|
|
58
|
-
reactJsxRuntime_production.jsxs = jsxProd;
|
|
59
|
-
return reactJsxRuntime_production;
|
|
60
|
-
}
|
|
61
|
-
var reactJsxRuntime_development = {};
|
|
62
|
-
/**
|
|
63
|
-
* @license React
|
|
64
|
-
* react-jsx-runtime.development.js
|
|
65
|
-
*
|
|
66
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
67
|
-
*
|
|
68
|
-
* This source code is licensed under the MIT license found in the
|
|
69
|
-
* LICENSE file in the root directory of this source tree.
|
|
70
|
-
*/
|
|
71
|
-
var hasRequiredReactJsxRuntime_development;
|
|
72
|
-
function requireReactJsxRuntime_development() {
|
|
73
|
-
if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
|
|
74
|
-
hasRequiredReactJsxRuntime_development = 1;
|
|
75
|
-
"production" !== "development" && function() {
|
|
76
|
-
function getComponentNameFromType(type) {
|
|
77
|
-
if (null == type) return null;
|
|
78
|
-
if ("function" === typeof type)
|
|
79
|
-
return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
|
|
80
|
-
if ("string" === typeof type) return type;
|
|
81
|
-
switch (type) {
|
|
82
|
-
case REACT_FRAGMENT_TYPE:
|
|
83
|
-
return "Fragment";
|
|
84
|
-
case REACT_PROFILER_TYPE:
|
|
85
|
-
return "Profiler";
|
|
86
|
-
case REACT_STRICT_MODE_TYPE:
|
|
87
|
-
return "StrictMode";
|
|
88
|
-
case REACT_SUSPENSE_TYPE:
|
|
89
|
-
return "Suspense";
|
|
90
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
91
|
-
return "SuspenseList";
|
|
92
|
-
case REACT_ACTIVITY_TYPE:
|
|
93
|
-
return "Activity";
|
|
94
|
-
}
|
|
95
|
-
if ("object" === typeof type)
|
|
96
|
-
switch ("number" === typeof type.tag && console.error(
|
|
97
|
-
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
98
|
-
), type.$$typeof) {
|
|
99
|
-
case REACT_PORTAL_TYPE:
|
|
100
|
-
return "Portal";
|
|
101
|
-
case REACT_CONTEXT_TYPE:
|
|
102
|
-
return type.displayName || "Context";
|
|
103
|
-
case REACT_CONSUMER_TYPE:
|
|
104
|
-
return (type._context.displayName || "Context") + ".Consumer";
|
|
105
|
-
case REACT_FORWARD_REF_TYPE:
|
|
106
|
-
var innerType = type.render;
|
|
107
|
-
type = type.displayName;
|
|
108
|
-
type || (type = innerType.displayName || innerType.name || "", type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef");
|
|
109
|
-
return type;
|
|
110
|
-
case REACT_MEMO_TYPE:
|
|
111
|
-
return innerType = type.displayName || null, null !== innerType ? innerType : getComponentNameFromType(type.type) || "Memo";
|
|
112
|
-
case REACT_LAZY_TYPE:
|
|
113
|
-
innerType = type._payload;
|
|
114
|
-
type = type._init;
|
|
115
|
-
try {
|
|
116
|
-
return getComponentNameFromType(type(innerType));
|
|
117
|
-
} catch (x) {
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
return null;
|
|
121
|
-
}
|
|
122
|
-
function testStringCoercion(value) {
|
|
123
|
-
return "" + value;
|
|
124
|
-
}
|
|
125
|
-
function checkKeyStringCoercion(value) {
|
|
126
|
-
try {
|
|
127
|
-
testStringCoercion(value);
|
|
128
|
-
var JSCompiler_inline_result = false;
|
|
129
|
-
} catch (e) {
|
|
130
|
-
JSCompiler_inline_result = true;
|
|
131
|
-
}
|
|
132
|
-
if (JSCompiler_inline_result) {
|
|
133
|
-
JSCompiler_inline_result = console;
|
|
134
|
-
var JSCompiler_temp_const = JSCompiler_inline_result.error;
|
|
135
|
-
var JSCompiler_inline_result$jscomp$0 = "function" === typeof Symbol && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
|
|
136
|
-
JSCompiler_temp_const.call(
|
|
137
|
-
JSCompiler_inline_result,
|
|
138
|
-
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
139
|
-
JSCompiler_inline_result$jscomp$0
|
|
140
|
-
);
|
|
141
|
-
return testStringCoercion(value);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
function getTaskName(type) {
|
|
145
|
-
if (type === REACT_FRAGMENT_TYPE) return "<>";
|
|
146
|
-
if ("object" === typeof type && null !== type && type.$$typeof === REACT_LAZY_TYPE)
|
|
147
|
-
return "<...>";
|
|
148
|
-
try {
|
|
149
|
-
var name = getComponentNameFromType(type);
|
|
150
|
-
return name ? "<" + name + ">" : "<...>";
|
|
151
|
-
} catch (x) {
|
|
152
|
-
return "<...>";
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
function getOwner() {
|
|
156
|
-
var dispatcher = ReactSharedInternals.A;
|
|
157
|
-
return null === dispatcher ? null : dispatcher.getOwner();
|
|
158
|
-
}
|
|
159
|
-
function UnknownOwner() {
|
|
160
|
-
return Error("react-stack-top-frame");
|
|
161
|
-
}
|
|
162
|
-
function hasValidKey(config) {
|
|
163
|
-
if (hasOwnProperty.call(config, "key")) {
|
|
164
|
-
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
|
165
|
-
if (getter && getter.isReactWarning) return false;
|
|
166
|
-
}
|
|
167
|
-
return void 0 !== config.key;
|
|
168
|
-
}
|
|
169
|
-
function defineKeyPropWarningGetter(props, displayName) {
|
|
170
|
-
function warnAboutAccessingKey() {
|
|
171
|
-
specialPropKeyWarningShown || (specialPropKeyWarningShown = true, console.error(
|
|
172
|
-
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
173
|
-
displayName
|
|
174
|
-
));
|
|
175
|
-
}
|
|
176
|
-
warnAboutAccessingKey.isReactWarning = true;
|
|
177
|
-
Object.defineProperty(props, "key", {
|
|
178
|
-
get: warnAboutAccessingKey,
|
|
179
|
-
configurable: true
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
function elementRefGetterWithDeprecationWarning() {
|
|
183
|
-
var componentName = getComponentNameFromType(this.type);
|
|
184
|
-
didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = true, console.error(
|
|
185
|
-
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
186
|
-
));
|
|
187
|
-
componentName = this.props.ref;
|
|
188
|
-
return void 0 !== componentName ? componentName : null;
|
|
189
|
-
}
|
|
190
|
-
function ReactElement(type, key, props, owner, debugStack, debugTask) {
|
|
191
|
-
var refProp = props.ref;
|
|
192
|
-
type = {
|
|
193
|
-
$$typeof: REACT_ELEMENT_TYPE,
|
|
194
|
-
type,
|
|
195
|
-
key,
|
|
196
|
-
props,
|
|
197
|
-
_owner: owner
|
|
198
|
-
};
|
|
199
|
-
null !== (void 0 !== refProp ? refProp : null) ? Object.defineProperty(type, "ref", {
|
|
200
|
-
enumerable: false,
|
|
201
|
-
get: elementRefGetterWithDeprecationWarning
|
|
202
|
-
}) : Object.defineProperty(type, "ref", { enumerable: false, value: null });
|
|
203
|
-
type._store = {};
|
|
204
|
-
Object.defineProperty(type._store, "validated", {
|
|
205
|
-
configurable: false,
|
|
206
|
-
enumerable: false,
|
|
207
|
-
writable: true,
|
|
208
|
-
value: 0
|
|
209
|
-
});
|
|
210
|
-
Object.defineProperty(type, "_debugInfo", {
|
|
211
|
-
configurable: false,
|
|
212
|
-
enumerable: false,
|
|
213
|
-
writable: true,
|
|
214
|
-
value: null
|
|
215
|
-
});
|
|
216
|
-
Object.defineProperty(type, "_debugStack", {
|
|
217
|
-
configurable: false,
|
|
218
|
-
enumerable: false,
|
|
219
|
-
writable: true,
|
|
220
|
-
value: debugStack
|
|
221
|
-
});
|
|
222
|
-
Object.defineProperty(type, "_debugTask", {
|
|
223
|
-
configurable: false,
|
|
224
|
-
enumerable: false,
|
|
225
|
-
writable: true,
|
|
226
|
-
value: debugTask
|
|
227
|
-
});
|
|
228
|
-
Object.freeze && (Object.freeze(type.props), Object.freeze(type));
|
|
229
|
-
return type;
|
|
230
|
-
}
|
|
231
|
-
function jsxDEVImpl(type, config, maybeKey, isStaticChildren, debugStack, debugTask) {
|
|
232
|
-
var children = config.children;
|
|
233
|
-
if (void 0 !== children)
|
|
234
|
-
if (isStaticChildren)
|
|
235
|
-
if (isArrayImpl(children)) {
|
|
236
|
-
for (isStaticChildren = 0; isStaticChildren < children.length; isStaticChildren++)
|
|
237
|
-
validateChildKeys(children[isStaticChildren]);
|
|
238
|
-
Object.freeze && Object.freeze(children);
|
|
239
|
-
} else
|
|
240
|
-
console.error(
|
|
241
|
-
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
242
|
-
);
|
|
243
|
-
else validateChildKeys(children);
|
|
244
|
-
if (hasOwnProperty.call(config, "key")) {
|
|
245
|
-
children = getComponentNameFromType(type);
|
|
246
|
-
var keys = Object.keys(config).filter(function(k) {
|
|
247
|
-
return "key" !== k;
|
|
248
|
-
});
|
|
249
|
-
isStaticChildren = 0 < keys.length ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
250
|
-
didWarnAboutKeySpread[children + isStaticChildren] || (keys = 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
251
|
-
'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',
|
|
252
|
-
isStaticChildren,
|
|
253
|
-
children,
|
|
254
|
-
keys,
|
|
255
|
-
children
|
|
256
|
-
), didWarnAboutKeySpread[children + isStaticChildren] = true);
|
|
257
|
-
}
|
|
258
|
-
children = null;
|
|
259
|
-
void 0 !== maybeKey && (checkKeyStringCoercion(maybeKey), children = "" + maybeKey);
|
|
260
|
-
hasValidKey(config) && (checkKeyStringCoercion(config.key), children = "" + config.key);
|
|
261
|
-
if ("key" in config) {
|
|
262
|
-
maybeKey = {};
|
|
263
|
-
for (var propName in config)
|
|
264
|
-
"key" !== propName && (maybeKey[propName] = config[propName]);
|
|
265
|
-
} else maybeKey = config;
|
|
266
|
-
children && defineKeyPropWarningGetter(
|
|
267
|
-
maybeKey,
|
|
268
|
-
"function" === typeof type ? type.displayName || type.name || "Unknown" : type
|
|
269
|
-
);
|
|
270
|
-
return ReactElement(
|
|
271
|
-
type,
|
|
272
|
-
children,
|
|
273
|
-
maybeKey,
|
|
274
|
-
getOwner(),
|
|
275
|
-
debugStack,
|
|
276
|
-
debugTask
|
|
277
|
-
);
|
|
278
|
-
}
|
|
279
|
-
function validateChildKeys(node) {
|
|
280
|
-
isValidElement(node) ? node._store && (node._store.validated = 1) : "object" === typeof node && null !== node && node.$$typeof === REACT_LAZY_TYPE && ("fulfilled" === node._payload.status ? isValidElement(node._payload.value) && node._payload.value._store && (node._payload.value._store.validated = 1) : node._store && (node._store.validated = 1));
|
|
281
|
-
}
|
|
282
|
-
function isValidElement(object) {
|
|
283
|
-
return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
284
|
-
}
|
|
285
|
-
var React = require$$0, REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty = Object.prototype.hasOwnProperty, isArrayImpl = Array.isArray, createTask = console.createTask ? console.createTask : function() {
|
|
286
|
-
return null;
|
|
287
|
-
};
|
|
288
|
-
React = {
|
|
289
|
-
react_stack_bottom_frame: function(callStackForError) {
|
|
290
|
-
return callStackForError();
|
|
291
|
-
}
|
|
292
|
-
};
|
|
293
|
-
var specialPropKeyWarningShown;
|
|
294
|
-
var didWarnAboutElementRef = {};
|
|
295
|
-
var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(
|
|
296
|
-
React,
|
|
297
|
-
UnknownOwner
|
|
298
|
-
)();
|
|
299
|
-
var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
|
|
300
|
-
var didWarnAboutKeySpread = {};
|
|
301
|
-
reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
|
|
302
|
-
reactJsxRuntime_development.jsx = function(type, config, maybeKey) {
|
|
303
|
-
var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
|
|
304
|
-
return jsxDEVImpl(
|
|
305
|
-
type,
|
|
306
|
-
config,
|
|
307
|
-
maybeKey,
|
|
308
|
-
false,
|
|
309
|
-
trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack,
|
|
310
|
-
trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
|
|
311
|
-
);
|
|
312
|
-
};
|
|
313
|
-
reactJsxRuntime_development.jsxs = function(type, config, maybeKey) {
|
|
314
|
-
var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
|
|
315
|
-
return jsxDEVImpl(
|
|
316
|
-
type,
|
|
317
|
-
config,
|
|
318
|
-
maybeKey,
|
|
319
|
-
true,
|
|
320
|
-
trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack,
|
|
321
|
-
trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
|
|
322
|
-
);
|
|
323
|
-
};
|
|
324
|
-
}();
|
|
325
|
-
return reactJsxRuntime_development;
|
|
326
|
-
}
|
|
327
|
-
if ("development" === "production") {
|
|
328
|
-
jsxRuntime.exports = requireReactJsxRuntime_production();
|
|
329
|
-
} else {
|
|
330
|
-
jsxRuntime.exports = requireReactJsxRuntime_development();
|
|
331
|
-
}
|
|
332
|
-
var jsxRuntimeExports = jsxRuntime.exports;
|
|
333
|
-
const EventBusContext = require$$0.createContext(null);
|
|
21
|
+
const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
|
|
22
|
+
const EventBusContext = React.createContext(null);
|
|
334
23
|
const useEventBus = () => {
|
|
335
|
-
return
|
|
24
|
+
return React.useContext(EventBusContext);
|
|
336
25
|
};
|
|
337
26
|
const createPublishEvent = (bus) => {
|
|
338
27
|
function publishEvent(...args) {
|
|
@@ -344,18 +33,18 @@
|
|
|
344
33
|
}
|
|
345
34
|
return publishEvent;
|
|
346
35
|
};
|
|
347
|
-
const PublishEventContext =
|
|
348
|
-
const usePublishEvent = () =>
|
|
36
|
+
const PublishEventContext = React.createContext(null);
|
|
37
|
+
const usePublishEvent = () => React.useContext(PublishEventContext);
|
|
349
38
|
const EspEventBusContextProvider = ({ children, bus }) => {
|
|
350
39
|
let busFromContext = useEventBus();
|
|
351
40
|
bus = bus || busFromContext;
|
|
352
|
-
const publishEvent =
|
|
353
|
-
return /* @__PURE__ */
|
|
41
|
+
const publishEvent = React.useCallback(createPublishEvent(bus), [bus]);
|
|
42
|
+
return /* @__PURE__ */ React__namespace.createElement(EventBusContext.Provider, { value: bus }, /* @__PURE__ */ React__namespace.createElement(PublishEventContext.Provider, { value: publishEvent }, children));
|
|
354
43
|
};
|
|
355
|
-
const GetStoreIdContext =
|
|
356
|
-
const useGetStoreId = () =>
|
|
357
|
-
const GetStoreModelContext =
|
|
358
|
-
const useGetStoreModel = () =>
|
|
44
|
+
const GetStoreIdContext = React.createContext(null);
|
|
45
|
+
const useGetStoreId = () => React.useContext(GetStoreIdContext);
|
|
46
|
+
const GetStoreModelContext = React.createContext(null);
|
|
47
|
+
const useGetStoreModel = () => React.useContext(GetStoreModelContext);
|
|
359
48
|
const createPublishStoreEvent = (bus, storeId) => {
|
|
360
49
|
function publishStoreEvent(...args) {
|
|
361
50
|
if (args.length === 1) {
|
|
@@ -366,8 +55,8 @@
|
|
|
366
55
|
}
|
|
367
56
|
return publishStoreEvent;
|
|
368
57
|
};
|
|
369
|
-
const PublishStoreEventContext =
|
|
370
|
-
const usePublishStoreEvent = () =>
|
|
58
|
+
const PublishStoreEventContext = React.createContext(null);
|
|
59
|
+
const usePublishStoreEvent = () => React.useContext(PublishStoreEventContext);
|
|
371
60
|
const createPublishStoreEventWithEntityKey = (bus, storeId) => {
|
|
372
61
|
function publishStoreEventWithEntityKey(...args) {
|
|
373
62
|
if (args.length === 1) {
|
|
@@ -378,15 +67,15 @@
|
|
|
378
67
|
}
|
|
379
68
|
return publishStoreEventWithEntityKey;
|
|
380
69
|
};
|
|
381
|
-
const PublishStoreEventWithEntityKeyContext =
|
|
382
|
-
const usePublishStoreEventWithEntityKey = () =>
|
|
70
|
+
const PublishStoreEventWithEntityKeyContext = React.createContext(null);
|
|
71
|
+
const usePublishStoreEventWithEntityKey = () => React.useContext(PublishStoreEventWithEntityKeyContext);
|
|
383
72
|
const EspStoreContextProvider = ({ storeId, children, model }) => {
|
|
384
73
|
const bus = useEventBus();
|
|
385
74
|
let storeIdFromContext = useGetStoreId();
|
|
386
75
|
storeId = storeId || storeIdFromContext;
|
|
387
|
-
const publishStoreEvent =
|
|
388
|
-
const publishStoreEventWithEntityKey =
|
|
389
|
-
return /* @__PURE__ */
|
|
76
|
+
const publishStoreEvent = React.useCallback(createPublishStoreEvent(bus, storeId), [bus, storeId]);
|
|
77
|
+
const publishStoreEventWithEntityKey = React.useCallback(createPublishStoreEventWithEntityKey(bus, storeId), [bus, storeId]);
|
|
78
|
+
return /* @__PURE__ */ React__namespace.createElement(GetStoreIdContext.Provider, { value: storeId }, /* @__PURE__ */ React__namespace.createElement(PublishStoreEventContext.Provider, { value: publishStoreEvent }, /* @__PURE__ */ React__namespace.createElement(PublishStoreEventWithEntityKeyContext.Provider, { value: publishStoreEventWithEntityKey }, /* @__PURE__ */ React__namespace.createElement(GetStoreModelContext.Provider, { value: model }, children))));
|
|
390
79
|
};
|
|
391
80
|
var withSelector = { exports: {} };
|
|
392
81
|
var useSyncExternalStoreWithSelector_production = {};
|
|
@@ -403,11 +92,11 @@
|
|
|
403
92
|
function requireUseSyncExternalStoreWithSelector_production() {
|
|
404
93
|
if (hasRequiredUseSyncExternalStoreWithSelector_production) return useSyncExternalStoreWithSelector_production;
|
|
405
94
|
hasRequiredUseSyncExternalStoreWithSelector_production = 1;
|
|
406
|
-
var React =
|
|
95
|
+
var React$1 = React;
|
|
407
96
|
function is(x, y) {
|
|
408
97
|
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
|
|
409
98
|
}
|
|
410
|
-
var objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore = React.useSyncExternalStore, useRef = React.useRef, useEffect = React.useEffect, useMemo = React.useMemo, useDebugValue = React.useDebugValue;
|
|
99
|
+
var objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore = React$1.useSyncExternalStore, useRef = React$1.useRef, useEffect = React$1.useEffect, useMemo = React$1.useMemo, useDebugValue = React$1.useDebugValue;
|
|
411
100
|
useSyncExternalStoreWithSelector_production.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
412
101
|
var instRef = useRef(null);
|
|
413
102
|
if (null === instRef.current) {
|
|
@@ -480,7 +169,7 @@
|
|
|
480
169
|
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
|
|
481
170
|
}
|
|
482
171
|
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
483
|
-
var React =
|
|
172
|
+
var React$1 = React, objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore = React$1.useSyncExternalStore, useRef = React$1.useRef, useEffect = React$1.useEffect, useMemo = React$1.useMemo, useDebugValue = React$1.useDebugValue;
|
|
484
173
|
useSyncExternalStoreWithSelector_development.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
485
174
|
var instRef = useRef(null);
|
|
486
175
|
if (null === instRef.current) {
|
|
@@ -581,7 +270,7 @@
|
|
|
581
270
|
const storeIdFromContext = useGetStoreId();
|
|
582
271
|
const storeId = (options == null ? void 0 : options.storeId) || storeIdFromContext;
|
|
583
272
|
const equalityFn = options == null ? void 0 : options.equalityFn;
|
|
584
|
-
const dependencies =
|
|
273
|
+
const dependencies = React.useMemo(
|
|
585
274
|
() => {
|
|
586
275
|
const canSubscribe = bus && espJs.utils.isString(storeId);
|
|
587
276
|
if (canSubscribe) {
|
|
@@ -663,7 +352,7 @@
|
|
|
663
352
|
const bus = useEventBus();
|
|
664
353
|
let storeIdFromContext = useGetStoreId();
|
|
665
354
|
storeId = storeId || storeIdFromContext;
|
|
666
|
-
const publishEventProps =
|
|
355
|
+
const publishEventProps = React.useMemo(
|
|
667
356
|
() => {
|
|
668
357
|
if (createPublishEventProps) {
|
|
669
358
|
const publishModelEvent = (eventType, event) => {
|
|
@@ -683,26 +372,26 @@
|
|
|
683
372
|
return null;
|
|
684
373
|
}
|
|
685
374
|
let childProps = getChildProps(bus, storeId, rest, model, mapStoreModelToProps, publishEventProps);
|
|
686
|
-
let viewElement = view ?
|
|
687
|
-
return /* @__PURE__ */
|
|
375
|
+
let viewElement = view ? React__namespace.createElement(view, childProps) : null;
|
|
376
|
+
return /* @__PURE__ */ React__namespace.createElement(EspStoreContextProvider, { storeId, model, bus, ...childProps }, viewElement);
|
|
688
377
|
};
|
|
689
|
-
const EspModulesContext =
|
|
378
|
+
const EspModulesContext = React__namespace.createContext([]);
|
|
690
379
|
const RegionView = ({ regionName }) => {
|
|
691
|
-
const modules =
|
|
692
|
-
const bindings =
|
|
380
|
+
const modules = React.useContext(EspModulesContext);
|
|
381
|
+
const bindings = React.useMemo(
|
|
693
382
|
() => modules.flatMap((m) => m.viewBindings).filter((b) => b.region === regionName),
|
|
694
383
|
[modules, regionName]
|
|
695
384
|
);
|
|
696
|
-
return /* @__PURE__ */
|
|
385
|
+
return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, bindings.map((binding, index) => /* @__PURE__ */ React__namespace.createElement(
|
|
697
386
|
ConnectableComponent,
|
|
698
387
|
{
|
|
388
|
+
key: `${binding.storeId}:${index}`,
|
|
699
389
|
storeId: binding.storeId,
|
|
700
390
|
view: binding.viewComponent
|
|
701
|
-
}
|
|
702
|
-
|
|
703
|
-
)) });
|
|
391
|
+
}
|
|
392
|
+
)));
|
|
704
393
|
};
|
|
705
|
-
const EspApp = ({ app, children }) => /* @__PURE__ */
|
|
394
|
+
const EspApp = ({ app, children }) => /* @__PURE__ */ React__namespace.createElement(EspEventBusContextProvider, { bus: app.eventBus }, /* @__PURE__ */ React__namespace.createElement(EspModulesContext.Provider, { value: app.modules }, children));
|
|
706
395
|
exports2.ConnectableComponent = ConnectableComponent;
|
|
707
396
|
exports2.EspApp = EspApp;
|
|
708
397
|
exports2.EspEventBusContextProvider = EspEventBusContextProvider;
|