@webstudio-is/css-engine 0.181.0 → 0.182.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 +14 -10
  2. package/package.json +5 -5
package/lib/index.js CHANGED
@@ -155,17 +155,21 @@ var cssWideKeywords = /* @__PURE__ */ new Set([
155
155
  import { captureError } from "@webstudio-is/error-utils";
156
156
  import { DEFAULT_FONT_FALLBACK, SYSTEM_FONTS } from "@webstudio-is/fonts";
157
157
  var fallbackTransform = (styleValue) => {
158
- if (styleValue.type === "fontFamily") {
159
- const fonts = SYSTEM_FONTS.get(styleValue.value[0])?.stack ?? [
160
- styleValue.value[0],
161
- DEFAULT_FONT_FALLBACK
162
- ];
163
- const value = Array.from(new Set(fonts));
164
- return {
165
- type: "fontFamily",
166
- value
167
- };
158
+ if (styleValue.type !== "fontFamily") {
159
+ return;
168
160
  }
161
+ let { value } = styleValue;
162
+ if (value.length === 0) {
163
+ value = [DEFAULT_FONT_FALLBACK];
164
+ }
165
+ if (value.length === 1) {
166
+ const stack = SYSTEM_FONTS.get(value[0])?.stack;
167
+ value = stack ?? [value[0], DEFAULT_FONT_FALLBACK];
168
+ }
169
+ return {
170
+ type: "fontFamily",
171
+ value: Array.from(new Set(value))
172
+ };
169
173
  };
170
174
  var sanitizeCssUrl = (str) => JSON.stringify(str);
171
175
  var toValue = (styleValue, transformValue) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webstudio-is/css-engine",
3
- "version": "0.181.0",
3
+ "version": "0.182.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
  "zod": "^3.22.4",
11
- "@webstudio-is/fonts": "0.181.0",
12
- "@webstudio-is/error-utils": "0.181.0"
11
+ "@webstudio-is/error-utils": "0.182.0",
12
+ "@webstudio-is/fonts": "0.182.0"
13
13
  },
14
14
  "devDependencies": {
15
15
  "@jest/globals": "^29.7.0",
@@ -18,8 +18,8 @@
18
18
  "react": "18.3.0-canary-14898b6a9-20240318",
19
19
  "react-dom": "18.3.0-canary-14898b6a9-20240318",
20
20
  "typescript": "5.5.2",
21
- "@webstudio-is/jest-config": "1.0.7",
22
- "@webstudio-is/tsconfig": "1.0.7"
21
+ "@webstudio-is/tsconfig": "1.0.7",
22
+ "@webstudio-is/jest-config": "1.0.7"
23
23
  },
24
24
  "exports": {
25
25
  "webstudio": "./src/index.ts",