Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: sync with vercel/satory (v0.10.3) #3

Merged
merged 55 commits into from
Apr 26, 2024

Conversation

sahithyandev
Copy link
Owner

No description provided.

Jackie1210 and others added 30 commits April 12, 2023 15:37
Addresses #203 by placing a check on absolute url patterns by checking
if the URL begins with 'http' or 'data:' format. Also added in a test to
check for relative urls.
Hi! @shuding I have encountered a minor issue. After successfully
retrieving the necessary font files on the backend server, I am simply
uncertain about the optimal method for transmitting them back to the
front end in a single response while also specifying the language for
each file. Would you be able to provide me with some guidance on this
matter? 🤔️

Closes: #367

---------

Co-authored-by: Shu Ding <[email protected]>
- radial-gradient should support default value when missed according to
[reference](https://w3c.github.io/csswg-drafts/css-images/#radial-gradients)
- radial-gradient `<position>` should support unit such as `vw`,
`vh`,`em`, `rem`, `%` etc
- support `rg-extent-keyword` such as `closest-corner`,
`farthest-side`,`closest-side`, `farthest-corner`
- support explicitly set rg-size like `radial-gradient(20% 20% at top
left, yellow, blue)`

Close #453
Close #222
Close #456

you can check
[it](https://satori-playground-git-fork-jackie1210-fix-453.vercel.sh/?share=XVLLbuMwDPwVgYtFdgE30TaOsxXSHPYBtIeeWqAXX-SIsdXKkiHLeTTIv5ey66LtSeQMySEpnmDjFIKAldK73DLWhqPB69Mp2oxVqMsqCDb5xfn3STKAe61C9QVTum2MPBK6NXgY0Wj_0x43QTtL3MaZrrYjK40u7W3Auo0U2oB-pJ66Nujt8a8j0Eb9z3QhN8-ld51Vt7UsUUy8VFqaizK-FPnDo0pY6RFtwgrT4c_3jqjivX5BweaXH6DHtzkzznv0fM7tOhqrdld-mPo6h-UihwHZadz_cQfCOONsuWDZO7XVxhD-jXM-QuNiWS19qeM2Yk5zmPRijPVyJNjIUDFFyXfz5XRxNb1cmHk2vaLq6c00SwfnIktfclivZjF6aHRGnQ4W_eRXtQfXCJZyklrfoDEuYY_OG7WaUSwljS8k4Jr4Vy2IE_QTg_hNO4HhEECk0VFYdCWIrTQtJoC1e9IPxyZeUdj3HtWJW_1fF6hABN_hOYEgC4qoovw-isP5FQ)

while it can render now, but it seems diffs from result in html in
opacity? worth to dig it.
Relates to #223 and partially solves it. There're two categories of
discoverable nodes: HTML nodes and SVG nodes. The HTML nodes are just
the same as the input, which is easier to reason about: we just emit the
input nodes with resolved layout and styling information. This can be
thought as the "preprocessing step" of the data.

Then, the SVG nodes are a little bit tricky because they're not a 1:1
mapping from the input nodes. For example a `<div style={{ boxShadow:
'...' }}>` might be generated as a collection of SVG nodes including
`<defs>`, `<filter>` and `<rect>`.

However, in the future we can still emit structured data for these in a
`onNodeGenerated` event, containing the mapping information via a `from`
field:

```html
<div key="k" id="i" className="c" style={{ boxShadow: '...' }}>
```

Emits:

```js
onNodeDetected: #0 = { type: 'div', key: 'k', width, height, left, top, props }
```

And:

```js
onNodeGenerated: {
  from: #0,
  defs: DefNode[],
  elements: SVGElementNode[]
}
```

It apparently needs more discussion to get the best structured data
design. The generated node can be converted to SVG easily but not
necessarily (i.e. can be rendered in an imperative way such as canvas
too). Then we can get #233 fully supported.
It partially fixes #458 but I believe there're more uncovered cases.
Should fix #451 but we need to test after the release.
Close #471

## Additional

Here we did not respect the `<geometry-box>` property, according to
[mdn](https://developer.mozilla.org/en-US/docs/Web/CSS/clip-path)

> A shape whose size and position is defined by the <geometry-box>
value. If no geometry box is specified, the border-box will be used as
the reference box

but when i set `border-box` explictly, it does not work in html mode
unless i do not set `<geometry-box>`(so does any of `<geometry-box>`
value) just wired...😅
This PR renames the property name.

The `integrity` job uses `${{ matrix.node }}` but `matrix` property
defines `node-version: [ 18 ]` so it doesn't work correctly. It looks
the job uses Node.js 18 since it is the default version.

https://github.com/vercel/satori/blob/main/.github/workflows/ci.yml
```yml
  integrity:
    # prevents this action from running on forks
    if: github.repository_owner == 'vercel'
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [ 18 ]
    steps:
    - name: Checkout
      uses: actions/checkout@v3
    - name: Use pnpm
      run: corepack enable pnpm && pnpm --version
    - name: Use Node.js ${{ matrix.node }}
      uses: actions/setup-node@v3
      with:
        node-version: ${{ matrix.node }}
        cache: 'pnpm'
    - run: pnpm install
    - run: pnpm ci-check
```

`setup-node`'s example uses `node` instead of `node-version` so I
renamed it from `node-version` to `node`.
https://github.com/actions/setup-node#matrix-testing
### Description
Reset default tab-size to 8 to ensure 'satori' has the same effect as
'html' without setting tab-size.

before:
<img width="1438" alt="image"
src="https://github.com/vercel/satori/assets/22126563/02547a14-acff-4702-a52a-2e01e43be041">

after:
<img width="1439" alt="image"
src="https://github.com/vercel/satori/assets/22126563/bab20234-f493-4323-9ad7-a074ff970c94">
### Description
1. Support multiline text overflow ellipsis(webkit-line-clamp +
webkit-box-orient).

2. Fixed a bug where overflow: 'hidden' should not be inherited by child
elements.

3. Support the 'line-clamp' property, including custom block ellipsis.

I added display: block here because whether it's required by the CSS
draft or needed to implement this feature (must be different from
display: flex), it seems I have to do so. One thing I want to discuss
here is whether we can set the default display to flex, because this is
more in line with the original behavior of the browser and does not seem
to cause any problems (can pass all unit tests).



https://github.com/vercel/satori/assets/22126563/5ec006a7-9cfb-4fc4-9000-adc9fb042c17


https://github.com/vercel/satori/assets/22126563/d672942e-e2c9-423c-8bcf-23a932e7cfb3


Closes: #253

---------

Co-authored-by: Shu Ding <[email protected]>
`'foo'.startsWith('foo') // true`
Improve docs and add an "Example" column to the CSS table.
LuciNyan and others added 25 commits June 3, 2023 15:28
Hi there! We're developing an open-source app
(https://github.com/dumpus-app/dumpus-app) and use satori to render some
images client-side.
However, we encountered the following error on both ios web (safari) and
capacitor (that uses safari webview) on a lot of iOS devices:
```bash
Invalid regular expression: invalid group specifier name
```
After investigating, we found out it's caused by [regex
lookbehind](https://stackoverflow.com/questions/51568821/works-in-chrome-but-breaks-in-safari-invalid-regular-expression-invalid-group)
not being [supported until iOS
16.4](https://caniuse.com/js-regexp-lookbehind).

This PR replaces this regex by some quite hacky code because we needed a
hotfix.
If anybody wants to update the regex in order not to use `lookbehind`
feature, feel free to do so!.

If you want to test it, you can use satori on the web using the
following package json version:
```json
"satori": "dumpus-app/satori#fix-safari-compatibility-build"
```

Thanks for your time!

Co-authored-by: Androz2091 <[email protected]>
### Description

Closes: #525
## Description

Adds a note to clarify that `"min-content"` and `"max-content"` can not
be used on the `minWidth`, `minHeight`, `maxWidth` and `maxHeight` style
properties.

Closes #521
### Description
1. Default to the current color when `textDecorationColor` is unset.
2. Resolve incorrect positioning of decoration line.
3. Address inaccurate line-through positioning.

<img width="1438" alt="image"
src="https://github.com/vercel/satori/assets/22126563/71e401e1-f03d-45e4-a5ad-c202487ad605">

<img width="912" alt="image"
src="https://github.com/vercel/satori/assets/22126563/fe010957-ce7c-401d-bf02-e59e1a03a2a9">

Closes: #530
### Description
This may be a temporary fix, I didn't dig deep into yoga. But when the
return value of width here doesn't change (assuming the value of width
is 216.9), when we later get the width through
`parent.getComputedWidth()`, sometimes it returns 216 and sometimes 217.
I'm not sure if this is a yoga bug, but it seems related to the entire
page width.

Closes: #540


https://github.com/vercel/satori/assets/22126563/6929db4c-60e8-4a85-ae8b-497ad64c317e
## Description
There are many uses of `any` throughout the codebase. We could aim to
tighten up the typings to be more precise. This PR makes only small
improvements, but please share any thoughts on further changes we could
make or naming conventions to standardize on. I want you to know that
all feedback is welcome. <3

@Jackie1210 @shuding.
This PR aims to reach the following results:
- pnpm to v8
- add node v20 to ci
- make vercel playground work well after upgrading pnpm to v8(need
@shuding access to the vercel dashboard to make it deploy well)

@shuding Thanks for your time~
We always need to handle mutiple effects. Let's give it a fn and add
some tests
### Description
- Fix text-shadow.
- Refactor the **text** to improve readability. Since the refactoring
changes may be extensive, to prevent bugs caused by refactoring from
being hard to locate, it will be implemented in multiple PRs
step-by-step.
small fix to display correct table border.

Before the fix (see bottom of "Mask" cell):

![screen-2](https://github.com/vercel/satori/assets/1787206/cb8cb86a-02b0-4015-b3c8-6ea3c78b33fe)

After the fix:

![screen-1](https://github.com/vercel/satori/assets/1787206/03b1a7b4-0e77-4e5b-8d71-c834f179fa0a)
Update that maxHeight, maxWidth, minHeight and minWidth are unsupported
for `fit-content`.

reference:

[MDN
max-height](https://developer.mozilla.org/en-US/docs/Web/CSS/max-height)
Resolves #565

---------

Co-authored-by: Shu Ding <[email protected]>
@sahithyandev sahithyandev merged commit 25168bf into sahithyandev:main Apr 26, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.