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