@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
@@ -18458,114 +18458,141 @@ function list (state, startLine, endLine, silent) {
18458
18458
  return true
18459
18459
  }
18460
18460
 
18461
- function reference (state, startLine, _endLine, silent) {
18462
- let pos = state.bMarks[startLine] + state.tShift[startLine];
18463
- let max = state.eMarks[startLine];
18464
- let nextLine = startLine + 1;
18465
-
18466
- // if it's indented more than 3 spaces, it should be a code block
18467
- if (state.sCount[startLine] - state.blkIndent >= 4) { return false }
18461
+ // CommonMark limits reference labels to 999 Unicode code points.
18462
+ const MAX_LABEL_LENGTH = 999;
18468
18463
 
18469
- if (state.src.charCodeAt(pos) !== 0x5B/* [ */) { return false }
18464
+ function countCodePoints (str) {
18465
+ let length = str.length;
18470
18466
 
18471
- function getNextLine (nextLine) {
18472
- const endLine = state.lineMax;
18467
+ for (let i = 0; i < str.length - 1; i++) {
18468
+ const high = str.charCodeAt(i);
18469
+ if (high < 0xD800 || high > 0xDBFF) { continue }
18473
18470
 
18474
- if (nextLine >= endLine || state.isEmpty(nextLine)) {
18475
- // empty line or end of input
18476
- return null
18471
+ const low = str.charCodeAt(i + 1);
18472
+ if (low >= 0xDC00 && low <= 0xDFFF) {
18473
+ length--;
18474
+ i++;
18477
18475
  }
18476
+ }
18478
18477
 
18479
- let isContinuation = false;
18478
+ return length
18479
+ }
18480
18480
 
18481
- // this would be a code block normally, but after paragraph
18482
- // it's considered a lazy continuation regardless of what's there
18483
- if (state.sCount[nextLine] - state.blkIndent > 3) { isContinuation = true; }
18481
+ // Exclusive end offset of the line, after its newline if present
18482
+ function lineEnd (state, line) {
18483
+ return Math.min(state.eMarks[line] + 1, state.src.length)
18484
+ }
18484
18485
 
18485
- // quirk for blockquotes, this line should already be checked by that rule
18486
- if (state.sCount[nextLine] < 0) { isContinuation = true; }
18487
-
18488
- if (!isContinuation) {
18489
- const terminatorRules = state.md.block.ruler.getRules('reference');
18490
- const oldParentType = state.parentType;
18491
- state.parentType = 'reference';
18492
-
18493
- // Some tags can terminate paragraph without empty line.
18494
- let terminate = false;
18495
- for (let i = 0, l = terminatorRules.length; i < l; i++) {
18496
- if (terminatorRules[i](state, nextLine, endLine, true)) {
18497
- terminate = true;
18498
- break
18499
- }
18500
- }
18486
+ // Returns -1 if the reference can't continue on this line
18487
+ function getNextLinePos (state, nextLine) {
18488
+ const endLine = state.lineMax;
18489
+
18490
+ if (nextLine >= endLine || state.isEmpty(nextLine)) {
18491
+ // empty line or end of input
18492
+ return -1
18493
+ }
18494
+
18495
+ let isContinuation = false;
18496
+
18497
+ // this would be a code block normally, but after paragraph
18498
+ // it's considered a lazy continuation regardless of what's there
18499
+ if (state.sCount[nextLine] - state.blkIndent > 3) { isContinuation = true; }
18501
18500
 
18502
- state.parentType = oldParentType;
18503
- if (terminate) {
18504
- // terminated by another block
18505
- return null
18501
+ // quirk for blockquotes, this line should already be checked by that rule
18502
+ if (state.sCount[nextLine] < 0) { isContinuation = true; }
18503
+
18504
+ if (!isContinuation) {
18505
+ const terminatorRules = state.md.block.ruler.getRules('reference');
18506
+ const oldParentType = state.parentType;
18507
+ state.parentType = 'reference';
18508
+
18509
+ // Some tags can terminate paragraph without empty line.
18510
+ let terminate = false;
18511
+ for (let i = 0, l = terminatorRules.length; i < l; i++) {
18512
+ if (terminatorRules[i](state, nextLine, endLine, true)) {
18513
+ terminate = true;
18514
+ break
18506
18515
  }
18507
18516
  }
18508
18517
 
18509
- const pos = state.bMarks[nextLine] + state.tShift[nextLine];
18510
- const max = state.eMarks[nextLine];
18511
-
18512
- // max + 1 explicitly includes the newline
18513
- return state.src.slice(pos, max + 1)
18518
+ state.parentType = oldParentType;
18519
+ if (terminate) {
18520
+ // terminated by another block
18521
+ return -1
18522
+ }
18514
18523
  }
18515
18524
 
18516
- let str = state.src.slice(pos, max + 1);
18525
+ return state.bMarks[nextLine] + state.tShift[nextLine]
18526
+ }
18527
+
18528
+ function reference (state, startLine, _endLine, silent) {
18529
+ const src = state.src;
18530
+ let pos = state.bMarks[startLine] + state.tShift[startLine];
18531
+ let nextLine = startLine + 1;
18532
+
18533
+ // if it's indented more than 3 spaces, it should be a code block
18534
+ if (state.sCount[startLine] - state.blkIndent >= 4) { return false }
18535
+
18536
+ if (src.charCodeAt(pos) !== 0x5B/* [ */) { return false }
18537
+
18538
+ // Scan the source directly: indexing a string after each appended line
18539
+ // can make V8 copy the accumulated prefix on every continuation.
18540
+ let max = lineEnd(state, startLine);
18517
18541
 
18518
- max = str.length;
18542
+ let rawLabel = '';
18519
18543
  let labelEnd = -1;
18544
+ let segmentStart = ++pos;
18520
18545
 
18521
- for (pos = 1; pos < max; pos++) {
18522
- const ch = str.charCodeAt(pos);
18523
- if (ch === 0x5B /* [ */) {
18524
- return false
18525
- } else if (ch === 0x5D /* ] */) {
18546
+ while (pos < max) {
18547
+ if (rawLabel.length + pos - segmentStart > MAX_LABEL_LENGTH * 2) { return false }
18548
+
18549
+ let ch = src.charCodeAt(pos);
18550
+ if (ch === 0x5B /* [ */) { return false }
18551
+ if (ch === 0x5D /* ] */) {
18526
18552
  labelEnd = pos;
18527
18553
  break
18528
- } else if (ch === 0x0A /* \n */) {
18529
- const lineContent = getNextLine(nextLine);
18530
- if (lineContent !== null) {
18531
- str += lineContent;
18532
- max = str.length;
18533
- nextLine++;
18534
- }
18535
- } else if (ch === 0x5C /* \ */) {
18536
- pos++;
18537
- if (pos < max && str.charCodeAt(pos) === 0x0A) {
18538
- const lineContent = getNextLine(nextLine);
18539
- if (lineContent !== null) {
18540
- str += lineContent;
18541
- max = str.length;
18542
- nextLine++;
18543
- }
18544
- }
18545
18554
  }
18555
+ if (ch === 0x5C /* \ */) { ch = src.charCodeAt(++pos); }
18556
+
18557
+ if (ch === 0x0A /* \n */ && pos < max) {
18558
+ const nextPos = getNextLinePos(state, nextLine);
18559
+ if (nextPos < 0) { return false }
18560
+ rawLabel += src.slice(segmentStart, max);
18561
+ pos = segmentStart = nextPos;
18562
+ max = lineEnd(state, nextLine++);
18563
+ continue
18564
+ }
18565
+ pos++;
18546
18566
  }
18547
18567
 
18548
- if (labelEnd < 0 || str.charCodeAt(labelEnd + 1) !== 0x3A/* : */) { return false }
18568
+ if (labelEnd < 0 || src.charCodeAt(labelEnd + 1) !== 0x3A/* : */) { return false }
18569
+
18570
+ rawLabel += src.slice(segmentStart, labelEnd);
18571
+
18572
+ if (rawLabel.length > MAX_LABEL_LENGTH && countCodePoints(rawLabel) > MAX_LABEL_LENGTH) {
18573
+ return false
18574
+ }
18549
18575
 
18550
18576
  // [label]: destination 'title'
18551
18577
  // ^^^ skip optional whitespace here
18552
- for (pos = labelEnd + 2; pos < max; pos++) {
18553
- const ch = str.charCodeAt(pos);
18578
+ pos = labelEnd + 2;
18579
+ while (pos < max) {
18580
+ const ch = src.charCodeAt(pos);
18554
18581
  if (ch === 0x0A) {
18555
- const lineContent = getNextLine(nextLine);
18556
- if (lineContent !== null) {
18557
- str += lineContent;
18558
- max = str.length;
18559
- nextLine++;
18560
- }
18561
- } else if (isSpace(ch)) ; else {
18582
+ const nextPos = getNextLinePos(state, nextLine);
18583
+ if (nextPos < 0) { break }
18584
+ pos = nextPos;
18585
+ max = lineEnd(state, nextLine++);
18586
+ } else if (isSpace(ch)) {
18587
+ pos++;
18588
+ } else {
18562
18589
  break
18563
18590
  }
18564
18591
  }
18565
18592
 
18566
18593
  // [label]: destination 'title'
18567
18594
  // ^^^^^^^^^^^ parse this
18568
- const destRes = state.md.helpers.parseLinkDestination(str, pos, max);
18595
+ const destRes = state.md.helpers.parseLinkDestination(src, pos, max);
18569
18596
  if (!destRes.ok) { return false }
18570
18597
 
18571
18598
  const href = state.md.normalizeLink(destRes.str);
@@ -18575,76 +18602,77 @@ function reference (state, startLine, _endLine, silent) {
18575
18602
 
18576
18603
  // save cursor state, we could require to rollback later
18577
18604
  const destEndPos = pos;
18605
+ const destEndMax = max;
18578
18606
  const destEndLineNo = nextLine;
18579
18607
 
18580
18608
  // [label]: destination 'title'
18581
18609
  // ^^^ skipping those spaces
18582
- const start = pos;
18583
- for (; pos < max; pos++) {
18584
- const ch = str.charCodeAt(pos);
18610
+ while (pos < max) {
18611
+ const ch = src.charCodeAt(pos);
18585
18612
  if (ch === 0x0A) {
18586
- const lineContent = getNextLine(nextLine);
18587
- if (lineContent !== null) {
18588
- str += lineContent;
18589
- max = str.length;
18590
- nextLine++;
18591
- }
18592
- } else if (isSpace(ch)) ; else {
18613
+ const nextPos = getNextLinePos(state, nextLine);
18614
+ if (nextPos < 0) { break }
18615
+ pos = nextPos;
18616
+ max = lineEnd(state, nextLine++);
18617
+ } else if (isSpace(ch)) {
18618
+ pos++;
18619
+ } else {
18593
18620
  break
18594
18621
  }
18595
18622
  }
18596
18623
 
18597
18624
  // [label]: destination 'title'
18598
18625
  // ^^^^^^^ parse this
18599
- let titleRes = state.md.helpers.parseLinkTitle(str, pos, max);
18626
+ const titleStart = pos;
18627
+ let titleRes = state.md.helpers.parseLinkTitle(src, pos, max);
18600
18628
  while (titleRes.can_continue) {
18601
- const lineContent = getNextLine(nextLine);
18602
- if (lineContent === null) break
18603
- str += lineContent;
18604
- pos = max;
18605
- max = str.length;
18606
- nextLine++;
18607
- titleRes = state.md.helpers.parseLinkTitle(str, pos, max, titleRes);
18629
+ const nextPos = getNextLinePos(state, nextLine);
18630
+ if (nextPos < 0) break
18631
+ pos = nextPos;
18632
+ max = lineEnd(state, nextLine++);
18633
+ titleRes = state.md.helpers.parseLinkTitle(src, pos, max, titleRes);
18608
18634
  }
18609
18635
  let title;
18610
18636
 
18611
- if (pos < max && start !== pos && titleRes.ok) {
18637
+ if (titleStart !== destEndPos && titleRes.ok) {
18612
18638
  title = titleRes.str;
18613
18639
  pos = titleRes.pos;
18614
18640
  } else {
18615
18641
  title = '';
18616
18642
  pos = destEndPos;
18643
+ max = destEndMax;
18617
18644
  nextLine = destEndLineNo;
18618
18645
  }
18619
18646
 
18620
18647
  // skip trailing spaces until the rest of the line
18621
18648
  while (pos < max) {
18622
- const ch = str.charCodeAt(pos);
18649
+ const ch = src.charCodeAt(pos);
18623
18650
  if (!isSpace(ch)) { break }
18624
18651
  pos++;
18625
18652
  }
18626
18653
 
18627
- if (pos < max && str.charCodeAt(pos) !== 0x0A) {
18654
+ if (pos < max && src.charCodeAt(pos) !== 0x0A) {
18628
18655
  if (title) {
18629
18656
  // garbage at the end of the line after title,
18630
18657
  // but it could still be a valid reference if we roll back
18631
18658
  title = '';
18632
18659
  pos = destEndPos;
18660
+ max = destEndMax;
18633
18661
  nextLine = destEndLineNo;
18634
18662
  while (pos < max) {
18635
- const ch = str.charCodeAt(pos);
18663
+ const ch = src.charCodeAt(pos);
18636
18664
  if (!isSpace(ch)) { break }
18637
18665
  pos++;
18638
18666
  }
18639
18667
  }
18640
18668
  }
18641
18669
 
18642
- if (pos < max && str.charCodeAt(pos) !== 0x0A) {
18670
+ if (pos < max && src.charCodeAt(pos) !== 0x0A) {
18643
18671
  // garbage at the end of the line
18644
18672
  return false
18645
18673
  }
18646
18674
 
18647
- const label = normalizeReference(str.slice(1, labelEnd));
18675
+ const label = normalizeReference(rawLabel);
18648
18676
  if (!label) {
18649
18677
  // CommonMark 0.20 disallows empty labels
18650
18678
  return false
@@ -18748,13 +18776,6 @@ const attribute = '(?:\\s+' + attr_name + '(?:\\s*=\\s*' + attr_value + ')?)';
18748
18776
  const open_tag = '<[A-Za-z][A-Za-z0-9\\-]*' + attribute + '*\\s*\\/?>';
18749
18777
 
18750
18778
  const close_tag = '<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>';
18751
- const comment = '<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->';
18752
- const processing = '<[?][\\s\\S]*?[?]>';
18753
- const declaration = '<![A-Za-z][^>]*>';
18754
- const cdata = '<!\\[CDATA\\[[\\s\\S]*?\\]\\]>';
18755
-
18756
- const HTML_TAG_RE = new RegExp('^(?:' + open_tag + '|' + close_tag + '|' + comment +
18757
- '|' + processing + '|' + declaration + '|' + cdata + ')');
18758
18779
  const HTML_OPEN_CLOSE_TAG_RE = new RegExp('^(?:' + open_tag + '|' + close_tag + ')');
18759
18780
 
18760
18781
  // HTML block
@@ -19169,6 +19190,10 @@ function StateInline (src, md, env, outTokens) {
19169
19190
  this.backticks = {};
19170
19191
  this.backticksScanned = false;
19171
19192
 
19193
+ // Set when html comment / PI / declaration / CDATA has no terminator,
19194
+ // to skip further scans of these constructs
19195
+ this.skipHtmlSpecial = false;
19196
+
19172
19197
  // Counter used to disable inline linkify-it execution
19173
19198
  // inside <a> and markdown links
19174
19199
  this.linkLevel = 0;
@@ -20263,6 +20288,43 @@ function isLetter (ch) {
20263
20288
  return (lc >= 0x61/* a */) && (lc <= 0x7a/* z */)
20264
20289
  }
20265
20290
 
20291
+ // Comment, processing instruction, declaration or CDATA: fixed opener,
20292
+ // then everything up to the first terminator. Returns end position or -1.
20293
+ function scanSpecial (state, pos) {
20294
+ const src = state.src;
20295
+ let start;
20296
+ let terminator;
20297
+
20298
+ if (src.startsWith('<!--', pos)) {
20299
+ if (src.startsWith('>', pos + 4)) { return pos + 5 }
20300
+ if (src.startsWith('->', pos + 4)) { return pos + 6 }
20301
+ start = pos + 4;
20302
+ terminator = '-->';
20303
+ } else if (src.startsWith('<![CDATA[', pos)) {
20304
+ start = pos + 9;
20305
+ terminator = ']]>';
20306
+ } else if (src.charCodeAt(pos + 1) === 0x3F/* ? */) {
20307
+ start = pos + 2;
20308
+ terminator = '?>';
20309
+ } else if (isLetter(src.charCodeAt(pos + 2))) {
20310
+ start = pos + 3;
20311
+ terminator = '>';
20312
+ } else {
20313
+ return -1
20314
+ }
20315
+
20316
+ if (state.skipHtmlSpecial) { return -1 }
20317
+
20318
+ const end = src.indexOf(terminator, start);
20319
+ if (end < 0) {
20320
+ // One flag for all constructs to keep code simple. Valid constructs after
20321
+ // an unclosed one in the same paragraph become text, that's acceptable.
20322
+ state.skipHtmlSpecial = true;
20323
+ return -1
20324
+ }
20325
+ return end + terminator.length
20326
+ }
20327
+
20266
20328
  function html_inline (state, silent) {
20267
20329
  if (!state.md.options.html) { return false }
20268
20330
 
@@ -20274,26 +20336,28 @@ function html_inline (state, silent) {
20274
20336
  return false
20275
20337
  }
20276
20338
 
20277
- // Quick fail on second char
20339
+ let end;
20278
20340
  const ch = state.src.charCodeAt(pos + 1);
20279
- if (ch !== 0x21/* ! */ &&
20280
- ch !== 0x3F/* ? */ &&
20281
- ch !== 0x2F/* / */ &&
20282
- !isLetter(ch)) {
20341
+
20342
+ if (ch === 0x21/* ! */ || ch === 0x3F/* ? */) {
20343
+ end = scanSpecial(state, pos);
20344
+ } else if (ch === 0x2F/* / */ || isLetter(ch)) {
20345
+ const match = state.src.slice(pos).match(HTML_OPEN_CLOSE_TAG_RE);
20346
+ end = match ? pos + match[0].length : -1;
20347
+ } else {
20283
20348
  return false
20284
20349
  }
20285
20350
 
20286
- const match = state.src.slice(pos).match(HTML_TAG_RE);
20287
- if (!match) { return false }
20351
+ if (end < 0) { return false }
20288
20352
 
20289
20353
  if (!silent) {
20290
20354
  const token = state.push('html_inline', '', 0);
20291
- token.content = match[0];
20355
+ token.content = state.src.slice(pos, end);
20292
20356
 
20293
20357
  if (isLinkOpen(token.content)) state.linkLevel++;
20294
20358
  if (isLinkClose(token.content)) state.linkLevel--;
20295
20359
  }
20296
- state.pos += match[0].length;
20360
+ state.pos = end;
20297
20361
  return true
20298
20362
  }
20299
20363
 
@@ -28316,6 +28380,15 @@ const ProsemirrorAdapter = class {
28316
28380
  * Specifies the visual appearance of the editor.
28317
28381
  */
28318
28382
  this.ui = 'standard';
28383
+ /**
28384
+ * Set to `true` to indicate that the editable area is required.
28385
+ */
28386
+ this.required = false;
28387
+ /**
28388
+ * Set to `true` to indicate that the current value of the editable area
28389
+ * is invalid.
28390
+ */
28391
+ this.invalid = false;
28319
28392
  this.actionBarItems = [];
28320
28393
  this.link = { href: 'https://' };
28321
28394
  /**
@@ -28326,6 +28399,7 @@ const ProsemirrorAdapter = class {
28326
28399
  this.transactionFired = false;
28327
28400
  this.lastClickedPos = null;
28328
28401
  this.focusRestoreTimeout = null;
28402
+ this.hadFocusWhenDisabled = false;
28329
28403
  this.metadata = { images: [], links: [] };
28330
28404
  /**
28331
28405
  * Used to stop change event emitting as result of getting updated value from consumer
@@ -28344,6 +28418,7 @@ const ProsemirrorAdapter = class {
28344
28418
  }
28345
28419
  return newItem;
28346
28420
  };
28421
+ this.isEditable = () => !this.disabled;
28347
28422
  this.updateActiveActionBarItems = (activeTypes, allowedTypes) => {
28348
28423
  this.actionBarItems = getTextEditorMenuItems()
28349
28424
  .map(this.getTranslatedItem)
@@ -28389,8 +28464,7 @@ const ProsemirrorAdapter = class {
28389
28464
  this.handleCancelLinkMenu = (event) => {
28390
28465
  event.preventDefault();
28391
28466
  event.stopPropagation();
28392
- this.isLinkMenuOpen = false;
28393
- this.link = { text: '', href: 'https://' };
28467
+ this.closeLinkMenu();
28394
28468
  };
28395
28469
  this.handleSaveLinkMenu = () => {
28396
28470
  this.isLinkMenuOpen = false;
@@ -28507,6 +28581,20 @@ const ProsemirrorAdapter = class {
28507
28581
  }
28508
28582
  await this.updateView('');
28509
28583
  }
28584
+ watchEditableAttributes() {
28585
+ this.updateEditableProps();
28586
+ }
28587
+ watchDisabled(disabled) {
28588
+ var _a;
28589
+ if (disabled) {
28590
+ this.hadFocusWhenDisabled = !!((_a = this.view) === null || _a === void 0 ? void 0 : _a.hasFocus());
28591
+ this.closeLinkMenu();
28592
+ }
28593
+ this.updateEditableProps();
28594
+ if (!disabled) {
28595
+ this.restoreFocus();
28596
+ }
28597
+ }
28510
28598
  watchValue(newValue) {
28511
28599
  if (!this.view) {
28512
28600
  return;
@@ -28566,13 +28654,19 @@ const ProsemirrorAdapter = class {
28566
28654
  (_e = this.view) === null || _e === void 0 ? void 0 : _e.destroy();
28567
28655
  }
28568
28656
  render() {
28569
- return (h(Host, { key: '6c92f1576fdd862e592d0ccf6779c6d3da806808', onFocus: this.handleFocus }, h("div", { key: '0b1b90a7c68b62ecffed21f4c49fced5333f0d83', id: "editor" }), this.renderToolbar(), this.renderLinkMenu()));
28657
+ return (h(Host, { key: 'eff663aa0d2c0ce2906fc160a70691e78dbda774', onFocus: this.handleFocus }, h("div", { key: '71111267b9098261ca843516ae067443c7f40740', id: "editor" }), this.renderToolbar(), this.renderLinkMenu()));
28570
28658
  }
28571
28659
  renderToolbar() {
28572
28660
  if (this.actionBarItems.length === 0 || this.ui === 'no-toolbar') {
28573
28661
  return;
28574
28662
  }
28575
- return (h("div", { class: "toolbar" }, h("limel-action-bar", { ref: (el) => (this.actionBarElement = el), accessibleLabel: translations.get('editor-menu.toolbar', this.language), actions: this.actionBarItems, onItemSelected: this.handleActionBarItem })));
28663
+ return (h("div", { class: "toolbar" }, h("limel-action-bar", { ref: (el) => (this.actionBarElement = el), accessibleLabel: translations.get('editor-menu.toolbar', this.language), actions: this.getToolbarItems(), onItemSelected: this.handleActionBarItem })));
28664
+ }
28665
+ getToolbarItems() {
28666
+ if (!this.disabled) {
28667
+ return this.actionBarItems;
28668
+ }
28669
+ return this.actionBarItems.map((item) => isItem(item) ? Object.assign(Object.assign({}, item), { disabled: true }) : item);
28576
28670
  }
28577
28671
  renderLinkMenu() {
28578
28672
  if (!this.isLinkMenuOpen) {
@@ -28612,6 +28706,8 @@ const ProsemirrorAdapter = class {
28612
28706
  this.view = new EditorView(this.host.shadowRoot.querySelector('#editor'), {
28613
28707
  state: this.createEditorState(initialDoc),
28614
28708
  dispatchTransaction: this.handleTransaction,
28709
+ attributes: this.getEditableAttributes(),
28710
+ editable: this.isEditable,
28615
28711
  });
28616
28712
  this.view.dom.addEventListener('blur', this.handleBlur);
28617
28713
  this.view.dom.addEventListener('mousedown', this.handleMouseDown);
@@ -28621,6 +28717,47 @@ const ProsemirrorAdapter = class {
28621
28717
  // Initialize lastEmittedValue to prevent false change events
28622
28718
  this.lastEmittedValue = this.contentConverter.serialize(this.view, this.schema);
28623
28719
  }
28720
+ updateEditableProps() {
28721
+ var _a;
28722
+ (_a = this.view) === null || _a === void 0 ? void 0 : _a.setProps({
28723
+ attributes: this.getEditableAttributes(),
28724
+ editable: this.isEditable,
28725
+ });
28726
+ }
28727
+ restoreFocus() {
28728
+ var _a;
28729
+ const shouldRestore = this.hadFocusWhenDisabled &&
28730
+ document.activeElement === document.body;
28731
+ this.hadFocusWhenDisabled = false;
28732
+ if (shouldRestore) {
28733
+ (_a = this.view) === null || _a === void 0 ? void 0 : _a.focus();
28734
+ }
28735
+ }
28736
+ getEditableAttributes() {
28737
+ const attributes = {
28738
+ role: 'textbox',
28739
+ 'aria-multiline': 'true',
28740
+ };
28741
+ if (this.accessibleLabel) {
28742
+ attributes['aria-label'] = this.accessibleLabel;
28743
+ }
28744
+ if (this.accessibleDescription) {
28745
+ attributes['aria-description'] = this.accessibleDescription;
28746
+ }
28747
+ if (this.accessiblePlaceholder) {
28748
+ attributes['aria-placeholder'] = this.accessiblePlaceholder;
28749
+ }
28750
+ if (this.required) {
28751
+ attributes['aria-required'] = 'true';
28752
+ }
28753
+ if (this.invalid) {
28754
+ attributes['aria-invalid'] = 'true';
28755
+ }
28756
+ if (this.disabled) {
28757
+ attributes['aria-disabled'] = 'true';
28758
+ }
28759
+ return attributes;
28760
+ }
28624
28761
  initializeSchema() {
28625
28762
  return buildEditorSchema({
28626
28763
  customElements: this.customElements,
@@ -28702,9 +28839,31 @@ const ProsemirrorAdapter = class {
28702
28839
  this.imageRemoved.emit(image);
28703
28840
  }
28704
28841
  }
28842
+ closeLinkMenu() {
28843
+ this.isLinkMenuOpen = false;
28844
+ this.link = { text: '', href: 'https://' };
28845
+ }
28705
28846
  static get delegatesFocus() { return true; }
28706
28847
  get host() { return getElement(this); }
28707
28848
  static get watchers() { return {
28849
+ "accessibleLabel": [{
28850
+ "watchEditableAttributes": 0
28851
+ }],
28852
+ "accessibleDescription": [{
28853
+ "watchEditableAttributes": 0
28854
+ }],
28855
+ "accessiblePlaceholder": [{
28856
+ "watchEditableAttributes": 0
28857
+ }],
28858
+ "required": [{
28859
+ "watchEditableAttributes": 0
28860
+ }],
28861
+ "invalid": [{
28862
+ "watchEditableAttributes": 0
28863
+ }],
28864
+ "disabled": [{
28865
+ "watchDisabled": 0
28866
+ }],
28708
28867
  "value": [{
28709
28868
  "watchValue": 0
28710
28869
  }]
@@ -417,6 +417,7 @@ class TypeaheadBuffer {
417
417
  const TRIGGER_ID = 's-trigger';
418
418
  const LABEL_ID = 's-label';
419
419
  const SELECTED_TEXT_ID = 's-selected-text';
420
+ const HELPER_TEXT_ID = 's-helper-text';
420
421
  const SelectTemplate = (props) => {
421
422
  const value = props.value;
422
423
  let hasValue = !!props.value;
@@ -449,6 +450,10 @@ const SelectTemplate = (props) => {
449
450
  h(SelectDropdown, Object.assign({}, props)),
450
451
  ];
451
452
  };
453
+ const getDescribedBy = (props) => {
454
+ var _a;
455
+ return ((_a = props.helperText) === null || _a === void 0 ? void 0 : _a.trim()) ? HELPER_TEXT_ID : undefined;
456
+ };
452
457
  const floatLabelAbove = (props) => {
453
458
  if (props.isOpen) {
454
459
  return true;
@@ -470,7 +475,7 @@ const SelectValue = (props) => {
470
475
  };
471
476
  return (h("button", { id: TRIGGER_ID, slot: "content", class: anchorClassList, onClick: props.open, onKeyDown: props.onTriggerKeyDown, "aria-haspopup": "listbox", "aria-expanded": props.isOpen, "aria-controls": props.id, "aria-labelledby": props.label
472
477
  ? `${LABEL_ID} ${SELECTED_TEXT_ID}`
473
- : SELECTED_TEXT_ID, "aria-required": props.required, disabled: props.disabled || props.readonly }, h("span", { class: "mdc-select__selected-text-container limel-select__selected-option" }, getSelectedIcon(props.value), getSelectedPrimaryComponent(props.value), h("span", { id: SELECTED_TEXT_ID, class: "mdc-select__selected-text limel-select__selected-option__text" }, getSelectedText(props.value))), h(ShowIcon, Object.assign({}, props, { isValid: props.isValid })), h("span", { class: "mdc-select__dropdown-icon" }, h("svg", { class: "mdc-select__dropdown-icon-graphic", viewBox: "7 10 10 5", focusable: "false" }, h("polygon", { stroke: "none", "fill-rule": "evenodd", points: "7 10 12 15 17 10" })))));
478
+ : SELECTED_TEXT_ID, "aria-describedby": getDescribedBy(props), "aria-required": props.required, disabled: props.disabled || props.readonly }, h("span", { class: "mdc-select__selected-text-container limel-select__selected-option" }, getSelectedIcon(props.value), getSelectedPrimaryComponent(props.value), h("span", { id: SELECTED_TEXT_ID, class: "mdc-select__selected-text limel-select__selected-option__text" }, getSelectedText(props.value))), h(ShowIcon, Object.assign({}, props, { isValid: props.isValid })), h("span", { class: "mdc-select__dropdown-icon" }, h("svg", { class: "mdc-select__dropdown-icon-graphic", viewBox: "7 10 10 5", focusable: "false" }, h("polygon", { stroke: "none", "fill-rule": "evenodd", points: "7 10 12 15 17 10" })))));
474
479
  };
475
480
  const ShowIcon = (props) => {
476
481
  if (props.isValid) {
@@ -482,7 +487,7 @@ const HelperText = (props) => {
482
487
  if (typeof props.text !== 'string') {
483
488
  return;
484
489
  }
485
- return (h("limel-helper-line", { helperText: props.text.trim(), invalid: !props.isValid }));
490
+ return (h("limel-helper-line", { helperText: props.text.trim(), helperTextId: HELPER_TEXT_ID, invalid: !props.isValid }));
486
491
  };
487
492
  const SelectDropdown = (props) => {
488
493
  if (props.native) {
@@ -504,7 +509,7 @@ const NativeDropdown = (props) => {
504
509
  const options = props.options
505
510
  .filter((option) => !('separator' in option))
506
511
  .map(renderOption(props.value));
507
- return (h("select", { required: props.required, "aria-labelledby": props.label ? LABEL_ID : undefined, "aria-disabled": props.disabled, "aria-required": props.required, onChange: props.onNativeChange, onFocus: props.open, onBlur: props.close, class: "limel-select__native-control", disabled: props.disabled, multiple: props.multiple }, options));
512
+ return (h("select", { required: props.required, "aria-labelledby": props.label ? LABEL_ID : undefined, "aria-describedby": getDescribedBy(props), "aria-disabled": props.disabled, "aria-required": props.required, onChange: props.onNativeChange, onFocus: props.open, onBlur: props.close, class: "limel-select__native-control", disabled: props.disabled, multiple: props.multiple }, options));
508
513
  };
509
514
  const renderOption = (selectedOption) => {
510
515
  return (option) => {