@webstudio-is/fonts 0.289.0 → 0.290.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.
package/lib/index.js CHANGED
@@ -356,6 +356,29 @@ var fontMetaUpdate = z.union([
356
356
  fontMetaStatic.partial().strict(),
357
357
  fontMetaVariable.partial().strict()
358
358
  ]);
359
+ var mergeFontMeta = (current, override) => {
360
+ const result = fontMetaUpdate.safeParse(override);
361
+ if (result.success === false) {
362
+ return;
363
+ }
364
+ const { family } = result.data;
365
+ if ("variationAxes" in current) {
366
+ const variationAxes2 = "variationAxes" in result.data ? result.data.variationAxes : void 0;
367
+ return {
368
+ ...current,
369
+ ...family === void 0 ? {} : { family },
370
+ ...variationAxes2 === void 0 ? {} : { variationAxes: variationAxes2 }
371
+ };
372
+ }
373
+ const style = "style" in result.data ? result.data.style : void 0;
374
+ const weight = "weight" in result.data ? result.data.weight : void 0;
375
+ return {
376
+ ...current,
377
+ ...family === void 0 ? {} : { family },
378
+ ...style === void 0 ? {} : { style },
379
+ ...weight === void 0 ? {} : { weight }
380
+ };
381
+ };
359
382
 
360
383
  // src/font-weights.ts
361
384
  var fontWeights = {
@@ -415,5 +438,6 @@ export {
415
438
  fontMetaVariable,
416
439
  fontWeightNames,
417
440
  fontWeights,
418
- getFontFaces
441
+ getFontFaces,
442
+ mergeFontMeta
419
443
  };
@@ -122,4 +122,5 @@ export declare const fontMetaUpdate: z.ZodUnion<readonly [z.ZodObject<{
122
122
  }, z.core.$strip>>>;
123
123
  }, z.core.$strict>]>;
124
124
  export type FontMeta = z.infer<typeof fontMeta>;
125
+ export declare const mergeFontMeta: (current: FontMeta, override: unknown) => FontMeta | undefined;
125
126
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webstudio-is/fonts",
3
- "version": "0.289.0",
3
+ "version": "0.290.0",
4
4
  "description": "Fonts utils",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",