unlayer-types 1.376.0 → 1.377.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/embed.d.ts +37 -2
- package/package.json +1 -1
package/embed.d.ts
CHANGED
|
@@ -1341,6 +1341,19 @@ declare module "packages/editor/src/engine/constants" {
|
|
|
1341
1341
|
IS_SAFARI: boolean;
|
|
1342
1342
|
};
|
|
1343
1343
|
}
|
|
1344
|
+
declare module "packages/editor/src/engine/config/optionGroups" {
|
|
1345
|
+
export interface OptionGroup<T> {
|
|
1346
|
+
label: string;
|
|
1347
|
+
options: OptionItem<T>[];
|
|
1348
|
+
}
|
|
1349
|
+
export type OptionItem<T> = T | OptionGroup<T>;
|
|
1350
|
+
export function isOptionGroup<T>(item: OptionItem<T>): item is OptionGroup<T>;
|
|
1351
|
+
export function extractFlatOptions<T>(items?: OptionItem<T>[]): T[];
|
|
1352
|
+
export function buildRootItems<T>(groups: OptionGroup<T>[]): OptionItem<T>[];
|
|
1353
|
+
export function getItemsAtPath<T>(rootItems: OptionItem<T>[], path: number[]): OptionItem<T>[];
|
|
1354
|
+
export function findPathToValue<T>(items: OptionItem<T>[], targetValue: string, getOptionValue: (item: T) => string, currentPath?: number[]): number[] | null;
|
|
1355
|
+
export function hasNestedValue<T>(item: OptionItem<T>, targetValue: string, getOptionValue: (item: T) => string): boolean;
|
|
1356
|
+
}
|
|
1344
1357
|
declare module "packages/editor/src/state/types/types" {
|
|
1345
1358
|
import * as Ariakit from '@ariakit/react';
|
|
1346
1359
|
import { MutableRefObject, ReactInstance } from 'react';
|
|
@@ -1580,9 +1593,12 @@ declare module "packages/editor/src/state/types/types" {
|
|
|
1580
1593
|
};
|
|
1581
1594
|
schemaVersion?: number;
|
|
1582
1595
|
};
|
|
1596
|
+
export type { OptionGroup, OptionItem } from "packages/editor/src/engine/config/optionGroups";
|
|
1597
|
+
export type FontGroup = import("packages/editor/src/engine/config/optionGroups").OptionGroup<CustomFont>;
|
|
1598
|
+
export type FontItem = import("packages/editor/src/engine/config/optionGroups").OptionItem<CustomFont>;
|
|
1583
1599
|
export type Fonts = {
|
|
1584
1600
|
showDefaultFonts?: boolean;
|
|
1585
|
-
customFonts?:
|
|
1601
|
+
customFonts?: FontItem[];
|
|
1586
1602
|
};
|
|
1587
1603
|
export type Icon = {
|
|
1588
1604
|
name?: string;
|
|
@@ -1962,14 +1978,32 @@ declare module "packages/editor/src/engine/config/callbacks" {
|
|
|
1962
1978
|
remove: () => void;
|
|
1963
1979
|
};
|
|
1964
1980
|
}
|
|
1981
|
+
declare module "packages/editor/src/engine/utils/fonts" {
|
|
1982
|
+
/**
|
|
1983
|
+
* Extracts the primary (first) font from a CSS font-family value.
|
|
1984
|
+
* Handles quoted fonts like "'Open Sans', Arial, sans-serif" -> "Open Sans"
|
|
1985
|
+
* And unquoted fonts like "arial,helvetica,sans-serif" -> "arial"
|
|
1986
|
+
*/
|
|
1987
|
+
export function extractPrimaryFont(fontFamily: string | undefined): string;
|
|
1988
|
+
export function parseFontFamily(fontFamily: string | undefined): string[];
|
|
1989
|
+
export function fontsMatch(fontA: string | undefined, fontB: string | undefined): boolean;
|
|
1990
|
+
export function findMatchingFont(fontFamily: string | undefined, availableFonts: Array<{
|
|
1991
|
+
label: string;
|
|
1992
|
+
value: string;
|
|
1993
|
+
}>): string;
|
|
1994
|
+
}
|
|
1965
1995
|
declare module "packages/editor/src/engine/config/fonts" {
|
|
1966
1996
|
import { z } from 'zod';
|
|
1967
1997
|
import { FontZodSchema } from '@libs/schemas/common/schemas';
|
|
1998
|
+
import { OptionGroup, OptionItem } from "packages/editor/src/engine/config/optionGroups";
|
|
1968
1999
|
export type Font = z.infer<typeof FontZodSchema>;
|
|
1969
2000
|
export type FontList = Font[];
|
|
2001
|
+
export type FontGroup = OptionGroup<Font>;
|
|
2002
|
+
export type FontItem = OptionItem<Font>;
|
|
2003
|
+
export function isFontGroup(item: FontItem): item is FontGroup;
|
|
1970
2004
|
export interface FontConfig {
|
|
1971
2005
|
showDefaultFonts?: boolean;
|
|
1972
|
-
customFonts?:
|
|
2006
|
+
customFonts?: FontItem[];
|
|
1973
2007
|
}
|
|
1974
2008
|
export interface FontOptions {
|
|
1975
2009
|
showCustomFonts?: boolean;
|
|
@@ -1982,6 +2016,7 @@ declare module "packages/editor/src/engine/config/fonts" {
|
|
|
1982
2016
|
export function getFontsVersion(): number;
|
|
1983
2017
|
export function getCustomFontsCount(): number;
|
|
1984
2018
|
export const defaultFontWeights: number[];
|
|
2019
|
+
export function getGroupedFonts(options?: FontOptions): FontGroup[] | null;
|
|
1985
2020
|
}
|
|
1986
2021
|
declare module "packages/editor/src/engine/config/safeHtml" {
|
|
1987
2022
|
import { Config } from 'dompurify';
|
package/package.json
CHANGED