@arsedizioni/ars-utils 22.1.5 → 22.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/README.md +158 -10
  2. package/clipper.ui/clipper.scss +564 -0
  3. package/fesm2022/arsedizioni-ars-utils-clipper.common.mjs +1 -1
  4. package/fesm2022/arsedizioni-ars-utils-clipper.common.mjs.map +1 -1
  5. package/fesm2022/arsedizioni-ars-utils-clipper.ui.mjs +11 -7
  6. package/fesm2022/arsedizioni-ars-utils-clipper.ui.mjs.map +1 -1
  7. package/fesm2022/arsedizioni-ars-utils-core.date.mjs +609 -0
  8. package/fesm2022/arsedizioni-ars-utils-core.date.mjs.map +1 -0
  9. package/fesm2022/arsedizioni-ars-utils-core.markdown.mjs +591 -0
  10. package/fesm2022/arsedizioni-ars-utils-core.markdown.mjs.map +1 -0
  11. package/fesm2022/arsedizioni-ars-utils-core.mjs +270 -1449
  12. package/fesm2022/arsedizioni-ars-utils-core.mjs.map +1 -1
  13. package/fesm2022/arsedizioni-ars-utils-evolution.common.mjs +1 -1
  14. package/fesm2022/arsedizioni-ars-utils-evolution.common.mjs.map +1 -1
  15. package/fesm2022/arsedizioni-ars-utils-support.common.mjs +1 -1
  16. package/fesm2022/arsedizioni-ars-utils-support.common.mjs.map +1 -1
  17. package/fesm2022/arsedizioni-ars-utils-ui.application.mjs +14 -4108
  18. package/fesm2022/arsedizioni-ars-utils-ui.application.mjs.map +1 -1
  19. package/fesm2022/arsedizioni-ars-utils-ui.controls.mjs +962 -0
  20. package/fesm2022/arsedizioni-ars-utils-ui.controls.mjs.map +1 -0
  21. package/fesm2022/arsedizioni-ars-utils-ui.dialogs.auth.mjs +506 -0
  22. package/fesm2022/arsedizioni-ars-utils-ui.dialogs.auth.mjs.map +1 -0
  23. package/fesm2022/arsedizioni-ars-utils-ui.dialogs.mjs +450 -0
  24. package/fesm2022/arsedizioni-ars-utils-ui.dialogs.mjs.map +1 -0
  25. package/fesm2022/arsedizioni-ars-utils-ui.dialogs.prompt.mjs +184 -0
  26. package/fesm2022/arsedizioni-ars-utils-ui.dialogs.prompt.mjs.map +1 -0
  27. package/fesm2022/arsedizioni-ars-utils-ui.dialogs.select.mjs +825 -0
  28. package/fesm2022/arsedizioni-ars-utils-ui.dialogs.select.mjs.map +1 -0
  29. package/fesm2022/arsedizioni-ars-utils-ui.files.mjs +708 -0
  30. package/fesm2022/arsedizioni-ars-utils-ui.files.mjs.map +1 -0
  31. package/fesm2022/arsedizioni-ars-utils-ui.filters.mjs +426 -0
  32. package/fesm2022/arsedizioni-ars-utils-ui.filters.mjs.map +1 -0
  33. package/fesm2022/arsedizioni-ars-utils-ui.help.mjs +531 -0
  34. package/fesm2022/arsedizioni-ars-utils-ui.help.mjs.map +1 -0
  35. package/fesm2022/arsedizioni-ars-utils-ui.mjs +54 -1227
  36. package/fesm2022/arsedizioni-ars-utils-ui.mjs.map +1 -1
  37. package/fesm2022/arsedizioni-ars-utils-ui.navigation.mjs +1049 -0
  38. package/fesm2022/arsedizioni-ars-utils-ui.navigation.mjs.map +1 -0
  39. package/fesm2022/arsedizioni-ars-utils-ui.notifications.mjs +263 -0
  40. package/fesm2022/arsedizioni-ars-utils-ui.notifications.mjs.map +1 -0
  41. package/fesm2022/arsedizioni-ars-utils-ui.oauth.mjs +4 -3
  42. package/fesm2022/arsedizioni-ars-utils-ui.oauth.mjs.map +1 -1
  43. package/fesm2022/arsedizioni-ars-utils-ui.paginator.mjs +53 -0
  44. package/fesm2022/arsedizioni-ars-utils-ui.paginator.mjs.map +1 -0
  45. package/fesm2022/arsedizioni-ars-utils-ui.shell.mjs +517 -0
  46. package/fesm2022/arsedizioni-ars-utils-ui.shell.mjs.map +1 -0
  47. package/fesm2022/arsedizioni-ars-utils-ui.tinymce.mjs +246 -0
  48. package/fesm2022/arsedizioni-ars-utils-ui.tinymce.mjs.map +1 -0
  49. package/fesm2022/arsedizioni-ars-utils.mjs +13 -12
  50. package/fesm2022/arsedizioni-ars-utils.mjs.map +1 -1
  51. package/help/package.json +4 -0
  52. package/package.json +80 -14
  53. package/styles/ui.colors.scss +23 -0
  54. package/support.ui/package.json +4 -0
  55. package/tinymce/package.json +4 -0
  56. package/types/arsedizioni-ars-utils-clipper.common.d.ts +1 -2
  57. package/types/arsedizioni-ars-utils-clipper.ui.d.ts +4 -1
  58. package/types/arsedizioni-ars-utils-core.d.ts +684 -1004
  59. package/types/arsedizioni-ars-utils-core.date.d.ts +304 -0
  60. package/types/arsedizioni-ars-utils-core.markdown.d.ts +159 -0
  61. package/types/arsedizioni-ars-utils-ui.application.d.ts +10 -2022
  62. package/types/arsedizioni-ars-utils-ui.controls.d.ts +413 -0
  63. package/types/arsedizioni-ars-utils-ui.d.ts +183 -566
  64. package/types/arsedizioni-ars-utils-ui.dialogs.auth.d.ts +224 -0
  65. package/types/arsedizioni-ars-utils-ui.dialogs.d.ts +228 -0
  66. package/types/arsedizioni-ars-utils-ui.dialogs.prompt.d.ts +47 -0
  67. package/types/arsedizioni-ars-utils-ui.dialogs.select.d.ts +309 -0
  68. package/types/arsedizioni-ars-utils-ui.files.d.ts +271 -0
  69. package/types/arsedizioni-ars-utils-ui.filters.d.ts +163 -0
  70. package/types/arsedizioni-ars-utils-ui.help.d.ts +220 -0
  71. package/types/arsedizioni-ars-utils-ui.navigation.d.ts +650 -0
  72. package/types/arsedizioni-ars-utils-ui.notifications.d.ts +73 -0
  73. package/types/arsedizioni-ars-utils-ui.paginator.d.ts +23 -0
  74. package/types/arsedizioni-ars-utils-ui.shell.d.ts +345 -0
  75. package/types/arsedizioni-ars-utils-ui.tinymce.d.ts +63 -0
  76. package/types/arsedizioni-ars-utils.d.ts +4 -10
  77. package/ui.tinymce/README.md +12 -0
  78. package/ui.tinymce/langs/it.js +466 -0
@@ -0,0 +1,304 @@
1
+ import * as i0 from '@angular/core';
2
+ import { EnvironmentProviders, InjectionToken } from '@angular/core';
3
+ import { DateAdapter, MatDateFormats } from '@angular/material/core';
4
+ import { Locale } from 'date-fns';
5
+ import { HttpInterceptor, HttpRequest, HttpHandler, HttpEvent, HttpInterceptorFn } from '@angular/common/http';
6
+ import { Observable } from 'rxjs';
7
+
8
+ declare const MAT_DATE_FNS_FORMATS: MatDateFormats;
9
+ /**
10
+ * date-fns adapter that integrates Angular Material's date picker with the date-fns library,
11
+ * applying `Europe/Rome` timezone for all parsed and created dates.
12
+ */
13
+ declare class DateFnsAdapter extends DateAdapter<Date, Locale> {
14
+ constructor();
15
+ /**
16
+ * Wraps a date/instant into a Europe/Rome TZDate whose JSON serialisation emits a
17
+ * naive local datetime string ("yyyy-MM-dd'T'HH:mm:ss") instead of a UTC instant,
18
+ * so the wall-clock value the user entered is preserved end-to-end (no timezone shift).
19
+ * @param value - The source Date or Unix timestamp in milliseconds.
20
+ * @returns a Europe/Rome TZDate whose toJSON yields a naive local datetime string.
21
+ */
22
+ private static toLocal;
23
+ /**
24
+ * Returns the year component of the given date.
25
+ * @param date - The source date.
26
+ */
27
+ getYear(date: Date): number;
28
+ /**
29
+ * Returns the zero-based month index of the given date (0 = January).
30
+ * @param date - The source date.
31
+ */
32
+ getMonth(date: Date): number;
33
+ /**
34
+ * Returns the day-of-month of the given date (1-based).
35
+ * @param date - The source date.
36
+ */
37
+ getDate(date: Date): number;
38
+ /**
39
+ * Returns the day-of-week of the given date (0 = Sunday).
40
+ * @param date - The source date.
41
+ */
42
+ getDayOfWeek(date: Date): number;
43
+ /**
44
+ * Returns an array of 12 month name strings formatted for the active locale.
45
+ * @param style - One of `'long'`, `'short'`, or `'narrow'`.
46
+ */
47
+ getMonthNames(style: 'long' | 'short' | 'narrow'): string[];
48
+ /**
49
+ * Returns an array of 31 day-of-month label strings formatted using `Intl.DateTimeFormat`
50
+ * when available, falling back to plain numeric strings.
51
+ */
52
+ getDateNames(): string[];
53
+ /**
54
+ * Returns an array of 7 day-of-week name strings formatted for the active locale.
55
+ * @param style - One of `'long'`, `'short'`, or `'narrow'`.
56
+ */
57
+ getDayOfWeekNames(style: 'long' | 'short' | 'narrow'): string[];
58
+ /**
59
+ * Returns the four-digit year string for the given date.
60
+ * @param date - The source date.
61
+ */
62
+ getYearName(date: Date): string;
63
+ /**
64
+ * Returns the first day of the week for the active locale (0 = Sunday, 1 = Monday, …).
65
+ */
66
+ getFirstDayOfWeek(): number;
67
+ /**
68
+ * Returns the number of days in the month of the given date.
69
+ * @param date - The source date.
70
+ */
71
+ getNumDaysInMonth(date: Date): number;
72
+ /**
73
+ * Creates an independent copy of the given date.
74
+ * @param date - The date to clone.
75
+ */
76
+ clone(date: Date): Date;
77
+ /**
78
+ * Creates a `Date` in the `Europe/Rome` timezone for the given year, month, and day.
79
+ * Throws an `Error` when any component is out of range.
80
+ * @param year - Full four-digit year.
81
+ * @param month - Zero-based month index (0 = January, 11 = December).
82
+ * @param date - Day-of-month (1-based).
83
+ */
84
+ createDate(year: number, month: number, date: number): Date;
85
+ /**
86
+ * Returns the current date and time in the Europe/Rome timezone, preserving the wall-clock value.
87
+ */
88
+ today(): Date;
89
+ /**
90
+ * Parses a value into a `Date`.
91
+ * - Strings are first attempted as ISO 8601, then matched against each format in `parseFormat`.
92
+ * - Numbers are treated as Unix timestamps (milliseconds).
93
+ * - Existing `Date` instances are cloned.
94
+ * @param value - The value to parse.
95
+ * @param parseFormat - A format string or an array of format strings (date-fns tokens).
96
+ * @returns A valid `Date` in `Europe/Rome`, an invalid sentinel, or `null` for unrecognised input.
97
+ */
98
+ parse(value: unknown, parseFormat: string | string[]): Date | null;
99
+ /**
100
+ * Formats a `Date` using the given date-fns display format string.
101
+ * Throws an `Error` when `date` is not valid.
102
+ * @param date - The date to format.
103
+ * @param displayFormat - A date-fns format string (e.g. `'P'`, `'LLL uuuu'`).
104
+ */
105
+ format(date: Date, displayFormat: string): string;
106
+ /**
107
+ * Adds the given number of whole years to a date.
108
+ * @param date - The base date.
109
+ * @param years - Number of years to add (can be negative).
110
+ */
111
+ addCalendarYears(date: Date, years: number): Date;
112
+ /**
113
+ * Adds the given number of whole months to a date.
114
+ * @param date - The base date.
115
+ * @param months - Number of months to add (can be negative).
116
+ */
117
+ addCalendarMonths(date: Date, months: number): Date;
118
+ /**
119
+ * Adds the given number of whole days to a date.
120
+ * @param date - The base date.
121
+ * @param days - Number of days to add (can be negative).
122
+ */
123
+ addCalendarDays(date: Date, days: number): Date;
124
+ /**
125
+ * Serialises a date to an ISO 8601 date-only string (`yyyy-MM-dd`) using its Europe/Rome calendar day,
126
+ * independent of the browser timezone.
127
+ * @param date - The date to serialise.
128
+ * @returns the yyyy-MM-dd string for the date in Europe/Rome.
129
+ */
130
+ toIso8601(date: Date): string;
131
+ /**
132
+ * Returns the given value when it is a valid `Date`, or `null` for an empty string.
133
+ * Deserialises valid ISO 8601 strings into `Date` instances.
134
+ * Delegates all other values to the base-class implementation.
135
+ * @param value - The raw value to deserialise.
136
+ */
137
+ deserialize(value: unknown): Date | null;
138
+ /**
139
+ * Returns `true` when `obj` is an instance of `Date`.
140
+ * @param obj - The object to test.
141
+ */
142
+ isDateInstance(obj: unknown): boolean;
143
+ /**
144
+ * Returns `true` when `date` represents a valid point in time.
145
+ * @param date - The date to validate.
146
+ */
147
+ isValid(date: Date): boolean;
148
+ /**
149
+ * Returns a sentinel `Date` that represents an invalid date (`new Date(NaN)`).
150
+ */
151
+ invalid(): Date;
152
+ /**
153
+ * Returns the hours component (0-23) of the given date.
154
+ * @param date - The source date.
155
+ */
156
+ getHours(date: Date): number;
157
+ /**
158
+ * Returns the minutes component (0-59) of the given date.
159
+ * @param date - The source date.
160
+ */
161
+ getMinutes(date: Date): number;
162
+ /**
163
+ * Returns the seconds component (0-59) of the given date.
164
+ * @param date - The source date.
165
+ */
166
+ getSeconds(date: Date): number;
167
+ /**
168
+ * Returns a clone of `target` with its time-of-day set to the given hours/minutes/seconds,
169
+ * keeping the date part unchanged.
170
+ * @param target - The date whose time should be set.
171
+ * @param hours - New hours (0-23).
172
+ * @param minutes - New minutes (0-59).
173
+ * @param seconds - New seconds (0-59).
174
+ */
175
+ setTime(target: Date, hours: number, minutes: number, seconds: number): Date;
176
+ /**
177
+ * Adds the given number of seconds to a date.
178
+ * @param date - The base date.
179
+ * @param amount - Number of seconds to add (can be negative).
180
+ */
181
+ addSeconds(date: Date, amount: number): Date;
182
+ /**
183
+ * Parses a time-only value into a `Date` (today's date, in `Europe/Rome`, with the parsed
184
+ * time-of-day set). The wall-clock time is preserved exactly as entered.
185
+ * @param value - The value to parse (a string, or an existing `Date`).
186
+ * @param parseFormat - A format string or an array of format strings (date-fns tokens).
187
+ * @returns the parsed Date, an invalid sentinel, or null for unrecognised input.
188
+ */
189
+ parseTime(value: unknown, parseFormat: string | string[]): Date | null;
190
+ static ɵfac: i0.ɵɵFactoryDeclaration<DateFnsAdapter, never>;
191
+ static ɵprov: i0.ɵɵInjectableDeclaration<DateFnsAdapter>;
192
+ }
193
+ /**
194
+ * Standalone providers for the ARS date-fns adapter.
195
+ *
196
+ * Configures Angular Material to use {@link DateFnsAdapter} (Europe/Rome timezone)
197
+ * and the matching {@link MAT_DATE_FNS_FORMATS}. Also supports `mat-timepicker` since
198
+ * {@link DateFnsAdapter} implements the time-related `DateAdapter` methods.
199
+ *
200
+ * @example
201
+ * bootstrapApplication(AppComponent, {
202
+ * providers: [provideArsDateFns()]
203
+ * });
204
+ */
205
+ declare function provideArsDateFns(): EnvironmentProviders;
206
+
207
+ /** Default application timezone: all dates are serialised as Europe/Rome wall-clock values. */
208
+ declare const DEFAULT_TIME_ZONE = "Europe/Rome";
209
+ /**
210
+ * IANA timezone used to serialise dates towards the backend.
211
+ * Override it in the application providers to run the same code in another zone:
212
+ * `{ provide: ARS_TIME_ZONE, useValue: 'Europe/Zurich' }`.
213
+ */
214
+ declare const ARS_TIME_ZONE: InjectionToken<string>;
215
+ /**
216
+ * Functional interceptor that serialises every `Date` in an outgoing request
217
+ * body as a naive local datetime string (`yyyy-MM-ddTHH:mm:ss`: no `Z`, no offset).
218
+ *
219
+ * WHY: `JSON.stringify` calls `Date.prototype.toJSON`, which emits a UTC instant.
220
+ * A date picked as 29/07/2026 00:00 in Rome (UTC+2) becomes
221
+ * `2026-07-28T22:00:00.000Z`, so the server stores the 28th — the classic
222
+ * "off by one day" bug. Sending the wall-clock value instead makes
223
+ * System.Text.Json produce a `DateTime` with `Kind = Unspecified` and the exact
224
+ * day/time the user selected.
225
+ *
226
+ * This is the single serialisation boundary of the application: no call site has
227
+ * to convert anything, and it also covers dates that lost a per-instance
228
+ * `toJSON` along the way (e.g. after `structuredClone`).
229
+ *
230
+ * Register it explicitly in `provideHttpClient(withInterceptors([...]))`.
231
+ * If you would rather have the library register it for you, use
232
+ * {@link provideArsLocalDates} instead.
233
+ *
234
+ * @example
235
+ * provideHttpClient(withInterceptors([
236
+ * arsLocalDateInterceptor,
237
+ * evolutionAuthInterceptor(...),
238
+ * ]));
239
+ */
240
+ declare const arsLocalDateInterceptor: HttpInterceptorFn;
241
+ /**
242
+ * Class-based twin of {@link arsLocalDateInterceptor}.
243
+ *
244
+ * Exists because a functional `HttpInterceptorFn` can ONLY be registered inside
245
+ * `provideHttpClient(withInterceptors([...]))`, while a class registered on the
246
+ * `HTTP_INTERCEPTORS` multi-token can be contributed by any `EnvironmentProviders` —
247
+ * which is what lets {@link provideArsLocalDates} (and `provideArsDateFns`) wire it up
248
+ * on their own.
249
+ *
250
+ * REQUIRES `withInterceptorsFromDi()` in the application's `provideHttpClient()`:
251
+ * without it Angular never reads `HTTP_INTERCEPTORS` and this interceptor is
252
+ * silently skipped.
253
+ */
254
+ declare class ArsLocalDateInterceptor implements HttpInterceptor {
255
+ private readonly timeZone;
256
+ /**
257
+ * Normalises the request body before handing it to the next handler.
258
+ * @param req - The outgoing request.
259
+ * @param next - The next handler in the chain.
260
+ */
261
+ intercept(req: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>>;
262
+ static ɵfac: i0.ɵɵFactoryDeclaration<ArsLocalDateInterceptor, never>;
263
+ static ɵprov: i0.ɵɵInjectableDeclaration<ArsLocalDateInterceptor>;
264
+ }
265
+ /**
266
+ * Standalone providers for date serialisation towards the backend.
267
+ *
268
+ * Registers {@link ArsLocalDateInterceptor} so that every `Date` in a request
269
+ * body travels as a naive local datetime string instead of a UTC instant.
270
+ *
271
+ * IMPORTANT: the application MUST call `withInterceptorsFromDi()`, otherwise
272
+ * these providers have no effect at all (no error is raised).
273
+ *
274
+ * @param timeZone - IANA timezone name (default: `Europe/Rome`).
275
+ *
276
+ * @example
277
+ * providers: [
278
+ * provideArsLocalDates(),
279
+ * provideHttpClient(withInterceptors([evolutionAuthInterceptor(...)]), withInterceptorsFromDi()),
280
+ * ]
281
+ */
282
+ declare function provideArsLocalDates(timeZone?: string): EnvironmentProviders;
283
+ /**
284
+ * Formats a date as a date-only ISO string (`yyyy-MM-dd`) using its wall-clock
285
+ * calendar day in the given timezone. Use it for query-string parameters and for
286
+ * DTO fields mapped to a .NET `DateOnly`, which the interceptor cannot detect.
287
+ *
288
+ * @param value - The date to serialise.
289
+ * @param timeZone - IANA timezone name (default: `Europe/Rome`).
290
+ * @returns The `yyyy-MM-dd` string, or `undefined` for empty/invalid input.
291
+ */
292
+ declare function toLocalDateOnlyString(value?: Date | null, timeZone?: string): string | undefined;
293
+ /**
294
+ * Formats a date as a naive local datetime string (`yyyy-MM-ddTHH:mm:ss`), the
295
+ * same representation produced by the interceptor. Useful for query-string
296
+ * parameters, which never pass through the request body.
297
+ *
298
+ * @param value - The date to serialise.
299
+ * @param timeZone - IANA timezone name (default: `Europe/Rome`).
300
+ * @returns The naive datetime string, or `undefined` for empty/invalid input.
301
+ */
302
+ declare function toLocalDateTimeString(value?: Date | null, timeZone?: string): string | undefined;
303
+
304
+ export { ARS_TIME_ZONE, ArsLocalDateInterceptor, DEFAULT_TIME_ZONE, DateFnsAdapter, MAT_DATE_FNS_FORMATS, arsLocalDateInterceptor, provideArsDateFns, provideArsLocalDates, toLocalDateOnlyString, toLocalDateTimeString };
@@ -0,0 +1,159 @@
1
+ import * as i0 from '@angular/core';
2
+ import { PipeTransform } from '@angular/core';
3
+ import { SafeHtml } from '@angular/platform-browser';
4
+
5
+ /**
6
+ * Zero-dependency Markdown to HTML converter.
7
+ *
8
+ * Design goals:
9
+ * - Single line-based pass over blocks (no repeated full-string regex passes).
10
+ * - Inline formatting never touches code spans / code blocks (stash & restore).
11
+ * - No HTML entity escaping by default in normal text: the source passes as-is.
12
+ * Exception: the content of code spans / code blocks is ALWAYS escaped, so
13
+ * things like List<string> render correctly (the browser displays the
14
+ * original characters; entities never reach the user or the clipboard).
15
+ * Opt-in full escaping via { escapeHtml: true } for untrusted input.
16
+ * - URL sanitization on links/images (javascript:, vbscript:, data: are dropped).
17
+ * - Bounded result cache for repeated renders (Angular change detection friendly).
18
+ *
19
+ * Supported syntax: headings, paragraphs, hard/soft breaks, hr, blockquotes
20
+ * (nested), fenced code blocks, inline code, bold/italic/strikethrough, links
21
+ * (with title), images, autolinked bare URLs, ordered/unordered lists (nested,
22
+ * task lists, ordered start offset), GFM tables with alignment, raw HTML
23
+ * blocks (e.g. <table>...</table>) passed through verbatim when escapeHtml
24
+ * is false: their newlines stay plain newlines, never converted to <br>.
25
+ *
26
+ * Known simplifications (documented, by design):
27
+ * - A blank line terminates a list.
28
+ * - Setext headings (=== / ---) are not supported, use # syntax.
29
+ * - Reference-style links [text][ref] are not supported.
30
+ */
31
+ interface MarkdownOptions {
32
+ /**
33
+ * Escape raw HTML found in the source as entities (default: false).
34
+ * When false (default) no &amp;/&lt;/&gt;/&quot; entities are ever produced:
35
+ * the text is emitted as-is. Enable ONLY when rendering untrusted input,
36
+ * since raw HTML in the source would otherwise reach the DOM (XSS).
37
+ */
38
+ escapeHtml?: boolean;
39
+ /** Render single newlines inside paragraphs as <br> (default: true). */
40
+ breaks?: boolean;
41
+ }
42
+ declare class MarkdownUtils {
43
+ private static readonly cache;
44
+ private static readonly CACHE_MAX;
45
+ /** Clears the internal result cache. */
46
+ static clearCache(): void;
47
+ /**
48
+ * Convert markdown to HTML.
49
+ * @param markdown : the markdown source
50
+ * @param options : conversion options
51
+ * @returns : the HTML string ('' when input is falsy)
52
+ */
53
+ static toHtml(markdown?: string, options?: MarkdownOptions): string;
54
+ /** Block-level HTML tags that start a raw HTML block (passthrough, no <p>/<br>). */
55
+ private static readonly htmlBlockTags;
56
+ /** Void/self-contained tags: a single tag, no closing tag expected. */
57
+ private static readonly htmlVoidTags;
58
+ /**
59
+ * Precompiled: first block-level tag occurrence anywhere in a line.
60
+ * Anchored on the '<' literal, so scanning is cheap; the lookahead
61
+ * prevents partial matches ('<td' must not match inside '<tdx').
62
+ */
63
+ private static readonly htmlBlockScanRe;
64
+ /** Result of scanning a line for the start of a raw HTML block. */
65
+ private static findHtmlBlockStart;
66
+ /** True when `index` falls inside an inline code span (odd backtick count before it). */
67
+ private static insideCodeSpan;
68
+ /**
69
+ * indexOf-based depth scanner (no regex, no allocations): walks `text`
70
+ * adjusting `depth` for <tag ...> / </tag> occurrences of the SAME tag.
71
+ * Self-closing <tag ... /> forms do not alter depth.
72
+ * @returns [newDepth, endIndex] where endIndex is the position right after
73
+ * the '>' that balanced the element, or -1 when still open.
74
+ */
75
+ private static scanHtmlDepth;
76
+ /** A tag token must be followed by whitespace, '/', '>' or end of line. */
77
+ private static isTagBoundary;
78
+ /**
79
+ * Re-injects the remainder of a partially consumed line so the main loop
80
+ * processes it as markdown. Returns the index the loop should resume from.
81
+ */
82
+ private static pushBack;
83
+ /**
84
+ * Emits a raw HTML block starting at `hit.index` of lines[i], consuming
85
+ * following lines until the element is balanced. Text after the block on
86
+ * the closing line is pushed back for markdown processing.
87
+ * @returns the index of the last consumed line
88
+ */
89
+ private static emitHtmlBlock;
90
+ private static parseBlocks;
91
+ /** Matches "- item", "* item", "+ item", "1. item", "1) item" with leading indent. */
92
+ private static readonly listItemRe;
93
+ /**
94
+ * Gathers the contiguous list block starting at `start`, builds it (with
95
+ * nesting) and returns [html, indexOfLastConsumedLine].
96
+ */
97
+ private static parseList;
98
+ private static buildList;
99
+ private static tableAligns;
100
+ private static tableRow;
101
+ /**
102
+ * Applies inline markdown to a single text segment.
103
+ * Generated HTML (code, links, images, autolinks) is stashed behind \u0000
104
+ * placeholders so later regex passes can never corrupt it.
105
+ */
106
+ private static inline;
107
+ /** Escapes quotes for safe interpolation inside a double-quoted HTML attribute. */
108
+ private static escapeAttr;
109
+ /** Escapes &, <, > and " for safe HTML interpolation. */
110
+ private static escape;
111
+ /**
112
+ * Returns a sanitized URL or undefined when the scheme is dangerous.
113
+ * Blocks javascript:, vbscript: and data: (also when obfuscated with
114
+ * whitespace/control characters, e.g. "java\tscript:").
115
+ */
116
+ private static safeUrl;
117
+ /**
118
+ * Copies markdown content to the clipboard in two flavors:
119
+ * - text/html : the rendered HTML (rich paste into Word, Outlook, Gmail...)
120
+ * - text/plain : the original markdown source (paste into editors, IDEs...)
121
+ * @param markdown : the markdown source
122
+ * @param options : conversion options for the HTML flavor
123
+ * @returns : true on success
124
+ */
125
+ static copyToClipboard(markdown?: string, options?: MarkdownOptions): Promise<boolean>;
126
+ /**
127
+ * Copies plain text (e.g. the content of a single code block) to the clipboard.
128
+ * @param text : the text to copy
129
+ * @returns : true on success
130
+ */
131
+ static copyText(text?: string): Promise<boolean>;
132
+ /**
133
+ * Extracts the visible plain text from a rendered element
134
+ * (what the user sees, entities already decoded by the browser).
135
+ * @param element : the element hosting the rendered markdown
136
+ * @returns : the plain text
137
+ */
138
+ static elementToText(element: HTMLElement): string;
139
+ }
140
+
141
+ /**
142
+ * Pipe that converts a Markdown string to sanitized HTML using `MarkdownUtils.toHtml`.
143
+ *
144
+ * Usage: `{{ text | formatMarkdown }}`
145
+ */
146
+ declare class FormatMarkdownPipe implements PipeTransform {
147
+ private readonly sanitizer;
148
+ /**
149
+ * Transforms a Markdown string into sanitized HTML.
150
+ * @param value - The Markdown input to convert. Treated as an empty string when `undefined`.
151
+ * @returns A `SafeHtml` value that can be rendered with `[innerHTML]`.
152
+ */
153
+ transform(value?: string): SafeHtml;
154
+ static ɵfac: i0.ɵɵFactoryDeclaration<FormatMarkdownPipe, never>;
155
+ static ɵpipe: i0.ɵɵPipeDeclaration<FormatMarkdownPipe, "formatMarkdown", true>;
156
+ }
157
+
158
+ export { FormatMarkdownPipe, MarkdownUtils };
159
+ export type { MarkdownOptions };