@tbela99/css-parser 2.1.0 → 2.3.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/CHANGELOG.md +66 -1
- package/README.md +14 -7
- package/architecture.png +0 -0
- package/dist/{src/lib/ast → ast}/arena-node.js +10 -10
- package/dist/{src/lib/ast → ast}/arena.js +304 -139
- package/dist/{src/lib/ast → ast}/cache.js +40 -24
- package/dist/{src/lib/ast → ast}/features/calc.js +11 -9
- package/dist/{src/lib/ast → ast}/features/if.js +6 -6
- package/dist/ast/features/index.d.ts +7 -0
- package/dist/{src/lib/ast → ast}/features/index.js +3 -2
- package/dist/{src/lib/ast → ast}/features/inlinecssvariables.js +12 -10
- package/dist/ast/features/mixin.js +953 -0
- package/dist/{src/lib/ast → ast}/features/prefix.js +39 -39
- package/dist/ast/features/shorthand.js +129 -0
- package/dist/ast/features/transform.js +188 -0
- package/dist/{src/lib/ast → ast}/features/type.js +2 -2
- package/dist/{src/lib/ast → ast}/math/expression.js +24 -24
- package/dist/{src/lib/ast → ast}/math/math.js +2 -2
- package/dist/{src/lib/ast → ast}/minify.js +745 -201
- package/dist/ast/mixins/custom-function.js +393 -0
- package/dist/ast/mixins/utils.js +53 -0
- package/dist/ast/mixins/variables.js +678 -0
- package/dist/ast/strings.js +910 -0
- package/dist/ast/transform/compute.js +560 -0
- package/dist/ast/transform/matrix.js +67 -0
- package/dist/ast/transform/minify.js +325 -0
- package/dist/ast/transform/perspective.js +24 -0
- package/dist/{src/lib/ast → ast}/transform/rotate.js +16 -7
- package/dist/ast/transform/scale.js +43 -0
- package/dist/ast/transform/skew.js +38 -0
- package/dist/ast/transform/translate.js +56 -0
- package/dist/ast/transform/utils.js +390 -0
- package/dist/{src/lib/ast → ast}/types.js +2 -2
- package/dist/{src/lib/ast → ast}/walk.js +2 -2
- package/dist/{src/data → data}/properties.json.js +86 -2
- package/dist/{src/data → data}/validation.json.js +30 -21
- package/dist/{src/lib/fs → fs}/resolve.js +2 -2
- package/dist/index-umd-web.js +19727 -10719
- package/dist/index.d.ts +738 -100
- package/dist/{src/node.js → node.js} +70 -52
- package/dist/{src/lib/parser → parser}/declaration/list.js +25 -8
- package/dist/{src/lib/parser → parser}/declaration/map.js +15 -15
- package/dist/{src/lib/parser → parser}/declaration/set.js +5 -5
- package/dist/{src/lib/parser → parser}/input.js +18 -3
- package/dist/{src/lib/parser → parser}/linesmap.js +2 -2
- package/dist/{src/lib/parser → parser}/parse.js +444 -278
- package/dist/{src/lib/parser → parser}/source.js +3 -3
- package/dist/{src/lib/parser → parser}/tokenize.js +480 -312
- package/dist/{src/lib/parser → parser}/utils/angle.js +3 -3
- package/dist/{src/lib/parser → parser}/utils/at-rule-container.js +12 -12
- package/dist/{src/lib/parser → parser}/utils/at-rule-font-feature-values.js +3 -3
- package/dist/{src/lib/parser → parser}/utils/at-rule-generic.js +7 -7
- package/dist/{src/lib/parser → parser}/utils/at-rule-import.js +10 -10
- package/dist/{src/lib/parser → parser}/utils/at-rule-media.js +14 -14
- package/dist/{src/lib/parser → parser}/utils/at-rule-support.js +9 -14
- package/dist/{src/lib/parser → parser}/utils/at-rule-when-else.js +6 -6
- package/dist/{src/lib/parser → parser}/utils/at-rule.js +3 -3
- package/dist/{src/lib/parser → parser}/utils/base64.js +2 -2
- package/dist/parser/utils/cache.js +53 -0
- package/dist/parser/utils/canonical.js +78 -0
- package/dist/parser/utils/codes.js +93 -0
- package/dist/{src/lib/parser → parser}/utils/config.js +3 -3
- package/dist/{src/lib/parser → parser}/utils/declaration.js +31 -26
- package/dist/{src/lib/parser → parser}/utils/eq.js +2 -2
- package/dist/{src/lib/parser → parser}/utils/hash.js +2 -2
- package/dist/{src/lib/parser → parser}/utils/selector.js +339 -87
- package/dist/{src/lib/parser → parser}/utils/text.js +2 -2
- package/dist/{src/lib/parser → parser}/utils/token.js +2 -2
- package/dist/{src/lib/parser → parser}/utils/type.js +9 -7
- package/dist/{src/lib/printer/sourcemap → printer}/lib/codec.js +2 -2
- package/dist/{src/lib/printer → printer}/render.js +582 -153
- package/dist/printer/result.js +148 -0
- package/dist/{src/lib/printer/sourcemap → printer}/sourcemap.js +4 -3
- package/dist/printer/writer.js +252 -0
- package/dist/{src/lib/syntax → syntax}/color/a98rgb.js +2 -2
- package/dist/{src/lib/syntax → syntax}/color/alpha.js +10 -10
- package/dist/{src/lib/syntax → syntax}/color/cmyk.js +2 -2
- package/dist/{src/lib/syntax → syntax}/color/color-mix.js +18 -18
- package/dist/{src/lib/syntax → syntax}/color/color.js +18 -18
- package/dist/{src/lib/syntax → syntax}/color/hex.js +3 -3
- package/dist/{src/lib/syntax → syntax}/color/hsl.js +2 -2
- package/dist/{src/lib/syntax → syntax}/color/hwb.js +2 -2
- package/dist/{src/lib/syntax → syntax}/color/lab.js +2 -2
- package/dist/{src/lib/syntax → syntax}/color/lch.js +2 -2
- package/dist/{src/lib/syntax → syntax}/color/oklab.js +2 -2
- package/dist/{src/lib/syntax → syntax}/color/oklch.js +3 -3
- package/dist/{src/lib/syntax → syntax}/color/p3.js +2 -2
- package/dist/{src/lib/syntax → syntax}/color/prophotorgb.js +2 -2
- package/dist/{src/lib/syntax → syntax}/color/rec2020.js +2 -2
- package/dist/{src/lib/syntax → syntax}/color/relative-color.js +14 -14
- package/dist/{src/lib/syntax → syntax}/color/rgb.js +4 -4
- package/dist/{src/lib/syntax → syntax}/color/srgb.js +5 -5
- package/dist/{src/lib/syntax → syntax}/color/utils/color-type.js +4 -4
- package/dist/{src/lib/syntax → syntax}/color/utils/colorspace.js +10 -10
- package/dist/{src/lib/syntax → syntax}/color/utils/components.js +5 -5
- package/dist/{src/lib/syntax → syntax}/color/utils/distance.js +2 -2
- package/dist/{src/lib/syntax → syntax}/color/utils/make-color.js +3 -3
- package/dist/{src/lib/syntax → syntax}/color/utils/matrix.js +2 -2
- package/dist/{src/lib/syntax → syntax}/color/xyz.js +2 -2
- package/dist/{src/lib/syntax → syntax}/color/xyzd50.js +2 -2
- package/dist/{src/lib/syntax → syntax}/constants.js +27 -4
- package/dist/{src/lib/syntax → syntax}/syntax.js +37 -29
- package/dist/{src/types.js → types.js} +2 -2
- package/dist/{src/utils → utils}/sync.js +12 -7
- package/dist/validation/compiled/builtins.js +32 -0
- package/dist/validation/compiled/runtime.js +705 -0
- package/dist/validation/compiled/syntaxes.js +1620 -0
- package/dist/{src/lib/validation → validation}/config.js +63 -16
- package/dist/validation/first.js +574 -0
- package/dist/{src/lib/validation → validation}/match.js +376 -161
- package/dist/{src/lib/validation → validation}/parser/parse.js +2 -2
- package/dist/{src/lib/validation → validation}/parser/typedef.js +2 -2
- package/dist/{src/lib/validation → validation}/utils/list.js +3 -19
- package/dist/version.js +13 -0
- package/dist/{src/web.js → web.js} +68 -55
- package/package.json +15 -13
- package/dist/package.json.js +0 -10
- package/dist/src/lib/ast/features/shorthand.js +0 -95
- package/dist/src/lib/ast/features/transform.js +0 -90
- package/dist/src/lib/ast/transform/compute.js +0 -362
- package/dist/src/lib/ast/transform/matrix.js +0 -88
- package/dist/src/lib/ast/transform/minify.js +0 -267
- package/dist/src/lib/ast/transform/perspective.js +0 -16
- package/dist/src/lib/ast/transform/scale.js +0 -39
- package/dist/src/lib/ast/transform/skew.js +0 -30
- package/dist/src/lib/ast/transform/translate.js +0 -39
- package/dist/src/lib/ast/transform/utils.js +0 -287
- package/dist/src/lib/parser/utils/cache.js +0 -54
- package/dist/types.d.ts +0 -21
- package/dist/utils/sync.d.ts +0 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,70 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
# v2.3.0
|
|
4
|
+
|
|
5
|
+
## Performance
|
|
6
|
+
|
|
7
|
+
- [x] validation: the syntaxes of the declarations, the types and the functions are compiled at build time into matchers (`npm run syntax-compile`, src/validation/compiled). a value accepted by a compiled matcher is valid, the other values are validated by the interpreter, which reports the errors. the values that contain `var()` or a custom function call are validated by the interpreter. `npm run syntax-verify` checks the compiled matchers against the interpreter
|
|
8
|
+
- [x] selectors: the validated tokens are written back in place instead of emptying the selector and pushing them again (the backing store of the array was released and allocated again for each selector)
|
|
9
|
+
- [x] validation: the validation contexts read a range of the tokens instead of a copy (`slice()`)
|
|
10
|
+
- [x] selectors: the syntax of a selector function (`:name()`) and the rules allowed in an at-rule are looked up once per name, the names are not concatenated for each selector. `:name` and `::name` are interned without creating a string
|
|
11
|
+
- [x] minifier: the size of the rules compared when they are merged is computed from the memoized sizes of their declarations instead of rendering them
|
|
12
|
+
- [x] render memo: the keys are hashed while they are serialized (one pass)
|
|
13
|
+
|
|
14
|
+
## Feature
|
|
15
|
+
|
|
16
|
+
- [x] update to webref/css syntax v8.7.10
|
|
17
|
+
- [x] syntax: `npm run syntax-update` compiles the syntaxes (`npm run syntax-compile`). a type that is referenced but neither defined nor built in fails the build: a definition renamed or removed upstream is reported (src/data/syntax-report.json)
|
|
18
|
+
- [x] visitors: the events are flags, a handler registered with `{type: WalkerEvent.Enter | WalkerEvent.Leave}` is called when the node is entered and when it is left
|
|
19
|
+
|
|
20
|
+
## Bugs
|
|
21
|
+
|
|
22
|
+
- [x] syntax: @webref/css 8.7.10. `<marker-ref>` (removed upstream, still referenced by `marker`, `marker-start`, `marker-mid`, `marker-end`) is defined by the local patch. an at-rule defined with several forms (`@property … { … } | @property … ;`) keeps the form with a block: `@property` rules were dropped
|
|
23
|
+
- [x] validation: a custom function call (`--fn()`) is validated like `var()`: it may be substituted by any value, the declaration that contains it is no longer reported as not valid. `width: --max-plus-x({ 1px, 7px, 2px }, 3px)` -> no error
|
|
24
|
+
- [x] web: `parse()` and `transform()` called with `{file}` lost the source of the file: the css module names lost the file parts (`[name]`, `[folder]`, `[ext]`, `[path]`), the source maps and the relative urls the file path
|
|
25
|
+
- [x] css modules: the case transform options are flags: they are tested with bitwise operators (`(naming & ModuleCaseTransformEnum.IgnoreCase) == 0`, `getKeyName()`)
|
|
26
|
+
|
|
27
|
+
# v2.2.0
|
|
28
|
+
|
|
29
|
+
## Bugs
|
|
30
|
+
|
|
31
|
+
- [x] minifier: the universal selector was removed before a combinator: `.foo *+.x` became `.foo +.x`, `.a * .b` became `.a .b`, `*|*` became `|*`
|
|
32
|
+
- [x] minifier: the selectors factored with `:is()` lost the descendant combinator: `.foo .a,.foo .b` became `.foo:is(.a,.b)` instead of `.foo :is(.a,.b)`
|
|
33
|
+
- [x] minifier: the declarations of a rule were moved across an `@apply` rule, an empty contents block was removed: `@apply --mixin {}`
|
|
34
|
+
- [x] minifier: the unit of the `initial-value` of `@property` was removed: `initial-value: 0deg` became `initial-value: 0`, which is not a valid `<angle>`
|
|
35
|
+
- [x] minifier: there is no early return in a `@function`: the `result` that precedes the conditional rules is moved after them. `result: 16px; @media (...) { result: 20px }` -> `@media (...) { result: 20px } result: 16px`
|
|
36
|
+
- [x] minifier: the conditional rules of a `@function` were removed when they were placed before the last `result`: they are never removed
|
|
37
|
+
- [x] minifier: the `result` descriptors of a `@function` were only deduplicated with `{validation: true}`: `@function --mypi() { result: 3; result: 3.14; }` -> `@function --mypi(){result:3.14}`
|
|
38
|
+
- [x] an empty `@function` or `@mixin` was removed with `removeEmpty`, and a `@function` with an empty result (`result: ;`) was dropped: they are valid definitions
|
|
39
|
+
- [x] a declaration that is not `!important` no longer overrides a previous `!important` declaration of the same property: `.a{color:red !important;color:blue}` -> `.a{color:red!important}`
|
|
40
|
+
- [x] minifier: the merge of two rules is kept only when the output is smaller (or has the same size and removes a rule). the merge of a rule into a rule that keeps some declarations repeated the selector of that rule: `html{margin:0}body,div,...{margin:0;font:inherit}` became `html,body,div,...{margin:0}body,div,...{font:inherit}`. the minified output
|
|
41
|
+
- [x] minifier: `text-emphasis` declarations threw `Cannot read properties of undefined (reading 'includes')` (`text-emphasis-color` has no keyword)
|
|
42
|
+
- [x] `parse()`, `parseSync()`, `transform()`, `transformSync()` and `render()` no longer modify the options object of the caller: a reused options object kept the source and the code units of the first input, and its validation (sync api) traversed them at every call. the sync api options check only traverses the plain objects and the arrays of `blueprint.css` was larger than the output of the fast mode (`minify: false`)
|
|
43
|
+
|
|
44
|
+
## Feature
|
|
45
|
+
- [x] experimental: evaluate css mixins with `{evaluateMixins: true}`: the `@apply` rules are replaced by the mixin body, the private variables (`@private`, mixin arguments, custom properties of the rule) are substituted https://drafts.csswg.org/css-mixins-1/#mixin-rule
|
|
46
|
+
- [x] minification: `@apply --mixin()` is minified to `@apply --mixin`
|
|
47
|
+
- [x] the evaluated mixins and the mixins that are not referenced are replaced with a comment, they are kept with `{keepMixins: true}`
|
|
48
|
+
- [x] a mixin can be defined in a cascade layer or a conditional group rule that is not nested in a style rule
|
|
49
|
+
- [x] custom functions: a call that is not evaluated makes the declaration, the custom function and the mixin that contain it fail, they are not evaluated
|
|
50
|
+
- [x] custom functions that contain conditional rules (`@media`, `@supports`, `@container`, `@when`, `@else`) are not evaluated
|
|
51
|
+
- [x] mixins and custom functions: a definition located in a rule or an at-rule is only visible inside of it, it hides the definitions with the same name of the outer scopes. a reference that does not see a definition is not evaluated
|
|
52
|
+
- [x] mixins: `@contents` is replaced with a copy of the contents block of the `@apply` rule, or with its default contents. `@result` is supported
|
|
53
|
+
- [x] mixins: the value of a typed argument is computed on the element the mixin is applied to, using a registered custom property (`@property`) when a descendant references it
|
|
54
|
+
- [x] evaluate the custom functions with `{evaluateMixins: true}`: the custom function calls (`--fn(1px)`) are replaced by the result of the function
|
|
55
|
+
- [x] the rules that apply a mixin are not merged
|
|
56
|
+
- [x] mixins and custom functions: a value that is not valid is left as is. a mixin that is not valid is ignored and left as is
|
|
57
|
+
- [x] custom functions: a `@function` rule whose parameters contain the same name more than once is invalid, it is dropped when `{evaluateMixins: true}`. the custom functions see the custom properties of the call site. the css-wide keywords of the local variables: `initial` is the value of the parameter, `inherit` and `unset` the value of the calling context. the invalid declarations are not evaluated
|
|
58
|
+
- [x] shorthand properties `padding-inline`, `padding-block`, `margin-inline` and `margin-block`: `.a{margin-inline-start:auto;margin-inline-end:auto}` -> `.a{margin-inline:auto}`
|
|
59
|
+
- [x] `RenderResult` and `TransformResult` are classes. the generated css is accumulated as UTF-8 bytes in `result.write` (`Uint8Array`), `result.code` is a getter that decodes the bytes once, when it is first read.
|
|
60
|
+
|
|
61
|
+
## Performance
|
|
62
|
+
- [x] avoid temporary strings allocation
|
|
63
|
+
- [x] faster css transform minification
|
|
64
|
+
|
|
65
|
+
## Validation
|
|
66
|
+
- [x] rewrite validation to reduce execution time
|
|
67
|
+
|
|
3
68
|
# v2.1.0
|
|
4
69
|
|
|
5
70
|
## Bugs
|
|
@@ -11,7 +76,7 @@
|
|
|
11
76
|
## Feature
|
|
12
77
|
|
|
13
78
|
- [x] now accepting arraybuffer as input data: transformSync(arraybuffer);
|
|
14
|
-
- [
|
|
79
|
+
- [ ] renamed 'word-wrap' to 'overflow-wrap', 'grid-gap' to 'gap', 'grid-row-gap' to 'row-gap', 'grid-column-gap' to 'column-gap', 'font-stretch' to 'font-width'.
|
|
15
80
|
|
|
16
81
|
## Validation
|
|
17
82
|
- [x] switching syntax definitions source from mdn-data to webref/css
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ A zero-allocation, high-performance CSS processing engine for Node.js and the br
|
|
|
9
9
|
Every stylesheet is fully parsed into a structured AST, with token values represented as typed data. This provides a reliable semantic foundation for custom transformations, plugin development, and advanced stylesheet analysis without relying on raw string manipulation.
|
|
10
10
|
|
|
11
11
|
> [!NOTE]
|
|
12
|
-
> Version 2.0 has been rewritten to use arena memory for AST nodes and tokens, improving memory usage and performance. On the Tailwind CSS parsing and validation workload, runtime is
|
|
12
|
+
> Version 2.2.0 has been rewritten to use arena memory for AST nodes and tokens, improving memory usage and performance. On the Tailwind CSS parsing and validation workload, runtime is **59% faster than v1.8.2** while using less memory.<br>
|
|
13
13
|
This major release also introduces breaking changes and removes deprecated features. See the [migration guide](https://tbela99.github.io/css-parser/docs/documents/Guide.Migration.html) for details.
|
|
14
14
|
|
|
15
15
|
## Installation
|
|
@@ -30,7 +30,7 @@ $ deno add @tbela99/css-parser
|
|
|
30
30
|
|
|
31
31
|
* **Zero dependencies** — lightweight and easy to integrate into any project.
|
|
32
32
|
* **All-in-one CSS parsing solution** covering parsing, validation, transformation, minification, and AST manipulation.
|
|
33
|
-
* **Standards-based CSS validation** powered by
|
|
33
|
+
* **Standards-based CSS validation** powered by the W3C specification definitions ([@webref/css](https://github.com/w3c/webref/tree/main/packages/css)).
|
|
34
34
|
* **Full CSS Modules support** for modern component-based workflows.
|
|
35
35
|
* **Fault-tolerant parsing** that follows the CSS Syntax Module Level 3 specification and always produces a complete, structured parse result.
|
|
36
36
|
* **Typed tokens and AST** — parsed CSS is exposed as strongly typed tokens and nodes so plugins and transforms can operate on semantic structures.
|
|
@@ -45,7 +45,9 @@ $ deno add @tbela99/css-parser
|
|
|
45
45
|
* **CSS variable inlining** where values can be safely resolved.
|
|
46
46
|
* **Duplicate declaration removal** to eliminate redundant rules.
|
|
47
47
|
* **`@import` flattening** to produce self-contained stylesheets.
|
|
48
|
+
* **Vendor prefix cleanup** to modernize generated CSS.
|
|
48
49
|
* **Binary input** — the css can be a string, an `ArrayBuffer` or an `ArrayBufferView` (utf-8 bytes, `Uint8Array`, `Buffer`): an ASCII buffer is tokenized without copy.
|
|
50
|
+
* **Experimental**: evaluate @mixin and @function
|
|
49
51
|
* **51.5kb** once minified and gzipped.
|
|
50
52
|
|
|
51
53
|
## Vendor prefix removal
|
|
@@ -55,6 +57,7 @@ $ deno add @tbela99/css-parser
|
|
|
55
57
|
CSS-Parser can transform these modern CSS features into lower-level CSS syntax:
|
|
56
58
|
* **Nested CSS transpilation** to legacy-compatible syntax.
|
|
57
59
|
* **`if()` function transpilation** for broader browser compatibility.
|
|
60
|
+
* **CSS mixins and custom functions evaluation** the `@apply` rules are replaced by the mixin body, the custom function calls are replaced by their result.
|
|
58
61
|
* **`color-mix()` function conversion** convert new color-mix() syntax to any of the supported colors.
|
|
59
62
|
|
|
60
63
|
## Benchmark
|
|
@@ -67,9 +70,9 @@ A sample result:
|
|
|
67
70
|
|
|
68
71
|
| File | ligthningcss | CSS Parser |
|
|
69
72
|
| ------------------------------ | ------------- | ------------- |
|
|
70
|
-
| tailwind.css - 2380419 bytes | 1864728 bytes |
|
|
71
|
-
| bootstrap-4.css - 200078 bytes | 153616 bytes |
|
|
72
|
-
| bootstrap-5.css - 205481 bytes | 159987 bytes |
|
|
73
|
+
| tailwind.css - 2380419 bytes | 1864728 bytes | 1624148 bytes |
|
|
74
|
+
| bootstrap-4.css - 200078 bytes | 153616 bytes | 144391 bytes |
|
|
75
|
+
| bootstrap-5.css - 205481 bytes | 159987 bytes | 150764 bytes |
|
|
73
76
|
|
|
74
77
|
On the [complete benchmark suite](https://tbela99.github.io/css-parser/benchmark/index.html), css-parser generated a total output size of 2,158,698 bytes, compared to 2,494,113 bytes for Lightning CSS and larger outputs for all other tested minifiers.
|
|
75
78
|
While some tools prioritize raw execution speed, css-parser focuses on maximizing compression while preserving stylesheet semantics, resulting in consistently smaller production bundles.
|
|
@@ -114,8 +117,8 @@ Performance vs execution speed comparison
|
|
|
114
117
|
| File: tailwind.css | Speed optimization | Minification optimization |
|
|
115
118
|
| --------------------- | ------------------ | ------------------------- |
|
|
116
119
|
| Size: 2,380,419 bytes | 1,890,835 bytes | 1,633,188 bytes |
|
|
117
|
-
| Time |
|
|
118
|
-
| Size reduction | -20.
|
|
120
|
+
| Time | 109.07 ms | 191.85 ms |
|
|
121
|
+
| Size reduction | -20.7% | -31.8% |
|
|
119
122
|
|
|
120
123
|
## Playground
|
|
121
124
|
|
|
@@ -321,11 +324,15 @@ See [Ast Manipulation](https://tbela99.github.io/css-parser/docs/documents/Guide
|
|
|
321
324
|
- [x] inset
|
|
322
325
|
- [x] list-style
|
|
323
326
|
- [x] margin
|
|
327
|
+
- [x] margin-block
|
|
328
|
+
- [x] margin-inline
|
|
324
329
|
- [ ] mask
|
|
325
330
|
- [ ] offset
|
|
326
331
|
- [x] outline
|
|
327
332
|
- [x] overflow
|
|
328
333
|
- [x] padding
|
|
334
|
+
- [x] padding-block
|
|
335
|
+
- [x] padding-inline
|
|
329
336
|
- [ ] place-content
|
|
330
337
|
- [ ] place-items
|
|
331
338
|
- [ ] place-self
|
package/architecture.png
CHANGED
|
Binary file
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*
|
|
2
|
-
CSS parser, minifier and validator for node and the browser
|
|
2
|
+
CSS parser, minifier and validator for node, deno, bun and the browser
|
|
3
3
|
|
|
4
4
|
Author(s): Thierry Bela
|
|
5
|
-
Version: 2.
|
|
5
|
+
Version: 2.3.0
|
|
6
6
|
License: MIT
|
|
7
7
|
*/
|
|
8
8
|
import { EnumToken, EnumAstNodeStatus, ColorType } from './types.js';
|
|
@@ -153,10 +153,10 @@ class AstArenaNode {
|
|
|
153
153
|
const typ = arena.dataTypes[id];
|
|
154
154
|
if (isNodeObjectType(typ)) {
|
|
155
155
|
return typ === EnumToken.AtRuleNodeType || typ === EnumToken.KeyframesAtRuleNodeType || hasValueTokens(typ)
|
|
156
|
-
? arena.
|
|
156
|
+
? arena.resolveString(arena.name[id])
|
|
157
157
|
: undefined;
|
|
158
158
|
}
|
|
159
|
-
return arena.name[id] === 0 ? undefined : arena.
|
|
159
|
+
return arena.name[id] === 0 ? undefined : arena.resolveString(arena.name[id]);
|
|
160
160
|
}
|
|
161
161
|
/**
|
|
162
162
|
*
|
|
@@ -173,7 +173,7 @@ class AstArenaNode {
|
|
|
173
173
|
const id = this[ARENAID];
|
|
174
174
|
const typ = arena.dataTypes[id];
|
|
175
175
|
return typ === EnumToken.RuleNodeType || typ === EnumToken.KeyframesRuleNodeType
|
|
176
|
-
? arena.
|
|
176
|
+
? arena.resolveString(arena.name[id])
|
|
177
177
|
: undefined;
|
|
178
178
|
}
|
|
179
179
|
/**
|
|
@@ -204,7 +204,7 @@ class AstArenaNode {
|
|
|
204
204
|
typ === EnumToken.RuleNodeType ||
|
|
205
205
|
typ === EnumToken.KeyframesRuleNodeType
|
|
206
206
|
? undefined
|
|
207
|
-
: arena.
|
|
207
|
+
: arena.resolveString(arena.stringValue[id]);
|
|
208
208
|
}
|
|
209
209
|
if (typ === EnumToken.BinaryExpressionTokenType || typ === EnumToken.FractionTokenType) {
|
|
210
210
|
return undefined;
|
|
@@ -221,7 +221,7 @@ class AstArenaNode {
|
|
|
221
221
|
return field;
|
|
222
222
|
}
|
|
223
223
|
return arena.stringValue[id] !== 0 || typ === EnumToken.IdenTokenType || typ === EnumToken.StringTokenType
|
|
224
|
-
? arena.
|
|
224
|
+
? arena.resolveString(arena.stringValue[id])
|
|
225
225
|
: undefined;
|
|
226
226
|
}
|
|
227
227
|
/**
|
|
@@ -331,7 +331,7 @@ class AstArenaNode {
|
|
|
331
331
|
const typ = arena.dataTypes[id];
|
|
332
332
|
return arena.unit[id] === 0 || typ === EnumToken.ColorTokenType || typ === EnumToken.MatchExpressionTokenType
|
|
333
333
|
? undefined
|
|
334
|
-
: arena.
|
|
334
|
+
: arena.resolveString(arena.unit[id]);
|
|
335
335
|
}
|
|
336
336
|
/**
|
|
337
337
|
*
|
|
@@ -348,7 +348,7 @@ class AstArenaNode {
|
|
|
348
348
|
const id = this[ARENAID];
|
|
349
349
|
return arena.unit[id] === 0 || arena.dataTypes[id] !== EnumToken.ColorTokenType
|
|
350
350
|
? undefined
|
|
351
|
-
: arena.
|
|
351
|
+
: arena.resolveString(arena.unit[id]);
|
|
352
352
|
}
|
|
353
353
|
set cal(cal) {
|
|
354
354
|
this[ARENA].setUnitString(this[ARENAID], cal ?? null);
|
|
@@ -361,7 +361,7 @@ class AstArenaNode {
|
|
|
361
361
|
const id = this[ARENAID];
|
|
362
362
|
return arena.unit[id] === 0 || arena.dataTypes[id] !== EnumToken.MatchExpressionTokenType
|
|
363
363
|
? undefined
|
|
364
|
-
: arena.
|
|
364
|
+
: arena.resolveString(arena.unit[id]);
|
|
365
365
|
}
|
|
366
366
|
set attr(attr) {
|
|
367
367
|
this[ARENA].setUnitString(this[ARENAID], attr ?? null);
|