esp-js-react 7.0.2-next.0 → 8.0.0-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 (41) hide show
  1. package/.dist/esp-react.js +425 -510
  2. package/.dist/esp-react.js.map +1 -1
  3. package/.dist/esp-react.min.js +2 -1
  4. package/.dist/esp-react.min.js.LICENSE.txt +9 -0
  5. package/.dist/esp-react.min.js.map +1 -1
  6. package/.dist/typings/connect.d.ts +12 -0
  7. package/.dist/typings/connectableComponent.d.ts +20 -46
  8. package/.dist/typings/espModelContext.d.ts +7 -8
  9. package/.dist/typings/espRouterContext.d.ts +47 -0
  10. package/.dist/typings/index.d.ts +7 -6
  11. package/.dist/typings/{getEspReactRenderModel.d.ts → polimer/getEspReactRenderModel.d.ts} +7 -0
  12. package/.dist/typings/useModelSelector.d.ts +13 -0
  13. package/.dist/typings/viewBinder.d.ts +1 -8
  14. package/.dist/typings/viewBinderConnectable.d.ts +15 -0
  15. package/.dist/typings/viewBindingDecorator.d.ts +1 -2
  16. package/package.json +7 -6
  17. package/src/connect.tsx +31 -0
  18. package/src/connectableComponent.tsx +93 -190
  19. package/src/espModelContext.tsx +49 -23
  20. package/src/espRouterContext.tsx +88 -0
  21. package/src/index.ts +32 -16
  22. package/src/polimer/getEspReactRenderModel.ts +50 -0
  23. package/src/useModelSelector.ts +94 -0
  24. package/src/viewBinder.tsx +14 -22
  25. package/src/viewBinderConnectable.tsx +53 -0
  26. package/src/viewBindingDecorator.ts +2 -3
  27. package/tests/connectWithSelectorTests.tsx +67 -0
  28. package/tests/connectableComponentLegacyTests.tsx +405 -0
  29. package/tests/indexTests.ts +0 -12
  30. package/.dist/typings/routerProvider.d.ts +0 -18
  31. package/.dist/typings/shallowEqual.d.ts +0 -21
  32. package/.dist/typings/shouldUpdateMixin.d.ts +0 -10
  33. package/.dist/typings/smartComponent.d.ts +0 -33
  34. package/.dist/typings/utils.d.ts +0 -5
  35. package/src/getEspReactRenderModel.ts +0 -27
  36. package/src/routerProvider.tsx +0 -47
  37. package/src/shallowEqual.ts +0 -70
  38. package/src/shouldUpdateMixin.ts +0 -73
  39. package/src/smartComponent.tsx +0 -93
  40. package/src/utils.ts +0 -61
  41. package/tests/connectableComponentTests.tsx +0 -390
@@ -1 +1 @@
1
- {"version":3,"file":"esp-react.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;;;;;;;;;;;;;;;;ACVA,uCAA+B;AAC/B,2CAAwC;AACxC,0CAAmF;AACnF,wDAA2D;AAC3D,0DAAsG;AACtG,mDAAkD;AA2ClD,MAAa,oBAAgF,SAAQ,KAAK,CAAC,SAA4F;IAUnM,YAAY,KAAiF,EAAE,OAAoC;QAC/H,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAVlB,eAAU,GAAG,KAAK,CAAC;QAwFnB,kBAAa,GAAG,CAAC,MAAc,EAAE,OAAe,EAAE,EAAE,CAAC,CAAC,SAAiB,EAAE,KAAU,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QA7E3I,IAAI,CAAC,KAAK,GAAG,EAAC,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAC,CAAC;IACrD,CAAC;IAED,yBAAyB,CAAC,SAAqF,EAAE,WAAwC;QACrJ,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,IAAI,WAAW,CAAC,OAAO,CAAC;QACzD,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QAEtC,IAAI,OAAO,KAAK,UAAU,EAAE,CAAC;YACzB,OAAO;QACX,CAAC;QAED,IAAG,SAAS,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;YAClC,OAAO;QACX,CAAC;QAED,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;IAED,iBAAiB;QACb,IAAI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CAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;UEtBA;UACA;UACA;UACA","sources":["webpack://esp-js-react/webpack/universalModuleDefinition","webpack://esp-js-react/./src/connectableComponent.tsx","webpack://esp-js-react/./src/espModelContext.tsx","webpack://esp-js-react/./src/getEspReactRenderModel.ts","webpack://esp-js-react/./src/index.ts","webpack://esp-js-react/./src/polimer/polimerExtentsions.ts","webpack://esp-js-react/./src/routerProvider.tsx","webpack://esp-js-react/./src/shallowEqual.ts","webpack://esp-js-react/./src/shouldUpdateMixin.ts","webpack://esp-js-react/./src/smartComponent.tsx","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 \"prop-types\"","webpack://esp-js-react/external umd \"react\"","webpack://esp-js-react/webpack/bootstrap","webpack://esp-js-react/webpack/before-startup","webpack://esp-js-react/webpack/startup","webpack://esp-js-react/webpack/after-startup"],"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(\"prop-types\"), require(\"react\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"esp-js\", \"esp-js-polimer\", \"prop-types\", \"react\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"esp-js-react\"] = factory(require(\"esp-js\"), require(\"esp-js-polimer\"), require(\"prop-types\"), require(\"react\"));\n\telse\n\t\troot[\"esp-js-react\"] = factory(root[\"esp-js\"], root[\"esp-js-polimer\"], root[\"prop-types\"], root[\"react\"]);\n})(self, (__WEBPACK_EXTERNAL_MODULE__152__, __WEBPACK_EXTERNAL_MODULE__43__, __WEBPACK_EXTERNAL_MODULE__949__, __WEBPACK_EXTERNAL_MODULE__155__) => {\nreturn ","import * as React from 'react';\nimport * as PropTypes from 'prop-types';\nimport {Disposable, Router, EspDecoratorUtil, utils, DisposableBase} from 'esp-js';\nimport {createViewForModel } from './viewBindingDecorator';\nimport {GetEspReactRenderModelConsts, GetEspReactRenderModelMetadata} from './getEspReactRenderModel';\nimport {EspModelContext} from './espModelContext';\n\nexport type PublishEvent = (eventType: string, event: any) => void;\n\nexport type CreatePublishEventProps<TPublishEventProps> = (publishEvent: PublishEvent) => TPublishEventProps;\n\nexport type MapModelToProps<TModel, TModelMappedToProps, TPublishEventProps = {}> = (model: TModel, publishEventProps: TPublishEventProps) => TModelMappedToProps;\n\nexport type ViewComponentTypes = React.FunctionComponent | React.ClassType<any, any, any> | React.ComponentClass;\n\nexport interface ConnectableComponentProps<TModel ={}, TPublishEventProps = {}, TModelMappedToProps = {}> {\n modelId?: string;\n viewContext?: string;\n view?: ViewComponentTypes;\n /**\n * Provides a means to create a serious of 'publish event' callbacks which will be passed as props to the child view.\n */\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> {\n modelId: string;\n model: TModel;\n router: Router;\n [key: string]: any; // ...rest props, including the result of mapPublish and mapPublish if 'connect' was used\n}\n\nexport interface State {\n model?: any;\n currentModelId?: string;\n publishProps?: any;\n publishEvent?: PublishModelEventDelegate;\n}\n\ninterface ConnectableComponentContext {\n router: Router;\n modelId: string;\n}\n\nexport type PublishModelEventDelegate = (eventType: string, event: any) => void;\n\nexport class ConnectableComponent<TModel, TPublishEventProps = {}, TModelMappedToProps = {}> extends React.Component<ConnectableComponentProps<TModel, TPublishEventProps, TModelMappedToProps>, State> {\n private _isMounted = false;\n private _observationSubscription: Disposable;\n context: ConnectableComponentContext;\n\n static contextTypes = {\n router: PropTypes.instanceOf(Router).isRequired,\n modelId: PropTypes.string\n };\n\n constructor(props: ConnectableComponentProps<TModel, TPublishEventProps, TModelMappedToProps>, context: ConnectableComponentContext) {\n super(props, context);\n this.state = {model: null, currentModelId: null};\n }\n\n componentWillReceiveProps(nextProps: ConnectableComponentProps<TModel, TPublishEventProps, TModelMappedToProps>, nextContext: ConnectableComponentContext) {\n const modelId = nextProps.modelId || nextContext.modelId;\n const oldModelId = this._getModelId();\n\n if (modelId === oldModelId) {\n return;\n }\n \n if(nextProps.modelId === oldModelId) {\n return;\n }\n\n this._tryObserveModel(modelId);\n }\n\n componentDidMount() {\n this._isMounted = true;\n this._tryObserveModel(this._getModelId());\n }\n\n componentWillUnmount() {\n this._isMounted = false;\n this._tryDisposeModelSubscription();\n }\n\n private _getModelId(): string {\n // props override context\n return this.props.modelId || this.context.modelId;\n }\n\n private _tryObserveModel(modelId: string): void {\n this._tryDisposeModelSubscription();\n\n if (!modelId) {\n return;\n }\n\n let stateChanged = modelId !== this.state.currentModelId;\n\n let publishEvent = this.state.publishEvent;\n if (stateChanged) {\n publishEvent = this._publishEvent(this.context.router, modelId);\n }\n\n let publishProps = this.state.publishProps;\n // We only map the publish props once, as for well behaving components these callbacks should never change\n if (stateChanged && this.props.createPublishEventProps) {\n publishProps = this.props.createPublishEventProps(publishEvent);\n }\n\n if (stateChanged) {\n this.setState({\n currentModelId: modelId,\n publishEvent,\n publishProps\n });\n this._observationSubscription = this.context.router\n .getModelObservable(modelId)\n .subscribe(model => {\n if (this._isMounted) {\n this.setState({model});\n }\n });\n }\n }\n\n private _tryDisposeModelSubscription() {\n if(this._observationSubscription) {\n this._observationSubscription.dispose();\n this._observationSubscription = new DisposableBase();\n this.setState({model: null, currentModelId: null, publishProps: null, publishEvent: null});\n }\n }\n\n private _publishEvent = (router: Router, modelId: string) => (eventType: string, event: any) => router.publishEvent(modelId, eventType, event);\n\n public render() {\n if(this.state.model == null) {\n return null;\n }\n let childProps = this._getChildProps();\n let view = createViewForModel(this.state.model, childProps, this.props.viewContext, this.props.view);\n\n return (<EspModelContext modelId={this.props.modelId} router={this.context.router} {...childProps}>{view}</EspModelContext>);\n }\n\n private _getChildProps(): ConnectableComponentChildProps<TModel> {\n // consume what this component owns, and let the rest end up in `...rest`\n const {children, createPublishEventProps, modelId, mapModelToProps, view, viewContext, ...rest} = this.props;\n const model = this._getRenderModel(this.state.model);\n let childProps = {\n modelId,\n router: this.context.router,\n ...rest,\n ...this.state.publishProps,\n model\n };\n if (this.props.mapModelToProps) {\n childProps = {\n ...childProps,\n ...(this.props.mapModelToProps(model, this.state.publishProps) as any)\n };\n }\n return childProps;\n }\n\n /**\n * Sees if there is a special selector function which can be invoked to return a render model rather than the top level model model itself\n */\n private _getRenderModel(model: any): TModel {\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: GetEspReactRenderModelMetadata = EspDecoratorUtil.getCustomData(model, GetEspReactRenderModelConsts.CustomDataKey);\n if (metadata) {\n return model[metadata.functionName]();\n }\n }\n // else see if there is a function with name GetEspReactRenderModelConsts.HandlerFunctionName we can invoke to get a different model to render?\n let renderModelGetter = model[GetEspReactRenderModelConsts.HandlerFunctionName];\n if (renderModelGetter && utils.isFunction(renderModelGetter)) {\n return renderModelGetter.call(model);\n }\n // else just return the default model\n return model;\n }\n}\n\n// Lifting 'ConnectableView' into it's own type so it can be exported, else tsc doesn't correctly generated declaration files\nexport type ConnectableView = React.ComponentClass | React.SFC;\n\nexport const connect = function<TModel, TPublishEventProps, TModelMappedToProps = {}>(\n mapModelToProps?: MapModelToProps<TModel, TModelMappedToProps, TPublishEventProps>,\n createPublishEventProps?: CreatePublishEventProps<TPublishEventProps>\n): (view: ConnectableView) => (props: ConnectableComponentProps<TModel, TPublishEventProps, TModelMappedToProps>) => JSX.Element {\n return function(view: ConnectableView) {\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 {DefaultModelAddress, ModelAddress, Router} from 'esp-js';\nimport {useContext, useCallback, createContext, PropsWithChildren} from 'react';\nimport {RouterContext} from './routerProvider';\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 PublishEventDelegate = (modelIdOrModelAddress: string | ModelAddress, eventType: string, event: any) => void;\nexport const PublishEventContext = createContext<PublishEventDelegate>(null);\n/**\n * Returns a function which can be used to publish an event.\n */\nexport const usePublishEvent = () => useContext(PublishEventContext);\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 EspModelContextProps {\n modelId: string;\n router: Router;\n}\n\nexport const EspModelContext = ({modelId, children, router}: PropsWithChildren<EspModelContextProps>) => {\n const getModelId: () => string = useCallback(() => {\n return modelId;\n }, [router, modelId]);\n const publishEvent: PublishEventDelegate = useCallback((modelIdOrModelAddress: string, eventType: string, event: any) => {\n router.publishEvent(modelIdOrModelAddress, eventType, event);\n }, [router]);\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 <RouterContext.Provider value={router}>\n <GetModelIdContext.Provider value={getModelId}>\n <PublishEventContext.Provider value={publishEvent}>\n <PublishModelEventContext.Provider value={publishModelEvent}>\n <PublishModelEventWithEntityKeyContext.Provider value={publishModelEventWithEntityKey}>\n {children}\n </PublishModelEventWithEntityKeyContext.Provider>\n </PublishModelEventContext.Provider>\n </PublishEventContext.Provider>\n </GetModelIdContext.Provider>\n </RouterContext.Provider>\n );\n};","import {EspMetadata, EspDecoratorUtil} from 'esp-js';\n\nexport interface GetEspReactRenderModelMetadata {\n functionName: string;\n}\n\nexport namespace GetEspReactRenderModelConsts {\n export const CustomDataKey = 'GetEspReactRenderModelCustomDataKey';\n /**\n * If there is no @getEspReactRenderModel 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 = 'getEspReactRenderModel';\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 getEspReactRenderModel() {\n return function (target, name, descriptor) {\n let metadata: EspMetadata = EspDecoratorUtil.getOrCreateMetaData(target.constructor);\n metadata.addCustomData(\n GetEspReactRenderModelConsts.CustomDataKey,\n <GetEspReactRenderModelMetadata>{ functionName: name }\n );\n return descriptor;\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/polimerExtentsions';\n\nexport {RouterProvider, RouterContext, useRouter} from './routerProvider';\nexport {SmartComponent} from './smartComponent';\nexport {ViewBinder} from './viewBinder';\nexport {viewBinding, DEFAULT_VIEW_KEY} from './viewBindingDecorator';\nexport * from './getEspReactRenderModel';\nexport {shouldUpdateMixin} from './shouldUpdateMixin';\nexport {createViewForModel} from './viewBindingDecorator';\nexport {\n ConnectableComponent,\n connect,\n ConnectableComponentProps,\n MapModelToProps,\n CreatePublishEventProps,\n ConnectableView,\n ConnectableComponentChildProps,\n} from './connectableComponent';\nexport {\n useGetModelId,\n GetModelIdDelegate,\n GetModelIdContext,\n\n PublishEventDelegate,\n PublishEventContext,\n usePublishEvent,\n\n PublishModelEventDelegate,\n PublishModelEventContext,\n usePublishModelEvent,\n\n PublishModelEventWithEntityKeyDelegate,\n PublishModelEventWithEntityKeyContext,\n usePublishModelEventWithEntityKey,\n\n EspModelContext,\n EspModelContextProps\n} from './espModelContext';\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","// 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 * as PropTypes from 'prop-types';\nimport { Router } from 'esp-js';\nimport {useContext} from 'react';\n\nexport interface RouterProviderProps {\n router: Router;\n // React 18 Fix:\n // The current codebase is React 16, it will work with React 18, but there were changes to the types in React 18.\n // The `children` prop was removed from some React types that cause the RouterProvider to fail, this fixes that.\n children: any;\n}\n\nexport const RouterContext = React.createContext<Router>(null);\nexport const useRouter = () => useContext(RouterContext);\n\nexport class RouterProvider extends React.Component<RouterProviderProps, any> {\n static childContextTypes = {\n router: PropTypes.instanceOf(Router).isRequired\n };\n getChildContext() {\n return {\n router: this.props.router\n };\n }\n render() {\n return (<RouterContext.Provider value={this.props.router}>{this.props.children}</RouterContext.Provider>);\n }\n}","// taken from fbjs:\n// https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/core/shallowEqual.js\n// Licence (MIT) https://github.com/facebook/fbjs/blob/master/packages/fbjs/LICENSE\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\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 * @providesModule shallowEqual\n * @typechecks\n * @flow\n */\n\n/*eslint-disable no-self-compare */\n\n'use strict';\n\nconst hasOwnProperty = Object.prototype.hasOwnProperty;\n\n/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\nexport function is(x: any, y: any): boolean {\n // SameValue algorithm\n if (x === y) { // Steps 1-5, 7-10\n // Steps 6.b-6.e: +0 != -0\n // Added the nonzero y check to make Flow happy, but it is redundant\n return x !== 0 || y !== 0 || 1 / x === 1 / y;\n } else {\n // Step 6.a: NaN == NaN\n return x !== x && y !== y;\n }\n}\n\n/**\n * Performs equality by iterating through keys on an object and returning false\n * when any key has values which are not strictly equal between the arguments.\n * Returns true when the values of all keys are strictly equal.\n */\nexport function shallowEqual(objA, objB) {\n if (is(objA, objB)) {\n return true;\n }\n\n if (typeof objA !== 'object' || objA === null ||\n typeof objB !== 'object' || objB === null) {\n return false;\n }\n\n const keysA = Object.keys(objA);\n const keysB = Object.keys(objB);\n\n if (keysA.length !== keysB.length) {\n return false;\n }\n\n // Test for A's keys different from B.\n for (let i = 0; i < keysA.length; i++) {\n if (\n !hasOwnProperty.call(objB, keysA[i]) ||\n !is(objA[keysA[i]], objB[keysA[i]])\n ) {\n return false;\n }\n }\n\n return true;\n}","// notice_start\n/*\n * Copyright 2018 Keith Woods\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 {shallowEqual} from './shallowEqual';\n\n// WORKS (compiles at least):\n//\n// export function shouldUpdateMixin<TProps, TState, TPropBindings>(itemsThatEffectUpdateSelector: (nextProps: TProps) => TPropBindings) {\n// return function <T extends {new(...args:any[]):{}}>(constructor:T) {\n// return class extends constructor {\n// _propBindings : {};\n// shouldComponentUpdate(nextProps, nextState) {\n// let newBindings = itemsThatEffectUpdateSelector(nextProps);\n// let bindingsAreEqual = shallowEqual(this._propBindings, newBindings);\n// this._propBindings = newBindings;\n// return !bindingsAreEqual;\n// }\n// render() {\n// return React.createElement(<any>constructor, (<any>this).props);\n// }\n// };\n// };\n// }\n\nexport function shouldUpdateMixin<TProps, TState, TPropBindings>(itemsThatEffectUpdateSelector: (nextProps: TProps) => TPropBindings) {\n return function <TConstructor extends { new(...args: any[]): {} }>(Constructor: TConstructor) {\n return class extends Constructor {\n _propBindings: {};\n shouldComponentUpdate(nextProps, nextState) {\n let newBindings = itemsThatEffectUpdateSelector(nextProps);\n let bindingsAreEqual = shallowEqual(this._propBindings, newBindings);\n this._propBindings = newBindings;\n return !bindingsAreEqual;\n }\n render() {\n return React.createElement(<any>Constructor, (<any>this).props);\n }\n };\n };\n}\n\n// export function shouldUpdateMixin<TProps, TState, TPropBindings>(itemsThatEffectUpdateSelector: (nextProps: TProps) => TPropBindings) {\n// return function(Comp: React.ComponentClass<TProps, TState>) {\n// return class extends React.Component<TProps, TState> {\n// _propBindings : {};\n// shouldComponentUpdate(nextProps, nextState) {\n// let newBindings = itemsThatEffectUpdateSelector(nextProps);\n// let bindingsAreEqual = shallowEqual(this._propBindings, newBindings);\n// this._propBindings = newBindings;\n// return !bindingsAreEqual;\n// }\n// render() {\n// return React.createElement(Comp, this.props);\n// }\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 * as PropTypes from 'prop-types';\nimport { createViewForModel } from './viewBindingDecorator';\nimport { Router } from 'esp-js';\n\nexport interface SmartComponentProps {\n modelId: string;\n view?: any;\n viewContext?: string;\n modelSelector?: (model: any) => any;\n [key: string]: any; // other props which will be passed through to the SmartComponent's view\n}\n\nexport interface SmartComponentState {\n model: any;\n}\n\nexport class SmartComponent extends React.Component<SmartComponentProps, SmartComponentState> {\n private _currentObservingModelId = false;\n private _observationSubscription = null;\n\n static contextTypes = {\n router: PropTypes.instanceOf(Router).isRequired\n };\n\n componentWillReceiveProps(nextProps: SmartComponentProps) {\n this._tryObserveModel(nextProps.modelId);\n }\n componentWillMount() {\n this._tryObserveModel(this.props.modelId);\n }\n componentWillUnmount() {\n this._tryDisposeObservationSubscription();\n }\n _tryObserveModel(modelId) {\n if(!modelId) {\n this._tryDisposeObservationSubscription();\n this.setState({model: null});\n } else if (modelId !== this._currentObservingModelId) {\n this._tryDisposeObservationSubscription();\n this._currentObservingModelId = modelId;\n this._observationSubscription = this.context.router\n .getModelObservable(modelId)\n .map(model => {\n return this.props.modelSelector\n ? this.props.modelSelector(model)\n : model;\n })\n .subscribe(model => {\n this.setState({model: model});\n });\n }\n }\n _tryDisposeObservationSubscription() {\n this._currentObservingModelId = null;\n if(this._observationSubscription) {\n this._observationSubscription.dispose();\n }\n }\n render() {\n if(this.state.model) {\n return createViewForModel(this.state.model, this._getChildProps(), this.props.viewContext, this.props.view);\n }\n return null; // this (in react 15) will render a 'comment node' rather than any actual html\n }\n _getChildProps() {\n // 'consume' the props we own, pass the rest down\n let {modelId, viewContext, view, modelSelector, ...other} = this.props;\n let newProps = {\n model: this.state.model,\n router: this.context.router\n };\n return Object.assign({}, newProps, other);\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 esp from 'esp-js';\nimport * as React from 'react';\nimport * as PropTypes from 'prop-types';\nimport { createViewForModel } from './viewBindingDecorator';\n\nexport interface ViewBinderProps {\n model: any;\n viewContext: string;\n}\n\nexport class ViewBinder extends React.Component<ViewBinderProps> {\n\n static contextTypes = {\n router: PropTypes.instanceOf(esp.Router).isRequired\n };\n\n render() {\n if(this.props.model) {\n let {model, viewContext, ...other} = this.props;\n let newProps = Object.assign({}, { model: this.props.model, router:this.context.router }, other);\n return createViewForModel(\n this.props.model,\n newProps,\n this.props.viewContext,\n null\n );\n }\n return null;\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';\nimport {ViewComponentTypes} from './connectableComponent';\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: ViewComponentTypes) {\n let finalView: ViewComponentTypes = 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__949__;","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","","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(872);\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;AAOjI;;;;GAIG;AACI,MAAM,OAAO,GAAG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AGmB;AAFf,0GAAO;AAGX,sDAMgC;AAD5B,iJAAoB;AAExB,kDAI4B;AAHxB,qIAAgB;AAEhB,qJAAwB;AAE5B,iDAU4B;AATxB,iIAAc;AAEd,qIAAgB;AAEhB,+HAAa;AACb,uHAAS;AAET,2IAAmB;AACnB,mIAAe;AAEnB,iDAY2B;AAXvB,8HAAa;AAEb,sIAAiB;AAEjB,oJAAwB;AACxB,4IAAoB;AAEpB,8KAAqC;AACrC,sKAAiC;AACjC,kIAAe","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/espModelContext.tsx","webpack://esp-js-react/./src/espRouterContext.tsx","webpack://esp-js-react/./src/polimer/getEspReactRenderModel.ts","webpack://esp-js-react/./src/polimer/polimerExtentsions.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 './espRouterContext';\nimport {useMemo} from 'react';\nimport {Router, utils} from 'esp-js';\nimport {EspModelContext, useGetModelId} from './espModelContext';\nimport {createViewForModel} from './viewBindingDecorator';\nimport {tryGetRenderModel} from './polimer/getEspReactRenderModel';\nimport {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 = tryGetRenderModel<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 modelId,\n 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 <EspModelContext modelId={modelId} model={model} router={router} {...childProps}>\n {viewElement}\n </EspModelContext>\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 './espRouterContext';\n\nconst _log = Logger.create('EspModelContext');\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 EspModelContextProps {\n modelId: string;\n model?: unknown;\n}\n\nexport const EspModelContext = ({modelId, children, model}: PropsWithChildren<EspModelContextProps>) => {\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 `EspModelContext 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 * <EspRouterContext router={router}>\n * <YourComponents />\n * </EspRouterContext>\n */\nexport const usePublishEvent = () => useContext(PublishEventContext);\n\nexport type EspRouterContextProps = 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 EspRouterContext = ({children, router}: EspRouterContextProps) => {\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 EspRouterContext\n */\nexport const RouterProvider = EspRouterContext;\n\n/**\n * Props for RouterProvider\n *\n * @deprecated use EspRouterContextProps\n */\nexport type RouterProviderProps = EspRouterContextProps;\n","import {EspMetadata, EspDecoratorUtil, utils} from 'esp-js';\n\nexport interface GetEspReactRenderModelMetadata {\n functionName: string;\n}\n\nexport namespace GetEspReactRenderModelConsts {\n export const CustomDataKey = 'GetEspReactRenderModelCustomDataKey';\n /**\n * If there is no @getEspReactRenderModel 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 = 'getEspReactRenderModel';\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 getEspReactRenderModel() {\n return function (target, name, descriptor) {\n let metadata: EspMetadata = EspDecoratorUtil.getOrCreateMetaData(target.constructor);\n metadata.addCustomData(\n GetEspReactRenderModelConsts.CustomDataKey,\n <GetEspReactRenderModelMetadata>{ 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 sub graph to use as state.\n *\n */\nexport const tryGetRenderModel = <TRenderModel>(model: any): TRenderModel => {\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: GetEspReactRenderModelMetadata = EspDecoratorUtil.getCustomData(model, GetEspReactRenderModelConsts.CustomDataKey);\n if (metadata) {\n return model[metadata.functionName]();\n }\n }\n // else see if there is a function with name GetEspReactRenderModelConsts.HandlerFunctionName we can invoke to get a different model to render?\n let renderModelGetter = model[GetEspReactRenderModelConsts.HandlerFunctionName];\n if (renderModelGetter && utils.isFunction(renderModelGetter)) {\n return renderModelGetter.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} from 'esp-js';\nimport {useRouter} from './espRouterContext';\nimport {useGetModelId} from './espModelContext';\nimport {tryGetRenderModel} from './polimer/getEspReactRenderModel';\n\nexport const defaultConnectEqualityFn = <TSelected>(a: TSelected, b: TSelected) => a === b; // reference equality\n\nexport type ConnectEqualityFn<T> = (last: T, next: T) => boolean;\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 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 const useModelSelector = <TModel = unknown, TSelected = unknown>(\n selector: (model: TModel) => TSelected,\n modelId?: string,\n tryPreSelectPolimerImmutableModel: boolean = true,\n equalityFn: ConnectEqualityFn<TSelected> = defaultConnectEqualityFn\n) => {\n Guard.isFunction(selector, 'You must pass a selector function to connectSelector');\n const router = useRouter();\n modelId = modelId || useGetModelId();\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 ? tryGetRenderModel(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\n // TODO confirm this comment with a test:\n\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 // 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};","// 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 './espRouterContext';\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 './espRouterContext';\nimport {EspModelContext} from './espModelContext';\nimport {Logger, Router} from 'esp-js';\nimport * as React from 'react';\nimport {useModelSelector} from './useModelSelector';\nimport {createViewForModel} from './viewBindingDecorator';\nimport {tryGetRenderModel} from './polimer/getEspReactRenderModel';\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 modelId,\n false\n );\n if (!model) {\n return null;\n }\n let renderModel = tryGetRenderModel<object>(model);\n const childProps: ViewBinderConnectableChildProps = {\n modelId,\n router: router,\n model: renderModel\n };\n let viewElement = createViewForModel(model, childProps, viewContext, view);\n return (\n <EspModelContext modelId={modelId} router={router} model={renderModel} {...childProps}>\n {viewElement}\n </EspModelContext>\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/polimerExtentsions';\n\nexport {ViewBinder} from './viewBinder';\nexport {\n ViewBinderConnectableProps,\n ViewBinderConnectable\n} from './viewBinderConnectable';\nexport {viewBinding, DEFAULT_VIEW_KEY} from './viewBindingDecorator';\nexport {\n GetEspReactRenderModelMetadata,\n GetEspReactRenderModelConsts,\n getEspReactRenderModel\n} from './polimer/getEspReactRenderModel';\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 ConnectEqualityFn,\n defaultConnectEqualityFn\n} from './useModelSelector';\nexport {\n RouterProvider,\n RouterProviderProps,\n EspRouterContext,\n EspRouterContextProps,\n RouterContext,\n useRouter,\n PublishEventDelegate,\n PublishEventContext,\n usePublishEvent,\n} from './espRouterContext';\nexport {\n useGetModelId,\n GetModelIdDelegate,\n GetModelIdContext,\n PublishModelEventDelegate,\n PublishModelEventContext,\n usePublishModelEvent,\n PublishModelEventWithEntityKeyDelegate,\n PublishModelEventWithEntityKeyContext,\n usePublishModelEventWithEntityKey,\n EspModelContext,\n EspModelContextProps,\n} from './espModelContext';\n"],"names":[],"sourceRoot":""}
@@ -1,2 +1,3 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("esp-js"),require("esp-js-polimer"),require("prop-types"),require("react")):"function"==typeof define&&define.amd?define(["esp-js","esp-js-polimer","prop-types","react"],t):"object"==typeof exports?exports["esp-js-react"]=t(require("esp-js"),require("esp-js-polimer"),require("prop-types"),require("react")):e["esp-js-react"]=t(e["esp-js"],e["esp-js-polimer"],e["prop-types"],e.react)}(self,((e,t,o,r)=>(()=>{"use strict";var n={397:function(e,t,o){var r=this&&this.__rest||function(e,t){var o={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(o[r[n]]=e[r[n]])}return o};Object.defineProperty(t,"__esModule",{value:!0}),t.connect=t.ConnectableComponent=void 0;const n=o(155),i=o(949),s=o(152),l=o(213),u=o(102),d=o(680);class a extends n.Component{constructor(e,t){super(e,t),this._isMounted=!1,this._publishEvent=(e,t)=>(o,r)=>e.publishEvent(t,o,r),this.state={model:null,currentModelId:null}}componentWillReceiveProps(e,t){const o=e.modelId||t.modelId,r=this._getModelId();o!==r&&e.modelId!==r&&this._tryObserveModel(o)}componentDidMount(){this._isMounted=!0,this._tryObserveModel(this._getModelId())}componentWillUnmount(){this._isMounted=!1,this._tryDisposeModelSubscription()}_getModelId(){return this.props.modelId||this.context.modelId}_tryObserveModel(e){if(this._tryDisposeModelSubscription(),!e)return;let t=e!==this.state.currentModelId,o=this.state.publishEvent;t&&(o=this._publishEvent(this.context.router,e));let r=this.state.publishProps;t&&this.props.createPublishEventProps&&(r=this.props.createPublishEventProps(o)),t&&(this.setState({currentModelId:e,publishEvent:o,publishProps:r}),this._observationSubscription=this.context.router.getModelObservable(e).subscribe((e=>{this._isMounted&&this.setState({model:e})})))}_tryDisposeModelSubscription(){this._observationSubscription&&(this._observationSubscription.dispose(),this._observationSubscription=new s.DisposableBase,this.setState({model:null,currentModelId:null,publishProps:null,publishEvent:null}))}render(){if(null==this.state.model)return null;let e=this._getChildProps(),t=(0,l.createViewForModel)(this.state.model,e,this.props.viewContext,this.props.view);return n.createElement(d.EspModelContext,Object.assign({modelId:this.props.modelId,router:this.context.router},e),t)}_getChildProps(){const e=this.props,{children:t,createPublishEventProps:o,modelId:n,mapModelToProps:i,view:s,viewContext:l}=e,u=r(e,["children","createPublishEventProps","modelId","mapModelToProps","view","viewContext"]),d=this._getRenderModel(this.state.model);let a=Object.assign(Object.assign(Object.assign({modelId:n,router:this.context.router},u),this.state.publishProps),{model:d});return this.props.mapModelToProps&&(a=Object.assign(Object.assign({},a),this.props.mapModelToProps(d,this.state.publishProps))),a}_getRenderModel(e){if(s.EspDecoratorUtil.hasMetadata(e)){let t=s.EspDecoratorUtil.getCustomData(e,u.GetEspReactRenderModelConsts.CustomDataKey);if(t)return e[t.functionName]()}let t=e[u.GetEspReactRenderModelConsts.HandlerFunctionName];return t&&s.utils.isFunction(t)?t.call(e):e}}t.ConnectableComponent=a,a.contextTypes={router:i.instanceOf(s.Router).isRequired,modelId:i.string};t.connect=function(e,t){return function(o){return function(i){const{modelId:s,viewContext:l}=i,u=r(i,["modelId","viewContext"]);return n.createElement(a,Object.assign({modelId:s,view:o,viewContext:l,createPublishEventProps:t,mapModelToProps:e},u))}}}},680:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EspModelContext=t.usePublishModelEventWithEntityKey=t.PublishModelEventWithEntityKeyContext=t.usePublishModelEvent=t.PublishModelEventContext=t.usePublishEvent=t.PublishEventContext=t.useGetModelId=t.GetModelIdContext=void 0;const r=o(155),n=o(152),i=o(155),s=o(182);t.GetModelIdContext=(0,i.createContext)(null);t.useGetModelId=()=>(0,i.useContext)(t.GetModelIdContext),t.PublishEventContext=(0,i.createContext)(null);t.usePublishEvent=()=>(0,i.useContext)(t.PublishEventContext),t.PublishModelEventContext=(0,i.createContext)(null);t.usePublishModelEvent=()=>(0,i.useContext)(t.PublishModelEventContext),t.PublishModelEventWithEntityKeyContext=(0,i.createContext)(null);t.usePublishModelEventWithEntityKey=()=>(0,i.useContext)(t.PublishModelEventWithEntityKeyContext);t.EspModelContext=({modelId:e,children:o,router:l})=>{const u=(0,i.useCallback)((()=>e),[l,e]),d=(0,i.useCallback)(((e,t,o)=>{l.publishEvent(e,t,o)}),[l]),a=(0,i.useCallback)(((t,o)=>{l.publishEvent(e,t,o)}),[l,e]),p=(0,i.useCallback)(((t,o,r)=>{l.publishEvent(new n.DefaultModelAddress(e,t),o,r)}),[l,e]);return r.createElement(s.RouterContext.Provider,{value:l},r.createElement(t.GetModelIdContext.Provider,{value:u},r.createElement(t.PublishEventContext.Provider,{value:d},r.createElement(t.PublishModelEventContext.Provider,{value:a},r.createElement(t.PublishModelEventWithEntityKeyContext.Provider,{value:p},o)))))}},102:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GetEspReactRenderModelConsts=void 0,t.getEspReactRenderModel=function(){return function(e,t,o){return r.EspDecoratorUtil.getOrCreateMetaData(e.constructor).addCustomData(n.CustomDataKey,{functionName:t}),o}};const r=o(152);var n;!function(e){e.CustomDataKey="GetEspReactRenderModelCustomDataKey",e.HandlerFunctionName="getEspReactRenderModel"}(n||(t.GetEspReactRenderModelConsts=n={}))},872:function(e,t,o){var r=this&&this.__createBinding||(Object.create?function(e,t,o,r){void 0===r&&(r=o);var n=Object.getOwnPropertyDescriptor(t,o);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[o]}}),Object.defineProperty(e,r,n)}:function(e,t,o,r){void 0===r&&(r=o),e[r]=t[o]}),n=this&&this.__exportStar||function(e,t){for(var o in e)"default"===o||Object.prototype.hasOwnProperty.call(t,o)||r(t,e,o)};Object.defineProperty(t,"__esModule",{value:!0}),t.EspModelContext=t.usePublishModelEventWithEntityKey=t.PublishModelEventWithEntityKeyContext=t.usePublishModelEvent=t.PublishModelEventContext=t.usePublishEvent=t.PublishEventContext=t.GetModelIdContext=t.useGetModelId=t.connect=t.ConnectableComponent=t.createViewForModel=t.shouldUpdateMixin=t.DEFAULT_VIEW_KEY=t.viewBinding=t.ViewBinder=t.SmartComponent=t.useRouter=t.RouterContext=t.RouterProvider=void 0,o(637);var i=o(182);Object.defineProperty(t,"RouterProvider",{enumerable:!0,get:function(){return i.RouterProvider}}),Object.defineProperty(t,"RouterContext",{enumerable:!0,get:function(){return i.RouterContext}}),Object.defineProperty(t,"useRouter",{enumerable:!0,get:function(){return i.useRouter}});var s=o(438);Object.defineProperty(t,"SmartComponent",{enumerable:!0,get:function(){return s.SmartComponent}});var l=o(453);Object.defineProperty(t,"ViewBinder",{enumerable:!0,get:function(){return l.ViewBinder}});var u=o(213);Object.defineProperty(t,"viewBinding",{enumerable:!0,get:function(){return u.viewBinding}}),Object.defineProperty(t,"DEFAULT_VIEW_KEY",{enumerable:!0,get:function(){return u.DEFAULT_VIEW_KEY}}),n(o(102),t);var d=o(79);Object.defineProperty(t,"shouldUpdateMixin",{enumerable:!0,get:function(){return d.shouldUpdateMixin}});var a=o(213);Object.defineProperty(t,"createViewForModel",{enumerable:!0,get:function(){return a.createViewForModel}});var p=o(397);Object.defineProperty(t,"ConnectableComponent",{enumerable:!0,get:function(){return p.ConnectableComponent}}),Object.defineProperty(t,"connect",{enumerable:!0,get:function(){return p.connect}});var c=o(680);Object.defineProperty(t,"useGetModelId",{enumerable:!0,get:function(){return c.useGetModelId}}),Object.defineProperty(t,"GetModelIdContext",{enumerable:!0,get:function(){return c.GetModelIdContext}}),Object.defineProperty(t,"PublishEventContext",{enumerable:!0,get:function(){return c.PublishEventContext}}),Object.defineProperty(t,"usePublishEvent",{enumerable:!0,get:function(){return c.usePublishEvent}}),Object.defineProperty(t,"PublishModelEventContext",{enumerable:!0,get:function(){return c.PublishModelEventContext}}),Object.defineProperty(t,"usePublishModelEvent",{enumerable:!0,get:function(){return c.usePublishModelEvent}}),Object.defineProperty(t,"PublishModelEventWithEntityKeyContext",{enumerable:!0,get:function(){return c.PublishModelEventWithEntityKeyContext}}),Object.defineProperty(t,"usePublishModelEventWithEntityKey",{enumerable:!0,get:function(){return c.usePublishModelEventWithEntityKey}}),Object.defineProperty(t,"EspModelContext",{enumerable:!0,get:function(){return c.EspModelContext}})},637:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0});const r=o(43),n=o(213);r.PolimerModelBuilder.prototype.withViewBindings=function(e,t=n.DEFAULT_VIEW_KEY){let o=this._viewMappings||{};return o[t]=e,this._viewMappings=o,this};let i=r.PolimerModelBuilder.prototype.registerWithRouter;r.PolimerModelBuilder.prototype.registerWithRouter=function(){let e=i.call(this),t=this._viewMappings;return t&&Object.keys(t).forEach((o=>{(0,n.viewBinding)(t[o],o)(e.constructor)})),e}},182:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RouterProvider=t.useRouter=t.RouterContext=void 0;const r=o(155),n=o(949),i=o(152),s=o(155);t.RouterContext=r.createContext(null);t.useRouter=()=>(0,s.useContext)(t.RouterContext);class l extends r.Component{getChildContext(){return{router:this.props.router}}render(){return r.createElement(t.RouterContext.Provider,{value:this.props.router},this.props.children)}}t.RouterProvider=l,l.childContextTypes={router:n.instanceOf(i.Router).isRequired}},234:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.is=r,t.shallowEqual=function(e,t){if(r(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(let i=0;i<n.length;i++)if(!o.call(t,n[i])||!r(e[n[i]],t[n[i]]))return!1;return!0};const o=Object.prototype.hasOwnProperty;function r(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}},79:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.shouldUpdateMixin=function(e){return function(t){return class extends t{shouldComponentUpdate(t,o){let r=e(t),i=(0,n.shallowEqual)(this._propBindings,r);return this._propBindings=r,!i}render(){return r.createElement(t,this.props)}}}};const r=o(155),n=o(234)},438:function(e,t,o){var r=this&&this.__rest||function(e,t){var o={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(o[r[n]]=e[r[n]])}return o};Object.defineProperty(t,"__esModule",{value:!0}),t.SmartComponent=void 0;const n=o(155),i=o(949),s=o(213),l=o(152);class u extends n.Component{constructor(){super(...arguments),this._currentObservingModelId=!1,this._observationSubscription=null}componentWillReceiveProps(e){this._tryObserveModel(e.modelId)}componentWillMount(){this._tryObserveModel(this.props.modelId)}componentWillUnmount(){this._tryDisposeObservationSubscription()}_tryObserveModel(e){e?e!==this._currentObservingModelId&&(this._tryDisposeObservationSubscription(),this._currentObservingModelId=e,this._observationSubscription=this.context.router.getModelObservable(e).map((e=>this.props.modelSelector?this.props.modelSelector(e):e)).subscribe((e=>{this.setState({model:e})}))):(this._tryDisposeObservationSubscription(),this.setState({model:null}))}_tryDisposeObservationSubscription(){this._currentObservingModelId=null,this._observationSubscription&&this._observationSubscription.dispose()}render(){return this.state.model?(0,s.createViewForModel)(this.state.model,this._getChildProps(),this.props.viewContext,this.props.view):null}_getChildProps(){let e=this.props,{modelId:t,viewContext:o,view:n,modelSelector:i}=e,s=r(e,["modelId","viewContext","view","modelSelector"]),l={model:this.state.model,router:this.context.router};return Object.assign({},l,s)}}t.SmartComponent=u,u.contextTypes={router:i.instanceOf(l.Router).isRequired}},453:function(e,t,o){var r=this&&this.__rest||function(e,t){var o={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(o[r[n]]=e[r[n]])}return o};Object.defineProperty(t,"__esModule",{value:!0}),t.ViewBinder=void 0;const n=o(152),i=o(155),s=o(949),l=o(213);class u extends i.Component{render(){if(this.props.model){let e=this.props,{model:t,viewContext:o}=e,n=r(e,["model","viewContext"]),i=Object.assign({},{model:this.props.model,router:this.context.router},n);return(0,l.createViewForModel)(this.props.model,i,this.props.viewContext,null)}return null}}t.ViewBinder=u,u.contextTypes={router:s.instanceOf(n.Router).isRequired}},213:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ViewMetadataRegistration=t.ViewMetadata=t.DEFAULT_VIEW_KEY=void 0,t.createViewForModel=function(e,o,n,i){let s=i;if(e){let o=e.constructor;if(o._viewMetadata){let e=o._viewMetadata;if(n&&e.hasRegisteredViewContext(n)){s=e.viewRegistrations[n].view}if(!s&&e.hasRegisteredViewContext(t.DEFAULT_VIEW_KEY)){s=e.viewRegistrations[t.DEFAULT_VIEW_KEY].view}}}if(!s)throw new Error(`No suitable view found for model id '${e.modelId}' using context '${n}'`);return r.createElement(s,o)},t.viewBinding=function(e,o=t.DEFAULT_VIEW_KEY){return n.Guard.isDefined(e,"view must be defined"),n.Guard.isString(o,"displayContext must be a string"),function(t){let r=function(e){e._viewMetadata||(e._viewMetadata=new i);return e._viewMetadata}(t);if(r.hasRegisteredViewContext(o))throw new Error(`Context ${o} already registered for view`);r.viewRegistrations[o]=new s(e,o)}};const r=o(155),n=o(152);t.DEFAULT_VIEW_KEY="default-view-key";class i{constructor(){this._viewRegistrations={}}get viewRegistrations(){return this._viewRegistrations}hasRegisteredViewContext(e){return void 0!==this._viewRegistrations[e]}}t.ViewMetadata=i;class s{constructor(e,t){this._view=e,this._displayContext=t}get view(){return this._view}get displayContext(){return this._displayContext}}t.ViewMetadataRegistration=s},152:t=>{t.exports=e},43:e=>{e.exports=t},949:e=>{e.exports=o},155:e=>{e.exports=r}},i={};var s=function e(t){var o=i[t];if(void 0!==o)return o.exports;var r=i[t]={exports:{}};return n[t].call(r.exports,r,r.exports,e),r.exports}(872);return s})()));
1
+ /*! For license information please see esp-react.min.js.LICENSE.txt */
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("esp-js"),require("esp-js-polimer"),require("react")):"function"==typeof define&&define.amd?define(["esp-js","esp-js-polimer","react"],t):"object"==typeof exports?exports["esp-js-react"]=t(require("esp-js"),require("esp-js-polimer"),require("react")):e["esp-js-react"]=t(e["esp-js"],e["esp-js-polimer"],e.react)}(self,((e,t,n)=>(()=>{"use strict";var r={774:(e,t,n)=>{var r=n(155);var o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=r.useSyncExternalStore,u=r.useRef,l=r.useEffect,s=r.useMemo,d=r.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,r,a){var c=u(null);if(null===c.current){var v={hasValue:!1,value:null};c.current=v}else v=c.current;c=s((function(){function e(e){if(!l){if(l=!0,i=e,e=r(e),void 0!==a&&v.hasValue){var t=v.value;if(a(t,e))return u=t}return u=e}if(t=u,o(i,e))return t;var n=r(e);return void 0!==a&&a(t,n)?t:(i=e,u=n)}var i,u,l=!1,s=void 0===n?null:n;return[function(){return e(t())},null===s?void 0:function(){return e(s())}]}),[t,n,r,a]);var b=i(e,c[0],c[1]);return l((function(){v.hasValue=!0,v.value=b}),[b]),d(b),b}},614:(e,t,n)=>{e.exports=n(774)},746:function(e,t,n){var r=this&&this.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n};Object.defineProperty(t,"__esModule",{value:!0}),t.connect=void 0;const o=n(155),i=n(397);t.connect=function(e,t){return function(n){return function(u){const{modelId:l,viewContext:s}=u,d=r(u,["modelId","viewContext"]);return o.createElement(i.ConnectableComponent,Object.assign({modelId:l,view:n,viewContext:s,createPublishEventProps:t,mapModelToProps:e},d))}}}},397:function(e,t,n){var r=this&&this.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n};Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectableComponent=void 0;const o=n(155),i=n(46),u=n(155),l=n(152),s=n(680),d=n(213),a=n(621),c=n(743);t.ConnectableComponent=e=>{var{modelId:t,mapModelToProps:n,createPublishEventProps:v,view:b,viewContext:p}=e,f=r(e,["modelId","mapModelToProps","createPublishEventProps","view","viewContext"]);const E=(0,i.useRouter)();if(t=t||(0,s.useGetModelId)(),l.utils.stringIsEmpty(t)||!E)return null;const C=(0,u.useMemo)((()=>{if(v){return v(((e,n)=>{E.publishEvent(t,e,n)}))}return{}}),[E,t]),y=(0,c.useModelSelector)((e=>e),t,!1);if(null==y)return null;let M=((e,t,n,r,o,i)=>{const u=(0,a.tryGetRenderModel)(r);let l=Object.assign(Object.assign(Object.assign({modelId:t,router:e},n),i),{model:u});return o&&(l=Object.assign(Object.assign({},l),o(u,i))),l})(E,t,f,y,n,C),x=(0,d.createViewForModel)(y,M,p,b);return o.createElement(s.EspModelContext,Object.assign({modelId:t,model:y,router:E},M),x)}},680:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EspModelContext=t.usePublishModelEventWithEntityKey=t.PublishModelEventWithEntityKeyContext=t.usePublishModelEvent=t.PublishModelEventContext=t.useGetModel=t.GetModelContext=t.useGetModelId=t.GetModelIdContext=void 0;const r=n(155),o=n(152),i=n(155),u=n(46);o.Logger.create("EspModelContext");t.GetModelIdContext=(0,i.createContext)(null);t.useGetModelId=()=>(0,i.useContext)(t.GetModelIdContext)(),t.GetModelContext=(0,i.createContext)(null);t.useGetModel=()=>(0,i.useContext)(t.GetModelContext)(),t.PublishModelEventContext=(0,i.createContext)(null);t.usePublishModelEvent=()=>(0,i.useContext)(t.PublishModelEventContext),t.PublishModelEventWithEntityKeyContext=(0,i.createContext)(null);t.usePublishModelEventWithEntityKey=()=>(0,i.useContext)(t.PublishModelEventWithEntityKeyContext);t.EspModelContext=({modelId:e,children:n,model:s})=>{const d=(0,u.useRouter)(),a=(0,i.useCallback)((()=>e),[d,e]),c=(0,i.useCallback)((()=>(l(d,e),s)),[s,d,e]),v=(0,i.useCallback)(((t,n)=>{d.publishEvent(e,t,n)}),[d,e]),b=(0,i.useCallback)(((t,n,r)=>{d.publishEvent(new o.DefaultModelAddress(e,t),n,r)}),[d,e]);return r.createElement(t.GetModelIdContext.Provider,{value:a},r.createElement(t.PublishModelEventContext.Provider,{value:v},r.createElement(t.PublishModelEventWithEntityKeyContext.Provider,{value:b},r.createElement(t.GetModelContext.Provider,{value:c},n))))};const l=(e,t)=>{}},46:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RouterProvider=t.EspRouterContext=t.usePublishEvent=t.PublishEventContext=t.useRouter=t.RouterContext=void 0;const r=n(155),o=n(155);t.RouterContext=(0,o.createContext)(null);t.useRouter=()=>{const e=(0,o.useContext)(t.RouterContext);if(void 0===e)throw new Error("useRouter must be used within a RouterContext.Provider");return e},t.PublishEventContext=(0,o.createContext)(null);t.usePublishEvent=()=>(0,o.useContext)(t.PublishEventContext);t.EspRouterContext=({children:e,router:n})=>{const i=(0,o.useCallback)(((e,t,r)=>{n.publishEvent(e,t,r)}),[n]);return r.createElement(t.RouterContext.Provider,{value:n},r.createElement(t.PublishEventContext.Provider,{value:i},e))},t.RouterProvider=t.EspRouterContext},621:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tryGetRenderModel=t.GetEspReactRenderModelConsts=void 0,t.getEspReactRenderModel=function(){return function(e,t,n){return r.EspDecoratorUtil.getOrCreateMetaData(e.constructor).addCustomData(o.CustomDataKey,{functionName:t}),n}};const r=n(152);var o;!function(e){e.CustomDataKey="GetEspReactRenderModelCustomDataKey",e.HandlerFunctionName="getEspReactRenderModel"}(o||(t.GetEspReactRenderModelConsts=o={}));t.tryGetRenderModel=e=>{if(r.EspDecoratorUtil.hasMetadata(e)){let t=r.EspDecoratorUtil.getCustomData(e,o.CustomDataKey);if(t)return e[t.functionName]()}let t=e[o.HandlerFunctionName];return t&&r.utils.isFunction(t)?t.call(e):e}},637:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});const r=n(43),o=n(213);r.PolimerModelBuilder.prototype.withViewBindings=function(e,t=o.DEFAULT_VIEW_KEY){let n=this._viewMappings||{};return n[t]=e,this._viewMappings=n,this};let i=r.PolimerModelBuilder.prototype.registerWithRouter;r.PolimerModelBuilder.prototype.registerWithRouter=function(){let e=i.call(this),t=this._viewMappings;return t&&Object.keys(t).forEach((n=>{(0,o.viewBinding)(t[n],n)(e.constructor)})),e}},743:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.useModelSelector=t.defaultConnectEqualityFn=void 0;const r=n(155),o=n(614),i=n(152),u=n(46),l=n(680),s=n(621);t.defaultConnectEqualityFn=(e,t)=>e===t;t.useModelSelector=(e,n,d=!0,a=t.defaultConnectEqualityFn)=>{i.Guard.isFunction(e,"You must pass a selector function to connectSelector");const c=(0,u.useRouter)();n=n||(0,l.useGetModelId)();const v=(0,r.useMemo)((()=>{let t=null;return{subscribe:e=>{const r=c.getModelObservable(n).subscribe((n=>{const r=d?(0,s.tryGetRenderModel)(n):n;t=r===n?Object.create(r):r,e()}));return()=>{t=null,r.dispose()}},getSnapshot:()=>t,wrappedSelector:t=>t?e(t):null}}),[c,n]);return(0,o.useSyncExternalStoreWithSelector)(v.subscribe,v.getSnapshot,void 0,v.wrappedSelector,a)}},453:function(e,t,n){var r=this&&this.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n};Object.defineProperty(t,"__esModule",{value:!0}),t.ViewBinder=void 0;const o=n(213),i=n(46);t.ViewBinder=e=>{var{model:t,viewContext:n}=e,u=r(e,["model","viewContext"]);if(t){const e=(0,i.useRouter)(),r=Object.assign({},{model:t,router:e},u);return(0,o.createViewForModel)(t,r,n,null)}return null}},639:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ViewBinderConnectable=void 0;const r=n(46),o=n(680),i=n(152),u=n(155),l=n(743),s=n(213),d=n(621);i.Logger.create("ViewBinderConnectable");t.ViewBinderConnectable=({modelId:e,viewContext:t,view:n})=>{const i=(0,r.useRouter)(),a=(0,l.useModelSelector)((e=>e),e,!1);if(!a)return null;let c=(0,d.tryGetRenderModel)(a);const v={modelId:e,router:i,model:c};let b=(0,s.createViewForModel)(a,v,t,n);return u.createElement(o.EspModelContext,Object.assign({modelId:e,router:i,model:c},v),b)}},213:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ViewMetadataRegistration=t.ViewMetadata=t.DEFAULT_VIEW_KEY=void 0,t.createViewForModel=function(e,n,o,i){let u=i;if(e){let n=e.constructor;if(n._viewMetadata){let e=n._viewMetadata;if(o&&e.hasRegisteredViewContext(o)){u=e.viewRegistrations[o].view}if(!u&&e.hasRegisteredViewContext(t.DEFAULT_VIEW_KEY)){u=e.viewRegistrations[t.DEFAULT_VIEW_KEY].view}}}if(!u)throw new Error(`No suitable view found for model id '${e.modelId}' using context '${o}'`);return r.createElement(u,n)},t.viewBinding=function(e,n=t.DEFAULT_VIEW_KEY){return o.Guard.isDefined(e,"view must be defined"),o.Guard.isString(n,"displayContext must be a string"),function(t){let r=function(e){e._viewMetadata||(e._viewMetadata=new i);return e._viewMetadata}(t);if(r.hasRegisteredViewContext(n))throw new Error(`Context ${n} already registered for view`);r.viewRegistrations[n]=new u(e,n)}};const r=n(155),o=n(152);t.DEFAULT_VIEW_KEY="default-view-key";class i{constructor(){this._viewRegistrations={}}get viewRegistrations(){return this._viewRegistrations}hasRegisteredViewContext(e){return void 0!==this._viewRegistrations[e]}}t.ViewMetadata=i;class u{constructor(e,t){this._view=e,this._displayContext=t}get view(){return this._view}get displayContext(){return this._displayContext}}t.ViewMetadataRegistration=u},152:t=>{t.exports=e},43:e=>{e.exports=t},155:e=>{e.exports=n}},o={};function i(e){var t=o[e];if(void 0!==t)return t.exports;var n=o[e]={exports:{}};return r[e].call(n.exports,n,n.exports,i),n.exports}var u={};return(()=>{var e=u;Object.defineProperty(e,"__esModule",{value:!0}),e.EspModelContext=e.usePublishModelEventWithEntityKey=e.PublishModelEventWithEntityKeyContext=e.usePublishModelEvent=e.PublishModelEventContext=e.GetModelIdContext=e.useGetModelId=e.usePublishEvent=e.PublishEventContext=e.useRouter=e.RouterContext=e.EspRouterContext=e.RouterProvider=e.defaultConnectEqualityFn=e.useModelSelector=e.ConnectableComponent=e.connect=e.createViewForModel=e.getEspReactRenderModel=e.GetEspReactRenderModelConsts=e.DEFAULT_VIEW_KEY=e.viewBinding=e.ViewBinderConnectable=e.ViewBinder=void 0,i(637);var t=i(453);Object.defineProperty(e,"ViewBinder",{enumerable:!0,get:function(){return t.ViewBinder}});var n=i(639);Object.defineProperty(e,"ViewBinderConnectable",{enumerable:!0,get:function(){return n.ViewBinderConnectable}});var r=i(213);Object.defineProperty(e,"viewBinding",{enumerable:!0,get:function(){return r.viewBinding}}),Object.defineProperty(e,"DEFAULT_VIEW_KEY",{enumerable:!0,get:function(){return r.DEFAULT_VIEW_KEY}});var o=i(621);Object.defineProperty(e,"GetEspReactRenderModelConsts",{enumerable:!0,get:function(){return o.GetEspReactRenderModelConsts}}),Object.defineProperty(e,"getEspReactRenderModel",{enumerable:!0,get:function(){return o.getEspReactRenderModel}});var l=i(213);Object.defineProperty(e,"createViewForModel",{enumerable:!0,get:function(){return l.createViewForModel}});var s=i(746);Object.defineProperty(e,"connect",{enumerable:!0,get:function(){return s.connect}});var d=i(397);Object.defineProperty(e,"ConnectableComponent",{enumerable:!0,get:function(){return d.ConnectableComponent}});var a=i(743);Object.defineProperty(e,"useModelSelector",{enumerable:!0,get:function(){return a.useModelSelector}}),Object.defineProperty(e,"defaultConnectEqualityFn",{enumerable:!0,get:function(){return a.defaultConnectEqualityFn}});var c=i(46);Object.defineProperty(e,"RouterProvider",{enumerable:!0,get:function(){return c.RouterProvider}}),Object.defineProperty(e,"EspRouterContext",{enumerable:!0,get:function(){return c.EspRouterContext}}),Object.defineProperty(e,"RouterContext",{enumerable:!0,get:function(){return c.RouterContext}}),Object.defineProperty(e,"useRouter",{enumerable:!0,get:function(){return c.useRouter}}),Object.defineProperty(e,"PublishEventContext",{enumerable:!0,get:function(){return c.PublishEventContext}}),Object.defineProperty(e,"usePublishEvent",{enumerable:!0,get:function(){return c.usePublishEvent}});var v=i(680);Object.defineProperty(e,"useGetModelId",{enumerable:!0,get:function(){return v.useGetModelId}}),Object.defineProperty(e,"GetModelIdContext",{enumerable:!0,get:function(){return v.GetModelIdContext}}),Object.defineProperty(e,"PublishModelEventContext",{enumerable:!0,get:function(){return v.PublishModelEventContext}}),Object.defineProperty(e,"usePublishModelEvent",{enumerable:!0,get:function(){return v.usePublishModelEvent}}),Object.defineProperty(e,"PublishModelEventWithEntityKeyContext",{enumerable:!0,get:function(){return v.PublishModelEventWithEntityKeyContext}}),Object.defineProperty(e,"usePublishModelEventWithEntityKey",{enumerable:!0,get:function(){return v.usePublishModelEventWithEntityKey}}),Object.defineProperty(e,"EspModelContext",{enumerable:!0,get:function(){return v.EspModelContext}})})(),u})()));
2
3
  //# sourceMappingURL=esp-react.min.js.map
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @license React
3
+ * use-sync-external-store-with-selector.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */
@@ -1 +1 @@
1
- {"version":3,"file":"esp-react.min.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,EAAQG,QAAQ,UAAWA,QAAQ,kBAAmBA,QAAQ,cAAeA,QAAQ,UAC7E,mBAAXC,QAAyBA,OAAOC,IAC9CD,OAAO,CAAC,SAAU,iBAAkB,aAAc,SAAUJ,GAClC,iBAAZC,QACdA,QA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BC,GAE5B,IAAIC,EAAeJ,EAAyBG,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaxK,QAGrB,IAAIC,EAASmK,EAAyBG,GAAY,CAGjDvK,QAAS,CAAC,GAOX,OAHA0K,EAAoBH,GAAUnG,KAAKnE,EAAOD,QAASC,EAAQA,EAAOD,QAASsK,GAGpErK,EAAOD,OACf,CCnB0BsK,CAAoB,K","sources":["webpack://esp-js-react/webpack/universalModuleDefinition","webpack://esp-js-react/./src/connectableComponent.tsx","webpack://esp-js-react/./src/espModelContext.tsx","webpack://esp-js-react/./src/getEspReactRenderModel.ts","webpack://esp-js-react/./src/index.ts","webpack://esp-js-react/./src/polimer/polimerExtentsions.ts","webpack://esp-js-react/./src/routerProvider.tsx","webpack://esp-js-react/./src/shallowEqual.ts","webpack://esp-js-react/./src/shouldUpdateMixin.ts","webpack://esp-js-react/./src/smartComponent.tsx","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 \"prop-types\"","webpack://esp-js-react/external umd \"react\"","webpack://esp-js-react/webpack/bootstrap","webpack://esp-js-react/webpack/startup"],"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(\"prop-types\"), require(\"react\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"esp-js\", \"esp-js-polimer\", \"prop-types\", \"react\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"esp-js-react\"] = factory(require(\"esp-js\"), require(\"esp-js-polimer\"), require(\"prop-types\"), require(\"react\"));\n\telse\n\t\troot[\"esp-js-react\"] = factory(root[\"esp-js\"], root[\"esp-js-polimer\"], root[\"prop-types\"], root[\"react\"]);\n})(self, (__WEBPACK_EXTERNAL_MODULE__152__, __WEBPACK_EXTERNAL_MODULE__43__, __WEBPACK_EXTERNAL_MODULE__949__, __WEBPACK_EXTERNAL_MODULE__155__) => {\nreturn ","import * as React from 'react';\nimport * as PropTypes from 'prop-types';\nimport {Disposable, Router, EspDecoratorUtil, utils, DisposableBase} from 'esp-js';\nimport {createViewForModel } from './viewBindingDecorator';\nimport {GetEspReactRenderModelConsts, GetEspReactRenderModelMetadata} from './getEspReactRenderModel';\nimport {EspModelContext} from './espModelContext';\n\nexport type PublishEvent = (eventType: string, event: any) => void;\n\nexport type CreatePublishEventProps<TPublishEventProps> = (publishEvent: PublishEvent) => TPublishEventProps;\n\nexport type MapModelToProps<TModel, TModelMappedToProps, TPublishEventProps = {}> = (model: TModel, publishEventProps: TPublishEventProps) => TModelMappedToProps;\n\nexport type ViewComponentTypes = React.FunctionComponent | React.ClassType<any, any, any> | React.ComponentClass;\n\nexport interface ConnectableComponentProps<TModel ={}, TPublishEventProps = {}, TModelMappedToProps = {}> {\n modelId?: string;\n viewContext?: string;\n view?: ViewComponentTypes;\n /**\n * Provides a means to create a serious of 'publish event' callbacks which will be passed as props to the child view.\n */\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> {\n modelId: string;\n model: TModel;\n router: Router;\n [key: string]: any; // ...rest props, including the result of mapPublish and mapPublish if 'connect' was used\n}\n\nexport interface State {\n model?: any;\n currentModelId?: string;\n publishProps?: any;\n publishEvent?: PublishModelEventDelegate;\n}\n\ninterface ConnectableComponentContext {\n router: Router;\n modelId: string;\n}\n\nexport type PublishModelEventDelegate = (eventType: string, event: any) => void;\n\nexport class ConnectableComponent<TModel, TPublishEventProps = {}, TModelMappedToProps = {}> extends React.Component<ConnectableComponentProps<TModel, TPublishEventProps, TModelMappedToProps>, State> {\n private _isMounted = false;\n private _observationSubscription: Disposable;\n context: ConnectableComponentContext;\n\n static contextTypes = {\n router: PropTypes.instanceOf(Router).isRequired,\n modelId: PropTypes.string\n };\n\n constructor(props: ConnectableComponentProps<TModel, TPublishEventProps, TModelMappedToProps>, context: ConnectableComponentContext) {\n super(props, context);\n this.state = {model: null, currentModelId: null};\n }\n\n componentWillReceiveProps(nextProps: ConnectableComponentProps<TModel, TPublishEventProps, TModelMappedToProps>, nextContext: ConnectableComponentContext) {\n const modelId = nextProps.modelId || nextContext.modelId;\n const oldModelId = this._getModelId();\n\n if (modelId === oldModelId) {\n return;\n }\n \n if(nextProps.modelId === oldModelId) {\n return;\n }\n\n this._tryObserveModel(modelId);\n }\n\n componentDidMount() {\n this._isMounted = true;\n this._tryObserveModel(this._getModelId());\n }\n\n componentWillUnmount() {\n this._isMounted = false;\n this._tryDisposeModelSubscription();\n }\n\n private _getModelId(): string {\n // props override context\n return this.props.modelId || this.context.modelId;\n }\n\n private _tryObserveModel(modelId: string): void {\n this._tryDisposeModelSubscription();\n\n if (!modelId) {\n return;\n }\n\n let stateChanged = modelId !== this.state.currentModelId;\n\n let publishEvent = this.state.publishEvent;\n if (stateChanged) {\n publishEvent = this._publishEvent(this.context.router, modelId);\n }\n\n let publishProps = this.state.publishProps;\n // We only map the publish props once, as for well behaving components these callbacks should never change\n if (stateChanged && this.props.createPublishEventProps) {\n publishProps = this.props.createPublishEventProps(publishEvent);\n }\n\n if (stateChanged) {\n this.setState({\n currentModelId: modelId,\n publishEvent,\n publishProps\n });\n this._observationSubscription = this.context.router\n .getModelObservable(modelId)\n .subscribe(model => {\n if (this._isMounted) {\n this.setState({model});\n }\n });\n }\n }\n\n private _tryDisposeModelSubscription() {\n if(this._observationSubscription) {\n this._observationSubscription.dispose();\n this._observationSubscription = new DisposableBase();\n this.setState({model: null, currentModelId: null, publishProps: null, publishEvent: null});\n }\n }\n\n private _publishEvent = (router: Router, modelId: string) => (eventType: string, event: any) => router.publishEvent(modelId, eventType, event);\n\n public render() {\n if(this.state.model == null) {\n return null;\n }\n let childProps = this._getChildProps();\n let view = createViewForModel(this.state.model, childProps, this.props.viewContext, this.props.view);\n\n return (<EspModelContext modelId={this.props.modelId} router={this.context.router} {...childProps}>{view}</EspModelContext>);\n }\n\n private _getChildProps(): ConnectableComponentChildProps<TModel> {\n // consume what this component owns, and let the rest end up in `...rest`\n const {children, createPublishEventProps, modelId, mapModelToProps, view, viewContext, ...rest} = this.props;\n const model = this._getRenderModel(this.state.model);\n let childProps = {\n modelId,\n router: this.context.router,\n ...rest,\n ...this.state.publishProps,\n model\n };\n if (this.props.mapModelToProps) {\n childProps = {\n ...childProps,\n ...(this.props.mapModelToProps(model, this.state.publishProps) as any)\n };\n }\n return childProps;\n }\n\n /**\n * Sees if there is a special selector function which can be invoked to return a render model rather than the top level model model itself\n */\n private _getRenderModel(model: any): TModel {\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: GetEspReactRenderModelMetadata = EspDecoratorUtil.getCustomData(model, GetEspReactRenderModelConsts.CustomDataKey);\n if (metadata) {\n return model[metadata.functionName]();\n }\n }\n // else see if there is a function with name GetEspReactRenderModelConsts.HandlerFunctionName we can invoke to get a different model to render?\n let renderModelGetter = model[GetEspReactRenderModelConsts.HandlerFunctionName];\n if (renderModelGetter && utils.isFunction(renderModelGetter)) {\n return renderModelGetter.call(model);\n }\n // else just return the default model\n return model;\n }\n}\n\n// Lifting 'ConnectableView' into it's own type so it can be exported, else tsc doesn't correctly generated declaration files\nexport type ConnectableView = React.ComponentClass | React.SFC;\n\nexport const connect = function<TModel, TPublishEventProps, TModelMappedToProps = {}>(\n mapModelToProps?: MapModelToProps<TModel, TModelMappedToProps, TPublishEventProps>,\n createPublishEventProps?: CreatePublishEventProps<TPublishEventProps>\n): (view: ConnectableView) => (props: ConnectableComponentProps<TModel, TPublishEventProps, TModelMappedToProps>) => JSX.Element {\n return function(view: ConnectableView) {\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 {DefaultModelAddress, ModelAddress, Router} from 'esp-js';\nimport {useContext, useCallback, createContext, PropsWithChildren} from 'react';\nimport {RouterContext} from './routerProvider';\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 PublishEventDelegate = (modelIdOrModelAddress: string | ModelAddress, eventType: string, event: any) => void;\nexport const PublishEventContext = createContext<PublishEventDelegate>(null);\n/**\n * Returns a function which can be used to publish an event.\n */\nexport const usePublishEvent = () => useContext(PublishEventContext);\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 EspModelContextProps {\n modelId: string;\n router: Router;\n}\n\nexport const EspModelContext = ({modelId, children, router}: PropsWithChildren<EspModelContextProps>) => {\n const getModelId: () => string = useCallback(() => {\n return modelId;\n }, [router, modelId]);\n const publishEvent: PublishEventDelegate = useCallback((modelIdOrModelAddress: string, eventType: string, event: any) => {\n router.publishEvent(modelIdOrModelAddress, eventType, event);\n }, [router]);\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 <RouterContext.Provider value={router}>\n <GetModelIdContext.Provider value={getModelId}>\n <PublishEventContext.Provider value={publishEvent}>\n <PublishModelEventContext.Provider value={publishModelEvent}>\n <PublishModelEventWithEntityKeyContext.Provider value={publishModelEventWithEntityKey}>\n {children}\n </PublishModelEventWithEntityKeyContext.Provider>\n </PublishModelEventContext.Provider>\n </PublishEventContext.Provider>\n </GetModelIdContext.Provider>\n </RouterContext.Provider>\n );\n};","import {EspMetadata, EspDecoratorUtil} from 'esp-js';\n\nexport interface GetEspReactRenderModelMetadata {\n functionName: string;\n}\n\nexport namespace GetEspReactRenderModelConsts {\n export const CustomDataKey = 'GetEspReactRenderModelCustomDataKey';\n /**\n * If there is no @getEspReactRenderModel 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 = 'getEspReactRenderModel';\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 getEspReactRenderModel() {\n return function (target, name, descriptor) {\n let metadata: EspMetadata = EspDecoratorUtil.getOrCreateMetaData(target.constructor);\n metadata.addCustomData(\n GetEspReactRenderModelConsts.CustomDataKey,\n <GetEspReactRenderModelMetadata>{ functionName: name }\n );\n return descriptor;\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/polimerExtentsions';\n\nexport {RouterProvider, RouterContext, useRouter} from './routerProvider';\nexport {SmartComponent} from './smartComponent';\nexport {ViewBinder} from './viewBinder';\nexport {viewBinding, DEFAULT_VIEW_KEY} from './viewBindingDecorator';\nexport * from './getEspReactRenderModel';\nexport {shouldUpdateMixin} from './shouldUpdateMixin';\nexport {createViewForModel} from './viewBindingDecorator';\nexport {\n ConnectableComponent,\n connect,\n ConnectableComponentProps,\n MapModelToProps,\n CreatePublishEventProps,\n ConnectableView,\n ConnectableComponentChildProps,\n} from './connectableComponent';\nexport {\n useGetModelId,\n GetModelIdDelegate,\n GetModelIdContext,\n\n PublishEventDelegate,\n PublishEventContext,\n usePublishEvent,\n\n PublishModelEventDelegate,\n PublishModelEventContext,\n usePublishModelEvent,\n\n PublishModelEventWithEntityKeyDelegate,\n PublishModelEventWithEntityKeyContext,\n usePublishModelEventWithEntityKey,\n\n EspModelContext,\n EspModelContextProps\n} from './espModelContext';\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","// 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 * as PropTypes from 'prop-types';\nimport { Router } from 'esp-js';\nimport {useContext} from 'react';\n\nexport interface RouterProviderProps {\n router: Router;\n // React 18 Fix:\n // The current codebase is React 16, it will work with React 18, but there were changes to the types in React 18.\n // The `children` prop was removed from some React types that cause the RouterProvider to fail, this fixes that.\n children: any;\n}\n\nexport const RouterContext = React.createContext<Router>(null);\nexport const useRouter = () => useContext(RouterContext);\n\nexport class RouterProvider extends React.Component<RouterProviderProps, any> {\n static childContextTypes = {\n router: PropTypes.instanceOf(Router).isRequired\n };\n getChildContext() {\n return {\n router: this.props.router\n };\n }\n render() {\n return (<RouterContext.Provider value={this.props.router}>{this.props.children}</RouterContext.Provider>);\n }\n}","// taken from fbjs:\n// https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/core/shallowEqual.js\n// Licence (MIT) https://github.com/facebook/fbjs/blob/master/packages/fbjs/LICENSE\n/**\n * Copyright (c) 2013-present, Facebook, Inc.\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 * @providesModule shallowEqual\n * @typechecks\n * @flow\n */\n\n/*eslint-disable no-self-compare */\n\n'use strict';\n\nconst hasOwnProperty = Object.prototype.hasOwnProperty;\n\n/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\nexport function is(x: any, y: any): boolean {\n // SameValue algorithm\n if (x === y) { // Steps 1-5, 7-10\n // Steps 6.b-6.e: +0 != -0\n // Added the nonzero y check to make Flow happy, but it is redundant\n return x !== 0 || y !== 0 || 1 / x === 1 / y;\n } else {\n // Step 6.a: NaN == NaN\n return x !== x && y !== y;\n }\n}\n\n/**\n * Performs equality by iterating through keys on an object and returning false\n * when any key has values which are not strictly equal between the arguments.\n * Returns true when the values of all keys are strictly equal.\n */\nexport function shallowEqual(objA, objB) {\n if (is(objA, objB)) {\n return true;\n }\n\n if (typeof objA !== 'object' || objA === null ||\n typeof objB !== 'object' || objB === null) {\n return false;\n }\n\n const keysA = Object.keys(objA);\n const keysB = Object.keys(objB);\n\n if (keysA.length !== keysB.length) {\n return false;\n }\n\n // Test for A's keys different from B.\n for (let i = 0; i < keysA.length; i++) {\n if (\n !hasOwnProperty.call(objB, keysA[i]) ||\n !is(objA[keysA[i]], objB[keysA[i]])\n ) {\n return false;\n }\n }\n\n return true;\n}","// notice_start\n/*\n * Copyright 2018 Keith Woods\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 {shallowEqual} from './shallowEqual';\n\n// WORKS (compiles at least):\n//\n// export function shouldUpdateMixin<TProps, TState, TPropBindings>(itemsThatEffectUpdateSelector: (nextProps: TProps) => TPropBindings) {\n// return function <T extends {new(...args:any[]):{}}>(constructor:T) {\n// return class extends constructor {\n// _propBindings : {};\n// shouldComponentUpdate(nextProps, nextState) {\n// let newBindings = itemsThatEffectUpdateSelector(nextProps);\n// let bindingsAreEqual = shallowEqual(this._propBindings, newBindings);\n// this._propBindings = newBindings;\n// return !bindingsAreEqual;\n// }\n// render() {\n// return React.createElement(<any>constructor, (<any>this).props);\n// }\n// };\n// };\n// }\n\nexport function shouldUpdateMixin<TProps, TState, TPropBindings>(itemsThatEffectUpdateSelector: (nextProps: TProps) => TPropBindings) {\n return function <TConstructor extends { new(...args: any[]): {} }>(Constructor: TConstructor) {\n return class extends Constructor {\n _propBindings: {};\n shouldComponentUpdate(nextProps, nextState) {\n let newBindings = itemsThatEffectUpdateSelector(nextProps);\n let bindingsAreEqual = shallowEqual(this._propBindings, newBindings);\n this._propBindings = newBindings;\n return !bindingsAreEqual;\n }\n render() {\n return React.createElement(<any>Constructor, (<any>this).props);\n }\n };\n };\n}\n\n// export function shouldUpdateMixin<TProps, TState, TPropBindings>(itemsThatEffectUpdateSelector: (nextProps: TProps) => TPropBindings) {\n// return function(Comp: React.ComponentClass<TProps, TState>) {\n// return class extends React.Component<TProps, TState> {\n// _propBindings : {};\n// shouldComponentUpdate(nextProps, nextState) {\n// let newBindings = itemsThatEffectUpdateSelector(nextProps);\n// let bindingsAreEqual = shallowEqual(this._propBindings, newBindings);\n// this._propBindings = newBindings;\n// return !bindingsAreEqual;\n// }\n// render() {\n// return React.createElement(Comp, this.props);\n// }\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 * as PropTypes from 'prop-types';\nimport { createViewForModel } from './viewBindingDecorator';\nimport { Router } from 'esp-js';\n\nexport interface SmartComponentProps {\n modelId: string;\n view?: any;\n viewContext?: string;\n modelSelector?: (model: any) => any;\n [key: string]: any; // other props which will be passed through to the SmartComponent's view\n}\n\nexport interface SmartComponentState {\n model: any;\n}\n\nexport class SmartComponent extends React.Component<SmartComponentProps, SmartComponentState> {\n private _currentObservingModelId = false;\n private _observationSubscription = null;\n\n static contextTypes = {\n router: PropTypes.instanceOf(Router).isRequired\n };\n\n componentWillReceiveProps(nextProps: SmartComponentProps) {\n this._tryObserveModel(nextProps.modelId);\n }\n componentWillMount() {\n this._tryObserveModel(this.props.modelId);\n }\n componentWillUnmount() {\n this._tryDisposeObservationSubscription();\n }\n _tryObserveModel(modelId) {\n if(!modelId) {\n this._tryDisposeObservationSubscription();\n this.setState({model: null});\n } else if (modelId !== this._currentObservingModelId) {\n this._tryDisposeObservationSubscription();\n this._currentObservingModelId = modelId;\n this._observationSubscription = this.context.router\n .getModelObservable(modelId)\n .map(model => {\n return this.props.modelSelector\n ? this.props.modelSelector(model)\n : model;\n })\n .subscribe(model => {\n this.setState({model: model});\n });\n }\n }\n _tryDisposeObservationSubscription() {\n this._currentObservingModelId = null;\n if(this._observationSubscription) {\n this._observationSubscription.dispose();\n }\n }\n render() {\n if(this.state.model) {\n return createViewForModel(this.state.model, this._getChildProps(), this.props.viewContext, this.props.view);\n }\n return null; // this (in react 15) will render a 'comment node' rather than any actual html\n }\n _getChildProps() {\n // 'consume' the props we own, pass the rest down\n let {modelId, viewContext, view, modelSelector, ...other} = this.props;\n let newProps = {\n model: this.state.model,\n router: this.context.router\n };\n return Object.assign({}, newProps, other);\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 esp from 'esp-js';\nimport * as React from 'react';\nimport * as PropTypes from 'prop-types';\nimport { createViewForModel } from './viewBindingDecorator';\n\nexport interface ViewBinderProps {\n model: any;\n viewContext: string;\n}\n\nexport class ViewBinder extends React.Component<ViewBinderProps> {\n\n static contextTypes = {\n router: PropTypes.instanceOf(esp.Router).isRequired\n };\n\n render() {\n if(this.props.model) {\n let {model, viewContext, ...other} = this.props;\n let newProps = Object.assign({}, { model: this.props.model, router:this.context.router }, other);\n return createViewForModel(\n this.props.model,\n newProps,\n this.props.viewContext,\n null\n );\n }\n return null;\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';\nimport {ViewComponentTypes} from './connectableComponent';\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: ViewComponentTypes) {\n let finalView: ViewComponentTypes = 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__949__;","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","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(872);\n"],"names":["root","factory","exports","module","require","define","amd","self","__WEBPACK_EXTERNAL_MODULE__152__","__WEBPACK_EXTERNAL_MODULE__43__","__WEBPACK_EXTERNAL_MODULE__949__","__WEBPACK_EXTERNAL_MODULE__155__","ConnectableComponent","React","Component","constructor","props","context","super","_isMounted","_publishEvent","router","modelId","eventType","event","publishEvent","this","state","model","currentModelId","componentWillReceiveProps","nextProps","nextContext","oldModelId","_getModelId","_tryObserveModel","componentDidMount","componentWillUnmount","_tryDisposeModelSubscription","stateChanged","publishProps","createPublishEventProps","setState","_observationSubscription","getModelObservable","subscribe","dispose","DisposableBase","render","childProps","_getChildProps","view","createViewForModel","viewContext","EspModelContext","children","mapModelToProps","rest","_getRenderModel","EspDecoratorUtil","hasMetadata","metadata","getCustomData","GetEspReactRenderModelConsts","CustomDataKey","functionName","renderModelGetter","HandlerFunctionName","utils","isFunction","call","contextTypes","PropTypes","instanceOf","Router","isRequired","string","connect","GetModelIdContext","createContext","useGetModelId","useContext","PublishEventContext","usePublishEvent","PublishModelEventContext","usePublishModelEvent","PublishModelEventWithEntityKeyContext","usePublishModelEventWithEntityKey","getModelId","useCallback","modelIdOrModelAddress","publishModelEvent","publishModelEventWithEntityKey","entityKey","DefaultModelAddress","RouterContext","Provider","value","target","name","descriptor","getOrCreateMetaData","addCustomData","RouterProvider","useRouter","SmartComponent","ViewBinder","viewBinding","DEFAULT_VIEW_KEY","shouldUpdateMixin","PolimerModelBuilder","prototype","withViewBindings","displayContext","viewMappings","_viewMappings","registerWithRouter","Object","keys","forEach","getChildContext","childContextTypes","objA","objB","is","keysA","keysB","length","i","hasOwnProperty","x","y","itemsThatEffectUpdateSelector","Constructor","shouldComponentUpdate","nextState","newBindings","bindingsAreEqual","shallowEqual","_propBindings","createElement","_currentObservingModelId","componentWillMount","_tryDisposeObservationSubscription","map","modelSelector","other","newProps","assign","esp","finalView","constructorFunction","_viewMetadata","viewMetadata","hasRegisteredViewContext","viewRegistrations","Error","Guard","isDefined","isString","ViewMetadata","getMetadata","ViewMetadataRegistration","_viewRegistrations","_view","_displayContext","__webpack_module_cache__","__webpack_exports__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__"],"sourceRoot":""}
1
+ {"version":3,"file":"esp-react.min.js","mappings":";CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,EAAQG,QAAQ,UAAWA,QAAQ,kBAAmBA,QAAQ,UACtD,mBAAXC,QAAyBA,OAAOC,IAC9CD,OAAO,CAAC,SAAU,iBAAkB,SAAUJ,GACpB,iBAAZC,QACdA,QAAQ,gBAAkBD,EAAQG,QAAQ,UAAWA,QAAQ,kBAAmBA,QAAQ,UAExFJ,EAAK,gBAAkBC,EAAQD,EAAK,UAAWA,EAAK,kBAAmBA,EAAY,MACpF,CATD,CASGO,MAAM,CAACC,EAAkCC,EAAiCC,4CCAhE,IAAIC,EAAE,EAAQ,KAA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AnB,WAAW,IAAE,kFAAAP,gBAAgB,IACrC,aAEI,8FAAAd,4BAA4B,IAC5B,gEAAA+D,IAAA,oBAAAC,sBAAsB,IAE1B,aAAQ,oFAAAvG,kBAAkB,IAC1B,aACI,yEAAA1B,OAAO,IAGX,aAKI,sFAAAQ,oBAAoB,IAExB,aACI,kFAAAW,gBAAgB,IAEhB,0FAAAoE,wBAAwB,IAE5B,YACI,gFAAA9B,cAAc,IAEd,kFAAAF,gBAAgB,IAEhB,+EAAAN,aAAa,IACb,2EAAAvC,SAAS,IAET,qFAAA2C,mBAAmB,IACnB,iFAAAC,eAAe,IAEnB,aACI,+EAAA3C,aAAa,IAEb,mFAAAmB,iBAAiB,IAEjB,0FAAAK,wBAAwB,IACxB,sFAAAC,oBAAoB,IAEpB,uGAAAC,qCAAqC,IACrC,mGAAAC,iCAAiC,IACjC,iFAAAX,eAAe","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/espModelContext.tsx","webpack://esp-js-react/./src/espRouterContext.tsx","webpack://esp-js-react/./src/polimer/getEspReactRenderModel.ts","webpack://esp-js-react/./src/polimer/polimerExtentsions.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 './espRouterContext';\nimport {useMemo} from 'react';\nimport {Router, utils} from 'esp-js';\nimport {EspModelContext, useGetModelId} from './espModelContext';\nimport {createViewForModel} from './viewBindingDecorator';\nimport {tryGetRenderModel} from './polimer/getEspReactRenderModel';\nimport {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 = tryGetRenderModel<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 modelId,\n 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 <EspModelContext modelId={modelId} model={model} router={router} {...childProps}>\n {viewElement}\n </EspModelContext>\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 './espRouterContext';\n\nconst _log = Logger.create('EspModelContext');\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 EspModelContextProps {\n modelId: string;\n model?: unknown;\n}\n\nexport const EspModelContext = ({modelId, children, model}: PropsWithChildren<EspModelContextProps>) => {\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 `EspModelContext 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 * <EspRouterContext router={router}>\n * <YourComponents />\n * </EspRouterContext>\n */\nexport const usePublishEvent = () => useContext(PublishEventContext);\n\nexport type EspRouterContextProps = 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 EspRouterContext = ({children, router}: EspRouterContextProps) => {\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 EspRouterContext\n */\nexport const RouterProvider = EspRouterContext;\n\n/**\n * Props for RouterProvider\n *\n * @deprecated use EspRouterContextProps\n */\nexport type RouterProviderProps = EspRouterContextProps;\n","import {EspMetadata, EspDecoratorUtil, utils} from 'esp-js';\n\nexport interface GetEspReactRenderModelMetadata {\n functionName: string;\n}\n\nexport namespace GetEspReactRenderModelConsts {\n export const CustomDataKey = 'GetEspReactRenderModelCustomDataKey';\n /**\n * If there is no @getEspReactRenderModel 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 = 'getEspReactRenderModel';\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 getEspReactRenderModel() {\n return function (target, name, descriptor) {\n let metadata: EspMetadata = EspDecoratorUtil.getOrCreateMetaData(target.constructor);\n metadata.addCustomData(\n GetEspReactRenderModelConsts.CustomDataKey,\n <GetEspReactRenderModelMetadata>{ 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 sub graph to use as state.\n *\n */\nexport const tryGetRenderModel = <TRenderModel>(model: any): TRenderModel => {\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: GetEspReactRenderModelMetadata = EspDecoratorUtil.getCustomData(model, GetEspReactRenderModelConsts.CustomDataKey);\n if (metadata) {\n return model[metadata.functionName]();\n }\n }\n // else see if there is a function with name GetEspReactRenderModelConsts.HandlerFunctionName we can invoke to get a different model to render?\n let renderModelGetter = model[GetEspReactRenderModelConsts.HandlerFunctionName];\n if (renderModelGetter && utils.isFunction(renderModelGetter)) {\n return renderModelGetter.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} from 'esp-js';\nimport {useRouter} from './espRouterContext';\nimport {useGetModelId} from './espModelContext';\nimport {tryGetRenderModel} from './polimer/getEspReactRenderModel';\n\nexport const defaultConnectEqualityFn = <TSelected>(a: TSelected, b: TSelected) => a === b; // reference equality\n\nexport type ConnectEqualityFn<T> = (last: T, next: T) => boolean;\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 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 const useModelSelector = <TModel = unknown, TSelected = unknown>(\n selector: (model: TModel) => TSelected,\n modelId?: string,\n tryPreSelectPolimerImmutableModel: boolean = true,\n equalityFn: ConnectEqualityFn<TSelected> = defaultConnectEqualityFn\n) => {\n Guard.isFunction(selector, 'You must pass a selector function to connectSelector');\n const router = useRouter();\n modelId = modelId || useGetModelId();\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 ? tryGetRenderModel(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\n // TODO confirm this comment with a test:\n\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 // 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};","// 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 './espRouterContext';\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 './espRouterContext';\nimport {EspModelContext} from './espModelContext';\nimport {Logger, Router} from 'esp-js';\nimport * as React from 'react';\nimport {useModelSelector} from './useModelSelector';\nimport {createViewForModel} from './viewBindingDecorator';\nimport {tryGetRenderModel} from './polimer/getEspReactRenderModel';\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 modelId,\n false\n );\n if (!model) {\n return null;\n }\n let renderModel = tryGetRenderModel<object>(model);\n const childProps: ViewBinderConnectableChildProps = {\n modelId,\n router: router,\n model: renderModel\n };\n let viewElement = createViewForModel(model, childProps, viewContext, view);\n return (\n <EspModelContext modelId={modelId} router={router} model={renderModel} {...childProps}>\n {viewElement}\n </EspModelContext>\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/polimerExtentsions';\n\nexport {ViewBinder} from './viewBinder';\nexport {\n ViewBinderConnectableProps,\n ViewBinderConnectable\n} from './viewBinderConnectable';\nexport {viewBinding, DEFAULT_VIEW_KEY} from './viewBindingDecorator';\nexport {\n GetEspReactRenderModelMetadata,\n GetEspReactRenderModelConsts,\n getEspReactRenderModel\n} from './polimer/getEspReactRenderModel';\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 ConnectEqualityFn,\n defaultConnectEqualityFn\n} from './useModelSelector';\nexport {\n RouterProvider,\n RouterProviderProps,\n EspRouterContext,\n EspRouterContextProps,\n RouterContext,\n useRouter,\n PublishEventDelegate,\n PublishEventContext,\n usePublishEvent,\n} from './espRouterContext';\nexport {\n useGetModelId,\n GetModelIdDelegate,\n GetModelIdContext,\n PublishModelEventDelegate,\n PublishModelEventContext,\n usePublishModelEvent,\n PublishModelEventWithEntityKeyDelegate,\n PublishModelEventWithEntityKeyContext,\n usePublishModelEventWithEntityKey,\n EspModelContext,\n EspModelContextProps,\n} from './espModelContext';\n"],"names":["root","factory","exports","module","require","define","amd","self","__WEBPACK_EXTERNAL_MODULE__152__","__WEBPACK_EXTERNAL_MODULE__43__","__WEBPACK_EXTERNAL_MODULE__155__","g","p","Object","is","a","b","q","useSyncExternalStore","r","useRef","t","useEffect","u","useMemo","v","useDebugValue","useSyncExternalStoreWithSelector","e","l","h","c","current","f","hasValue","value","d","k","m","connect","mapModelToProps","createPublishEventProps","view","props","modelId","viewContext","rest","ConnectableComponent","router","useRouter","useGetModelId","utils","stringIsEmpty","publishEventProps","eventType","event","publishEvent","model","useModelSelector","childProps","restProps","initialModel","tryGetRenderModel","getChildProps","viewElement","createViewForModel","EspModelContext","Logger","create","GetModelIdContext","createContext","useContext","GetModelContext","useGetModel","PublishModelEventContext","usePublishModelEvent","PublishModelEventWithEntityKeyContext","usePublishModelEventWithEntityKey","children","getModelId","useCallback","getModel","warnIfModelAccessedOutSideDispatchLoop","publishModelEvent","publishModelEventWithEntityKey","entityKey","DefaultModelAddress","Provider","RouterContext","context","undefined","Error","PublishEventContext","usePublishEvent","EspRouterContext","modelIdOrModelAddress","RouterProvider","target","name","descriptor","EspDecoratorUtil","getOrCreateMetaData","constructor","addCustomData","GetEspReactRenderModelConsts","CustomDataKey","functionName","HandlerFunctionName","hasMetadata","metadata","getCustomData","renderModelGetter","isFunction","call","PolimerModelBuilder","prototype","withViewBindings","displayContext","DEFAULT_VIEW_KEY","viewMappings","this","_viewMappings","registerWithRouter","keys","forEach","viewBinding","defaultConnectEqualityFn","selector","tryPreSelectPolimerImmutableModel","equalityFn","Guard","dependencies","subscribe","stateChanged","modelSubscriptionDisposable","getModelObservable","nextModel","dispose","getSnapshot","wrappedSelector","snapshot","ViewBinder","newProps","assign","ViewBinderConnectable","renderModel","finalView","constructorFunction","_viewMetadata","viewMetadata","hasRegisteredViewContext","viewRegistrations","React","createElement","isDefined","isString","ViewMetadata","getMetadata","ViewMetadataRegistration","_viewRegistrations","_view","_displayContext","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","get","getEspReactRenderModel"],"sourceRoot":""}
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+ import { ConnectableComponentProps, CreatePublishEventProps, MapModelToProps } from './connectableComponent';
3
+ /**
4
+ * @deprecated
5
+ */
6
+ export type ConnectableComponentFactory<TModel, TPublishEventProps, TModelMappedToProps = {}> = (view: React.ComponentType) => (props: ConnectableComponentProps<TModel, TPublishEventProps, TModelMappedToProps>) => React.JSX.Element;
7
+ /**
8
+ * @deprecated
9
+ * @param mapModelToProps
10
+ * @param createPublishEventProps
11
+ */
12
+ export declare const connect: <TModel, TPublishEventProps, TModelMappedToProps = {}>(mapModelToProps?: MapModelToProps<TModel, TModelMappedToProps, TPublishEventProps>, createPublishEventProps?: CreatePublishEventProps<TPublishEventProps>) => ConnectableComponentFactory<TModel, TPublishEventProps, TModelMappedToProps>;