@lukso/web-components 1.160.4 → 1.161.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 (121) hide show
  1. package/dist/components/index.cjs +7 -5
  2. package/dist/components/index.js +5 -5
  3. package/dist/components/lukso-button/index.cjs +3 -3
  4. package/dist/components/lukso-button/index.js +3 -3
  5. package/dist/components/lukso-card/index.cjs +6 -6
  6. package/dist/components/lukso-card/index.js +6 -6
  7. package/dist/components/lukso-checkbox/index.cjs +3 -3
  8. package/dist/components/lukso-checkbox/index.js +3 -3
  9. package/dist/components/lukso-collapse/index.cjs +3 -3
  10. package/dist/components/lukso-collapse/index.js +3 -3
  11. package/dist/components/lukso-color-picker/index.cjs +5 -5
  12. package/dist/components/lukso-color-picker/index.js +5 -5
  13. package/dist/components/lukso-dropdown/index.cjs +4 -4
  14. package/dist/components/lukso-dropdown/index.js +4 -4
  15. package/dist/components/lukso-dropdown-option/index.cjs +2 -2
  16. package/dist/components/lukso-dropdown-option/index.js +2 -2
  17. package/dist/components/lukso-footer/index.cjs +3 -2
  18. package/dist/components/lukso-footer/index.d.ts.map +1 -1
  19. package/dist/components/lukso-footer/index.js +3 -2
  20. package/dist/components/lukso-icon/index.cjs +4 -4
  21. package/dist/components/lukso-icon/index.js +4 -4
  22. package/dist/components/lukso-image/index.cjs +4 -4
  23. package/dist/components/lukso-image/index.js +4 -4
  24. package/dist/components/lukso-input/index.cjs +4 -4
  25. package/dist/components/lukso-input/index.js +4 -4
  26. package/dist/components/lukso-markdown/index.cjs +13 -5
  27. package/dist/components/lukso-markdown/index.d.ts +1 -0
  28. package/dist/components/lukso-markdown/index.d.ts.map +1 -1
  29. package/dist/components/lukso-markdown/index.js +13 -5
  30. package/dist/components/lukso-markdown/lukso-markdown.stories.d.ts +2 -0
  31. package/dist/components/lukso-markdown/lukso-markdown.stories.d.ts.map +1 -1
  32. package/dist/components/lukso-markdown-editor/index.cjs +334 -255
  33. package/dist/components/lukso-markdown-editor/index.d.ts +9 -1
  34. package/dist/components/lukso-markdown-editor/index.d.ts.map +1 -1
  35. package/dist/components/lukso-markdown-editor/index.js +334 -255
  36. package/dist/components/lukso-markdown-editor/lukso-markdown-editor.stories.d.ts +6 -0
  37. package/dist/components/lukso-markdown-editor/lukso-markdown-editor.stories.d.ts.map +1 -1
  38. package/dist/components/lukso-modal/index.cjs +2 -2
  39. package/dist/components/lukso-modal/index.js +2 -2
  40. package/dist/components/lukso-navbar/index.cjs +3 -3
  41. package/dist/components/lukso-navbar/index.js +3 -3
  42. package/dist/components/lukso-pagination/index.cjs +3 -3
  43. package/dist/components/lukso-pagination/index.js +3 -3
  44. package/dist/components/lukso-profile/index.cjs +3 -3
  45. package/dist/components/lukso-profile/index.js +3 -3
  46. package/dist/components/lukso-progress/index.cjs +3 -3
  47. package/dist/components/lukso-progress/index.js +3 -3
  48. package/dist/components/lukso-radio/index.cjs +3 -3
  49. package/dist/components/lukso-radio/index.js +3 -3
  50. package/dist/components/lukso-radio-group/index.cjs +3 -3
  51. package/dist/components/lukso-radio-group/index.js +3 -3
  52. package/dist/components/lukso-sanitize/index.cjs +9 -1390
  53. package/dist/components/lukso-sanitize/index.d.ts +17 -1
  54. package/dist/components/lukso-sanitize/index.d.ts.map +1 -1
  55. package/dist/components/lukso-sanitize/index.js +4 -1396
  56. package/dist/components/lukso-sanitize/lukso-sanitize.stories.d.ts +17 -1
  57. package/dist/components/lukso-sanitize/lukso-sanitize.stories.d.ts.map +1 -1
  58. package/dist/components/lukso-search/index.cjs +6 -6
  59. package/dist/components/lukso-search/index.js +6 -6
  60. package/dist/components/lukso-select/index.cjs +6 -6
  61. package/dist/components/lukso-select/index.js +6 -6
  62. package/dist/components/lukso-share/index.cjs +2 -2
  63. package/dist/components/lukso-share/index.js +2 -2
  64. package/dist/components/lukso-switch/index.cjs +4 -4
  65. package/dist/components/lukso-switch/index.js +4 -4
  66. package/dist/components/lukso-tag/index.cjs +3 -3
  67. package/dist/components/lukso-tag/index.js +3 -3
  68. package/dist/components/lukso-terms/index.cjs +4 -4
  69. package/dist/components/lukso-terms/index.js +4 -4
  70. package/dist/components/lukso-textarea/index.cjs +4 -4
  71. package/dist/components/lukso-textarea/index.js +4 -4
  72. package/dist/components/lukso-tooltip/index.cjs +4 -4
  73. package/dist/components/lukso-tooltip/index.js +4 -4
  74. package/dist/components/lukso-username/index.cjs +4 -4
  75. package/dist/components/lukso-username/index.js +4 -4
  76. package/dist/components/lukso-wizard/index.cjs +2 -2
  77. package/dist/components/lukso-wizard/index.js +2 -2
  78. package/dist/{index-DNhzT2hA.cjs → index-BDC9pVk6.cjs} +2 -2
  79. package/dist/index-BFqOU6o6.cjs +50 -0
  80. package/dist/{index-NKnet_Ow.js → index-BJwLob67.js} +2 -2
  81. package/dist/{index-CKlH1beR.js → index-BOWftFAY.js} +1 -1
  82. package/dist/{index-CKjNXRek.cjs → index-C2uvRzO4.cjs} +3 -3
  83. package/dist/{index-C1JF-hTl.cjs → index-CEnG_x_7.cjs} +5 -5
  84. package/dist/index-CQq_Eyeu.js +41 -0
  85. package/dist/index-Chl2HHJ6.cjs +1408 -0
  86. package/dist/index-JvkSiEeQ.js +1404 -0
  87. package/dist/{index-C9Ins46B.cjs → index-Zriuvita.cjs} +1 -1
  88. package/dist/{index-BSwFyDEC.js → index-f-xajtU2.js} +3 -3
  89. package/dist/{index-CDUQ0-Uh.js → index-oQecUOlb.js} +5 -5
  90. package/dist/index.cjs +7 -5
  91. package/dist/index.js +5 -5
  92. package/dist/{property-Da9lvmME.js → property-CPkYmAYi.js} +1 -1
  93. package/dist/{property-dUn0JQiG.cjs → property-Cs8qVdri.cjs} +1 -1
  94. package/dist/shared/tailwind-element/index.cjs +1 -1
  95. package/dist/shared/tailwind-element/index.js +1 -1
  96. package/dist/{state-CD8hXUlY.cjs → state-Bh6EXopE.cjs} +1 -1
  97. package/dist/{state-CtpsBPdH.js → state-CtrTo6cC.js} +1 -1
  98. package/dist/{style-map-CDCcO0mt.js → style-map-BBz25umN.js} +1 -1
  99. package/dist/{style-map-nBexjTCa.cjs → style-map-DhbNG03r.cjs} +1 -1
  100. package/dist/tailwind-config.cjs +65 -0
  101. package/dist/tailwind-config.d.ts +85 -0
  102. package/dist/tailwind-config.d.ts.map +1 -1
  103. package/dist/tailwind-config.js +64 -1
  104. package/dist/{unsafe-html-DHNeIs-4.cjs → unsafe-html-Cb1yjpJn.cjs} +1 -1
  105. package/dist/{unsafe-html-Ci4jmi7b.js → unsafe-html-DTE5r2A7.js} +1 -1
  106. package/package.json +1 -1
  107. package/tailwind.config.cjs +208 -178
  108. package/tools/cn.cjs +1 -1
  109. package/tools/cn.js +1 -1
  110. package/tools/copy-assets.cjs +16 -16
  111. package/tools/copy-assets.js +2 -2
  112. package/tools/index.cjs +1 -1
  113. package/tools/index.js +1 -1
  114. package/tools/{tailwind-config-Ch2-b3Be.js → tailwind-config-DVTyRd7x.js} +64 -1
  115. package/tools/{tailwind-config-BIErjaAT.cjs → tailwind-config-DoMZEvsr.cjs} +65 -0
  116. package/tools/tailwind-config.cjs +3 -1
  117. package/tools/tailwind-config.d.ts +85 -0
  118. package/tools/tailwind-config.d.ts.map +1 -1
  119. package/tools/tailwind-config.js +1 -1
  120. package/dist/index-B5CXCi6j.js +0 -41
  121. package/dist/index-D4DEFira.cjs +0 -50
@@ -2,9 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const shared_tailwindElement_index = require('../../index-D4DEFira.cjs');
6
- const property = require('../../property-dUn0JQiG.cjs');
7
- const state = require('../../state-CD8hXUlY.cjs');
5
+ const shared_tailwindElement_index = require('../../index-BFqOU6o6.cjs');
6
+ const property = require('../../property-Cs8qVdri.cjs');
7
+ const state = require('../../state-Bh6EXopE.cjs');
8
8
  const query = require('../../query-EFiHeHdi.cjs');
9
9
  const index = require('../../index-CaJky2qL.cjs');
10
10
  require('../../tailwind-config.cjs');
@@ -14,7 +14,7 @@ require('../lukso-markdown/index.cjs');
14
14
  require('../lukso-switch/index.cjs');
15
15
  require('../lukso-button/index.cjs');
16
16
  require('../lukso-icon/index.cjs');
17
- require('../lukso-sanitize/index.cjs');
17
+ require('../../index-Chl2HHJ6.cjs');
18
18
  require('../lukso-dropdown/index.cjs');
19
19
  require('../lukso-dropdown-option/index.cjs');
20
20
  require('../lukso-tooltip/index.cjs');
@@ -205,6 +205,7 @@ var __decorateClass = (decorators, target, key, kind) => {
205
205
  };
206
206
  const DEFAULT_PREVIEW_BACKGROUND_COLOR = "#f9f9f9";
207
207
  const DEFAULT_PREVIEW_TEXT_COLOR = "#374151";
208
+ const ACCESSIBILITY_CHECK_DELAY = 1e3;
208
209
  exports.LuksoMarkdownEditor = class LuksoMarkdownEditor extends shared_tailwindElement_index.TailwindStyledElement(style) {
209
210
  constructor() {
210
211
  super(...arguments);
@@ -224,6 +225,18 @@ exports.LuksoMarkdownEditor = class LuksoMarkdownEditor extends shared_tailwindE
224
225
  this.placeholder = "";
225
226
  this.previewBackgroundColor = DEFAULT_PREVIEW_BACKGROUND_COLOR;
226
227
  this.previewTextColor = DEFAULT_PREVIEW_TEXT_COLOR;
228
+ this.stripHtmlTags = false;
229
+ this.tools = void 0;
230
+ this.toolsState = [];
231
+ this.defaultTools = [
232
+ "heading",
233
+ "bold",
234
+ "italic",
235
+ "list",
236
+ "link",
237
+ "alignment",
238
+ "color"
239
+ ];
227
240
  this.savedSelectionForPreview = null;
228
241
  this.isHeadingDropdownOpen = false;
229
242
  this.isColorDropdownOpen = false;
@@ -260,7 +273,6 @@ exports.LuksoMarkdownEditor = class LuksoMarkdownEditor extends shared_tailwindE
260
273
  this.accessibilityViolations = [];
261
274
  this.hasAccessibilityViolations = false;
262
275
  this.accessibilityCheckTimeout = null;
263
- this.ACCESSIBILITY_CHECK_DELAY = 1e3;
264
276
  this.handleOutsideClick = (event) => {
265
277
  const target = event.target;
266
278
  const isInsideThisComponent = this.contains(target) || this.shadowRoot?.contains(target);
@@ -532,7 +544,25 @@ exports.LuksoMarkdownEditor = class LuksoMarkdownEditor extends shared_tailwindE
532
544
  this.accessibilityCheckTimeout = window.setTimeout(() => {
533
545
  this.performAccessibilityCheck();
534
546
  this.accessibilityCheckTimeout = null;
535
- }, this.ACCESSIBILITY_CHECK_DELAY);
547
+ }, ACCESSIBILITY_CHECK_DELAY);
548
+ }
549
+ /**
550
+ * Clean up empty color spans from the value.
551
+ * This removes spans like <span style="color: #xxx"></span> with no content.
552
+ */
553
+ cleanupEmptyColorSpans() {
554
+ const emptyColorSpanRegex = /<span style="color: [^"]+"><\/span>/g;
555
+ const cleanedValue = this.value.replace(emptyColorSpanRegex, "");
556
+ if (cleanedValue !== this.value) {
557
+ this.value = cleanedValue;
558
+ const textarea = this.textareaEl?.shadowRoot?.querySelector("textarea");
559
+ if (textarea) {
560
+ const currentPos = textarea.selectionStart ?? 0;
561
+ textarea.value = cleanedValue;
562
+ const newPos = Math.min(currentPos, cleanedValue.length);
563
+ textarea.setSelectionRange(newPos, newPos);
564
+ }
565
+ }
536
566
  }
537
567
  /**
538
568
  * Unified helper that ensures both active format state and change events are properly
@@ -542,6 +572,7 @@ exports.LuksoMarkdownEditor = class LuksoMarkdownEditor extends shared_tailwindE
542
572
  * @param event - Optional event that triggered the change
543
573
  */
544
574
  emitChangeAndRefresh(event) {
575
+ this.cleanupEmptyColorSpans();
545
576
  this.updateActiveFormats();
546
577
  this.dispatchChange(event);
547
578
  this.scheduleAccessibilityCheck();
@@ -831,9 +862,27 @@ exports.LuksoMarkdownEditor = class LuksoMarkdownEditor extends shared_tailwindE
831
862
  }
832
863
  this.value = before + transformed + after;
833
864
  textarea.value = before + transformed + after;
834
- const cursorPosition = before.length + transformed.length;
865
+ let selStart;
866
+ let selEnd;
867
+ if (alignment === "left" || existingMatch && existingMatch[1] === alignment || this.getNestedAlignment(selected) === alignment) {
868
+ selStart = before.length;
869
+ selEnd = before.length + transformed.length;
870
+ } else {
871
+ const openTagMatch = transformed.match(
872
+ /<div style="text-align: (center|right);">([^<]*)<\/div>/
873
+ );
874
+ if (openTagMatch) {
875
+ const innerContent = openTagMatch[2];
876
+ const tagStart = transformed.indexOf(">") + 1;
877
+ selStart = before.length + tagStart;
878
+ selEnd = selStart + innerContent.length;
879
+ } else {
880
+ selStart = before.length;
881
+ selEnd = before.length + transformed.length;
882
+ }
883
+ }
835
884
  requestAnimationFrame(() => {
836
- textarea.setSelectionRange(cursorPosition, cursorPosition);
885
+ textarea.setSelectionRange(selStart, selEnd);
837
886
  this.emitChangeAndRefresh();
838
887
  });
839
888
  });
@@ -1331,7 +1380,7 @@ exports.LuksoMarkdownEditor = class LuksoMarkdownEditor extends shared_tailwindE
1331
1380
  this.value = before + wrapped + after;
1332
1381
  textarea.value = before + wrapped + after;
1333
1382
  const selStart = before.length + newColorTagOpen.length;
1334
- const selEnd = selStart + (selected ? selected.length : 4);
1383
+ const selEnd = selStart + (selected ? selected.length : 0);
1335
1384
  requestAnimationFrame(() => {
1336
1385
  textarea.setSelectionRange(selStart, selEnd);
1337
1386
  this.emitChangeAndRefresh();
@@ -2136,126 +2185,127 @@ ${indent}${nextNumber}. `;
2136
2185
  toolbarTemplate() {
2137
2186
  return shared_tailwindElement_index.x`
2138
2187
  <div class="flex items-center gap-1">
2139
- <div class=${axe.cn(this.styles().headingMenu())}>
2140
- <!-- Heading -->
2141
- <lukso-tooltip text="Heading options" placement="top">
2142
- <lukso-button
2143
- id=${this.headingTriggerId}
2144
- @click=${(e) => {
2188
+ <!-- Heading -->
2189
+ ${this.toolsState.includes("heading") ? shared_tailwindElement_index.x`<div class=${axe.cn(this.styles().headingMenu())}>
2190
+ <lukso-tooltip text="Heading options" placement="top">
2191
+ <lukso-button
2192
+ id=${this.headingTriggerId}
2193
+ @click=${(e) => {
2145
2194
  e.stopPropagation();
2146
2195
  this.isColorDropdownOpen = false;
2147
2196
  this.isListDropdownOpen = false;
2148
2197
  this.isAlignmentDropdownOpen = false;
2149
2198
  this.isHeadingDropdownOpen = !this.isHeadingDropdownOpen;
2150
2199
  }}
2151
- aria-expanded=${this.isHeadingDropdownOpen ? "true" : "false"}
2152
- aria-label="Heading options"
2153
- variant="secondary"
2154
- size="small"
2155
- custom-class=${this.toolbarButton({
2200
+ aria-expanded=${this.isHeadingDropdownOpen ? "true" : "false"}
2201
+ aria-label="Heading options"
2202
+ variant="secondary"
2203
+ size="small"
2204
+ custom-class=${this.toolbarButton({
2156
2205
  active: this.getActiveHeadingLevel() > 0
2157
2206
  })}
2158
- is-icon
2159
- >
2160
- <lukso-icon
2161
- name="smallcaps"
2162
- size="small"
2163
- pack="vuesax"
2164
- variant="linear"
2165
- ></lukso-icon>
2166
- </lukso-button>
2167
- </lukso-tooltip>
2168
- <lukso-dropdown
2169
- id="headingDropdown"
2170
- trigger-id=""
2171
- size="medium"
2172
- ?is-open=${this.isHeadingDropdownOpen}
2173
- >
2174
- <lukso-dropdown-option
2175
- ?is-selected=${this.getActiveHeadingLevel() === 0}
2176
- @click=${(e) => {
2207
+ is-icon
2208
+ >
2209
+ <lukso-icon
2210
+ name="smallcaps"
2211
+ size="small"
2212
+ pack="vuesax"
2213
+ variant="linear"
2214
+ ></lukso-icon>
2215
+ </lukso-button>
2216
+ </lukso-tooltip>
2217
+ <lukso-dropdown
2218
+ id="headingDropdown"
2219
+ trigger-id=""
2220
+ size="medium"
2221
+ ?is-open=${this.isHeadingDropdownOpen}
2222
+ >
2223
+ <lukso-dropdown-option
2224
+ ?is-selected=${this.getActiveHeadingLevel() === 0}
2225
+ @click=${(e) => {
2177
2226
  e.stopPropagation();
2178
2227
  this.restoreFocusAndSelection();
2179
2228
  this.applyHeading(0);
2180
2229
  this.isHeadingDropdownOpen = false;
2181
2230
  }}
2182
- size="medium"
2183
- >
2184
- Normal text
2185
- </lukso-dropdown-option>
2186
- <lukso-dropdown-option
2187
- ?is-selected=${this.getActiveHeadingLevel() === 1}
2188
- @click=${(e) => {
2231
+ size="medium"
2232
+ >
2233
+ Normal text
2234
+ </lukso-dropdown-option>
2235
+ <lukso-dropdown-option
2236
+ ?is-selected=${this.getActiveHeadingLevel() === 1}
2237
+ @click=${(e) => {
2189
2238
  e.stopPropagation();
2190
2239
  this.restoreFocusAndSelection();
2191
2240
  this.applyHeading(1);
2192
2241
  this.isHeadingDropdownOpen = false;
2193
2242
  }}
2194
- size="medium"
2195
- >
2196
- Heading 1
2197
- </lukso-dropdown-option>
2198
- <lukso-dropdown-option
2199
- ?is-selected=${this.getActiveHeadingLevel() === 2}
2200
- @click=${(e) => {
2243
+ size="medium"
2244
+ >
2245
+ Heading 1
2246
+ </lukso-dropdown-option>
2247
+ <lukso-dropdown-option
2248
+ ?is-selected=${this.getActiveHeadingLevel() === 2}
2249
+ @click=${(e) => {
2201
2250
  e.stopPropagation();
2202
2251
  this.restoreFocusAndSelection();
2203
2252
  this.applyHeading(2);
2204
2253
  this.isHeadingDropdownOpen = false;
2205
2254
  }}
2206
- size="medium"
2207
- >
2208
- Heading 2
2209
- </lukso-dropdown-option>
2210
- <lukso-dropdown-option
2211
- ?is-selected=${this.getActiveHeadingLevel() === 3}
2212
- @click=${(e) => {
2255
+ size="medium"
2256
+ >
2257
+ Heading 2
2258
+ </lukso-dropdown-option>
2259
+ <lukso-dropdown-option
2260
+ ?is-selected=${this.getActiveHeadingLevel() === 3}
2261
+ @click=${(e) => {
2213
2262
  e.stopPropagation();
2214
2263
  this.restoreFocusAndSelection();
2215
2264
  this.applyHeading(3);
2216
2265
  this.isHeadingDropdownOpen = false;
2217
2266
  }}
2218
- size="medium"
2219
- >
2220
- Heading 3
2221
- </lukso-dropdown-option>
2222
- <lukso-dropdown-option
2223
- ?is-selected=${this.getActiveHeadingLevel() === 4}
2224
- @click=${(e) => {
2267
+ size="medium"
2268
+ >
2269
+ Heading 3
2270
+ </lukso-dropdown-option>
2271
+ <lukso-dropdown-option
2272
+ ?is-selected=${this.getActiveHeadingLevel() === 4}
2273
+ @click=${(e) => {
2225
2274
  e.stopPropagation();
2226
2275
  this.restoreFocusAndSelection();
2227
2276
  this.applyHeading(4);
2228
2277
  this.isHeadingDropdownOpen = false;
2229
2278
  }}
2230
- size="medium"
2231
- >
2232
- Heading 4
2233
- </lukso-dropdown-option>
2234
- </lukso-dropdown>
2235
- </div>
2279
+ size="medium"
2280
+ >
2281
+ Heading 4
2282
+ </lukso-dropdown-option>
2283
+ </lukso-dropdown>
2284
+ </div>` : shared_tailwindElement_index.E}
2236
2285
 
2237
2286
  <!-- Bold -->
2238
- ${this.buttonTemplate(
2287
+ ${this.toolsState.includes("bold") ? this.buttonTemplate(
2239
2288
  "text-bold",
2240
2289
  () => this.toggleWrap("**"),
2241
2290
  "Bold",
2242
2291
  this.activeFormats.bold
2243
- )}
2292
+ ) : shared_tailwindElement_index.E}
2244
2293
 
2245
2294
  <!-- Italic -->
2246
- ${this.buttonTemplate(
2295
+ ${this.toolsState.includes("italic") ? this.buttonTemplate(
2247
2296
  "text-italic",
2248
2297
  () => this.toggleWrap("*"),
2249
2298
  "Italic",
2250
2299
  this.activeFormats.italic
2251
- )}
2300
+ ) : shared_tailwindElement_index.E}
2252
2301
 
2253
2302
  <!-- List -->
2254
- <div class=${this.styles().listMenu()}>
2255
- <lukso-tooltip text="List options" placement="top">
2256
- <lukso-button
2257
- id=${this.listTriggerId}
2258
- @click=${(e) => {
2303
+ ${this.toolsState.includes("list") ? shared_tailwindElement_index.x`
2304
+ <div class=${this.styles().listMenu()}>
2305
+ <lukso-tooltip text="List options" placement="top">
2306
+ <lukso-button
2307
+ id=${this.listTriggerId}
2308
+ @click=${(e) => {
2259
2309
  e.stopPropagation();
2260
2310
  this.restoreFocusAndSelection();
2261
2311
  this.isHeadingDropdownOpen = false;
@@ -2263,82 +2313,84 @@ ${indent}${nextNumber}. `;
2263
2313
  this.isAlignmentDropdownOpen = false;
2264
2314
  this.isListDropdownOpen = !this.isListDropdownOpen;
2265
2315
  }}
2266
- aria-expanded=${this.isListDropdownOpen ? "true" : "false"}
2267
- aria-label="List options"
2268
- variant="secondary"
2269
- size="small"
2270
- custom-class=${this.toolbarButton({
2316
+ aria-expanded=${this.isListDropdownOpen ? "true" : "false"}
2317
+ aria-label="List options"
2318
+ variant="secondary"
2319
+ size="small"
2320
+ custom-class=${this.toolbarButton({
2271
2321
  active: this.activeFormats.unorderedList || this.activeFormats.orderedList
2272
2322
  })}
2273
- is-icon
2274
- >
2275
- <lukso-icon
2276
- name="task"
2277
- size="small"
2278
- pack="vuesax"
2279
- variant="linear"
2280
- ></lukso-icon>
2281
- </lukso-button>
2282
- </lukso-tooltip>
2283
- <lukso-dropdown
2284
- id="listDropdown"
2285
- trigger-id=""
2286
- size="medium"
2287
- ?is-open=${this.isListDropdownOpen}
2288
- >
2289
- <lukso-dropdown-option
2290
- ?is-selected=${this.getActiveListType() === "none"}
2291
- @click=${(e) => {
2323
+ is-icon
2324
+ >
2325
+ <lukso-icon
2326
+ name="task"
2327
+ size="small"
2328
+ pack="vuesax"
2329
+ variant="linear"
2330
+ ></lukso-icon>
2331
+ </lukso-button>
2332
+ </lukso-tooltip>
2333
+ <lukso-dropdown
2334
+ id="listDropdown"
2335
+ trigger-id=""
2336
+ size="medium"
2337
+ ?is-open=${this.isListDropdownOpen}
2338
+ >
2339
+ <lukso-dropdown-option
2340
+ ?is-selected=${this.getActiveListType() === "none"}
2341
+ @click=${(e) => {
2292
2342
  e.stopPropagation();
2293
2343
  this.restoreFocusAndSelection();
2294
2344
  this.applyList("none");
2295
2345
  this.isListDropdownOpen = false;
2296
2346
  }}
2297
- size="medium"
2298
- >
2299
- No list
2300
- </lukso-dropdown-option>
2301
- <lukso-dropdown-option
2302
- ?is-selected=${this.getActiveListType() === "unordered"}
2303
- @click=${(e) => {
2347
+ size="medium"
2348
+ >
2349
+ No list
2350
+ </lukso-dropdown-option>
2351
+ <lukso-dropdown-option
2352
+ ?is-selected=${this.getActiveListType() === "unordered"}
2353
+ @click=${(e) => {
2304
2354
  e.stopPropagation();
2305
2355
  this.restoreFocusAndSelection();
2306
2356
  this.applyList("unordered");
2307
2357
  this.isListDropdownOpen = false;
2308
2358
  }}
2309
- size="medium"
2310
- >
2311
- Unordered
2312
- </lukso-dropdown-option>
2313
- <lukso-dropdown-option
2314
- ?is-selected=${this.getActiveListType() === "ordered"}
2315
- @click=${(e) => {
2359
+ size="medium"
2360
+ >
2361
+ Unordered
2362
+ </lukso-dropdown-option>
2363
+ <lukso-dropdown-option
2364
+ ?is-selected=${this.getActiveListType() === "ordered"}
2365
+ @click=${(e) => {
2316
2366
  e.stopPropagation();
2317
2367
  this.restoreFocusAndSelection();
2318
2368
  this.applyList("ordered");
2319
2369
  this.isListDropdownOpen = false;
2320
2370
  }}
2321
- size="medium"
2322
- >
2323
- Ordered
2324
- </lukso-dropdown-option>
2325
- </lukso-dropdown>
2326
- </div>
2371
+ size="medium"
2372
+ >
2373
+ Ordered
2374
+ </lukso-dropdown-option>
2375
+ </lukso-dropdown>
2376
+ </div>
2377
+ ` : shared_tailwindElement_index.E}
2327
2378
 
2328
2379
  <!-- Link -->
2329
- ${this.buttonTemplate(
2380
+ ${this.toolsState.includes("link") ? this.buttonTemplate(
2330
2381
  "link",
2331
2382
  () => this.insertLink(),
2332
2383
  "Link",
2333
2384
  this.activeFormats.link
2334
- )}
2385
+ ) : shared_tailwindElement_index.E}
2335
2386
 
2336
2387
  <!-- Text Alignment -->
2337
- <div class=${this.styles().alignmentMenu()}>
2338
- <lukso-tooltip text="Text alignment" placement="top">
2339
- <lukso-button
2340
- id=${this.alignmentTriggerId}
2341
- @click=${(e) => {
2388
+ ${this.toolsState.includes("alignment") ? shared_tailwindElement_index.x`
2389
+ <div class=${this.styles().alignmentMenu()}>
2390
+ <lukso-tooltip text="Text alignment" placement="top">
2391
+ <lukso-button
2392
+ id=${this.alignmentTriggerId}
2393
+ @click=${(e) => {
2342
2394
  e.stopPropagation();
2343
2395
  this.restoreFocusAndSelection();
2344
2396
  this.isHeadingDropdownOpen = false;
@@ -2346,101 +2398,103 @@ ${indent}${nextNumber}. `;
2346
2398
  this.isListDropdownOpen = false;
2347
2399
  this.isAlignmentDropdownOpen = !this.isAlignmentDropdownOpen;
2348
2400
  }}
2349
- aria-expanded=${this.isAlignmentDropdownOpen ? "true" : "false"}
2350
- aria-label="Text alignment"
2351
- variant="secondary"
2352
- size="small"
2353
- custom-class=${this.toolbarButton({
2401
+ aria-expanded=${this.isAlignmentDropdownOpen ? "true" : "false"}
2402
+ aria-label="Text alignment"
2403
+ variant="secondary"
2404
+ size="small"
2405
+ custom-class=${this.toolbarButton({
2354
2406
  active: this.activeFormats.alignment !== "left"
2355
2407
  })}
2356
- is-icon
2357
- >
2358
- <lukso-icon
2359
- name=${this.getAlignmentIcon()}
2360
- size="small"
2361
- pack="vuesax"
2362
- variant="linear"
2363
- ></lukso-icon>
2364
- </lukso-button>
2365
- </lukso-tooltip>
2366
- <lukso-dropdown
2367
- id="alignmentDropdown"
2368
- trigger-id=""
2369
- size="medium"
2370
- ?is-open=${this.isAlignmentDropdownOpen}
2371
- >
2372
- <lukso-dropdown-option
2373
- ?is-selected=${this.activeFormats.alignment === "left"}
2374
- @click=${(e) => {
2408
+ is-icon
2409
+ >
2410
+ <lukso-icon
2411
+ name=${this.getAlignmentIcon()}
2412
+ size="small"
2413
+ pack="vuesax"
2414
+ variant="linear"
2415
+ ></lukso-icon>
2416
+ </lukso-button>
2417
+ </lukso-tooltip>
2418
+ <lukso-dropdown
2419
+ id="alignmentDropdown"
2420
+ trigger-id=""
2421
+ size="medium"
2422
+ ?is-open=${this.isAlignmentDropdownOpen}
2423
+ >
2424
+ <lukso-dropdown-option
2425
+ ?is-selected=${this.activeFormats.alignment === "left"}
2426
+ @click=${(e) => {
2375
2427
  e.stopPropagation();
2376
2428
  this.restoreFocusAndSelection();
2377
2429
  this.applyAlignment("left");
2378
2430
  this.isAlignmentDropdownOpen = false;
2379
2431
  }}
2380
- size="medium"
2381
- aria-label="Align left"
2382
- >
2383
- <div style="display: flex; align-items: center; gap: 8px;">
2384
- <lukso-icon
2385
- name="textalign-left"
2386
- size="small"
2387
- pack="vuesax"
2388
- variant="linear"
2389
- ></lukso-icon>
2390
- Left
2391
- </div>
2392
- </lukso-dropdown-option>
2393
- <lukso-dropdown-option
2394
- ?is-selected=${this.activeFormats.alignment === "center"}
2395
- @click=${(e) => {
2432
+ size="medium"
2433
+ aria-label="Align left"
2434
+ >
2435
+ <div style="display: flex; align-items: center; gap: 8px;">
2436
+ <lukso-icon
2437
+ name="textalign-left"
2438
+ size="small"
2439
+ pack="vuesax"
2440
+ variant="linear"
2441
+ ></lukso-icon>
2442
+ Left
2443
+ </div>
2444
+ </lukso-dropdown-option>
2445
+ <lukso-dropdown-option
2446
+ ?is-selected=${this.activeFormats.alignment === "center"}
2447
+ @click=${(e) => {
2396
2448
  e.stopPropagation();
2397
2449
  this.restoreFocusAndSelection();
2398
2450
  this.applyAlignment("center");
2399
2451
  this.isAlignmentDropdownOpen = false;
2400
2452
  }}
2401
- size="medium"
2402
- aria-label="Align center"
2403
- >
2404
- <div style="display: flex; align-items: center; gap: 8px;">
2405
- <lukso-icon
2406
- name="textalign-center"
2407
- size="small"
2408
- pack="vuesax"
2409
- variant="linear"
2410
- ></lukso-icon>
2411
- Center
2412
- </div>
2413
- </lukso-dropdown-option>
2414
- <lukso-dropdown-option
2415
- ?is-selected=${this.activeFormats.alignment === "right"}
2416
- @click=${(e) => {
2453
+ size="medium"
2454
+ aria-label="Align center"
2455
+ >
2456
+ <div style="display: flex; align-items: center; gap: 8px;">
2457
+ <lukso-icon
2458
+ name="textalign-center"
2459
+ size="small"
2460
+ pack="vuesax"
2461
+ variant="linear"
2462
+ ></lukso-icon>
2463
+ Center
2464
+ </div>
2465
+ </lukso-dropdown-option>
2466
+ <lukso-dropdown-option
2467
+ ?is-selected=${this.activeFormats.alignment === "right"}
2468
+ @click=${(e) => {
2417
2469
  e.stopPropagation();
2418
2470
  this.restoreFocusAndSelection();
2419
2471
  this.applyAlignment("right");
2420
2472
  this.isAlignmentDropdownOpen = false;
2421
2473
  }}
2422
- size="medium"
2423
- aria-label="Align right"
2424
- >
2425
- <div style="display: flex; align-items: center; gap: 8px;">
2426
- <lukso-icon
2427
- name="textalign-right"
2428
- size="small"
2429
- pack="vuesax"
2430
- variant="linear"
2431
- ></lukso-icon>
2432
- Right
2474
+ size="medium"
2475
+ aria-label="Align right"
2476
+ >
2477
+ <div style="display: flex; align-items: center; gap: 8px;">
2478
+ <lukso-icon
2479
+ name="textalign-right"
2480
+ size="small"
2481
+ pack="vuesax"
2482
+ variant="linear"
2483
+ ></lukso-icon>
2484
+ Right
2485
+ </div>
2486
+ </lukso-dropdown-option>
2487
+ </lukso-dropdown>
2433
2488
  </div>
2434
- </lukso-dropdown-option>
2435
- </lukso-dropdown>
2436
- </div>
2489
+ ` : shared_tailwindElement_index.E}
2437
2490
 
2438
2491
  <!-- Color -->
2439
- <div class=${this.styles().colorMenu()}>
2440
- <lukso-tooltip text="Text color" placement="top">
2441
- <lukso-button
2442
- id=${this.colorTriggerId}
2443
- @click=${(e) => {
2492
+ ${this.toolsState.includes("color") ? shared_tailwindElement_index.x`
2493
+ <div class=${this.styles().colorMenu()}>
2494
+ <lukso-tooltip text="Text color" placement="top">
2495
+ <lukso-button
2496
+ id=${this.colorTriggerId}
2497
+ @click=${(e) => {
2444
2498
  e.stopPropagation();
2445
2499
  this.restoreFocusAndSelection();
2446
2500
  this.isHeadingDropdownOpen = false;
@@ -2457,66 +2511,70 @@ ${indent}${nextNumber}. `;
2457
2511
  }
2458
2512
  this.isColorDropdownOpen = !this.isColorDropdownOpen;
2459
2513
  }}
2460
- aria-expanded=${this.isColorDropdownOpen ? "true" : "false"}
2461
- aria-pressed=${this.activeFormats.color ? "true" : "false"}
2462
- aria-label="Text color"
2463
- variant="secondary"
2464
- size="small"
2465
- custom-class=${this.toolbarButton({
2514
+ aria-expanded=${this.isColorDropdownOpen ? "true" : "false"}
2515
+ aria-pressed=${this.activeFormats.color ? "true" : "false"}
2516
+ aria-label="Text color"
2517
+ variant="secondary"
2518
+ size="small"
2519
+ custom-class=${this.toolbarButton({
2466
2520
  active: this.activeFormats.color
2467
2521
  })}
2468
- is-icon
2469
- >
2470
- <div
2471
- class="size-4 rounded-full"
2472
- style="background-color: ${this.activeFormats.activeColor};"
2473
- ></div>
2474
- </lukso-button>
2475
- </lukso-tooltip>
2476
- <lukso-dropdown
2477
- id="colorDropdown"
2478
- trigger-id=""
2479
- size="medium"
2480
- max-height="300"
2481
- ?is-open=${this.isColorDropdownOpen}
2482
- >
2483
- <div class="grid grid-cols-8 gap-2 p-2 w-[260px]">
2484
- <div class="col-span-8 mb-2 flex items-center justify-between">
2485
- <span class="text-xs text-neutral-60">Text Color</span>
2486
- ${this.activeFormats.color ? shared_tailwindElement_index.x`<button
2487
- class="text-xs text-neutral-60 hover:text-neutral-20 underline"
2488
- @click=${(e) => {
2522
+ is-icon
2523
+ >
2524
+ <div
2525
+ class="size-4 rounded-full"
2526
+ style="background-color: ${this.activeFormats.activeColor};"
2527
+ ></div>
2528
+ </lukso-button>
2529
+ </lukso-tooltip>
2530
+ <lukso-dropdown
2531
+ id="colorDropdown"
2532
+ trigger-id=""
2533
+ size="medium"
2534
+ max-height="300"
2535
+ ?is-open=${this.isColorDropdownOpen}
2536
+ >
2537
+ <div class="grid grid-cols-8 gap-2 p-2 w-[260px]">
2538
+ <div
2539
+ class="col-span-8 mb-2 flex items-center justify-between"
2540
+ >
2541
+ <span class="text-xs text-neutral-60">Text Color</span>
2542
+ ${this.activeFormats.color ? shared_tailwindElement_index.x`<button
2543
+ class="text-xs text-neutral-60 hover:text-neutral-20 underline"
2544
+ @click=${(e) => {
2489
2545
  e.stopPropagation();
2490
2546
  this.clearColor();
2491
2547
  this.isColorDropdownOpen = false;
2492
2548
  }}
2493
- type="button"
2494
- aria-label="Clear color"
2495
- >
2496
- Clear
2497
- </button>` : shared_tailwindElement_index.E}
2498
- </div>
2499
- ${this.colorSamples.map(
2549
+ type="button"
2550
+ aria-label="Clear color"
2551
+ >
2552
+ Clear
2553
+ </button>` : shared_tailwindElement_index.E}
2554
+ </div>
2555
+ ${this.colorSamples.map(
2500
2556
  (color) => shared_tailwindElement_index.x`
2501
- <button
2502
- class="w-6 h-6 rounded-4 border transition-all ${this.activeFormats.activeColor === color ? "border-neutral-20 ring-2 ring-purple-51" : "border-neutral-90 hover:border-neutral-60"}"
2503
- style="background-color: ${color}"
2504
- title=${color}
2505
- aria-pressed=${this.activeFormats.activeColor === color ? "true" : "false"}
2506
- aria-label="Color ${color}"
2507
- @click=${(e) => {
2557
+ <button
2558
+ class="w-6 h-6 rounded-4 border transition-all ${this.activeFormats.activeColor === color ? "border-neutral-20 ring-2 ring-purple-51" : "border-neutral-90 hover:border-neutral-60"}"
2559
+ style="background-color: ${color}"
2560
+ title=${color}
2561
+ aria-pressed=${this.activeFormats.activeColor === color ? "true" : "false"}
2562
+ aria-label="Color ${color}"
2563
+ @click=${(e) => {
2508
2564
  e.stopPropagation();
2509
2565
  this.selectColor(color);
2510
2566
  this.isColorDropdownOpen = false;
2511
2567
  }}
2512
- ></button>
2513
- `
2568
+ ></button>
2569
+ `
2514
2570
  )}
2515
- </div>
2516
- </lukso-dropdown>
2517
- </div>
2571
+ </div>
2572
+ </lukso-dropdown>
2573
+ </div>
2574
+ ` : shared_tailwindElement_index.E}
2518
2575
 
2519
- <div class=${this.styles().divider()}></div>
2576
+ <!-- Divider -->
2577
+ ${this.toolsState.length > 0 ? shared_tailwindElement_index.x`<div class=${this.styles().divider()}></div>` : shared_tailwindElement_index.E}
2520
2578
  </div>
2521
2579
  `;
2522
2580
  }
@@ -2561,6 +2619,17 @@ ${indent}${nextNumber}. `;
2561
2619
  if (!this.previewTextColor) {
2562
2620
  this.previewTextColor = DEFAULT_PREVIEW_TEXT_COLOR;
2563
2621
  }
2622
+ this.toolsState = this.defaultTools;
2623
+ try {
2624
+ if (this.tools) {
2625
+ this.toolsState = JSON.parse(this.tools);
2626
+ }
2627
+ } catch (error) {
2628
+ console.warn(
2629
+ "Invalid JSON for tools property in lukso-markdown-editor. Using default tools.",
2630
+ error
2631
+ );
2632
+ }
2564
2633
  return shared_tailwindElement_index.x`
2565
2634
  <div class=${wrapper()}>
2566
2635
  ${this.labelTemplate()} ${this.descriptionTemplate()}
@@ -2600,6 +2669,7 @@ ${indent}${nextNumber}. `;
2600
2669
  >
2601
2670
  <lukso-markdown
2602
2671
  value=${this.value}
2672
+ ?strip-html-tags=${this.stripHtmlTags}
2603
2673
  custom-style=${`color: ${this.previewTextColor};`}
2604
2674
  ></lukso-markdown>
2605
2675
  ${this.accessibilityIndicatorTemplate()}
@@ -2662,6 +2732,15 @@ __decorateClass([
2662
2732
  __decorateClass([
2663
2733
  property.n({ type: String, attribute: "preview-text-color", reflect: true })
2664
2734
  ], exports.LuksoMarkdownEditor.prototype, "previewTextColor", 2);
2735
+ __decorateClass([
2736
+ property.n({ type: Boolean, attribute: "strip-html-tags" })
2737
+ ], exports.LuksoMarkdownEditor.prototype, "stripHtmlTags", 2);
2738
+ __decorateClass([
2739
+ property.n({ type: String })
2740
+ ], exports.LuksoMarkdownEditor.prototype, "tools", 2);
2741
+ __decorateClass([
2742
+ state.r()
2743
+ ], exports.LuksoMarkdownEditor.prototype, "toolsState", 2);
2665
2744
  __decorateClass([
2666
2745
  state.r()
2667
2746
  ], exports.LuksoMarkdownEditor.prototype, "savedSelectionForPreview", 2);