@limetech/lime-elements 40.12.1 → 40.12.3

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 (54) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/cjs/{checkbox.template-_WUgtMJy.js → checkbox.template-CNJ29zDR.js} +1 -1
  3. package/dist/cjs/lime-elements.cjs.js +1 -1
  4. package/dist/cjs/limel-checkbox.cjs.entry.js +1 -1
  5. package/dist/cjs/limel-chip-set.cjs.entry.js +5 -2
  6. package/dist/cjs/limel-file-viewer.cjs.entry.js +75 -12
  7. package/dist/cjs/limel-list-item.cjs.entry.js +1 -1
  8. package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +280 -121
  9. package/dist/cjs/limel-select.cjs.entry.js +2 -2
  10. package/dist/cjs/limel-slider.cjs.entry.js +4 -4
  11. package/dist/cjs/limel-switch.cjs.entry.js +1 -1
  12. package/dist/cjs/limel-text-editor.cjs.entry.js +4 -7
  13. package/dist/cjs/loader.cjs.js +1 -1
  14. package/dist/collection/components/checkbox/checkbox.template.js +1 -1
  15. package/dist/collection/components/chip-set/chip-set.js +5 -2
  16. package/dist/collection/components/select/select.template.js +2 -2
  17. package/dist/collection/components/slider/slider.js +4 -4
  18. package/dist/collection/components/switch/switch.js +1 -1
  19. package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js +196 -4
  20. package/dist/collection/components/text-editor/text-editor.js +5 -7
  21. package/dist/esm/{checkbox.template-BFL4SMzl.js → checkbox.template-CAja2LKZ.js} +1 -1
  22. package/dist/esm/lime-elements.js +1 -1
  23. package/dist/esm/limel-checkbox.entry.js +1 -1
  24. package/dist/esm/limel-chip-set.entry.js +5 -2
  25. package/dist/esm/limel-file-viewer.entry.js +75 -12
  26. package/dist/esm/limel-list-item.entry.js +1 -1
  27. package/dist/esm/limel-prosemirror-adapter.entry.js +280 -121
  28. package/dist/esm/limel-select.entry.js +2 -2
  29. package/dist/esm/limel-slider.entry.js +4 -4
  30. package/dist/esm/limel-switch.entry.js +1 -1
  31. package/dist/esm/limel-text-editor.entry.js +4 -7
  32. package/dist/esm/loader.js +1 -1
  33. package/dist/lime-elements/lime-elements.esm.js +1 -1
  34. package/dist/lime-elements/p-074275f4.entry.js +1 -0
  35. package/dist/lime-elements/{p-43c36a02.entry.js → p-268b4da1.entry.js} +1 -1
  36. package/dist/lime-elements/p-55b56742.entry.js +1 -0
  37. package/dist/lime-elements/{p-c492af1b.entry.js → p-828558cf.entry.js} +1 -1
  38. package/dist/lime-elements/p-95322502.entry.js +1 -0
  39. package/dist/lime-elements/{p-1qqvOwzC.js → p-Cadm4-WZ.js} +1 -1
  40. package/dist/lime-elements/p-b609552e.entry.js +1 -0
  41. package/dist/lime-elements/p-f4c9940e.entry.js +23 -0
  42. package/dist/lime-elements/{p-e247e9fe.entry.js → p-fb15f608.entry.js} +1 -1
  43. package/dist/lime-elements/p-ff4a8b89.entry.js +1 -0
  44. package/dist/types/components/chip-set/chip-set.d.ts +1 -0
  45. package/dist/types/components/text-editor/prosemirror-adapter/prosemirror-adapter.d.ts +34 -0
  46. package/dist/types/components/text-editor/text-editor.d.ts +1 -3
  47. package/dist/types/components.d.ts +53 -0
  48. package/package.json +3 -3
  49. package/dist/lime-elements/p-06850418.entry.js +0 -1
  50. package/dist/lime-elements/p-0e662a3c.entry.js +0 -1
  51. package/dist/lime-elements/p-262a3d66.entry.js +0 -1
  52. package/dist/lime-elements/p-5a15606a.entry.js +0 -1
  53. package/dist/lime-elements/p-89d75e9c.entry.js +0 -1
  54. package/dist/lime-elements/p-92fab922.entry.js +0 -23
@@ -18460,114 +18460,141 @@ function list (state, startLine, endLine, silent) {
18460
18460
  return true
18461
18461
  }
18462
18462
 
18463
- function reference (state, startLine, _endLine, silent) {
18464
- let pos = state.bMarks[startLine] + state.tShift[startLine];
18465
- let max = state.eMarks[startLine];
18466
- let nextLine = startLine + 1;
18467
-
18468
- // if it's indented more than 3 spaces, it should be a code block
18469
- if (state.sCount[startLine] - state.blkIndent >= 4) { return false }
18463
+ // CommonMark limits reference labels to 999 Unicode code points.
18464
+ const MAX_LABEL_LENGTH = 999;
18470
18465
 
18471
- if (state.src.charCodeAt(pos) !== 0x5B/* [ */) { return false }
18466
+ function countCodePoints (str) {
18467
+ let length = str.length;
18472
18468
 
18473
- function getNextLine (nextLine) {
18474
- const endLine = state.lineMax;
18469
+ for (let i = 0; i < str.length - 1; i++) {
18470
+ const high = str.charCodeAt(i);
18471
+ if (high < 0xD800 || high > 0xDBFF) { continue }
18475
18472
 
18476
- if (nextLine >= endLine || state.isEmpty(nextLine)) {
18477
- // empty line or end of input
18478
- return null
18473
+ const low = str.charCodeAt(i + 1);
18474
+ if (low >= 0xDC00 && low <= 0xDFFF) {
18475
+ length--;
18476
+ i++;
18479
18477
  }
18478
+ }
18480
18479
 
18481
- let isContinuation = false;
18480
+ return length
18481
+ }
18482
18482
 
18483
- // this would be a code block normally, but after paragraph
18484
- // it's considered a lazy continuation regardless of what's there
18485
- if (state.sCount[nextLine] - state.blkIndent > 3) { isContinuation = true; }
18483
+ // Exclusive end offset of the line, after its newline if present
18484
+ function lineEnd (state, line) {
18485
+ return Math.min(state.eMarks[line] + 1, state.src.length)
18486
+ }
18486
18487
 
18487
- // quirk for blockquotes, this line should already be checked by that rule
18488
- if (state.sCount[nextLine] < 0) { isContinuation = true; }
18489
-
18490
- if (!isContinuation) {
18491
- const terminatorRules = state.md.block.ruler.getRules('reference');
18492
- const oldParentType = state.parentType;
18493
- state.parentType = 'reference';
18494
-
18495
- // Some tags can terminate paragraph without empty line.
18496
- let terminate = false;
18497
- for (let i = 0, l = terminatorRules.length; i < l; i++) {
18498
- if (terminatorRules[i](state, nextLine, endLine, true)) {
18499
- terminate = true;
18500
- break
18501
- }
18502
- }
18488
+ // Returns -1 if the reference can't continue on this line
18489
+ function getNextLinePos (state, nextLine) {
18490
+ const endLine = state.lineMax;
18491
+
18492
+ if (nextLine >= endLine || state.isEmpty(nextLine)) {
18493
+ // empty line or end of input
18494
+ return -1
18495
+ }
18496
+
18497
+ let isContinuation = false;
18498
+
18499
+ // this would be a code block normally, but after paragraph
18500
+ // it's considered a lazy continuation regardless of what's there
18501
+ if (state.sCount[nextLine] - state.blkIndent > 3) { isContinuation = true; }
18503
18502
 
18504
- state.parentType = oldParentType;
18505
- if (terminate) {
18506
- // terminated by another block
18507
- return null
18503
+ // quirk for blockquotes, this line should already be checked by that rule
18504
+ if (state.sCount[nextLine] < 0) { isContinuation = true; }
18505
+
18506
+ if (!isContinuation) {
18507
+ const terminatorRules = state.md.block.ruler.getRules('reference');
18508
+ const oldParentType = state.parentType;
18509
+ state.parentType = 'reference';
18510
+
18511
+ // Some tags can terminate paragraph without empty line.
18512
+ let terminate = false;
18513
+ for (let i = 0, l = terminatorRules.length; i < l; i++) {
18514
+ if (terminatorRules[i](state, nextLine, endLine, true)) {
18515
+ terminate = true;
18516
+ break
18508
18517
  }
18509
18518
  }
18510
18519
 
18511
- const pos = state.bMarks[nextLine] + state.tShift[nextLine];
18512
- const max = state.eMarks[nextLine];
18513
-
18514
- // max + 1 explicitly includes the newline
18515
- return state.src.slice(pos, max + 1)
18520
+ state.parentType = oldParentType;
18521
+ if (terminate) {
18522
+ // terminated by another block
18523
+ return -1
18524
+ }
18516
18525
  }
18517
18526
 
18518
- let str = state.src.slice(pos, max + 1);
18527
+ return state.bMarks[nextLine] + state.tShift[nextLine]
18528
+ }
18529
+
18530
+ function reference (state, startLine, _endLine, silent) {
18531
+ const src = state.src;
18532
+ let pos = state.bMarks[startLine] + state.tShift[startLine];
18533
+ let nextLine = startLine + 1;
18534
+
18535
+ // if it's indented more than 3 spaces, it should be a code block
18536
+ if (state.sCount[startLine] - state.blkIndent >= 4) { return false }
18537
+
18538
+ if (src.charCodeAt(pos) !== 0x5B/* [ */) { return false }
18539
+
18540
+ // Scan the source directly: indexing a string after each appended line
18541
+ // can make V8 copy the accumulated prefix on every continuation.
18542
+ let max = lineEnd(state, startLine);
18519
18543
 
18520
- max = str.length;
18544
+ let rawLabel = '';
18521
18545
  let labelEnd = -1;
18546
+ let segmentStart = ++pos;
18522
18547
 
18523
- for (pos = 1; pos < max; pos++) {
18524
- const ch = str.charCodeAt(pos);
18525
- if (ch === 0x5B /* [ */) {
18526
- return false
18527
- } else if (ch === 0x5D /* ] */) {
18548
+ while (pos < max) {
18549
+ if (rawLabel.length + pos - segmentStart > MAX_LABEL_LENGTH * 2) { return false }
18550
+
18551
+ let ch = src.charCodeAt(pos);
18552
+ if (ch === 0x5B /* [ */) { return false }
18553
+ if (ch === 0x5D /* ] */) {
18528
18554
  labelEnd = pos;
18529
18555
  break
18530
- } else if (ch === 0x0A /* \n */) {
18531
- const lineContent = getNextLine(nextLine);
18532
- if (lineContent !== null) {
18533
- str += lineContent;
18534
- max = str.length;
18535
- nextLine++;
18536
- }
18537
- } else if (ch === 0x5C /* \ */) {
18538
- pos++;
18539
- if (pos < max && str.charCodeAt(pos) === 0x0A) {
18540
- const lineContent = getNextLine(nextLine);
18541
- if (lineContent !== null) {
18542
- str += lineContent;
18543
- max = str.length;
18544
- nextLine++;
18545
- }
18546
- }
18547
18556
  }
18557
+ if (ch === 0x5C /* \ */) { ch = src.charCodeAt(++pos); }
18558
+
18559
+ if (ch === 0x0A /* \n */ && pos < max) {
18560
+ const nextPos = getNextLinePos(state, nextLine);
18561
+ if (nextPos < 0) { return false }
18562
+ rawLabel += src.slice(segmentStart, max);
18563
+ pos = segmentStart = nextPos;
18564
+ max = lineEnd(state, nextLine++);
18565
+ continue
18566
+ }
18567
+ pos++;
18548
18568
  }
18549
18569
 
18550
- if (labelEnd < 0 || str.charCodeAt(labelEnd + 1) !== 0x3A/* : */) { return false }
18570
+ if (labelEnd < 0 || src.charCodeAt(labelEnd + 1) !== 0x3A/* : */) { return false }
18571
+
18572
+ rawLabel += src.slice(segmentStart, labelEnd);
18573
+
18574
+ if (rawLabel.length > MAX_LABEL_LENGTH && countCodePoints(rawLabel) > MAX_LABEL_LENGTH) {
18575
+ return false
18576
+ }
18551
18577
 
18552
18578
  // [label]: destination 'title'
18553
18579
  // ^^^ skip optional whitespace here
18554
- for (pos = labelEnd + 2; pos < max; pos++) {
18555
- const ch = str.charCodeAt(pos);
18580
+ pos = labelEnd + 2;
18581
+ while (pos < max) {
18582
+ const ch = src.charCodeAt(pos);
18556
18583
  if (ch === 0x0A) {
18557
- const lineContent = getNextLine(nextLine);
18558
- if (lineContent !== null) {
18559
- str += lineContent;
18560
- max = str.length;
18561
- nextLine++;
18562
- }
18563
- } else if (isSpace(ch)) ; else {
18584
+ const nextPos = getNextLinePos(state, nextLine);
18585
+ if (nextPos < 0) { break }
18586
+ pos = nextPos;
18587
+ max = lineEnd(state, nextLine++);
18588
+ } else if (isSpace(ch)) {
18589
+ pos++;
18590
+ } else {
18564
18591
  break
18565
18592
  }
18566
18593
  }
18567
18594
 
18568
18595
  // [label]: destination 'title'
18569
18596
  // ^^^^^^^^^^^ parse this
18570
- const destRes = state.md.helpers.parseLinkDestination(str, pos, max);
18597
+ const destRes = state.md.helpers.parseLinkDestination(src, pos, max);
18571
18598
  if (!destRes.ok) { return false }
18572
18599
 
18573
18600
  const href = state.md.normalizeLink(destRes.str);
@@ -18577,76 +18604,77 @@ function reference (state, startLine, _endLine, silent) {
18577
18604
 
18578
18605
  // save cursor state, we could require to rollback later
18579
18606
  const destEndPos = pos;
18607
+ const destEndMax = max;
18580
18608
  const destEndLineNo = nextLine;
18581
18609
 
18582
18610
  // [label]: destination 'title'
18583
18611
  // ^^^ skipping those spaces
18584
- const start = pos;
18585
- for (; pos < max; pos++) {
18586
- const ch = str.charCodeAt(pos);
18612
+ while (pos < max) {
18613
+ const ch = src.charCodeAt(pos);
18587
18614
  if (ch === 0x0A) {
18588
- const lineContent = getNextLine(nextLine);
18589
- if (lineContent !== null) {
18590
- str += lineContent;
18591
- max = str.length;
18592
- nextLine++;
18593
- }
18594
- } else if (isSpace(ch)) ; else {
18615
+ const nextPos = getNextLinePos(state, nextLine);
18616
+ if (nextPos < 0) { break }
18617
+ pos = nextPos;
18618
+ max = lineEnd(state, nextLine++);
18619
+ } else if (isSpace(ch)) {
18620
+ pos++;
18621
+ } else {
18595
18622
  break
18596
18623
  }
18597
18624
  }
18598
18625
 
18599
18626
  // [label]: destination 'title'
18600
18627
  // ^^^^^^^ parse this
18601
- let titleRes = state.md.helpers.parseLinkTitle(str, pos, max);
18628
+ const titleStart = pos;
18629
+ let titleRes = state.md.helpers.parseLinkTitle(src, pos, max);
18602
18630
  while (titleRes.can_continue) {
18603
- const lineContent = getNextLine(nextLine);
18604
- if (lineContent === null) break
18605
- str += lineContent;
18606
- pos = max;
18607
- max = str.length;
18608
- nextLine++;
18609
- titleRes = state.md.helpers.parseLinkTitle(str, pos, max, titleRes);
18631
+ const nextPos = getNextLinePos(state, nextLine);
18632
+ if (nextPos < 0) break
18633
+ pos = nextPos;
18634
+ max = lineEnd(state, nextLine++);
18635
+ titleRes = state.md.helpers.parseLinkTitle(src, pos, max, titleRes);
18610
18636
  }
18611
18637
  let title;
18612
18638
 
18613
- if (pos < max && start !== pos && titleRes.ok) {
18639
+ if (titleStart !== destEndPos && titleRes.ok) {
18614
18640
  title = titleRes.str;
18615
18641
  pos = titleRes.pos;
18616
18642
  } else {
18617
18643
  title = '';
18618
18644
  pos = destEndPos;
18645
+ max = destEndMax;
18619
18646
  nextLine = destEndLineNo;
18620
18647
  }
18621
18648
 
18622
18649
  // skip trailing spaces until the rest of the line
18623
18650
  while (pos < max) {
18624
- const ch = str.charCodeAt(pos);
18651
+ const ch = src.charCodeAt(pos);
18625
18652
  if (!isSpace(ch)) { break }
18626
18653
  pos++;
18627
18654
  }
18628
18655
 
18629
- if (pos < max && str.charCodeAt(pos) !== 0x0A) {
18656
+ if (pos < max && src.charCodeAt(pos) !== 0x0A) {
18630
18657
  if (title) {
18631
18658
  // garbage at the end of the line after title,
18632
18659
  // but it could still be a valid reference if we roll back
18633
18660
  title = '';
18634
18661
  pos = destEndPos;
18662
+ max = destEndMax;
18635
18663
  nextLine = destEndLineNo;
18636
18664
  while (pos < max) {
18637
- const ch = str.charCodeAt(pos);
18665
+ const ch = src.charCodeAt(pos);
18638
18666
  if (!isSpace(ch)) { break }
18639
18667
  pos++;
18640
18668
  }
18641
18669
  }
18642
18670
  }
18643
18671
 
18644
- if (pos < max && str.charCodeAt(pos) !== 0x0A) {
18672
+ if (pos < max && src.charCodeAt(pos) !== 0x0A) {
18645
18673
  // garbage at the end of the line
18646
18674
  return false
18647
18675
  }
18648
18676
 
18649
- const label = normalizeReference(str.slice(1, labelEnd));
18677
+ const label = normalizeReference(rawLabel);
18650
18678
  if (!label) {
18651
18679
  // CommonMark 0.20 disallows empty labels
18652
18680
  return false
@@ -18750,13 +18778,6 @@ const attribute = '(?:\\s+' + attr_name + '(?:\\s*=\\s*' + attr_value + ')?)';
18750
18778
  const open_tag = '<[A-Za-z][A-Za-z0-9\\-]*' + attribute + '*\\s*\\/?>';
18751
18779
 
18752
18780
  const close_tag = '<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>';
18753
- const comment = '<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->';
18754
- const processing = '<[?][\\s\\S]*?[?]>';
18755
- const declaration = '<![A-Za-z][^>]*>';
18756
- const cdata = '<!\\[CDATA\\[[\\s\\S]*?\\]\\]>';
18757
-
18758
- const HTML_TAG_RE = new RegExp('^(?:' + open_tag + '|' + close_tag + '|' + comment +
18759
- '|' + processing + '|' + declaration + '|' + cdata + ')');
18760
18781
  const HTML_OPEN_CLOSE_TAG_RE = new RegExp('^(?:' + open_tag + '|' + close_tag + ')');
18761
18782
 
18762
18783
  // HTML block
@@ -19171,6 +19192,10 @@ function StateInline (src, md, env, outTokens) {
19171
19192
  this.backticks = {};
19172
19193
  this.backticksScanned = false;
19173
19194
 
19195
+ // Set when html comment / PI / declaration / CDATA has no terminator,
19196
+ // to skip further scans of these constructs
19197
+ this.skipHtmlSpecial = false;
19198
+
19174
19199
  // Counter used to disable inline linkify-it execution
19175
19200
  // inside <a> and markdown links
19176
19201
  this.linkLevel = 0;
@@ -20265,6 +20290,43 @@ function isLetter (ch) {
20265
20290
  return (lc >= 0x61/* a */) && (lc <= 0x7a/* z */)
20266
20291
  }
20267
20292
 
20293
+ // Comment, processing instruction, declaration or CDATA: fixed opener,
20294
+ // then everything up to the first terminator. Returns end position or -1.
20295
+ function scanSpecial (state, pos) {
20296
+ const src = state.src;
20297
+ let start;
20298
+ let terminator;
20299
+
20300
+ if (src.startsWith('<!--', pos)) {
20301
+ if (src.startsWith('>', pos + 4)) { return pos + 5 }
20302
+ if (src.startsWith('->', pos + 4)) { return pos + 6 }
20303
+ start = pos + 4;
20304
+ terminator = '-->';
20305
+ } else if (src.startsWith('<![CDATA[', pos)) {
20306
+ start = pos + 9;
20307
+ terminator = ']]>';
20308
+ } else if (src.charCodeAt(pos + 1) === 0x3F/* ? */) {
20309
+ start = pos + 2;
20310
+ terminator = '?>';
20311
+ } else if (isLetter(src.charCodeAt(pos + 2))) {
20312
+ start = pos + 3;
20313
+ terminator = '>';
20314
+ } else {
20315
+ return -1
20316
+ }
20317
+
20318
+ if (state.skipHtmlSpecial) { return -1 }
20319
+
20320
+ const end = src.indexOf(terminator, start);
20321
+ if (end < 0) {
20322
+ // One flag for all constructs to keep code simple. Valid constructs after
20323
+ // an unclosed one in the same paragraph become text, that's acceptable.
20324
+ state.skipHtmlSpecial = true;
20325
+ return -1
20326
+ }
20327
+ return end + terminator.length
20328
+ }
20329
+
20268
20330
  function html_inline (state, silent) {
20269
20331
  if (!state.md.options.html) { return false }
20270
20332
 
@@ -20276,26 +20338,28 @@ function html_inline (state, silent) {
20276
20338
  return false
20277
20339
  }
20278
20340
 
20279
- // Quick fail on second char
20341
+ let end;
20280
20342
  const ch = state.src.charCodeAt(pos + 1);
20281
- if (ch !== 0x21/* ! */ &&
20282
- ch !== 0x3F/* ? */ &&
20283
- ch !== 0x2F/* / */ &&
20284
- !isLetter(ch)) {
20343
+
20344
+ if (ch === 0x21/* ! */ || ch === 0x3F/* ? */) {
20345
+ end = scanSpecial(state, pos);
20346
+ } else if (ch === 0x2F/* / */ || isLetter(ch)) {
20347
+ const match = state.src.slice(pos).match(HTML_OPEN_CLOSE_TAG_RE);
20348
+ end = match ? pos + match[0].length : -1;
20349
+ } else {
20285
20350
  return false
20286
20351
  }
20287
20352
 
20288
- const match = state.src.slice(pos).match(HTML_TAG_RE);
20289
- if (!match) { return false }
20353
+ if (end < 0) { return false }
20290
20354
 
20291
20355
  if (!silent) {
20292
20356
  const token = state.push('html_inline', '', 0);
20293
- token.content = match[0];
20357
+ token.content = state.src.slice(pos, end);
20294
20358
 
20295
20359
  if (isLinkOpen(token.content)) state.linkLevel++;
20296
20360
  if (isLinkClose(token.content)) state.linkLevel--;
20297
20361
  }
20298
- state.pos += match[0].length;
20362
+ state.pos = end;
20299
20363
  return true
20300
20364
  }
20301
20365
 
@@ -28318,6 +28382,15 @@ const ProsemirrorAdapter = class {
28318
28382
  * Specifies the visual appearance of the editor.
28319
28383
  */
28320
28384
  this.ui = 'standard';
28385
+ /**
28386
+ * Set to `true` to indicate that the editable area is required.
28387
+ */
28388
+ this.required = false;
28389
+ /**
28390
+ * Set to `true` to indicate that the current value of the editable area
28391
+ * is invalid.
28392
+ */
28393
+ this.invalid = false;
28321
28394
  this.actionBarItems = [];
28322
28395
  this.link = { href: 'https://' };
28323
28396
  /**
@@ -28328,6 +28401,7 @@ const ProsemirrorAdapter = class {
28328
28401
  this.transactionFired = false;
28329
28402
  this.lastClickedPos = null;
28330
28403
  this.focusRestoreTimeout = null;
28404
+ this.hadFocusWhenDisabled = false;
28331
28405
  this.metadata = { images: [], links: [] };
28332
28406
  /**
28333
28407
  * Used to stop change event emitting as result of getting updated value from consumer
@@ -28346,6 +28420,7 @@ const ProsemirrorAdapter = class {
28346
28420
  }
28347
28421
  return newItem;
28348
28422
  };
28423
+ this.isEditable = () => !this.disabled;
28349
28424
  this.updateActiveActionBarItems = (activeTypes, allowedTypes) => {
28350
28425
  this.actionBarItems = getTextEditorMenuItems()
28351
28426
  .map(this.getTranslatedItem)
@@ -28391,8 +28466,7 @@ const ProsemirrorAdapter = class {
28391
28466
  this.handleCancelLinkMenu = (event) => {
28392
28467
  event.preventDefault();
28393
28468
  event.stopPropagation();
28394
- this.isLinkMenuOpen = false;
28395
- this.link = { text: '', href: 'https://' };
28469
+ this.closeLinkMenu();
28396
28470
  };
28397
28471
  this.handleSaveLinkMenu = () => {
28398
28472
  this.isLinkMenuOpen = false;
@@ -28509,6 +28583,20 @@ const ProsemirrorAdapter = class {
28509
28583
  }
28510
28584
  await this.updateView('');
28511
28585
  }
28586
+ watchEditableAttributes() {
28587
+ this.updateEditableProps();
28588
+ }
28589
+ watchDisabled(disabled) {
28590
+ var _a;
28591
+ if (disabled) {
28592
+ this.hadFocusWhenDisabled = !!((_a = this.view) === null || _a === void 0 ? void 0 : _a.hasFocus());
28593
+ this.closeLinkMenu();
28594
+ }
28595
+ this.updateEditableProps();
28596
+ if (!disabled) {
28597
+ this.restoreFocus();
28598
+ }
28599
+ }
28512
28600
  watchValue(newValue) {
28513
28601
  if (!this.view) {
28514
28602
  return;
@@ -28568,13 +28656,19 @@ const ProsemirrorAdapter = class {
28568
28656
  (_e = this.view) === null || _e === void 0 ? void 0 : _e.destroy();
28569
28657
  }
28570
28658
  render() {
28571
- return (index$1.h(index$1.Host, { key: '6c92f1576fdd862e592d0ccf6779c6d3da806808', onFocus: this.handleFocus }, index$1.h("div", { key: '0b1b90a7c68b62ecffed21f4c49fced5333f0d83', id: "editor" }), this.renderToolbar(), this.renderLinkMenu()));
28659
+ return (index$1.h(index$1.Host, { key: 'eff663aa0d2c0ce2906fc160a70691e78dbda774', onFocus: this.handleFocus }, index$1.h("div", { key: '71111267b9098261ca843516ae067443c7f40740', id: "editor" }), this.renderToolbar(), this.renderLinkMenu()));
28572
28660
  }
28573
28661
  renderToolbar() {
28574
28662
  if (this.actionBarItems.length === 0 || this.ui === 'no-toolbar') {
28575
28663
  return;
28576
28664
  }
28577
- return (index$1.h("div", { class: "toolbar" }, index$1.h("limel-action-bar", { ref: (el) => (this.actionBarElement = el), accessibleLabel: translations.translations.get('editor-menu.toolbar', this.language), actions: this.actionBarItems, onItemSelected: this.handleActionBarItem })));
28665
+ return (index$1.h("div", { class: "toolbar" }, index$1.h("limel-action-bar", { ref: (el) => (this.actionBarElement = el), accessibleLabel: translations.translations.get('editor-menu.toolbar', this.language), actions: this.getToolbarItems(), onItemSelected: this.handleActionBarItem })));
28666
+ }
28667
+ getToolbarItems() {
28668
+ if (!this.disabled) {
28669
+ return this.actionBarItems;
28670
+ }
28671
+ return this.actionBarItems.map((item) => isItem.isItem(item) ? Object.assign(Object.assign({}, item), { disabled: true }) : item);
28578
28672
  }
28579
28673
  renderLinkMenu() {
28580
28674
  if (!this.isLinkMenuOpen) {
@@ -28614,6 +28708,8 @@ const ProsemirrorAdapter = class {
28614
28708
  this.view = new EditorView(this.host.shadowRoot.querySelector('#editor'), {
28615
28709
  state: this.createEditorState(initialDoc),
28616
28710
  dispatchTransaction: this.handleTransaction,
28711
+ attributes: this.getEditableAttributes(),
28712
+ editable: this.isEditable,
28617
28713
  });
28618
28714
  this.view.dom.addEventListener('blur', this.handleBlur);
28619
28715
  this.view.dom.addEventListener('mousedown', this.handleMouseDown);
@@ -28623,6 +28719,47 @@ const ProsemirrorAdapter = class {
28623
28719
  // Initialize lastEmittedValue to prevent false change events
28624
28720
  this.lastEmittedValue = this.contentConverter.serialize(this.view, this.schema);
28625
28721
  }
28722
+ updateEditableProps() {
28723
+ var _a;
28724
+ (_a = this.view) === null || _a === void 0 ? void 0 : _a.setProps({
28725
+ attributes: this.getEditableAttributes(),
28726
+ editable: this.isEditable,
28727
+ });
28728
+ }
28729
+ restoreFocus() {
28730
+ var _a;
28731
+ const shouldRestore = this.hadFocusWhenDisabled &&
28732
+ document.activeElement === document.body;
28733
+ this.hadFocusWhenDisabled = false;
28734
+ if (shouldRestore) {
28735
+ (_a = this.view) === null || _a === void 0 ? void 0 : _a.focus();
28736
+ }
28737
+ }
28738
+ getEditableAttributes() {
28739
+ const attributes = {
28740
+ role: 'textbox',
28741
+ 'aria-multiline': 'true',
28742
+ };
28743
+ if (this.accessibleLabel) {
28744
+ attributes['aria-label'] = this.accessibleLabel;
28745
+ }
28746
+ if (this.accessibleDescription) {
28747
+ attributes['aria-description'] = this.accessibleDescription;
28748
+ }
28749
+ if (this.accessiblePlaceholder) {
28750
+ attributes['aria-placeholder'] = this.accessiblePlaceholder;
28751
+ }
28752
+ if (this.required) {
28753
+ attributes['aria-required'] = 'true';
28754
+ }
28755
+ if (this.invalid) {
28756
+ attributes['aria-invalid'] = 'true';
28757
+ }
28758
+ if (this.disabled) {
28759
+ attributes['aria-disabled'] = 'true';
28760
+ }
28761
+ return attributes;
28762
+ }
28626
28763
  initializeSchema() {
28627
28764
  return buildEditorSchema({
28628
28765
  customElements: this.customElements,
@@ -28704,9 +28841,31 @@ const ProsemirrorAdapter = class {
28704
28841
  this.imageRemoved.emit(image);
28705
28842
  }
28706
28843
  }
28844
+ closeLinkMenu() {
28845
+ this.isLinkMenuOpen = false;
28846
+ this.link = { text: '', href: 'https://' };
28847
+ }
28707
28848
  static get delegatesFocus() { return true; }
28708
28849
  get host() { return index$1.getElement(this); }
28709
28850
  static get watchers() { return {
28851
+ "accessibleLabel": [{
28852
+ "watchEditableAttributes": 0
28853
+ }],
28854
+ "accessibleDescription": [{
28855
+ "watchEditableAttributes": 0
28856
+ }],
28857
+ "accessiblePlaceholder": [{
28858
+ "watchEditableAttributes": 0
28859
+ }],
28860
+ "required": [{
28861
+ "watchEditableAttributes": 0
28862
+ }],
28863
+ "invalid": [{
28864
+ "watchEditableAttributes": 0
28865
+ }],
28866
+ "disabled": [{
28867
+ "watchDisabled": 0
28868
+ }],
28710
28869
  "value": [{
28711
28870
  "watchValue": 0
28712
28871
  }]
@@ -449,7 +449,7 @@ const SelectTemplate = (props) => {
449
449
  };
450
450
  return [
451
451
  index.h("div", { class: fieldClassList }, index.h("limel-notched-outline", { class: classList, labelId: TRIGGER_ID, labelElementId: LABEL_ID, label: props.label, required: props.required, invalid: !isValid, disabled: props.disabled, readonly: props.readonly, hasValue: hasValue, hasFloatingLabel: floatLabelAbove(props) }, index.h(SelectValue, Object.assign({}, props, { hasValue: hasValue, isValid: isValid, hasEmptyText: hasEmptyText }))), index.h(HelperText, { text: props.helperText, isValid: isValid })),
452
- index.h(SelectDropdown, Object.assign({}, props)),
452
+ index.h(SelectDropdown, Object.assign({}, props, { isValid: isValid })),
453
453
  ];
454
454
  };
455
455
  const getDescribedBy = (props) => {
@@ -511,7 +511,7 @@ const NativeDropdown = (props) => {
511
511
  const options = props.options
512
512
  .filter((option) => !('separator' in option))
513
513
  .map(renderOption(props.value));
514
- return (index.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));
514
+ return (index.h("select", { required: props.required, "aria-labelledby": props.label ? LABEL_ID : undefined, "aria-describedby": getDescribedBy(props), "aria-disabled": props.disabled, "aria-required": props.required, "aria-invalid": props.isValid ? undefined : 'true', onChange: props.onNativeChange, onFocus: props.open, onBlur: props.close, class: "limel-select__native-control", disabled: props.disabled, multiple: props.multiple }, options));
515
515
  };
516
516
  const renderOption = (selectedOption) => {
517
517
  return (option) => {
@@ -307,15 +307,15 @@ const Slider = class {
307
307
  if (this.disabled || this.readonly) {
308
308
  inputProps.disabled = true;
309
309
  }
310
- return (index.h(index.Host, { key: '6d910879894ffc7ff36df228e4252e4758622ab9', class: this.getContainerClassList() }, index.h("limel-notched-outline", { key: '56e3b4dbc963b6923c63a33acb21895f4e86c947', labelId: this.inputId, label: this.label, required: this.required, invalid: this.invalid, disabled: this.disabled, readonly: this.readonly, hasValue: !this.isUnset, hasFloatingLabel: true }, index.h("div", { key: 'f74ef31e0b7d67dcc8a231a05f9b00b84de50b33', slot: "content" }, index.h("div", { key: '4a4018ac095977f89cba99a0222603469d11ce30', class: "slider", style: { '--slider-fraction': `${fraction}` } }, index.h("input", Object.assign({ key: '588a4049b70749cf54a9faf08d6f0514cbfd2d6c', id: this.inputId, type: "range", min: min, max: max, value: this.displayValue, "aria-describedby": this.helperText
310
+ return (index.h(index.Host, { key: '6d910879894ffc7ff36df228e4252e4758622ab9', class: this.getContainerClassList() }, index.h("limel-notched-outline", { key: '56e3b4dbc963b6923c63a33acb21895f4e86c947', labelId: this.inputId, label: this.label, required: this.required, invalid: this.invalid, disabled: this.disabled, readonly: this.readonly, hasValue: !this.isUnset, hasFloatingLabel: true }, index.h("div", { key: 'f74ef31e0b7d67dcc8a231a05f9b00b84de50b33', slot: "content" }, index.h("div", { key: '4a4018ac095977f89cba99a0222603469d11ce30', class: "slider", style: { '--slider-fraction': `${fraction}` } }, index.h("input", Object.assign({ key: '3c9dc1fb20dd26ae0ea6cbab0914d5012a9c0184', id: this.inputId, type: "range", min: min, max: max, value: this.displayValue, "aria-describedby": this.helperText
311
311
  ? this.helperTextId
312
- : undefined, "aria-valuetext": this.isUnset
312
+ : undefined, "aria-invalid": this.invalid ? 'true' : undefined, "aria-valuetext": this.isUnset
313
313
  ? translations.translations.get('value-not-set', this.language)
314
314
  : undefined, ref: (el) => {
315
315
  this.inputElement = el;
316
- }, onInput: this.handleInput, onChange: this.handleChange, onClick: this.handleClick }, inputProps)), index.h("div", { key: '48f58e7fe170d8fe9d01fcd938b53088ff9b796d', class: "track" }, index.h("div", { key: '4f488b62a840c0346de6157d7d1ce7bdba26b357', class: "active" }), this.renderStepDots(min, max)), index.h("div", { key: '4234e2d0711fa650b1d0b7c05eb9d52d327818fc', class: "thumb" }, index.h("div", { key: '28c9d98e694cdaa0927ef05b396199b24d6b6e16', class: "knob" }), index.h("div", { key: 'cde9b95313351dd37794e32f2a107426a5bca7dc', class: "indicator", "aria-hidden": "true" }, this.isUnset
316
+ }, onInput: this.handleInput, onChange: this.handleChange, onClick: this.handleClick }, inputProps)), index.h("div", { key: '4873567abad9bd78cd44cf244bb5c41e87c10e12', class: "track" }, index.h("div", { key: '165858a4a1ee9ff35ed17b3f31c358b77143af47', class: "active" }), this.renderStepDots(min, max)), index.h("div", { key: 'ad6a62247047caad0332385713acf0660473589c', class: "thumb" }, index.h("div", { key: '10a5b6171a86d156de78987caf36c6256b1d3db7', class: "knob" }), index.h("div", { key: 'dac6f4e48e2345091c58433124afeb29cca52e02', class: "indicator", "aria-hidden": "true" }, this.isUnset
317
317
  ? '\u{2194}\u{FE0E}'
318
- : this.displayValue))), index.h("div", { key: '0fa3c9c45697c787376880734f8be0127927eb30', class: "range-labels" }, index.h("span", { key: '9dc7d1b38bcf62369e827519b919c9cd69676b4d', class: "min" }, this.multiplyByFactor(this.valuemin), this.unit), index.h("span", { key: '6cf1350f909d119da15e46599dbada96f2e9f7dc', class: "max" }, this.multiplyByFactor(this.valuemax), this.unit)))), this.renderClearButton(), this.renderHelperLine()));
318
+ : this.displayValue))), index.h("div", { key: 'b62ca0a0dc80b5d6c370d477a7cb340c5c1fb79d', class: "range-labels" }, index.h("span", { key: '4455915693d0c95db8f5a05ac344e8de3c7efe4d', class: "min" }, this.multiplyByFactor(this.valuemin), this.unit), index.h("span", { key: 'ef141dec4f89ad937e521cb82b94ad3348904e49', class: "max" }, this.multiplyByFactor(this.valuemax), this.unit)))), this.renderClearButton(), this.renderHelperLine()));
319
319
  }
320
320
  watchValue() {
321
321
  this.syncStateFromValue();
@@ -44,7 +44,7 @@ const Switch = class {
44
44
  return (index.h("limel-dynamic-label", { value: this.value, "aria-describedby": this.ariaDescribedBy, defaultLabel: { text: this.label, icon: icon }, labels: this.readonlyLabels }));
45
45
  };
46
46
  this.renderInteractive = () => {
47
- return (index.h("div", { class: "switch" }, index.h("button", { id: this.fieldId, type: "button", role: "switch", "aria-checked": String(this.value), disabled: this.disabled, onClick: this.handleClick, "aria-describedby": this.ariaDescribedBy }, index.h("span", { class: "handle" })), index.h("label", { htmlFor: this.fieldId }, this.label)));
47
+ return (index.h("div", { class: "switch" }, index.h("button", { id: this.fieldId, type: "button", role: "switch", "aria-checked": String(this.value), disabled: this.disabled, onClick: this.handleClick, "aria-describedby": this.ariaDescribedBy, "aria-invalid": this.invalid ? 'true' : undefined }, index.h("span", { class: "handle" })), index.h("label", { htmlFor: this.fieldId }, this.label)));
48
48
  };
49
49
  this.renderHelperLine = () => {
50
50
  if (!this.hasHelperText()) {