@webiny/website-builder-vue 6.4.0-beta.5 → 6.4.0-beta.6
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/LICENSE +21 -0
- package/README.md +11 -0
- package/components/ConnectToEditor.d.ts +35 -0
- package/components/ConnectToEditor.js +40 -0
- package/components/ConnectToEditor.js.map +1 -0
- package/components/DocumentFragment.d.ts +67 -0
- package/components/DocumentFragment.js +24 -0
- package/components/DocumentFragment.js.map +1 -0
- package/components/DocumentRenderer.d.ts +59 -0
- package/components/DocumentRenderer.js +68 -0
- package/components/DocumentRenderer.js.map +1 -0
- package/components/DocumentStoreProvider.d.ts +37 -0
- package/components/DocumentStoreProvider.js +32 -0
- package/components/DocumentStoreProvider.js.map +1 -0
- package/components/EditingElementRenderer/EditingElementRenderer.d.ts +22 -0
- package/components/EditingElementRenderer/EditingElementRenderer.js +53 -0
- package/components/EditingElementRenderer/EditingElementRenderer.js.map +1 -0
- package/components/EditingElementRenderer/EditingElementRenderer.presenter.d.ts +15 -0
- package/components/EditingElementRenderer/EditingElementRenderer.presenter.js +37 -0
- package/components/EditingElementRenderer/EditingElementRenderer.presenter.js.map +1 -0
- package/components/EditingElementRenderer/index.js +2 -0
- package/components/ElementIndexProvider.d.ts +19 -0
- package/components/ElementIndexProvider.js +19 -0
- package/components/ElementIndexProvider.js.map +1 -0
- package/components/ElementRenderer.d.ts +19 -0
- package/components/ElementRenderer.js +33 -0
- package/components/ElementRenderer.js.map +1 -0
- package/components/ElementSlot.d.ts +39 -0
- package/components/ElementSlot.js +36 -0
- package/components/ElementSlot.js.map +1 -0
- package/components/ElementSlotDepthProvider.d.ts +19 -0
- package/components/ElementSlotDepthProvider.js +19 -0
- package/components/ElementSlotDepthProvider.js.map +1 -0
- package/components/FragmentsProvider.d.ts +46 -0
- package/components/FragmentsProvider.js +40 -0
- package/components/FragmentsProvider.js.map +1 -0
- package/components/LiveElementRenderer.d.ts +24 -0
- package/components/LiveElementRenderer.js +74 -0
- package/components/LiveElementRenderer.js.map +1 -0
- package/components/LiveElementSlot.d.ts +21 -0
- package/components/LiveElementSlot.js +36 -0
- package/components/LiveElementSlot.js.map +1 -0
- package/components/PreviewElementSlot.d.ts +38 -0
- package/components/PreviewElementSlot.js +45 -0
- package/components/PreviewElementSlot.js.map +1 -0
- package/{src/components/index.ts → components/index.d.ts} +2 -11
- package/components/index.js +8 -0
- package/composables/useBindingsForElement.d.ts +825 -0
- package/composables/useBindingsForElement.js +24 -0
- package/composables/useBindingsForElement.js.map +1 -0
- package/composables/useDocumentState.d.ts +5 -0
- package/composables/useDocumentState.js +11 -0
- package/composables/useDocumentState.js.map +1 -0
- package/composables/useObservable.d.ts +13 -0
- package/composables/useObservable.js +14 -0
- package/composables/useObservable.js.map +1 -0
- package/{src/composables/useSelectFromState.ts → composables/useSelectFromState.d.ts} +2 -10
- package/composables/useSelectFromState.js +9 -0
- package/composables/useSelectFromState.js.map +1 -0
- package/composables/useViewport.d.ts +7 -0
- package/composables/useViewport.js +18 -0
- package/composables/useViewport.js.map +1 -0
- package/createComponent.d.ts +21 -0
- package/createComponent.js +31 -0
- package/createComponent.js.map +1 -0
- package/editorComponents/Box.d.ts +7 -0
- package/editorComponents/Box.js +4 -0
- package/editorComponents/Box.js.map +1 -0
- package/editorComponents/Box.manifest.d.ts +1 -0
- package/{src/editorComponents/Box.manifest.ts → editorComponents/Box.manifest.js} +6 -4
- package/editorComponents/Box.manifest.js.map +1 -0
- package/editorComponents/Fragment.d.ts +13 -0
- package/editorComponents/Fragment.js +39 -0
- package/editorComponents/Fragment.js.map +1 -0
- package/editorComponents/Fragment.manifest.d.ts +1 -0
- package/{src/editorComponents/Fragment.manifest.ts → editorComponents/Fragment.manifest.js} +6 -4
- package/editorComponents/Fragment.manifest.js.map +1 -0
- package/editorComponents/Grid.d.ts +24 -0
- package/editorComponents/Grid.js +33 -0
- package/editorComponents/Grid.js.map +1 -0
- package/editorComponents/Grid.manifest.d.ts +1 -0
- package/{src/editorComponents/Grid.manifest.ts → editorComponents/Grid.manifest.js} +58 -55
- package/editorComponents/Grid.manifest.js.map +1 -0
- package/editorComponents/GridColumn.d.ts +5 -0
- package/editorComponents/GridColumn.js +4 -0
- package/editorComponents/GridColumn.js.map +1 -0
- package/editorComponents/GridColumn.manifest.d.ts +1 -0
- package/{src/editorComponents/GridColumn.manifest.ts → editorComponents/GridColumn.manifest.js} +9 -5
- package/editorComponents/GridColumn.manifest.js.map +1 -0
- package/editorComponents/Image.d.ts +37 -0
- package/editorComponents/Image.js +115 -0
- package/editorComponents/Image.js.map +1 -0
- package/editorComponents/Image.manifest.d.ts +1 -0
- package/{src/editorComponents/Image.manifest.ts → editorComponents/Image.manifest.js} +17 -12
- package/editorComponents/Image.manifest.js.map +1 -0
- package/editorComponents/Lexical.d.ts +18 -0
- package/editorComponents/Lexical.js +15 -0
- package/editorComponents/Lexical.js.map +1 -0
- package/editorComponents/Lexical.manifest.d.ts +1 -0
- package/editorComponents/Lexical.manifest.js +24 -0
- package/editorComponents/Lexical.manifest.js.map +1 -0
- package/editorComponents/Root.d.ts +7 -0
- package/editorComponents/Root.js +4 -0
- package/editorComponents/Root.js.map +1 -0
- package/editorComponents/Root.manifest.d.ts +1 -0
- package/{src/editorComponents/Root.manifest.ts → editorComponents/Root.manifest.js} +5 -3
- package/editorComponents/Root.manifest.js.map +1 -0
- package/{src/editorComponents/index.ts → editorComponents/index.d.ts} +1 -3
- package/editorComponents/index.js +20 -0
- package/editorComponents/index.js.map +1 -0
- package/index.d.ts +10 -0
- package/index.js +9 -4
- package/package.json +10 -8
- package/{src/types.ts → types.d.ts} +11 -32
- package/types.js +0 -0
- package/src/components/ConnectToEditor.ts +0 -46
- package/src/components/DocumentFragment.ts +0 -43
- package/src/components/DocumentRenderer.ts +0 -102
- package/src/components/DocumentStoreProvider.ts +0 -53
- package/src/components/EditingElementRenderer/EditingElementRenderer.presenter.ts +0 -59
- package/src/components/EditingElementRenderer/EditingElementRenderer.ts +0 -70
- package/src/components/ElementIndexProvider.ts +0 -24
- package/src/components/ElementRenderer.ts +0 -42
- package/src/components/ElementSlot.ts +0 -34
- package/src/components/ElementSlotDepthProvider.ts +0 -24
- package/src/components/FragmentsProvider.ts +0 -87
- package/src/components/LiveElementRenderer.ts +0 -102
- package/src/components/LiveElementSlot.ts +0 -46
- package/src/components/PreviewElementSlot.ts +0 -43
- package/src/composables/useBindingsForElement.ts +0 -40
- package/src/composables/useDocumentState.ts +0 -13
- package/src/composables/useObservable.ts +0 -30
- package/src/composables/useViewport.ts +0 -27
- package/src/createComponent.ts +0 -55
- package/src/editorComponents/Box.ts +0 -8
- package/src/editorComponents/Fragment.ts +0 -57
- package/src/editorComponents/Grid.ts +0 -72
- package/src/editorComponents/GridColumn.ts +0 -6
- package/src/editorComponents/Image.ts +0 -144
- package/src/editorComponents/Lexical.manifest.ts +0 -24
- package/src/editorComponents/Lexical.ts +0 -23
- package/src/editorComponents/Root.ts +0 -8
- package/src/index.ts +0 -52
- package/tsconfig.build.json +0 -16
- package/tsconfig.json +0 -16
- package/webiny.config.js +0 -8
- /package/{src/components/EditingElementRenderer/index.ts → components/EditingElementRenderer/index.d.ts} +0 -0
- /package/{src/lexical.css → lexical.css} +0 -0
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
createElement,
|
|
5
|
-
createNumberInput,
|
|
6
|
-
createObjectInput,
|
|
7
|
-
createSelectInput,
|
|
8
|
-
createSlotInput,
|
|
9
|
-
createTextInput
|
|
10
|
-
} from "@webiny/website-builder-sdk";
|
|
11
|
-
import { createComponent } from "~/createComponent.js";
|
|
2
|
+
import { createBooleanInput, createElement, createNumberInput, createObjectInput, createSelectInput, createSlotInput, createTextInput } from "@webiny/website-builder-sdk";
|
|
3
|
+
import { createComponent } from "../createComponent.js";
|
|
12
4
|
import { GridComponent } from "./Grid.js";
|
|
13
|
-
|
|
14
|
-
export const Grid = createComponent(GridComponent, {
|
|
5
|
+
const Grid = createComponent(GridComponent, {
|
|
15
6
|
name: "Webiny/Grid",
|
|
16
7
|
label: "Grid",
|
|
17
|
-
image:
|
|
8
|
+
image: '<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e8eaed"><path d="M120-520v-320h320v320H120Zm0 400v-320h320v320H120Zm400-400v-320h320v320H520Zm0 400v-320h320v320H520ZM200-600h160v-160H200v160Zm400 0h160v-160H600v160Zm0 400h160v-160H600v160Zm-400 0h160v-160H200v160Zm400-400Zm0 240Zm-240 0Zm0-240Z"/></svg>',
|
|
18
9
|
group: "basic",
|
|
19
10
|
autoApplyStyles: false,
|
|
20
11
|
inputs: [
|
|
@@ -22,23 +13,23 @@ export const Grid = createComponent(GridComponent, {
|
|
|
22
13
|
name: "gridLayout",
|
|
23
14
|
label: "Grid Layout",
|
|
24
15
|
renderer: "Webiny/GridLayout",
|
|
25
|
-
onChange: ({ inputs, createElement: ce })
|
|
16
|
+
onChange: ({ inputs, createElement: ce })=>{
|
|
26
17
|
const rowColumnCount = inputs.gridLayout.split("-").length;
|
|
27
18
|
const columns = inputs.columns.length;
|
|
28
19
|
const remainder = columns % rowColumnCount;
|
|
29
|
-
|
|
30
|
-
if (remainder !== 0) {
|
|
20
|
+
if (0 !== remainder) {
|
|
31
21
|
const fullColumnCount = rowColumnCount * inputs.rowCount;
|
|
32
|
-
const toCreate =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
22
|
+
const toCreate = columns > fullColumnCount ? remainder : rowColumnCount - remainder;
|
|
23
|
+
Array.from({
|
|
24
|
+
length: toCreate
|
|
25
|
+
}).forEach(()=>{
|
|
36
26
|
inputs.columns.push({
|
|
37
|
-
children: ce({
|
|
27
|
+
children: ce({
|
|
28
|
+
component: "Webiny/GridColumn"
|
|
29
|
+
})
|
|
38
30
|
});
|
|
39
31
|
});
|
|
40
32
|
}
|
|
41
|
-
|
|
42
33
|
inputs.rowCount = inputs.columns.length / rowColumnCount;
|
|
43
34
|
}
|
|
44
35
|
}),
|
|
@@ -47,30 +38,25 @@ export const Grid = createComponent(GridComponent, {
|
|
|
47
38
|
label: "Row Count",
|
|
48
39
|
defaultValue: 1,
|
|
49
40
|
minValue: 1,
|
|
50
|
-
onChange: ({ inputs, createElement: ce })
|
|
41
|
+
onChange: ({ inputs, createElement: ce })=>{
|
|
51
42
|
const columnCount = inputs.gridLayout.split("-").length;
|
|
52
43
|
const rowCount = Math.max(1, inputs.rowCount);
|
|
53
44
|
const columns = inputs.columns;
|
|
54
|
-
const rows
|
|
55
|
-
|
|
56
|
-
for (let i = 0; i < columns.length; i += columnCount) {
|
|
57
|
-
rows.push(columns.slice(i, i + columnCount));
|
|
58
|
-
}
|
|
59
|
-
|
|
45
|
+
const rows = [];
|
|
46
|
+
for(let i = 0; i < columns.length; i += columnCount)rows.push(columns.slice(i, i + columnCount));
|
|
60
47
|
if (rows.length > rowCount) {
|
|
61
48
|
inputs.columns = columns.slice(0, columnCount * rowCount);
|
|
62
49
|
return;
|
|
63
50
|
}
|
|
64
|
-
|
|
65
51
|
const createRows = Math.max(0, rowCount - rows.length);
|
|
66
|
-
if (createRows <= 0)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
52
|
+
if (createRows <= 0) return;
|
|
53
|
+
const newRows = Array.from({
|
|
54
|
+
length: createRows * columnCount
|
|
55
|
+
}).map(()=>({
|
|
56
|
+
children: ce({
|
|
57
|
+
component: "Webiny/GridColumn"
|
|
58
|
+
})
|
|
59
|
+
}));
|
|
74
60
|
inputs.columns.push(...newRows);
|
|
75
61
|
}
|
|
76
62
|
}),
|
|
@@ -79,13 +65,10 @@ export const Grid = createComponent(GridComponent, {
|
|
|
79
65
|
label: "Row Gap",
|
|
80
66
|
defaultValue: 0,
|
|
81
67
|
responsive: true,
|
|
82
|
-
onChange: ({ inputs, styles })
|
|
68
|
+
onChange: ({ inputs, styles })=>{
|
|
83
69
|
const v = parseInt(inputs.rowGap);
|
|
84
|
-
if (isNaN(v))
|
|
85
|
-
|
|
86
|
-
} else {
|
|
87
|
-
styles.rowGap = `${inputs.rowGap}px`;
|
|
88
|
-
}
|
|
70
|
+
if (isNaN(v)) delete styles.rowGap;
|
|
71
|
+
else styles.rowGap = `${inputs.rowGap}px`;
|
|
89
72
|
}
|
|
90
73
|
}),
|
|
91
74
|
createNumberInput({
|
|
@@ -93,21 +76,24 @@ export const Grid = createComponent(GridComponent, {
|
|
|
93
76
|
label: "Column Gap",
|
|
94
77
|
defaultValue: 0,
|
|
95
78
|
responsive: true,
|
|
96
|
-
onChange: ({ inputs, styles })
|
|
79
|
+
onChange: ({ inputs, styles })=>{
|
|
97
80
|
const v = parseInt(inputs.columnGap);
|
|
98
|
-
if (isNaN(v))
|
|
99
|
-
|
|
100
|
-
} else {
|
|
101
|
-
styles.columnGap = `${inputs.columnGap}px`;
|
|
102
|
-
}
|
|
81
|
+
if (isNaN(v)) delete styles.columnGap;
|
|
82
|
+
else styles.columnGap = `${inputs.columnGap}px`;
|
|
103
83
|
}
|
|
104
84
|
}),
|
|
105
85
|
createSelectInput({
|
|
106
86
|
name: "stackAtBreakpoint",
|
|
107
87
|
label: "Stack at breakpoint",
|
|
108
88
|
options: [
|
|
109
|
-
{
|
|
110
|
-
|
|
89
|
+
{
|
|
90
|
+
label: "Tablet",
|
|
91
|
+
value: "tablet"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
label: "Mobile",
|
|
95
|
+
value: "mobile"
|
|
96
|
+
}
|
|
111
97
|
]
|
|
112
98
|
}),
|
|
113
99
|
createBooleanInput({
|
|
@@ -122,7 +108,9 @@ export const Grid = createComponent(GridComponent, {
|
|
|
122
108
|
createSlotInput({
|
|
123
109
|
name: "children",
|
|
124
110
|
list: false,
|
|
125
|
-
components: [
|
|
111
|
+
components: [
|
|
112
|
+
"Webiny/GridColumn"
|
|
113
|
+
]
|
|
126
114
|
})
|
|
127
115
|
]
|
|
128
116
|
})
|
|
@@ -134,13 +122,25 @@ export const Grid = createComponent(GridComponent, {
|
|
|
134
122
|
{
|
|
135
123
|
children: createElement({
|
|
136
124
|
component: "Webiny/GridColumn",
|
|
137
|
-
inputs: {
|
|
125
|
+
inputs: {
|
|
126
|
+
children: [
|
|
127
|
+
createElement({
|
|
128
|
+
component: "Webiny/Lexical"
|
|
129
|
+
})
|
|
130
|
+
]
|
|
131
|
+
}
|
|
138
132
|
})
|
|
139
133
|
},
|
|
140
134
|
{
|
|
141
135
|
children: createElement({
|
|
142
136
|
component: "Webiny/GridColumn",
|
|
143
|
-
inputs: {
|
|
137
|
+
inputs: {
|
|
138
|
+
children: [
|
|
139
|
+
createElement({
|
|
140
|
+
component: "Webiny/Lexical"
|
|
141
|
+
})
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
144
|
})
|
|
145
145
|
}
|
|
146
146
|
]
|
|
@@ -164,3 +164,6 @@ export const Grid = createComponent(GridComponent, {
|
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
166
|
});
|
|
167
|
+
export { Grid };
|
|
168
|
+
|
|
169
|
+
//# sourceMappingURL=Grid.manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editorComponents/Grid.manifest.js","sources":["../../src/editorComponents/Grid.manifest.ts"],"sourcesContent":["\"use client\";\nimport {\n createBooleanInput,\n createElement,\n createNumberInput,\n createObjectInput,\n createSelectInput,\n createSlotInput,\n createTextInput\n} from \"@webiny/website-builder-sdk\";\nimport { createComponent } from \"~/createComponent.js\";\nimport { GridComponent } from \"./Grid.js\";\n\nexport const Grid = createComponent(GridComponent, {\n name: \"Webiny/Grid\",\n label: \"Grid\",\n image: `<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\" width=\"24px\" fill=\"#e8eaed\"><path d=\"M120-520v-320h320v320H120Zm0 400v-320h320v320H120Zm400-400v-320h320v320H520Zm0 400v-320h320v320H520ZM200-600h160v-160H200v160Zm400 0h160v-160H600v160Zm0 400h160v-160H600v160Zm-400 0h160v-160H200v160Zm400-400Zm0 240Zm-240 0Zm0-240Z\"/></svg>`,\n group: \"basic\",\n autoApplyStyles: false,\n inputs: [\n createTextInput({\n name: \"gridLayout\",\n label: \"Grid Layout\",\n renderer: \"Webiny/GridLayout\",\n onChange: ({ inputs, createElement: ce }) => {\n const rowColumnCount = inputs.gridLayout.split(\"-\").length;\n const columns = inputs.columns.length;\n const remainder = columns % rowColumnCount;\n\n if (remainder !== 0) {\n const fullColumnCount = rowColumnCount * inputs.rowCount;\n const toCreate =\n columns > fullColumnCount ? remainder : rowColumnCount - remainder;\n\n Array.from({ length: toCreate }).forEach(() => {\n inputs.columns.push({\n children: ce({ component: \"Webiny/GridColumn\" })\n });\n });\n }\n\n inputs.rowCount = inputs.columns.length / rowColumnCount;\n }\n }),\n createNumberInput({\n name: \"rowCount\",\n label: \"Row Count\",\n defaultValue: 1,\n minValue: 1,\n onChange: ({ inputs, createElement: ce }) => {\n const columnCount = inputs.gridLayout.split(\"-\").length;\n const rowCount = Math.max(1, inputs.rowCount);\n const columns = inputs.columns;\n const rows: unknown[][] = [];\n\n for (let i = 0; i < columns.length; i += columnCount) {\n rows.push(columns.slice(i, i + columnCount));\n }\n\n if (rows.length > rowCount) {\n inputs.columns = columns.slice(0, columnCount * rowCount);\n return;\n }\n\n const createRows = Math.max(0, rowCount - rows.length);\n if (createRows <= 0) {\n return;\n }\n\n const newRows = Array.from({ length: createRows * columnCount }).map(() => ({\n children: ce({ component: \"Webiny/GridColumn\" })\n }));\n\n inputs.columns.push(...newRows);\n }\n }),\n createNumberInput({\n name: \"rowGap\",\n label: \"Row Gap\",\n defaultValue: 0,\n responsive: true,\n onChange: ({ inputs, styles }) => {\n const v = parseInt(inputs.rowGap);\n if (isNaN(v)) {\n delete styles.rowGap;\n } else {\n styles.rowGap = `${inputs.rowGap}px`;\n }\n }\n }),\n createNumberInput({\n name: \"columnGap\",\n label: \"Column Gap\",\n defaultValue: 0,\n responsive: true,\n onChange: ({ inputs, styles }) => {\n const v = parseInt(inputs.columnGap);\n if (isNaN(v)) {\n delete styles.columnGap;\n } else {\n styles.columnGap = `${inputs.columnGap}px`;\n }\n }\n }),\n createSelectInput({\n name: \"stackAtBreakpoint\",\n label: \"Stack at breakpoint\",\n options: [\n { label: \"Tablet\", value: \"tablet\" },\n { label: \"Mobile\", value: \"mobile\" }\n ]\n }),\n createBooleanInput({\n name: \"reverseWhenStacked\",\n label: \"Reverse columns when stacked\"\n }),\n createObjectInput({\n name: \"columns\",\n list: true,\n hideFromUi: true,\n fields: [\n createSlotInput({\n name: \"children\",\n list: false,\n components: [\"Webiny/GridColumn\"]\n })\n ]\n })\n ],\n defaults: {\n inputs: {\n gridLayout: \"6-6\",\n columns: [\n {\n children: createElement({\n component: \"Webiny/GridColumn\",\n inputs: { children: [createElement({ component: \"Webiny/Lexical\" })] }\n })\n },\n {\n children: createElement({\n component: \"Webiny/GridColumn\",\n inputs: { children: [createElement({ component: \"Webiny/Lexical\" })] }\n })\n }\n ]\n },\n styles: {\n boxSizing: \"border-box\",\n display: \"flex\",\n flexDirection: \"row\",\n flexWrap: \"wrap\",\n justifyContent: \"flex-start\",\n alignItems: \"stretch\",\n width: \"100%\",\n marginTop: \"0px\",\n marginBottom: \"0px\",\n marginLeft: \"0px\",\n marginRight: \"0px\",\n paddingTop: \"5px\",\n paddingRight: \"5px\",\n paddingBottom: \"5px\",\n paddingLeft: \"5px\"\n }\n }\n});\n"],"names":["Grid","createComponent","GridComponent","createTextInput","inputs","ce","rowColumnCount","columns","remainder","fullColumnCount","toCreate","Array","createNumberInput","columnCount","rowCount","Math","rows","i","createRows","newRows","styles","v","parseInt","isNaN","createSelectInput","createBooleanInput","createObjectInput","createSlotInput","createElement"],"mappings":";;;;AAaO,MAAMA,OAAOC,gBAAgBC,eAAe;IAC/C,MAAM;IACN,OAAO;IACP,OAAO;IACP,OAAO;IACP,iB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E,UAAU;gCAACA,cAAc;oCAAE,WAAW;gCAAiB;6BAAG;wBAAC;oBACzE;gBACJ;gBACA;oBACI,UAAUA,cAAc;wBACpB,WAAW;wBACX,QAAQ;4BAAE,UAAU;gCAACA,cAAc;oCAAE,WAAW;gCAAiB;6BAAG;wBAAC;oBACzE;gBACJ;aACH;QACL;QACA,QAAQ;YACJ,WAAW;YACX,SAAS;YACT,eAAe;YACf,UAAU;YACV,gBAAgB;YAChB,YAAY;YACZ,OAAO;YACP,WAAW;YACX,cAAc;YACd,YAAY;YACZ,aAAa;YACb,YAAY;YACZ,cAAc;YACd,eAAe;YACf,aAAa;QACjB;IACJ;AACJ"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ComponentPropsWithChildren } from "../types.js";
|
|
2
|
+
/** Renders only its children slot (the column content). */
|
|
3
|
+
export declare const GridColumnComponent: (props: ComponentPropsWithChildren) => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
}> | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editorComponents/GridColumn.js","sources":["../../src/editorComponents/GridColumn.ts"],"sourcesContent":["import type { ComponentPropsWithChildren } from \"~/types.js\";\n\n/** Renders only its children slot (the column content). */\nexport const GridColumnComponent = (props: ComponentPropsWithChildren) => {\n return props.inputs?.children ?? null;\n};\n"],"names":["GridColumnComponent","props"],"mappings":"AAGO,MAAMA,sBAAsB,CAACC,QACzBA,MAAM,MAAM,EAAE,YAAY"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const GridColumn: import("@webiny/website-builder-sdk").Component;
|
package/{src/editorComponents/GridColumn.manifest.ts → editorComponents/GridColumn.manifest.js}
RENAMED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { StyleSettings } from "@webiny/website-builder-sdk";
|
|
3
|
-
import { createComponent } from "
|
|
3
|
+
import { createComponent } from "../createComponent.js";
|
|
4
4
|
import { GridColumnComponent } from "./GridColumn.js";
|
|
5
|
-
|
|
6
|
-
export const GridColumn = createComponent(GridColumnComponent, {
|
|
5
|
+
const GridColumn = createComponent(GridColumnComponent, {
|
|
7
6
|
name: "Webiny/GridColumn",
|
|
8
7
|
label: "Column",
|
|
9
|
-
image:
|
|
8
|
+
image: '<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e8eaed"><path d="M600-120q-33 0-56.5-23.5T520-200v-560q0-33 23.5-56.5T600-840h160q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H600Zm0-640v560h160v-560H600ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h160q33 0 56.5 23.5T440-760v560q0 33-23.5 56.5T360-120H200Zm0-640v560h160v-560H200Zm560 0H600h160Zm-400 0H200h160Z"/></svg>',
|
|
10
9
|
canDrag: false,
|
|
11
10
|
canDelete: false,
|
|
12
11
|
acceptsChildren: true,
|
|
13
12
|
hideFromToolbar: true,
|
|
14
|
-
hideStyleSettings: [
|
|
13
|
+
hideStyleSettings: [
|
|
14
|
+
StyleSettings.Visibility
|
|
15
|
+
],
|
|
15
16
|
defaults: {
|
|
16
17
|
styles: {
|
|
17
18
|
paddingTop: "10px",
|
|
@@ -21,3 +22,6 @@ export const GridColumn = createComponent(GridColumnComponent, {
|
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
});
|
|
25
|
+
export { GridColumn };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=GridColumn.manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editorComponents/GridColumn.manifest.js","sources":["../../src/editorComponents/GridColumn.manifest.ts"],"sourcesContent":["\"use client\";\nimport { StyleSettings } from \"@webiny/website-builder-sdk\";\nimport { createComponent } from \"~/createComponent.js\";\nimport { GridColumnComponent } from \"./GridColumn.js\";\n\nexport const GridColumn = createComponent(GridColumnComponent, {\n name: \"Webiny/GridColumn\",\n label: \"Column\",\n image: `<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\" width=\"24px\" fill=\"#e8eaed\"><path d=\"M600-120q-33 0-56.5-23.5T520-200v-560q0-33 23.5-56.5T600-840h160q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H600Zm0-640v560h160v-560H600ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h160q33 0 56.5 23.5T440-760v560q0 33-23.5 56.5T360-120H200Zm0-640v560h160v-560H200Zm560 0H600h160Zm-400 0H200h160Z\"/></svg>`,\n canDrag: false,\n canDelete: false,\n acceptsChildren: true,\n hideFromToolbar: true,\n hideStyleSettings: [StyleSettings.Visibility],\n defaults: {\n styles: {\n paddingTop: \"10px\",\n paddingRight: \"10px\",\n paddingBottom: \"10px\",\n paddingLeft: \"10px\"\n }\n }\n});\n"],"names":["GridColumn","createComponent","GridColumnComponent","StyleSettings"],"mappings":";;;;AAKO,MAAMA,aAAaC,gBAAgBC,qBAAqB;IAC3D,MAAM;IACN,OAAO;IACP,OAAO;IACP,SAAS;IACT,WAAW;IACX,iBAAiB;IACjB,iBAAiB;IACjB,mBAAmB;QAACC,cAAc,UAAU;KAAC;IAC7C,UAAU;QACN,QAAQ;YACJ,YAAY;YACZ,cAAc;YACd,eAAe;YACf,aAAa;QACjB;IACJ;AACJ"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type PropType } from "vue";
|
|
2
|
+
import type { CssProperties } from "@webiny/website-builder-sdk";
|
|
3
|
+
type ImageInputs = {
|
|
4
|
+
title: string;
|
|
5
|
+
altText: string;
|
|
6
|
+
image: {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
size: number;
|
|
10
|
+
mimeType: string;
|
|
11
|
+
src: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export declare const ImageComponent: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
15
|
+
inputs: {
|
|
16
|
+
type: PropType<ImageInputs>;
|
|
17
|
+
required: true;
|
|
18
|
+
};
|
|
19
|
+
styles: {
|
|
20
|
+
type: PropType<CssProperties>;
|
|
21
|
+
default: () => {};
|
|
22
|
+
};
|
|
23
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
24
|
+
[key: string]: any;
|
|
25
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
26
|
+
inputs: {
|
|
27
|
+
type: PropType<ImageInputs>;
|
|
28
|
+
required: true;
|
|
29
|
+
};
|
|
30
|
+
styles: {
|
|
31
|
+
type: PropType<CssProperties>;
|
|
32
|
+
default: () => {};
|
|
33
|
+
};
|
|
34
|
+
}>> & Readonly<{}>, {
|
|
35
|
+
styles: CssProperties;
|
|
36
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { Fragment, defineComponent, h, ref, watch } from "vue";
|
|
2
|
+
import { contentSdk } from "@webiny/website-builder-sdk";
|
|
3
|
+
const SUPPORTED_WIDTHS = [
|
|
4
|
+
100,
|
|
5
|
+
300,
|
|
6
|
+
500,
|
|
7
|
+
750,
|
|
8
|
+
1000,
|
|
9
|
+
1500,
|
|
10
|
+
2500
|
|
11
|
+
];
|
|
12
|
+
const getSrcSet = (src, widths)=>widths.map((w)=>`${src}?width=${w} ${w}w`).join(", ");
|
|
13
|
+
const computeSrcSetWidths = (width)=>{
|
|
14
|
+
if (width && String(width).endsWith("px")) {
|
|
15
|
+
const px = parseInt(String(width));
|
|
16
|
+
const widths = [];
|
|
17
|
+
for (const w of SUPPORTED_WIDTHS){
|
|
18
|
+
widths.push(w);
|
|
19
|
+
if (w >= px) break;
|
|
20
|
+
}
|
|
21
|
+
return widths;
|
|
22
|
+
}
|
|
23
|
+
return SUPPORTED_WIDTHS;
|
|
24
|
+
};
|
|
25
|
+
const ImagePlaceholder = (props)=>h("div", {
|
|
26
|
+
style: {
|
|
27
|
+
display: "flex",
|
|
28
|
+
height: "200px",
|
|
29
|
+
backgroundColor: "#f4f4f4",
|
|
30
|
+
justifyContent: "center",
|
|
31
|
+
alignItems: "center",
|
|
32
|
+
fill: "#ffffff",
|
|
33
|
+
...props.style
|
|
34
|
+
}
|
|
35
|
+
}, [
|
|
36
|
+
h("svg", {
|
|
37
|
+
style: {
|
|
38
|
+
width: "70px",
|
|
39
|
+
height: "70px",
|
|
40
|
+
filter: "drop-shadow(rgba(0, 0, 0, 0.16) 0px 1px 0px)"
|
|
41
|
+
},
|
|
42
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
43
|
+
height: "24px",
|
|
44
|
+
viewBox: "0 -960 960 960",
|
|
45
|
+
width: "24px"
|
|
46
|
+
}, [
|
|
47
|
+
h("path", {
|
|
48
|
+
d: "M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm40-80h480L570-480 450-320l-90-120-120 160Zm-40 80v-560 560Z"
|
|
49
|
+
})
|
|
50
|
+
])
|
|
51
|
+
]);
|
|
52
|
+
const ImageComponent = defineComponent({
|
|
53
|
+
name: "WebinyImageComponent",
|
|
54
|
+
props: {
|
|
55
|
+
inputs: {
|
|
56
|
+
type: Object,
|
|
57
|
+
required: true
|
|
58
|
+
},
|
|
59
|
+
styles: {
|
|
60
|
+
type: Object,
|
|
61
|
+
default: ()=>({})
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
setup (props) {
|
|
65
|
+
const isLoaded = ref(!contentSdk.isEditing());
|
|
66
|
+
watch(()=>props.inputs?.image?.src, (src)=>{
|
|
67
|
+
if (!src) isLoaded.value = false;
|
|
68
|
+
});
|
|
69
|
+
function onLoad() {
|
|
70
|
+
if (contentSdk.isEditing()) setTimeout(()=>{
|
|
71
|
+
isLoaded.value = true;
|
|
72
|
+
}, 100);
|
|
73
|
+
else isLoaded.value = true;
|
|
74
|
+
}
|
|
75
|
+
return ()=>{
|
|
76
|
+
const { inputs, styles } = props;
|
|
77
|
+
const { title = "", altText, image } = inputs;
|
|
78
|
+
const src = image?.src;
|
|
79
|
+
if (!src) return h(ImagePlaceholder, {
|
|
80
|
+
style: styles
|
|
81
|
+
});
|
|
82
|
+
if (src.endsWith(".svg")) return h("object", {
|
|
83
|
+
style: {
|
|
84
|
+
maxWidth: "100%",
|
|
85
|
+
...styles
|
|
86
|
+
},
|
|
87
|
+
title,
|
|
88
|
+
data: src
|
|
89
|
+
});
|
|
90
|
+
const imageStyles = {
|
|
91
|
+
maxWidth: "100%",
|
|
92
|
+
opacity: isLoaded.value ? 1 : 0,
|
|
93
|
+
transition: "opacity 0.3s ease",
|
|
94
|
+
...styles
|
|
95
|
+
};
|
|
96
|
+
const srcSet = getSrcSet(src, computeSrcSetWidths(styles.width));
|
|
97
|
+
return h(Fragment, null, [
|
|
98
|
+
isLoaded.value ? null : h(ImagePlaceholder, {
|
|
99
|
+
style: styles
|
|
100
|
+
}),
|
|
101
|
+
h("img", {
|
|
102
|
+
alt: altText,
|
|
103
|
+
title,
|
|
104
|
+
src,
|
|
105
|
+
srcset: srcSet,
|
|
106
|
+
style: imageStyles,
|
|
107
|
+
onLoad
|
|
108
|
+
})
|
|
109
|
+
]);
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
export { ImageComponent };
|
|
114
|
+
|
|
115
|
+
//# sourceMappingURL=Image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editorComponents/Image.js","sources":["../../src/editorComponents/Image.ts"],"sourcesContent":["import { defineComponent, ref, watch, h, Fragment, type PropType } from \"vue\";\nimport { contentSdk } from \"@webiny/website-builder-sdk\";\nimport type { CssProperties } from \"@webiny/website-builder-sdk\";\n\nconst SUPPORTED_WIDTHS = [100, 300, 500, 750, 1000, 1500, 2500];\n\ntype ImageInputs = {\n title: string;\n altText: string;\n image: {\n id: string;\n name: string;\n size: number;\n mimeType: string;\n src: string;\n };\n};\n\nconst getSrcSet = (src: string, widths: number[]) =>\n widths.map(w => `${src}?width=${w} ${w}w`).join(\", \");\n\nconst computeSrcSetWidths = (width?: string | number): number[] => {\n if (width && String(width).endsWith(\"px\")) {\n const px = parseInt(String(width));\n const widths: number[] = [];\n for (const w of SUPPORTED_WIDTHS) {\n widths.push(w);\n if (w >= px) {\n break;\n }\n }\n return widths;\n }\n return SUPPORTED_WIDTHS;\n};\n\nconst ImagePlaceholder = (props: { style: CssProperties }) =>\n h(\n \"div\",\n {\n style: {\n display: \"flex\",\n height: \"200px\",\n backgroundColor: \"#f4f4f4\",\n justifyContent: \"center\",\n alignItems: \"center\",\n fill: \"#ffffff\",\n ...props.style\n }\n },\n [\n h(\n \"svg\",\n {\n style: {\n width: \"70px\",\n height: \"70px\",\n filter: \"drop-shadow(rgba(0, 0, 0, 0.16) 0px 1px 0px)\"\n },\n xmlns: \"http://www.w3.org/2000/svg\",\n height: \"24px\",\n viewBox: \"0 -960 960 960\",\n width: \"24px\"\n },\n [\n h(\"path\", {\n d: \"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm40-80h480L570-480 450-320l-90-120-120 160Zm-40 80v-560 560Z\"\n })\n ]\n )\n ]\n );\n\nexport const ImageComponent = defineComponent({\n name: \"WebinyImageComponent\",\n props: {\n inputs: { type: Object as PropType<ImageInputs>, required: true },\n styles: { type: Object as PropType<CssProperties>, default: () => ({}) }\n },\n setup(props) {\n // In editing mode start as not-loaded (fade in after load).\n // In live mode start as loaded (no fade effect needed).\n const isLoaded = ref(!contentSdk.isEditing());\n\n watch(\n () => props.inputs?.image?.src,\n src => {\n if (!src) {\n isLoaded.value = false;\n }\n }\n );\n\n function onLoad() {\n if (contentSdk.isEditing()) {\n setTimeout(() => {\n isLoaded.value = true;\n }, 100);\n } else {\n isLoaded.value = true;\n }\n }\n\n return () => {\n const { inputs, styles } = props;\n const { title = \"\", altText, image } = inputs;\n const src = image?.src;\n\n if (!src) {\n return h(ImagePlaceholder, { style: styles });\n }\n\n if (src.endsWith(\".svg\")) {\n return h(\"object\", {\n style: { maxWidth: \"100%\", ...styles },\n title,\n data: src\n });\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const imageStyles: CssProperties = {\n maxWidth: \"100%\",\n opacity: isLoaded.value ? 1 : 0,\n transition: \"opacity 0.3s ease\",\n ...styles\n } as any;\n\n const srcSet = getSrcSet(src, computeSrcSetWidths(styles.width));\n\n return h(Fragment, null, [\n !isLoaded.value ? h(ImagePlaceholder, { style: styles }) : null,\n h(\"img\", {\n alt: altText,\n title,\n src,\n srcset: srcSet,\n style: imageStyles,\n onLoad\n })\n ]);\n };\n }\n});\n"],"names":["SUPPORTED_WIDTHS","getSrcSet","src","widths","w","computeSrcSetWidths","width","String","px","parseInt","ImagePlaceholder","props","h","ImageComponent","defineComponent","Object","isLoaded","ref","contentSdk","watch","onLoad","setTimeout","inputs","styles","title","altText","image","imageStyles","srcSet","Fragment"],"mappings":";;AAIA,MAAMA,mBAAmB;IAAC;IAAK;IAAK;IAAK;IAAK;IAAM;IAAM;CAAK;AAc/D,MAAMC,YAAY,CAACC,KAAaC,SAC5BA,OAAO,GAAG,CAACC,CAAAA,IAAK,GAAGF,IAAI,OAAO,EAAEE,EAAE,CAAC,EAAEA,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC;AAEpD,MAAMC,sBAAsB,CAACC;IACzB,IAAIA,SAASC,OAAOD,OAAO,QAAQ,CAAC,OAAO;QACvC,MAAME,KAAKC,SAASF,OAAOD;QAC3B,MAAMH,SAAmB,EAAE;QAC3B,KAAK,MAAMC,KAAKJ,iBAAkB;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gBAAC;gBACrCC;gBACA,MAAMtB;YACV;YAIJ,MAAMyB,cAA6B;gBAC/B,UAAU;gBACV,SAASX,SAAS,KAAK,GAAG,IAAI;gBAC9B,YAAY;gBACZ,GAAGO,MAAM;YACb;YAEA,MAAMK,SAAS3B,UAAUC,KAAKG,oBAAoBkB,OAAO,KAAK;YAE9D,OAAOX,EAAEiB,UAAU,MAAM;gBACpBb,SAAS,KAAK,GAA4C,OAAzCJ,EAAEF,kBAAkB;oBAAE,OAAOa;gBAAO;gBACtDX,EAAE,OAAO;oBACL,KAAKa;oBACLD;oBACAtB;oBACA,QAAQ0B;oBACR,OAAOD;oBACPP;gBACJ;aACH;QACL;IACJ;AACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Image: import("@webiny/website-builder-sdk").Component;
|
|
@@ -1,36 +1,41 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { createFileInput, createTextInput } from "@webiny/website-builder-sdk";
|
|
3
|
-
import { createComponent } from "
|
|
3
|
+
import { createComponent } from "../createComponent.js";
|
|
4
4
|
import { ImageComponent } from "./Image.js";
|
|
5
|
-
|
|
6
|
-
// ImageComponent is a defineComponent result (object), not a plain function.
|
|
7
|
-
// createComponent accepts any component type at runtime; cast to satisfy the
|
|
8
|
-
// type constraint which is only used for input-type inference.
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
-
export const Image = createComponent(ImageComponent as unknown as (props: any) => any, {
|
|
5
|
+
const Image = createComponent(ImageComponent, {
|
|
11
6
|
name: "Webiny/Image",
|
|
12
7
|
label: "Image",
|
|
13
8
|
group: "basic",
|
|
14
|
-
image:
|
|
9
|
+
image: '<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px"><path d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm40-80h480L570-480 450-320l-90-120-120 160Zm-40 80v-560 560Z"/></svg>',
|
|
15
10
|
autoApplyStyles: false,
|
|
16
11
|
inputs: {
|
|
17
12
|
image: createFileInput({
|
|
18
13
|
label: "Image",
|
|
19
|
-
allowedFileTypes: [
|
|
20
|
-
|
|
14
|
+
allowedFileTypes: [
|
|
15
|
+
"image/*"
|
|
16
|
+
],
|
|
17
|
+
onChange: ({ inputs })=>{
|
|
21
18
|
if (inputs.image) {
|
|
22
19
|
inputs.title = inputs.image.name;
|
|
23
20
|
inputs.altText = inputs.image.name;
|
|
24
21
|
}
|
|
25
22
|
}
|
|
26
23
|
}),
|
|
27
|
-
title: createTextInput({
|
|
24
|
+
title: createTextInput({
|
|
25
|
+
label: "Title",
|
|
26
|
+
description: "Title of the image"
|
|
27
|
+
}),
|
|
28
28
|
altText: createTextInput({
|
|
29
29
|
label: "Alternate Text",
|
|
30
30
|
description: "Shown when the user has disabled images"
|
|
31
31
|
})
|
|
32
32
|
},
|
|
33
33
|
defaults: {
|
|
34
|
-
styles: {
|
|
34
|
+
styles: {
|
|
35
|
+
width: "100%"
|
|
36
|
+
}
|
|
35
37
|
}
|
|
36
38
|
});
|
|
39
|
+
export { Image };
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=Image.manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editorComponents/Image.manifest.js","sources":["../../src/editorComponents/Image.manifest.ts"],"sourcesContent":["\"use client\";\nimport { createFileInput, createTextInput } from \"@webiny/website-builder-sdk\";\nimport { createComponent } from \"~/createComponent.js\";\nimport { ImageComponent } from \"./Image.js\";\n\n// ImageComponent is a defineComponent result (object), not a plain function.\n// createComponent accepts any component type at runtime; cast to satisfy the\n// type constraint which is only used for input-type inference.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const Image = createComponent(ImageComponent as unknown as (props: any) => any, {\n name: \"Webiny/Image\",\n label: \"Image\",\n group: \"basic\",\n image: `<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\" width=\"24px\"><path d=\"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm40-80h480L570-480 450-320l-90-120-120 160Zm-40 80v-560 560Z\"/></svg>`,\n autoApplyStyles: false,\n inputs: {\n image: createFileInput({\n label: \"Image\",\n allowedFileTypes: [\"image/*\"],\n onChange: ({ inputs }) => {\n if (inputs.image) {\n inputs.title = inputs.image.name;\n inputs.altText = inputs.image.name;\n }\n }\n }),\n title: createTextInput({ label: \"Title\", description: \"Title of the image\" }),\n altText: createTextInput({\n label: \"Alternate Text\",\n description: \"Shown when the user has disabled images\"\n })\n },\n defaults: {\n styles: { width: \"100%\" }\n }\n});\n"],"names":["Image","createComponent","ImageComponent","createFileInput","inputs","createTextInput"],"mappings":";;;;AASO,MAAMA,QAAQC,gBAAgBC,gBAAkD;IACnF,MAAM;IACN,OAAO;IACP,OAAO;IACP,OAAO;IACP,iBAAiB;IACjB,QAAQ;QACJ,OAAOC,gBAAgB;YACnB,OAAO;YACP,kBAAkB;gBAAC;aAAU;YAC7B,UAAU,CAAC,EAAEC,MAAM,EAAE;gBACjB,IAAIA,OAAO,KAAK,EAAE;oBACdA,OAAO,KAAK,GAAGA,OAAO,KAAK,CAAC,IAAI;oBAChCA,OAAO,OAAO,GAAGA,OAAO,KAAK,CAAC,IAAI;gBACtC;YACJ;QACJ;QACA,OAAOC,gBAAgB;YAAE,OAAO;YAAS,aAAa;QAAqB;QAC3E,SAASA,gBAAgB;YACrB,OAAO;YACP,aAAa;QACjB;IACJ;IACA,UAAU;QACN,QAAQ;YAAE,OAAO;QAAO;IAC5B;AACJ"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ComponentProps } from "../types.js";
|
|
2
|
+
export declare const createLexicalValue: (value: string) => {
|
|
3
|
+
state: string;
|
|
4
|
+
html: string;
|
|
5
|
+
};
|
|
6
|
+
type LexicalProps = ComponentProps<{
|
|
7
|
+
content: {
|
|
8
|
+
html?: string;
|
|
9
|
+
};
|
|
10
|
+
}>;
|
|
11
|
+
/**
|
|
12
|
+
* Renders Lexical rich-text content as raw HTML.
|
|
13
|
+
* The HTML is produced by the editor and stored in `inputs.content.html`.
|
|
14
|
+
*/
|
|
15
|
+
export declare const LexicalComponent: (props: LexicalProps) => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
}> | null;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { h } from "vue";
|
|
2
|
+
const createLexicalValue = (value)=>({
|
|
3
|
+
state: `{"root":{"children":[{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"${value}","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"wby-paragraph","version":1,"textFormat":0,"textStyle":""}],"direction":"ltr","format":"","indent":0,"type":"root","version":1}}`,
|
|
4
|
+
html: `<p class="wb-paragraph-1">${value}</p>`
|
|
5
|
+
});
|
|
6
|
+
const LexicalComponent = (props)=>{
|
|
7
|
+
const html = props.inputs?.content?.html;
|
|
8
|
+
if (!html) return null;
|
|
9
|
+
return h("div", {
|
|
10
|
+
innerHTML: html
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
export { LexicalComponent, createLexicalValue };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=Lexical.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editorComponents/Lexical.js","sources":["../../src/editorComponents/Lexical.ts"],"sourcesContent":["import { h } from \"vue\";\nimport type { ComponentProps } from \"~/types.js\";\n\nexport const createLexicalValue = (value: string) => ({\n state: `{\"root\":{\"children\":[{\"children\":[{\"detail\":0,\"format\":0,\"mode\":\"normal\",\"style\":\"\",\"text\":\"${value}\",\"type\":\"text\",\"version\":1}],\"direction\":\"ltr\",\"format\":\"\",\"indent\":0,\"type\":\"wby-paragraph\",\"version\":1,\"textFormat\":0,\"textStyle\":\"\"}],\"direction\":\"ltr\",\"format\":\"\",\"indent\":0,\"type\":\"root\",\"version\":1}}`,\n html: `<p class=\"wb-paragraph-1\">${value}</p>`\n});\n\ntype LexicalProps = ComponentProps<{\n content: { html?: string };\n}>;\n\n/**\n * Renders Lexical rich-text content as raw HTML.\n * The HTML is produced by the editor and stored in `inputs.content.html`.\n */\nexport const LexicalComponent = (props: LexicalProps) => {\n const html = props.inputs?.content?.html;\n if (!html) {\n return null;\n }\n return h(\"div\", { innerHTML: html });\n};\n"],"names":["createLexicalValue","value","LexicalComponent","props","html","h"],"mappings":";AAGO,MAAMA,qBAAqB,CAACC,QAAmB;QAClD,OAAO,CAAC,4FAA4F,EAAEA,MAAM,8MAA8M,CAAC;QAC3T,MAAM,CAAC,0BAA0B,EAAEA,MAAM,IAAI,CAAC;IAClD;AAUO,MAAMC,mBAAmB,CAACC;IAC7B,MAAMC,OAAOD,MAAM,MAAM,EAAE,SAAS;IACpC,IAAI,CAACC,MACD,OAAO;IAEX,OAAOC,EAAE,OAAO;QAAE,WAAWD;IAAK;AACtC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Lexical: import("@webiny/website-builder-sdk").Component;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createLexicalInput } from "@webiny/website-builder-sdk";
|
|
3
|
+
import { createComponent } from "../createComponent.js";
|
|
4
|
+
import { LexicalComponent, createLexicalValue } from "./Lexical.js";
|
|
5
|
+
const Lexical = createComponent(LexicalComponent, {
|
|
6
|
+
name: "Webiny/Lexical",
|
|
7
|
+
label: "Rich Text",
|
|
8
|
+
group: "basic",
|
|
9
|
+
image: '<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px"><path d="M280-160v-520H80v-120h520v120H400v520H280Zm360 0v-320H520v-120h360v120H760v320H640Z"/></svg>',
|
|
10
|
+
inputs: [
|
|
11
|
+
createLexicalInput({
|
|
12
|
+
name: "content",
|
|
13
|
+
label: "Content"
|
|
14
|
+
})
|
|
15
|
+
],
|
|
16
|
+
defaults: {
|
|
17
|
+
inputs: {
|
|
18
|
+
content: createLexicalValue("Examine she brother prudent add day ham. Far stairs now coming bed oppose hunted become his. You zealously departure had procuring suspicion. Books whose front would purse if be do decay. Quitting you way formerly disposed perceive ladyship are. Common turned boy direct and yet.")
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
export { Lexical };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=Lexical.manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editorComponents/Lexical.manifest.js","sources":["../../src/editorComponents/Lexical.manifest.ts"],"sourcesContent":["\"use client\";\nimport { createLexicalInput } from \"@webiny/website-builder-sdk\";\nimport { createComponent } from \"~/createComponent.js\";\nimport { LexicalComponent, createLexicalValue } from \"./Lexical.js\";\n\nexport const Lexical = createComponent(LexicalComponent, {\n name: \"Webiny/Lexical\",\n label: \"Rich Text\",\n group: \"basic\",\n image: `<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\" width=\"24px\"><path d=\"M280-160v-520H80v-120h520v120H400v520H280Zm360 0v-320H520v-120h360v120H760v320H640Z\"/></svg>`,\n inputs: [\n createLexicalInput({\n name: \"content\",\n label: \"Content\"\n })\n ],\n defaults: {\n inputs: {\n content: createLexicalValue(\n \"Examine she brother prudent add day ham. Far stairs now coming bed oppose hunted become his. You zealously departure had procuring suspicion. Books whose front would purse if be do decay. Quitting you way formerly disposed perceive ladyship are. Common turned boy direct and yet.\"\n )\n }\n }\n});\n"],"names":["Lexical","createComponent","LexicalComponent","createLexicalInput","createLexicalValue"],"mappings":";;;;AAKO,MAAMA,UAAUC,gBAAgBC,kBAAkB;IACrD,MAAM;IACN,OAAO;IACP,OAAO;IACP,OAAO;IACP,QAAQ;QACJC,mBAAmB;YACf,MAAM;YACN,OAAO;QACX;KACH;IACD,UAAU;QACN,QAAQ;YACJ,SAASC,mBACL;QAER;IACJ;AACJ"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ComponentPropsWithChildren } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* The invisible root container — renders only its children slot.
|
|
4
|
+
*/
|
|
5
|
+
export declare const RootComponent: (props: ComponentPropsWithChildren) => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}> | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editorComponents/Root.js","sources":["../../src/editorComponents/Root.ts"],"sourcesContent":["import type { ComponentPropsWithChildren } from \"~/types.js\";\n\n/**\n * The invisible root container — renders only its children slot.\n */\nexport const RootComponent = (props: ComponentPropsWithChildren) => {\n return props.inputs?.children ?? null;\n};\n"],"names":["RootComponent","props"],"mappings":"AAKO,MAAMA,gBAAgB,CAACC,QACnBA,MAAM,MAAM,EAAE,YAAY"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Root: import("@webiny/website-builder-sdk/types.js").Component;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { createComponent } from "
|
|
2
|
+
import { createComponent } from "../createComponent.js";
|
|
3
3
|
import { RootComponent } from "./Root.js";
|
|
4
|
-
|
|
5
|
-
export const Root = createComponent(RootComponent, {
|
|
4
|
+
const Root = createComponent(RootComponent, {
|
|
6
5
|
name: "Webiny/Root",
|
|
7
6
|
label: "Main Content",
|
|
8
7
|
acceptsChildren: true,
|
|
9
8
|
hideFromToolbar: true
|
|
10
9
|
});
|
|
10
|
+
export { Root };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=Root.manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editorComponents/Root.manifest.js","sources":["../../src/editorComponents/Root.manifest.ts"],"sourcesContent":["\"use client\";\nimport { createComponent } from \"~/createComponent.js\";\nimport { RootComponent } from \"./Root.js\";\n\nexport const Root = createComponent(RootComponent, {\n name: \"Webiny/Root\",\n label: \"Main Content\",\n acceptsChildren: true,\n hideFromToolbar: true\n});\n"],"names":["Root","createComponent","RootComponent"],"mappings":";;;AAIO,MAAMA,OAAOC,gBAAgBC,eAAe;IAC/C,MAAM;IACN,OAAO;IACP,iBAAiB;IACjB,iBAAiB;AACrB"}
|