@masterteam/system-settings 0.0.23 → 0.0.24
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/assets/i18n/ar.json +67 -7
- package/assets/i18n/en.json +72 -12
- package/assets/system-settings.css +1 -1
- package/fesm2022/{masterteam-system-settings-email-delivery-shell-D9NShoTc.mjs → masterteam-system-settings-email-delivery-shell-DhJ_GMml.mjs} +53 -16
- package/fesm2022/{masterteam-system-settings-email-delivery-shell-D9NShoTc.mjs.map → masterteam-system-settings-email-delivery-shell-DhJ_GMml.mjs.map} +1 -1
- package/fesm2022/{masterteam-system-settings-masterteam-system-settings-C51hZw-Q.mjs → masterteam-system-settings-masterteam-system-settings-KfJrvCL9.mjs} +456 -33
- package/fesm2022/masterteam-system-settings-masterteam-system-settings-KfJrvCL9.mjs.map +1 -0
- package/fesm2022/masterteam-system-settings.mjs +1 -1
- package/package.json +1 -1
- package/types/masterteam-system-settings.d.ts +167 -5
- package/fesm2022/masterteam-system-settings-masterteam-system-settings-C51hZw-Q.mjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CommonModule, NgTemplateOutlet } from '@angular/common';
|
|
2
2
|
import { HttpClient, HttpErrorResponse, HttpHeaders } from '@angular/common/http';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { input, ChangeDetectionStrategy, Component, inject, computed, effect, output, signal, InjectionToken, makeEnvironmentProviders, Injectable, DestroyRef,
|
|
4
|
+
import { input, ChangeDetectionStrategy, Component, inject, computed, effect, output, signal, InjectionToken, makeEnvironmentProviders, Injectable, DestroyRef, untracked, viewChild, forwardRef } from '@angular/core';
|
|
5
5
|
import { toSignal, takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
6
6
|
import * as i1 from '@angular/forms';
|
|
7
7
|
import { ReactiveFormsModule, FormGroup, FormControl, Validators, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
@@ -28,6 +28,7 @@ import { of, map, tap, catchError, throwError, finalize, shareReplay, mergeMap,
|
|
|
28
28
|
import { TextareaField } from '@masterteam/components/textarea-field';
|
|
29
29
|
import { EntityStatus } from '@masterteam/components/entities';
|
|
30
30
|
import { ConfirmationService } from '@masterteam/components/confirmation';
|
|
31
|
+
import { ColorPickerField } from '@masterteam/components/color-picker-field';
|
|
31
32
|
import { Tabs } from '@masterteam/components/tabs';
|
|
32
33
|
import { Tooltip } from '@masterteam/components/tooltip';
|
|
33
34
|
import { Icon } from '@masterteam/icons';
|
|
@@ -2900,13 +2901,227 @@ function isTestRequestConflict(error) {
|
|
|
2900
2901
|
value.errors?.code === TEST_REQUEST_CONFLICT_CODE);
|
|
2901
2902
|
}
|
|
2902
2903
|
|
|
2904
|
+
const EMAIL_STYLE_RANGES = {
|
|
2905
|
+
size: { min: 8, max: 64, fractionDigits: 0 },
|
|
2906
|
+
lineHeight: { min: 1, max: 3, fractionDigits: 2 },
|
|
2907
|
+
space: { min: 0, max: 96, fractionDigits: 0 },
|
|
2908
|
+
padding: { min: 0, max: 48, fractionDigits: 0 },
|
|
2909
|
+
borderWidth: { min: 0, max: 4, fractionDigits: 0 },
|
|
2910
|
+
gap: { min: 0, max: 96, fractionDigits: 0 },
|
|
2911
|
+
};
|
|
2912
|
+
const EMAIL_FONT_WEIGHTS = [
|
|
2913
|
+
100, 200, 300, 400, 500, 600, 700, 800, 900,
|
|
2914
|
+
];
|
|
2915
|
+
const EMAIL_FONT_LABELS = {
|
|
2916
|
+
tahoma: 'Tahoma',
|
|
2917
|
+
arial: 'Arial',
|
|
2918
|
+
verdana: 'Verdana',
|
|
2919
|
+
georgia: 'Georgia',
|
|
2920
|
+
'times-new-roman': 'Times New Roman',
|
|
2921
|
+
'courier-new': 'Courier New',
|
|
2922
|
+
};
|
|
2923
|
+
const FIELD_KIND = {
|
|
2924
|
+
fontFamily: 'font',
|
|
2925
|
+
fontSize: 'size',
|
|
2926
|
+
lineHeight: 'lineHeight',
|
|
2927
|
+
color: 'color',
|
|
2928
|
+
backgroundColor: 'color',
|
|
2929
|
+
borderColor: 'color',
|
|
2930
|
+
fontWeight: 'weight',
|
|
2931
|
+
spaceBefore: 'space',
|
|
2932
|
+
spaceAfter: 'space',
|
|
2933
|
+
padding: 'padding',
|
|
2934
|
+
borderWidth: 'borderWidth',
|
|
2935
|
+
underline: 'underline',
|
|
2936
|
+
};
|
|
2937
|
+
function controls(group, fields) {
|
|
2938
|
+
return fields.map((field) => ({
|
|
2939
|
+
id: `${group}.${field}`,
|
|
2940
|
+
group,
|
|
2941
|
+
field,
|
|
2942
|
+
kind: FIELD_KIND[field],
|
|
2943
|
+
}));
|
|
2944
|
+
}
|
|
2945
|
+
const TYPOGRAPHY = [
|
|
2946
|
+
'fontFamily',
|
|
2947
|
+
'fontSize',
|
|
2948
|
+
'lineHeight',
|
|
2949
|
+
'color',
|
|
2950
|
+
];
|
|
2951
|
+
const HEADING = [
|
|
2952
|
+
'fontSize',
|
|
2953
|
+
'color',
|
|
2954
|
+
'fontWeight',
|
|
2955
|
+
'spaceAfter',
|
|
2956
|
+
];
|
|
2957
|
+
/** Everyday controls, shown first. */
|
|
2958
|
+
const EMAIL_STYLE_SECTIONS = [
|
|
2959
|
+
{ key: 'text', controls: controls('text', TYPOGRAPHY) },
|
|
2960
|
+
{
|
|
2961
|
+
key: 'languages',
|
|
2962
|
+
controls: [
|
|
2963
|
+
...controls('english', ['fontFamily', 'fontSize', 'lineHeight']),
|
|
2964
|
+
...controls('arabic', ['fontFamily', 'fontSize', 'lineHeight']),
|
|
2965
|
+
],
|
|
2966
|
+
},
|
|
2967
|
+
{
|
|
2968
|
+
key: 'headings',
|
|
2969
|
+
controls: [
|
|
2970
|
+
...controls('heading2', HEADING),
|
|
2971
|
+
...controls('heading3', HEADING),
|
|
2972
|
+
],
|
|
2973
|
+
},
|
|
2974
|
+
{ key: 'paragraph', controls: controls('paragraph', ['spaceAfter']) },
|
|
2975
|
+
{
|
|
2976
|
+
key: 'links',
|
|
2977
|
+
controls: [
|
|
2978
|
+
...controls('link', ['color', 'underline']),
|
|
2979
|
+
...controls('button', [
|
|
2980
|
+
'color',
|
|
2981
|
+
'backgroundColor',
|
|
2982
|
+
'padding',
|
|
2983
|
+
'underline',
|
|
2984
|
+
]),
|
|
2985
|
+
],
|
|
2986
|
+
},
|
|
2987
|
+
{
|
|
2988
|
+
key: 'spacing',
|
|
2989
|
+
controls: [
|
|
2990
|
+
{
|
|
2991
|
+
id: 'languageSectionGap',
|
|
2992
|
+
group: 'languageSectionGap',
|
|
2993
|
+
field: null,
|
|
2994
|
+
kind: 'gap',
|
|
2995
|
+
},
|
|
2996
|
+
],
|
|
2997
|
+
},
|
|
2998
|
+
];
|
|
2999
|
+
/** Less common roles, under "Advanced". Their values are kept when hidden. */
|
|
3000
|
+
const EMAIL_STYLE_ADVANCED_SECTIONS = [
|
|
3001
|
+
{
|
|
3002
|
+
key: 'more-headings',
|
|
3003
|
+
controls: [
|
|
3004
|
+
...controls('heading1', HEADING),
|
|
3005
|
+
...controls('heading4', HEADING),
|
|
3006
|
+
],
|
|
3007
|
+
},
|
|
3008
|
+
{
|
|
3009
|
+
key: 'tables',
|
|
3010
|
+
controls: [
|
|
3011
|
+
...controls('table', ['borderColor', 'borderWidth', 'backgroundColor']),
|
|
3012
|
+
...controls('tableHeader', [
|
|
3013
|
+
'backgroundColor',
|
|
3014
|
+
'color',
|
|
3015
|
+
'fontWeight',
|
|
3016
|
+
'padding',
|
|
3017
|
+
]),
|
|
3018
|
+
...controls('tableCell', ['padding', 'borderColor']),
|
|
3019
|
+
],
|
|
3020
|
+
},
|
|
3021
|
+
{
|
|
3022
|
+
key: 'blocks',
|
|
3023
|
+
controls: [
|
|
3024
|
+
...controls('list', ['spaceAfter', 'color']),
|
|
3025
|
+
...controls('quote', [
|
|
3026
|
+
'color',
|
|
3027
|
+
'backgroundColor',
|
|
3028
|
+
'borderColor',
|
|
3029
|
+
'borderWidth',
|
|
3030
|
+
'padding',
|
|
3031
|
+
]),
|
|
3032
|
+
...controls('code', [
|
|
3033
|
+
'fontFamily',
|
|
3034
|
+
'fontSize',
|
|
3035
|
+
'backgroundColor',
|
|
3036
|
+
'padding',
|
|
3037
|
+
]),
|
|
3038
|
+
],
|
|
3039
|
+
},
|
|
3040
|
+
];
|
|
3041
|
+
function readEmailStyle(styles, control) {
|
|
3042
|
+
if (control.group === 'languageSectionGap') {
|
|
3043
|
+
return styles.languageSectionGap ?? null;
|
|
3044
|
+
}
|
|
3045
|
+
const group = styles[control.group];
|
|
3046
|
+
const value = control.field ? group?.[control.field] : undefined;
|
|
3047
|
+
return value === undefined ? null : value;
|
|
3048
|
+
}
|
|
3049
|
+
/**
|
|
3050
|
+
* Returns new styles with one control changed. Everything else — other groups,
|
|
3051
|
+
* other fields, fields without a control — is kept exactly, because a publish
|
|
3052
|
+
* replaces the whole object. `null` removes the field (inherit); `0` and
|
|
3053
|
+
* `false` are kept as intentional values.
|
|
3054
|
+
*/
|
|
3055
|
+
function writeEmailStyle(styles, control, value) {
|
|
3056
|
+
if (control.group === 'languageSectionGap') {
|
|
3057
|
+
const next = { ...styles };
|
|
3058
|
+
if (value === null)
|
|
3059
|
+
delete next.languageSectionGap;
|
|
3060
|
+
else
|
|
3061
|
+
next.languageSectionGap = value;
|
|
3062
|
+
return next;
|
|
3063
|
+
}
|
|
3064
|
+
const field = control.field;
|
|
3065
|
+
if (!field)
|
|
3066
|
+
return styles;
|
|
3067
|
+
const group = {
|
|
3068
|
+
...(styles[control.group] ?? {}),
|
|
3069
|
+
};
|
|
3070
|
+
if (value === null)
|
|
3071
|
+
delete group[field];
|
|
3072
|
+
else
|
|
3073
|
+
group[field] = value;
|
|
3074
|
+
return { ...styles, [control.group]: group };
|
|
3075
|
+
}
|
|
3076
|
+
/** `#abc` / `#AABBCC` → `#aabbcc`; anything else is not a usable colour. */
|
|
3077
|
+
function normalizeEmailColor(value) {
|
|
3078
|
+
if (!value)
|
|
3079
|
+
return null;
|
|
3080
|
+
const match = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(value.trim());
|
|
3081
|
+
if (!match)
|
|
3082
|
+
return null;
|
|
3083
|
+
const hex = match[1].length === 3
|
|
3084
|
+
? match[1]
|
|
3085
|
+
.split('')
|
|
3086
|
+
.map((char) => char + char)
|
|
3087
|
+
.join('')
|
|
3088
|
+
: match[1];
|
|
3089
|
+
return `#${hex.toLowerCase()}`;
|
|
3090
|
+
}
|
|
3091
|
+
/**
|
|
3092
|
+
* A stable comparison key: key order, null fields and empty groups do not
|
|
3093
|
+
* count, so the server's normalized copy of the same styles compares equal.
|
|
3094
|
+
*/
|
|
3095
|
+
function emailStylesKey(styles) {
|
|
3096
|
+
return JSON.stringify(canonical(styles ?? {}));
|
|
3097
|
+
}
|
|
3098
|
+
function canonical(value) {
|
|
3099
|
+
if (Array.isArray(value))
|
|
3100
|
+
return value.map(canonical);
|
|
3101
|
+
if (value && typeof value === 'object') {
|
|
3102
|
+
const entries = Object.entries(value)
|
|
3103
|
+
.filter(([, item]) => item !== null && item !== undefined)
|
|
3104
|
+
.map(([key, item]) => [key, canonical(item)])
|
|
3105
|
+
.filter(([, item]) => !(item &&
|
|
3106
|
+
typeof item === 'object' &&
|
|
3107
|
+
!Array.isArray(item) &&
|
|
3108
|
+
Object.keys(item).length === 0))
|
|
3109
|
+
.sort(([left], [right]) => left.localeCompare(right));
|
|
3110
|
+
return Object.fromEntries(entries);
|
|
3111
|
+
}
|
|
3112
|
+
if (typeof value === 'string')
|
|
3113
|
+
return value.toLowerCase();
|
|
3114
|
+
return value;
|
|
3115
|
+
}
|
|
3116
|
+
|
|
2903
3117
|
/**
|
|
2904
3118
|
* State for the Email design tab. The working draft lives here rather than in
|
|
2905
3119
|
* the tab so switching between Connections / Activity / Email design keeps
|
|
2906
3120
|
* unsaved edits; leaving the page asks first (`emailDesignLeaveGuard`).
|
|
2907
3121
|
*
|
|
2908
|
-
* There is no server-side draft: the base
|
|
2909
|
-
* or published with the revision
|
|
3122
|
+
* There is no server-side draft: the design (base HTML + shared content
|
|
3123
|
+
* styles) is only ever previewed (render-only) or published with the revision
|
|
3124
|
+
* it was read at. Both parts always travel together.
|
|
2910
3125
|
*/
|
|
2911
3126
|
class EmailLayoutFacade {
|
|
2912
3127
|
http = inject(HttpClient);
|
|
@@ -2916,15 +3131,24 @@ class EmailLayoutFacade {
|
|
|
2916
3131
|
headers = new HttpHeaders({ noMessage: 'true' });
|
|
2917
3132
|
snapshot = signal(null, ...(ngDevMode ? [{ debugName: "snapshot" }] : /* istanbul ignore next */ []));
|
|
2918
3133
|
draft = signal('', ...(ngDevMode ? [{ debugName: "draft" }] : /* istanbul ignore next */ []));
|
|
3134
|
+
/** Working copy of the shared content styles; starts as the server's object. */
|
|
3135
|
+
stylesDraft = signal({}, ...(ngDevMode ? [{ debugName: "stylesDraft" }] : /* istanbul ignore next */ []));
|
|
2919
3136
|
loading = signal(false, ...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
|
|
2920
3137
|
loadErrorCode = signal(null, ...(ngDevMode ? [{ debugName: "loadErrorCode" }] : /* istanbul ignore next */ []));
|
|
2921
3138
|
loadFailed = signal(false, ...(ngDevMode ? [{ debugName: "loadFailed" }] : /* istanbul ignore next */ []));
|
|
2922
3139
|
saving = signal(null, ...(ngDevMode ? [{ debugName: "saving" }] : /* istanbul ignore next */ []));
|
|
2923
3140
|
/** Someone else published since this draft's baseline was read. */
|
|
2924
3141
|
conflict = signal(false, ...(ngDevMode ? [{ debugName: "conflict" }] : /* istanbul ignore next */ []));
|
|
3142
|
+
stylesDirty = computed(() => {
|
|
3143
|
+
const snapshot = this.snapshot();
|
|
3144
|
+
return (snapshot !== null &&
|
|
3145
|
+
emailStylesKey(this.stylesDraft()) !==
|
|
3146
|
+
emailStylesKey(snapshot.contentStyles));
|
|
3147
|
+
}, ...(ngDevMode ? [{ debugName: "stylesDirty" }] : /* istanbul ignore next */ []));
|
|
2925
3148
|
dirty = computed(() => {
|
|
2926
3149
|
const snapshot = this.snapshot();
|
|
2927
|
-
return snapshot !== null &&
|
|
3150
|
+
return (snapshot !== null &&
|
|
3151
|
+
(this.draft() !== snapshot.body || this.stylesDirty()));
|
|
2928
3152
|
}, ...(ngDevMode ? [{ debugName: "dirty" }] : /* istanbul ignore next */ []));
|
|
2929
3153
|
load() {
|
|
2930
3154
|
this.loading.set(true);
|
|
@@ -2934,8 +3158,10 @@ class EmailLayoutFacade {
|
|
|
2934
3158
|
.get(this.url(), { headers: this.headers })
|
|
2935
3159
|
.pipe(map((response) => response.data), tap((snapshot) => {
|
|
2936
3160
|
// Never overwrite edits the user has not saved yet.
|
|
2937
|
-
if (!this.dirty())
|
|
3161
|
+
if (!this.dirty()) {
|
|
2938
3162
|
this.draft.set(snapshot.body);
|
|
3163
|
+
this.stylesDraft.set(snapshot.contentStyles);
|
|
3164
|
+
}
|
|
2939
3165
|
this.snapshot.set(snapshot);
|
|
2940
3166
|
}), catchError((error) => {
|
|
2941
3167
|
this.loadFailed.set(true);
|
|
@@ -2944,9 +3170,9 @@ class EmailLayoutFacade {
|
|
|
2944
3170
|
}), finalize(() => this.loading.set(false)));
|
|
2945
3171
|
}
|
|
2946
3172
|
/** Render-only: the server supplies a fixed bilingual sample; nothing is saved or sent. */
|
|
2947
|
-
preview(body) {
|
|
3173
|
+
preview(body, contentStyles) {
|
|
2948
3174
|
return this.http
|
|
2949
|
-
.post(this.url('preview'), { body }, { headers: this.headers })
|
|
3175
|
+
.post(this.url('preview'), { body, contentStyles }, { headers: this.headers })
|
|
2950
3176
|
.pipe(map((response) => response.data));
|
|
2951
3177
|
}
|
|
2952
3178
|
publish() {
|
|
@@ -2955,7 +3181,13 @@ class EmailLayoutFacade {
|
|
|
2955
3181
|
return throwError(() => new Error('Layout not loaded'));
|
|
2956
3182
|
this.saving.set('publish');
|
|
2957
3183
|
return this.http
|
|
2958
|
-
.put(this.url(),
|
|
3184
|
+
.put(this.url(),
|
|
3185
|
+
// A complete replacement: the whole styles object, never a patch.
|
|
3186
|
+
{
|
|
3187
|
+
body: this.draft(),
|
|
3188
|
+
contentStyles: this.stylesDraft(),
|
|
3189
|
+
expectedRevision: snapshot.revision,
|
|
3190
|
+
}, { headers: this.headers })
|
|
2959
3191
|
.pipe(map((response) => response.data), tap((published) => this.adopt(published)), catchError((error) => this.onWriteError(error)), finalize(() => this.saving.set(null)));
|
|
2960
3192
|
}
|
|
2961
3193
|
restorePrevious() {
|
|
@@ -2974,15 +3206,19 @@ class EmailLayoutFacade {
|
|
|
2974
3206
|
*/
|
|
2975
3207
|
reloadLatest(keepDraft) {
|
|
2976
3208
|
const draft = this.draft();
|
|
3209
|
+
const styles = this.stylesDraft();
|
|
2977
3210
|
return this.load().pipe(tap((snapshot) => {
|
|
2978
3211
|
this.draft.set(keepDraft ? draft : snapshot.body);
|
|
3212
|
+
this.stylesDraft.set(keepDraft ? styles : snapshot.contentStyles);
|
|
2979
3213
|
this.conflict.set(false);
|
|
2980
3214
|
}));
|
|
2981
3215
|
}
|
|
2982
3216
|
discard() {
|
|
2983
3217
|
const snapshot = this.snapshot();
|
|
2984
|
-
if (snapshot)
|
|
2985
|
-
|
|
3218
|
+
if (!snapshot)
|
|
3219
|
+
return;
|
|
3220
|
+
this.draft.set(snapshot.body);
|
|
3221
|
+
this.stylesDraft.set(snapshot.contentStyles);
|
|
2986
3222
|
}
|
|
2987
3223
|
describeCode(code) {
|
|
2988
3224
|
if (code) {
|
|
@@ -3008,6 +3244,7 @@ class EmailLayoutFacade {
|
|
|
3008
3244
|
// The server returns the sanitized body it stored; show exactly that.
|
|
3009
3245
|
this.snapshot.set(snapshot);
|
|
3010
3246
|
this.draft.set(snapshot.body);
|
|
3247
|
+
this.stylesDraft.set(snapshot.contentStyles);
|
|
3011
3248
|
this.conflict.set(false);
|
|
3012
3249
|
}
|
|
3013
3250
|
onWriteError(error) {
|
|
@@ -3033,15 +3270,28 @@ function readLayoutErrorCode(error) {
|
|
|
3033
3270
|
const code = body?.errors?.code;
|
|
3034
3271
|
return typeof code === 'string' ? code : null;
|
|
3035
3272
|
}
|
|
3273
|
+
/**
|
|
3274
|
+
* The diagnostics of a failed write. Domain errors send `{code, severity,
|
|
3275
|
+
* path}` items; standard model validation (`VAL_001`) sends a field map such
|
|
3276
|
+
* as `{ "ContentStyles": ["..."] }`, shown as one invalid-field line each.
|
|
3277
|
+
*/
|
|
3036
3278
|
function readLayoutErrorDiagnostics(error) {
|
|
3037
3279
|
const body = error instanceof HttpErrorResponse ? error.error : error;
|
|
3038
3280
|
const details = body?.errors
|
|
3039
3281
|
?.details;
|
|
3040
|
-
|
|
3041
|
-
|
|
3282
|
+
if (Array.isArray(details)) {
|
|
3283
|
+
return details.filter((item) => typeof item === 'object' &&
|
|
3042
3284
|
item !== null &&
|
|
3043
|
-
typeof item.code === 'string')
|
|
3044
|
-
|
|
3285
|
+
typeof item.code === 'string');
|
|
3286
|
+
}
|
|
3287
|
+
if (details && typeof details === 'object') {
|
|
3288
|
+
return Object.keys(details).map((path) => ({
|
|
3289
|
+
code: 'FIELD_INVALID',
|
|
3290
|
+
severity: 'error',
|
|
3291
|
+
path,
|
|
3292
|
+
}));
|
|
3293
|
+
}
|
|
3294
|
+
return [];
|
|
3045
3295
|
}
|
|
3046
3296
|
|
|
3047
3297
|
/**
|
|
@@ -3083,16 +3333,189 @@ const EMAIL_DELIVERY_ROUTES = [
|
|
|
3083
3333
|
{
|
|
3084
3334
|
path: '',
|
|
3085
3335
|
canDeactivate: [emailDesignLeaveGuard],
|
|
3086
|
-
loadComponent: () => import('./masterteam-system-settings-email-delivery-shell-
|
|
3336
|
+
loadComponent: () => import('./masterteam-system-settings-email-delivery-shell-DhJ_GMml.mjs').then((module) => module.EmailDeliveryShell),
|
|
3087
3337
|
},
|
|
3088
3338
|
{ path: '**', redirectTo: '' },
|
|
3089
3339
|
];
|
|
3090
3340
|
|
|
3341
|
+
/** Fonts the server accepts for shared content styles (approved fallback stacks). */
|
|
3342
|
+
const EMAIL_FONT_FAMILIES = [
|
|
3343
|
+
'tahoma',
|
|
3344
|
+
'arial',
|
|
3345
|
+
'verdana',
|
|
3346
|
+
'georgia',
|
|
3347
|
+
'times-new-roman',
|
|
3348
|
+
'courier-new',
|
|
3349
|
+
];
|
|
3091
3350
|
/** The one literal slot every base must contain exactly once. */
|
|
3092
3351
|
const EMAIL_LAYOUT_CONTENT_SLOT = '{content}';
|
|
3093
3352
|
/** UTF-8 byte limit for the base HTML. */
|
|
3094
3353
|
const EMAIL_LAYOUT_MAX_BYTES = 128 * 1024;
|
|
3095
3354
|
|
|
3355
|
+
/**
|
|
3356
|
+
* The shared content style controls of the Email design tab. Every field is
|
|
3357
|
+
* optional: empty means "inherit". Only the edited field changes; groups and
|
|
3358
|
+
* fields without a control are passed through untouched, because publishing
|
|
3359
|
+
* replaces the whole styles object.
|
|
3360
|
+
*/
|
|
3361
|
+
class EmailContentStylesEditor {
|
|
3362
|
+
transloco = inject(TranslocoService);
|
|
3363
|
+
destroyRef = inject(DestroyRef);
|
|
3364
|
+
styles = input.required(...(ngDevMode ? [{ debugName: "styles" }] : /* istanbul ignore next */ []));
|
|
3365
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
3366
|
+
stylesChange = output();
|
|
3367
|
+
sections = EMAIL_STYLE_SECTIONS;
|
|
3368
|
+
advancedSections = EMAIL_STYLE_ADVANCED_SECTIONS;
|
|
3369
|
+
showAdvanced = signal(false, ...(ngDevMode ? [{ debugName: "showAdvanced" }] : /* istanbul ignore next */ []));
|
|
3370
|
+
lang = signal(this.transloco.getActiveLang(), ...(ngDevMode ? [{ debugName: "lang" }] : /* istanbul ignore next */ []));
|
|
3371
|
+
fontOptions = EMAIL_FONT_FAMILIES.map((value) => ({
|
|
3372
|
+
value,
|
|
3373
|
+
label: EMAIL_FONT_LABELS[value],
|
|
3374
|
+
}));
|
|
3375
|
+
weightOptions = EMAIL_FONT_WEIGHTS.map((value) => ({
|
|
3376
|
+
value,
|
|
3377
|
+
label: String(value),
|
|
3378
|
+
}));
|
|
3379
|
+
underlineOptions = computed(() => {
|
|
3380
|
+
this.lang();
|
|
3381
|
+
return [
|
|
3382
|
+
{ value: true, label: this.t('underline-on') },
|
|
3383
|
+
{ value: false, label: this.t('underline-off') },
|
|
3384
|
+
];
|
|
3385
|
+
}, ...(ngDevMode ? [{ debugName: "underlineOptions" }] : /* istanbul ignore next */ []));
|
|
3386
|
+
/** The styles as last emitted, or as last received from the host. */
|
|
3387
|
+
latest = null;
|
|
3388
|
+
/** One control per style field, built once. */
|
|
3389
|
+
controls = new Map([...EMAIL_STYLE_SECTIONS, ...EMAIL_STYLE_ADVANCED_SECTIONS]
|
|
3390
|
+
.flatMap((section) => section.controls)
|
|
3391
|
+
.map((control) => [control.id, new FormControl(null)]));
|
|
3392
|
+
definitions = new Map([...EMAIL_STYLE_SECTIONS, ...EMAIL_STYLE_ADVANCED_SECTIONS]
|
|
3393
|
+
.flatMap((section) => section.controls)
|
|
3394
|
+
.map((control) => [control.id, control]));
|
|
3395
|
+
constructor() {
|
|
3396
|
+
const langSub = this.transloco.langChanges$.subscribe((lang) => this.lang.set(lang));
|
|
3397
|
+
this.destroyRef.onDestroy(() => langSub.unsubscribe());
|
|
3398
|
+
// Show what the styles hold. Writing a control that already shows the same
|
|
3399
|
+
// value is skipped, so the user's typing is never interrupted.
|
|
3400
|
+
effect(() => {
|
|
3401
|
+
const styles = this.styles();
|
|
3402
|
+
untracked(() => {
|
|
3403
|
+
this.latest = styles;
|
|
3404
|
+
for (const [id, control] of this.controls) {
|
|
3405
|
+
const definition = this.definitions.get(id);
|
|
3406
|
+
if (!definition)
|
|
3407
|
+
continue;
|
|
3408
|
+
const value = readEmailStyle(styles, definition);
|
|
3409
|
+
if (!sameValue(control.value, value, definition)) {
|
|
3410
|
+
control.setValue(value, { emitEvent: false });
|
|
3411
|
+
}
|
|
3412
|
+
}
|
|
3413
|
+
});
|
|
3414
|
+
});
|
|
3415
|
+
effect(() => {
|
|
3416
|
+
const disabled = this.disabled();
|
|
3417
|
+
untracked(() => {
|
|
3418
|
+
for (const control of this.controls.values()) {
|
|
3419
|
+
if (disabled)
|
|
3420
|
+
control.disable({ emitEvent: false });
|
|
3421
|
+
else
|
|
3422
|
+
control.enable({ emitEvent: false });
|
|
3423
|
+
}
|
|
3424
|
+
});
|
|
3425
|
+
});
|
|
3426
|
+
for (const [id, control] of this.controls) {
|
|
3427
|
+
const definition = this.definitions.get(id);
|
|
3428
|
+
if (!definition)
|
|
3429
|
+
continue;
|
|
3430
|
+
control.valueChanges
|
|
3431
|
+
.pipe(takeUntilDestroyed())
|
|
3432
|
+
.subscribe((value) => this.onEdit(definition, value));
|
|
3433
|
+
}
|
|
3434
|
+
}
|
|
3435
|
+
control(id) {
|
|
3436
|
+
const control = this.controls.get(id);
|
|
3437
|
+
if (!control)
|
|
3438
|
+
throw new Error(`Unknown style control ${id}`);
|
|
3439
|
+
return control;
|
|
3440
|
+
}
|
|
3441
|
+
label(control) {
|
|
3442
|
+
this.lang();
|
|
3443
|
+
return this.t(`fields.${control.field ?? control.group}`);
|
|
3444
|
+
}
|
|
3445
|
+
groupLabel(control) {
|
|
3446
|
+
this.lang();
|
|
3447
|
+
return control.field ? this.t(`groups.${control.group}`) : '';
|
|
3448
|
+
}
|
|
3449
|
+
/** Controls of one section, bunched by the role they style. */
|
|
3450
|
+
rows(section) {
|
|
3451
|
+
const rows = [];
|
|
3452
|
+
for (const control of section.controls) {
|
|
3453
|
+
const last = rows[rows.length - 1];
|
|
3454
|
+
if (last && last[0].group === control.group)
|
|
3455
|
+
last.push(control);
|
|
3456
|
+
else
|
|
3457
|
+
rows.push([control]);
|
|
3458
|
+
}
|
|
3459
|
+
return rows;
|
|
3460
|
+
}
|
|
3461
|
+
/** Bounds of a number control (the select / colour kinds never ask). */
|
|
3462
|
+
range(control) {
|
|
3463
|
+
switch (control.kind) {
|
|
3464
|
+
case 'size':
|
|
3465
|
+
case 'lineHeight':
|
|
3466
|
+
case 'space':
|
|
3467
|
+
case 'padding':
|
|
3468
|
+
case 'borderWidth':
|
|
3469
|
+
case 'gap':
|
|
3470
|
+
return EMAIL_STYLE_RANGES[control.kind];
|
|
3471
|
+
default:
|
|
3472
|
+
return { min: 0, max: 0, fractionDigits: 0 };
|
|
3473
|
+
}
|
|
3474
|
+
}
|
|
3475
|
+
sectionLabel(section) {
|
|
3476
|
+
this.lang();
|
|
3477
|
+
return this.t(`sections.${section.key}`);
|
|
3478
|
+
}
|
|
3479
|
+
onEdit(definition, raw) {
|
|
3480
|
+
let value = raw === '' || raw === undefined ? null : raw;
|
|
3481
|
+
if (definition.kind === 'color' && value !== null) {
|
|
3482
|
+
// Ignore a half-typed colour; the server accepts exactly #RRGGBB.
|
|
3483
|
+
value = normalizeEmailColor(String(value));
|
|
3484
|
+
if (value === null)
|
|
3485
|
+
return;
|
|
3486
|
+
}
|
|
3487
|
+
// Build on the last emitted styles, not the input: edits in quick
|
|
3488
|
+
// succession arrive before the host's new value has flowed back in.
|
|
3489
|
+
const next = writeEmailStyle(this.latest ?? this.styles(), definition, value);
|
|
3490
|
+
this.latest = next;
|
|
3491
|
+
this.stylesChange.emit(next);
|
|
3492
|
+
}
|
|
3493
|
+
t(key) {
|
|
3494
|
+
return this.transloco.translate(`email-delivery.design.styles.${key}`);
|
|
3495
|
+
}
|
|
3496
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EmailContentStylesEditor, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3497
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EmailContentStylesEditor, isStandalone: true, selector: "mt-email-content-styles", inputs: { styles: { classPropertyName: "styles", publicName: "styles", isSignal: true, isRequired: true, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { stylesChange: "stylesChange" }, host: { classAttribute: "block min-w-0" }, ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'email-delivery.design.styles'\">\n <div class=\"flex min-w-0 flex-col gap-4\">\n <p class=\"text-xs text-muted-color\">{{ t(\"hint\") }}</p>\n\n @for (section of sections; track section.key) {\n <ng-container\n [ngTemplateOutlet]=\"sectionTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: section }\"\n />\n }\n\n <div>\n <mt-button\n [icon]=\"showAdvanced() ? 'arrow.chevron-up' : 'arrow.chevron-down'\"\n [label]=\"t(showAdvanced() ? 'hide-advanced' : 'show-advanced')\"\n severity=\"secondary\"\n variant=\"text\"\n size=\"small\"\n (onClick)=\"showAdvanced.set(!showAdvanced())\"\n />\n </div>\n <!-- Hidden advanced values are kept: the styles object passes through. -->\n @if (showAdvanced()) {\n @for (section of advancedSections; track section.key) {\n <ng-container\n [ngTemplateOutlet]=\"sectionTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: section }\"\n />\n }\n }\n </div>\n\n <ng-template #sectionTemplate let-section>\n <section\n class=\"flex min-w-0 flex-col gap-3 rounded-md border border-surface p-3\"\n >\n <h4 class=\"text-sm font-semibold\">{{ sectionLabel(section) }}</h4>\n @for (row of rows(section); track $index) {\n <div class=\"flex min-w-0 flex-col gap-2\">\n @if (groupLabel(row[0]) && rows(section).length > 1) {\n <span class=\"text-xs font-medium text-muted-color\">{{\n groupLabel(row[0])\n }}</span>\n }\n <div class=\"grid min-w-0 grid-cols-1 gap-3 sm:grid-cols-2\">\n @for (item of row; track item.id) {\n @switch (item.kind) {\n @case (\"font\") {\n <mt-select-field\n [formControl]=\"control(item.id)\"\n [options]=\"fontOptions\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [showClear]=\"true\"\n [label]=\"label(item)\"\n [placeholder]=\"t('inherit')\"\n [hasPlaceholderPrefix]=\"false\"\n />\n }\n @case (\"weight\") {\n <mt-select-field\n [formControl]=\"control(item.id)\"\n [options]=\"weightOptions\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [showClear]=\"true\"\n [label]=\"label(item)\"\n [placeholder]=\"t('inherit')\"\n [hasPlaceholderPrefix]=\"false\"\n />\n }\n @case (\"underline\") {\n <mt-select-field\n [formControl]=\"control(item.id)\"\n [options]=\"underlineOptions()\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [showClear]=\"true\"\n [label]=\"label(item)\"\n [placeholder]=\"t('inherit')\"\n [hasPlaceholderPrefix]=\"false\"\n />\n }\n @case (\"color\") {\n <mt-color-picker-field\n [formControl]=\"control(item.id)\"\n [label]=\"label(item)\"\n [placeholder]=\"t('inherit')\"\n />\n }\n @default {\n <mt-number-field\n [formControl]=\"control(item.id)\"\n [label]=\"label(item)\"\n [placeholder]=\"t('inherit')\"\n [min]=\"range(item).min\"\n [max]=\"range(item).max\"\n [maxFractionDigits]=\"range(item).fractionDigits\"\n />\n }\n }\n }\n </div>\n </div>\n }\n </section>\n </ng-template>\n</ng-container>\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: ColorPickerField, selector: "mt-color-picker-field", inputs: ["label", "appendTo", "placeholder", "class", "variant", "readonly", "pInputs", "required"], outputs: ["onChange"] }, { kind: "component", type: NumberField, selector: "mt-number-field", inputs: ["field", "hint", "label", "placeholder", "class", "readonly", "pInputs", "format", "useGrouping", "maxFractionDigits", "min", "max", "required"] }, { kind: "component", type: SelectField, selector: "mt-select-field", inputs: ["field", "hint", "label", "placeholder", "hasPlaceholderPrefix", "class", "readonly", "pInputs", "options", "optionValue", "optionLabel", "filter", "filterBy", "dataKey", "showClear", "clearAfterSelect", "required", "group", "size", "optionGroupLabel", "optionGroupChildren", "loading", "optionIcon", "optionIconColor", "optionIconShape", "optionAvatarShape", "optionGroupIcon", "optionGroupIconColor", "optionGroupIconShape", "optionGroupAvatarShape", "markCurrentUser"], outputs: ["onChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3498
|
+
}
|
|
3499
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EmailContentStylesEditor, decorators: [{
|
|
3500
|
+
type: Component,
|
|
3501
|
+
args: [{ selector: 'mt-email-content-styles', imports: [
|
|
3502
|
+
NgTemplateOutlet,
|
|
3503
|
+
TranslocoDirective,
|
|
3504
|
+
ReactiveFormsModule,
|
|
3505
|
+
Button,
|
|
3506
|
+
ColorPickerField,
|
|
3507
|
+
NumberField,
|
|
3508
|
+
SelectField,
|
|
3509
|
+
], host: { class: 'block min-w-0' }, changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *transloco=\"let t; prefix: 'email-delivery.design.styles'\">\n <div class=\"flex min-w-0 flex-col gap-4\">\n <p class=\"text-xs text-muted-color\">{{ t(\"hint\") }}</p>\n\n @for (section of sections; track section.key) {\n <ng-container\n [ngTemplateOutlet]=\"sectionTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: section }\"\n />\n }\n\n <div>\n <mt-button\n [icon]=\"showAdvanced() ? 'arrow.chevron-up' : 'arrow.chevron-down'\"\n [label]=\"t(showAdvanced() ? 'hide-advanced' : 'show-advanced')\"\n severity=\"secondary\"\n variant=\"text\"\n size=\"small\"\n (onClick)=\"showAdvanced.set(!showAdvanced())\"\n />\n </div>\n <!-- Hidden advanced values are kept: the styles object passes through. -->\n @if (showAdvanced()) {\n @for (section of advancedSections; track section.key) {\n <ng-container\n [ngTemplateOutlet]=\"sectionTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: section }\"\n />\n }\n }\n </div>\n\n <ng-template #sectionTemplate let-section>\n <section\n class=\"flex min-w-0 flex-col gap-3 rounded-md border border-surface p-3\"\n >\n <h4 class=\"text-sm font-semibold\">{{ sectionLabel(section) }}</h4>\n @for (row of rows(section); track $index) {\n <div class=\"flex min-w-0 flex-col gap-2\">\n @if (groupLabel(row[0]) && rows(section).length > 1) {\n <span class=\"text-xs font-medium text-muted-color\">{{\n groupLabel(row[0])\n }}</span>\n }\n <div class=\"grid min-w-0 grid-cols-1 gap-3 sm:grid-cols-2\">\n @for (item of row; track item.id) {\n @switch (item.kind) {\n @case (\"font\") {\n <mt-select-field\n [formControl]=\"control(item.id)\"\n [options]=\"fontOptions\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [showClear]=\"true\"\n [label]=\"label(item)\"\n [placeholder]=\"t('inherit')\"\n [hasPlaceholderPrefix]=\"false\"\n />\n }\n @case (\"weight\") {\n <mt-select-field\n [formControl]=\"control(item.id)\"\n [options]=\"weightOptions\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [showClear]=\"true\"\n [label]=\"label(item)\"\n [placeholder]=\"t('inherit')\"\n [hasPlaceholderPrefix]=\"false\"\n />\n }\n @case (\"underline\") {\n <mt-select-field\n [formControl]=\"control(item.id)\"\n [options]=\"underlineOptions()\"\n optionLabel=\"label\"\n optionValue=\"value\"\n [showClear]=\"true\"\n [label]=\"label(item)\"\n [placeholder]=\"t('inherit')\"\n [hasPlaceholderPrefix]=\"false\"\n />\n }\n @case (\"color\") {\n <mt-color-picker-field\n [formControl]=\"control(item.id)\"\n [label]=\"label(item)\"\n [placeholder]=\"t('inherit')\"\n />\n }\n @default {\n <mt-number-field\n [formControl]=\"control(item.id)\"\n [label]=\"label(item)\"\n [placeholder]=\"t('inherit')\"\n [min]=\"range(item).min\"\n [max]=\"range(item).max\"\n [maxFractionDigits]=\"range(item).fractionDigits\"\n />\n }\n }\n }\n </div>\n </div>\n }\n </section>\n </ng-template>\n</ng-container>\n" }]
|
|
3510
|
+
}], ctorParameters: () => [], propDecorators: { styles: [{ type: i0.Input, args: [{ isSignal: true, alias: "styles", required: true }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], stylesChange: [{ type: i0.Output, args: ["stylesChange"] }] } });
|
|
3511
|
+
function sameValue(current, next, definition) {
|
|
3512
|
+
if (definition.kind === 'color') {
|
|
3513
|
+
return (normalizeEmailColor(current === null ? null : String(current)) ===
|
|
3514
|
+
normalizeEmailColor(next === null ? null : String(next)));
|
|
3515
|
+
}
|
|
3516
|
+
return (current ?? null) === (next ?? null);
|
|
3517
|
+
}
|
|
3518
|
+
|
|
3096
3519
|
/**
|
|
3097
3520
|
* Renders server-composed notification HTML without letting it touch the app.
|
|
3098
3521
|
*
|
|
@@ -3123,26 +3546,26 @@ class EmailHtmlPreview {
|
|
|
3123
3546
|
});
|
|
3124
3547
|
}
|
|
3125
3548
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EmailHtmlPreview, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3126
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.8", type: EmailHtmlPreview, isStandalone: true, selector: "mt-email-html-preview", inputs: { html: { classPropertyName: "html", publicName: "html", isSignal: true, isRequired: false, transformFunction: null }, showImages: { classPropertyName: "showImages", publicName: "showImages", isSignal: true, isRequired: false, transformFunction: null }, approvedImageOrigins: { classPropertyName: "approvedImageOrigins", publicName: "approvedImageOrigins", isSignal: true, isRequired: false, transformFunction: null }, fragment: { classPropertyName: "fragment", publicName: "fragment", isSignal: true, isRequired: false, transformFunction: null }, direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "block min-w-0" }, viewQueries: [{ propertyName: "frame", first: true, predicate: ["frame"], descendants: true, isSignal: true }], ngImport: i0, template: `<iframe
|
|
3127
|
-
#frame
|
|
3128
|
-
sandbox=""
|
|
3129
|
-
referrerpolicy="no-referrer"
|
|
3130
|
-
[attr.title]="title()"
|
|
3131
|
-
class="block w-full border-0 bg-white"
|
|
3132
|
-
[style.height]="height()"
|
|
3549
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.8", type: EmailHtmlPreview, isStandalone: true, selector: "mt-email-html-preview", inputs: { html: { classPropertyName: "html", publicName: "html", isSignal: true, isRequired: false, transformFunction: null }, showImages: { classPropertyName: "showImages", publicName: "showImages", isSignal: true, isRequired: false, transformFunction: null }, approvedImageOrigins: { classPropertyName: "approvedImageOrigins", publicName: "approvedImageOrigins", isSignal: true, isRequired: false, transformFunction: null }, fragment: { classPropertyName: "fragment", publicName: "fragment", isSignal: true, isRequired: false, transformFunction: null }, direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "block min-w-0" }, viewQueries: [{ propertyName: "frame", first: true, predicate: ["frame"], descendants: true, isSignal: true }], ngImport: i0, template: `<iframe
|
|
3550
|
+
#frame
|
|
3551
|
+
sandbox=""
|
|
3552
|
+
referrerpolicy="no-referrer"
|
|
3553
|
+
[attr.title]="title()"
|
|
3554
|
+
class="block w-full border-0 bg-white"
|
|
3555
|
+
[style.height]="height()"
|
|
3133
3556
|
></iframe>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3134
3557
|
}
|
|
3135
3558
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EmailHtmlPreview, decorators: [{
|
|
3136
3559
|
type: Component,
|
|
3137
3560
|
args: [{
|
|
3138
3561
|
selector: 'mt-email-html-preview',
|
|
3139
|
-
template: `<iframe
|
|
3140
|
-
#frame
|
|
3141
|
-
sandbox=""
|
|
3142
|
-
referrerpolicy="no-referrer"
|
|
3143
|
-
[attr.title]="title()"
|
|
3144
|
-
class="block w-full border-0 bg-white"
|
|
3145
|
-
[style.height]="height()"
|
|
3562
|
+
template: `<iframe
|
|
3563
|
+
#frame
|
|
3564
|
+
sandbox=""
|
|
3565
|
+
referrerpolicy="no-referrer"
|
|
3566
|
+
[attr.title]="title()"
|
|
3567
|
+
class="block w-full border-0 bg-white"
|
|
3568
|
+
[style.height]="height()"
|
|
3146
3569
|
></iframe>`,
|
|
3147
3570
|
host: { class: 'block min-w-0' },
|
|
3148
3571
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
@@ -4105,7 +4528,7 @@ class EmailVisualEditor {
|
|
|
4105
4528
|
useExisting: forwardRef(() => EmailVisualEditor),
|
|
4106
4529
|
multi: true,
|
|
4107
4530
|
},
|
|
4108
|
-
], viewQueries: [{ propertyName: "frame", first: true, predicate: ["frame"], descendants: true, isSignal: true }, { propertyName: "sourceHost", first: true, predicate: ["sourceHost"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'email-delivery.editor'\">\n <div class=\"flex min-w-0 flex-col gap-1\">\n @if (label() || hint()) {\n <div class=\"flex items-center gap-1 text-sm\">\n @if (label()) {\n <span class=\"font-medium\">{{ label() }}</span>\n }\n @if (hint()) {\n <span class=\"inline-flex text-surface-400\" [mtTooltip]=\"hint()\">\n <mt-icon icon=\"general.help-circle\" />\n </span>\n }\n </div>\n }\n\n <div\n class=\"flex min-w-0 flex-col overflow-hidden rounded-md border border-surface bg-content\"\n >\n <!-- Toolbar -->\n <div\n class=\"flex flex-wrap items-center justify-between gap-2 border-b border-surface bg-surface-50 px-2 py-1.5\"\n >\n <div\n class=\"flex min-w-0 flex-wrap items-center gap-0.5\"\n role=\"toolbar\"\n [attr.aria-label]=\"t('toolbar')\"\n >\n @if (effectiveMode() === \"design\") {\n @for (action of blockActions; track action.key) {\n <ng-container\n [ngTemplateOutlet]=\"toolbarButton\"\n [ngTemplateOutletContext]=\"{ $implicit: action }\"\n />\n }\n <span\n class=\"mx-1 h-5 w-px bg-surface-200\"\n aria-hidden=\"true\"\n ></span>\n @for (action of inlineActions; track action.key) {\n <ng-container\n [ngTemplateOutlet]=\"toolbarButton\"\n [ngTemplateOutletContext]=\"{ $implicit: action }\"\n />\n }\n <span\n class=\"mx-1 h-5 w-px bg-surface-200\"\n aria-hidden=\"true\"\n ></span>\n @for (action of styleActions; track action.key) {\n <ng-container\n [ngTemplateOutlet]=\"toolbarButton\"\n [ngTemplateOutletContext]=\"{ $implicit: action }\"\n />\n }\n <span\n class=\"mx-1 h-5 w-px bg-surface-200\"\n aria-hidden=\"true\"\n ></span>\n @for (action of alignActions; track action.key) {\n <ng-container\n [ngTemplateOutlet]=\"toolbarButton\"\n [ngTemplateOutletContext]=\"{ $implicit: action }\"\n />\n }\n <span\n class=\"mx-1 h-5 w-px bg-surface-200\"\n aria-hidden=\"true\"\n ></span>\n @for (action of listActions; track action.key) {\n <ng-container\n [ngTemplateOutlet]=\"toolbarButton\"\n [ngTemplateOutletContext]=\"{ $implicit: action }\"\n />\n }\n <mt-button\n icon=\"general.link-01\"\n severity=\"secondary\"\n variant=\"text\"\n size=\"small\"\n [tooltip]=\"t('actions.link')\"\n [ariaLabel]=\"t('actions.link')\"\n [disabled]=\"disabled()\"\n (onClick)=\"toggleLink()\"\n />\n <mt-button\n icon=\"image.image-01\"\n severity=\"secondary\"\n variant=\"text\"\n size=\"small\"\n [tooltip]=\"\n editingImage() ? t('actions.image-edit') : t('actions.image')\n \"\n [ariaLabel]=\"t('actions.image')\"\n [disabled]=\"disabled()\"\n (onClick)=\"toggleImage()\"\n />\n <span\n class=\"mx-1 h-5 w-px bg-surface-200\"\n aria-hidden=\"true\"\n ></span>\n @for (action of directionActions; track action.key) {\n <ng-container\n [ngTemplateOutlet]=\"toolbarButton\"\n [ngTemplateOutletContext]=\"{ $implicit: action }\"\n />\n }\n <span\n class=\"mx-1 h-5 w-px bg-surface-200\"\n aria-hidden=\"true\"\n ></span>\n @for (action of historyActions; track action.key) {\n <ng-container\n [ngTemplateOutlet]=\"toolbarButton\"\n [ngTemplateOutletContext]=\"{ $implicit: action }\"\n />\n }\n }\n </div>\n @if (!designBlocked()) {\n <!-- ms-auto keeps the switch at the end when the toolbar wraps. -->\n <mt-tabs\n class=\"ms-auto\"\n size=\"small\"\n [options]=\"modeOptions()\"\n [active]=\"mode()\"\n (activeChange)=\"onModeChange($event)\"\n />\n }\n </div>\n\n @if (stylePanel() && effectiveMode() === \"design\") {\n <div\n class=\"flex flex-wrap items-center gap-2 border-b border-surface px-3 py-2\"\n role=\"group\"\n [attr.aria-label]=\"\n t(\n 'style.' +\n (stylePanel() === 'color' ? 'text-color' : stylePanel())\n )\n \"\n >\n <span class=\"text-xs font-medium text-muted-color\">{{\n t(\n \"style.\" +\n (stylePanel() === \"color\" ? \"text-color\" : stylePanel())\n )\n }}</span>\n @if (stylePanel() === \"size\") {\n @for (size of textSizes; track size.key) {\n <mt-button\n size=\"small\"\n severity=\"secondary\"\n variant=\"outlined\"\n [label]=\"t('style.sizes.' + size.key)\"\n (onClick)=\"applySize(size.key)\"\n />\n }\n } @else {\n <div class=\"flex flex-wrap items-center gap-1\">\n @for (\n swatch of stylePanel() === \"highlight\"\n ? highlightColors\n : textColors;\n track swatch.key\n ) {\n <!-- The swatch colour is data, not a theme token. -->\n <button\n type=\"button\"\n class=\"size-6 rounded-md border border-surface outline-offset-2 hover:scale-110 focus-visible:outline-2 focus-visible:outline-primary\"\n [style.background-color]=\"swatch.value\"\n [attr.aria-label]=\"swatchLabel(swatch)\"\n [mtTooltip]=\"swatchLabel(swatch)\"\n (click)=\"applyColor(swatch)\"\n ></button>\n }\n </div>\n <mt-button\n size=\"small\"\n severity=\"secondary\"\n variant=\"text\"\n icon=\"general.x-close\"\n [label]=\"t('style.remove-color')\"\n (onClick)=\"removeColor()\"\n />\n }\n </div>\n }\n\n @if (imageOpen() && effectiveMode() === \"design\") {\n <div\n class=\"flex flex-col gap-2 border-b border-surface px-3 py-2\"\n [attr.aria-label]=\"t('actions.image')\"\n >\n <div class=\"grid grid-cols-1 gap-2 md:grid-cols-2\">\n <mt-text-field\n [formControl]=\"imageForm.src\"\n [label]=\"t('image.src')\"\n placeholder=\"https://\"\n dir=\"ltr\"\n />\n <mt-text-field\n [formControl]=\"imageForm.alt\"\n [label]=\"t('image.alt')\"\n [hint]=\"t('image.alt-hint')\"\n />\n <mt-number-field\n [formControl]=\"imageForm.width\"\n [label]=\"t('image.width')\"\n [min]=\"imageMin\"\n [max]=\"imageMax\"\n [maxFractionDigits]=\"0\"\n />\n <mt-number-field\n [formControl]=\"imageForm.height\"\n [label]=\"t('image.height')\"\n [min]=\"imageMin\"\n [max]=\"imageMax\"\n [maxFractionDigits]=\"0\"\n />\n </div>\n @if (imageError(); as error) {\n <p\n class=\"rounded-md border px-3 py-2 text-xs\"\n [class]=\"\n error === 'no-origins'\n ? 'border-amber-200 bg-amber-50 text-amber-700'\n : 'border-red-200 bg-red-50 text-red-700'\n \"\n role=\"alert\"\n >\n {{ imageErrorText() }}\n </p>\n } @else {\n <p class=\"text-xs text-muted-color\">\n {{ t(\"image.hint\", { origins: imageOriginsLabel() }) }}\n </p>\n }\n <div class=\"flex flex-wrap gap-2\">\n <mt-button\n size=\"small\"\n [label]=\"editingImage() ? t('image.update') : t('image.insert')\"\n [disabled]=\"imageError() === 'no-origins'\"\n (onClick)=\"applyImage()\"\n />\n @if (editingImage()) {\n <mt-button\n size=\"small\"\n severity=\"danger\"\n variant=\"text\"\n [label]=\"t('image.remove')\"\n (onClick)=\"removeImage()\"\n />\n }\n <mt-button\n size=\"small\"\n severity=\"secondary\"\n variant=\"text\"\n [label]=\"t('image.cancel')\"\n (onClick)=\"closeImage()\"\n />\n </div>\n </div>\n }\n\n @if (linkOpen() && effectiveMode() === \"design\") {\n <div\n class=\"flex flex-wrap items-start gap-2 border-b border-surface px-3 py-2\"\n >\n <mt-text-field\n class=\"min-w-0 flex-1\"\n [formControl]=\"linkControl\"\n [placeholder]=\"t('link.placeholder')\"\n dir=\"ltr\"\n />\n <mt-button\n size=\"small\"\n [label]=\"t('link.apply')\"\n (onClick)=\"applyLink()\"\n />\n <mt-button\n size=\"small\"\n severity=\"secondary\"\n variant=\"outlined\"\n [label]=\"t('link.record')\"\n (onClick)=\"useRecordLink()\"\n />\n <mt-button\n size=\"small\"\n severity=\"secondary\"\n variant=\"text\"\n [label]=\"t('link.remove')\"\n (onClick)=\"removeLink()\"\n />\n @if (linkError()) {\n <p class=\"w-full text-xs text-red-600\" role=\"alert\">\n {{ t(\"link.invalid\") }}\n </p>\n }\n </div>\n }\n\n @if (designBlocked()) {\n <p\n class=\"border-b border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-700\"\n >\n {{ t(\"design-blocked\") }}\n </p>\n }\n\n @if (effectiveMode() === \"design\") {\n @if (starter() && isEmpty() && !disabled()) {\n <div\n class=\"flex items-center justify-between gap-2 border-b border-surface px-3 py-2 text-xs text-muted-color\"\n >\n <span>{{ t(\"empty\") }}</span>\n <mt-button\n size=\"small\"\n severity=\"secondary\"\n variant=\"outlined\"\n [label]=\"t('bilingual')\"\n (onClick)=\"startBilingual()\"\n />\n </div>\n }\n <iframe\n #frame\n sandbox=\"allow-same-origin\"\n referrerpolicy=\"no-referrer\"\n [attr.title]=\"label() || t('canvas')\"\n class=\"block w-full border-0 bg-white\"\n [style.height]=\"height()\"\n ></iframe>\n } @else {\n <div #sourceHost class=\"p-2\" dir=\"ltr\">\n <textarea\n class=\"block w-full resize-y rounded-md border border-surface bg-content p-2 font-mono text-xs leading-5 outline-none focus:border-primary\"\n (focus)=\"focused.emit()\"\n [style.height]=\"height()\"\n [formControl]=\"sourceControl\"\n [attr.aria-label]=\"label() || t('html')\"\n spellcheck=\"false\"\n ></textarea>\n </div>\n }\n </div>\n </div>\n\n <ng-template #toolbarButton let-action>\n <mt-button\n [icon]=\"action.icon\"\n [label]=\"action.text\"\n severity=\"secondary\"\n variant=\"text\"\n size=\"small\"\n [tooltip]=\"actionLabel(action.key)\"\n [ariaLabel]=\"actionLabel(action.key)\"\n [disabled]=\"disabled()\"\n (onClick)=\"action.run()\"\n />\n </ng-template>\n</ng-container>\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: Tabs, selector: "mt-tabs", inputs: ["options", "optionLabel", "optionValue", "active", "mode", "moreLabel", "defaultIcon", "size", "fluid", "disabled", "searchThreshold"], outputs: ["activeChange", "onChange"] }, { kind: "component", type: TextField, selector: "mt-text-field", inputs: ["field", "hint", "label", "placeholder", "class", "type", "readonly", "pInputs", "required", "maxLength", "icon", "iconPosition"] }, { kind: "component", type: NumberField, selector: "mt-number-field", inputs: ["field", "hint", "label", "placeholder", "class", "readonly", "pInputs", "format", "useGrouping", "maxFractionDigits", "min", "max", "required"] }, { kind: "directive", type: Tooltip, selector: "[mtTooltip]" }, { kind: "component", type: Icon, selector: "mt-icon", inputs: ["icon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
4531
|
+
], viewQueries: [{ propertyName: "frame", first: true, predicate: ["frame"], descendants: true, isSignal: true }, { propertyName: "sourceHost", first: true, predicate: ["sourceHost"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-container *transloco=\"let t; prefix: 'email-delivery.editor'\">\r\n <div class=\"flex min-w-0 flex-col gap-1\">\r\n @if (label() || hint()) {\r\n <div class=\"flex items-center gap-1 text-sm\">\r\n @if (label()) {\r\n <span class=\"font-medium\">{{ label() }}</span>\r\n }\r\n @if (hint()) {\r\n <span class=\"inline-flex text-surface-400\" [mtTooltip]=\"hint()\">\r\n <mt-icon icon=\"general.help-circle\" />\r\n </span>\r\n }\r\n </div>\r\n }\r\n\r\n <div\r\n class=\"flex min-w-0 flex-col overflow-hidden rounded-md border border-surface bg-content\"\r\n >\r\n <!-- Toolbar -->\r\n <div\r\n class=\"flex flex-wrap items-center justify-between gap-2 border-b border-surface bg-surface-50 px-2 py-1.5\"\r\n >\r\n <div\r\n class=\"flex min-w-0 flex-wrap items-center gap-0.5\"\r\n role=\"toolbar\"\r\n [attr.aria-label]=\"t('toolbar')\"\r\n >\r\n @if (effectiveMode() === \"design\") {\r\n @for (action of blockActions; track action.key) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"toolbarButton\"\r\n [ngTemplateOutletContext]=\"{ $implicit: action }\"\r\n />\r\n }\r\n <span\r\n class=\"mx-1 h-5 w-px bg-surface-200\"\r\n aria-hidden=\"true\"\r\n ></span>\r\n @for (action of inlineActions; track action.key) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"toolbarButton\"\r\n [ngTemplateOutletContext]=\"{ $implicit: action }\"\r\n />\r\n }\r\n <span\r\n class=\"mx-1 h-5 w-px bg-surface-200\"\r\n aria-hidden=\"true\"\r\n ></span>\r\n @for (action of styleActions; track action.key) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"toolbarButton\"\r\n [ngTemplateOutletContext]=\"{ $implicit: action }\"\r\n />\r\n }\r\n <span\r\n class=\"mx-1 h-5 w-px bg-surface-200\"\r\n aria-hidden=\"true\"\r\n ></span>\r\n @for (action of alignActions; track action.key) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"toolbarButton\"\r\n [ngTemplateOutletContext]=\"{ $implicit: action }\"\r\n />\r\n }\r\n <span\r\n class=\"mx-1 h-5 w-px bg-surface-200\"\r\n aria-hidden=\"true\"\r\n ></span>\r\n @for (action of listActions; track action.key) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"toolbarButton\"\r\n [ngTemplateOutletContext]=\"{ $implicit: action }\"\r\n />\r\n }\r\n <mt-button\r\n icon=\"general.link-01\"\r\n severity=\"secondary\"\r\n variant=\"text\"\r\n size=\"small\"\r\n [tooltip]=\"t('actions.link')\"\r\n [ariaLabel]=\"t('actions.link')\"\r\n [disabled]=\"disabled()\"\r\n (onClick)=\"toggleLink()\"\r\n />\r\n <mt-button\r\n icon=\"image.image-01\"\r\n severity=\"secondary\"\r\n variant=\"text\"\r\n size=\"small\"\r\n [tooltip]=\"\r\n editingImage() ? t('actions.image-edit') : t('actions.image')\r\n \"\r\n [ariaLabel]=\"t('actions.image')\"\r\n [disabled]=\"disabled()\"\r\n (onClick)=\"toggleImage()\"\r\n />\r\n <span\r\n class=\"mx-1 h-5 w-px bg-surface-200\"\r\n aria-hidden=\"true\"\r\n ></span>\r\n @for (action of directionActions; track action.key) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"toolbarButton\"\r\n [ngTemplateOutletContext]=\"{ $implicit: action }\"\r\n />\r\n }\r\n <span\r\n class=\"mx-1 h-5 w-px bg-surface-200\"\r\n aria-hidden=\"true\"\r\n ></span>\r\n @for (action of historyActions; track action.key) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"toolbarButton\"\r\n [ngTemplateOutletContext]=\"{ $implicit: action }\"\r\n />\r\n }\r\n }\r\n </div>\r\n @if (!designBlocked()) {\r\n <!-- ms-auto keeps the switch at the end when the toolbar wraps. -->\r\n <mt-tabs\r\n class=\"ms-auto\"\r\n size=\"small\"\r\n [options]=\"modeOptions()\"\r\n [active]=\"mode()\"\r\n (activeChange)=\"onModeChange($event)\"\r\n />\r\n }\r\n </div>\r\n\r\n @if (stylePanel() && effectiveMode() === \"design\") {\r\n <div\r\n class=\"flex flex-wrap items-center gap-2 border-b border-surface px-3 py-2\"\r\n role=\"group\"\r\n [attr.aria-label]=\"\r\n t(\r\n 'style.' +\r\n (stylePanel() === 'color' ? 'text-color' : stylePanel())\r\n )\r\n \"\r\n >\r\n <span class=\"text-xs font-medium text-muted-color\">{{\r\n t(\r\n \"style.\" +\r\n (stylePanel() === \"color\" ? \"text-color\" : stylePanel())\r\n )\r\n }}</span>\r\n @if (stylePanel() === \"size\") {\r\n @for (size of textSizes; track size.key) {\r\n <mt-button\r\n size=\"small\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n [label]=\"t('style.sizes.' + size.key)\"\r\n (onClick)=\"applySize(size.key)\"\r\n />\r\n }\r\n } @else {\r\n <div class=\"flex flex-wrap items-center gap-1\">\r\n @for (\r\n swatch of stylePanel() === \"highlight\"\r\n ? highlightColors\r\n : textColors;\r\n track swatch.key\r\n ) {\r\n <!-- The swatch colour is data, not a theme token. -->\r\n <button\r\n type=\"button\"\r\n class=\"size-6 rounded-md border border-surface outline-offset-2 hover:scale-110 focus-visible:outline-2 focus-visible:outline-primary\"\r\n [style.background-color]=\"swatch.value\"\r\n [attr.aria-label]=\"swatchLabel(swatch)\"\r\n [mtTooltip]=\"swatchLabel(swatch)\"\r\n (click)=\"applyColor(swatch)\"\r\n ></button>\r\n }\r\n </div>\r\n <mt-button\r\n size=\"small\"\r\n severity=\"secondary\"\r\n variant=\"text\"\r\n icon=\"general.x-close\"\r\n [label]=\"t('style.remove-color')\"\r\n (onClick)=\"removeColor()\"\r\n />\r\n }\r\n </div>\r\n }\r\n\r\n @if (imageOpen() && effectiveMode() === \"design\") {\r\n <div\r\n class=\"flex flex-col gap-2 border-b border-surface px-3 py-2\"\r\n [attr.aria-label]=\"t('actions.image')\"\r\n >\r\n <div class=\"grid grid-cols-1 gap-2 md:grid-cols-2\">\r\n <mt-text-field\r\n [formControl]=\"imageForm.src\"\r\n [label]=\"t('image.src')\"\r\n placeholder=\"https://\"\r\n dir=\"ltr\"\r\n />\r\n <mt-text-field\r\n [formControl]=\"imageForm.alt\"\r\n [label]=\"t('image.alt')\"\r\n [hint]=\"t('image.alt-hint')\"\r\n />\r\n <mt-number-field\r\n [formControl]=\"imageForm.width\"\r\n [label]=\"t('image.width')\"\r\n [min]=\"imageMin\"\r\n [max]=\"imageMax\"\r\n [maxFractionDigits]=\"0\"\r\n />\r\n <mt-number-field\r\n [formControl]=\"imageForm.height\"\r\n [label]=\"t('image.height')\"\r\n [min]=\"imageMin\"\r\n [max]=\"imageMax\"\r\n [maxFractionDigits]=\"0\"\r\n />\r\n </div>\r\n @if (imageError(); as error) {\r\n <p\r\n class=\"rounded-md border px-3 py-2 text-xs\"\r\n [class]=\"\r\n error === 'no-origins'\r\n ? 'border-amber-200 bg-amber-50 text-amber-700'\r\n : 'border-red-200 bg-red-50 text-red-700'\r\n \"\r\n role=\"alert\"\r\n >\r\n {{ imageErrorText() }}\r\n </p>\r\n } @else {\r\n <p class=\"text-xs text-muted-color\">\r\n {{ t(\"image.hint\", { origins: imageOriginsLabel() }) }}\r\n </p>\r\n }\r\n <div class=\"flex flex-wrap gap-2\">\r\n <mt-button\r\n size=\"small\"\r\n [label]=\"editingImage() ? t('image.update') : t('image.insert')\"\r\n [disabled]=\"imageError() === 'no-origins'\"\r\n (onClick)=\"applyImage()\"\r\n />\r\n @if (editingImage()) {\r\n <mt-button\r\n size=\"small\"\r\n severity=\"danger\"\r\n variant=\"text\"\r\n [label]=\"t('image.remove')\"\r\n (onClick)=\"removeImage()\"\r\n />\r\n }\r\n <mt-button\r\n size=\"small\"\r\n severity=\"secondary\"\r\n variant=\"text\"\r\n [label]=\"t('image.cancel')\"\r\n (onClick)=\"closeImage()\"\r\n />\r\n </div>\r\n </div>\r\n }\r\n\r\n @if (linkOpen() && effectiveMode() === \"design\") {\r\n <div\r\n class=\"flex flex-wrap items-start gap-2 border-b border-surface px-3 py-2\"\r\n >\r\n <mt-text-field\r\n class=\"min-w-0 flex-1\"\r\n [formControl]=\"linkControl\"\r\n [placeholder]=\"t('link.placeholder')\"\r\n dir=\"ltr\"\r\n />\r\n <mt-button\r\n size=\"small\"\r\n [label]=\"t('link.apply')\"\r\n (onClick)=\"applyLink()\"\r\n />\r\n <mt-button\r\n size=\"small\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n [label]=\"t('link.record')\"\r\n (onClick)=\"useRecordLink()\"\r\n />\r\n <mt-button\r\n size=\"small\"\r\n severity=\"secondary\"\r\n variant=\"text\"\r\n [label]=\"t('link.remove')\"\r\n (onClick)=\"removeLink()\"\r\n />\r\n @if (linkError()) {\r\n <p class=\"w-full text-xs text-red-600\" role=\"alert\">\r\n {{ t(\"link.invalid\") }}\r\n </p>\r\n }\r\n </div>\r\n }\r\n\r\n @if (designBlocked()) {\r\n <p\r\n class=\"border-b border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-700\"\r\n >\r\n {{ t(\"design-blocked\") }}\r\n </p>\r\n }\r\n\r\n @if (effectiveMode() === \"design\") {\r\n @if (starter() && isEmpty() && !disabled()) {\r\n <div\r\n class=\"flex items-center justify-between gap-2 border-b border-surface px-3 py-2 text-xs text-muted-color\"\r\n >\r\n <span>{{ t(\"empty\") }}</span>\r\n <mt-button\r\n size=\"small\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n [label]=\"t('bilingual')\"\r\n (onClick)=\"startBilingual()\"\r\n />\r\n </div>\r\n }\r\n <iframe\r\n #frame\r\n sandbox=\"allow-same-origin\"\r\n referrerpolicy=\"no-referrer\"\r\n [attr.title]=\"label() || t('canvas')\"\r\n class=\"block w-full border-0 bg-white\"\r\n [style.height]=\"height()\"\r\n ></iframe>\r\n } @else {\r\n <div #sourceHost class=\"p-2\" dir=\"ltr\">\r\n <textarea\r\n class=\"block w-full resize-y rounded-md border border-surface bg-content p-2 font-mono text-xs leading-5 outline-none focus:border-primary\"\r\n (focus)=\"focused.emit()\"\r\n [style.height]=\"height()\"\r\n [formControl]=\"sourceControl\"\r\n [attr.aria-label]=\"label() || t('html')\"\r\n spellcheck=\"false\"\r\n ></textarea>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n\r\n <ng-template #toolbarButton let-action>\r\n <mt-button\r\n [icon]=\"action.icon\"\r\n [label]=\"action.text\"\r\n severity=\"secondary\"\r\n variant=\"text\"\r\n size=\"small\"\r\n [tooltip]=\"actionLabel(action.key)\"\r\n [ariaLabel]=\"actionLabel(action.key)\"\r\n [disabled]=\"disabled()\"\r\n (onClick)=\"action.run()\"\r\n />\r\n </ng-template>\r\n</ng-container>\r\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: Tabs, selector: "mt-tabs", inputs: ["options", "optionLabel", "optionValue", "active", "mode", "moreLabel", "defaultIcon", "size", "fluid", "disabled", "searchThreshold"], outputs: ["activeChange", "onChange"] }, { kind: "component", type: TextField, selector: "mt-text-field", inputs: ["field", "hint", "label", "placeholder", "class", "type", "readonly", "pInputs", "required", "maxLength", "icon", "iconPosition"] }, { kind: "component", type: NumberField, selector: "mt-number-field", inputs: ["field", "hint", "label", "placeholder", "class", "readonly", "pInputs", "format", "useGrouping", "maxFractionDigits", "min", "max", "required"] }, { kind: "directive", type: Tooltip, selector: "[mtTooltip]" }, { kind: "component", type: Icon, selector: "mt-icon", inputs: ["icon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
4109
4532
|
}
|
|
4110
4533
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EmailVisualEditor, decorators: [{
|
|
4111
4534
|
type: Component,
|
|
@@ -4125,7 +4548,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
4125
4548
|
useExisting: forwardRef(() => EmailVisualEditor),
|
|
4126
4549
|
multi: true,
|
|
4127
4550
|
},
|
|
4128
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *transloco=\"let t; prefix: 'email-delivery.editor'\">\n <div class=\"flex min-w-0 flex-col gap-1\">\n @if (label() || hint()) {\n <div class=\"flex items-center gap-1 text-sm\">\n @if (label()) {\n <span class=\"font-medium\">{{ label() }}</span>\n }\n @if (hint()) {\n <span class=\"inline-flex text-surface-400\" [mtTooltip]=\"hint()\">\n <mt-icon icon=\"general.help-circle\" />\n </span>\n }\n </div>\n }\n\n <div\n class=\"flex min-w-0 flex-col overflow-hidden rounded-md border border-surface bg-content\"\n >\n <!-- Toolbar -->\n <div\n class=\"flex flex-wrap items-center justify-between gap-2 border-b border-surface bg-surface-50 px-2 py-1.5\"\n >\n <div\n class=\"flex min-w-0 flex-wrap items-center gap-0.5\"\n role=\"toolbar\"\n [attr.aria-label]=\"t('toolbar')\"\n >\n @if (effectiveMode() === \"design\") {\n @for (action of blockActions; track action.key) {\n <ng-container\n [ngTemplateOutlet]=\"toolbarButton\"\n [ngTemplateOutletContext]=\"{ $implicit: action }\"\n />\n }\n <span\n class=\"mx-1 h-5 w-px bg-surface-200\"\n aria-hidden=\"true\"\n ></span>\n @for (action of inlineActions; track action.key) {\n <ng-container\n [ngTemplateOutlet]=\"toolbarButton\"\n [ngTemplateOutletContext]=\"{ $implicit: action }\"\n />\n }\n <span\n class=\"mx-1 h-5 w-px bg-surface-200\"\n aria-hidden=\"true\"\n ></span>\n @for (action of styleActions; track action.key) {\n <ng-container\n [ngTemplateOutlet]=\"toolbarButton\"\n [ngTemplateOutletContext]=\"{ $implicit: action }\"\n />\n }\n <span\n class=\"mx-1 h-5 w-px bg-surface-200\"\n aria-hidden=\"true\"\n ></span>\n @for (action of alignActions; track action.key) {\n <ng-container\n [ngTemplateOutlet]=\"toolbarButton\"\n [ngTemplateOutletContext]=\"{ $implicit: action }\"\n />\n }\n <span\n class=\"mx-1 h-5 w-px bg-surface-200\"\n aria-hidden=\"true\"\n ></span>\n @for (action of listActions; track action.key) {\n <ng-container\n [ngTemplateOutlet]=\"toolbarButton\"\n [ngTemplateOutletContext]=\"{ $implicit: action }\"\n />\n }\n <mt-button\n icon=\"general.link-01\"\n severity=\"secondary\"\n variant=\"text\"\n size=\"small\"\n [tooltip]=\"t('actions.link')\"\n [ariaLabel]=\"t('actions.link')\"\n [disabled]=\"disabled()\"\n (onClick)=\"toggleLink()\"\n />\n <mt-button\n icon=\"image.image-01\"\n severity=\"secondary\"\n variant=\"text\"\n size=\"small\"\n [tooltip]=\"\n editingImage() ? t('actions.image-edit') : t('actions.image')\n \"\n [ariaLabel]=\"t('actions.image')\"\n [disabled]=\"disabled()\"\n (onClick)=\"toggleImage()\"\n />\n <span\n class=\"mx-1 h-5 w-px bg-surface-200\"\n aria-hidden=\"true\"\n ></span>\n @for (action of directionActions; track action.key) {\n <ng-container\n [ngTemplateOutlet]=\"toolbarButton\"\n [ngTemplateOutletContext]=\"{ $implicit: action }\"\n />\n }\n <span\n class=\"mx-1 h-5 w-px bg-surface-200\"\n aria-hidden=\"true\"\n ></span>\n @for (action of historyActions; track action.key) {\n <ng-container\n [ngTemplateOutlet]=\"toolbarButton\"\n [ngTemplateOutletContext]=\"{ $implicit: action }\"\n />\n }\n }\n </div>\n @if (!designBlocked()) {\n <!-- ms-auto keeps the switch at the end when the toolbar wraps. -->\n <mt-tabs\n class=\"ms-auto\"\n size=\"small\"\n [options]=\"modeOptions()\"\n [active]=\"mode()\"\n (activeChange)=\"onModeChange($event)\"\n />\n }\n </div>\n\n @if (stylePanel() && effectiveMode() === \"design\") {\n <div\n class=\"flex flex-wrap items-center gap-2 border-b border-surface px-3 py-2\"\n role=\"group\"\n [attr.aria-label]=\"\n t(\n 'style.' +\n (stylePanel() === 'color' ? 'text-color' : stylePanel())\n )\n \"\n >\n <span class=\"text-xs font-medium text-muted-color\">{{\n t(\n \"style.\" +\n (stylePanel() === \"color\" ? \"text-color\" : stylePanel())\n )\n }}</span>\n @if (stylePanel() === \"size\") {\n @for (size of textSizes; track size.key) {\n <mt-button\n size=\"small\"\n severity=\"secondary\"\n variant=\"outlined\"\n [label]=\"t('style.sizes.' + size.key)\"\n (onClick)=\"applySize(size.key)\"\n />\n }\n } @else {\n <div class=\"flex flex-wrap items-center gap-1\">\n @for (\n swatch of stylePanel() === \"highlight\"\n ? highlightColors\n : textColors;\n track swatch.key\n ) {\n <!-- The swatch colour is data, not a theme token. -->\n <button\n type=\"button\"\n class=\"size-6 rounded-md border border-surface outline-offset-2 hover:scale-110 focus-visible:outline-2 focus-visible:outline-primary\"\n [style.background-color]=\"swatch.value\"\n [attr.aria-label]=\"swatchLabel(swatch)\"\n [mtTooltip]=\"swatchLabel(swatch)\"\n (click)=\"applyColor(swatch)\"\n ></button>\n }\n </div>\n <mt-button\n size=\"small\"\n severity=\"secondary\"\n variant=\"text\"\n icon=\"general.x-close\"\n [label]=\"t('style.remove-color')\"\n (onClick)=\"removeColor()\"\n />\n }\n </div>\n }\n\n @if (imageOpen() && effectiveMode() === \"design\") {\n <div\n class=\"flex flex-col gap-2 border-b border-surface px-3 py-2\"\n [attr.aria-label]=\"t('actions.image')\"\n >\n <div class=\"grid grid-cols-1 gap-2 md:grid-cols-2\">\n <mt-text-field\n [formControl]=\"imageForm.src\"\n [label]=\"t('image.src')\"\n placeholder=\"https://\"\n dir=\"ltr\"\n />\n <mt-text-field\n [formControl]=\"imageForm.alt\"\n [label]=\"t('image.alt')\"\n [hint]=\"t('image.alt-hint')\"\n />\n <mt-number-field\n [formControl]=\"imageForm.width\"\n [label]=\"t('image.width')\"\n [min]=\"imageMin\"\n [max]=\"imageMax\"\n [maxFractionDigits]=\"0\"\n />\n <mt-number-field\n [formControl]=\"imageForm.height\"\n [label]=\"t('image.height')\"\n [min]=\"imageMin\"\n [max]=\"imageMax\"\n [maxFractionDigits]=\"0\"\n />\n </div>\n @if (imageError(); as error) {\n <p\n class=\"rounded-md border px-3 py-2 text-xs\"\n [class]=\"\n error === 'no-origins'\n ? 'border-amber-200 bg-amber-50 text-amber-700'\n : 'border-red-200 bg-red-50 text-red-700'\n \"\n role=\"alert\"\n >\n {{ imageErrorText() }}\n </p>\n } @else {\n <p class=\"text-xs text-muted-color\">\n {{ t(\"image.hint\", { origins: imageOriginsLabel() }) }}\n </p>\n }\n <div class=\"flex flex-wrap gap-2\">\n <mt-button\n size=\"small\"\n [label]=\"editingImage() ? t('image.update') : t('image.insert')\"\n [disabled]=\"imageError() === 'no-origins'\"\n (onClick)=\"applyImage()\"\n />\n @if (editingImage()) {\n <mt-button\n size=\"small\"\n severity=\"danger\"\n variant=\"text\"\n [label]=\"t('image.remove')\"\n (onClick)=\"removeImage()\"\n />\n }\n <mt-button\n size=\"small\"\n severity=\"secondary\"\n variant=\"text\"\n [label]=\"t('image.cancel')\"\n (onClick)=\"closeImage()\"\n />\n </div>\n </div>\n }\n\n @if (linkOpen() && effectiveMode() === \"design\") {\n <div\n class=\"flex flex-wrap items-start gap-2 border-b border-surface px-3 py-2\"\n >\n <mt-text-field\n class=\"min-w-0 flex-1\"\n [formControl]=\"linkControl\"\n [placeholder]=\"t('link.placeholder')\"\n dir=\"ltr\"\n />\n <mt-button\n size=\"small\"\n [label]=\"t('link.apply')\"\n (onClick)=\"applyLink()\"\n />\n <mt-button\n size=\"small\"\n severity=\"secondary\"\n variant=\"outlined\"\n [label]=\"t('link.record')\"\n (onClick)=\"useRecordLink()\"\n />\n <mt-button\n size=\"small\"\n severity=\"secondary\"\n variant=\"text\"\n [label]=\"t('link.remove')\"\n (onClick)=\"removeLink()\"\n />\n @if (linkError()) {\n <p class=\"w-full text-xs text-red-600\" role=\"alert\">\n {{ t(\"link.invalid\") }}\n </p>\n }\n </div>\n }\n\n @if (designBlocked()) {\n <p\n class=\"border-b border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-700\"\n >\n {{ t(\"design-blocked\") }}\n </p>\n }\n\n @if (effectiveMode() === \"design\") {\n @if (starter() && isEmpty() && !disabled()) {\n <div\n class=\"flex items-center justify-between gap-2 border-b border-surface px-3 py-2 text-xs text-muted-color\"\n >\n <span>{{ t(\"empty\") }}</span>\n <mt-button\n size=\"small\"\n severity=\"secondary\"\n variant=\"outlined\"\n [label]=\"t('bilingual')\"\n (onClick)=\"startBilingual()\"\n />\n </div>\n }\n <iframe\n #frame\n sandbox=\"allow-same-origin\"\n referrerpolicy=\"no-referrer\"\n [attr.title]=\"label() || t('canvas')\"\n class=\"block w-full border-0 bg-white\"\n [style.height]=\"height()\"\n ></iframe>\n } @else {\n <div #sourceHost class=\"p-2\" dir=\"ltr\">\n <textarea\n class=\"block w-full resize-y rounded-md border border-surface bg-content p-2 font-mono text-xs leading-5 outline-none focus:border-primary\"\n (focus)=\"focused.emit()\"\n [style.height]=\"height()\"\n [formControl]=\"sourceControl\"\n [attr.aria-label]=\"label() || t('html')\"\n spellcheck=\"false\"\n ></textarea>\n </div>\n }\n </div>\n </div>\n\n <ng-template #toolbarButton let-action>\n <mt-button\n [icon]=\"action.icon\"\n [label]=\"action.text\"\n severity=\"secondary\"\n variant=\"text\"\n size=\"small\"\n [tooltip]=\"actionLabel(action.key)\"\n [ariaLabel]=\"actionLabel(action.key)\"\n [disabled]=\"disabled()\"\n (onClick)=\"action.run()\"\n />\n </ng-template>\n</ng-container>\n" }]
|
|
4551
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *transloco=\"let t; prefix: 'email-delivery.editor'\">\r\n <div class=\"flex min-w-0 flex-col gap-1\">\r\n @if (label() || hint()) {\r\n <div class=\"flex items-center gap-1 text-sm\">\r\n @if (label()) {\r\n <span class=\"font-medium\">{{ label() }}</span>\r\n }\r\n @if (hint()) {\r\n <span class=\"inline-flex text-surface-400\" [mtTooltip]=\"hint()\">\r\n <mt-icon icon=\"general.help-circle\" />\r\n </span>\r\n }\r\n </div>\r\n }\r\n\r\n <div\r\n class=\"flex min-w-0 flex-col overflow-hidden rounded-md border border-surface bg-content\"\r\n >\r\n <!-- Toolbar -->\r\n <div\r\n class=\"flex flex-wrap items-center justify-between gap-2 border-b border-surface bg-surface-50 px-2 py-1.5\"\r\n >\r\n <div\r\n class=\"flex min-w-0 flex-wrap items-center gap-0.5\"\r\n role=\"toolbar\"\r\n [attr.aria-label]=\"t('toolbar')\"\r\n >\r\n @if (effectiveMode() === \"design\") {\r\n @for (action of blockActions; track action.key) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"toolbarButton\"\r\n [ngTemplateOutletContext]=\"{ $implicit: action }\"\r\n />\r\n }\r\n <span\r\n class=\"mx-1 h-5 w-px bg-surface-200\"\r\n aria-hidden=\"true\"\r\n ></span>\r\n @for (action of inlineActions; track action.key) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"toolbarButton\"\r\n [ngTemplateOutletContext]=\"{ $implicit: action }\"\r\n />\r\n }\r\n <span\r\n class=\"mx-1 h-5 w-px bg-surface-200\"\r\n aria-hidden=\"true\"\r\n ></span>\r\n @for (action of styleActions; track action.key) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"toolbarButton\"\r\n [ngTemplateOutletContext]=\"{ $implicit: action }\"\r\n />\r\n }\r\n <span\r\n class=\"mx-1 h-5 w-px bg-surface-200\"\r\n aria-hidden=\"true\"\r\n ></span>\r\n @for (action of alignActions; track action.key) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"toolbarButton\"\r\n [ngTemplateOutletContext]=\"{ $implicit: action }\"\r\n />\r\n }\r\n <span\r\n class=\"mx-1 h-5 w-px bg-surface-200\"\r\n aria-hidden=\"true\"\r\n ></span>\r\n @for (action of listActions; track action.key) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"toolbarButton\"\r\n [ngTemplateOutletContext]=\"{ $implicit: action }\"\r\n />\r\n }\r\n <mt-button\r\n icon=\"general.link-01\"\r\n severity=\"secondary\"\r\n variant=\"text\"\r\n size=\"small\"\r\n [tooltip]=\"t('actions.link')\"\r\n [ariaLabel]=\"t('actions.link')\"\r\n [disabled]=\"disabled()\"\r\n (onClick)=\"toggleLink()\"\r\n />\r\n <mt-button\r\n icon=\"image.image-01\"\r\n severity=\"secondary\"\r\n variant=\"text\"\r\n size=\"small\"\r\n [tooltip]=\"\r\n editingImage() ? t('actions.image-edit') : t('actions.image')\r\n \"\r\n [ariaLabel]=\"t('actions.image')\"\r\n [disabled]=\"disabled()\"\r\n (onClick)=\"toggleImage()\"\r\n />\r\n <span\r\n class=\"mx-1 h-5 w-px bg-surface-200\"\r\n aria-hidden=\"true\"\r\n ></span>\r\n @for (action of directionActions; track action.key) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"toolbarButton\"\r\n [ngTemplateOutletContext]=\"{ $implicit: action }\"\r\n />\r\n }\r\n <span\r\n class=\"mx-1 h-5 w-px bg-surface-200\"\r\n aria-hidden=\"true\"\r\n ></span>\r\n @for (action of historyActions; track action.key) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"toolbarButton\"\r\n [ngTemplateOutletContext]=\"{ $implicit: action }\"\r\n />\r\n }\r\n }\r\n </div>\r\n @if (!designBlocked()) {\r\n <!-- ms-auto keeps the switch at the end when the toolbar wraps. -->\r\n <mt-tabs\r\n class=\"ms-auto\"\r\n size=\"small\"\r\n [options]=\"modeOptions()\"\r\n [active]=\"mode()\"\r\n (activeChange)=\"onModeChange($event)\"\r\n />\r\n }\r\n </div>\r\n\r\n @if (stylePanel() && effectiveMode() === \"design\") {\r\n <div\r\n class=\"flex flex-wrap items-center gap-2 border-b border-surface px-3 py-2\"\r\n role=\"group\"\r\n [attr.aria-label]=\"\r\n t(\r\n 'style.' +\r\n (stylePanel() === 'color' ? 'text-color' : stylePanel())\r\n )\r\n \"\r\n >\r\n <span class=\"text-xs font-medium text-muted-color\">{{\r\n t(\r\n \"style.\" +\r\n (stylePanel() === \"color\" ? \"text-color\" : stylePanel())\r\n )\r\n }}</span>\r\n @if (stylePanel() === \"size\") {\r\n @for (size of textSizes; track size.key) {\r\n <mt-button\r\n size=\"small\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n [label]=\"t('style.sizes.' + size.key)\"\r\n (onClick)=\"applySize(size.key)\"\r\n />\r\n }\r\n } @else {\r\n <div class=\"flex flex-wrap items-center gap-1\">\r\n @for (\r\n swatch of stylePanel() === \"highlight\"\r\n ? highlightColors\r\n : textColors;\r\n track swatch.key\r\n ) {\r\n <!-- The swatch colour is data, not a theme token. -->\r\n <button\r\n type=\"button\"\r\n class=\"size-6 rounded-md border border-surface outline-offset-2 hover:scale-110 focus-visible:outline-2 focus-visible:outline-primary\"\r\n [style.background-color]=\"swatch.value\"\r\n [attr.aria-label]=\"swatchLabel(swatch)\"\r\n [mtTooltip]=\"swatchLabel(swatch)\"\r\n (click)=\"applyColor(swatch)\"\r\n ></button>\r\n }\r\n </div>\r\n <mt-button\r\n size=\"small\"\r\n severity=\"secondary\"\r\n variant=\"text\"\r\n icon=\"general.x-close\"\r\n [label]=\"t('style.remove-color')\"\r\n (onClick)=\"removeColor()\"\r\n />\r\n }\r\n </div>\r\n }\r\n\r\n @if (imageOpen() && effectiveMode() === \"design\") {\r\n <div\r\n class=\"flex flex-col gap-2 border-b border-surface px-3 py-2\"\r\n [attr.aria-label]=\"t('actions.image')\"\r\n >\r\n <div class=\"grid grid-cols-1 gap-2 md:grid-cols-2\">\r\n <mt-text-field\r\n [formControl]=\"imageForm.src\"\r\n [label]=\"t('image.src')\"\r\n placeholder=\"https://\"\r\n dir=\"ltr\"\r\n />\r\n <mt-text-field\r\n [formControl]=\"imageForm.alt\"\r\n [label]=\"t('image.alt')\"\r\n [hint]=\"t('image.alt-hint')\"\r\n />\r\n <mt-number-field\r\n [formControl]=\"imageForm.width\"\r\n [label]=\"t('image.width')\"\r\n [min]=\"imageMin\"\r\n [max]=\"imageMax\"\r\n [maxFractionDigits]=\"0\"\r\n />\r\n <mt-number-field\r\n [formControl]=\"imageForm.height\"\r\n [label]=\"t('image.height')\"\r\n [min]=\"imageMin\"\r\n [max]=\"imageMax\"\r\n [maxFractionDigits]=\"0\"\r\n />\r\n </div>\r\n @if (imageError(); as error) {\r\n <p\r\n class=\"rounded-md border px-3 py-2 text-xs\"\r\n [class]=\"\r\n error === 'no-origins'\r\n ? 'border-amber-200 bg-amber-50 text-amber-700'\r\n : 'border-red-200 bg-red-50 text-red-700'\r\n \"\r\n role=\"alert\"\r\n >\r\n {{ imageErrorText() }}\r\n </p>\r\n } @else {\r\n <p class=\"text-xs text-muted-color\">\r\n {{ t(\"image.hint\", { origins: imageOriginsLabel() }) }}\r\n </p>\r\n }\r\n <div class=\"flex flex-wrap gap-2\">\r\n <mt-button\r\n size=\"small\"\r\n [label]=\"editingImage() ? t('image.update') : t('image.insert')\"\r\n [disabled]=\"imageError() === 'no-origins'\"\r\n (onClick)=\"applyImage()\"\r\n />\r\n @if (editingImage()) {\r\n <mt-button\r\n size=\"small\"\r\n severity=\"danger\"\r\n variant=\"text\"\r\n [label]=\"t('image.remove')\"\r\n (onClick)=\"removeImage()\"\r\n />\r\n }\r\n <mt-button\r\n size=\"small\"\r\n severity=\"secondary\"\r\n variant=\"text\"\r\n [label]=\"t('image.cancel')\"\r\n (onClick)=\"closeImage()\"\r\n />\r\n </div>\r\n </div>\r\n }\r\n\r\n @if (linkOpen() && effectiveMode() === \"design\") {\r\n <div\r\n class=\"flex flex-wrap items-start gap-2 border-b border-surface px-3 py-2\"\r\n >\r\n <mt-text-field\r\n class=\"min-w-0 flex-1\"\r\n [formControl]=\"linkControl\"\r\n [placeholder]=\"t('link.placeholder')\"\r\n dir=\"ltr\"\r\n />\r\n <mt-button\r\n size=\"small\"\r\n [label]=\"t('link.apply')\"\r\n (onClick)=\"applyLink()\"\r\n />\r\n <mt-button\r\n size=\"small\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n [label]=\"t('link.record')\"\r\n (onClick)=\"useRecordLink()\"\r\n />\r\n <mt-button\r\n size=\"small\"\r\n severity=\"secondary\"\r\n variant=\"text\"\r\n [label]=\"t('link.remove')\"\r\n (onClick)=\"removeLink()\"\r\n />\r\n @if (linkError()) {\r\n <p class=\"w-full text-xs text-red-600\" role=\"alert\">\r\n {{ t(\"link.invalid\") }}\r\n </p>\r\n }\r\n </div>\r\n }\r\n\r\n @if (designBlocked()) {\r\n <p\r\n class=\"border-b border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-700\"\r\n >\r\n {{ t(\"design-blocked\") }}\r\n </p>\r\n }\r\n\r\n @if (effectiveMode() === \"design\") {\r\n @if (starter() && isEmpty() && !disabled()) {\r\n <div\r\n class=\"flex items-center justify-between gap-2 border-b border-surface px-3 py-2 text-xs text-muted-color\"\r\n >\r\n <span>{{ t(\"empty\") }}</span>\r\n <mt-button\r\n size=\"small\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n [label]=\"t('bilingual')\"\r\n (onClick)=\"startBilingual()\"\r\n />\r\n </div>\r\n }\r\n <iframe\r\n #frame\r\n sandbox=\"allow-same-origin\"\r\n referrerpolicy=\"no-referrer\"\r\n [attr.title]=\"label() || t('canvas')\"\r\n class=\"block w-full border-0 bg-white\"\r\n [style.height]=\"height()\"\r\n ></iframe>\r\n } @else {\r\n <div #sourceHost class=\"p-2\" dir=\"ltr\">\r\n <textarea\r\n class=\"block w-full resize-y rounded-md border border-surface bg-content p-2 font-mono text-xs leading-5 outline-none focus:border-primary\"\r\n (focus)=\"focused.emit()\"\r\n [style.height]=\"height()\"\r\n [formControl]=\"sourceControl\"\r\n [attr.aria-label]=\"label() || t('html')\"\r\n spellcheck=\"false\"\r\n ></textarea>\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n\r\n <ng-template #toolbarButton let-action>\r\n <mt-button\r\n [icon]=\"action.icon\"\r\n [label]=\"action.text\"\r\n severity=\"secondary\"\r\n variant=\"text\"\r\n size=\"small\"\r\n [tooltip]=\"actionLabel(action.key)\"\r\n [ariaLabel]=\"actionLabel(action.key)\"\r\n [disabled]=\"disabled()\"\r\n (onClick)=\"action.run()\"\r\n />\r\n </ng-template>\r\n</ng-container>\r\n" }]
|
|
4129
4552
|
}], ctorParameters: () => [], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], placeholders: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholders", required: false }] }], layout: [{ type: i0.Input, args: [{ isSignal: true, alias: "layout", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], direction: [{ type: i0.Input, args: [{ isSignal: true, alias: "direction", required: false }] }], starter: [{ type: i0.Input, args: [{ isSignal: true, alias: "starter", required: false }] }], focused: [{ type: i0.Output, args: ["focused"] }], approvedImageOrigins: [{ type: i0.Input, args: [{ isSignal: true, alias: "approvedImageOrigins", required: false }] }], frame: [{ type: i0.ViewChild, args: ['frame', { isSignal: true }] }], sourceHost: [{ type: i0.ViewChild, args: ['sourceHost', { isSignal: true }] }] } });
|
|
4130
4553
|
function numberAttribute(element, name) {
|
|
4131
4554
|
const value = Number(element?.getAttribute(name));
|
|
@@ -4136,5 +4559,5 @@ function numberAttribute(element, name) {
|
|
|
4136
4559
|
* Generated bundle index. Do not edit.
|
|
4137
4560
|
*/
|
|
4138
4561
|
|
|
4139
|
-
export {
|
|
4140
|
-
//# sourceMappingURL=masterteam-system-settings-masterteam-system-settings-
|
|
4562
|
+
export { EmailDeliveryAccessService as A, collectEmailTemplatePlaceholders as B, buildEmailTemplatePlaceholderFields as C, DEFAULT_GENERAL_CONFIGURATION as D, EmailDeliveryFacade as E, FIXED_CURRENCIES as F, GENERAL_CONFIGURATION_SETTING_KEY as G, EmailUserTestDialog as H, EMAIL_USER_INITIATED_TEST_OPERATION_KIND as I, EMAIL_DELIVERY_ROUTES as J, EMAIL_FONT_FAMILIES as K, EMAIL_STYLE_RANGES as L, EMAIL_FONT_WEIGHTS as M, EMAIL_FONT_LABELS as N, EMAIL_STYLE_SECTIONS as O, EMAIL_STYLE_ADVANCED_SECTIONS as P, readEmailStyle as Q, RATE_SOURCE_OPTIONS as R, SystemSettings as S, TIMESHEET_FREQUENCY_OPTIONS as T, writeEmailStyle as U, normalizeEmailColor as V, WEEKEND_DAY_DEFINITIONS as W, emailDesignLeaveGuard as X, buildEmailPreviewDocument as Y, EmailDeliveryStatus as a, EMAIL_DELIVERY_ATTEMPT_STATUSES as b, createEmailTestRequestId as c, areEmailTestRecipientsValid as d, isEmailTestRequestPending as e, EMAIL_DELIVERY_PERMISSIONS as f, getEmailDeliveryStatusMap as g, EmailLayoutFacade as h, isConnectionTestAttempt as i, emailStylesKey as j, EMAIL_LAYOUT_CONTENT_SLOT as k, EMAIL_LAYOUT_MAX_BYTES as l, EmailVisualEditor as m, EmailContentStylesEditor as n, EmailHtmlPreview as o, parseEmailTestRecipients as p, EXPLORE_DEFAULT_VIEW_OPTIONS as q, readLayoutErrorDiagnostics as r, DEFAULT_DATE_FORMAT_OPTIONS as s, DEFAULT_TIME_FORMAT_OPTIONS as t, DOTNET_DAY_DEFINITIONS as u, SCHEDULE_ITEM_TYPE_OPTIONS as v, SystemSettingsHolidayEditor as w, DEFAULT_EMAIL_DELIVERY_OPTIONS as x, EMAIL_DELIVERY_OPTIONS as y, provideEmailDelivery as z };
|
|
4563
|
+
//# sourceMappingURL=masterteam-system-settings-masterteam-system-settings-KfJrvCL9.mjs.map
|