@webiny/website-builder-sdk 0.0.0-unstable.e53eceafb5 → 0.0.0-unstable.f9f12f52a0
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/Theme.js +3 -1
- package/Theme.js.map +1 -1
- package/createTheme.d.ts +1 -0
- package/createTheme.js.map +1 -1
- package/package.json +4 -4
- package/types/WebsiteBuilderTheme.d.ts +15 -2
- package/types/WebsiteBuilderTheme.js.map +1 -1
package/Theme.js
CHANGED
|
@@ -16,7 +16,9 @@ export class Theme {
|
|
|
16
16
|
});
|
|
17
17
|
});
|
|
18
18
|
return {
|
|
19
|
-
|
|
19
|
+
css: input.css,
|
|
20
|
+
cssVariables: input.cssVariables,
|
|
21
|
+
fonts: input.fonts,
|
|
20
22
|
breakpoints: breakpoints.sort((a, b) => b.maxWidth - a.maxWidth),
|
|
21
23
|
lexical: createLexicalTheme(input?.lexical),
|
|
22
24
|
styles: {
|
package/Theme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["deepMerge","defaultBreakpoints","createLexicalTheme","Theme","from","input","custom","builtInOverrides","breakpoints","mergedBreakpoints","all","Object","entries","forEach","name","breakpoint","push","
|
|
1
|
+
{"version":3,"names":["deepMerge","defaultBreakpoints","createLexicalTheme","Theme","from","input","custom","builtInOverrides","breakpoints","mergedBreakpoints","all","Object","entries","forEach","name","breakpoint","push","css","cssVariables","fonts","sort","a","b","maxWidth","lexical","styles","colors","typography"],"sources":["Theme.ts"],"sourcesContent":["import deepMerge from \"deepmerge\";\nimport type {\n Breakpoint,\n WebsiteBuilderTheme,\n WebsiteBuilderThemeInput\n} from \"~/types/WebsiteBuilderTheme\";\nimport { defaultBreakpoints } from \"~/defaultBreakpoints\";\nimport { createLexicalTheme } from \"~/lexical/createLexicalTheme\";\n\nexport class Theme {\n static from(input: WebsiteBuilderThemeInput): WebsiteBuilderTheme {\n const { custom = {}, ...builtInOverrides } = input?.breakpoints ?? {};\n\n const mergedBreakpoints = deepMerge.all([\n {},\n defaultBreakpoints,\n builtInOverrides,\n custom\n ]) as WebsiteBuilderThemeInput[\"breakpoints\"];\n\n const breakpoints: Breakpoint[] = [];\n Object.entries(mergedBreakpoints ?? {}).forEach(([name, breakpoint]) => {\n breakpoints.push({\n name,\n ...(breakpoint as Omit<Breakpoint, \"name\">)\n });\n });\n\n return {\n css: input.css,\n cssVariables: input.cssVariables,\n fonts: input.fonts,\n breakpoints: breakpoints.sort((a, b) => b.maxWidth - a.maxWidth),\n lexical: createLexicalTheme(input?.lexical),\n styles: {\n colors: {\n ...input?.styles?.colors\n },\n typography: {\n ...input?.styles?.typography\n }\n }\n };\n }\n}\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,WAAW;AAMjC,SAASC,kBAAkB;AAC3B,SAASC,kBAAkB;AAE3B,OAAO,MAAMC,KAAK,CAAC;EACf,OAAOC,IAAIA,CAACC,KAA+B,EAAuB;IAC9D,MAAM;MAAEC,MAAM,GAAG,CAAC,CAAC;MAAE,GAAGC;IAAiB,CAAC,GAAGF,KAAK,EAAEG,WAAW,IAAI,CAAC,CAAC;IAErE,MAAMC,iBAAiB,GAAGT,SAAS,CAACU,GAAG,CAAC,CACpC,CAAC,CAAC,EACFT,kBAAkB,EAClBM,gBAAgB,EAChBD,MAAM,CACT,CAA4C;IAE7C,MAAME,WAAyB,GAAG,EAAE;IACpCG,MAAM,CAACC,OAAO,CAACH,iBAAiB,IAAI,CAAC,CAAC,CAAC,CAACI,OAAO,CAAC,CAAC,CAACC,IAAI,EAAEC,UAAU,CAAC,KAAK;MACpEP,WAAW,CAACQ,IAAI,CAAC;QACbF,IAAI;QACJ,GAAIC;MACR,CAAC,CAAC;IACN,CAAC,CAAC;IAEF,OAAO;MACHE,GAAG,EAAEZ,KAAK,CAACY,GAAG;MACdC,YAAY,EAAEb,KAAK,CAACa,YAAY;MAChCC,KAAK,EAAEd,KAAK,CAACc,KAAK;MAClBX,WAAW,EAAEA,WAAW,CAACY,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKA,CAAC,CAACC,QAAQ,GAAGF,CAAC,CAACE,QAAQ,CAAC;MAChEC,OAAO,EAAEtB,kBAAkB,CAACG,KAAK,EAAEmB,OAAO,CAAC;MAC3CC,MAAM,EAAE;QACJC,MAAM,EAAE;UACJ,GAAGrB,KAAK,EAAEoB,MAAM,EAAEC;QACtB,CAAC;QACDC,UAAU,EAAE;UACR,GAAGtB,KAAK,EAAEoB,MAAM,EAAEE;QACtB;MACJ;IACJ,CAAC;EACL;AACJ","ignoreList":[]}
|
package/createTheme.d.ts
CHANGED
package/createTheme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createTheme","theme"],"sources":["createTheme.ts"],"sourcesContent":["import type { WebsiteBuilderThemeInput } from \"~/types/WebsiteBuilderTheme\";\n\nexport const createTheme = (theme: WebsiteBuilderThemeInput) => {\n return theme;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["createTheme","theme"],"sources":["createTheme.ts"],"sourcesContent":["import type { WebsiteBuilderThemeInput } from \"~/types/WebsiteBuilderTheme\";\n\nexport type { WebsiteBuilderThemeInput };\n\nexport const createTheme = (theme: WebsiteBuilderThemeInput) => {\n return theme;\n};\n"],"mappings":"AAIA,OAAO,MAAMA,WAAW,GAAIC,KAA+B,IAAK;EAC5D,OAAOA,KAAK;AAChB,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/website-builder-sdk",
|
|
3
|
-
"version": "0.0.0-unstable.
|
|
3
|
+
"version": "0.0.0-unstable.f9f12f52a0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"@types/deep-equal": "1.0.4",
|
|
32
32
|
"@types/is-hotkey": "0.1.10",
|
|
33
33
|
"@types/micromatch": "4.0.9",
|
|
34
|
-
"@webiny/cli": "0.0.0-unstable.
|
|
35
|
-
"@webiny/project-utils": "0.0.0-unstable.
|
|
34
|
+
"@webiny/cli": "0.0.0-unstable.f9f12f52a0",
|
|
35
|
+
"@webiny/project-utils": "0.0.0-unstable.f9f12f52a0",
|
|
36
36
|
"typescript": "5.3.3"
|
|
37
37
|
},
|
|
38
38
|
"publishConfig": {
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
]
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "f9f12f52a0e2f8e4a2987aa71b4104f70f5d68c8"
|
|
54
54
|
}
|
|
@@ -8,7 +8,9 @@ export type Breakpoint = {
|
|
|
8
8
|
maxWidth: number;
|
|
9
9
|
};
|
|
10
10
|
export type WebsiteBuilderTheme = {
|
|
11
|
-
|
|
11
|
+
css?: string;
|
|
12
|
+
cssVariables?: Record<string, string>;
|
|
13
|
+
fonts?: string[];
|
|
12
14
|
breakpoints: Breakpoint[];
|
|
13
15
|
styles: {
|
|
14
16
|
colors: Record<string, any>;
|
|
@@ -33,7 +35,18 @@ export type TypographyStyle = {
|
|
|
33
35
|
};
|
|
34
36
|
export type Typography = Partial<Record<TypographyType, Readonly<TypographyStyle[]>>>;
|
|
35
37
|
export type WebsiteBuilderThemeInput = {
|
|
36
|
-
|
|
38
|
+
/**
|
|
39
|
+
* CSS to include in the editor.
|
|
40
|
+
*/
|
|
41
|
+
css?: string;
|
|
42
|
+
/**
|
|
43
|
+
* CSS variables to define in the editor.
|
|
44
|
+
*/
|
|
45
|
+
cssVariables?: Record<string, string>;
|
|
46
|
+
/**
|
|
47
|
+
* Fonts to load when the editor loads.
|
|
48
|
+
*/
|
|
49
|
+
fonts?: string[];
|
|
37
50
|
/**
|
|
38
51
|
* {
|
|
39
52
|
* title: "Desktop",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["WebsiteBuilderTheme.ts"],"sourcesContent":["import type { LexicalEditorTheme } from \"./LexicalEditorTheme\";\n\nexport type Breakpoint = {\n name: string;\n title: string;\n description: string;\n icon: string;\n minWidth: number;\n maxWidth: number;\n};\n\nexport type WebsiteBuilderTheme = {\n
|
|
1
|
+
{"version":3,"names":[],"sources":["WebsiteBuilderTheme.ts"],"sourcesContent":["import type { LexicalEditorTheme } from \"./LexicalEditorTheme\";\n\nexport type Breakpoint = {\n name: string;\n title: string;\n description: string;\n icon: string;\n minWidth: number;\n maxWidth: number;\n};\n\nexport type WebsiteBuilderTheme = {\n css?: string;\n cssVariables?: Record<string, string>;\n fonts?: string[];\n breakpoints: Breakpoint[];\n styles: {\n colors: Record<string, any>;\n typography: Typography;\n };\n lexical: LexicalEditorTheme;\n};\ntype KnownKeys = \"desktop\" | \"tablet\" | \"mobile\";\n\ntype BreakpointBase = Omit<Breakpoint, \"name\">;\n\ntype KnownBreakpoints = Partial<Record<KnownKeys, Partial<BreakpointBase>>>;\n\n// This merges both, while avoiding overlap issues\ntype Breakpoints = KnownBreakpoints & {\n custom?: {\n [K in string as K extends KnownKeys ? never : K]: BreakpointBase;\n };\n};\n\n// We want to allow custom strings as well, thus the (string & {}).\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport type TypographyType = \"headings\" | \"paragraphs\" | \"quotes\" | \"lists\" | (string & {});\n\nexport type TypographyStyle = {\n id: string;\n name: string;\n tag: string;\n className: string;\n};\n\nexport type Typography = Partial<Record<TypographyType, Readonly<TypographyStyle[]>>>;\n\nexport type WebsiteBuilderThemeInput = {\n /**\n * CSS to include in the editor.\n */\n css?: string;\n /**\n * CSS variables to define in the editor.\n */\n cssVariables?: Record<string, string>;\n /**\n * Fonts to load when the editor loads.\n */\n fonts?: string[];\n /**\n * {\n * title: \"Desktop\",\n * description: `Desktop styles apply at all breakpoints, unless they're edited at a lower breakpoint. Start your styling here.`,\n * icon: \"Inline SVG or a link to an SVG.\",\n * minWidth: 0,\n * maxWidth: 4000\n * }\n */\n breakpoints?: Breakpoints;\n lexical?: LexicalEditorTheme;\n styles?: {\n /**\n * color1: \"#fa5723\",\n * color2: \"#00ccb0\",\n */\n colors?: Record<string, any>;\n /**\n * headings: [\n * {\n * id: \"heading1\",\n * name: \"Heading 1\",\n * tag: \"h1\"\n * },\n * ],\n * paragraphs: [\n * {\n * id: \"paragraph1\",\n * name: \"Paragraph 1\",\n * tag: \"p\",\n * ],\n * quotes: [\n * {\n * id: \"quote\",\n * name: \"Quote\",\n * tag: \"blockquote\"\n * }\n * ]\n */\n typography?: Typography;\n };\n};\n"],"mappings":"","ignoreList":[]}
|