@webiny/website-builder-sdk 0.0.0-unstable.e53eceafb5 → 0.0.0-unstable.fdd9228b5d
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/ViewportManager.js +3 -0
- package/ViewportManager.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 +16 -3
- package/types/WebsiteBuilderTheme.js.map +1 -1
- package/types.d.ts +1 -6
- package/types.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/ViewportManager.js
CHANGED
package/ViewportManager.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["environment","ViewportManager","breakpoints","name","minWidth","maxWidth","constructor","timeout","changeTimeout","changeStartSubscribers","Set","changeEndSubscribers","isChanging","changeTimer","handleViewportChange","bind","handleResize","isClient","window","addEventListener","passive","setBreakpoints","onViewportChangeStart","callback","add","delete","onViewportChangeEnd","getViewport","getViewportInfo","destroy","removeEventListener","clearTimeout","clear","viewportInfo","notifySubscribers","setTimeout","modes","reverse","viewport","width","innerWidth","height","innerHeight","scrollX","scrollY","breakpoint","filter","mode","subscribers","forEach","viewportManager"],"sources":["ViewportManager.ts"],"sourcesContent":["\"use client\";\nimport type { Breakpoint } from \"~/types\";\nimport { environment } from \"~/Environment\";\n\nexport interface ViewportInfo {\n width: number;\n height: number;\n scrollX: number;\n scrollY: number;\n breakpoint: string;\n breakpoints: Breakpoint[];\n}\n\nexport class ViewportManager {\n private readonly changeTimeout: number;\n private readonly changeStartSubscribers: Set<(info: ViewportInfo) => void>;\n private readonly changeEndSubscribers: Set<(info: ViewportInfo) => void>;\n private isChanging: boolean;\n private changeTimer: number | null;\n\n /**\n * We need this fallback breakpoint for server environments.\n */\n private breakpoints: Breakpoint[] = [\n {\n name: \"desktop\",\n minWidth: 0,\n maxWidth: 4000\n }\n ];\n\n constructor(timeout: number = 150) {\n this.changeTimeout = timeout;\n this.changeStartSubscribers = new Set();\n this.changeEndSubscribers = new Set();\n this.isChanging = false;\n this.changeTimer = null;\n\n this.handleViewportChange = this.handleViewportChange.bind(this);\n this.handleResize = this.handleResize.bind(this);\n\n if (environment.isClient()) {\n window.addEventListener(\"resize\", this.handleResize, { passive: true });\n }\n }\n\n public setBreakpoints(breakpoints: Breakpoint[]) {\n this.breakpoints = breakpoints;\n }\n\n public onViewportChangeStart(callback: (info: ViewportInfo) => void): () => void {\n this.changeStartSubscribers.add(callback);\n return () => this.changeStartSubscribers.delete(callback);\n }\n\n public onViewportChangeEnd(callback: (info: ViewportInfo) => void): () => void {\n this.changeEndSubscribers.add(callback);\n return () => this.changeEndSubscribers.delete(callback);\n }\n\n /**\n * Get the current viewport information\n */\n public getViewport(): ViewportInfo {\n return this.getViewportInfo();\n }\n\n public destroy(): void {\n if (environment.isClient()) {\n window.removeEventListener(\"resize\", this.handleResize);\n if (this.changeTimer !== null) {\n clearTimeout(this.changeTimer);\n }\n this.changeStartSubscribers.clear();\n this.changeEndSubscribers.clear();\n }\n }\n\n private handleResize(): void {\n this.handleViewportChange();\n }\n\n private handleViewportChange(): void {\n const viewportInfo = this.getViewportInfo();\n\n if (!this.isChanging) {\n this.isChanging = true;\n this.notifySubscribers(this.changeStartSubscribers, viewportInfo);\n }\n\n if (this.changeTimer !== null) {\n clearTimeout(this.changeTimer);\n }\n\n this.changeTimer = window.setTimeout(() => {\n this.isChanging = false;\n this.notifySubscribers(this.changeEndSubscribers, viewportInfo);\n }, this.changeTimeout);\n }\n\n private getViewportInfo(): ViewportInfo {\n const modes = [...this.breakpoints].reverse();\n const viewport = environment.isClient()\n ? {\n width: window.innerWidth,\n height: window.innerHeight,\n scrollX: window.scrollX,\n scrollY: window.scrollY\n }\n : {\n // During SSR or Next.js build, viewport is not available.\n height: 0,\n width: 2000,\n scrollX: 0,\n scrollY: 0\n };\n\n const [breakpoint] = modes.filter(mode => mode.maxWidth >= viewport.width);\n\n return { ...viewport, breakpoint: breakpoint.name, breakpoints: this.breakpoints };\n }\n\n private notifySubscribers(\n subscribers: Set<(info: ViewportInfo) => void>,\n viewportInfo: ViewportInfo\n ): void {\n subscribers.forEach(callback => {\n if (typeof callback === \"function\") {\n callback(viewportInfo);\n }\n });\n }\n}\n\nexport const viewportManager = new ViewportManager();\n"],"mappings":"AAAA,YAAY;;AAEZ,SAASA,WAAW;AAWpB,OAAO,MAAMC,eAAe,CAAC;EAOzB;AACJ;AACA;EACYC,WAAW,GAAiB,CAChC;IACIC,IAAI,EAAE,SAAS;IACfC,QAAQ,EAAE,CAAC;IACXC,QAAQ,EAAE;EACd,CAAC,CACJ;EAEDC,WAAWA,CAACC,OAAe,GAAG,GAAG,EAAE;IAC/B,IAAI,CAACC,aAAa,GAAGD,OAAO;IAC5B,IAAI,CAACE,sBAAsB,GAAG,IAAIC,GAAG,CAAC,CAAC;IACvC,IAAI,CAACC,oBAAoB,GAAG,IAAID,GAAG,CAAC,CAAC;IACrC,IAAI,CAACE,UAAU,GAAG,KAAK;IACvB,IAAI,CAACC,WAAW,GAAG,IAAI;IAEvB,IAAI,CAACC,oBAAoB,GAAG,IAAI,CAACA,oBAAoB,CAACC,IAAI,CAAC,IAAI,CAAC;IAChE,IAAI,CAACC,YAAY,GAAG,IAAI,CAACA,YAAY,CAACD,IAAI,CAAC,IAAI,CAAC;IAEhD,
|
|
1
|
+
{"version":3,"names":["environment","ViewportManager","breakpoints","name","title","description","icon","minWidth","maxWidth","constructor","timeout","changeTimeout","changeStartSubscribers","Set","changeEndSubscribers","isChanging","changeTimer","handleViewportChange","bind","handleResize","isClient","window","addEventListener","passive","setBreakpoints","onViewportChangeStart","callback","add","delete","onViewportChangeEnd","getViewport","getViewportInfo","destroy","removeEventListener","clearTimeout","clear","viewportInfo","notifySubscribers","setTimeout","modes","reverse","viewport","width","innerWidth","height","innerHeight","scrollX","scrollY","breakpoint","filter","mode","subscribers","forEach","viewportManager"],"sources":["ViewportManager.ts"],"sourcesContent":["\"use client\";\nimport type { Breakpoint } from \"~/types\";\nimport { environment } from \"~/Environment\";\n\nexport interface ViewportInfo {\n width: number;\n height: number;\n scrollX: number;\n scrollY: number;\n breakpoint: string;\n breakpoints: Breakpoint[];\n}\n\nexport class ViewportManager {\n private readonly changeTimeout: number;\n private readonly changeStartSubscribers: Set<(info: ViewportInfo) => void>;\n private readonly changeEndSubscribers: Set<(info: ViewportInfo) => void>;\n private isChanging: boolean;\n private changeTimer: number | null;\n\n /**\n * We need this fallback breakpoint for server environments.\n */\n private breakpoints: Breakpoint[] = [\n {\n name: \"desktop\",\n title: \"\",\n description: \"\",\n icon: \"\",\n minWidth: 0,\n maxWidth: 4000\n }\n ];\n\n constructor(timeout: number = 150) {\n this.changeTimeout = timeout;\n this.changeStartSubscribers = new Set();\n this.changeEndSubscribers = new Set();\n this.isChanging = false;\n this.changeTimer = null;\n\n this.handleViewportChange = this.handleViewportChange.bind(this);\n this.handleResize = this.handleResize.bind(this);\n\n if (environment.isClient()) {\n window.addEventListener(\"resize\", this.handleResize, { passive: true });\n }\n }\n\n public setBreakpoints(breakpoints: Breakpoint[]) {\n this.breakpoints = breakpoints;\n }\n\n public onViewportChangeStart(callback: (info: ViewportInfo) => void): () => void {\n this.changeStartSubscribers.add(callback);\n return () => this.changeStartSubscribers.delete(callback);\n }\n\n public onViewportChangeEnd(callback: (info: ViewportInfo) => void): () => void {\n this.changeEndSubscribers.add(callback);\n return () => this.changeEndSubscribers.delete(callback);\n }\n\n /**\n * Get the current viewport information\n */\n public getViewport(): ViewportInfo {\n return this.getViewportInfo();\n }\n\n public destroy(): void {\n if (environment.isClient()) {\n window.removeEventListener(\"resize\", this.handleResize);\n if (this.changeTimer !== null) {\n clearTimeout(this.changeTimer);\n }\n this.changeStartSubscribers.clear();\n this.changeEndSubscribers.clear();\n }\n }\n\n private handleResize(): void {\n this.handleViewportChange();\n }\n\n private handleViewportChange(): void {\n const viewportInfo = this.getViewportInfo();\n\n if (!this.isChanging) {\n this.isChanging = true;\n this.notifySubscribers(this.changeStartSubscribers, viewportInfo);\n }\n\n if (this.changeTimer !== null) {\n clearTimeout(this.changeTimer);\n }\n\n this.changeTimer = window.setTimeout(() => {\n this.isChanging = false;\n this.notifySubscribers(this.changeEndSubscribers, viewportInfo);\n }, this.changeTimeout);\n }\n\n private getViewportInfo(): ViewportInfo {\n const modes = [...this.breakpoints].reverse();\n const viewport = environment.isClient()\n ? {\n width: window.innerWidth,\n height: window.innerHeight,\n scrollX: window.scrollX,\n scrollY: window.scrollY\n }\n : {\n // During SSR or Next.js build, viewport is not available.\n height: 0,\n width: 2000,\n scrollX: 0,\n scrollY: 0\n };\n\n const [breakpoint] = modes.filter(mode => mode.maxWidth >= viewport.width);\n\n return { ...viewport, breakpoint: breakpoint.name, breakpoints: this.breakpoints };\n }\n\n private notifySubscribers(\n subscribers: Set<(info: ViewportInfo) => void>,\n viewportInfo: ViewportInfo\n ): void {\n subscribers.forEach(callback => {\n if (typeof callback === \"function\") {\n callback(viewportInfo);\n }\n });\n }\n}\n\nexport const viewportManager = new ViewportManager();\n"],"mappings":"AAAA,YAAY;;AAEZ,SAASA,WAAW;AAWpB,OAAO,MAAMC,eAAe,CAAC;EAOzB;AACJ;AACA;EACYC,WAAW,GAAiB,CAChC;IACIC,IAAI,EAAE,SAAS;IACfC,KAAK,EAAE,EAAE;IACTC,WAAW,EAAE,EAAE;IACfC,IAAI,EAAE,EAAE;IACRC,QAAQ,EAAE,CAAC;IACXC,QAAQ,EAAE;EACd,CAAC,CACJ;EAEDC,WAAWA,CAACC,OAAe,GAAG,GAAG,EAAE;IAC/B,IAAI,CAACC,aAAa,GAAGD,OAAO;IAC5B,IAAI,CAACE,sBAAsB,GAAG,IAAIC,GAAG,CAAC,CAAC;IACvC,IAAI,CAACC,oBAAoB,GAAG,IAAID,GAAG,CAAC,CAAC;IACrC,IAAI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AACC,IAAI,IAAIA,IAAI,CAAC1C,QAAQ,IAAIiC,QAAQ,CAACC,KAAK,CAAC;IAE1E,OAAO;MAAE,GAAGD,QAAQ;MAAEO,UAAU,EAAEA,UAAU,CAAC7C,IAAI;MAAED,WAAW,EAAE,IAAI,CAACA;IAAY,CAAC;EACtF;EAEQmC,iBAAiBA,CACrBc,WAA8C,EAC9Cf,YAA0B,EACtB;IACJe,WAAW,CAACC,OAAO,CAAC1B,QAAQ,IAAI;MAC5B,IAAI,OAAOA,QAAQ,KAAK,UAAU,EAAE;QAChCA,QAAQ,CAACU,YAAY,CAAC;MAC1B;IACJ,CAAC,CAAC;EACN;AACJ;AAEA,OAAO,MAAMiB,eAAe,GAAG,IAAIpD,eAAe,CAAC,CAAC","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.fdd9228b5d",
|
|
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.fdd9228b5d",
|
|
35
|
+
"@webiny/project-utils": "0.0.0-unstable.fdd9228b5d",
|
|
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": "fdd9228b5d2636463e8a34b6e0d26eea1e29c01d"
|
|
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>;
|
|
@@ -31,9 +33,20 @@ export type TypographyStyle = {
|
|
|
31
33
|
tag: string;
|
|
32
34
|
className: string;
|
|
33
35
|
};
|
|
34
|
-
export type Typography = Partial<Record<TypographyType,
|
|
36
|
+
export type Typography = Partial<Record<TypographyType, 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, 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":[]}
|
package/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type * as CSS from "csstype";
|
|
2
2
|
import type { BindingsApi } from "./BindingsApi";
|
|
3
3
|
import type { ShorthandCssProperties } from "./types/ShorthandCssProperties";
|
|
4
|
-
export type { WebsiteBuilderTheme } from "./types/WebsiteBuilderTheme";
|
|
4
|
+
export type { WebsiteBuilderTheme, Breakpoint } from "./types/WebsiteBuilderTheme";
|
|
5
5
|
interface CSSProperties extends CSS.Properties<string | number> {
|
|
6
6
|
}
|
|
7
7
|
export type ElementMap = Record<string, DocumentElement>;
|
|
@@ -213,11 +213,6 @@ export interface IContentSdk {
|
|
|
213
213
|
getPage(path: string): Promise<PublicPage | null>;
|
|
214
214
|
listPages(options?: ListPagesOptions): Promise<PublicPage[]>;
|
|
215
215
|
}
|
|
216
|
-
export type Breakpoint = {
|
|
217
|
-
name: string;
|
|
218
|
-
minWidth: number;
|
|
219
|
-
maxWidth: number;
|
|
220
|
-
};
|
|
221
216
|
export type BaseInput<T = any> = {
|
|
222
217
|
name: string;
|
|
223
218
|
type: string;
|
package/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type * as CSS from \"csstype\";\nimport type { BindingsApi } from \"~/BindingsApi\";\nimport type { ShorthandCssProperties } from \"./types/ShorthandCssProperties\";\nexport type { WebsiteBuilderTheme } from \"./types/WebsiteBuilderTheme\";\n\ninterface CSSProperties extends CSS.Properties<string | number> {}\n\nexport type ElementMap = Record<string, DocumentElement>;\n\nexport type DocumentState = Record<string, any>;\n\nexport type InputValueBinding<T = any> = ValueBinding<T> & {\n id: string;\n type: string;\n translatable?: boolean;\n list?: boolean;\n};\n\nexport type StyleValueBinding<T = any> = ValueBinding<T>;\n\nexport type ValueBinding<T = any> = {\n static?: T;\n expression?: string;\n};\n\nexport type RepeatValueBinding = {\n expression: string;\n};\n\nexport type CssProperties = Omit<CSSProperties, ShorthandCssProperties>;\n\nexport type DocumentElementStyleBindings = Partial<{\n [K in keyof CssProperties]: StyleValueBinding<CssProperties[K]>;\n}>;\n\nexport type DocumentElementInputBindings = {\n [inputName: string]: InputValueBinding;\n};\n\nexport type DocumentElementBindings = {\n $repeat?: RepeatValueBinding;\n inputs?: DocumentElementInputBindings;\n styles?: DocumentElementStyleBindings;\n metadata?: Record<string, any>;\n overrides?: {\n [key: string]: {\n inputs?: DocumentElementInputBindings;\n styles?: DocumentElementStyleBindings;\n };\n };\n};\n\nexport type DocumentBindings = {\n [elementId: string]: DocumentElementBindings;\n};\n\nexport type ResolvedComponent<TComponent = any> = {\n component: TComponent;\n inputs: Record<string, any>;\n manifest: ComponentManifest;\n styles: SerializableCSSStyleDeclaration;\n};\n\nexport type ResolvedElement = {\n id: string;\n inputs: Record<string, any>;\n styles: SerializableCSSStyleDeclaration;\n};\n\nexport type Component = {\n component: any;\n manifest: ComponentManifest;\n};\n\nexport type ComponentGroupItem = {\n // Name of the component.\n name: string;\n // Optionally, define an exact element to insert.\n item?: DocumentElementTemplate;\n};\n\nexport type SerializedComponentGroup = ComponentGroup & {\n filter?: string;\n};\n\nexport type ComponentGroupFilterContext = {\n document: EditorDocument;\n};\n\nexport type ComponentGroup = {\n name: string;\n label: string;\n description?: string;\n filter?: (component: ComponentManifest, context: ComponentGroupFilterContext) => boolean;\n};\n\nexport type ResponsiveStyles = {\n [key: string]: SerializableCSSStyleDeclaration;\n};\n\nexport type ComponentManifest = {\n name: string;\n group?: string;\n label?: string;\n image?: string;\n inputs?: ComponentInput[];\n canDrag?: boolean;\n canDelete?: boolean;\n acceptsChildren?: boolean;\n hideFromToolbar?: boolean;\n hideStyleSettings?: string[];\n autoApplyStyles?: boolean;\n tags?: string[];\n defaults?: {\n inputs?: Record<string, any>;\n styles?: SerializableCSSStyleDeclaration;\n overrides?: {\n [breakpoint: string]: {\n inputs?: Record<string, any>;\n styles?: SerializableCSSStyleDeclaration;\n };\n };\n };\n};\n\nexport type DocumentElementTemplate = Omit<DocumentElement, \"id\">;\n\nexport type ElementComponent = {\n name: string;\n};\n\nexport type DocumentElement = {\n type: \"Webiny/Element\";\n id: string;\n component: ElementComponent;\n parent?: {\n id: string;\n slot: string;\n };\n styles?: ResponsiveStyles;\n};\n\nexport type SerializableCSSStyleDeclaration = {\n [K in keyof CssProperties]?: CssProperties[K];\n};\n\nexport type Document = {\n id: string;\n state: DocumentState;\n version: number;\n properties: Record<string, any>;\n bindings: DocumentBindings;\n elements: ElementMap;\n};\n\nexport type PublicPage = Pick<\n Page,\n \"id\" | \"version\" | \"properties\" | \"bindings\" | \"elements\" | \"state\"\n>;\n\nexport type EditorPage = EditorDocument & Pick<Page, \"properties\" | \"status\" | \"location\">;\n\nexport type EditorDocument = Document & {\n metadata: Record<string, any>;\n};\n\nexport type Page = Document & {\n id: string;\n status: string;\n version: number;\n location: {\n folderId: string;\n };\n properties: {\n title: string;\n snippet: string;\n /*image: {\n id: string;\n name: string;\n size: number;\n mimeType: string;\n src: string;\n };*/\n path: string;\n tags: string[];\n seo: {\n title: string;\n description: string;\n metaTags: Array<{ name: string; content: string }>;\n };\n social: {\n title: string;\n description: string;\n /*image: {\n id: string;\n name: string;\n size: number;\n mimeType: string;\n src: string;\n };*/\n metaTags: Array<{ property: string; content: string }>;\n };\n };\n};\n\nexport type Box = {\n depth: number;\n parentId: string;\n parentSlot: string;\n parentIndex: number;\n width: number;\n height: number;\n top: number;\n left: number;\n};\n\nexport type ElementBoxData = Box & {\n type: \"element\";\n};\n\nexport type ElementSlotBoxData = Box & {\n type: \"element-slot\";\n};\n\nexport type BoxData = ElementBoxData | ElementSlotBoxData;\n\nexport type EditorViewportInfo = PreviewViewportInfo & {\n top: number;\n left: number;\n};\n\nexport type PreviewViewportInfo = {\n width: number;\n height: number;\n scrollX: number;\n scrollY: number;\n};\n\nexport type BoxesData = Record<string, BoxData>;\n\nexport type EditorViewportData = {\n boxes: BoxesData;\n viewport: EditorViewportInfo;\n};\n\nexport type PreviewViewportData = {\n boxes: BoxesData;\n viewport: PreviewViewportInfo;\n};\n\nexport type ApiOptions = Record<string, any>;\n\nexport type GetPageOptions = ApiOptions;\nexport type ListPagesOptions = ApiOptions;\n\nexport interface IDataProvider {\n getPageByPath(path: string, options?: GetPageOptions): Promise<PublicPage | null>;\n getPageById(id: string, options?: GetPageOptions): Promise<PublicPage | null>;\n listPages(options?: ListPagesOptions): Promise<PublicPage[]>;\n}\n\nexport interface IEnvironment {\n isClient(): boolean;\n isServer(): boolean;\n isPreview(): boolean;\n}\n\nexport interface IContentSdk {\n getPage(path: string): Promise<PublicPage | null>;\n listPages(options?: ListPagesOptions): Promise<PublicPage[]>;\n}\n\
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type * as CSS from \"csstype\";\nimport type { BindingsApi } from \"~/BindingsApi\";\nimport type { ShorthandCssProperties } from \"./types/ShorthandCssProperties\";\nexport type { WebsiteBuilderTheme, Breakpoint } from \"./types/WebsiteBuilderTheme\";\n\ninterface CSSProperties extends CSS.Properties<string | number> {}\n\nexport type ElementMap = Record<string, DocumentElement>;\n\nexport type DocumentState = Record<string, any>;\n\nexport type InputValueBinding<T = any> = ValueBinding<T> & {\n id: string;\n type: string;\n translatable?: boolean;\n list?: boolean;\n};\n\nexport type StyleValueBinding<T = any> = ValueBinding<T>;\n\nexport type ValueBinding<T = any> = {\n static?: T;\n expression?: string;\n};\n\nexport type RepeatValueBinding = {\n expression: string;\n};\n\nexport type CssProperties = Omit<CSSProperties, ShorthandCssProperties>;\n\nexport type DocumentElementStyleBindings = Partial<{\n [K in keyof CssProperties]: StyleValueBinding<CssProperties[K]>;\n}>;\n\nexport type DocumentElementInputBindings = {\n [inputName: string]: InputValueBinding;\n};\n\nexport type DocumentElementBindings = {\n $repeat?: RepeatValueBinding;\n inputs?: DocumentElementInputBindings;\n styles?: DocumentElementStyleBindings;\n metadata?: Record<string, any>;\n overrides?: {\n [key: string]: {\n inputs?: DocumentElementInputBindings;\n styles?: DocumentElementStyleBindings;\n };\n };\n};\n\nexport type DocumentBindings = {\n [elementId: string]: DocumentElementBindings;\n};\n\nexport type ResolvedComponent<TComponent = any> = {\n component: TComponent;\n inputs: Record<string, any>;\n manifest: ComponentManifest;\n styles: SerializableCSSStyleDeclaration;\n};\n\nexport type ResolvedElement = {\n id: string;\n inputs: Record<string, any>;\n styles: SerializableCSSStyleDeclaration;\n};\n\nexport type Component = {\n component: any;\n manifest: ComponentManifest;\n};\n\nexport type ComponentGroupItem = {\n // Name of the component.\n name: string;\n // Optionally, define an exact element to insert.\n item?: DocumentElementTemplate;\n};\n\nexport type SerializedComponentGroup = ComponentGroup & {\n filter?: string;\n};\n\nexport type ComponentGroupFilterContext = {\n document: EditorDocument;\n};\n\nexport type ComponentGroup = {\n name: string;\n label: string;\n description?: string;\n filter?: (component: ComponentManifest, context: ComponentGroupFilterContext) => boolean;\n};\n\nexport type ResponsiveStyles = {\n [key: string]: SerializableCSSStyleDeclaration;\n};\n\nexport type ComponentManifest = {\n name: string;\n group?: string;\n label?: string;\n image?: string;\n inputs?: ComponentInput[];\n canDrag?: boolean;\n canDelete?: boolean;\n acceptsChildren?: boolean;\n hideFromToolbar?: boolean;\n hideStyleSettings?: string[];\n autoApplyStyles?: boolean;\n tags?: string[];\n defaults?: {\n inputs?: Record<string, any>;\n styles?: SerializableCSSStyleDeclaration;\n overrides?: {\n [breakpoint: string]: {\n inputs?: Record<string, any>;\n styles?: SerializableCSSStyleDeclaration;\n };\n };\n };\n};\n\nexport type DocumentElementTemplate = Omit<DocumentElement, \"id\">;\n\nexport type ElementComponent = {\n name: string;\n};\n\nexport type DocumentElement = {\n type: \"Webiny/Element\";\n id: string;\n component: ElementComponent;\n parent?: {\n id: string;\n slot: string;\n };\n styles?: ResponsiveStyles;\n};\n\nexport type SerializableCSSStyleDeclaration = {\n [K in keyof CssProperties]?: CssProperties[K];\n};\n\nexport type Document = {\n id: string;\n state: DocumentState;\n version: number;\n properties: Record<string, any>;\n bindings: DocumentBindings;\n elements: ElementMap;\n};\n\nexport type PublicPage = Pick<\n Page,\n \"id\" | \"version\" | \"properties\" | \"bindings\" | \"elements\" | \"state\"\n>;\n\nexport type EditorPage = EditorDocument & Pick<Page, \"properties\" | \"status\" | \"location\">;\n\nexport type EditorDocument = Document & {\n metadata: Record<string, any>;\n};\n\nexport type Page = Document & {\n id: string;\n status: string;\n version: number;\n location: {\n folderId: string;\n };\n properties: {\n title: string;\n snippet: string;\n /*image: {\n id: string;\n name: string;\n size: number;\n mimeType: string;\n src: string;\n };*/\n path: string;\n tags: string[];\n seo: {\n title: string;\n description: string;\n metaTags: Array<{ name: string; content: string }>;\n };\n social: {\n title: string;\n description: string;\n /*image: {\n id: string;\n name: string;\n size: number;\n mimeType: string;\n src: string;\n };*/\n metaTags: Array<{ property: string; content: string }>;\n };\n };\n};\n\nexport type Box = {\n depth: number;\n parentId: string;\n parentSlot: string;\n parentIndex: number;\n width: number;\n height: number;\n top: number;\n left: number;\n};\n\nexport type ElementBoxData = Box & {\n type: \"element\";\n};\n\nexport type ElementSlotBoxData = Box & {\n type: \"element-slot\";\n};\n\nexport type BoxData = ElementBoxData | ElementSlotBoxData;\n\nexport type EditorViewportInfo = PreviewViewportInfo & {\n top: number;\n left: number;\n};\n\nexport type PreviewViewportInfo = {\n width: number;\n height: number;\n scrollX: number;\n scrollY: number;\n};\n\nexport type BoxesData = Record<string, BoxData>;\n\nexport type EditorViewportData = {\n boxes: BoxesData;\n viewport: EditorViewportInfo;\n};\n\nexport type PreviewViewportData = {\n boxes: BoxesData;\n viewport: PreviewViewportInfo;\n};\n\nexport type ApiOptions = Record<string, any>;\n\nexport type GetPageOptions = ApiOptions;\nexport type ListPagesOptions = ApiOptions;\n\nexport interface IDataProvider {\n getPageByPath(path: string, options?: GetPageOptions): Promise<PublicPage | null>;\n getPageById(id: string, options?: GetPageOptions): Promise<PublicPage | null>;\n listPages(options?: ListPagesOptions): Promise<PublicPage[]>;\n}\n\nexport interface IEnvironment {\n isClient(): boolean;\n isServer(): boolean;\n isPreview(): boolean;\n}\n\nexport interface IContentSdk {\n getPage(path: string): Promise<PublicPage | null>;\n listPages(options?: ListPagesOptions): Promise<PublicPage[]>;\n}\n\n// Input types\n\n// inputTypes.ts\nexport type BaseInput<T = any> = {\n name: string;\n type: string;\n onChange?: (\n bindings: ReturnType<BindingsApi[\"getPublicApi\"]>,\n context: { breakpoint: string }\n ) => void;\n label?: string;\n description?: string;\n helperText?: string;\n defaultValue?: T;\n responsive?: boolean;\n required?: boolean;\n hideFromUi?: boolean;\n renderer?: string;\n list?: boolean;\n translatable?: boolean;\n};\n\n// Discriminated union per input type\nexport type TextInput = BaseInput<string> & {\n type: \"text\";\n};\n\nexport type SlotInput = BaseInput<any> & {\n type: \"slot\";\n components?: string[];\n};\n\nexport type TagsInput = BaseInput<string[]> & {\n type: \"text\";\n};\n\nexport type LongTextInput = BaseInput<string> & {\n type: \"longText\";\n};\n\nexport type NumberInput = BaseInput<number> & {\n type: \"number\";\n minValue?: number;\n};\n\nexport type BooleanInput = BaseInput<boolean> & {\n type: \"boolean\";\n};\n\nexport type ColorInput = BaseInput<string> & {\n type: \"color\";\n};\n\nexport type FileInput = BaseInput<string> & {\n type: \"file\";\n allowedFileTypes: string[];\n};\n\nexport type DateTimeInput = BaseInput<string> & {\n type: \"datetime\";\n};\n\nexport type LexicalInput = BaseInput<string> & {\n type: \"lexical\";\n};\n\nexport type SelectInput = BaseInput<string> & {\n type: \"select\";\n options: { label: string; value: string }[];\n showResetAction?: boolean;\n};\n\nexport type RadioInput = BaseInput<string> & {\n type: \"radio\";\n options: { label: string; value: string }[];\n};\n\nexport type ObjectInput = BaseInput<Record<string, any>> & {\n type: \"object\";\n fields: ComponentInput[];\n};\n\nexport type CustomInput = BaseInput<any> & {\n type: string;\n fields: ComponentInput[];\n};\n\n// Union of all input types\nexport type ComponentInput =\n | TextInput\n | LongTextInput\n | NumberInput\n | BooleanInput\n | ColorInput\n | FileInput\n | DateTimeInput\n | LexicalInput\n | SelectInput\n | RadioInput\n | TagsInput\n | ObjectInput\n | SlotInput\n | CustomInput;\n"],"mappings":"","ignoreList":[]}
|