@lyads/visual-editor 0.0.0-stage → 1.0.1

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 (258) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/LICENSE +201 -0
  3. package/NOTICE +8 -0
  4. package/README.md +135 -2
  5. package/THIRD_PARTY_NOTICES.md +21259 -0
  6. package/dist/application/block-placement.d.ts +30 -0
  7. package/dist/application/block-session.d.ts +135 -0
  8. package/dist/application/content-service.d.ts +73 -0
  9. package/dist/application/document-commands.d.ts +51 -0
  10. package/dist/application/document-metadata.d.ts +30 -0
  11. package/dist/application/document-presentation.d.ts +35 -0
  12. package/dist/application/email-insertion.d.ts +76 -0
  13. package/dist/application/host.d.ts +36 -0
  14. package/dist/application/image-link.d.ts +36 -0
  15. package/dist/application/section-layout.d.ts +25 -0
  16. package/dist/application/session.d.ts +128 -0
  17. package/dist/assets/browser-worker-D56tNvnb.js +1014 -0
  18. package/dist/assets/browser-worker-D56tNvnb.js.map +1 -0
  19. package/dist/block-controller-RjYGvOcn.js +2468 -0
  20. package/dist/block-controller-RjYGvOcn.js.map +1 -0
  21. package/dist/block-factory-C5oHi4Fm.js +5397 -0
  22. package/dist/block-factory-C5oHi4Fm.js.map +1 -0
  23. package/dist/blocks/block-checks.d.ts +34 -0
  24. package/dist/blocks/block-inspector.d.ts +55 -0
  25. package/dist/blocks/block-output.d.ts +28 -0
  26. package/dist/blocks/block-type.d.ts +124 -0
  27. package/dist/blocks/content-guard.d.ts +52 -0
  28. package/dist/blocks/conversion.d.ts +22 -0
  29. package/dist/blocks/definitions.d.ts +43 -0
  30. package/dist/blocks/device-styles.d.ts +31 -0
  31. package/dist/blocks/email-generator.d.ts +22 -0
  32. package/dist/blocks/email-preview.d.ts +23 -0
  33. package/dist/blocks/email-renderer.d.ts +20 -0
  34. package/dist/blocks/fields.d.ts +34 -0
  35. package/dist/blocks/page-generator.d.ts +16 -0
  36. package/dist/blocks/render-context.d.ts +58 -0
  37. package/dist/blocks/styles.d.ts +54 -0
  38. package/dist/blocks/types/embed.d.ts +40 -0
  39. package/dist/blocks/types/layout.d.ts +41 -0
  40. package/dist/blocks/types/media.d.ts +53 -0
  41. package/dist/blocks/types/structure.d.ts +44 -0
  42. package/dist/blocks/types/text.d.ts +88 -0
  43. package/dist/blocks/values.d.ts +64 -0
  44. package/dist/browser.js +69 -0
  45. package/dist/browser.js.map +1 -0
  46. package/dist/canvas-runtime/action-bar.d.ts +19 -0
  47. package/dist/canvas-runtime/auto-scroll.d.ts +10 -0
  48. package/dist/canvas-runtime/block-drag.d.ts +29 -0
  49. package/dist/canvas-runtime/bridge.d.ts +6 -0
  50. package/dist/canvas-runtime/context.d.ts +53 -0
  51. package/dist/canvas-runtime/document-sync.d.ts +21 -0
  52. package/dist/canvas-runtime/drop-targets.d.ts +34 -0
  53. package/dist/canvas-runtime/embed-markers.d.ts +15 -0
  54. package/dist/canvas-runtime/file-guard.d.ts +12 -0
  55. package/dist/canvas-runtime/image-tools.d.ts +31 -0
  56. package/dist/canvas-runtime/keyboard.d.ts +18 -0
  57. package/dist/canvas-runtime/main.d.ts +1 -0
  58. package/dist/canvas-runtime/messages.d.ts +26 -0
  59. package/dist/canvas-runtime/morph.d.ts +21 -0
  60. package/dist/canvas-runtime/navigation.d.ts +29 -0
  61. package/dist/canvas-runtime/overlay.d.ts +15 -0
  62. package/dist/canvas-runtime/pointer-intents.d.ts +14 -0
  63. package/dist/canvas-runtime/selection-layer.d.ts +16 -0
  64. package/dist/canvas-runtime/shared/shortcuts.d.ts +27 -0
  65. package/dist/canvas-runtime/text-editor.d.ts +55 -0
  66. package/dist/canvas-runtime/text-session.d.ts +39 -0
  67. package/dist/canvas-runtime/variable-marks.d.ts +20 -0
  68. package/dist/canvas-runtime/viewport.d.ts +10 -0
  69. package/dist/codecs/css.d.ts +74 -0
  70. package/dist/codecs/html.d.ts +81 -0
  71. package/dist/compilation/browser-compiler.d.ts +14 -0
  72. package/dist/compilation/browser-worker.d.ts +1 -0
  73. package/dist/compilation/compile-lanes.d.ts +18 -0
  74. package/dist/compilation/generated-mjml.d.ts +25 -0
  75. package/dist/compilation/guard.d.ts +40 -0
  76. package/dist/compilation/node-compiler.d.ts +17 -0
  77. package/dist/compilation/node-worker.d.ts +1 -0
  78. package/dist/composition/block-factory.d.ts +84 -0
  79. package/dist/composition/browser.d.ts +48 -0
  80. package/dist/composition/factory.d.ts +48 -0
  81. package/dist/composition/server.d.ts +43 -0
  82. package/dist/core/any-document.d.ts +16 -0
  83. package/dist/core/block-document.d.ts +215 -0
  84. package/dist/core/budget.d.ts +32 -0
  85. package/dist/core/canvas-contract.d.ts +29 -0
  86. package/dist/core/canvas-layout.d.ts +66 -0
  87. package/dist/core/catalog.d.ts +35 -0
  88. package/dist/core/document-presentation.d.ts +21 -0
  89. package/dist/core/document.d.ts +99 -0
  90. package/dist/core/history.d.ts +26 -0
  91. package/dist/core/html-content-model.d.ts +32 -0
  92. package/dist/core/html-escape.d.ts +2 -0
  93. package/dist/core/rich-text-format.d.ts +14 -0
  94. package/dist/core/rich-text-markup.d.ts +28 -0
  95. package/dist/core/section-layout.d.ts +83 -0
  96. package/dist/generated-mjml-CtzE-f3v.js +1235 -0
  97. package/dist/generated-mjml-CtzE-f3v.js.map +1 -0
  98. package/dist/identity-CJHb6l9N.js +13759 -0
  99. package/dist/identity-CJHb6l9N.js.map +1 -0
  100. package/dist/renderers/canvas-bridge.d.ts +75 -0
  101. package/dist/renderers/canvas-icons.d.ts +1 -0
  102. package/dist/renderers/canvas-runtime.generated.d.ts +3 -0
  103. package/dist/renderers/element-source.d.ts +13 -0
  104. package/dist/renderers/email-renderer.d.ts +14 -0
  105. package/dist/renderers/marked-preview.d.ts +34 -0
  106. package/dist/renderers/markup-tree.d.ts +36 -0
  107. package/dist/renderers/page-renderer.d.ts +15 -0
  108. package/dist/renderers/preview-document.d.ts +39 -0
  109. package/dist/renderers/preview-frame.d.ts +102 -0
  110. package/dist/renderers/section-scaffold.d.ts +16 -0
  111. package/dist/renderers/selection-preview.d.ts +47 -0
  112. package/dist/rich-text/command-executor.d.ts +26 -0
  113. package/dist/rich-text/commands.d.ts +36 -0
  114. package/dist/rich-text/document-builder.d.ts +52 -0
  115. package/dist/rich-text/formatting.d.ts +17 -0
  116. package/dist/rich-text/projection-export.d.ts +17 -0
  117. package/dist/rich-text/projection-rules.d.ts +13 -0
  118. package/dist/rich-text/schema.d.ts +50 -0
  119. package/dist/rich-text/whitespace.d.ts +7 -0
  120. package/dist/security/bounded-parser.d.ts +18 -0
  121. package/dist/security/conditional-comment.d.ts +30 -0
  122. package/dist/security/content-inventory.d.ts +78 -0
  123. package/dist/security/email-sanitizer.d.ts +36 -0
  124. package/dist/security/identity.d.ts +6 -0
  125. package/dist/security/markup-rules.d.ts +31 -0
  126. package/dist/security/policy.d.ts +61 -0
  127. package/dist/security/preview-message.d.ts +317 -0
  128. package/dist/security/rich-text-projection.d.ts +19 -0
  129. package/dist/security/sha256.d.ts +6 -0
  130. package/dist/security/source-markup.d.ts +53 -0
  131. package/dist/security/text-presentation.d.ts +19 -0
  132. package/dist/security/url-policy.d.ts +23 -0
  133. package/dist/server-worker.js +17 -0
  134. package/dist/server-worker.js.map +1 -0
  135. package/dist/server.js +79 -0
  136. package/dist/server.js.map +1 -0
  137. package/dist/templates/blank-email.d.ts +6 -0
  138. package/dist/templates/blocks/catalog.d.ts +31 -0
  139. package/dist/templates/catalog.d.ts +31 -0
  140. package/dist/visual-editor.css +2 -0
  141. package/dist/vue/block-controller.d.ts +106 -0
  142. package/dist/vue/block-workbench.d.ts +70 -0
  143. package/dist/vue/canvas/canvas-theme.d.ts +8 -0
  144. package/dist/vue/canvas/file-drop.d.ts +38 -0
  145. package/dist/vue/canvas/frame-window.d.ts +26 -0
  146. package/dist/vue/canvas/inline-text.d.ts +98 -0
  147. package/dist/vue/canvas/palette-drag.d.ts +55 -0
  148. package/dist/vue/canvas/piece-requests.d.ts +48 -0
  149. package/dist/vue/canvas/strip-reserve.d.ts +14 -0
  150. package/dist/vue/canvas-content-label.d.ts +5 -0
  151. package/dist/vue/components/BlockVisualEditor.vue.d.ts +44 -0
  152. package/dist/vue/components/CanvasSurface.vue.d.ts +11 -0
  153. package/dist/vue/components/CodeEditor.vue.d.ts +22 -0
  154. package/dist/vue/components/EditorBlockMenus.vue.d.ts +3 -0
  155. package/dist/vue/components/EditorBlockPalette.vue.d.ts +3 -0
  156. package/dist/vue/components/EditorDiagnostics.vue.d.ts +3 -0
  157. package/dist/vue/components/EditorDialogs.vue.d.ts +16 -0
  158. package/dist/vue/components/EditorDocumentMetadata.vue.d.ts +3 -0
  159. package/dist/vue/components/EditorDocumentStyles.vue.d.ts +15 -0
  160. package/dist/vue/components/EditorImageSizeControls.vue.d.ts +23 -0
  161. package/dist/vue/components/EditorLayoutControls.vue.d.ts +16 -0
  162. package/dist/vue/components/EditorLeftPanel.vue.d.ts +3 -0
  163. package/dist/vue/components/EditorNoticeIndicator.vue.d.ts +3 -0
  164. package/dist/vue/components/EditorPreview.vue.d.ts +8 -0
  165. package/dist/vue/components/EditorProperties.vue.d.ts +14 -0
  166. package/dist/vue/components/EditorRichTextControls.vue.d.ts +25 -0
  167. package/dist/vue/components/EditorSelectionPath.vue.d.ts +11 -0
  168. package/dist/vue/components/EditorShortcutHelp.vue.d.ts +3 -0
  169. package/dist/vue/components/EditorSourcePane.vue.d.ts +3 -0
  170. package/dist/vue/components/EditorStructureTree.vue.d.ts +3 -0
  171. package/dist/vue/components/EditorTemplateGallery.vue.d.ts +15 -0
  172. package/dist/vue/components/EditorTopBar.vue.d.ts +33 -0
  173. package/dist/vue/components/RichTextEditor.vue.d.ts +47 -0
  174. package/dist/vue/components/SelectionPreviewFrame.vue.d.ts +212 -0
  175. package/dist/vue/components/VisualEditor.vue.d.ts +53 -0
  176. package/dist/vue/components/blocks/BlockCanvas.vue.d.ts +15 -0
  177. package/dist/vue/components/blocks/BlockFieldControl.vue.d.ts +39 -0
  178. package/dist/vue/components/blocks/BlockGlobalStyles.vue.d.ts +3 -0
  179. package/dist/vue/components/blocks/BlockPalette.vue.d.ts +6 -0
  180. package/dist/vue/components/blocks/BlockProperties.vue.d.ts +5 -0
  181. package/dist/vue/components/blocks/BlockReview.vue.d.ts +5 -0
  182. package/dist/vue/components/properties/EditorPropertyAdvanced.vue.d.ts +8 -0
  183. package/dist/vue/components/properties/EditorPropertyContent.vue.d.ts +13 -0
  184. package/dist/vue/components/properties/EditorPropertyStyle.vue.d.ts +8 -0
  185. package/dist/vue/components/ui/EditorAnchoredMenu.vue.d.ts +36 -0
  186. package/dist/vue/components/ui/EditorBadge.vue.d.ts +18 -0
  187. package/dist/vue/components/ui/EditorButton.vue.d.ts +28 -0
  188. package/dist/vue/components/ui/EditorCheckbox.vue.d.ts +13 -0
  189. package/dist/vue/components/ui/EditorColorInput.vue.d.ts +27 -0
  190. package/dist/vue/components/ui/EditorConfirmDialog.vue.d.ts +35 -0
  191. package/dist/vue/components/ui/EditorContextMenu.vue.d.ts +27 -0
  192. package/dist/vue/components/ui/EditorContextPopover.vue.d.ts +33 -0
  193. package/dist/vue/components/ui/EditorEmpty.vue.d.ts +8 -0
  194. package/dist/vue/components/ui/EditorField.vue.d.ts +24 -0
  195. package/dist/vue/components/ui/EditorGroup.vue.d.ts +16 -0
  196. package/dist/vue/components/ui/EditorIcon.vue.d.ts +6 -0
  197. package/dist/vue/components/ui/EditorIconButton.vue.d.ts +19 -0
  198. package/dist/vue/components/ui/EditorInput.vue.d.ts +41 -0
  199. package/dist/vue/components/ui/EditorKeys.vue.d.ts +6 -0
  200. package/dist/vue/components/ui/EditorMeasurement.vue.d.ts +34 -0
  201. package/dist/vue/components/ui/EditorMenu.vue.d.ts +56 -0
  202. package/dist/vue/components/ui/EditorNotice.vue.d.ts +30 -0
  203. package/dist/vue/components/ui/EditorPropertyGroup.vue.d.ts +22 -0
  204. package/dist/vue/components/ui/EditorRecoveryDialog.vue.d.ts +23 -0
  205. package/dist/vue/components/ui/EditorScrollArea.vue.d.ts +13 -0
  206. package/dist/vue/components/ui/EditorSelect.vue.d.ts +25 -0
  207. package/dist/vue/components/ui/EditorSeparator.vue.d.ts +8 -0
  208. package/dist/vue/components/ui/EditorSidePanel.vue.d.ts +26 -0
  209. package/dist/vue/components/ui/EditorSwitch.vue.d.ts +12 -0
  210. package/dist/vue/components/ui/EditorTabs.vue.d.ts +28 -0
  211. package/dist/vue/components/ui/EditorTemplatePreview.vue.d.ts +9 -0
  212. package/dist/vue/components/ui/EditorTextToolbar.vue.d.ts +16 -0
  213. package/dist/vue/components/ui/EditorTree.vue.d.ts +37 -0
  214. package/dist/vue/components/ui/EditorUiProvider.vue.d.ts +13 -0
  215. package/dist/vue/components/ui/EditorVariablePicker.vue.d.ts +20 -0
  216. package/dist/vue/components/ui/color-style-value.d.ts +9 -0
  217. package/dist/vue/components/ui/composition-dismissal.d.ts +1 -0
  218. package/dist/vue/components/ui/editor-dialog-focus.d.ts +6 -0
  219. package/dist/vue/components/ui/numeric-style-value.d.ts +15 -0
  220. package/dist/vue/controller.d.ts +115 -0
  221. package/dist/vue/font-options.d.ts +6 -0
  222. package/dist/vue/icon-data.d.ts +233 -0
  223. package/dist/vue/icons.d.ts +5 -0
  224. package/dist/vue/locale.d.ts +7 -0
  225. package/dist/vue/outline.d.ts +26 -0
  226. package/dist/vue/projection-key.d.ts +7 -0
  227. package/dist/vue/properties/selection-properties.d.ts +40 -0
  228. package/dist/vue/properties/style-fields.d.ts +30 -0
  229. package/dist/vue/public.d.ts +14 -0
  230. package/dist/vue/recovery.d.ts +30 -0
  231. package/dist/vue/responsive-panel.d.ts +1 -0
  232. package/dist/vue/rich-text-commands.d.ts +29 -0
  233. package/dist/vue/services/block-command-definitions.d.ts +14 -0
  234. package/dist/vue/services/block-commands.d.ts +114 -0
  235. package/dist/vue/services/block-menu.d.ts +12 -0
  236. package/dist/vue/services/block-palette.d.ts +21 -0
  237. package/dist/vue/services/block-presentation.d.ts +16 -0
  238. package/dist/vue/services/diagnostic-groups.d.ts +25 -0
  239. package/dist/vue/services/image-requests.d.ts +80 -0
  240. package/dist/vue/services/live-change.d.ts +26 -0
  241. package/dist/vue/services/property-commands.d.ts +28 -0
  242. package/dist/vue/services/saved-blocks.d.ts +32 -0
  243. package/dist/vue/services/selection-path.d.ts +20 -0
  244. package/dist/vue/services/shortcuts.d.ts +39 -0
  245. package/dist/vue/services/structure-tree.d.ts +38 -0
  246. package/dist/vue/services/template-application.d.ts +33 -0
  247. package/dist/vue/services/tree-drag.d.ts +28 -0
  248. package/dist/vue/session/blocks.d.ts +44 -0
  249. package/dist/vue/session/guard.d.ts +13 -0
  250. package/dist/vue/session/structure.d.ts +36 -0
  251. package/dist/vue/session/text.d.ts +23 -0
  252. package/dist/vue/session/transfer.d.ts +23 -0
  253. package/dist/vue/theme.d.ts +20 -0
  254. package/dist/vue/variables.d.ts +21 -0
  255. package/dist/vue/workbench.d.ts +100 -0
  256. package/dist/vue.js +71418 -0
  257. package/dist/vue.js.map +1 -0
  258. package/package.json +125 -4
@@ -0,0 +1,40 @@
1
+ import type { Block, BlockProps } from '../../core/block-document';
2
+ import type { BlockField, BlockTypeDefinition, EmailBlockContext, PageBlockContext } from '../block-type';
3
+ /** Where the host renders one of its forms. Only in a page; the reference is the host's. */
4
+ export declare class FormBlock implements BlockTypeDefinition {
5
+ readonly type = "form";
6
+ readonly labelKey = "blocks.form";
7
+ readonly kinds: readonly ["page"];
8
+ readonly childTypes: never[];
9
+ readonly childCount: {
10
+ min: number;
11
+ max: number;
12
+ };
13
+ readonly fields: readonly BlockField[];
14
+ create(nextId: () => string, props?: BlockProps): Block;
15
+ page(context: PageBlockContext): string;
16
+ }
17
+ /**
18
+ * Free HTML written by the author. In a page it is kept as written (balanced by the parser);
19
+ * in an e-mail it must already follow the e-mail rules and is emitted through `mj-raw`, the
20
+ * only raw region the compilation accepts, and only from this generator.
21
+ */
22
+ export declare class HtmlBlock implements BlockTypeDefinition {
23
+ readonly type = "html";
24
+ readonly labelKey = "blocks.customHtml";
25
+ readonly kinds: readonly ["email", "page"];
26
+ readonly childTypes: never[];
27
+ readonly childCount: {
28
+ min: number;
29
+ max: number;
30
+ };
31
+ readonly fields: readonly BlockField[];
32
+ readonly mobileEmail: {
33
+ padding: {
34
+ selectors: string[];
35
+ };
36
+ };
37
+ create(nextId: () => string, props?: BlockProps): Block;
38
+ email(context: EmailBlockContext): string;
39
+ page(context: PageBlockContext): string;
40
+ }
@@ -0,0 +1,41 @@
1
+ import type { Block, BlockNodeType, BlockProps } from '../../core/block-document';
2
+ import type { BlockField, BlockTypeDefinition, EmailBlockContext, PageBlockContext } from '../block-type';
3
+ /** Content blocks a column holds. A form only exists in a page (checked by its definition). */
4
+ export declare const COLUMN_CONTENT: readonly BlockNodeType[];
5
+ /** Weight of a column within its section; the shares are the weights over their sum. */
6
+ export declare function columnWeight(block: Block): number;
7
+ /** A band of the piece: one to four real columns, side by side, stacked on small screens. */
8
+ export declare class SectionBlock implements BlockTypeDefinition {
9
+ readonly type = "section";
10
+ readonly labelKey = "blocks.section";
11
+ readonly kinds: readonly ["email", "page"];
12
+ readonly root = true;
13
+ readonly childTypes: readonly BlockNodeType[];
14
+ readonly childCount: {
15
+ min: number;
16
+ max: 4;
17
+ };
18
+ readonly fields: readonly BlockField[];
19
+ create(nextId: () => string, props?: BlockProps): Block;
20
+ /**
21
+ * Reversed stacking: the columns are written in reverse order and the section lays them out
22
+ * right to left, so a large screen shows them as authored and a small one stacks them from
23
+ * the last. MJML keeps the text of each column left to right.
24
+ */
25
+ email(context: EmailBlockContext): string;
26
+ page(context: PageBlockContext): string;
27
+ }
28
+ export declare class ColumnBlock implements BlockTypeDefinition {
29
+ readonly type = "column";
30
+ readonly labelKey = "blocks.column";
31
+ readonly kinds: readonly ["email", "page"];
32
+ readonly childTypes: readonly ("text" | "html" | "form" | "section" | "column" | "heading" | "image" | "button" | "divider" | "spacer" | "footer")[];
33
+ readonly childCount: {
34
+ min: number;
35
+ max: number;
36
+ };
37
+ readonly fields: readonly BlockField[];
38
+ create(nextId: () => string, props?: BlockProps): Block;
39
+ email(context: EmailBlockContext): string;
40
+ page(context: PageBlockContext): string;
41
+ }
@@ -0,0 +1,53 @@
1
+ import type { Block, BlockProps } from '../../core/block-document';
2
+ import type { BlockField, BlockTypeDefinition, EmailBlockContext, PageBlockContext } from '../block-type';
3
+ /**
4
+ * An image from the media library (`assetId` + `url`) or an address, with its description.
5
+ * Without an address it is only a placeholder in the preview and nothing in the output.
6
+ */
7
+ export declare class ImageBlock implements BlockTypeDefinition {
8
+ readonly type = "image";
9
+ readonly labelKey = "blocks.image";
10
+ readonly kinds: readonly ["email", "page"];
11
+ readonly childTypes: never[];
12
+ readonly childCount: {
13
+ min: number;
14
+ max: number;
15
+ };
16
+ readonly innerSelector = "img";
17
+ readonly fields: readonly BlockField[];
18
+ readonly mobileEmail: {
19
+ width: {
20
+ selectors: string[];
21
+ };
22
+ padding: {
23
+ selectors: string[];
24
+ };
25
+ };
26
+ create(nextId: () => string, props?: BlockProps): Block;
27
+ email(context: EmailBlockContext): string;
28
+ page(context: PageBlockContext): string;
29
+ }
30
+ /** A call to action. Its colors come from the global button style unless it sets its own. */
31
+ export declare class ButtonBlock implements BlockTypeDefinition {
32
+ readonly type = "button";
33
+ readonly labelKey = "blocks.button";
34
+ readonly kinds: readonly ["email", "page"];
35
+ readonly childTypes: never[];
36
+ readonly childCount: {
37
+ min: number;
38
+ max: number;
39
+ };
40
+ readonly innerSelector = ".ve-button";
41
+ readonly fields: readonly BlockField[];
42
+ readonly mobileEmail: {
43
+ fontSize: {
44
+ selectors: string[];
45
+ };
46
+ padding: {
47
+ selectors: string[];
48
+ };
49
+ };
50
+ create(nextId: () => string, props?: BlockProps): Block;
51
+ email(context: EmailBlockContext): string;
52
+ page(context: PageBlockContext): string;
53
+ }
@@ -0,0 +1,44 @@
1
+ import type { Block, BlockProps } from '../../core/block-document';
2
+ import type { BlockField, BlockTypeDefinition, EmailBlockContext, PageBlockContext } from '../block-type';
3
+ /** A horizontal rule in the global divider style. */
4
+ export declare class DividerBlock implements BlockTypeDefinition {
5
+ readonly type = "divider";
6
+ readonly labelKey = "blocks.divider";
7
+ readonly kinds: readonly ["email", "page"];
8
+ readonly childTypes: never[];
9
+ readonly childCount: {
10
+ min: number;
11
+ max: number;
12
+ };
13
+ readonly innerSelector = "hr";
14
+ readonly fields: readonly BlockField[];
15
+ readonly mobileEmail: {
16
+ padding: {
17
+ selectors: string[];
18
+ };
19
+ };
20
+ create(nextId: () => string, props?: BlockProps): Block;
21
+ email(context: EmailBlockContext): string;
22
+ page(context: PageBlockContext): string;
23
+ }
24
+ /** Vertical space. */
25
+ export declare class SpacerBlock implements BlockTypeDefinition {
26
+ readonly type = "spacer";
27
+ readonly labelKey = "blocks.spacer";
28
+ readonly kinds: readonly ["email", "page"];
29
+ readonly childTypes: never[];
30
+ readonly childCount: {
31
+ min: number;
32
+ max: number;
33
+ };
34
+ readonly fields: readonly BlockField[];
35
+ readonly mobileEmail: {
36
+ height: {
37
+ selectors: string[];
38
+ properties: string[];
39
+ };
40
+ };
41
+ create(nextId: () => string, props?: BlockProps): Block;
42
+ email(context: EmailBlockContext): string;
43
+ page(context: PageBlockContext): string;
44
+ }
@@ -0,0 +1,88 @@
1
+ import type { Block, BlockProps } from '../../core/block-document';
2
+ import type { BlockField, BlockTypeDefinition, EmailBlockContext, PageBlockContext } from '../block-type';
3
+ /** Paragraphs, lists and quotes in the body typography of the piece. */
4
+ export declare class TextBlock implements BlockTypeDefinition {
5
+ readonly type = "text";
6
+ readonly labelKey = "blocks.text";
7
+ readonly kinds: readonly ["email", "page"];
8
+ readonly childTypes: never[];
9
+ readonly childCount: {
10
+ min: number;
11
+ max: number;
12
+ };
13
+ readonly fields: readonly BlockField[];
14
+ readonly mobileEmail: Readonly<{
15
+ fontSize: {
16
+ selectors: string[];
17
+ };
18
+ lineHeight: {
19
+ selectors: string[];
20
+ };
21
+ align: {
22
+ selectors: string[];
23
+ };
24
+ padding: {
25
+ selectors: string[];
26
+ };
27
+ }>;
28
+ create(nextId: () => string, props?: BlockProps): Block;
29
+ email(context: EmailBlockContext): string;
30
+ page(context: PageBlockContext): string;
31
+ }
32
+ export declare const HEADING_LEVELS: readonly ["h1", "h2", "h3"];
33
+ /** A title in the heading typography of the piece, as a real `h1`-`h3`. */
34
+ export declare class HeadingBlock implements BlockTypeDefinition {
35
+ readonly type = "heading";
36
+ readonly labelKey = "blocks.heading";
37
+ readonly kinds: readonly ["email", "page"];
38
+ readonly childTypes: never[];
39
+ readonly childCount: {
40
+ min: number;
41
+ max: number;
42
+ };
43
+ readonly fields: readonly BlockField[];
44
+ readonly mobileEmail: {
45
+ fontSize: {
46
+ selectors: string[];
47
+ };
48
+ align: {
49
+ selectors: string[];
50
+ };
51
+ padding: {
52
+ selectors: string[];
53
+ };
54
+ };
55
+ create(nextId: () => string, props?: BlockProps): Block;
56
+ email(context: EmailBlockContext): string;
57
+ page(context: PageBlockContext): string;
58
+ private level;
59
+ }
60
+ /** The closing lines of a piece in the footer typography. */
61
+ export declare class FooterBlock implements BlockTypeDefinition {
62
+ readonly type = "footer";
63
+ readonly labelKey = "blocks.footer";
64
+ readonly kinds: readonly ["email", "page"];
65
+ readonly childTypes: never[];
66
+ readonly childCount: {
67
+ min: number;
68
+ max: number;
69
+ };
70
+ readonly fields: readonly BlockField[];
71
+ readonly mobileEmail: Readonly<{
72
+ fontSize: {
73
+ selectors: string[];
74
+ };
75
+ lineHeight: {
76
+ selectors: string[];
77
+ };
78
+ align: {
79
+ selectors: string[];
80
+ };
81
+ padding: {
82
+ selectors: string[];
83
+ };
84
+ }>;
85
+ create(nextId: () => string, props?: BlockProps): Block;
86
+ email(context: EmailBlockContext): string;
87
+ page(context: PageBlockContext): string;
88
+ }
@@ -0,0 +1,64 @@
1
+ import type { BlockPropValue, StyleValue } from '../core/block-document';
2
+ import type { DocumentKind } from '../core/document';
3
+ import type { UrlPurpose } from '../security/url-policy';
4
+ import type { BlockContentGuard } from './content-guard';
5
+ import type { RichTextMode } from '../core/rich-text-markup';
6
+ /** The kind of value a property or a global style holds, and what it may contain. */
7
+ export type ValueSpec = {
8
+ readonly type: 'color';
9
+ } | {
10
+ readonly type: 'length';
11
+ readonly units: readonly ('px' | '%')[];
12
+ readonly max: number;
13
+ } | {
14
+ readonly type: 'box';
15
+ } | {
16
+ readonly type: 'fontFamily';
17
+ } | {
18
+ readonly type: 'ratio';
19
+ } | {
20
+ readonly type: 'select';
21
+ readonly options: readonly string[];
22
+ } | {
23
+ readonly type: 'integer';
24
+ readonly min: number;
25
+ readonly max: number;
26
+ } | {
27
+ readonly type: 'toggle';
28
+ } | {
29
+ readonly type: 'plain';
30
+ readonly max: number;
31
+ readonly pattern?: RegExp;
32
+ } | {
33
+ readonly type: 'url';
34
+ readonly purpose: UrlPurpose;
35
+ } | {
36
+ readonly type: 'richtext';
37
+ readonly mode: RichTextMode;
38
+ } | {
39
+ readonly type: 'html';
40
+ };
41
+ /** The font stacks a piece may use: written as they are into CSS and MJML, never typed. */
42
+ export declare const FONT_STACKS: readonly [{
43
+ readonly value: "Arial, Helvetica, sans-serif";
44
+ readonly labelKey: "properties.fontSans";
45
+ }, {
46
+ readonly value: "Georgia, Times New Roman, serif";
47
+ readonly labelKey: "properties.fontSerif";
48
+ }, {
49
+ readonly value: "Courier New, Courier, monospace";
50
+ readonly labelKey: "properties.fontMonospace";
51
+ }];
52
+ /**
53
+ * Every value that reaches CSS, an MJML attribute or a URL passes one of these patterns: they
54
+ * have no quote, semicolon, brace or angle bracket, so a value can never end the declaration
55
+ * or the attribute it is written into.
56
+ */
57
+ export declare class ValueRules {
58
+ private readonly content;
59
+ constructor(content: BlockContentGuard);
60
+ accepts(spec: ValueSpec, value: BlockPropValue | StyleValue, kind: DocumentKind): boolean;
61
+ /** What a command stores: texts and HTML in their settled form, other values as given. */
62
+ normalize(spec: ValueSpec, value: BlockPropValue | StyleValue, kind: DocumentKind): BlockPropValue | undefined;
63
+ private length;
64
+ }
@@ -0,0 +1,69 @@
1
+ import { _ as e, b as t, g as n, r, s as i, y as a } from "./identity-CJHb6l9N.js";
2
+ import { i as o, n as s, r as c, u as l } from "./block-controller-RjYGvOcn.js";
3
+ import { C as u, S as d, _ as f, a as p, b as m, c as h, d as g, f as _, g as v, h as y, i as b, l as x, m as S, n as C, o as w, r as T, s as E, t as D, u as O, v as k, x as A, y as j } from "./block-factory-C5oHi4Fm.js";
4
+ import { c as M, i as N, o as P, r as F, s as I, t as L } from "./generated-mjml-CtzE-f3v.js";
5
+ //#region src/compilation/browser-compiler.ts
6
+ var R = class {
7
+ guard = new N();
8
+ jobs = /* @__PURE__ */ new Set();
9
+ disposed = !1;
10
+ async compile(e) {
11
+ return this.run(e);
12
+ }
13
+ async compileGenerated(e) {
14
+ if (!(e instanceof L)) throw Error("INVALID_COMPILE_INPUT");
15
+ return this.run(e.source, e.fragments);
16
+ }
17
+ async run(e, t) {
18
+ if (this.disposed) throw Error("COMPILER_DISPOSED");
19
+ if (this.guard.source(e, t), this.jobs.size >= F.parallelJobs) throw Error("COMPILER_BUSY");
20
+ let n = t ? {
21
+ source: e,
22
+ fragments: [...t]
23
+ } : e;
24
+ return new Promise((e, t) => {
25
+ let r = new Worker(new URL(
26
+ /* @vite-ignore */
27
+ new URL("./assets/browser-worker-D56tNvnb.js", import.meta.url).href,
28
+ "" + import.meta.url
29
+ ), { type: "module" }), i = () => {
30
+ clearTimeout(o), r.terminate(), this.jobs.delete(a);
31
+ }, a = () => {
32
+ i(), t(/* @__PURE__ */ Error("COMPILER_DISPOSED"));
33
+ }, o = setTimeout(() => {
34
+ i(), t(/* @__PURE__ */ Error("COMPILE_TIMEOUT"));
35
+ }, F.timeoutMs);
36
+ this.jobs.add(a), r.onmessage = (n) => {
37
+ try {
38
+ let t = n.data;
39
+ if (!t || typeof t != "object" || !("html" in t)) throw Error("COMPILE_FAILED");
40
+ let r = this.guard.output(t.html);
41
+ i(), e(r);
42
+ } catch (e) {
43
+ i(), t(e);
44
+ }
45
+ }, r.onerror = () => {
46
+ i(), t(/* @__PURE__ */ Error("COMPILE_FAILED"));
47
+ }, r.postMessage(n);
48
+ });
49
+ }
50
+ dispose() {
51
+ this.disposed = !0;
52
+ for (let e of [...this.jobs]) e();
53
+ }
54
+ };
55
+ //#endregion
56
+ //#region src/composition/browser.ts
57
+ function z(e) {
58
+ return new j(() => new R()).create(e);
59
+ }
60
+ function B(e) {
61
+ return new D(() => new R()).create(e);
62
+ }
63
+ function V(e) {
64
+ return new D(() => new R()).toolkit(e);
65
+ }
66
+ //#endregion
67
+ export { S as BLOCK_DOCUMENT_LIMITS, y as BLOCK_NODE_TYPES, s as BlockChecker, O as BlockContentGuard, T as BlockConversionError, w as BlockDefinitionRegistry, v as BlockDocument, f as BlockDocumentError, k as BlockDocumentSchema, D as BlockEditorFactory, g as BlockEditorSession, p as BlockEmailRenderer, h as BlockMjmlGenerator, E as BlockPageGenerator, C as BlockTemplateCatalog, b as BlockToHtmlConversion, R as BrowserMjmlCompiler, I as ContentPolicy, M as ContentPolicyError, r as CssDocumentCodec, n as DOCUMENT_LIMITS, e as DocumentNodeSchema, a as EditorDocument, t as EditorDocumentSchema, j as EditorFactory, u as EditorSession, x as GLOBAL_STYLE_GROUPS, c as GMAIL_CLIP_BYTES, o as GMAIL_NEAR_CLIP_BYTES, L as GeneratedMjml, A as HtmlDocumentAssembler, P as HtmlDocumentCodec, m as InitialDocumentError, d as PreviewDocument, l as SelectionPreviewRenderer, i as UrlPolicy, B as createBlockEditor, V as createBlockToolkit, z as createEditor, _ as parseAnyDocument };
68
+
69
+ //# sourceMappingURL=browser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser.js","names":["import.meta.ROLLDOWN_FILE_URL_TbyMcp1yW5yJVWQ06uiGqg","DocumentNodeSchema","EditorDocumentSchema","DOCUMENT_LIMITS","UrlPolicy","EditorDocument","GMAIL_NEAR_CLIP_BYTES","BlockChecker","GMAIL_CLIP_BYTES","SelectionPreviewRenderer","EditorSession","PreviewDocument","BlockDocumentError","BlockEmailRenderer","InitialDocumentError","BlockMjmlGenerator","BlockEditorSession","parseAnyDocument","BlockDocument","BLOCK_NODE_TYPES","BlockToHtmlConversion","GLOBAL_STYLE_GROUPS","BLOCK_DOCUMENT_LIMITS","BlockTemplateCatalog","BlockDefinitionRegistry","BlockConversionError","BlockPageGenerator","BlockEditorFactory","BlockContentGuard","BlockDocumentSchema","HtmlDocumentAssembler","EditorFactory","ContentPolicyError","CompilationGuard","HtmlDocumentCodec","COMPILE_LIMITS","ContentPolicy","GeneratedMjml","BrowserMjmlCompiler","source","mjml","fragments","request","worker","finish","timer","cancel","reject","message","event","html","resolve","error","createEditor","options","createBlockEditor","createBlockToolkit","CssDocumentCodec"],"sources":["../src/compilation/browser-compiler.ts","../src/composition/browser.ts"],"sourcesContent":["import type { MjmlCompilerPort } from '../renderers/email-renderer';\nimport { CompilationGuard, COMPILE_LIMITS } from './guard';\nimport { GeneratedMjml } from './generated-mjml';\nimport type { CompileRequest, GeneratedMjmlCompilerPort } from './generated-mjml';\n\nexport class BrowserMjmlCompiler implements MjmlCompilerPort, GeneratedMjmlCompilerPort {\n private readonly guard = new CompilationGuard();\n private readonly jobs = new Set<() => void>();\n private disposed = false;\n\n /** MJML from outside: no raw region is accepted. */\n async compile(source: string): Promise<string> {\n return this.run(source);\n }\n\n /** MJML of the block codec, with the raw regions it generated. */\n async compileGenerated(mjml: GeneratedMjml): Promise<string> {\n if (!(mjml instanceof GeneratedMjml)) throw new Error('INVALID_COMPILE_INPUT');\n return this.run(mjml.source, mjml.fragments);\n }\n\n private async run(source: string, fragments?: readonly string[]): Promise<string> {\n if (this.disposed) throw new Error('COMPILER_DISPOSED');\n this.guard.source(source, fragments);\n if (this.jobs.size >= COMPILE_LIMITS.parallelJobs) throw new Error('COMPILER_BUSY');\n const request: CompileRequest = fragments ? { source, fragments: [...fragments] } : source;\n return new Promise<string>((resolve, reject) => {\n const worker = new Worker(new URL('./browser-worker.ts', import.meta.url), {\n type: 'module',\n });\n const finish = () => {\n clearTimeout(timer);\n worker.terminate();\n this.jobs.delete(cancel);\n };\n const cancel = () => {\n finish();\n reject(new Error('COMPILER_DISPOSED'));\n };\n const timer = setTimeout(() => {\n finish();\n reject(new Error('COMPILE_TIMEOUT'));\n }, COMPILE_LIMITS.timeoutMs);\n this.jobs.add(cancel);\n worker.onmessage = (event: MessageEvent<unknown>) => {\n try {\n const message = event.data;\n if (!message || typeof message !== 'object' || !('html' in message))\n throw new Error('COMPILE_FAILED');\n const html = this.guard.output(message.html);\n finish();\n resolve(html);\n } catch (error) {\n finish();\n reject(error);\n }\n };\n worker.onerror = () => {\n finish();\n reject(new Error('COMPILE_FAILED'));\n };\n worker.postMessage(request);\n });\n }\n\n dispose(): void {\n this.disposed = true;\n for (const cancel of [...this.jobs]) cancel();\n }\n}\n","import { EditorFactory } from './factory';\nimport type { EditorOptions } from './factory';\nimport { BrowserMjmlCompiler } from '../compilation/browser-compiler';\nimport { BlockEditorFactory } from './block-factory';\nimport type {\n BlockEditorInstance,\n BlockEditorOptions,\n BlockToolkit,\n BlockToolkitOptions,\n} from './block-factory';\n\nexport function createEditor(options?: EditorOptions) {\n return new EditorFactory(() => new BrowserMjmlCompiler()).create(options);\n}\n\n/** An editor of a block piece (schema 2), compiling e-mails in a browser worker. */\nexport function createBlockEditor(options?: BlockEditorOptions): BlockEditorInstance {\n return new BlockEditorFactory(() => new BrowserMjmlCompiler()).create(options);\n}\n\n/** Parse, generate, compile and convert block pieces in the browser, without an editor. */\nexport function createBlockToolkit(options?: BlockToolkitOptions): BlockToolkit {\n return new BlockEditorFactory(() => new BrowserMjmlCompiler()).toolkit(options);\n}\nexport { EditorFactory, InitialDocumentError } from './factory';\nexport type { EditorOptions, EditorInstance } from './factory';\nexport {\n EditorDocument,\n EditorDocumentSchema,\n DocumentNodeSchema,\n DOCUMENT_LIMITS,\n} from '../core/document';\nexport type {\n EditorDocumentData,\n DocumentNode,\n Diagnostic,\n DiagnosticSeverity,\n DocumentKind,\n SourceInput,\n} from '../core/document';\nexport { EditorSession } from '../application/session';\nexport type { EditorState } from '../application/session';\nexport type {\n HostAdapters,\n StorePort,\n AssetPort,\n SlotsPort,\n AssetReference,\n} from '../application/host';\nexport { ContentPolicy, ContentPolicyError } from '../security/policy';\nexport type { SanitizedDocument } from '../security/policy';\nexport type { ContentInventory, ExternalReference } from '../security/content-inventory';\nexport { HtmlDocumentCodec } from '../codecs/html';\nexport { CssDocumentCodec } from '../codecs/css';\nexport { BrowserMjmlCompiler } from '../compilation/browser-compiler';\nexport { PreviewDocument } from '../renderers/preview-document';\nexport { HtmlDocumentAssembler } from '../renderers/preview-document';\nexport { SelectionPreviewRenderer } from '../renderers/selection-preview';\nexport { UrlPolicy } from '../security/url-policy';\nexport { BlockEditorFactory } from './block-factory';\nexport type {\n BlockCompiler,\n BlockEditorInstance,\n BlockEditorOptions,\n BlockToolkit,\n BlockToolkitOptions,\n} from './block-factory';\nexport {\n BlockDocument,\n BlockDocumentError,\n BlockDocumentSchema,\n BLOCK_DOCUMENT_LIMITS,\n BLOCK_NODE_TYPES,\n} from '../core/block-document';\nexport type {\n Block,\n BlockDocumentData,\n BlockNodeType,\n BlockPropValue,\n BlockProps,\n BlockTarget,\n GlobalStyles,\n StylePatch,\n} from '../core/block-document';\nexport { parseAnyDocument } from '../core/any-document';\nexport type { AnyDocument } from '../core/any-document';\nexport { BlockEditorSession } from '../application/block-session';\nexport type {\n BlockEditorState,\n BlockImageChoice,\n BlockStorePort,\n} from '../application/block-session';\nexport { BlockDefinitionRegistry } from '../blocks/definitions';\nexport { GLOBAL_STYLE_GROUPS } from '../blocks/styles';\nexport { BlockConversionError } from '../blocks/conversion';\nexport type { OutputMode } from '../blocks/block-type';\nexport { GeneratedMjml } from '../compilation/generated-mjml';\nexport { BlockTemplateCatalog } from '../templates/blocks/catalog';\nexport type { BlockTemplateDescriptor } from '../templates/blocks/catalog';\nexport type { BlockPreviewInput } from '../renderers/marked-preview';\nexport { BlockContentGuard } from '../blocks/content-guard';\nexport { BlockMjmlGenerator } from '../blocks/email-generator';\nexport { BlockPageGenerator } from '../blocks/page-generator';\nexport { BlockEmailRenderer } from '../blocks/email-renderer';\nexport { BlockToHtmlConversion } from '../blocks/conversion';\nexport { BlockChecker, GMAIL_CLIP_BYTES, GMAIL_NEAR_CLIP_BYTES } from '../blocks/block-checks';\nexport type { BlockCheck, BlockCheckCode } from '../blocks/block-checks';\nexport type { BlockDevice } from '../core/block-document';\n"],"mappings":";;;;;AAKA,IAAasC,IAAb,MAAwF;CACtF,QAAyB,IAAIL,EAAiB;CAC9C,uBAAwB,IAAI,IAAgB;CAC5C,WAAmB;CAGnB,MAAM,QAAQ,GAAiC;EAC7C,OAAO,KAAK,IAAIM,CAAM;CACxB;CAGA,MAAM,iBAAiB,GAAsC;EAC3D,IAAI,EAAEC,aAAgBH,IAAgB,MAAU,MAAM,uBAAuB;EAC7E,OAAO,KAAK,IAAIG,EAAK,QAAQA,EAAK,SAAS;CAC7C;CAEA,MAAc,IAAI,GAAgB,GAAgD;EAChF,IAAI,KAAK,UAAU,MAAU,MAAM,mBAAmB;EAEtD,IADA,KAAK,MAAM,OAAOD,GAAQE,CAAS,GAC/B,KAAK,KAAK,QAAQN,EAAe,cAAc,MAAU,MAAM,eAAe;EAClF,IAAMO,IAA0BD,IAAY;GAAE;GAAQ,WAAW,CAAC,GAAGA,CAAS;EAAE,IAAIF;EACpF,OAAO,IAAI,SAAiB,GAAS,MAAW;GAC9C,IAAMI,IAAS,IAAI,OAAO,IAAA;;IAAA,IAAA,IAAA,uCAAA,YAAA,GAAA,CAAA,CAAA3C;IAAA,KAAA,YAAA;GAAA,GAAiD,EACzE,MAAM,SACR,CAAC,GACK4C,UAAe;IAGnB,AAFA,aAAaC,CAAK,GAClBF,EAAO,UAAU,GACjB,KAAK,KAAK,OAAOG,CAAM;GACzB,GACMA,UAAe;IAEnB,AADAF,EAAO,GACPG,EAAO,gBAAI,MAAM,mBAAmB,CAAC;GACvC,GACMF,IAAQ,iBAAiB;IAE7B,AADAD,EAAO,GACPG,EAAO,gBAAI,MAAM,iBAAiB,CAAC;GACrC,GAAGZ,EAAe,SAAS;GAmB3B,AAlBA,KAAK,KAAK,IAAIW,CAAM,GACpB,EAAO,aAAa,MAAiC;IACnD,IAAI;KACF,IAAME,IAAUC,EAAM;KACtB,IAAI,CAACD,KAAW,OAAOA,KAAY,YAAY,EAAE,UAAUA,IACzD,MAAU,MAAM,gBAAgB;KAClC,IAAME,IAAO,KAAK,MAAM,OAAOF,EAAQ,IAAI;KAE3C,AADAJ,EAAO,GACPO,EAAQD,CAAI;IACd,SAASE,GAAO;KAEd,AADAR,EAAO,GACPG,EAAOK,CAAK;IACd;GACF,GACA,EAAO,gBAAgB;IAErB,AADAR,EAAO,GACPG,EAAO,gBAAI,MAAM,gBAAgB,CAAC;GACpC,GACAJ,EAAO,YAAYD,CAAO;EAC5B,CAAC;CACH;CAEA,UAAgB;EACd,KAAK,WAAW;EAChB,KAAK,IAAMI,KAAU,CAAC,GAAG,KAAK,IAAI,GAAG,EAAO;CAC9C;AACF;;;AC1DA,SAAgBO,EAAa,GAAyB;CACpD,OAAO,IAAItB,QAAoB,IAAIO,EAAoB,CAAC,CAAC,CAAC,OAAOgB,CAAO;AAC1E;AAGA,SAAgBC,EAAkB,GAAmD;CACnF,OAAO,IAAI5B,QAAyB,IAAIW,EAAoB,CAAC,CAAC,CAAC,OAAOgB,CAAO;AAC/E;AAGA,SAAgBE,EAAmB,GAA6C;CAC9E,OAAO,IAAI7B,QAAyB,IAAIW,EAAoB,CAAC,CAAC,CAAC,QAAQgB,CAAO;AAChF"}
@@ -0,0 +1,19 @@
1
+ import type { CanvasContext } from './context';
2
+ import type { ControlsOverlay } from './overlay';
3
+ export interface ActionBarEvents {
4
+ /** The text of the selected block is opened for editing. */
5
+ edit(): void;
6
+ /** A press on the handle starts moving the selected block. */
7
+ grab(event: PointerEvent, handle: HTMLElement): void;
8
+ /** The element the bar must not cover while its text is being edited. */
9
+ editingId(): string | undefined;
10
+ }
11
+ /** The actions of the selected block, always next to it and never over a text being edited. */
12
+ export declare class ActionBar {
13
+ #private;
14
+ private readonly ctx;
15
+ private readonly overlay;
16
+ private readonly events;
17
+ readonly handle: HTMLButtonElement;
18
+ constructor(ctx: CanvasContext, overlay: ControlsOverlay, events: ActionBarEvents);
19
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Scrolls the frame while a drag rests near its top or bottom edge. It runs on its own clock, so
3
+ * the piece keeps moving when the pointer stands still.
4
+ */
5
+ export declare class AutoScroll {
6
+ #private;
7
+ /** `after` runs after every scroll step, to find the destination under the same point again. */
8
+ update(y: number, after: () => void): void;
9
+ stop(): void;
10
+ }
@@ -0,0 +1,29 @@
1
+ import type { CanvasContext } from './context';
2
+ import type { DropTargets } from './drop-targets';
3
+ import type { TextSession } from './text-session';
4
+ /**
5
+ * Moves a block with the pointer and follows a block which the host drags in from its palette.
6
+ * One gesture at a time; nothing changes in the document before a completed drop.
7
+ */
8
+ export declare class BlockDrag {
9
+ #private;
10
+ private readonly ctx;
11
+ private readonly targets;
12
+ private readonly text;
13
+ private readonly handle;
14
+ constructor(ctx: CanvasContext, targets: DropTargets, text: TextSession, handle: HTMLElement);
15
+ get sourceId(): string | undefined;
16
+ /** True once: a drag is never also the click which follows it. */
17
+ consumeClick(): boolean;
18
+ cancel(): void;
19
+ /** The window lost the pointer for good: no touch is still down. */
20
+ interrupt(): void;
21
+ start(event: PointerEvent, sourceId: string | undefined, capture: HTMLElement): boolean;
22
+ /** The handle of the action bar: a text being edited is concluded before its block moves. */
23
+ grab(event: PointerEvent): void;
24
+ /**
25
+ * A block dragged from the palette of the host, or an image file from the desktop, reported
26
+ * as points of this frame.
27
+ */
28
+ insertion(phase: unknown, x: unknown, y: unknown, file?: unknown): void;
29
+ }
@@ -0,0 +1,6 @@
1
+ import type { CanvasBridgeConfiguration } from '../renderers/canvas-bridge';
2
+ /**
3
+ * The only executable code of the opaque preview. It composes the modules of the runtime and
4
+ * routes the messages of the host; each interaction lives in its own module.
5
+ */
6
+ export declare function installCanvasBridge(cfg: CanvasBridgeConfiguration): void;
@@ -0,0 +1,53 @@
1
+ import type { CanvasBridgeConfiguration, CanvasBridgeRegion } from '../renderers/canvas-bridge';
2
+ import { BridgeChannel } from './messages';
3
+ export type Placement = 'before' | 'after' | 'inside';
4
+ export interface FramePoint {
5
+ readonly x: number;
6
+ readonly y: number;
7
+ }
8
+ export declare function isRegion(value: unknown): value is CanvasBridgeRegion;
9
+ /**
10
+ * What every module of the runtime shares: the channel to the host, the regions of the revision
11
+ * on screen, the selection and one measuring frame. It decides nothing about interaction.
12
+ */
13
+ export declare class CanvasContext {
14
+ #private;
15
+ readonly cfg: CanvasBridgeConfiguration;
16
+ readonly controls: HTMLElement;
17
+ readonly lifecycle: AbortController;
18
+ readonly channel: BridgeChannel;
19
+ readonly marked: Map<string, HTMLElement>;
20
+ regions: Map<string, CanvasBridgeRegion>;
21
+ readOnly: boolean;
22
+ selectedId: string | undefined;
23
+ disposed: boolean;
24
+ /** A block or palette gesture is in course: hover feedback stays out of the way. */
25
+ dragging: boolean;
26
+ /** When the keyboard last asked for the menu of a block, to ignore the event the key fires. */
27
+ keyboardMenu: number;
28
+ constructor(cfg: CanvasBridgeConfiguration, controls: HTMLElement);
29
+ get signal(): AbortSignal;
30
+ index(): void;
31
+ /**
32
+ * The element whose text is edited in place: the block itself, or the element inside it which
33
+ * carries the edit mark of the same block (the text of an e-mail cell, generated by a block
34
+ * piece). The host already admitted that mark only inside its own block.
35
+ */
36
+ textElement(id: string): HTMLElement | undefined;
37
+ setRegions(regions: readonly CanvasBridgeRegion[]): void;
38
+ send(type: string, payload?: Record<string, unknown>): void;
39
+ select(id: string | undefined): void;
40
+ /** Runs before this frame asks the host to select another block. */
41
+ beforeSelect(action: () => void): void;
42
+ regionFrom(element: Element | null): string | undefined;
43
+ /** The closest selectable ancestor in the piece, whatever plain markup lies between. */
44
+ parentOf(id: string | undefined): string | undefined;
45
+ /** Regions which share the parent of `id`, in document order. */
46
+ siblings(id: string): string[];
47
+ isControls(event: Event): boolean;
48
+ /** Hit test of the piece itself: the trusted overlay never answers for a document element. */
49
+ elementAt(x: number, y: number): Element | null;
50
+ onMeasure(measure: () => void): void;
51
+ schedule(): void;
52
+ dispose(): void;
53
+ }
@@ -0,0 +1,21 @@
1
+ import type { BlockDrag } from './block-drag';
2
+ import type { CanvasContext } from './context';
3
+ import type { DropTargets } from './drop-targets';
4
+ import type { ImageTools } from './image-tools';
5
+ import type { SelectionLayer } from './selection-layer';
6
+ import type { TextSession } from './text-session';
7
+ export interface DocumentSyncParts {
8
+ readonly text: TextSession;
9
+ readonly drag: BlockDrag;
10
+ readonly targets: DropTargets;
11
+ readonly selection: SelectionLayer;
12
+ readonly images: ImageTools;
13
+ }
14
+ /** Brings the next validated revision into the window which is already running. */
15
+ export declare class DocumentSync {
16
+ #private;
17
+ private readonly ctx;
18
+ private readonly parts;
19
+ constructor(ctx: CanvasContext, parts: DocumentSyncParts);
20
+ apply(message: Record<string, unknown>): void;
21
+ }
@@ -0,0 +1,34 @@
1
+ import type { CanvasContext, Placement } from './context';
2
+ import type { ControlsOverlay } from './overlay';
3
+ export type DropDestination = {
4
+ readonly targetId: string;
5
+ readonly placement: Placement;
6
+ } | {
7
+ readonly end: true;
8
+ }
9
+ /** A dropped image file over an image: it takes the place of that image. */
10
+ | {
11
+ readonly replace: string;
12
+ };
13
+ /**
14
+ * Decides where a dragged block would land and draws the insertion marker. Only destinations the
15
+ * host declared valid are ever shown; the command itself is validated again by the host.
16
+ */
17
+ export declare class DropTargets {
18
+ #private;
19
+ private readonly ctx;
20
+ constructor(ctx: CanvasContext, overlay: ControlsOverlay);
21
+ get destination(): DropDestination | undefined;
22
+ clear(): void;
23
+ /** A new revision invalidates every destination the host had declared. */
24
+ reset(): void;
25
+ /** Where the selected block may be moved to. */
26
+ setMovement(sourceId: unknown, entries: unknown): void;
27
+ /** Where a new block may be inserted. */
28
+ setInsertion(entries: unknown): void;
29
+ /**
30
+ * Finds the destination under a point of the frame and shows it, or shows nothing. A file
31
+ * held over an image replaces that image instead of landing next to it.
32
+ */
33
+ resolve(x: number, y: number, sourceId?: string, file?: boolean): void;
34
+ }
@@ -0,0 +1,15 @@
1
+ import type { BlockDrag } from './block-drag';
2
+ import type { CanvasContext } from './context';
3
+ import type { ControlsOverlay } from './overlay';
4
+ /**
5
+ * Embedded content never loads inside the editor, and a click on a frame would not reach this
6
+ * document anyway. Each one on screen gets a marker drawn over it, which selects, moves and opens
7
+ * the menu of the block it stands for.
8
+ */
9
+ export declare class EmbedMarkers {
10
+ #private;
11
+ private readonly ctx;
12
+ private readonly overlay;
13
+ private readonly drag;
14
+ constructor(ctx: CanvasContext, overlay: ControlsOverlay, drag: BlockDrag);
15
+ }
@@ -0,0 +1,12 @@
1
+ import type { CanvasContext } from './context';
2
+ /**
3
+ * A file dragged from the system straight over the frame. The frame never takes it: its drop is
4
+ * cancelled before any listener of the document sees it (no navigation to the file, no data for
5
+ * the page), and the host is told, without any data, that a file drag is over the piece so it can
6
+ * raise its own layer, which accepts the file through the upload of the host or refuses it.
7
+ */
8
+ export declare class FileGuard {
9
+ #private;
10
+ private readonly ctx;
11
+ constructor(ctx: CanvasContext);
12
+ }