@webstudio-is/css-engine 0.129.0 → 0.131.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.
Files changed (2) hide show
  1. package/lib/index.js +10 -3
  2. package/package.json +5 -5
package/lib/index.js CHANGED
@@ -28,7 +28,11 @@ var toValue = (styleValue, transformValue) => {
28
28
  return value.value + (value.unit === "number" ? "" : value.unit);
29
29
  }
30
30
  if (value.type === "fontFamily") {
31
- return value.value.join(", ");
31
+ const families = [];
32
+ for (const family of value.value) {
33
+ families.push(family.includes(" ") ? `"${family}"` : family);
34
+ }
35
+ return families.join(", ");
32
36
  }
33
37
  if (value.type === "var") {
34
38
  const fallbacks = [];
@@ -237,9 +241,12 @@ var FontFaceRule = class {
237
241
  toString() {
238
242
  const decls = [];
239
243
  const { fontFamily, fontStyle, fontWeight, fontDisplay, src } = this.options;
240
- decls.push(
241
- `font-family: ${/\s/.test(fontFamily) ? `"${fontFamily}"` : fontFamily}`
244
+ const value = toValue(
245
+ { type: "fontFamily", value: [fontFamily] },
246
+ // Avoids adding a fallback automatically which needs to happen for font family in general but not for font face.
247
+ (value2) => value2
242
248
  );
249
+ decls.push(`font-family: ${value}`);
243
250
  decls.push(`font-style: ${fontStyle}`);
244
251
  decls.push(`font-weight: ${fontWeight}`);
245
252
  decls.push(`font-display: ${fontDisplay}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webstudio-is/css-engine",
3
- "version": "0.129.0",
3
+ "version": "0.131.0",
4
4
  "description": "CSS Renderer for Webstudio",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -8,8 +8,8 @@
8
8
  "dependencies": {
9
9
  "@emotion/hash": "^0.9.1",
10
10
  "hyphenate-style-name": "^1.0.4",
11
- "@webstudio-is/fonts": "0.129.0",
12
- "@webstudio-is/error-utils": "0.129.0"
11
+ "@webstudio-is/error-utils": "0.131.0",
12
+ "@webstudio-is/fonts": "0.131.0"
13
13
  },
14
14
  "devDependencies": {
15
15
  "@jest/globals": "^29.7.0",
@@ -19,9 +19,9 @@
19
19
  "react": "^18.2.0",
20
20
  "react-dom": "^18.2.0",
21
21
  "typescript": "5.2.2",
22
+ "@webstudio-is/jest-config": "1.0.7",
22
23
  "@webstudio-is/storybook-config": "0.0.0",
23
- "@webstudio-is/tsconfig": "1.0.7",
24
- "@webstudio-is/jest-config": "1.0.7"
24
+ "@webstudio-is/tsconfig": "1.0.7"
25
25
  },
26
26
  "exports": {
27
27
  "webstudio": "./src/index.ts",