@developer_tribe/react-builder 1.2.0 → 1.2.1
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/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/pages/ProjectPage.d.ts +10 -3
- package/dist/types/Fonts.d.ts +5 -1
- package/package.json +1 -1
- package/src/pages/ProjectPage.tsx +15 -5
- package/src/types/Fonts.ts +5 -1
|
@@ -10,7 +10,14 @@ export type ProjectPageProps = {
|
|
|
10
10
|
projectColors?: ProjectColors;
|
|
11
11
|
onSaveProjectColors?: (colors: ProjectColors) => void;
|
|
12
12
|
name?: string;
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
typography: {
|
|
14
|
+
fonts: Fonts;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Optional. If omitted, `ProjectPage` will infer it from `typography.fonts`:
|
|
18
|
+
* - first font with `isMain: true`
|
|
19
|
+
* - else first font in the list
|
|
20
|
+
*/
|
|
21
|
+
appFont?: string | undefined;
|
|
15
22
|
};
|
|
16
|
-
export declare function ProjectPage({ project, appConfig, onSaveProject, logLevel, projectColors, onSaveProjectColors, name,
|
|
23
|
+
export declare function ProjectPage({ project, appConfig, onSaveProject, logLevel, projectColors, onSaveProjectColors, name, typography, appFont, }: ProjectPageProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/types/Fonts.d.ts
CHANGED
|
@@ -3,10 +3,14 @@ export type FontWeightKey = string;
|
|
|
3
3
|
/** URL to a font file (ttf/otf/woff/woff2). */
|
|
4
4
|
export type FontFileUrl = string;
|
|
5
5
|
/** Map of font-weight -> font file URL. */
|
|
6
|
-
export type FontFamilySources = Record<FontWeightKey, FontFileUrl>;
|
|
6
|
+
export type FontFamilySources = Record<FontWeightKey, FontFileUrl | undefined>;
|
|
7
7
|
export type FontDefinition = {
|
|
8
8
|
name: string;
|
|
9
9
|
family: FontFamilySources;
|
|
10
10
|
projects?: string[];
|
|
11
|
+
/** Optional language target for this font (e.g. "ar"). */
|
|
12
|
+
targetLanguage?: string;
|
|
13
|
+
/** Optional marker to pick a default app font. */
|
|
14
|
+
isMain?: boolean;
|
|
11
15
|
};
|
|
12
16
|
export type Fonts = FontDefinition[];
|
package/package.json
CHANGED
|
@@ -44,9 +44,15 @@ export type ProjectPageProps = {
|
|
|
44
44
|
projectColors?: ProjectColors;
|
|
45
45
|
onSaveProjectColors?: (colors: ProjectColors) => void;
|
|
46
46
|
name?: string;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
typography: {
|
|
48
|
+
fonts: Fonts;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Optional. If omitted, `ProjectPage` will infer it from `typography.fonts`:
|
|
52
|
+
* - first font with `isMain: true`
|
|
53
|
+
* - else first font in the list
|
|
54
|
+
*/
|
|
55
|
+
appFont?: string | undefined;
|
|
50
56
|
};
|
|
51
57
|
|
|
52
58
|
const MOBILE_BREAKPOINT = 1000;
|
|
@@ -59,12 +65,16 @@ export function ProjectPage({
|
|
|
59
65
|
projectColors,
|
|
60
66
|
onSaveProjectColors,
|
|
61
67
|
name,
|
|
62
|
-
|
|
68
|
+
typography,
|
|
63
69
|
appFont,
|
|
64
70
|
}: ProjectPageProps) {
|
|
65
71
|
useLogRender('ProjectPage');
|
|
66
72
|
useSyncHtmlThemeClass();
|
|
67
|
-
|
|
73
|
+
const resolvedAppFont =
|
|
74
|
+
appFont ??
|
|
75
|
+
typography.fonts.find((f) => f?.isMain)?.name ??
|
|
76
|
+
typography.fonts[0]?.name;
|
|
77
|
+
useProjectFonts({ fonts: typography.fonts, appFont: resolvedAppFont });
|
|
68
78
|
const resolvedName = name ?? project.name;
|
|
69
79
|
const resolvedProjectColors = projectColors ?? project.projectColors;
|
|
70
80
|
const isEmptyProjectData =
|
package/src/types/Fonts.ts
CHANGED
|
@@ -5,12 +5,16 @@ export type FontWeightKey = string;
|
|
|
5
5
|
export type FontFileUrl = string;
|
|
6
6
|
|
|
7
7
|
/** Map of font-weight -> font file URL. */
|
|
8
|
-
export type FontFamilySources = Record<FontWeightKey, FontFileUrl>;
|
|
8
|
+
export type FontFamilySources = Record<FontWeightKey, FontFileUrl | undefined>;
|
|
9
9
|
|
|
10
10
|
export type FontDefinition = {
|
|
11
11
|
name: string;
|
|
12
12
|
family: FontFamilySources;
|
|
13
13
|
projects?: string[];
|
|
14
|
+
/** Optional language target for this font (e.g. "ar"). */
|
|
15
|
+
targetLanguage?: string;
|
|
16
|
+
/** Optional marker to pick a default app font. */
|
|
17
|
+
isMain?: boolean;
|
|
14
18
|
};
|
|
15
19
|
|
|
16
20
|
export type Fonts = FontDefinition[];
|