esp-js-react 8.1.1-next.0 → 9.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dist/esp-react.esm.js +713 -0
- package/.dist/esp-react.esm.js.map +1 -0
- package/.dist/esp-react.js +696 -775
- package/.dist/esp-react.js.map +1 -1
- package/.dist/esp-react.min.js +20 -3
- package/.dist/esp-react.min.js.map +1 -1
- package/.dist/typings/connectableComponent.d.ts +5 -6
- package/.dist/typings/espApp.d.ts +25 -0
- package/.dist/typings/espEventBusContextProvider.d.ts +41 -0
- package/.dist/typings/espModulesContext.d.ts +3 -0
- package/.dist/typings/espStoreContextProvider.d.ts +62 -0
- package/.dist/typings/index.d.ts +13 -9
- package/.dist/typings/regionView.d.ts +19 -0
- package/.dist/typings/useSyncModelWithSelector.d.ts +9 -16
- package/README.md +62 -22
- package/package.json +53 -45
- package/.dist/esp-react.min.js.LICENSE.txt +0 -9
- package/.dist/typings/connect.d.ts +0 -8
- package/.dist/typings/espModelContextProvider.d.ts +0 -63
- package/.dist/typings/espRouterContextProvider.d.ts +0 -54
- package/.dist/typings/polimer/polimerModelBuilderExtentsions.d.ts +0 -6
- package/.dist/typings/viewBinder.d.ts +0 -13
- package/.dist/typings/viewBindingDecorator.d.ts +0 -34
- package/.yarnignore +0 -15
- package/docs/images/esp-agile-demo.gif +0 -0
- package/jest.config.js +0 -19
- package/src/connect.tsx +0 -27
- package/src/connectableComponent.tsx +0 -99
- package/src/espModelContextProvider.tsx +0 -101
- package/src/espRouterContextProvider.tsx +0 -97
- package/src/index.ts +0 -68
- package/src/polimer/polimerModelBuilderExtentsions.ts +0 -36
- package/src/useSyncModelWithSelector.ts +0 -223
- package/src/viewBinder.tsx +0 -51
- package/src/viewBindingDecorator.ts +0 -113
- package/tests/connectableComponentTests.tsx +0 -477
- package/tests/espModelContextProviderTests.tsx +0 -150
- package/tests/espRouterContextProviderTests.tsx +0 -56
- package/tests/indexTests.ts +0 -47
- package/tests/testApi/asserts.ts +0 -102
- package/tests/testApi/routerSpy.ts +0 -24
- package/tests/testApi/testApi.tsx +0 -100
- package/tests/testApi/testModel.ts +0 -43
- package/tests/testApi/useStoreReceivedProps.ts +0 -14
- package/tests/testApi/viewFactory.tsx +0 -31
- package/tests/useSyncModelWithSelectorTests.tsx +0 -330
- package/tests/viewBinderTests.tsx +0 -61
- package/tsconfig.json +0 -14
- package/webpack.config.js +0 -27
|
@@ -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,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,KAAwE,IAAIC,EAAE,mBAAoBC,OAAOC,GAAGD,OAAOC,GAA1G,SAAWC,EAAEC,GAAG,OAAOD,IAAIC,IAAI,IAAID,GAAG,EAAEA,GAAI,EAAEC,IAAID,GAAIA,GAAGC,GAAIA,CAAC,EAAiDC,EAAEN,EAAEO,qBAAqBC,EAAER,EAAES,OAAOC,EAAEV,EAAEW,UAAUC,EAAEZ,EAAEa,QAAQC,EAAEd,EAAEe,cACrNxB,EAAQyB,iCAAiC,SAASZ,EAAEC,EAAEY,EAAEC,EAAEC,GAAG,IAAIC,EAAEZ,EAAE,MAAM,GAAG,OAAOY,EAAEC,QAAQ,CAAC,IAAIC,EAAE,CAACC,UAAS,EAAGC,MAAM,MAAMJ,EAAEC,QAAQC,CAAC,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mB,IACnB,iFAAAC,eAAe,IAEnB,aACI,+EAAA1C,aAAa,IACb,mFAAAoB,iBAAiB,IACjB,6EAAAI,WAAW,IACX,iFAAAD,eAAe,IAEf,0FAAAE,wBAAwB,IACxB,sFAAAC,oBAAoB,IAEpB,uGAAAC,qCAAqC,IACrC,mGAAAC,iCAAiC,IACjC,yFAAAT,uBAAuB","sources":["webpack://esp-js-react/webpack/universalModuleDefinition","webpack://esp-js-react/../../node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.production.min.js","webpack://esp-js-react/../../node_modules/use-sync-external-store/with-selector.js","webpack://esp-js-react/./src/connect.tsx","webpack://esp-js-react/./src/connectableComponent.tsx","webpack://esp-js-react/./src/espModelContextProvider.tsx","webpack://esp-js-react/./src/espRouterContextProvider.tsx","webpack://esp-js-react/./src/polimer/polimerModelBuilderExtentsions.ts","webpack://esp-js-react/./src/useSyncModelWithSelector.ts","webpack://esp-js-react/./src/viewBinder.tsx","webpack://esp-js-react/./src/viewBindingDecorator.ts","webpack://esp-js-react/external umd \"esp-js\"","webpack://esp-js-react/external umd \"esp-js-polimer\"","webpack://esp-js-react/external umd \"react\"","webpack://esp-js-react/webpack/bootstrap","webpack://esp-js-react/./src/index.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"esp-js\"), require(\"esp-js-polimer\"), require(\"react\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"esp-js\", \"esp-js-polimer\", \"react\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"esp-js-react\"] = factory(require(\"esp-js\"), require(\"esp-js-polimer\"), require(\"react\"));\n\telse\n\t\troot[\"esp-js-react\"] = factory(root[\"esp-js\"], root[\"esp-js-polimer\"], root[\"react\"]);\n})(self, (__WEBPACK_EXTERNAL_MODULE__152__, __WEBPACK_EXTERNAL_MODULE__43__, __WEBPACK_EXTERNAL_MODULE__155__) => {\nreturn ","/**\n * @license React\n * use-sync-external-store-with-selector.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var g=require(\"react\");function n(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var p=\"function\"===typeof Object.is?Object.is:n,q=g.useSyncExternalStore,r=g.useRef,t=g.useEffect,u=g.useMemo,v=g.useDebugValue;\nexports.useSyncExternalStoreWithSelector=function(a,b,e,l,h){var c=r(null);if(null===c.current){var f={hasValue:!1,value:null};c.current=f}else f=c.current;c=u(function(){function a(a){if(!c){c=!0;d=a;a=l(a);if(void 0!==h&&f.hasValue){var b=f.value;if(h(b,a))return k=b}return k=a}b=k;if(p(d,a))return b;var e=l(a);if(void 0!==h&&h(b,e))return b;d=a;return k=e}var c=!1,d,k,m=void 0===e?null:e;return[function(){return a(b())},null===m?void 0:function(){return a(m())}]},[b,e,l,h]);var d=q(a,c[0],c[1]);\nt(function(){f.hasValue=!0;f.value=d},[d]);v(d);return d};\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/use-sync-external-store-with-selector.production.min.js');\n} else {\n module.exports = require('./cjs/use-sync-external-store-with-selector.development.js');\n}\n","import * as React from 'react';\nimport {ConnectableComponent, ConnectableComponentProps, CreatePublishEventProps, MapModelToProps} from './connectableComponent';\n\nexport type ConnectableComponentFactory<TModel, TPublishEventProps, TModelMappedToProps = {}> = (view: React.ComponentType) => (props: ConnectableComponentProps<TModel, TPublishEventProps, TModelMappedToProps>) => React.JSX.Element;\n\n/**\n * @param mapModelToProps - maps the model to a different structure, that structure is sent as props to the view.\n * @param createPublishEventProps - creates functions to publish events, the structure is sent as props to the view.\n */\nexport const connect = function <TModel, TPublishEventProps, TModelMappedToProps = {}>(\n mapModelToProps?: MapModelToProps<TModel, TModelMappedToProps, TPublishEventProps>,\n createPublishEventProps?: CreatePublishEventProps<TPublishEventProps>\n): ConnectableComponentFactory<TModel, TPublishEventProps, TModelMappedToProps> {\n return function (view: React.ComponentType) {\n return function (props: ConnectableComponentProps<TModel, TPublishEventProps, TModelMappedToProps>) {\n const {modelId, viewContext, ...rest} = props;\n return <ConnectableComponent\n modelId={modelId}\n view={view}\n viewContext={viewContext}\n createPublishEventProps={createPublishEventProps}\n mapModelToProps={mapModelToProps}\n {...rest}\n />;\n };\n };\n};","import * as React from 'react';\nimport {useRouter} from './espRouterContextProvider';\nimport {useMemo} from 'react';\nimport {Router} from 'esp-js';\nimport {EspModelContextProvider, useGetModelId} from './espModelContextProvider';\nimport {createViewForModel} from './viewBindingDecorator';\nimport {syncModelWithSelectorOptions, useSyncModelWithSelector} from './useSyncModelWithSelector';\nimport {PolimerModel} from 'esp-js-polimer';\n\nexport type CreatePublishEventProps<TPublishEventProps> = (publishModelEvent: (eventType: string, event: any) => void) => TPublishEventProps;\n\nexport type MapModelToProps<TModel, TModelMappedToProps, TPublishEventProps = {}> = (model: TModel, publishEventProps: TPublishEventProps) => TModelMappedToProps;\n\nexport interface ConnectableComponentProps<TModel = {}, TPublishEventProps = {}, TModelMappedToProps = {}> {\n modelId?: string;\n viewContext?: string;\n view?: React.ComponentType;\n createPublishEventProps?: CreatePublishEventProps<TPublishEventProps>;\n mapModelToProps?: MapModelToProps<TModel, TModelMappedToProps, TPublishEventProps>;\n [key: string]: any; // ...rest props, including the result of mapPublish and mapPublish if 'connect' was used\n}\n\nexport interface ConnectableComponentChildProps<TModel = object> {\n modelId: string;\n model: TModel;\n router: Router;\n [key: string]: any; // ...rest props\n}\n\nconst getChildProps = <TModel, TModelMappedToProps, TPublishEventProps>(\n router: Router,\n modelId: string,\n restProps: object,\n initialModel: TModel,\n mapModelToProps: MapModelToProps<TModel, TModelMappedToProps, TPublishEventProps>,\n publishEventProps: TPublishEventProps\n): ConnectableComponentChildProps<TModel> => {\n const model = PolimerModel.isPolimerModel(initialModel)\n ? initialModel.getEspPolimerImmutableModel()\n : initialModel;\n let childProps = {\n modelId,\n router: router,\n ...restProps,\n ...publishEventProps,\n model\n };\n if (mapModelToProps) {\n childProps = {\n ...childProps,\n ...(mapModelToProps(model, publishEventProps) as TModelMappedToProps)\n };\n }\n return childProps;\n};\n\nexport const ConnectableComponent = <TModel = {}, TPublishEventProps = {}, TModelMappedToProps = {}>(\n {\n modelId,\n mapModelToProps,\n createPublishEventProps,\n view,\n viewContext,\n ...rest\n }: ConnectableComponentProps<TModel, TPublishEventProps, TModelMappedToProps>\n) => {\n const router = useRouter();\n // Note: we always need to render the hooks else react will complain about a different count.\n let modelIdFromContext = useGetModelId();\n modelId = modelId || modelIdFromContext;\n const publishEventProps: TPublishEventProps = useMemo(\n () => {\n if (createPublishEventProps) {\n const publishModelEvent = (eventType: string, event: any) => {\n router.publishEvent(modelId, eventType, event);\n };\n return createPublishEventProps(publishModelEvent);\n }\n return {} as TPublishEventProps;\n },\n [router, modelId]\n );\n const model = useSyncModelWithSelector<TModel, TModel>(\n m => m,\n syncModelWithSelectorOptions()\n .setModelId(modelId)\n .setTryPreSelectPolimerImmutableModel(false)\n );\n if (model == null) {\n return null;\n }\n let childProps = getChildProps(router, modelId, rest, model, mapModelToProps, publishEventProps);\n let viewElement = createViewForModel(model, childProps, viewContext, view);\n return (\n <EspModelContextProvider modelId={modelId} model={model} router={router} {...childProps}>\n {viewElement}\n </EspModelContextProvider>\n );\n};","import * as React from 'react';\nimport {DefaultModelAddress, Router} from 'esp-js';\nimport {useContext, useCallback, createContext, PropsWithChildren} from 'react';\nimport {useRouter} from './espRouterContextProvider';\n\nexport const GetModelIdContext = createContext<string>(null);\n/**\n * Returns a function to get the ID of the model connected at a higher point in the V-DOM.\n *\n * To use this, please ensure your V-DOM has the EspModelContextProvider at a higher node.\n */\nexport const useGetModelId = () => useContext(GetModelIdContext);\n\nexport const GetModelContext = createContext<object>(null);\n/**\n * Returns a function which will return the model connected at a higher point in the V-DOM.\n *\n * To use this, please ensure your V-DOM has the EspModelContextProvider at a higher node.\n */\nexport const useGetModel = <TModel,>() => useContext(GetModelContext) as TModel;\n\nexport type PublishModelEventDelegate = { (eventType: string, event: any): void; (eventData: {eventType: string, event: any}): void; };\nconst createPublishModelEvent = (router: Router, modelId: string) => {\n function publishModelEvent(eventType: string, event: any): void;\n function publishModelEvent(eventData: {eventType: string, event: any}): void;\n function publishModelEvent(...args: any[]) {\n if (args.length === 1) {\n router.publishEvent(modelId, args[0].eventType, args[0].event);\n } else {\n router.publishEvent(modelId, args[0], args[1]);\n }\n }\n return publishModelEvent;\n};\nexport const PublishModelEventContext = createContext<PublishModelEventDelegate>(null);\n\n/**\n * Returns a function which can be used to publish an event to the model connected at a higher point in the V-DOM.\n *\n * Effectively, this is a version of usePublishEvent() which closes over the relevant modelId.\n *\n * To use this, please ensure your V-DOM has the EspModelContextProvider at a higher node.\n */\nexport const usePublishModelEvent = () => useContext(PublishModelEventContext);\n\nexport type PublishModelEventWithEntityKeyDelegate = {(entityKey: string, eventType: string, event: any): void; (eventData: {entityKey: string, eventType: string, event: any}): void; };\nconst createPublishModelEventWithEntityKey = (router: Router, modelId: string) => {\n function publishModelEventWithEntityKey(entityKey: string, eventType: string, event: any): void;\n function publishModelEventWithEntityKey(eventData: {entityKey: string, eventType: string, event: any}): void;\n function publishModelEventWithEntityKey(...args: any[]) {\n if (args.length === 1) {\n router.publishEvent(new DefaultModelAddress(modelId, args[0].entityKey), args[0].eventType, args[0].event);\n } else {\n router.publishEvent(new DefaultModelAddress(modelId, args[0]), args[1], args[2]);\n }\n }\n return publishModelEventWithEntityKey;\n};\nexport const PublishModelEventWithEntityKeyContext = createContext<PublishModelEventWithEntityKeyDelegate>(null);\n/**\n * Returns a function which can be used to publish an event to the model connected at a higher point in the V-DOM, allows an entityKey to be specified.\n *\n * Effectively, this is a version of usePublishEvent() which closes over the modelId.\n *\n * To use this, please ensure your V-DOM has the EspModelContextProvider at a higher node.\n */\nexport const usePublishModelEventWithEntityKey = () => useContext(PublishModelEventWithEntityKeyContext);\n\nexport interface EspModelContextProviderProps {\n modelId: string;\n model?: any;\n}\n\n/**\n * Sets up various ESP context so ESP hooks are available below this point in the V-DOM\n *\n * To use this, please ensure your V-DOM has the EspRouterContextProvider at a higher node.\n * @param modelId\n * @param children\n * @param model\n * @constructor\n */\nexport const EspModelContextProvider = ({modelId, children, model}: PropsWithChildren<EspModelContextProviderProps>) => {\n const router = useRouter();\n // modelId may have been set by a higher level version of this component, so we try and get it from context if it's not set by props.\n let modelIdFromContext = useGetModelId();\n modelId = modelId || modelIdFromContext;\n const publishModelEvent: PublishModelEventDelegate = useCallback(createPublishModelEvent(router, modelId), [router, modelId]);\n const publishModelEventWithEntityKey: PublishModelEventWithEntityKeyDelegate = useCallback(createPublishModelEventWithEntityKey(router, modelId), [router, modelId]);\n return (\n <GetModelIdContext.Provider value={modelId}>\n <PublishModelEventContext.Provider value={publishModelEvent}>\n <PublishModelEventWithEntityKeyContext.Provider value={publishModelEventWithEntityKey}>\n <GetModelContext.Provider value={model}>\n {children}\n </GetModelContext.Provider>\n </PublishModelEventWithEntityKeyContext.Provider>\n </PublishModelEventContext.Provider>\n </GetModelIdContext.Provider>\n );\n};","// notice_start\n/*\n * Copyright 2015 Dev Shop Limited\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// notice_end\n\nimport * as React from 'react';\nimport {ModelAddress, Router} from 'esp-js';\nimport {PropsWithChildren, createContext, useContext, useCallback} from 'react';\n\nexport const RouterContext = createContext<Router>(null);\n\n/**\n * Get the esp Router from context.\n *\n * To use this, please ensure your V-DOM has the EspRouterContextProvider at a higher node:\n *\n * <EspRouterContextProvider router={router}>\n * <YourComponents />\n * </EspRouterContextProvider>\n */\nexport const useRouter = () => {\n return useContext(RouterContext);\n};\n\nexport type PublishEventDelegate = {(modelIdOrModelAddress: string | ModelAddress, eventType: string, event: any): void; (eventData: { address: string | ModelAddress, eventType: string, event: any }): void; };\nconst createPublishEvent = (router: Router) => {\n function publishEvent(modelIdOrModelAddress: string | ModelAddress, eventType: string, event: any): void;\n function publishEvent(eventData: { address: string | ModelAddress, eventType: string, event: any }): void;\n function publishEvent(...args: any[]): void {\n if (args.length === 1) {\n router.publishEvent(args[0].address, args[0].eventType, args[0].event);\n } else {\n router.publishEvent(args[0], args[1], args[2]);\n }\n }\n return publishEvent;\n};\nexport const PublishEventContext = createContext<PublishEventDelegate>(null);\n\n/**\n * Returns a function which can be used to publish an event.\n *\n * To use this, please ensure your V-DOM has the EspRouterContextProvider at a higher node:\n *\n * <EspRouterContextProvider router={router}>\n * <YourComponents />\n * </EspRouterContextProvider>\n */\nexport const usePublishEvent = () => useContext(PublishEventContext);\n\nexport type EspRouterContextProviderProps = PropsWithChildren<{ router: Router; }>;\n\n/**\n * Used to set the router on the RouterContext making it available to components down the tree via the useRouter() hook.\n *\n * Also sets up the usePublishEvent() hook so nested components can publish to the router.\n */\nexport const EspRouterContextProvider = ({children, router}: EspRouterContextProviderProps) => {\n // Router may have been set by a higher level version of this component, so we try and get it from context if it's not set by props.\n let routerFromContext = useRouter();\n router = router || routerFromContext;\n const publishEvent: PublishEventDelegate = useCallback(createPublishEvent(router), [router]);\n return (\n <RouterContext.Provider value={router}>\n <PublishEventContext.Provider value={publishEvent}>\n {children}\n </PublishEventContext.Provider>\n </RouterContext.Provider>\n );\n};\n\n/**\n * Used to set the router on the RouterContext making it available to components down the tree (via useRouter()).\n *\n * @deprecated use EspRouterContextProvider\n */\nexport const RouterProvider = EspRouterContextProvider;\n\n/**\n * Props for RouterProvider\n *\n * @deprecated use EspRouterContextProviderProps\n */\nexport type RouterProviderProps = EspRouterContextProviderProps;\n","import {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 {Logger, Router, utils} from 'esp-js';\nimport {useRouter} from './espRouterContextProvider';\nimport {useGetModelId} from './espModelContextProvider';\nimport {PolimerModel} from 'esp-js-polimer';\n\nexport type SyncModelWithSelectorEqualityFn<T> = (last: T, next: T) => boolean;\n\nexport const logger = Logger.create('useSyncModelWithSelector');\n\n/**\n * Options affecting the subscription of the model to the Router.\n *\n * Use syncModelWithSelectorOptions() to create an instance of this type with sensible defaults.\n *\n * @param modelId - the modelId of the model to be observed via the esp Router.\n * @param tryPreSelectPolimerImmutableModel - if true, and the esp model is an esp-js-polimer model, the immutable model will be used when calling the selector.\n * @param equalityFn - Equality function which will be applied against TSelected, defaults to instance equality (a === b).\n */\nexport type SyncModelWithSelectorOptions<TSelected> = {\n modelId?: string,\n tryPreSelectPolimerImmutableModel: boolean,\n equalityFn: SyncModelWithSelectorEqualityFn<TSelected>\n};\n\n/**\n * Convenience API to build SyncModelWithSelectorOptions<TSelected>, has sensible defaulting.\n */\nexport interface SyncModelWithSelectorOptionsBuilder<TSelected> extends SyncModelWithSelectorOptions<TSelected> {\n /**\n * Sets the model ID\n * @param modelId - default if unset: undefined\n */\n setModelId(modelId: string): this;\n\n /**\n * If the model is a PolimerModel and this set true, PolimerModel.getImmutableModel() will be selected by default.\n * @param value - default if unset: true\n */\n setTryPreSelectPolimerImmutableModel(value: boolean): this;\n\n /**\n * Equality function used when comparing the last TSelected with the next.\n * @param fn - default if unset: obj instance equality (e.g. a===b)\n */\n setEqualityFn(fn: (a: TSelected, b: TSelected) => boolean): this;\n}\n\n/**\n * Convenience API to create SyncModelWithSelectorOptions\n */\nexport const syncModelWithSelectorOptions = <TSelected>() => {\n let modelId = undefined;\n let equalityFn: SyncModelWithSelectorEqualityFn<TSelected> = (a: TSelected, b: TSelected) => a === b;\n let tryPreSelectPolimerImmutableModel = true;\n return {\n get modelId() {\n return modelId;\n },\n setModelId(value: string) {\n modelId = value;\n return this;\n },\n get equalityFn() {\n return equalityFn;\n },\n setEqualityFn(value: SyncModelWithSelectorEqualityFn<TSelected>) {\n equalityFn = value;\n return this;\n },\n get tryPreSelectPolimerImmutableModel() {\n return tryPreSelectPolimerImmutableModel;\n },\n setTryPreSelectPolimerImmutableModel(value: boolean) {\n tryPreSelectPolimerImmutableModel = value;\n return this;\n }\n } as SyncModelWithSelectorOptionsBuilder<TSelected>;\n};\n\nconst checkArguments = (selector: (model: any) => any, options: SyncModelWithSelectorOptions<any> ) => {\n if (!utils.isFunction(selector)) {\n throw new Error('You must pass a selector function to useSyncModelWithSelector');\n }\n if (!utils.isObject(options)) {\n throw new Error('You must provide options when using useSyncModelWithSelector');\n }\n if (!utils.isFunction(options.equalityFn)) {\n throw new Error('You must provide an equalityFn when using useSyncModelWithSelector');\n }\n};\n\n/**\n * A hook which returns model state from the esp Router.\n *\n * This hooks wih observe updates and re-render the component if the model changes.\n *\n * To use this, please ensure your V-DOM has the EspRouterContextProvider at a higher node, and optionally EspModelContextProvider.\n *\n * @param selector - a function to select a selection of the model - the selector does not need to be memoized, this selector will be cached against the modelId.\n * @param options\n */\nexport const useSyncModelWithSelector = <TModel, TSelected>(\n selector: (model: TModel) => TSelected,\n options: SyncModelWithSelectorOptions<TSelected> = syncModelWithSelectorOptions<TSelected>()\n): TSelected => {\n checkArguments(selector, options);\n const router = useRouter();\n const modelIdFromContext = useGetModelId();\n const modelId = options?.modelId || modelIdFromContext;\n const tryPreSelectPolimerImmutableModel = options?.tryPreSelectPolimerImmutableModel;\n const equalityFn = options?.equalityFn;\n const dependencies = useMemo(\n () => {\n const canSubscribe = router && utils.isString(modelId) && router.isModelRegistered(modelId);\n if (canSubscribe) {\n return createSubscriptionState(router, modelId, selector, tryPreSelectPolimerImmutableModel);\n }\n return createNoopSubscriptionState();\n },\n // Don't add 'selector' to the dependency list as that will likely change unless the caller memoizes it.\n [router, modelId]\n );\n\n // Docs on useSyncExternalStore https://github.com/reactwg/react-18/discussions/86\n // Redux's usage of this: https://github.com/reduxjs/react-redux/blob/master/src/hooks/useSelector.ts\n // Code: https://github.com/facebook/react/blob/main/packages/use-sync-external-store/src/useSyncExternalStoreWithSelector.js\n return useSyncExternalStoreWithSelector(\n dependencies.subscribe,\n dependencies.getSnapshot,\n undefined,\n dependencies.wrappedSelector,\n equalityFn,\n );\n};\n\nconst createSubscriptionState = <TModel, TSelected>(\n router: Router,\n modelId: string,\n selector: (model: TModel) => TSelected,\n tryPreSelectPolimerImmutableModel: boolean\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,\n // React calls that when it deems it needs to.\n // Given that, we need to cache the state which getSnapshot will return.\n //\n // Another edge case with useSyncExternalStore:\n // It will call getSnapshot before it calls subscribe, to account for this we need to fetch the model first.\n let currentModel: TModel;\n let onStateChanged: () => void = null;\n const modelSubscriptionDisposable = router\n .getModelObservable<TModel>(modelId)\n .subscribe(\n (m: any) => {\n // try and get the esp-js-polimer immutable model if possible, this should mutate when any state changes\n const nextModel = tryPreSelectPolimerImmutableModel && PolimerModel.isPolimerModel(m)\n ? m.getEspPolimerImmutableModel()\n // If the above didn't manage to get a polimer model,\n // we need to mutate to force useSyncExternalStoreWithSelector to pick up the change.\n // This should only affect older style OO models.\n : Object.create(m);\n warnIfModelInstanceHasNotChanged(modelId, currentModel, nextModel);\n currentModel = nextModel;\n if (onStateChanged) {\n onStateChanged();\n }\n }\n );\n return {\n subscribe: (stateChanged: () => void) => {\n onStateChanged = stateChanged;\n return () => {\n onStateChanged = null;\n currentModel = 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 currentModel;\n },\n // While getSnapshot needs to model to be immutable,\n // useSyncExternalStoreWithSelector builds on top of this, so the TSelected can defer to an equality check to determine if the change is propagated.\n // The selector here just maps the TSelected, useSyncExternalStoreWithSelector internally does the equality check.\n wrappedSelector: (snapshot: TModel) => {\n return snapshot\n ? selector(snapshot)\n : null;\n }\n };\n};\n\nconst createNoopSubscriptionState = () => ({\n subscribe: () => {\n return () => {};\n },\n getSnapshot: () => null,\n wrappedSelector: () => null\n});\n\nconst warnIfModelInstanceHasNotChanged = (modelId: string, lastModel: any, nextModel: string) => {\n if (process.env.NODE_ENV === 'production') {\n return;\n }\n if (utils.stringIsEmpty(modelId)) {\n return;\n }\n if (lastModel === nextModel) {\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 logger.warn(\n `useSyncModelWithSelector had detected the latest model update hasn't mutated. This will cause odd render bugs. modelId: ${modelId}`,\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 {createViewForModel} from './viewBindingDecorator';\nimport {useRouter} from './espRouterContextProvider';\n\nexport interface ViewBinderProps {\n model: any;\n viewContext?: string;\n /**\n * ...rest props, these will be passed to the child\n */\n [key: string]: any;\n}\n\n/**\n * Takes a model with a @viewBinding decorator and dynamically crates the view specified by the decorator\n */\nexport const ViewBinder: React.FC<ViewBinderProps> = ({model, viewContext, ...rest}) => {\n if (model) {\n const router = useRouter();\n const newProps = {\n model,\n router,\n ...rest\n };\n return createViewForModel(\n model,\n newProps,\n viewContext,\n null\n );\n }\n return null;\n};","// notice_start\n/*\n * Copyright 2015 Dev Shop Limited\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// notice_end\n\nimport * as React from 'react';\nimport {Guard} from 'esp-js';\n\nexport const DEFAULT_VIEW_KEY = 'default-view-key';\n\nfunction getMetadata(target) {\n if (!target._viewMetadata) {\n target._viewMetadata = new ViewMetadata();\n }\n return target._viewMetadata;\n}\n\n/**\n * Tries to get a view for the given model.\n *\n * It does this using the following order:\n * 1) If a @viewBinding decorator was used and a display context was given, try get a view for that\n * 2) Else if a view was explicitly provided use that\n * 3) Else if a @viewBinding decorator was used and there is a view associated with the default display context, use that view\n * @param model\n * @param props\n * @param displayContext\n * @param view\n */\nexport function createViewForModel(model: any, props: object, displayContext: string, view: React.ComponentType) {\n let finalView: React.ComponentType = view; // default to that passed in, if any.\n\n // displayContext = displayContext || DEFAULT_VIEW_KEY;\n // the view decorator isn't on the instance, it's on the constructor function that created that instance\n if (model) {\n let constructorFunction = model.constructor;\n if (constructorFunction._viewMetadata) {\n let viewMetadata = constructorFunction._viewMetadata;\n if (displayContext && viewMetadata.hasRegisteredViewContext(displayContext)) {\n let viewMetadataRegistration = viewMetadata.viewRegistrations[displayContext];\n // we've found a view for the display context, use that\n finalView = viewMetadataRegistration.view;\n }\n\n // if we've not found a view yet, and one wasn't provided, is there a default one?\n if (!finalView && viewMetadata.hasRegisteredViewContext(DEFAULT_VIEW_KEY)) {\n let viewMetadataRegistration = viewMetadata.viewRegistrations[DEFAULT_VIEW_KEY];\n finalView = viewMetadataRegistration.view;\n }\n }\n }\n if (!finalView) {\n throw new Error(`No suitable view found for model id '${model.modelId}' using context '${displayContext}'`);\n }\n return React.createElement(finalView, props);\n}\n\n/**\n * An ES7 style decorator that associates a model with a view\n * @param view the react component that will be used to display this model\n * @param displayContext an optional context allowing for different views to display the same model\n * @returns {Function}\n */\nexport function viewBinding(view: any, displayContext: string = DEFAULT_VIEW_KEY) {\n Guard.isDefined(view, 'view must be defined');\n Guard.isString(displayContext, 'displayContext must be a string');\n return function (target: any) {\n let viewMetadata = getMetadata(target);\n if (viewMetadata.hasRegisteredViewContext(displayContext)) {\n throw new Error(`Context ${displayContext} already registered for view`);\n }\n viewMetadata.viewRegistrations[displayContext] = new ViewMetadataRegistration(view, displayContext);\n };\n}\n\nexport class ViewMetadata {\n private _viewRegistrations = {};\n\n get viewRegistrations() {\n return this._viewRegistrations;\n }\n\n hasRegisteredViewContext(displayContext) {\n return typeof this._viewRegistrations[displayContext] !== 'undefined';\n }\n}\n\nexport class ViewMetadataRegistration {\n\n constructor(private _view, private _displayContext) {\n }\n\n get view() {\n return this._view;\n }\n\n get displayContext() {\n return this._displayContext;\n }\n}","module.exports = __WEBPACK_EXTERNAL_MODULE__152__;","module.exports = __WEBPACK_EXTERNAL_MODULE__43__;","module.exports = __WEBPACK_EXTERNAL_MODULE__155__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// notice_start\n/*\n * Copyright 2015 Dev Shop Limited\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// notice_end\n//\n\n// import for side effects\nimport './polimer/polimerModelBuilderExtentsions';\n\nexport {ViewBinder} from './viewBinder';\nexport {viewBinding, DEFAULT_VIEW_KEY} from './viewBindingDecorator';\nexport {createViewForModel} from './viewBindingDecorator';\nexport {\n connect,\n ConnectableComponentFactory\n} from './connect';\nexport {\n CreatePublishEventProps,\n MapModelToProps,\n ConnectableComponentProps,\n ConnectableComponentChildProps,\n ConnectableComponent,\n} from './connectableComponent';\nexport {\n useSyncModelWithSelector,\n SyncModelWithSelectorOptionsBuilder,\n syncModelWithSelectorOptions,\n SyncModelWithSelectorOptions,\n SyncModelWithSelectorEqualityFn,\n} from './useSyncModelWithSelector';\nexport {\n RouterProvider,\n RouterProviderProps,\n EspRouterContextProvider,\n EspRouterContextProviderProps,\n RouterContext,\n useRouter,\n PublishEventDelegate,\n PublishEventContext,\n usePublishEvent,\n} from './espRouterContextProvider';\nexport {\n useGetModelId,\n GetModelIdContext,\n useGetModel,\n GetModelContext,\n PublishModelEventDelegate,\n PublishModelEventContext,\n usePublishModelEvent,\n PublishModelEventWithEntityKeyDelegate,\n PublishModelEventWithEntityKeyContext,\n usePublishModelEventWithEntityKey,\n EspModelContextProvider,\n EspModelContextProviderProps,\n} from './espModelContextProvider';"],"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","modelIdFromContext","useGetModelId","publishEventProps","eventType","event","publishEvent","model","useSyncModelWithSelector","syncModelWithSelectorOptions","setModelId","setTryPreSelectPolimerImmutableModel","childProps","restProps","initialModel","PolimerModel","isPolimerModel","getEspPolimerImmutableModel","getChildProps","viewElement","createViewForModel","EspModelContextProvider","GetModelIdContext","createContext","useContext","GetModelContext","useGetModel","PublishModelEventContext","usePublishModelEvent","PublishModelEventWithEntityKeyContext","usePublishModelEventWithEntityKey","children","publishModelEvent","useCallback","args","length","createPublishModelEvent","publishModelEventWithEntityKey","DefaultModelAddress","entityKey","createPublishModelEventWithEntityKey","Provider","RouterContext","PublishEventContext","usePublishEvent","EspRouterContextProvider","routerFromContext","address","createPublishEvent","RouterProvider","PolimerModelBuilder","prototype","withViewBindings","displayContext","DEFAULT_VIEW_KEY","viewMappings","this","_viewMappings","registerWithRouter","call","keys","forEach","viewBinding","constructor","logger","Logger","create","equalityFn","tryPreSelectPolimerImmutableModel","setEqualityFn","selector","options","utils","isFunction","Error","isObject","checkArguments","dependencies","isString","isModelRegistered","createSubscriptionState","createNoopSubscriptionState","subscribe","getSnapshot","undefined","wrappedSelector","currentModel","onStateChanged","modelSubscriptionDisposable","getModelObservable","nextModel","warnIfModelInstanceHasNotChanged","stateChanged","dispose","snapshot","lastModel","ViewBinder","newProps","finalView","constructorFunction","_viewMetadata","viewMetadata","hasRegisteredViewContext","viewRegistrations","React","createElement","Guard","isDefined","target","ViewMetadata","getMetadata","ViewMetadataRegistration","_viewRegistrations","_view","_displayContext","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"esp-react.min.js","sources":["../../../node_modules/react/jsx-runtime.js","../../../node_modules/react/cjs/react-jsx-runtime.production.js","../../../node_modules/react/cjs/react-jsx-runtime.development.js","../src/espEventBusContextProvider.tsx","../src/espStoreContextProvider.tsx","../../../node_modules/use-sync-external-store/with-selector.js","../../../node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.production.js","../../../node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.development.js","../src/useSyncModelWithSelector.ts","../src/connectableComponent.tsx","../src/espModulesContext.ts","../src/espApp.tsx","../src/regionView.tsx"],"sourcesContent":["'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-jsx-runtime.production.js');\n} else {\n module.exports = require('./cjs/react-jsx-runtime.development.js');\n}\n","/**\n * @license React\n * react-jsx-runtime.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and 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\n\"use strict\";\nvar REACT_ELEMENT_TYPE = Symbol.for(\"react.transitional.element\"),\n REACT_FRAGMENT_TYPE = Symbol.for(\"react.fragment\");\nfunction jsxProd(type, config, maybeKey) {\n var key = null;\n void 0 !== maybeKey && (key = \"\" + maybeKey);\n void 0 !== config.key && (key = \"\" + config.key);\n if (\"key\" in config) {\n maybeKey = {};\n for (var propName in config)\n \"key\" !== propName && (maybeKey[propName] = config[propName]);\n } else maybeKey = config;\n config = maybeKey.ref;\n return {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key,\n ref: void 0 !== config ? config : null,\n props: maybeKey\n };\n}\nexports.Fragment = REACT_FRAGMENT_TYPE;\nexports.jsx = jsxProd;\nexports.jsxs = jsxProd;\n","/**\n * @license React\n * react-jsx-runtime.development.js\n *\n * Copyright (c) Meta Platforms, Inc. and 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\n\"use strict\";\n\"production\" !== process.env.NODE_ENV &&\n (function () {\n function getComponentNameFromType(type) {\n if (null == type) return null;\n if (\"function\" === typeof type)\n return type.$$typeof === REACT_CLIENT_REFERENCE\n ? null\n : type.displayName || type.name || null;\n if (\"string\" === typeof type) return type;\n switch (type) {\n case REACT_FRAGMENT_TYPE:\n return \"Fragment\";\n case REACT_PROFILER_TYPE:\n return \"Profiler\";\n case REACT_STRICT_MODE_TYPE:\n return \"StrictMode\";\n case REACT_SUSPENSE_TYPE:\n return \"Suspense\";\n case REACT_SUSPENSE_LIST_TYPE:\n return \"SuspenseList\";\n case REACT_ACTIVITY_TYPE:\n return \"Activity\";\n }\n if (\"object\" === typeof type)\n switch (\n (\"number\" === typeof type.tag &&\n console.error(\n \"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.\"\n ),\n type.$$typeof)\n ) {\n case REACT_PORTAL_TYPE:\n return \"Portal\";\n case REACT_CONTEXT_TYPE:\n return type.displayName || \"Context\";\n case REACT_CONSUMER_TYPE:\n return (type._context.displayName || \"Context\") + \".Consumer\";\n case REACT_FORWARD_REF_TYPE:\n var innerType = type.render;\n type = type.displayName;\n type ||\n ((type = innerType.displayName || innerType.name || \"\"),\n (type = \"\" !== type ? \"ForwardRef(\" + type + \")\" : \"ForwardRef\"));\n return type;\n case REACT_MEMO_TYPE:\n return (\n (innerType = type.displayName || null),\n null !== innerType\n ? innerType\n : getComponentNameFromType(type.type) || \"Memo\"\n );\n case REACT_LAZY_TYPE:\n innerType = type._payload;\n type = type._init;\n try {\n return getComponentNameFromType(type(innerType));\n } catch (x) {}\n }\n return null;\n }\n function testStringCoercion(value) {\n return \"\" + value;\n }\n function checkKeyStringCoercion(value) {\n try {\n testStringCoercion(value);\n var JSCompiler_inline_result = !1;\n } catch (e) {\n JSCompiler_inline_result = !0;\n }\n if (JSCompiler_inline_result) {\n JSCompiler_inline_result = console;\n var JSCompiler_temp_const = JSCompiler_inline_result.error;\n var JSCompiler_inline_result$jscomp$0 =\n (\"function\" === typeof Symbol &&\n Symbol.toStringTag &&\n value[Symbol.toStringTag]) ||\n value.constructor.name ||\n \"Object\";\n JSCompiler_temp_const.call(\n JSCompiler_inline_result,\n \"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.\",\n JSCompiler_inline_result$jscomp$0\n );\n return testStringCoercion(value);\n }\n }\n function getTaskName(type) {\n if (type === REACT_FRAGMENT_TYPE) return \"<>\";\n if (\n \"object\" === typeof type &&\n null !== type &&\n type.$$typeof === REACT_LAZY_TYPE\n )\n return \"<...>\";\n try {\n var name = getComponentNameFromType(type);\n return name ? \"<\" + name + \">\" : \"<...>\";\n } catch (x) {\n return \"<...>\";\n }\n }\n function getOwner() {\n var dispatcher = ReactSharedInternals.A;\n return null === dispatcher ? null : dispatcher.getOwner();\n }\n function UnknownOwner() {\n return Error(\"react-stack-top-frame\");\n }\n function hasValidKey(config) {\n if (hasOwnProperty.call(config, \"key\")) {\n var getter = Object.getOwnPropertyDescriptor(config, \"key\").get;\n if (getter && getter.isReactWarning) return !1;\n }\n return void 0 !== config.key;\n }\n function defineKeyPropWarningGetter(props, displayName) {\n function warnAboutAccessingKey() {\n specialPropKeyWarningShown ||\n ((specialPropKeyWarningShown = !0),\n console.error(\n \"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)\",\n displayName\n ));\n }\n warnAboutAccessingKey.isReactWarning = !0;\n Object.defineProperty(props, \"key\", {\n get: warnAboutAccessingKey,\n configurable: !0\n });\n }\n function elementRefGetterWithDeprecationWarning() {\n var componentName = getComponentNameFromType(this.type);\n didWarnAboutElementRef[componentName] ||\n ((didWarnAboutElementRef[componentName] = !0),\n console.error(\n \"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.\"\n ));\n componentName = this.props.ref;\n return void 0 !== componentName ? componentName : null;\n }\n function ReactElement(type, key, props, owner, debugStack, debugTask) {\n var refProp = props.ref;\n type = {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key,\n props: props,\n _owner: owner\n };\n null !== (void 0 !== refProp ? refProp : null)\n ? Object.defineProperty(type, \"ref\", {\n enumerable: !1,\n get: elementRefGetterWithDeprecationWarning\n })\n : Object.defineProperty(type, \"ref\", { enumerable: !1, value: null });\n type._store = {};\n Object.defineProperty(type._store, \"validated\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: 0\n });\n Object.defineProperty(type, \"_debugInfo\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: null\n });\n Object.defineProperty(type, \"_debugStack\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: debugStack\n });\n Object.defineProperty(type, \"_debugTask\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: debugTask\n });\n Object.freeze && (Object.freeze(type.props), Object.freeze(type));\n return type;\n }\n function jsxDEVImpl(\n type,\n config,\n maybeKey,\n isStaticChildren,\n debugStack,\n debugTask\n ) {\n var children = config.children;\n if (void 0 !== children)\n if (isStaticChildren)\n if (isArrayImpl(children)) {\n for (\n isStaticChildren = 0;\n isStaticChildren < children.length;\n isStaticChildren++\n )\n validateChildKeys(children[isStaticChildren]);\n Object.freeze && Object.freeze(children);\n } else\n console.error(\n \"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.\"\n );\n else validateChildKeys(children);\n if (hasOwnProperty.call(config, \"key\")) {\n children = getComponentNameFromType(type);\n var keys = Object.keys(config).filter(function (k) {\n return \"key\" !== k;\n });\n isStaticChildren =\n 0 < keys.length\n ? \"{key: someKey, \" + keys.join(\": ..., \") + \": ...}\"\n : \"{key: someKey}\";\n didWarnAboutKeySpread[children + isStaticChildren] ||\n ((keys =\n 0 < keys.length ? \"{\" + keys.join(\": ..., \") + \": ...}\" : \"{}\"),\n console.error(\n 'A props object containing a \"key\" prop is being spread into JSX:\\n let props = %s;\\n <%s {...props} />\\nReact keys must be passed directly to JSX without using spread:\\n let props = %s;\\n <%s key={someKey} {...props} />',\n isStaticChildren,\n children,\n keys,\n children\n ),\n (didWarnAboutKeySpread[children + isStaticChildren] = !0));\n }\n children = null;\n void 0 !== maybeKey &&\n (checkKeyStringCoercion(maybeKey), (children = \"\" + maybeKey));\n hasValidKey(config) &&\n (checkKeyStringCoercion(config.key), (children = \"\" + config.key));\n if (\"key\" in config) {\n maybeKey = {};\n for (var propName in config)\n \"key\" !== propName && (maybeKey[propName] = config[propName]);\n } else maybeKey = config;\n children &&\n defineKeyPropWarningGetter(\n maybeKey,\n \"function\" === typeof type\n ? type.displayName || type.name || \"Unknown\"\n : type\n );\n return ReactElement(\n type,\n children,\n maybeKey,\n getOwner(),\n debugStack,\n debugTask\n );\n }\n function validateChildKeys(node) {\n isValidElement(node)\n ? node._store && (node._store.validated = 1)\n : \"object\" === typeof node &&\n null !== node &&\n node.$$typeof === REACT_LAZY_TYPE &&\n (\"fulfilled\" === node._payload.status\n ? isValidElement(node._payload.value) &&\n node._payload.value._store &&\n (node._payload.value._store.validated = 1)\n : node._store && (node._store.validated = 1));\n }\n function isValidElement(object) {\n return (\n \"object\" === typeof object &&\n null !== object &&\n object.$$typeof === REACT_ELEMENT_TYPE\n );\n }\n var React = require(\"react\"),\n REACT_ELEMENT_TYPE = Symbol.for(\"react.transitional.element\"),\n REACT_PORTAL_TYPE = Symbol.for(\"react.portal\"),\n REACT_FRAGMENT_TYPE = Symbol.for(\"react.fragment\"),\n REACT_STRICT_MODE_TYPE = Symbol.for(\"react.strict_mode\"),\n REACT_PROFILER_TYPE = Symbol.for(\"react.profiler\"),\n REACT_CONSUMER_TYPE = Symbol.for(\"react.consumer\"),\n REACT_CONTEXT_TYPE = Symbol.for(\"react.context\"),\n REACT_FORWARD_REF_TYPE = Symbol.for(\"react.forward_ref\"),\n REACT_SUSPENSE_TYPE = Symbol.for(\"react.suspense\"),\n REACT_SUSPENSE_LIST_TYPE = Symbol.for(\"react.suspense_list\"),\n REACT_MEMO_TYPE = Symbol.for(\"react.memo\"),\n REACT_LAZY_TYPE = Symbol.for(\"react.lazy\"),\n REACT_ACTIVITY_TYPE = Symbol.for(\"react.activity\"),\n REACT_CLIENT_REFERENCE = Symbol.for(\"react.client.reference\"),\n ReactSharedInternals =\n React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,\n hasOwnProperty = Object.prototype.hasOwnProperty,\n isArrayImpl = Array.isArray,\n createTask = console.createTask\n ? console.createTask\n : function () {\n return null;\n };\n React = {\n react_stack_bottom_frame: function (callStackForError) {\n return callStackForError();\n }\n };\n var specialPropKeyWarningShown;\n var didWarnAboutElementRef = {};\n var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(\n React,\n UnknownOwner\n )();\n var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));\n var didWarnAboutKeySpread = {};\n exports.Fragment = REACT_FRAGMENT_TYPE;\n exports.jsx = function (type, config, maybeKey) {\n var trackActualOwner =\n 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;\n return jsxDEVImpl(\n type,\n config,\n maybeKey,\n !1,\n trackActualOwner\n ? Error(\"react-stack-top-frame\")\n : unknownOwnerDebugStack,\n trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask\n );\n };\n exports.jsxs = function (type, config, maybeKey) {\n var trackActualOwner =\n 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;\n return jsxDEVImpl(\n type,\n config,\n maybeKey,\n !0,\n trackActualOwner\n ? Error(\"react-stack-top-frame\")\n : unknownOwnerDebugStack,\n trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask\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 {StoreAddress, EventBus} from 'esp-js';\nimport {PropsWithChildren, createContext, useContext, useCallback} from 'react';\n\nexport const EventBusContext = createContext<EventBus>(null);\n\n/**\n * Get the esp EventBus from context.\n *\n * To use this, please ensure your V-DOM has the EspEventBusContextProvider at a higher node:\n *\n * <EspEventBusContextProvider bus={bus}>\n * <YourComponents />\n * </EspEventBusContextProvider>\n */\nexport const useEventBus = () => {\n return useContext(EventBusContext);\n};\n\nexport type PublishEventDelegate = {(storeIdOrStoreAddress: string | StoreAddress, eventType: string, event: any): void; (eventData: { address: string | StoreAddress, eventType: string, event: any }): void; };\nconst createPublishEvent = (bus: EventBus) => {\n function publishEvent(storeIdOrStoreAddress: string | StoreAddress, eventType: string, event: any): void;\n function publishEvent(eventData: { address: string | StoreAddress, eventType: string, event: any }): void;\n function publishEvent(...args: any[]): void {\n if (args.length === 1) {\n bus.publishEvent(args[0].address, args[0].eventType, args[0].event);\n } else {\n bus.publishEvent(args[0], args[1], args[2]);\n }\n }\n return publishEvent;\n};\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 EspEventBusContextProvider at a higher node:\n *\n * <EspEventBusContextProvider bus={bus}>\n * <YourComponents />\n * </EspEventBusContextProvider>\n */\nexport const usePublishEvent = () => useContext(PublishEventContext);\n\nexport type EspEventBusContextProviderProps = PropsWithChildren<{ bus: EventBus; }>;\n\n/**\n * Used to set the bus on the EventBusContext making it available to components down the tree via the useEventBus() hook.\n *\n * Also sets up the usePublishEvent() hook so nested components can publish to the bus.\n */\nexport const EspEventBusContextProvider = ({children, bus}: EspEventBusContextProviderProps) => {\n // EventBus may have been set by a higher level version of this component, so we try and get it from context if it's not set by props.\n let busFromContext = useEventBus();\n bus = bus || busFromContext;\n const publishEvent: PublishEventDelegate = useCallback(createPublishEvent(bus), [bus]);\n return (\n <EventBusContext.Provider value={bus}>\n <PublishEventContext.Provider value={publishEvent}>\n {children}\n </PublishEventContext.Provider>\n </EventBusContext.Provider>\n );\n};","import {DefaultStoreAddress, EventBus} from 'esp-js';\nimport {useContext, useCallback, createContext, PropsWithChildren} from 'react';\nimport {useEventBus} from './espEventBusContextProvider';\n\nexport const GetStoreIdContext = createContext<string>(null);\n/**\n * Returns a function to get the ID of the store connected at a higher point in the V-DOM.\n *\n * To use this, please ensure your V-DOM has the EspStoreContextProvider at a higher node.\n */\nexport const useGetStoreId = () => useContext(GetStoreIdContext);\n\nexport const GetStoreContext = createContext<object>(null);\n/**\n * Returns a function which will return the store connected at a higher point in the V-DOM.\n *\n * To use this, please ensure your V-DOM has the EspStoreContextProvider at a higher node.\n */\nexport const useGetStore = <TModel,>() => useContext(GetStoreContext) as TModel;\n\nexport type PublishStoreEventDelegate = { (eventType: string, event: any): void; (eventData: {eventType: string, event: any}): void; };\nconst createPublishStoreEvent = (bus: EventBus, storeId: string) => {\n function publishStoreEvent(eventType: string, event: any): void;\n function publishStoreEvent(eventData: {eventType: string, event: any}): void;\n function publishStoreEvent(...args: any[]) {\n if (args.length === 1) {\n bus.publishEvent(storeId, args[0].eventType, args[0].event);\n } else {\n bus.publishEvent(storeId, args[0], args[1]);\n }\n }\n return publishStoreEvent;\n};\nexport const PublishStoreEventContext = createContext<PublishStoreEventDelegate>(null);\n\n/**\n * Returns a function which can be used to publish an event to the store connected at a higher point in the V-DOM.\n *\n * Effectively, this is a version of usePublishEvent() which closes over the relevant storeId.\n *\n * To use this, please ensure your V-DOM has the EspStoreContextProvider at a higher node.\n */\nexport const usePublishStoreEvent = () => useContext(PublishStoreEventContext);\n\nexport type PublishStoreEventWithEntityKeyDelegate = {(entityKey: string, eventType: string, event: any): void; (eventData: {entityKey: string, eventType: string, event: any}): void; };\nconst createPublishStoreEventWithEntityKey = (bus: EventBus, storeId: string) => {\n function publishStoreEventWithEntityKey(entityKey: string, eventType: string, event: any): void;\n function publishStoreEventWithEntityKey(eventData: {entityKey: string, eventType: string, event: any}): void;\n function publishStoreEventWithEntityKey(...args: any[]) {\n if (args.length === 1) {\n bus.publishEvent(new DefaultStoreAddress(storeId, args[0].entityKey), args[0].eventType, args[0].event);\n } else {\n bus.publishEvent(new DefaultStoreAddress(storeId, args[0]), args[1], args[2]);\n }\n }\n return publishStoreEventWithEntityKey;\n};\nexport const PublishStoreEventWithEntityKeyContext = createContext<PublishStoreEventWithEntityKeyDelegate>(null);\n/**\n * Returns a function which can be used to publish an event to the store connected at a higher point in the V-DOM, allows an entityKey to be specified.\n *\n * Effectively, this is a version of usePublishEvent() which closes over the storeId.\n *\n * To use this, please ensure your V-DOM has the EspStoreContextProvider at a higher node.\n */\nexport const usePublishStoreEventWithEntityKey = () => useContext(PublishStoreEventWithEntityKeyContext);\n\nexport interface EspStoreContextProviderProps {\n storeId: string;\n model?: any;\n}\n\n/**\n * Sets up various ESP context so ESP hooks are available below this point in the V-DOM\n *\n * To use this, please ensure your V-DOM has the EspEventBusContextProvider at a higher node.\n * @param storeId\n * @param children\n * @param model\n * @constructor\n */\nexport const EspStoreContextProvider = ({storeId, children, model}: PropsWithChildren<EspStoreContextProviderProps>) => {\n const bus = useEventBus();\n // storeId may have been set by a higher level version of this component, so we try and get it from context if it's not set by props.\n let storeIdFromContext = useGetStoreId();\n storeId = storeId || storeIdFromContext;\n const publishStoreEvent: PublishStoreEventDelegate = useCallback(createPublishStoreEvent(bus, storeId), [bus, storeId]);\n const publishStoreEventWithEntityKey: PublishStoreEventWithEntityKeyDelegate = useCallback(createPublishStoreEventWithEntityKey(bus, storeId), [bus, storeId]);\n return (\n <GetStoreIdContext.Provider value={storeId}>\n <PublishStoreEventContext.Provider value={publishStoreEvent}>\n <PublishStoreEventWithEntityKeyContext.Provider value={publishStoreEventWithEntityKey}>\n <GetStoreContext.Provider value={model}>\n {children}\n </GetStoreContext.Provider>\n </PublishStoreEventWithEntityKeyContext.Provider>\n </PublishStoreEventContext.Provider>\n </GetStoreIdContext.Provider>\n );\n};\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/use-sync-external-store-with-selector.production.js');\n} else {\n module.exports = require('./cjs/use-sync-external-store-with-selector.development.js');\n}\n","/**\n * @license React\n * use-sync-external-store-with-selector.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and 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\n\"use strict\";\nvar React = require(\"react\");\nfunction is(x, y) {\n return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);\n}\nvar objectIs = \"function\" === typeof Object.is ? Object.is : is,\n useSyncExternalStore = React.useSyncExternalStore,\n useRef = React.useRef,\n useEffect = React.useEffect,\n useMemo = React.useMemo,\n useDebugValue = React.useDebugValue;\nexports.useSyncExternalStoreWithSelector = function (\n subscribe,\n getSnapshot,\n getServerSnapshot,\n selector,\n isEqual\n) {\n var instRef = useRef(null);\n if (null === instRef.current) {\n var inst = { hasValue: !1, value: null };\n instRef.current = inst;\n } else inst = instRef.current;\n instRef = useMemo(\n function () {\n function memoizedSelector(nextSnapshot) {\n if (!hasMemo) {\n hasMemo = !0;\n memoizedSnapshot = nextSnapshot;\n nextSnapshot = selector(nextSnapshot);\n if (void 0 !== isEqual && inst.hasValue) {\n var currentSelection = inst.value;\n if (isEqual(currentSelection, nextSnapshot))\n return (memoizedSelection = currentSelection);\n }\n return (memoizedSelection = nextSnapshot);\n }\n currentSelection = memoizedSelection;\n if (objectIs(memoizedSnapshot, nextSnapshot)) return currentSelection;\n var nextSelection = selector(nextSnapshot);\n if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))\n return (memoizedSnapshot = nextSnapshot), currentSelection;\n memoizedSnapshot = nextSnapshot;\n return (memoizedSelection = nextSelection);\n }\n var hasMemo = !1,\n memoizedSnapshot,\n memoizedSelection,\n maybeGetServerSnapshot =\n void 0 === getServerSnapshot ? null : getServerSnapshot;\n return [\n function () {\n return memoizedSelector(getSnapshot());\n },\n null === maybeGetServerSnapshot\n ? void 0\n : function () {\n return memoizedSelector(maybeGetServerSnapshot());\n }\n ];\n },\n [getSnapshot, getServerSnapshot, selector, isEqual]\n );\n var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);\n useEffect(\n function () {\n inst.hasValue = !0;\n inst.value = value;\n },\n [value]\n );\n useDebugValue(value);\n return value;\n};\n","/**\n * @license React\n * use-sync-external-store-with-selector.development.js\n *\n * Copyright (c) Meta Platforms, Inc. and 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\n\"use strict\";\n\"production\" !== process.env.NODE_ENV &&\n (function () {\n function is(x, y) {\n return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);\n }\n \"undefined\" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&\n \"function\" ===\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart &&\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());\n var React = require(\"react\"),\n objectIs = \"function\" === typeof Object.is ? Object.is : is,\n useSyncExternalStore = React.useSyncExternalStore,\n useRef = React.useRef,\n useEffect = React.useEffect,\n useMemo = React.useMemo,\n useDebugValue = React.useDebugValue;\n exports.useSyncExternalStoreWithSelector = function (\n subscribe,\n getSnapshot,\n getServerSnapshot,\n selector,\n isEqual\n ) {\n var instRef = useRef(null);\n if (null === instRef.current) {\n var inst = { hasValue: !1, value: null };\n instRef.current = inst;\n } else inst = instRef.current;\n instRef = useMemo(\n function () {\n function memoizedSelector(nextSnapshot) {\n if (!hasMemo) {\n hasMemo = !0;\n memoizedSnapshot = nextSnapshot;\n nextSnapshot = selector(nextSnapshot);\n if (void 0 !== isEqual && inst.hasValue) {\n var currentSelection = inst.value;\n if (isEqual(currentSelection, nextSnapshot))\n return (memoizedSelection = currentSelection);\n }\n return (memoizedSelection = nextSnapshot);\n }\n currentSelection = memoizedSelection;\n if (objectIs(memoizedSnapshot, nextSnapshot))\n return currentSelection;\n var nextSelection = selector(nextSnapshot);\n if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))\n return (memoizedSnapshot = nextSnapshot), currentSelection;\n memoizedSnapshot = nextSnapshot;\n return (memoizedSelection = nextSelection);\n }\n var hasMemo = !1,\n memoizedSnapshot,\n memoizedSelection,\n maybeGetServerSnapshot =\n void 0 === getServerSnapshot ? null : getServerSnapshot;\n return [\n function () {\n return memoizedSelector(getSnapshot());\n },\n null === maybeGetServerSnapshot\n ? void 0\n : function () {\n return memoizedSelector(maybeGetServerSnapshot());\n }\n ];\n },\n [getSnapshot, getServerSnapshot, selector, isEqual]\n );\n var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);\n useEffect(\n function () {\n inst.hasValue = !0;\n inst.value = value;\n },\n [value]\n );\n useDebugValue(value);\n return value;\n };\n \"undefined\" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&\n \"function\" ===\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());\n })();\n","import {useMemo} from 'react';\nimport {useSyncExternalStoreWithSelector} from 'use-sync-external-store/with-selector';\nimport {Logger, EventBus, utils} from 'esp-js';\nimport {useEventBus} from './espEventBusContextProvider';\nimport {useGetStoreId} from './espStoreContextProvider';\n\nexport type SyncModelWithSelectorEqualityFn<T> = (last: T, next: T) => boolean;\n\nexport const logger = Logger.create('useSyncModelWithSelector');\n\n/**\n * Options affecting the subscription of the model to the EventBus.\n *\n * Use syncModelWithSelectorOptions() to create an instance of this type with sensible defaults.\n *\n * @param storeId - the storeId of the store to be observed via the esp EventBus.\n * @param equalityFn - Equality function which will be applied against TSelected, defaults to instance equality (a === b).\n */\nexport type SyncModelWithSelectorOptions<TSelected> = {\n storeId?: string,\n equalityFn: SyncModelWithSelectorEqualityFn<TSelected>\n};\n\n/**\n * Convenience API to build SyncModelWithSelectorOptions<TSelected>, has sensible defaulting.\n */\nexport interface SyncModelWithSelectorOptionsBuilder<TSelected> extends SyncModelWithSelectorOptions<TSelected> {\n /**\n * Sets the store ID\n * @param storeId - default if unset: undefined\n */\n setStoreId(storeId: string): this;\n\n /**\n * Equality function used when comparing the last TSelected with the next.\n * @param fn - default if unset: obj instance equality (e.g. a===b)\n */\n setEqualityFn(fn: (a: TSelected, b: TSelected) => boolean): this;\n}\n\n/**\n * Convenience API to create SyncModelWithSelectorOptions\n */\nexport const syncModelWithSelectorOptions = <TSelected>() => {\n let storeId = undefined;\n let equalityFn: SyncModelWithSelectorEqualityFn<TSelected> = (a: TSelected, b: TSelected) => a === b;\n return {\n get storeId() {\n return storeId;\n },\n setStoreId(value: string) {\n storeId = value;\n return this;\n },\n get equalityFn() {\n return equalityFn;\n },\n setEqualityFn(value: SyncModelWithSelectorEqualityFn<TSelected>) {\n equalityFn = value;\n return this;\n }\n } as SyncModelWithSelectorOptionsBuilder<TSelected>;\n};\n\nconst checkArguments = (selector: (model: any) => any, options: SyncModelWithSelectorOptions<any> ) => {\n if (!utils.isFunction(selector)) {\n throw new Error('You must pass a selector function to useSyncModelWithSelector');\n }\n if (!utils.isObject(options)) {\n throw new Error('You must provide options when using useSyncModelWithSelector');\n }\n if (!utils.isFunction(options.equalityFn)) {\n throw new Error('You must provide an equalityFn when using useSyncModelWithSelector');\n }\n};\n\n/**\n * A hook which returns model state from the esp EventBus.\n *\n * This hooks wih observe updates and re-render the component if the model changes.\n *\n * To use this, please ensure your V-DOM has the EspEventBusContextProvider at a higher node, and optionally EspStoreContextProvider.\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 storeId.\n * @param options\n */\nexport const useSyncModelWithSelector = <TModel, TSelected>(\n selector: (model: TModel) => TSelected,\n options: SyncModelWithSelectorOptions<TSelected> = syncModelWithSelectorOptions<TSelected>()\n): TSelected => {\n checkArguments(selector, options);\n const bus = useEventBus();\n const storeIdFromContext = useGetStoreId();\n const storeId = options?.storeId || storeIdFromContext;\n const equalityFn = options?.equalityFn;\n const dependencies = useMemo(\n () => {\n const canSubscribe = bus && utils.isString(storeId) && bus.isModelRegistered(storeId);\n if (canSubscribe) {\n return createSubscriptionState(bus, storeId, selector);\n }\n return createNoopSubscriptionState();\n },\n // Don't add 'selector' to the dependency list as that will likely change unless the caller memoizes it.\n [bus, storeId]\n );\n\n // Docs on useSyncExternalStore https://github.com/reactwg/react-18/discussions/86\n // Redux's usage of this: https://github.com/reduxjs/react-redux/blob/master/src/hooks/useSelector.ts\n // Code: https://github.com/facebook/react/blob/main/packages/use-sync-external-store/src/useSyncExternalStoreWithSelector.js\n return useSyncExternalStoreWithSelector(\n dependencies.subscribe,\n dependencies.getSnapshot,\n undefined,\n dependencies.wrappedSelector,\n equalityFn,\n );\n};\n\nconst createSubscriptionState = <TModel, TSelected>(\n bus: EventBus,\n storeId: string,\n selector: (model: TModel) => TSelected,\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 EventBus, it can't pass this directly onto getSnapshot,\n // React calls that when it deems it needs to.\n // Given that, we need to cache the state which getSnapshot will return.\n //\n // Note: the bus subscription is created inside the `subscribe` callback (not here at factory time).\n // This is important for correctness with React StrictMode: StrictMode intentionally unmounts and remounts\n // components to surface side-effect bugs. When the cleanup returned by `subscribe` is called, it disposes\n // the bus subscription and clears `currentModel`. Because the `dependencies` object created by useMemo is\n // reused across the remount (deps haven't changed), any bus subscription created eagerly at useMemo time\n // would already be disposed on remount, leaving `currentModel` permanently null.\n //\n // useSyncExternalStore guarantees that `getSnapshot` is called before `subscribe`, so we initialise\n // `currentModel` lazily from `bus.getModel()` inside `getSnapshot` when it is still null.\n let currentModel: TModel;\n return {\n subscribe: (stateChanged: () => void) => {\n // Subscribe to future model updates from the EventBus.\n // This is called by React when the component mounts (and remounts after StrictMode teardown).\n const modelSubscriptionDisposable = bus\n .getModelObservable<TModel>(storeId)\n .subscribe(\n (m: TModel) => {\n // The model is a frozen immutable snapshot produced by immer after each dispatch cycle.\n // Each update is a new object reference, so useSyncExternalStoreWithSelector will detect the change naturally.\n warnIfModelInstanceHasNotChanged(storeId, currentModel, m as any);\n currentModel = m;\n stateChanged();\n }\n );\n return () => {\n currentModel = null;\n modelSubscriptionDisposable.dispose();\n };\n },\n // React expects getSnapshot to be pure and stable between renders unless the store has changed.\n // We seed currentModel from bus.getModel() on first call (before subscribe has been called),\n // then keep it up-to-date via the subscription callback above.\n getSnapshot: () => {\n if (currentModel == null) {\n currentModel = bus.getModel<TModel>(storeId);\n }\n return currentModel;\n },\n // While getSnapshot needs to model to be immutable,\n // useSyncExternalStoreWithSelector builds on top of this, so the TSelected can defer to an equality check to determine if the change is propagated.\n // The selector here just maps the TSelected, useSyncExternalStoreWithSelector internally does the equality check.\n wrappedSelector: (snapshot: TModel) => {\n return snapshot\n ? selector(snapshot)\n : null;\n }\n };\n};\n\nconst createNoopSubscriptionState = () => ({\n subscribe: () => {\n return () => {};\n },\n getSnapshot: () => null,\n wrappedSelector: () => null\n});\n\nconst warnIfModelInstanceHasNotChanged = (storeId: string, lastModel: any, nextModel: string) => {\n if (import.meta.env.MODE === 'production') {\n return;\n }\n if (utils.stringIsEmpty(storeId)) {\n return;\n }\n if (lastModel === nextModel) {\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 logger.warn(\n `useSyncModelWithSelector had detected the latest model update hasn't mutated. This will cause odd render bugs. storeId: ${storeId}`,\n stack\n );\n }\n};\n","import * as React from 'react';\nimport {useEventBus} from './espEventBusContextProvider';\nimport {useMemo} from 'react';\nimport {EventBus} from 'esp-js';\nimport {EspStoreContextProvider, useGetStoreId} from './espStoreContextProvider';\nimport {syncModelWithSelectorOptions, useSyncModelWithSelector} from './useSyncModelWithSelector';\n\nexport type CreatePublishEventProps<TPublishEventProps> = (publishModelEvent: (eventType: string, event: any) => void) => TPublishEventProps;\n\nexport type MapModelToProps<TModel, TModelMappedToProps, TPublishEventProps = {}> = (model: TModel, publishEventProps: TPublishEventProps) => TModelMappedToProps;\n\nexport interface ConnectableComponentProps<TModel = {}, TPublishEventProps = {}, TModelMappedToProps = {}> {\n storeId?: string;\n view?: React.ComponentType;\n createPublishEventProps?: CreatePublishEventProps<TPublishEventProps>;\n mapModelToProps?: MapModelToProps<TModel, TModelMappedToProps, TPublishEventProps>;\n [key: string]: any; // ...rest props, including the result of mapPublish and mapPublish if 'connect' was used\n}\n\nexport interface ConnectableComponentChildProps<TModel = object> {\n storeId: string;\n model: TModel;\n bus: EventBus;\n [key: string]: any; // ...rest props\n}\n\nconst getChildProps = <TModel, TModelMappedToProps, TPublishEventProps>(\n bus: EventBus,\n storeId: string,\n restProps: object,\n model: TModel,\n mapModelToProps: MapModelToProps<TModel, TModelMappedToProps, TPublishEventProps>,\n publishEventProps: TPublishEventProps\n): ConnectableComponentChildProps<TModel> => {\n let childProps = {\n storeId,\n bus: bus,\n ...restProps,\n ...publishEventProps,\n model\n };\n if (mapModelToProps) {\n childProps = {\n ...childProps,\n ...(mapModelToProps(model, publishEventProps) as TModelMappedToProps)\n };\n }\n return childProps;\n};\n\nexport const ConnectableComponent = <TModel = {}, TPublishEventProps = {}, TModelMappedToProps = {}>(\n {\n storeId,\n mapModelToProps,\n createPublishEventProps,\n view,\n ...rest\n }: ConnectableComponentProps<TModel, TPublishEventProps, TModelMappedToProps>\n) => {\n const bus = useEventBus();\n // Note: we always need to render the hooks else react will complain about a different count.\n let storeIdFromContext = useGetStoreId();\n storeId = storeId || storeIdFromContext;\n const publishEventProps: TPublishEventProps = useMemo(\n () => {\n if (createPublishEventProps) {\n const publishModelEvent = (eventType: string, event: any) => {\n bus.publishEvent(storeId, eventType, event);\n };\n return createPublishEventProps(publishModelEvent);\n }\n return {} as TPublishEventProps;\n },\n [bus, storeId]\n );\n const model = useSyncModelWithSelector<TModel, TModel>(\n m => m,\n syncModelWithSelectorOptions()\n .setStoreId(storeId)\n );\n if (model == null) {\n return null;\n }\n let childProps = getChildProps(bus, storeId, rest, model, mapModelToProps, publishEventProps);\n let viewElement = view ? React.createElement(view as React.ComponentType<any>, childProps) : null;\n return (\n <EspStoreContextProvider storeId={storeId} model={model} bus={bus} {...childProps}>\n {viewElement}\n </EspStoreContextProvider>\n );\n};\n","import React from 'react';\nimport type { Module } from 'esp-js-ui';\n\nexport const EspModulesContext = React.createContext<ReadonlyArray<Module>>([]);\n","import React from 'react';\nimport type { App } from 'esp-js-ui';\nimport { EspEventBusContextProvider } from './espEventBusContextProvider';\nimport { EspModulesContext } from './espModulesContext';\n\nexport interface EspAppProps {\n app: App;\n children: React.ReactNode;\n}\n\n/**\n * Wraps an application root with the ESP context providers.\n *\n * Provides the EventBus (via EspEventBusContextProvider) and the loaded\n * modules list (via EspModulesContext) so that RegionView and any\n * esp-js-react hooks work without additional setup in the root component.\n *\n * Multiple EspApp instances can be mounted independently in the same DOM\n * for multi-app scenarios.\n *\n * Example:\n * await app.start();\n * ReactDOM.createRoot(document.getElementById('root')).render(\n * <EspApp app={app}>\n * <AppShell />\n * </EspApp>\n * );\n */\nexport const EspApp = ({ app, children }: EspAppProps) => (\n <EspEventBusContextProvider bus={app.eventBus}>\n <EspModulesContext.Provider value={app.modules}>\n {children}\n </EspModulesContext.Provider>\n </EspEventBusContextProvider>\n);\n","import React, {useContext, useMemo} from 'react';\nimport { ConnectableComponent } from './connectableComponent';\nimport { EspModulesContext } from './espModulesContext';\n\nexport interface RegionViewProps {\n regionName: string;\n}\n\n/**\n * Renders all view bindings registered for a given region across all loaded modules.\n *\n * Each module declares views with a region token (ModuleBuilder.withView in esp-js-ui).\n * RegionView reads EspModulesContext (populated by EspApp), finds all bindings\n * matching regionName, and mounts a ConnectableComponent for each.\n *\n * Example:\n * const AppRoot = () => (\n * <div>\n * <RegionView regionName='main' />\n * <RegionView regionName='sidebar' />\n * </div>\n * );\n */\nexport const RegionView = ({ regionName }: RegionViewProps) => {\n const modules = useContext(EspModulesContext);\n const bindings = useMemo(\n () => modules\n .flatMap(m => m.viewBindings)\n .filter(b => b.region === regionName),\n [modules, regionName]\n );\n return (\n <>\n {bindings.map(binding => (\n <ConnectableComponent\n key={binding.storeId}\n storeId={binding.storeId}\n view={binding.viewComponent}\n />\n ))}\n </>\n );\n};\n"],"names":["process","env","NODE_ENV","jsxRuntimeModule","exports","REACT_ELEMENT_TYPE","Symbol","for","REACT_FRAGMENT_TYPE","jsxProd","type","config","maybeKey","key","propName","ref","$$typeof","props","reactJsxRuntime_production","Fragment","jsx","jsxs","require$$0","getComponentNameFromType","REACT_CLIENT_REFERENCE","displayName","name","REACT_PROFILER_TYPE","REACT_STRICT_MODE_TYPE","REACT_SUSPENSE_TYPE","REACT_SUSPENSE_LIST_TYPE","REACT_ACTIVITY_TYPE","tag","console","error","REACT_PORTAL_TYPE","REACT_CONTEXT_TYPE","REACT_CONSUMER_TYPE","_context","REACT_FORWARD_REF_TYPE","innerType","render","REACT_MEMO_TYPE","REACT_LAZY_TYPE","_payload","_init","x","testStringCoercion","value","checkKeyStringCoercion","JSCompiler_inline_result","e","JSCompiler_temp_const","JSCompiler_inline_result$jscomp$0","toStringTag","constructor","call","getTaskName","UnknownOwner","Error","elementRefGetterWithDeprecationWarning","componentName","this","didWarnAboutElementRef","jsxDEVImpl","isStaticChildren","debugStack","debugTask","dispatcher","children","isArrayImpl","length","validateChildKeys","Object","freeze","hasOwnProperty","keys","filter","k","join","didWarnAboutKeySpread","getter","getOwnPropertyDescriptor","get","isReactWarning","hasValidKey","warnAboutAccessingKey","specialPropKeyWarningShown","defineProperty","configurable","defineKeyPropWarningGetter","owner","refProp","_owner","enumerable","_store","writable","ReactElement","ReactSharedInternals","A","getOwner","node","isValidElement","validated","status","object","React","__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE","prototype","Array","isArray","createTask","unknownOwnerDebugStack","react_stack_bottom_frame","callStackForError","bind","unknownOwnerDebugTask","reactJsxRuntime_development","trackActualOwner","recentlyCreatedOwnerStacks","EventBusContext","createContext","useEventBus","useContext","PublishEventContext","EspEventBusContextProvider","bus","busFromContext","publishEvent","useCallback","args","address","eventType","event","createPublishEvent","Provider","GetStoreIdContext","useGetStoreId","GetStoreContext","PublishStoreEventContext","PublishStoreEventWithEntityKeyContext","EspStoreContextProvider","storeId","model","storeIdFromContext","publishStoreEvent","createPublishStoreEvent","publishStoreEventWithEntityKey","DefaultStoreAddress","entityKey","createPublishStoreEventWithEntityKey","withSelectorModule","objectIs","is","y","useSyncExternalStore","useRef","useEffect","useMemo","useDebugValue","useSyncExternalStoreWithSelector_production","useSyncExternalStoreWithSelector","subscribe","getSnapshot","getServerSnapshot","selector","isEqual","instRef","current","inst","hasValue","memoizedSelector","nextSnapshot","hasMemo","memoizedSnapshot","currentSelection","memoizedSelection","nextSelection","maybeGetServerSnapshot","__REACT_DEVTOOLS_GLOBAL_HOOK__","registerInternalModuleStart","useSyncExternalStoreWithSelector_development","registerInternalModuleStop","Logger","create","syncModelWithSelectorOptions","equalityFn","a","b","setStoreId","setEqualityFn","useSyncModelWithSelector","options","utils","isFunction","isObject","checkArguments","dependencies","isString","isModelRegistered","createSubscriptionState","createNoopSubscriptionState","wrappedSelector","currentModel","stateChanged","modelSubscriptionDisposable","getModelObservable","m","dispose","getModel","snapshot","ConnectableComponent","mapModelToProps","createPublishEventProps","view","rest","publishEventProps","childProps","restProps","getChildProps","viewElement","createElement","EspModulesContext","app","eventBus","modules","regionName","bindings","flatMap","viewBindings","region","map","binding","viewComponent"],"mappings":";;;;;;;;;KAE6B,eAAzBA,QAAQC,IAAIC,SACdC,EAAAC,qCCQF,IAAIC,EAAqBC,OAAOC,IAAI,8BAClCC,EAAsBF,OAAOC,IAAI,kBACnC,SAASE,EAAQC,EAAMC,EAAQC,GAC7B,IAAIC,EAAM,KAGV,QAFA,IAAWD,IAAaC,EAAM,GAAKD,QACnC,IAAWD,EAAOE,MAAQA,EAAM,GAAKF,EAAOE,KACxC,QAASF,EAEX,IAAA,IAASG,KADTF,EAAW,CAAA,EACUD,EACnB,QAAUG,IAAaF,EAASE,GAAYH,EAAOG,SAChDF,EAAWD,EAElB,OADAA,EAASC,EAASG,IACX,CACLC,SAAUX,EACVK,OACAG,MACAE,SAAK,IAAWJ,EAASA,EAAS,KAClCM,MAAOL,EAEX,QACAM,EAAAC,SAAmBX,EACnBU,EAAAE,IAAcX,EACdS,EAAAG,KAAeZ,ID9BIa,GAEjBnB,EAAAC,iBEMF,eAAiBJ,QAAQC,IAAIC,UAC1B,WACC,SAASqB,EAAyBb,GAChC,GAAI,MAAQA,EAAM,OAAO,KACzB,GAAI,mBAAsBA,EACxB,OAAOA,EAAKM,WAAaQ,EACrB,KACAd,EAAKe,aAAef,EAAKgB,MAAQ,KACvC,GAAI,iBAAoBhB,EAAM,OAAOA,EACrC,OAAQA,GACN,KAAKF,EACH,MAAO,WACT,KAAKmB,EACH,MAAO,WACT,KAAKC,EACH,MAAO,aACT,KAAKC,EACH,MAAO,WACT,KAAKC,EACH,MAAO,eACT,KAAKC,EACH,MAAO,WAEX,GAAI,iBAAoBrB,EACtB,OACG,iBAAoBA,EAAKsB,KACxBC,QAAQ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,GACrBK,EAAWrE,EAAAA,SACb,IAAMmE,EACDG,SAAQrB,GAAKA,EAAEsB,eACfxJ,QAAO+G,GAAKA,EAAE0C,SAAWJ,KAC9B,CAACD,EAASC,IAEd,OACI9M,EAAAA,IAAAD,EAAAA,SAAA,CACKkD,SAAA8J,EAASI,KAAIC,GACVpN,EAAAA,IAAC+L,EAAA,CAEGrE,QAAS0F,EAAQ1F,QACjBwE,KAAMkB,EAAQC,eAFTD,EAAQ1F,YAKzB,iERtBmB,IAAenB,EAAAA,WAAWe,uCD0CtB,IAAMf,EAAAA,WAAWC,0BClBZ,IAAMD,EAAAA,WAAWgB,uCAuBJ,IAAMhB,EAAAA,WAAWiB","x_google_ignoreList":[0,1,2,5,6,7]}
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
+
import { EventBus } from 'esp-js';
|
|
1
2
|
import * as React from 'react';
|
|
2
|
-
import { Router } from 'esp-js';
|
|
3
3
|
export type CreatePublishEventProps<TPublishEventProps> = (publishModelEvent: (eventType: string, event: any) => void) => TPublishEventProps;
|
|
4
4
|
export type MapModelToProps<TModel, TModelMappedToProps, TPublishEventProps = {}> = (model: TModel, publishEventProps: TPublishEventProps) => TModelMappedToProps;
|
|
5
5
|
export interface ConnectableComponentProps<TModel = {}, TPublishEventProps = {}, TModelMappedToProps = {}> {
|
|
6
|
-
|
|
7
|
-
viewContext?: string;
|
|
6
|
+
storeId?: string;
|
|
8
7
|
view?: React.ComponentType;
|
|
9
8
|
createPublishEventProps?: CreatePublishEventProps<TPublishEventProps>;
|
|
10
9
|
mapModelToProps?: MapModelToProps<TModel, TModelMappedToProps, TPublishEventProps>;
|
|
11
10
|
[key: string]: any;
|
|
12
11
|
}
|
|
13
12
|
export interface ConnectableComponentChildProps<TModel = object> {
|
|
14
|
-
|
|
13
|
+
storeId: string;
|
|
15
14
|
model: TModel;
|
|
16
|
-
|
|
15
|
+
bus: EventBus;
|
|
17
16
|
[key: string]: any;
|
|
18
17
|
}
|
|
19
|
-
export declare const ConnectableComponent: <TModel = {}, TPublishEventProps = {}, TModelMappedToProps = {}>({
|
|
18
|
+
export declare const ConnectableComponent: <TModel = {}, TPublishEventProps = {}, TModelMappedToProps = {}>({ storeId, mapModelToProps, createPublishEventProps, view, ...rest }: ConnectableComponentProps<TModel, TPublishEventProps, TModelMappedToProps>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { App } from 'esp-js-ui';
|
|
3
|
+
export interface EspAppProps {
|
|
4
|
+
app: App;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Wraps an application root with the ESP context providers.
|
|
9
|
+
*
|
|
10
|
+
* Provides the EventBus (via EspEventBusContextProvider) and the loaded
|
|
11
|
+
* modules list (via EspModulesContext) so that RegionView and any
|
|
12
|
+
* esp-js-react hooks work without additional setup in the root component.
|
|
13
|
+
*
|
|
14
|
+
* Multiple EspApp instances can be mounted independently in the same DOM
|
|
15
|
+
* for multi-app scenarios.
|
|
16
|
+
*
|
|
17
|
+
* Example:
|
|
18
|
+
* await app.start();
|
|
19
|
+
* ReactDOM.createRoot(document.getElementById('root')).render(
|
|
20
|
+
* <EspApp app={app}>
|
|
21
|
+
* <AppShell />
|
|
22
|
+
* </EspApp>
|
|
23
|
+
* );
|
|
24
|
+
*/
|
|
25
|
+
export declare const EspApp: ({ app, children }: EspAppProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { StoreAddress, EventBus } from 'esp-js';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
3
|
+
export declare const EventBusContext: import('react').Context<EventBus>;
|
|
4
|
+
/**
|
|
5
|
+
* Get the esp EventBus from context.
|
|
6
|
+
*
|
|
7
|
+
* To use this, please ensure your V-DOM has the EspEventBusContextProvider at a higher node:
|
|
8
|
+
*
|
|
9
|
+
* <EspEventBusContextProvider bus={bus}>
|
|
10
|
+
* <YourComponents />
|
|
11
|
+
* </EspEventBusContextProvider>
|
|
12
|
+
*/
|
|
13
|
+
export declare const useEventBus: () => EventBus;
|
|
14
|
+
export type PublishEventDelegate = {
|
|
15
|
+
(storeIdOrStoreAddress: string | StoreAddress, eventType: string, event: any): void;
|
|
16
|
+
(eventData: {
|
|
17
|
+
address: string | StoreAddress;
|
|
18
|
+
eventType: string;
|
|
19
|
+
event: any;
|
|
20
|
+
}): void;
|
|
21
|
+
};
|
|
22
|
+
export declare const PublishEventContext: import('react').Context<PublishEventDelegate>;
|
|
23
|
+
/**
|
|
24
|
+
* Returns a function which can be used to publish an event.
|
|
25
|
+
*
|
|
26
|
+
* To use this, please ensure your V-DOM has the EspEventBusContextProvider at a higher node:
|
|
27
|
+
*
|
|
28
|
+
* <EspEventBusContextProvider bus={bus}>
|
|
29
|
+
* <YourComponents />
|
|
30
|
+
* </EspEventBusContextProvider>
|
|
31
|
+
*/
|
|
32
|
+
export declare const usePublishEvent: () => PublishEventDelegate;
|
|
33
|
+
export type EspEventBusContextProviderProps = PropsWithChildren<{
|
|
34
|
+
bus: EventBus;
|
|
35
|
+
}>;
|
|
36
|
+
/**
|
|
37
|
+
* Used to set the bus on the EventBusContext making it available to components down the tree via the useEventBus() hook.
|
|
38
|
+
*
|
|
39
|
+
* Also sets up the usePublishEvent() hook so nested components can publish to the bus.
|
|
40
|
+
*/
|
|
41
|
+
export declare const EspEventBusContextProvider: ({ children, bus }: EspEventBusContextProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
export declare const GetStoreIdContext: import('react').Context<string>;
|
|
3
|
+
/**
|
|
4
|
+
* Returns a function to get the ID of the store connected at a higher point in the V-DOM.
|
|
5
|
+
*
|
|
6
|
+
* To use this, please ensure your V-DOM has the EspStoreContextProvider at a higher node.
|
|
7
|
+
*/
|
|
8
|
+
export declare const useGetStoreId: () => string;
|
|
9
|
+
export declare const GetStoreContext: import('react').Context<object>;
|
|
10
|
+
/**
|
|
11
|
+
* Returns a function which will return the store connected at a higher point in the V-DOM.
|
|
12
|
+
*
|
|
13
|
+
* To use this, please ensure your V-DOM has the EspStoreContextProvider at a higher node.
|
|
14
|
+
*/
|
|
15
|
+
export declare const useGetStore: <TModel>() => TModel;
|
|
16
|
+
export type PublishStoreEventDelegate = {
|
|
17
|
+
(eventType: string, event: any): void;
|
|
18
|
+
(eventData: {
|
|
19
|
+
eventType: string;
|
|
20
|
+
event: any;
|
|
21
|
+
}): void;
|
|
22
|
+
};
|
|
23
|
+
export declare const PublishStoreEventContext: import('react').Context<PublishStoreEventDelegate>;
|
|
24
|
+
/**
|
|
25
|
+
* Returns a function which can be used to publish an event to the store connected at a higher point in the V-DOM.
|
|
26
|
+
*
|
|
27
|
+
* Effectively, this is a version of usePublishEvent() which closes over the relevant storeId.
|
|
28
|
+
*
|
|
29
|
+
* To use this, please ensure your V-DOM has the EspStoreContextProvider at a higher node.
|
|
30
|
+
*/
|
|
31
|
+
export declare const usePublishStoreEvent: () => PublishStoreEventDelegate;
|
|
32
|
+
export type PublishStoreEventWithEntityKeyDelegate = {
|
|
33
|
+
(entityKey: string, eventType: string, event: any): void;
|
|
34
|
+
(eventData: {
|
|
35
|
+
entityKey: string;
|
|
36
|
+
eventType: string;
|
|
37
|
+
event: any;
|
|
38
|
+
}): void;
|
|
39
|
+
};
|
|
40
|
+
export declare const PublishStoreEventWithEntityKeyContext: import('react').Context<PublishStoreEventWithEntityKeyDelegate>;
|
|
41
|
+
/**
|
|
42
|
+
* Returns a function which can be used to publish an event to the store connected at a higher point in the V-DOM, allows an entityKey to be specified.
|
|
43
|
+
*
|
|
44
|
+
* Effectively, this is a version of usePublishEvent() which closes over the storeId.
|
|
45
|
+
*
|
|
46
|
+
* To use this, please ensure your V-DOM has the EspStoreContextProvider at a higher node.
|
|
47
|
+
*/
|
|
48
|
+
export declare const usePublishStoreEventWithEntityKey: () => PublishStoreEventWithEntityKeyDelegate;
|
|
49
|
+
export interface EspStoreContextProviderProps {
|
|
50
|
+
storeId: string;
|
|
51
|
+
model?: any;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Sets up various ESP context so ESP hooks are available below this point in the V-DOM
|
|
55
|
+
*
|
|
56
|
+
* To use this, please ensure your V-DOM has the EspEventBusContextProvider at a higher node.
|
|
57
|
+
* @param storeId
|
|
58
|
+
* @param children
|
|
59
|
+
* @param model
|
|
60
|
+
* @constructor
|
|
61
|
+
*/
|
|
62
|
+
export declare const EspStoreContextProvider: ({ storeId, children, model }: PropsWithChildren<EspStoreContextProviderProps>) => import("react/jsx-runtime").JSX.Element;
|
package/.dist/typings/index.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
1
|
+
export { ConnectableComponent } from './connectableComponent';
|
|
2
|
+
export type { CreatePublishEventProps, MapModelToProps, ConnectableComponentProps, ConnectableComponentChildProps, } from './connectableComponent';
|
|
3
|
+
export { useSyncModelWithSelector, syncModelWithSelectorOptions, } from './useSyncModelWithSelector';
|
|
4
|
+
export type { SyncModelWithSelectorOptionsBuilder, SyncModelWithSelectorOptions, SyncModelWithSelectorEqualityFn, } from './useSyncModelWithSelector';
|
|
5
|
+
export { EspEventBusContextProvider, EventBusContext, useEventBus, PublishEventContext, usePublishEvent, } from './espEventBusContextProvider';
|
|
6
|
+
export type { EspEventBusContextProviderProps, PublishEventDelegate, } from './espEventBusContextProvider';
|
|
7
|
+
export { useGetStoreId, GetStoreIdContext, useGetStore, GetStoreContext, PublishStoreEventContext, usePublishStoreEvent, PublishStoreEventWithEntityKeyContext, usePublishStoreEventWithEntityKey, EspStoreContextProvider, } from './espStoreContextProvider';
|
|
8
|
+
export type { PublishStoreEventDelegate, PublishStoreEventWithEntityKeyDelegate, EspStoreContextProviderProps, } from './espStoreContextProvider';
|
|
9
|
+
export { EspModulesContext } from './espModulesContext';
|
|
10
|
+
export { RegionView } from './regionView';
|
|
11
|
+
export type { RegionViewProps } from './regionView';
|
|
12
|
+
export { EspApp } from './espApp';
|
|
13
|
+
export type { EspAppProps } from './espApp';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface RegionViewProps {
|
|
2
|
+
regionName: string;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Renders all view bindings registered for a given region across all loaded modules.
|
|
6
|
+
*
|
|
7
|
+
* Each module declares views with a region token (ModuleBuilder.withView in esp-js-ui).
|
|
8
|
+
* RegionView reads EspModulesContext (populated by EspApp), finds all bindings
|
|
9
|
+
* matching regionName, and mounts a ConnectableComponent for each.
|
|
10
|
+
*
|
|
11
|
+
* Example:
|
|
12
|
+
* const AppRoot = () => (
|
|
13
|
+
* <div>
|
|
14
|
+
* <RegionView regionName='main' />
|
|
15
|
+
* <RegionView regionName='sidebar' />
|
|
16
|
+
* </div>
|
|
17
|
+
* );
|
|
18
|
+
*/
|
|
19
|
+
export declare const RegionView: ({ regionName }: RegionViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,17 +2,15 @@ import { Logger } from 'esp-js';
|
|
|
2
2
|
export type SyncModelWithSelectorEqualityFn<T> = (last: T, next: T) => boolean;
|
|
3
3
|
export declare const logger: Logger;
|
|
4
4
|
/**
|
|
5
|
-
* Options affecting the subscription of the model to the
|
|
5
|
+
* Options affecting the subscription of the model to the EventBus.
|
|
6
6
|
*
|
|
7
7
|
* Use syncModelWithSelectorOptions() to create an instance of this type with sensible defaults.
|
|
8
8
|
*
|
|
9
|
-
* @param
|
|
10
|
-
* @param tryPreSelectPolimerImmutableModel - if true, and the esp model is an esp-js-polimer model, the immutable model will be used when calling the selector.
|
|
9
|
+
* @param storeId - the storeId of the store to be observed via the esp EventBus.
|
|
11
10
|
* @param equalityFn - Equality function which will be applied against TSelected, defaults to instance equality (a === b).
|
|
12
11
|
*/
|
|
13
12
|
export type SyncModelWithSelectorOptions<TSelected> = {
|
|
14
|
-
|
|
15
|
-
tryPreSelectPolimerImmutableModel: boolean;
|
|
13
|
+
storeId?: string;
|
|
16
14
|
equalityFn: SyncModelWithSelectorEqualityFn<TSelected>;
|
|
17
15
|
};
|
|
18
16
|
/**
|
|
@@ -20,15 +18,10 @@ export type SyncModelWithSelectorOptions<TSelected> = {
|
|
|
20
18
|
*/
|
|
21
19
|
export interface SyncModelWithSelectorOptionsBuilder<TSelected> extends SyncModelWithSelectorOptions<TSelected> {
|
|
22
20
|
/**
|
|
23
|
-
* Sets the
|
|
24
|
-
* @param
|
|
21
|
+
* Sets the store ID
|
|
22
|
+
* @param storeId - default if unset: undefined
|
|
25
23
|
*/
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* If the model is a PolimerModel and this set true, PolimerModel.getImmutableModel() will be selected by default.
|
|
29
|
-
* @param value - default if unset: true
|
|
30
|
-
*/
|
|
31
|
-
setTryPreSelectPolimerImmutableModel(value: boolean): this;
|
|
24
|
+
setStoreId(storeId: string): this;
|
|
32
25
|
/**
|
|
33
26
|
* Equality function used when comparing the last TSelected with the next.
|
|
34
27
|
* @param fn - default if unset: obj instance equality (e.g. a===b)
|
|
@@ -40,13 +33,13 @@ export interface SyncModelWithSelectorOptionsBuilder<TSelected> extends SyncMode
|
|
|
40
33
|
*/
|
|
41
34
|
export declare const syncModelWithSelectorOptions: <TSelected>() => SyncModelWithSelectorOptionsBuilder<TSelected>;
|
|
42
35
|
/**
|
|
43
|
-
* A hook which returns model state from the esp
|
|
36
|
+
* A hook which returns model state from the esp EventBus.
|
|
44
37
|
*
|
|
45
38
|
* This hooks wih observe updates and re-render the component if the model changes.
|
|
46
39
|
*
|
|
47
|
-
* To use this, please ensure your V-DOM has the
|
|
40
|
+
* To use this, please ensure your V-DOM has the EspEventBusContextProvider at a higher node, and optionally EspStoreContextProvider.
|
|
48
41
|
*
|
|
49
|
-
* @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
|
|
42
|
+
* @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 storeId.
|
|
50
43
|
* @param options
|
|
51
44
|
*/
|
|
52
45
|
export declare const useSyncModelWithSelector: <TModel, TSelected>(selector: (model: TModel) => TSelected, options?: SyncModelWithSelectorOptions<TSelected>) => TSelected;
|