@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,80 @@
1
+ import type { ShallowRef } from 'vue';
2
+ import type { CanvasPlacement } from '../../core/canvas-layout';
3
+ import type { DocumentKind, SourceInput } from '../../core/document';
4
+ import type { EditorController } from '../controller';
5
+ /** What the person chose: a URL the host is responsible for, and optionally its asset id. */
6
+ export interface EditorImageChoice {
7
+ /** Identifier of the asset in the host, 1 to 128 of `A-Z a-z 0-9 _ -`. Omit for a plain URL. */
8
+ readonly id?: string;
9
+ readonly url: string;
10
+ readonly alt?: string;
11
+ }
12
+ export interface EditorImageRequest {
13
+ /** The image being replaced; absent when a new image is being inserted. */
14
+ readonly nodeId?: string;
15
+ readonly kind: DocumentKind;
16
+ readonly current?: {
17
+ readonly url: string;
18
+ readonly alt: string;
19
+ };
20
+ }
21
+ /**
22
+ * The door a host implements to choose images. The editor knows nothing about the library, the
23
+ * upload or the permissions behind it: it asks, waits and applies what comes back. Resolving
24
+ * `undefined` means the person gave up.
25
+ */
26
+ export interface EditorImagePicker {
27
+ pickImage(request: EditorImageRequest): Promise<EditorImageChoice | undefined>;
28
+ /** Declares support for files dropped on the piece; without it, drops are ignored. */
29
+ uploadImage?(file: File, request: EditorImageRequest): Promise<EditorImageChoice | undefined>;
30
+ }
31
+ export interface ImageRequestPorts {
32
+ controller(): EditorController;
33
+ picker(): EditorImagePicker | undefined;
34
+ /** The older contract: the host is told and later calls `controller.attachAsset` itself. */
35
+ legacyRequest(): ((nodeId: string | undefined) => void) | undefined;
36
+ flush(): Promise<boolean>;
37
+ notify(outcome: 'applied' | 'invalid'): void;
38
+ /** The exported source with one element rewritten, for a change which is one history step. */
39
+ replaceElementSource?(id: string, html: string): SourceInput | undefined;
40
+ }
41
+ export interface ImageDialogState {
42
+ readonly nodeId?: string;
43
+ readonly url: string;
44
+ readonly alt: string;
45
+ }
46
+ export type ImageDestination = {
47
+ readonly targetId: string;
48
+ readonly placement: CanvasPlacement;
49
+ } | 'end' | undefined;
50
+ /**
51
+ * One path for every way of choosing an image: the button of the piece, the double click, the
52
+ * panel, the menu and a dropped file. It prefers the picker of the host, falls back to the older
53
+ * request event and, without either, to the editor's own dialog with a URL.
54
+ */
55
+ export declare class ImageRequestService {
56
+ private readonly ports;
57
+ /** Open while the editor's own dialog is the way to choose. */
58
+ readonly dialog: ShallowRef<ImageDialogState | undefined>;
59
+ readonly busy: ShallowRef<boolean, boolean>;
60
+ constructor(ports: ImageRequestPorts);
61
+ get acceptsFiles(): boolean;
62
+ private request;
63
+ /** Replaces the image of `nodeId`, or inserts a new one when there is none. */
64
+ choose(nodeId?: string): Promise<boolean>;
65
+ /**
66
+ * A file dropped on the piece goes through the upload the host declared: a new image at
67
+ * `destination`, or, with `{ replace }`, in place of the image dropped on.
68
+ */
69
+ upload(file: File, destination: ImageDestination | {
70
+ readonly replace: string;
71
+ }): Promise<boolean>;
72
+ private settle;
73
+ /** Applies a choice through the same validated commands as any other change. */
74
+ apply(choice: EditorImageChoice, nodeId?: string, destination?: ImageDestination): boolean;
75
+ /** A plain URL has no asset behind it: the image is ordinary markup, validated as any other. */
76
+ private insertByUrl;
77
+ /** A plain URL has no asset behind it: only the address and the description change. */
78
+ private replaceByUrl;
79
+ cancel(): void;
80
+ }
@@ -0,0 +1,26 @@
1
+ import type { EditorController } from '../controller';
2
+ /**
3
+ * Makes a run of changes to one field a single history step. The session has no grouping, so the
4
+ * previous step of the same run is undone before the next value is applied: the history then
5
+ * holds the state before the run and its latest value, and nothing in between. The session stays
6
+ * the only source of truth; no value lives outside it.
7
+ */
8
+ export declare class LiveChangeGroup {
9
+ #private;
10
+ private readonly controller;
11
+ constructor(controller: () => EditorController);
12
+ /** Ends the run: the next change of any field is a step of its own. */
13
+ close(): void;
14
+ apply(key: string, change: () => boolean): boolean;
15
+ }
16
+ /** Runs the latest call after a pause; `flush` runs it now, as when a field loses the focus. */
17
+ export declare class Debouncer {
18
+ #private;
19
+ private readonly delay;
20
+ constructor(delay?: number);
21
+ /** A call is waiting for its pause. */
22
+ get pending(): boolean;
23
+ schedule(action: () => void): void;
24
+ flush(): void;
25
+ cancel(): void;
26
+ }
@@ -0,0 +1,28 @@
1
+ import type { DocumentStyleProperty, ImageSizeSettings } from '../../application/document-presentation';
2
+ import type { ImageLinkOptions } from '../../application/image-link';
3
+ import type { SectionLayoutPatch } from '../../core/section-layout';
4
+ import type { EditorController } from '../controller';
5
+ /**
6
+ * The single door for changing what a block or the document says and looks like: the fields of
7
+ * the properties panel, the document settings and the text typed in the panel or reviewed after
8
+ * a recovery. Components decide when a change is one history step (`LiveChangeGroup`) and where
9
+ * its error is shown; what reaches the controller passes here.
10
+ */
11
+ export declare class PropertyCommandService {
12
+ private readonly controller;
13
+ constructor(controller: () => EditorController);
14
+ style(property: string, value: string): boolean;
15
+ attribute(name: string, value: string): boolean;
16
+ imageLink(href: string, options?: ImageLinkOptions): boolean;
17
+ imageSize(settings: ImageSizeSettings): boolean;
18
+ /** The columns of a section; the answer belongs to the editor which was asked. */
19
+ layout(patch: SectionLayoutPatch): Promise<boolean>;
20
+ documentStyle(property: DocumentStyleProperty, value: string): boolean;
21
+ title(value: string): boolean;
22
+ preheader(value: string): boolean;
23
+ /** Opens the text of a block for the editor of the panel. */
24
+ beginText(id: string): boolean;
25
+ draftText(html: string): boolean;
26
+ commitText(): boolean;
27
+ cancelText(): void;
28
+ }
@@ -0,0 +1,32 @@
1
+ import type { Block } from '../../core/block-document';
2
+ import type { DocumentKind } from '../../core/document';
3
+ /** A block saved to use again: a section with its columns, or one content block. */
4
+ export interface EditorSavedBlock {
5
+ /** Identifier in the host, 1 to 128 of `A-Z a-z 0-9 _ -`. */
6
+ readonly id: string;
7
+ readonly name: string;
8
+ readonly kind: DocumentKind;
9
+ /** The block as it was saved; the editor checks it again before it enters a piece. */
10
+ readonly block: Block;
11
+ }
12
+ export interface EditorSavedBlockInput {
13
+ readonly name: string;
14
+ readonly kind: DocumentKind;
15
+ readonly block: Block;
16
+ }
17
+ /**
18
+ * The door a host implements to keep saved blocks (per account, team or project, as the host decides): the editor lists them in the
19
+ * palette, saves the selected block under a name and removes one. Where they are stored, who
20
+ * may see or change them and the audit belong to the host.
21
+ */
22
+ export interface EditorSavedBlocks {
23
+ list(kind: DocumentKind): Promise<readonly EditorSavedBlock[]>;
24
+ save(input: EditorSavedBlockInput): Promise<EditorSavedBlock>;
25
+ remove?(id: string): Promise<void>;
26
+ }
27
+ export declare const SAVED_BLOCK_LIMITS: Readonly<{
28
+ name: 80;
29
+ list: 200;
30
+ }>;
31
+ /** What the editor keeps of a list from the host: well-formed entries of the kind, in order. */
32
+ export declare function acceptedSavedBlocks(entries: unknown, kind: DocumentKind): readonly EditorSavedBlock[];
@@ -0,0 +1,20 @@
1
+ export interface PathEntry {
2
+ readonly id: string;
3
+ readonly label: string;
4
+ readonly icon: string;
5
+ }
6
+ export interface CollapsedPath {
7
+ readonly head: readonly PathEntry[];
8
+ /** Levels folded into the ellipsis menu, outermost first. */
9
+ readonly hidden: readonly PathEntry[];
10
+ readonly tail: readonly PathEntry[];
11
+ }
12
+ /**
13
+ * Fits the path of the selection in one line: the outermost level and the innermost ones stay,
14
+ * the middle folds into one menu. It never asks for a scroll bar.
15
+ */
16
+ export declare class SelectionPath {
17
+ collapse(entries: readonly PathEntry[], visible: number): CollapsedPath;
18
+ /** How many levels fit in `width` pixels, from an average width per level. */
19
+ capacity(width: number, perLevel?: number): number;
20
+ }
@@ -0,0 +1,39 @@
1
+ import type { EditorShortcutCommand } from '../../canvas-runtime/shared/shortcuts';
2
+ export interface ShortcutPorts {
3
+ readOnly(): boolean;
4
+ mode(): 'visual' | 'html';
5
+ /** A text is being edited in the piece or a gesture is in course: block keys stay out. */
6
+ busy(): boolean;
7
+ hasSelection(): boolean;
8
+ history(direction: 'undo' | 'redo'): void;
9
+ save(): void;
10
+ /** There is a change to save, or a text open in the piece which may hold one. */
11
+ unsaved(): boolean;
12
+ block(command: 'remove' | 'duplicate' | 'moveUp' | 'moveDown' | 'selectParent'): void;
13
+ /** Opens the block picker next to the selected block. */
14
+ insert(): void;
15
+ }
16
+ export interface ShortcutHelp {
17
+ readonly command: EditorShortcutCommand;
18
+ readonly labelKey: string;
19
+ readonly keys: readonly (readonly string[])[];
20
+ }
21
+ /**
22
+ * The shortcuts of the whole shell, in one place. A key pressed in a panel, in a bar or in the
23
+ * piece runs the same command; inside a text field of the shell the field keeps its own keys.
24
+ */
25
+ export declare class ShortcutService {
26
+ private readonly ports;
27
+ constructor(ports: ShortcutPorts);
28
+ list(): readonly ShortcutHelp[];
29
+ static isTextField(target: EventTarget | null): boolean;
30
+ /** Handles a key pressed in the shell. Returns whether a command took it. */
31
+ handle(event: KeyboardEvent): boolean;
32
+ /**
33
+ * A key forwarded by the frame of the piece. The frame is not trusted to decide when the host
34
+ * saves: with nothing to save the request is dropped here.
35
+ */
36
+ forwarded(command: EditorShortcutCommand): boolean;
37
+ /** Runs a command by name. */
38
+ run(command: EditorShortcutCommand): boolean;
39
+ }
@@ -0,0 +1,38 @@
1
+ import type { CanvasMovementTarget, CanvasPlacement, CanvasRegion } from '../../core/canvas-layout';
2
+ export interface StructureNode {
3
+ readonly id: string;
4
+ readonly label: string;
5
+ readonly detail: string;
6
+ readonly icon: string;
7
+ readonly container: boolean;
8
+ readonly depth: number;
9
+ readonly children?: StructureNode[];
10
+ }
11
+ export interface StructureEntry {
12
+ readonly id: string;
13
+ readonly label: string;
14
+ readonly labelKey?: string;
15
+ }
16
+ /**
17
+ * The real hierarchy of selectable blocks. Regions arrive in document order with their depth, so
18
+ * the tree is built in one pass, whatever plain markup lies between a block and its parent.
19
+ */
20
+ export declare class StructureTree {
21
+ private readonly text;
22
+ private readonly presentation;
23
+ constructor(text: (key: string) => string);
24
+ build(regions: readonly CanvasRegion[], entries: readonly StructureEntry[]): StructureNode[];
25
+ private prune;
26
+ /** Every ancestor of `id`, outermost first. */
27
+ path(nodes: readonly StructureNode[], id: string): string[];
28
+ private trail;
29
+ find(nodes: readonly StructureNode[], id: string): StructureNode | undefined;
30
+ count(nodes: readonly StructureNode[]): number;
31
+ /** Shallow levels start open; deep ones stay folded so a long piece remains readable. */
32
+ defaultExpanded(nodes: readonly StructureNode[], depth?: number): string[];
33
+ /**
34
+ * Where a dragged row would land on the row under the pointer. `ratio` is the vertical position
35
+ * inside that row; only placements the document accepts are returned.
36
+ */
37
+ placement(targets: readonly CanvasMovementTarget[], targetId: string, ratio: number, container: boolean): CanvasPlacement | undefined;
38
+ }
@@ -0,0 +1,33 @@
1
+ import type { ShallowRef } from 'vue';
2
+ import type { EditorController } from '../controller';
3
+ export interface TemplateChoice {
4
+ readonly id: string;
5
+ readonly html: string;
6
+ readonly trigger: HTMLElement;
7
+ }
8
+ interface PendingTemplate extends TemplateChoice {
9
+ readonly owner: EditorController;
10
+ readonly documentId: string;
11
+ readonly revision: number;
12
+ readonly editGeneration: number;
13
+ }
14
+ export interface TemplatePorts {
15
+ controller(): EditorController;
16
+ prepare(action: () => Promise<boolean>): Promise<void>;
17
+ invalid(): void;
18
+ }
19
+ /**
20
+ * Replacing the piece with a model, after the person confirmed it. It works from either mode:
21
+ * from the HTML mode the pending source is left behind and the editor returns to the visual
22
+ * mode, since the model replaces everything anyway.
23
+ */
24
+ export declare class TemplateApplication {
25
+ private readonly ports;
26
+ readonly pending: ShallowRef<PendingTemplate | undefined>;
27
+ constructor(ports: TemplatePorts);
28
+ choose(choice: TemplateChoice): void;
29
+ close(): void;
30
+ /** Applies the confirmed model; returns the element which should receive the focus back. */
31
+ apply(): Promise<HTMLElement | undefined>;
32
+ }
33
+ export {};
@@ -0,0 +1,28 @@
1
+ import type { CanvasPlacement } from '../../core/canvas-layout';
2
+ export interface TreeDrop {
3
+ readonly source: string;
4
+ readonly target: string;
5
+ readonly placement: CanvasPlacement;
6
+ }
7
+ interface PointerLike {
8
+ readonly pointerId: number;
9
+ readonly clientX: number;
10
+ readonly clientY: number;
11
+ readonly button: number;
12
+ readonly isPrimary: boolean;
13
+ }
14
+ /** Pointer transaction of a row dragged in the tree. The document changes only after a drop. */
15
+ export declare class TreeDragSession {
16
+ #private;
17
+ get sourceId(): string | undefined;
18
+ get dragging(): boolean;
19
+ start(id: string, event: PointerLike): boolean;
20
+ /** Returns whether the gesture is a drag; a target only counts while it is one. */
21
+ update(event: PointerLike, target?: {
22
+ id: string;
23
+ placement: CanvasPlacement;
24
+ }): boolean;
25
+ finish(event: PointerLike): TreeDrop | undefined;
26
+ cancel(): void;
27
+ }
28
+ export {};
@@ -0,0 +1,44 @@
1
+ import type { AssetReference } from '../../application/host';
2
+ import type { EditorSession } from '../../application/session';
3
+ import type { CanvasLayout, CanvasPlacement } from '../../core/canvas-layout';
4
+ import type { SourceInput } from '../../core/document';
5
+ import type { TemplateCatalog } from '../../templates/catalog';
6
+ import type { MutationGuard } from './guard';
7
+ /** Commands which add, move, duplicate and remove blocks, each one validated by the session. */
8
+ export declare class BlockEditing {
9
+ private readonly session;
10
+ private readonly layout;
11
+ private readonly templates;
12
+ private readonly guard;
13
+ constructor(session: EditorSession, layout: CanvasLayout, templates: TemplateCatalog, guard: MutationGuard);
14
+ /**
15
+ * Where something new lands: next to `targetId`, at the selected block, or (`end`) after all
16
+ * the content whatever is selected.
17
+ */
18
+ private destination;
19
+ /** A block of the catalog, compiled when it is of an e-mail, where `destination` says. */
20
+ add(type: string, targetId: string | undefined, placement: CanvasPlacement, end?: boolean): Promise<boolean>;
21
+ /** Markup next to a block, at the selection or at the end: the paste of a copied block. */
22
+ insertSource(source: SourceInput, targetId: string | undefined, placement: CanvasPlacement, end?: boolean): boolean;
23
+ /** Replaces the whole source through the ordinary import: one validated history step. */
24
+ replaceSource(source: SourceInput): boolean;
25
+ applyTemplate(id: string): Promise<boolean>;
26
+ moveTo(sourceId: string, targetId: string, placement: CanvasPlacement): boolean;
27
+ act(id: string, action: 'duplicate' | 'remove' | 'up' | 'down'): boolean;
28
+ /**
29
+ * One step of a block up or down, by keyboard or by the buttons of the bar. Next to a sibling
30
+ * it passes it, entering it first when the sibling is a container which takes the block; at
31
+ * the edge of its container it leaves it, before or after the closest ancestor which takes it,
32
+ * or, where that is refused, into the container beside that ancestor.
33
+ * Every candidate goes through the same check as a drop, so the step lands only where a drag
34
+ * could, and it is one move of the session: one step of undo.
35
+ */
36
+ private step;
37
+ /**
38
+ * Where a block enters a container it moves into: the near edge of its deepest container
39
+ * first (the top going down, the end going up), then each shallower level.
40
+ */
41
+ private entry;
42
+ connectFormReference(reference: string, nodeId?: string): boolean;
43
+ attachAsset(asset: AssetReference, nodeId?: string): boolean;
44
+ }
@@ -0,0 +1,13 @@
1
+ import type { EditorSession } from '../../application/session';
2
+ type ViewState = ReturnType<EditorSession['getState']>;
3
+ /** What has to be settled before a command changes or exports the document. */
4
+ export declare class MutationGuard {
5
+ private readonly session;
6
+ constructor(session: EditorSession);
7
+ /** Concludes the text being edited and the pending source; false when the document is locked. */
8
+ prepareMutation(): boolean;
9
+ prepareExport(): void;
10
+ /** Nothing changed since `initial`: the answer to something asynchronous still applies. */
11
+ isCurrent(initial: ViewState): boolean;
12
+ }
13
+ export {};
@@ -0,0 +1,36 @@
1
+ import type { EditorSession } from '../../application/session';
2
+ import type { BlockCatalog, BlockType } from '../../core/catalog';
3
+ import type { CanvasLayout, CanvasMovementTarget } from '../../core/canvas-layout';
4
+ import type { DocumentOutline, OutlineEntry } from '../outline';
5
+ export interface PropertyCapabilities {
6
+ attributes: readonly string[];
7
+ styles: readonly string[];
8
+ richText: boolean;
9
+ blocks: boolean;
10
+ container: boolean;
11
+ kind: BlockType | 'container' | 'native';
12
+ }
13
+ /**
14
+ * What the shell asks about the structure of the document on screen: its blocks, the selected
15
+ * one, where a block may go. Answers which cost a walk of the tree are kept for the revision
16
+ * which produced them; a revision number never names two different documents.
17
+ */
18
+ export declare class StructureQueries {
19
+ #private;
20
+ private readonly session;
21
+ private readonly layout;
22
+ private readonly catalog;
23
+ private readonly outline;
24
+ constructor(session: EditorSession, layout: CanvasLayout, catalog: BlockCatalog, outline: DocumentOutline);
25
+ private same;
26
+ entries(): readonly OutlineEntry[];
27
+ regions(): readonly import("../../core/canvas-layout").CanvasRegion[];
28
+ resolve(id: string): import("../../core/canvas-layout").CanvasRegion | undefined;
29
+ selected(): OutlineEntry | undefined;
30
+ /** The closest selectable block which contains `id`. */
31
+ parentOf(id: string): string | undefined;
32
+ movementTargets(sourceId: string): readonly CanvasMovementTarget[];
33
+ /** Where a new block may be dropped, by block and side; the command validates again. */
34
+ insertionTargets(): readonly CanvasMovementTarget[];
35
+ propertyCapabilities(): PropertyCapabilities | undefined;
36
+ }
@@ -0,0 +1,23 @@
1
+ import type { EditorSession } from '../../application/session';
2
+ import type { BlockCatalog } from '../../core/catalog';
3
+ import type { CanvasLayout } from '../../core/canvas-layout';
4
+ import type { DocumentOutline } from '../outline';
5
+ import type { StructureQueries } from './structure';
6
+ /** The text of a block: what the editors show and the transaction which changes it. */
7
+ export declare class TextEditing {
8
+ private readonly session;
9
+ private readonly layout;
10
+ private readonly catalog;
11
+ private readonly outline;
12
+ private readonly structure;
13
+ constructor(session: EditorSession, layout: CanvasLayout, catalog: BlockCatalog, outline: DocumentOutline, structure: StructureQueries);
14
+ private region;
15
+ plain(): string;
16
+ /** The projection of the text of `id`: the valid pending draft, or what the document holds. */
17
+ richTextFor(id: string): string | undefined;
18
+ allowsBlocksFor(id: string): boolean;
19
+ /** Opens the transaction of an already selected block. */
20
+ begin(id: string): boolean;
21
+ updatePlain(value: string): boolean;
22
+ updateRichTextFor(id: string, value: string): boolean;
23
+ }
@@ -0,0 +1,23 @@
1
+ import type { EditorSession } from '../../application/session';
2
+ import type { CanvasLayout } from '../../core/canvas-layout';
3
+ import type { SourceInput } from '../../core/document';
4
+ import type { HtmlAssemblyPort } from '../../renderers/preview-document';
5
+ import type { DocumentOutline } from '../outline';
6
+ import type { MutationGuard } from './guard';
7
+ /** What leaves and enters the editor as a file: source, document, preview and recovery copy. */
8
+ export declare class DocumentTransfer {
9
+ private readonly session;
10
+ private readonly assembler;
11
+ private readonly layout;
12
+ private readonly outline;
13
+ private readonly guard;
14
+ constructor(session: EditorSession, assembler: HtmlAssemblyPort, layout: CanvasLayout, outline: DocumentOutline, guard: MutationGuard);
15
+ exportSource(): SourceInput;
16
+ exportHtml(): string;
17
+ previewHtml(): string;
18
+ exportJson(): string;
19
+ exportRecovery(): string;
20
+ importFile(file: File): Promise<boolean>;
21
+ importRecovery(value: unknown): boolean;
22
+ private restore;
23
+ }
@@ -0,0 +1,20 @@
1
+ export interface EditorThemeOptions {
2
+ readonly accent?: string;
3
+ readonly surface?: string;
4
+ readonly background?: string;
5
+ readonly text?: string;
6
+ readonly muted?: string;
7
+ readonly border?: string;
8
+ readonly radius?: number;
9
+ readonly fontFamily?: string;
10
+ }
11
+ /**
12
+ * Optional overrides for a host which is not themed by Nuxt UI variables. The editor has no brand
13
+ * of its own: without options it defines nothing and inherits the theme of the host. Each option
14
+ * given sets the matching theme variable for this editor only.
15
+ */
16
+ export declare class EditorTheme {
17
+ private readonly tokens;
18
+ constructor(options?: EditorThemeOptions);
19
+ variables(): Readonly<Record<string, string>>;
20
+ }
@@ -0,0 +1,21 @@
1
+ /** A value the host fills in when the piece is sent or published: a name, a link, a date. */
2
+ export interface EditorVariable {
3
+ readonly key: string;
4
+ readonly label: string;
5
+ readonly purpose: 'text' | 'url';
6
+ /** Optional heading under which the variable is listed: "Contato", "Empresa". */
7
+ readonly group?: string;
8
+ }
9
+ export interface VariableGroup {
10
+ readonly label: string;
11
+ readonly variables: readonly EditorVariable[];
12
+ }
13
+ /** Groups the catalog of the host for one purpose and resolves a key to its token. */
14
+ export declare class VariableCatalog {
15
+ private readonly variables;
16
+ constructor(variables: readonly EditorVariable[]);
17
+ for(purpose: 'text' | 'url'): readonly EditorVariable[];
18
+ groups(purpose: 'text' | 'url', fallback: string): readonly VariableGroup[];
19
+ /** The text which stands for the variable in the piece, or undefined for an unknown key. */
20
+ token(key: string, purpose: 'text' | 'url'): string | undefined;
21
+ }
@@ -0,0 +1,100 @@
1
+ import type { ComputedRef, InjectionKey, Ref, ShallowRef } from 'vue';
2
+ import type { EditorDocumentData, SourceInput } from '../core/document';
3
+ import type { SelectionPreviewRenderer } from '../renderers/selection-preview';
4
+ import type { CanvasTextStyle } from '../security/text-presentation';
5
+ import type { EditorController, EditorViewState } from './controller';
6
+ import { EditorLocale } from './locale';
7
+ import type { EditorMessages } from './locale';
8
+ import { BlockCommandService } from './services/block-commands';
9
+ import { ImageRequestService } from './services/image-requests';
10
+ import type { EditorImagePicker } from './services/image-requests';
11
+ import { LiveChangeGroup } from './services/live-change';
12
+ import { PropertyCommandService } from './services/property-commands';
13
+ import { ShortcutService } from './services/shortcuts';
14
+ import { TemplateApplication } from './services/template-application';
15
+ import type { EditorVariable } from './variables';
16
+ /** What the editing area offers to the rest of the shell while it is mounted. */
17
+ export interface CanvasApi {
18
+ flush(): Promise<boolean>;
19
+ cancel(): void;
20
+ edit(id: string): void;
21
+ editingId(): string | undefined;
22
+ /** A drag from the palette or of a file is in course. */
23
+ gesture(): boolean;
24
+ canHistory(direction: 'undo' | 'redo'): boolean;
25
+ history(direction: 'undo' | 'redo'): boolean;
26
+ insertText(value: string): boolean;
27
+ hover(id: string | undefined): void;
28
+ startPalette(type: string, event: PointerEvent): void;
29
+ paletteDragged(): boolean;
30
+ }
31
+ /** The second text editor, in the properties panel, shares history and variables with the shell. */
32
+ export interface PanelTextApi {
33
+ canHistory(direction: 'undo' | 'redo'): boolean;
34
+ history(direction: 'undo' | 'redo'): boolean;
35
+ insertText(value: string): boolean;
36
+ }
37
+ export interface EffectiveText {
38
+ readonly documentId: string;
39
+ readonly revision: number;
40
+ readonly targetId: string;
41
+ readonly style: CanvasTextStyle;
42
+ }
43
+ export type PreviewWidth = 'desktop' | 'tablet' | 'mobile';
44
+ export interface WorkbenchOptions {
45
+ controller(): EditorController;
46
+ renderer(): SelectionPreviewRenderer | undefined;
47
+ messages(): EditorMessages | undefined;
48
+ variables(): readonly EditorVariable[];
49
+ imagePicker(): EditorImagePicker | undefined;
50
+ /** The older image contract, when the host enabled it. */
51
+ requestImage(): ((nodeId: string | undefined) => void) | undefined;
52
+ saved(payload: {
53
+ document: EditorDocumentData;
54
+ source: SourceInput;
55
+ }): void;
56
+ failed(code: string): void;
57
+ }
58
+ /**
59
+ * Everything one mounted editor shares between its components: the state of its session and the
60
+ * services which act on it. One per editor; nothing here is global.
61
+ */
62
+ export interface EditorWorkbench {
63
+ readonly state: ShallowRef<EditorViewState>;
64
+ readonly locale: ComputedRef<EditorLocale>;
65
+ readonly feedback: Ref<string>;
66
+ readonly busy: Ref<boolean>;
67
+ readonly width: Ref<PreviewWidth>;
68
+ readonly canvas: ShallowRef<CanvasApi | undefined>;
69
+ readonly panelText: ShallowRef<PanelTextApi | undefined>;
70
+ readonly inlineEditingId: Ref<string | undefined>;
71
+ readonly effectiveText: ShallowRef<EffectiveText | undefined>;
72
+ readonly commands: BlockCommandService;
73
+ readonly properties: PropertyCommandService;
74
+ readonly images: ImageRequestService;
75
+ readonly shortcuts: ShortcutService;
76
+ readonly live: LiveChangeGroup;
77
+ readonly templates: TemplateApplication;
78
+ controller(): EditorController;
79
+ renderer(): SelectionPreviewRenderer | undefined;
80
+ variables(): readonly EditorVariable[];
81
+ t(key: string): string;
82
+ /** Concludes a text being edited in the piece before anything else acts on the document. */
83
+ flush(): Promise<boolean>;
84
+ act(action: () => boolean | void | Promise<boolean | void>, success?: string): Promise<void>;
85
+ prepare(action: () => Promise<boolean>): Promise<void>;
86
+ select(id: string): Promise<void>;
87
+ history(direction: 'undo' | 'redo'): void;
88
+ /** A step of the document itself, when the text being edited has none of its own left. */
89
+ documentHistory(direction: 'undo' | 'redo', success?: string): void;
90
+ canHistory(direction: 'undo' | 'redo'): boolean;
91
+ setMode(mode: 'visual' | 'html'): Promise<void>;
92
+ save(): Promise<void>;
93
+ insertVariable(key: string): boolean;
94
+ report(code: string): void;
95
+ dispose(): void;
96
+ }
97
+ declare const WORKBENCH: InjectionKey<EditorWorkbench>;
98
+ export { WORKBENCH };
99
+ export declare function useWorkbench(): EditorWorkbench;
100
+ export declare function createWorkbench(options: WorkbenchOptions): EditorWorkbench;