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.

fix: Accept custom variable font axes (#6152)

Oleg Isonencdbe9d99f5c8
diff --git a/fixtures/react-router-cloudflare/.webstudio/data.json b/fixtures/react-router-cloudflare/.webstudio/data.json
index 29ce4493cc..0feb64370c 100644
--- a/fixtures/react-router-cloudflare/.webstudio/data.json
+++ b/fixtures/react-router-cloudflare/.webstudio/data.json
@@ -1,5 +1,5 @@
{
- "bundleVersion": "bundle-i6o13q",
+ "bundleVersion": "bundle-oez66b",
"build": {
"id": "f565d527-32e7-4731-bc71-aca9e9574587",
"projectId": "d845c167-ea07-4875-b08d-83e97c09dcce",
diff --git a/fixtures/react-router-docker/.webstudio/data.json b/fixtures/react-router-docker/.webstudio/data.json
index 29ce4493cc..0feb64370c 100644
--- a/fixtures/react-router-docker/.webstudio/data.json
+++ b/fixtures/react-router-docker/.webstudio/data.json
@@ -1,5 +1,5 @@
{
- "bundleVersion": "bundle-i6o13q",
+ "bundleVersion": "bundle-oez66b",
"build": {
"id": "f565d527-32e7-4731-bc71-aca9e9574587",
"projectId": "d845c167-ea07-4875-b08d-83e97c09dcce",
diff --git a/fixtures/react-router-netlify/.webstudio/data.json b/fixtures/react-router-netlify/.webstudio/data.json
index 29ce4493cc..0feb64370c 100644
--- a/fixtures/react-router-netlify/.webstudio/data.json
+++ b/fixtures/react-router-netlify/.webstudio/data.json
@@ -1,5 +1,5 @@
{
- "bundleVersion": "bundle-i6o13q",
+ "bundleVersion": "bundle-oez66b",
"build": {
"id": "f565d527-32e7-4731-bc71-aca9e9574587",
"projectId": "d845c167-ea07-4875-b08d-83e97c09dcce",
diff --git a/fixtures/react-router-vercel/.webstudio/data.json b/fixtures/react-router-vercel/.webstudio/data.json
index 29ce4493cc..0feb64370c 100644
--- a/fixtures/react-router-vercel/.webstudio/data.json
+++ b/fixtures/react-router-vercel/.webstudio/data.json
@@ -1,5 +1,5 @@
{
- "bundleVersion": "bundle-i6o13q",
+ "bundleVersion": "bundle-oez66b",
"build": {
"id": "f565d527-32e7-4731-bc71-aca9e9574587",
"projectId": "d845c167-ea07-4875-b08d-83e97c09dcce",
diff --git a/fixtures/ssg-cloudflare-pages/.webstudio/data.json b/fixtures/ssg-cloudflare-pages/.webstudio/data.json
index 90342a0b72..75756496fd 100644
--- a/fixtures/ssg-cloudflare-pages/.webstudio/data.json
+++ b/fixtures/ssg-cloudflare-pages/.webstudio/data.json
@@ -1,5 +1,5 @@
{
- "bundleVersion": "bundle-i6o13q",
+ "bundleVersion": "bundle-oez66b",
"build": {
"id": "a2e8de30-03d5-4514-a3a6-406b3266a3af",
"projectId": "d845c167-ea07-4875-b08d-83e97c09dcce",
diff --git a/fixtures/ssg-netlify-by-project-id/.webstudio/data.json b/fixtures/ssg-netlify-by-project-id/.webstudio/data.json
index 6d5ea9c7ed..862a28d792 100644
--- a/fixtures/ssg-netlify-by-project-id/.webstudio/data.json
+++ b/fixtures/ssg-netlify-by-project-id/.webstudio/data.json
@@ -1,5 +1,5 @@
{
- "bundleVersion": "bundle-i6o13q",
+ "bundleVersion": "bundle-oez66b",
"build": {
"id": "8f0fdff2-e76b-4f86-9203-ea7df5f1143c",
"projectId": "8a7358b1-7de3-459d-b7b1-56dddfb6ce1e",
diff --git a/fixtures/webstudio-cloudflare-template/.webstudio/data.json b/fixtures/webstudio-cloudflare-template/.webstudio/data.json
index 90342a0b72..75756496fd 100644
--- a/fixtures/webstudio-cloudflare-template/.webstudio/data.json
+++ b/fixtures/webstudio-cloudflare-template/.webstudio/data.json
@@ -1,5 +1,5 @@
{
- "bundleVersion": "bundle-i6o13q",
+ "bundleVersion": "bundle-oez66b",
"build": {
"id": "a2e8de30-03d5-4514-a3a6-406b3266a3af",
"projectId": "d845c167-ea07-4875-b08d-83e97c09dcce",
diff --git a/fixtures/webstudio-features/.webstudio/data.json b/fixtures/webstudio-features/.webstudio/data.json
index c9c055ef49..6435f80c24 100644
--- a/fixtures/webstudio-features/.webstudio/data.json
+++ b/fixtures/webstudio-features/.webstudio/data.json
@@ -1,5 +1,5 @@
{
- "bundleVersion": "bundle-i6o13q",
+ "bundleVersion": "bundle-oez66b",
"build": {
"id": "1b66ee06-8ea5-4420-9a0e-e0d3a67aca32",
"projectId": "cddc1d44-af37-4cb6-a430-d300cf6f932d",
diff --git a/packages/fonts/src/schema.test.ts b/packages/fonts/src/schema.test.ts
index 3659eee754..2844ae606f 100644
--- a/packages/fonts/src/schema.test.ts
+++ b/packages/fonts/src/schema.test.ts
@@ -1,5 +1,17 @@
import { describe, expect, test } from "vitest";
-import { mergeFontMeta } from "./schema";
+import { fontMeta, mergeFontMeta } from "./schema";
+
+test("accepts custom variation axes", () => {
+ const meta = {
+ family: "Antarctica",
+ variationAxes: {
+ wght: { name: "Weight", min: 100, default: 400, max: 950 },
+ CNTR: { name: "Contrast", min: 0, default: 0, max: 100 },
+ },
+ };
+
+ expect(fontMeta.parse(meta)).toEqual(meta);
+});
describe("mergeFontMeta", () => {
test("keeps the detected font shape", () => {
diff --git a/packages/fonts/src/schema.ts b/packages/fonts/src/schema.ts
index 40dd975b51..bd454cd155 100644
--- a/packages/fonts/src/schema.ts
+++ b/packages/fonts/src/schema.ts
@@ -8,22 +8,12 @@ export const fontFormat = z.union([
]);
export type FontFormat = z.infer<typeof fontFormat>;
-const axisName = z.enum([
- "wght",
- "wdth",
- "slnt",
- "opsz",
- "ital",
- "GRAD",
- "XTRA",
- "XOPQ",
- "YOPQ",
- "YTLC",
- "YTUC",
- "YTAS",
- "YTDE",
- "YTFI",
-]);
+// OpenType variation axis tags contain four ASCII characters. Registered tags
+// and foundry-defined custom tags use the same identifier format.
+const axisName = z
+ .string()
+ .regex(/^[A-Za-z][A-Za-z0-9]* *$/)
+ .length(4);
const variationAxes = z.partialRecord(
axisName,
diff --git a/packages/project-build/src/contracts/__generated__/runtime-operation-contracts.ts b/packages/project-build/src/contracts/__generated__/runtime-operation-contracts.ts
index 9f1907dbb6..047776fbb4 100644
--- a/packages/project-build/src/contracts/__generated__/runtime-operation-contracts.ts
+++ b/packages/project-build/src/contracts/__generated__/runtime-operation-contracts.ts
@@ -3745,22 +3745,9 @@ export const runtimeOperationContractData = [
type: "object",
propertyNames: {
type: "string",
- enum: [
- "wght",
- "wdth",
- "slnt",
- "opsz",
- "ital",
- "GRAD",
- "XTRA",
- "XOPQ",
- "YOPQ",
- "YTLC",
- "YTUC",
- "YTAS",
- "YTDE",
- "YTFI",
- ],
+ minLength: 4,
+ maxLength: 4,
+ pattern: "^[A-Za-z][A-Za-z0-9]* *$",
},
additionalProperties: {
type: "object",
@@ -6875,22 +6862,9 @@ export const runtimeOperationContractData = [
type: "object",
propertyNames: {
type: "string",
- enum: [
- "wght",
- "wdth",
- "slnt",
- "opsz",
- "ital",
- "GRAD",
- "XTRA",
- "XOPQ",
- "YOPQ",
- "YTLC",
- "YTUC",
- "YTAS",
- "YTDE",
- "YTFI",
- ],
+ minLength: 4,
+ maxLength: 4,
+ pattern: "^[A-Za-z][A-Za-z0-9]* *$",
},
additionalProperties: {
type: "object",
@@ -10016,22 +9990,9 @@ export const runtimeOperationContractData = [
type: "object",
propertyNames: {
type: "string",
- enum: [
- "wght",
- "wdth",
- "slnt",
- "opsz",
- "ital",
- "GRAD",
- "XTRA",
- "XOPQ",
- "YOPQ",
- "YTLC",
- "YTUC",
- "YTAS",
- "YTDE",
- "YTFI",
- ],
+ minLength: 4,
+ maxLength: 4,
+ pattern: "^[A-Za-z][A-Za-z0-9]* *$",
},
additionalProperties: {
type: "object",
@@ -13146,22 +13107,9 @@ export const runtimeOperationContractData = [
type: "object",
propertyNames: {
type: "string",
- enum: [
- "wght",
- "wdth",
- "slnt",
- "opsz",
- "ital",
- "GRAD",
- "XTRA",
- "XOPQ",
- "YOPQ",
- "YTLC",
- "YTUC",
- "YTAS",
- "YTDE",
- "YTFI",
- ],
+ minLength: 4,
+ maxLength: 4,
+ pattern: "^[A-Za-z][A-Za-z0-9]* *$",
},
additionalProperties: {
type: "object",
@@ -18985,22 +18933,10 @@ export const runtimeOperationContractData = [
type: "object",
propertyNames: {
type: "string",
- enum: [
- "wght",
- "wdth",
- "slnt",
- "opsz",
- "ital",
- "GRAD",
- "XTRA",
- "XOPQ",
- "YOPQ",
- "YTLC",
- "YTUC",
- "YTAS",
- "YTDE",
- "YTFI",
- ],
+ minLength: 4,
+ maxLength: 4,
+ pattern:
+ "^[A-Za-z][A-Za-z0-9]* *$",
},
additionalProperties: {
type: "object",
@@ -22318,22 +22254,10 @@ export const runtimeOperationContractData = [
type: "object",
propertyNames: {
type: "string",
- enum: [
- "wght",
- "wdth",
- "slnt",
- "opsz",
- "ital",
- "GRAD",
- "XTRA",
- "XOPQ",
- "YOPQ",
- "YTLC",
- "YTUC",
- "YTAS",
- "YTDE",
- "YTFI",
- ],
+ minLength: 4,
+ maxLength: 4,
+ pattern:
+ "^[A-Za-z][A-Za-z0-9]* *$",
},
additionalProperties: {
type: "object",
@@ -36695,22 +36619,9 @@ export const runtimeOperationContractData = [
type: "object",
propertyNames: {
type: "string",
- enum: [
- "wght",
- "wdth",
- "slnt",
- "opsz",
- "ital",
- "GRAD",
- "XTRA",
- "XOPQ",
- "YOPQ",
- "YTLC",
- "YTUC",
- "YTAS",
- "YTDE",
- "YTFI",
- ],
+ minLength: 4,
+ maxLength: 4,
+ pattern: "^[A-Za-z][A-Za-z0-9]* *$",
},
additionalProperties: {
type: "object",
@@ -39904,22 +39815,9 @@ export const runtimeOperationContractData = [
type: "object",
propertyNames: {
type: "string",
- enum: [
- "wght",
- "wdth",
- "slnt",
- "opsz",
- "ital",
- "GRAD",
- "XTRA",
- "XOPQ",
- "YOPQ",
- "YTLC",
- "YTUC",
- "YTAS",
- "YTDE",
- "YTFI",
- ],
+ minLength: 4,
+ maxLength: 4,
+ pattern: "^[A-Za-z][A-Za-z0-9]* *$",
},
additionalProperties: {
type: "object",
@@ -46225,22 +46123,9 @@ export const runtimeOperationContractData = [
type: "object",
propertyNames: {
type: "string",
- enum: [
- "wght",
- "wdth",
- "slnt",
- "opsz",
- "ital",
- "GRAD",
- "XTRA",
- "XOPQ",
- "YOPQ",
- "YTLC",
- "YTUC",
- "YTAS",
- "YTDE",
- "YTFI",
- ],
+ minLength: 4,
+ maxLength: 4,
+ pattern: "^[A-Za-z][A-Za-z0-9]* *$",
},
additionalProperties: {
type: "object",
@@ -52044,22 +51929,9 @@ export const runtimeOperationContractData = [
type: "object",
propertyNames: {
type: "string",
- enum: [
- "wght",
- "wdth",
- "slnt",
- "opsz",
- "ital",
- "GRAD",
- "XTRA",
- "XOPQ",
- "YOPQ",
- "YTLC",
- "YTUC",
- "YTAS",
- "YTDE",
- "YTFI",
- ],
+ minLength: 4,
+ maxLength: 4,
+ pattern: "^[A-Za-z][A-Za-z0-9]* *$",
},
additionalProperties: {
type: "object",
@@ -70788,22 +70660,9 @@ export const runtimeOperationContractData = [
type: "object",
propertyNames: {
type: "string",
- enum: [
- "wght",
- "wdth",
- "slnt",
- "opsz",
- "ital",
- "GRAD",
- "XTRA",
- "XOPQ",
- "YOPQ",
- "YTLC",
- "YTUC",
- "YTAS",
- "YTDE",
- "YTFI",
- ],
+ minLength: 4,
+ maxLength: 4,
+ pattern: "^[A-Za-z][A-Za-z0-9]* *$",
},
additionalProperties: {
type: "object",
@@ -71051,22 +70910,9 @@ export const runtimeOperationContractData = [
type: "object",
propertyNames: {
type: "string",
- enum: [
- "wght",
- "wdth",
- "slnt",
- "opsz",
- "ital",
- "GRAD",
- "XTRA",
- "XOPQ",
- "YOPQ",
- "YTLC",
- "YTUC",
- "YTAS",
- "YTDE",
- "YTFI",
- ],
+ minLength: 4,
+ maxLength: 4,
+ pattern: "^[A-Za-z][A-Za-z0-9]* *$",
},
additionalProperties: {
type: "object",