@universityofmaryland/web-model-library 1.0.0
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/README.md +138 -0
- package/dist/_types.d.ts +77 -0
- package/dist/_types.d.ts.map +1 -0
- package/dist/_virtual/___vite-browser-external.js +8 -0
- package/dist/_virtual/___vite-browser-external.js.map +1 -0
- package/dist/_virtual/___vite-browser-external.mjs +7 -0
- package/dist/_virtual/___vite-browser-external.mjs.map +1 -0
- package/dist/_virtual/__vite-browser-external.js +4 -0
- package/dist/_virtual/__vite-browser-external.js.map +1 -0
- package/dist/_virtual/__vite-browser-external.mjs +5 -0
- package/dist/_virtual/__vite-browser-external.mjs.map +1 -0
- package/dist/_virtual/_commonjsHelpers.js +37 -0
- package/dist/_virtual/_commonjsHelpers.js.map +1 -0
- package/dist/_virtual/_commonjsHelpers.mjs +37 -0
- package/dist/_virtual/_commonjsHelpers.mjs.map +1 -0
- package/dist/_virtual/index.js +7 -0
- package/dist/_virtual/index.js.map +1 -0
- package/dist/_virtual/index.mjs +8 -0
- package/dist/_virtual/index.mjs.map +1 -0
- package/dist/_virtual/picocolors.browser.js +5 -0
- package/dist/_virtual/picocolors.browser.js.map +1 -0
- package/dist/_virtual/picocolors.browser.mjs +5 -0
- package/dist/_virtual/picocolors.browser.mjs.map +1 -0
- package/dist/_virtual/postcss.js +7 -0
- package/dist/_virtual/postcss.js.map +1 -0
- package/dist/_virtual/postcss.mjs +8 -0
- package/dist/_virtual/postcss.mjs.map +1 -0
- package/dist/_virtual/symbols.js +5 -0
- package/dist/_virtual/symbols.js.map +1 -0
- package/dist/_virtual/symbols.mjs +5 -0
- package/dist/_virtual/symbols.mjs.map +1 -0
- package/dist/attributes/checks.d.ts +133 -0
- package/dist/attributes/checks.d.ts.map +1 -0
- package/dist/attributes/checks.js +757 -0
- package/dist/attributes/checks.js.map +1 -0
- package/dist/attributes/checks.mjs +740 -0
- package/dist/attributes/checks.mjs.map +1 -0
- package/dist/attributes/handler.d.ts +52 -0
- package/dist/attributes/handler.d.ts.map +1 -0
- package/dist/attributes/handler.js +205 -0
- package/dist/attributes/handler.js.map +1 -0
- package/dist/attributes/handler.mjs +206 -0
- package/dist/attributes/handler.mjs.map +1 -0
- package/dist/attributes/index.d.ts +7 -0
- package/dist/attributes/index.d.ts.map +1 -0
- package/dist/attributes/names.d.ts +132 -0
- package/dist/attributes/names.d.ts.map +1 -0
- package/dist/attributes/names.js +145 -0
- package/dist/attributes/names.js.map +1 -0
- package/dist/attributes/names.mjs +146 -0
- package/dist/attributes/names.mjs.map +1 -0
- package/dist/attributes/values.d.ts +70 -0
- package/dist/attributes/values.d.ts.map +1 -0
- package/dist/attributes/values.js +80 -0
- package/dist/attributes/values.js.map +1 -0
- package/dist/attributes/values.mjs +81 -0
- package/dist/attributes/values.mjs.map +1 -0
- package/dist/attributes.d.ts +2 -0
- package/dist/attributes.js +23 -0
- package/dist/attributes.js.map +1 -0
- package/dist/attributes.mjs +23 -0
- package/dist/attributes.mjs.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +13 -0
- package/dist/index.mjs.map +1 -0
- package/dist/model/index.d.ts +43 -0
- package/dist/model/index.d.ts.map +1 -0
- package/dist/model.d.ts +2 -0
- package/dist/model.js +259 -0
- package/dist/model.js.map +1 -0
- package/dist/model.mjs +259 -0
- package/dist/model.mjs.map +1 -0
- package/dist/node_modules/nanoid/non-secure/index.js +31 -0
- package/dist/node_modules/nanoid/non-secure/index.js.map +1 -0
- package/dist/node_modules/nanoid/non-secure/index.mjs +31 -0
- package/dist/node_modules/nanoid/non-secure/index.mjs.map +1 -0
- package/dist/node_modules/picocolors/picocolors.browser.js +17 -0
- package/dist/node_modules/picocolors/picocolors.browser.js.map +1 -0
- package/dist/node_modules/picocolors/picocolors.browser.mjs +17 -0
- package/dist/node_modules/picocolors/picocolors.browser.mjs.map +1 -0
- package/dist/node_modules/postcss/lib/at-rule.js +30 -0
- package/dist/node_modules/postcss/lib/at-rule.js.map +1 -0
- package/dist/node_modules/postcss/lib/at-rule.mjs +30 -0
- package/dist/node_modules/postcss/lib/at-rule.mjs.map +1 -0
- package/dist/node_modules/postcss/lib/comment.js +21 -0
- package/dist/node_modules/postcss/lib/comment.js.map +1 -0
- package/dist/node_modules/postcss/lib/comment.mjs +21 -0
- package/dist/node_modules/postcss/lib/comment.mjs.map +1 -0
- package/dist/node_modules/postcss/lib/container.js +383 -0
- package/dist/node_modules/postcss/lib/container.js.map +1 -0
- package/dist/node_modules/postcss/lib/container.mjs +383 -0
- package/dist/node_modules/postcss/lib/container.mjs.map +1 -0
- package/dist/node_modules/postcss/lib/css-syntax-error.js +92 -0
- package/dist/node_modules/postcss/lib/css-syntax-error.js.map +1 -0
- package/dist/node_modules/postcss/lib/css-syntax-error.mjs +92 -0
- package/dist/node_modules/postcss/lib/css-syntax-error.mjs.map +1 -0
- package/dist/node_modules/postcss/lib/declaration.js +27 -0
- package/dist/node_modules/postcss/lib/declaration.js.map +1 -0
- package/dist/node_modules/postcss/lib/declaration.mjs +27 -0
- package/dist/node_modules/postcss/lib/declaration.mjs.map +1 -0
- package/dist/node_modules/postcss/lib/document.js +34 -0
- package/dist/node_modules/postcss/lib/document.js.map +1 -0
- package/dist/node_modules/postcss/lib/document.mjs +34 -0
- package/dist/node_modules/postcss/lib/document.mjs.map +1 -0
- package/dist/node_modules/postcss/lib/fromJSON.js +67 -0
- package/dist/node_modules/postcss/lib/fromJSON.js.map +1 -0
- package/dist/node_modules/postcss/lib/fromJSON.mjs +67 -0
- package/dist/node_modules/postcss/lib/fromJSON.mjs.map +1 -0
- package/dist/node_modules/postcss/lib/input.js +216 -0
- package/dist/node_modules/postcss/lib/input.js.map +1 -0
- package/dist/node_modules/postcss/lib/input.mjs +216 -0
- package/dist/node_modules/postcss/lib/input.mjs.map +1 -0
- package/dist/node_modules/postcss/lib/lazy-result.js +467 -0
- package/dist/node_modules/postcss/lib/lazy-result.js.map +1 -0
- package/dist/node_modules/postcss/lib/lazy-result.mjs +467 -0
- package/dist/node_modules/postcss/lib/lazy-result.mjs.map +1 -0
- package/dist/node_modules/postcss/lib/list.js +60 -0
- package/dist/node_modules/postcss/lib/list.js.map +1 -0
- package/dist/node_modules/postcss/lib/list.mjs +60 -0
- package/dist/node_modules/postcss/lib/list.mjs.map +1 -0
- package/dist/node_modules/postcss/lib/map-generator.js +314 -0
- package/dist/node_modules/postcss/lib/map-generator.js.map +1 -0
- package/dist/node_modules/postcss/lib/map-generator.mjs +314 -0
- package/dist/node_modules/postcss/lib/map-generator.mjs.map +1 -0
- package/dist/node_modules/postcss/lib/no-work-result.js +113 -0
- package/dist/node_modules/postcss/lib/no-work-result.js.map +1 -0
- package/dist/node_modules/postcss/lib/no-work-result.mjs +113 -0
- package/dist/node_modules/postcss/lib/no-work-result.mjs.map +1 -0
- package/dist/node_modules/postcss/lib/node.js +335 -0
- package/dist/node_modules/postcss/lib/node.js.map +1 -0
- package/dist/node_modules/postcss/lib/node.mjs +335 -0
- package/dist/node_modules/postcss/lib/node.mjs.map +1 -0
- package/dist/node_modules/postcss/lib/parse.js +30 -0
- package/dist/node_modules/postcss/lib/parse.js.map +1 -0
- package/dist/node_modules/postcss/lib/parse.mjs +30 -0
- package/dist/node_modules/postcss/lib/parse.mjs.map +1 -0
- package/dist/node_modules/postcss/lib/parser.js +543 -0
- package/dist/node_modules/postcss/lib/parser.js.map +1 -0
- package/dist/node_modules/postcss/lib/parser.mjs +543 -0
- package/dist/node_modules/postcss/lib/parser.mjs.map +1 -0
- package/dist/node_modules/postcss/lib/postcss.js +28 -0
- package/dist/node_modules/postcss/lib/postcss.js.map +1 -0
- package/dist/node_modules/postcss/lib/postcss.mjs +29 -0
- package/dist/node_modules/postcss/lib/postcss.mjs.map +1 -0
- package/dist/node_modules/postcss/lib/postcss2.js +110 -0
- package/dist/node_modules/postcss/lib/postcss2.js.map +1 -0
- package/dist/node_modules/postcss/lib/postcss2.mjs +110 -0
- package/dist/node_modules/postcss/lib/postcss2.mjs.map +1 -0
- package/dist/node_modules/postcss/lib/previous-map.js +123 -0
- package/dist/node_modules/postcss/lib/previous-map.js.map +1 -0
- package/dist/node_modules/postcss/lib/previous-map.mjs +123 -0
- package/dist/node_modules/postcss/lib/previous-map.mjs.map +1 -0
- package/dist/node_modules/postcss/lib/processor.js +61 -0
- package/dist/node_modules/postcss/lib/processor.js.map +1 -0
- package/dist/node_modules/postcss/lib/processor.mjs +61 -0
- package/dist/node_modules/postcss/lib/processor.mjs.map +1 -0
- package/dist/node_modules/postcss/lib/result.js +44 -0
- package/dist/node_modules/postcss/lib/result.js.map +1 -0
- package/dist/node_modules/postcss/lib/result.mjs +44 -0
- package/dist/node_modules/postcss/lib/result.mjs.map +1 -0
- package/dist/node_modules/postcss/lib/root.js +58 -0
- package/dist/node_modules/postcss/lib/root.js.map +1 -0
- package/dist/node_modules/postcss/lib/root.mjs +58 -0
- package/dist/node_modules/postcss/lib/root.mjs.map +1 -0
- package/dist/node_modules/postcss/lib/rule.js +33 -0
- package/dist/node_modules/postcss/lib/rule.js.map +1 -0
- package/dist/node_modules/postcss/lib/rule.mjs +33 -0
- package/dist/node_modules/postcss/lib/rule.mjs.map +1 -0
- package/dist/node_modules/postcss/lib/stringifier.js +308 -0
- package/dist/node_modules/postcss/lib/stringifier.js.map +1 -0
- package/dist/node_modules/postcss/lib/stringifier.mjs +308 -0
- package/dist/node_modules/postcss/lib/stringifier.mjs.map +1 -0
- package/dist/node_modules/postcss/lib/stringify.js +19 -0
- package/dist/node_modules/postcss/lib/stringify.js.map +1 -0
- package/dist/node_modules/postcss/lib/stringify.mjs +19 -0
- package/dist/node_modules/postcss/lib/stringify.mjs.map +1 -0
- package/dist/node_modules/postcss/lib/symbols.js +13 -0
- package/dist/node_modules/postcss/lib/symbols.js.map +1 -0
- package/dist/node_modules/postcss/lib/symbols.mjs +13 -0
- package/dist/node_modules/postcss/lib/symbols.mjs.map +1 -0
- package/dist/node_modules/postcss/lib/tokenize.js +219 -0
- package/dist/node_modules/postcss/lib/tokenize.js.map +1 -0
- package/dist/node_modules/postcss/lib/tokenize.mjs +219 -0
- package/dist/node_modules/postcss/lib/tokenize.mjs.map +1 -0
- package/dist/node_modules/postcss/lib/warning.js +40 -0
- package/dist/node_modules/postcss/lib/warning.js.map +1 -0
- package/dist/node_modules/postcss/lib/warning.mjs +40 -0
- package/dist/node_modules/postcss/lib/warning.mjs.map +1 -0
- package/dist/packages/model/node_modules/postcss-discard-duplicates/src/index.js +130 -0
- package/dist/packages/model/node_modules/postcss-discard-duplicates/src/index.js.map +1 -0
- package/dist/packages/model/node_modules/postcss-discard-duplicates/src/index.mjs +130 -0
- package/dist/packages/model/node_modules/postcss-discard-duplicates/src/index.mjs.map +1 -0
- package/dist/slots/create.d.ts +15 -0
- package/dist/slots/create.d.ts.map +1 -0
- package/dist/slots/create.js +50 -0
- package/dist/slots/create.js.map +1 -0
- package/dist/slots/create.mjs +50 -0
- package/dist/slots/create.mjs.map +1 -0
- package/dist/slots/element.d.ts +3 -0
- package/dist/slots/element.d.ts.map +1 -0
- package/dist/slots/element.js +42 -0
- package/dist/slots/element.js.map +1 -0
- package/dist/slots/element.mjs +42 -0
- package/dist/slots/element.mjs.map +1 -0
- package/dist/slots/extract.d.ts +6 -0
- package/dist/slots/extract.d.ts.map +1 -0
- package/dist/slots/index.d.ts +140 -0
- package/dist/slots/index.d.ts.map +1 -0
- package/dist/slots/mapping.d.ts +82 -0
- package/dist/slots/mapping.d.ts.map +1 -0
- package/dist/slots/mapping.js +97 -0
- package/dist/slots/mapping.js.map +1 -0
- package/dist/slots/mapping.mjs +97 -0
- package/dist/slots/mapping.mjs.map +1 -0
- package/dist/slots/query.d.ts +9 -0
- package/dist/slots/query.d.ts.map +1 -0
- package/dist/slots/validate.d.ts +22 -0
- package/dist/slots/validate.d.ts.map +1 -0
- package/dist/slots.d.ts +6 -0
- package/dist/slots.js +73 -0
- package/dist/slots.js.map +1 -0
- package/dist/slots.mjs +74 -0
- package/dist/slots.mjs.map +1 -0
- package/dist/utilities/index.d.ts +4 -0
- package/dist/utilities/index.d.ts.map +1 -0
- package/dist/utilities/lifecycle.d.ts +12 -0
- package/dist/utilities/lifecycle.d.ts.map +1 -0
- package/dist/utilities/lifecycle.js +21 -0
- package/dist/utilities/lifecycle.js.map +1 -0
- package/dist/utilities/lifecycle.mjs +21 -0
- package/dist/utilities/lifecycle.mjs.map +1 -0
- package/dist/utilities/register.d.ts +17 -0
- package/dist/utilities/register.d.ts.map +1 -0
- package/dist/utilities/register.js +32 -0
- package/dist/utilities/register.js.map +1 -0
- package/dist/utilities/register.mjs +32 -0
- package/dist/utilities/register.mjs.map +1 -0
- package/dist/utilities/styles.d.ts +5 -0
- package/dist/utilities/styles.d.ts.map +1 -0
- package/dist/utilities/styles.js +79 -0
- package/dist/utilities/styles.js.map +1 -0
- package/dist/utilities/styles.mjs +80 -0
- package/dist/utilities/styles.mjs.map +1 -0
- package/dist/utilities.d.ts +2 -0
- package/dist/utilities.js +11 -0
- package/dist/utilities.js.map +1 -0
- package/dist/utilities.mjs +11 -0
- package/dist/utilities.mjs.map +1 -0
- package/package.json +69 -0
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
var stringifier;
|
|
4
|
+
var hasRequiredStringifier;
|
|
5
|
+
function requireStringifier() {
|
|
6
|
+
if (hasRequiredStringifier) return stringifier;
|
|
7
|
+
hasRequiredStringifier = 1;
|
|
8
|
+
const DEFAULT_RAW = {
|
|
9
|
+
after: "\n",
|
|
10
|
+
beforeClose: "\n",
|
|
11
|
+
beforeComment: "\n",
|
|
12
|
+
beforeDecl: "\n",
|
|
13
|
+
beforeOpen: " ",
|
|
14
|
+
beforeRule: "\n",
|
|
15
|
+
colon: ": ",
|
|
16
|
+
commentLeft: " ",
|
|
17
|
+
commentRight: " ",
|
|
18
|
+
emptyBody: "",
|
|
19
|
+
indent: " ",
|
|
20
|
+
semicolon: false
|
|
21
|
+
};
|
|
22
|
+
function capitalize(str) {
|
|
23
|
+
return str[0].toUpperCase() + str.slice(1);
|
|
24
|
+
}
|
|
25
|
+
class Stringifier {
|
|
26
|
+
constructor(builder) {
|
|
27
|
+
this.builder = builder;
|
|
28
|
+
}
|
|
29
|
+
atrule(node, semicolon) {
|
|
30
|
+
let name = "@" + node.name;
|
|
31
|
+
let params = node.params ? this.rawValue(node, "params") : "";
|
|
32
|
+
if (typeof node.raws.afterName !== "undefined") {
|
|
33
|
+
name += node.raws.afterName;
|
|
34
|
+
} else if (params) {
|
|
35
|
+
name += " ";
|
|
36
|
+
}
|
|
37
|
+
if (node.nodes) {
|
|
38
|
+
this.block(node, name + params);
|
|
39
|
+
} else {
|
|
40
|
+
let end = (node.raws.between || "") + (semicolon ? ";" : "");
|
|
41
|
+
this.builder(name + params + end, node);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
beforeAfter(node, detect) {
|
|
45
|
+
let value;
|
|
46
|
+
if (node.type === "decl") {
|
|
47
|
+
value = this.raw(node, null, "beforeDecl");
|
|
48
|
+
} else if (node.type === "comment") {
|
|
49
|
+
value = this.raw(node, null, "beforeComment");
|
|
50
|
+
} else if (detect === "before") {
|
|
51
|
+
value = this.raw(node, null, "beforeRule");
|
|
52
|
+
} else {
|
|
53
|
+
value = this.raw(node, null, "beforeClose");
|
|
54
|
+
}
|
|
55
|
+
let buf = node.parent;
|
|
56
|
+
let depth = 0;
|
|
57
|
+
while (buf && buf.type !== "root") {
|
|
58
|
+
depth += 1;
|
|
59
|
+
buf = buf.parent;
|
|
60
|
+
}
|
|
61
|
+
if (value.includes("\n")) {
|
|
62
|
+
let indent = this.raw(node, null, "indent");
|
|
63
|
+
if (indent.length) {
|
|
64
|
+
for (let step = 0; step < depth; step++) value += indent;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return value;
|
|
68
|
+
}
|
|
69
|
+
block(node, start) {
|
|
70
|
+
let between = this.raw(node, "between", "beforeOpen");
|
|
71
|
+
this.builder(start + between + "{", node, "start");
|
|
72
|
+
let after;
|
|
73
|
+
if (node.nodes && node.nodes.length) {
|
|
74
|
+
this.body(node);
|
|
75
|
+
after = this.raw(node, "after");
|
|
76
|
+
} else {
|
|
77
|
+
after = this.raw(node, "after", "emptyBody");
|
|
78
|
+
}
|
|
79
|
+
if (after) this.builder(after);
|
|
80
|
+
this.builder("}", node, "end");
|
|
81
|
+
}
|
|
82
|
+
body(node) {
|
|
83
|
+
let last = node.nodes.length - 1;
|
|
84
|
+
while (last > 0) {
|
|
85
|
+
if (node.nodes[last].type !== "comment") break;
|
|
86
|
+
last -= 1;
|
|
87
|
+
}
|
|
88
|
+
let semicolon = this.raw(node, "semicolon");
|
|
89
|
+
for (let i = 0; i < node.nodes.length; i++) {
|
|
90
|
+
let child = node.nodes[i];
|
|
91
|
+
let before = this.raw(child, "before");
|
|
92
|
+
if (before) this.builder(before);
|
|
93
|
+
this.stringify(child, last !== i || semicolon);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
comment(node) {
|
|
97
|
+
let left = this.raw(node, "left", "commentLeft");
|
|
98
|
+
let right = this.raw(node, "right", "commentRight");
|
|
99
|
+
this.builder("/*" + left + node.text + right + "*/", node);
|
|
100
|
+
}
|
|
101
|
+
decl(node, semicolon) {
|
|
102
|
+
let between = this.raw(node, "between", "colon");
|
|
103
|
+
let string = node.prop + between + this.rawValue(node, "value");
|
|
104
|
+
if (node.important) {
|
|
105
|
+
string += node.raws.important || " !important";
|
|
106
|
+
}
|
|
107
|
+
if (semicolon) string += ";";
|
|
108
|
+
this.builder(string, node);
|
|
109
|
+
}
|
|
110
|
+
document(node) {
|
|
111
|
+
this.body(node);
|
|
112
|
+
}
|
|
113
|
+
raw(node, own, detect) {
|
|
114
|
+
let value;
|
|
115
|
+
if (!detect) detect = own;
|
|
116
|
+
if (own) {
|
|
117
|
+
value = node.raws[own];
|
|
118
|
+
if (typeof value !== "undefined") return value;
|
|
119
|
+
}
|
|
120
|
+
let parent = node.parent;
|
|
121
|
+
if (detect === "before") {
|
|
122
|
+
if (!parent || parent.type === "root" && parent.first === node) {
|
|
123
|
+
return "";
|
|
124
|
+
}
|
|
125
|
+
if (parent && parent.type === "document") {
|
|
126
|
+
return "";
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
if (!parent) return DEFAULT_RAW[detect];
|
|
130
|
+
let root = node.root();
|
|
131
|
+
if (!root.rawCache) root.rawCache = {};
|
|
132
|
+
if (typeof root.rawCache[detect] !== "undefined") {
|
|
133
|
+
return root.rawCache[detect];
|
|
134
|
+
}
|
|
135
|
+
if (detect === "before" || detect === "after") {
|
|
136
|
+
return this.beforeAfter(node, detect);
|
|
137
|
+
} else {
|
|
138
|
+
let method = "raw" + capitalize(detect);
|
|
139
|
+
if (this[method]) {
|
|
140
|
+
value = this[method](root, node);
|
|
141
|
+
} else {
|
|
142
|
+
root.walk((i) => {
|
|
143
|
+
value = i.raws[own];
|
|
144
|
+
if (typeof value !== "undefined") return false;
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (typeof value === "undefined") value = DEFAULT_RAW[detect];
|
|
149
|
+
root.rawCache[detect] = value;
|
|
150
|
+
return value;
|
|
151
|
+
}
|
|
152
|
+
rawBeforeClose(root) {
|
|
153
|
+
let value;
|
|
154
|
+
root.walk((i) => {
|
|
155
|
+
if (i.nodes && i.nodes.length > 0) {
|
|
156
|
+
if (typeof i.raws.after !== "undefined") {
|
|
157
|
+
value = i.raws.after;
|
|
158
|
+
if (value.includes("\n")) {
|
|
159
|
+
value = value.replace(/[^\n]+$/, "");
|
|
160
|
+
}
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
if (value) value = value.replace(/\S/g, "");
|
|
166
|
+
return value;
|
|
167
|
+
}
|
|
168
|
+
rawBeforeComment(root, node) {
|
|
169
|
+
let value;
|
|
170
|
+
root.walkComments((i) => {
|
|
171
|
+
if (typeof i.raws.before !== "undefined") {
|
|
172
|
+
value = i.raws.before;
|
|
173
|
+
if (value.includes("\n")) {
|
|
174
|
+
value = value.replace(/[^\n]+$/, "");
|
|
175
|
+
}
|
|
176
|
+
return false;
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
if (typeof value === "undefined") {
|
|
180
|
+
value = this.raw(node, null, "beforeDecl");
|
|
181
|
+
} else if (value) {
|
|
182
|
+
value = value.replace(/\S/g, "");
|
|
183
|
+
}
|
|
184
|
+
return value;
|
|
185
|
+
}
|
|
186
|
+
rawBeforeDecl(root, node) {
|
|
187
|
+
let value;
|
|
188
|
+
root.walkDecls((i) => {
|
|
189
|
+
if (typeof i.raws.before !== "undefined") {
|
|
190
|
+
value = i.raws.before;
|
|
191
|
+
if (value.includes("\n")) {
|
|
192
|
+
value = value.replace(/[^\n]+$/, "");
|
|
193
|
+
}
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
if (typeof value === "undefined") {
|
|
198
|
+
value = this.raw(node, null, "beforeRule");
|
|
199
|
+
} else if (value) {
|
|
200
|
+
value = value.replace(/\S/g, "");
|
|
201
|
+
}
|
|
202
|
+
return value;
|
|
203
|
+
}
|
|
204
|
+
rawBeforeOpen(root) {
|
|
205
|
+
let value;
|
|
206
|
+
root.walk((i) => {
|
|
207
|
+
if (i.type !== "decl") {
|
|
208
|
+
value = i.raws.between;
|
|
209
|
+
if (typeof value !== "undefined") return false;
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
return value;
|
|
213
|
+
}
|
|
214
|
+
rawBeforeRule(root) {
|
|
215
|
+
let value;
|
|
216
|
+
root.walk((i) => {
|
|
217
|
+
if (i.nodes && (i.parent !== root || root.first !== i)) {
|
|
218
|
+
if (typeof i.raws.before !== "undefined") {
|
|
219
|
+
value = i.raws.before;
|
|
220
|
+
if (value.includes("\n")) {
|
|
221
|
+
value = value.replace(/[^\n]+$/, "");
|
|
222
|
+
}
|
|
223
|
+
return false;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
if (value) value = value.replace(/\S/g, "");
|
|
228
|
+
return value;
|
|
229
|
+
}
|
|
230
|
+
rawColon(root) {
|
|
231
|
+
let value;
|
|
232
|
+
root.walkDecls((i) => {
|
|
233
|
+
if (typeof i.raws.between !== "undefined") {
|
|
234
|
+
value = i.raws.between.replace(/[^\s:]/g, "");
|
|
235
|
+
return false;
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
return value;
|
|
239
|
+
}
|
|
240
|
+
rawEmptyBody(root) {
|
|
241
|
+
let value;
|
|
242
|
+
root.walk((i) => {
|
|
243
|
+
if (i.nodes && i.nodes.length === 0) {
|
|
244
|
+
value = i.raws.after;
|
|
245
|
+
if (typeof value !== "undefined") return false;
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
return value;
|
|
249
|
+
}
|
|
250
|
+
rawIndent(root) {
|
|
251
|
+
if (root.raws.indent) return root.raws.indent;
|
|
252
|
+
let value;
|
|
253
|
+
root.walk((i) => {
|
|
254
|
+
let p = i.parent;
|
|
255
|
+
if (p && p !== root && p.parent && p.parent === root) {
|
|
256
|
+
if (typeof i.raws.before !== "undefined") {
|
|
257
|
+
let parts = i.raws.before.split("\n");
|
|
258
|
+
value = parts[parts.length - 1];
|
|
259
|
+
value = value.replace(/\S/g, "");
|
|
260
|
+
return false;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
return value;
|
|
265
|
+
}
|
|
266
|
+
rawSemicolon(root) {
|
|
267
|
+
let value;
|
|
268
|
+
root.walk((i) => {
|
|
269
|
+
if (i.nodes && i.nodes.length && i.last.type === "decl") {
|
|
270
|
+
value = i.raws.semicolon;
|
|
271
|
+
if (typeof value !== "undefined") return false;
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
return value;
|
|
275
|
+
}
|
|
276
|
+
rawValue(node, prop) {
|
|
277
|
+
let value = node[prop];
|
|
278
|
+
let raw = node.raws[prop];
|
|
279
|
+
if (raw && raw.value === value) {
|
|
280
|
+
return raw.raw;
|
|
281
|
+
}
|
|
282
|
+
return value;
|
|
283
|
+
}
|
|
284
|
+
root(node) {
|
|
285
|
+
this.body(node);
|
|
286
|
+
if (node.raws.after) this.builder(node.raws.after);
|
|
287
|
+
}
|
|
288
|
+
rule(node) {
|
|
289
|
+
this.block(node, this.rawValue(node, "selector"));
|
|
290
|
+
if (node.raws.ownSemicolon) {
|
|
291
|
+
this.builder(node.raws.ownSemicolon, node, "end");
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
stringify(node, semicolon) {
|
|
295
|
+
if (!this[node.type]) {
|
|
296
|
+
throw new Error(
|
|
297
|
+
"Unknown AST node type " + node.type + ". Maybe you need to change PostCSS stringifier."
|
|
298
|
+
);
|
|
299
|
+
}
|
|
300
|
+
this[node.type](node, semicolon);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
stringifier = Stringifier;
|
|
304
|
+
Stringifier.default = Stringifier;
|
|
305
|
+
return stringifier;
|
|
306
|
+
}
|
|
307
|
+
exports.__require = requireStringifier;
|
|
308
|
+
//# sourceMappingURL=stringifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stringifier.js","sources":["../../../../../../node_modules/postcss/lib/stringifier.js"],"sourcesContent":["'use strict'\n\nconst DEFAULT_RAW = {\n after: '\\n',\n beforeClose: '\\n',\n beforeComment: '\\n',\n beforeDecl: '\\n',\n beforeOpen: ' ',\n beforeRule: '\\n',\n colon: ': ',\n commentLeft: ' ',\n commentRight: ' ',\n emptyBody: '',\n indent: ' ',\n semicolon: false\n}\n\nfunction capitalize(str) {\n return str[0].toUpperCase() + str.slice(1)\n}\n\nclass Stringifier {\n constructor(builder) {\n this.builder = builder\n }\n\n atrule(node, semicolon) {\n let name = '@' + node.name\n let params = node.params ? this.rawValue(node, 'params') : ''\n\n if (typeof node.raws.afterName !== 'undefined') {\n name += node.raws.afterName\n } else if (params) {\n name += ' '\n }\n\n if (node.nodes) {\n this.block(node, name + params)\n } else {\n let end = (node.raws.between || '') + (semicolon ? ';' : '')\n this.builder(name + params + end, node)\n }\n }\n\n beforeAfter(node, detect) {\n let value\n if (node.type === 'decl') {\n value = this.raw(node, null, 'beforeDecl')\n } else if (node.type === 'comment') {\n value = this.raw(node, null, 'beforeComment')\n } else if (detect === 'before') {\n value = this.raw(node, null, 'beforeRule')\n } else {\n value = this.raw(node, null, 'beforeClose')\n }\n\n let buf = node.parent\n let depth = 0\n while (buf && buf.type !== 'root') {\n depth += 1\n buf = buf.parent\n }\n\n if (value.includes('\\n')) {\n let indent = this.raw(node, null, 'indent')\n if (indent.length) {\n for (let step = 0; step < depth; step++) value += indent\n }\n }\n\n return value\n }\n\n block(node, start) {\n let between = this.raw(node, 'between', 'beforeOpen')\n this.builder(start + between + '{', node, 'start')\n\n let after\n if (node.nodes && node.nodes.length) {\n this.body(node)\n after = this.raw(node, 'after')\n } else {\n after = this.raw(node, 'after', 'emptyBody')\n }\n\n if (after) this.builder(after)\n this.builder('}', node, 'end')\n }\n\n body(node) {\n let last = node.nodes.length - 1\n while (last > 0) {\n if (node.nodes[last].type !== 'comment') break\n last -= 1\n }\n\n let semicolon = this.raw(node, 'semicolon')\n for (let i = 0; i < node.nodes.length; i++) {\n let child = node.nodes[i]\n let before = this.raw(child, 'before')\n if (before) this.builder(before)\n this.stringify(child, last !== i || semicolon)\n }\n }\n\n comment(node) {\n let left = this.raw(node, 'left', 'commentLeft')\n let right = this.raw(node, 'right', 'commentRight')\n this.builder('/*' + left + node.text + right + '*/', node)\n }\n\n decl(node, semicolon) {\n let between = this.raw(node, 'between', 'colon')\n let string = node.prop + between + this.rawValue(node, 'value')\n\n if (node.important) {\n string += node.raws.important || ' !important'\n }\n\n if (semicolon) string += ';'\n this.builder(string, node)\n }\n\n document(node) {\n this.body(node)\n }\n\n raw(node, own, detect) {\n let value\n if (!detect) detect = own\n\n // Already had\n if (own) {\n value = node.raws[own]\n if (typeof value !== 'undefined') return value\n }\n\n let parent = node.parent\n\n if (detect === 'before') {\n // Hack for first rule in CSS\n if (!parent || (parent.type === 'root' && parent.first === node)) {\n return ''\n }\n\n // `root` nodes in `document` should use only their own raws\n if (parent && parent.type === 'document') {\n return ''\n }\n }\n\n // Floating child without parent\n if (!parent) return DEFAULT_RAW[detect]\n\n // Detect style by other nodes\n let root = node.root()\n if (!root.rawCache) root.rawCache = {}\n if (typeof root.rawCache[detect] !== 'undefined') {\n return root.rawCache[detect]\n }\n\n if (detect === 'before' || detect === 'after') {\n return this.beforeAfter(node, detect)\n } else {\n let method = 'raw' + capitalize(detect)\n if (this[method]) {\n value = this[method](root, node)\n } else {\n root.walk(i => {\n value = i.raws[own]\n if (typeof value !== 'undefined') return false\n })\n }\n }\n\n if (typeof value === 'undefined') value = DEFAULT_RAW[detect]\n\n root.rawCache[detect] = value\n return value\n }\n\n rawBeforeClose(root) {\n let value\n root.walk(i => {\n if (i.nodes && i.nodes.length > 0) {\n if (typeof i.raws.after !== 'undefined') {\n value = i.raws.after\n if (value.includes('\\n')) {\n value = value.replace(/[^\\n]+$/, '')\n }\n return false\n }\n }\n })\n if (value) value = value.replace(/\\S/g, '')\n return value\n }\n\n rawBeforeComment(root, node) {\n let value\n root.walkComments(i => {\n if (typeof i.raws.before !== 'undefined') {\n value = i.raws.before\n if (value.includes('\\n')) {\n value = value.replace(/[^\\n]+$/, '')\n }\n return false\n }\n })\n if (typeof value === 'undefined') {\n value = this.raw(node, null, 'beforeDecl')\n } else if (value) {\n value = value.replace(/\\S/g, '')\n }\n return value\n }\n\n rawBeforeDecl(root, node) {\n let value\n root.walkDecls(i => {\n if (typeof i.raws.before !== 'undefined') {\n value = i.raws.before\n if (value.includes('\\n')) {\n value = value.replace(/[^\\n]+$/, '')\n }\n return false\n }\n })\n if (typeof value === 'undefined') {\n value = this.raw(node, null, 'beforeRule')\n } else if (value) {\n value = value.replace(/\\S/g, '')\n }\n return value\n }\n\n rawBeforeOpen(root) {\n let value\n root.walk(i => {\n if (i.type !== 'decl') {\n value = i.raws.between\n if (typeof value !== 'undefined') return false\n }\n })\n return value\n }\n\n rawBeforeRule(root) {\n let value\n root.walk(i => {\n if (i.nodes && (i.parent !== root || root.first !== i)) {\n if (typeof i.raws.before !== 'undefined') {\n value = i.raws.before\n if (value.includes('\\n')) {\n value = value.replace(/[^\\n]+$/, '')\n }\n return false\n }\n }\n })\n if (value) value = value.replace(/\\S/g, '')\n return value\n }\n\n rawColon(root) {\n let value\n root.walkDecls(i => {\n if (typeof i.raws.between !== 'undefined') {\n value = i.raws.between.replace(/[^\\s:]/g, '')\n return false\n }\n })\n return value\n }\n\n rawEmptyBody(root) {\n let value\n root.walk(i => {\n if (i.nodes && i.nodes.length === 0) {\n value = i.raws.after\n if (typeof value !== 'undefined') return false\n }\n })\n return value\n }\n\n rawIndent(root) {\n if (root.raws.indent) return root.raws.indent\n let value\n root.walk(i => {\n let p = i.parent\n if (p && p !== root && p.parent && p.parent === root) {\n if (typeof i.raws.before !== 'undefined') {\n let parts = i.raws.before.split('\\n')\n value = parts[parts.length - 1]\n value = value.replace(/\\S/g, '')\n return false\n }\n }\n })\n return value\n }\n\n rawSemicolon(root) {\n let value\n root.walk(i => {\n if (i.nodes && i.nodes.length && i.last.type === 'decl') {\n value = i.raws.semicolon\n if (typeof value !== 'undefined') return false\n }\n })\n return value\n }\n\n rawValue(node, prop) {\n let value = node[prop]\n let raw = node.raws[prop]\n if (raw && raw.value === value) {\n return raw.raw\n }\n\n return value\n }\n\n root(node) {\n this.body(node)\n if (node.raws.after) this.builder(node.raws.after)\n }\n\n rule(node) {\n this.block(node, this.rawValue(node, 'selector'))\n if (node.raws.ownSemicolon) {\n this.builder(node.raws.ownSemicolon, node, 'end')\n }\n }\n\n stringify(node, semicolon) {\n /* c8 ignore start */\n if (!this[node.type]) {\n throw new Error(\n 'Unknown AST node type ' +\n node.type +\n '. ' +\n 'Maybe you need to change PostCSS stringifier.'\n )\n }\n /* c8 ignore stop */\n this[node.type](node, semicolon)\n }\n}\n\nmodule.exports = Stringifier\nStringifier.default = Stringifier\n"],"names":[],"mappings":";;;;;;;AAEA,QAAM,cAAc;AAAA,IAClB,OAAO;AAAA,IACP,aAAa;AAAA,IACb,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,aAAa;AAAA,IACb,cAAc;AAAA,IACd,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,WAAW;AAAA,EACb;AAEA,WAAS,WAAW,KAAK;AACvB,WAAO,IAAI,CAAC,EAAE,YAAW,IAAK,IAAI,MAAM,CAAC;AAAA,EAC3C;AAAA,EAEA,MAAM,YAAY;AAAA,IAChB,YAAY,SAAS;AACnB,WAAK,UAAU;AAAA,IACnB;AAAA,IAEE,OAAO,MAAM,WAAW;AACtB,UAAI,OAAO,MAAM,KAAK;AACtB,UAAI,SAAS,KAAK,SAAS,KAAK,SAAS,MAAM,QAAQ,IAAI;AAE3D,UAAI,OAAO,KAAK,KAAK,cAAc,aAAa;AAC9C,gBAAQ,KAAK,KAAK;AAAA,MACxB,WAAe,QAAQ;AACjB,gBAAQ;AAAA,MACd;AAEI,UAAI,KAAK,OAAO;AACd,aAAK,MAAM,MAAM,OAAO,MAAM;AAAA,MACpC,OAAW;AACL,YAAI,OAAO,KAAK,KAAK,WAAW,OAAO,YAAY,MAAM;AACzD,aAAK,QAAQ,OAAO,SAAS,KAAK,IAAI;AAAA,MAC5C;AAAA,IACA;AAAA,IAEE,YAAY,MAAM,QAAQ;AACxB,UAAI;AACJ,UAAI,KAAK,SAAS,QAAQ;AACxB,gBAAQ,KAAK,IAAI,MAAM,MAAM,YAAY;AAAA,MAC/C,WAAe,KAAK,SAAS,WAAW;AAClC,gBAAQ,KAAK,IAAI,M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d,UAAI,KAAK,KAAK,MAAO,MAAK,QAAQ,KAAK,KAAK,KAAK;AAAA,IACrD;AAAA,IAEE,KAAK,MAAM;AACT,WAAK,MAAM,MAAM,KAAK,SAAS,MAAM,UAAU,CAAC;AAChD,UAAI,KAAK,KAAK,cAAc;AAC1B,aAAK,QAAQ,KAAK,KAAK,cAAc,MAAM,KAAK;AAAA,MACtD;AAAA,IACA;AAAA,IAEE,UAAU,MAAM,WAAW;AAEzB,UAAI,CAAC,KAAK,KAAK,IAAI,GAAG;AACpB,cAAM,IAAI;AAAA,UACR,2BACE,KAAK,OACL;AAAA,QAEV;AAAA,MACA;AAEI,WAAK,KAAK,IAAI,EAAE,MAAM,SAAS;AAAA,IACnC;AAAA,EACA;AAEA,gBAAiB;AACjB,cAAY,UAAU;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
var stringifier;
|
|
2
|
+
var hasRequiredStringifier;
|
|
3
|
+
function requireStringifier() {
|
|
4
|
+
if (hasRequiredStringifier) return stringifier;
|
|
5
|
+
hasRequiredStringifier = 1;
|
|
6
|
+
const DEFAULT_RAW = {
|
|
7
|
+
after: "\n",
|
|
8
|
+
beforeClose: "\n",
|
|
9
|
+
beforeComment: "\n",
|
|
10
|
+
beforeDecl: "\n",
|
|
11
|
+
beforeOpen: " ",
|
|
12
|
+
beforeRule: "\n",
|
|
13
|
+
colon: ": ",
|
|
14
|
+
commentLeft: " ",
|
|
15
|
+
commentRight: " ",
|
|
16
|
+
emptyBody: "",
|
|
17
|
+
indent: " ",
|
|
18
|
+
semicolon: false
|
|
19
|
+
};
|
|
20
|
+
function capitalize(str) {
|
|
21
|
+
return str[0].toUpperCase() + str.slice(1);
|
|
22
|
+
}
|
|
23
|
+
class Stringifier {
|
|
24
|
+
constructor(builder) {
|
|
25
|
+
this.builder = builder;
|
|
26
|
+
}
|
|
27
|
+
atrule(node, semicolon) {
|
|
28
|
+
let name = "@" + node.name;
|
|
29
|
+
let params = node.params ? this.rawValue(node, "params") : "";
|
|
30
|
+
if (typeof node.raws.afterName !== "undefined") {
|
|
31
|
+
name += node.raws.afterName;
|
|
32
|
+
} else if (params) {
|
|
33
|
+
name += " ";
|
|
34
|
+
}
|
|
35
|
+
if (node.nodes) {
|
|
36
|
+
this.block(node, name + params);
|
|
37
|
+
} else {
|
|
38
|
+
let end = (node.raws.between || "") + (semicolon ? ";" : "");
|
|
39
|
+
this.builder(name + params + end, node);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
beforeAfter(node, detect) {
|
|
43
|
+
let value;
|
|
44
|
+
if (node.type === "decl") {
|
|
45
|
+
value = this.raw(node, null, "beforeDecl");
|
|
46
|
+
} else if (node.type === "comment") {
|
|
47
|
+
value = this.raw(node, null, "beforeComment");
|
|
48
|
+
} else if (detect === "before") {
|
|
49
|
+
value = this.raw(node, null, "beforeRule");
|
|
50
|
+
} else {
|
|
51
|
+
value = this.raw(node, null, "beforeClose");
|
|
52
|
+
}
|
|
53
|
+
let buf = node.parent;
|
|
54
|
+
let depth = 0;
|
|
55
|
+
while (buf && buf.type !== "root") {
|
|
56
|
+
depth += 1;
|
|
57
|
+
buf = buf.parent;
|
|
58
|
+
}
|
|
59
|
+
if (value.includes("\n")) {
|
|
60
|
+
let indent = this.raw(node, null, "indent");
|
|
61
|
+
if (indent.length) {
|
|
62
|
+
for (let step = 0; step < depth; step++) value += indent;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return value;
|
|
66
|
+
}
|
|
67
|
+
block(node, start) {
|
|
68
|
+
let between = this.raw(node, "between", "beforeOpen");
|
|
69
|
+
this.builder(start + between + "{", node, "start");
|
|
70
|
+
let after;
|
|
71
|
+
if (node.nodes && node.nodes.length) {
|
|
72
|
+
this.body(node);
|
|
73
|
+
after = this.raw(node, "after");
|
|
74
|
+
} else {
|
|
75
|
+
after = this.raw(node, "after", "emptyBody");
|
|
76
|
+
}
|
|
77
|
+
if (after) this.builder(after);
|
|
78
|
+
this.builder("}", node, "end");
|
|
79
|
+
}
|
|
80
|
+
body(node) {
|
|
81
|
+
let last = node.nodes.length - 1;
|
|
82
|
+
while (last > 0) {
|
|
83
|
+
if (node.nodes[last].type !== "comment") break;
|
|
84
|
+
last -= 1;
|
|
85
|
+
}
|
|
86
|
+
let semicolon = this.raw(node, "semicolon");
|
|
87
|
+
for (let i = 0; i < node.nodes.length; i++) {
|
|
88
|
+
let child = node.nodes[i];
|
|
89
|
+
let before = this.raw(child, "before");
|
|
90
|
+
if (before) this.builder(before);
|
|
91
|
+
this.stringify(child, last !== i || semicolon);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
comment(node) {
|
|
95
|
+
let left = this.raw(node, "left", "commentLeft");
|
|
96
|
+
let right = this.raw(node, "right", "commentRight");
|
|
97
|
+
this.builder("/*" + left + node.text + right + "*/", node);
|
|
98
|
+
}
|
|
99
|
+
decl(node, semicolon) {
|
|
100
|
+
let between = this.raw(node, "between", "colon");
|
|
101
|
+
let string = node.prop + between + this.rawValue(node, "value");
|
|
102
|
+
if (node.important) {
|
|
103
|
+
string += node.raws.important || " !important";
|
|
104
|
+
}
|
|
105
|
+
if (semicolon) string += ";";
|
|
106
|
+
this.builder(string, node);
|
|
107
|
+
}
|
|
108
|
+
document(node) {
|
|
109
|
+
this.body(node);
|
|
110
|
+
}
|
|
111
|
+
raw(node, own, detect) {
|
|
112
|
+
let value;
|
|
113
|
+
if (!detect) detect = own;
|
|
114
|
+
if (own) {
|
|
115
|
+
value = node.raws[own];
|
|
116
|
+
if (typeof value !== "undefined") return value;
|
|
117
|
+
}
|
|
118
|
+
let parent = node.parent;
|
|
119
|
+
if (detect === "before") {
|
|
120
|
+
if (!parent || parent.type === "root" && parent.first === node) {
|
|
121
|
+
return "";
|
|
122
|
+
}
|
|
123
|
+
if (parent && parent.type === "document") {
|
|
124
|
+
return "";
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (!parent) return DEFAULT_RAW[detect];
|
|
128
|
+
let root = node.root();
|
|
129
|
+
if (!root.rawCache) root.rawCache = {};
|
|
130
|
+
if (typeof root.rawCache[detect] !== "undefined") {
|
|
131
|
+
return root.rawCache[detect];
|
|
132
|
+
}
|
|
133
|
+
if (detect === "before" || detect === "after") {
|
|
134
|
+
return this.beforeAfter(node, detect);
|
|
135
|
+
} else {
|
|
136
|
+
let method = "raw" + capitalize(detect);
|
|
137
|
+
if (this[method]) {
|
|
138
|
+
value = this[method](root, node);
|
|
139
|
+
} else {
|
|
140
|
+
root.walk((i) => {
|
|
141
|
+
value = i.raws[own];
|
|
142
|
+
if (typeof value !== "undefined") return false;
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
if (typeof value === "undefined") value = DEFAULT_RAW[detect];
|
|
147
|
+
root.rawCache[detect] = value;
|
|
148
|
+
return value;
|
|
149
|
+
}
|
|
150
|
+
rawBeforeClose(root) {
|
|
151
|
+
let value;
|
|
152
|
+
root.walk((i) => {
|
|
153
|
+
if (i.nodes && i.nodes.length > 0) {
|
|
154
|
+
if (typeof i.raws.after !== "undefined") {
|
|
155
|
+
value = i.raws.after;
|
|
156
|
+
if (value.includes("\n")) {
|
|
157
|
+
value = value.replace(/[^\n]+$/, "");
|
|
158
|
+
}
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
if (value) value = value.replace(/\S/g, "");
|
|
164
|
+
return value;
|
|
165
|
+
}
|
|
166
|
+
rawBeforeComment(root, node) {
|
|
167
|
+
let value;
|
|
168
|
+
root.walkComments((i) => {
|
|
169
|
+
if (typeof i.raws.before !== "undefined") {
|
|
170
|
+
value = i.raws.before;
|
|
171
|
+
if (value.includes("\n")) {
|
|
172
|
+
value = value.replace(/[^\n]+$/, "");
|
|
173
|
+
}
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
if (typeof value === "undefined") {
|
|
178
|
+
value = this.raw(node, null, "beforeDecl");
|
|
179
|
+
} else if (value) {
|
|
180
|
+
value = value.replace(/\S/g, "");
|
|
181
|
+
}
|
|
182
|
+
return value;
|
|
183
|
+
}
|
|
184
|
+
rawBeforeDecl(root, node) {
|
|
185
|
+
let value;
|
|
186
|
+
root.walkDecls((i) => {
|
|
187
|
+
if (typeof i.raws.before !== "undefined") {
|
|
188
|
+
value = i.raws.before;
|
|
189
|
+
if (value.includes("\n")) {
|
|
190
|
+
value = value.replace(/[^\n]+$/, "");
|
|
191
|
+
}
|
|
192
|
+
return false;
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
if (typeof value === "undefined") {
|
|
196
|
+
value = this.raw(node, null, "beforeRule");
|
|
197
|
+
} else if (value) {
|
|
198
|
+
value = value.replace(/\S/g, "");
|
|
199
|
+
}
|
|
200
|
+
return value;
|
|
201
|
+
}
|
|
202
|
+
rawBeforeOpen(root) {
|
|
203
|
+
let value;
|
|
204
|
+
root.walk((i) => {
|
|
205
|
+
if (i.type !== "decl") {
|
|
206
|
+
value = i.raws.between;
|
|
207
|
+
if (typeof value !== "undefined") return false;
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
return value;
|
|
211
|
+
}
|
|
212
|
+
rawBeforeRule(root) {
|
|
213
|
+
let value;
|
|
214
|
+
root.walk((i) => {
|
|
215
|
+
if (i.nodes && (i.parent !== root || root.first !== i)) {
|
|
216
|
+
if (typeof i.raws.before !== "undefined") {
|
|
217
|
+
value = i.raws.before;
|
|
218
|
+
if (value.includes("\n")) {
|
|
219
|
+
value = value.replace(/[^\n]+$/, "");
|
|
220
|
+
}
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
if (value) value = value.replace(/\S/g, "");
|
|
226
|
+
return value;
|
|
227
|
+
}
|
|
228
|
+
rawColon(root) {
|
|
229
|
+
let value;
|
|
230
|
+
root.walkDecls((i) => {
|
|
231
|
+
if (typeof i.raws.between !== "undefined") {
|
|
232
|
+
value = i.raws.between.replace(/[^\s:]/g, "");
|
|
233
|
+
return false;
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
return value;
|
|
237
|
+
}
|
|
238
|
+
rawEmptyBody(root) {
|
|
239
|
+
let value;
|
|
240
|
+
root.walk((i) => {
|
|
241
|
+
if (i.nodes && i.nodes.length === 0) {
|
|
242
|
+
value = i.raws.after;
|
|
243
|
+
if (typeof value !== "undefined") return false;
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
return value;
|
|
247
|
+
}
|
|
248
|
+
rawIndent(root) {
|
|
249
|
+
if (root.raws.indent) return root.raws.indent;
|
|
250
|
+
let value;
|
|
251
|
+
root.walk((i) => {
|
|
252
|
+
let p = i.parent;
|
|
253
|
+
if (p && p !== root && p.parent && p.parent === root) {
|
|
254
|
+
if (typeof i.raws.before !== "undefined") {
|
|
255
|
+
let parts = i.raws.before.split("\n");
|
|
256
|
+
value = parts[parts.length - 1];
|
|
257
|
+
value = value.replace(/\S/g, "");
|
|
258
|
+
return false;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
return value;
|
|
263
|
+
}
|
|
264
|
+
rawSemicolon(root) {
|
|
265
|
+
let value;
|
|
266
|
+
root.walk((i) => {
|
|
267
|
+
if (i.nodes && i.nodes.length && i.last.type === "decl") {
|
|
268
|
+
value = i.raws.semicolon;
|
|
269
|
+
if (typeof value !== "undefined") return false;
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
return value;
|
|
273
|
+
}
|
|
274
|
+
rawValue(node, prop) {
|
|
275
|
+
let value = node[prop];
|
|
276
|
+
let raw = node.raws[prop];
|
|
277
|
+
if (raw && raw.value === value) {
|
|
278
|
+
return raw.raw;
|
|
279
|
+
}
|
|
280
|
+
return value;
|
|
281
|
+
}
|
|
282
|
+
root(node) {
|
|
283
|
+
this.body(node);
|
|
284
|
+
if (node.raws.after) this.builder(node.raws.after);
|
|
285
|
+
}
|
|
286
|
+
rule(node) {
|
|
287
|
+
this.block(node, this.rawValue(node, "selector"));
|
|
288
|
+
if (node.raws.ownSemicolon) {
|
|
289
|
+
this.builder(node.raws.ownSemicolon, node, "end");
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
stringify(node, semicolon) {
|
|
293
|
+
if (!this[node.type]) {
|
|
294
|
+
throw new Error(
|
|
295
|
+
"Unknown AST node type " + node.type + ". Maybe you need to change PostCSS stringifier."
|
|
296
|
+
);
|
|
297
|
+
}
|
|
298
|
+
this[node.type](node, semicolon);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
stringifier = Stringifier;
|
|
302
|
+
Stringifier.default = Stringifier;
|
|
303
|
+
return stringifier;
|
|
304
|
+
}
|
|
305
|
+
export {
|
|
306
|
+
requireStringifier as __require
|
|
307
|
+
};
|
|
308
|
+
//# sourceMappingURL=stringifier.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stringifier.mjs","sources":["../../../../../../node_modules/postcss/lib/stringifier.js"],"sourcesContent":["'use strict'\n\nconst DEFAULT_RAW = {\n after: '\\n',\n beforeClose: '\\n',\n beforeComment: '\\n',\n beforeDecl: '\\n',\n beforeOpen: ' ',\n beforeRule: '\\n',\n colon: ': ',\n commentLeft: ' ',\n commentRight: ' ',\n emptyBody: '',\n indent: ' ',\n semicolon: false\n}\n\nfunction capitalize(str) {\n return str[0].toUpperCase() + str.slice(1)\n}\n\nclass Stringifier {\n constructor(builder) {\n this.builder = builder\n }\n\n atrule(node, semicolon) {\n let name = '@' + node.name\n let params = node.params ? this.rawValue(node, 'params') : ''\n\n if (typeof node.raws.afterName !== 'undefined') {\n name += node.raws.afterName\n } else if (params) {\n name += ' '\n }\n\n if (node.nodes) {\n this.block(node, name + params)\n } else {\n let end = (node.raws.between || '') + (semicolon ? ';' : '')\n this.builder(name + params + end, node)\n }\n }\n\n beforeAfter(node, detect) {\n let value\n if (node.type === 'decl') {\n value = this.raw(node, null, 'beforeDecl')\n } else if (node.type === 'comment') {\n value = this.raw(node, null, 'beforeComment')\n } else if (detect === 'before') {\n value = this.raw(node, null, 'beforeRule')\n } else {\n value = this.raw(node, null, 'beforeClose')\n }\n\n let buf = node.parent\n let depth = 0\n while (buf && buf.type !== 'root') {\n depth += 1\n buf = buf.parent\n }\n\n if (value.includes('\\n')) {\n let indent = this.raw(node, null, 'indent')\n if (indent.length) {\n for (let step = 0; step < depth; step++) value += indent\n }\n }\n\n return value\n }\n\n block(node, start) {\n let between = this.raw(node, 'between', 'beforeOpen')\n this.builder(start + between + '{', node, 'start')\n\n let after\n if (node.nodes && node.nodes.length) {\n this.body(node)\n after = this.raw(node, 'after')\n } else {\n after = this.raw(node, 'after', 'emptyBody')\n }\n\n if (after) this.builder(after)\n this.builder('}', node, 'end')\n }\n\n body(node) {\n let last = node.nodes.length - 1\n while (last > 0) {\n if (node.nodes[last].type !== 'comment') break\n last -= 1\n }\n\n let semicolon = this.raw(node, 'semicolon')\n for (let i = 0; i < node.nodes.length; i++) {\n let child = node.nodes[i]\n let before = this.raw(child, 'before')\n if (before) this.builder(before)\n this.stringify(child, last !== i || semicolon)\n }\n }\n\n comment(node) {\n let left = this.raw(node, 'left', 'commentLeft')\n let right = this.raw(node, 'right', 'commentRight')\n this.builder('/*' + left + node.text + right + '*/', node)\n }\n\n decl(node, semicolon) {\n let between = this.raw(node, 'between', 'colon')\n let string = node.prop + between + this.rawValue(node, 'value')\n\n if (node.important) {\n string += node.raws.important || ' !important'\n }\n\n if (semicolon) string += ';'\n this.builder(string, node)\n }\n\n document(node) {\n this.body(node)\n }\n\n raw(node, own, detect) {\n let value\n if (!detect) detect = own\n\n // Already had\n if (own) {\n value = node.raws[own]\n if (typeof value !== 'undefined') return value\n }\n\n let parent = node.parent\n\n if (detect === 'before') {\n // Hack for first rule in CSS\n if (!parent || (parent.type === 'root' && parent.first === node)) {\n return ''\n }\n\n // `root` nodes in `document` should use only their own raws\n if (parent && parent.type === 'document') {\n return ''\n }\n }\n\n // Floating child without parent\n if (!parent) return DEFAULT_RAW[detect]\n\n // Detect style by other nodes\n let root = node.root()\n if (!root.rawCache) root.rawCache = {}\n if (typeof root.rawCache[detect] !== 'undefined') {\n return root.rawCache[detect]\n }\n\n if (detect === 'before' || detect === 'after') {\n return this.beforeAfter(node, detect)\n } else {\n let method = 'raw' + capitalize(detect)\n if (this[method]) {\n value = this[method](root, node)\n } else {\n root.walk(i => {\n value = i.raws[own]\n if (typeof value !== 'undefined') return false\n })\n }\n }\n\n if (typeof value === 'undefined') value = DEFAULT_RAW[detect]\n\n root.rawCache[detect] = value\n return value\n }\n\n rawBeforeClose(root) {\n let value\n root.walk(i => {\n if (i.nodes && i.nodes.length > 0) {\n if (typeof i.raws.after !== 'undefined') {\n value = i.raws.after\n if (value.includes('\\n')) {\n value = value.replace(/[^\\n]+$/, '')\n }\n return false\n }\n }\n })\n if (value) value = value.replace(/\\S/g, '')\n return value\n }\n\n rawBeforeComment(root, node) {\n let value\n root.walkComments(i => {\n if (typeof i.raws.before !== 'undefined') {\n value = i.raws.before\n if (value.includes('\\n')) {\n value = value.replace(/[^\\n]+$/, '')\n }\n return false\n }\n })\n if (typeof value === 'undefined') {\n value = this.raw(node, null, 'beforeDecl')\n } else if (value) {\n value = value.replace(/\\S/g, '')\n }\n return value\n }\n\n rawBeforeDecl(root, node) {\n let value\n root.walkDecls(i => {\n if (typeof i.raws.before !== 'undefined') {\n value = i.raws.before\n if (value.includes('\\n')) {\n value = value.replace(/[^\\n]+$/, '')\n }\n return false\n }\n })\n if (typeof value === 'undefined') {\n value = this.raw(node, null, 'beforeRule')\n } else if (value) {\n value = value.replace(/\\S/g, '')\n }\n return value\n }\n\n rawBeforeOpen(root) {\n let value\n root.walk(i => {\n if (i.type !== 'decl') {\n value = i.raws.between\n if (typeof value !== 'undefined') return false\n }\n })\n return value\n }\n\n rawBeforeRule(root) {\n let value\n root.walk(i => {\n if (i.nodes && (i.parent !== root || root.first !== i)) {\n if (typeof i.raws.before !== 'undefined') {\n value = i.raws.before\n if (value.includes('\\n')) {\n value = value.replace(/[^\\n]+$/, '')\n }\n return false\n }\n }\n })\n if (value) value = value.replace(/\\S/g, '')\n return value\n }\n\n rawColon(root) {\n let value\n root.walkDecls(i => {\n if (typeof i.raws.between !== 'undefined') {\n value = i.raws.between.replace(/[^\\s:]/g, '')\n return false\n }\n })\n return value\n }\n\n rawEmptyBody(root) {\n let value\n root.walk(i => {\n if (i.nodes && i.nodes.length === 0) {\n value = i.raws.after\n if (typeof value !== 'undefined') return false\n }\n })\n return value\n }\n\n rawIndent(root) {\n if (root.raws.indent) return root.raws.indent\n let value\n root.walk(i => {\n let p = i.parent\n if (p && p !== root && p.parent && p.parent === root) {\n if (typeof i.raws.before !== 'undefined') {\n let parts = i.raws.before.split('\\n')\n value = parts[parts.length - 1]\n value = value.replace(/\\S/g, '')\n return false\n }\n }\n })\n return value\n }\n\n rawSemicolon(root) {\n let value\n root.walk(i => {\n if (i.nodes && i.nodes.length && i.last.type === 'decl') {\n value = i.raws.semicolon\n if (typeof value !== 'undefined') return false\n }\n })\n return value\n }\n\n rawValue(node, prop) {\n let value = node[prop]\n let raw = node.raws[prop]\n if (raw && raw.value === value) {\n return raw.raw\n }\n\n return value\n }\n\n root(node) {\n this.body(node)\n if (node.raws.after) this.builder(node.raws.after)\n }\n\n rule(node) {\n this.block(node, this.rawValue(node, 'selector'))\n if (node.raws.ownSemicolon) {\n this.builder(node.raws.ownSemicolon, node, 'end')\n }\n }\n\n stringify(node, semicolon) {\n /* c8 ignore start */\n if (!this[node.type]) {\n throw new Error(\n 'Unknown AST node type ' +\n node.type +\n '. ' +\n 'Maybe you need to change PostCSS stringifier.'\n )\n }\n /* c8 ignore stop */\n this[node.type](node, semicolon)\n }\n}\n\nmodule.exports = Stringifier\nStringifier.default = Stringifier\n"],"names":[],"mappings":";;;;;AAEA,QAAM,cAAc;AAAA,IAClB,OAAO;AAAA,IACP,aAAa;AAAA,IACb,eAAe;AAAA,IACf,YAAY;AAAA,IACZ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