@webiny/website-builder-sdk 6.0.0-alpha.5 → 6.0.0-rc.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/BindingsProcessor.test.js +1 -0
- package/BindingsProcessor.test.js.map +1 -1
- package/BindingsResolver.d.ts +1 -1
- package/BindingsResolver.js +2 -2
- package/BindingsResolver.js.map +1 -1
- package/BindingsResolver.test.js +1 -0
- package/BindingsResolver.test.js.map +1 -1
- package/DocumentStore.d.ts +1 -1
- package/ElementFactory.js.map +1 -1
- package/HotkeyManager.js +1 -1
- package/HotkeyManager.js.map +1 -1
- package/InheritanceProcessor.d.ts +2 -2
- package/InheritanceProcessor.test.js +1 -0
- package/InheritanceProcessor.test.js.map +1 -1
- package/InputsBindingsProcessor.test.js +1 -0
- package/InputsBindingsProcessor.test.js.map +1 -1
- package/InputsUpdater.d.ts +1 -1
- package/Logger.d.ts +2 -1
- package/README.md +10 -2
- package/StylesUpdater.d.ts +1 -1
- package/Theme.js +3 -10
- package/Theme.js.map +1 -1
- package/createInput.d.ts +123 -15
- package/createInput.js +32 -0
- package/createInput.js.map +1 -1
- package/dataProviders/DefaultDataProvider.d.ts +1 -1
- package/dataProviders/GET_PAGE_BY_ID.d.ts +1 -1
- package/dataProviders/GET_PAGE_BY_ID.js +1 -0
- package/dataProviders/GET_PAGE_BY_ID.js.map +1 -1
- package/dataProviders/GET_PAGE_BY_PATH.d.ts +1 -1
- package/dataProviders/GET_PAGE_BY_PATH.js +1 -0
- package/dataProviders/GET_PAGE_BY_PATH.js.map +1 -1
- package/dataProviders/LIST_PUBLISHED_PAGES.d.ts +1 -1
- package/dataProviders/LIST_PUBLISHED_PAGES.js +1 -0
- package/dataProviders/LIST_PUBLISHED_PAGES.js.map +1 -1
- package/documentOperations/SetGlobalStyleBinding.js.map +1 -1
- package/documentOperations/SetInputBindingOverride.js.map +1 -1
- package/documentOperations/SetStyleBindingOverride.js.map +1 -1
- package/generateElementId.d.ts +1 -1
- package/generateElementId.js +0 -1
- package/generateElementId.js.map +1 -1
- package/index.d.ts +1 -1
- package/index.js +0 -1
- package/index.js.map +1 -1
- package/jsonPatch.d.ts +1 -1
- package/messenger/Messenger.js +6 -6
- package/messenger/Messenger.js.map +1 -1
- package/package.json +14 -19
- package/types/WebsiteBuilderTheme.d.ts +42 -45
- package/types/WebsiteBuilderTheme.js.map +1 -1
- package/types.d.ts +26 -4
- package/types.js.map +1 -1
- package/lexical/createDefaultLexicalTheme.d.ts +0 -2
- package/lexical/createDefaultLexicalTheme.js +0 -84
- package/lexical/createDefaultLexicalTheme.js.map +0 -1
- package/lexical/createLexicalTheme.d.ts +0 -2
- package/lexical/createLexicalTheme.js +0 -7
- package/lexical/createLexicalTheme.js.map +0 -1
- package/lexical/deepMerge.d.ts +0 -1
- package/lexical/deepMerge.js +0 -23
- package/lexical/deepMerge.js.map +0 -1
- package/types/LexicalEditorTheme.d.ts +0 -2
- package/types/LexicalEditorTheme.js +0 -3
- package/types/LexicalEditorTheme.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["isMatch","logger","ignored","Messenger","listeners","Map","constructor","source","target","pattern","prefixGlob","replace","handleMessage","bind","window","addEventListener","event","type","payload","data","matches","logicalType","stripPrefix","isIgnored","debug","getTime","origin","handlers","get","forEach","fn","fullType","startsWith","slice","length","includes","on","handler","has","set","Set","add","delete","send","postMessage","dispose","removeEventListener","clear","date","Date","getHours","getMinutes","getSeconds","getMilliseconds"],"sources":["Messenger.ts"],"sourcesContent":["import { isMatch } from \"matcher\";\nimport type { MessageOrigin } from \"./MessageOrigin.js\";\nimport { logger } from \"../Logger.js\";\n\nexport type Message<T = any> = {\n type: string;\n payload: T;\n};\n\ntype Handler<T = any> = (payload: T, logicalType: string, wildcardMatch?: string) => void;\n\nconst ignored = [\n \"preview.mouse.move\",\n \"preview.component.register\",\n \"preview.scroll\",\n // \"preview.viewport\",\n \"preview.viewport.change.start\",\n \"preview.viewport.change.end\"\n];\n\nexport class Messenger {\n private listeners = new Map<string, Set<Handler>>();\n private readonly pattern: string;\n private readonly prefixGlob: string;\n\n constructor(\n private source: MessageOrigin,\n private target: MessageOrigin,\n // Pattern to filter events this Messenger handles.\n pattern: string\n ) {\n this.pattern = pattern;\n this.prefixGlob = pattern.replace(/\\*+$/, \"\");\n this.handleMessage = this.handleMessage.bind(this);\n this.source.window.addEventListener(\"message\", this.handleMessage);\n }\n\n private handleMessage(event: MessageEvent) {\n const { type, payload } = event.data || {};\n if (!this.target.matches(event)) {\n return;\n }\n\n if (!type || !isMatch(type, this.pattern)) {\n return;\n }\n\n const logicalType = this.stripPrefix(type);\n\n if (!this.isIgnored(logicalType)) {\n logger.debug(\n {\n type,\n payload\n },\n `${this.getTime()} --> [${this.source.origin}][${logicalType}]`\n );\n }\n\n const handlers = this.listeners.get(logicalType);\n if (handlers) {\n handlers.forEach(fn => fn(payload, logicalType));\n }\n }\n\n private stripPrefix(fullType: string): string {\n return fullType.startsWith(this.prefixGlob)\n ? fullType.slice(this.prefixGlob.length)\n : fullType;\n }\n\n private isIgnored(logicalType: string): boolean {\n return ignored.includes(logicalType);\n }\n\n on<T = any>(logicalType: string, handler: Handler<T>) {\n if (!this.listeners.has(logicalType)) {\n this.listeners.set(logicalType, new Set());\n }\n this.listeners.get(logicalType)!.add(handler);\n return () => {\n const listeners = this.listeners.get(logicalType);\n if (listeners) {\n listeners.delete(handler);\n }\n };\n }\n\n send<T = any>(logicalType: string, payload?: T) {\n const fullType = this.prefixGlob + logicalType;\n\n if (!this.isIgnored(logicalType)) {\n logger.debug(\n {\n type: fullType,\n payload\n },\n `${this.getTime()} <-- [${this.source.origin}][${logicalType}]`\n );\n }\n\n this.target.window.postMessage({ type: fullType, payload }, this.target.origin);\n }\n\n dispose() {\n this.source.window.removeEventListener(\"message\", this.handleMessage);\n this.listeners.clear();\n }\n\n getTime() {\n const date = new Date();\n return `${date.getHours()}:${date.getMinut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AS,CAACF,WAAW,CAAC,EAAE;MAC9BpB,MAAM,CAACuB,KAAK,CACR;QACIP,IAAI,EAAEc,QAAQ;QACdb;MACJ,CAAC,EACD,GAAG,IAAI,CAACO,OAAO,CAAC,CAAC,SAAS,IAAI,CAAClB,MAAM,CAACmB,MAAM,KAAKL,WAAW,GAChE,CAAC;IACL;IAEA,IAAI,CAACb,MAAM,CAACM,MAAM,CAAC8B,WAAW,CAAC;MAAE3B,IAAI,EAAEc,QAAQ;MAAEb;IAAQ,CAAC,EAAE,IAAI,CAACV,MAAM,CAACkB,MAAM,CAAC;EACnF;EAEAmB,OAAOA,CAAA,EAAG;IACN,IAAI,CAACtC,MAAM,CAACO,MAAM,CAACgC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAClC,aAAa,CAAC;IACrE,IAAI,CAACR,SAAS,CAAC2C,KAAK,CAAC,CAAC;EAC1B;EAEAtB,OAAOA,CAAA,EAAG;IACN,MAAMuB,IAAI,GAAG,IAAIC,IAAI,CAAC,CAAC;IACvB,OAAO,GAAGD,IAAI,CAACE,QAAQ,CAAC,CAAC,IAAIF,IAAI,CAACG,UAAU,CAAC,CAAC,IAAIH,IAAI,CAACI,UAAU,CAAC,CAAC,IAAIJ,IAAI,CAACK,eAAe,CAAC,CAAC,EAAE;EACnG;AACJ","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/website-builder-sdk",
|
|
3
|
-
"version": "6.0.0-
|
|
3
|
+
"version": "6.0.0-rc.0",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"main": "index.js",
|
|
5
6
|
"repository": {
|
|
6
7
|
"type": "git",
|
|
@@ -12,37 +13,31 @@
|
|
|
12
13
|
"author": "Pavel Denisjuk",
|
|
13
14
|
"license": "MIT",
|
|
14
15
|
"dependencies": {
|
|
15
|
-
"csstype": "3.
|
|
16
|
+
"csstype": "3.2.3",
|
|
16
17
|
"deep-equal": "2.2.3",
|
|
17
18
|
"deepmerge": "4.3.1",
|
|
18
19
|
"fast-json-patch": "3.1.1",
|
|
19
20
|
"fast-json-stable-stringify": "2.1.0",
|
|
20
21
|
"is-hotkey": "0.2.0",
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"nanoid": "
|
|
26
|
-
"
|
|
27
|
-
"pino": "
|
|
28
|
-
"pino-pretty": "9.4.0"
|
|
22
|
+
"lodash": "4.17.23",
|
|
23
|
+
"matcher": "5.0.0",
|
|
24
|
+
"mobx": "6.15.0",
|
|
25
|
+
"nanoid": "5.1.6",
|
|
26
|
+
"nanoid-dictionary": "5.0.0",
|
|
27
|
+
"pino": "9.14.0",
|
|
28
|
+
"pino-pretty": "9.4.1"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/deep-equal": "1.0.4",
|
|
32
32
|
"@types/is-hotkey": "0.1.10",
|
|
33
|
-
"@
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"typescript": "5.3.3"
|
|
33
|
+
"@webiny/build-tools": "6.0.0-rc.0",
|
|
34
|
+
"typescript": "5.9.3",
|
|
35
|
+
"vitest": "4.0.18"
|
|
37
36
|
},
|
|
38
37
|
"publishConfig": {
|
|
39
38
|
"access": "public",
|
|
40
39
|
"directory": "dist"
|
|
41
40
|
},
|
|
42
|
-
"scripts": {
|
|
43
|
-
"build": "yarn webiny run build",
|
|
44
|
-
"watch": "yarn webiny run watch"
|
|
45
|
-
},
|
|
46
41
|
"adio": {
|
|
47
42
|
"ignore": {
|
|
48
43
|
"dependencies": [
|
|
@@ -50,5 +45,5 @@
|
|
|
50
45
|
]
|
|
51
46
|
}
|
|
52
47
|
},
|
|
53
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "0f2aa699f4642e550ab62c96fcd050e8d02345c9"
|
|
54
49
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { LexicalEditorTheme } from "./LexicalEditorTheme.js";
|
|
2
1
|
export type Breakpoint = {
|
|
3
2
|
name: string;
|
|
4
3
|
title: string;
|
|
@@ -9,14 +8,10 @@ export type Breakpoint = {
|
|
|
9
8
|
};
|
|
10
9
|
export type WebsiteBuilderTheme = {
|
|
11
10
|
css?: string;
|
|
12
|
-
cssVariables?: Record<string, string>;
|
|
13
11
|
fonts?: string[];
|
|
14
12
|
breakpoints: Breakpoint[];
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
typography: Typography;
|
|
18
|
-
};
|
|
19
|
-
lexical: LexicalEditorTheme;
|
|
13
|
+
colors: ColorStyle[];
|
|
14
|
+
typography: Typography;
|
|
20
15
|
};
|
|
21
16
|
type KnownKeys = "desktop" | "tablet" | "mobile";
|
|
22
17
|
type BreakpointBase = Omit<Breakpoint, "name">;
|
|
@@ -26,23 +21,23 @@ type Breakpoints = KnownBreakpoints & {
|
|
|
26
21
|
[K in string as K extends KnownKeys ? never : K]: BreakpointBase;
|
|
27
22
|
};
|
|
28
23
|
};
|
|
29
|
-
export type
|
|
24
|
+
export type ColorStyle = {
|
|
25
|
+
id: string;
|
|
26
|
+
label: string;
|
|
27
|
+
value: string;
|
|
28
|
+
};
|
|
30
29
|
export type TypographyStyle = {
|
|
31
30
|
id: string;
|
|
32
|
-
|
|
31
|
+
label: string;
|
|
33
32
|
tag: string;
|
|
34
33
|
className: string;
|
|
35
34
|
};
|
|
36
|
-
export type Typography =
|
|
35
|
+
export type Typography = Record<string, TypographyStyle[]>;
|
|
37
36
|
export type WebsiteBuilderThemeInput = {
|
|
38
37
|
/**
|
|
39
38
|
* CSS to include in the editor.
|
|
40
39
|
*/
|
|
41
40
|
css?: string;
|
|
42
|
-
/**
|
|
43
|
-
* CSS variables to define in the editor.
|
|
44
|
-
*/
|
|
45
|
-
cssVariables?: Record<string, string>;
|
|
46
41
|
/**
|
|
47
42
|
* Fonts to load when the editor loads.
|
|
48
43
|
*/
|
|
@@ -57,36 +52,38 @@ export type WebsiteBuilderThemeInput = {
|
|
|
57
52
|
* }
|
|
58
53
|
*/
|
|
59
54
|
breakpoints?: Breakpoints;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
55
|
+
/**
|
|
56
|
+
* [
|
|
57
|
+
* {
|
|
58
|
+
* id: "primary",
|
|
59
|
+
* label: "Primary",
|
|
60
|
+
* value: "#000000"
|
|
61
|
+
* },
|
|
62
|
+
* ]
|
|
63
|
+
*/
|
|
64
|
+
colors?: ColorStyle[];
|
|
65
|
+
/**
|
|
66
|
+
* headings: [
|
|
67
|
+
* {
|
|
68
|
+
* id: "heading1",
|
|
69
|
+
* name: "Heading 1",
|
|
70
|
+
* tag: "h1"
|
|
71
|
+
* },
|
|
72
|
+
* ],
|
|
73
|
+
* paragraphs: [
|
|
74
|
+
* {
|
|
75
|
+
* id: "paragraph1",
|
|
76
|
+
* name: "Paragraph 1",
|
|
77
|
+
* tag: "p",
|
|
78
|
+
* ],
|
|
79
|
+
* quotes: [
|
|
80
|
+
* {
|
|
81
|
+
* id: "quote",
|
|
82
|
+
* name: "Quote",
|
|
83
|
+
* tag: "blockquote"
|
|
84
|
+
* }
|
|
85
|
+
* ]
|
|
86
|
+
*/
|
|
87
|
+
typography?: Typography;
|
|
91
88
|
};
|
|
92
89
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["WebsiteBuilderTheme.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"names":[],"sources":["WebsiteBuilderTheme.ts"],"sourcesContent":["export 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 fonts?: string[];\n breakpoints: Breakpoint[];\n colors: ColorStyle[];\n typography: Typography;\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\nexport type ColorStyle = {\n id: string;\n label: string;\n value: string;\n};\n\nexport type TypographyStyle = {\n id: string;\n label: string;\n tag: string;\n className: string;\n};\n\nexport type Typography = Record<string, TypographyStyle[]>;\n\nexport type WebsiteBuilderThemeInput = {\n /**\n * CSS to include in the editor.\n */\n css?: 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 /**\n * [\n * {\n * id: \"primary\",\n * label: \"Primary\",\n * value: \"#000000\"\n * },\n * ]\n */\n colors?: ColorStyle[];\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"],"mappings":"","ignoreList":[]}
|
package/types.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type * as CSS from "csstype";
|
|
2
2
|
import type { BindingsApi } from "./BindingsApi.js";
|
|
3
3
|
import type { ShorthandCssProperties } from "./types/ShorthandCssProperties.js";
|
|
4
|
+
import type { InputFactory } from "./createInput.js";
|
|
4
5
|
export type { WebsiteBuilderTheme, Breakpoint } from "./types/WebsiteBuilderTheme.js";
|
|
5
|
-
|
|
6
|
-
}
|
|
6
|
+
type CSSProperties = CSS.Properties<string | number>;
|
|
7
7
|
export type ElementMap = Record<string, DocumentElement>;
|
|
8
8
|
export type DocumentState = Record<string, any>;
|
|
9
9
|
export type InputValueBinding<T = any> = ValueBinding<T> & {
|
|
@@ -57,6 +57,10 @@ export type Component = {
|
|
|
57
57
|
component: any;
|
|
58
58
|
manifest: ComponentManifest;
|
|
59
59
|
};
|
|
60
|
+
export type ComponentBlueprint<TComponent = any, TManifest = any> = {
|
|
61
|
+
component: TComponent;
|
|
62
|
+
manifest: TManifest;
|
|
63
|
+
};
|
|
60
64
|
export type ComponentGroupItem = {
|
|
61
65
|
name: string;
|
|
62
66
|
item?: DocumentElementTemplate;
|
|
@@ -81,7 +85,7 @@ export type ComponentManifest = {
|
|
|
81
85
|
group?: string;
|
|
82
86
|
label?: string;
|
|
83
87
|
image?: string;
|
|
84
|
-
inputs
|
|
88
|
+
inputs: ComponentInput[];
|
|
85
89
|
canDrag?: boolean;
|
|
86
90
|
canDelete?: boolean;
|
|
87
91
|
acceptsChildren?: boolean;
|
|
@@ -125,7 +129,7 @@ export type Document = {
|
|
|
125
129
|
bindings: DocumentBindings;
|
|
126
130
|
elements: ElementMap;
|
|
127
131
|
};
|
|
128
|
-
export type PublicPage = Pick<Page, "id" | "version" | "properties" | "bindings" | "elements" | "state">;
|
|
132
|
+
export type PublicPage = Pick<Page, "id" | "version" | "properties" | "bindings" | "elements" | "extensions" | "state">;
|
|
129
133
|
export type PublicRedirect = {
|
|
130
134
|
id: string;
|
|
131
135
|
from: string;
|
|
@@ -165,6 +169,7 @@ export type Page = Document & {
|
|
|
165
169
|
}>;
|
|
166
170
|
};
|
|
167
171
|
};
|
|
172
|
+
extensions: Record<string, any>;
|
|
168
173
|
};
|
|
169
174
|
export type Box = {
|
|
170
175
|
depth: number;
|
|
@@ -295,3 +300,20 @@ export type CustomInput = BaseInput<any> & {
|
|
|
295
300
|
fields: ComponentInput[];
|
|
296
301
|
};
|
|
297
302
|
export type ComponentInput = TextInput | LongTextInput | NumberInput | BooleanInput | ColorInput | FileInput | DateTimeInput | LexicalInput | SelectInput | RadioInput | TagsInput | ObjectInput | SlotInput | CustomInput;
|
|
303
|
+
export type ManifestInputsArray<TInputs, TAllowChildren extends boolean> = TAllowChildren extends true ? {
|
|
304
|
+
[K in Exclude<keyof TInputs, "children">]: InputFactory<K & string>;
|
|
305
|
+
}[Exclude<keyof TInputs, "children">][] : {
|
|
306
|
+
[K in keyof TInputs]: InputFactory<K & string>;
|
|
307
|
+
}[keyof TInputs][];
|
|
308
|
+
export type ManifestInputsObject<TInputs, TAllowChildren extends boolean> = TAllowChildren extends true ? {
|
|
309
|
+
[K in Exclude<keyof TInputs, "children">]: InputFactory<K & string>;
|
|
310
|
+
} : {
|
|
311
|
+
[K in keyof TInputs]: InputFactory<K & string>;
|
|
312
|
+
};
|
|
313
|
+
export type ComponentManifestInput<TInputs> = (Omit<ComponentManifest, "inputs" | "acceptsChildren"> & {
|
|
314
|
+
acceptsChildren: true;
|
|
315
|
+
inputs?: ManifestInputsArray<TInputs, true> | ManifestInputsObject<TInputs, true>;
|
|
316
|
+
}) | (Omit<ComponentManifest, "inputs" | "acceptsChildren"> & {
|
|
317
|
+
acceptsChildren?: false;
|
|
318
|
+
inputs: ManifestInputsArray<TInputs, false> | ManifestInputsObject<TInputs, false>;
|
|
319
|
+
});
|
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.js\";\nimport type { ShorthandCssProperties } from \"./types/ShorthandCssProperties.js\";\nexport type { WebsiteBuilderTheme, Breakpoint } from \"./types/WebsiteBuilderTheme.js\";\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 PublicRedirect = {\n id: string;\n from: string;\n to: string;\n permanent: boolean;\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 // Viewport width (only the visible part)\n width: number;\n // Viewport height (only the visible part)\n height: number;\n // Full iframe width\n scrollWidth: number;\n // Full iframe height\n scrollHeight: number;\n // Iframe horizontal scroll offset\n scrollX: number;\n // Iframe vertical scroll offest\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":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type * as CSS from \"csstype\";\nimport type { BindingsApi } from \"~/BindingsApi.js\";\nimport type { ShorthandCssProperties } from \"./types/ShorthandCssProperties.js\";\nimport type { InputFactory } from \"~/createInput.js\";\nexport type { WebsiteBuilderTheme, Breakpoint } from \"./types/WebsiteBuilderTheme.js\";\n\ntype CSSProperties = 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 ComponentBlueprint<TComponent = any, TManifest = any> = {\n component: TComponent;\n manifest: TManifest;\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\" | \"extensions\" | \"state\"\n>;\n\nexport type PublicRedirect = {\n id: string;\n from: string;\n to: string;\n permanent: boolean;\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 extensions: Record<string, any>;\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 // Viewport width (only the visible part)\n width: number;\n // Viewport height (only the visible part)\n height: number;\n // Full iframe width\n scrollWidth: number;\n // Full iframe height\n scrollHeight: number;\n // Iframe horizontal scroll offset\n scrollX: number;\n // Iframe vertical scroll offest\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\nexport type ManifestInputsArray<\n TInputs,\n TAllowChildren extends boolean\n> = TAllowChildren extends true\n ? {\n [K in Exclude<keyof TInputs, \"children\">]: InputFactory<K & string>;\n }[Exclude<keyof TInputs, \"children\">][]\n : {\n [K in keyof TInputs]: InputFactory<K & string>;\n }[keyof TInputs][];\n\nexport type ManifestInputsObject<\n TInputs,\n TAllowChildren extends boolean\n> = TAllowChildren extends true\n ? { [K in Exclude<keyof TInputs, \"children\">]: InputFactory<K & string> }\n : { [K in keyof TInputs]: InputFactory<K & string> };\n\nexport type ComponentManifestInput<TInputs> =\n | (Omit<ComponentManifest, \"inputs\" | \"acceptsChildren\"> & {\n acceptsChildren: true;\n inputs?: ManifestInputsArray<TInputs, true> | ManifestInputsObject<TInputs, true>;\n })\n | (Omit<ComponentManifest, \"inputs\" | \"acceptsChildren\"> & {\n acceptsChildren?: false;\n inputs: ManifestInputsArray<TInputs, false> | ManifestInputsObject<TInputs, false>;\n });\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
export const createDefaultLexicalTheme = () => {
|
|
2
|
-
return {
|
|
3
|
-
characterLimit: "wb-lx-characterLimit",
|
|
4
|
-
code: "wb-lx-code",
|
|
5
|
-
codeHighlight: {
|
|
6
|
-
atrule: "wb-lx-tokenAttr",
|
|
7
|
-
attr: "wb-lx-tokenAttr",
|
|
8
|
-
boolean: "wb-lx-tokenProperty",
|
|
9
|
-
builtin: "wb-lx-tokenSelector",
|
|
10
|
-
cdata: "wb-lx-tokenComment",
|
|
11
|
-
char: "wb-lx-tokenSelector",
|
|
12
|
-
class: "wb-lx-tokenFunction",
|
|
13
|
-
"class-name": "wb-lx-tokenFunction",
|
|
14
|
-
comment: "wb-lx-tokenComment",
|
|
15
|
-
constant: "wb-lx-tokenProperty",
|
|
16
|
-
deleted: "wb-lx-tokenProperty",
|
|
17
|
-
doctype: "wb-lx-tokenComment",
|
|
18
|
-
entity: "wb-lx-tokenOperator",
|
|
19
|
-
function: "wb-lx-tokenFunction",
|
|
20
|
-
important: "wb-lx-tokenVariable",
|
|
21
|
-
inserted: "wb-lx-tokenSelector",
|
|
22
|
-
keyword: "wb-lx-tokenAttr",
|
|
23
|
-
namespace: "wb-lx-tokenVariable",
|
|
24
|
-
number: "wb-lx-tokenProperty",
|
|
25
|
-
operator: "wb-lx-tokenOperator",
|
|
26
|
-
prolog: "wb-lx-tokenComment",
|
|
27
|
-
property: "wb-lx-tokenProperty",
|
|
28
|
-
punctuation: "wb-lx-tokenPunctuation",
|
|
29
|
-
regex: "wb-lx-tokenVariable",
|
|
30
|
-
selector: "wb-lx-tokenSelector",
|
|
31
|
-
string: "wb-lx-tokenSelector",
|
|
32
|
-
symbol: "wb-lx-tokenProperty",
|
|
33
|
-
tag: "wb-lx-tokenProperty",
|
|
34
|
-
url: "wb-lx-tokenOperator",
|
|
35
|
-
variable: "wb-lx-tokenVariable"
|
|
36
|
-
},
|
|
37
|
-
embedBlock: {
|
|
38
|
-
base: "wb-lx-embedBlock",
|
|
39
|
-
focus: "wb-lx-embedBlockFocus"
|
|
40
|
-
},
|
|
41
|
-
hashtag: "wb-lx-hashtag",
|
|
42
|
-
heading: {
|
|
43
|
-
h1: "wb-lx-h1",
|
|
44
|
-
h2: "wb-lx-h2",
|
|
45
|
-
h3: "wb-lx-h3",
|
|
46
|
-
h4: "wb-lx-h4",
|
|
47
|
-
h5: "wb-lx-h5",
|
|
48
|
-
h6: "wb-lx-h6"
|
|
49
|
-
},
|
|
50
|
-
link: "wb-lx-link",
|
|
51
|
-
list: {
|
|
52
|
-
listitem: "wb-lx-listItem",
|
|
53
|
-
listitemChecked: "wb-lx-listItemChecked",
|
|
54
|
-
listitemUnchecked: "wb-lx-listItemUnchecked",
|
|
55
|
-
nested: {
|
|
56
|
-
listitem: "wb-lx-nestedListItem"
|
|
57
|
-
},
|
|
58
|
-
olDepth: ["wb-lx-ol1", "wb-lx-ol2", "wb-lx-ol3", "wb-lx-ol4", "wb-lx-ol5"],
|
|
59
|
-
ul: "wb-lx-ul"
|
|
60
|
-
},
|
|
61
|
-
ltr: "wb-lx-ltr",
|
|
62
|
-
mark: "wb-lx-mark",
|
|
63
|
-
markOverlap: "wb-lx-markOverlap",
|
|
64
|
-
paragraph: "wb-lx-paragraph",
|
|
65
|
-
quote: "wb-lx-quote",
|
|
66
|
-
rtl: "wb-lx-rtl",
|
|
67
|
-
text: {
|
|
68
|
-
bold: "wb-lx-textBold",
|
|
69
|
-
code: "wb-lx-textCode",
|
|
70
|
-
italic: "wb-lx-textItalic",
|
|
71
|
-
strikethrough: "wb-lx-textStrikethrough",
|
|
72
|
-
subscript: "wb-lx-textSubscript",
|
|
73
|
-
superscript: "wb-lx-textSuperscript",
|
|
74
|
-
underline: "wb-lx-textUnderline",
|
|
75
|
-
underlineStrikethrough: "wb-lx-textUnderlineStrikethrough"
|
|
76
|
-
},
|
|
77
|
-
fontColorText: "wb-lx-fontColorText",
|
|
78
|
-
image: "wb-lx-image",
|
|
79
|
-
indent: "wb-lx-indent",
|
|
80
|
-
inlineImage: "wb-lx-inline-image"
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
//# sourceMappingURL=createDefaultLexicalTheme.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createDefaultLexicalTheme","characterLimit","code","codeHighlight","atrule","attr","boolean","builtin","cdata","char","class","comment","constant","deleted","doctype","entity","function","important","inserted","keyword","namespace","number","operator","prolog","property","punctuation","regex","selector","string","symbol","tag","url","variable","embedBlock","base","focus","hashtag","heading","h1","h2","h3","h4","h5","h6","link","list","listitem","listitemChecked","listitemUnchecked","nested","olDepth","ul","ltr","mark","markOverlap","paragraph","quote","rtl","text","bold","italic","strikethrough","subscript","superscript","underline","underlineStrikethrough","fontColorText","image","indent","inlineImage"],"sources":["createDefaultLexicalTheme.ts"],"sourcesContent":["import type { LexicalEditorTheme } from \"~/types/LexicalEditorTheme.js\";\n\nexport const createDefaultLexicalTheme = (): LexicalEditorTheme => {\n return {\n characterLimit: \"wb-lx-characterLimit\",\n code: \"wb-lx-code\",\n codeHighlight: {\n atrule: \"wb-lx-tokenAttr\",\n attr: \"wb-lx-tokenAttr\",\n boolean: \"wb-lx-tokenProperty\",\n builtin: \"wb-lx-tokenSelector\",\n cdata: \"wb-lx-tokenComment\",\n char: \"wb-lx-tokenSelector\",\n class: \"wb-lx-tokenFunction\",\n \"class-name\": \"wb-lx-tokenFunction\",\n comment: \"wb-lx-tokenComment\",\n constant: \"wb-lx-tokenProperty\",\n deleted: \"wb-lx-tokenProperty\",\n doctype: \"wb-lx-tokenComment\",\n entity: \"wb-lx-tokenOperator\",\n function: \"wb-lx-tokenFunction\",\n important: \"wb-lx-tokenVariable\",\n inserted: \"wb-lx-tokenSelector\",\n keyword: \"wb-lx-tokenAttr\",\n namespace: \"wb-lx-tokenVariable\",\n number: \"wb-lx-tokenProperty\",\n operator: \"wb-lx-tokenOperator\",\n prolog: \"wb-lx-tokenComment\",\n property: \"wb-lx-tokenProperty\",\n punctuation: \"wb-lx-tokenPunctuation\",\n regex: \"wb-lx-tokenVariable\",\n selector: \"wb-lx-tokenSelector\",\n string: \"wb-lx-tokenSelector\",\n symbol: \"wb-lx-tokenProperty\",\n tag: \"wb-lx-tokenProperty\",\n url: \"wb-lx-tokenOperator\",\n variable: \"wb-lx-tokenVariable\"\n },\n embedBlock: {\n base: \"wb-lx-embedBlock\",\n focus: \"wb-lx-embedBlockFocus\"\n },\n hashtag: \"wb-lx-hashtag\",\n heading: {\n h1: \"wb-lx-h1\",\n h2: \"wb-lx-h2\",\n h3: \"wb-lx-h3\",\n h4: \"wb-lx-h4\",\n h5: \"wb-lx-h5\",\n h6: \"wb-lx-h6\"\n },\n link: \"wb-lx-link\",\n list: {\n listitem: \"wb-lx-listItem\",\n listitemChecked: \"wb-lx-listItemChecked\",\n listitemUnchecked: \"wb-lx-listItemUnchecked\",\n nested: {\n listitem: \"wb-lx-nestedListItem\"\n },\n olDepth: [\"wb-lx-ol1\", \"wb-lx-ol2\", \"wb-lx-ol3\", \"wb-lx-ol4\", \"wb-lx-ol5\"],\n ul: \"wb-lx-ul\"\n },\n ltr: \"wb-lx-ltr\",\n mark: \"wb-lx-mark\",\n markOverlap: \"wb-lx-markOverlap\",\n paragraph: \"wb-lx-paragraph\",\n quote: \"wb-lx-quote\",\n rtl: \"wb-lx-rtl\",\n text: {\n bold: \"wb-lx-textBold\",\n code: \"wb-lx-textCode\",\n italic: \"wb-lx-textItalic\",\n strikethrough: \"wb-lx-textStrikethrough\",\n subscript: \"wb-lx-textSubscript\",\n superscript: \"wb-lx-textSuperscript\",\n underline: \"wb-lx-textUnderline\",\n underlineStrikethrough: \"wb-lx-textUnderlineStrikethrough\"\n },\n fontColorText: \"wb-lx-fontColorText\",\n image: \"wb-lx-image\",\n indent: \"wb-lx-indent\",\n inlineImage: \"wb-lx-inline-image\"\n };\n};\n"],"mappings":"AAEA,OAAO,MAAMA,yBAAyB,GAAGA,CAAA,KAA0B;EAC/D,OAAO;IACHC,cAAc,EAAE,sBAAsB;IACtCC,IAAI,EAAE,YAAY;IAClBC,aAAa,EAAE;MACXC,MAAM,EAAE,iBAAiB;MACzBC,IAAI,EAAE,iBAAiB;MACvBC,OAAO,EAAE,qBAAqB;MAC9BC,OAAO,EAAE,qBAAqB;MAC9BC,KAAK,EAAE,oBAAoB;MAC3BC,IAAI,EAAE,qBAAqB;MAC3BC,KAAK,EAAE,qBAAqB;MAC5B,YAAY,EAAE,qBAAqB;MACnCC,OAAO,EAAE,oBAAoB;MAC7BC,QAAQ,EAAE,qBAAqB;MAC/BC,OAAO,EAAE,qBAAqB;MAC9BC,OAAO,EAAE,oBAAoB;MAC7BC,MAAM,EAAE,qBAAqB;MAC7BC,QAAQ,EAAE,qBAAqB;MAC/BC,SAAS,EAAE,qBAAqB;MAChCC,QAAQ,EAAE,qBAAqB;MAC/BC,OAAO,EAAE,iBAAiB;MAC1BC,SAAS,EAAE,qBAAqB;MAChCC,MAAM,EAAE,qBAAqB;MAC7BC,QAAQ,EAAE,qBAAqB;MAC/BC,MAAM,EAAE,oBAAoB;MAC5BC,QAAQ,EAAE,qBAAqB;MAC/BC,WAAW,EAAE,wBAAwB;MACrCC,KAAK,EAAE,qBAAqB;MAC5BC,QAAQ,EAAE,qBAAqB;MAC/BC,MAAM,EAAE,qBAAqB;MAC7BC,MAAM,EAAE,qBAAqB;MAC7BC,GAAG,EAAE,qBAAqB;MAC1BC,GAAG,EAAE,q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import { deepMerge } from "./deepMerge.js";
|
|
3
|
-
export const createLexicalTheme = (theme = {}) => {
|
|
4
|
-
return deepMerge(createDefaultLexicalTheme(), theme);
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
//# sourceMappingURL=createLexicalTheme.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createDefaultLexicalTheme","deepMerge","createLexicalTheme","theme"],"sources":["createLexicalTheme.ts"],"sourcesContent":["import type { LexicalEditorTheme } from \"~/types/LexicalEditorTheme.js\";\nimport { createDefaultLexicalTheme } from \"./createDefaultLexicalTheme.js\";\nimport { deepMerge } from \"./deepMerge.js\";\n\nexport const createLexicalTheme = (theme: LexicalEditorTheme = {}): LexicalEditorTheme => {\n return deepMerge(createDefaultLexicalTheme(), theme);\n};\n"],"mappings":"AACA,SAASA,yBAAyB;AAClC,SAASC,SAAS;AAElB,OAAO,MAAMC,kBAAkB,GAAGA,CAACC,KAAyB,GAAG,CAAC,CAAC,KAAyB;EACtF,OAAOF,SAAS,CAACD,yBAAyB,CAAC,CAAC,EAAEG,KAAK,CAAC;AACxD,CAAC","ignoreList":[]}
|
package/lexical/deepMerge.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function deepMerge<T extends Record<string, unknown>>(target: T, source: Partial<T>): T;
|
package/lexical/deepMerge.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
function isObject(value) {
|
|
2
|
-
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
3
|
-
}
|
|
4
|
-
function mergeObjects(target, source) {
|
|
5
|
-
const output = {
|
|
6
|
-
...target
|
|
7
|
-
};
|
|
8
|
-
for (const key in source) {
|
|
9
|
-
const sourceValue = source[key];
|
|
10
|
-
const targetValue = target[key];
|
|
11
|
-
if (isObject(sourceValue) && isObject(targetValue)) {
|
|
12
|
-
output[key] = mergeObjects(targetValue, sourceValue);
|
|
13
|
-
} else {
|
|
14
|
-
output[key] = sourceValue;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return output;
|
|
18
|
-
}
|
|
19
|
-
export function deepMerge(target, source) {
|
|
20
|
-
return mergeObjects(target, source);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
//# sourceMappingURL=deepMerge.js.map
|
package/lexical/deepMerge.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["isObject","value","Array","isArray","mergeObjects","target","source","output","key","sourceValue","targetValue","deepMerge"],"sources":["deepMerge.ts"],"sourcesContent":["function isObject(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n\nfunction mergeObjects(\n target: Record<string, unknown>,\n source: Record<string, unknown>\n): Record<string, unknown> {\n const output: Record<string, unknown> = { ...target };\n\n for (const key in source) {\n const sourceValue = source[key];\n const targetValue = target[key];\n\n if (isObject(sourceValue) && isObject(targetValue)) {\n output[key] = mergeObjects(targetValue, sourceValue);\n } else {\n output[key] = sourceValue;\n }\n }\n\n return output;\n}\n\nexport function deepMerge<T extends Record<string, unknown>>(target: T, source: Partial<T>): T {\n return mergeObjects(target, source as Record<string, unknown>) as T;\n}\n"],"mappings":"AAAA,SAASA,QAAQA,CAACC,KAAc,EAAoC;EAChE,OAAOA,KAAK,KAAK,IAAI,IAAI,OAAOA,KAAK,KAAK,QAAQ,IAAI,CAACC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC;AAC/E;AAEA,SAASG,YAAYA,CACjBC,MAA+B,EAC/BC,MAA+B,EACR;EACvB,MAAMC,MAA+B,GAAG;IAAE,GAAGF;EAAO,CAAC;EAErD,KAAK,MAAMG,GAAG,IAAIF,MAAM,EAAE;IACtB,MAAMG,WAAW,GAAGH,MAAM,CAACE,GAAG,CAAC;IAC/B,MAAME,WAAW,GAAGL,MAAM,CAACG,GAAG,CAAC;IAE/B,IAAIR,QAAQ,CAACS,WAAW,CAAC,IAAIT,QAAQ,CAACU,WAAW,CAAC,EAAE;MAChDH,MAAM,CAACC,GAAG,CAAC,GAAGJ,YAAY,CAACM,WAAW,EAAED,WAAW,CAAC;IACxD,CAAC,MAAM;MACHF,MAAM,CAACC,GAAG,CAAC,GAAGC,WAAW;IAC7B;EACJ;EAEA,OAAOF,MAAM;AACjB;AAEA,OAAO,SAASI,SAASA,CAAoCN,MAAS,EAAEC,MAAkB,EAAK;EAC3F,OAAOF,YAAY,CAACC,MAAM,EAAEC,MAAiC,CAAC;AAClE","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["LexicalEditorTheme.ts"],"sourcesContent":["import type { EditorThemeClasses } from \"lexical\";\n\nexport type LexicalEditorTheme = EditorThemeClasses;\n"],"mappings":"","ignoreList":[]}
|