@webiny/website-builder-vue 6.4.0-beta.4

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.
Files changed (45) hide show
  1. package/index.js +4 -0
  2. package/package.json +46 -0
  3. package/src/components/ConnectToEditor.ts +46 -0
  4. package/src/components/DocumentFragment.ts +43 -0
  5. package/src/components/DocumentRenderer.ts +102 -0
  6. package/src/components/DocumentStoreProvider.ts +53 -0
  7. package/src/components/EditingElementRenderer/EditingElementRenderer.presenter.ts +59 -0
  8. package/src/components/EditingElementRenderer/EditingElementRenderer.ts +70 -0
  9. package/src/components/EditingElementRenderer/index.ts +2 -0
  10. package/src/components/ElementIndexProvider.ts +24 -0
  11. package/src/components/ElementRenderer.ts +42 -0
  12. package/src/components/ElementSlot.ts +34 -0
  13. package/src/components/ElementSlotDepthProvider.ts +24 -0
  14. package/src/components/FragmentsProvider.ts +87 -0
  15. package/src/components/LiveElementRenderer.ts +102 -0
  16. package/src/components/LiveElementSlot.ts +46 -0
  17. package/src/components/PreviewElementSlot.ts +43 -0
  18. package/src/components/index.ts +17 -0
  19. package/src/composables/useBindingsForElement.ts +40 -0
  20. package/src/composables/useDocumentState.ts +13 -0
  21. package/src/composables/useObservable.ts +30 -0
  22. package/src/composables/useSelectFromState.ts +18 -0
  23. package/src/composables/useViewport.ts +27 -0
  24. package/src/createComponent.ts +55 -0
  25. package/src/editorComponents/Box.manifest.ts +19 -0
  26. package/src/editorComponents/Box.ts +8 -0
  27. package/src/editorComponents/Fragment.manifest.ts +19 -0
  28. package/src/editorComponents/Fragment.ts +57 -0
  29. package/src/editorComponents/Grid.manifest.ts +166 -0
  30. package/src/editorComponents/Grid.ts +72 -0
  31. package/src/editorComponents/GridColumn.manifest.ts +23 -0
  32. package/src/editorComponents/GridColumn.ts +6 -0
  33. package/src/editorComponents/Image.manifest.ts +36 -0
  34. package/src/editorComponents/Image.ts +144 -0
  35. package/src/editorComponents/Lexical.manifest.ts +24 -0
  36. package/src/editorComponents/Lexical.ts +23 -0
  37. package/src/editorComponents/Root.manifest.ts +10 -0
  38. package/src/editorComponents/Root.ts +8 -0
  39. package/src/editorComponents/index.ts +12 -0
  40. package/src/index.ts +52 -0
  41. package/src/lexical.css +379 -0
  42. package/src/types.ts +46 -0
  43. package/tsconfig.build.json +16 -0
  44. package/tsconfig.json +16 -0
  45. package/webiny.config.js +8 -0
@@ -0,0 +1,379 @@
1
+ .wb-lx-ltr {
2
+ text-align: inherit;
3
+ }
4
+ .wb-lx-rtl {
5
+ text-align: inherit;
6
+ }
7
+ .wb-lx-paragraph {
8
+ }
9
+
10
+ .wb-lx-quote {
11
+ }
12
+
13
+ .wb-lx-h1,
14
+ .wb-lx-h2,
15
+ .wb-lx-h3,
16
+ .wb-lx-h4,
17
+ .wb-lx-h5,
18
+ .wb-lx-h6 {
19
+ }
20
+
21
+ .wb-lx-textBold {
22
+ font-weight: bold;
23
+ }
24
+
25
+ .wb-lx-textItalic {
26
+ font-style: italic;
27
+ }
28
+ .wb-lx-textUnderline {
29
+ text-decoration: underline;
30
+ }
31
+ .wb-lx-textStrikethrough {
32
+ text-decoration: line-through;
33
+ }
34
+ .wb-lx-textUnderlineStrikethrough {
35
+ text-decoration: underline line-through;
36
+ }
37
+
38
+ .wb-lx-textSubscript {
39
+ font-size: 0.8em;
40
+ vertical-align: sub !important;
41
+ }
42
+
43
+ .wb-lx-textSuperscript {
44
+ font-size: 0.8em;
45
+ vertical-align: super;
46
+ }
47
+
48
+ .wb-lx-textCode {
49
+ background-color: rgb(240, 242, 245);
50
+ padding: 1px 0.25rem;
51
+ font-family: Menlo, Consolas, Monaco, monospace;
52
+ font-size: 94%;
53
+ }
54
+ .wb-lx-hashtag {
55
+ background-color: rgba(88, 144, 255, 0.15);
56
+ border-bottom: 1px solid rgba(88, 144, 255, 0.3);
57
+ }
58
+ .wb-lx-link {
59
+ color: var(--wb-theme-color1);
60
+ text-decoration: none;
61
+ > * {
62
+ color: inherit !important;
63
+ }
64
+ }
65
+ .wb-lx-link:hover {
66
+ text-decoration: underline;
67
+ }
68
+ .wb-lx-code {
69
+ background-color: rgb(240, 242, 245);
70
+ font-family: Menlo, Consolas, Monaco, monospace;
71
+ display: block;
72
+ padding: 8px 8px 8px 52px;
73
+ line-height: 1.53;
74
+ font-size: 13px;
75
+ margin: 8px 0;
76
+ tab-size: 2;
77
+ /* white-space: pre; */
78
+ overflow-x: auto;
79
+ position: relative;
80
+ }
81
+ .wb-lx-code:before {
82
+ content: attr(data-gutter);
83
+ position: absolute;
84
+ background-color: #eee;
85
+ left: 0;
86
+ top: 0;
87
+ border-right: 1px solid #ccc;
88
+ padding: 8px;
89
+ color: #777;
90
+ white-space: pre-wrap;
91
+ text-align: right;
92
+ min-width: 25px;
93
+ }
94
+ .wb-lx-table {
95
+ border-collapse: collapse;
96
+ border-spacing: 0;
97
+ max-width: 100%;
98
+ overflow-y: scroll;
99
+ table-layout: fixed;
100
+ width: calc(100% - 25px);
101
+ margin: 30px 0;
102
+ }
103
+ .wb-lx-tableSelected {
104
+ outline: 2px solid rgb(60, 132, 244);
105
+ }
106
+ .wb-lx-tableCell {
107
+ border: 1px solid #bbb;
108
+ min-width: 75px;
109
+ vertical-align: top;
110
+ text-align: start;
111
+ padding: 6px 8px;
112
+ position: relative;
113
+ cursor: default;
114
+ outline: none;
115
+ }
116
+ .wb-lx-tableCellSortedIndicator {
117
+ display: block;
118
+ opacity: 0.5;
119
+ position: absolute;
120
+ bottom: 0;
121
+ left: 0;
122
+ width: 100%;
123
+ height: 4px;
124
+ background-color: #999;
125
+ }
126
+ .wb-lx-tableCellResizer {
127
+ position: absolute;
128
+ right: -4px;
129
+ height: 100%;
130
+ width: 8px;
131
+ cursor: ew-resize;
132
+ z-index: 10;
133
+ top: 0;
134
+ }
135
+ .wb-lx-tableCellHeader {
136
+ background-color: #f2f3f5;
137
+ text-align: start;
138
+ }
139
+ .wb-lx-tableCellSelected {
140
+ background-color: #c9dbf0;
141
+ }
142
+ .wb-lx-tableCellPrimarySelected {
143
+ border: 2px solid rgb(60, 132, 244);
144
+ display: block;
145
+ height: calc(100% - 2px);
146
+ position: absolute;
147
+ width: calc(100% - 2px);
148
+ left: -1px;
149
+ top: -1px;
150
+ z-index: 2;
151
+ }
152
+ .wb-lx-tableCellEditing {
153
+ box-shadow: 0 0 5px rgba(0, 0, 0, 0.4);
154
+ border-radius: 3px;
155
+ }
156
+ .wb-lx-tableAddColumns {
157
+ position: absolute;
158
+ top: 0;
159
+ width: 20px;
160
+ background-color: #eee;
161
+ height: 100%;
162
+ right: 0;
163
+ animation: table-controls 0.2s ease;
164
+ border: 0;
165
+ cursor: pointer;
166
+ }
167
+
168
+ .wb-lx-tableAddColumns:hover {
169
+ background-color: #c9dbf0;
170
+ }
171
+ .wb-lx-tableAddRows {
172
+ position: absolute;
173
+ bottom: -25px;
174
+ width: calc(100% - 25px);
175
+ background-color: #eee;
176
+ height: 20px;
177
+ left: 0;
178
+ animation: table-controls 0.2s ease;
179
+ border: 0;
180
+ cursor: pointer;
181
+ }
182
+ .wb-lx-tableAddRows:hover {
183
+ background-color: #c9dbf0;
184
+ }
185
+ @keyframes table-controls {
186
+ 0% {
187
+ opacity: 0;
188
+ }
189
+ 100% {
190
+ opacity: 1;
191
+ }
192
+ }
193
+ .wb-lx-tableCellResizeRuler {
194
+ display: block;
195
+ position: absolute;
196
+ width: 1px;
197
+ background-color: rgb(60, 132, 244);
198
+ height: 100%;
199
+ top: 0;
200
+ }
201
+ .wb-lx-tableCellActionButtonContainer {
202
+ display: block;
203
+ right: 5px;
204
+ top: 6px;
205
+ position: absolute;
206
+ z-index: 4;
207
+ width: 20px;
208
+ height: 20px;
209
+ }
210
+ .wb-lx-tableCellActionButton {
211
+ background-color: #eee;
212
+ display: block;
213
+ border: 0;
214
+ border-radius: 20px;
215
+ width: 20px;
216
+ height: 20px;
217
+ color: #222;
218
+ cursor: pointer;
219
+ }
220
+ .wb-lx-tableCellActionButton:hover {
221
+ background-color: #ddd;
222
+ }
223
+ .wb-lx-characterLimit {
224
+ display: inline;
225
+ background-color: #ffbbbb !important;
226
+ }
227
+ .wb-lx-ol1 {
228
+ padding: 0;
229
+ margin: 0 0 0 16px;
230
+ list-style: inside;
231
+ }
232
+ .wb-lx-ol2 {
233
+ padding: 0;
234
+ margin: 0 0 0 16px;
235
+ list-style: upper-alpha inside;
236
+ }
237
+ .wb-lx-ol3 {
238
+ list-style: initial;
239
+ list-style: auto;
240
+ padding: 0;
241
+ margin: 0 0 0 16px;
242
+ list-style-type: lower-alpha;
243
+ list-style-position: inside;
244
+ }
245
+ .wb-lx-ol4 {
246
+ padding: 0;
247
+ margin: 0 0 0 16px;
248
+ list-style: upper-roman inside;
249
+ }
250
+ .wb-lx-ol5 {
251
+ padding: 0;
252
+ margin: 0 0 0 16px;
253
+ list-style: lower-roman inside;
254
+ }
255
+ .wb-lx-ul {
256
+ padding: 0;
257
+ margin: 0 0 0 16px;
258
+ list-style: inside;
259
+ }
260
+ .wb-lx-listItem {
261
+ margin: 0 32px;
262
+ }
263
+ .wb-lx-listItemChecked,
264
+ .wb-lx-listItemUnchecked {
265
+ position: relative;
266
+ margin-left: 8px;
267
+ margin-right: 8px;
268
+ padding-left: 24px;
269
+ padding-right: 24px;
270
+ list-style-type: none;
271
+ outline: none;
272
+ }
273
+ .wb-lx-listItemChecked {
274
+ text-decoration: line-through;
275
+ }
276
+ .wb-lx-listItemUnchecked:before,
277
+ .wb-lx-listItemChecked:before {
278
+ content: "";
279
+ width: 16px;
280
+ height: 16px;
281
+ top: 2px;
282
+ left: 0;
283
+ cursor: pointer;
284
+ display: block;
285
+ background-size: cover;
286
+ position: absolute;
287
+ }
288
+ .wb-lx-listItemUnchecked[dir="rtl"]:before,
289
+ .wb-lx-listItemChecked[dir="rtl"]:before {
290
+ left: auto;
291
+ right: 0;
292
+ }
293
+ .wb-lx-listItemUnchecked:focus:before,
294
+ .wb-lx-listItemChecked:focus:before {
295
+ box-shadow: 0 0 0 2px #a6cdfe;
296
+ border-radius: 2px;
297
+ }
298
+ .wb-lx-listItemUnchecked:before {
299
+ border: 1px solid #999;
300
+ border-radius: 2px;
301
+ }
302
+ .wb-lx-listItemChecked:before {
303
+ border: 1px solid rgb(61, 135, 245);
304
+ border-radius: 2px;
305
+ background-color: #3d87f5;
306
+ background-repeat: no-repeat;
307
+ }
308
+ .wb-lx-listItemChecked:after {
309
+ content: "";
310
+ cursor: pointer;
311
+ border-color: #fff;
312
+ border-style: solid;
313
+ position: absolute;
314
+ display: block;
315
+ top: 6px;
316
+ width: 3px;
317
+ left: 7px;
318
+ height: 6px;
319
+ transform: rotate(45deg);
320
+ border-width: 0 2px 2px 0;
321
+ }
322
+ .wb-lx-nestedListItem {
323
+ list-style-type: none;
324
+ }
325
+ .wb-lx-nestedListItem:before,
326
+ .wb-lx-nestedListItem:after {
327
+ display: none;
328
+ }
329
+ .wb-lx-tokenComment {
330
+ color: slategray;
331
+ }
332
+ .wb-lx-tokenPunctuation {
333
+ color: #999;
334
+ }
335
+ .wb-lx-tokenProperty {
336
+ color: #905;
337
+ }
338
+ .wb-lx-tokenSelector {
339
+ color: #690;
340
+ }
341
+ .wb-lx-tokenOperator {
342
+ color: #9a6e3a;
343
+ }
344
+ .wb-lx-tokenAttr {
345
+ color: #07a;
346
+ }
347
+ .wb-lx-tokenVariable {
348
+ color: #e90;
349
+ }
350
+ .wb-lx-tokenFunction {
351
+ color: #dd4a68;
352
+ }
353
+ .wb-lx-mark {
354
+ background: rgba(255, 212, 0, 0.14);
355
+ border-bottom: 2px solid rgba(255, 212, 0, 0.3);
356
+ padding-bottom: 2px;
357
+ }
358
+ .wb-lx-markOverlap {
359
+ background: rgba(255, 212, 0, 0.3);
360
+ border-bottom: 2px solid rgba(255, 212, 0, 0.7);
361
+ }
362
+ .wb-lx-mark.selected {
363
+ background: rgba(255, 212, 0, 0.5);
364
+ border-bottom: 2px solid rgba(255, 212, 0, 1);
365
+ }
366
+ .wb-lx-markOverlap.selected {
367
+ background: rgba(255, 212, 0, 0.7);
368
+ border-bottom: 2px solid rgba(255, 212, 0, 0.7);
369
+ }
370
+ .wb-lx-embedBlock {
371
+ user-select: none;
372
+ }
373
+ .wb-lx-embedBlockFocus {
374
+ outline: 2px solid rgb(60, 132, 244);
375
+ }
376
+
377
+ .wb-lx-placeholder {
378
+ text-align: left;
379
+ }
package/src/types.ts ADDED
@@ -0,0 +1,46 @@
1
+ import type {
2
+ CssProperties,
3
+ DocumentElement,
4
+ ComponentManifestInput,
5
+ ComponentChangeHandler,
6
+ DescendantChangeHandler
7
+ } from "@webiny/website-builder-sdk";
8
+ import type { VNode } from "vue";
9
+
10
+ /**
11
+ * Props received by every user-defined component registered via createComponent().
12
+ */
13
+ export type ComponentProps<TInputs = unknown> = {
14
+ inputs: TInputs;
15
+ styles: CssProperties;
16
+ element: DocumentElement;
17
+ breakpoint: string;
18
+ };
19
+
20
+ /**
21
+ * Shorthand for components that accept children (Box, Root, GridColumn, etc.).
22
+ * `inputs.children` is the resolved VNode produced by ElementSlot.
23
+ */
24
+ export type ComponentPropsWithChildren<TInputs = unknown> = ComponentProps<
25
+ TInputs & { children: VNode | null }
26
+ >;
27
+
28
+ // ---------- TypeScript utility types (mirrors the React package) ----------
29
+
30
+ export type ExtractInputs<T> = T extends { inputs: infer I } ? I : never;
31
+
32
+ export type ExtractInputNames<T extends (props: any) => any> = keyof ExtractInputs<
33
+ Parameters<T>[0]
34
+ >;
35
+
36
+ export type InferManifest<T extends (props: any) => any> = ComponentManifestInput<
37
+ ExtractInputs<Parameters<T>[0]>
38
+ >;
39
+
40
+ export type InferComponentChange<T extends (props: any) => any> = ComponentChangeHandler<
41
+ ExtractInputs<Parameters<T>[0]>
42
+ >;
43
+
44
+ export type InferDescendantChange<T extends (props: any) => any> = DescendantChangeHandler<
45
+ ExtractInputs<Parameters<T>[0]>
46
+ >;
@@ -0,0 +1,16 @@
1
+ {
2
+ "extends": "../../tsconfig.build.json",
3
+ "include": ["src"],
4
+ "references": [{ "path": "../website-builder-sdk/tsconfig.build.json" }],
5
+ "compilerOptions": {
6
+ "rootDir": "./src",
7
+ "outDir": "./dist",
8
+ "declarationDir": "./dist",
9
+ "paths": {
10
+ "~/*": ["./src/*"],
11
+ "~tests/*": ["./__tests__/*"],
12
+ "@webiny/website-builder-sdk/*": ["../website-builder-sdk/src/*"],
13
+ "@webiny/website-builder-sdk": ["../website-builder-sdk/src"]
14
+ }
15
+ }
16
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "include": ["src", "__tests__"],
4
+ "references": [{ "path": "../website-builder-sdk" }],
5
+ "compilerOptions": {
6
+ "rootDirs": ["./src", "./__tests__"],
7
+ "outDir": "./dist",
8
+ "declarationDir": "./dist",
9
+ "paths": {
10
+ "~/*": ["./src/*"],
11
+ "~tests/*": ["./__tests__/*"],
12
+ "@webiny/website-builder-sdk/*": ["../website-builder-sdk/src/*"],
13
+ "@webiny/website-builder-sdk": ["../website-builder-sdk/src"]
14
+ }
15
+ }
16
+ }
@@ -0,0 +1,8 @@
1
+ import { createWatchPackage, createBuildPackage } from "@webiny/build-tools";
2
+
3
+ export default {
4
+ commands: {
5
+ build: createBuildPackage({ cwd: import.meta.dirname }),
6
+ watch: createWatchPackage({ cwd: import.meta.dirname })
7
+ }
8
+ };