UNPKG

14.4 kBJavaScriptView Raw
1!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("@material/linear-progress",[],e):"object"==typeof exports?exports["linear-progress"]=e():(t.mdc=t.mdc||{},t.mdc["linear-progress"]=e())}(this,function(){return n={},o.m=r={0:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MDCFoundation=void 0;var n=(Object.defineProperty(o,"cssClasses",{get:function(){return{}},enumerable:!1,configurable:!0}),Object.defineProperty(o,"strings",{get:function(){return{}},enumerable:!1,configurable:!0}),Object.defineProperty(o,"numbers",{get:function(){return{}},enumerable:!1,configurable:!0}),Object.defineProperty(o,"defaultAdapter",{get:function(){return{}},enumerable:!1,configurable:!0}),o.prototype.init=function(){},o.prototype.destroy=function(){},o);function o(t){void 0===t&&(t={}),this.adapter=t}e.MDCFoundation=n,e.default=n},1:function(t,e,r){"use strict";var o=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(n=i.next()).done;)s.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s},i=this&&this.__spreadArray||function(t,e){for(var r=0,n=e.length,o=t.length;r<n;r++,o++)t[o]=e[r];return t};Object.defineProperty(e,"__esModule",{value:!0}),e.MDCComponent=void 0;var n=r(0),s=(a.attachTo=function(t){return new a(t,new n.MDCFoundation({}))},a.prototype.initialize=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e]},a.prototype.getDefaultFoundation=function(){throw new Error("Subclasses must override getDefaultFoundation to return a properly configured foundation class")},a.prototype.initialSyncWithDOM=function(){},a.prototype.destroy=function(){this.foundation.destroy()},a.prototype.listen=function(t,e,r){this.root.addEventListener(t,e,r)},a.prototype.unlisten=function(t,e,r){this.root.removeEventListener(t,e,r)},a.prototype.emit=function(t,e,r){var n;void 0===r&&(r=!1),"function"==typeof CustomEvent?n=new CustomEvent(t,{bubbles:r,detail:e}):(n=document.createEvent("CustomEvent")).initCustomEvent(t,r,!1,e),this.root.dispatchEvent(n)},a);function a(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];this.root=t,this.initialize.apply(this,i([],o(r))),this.foundation=void 0===e?this.getDefaultFoundation():e,this.foundation.init(),this.initialSyncWithDOM()}e.MDCComponent=s,e.default=s},10:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getCorrectEventName=e.getCorrectPropertyName=void 0;var s={animation:{prefixed:"-webkit-animation",standard:"animation"},transform:{prefixed:"-webkit-transform",standard:"transform"},transition:{prefixed:"-webkit-transition",standard:"transition"}},a={animationend:{cssProperty:"animation",prefixed:"webkitAnimationEnd",standard:"animationend"},animationiteration:{cssProperty:"animation",prefixed:"webkitAnimationIteration",standard:"animationiteration"},animationstart:{cssProperty:"animation",prefixed:"webkitAnimationStart",standard:"animationstart"},transitionend:{cssProperty:"transition",prefixed:"webkitTransitionEnd",standard:"transitionend"}};function u(t){return Boolean(t.document)&&"function"==typeof t.document.createElement}e.getCorrectPropertyName=function(t,e){if(u(t)&&e in s){var r=t.document.createElement("div"),n=s[e],o=n.standard,i=n.prefixed;return o in r.style?o:i}return e},e.getCorrectEventName=function(t,e){if(u(t)&&e in a){var r=t.document.createElement("div"),n=a[e],o=n.standard,i=n.prefixed;return n.cssProperty in r.style?o:i}return e}},197:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),o(r(198),e),o(r(57),e),o(r(46),e),o(r(45),e),o(r(199),e)},198:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},199:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},45:function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},a=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.MDCLinearProgressFoundation=void 0;var s,u=r(10),c=r(0),f=r(46),l=(s=c.MDCFoundation,o(d,s),Object.defineProperty(d,"cssClasses",{get:function(){return f.cssClasses},enumerable:!1,configurable:!0}),Object.defineProperty(d,"strings",{get:function(){return f.strings},enumerable:!1,configurable:!0}),Object.defineProperty(d,"defaultAdapter",{get:function(){return{addClass:function(){},attachResizeObserver:function(){return null},forceLayout:function(){},getWidth:function(){return 0},hasClass:function(){return!1},setBufferBarStyle:function(){return null},setPrimaryBarStyle:function(){return null},setStyle:function(){},removeAttribute:function(){},removeClass:function(){},setAttribute:function(){}}},enumerable:!1,configurable:!0}),d.prototype.init=function(){var s=this;this.determinate=!this.adapter.hasClass(f.cssClasses.INDETERMINATE_CLASS),this.adapter.addClass(f.cssClasses.ANIMATION_READY_CLASS),this.progress=0,this.buffer=1,this.observer=this.adapter.attachResizeObserver(function(t){var e,r;if(!s.determinate)try{for(var n=a(t),o=n.next();!o.done;o=n.next()){var i=o.value;i.contentRect&&s.calculateAndSetDimensions(i.contentRect.width)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}}),!this.determinate&&this.observer&&this.calculateAndSetDimensions(this.adapter.getWidth())},d.prototype.setDeterminate=function(t){if(this.determinate=t,this.determinate)return this.adapter.removeClass(f.cssClasses.INDETERMINATE_CLASS),this.adapter.setAttribute(f.strings.ARIA_VALUENOW,this.progress.toString()),this.adapter.setAttribute(f.strings.ARIA_VALUEMAX,"1"),this.adapter.setAttribute(f.strings.ARIA_VALUEMIN,"0"),this.setPrimaryBarProgress(this.progress),void this.setBufferBarProgress(this.buffer);this.observer&&this.calculateAndSetDimensions(this.adapter.getWidth()),this.adapter.addClass(f.cssClasses.INDETERMINATE_CLASS),this.adapter.removeAttribute(f.strings.ARIA_VALUENOW),this.adapter.removeAttribute(f.strings.ARIA_VALUEMAX),this.adapter.removeAttribute(f.strings.ARIA_VALUEMIN),this.setPrimaryBarProgress(1),this.setBufferBarProgress(1)},d.prototype.isDeterminate=function(){return this.determinate},d.prototype.setProgress=function(t){this.progress=t,this.determinate&&(this.setPrimaryBarProgress(t),this.adapter.setAttribute(f.strings.ARIA_VALUENOW,t.toString()))},d.prototype.getProgress=function(){return this.progress},d.prototype.setBuffer=function(t){this.buffer=t,this.determinate&&this.setBufferBarProgress(t)},d.prototype.getBuffer=function(){return this.buffer},d.prototype.open=function(){this.adapter.removeClass(f.cssClasses.CLOSED_CLASS),this.adapter.removeClass(f.cssClasses.CLOSED_ANIMATION_OFF_CLASS),this.adapter.removeAttribute(f.strings.ARIA_HIDDEN)},d.prototype.close=function(){this.adapter.addClass(f.cssClasses.CLOSED_CLASS),this.adapter.setAttribute(f.strings.ARIA_HIDDEN,"true")},d.prototype.isClosed=function(){return this.adapter.hasClass(f.cssClasses.CLOSED_CLASS)},d.prototype.handleTransitionEnd=function(){this.adapter.hasClass(f.cssClasses.CLOSED_CLASS)&&this.adapter.addClass(f.cssClasses.CLOSED_ANIMATION_OFF_CLASS)},d.prototype.destroy=function(){s.prototype.destroy.call(this),this.observer&&this.observer.disconnect()},d.prototype.restartAnimation=function(){this.adapter.removeClass(f.cssClasses.ANIMATION_READY_CLASS),this.adapter.forceLayout(),this.adapter.addClass(f.cssClasses.ANIMATION_READY_CLASS)},d.prototype.setPrimaryBarProgress=function(t){var e="scaleX("+t+")",r="undefined"!=typeof window?u.getCorrectPropertyName(window,"transform"):"transform";this.adapter.setPrimaryBarStyle(r,e)},d.prototype.setBufferBarProgress=function(t){var e=100*t+"%";this.adapter.setBufferBarStyle(f.strings.FLEX_BASIS,e)},d.prototype.calculateAndSetDimensions=function(t){var e=t*f.animationDimensionPercentages.PRIMARY_HALF,r=t*f.animationDimensionPercentages.PRIMARY_FULL,n=t*f.animationDimensionPercentages.SECONDARY_QUARTER,o=t*f.animationDimensionPercentages.SECONDARY_HALF,i=t*f.animationDimensionPercentages.SECONDARY_FULL;this.adapter.setStyle("--mdc-linear-progress-primary-half",e+"px"),this.adapter.setStyle("--mdc-linear-progress-primary-half-neg",-e+"px"),this.adapter.setStyle("--mdc-linear-progress-primary-full",r+"px"),this.adapter.setStyle("--mdc-linear-progress-primary-full-neg",-r+"px"),this.adapter.setStyle("--mdc-linear-progress-secondary-quarter",n+"px"),this.adapter.setStyle("--mdc-linear-progress-secondary-quarter-neg",-n+"px"),this.adapter.setStyle("--mdc-linear-progress-secondary-half",o+"px"),this.adapter.setStyle("--mdc-linear-progress-secondary-half-neg",-o+"px"),this.adapter.setStyle("--mdc-linear-progress-secondary-full",i+"px"),this.adapter.setStyle("--mdc-linear-progress-secondary-full-neg",-i+"px"),this.restartAnimation()},d);function d(t){var e=s.call(this,i(i({},d.defaultAdapter),t))||this;return e.observer=null,e}e.MDCLinearProgressFoundation=l,e.default=l},46:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.animationDimensionPercentages=e.strings=e.cssClasses=void 0,e.cssClasses={CLOSED_CLASS:"mdc-linear-progress--closed",CLOSED_ANIMATION_OFF_CLASS:"mdc-linear-progress--closed-animation-off",INDETERMINATE_CLASS:"mdc-linear-progress--indeterminate",REVERSED_CLASS:"mdc-linear-progress--reversed",ANIMATION_READY_CLASS:"mdc-linear-progress--animation-ready"},e.strings={ARIA_HIDDEN:"aria-hidden",ARIA_VALUEMAX:"aria-valuemax",ARIA_VALUEMIN:"aria-valuemin",ARIA_VALUENOW:"aria-valuenow",BUFFER_BAR_SELECTOR:".mdc-linear-progress__buffer-bar",FLEX_BASIS:"flex-basis",PRIMARY_BAR_SELECTOR:".mdc-linear-progress__primary-bar"},e.animationDimensionPercentages={PRIMARY_HALF:.8367142,PRIMARY_FULL:2.00611057,SECONDARY_QUARTER:.37651913,SECONDARY_HALF:.84386165,SECONDARY_FULL:1.60277782}},57:function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.MDCLinearProgress=void 0;var i,s=r(1),a=r(45),u=(i=s.MDCComponent,o(c,i),c.attachTo=function(t){return new c(t)},Object.defineProperty(c.prototype,"determinate",{set:function(t){this.foundation.setDeterminate(t)},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"progress",{set:function(t){this.foundation.setProgress(t)},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"buffer",{set:function(t){this.foundation.setBuffer(t)},enumerable:!1,configurable:!0}),c.prototype.open=function(){this.foundation.open()},c.prototype.close=function(){this.foundation.close()},c.prototype.initialSyncWithDOM=function(){var t=this;this.root.addEventListener("transitionend",function(){t.foundation.handleTransitionEnd()})},c.prototype.getDefaultFoundation=function(){var n=this,t={addClass:function(t){n.root.classList.add(t)},forceLayout:function(){n.root.getBoundingClientRect()},setBufferBarStyle:function(t,e){var r=n.root.querySelector(a.MDCLinearProgressFoundation.strings.BUFFER_BAR_SELECTOR);r&&r.style.setProperty(t,e)},setPrimaryBarStyle:function(t,e){var r=n.root.querySelector(a.MDCLinearProgressFoundation.strings.PRIMARY_BAR_SELECTOR);r&&r.style.setProperty(t,e)},hasClass:function(t){return n.root.classList.contains(t)},removeAttribute:function(t){n.root.removeAttribute(t)},removeClass:function(t){n.root.classList.remove(t)},setAttribute:function(t,e){n.root.setAttribute(t,e)},setStyle:function(t,e){n.root.style.setProperty(t,e)},attachResizeObserver:function(t){var e=window.ResizeObserver;if(e){var r=new e(t);return r.observe(n.root),r}return null},getWidth:function(){return n.root.offsetWidth}};return new a.MDCLinearProgressFoundation(t)},c);function c(){return null!==i&&i.apply(this,arguments)||this}e.MDCLinearProgress=u}},o.c=n,o.d=function(t,e,r){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)o.d(r,n,function(t){return e[t]}.bind(null,n));return r},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=197);function o(t){if(n[t])return n[t].exports;var e=n[t]={i:t,l:!1,exports:{}};return r[t].call(e.exports,e,e.exports,o),e.l=!0,e.exports}var r,n});
\No newline at end of file