@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,335 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const symbols = require("./symbols.js");
|
|
4
|
+
const cssSyntaxError = require("./css-syntax-error.js");
|
|
5
|
+
const stringifier = require("./stringifier.js");
|
|
6
|
+
const stringify = require("./stringify.js");
|
|
7
|
+
var node;
|
|
8
|
+
var hasRequiredNode;
|
|
9
|
+
function requireNode() {
|
|
10
|
+
if (hasRequiredNode) return node;
|
|
11
|
+
hasRequiredNode = 1;
|
|
12
|
+
let { isClean, my } = symbols.__require();
|
|
13
|
+
let CssSyntaxError = cssSyntaxError.__require();
|
|
14
|
+
let Stringifier = stringifier.__require();
|
|
15
|
+
let stringify$1 = stringify.__require();
|
|
16
|
+
function cloneNode(obj, parent) {
|
|
17
|
+
let cloned = new obj.constructor();
|
|
18
|
+
for (let i in obj) {
|
|
19
|
+
if (!Object.prototype.hasOwnProperty.call(obj, i)) {
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
if (i === "proxyCache") continue;
|
|
23
|
+
let value = obj[i];
|
|
24
|
+
let type = typeof value;
|
|
25
|
+
if (i === "parent" && type === "object") {
|
|
26
|
+
if (parent) cloned[i] = parent;
|
|
27
|
+
} else if (i === "source") {
|
|
28
|
+
cloned[i] = value;
|
|
29
|
+
} else if (Array.isArray(value)) {
|
|
30
|
+
cloned[i] = value.map((j) => cloneNode(j, cloned));
|
|
31
|
+
} else {
|
|
32
|
+
if (type === "object" && value !== null) value = cloneNode(value);
|
|
33
|
+
cloned[i] = value;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return cloned;
|
|
37
|
+
}
|
|
38
|
+
class Node {
|
|
39
|
+
constructor(defaults = {}) {
|
|
40
|
+
this.raws = {};
|
|
41
|
+
this[isClean] = false;
|
|
42
|
+
this[my] = true;
|
|
43
|
+
for (let name in defaults) {
|
|
44
|
+
if (name === "nodes") {
|
|
45
|
+
this.nodes = [];
|
|
46
|
+
for (let node2 of defaults[name]) {
|
|
47
|
+
if (typeof node2.clone === "function") {
|
|
48
|
+
this.append(node2.clone());
|
|
49
|
+
} else {
|
|
50
|
+
this.append(node2);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
} else {
|
|
54
|
+
this[name] = defaults[name];
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
addToError(error) {
|
|
59
|
+
error.postcssNode = this;
|
|
60
|
+
if (error.stack && this.source && /\n\s{4}at /.test(error.stack)) {
|
|
61
|
+
let s = this.source;
|
|
62
|
+
error.stack = error.stack.replace(
|
|
63
|
+
/\n\s{4}at /,
|
|
64
|
+
`$&${s.input.from}:${s.start.line}:${s.start.column}$&`
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
return error;
|
|
68
|
+
}
|
|
69
|
+
after(add) {
|
|
70
|
+
this.parent.insertAfter(this, add);
|
|
71
|
+
return this;
|
|
72
|
+
}
|
|
73
|
+
assign(overrides = {}) {
|
|
74
|
+
for (let name in overrides) {
|
|
75
|
+
this[name] = overrides[name];
|
|
76
|
+
}
|
|
77
|
+
return this;
|
|
78
|
+
}
|
|
79
|
+
before(add) {
|
|
80
|
+
this.parent.insertBefore(this, add);
|
|
81
|
+
return this;
|
|
82
|
+
}
|
|
83
|
+
cleanRaws(keepBetween) {
|
|
84
|
+
delete this.raws.before;
|
|
85
|
+
delete this.raws.after;
|
|
86
|
+
if (!keepBetween) delete this.raws.between;
|
|
87
|
+
}
|
|
88
|
+
clone(overrides = {}) {
|
|
89
|
+
let cloned = cloneNode(this);
|
|
90
|
+
for (let name in overrides) {
|
|
91
|
+
cloned[name] = overrides[name];
|
|
92
|
+
}
|
|
93
|
+
return cloned;
|
|
94
|
+
}
|
|
95
|
+
cloneAfter(overrides = {}) {
|
|
96
|
+
let cloned = this.clone(overrides);
|
|
97
|
+
this.parent.insertAfter(this, cloned);
|
|
98
|
+
return cloned;
|
|
99
|
+
}
|
|
100
|
+
cloneBefore(overrides = {}) {
|
|
101
|
+
let cloned = this.clone(overrides);
|
|
102
|
+
this.parent.insertBefore(this, cloned);
|
|
103
|
+
return cloned;
|
|
104
|
+
}
|
|
105
|
+
error(message, opts = {}) {
|
|
106
|
+
if (this.source) {
|
|
107
|
+
let { end, start } = this.rangeBy(opts);
|
|
108
|
+
return this.source.input.error(
|
|
109
|
+
message,
|
|
110
|
+
{ column: start.column, line: start.line },
|
|
111
|
+
{ column: end.column, line: end.line },
|
|
112
|
+
opts
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
return new CssSyntaxError(message);
|
|
116
|
+
}
|
|
117
|
+
getProxyProcessor() {
|
|
118
|
+
return {
|
|
119
|
+
get(node2, prop) {
|
|
120
|
+
if (prop === "proxyOf") {
|
|
121
|
+
return node2;
|
|
122
|
+
} else if (prop === "root") {
|
|
123
|
+
return () => node2.root().toProxy();
|
|
124
|
+
} else {
|
|
125
|
+
return node2[prop];
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
set(node2, prop, value) {
|
|
129
|
+
if (node2[prop] === value) return true;
|
|
130
|
+
node2[prop] = value;
|
|
131
|
+
if (prop === "prop" || prop === "value" || prop === "name" || prop === "params" || prop === "important" || /* c8 ignore next */
|
|
132
|
+
prop === "text") {
|
|
133
|
+
node2.markDirty();
|
|
134
|
+
}
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
markDirty() {
|
|
140
|
+
if (this[isClean]) {
|
|
141
|
+
this[isClean] = false;
|
|
142
|
+
let next = this;
|
|
143
|
+
while (next = next.parent) {
|
|
144
|
+
next[isClean] = false;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
next() {
|
|
149
|
+
if (!this.parent) return void 0;
|
|
150
|
+
let index = this.parent.index(this);
|
|
151
|
+
return this.parent.nodes[index + 1];
|
|
152
|
+
}
|
|
153
|
+
positionBy(opts, stringRepresentation) {
|
|
154
|
+
let pos = this.source.start;
|
|
155
|
+
if (opts.index) {
|
|
156
|
+
pos = this.positionInside(opts.index, stringRepresentation);
|
|
157
|
+
} else if (opts.word) {
|
|
158
|
+
stringRepresentation = this.toString();
|
|
159
|
+
let index = stringRepresentation.indexOf(opts.word);
|
|
160
|
+
if (index !== -1) pos = this.positionInside(index, stringRepresentation);
|
|
161
|
+
}
|
|
162
|
+
return pos;
|
|
163
|
+
}
|
|
164
|
+
positionInside(index, stringRepresentation) {
|
|
165
|
+
let string = stringRepresentation || this.toString();
|
|
166
|
+
let column = this.source.start.column;
|
|
167
|
+
let line = this.source.start.line;
|
|
168
|
+
for (let i = 0; i < index; i++) {
|
|
169
|
+
if (string[i] === "\n") {
|
|
170
|
+
column = 1;
|
|
171
|
+
line += 1;
|
|
172
|
+
} else {
|
|
173
|
+
column += 1;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return { column, line };
|
|
177
|
+
}
|
|
178
|
+
prev() {
|
|
179
|
+
if (!this.parent) return void 0;
|
|
180
|
+
let index = this.parent.index(this);
|
|
181
|
+
return this.parent.nodes[index - 1];
|
|
182
|
+
}
|
|
183
|
+
rangeBy(opts) {
|
|
184
|
+
let start = {
|
|
185
|
+
column: this.source.start.column,
|
|
186
|
+
line: this.source.start.line
|
|
187
|
+
};
|
|
188
|
+
let end = this.source.end ? {
|
|
189
|
+
column: this.source.end.column + 1,
|
|
190
|
+
line: this.source.end.line
|
|
191
|
+
} : {
|
|
192
|
+
column: start.column + 1,
|
|
193
|
+
line: start.line
|
|
194
|
+
};
|
|
195
|
+
if (opts.word) {
|
|
196
|
+
let stringRepresentation = this.toString();
|
|
197
|
+
let index = stringRepresentation.indexOf(opts.word);
|
|
198
|
+
if (index !== -1) {
|
|
199
|
+
start = this.positionInside(index, stringRepresentation);
|
|
200
|
+
end = this.positionInside(index + opts.word.length, stringRepresentation);
|
|
201
|
+
}
|
|
202
|
+
} else {
|
|
203
|
+
if (opts.start) {
|
|
204
|
+
start = {
|
|
205
|
+
column: opts.start.column,
|
|
206
|
+
line: opts.start.line
|
|
207
|
+
};
|
|
208
|
+
} else if (opts.index) {
|
|
209
|
+
start = this.positionInside(opts.index);
|
|
210
|
+
}
|
|
211
|
+
if (opts.end) {
|
|
212
|
+
end = {
|
|
213
|
+
column: opts.end.column,
|
|
214
|
+
line: opts.end.line
|
|
215
|
+
};
|
|
216
|
+
} else if (opts.endIndex) {
|
|
217
|
+
end = this.positionInside(opts.endIndex);
|
|
218
|
+
} else if (opts.index) {
|
|
219
|
+
end = this.positionInside(opts.index + 1);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
if (end.line < start.line || end.line === start.line && end.column <= start.column) {
|
|
223
|
+
end = { column: start.column + 1, line: start.line };
|
|
224
|
+
}
|
|
225
|
+
return { end, start };
|
|
226
|
+
}
|
|
227
|
+
raw(prop, defaultType) {
|
|
228
|
+
let str = new Stringifier();
|
|
229
|
+
return str.raw(this, prop, defaultType);
|
|
230
|
+
}
|
|
231
|
+
remove() {
|
|
232
|
+
if (this.parent) {
|
|
233
|
+
this.parent.removeChild(this);
|
|
234
|
+
}
|
|
235
|
+
this.parent = void 0;
|
|
236
|
+
return this;
|
|
237
|
+
}
|
|
238
|
+
replaceWith(...nodes) {
|
|
239
|
+
if (this.parent) {
|
|
240
|
+
let bookmark = this;
|
|
241
|
+
let foundSelf = false;
|
|
242
|
+
for (let node2 of nodes) {
|
|
243
|
+
if (node2 === this) {
|
|
244
|
+
foundSelf = true;
|
|
245
|
+
} else if (foundSelf) {
|
|
246
|
+
this.parent.insertAfter(bookmark, node2);
|
|
247
|
+
bookmark = node2;
|
|
248
|
+
} else {
|
|
249
|
+
this.parent.insertBefore(bookmark, node2);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
if (!foundSelf) {
|
|
253
|
+
this.remove();
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
return this;
|
|
257
|
+
}
|
|
258
|
+
root() {
|
|
259
|
+
let result = this;
|
|
260
|
+
while (result.parent && result.parent.type !== "document") {
|
|
261
|
+
result = result.parent;
|
|
262
|
+
}
|
|
263
|
+
return result;
|
|
264
|
+
}
|
|
265
|
+
toJSON(_, inputs) {
|
|
266
|
+
let fixed = {};
|
|
267
|
+
let emitInputs = inputs == null;
|
|
268
|
+
inputs = inputs || /* @__PURE__ */ new Map();
|
|
269
|
+
let inputsNextIndex = 0;
|
|
270
|
+
for (let name in this) {
|
|
271
|
+
if (!Object.prototype.hasOwnProperty.call(this, name)) {
|
|
272
|
+
continue;
|
|
273
|
+
}
|
|
274
|
+
if (name === "parent" || name === "proxyCache") continue;
|
|
275
|
+
let value = this[name];
|
|
276
|
+
if (Array.isArray(value)) {
|
|
277
|
+
fixed[name] = value.map((i) => {
|
|
278
|
+
if (typeof i === "object" && i.toJSON) {
|
|
279
|
+
return i.toJSON(null, inputs);
|
|
280
|
+
} else {
|
|
281
|
+
return i;
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
} else if (typeof value === "object" && value.toJSON) {
|
|
285
|
+
fixed[name] = value.toJSON(null, inputs);
|
|
286
|
+
} else if (name === "source") {
|
|
287
|
+
let inputId = inputs.get(value.input);
|
|
288
|
+
if (inputId == null) {
|
|
289
|
+
inputId = inputsNextIndex;
|
|
290
|
+
inputs.set(value.input, inputsNextIndex);
|
|
291
|
+
inputsNextIndex++;
|
|
292
|
+
}
|
|
293
|
+
fixed[name] = {
|
|
294
|
+
end: value.end,
|
|
295
|
+
inputId,
|
|
296
|
+
start: value.start
|
|
297
|
+
};
|
|
298
|
+
} else {
|
|
299
|
+
fixed[name] = value;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
if (emitInputs) {
|
|
303
|
+
fixed.inputs = [...inputs.keys()].map((input) => input.toJSON());
|
|
304
|
+
}
|
|
305
|
+
return fixed;
|
|
306
|
+
}
|
|
307
|
+
toProxy() {
|
|
308
|
+
if (!this.proxyCache) {
|
|
309
|
+
this.proxyCache = new Proxy(this, this.getProxyProcessor());
|
|
310
|
+
}
|
|
311
|
+
return this.proxyCache;
|
|
312
|
+
}
|
|
313
|
+
toString(stringifier2 = stringify$1) {
|
|
314
|
+
if (stringifier2.stringify) stringifier2 = stringifier2.stringify;
|
|
315
|
+
let result = "";
|
|
316
|
+
stringifier2(this, (i) => {
|
|
317
|
+
result += i;
|
|
318
|
+
});
|
|
319
|
+
return result;
|
|
320
|
+
}
|
|
321
|
+
warn(result, text, opts) {
|
|
322
|
+
let data = { node: this };
|
|
323
|
+
for (let i in opts) data[i] = opts[i];
|
|
324
|
+
return result.warn(text, data);
|
|
325
|
+
}
|
|
326
|
+
get proxyOf() {
|
|
327
|
+
return this;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
node = Node;
|
|
331
|
+
Node.default = Node;
|
|
332
|
+
return node;
|
|
333
|
+
}
|
|
334
|
+
exports.__require = requireNode;
|
|
335
|
+
//# sourceMappingURL=node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.js","sources":["../../../../../../node_modules/postcss/lib/node.js"],"sourcesContent":["'use strict'\n\nlet { isClean, my } = require('./symbols')\nlet CssSyntaxError = require('./css-syntax-error')\nlet Stringifier = require('./stringifier')\nlet stringify = require('./stringify')\n\nfunction cloneNode(obj, parent) {\n let cloned = new obj.constructor()\n\n for (let i in obj) {\n if (!Object.prototype.hasOwnProperty.call(obj, i)) {\n /* c8 ignore next 2 */\n continue\n }\n if (i === 'proxyCache') continue\n let value = obj[i]\n let type = typeof value\n\n if (i === 'parent' && type === 'object') {\n if (parent) cloned[i] = parent\n } else if (i === 'source') {\n cloned[i] = value\n } else if (Array.isArray(value)) {\n cloned[i] = value.map(j => cloneNode(j, cloned))\n } else {\n if (type === 'object' && value !== null) value = cloneNode(value)\n cloned[i] = value\n }\n }\n\n return cloned\n}\n\nclass Node {\n constructor(defaults = {}) {\n this.raws = {}\n this[isClean] = false\n this[my] = true\n\n for (let name in defaults) {\n if (name === 'nodes') {\n this.nodes = []\n for (let node of defaults[name]) {\n if (typeof node.clone === 'function') {\n this.append(node.clone())\n } else {\n this.append(node)\n }\n }\n } else {\n this[name] = defaults[name]\n }\n }\n }\n\n addToError(error) {\n error.postcssNode = this\n if (error.stack && this.source && /\\n\\s{4}at /.test(error.stack)) {\n let s = this.source\n error.stack = error.stack.replace(\n /\\n\\s{4}at /,\n `$&${s.input.from}:${s.start.line}:${s.start.column}$&`\n )\n }\n return error\n }\n\n after(add) {\n this.parent.insertAfter(this, add)\n return this\n }\n\n assign(overrides = {}) {\n for (let name in overrides) {\n this[name] = overrides[name]\n }\n return this\n }\n\n before(add) {\n this.parent.insertBefore(this, add)\n return this\n }\n\n cleanRaws(keepBetween) {\n delete this.raws.before\n delete this.raws.after\n if (!keepBetween) delete this.raws.between\n }\n\n clone(overrides = {}) {\n let cloned = cloneNode(this)\n for (let name in overrides) {\n cloned[name] = overrides[name]\n }\n return cloned\n }\n\n cloneAfter(overrides = {}) {\n let cloned = this.clone(overrides)\n this.parent.insertAfter(this, cloned)\n return cloned\n }\n\n cloneBefore(overrides = {}) {\n let cloned = this.clone(overrides)\n this.parent.insertBefore(this, cloned)\n return cloned\n }\n\n error(message, opts = {}) {\n if (this.source) {\n let { end, start } = this.rangeBy(opts)\n return this.source.input.error(\n message,\n { column: start.column, line: start.line },\n { column: end.column, line: end.line },\n opts\n )\n }\n return new CssSyntaxError(message)\n }\n\n getProxyProcessor() {\n return {\n get(node, prop) {\n if (prop === 'proxyOf') {\n return node\n } else if (prop === 'root') {\n return () => node.root().toProxy()\n } else {\n return node[prop]\n }\n },\n\n set(node, prop, value) {\n if (node[prop] === value) return true\n node[prop] = value\n if (\n prop === 'prop' ||\n prop === 'value' ||\n prop === 'name' ||\n prop === 'params' ||\n prop === 'important' ||\n /* c8 ignore next */\n prop === 'text'\n ) {\n node.markDirty()\n }\n return true\n }\n }\n }\n\n markDirty() {\n if (this[isClean]) {\n this[isClean] = false\n let next = this\n while ((next = next.parent)) {\n next[isClean] = false\n }\n }\n }\n\n next() {\n if (!this.parent) return undefined\n let index = this.parent.index(this)\n return this.parent.nodes[index + 1]\n }\n\n positionBy(opts, stringRepresentation) {\n let pos = this.source.start\n if (opts.index) {\n pos = this.positionInside(opts.index, stringRepresentation)\n } else if (opts.word) {\n stringRepresentation = this.toString()\n let index = stringRepresentation.indexOf(opts.word)\n if (index !== -1) pos = this.positionInside(index, stringRepresentation)\n }\n return pos\n }\n\n positionInside(index, stringRepresentation) {\n let string = stringRepresentation || this.toString()\n let column = this.source.start.column\n let line = this.source.start.line\n\n for (let i = 0; i < index; i++) {\n if (string[i] === '\\n') {\n column = 1\n line += 1\n } else {\n column += 1\n }\n }\n\n return { column, line }\n }\n\n prev() {\n if (!this.parent) return undefined\n let index = this.parent.index(this)\n return this.parent.nodes[index - 1]\n }\n\n rangeBy(opts) {\n let start = {\n column: this.source.start.column,\n line: this.source.start.line\n }\n let end = this.source.end\n ? {\n column: this.source.end.column + 1,\n line: this.source.end.line\n }\n : {\n column: start.column + 1,\n line: start.line\n }\n\n if (opts.word) {\n let stringRepresentation = this.toString()\n let index = stringRepresentation.indexOf(opts.word)\n if (index !== -1) {\n start = this.positionInside(index, stringRepresentation)\n end = this.positionInside(index + opts.word.length, stringRepresentation)\n }\n } else {\n if (opts.start) {\n start = {\n column: opts.start.column,\n line: opts.start.line\n }\n } else if (opts.index) {\n start = this.positionInside(opts.index)\n }\n\n if (opts.end) {\n end = {\n column: opts.end.column,\n line: opts.end.line\n }\n } else if (opts.endIndex) {\n end = this.positionInside(opts.endIndex)\n } else if (opts.index) {\n end = this.positionInside(opts.index + 1)\n }\n }\n\n if (\n end.line < start.line ||\n (end.line === start.line && end.column <= start.column)\n ) {\n end = { column: start.column + 1, line: start.line }\n }\n\n return { end, start }\n }\n\n raw(prop, defaultType) {\n let str = new Stringifier()\n return str.raw(this, prop, defaultType)\n }\n\n remove() {\n if (this.parent) {\n this.parent.removeChild(this)\n }\n this.parent = undefined\n return this\n }\n\n replaceWith(...nodes) {\n if (this.parent) {\n let bookmark = this\n let foundSelf = false\n for (let node of nodes) {\n if (node === this) {\n foundSelf = true\n } else if (foundSelf) {\n this.parent.insertAfter(bookmark, node)\n bookmark = node\n } else {\n this.parent.insertBefore(bookmark, node)\n }\n }\n\n if (!foundSelf) {\n this.remove()\n }\n }\n\n return this\n }\n\n root() {\n let result = this\n while (result.parent && result.parent.type !== 'document') {\n result = result.parent\n }\n return result\n }\n\n toJSON(_, inputs) {\n let fixed = {}\n let emitInputs = inputs == null\n inputs = inputs || new Map()\n let inputsNextIndex = 0\n\n for (let name in this) {\n if (!Object.prototype.hasOwnProperty.call(this, name)) {\n /* c8 ignore next 2 */\n continue\n }\n if (name === 'parent' || name === 'proxyCache') continue\n let value = this[name]\n\n if (Array.isArray(value)) {\n fixed[name] = value.map(i => {\n if (typeof i === 'object' && i.toJSON) {\n return i.toJSON(null, inputs)\n } else {\n return i\n }\n })\n } else if (typeof value === 'object' && value.toJSON) {\n fixed[name] = value.toJSON(null, inputs)\n } else if (name === 'source') {\n let inputId = inputs.get(value.input)\n if (inputId == null) {\n inputId = inputsNextIndex\n inputs.set(value.input, inputsNextIndex)\n inputsNextIndex++\n }\n fixed[name] = {\n end: value.end,\n inputId,\n start: value.start\n }\n } else {\n fixed[name] = value\n }\n }\n\n if (emitInputs) {\n fixed.inputs = [...inputs.keys()].map(input => input.toJSON())\n }\n\n return fixed\n }\n\n toProxy() {\n if (!this.proxyCache) {\n this.proxyCache = new Proxy(this, this.getProxyProcessor())\n }\n return this.proxyCache\n }\n\n toString(stringifier = stringify) {\n if (stringifier.stringify) stringifier = stringifier.stringify\n let result = ''\n stringifier(this, i => {\n result += i\n })\n return result\n }\n\n warn(result, text, opts) {\n let data = { node: this }\n for (let i in opts) data[i] = opts[i]\n return result.warn(text, data)\n }\n\n get proxyOf() {\n return this\n }\n}\n\nmodule.exports = Node\nNode.default = Node\n"],"names":["require$$0","require$$1","require$$2","stringify","require$$3","node","stringifier"],"mappings":";;;;;;;;;;;AAEA,MAAI,EAAE,SAAS,GAAE,IAAKA,QAAAA,UAAA;AACtB,MAAI,iBAAiBC,eAAAA,UAAA;AACrB,MAAI,cAAcC,YAAAA,UAAA;AAClB,MAAIC,cAAYC,UAAAA,UAAA;AAEhB,WAAS,UAAU,KAAK,QAAQ;AAC9B,QAAI,SAAS,IAAI,IAAI,YAAW;AAEhC,aAAS,KAAK,KAAK;AACjB,UAAI,CAAC,OAAO,UAAU,eAAe,KAAK,KAAK,CAAC,GAAG;AAEjD;AAAA,MACN;AACI,UAAI,MAAM,aAAc;AACxB,UAAI,QAAQ,IAAI,CAAC;AACjB,UAAI,OAAO,OAAO;AAElB,UAAI,MAAM,YAAY,SAAS,UAAU;AACvC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IAEE,KAAK,QAAQ,MAAM,MAAM;AACvB,UAAI,OAAO,EAAE,MAAM,KAAI;AACvB,eAAS,KAAK,KAAM,MAAK,CAAC,IAAI,KAAK,CAAC;AACpC,aAAO,OAAO,KAAK,MAAM,IAAI;AAAA,IACjC;AAAA,IAEE,IAAI,UAAU;AACZ,aAAO;AAAA,IACX;AAAA,EACA;AAEA,SAAiB;AACjB,OAAK,UAAU;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
import { __require as requireSymbols } from "./symbols.mjs";
|
|
2
|
+
import { __require as requireCssSyntaxError } from "./css-syntax-error.mjs";
|
|
3
|
+
import { __require as requireStringifier } from "./stringifier.mjs";
|
|
4
|
+
import { __require as requireStringify } from "./stringify.mjs";
|
|
5
|
+
var node;
|
|
6
|
+
var hasRequiredNode;
|
|
7
|
+
function requireNode() {
|
|
8
|
+
if (hasRequiredNode) return node;
|
|
9
|
+
hasRequiredNode = 1;
|
|
10
|
+
let { isClean, my } = requireSymbols();
|
|
11
|
+
let CssSyntaxError = requireCssSyntaxError();
|
|
12
|
+
let Stringifier = requireStringifier();
|
|
13
|
+
let stringify = requireStringify();
|
|
14
|
+
function cloneNode(obj, parent) {
|
|
15
|
+
let cloned = new obj.constructor();
|
|
16
|
+
for (let i in obj) {
|
|
17
|
+
if (!Object.prototype.hasOwnProperty.call(obj, i)) {
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
if (i === "proxyCache") continue;
|
|
21
|
+
let value = obj[i];
|
|
22
|
+
let type = typeof value;
|
|
23
|
+
if (i === "parent" && type === "object") {
|
|
24
|
+
if (parent) cloned[i] = parent;
|
|
25
|
+
} else if (i === "source") {
|
|
26
|
+
cloned[i] = value;
|
|
27
|
+
} else if (Array.isArray(value)) {
|
|
28
|
+
cloned[i] = value.map((j) => cloneNode(j, cloned));
|
|
29
|
+
} else {
|
|
30
|
+
if (type === "object" && value !== null) value = cloneNode(value);
|
|
31
|
+
cloned[i] = value;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return cloned;
|
|
35
|
+
}
|
|
36
|
+
class Node {
|
|
37
|
+
constructor(defaults = {}) {
|
|
38
|
+
this.raws = {};
|
|
39
|
+
this[isClean] = false;
|
|
40
|
+
this[my] = true;
|
|
41
|
+
for (let name in defaults) {
|
|
42
|
+
if (name === "nodes") {
|
|
43
|
+
this.nodes = [];
|
|
44
|
+
for (let node2 of defaults[name]) {
|
|
45
|
+
if (typeof node2.clone === "function") {
|
|
46
|
+
this.append(node2.clone());
|
|
47
|
+
} else {
|
|
48
|
+
this.append(node2);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
} else {
|
|
52
|
+
this[name] = defaults[name];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
addToError(error) {
|
|
57
|
+
error.postcssNode = this;
|
|
58
|
+
if (error.stack && this.source && /\n\s{4}at /.test(error.stack)) {
|
|
59
|
+
let s = this.source;
|
|
60
|
+
error.stack = error.stack.replace(
|
|
61
|
+
/\n\s{4}at /,
|
|
62
|
+
`$&${s.input.from}:${s.start.line}:${s.start.column}$&`
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
return error;
|
|
66
|
+
}
|
|
67
|
+
after(add) {
|
|
68
|
+
this.parent.insertAfter(this, add);
|
|
69
|
+
return this;
|
|
70
|
+
}
|
|
71
|
+
assign(overrides = {}) {
|
|
72
|
+
for (let name in overrides) {
|
|
73
|
+
this[name] = overrides[name];
|
|
74
|
+
}
|
|
75
|
+
return this;
|
|
76
|
+
}
|
|
77
|
+
before(add) {
|
|
78
|
+
this.parent.insertBefore(this, add);
|
|
79
|
+
return this;
|
|
80
|
+
}
|
|
81
|
+
cleanRaws(keepBetween) {
|
|
82
|
+
delete this.raws.before;
|
|
83
|
+
delete this.raws.after;
|
|
84
|
+
if (!keepBetween) delete this.raws.between;
|
|
85
|
+
}
|
|
86
|
+
clone(overrides = {}) {
|
|
87
|
+
let cloned = cloneNode(this);
|
|
88
|
+
for (let name in overrides) {
|
|
89
|
+
cloned[name] = overrides[name];
|
|
90
|
+
}
|
|
91
|
+
return cloned;
|
|
92
|
+
}
|
|
93
|
+
cloneAfter(overrides = {}) {
|
|
94
|
+
let cloned = this.clone(overrides);
|
|
95
|
+
this.parent.insertAfter(this, cloned);
|
|
96
|
+
return cloned;
|
|
97
|
+
}
|
|
98
|
+
cloneBefore(overrides = {}) {
|
|
99
|
+
let cloned = this.clone(overrides);
|
|
100
|
+
this.parent.insertBefore(this, cloned);
|
|
101
|
+
return cloned;
|
|
102
|
+
}
|
|
103
|
+
error(message, opts = {}) {
|
|
104
|
+
if (this.source) {
|
|
105
|
+
let { end, start } = this.rangeBy(opts);
|
|
106
|
+
return this.source.input.error(
|
|
107
|
+
message,
|
|
108
|
+
{ column: start.column, line: start.line },
|
|
109
|
+
{ column: end.column, line: end.line },
|
|
110
|
+
opts
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
return new CssSyntaxError(message);
|
|
114
|
+
}
|
|
115
|
+
getProxyProcessor() {
|
|
116
|
+
return {
|
|
117
|
+
get(node2, prop) {
|
|
118
|
+
if (prop === "proxyOf") {
|
|
119
|
+
return node2;
|
|
120
|
+
} else if (prop === "root") {
|
|
121
|
+
return () => node2.root().toProxy();
|
|
122
|
+
} else {
|
|
123
|
+
return node2[prop];
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
set(node2, prop, value) {
|
|
127
|
+
if (node2[prop] === value) return true;
|
|
128
|
+
node2[prop] = value;
|
|
129
|
+
if (prop === "prop" || prop === "value" || prop === "name" || prop === "params" || prop === "important" || /* c8 ignore next */
|
|
130
|
+
prop === "text") {
|
|
131
|
+
node2.markDirty();
|
|
132
|
+
}
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
markDirty() {
|
|
138
|
+
if (this[isClean]) {
|
|
139
|
+
this[isClean] = false;
|
|
140
|
+
let next = this;
|
|
141
|
+
while (next = next.parent) {
|
|
142
|
+
next[isClean] = false;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
next() {
|
|
147
|
+
if (!this.parent) return void 0;
|
|
148
|
+
let index = this.parent.index(this);
|
|
149
|
+
return this.parent.nodes[index + 1];
|
|
150
|
+
}
|
|
151
|
+
positionBy(opts, stringRepresentation) {
|
|
152
|
+
let pos = this.source.start;
|
|
153
|
+
if (opts.index) {
|
|
154
|
+
pos = this.positionInside(opts.index, stringRepresentation);
|
|
155
|
+
} else if (opts.word) {
|
|
156
|
+
stringRepresentation = this.toString();
|
|
157
|
+
let index = stringRepresentation.indexOf(opts.word);
|
|
158
|
+
if (index !== -1) pos = this.positionInside(index, stringRepresentation);
|
|
159
|
+
}
|
|
160
|
+
return pos;
|
|
161
|
+
}
|
|
162
|
+
positionInside(index, stringRepresentation) {
|
|
163
|
+
let string = stringRepresentation || this.toString();
|
|
164
|
+
let column = this.source.start.column;
|
|
165
|
+
let line = this.source.start.line;
|
|
166
|
+
for (let i = 0; i < index; i++) {
|
|
167
|
+
if (string[i] === "\n") {
|
|
168
|
+
column = 1;
|
|
169
|
+
line += 1;
|
|
170
|
+
} else {
|
|
171
|
+
column += 1;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return { column, line };
|
|
175
|
+
}
|
|
176
|
+
prev() {
|
|
177
|
+
if (!this.parent) return void 0;
|
|
178
|
+
let index = this.parent.index(this);
|
|
179
|
+
return this.parent.nodes[index - 1];
|
|
180
|
+
}
|
|
181
|
+
rangeBy(opts) {
|
|
182
|
+
let start = {
|
|
183
|
+
column: this.source.start.column,
|
|
184
|
+
line: this.source.start.line
|
|
185
|
+
};
|
|
186
|
+
let end = this.source.end ? {
|
|
187
|
+
column: this.source.end.column + 1,
|
|
188
|
+
line: this.source.end.line
|
|
189
|
+
} : {
|
|
190
|
+
column: start.column + 1,
|
|
191
|
+
line: start.line
|
|
192
|
+
};
|
|
193
|
+
if (opts.word) {
|
|
194
|
+
let stringRepresentation = this.toString();
|
|
195
|
+
let index = stringRepresentation.indexOf(opts.word);
|
|
196
|
+
if (index !== -1) {
|
|
197
|
+
start = this.positionInside(index, stringRepresentation);
|
|
198
|
+
end = this.positionInside(index + opts.word.length, stringRepresentation);
|
|
199
|
+
}
|
|
200
|
+
} else {
|
|
201
|
+
if (opts.start) {
|
|
202
|
+
start = {
|
|
203
|
+
column: opts.start.column,
|
|
204
|
+
line: opts.start.line
|
|
205
|
+
};
|
|
206
|
+
} else if (opts.index) {
|
|
207
|
+
start = this.positionInside(opts.index);
|
|
208
|
+
}
|
|
209
|
+
if (opts.end) {
|
|
210
|
+
end = {
|
|
211
|
+
column: opts.end.column,
|
|
212
|
+
line: opts.end.line
|
|
213
|
+
};
|
|
214
|
+
} else if (opts.endIndex) {
|
|
215
|
+
end = this.positionInside(opts.endIndex);
|
|
216
|
+
} else if (opts.index) {
|
|
217
|
+
end = this.positionInside(opts.index + 1);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
if (end.line < start.line || end.line === start.line && end.column <= start.column) {
|
|
221
|
+
end = { column: start.column + 1, line: start.line };
|
|
222
|
+
}
|
|
223
|
+
return { end, start };
|
|
224
|
+
}
|
|
225
|
+
raw(prop, defaultType) {
|
|
226
|
+
let str = new Stringifier();
|
|
227
|
+
return str.raw(this, prop, defaultType);
|
|
228
|
+
}
|
|
229
|
+
remove() {
|
|
230
|
+
if (this.parent) {
|
|
231
|
+
this.parent.removeChild(this);
|
|
232
|
+
}
|
|
233
|
+
this.parent = void 0;
|
|
234
|
+
return this;
|
|
235
|
+
}
|
|
236
|
+
replaceWith(...nodes) {
|
|
237
|
+
if (this.parent) {
|
|
238
|
+
let bookmark = this;
|
|
239
|
+
let foundSelf = false;
|
|
240
|
+
for (let node2 of nodes) {
|
|
241
|
+
if (node2 === this) {
|
|
242
|
+
foundSelf = true;
|
|
243
|
+
} else if (foundSelf) {
|
|
244
|
+
this.parent.insertAfter(bookmark, node2);
|
|
245
|
+
bookmark = node2;
|
|
246
|
+
} else {
|
|
247
|
+
this.parent.insertBefore(bookmark, node2);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
if (!foundSelf) {
|
|
251
|
+
this.remove();
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return this;
|
|
255
|
+
}
|
|
256
|
+
root() {
|
|
257
|
+
let result = this;
|
|
258
|
+
while (result.parent && result.parent.type !== "document") {
|
|
259
|
+
result = result.parent;
|
|
260
|
+
}
|
|
261
|
+
return result;
|
|
262
|
+
}
|
|
263
|
+
toJSON(_, inputs) {
|
|
264
|
+
let fixed = {};
|
|
265
|
+
let emitInputs = inputs == null;
|
|
266
|
+
inputs = inputs || /* @__PURE__ */ new Map();
|
|
267
|
+
let inputsNextIndex = 0;
|
|
268
|
+
for (let name in this) {
|
|
269
|
+
if (!Object.prototype.hasOwnProperty.call(this, name)) {
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
if (name === "parent" || name === "proxyCache") continue;
|
|
273
|
+
let value = this[name];
|
|
274
|
+
if (Array.isArray(value)) {
|
|
275
|
+
fixed[name] = value.map((i) => {
|
|
276
|
+
if (typeof i === "object" && i.toJSON) {
|
|
277
|
+
return i.toJSON(null, inputs);
|
|
278
|
+
} else {
|
|
279
|
+
return i;
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
} else if (typeof value === "object" && value.toJSON) {
|
|
283
|
+
fixed[name] = value.toJSON(null, inputs);
|
|
284
|
+
} else if (name === "source") {
|
|
285
|
+
let inputId = inputs.get(value.input);
|
|
286
|
+
if (inputId == null) {
|
|
287
|
+
inputId = inputsNextIndex;
|
|
288
|
+
inputs.set(value.input, inputsNextIndex);
|
|
289
|
+
inputsNextIndex++;
|
|
290
|
+
}
|
|
291
|
+
fixed[name] = {
|
|
292
|
+
end: value.end,
|
|
293
|
+
inputId,
|
|
294
|
+
start: value.start
|
|
295
|
+
};
|
|
296
|
+
} else {
|
|
297
|
+
fixed[name] = value;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
if (emitInputs) {
|
|
301
|
+
fixed.inputs = [...inputs.keys()].map((input) => input.toJSON());
|
|
302
|
+
}
|
|
303
|
+
return fixed;
|
|
304
|
+
}
|
|
305
|
+
toProxy() {
|
|
306
|
+
if (!this.proxyCache) {
|
|
307
|
+
this.proxyCache = new Proxy(this, this.getProxyProcessor());
|
|
308
|
+
}
|
|
309
|
+
return this.proxyCache;
|
|
310
|
+
}
|
|
311
|
+
toString(stringifier = stringify) {
|
|
312
|
+
if (stringifier.stringify) stringifier = stringifier.stringify;
|
|
313
|
+
let result = "";
|
|
314
|
+
stringifier(this, (i) => {
|
|
315
|
+
result += i;
|
|
316
|
+
});
|
|
317
|
+
return result;
|
|
318
|
+
}
|
|
319
|
+
warn(result, text, opts) {
|
|
320
|
+
let data = { node: this };
|
|
321
|
+
for (let i in opts) data[i] = opts[i];
|
|
322
|
+
return result.warn(text, data);
|
|
323
|
+
}
|
|
324
|
+
get proxyOf() {
|
|
325
|
+
return this;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
node = Node;
|
|
329
|
+
Node.default = Node;
|
|
330
|
+
return node;
|
|
331
|
+
}
|
|
332
|
+
export {
|
|
333
|
+
requireNode as __require
|
|
334
|
+
};
|
|
335
|
+
//# sourceMappingURL=node.mjs.map
|