@material/base
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -78,9 +78,12 @@ /** | ||
// with the given data. | ||
emit(evtType, evtData) { | ||
emit(evtType, evtData, shouldBubble = false) { | ||
let evt; | ||
if (typeof CustomEvent === 'function') { | ||
evt = new CustomEvent(evtType, {detail: evtData}); | ||
evt = new CustomEvent(evtType, { | ||
detail: evtData, | ||
bubbles: shouldBubble, | ||
}); | ||
} else { | ||
evt = document.createEvent('CustomEvent'); | ||
evt.initCustomEvent(evtType, false, false, evtData); | ||
evt.initCustomEvent(evtType, shouldBubble, false, evtData); | ||
} | ||
@@ -87,0 +90,0 @@ |
@@ -19,10 +19,10 @@ /*! | ||
/******/ var installedModules = {}; | ||
/******/ | ||
/******/ // The require function | ||
/******/ function __webpack_require__(moduleId) { | ||
/******/ | ||
/******/ // Check if module is in cache | ||
/******/ if(installedModules[moduleId]) | ||
/******/ if(installedModules[moduleId]) { | ||
/******/ return installedModules[moduleId].exports; | ||
/******/ } | ||
/******/ // Create a new module (and put it into the cache) | ||
@@ -34,23 +34,23 @@ /******/ var module = installedModules[moduleId] = { | ||
/******/ }; | ||
/******/ | ||
/******/ // Execute the module function | ||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | ||
/******/ | ||
/******/ // Flag the module as loaded | ||
/******/ module.l = true; | ||
/******/ | ||
/******/ // Return the exports of the module | ||
/******/ return module.exports; | ||
/******/ } | ||
/******/ | ||
/******/ | ||
/******/ // expose the modules object (__webpack_modules__) | ||
/******/ __webpack_require__.m = modules; | ||
/******/ | ||
/******/ // expose the module cache | ||
/******/ __webpack_require__.c = installedModules; | ||
/******/ | ||
/******/ // identity function for calling harmony imports with the correct context | ||
/******/ __webpack_require__.i = function(value) { return value; }; | ||
/******/ | ||
/******/ // define getter function for harmony exports | ||
@@ -66,3 +66,3 @@ /******/ __webpack_require__.d = function(exports, name, getter) { | ||
/******/ }; | ||
/******/ | ||
/******/ // getDefaultExport function for compatibility with non-harmony modules | ||
@@ -76,11 +76,11 @@ /******/ __webpack_require__.n = function(module) { | ||
/******/ }; | ||
/******/ | ||
/******/ // Object.prototype.hasOwnProperty.call | ||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; | ||
/******/ | ||
/******/ // __webpack_public_path__ | ||
/******/ __webpack_require__.p = "/assets/"; | ||
/******/ | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(__webpack_require__.s = 38); | ||
/******/ return __webpack_require__(__webpack_require__.s = 68); | ||
/******/ }) | ||
@@ -199,3 +199,3 @@ /************************************************************************/ | ||
/* harmony default export */ __webpack_exports__["a"] = MDCFoundation; | ||
/* harmony default export */ __webpack_exports__["a"] = (MDCFoundation); | ||
@@ -316,8 +316,13 @@ /***/ }), | ||
value: function emit(evtType, evtData) { | ||
var shouldBubble = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; | ||
var evt = void 0; | ||
if (typeof CustomEvent === 'function') { | ||
evt = new CustomEvent(evtType, { detail: evtData }); | ||
evt = new CustomEvent(evtType, { | ||
detail: evtData, | ||
bubbles: shouldBubble | ||
}); | ||
} else { | ||
evt = document.createEvent('CustomEvent'); | ||
evt.initCustomEvent(evtType, false, false, evtData); | ||
evt.initCustomEvent(evtType, shouldBubble, false, evtData); | ||
} | ||
@@ -332,7 +337,7 @@ | ||
/* harmony default export */ __webpack_exports__["a"] = MDCComponent; | ||
/* harmony default export */ __webpack_exports__["a"] = (MDCComponent); | ||
/***/ }), | ||
/***/ 38: | ||
/***/ 68: | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -339,0 +344,0 @@ |
@@ -6,2 +6,2 @@ /*! | ||
*/ | ||
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.base=n():(t.mdc=t.mdc||{},t.mdc.base=n())}(this,function(){return function(t){function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}var e={};return n.m=t,n.c=e,n.i=function(t){return t},n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:o})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},n.p="/assets/",n(n.s=38)}({0:function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var o=e(1);e.d(n,"MDCFoundation",function(){return o.a});var r=e(2);e.d(n,"MDCComponent",function(){return r.a})},1:function(t,n,e){"use strict";function o(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}var r=function(){function t(t,n){for(var e=0;e<n.length;e++){var o=n[e];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(n,e,o){return e&&t(n.prototype,e),o&&t(n,o),n}}(),i=function(){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(this,t),this.adapter_=n}return r(t,null,[{key:"cssClasses",get:function(){return{}}},{key:"strings",get:function(){return{}}},{key:"numbers",get:function(){return{}}},{key:"defaultAdapter",get:function(){return{}}}]),r(t,[{key:"init",value:function(){}},{key:"destroy",value:function(){}}]),t}();n.a=i},2:function(t,n,e){"use strict";function o(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}var r=e(1),i=function(){function t(t,n){for(var e=0;e<n.length;e++){var o=n[e];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(n,e,o){return e&&t(n.prototype,e),o&&t(n,o),n}}(),u=function(){function t(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;o(this,t),this.root_=n;for(var r=arguments.length,i=Array(r>2?r-2:0),u=2;u<r;u++)i[u-2]=arguments[u];this.initialize.apply(this,i),this.foundation_=void 0===e?this.getDefaultFoundation():e,this.foundation_.init(),this.initialSyncWithDOM()}return i(t,null,[{key:"attachTo",value:function(n){return new t(n,new r.a)}}]),i(t,[{key:"initialize",value:function(){}},{key:"getDefaultFoundation",value:function(){throw new Error("Subclasses must override getDefaultFoundation to return a properly configured foundation class")}},{key:"initialSyncWithDOM",value:function(){}},{key:"destroy",value:function(){this.foundation_.destroy()}},{key:"listen",value:function(t,n){this.root_.addEventListener(t,n)}},{key:"unlisten",value:function(t,n){this.root_.removeEventListener(t,n)}},{key:"emit",value:function(t,n){var e=void 0;"function"==typeof CustomEvent?e=new CustomEvent(t,{detail:n}):(e=document.createEvent("CustomEvent"),e.initCustomEvent(t,!1,!1,n)),this.root_.dispatchEvent(e)}}]),t}();n.a=u},38:function(t,n,e){t.exports=e(0)}})}); | ||
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.base=n():(t.mdc=t.mdc||{},t.mdc.base=n())}(this,function(){return function(t){function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}var e={};return n.m=t,n.c=e,n.i=function(t){return t},n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:o})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},n.p="/assets/",n(n.s=68)}({0:function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var o=e(1);e.d(n,"MDCFoundation",function(){return o.a});var r=e(2);e.d(n,"MDCComponent",function(){return r.a})},1:function(t,n,e){"use strict";function o(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}var r=function(){function t(t,n){for(var e=0;e<n.length;e++){var o=n[e];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(n,e,o){return e&&t(n.prototype,e),o&&t(n,o),n}}(),i=function(){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(this,t),this.adapter_=n}return r(t,null,[{key:"cssClasses",get:function(){return{}}},{key:"strings",get:function(){return{}}},{key:"numbers",get:function(){return{}}},{key:"defaultAdapter",get:function(){return{}}}]),r(t,[{key:"init",value:function(){}},{key:"destroy",value:function(){}}]),t}();n.a=i},2:function(t,n,e){"use strict";function o(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}var r=e(1),i=function(){function t(t,n){for(var e=0;e<n.length;e++){var o=n[e];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(n,e,o){return e&&t(n.prototype,e),o&&t(n,o),n}}(),u=function(){function t(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;o(this,t),this.root_=n;for(var r=arguments.length,i=Array(r>2?r-2:0),u=2;u<r;u++)i[u-2]=arguments[u];this.initialize.apply(this,i),this.foundation_=void 0===e?this.getDefaultFoundation():e,this.foundation_.init(),this.initialSyncWithDOM()}return i(t,null,[{key:"attachTo",value:function(n){return new t(n,new r.a)}}]),i(t,[{key:"initialize",value:function(){}},{key:"getDefaultFoundation",value:function(){throw new Error("Subclasses must override getDefaultFoundation to return a properly configured foundation class")}},{key:"initialSyncWithDOM",value:function(){}},{key:"destroy",value:function(){this.foundation_.destroy()}},{key:"listen",value:function(t,n){this.root_.addEventListener(t,n)}},{key:"unlisten",value:function(t,n){this.root_.removeEventListener(t,n)}},{key:"emit",value:function(t,n){var e=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=void 0;"function"==typeof CustomEvent?o=new CustomEvent(t,{detail:n,bubbles:e}):(o=document.createEvent("CustomEvent"),o.initCustomEvent(t,e,!1,n)),this.root_.dispatchEvent(o)}}]),t}();n.a=u},68:function(t,n,e){t.exports=e(0)}})}); |
{ | ||
"name": "@material/base", | ||
"description": "The set of base classes for Material Components for the web", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"license": "Apache-2.0", | ||
@@ -6,0 +6,0 @@ "main": "index.js", |
@@ -1,5 +0,13 @@ | ||
# mdc-base | ||
<!--docs: | ||
title: "Base" | ||
layout: detail | ||
section: components | ||
excerpt: "Base foundation and component classes." | ||
path: /catalog/base/ | ||
--> | ||
MDC base contains core foundation and component classes that serve as the base classes for all of MDC-Web's foundation classes and components (respectively). | ||
# Base | ||
MDC Base contains core foundation and component classes that serve as the base classes for all of MDC-Web's foundation classes and components (respectively). | ||
Most of the time, you shouldn't need to depend on `mdc-base` directly. It is useful however if you'd like to write custom components that follow MDC-Web's pattern and elegantly integrate with the MDC-Web ecosystem. | ||
@@ -167,3 +175,3 @@ | ||
| `unlisten(type: string, handler: EventListener)` | Removes an event listener from the component's root node. Note that this is simply a proxy to `this.root_.removeEventListener`. | | ||
| `emit(type: string, data: Object)` | Dispatches a custom event of type `type` with detail `data` from the component's root node. This is the preferred way of dispatching events within our vanilla components. | | ||
| `emit(type: string, data: Object, shouldBubble: boolean = false)` | Dispatches a custom event of type `type` with detail `data` from the component's root node. It also takes an optional shouldBubble argument to specify if the event should bubble. This is the preferred way of dispatching events within our vanilla components. | | ||
@@ -170,0 +178,0 @@ #### Static Methods |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34423
448
268
1