@keycloakify/angular-email 0.0.1-rc.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +130 -0
- package/bin/build.js +153 -0
- package/esbuild/esbuild.d.ts +2 -0
- package/esbuild/index.d.ts +1 -0
- package/fesm2022/keycloakify-angular-email-esbuild.mjs +28 -0
- package/fesm2022/keycloakify-angular-email-esbuild.mjs.map +1 -0
- package/fesm2022/keycloakify-angular-email.mjs +829 -0
- package/fesm2022/keycloakify-angular-email.mjs.map +1 -0
- package/index.d.ts +19 -0
- package/lib/components/background/background.component.d.ts +15 -0
- package/lib/components/body/body.component.d.ts +7 -0
- package/lib/components/button/button.component.d.ts +55 -0
- package/lib/components/color-scheme/color-scheme.component.d.ts +34 -0
- package/lib/components/column/column.component.d.ts +9 -0
- package/lib/components/conditional/conditional.component.d.ts +12 -0
- package/lib/components/container/container.component.d.ts +20 -0
- package/lib/components/head/head.component.d.ts +7 -0
- package/lib/components/heading/heading.component.d.ts +16 -0
- package/lib/components/hr/hr.component.d.ts +13 -0
- package/lib/components/html/html.component.d.ts +10 -0
- package/lib/components/img/img.component.d.ts +18 -0
- package/lib/components/link/link.component.d.ts +14 -0
- package/lib/components/preview/preview.component.d.ts +8 -0
- package/lib/components/raw/raw.component.d.ts +8 -0
- package/lib/components/section/section.component.d.ts +8 -0
- package/lib/components/text/text.component.d.ts +13 -0
- package/lib/render.d.ts +26 -0
- package/lib/utils.d.ts +18 -0
- package/package.json +58 -0
|
@@ -0,0 +1,829 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, computed, Component, ChangeDetectionStrategy, effect, CUSTOM_ELEMENTS_SCHEMA, inject, NO_ERRORS_SCHEMA, provideExperimentalZonelessChangeDetection } from '@angular/core';
|
|
3
|
+
import { NgTemplateOutlet, DOCUMENT } from '@angular/common';
|
|
4
|
+
import { bootstrapApplication } from '@angular/platform-browser';
|
|
5
|
+
import { provideServerRendering, renderApplication } from '@angular/platform-server';
|
|
6
|
+
import { render as render$1 } from '@maizzle/framework';
|
|
7
|
+
import * as cheerio from 'cheerio/slim';
|
|
8
|
+
import { convert } from 'html-to-text';
|
|
9
|
+
import prettyPrint from 'pretty';
|
|
10
|
+
|
|
11
|
+
class BackgroundComponent {
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
|
+
$style = input(null, { alias: 'style' });
|
|
14
|
+
$styleClass = input(undefined, { alias: 'styleClass' });
|
|
15
|
+
$width = input(0, { alias: 'width' });
|
|
16
|
+
$height = input(0, { alias: 'height' });
|
|
17
|
+
$src = input(undefined, { alias: 'src' });
|
|
18
|
+
$bgRepeat = input('no-repeat', { alias: 'bgRepeat' });
|
|
19
|
+
$bgColor = input(undefined, { alias: 'bgColor' });
|
|
20
|
+
$bgStyle = computed(() => ({ backgroundRepeat: this.$bgRepeat(), ...(this.$style() ?? {}) }));
|
|
21
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: BackgroundComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
22
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.6", type: BackgroundComponent, isStandalone: true, selector: "ng-email-background", inputs: { $style: { classPropertyName: "$style", publicName: "style", isSignal: true, isRequired: false, transformFunction: null }, $styleClass: { classPropertyName: "$styleClass", publicName: "styleClass", isSignal: true, isRequired: false, transformFunction: null }, $width: { classPropertyName: "$width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, $height: { classPropertyName: "$height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, $src: { classPropertyName: "$src", publicName: "src", isSignal: true, isRequired: false, transformFunction: null }, $bgRepeat: { classPropertyName: "$bgRepeat", publicName: "bgRepeat", isSignal: true, isRequired: false, transformFunction: null }, $bgColor: { classPropertyName: "$bgColor", publicName: "bgColor", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@let width = $width();\n@let height = $height();\n\n<table\n [cellPadding]=\"0\"\n [cellSpacing]=\"0\"\n [border]=\"0\"\n width=\"100%\"\n [attr.height]=\"height\"\n role=\"presentation\"\n>\n <tr>\n <td\n [align]=\"'top'\"\n [width]=\"width\"\n [height]=\"height && width ? height : undefined\"\n [attr.bgcolor]=\"$bgColor()\"\n [attr.background]=\"$src()\"\n [style]=\"$bgStyle()\"\n [class]=\"$styleClass()\"\n >\n <ng-content />\n </td>\n </tr>\n</table>\n", changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
23
|
+
}
|
|
24
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: BackgroundComponent, decorators: [{
|
|
25
|
+
type: Component,
|
|
26
|
+
args: [{ selector: 'ng-email-background', changeDetection: ChangeDetectionStrategy.OnPush, imports: [], template: "@let width = $width();\n@let height = $height();\n\n<table\n [cellPadding]=\"0\"\n [cellSpacing]=\"0\"\n [border]=\"0\"\n width=\"100%\"\n [attr.height]=\"height\"\n role=\"presentation\"\n>\n <tr>\n <td\n [align]=\"'top'\"\n [width]=\"width\"\n [height]=\"height && width ? height : undefined\"\n [attr.bgcolor]=\"$bgColor()\"\n [attr.background]=\"$src()\"\n [style]=\"$bgStyle()\"\n [class]=\"$styleClass()\"\n >\n <ng-content />\n </td>\n </tr>\n</table>\n" }]
|
|
27
|
+
}] });
|
|
28
|
+
|
|
29
|
+
class BodyComponent {
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
31
|
+
$style = input(null, { alias: 'style' });
|
|
32
|
+
$styleClass = input(undefined, { alias: 'styleClass' });
|
|
33
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: BodyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
34
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.6", type: BodyComponent, isStandalone: true, selector: "ng-email-body", inputs: { $style: { classPropertyName: "$style", publicName: "style", isSignal: true, isRequired: false, transformFunction: null }, $styleClass: { classPropertyName: "$styleClass", publicName: "styleClass", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<body\n [style]=\"$style()\"\n [class]=\"$styleClass()\"\n>\n <ng-content />\n</body>\n", changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
35
|
+
}
|
|
36
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: BodyComponent, decorators: [{
|
|
37
|
+
type: Component,
|
|
38
|
+
args: [{ selector: 'ng-email-body', changeDetection: ChangeDetectionStrategy.OnPush, template: "<body\n [style]=\"$style()\"\n [class]=\"$styleClass()\"\n>\n <ng-content />\n</body>\n" }]
|
|
39
|
+
}] });
|
|
40
|
+
|
|
41
|
+
class ButtonComponent {
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
43
|
+
$style = input(null, { alias: 'style' });
|
|
44
|
+
$styleClass = input(null, { alias: 'styleClass' });
|
|
45
|
+
$href = input(undefined, { alias: 'href' });
|
|
46
|
+
$textContent = input.required({ alias: 'textContent' });
|
|
47
|
+
$width = input(undefined, { alias: 'width' });
|
|
48
|
+
$height = input(undefined, { alias: 'height' });
|
|
49
|
+
$borderRadius = input(0, { alias: 'borderRadius' });
|
|
50
|
+
$textColor = input(undefined, { alias: 'textColor' });
|
|
51
|
+
$backgroundColor = input(undefined, { alias: 'backgroundColor' });
|
|
52
|
+
$borderColor = input(undefined, { alias: 'borderColor' });
|
|
53
|
+
$borderSize = input(1, { alias: 'borderSize' });
|
|
54
|
+
$fontSize = input(16, { alias: 'fontSize' });
|
|
55
|
+
$align = input('left', { alias: 'align' });
|
|
56
|
+
$withBackground = input(false, { alias: 'withBackground' });
|
|
57
|
+
$arcsize = computed(() => Math.floor((this.$borderRadius() / (this.$height() ?? 1)) * 100));
|
|
58
|
+
$lineHeight = computed(() => this.$borderSize() ? (this.$height() ?? 0) - 2 * this.$borderSize() : (this.$height() ?? 0));
|
|
59
|
+
$baseStyle = computed(() => ({
|
|
60
|
+
'-webkit-text-size-adjust': 'none',
|
|
61
|
+
borderRadius: this.$borderRadius(),
|
|
62
|
+
display: 'inline-block',
|
|
63
|
+
fontSize: this.$fontSize(),
|
|
64
|
+
lineHeight: `${this.$lineHeight()}px`,
|
|
65
|
+
maxWidth: this.$width(),
|
|
66
|
+
textAlign: 'center',
|
|
67
|
+
textDecoration: 'none',
|
|
68
|
+
width: '100%',
|
|
69
|
+
}));
|
|
70
|
+
$borderStyles = computed(() => ({
|
|
71
|
+
border: `${this.$borderSize()}px solid ${this.$borderColor()}`,
|
|
72
|
+
msoBorderAlt: 'none',
|
|
73
|
+
}));
|
|
74
|
+
$propStyles = computed(() => ({
|
|
75
|
+
// border styles
|
|
76
|
+
...(this.$borderColor() ? this.$borderStyles() : {}),
|
|
77
|
+
// background styles
|
|
78
|
+
...(this.$backgroundColor() ? { backgroundColor: this.$backgroundColor() } : {}),
|
|
79
|
+
// text styles
|
|
80
|
+
...(this.$textColor() ? { color: this.$textColor() } : {}),
|
|
81
|
+
}));
|
|
82
|
+
$withBackgroundStyle = computed(() => ({
|
|
83
|
+
...this.$baseStyle(),
|
|
84
|
+
// background styles
|
|
85
|
+
...(this.$backgroundColor() ? { backgroundColor: this.$backgroundColor() } : {}),
|
|
86
|
+
// text styles
|
|
87
|
+
...(this.$textColor() ? { color: this.$textColor() } : {}),
|
|
88
|
+
...(this.$style() ?? {}),
|
|
89
|
+
...(this.$withBackground() ? {} : { msoHide: 'all' }),
|
|
90
|
+
}));
|
|
91
|
+
$withoutBackgroundStyle = computed(() => ({
|
|
92
|
+
...this.$baseStyle(),
|
|
93
|
+
// background styles
|
|
94
|
+
...this.$propStyles(),
|
|
95
|
+
...(this.$style() ?? {}),
|
|
96
|
+
...(this.$withBackground() ? {} : { msoHide: 'all' }),
|
|
97
|
+
}));
|
|
98
|
+
$noBgInnerHtml = computed(() => {
|
|
99
|
+
const href = this.$href();
|
|
100
|
+
const borderColor = this.$borderColor();
|
|
101
|
+
const borderSize = this.$borderSize();
|
|
102
|
+
const height = this.$height();
|
|
103
|
+
const width = this.$width();
|
|
104
|
+
const arcsize = this.$arcsize();
|
|
105
|
+
const backgroundColor = this.$backgroundColor();
|
|
106
|
+
const fontSize = this.$fontSize();
|
|
107
|
+
const textColor = this.$textColor();
|
|
108
|
+
const textContent = this.$textContent();
|
|
109
|
+
return `<!--[if mso]>
|
|
110
|
+
<v:roundrect href="${href}" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" style="${height !== undefined ? `height:${height}px` : ''};v-text-anchor:middle;${width !== undefined ? `height:${width}px` : ''};" arcsize="${arcsize}%" ${borderColor ? `strokecolor=${borderColor}` : ''} ${borderSize ? `strokeweight="${borderSize}px"` : `stroke="false"`} ${backgroundColor ? `fillcolor=${backgroundColor}` : `fill="false"`}>
|
|
111
|
+
<w:anchorlock/>
|
|
112
|
+
<center style="font-size:${fontSize}px;${textColor ? `color:${textColor};` : ''}">
|
|
113
|
+
${textContent}
|
|
114
|
+
</center></v:roundrect>
|
|
115
|
+
<![endif]-->`;
|
|
116
|
+
});
|
|
117
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: ButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
118
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.6", type: ButtonComponent, isStandalone: true, selector: "ng-email-button", inputs: { $style: { classPropertyName: "$style", publicName: "style", isSignal: true, isRequired: false, transformFunction: null }, $styleClass: { classPropertyName: "$styleClass", publicName: "styleClass", isSignal: true, isRequired: false, transformFunction: null }, $href: { classPropertyName: "$href", publicName: "href", isSignal: true, isRequired: false, transformFunction: null }, $textContent: { classPropertyName: "$textContent", publicName: "textContent", isSignal: true, isRequired: true, transformFunction: null }, $width: { classPropertyName: "$width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, $height: { classPropertyName: "$height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, $borderRadius: { classPropertyName: "$borderRadius", publicName: "borderRadius", isSignal: true, isRequired: false, transformFunction: null }, $textColor: { classPropertyName: "$textColor", publicName: "textColor", isSignal: true, isRequired: false, transformFunction: null }, $backgroundColor: { classPropertyName: "$backgroundColor", publicName: "backgroundColor", isSignal: true, isRequired: false, transformFunction: null }, $borderColor: { classPropertyName: "$borderColor", publicName: "borderColor", isSignal: true, isRequired: false, transformFunction: null }, $borderSize: { classPropertyName: "$borderSize", publicName: "borderSize", isSignal: true, isRequired: false, transformFunction: null }, $fontSize: { classPropertyName: "$fontSize", publicName: "fontSize", isSignal: true, isRequired: false, transformFunction: null }, $align: { classPropertyName: "$align", publicName: "align", isSignal: true, isRequired: false, transformFunction: null }, $withBackground: { classPropertyName: "$withBackground", publicName: "withBackground", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@let withBackground = $withBackground();\n@let align = $align();\n@let href = $href();\n@let height = $height();\n@let width = $width();\n@let borderRadius = $borderRadius();\n\n<ng-template #child><ng-content></ng-content></ng-template>\n\n<table\n [width]=\"'100%'\"\n [border]=\"0\"\n [cellPadding]=\"0\"\n [cellSpacing]=\"0\"\n style=\"border-collapse: collapse\"\n role=\"presentation\"\n>\n <tr>\n <td [align]=\"align\">\n @if (withBackground) {\n <table\n [align]=\"align\"\n [width]=\"width\"\n [border]=\"0\"\n [cellPadding]=\"0\"\n [cellSpacing]=\"0\"\n role=\"presentation\"\n [style]=\"{\n border: $borderSize() + 'px solid ' + ($borderColor() ?? 'inherit'),\n borderRadius,\n }\"\n >\n <tr>\n <td\n [attr.bgcolor]=\"$backgroundColor()\"\n [width]=\"width\"\n [height]=\"height\"\n [style]=\"{\n borderRadius,\n height,\n width,\n maxWidth: width,\n textAlign: 'center',\n }\"\n >\n <a\n [href]=\"href\"\n [class]=\"$styleClass()\"\n [style]=\"$withBackgroundStyle()\"\n >\n <ng-container [ngTemplateOutlet]=\"child\"></ng-container>\n </a>\n </td>\n </tr>\n </table>\n } @else {\n <noscript [attr.data-html]=\"$noBgInnerHtml()\"></noscript>\n <a\n [href]=\"href\"\n [class]=\"$styleClass()\"\n [style]=\"$withoutBackgroundStyle()\"\n >\n <ng-container [ngTemplateOutlet]=\"child\"></ng-container>\n </a>\n }\n </td>\n </tr>\n</table>\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
119
|
+
}
|
|
120
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: ButtonComponent, decorators: [{
|
|
121
|
+
type: Component,
|
|
122
|
+
args: [{ selector: 'ng-email-button', imports: [NgTemplateOutlet], changeDetection: ChangeDetectionStrategy.OnPush, template: "@let withBackground = $withBackground();\n@let align = $align();\n@let href = $href();\n@let height = $height();\n@let width = $width();\n@let borderRadius = $borderRadius();\n\n<ng-template #child><ng-content></ng-content></ng-template>\n\n<table\n [width]=\"'100%'\"\n [border]=\"0\"\n [cellPadding]=\"0\"\n [cellSpacing]=\"0\"\n style=\"border-collapse: collapse\"\n role=\"presentation\"\n>\n <tr>\n <td [align]=\"align\">\n @if (withBackground) {\n <table\n [align]=\"align\"\n [width]=\"width\"\n [border]=\"0\"\n [cellPadding]=\"0\"\n [cellSpacing]=\"0\"\n role=\"presentation\"\n [style]=\"{\n border: $borderSize() + 'px solid ' + ($borderColor() ?? 'inherit'),\n borderRadius,\n }\"\n >\n <tr>\n <td\n [attr.bgcolor]=\"$backgroundColor()\"\n [width]=\"width\"\n [height]=\"height\"\n [style]=\"{\n borderRadius,\n height,\n width,\n maxWidth: width,\n textAlign: 'center',\n }\"\n >\n <a\n [href]=\"href\"\n [class]=\"$styleClass()\"\n [style]=\"$withBackgroundStyle()\"\n >\n <ng-container [ngTemplateOutlet]=\"child\"></ng-container>\n </a>\n </td>\n </tr>\n </table>\n } @else {\n <noscript [attr.data-html]=\"$noBgInnerHtml()\"></noscript>\n <a\n [href]=\"href\"\n [class]=\"$styleClass()\"\n [style]=\"$withoutBackgroundStyle()\"\n >\n <ng-container [ngTemplateOutlet]=\"child\"></ng-container>\n </a>\n }\n </td>\n </tr>\n</table>\n" }]
|
|
123
|
+
}] });
|
|
124
|
+
|
|
125
|
+
class ColorSchemeComponent {
|
|
126
|
+
$mode = input('normal', { alias: 'mode' });
|
|
127
|
+
$style = computed(() => `<style>:root { color-scheme: ${this.$mode()}; supported-color-schemes: ${this.$mode()}; }</style>`);
|
|
128
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: ColorSchemeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
129
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.6", type: ColorSchemeComponent, isStandalone: true, selector: "ng-email-color-scheme", inputs: { $mode: { classPropertyName: "$mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@let mode = $mode();\n\n<meta\n name=\"color-scheme\"\n [content]=\"mode\"\n/>\n<meta\n name=\"supported-color-schemes\"\n [content]=\"mode\"\n/>\n\n<noscript [attr.data-html]=\"$style()\"></noscript>\n", changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
130
|
+
}
|
|
131
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: ColorSchemeComponent, decorators: [{
|
|
132
|
+
type: Component,
|
|
133
|
+
args: [{ selector: 'ng-email-color-scheme', changeDetection: ChangeDetectionStrategy.OnPush, template: "@let mode = $mode();\n\n<meta\n name=\"color-scheme\"\n [content]=\"mode\"\n/>\n<meta\n name=\"supported-color-schemes\"\n [content]=\"mode\"\n/>\n\n<noscript [attr.data-html]=\"$style()\"></noscript>\n" }]
|
|
134
|
+
}] });
|
|
135
|
+
|
|
136
|
+
class ColumnComponent {
|
|
137
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
138
|
+
$style = input(null, { alias: 'style' });
|
|
139
|
+
$styleClass = input(undefined, { alias: 'styleClass' });
|
|
140
|
+
$bgImage = input(undefined, { alias: 'bgImage' });
|
|
141
|
+
$bgColor = input(undefined, { alias: 'bgColor' });
|
|
142
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: ColumnComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
143
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.6", type: ColumnComponent, isStandalone: true, selector: "ng-email-column", inputs: { $style: { classPropertyName: "$style", publicName: "style", isSignal: true, isRequired: false, transformFunction: null }, $styleClass: { classPropertyName: "$styleClass", publicName: "styleClass", isSignal: true, isRequired: false, transformFunction: null }, $bgImage: { classPropertyName: "$bgImage", publicName: "bgImage", isSignal: true, isRequired: false, transformFunction: null }, $bgColor: { classPropertyName: "$bgColor", publicName: "bgColor", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<td\n [attr.background]=\"$bgImage()\"\n [attr.bgcolor]=\"$bgColor()\"\n [style]=\"$style()\"\n [class]=\"$styleClass()\"\n role=\"presentation\"\n>\n <ng-content />\n</td>\n", changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
144
|
+
}
|
|
145
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: ColumnComponent, decorators: [{
|
|
146
|
+
type: Component,
|
|
147
|
+
args: [{ selector: 'ng-email-column', changeDetection: ChangeDetectionStrategy.OnPush, imports: [], template: "<td\n [attr.background]=\"$bgImage()\"\n [attr.bgcolor]=\"$bgColor()\"\n [style]=\"$style()\"\n [class]=\"$styleClass()\"\n role=\"presentation\"\n>\n <ng-content />\n</td>\n" }]
|
|
148
|
+
}] });
|
|
149
|
+
|
|
150
|
+
class ConditionalComponent {
|
|
151
|
+
$expression = input(undefined, { alias: 'expression' });
|
|
152
|
+
$mso = input(undefined, { alias: 'mso' });
|
|
153
|
+
noMsoInnerHtmlPre = '<!--[if !mso]><!-->';
|
|
154
|
+
noMsoInnerHtmlPost = '<!--<![endif]-->';
|
|
155
|
+
$msoInnerHtmlPre = computed(() => `<!--[if ${this.$expression() ?? 'mso'}]>`);
|
|
156
|
+
msoInnerHtmlPost = '<![endif]-->';
|
|
157
|
+
constructor() {
|
|
158
|
+
effect(() => {
|
|
159
|
+
if (typeof this.$expression() === 'undefined' && typeof this.$mso() === 'undefined')
|
|
160
|
+
throw new RangeError('angular-email: Conditional expects the `expression` or `mso` prop to be defined');
|
|
161
|
+
if (typeof this.$expression() !== 'undefined' && typeof this.$mso() !== 'undefined')
|
|
162
|
+
throw new RangeError('angular-email: Conditional expects the `expression` or `mso` prop to be defined, not both');
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: ConditionalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
166
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.6", type: ConditionalComponent, isStandalone: true, selector: "ng-email-conditional", inputs: { $expression: { classPropertyName: "$expression", publicName: "expression", isSignal: true, isRequired: false, transformFunction: null }, $mso: { classPropertyName: "$mso", publicName: "mso", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@let mso = $mso();\n\n@if (!mso) {\n <noscript [attr.data-html]=\"noMsoInnerHtmlPre\"></noscript>\n <ng-container [ngTemplateOutlet]=\"content\"></ng-container>\n <noscript [attr.data-html]=\"noMsoInnerHtmlPost\"></noscript>\n} @else {\n <noscript [attr.data-html]=\"$msoInnerHtmlPre()\"></noscript>\n <ng-container [ngTemplateOutlet]=\"content\"></ng-container>\n <noscript [attr.data-html]=\"msoInnerHtmlPost\"></noscript>\n}\n<ng-template #content><ng-content></ng-content></ng-template>\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
167
|
+
}
|
|
168
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: ConditionalComponent, decorators: [{
|
|
169
|
+
type: Component,
|
|
170
|
+
args: [{ selector: 'ng-email-conditional', changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgTemplateOutlet], schemas: [CUSTOM_ELEMENTS_SCHEMA], template: "@let mso = $mso();\n\n@if (!mso) {\n <noscript [attr.data-html]=\"noMsoInnerHtmlPre\"></noscript>\n <ng-container [ngTemplateOutlet]=\"content\"></ng-container>\n <noscript [attr.data-html]=\"noMsoInnerHtmlPost\"></noscript>\n} @else {\n <noscript [attr.data-html]=\"$msoInnerHtmlPre()\"></noscript>\n <ng-container [ngTemplateOutlet]=\"content\"></ng-container>\n <noscript [attr.data-html]=\"msoInnerHtmlPost\"></noscript>\n}\n<ng-template #content><ng-content></ng-content></ng-template>\n" }]
|
|
171
|
+
}], ctorParameters: () => [] });
|
|
172
|
+
|
|
173
|
+
class ContainerComponent {
|
|
174
|
+
random = Math.random();
|
|
175
|
+
document = inject(DOCUMENT);
|
|
176
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
177
|
+
$style = input(null, { alias: 'style' });
|
|
178
|
+
$styleClass = input(undefined, { alias: 'styleClass' });
|
|
179
|
+
$alignment = input('center', { alias: 'alignment' });
|
|
180
|
+
$disableDefaultStyle = input(false, { alias: 'disableDefaultStyle' });
|
|
181
|
+
$containerWidth = input(600, { alias: 'containerWidth' });
|
|
182
|
+
$containerStyle = computed(() => ({
|
|
183
|
+
...(this.$disableDefaultStyle() ? {} : { maxWidth: `${this.$containerWidth()}px` }),
|
|
184
|
+
...this.$style(),
|
|
185
|
+
}));
|
|
186
|
+
$trStyle = computed(() => ({
|
|
187
|
+
...(this.$disableDefaultStyle() ? {} : { width: '100%' }),
|
|
188
|
+
}));
|
|
189
|
+
$innerHtmlPre = computed(() => `<!--[if mso]><table align="${this.$alignment()}" width="${this.$containerWidth()}" style="border-spacing: 0; width:${this.$containerWidth()}px;" role="presentation"><tr><td><![endif]-->`);
|
|
190
|
+
$innerHtmlPost = computed(() => `<!--[if mso]></td></tr></table><![endif]-->`);
|
|
191
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: ContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
192
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.6", type: ContainerComponent, isStandalone: true, selector: "ng-email-container", inputs: { $style: { classPropertyName: "$style", publicName: "style", isSignal: true, isRequired: false, transformFunction: null }, $styleClass: { classPropertyName: "$styleClass", publicName: "styleClass", isSignal: true, isRequired: false, transformFunction: null }, $alignment: { classPropertyName: "$alignment", publicName: "alignment", isSignal: true, isRequired: false, transformFunction: null }, $disableDefaultStyle: { classPropertyName: "$disableDefaultStyle", publicName: "disableDefaultStyle", isSignal: true, isRequired: false, transformFunction: null }, $containerWidth: { classPropertyName: "$containerWidth", publicName: "containerWidth", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@let containerWidth = $containerWidth();\n@let alignment = $alignment();\n\n<div [style]=\"{ tableLayout: 'fixed', width: '100%' }\">\n <div [style]=\"{ margin: '0 auto', maxWidth: containerWidth }\">\n <noscript [attr.data-html]=\"$innerHtmlPre()\"></noscript>\n <table\n [align]=\"alignment\"\n [width]=\"'100%'\"\n role=\"presentation\"\n [cellSpacing]=\"0\"\n [cellPadding]=\"0\"\n [border]=\"0\"\n [style]=\"$containerStyle()\"\n [class]=\"$styleClass()\"\n >\n <tbody>\n <tr [style]=\"$trStyle()\">\n <td [align]=\"alignment\">\n <ng-content></ng-content>\n </td>\n </tr>\n </tbody>\n </table>\n <noscript [attr.data-html]=\"$innerHtmlPost()\"></noscript>\n </div>\n</div>\n", changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
193
|
+
}
|
|
194
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: ContainerComponent, decorators: [{
|
|
195
|
+
type: Component,
|
|
196
|
+
args: [{ selector: 'ng-email-container', changeDetection: ChangeDetectionStrategy.OnPush, imports: [], template: "@let containerWidth = $containerWidth();\n@let alignment = $alignment();\n\n<div [style]=\"{ tableLayout: 'fixed', width: '100%' }\">\n <div [style]=\"{ margin: '0 auto', maxWidth: containerWidth }\">\n <noscript [attr.data-html]=\"$innerHtmlPre()\"></noscript>\n <table\n [align]=\"alignment\"\n [width]=\"'100%'\"\n role=\"presentation\"\n [cellSpacing]=\"0\"\n [cellPadding]=\"0\"\n [border]=\"0\"\n [style]=\"$containerStyle()\"\n [class]=\"$styleClass()\"\n >\n <tbody>\n <tr [style]=\"$trStyle()\">\n <td [align]=\"alignment\">\n <ng-content></ng-content>\n </td>\n </tr>\n </tbody>\n </table>\n <noscript [attr.data-html]=\"$innerHtmlPost()\"></noscript>\n </div>\n</div>\n" }]
|
|
197
|
+
}] });
|
|
198
|
+
|
|
199
|
+
class HeadComponent {
|
|
200
|
+
$enableFormatDetection = input(false, { alias: 'enableFormatDetection' });
|
|
201
|
+
xml = `\n<xml><o:OfficeDocumentSettings><o:AllowPNG /><o:PixelsPerInch>96</o:PixelsPerInch></o:OfficeDocumentSettings></xml>\n`;
|
|
202
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: HeadComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
203
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.6", type: HeadComponent, isStandalone: true, selector: "ng-email-head", inputs: { $enableFormatDetection: { classPropertyName: "$enableFormatDetection", publicName: "enableFormatDetection", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@let enableFormatDetection = $enableFormatDetection();\n\n<head>\n <meta\n http-equiv=\"content-type\"\n content=\"text/html; charset=UTF-8\"\n />\n <meta\n name=\"viewport\"\n content=\"width=device-width, initial-scale=1, user-scalable=yes\"\n />\n <meta name=\"x-apple-disable-message-reformatting\" />\n @if (!enableFormatDetection) {\n <meta\n name=\"format-detection\"\n content=\"telephone=no, date=no, address=no, email=no, url=no\"\n />\n }\n <ng-content></ng-content>\n <ng-email-conditional [mso]=\"true\">\n <noscript [attr.data-html]=\"xml\"></noscript>\n </ng-email-conditional>\n</head>\n", dependencies: [{ kind: "component", type: ConditionalComponent, selector: "ng-email-conditional", inputs: ["expression", "mso"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
204
|
+
}
|
|
205
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: HeadComponent, decorators: [{
|
|
206
|
+
type: Component,
|
|
207
|
+
args: [{ selector: 'ng-email-head', changeDetection: ChangeDetectionStrategy.OnPush, imports: [ConditionalComponent], schemas: [NO_ERRORS_SCHEMA], template: "@let enableFormatDetection = $enableFormatDetection();\n\n<head>\n <meta\n http-equiv=\"content-type\"\n content=\"text/html; charset=UTF-8\"\n />\n <meta\n name=\"viewport\"\n content=\"width=device-width, initial-scale=1, user-scalable=yes\"\n />\n <meta name=\"x-apple-disable-message-reformatting\" />\n @if (!enableFormatDetection) {\n <meta\n name=\"format-detection\"\n content=\"telephone=no, date=no, address=no, email=no, url=no\"\n />\n }\n <ng-content></ng-content>\n <ng-email-conditional [mso]=\"true\">\n <noscript [attr.data-html]=\"xml\"></noscript>\n </ng-email-conditional>\n</head>\n" }]
|
|
208
|
+
}] });
|
|
209
|
+
|
|
210
|
+
const copyTextToClipboard = async (text) => {
|
|
211
|
+
try {
|
|
212
|
+
await navigator.clipboard.writeText(text);
|
|
213
|
+
}
|
|
214
|
+
catch {
|
|
215
|
+
throw new Error('Not able to copy');
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
const pxToPt = (px) => (isNaN(Number(px)) ? null : (parseInt(px, 10) * 3) / 4);
|
|
219
|
+
const withMargin = (props) => [
|
|
220
|
+
withSpace(props.m, ['margin']),
|
|
221
|
+
withSpace(props.mx, ['marginLeft', 'marginRight']),
|
|
222
|
+
withSpace(props.my, ['marginTop', 'marginBottom']),
|
|
223
|
+
withSpace(props.mt, ['marginTop']),
|
|
224
|
+
withSpace(props.mr, ['marginRight']),
|
|
225
|
+
withSpace(props.mb, ['marginBottom']),
|
|
226
|
+
withSpace(props.ml, ['marginLeft']),
|
|
227
|
+
].filter((s) => Object.keys(s).length)[0];
|
|
228
|
+
const withSpace = (value, properties) => {
|
|
229
|
+
return properties.reduce((styles, property) => {
|
|
230
|
+
if (value) {
|
|
231
|
+
return { ...styles, [property]: `${value}px` };
|
|
232
|
+
}
|
|
233
|
+
return styles;
|
|
234
|
+
}, {});
|
|
235
|
+
};
|
|
236
|
+
// https://stackoverflow.com/a/61410824
|
|
237
|
+
const styleToString = (style) => {
|
|
238
|
+
if (!style)
|
|
239
|
+
return '';
|
|
240
|
+
return Object.keys(style).reduce((acc, key) => acc +
|
|
241
|
+
key
|
|
242
|
+
.split(/(?=[A-Z])/)
|
|
243
|
+
.join('-')
|
|
244
|
+
.toLowerCase() +
|
|
245
|
+
':' +
|
|
246
|
+
style[key] +
|
|
247
|
+
';', '');
|
|
248
|
+
};
|
|
249
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
250
|
+
const classToString = (style) => {
|
|
251
|
+
if (!style)
|
|
252
|
+
return '';
|
|
253
|
+
if (typeof style === 'string')
|
|
254
|
+
return style;
|
|
255
|
+
if (Array.isArray(style))
|
|
256
|
+
return style.join(' ');
|
|
257
|
+
return Object.keys(style).reduce((acc, key) => acc +
|
|
258
|
+
key
|
|
259
|
+
.split(/(?=[A-Z])/)
|
|
260
|
+
.join('-')
|
|
261
|
+
.toLowerCase() +
|
|
262
|
+
':' +
|
|
263
|
+
style[key] +
|
|
264
|
+
';', '');
|
|
265
|
+
};
|
|
266
|
+
const unreachable = (condition, message = `Entered unreachable code. Received '${condition}'.`) => {
|
|
267
|
+
throw new TypeError(message);
|
|
268
|
+
};
|
|
269
|
+
const HTMLElements = [
|
|
270
|
+
'!DOCTYPE',
|
|
271
|
+
'a',
|
|
272
|
+
'abbr',
|
|
273
|
+
'abbr',
|
|
274
|
+
//"acronym", // NOT HTML5
|
|
275
|
+
'address',
|
|
276
|
+
//"applet", // NOT HTML5 (NOT MAJORLY SUPPORTED)
|
|
277
|
+
'area',
|
|
278
|
+
'article',
|
|
279
|
+
'aside',
|
|
280
|
+
'audio',
|
|
281
|
+
'b',
|
|
282
|
+
'base',
|
|
283
|
+
//"basefont", // NOT HTML5
|
|
284
|
+
'bdi',
|
|
285
|
+
'bdo',
|
|
286
|
+
//"big", // NOT HTML5
|
|
287
|
+
'blockquote',
|
|
288
|
+
'body',
|
|
289
|
+
'br',
|
|
290
|
+
'button',
|
|
291
|
+
'canvas',
|
|
292
|
+
'caption',
|
|
293
|
+
//"center", // NOT HTML5
|
|
294
|
+
'cite',
|
|
295
|
+
'code',
|
|
296
|
+
'col',
|
|
297
|
+
'colgroup',
|
|
298
|
+
'data',
|
|
299
|
+
'datalist',
|
|
300
|
+
'dd',
|
|
301
|
+
'del',
|
|
302
|
+
'details',
|
|
303
|
+
'dfn',
|
|
304
|
+
'dialog',
|
|
305
|
+
//"dir", NOT HTML5 (use "ul" instead)
|
|
306
|
+
'div',
|
|
307
|
+
'dl',
|
|
308
|
+
'dt',
|
|
309
|
+
'em',
|
|
310
|
+
'embed',
|
|
311
|
+
'fieldset',
|
|
312
|
+
'figcaption',
|
|
313
|
+
'figure',
|
|
314
|
+
//"font", // NOT HTML5 (use CSS)
|
|
315
|
+
'footer',
|
|
316
|
+
'form',
|
|
317
|
+
//"frame", // NOT HTML5
|
|
318
|
+
//"frameset", // NOT HTML5
|
|
319
|
+
'h1',
|
|
320
|
+
'h2',
|
|
321
|
+
'h3',
|
|
322
|
+
'h4',
|
|
323
|
+
'h5',
|
|
324
|
+
'h6',
|
|
325
|
+
'head',
|
|
326
|
+
'header',
|
|
327
|
+
'hr',
|
|
328
|
+
'html',
|
|
329
|
+
'i',
|
|
330
|
+
'iframe',
|
|
331
|
+
'img',
|
|
332
|
+
'input',
|
|
333
|
+
'ins',
|
|
334
|
+
'kbd',
|
|
335
|
+
'label',
|
|
336
|
+
'legend',
|
|
337
|
+
'li',
|
|
338
|
+
'link',
|
|
339
|
+
'main',
|
|
340
|
+
'map',
|
|
341
|
+
'mark',
|
|
342
|
+
'meta',
|
|
343
|
+
'meter',
|
|
344
|
+
'nav',
|
|
345
|
+
//"noframes", // NOT HTML5
|
|
346
|
+
'noscript',
|
|
347
|
+
'object',
|
|
348
|
+
'ol',
|
|
349
|
+
'optgroup',
|
|
350
|
+
'option',
|
|
351
|
+
'output',
|
|
352
|
+
'p',
|
|
353
|
+
'param',
|
|
354
|
+
'picture',
|
|
355
|
+
'pre',
|
|
356
|
+
'progress',
|
|
357
|
+
'q',
|
|
358
|
+
'rp',
|
|
359
|
+
'rt',
|
|
360
|
+
'ruby',
|
|
361
|
+
's',
|
|
362
|
+
'samp',
|
|
363
|
+
'script',
|
|
364
|
+
'section',
|
|
365
|
+
'select',
|
|
366
|
+
'small',
|
|
367
|
+
'source',
|
|
368
|
+
'span',
|
|
369
|
+
//"strike", NOT HTML5 (Use <del> or <s> instead)
|
|
370
|
+
'strong',
|
|
371
|
+
'style',
|
|
372
|
+
'sub',
|
|
373
|
+
'summary',
|
|
374
|
+
'sup',
|
|
375
|
+
'svg',
|
|
376
|
+
'table',
|
|
377
|
+
'tbody',
|
|
378
|
+
'td',
|
|
379
|
+
'template',
|
|
380
|
+
'textarea',
|
|
381
|
+
'tfoot',
|
|
382
|
+
'th',
|
|
383
|
+
'thead',
|
|
384
|
+
'time',
|
|
385
|
+
'title',
|
|
386
|
+
'tr',
|
|
387
|
+
'track',
|
|
388
|
+
//"tt", // NOT HTML5 (Use CSS)
|
|
389
|
+
'u',
|
|
390
|
+
'ul',
|
|
391
|
+
'var',
|
|
392
|
+
'video',
|
|
393
|
+
'wbr',
|
|
394
|
+
// xml
|
|
395
|
+
'xml',
|
|
396
|
+
'o:OfficeDocumentSettings',
|
|
397
|
+
'o:AllowPNG',
|
|
398
|
+
'o:PixelsPerInch',
|
|
399
|
+
'angular-email-raw',
|
|
400
|
+
];
|
|
401
|
+
const START_TAG = '__COMMENT_START';
|
|
402
|
+
const END_TAG = '__COMMENT_END';
|
|
403
|
+
function escapeForRawComponent(input) {
|
|
404
|
+
// escape comment sequences
|
|
405
|
+
return input.replace(/<!--/g, START_TAG).replace(/-->/g, END_TAG);
|
|
406
|
+
}
|
|
407
|
+
function unescapeForRawComponent(input) {
|
|
408
|
+
return input.replace(new RegExp(START_TAG, 'g'), '<!--').replace(new RegExp(END_TAG, 'g'), '-->');
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
class HeadingComponent {
|
|
412
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
413
|
+
$style = input(null, { alias: 'style' });
|
|
414
|
+
$styleClass = input(undefined, { alias: 'styleClass' });
|
|
415
|
+
$as = input('h1', { alias: 'as' });
|
|
416
|
+
$m = input(undefined, { alias: 'm' });
|
|
417
|
+
$mx = input(undefined, { alias: 'mx' });
|
|
418
|
+
$my = input(undefined, { alias: 'my' });
|
|
419
|
+
$mt = input(undefined, { alias: 'mt' });
|
|
420
|
+
$mr = input(undefined, { alias: 'mr' });
|
|
421
|
+
$mb = input(undefined, { alias: 'mb' });
|
|
422
|
+
$ml = input(undefined, { alias: 'ml' });
|
|
423
|
+
$headingStyle = computed(() => {
|
|
424
|
+
return styleToString({
|
|
425
|
+
...withMargin({
|
|
426
|
+
m: this.$m(),
|
|
427
|
+
mx: this.$mx(),
|
|
428
|
+
my: this.$my(),
|
|
429
|
+
mt: this.$mt(),
|
|
430
|
+
mr: this.$mr(),
|
|
431
|
+
mb: this.$mb(),
|
|
432
|
+
ml: this.$ml(),
|
|
433
|
+
}),
|
|
434
|
+
...(this.$style() ?? {}),
|
|
435
|
+
});
|
|
436
|
+
});
|
|
437
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: HeadingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
438
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.6", type: HeadingComponent, isStandalone: true, selector: "ng-email-heading", inputs: { $style: { classPropertyName: "$style", publicName: "style", isSignal: true, isRequired: false, transformFunction: null }, $styleClass: { classPropertyName: "$styleClass", publicName: "styleClass", isSignal: true, isRequired: false, transformFunction: null }, $as: { classPropertyName: "$as", publicName: "as", isSignal: true, isRequired: false, transformFunction: null }, $m: { classPropertyName: "$m", publicName: "m", isSignal: true, isRequired: false, transformFunction: null }, $mx: { classPropertyName: "$mx", publicName: "mx", isSignal: true, isRequired: false, transformFunction: null }, $my: { classPropertyName: "$my", publicName: "my", isSignal: true, isRequired: false, transformFunction: null }, $mt: { classPropertyName: "$mt", publicName: "mt", isSignal: true, isRequired: false, transformFunction: null }, $mr: { classPropertyName: "$mr", publicName: "mr", isSignal: true, isRequired: false, transformFunction: null }, $mb: { classPropertyName: "$mb", publicName: "mb", isSignal: true, isRequired: false, transformFunction: null }, $ml: { classPropertyName: "$ml", publicName: "ml", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@let heading = $as();\n@let style = $headingStyle();\n@let styleClass = $styleClass();\n@if (heading === 'h1') {\n <h1\n [style]=\"style\"\n [class]=\"styleClass\"\n >\n <ng-container [ngTemplateOutlet]=\"content\"></ng-container>\n </h1>\n} @else if (heading === 'h2') {\n <h2\n [style]=\"style\"\n [class]=\"styleClass\"\n >\n <ng-container [ngTemplateOutlet]=\"content\"></ng-container>\n </h2>\n} @else if (heading === 'h3') {\n <h3\n [style]=\"style\"\n [class]=\"styleClass\"\n >\n <ng-container [ngTemplateOutlet]=\"content\"></ng-container>\n </h3>\n} @else if (heading === 'h4') {\n <h4\n [style]=\"style\"\n [class]=\"styleClass\"\n >\n <ng-container [ngTemplateOutlet]=\"content\"></ng-container>\n </h4>\n} @else if (heading === 'h5') {\n <h5\n [style]=\"style\"\n [class]=\"styleClass\"\n >\n <ng-container [ngTemplateOutlet]=\"content\"></ng-container>\n </h5>\n} @else if (heading === 'h6') {\n <h6\n [style]=\"style\"\n [class]=\"styleClass\"\n >\n <ng-container [ngTemplateOutlet]=\"content\"></ng-container>\n </h6>\n} @else {\n <ng-container [ngTemplateOutlet]=\"content\"></ng-container>\n}\n<ng-template #content><ng-content></ng-content></ng-template>\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
439
|
+
}
|
|
440
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: HeadingComponent, decorators: [{
|
|
441
|
+
type: Component,
|
|
442
|
+
args: [{ selector: 'ng-email-heading', imports: [NgTemplateOutlet], changeDetection: ChangeDetectionStrategy.OnPush, template: "@let heading = $as();\n@let style = $headingStyle();\n@let styleClass = $styleClass();\n@if (heading === 'h1') {\n <h1\n [style]=\"style\"\n [class]=\"styleClass\"\n >\n <ng-container [ngTemplateOutlet]=\"content\"></ng-container>\n </h1>\n} @else if (heading === 'h2') {\n <h2\n [style]=\"style\"\n [class]=\"styleClass\"\n >\n <ng-container [ngTemplateOutlet]=\"content\"></ng-container>\n </h2>\n} @else if (heading === 'h3') {\n <h3\n [style]=\"style\"\n [class]=\"styleClass\"\n >\n <ng-container [ngTemplateOutlet]=\"content\"></ng-container>\n </h3>\n} @else if (heading === 'h4') {\n <h4\n [style]=\"style\"\n [class]=\"styleClass\"\n >\n <ng-container [ngTemplateOutlet]=\"content\"></ng-container>\n </h4>\n} @else if (heading === 'h5') {\n <h5\n [style]=\"style\"\n [class]=\"styleClass\"\n >\n <ng-container [ngTemplateOutlet]=\"content\"></ng-container>\n </h5>\n} @else if (heading === 'h6') {\n <h6\n [style]=\"style\"\n [class]=\"styleClass\"\n >\n <ng-container [ngTemplateOutlet]=\"content\"></ng-container>\n </h6>\n} @else {\n <ng-container [ngTemplateOutlet]=\"content\"></ng-container>\n}\n<ng-template #content><ng-content></ng-content></ng-template>\n" }]
|
|
443
|
+
}] });
|
|
444
|
+
|
|
445
|
+
class HrComponent {
|
|
446
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
447
|
+
$style = input(null, { alias: 'style' });
|
|
448
|
+
$styleClass = input(undefined, { alias: 'styleClass' });
|
|
449
|
+
$disableDefaultStyle = input(false, { alias: 'disableDefaultStyle' });
|
|
450
|
+
$hrStyle = computed(() => {
|
|
451
|
+
return {
|
|
452
|
+
...(this.$disableDefaultStyle()
|
|
453
|
+
? {}
|
|
454
|
+
: {
|
|
455
|
+
width: '100%',
|
|
456
|
+
border: 'none',
|
|
457
|
+
borderTop: '1px solid #eaeaea',
|
|
458
|
+
}),
|
|
459
|
+
...(this.$style() ?? {}),
|
|
460
|
+
};
|
|
461
|
+
});
|
|
462
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: HrComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
463
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.6", type: HrComponent, isStandalone: true, selector: "ng-email-hr", inputs: { $style: { classPropertyName: "$style", publicName: "style", isSignal: true, isRequired: false, transformFunction: null }, $styleClass: { classPropertyName: "$styleClass", publicName: "styleClass", isSignal: true, isRequired: false, transformFunction: null }, $disableDefaultStyle: { classPropertyName: "$disableDefaultStyle", publicName: "disableDefaultStyle", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<hr\n [style]=\"$hrStyle()\"\n [class]=\"$styleClass()\"\n/>\n", changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
464
|
+
}
|
|
465
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: HrComponent, decorators: [{
|
|
466
|
+
type: Component,
|
|
467
|
+
args: [{ selector: 'ng-email-hr', imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: "<hr\n [style]=\"$hrStyle()\"\n [class]=\"$styleClass()\"\n/>\n" }]
|
|
468
|
+
}] });
|
|
469
|
+
|
|
470
|
+
class HtmlComponent {
|
|
471
|
+
$lang = input('en', { alias: 'lang' });
|
|
472
|
+
$dir = input('ltr', { alias: 'dir' });
|
|
473
|
+
$enableVML = input(true, { alias: 'enableVML' });
|
|
474
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
475
|
+
$style = input(null, { alias: 'style' });
|
|
476
|
+
$styleClass = input(undefined, { alias: 'styleClass' });
|
|
477
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: HtmlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
478
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.6", type: HtmlComponent, isStandalone: true, selector: "ng-email-html", inputs: { $lang: { classPropertyName: "$lang", publicName: "lang", isSignal: true, isRequired: false, transformFunction: null }, $dir: { classPropertyName: "$dir", publicName: "dir", isSignal: true, isRequired: false, transformFunction: null }, $enableVML: { classPropertyName: "$enableVML", publicName: "enableVML", isSignal: true, isRequired: false, transformFunction: null }, $style: { classPropertyName: "$style", publicName: "style", isSignal: true, isRequired: false, transformFunction: null }, $styleClass: { classPropertyName: "$styleClass", publicName: "styleClass", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@let enableVML = $enableVML();\n@let lang = $lang();\n@let dir = $dir();\n\n<html\n id=\"__angular-email\"\n [lang]=\"lang\"\n [dir]=\"dir\"\n [attr.xmlns:o]=\"enableVML ? 'urn:schemas-microsoft-com:office:office' : undefined\"\n [attr.xmlns:v]=\"enableVML ? 'urn:schemas-microsoft-com:vml' : undefined\"\n [style]=\"$style()\"\n [class]=\"$styleClass()\"\n>\n <ng-content />\n</html>\n", changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
479
|
+
}
|
|
480
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: HtmlComponent, decorators: [{
|
|
481
|
+
type: Component,
|
|
482
|
+
args: [{ selector: 'ng-email-html', changeDetection: ChangeDetectionStrategy.OnPush, template: "@let enableVML = $enableVML();\n@let lang = $lang();\n@let dir = $dir();\n\n<html\n id=\"__angular-email\"\n [lang]=\"lang\"\n [dir]=\"dir\"\n [attr.xmlns:o]=\"enableVML ? 'urn:schemas-microsoft-com:office:office' : undefined\"\n [attr.xmlns:v]=\"enableVML ? 'urn:schemas-microsoft-com:vml' : undefined\"\n [style]=\"$style()\"\n [class]=\"$styleClass()\"\n>\n <ng-content />\n</html>\n" }]
|
|
483
|
+
}] });
|
|
484
|
+
|
|
485
|
+
class ImgComponent {
|
|
486
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
487
|
+
$style = input(null, { alias: 'style' });
|
|
488
|
+
$styleClass = input(undefined, { alias: 'styleClass' });
|
|
489
|
+
$disableDefaultStyle = input(false, { alias: 'disableDefaultStyle' });
|
|
490
|
+
$alt = input('', { alias: 'alt' });
|
|
491
|
+
$src = input('', { alias: 'src' });
|
|
492
|
+
$width = input('0', { alias: 'width' });
|
|
493
|
+
$height = input('0', { alias: 'height' });
|
|
494
|
+
$imageStyle = computed(() => {
|
|
495
|
+
return {
|
|
496
|
+
...(this.$disableDefaultStyle()
|
|
497
|
+
? {}
|
|
498
|
+
: {
|
|
499
|
+
display: 'block',
|
|
500
|
+
outline: 'none',
|
|
501
|
+
border: 'none',
|
|
502
|
+
textDecoration: 'none',
|
|
503
|
+
}),
|
|
504
|
+
...(this.$style() ?? {}),
|
|
505
|
+
};
|
|
506
|
+
});
|
|
507
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: ImgComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
508
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.6", type: ImgComponent, isStandalone: true, selector: "ng-email-img", inputs: { $style: { classPropertyName: "$style", publicName: "style", isSignal: true, isRequired: false, transformFunction: null }, $styleClass: { classPropertyName: "$styleClass", publicName: "styleClass", isSignal: true, isRequired: false, transformFunction: null }, $disableDefaultStyle: { classPropertyName: "$disableDefaultStyle", publicName: "disableDefaultStyle", isSignal: true, isRequired: false, transformFunction: null }, $alt: { classPropertyName: "$alt", publicName: "alt", isSignal: true, isRequired: false, transformFunction: null }, $src: { classPropertyName: "$src", publicName: "src", isSignal: true, isRequired: false, transformFunction: null }, $width: { classPropertyName: "$width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, $height: { classPropertyName: "$height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<img\n [style]=\"$imageStyle()\"\n [class]=\"$styleClass()\"\n [alt]=\"$alt()\"\n [src]=\"$src()\"\n [width]=\"$width()\"\n [height]=\"$height()\"\n/>\n", changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
509
|
+
}
|
|
510
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: ImgComponent, decorators: [{
|
|
511
|
+
type: Component,
|
|
512
|
+
args: [{ selector: 'ng-email-img', imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: "<img\n [style]=\"$imageStyle()\"\n [class]=\"$styleClass()\"\n [alt]=\"$alt()\"\n [src]=\"$src()\"\n [width]=\"$width()\"\n [height]=\"$height()\"\n/>\n" }]
|
|
513
|
+
}] });
|
|
514
|
+
|
|
515
|
+
class LinkComponent {
|
|
516
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
517
|
+
$style = input(null, { alias: 'style' });
|
|
518
|
+
$styleClass = input(undefined, { alias: 'styleClass' });
|
|
519
|
+
$disableDefaultStyle = input(false, { alias: 'disableDefaultStyle' });
|
|
520
|
+
$href = input('', { alias: 'href' });
|
|
521
|
+
$target = input('_blank', { alias: 'target' });
|
|
522
|
+
$linkStyle = computed(() => {
|
|
523
|
+
return {
|
|
524
|
+
...(this.$disableDefaultStyle()
|
|
525
|
+
? {}
|
|
526
|
+
: {
|
|
527
|
+
color: '#067df7',
|
|
528
|
+
textDecoration: 'none',
|
|
529
|
+
}),
|
|
530
|
+
...(this.$style() ?? {}),
|
|
531
|
+
};
|
|
532
|
+
});
|
|
533
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: LinkComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
534
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.6", type: LinkComponent, isStandalone: true, selector: "ng-email-link", inputs: { $style: { classPropertyName: "$style", publicName: "style", isSignal: true, isRequired: false, transformFunction: null }, $styleClass: { classPropertyName: "$styleClass", publicName: "styleClass", isSignal: true, isRequired: false, transformFunction: null }, $disableDefaultStyle: { classPropertyName: "$disableDefaultStyle", publicName: "disableDefaultStyle", isSignal: true, isRequired: false, transformFunction: null }, $href: { classPropertyName: "$href", publicName: "href", isSignal: true, isRequired: false, transformFunction: null }, $target: { classPropertyName: "$target", publicName: "target", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<a\n [style]=\"$linkStyle()\"\n [class]=\"$styleClass()\"\n [href]=\"$href()\"\n [target]=\"$target()\"\n ><ng-content></ng-content\n></a>\n", changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
535
|
+
}
|
|
536
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: LinkComponent, decorators: [{
|
|
537
|
+
type: Component,
|
|
538
|
+
args: [{ selector: 'ng-email-link', imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: "<a\n [style]=\"$linkStyle()\"\n [class]=\"$styleClass()\"\n [href]=\"$href()\"\n [target]=\"$target()\"\n ><ng-content></ng-content\n></a>\n" }]
|
|
539
|
+
}] });
|
|
540
|
+
|
|
541
|
+
class RawComponent {
|
|
542
|
+
$disablePlainTextOutput = input(false, { alias: 'disablePlainTextOutput' });
|
|
543
|
+
$content = input('', { alias: 'content' });
|
|
544
|
+
$escapingContent = computed(() => `<!--${escapeForRawComponent(this.$content())}-->`);
|
|
545
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: RawComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
546
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.6", type: RawComponent, isStandalone: true, selector: "ng-email-raw", inputs: { $disablePlainTextOutput: { classPropertyName: "$disablePlainTextOutput", publicName: "disablePlainTextOutput", isSignal: true, isRequired: false, transformFunction: null }, $content: { classPropertyName: "$content", publicName: "content", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<angular-email-raw [attr.data-skip]=\"$disablePlainTextOutput()\">\n <noscript [attr.data-html]=\"$escapingContent()\"></noscript>\n</angular-email-raw>\n", changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
547
|
+
}
|
|
548
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: RawComponent, decorators: [{
|
|
549
|
+
type: Component,
|
|
550
|
+
args: [{ selector: 'ng-email-raw', changeDetection: ChangeDetectionStrategy.OnPush, schemas: [CUSTOM_ELEMENTS_SCHEMA], template: "<angular-email-raw [attr.data-skip]=\"$disablePlainTextOutput()\">\n <noscript [attr.data-html]=\"$escapingContent()\"></noscript>\n</angular-email-raw>\n" }]
|
|
551
|
+
}] });
|
|
552
|
+
|
|
553
|
+
class PreviewComponent {
|
|
554
|
+
$preview = input('', { alias: 'preview' });
|
|
555
|
+
maxLength = 150;
|
|
556
|
+
$text = computed(() => {
|
|
557
|
+
const preview = this.$preview();
|
|
558
|
+
if (preview.length >= this.maxLength)
|
|
559
|
+
return null;
|
|
560
|
+
const whiteSpaceCodes = ' ‌​‍‎‏';
|
|
561
|
+
return whiteSpaceCodes.repeat(this.maxLength - preview.length);
|
|
562
|
+
});
|
|
563
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: PreviewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
564
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.6", type: PreviewComponent, isStandalone: true, selector: "ng-email-preview", inputs: { $preview: { classPropertyName: "$preview", publicName: "preview", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@let text = $text();\n\n<div\n id=\"__angular-email-preview\"\n style=\"display: none; overflow: hidden; line-height: 1px; opacity: 0; max-height: 0; max-width: 0\"\n>\n {{ $preview() }}\n @if (text) {\n <ng-email-raw\n [content]=\"text\"\n [disablePlainTextOutput]=\"false\"\n ></ng-email-raw>\n }\n</div>\n", dependencies: [{ kind: "component", type: RawComponent, selector: "ng-email-raw", inputs: ["disablePlainTextOutput", "content"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
565
|
+
}
|
|
566
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: PreviewComponent, decorators: [{
|
|
567
|
+
type: Component,
|
|
568
|
+
args: [{ selector: 'ng-email-preview', changeDetection: ChangeDetectionStrategy.OnPush, imports: [RawComponent], template: "@let text = $text();\n\n<div\n id=\"__angular-email-preview\"\n style=\"display: none; overflow: hidden; line-height: 1px; opacity: 0; max-height: 0; max-width: 0\"\n>\n {{ $preview() }}\n @if (text) {\n <ng-email-raw\n [content]=\"text\"\n [disablePlainTextOutput]=\"false\"\n ></ng-email-raw>\n }\n</div>\n" }]
|
|
569
|
+
}] });
|
|
570
|
+
|
|
571
|
+
class SectionComponent {
|
|
572
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
573
|
+
$style = input(null, { alias: 'style' });
|
|
574
|
+
$styleClass = input(undefined, { alias: 'styleClass' });
|
|
575
|
+
$sectionStyle = computed(() => {
|
|
576
|
+
return styleToString({
|
|
577
|
+
width: '100%',
|
|
578
|
+
...(this.$style() ?? {}),
|
|
579
|
+
});
|
|
580
|
+
});
|
|
581
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: SectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
582
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.6", type: SectionComponent, isStandalone: true, selector: "ng-email-section", inputs: { $style: { classPropertyName: "$style", publicName: "style", isSignal: true, isRequired: false, transformFunction: null }, $styleClass: { classPropertyName: "$styleClass", publicName: "styleClass", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<table\n [align]=\"'center'\"\n [border]=\"0\"\n [cellPadding]=\"0\"\n [cellSpacing]=\"0\"\n width=\"100%\"\n role=\"presentation\"\n [style]=\"$sectionStyle()\"\n [class]=\"$styleClass()\"\n>\n <tbody>\n <tr>\n <td>\n <ng-content />\n </td>\n </tr>\n </tbody>\n</table>\n", changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
583
|
+
}
|
|
584
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: SectionComponent, decorators: [{
|
|
585
|
+
type: Component,
|
|
586
|
+
args: [{ selector: 'ng-email-section', changeDetection: ChangeDetectionStrategy.OnPush, imports: [], template: "<table\n [align]=\"'center'\"\n [border]=\"0\"\n [cellPadding]=\"0\"\n [cellSpacing]=\"0\"\n width=\"100%\"\n role=\"presentation\"\n [style]=\"$sectionStyle()\"\n [class]=\"$styleClass()\"\n>\n <tbody>\n <tr>\n <td>\n <ng-content />\n </td>\n </tr>\n </tbody>\n</table>\n" }]
|
|
587
|
+
}] });
|
|
588
|
+
|
|
589
|
+
class TextComponent {
|
|
590
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
591
|
+
$style = input(null, { alias: 'style' });
|
|
592
|
+
$styleClass = input(undefined, { alias: 'styleClass' });
|
|
593
|
+
$disableDefaultStyle = input(false, { alias: 'disableDefaultStyle' });
|
|
594
|
+
$textStyle = computed(() => {
|
|
595
|
+
return {
|
|
596
|
+
...(this.$disableDefaultStyle()
|
|
597
|
+
? {}
|
|
598
|
+
: {
|
|
599
|
+
fontSize: '14px',
|
|
600
|
+
lineHeight: '24px',
|
|
601
|
+
margin: '16px 0',
|
|
602
|
+
}),
|
|
603
|
+
...(this.$style() ?? {}),
|
|
604
|
+
};
|
|
605
|
+
});
|
|
606
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: TextComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
607
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.6", type: TextComponent, isStandalone: true, selector: "ng-email-text", inputs: { $style: { classPropertyName: "$style", publicName: "style", isSignal: true, isRequired: false, transformFunction: null }, $styleClass: { classPropertyName: "$styleClass", publicName: "styleClass", isSignal: true, isRequired: false, transformFunction: null }, $disableDefaultStyle: { classPropertyName: "$disableDefaultStyle", publicName: "disableDefaultStyle", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<p\n [style]=\"$textStyle()\"\n [class]=\"$styleClass()\"\n>\n <ng-content></ng-content>\n</p>\n", changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
608
|
+
}
|
|
609
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: TextComponent, decorators: [{
|
|
610
|
+
type: Component,
|
|
611
|
+
args: [{ selector: 'ng-email-text', imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: "<p\n [style]=\"$textStyle()\"\n [class]=\"$styleClass()\"\n>\n <ng-content></ng-content>\n</p>\n" }]
|
|
612
|
+
}] });
|
|
613
|
+
|
|
614
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
615
|
+
/**
|
|
616
|
+
* Renders an Angular component to HTML and applies transformations.
|
|
617
|
+
*
|
|
618
|
+
* @param component - The Angular component to render.
|
|
619
|
+
* @param selector - The Component selector.
|
|
620
|
+
* @param options - Optional rendering options.
|
|
621
|
+
*
|
|
622
|
+
* @returns {Promise<string>} The rendered HTML or plain text.
|
|
623
|
+
*/
|
|
624
|
+
const render = async ({ component, selector, props, options }) => {
|
|
625
|
+
const { styles, html: normalizedHtml } = await renderNgComponent(component, selector, props, options?.signalInputsPrefix);
|
|
626
|
+
const html = applyHtmlTransformations(normalizedHtml, styles);
|
|
627
|
+
if (options?.plainText) {
|
|
628
|
+
return renderAsPlainText(html);
|
|
629
|
+
}
|
|
630
|
+
const doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
|
|
631
|
+
const tailwindConfig = options?.tailwindConfig;
|
|
632
|
+
const markup = await inlineCss(html, !!options?.pretty, tailwindConfig);
|
|
633
|
+
const document = `${doctype}${markup}`;
|
|
634
|
+
return document;
|
|
635
|
+
};
|
|
636
|
+
/**
|
|
637
|
+
* Converts the given markup string to plain text while skipping certain elements.
|
|
638
|
+
*
|
|
639
|
+
* @param markup - The HTML markup string to be converted to plain text.
|
|
640
|
+
* @returns The plain text representation of the given markup.
|
|
641
|
+
*
|
|
642
|
+
* The conversion skips the following elements:
|
|
643
|
+
* - `<img>` tags
|
|
644
|
+
* - Elements with the ID `__angular-email-preview`
|
|
645
|
+
*/
|
|
646
|
+
const renderAsPlainText = (markup) => {
|
|
647
|
+
return convert(markup, {
|
|
648
|
+
decodeEntities: true,
|
|
649
|
+
formatters: {
|
|
650
|
+
raw: (elem, _walk, builder) => {
|
|
651
|
+
if (elem.children.length && elem.children[0].type === 'comment') {
|
|
652
|
+
builder.addInline(unescapeForRawComponent(elem.children[0].data.trim()));
|
|
653
|
+
}
|
|
654
|
+
},
|
|
655
|
+
},
|
|
656
|
+
selectors: [
|
|
657
|
+
{ selector: '[data-skip="true"]', format: 'skip' },
|
|
658
|
+
{ selector: 'img', format: 'skip' },
|
|
659
|
+
{ selector: '#__angular-email-preview', format: 'skip' },
|
|
660
|
+
{
|
|
661
|
+
format: 'raw',
|
|
662
|
+
options: {},
|
|
663
|
+
selector: 'angular-email-raw',
|
|
664
|
+
},
|
|
665
|
+
],
|
|
666
|
+
});
|
|
667
|
+
};
|
|
668
|
+
/**
|
|
669
|
+
* Renders an Angular component to html.
|
|
670
|
+
*
|
|
671
|
+
* @param component - The Angular component to render.
|
|
672
|
+
* @param selector - The CSS selector for the component.
|
|
673
|
+
* @returns A promise that resolves to the rendered HTML string.
|
|
674
|
+
*/
|
|
675
|
+
const renderNgComponent = async (component, selector, props, signalInputsPrefix) => {
|
|
676
|
+
const bootstrap = async () => {
|
|
677
|
+
const appRef = await bootstrapApplication(component, {
|
|
678
|
+
providers: [provideExperimentalZonelessChangeDetection(), provideServerRendering()],
|
|
679
|
+
});
|
|
680
|
+
appRef.components.forEach((componentRef) => {
|
|
681
|
+
Object.entries(props ?? {}).forEach(([key, value]) => {
|
|
682
|
+
if (key in componentRef.instance || `${signalInputsPrefix ?? ''}${key}` in componentRef.instance) {
|
|
683
|
+
componentRef.setInput(key, value);
|
|
684
|
+
}
|
|
685
|
+
});
|
|
686
|
+
componentRef.changeDetectorRef.detectChanges();
|
|
687
|
+
});
|
|
688
|
+
return appRef;
|
|
689
|
+
};
|
|
690
|
+
const ngHtml = await renderApplication(bootstrap, {
|
|
691
|
+
document: `<${selector}></${selector}>`,
|
|
692
|
+
});
|
|
693
|
+
const $ = cheerio.load(ngHtml, {
|
|
694
|
+
xml: { lowerCaseAttributeNames: false, lowerCaseTags: false },
|
|
695
|
+
});
|
|
696
|
+
const styles = [];
|
|
697
|
+
$('style').each(function () {
|
|
698
|
+
const content = $(this).html();
|
|
699
|
+
if (content) {
|
|
700
|
+
styles.push(content);
|
|
701
|
+
}
|
|
702
|
+
});
|
|
703
|
+
const html = normalizeNgHtml(ngHtml, selector);
|
|
704
|
+
return { styles, html };
|
|
705
|
+
};
|
|
706
|
+
/**
|
|
707
|
+
* Normalizes the provided HTML string by extracting the content within the specified selector
|
|
708
|
+
* and removing any non-standard HTML elements.
|
|
709
|
+
*
|
|
710
|
+
* @param html - The HTML string to be normalized.
|
|
711
|
+
* @param selector - The CSS selector used to identify the content to be extracted.
|
|
712
|
+
* @returns The normalized HTML string with the content of the specified selector and without non-standard HTML elements.
|
|
713
|
+
*/
|
|
714
|
+
const normalizeNgHtml = (html, selector) => {
|
|
715
|
+
const nsHtmlRegex = new RegExp(`<(?!(\\/?(${HTMLElements.join('|')})))[^>]+>`, 'gm');
|
|
716
|
+
return html
|
|
717
|
+
.replace(new RegExp(`[\\s\\S]*?<${selector}[\\s\\S]*?>([\\s\\S]*?)<\\/${selector}>[\\s\\S]*?`, 'gm'), '$1')
|
|
718
|
+
.replace(nsHtmlRegex, '');
|
|
719
|
+
};
|
|
720
|
+
/**
|
|
721
|
+
* Applies HTML transformations to the provided HTML string.
|
|
722
|
+
*
|
|
723
|
+
* This function uses Cheerio to load the HTML and perform transformations such as
|
|
724
|
+
* replacing placeholders and applying styles from the provided CSS file paths.
|
|
725
|
+
* It also ensures that certain HTML entities are replaced with their corresponding
|
|
726
|
+
* characters.
|
|
727
|
+
*
|
|
728
|
+
* @param html - The HTML string to transform.
|
|
729
|
+
* @param cssFilePaths - An optional array of CSS file paths to apply styles from.
|
|
730
|
+
* @returns The transformed HTML string.
|
|
731
|
+
*/
|
|
732
|
+
const applyHtmlTransformations = (html, styles) => {
|
|
733
|
+
const $ = cheerio.load(html, {
|
|
734
|
+
xml: { lowerCaseAttributeNames: false, lowerCaseTags: false },
|
|
735
|
+
});
|
|
736
|
+
replacePlaceholders($);
|
|
737
|
+
applyStyles($, styles);
|
|
738
|
+
return $.html()
|
|
739
|
+
.replaceAll('\n', '')
|
|
740
|
+
.replace(/\s+/g, ' ')
|
|
741
|
+
.replaceAll('<', '<')
|
|
742
|
+
.replaceAll('>', '>')
|
|
743
|
+
.replaceAll('$', '$');
|
|
744
|
+
};
|
|
745
|
+
/**
|
|
746
|
+
* Replaces elements with the `data-html` attribute with their corresponding HTML content.
|
|
747
|
+
*
|
|
748
|
+
* This function iterates over all elements that have the `data-html` attribute,
|
|
749
|
+
* retrieves the value of the attribute, and replaces the element with the HTML content
|
|
750
|
+
* specified in the attribute.
|
|
751
|
+
*
|
|
752
|
+
* @param $ - The Cheerio API instance used to manipulate the HTML.
|
|
753
|
+
*/
|
|
754
|
+
const replacePlaceholders = ($) => {
|
|
755
|
+
$('[data-html]').each(function () {
|
|
756
|
+
const content = $(this).attr('data-html');
|
|
757
|
+
if (content) {
|
|
758
|
+
$(this).replaceWith(`${content}`);
|
|
759
|
+
}
|
|
760
|
+
});
|
|
761
|
+
};
|
|
762
|
+
/**
|
|
763
|
+
* Applies the styles from the specified CSS file paths to the HTML document.
|
|
764
|
+
*
|
|
765
|
+
* @param $ - The Cheerio API instance used to manipulate the HTML document.
|
|
766
|
+
* @param cssFilePaths - An array of file paths to the CSS files to be applied.
|
|
767
|
+
*/
|
|
768
|
+
const applyStyles = ($, styles) => {
|
|
769
|
+
styles.forEach((style) => {
|
|
770
|
+
$('head').append(`<style>${style}</style>`);
|
|
771
|
+
});
|
|
772
|
+
};
|
|
773
|
+
/**
|
|
774
|
+
* Inlines CSS into the provided HTML string using Maizzle and Tailwind CSS.
|
|
775
|
+
*
|
|
776
|
+
* @param html - The HTML string to process.
|
|
777
|
+
* @param pretty - Whether to prettify the output HTML. Defaults to `false`.
|
|
778
|
+
* @param tailwindConfig - Optional Tailwind CSS configuration to use. If not provided, the `tailwindcss-preset-email` preset will be used.
|
|
779
|
+
* @returns A promise that resolves to the processed HTML string with inlined CSS.
|
|
780
|
+
*/
|
|
781
|
+
const inlineCss = async (html, pretty = false, tailwindConfig) => {
|
|
782
|
+
//@ts-expect-error: missing exports
|
|
783
|
+
const tailwindcssPresetEmail = (await import('tailwindcss-preset-email')).default;
|
|
784
|
+
return (await render$1(html, {
|
|
785
|
+
afterTransformers: ({ html }) => {
|
|
786
|
+
const renderedHtml = unescapeForRawComponent(html
|
|
787
|
+
.replaceAll('\n', '')
|
|
788
|
+
.replace(/\s+/g, ' ')
|
|
789
|
+
.replaceAll('$', '$')
|
|
790
|
+
.replace(/<angular-email-raw[\s\S]*?><!--(.*?)--><\/angular-email-raw>/gm, `$1`));
|
|
791
|
+
if (pretty)
|
|
792
|
+
return prettyPrint(renderedHtml);
|
|
793
|
+
return renderedHtml;
|
|
794
|
+
},
|
|
795
|
+
css: {
|
|
796
|
+
shorthand: true,
|
|
797
|
+
inline: {
|
|
798
|
+
applyWidthAttributes: true,
|
|
799
|
+
applyHeightAttributes: true,
|
|
800
|
+
},
|
|
801
|
+
purge: {
|
|
802
|
+
doNotRemoveHTMLCommentsWhoseOpeningTagContains: ['[if', '[endif', '<#if', '</#if', '<#else', '<#elseif'],
|
|
803
|
+
removeHTMLComments: false,
|
|
804
|
+
},
|
|
805
|
+
tailwind: {
|
|
806
|
+
presets: tailwindConfig ? [tailwindConfig] : [tailwindcssPresetEmail],
|
|
807
|
+
content: [
|
|
808
|
+
{
|
|
809
|
+
raw: html,
|
|
810
|
+
extension: 'html',
|
|
811
|
+
},
|
|
812
|
+
],
|
|
813
|
+
},
|
|
814
|
+
},
|
|
815
|
+
prettify: false,
|
|
816
|
+
minify: true,
|
|
817
|
+
})).html;
|
|
818
|
+
};
|
|
819
|
+
|
|
820
|
+
/*
|
|
821
|
+
* Public API Surface of angular-email
|
|
822
|
+
*/
|
|
823
|
+
|
|
824
|
+
/**
|
|
825
|
+
* Generated bundle index. Do not edit.
|
|
826
|
+
*/
|
|
827
|
+
|
|
828
|
+
export { BackgroundComponent, BodyComponent, ButtonComponent, ColorSchemeComponent, ColumnComponent, ConditionalComponent, ContainerComponent, HTMLElements, HeadComponent, HeadingComponent, HrComponent, HtmlComponent, ImgComponent, LinkComponent, PreviewComponent, RawComponent, SectionComponent, TextComponent, classToString, copyTextToClipboard, escapeForRawComponent, pxToPt, render, styleToString, unescapeForRawComponent, unreachable, withMargin };
|
|
829
|
+
//# sourceMappingURL=keycloakify-angular-email.mjs.map
|