brew-js-react 0.4.1 → 0.4.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/dist/brew-js-react.js +62 -12
- package/dist/brew-js-react.js.map +1 -1
- package/dist/brew-js-react.min.js +2 -2
- package/dist/brew-js-react.min.js.map +1 -1
- package/mixin.d.ts +5 -1
- package/mixin.js +4 -1
- package/mixins/ClassNameMixin.js +56 -56
- package/mixins/ScrollIntoViewMixin.d.ts +5 -0
- package/mixins/ScrollIntoViewMixin.js +21 -0
- package/package.json +1 -1
- package/view.d.ts +27 -1
- package/view.js +26 -3
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! brew-js-react v0.4.
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("brew-js"),require("react"),require("react-dom"),function(){try{return require("react-dom/client")}catch(e){}}(),require("zeta-dom"),require("zeta-dom-react"),require("waterpipe"),require("jQuery")):"function"==typeof define&&define.amd?define("brew-js-react",["brew-js","react","react-dom","react-dom/client","zeta-dom","zeta-dom-react","waterpipe","jQuery"],t):"object"==typeof exports?exports["brew-js-react"]=t(require("brew-js"),require("react"),require("react-dom"),function(){try{return require("react-dom/client")}catch(e){}}(),require("zeta-dom"),require("zeta-dom-react"),require("waterpipe"),require("jQuery")):e["brew-js-react"]=t(e.brew,e.React,e.ReactDOM,e["react-dom/client"],e.zeta,e["zeta-dom-react"],e.waterpipe,e.jQuery)}(self,(function(e,t,n,r,i,o,a,s){return(()=>{var u={145:e=>{"use strict";e.exports=s},715:e=>{"use strict";if(void 0===r){var t=new Error("Cannot find module 'react-dom/client'");throw t.code="MODULE_NOT_FOUND",t}e.exports=r},28:e=>{"use strict";e.exports=a},103:e=>{"use strict";e.exports=o},80:t=>{"use strict";t.exports=e},359:e=>{"use strict";e.exports=t},318:e=>{"use strict";e.exports=n},654:e=>{"use strict";e.exports=i},662:(e,t,n)=>{var r,i=n(318);try{r=n(715)}catch(e){r={createRoot:(e,t)=>({render(t){i.render(t,e)},unmount(){i.unmountComponentAtNode(e)}}),hydrateRoot:(e,t,n)=>(i.hydrate(t,e),{render(t){i.render(t,e)},unmount(){i.unmountComponentAtNode(e)}})}}e.exports=r}},c={};function l(e){var t=c[e];if(void 0!==t)return t.exports;var n=c[e]={exports:{}};return u[e](n,n.exports,l),n.exports}l.d=(e,t)=>{for(var n in t)l.o(t,n)&&!l.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),l.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var f={};return(()=>{"use strict";l.d(f,{default:()=>Gt});var e={};l.r(e),l.d(e,{AnimateMixin:()=>vt,AnimateSequenceItemMixin:()=>wt,AnimateSequenceMixin:()=>Ct,ClassNameMixin:()=>ht,Dialog:()=>pe,FlyoutMixin:()=>Mt,FlyoutToggleMixin:()=>Pt,FocusStateMixin:()=>Rt,LoadingStateMixin:()=>Tt,Mixin:()=>st,ScrollableMixin:()=>Ft,StatefulMixin:()=>pt,ViewStateContainer:()=>Xe,createDialog:()=>fe,default:()=>Ht,isViewMatched:()=>qe,linkTo:()=>We,makeTranslation:()=>ot,matchView:()=>De,navigateTo:()=>_e,redirectTo:()=>Be,registerErrorView:()=>Le,registerView:()=>ke,renderView:()=>Ue,resolvePath:()=>ze,useAnimateMixin:()=>kt,useAnimateSequenceMixin:()=>Lt,useAppReady:()=>Ze,useAppReadyState:()=>$e,useFlyoutMixin:()=>Ut,useFocusStateMixin:()=>zt,useLanguage:()=>it,useLoadingStateMixin:()=>Wt,useMixin:()=>Bt,useMixinRef:()=>Qt,useRouteParam:()=>Je,useRouteState:()=>Ke,useScrollableMixin:()=>_t,useViewContainerState:()=>Fe});var t=l(80);const n=t;var r=t.install;t.addExtension,t.addDetect,t.isElementActive;const i=n;var o=l(359),a=l(318);const s=l(662);var u=l(654),c=u.util,p=c.noop,m=c.pipe,d=c.either,h=(c.is,c.isUndefinedOrNull),g=(c.isArray,c.isFunction),v=c.isThenable,y=(c.isPlainObject,c.isArrayLike,c.makeArray),w=c.extend,b=c.each,x=c.map,C=c.grep,S=(c.splice,c.any),P=c.single,E=c.kv,A=(c.fill,c.pick),O=c.exclude,M=(c.mapObject,c.mapGet,c.mapRemove,c.arrRemove,c.setAdd),N=c.equal,R=c.combineFn,V=c.executeOnce,T=c.createPrivateStore,j=(c.setTimeout,c.setTimeoutOnce,c.setInterval,c.setIntervalSafe,c.setImmediate),I=c.setImmediateOnce,F=(c.throws,c.throwNotFunction),q=(c.errorWithCode,c.isErrorWithCode,c.keys),D=c.values,k=(c.hasOwnProperty,c.getOwnPropertyDescriptors,c.define),L=c.definePrototype,U=(c.defineOwnProperty,c.defineGetterProperty,c.defineHiddenProperty),z=c.defineAliasProperty,W=c.defineObservableProperty,_=c.watch,B=(c.watchOnce,c.watchable),Q=c.inherit,H=c.freeze,G=(c.deepFreeze,c.iequal,c.randomId),Z=(c.repeat,c.camel,c.hyphenate,c.ucfirst,c.lcfirst,c.trim,c.matchWord,c.htmlDecode,c.resolve,c.reject,c.always),$=(c.resolveAll,c.retryable,c.deferrable,c.catchAsync),J=(c.setPromiseTimeout,c.delay,c.makeAsync),K=u.util,X=(K.domReady,K.tagName,K.isVisible,K.matchSelector,K.comparePosition,K.connected,K.containsOrEquals),Y=(K.acceptNode,K.combineNodeFilters,K.iterateNode,K.iterateNodeToArray,K.getCommonAncestor,K.parentsAndSelf,K.selectIncludeSelf,K.selectClosestRelative,K.createNodeIterator,K.createTreeWalker,K.bind),ee=(K.bindUntil,K.dispatchDOMMouseEvent,K.removeNode),te=(K.getClass,K.setClass);K.getScrollOffset,K.getScrollParent,K.getContentRect,K.scrollBy,K.scrollIntoView,K.makeSelection,K.getRect,K.getRects,K.toPlainRect,K.rectEquals,K.rectCovers,K.rectIntersects,K.pointInRect,K.mergeRect,K.elementFromPoint;const ne=u.dom;var re=u.dom;re.textInputAllowed,re.beginDrag,re.beginPinchZoom,re.insertText,re.getShortcut,re.setShortcut,re.focusable,re.focused,re.setModal,re.releaseModal,re.retainFocus,re.releaseFocus,re.iterateFocusPath,re.focus;const ie=ne;var oe=u.dom,ae=oe.lock,se=(oe.locked,oe.cancelLock,oe.subscribeAsync,oe.notifyAsync),ue=oe.preventLeave,ce=(t.addAsyncAction,t.closeFlyout),le=t.openFlyout;function fe(e){var t,n=document.createElement("div"),r=s.createRoot(n),i=ce.bind(0,n);return ie.on(n,"flyouthide",(function(){ee(n),(e.onClose||p)(n),e.onRender&&r.unmount()})),{root:n,close:i,open:function(){if(t)return t;if(n.className=e.className||"",document.body.appendChild(n),ie.retainFocus(ie.activeElement,n),e.modal&&(n.setAttribute("is-modal",""),ie.setModal(n)),e.onRender){var a=w({},e,{closeDialog:function(t){var n=J(e.onCommit||m)(t);$(ae(ie.activeElement,n)),n.then(i,p)}}),s=(0,o.createElement)(e.onRender,a);e.wrapper&&(s=(0,o.createElement)(e.wrapper,a,s)),r.render(s)}return t=le(n),e.preventLeave?ue(n,t):e.preventNavigation&&ae(n,t),Z(t,(function(){t=null})),(e.onOpen||p)(n),t}}}function pe(e){var t=(0,o.useState)({})[0],n=(0,o.useState)((function(){return fe(t)}))[0];return w(t,e),(0,o.useEffect)((function(){var e=X(ie.root,n.root);d(e,t.isOpen)&&(e?n.close():n.open())}),[t.isOpen]),(0,o.useEffect)((function(){return n.close}),[n]),a.createPortal(e.children,n.root)}var me=l(103),de=u.EventContainer;const he=t.defaults;var ge,ve=[];r("react",(function(e){ge=e,R(ve)(ge)})),he.react=!0;var ye,we,be=t.animateIn,xe=t.animateOut,Ce=(t.addAnimateIn,t.addAnimateOut,t.setBaseUrl,t.combinePath,t.parsePath,t.normalizePath,t.removeQueryAndHash),Se=(t.withBaseUrl,t.toAbsoluteUrl,t.toRelativeUrl,t.isSubPathOf,t.toSegments,ie.root),Pe=new Map,Ee={},Ae=[],Oe=o.createContext(Object.freeze({container:Se,active:!0})),Me={};function Ne(){o.Component.apply(this,arguments),this.state={}}function Re(){o.Component.apply(this,arguments),this.stateId=history.state}function Ve(e,t,n){var r=Pe.get(e);if(!r.maxParams){var i=O(r.matchers,["remainingSegments"]),o=x(ge.routes,(function(e){var t=ge.parseRoute(e),n=t.length&&!S(i,(function(e,n){var r=t.params[n];return(e?!(r>=0):r<t.minLength)||!g(e)&&!t.match(n,e)}));return n?t:null}));if(o[1]&&(o=C(o,(function(e){return!P(e.params,(function(e,t){return Ee[t]&&!i[t]}))}))),o[0]){var a=o.slice(-1)[0];r.maxParams=q(w.apply(0,[{remainingSegments:!0}].concat(o.map((function(e){return e.params}))))),r.minParams=x(a.params,(function(e,t){return r.params[t]||e>=a.minLength?null:t}))}}return A(n||ge.route,t?r.maxParams:r.minParams)}function Te(e,t){return(Pe.get(t)||{}).matchCount-(Pe.get(e)||{}).matchCount}function je(e,t){var n=Pe.get(e);return!!n&&!P(n.matchers,(function(e,n){var r=t[n]||"";return g(e)?!e(r):(e||"")!==r}))}function Ie(e){var t;return F(e),e.prototype instanceof o.Component&&(e=o.createElement.bind(null,e)),function(n){var r=n.viewProps,i=!t&&e(r);v(i)&&(t=i,i=null);var a=(0,me.useAsync)((function(){return t.then((function(e){return o.createElement(e.default,r)}))}),!!t)[1];if((!t||!a.loading)&&(n.onComponentLoaded(),a.error))throw a.error;return i||a.value||o.createElement(o.Fragment)}}function Fe(){return o.useContext(Oe)}function qe(e){return je(e,ge.route)}function De(e,t){var n=ge.route;return"string"==typeof e?n=n.parse(e):t=e,t=t?y(t).sort(Te):Ae,S(t,(function(e){return je(e,n)}))||void 0}function ke(e,t){var n=Ie(e);return t=w({},t),b(t,(function(e,n){Ee[e]=!0,n instanceof RegExp&&(t[e]=n.test.bind(n))})),Pe.set(n,{id:G(),matchCount:q(t).length,matchers:t,params:A(t,(function(e){return h(e)||"string"==typeof e}))}),Ae.push(n),Ae.sort(Te),n}function Le(e){ye=Ie(e)}function Ue(){var e=y(arguments),t=g(e[0])?{}:e.shift(),n=e[0];return b(e,(function(e,t){if(!Pe.has(t))throw new Error("Invalid argument to renderView: "+(g(t)?t.name:t))})),e.sort(Te),o.createElement(Re,{rootProps:t,views:e,defaultView:n})}function ze(e,t){var n=Pe.get(e);if(!n)return"/";var r=w(Ve(e),Ve(e,!0,t||{}),n.params);return ge.route.getPath(r)}function We(e,t){return ge.toHref(ze(e,t))}function _e(e,t,n,r){return ge.navigate(ze(e,t),r,n&&H(w({},n)))}function Be(e,t,n){return _e(e,t,n,!0)}we=function(){ge.on("beforepageload",(function(e){Me=e}))},ve.push(F(we)),Ne.contextType=Oe,L(Ne,o.Component,{componentDidCatch:function(e){var t=this;ye&&!t.state.error?t.setState({error:e}):j((function(){ie.emit("error",t.context.container,{error:e},!0)}))},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?o.createElement(ye,{onComponentLoaded:n,viewProps:t}):o.createElement(t.view,{onComponentLoaded:n,viewProps:e.props.viewProps})},reset:function(){this.setState({error:null})}}),L(Re,o.Component,{componentDidMount:function(){var e=this;e.componentWillUnmount=R(_(ge.route,(function(){e.setActive(e.getViewComponent()===e.currentViewComponent)})),ge.on("beforepageload",(function(){e.stateId=history.state,e.updateView(),e.forceUpdate()})))},render:function(){var e=this;return history.state===e.stateId&&e.updateView(),o.createElement(o.Fragment,null,e.prevView,e.currentView)},updateView:function(){var e=this,t=e.getViewComponent();if(t){var n=ze(t,Ve(t,!0));n!==Ce(ge.path)&&ge.navigate(n,!0)}if(t&&t!==e.currentViewComponent){var r,i=e.currentElement;i&&(e.setActive(!1),e.prevView=e.currentView,e.currentElement=void 0,ge.emit("pageleave",i,{pathname:e.currentPath},!0),xe(i,"show").then((function(){e.prevView=void 0,e.forceUpdate()})));var a=new Promise((function(e){r=e})),s=V((function(t){e.currentElement=t,c.container=t,a.then((function(){be(t,"show"),ge.emit("pageenter",t,{pathname:ge.path},!0)})),se(t,a)})),u=H({navigationType:Me.navigationType,viewData:Me.data||{}}),c={view:t},l=o.createElement(Oe.Provider,{key:Pe.get(t).id,value:c},o.createElement(Xe,null,o.createElement("div",w({},e.props.rootProps,{ref:s}),o.createElement(Ne,{onComponentLoaded:r,viewProps:u}))));w(e,{currentPath:ge.path,currentView:l,currentViewComponent:t,setActive:W(c,"active",!0,!0)}),(Me.waitFor||p)(a)}},getViewComponent:function(){var e=this.props;return S(e.views,qe)||e.defaultView}});var Qe=new de;function He(){return ge.historyStorage.current}function Ge(e,t){this.key=e,this.value=t}function Ze(){return $e().ready}function $e(){var e=(0,me.useObservableProperty)(ge,"readyState");return{ready:"ready"===e,error:"error"===e}}function Je(e,t){var n=Fe(),r=ge.route,i=r[e]||"",a=(0,o.useRef)(i),s=(0,o.useState)()[1];return(0,o.useEffect)((function(){var t=function t(){var i=r[e]||"";i!==a.current&&(n.active?(a.current=i,s({})):_(n,"active",t))};if(t(),e in r)return r.watch(e,(function(){I(t)}));console.error("Route parameter "+e+" does not exist")}),[e,t]),a.current=i,void 0===t||i&&("remainingSegments"!==e||"/"!==i)||ge.navigate(r.getPath(w({},r,E(e,t))),!0),i}function Ke(e,t,n){var r=Fe(),i=He(),a=(0,o.useState)(i.has(e)?i.get(e):t);return r.active&&i.get(e)!==a[0]&&(n&&i.has(e)&&(ge.snapshot(),i=He()),i.set(e,a[0])),(0,o.useEffect)((function(){if(n)return Y(window,"popstate",(function(){if(r.active){var n=He();a[1](n.has(e)?n.get(e):t)}}))}),[r,n]),a}function Xe(e){var t=Fe(),n=(0,o.useState)((function(){var e={};return{getState:function(n,r){var i=He(),o=i.get(r),a=e[n]||(e[n]=new Ge(r,o));if(t.active){var s=a.store;s&&(s!==i&&i.has(r)||r!==a.key)&&(Qe.emit("popstate",a,{newValue:o}),a.value=o,a.key=r),a.store=i,i.set(r,a.value)}return a}}}))[0];return(0,o.createElement)(me.ViewStateProvider,{value:n},e.children)}L(Ge,{get:function(){return this.value},set:function(e){var t=this;t.value=e,t.store.set(t.key,e)},onPopState:function(e){return F(e),Qe.add(this,"popstate",(function(t){e.call(this,t.newValue)}))}});const Ye=l(28);var et=Object.create(null),tt="function"==typeof Symbol&&Symbol.toPrimitive;function nt(e){this.toString=e}function rt(e){return w((function(t,n){var r=e(t,n,!0);return void 0!==r?r:t}),{html:function(t,n){return{__html:e(t,n)}},lazy:function(t,n){return new nt(e.bind(0,t,n,!0))}})}function it(){return(0,me.useObservableProperty)(ge,"language")}function ot(e,t){var n=new RegExp("^("+Object.keys(e[t]).join("|")+")\\."),r={};function i(n,r,o,a,s){var u=((e[s]||et)[n]||et)[r];return"string"==typeof u?!u||a&&void 0===o?u:Ye(u,o,{noEncode:a}):s!==t?i(n,r,o,a,t):void 0}function o(){var e=y(arguments),t=e.join(" ");return r[t]||(r[t]=rt((function(t,n,r){var o=ge.language;return P(e,(function(e){return i(e,t,n,r,o)}))})))}return r[""]=rt((function(e,t,r){var o=n.test(e)?RegExp.$1:"";return i(o,o?e.slice(RegExp.lastMatch.length):e,t,r,ge.language)})),{translate:r[""],getTranslation:o,useTranslation:function(){var e=it(),t=o.apply(0,arguments);return{language:e,t}},keys:function(n){return q(e[t][n]||et)}}}function at(e){st.call(this),this.attributes=e||{}}function st(){}tt&&(nt.prototype[tt]=function(){return this.toString()}),L(at,st,{getCustomAttributes:function(){return w({},this.attributes)}}),L(st,{next:function(){},getRef:function(){return p},getClassNames:function(){return[]},getCustomAttributes:function(){return{}},dispose:function(){}}),B(st.prototype),k(st,{get scrollableTarget(){return new at({"scrollable-target":""})},use:function(){var e=y(arguments),t=e[0],n={},r=e.filter((function(e){return e instanceof st})),i=r.map((function(e){return e.getRef()}));return!t||t instanceof st?t||e.shift():("function"!=typeof t?i.push((function(e){t.current=e})):i.push(t),e.shift()),b(r,(function(e,t){w(n,t.getCustomAttributes())})),w(n,{ref:R(i),className:me.classNames.apply(null,e)}),b(r,(function(e,t){t.next()})),n}});var ut=u.dom,ct=(ut.observe,ut.registerCleanup,ut.createAutoCleanupMap,ut.afterDetached,ut.watchElements,ut.watchAttributes,ut.watchOwnAttributes),lt=T();function ft(e){this.mixin=e}function pt(){st.call(this),lt(this,{elements:new Set,flush:_(this,!1),dispose:[],states:{},prefix:"",counter:0})}L(ft,{getMixin:function(){return this.mixin}}),L(pt,st,{get ref(){var e=this,t=e.state;return e.next(),t.ref||(t.ref=new ft(e.clone()))},get state(){var e=lt(this),t=e.prefix+e.counter;return e.states[t]||(e.states[t]=this.initState())},reset:function(){return lt(this).counter=0,this},next:function(){return lt(this).counter++,this},getRef:function(){var e=this,t=e.state;return function(n){t.element=n,n&&M(lt(e).elements,n)&&e.initElement(n,t)}},elements:function(){return D(lt(this).states).map((function(e){return e.element})).filter((function(e){return e}))},onDispose:function(e){lt(this).dispose.push(e)},initState:function(){return{element:null}},initElement:function(e,t){},clone:function(){var e=this,t=Q(Object.getPrototypeOf(e),e);return lt(t,w({},lt(e),{prefix:G()+".",counter:0})),t},dispose:function(){var e=lt(this),t=e.states;R(e.dispose.splice(0))(),e.flush(),e.elements.clear(),b(t,(function(e,n){delete t[e]}))}});var mt=pt.prototype;function dt(e,t,n,r){var i=n.classNames,o=w({},i);if(b(e.classNames,(function(e,n){i[n]=t.classList.contains(n)})),!N(o,i)){var a=e.onClassNameUpdated.bind(e,t,o,w({},i));r?j(a):a()}}function ht(e){pt.call(this),this.classNames=e||[]}L(ht,pt,{getClassNames:function(){return[this.state.classNames]},getRef:function(){var e=this,t=e.state.element;return t&&X(ie.root,t)&&dt(e,t,e.state,!0),mt.getRef.call(this)},initState:function(){return{element:null,classNames:{}}},initElement:function(e,t){var n=this;ct(e,"class",(function(){dt(n,e,t)}))},onClassNameUpdated:function(e,t,n){}});var gt=ht.prototype;function vt(){ht.call(this,["tweening-in","tweening-out"])}L(vt,ht,{next:function(){var e=this;return e.effects=void 0,e.trigger=void 0,gt.next.call(e)},with:function(e){var t=this;return t.effects=e.effects,t.trigger=e.trigger,t},withEffects:function(){return this.effects=y(arguments),this},getCustomAttributes:function(){var e=this;return w({},gt.getCustomAttributes.call(e),{"animate-in":(e.effects||[]).join(" "),"animate-on":e.trigger||"show"})}});var yt=ht.prototype;function wt(e){ht.call(this,["tweening-in","tweening-out"]),this.className=e}L(wt,ht,{getClassNames:function(){return[this.className].concat(yt.getClassNames.call(this))}});var bt=vt.prototype,xt=0;function Ct(){var e=this;vt.call(e),e.className="brew-anim-"+ ++xt,e.item=new wt(e.className)}L(Ct,vt,{reset:function(){return this.item.reset(),bt.reset.call(this)},getCustomAttributes:function(){return w({},bt.getCustomAttributes.call(this),{"animate-sequence":"."+this.className})},clone:function(){return w(bt.clone.call(this),{item:this.item.ref.getMixin()})}});var St=ht.prototype;function Pt(e){ht.call(this,["target-opened"]),this.flyoutMixin=e}L(Pt,ht,{open:function(e){return this.flyoutMixin.open(e)},close:function(e){return this.flyoutMixin.close(e)},getCustomAttributes:function(){var e=this.flyoutMixin.elements()[0];return w({},St.getCustomAttributes.call(this),{toggle:e&&"#"+e.id})}});var Et=ht.prototype,At=new WeakMap,Ot=0;function Mt(){var e=this;ht.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.toggle=new Pt(e),e.onDispose((function(){e.isFlyoutOpened=!1,e.visible=!1}))}L(Mt,ht,{reset:function(){return this.toggle.reset(),Et.reset.call(this)},next:function(){return this.effects=void 0,Et.next.call(this)},withEffects:function(){return this.effects=y(arguments),this},getCustomAttributes:function(){var e=this;return w({},Et.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){var t=this.elements()[0];return At.set(t,e),le(t)},close:function(e){return ce(this.elements()[0],e)},onOpen:function(e){var t=this.elements()[0];return this.onToggleState((function(n){if(n)return e(At.get(t))}))},onToggleState:function(e){return this.watch("isFlyoutOpened",e)},onVisibilityChanged:function(e){return this.watch("visible",e)},initElement:function(e,t){var n=this;Et.initElement.call(n,e,t),e.id||(e.id="flyout-"+ ++Ot),n.onDispose(ge.on(e,{animationstart:function(){n.animating=!0},animationcomplete:function(){n.animating=!1}},!0)),j((function(){b(n.toggle.elements(),(function(t,n){n.setAttribute("toggle","#"+e.id)}))}))},clone:function(){var e=this,t=w(Et.clone.call(e),{toggle:e.toggle.ref.getMixin()});return z(t,"isFlyoutOpened",e),z(t,"modal",e),t},onClassNameUpdated:function(e,t,n){this.visible=n.open,this.isFlyoutOpened=n.open&&!n.closing&&!n["tweening-out"]}});var Nt=pt.prototype;function Rt(){pt.call(this)}L(Rt,pt,{initElement:function(e,t){Nt.initElement.call(this,e,t),this.onDispose(ie.on(e,{focusin:function(n){t.focused=!0,te(e,"focused",n.source)},focusout:function(){t.focused=!1,te(e,"focused",!1)}}))},getClassNames:function(){return[{focused:!!this.state.focused}]}});var Vt=pt.prototype;function Tt(){pt.call(this)}L(Tt,pt,{initElement:function(e,t){Vt.initElement.call(this,e,t),ae(e),this.onDispose(ie.on(e,{asyncStart:function(){t.loading=!0,te(e,"loading",!0)},asyncEnd:function(){t.loading=!1,te(e,"loading",!1)},cancelled:function(){t.loading=!1,te(e,"loading",!1)}}))},getClassNames:function(){return[{loading:!!this.state.loading}]}});const jt=l(145);var It=ht.prototype;function Ft(){var e=this;ht.call(e,["scrollable-x","scrollable-x-l","scrollable-x-r","scrollable-y","scrollable-y-d","scrollable-y-u"]),e.target=st.scrollableTarget,e.pageIndex=0,e.scrolling=!1}function qt(e){w(this,e)}function Dt(e){return function(){var t=Bt(e);return(t.withOptions||qt).apply(t,arguments),t}}L(Ft,ht,{withOptions:function(e){return this.options=e,this},getCustomAttributes:function(){var e=this.options||{};return w({},It.getCustomAttributes.call(this),{scrollable:[e.direction||"both",e.handle||"auto"].join(" ")},e.paged&&{var:"{ pageIndex: 0 }","scroller-snap-page":e.paged,"scroller-page":e.pagedItemSelector,"scroller-state":"pageIndex"})},onPageIndexChanged:function(e){return this.watch("pageIndex",e)},initElement:function(e,t){var n=this;n.onDispose(ge.on(e,{statechange:function(e){"pageIndex"in e.newValues&&w(n,{pageIndex:e.newValues.pageIndex})},scrollStart:function(){n.scrolling=!0},scrollStop:function(){n.scrolling=!1}},!0))},clone:function(){var e=It.clone.call(this);return z(e,"pageIndex",this),e}}),b("destroy enable disable setOptions refresh scrollPadding stop scrollLeft scrollTop scrollBy scrollTo scrollByPage scrollToPage scrollToElement",(function(e,t){U(Ft.prototype,t,(function(){var e=jt(this.elements());return e.scrollable.apply(e,[t].concat(y(arguments)))}))}));var kt=Dt(vt),Lt=Dt(Ct),Ut=Dt(Mt),zt=Dt(Rt),Wt=Dt(Tt),_t=Dt(Ft);function Bt(e){return(0,me.useSingleton)((function(){return new e})).reset()}function Qt(e){return e&&e.getMixin().reset()}const Ht=i,Gt=e;i.react=e})(),f=f.default})()}));
|
|
1
|
+
/*! brew-js-react v0.4.2 | (c) misonou | https://hackmd.io/@misonou/brew-js-react */
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("brew-js"),require("react"),require("react-dom"),function(){try{return require("react-dom/client")}catch(e){}}(),require("zeta-dom"),require("zeta-dom-react"),require("waterpipe"),require("jQuery")):"function"==typeof define&&define.amd?define("brew-js-react",["brew-js","react","react-dom","react-dom/client","zeta-dom","zeta-dom-react","waterpipe","jQuery"],t):"object"==typeof exports?exports["brew-js-react"]=t(require("brew-js"),require("react"),require("react-dom"),function(){try{return require("react-dom/client")}catch(e){}}(),require("zeta-dom"),require("zeta-dom-react"),require("waterpipe"),require("jQuery")):e["brew-js-react"]=t(e.brew,e.React,e.ReactDOM,e["react-dom/client"],e.zeta,e["zeta-dom-react"],e.waterpipe,e.jQuery)}(self,(function(e,t,n,r,i,o,a,s){return(()=>{var u={145:e=>{"use strict";e.exports=s},715:e=>{"use strict";if(void 0===r){var t=new Error("Cannot find module 'react-dom/client'");throw t.code="MODULE_NOT_FOUND",t}e.exports=r},28:e=>{"use strict";e.exports=a},103:e=>{"use strict";e.exports=o},80:t=>{"use strict";t.exports=e},359:e=>{"use strict";e.exports=t},318:e=>{"use strict";e.exports=n},654:e=>{"use strict";e.exports=i},662:(e,t,n)=>{var r,i=n(318);try{r=n(715)}catch(e){r={createRoot:(e,t)=>({render(t){i.render(t,e)},unmount(){i.unmountComponentAtNode(e)}}),hydrateRoot:(e,t,n)=>(i.hydrate(t,e),{render(t){i.render(t,e)},unmount(){i.unmountComponentAtNode(e)}})}}e.exports=r}},c={};function l(e){var t=c[e];if(void 0!==t)return t.exports;var n=c[e]={exports:{}};return u[e](n,n.exports,l),n.exports}l.d=(e,t)=>{for(var n in t)l.o(t,n)&&!l.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),l.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var f={};return(()=>{"use strict";l.d(f,{default:()=>Yt});var e={};l.r(e),l.d(e,{AnimateMixin:()=>xt,AnimateSequenceItemMixin:()=>St,AnimateSequenceMixin:()=>At,ClassNameMixin:()=>wt,Dialog:()=>de,FlyoutMixin:()=>It,FlyoutToggleMixin:()=>Mt,FocusStateMixin:()=>jt,LoadingStateMixin:()=>qt,Mixin:()=>ft,ScrollIntoViewMixin:()=>Ut,ScrollableMixin:()=>Lt,StatefulMixin:()=>gt,ViewStateContainer:()=>nt,createDialog:()=>me,default:()=>Xt,isViewMatched:()=>Ue,linkTo:()=>He,makeTranslation:()=>ct,matchView:()=>ze,navigateTo:()=>Ge,redirectTo:()=>Ze,registerErrorView:()=>_e,registerView:()=>We,renderView:()=>Be,resolvePath:()=>Qe,useAnimateMixin:()=>_t,useAnimateSequenceMixin:()=>Bt,useAppReady:()=>Xe,useAppReadyState:()=>Ye,useFlyoutMixin:()=>Qt,useFocusStateMixin:()=>Ht,useLanguage:()=>ut,useLoadingStateMixin:()=>Gt,useMixin:()=>Jt,useMixinRef:()=>Kt,useRouteParam:()=>et,useRouteState:()=>tt,useScrollIntoViewMixin:()=>$t,useScrollableMixin:()=>Zt,useViewContainerState:()=>Le,useViewContext:()=>Le});var t=l(80);const n=t;var r=t.install;t.addExtension,t.addDetect,t.isElementActive;const i=n;var o=l(359),a=l(318);const s=l(662);var u=l(654),c=u.util,p=c.noop,m=c.pipe,d=c.either,h=(c.is,c.isUndefinedOrNull),g=(c.isArray,c.isFunction),v=c.isThenable,y=(c.isPlainObject,c.isArrayLike,c.makeArray),w=c.extend,b=c.each,x=c.map,C=c.grep,S=(c.splice,c.any),P=c.single,E=c.kv,A=(c.fill,c.pick),O=c.exclude,M=(c.mapObject,c.mapGet,c.mapRemove,c.arrRemove,c.setAdd),N=c.equal,R=c.combineFn,V=c.executeOnce,I=c.createPrivateStore,T=(c.setTimeout,c.setTimeoutOnce,c.setInterval,c.setIntervalSafe,c.setImmediate),j=c.setImmediateOnce,F=(c.throws,c.throwNotFunction),q=(c.errorWithCode,c.isErrorWithCode,c.keys),k=c.values,D=(c.hasOwnProperty,c.getOwnPropertyDescriptors,c.define),L=c.definePrototype,U=c.defineOwnProperty,z=(c.defineGetterProperty,c.defineHiddenProperty),W=c.defineAliasProperty,_=c.defineObservableProperty,B=c.watch,Q=(c.watchOnce,c.watchable),H=c.inherit,G=c.freeze,Z=(c.deepFreeze,c.iequal,c.randomId),$=(c.repeat,c.camel,c.hyphenate,c.ucfirst,c.lcfirst,c.trim,c.matchWord,c.htmlDecode,c.resolve,c.reject,c.always),J=(c.resolveAll,c.retryable,c.deferrable,c.catchAsync),K=(c.setPromiseTimeout,c.delay,c.makeAsync),X=u.util,Y=(X.domReady,X.tagName,X.isVisible,X.matchSelector,X.comparePosition,X.connected,X.containsOrEquals),ee=(X.acceptNode,X.combineNodeFilters,X.iterateNode,X.iterateNodeToArray,X.getCommonAncestor,X.parentsAndSelf,X.selectIncludeSelf,X.selectClosestRelative,X.createNodeIterator,X.createTreeWalker,X.bind),te=(X.bindUntil,X.dispatchDOMMouseEvent,X.removeNode),ne=(X.getClass,X.setClass),re=(X.getSafeAreaInset,X.getScrollOffset,X.getScrollParent,X.getContentRect,X.scrollBy,X.scrollIntoView);X.makeSelection,X.getRect,X.getRects,X.toPlainRect,X.rectEquals,X.rectCovers,X.rectIntersects,X.pointInRect,X.mergeRect,X.elementFromPoint;const ie=u.dom;var oe=u.dom;oe.textInputAllowed,oe.beginDrag,oe.beginPinchZoom,oe.insertText,oe.getShortcut,oe.setShortcut,oe.focusable,oe.focused,oe.setModal,oe.releaseModal,oe.retainFocus,oe.releaseFocus,oe.iterateFocusPath,oe.focus;const ae=ie;var se=u.dom,ue=se.lock,ce=(se.locked,se.cancelLock,se.subscribeAsync,se.notifyAsync),le=se.preventLeave,fe=(t.addAsyncAction,t.closeFlyout),pe=t.openFlyout;function me(e){var t,n=document.createElement("div"),r=s.createRoot(n),i=fe.bind(0,n);return ae.on(n,"flyouthide",(function(){te(n),(e.onClose||p)(n),e.onRender&&r.unmount()})),{root:n,close:i,open:function(){if(t)return t;if(n.className=e.className||"",document.body.appendChild(n),ae.retainFocus(ae.activeElement,n),e.modal&&(n.setAttribute("is-modal",""),ae.setModal(n)),e.onRender){var a=w({},e,{closeDialog:function(t){var n=K(e.onCommit||m)(t);J(ue(ae.activeElement,n)),n.then(i,p)}}),s=(0,o.createElement)(e.onRender,a);e.wrapper&&(s=(0,o.createElement)(e.wrapper,a,s)),r.render(s)}return t=pe(n),e.preventLeave?le(n,t):e.preventNavigation&&ue(n,t),$(t,(function(){t=null})),(e.onOpen||p)(n),t}}}function de(e){var t=(0,o.useState)({})[0],n=(0,o.useState)((function(){return me(t)}))[0];return w(t,e),(0,o.useEffect)((function(){var e=Y(ae.root,n.root);d(e,t.isOpen)&&(e?n.close():n.open())}),[t.isOpen]),(0,o.useEffect)((function(){return n.close}),[n]),a.createPortal(e.children,n.root)}var he=l(103),ge=u.EventContainer;const ve=t.defaults;var ye,we=[];r("react",(function(e){ye=e,R(we)(ye)})),ve.react=!0;var be,xe,Ce=t.animateIn,Se=t.animateOut,Pe=(t.addAnimateIn,t.addAnimateOut,t.setBaseUrl,t.combinePath,t.parsePath,t.normalizePath,t.removeQueryAndHash),Ee=(t.withBaseUrl,t.toAbsoluteUrl,t.toRelativeUrl,t.isSubPathOf,t.toSegments,ae.root),Ae=new Map,Oe={},Me=[],Ne=new ge,Re=o.createContext(Object.freeze({container:Ee,active:!0})),Ve={};function Ie(e){U(this,"view",e,!0)}function Te(){o.Component.apply(this,arguments),this.state={}}function je(){o.Component.apply(this,arguments),this.stateId=history.state}function Fe(e,t,n){var r=Ae.get(e);if(!r.maxParams){var i=O(r.matchers,["remainingSegments"]),o=x(ye.routes,(function(e){var t=ye.parseRoute(e),n=t.length&&!S(i,(function(e,n){var r=t.params[n];return(e?!(r>=0):r<t.minLength)||!g(e)&&!t.match(n,e)}));return n?t:null}));if(o[1]&&(o=C(o,(function(e){return!P(e.params,(function(e,t){return Oe[t]&&!i[t]}))}))),o[0]){var a=o.slice(-1)[0];r.maxParams=q(w.apply(0,[{remainingSegments:!0}].concat(o.map((function(e){return e.params}))))),r.minParams=x(a.params,(function(e,t){return r.params[t]||e>=a.minLength?null:t}))}}return A(n||ye.route,t?r.maxParams:r.minParams)}function qe(e,t){return(Ae.get(t)||{}).matchCount-(Ae.get(e)||{}).matchCount}function ke(e,t){var n=Ae.get(e);return!!n&&!P(n.matchers,(function(e,n){var r=t[n]||"";return g(e)?!e(r):(e||"")!==r}))}function De(e){var t;return F(e),e.prototype instanceof o.Component&&(e=o.createElement.bind(null,e)),function(n){var r=n.viewProps,i=!t&&e(r);v(i)&&(t=i,i=null);var a=(0,he.useAsync)((function(){return t.then((function(e){return o.createElement(e.default,r)}))}),!!t)[1];if((!t||!a.loading)&&(n.onComponentLoaded(),a.error))throw a.error;return i||a.value||o.createElement(o.Fragment)}}function Le(){return o.useContext(Re)}function Ue(e){return ke(e,ye.route)}function ze(e,t){var n=ye.route;return"string"==typeof e?n=n.parse(e):t=e,t=t?y(t).sort(qe):Me,S(t,(function(e){return ke(e,n)}))||void 0}function We(e,t){var n=De(e);return t=w({},t),b(t,(function(e,n){Oe[e]=!0,n instanceof RegExp&&(t[e]=n.test.bind(n))})),Ae.set(n,{id:Z(),matchCount:q(t).length,matchers:t,params:A(t,(function(e){return h(e)||"string"==typeof e}))}),Me.push(n),Me.sort(qe),n}function _e(e){be=De(e)}function Be(){var e=y(arguments),t=g(e[0])?{}:e.shift(),n=e[0];return b(e,(function(e,t){if(!Ae.has(t))throw new Error("Invalid argument to renderView: "+(g(t)?t.name:t))})),e.sort(qe),o.createElement(je,{rootProps:t,views:e,defaultView:n})}function Qe(e,t){var n=Ae.get(e);if(!n)return"/";var r=w(Fe(e),Fe(e,!0,t||{}),n.params);return ye.route.getPath(r)}function He(e,t){return ye.toHref(Qe(e,t))}function Ge(e,t,n,r){return ye.navigate(Qe(e,t),r,n&&G(w({},n)))}function Ze(e,t,n){return Ge(e,t,n,!0)}xe=function(){ye.on("beforepageload",(function(e){Ve=e}))},we.push(F(xe)),L(Ie,{on:function(e,t){return Ne.add(this,e,t)}}),Te.contextType=Re,L(Te,o.Component,{componentDidCatch:function(e){var t=this;be&&!t.state.error?t.setState({error:e}):T((function(){ae.emit("error",t.context.container,{error:e},!0)}))},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?o.createElement(be,{onComponentLoaded:n,viewProps:t}):o.createElement(t.view,{onComponentLoaded:n,viewProps:e.props.viewProps})},reset:function(){this.setState({error:null})}}),L(je,o.Component,{componentDidMount:function(){var e=this;e.componentWillUnmount=R(B(ye.route,(function(){e.setActive(e.getViewComponent()===e.currentViewComponent)})),ye.on("beforepageload",(function(){e.stateId=history.state,e.updateView(),e.forceUpdate()})))},render:function(){var e=this;return history.state===e.stateId&&e.updateView(),o.createElement(o.Fragment,null,e.prevView,e.currentView)},updateView:function(){var e=this,t=e.getViewComponent();if(t){var n=Qe(t,Fe(t,!0));n!==Pe(ye.path)&&ye.navigate(n,!0)}if(t&&t!==e.currentViewComponent){var r,i=e.currentElement;i&&(e.setActive(!1),e.prevView=e.currentView,e.currentElement=void 0,ye.emit("pageleave",i,{pathname:e.currentPath},!0),Se(i,"show").then((function(){e.prevView=void 0,e.forceUpdate()})));var a=new Promise((function(e){r=e})),s=V((function(t){e.currentElement=t,u.container=t,a.then((function(){Ce(t,"show"),ye.emit("pageenter",t,{pathname:ye.path},!0)})),ce(t,a)})),u=new Ie(t),c=G({navigationType:Ve.navigationType,viewContext:u,viewData:Ve.data||{}}),l=o.createElement(Re.Provider,{key:Ae.get(t).id,value:u},o.createElement(nt,null,o.createElement("div",w({},e.props.rootProps,{ref:s}),o.createElement(Te,{onComponentLoaded:r,viewProps:c}))));w(e,{currentPath:ye.path,currentView:l,currentViewComponent:t,setPage:_(u,"page",ye.page,!0),setActive:_(u,"active",!0,!0)}),B(u,"page",(function(e,t){Ne.emit("pagechange",u,{previousPage:t})})),(Ve.waitFor||p)(a)}(e.setPage||p)(ye.page)},getViewComponent:function(){var e=this.props;return S(e.views,Ue)||e.defaultView}});var $e=new ge;function Je(){return ye.historyStorage.current}function Ke(e,t){this.key=e,this.value=t}function Xe(){return Ye().ready}function Ye(){var e=(0,he.useObservableProperty)(ye,"readyState");return{ready:"ready"===e,error:"error"===e}}function et(e,t){var n=Le(),r=ye.route,i=r[e]||"",a=(0,o.useRef)(i),s=(0,o.useState)()[1];return(0,o.useEffect)((function(){var t=function t(){var i=r[e]||"";i!==a.current&&(n.active?(a.current=i,s({})):B(n,"active",t))};if(t(),e in r)return r.watch(e,(function(){j(t)}));console.error("Route parameter "+e+" does not exist")}),[e,t]),a.current=i,void 0===t||i&&("remainingSegments"!==e||"/"!==i)||ye.navigate(r.getPath(w({},r,E(e,t))),!0),i}function tt(e,t,n){var r=Le(),i=Je(),a=(0,o.useState)(i.has(e)?i.get(e):t);return r.active&&i.get(e)!==a[0]&&(n&&i.has(e)&&(ye.snapshot(),i=Je()),i.set(e,a[0])),(0,o.useEffect)((function(){if(n)return ee(window,"popstate",(function(){if(r.active){var n=Je();a[1](n.has(e)?n.get(e):t)}}))}),[r,n]),a}function nt(e){var t=Le(),n=(0,o.useState)((function(){var e={};return{getState:function(n,r){var i=Je(),o=i.get(r),a=e[n]||(e[n]=new Ke(r,o));if(t.active){var s=a.store;s&&(s!==i&&i.has(r)||r!==a.key)&&($e.emit("popstate",a,{newValue:o}),a.value=o,a.key=r),a.store=i,i.set(r,a.value)}return a}}}))[0];return(0,o.createElement)(he.ViewStateProvider,{value:n},e.children)}L(Ke,{get:function(){return this.value},set:function(e){var t=this;t.value=e,t.store.set(t.key,e)},onPopState:function(e){return F(e),$e.add(this,"popstate",(function(t){e.call(this,t.newValue)}))}});const rt=l(28);var it=Object.create(null),ot="function"==typeof Symbol&&Symbol.toPrimitive;function at(e){this.toString=e}function st(e){return w((function(t,n){var r=e(t,n,!0);return void 0!==r?r:t}),{html:function(t,n){return{__html:e(t,n)}},lazy:function(t,n){return new at(e.bind(0,t,n,!0))}})}function ut(){return(0,he.useObservableProperty)(ye,"language")}function ct(e,t){var n=new RegExp("^("+Object.keys(e[t]).join("|")+")\\."),r={};function i(n,r,o,a,s){var u=((e[s]||it)[n]||it)[r];return"string"==typeof u?!u||a&&void 0===o?u:rt(u,o,{noEncode:a}):s!==t?i(n,r,o,a,t):void 0}function o(){var e=y(arguments),t=e.join(" ");return r[t]||(r[t]=st((function(t,n,r){var o=ye.language;return P(e,(function(e){return i(e,t,n,r,o)}))})))}return r[""]=st((function(e,t,r){var o=n.test(e)?RegExp.$1:"";return i(o,o?e.slice(RegExp.lastMatch.length):e,t,r,ye.language)})),{translate:r[""],getTranslation:o,useTranslation:function(){var e=ut(),t=o.apply(0,arguments);return{language:e,t}},keys:function(n){return q(e[t][n]||it)}}}function lt(e){ft.call(this),this.attributes=e||{}}function ft(){}ot&&(at.prototype[ot]=function(){return this.toString()}),L(lt,ft,{getCustomAttributes:function(){return w({},this.attributes)}}),L(ft,{next:function(){},getRef:function(){return p},getClassNames:function(){return[]},getCustomAttributes:function(){return{}},dispose:function(){}}),Q(ft.prototype),D(ft,{get scrollableTarget(){return new lt({"scrollable-target":""})},use:function(){var e=y(arguments),t=e[0],n={},r=e.filter((function(e){return e instanceof ft})),i=r.map((function(e){return e.getRef()}));return!t||t instanceof ft?t||e.shift():("function"!=typeof t?i.push((function(e){t.current=e})):i.push(t),e.shift()),b(r,(function(e,t){w(n,t.getCustomAttributes())})),w(n,{ref:R(i),className:he.classNames.apply(null,e)}),b(r,(function(e,t){t.next()})),n}});var pt=u.dom,mt=(pt.observe,pt.registerCleanup,pt.createAutoCleanupMap,pt.afterDetached,pt.watchElements,pt.watchAttributes,pt.watchOwnAttributes),dt=I();function ht(e){this.mixin=e}function gt(){ft.call(this),dt(this,{elements:new Set,flush:B(this,!1),dispose:[],states:{},prefix:"",counter:0})}L(ht,{getMixin:function(){return this.mixin}}),L(gt,ft,{get ref(){var e=this,t=e.state;return e.next(),t.ref||(t.ref=new ht(e.clone()))},get state(){var e=dt(this),t=e.prefix+e.counter;return e.states[t]||(e.states[t]=this.initState())},reset:function(){return dt(this).counter=0,this},next:function(){return dt(this).counter++,this},getRef:function(){var e=this,t=e.state;return function(n){t.element=n,n&&M(dt(e).elements,n)&&e.initElement(n,t)}},elements:function(){return k(dt(this).states).map((function(e){return e.element})).filter((function(e){return e}))},onDispose:function(e){dt(this).dispose.push(e)},initState:function(){return{element:null}},initElement:function(e,t){},clone:function(){var e=this,t=H(Object.getPrototypeOf(e),e);return dt(t,w({},dt(e),{prefix:Z()+".",counter:0})),t},dispose:function(){var e=dt(this),t=e.states;R(e.dispose.splice(0))(),e.flush(),e.elements.clear(),b(t,(function(e,n){delete t[e]}))}});var vt=gt.prototype;function yt(e,t,n,r){var i=n.classNames,o=w({},i);if(b(e.classNames,(function(e,n){i[n]=t.classList.contains(n)})),!N(o,i)){var a=e.onClassNameUpdated.bind(e,t,o,w({},i));r?T(a):a()}}function wt(e){gt.call(this),this.classNames=e||[]}L(wt,gt,{getClassNames:function(){return[this.state.classNames]},getRef:function(){var e=this,t=e.state.element;return t&&Y(ae.root,t)&&yt(e,t,e.state,!0),vt.getRef.call(this)},initState:function(){return{element:null,classNames:{}}},initElement:function(e,t){var n=this;mt(e,"class",(function(){yt(n,e,t)}))},onClassNameUpdated:function(e,t,n){}});var bt=wt.prototype;function xt(){wt.call(this,["tweening-in","tweening-out"])}L(xt,wt,{next:function(){var e=this;return e.effects=void 0,e.trigger=void 0,bt.next.call(e)},with:function(e){var t=this;return t.effects=e.effects,t.trigger=e.trigger,t},withEffects:function(){return this.effects=y(arguments),this},getCustomAttributes:function(){var e=this;return w({},bt.getCustomAttributes.call(e),{"animate-in":(e.effects||[]).join(" "),"animate-on":e.trigger||"show"})}});var Ct=wt.prototype;function St(e){wt.call(this,["tweening-in","tweening-out"]),this.className=e}L(St,wt,{getClassNames:function(){return[this.className].concat(Ct.getClassNames.call(this))}});var Pt=xt.prototype,Et=0;function At(){var e=this;xt.call(e),e.className="brew-anim-"+ ++Et,e.item=new St(e.className)}L(At,xt,{reset:function(){return this.item.reset(),Pt.reset.call(this)},getCustomAttributes:function(){return w({},Pt.getCustomAttributes.call(this),{"animate-sequence":"."+this.className})},clone:function(){return w(Pt.clone.call(this),{item:this.item.ref.getMixin()})}});var Ot=wt.prototype;function Mt(e){wt.call(this,["target-opened"]),this.flyoutMixin=e}L(Mt,wt,{open:function(e){return this.flyoutMixin.open(e)},close:function(e){return this.flyoutMixin.close(e)},getCustomAttributes:function(){var e=this.flyoutMixin.elements()[0];return w({},Ot.getCustomAttributes.call(this),{toggle:e&&"#"+e.id})}});var Nt=wt.prototype,Rt=new WeakMap,Vt=0;function It(){var e=this;wt.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.toggle=new Mt(e),e.onDispose((function(){e.isFlyoutOpened=!1,e.visible=!1}))}L(It,wt,{reset:function(){return this.toggle.reset(),Nt.reset.call(this)},next:function(){return this.effects=void 0,Nt.next.call(this)},withEffects:function(){return this.effects=y(arguments),this},getCustomAttributes:function(){var e=this;return w({},Nt.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){var t=this.elements()[0];return Rt.set(t,e),pe(t)},close:function(e){return fe(this.elements()[0],e)},onOpen:function(e){var t=this.elements()[0];return this.onToggleState((function(n){if(n)return e(Rt.get(t))}))},onToggleState:function(e){return this.watch("isFlyoutOpened",e)},onVisibilityChanged:function(e){return this.watch("visible",e)},initElement:function(e,t){var n=this;Nt.initElement.call(n,e,t),e.id||(e.id="flyout-"+ ++Vt),n.onDispose(ye.on(e,{animationstart:function(){n.animating=!0},animationcomplete:function(){n.animating=!1}},!0)),T((function(){b(n.toggle.elements(),(function(t,n){n.setAttribute("toggle","#"+e.id)}))}))},clone:function(){var e=this,t=w(Nt.clone.call(e),{toggle:e.toggle.ref.getMixin()});return W(t,"isFlyoutOpened",e),W(t,"modal",e),t},onClassNameUpdated:function(e,t,n){this.visible=n.open,this.isFlyoutOpened=n.open&&!n.closing&&!n["tweening-out"]}});var Tt=gt.prototype;function jt(){gt.call(this)}L(jt,gt,{initElement:function(e,t){Tt.initElement.call(this,e,t),this.onDispose(ae.on(e,{focusin:function(n){t.focused=!0,ne(e,"focused",n.source)},focusout:function(){t.focused=!1,ne(e,"focused",!1)}}))},getClassNames:function(){return[{focused:!!this.state.focused}]}});var Ft=gt.prototype;function qt(){gt.call(this)}L(qt,gt,{initElement:function(e,t){Ft.initElement.call(this,e,t),ue(e),this.onDispose(ae.on(e,{asyncStart:function(){t.loading=!0,ne(e,"loading",!0)},asyncEnd:function(){t.loading=!1,ne(e,"loading",!1)},cancelled:function(){t.loading=!1,ne(e,"loading",!1)}}))},getClassNames:function(){return[{loading:!!this.state.loading}]}});const kt=l(145);var Dt=wt.prototype;function Lt(){var e=this;wt.call(e,["scrollable-x","scrollable-x-l","scrollable-x-r","scrollable-y","scrollable-y-d","scrollable-y-u"]),e.target=ft.scrollableTarget,e.pageIndex=0,e.scrolling=!1}function Ut(){gt.call(this)}function zt(e){w(this,e)}function Wt(e){return function(){var t=Jt(e);return(t.withOptions||zt).apply(t,arguments),t}}L(Lt,wt,{withOptions:function(e){return this.options=e,this},getCustomAttributes:function(){var e=this.options||{};return w({},Dt.getCustomAttributes.call(this),{scrollable:[e.direction||"both",e.handle||"auto"].join(" ")},e.paged&&{var:"{ pageIndex: 0 }","scroller-snap-page":e.paged,"scroller-page":e.pagedItemSelector,"scroller-state":"pageIndex"})},onPageIndexChanged:function(e){return this.watch("pageIndex",e)},initElement:function(e,t){var n=this;n.onDispose(ye.on(e,{statechange:function(e){"pageIndex"in e.newValues&&w(n,{pageIndex:e.newValues.pageIndex})},scrollStart:function(){n.scrolling=!0},scrollStop:function(){n.scrolling=!1}},!0))},clone:function(){var e=Dt.clone.call(this);return W(e,"pageIndex",this),e}}),b("destroy enable disable setOptions refresh scrollPadding stop scrollLeft scrollTop scrollBy scrollTo scrollByPage scrollToPage scrollToElement",(function(e,t){z(Lt.prototype,t,(function(){var e=kt(this.elements());return e.scrollable.apply(e,[t].concat(y(arguments)))}))})),L(Ut,gt,{when:function(e){var t=this.state,n=t.callback||(t.callback=function(){re(t.element)});return t.deps&&!N(e,t.deps)&&j(n),t.deps=y(e),this}});var _t=Wt(xt),Bt=Wt(At),Qt=Wt(It),Ht=Wt(jt),Gt=Wt(qt),Zt=Wt(Lt),$t=Wt(Ut);function Jt(e){return(0,he.useSingleton)((function(){return new e})).reset()}function Kt(e){return e&&e.getMixin().reset()}const Xt=i,Yt=e;i.react=e})(),f=f.default})()}));
|
|
3
3
|
//# sourceMappingURL=brew-js-react.min.js.map
|