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