| 1 | "use strict";
|
|---|
| 2 |
|
|---|
| 3 | /*
|
|---|
| 4 | MIT License http://www.opensource.org/licenses/mit-license.php
|
|---|
| 5 | Author Tobias Koppers @sokra
|
|---|
| 6 | */
|
|---|
| 7 | module.exports = function (cssWithMappingToString) {
|
|---|
| 8 | var list = [];
|
|---|
| 9 |
|
|---|
| 10 | // return the list of modules as css string
|
|---|
| 11 | list.toString = function toString() {
|
|---|
| 12 | return this.map(function (item) {
|
|---|
| 13 | var content = "";
|
|---|
| 14 | var needLayer = typeof item[5] !== "undefined";
|
|---|
| 15 | if (item[4]) {
|
|---|
| 16 | content += "@supports (".concat(item[4], ") {");
|
|---|
| 17 | }
|
|---|
| 18 | if (item[2]) {
|
|---|
| 19 | content += "@media ".concat(item[2], " {");
|
|---|
| 20 | }
|
|---|
| 21 | if (needLayer) {
|
|---|
| 22 | content += "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {");
|
|---|
| 23 | }
|
|---|
| 24 | content += cssWithMappingToString(item);
|
|---|
| 25 | if (needLayer) {
|
|---|
| 26 | content += "}";
|
|---|
| 27 | }
|
|---|
| 28 | if (item[2]) {
|
|---|
| 29 | content += "}";
|
|---|
| 30 | }
|
|---|
| 31 | if (item[4]) {
|
|---|
| 32 | content += "}";
|
|---|
| 33 | }
|
|---|
| 34 | return content;
|
|---|
| 35 | }).join("");
|
|---|
| 36 | };
|
|---|
| 37 |
|
|---|
| 38 | // import a list of modules into the list
|
|---|
| 39 | list.i = function i(modules, media, dedupe, supports, layer) {
|
|---|
| 40 | if (typeof modules === "string") {
|
|---|
| 41 | modules = [[null, modules, undefined]];
|
|---|
| 42 | }
|
|---|
| 43 | var alreadyImportedModules = {};
|
|---|
| 44 | if (dedupe) {
|
|---|
| 45 | for (var k = 0; k < this.length; k++) {
|
|---|
| 46 | var id = this[k][0];
|
|---|
| 47 | if (id != null) {
|
|---|
| 48 | alreadyImportedModules[id] = true;
|
|---|
| 49 | }
|
|---|
| 50 | }
|
|---|
| 51 | }
|
|---|
| 52 | for (var _k = 0; _k < modules.length; _k++) {
|
|---|
| 53 | var item = [].concat(modules[_k]);
|
|---|
| 54 | if (dedupe && alreadyImportedModules[item[0]]) {
|
|---|
| 55 | continue;
|
|---|
| 56 | }
|
|---|
| 57 | if (typeof layer !== "undefined") {
|
|---|
| 58 | if (typeof item[5] === "undefined") {
|
|---|
| 59 | item[5] = layer;
|
|---|
| 60 | } else {
|
|---|
| 61 | item[1] = "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {").concat(item[1], "}");
|
|---|
| 62 | item[5] = layer;
|
|---|
| 63 | }
|
|---|
| 64 | }
|
|---|
| 65 | if (media) {
|
|---|
| 66 | if (!item[2]) {
|
|---|
| 67 | item[2] = media;
|
|---|
| 68 | } else {
|
|---|
| 69 | item[1] = "@media ".concat(item[2], " {").concat(item[1], "}");
|
|---|
| 70 | item[2] = media;
|
|---|
| 71 | }
|
|---|
| 72 | }
|
|---|
| 73 | if (supports) {
|
|---|
| 74 | if (!item[4]) {
|
|---|
| 75 | item[4] = "".concat(supports);
|
|---|
| 76 | } else {
|
|---|
| 77 | item[1] = "@supports (".concat(item[4], ") {").concat(item[1], "}");
|
|---|
| 78 | item[4] = supports;
|
|---|
| 79 | }
|
|---|
| 80 | }
|
|---|
| 81 | list.push(item);
|
|---|
| 82 | }
|
|---|
| 83 | };
|
|---|
| 84 | return list;
|
|---|
| 85 | }; |
|---|