style-to-object 1.0.8 → 1.0.9
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/dist/style-to-object.js +266 -257
- package/dist/style-to-object.js.map +1 -1
- package/dist/style-to-object.min.js +1 -1
- package/dist/style-to-object.min.js.map +1 -1
- package/package.json +24 -23
package/dist/style-to-object.js
CHANGED
|
@@ -8,265 +8,274 @@
|
|
|
8
8
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
11
|
+
var inlineStyleParser;
|
|
12
|
+
var hasRequiredInlineStyleParser;
|
|
13
|
+
|
|
14
|
+
function requireInlineStyleParser () {
|
|
15
|
+
if (hasRequiredInlineStyleParser) return inlineStyleParser;
|
|
16
|
+
hasRequiredInlineStyleParser = 1;
|
|
17
|
+
// http://www.w3.org/TR/CSS21/grammar.html
|
|
18
|
+
// https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027
|
|
19
|
+
var COMMENT_REGEX = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;
|
|
20
|
+
|
|
21
|
+
var NEWLINE_REGEX = /\n/g;
|
|
22
|
+
var WHITESPACE_REGEX = /^\s*/;
|
|
23
|
+
|
|
24
|
+
// declaration
|
|
25
|
+
var PROPERTY_REGEX = /^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/;
|
|
26
|
+
var COLON_REGEX = /^:\s*/;
|
|
27
|
+
var VALUE_REGEX = /^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/;
|
|
28
|
+
var SEMICOLON_REGEX = /^[;\s]*/;
|
|
29
|
+
|
|
30
|
+
// https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill
|
|
31
|
+
var TRIM_REGEX = /^\s+|\s+$/g;
|
|
32
|
+
|
|
33
|
+
// strings
|
|
34
|
+
var NEWLINE = '\n';
|
|
35
|
+
var FORWARD_SLASH = '/';
|
|
36
|
+
var ASTERISK = '*';
|
|
37
|
+
var EMPTY_STRING = '';
|
|
38
|
+
|
|
39
|
+
// types
|
|
40
|
+
var TYPE_COMMENT = 'comment';
|
|
41
|
+
var TYPE_DECLARATION = 'declaration';
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @param {String} style
|
|
45
|
+
* @param {Object} [options]
|
|
46
|
+
* @return {Object[]}
|
|
47
|
+
* @throws {TypeError}
|
|
48
|
+
* @throws {Error}
|
|
49
|
+
*/
|
|
50
|
+
inlineStyleParser = function (style, options) {
|
|
51
|
+
if (typeof style !== 'string') {
|
|
52
|
+
throw new TypeError('First argument must be a string');
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (!style) return [];
|
|
56
|
+
|
|
57
|
+
options = options || {};
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Positional.
|
|
61
|
+
*/
|
|
62
|
+
var lineno = 1;
|
|
63
|
+
var column = 1;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Update lineno and column based on `str`.
|
|
67
|
+
*
|
|
68
|
+
* @param {String} str
|
|
69
|
+
*/
|
|
70
|
+
function updatePosition(str) {
|
|
71
|
+
var lines = str.match(NEWLINE_REGEX);
|
|
72
|
+
if (lines) lineno += lines.length;
|
|
73
|
+
var i = str.lastIndexOf(NEWLINE);
|
|
74
|
+
column = ~i ? str.length - i : column + str.length;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Mark position and patch `node.position`.
|
|
79
|
+
*
|
|
80
|
+
* @return {Function}
|
|
81
|
+
*/
|
|
82
|
+
function position() {
|
|
83
|
+
var start = { line: lineno, column: column };
|
|
84
|
+
return function (node) {
|
|
85
|
+
node.position = new Position(start);
|
|
86
|
+
whitespace();
|
|
87
|
+
return node;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Store position information for a node.
|
|
93
|
+
*
|
|
94
|
+
* @constructor
|
|
95
|
+
* @property {Object} start
|
|
96
|
+
* @property {Object} end
|
|
97
|
+
* @property {undefined|String} source
|
|
98
|
+
*/
|
|
99
|
+
function Position(start) {
|
|
100
|
+
this.start = start;
|
|
101
|
+
this.end = { line: lineno, column: column };
|
|
102
|
+
this.source = options.source;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Non-enumerable source string.
|
|
107
|
+
*/
|
|
108
|
+
Position.prototype.content = style;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Error `msg`.
|
|
112
|
+
*
|
|
113
|
+
* @param {String} msg
|
|
114
|
+
* @throws {Error}
|
|
115
|
+
*/
|
|
116
|
+
function error(msg) {
|
|
117
|
+
var err = new Error(
|
|
118
|
+
options.source + ':' + lineno + ':' + column + ': ' + msg
|
|
119
|
+
);
|
|
120
|
+
err.reason = msg;
|
|
121
|
+
err.filename = options.source;
|
|
122
|
+
err.line = lineno;
|
|
123
|
+
err.column = column;
|
|
124
|
+
err.source = style;
|
|
125
|
+
|
|
126
|
+
if (options.silent) ; else {
|
|
127
|
+
throw err;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Match `re` and return captures.
|
|
133
|
+
*
|
|
134
|
+
* @param {RegExp} re
|
|
135
|
+
* @return {undefined|Array}
|
|
136
|
+
*/
|
|
137
|
+
function match(re) {
|
|
138
|
+
var m = re.exec(style);
|
|
139
|
+
if (!m) return;
|
|
140
|
+
var str = m[0];
|
|
141
|
+
updatePosition(str);
|
|
142
|
+
style = style.slice(str.length);
|
|
143
|
+
return m;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Parse whitespace.
|
|
148
|
+
*/
|
|
149
|
+
function whitespace() {
|
|
150
|
+
match(WHITESPACE_REGEX);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Parse comments.
|
|
155
|
+
*
|
|
156
|
+
* @param {Object[]} [rules]
|
|
157
|
+
* @return {Object[]}
|
|
158
|
+
*/
|
|
159
|
+
function comments(rules) {
|
|
160
|
+
var c;
|
|
161
|
+
rules = rules || [];
|
|
162
|
+
while ((c = comment())) {
|
|
163
|
+
if (c !== false) {
|
|
164
|
+
rules.push(c);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return rules;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Parse comment.
|
|
172
|
+
*
|
|
173
|
+
* @return {Object}
|
|
174
|
+
* @throws {Error}
|
|
175
|
+
*/
|
|
176
|
+
function comment() {
|
|
177
|
+
var pos = position();
|
|
178
|
+
if (FORWARD_SLASH != style.charAt(0) || ASTERISK != style.charAt(1)) return;
|
|
179
|
+
|
|
180
|
+
var i = 2;
|
|
181
|
+
while (
|
|
182
|
+
EMPTY_STRING != style.charAt(i) &&
|
|
183
|
+
(ASTERISK != style.charAt(i) || FORWARD_SLASH != style.charAt(i + 1))
|
|
184
|
+
) {
|
|
185
|
+
++i;
|
|
186
|
+
}
|
|
187
|
+
i += 2;
|
|
188
|
+
|
|
189
|
+
if (EMPTY_STRING === style.charAt(i - 1)) {
|
|
190
|
+
return error('End of comment missing');
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
var str = style.slice(2, i - 2);
|
|
194
|
+
column += 2;
|
|
195
|
+
updatePosition(str);
|
|
196
|
+
style = style.slice(i);
|
|
197
|
+
column += 2;
|
|
198
|
+
|
|
199
|
+
return pos({
|
|
200
|
+
type: TYPE_COMMENT,
|
|
201
|
+
comment: str
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Parse declaration.
|
|
207
|
+
*
|
|
208
|
+
* @return {Object}
|
|
209
|
+
* @throws {Error}
|
|
210
|
+
*/
|
|
211
|
+
function declaration() {
|
|
212
|
+
var pos = position();
|
|
213
|
+
|
|
214
|
+
// prop
|
|
215
|
+
var prop = match(PROPERTY_REGEX);
|
|
216
|
+
if (!prop) return;
|
|
217
|
+
comment();
|
|
218
|
+
|
|
219
|
+
// :
|
|
220
|
+
if (!match(COLON_REGEX)) return error("property missing ':'");
|
|
221
|
+
|
|
222
|
+
// val
|
|
223
|
+
var val = match(VALUE_REGEX);
|
|
224
|
+
|
|
225
|
+
var ret = pos({
|
|
226
|
+
type: TYPE_DECLARATION,
|
|
227
|
+
property: trim(prop[0].replace(COMMENT_REGEX, EMPTY_STRING)),
|
|
228
|
+
value: val
|
|
229
|
+
? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING))
|
|
230
|
+
: EMPTY_STRING
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
// ;
|
|
234
|
+
match(SEMICOLON_REGEX);
|
|
235
|
+
|
|
236
|
+
return ret;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Parse declarations.
|
|
241
|
+
*
|
|
242
|
+
* @return {Object[]}
|
|
243
|
+
*/
|
|
244
|
+
function declarations() {
|
|
245
|
+
var decls = [];
|
|
246
|
+
|
|
247
|
+
comments(decls);
|
|
248
|
+
|
|
249
|
+
// declarations
|
|
250
|
+
var decl;
|
|
251
|
+
while ((decl = declaration())) {
|
|
252
|
+
if (decl !== false) {
|
|
253
|
+
decls.push(decl);
|
|
254
|
+
comments(decls);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
return decls;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
whitespace();
|
|
262
|
+
return declarations();
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Trim `str`.
|
|
267
|
+
*
|
|
268
|
+
* @param {String} str
|
|
269
|
+
* @return {String}
|
|
270
|
+
*/
|
|
271
|
+
function trim(str) {
|
|
272
|
+
return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING;
|
|
273
|
+
}
|
|
274
|
+
return inlineStyleParser;
|
|
267
275
|
}
|
|
268
276
|
|
|
269
|
-
var
|
|
277
|
+
var inlineStyleParserExports = requireInlineStyleParser();
|
|
278
|
+
var parse = /*@__PURE__*/getDefaultExportFromCjs(inlineStyleParserExports);
|
|
270
279
|
|
|
271
280
|
/**
|
|
272
281
|
* Parses inline style to object.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style-to-object.js","sources":["../node_modules/inline-style-parser/index.js","../src/index.ts"],"sourcesContent":["// http://www.w3.org/TR/CSS21/grammar.html\n// https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027\nvar COMMENT_REGEX = /\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\//g;\n\nvar NEWLINE_REGEX = /\\n/g;\nvar WHITESPACE_REGEX = /^\\s*/;\n\n// declaration\nvar PROPERTY_REGEX = /^(\\*?[-#/*\\\\\\w]+(\\[[0-9a-z_-]+\\])?)\\s*/;\nvar COLON_REGEX = /^:\\s*/;\nvar VALUE_REGEX = /^((?:'(?:\\\\'|.)*?'|\"(?:\\\\\"|.)*?\"|\\([^)]*?\\)|[^};])+)/;\nvar SEMICOLON_REGEX = /^[;\\s]*/;\n\n// https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill\nvar TRIM_REGEX = /^\\s+|\\s+$/g;\n\n// strings\nvar NEWLINE = '\\n';\nvar FORWARD_SLASH = '/';\nvar ASTERISK = '*';\nvar EMPTY_STRING = '';\n\n// types\nvar TYPE_COMMENT = 'comment';\nvar TYPE_DECLARATION = 'declaration';\n\n/**\n * @param {String} style\n * @param {Object} [options]\n * @return {Object[]}\n * @throws {TypeError}\n * @throws {Error}\n */\nmodule.exports = function (style, options) {\n if (typeof style !== 'string') {\n throw new TypeError('First argument must be a string');\n }\n\n if (!style) return [];\n\n options = options || {};\n\n /**\n * Positional.\n */\n var lineno = 1;\n var column = 1;\n\n /**\n * Update lineno and column based on `str`.\n *\n * @param {String} str\n */\n function updatePosition(str) {\n var lines = str.match(NEWLINE_REGEX);\n if (lines) lineno += lines.length;\n var i = str.lastIndexOf(NEWLINE);\n column = ~i ? str.length - i : column + str.length;\n }\n\n /**\n * Mark position and patch `node.position`.\n *\n * @return {Function}\n */\n function position() {\n var start = { line: lineno, column: column };\n return function (node) {\n node.position = new Position(start);\n whitespace();\n return node;\n };\n }\n\n /**\n * Store position information for a node.\n *\n * @constructor\n * @property {Object} start\n * @property {Object} end\n * @property {undefined|String} source\n */\n function Position(start) {\n this.start = start;\n this.end = { line: lineno, column: column };\n this.source = options.source;\n }\n\n /**\n * Non-enumerable source string.\n */\n Position.prototype.content = style;\n\n var errorsList = [];\n\n /**\n * Error `msg`.\n *\n * @param {String} msg\n * @throws {Error}\n */\n function error(msg) {\n var err = new Error(\n options.source + ':' + lineno + ':' + column + ': ' + msg\n );\n err.reason = msg;\n err.filename = options.source;\n err.line = lineno;\n err.column = column;\n err.source = style;\n\n if (options.silent) {\n errorsList.push(err);\n } else {\n throw err;\n }\n }\n\n /**\n * Match `re` and return captures.\n *\n * @param {RegExp} re\n * @return {undefined|Array}\n */\n function match(re) {\n var m = re.exec(style);\n if (!m) return;\n var str = m[0];\n updatePosition(str);\n style = style.slice(str.length);\n return m;\n }\n\n /**\n * Parse whitespace.\n */\n function whitespace() {\n match(WHITESPACE_REGEX);\n }\n\n /**\n * Parse comments.\n *\n * @param {Object[]} [rules]\n * @return {Object[]}\n */\n function comments(rules) {\n var c;\n rules = rules || [];\n while ((c = comment())) {\n if (c !== false) {\n rules.push(c);\n }\n }\n return rules;\n }\n\n /**\n * Parse comment.\n *\n * @return {Object}\n * @throws {Error}\n */\n function comment() {\n var pos = position();\n if (FORWARD_SLASH != style.charAt(0) || ASTERISK != style.charAt(1)) return;\n\n var i = 2;\n while (\n EMPTY_STRING != style.charAt(i) &&\n (ASTERISK != style.charAt(i) || FORWARD_SLASH != style.charAt(i + 1))\n ) {\n ++i;\n }\n i += 2;\n\n if (EMPTY_STRING === style.charAt(i - 1)) {\n return error('End of comment missing');\n }\n\n var str = style.slice(2, i - 2);\n column += 2;\n updatePosition(str);\n style = style.slice(i);\n column += 2;\n\n return pos({\n type: TYPE_COMMENT,\n comment: str\n });\n }\n\n /**\n * Parse declaration.\n *\n * @return {Object}\n * @throws {Error}\n */\n function declaration() {\n var pos = position();\n\n // prop\n var prop = match(PROPERTY_REGEX);\n if (!prop) return;\n comment();\n\n // :\n if (!match(COLON_REGEX)) return error(\"property missing ':'\");\n\n // val\n var val = match(VALUE_REGEX);\n\n var ret = pos({\n type: TYPE_DECLARATION,\n property: trim(prop[0].replace(COMMENT_REGEX, EMPTY_STRING)),\n value: val\n ? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING))\n : EMPTY_STRING\n });\n\n // ;\n match(SEMICOLON_REGEX);\n\n return ret;\n }\n\n /**\n * Parse declarations.\n *\n * @return {Object[]}\n */\n function declarations() {\n var decls = [];\n\n comments(decls);\n\n // declarations\n var decl;\n while ((decl = declaration())) {\n if (decl !== false) {\n decls.push(decl);\n comments(decls);\n }\n }\n\n return decls;\n }\n\n whitespace();\n return declarations();\n};\n\n/**\n * Trim `str`.\n *\n * @param {String} str\n * @return {String}\n */\nfunction trim(str) {\n return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING;\n}\n",null],"names":[],"mappings":";;;;;;;;;;CAAA;CACA;CACA,IAAI,aAAa,GAAG,iCAAiC,CAAC;AACtD;CACA,IAAI,aAAa,GAAG,KAAK,CAAC;CAC1B,IAAI,gBAAgB,GAAG,MAAM,CAAC;AAC9B;CACA;CACA,IAAI,cAAc,GAAG,wCAAwC,CAAC;CAC9D,IAAI,WAAW,GAAG,OAAO,CAAC;CAC1B,IAAI,WAAW,GAAG,sDAAsD,CAAC;CACzE,IAAI,eAAe,GAAG,SAAS,CAAC;AAChC;CACA;CACA,IAAI,UAAU,GAAG,YAAY,CAAC;AAC9B;CACA;CACA,IAAI,OAAO,GAAG,IAAI,CAAC;CACnB,IAAI,aAAa,GAAG,GAAG,CAAC;CACxB,IAAI,QAAQ,GAAG,GAAG,CAAC;CACnB,IAAI,YAAY,GAAG,EAAE,CAAC;AACtB;CACA;CACA,IAAI,YAAY,GAAG,SAAS,CAAC;CAC7B,IAAI,gBAAgB,GAAG,aAAa,CAAC;AACrC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,IAAA,iBAAc,GAAG,UAAU,KAAK,EAAE,OAAO,EAAE;CAC3C,EAAE,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;CACjC,IAAI,MAAM,IAAI,SAAS,CAAC,iCAAiC,CAAC,CAAC;CAC3D,GAAG;AACH;CACA,EAAE,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC;AACxB;CACA,EAAE,OAAO,GAAG,OAAO,IAAI,EAAE,CAAC;AAC1B;CACA;CACA;CACA;CACA,EAAE,IAAI,MAAM,GAAG,CAAC,CAAC;CACjB,EAAE,IAAI,MAA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AAK,CAAC;UAC/B;CACH,KAAC,CAAC,CAAC;CAEH,IAAA,OAAO,WAAW,CAAC;CACrB;;;;;;;;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"style-to-object.js","sources":["../node_modules/inline-style-parser/index.js","../src/index.ts"],"sourcesContent":["// http://www.w3.org/TR/CSS21/grammar.html\n// https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027\nvar COMMENT_REGEX = /\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\//g;\n\nvar NEWLINE_REGEX = /\\n/g;\nvar WHITESPACE_REGEX = /^\\s*/;\n\n// declaration\nvar PROPERTY_REGEX = /^(\\*?[-#/*\\\\\\w]+(\\[[0-9a-z_-]+\\])?)\\s*/;\nvar COLON_REGEX = /^:\\s*/;\nvar VALUE_REGEX = /^((?:'(?:\\\\'|.)*?'|\"(?:\\\\\"|.)*?\"|\\([^)]*?\\)|[^};])+)/;\nvar SEMICOLON_REGEX = /^[;\\s]*/;\n\n// https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill\nvar TRIM_REGEX = /^\\s+|\\s+$/g;\n\n// strings\nvar NEWLINE = '\\n';\nvar FORWARD_SLASH = '/';\nvar ASTERISK = '*';\nvar EMPTY_STRING = '';\n\n// types\nvar TYPE_COMMENT = 'comment';\nvar TYPE_DECLARATION = 'declaration';\n\n/**\n * @param {String} style\n * @param {Object} [options]\n * @return {Object[]}\n * @throws {TypeError}\n * @throws {Error}\n */\nmodule.exports = function (style, options) {\n if (typeof style !== 'string') {\n throw new TypeError('First argument must be a string');\n }\n\n if (!style) return [];\n\n options = options || {};\n\n /**\n * Positional.\n */\n var lineno = 1;\n var column = 1;\n\n /**\n * Update lineno and column based on `str`.\n *\n * @param {String} str\n */\n function updatePosition(str) {\n var lines = str.match(NEWLINE_REGEX);\n if (lines) lineno += lines.length;\n var i = str.lastIndexOf(NEWLINE);\n column = ~i ? str.length - i : column + str.length;\n }\n\n /**\n * Mark position and patch `node.position`.\n *\n * @return {Function}\n */\n function position() {\n var start = { line: lineno, column: column };\n return function (node) {\n node.position = new Position(start);\n whitespace();\n return node;\n };\n }\n\n /**\n * Store position information for a node.\n *\n * @constructor\n * @property {Object} start\n * @property {Object} end\n * @property {undefined|String} source\n */\n function Position(start) {\n this.start = start;\n this.end = { line: lineno, column: column };\n this.source = options.source;\n }\n\n /**\n * Non-enumerable source string.\n */\n Position.prototype.content = style;\n\n var errorsList = [];\n\n /**\n * Error `msg`.\n *\n * @param {String} msg\n * @throws {Error}\n */\n function error(msg) {\n var err = new Error(\n options.source + ':' + lineno + ':' + column + ': ' + msg\n );\n err.reason = msg;\n err.filename = options.source;\n err.line = lineno;\n err.column = column;\n err.source = style;\n\n if (options.silent) {\n errorsList.push(err);\n } else {\n throw err;\n }\n }\n\n /**\n * Match `re` and return captures.\n *\n * @param {RegExp} re\n * @return {undefined|Array}\n */\n function match(re) {\n var m = re.exec(style);\n if (!m) return;\n var str = m[0];\n updatePosition(str);\n style = style.slice(str.length);\n return m;\n }\n\n /**\n * Parse whitespace.\n */\n function whitespace() {\n match(WHITESPACE_REGEX);\n }\n\n /**\n * Parse comments.\n *\n * @param {Object[]} [rules]\n * @return {Object[]}\n */\n function comments(rules) {\n var c;\n rules = rules || [];\n while ((c = comment())) {\n if (c !== false) {\n rules.push(c);\n }\n }\n return rules;\n }\n\n /**\n * Parse comment.\n *\n * @return {Object}\n * @throws {Error}\n */\n function comment() {\n var pos = position();\n if (FORWARD_SLASH != style.charAt(0) || ASTERISK != style.charAt(1)) return;\n\n var i = 2;\n while (\n EMPTY_STRING != style.charAt(i) &&\n (ASTERISK != style.charAt(i) || FORWARD_SLASH != style.charAt(i + 1))\n ) {\n ++i;\n }\n i += 2;\n\n if (EMPTY_STRING === style.charAt(i - 1)) {\n return error('End of comment missing');\n }\n\n var str = style.slice(2, i - 2);\n column += 2;\n updatePosition(str);\n style = style.slice(i);\n column += 2;\n\n return pos({\n type: TYPE_COMMENT,\n comment: str\n });\n }\n\n /**\n * Parse declaration.\n *\n * @return {Object}\n * @throws {Error}\n */\n function declaration() {\n var pos = position();\n\n // prop\n var prop = match(PROPERTY_REGEX);\n if (!prop) return;\n comment();\n\n // :\n if (!match(COLON_REGEX)) return error(\"property missing ':'\");\n\n // val\n var val = match(VALUE_REGEX);\n\n var ret = pos({\n type: TYPE_DECLARATION,\n property: trim(prop[0].replace(COMMENT_REGEX, EMPTY_STRING)),\n value: val\n ? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING))\n : EMPTY_STRING\n });\n\n // ;\n match(SEMICOLON_REGEX);\n\n return ret;\n }\n\n /**\n * Parse declarations.\n *\n * @return {Object[]}\n */\n function declarations() {\n var decls = [];\n\n comments(decls);\n\n // declarations\n var decl;\n while ((decl = declaration())) {\n if (decl !== false) {\n decls.push(decl);\n comments(decls);\n }\n }\n\n return decls;\n }\n\n whitespace();\n return declarations();\n};\n\n/**\n * Trim `str`.\n *\n * @param {String} str\n * @return {String}\n */\nfunction trim(str) {\n return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING;\n}\n",null],"names":[],"mappings":";;;;;;;;;;;;;;;;CAAA;CACA;EACA,IAAI,aAAa,GAAG,iCAAiC;;EAErD,IAAI,aAAa,GAAG,KAAK;EACzB,IAAI,gBAAgB,GAAG,MAAM;;CAE7B;EACA,IAAI,cAAc,GAAG,wCAAwC;EAC7D,IAAI,WAAW,GAAG,OAAO;EACzB,IAAI,WAAW,GAAG,sDAAsD;EACxE,IAAI,eAAe,GAAG,SAAS;;CAE/B;EACA,IAAI,UAAU,GAAG,YAAY;;CAE7B;EACA,IAAI,OAAO,GAAG,IAAI;EAClB,IAAI,aAAa,GAAG,GAAG;EACvB,IAAI,QAAQ,GAAG,GAAG;EAClB,IAAI,YAAY,GAAG,EAAE;;CAErB;EACA,IAAI,YAAY,GAAG,SAAS;EAC5B,IAAI,gBAAgB,GAAG,aAAa;;CAEpC;CACA;CACA;CACA;CACA;CACA;CACA;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Aa,CACnC,KAAa,EACb,QAAmB,EAAA;KAEnB,IAAI,WAAW,GAAuB,IAAI;KAE1C,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;CACvC,QAAA,OAAO,WAAW;;CAGpB,IAAA,IAAM,YAAY,GAAG,KAAK,CAAC,KAAK,CAAC;CACjC,IAAA,IAAM,WAAW,GAAG,OAAO,QAAQ,KAAK,UAAU;CAElD,IAAA,YAAY,CAAC,OAAO,CAAC,UAAC,WAAW,EAAA;CAC/B,QAAA,IAAI,WAAW,CAAC,IAAI,KAAK,aAAa,EAAE;aACtC;;SAGM,IAAA,QAAQ,GAAY,WAAW,CAAA,QAAvB,EAAE,KAAK,GAAK,WAAW,CAAA,KAAhB;SAEvB,IAAI,WAAW,EAAE;CACf,YAAA,QAAQ,CAAC,QAAQ,EAAE,KAAK,EAAE,WAAW,CAAC;;cACjC,IAAI,KAAK,EAAE;CAChB,YAAA,WAAW,GAAG,WAAW,IAAI,EAAE;CAC/B,YAAA,WAAW,CAAC,QAAQ,CAAC,GAAG,KAAK;;CAEjC,KAAC,CAAC;CAEF,IAAA,OAAO,WAAW;CACpB;;;;;;;;","x_google_ignoreList":[0]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(n,
|
|
1
|
+
!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(n="undefined"!=typeof globalThis?globalThis:n||self).StyleToObject=r()}(this,(function(){"use strict";function n(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var r,t;var e=n(function(){if(t)return r;t=1;var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,o=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,u=/^:\s*/,c=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,f=/^[;\s]*/,a=/^\s+|\s+$/g,s="";function l(n){return n?n.replace(a,s):s}return r=function(r,t){if("string"!=typeof r)throw new TypeError("First argument must be a string");if(!r)return[];t=t||{};var a=1,p=1;function h(n){var r=n.match(e);r&&(a+=r.length);var t=n.lastIndexOf("\n");p=~t?n.length-t:p+n.length}function v(){var n={line:a,column:p};return function(r){return r.position=new d(n),g(),r}}function d(n){this.start=n,this.end={line:a,column:p},this.source=t.source}function m(n){var e=new Error(t.source+":"+a+":"+p+": "+n);if(e.reason=n,e.filename=t.source,e.line=a,e.column=p,e.source=r,!t.silent)throw e}function y(n){var t=n.exec(r);if(t){var e=t[0];return h(e),r=r.slice(e.length),t}}function g(){y(o)}function w(n){var r;for(n=n||[];r=b();)!1!==r&&n.push(r);return n}function b(){var n=v();if("/"==r.charAt(0)&&"*"==r.charAt(1)){for(var t=2;s!=r.charAt(t)&&("*"!=r.charAt(t)||"/"!=r.charAt(t+1));)++t;if(t+=2,s===r.charAt(t-1))return m("End of comment missing");var e=r.slice(2,t-2);return p+=2,h(e),r=r.slice(t),p+=2,n({type:"comment",comment:e})}}function A(){var r=v(),t=y(i);if(t){if(b(),!y(u))return m("property missing ':'");var e=y(c),o=r({type:"declaration",property:l(t[0].replace(n,s)),value:e?l(e[0].replace(n,s)):s});return y(f),o}}return d.prototype.content=r,g(),function(){var n,r=[];for(w(r);n=A();)!1!==n&&(r.push(n),w(r));return r}()}}());return function(n,r){var t=null;if(!n||"string"!=typeof n)return t;var o=e(n),i="function"==typeof r;return o.forEach((function(n){if("declaration"===n.type){var e=n.property,o=n.value;i?r(e,o,n):o&&((t=t||{})[e]=o)}})),t}}));
|
|
2
2
|
//# sourceMappingURL=style-to-object.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style-to-object.min.js","sources":["../node_modules/inline-style-parser/index.js","../src/index.ts"],"sourcesContent":["// http://www.w3.org/TR/CSS21/grammar.html\n// https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027\nvar COMMENT_REGEX = /\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\//g;\n\nvar NEWLINE_REGEX = /\\n/g;\nvar WHITESPACE_REGEX = /^\\s*/;\n\n// declaration\nvar PROPERTY_REGEX = /^(\\*?[-#/*\\\\\\w]+(\\[[0-9a-z_-]+\\])?)\\s*/;\nvar COLON_REGEX = /^:\\s*/;\nvar VALUE_REGEX = /^((?:'(?:\\\\'|.)*?'|\"(?:\\\\\"|.)*?\"|\\([^)]*?\\)|[^};])+)/;\nvar SEMICOLON_REGEX = /^[;\\s]*/;\n\n// https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill\nvar TRIM_REGEX = /^\\s+|\\s+$/g;\n\n// strings\nvar NEWLINE = '\\n';\nvar FORWARD_SLASH = '/';\nvar ASTERISK = '*';\nvar EMPTY_STRING = '';\n\n// types\nvar TYPE_COMMENT = 'comment';\nvar TYPE_DECLARATION = 'declaration';\n\n/**\n * @param {String} style\n * @param {Object} [options]\n * @return {Object[]}\n * @throws {TypeError}\n * @throws {Error}\n */\nmodule.exports = function (style, options) {\n if (typeof style !== 'string') {\n throw new TypeError('First argument must be a string');\n }\n\n if (!style) return [];\n\n options = options || {};\n\n /**\n * Positional.\n */\n var lineno = 1;\n var column = 1;\n\n /**\n * Update lineno and column based on `str`.\n *\n * @param {String} str\n */\n function updatePosition(str) {\n var lines = str.match(NEWLINE_REGEX);\n if (lines) lineno += lines.length;\n var i = str.lastIndexOf(NEWLINE);\n column = ~i ? str.length - i : column + str.length;\n }\n\n /**\n * Mark position and patch `node.position`.\n *\n * @return {Function}\n */\n function position() {\n var start = { line: lineno, column: column };\n return function (node) {\n node.position = new Position(start);\n whitespace();\n return node;\n };\n }\n\n /**\n * Store position information for a node.\n *\n * @constructor\n * @property {Object} start\n * @property {Object} end\n * @property {undefined|String} source\n */\n function Position(start) {\n this.start = start;\n this.end = { line: lineno, column: column };\n this.source = options.source;\n }\n\n /**\n * Non-enumerable source string.\n */\n Position.prototype.content = style;\n\n var errorsList = [];\n\n /**\n * Error `msg`.\n *\n * @param {String} msg\n * @throws {Error}\n */\n function error(msg) {\n var err = new Error(\n options.source + ':' + lineno + ':' + column + ': ' + msg\n );\n err.reason = msg;\n err.filename = options.source;\n err.line = lineno;\n err.column = column;\n err.source = style;\n\n if (options.silent) {\n errorsList.push(err);\n } else {\n throw err;\n }\n }\n\n /**\n * Match `re` and return captures.\n *\n * @param {RegExp} re\n * @return {undefined|Array}\n */\n function match(re) {\n var m = re.exec(style);\n if (!m) return;\n var str = m[0];\n updatePosition(str);\n style = style.slice(str.length);\n return m;\n }\n\n /**\n * Parse whitespace.\n */\n function whitespace() {\n match(WHITESPACE_REGEX);\n }\n\n /**\n * Parse comments.\n *\n * @param {Object[]} [rules]\n * @return {Object[]}\n */\n function comments(rules) {\n var c;\n rules = rules || [];\n while ((c = comment())) {\n if (c !== false) {\n rules.push(c);\n }\n }\n return rules;\n }\n\n /**\n * Parse comment.\n *\n * @return {Object}\n * @throws {Error}\n */\n function comment() {\n var pos = position();\n if (FORWARD_SLASH != style.charAt(0) || ASTERISK != style.charAt(1)) return;\n\n var i = 2;\n while (\n EMPTY_STRING != style.charAt(i) &&\n (ASTERISK != style.charAt(i) || FORWARD_SLASH != style.charAt(i + 1))\n ) {\n ++i;\n }\n i += 2;\n\n if (EMPTY_STRING === style.charAt(i - 1)) {\n return error('End of comment missing');\n }\n\n var str = style.slice(2, i - 2);\n column += 2;\n updatePosition(str);\n style = style.slice(i);\n column += 2;\n\n return pos({\n type: TYPE_COMMENT,\n comment: str\n });\n }\n\n /**\n * Parse declaration.\n *\n * @return {Object}\n * @throws {Error}\n */\n function declaration() {\n var pos = position();\n\n // prop\n var prop = match(PROPERTY_REGEX);\n if (!prop) return;\n comment();\n\n // :\n if (!match(COLON_REGEX)) return error(\"property missing ':'\");\n\n // val\n var val = match(VALUE_REGEX);\n\n var ret = pos({\n type: TYPE_DECLARATION,\n property: trim(prop[0].replace(COMMENT_REGEX, EMPTY_STRING)),\n value: val\n ? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING))\n : EMPTY_STRING\n });\n\n // ;\n match(SEMICOLON_REGEX);\n\n return ret;\n }\n\n /**\n * Parse declarations.\n *\n * @return {Object[]}\n */\n function declarations() {\n var decls = [];\n\n comments(decls);\n\n // declarations\n var decl;\n while ((decl = declaration())) {\n if (decl !== false) {\n decls.push(decl);\n comments(decls);\n }\n }\n\n return decls;\n }\n\n whitespace();\n return declarations();\n};\n\n/**\n * Trim `str`.\n *\n * @param {String} str\n * @return {String}\n */\nfunction trim(str) {\n return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING;\n}\n",null],"names":["COMMENT_REGEX","NEWLINE_REGEX","WHITESPACE_REGEX","PROPERTY_REGEX","COLON_REGEX","VALUE_REGEX","SEMICOLON_REGEX","TRIM_REGEX","EMPTY_STRING","trim","str","replace","style","options","TypeError","lineno","column","updatePosition","lines","match","length","i","lastIndexOf","position","start","line","node","Position","whitespace","this","end","source","error","msg","err","Error","reason","filename","silent","re","m","exec","slice","comments","rules","c","comment","push","pos","charAt","type","declaration","prop","val","ret","property","value","prototype","content","decl","decls","declarations","iterator","styleObject","parse","hasIterator","forEach"],"mappings":"
|
|
1
|
+
{"version":3,"file":"style-to-object.min.js","sources":["../node_modules/inline-style-parser/index.js","../src/index.ts"],"sourcesContent":["// http://www.w3.org/TR/CSS21/grammar.html\n// https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027\nvar COMMENT_REGEX = /\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\//g;\n\nvar NEWLINE_REGEX = /\\n/g;\nvar WHITESPACE_REGEX = /^\\s*/;\n\n// declaration\nvar PROPERTY_REGEX = /^(\\*?[-#/*\\\\\\w]+(\\[[0-9a-z_-]+\\])?)\\s*/;\nvar COLON_REGEX = /^:\\s*/;\nvar VALUE_REGEX = /^((?:'(?:\\\\'|.)*?'|\"(?:\\\\\"|.)*?\"|\\([^)]*?\\)|[^};])+)/;\nvar SEMICOLON_REGEX = /^[;\\s]*/;\n\n// https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill\nvar TRIM_REGEX = /^\\s+|\\s+$/g;\n\n// strings\nvar NEWLINE = '\\n';\nvar FORWARD_SLASH = '/';\nvar ASTERISK = '*';\nvar EMPTY_STRING = '';\n\n// types\nvar TYPE_COMMENT = 'comment';\nvar TYPE_DECLARATION = 'declaration';\n\n/**\n * @param {String} style\n * @param {Object} [options]\n * @return {Object[]}\n * @throws {TypeError}\n * @throws {Error}\n */\nmodule.exports = function (style, options) {\n if (typeof style !== 'string') {\n throw new TypeError('First argument must be a string');\n }\n\n if (!style) return [];\n\n options = options || {};\n\n /**\n * Positional.\n */\n var lineno = 1;\n var column = 1;\n\n /**\n * Update lineno and column based on `str`.\n *\n * @param {String} str\n */\n function updatePosition(str) {\n var lines = str.match(NEWLINE_REGEX);\n if (lines) lineno += lines.length;\n var i = str.lastIndexOf(NEWLINE);\n column = ~i ? str.length - i : column + str.length;\n }\n\n /**\n * Mark position and patch `node.position`.\n *\n * @return {Function}\n */\n function position() {\n var start = { line: lineno, column: column };\n return function (node) {\n node.position = new Position(start);\n whitespace();\n return node;\n };\n }\n\n /**\n * Store position information for a node.\n *\n * @constructor\n * @property {Object} start\n * @property {Object} end\n * @property {undefined|String} source\n */\n function Position(start) {\n this.start = start;\n this.end = { line: lineno, column: column };\n this.source = options.source;\n }\n\n /**\n * Non-enumerable source string.\n */\n Position.prototype.content = style;\n\n var errorsList = [];\n\n /**\n * Error `msg`.\n *\n * @param {String} msg\n * @throws {Error}\n */\n function error(msg) {\n var err = new Error(\n options.source + ':' + lineno + ':' + column + ': ' + msg\n );\n err.reason = msg;\n err.filename = options.source;\n err.line = lineno;\n err.column = column;\n err.source = style;\n\n if (options.silent) {\n errorsList.push(err);\n } else {\n throw err;\n }\n }\n\n /**\n * Match `re` and return captures.\n *\n * @param {RegExp} re\n * @return {undefined|Array}\n */\n function match(re) {\n var m = re.exec(style);\n if (!m) return;\n var str = m[0];\n updatePosition(str);\n style = style.slice(str.length);\n return m;\n }\n\n /**\n * Parse whitespace.\n */\n function whitespace() {\n match(WHITESPACE_REGEX);\n }\n\n /**\n * Parse comments.\n *\n * @param {Object[]} [rules]\n * @return {Object[]}\n */\n function comments(rules) {\n var c;\n rules = rules || [];\n while ((c = comment())) {\n if (c !== false) {\n rules.push(c);\n }\n }\n return rules;\n }\n\n /**\n * Parse comment.\n *\n * @return {Object}\n * @throws {Error}\n */\n function comment() {\n var pos = position();\n if (FORWARD_SLASH != style.charAt(0) || ASTERISK != style.charAt(1)) return;\n\n var i = 2;\n while (\n EMPTY_STRING != style.charAt(i) &&\n (ASTERISK != style.charAt(i) || FORWARD_SLASH != style.charAt(i + 1))\n ) {\n ++i;\n }\n i += 2;\n\n if (EMPTY_STRING === style.charAt(i - 1)) {\n return error('End of comment missing');\n }\n\n var str = style.slice(2, i - 2);\n column += 2;\n updatePosition(str);\n style = style.slice(i);\n column += 2;\n\n return pos({\n type: TYPE_COMMENT,\n comment: str\n });\n }\n\n /**\n * Parse declaration.\n *\n * @return {Object}\n * @throws {Error}\n */\n function declaration() {\n var pos = position();\n\n // prop\n var prop = match(PROPERTY_REGEX);\n if (!prop) return;\n comment();\n\n // :\n if (!match(COLON_REGEX)) return error(\"property missing ':'\");\n\n // val\n var val = match(VALUE_REGEX);\n\n var ret = pos({\n type: TYPE_DECLARATION,\n property: trim(prop[0].replace(COMMENT_REGEX, EMPTY_STRING)),\n value: val\n ? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING))\n : EMPTY_STRING\n });\n\n // ;\n match(SEMICOLON_REGEX);\n\n return ret;\n }\n\n /**\n * Parse declarations.\n *\n * @return {Object[]}\n */\n function declarations() {\n var decls = [];\n\n comments(decls);\n\n // declarations\n var decl;\n while ((decl = declaration())) {\n if (decl !== false) {\n decls.push(decl);\n comments(decls);\n }\n }\n\n return decls;\n }\n\n whitespace();\n return declarations();\n};\n\n/**\n * Trim `str`.\n *\n * @param {String} str\n * @return {String}\n */\nfunction trim(str) {\n return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING;\n}\n",null],"names":["COMMENT_REGEX","NEWLINE_REGEX","WHITESPACE_REGEX","PROPERTY_REGEX","COLON_REGEX","VALUE_REGEX","SEMICOLON_REGEX","TRIM_REGEX","EMPTY_STRING","trim","str","replace","inlineStyleParser","style","options","TypeError","lineno","column","updatePosition","lines","match","length","i","lastIndexOf","position","start","line","node","Position","whitespace","this","end","source","error","msg","err","Error","reason","filename","silent","re","m","exec","slice","comments","rules","c","comment","push","pos","charAt","type","declaration","prop","val","ret","property","value","prototype","content","decl","decls","declarations","iterator","styleObject","parse","hasIterator","forEach"],"mappings":"+XAEA,IAAIA,EAAgB,kCAEhBC,EAAgB,MAChBC,EAAmB,OAGnBC,EAAiB,yCACjBC,EAAc,QACdC,EAAc,uDACdC,EAAkB,UAGlBC,EAAa,aAMbC,EAAe,GA8OnB,SAASC,EAAKC,GACZ,OAAOA,EAAMA,EAAIC,QAAQJ,EAAYC,GAAgBA,CACvD,QAnOAI,EAAiB,SAAUC,EAAOC,GAChC,GAAqB,iBAAVD,EACT,MAAM,IAAIE,UAAU,mCAGtB,IAAKF,EAAO,MAAO,GAEnBC,EAAUA,GAAW,CAAE,EAKvB,IAAIE,EAAS,EACTC,EAAS,EAOb,SAASC,EAAeR,GACtB,IAAIS,EAAQT,EAAIU,MAAMnB,GAClBkB,IAAOH,GAAUG,EAAME,QAC3B,IAAIC,EAAIZ,EAAIa,YAvCF,MAwCVN,GAAUK,EAAIZ,EAAIW,OAASC,EAAIL,EAASP,EAAIW,MAChD,CAOE,SAASG,IACP,IAAIC,EAAQ,CAAEC,KAAMV,EAAQC,OAAQA,GACpC,OAAO,SAAUU,GAGf,OAFAA,EAAKH,SAAW,IAAII,EAASH,GAC7BI,IACOF,CACR,CACL,CAUE,SAASC,EAASH,GAChBK,KAAKL,MAAQA,EACbK,KAAKC,IAAM,CAAEL,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,GACjB,GAAKkD,EAAL,CAIA,GAHAN,KAGK3B,EAAMhB,GAAc,OAAO6B,EAAM,wBAGtC,IAAIqB,EAAMlC,EAAMf,GAEZkD,EAAMN,EAAI,CACZE,KA7LiB,cA8LjBK,SAAU/C,EAAK4C,EAAK,GAAG1C,QAAQX,EAAeQ,IAC9CiD,MAAOH,EACH7C,EAAK6C,EAAI,GAAG3C,QAAQX,EAAeQ,IACnCA,IAMN,OAFAY,EAAMd,GAECiD,CApBI,CAqBf,CAyBE,OA9JA3B,EAAS8B,UAAUC,QAAU9C,EA6J7BgB,IAjBA,WACE,IAKI+B,EALAC,EAAQ,GAMZ,IAJAjB,EAASiB,GAIDD,EAAOR,MACA,IAATQ,IACFC,EAAMb,KAAKY,GACXhB,EAASiB,IAIb,OAAOA,CACX,CAGSC,EACR,aC7Na,SACZjD,EACAkD,GAEA,IAAIC,EAAkC,KAEtC,IAAKnD,GAA0B,iBAAVA,EACnB,OAAOmD,EAGT,IAAMF,EAAeG,EAAMpD,GACrBqD,EAAkC,mBAAbH,EAiB3B,OAfAD,EAAaK,SAAQ,SAACf,GACpB,GAAyB,gBAArBA,EAAYD,KAAhB,CAIQ,IAAAK,EAAoBJ,EAAWI,SAArBC,EAAUL,EAAWK,MAEnCS,EACFH,EAASP,EAAUC,EAAOL,GACjBK,KACTO,EAAcA,GAAe,CAAE,GACnBR,GAAYC,GAE5B,IAEOO,CACT","x_google_ignoreList":[0]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "style-to-object",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "Parse CSS inline style to JavaScript object.",
|
|
5
5
|
"author": "Mark <mark@remarkablemark.org>",
|
|
6
6
|
"main": "./cjs/index.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"repository": {
|
|
29
29
|
"type": "git",
|
|
30
|
-
"url": "https://github.com/remarkablemark/style-to-object"
|
|
30
|
+
"url": "git+https://github.com/remarkablemark/style-to-object.git"
|
|
31
31
|
},
|
|
32
32
|
"bugs": {
|
|
33
33
|
"url": "https://github.com/remarkablemark/style-to-object/issues"
|
|
@@ -45,31 +45,32 @@
|
|
|
45
45
|
"inline-style-parser": "0.2.4"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@commitlint/cli": "19.
|
|
49
|
-
"@commitlint/config-conventional": "19.
|
|
50
|
-
"@eslint/compat": "1.
|
|
51
|
-
"@eslint/eslintrc": "3.1
|
|
52
|
-
"@eslint/js": "9.
|
|
53
|
-
"@rollup/plugin-commonjs": "
|
|
54
|
-
"@rollup/plugin-node-resolve": "
|
|
48
|
+
"@commitlint/cli": "19.8.1",
|
|
49
|
+
"@commitlint/config-conventional": "19.8.1",
|
|
50
|
+
"@eslint/compat": "1.2.9",
|
|
51
|
+
"@eslint/eslintrc": "3.3.1",
|
|
52
|
+
"@eslint/js": "9.28.0",
|
|
53
|
+
"@rollup/plugin-commonjs": "28.0.3",
|
|
54
|
+
"@rollup/plugin-node-resolve": "16.0.1",
|
|
55
55
|
"@rollup/plugin-terser": "0.4.4",
|
|
56
|
-
"@rollup/plugin-typescript": "
|
|
57
|
-
"@types/jest": "29.5.
|
|
58
|
-
"@types/node": "22.
|
|
59
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
60
|
-
"@typescript-eslint/parser": "8.
|
|
61
|
-
"eslint": "9.
|
|
62
|
-
"eslint-plugin-prettier": "5.
|
|
56
|
+
"@rollup/plugin-typescript": "12.1.2",
|
|
57
|
+
"@types/jest": "29.5.14",
|
|
58
|
+
"@types/node": "22.15.30",
|
|
59
|
+
"@typescript-eslint/eslint-plugin": "8.33.1",
|
|
60
|
+
"@typescript-eslint/parser": "8.33.1",
|
|
61
|
+
"eslint": "9.28.0",
|
|
62
|
+
"eslint-plugin-prettier": "5.4.1",
|
|
63
63
|
"eslint-plugin-simple-import-sort": "12.1.1",
|
|
64
|
-
"globals": "
|
|
65
|
-
"husky": "9.1.
|
|
64
|
+
"globals": "16.2.0",
|
|
65
|
+
"husky": "9.1.7",
|
|
66
66
|
"jest": "29.7.0",
|
|
67
|
-
"lint-staged": "
|
|
67
|
+
"lint-staged": "16.1.0",
|
|
68
68
|
"npm-run-all": "4.1.5",
|
|
69
|
-
"prettier": "3.
|
|
70
|
-
"rollup": "4.
|
|
71
|
-
"ts-jest": "29.
|
|
72
|
-
"
|
|
69
|
+
"prettier": "3.5.3",
|
|
70
|
+
"rollup": "4.42.0",
|
|
71
|
+
"ts-jest": "29.3.4",
|
|
72
|
+
"ts-node": "10.9.2",
|
|
73
|
+
"typescript": "5.8.3"
|
|
73
74
|
},
|
|
74
75
|
"files": [
|
|
75
76
|
"/cjs",
|