@it-consultis/page-builder 1.1.34
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/Editor.d.ts +77 -0
- package/Editor.js +312 -0
- package/LICENSE.txt +674 -0
- package/README.md +248 -0
- package/assets/svg/mp.d.ts +2 -0
- package/assets/svg/mp.js +37 -0
- package/assets/svg/status-bar.d.ts +2 -0
- package/assets/svg/status-bar.js +38 -0
- package/constants/index.d.ts +11 -0
- package/constants/index.js +17 -0
- package/contexts/I18nContext.d.ts +15 -0
- package/contexts/I18nContext.js +56 -0
- package/controls/AlignmentControl/AlignmentControl.d.ts +5 -0
- package/controls/AlignmentControl/AlignmentControl.js +58 -0
- package/controls/AlignmentControl/index.d.ts +3 -0
- package/controls/AlignmentControl/index.js +9 -0
- package/controls/DeviceSwitcher/DeviceSwitcher.d.ts +10 -0
- package/controls/DeviceSwitcher/DeviceSwitcher.js +64 -0
- package/controls/DeviceSwitcher/index.d.ts +2 -0
- package/controls/DeviceSwitcher/index.js +9 -0
- package/controls/GradientColorPicker/GradientColorPicker.d.ts +8 -0
- package/controls/GradientColorPicker/GradientColorPicker.js +81 -0
- package/controls/GradientColorPicker/index.d.ts +2 -0
- package/controls/GradientColorPicker/index.js +9 -0
- package/controls/HeadingControl/HeadingControl.d.ts +14 -0
- package/controls/HeadingControl/HeadingControl.js +251 -0
- package/controls/HeadingControl/HeadingView.d.ts +21 -0
- package/controls/HeadingControl/HeadingView.js +43 -0
- package/controls/HeadingControl/index.d.ts +4 -0
- package/controls/HeadingControl/index.js +16 -0
- package/controls/MediaLibraryControl/FileBrowserDialog.d.ts +14 -0
- package/controls/MediaLibraryControl/FileBrowserDialog.js +138 -0
- package/controls/MediaLibraryControl/MediaLibraryControl.d.ts +38 -0
- package/controls/MediaLibraryControl/MediaLibraryControl.js +537 -0
- package/controls/MediaLibraryControl/index.d.ts +3 -0
- package/controls/MediaLibraryControl/index.js +9 -0
- package/controls/PaddingMarginControl/PaddingMarginControl.d.ts +30 -0
- package/controls/PaddingMarginControl/PaddingMarginControl.js +88 -0
- package/controls/PaddingMarginControl/PaddingMarginForm.d.ts +8 -0
- package/controls/PaddingMarginControl/PaddingMarginForm.js +109 -0
- package/controls/PaddingMarginControl/index.d.ts +4 -0
- package/controls/PaddingMarginControl/index.js +16 -0
- package/controls/PaddingMarginControl/utils.d.ts +3 -0
- package/controls/PaddingMarginControl/utils.js +21 -0
- package/controls/SelectableControl/SelectableControl.d.ts +5 -0
- package/controls/SelectableControl/SelectableControl.js +35 -0
- package/controls/SelectableControl/index.d.ts +3 -0
- package/controls/SelectableControl/index.js +9 -0
- package/hooks/ui-optimizations/useDebounce.d.ts +3 -0
- package/hooks/ui-optimizations/useDebounce.js +23 -0
- package/hooks/ui-optimizations/useThrottle.d.ts +3 -0
- package/hooks/ui-optimizations/useThrottle.js +22 -0
- package/hooks/useMediaImageQuery.d.ts +10 -0
- package/hooks/useMediaImageQuery.js +51 -0
- package/hooks/useSortable.d.ts +20 -0
- package/hooks/useSortable.js +70 -0
- package/index.d.ts +7 -0
- package/index.js +54 -0
- package/layouts/BlocksBar/LayerPanel.d.ts +8 -0
- package/layouts/BlocksBar/LayerPanel.js +299 -0
- package/layouts/BlocksBar/index.d.ts +7 -0
- package/layouts/BlocksBar/index.js +575 -0
- package/layouts/EditorPreview/BlockView.d.ts +16 -0
- package/layouts/EditorPreview/BlockView.js +435 -0
- package/layouts/EditorPreview/index.d.ts +9 -0
- package/layouts/EditorPreview/index.js +463 -0
- package/layouts/Header/index.d.ts +18 -0
- package/layouts/Header/index.js +202 -0
- package/layouts/Header/menus/ExportDataDialog.d.ts +4 -0
- package/layouts/Header/menus/ExportDataDialog.js +95 -0
- package/layouts/Header/menus/ImportDataDialog.d.ts +4 -0
- package/layouts/Header/menus/ImportDataDialog.js +100 -0
- package/layouts/Header/menus/LeftMenu.d.ts +9 -0
- package/layouts/Header/menus/LeftMenu.js +369 -0
- package/layouts/Header/menus/RightMenu.d.ts +14 -0
- package/layouts/Header/menus/RightMenu.js +91 -0
- package/layouts/Header/menus/SaveTemplateDialog.d.ts +4 -0
- package/layouts/Header/menus/SaveTemplateDialog.js +203 -0
- package/layouts/MessageBus.d.ts +13 -0
- package/layouts/MessageBus.js +76 -0
- package/layouts/Sidebar/AddBlockButton.d.ts +12 -0
- package/layouts/Sidebar/AddBlockButton.js +267 -0
- package/layouts/Sidebar/BlockForm.d.ts +20 -0
- package/layouts/Sidebar/BlockForm.js +517 -0
- package/layouts/Sidebar/BlocksControl.d.ts +21 -0
- package/layouts/Sidebar/BlocksControl.js +190 -0
- package/layouts/Sidebar/index.d.ts +10 -0
- package/layouts/Sidebar/index.js +451 -0
- package/layouts/Snackbar.d.ts +3 -0
- package/layouts/Snackbar.js +43 -0
- package/package.json +133 -0
- package/store/Provider.d.ts +15 -0
- package/store/Provider.js +71 -0
- package/store/editor-store-core.d.ts +4 -0
- package/store/editor-store-core.js +271 -0
- package/store/index.d.ts +112 -0
- package/store/index.js +178 -0
- package/theme.d.ts +10 -0
- package/theme.js +9 -0
- package/translation/cn.json +29 -0
- package/translation/en.json +29 -0
- package/translation/fr.json +31 -0
- package/translation/index.d.ts +6 -0
- package/translation/index.js +23 -0
- package/translation/types.d.ts +13 -0
- package/translation/types.js +5 -0
- package/types/Block.d.ts +22 -0
- package/types/Block.js +5 -0
- package/types/BlockType.d.ts +50 -0
- package/types/BlockType.js +5 -0
- package/types/ConfigStorageAdapter.d.ts +11 -0
- package/types/ConfigStorageAdapter.js +5 -0
- package/types/ObjectStorageAdapter.d.ts +68 -0
- package/types/ObjectStorageAdapter.js +5 -0
- package/types/index.d.ts +5 -0
- package/types/index.js +100 -0
- package/types/throttle-and-debounce.d.ts +2 -0
- package/types/throttle-and-debounce.js +5 -0
- package/utils/block.d.ts +16 -0
- package/utils/block.js +41 -0
- package/utils/helpers.d.ts +5 -0
- package/utils/helpers.js +22 -0
- package/utils/strings.d.ts +1 -0
- package/utils/strings.js +11 -0
package/README.md
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
## Editor Component
|
|
2
|
+
|
|
3
|
+
### Full Mode (format="full") Property Description
|
|
4
|
+
|
|
5
|
+
#### Core Properties
|
|
6
|
+
|
|
7
|
+
| Property | Type | Required | Description |
|
|
8
|
+
|------|------|------|------|
|
|
9
|
+
| data | Block[] | No | Editor data content |
|
|
10
|
+
| blockTypes | BlockType[] | Yes | Available block type definition |
|
|
11
|
+
| onChange | (data: Block[]) => void | No | Data change callback function |
|
|
12
|
+
| title | string | No | Editor Title |
|
|
13
|
+
| cardinality | number | No | Block quantity limit, default is -1 indicating no limit |
|
|
14
|
+
| addBlockDisplayFormat | 'select' \| 'button' | No | Add block button display format, default is 'select' |
|
|
15
|
+
| storage | EditorState['storage'] | No | Editor storage configuration |
|
|
16
|
+
| editorTheme | Theme | No | Editor theme configuration |
|
|
17
|
+
| isFullScreen | boolean | No | Whether in full screen mode |
|
|
18
|
+
| previewSrc | string | No | Preview iframe source address |
|
|
19
|
+
| previewWidth | 'sm' \| 'md' \| 'lg' \| 'xl' \| 'full' | No | Preview area width |
|
|
20
|
+
| allowedOrigins | string[] | No | Allow preview iframe source domain name list |
|
|
21
|
+
|
|
22
|
+
#### Event Callback
|
|
23
|
+
|
|
24
|
+
| Callback Method | Type | Description |
|
|
25
|
+
|---------|------|------|
|
|
26
|
+
| onFullScreen | () => void | Enter full screen trigger |
|
|
27
|
+
| onFullScreenExit | () => void | Exit full screen trigger |
|
|
28
|
+
| onPreviewIframeLoad | (iframe: HTMLIFrameElement) => void | Preview iframe load complete trigger |
|
|
29
|
+
| onPreviewInstanceLoad | (preview: PreviewInstance) => void | Preview instance load complete trigger |
|
|
30
|
+
| onAction | (action: { type: string; payload: any }) => void | Editor operation event trigger callback |
|
|
31
|
+
|
|
32
|
+
#### Custom Component
|
|
33
|
+
|
|
34
|
+
| Property | Type | Description |
|
|
35
|
+
|------|------|------|
|
|
36
|
+
| previewWrapperComponent | React.ElementType | Custom preview area wrapper component |
|
|
37
|
+
|
|
38
|
+
### Usage Example
|
|
39
|
+
|
|
40
|
+
#### Basic Preview Mode
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
<Editor
|
|
44
|
+
format="full"
|
|
45
|
+
value={code}
|
|
46
|
+
language="javascript"
|
|
47
|
+
previewSrc="https://preview.example.com"
|
|
48
|
+
previewWidth="md"
|
|
49
|
+
allowedOrigins={['example.com']}
|
|
50
|
+
/>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
#### Full Screen Mode Control
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
<Editor
|
|
57
|
+
format="full"
|
|
58
|
+
isFullScreen={isFullScreen}
|
|
59
|
+
onFullScreen={() => {
|
|
60
|
+
console.log('Trigger full screen event');
|
|
61
|
+
setIsFullScreen(true);
|
|
62
|
+
}}
|
|
63
|
+
onFullScreenExit={() => {
|
|
64
|
+
console.log('Trigger exit full screen event');
|
|
65
|
+
setIsFullScreen(false);
|
|
66
|
+
}}
|
|
67
|
+
/>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
#### Preview Load Event Handling
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
<Editor
|
|
74
|
+
format="full"
|
|
75
|
+
onPreviewIframeLoad={(iframe) => {
|
|
76
|
+
console.log('preview iframe loaded', iframe);
|
|
77
|
+
}}
|
|
78
|
+
onPreviewInstanceLoad={(preview) => {
|
|
79
|
+
console.log('preview instance loaded', preview);
|
|
80
|
+
}}
|
|
81
|
+
/>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
#### Custom Preview Wrapper Component
|
|
85
|
+
|
|
86
|
+
```tsx
|
|
87
|
+
const CustomPreviewWrapper = ({ children }) => (
|
|
88
|
+
<div className="custom-preview-container">
|
|
89
|
+
{children}
|
|
90
|
+
</div>
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
<Editor
|
|
94
|
+
format="full"
|
|
95
|
+
previewWrapperComponent={CustomPreviewWrapper}
|
|
96
|
+
/>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
#### Operation Event Listening
|
|
100
|
+
|
|
101
|
+
```tsx
|
|
102
|
+
<Editor
|
|
103
|
+
format="full"
|
|
104
|
+
onAction={({ type, payload }) => {
|
|
105
|
+
switch (type) {
|
|
106
|
+
case 'save':
|
|
107
|
+
console.log('save operation', payload);
|
|
108
|
+
break;
|
|
109
|
+
case 'format':
|
|
110
|
+
console.log('format operation', payload);
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
}}
|
|
114
|
+
/>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Preview Width Description
|
|
118
|
+
|
|
119
|
+
Preview area width (previewWidth) correspondence:
|
|
120
|
+
- sm: 375px
|
|
121
|
+
- md: 1024px
|
|
122
|
+
- lg: 1280px
|
|
123
|
+
- xl: 1536px
|
|
124
|
+
- full: 100%
|
|
125
|
+
|
|
126
|
+
### Security Description
|
|
127
|
+
|
|
128
|
+
Use the `allowedOrigins` property to restrict the source domain name of the preview iframe, increasing security:
|
|
129
|
+
|
|
130
|
+
```tsx
|
|
131
|
+
<Editor
|
|
132
|
+
format="full"
|
|
133
|
+
previewSrc="https://preview.example.com"
|
|
134
|
+
allowedOrigins={[
|
|
135
|
+
'preview.example.com',
|
|
136
|
+
'test.example.com'
|
|
137
|
+
]}
|
|
138
|
+
/>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Notes
|
|
142
|
+
|
|
143
|
+
1. When using the full mode, ensure that the `previewSrc` points to a valid preview service
|
|
144
|
+
2. When switching to full screen mode, it is recommended to synchronize the other UI state of the application
|
|
145
|
+
3. After the preview instance is loaded, you can obtain the instance through the `onPreviewInstanceLoad` callback for further interaction
|
|
146
|
+
4. When customizing the preview wrapper component, ensure that the child component is correctly passed
|
|
147
|
+
|
|
148
|
+
### Editor Formats
|
|
149
|
+
|
|
150
|
+
Editor supports three display formats:
|
|
151
|
+
|
|
152
|
+
1. Full Format (format="full")
|
|
153
|
+
```tsx
|
|
154
|
+
<Editor
|
|
155
|
+
format="full"
|
|
156
|
+
blockTypes={blockTypes}
|
|
157
|
+
data={data}
|
|
158
|
+
onChange={handleChange}
|
|
159
|
+
title="My Editor"
|
|
160
|
+
/>
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
2. Sidebar Format (format="sidebar")
|
|
164
|
+
```tsx
|
|
165
|
+
<Editor
|
|
166
|
+
format="sidebar"
|
|
167
|
+
blockTypes={blockTypes}
|
|
168
|
+
data={data}
|
|
169
|
+
onChange={handleChange}
|
|
170
|
+
onBack={() => {/* return event */}}
|
|
171
|
+
/>
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
3. Inline Format (format="inline")
|
|
175
|
+
```tsx
|
|
176
|
+
<Editor
|
|
177
|
+
format="inline"
|
|
178
|
+
blockTypes={blockTypes}
|
|
179
|
+
data={data}
|
|
180
|
+
onChange={handleChange}
|
|
181
|
+
/>
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Block Types
|
|
185
|
+
|
|
186
|
+
blockTypes defines the available block types, example:
|
|
187
|
+
|
|
188
|
+
```typescript
|
|
189
|
+
const blockTypes: BlockType[] = [
|
|
190
|
+
{
|
|
191
|
+
type: 'text',
|
|
192
|
+
title: 'Text Block',
|
|
193
|
+
}
|
|
194
|
+
];
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Cardinality
|
|
198
|
+
|
|
199
|
+
cardinality property is used to limit the number of blocks:
|
|
200
|
+
```
|
|
201
|
+
- -1: No limit (default)
|
|
202
|
+
- 0: No blocks allowed
|
|
203
|
+
- n: Maximum of n blocks allowed
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Full example of Editor Component
|
|
207
|
+
|
|
208
|
+
```tsx
|
|
209
|
+
<Editor
|
|
210
|
+
onFullScreen={() => {
|
|
211
|
+
document.documentElement.requestFullscreen();
|
|
212
|
+
}}
|
|
213
|
+
onFullScreenExit={() => {
|
|
214
|
+
document.exitFullscreen();
|
|
215
|
+
}}
|
|
216
|
+
format="full"
|
|
217
|
+
data={data}
|
|
218
|
+
allowedOrigins={[env.wordpressUrl, window.location.origin]}
|
|
219
|
+
blockTypes={blockTypes}
|
|
220
|
+
previewSrc={`${window.location.origin}/${locale}/editor/wordpress/preview`}
|
|
221
|
+
onAction={(action) => {
|
|
222
|
+
const { type, payload } = action;
|
|
223
|
+
switch (type) {
|
|
224
|
+
case "editor/jwtToken":
|
|
225
|
+
configStorage.init({ token: payload });
|
|
226
|
+
objectStorage.init({ token: payload });
|
|
227
|
+
case "editor/page/categoryId":
|
|
228
|
+
// How to mock the payload?
|
|
229
|
+
// window.postMessage({type:"editor/page/categoryId", payload: "15"})
|
|
230
|
+
// window.previewPayload = payload;
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
}}
|
|
234
|
+
storage={{
|
|
235
|
+
object: objectStorage,
|
|
236
|
+
config: configStorage,
|
|
237
|
+
}}
|
|
238
|
+
onChange={(newData) => {
|
|
239
|
+
if (isDev && !isInIframe) {
|
|
240
|
+
window.clearTimeout(timeoutId);
|
|
241
|
+
setData(newData);
|
|
242
|
+
timeoutId = window.setTimeout(() => {
|
|
243
|
+
localStorage.setItem(storageKey, JSON.stringify(newData));
|
|
244
|
+
}, 300);
|
|
245
|
+
}
|
|
246
|
+
}}
|
|
247
|
+
/>
|
|
248
|
+
```
|
package/assets/svg/mp.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = MpIcon;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _store = require("../../store");
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
function MpIcon(props = {}) {
|
|
12
|
+
const {
|
|
13
|
+
theme: {
|
|
14
|
+
palette: {
|
|
15
|
+
header: {
|
|
16
|
+
text = ''
|
|
17
|
+
} = {}
|
|
18
|
+
} = {}
|
|
19
|
+
} = {}
|
|
20
|
+
} = (0, _store.useEditorStore)(state => state);
|
|
21
|
+
return (
|
|
22
|
+
/*#__PURE__*/
|
|
23
|
+
// eslint-disable-next-line react/react-in-jsx-scope
|
|
24
|
+
(0, _jsxRuntime.jsx)("svg", {
|
|
25
|
+
className: "icon",
|
|
26
|
+
viewBox: "0 0 1024 1024",
|
|
27
|
+
version: "1.1",
|
|
28
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
29
|
+
width: "23",
|
|
30
|
+
height: "23",
|
|
31
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
32
|
+
d: "M512.042667 938.666667c-235.648 0-426.666667-191.018667-426.666667-426.666667s191.018667-426.666667 426.666667-426.666667 426.666667 191.018667 426.666666 426.666667-191.018667 426.666667-426.666666 426.666667z m0-85.333334a341.333333 341.333333 0 1 0 0-682.666666 341.333333 341.333333 0 0 0 0 682.666666z m42.666666-256a149.333333 149.333333 0 1 1-212.352-135.424 42.666667 42.666667 0 1 1 36.053334 77.354667A64 64 0 1 0 469.333333 597.333333v-170.666666a149.333333 149.333333 0 1 1 212.352 135.424 42.666667 42.666667 0 0 1-36.053333-77.354667A64 64 0 1 0 554.709333 426.666667v170.666666z",
|
|
33
|
+
fill: text || '#ffffff'
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = StatusBar;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
function StatusBar(props = {}) {
|
|
11
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("svg", {
|
|
12
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
13
|
+
width: "68",
|
|
14
|
+
height: "12",
|
|
15
|
+
viewBox: "0 0 68 12",
|
|
16
|
+
fill: "none",
|
|
17
|
+
...props,
|
|
18
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
19
|
+
opacity: "0.35",
|
|
20
|
+
d: "M45.667 0.833374H62.333C63.5296 0.833374 64.5 1.80375 64.5 3.00037V9.00037C64.4998 10.1968 63.5295 11.1664 62.333 11.1664H45.667C44.4705 11.1664 43.5002 10.1968 43.5 9.00037V3.00037L43.5107 2.77869C43.6216 1.68603 44.5451 0.833374 45.667 0.833374Z",
|
|
21
|
+
stroke: "black",
|
|
22
|
+
fill: props.fill || 'black'
|
|
23
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
24
|
+
opacity: "0.4",
|
|
25
|
+
d: "M66 4.00006V8.00006C66.8047 7.66128 67.328 6.87319 67.328 6.00006C67.328 5.12693 66.8047 4.33884 66 4.00006Z",
|
|
26
|
+
fill: props.fill || 'black'
|
|
27
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
28
|
+
d: "M45 3.66671C45 2.93033 45.597 2.33337 46.3333 2.33337H61.6667C62.403 2.33337 63 2.93033 63 3.66671V8.33337C63 9.06975 62.403 9.66671 61.6667 9.66671H46.3333C45.597 9.66671 45 9.06975 45 8.33337V3.66671Z",
|
|
29
|
+
fill: props.fill || 'black'
|
|
30
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
31
|
+
d: "M28.1206 8.73108C29.3961 7.65226 31.264 7.65239 32.5396 8.73108C32.6037 8.78911 32.6413 8.87114 32.6431 8.95764C32.6448 9.0441 32.611 9.12754 32.5493 9.18811L30.5523 11.2037C30.4938 11.2629 30.4138 11.2964 30.3306 11.2965C30.2473 11.2965 30.1674 11.2629 30.1089 11.2037L28.1108 9.18811C28.0492 9.12751 28.0153 9.04406 28.0171 8.95764C28.0189 8.87116 28.0564 8.78906 28.1206 8.73108ZM25.4556 6.04163C28.2037 3.48563 32.4594 3.48559 35.2075 6.04163C35.2695 6.10148 35.3052 6.18402 35.3062 6.27014C35.307 6.35629 35.2731 6.43944 35.2124 6.50061L34.0581 7.6676C33.9392 7.78669 33.7466 7.78929 33.6245 7.67346C32.7221 6.85631 31.548 6.40392 30.3306 6.40393C29.1139 6.40444 27.9405 6.85679 27.0386 7.67346C26.9165 7.78935 26.7239 7.78671 26.605 7.6676L25.4507 6.50061C25.39 6.43954 25.3561 6.35627 25.3569 6.27014C25.3579 6.18402 25.3936 6.10146 25.4556 6.04163ZM22.7896 3.35999C27.0045 -0.679441 33.6545 -0.679202 37.8696 3.35999C37.9306 3.41994 37.9657 3.50204 37.9663 3.58753C37.9668 3.67306 37.9328 3.75533 37.8726 3.81604L36.7163 4.98303C36.5972 5.10257 36.4046 5.10378 36.2837 4.98596C34.6778 3.45922 32.5464 2.60819 30.3306 2.60803C28.1145 2.60803 25.9826 3.45912 24.3765 4.98596C24.2556 5.10402 24.0619 5.10294 23.9429 4.98303L22.7866 3.81604C22.7266 3.75531 22.6933 3.67294 22.6939 3.58753C22.6945 3.50204 22.7286 3.4199 22.7896 3.35999Z",
|
|
32
|
+
fill: props.fill || 'black'
|
|
33
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
34
|
+
d: "M2.66699 7.33362C3.21914 7.33378 3.66699 7.78144 3.66699 8.33362V10.3336C3.66682 10.8857 3.21903 11.3335 2.66699 11.3336H1.66699C1.11482 11.3336 0.667168 10.8858 0.666992 10.3336V8.33362C0.666992 7.78133 1.11471 7.33362 1.66699 7.33362H2.66699ZM7.33301 5.33362C7.88529 5.33362 8.33301 5.78133 8.33301 6.33362V10.3336C8.33283 10.8858 7.88518 11.3336 7.33301 11.3336H6.33301C5.78099 11.3334 5.33318 10.8856 5.33301 10.3336V6.33362C5.33301 5.78145 5.78088 5.3338 6.33301 5.33362H7.33301ZM12 2.99963C12.5522 2.99963 12.9998 3.4475 13 3.99963V10.3336C12.9998 10.8858 12.5522 11.3336 12 11.3336H11C10.4478 11.3336 10.0002 10.8857 10 10.3336V3.99963C10.0002 3.44751 10.4478 2.99965 11 2.99963H12ZM16.667 0.666626C17.2191 0.666791 17.667 1.11444 17.667 1.66663V10.3336C17.6668 10.8857 17.219 11.3335 16.667 11.3336H15.667C15.1148 11.3336 14.6672 10.8858 14.667 10.3336V1.66663C14.667 1.11434 15.1147 0.666626 15.667 0.666626H16.667Z",
|
|
35
|
+
fill: props.fill || 'black'
|
|
36
|
+
})]
|
|
37
|
+
});
|
|
38
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const MP_QUERY_KEY = "mp";
|
|
2
|
+
export declare const MP_QUERY_VALUE = "1";
|
|
3
|
+
export declare const MP_NAV_BAR_TYPE = "mp-nav";
|
|
4
|
+
export declare const PLATINUM_QUERY_KEY = "platinum";
|
|
5
|
+
export declare const PLATINUM_QUERY_VALUE = "1";
|
|
6
|
+
export declare const EDITOR_READY = "editor/editorReady";
|
|
7
|
+
export declare const EDITOR_DATA = "editor/editorData";
|
|
8
|
+
export declare const EDITOR_BLOCK_UPDATE = "editor/blockUpdate";
|
|
9
|
+
export declare const EDITOR_BLOCK_DELETE = "editor/blockDelete";
|
|
10
|
+
export declare const EDITOR_BLOCK_ADD = "editor/blockAdd";
|
|
11
|
+
export declare const isDev: boolean;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isDev = exports.PLATINUM_QUERY_VALUE = exports.PLATINUM_QUERY_KEY = exports.MP_QUERY_VALUE = exports.MP_QUERY_KEY = exports.MP_NAV_BAR_TYPE = exports.EDITOR_READY = exports.EDITOR_DATA = exports.EDITOR_BLOCK_UPDATE = exports.EDITOR_BLOCK_DELETE = exports.EDITOR_BLOCK_ADD = void 0;
|
|
7
|
+
const MP_QUERY_KEY = exports.MP_QUERY_KEY = 'mp';
|
|
8
|
+
const MP_QUERY_VALUE = exports.MP_QUERY_VALUE = '1';
|
|
9
|
+
const MP_NAV_BAR_TYPE = exports.MP_NAV_BAR_TYPE = 'mp-nav';
|
|
10
|
+
const PLATINUM_QUERY_KEY = exports.PLATINUM_QUERY_KEY = 'platinum';
|
|
11
|
+
const PLATINUM_QUERY_VALUE = exports.PLATINUM_QUERY_VALUE = '1';
|
|
12
|
+
const EDITOR_READY = exports.EDITOR_READY = 'editor/editorReady';
|
|
13
|
+
const EDITOR_DATA = exports.EDITOR_DATA = 'editor/editorData';
|
|
14
|
+
const EDITOR_BLOCK_UPDATE = exports.EDITOR_BLOCK_UPDATE = 'editor/blockUpdate';
|
|
15
|
+
const EDITOR_BLOCK_DELETE = exports.EDITOR_BLOCK_DELETE = 'editor/blockDelete';
|
|
16
|
+
const EDITOR_BLOCK_ADD = exports.EDITOR_BLOCK_ADD = 'editor/blockAdd';
|
|
17
|
+
const isDev = exports.isDev = "production" === 'development';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { LocaleType, TMessage, TranslationKey } from '../translation';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
interface I18nContextValue {
|
|
4
|
+
locale: LocaleType;
|
|
5
|
+
translations: TMessage;
|
|
6
|
+
t: (key: TranslationKey) => string;
|
|
7
|
+
}
|
|
8
|
+
interface I18nProviderProps {
|
|
9
|
+
locale: LocaleType;
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export declare const I18nProvider: React.FC<I18nProviderProps>;
|
|
13
|
+
export declare const useTranslation: () => I18nContextValue;
|
|
14
|
+
export declare const useT: () => (key: TranslationKey) => string;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useTranslation = exports.useT = exports.I18nProvider = void 0;
|
|
7
|
+
var _translation = require("../translation");
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
11
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
12
|
+
const I18nContext = /*#__PURE__*/(0, _react.createContext)(undefined);
|
|
13
|
+
const I18nProvider = ({
|
|
14
|
+
locale,
|
|
15
|
+
children
|
|
16
|
+
}) => {
|
|
17
|
+
const value = (0, _react.useMemo)(() => {
|
|
18
|
+
const translations = (0, _translation.getTranslations)(locale);
|
|
19
|
+
const t = key => {
|
|
20
|
+
const keys = key.split('.');
|
|
21
|
+
const result = keys.reduce((current, k) => {
|
|
22
|
+
if (current && typeof current === 'object' && k in current) {
|
|
23
|
+
return current[k];
|
|
24
|
+
}
|
|
25
|
+
console.warn(`Translation key not found: ${key} for locale: ${locale}`);
|
|
26
|
+
return undefined;
|
|
27
|
+
}, translations);
|
|
28
|
+
return typeof result === 'string' ? result : key;
|
|
29
|
+
};
|
|
30
|
+
return {
|
|
31
|
+
locale,
|
|
32
|
+
translations,
|
|
33
|
+
t
|
|
34
|
+
};
|
|
35
|
+
}, [locale]);
|
|
36
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(I18nContext.Provider, {
|
|
37
|
+
value: value,
|
|
38
|
+
children: children
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
exports.I18nProvider = I18nProvider;
|
|
42
|
+
const useTranslation = () => {
|
|
43
|
+
const context = (0, _react.useContext)(I18nContext);
|
|
44
|
+
if (context === undefined) {
|
|
45
|
+
throw new Error('useTranslation must be used within a I18nProvider');
|
|
46
|
+
}
|
|
47
|
+
return context;
|
|
48
|
+
};
|
|
49
|
+
exports.useTranslation = useTranslation;
|
|
50
|
+
const useT = () => {
|
|
51
|
+
const {
|
|
52
|
+
t
|
|
53
|
+
} = useTranslation();
|
|
54
|
+
return t;
|
|
55
|
+
};
|
|
56
|
+
exports.useT = useT;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = AlignmentControl;
|
|
8
|
+
var _FormatAlignCenter = _interopRequireDefault(require("@mui/icons-material/FormatAlignCenter"));
|
|
9
|
+
var _FormatAlignJustify = _interopRequireDefault(require("@mui/icons-material/FormatAlignJustify"));
|
|
10
|
+
var _FormatAlignLeft = _interopRequireDefault(require("@mui/icons-material/FormatAlignLeft"));
|
|
11
|
+
var _FormatAlignRight = _interopRequireDefault(require("@mui/icons-material/FormatAlignRight"));
|
|
12
|
+
var _Button = _interopRequireDefault(require("@mui/material/Button"));
|
|
13
|
+
var _ButtonGroup = _interopRequireDefault(require("@mui/material/ButtonGroup"));
|
|
14
|
+
var _react = _interopRequireDefault(require("react"));
|
|
15
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
+
const alignIcons = [{
|
|
18
|
+
align: 'left',
|
|
19
|
+
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormatAlignLeft.default, {})
|
|
20
|
+
}, {
|
|
21
|
+
align: 'center',
|
|
22
|
+
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormatAlignCenter.default, {})
|
|
23
|
+
}, {
|
|
24
|
+
align: 'right',
|
|
25
|
+
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormatAlignRight.default, {})
|
|
26
|
+
}, {
|
|
27
|
+
align: 'none',
|
|
28
|
+
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormatAlignJustify.default, {})
|
|
29
|
+
}];
|
|
30
|
+
function AlignmentControl({
|
|
31
|
+
current,
|
|
32
|
+
onChange
|
|
33
|
+
}) {
|
|
34
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
35
|
+
style: {
|
|
36
|
+
display: 'flex',
|
|
37
|
+
flexDirection: 'column',
|
|
38
|
+
gap: 10
|
|
39
|
+
},
|
|
40
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
41
|
+
style: {
|
|
42
|
+
fontWeight: 'bold',
|
|
43
|
+
textTransform: 'uppercase'
|
|
44
|
+
},
|
|
45
|
+
children: "Alignment"
|
|
46
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonGroup.default, {
|
|
47
|
+
variant: "outlined",
|
|
48
|
+
children: alignIcons.map(item => /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
49
|
+
size: "small",
|
|
50
|
+
variant: current === item.align ? 'contained' : 'outlined',
|
|
51
|
+
onClick: () => {
|
|
52
|
+
onChange(item.align);
|
|
53
|
+
},
|
|
54
|
+
children: item.icon
|
|
55
|
+
}, item.align))
|
|
56
|
+
})]
|
|
57
|
+
});
|
|
58
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _AlignmentControl = _interopRequireDefault(require("./AlignmentControl"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
var _default = exports.default = _AlignmentControl.default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type DeviceMode = 'desktop' | 'mobile';
|
|
3
|
+
interface DeviceSwitcherProps {
|
|
4
|
+
value: DeviceMode;
|
|
5
|
+
onChange: (device: DeviceMode) => void;
|
|
6
|
+
title: string;
|
|
7
|
+
children: (device: DeviceMode) => React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export default function DeviceSwitcher({ value, onChange, title, children }: DeviceSwitcherProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = DeviceSwitcher;
|
|
7
|
+
var _Laptop = _interopRequireDefault(require("@mui/icons-material/Laptop"));
|
|
8
|
+
var _PhoneIphone = _interopRequireDefault(require("@mui/icons-material/PhoneIphone"));
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _store = require("../../store");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
function DeviceSwitcher({
|
|
14
|
+
value,
|
|
15
|
+
onChange,
|
|
16
|
+
title,
|
|
17
|
+
children
|
|
18
|
+
}) {
|
|
19
|
+
const {
|
|
20
|
+
setPreviewWidth
|
|
21
|
+
} = (0, _store.useEditorStore)(state => state);
|
|
22
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
23
|
+
className: "flex flex-col gap-4",
|
|
24
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
25
|
+
className: "flex justify-between gap-4",
|
|
26
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
27
|
+
className: "font-bold",
|
|
28
|
+
style: {
|
|
29
|
+
textTransform: 'uppercase'
|
|
30
|
+
},
|
|
31
|
+
children: title
|
|
32
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
33
|
+
className: "flex cursor-pointer gap-4",
|
|
34
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
35
|
+
"aria-label": "Desktop",
|
|
36
|
+
type: "button",
|
|
37
|
+
style: {
|
|
38
|
+
color: value === 'desktop' ? '#dc2626' : 'inherit'
|
|
39
|
+
},
|
|
40
|
+
onClick: () => {
|
|
41
|
+
onChange('desktop');
|
|
42
|
+
setPreviewWidth('lg');
|
|
43
|
+
},
|
|
44
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Laptop.default, {
|
|
45
|
+
fontSize: "small"
|
|
46
|
+
})
|
|
47
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
48
|
+
"aria-label": "Mobile",
|
|
49
|
+
type: "button",
|
|
50
|
+
style: {
|
|
51
|
+
color: value === 'mobile' ? '#dc2626' : 'inherit'
|
|
52
|
+
},
|
|
53
|
+
onClick: () => {
|
|
54
|
+
onChange('mobile');
|
|
55
|
+
setPreviewWidth('sm');
|
|
56
|
+
},
|
|
57
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PhoneIphone.default, {
|
|
58
|
+
fontSize: "small"
|
|
59
|
+
})
|
|
60
|
+
})]
|
|
61
|
+
})]
|
|
62
|
+
}), children(value)]
|
|
63
|
+
});
|
|
64
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _DeviceSwitcher = _interopRequireDefault(require("./DeviceSwitcher"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
var _default = exports.default = _DeviceSwitcher.default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type GradientColorPickerProps = {
|
|
2
|
+
current: string;
|
|
3
|
+
onChange: (value: string) => void;
|
|
4
|
+
label?: string;
|
|
5
|
+
presets: string[];
|
|
6
|
+
};
|
|
7
|
+
declare function GradientColorPicker({ current, onChange, label, presets }: GradientColorPickerProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default GradientColorPicker;
|