Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

refactor: drop detect-font (#4581)

Bogdan Chadkine703bf89267c
diff --git a/@types/detect-font.d.ts b/@types/detect-font.d.ts
deleted file mode 100644
index 5dc8d92953..0000000000
--- a/@types/detect-font.d.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-declare module "detect-font" {
- type Options = {
- text?: string;
- fontSize?: number;
- baseFont?: string;
- };
- export function detectFont(element: Element, options?: Options): string;
-}
diff --git a/apps/builder/app/canvas/features/webstudio-component/get-browser-style.ts b/apps/builder/app/canvas/features/webstudio-component/get-browser-style.ts
index e796368b15..7106e5f669 100644
--- a/apps/builder/app/canvas/features/webstudio-component/get-browser-style.ts
+++ b/apps/builder/app/canvas/features/webstudio-component/get-browser-style.ts
@@ -1,4 +1,3 @@
-import { detectFont } from "detect-font";
import type { Style, StyleValue, Unit } from "@webstudio-is/css-engine";
import { keywordValues } from "@webstudio-is/css-data";
import { properties, units } from "@webstudio-is/css-data";
@@ -68,10 +67,5 @@ export const getBrowserStyle = (element?: Element): Style => {
const computedValue = computedStyle[knownProperty as unknown as number];
browserStyle[knownProperty] = parseValue(knownProperty, computedValue);
}
- // We need a single font-family that is actually rendered. Computed style will return a list of potential fonts.
- browserStyle.fontFamily = {
- type: "fontFamily",
- value: [detectFont(element)],
- };
return browserStyle;
};
diff --git a/apps/builder/package.json b/apps/builder/package.json
index 52d9799ed5..251de924e1 100644
--- a/apps/builder/package.json
+++ b/apps/builder/package.json
@@ -83,7 +83,6 @@
"css-tree": "^2.3.1",
"date-fns": "^3.6.0",
"debug": "^4.3.7",
- "detect-font": "^0.1.5",
"downshift": "^6.1.7",
"fast-deep-equal": "^3.1.3",
"immer": "^10.1.1",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 20f2786b85..1a5ad24d1d 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -316,9 +316,6 @@ importers:
debug:
specifier: ^4.3.7
version: 4.3.7
- detect-font:
- specifier: ^0.1.5
- version: 0.1.5
downshift:
specifier: ^6.1.7
version: 6.1.7([email protected])
@@ -5604,9 +5601,6 @@ packages:
resolution: {integrity: sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==}
engines: {node: '>= 0.8', npm: 1.2.8000 || >= 1.4.16}
- resolution: {integrity: sha512-Ir0jJlsJ7hkpbqzpr8TB5grZTbhZ2Lk90Z0Yt1LpUd1xTZEl/bLhKypDyLc7jEeuuI8ZA0kmDwxARB4n0/jPTA==}
-
resolution: {integrity: sha512-ypdmJU/TbBby2Dxibuv7ZLW3Bs1QEmM7nHjEANfohJLvE0XVujisn1qPJcZxg+qDucsr+bP6fLD1rPS3AhJ7EQ==}
@@ -6346,9 +6340,6 @@ packages:
engines: {node: '>=8'}
hasBin: true
- resolution: {integrity: sha512-qtlzvwm4bPrI6hBRHBhLWgp/fUeDaeCBRcT8eHhI7yP1C2g45AilloSAmbPgeAMm3InTgMy6z3ZImq9byMlYXg==}
-
resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==}
engines: {node: '>=0.10.0'}
@@ -12506,10 +12497,6 @@ snapshots:
- dependencies:
- is-element: 0.1.0
-
@@ -13476,8 +13463,6 @@ snapshots:
-