@maizzle/framework 6.0.0-rc.3 → 6.0.0-rc.5

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 (52) hide show
  1. package/dist/build.mjs +3 -2
  2. package/dist/build.mjs.map +1 -1
  3. package/dist/components/Button.vue +65 -14
  4. package/dist/components/CodeBlock.vue +75 -0
  5. package/dist/components/CodeInline.vue +44 -0
  6. package/dist/components/Preview.vue +20 -0
  7. package/dist/composables/renderContext.d.mts +5 -0
  8. package/dist/composables/renderContext.d.mts.map +1 -1
  9. package/dist/composables/renderContext.mjs.map +1 -1
  10. package/dist/composables/usePreviewText.d.mts +24 -0
  11. package/dist/composables/usePreviewText.d.mts.map +1 -0
  12. package/dist/composables/usePreviewText.mjs +29 -0
  13. package/dist/composables/usePreviewText.mjs.map +1 -0
  14. package/dist/index.d.mts +3 -2
  15. package/dist/index.mjs +2 -1
  16. package/dist/render/createRenderer.d.mts +1 -0
  17. package/dist/render/createRenderer.d.mts.map +1 -1
  18. package/dist/render/createRenderer.mjs +60 -1
  19. package/dist/render/createRenderer.mjs.map +1 -1
  20. package/dist/render/index.mjs +3 -2
  21. package/dist/render/index.mjs.map +1 -1
  22. package/dist/serve.d.mts.map +1 -1
  23. package/dist/serve.mjs +31 -20
  24. package/dist/serve.mjs.map +1 -1
  25. package/dist/server/ui/pages/Preview.vue +11 -5
  26. package/dist/transformers/entities.d.mts.map +1 -1
  27. package/dist/transformers/entities.mjs +3 -0
  28. package/dist/transformers/entities.mjs.map +1 -1
  29. package/dist/transformers/filters/defaults.d.mts +6 -0
  30. package/dist/transformers/filters/defaults.d.mts.map +1 -0
  31. package/dist/transformers/filters/defaults.mjs +78 -0
  32. package/dist/transformers/filters/defaults.mjs.map +1 -0
  33. package/dist/transformers/filters/index.d.mts +22 -0
  34. package/dist/transformers/filters/index.d.mts.map +1 -0
  35. package/dist/transformers/filters/index.mjs +67 -0
  36. package/dist/transformers/filters/index.mjs.map +1 -0
  37. package/dist/transformers/index.d.mts +9 -8
  38. package/dist/transformers/index.d.mts.map +1 -1
  39. package/dist/transformers/index.mjs +15 -10
  40. package/dist/transformers/index.mjs.map +1 -1
  41. package/dist/transformers/tailwindcss.d.mts +6 -2
  42. package/dist/transformers/tailwindcss.d.mts.map +1 -1
  43. package/dist/transformers/tailwindcss.mjs +49 -21
  44. package/dist/transformers/tailwindcss.mjs.map +1 -1
  45. package/dist/types/config.d.mts +373 -14
  46. package/dist/types/config.d.mts.map +1 -1
  47. package/dist/types/index.d.mts +2 -2
  48. package/dist/utils/ast/serializer.d.mts +3 -2
  49. package/dist/utils/ast/serializer.d.mts.map +1 -1
  50. package/dist/utils/ast/serializer.mjs +24 -0
  51. package/dist/utils/ast/serializer.mjs.map +1 -1
  52. package/package.json +1 -1
@@ -4,62 +4,282 @@ import * as unplugin_vue_markdown_types0 from "unplugin-vue-markdown/types";
4
4
 
5
5
  //#region src/types/config.d.ts
6
6
  interface UrlQueryOptions {
7
+ /**
8
+ * CSS selectors for elements to process.
9
+ *
10
+ * @default ['a']
11
+ */
7
12
  tags?: string[];
13
+ /**
14
+ * HTML attributes containing URLs to append query params to.
15
+ *
16
+ * @default ['src', 'href', 'poster', 'srcset', 'background']
17
+ */
8
18
  attributes?: string[];
19
+ /**
20
+ * When `true`, only appends query params to absolute URLs.
21
+ *
22
+ * @default true
23
+ */
9
24
  strict?: boolean;
25
+ /**
26
+ * Options forwarded to the `query-string` library for controlling serialization.
27
+ *
28
+ * @default { encode: false }
29
+ */
10
30
  qs?: Record<string, unknown>;
11
31
  }
12
32
  type UrlQuery = Record<string, unknown> & {
13
33
  _options?: UrlQueryOptions;
14
34
  };
15
35
  interface UrlConfig {
36
+ /**
37
+ * Append query parameters to URLs in your HTML.
38
+ *
39
+ * @example
40
+ * url: {
41
+ * query: {
42
+ * utm_source: 'maizzle',
43
+ * utm_medium: 'email',
44
+ * }
45
+ * }
46
+ */
16
47
  query?: UrlQuery;
48
+ /**
49
+ * Prepend a base URL to relative paths.
50
+ *
51
+ * Pass a string to prepend to all tags, or an object for fine-grained control.
52
+ *
53
+ * @example
54
+ * url: {
55
+ * base: 'https://cdn.example.com/emails/',
56
+ * }
57
+ */
17
58
  base?: string | {
18
- url?: string;
19
- tags?: string[] | Record<string, Record<string, string | boolean>>;
20
- attributes?: Record<string, string>;
21
- styleTag?: boolean;
59
+ /** The base URL to prepend. */url?: string; /** Tags or tag-attribute map to process. */
60
+ tags?: string[] | Record<string, Record<string, string | boolean>>; /** Attributes to process. */
61
+ attributes?: Record<string, string>; /** Also apply to URLs in `<style>` tags. */
62
+ styleTag?: boolean; /** Also apply to URLs in inline `style` attributes. */
22
63
  inlineCss?: boolean;
23
64
  };
24
65
  }
25
66
  interface CssConfig {
67
+ /**
68
+ * Base directory for Tailwind CSS `@source` resolution.
69
+ *
70
+ * Automatically set to `root` when `root` is configured.
71
+ */
26
72
  base?: string;
73
+ /**
74
+ * Remove unused CSS.
75
+ *
76
+ * Set to `true` to enable with defaults, or pass an options object.
77
+ *
78
+ * @default false
79
+ */
27
80
  purge?: boolean | Record<string, unknown>;
81
+ /**
82
+ * Inline CSS from `<style>` tags into matching HTML elements.
83
+ *
84
+ * Set to `true` to enable with defaults, or pass an options object for fine-grained control.
85
+ *
86
+ * @example
87
+ * css: {
88
+ * inline: {
89
+ * removeStyleTags: true,
90
+ * applyWidthAttributes: true,
91
+ * }
92
+ * }
93
+ */
28
94
  inline?: boolean | {
95
+ /**
96
+ * Convert HTML attributes like `width`, `height`, `bgcolor`, and `valign`
97
+ * to inline CSS styles. Set to `true` for all, or pass an array of attribute names.
98
+ *
99
+ * @default false
100
+ */
29
101
  attributeToStyle?: boolean | string[];
102
+ /**
103
+ * Remove `<style>` tags after inlining.
104
+ *
105
+ * @default false
106
+ */
30
107
  removeStyleTags?: boolean;
108
+ /**
109
+ * Remove selectors from `<style>` tags after they have been inlined.
110
+ *
111
+ * @default true
112
+ */
31
113
  removeInlinedSelectors?: boolean;
114
+ /**
115
+ * Convert `0px`, `0em` etc. to `0` in inline styles.
116
+ *
117
+ * @default true
118
+ */
32
119
  preferUnitlessValues?: boolean;
120
+ /**
121
+ * CSS selectors to preserve in `<style>` tags, even after inlining.
122
+ *
123
+ * @default []
124
+ */
33
125
  safelist?: string[];
126
+ /**
127
+ * Duplicate CSS properties to HTML attributes.
128
+ *
129
+ * @default {}
130
+ *
131
+ * @example
132
+ * styleToAttribute: {
133
+ * 'background-color': 'bgcolor',
134
+ * }
135
+ */
34
136
  styleToAttribute?: Record<string, string>;
137
+ /**
138
+ * Add `width` HTML attributes based on inline CSS width values.
139
+ *
140
+ * @default true
141
+ */
35
142
  applyWidthAttributes?: boolean;
143
+ /**
144
+ * Add `height` HTML attributes based on inline CSS height values.
145
+ *
146
+ * @default true
147
+ */
36
148
  applyHeightAttributes?: boolean;
149
+ /**
150
+ * Elements that can receive `width` HTML attributes.
151
+ *
152
+ * @default ['img', 'video']
153
+ */
37
154
  widthElements?: string[];
155
+ /**
156
+ * Elements that can receive `height` HTML attributes.
157
+ *
158
+ * @default ['img', 'video']
159
+ */
38
160
  heightElements?: string[];
161
+ /**
162
+ * CSS properties to exclude from inlining.
163
+ *
164
+ * @default []
165
+ */
39
166
  excludedProperties?: string[];
167
+ /**
168
+ * Template language code blocks to preserve during inlining.
169
+ *
170
+ * @default { EJS: { start: '<%', end: '%>' }, HBS: { start: '\{\{', end: '}}' } }
171
+ */
40
172
  codeBlocks?: Record<string, {
41
173
  start: string;
42
174
  end: string;
43
175
  }>;
176
+ /**
177
+ * Additional CSS string to inline alongside `<style>` tag contents.
178
+ */
44
179
  customCSS?: string;
45
- [key: string]: unknown;
46
180
  };
181
+ /**
182
+ * Merge duplicate `@media` queries and sort them.
183
+ *
184
+ * Enabled by default. Set to `false` to disable, or pass an object to control sort order.
185
+ *
186
+ * @default true
187
+ *
188
+ * @example
189
+ * css: {
190
+ * media: { sort: 'desktop-first' },
191
+ * }
192
+ */
47
193
  media?: boolean | {
194
+ /**
195
+ * Sort order for media queries.
196
+ *
197
+ * @default 'mobile-first'
198
+ */
48
199
  sort?: 'mobile-first' | 'desktop-first' | ((a: string, b: string) => number);
49
200
  };
201
+ /**
202
+ * Convert unitless CSS values to their unitless equivalents.
203
+ *
204
+ * For example, `line-height: 24px` with a `16px` font becomes `line-height: 1.5`.
205
+ *
206
+ * @default true
207
+ */
50
208
  preferUnitless?: boolean;
209
+ /**
210
+ * Resolve CSS `calc()` expressions to static values where possible.
211
+ *
212
+ * @default true
213
+ */
51
214
  resolveCalc?: boolean;
215
+ /**
216
+ * Resolve CSS custom properties (`var()`) to their computed values.
217
+ *
218
+ * @default true
219
+ */
52
220
  resolveProps?: boolean;
221
+ /**
222
+ * Replace unsafe CSS class names with email-safe equivalents.
223
+ *
224
+ * @default true
225
+ */
53
226
  safe?: boolean | Record<string, string>;
54
- sixHex?: boolean;
227
+ /**
228
+ * Rewrite longhand CSS to shorthand where possible.
229
+ *
230
+ * For example, `padding: 10px 20px 10px 20px` becomes `padding: 10px 20px`.
231
+ *
232
+ * @default false
233
+ */
55
234
  shorthand?: boolean | {
56
235
  tags?: string[];
57
236
  };
237
+ /**
238
+ * Remove specific CSS declarations by selector.
239
+ *
240
+ * @example
241
+ * css: {
242
+ * removeDeclarations: {
243
+ * ':root': '*',
244
+ * }
245
+ * }
246
+ */
58
247
  removeDeclarations?: Record<string, RemoveValue>;
248
+ /**
249
+ * File paths to exclude from CSS processing.
250
+ *
251
+ * @example
252
+ * css: {
253
+ * exclude: ['emails/amp/**'],
254
+ * }
255
+ */
59
256
  exclude?: string[];
60
257
  }
61
258
  interface AttributesConfig {
259
+ /**
260
+ * Add attributes to HTML elements.
261
+ *
262
+ * @example
263
+ * html: {
264
+ * attributes: {
265
+ * add: {
266
+ * table: { cellpadding: 0, cellspacing: 0, role: 'none' },
267
+ * img: { alt: '' },
268
+ * }
269
+ * }
270
+ * }
271
+ */
62
272
  add?: false | Record<string, Record<string, string | boolean | number>>;
273
+ /**
274
+ * Remove attributes from HTML elements by name or name-value pair.
275
+ *
276
+ * @example
277
+ * html: {
278
+ * attributes: {
279
+ * remove: ['data-test', { name: 'class', value: /^js-/ }],
280
+ * }
281
+ * }
282
+ */
63
283
  remove?: Array<string | {
64
284
  name: string;
65
285
  value?: string | RegExp;
@@ -67,77 +287,216 @@ interface AttributesConfig {
67
287
  }
68
288
  type EntitiesConfig = boolean | Record<string, string>;
69
289
  interface PostcssConfig {
70
- /** Selector prefixes to strip from compiled CSS (e.g. ':host', ':lang'). */
290
+ /**
291
+ * Selector prefixes to strip from compiled CSS.
292
+ *
293
+ * @default [':host', ':lang']
294
+ *
295
+ * @example
296
+ * postcss: {
297
+ * removeSelectors: [':host', ':lang', ':root'],
298
+ * }
299
+ */
71
300
  removeSelectors?: string[];
72
- /** At-rule names to strip from compiled CSS (e.g. '@layer', '@property'). */
301
+ /**
302
+ * At-rule names to strip from compiled CSS.
303
+ *
304
+ * @default ['layer', 'property']
305
+ *
306
+ * @example
307
+ * postcss: {
308
+ * removeAtRules: ['layer', 'property', 'charset'],
309
+ * }
310
+ */
73
311
  removeAtRules?: string[];
74
- [key: string]: unknown;
75
312
  }
76
313
  interface HtmlConfig {
314
+ /** Configure HTML attribute transformations. */
77
315
  attributes?: AttributesConfig;
316
+ /**
317
+ * Decode HTML entities.
318
+ *
319
+ * Set to `true` to decode all, or pass a map of entities to decode.
320
+ *
321
+ * @default true
322
+ */
78
323
  decodeEntities?: EntitiesConfig;
324
+ /**
325
+ * Pretty-print the HTML output.
326
+ *
327
+ * Set to `true` to enable with defaults, or pass options.
328
+ */
79
329
  format?: boolean | oxfmt.FormatOptions;
330
+ /**
331
+ * Minify the HTML output.
332
+ *
333
+ * Set to `true` to enable with defaults, or pass options.
334
+ */
80
335
  minify?: boolean | Record<string, unknown>;
81
336
  }
337
+ type FilterFunction = (str: string, value: string) => string;
338
+ type FiltersConfig = false | Record<string, FilterFunction>;
82
339
  interface MaizzleConfig {
83
340
  /**
84
341
  * Root directory for the Maizzle email project.
85
342
  *
86
- * When set, relative paths for `content`, `static.source`, component
87
- * auto-import directories, `.d.ts` output, and `css.base` are all
88
- * resolved relative to this directory.
343
+ * When set, relative paths for `content`, `static.source`,
344
+ * and `css.base` are all resolved relative to this directory.
89
345
  *
90
346
  * Defaults to `process.cwd()`.
91
347
  *
92
348
  * @example
93
- * // In a Laravel app where emails live under resources/js/emails:
94
349
  * maizzle({
95
350
  * root: 'resources/js/emails',
96
351
  * content: ['./**\/*.vue'],
97
352
  * })
98
353
  */
99
354
  root?: string;
355
+ /** Options passed to `unplugin-vue-markdown` for Markdown template support. */
100
356
  markdown?: unplugin_vue_markdown_types0.Options;
357
+ /**
358
+ * Glob patterns for email template files to process.
359
+ *
360
+ * Resolved relative to `root`.
361
+ *
362
+ * @default ['emails/**\/*.{vue,md}']
363
+ */
101
364
  content?: string[];
365
+ /** Output configuration for built email templates. */
102
366
  output?: {
367
+ /**
368
+ * Directory to write compiled HTML files to.
369
+ *
370
+ * @default 'dist'
371
+ */
103
372
  path?: string;
373
+ /**
374
+ * File extension for compiled templates.
375
+ *
376
+ * @default 'html'
377
+ *
378
+ * @example
379
+ * output: {
380
+ * extension: 'blade.php',
381
+ * }
382
+ */
104
383
  extension?: string;
105
384
  };
385
+ /** Static file copying configuration. */
106
386
  static?: {
387
+ /**
388
+ * Glob patterns for static files to copy to the output directory.
389
+ *
390
+ * @default ['public/**\/*.*']
391
+ */
107
392
  source?: string[];
393
+ /**
394
+ * Subdirectory in the output folder where static files are placed.
395
+ *
396
+ * @default 'public'
397
+ */
108
398
  destination?: string;
109
399
  };
400
+ /** Component auto-import configuration. */
110
401
  components?: {
402
+ /**
403
+ * Additional directories to scan for auto-imported Vue components.
404
+ *
405
+ * Resolved relative to `cwd` (not `root`), so paths outside the
406
+ * email root directory work as expected.
407
+ *
408
+ * @example
409
+ * components: {
410
+ * source: ['resources/js/components/email'],
411
+ * }
412
+ */
111
413
  source?: string | string[];
112
414
  };
415
+ /** Dev server configuration. */
113
416
  server?: {
417
+ /**
418
+ * Port for the dev server.
419
+ *
420
+ * @default 3000
421
+ */
114
422
  port?: number;
423
+ /**
424
+ * Additional file paths to watch for changes.
425
+ *
426
+ * @default []
427
+ *
428
+ * @example
429
+ * server: {
430
+ * watch: ['./tailwind.config.ts'],
431
+ * }
432
+ */
115
433
  watch?: string[];
116
434
  };
435
+ /** Tailwind CSS and email CSS optimization settings. */
117
436
  css?: CssConfig;
437
+ /**
438
+ * Generate a plaintext version of the email.
439
+ *
440
+ * Set to `true` to enable, or pass a string path or options object.
441
+ *
442
+ * @default false
443
+ */
118
444
  plaintext?: boolean | string | Record<string, unknown>;
445
+ /** PostCSS processing options. */
119
446
  postcss?: PostcssConfig;
447
+ /**
448
+ * Enable the transformer pipeline (CSS inlining, purging, shorthand, etc).
449
+ *
450
+ * @default true
451
+ */
120
452
  useTransformers?: boolean;
453
+ /**
454
+ * Replace strings in the final HTML output.
455
+ *
456
+ * @example
457
+ * replaceStrings: {
458
+ * '{{ year }}': new Date().getFullYear().toString(),
459
+ * }
460
+ */
121
461
  replaceStrings?: Record<string, string>;
462
+ /**
463
+ * Content filters that transform text inside HTML elements using custom attributes.
464
+ *
465
+ * Set to `false` to disable all filters. Pass an object to add custom filters
466
+ * (merged with built-in defaults).
467
+ *
468
+ * @example
469
+ * filters: {
470
+ * uppercase: str => str.toUpperCase(),
471
+ * }
472
+ */
473
+ filters?: FiltersConfig;
474
+ /** URL transformation settings (base URL, query string appending). */
122
475
  url?: UrlConfig;
476
+ /** HTML post-processing settings (attributes, formatting, minification). */
123
477
  html?: HtmlConfig;
478
+ /** Called before any templates are processed. */
124
479
  beforeCreate?: (params: {
125
480
  config: MaizzleConfig;
126
481
  }) => void | Promise<void>;
482
+ /** Called before each template is rendered. Return a string to replace the template source. */
127
483
  beforeRender?: (params: {
128
484
  config: MaizzleConfig;
129
485
  template: string;
130
486
  }) => string | void | Promise<string | void>;
487
+ /** Called after each template is rendered but before transformers run. Return a string to replace the output HTML. */
131
488
  afterRender?: (params: {
132
489
  config: MaizzleConfig;
133
490
  template: string;
134
491
  html: string;
135
492
  }) => string | void | Promise<string | void>;
493
+ /** Called after transformers have run on each template. Return a string to replace the output HTML. */
136
494
  afterTransform?: (params: {
137
495
  config: MaizzleConfig;
138
496
  template: string;
139
497
  html: string;
140
498
  }) => string | void | Promise<string | void>;
499
+ /** Called after all templates have been built. */
141
500
  afterBuild?: (params: {
142
501
  files: string[];
143
502
  config: MaizzleConfig;
@@ -145,5 +504,5 @@ interface MaizzleConfig {
145
504
  [key: string]: any;
146
505
  }
147
506
  //#endregion
148
- export { AttributesConfig, CssConfig, EntitiesConfig, HtmlConfig, MaizzleConfig, PostcssConfig, UrlConfig, UrlQuery, UrlQueryOptions };
507
+ export { AttributesConfig, CssConfig, EntitiesConfig, FilterFunction, FiltersConfig, HtmlConfig, MaizzleConfig, PostcssConfig, UrlConfig, UrlQuery, UrlQueryOptions };
149
508
  //# sourceMappingURL=config.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.mts","names":[],"sources":["../../src/types/config.ts"],"mappings":";;;;;UAAiB,eAAA;EACf,IAAA;EACA,UAAA;EACA,MAAA;EACA,EAAA,GAAK,MAAA;AAAA;AAAA,KAGK,QAAA,GAAW,MAAA;EACrB,QAAA,GAAW,eAAA;AAAA;AAAA,UAGI,SAAA;EACf,KAAA,GAAQ,QAAA;EACR,IAAA;IACE,GAAA;IACA,IAAA,cAAkB,MAAA,SAAe,MAAA;IACjC,UAAA,GAAa,MAAA;IACb,QAAA;IACA,SAAA;EAAA;AAAA;AAAA,UAIa,SAAA;EACf,IAAA;EACA,KAAA,aAAkB,MAAA;EAClB,MAAA;IACE,gBAAA;IACA,eAAA;IACA,sBAAA;IACA,oBAAA;IACA,QAAA;IACA,gBAAA,GAAmB,MAAA;IACnB,oBAAA;IACA,qBAAA;IACA,aAAA;IACA,cAAA;IACA,kBAAA;IACA,UAAA,GAAa,MAAA;MAAiB,KAAA;MAAe,GAAA;IAAA;IAC7C,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AA;EAAA;;EAGF,MAAA;;;;;;IAME,IAAA;;;;;;;;;;;IAWA,KAAA;EAAA;;EAGF,GAAA,GAAM,SAAA;;;;;;;;EAQN,SAAA,sBAA+B,MAAA;;EAE/B,OAAA,GAAU,aAAA;;;;;;EAMV,eAAA;;;;;;;;;EASA,cAAA,GAAiB,MAAA;;;;;;;;;;;;EAYjB,OAAA,GAAU,aAAA;;EAEV,GAAA,GAAM,SAAA;;EAEN,IAAA,GAAO,UAAA;;EAKP,YAAA,IAAgB,MAAA;IAAU,MAAA,EAAQ,aAAA;EAAA,aAA2B,OAAA;;EAE7D,YAAA,IAAgB,MAAA;IAAU,MAAA,EAAQ,aAAA;IAAe,QAAA;EAAA,sBAAuC,OAAA;;EAExF,WAAA,IAAe,MAAA;IAAU,MAAA,EAAQ,aAAA;IAAe,QAAA;IAAkB,IAAA;EAAA,sBAAmC,OAAA;;EAErG,cAAA,IAAkB,MAAA;IAAU,MAAA,EAAQ,aAAA;IAAe,QAAA;IAAkB,IAAA;EAAA,sBAAmC,OAAA;;EAExG,UAAA,IAAc,MAAA;IAAU,KAAA;IAAiB,MAAA,EAAQ,aAAA;EAAA,aAA2B,OAAA;EAAA,CAG3E,GAAA;AAAA"}
@@ -1,2 +1,2 @@
1
- import { AttributesConfig, CssConfig, EntitiesConfig, HtmlConfig, MaizzleConfig, PostcssConfig, UrlConfig, UrlQuery, UrlQueryOptions } from "./config.mjs";
2
- export { type AttributesConfig, type CssConfig, type EntitiesConfig, type HtmlConfig, type MaizzleConfig, type PostcssConfig, type UrlConfig, type UrlQuery, type UrlQueryOptions };
1
+ import { AttributesConfig, CssConfig, EntitiesConfig, FilterFunction, FiltersConfig, HtmlConfig, MaizzleConfig, PostcssConfig, UrlConfig, UrlQuery, UrlQueryOptions } from "./config.mjs";
2
+ export { type AttributesConfig, type CssConfig, type EntitiesConfig, type FilterFunction, type FiltersConfig, type HtmlConfig, type MaizzleConfig, type PostcssConfig, type UrlConfig, type UrlQuery, type UrlQueryOptions };
@@ -1,7 +1,8 @@
1
- import { ChildNode, DomHandlerOptions } from "domhandler";
1
+ import { ChildNode } from "domhandler";
2
+ import { DomSerializerOptions } from "dom-serializer";
2
3
 
3
4
  //#region src/utils/ast/serializer.d.ts
4
- declare function serialize(dom: ChildNode[], options?: DomHandlerOptions): string;
5
+ declare function serialize(dom: ChildNode[], options?: DomSerializerOptions): string;
5
6
  //#endregion
6
7
  export { serialize };
7
8
  //# sourceMappingURL=serializer.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"serializer.d.mts","names":[],"sources":["../../../src/utils/ast/serializer.ts"],"mappings":";;;iBAGgB,SAAA,CAAU,GAAA,EAAK,SAAA,IAAa,OAAA,GAAU,iBAAA"}
1
+ {"version":3,"file":"serializer.d.mts","names":[],"sources":["../../../src/utils/ast/serializer.ts"],"mappings":";;;;iBA6BgB,SAAA,CAAU,GAAA,EAAK,SAAA,IAAa,OAAA,GAAU,oBAAA"}
@@ -1,7 +1,31 @@
1
+ import { walk } from "./walker.mjs";
1
2
  import render from "dom-serializer";
2
3
 
3
4
  //#region src/utils/ast/serializer.ts
5
+ /**
6
+ * Re-encode < and > as entities in text nodes inside <code> elements.
7
+ *
8
+ * The DOM parser decodes entities like &#x3C; into raw < in text nodes.
9
+ * With encodeEntities: false the serializer outputs them as-is, which
10
+ * creates broken HTML (e.g. </a> inside a code block closes the real tag).
11
+ *
12
+ * We selectively fix this for <code> contents only, so the rest of the
13
+ * document (where encodeEntities: false is needed) is unaffected.
14
+ */
15
+ function encodeCodeTextNodes(dom) {
16
+ walk(dom, (node) => {
17
+ const el = node;
18
+ if (el.name !== "code") return;
19
+ walk(el.children ?? [], (child) => {
20
+ if (child.type === "text") {
21
+ const text = child;
22
+ text.data = text.data.replace(/</g, "&lt;").replace(/>/g, "&gt;");
23
+ }
24
+ });
25
+ });
26
+ }
4
27
  function serialize(dom, options) {
28
+ encodeCodeTextNodes(dom);
5
29
  return render(dom, {
6
30
  encodeEntities: false,
7
31
  ...options
@@ -1 +1 @@
1
- {"version":3,"file":"serializer.mjs","names":[],"sources":["../../../src/utils/ast/serializer.ts"],"sourcesContent":["import render from 'dom-serializer'\nimport type { ChildNode, DomHandlerOptions } from 'domhandler'\n\nexport function serialize(dom: ChildNode[], options?: DomHandlerOptions): string {\n return render(dom, { encodeEntities: false, ...options })\n}\n"],"mappings":";;;AAGA,SAAgB,UAAU,KAAkB,SAAqC;AAC/E,QAAO,OAAO,KAAK;EAAE,gBAAgB;EAAO,GAAG;EAAS,CAAC"}
1
+ {"version":3,"file":"serializer.mjs","names":[],"sources":["../../../src/utils/ast/serializer.ts"],"sourcesContent":["import render from 'dom-serializer'\nimport type { ChildNode } from 'domhandler'\nimport type { DomSerializerOptions } from 'dom-serializer'\nimport { walk } from './walker.ts'\n\n/**\n * Re-encode < and > as entities in text nodes inside <code> elements.\n *\n * The DOM parser decodes entities like &#x3C; into raw < in text nodes.\n * With encodeEntities: false the serializer outputs them as-is, which\n * creates broken HTML (e.g. </a> inside a code block closes the real tag).\n *\n * We selectively fix this for <code> contents only, so the rest of the\n * document (where encodeEntities: false is needed) is unaffected.\n */\nfunction encodeCodeTextNodes(dom: ChildNode[]): void {\n walk(dom, (node) => {\n const el = node as import('domhandler').Element\n if (el.name !== 'code') return\n\n walk(el.children ?? [], (child) => {\n if (child.type === 'text') {\n const text = child as import('domhandler').Text\n text.data = text.data.replace(/</g, '&lt;').replace(/>/g, '&gt;')\n }\n })\n })\n}\n\nexport function serialize(dom: ChildNode[], options?: DomSerializerOptions): string {\n encodeCodeTextNodes(dom)\n return render(dom, { encodeEntities: false, ...options })\n}\n"],"mappings":";;;;;;;;;;;;;;AAeA,SAAS,oBAAoB,KAAwB;AACnD,MAAK,MAAM,SAAS;EAClB,MAAM,KAAK;AACX,MAAI,GAAG,SAAS,OAAQ;AAExB,OAAK,GAAG,YAAY,EAAE,GAAG,UAAU;AACjC,OAAI,MAAM,SAAS,QAAQ;IACzB,MAAM,OAAO;AACb,SAAK,OAAO,KAAK,KAAK,QAAQ,MAAM,OAAO,CAAC,QAAQ,MAAM,OAAO;;IAEnE;GACF;;AAGJ,SAAgB,UAAU,KAAkB,SAAwC;AAClF,qBAAoB,IAAI;AACxB,QAAO,OAAO,KAAK;EAAE,gBAAgB;EAAO,GAAG;EAAS,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maizzle/framework",
3
- "version": "6.0.0-rc.3",
3
+ "version": "6.0.0-rc.5",
4
4
  "description": "Maizzle is a framework that helps you quickly build HTML emails with Tailwind CSS.",
5
5
  "license": "MIT",
6
6
  "type": "module",