@limetech/lime-elements 40.12.0 → 40.12.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 (69) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/cjs/{checkbox.template-CoNVC4Nf.js → checkbox.template-_WUgtMJy.js} +2 -2
  3. package/dist/cjs/lime-elements.cjs.js +1 -1
  4. package/dist/cjs/limel-breadcrumbs_6.cjs.entry.js +5 -10
  5. package/dist/cjs/limel-checkbox.cjs.entry.js +1 -1
  6. package/dist/cjs/limel-chip-set.cjs.entry.js +8 -3
  7. package/dist/cjs/limel-code-editor.cjs.entry.js +1 -2
  8. package/dist/cjs/limel-color-picker.cjs.entry.js +1 -1
  9. package/dist/cjs/limel-file-viewer.cjs.entry.js +75 -12
  10. package/dist/cjs/limel-helper-line_3.cjs.entry.js +3 -3
  11. package/dist/cjs/limel-list-item.cjs.entry.js +1 -1
  12. package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +280 -121
  13. package/dist/cjs/limel-select.cjs.entry.js +8 -3
  14. package/dist/cjs/limel-text-editor.cjs.entry.js +4 -7
  15. package/dist/cjs/loader.cjs.js +1 -1
  16. package/dist/collection/components/checkbox/checkbox.template.js +2 -2
  17. package/dist/collection/components/chip-set/chip-set.js +8 -3
  18. package/dist/collection/components/code-editor/code-editor.js +1 -2
  19. package/dist/collection/components/color-picker/color-picker.js +3 -3
  20. package/dist/collection/components/date-picker/date-picker.js +2 -2
  21. package/dist/collection/components/helper-line/helper-line.css +10 -14
  22. package/dist/collection/components/helper-line/helper-line.js +9 -6
  23. package/dist/collection/components/input-field/input-field.js +7 -12
  24. package/dist/collection/components/select/select.template.js +8 -3
  25. package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js +196 -4
  26. package/dist/collection/components/text-editor/text-editor.js +5 -7
  27. package/dist/esm/{checkbox.template-IDyv2bgn.js → checkbox.template-BFL4SMzl.js} +2 -2
  28. package/dist/esm/lime-elements.js +1 -1
  29. package/dist/esm/limel-breadcrumbs_6.entry.js +5 -10
  30. package/dist/esm/limel-checkbox.entry.js +1 -1
  31. package/dist/esm/limel-chip-set.entry.js +8 -3
  32. package/dist/esm/limel-code-editor.entry.js +1 -2
  33. package/dist/esm/limel-color-picker.entry.js +1 -1
  34. package/dist/esm/limel-file-viewer.entry.js +75 -12
  35. package/dist/esm/limel-helper-line_3.entry.js +3 -3
  36. package/dist/esm/limel-list-item.entry.js +1 -1
  37. package/dist/esm/limel-prosemirror-adapter.entry.js +280 -121
  38. package/dist/esm/limel-select.entry.js +8 -3
  39. package/dist/esm/limel-text-editor.entry.js +4 -7
  40. package/dist/esm/loader.js +1 -1
  41. package/dist/lime-elements/lime-elements.esm.js +1 -1
  42. package/dist/lime-elements/p-06850418.entry.js +1 -0
  43. package/dist/lime-elements/p-074275f4.entry.js +1 -0
  44. package/dist/lime-elements/p-1qqvOwzC.js +1 -0
  45. package/dist/lime-elements/p-236743f1.entry.js +1 -0
  46. package/dist/lime-elements/p-2528f75e.entry.js +159 -0
  47. package/dist/lime-elements/{p-cf6fab84.entry.js → p-43c36a02.entry.js} +1 -1
  48. package/dist/lime-elements/{p-7a2e0e18.entry.js → p-675a7469.entry.js} +1 -1
  49. package/dist/lime-elements/{p-9b1934fb.entry.js → p-90286e5c.entry.js} +1 -1
  50. package/dist/lime-elements/p-92fab922.entry.js +23 -0
  51. package/dist/lime-elements/p-b609552e.entry.js +1 -0
  52. package/dist/lime-elements/{p-14aff731.entry.js → p-c492af1b.entry.js} +1 -1
  53. package/dist/lime-elements/{p-e247e9fe.entry.js → p-fb15f608.entry.js} +1 -1
  54. package/dist/types/components/chip-set/chip-set.d.ts +2 -0
  55. package/dist/types/components/color-picker/color-picker.d.ts +10 -3
  56. package/dist/types/components/date-picker/date-picker.d.ts +11 -2
  57. package/dist/types/components/helper-line/helper-line.d.ts +7 -3
  58. package/dist/types/components/input-field/input-field.d.ts +10 -2
  59. package/dist/types/components/text-editor/prosemirror-adapter/prosemirror-adapter.d.ts +34 -0
  60. package/dist/types/components/text-editor/text-editor.d.ts +1 -3
  61. package/dist/types/components.d.ts +91 -22
  62. package/package.json +3 -3
  63. package/dist/lime-elements/p-25d0d06b.entry.js +0 -159
  64. package/dist/lime-elements/p-5a15606a.entry.js +0 -1
  65. package/dist/lime-elements/p-732e7807.entry.js +0 -23
  66. package/dist/lime-elements/p-9ed21407.entry.js +0 -1
  67. package/dist/lime-elements/p-DqQOawxc.js +0 -1
  68. package/dist/lime-elements/p-b69af611.entry.js +0 -1
  69. package/dist/lime-elements/p-ec74a07a.entry.js +0 -1
@@ -1056,6 +1056,8 @@ class QPDecoder {
1056
1056
  // single byte charset, read as windows-1252 rather than as replacement characters, see
1057
1057
  // decodeUtf8OrWindows1252.
1058
1058
  const headerDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
1059
+ // number of pieces decodeFlowedText collects before joining them
1060
+ const FLOWED_JOIN_INTERVAL = 4096;
1059
1061
  // Trims only the whitespace RFC 5322 allows around a field name. String.prototype.trim
1060
1062
  // also strips U+00A0, U+FEFF, U+2028 and the rest of the Unicode spaces, which turns a
1061
1063
  // line that a strict parser rejects into a canonical field name: a `From:` line with a
@@ -1424,16 +1426,23 @@ class MimeNode {
1424
1426
  // written, so a fixed quoted line comes out exactly as it went in. An unquoted stuffed
1425
1427
  // line loses its stuffing, which is all the stuffing is for.
1426
1428
  decodeFlowedText(str, delSp) {
1427
- // Pieces of the result, joined once at the end. Growing a single string instead
1428
- // flattens the whole paragraph again on each line, which is quadratic in the
1429
- // length of a paragraph.
1430
- const parts = [];
1429
+ // Pieces of the result. Growing a single string instead flattens the whole
1430
+ // paragraph again on each line, which is quadratic in the length of a paragraph.
1431
+ // `parts` holds an entry or two per line, so it is joined into `chunks` every few
1432
+ // thousand entries to keep memory following the length of the text rather than
1433
+ // the number of lines. Its last entry stays behind, since delsp trims it when
1434
+ // the next line continues the paragraph.
1435
+ const chunks = [];
1436
+ let parts = [];
1431
1437
  // whether the previous line was flowed, and the quote depth of its paragraph
1432
1438
  let flowed = false;
1433
1439
  let depth = 0;
1434
- const lines = str.split('\n');
1435
- for (let i = 0; i < lines.length; i++) {
1436
- const line = lines[i];
1440
+ for (let lineStart = 0; lineStart <= str.length;) {
1441
+ let lineEnd = str.indexOf('\n', lineStart);
1442
+ if (lineEnd < 0) {
1443
+ lineEnd = str.length;
1444
+ }
1445
+ const line = str.slice(lineStart, lineEnd);
1437
1446
  let quoteDepth = 0;
1438
1447
  while (line.charCodeAt(quoteDepth) === 0x3e /* > */) {
1439
1448
  quoteDepth++;
@@ -1450,15 +1459,22 @@ class MimeNode {
1450
1459
  parts.push(content);
1451
1460
  }
1452
1461
  else {
1453
- if (i) {
1462
+ if (lineStart) {
1454
1463
  parts.push('\n');
1455
1464
  }
1456
1465
  parts.push(quoteDepth ? line : content);
1457
1466
  }
1458
1467
  flowed = !isSignature && content.endsWith(' ');
1459
1468
  depth = quoteDepth;
1469
+ if (parts.length >= FLOWED_JOIN_INTERVAL) {
1470
+ const last = parts.pop();
1471
+ chunks.push(parts.join(''));
1472
+ parts = [last];
1473
+ }
1474
+ lineStart = lineEnd + 1;
1460
1475
  }
1461
- return parts.join('');
1476
+ chunks.push(parts.join(''));
1477
+ return chunks.join('');
1462
1478
  }
1463
1479
  getTextContent() {
1464
1480
  if (!this.content) {
@@ -3976,6 +3992,19 @@ function createFinder(str, regex) {
3976
3992
  return found;
3977
3993
  };
3978
3994
  }
3995
+ /**
3996
+ * Runs `process` on the text up to and including the last `>` and appends the rest as is,
3997
+ * for a pass whose every match ends at a `>`. The text after the last `>` can never match
3998
+ * and is where a failing pattern rescans to the end from each candidate.
3999
+ *
4000
+ * @param str String to process
4001
+ * @param process The pass to run
4002
+ * @return Processed string
4003
+ */
4004
+ function throughLastTag(str, process) {
4005
+ const end = str.lastIndexOf('>') + 1;
4006
+ return process(str.slice(0, end)) + str.slice(end);
4007
+ }
3979
4008
  /**
3980
4009
  * `str.replace(pattern, replacement)` for a pattern shaped like `<tag\b[^>]*>`.
3981
4010
  *
@@ -3989,8 +4018,7 @@ function createFinder(str, regex) {
3989
4018
  * @return Processed string
3990
4019
  */
3991
4020
  function replaceClosedTags(str, pattern, replacement) {
3992
- const end = str.lastIndexOf('>') + 1;
3993
- return str.slice(0, end).replace(pattern, replacement) + str.slice(end);
4021
+ return throughLastTag(str, head => head.replace(pattern, replacement));
3994
4022
  }
3995
4023
  /**
3996
4024
  * `str.replace(pattern, replacement)` for a tag pattern that may fail even when a `>`
@@ -4151,7 +4179,10 @@ function htmlToText(str) {
4151
4179
  str = stripThroughLastTag(str, /<!doctype\b/gi);
4152
4180
  str = stripFromFirstTag(str, /<\/body\b/gi);
4153
4181
  str = stripFromFirstTag(str, /<\/html\b/gi);
4154
- str = replaceTags(str, /<a\b/gi, /<a\b[^>]*href\s*=\s*["']?([^\s"']+)[^>]*>/iy, (match, href) => ` (${href}) `);
4182
+ // The href capture also matches `>`, so after a link a run with no whitespace or quote
4183
+ // is taken to the end of the input and given back one character at a time, retrying
4184
+ // `[^>]*>` to the end from each, which is quadratic when no `>` follows
4185
+ str = throughLastTag(str, head => replaceTags(head, /<a\b/gi, /<a\b[^>]*href\s*=\s*["']?([^\s"']+)[^>]*>/iy, (match, href) => ` (${href}) `));
4155
4186
  str = replaceClosedTags(str, /<\/?(span|em|i|strong|b|u|a)\b[^>]*>/gi, '');
4156
4187
  // the whitespace after the tag may run on past the last `>`
4157
4188
  str = replaceTags(str, /<li\b/gi, /<li\b[^>]*>[\n\u0001\s]*/iy, () => '* ');
@@ -5256,6 +5287,23 @@ const MAX_PART_COUNT = 10000;
5256
5287
  // so a small crafted email can exhaust memory (OOM crash). Cap the recursion and
5257
5288
  // treat deeper nested messages as regular attachments instead.
5258
5289
  const MAX_RFC822_NESTING_DEPTH = 10;
5290
+ // The From, To, Cc and Bcc of every inline message/rfc822 part are rendered into the
5291
+ // text and html of the parent, an address of one or two bytes as some 60 characters of
5292
+ // html. maxHeadersSize bounds the header bytes of each nested message on its own, so
5293
+ // without a limit counted across all of them the output grows with the number of forwards.
5294
+ const MAX_FORWARDED_ADDRESSES = 10000;
5295
+ // the number of entries the header formatters render for a list of addresses, a group
5296
+ // counted along with each of its members
5297
+ function countAddresses(addresses) {
5298
+ if (!addresses) {
5299
+ return 0;
5300
+ }
5301
+ let count = 0;
5302
+ for (const address of Array.isArray(addresses) ? addresses : [addresses]) {
5303
+ count += 1 + (address.group ? address.group.length : 0);
5304
+ }
5305
+ return count;
5306
+ }
5259
5307
  // Limit options must be validated rather than falsy-coalesced. `0` would silently
5260
5308
  // restore the default, and a string or NaN disables the limit altogether, because
5261
5309
  // every `size > limit` comparison against such a value is false. Callers that
@@ -5298,6 +5346,10 @@ class PostalMime {
5298
5346
  // It is deliberately not an option, so that forwarding a caller supplied options
5299
5347
  // object can not seed it and switch the recursion limit off.
5300
5348
  this.rfc822NestingDepth = 0;
5349
+ this.maxForwardedAddresses = parseLimitOption(this.options.maxForwardedAddresses, MAX_FORWARDED_ADDRESSES, 'maxForwardedAddresses');
5350
+ // Like rfc822NestingDepth, a nested parser gets the counter of its parent rather
5351
+ // than an option, so that the count runs across the whole message
5352
+ this.forwardedAddresses = { count: 0 };
5301
5353
  // Header bytes seen across every part of this message, see MimeNode.feed, and the
5302
5354
  // number of parts created for it, the root included, see the MimeNode constructor
5303
5355
  this.headerSize = 0;
@@ -5478,11 +5530,22 @@ class PostalMime {
5478
5530
  // is classified stay with the parser that was configured.
5479
5531
  ...this.mimeOptions,
5480
5532
  maxRfc822NestingDepth: this.maxRfc822NestingDepth,
5533
+ maxForwardedAddresses: this.maxForwardedAddresses,
5481
5534
  // attachments are encoded by the parent parser, keep raw buffers here
5482
5535
  attachmentEncoding: 'arraybuffer'
5483
5536
  });
5484
5537
  subParser.rfc822NestingDepth = this.rfc822NestingDepth + 1;
5538
+ subParser.forwardedAddresses = this.forwardedAddresses;
5485
5539
  const subMessage = (node.subMessage = await subParser.parse(node.content || new ArrayBuffer(0)));
5540
+ // counted before the header block below is rendered into the text and html
5541
+ this.forwardedAddresses.count +=
5542
+ countAddresses(subMessage.from) +
5543
+ countAddresses(subMessage.to) +
5544
+ countAddresses(subMessage.cc) +
5545
+ countAddresses(subMessage.bcc);
5546
+ if (this.forwardedAddresses.count > this.maxForwardedAddresses) {
5547
+ throw new Error(`Maximum forwarded address count of ${this.maxForwardedAddresses} addresses exceeded`);
5548
+ }
5486
5549
  // default to text if there is no content
5487
5550
  if (subMessage.text || !subMessage.html) {
5488
5551
  this.addTextEntry(node, 'plain', { type: 'subMessage', value: subMessage });
@@ -2,7 +2,7 @@ import { r as registerInstance, h, H as Host, c as createEvent, a as getElement
2
2
  import { a as MDCList, s as strings } from './component-kP1jCDLp.js';
3
3
  import './ponyfill-6YuZiAPi.js';
4
4
 
5
- const helperLineCss = () => `:host(limel-helper-line){transition:opacity 0.2s ease;box-sizing:border-box;display:grid;min-width:0;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-size:0.6875rem;line-height:normal;color:rgb(var(--contrast-1200))}div{display:flex;justify-content:space-between;gap:0.75rem;overflow:hidden;padding:0 1rem}:host(limel-helper-line.invalid){--limel-h-l-grid-template-rows-transition-speed:0.46s;--limel-h-l-grid-template-rows:1fr}:host(limel-helper-line.invalid) .helper-text{color:var(--limel-theme-error-color)}.counter{flex-shrink:0;margin-left:auto}.helper-text,.counter{padding-top:0.125rem}:host(limel-helper-line){transition:grid-template-rows var(--limel-h-l-grid-template-rows-transition-speed, 0.46s) cubic-bezier(1, 0.09, 0, 0.89);grid-template-rows:var(--limel-h-l-grid-template-rows, 1fr)}:host(limel-helper-line.hide){--limel-h-l-grid-template-rows-transition-speed:0.3s;--limel-h-l-grid-template-rows:0fr}`;
5
+ const helperLineCss = () => `limel-helper-line{box-sizing:border-box;display:grid;min-width:0;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-size:0.6875rem;line-height:normal;color:rgb(var(--contrast-1200));transition:grid-template-rows var(--limel-h-l-grid-template-rows-transition-speed, 0.46s) cubic-bezier(1, 0.09, 0, 0.89);grid-template-rows:var(--limel-h-l-grid-template-rows, 1fr)}limel-helper-line>div{display:flex;justify-content:space-between;gap:0.75rem;overflow:hidden;padding:0 1rem}limel-helper-line.invalid{--limel-h-l-grid-template-rows-transition-speed:0.46s;--limel-h-l-grid-template-rows:1fr}limel-helper-line.invalid .helper-text{color:var(--limel-theme-error-color)}limel-helper-line .counter{flex-shrink:0;margin-left:auto}limel-helper-line .helper-text,limel-helper-line .counter{padding-top:0.125rem}limel-helper-line.hide{--limel-h-l-grid-template-rows-transition-speed:0.3s;--limel-h-l-grid-template-rows:0fr}`;
6
6
 
7
7
  const HelperLine = class {
8
8
  constructor(hostRef) {
@@ -32,9 +32,9 @@ const HelperLine = class {
32
32
  };
33
33
  }
34
34
  render() {
35
- return (h(Host, { key: '69872d6dcdbecf1d703a9fb441f118f9389596bc', tabIndex: -1, class: {
35
+ return (h(Host, { key: 'ac3dcfadd4d281bf64bce4124602279eef598d87', tabIndex: -1, class: {
36
36
  invalid: this.invalid,
37
- }, style: this.hasContent() ? {} : { display: 'none' }, "aria-hidden": !this.hasContent() }, h("div", { key: 'bf63441b2481b1d91fae50d7f85630e361fb2089' }, this.renderHelperText(), this.renderCharacterCounter())));
37
+ }, style: this.hasContent() ? {} : { display: 'none' }, "aria-hidden": !this.hasContent() }, h("div", { key: '80aaa762e38841ed13a880cc5444c8aa23025130' }, this.renderHelperText(), this.renderCharacterCounter())));
38
38
  }
39
39
  };
40
40
  HelperLine.style = helperLineCss();
@@ -2,7 +2,7 @@ import { r as registerInstance, h, H as Host } from './index-BU9IJqli.js';
2
2
  import { g as getIconName } from './get-icon-props-CgNJbSP4.js';
3
3
  import { c as createRandomString } from './random-string-BrjD-ITe.js';
4
4
  import { r as renderListComponent } from './render-list-component-J1IzNpbv.js';
5
- import { C as CheckboxTemplate } from './checkbox.template-IDyv2bgn.js';
5
+ import { C as CheckboxTemplate } from './checkbox.template-BFL4SMzl.js';
6
6
  import { t as translations } from './translations-UrIr-5_D.js';
7
7
  import { I as ImageTemplate } from './image.template-BGjw97m_.js';
8
8
  import './language-ChagAaNf.js';