🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@material/auto-init

Package Overview
Dependencies
Maintainers
13
Versions
1664
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@material/auto-init - npm Package Compare versions

Comparing version

to
2.3.0

constants.d.ts

2

dist/mdc.autoInit.d.ts

@@ -38,3 +38,3 @@ // Generated by dts-bundle v0.7.3

*/
export function mdcAutoInit(root?: Document, warn?: (message?: any, ...optionalParams: any[]) => void): MDCComponent<MDCFoundation<{}>>[];
export function mdcAutoInit(root?: Document): MDCComponent<MDCFoundation<{}>>[];
export namespace mdcAutoInit {

@@ -41,0 +41,0 @@ var register: (componentName: string, Constructor: MDCAttachable, warn?: (message?: any, ...optionalParams: any[]) => void) => void;

@@ -1,427 +0,172 @@

/*!
Material Components for the Web
Copyright (c) 2019 Google Inc.
License: MIT
*/
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["autoInit"] = factory();
else
root["mdc"] = root["mdc"] || {}, root["mdc"]["autoInit"] = factory();
})(this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // 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;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 134);
/******/ })
/************************************************************************/
/******/ ({
/***/ 134:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* @license
* Copyright 2016 Google Inc.
* Copyright Google LLC All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://github.com/material-components/material-components-web/blob/master/LICENSE
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = __webpack_require__(135);
var registry = {};
var CONSOLE_WARN = console.warn.bind(console); // tslint:disable-line:no-console
function emit(evtType, evtData, shouldBubble) {
if (shouldBubble === void 0) {
shouldBubble = false;
}
var evt;
if (typeof CustomEvent === 'function') {
evt = new CustomEvent(evtType, {
bubbles: shouldBubble,
detail: evtData
});
} else {
evt = document.createEvent('CustomEvent');
evt.initCustomEvent(evtType, shouldBubble, false, evtData);
}
document.dispatchEvent(evt);
}
/* istanbul ignore next: optional argument is not a branch statement */
/**
* Auto-initializes all MDC components on a page.
*/
function mdcAutoInit(root, warn) {
if (root === void 0) {
root = document;
}
if (warn === void 0) {
warn = CONSOLE_WARN;
}
var e_1, _a;
var components = [];
var nodes = [].slice.call(root.querySelectorAll('[data-mdc-auto-init]'));
try {
for (var nodes_1 = tslib_1.__values(nodes), nodes_1_1 = nodes_1.next(); !nodes_1_1.done; nodes_1_1 = nodes_1.next()) {
var node = nodes_1_1.value;
var ctorName = node.getAttribute('data-mdc-auto-init');
if (!ctorName) {
throw new Error('(mdc-auto-init) Constructor name must be given.');
(function webpackUniversalModuleDefinition(root, factory) {
if (typeof exports === "object" && typeof module === "object") module.exports = factory(); else if (typeof define === "function" && define.amd) define([], factory); else if (typeof exports === "object") exports["autoInit"] = factory(); else root["mdc"] = root["mdc"] || {},
root["mdc"]["autoInit"] = factory();
})(this, function() {
return function(modules) {
var installedModules = {};
function __webpack_require__(moduleId) {
if (installedModules[moduleId]) {
return installedModules[moduleId].exports;
}
var Constructor = registry[ctorName]; // tslint:disable-line:variable-name
if (typeof Constructor !== 'function') {
throw new Error("(mdc-auto-init) Could not find constructor in registry for " + ctorName);
var module = installedModules[moduleId] = {
i: moduleId,
l: false,
exports: {}
};
modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
module.l = true;
return module.exports;
}
__webpack_require__.m = modules;
__webpack_require__.c = installedModules;
__webpack_require__.d = function(exports, name, getter) {
if (!__webpack_require__.o(exports, name)) {
Object.defineProperty(exports, name, {
configurable: false,
enumerable: true,
get: getter
});
}
if (Object.getOwnPropertyDescriptor(node, ctorName)) {
warn("(mdc-auto-init) Component already initialized for " + node + ". Skipping...");
continue;
};
__webpack_require__.n = function(module) {
var getter = module && module.__esModule ? function getDefault() {
return module["default"];
} : function getModuleExports() {
return module;
};
__webpack_require__.d(getter, "a", getter);
return getter;
};
__webpack_require__.o = function(object, property) {
return Object.prototype.hasOwnProperty.call(object, property);
};
__webpack_require__.p = "";
return __webpack_require__(__webpack_require__.s = 112);
}({
112: function(module, exports, __webpack_require__) {
"use strict";
var __values = this && this.__values || function(o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
if (m) return m.call(o);
return {
next: function next() {
if (o && i >= o.length) o = void 0;
return {
value: o && o[i++],
done: !o
};
}
};
};
Object.defineProperty(exports, "__esModule", {
value: true
});
var constants_1 = __webpack_require__(113);
var AUTO_INIT_ATTR = constants_1.strings.AUTO_INIT_ATTR, AUTO_INIT_STATE_ATTR = constants_1.strings.AUTO_INIT_STATE_ATTR, INITIALIZED_STATE = constants_1.strings.INITIALIZED_STATE;
var registry = {};
var CONSOLE_WARN = console.warn.bind(console);
function emit(evtType, evtData, shouldBubble) {
if (shouldBubble === void 0) {
shouldBubble = false;
}
var evt;
if (typeof CustomEvent === "function") {
evt = new CustomEvent(evtType, {
bubbles: shouldBubble,
detail: evtData
});
} else {
evt = document.createEvent("CustomEvent");
evt.initCustomEvent(evtType, shouldBubble, false, evtData);
}
document.dispatchEvent(evt);
}
// TODO: Should we make an eslint rule for an attachTo() static method?
// See https://github.com/Microsoft/TypeScript/issues/14600 for discussion of static interface support in TS
var component = Constructor.attachTo(node);
Object.defineProperty(node, ctorName, {
configurable: true,
enumerable: false,
value: component,
writable: false
function mdcAutoInit(root) {
if (root === void 0) {
root = document;
}
var e_1, _a;
var components = [];
var nodes = [].slice.call(root.querySelectorAll("[" + AUTO_INIT_ATTR + "]"));
nodes = nodes.filter(function(node) {
return node.getAttribute(AUTO_INIT_STATE_ATTR) !== INITIALIZED_STATE;
});
try {
for (var nodes_1 = __values(nodes), nodes_1_1 = nodes_1.next(); !nodes_1_1.done; nodes_1_1 = nodes_1.next()) {
var node = nodes_1_1.value;
var ctorName = node.getAttribute(AUTO_INIT_ATTR);
if (!ctorName) {
throw new Error("(mdc-auto-init) Constructor name must be given.");
}
var Constructor = registry[ctorName];
if (typeof Constructor !== "function") {
throw new Error("(mdc-auto-init) Could not find constructor in registry for " + ctorName);
}
var component = Constructor.attachTo(node);
Object.defineProperty(node, ctorName, {
configurable: true,
enumerable: false,
value: component,
writable: false
});
components.push(component);
node.setAttribute(AUTO_INIT_STATE_ATTR, INITIALIZED_STATE);
}
} catch (e_1_1) {
e_1 = {
error: e_1_1
};
} finally {
try {
if (nodes_1_1 && !nodes_1_1.done && (_a = nodes_1.return)) _a.call(nodes_1);
} finally {
if (e_1) throw e_1.error;
}
}
emit("MDCAutoInit:End", {});
return components;
}
exports.mdcAutoInit = mdcAutoInit;
mdcAutoInit.register = function(componentName, Constructor, warn) {
if (warn === void 0) {
warn = CONSOLE_WARN;
}
if (typeof Constructor !== "function") {
throw new Error("(mdc-auto-init) Invalid Constructor value: " + Constructor + ". Expected function.");
}
var registryValue = registry[componentName];
if (registryValue) {
warn("(mdc-auto-init) Overriding registration for " + componentName + " with " + Constructor + ". Was: " + registryValue);
}
registry[componentName] = Constructor;
};
mdcAutoInit.deregister = function(componentName) {
delete registry[componentName];
};
mdcAutoInit.deregisterAll = function() {
var keys = Object.keys(registry);
keys.forEach(this.deregister, this);
};
exports.default = mdcAutoInit;
},
113: function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
components.push(component);
exports.strings = {
AUTO_INIT_ATTR: "data-mdc-auto-init",
AUTO_INIT_STATE_ATTR: "data-mdc-auto-init-state",
INITIALIZED_STATE: "initialized"
};
}
} catch (e_1_1) {
e_1 = { error: e_1_1 };
} finally {
try {
if (nodes_1_1 && !nodes_1_1.done && (_a = nodes_1.return)) _a.call(nodes_1);
} finally {
if (e_1) throw e_1.error;
}
}
emit('MDCAutoInit:End', {});
return components;
}
exports.mdcAutoInit = mdcAutoInit;
// Constructor is PascalCased because it is a direct reference to a class, rather than an instance of a class.
// tslint:disable-next-line:variable-name
mdcAutoInit.register = function (componentName, Constructor, warn) {
if (warn === void 0) {
warn = CONSOLE_WARN;
}
if (typeof Constructor !== 'function') {
throw new Error("(mdc-auto-init) Invalid Constructor value: " + Constructor + ". Expected function.");
}
var registryValue = registry[componentName];
if (registryValue) {
warn("(mdc-auto-init) Overriding registration for " + componentName + " with " + Constructor + ". Was: " + registryValue);
}
registry[componentName] = Constructor;
};
mdcAutoInit.deregister = function (componentName) {
delete registry[componentName];
};
mdcAutoInit.deregisterAll = function () {
var keys = Object.keys(registry);
keys.forEach(this.deregister, this);
};
// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
exports.default = mdcAutoInit;
/***/ }),
/***/ 135:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony export (immutable) */ __webpack_exports__["__extends"] = __extends;
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__assign", function() { return __assign; });
/* harmony export (immutable) */ __webpack_exports__["__rest"] = __rest;
/* harmony export (immutable) */ __webpack_exports__["__decorate"] = __decorate;
/* harmony export (immutable) */ __webpack_exports__["__param"] = __param;
/* harmony export (immutable) */ __webpack_exports__["__metadata"] = __metadata;
/* harmony export (immutable) */ __webpack_exports__["__awaiter"] = __awaiter;
/* harmony export (immutable) */ __webpack_exports__["__generator"] = __generator;
/* harmony export (immutable) */ __webpack_exports__["__exportStar"] = __exportStar;
/* harmony export (immutable) */ __webpack_exports__["__values"] = __values;
/* harmony export (immutable) */ __webpack_exports__["__read"] = __read;
/* harmony export (immutable) */ __webpack_exports__["__spread"] = __spread;
/* harmony export (immutable) */ __webpack_exports__["__await"] = __await;
/* harmony export (immutable) */ __webpack_exports__["__asyncGenerator"] = __asyncGenerator;
/* harmony export (immutable) */ __webpack_exports__["__asyncDelegator"] = __asyncDelegator;
/* harmony export (immutable) */ __webpack_exports__["__asyncValues"] = __asyncValues;
/* harmony export (immutable) */ __webpack_exports__["__makeTemplateObject"] = __makeTemplateObject;
/* harmony export (immutable) */ __webpack_exports__["__importStar"] = __importStar;
/* harmony export (immutable) */ __webpack_exports__["__importDefault"] = __importDefault;
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
function __extends(d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
}
return __assign.apply(this, arguments);
}
function __rest(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
t[p[i]] = s[p[i]];
return t;
}
function __decorate(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
}
function __param(paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
}
function __metadata(metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
}
function __awaiter(thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
function __generator(thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
}
function __exportStar(m, exports) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
function __values(o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
if (m) return m.call(o);
return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
}
function __read(o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
}
function __spread() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
}
function __await(v) {
return this instanceof __await ? (this.v = v, this) : new __await(v);
}
function __asyncGenerator(thisArg, _arguments, generator) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
}
function __asyncDelegator(o) {
var i, p;
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
}
function __asyncValues(o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
}
function __makeTemplateObject(cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
function __importStar(mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result.default = mod;
return result;
}
function __importDefault(mod) {
return (mod && mod.__esModule) ? mod : { default: mod };
}
/***/ })
/******/ });
});
//# sourceMappingURL=mdc.autoInit.js.map

@@ -1,43 +0,9 @@

/*!
Material Components for the Web
Copyright (c) 2019 Google Inc.
License: MIT
*/
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.autoInit=e():(t.mdc=t.mdc||{},t.mdc.autoInit=e())}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=134)}({134:function(t,e,n){"use strict";function r(t,e,n){void 0===n&&(n=!1);var r;"function"==typeof CustomEvent?r=new CustomEvent(t,{bubbles:n,detail:e}):(r=document.createEvent("CustomEvent"),r.initCustomEvent(t,n,!1,e)),document.dispatchEvent(r)}function o(t,e){void 0===t&&(t=document),void 0===e&&(e=c);var n,o,a=[],f=[].slice.call(t.querySelectorAll("[data-mdc-auto-init]"));try{for(var l=i.__values(f),s=l.next();!s.done;s=l.next()){var p=s.value,y=p.getAttribute("data-mdc-auto-init");if(!y)throw new Error("(mdc-auto-init) Constructor name must be given.");var d=u[y];if("function"!=typeof d)throw new Error("(mdc-auto-init) Could not find constructor in registry for "+y);if(Object.getOwnPropertyDescriptor(p,y))e("(mdc-auto-init) Component already initialized for "+p+". Skipping...");else{var v=d.attachTo(p);Object.defineProperty(p,y,{configurable:!0,enumerable:!1,value:v,writable:!1}),a.push(v)}}}catch(t){n={error:t}}finally{try{s&&!s.done&&(o=l.return)&&o.call(l)}finally{if(n)throw n.error}}return r("MDCAutoInit:End",{}),a}/**
/**
* @license
* Copyright 2016 Google Inc.
* Copyright Google LLC All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://github.com/material-components/material-components-web/blob/master/LICENSE
*/
Object.defineProperty(e,"__esModule",{value:!0});var i=n(135),u={},c=console.warn.bind(console);e.mdcAutoInit=o,o.register=function(t,e,n){if(void 0===n&&(n=c),"function"!=typeof e)throw new Error("(mdc-auto-init) Invalid Constructor value: "+e+". Expected function.");var r=u[t];r&&n("(mdc-auto-init) Overriding registration for "+t+" with "+e+". Was: "+r),u[t]=e},o.deregister=function(t){delete u[t]},o.deregisterAll=function(){Object.keys(u).forEach(this.deregister,this)},e.default=o},135:function(t,e,n){"use strict";function r(t,e){function n(){this.constructor=t}O(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function o(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&(n[r[o]]=t[r[o]]);return n}function i(t,e,n,r){var o,i=arguments.length,u=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(t,e,n,r);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(u=(i<3?o(u):i>3?o(e,n,u):o(e,n))||u);return i>3&&u&&Object.defineProperty(e,n,u),u}function u(t,e){return function(n,r){e(n,r,t)}}function c(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function a(t,e,n,r){return new(n||(n=Promise))(function(o,i){function u(t){try{a(r.next(t))}catch(t){i(t)}}function c(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){t.done?o(t.value):new n(function(e){e(t.value)}).then(u,c)}a((r=r.apply(t,e||[])).next())})}function f(t,e){function n(t){return function(e){return r([t,e])}}function r(n){if(o)throw new TypeError("Generator is already executing.");for(;a;)try{if(o=1,i&&(u=2&n[0]?i.return:n[0]?i.throw||((u=i.return)&&u.call(i),0):i.next)&&!(u=u.call(i,n[1])).done)return u;switch(i=0,u&&(n=[2&n[0],u.value]),n[0]){case 0:case 1:u=n;break;case 4:return a.label++,{value:n[1],done:!1};case 5:a.label++,i=n[1],n=[0];continue;case 7:n=a.ops.pop(),a.trys.pop();continue;default:if(u=a.trys,!(u=u.length>0&&u[u.length-1])&&(6===n[0]||2===n[0])){a=0;continue}if(3===n[0]&&(!u||n[1]>u[0]&&n[1]<u[3])){a.label=n[1];break}if(6===n[0]&&a.label<u[1]){a.label=u[1],u=n;break}if(u&&a.label<u[2]){a.label=u[2],a.ops.push(n);break}u[2]&&a.ops.pop(),a.trys.pop();continue}n=e.call(t,a)}catch(t){n=[6,t],i=0}finally{o=u=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var o,i,u,c,a={label:0,sent:function(){if(1&u[0])throw u[1];return u[1]},trys:[],ops:[]};return c={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(c[Symbol.iterator]=function(){return this}),c}function l(t,e){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}function s(t){var e="function"==typeof Symbol&&t[Symbol.iterator],n=0;return e?e.call(t):{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}function p(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),u=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)u.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return u}function y(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(p(arguments[e]));return t}function d(t){return this instanceof d?(this.v=t,this):new d(t)}function v(t,e,n){function r(t){l[t]&&(f[t]=function(e){return new Promise(function(n,r){s.push([t,e,n,r])>1||o(t,e)})})}function o(t,e){try{i(l[t](e))}catch(t){a(s[0][3],t)}}function i(t){t.value instanceof d?Promise.resolve(t.value.v).then(u,c):a(s[0][2],t)}function u(t){o("next",t)}function c(t){o("throw",t)}function a(t,e){t(e),s.shift(),s.length&&o(s[0][0],s[0][1])}if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var f,l=n.apply(t,e||[]),s=[];return f={},r("next"),r("throw"),r("return"),f[Symbol.asyncIterator]=function(){return this},f}function b(t){function e(e,o){n[e]=t[e]?function(n){return(r=!r)?{value:d(t[e](n)),done:"return"===e}:o?o(n):n}:o}var n,r;return n={},e("next"),e("throw",function(t){throw t}),e("return"),n[Symbol.iterator]=function(){return this},n}function h(t){function e(e){r[e]=t[e]&&function(r){return new Promise(function(o,i){r=t[e](r),n(o,i,r.done,r.value)})}}function n(t,e,n,r){Promise.resolve(r).then(function(e){t({value:e,done:n})},e)}if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,o=t[Symbol.asyncIterator];return o?o.call(t):(t="function"==typeof s?s(t):t[Symbol.iterator](),r={},e("next"),e("throw"),e("return"),r[Symbol.asyncIterator]=function(){return this},r)}function _(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function m(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function w(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.__extends=r,n.d(e,"__assign",function(){return g}),e.__rest=o,e.__decorate=i,e.__param=u,e.__metadata=c,e.__awaiter=a,e.__generator=f,e.__exportStar=l,e.__values=s,e.__read=p,e.__spread=y,e.__await=d,e.__asyncGenerator=v,e.__asyncDelegator=b,e.__asyncValues=h,e.__makeTemplateObject=_,e.__importStar=m,e.__importDefault=w;/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
var O=function(t,e){return(O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},g=function(){return g=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},g.apply(this,arguments)}}})});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.autoInit=e():(t.mdc=t.mdc||{},t.mdc.autoInit=e())}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=112)}({112:function(t,e,n){"use strict";function r(t,e,n){void 0===n&&(n=!1);var r;"function"==typeof CustomEvent?r=new CustomEvent(t,{bubbles:n,detail:e}):(r=document.createEvent("CustomEvent"),r.initCustomEvent(t,n,!1,e)),document.dispatchEvent(r)}function o(t){void 0===t&&(t=document);var e,n,o=[],u=[].slice.call(t.querySelectorAll("["+c+"]"));u=u.filter(function(t){return t.getAttribute(a)!==f});try{for(var d=i(u),l=d.next();!l.done;l=d.next()){var v=l.value,p=v.getAttribute(c);if(!p)throw new Error("(mdc-auto-init) Constructor name must be given.");var m=s[p];if("function"!=typeof m)throw new Error("(mdc-auto-init) Could not find constructor in registry for "+p);var T=m.attachTo(v);Object.defineProperty(v,p,{configurable:!0,enumerable:!1,value:T,writable:!1}),o.push(T),v.setAttribute(a,f)}}catch(t){e={error:t}}finally{try{l&&!l.done&&(n=d.return)&&n.call(d)}finally{if(e)throw e.error}}return r("MDCAutoInit:End",{}),o}var i=this&&this.__values||function(t){var e="function"==typeof Symbol&&t[Symbol.iterator],n=0;return e?e.call(t):{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}};Object.defineProperty(e,"__esModule",{value:!0});var u=n(113),c=u.strings.AUTO_INIT_ATTR,a=u.strings.AUTO_INIT_STATE_ATTR,f=u.strings.INITIALIZED_STATE,s={},d=console.warn.bind(console);e.mdcAutoInit=o,o.register=function(t,e,n){if(void 0===n&&(n=d),"function"!=typeof e)throw new Error("(mdc-auto-init) Invalid Constructor value: "+e+". Expected function.");var r=s[t];r&&n("(mdc-auto-init) Overriding registration for "+t+" with "+e+". Was: "+r),s[t]=e},o.deregister=function(t){delete s[t]},o.deregisterAll=function(){Object.keys(s).forEach(this.deregister,this)},e.default=o},113:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.strings={AUTO_INIT_ATTR:"data-mdc-auto-init",AUTO_INIT_STATE_ATTR:"data-mdc-auto-init-state",INITIALIZED_STATE:"initialized"}}})});
//# sourceMappingURL=mdc.autoInit.min.js.map

@@ -32,3 +32,3 @@ /**

*/
export declare function mdcAutoInit(root?: Document, warn?: (message?: any, ...optionalParams: any[]) => void): MDCComponent<MDCFoundation<{}>>[];
export declare function mdcAutoInit(root?: Document): MDCComponent<MDCFoundation<{}>>[];
export declare namespace mdcAutoInit {

@@ -35,0 +35,0 @@ var register: (componentName: string, Constructor: MDCAttachable, warn?: (message?: any, ...optionalParams: any[]) => void) => void;

@@ -24,2 +24,4 @@ /**

import * as tslib_1 from "tslib";
import { strings } from './constants';
var AUTO_INIT_ATTR = strings.AUTO_INIT_ATTR, AUTO_INIT_STATE_ATTR = strings.AUTO_INIT_STATE_ATTR, INITIALIZED_STATE = strings.INITIALIZED_STATE;
var registry = {};

@@ -46,12 +48,12 @@ var CONSOLE_WARN = console.warn.bind(console); // tslint:disable-line:no-console

*/
export function mdcAutoInit(root, warn) {
export function mdcAutoInit(root) {
if (root === void 0) { root = document; }
if (warn === void 0) { warn = CONSOLE_WARN; }
var e_1, _a;
var components = [];
var nodes = [].slice.call(root.querySelectorAll('[data-mdc-auto-init]'));
var nodes = [].slice.call(root.querySelectorAll("[" + AUTO_INIT_ATTR + "]"));
nodes = nodes.filter(function (node) { return node.getAttribute(AUTO_INIT_STATE_ATTR) !== INITIALIZED_STATE; });
try {
for (var nodes_1 = tslib_1.__values(nodes), nodes_1_1 = nodes_1.next(); !nodes_1_1.done; nodes_1_1 = nodes_1.next()) {
var node = nodes_1_1.value;
var ctorName = node.getAttribute('data-mdc-auto-init');
var ctorName = node.getAttribute(AUTO_INIT_ATTR);
if (!ctorName) {

@@ -64,6 +66,2 @@ throw new Error('(mdc-auto-init) Constructor name must be given.');

}
if (Object.getOwnPropertyDescriptor(node, ctorName)) {
warn("(mdc-auto-init) Component already initialized for " + node + ". Skipping...");
continue;
}
// TODO: Should we make an eslint rule for an attachTo() static method?

@@ -79,2 +77,3 @@ // See https://github.com/Microsoft/TypeScript/issues/14600 for discussion of static interface support in TS

components.push(component);
node.setAttribute(AUTO_INIT_STATE_ATTR, INITIALIZED_STATE);
}

@@ -81,0 +80,0 @@ }

{
"name": "@material/auto-init",
"description": "Declarative, easy-to-use auto-initialization for Material Components for the web",
"version": "1.0.0",
"version": "2.3.0",
"main": "dist/mdc.autoInit.js",

@@ -6,0 +6,0 @@ "module": "index.js",

@@ -69,2 +69,12 @@ <!--docs:

#### Calling subsequent `mdc.autoInit()`
If you decide to add new components into the DOM after the initial `mdc.autoInit()`, you can make subsequent calls to `mdc.autoInit()`. This will not reinitialize existing components. This works since mdc-auto-init will add the `data-mdc-auto-init-state="initialized"` attribute, which tracks if the component has already been initialized. After calling `mdc.autoInit()` your component will then look like:
```html
<div class="mdc-text-field" data-mdc-auto-init="MDCTextField" data-mdc-auto-init-state="initialized">
...
</div>
```
### Using as a standalone module

@@ -71,0 +81,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet