iobroker.mywebui 1.37.21 → 1.37.22

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.
Files changed (29) hide show
  1. package/io-package.json +1 -1
  2. package/package.json +1 -1
  3. package/www/node_modules/@node-projects/css-parser/LICENSE +11 -0
  4. package/www/node_modules/@node-projects/css-parser/README.md +161 -0
  5. package/www/node_modules/@node-projects/css-parser/dist/CssParseError.d.ts +8 -0
  6. package/www/node_modules/@node-projects/css-parser/dist/CssParseError.js +15 -0
  7. package/www/node_modules/@node-projects/css-parser/dist/CssPosition.d.ts +25 -0
  8. package/www/node_modules/@node-projects/css-parser/dist/CssPosition.js +13 -0
  9. package/www/node_modules/@node-projects/css-parser/dist/index-min.js +56 -0
  10. package/www/node_modules/@node-projects/css-parser/dist/index-min.js.map +7 -0
  11. package/www/node_modules/@node-projects/css-parser/dist/index.d.ts +12 -0
  12. package/www/node_modules/@node-projects/css-parser/dist/index.js +8 -0
  13. package/www/node_modules/@node-projects/css-parser/dist/parse/index.d.ts +8 -0
  14. package/www/node_modules/@node-projects/css-parser/dist/parse/index.js +1293 -0
  15. package/www/node_modules/@node-projects/css-parser/dist/parse/lexer.d.ts +118 -0
  16. package/www/node_modules/@node-projects/css-parser/dist/parse/lexer.js +248 -0
  17. package/www/node_modules/@node-projects/css-parser/dist/stringify/compiler.d.ts +172 -0
  18. package/www/node_modules/@node-projects/css-parser/dist/stringify/compiler.js +732 -0
  19. package/www/node_modules/@node-projects/css-parser/dist/stringify/index.d.ts +5 -0
  20. package/www/node_modules/@node-projects/css-parser/dist/stringify/index.js +5 -0
  21. package/www/node_modules/@node-projects/css-parser/dist/type.d.ts +205 -0
  22. package/www/node_modules/@node-projects/css-parser/dist/type.js +31 -0
  23. package/www/node_modules/@node-projects/css-parser/dist/utils/stringSearch.d.ts +53 -0
  24. package/www/node_modules/@node-projects/css-parser/dist/utils/stringSearch.js +166 -0
  25. package/www/node_modules/@node-projects/css-parser/docs/API.md +362 -0
  26. package/www/node_modules/@node-projects/css-parser/docs/AST.md +417 -0
  27. package/www/node_modules/@node-projects/css-parser/docs/CHANGELOG.md +205 -0
  28. package/www/node_modules/@node-projects/css-parser/docs/EXAMPLES.md +497 -0
  29. package/www/node_modules/@node-projects/css-parser/package.json +66 -0
@@ -0,0 +1,497 @@
1
+ # Usage Examples
2
+
3
+ ## Basic Usage
4
+
5
+ ### Parsing CSS
6
+
7
+ ```javascript
8
+ import { parse } from '@adobe/css-tools';
9
+
10
+ // Basic CSS parsing
11
+ const css = `
12
+ body {
13
+ font-size: 12px;
14
+ color: #333;
15
+ }
16
+
17
+ .container {
18
+ max-width: 1200px;
19
+ margin: 0 auto;
20
+ }
21
+ `;
22
+
23
+ const ast = parse(css);
24
+ console.log(ast);
25
+ ```
26
+
27
+ ### Stringifying AST
28
+
29
+ ```javascript
30
+ import { parse, stringify } from '@adobe/css-tools';
31
+
32
+ const css = 'body { font-size: 12px; color: #333; }';
33
+ const ast = parse(css);
34
+
35
+ // Convert back to CSS
36
+ const output = stringify(ast);
37
+ console.log(output); // "body { font-size: 12px; color: #333; }"
38
+ ```
39
+
40
+ ## Advanced Parsing Options
41
+
42
+ ### Source Tracking
43
+
44
+ ```javascript
45
+ import { parse } from '@adobe/css-tools';
46
+
47
+ const css = 'body { color: red; }';
48
+ const ast = parse(css, { source: 'styles.css' });
49
+
50
+ // Position information is available
51
+ const rule = ast.stylesheet.rules[0];
52
+ console.log(rule.position?.source); // "styles.css"
53
+ console.log(rule.position?.start); // { line: 1, column: 1 }
54
+ console.log(rule.position?.end); // { line: 1, column: 20 }
55
+ ```
56
+
57
+ ### Silent Error Handling
58
+
59
+ ```javascript
60
+ import { parse } from '@adobe/css-tools';
61
+
62
+ const malformedCss = `
63
+ body { color: red; }
64
+ { color: blue; } /* Missing selector */
65
+ .valid { background: green; }
66
+ `;
67
+
68
+ // Parse with silent error handling
69
+ const result = parse(malformedCss, { silent: true });
70
+
71
+ // Check for parsing errors
72
+ if (result.stylesheet.parsingErrors) {
73
+ console.log('Parsing errors:', result.stylesheet.parsingErrors.length);
74
+ result.stylesheet.parsingErrors.forEach(error => {
75
+ console.log(`Error at line ${error.line}: ${error.message}`);
76
+ });
77
+ }
78
+
79
+ // Valid rules are still parsed
80
+ console.log('Valid rules:', result.stylesheet.rules.length);
81
+ ```
82
+
83
+ ## AST Structure Examples
84
+
85
+ ### Basic Rule
86
+
87
+ ```javascript
88
+ import { parse } from '@adobe/css-tools';
89
+
90
+ const css = `
91
+ .header {
92
+ background: #f0f0f0;
93
+ padding: 20px;
94
+ border-bottom: 1px solid #ccc;
95
+ }
96
+ `;
97
+
98
+ const ast = parse(css);
99
+ const rule = ast.stylesheet.rules[0];
100
+
101
+ console.log(rule.type); // "rule"
102
+ console.log(rule.selectors); // [".header"]
103
+ console.log(rule.declarations.length); // 3
104
+
105
+ rule.declarations.forEach(decl => {
106
+ console.log(`${decl.property}: ${decl.value}`);
107
+ });
108
+ // Output:
109
+ // background: #f0f0f0
110
+ // padding: 20px
111
+ // border-bottom: 1px solid #ccc
112
+ ```
113
+
114
+ ### Media Queries
115
+
116
+ ```javascript
117
+ import { parse } from '@adobe/css-tools';
118
+
119
+ const css = `
120
+ @media screen and (max-width: 768px) {
121
+ .container {
122
+ padding: 10px;
123
+ }
124
+
125
+ .sidebar {
126
+ display: none;
127
+ }
128
+ }
129
+ `;
130
+
131
+ const ast = parse(css);
132
+ const mediaRule = ast.stylesheet.rules[0];
133
+
134
+ console.log(mediaRule.type); // "media"
135
+ console.log(mediaRule.media); // "screen and (max-width: 768px)"
136
+ console.log(mediaRule.rules.length); // 2
137
+ ```
138
+
139
+ ### Keyframes
140
+
141
+ ```javascript
142
+ import { parse } from '@adobe/css-tools';
143
+
144
+ const css = `
145
+ @keyframes fadeIn {
146
+ from {
147
+ opacity: 0;
148
+ }
149
+ to {
150
+ opacity: 1;
151
+ }
152
+ }
153
+ `;
154
+
155
+ const ast = parse(css);
156
+ const keyframesRule = ast.stylesheet.rules[0];
157
+
158
+ console.log(keyframesRule.type); // "keyframes"
159
+ console.log(keyframesRule.name); // "fadeIn"
160
+ console.log(keyframesRule.keyframes.length); // 2
161
+
162
+ keyframesRule.keyframes.forEach(keyframe => {
163
+ console.log(`Keyframe: ${keyframe.values.join(', ')}`);
164
+ keyframe.declarations.forEach(decl => {
165
+ console.log(` ${decl.property}: ${decl.value}`);
166
+ });
167
+ });
168
+ ```
169
+
170
+ ### Comments
171
+
172
+ ```javascript
173
+ import { parse } from '@adobe/css-tools';
174
+
175
+ const css = `
176
+ /* Header styles */
177
+ .header {
178
+ background: red; /* Fallback color */
179
+ }
180
+
181
+ /* Footer styles */
182
+ .footer {
183
+ background: blue;
184
+ }
185
+ `;
186
+
187
+ const ast = parse(css);
188
+
189
+ ast.stylesheet.rules.forEach(rule => {
190
+ if (rule.type === 'comment') {
191
+ console.log(`Comment: ${rule.comment}`);
192
+ } else if (rule.type === 'rule') {
193
+ console.log(`Rule: ${rule.selectors.join(', ')}`);
194
+
195
+ rule.declarations.forEach(decl => {
196
+ if (decl.type === 'comment') {
197
+ console.log(` Comment: ${decl.comment}`);
198
+ } else {
199
+ console.log(` ${decl.property}: ${decl.value}`);
200
+ }
201
+ });
202
+ }
203
+ });
204
+ ```
205
+
206
+ ## Stringifying Options
207
+
208
+ ### Compressed Output
209
+
210
+ ```javascript
211
+ import { parse, stringify } from '@adobe/css-tools';
212
+
213
+ const css = `
214
+ body {
215
+ font-size: 12px;
216
+ color: #333;
217
+ margin: 0;
218
+ padding: 0;
219
+ }
220
+ `;
221
+
222
+ const ast = parse(css);
223
+
224
+ // Compressed output
225
+ const compressed = stringify(ast, { compress: true });
226
+ console.log(compressed);
227
+ // Output: "body{font-size:12px;color:#333;margin:0;padding:0}"
228
+ ```
229
+
230
+ ### Custom Indentation
231
+
232
+ ```javascript
233
+ import { parse, stringify } from '@adobe/css-tools';
234
+
235
+ const css = 'body { font-size: 12px; color: #333; }';
236
+ const ast = parse(css);
237
+
238
+ // Custom indentation
239
+ const formatted = stringify(ast, { indent: ' ' });
240
+ console.log(formatted);
241
+ // Output:
242
+ // body {
243
+ // font-size: 12px;
244
+ // color: #333;
245
+ // }
246
+ ```
247
+
248
+ ### Identity Round-Trip
249
+
250
+ Reproduce the original CSS exactly as it was written, preserving all whitespace,
251
+ comments, and formatting:
252
+
253
+ ```javascript
254
+ import { parse, stringify } from '@adobe/css-tools';
255
+
256
+ const css = `body {
257
+ font-size: 12px;
258
+ color: #333;
259
+ }`;
260
+
261
+ // Parse with preserveFormatting to store original source
262
+ const ast = parse(css, { preserveFormatting: true });
263
+
264
+ // Stringify with identity mode
265
+ const output = stringify(ast, { identity: true });
266
+ console.log(output === css); // true — exact round-trip
267
+ ```
268
+
269
+ ### Removing Empty Rules
270
+
271
+ ```javascript
272
+ import { parse, stringify } from '@adobe/css-tools';
273
+
274
+ const css = `
275
+ .unused {}
276
+ .active { color: red; }
277
+ `;
278
+
279
+ const ast = parse(css);
280
+
281
+ // Remove empty rules in beautified output
282
+ const output = stringify(ast, { removeEmptyRules: true });
283
+ console.log(output);
284
+ // Output:
285
+ // .active {
286
+ // color: red;
287
+ // }
288
+
289
+ // Also works with compressed mode
290
+ const compressed = stringify(ast, { compress: true, removeEmptyRules: true });
291
+ console.log(compressed);
292
+ // Output: .active{color:red;}
293
+ ```
294
+
295
+ ## Working with Complex CSS
296
+
297
+ ### Nested Rules and At-Rules
298
+
299
+ ```javascript
300
+ import { parse, stringify } from '@adobe/css-tools';
301
+
302
+ const complexCss = `
303
+ @import url('https://fonts.googleapis.com/css2?family=Roboto');
304
+
305
+ @charset "UTF-8";
306
+
307
+ @media print {
308
+ body {
309
+ font-size: 12pt;
310
+ }
311
+ }
312
+
313
+ @supports (display: grid) {
314
+ .grid {
315
+ display: grid;
316
+ }
317
+ }
318
+
319
+ @keyframes slideIn {
320
+ 0% { transform: translateX(-100%); }
321
+ 100% { transform: translateX(0); }
322
+ }
323
+
324
+ @font-face {
325
+ font-family: 'CustomFont';
326
+ src: url('custom-font.woff2') format('woff2');
327
+ }
328
+ `;
329
+
330
+ const ast = parse(complexCss);
331
+
332
+ ast.stylesheet.rules.forEach(rule => {
333
+ switch (rule.type) {
334
+ case 'import':
335
+ console.log(`Import: ${rule.import}`);
336
+ break;
337
+ case 'charset':
338
+ console.log(`Charset: ${rule.charset}`);
339
+ break;
340
+ case 'media':
341
+ console.log(`Media query: ${rule.media}`);
342
+ break;
343
+ case 'supports':
344
+ console.log(`Supports: ${rule.supports}`);
345
+ break;
346
+ case 'keyframes':
347
+ console.log(`Keyframes: ${rule.name}`);
348
+ break;
349
+ case 'font-face':
350
+ console.log('Font-face rule');
351
+ break;
352
+ }
353
+ });
354
+ ```
355
+
356
+ ### Manipulating the AST
357
+
358
+ ```javascript
359
+ import { parse, stringify } from '@adobe/css-tools';
360
+
361
+ const css = `
362
+ .button {
363
+ background: blue;
364
+ color: white;
365
+ padding: 10px;
366
+ }
367
+ `;
368
+
369
+ const ast = parse(css);
370
+ const rule = ast.stylesheet.rules[0];
371
+
372
+ // Add a new declaration
373
+ rule.declarations.push({
374
+ type: 'declaration',
375
+ property: 'border-radius',
376
+ value: '5px'
377
+ });
378
+
379
+ // Modify existing declaration
380
+ const backgroundDecl = rule.declarations.find(d => d.property === 'background');
381
+ if (backgroundDecl) {
382
+ backgroundDecl.value = 'red';
383
+ }
384
+
385
+ // Add a new selector
386
+ rule.selectors.push('.btn');
387
+
388
+ const modifiedCss = stringify(ast);
389
+ console.log(modifiedCss);
390
+ ```
391
+
392
+ ## Error Handling
393
+
394
+ ### Catching Parse Errors
395
+
396
+ ```javascript
397
+ import { parse, CssParseError } from '@adobe/css-tools';
398
+
399
+ try {
400
+ const ast = parse('body { color: red; } { invalid }');
401
+ } catch (error) {
402
+ if (error instanceof CssParseError) {
403
+ console.log(`Parse error at line ${error.line}, column ${error.column}:`);
404
+ console.log(error.message);
405
+ console.log(`Source: ${error.filename}`);
406
+ }
407
+ }
408
+ ```
409
+
410
+ ### Working with Silent Errors
411
+
412
+ ```javascript
413
+ import { parse } from '@adobe/css-tools';
414
+
415
+ const problematicCss = `
416
+ body { color: red; }
417
+ { color: blue; } /* Missing selector */
418
+ .valid { background: green; }
419
+ .another { border: 1px solid; } /* Missing closing brace */
420
+ `;
421
+
422
+ const result = parse(problematicCss, {
423
+ silent: true,
424
+ source: 'problematic.css'
425
+ });
426
+
427
+ // Process valid rules
428
+ const validRules = result.stylesheet.rules.filter(rule => rule.type === 'rule');
429
+ console.log(`Found ${validRules.length} valid rules`);
430
+
431
+ // Log errors for debugging
432
+ if (result.stylesheet.parsingErrors) {
433
+ result.stylesheet.parsingErrors.forEach(error => {
434
+ console.log(`Error: ${error.message} at line ${error.line}`);
435
+ });
436
+ }
437
+ ```
438
+
439
+ ### CSS Minification
440
+
441
+ ```javascript
442
+ import { parse, stringify } from '@adobe/css-tools';
443
+
444
+ function minifyCSS(css) {
445
+ const ast = parse(css);
446
+ return stringify(ast, { compress: true });
447
+ }
448
+
449
+ const css = `
450
+ body {
451
+ font-size: 12px;
452
+ color: #333;
453
+ margin: 0;
454
+ padding: 0;
455
+ }
456
+
457
+ .container {
458
+ max-width: 1200px;
459
+ margin: 0 auto;
460
+ }
461
+ `;
462
+
463
+ const minified = minifyCSS(css);
464
+ console.log(minified);
465
+ // Output: "body{font-size:12px;color:#333;margin:0;padding:0}.container{max-width:1200px;margin:0 auto}"
466
+ ```
467
+
468
+ ### CSS Validation
469
+
470
+ ```javascript
471
+ import { parse } from '@adobe/css-tools';
472
+
473
+ function validateCSS(css, filename = 'unknown') {
474
+ try {
475
+ const ast = parse(css, { source: filename });
476
+ return {
477
+ valid: true,
478
+ rules: ast.stylesheet.rules.length,
479
+ errors: []
480
+ };
481
+ } catch (error) {
482
+ return {
483
+ valid: false,
484
+ rules: 0,
485
+ errors: [{
486
+ message: error.message,
487
+ line: error.line,
488
+ column: error.column,
489
+ source: error.filename
490
+ }]
491
+ };
492
+ }
493
+ }
494
+
495
+ const result = validateCSS('body { color: red; } { invalid }', 'test.css');
496
+ console.log(result);
497
+ ```
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "@node-projects/css-parser",
3
+ "version": "5.2.0",
4
+ "description": "A modern CSS parser and stringifier with TypeScript support",
5
+ "source": "./src/index.ts",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "sideEffects": false,
9
+ "types": "./dist/index.d.ts",
10
+ "type": "module",
11
+ "files": [
12
+ "dist",
13
+ "README.md",
14
+ "docs/"
15
+ ],
16
+ "devDependencies": {
17
+ "@biomejs/biome": "^2.4.7",
18
+ "@types/benchmark": "^2.1.5",
19
+ "@types/bytes": "^3.1.5",
20
+ "@types/jest": "^30.0.0",
21
+ "@types/node": "^25.5.0",
22
+ "benchmark": "^2.1.4",
23
+ "bytes": "^3.1.2",
24
+ "esbuild": "^0.27.4",
25
+ "jest": "^30.3.0",
26
+ "ts-jest": "^29.4.6",
27
+ "tslib": "^2.8.1",
28
+ "typescript": "^5.9.3"
29
+ },
30
+ "scripts": {
31
+ "benchmark": "npm run build && node benchmark/index.mjs",
32
+ "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
33
+ "clean": "rm -rf ./dist",
34
+ "fix": "biome check --write",
35
+ "lint": "biome check",
36
+ "posttest": "npm run lint",
37
+ "prebuild": "npm run clean",
38
+ "build": "tsc",
39
+ "bundle": "esbuild ./dist/index.js --format=esm --minify --sourcemap --platform=neutral --bundle --outfile=./dist/index-min.js",
40
+ "postbuild": "npm run bundle"
41
+ },
42
+ "author": "TJ Holowaychuk <tj@vision-media.ca>",
43
+ "contributors": [
44
+ "Jochen Kühner <jochen.kuhner@gmx.de>",
45
+ "Jean-Philippe Zolesio <holblin@gmail.com>"
46
+ ],
47
+ "license": "MIT",
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "https://github.com/node-projects/css-parser.git"
51
+ },
52
+ "keywords": [
53
+ "css",
54
+ "parser",
55
+ "stringifier",
56
+ "stylesheet",
57
+ "ast",
58
+ "typescript",
59
+ "css-parser",
60
+ "css-ast",
61
+ "css-tools",
62
+ "minify",
63
+ "format",
64
+ "preprocessor"
65
+ ]
66
+ }