36 Commits
Author SHA1 Message Date
Ivan Starkov a939121318 fix: Incorrectly quoted URLs in CSS (#2642)
## Description

Even we have this

https://github.com/webstudio-is/webstudio-builder/blob/9af97656af2e06a789f416bd93e1e1d0e756f063/packages/asset-uploader/src/utils/sanitize-s3-key.ts#L26

Additionally seems like best practice is to add backslashes for `"` and
`\` symbols, even this symbols are impossible having sanitize we are
using. (In case of sanitizer change everything can break)




## Steps for reproduction

1. click button
2. expect xyz

## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2023-11-22 18:53:36 +02:00
Bogdan Chadkin f506312a0d Move font parsing into asset uploader (#2242)
Here I moved font parsing into asset uploader as it is used only there
but bloats sdk and cli with big fontkit package.

Cli install size

```diff
du -ck node_modules
- 72464
+ 57880
```
2023-09-04 16:18:50 +04:00
Bogdan Chadkin 5af1ba168f Fix font weight detection of uploaded fonts (#2175)
Ref https://discord.com/channels/955905230107738152/1144505313358254120

Here turns out there is not standard in naming font subfamilies. To fix
I expanded the list of weights wiith spaceless variants. Added "regular"
keyword to detect normal font weight.
2023-08-25 13:11:36 +04:00
Oleg Isonen cda2c05020 Roboto font fallback for arial (#1898)
## Description

Closes #1884 

## Steps for reproduction

1. use Arial on any element
2. check in dev tools if roboto is a fallback

## Code Review

- [ ] hi @TrySound , I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio-builder/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
2023-07-05 14:17:15 +02:00
Bogdan Chadkin 4375cd9ea0 Pass asset base url for fonts and style images (#1451)
Ref https://github.com/webstudio-is/webstudio-builder/issues/1179

publicPath and cdnUrl are separate environment variables for different
deployments. Though they do exactly same thing we can unify them as
asset base url.
2023-04-14 14:49:58 +07:00
Bogdan Chadkin 22962e1a46 Fix font assets resolving (#1443)
Fonts are resolved separately. Here provided same publicPath and cdnUrl
options to font face resolver.
2023-04-13 13:05:54 +07:00
Bogdan Chadkin b4d21aadff Run global prettier check (#1353)
Here add check to have formatting always applied in case git hook was
ignored or not run for some reason.

Cached prettier for whole project is run within 2-3 seconds.
2023-04-03 16:48:10 +07:00
Bogdan Chadkin 9c316b0499 Enable typescript preserveValueImports (#1341)
This option forces all type imports to have "type" specifier even though
there are other value imports.

TS 5 forces it when new verbatimModuleSyntax is enabled.
2023-04-01 17:47:55 +07:00
Oleg Isonen 525e6e384d Support for variable fonts (#1007)
Closes https://github.com/webstudio-is/webstudio-designer/issues/994

## Description

Variable fonts were treated like normal fonts, so we were only showing
one default font weight as available.
Now we not only detect variable fonts, but we also save all the meta
data we get from them, so we can add a variable font settings UI in the
future, which is a huge deal for designers, because variable fonts offer
very interesting styling options and animations

## Steps for reproduction

1. select instance
2. font family, upload variable versions fonts like Monrope, Inter or
Roboto Flex
3. see you can choose any font weight
4. use any styles on the font e.g. italic etc 

## Code Review

- [ ] hi @TrySound , I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio-designer/blob/main/apps/designer/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `designer/env-check.js` if mandatory
2023-02-12 21:34:38 +01:00
Bogdan Chadkin 752768abbc Use explicit imports from @jest/globals (#645)
pnpm prevents access to jest and @types/jest from packages so we need to
explicitly install it. Though @types/jest is not officially maintained
and often late for months with new major which bloats node_modules with
two versions of jest transitives.

Here is alternative way to use official types. The only downside is
complains these types has less descriptions.
2022-12-16 16:35:22 +03:00
Roman Pominov 26f0990347 fix UserProp schema 2022-11-28 12:53:56 +04:00
Bogdan Chadkin ad04473f26 Migrate packages to native ESM (#493)
Our designer bundle heavily bloated with not analyzable commonjs
generated by typescript.

The biggest problem comes from bundled icons library which esbuild
cannot tree shake because of cjs.

Another issue is broken code splitting. Packages in one piece are appear
in chunks and always loaded even with dynamic import and React.lazy.

To solve this I migrated each package to native node es modules.
Storybook and jest work almost without changes. Though it's not possible
to run remix in esm project (while still esm packages can be bundled for
ssr). And as a result designer jest failed because of cjs tests requires
from esm packages. As a solution I generated additional commonjs
artifacts in lib/cjs.

du -ck public/build
2336
1736
2022-11-23 10:12:58 +03:00
Bogdan Chadkin 47a7bd6e4b Bump to jest 29 (#484)
The new version got more readable snapshots, no longer depends jsdom and
has much better esm support (will be enabled in next PR).

Had to switch to babel to support typescript, react and esm for now.
2022-11-21 19:10:18 +03:00
Oleg Isonen 82535ca86b more test cases 2022-11-07 17:08:31 +01:00
Oleg Isonen c3f1df5069 more tests 2022-11-07 16:46:42 +01:00
Oleg Isonen 74236cb77c only replace parts of family that are separate words during normalization 2022-11-07 16:39:56 +01:00
Oleg Isonen 43453e07d6 Merge branch 'main' into 252-fonts-manager-and-fonts-selector 2022-11-07 16:14:57 +01:00
Oleg Isonen fa81279c94 explain why we need this function 2022-11-07 16:11:31 +01:00
Oleg Isonen 2fc8940686 don't use regex to avoid the need for escaping 2022-11-07 16:08:53 +01:00
Oleg Isonen 68d22988cc fix font rendering for different weights/styles 2022-11-05 13:24:03 +01:00
Mateusz Burzyński 1b84fd65ef Generate actual /server entries in packages 2022-11-04 09:21:48 +01:00
Oleg Isonen 504fc976b2 render font weights we have defined 2022-11-03 23:11:00 +01:00
Oleg Isonen 031c823695 normalize family 2022-11-03 17:02:16 +01:00
Oleg Isonen 0a8c3d8f36 delete font-face from canvas when font was deleted 2022-11-01 18:54:50 +01:00
Oleg Isonen bb1e58b46b font face can't have fallback font family 2022-09-26 12:19:22 +03:00
Oleg Isonen 02f74bade0 use Map instead of object 2022-09-25 21:53:47 +03:00
Oleg Isonen e1e2f6e53a add fontFamily css value type, render fallback fonts for system and uploaded fonts 2022-09-25 13:24:15 +03:00
Oleg Isonen 96c5f7ecfd add fallback font to the uploaded one 2022-09-25 12:09:22 +03:00
Oleg Isonen 23a980eb7d add test for getFontFaces 2022-09-24 16:57:32 +03:00
Oleg Isonen 913cf52b86 dedupe family, render same family assets as multiple src 2022-09-24 16:23:10 +03:00
Oleg Isonen 85075f06f8 fallback to subfamily if preferredSubfamily is not available 2022-09-23 21:39:31 +03:00
Oleg Isonen 3ff24033cb split server-side ressources 2022-09-23 13:11:20 +03:00
Oleg Isonen fc2c586847 move font logic to fonts package 2022-09-22 19:49:59 +03:00
Oleg Isonen 68276293d1 cleanup font configs 2022-09-22 17:06:31 +03:00
Oleg Isonen 2cce1fe983 wip render fonts list and font-face 2022-09-22 16:31:19 +03:00
Oleg Isonen 475546faf9 fonts package with fonts config 2022-09-21 19:31:32 +03:00