brew-js-react 0.6.5 → 0.6.7
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/dialog.d.ts +58 -1
- package/dialog.js +157 -58
- package/dist/brew-js-react.js +190 -77
- package/dist/brew-js-react.js.map +1 -1
- package/dist/brew-js-react.min.js +2 -2
- package/dist/brew-js-react.min.js.map +1 -1
- package/mixin.d.ts +13 -0
- package/mixin.js +8 -8
- package/package.json +1 -1
- package/view.d.ts +6 -1
- package/view.js +17 -4
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! brew-js-react v0.6.
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("zeta-dom"),require("brew-js"),require("react"),require("react-dom"),require("zeta-dom-react"),require("waterpipe"),require("jquery")):"function"==typeof define&&define.amd?define("brew-js-react",["zeta-dom","brew-js","react","react-dom","zeta-dom-react","waterpipe","jquery"],t):"object"==typeof exports?exports["brew-js-react"]=t(require("zeta-dom"),require("brew-js"),require("react"),require("react-dom"),require("zeta-dom-react"),require("waterpipe"),require("jquery")):(e.brew=e.brew||{},e.brew.react=t(e.zeta,e.brew,e.React,e.ReactDOM,e.zeta.react,e.waterpipe,e.jQuery))}(self,((e,t,n,r,i,o,s)=>(()=>{var a={87:e=>{"use strict";e.exports=o},760:e=>{"use strict";e.exports=t},914:e=>{"use strict";e.exports=s},12:e=>{"use strict";e.exports=n},33:e=>{"use strict";e.exports=r},231:t=>{"use strict";t.exports=e},402:e=>{"use strict";e.exports=i},621:(e,t,n)=>{var r,i=n(33);r=i.createRoot?i:{createRoot:(e,t)=>({render(t){i.render(t,e)},unmount(){i.unmountComponentAtNode(e)}}),hydrateRoot:(e,t,n)=>(i.hydrate(t,e),r.createRoot(e,n))},e.exports=r}},u={};function c(e){var t=u[e];if(void 0!==t)return t.exports;var n=u[e]={exports:{}};return a[e](n,n.exports,c),n.exports}c.d=(e,t)=>{for(var n in t)c.o(t,n)&&!c.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},c.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var l={};return(()=>{"use strict";c.r(l),c.d(l,{AnimateMixin:()=>sn,AnimateSequenceItemMixin:()=>un,AnimateSequenceMixin:()=>pn,ClassNameMixin:()=>rn,ClassNameToggleMixin:()=>dn,Dialog:()=>ze,FlyoutMixin:()=>bn,FlyoutToggleMixin:()=>mn,FocusStateMixin:()=>Cn,LoadingStateMixin:()=>En,Mixin:()=>Wt,ScrollIntoViewMixin:()=>Vn,ScrollableMixin:()=>An,StatefulMixin:()=>tn,UnmanagedClassNameMixin:()=>On,ViewContext:()=>ut,ViewStateContainer:()=>Dt,createDialog:()=>Ue,isViewMatched:()=>gt,isViewRendered:()=>vt,linkTo:()=>St,makeTranslation:()=>Qt,matchView:()=>wt,navigateTo:()=>Pt,redirectTo:()=>Et,registerErrorView:()=>bt,registerView:()=>yt,renderView:()=>xt,resolvePath:()=>Ct,useAnimateMixin:()=>Tn,useAnimateSequenceMixin:()=>jn,useAppReady:()=>Tt,useAppReadyState:()=>jt,useClassNameToggleMixin:()=>Fn,useFlyoutMixin:()=>qn,useFocusStateMixin:()=>kn,useLanguage:()=>Bt,useLoadingStateMixin:()=>Dn,useMixin:()=>zn,useMixinRef:()=>Hn,useQueryParam:()=>kt,useRouteParam:()=>Ft,useRouteState:()=>qt,useScrollIntoViewMixin:()=>In,useScrollableMixin:()=>Ln,useUnmanagedClassNameMixin:()=>Un,useViewContainerState:()=>mt,useViewContext:()=>mt});var e=c(231),t=e.util,n=t.always,r=t.any,i=t.arrRemove,o=t.catchAsync,s=t.combineFn,a=t.createPrivateStore,u=t.define,f=t.defineGetterProperty,p=t.defineHiddenProperty,d=t.defineObservableProperty,h=t.defineOwnProperty,m=t.definePrototype,g=t.delay,v=t.each,w=t.either,y=t.equal,b=t.exclude,x=t.executeOnce,C=t.extend,S=t.fill,P=t.freeze,E=t.grep,M=t.isArray,A=t.isFunction,V=t.isPlainObject,O=t.isThenable,N=t.isUndefinedOrNull,R=t.keys,T=t.kv,j=t.makeArray,F=t.map,q=t.mapObject,k=t.noop,D=t.pick,L=t.randomId,I=t.resolve,U=t.setImmediate,z=t.setImmediateOnce,H=t.single,B=t.throwNotFunction,Q=t.throws,_=t.watch,W=t.watchable,G=c(760);var $=G.addExtension,J=G.install;const K=G.defaults;var X,Y=[];J("react",$(!0,"react2",["?router","?i18n"],(function(e){X=e,s(Y)(X)}))),K.react=!0;var Z=c(12),ee=Z.Component,te=Z.StrictMode,ne=Z.createContext,re=Z.createElement,ie=Z.useContext,oe=Z.useEffect,se=Z.useLayoutEffect,ae=Z.useMemo,ue=Z.useRef,ce=Z.useState,le=c(33),fe=c(621),pe=c(402),de=pe.ViewStateProvider,he=pe.classNames,me=pe.createAsyncScope,ge=pe.useAsync,ve=pe.useEagerState,we=pe.useMemoizedFunction,ye=pe.useObservableProperty,be=pe.useSingleton,xe=pe.useValueTrigger,Ce=e.util,Se=Ce.containsOrEquals,Pe=Ce.getClass,Ee=Ce.removeNode,Me=Ce.scrollIntoView,Ae=Ce.setClass,Ve=e.dom;const Oe=Ve;var Ne=Ve.reportError,Re=e.dom,Te=Re.lock,je=Re.preventLeave,Fe=Re.runAsync,qe=Re.subscribeAsync,ke=G.closeFlyout,De=G.isFlyoutOpen,Le=G.openFlyout,Ie=G.toggleFlyout;function Ue(e){var t,n=document.createElement("div"),r=fe.createRoot(n),i=me(n),o=ke.bind(0,n);return Oe.on(n,{flyoutshow:function(){(e.onOpen||k)(n)},flyouthide:function(){t=null,Ee(n),(e.onClose||k)(n),e.onRender&&r.unmount()}}),n.setAttribute("loading-class",""),qe(n,!0),{root:n,close:o,open:function(){if(t)return t;if(n.className=e.className||"",document.body.appendChild(n),e.modal&&n.setAttribute("is-modal",""),e.onRender){var s=e.onCommit?function(t){return Fe(Oe.activeElement,e.onCommit.bind(this,t)).then(o)}:o,a=C({},e,{errorHandler:i.errorHandler,closeDialog:s,commitDialog:s,dismissDialog:o}),u=re(e.onRender,a);e.wrapper&&(u=re(e.wrapper,a,u)),r.render(re(te,null,re(i.Provider,null,u)))}return t=I().then((function(){return Oe.retainFocus(Oe.activeElement,n),Le(n,null,D(e,["focus"]))})),e.preventLeave?je(n,t):e.preventNavigation&&Te(n,t),t}}}function ze(e){var t=ce({})[0],n=ce((function(){return Ue(t)}))[0];return C(t,e),oe((function(){var e=Se(Oe.root,n.root);w(e,t.isOpen)&&(e?n.close():n.open())}),[t.isOpen]),oe((function(){return n.close}),[n]),le.createPortal(e.children,n.root)}var He,Be,Qe=e.EventContainer,_e=G.getQueryParam,We=G.setQueryParam,Ge=G.toQueryString,$e=G.parsePath,Je=G.removeQueryAndHash,Ke=G.animateIn,Xe=G.animateOut,Ye=a(),Ze=Oe.root,et=new Map,tt={},nt=[],rt=new Qe,it=P(C(new ut,{container:Ze})),ot=Ye(it),st=ne(it),at={waitFor:k};function ut(e,t,n){var r=this;h(r,"view",e||null,!0),h(r,"parent",n||null,!0),Ye(r,{children:[],setPage:d(r,"page",t||null,!0),setActive:d(r,"active",!!t,!0)}),_(r,"page",(function(e,t){rt.emit("pagechange",r,{page:e,previousPage:t,navigationType:at.navigationType,waitFor:at.waitFor})}))}function ct(e){ee.call(this,e),this.state={},Ye(e.context).wrapper=this}function lt(){ee.apply(this,arguments),this.views=[]}function ft(e,t){return N(e)||""===e||e===t?"":e[0]===t?e:t+e}function pt(e,t){return(et.get(t)||{}).matchCount-(et.get(e)||{}).matchCount}function dt(e,t){var n=et.get(e);return!!n&&!H(n.matchers,(function(e,n){var r=t[n]||"";return A(e)?!e(r):(e||"")!==r}))}function ht(e){var t;return B(e),e.prototype instanceof ee&&(e=re.bind(null,e)),function(n){var r=t||e(n.viewProps);if(!O(r))return se(n.onLoad,[]),r;o(t=r);var i=ge((function(){return t.then(null,(function(e){t=null,n.onError(e)}))}))[0];return i&&n.onLoad(),i?re(i.default,n.viewProps):n.self.currentContext===n.context&&n.loader||null}}function mt(){return ie(st)}function gt(e){var t=X.route;return dt(e,t)&&Ct(e,t)===t.toString()}function vt(e){return!!(et.get(e)||"").rendered}function wt(){var e=j(arguments),t=X.route;return"string"==typeof e[0]&&(t=t.parse(e.shift())),e=e[0]?(M(e[0])?j(e[0]):e).sort(pt):nt,r(e,(function(e){return dt(e,t)}))||void 0}function yt(e,t){var n=ht(e);return t=C({},t),v(t,(function(e,n){tt[e]=!0,n instanceof RegExp&&(t[e]=n.test.bind(n))})),et.set(n,{id:L(),rendered:0,matchCount:R(t).length,matchers:t,params:D(t,(function(e){return N(e)||"string"==typeof e}))}),nt.push(n),nt.sort(pt),n}function bt(e){He=B(e)}function xt(){var e=j(arguments),t=A(e[0])?{}:e.shift(),n=e[0];return v(e,(function(e,t){if(!et.has(t))throw new Error("Invalid argument to renderView: "+(A(t)?t.name:t))})),e.sort(pt),re(lt,{rootProps:t,views:e,defaultView:n})}function Ct(e,t){var n="";return M(t)&&(n=ft(V(t[1])?Ge(t[1]):t[1],"?")+ft(t[2],"#"),t=t[0]),(et.has(e)?X.route.getPath(function(e,t){var n=et.get(e);if(!n.maxParams){var i=b(n.matchers,["remainingSegments"]),o=F(X.routes,(function(e){var t=X.parseRoute(e),n=t.length&&!r(i,(function(e,n){var r=t.params[n];return(e?!(r>=0):r<t.minLength)||!A(e)&&!t.match(n,e)}));return n?t:null}));if(o[1]&&(o=E(o,(function(e){return!H(e.params,(function(e,t){return tt[t]&&!i[t]}))}))),o[0]){var s=o.slice(-1)[0];n.maxParams=R(C.apply(0,[{remainingSegments:!0}].concat(o.map((function(e){return e.params}))))),n.minParams=F(s.params,(function(e,t){return n.params[t]||e>=s.minLength?null:t}))}}return C(D(X.route,n.minParams),t&&D(t,n.maxParams),n.params)}(e,t)):"/")+n}function St(e,t){return X.toHref(Ct(e,t))}function Pt(e,t,n,r){return X.navigate(Ct(e,t),r,n&&P(C({},n)))}function Et(e,t,n){return Pt(e,t,n,!0)}Be=function(){X.on("beforepageload",(function(e){ot.setPage(X.page),ot.setActive(!0),at=e,function t(n){v(n.children,(function(n,r){e.waitFor(new Promise((function(e){r.onRender=e,r.forceUpdate()})).then((function(){t(r)})))}))}(ot)})),ot.setPage(X.page)},X?Be(X):Y.push(B(Be)),h(ut,"root",it,!0),m(ut,{getChildren:function(){return F(Ye(this).children,(function(e){return e.currentContext}))},setErrorView:function(e,t){var n=Ye(this).wrapper;return n&&e&&!n.setState({error:t,errorView:e})},on:function(e,t){return rt.add(this,e,t)}}),m(ct,ee,{componentDidMount:function(){var e=this;e.componentWillUnmount=_(e.props.context,"page",(function(){e.state.errorView=null,e.forceUpdate()}))},componentDidCatch:function(e){var t=this;He&&t.state.errorView!==He?t.setState({error:e,errorView:He}):(t.props.onLoad(),Ne(e,t.props.context.container))},render:function(){var e=this,t=e.props.context;if(!t.container)return U((function(){C(e,me(t.container)),Oe.on(t.container,"error",(function(e){return rt.emit(e,t,{error:e.error})})),e.forceUpdate()})),null;if(e.state.errorView)return e.props.onLoad(),re(e.Provider,null,re(e.state.errorView,{view:t.view,error:e.state.error,reset:e.reset.bind(e)}));var n=e.componentDidCatch.bind(e),r={errorHandler:e.errorHandler,navigationType:at.navigationType,viewContext:t,viewData:t.page.data||{}};return re(e.Provider,null,re(t.view,C({viewProps:r,onError:n},e.props)))},reset:function(){this.setState({errorView:null})}}),lt.contextType=st,m(lt,ee,{componentDidMount:function(){var e=this,t=Ye(e.context).children,n=_(X.route,(function(){e.setActive(e.getViewComponent()===(e.currentContext||"").view)}));e.componentWillUnmount=function(){e.setActive(!1),i(t,e),n(),U((function(){e.currentContext&&!e.currentContext.active&&e.unmountView()}))},t.push(e),e.setActive(!0)},render:function(){var e=this;return e.context.active&&e.updateView(),e.onRender(),e.views},updateView:function(){var e=this,t=e.getViewComponent(),r=t!==(e.currentContext||"").view;if(t&&(r||!(e.children||"")[0])){var i=Ct(t,X.route);if(i!==Je(X.path))return void X.navigate(i,!0)}var o=et.get(t)||{};if((e.views[2]||"").key!==o.id){if(e.views[2]=null,e.abort(),!t||!r)return e.setActive(!0),void e.setPage(X.page);at.waitFor(new Promise((function(r){var i=new ut(t,X.page,e.context),s=e.props.rootProps,a=x((function(t){h(i,"container",t,!0),e.currentContext=e.currentContext||i})),u=x((function(){var s=i.container,a=e.unmountView();e.unmountView=x((function(){return o.rendered--,e.setActive(!1),X.emit("pageleave",s,{pathname:i.page.path,view:t},!0),Xe(s,"show").then((function(){e.views[0]=null,e.forceUpdate()}))})),n(a,g).then((function(){X.emit("pageenter",s,{pathname:i.page.path,view:t},!0)})),e.views.shift(),e.currentContext=i,C(e,Ye(i)),o.rendered++,Ke(s,"show","[brew-view]",!0),r()}));i.on("error",(function(){return(s.onError||k).apply(this,arguments)})),e.abort=r,e.views[2]=re(st.Provider,{key:o.id,value:i},re(Dt,null,re("div",C(b(s,["loader","onError"]),{ref:a,"brew-view":""}),re(ct,{onLoad:u,context:i,self:e,loader:s.loader}))))})))}},getViewComponent:function(){var e=this.props;return r(e.views,(function(e){return dt(e,X.route)}))||e.defaultView}}),S(lt.prototype,"abort onRender setActive setPage unmountView",k);var Mt=new Qe;function At(){return X.historyStorage.current}function Vt(e,t){this.key=e,this.store=At(),this.dispose=t}function Ot(e,t,n,r){return e.get(t)!==n&&(r&&e.has(t)&&(X.snapshot(),e=At()),e.set(t,n)),e}function Nt(e,t,n){var r=e.get();(t!==e.key||n!==e.store&&n.has(t))&&(r=n.get(t),Mt.emit("popstate",e,{newValue:r})),e.key=t,e.store=n,n.set(t,r)}function Rt(e,t){var n=mt();return oe((function(){return X.on("beforepageload popstate",(function(){n.active&&e(At())}))}),t),n}function Tt(){return jt().ready}function jt(){var e=ye(X,"readyState");return{ready:"ready"===e,error:"error"===e}}function Ft(e,t){var n=mt(),r=n.page.params,i=r[e]||"",o=xe(i);return oe((function(){var t=function(){o(n.page.params[e]||"")};return t(),n.on("pagechange",t)}),[e]),t&&n.active&&(!i||"remainingSegments"===e&&"/"===i)&&X.navigate(X.route.getPath(C({},r,T(e,t))),!0),i}function qt(e,t,n){var r=At(),i=ve(r&&r.has(e)?r.get(e):t),o=Rt((function(t){i[1]((function(n){return t.has(e)?t.get(e):(t.set(e,n),n)}))}),[e]);return r?o.active&&Ot(r,e,i[0],n):X.beforeInit(g(1)),i}function kt(e,t,n){V(e)&&(n=t,t=e,e=!1);var r=mt(),i=function(){return P(q(!1===e?t:T(e,t),(function(e,t){return _e(t,X.path)||e||""})))},s=ue({});ae((function(){s.current=i()}),[e]);var a=s.current,u=xe(a,(function(e,t){return y(e,t)||!(s.current=t)})),c=we((function(t){var a=s.current;if(!1!==e?t=T(e,A(t)?t(a[e]):t):A(t)&&(t=t(C({},a))),r.active){var c=$e(X.path),l=R(t).reduce((function(e,n){return t[n]!==a[n]?We(n,t[n]||null,e):e}),c.search);l!==c.search&&(n&&X.snapshot(),o(X.navigate((l||"?")+c.hash,!0)),u(i()))}}));return oe((function(){return X.watch("path",(function(){r.active&&u(i())}))}),[e]),[!1!==e?a[e]:a,c]}function Dt(e){var t=ce({})[0],n=Rt((function(e){v(t,(function(t,n){Nt(n,n.key,e)}))}),[]),r=ce((function(){return{getState:function(e,r){var i=t[e];return i&&n.active&&Nt(i,r,At()),i||(t[e]=new Vt(r,(function(){delete t[e]})))}}}))[0];return re(de,{value:r},e.children)}m(Vt,{get:function(){return this.store.get(this.key)},set:function(e,t){this.store=Ot(this.store,this.key,e,t)},onPopState:function(e){return B(e),Mt.add(this,"popstate",(function(t){e.call(this,t.newValue)}))}});var Lt=c(87),It=Object.create(null),Ut="function"==typeof Symbol&&Symbol.toPrimitive;function zt(e){this.toString=e}function Ht(e){return C((function(t,n,r){var i=e(t,n,r,!0);return void 0!==i?i:t}),{html:function(t,n,r){return{__html:e(t,n,r)}},lazy:function(t,n,r){return new zt(e.bind(0,t,n,r,!0))}})}function Bt(){return ye(X,"language")}function Qt(e,t){var n=new RegExp("^("+Object.keys(e[t]).join("|")+")\\."),r={};function i(n,r,o,s,a){var u=((e[a]||It)[n]||It)[r];return"string"==typeof u?!u||s&&void 0===o?u:Lt(u,o,{noEncode:s}):a!==t?i(n,r,o,s,t):void 0}function o(e,t,r,o){var s=n.test(e)?RegExp.$1:"";return i(s,s?e.slice(RegExp.lastMatch.length):e,t,o,r||X.language)}function s(){var e=String(this),t=j(arguments),n=e+" "+t.join(" ");return r[n]||(r[n]=t[0]?Ht((function(n,r,o,s){return o=o||e||X.language,H(t,(function(e){return i(e,n,r,s,o)}))})):Ht((function(t,n,r,i){return o(t,n,r||e,i)})))}return{translate:Ht(o),getTranslation:s.bind(""),useTranslation:function(){var e=Bt();return{language:e,t:s.apply(e,arguments)}},keys:function(n){return R(e[t][n]||It)}}}function _t(e,t){Wt.call(this),this.attributes=V(e)||T(e,t||"")}function Wt(){}Ut&&(zt.prototype[Ut]=function(){return this.toString()}),m(_t,Wt,{getCustomAttributes:function(){return C({},this.attributes)}}),m(Wt,{reset:function(){return this},next:function(){},getRef:function(){return k},getClassNames:function(){return[]},getCustomAttributes:function(){return{}},dispose:function(){}}),W(Wt.prototype),u(Wt,{get scrollableTarget(){return new _t("scrollable-target")},get tabRoot(){return new _t("tab-root")},use:function(){var e=j(arguments),t=e[0],n={},r=e.filter((function(e){return e instanceof Wt})),i=r.map((function(e){return e.getRef()}));return!t||t instanceof Wt?t||e.shift():("function"!=typeof t?i.push((function(e){t.current=e})):i.push(t),e.shift()),v(r,(function(e,t){C(n,t.getCustomAttributes())})),C(n,{ref:s(i),className:he.apply(null,e)}),v(r,(function(e,t){t.next()})),n}});var Gt=e.dom,$t=Gt.watchElements,Jt=Gt.watchOwnAttributes,Kt=a(),Xt=new Set;function Yt(){v(Xt,(function(e,t){s(Kt(t).splice(0))()})),Xt.clear()}function Zt(e,t){Kt(this,[e.delete.bind(e,t)]),e.set(t,this)}function en(e){this.mixin=e}function tn(){Wt.call(this),Kt(this,{pending:{},elements:[],states:new Map,flush:_(this,!1),dispose:[]})}function nn(e,t,n,r){var i=n.classNames,o=C({},i);v(i,(function(e){i[e]=t.classList.contains(e)})),r&&!y(n.prev||o,i)&&(n.prev=o,e.onClassNameUpdated(t,o,C({},i)))}function rn(e){tn.call(this),this.classNames=e||[]}m(Zt,{onDispose:function(e){Kt(this).push(B(e))}}),m(en,{getMixin:function(){return this.mixin}}),m(tn,Wt,{get ref(){var e=Kt(this);return e.ref||(e.ref=new en(this))},get state(){return Kt(this).pending},reset:function(){return Kt(this).pending={},this},next:function(){return Kt(this).pending={},this},getRef:function(){var e,t,n=this,r=Kt(n),o=r.pending;return function(s){s?(e=s,t=r.states.get(e)||new Zt(r.states,e),r.elements.push(e),t.element?R(o)[0]&&n.mergeState(e,t,o):n.initElement(e,C(t,n.initState(),o,{element:e})),n.onLayoutEffect(e,t),Xt.delete(t)):t&&(Xt.add(t),n.onBeforeUpdate(e,t),i(r.elements,e)),z(Yt)}},elements:function(){return Kt(this).elements.slice()},onDispose:function(e){Kt(this).dispose.push(e)},initState:function(){return{}},initElement:function(e,t){},mergeState:function(e,t,n){C(t,n)},onLayoutEffect:function(e,t){},onBeforeUpdate:function(e,t){},clone:function(){return this},dispose:function(){var e=Kt(this);v(e.states,(function(e,t){Xt.add(t)})),z(Yt),s(e.dispose.splice(0))(),e.flush(),e.pending={}}}),m(rn,tn,{initElement:function(e,t){var n=this;t.classNames=S(n.classNames,!1),nn(n,e,t),t.onDispose(Jt(e,"class",(function(){nn(n,e,t,!0)})).dispose)},onLayoutEffect:function(e,t){Ae(e,t.classNames)},onBeforeUpdate:function(e,t){nn(this,e,t)},onClassNameUpdated:function(e,t,n){}});var on=rn.prototype;function sn(){rn.call(this,["tweening-in","tweening-out"])}m(sn,rn,{next:function(){var e=this;return e.effects=void 0,e.trigger=void 0,on.next.call(e)},with:function(e){var t=this;return t.effects=e.effects,t.trigger=e.trigger,t},withEffects:function(){return this.effects=j(arguments),this},getCustomAttributes:function(){var e=this;return C(on.getCustomAttributes.call(e),{"animate-in":(e.effects||[]).join(" "),"animate-on":e.trigger||"show"})}});var an=rn.prototype;function un(e){rn.call(this,["tweening-in","tweening-out"]),this.className=e}m(un,rn,{getCustomAttributes:function(){return C(an.getCustomAttributes.call(this),{"is-animate-sequence":""})},getClassNames:function(){return[this.className].concat(an.getClassNames.call(this))}});var cn=c(914),ln=sn.prototype,fn=0;function pn(){var e=this;sn.call(e),e.className="brew-anim-"+ ++fn,e.item=new un(e.className)}function dn(){tn.call(this)}m(pn,sn,{withOptions:function(e){return this.selector=e,this},getCustomAttributes:function(){var e=this;return C(ln.getCustomAttributes.call(e),{"animate-in":null,"animate-sequence-type":(e.effects||[]).join(" "),"animate-sequence":e.selector||"."+e.className})},initElement:function(e,t){var n=this;ln.initElement.call(n,e,t),n.selector&&t.onDispose($t(e,n.selector,(function(e){cn(e).attr("is-animate-sequence","")})).dispose)}}),m(dn,tn,{withOptions:function(e){this.classes=C({},e)},getClassNames:function(){return this.classes},set:function(e,t){t=V(e)||T(e,t),v(this.elements(),(function(e,n){Ae(n,t)})),C(this.classes,t)}});var hn=rn.prototype;function mn(e){rn.call(this,["target-opened"]),this.flyoutMixin=e}function gn(e,t,n,r,i){(t.trigger||"click")===n&&r.apply(e,i)}m(mn,rn,{on:function(e){return this.state.trigger=e,this},open:function(e,t){return this.flyoutMixin.open(e,t)},close:function(e){return this.flyoutMixin.close(e)},toggle:function(e,t){return this.flyoutMixin.toggleSelf(e,t)},initElement:function(e,t){var n=this;hn.initElement.call(n,e,t),t.onDispose(Oe.on(e,{focusin:function(){gn(n,t,"focus",n.open,[null,Oe.activeElement])},focusout:function(){gn(n,t,"focus",n.close,[])},click:function(){gn(n,t,"click",n.toggle,[e])}}))}});var vn=rn.prototype,wn=new WeakMap;function yn(e,t,n,r){if(!t&&!De(e.element))return I();var i=e.getOptions();return t?Le(e.element,n,r,i):Ie(e.element,r,i)}function bn(){var e=this;rn.call(e,["open","closing","visible","tweening-in","tweening-out"]),e.modal=!1,e.tabThrough=!1,e.isFlyoutOpened=!1,e.animating=!1,e.visible=!1,e.initialFocus=void 0,e.toggle=new mn(e),e.onDispose((function(){e.isFlyoutOpened=!1,e.visible=!1,e.toggle.dispose()}))}m(bn,rn,{get element(){return this.elements()[0]||null},getOptions:function(){var e=this,t=D(e,["closeOnBlur","containment"]);return void 0!==e.initialFocus&&(t.focus=e.initialFocus),t},next:function(){return this.effects=void 0,vn.next.call(this)},withEffects:function(){return this.effects=j(arguments),this},getCustomAttributes:function(){var e=this;return C(vn.getCustomAttributes.call(e),{"is-flyout":"","swipe-dismiss":e.swipeToDismiss},e.modal&&{"is-modal":""},e.tabThrough&&{"tab-through":""},e.effects&&{"animate-on":"open","animate-in":e.effects.join(" "),"animate-out":""})},open:function(e,t){return yn(this,!0,e,t)},close:function(e){return ke(this.element,e)},toggleSelf:function(e,t){return"boolean"!=typeof e&&(t=e,e=!De(this.element)),yn(this,e,void 0,t)},onOpen:function(e){return this.onToggleState((function(t){t&&e(wn.get(this.element))}))},onToggleState:function(e){return this.watch("isFlyoutOpened",e)},onVisibilityChanged:function(e){return this.watch("visible",e)},whenVisible:function(e){var t=[];return t[0]=this.watch("visible",(function(n){t[1]=(n?A(e()):t[1]&&void t[1]())||k}),!0),s(t)},initElement:function(e,t){var n=this;n.elements()[1]&&Q("FlyoutMixin only supports single element"),vn.initElement.call(n,e,t),t.onDispose(X.on(e,{flyoutshow:function(t){wn.set(e,t.data),n.isFlyoutOpened=!0,n.visible=!0},flyoutclose:function(){n.isFlyoutOpened=!1},flyouthide:function(){n.visible=!1},animationstart:function(){n.animating=!0},animationcomplete:function(){n.animating=!1}},!0))}});var xn=tn.prototype;function Cn(){tn.call(this)}m(Cn,tn,{for:function(e){return this.state.ref=e,this},initElement:function(e,t){xn.initElement.call(this,e,t);var n=function(n,r){var i=t.ref,o=i&&("string"==typeof i?e.querySelector(i):i.current);o&&!Oe.focused(o)&&n(r||o)};t.onDispose(Oe.on(e,{focusin:function(r){t.focused=r.source,Ae(e,"focused",r.source),n(Oe.focus)},focusout:function(){t.focused=!1,Ae(e,"focused",!1)},focuschange:function(){n(Oe.blur,e)}}))},onLayoutEffect:function(e,t){Ae(e,"focused",t.focused)}});var Sn=G.getDirectiveComponent,Pn=rn.prototype;function En(){rn.call(this,["loading","loading-complete"]),this.loading=!1}m(En,rn,{initElement:function(e,t){var n=this;Pn.initElement.call(n,e,t),Sn(e).enableLoadingClass=!0,t.onDispose(qe(e,(function(t){n.loading=t||!!r(n.elements(),(function(t){return t!==e&&!0===Pe(t,"loading")}))})))}});var Mn=rn.prototype;function An(){var e=this;rn.call(e,["scrollable-x","scrollable-x-l","scrollable-x-r","scrollable-y","scrollable-y-d","scrollable-y-u"]),e.target=Wt.scrollableTarget,e.pageIndex=0,e.scrolling=!1}function Vn(){tn.call(this)}function On(){rn.call(this)}function Nn(e){C(this,e)}function Rn(e){return function(){var t=zn(e);return(t.withOptions||Nn).apply(t,arguments),t}}m(An,rn,{get element(){return this.elements()[0]||null},get contentElement(){var e=this.element;return e&&Sn(e).scrollable.scrollTarget},withOptions:function(e){return this.options=e,this},getCustomAttributes:function(){var e=this.options||{};return C(Mn.getCustomAttributes.call(this),{scrollable:[e.direction||"both",e.handle||"auto"].join(" ")},e.pagedItemSelector&&{"scroller-snap-page":e.paged,"scroller-page":e.pagedItemSelector},e.persistScroll&&{"persist-scroll":""})},onPageIndexChanged:function(e){return this.watch("pageIndex",e)},initElement:function(e,t){var n=this;n.elements()[1]&&Q("ScrollableMixin only supports single element"),Mn.initElement.call(n,e,t),t.onDispose(X.on(e,{scrollIndexChange:function(e){n.pageIndex=e.newIndex},scrollStart:function(){n.scrolling=!0},scrollStop:function(){n.scrolling=!1}},!0))}}),v("destroy enable disable setOptions setStickyPosition refresh scrollPadding stop scrollLeft scrollTop scrollBy scrollTo scrollByPage scrollToPage scrollToElement",(function(e,t){p(An.prototype,t,(function(){return Sn(this.element).scrollable[t].apply(null,arguments)}))})),m(Vn,tn,{when:function(e){return this.state.deps=e,this},initElement:function(e,t){t.callback=function(){Me(e)}},mergeState:function(e,t,n){n.deps&&!y(n.deps,t.deps)&&z(t.callback),C(t,n)}}),m(On,rn,{memorize:function(){return this.classNames=j(arguments),this}});var Tn=Rn(sn),jn=Rn(pn),Fn=Rn(dn),qn=Rn(bn),kn=Rn(Cn),Dn=Rn(En),Ln=Rn(An),In=Rn(Vn),Un=Rn(On);function zn(e){return be((function(){return new e})).reset()}function Hn(e){return e&&e.getMixin().reset()}f(window,"brew-js-react",(function(){return console.warn('window["brew-js-react"] is deprecated, access brew.react instead.'),brew.react}))})(),l})()));
|
|
1
|
+
/*! brew-js-react v0.6.7 | (c) misonou | https://misonou.github.io */
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("zeta-dom"),require("brew-js"),require("react"),require("react-dom"),require("zeta-dom-react"),require("waterpipe"),require("jquery")):"function"==typeof define&&define.amd?define("brew-js-react",["zeta-dom","brew-js","react","react-dom","zeta-dom-react","waterpipe","jquery"],t):"object"==typeof exports?exports["brew-js-react"]=t(require("zeta-dom"),require("brew-js"),require("react"),require("react-dom"),require("zeta-dom-react"),require("waterpipe"),require("jquery")):(e.brew=e.brew||{},e.brew.react=t(e.zeta,e.brew,e.React,e.ReactDOM,e.zeta.react,e.waterpipe,e.jQuery))}(self,((e,t,n,r,i,o,s)=>(()=>{var u={87:e=>{"use strict";e.exports=o},760:e=>{"use strict";e.exports=t},914:e=>{"use strict";e.exports=s},12:e=>{"use strict";e.exports=n},33:e=>{"use strict";e.exports=r},231:t=>{"use strict";t.exports=e},402:e=>{"use strict";e.exports=i},621:(e,t,n)=>{var r,i=n(33);r=i.createRoot?i:{createRoot:(e,t)=>({render(t){i.render(t,e)},unmount(){i.unmountComponentAtNode(e)}}),hydrateRoot:(e,t,n)=>(i.hydrate(t,e),r.createRoot(e,n))},e.exports=r}},a={};function c(e){var t=a[e];if(void 0!==t)return t.exports;var n=a[e]={exports:{}};return u[e](n,n.exports,c),n.exports}c.d=(e,t)=>{for(var n in t)c.o(t,n)&&!c.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},c.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var l={};return(()=>{"use strict";c.r(l),c.d(l,{AnimateMixin:()=>ln,AnimateSequenceItemMixin:()=>pn,AnimateSequenceMixin:()=>gn,ClassNameMixin:()=>an,ClassNameToggleMixin:()=>vn,Dialog:()=>_e,FlyoutMixin:()=>Pn,FlyoutToggleMixin:()=>yn,FocusStateMixin:()=>Mn,LoadingStateMixin:()=>Vn,Mixin:()=>Kt,ScrollIntoViewMixin:()=>Rn,ScrollableMixin:()=>qn,StatefulMixin:()=>sn,StaticAttributeMixin:()=>Jt,UnmanagedClassNameMixin:()=>Tn,ViewContext:()=>pt,ViewStateContainer:()=>zt,createDialog:()=>He,createDialogQueue:()=>Qe,isViewMatched:()=>bt,isViewRendered:()=>xt,linkTo:()=>At,makeTranslation:()=>$t,matchView:()=>Ct,navigateTo:()=>Ot,redirectTo:()=>Vt,registerErrorView:()=>Pt,registerView:()=>St,renderView:()=>Et,resolvePath:()=>Mt,useAnimateMixin:()=>Dn,useAnimateSequenceMixin:()=>kn,useAppReady:()=>Dt,useAppReadyState:()=>kt,useClassNameToggleMixin:()=>Ln,useFlyoutMixin:()=>In,useFocusStateMixin:()=>Un,useLanguage:()=>Gt,useLoadingStateMixin:()=>zn,useMixin:()=>_n,useMixinRef:()=>Wn,useQueryParam:()=>Ut,useRouteParam:()=>Lt,useRouteState:()=>It,useScrollIntoViewMixin:()=>Hn,useScrollableMixin:()=>Bn,useUnmanagedClassNameMixin:()=>Qn,useViewContainerState:()=>yt,useViewContext:()=>yt});var e=c(231),t=e.util,n=t.always,r=t.any,i=t.arrRemove,o=t.catchAsync,s=t.combineFn,u=t.createPrivateStore,a=t.define,f=t.defineGetterProperty,p=t.defineHiddenProperty,h=t.defineObservableProperty,d=t.defineOwnProperty,m=t.definePrototype,g=t.delay,v=t.each,w=t.either,y=t.equal,b=t.exclude,x=t.executeOnce,C=t.extend,S=t.fill,P=t.freeze,E=t.grep,M=t.isArray,A=t.isFunction,O=t.isPlainObject,V=t.isThenable,N=t.isUndefinedOrNull,q=t.keys,R=t.kv,T=t.makeArray,j=t.map,F=t.mapObject,D=t.noop,k=t.pick,L=t.randomId,I=t.resolve,U=t.setImmediate,z=t.setImmediateOnce,B=t.single,H=t.throwNotFunction,Q=t.throws,_=t.watch,W=t.watchable,G=c(760);var $=G.addExtension,J=G.install;const K=G.defaults;var X,Y=[];J("react",$(!0,"react2",["?router","?i18n"],(function(e){X=e,s(Y)(X)}))),K.react=!0;var Z=c(12),ee=Z.Component,te=Z.StrictMode,ne=Z.createContext,re=Z.createElement,ie=Z.useContext,oe=Z.useEffect,se=Z.useLayoutEffect,ue=Z.useMemo,ae=Z.useRef,ce=Z.useState,le=c(33),fe=c(621),pe=c(402),he=pe.ViewStateProvider,de=pe.classNames,me=pe.createAsyncScope,ge=pe.useAsync,ve=pe.useEagerState,we=pe.useMemoizedFunction,ye=pe.useObservableProperty,be=pe.useSingleton,xe=pe.useValueTrigger,Ce=e.util,Se=Ce.containsOrEquals,Pe=Ce.getClass,Ee=Ce.removeNode,Me=Ce.scrollIntoView,Ae=Ce.setClass,Oe=e.dom;const Ve=Oe;var Ne=Oe.reportError,qe=e.dom,Re=qe.lock,Te=qe.preventLeave,je=qe.runAsync,Fe=qe.subscribeAsync,De=G.closeFlyout,ke=G.isFlyoutOpen,Le=G.openFlyout,Ie=G.toggleFlyout,Ue=u();function ze(e,t){var n=document.createElement("div");return Ve.on(n,{flyoutshow:function(){(e.onOpen||D)(n)},flyouthide:function(){Ee(n),(e.onClose||D)(n),(t||D)()}}),n.setAttribute("loading-class",""),Fe(n,!0),n}function Be(e,t,n){Se(Ve.root,e)||(e.className=t.className||"",(n||t.container||document.body).appendChild(e),t.modal&&e.setAttribute("is-modal",""),U((function(){Ve.retainFocus(Ve.activeElement,e)})));var r=Le(e,null,k(t,["focus","closeOnBlur"]));return t.preventLeave?Te(e,r):t.preventNavigation&&Re(e,r),r}function He(e){var t,r,i=Ue(e.controller)||{},o="shared"===i.mode,s=o?i:{},u=s.root||(s.root=ze(e,(function(){a.unmount()}))),a=s.reactRoot||(s.reactRoot=fe.createRoot(u)),c=s.scope||(s.scope=me(u)),l=o?D:De.bind(0,u);function f(e,t,n){var r=t.onCommit?function(n){return je(Ve.activeElement,t.onCommit.bind(this,n)).then(e)}:e,i=C({},t,{errorHandler:c.errorHandler,closeDialog:r,commitDialog:r,dismissDialog:e}),s=re(t.onRender,i);return t.wrapper&&(s=re(t.wrapper,i,s)),a.render(re(te,null,re(c.Provider,null,s))),o?{then:D}:Be(u,t,n)}return{root:u,close:function(e){return l(e)},open:(t=function(){return i.enqueue?i.enqueue((function(t){f(l=o?t:l,C({},i.props,e),i.root).then(t)})):f(l,e)},function(){return r||(r=t.apply(this,arguments),n(r,(function(){r=null}))),r})}}function Qe(e){var t,n=e&&e.mode,r=n&&ze(e),o="multiple"===n,u=[],a=[],c={},l=h(c,"pendingCount",0,!0);function f(){s(u.splice(0))(),l(0)}function p(e){s(a.splice(0))(o?void 0:e),f()}function d(e){return new Promise((function(t){a.push(t),l(u.length),e((function(e){return i(a,t)&&(t(e),U((function(){(u.shift()||D)(!0)}))),!r||u[0]||a[0]?I():De(r)}))}))}return o?e=C({},e,t={closeOnBlur:!1}):t=e&&k(e,["className","focus","modal","container"]),Ue(c,{root:r,mode:n,props:t,enqueue:function(t){return r&&!ke(r)&&Be(r,e).then(p),u.length||a.length>=(o?e.concurrent||1/0:1)?new Promise((function(e){u.push((function(n){e(n&&d(t))})),l(u.length)})):d(t)}}),C(c,{dismissAll:p,dismissPending:f})}function _e(e){var t=C(ce({})[0],e),n=ce((function(){return ze(t)}))[0];return oe((function(){var e=ke(n);w(e,t.isOpen)&&(e?De(n):Be(n,t))}),[t.isOpen]),oe((function(){return De.bind(0,n)}),[]),le.createPortal(e.children,n)}var We,Ge,$e=e.EventContainer,Je=G.getQueryParam,Ke=G.setQueryParam,Xe=G.toQueryString,Ye=G.parsePath,Ze=G.removeQueryAndHash,et=G.animateIn,tt=G.animateOut,nt=u(),rt=Ve.root,it=new Map,ot={},st=[],ut=new $e,at=P(C(new pt,{container:rt})),ct=nt(at),lt=ne(at),ft={waitFor:D};function pt(e,t,n){var r=this;d(r,"view",e||null,!0),d(r,"parent",n||null,!0),nt(r,{children:[],setPage:h(r,"page",t||null,!0),setActive:h(r,"active",!!t,!0)}),_(r,"page",(function(e,t){ut.emit("pagechange",r,{page:e,previousPage:t,navigationType:ft.navigationType,waitFor:ft.waitFor})}))}function ht(e){ee.call(this,e),this.state={},nt(e.context).wrapper=this}function dt(){ee.apply(this,arguments),this.views=[]}function mt(e,t){return N(e)||""===e||e===t?"":e[0]===t?e:t+e}function gt(e,t){return(it.get(t)||{}).matchCount-(it.get(e)||{}).matchCount}function vt(e,t){var n=it.get(e);return!!n&&!B(n.matchers,(function(e,n){var r=t[n]||"";return A(e)?!e(r):(e||"")!==r}))}function wt(e){var t;return H(e),e.prototype instanceof ee&&(e=re.bind(null,e)),function(n){var r=t||e(n.viewProps);if(!V(r))return se(n.onLoad,[]),r;o(t=r);var i=ge((function(){return t.then(null,(function(e){t=null,n.onError(e)}))}))[0];return i&&n.onLoad(),i?re(i.default,n.viewProps):n.self.currentContext===n.context&&n.loader||null}}function yt(){return ie(lt)}function bt(e){var t=X.route;return vt(e,t)&&Mt(e,t)===t.toString()}function xt(e){return!!(it.get(e)||"").rendered}function Ct(){var e=T(arguments),t=X.route;return"string"==typeof e[0]&&(t=t.parse(e.shift())),e=e[0]?(M(e[0])?T(e[0]):e).sort(gt):st,r(e,(function(e){return vt(e,t)}))||void 0}function St(e,t){var n=wt(e);return t=C({},t),v(t,(function(e,n){ot[e]=!0,n instanceof RegExp&&(t[e]=n.test.bind(n))})),it.set(n,{id:L(),rendered:0,matchCount:q(t).length,matchers:t,params:k(t,(function(e){return N(e)||"string"==typeof e}))}),st.push(n),st.sort(gt),n}function Pt(e){We=H(e)}function Et(){var e=T(arguments),t=A(e[0])?{}:e.shift(),n=e[0];return v(e,(function(e,t){if(!it.has(t))throw new Error("Invalid argument to renderView: "+(A(t)?t.name:t))})),e.sort(gt),re(dt,{rootProps:t,views:e,defaultView:n})}function Mt(e,t){var n="";return M(t)&&(n=mt(O(t[1])?Xe(t[1]):t[1],"?")+mt(t[2],"#"),t=t[0]),(it.has(e)?X.route.getPath(function(e,t){var n=it.get(e);if(!n.maxParams){var i=b(n.matchers,["remainingSegments"]),o=j(X.routes,(function(e){var t=X.parseRoute(e),n=t.length&&!r(i,(function(e,n){var r=t.params[n];return(e?!(r>=0):r<t.minLength)||!A(e)&&!t.match(n,e)}));return n?t:null}));if(o[1]&&(o=E(o,(function(e){return!B(e.params,(function(e,t){return ot[t]&&!i[t]}))}))),o[0]){var s=o.slice(-1)[0];n.maxParams=q(C.apply(0,[{remainingSegments:!0}].concat(o.map((function(e){return e.params}))))),n.minParams=j(s.params,(function(e,t){return n.params[t]||e>=s.minLength?null:t}))}}return C(k(X.route,n.minParams),t&&k(t,n.maxParams),n.params)}(e,t)):"/")+n}function At(e,t){return X.toHref(Mt(e,t))}function Ot(e,t,n,r){return X.navigate(Mt(e,t),r,n&&P(C({},n)))}function Vt(e,t,n){return Ot(e,t,n,!0)}Ge=function(){X.on("beforepageload",(function(e){ct.setPage(X.page),ct.setActive(!0),ft=e,function t(n){v(n.children,(function(n,r){e.waitFor(new Promise((function(e){r.onRender=e,r.forceUpdate()})).then((function(){t(r)})))}))}(ct)})),ct.setPage(X.page)},X?Ge(X):Y.push(H(Ge)),d(pt,"root",at,!0),m(pt,{getChildren:function(){return j(nt(this).children,(function(e){return e.currentContext}))},setErrorView:function(e,t){var n=nt(this).wrapper;return n&&e&&!n.setState({error:t,errorView:e})},on:function(e,t){return ut.add(this,e,t)}}),m(ht,ee,{componentDidMount:function(){var e=this;e.componentWillUnmount=_(e.props.context,"page",(function(){e.state.errorView=null,e.forceUpdate()}))},componentDidCatch:function(e){var t=this;We&&t.state.errorView!==We?t.setState({error:e,errorView:We}):(t.props.onLoad(),Ne(e,t.props.context.container))},render:function(){var e=this,t=e.props.context;if(!t.container)return U((function(){C(e,me(t.container)),Ve.on(t.container,"error",(function(e){return ut.emit(e,t,{error:e.error},!1)})),e.forceUpdate()})),null;if(e.state.errorView)return e.props.onLoad(),re(e.Provider,null,re(e.state.errorView,{view:t.view,error:e.state.error,reset:e.reset.bind(e)}));var n=e.componentDidCatch.bind(e),r={errorHandler:e.errorHandler,navigationType:ft.navigationType,viewContext:t,viewData:t.page.data||{}};return re(e.Provider,null,re(t.view,C({viewProps:r,onError:n},e.props)))},reset:function(){this.setState({errorView:null})}}),dt.contextType=lt,m(dt,ee,{componentDidMount:function(){var e=this,t=nt(e.context).children,n=_(X.route,(function(){e.setActive(e.getViewComponent()===(e.currentContext||"").view)}));e.componentWillUnmount=function(){e.setActive(!1),i(t,e),n(),U((function(){e.currentContext&&!e.currentContext.active&&e.unmountView()}))},t.push(e),e.setActive(!0)},componentDidUpdate:function(e){(e.rootProps.ref||{}).current=null,this.setContext(this.currentContext)},setContext:function(e){this.currentContext=e,(this.props.rootProps.ref||{}).current=e},render:function(){var e=this;return e.context.active&&e.updateView(),e.onRender(),e.views},updateView:function(){var e=this,t=e.getViewComponent(),r=t!==(e.currentContext||"").view;if(t&&(r||!(e.children||"")[0])){var i=Mt(t,X.route);if(i!==Ze(X.path))return void X.navigate(i,!0)}var o=it.get(t)||{};if((e.views[2]||"").key!==o.id){if(e.views[2]=null,e.abort(),!t||!r)return e.setActive(!0),void e.setPage(X.page);ft.waitFor(new Promise((function(r){var i=new pt(t,X.page,e.context),s=e.props.rootProps,u=x((function(t){d(i,"container",t,!0),Ve.on(t,"error",(function(t){i!==e.currentContext&&t.handled()})),e.setContext(e.currentContext||i)})),a=x((function(){var s=i.container,u=e.unmountView();e.unmountView=x((function(){return o.rendered--,e.setActive(!1),X.emit("pageleave",s,{pathname:i.page.path,view:t},!0),tt(s,"show").then((function(){e.views[0]=null,e.forceUpdate()}))})),n(u,g).then((function(){X.emit("pageenter",s,{pathname:i.page.path,view:t},!0)})),e.views.shift(),e.setContext(i),C(e,nt(i)),o.rendered++,et(s,"show","[brew-view]",!0),r()}));i.on("error",(function(){return(e.props.rootProps.onError||D).apply(this,arguments)})),e.abort=r,e.views[2]=re(lt.Provider,{key:o.id,value:i},re(zt,null,re("div",C(b(s,["loader","onError"]),{ref:u,"brew-view":""}),re(ht,{onLoad:a,context:i,self:e,loader:s.loader}))))})))}},getViewComponent:function(){var e=this.props;return r(e.views,(function(e){return vt(e,X.route)}))||e.defaultView}}),S(dt.prototype,"abort onRender setActive setPage unmountView",D);var Nt=new $e;function qt(){return X.historyStorage.current}function Rt(e,t){this.key=e,this.store=qt(),this.dispose=t}function Tt(e,t,n,r){return e.get(t)!==n&&(r&&e.has(t)&&(X.snapshot(),e=qt()),e.set(t,n)),e}function jt(e,t,n){var r=e.get();(t!==e.key||n!==e.store&&n.has(t))&&(r=n.get(t),Nt.emit("popstate",e,{newValue:r})),e.key=t,e.store=n,n.set(t,r)}function Ft(e,t){var n=yt();return oe((function(){return X.on("beforepageload popstate",(function(){n.active&&e(qt())}))}),t),n}function Dt(){return kt().ready}function kt(){var e=ye(X,"readyState");return{ready:"ready"===e,error:"error"===e}}function Lt(e,t){var n=yt(),r=n.page.params,i=r[e]||"",o=xe(i);return oe((function(){var t=function(){o(n.page.params[e]||"")};return t(),n.on("pagechange",t)}),[e]),t&&n.active&&(!i||"remainingSegments"===e&&"/"===i)&&X.navigate(X.route.getPath(C({},r,R(e,t))),!0),i}function It(e,t,n){var r=qt(),i=ve(r&&r.has(e)?r.get(e):t),o=Ft((function(t){i[1]((function(n){return t.has(e)?t.get(e):(t.set(e,n),n)}))}),[e]);return r?o.active&&Tt(r,e,i[0],n):X.beforeInit(g(1)),i}function Ut(e,t,n){O(e)&&(n=t,t=e,e=!1);var r=yt(),i=function(){return P(F(!1===e?t:R(e,t),(function(e,t){return Je(t,X.path)||e||""})))},s=ae({});ue((function(){s.current=i()}),[e]);var u=s.current,a=xe(u,(function(e,t){return y(e,t)||!(s.current=t)})),c=we((function(t){var u=s.current;if(!1!==e?t=R(e,A(t)?t(u[e]):t):A(t)&&(t=t(C({},u))),r.active){var c=Ye(X.path),l=q(t).reduce((function(e,n){return t[n]!==u[n]?Ke(n,t[n]||null,e):e}),c.search);l!==c.search&&(n&&X.snapshot(),o(X.navigate((l||"?")+c.hash,!0)),a(i()))}}));return oe((function(){return X.watch("path",(function(){r.active&&a(i())}))}),[e]),[!1!==e?u[e]:u,c]}function zt(e){var t=ce({})[0],n=Ft((function(e){v(t,(function(t,n){jt(n,n.key,e)}))}),[]),r=ce((function(){return{getState:function(e,r){var i=t[e];return i&&n.active&&jt(i,r,qt()),i||(t[e]=new Rt(r,(function(){delete t[e]})))}}}))[0];return re(he,{value:r},e.children)}m(Rt,{get:function(){return this.store.get(this.key)},set:function(e,t){this.store=Tt(this.store,this.key,e,t)},onPopState:function(e){return H(e),Nt.add(this,"popstate",(function(t){e.call(this,t.newValue)}))}});var Bt=c(87),Ht=Object.create(null),Qt="function"==typeof Symbol&&Symbol.toPrimitive;function _t(e){this.toString=e}function Wt(e){return C((function(t,n,r){var i=e(t,n,r,!0);return void 0!==i?i:t}),{html:function(t,n,r){return{__html:e(t,n,r)}},lazy:function(t,n,r){return new _t(e.bind(0,t,n,r,!0))}})}function Gt(){return ye(X,"language")}function $t(e,t){var n=new RegExp("^("+Object.keys(e[t]).join("|")+")\\."),r={};function i(n,r,o,s,u){var a=((e[u]||Ht)[n]||Ht)[r];return"string"==typeof a?!a||s&&void 0===o?a:Bt(a,o,{noEncode:s}):u!==t?i(n,r,o,s,t):void 0}function o(e,t,r,o){var s=n.test(e)?RegExp.$1:"";return i(s,s?e.slice(RegExp.lastMatch.length):e,t,o,r||X.language)}function s(){var e=String(this),t=T(arguments),n=e+" "+t.join(" ");return r[n]||(r[n]=t[0]?Wt((function(n,r,o,s){return o=o||e||X.language,B(t,(function(e){return i(e,n,r,s,o)}))})):Wt((function(t,n,r,i){return o(t,n,r||e,i)})))}return{translate:Wt(o),getTranslation:s.bind(""),useTranslation:function(){var e=Gt();return{language:e,t:s.apply(e,arguments)}},keys:function(n){return q(e[t][n]||Ht)}}}function Jt(e,t){Kt.call(this),this.attributes=O(e)||R(e,t||"")}function Kt(){}Qt&&(_t.prototype[Qt]=function(){return this.toString()}),m(Jt,Kt,{getCustomAttributes:function(){return C({},this.attributes)}}),m(Kt,{reset:function(){return this},next:function(){},getRef:function(){return D},getClassNames:function(){return[]},getCustomAttributes:function(){return{}},dispose:function(){}}),W(Kt.prototype),a(Kt,{get scrollableTarget(){return new Jt("scrollable-target")},get tabRoot(){return new Jt("tab-root")},use:function(){var e=T(arguments),t=e[0],n={},r=e.filter((function(e){return e instanceof Kt})),i=r.map((function(e){return e.getRef()}));return!t||t instanceof Kt?t||e.shift():("function"!=typeof t?i.push((function(e){t.current=e})):i.push(t),e.shift()),v(r,(function(e,t){C(n,t.getCustomAttributes())})),C(n,{ref:s(i),className:de.apply(null,e)}),v(r,(function(e,t){t.next()})),n}});var Xt=e.dom,Yt=Xt.watchElements,Zt=Xt.watchOwnAttributes,en=u(),tn=new Set;function nn(){v(tn,(function(e,t){s(en(t).splice(0))()})),tn.clear()}function rn(e,t){en(this,[e.delete.bind(e,t)]),e.set(t,this)}function on(e){this.mixin=e}function sn(){Kt.call(this),en(this,{pending:{},elements:[],states:new Map,flush:_(this,!1),dispose:[]})}function un(e,t,n,r){var i=n.classNames,o=C({},i);v(i,(function(e){i[e]=t.classList.contains(e)})),r&&!y(n.prev||o,i)&&(n.prev=o,e.onClassNameUpdated(t,o,C({},i)))}function an(e){sn.call(this),this.classNames=e||[]}m(rn,{onDispose:function(e){en(this).push(H(e))}}),m(on,{getMixin:function(){return this.mixin}}),m(sn,Kt,{get ref(){var e=en(this);return e.ref||(e.ref=new on(this))},get state(){return en(this).pending},reset:function(){return en(this).pending={},this},next:function(){return en(this).pending={},this},getRef:function(){var e,t,n=this,r=en(n),o=r.pending;return function(s){s?(e=s,t=r.states.get(e)||new rn(r.states,e),r.elements.push(e),t.element?q(o)[0]&&n.mergeState(e,t,o):n.initElement(e,C(t,n.initState(),o,{element:e})),n.onLayoutEffect(e,t),tn.delete(t)):t&&(tn.add(t),n.onBeforeUpdate(e,t),i(r.elements,e)),z(nn)}},elements:function(){return en(this).elements.slice()},onDispose:function(e){en(this).dispose.push(e)},initState:function(){return{}},initElement:function(e,t){},mergeState:function(e,t,n){C(t,n)},onLayoutEffect:function(e,t){},onBeforeUpdate:function(e,t){},clone:function(){return this},dispose:function(){var e=en(this);v(e.states,(function(e,t){tn.add(t)})),z(nn),s(e.dispose.splice(0))(),e.flush(),e.pending={}}}),m(an,sn,{initElement:function(e,t){var n=this;t.classNames=S(n.classNames,!1),un(n,e,t),t.onDispose(Zt(e,"class",(function(){un(n,e,t,!0)})).dispose)},onLayoutEffect:function(e,t){Ae(e,t.classNames)},onBeforeUpdate:function(e,t){un(this,e,t)},onClassNameUpdated:function(e,t,n){}});var cn=an.prototype;function ln(){an.call(this,["tweening-in","tweening-out"])}m(ln,an,{next:function(){var e=this;return e.effects=void 0,e.trigger=void 0,cn.next.call(e)},with:function(e){var t=this;return t.effects=e.effects,t.trigger=e.trigger,t},withEffects:function(){return this.effects=T(arguments),this},getCustomAttributes:function(){var e=this;return C(cn.getCustomAttributes.call(e),{"animate-in":(e.effects||[]).join(" "),"animate-on":e.trigger||"show"})}});var fn=an.prototype;function pn(e){an.call(this,["tweening-in","tweening-out"]),this.className=e}m(pn,an,{getCustomAttributes:function(){return C(fn.getCustomAttributes.call(this),{"is-animate-sequence":""})},getClassNames:function(){return[this.className].concat(fn.getClassNames.call(this))}});var hn=c(914),dn=ln.prototype,mn=0;function gn(){var e=this;ln.call(e),e.className="brew-anim-"+ ++mn,e.item=new pn(e.className)}function vn(){sn.call(this)}m(gn,ln,{withOptions:function(e){return this.selector=e,this},getCustomAttributes:function(){var e=this;return C(dn.getCustomAttributes.call(e),{"animate-in":null,"animate-sequence-type":(e.effects||[]).join(" "),"animate-sequence":e.selector||"."+e.className})},initElement:function(e,t){var n=this;dn.initElement.call(n,e,t),n.selector&&t.onDispose(Yt(e,n.selector,(function(e){hn(e).attr("is-animate-sequence","")})).dispose)}}),m(vn,sn,{withOptions:function(e){this.classes=C({},e)},getClassNames:function(){return this.classes},set:function(e,t){t=O(e)||R(e,t),v(this.elements(),(function(e,n){Ae(n,t)})),C(this.classes,t)}});var wn=an.prototype;function yn(e){an.call(this,["target-opened"]),this.flyoutMixin=e}function bn(e,t,n,r,i){(t.trigger||"click")===n&&r.apply(e,i)}m(yn,an,{on:function(e){return this.state.trigger=e,this},open:function(e,t){return this.flyoutMixin.open(e,t)},close:function(e){return this.flyoutMixin.close(e)},toggle:function(e,t){return this.flyoutMixin.toggleSelf(e,t)},initElement:function(e,t){var n=this;wn.initElement.call(n,e,t),t.onDispose(Ve.on(e,{focusin:function(){bn(n,t,"focus",n.open,[null,Ve.activeElement])},focusout:function(){bn(n,t,"focus",n.close,[])},click:function(){bn(n,t,"click",n.toggle,[e])}}))}});var xn=an.prototype,Cn=new WeakMap;function Sn(e,t,n,r){if(!t&&!ke(e.element))return I();var i=e.getOptions();return t?Le(e.element,n,r,i):Ie(e.element,r,i)}function Pn(){var e=this;an.call(e,["open","closing","visible","tweening-in","tweening-out"]),e.modal=!1,e.tabThrough=!1,e.isFlyoutOpened=!1,e.animating=!1,e.visible=!1,e.initialFocus=void 0,e.toggle=new yn(e),e.onDispose((function(){e.isFlyoutOpened=!1,e.visible=!1,e.toggle.dispose()}))}m(Pn,an,{get element(){return this.elements()[0]||null},getOptions:function(){var e=this,t=k(e,["closeOnBlur","containment"]);return void 0!==e.initialFocus&&(t.focus=e.initialFocus),t},next:function(){return this.effects=void 0,xn.next.call(this)},withEffects:function(){return this.effects=T(arguments),this},getCustomAttributes:function(){var e=this;return C(xn.getCustomAttributes.call(e),{"is-flyout":"","swipe-dismiss":e.swipeToDismiss},e.modal&&{"is-modal":""},e.tabThrough&&{"tab-through":""},e.effects&&{"animate-on":"open","animate-in":e.effects.join(" "),"animate-out":""})},open:function(e,t){return Sn(this,!0,e,t)},close:function(e){return De(this.element,e)},toggleSelf:function(e,t){return"boolean"!=typeof e&&(t=e,e=!ke(this.element)),Sn(this,e,void 0,t)},onOpen:function(e){return this.onToggleState((function(t){t&&e(Cn.get(this.element))}))},onToggleState:function(e){return this.watch("isFlyoutOpened",e)},onVisibilityChanged:function(e){return this.watch("visible",e)},whenVisible:function(e){var t=[];return t[0]=this.watch("visible",(function(n){t[1]=(n?A(e()):t[1]&&void t[1]())||D}),!0),s(t)},initElement:function(e,t){var n=this;n.elements()[1]&&Q("FlyoutMixin only supports single element"),xn.initElement.call(n,e,t),t.onDispose(X.on(e,{flyoutshow:function(t){Cn.set(e,t.data),n.isFlyoutOpened=!0,n.visible=!0},flyoutclose:function(){n.isFlyoutOpened=!1},flyouthide:function(){n.visible=!1},animationstart:function(){n.animating=!0},animationcomplete:function(){n.animating=!1}},!0))}});var En=sn.prototype;function Mn(){sn.call(this)}m(Mn,sn,{for:function(e){return this.state.ref=e,this},initElement:function(e,t){En.initElement.call(this,e,t);var n=function(n,r){var i=t.ref,o=i&&("string"==typeof i?e.querySelector(i):i.current);o&&!Ve.focused(o)&&n(r||o)};t.onDispose(Ve.on(e,{focusin:function(r){t.focused=r.source,Ae(e,"focused",r.source),n(Ve.focus)},focusout:function(){t.focused=!1,Ae(e,"focused",!1)},focuschange:function(){n(Ve.blur,e)}}))},onLayoutEffect:function(e,t){Ae(e,"focused",t.focused)}});var An=G.getDirectiveComponent,On=an.prototype;function Vn(){an.call(this,["loading","loading-complete"]),this.loading=!1}m(Vn,an,{initElement:function(e,t){var n=this;On.initElement.call(n,e,t),An(e).enableLoadingClass=!0,t.onDispose(Fe(e,(function(t){n.loading=t||!!r(n.elements(),(function(t){return t!==e&&!0===Pe(t,"loading")}))})))}});var Nn=an.prototype;function qn(){var e=this;an.call(e,["scrollable-x","scrollable-x-l","scrollable-x-r","scrollable-y","scrollable-y-d","scrollable-y-u"]),e.target=Kt.scrollableTarget,e.pageIndex=0,e.scrolling=!1}function Rn(){sn.call(this)}function Tn(){an.call(this)}function jn(e){C(this,e)}function Fn(e){return _n.bind(0,e)}m(qn,an,{get element(){return this.elements()[0]||null},get contentElement(){var e=this.element;return e&&An(e).scrollable.scrollTarget},withOptions:function(e){return this.options=e,this},getCustomAttributes:function(){var e=this.options||{};return C(Nn.getCustomAttributes.call(this),{scrollable:[e.direction||"both",e.handle||"auto"].join(" ")},e.pagedItemSelector&&{"scroller-snap-page":e.paged,"scroller-page":e.pagedItemSelector},e.persistScroll&&{"persist-scroll":""})},onPageIndexChanged:function(e){return this.watch("pageIndex",e)},initElement:function(e,t){var n=this;n.elements()[1]&&Q("ScrollableMixin only supports single element"),Nn.initElement.call(n,e,t),t.onDispose(X.on(e,{scrollIndexChange:function(e){n.pageIndex=e.newIndex},scrollStart:function(){n.scrolling=!0},scrollStop:function(){n.scrolling=!1}},!0))}}),v("destroy enable disable setOptions setStickyPosition refresh scrollPadding stop scrollLeft scrollTop scrollBy scrollTo scrollByPage scrollToPage scrollToElement",(function(e,t){p(qn.prototype,t,(function(){return An(this.element).scrollable[t].apply(null,arguments)}))})),m(Rn,sn,{when:function(e){return this.state.deps=e,this},initElement:function(e,t){t.callback=function(){Me(e)}},mergeState:function(e,t,n){n.deps&&!y(n.deps,t.deps)&&z(t.callback),C(t,n)}}),m(Tn,an,{memorize:function(){return this.classNames=T(arguments),this}});var Dn=Fn(ln),kn=Fn(gn),Ln=Fn(vn),In=Fn(Pn),Un=Fn(Mn),zn=Fn(Vn),Bn=Fn(qn),Hn=Fn(Rn),Qn=Fn(Tn);function _n(e,t){var n=be((function(){return new e}),[]).reset();return(n.withOptions||jn).call(n,t),n}function Wn(e){return e&&e.getMixin().reset()}f(window,"brew-js-react",(function(){return console.warn('window["brew-js-react"] is deprecated, access brew.react instead.'),brew.react}))})(),l})()));
|
|
3
3
|
//# sourceMappingURL=brew-js-react.min.js.map
|