Skip to content

Commit 3b25b77

Browse files
authored
Merge pull request #25 from tbela99/v.next
V0.3.0
2 parents b9d459e + 149c89a commit 3b25b77

File tree

171 files changed

+8983
-7445
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

171 files changed

+8983
-7445
lines changed

.github/workflows/node.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,17 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
node-version: [18.x, 20.x, 21.x]
20+
node-version: [ 18.x, 20.x, 21.x ]
2121
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
2222

2323
steps:
24-
- uses: actions/checkout@v3
25-
- name: Use Node.js ${{ matrix.node-version }}
26-
uses: actions/setup-node@v3
27-
with:
28-
node-version: ${{ matrix.node-version }}
29-
- run: npm install
30-
- run: npx playwright install
31-
# - run: npm run build
32-
- run: npm test
24+
- uses: actions/checkout@v3
25+
- name: Use Node.js ${{ matrix.node-version }}
26+
uses: actions/setup-node@v3
27+
with:
28+
node-version: ${{ matrix.node-version }}
29+
- name: Install NPM dependencies
30+
run: npm install
31+
- name: Install playwright dependencies
32+
run: npx playwright install --with-deps
33+
- run: npm test

.npmignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
/tools
88
/ROADMAP.md
99
/CHANGELOG.md
10-
/rollup.config.mjs
10+
/rollup.config.js
1111
/tsconfig.json
1212
/src
1313
/.idea
@@ -16,4 +16,5 @@
1616
/coverage
1717
/.github
1818
/.gitattributes
19-
/Writerside
19+
/Writerside
20+
/validator

CHANGELOG.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
11
# Changelog
22

3+
### V0.3.0
4+
5+
### shorthands
6+
7+
- [x] column-rule
8+
- [x] columns
9+
- [x] container
10+
- [x] flex
11+
- [x] flex-flow
12+
- [x] gap
13+
14+
### Other
15+
- [x] renamed RenderOptions.colorConvert to RenderOptions.convertColor
16+
- [x] support none keyword in color
17+
- [x] css relative color syntax for rgb(), hsl() and hwb() colors https://www.w3.org/TR/css-color-5/#relative-colors
18+
- [x] rgb
19+
- [x] hex
20+
- [x] hsl
21+
- [x] hwb
22+
- [x] calc()
23+
- [x] calc() and inline var()
24+
325
## v0.2.0
426

527
- [x] cancellable parser promise using abortSignal
@@ -9,7 +31,7 @@
931
- [x] at-rule visitor
1032
- [x] support mixing units with calc()
1133

12-
# shorthands
34+
### shorthands
1335

1436
- [x] transition
1537
- [x] list-style

README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ $ npm install @tbela99/css-parser
1818
- generate sourcemap
1919
- compute css shorthands. see the list below
2020
- compute calc() expression
21+
- inline css variables
22+
- relative css colors using rgb(), hsl() and hwb()
2123
- nested css expansion
2224
- remove duplicate properties
2325
- flatten @import rules
@@ -344,6 +346,37 @@ result
344346

345347
```
346348

349+
### Example 5
350+
351+
### CSS variable inlining and relative color
352+
353+
```javascript
354+
355+
import {parse, render} from '@tbela99/css-parser';
356+
357+
const css = `
358+
359+
:root {
360+
--color: green;
361+
}
362+
._19_u :focus {
363+
color: hsl(from var(--color) calc(h * 2) s l);
364+
365+
}
366+
`
367+
368+
const prettyPrint = await parse(css, {inlineCssVariables: true}).then(result => render(result.ast, {minify: false}).code);
369+
370+
```
371+
result
372+
373+
```css
374+
._19_u :focus {
375+
color: navy
376+
}
377+
378+
```
379+
347380
## AST
348381

349382
### Comment
@@ -396,24 +429,53 @@ result
396429
- [x] decode and replace utf-8 escape sequence
397430

398431
## Computed shorthands properties
432+
433+
- ~all~
399434
- [x] animation
400435
- [x] background
401436
- [x] border
437+
- [ ] border-block-end
438+
- [ ] border-block-start
402439
- [x] border-bottom
403440
- [x] border-color
441+
- [ ] border-image
442+
- [ ] border-inline-end
443+
- [ ] border-inline-start
404444
- [x] border-left
405445
- [x] border-radius
406446
- [x] border-right
407447
- [x] border-style
408448
- [x] border-top
409449
- [x] border-width
450+
- [x] column-rule
451+
- [x] columns
452+
- [x] container
453+
- [ ] contain-intrinsic-size
454+
- [x] flex
455+
- [x] flex-flow
410456
- [x] font
457+
- [ ] font-synthesis
458+
- [ ] font-variant
459+
- [x] gap
460+
- [ ] grid
461+
- [ ] grid-area
462+
- [ ] grid-column
463+
- [ ] grid-row
464+
- [ ] grid-template
411465
- [x] inset
412466
- [x] list-style
413467
- [x] margin
468+
- [ ] mask
469+
- [ ] offset
414470
- [x] outline
415471
- [x] overflow
416472
- [x] padding
473+
- [ ] place-content
474+
- [ ] place-items
475+
- [ ] place-self
476+
- [ ] scroll-margin
477+
- [ ] scroll-padding
478+
- [ ] scroll-timeline
417479
- [x] text-decoration
418480
- [x] text-emphasis
419481
- [x] transition

build.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
#!/bin/bash
2-
#
2+
# force export interfaces and types in dist/index.d.ts
33
file="$1"
44
shift
55

66
while [ "$#" -gt 0 ]
77
do
88
sed -i "s/^$1/export $1/g" "$file" 2>/dev/null || sed -i '' "s/^$1/export $1/g" "$file"
99
shift
10-
done
10+
done
11+
# delete extra .d.ts files in dist/ sub directories
12+
find dist/ | grep .d.ts | grep -v dist/index.d.ts | xargs rm

0 commit comments

Comments
 (0)