@forgeroute/ui 0.5.38 → 0.5.40

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.
@@ -2,7 +2,6 @@ import { ControlValueAccessor } from "@angular/forms";
2
2
  import { UiLabelsService } from "@forgeroute/ui/core";
3
3
  import * as i0 from "@angular/core";
4
4
  import { SafeHtml } from "@angular/platform-browser";
5
- import { PillTab } from "@forgeroute/ui/pill-tabs";
6
5
  import { SelectOption } from "@forgeroute/ui/select";
7
6
  /**
8
7
  * Every toolbar control of `ui-rich-text-editor`. All are shown by default; pass any of them in
@@ -201,6 +200,8 @@ export interface EmailTemplateAssignmentOption {
201
200
  key: string;
202
201
  name: string;
203
202
  description: string;
203
+ /** Section the row belongs to (like the sections of an app's automations page). Rows of the same section are listed together, in the order given, under one heading; none = no headings. */
204
+ group?: string;
204
205
  }
205
206
  /** A template as the editor shows it. `id` is null/absent for a template that is not stored yet (new, or a copy of another). */
206
207
  export interface EmailTemplateValue {
@@ -250,6 +251,8 @@ export interface EmailTemplateVariable {
250
251
  example: string;
251
252
  /** Optional one-line explanation of what the variable is filled with; shown under the example. */
252
253
  description?: string;
254
+ /** Assignment keys (`assignmentOptions[].key`) of the emails that fill this variable. Omitted = every email. The editor lists the variable only while the template is assigned to at least one of them. */
255
+ appliesTo?: string[];
253
256
  }
254
257
  export interface EmailTemplateVariableGroup {
255
258
  name: string;
@@ -295,6 +298,120 @@ export interface EmailTemplatePreviewBrand {
295
298
  /** Shown under the message (an address, a signature, a legal line); line breaks are kept. */
296
299
  footerText?: string;
297
300
  }
301
+ /** The text a new template's first block starts with: it is a prompt, not content, so a template still holding only this has no message. */
302
+ export declare const EMAIL_TEMPLATE_START_TEXT = "Start writing your email...";
303
+ /** Longest message (serialised HTML) the editor accepts by default; hosts pass their own server limit through `maxBodyLength`. */
304
+ export declare const EMAIL_TEMPLATE_MAX_BODY = 9000;
305
+ /** Longest name / subject accepted by default. */
306
+ export declare const EMAIL_TEMPLATE_MAX_TEXT = 255;
307
+ /** Longest single email address (server rule). */
308
+ export declare const MAX_EMAIL_ADDRESS_LENGTH = 254;
309
+ /** True for a plausible single email address of at most 254 characters. */
310
+ export declare const isValidEmailAddress: (address: string) => boolean;
311
+ /** An http(s) address with a real host: no spaces or quotes (the address is written into an HTML attribute) and a dot or `localhost`. */
312
+ export declare function isWebUrl(raw: string): boolean;
313
+ /**
314
+ * How many characters typed text takes once it is saved, i.e. as `innerHTML` writes a TEXT node: `&`, `<` and `>` become entities and a
315
+ * non-breaking space (what a browser types for a run of spaces) becomes `&nbsp;`; quotes are not escaped in text, so each counts as one.
316
+ */
317
+ export declare function serializedTextLength(text: string): number;
318
+ /** Escapes text for HTML text and double-quoted attribute values. */
319
+ export declare function escapeHtml(value: string): string;
320
+ /** True when a block's HTML shows something to a reader: an image or other media, or text once tags, non-breaking spaces and whitespace are gone. */
321
+ export declare function blockHasContent(html: string): boolean;
322
+ /**
323
+ * The drag payload of a block (a palette item or a block being reordered). A custom type, never `text/plain`: a text drop onto a block's
324
+ * contenteditable would insert the payload into the message in every engine. Firefox only starts a drag when some data is set (a custom
325
+ * type counts); Safari lets a drop zone read `types` during dragover but not `getData`.
326
+ */
327
+ export declare const EMAIL_BLOCK_DRAG_TYPE = "application/x-tpl-block";
328
+ /** True when the drag carries a block payload (`types` is an array in current engines, a DOMStringList in very old ones). */
329
+ export declare function isBlockDrag(event: {
330
+ dataTransfer?: {
331
+ types?: ArrayLike<string> | readonly string[];
332
+ } | null;
333
+ }): boolean;
334
+ /** True when a node sits inside one of the editor's blocks (the only place a saved selection may point). */
335
+ export declare function insideEditorBlock(node: Node | null | undefined): boolean;
336
+ /** `m:ss` for a duration in seconds; '' when there is none. */
337
+ export declare function formatVideoDuration(seconds: number | null | undefined): string;
338
+ /** `follow-up` → `Follow Up`. */
339
+ export declare function formatCategoryLabel(cat: string | null | undefined): string;
340
+ /** The email block a video becomes: a thumbnail with a play overlay, linked to `link`, with the title and a caption. Every user value is escaped. */
341
+ export declare function buildVideoBlockHtml(video: EmailTemplateVideo, link: string, caption: string, origin: string): string;
342
+ /** The content blocks every host gets unless it passes its own `blockGroups`. */
343
+ export declare const DEFAULT_EMAIL_TEMPLATE_BLOCK_GROUPS: EmailTemplateBlockGroup[];
344
+ /** The default content blocks with group names, block names and sample words in the app's active language. */
345
+ export declare function localizedEmailBlockGroups(): EmailTemplateBlockGroup[];
346
+ /** Generic merge variables; a host passes its own `variableGroups` for the data its sender can fill in. */
347
+ export declare const DEFAULT_EMAIL_TEMPLATE_VARIABLE_GROUPS: {
348
+ name: string;
349
+ variables: {
350
+ key: string;
351
+ label: string;
352
+ example: string;
353
+ }[];
354
+ }[];
355
+ /** The font of a sent email's message (the apps' email shell uses this stack); the Preview and the design canvas use it too, so the three look alike. */
356
+ export declare const EMAIL_DEFAULT_FONT = "-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif";
357
+ /**
358
+ * The document the Preview / Mobile tabs show (inside a sandboxed iframe): the serialised message with the base look of a sent email. A
359
+ * Content-Security-Policy meta blocks scripts and anything but images / inline styles, and links open nowhere (sandbox, no popups).
360
+ */
361
+ export declare function buildPreviewDocument(bodyHtml: string, brand?: EmailTemplatePreviewBrand | null): string;
362
+ /** Keeps only the brand values that are safe to write into the preview document (see `EmailTemplatePreviewBrand`); anything else is dropped. */
363
+ export declare function safePreviewBrand(brand?: EmailTemplatePreviewBrand | null): EmailTemplatePreviewBrand;
364
+ /** True when the whole text is one merge variable (`{{trackingUrl}}`): a link address the email fills in when it is sent. */
365
+ export declare function isVariableAddress(value: string): boolean;
366
+ /** The `{{key}}` merge variables written in the texts, each once, in the order they first appear. */
367
+ export declare function usedVariableKeys(...texts: string[]): string[];
368
+ /** The message as the Preview shows it with sample data: every known `{{key}}` becomes the variable's (escaped) `example`; a key the host does not offer stays as written. */
369
+ export declare function fillSampleVariables(html: string, groups: readonly EmailTemplateVariableGroup[]): string;
370
+ /** What the editor warns about before a template is saved: mistakes that turn into a broken email. */
371
+ export interface EmailChecks {
372
+ /** Variables used in the subject or message that the host does not offer: they are sent as empty text. */
373
+ unknownVariables: string[];
374
+ /** Images with no alt text (what a screen reader and a blocked-image inbox show). */
375
+ imagesWithoutAlt: number;
376
+ /** Links with no address (empty or `#`): clicking them goes nowhere. */
377
+ emptyLinks: number;
378
+ }
379
+ export declare function findEmailChecks(subject: string, bodyHtml: string, knownKeys: readonly string[]): EmailChecks;
380
+ /** The default merge variables with names in the app's active language (the `key` and the example value stay as they are). */
381
+ export declare function localizedEmailVariableGroups(): {
382
+ name: string;
383
+ variables: {
384
+ label: string;
385
+ key: string;
386
+ example: string;
387
+ }[];
388
+ }[];
389
+ /** One emoji of the picker: the character, the words a search matches, the group it is listed in and whether a skin tone can be applied to it. */
390
+ export interface EmailEmoji {
391
+ char: string;
392
+ words: string;
393
+ group: string;
394
+ tone: boolean;
395
+ }
396
+ /** The picker's groups, in order (`key` is the label key `emailTemplateEditor.emojiGroup.<key>`; `icon` is the emoji that stands for the group in the tab row). */
397
+ export declare const EMAIL_EMOJI_GROUP_KEYS: readonly {
398
+ key: string;
399
+ icon: string;
400
+ }[];
401
+ /** Skin tones: the Fitzpatrick modifier written after a base emoji that supports it ('' = the default yellow). */
402
+ export declare const EMAIL_SKIN_TONES: readonly {
403
+ key: string;
404
+ modifier: string;
405
+ swatch: string;
406
+ }[];
407
+ /** Every emoji of the picker, in group order. */
408
+ export declare const EMAIL_EMOJIS: readonly EmailEmoji[];
409
+ /** The emojis a search matches (every word typed must appear in the emoji's words; case and accents ignored); all of a group when the search is empty. */
410
+ export declare function findEmojis(search: string, group: string): EmailEmoji[];
411
+ /** The emoji with a skin tone applied (only to one that supports it; the modifier goes after the first code point, before any variation selector). */
412
+ export declare function withSkinTone(emoji: EmailEmoji, modifier: string): string;
413
+ /** The special characters panel: the symbols an email commonly needs. */
414
+ export declare const EMAIL_SPECIAL_CHARACTERS: readonly string[];
298
415
  interface EmailBlock {
299
416
  id: string;
300
417
  html: string;
@@ -328,8 +445,12 @@ export declare class EmailTemplateEditorComponent {
328
445
  readonly showCategory: import("@angular/core").InputSignal<boolean>;
329
446
  /** Shows "Use this template all year" and the Active From / To dates (default). An app whose templates are not seasonal sets `false`: nothing is shown and Save always emits `useAllYear: true` with no dates. */
330
447
  readonly showActiveRange: import("@angular/core").InputSignal<boolean>;
448
+ /** Prints the "Add a name, a subject, ..." line under a disabled Save button (default). An app that does not want it sets `false`: the line is gone, Save stays disabled and the same text stays as the button's tooltip. */
449
+ readonly showSaveHint: import("@angular/core").InputSignal<boolean>;
331
450
  /** Styles the Preview and Mobile tabs like the app's real emails (font, colours, logo, company name, footer); see `EmailTemplatePreviewBrand`. `null` = the default look. */
332
451
  readonly previewBrand: import("@angular/core").InputSignal<EmailTemplatePreviewBrand | null>;
452
+ /** The font the design canvas is written in: the one the sent email uses (the brand's, else the shared email stack), so line breaks and text size are what the inbox shows. */
453
+ readonly canvasFont: import("@angular/core").Signal<string>;
333
454
  /** The Preview and Mobile tabs fill every variable with its `example` (default off: they show the `{{key}}` tokens as written). The saved message is never changed. */
334
455
  readonly previewSampleData: import("@angular/core").InputSignal<boolean>;
335
456
  /**
@@ -346,6 +467,10 @@ export declare class EmailTemplateEditorComponent {
346
467
  readonly assignmentsDescription: import("@angular/core").Signal<string>;
347
468
  readonly variableGroupsInput: import("@angular/core").InputSignal<EmailTemplateVariableGroup[] | null>;
348
469
  readonly variableGroups: import("@angular/core").Signal<EmailTemplateVariableGroup[]>;
470
+ /** With assignment options, no variable is offered until the template is assigned to an email; then only the variables that email (any assigned email) fills (`appliesTo`; none = all emails). */
471
+ readonly variablesNeedAssignment: import("@angular/core").Signal<boolean>;
472
+ /** Only these are offered, and a `{{variable}}` typed by hand that is not among them is reported by "Check before saving" (it would arrive blank). */
473
+ readonly availableVariableGroups: import("@angular/core").Signal<EmailTemplateVariableGroup[]>;
349
474
  readonly blockGroupsInput: import("@angular/core").InputSignal<EmailTemplateBlockGroup[] | null>;
350
475
  readonly blockGroups: import("@angular/core").Signal<EmailTemplateBlockGroup[]>;
351
476
  /** Page heading shown at the start of the actions row (e.g. "Create Your Template"). Empty (default) = no heading; the buttons stay right aligned. */
@@ -395,8 +520,14 @@ export declare class EmailTemplateEditorComponent {
395
520
  readonly subject: import("@angular/core").WritableSignal<string>;
396
521
  readonly category: import("@angular/core").WritableSignal<string>;
397
522
  readonly useAllYear: import("@angular/core").WritableSignal<boolean>;
523
+ /** Today in the user's own time zone (`YYYY-MM-DD`): neither active date may be earlier (a template cannot start or end in the past). */
524
+ readonly today: string;
398
525
  readonly activeFrom: import("@angular/core").WritableSignal<string>;
399
526
  readonly activeTo: import("@angular/core").WritableSignal<string>;
527
+ /** Picking a later Active From than the Active To already chosen clears Active To (the user picks it again), so the range is never backwards. */
528
+ onActiveFromChange(value: string): void;
529
+ /** The earliest Active To: the Active From date when it is set and later than today, otherwise today. */
530
+ readonly activeToMin: import("@angular/core").Signal<string>;
400
531
  readonly videoId: import("@angular/core").WritableSignal<string | null>;
401
532
  readonly videoTitle: import("@angular/core").WritableSignal<string | null>;
402
533
  /** The triggers this template is assigned to (an email template is only ever assigned for email); the rows shown are `assignmentOptions` with this applied. */
@@ -408,23 +539,22 @@ export declare class EmailTemplateEditorComponent {
408
539
  private savedRange;
409
540
  private readonly blockEditors;
410
541
  private readonly colorInputRef;
542
+ private readonly highlightInputRef;
411
543
  /** The stored body of the template being edited; null for a new one. */
412
544
  private readonly loadedBody;
413
545
  /** True once the user really edited the message (typing, blocks, formatting, links...). */
414
546
  private readonly bodyEdited;
415
547
  private savedSnapshot;
416
548
  private dragFromPalette;
417
- readonly dragFromCanvas: import("@angular/core").WritableSignal<number | null>;
418
- readonly dragOverIndex: import("@angular/core").WritableSignal<number | null>;
419
549
  readonly currentColor: import("@angular/core").WritableSignal<string>;
420
550
  readonly blockSpacing: import("@angular/core").WritableSignal<string>;
421
- readonly headingKey: import("@angular/core").WritableSignal<number>;
422
551
  readonly sizeKey: import("@angular/core").WritableSignal<number>;
423
552
  private readonly _headingOptions;
424
553
  get headingOptions(): SelectOption<string>[];
425
554
  readonly fontSizeOptions: SelectOption<string>[];
426
- private readonly _spacingTabs;
427
- get spacingTabs(): PillTab[];
555
+ /** The block spacing as one compact dropdown (the toolbar's last group): the label carries the word "Spacing" so the closed select reads "Spacing: Medium". */
556
+ private readonly _spacingOptions;
557
+ get spacingOptions(): SelectOption<string>[];
428
558
  /** The grey hint shown in the empty first block. */
429
559
  protected readonly startPlaceholder: import("@angular/core").Signal<string>;
430
560
  private readonly _ctaTypeOptions;
@@ -435,6 +565,28 @@ export declare class EmailTemplateEditorComponent {
435
565
  label: string;
436
566
  }[];
437
567
  readonly showLinkDialog: import("@angular/core").WritableSignal<boolean>;
568
+ readonly showEmojiPanel: import("@angular/core").WritableSignal<boolean>;
569
+ /** The open colour panel (text colour or highlight), or none. */
570
+ readonly colorPanel: import("@angular/core").WritableSignal<"highlight" | "text" | null>;
571
+ readonly colorSwatches: readonly string[];
572
+ /** The email's own text colour (what "Remove" on the text colour goes back to). */
573
+ readonly brandTextColor: import("@angular/core").Signal<string>;
574
+ readonly showSpecialPanel: import("@angular/core").WritableSignal<boolean>;
575
+ readonly emojiGroupKeys: readonly {
576
+ key: string;
577
+ icon: string;
578
+ }[];
579
+ readonly specialCharacters: readonly string[];
580
+ readonly emojiSearch: import("@angular/core").WritableSignal<string>;
581
+ readonly emojiTone: import("@angular/core").WritableSignal<string>;
582
+ readonly emojiGroup: import("@angular/core").WritableSignal<string>;
583
+ readonly skinToneOptions: import("@angular/core").Signal<SelectOption<string>[]>;
584
+ readonly shownEmojis: import("@angular/core").Signal<EmailEmoji[]>;
585
+ /** The heading the caret is in ('p' for text and quotes), shown in the Heading select. */
586
+ readonly headingValue: import("@angular/core").WritableSignal<string>;
587
+ readonly currentHighlight: import("@angular/core").WritableSignal<string>;
588
+ /** True while the caret is in a table: the table tools show in the toolbar. */
589
+ readonly inTable: import("@angular/core").WritableSignal<boolean>;
438
590
  readonly linkUrl: import("@angular/core").WritableSignal<string>;
439
591
  readonly linkText: import("@angular/core").WritableSignal<string>;
440
592
  /** True when the link is made from selected text (the text field is then not needed). */
@@ -461,7 +613,14 @@ export declare class EmailTemplateEditorComponent {
461
613
  readonly canWrite: import("@angular/core").Signal<boolean>;
462
614
  /** A system template can be copied into a new template of the company's own (full access). */
463
615
  readonly canCopySystem: import("@angular/core").Signal<boolean>;
464
- readonly filteredAssignments: import("@angular/core").Signal<AssignmentView[]>;
616
+ readonly filteredAssignments: import("@angular/core").Signal<{
617
+ groupStart: boolean;
618
+ assigned: boolean;
619
+ key: string;
620
+ name: string;
621
+ description: string;
622
+ group?: string;
623
+ }[]>;
465
624
  readonly filteredBlockGroups: import("@angular/core").Signal<EmailTemplateBlockGroup[]>;
466
625
  private readonly serialized;
467
626
  readonly previewHtml: import("@angular/core").Signal<string>;
@@ -528,18 +687,16 @@ export declare class EmailTemplateEditorComponent {
528
687
  onSave(): void;
529
688
  private snapshot;
530
689
  private serialize;
531
- private htmlToBlocks;
690
+ /** The stored message as the one document's HTML: the inside of every `data-block` element, joined in order (a message without blocks is taken as it is). */
691
+ private htmlToDocument;
532
692
  private genId;
533
693
  private editorFor;
534
694
  /** Copies each block's HTML from its DOM element (before saving / preview). */
535
695
  syncActiveBlockHtml(): void;
536
696
  private syncBlock;
537
697
  setEditorTab(tab: EditorTab): void;
538
- addBlock(blockKey?: string): void;
698
+ /** Puts a content block (a button, a divider, a video card...) into the document at the caret, or at the end when the caret is elsewhere. */
539
699
  private addBlockHtml;
540
- deleteBlock(index: number): void;
541
- duplicateBlock(index: number): void;
542
- moveBlock(index: number, direction: -1 | 1): void;
543
700
  onBlockInput(event: Event, block: EmailBlock): void;
544
701
  /**
545
702
  * Typing and pasting stop at the body limit: input that would push the saved HTML past it is refused before it reaches the block
@@ -547,18 +704,20 @@ export declare class EmailTemplateEditorComponent {
547
704
  */
548
705
  onBlockBeforeInput(event: InputEvent): void;
549
706
  onBlockFocus(block: EmailBlock): void;
550
- onPaletteDragStart(event: DragEvent, block: EmailTemplateBlock): void;
551
707
  /**
552
- * Starts reordering a block. Only the block's drag HANDLE is draggable (not the whole block): a draggable ancestor of a contenteditable makes
553
- * Firefox and Safari hijack mouse text selection inside it. `wrapper` is the block, shown as the drag image instead of the small handle.
708
+ * Text typed straight into the empty document is a bare text node; a sent email styles paragraphs, so every run of loose text (and inline elements) at the top level is wrapped in a
709
+ * `<p>` the moment it appears. The caret stays where it was.
554
710
  */
555
- onBlockDragStart(event: DragEvent, index: number, wrapper?: HTMLElement): void;
711
+ private wrapBareText;
712
+ /** What the caret is in: the top-level element (its heading, its spacing wrapper) and a table; the toolbar shows it. */
713
+ refreshContext(): void;
714
+ /** The element of the document the caret (or the start of the selection) is in, at the top level of the document. A bare text run at the top level is wrapped in a paragraph first. */
715
+ private topLevelAtCaret;
716
+ onPaletteDragStart(event: DragEvent, block: EmailTemplateBlock): void;
556
717
  onBlockDragEnd(): void;
557
- /** The canvas as a whole accepts only a block drag; a text drag inside a block keeps the browser's own behaviour. */
558
- onCanvasDragOver(event: DragEvent): void;
559
- onDropZoneDragOver(event: DragEvent, index: number): void;
560
- onDropZoneLeave(): void;
561
- onDropZoneDrop(event: DragEvent, insertBefore: number): void;
718
+ onDocDragOver(event: DragEvent): void;
719
+ /** A content block dropped on the document goes in where it was dropped (the caret is moved to that point first). */
720
+ onDocDrop(event: DragEvent): void;
562
721
  /**
563
722
  * Mousedown on the toolbar keeps the selection in the editor (a button click must not blur it). A `<select>` / `<input>` must be left alone:
564
723
  * preventing the default of its mousedown stops the dropdown from opening. Those controls take focus, so they save the selection first
@@ -573,6 +732,8 @@ export declare class EmailTemplateEditorComponent {
573
732
  * from an earlier interaction is dropped instead of formatting the wrong block.
574
733
  */
575
734
  private restoreSelection;
735
+ /** Puts focus back in the document (keeping the selection inside it): a command run from a dialog's field would otherwise act on that field, not on the text. */
736
+ private focusEditor;
576
737
  /** The HTML of the block being edited, or null when its editor is not on screen. */
577
738
  private activeBlockHtml;
578
739
  /**
@@ -582,18 +743,50 @@ export declare class EmailTemplateEditorComponent {
582
743
  */
583
744
  private runEditCommand;
584
745
  execCommand(cmd: string, value?: string): void;
746
+ /** A divider or a quote the browser just created gets its look written INTO it: a mail client has no stylesheet of ours, so the line and the quote bar must be inline styles. */
747
+ private styleNewBlocks;
585
748
  /**
586
749
  * A list the browser just created gets its look written INTO it (bullets or numbers, a 40px indent, 1em above and below): the editing surface, the Preview and the sent email then
587
750
  * all show the same list, whatever the app's own CSS does to `ul` / `ol` (a reset that removes bullets) and although the component's scoped styles never reach elements the browser
588
751
  * creates at run time. A list that already has a style (one the user or a template set) is left as it is.
589
752
  */
590
753
  private styleNewLists;
754
+ /** Enter on an empty line inside a quote leaves the quote (the browser would only add another quoted line). */
755
+ onDocEnter(event: Event): void;
756
+ /** The browser copies a quote's inline look (bar, indent, grey) onto the paragraph it turns the line into; a paragraph that is no longer a quote gets none of it. */
757
+ private stripQuoteLook;
758
+ /** Block quote: the paragraph the caret is in becomes a quote; a second click on a quote turns it back into a paragraph. */
759
+ toggleQuote(): void;
591
760
  onHeading(value: string): void;
592
761
  onFontSize(value: string): void;
593
762
  applyFontSize(size: string): void;
594
763
  applyTextColor(color: string): void;
595
- openColorPicker(): void;
764
+ /** The colour panel for the text colour or the highlight (one at a time; any other panel closes). */
765
+ toggleColorPanel(which: 'text' | 'highlight'): void;
766
+ /** A ready colour: applied to the selection, then the panel closes. */
767
+ pickColor(which: 'text' | 'highlight', color: string): void;
768
+ /** "Remove": the text goes back to the email's own text colour; the highlight is taken off. */
769
+ removeColor(which: 'text' | 'highlight'): void;
770
+ /** "Custom color": the browser's own colour dialog, opened from the click on this button (a hidden input cannot open it reliably from a mousedown). */
771
+ openCustomColor(which: 'text' | 'highlight'): void;
772
+ /**
773
+ * Block spacing: extra space above and below the paragraph, heading, list or table the caret is in, written as the same wrapper the sent email carries
774
+ * (`<div data-spacing style="padding:Npx 0">`). 'None' takes the wrapper off again.
775
+ */
596
776
  applySpacing(value: string): void;
777
+ applyHighlight(color: string): void;
778
+ /** Puts a 3 x 3 table at the caret. Borders and padding are inline styles, so a mail client draws the same grid. */
779
+ insertTable(): void;
780
+ private currentCell;
781
+ private editTable;
782
+ private newCell;
783
+ tableAddRow(): void;
784
+ tableAddColumn(): void;
785
+ /** Puts the caret in a cell, so the table tools stay on screen after the cell the caret was in is deleted. */
786
+ private placeCaretInCell;
787
+ tableDeleteRow(): void;
788
+ tableDeleteColumn(): void;
789
+ tableDelete(): void;
597
790
  /** The one link of the message block being edited that holds the whole selection (or the caret), else null: a selection that reaches outside a link, or lies in two links, is not "in" a link. */
598
791
  private anchorAtSelection;
599
792
  openLinkDialog(): void;
@@ -613,8 +806,17 @@ export declare class EmailTemplateEditorComponent {
613
806
  isOpen(id: string): boolean;
614
807
  toggleGroup(id: string): void;
615
808
  insertBlock(block: EmailTemplateBlock): void;
809
+ emojiGroupLabel(key: string): string;
810
+ toneLabel(key: string): string;
811
+ /** The emoji as it is inserted: with the chosen skin tone when it supports one. */
812
+ emojiWithTone(e: EmailEmoji): string;
813
+ /** The first words of the emoji's name, for the button's accessible name. */
814
+ emojiName(e: EmailEmoji): string;
815
+ toggleEmojiPanel(): void;
816
+ toggleSpecialPanel(): void;
817
+ /** Types the emoji at the caret of the block being edited (nothing is inserted when no block holds the caret). */
818
+ insertEmoji(emoji: string): void;
616
819
  insertVariable(variable: EmailTemplateVariable): void;
617
- private blockHtml;
618
820
  static ɵfac: i0.ɵɵFactoryDeclaration<EmailTemplateEditorComponent, never>;
619
821
  static ɵcmp: i0.ɵɵComponentDeclaration<EmailTemplateEditorComponent, "ui-email-template-editor", never, {
620
822
  "template": {
@@ -637,6 +839,11 @@ export declare class EmailTemplateEditorComponent {
637
839
  "required": false;
638
840
  "isSignal": true;
639
841
  };
842
+ "showSaveHint": {
843
+ "alias": "showSaveHint";
844
+ "required": false;
845
+ "isSignal": true;
846
+ };
640
847
  "previewBrand": {
641
848
  "alias": "previewBrand";
642
849
  "required": false;
@@ -782,94 +989,8 @@ export declare class EmailTemplateEditorComponent {
782
989
  "testSend": "testSend";
783
990
  "videosRequested": "videosRequested";
784
991
  "useAsMine": "useAsMine";
785
- }, never, never, true, never>;
992
+ }, never, ["[editor-heading-start]"], true, never>;
786
993
  }
787
- /** The text a new template's first block starts with: it is a prompt, not content, so a template still holding only this has no message. */
788
- export declare const EMAIL_TEMPLATE_START_TEXT = "Start writing your email...";
789
- /** Longest message (serialised HTML) the editor accepts by default; hosts pass their own server limit through `maxBodyLength`. */
790
- export declare const EMAIL_TEMPLATE_MAX_BODY = 9000;
791
- /** Longest name / subject accepted by default. */
792
- export declare const EMAIL_TEMPLATE_MAX_TEXT = 255;
793
- /** Longest single email address (server rule). */
794
- export declare const MAX_EMAIL_ADDRESS_LENGTH = 254;
795
- /** True for a plausible single email address of at most 254 characters. */
796
- export declare const isValidEmailAddress: (address: string) => boolean;
797
- /** An http(s) address with a real host: no spaces or quotes (the address is written into an HTML attribute) and a dot or `localhost`. */
798
- export declare function isWebUrl(raw: string): boolean;
799
- /**
800
- * How many characters typed text takes once it is saved, i.e. as `innerHTML` writes a TEXT node: `&`, `<` and `>` become entities and a
801
- * non-breaking space (what a browser types for a run of spaces) becomes `&nbsp;`; quotes are not escaped in text, so each counts as one.
802
- */
803
- export declare function serializedTextLength(text: string): number;
804
- /** Escapes text for HTML text and double-quoted attribute values. */
805
- export declare function escapeHtml(value: string): string;
806
- /** True when a block's HTML shows something to a reader: an image or other media, or text once tags, non-breaking spaces and whitespace are gone. */
807
- export declare function blockHasContent(html: string): boolean;
808
- /**
809
- * The drag payload of a block (a palette item or a block being reordered). A custom type, never `text/plain`: a text drop onto a block's
810
- * contenteditable would insert the payload into the message in every engine. Firefox only starts a drag when some data is set (a custom
811
- * type counts); Safari lets a drop zone read `types` during dragover but not `getData`.
812
- */
813
- export declare const EMAIL_BLOCK_DRAG_TYPE = "application/x-tpl-block";
814
- /** True when the drag carries a block payload (`types` is an array in current engines, a DOMStringList in very old ones). */
815
- export declare function isBlockDrag(event: {
816
- dataTransfer?: {
817
- types?: ArrayLike<string> | readonly string[];
818
- } | null;
819
- }): boolean;
820
- /** True when a node sits inside one of the editor's blocks (the only place a saved selection may point). */
821
- export declare function insideEditorBlock(node: Node | null | undefined): boolean;
822
- /** `m:ss` for a duration in seconds; '' when there is none. */
823
- export declare function formatVideoDuration(seconds: number | null | undefined): string;
824
- /** `follow-up` → `Follow Up`. */
825
- export declare function formatCategoryLabel(cat: string | null | undefined): string;
826
- /** The email block a video becomes: a thumbnail with a play overlay, linked to `link`, with the title and a caption. Every user value is escaped. */
827
- export declare function buildVideoBlockHtml(video: EmailTemplateVideo, link: string, caption: string, origin: string): string;
828
- /** The content blocks every host gets unless it passes its own `blockGroups`. */
829
- export declare const DEFAULT_EMAIL_TEMPLATE_BLOCK_GROUPS: EmailTemplateBlockGroup[];
830
- /** The default content blocks with group names, block names and sample words in the app's active language. */
831
- export declare function localizedEmailBlockGroups(): EmailTemplateBlockGroup[];
832
- /** Generic merge variables; a host passes its own `variableGroups` for the data its sender can fill in. */
833
- export declare const DEFAULT_EMAIL_TEMPLATE_VARIABLE_GROUPS: {
834
- name: string;
835
- variables: {
836
- key: string;
837
- label: string;
838
- example: string;
839
- }[];
840
- }[];
841
- /**
842
- * The document the Preview / Mobile tabs show (inside a sandboxed iframe): the serialised message with the base look of a sent email. A
843
- * Content-Security-Policy meta blocks scripts and anything but images / inline styles, and links open nowhere (sandbox, no popups).
844
- */
845
- export declare function buildPreviewDocument(bodyHtml: string, brand?: EmailTemplatePreviewBrand | null): string;
846
- /** Keeps only the brand values that are safe to write into the preview document (see `EmailTemplatePreviewBrand`); anything else is dropped. */
847
- export declare function safePreviewBrand(brand?: EmailTemplatePreviewBrand | null): EmailTemplatePreviewBrand;
848
- /** True when the whole text is one merge variable (`{{trackingUrl}}`): a link address the email fills in when it is sent. */
849
- export declare function isVariableAddress(value: string): boolean;
850
- /** The `{{key}}` merge variables written in the texts, each once, in the order they first appear. */
851
- export declare function usedVariableKeys(...texts: string[]): string[];
852
- /** The message as the Preview shows it with sample data: every known `{{key}}` becomes the variable's (escaped) `example`; a key the host does not offer stays as written. */
853
- export declare function fillSampleVariables(html: string, groups: readonly EmailTemplateVariableGroup[]): string;
854
- /** What the editor warns about before a template is saved: mistakes that turn into a broken email. */
855
- export interface EmailChecks {
856
- /** Variables used in the subject or message that the host does not offer: they are sent as empty text. */
857
- unknownVariables: string[];
858
- /** Images with no alt text (what a screen reader and a blocked-image inbox show). */
859
- imagesWithoutAlt: number;
860
- /** Links with no address (empty or `#`): clicking them goes nowhere. */
861
- emptyLinks: number;
862
- }
863
- export declare function findEmailChecks(subject: string, bodyHtml: string, knownKeys: readonly string[]): EmailChecks;
864
- /** The default merge variables with names in the app's active language (the `key` and the example value stay as they are). */
865
- export declare function localizedEmailVariableGroups(): {
866
- name: string;
867
- variables: {
868
- label: string;
869
- key: string;
870
- example: string;
871
- }[];
872
- }[];
873
994
  /** An inspection checklist template, as the print sheet needs it. */
874
995
  export interface PrintableInspectionTemplate {
875
996
  name: string;