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