esp-js-react 8.0.2-next.0 → 8.0.4-next.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.
Files changed (37) hide show
  1. package/.dist/esp-react.js +68 -112
  2. package/.dist/esp-react.js.map +1 -1
  3. package/.dist/esp-react.min.js +1 -1
  4. package/.dist/esp-react.min.js.map +1 -1
  5. package/.dist/typings/connect.d.ts +2 -6
  6. package/.dist/typings/connectableComponent.d.ts +0 -16
  7. package/.dist/typings/espModelContextProvider.d.ts +27 -12
  8. package/.dist/typings/espRouterContextProvider.d.ts +5 -5
  9. package/.dist/typings/index.d.ts +2 -3
  10. package/.dist/typings/useSyncModelWithSelector.d.ts +50 -0
  11. package/.dist/typings/viewBinder.d.ts +8 -1
  12. package/.dist/typings/viewBindingDecorator.d.ts +1 -1
  13. package/package.json +4 -4
  14. package/src/connect.tsx +2 -6
  15. package/src/connectableComponent.tsx +3 -20
  16. package/src/espModelContextProvider.tsx +30 -46
  17. package/src/espRouterContextProvider.tsx +5 -5
  18. package/src/index.ts +6 -13
  19. package/src/{useModelSelector.ts → useSyncModelWithSelector.ts} +47 -16
  20. package/src/viewBinder.tsx +13 -2
  21. package/src/viewBindingDecorator.ts +2 -2
  22. package/tests/connectableComponentTests.tsx +323 -246
  23. package/tests/espModelContextProviderTests.tsx +142 -0
  24. package/tests/espRouterContextProviderTests.tsx +54 -0
  25. package/tests/indexTests.ts +3 -4
  26. package/tests/testApi/asserts.ts +17 -2
  27. package/tests/testApi/testApi.tsx +37 -21
  28. package/tests/testApi/testModel.ts +15 -8
  29. package/tests/testApi/useStoreReceivedProps.ts +3 -0
  30. package/tests/testApi/viewFactory.tsx +31 -0
  31. package/tests/{useModelSelectorTests.tsx → useSyncModelWithSelectorTests.tsx} +52 -22
  32. package/tests/viewBinderTests.tsx +61 -0
  33. package/.dist/typings/useModelSelector.d.ts +0 -27
  34. package/.dist/typings/viewBinderConnectable.d.ts +0 -15
  35. package/src/viewBinderConnectable.tsx +0 -54
  36. package/tests/connectableComponentLegacyTests.tsx +0 -405
  37. package/tests/testApi/viewMetadata.tsx +0 -46
@@ -63,9 +63,8 @@ exports.connect = void 0;
63
63
  const React = __webpack_require__(155);
64
64
  const connectableComponent_1 = __webpack_require__(397);
65
65
  /**
66
- * @deprecated
67
- * @param mapModelToProps
68
- * @param createPublishEventProps
66
+ * @param mapModelToProps - maps the model to a different structure, that structure is sent as props to the view.
67
+ * @param createPublishEventProps - creates functions to publish events, the structure is sent as props to the view.
69
68
  */
70
69
  const connect = function (mapModelToProps, createPublishEventProps) {
71
70
  return function (view) {
@@ -104,9 +103,8 @@ const esp_js_1 = __webpack_require__(152);
104
103
  const espModelContextProvider_1 = __webpack_require__(963);
105
104
  const viewBindingDecorator_1 = __webpack_require__(213);
106
105
  const getEspPolimerImmutableModel_1 = __webpack_require__(894);
107
- const useModelSelector_1 = __webpack_require__(743);
106
+ const useSyncModelWithSelector_1 = __webpack_require__(606);
108
107
  const getChildProps = (router, modelId, restProps, initialModel, mapModelToProps, publishEventProps) => {
109
- // consume what this component owns, and let the rest end up in `...rest`
110
108
  const model = (0, getEspPolimerImmutableModel_1.tryGetPolimerImmutableModel)(initialModel);
111
109
  let childProps = Object.assign(Object.assign(Object.assign({ modelId, router: router }, restProps), publishEventProps), { model });
112
110
  if (mapModelToProps) {
@@ -114,10 +112,6 @@ const getChildProps = (router, modelId, restProps, initialModel, mapModelToProps
114
112
  }
115
113
  return childProps;
116
114
  };
117
- /**
118
- * @deprecated - use ViewBinderConnectable and ESP hooks if you need to dynamically bind a view to a model
119
- * or useModelSelector with other ESP hooks for direct model subscription.
120
- */
121
115
  const ConnectableComponent = (_a) => {
122
116
  var { modelId, mapModelToProps, createPublishEventProps, view, viewContext } = _a, rest = __rest(_a, ["modelId", "mapModelToProps", "createPublishEventProps", "view", "viewContext"]);
123
117
  const router = (0, espRouterContextProvider_1.useRouter)();
@@ -134,7 +128,7 @@ const ConnectableComponent = (_a) => {
134
128
  }
135
129
  return {};
136
130
  }, [router, modelId]);
137
- const model = (0, useModelSelector_1.useModelSelector)(m => m, (0, useModelSelector_1.modelSelectorOptions)()
131
+ const model = (0, useSyncModelWithSelector_1.useSyncModelWithSelector)(m => m, (0, useSyncModelWithSelector_1.syncModelWithSelectorOptions)()
138
132
  .setModelId(modelId)
139
133
  .setTryPreSelectPolimerImmutableModel(false));
140
134
  if (model == null) {
@@ -162,75 +156,63 @@ const espRouterContextProvider_1 = __webpack_require__(169);
162
156
  const _log = esp_js_1.Logger.create('EspModelContextProvider');
163
157
  exports.GetModelIdContext = (0, react_1.createContext)(null);
164
158
  /**
165
- * Returns a function which will return the ID of the model currently being rendered.
159
+ * Returns a function to get the ID of the model connected at a higher point in the V-DOM.
160
+ *
161
+ * To use this, please ensure your V-DOM has the EspModelContextProvider at a higher node.
166
162
  */
167
- const useGetModelId = () => (0, react_1.useContext)(exports.GetModelIdContext)();
163
+ const useGetModelId = () => (0, react_1.useContext)(exports.GetModelIdContext);
168
164
  exports.useGetModelId = useGetModelId;
169
165
  exports.GetModelContext = (0, react_1.createContext)(null);
170
166
  /**
171
- * Returns a function which will return the model set at last dispatch.
167
+ * Returns a function which will return the model connected at a higher point in the V-DOM.
168
+ *
169
+ * To use this, please ensure your V-DOM has the EspModelContextProvider at a higher node.
172
170
  */
173
- const useGetModel = () => (0, react_1.useContext)(exports.GetModelContext)();
171
+ const useGetModel = () => (0, react_1.useContext)(exports.GetModelContext);
174
172
  exports.useGetModel = useGetModel;
175
173
  exports.PublishModelEventContext = (0, react_1.createContext)(null);
176
174
  /**
177
- * Returns a function which can be used to publish an event to the current model being rendered.
175
+ * Returns a function which can be used to publish an event to the model connected at a higher point in the V-DOM.
178
176
  *
179
- * Effectively, this is a version of usePublishEvent() which closes over the current modelId.
177
+ * Effectively, this is a version of usePublishEvent() which closes over the relevant modelId.
178
+ *
179
+ * To use this, please ensure your V-DOM has the EspModelContextProvider at a higher node.
180
180
  */
181
181
  const usePublishModelEvent = () => (0, react_1.useContext)(exports.PublishModelEventContext);
182
182
  exports.usePublishModelEvent = usePublishModelEvent;
183
183
  exports.PublishModelEventWithEntityKeyContext = (0, react_1.createContext)(null);
184
184
  /**
185
- * Returns a function which can be used to publish an event to the current model being rendered, allows an entityKey to be specified.
185
+ * Returns a function which can be used to publish an event to the model connected at a higher point in the V-DOM, allows an entityKey to be specified.
186
+ *
187
+ * Effectively, this is a version of usePublishEvent() which closes over the modelId.
186
188
  *
187
- * Effectively, this is a version of usePublishEvent() which closes over the current modelId.
189
+ * To use this, please ensure your V-DOM has the EspModelContextProvider at a higher node.
188
190
  */
189
191
  const usePublishModelEventWithEntityKey = () => (0, react_1.useContext)(exports.PublishModelEventWithEntityKeyContext);
190
192
  exports.usePublishModelEventWithEntityKey = usePublishModelEventWithEntityKey;
193
+ /**
194
+ * Sets up various ESP context so ESP hooks are available below this point in the V-DOM
195
+ *
196
+ * To use this, please ensure your V-DOM has the EspRouterContextProvider at a higher node.
197
+ * @param modelId
198
+ * @param children
199
+ * @param model
200
+ * @constructor
201
+ */
191
202
  const EspModelContextProvider = ({ modelId, children, model }) => {
192
203
  const router = (0, espRouterContextProvider_1.useRouter)();
193
- const getModelId = (0, react_1.useCallback)(() => {
194
- return modelId;
195
- }, [router, modelId]);
196
- const getModel = (0, react_1.useCallback)(() => {
197
- warnIfModelAccessedOutSideDispatchLoop(router, modelId);
198
- return model;
199
- }, [model, router, modelId]);
200
204
  const publishModelEvent = (0, react_1.useCallback)((eventType, event) => {
201
205
  router.publishEvent(modelId, eventType, event);
202
206
  }, [router, modelId]);
203
207
  const publishModelEventWithEntityKey = (0, react_1.useCallback)((entityKey, eventType, event) => {
204
208
  router.publishEvent(new esp_js_1.DefaultModelAddress(modelId, entityKey), eventType, event);
205
209
  }, [router, modelId]);
206
- return (React.createElement(exports.GetModelIdContext.Provider, { value: getModelId },
210
+ return (React.createElement(exports.GetModelIdContext.Provider, { value: modelId },
207
211
  React.createElement(exports.PublishModelEventContext.Provider, { value: publishModelEvent },
208
212
  React.createElement(exports.PublishModelEventWithEntityKeyContext.Provider, { value: publishModelEventWithEntityKey },
209
- React.createElement(exports.GetModelContext.Provider, { value: getModel }, children)))));
213
+ React.createElement(exports.GetModelContext.Provider, { value: model }, children)))));
210
214
  };
211
215
  exports.EspModelContextProvider = EspModelContextProvider;
212
- const warnIfModelAccessedOutSideDispatchLoop = (router, modelId) => {
213
- if (true) {
214
- return;
215
- }
216
- if (esp_js_1.utils.stringIsEmpty(modelId)) {
217
- return;
218
- }
219
- let isDispatchModelUpdateStatus = router.isModelDispatchStatus(modelId, esp_js_1.Status.DispatchModelUpdates);
220
- if (!isDispatchModelUpdateStatus) {
221
- let stack = undefined;
222
- try {
223
- // noinspection ExceptionCaughtLocallyJS
224
- throw new Error();
225
- }
226
- catch (e) {
227
- stack = e.stack;
228
- }
229
- _log.warn(`EspModelContextProvider useGetModelId has been invoked outside of the models (${modelId}) dispatch loop.` +
230
- `This may have unknown state state issues.` +
231
- stack);
232
- }
233
- };
234
216
 
235
217
 
236
218
  /***/ }),
@@ -262,13 +244,13 @@ const React = __webpack_require__(155);
262
244
  const react_1 = __webpack_require__(155);
263
245
  exports.RouterContext = (0, react_1.createContext)(null);
264
246
  /**
265
- * Get the esp Router from the RouterContext
247
+ * Get the esp Router from context.
266
248
  *
267
- * To use this, please ensure your V-DOM has the EspRouterContext at a higher node:
249
+ * To use this, please ensure your V-DOM has the EspRouterContextProvider at a higher node:
268
250
  *
269
- * <EspRouterContext router={router}>
251
+ * <EspRouterContextProvider router={router}>
270
252
  * <YourComponents />
271
- * </EspRouterContext>
253
+ * </EspRouterContextProvider>
272
254
  */
273
255
  const useRouter = () => {
274
256
  const context = (0, react_1.useContext)(exports.RouterContext);
@@ -282,7 +264,7 @@ exports.PublishEventContext = (0, react_1.createContext)(null);
282
264
  /**
283
265
  * Returns a function which can be used to publish an event.
284
266
  *
285
- * To use this, please ensure your V-DOM has the EspRouterContext at a higher node:
267
+ * To use this, please ensure your V-DOM has the EspRouterContextProvider at a higher node:
286
268
  *
287
269
  * <EspRouterContextProvider router={router}>
288
270
  * <YourComponents />
@@ -399,19 +381,22 @@ esp_js_polimer_1.PolimerModelBuilder.prototype.registerWithRouter = function ()
399
381
 
400
382
  /***/ }),
401
383
 
402
- /***/ 743:
384
+ /***/ 606:
403
385
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
404
386
 
405
387
 
406
388
  Object.defineProperty(exports, "__esModule", ({ value: true }));
407
- exports.useModelSelector = exports.modelSelectorOptions = void 0;
389
+ exports.useSyncModelWithSelector = exports.syncModelWithSelectorOptions = void 0;
408
390
  const react_1 = __webpack_require__(155);
409
391
  const with_selector_1 = __webpack_require__(614);
410
392
  const esp_js_1 = __webpack_require__(152);
411
393
  const espRouterContextProvider_1 = __webpack_require__(169);
412
394
  const espModelContextProvider_1 = __webpack_require__(963);
413
395
  const getEspPolimerImmutableModel_1 = __webpack_require__(894);
414
- const modelSelectorOptions = () => {
396
+ /**
397
+ * Convenience API to create SyncModelWithSelectorOptions
398
+ */
399
+ const syncModelWithSelectorOptions = () => {
415
400
  let modelId = undefined;
416
401
  let equalityFn = (a, b) => a === b;
417
402
  let tryPreSelectPolimerImmutableModel = true;
@@ -439,17 +424,30 @@ const modelSelectorOptions = () => {
439
424
  }
440
425
  };
441
426
  };
442
- exports.modelSelectorOptions = modelSelectorOptions;
427
+ exports.syncModelWithSelectorOptions = syncModelWithSelectorOptions;
428
+ const checkArguments = (selector, options) => {
429
+ if (!esp_js_1.utils.isFunction(selector)) {
430
+ throw new Error('You must pass a selector function to useSyncModelWithSelector');
431
+ }
432
+ if (!esp_js_1.utils.isObject(options)) {
433
+ throw new Error('You must provide options when using useSyncModelWithSelector');
434
+ }
435
+ if (!esp_js_1.utils.isFunction(options.equalityFn)) {
436
+ throw new Error('You must provide an equalityFn when using useSyncModelWithSelector');
437
+ }
438
+ };
443
439
  /**
444
440
  * A hook which returns model state from the esp Router.
445
441
  *
446
442
  * This hooks wih observe updates and re-render the component if the model changes.
447
443
  *
444
+ * To use this, please ensure your V-DOM has the EspRouterContextProvider at a higher node, and optionally EspModelContextProvider.
445
+ *
448
446
  * @param selector - a function to select a selection of the model - the selector does not need to be memoized, this selector will be cached against the modelId.
449
447
  * @param options
450
448
  */
451
- const useModelSelector = (selector, options = (0, exports.modelSelectorOptions)()) => {
452
- esp_js_1.Guard.isFunction(selector, 'You must pass a selector function to connectSelector');
449
+ const useSyncModelWithSelector = (selector, options = (0, exports.syncModelWithSelectorOptions)()) => {
450
+ checkArguments(selector, options);
453
451
  const router = (0, espRouterContextProvider_1.useRouter)();
454
452
  const modelId = (options === null || options === void 0 ? void 0 : options.modelId) || (0, espModelContextProvider_1.useGetModelId)();
455
453
  const tryPreSelectPolimerImmutableModel = options === null || options === void 0 ? void 0 : options.tryPreSelectPolimerImmutableModel;
@@ -510,7 +508,7 @@ const useModelSelector = (selector, options = (0, exports.modelSelectorOptions)(
510
508
  // Code: https://github.com/facebook/react/blob/main/packages/use-sync-external-store/src/useSyncExternalStoreWithSelector.js
511
509
  return (0, with_selector_1.useSyncExternalStoreWithSelector)(dependencies.subscribe, dependencies.getSnapshot, undefined, dependencies.wrappedSelector, equalityFn);
512
510
  };
513
- exports.useModelSelector = useModelSelector;
511
+ exports.useSyncModelWithSelector = useSyncModelWithSelector;
514
512
  const noopSubscription = {
515
513
  subscribe: () => { },
516
514
  getSnapshot: () => null,
@@ -556,11 +554,15 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
556
554
  exports.ViewBinder = void 0;
557
555
  const viewBindingDecorator_1 = __webpack_require__(213);
558
556
  const espRouterContextProvider_1 = __webpack_require__(169);
557
+ /**
558
+ * Takes a model with a @viewBinding decorator and dynamically crates the view specified by the decorator
559
+ */
559
560
  const ViewBinder = (_a) => {
560
561
  var { model, viewContext } = _a, rest = __rest(_a, ["model", "viewContext"]);
561
562
  if (model) {
562
563
  const router = (0, espRouterContextProvider_1.useRouter)();
563
- const newProps = Object.assign({}, { model, router }, rest);
564
+ const newProps = Object.assign({ model,
565
+ router }, rest);
564
566
  return (0, viewBindingDecorator_1.createViewForModel)(model, newProps, viewContext, null);
565
567
  }
566
568
  return null;
@@ -568,50 +570,6 @@ const ViewBinder = (_a) => {
568
570
  exports.ViewBinder = ViewBinder;
569
571
 
570
572
 
571
- /***/ }),
572
-
573
- /***/ 639:
574
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
575
-
576
-
577
- Object.defineProperty(exports, "__esModule", ({ value: true }));
578
- exports.ViewBinderConnectable = void 0;
579
- const espRouterContextProvider_1 = __webpack_require__(169);
580
- const espModelContextProvider_1 = __webpack_require__(963);
581
- const esp_js_1 = __webpack_require__(152);
582
- const React = __webpack_require__(155);
583
- const useModelSelector_1 = __webpack_require__(743);
584
- const viewBindingDecorator_1 = __webpack_require__(213);
585
- const getEspPolimerImmutableModel_1 = __webpack_require__(894);
586
- const _log = esp_js_1.Logger.create('ViewBinderConnectable');
587
- /**
588
- * Dynamically binds a view found via @viewBinder(SomeJsXView) to a model managed by the Router.
589
- * Optionally provide a view override and/or a viewContext
590
- * @param modelId
591
- * @param viewContext
592
- * @param view
593
- * @constructor
594
- */
595
- const ViewBinderConnectable = ({ modelId, viewContext, view }) => {
596
- const router = (0, espRouterContextProvider_1.useRouter)();
597
- const model = (0, useModelSelector_1.useModelSelector)(m => m, (0, useModelSelector_1.modelSelectorOptions)()
598
- .setModelId(modelId)
599
- .setTryPreSelectPolimerImmutableModel(false));
600
- if (!model) {
601
- return null;
602
- }
603
- let immutableModel = (0, getEspPolimerImmutableModel_1.tryGetPolimerImmutableModel)(model);
604
- const childProps = {
605
- modelId,
606
- router: router,
607
- model: immutableModel
608
- };
609
- let viewElement = (0, viewBindingDecorator_1.createViewForModel)(model, childProps, viewContext, view);
610
- return (React.createElement(espModelContextProvider_1.EspModelContextProvider, Object.assign({ modelId: modelId, router: router, model: immutableModel }, childProps), viewElement));
611
- };
612
- exports.ViewBinderConnectable = ViewBinderConnectable;
613
-
614
-
615
573
  /***/ }),
616
574
 
617
575
  /***/ 213:
@@ -803,13 +761,11 @@ var exports = __webpack_exports__;
803
761
  // notice_end
804
762
  //
805
763
  Object.defineProperty(exports, "__esModule", ({ value: true }));
806
- exports.EspModelContextProvider = exports.usePublishModelEventWithEntityKey = exports.PublishModelEventWithEntityKeyContext = exports.usePublishModelEvent = exports.PublishModelEventContext = exports.GetModelContext = exports.useGetModel = exports.GetModelIdContext = exports.useGetModelId = exports.usePublishEvent = exports.PublishEventContext = exports.useRouter = exports.RouterContext = exports.EspRouterContextProvider = exports.RouterProvider = exports.modelSelectorOptions = exports.useModelSelector = exports.ConnectableComponent = exports.connect = exports.createViewForModel = exports.getEspPolimerImmutableModel = exports.GetEspPolimerImmutableModelConsts = exports.DEFAULT_VIEW_KEY = exports.viewBinding = exports.ViewBinderConnectable = exports.ViewBinder = void 0;
764
+ exports.EspModelContextProvider = exports.usePublishModelEventWithEntityKey = exports.PublishModelEventWithEntityKeyContext = exports.usePublishModelEvent = exports.PublishModelEventContext = exports.GetModelContext = exports.useGetModel = exports.GetModelIdContext = exports.useGetModelId = exports.usePublishEvent = exports.PublishEventContext = exports.useRouter = exports.RouterContext = exports.EspRouterContextProvider = exports.RouterProvider = exports.syncModelWithSelectorOptions = exports.useSyncModelWithSelector = exports.ConnectableComponent = exports.connect = exports.createViewForModel = exports.getEspPolimerImmutableModel = exports.GetEspPolimerImmutableModelConsts = exports.DEFAULT_VIEW_KEY = exports.viewBinding = exports.ViewBinder = void 0;
807
765
  // import for side effects
808
766
  __webpack_require__(185);
809
767
  var viewBinder_1 = __webpack_require__(453);
810
768
  Object.defineProperty(exports, "ViewBinder", ({ enumerable: true, get: function () { return viewBinder_1.ViewBinder; } }));
811
- var viewBinderConnectable_1 = __webpack_require__(639);
812
- Object.defineProperty(exports, "ViewBinderConnectable", ({ enumerable: true, get: function () { return viewBinderConnectable_1.ViewBinderConnectable; } }));
813
769
  var viewBindingDecorator_1 = __webpack_require__(213);
814
770
  Object.defineProperty(exports, "viewBinding", ({ enumerable: true, get: function () { return viewBindingDecorator_1.viewBinding; } }));
815
771
  Object.defineProperty(exports, "DEFAULT_VIEW_KEY", ({ enumerable: true, get: function () { return viewBindingDecorator_1.DEFAULT_VIEW_KEY; } }));
@@ -822,9 +778,9 @@ var connect_1 = __webpack_require__(746);
822
778
  Object.defineProperty(exports, "connect", ({ enumerable: true, get: function () { return connect_1.connect; } }));
823
779
  var connectableComponent_1 = __webpack_require__(397);
824
780
  Object.defineProperty(exports, "ConnectableComponent", ({ enumerable: true, get: function () { return connectableComponent_1.ConnectableComponent; } }));
825
- var useModelSelector_1 = __webpack_require__(743);
826
- Object.defineProperty(exports, "useModelSelector", ({ enumerable: true, get: function () { return useModelSelector_1.useModelSelector; } }));
827
- Object.defineProperty(exports, "modelSelectorOptions", ({ enumerable: true, get: function () { return useModelSelector_1.modelSelectorOptions; } }));
781
+ var useSyncModelWithSelector_1 = __webpack_require__(606);
782
+ Object.defineProperty(exports, "useSyncModelWithSelector", ({ enumerable: true, get: function () { return useSyncModelWithSelector_1.useSyncModelWithSelector; } }));
783
+ Object.defineProperty(exports, "syncModelWithSelectorOptions", ({ enumerable: true, get: function () { return useSyncModelWithSelector_1.syncModelWithSelectorOptions; } }));
828
784
  var espRouterContextProvider_1 = __webpack_require__(169);
829
785
  Object.defineProperty(exports, "RouterProvider", ({ enumerable: true, get: function () { return espRouterContextProvider_1.RouterProvider; } }));
830
786
  Object.defineProperty(exports, "EspRouterContextProvider", ({ enumerable: true, get: function () { return espRouterContextProvider_1.EspRouterContextProvider; } }));
@@ -1 +1 @@
1
- {"version":3,"file":"esp-react.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACa,MAAM,mBAAO,CAAC,GAAO,EAAE,gBAAgB,+CAA+C;AACnG,wCAAwC,qBAAqB,cAAc,qBAAqB,OAAO,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ACAA;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;;;;ACtBA,eAAe;AACf;;;;;;;;;;;;;;GAcG;AACH,aAAa;AACb,EAAE;;;AAEF,0BAA0B;AAC1B,yBAAkD;AAElD,4CAAwC;AAAhC,mHAAU;AAClB,uDAGiC;AAD7B,oJAAqB;AAEzB,sDAAqE;AAA7D,+HAAW;AAAE,yIAAgB;AACrC,6DAI+C;AAF3C,kLAAiC;AACjC,sKAA2B;AAE/B,sDAA0D;AAAlD,6IAAkB;AAC1B,yCAGmB;AAFf,0GAAO;AAGX,sDAMgC;AAD5B,iJAAoB;AAExB,kDAO4B;AALxB,qIAAgB;AAEhB,6IAAoB;AAIxB,0DAUoC;AAThC,yIAAc;AAEd,6JAAwB;AAExB,uIAAa;AACb,+HAAS;AAET,mJAAmB;AACnB,2IAAe;AAEnB,yDAemC;AAd/B,sIAAa;AAEb,8IAAiB;AACjB,kIAAW;AAEX,0IAAe;AAEf,4JAAwB;AACxB,oJAAoB;AAEpB,sLAAqC;AACrC,8KAAiC;AACjC,0JAAuB","sources":["webpack://esp-js-react/webpack/universalModuleDefinition","webpack://esp-js-react/../../node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.production.min.js","webpack://esp-js-react/../../node_modules/use-sync-external-store/with-selector.js","webpack://esp-js-react/./src/connect.tsx","webpack://esp-js-react/./src/connectableComponent.tsx","webpack://esp-js-react/./src/espModelContextProvider.tsx","webpack://esp-js-react/./src/espRouterContextProvider.tsx","webpack://esp-js-react/./src/polimer/getEspPolimerImmutableModel.ts","webpack://esp-js-react/./src/polimer/polimerModelBuilderExtentsions.ts","webpack://esp-js-react/./src/useModelSelector.ts","webpack://esp-js-react/./src/viewBinder.tsx","webpack://esp-js-react/./src/viewBinderConnectable.tsx","webpack://esp-js-react/./src/viewBindingDecorator.ts","webpack://esp-js-react/external umd \"esp-js\"","webpack://esp-js-react/external umd \"esp-js-polimer\"","webpack://esp-js-react/external umd \"react\"","webpack://esp-js-react/webpack/bootstrap","webpack://esp-js-react/./src/index.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"esp-js\"), require(\"esp-js-polimer\"), require(\"react\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"esp-js\", \"esp-js-polimer\", \"react\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"esp-js-react\"] = factory(require(\"esp-js\"), require(\"esp-js-polimer\"), require(\"react\"));\n\telse\n\t\troot[\"esp-js-react\"] = factory(root[\"esp-js\"], root[\"esp-js-polimer\"], root[\"react\"]);\n})(self, (__WEBPACK_EXTERNAL_MODULE__152__, __WEBPACK_EXTERNAL_MODULE__43__, __WEBPACK_EXTERNAL_MODULE__155__) => {\nreturn ","/**\n * @license React\n * use-sync-external-store-with-selector.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var g=require(\"react\");function n(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var p=\"function\"===typeof Object.is?Object.is:n,q=g.useSyncExternalStore,r=g.useRef,t=g.useEffect,u=g.useMemo,v=g.useDebugValue;\nexports.useSyncExternalStoreWithSelector=function(a,b,e,l,h){var c=r(null);if(null===c.current){var f={hasValue:!1,value:null};c.current=f}else f=c.current;c=u(function(){function a(a){if(!c){c=!0;d=a;a=l(a);if(void 0!==h&&f.hasValue){var b=f.value;if(h(b,a))return k=b}return k=a}b=k;if(p(d,a))return b;var e=l(a);if(void 0!==h&&h(b,e))return b;d=a;return k=e}var c=!1,d,k,m=void 0===e?null:e;return[function(){return a(b())},null===m?void 0:function(){return a(m())}]},[b,e,l,h]);var d=q(a,c[0],c[1]);\nt(function(){f.hasValue=!0;f.value=d},[d]);v(d);return d};\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/use-sync-external-store-with-selector.production.min.js');\n} else {\n module.exports = require('./cjs/use-sync-external-store-with-selector.development.js');\n}\n","import * as React from 'react';\nimport {ConnectableComponent, ConnectableComponentProps, CreatePublishEventProps, MapModelToProps} from './connectableComponent';\n\n/**\n * @deprecated\n */\nexport type ConnectableComponentFactory<TModel, TPublishEventProps, TModelMappedToProps = {}> = (view: React.ComponentType) => (props: ConnectableComponentProps<TModel, TPublishEventProps, TModelMappedToProps>) => React.JSX.Element;\n\n/**\n * @deprecated\n * @param mapModelToProps\n * @param createPublishEventProps\n */\nexport const connect = function <TModel, TPublishEventProps, TModelMappedToProps = {}>(\n mapModelToProps?: MapModelToProps<TModel, TModelMappedToProps, TPublishEventProps>,\n createPublishEventProps?: CreatePublishEventProps<TPublishEventProps>\n): ConnectableComponentFactory<TModel, TPublishEventProps, TModelMappedToProps> {\n return function (view: React.ComponentType) {\n return function (props: ConnectableComponentProps<TModel, TPublishEventProps, TModelMappedToProps>) {\n const {modelId, viewContext, ...rest} = props;\n return <ConnectableComponent\n modelId={modelId}\n view={view}\n viewContext={viewContext}\n createPublishEventProps={createPublishEventProps}\n mapModelToProps={mapModelToProps}\n {...rest}\n />;\n };\n };\n};","import * as React from 'react';\nimport {useRouter} from './espRouterContextProvider';\nimport {useMemo} from 'react';\nimport {Router, utils} from 'esp-js';\nimport {EspModelContextProvider, useGetModelId} from './espModelContextProvider';\nimport {createViewForModel} from './viewBindingDecorator';\nimport {tryGetPolimerImmutableModel} from './polimer/getEspPolimerImmutableModel';\nimport {modelSelectorOptions, useModelSelector} from './useModelSelector';\n\n/**\n * @deprecated\n */\nexport type CreatePublishEventProps<TPublishEventProps> = (publishModelEvent: (eventType: string, event: any) => void) => TPublishEventProps;\n\n/**\n * @deprecated\n */\nexport type MapModelToProps<TModel, TModelMappedToProps, TPublishEventProps = {}> = (model: TModel, publishEventProps: TPublishEventProps) => TModelMappedToProps;\n\n/**\n * @deprecated\n */\nexport interface ConnectableComponentProps<TModel = {}, TPublishEventProps = {}, TModelMappedToProps = {}> {\n modelId?: string;\n viewContext?: string;\n view?: React.ComponentType;\n createPublishEventProps?: CreatePublishEventProps<TPublishEventProps>;\n mapModelToProps?: MapModelToProps<TModel, TModelMappedToProps, TPublishEventProps>;\n [key: string]: any; // ...rest props, including the result of mapPublish and mapPublish if 'connect' was used\n}\n\n/**\n * @deprecated\n */\nexport interface ConnectableComponentChildProps<TModel = object> {\n modelId: string;\n model: TModel;\n router: Router;\n [key: string]: any; // ...rest props\n}\n\nconst getChildProps = <TModel, TModelMappedToProps, TPublishEventProps>(\n router: Router,\n modelId: string,\n restProps: object,\n initialModel: TModel,\n mapModelToProps: MapModelToProps<TModel, TModelMappedToProps, TPublishEventProps>,\n publishEventProps: TPublishEventProps\n): ConnectableComponentChildProps<TModel> => {\n // consume what this component owns, and let the rest end up in `...rest`\n const model = tryGetPolimerImmutableModel<TModel>(initialModel);\n let childProps = {\n modelId,\n router: router,\n ...restProps,\n ...publishEventProps,\n model\n };\n if (mapModelToProps) {\n childProps = {\n ...childProps,\n ...(mapModelToProps(model, publishEventProps) as TModelMappedToProps)\n };\n }\n return childProps;\n};\n\n/**\n * @deprecated - use ViewBinderConnectable and ESP hooks if you need to dynamically bind a view to a model\n * or useModelSelector with other ESP hooks for direct model subscription.\n */\nexport const ConnectableComponent = <TModel = {}, TPublishEventProps = {}, TModelMappedToProps = {}>(\n {\n modelId,\n mapModelToProps,\n createPublishEventProps,\n view,\n viewContext,\n ...rest\n }: ConnectableComponentProps<TModel, TPublishEventProps, TModelMappedToProps>\n) => {\n const router = useRouter();\n modelId = modelId || useGetModelId();\n if (utils.stringIsEmpty(modelId) || !router) {\n return null;\n }\n const publishEventProps: TPublishEventProps = useMemo(\n () => {\n if (createPublishEventProps) {\n const publishModelEvent = (eventType: string, event: any) => {\n router.publishEvent(modelId, eventType, event);\n };\n return createPublishEventProps(publishModelEvent);\n }\n return {} as TPublishEventProps;\n },\n [router, modelId]\n );\n const model = useModelSelector<TModel, TModel>(\n m => m,\n modelSelectorOptions()\n .setModelId(modelId)\n .setTryPreSelectPolimerImmutableModel(false)\n );\n if (model == null) {\n return null;\n }\n let childProps = getChildProps(router, modelId, rest, model, mapModelToProps, publishEventProps);\n let viewElement = createViewForModel(model, childProps, viewContext, view);\n return (\n <EspModelContextProvider modelId={modelId} model={model} router={router} {...childProps}>\n {viewElement}\n </EspModelContextProvider>\n );\n};","import * as React from 'react';\nimport {DefaultModelAddress, Router, Status, Logger, utils} from 'esp-js';\nimport {useContext, useCallback, createContext, PropsWithChildren} from 'react';\nimport {useRouter} from './espRouterContextProvider';\n\nconst _log = Logger.create('EspModelContextProvider');\n\nexport type GetModelIdDelegate = () => string;\nexport const GetModelIdContext = createContext<GetModelIdDelegate>(null);\n/**\n * Returns a function which will return the ID of the model currently being rendered.\n */\nexport const useGetModelId = () => useContext(GetModelIdContext)();\n\nexport type GetModelDelegate = <TModel = any, >() => TModel;\nexport const GetModelContext = createContext<GetModelDelegate>(null);\n/**\n * Returns a function which will return the model set at last dispatch.\n */\nexport const useGetModel = () => useContext(GetModelContext)();\n\nexport type PublishModelEventDelegate = (eventType: string, event: any) => void;\nexport const PublishModelEventContext = createContext<PublishModelEventDelegate>(null);\n/**\n * Returns a function which can be used to publish an event to the current model being rendered.\n *\n * Effectively, this is a version of usePublishEvent() which closes over the current modelId.\n */\nexport const usePublishModelEvent = () => useContext(PublishModelEventContext);\n\nexport type PublishModelEventWithEntityKeyDelegate = (entityKey: string, eventType: string, event: any) => void;\nexport const PublishModelEventWithEntityKeyContext = createContext<PublishModelEventWithEntityKeyDelegate>(null);\n/**\n * Returns a function which can be used to publish an event to the current model being rendered, allows an entityKey to be specified.\n *\n * Effectively, this is a version of usePublishEvent() which closes over the current modelId.\n */\nexport const usePublishModelEventWithEntityKey = () => useContext(PublishModelEventWithEntityKeyContext);\n\nexport interface EspModelContextProviderProps {\n modelId: string;\n model?: unknown;\n}\n\nexport const EspModelContextProvider = ({modelId, children, model}: PropsWithChildren<EspModelContextProviderProps>) => {\n const router = useRouter();\n const getModelId: () => string = useCallback(() => {\n return modelId;\n }, [router, modelId]);\n const getModel: () => any = useCallback(() => {\n warnIfModelAccessedOutSideDispatchLoop(router, modelId);\n return model;\n }, [model, router, modelId]);\n const publishModelEvent: PublishModelEventDelegate = useCallback((eventType: string, event: any) => {\n router.publishEvent(modelId, eventType, event);\n }, [router, modelId]);\n const publishModelEventWithEntityKey: PublishModelEventWithEntityKeyDelegate = useCallback((entityKey: string, eventType: string, event: any) => {\n router.publishEvent(new DefaultModelAddress(modelId, entityKey), eventType, event);\n }, [router, modelId]);\n return (\n <GetModelIdContext.Provider value={getModelId}>\n <PublishModelEventContext.Provider value={publishModelEvent}>\n <PublishModelEventWithEntityKeyContext.Provider value={publishModelEventWithEntityKey}>\n <GetModelContext.Provider value={getModel}>\n {children}\n </GetModelContext.Provider>\n </PublishModelEventWithEntityKeyContext.Provider>\n </PublishModelEventContext.Provider>\n </GetModelIdContext.Provider>\n );\n};\n\nconst warnIfModelAccessedOutSideDispatchLoop = (router: Router, modelId: string) => {\n if (process.env.NODE_ENV === 'production') {\n return;\n }\n if (utils.stringIsEmpty(modelId)) {\n return;\n }\n let isDispatchModelUpdateStatus = router.isModelDispatchStatus(modelId, Status.DispatchModelUpdates);\n if (!isDispatchModelUpdateStatus) {\n let stack: string | undefined = undefined;\n try {\n // noinspection ExceptionCaughtLocallyJS\n throw new Error();\n } catch (e) {\n stack = (e as Error).stack;\n }\n _log.warn(\n `EspModelContextProvider useGetModelId has been invoked outside of the models (${modelId}) dispatch loop.` +\n `This may have unknown state state issues.` +\n stack\n );\n }\n};","// notice_start\n/*\n * Copyright 2015 Dev Shop Limited\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// notice_end\n\nimport * as React from 'react';\nimport {ModelAddress, Router} from 'esp-js';\nimport {PropsWithChildren, createContext, useContext, useCallback} from 'react';\n\nexport const RouterContext = createContext<Router>(null);\n\n/**\n * Get the esp Router from the RouterContext\n *\n * To use this, please ensure your V-DOM has the EspRouterContext at a higher node:\n *\n * <EspRouterContext router={router}>\n * <YourComponents />\n * </EspRouterContext>\n */\nexport const useRouter = () => {\n const context: Router = useContext(RouterContext);\n if (context === undefined) {\n throw new Error('useRouter must be used within a RouterContext.Provider');\n }\n return context;\n};\n\nexport type PublishEventDelegate = (modelIdOrModelAddress: string | ModelAddress, eventType: string, event: any) => void;\nexport const PublishEventContext = createContext<PublishEventDelegate>(null);\n\n/**\n * Returns a function which can be used to publish an event.\n *\n * To use this, please ensure your V-DOM has the EspRouterContext at a higher node:\n *\n * <EspRouterContextProvider router={router}>\n * <YourComponents />\n * </EspRouterContextProvider>\n */\nexport const usePublishEvent = () => useContext(PublishEventContext);\n\nexport type EspRouterContextProviderProps = PropsWithChildren<{ router: Router; }>;\n\n/**\n * Used to set the router on the RouterContext making it available to components down the tree via the useRouter() hook.\n *\n * Also sets up the usePublishEvent() hook so nested components can publish to the router.\n */\nexport const EspRouterContextProvider = ({children, router}: EspRouterContextProviderProps) => {\n const publishEvent: PublishEventDelegate = useCallback((modelIdOrModelAddress: string, eventType: string, event: any) => {\n router.publishEvent(modelIdOrModelAddress, eventType, event);\n }, [router]);\n return (\n <RouterContext.Provider value={router}>\n <PublishEventContext.Provider value={publishEvent}>\n {children}\n </PublishEventContext.Provider>\n </RouterContext.Provider>\n );\n};\n\n/**\n * Used to set the router on the RouterContext making it available to components down the tree (via useRouter()).\n *\n * @deprecated use EspRouterContextProvider\n */\nexport const RouterProvider = EspRouterContextProvider;\n\n/**\n * Props for RouterProvider\n *\n * @deprecated use EspRouterContextProviderProps\n */\nexport type RouterProviderProps = EspRouterContextProviderProps;\n","import {EspMetadata, EspDecoratorUtil, utils} from 'esp-js';\n\nexport interface GetEspPolimerImmutableModelMetadata {\n functionName: string;\n}\n\nexport namespace GetEspPolimerImmutableModelConsts {\n export const CustomDataKey = 'GetEspReactImmutableModelCustomDataKey';\n /**\n * If there is no @getEspPolimerImmutableModel decorator and a function by this name exists on a model, then it will be invoked to identify the sub model which will replaced the `model` prop passed to the child view of a ConnectableComponent\n */\n export const HandlerFunctionName = 'getEspPolimerImmutableModel';\n}\n\n/**\n * A decorator which can be used to identify the render model which will replaced the `model` prop passed to the child view of a ConnectableComponent\n */\nexport function getEspPolimerImmutableModel() {\n return function (target, name, descriptor) {\n let metadata: EspMetadata = EspDecoratorUtil.getOrCreateMetaData(target.constructor);\n metadata.addCustomData(\n GetEspPolimerImmutableModelConsts.CustomDataKey,\n <GetEspPolimerImmutableModelMetadata>{ functionName: name }\n );\n return descriptor;\n };\n}\n\n/**\n * Returns the model which will be used to pluck state/props for the current view.\n *\n * This is basically a hook (not a React 'hook') to call a function on `model` and get a new subgraph to use as state.\n *\n */\nexport const tryGetPolimerImmutableModel = <TImmutableModel>(model: any): TImmutableModel => {\n // does the given model have a decorated function we can invoke to get a different model to render?\n if (EspDecoratorUtil.hasMetadata(model)) {\n let metadata: GetEspPolimerImmutableModelMetadata = EspDecoratorUtil.getCustomData(model, GetEspPolimerImmutableModelConsts.CustomDataKey);\n if (metadata) {\n return model[metadata.functionName]();\n }\n }\n // else see if there is a function with name GetEspPolimerImmutableModelConsts.HandlerFunctionName we can invoke to get a different model to render?\n let immutableModel = model[GetEspPolimerImmutableModelConsts.HandlerFunctionName];\n if (immutableModel && utils.isFunction(immutableModel)) {\n return immutableModel.call(model);\n }\n // else return the initial model passed in\n return model;\n};","import {PolimerModelBuilder, PolimerModel} from 'esp-js-polimer';\nimport {DEFAULT_VIEW_KEY, viewBinding} from '../viewBindingDecorator';\n\ndeclare module 'esp-js-polimer/.dist/typings/modelBuilderUpdater' {\n export interface PolimerModelBuilder<TModel> {\n withViewBindings?(view: any, displayContext?: string): PolimerModelBuilder<TModel>;\n }\n}\n\ninterface ViewMappings {\n [displayContext: string]: any;\n}\n\nPolimerModelBuilder.prototype.withViewBindings = function (view: any, displayContext: string = DEFAULT_VIEW_KEY): PolimerModelBuilder<any> {\n let builder = this;\n // store some metadata on the builder which we'll use later to tack onto the model\n let viewMappings: ViewMappings = builder._viewMappings || { };\n viewMappings[displayContext] = view;\n builder._viewMappings = viewMappings;\n return this;\n};\n\n// we need to replace the registerWithRouter in order to dynamically add the\n// @viewBinding decorator to it\nlet registerWithRouter = PolimerModelBuilder.prototype.registerWithRouter;\nPolimerModelBuilder.prototype.registerWithRouter = function (): PolimerModel<any> {\n let builder = this;\n let model = registerWithRouter.call(builder);\n let viewMappings: ViewMappings = builder._viewMappings;\n if (viewMappings) {\n Object.keys(viewMappings).forEach(displayContext => {\n viewBinding(viewMappings[displayContext], displayContext)(model.constructor);\n });\n }\n return model;\n};\n","import {useMemo} from 'react';\nimport {useSyncExternalStoreWithSelector} from 'use-sync-external-store/with-selector';\nimport {Guard, utils} from 'esp-js';\nimport {useRouter} from './espRouterContextProvider';\nimport {useGetModelId} from './espModelContextProvider';\nimport {tryGetPolimerImmutableModel} from './polimer/getEspPolimerImmutableModel';\n\nexport type ModelSelectorEqualityFn<T> = (last: T, next: T) => boolean;\n\n/**\n * @param modelId - the modelId of the model to be observed via the esp Router.\n * @param tryPreSelectPolimerImmutableModel - if true, and the esp model is an esp-js-polimer model, the immutable model will be used when calling the selector.\n * @param equalityFn - Equality function which will be applied against TSelected, defaults to instance equality (a === b).\n */\nexport type ModelSelectorOptions<TSelected> = {\n modelId?: string,\n tryPreSelectPolimerImmutableModel: boolean,\n equalityFn: ModelSelectorEqualityFn<TSelected>\n};\n\nexport interface EditableModelSelectorOptions<TSelected> extends ModelSelectorOptions<TSelected> {\n setModelId(modelId: string): this;\n\n setTryPreSelectPolimerImmutableModel(value: boolean): this;\n\n setEqualityFn(fn: (a: TSelected, b: TSelected) => boolean): this;\n}\n\nexport const modelSelectorOptions = <TSelected>() => {\n let modelId = undefined;\n let equalityFn: ModelSelectorEqualityFn<TSelected> = (a: TSelected, b: TSelected) => a === b;\n let tryPreSelectPolimerImmutableModel = true;\n return {\n get modelId() {\n return modelId;\n },\n setModelId(value: string) {\n modelId = value;\n return this;\n },\n get equalityFn() {\n return equalityFn;\n },\n setEqualityFn(value: ModelSelectorEqualityFn<TSelected>) {\n equalityFn = value;\n return this;\n },\n get tryPreSelectPolimerImmutableModel() {\n return tryPreSelectPolimerImmutableModel;\n },\n setTryPreSelectPolimerImmutableModel(value: boolean) {\n tryPreSelectPolimerImmutableModel = value;\n return this;\n }\n } as EditableModelSelectorOptions<TSelected>;\n};\n\nexport type UseModelSelector = <TModel, TSelected>(\n selector: (model: TModel) => TSelected,\n options?: ModelSelectorOptions<TSelected>\n) => TSelected;\n\n/**\n * A hook which returns model state from the esp Router.\n *\n * This hooks wih observe updates and re-render the component if the model changes.\n *\n * @param selector - a function to select a selection of the model - the selector does not need to be memoized, this selector will be cached against the modelId.\n * @param options\n */\nexport const useModelSelector: UseModelSelector = <TModel, TSelected>(\n selector: (model: TModel) => TSelected,\n options: ModelSelectorOptions<TSelected> = modelSelectorOptions<TSelected>()\n) => {\n Guard.isFunction(selector, 'You must pass a selector function to connectSelector');\n const router = useRouter();\n const modelId = options?.modelId || useGetModelId();\n const tryPreSelectPolimerImmutableModel = options?.tryPreSelectPolimerImmutableModel;\n const equalityFn = options?.equalityFn;\n const dependencies = useMemo(\n () => {\n // Because of how useSyncExternalStore works, there is an implicit dependency between the subscribe and getSnapshot functions.\n // When the subscription receives the new state from the Router, it can't pass this directly onto getSnapshot, React calls that when it deems it needs to.\n // Given that, we need to cache the state which getSnapshot will return.\n //\n // It's not ideal but shouldn't be a problem as here we've wrapped all these dependent functions inside a single useMemo()\n let model: TModel = null;\n return {\n subscribe: (stateChanged: () => void) => {\n const modelSubscriptionDisposable = router\n .getModelObservable(modelId)\n .subscribe(\n (m: any) => {\n // try and get a submodel to render\n const nextModel = tryPreSelectPolimerImmutableModel\n ? tryGetPolimerImmutableModel(m)\n : m;\n // if the above didn't manage to get a submodel,\n // we need to mutate to force useSyncExternalStoreWithSelector to pick up the change\n model = nextModel === m\n ? Object.create(nextModel)\n : nextModel;\n stateChanged();\n }\n );\n return () => {\n model = null;\n modelSubscriptionDisposable.dispose();\n };\n },\n // React expects getSnapshot to be immutable, it'll only re-render if the instance changes\n getSnapshot: () => {\n return model;\n },\n // While getSnapshot needs to model to be immutable,\n // useSyncExternalStoreWithSelector builds on top of this, so the TSelected can defer to an equality check to determine if the change is propagated.\n // The selector here just maps the TSelected, useSyncExternalStoreWithSelector internally does the equality check.\n wrappedSelector: (snapshot: TModel) => {\n // The first time this renders, react calls getSnapshot and the selector before the router has pushed a change.\n // In that case, there is no state for any component to process, therefore, we return null;\n return snapshot\n ? selector(snapshot)\n : null;\n }\n };\n },\n // Don't cache check against 'selector' argument as that will likely change unless the caller memoizes it.\n [router, modelId]\n );\n\n // If we don't have a modelId, we still need to return a hook so React doesn't complain.\n // Additionally, we need to let the above expiration (dependencies) run to unsubscribe from any previous subscription.\n if (utils.stringIsEmpty(modelId)) {\n return useSyncExternalStoreWithSelector(\n noopSubscription.subscribe,\n noopSubscription.getSnapshot,\n undefined,\n noopSubscription.wrappedSelector,\n equalityFn\n );\n }\n\n // Docs on useSyncExternalStore https://github.com/reactwg/react-18/discussions/86\n // Redux's usage of this: https://github.com/reduxjs/react-redux/blob/master/src/hooks/useSelector.ts\n // Code: https://github.com/facebook/react/blob/main/packages/use-sync-external-store/src/useSyncExternalStoreWithSelector.js\n return useSyncExternalStoreWithSelector(\n dependencies.subscribe,\n dependencies.getSnapshot,\n undefined,\n dependencies.wrappedSelector,\n equalityFn,\n );\n};\n\nconst noopSubscription = {\n subscribe: () => { },\n getSnapshot: () => null,\n wrappedSelector: () => true\n};","// notice_start\n/*\n * Copyright 2015 Dev Shop Limited\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// notice_end\n\nimport * as React from 'react';\nimport {createViewForModel} from './viewBindingDecorator';\nimport {useRouter} from './espRouterContextProvider';\n\nexport interface ViewBinderProps {\n model: any;\n viewContext: string;\n}\n\nexport const ViewBinder: React.FC<ViewBinderProps> = ({model, viewContext, ...rest}) => {\n if (model) {\n const router = useRouter();\n const newProps = Object.assign({}, {model, router}, rest);\n return createViewForModel(\n model,\n newProps,\n viewContext,\n null\n );\n }\n return null;\n};","import {useRouter} from './espRouterContextProvider';\nimport {EspModelContextProvider} from './espModelContextProvider';\nimport {Logger, Router} from 'esp-js';\nimport * as React from 'react';\nimport {modelSelectorOptions, useModelSelector} from './useModelSelector';\nimport {createViewForModel} from './viewBindingDecorator';\nimport {tryGetPolimerImmutableModel} from './polimer/getEspPolimerImmutableModel';\n\nconst _log = Logger.create('ViewBinderConnectable');\n\nexport interface ViewBinderConnectableProps {\n modelId?: string;\n viewContext?: string;\n view?: React.ComponentType;\n}\n\ninterface ViewBinderConnectableChildProps {\n modelId: string;\n model: object;\n router: Router;\n}\n\n/**\n * Dynamically binds a view found via @viewBinder(SomeJsXView) to a model managed by the Router.\n * Optionally provide a view override and/or a viewContext\n * @param modelId\n * @param viewContext\n * @param view\n * @constructor\n */\nexport const ViewBinderConnectable = ({modelId, viewContext, view}: ViewBinderConnectableProps) => {\n const router = useRouter();\n const model = useModelSelector<object, object>(\n m => m,\n modelSelectorOptions()\n .setModelId(modelId)\n .setTryPreSelectPolimerImmutableModel(false)\n );\n if (!model) {\n return null;\n }\n let immutableModel = tryGetPolimerImmutableModel<object>(model);\n const childProps: ViewBinderConnectableChildProps = {\n modelId,\n router: router,\n model: immutableModel\n };\n let viewElement = createViewForModel(model, childProps, viewContext, view);\n return (\n <EspModelContextProvider modelId={modelId} router={router} model={immutableModel} {...childProps}>\n {viewElement}\n </EspModelContextProvider>\n );\n};","// notice_start\n/*\n * Copyright 2015 Dev Shop Limited\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// notice_end\n\nimport * as React from 'react';\nimport {Guard} from 'esp-js';\n\nexport const DEFAULT_VIEW_KEY = 'default-view-key';\n\nfunction getMetadata(target) {\n if (!target._viewMetadata) {\n target._viewMetadata = new ViewMetadata();\n }\n return target._viewMetadata;\n}\n\n/**\n * Tries to get a view for the given model.\n *\n * It does this using the following order:\n * 1) If a @viewBinding decorator was used and a display context was given, try get a view for that\n * 2) Else if a view was explicitly provided use that\n * 3) Else if a @viewBinding decorator was used and there is a view associated with the default display context, use that view\n * @param model\n * @param props\n * @param displayContext\n * @param view\n */\nexport function createViewForModel(model: any, props, displayContext: string, view: React.ComponentType) {\n let finalView: React.ComponentType = view; // default to that passed in, if any.\n\n // displayContext = displayContext || DEFAULT_VIEW_KEY;\n // the view decorator isn't on the instance, it's on the constructor function that created that instance\n if (model) {\n let constructorFunction = model.constructor;\n if (constructorFunction._viewMetadata) {\n let viewMetadata = constructorFunction._viewMetadata;\n if (displayContext && viewMetadata.hasRegisteredViewContext(displayContext)) {\n let viewMetadataRegistration = viewMetadata.viewRegistrations[displayContext];\n // we've found a view for the display context, use that\n finalView = viewMetadataRegistration.view;\n }\n\n // if we've not found a view yet, and one wasn't provided, is there a default one?\n if (!finalView && viewMetadata.hasRegisteredViewContext(DEFAULT_VIEW_KEY)) {\n let viewMetadataRegistration = viewMetadata.viewRegistrations[DEFAULT_VIEW_KEY];\n finalView = viewMetadataRegistration.view;\n }\n }\n }\n if (!finalView) {\n throw new Error(`No suitable view found for model id '${model.modelId}' using context '${displayContext}'`);\n }\n return React.createElement(finalView, props);\n}\n\n/**\n * An ES7 style decorator that associates a model with a view\n * @param view the react component that will be used to display this model\n * @param displayContext an optional context allowing for different views to display the same model\n * @returns {Function}\n */\nexport function viewBinding(view: any, displayContext: string = DEFAULT_VIEW_KEY) {\n Guard.isDefined(view, 'view must be defined');\n Guard.isString(displayContext, 'displayContext must be a string');\n return function (target) {\n let viewMetadata = getMetadata(target);\n if (viewMetadata.hasRegisteredViewContext(displayContext)) {\n throw new Error(`Context ${displayContext} already registered for view`);\n }\n viewMetadata.viewRegistrations[displayContext] = new ViewMetadataRegistration(view, displayContext);\n };\n}\n\nexport class ViewMetadata {\n private _viewRegistrations = {};\n\n get viewRegistrations() {\n return this._viewRegistrations;\n }\n\n hasRegisteredViewContext(displayContext) {\n return typeof this._viewRegistrations[displayContext] !== 'undefined';\n }\n}\n\nexport class ViewMetadataRegistration {\n\n constructor(private _view, private _displayContext) {\n }\n\n get view() {\n return this._view;\n }\n\n get displayContext() {\n return this._displayContext;\n }\n}","module.exports = __WEBPACK_EXTERNAL_MODULE__152__;","module.exports = __WEBPACK_EXTERNAL_MODULE__43__;","module.exports = __WEBPACK_EXTERNAL_MODULE__155__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// notice_start\n/*\n * Copyright 2015 Dev Shop Limited\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// notice_end\n//\n\n// import for side effects\nimport './polimer/polimerModelBuilderExtentsions';\n\nexport {ViewBinder} from './viewBinder';\nexport {\n ViewBinderConnectableProps,\n ViewBinderConnectable\n} from './viewBinderConnectable';\nexport {viewBinding, DEFAULT_VIEW_KEY} from './viewBindingDecorator';\nexport {\n GetEspPolimerImmutableModelMetadata,\n GetEspPolimerImmutableModelConsts,\n getEspPolimerImmutableModel\n} from './polimer/getEspPolimerImmutableModel';\nexport {createViewForModel} from './viewBindingDecorator';\nexport {\n connect,\n ConnectableComponentFactory\n} from './connect';\nexport {\n CreatePublishEventProps,\n MapModelToProps,\n ConnectableComponentProps,\n ConnectableComponentChildProps,\n ConnectableComponent,\n} from './connectableComponent';\nexport {\n UseModelSelector,\n useModelSelector,\n EditableModelSelectorOptions,\n modelSelectorOptions,\n ModelSelectorOptions,\n ModelSelectorEqualityFn,\n} from './useModelSelector';\nexport {\n RouterProvider,\n RouterProviderProps,\n EspRouterContextProvider,\n EspRouterContextProviderProps,\n RouterContext,\n useRouter,\n PublishEventDelegate,\n PublishEventContext,\n usePublishEvent,\n} from './espRouterContextProvider';\nexport {\n useGetModelId,\n GetModelIdDelegate,\n GetModelIdContext,\n useGetModel,\n GetModelDelegate,\n GetModelContext,\n PublishModelEventDelegate,\n PublishModelEventContext,\n usePublishModelEvent,\n PublishModelEventWithEntityKeyDelegate,\n PublishModelEventWithEntityKeyContext,\n usePublishModelEventWithEntityKey,\n EspModelContextProvider,\n EspModelContextProviderProps,\n} from './espModelContextProvider';\n"],"names":[],"sourceRoot":""}
1
+ {"version":3,"file":"esp-react.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACa,MAAM,mBAAO,CAAC,GAAO,EAAE,gBAAgB,+CAA+C;AACnG,wCAAwC,qBAAqB,cAAc,qBAAqB,OAAO,wBAAwB,YAAY,iBAAiB,eAAe,cAAc,OAAO,KAAK,IAAI,OAAO,2BAA2B,cAAc,qBAAqB,WAAW,IAAI,mBAAmB,WAAW,+BAA+B,IAAI,WAAW,iCAAiC,kBAAkB,cAAc,4BAA4B,cAAc,EAAE,YAAY;AACle,aAAa,cAAc,UAAU,MAAM,KAAK;;;;;;;;ACXnC;;AAEb,IAAI,IAAqC;AACzC,EAAE,yCAAyF;AAC3F,EAAE,KAAK,EAEN;;;;;;;;;;;;;;;;;;;;;;ACND,uCAA+B;AAC/B,wDAAiI;AAIjI;;;GAGG;AACI,MAAM,OAAO,GAAG,UACnB,eAAkF,EAClF,uBAAqE;IAErE,OAAO,UAAU,IAAyB;QACtC,OAAO,UAAU,KAAiF;YAC9F,MAAM,EAAC,OAAO,EAAE,WAAW,KAAa,KAAK,EAAb,IAAI,UAAI,KAAK,EAAvC,0BAA+B,CAAQ,CAAC;YAC9C,OAAO,oBAAC,2CAAoB,kBACxB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,WAAW,EACxB,uBAAuB,EAAE,uBAAuB,EAChD,eAAe,EAAE,eAAe,IAC5B,IAAI,EACV,CAAC;QACP,CAAC,CAAC;IACN,CAAC,CAAC;AACN,CAAC,CAAC;AAjBW,eAAO,WAiBlB;;;;;;;;;;;;;;;;;;;;;;AC1BF,uCAA+B;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;;AChHD;;;;;;;ACAA;;;;;;;ACAA;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;;;;ACtBA,eAAe;AACf;;;;;;;;;;;;;;GAcG;AACH,aAAa;AACb,EAAE;;;AAEF,0BAA0B;AAC1B,yBAAkD;AAElD,4CAAwC;AAAhC,mHAAU;AAClB,sDAAqE;AAA7D,+HAAW;AAAE,yIAAgB;AACrC,6DAI+C;AAF3C,kLAAiC;AACjC,sKAA2B;AAE/B,sDAA0D;AAAlD,6IAAkB;AAC1B,yCAGmB;AAFf,0GAAO;AAGX,sDAMgC;AAD5B,iJAAoB;AAExB,0DAMoC;AALhC,6JAAwB;AAExB,qKAA4B;AAIhC,0DAUoC;AAThC,yIAAc;AAEd,6JAAwB;AAExB,uIAAa;AACb,+HAAS;AAET,mJAAmB;AACnB,2IAAe;AAEnB,yDAamC;AAZ/B,sIAAa;AACb,8IAAiB;AACjB,kIAAW;AACX,0IAAe;AAEf,4JAAwB;AACxB,oJAAoB;AAEpB,sLAAqC;AACrC,8KAAiC;AACjC,0JAAuB","sources":["webpack://esp-js-react/webpack/universalModuleDefinition","webpack://esp-js-react/../../node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.production.min.js","webpack://esp-js-react/../../node_modules/use-sync-external-store/with-selector.js","webpack://esp-js-react/./src/connect.tsx","webpack://esp-js-react/./src/connectableComponent.tsx","webpack://esp-js-react/./src/espModelContextProvider.tsx","webpack://esp-js-react/./src/espRouterContextProvider.tsx","webpack://esp-js-react/./src/polimer/getEspPolimerImmutableModel.ts","webpack://esp-js-react/./src/polimer/polimerModelBuilderExtentsions.ts","webpack://esp-js-react/./src/useSyncModelWithSelector.ts","webpack://esp-js-react/./src/viewBinder.tsx","webpack://esp-js-react/./src/viewBindingDecorator.ts","webpack://esp-js-react/external umd \"esp-js\"","webpack://esp-js-react/external umd \"esp-js-polimer\"","webpack://esp-js-react/external umd \"react\"","webpack://esp-js-react/webpack/bootstrap","webpack://esp-js-react/./src/index.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"esp-js\"), require(\"esp-js-polimer\"), require(\"react\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"esp-js\", \"esp-js-polimer\", \"react\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"esp-js-react\"] = factory(require(\"esp-js\"), require(\"esp-js-polimer\"), require(\"react\"));\n\telse\n\t\troot[\"esp-js-react\"] = factory(root[\"esp-js\"], root[\"esp-js-polimer\"], root[\"react\"]);\n})(self, (__WEBPACK_EXTERNAL_MODULE__152__, __WEBPACK_EXTERNAL_MODULE__43__, __WEBPACK_EXTERNAL_MODULE__155__) => {\nreturn ","/**\n * @license React\n * use-sync-external-store-with-selector.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var g=require(\"react\");function n(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var p=\"function\"===typeof Object.is?Object.is:n,q=g.useSyncExternalStore,r=g.useRef,t=g.useEffect,u=g.useMemo,v=g.useDebugValue;\nexports.useSyncExternalStoreWithSelector=function(a,b,e,l,h){var c=r(null);if(null===c.current){var f={hasValue:!1,value:null};c.current=f}else f=c.current;c=u(function(){function a(a){if(!c){c=!0;d=a;a=l(a);if(void 0!==h&&f.hasValue){var b=f.value;if(h(b,a))return k=b}return k=a}b=k;if(p(d,a))return b;var e=l(a);if(void 0!==h&&h(b,e))return b;d=a;return k=e}var c=!1,d,k,m=void 0===e?null:e;return[function(){return a(b())},null===m?void 0:function(){return a(m())}]},[b,e,l,h]);var d=q(a,c[0],c[1]);\nt(function(){f.hasValue=!0;f.value=d},[d]);v(d);return d};\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/use-sync-external-store-with-selector.production.min.js');\n} else {\n module.exports = require('./cjs/use-sync-external-store-with-selector.development.js');\n}\n","import * as React from 'react';\nimport {ConnectableComponent, ConnectableComponentProps, CreatePublishEventProps, MapModelToProps} from './connectableComponent';\n\nexport type ConnectableComponentFactory<TModel, TPublishEventProps, TModelMappedToProps = {}> = (view: React.ComponentType) => (props: ConnectableComponentProps<TModel, TPublishEventProps, TModelMappedToProps>) => React.JSX.Element;\n\n/**\n * @param mapModelToProps - maps the model to a different structure, that structure is sent as props to the view.\n * @param createPublishEventProps - creates functions to publish events, the structure is sent as props to the view.\n */\nexport const connect = function <TModel, TPublishEventProps, TModelMappedToProps = {}>(\n mapModelToProps?: MapModelToProps<TModel, TModelMappedToProps, TPublishEventProps>,\n createPublishEventProps?: CreatePublishEventProps<TPublishEventProps>\n): ConnectableComponentFactory<TModel, TPublishEventProps, TModelMappedToProps> {\n return function (view: React.ComponentType) {\n return function (props: ConnectableComponentProps<TModel, TPublishEventProps, TModelMappedToProps>) {\n const {modelId, viewContext, ...rest} = props;\n return <ConnectableComponent\n modelId={modelId}\n view={view}\n viewContext={viewContext}\n createPublishEventProps={createPublishEventProps}\n mapModelToProps={mapModelToProps}\n {...rest}\n />;\n };\n };\n};","import * as React from 'react';\nimport {useRouter} from './espRouterContextProvider';\nimport {useMemo} from 'react';\nimport {Router, utils} from 'esp-js';\nimport {EspModelContextProvider, useGetModelId} from './espModelContextProvider';\nimport {createViewForModel} from './viewBindingDecorator';\nimport {tryGetPolimerImmutableModel} from './polimer/getEspPolimerImmutableModel';\nimport {syncModelWithSelectorOptions, useSyncModelWithSelector} from './useSyncModelWithSelector';\n\nexport type CreatePublishEventProps<TPublishEventProps> = (publishModelEvent: (eventType: string, event: any) => void) => TPublishEventProps;\n\nexport type MapModelToProps<TModel, TModelMappedToProps, TPublishEventProps = {}> = (model: TModel, publishEventProps: TPublishEventProps) => TModelMappedToProps;\n\nexport interface ConnectableComponentProps<TModel = {}, TPublishEventProps = {}, TModelMappedToProps = {}> {\n modelId?: string;\n viewContext?: string;\n view?: React.ComponentType;\n createPublishEventProps?: CreatePublishEventProps<TPublishEventProps>;\n mapModelToProps?: MapModelToProps<TModel, TModelMappedToProps, TPublishEventProps>;\n [key: string]: any; // ...rest props, including the result of mapPublish and mapPublish if 'connect' was used\n}\n\nexport interface ConnectableComponentChildProps<TModel = object> {\n modelId: string;\n model: TModel;\n router: Router;\n [key: string]: any; // ...rest props\n}\n\nconst getChildProps = <TModel, TModelMappedToProps, TPublishEventProps>(\n router: Router,\n modelId: string,\n restProps: object,\n initialModel: TModel,\n mapModelToProps: MapModelToProps<TModel, TModelMappedToProps, TPublishEventProps>,\n publishEventProps: TPublishEventProps\n): ConnectableComponentChildProps<TModel> => {\n const model = tryGetPolimerImmutableModel<TModel>(initialModel);\n let childProps = {\n modelId,\n router: router,\n ...restProps,\n ...publishEventProps,\n model\n };\n if (mapModelToProps) {\n childProps = {\n ...childProps,\n ...(mapModelToProps(model, publishEventProps) as TModelMappedToProps)\n };\n }\n return childProps;\n};\n\nexport const ConnectableComponent = <TModel = {}, TPublishEventProps = {}, TModelMappedToProps = {}>(\n {\n modelId,\n mapModelToProps,\n createPublishEventProps,\n view,\n viewContext,\n ...rest\n }: ConnectableComponentProps<TModel, TPublishEventProps, TModelMappedToProps>\n) => {\n const router = useRouter();\n modelId = modelId || useGetModelId();\n if (utils.stringIsEmpty(modelId) || !router) {\n return null;\n }\n const publishEventProps: TPublishEventProps = useMemo(\n () => {\n if (createPublishEventProps) {\n const publishModelEvent = (eventType: string, event: any) => {\n router.publishEvent(modelId, eventType, event);\n };\n return createPublishEventProps(publishModelEvent);\n }\n return {} as TPublishEventProps;\n },\n [router, modelId]\n );\n const model = useSyncModelWithSelector<TModel, TModel>(\n m => m,\n syncModelWithSelectorOptions()\n .setModelId(modelId)\n .setTryPreSelectPolimerImmutableModel(false)\n );\n if (model == null) {\n return null;\n }\n let childProps = getChildProps(router, modelId, rest, model, mapModelToProps, publishEventProps);\n let viewElement = createViewForModel(model, childProps, viewContext, view);\n return (\n <EspModelContextProvider modelId={modelId} model={model} router={router} {...childProps}>\n {viewElement}\n </EspModelContextProvider>\n );\n};","import * as React from 'react';\nimport {DefaultModelAddress, Router, Status, Logger, utils} from 'esp-js';\nimport {useContext, useCallback, createContext, PropsWithChildren} from 'react';\nimport {useRouter} from './espRouterContextProvider';\n\nconst _log = Logger.create('EspModelContextProvider');\n\nexport const GetModelIdContext = createContext<string>(null);\n/**\n * Returns a function to get the ID of the model connected at a higher point in the V-DOM.\n *\n * To use this, please ensure your V-DOM has the EspModelContextProvider at a higher node.\n */\nexport const useGetModelId = () => useContext(GetModelIdContext);\n\nexport const GetModelContext = createContext<object>(null);\n/**\n * Returns a function which will return the model connected at a higher point in the V-DOM.\n *\n * To use this, please ensure your V-DOM has the EspModelContextProvider at a higher node.\n */\nexport const useGetModel = <TModel,>() => useContext(GetModelContext) as TModel;\n\nexport type PublishModelEventDelegate = (eventType: string, event: any) => void;\nexport const PublishModelEventContext = createContext<PublishModelEventDelegate>(null);\n/**\n * Returns a function which can be used to publish an event to the model connected at a higher point in the V-DOM.\n *\n * Effectively, this is a version of usePublishEvent() which closes over the relevant modelId.\n *\n * To use this, please ensure your V-DOM has the EspModelContextProvider at a higher node.\n */\nexport const usePublishModelEvent = () => useContext(PublishModelEventContext);\n\nexport type PublishModelEventWithEntityKeyDelegate = (entityKey: string, eventType: string, event: any) => void;\nexport const PublishModelEventWithEntityKeyContext = createContext<PublishModelEventWithEntityKeyDelegate>(null);\n/**\n * Returns a function which can be used to publish an event to the model connected at a higher point in the V-DOM, allows an entityKey to be specified.\n *\n * Effectively, this is a version of usePublishEvent() which closes over the modelId.\n *\n * To use this, please ensure your V-DOM has the EspModelContextProvider at a higher node.\n */\nexport const usePublishModelEventWithEntityKey = () => useContext(PublishModelEventWithEntityKeyContext);\n\nexport interface EspModelContextProviderProps {\n modelId: string;\n model?: any;\n}\n\n/**\n * Sets up various ESP context so ESP hooks are available below this point in the V-DOM\n *\n * To use this, please ensure your V-DOM has the EspRouterContextProvider at a higher node.\n * @param modelId\n * @param children\n * @param model\n * @constructor\n */\nexport const EspModelContextProvider = ({modelId, children, model}: PropsWithChildren<EspModelContextProviderProps>) => {\n const router = useRouter();\n const publishModelEvent: PublishModelEventDelegate = useCallback((eventType: string, event: any) => {\n router.publishEvent(modelId, eventType, event);\n }, [router, modelId]);\n const publishModelEventWithEntityKey: PublishModelEventWithEntityKeyDelegate = useCallback((entityKey: string, eventType: string, event: any) => {\n router.publishEvent(new DefaultModelAddress(modelId, entityKey), eventType, event);\n }, [router, modelId]);\n return (\n <GetModelIdContext.Provider value={modelId}>\n <PublishModelEventContext.Provider value={publishModelEvent}>\n <PublishModelEventWithEntityKeyContext.Provider value={publishModelEventWithEntityKey}>\n <GetModelContext.Provider value={model}>\n {children}\n </GetModelContext.Provider>\n </PublishModelEventWithEntityKeyContext.Provider>\n </PublishModelEventContext.Provider>\n </GetModelIdContext.Provider>\n );\n};","// notice_start\n/*\n * Copyright 2015 Dev Shop Limited\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// notice_end\n\nimport * as React from 'react';\nimport {ModelAddress, Router} from 'esp-js';\nimport {PropsWithChildren, createContext, useContext, useCallback} from 'react';\n\nexport const RouterContext = createContext<Router>(null);\n\n/**\n * Get the esp Router from context.\n *\n * To use this, please ensure your V-DOM has the EspRouterContextProvider at a higher node:\n *\n * <EspRouterContextProvider router={router}>\n * <YourComponents />\n * </EspRouterContextProvider>\n */\nexport const useRouter = () => {\n const context: Router = useContext(RouterContext);\n if (context === undefined) {\n throw new Error('useRouter must be used within a RouterContext.Provider');\n }\n return context;\n};\n\nexport type PublishEventDelegate = (modelIdOrModelAddress: string | ModelAddress, eventType: string, event: any) => void;\nexport const PublishEventContext = createContext<PublishEventDelegate>(null);\n\n/**\n * Returns a function which can be used to publish an event.\n *\n * To use this, please ensure your V-DOM has the EspRouterContextProvider at a higher node:\n *\n * <EspRouterContextProvider router={router}>\n * <YourComponents />\n * </EspRouterContextProvider>\n */\nexport const usePublishEvent = () => useContext(PublishEventContext);\n\nexport type EspRouterContextProviderProps = PropsWithChildren<{ router: Router; }>;\n\n/**\n * Used to set the router on the RouterContext making it available to components down the tree via the useRouter() hook.\n *\n * Also sets up the usePublishEvent() hook so nested components can publish to the router.\n */\nexport const EspRouterContextProvider = ({children, router}: EspRouterContextProviderProps) => {\n const publishEvent: PublishEventDelegate = useCallback((modelIdOrModelAddress: string, eventType: string, event: any) => {\n router.publishEvent(modelIdOrModelAddress, eventType, event);\n }, [router]);\n return (\n <RouterContext.Provider value={router}>\n <PublishEventContext.Provider value={publishEvent}>\n {children}\n </PublishEventContext.Provider>\n </RouterContext.Provider>\n );\n};\n\n/**\n * Used to set the router on the RouterContext making it available to components down the tree (via useRouter()).\n *\n * @deprecated use EspRouterContextProvider\n */\nexport const RouterProvider = EspRouterContextProvider;\n\n/**\n * Props for RouterProvider\n *\n * @deprecated use EspRouterContextProviderProps\n */\nexport type RouterProviderProps = EspRouterContextProviderProps;\n","import {EspMetadata, EspDecoratorUtil, utils} from 'esp-js';\n\nexport interface GetEspPolimerImmutableModelMetadata {\n functionName: string;\n}\n\nexport namespace GetEspPolimerImmutableModelConsts {\n export const CustomDataKey = 'GetEspReactImmutableModelCustomDataKey';\n /**\n * If there is no @getEspPolimerImmutableModel decorator and a function by this name exists on a model, then it will be invoked to identify the sub model which will replaced the `model` prop passed to the child view of a ConnectableComponent\n */\n export const HandlerFunctionName = 'getEspPolimerImmutableModel';\n}\n\n/**\n * A decorator which can be used to identify the render model which will replaced the `model` prop passed to the child view of a ConnectableComponent\n */\nexport function getEspPolimerImmutableModel() {\n return function (target, name, descriptor) {\n let metadata: EspMetadata = EspDecoratorUtil.getOrCreateMetaData(target.constructor);\n metadata.addCustomData(\n GetEspPolimerImmutableModelConsts.CustomDataKey,\n <GetEspPolimerImmutableModelMetadata>{ functionName: name }\n );\n return descriptor;\n };\n}\n\n/**\n * Returns the model which will be used to pluck state/props for the current view.\n *\n * This is basically a hook (not a React 'hook') to call a function on `model` and get a new subgraph to use as state.\n *\n */\nexport const tryGetPolimerImmutableModel = <TImmutableModel>(model: any): TImmutableModel => {\n // does the given model have a decorated function we can invoke to get a different model to render?\n if (EspDecoratorUtil.hasMetadata(model)) {\n let metadata: GetEspPolimerImmutableModelMetadata = EspDecoratorUtil.getCustomData(model, GetEspPolimerImmutableModelConsts.CustomDataKey);\n if (metadata) {\n return model[metadata.functionName]();\n }\n }\n // else see if there is a function with name GetEspPolimerImmutableModelConsts.HandlerFunctionName we can invoke to get a different model to render?\n let immutableModel = model[GetEspPolimerImmutableModelConsts.HandlerFunctionName];\n if (immutableModel && utils.isFunction(immutableModel)) {\n return immutableModel.call(model);\n }\n // else return the initial model passed in\n return model;\n};","import {PolimerModelBuilder, PolimerModel} from 'esp-js-polimer';\nimport {DEFAULT_VIEW_KEY, viewBinding} from '../viewBindingDecorator';\n\ndeclare module 'esp-js-polimer/.dist/typings/modelBuilderUpdater' {\n export interface PolimerModelBuilder<TModel> {\n withViewBindings?(view: any, displayContext?: string): PolimerModelBuilder<TModel>;\n }\n}\n\ninterface ViewMappings {\n [displayContext: string]: any;\n}\n\nPolimerModelBuilder.prototype.withViewBindings = function (view: any, displayContext: string = DEFAULT_VIEW_KEY): PolimerModelBuilder<any> {\n let builder = this;\n // store some metadata on the builder which we'll use later to tack onto the model\n let viewMappings: ViewMappings = builder._viewMappings || { };\n viewMappings[displayContext] = view;\n builder._viewMappings = viewMappings;\n return this;\n};\n\n// we need to replace the registerWithRouter in order to dynamically add the\n// @viewBinding decorator to it\nlet registerWithRouter = PolimerModelBuilder.prototype.registerWithRouter;\nPolimerModelBuilder.prototype.registerWithRouter = function (): PolimerModel<any> {\n let builder = this;\n let model = registerWithRouter.call(builder);\n let viewMappings: ViewMappings = builder._viewMappings;\n if (viewMappings) {\n Object.keys(viewMappings).forEach(displayContext => {\n viewBinding(viewMappings[displayContext], displayContext)(model.constructor);\n });\n }\n return model;\n};\n","import {useMemo} from 'react';\nimport {useSyncExternalStoreWithSelector} from 'use-sync-external-store/with-selector';\nimport {Guard, utils} from 'esp-js';\nimport {useRouter} from './espRouterContextProvider';\nimport {useGetModelId} from './espModelContextProvider';\nimport {tryGetPolimerImmutableModel} from './polimer/getEspPolimerImmutableModel';\n\nexport type SyncModelWithSelectorEqualityFn<T> = (last: T, next: T) => boolean;\n\n/**\n * Options affecting the subscription of the model to the Router.\n *\n * Use syncModelWithSelectorOptions() to create an instance of this type with sensible defaults.\n *\n * @param modelId - the modelId of the model to be observed via the esp Router.\n * @param tryPreSelectPolimerImmutableModel - if true, and the esp model is an esp-js-polimer model, the immutable model will be used when calling the selector.\n * @param equalityFn - Equality function which will be applied against TSelected, defaults to instance equality (a === b).\n */\nexport type SyncModelWithSelectorOptions<TSelected> = {\n modelId?: string,\n tryPreSelectPolimerImmutableModel: boolean,\n equalityFn: SyncModelWithSelectorEqualityFn<TSelected>\n};\n\n/**\n * Convenience API to build SyncModelWithSelectorOptions<TSelected>, has sensible defaulting.\n */\nexport interface SyncModelWithSelectorOptionsBuilder<TSelected> extends SyncModelWithSelectorOptions<TSelected> {\n /**\n * Sets the model ID\n * @param modelId - default if unset: undefined\n */\n setModelId(modelId: string): this;\n\n /**\n * If the model is a PolimerModel and this set true, PolimerModel.getImmutableModel() will be selected by default.\n * @param value - default if unset: true\n */\n setTryPreSelectPolimerImmutableModel(value: boolean): this;\n\n /**\n * Equality function used when comparing the last TSelected with the next.\n * @param fn - default if unset: obj instance equality (e.g. a===b)\n */\n setEqualityFn(fn: (a: TSelected, b: TSelected) => boolean): this;\n}\n\n/**\n * Convenience API to create SyncModelWithSelectorOptions\n */\nexport const syncModelWithSelectorOptions = <TSelected>() => {\n let modelId = undefined;\n let equalityFn: SyncModelWithSelectorEqualityFn<TSelected> = (a: TSelected, b: TSelected) => a === b;\n let tryPreSelectPolimerImmutableModel = true;\n return {\n get modelId() {\n return modelId;\n },\n setModelId(value: string) {\n modelId = value;\n return this;\n },\n get equalityFn() {\n return equalityFn;\n },\n setEqualityFn(value: SyncModelWithSelectorEqualityFn<TSelected>) {\n equalityFn = value;\n return this;\n },\n get tryPreSelectPolimerImmutableModel() {\n return tryPreSelectPolimerImmutableModel;\n },\n setTryPreSelectPolimerImmutableModel(value: boolean) {\n tryPreSelectPolimerImmutableModel = value;\n return this;\n }\n } as SyncModelWithSelectorOptionsBuilder<TSelected>;\n};\n\nconst checkArguments = (selector: (model: any) => any, options: SyncModelWithSelectorOptions<any> ) => {\n if (!utils.isFunction(selector)) {\n throw new Error('You must pass a selector function to useSyncModelWithSelector');\n }\n if (!utils.isObject(options)) {\n throw new Error('You must provide options when using useSyncModelWithSelector');\n }\n if (!utils.isFunction(options.equalityFn)) {\n throw new Error('You must provide an equalityFn when using useSyncModelWithSelector');\n }\n};\n\n/**\n * A hook which returns model state from the esp Router.\n *\n * This hooks wih observe updates and re-render the component if the model changes.\n *\n * To use this, please ensure your V-DOM has the EspRouterContextProvider at a higher node, and optionally EspModelContextProvider.\n *\n * @param selector - a function to select a selection of the model - the selector does not need to be memoized, this selector will be cached against the modelId.\n * @param options\n */\nexport const useSyncModelWithSelector = <TModel, TSelected>(\n selector: (model: TModel) => TSelected,\n options: SyncModelWithSelectorOptions<TSelected> = syncModelWithSelectorOptions<TSelected>()\n): TSelected => {\n checkArguments(selector, options);\n const router = useRouter();\n const modelId = options?.modelId || useGetModelId();\n const tryPreSelectPolimerImmutableModel = options?.tryPreSelectPolimerImmutableModel;\n const equalityFn = options?.equalityFn;\n const dependencies = useMemo(\n () => {\n // Because of how useSyncExternalStore works, there is an implicit dependency between the subscribe and getSnapshot functions.\n // When the subscription receives the new state from the Router, it can't pass this directly onto getSnapshot, React calls that when it deems it needs to.\n // Given that, we need to cache the state which getSnapshot will return.\n //\n // It's not ideal but shouldn't be a problem as here we've wrapped all these dependent functions inside a single useMemo()\n let model: TModel = null;\n return {\n subscribe: (stateChanged: () => void) => {\n const modelSubscriptionDisposable = router\n .getModelObservable(modelId)\n .subscribe(\n (m: any) => {\n // try and get a submodel to render\n const nextModel = tryPreSelectPolimerImmutableModel\n ? tryGetPolimerImmutableModel(m)\n : m;\n // if the above didn't manage to get a submodel,\n // we need to mutate to force useSyncExternalStoreWithSelector to pick up the change\n model = nextModel === m\n ? Object.create(nextModel)\n : nextModel;\n stateChanged();\n }\n );\n return () => {\n model = null;\n modelSubscriptionDisposable.dispose();\n };\n },\n // React expects getSnapshot to be immutable, it'll only re-render if the instance changes\n getSnapshot: () => {\n return model;\n },\n // While getSnapshot needs to model to be immutable,\n // useSyncExternalStoreWithSelector builds on top of this, so the TSelected can defer to an equality check to determine if the change is propagated.\n // The selector here just maps the TSelected, useSyncExternalStoreWithSelector internally does the equality check.\n wrappedSelector: (snapshot: TModel) => {\n // The first time this renders, react calls getSnapshot and the selector before the router has pushed a change.\n // In that case, there is no state for any component to process, therefore, we return null;\n return snapshot\n ? selector(snapshot)\n : null;\n }\n };\n },\n // Don't cache check against 'selector' argument as that will likely change unless the caller memoizes it.\n [router, modelId]\n );\n\n // If we don't have a modelId, we still need to return a hook so React doesn't complain.\n // Additionally, we need to let the above expiration (dependencies) run to unsubscribe from any previous subscription.\n if (utils.stringIsEmpty(modelId)) {\n return useSyncExternalStoreWithSelector(\n noopSubscription.subscribe,\n noopSubscription.getSnapshot,\n undefined,\n noopSubscription.wrappedSelector,\n equalityFn\n );\n }\n\n // Docs on useSyncExternalStore https://github.com/reactwg/react-18/discussions/86\n // Redux's usage of this: https://github.com/reduxjs/react-redux/blob/master/src/hooks/useSelector.ts\n // Code: https://github.com/facebook/react/blob/main/packages/use-sync-external-store/src/useSyncExternalStoreWithSelector.js\n return useSyncExternalStoreWithSelector(\n dependencies.subscribe,\n dependencies.getSnapshot,\n undefined,\n dependencies.wrappedSelector,\n equalityFn,\n );\n};\n\nconst noopSubscription = {\n subscribe: () => { },\n getSnapshot: () => null,\n wrappedSelector: () => true\n};","// notice_start\n/*\n * Copyright 2015 Dev Shop Limited\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// notice_end\n\nimport * as React from 'react';\nimport {createViewForModel} from './viewBindingDecorator';\nimport {useRouter} from './espRouterContextProvider';\n\nexport interface ViewBinderProps {\n model: any;\n viewContext?: string;\n /**\n * ...rest props, these will be passed to the child\n */\n [key: string]: any;\n}\n\n/**\n * Takes a model with a @viewBinding decorator and dynamically crates the view specified by the decorator\n */\nexport const ViewBinder: React.FC<ViewBinderProps> = ({model, viewContext, ...rest}) => {\n if (model) {\n const router = useRouter();\n const newProps = {\n model,\n router,\n ...rest\n };\n return createViewForModel(\n model,\n newProps,\n viewContext,\n null\n );\n }\n return null;\n};","// notice_start\n/*\n * Copyright 2015 Dev Shop Limited\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// notice_end\n\nimport * as React from 'react';\nimport {Guard} from 'esp-js';\n\nexport const DEFAULT_VIEW_KEY = 'default-view-key';\n\nfunction getMetadata(target) {\n if (!target._viewMetadata) {\n target._viewMetadata = new ViewMetadata();\n }\n return target._viewMetadata;\n}\n\n/**\n * Tries to get a view for the given model.\n *\n * It does this using the following order:\n * 1) If a @viewBinding decorator was used and a display context was given, try get a view for that\n * 2) Else if a view was explicitly provided use that\n * 3) Else if a @viewBinding decorator was used and there is a view associated with the default display context, use that view\n * @param model\n * @param props\n * @param displayContext\n * @param view\n */\nexport function createViewForModel(model: any, props: object, displayContext: string, view: React.ComponentType) {\n let finalView: React.ComponentType = view; // default to that passed in, if any.\n\n // displayContext = displayContext || DEFAULT_VIEW_KEY;\n // the view decorator isn't on the instance, it's on the constructor function that created that instance\n if (model) {\n let constructorFunction = model.constructor;\n if (constructorFunction._viewMetadata) {\n let viewMetadata = constructorFunction._viewMetadata;\n if (displayContext && viewMetadata.hasRegisteredViewContext(displayContext)) {\n let viewMetadataRegistration = viewMetadata.viewRegistrations[displayContext];\n // we've found a view for the display context, use that\n finalView = viewMetadataRegistration.view;\n }\n\n // if we've not found a view yet, and one wasn't provided, is there a default one?\n if (!finalView && viewMetadata.hasRegisteredViewContext(DEFAULT_VIEW_KEY)) {\n let viewMetadataRegistration = viewMetadata.viewRegistrations[DEFAULT_VIEW_KEY];\n finalView = viewMetadataRegistration.view;\n }\n }\n }\n if (!finalView) {\n throw new Error(`No suitable view found for model id '${model.modelId}' using context '${displayContext}'`);\n }\n return React.createElement(finalView, props);\n}\n\n/**\n * An ES7 style decorator that associates a model with a view\n * @param view the react component that will be used to display this model\n * @param displayContext an optional context allowing for different views to display the same model\n * @returns {Function}\n */\nexport function viewBinding(view: any, displayContext: string = DEFAULT_VIEW_KEY) {\n Guard.isDefined(view, 'view must be defined');\n Guard.isString(displayContext, 'displayContext must be a string');\n return function (target: any) {\n let viewMetadata = getMetadata(target);\n if (viewMetadata.hasRegisteredViewContext(displayContext)) {\n throw new Error(`Context ${displayContext} already registered for view`);\n }\n viewMetadata.viewRegistrations[displayContext] = new ViewMetadataRegistration(view, displayContext);\n };\n}\n\nexport class ViewMetadata {\n private _viewRegistrations = {};\n\n get viewRegistrations() {\n return this._viewRegistrations;\n }\n\n hasRegisteredViewContext(displayContext) {\n return typeof this._viewRegistrations[displayContext] !== 'undefined';\n }\n}\n\nexport class ViewMetadataRegistration {\n\n constructor(private _view, private _displayContext) {\n }\n\n get view() {\n return this._view;\n }\n\n get displayContext() {\n return this._displayContext;\n }\n}","module.exports = __WEBPACK_EXTERNAL_MODULE__152__;","module.exports = __WEBPACK_EXTERNAL_MODULE__43__;","module.exports = __WEBPACK_EXTERNAL_MODULE__155__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// notice_start\n/*\n * Copyright 2015 Dev Shop Limited\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// notice_end\n//\n\n// import for side effects\nimport './polimer/polimerModelBuilderExtentsions';\n\nexport {ViewBinder} from './viewBinder';\nexport {viewBinding, DEFAULT_VIEW_KEY} from './viewBindingDecorator';\nexport {\n GetEspPolimerImmutableModelMetadata,\n GetEspPolimerImmutableModelConsts,\n getEspPolimerImmutableModel\n} from './polimer/getEspPolimerImmutableModel';\nexport {createViewForModel} from './viewBindingDecorator';\nexport {\n connect,\n ConnectableComponentFactory\n} from './connect';\nexport {\n CreatePublishEventProps,\n MapModelToProps,\n ConnectableComponentProps,\n ConnectableComponentChildProps,\n ConnectableComponent,\n} from './connectableComponent';\nexport {\n useSyncModelWithSelector,\n SyncModelWithSelectorOptionsBuilder,\n syncModelWithSelectorOptions,\n SyncModelWithSelectorOptions,\n SyncModelWithSelectorEqualityFn,\n} from './useSyncModelWithSelector';\nexport {\n RouterProvider,\n RouterProviderProps,\n EspRouterContextProvider,\n EspRouterContextProviderProps,\n RouterContext,\n useRouter,\n PublishEventDelegate,\n PublishEventContext,\n usePublishEvent,\n} from './espRouterContextProvider';\nexport {\n useGetModelId,\n GetModelIdContext,\n useGetModel,\n GetModelContext,\n PublishModelEventDelegate,\n PublishModelEventContext,\n usePublishModelEvent,\n PublishModelEventWithEntityKeyDelegate,\n PublishModelEventWithEntityKeyContext,\n usePublishModelEventWithEntityKey,\n EspModelContextProvider,\n EspModelContextProviderProps,\n} from './espModelContextProvider';\n"],"names":[],"sourceRoot":""}