@lukso/web-components 1.161.1 → 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 +294 -252
  33. package/dist/components/lukso-markdown-editor/index.d.ts +4 -1
  34. package/dist/components/lukso-markdown-editor/index.d.ts.map +1 -1
  35. package/dist/components/lukso-markdown-editor/index.js +294 -252
  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
@@ -1,6 +1,6 @@
1
- import { T as TailwindStyledElement, E, x } from '../../index-B5CXCi6j.js';
2
- import { n, t } from '../../property-Da9lvmME.js';
3
- import { r } from '../../state-CtpsBPdH.js';
1
+ import { T as TailwindStyledElement, E, x } from '../../index-CQq_Eyeu.js';
2
+ import { n, t } from '../../property-CPkYmAYi.js';
3
+ import { r } from '../../state-CtrTo6cC.js';
4
4
  import { e } from '../../query-CHb9Ft_d.js';
5
5
  import { c as ce } from '../../index-B9iart53.js';
6
6
  import '../../tailwind-config.js';
@@ -10,7 +10,7 @@ import '../lukso-markdown/index.js';
10
10
  import '../lukso-switch/index.js';
11
11
  import '../lukso-button/index.js';
12
12
  import '../lukso-icon/index.js';
13
- import '../lukso-sanitize/index.js';
13
+ import '../../index-JvkSiEeQ.js';
14
14
  import '../lukso-dropdown/index.js';
15
15
  import '../lukso-dropdown-option/index.js';
16
16
  import '../lukso-tooltip/index.js';
@@ -201,6 +201,7 @@ var __decorateClass = (decorators, target, key, kind) => {
201
201
  };
202
202
  const DEFAULT_PREVIEW_BACKGROUND_COLOR = "#f9f9f9";
203
203
  const DEFAULT_PREVIEW_TEXT_COLOR = "#374151";
204
+ const ACCESSIBILITY_CHECK_DELAY = 1e3;
204
205
  let LuksoMarkdownEditor = class extends TailwindStyledElement(style) {
205
206
  constructor() {
206
207
  super(...arguments);
@@ -220,6 +221,18 @@ let LuksoMarkdownEditor = class extends TailwindStyledElement(style) {
220
221
  this.placeholder = "";
221
222
  this.previewBackgroundColor = DEFAULT_PREVIEW_BACKGROUND_COLOR;
222
223
  this.previewTextColor = DEFAULT_PREVIEW_TEXT_COLOR;
224
+ this.stripHtmlTags = false;
225
+ this.tools = void 0;
226
+ this.toolsState = [];
227
+ this.defaultTools = [
228
+ "heading",
229
+ "bold",
230
+ "italic",
231
+ "list",
232
+ "link",
233
+ "alignment",
234
+ "color"
235
+ ];
223
236
  this.savedSelectionForPreview = null;
224
237
  this.isHeadingDropdownOpen = false;
225
238
  this.isColorDropdownOpen = false;
@@ -256,7 +269,6 @@ let LuksoMarkdownEditor = class extends TailwindStyledElement(style) {
256
269
  this.accessibilityViolations = [];
257
270
  this.hasAccessibilityViolations = false;
258
271
  this.accessibilityCheckTimeout = null;
259
- this.ACCESSIBILITY_CHECK_DELAY = 1e3;
260
272
  this.handleOutsideClick = (event) => {
261
273
  const target = event.target;
262
274
  const isInsideThisComponent = this.contains(target) || this.shadowRoot?.contains(target);
@@ -528,7 +540,7 @@ let LuksoMarkdownEditor = class extends TailwindStyledElement(style) {
528
540
  this.accessibilityCheckTimeout = window.setTimeout(() => {
529
541
  this.performAccessibilityCheck();
530
542
  this.accessibilityCheckTimeout = null;
531
- }, this.ACCESSIBILITY_CHECK_DELAY);
543
+ }, ACCESSIBILITY_CHECK_DELAY);
532
544
  }
533
545
  /**
534
546
  * Clean up empty color spans from the value.
@@ -2169,126 +2181,127 @@ ${indent}${nextNumber}. `;
2169
2181
  toolbarTemplate() {
2170
2182
  return x`
2171
2183
  <div class="flex items-center gap-1">
2172
- <div class=${cn(this.styles().headingMenu())}>
2173
- <!-- Heading -->
2174
- <lukso-tooltip text="Heading options" placement="top">
2175
- <lukso-button
2176
- id=${this.headingTriggerId}
2177
- @click=${(e) => {
2184
+ <!-- Heading -->
2185
+ ${this.toolsState.includes("heading") ? x`<div class=${cn(this.styles().headingMenu())}>
2186
+ <lukso-tooltip text="Heading options" placement="top">
2187
+ <lukso-button
2188
+ id=${this.headingTriggerId}
2189
+ @click=${(e) => {
2178
2190
  e.stopPropagation();
2179
2191
  this.isColorDropdownOpen = false;
2180
2192
  this.isListDropdownOpen = false;
2181
2193
  this.isAlignmentDropdownOpen = false;
2182
2194
  this.isHeadingDropdownOpen = !this.isHeadingDropdownOpen;
2183
2195
  }}
2184
- aria-expanded=${this.isHeadingDropdownOpen ? "true" : "false"}
2185
- aria-label="Heading options"
2186
- variant="secondary"
2187
- size="small"
2188
- custom-class=${this.toolbarButton({
2196
+ aria-expanded=${this.isHeadingDropdownOpen ? "true" : "false"}
2197
+ aria-label="Heading options"
2198
+ variant="secondary"
2199
+ size="small"
2200
+ custom-class=${this.toolbarButton({
2189
2201
  active: this.getActiveHeadingLevel() > 0
2190
2202
  })}
2191
- is-icon
2192
- >
2193
- <lukso-icon
2194
- name="smallcaps"
2195
- size="small"
2196
- pack="vuesax"
2197
- variant="linear"
2198
- ></lukso-icon>
2199
- </lukso-button>
2200
- </lukso-tooltip>
2201
- <lukso-dropdown
2202
- id="headingDropdown"
2203
- trigger-id=""
2204
- size="medium"
2205
- ?is-open=${this.isHeadingDropdownOpen}
2206
- >
2207
- <lukso-dropdown-option
2208
- ?is-selected=${this.getActiveHeadingLevel() === 0}
2209
- @click=${(e) => {
2203
+ is-icon
2204
+ >
2205
+ <lukso-icon
2206
+ name="smallcaps"
2207
+ size="small"
2208
+ pack="vuesax"
2209
+ variant="linear"
2210
+ ></lukso-icon>
2211
+ </lukso-button>
2212
+ </lukso-tooltip>
2213
+ <lukso-dropdown
2214
+ id="headingDropdown"
2215
+ trigger-id=""
2216
+ size="medium"
2217
+ ?is-open=${this.isHeadingDropdownOpen}
2218
+ >
2219
+ <lukso-dropdown-option
2220
+ ?is-selected=${this.getActiveHeadingLevel() === 0}
2221
+ @click=${(e) => {
2210
2222
  e.stopPropagation();
2211
2223
  this.restoreFocusAndSelection();
2212
2224
  this.applyHeading(0);
2213
2225
  this.isHeadingDropdownOpen = false;
2214
2226
  }}
2215
- size="medium"
2216
- >
2217
- Normal text
2218
- </lukso-dropdown-option>
2219
- <lukso-dropdown-option
2220
- ?is-selected=${this.getActiveHeadingLevel() === 1}
2221
- @click=${(e) => {
2227
+ size="medium"
2228
+ >
2229
+ Normal text
2230
+ </lukso-dropdown-option>
2231
+ <lukso-dropdown-option
2232
+ ?is-selected=${this.getActiveHeadingLevel() === 1}
2233
+ @click=${(e) => {
2222
2234
  e.stopPropagation();
2223
2235
  this.restoreFocusAndSelection();
2224
2236
  this.applyHeading(1);
2225
2237
  this.isHeadingDropdownOpen = false;
2226
2238
  }}
2227
- size="medium"
2228
- >
2229
- Heading 1
2230
- </lukso-dropdown-option>
2231
- <lukso-dropdown-option
2232
- ?is-selected=${this.getActiveHeadingLevel() === 2}
2233
- @click=${(e) => {
2239
+ size="medium"
2240
+ >
2241
+ Heading 1
2242
+ </lukso-dropdown-option>
2243
+ <lukso-dropdown-option
2244
+ ?is-selected=${this.getActiveHeadingLevel() === 2}
2245
+ @click=${(e) => {
2234
2246
  e.stopPropagation();
2235
2247
  this.restoreFocusAndSelection();
2236
2248
  this.applyHeading(2);
2237
2249
  this.isHeadingDropdownOpen = false;
2238
2250
  }}
2239
- size="medium"
2240
- >
2241
- Heading 2
2242
- </lukso-dropdown-option>
2243
- <lukso-dropdown-option
2244
- ?is-selected=${this.getActiveHeadingLevel() === 3}
2245
- @click=${(e) => {
2251
+ size="medium"
2252
+ >
2253
+ Heading 2
2254
+ </lukso-dropdown-option>
2255
+ <lukso-dropdown-option
2256
+ ?is-selected=${this.getActiveHeadingLevel() === 3}
2257
+ @click=${(e) => {
2246
2258
  e.stopPropagation();
2247
2259
  this.restoreFocusAndSelection();
2248
2260
  this.applyHeading(3);
2249
2261
  this.isHeadingDropdownOpen = false;
2250
2262
  }}
2251
- size="medium"
2252
- >
2253
- Heading 3
2254
- </lukso-dropdown-option>
2255
- <lukso-dropdown-option
2256
- ?is-selected=${this.getActiveHeadingLevel() === 4}
2257
- @click=${(e) => {
2263
+ size="medium"
2264
+ >
2265
+ Heading 3
2266
+ </lukso-dropdown-option>
2267
+ <lukso-dropdown-option
2268
+ ?is-selected=${this.getActiveHeadingLevel() === 4}
2269
+ @click=${(e) => {
2258
2270
  e.stopPropagation();
2259
2271
  this.restoreFocusAndSelection();
2260
2272
  this.applyHeading(4);
2261
2273
  this.isHeadingDropdownOpen = false;
2262
2274
  }}
2263
- size="medium"
2264
- >
2265
- Heading 4
2266
- </lukso-dropdown-option>
2267
- </lukso-dropdown>
2268
- </div>
2275
+ size="medium"
2276
+ >
2277
+ Heading 4
2278
+ </lukso-dropdown-option>
2279
+ </lukso-dropdown>
2280
+ </div>` : E}
2269
2281
 
2270
2282
  <!-- Bold -->
2271
- ${this.buttonTemplate(
2283
+ ${this.toolsState.includes("bold") ? this.buttonTemplate(
2272
2284
  "text-bold",
2273
2285
  () => this.toggleWrap("**"),
2274
2286
  "Bold",
2275
2287
  this.activeFormats.bold
2276
- )}
2288
+ ) : E}
2277
2289
 
2278
2290
  <!-- Italic -->
2279
- ${this.buttonTemplate(
2291
+ ${this.toolsState.includes("italic") ? this.buttonTemplate(
2280
2292
  "text-italic",
2281
2293
  () => this.toggleWrap("*"),
2282
2294
  "Italic",
2283
2295
  this.activeFormats.italic
2284
- )}
2296
+ ) : E}
2285
2297
 
2286
2298
  <!-- List -->
2287
- <div class=${this.styles().listMenu()}>
2288
- <lukso-tooltip text="List options" placement="top">
2289
- <lukso-button
2290
- id=${this.listTriggerId}
2291
- @click=${(e) => {
2299
+ ${this.toolsState.includes("list") ? x`
2300
+ <div class=${this.styles().listMenu()}>
2301
+ <lukso-tooltip text="List options" placement="top">
2302
+ <lukso-button
2303
+ id=${this.listTriggerId}
2304
+ @click=${(e) => {
2292
2305
  e.stopPropagation();
2293
2306
  this.restoreFocusAndSelection();
2294
2307
  this.isHeadingDropdownOpen = false;
@@ -2296,82 +2309,84 @@ ${indent}${nextNumber}. `;
2296
2309
  this.isAlignmentDropdownOpen = false;
2297
2310
  this.isListDropdownOpen = !this.isListDropdownOpen;
2298
2311
  }}
2299
- aria-expanded=${this.isListDropdownOpen ? "true" : "false"}
2300
- aria-label="List options"
2301
- variant="secondary"
2302
- size="small"
2303
- custom-class=${this.toolbarButton({
2312
+ aria-expanded=${this.isListDropdownOpen ? "true" : "false"}
2313
+ aria-label="List options"
2314
+ variant="secondary"
2315
+ size="small"
2316
+ custom-class=${this.toolbarButton({
2304
2317
  active: this.activeFormats.unorderedList || this.activeFormats.orderedList
2305
2318
  })}
2306
- is-icon
2307
- >
2308
- <lukso-icon
2309
- name="task"
2310
- size="small"
2311
- pack="vuesax"
2312
- variant="linear"
2313
- ></lukso-icon>
2314
- </lukso-button>
2315
- </lukso-tooltip>
2316
- <lukso-dropdown
2317
- id="listDropdown"
2318
- trigger-id=""
2319
- size="medium"
2320
- ?is-open=${this.isListDropdownOpen}
2321
- >
2322
- <lukso-dropdown-option
2323
- ?is-selected=${this.getActiveListType() === "none"}
2324
- @click=${(e) => {
2319
+ is-icon
2320
+ >
2321
+ <lukso-icon
2322
+ name="task"
2323
+ size="small"
2324
+ pack="vuesax"
2325
+ variant="linear"
2326
+ ></lukso-icon>
2327
+ </lukso-button>
2328
+ </lukso-tooltip>
2329
+ <lukso-dropdown
2330
+ id="listDropdown"
2331
+ trigger-id=""
2332
+ size="medium"
2333
+ ?is-open=${this.isListDropdownOpen}
2334
+ >
2335
+ <lukso-dropdown-option
2336
+ ?is-selected=${this.getActiveListType() === "none"}
2337
+ @click=${(e) => {
2325
2338
  e.stopPropagation();
2326
2339
  this.restoreFocusAndSelection();
2327
2340
  this.applyList("none");
2328
2341
  this.isListDropdownOpen = false;
2329
2342
  }}
2330
- size="medium"
2331
- >
2332
- No list
2333
- </lukso-dropdown-option>
2334
- <lukso-dropdown-option
2335
- ?is-selected=${this.getActiveListType() === "unordered"}
2336
- @click=${(e) => {
2343
+ size="medium"
2344
+ >
2345
+ No list
2346
+ </lukso-dropdown-option>
2347
+ <lukso-dropdown-option
2348
+ ?is-selected=${this.getActiveListType() === "unordered"}
2349
+ @click=${(e) => {
2337
2350
  e.stopPropagation();
2338
2351
  this.restoreFocusAndSelection();
2339
2352
  this.applyList("unordered");
2340
2353
  this.isListDropdownOpen = false;
2341
2354
  }}
2342
- size="medium"
2343
- >
2344
- Unordered
2345
- </lukso-dropdown-option>
2346
- <lukso-dropdown-option
2347
- ?is-selected=${this.getActiveListType() === "ordered"}
2348
- @click=${(e) => {
2355
+ size="medium"
2356
+ >
2357
+ Unordered
2358
+ </lukso-dropdown-option>
2359
+ <lukso-dropdown-option
2360
+ ?is-selected=${this.getActiveListType() === "ordered"}
2361
+ @click=${(e) => {
2349
2362
  e.stopPropagation();
2350
2363
  this.restoreFocusAndSelection();
2351
2364
  this.applyList("ordered");
2352
2365
  this.isListDropdownOpen = false;
2353
2366
  }}
2354
- size="medium"
2355
- >
2356
- Ordered
2357
- </lukso-dropdown-option>
2358
- </lukso-dropdown>
2359
- </div>
2367
+ size="medium"
2368
+ >
2369
+ Ordered
2370
+ </lukso-dropdown-option>
2371
+ </lukso-dropdown>
2372
+ </div>
2373
+ ` : E}
2360
2374
 
2361
2375
  <!-- Link -->
2362
- ${this.buttonTemplate(
2376
+ ${this.toolsState.includes("link") ? this.buttonTemplate(
2363
2377
  "link",
2364
2378
  () => this.insertLink(),
2365
2379
  "Link",
2366
2380
  this.activeFormats.link
2367
- )}
2381
+ ) : E}
2368
2382
 
2369
2383
  <!-- Text Alignment -->
2370
- <div class=${this.styles().alignmentMenu()}>
2371
- <lukso-tooltip text="Text alignment" placement="top">
2372
- <lukso-button
2373
- id=${this.alignmentTriggerId}
2374
- @click=${(e) => {
2384
+ ${this.toolsState.includes("alignment") ? x`
2385
+ <div class=${this.styles().alignmentMenu()}>
2386
+ <lukso-tooltip text="Text alignment" placement="top">
2387
+ <lukso-button
2388
+ id=${this.alignmentTriggerId}
2389
+ @click=${(e) => {
2375
2390
  e.stopPropagation();
2376
2391
  this.restoreFocusAndSelection();
2377
2392
  this.isHeadingDropdownOpen = false;
@@ -2379,101 +2394,103 @@ ${indent}${nextNumber}. `;
2379
2394
  this.isListDropdownOpen = false;
2380
2395
  this.isAlignmentDropdownOpen = !this.isAlignmentDropdownOpen;
2381
2396
  }}
2382
- aria-expanded=${this.isAlignmentDropdownOpen ? "true" : "false"}
2383
- aria-label="Text alignment"
2384
- variant="secondary"
2385
- size="small"
2386
- custom-class=${this.toolbarButton({
2397
+ aria-expanded=${this.isAlignmentDropdownOpen ? "true" : "false"}
2398
+ aria-label="Text alignment"
2399
+ variant="secondary"
2400
+ size="small"
2401
+ custom-class=${this.toolbarButton({
2387
2402
  active: this.activeFormats.alignment !== "left"
2388
2403
  })}
2389
- is-icon
2390
- >
2391
- <lukso-icon
2392
- name=${this.getAlignmentIcon()}
2393
- size="small"
2394
- pack="vuesax"
2395
- variant="linear"
2396
- ></lukso-icon>
2397
- </lukso-button>
2398
- </lukso-tooltip>
2399
- <lukso-dropdown
2400
- id="alignmentDropdown"
2401
- trigger-id=""
2402
- size="medium"
2403
- ?is-open=${this.isAlignmentDropdownOpen}
2404
- >
2405
- <lukso-dropdown-option
2406
- ?is-selected=${this.activeFormats.alignment === "left"}
2407
- @click=${(e) => {
2404
+ is-icon
2405
+ >
2406
+ <lukso-icon
2407
+ name=${this.getAlignmentIcon()}
2408
+ size="small"
2409
+ pack="vuesax"
2410
+ variant="linear"
2411
+ ></lukso-icon>
2412
+ </lukso-button>
2413
+ </lukso-tooltip>
2414
+ <lukso-dropdown
2415
+ id="alignmentDropdown"
2416
+ trigger-id=""
2417
+ size="medium"
2418
+ ?is-open=${this.isAlignmentDropdownOpen}
2419
+ >
2420
+ <lukso-dropdown-option
2421
+ ?is-selected=${this.activeFormats.alignment === "left"}
2422
+ @click=${(e) => {
2408
2423
  e.stopPropagation();
2409
2424
  this.restoreFocusAndSelection();
2410
2425
  this.applyAlignment("left");
2411
2426
  this.isAlignmentDropdownOpen = false;
2412
2427
  }}
2413
- size="medium"
2414
- aria-label="Align left"
2415
- >
2416
- <div style="display: flex; align-items: center; gap: 8px;">
2417
- <lukso-icon
2418
- name="textalign-left"
2419
- size="small"
2420
- pack="vuesax"
2421
- variant="linear"
2422
- ></lukso-icon>
2423
- Left
2424
- </div>
2425
- </lukso-dropdown-option>
2426
- <lukso-dropdown-option
2427
- ?is-selected=${this.activeFormats.alignment === "center"}
2428
- @click=${(e) => {
2428
+ size="medium"
2429
+ aria-label="Align left"
2430
+ >
2431
+ <div style="display: flex; align-items: center; gap: 8px;">
2432
+ <lukso-icon
2433
+ name="textalign-left"
2434
+ size="small"
2435
+ pack="vuesax"
2436
+ variant="linear"
2437
+ ></lukso-icon>
2438
+ Left
2439
+ </div>
2440
+ </lukso-dropdown-option>
2441
+ <lukso-dropdown-option
2442
+ ?is-selected=${this.activeFormats.alignment === "center"}
2443
+ @click=${(e) => {
2429
2444
  e.stopPropagation();
2430
2445
  this.restoreFocusAndSelection();
2431
2446
  this.applyAlignment("center");
2432
2447
  this.isAlignmentDropdownOpen = false;
2433
2448
  }}
2434
- size="medium"
2435
- aria-label="Align center"
2436
- >
2437
- <div style="display: flex; align-items: center; gap: 8px;">
2438
- <lukso-icon
2439
- name="textalign-center"
2440
- size="small"
2441
- pack="vuesax"
2442
- variant="linear"
2443
- ></lukso-icon>
2444
- Center
2445
- </div>
2446
- </lukso-dropdown-option>
2447
- <lukso-dropdown-option
2448
- ?is-selected=${this.activeFormats.alignment === "right"}
2449
- @click=${(e) => {
2449
+ size="medium"
2450
+ aria-label="Align center"
2451
+ >
2452
+ <div style="display: flex; align-items: center; gap: 8px;">
2453
+ <lukso-icon
2454
+ name="textalign-center"
2455
+ size="small"
2456
+ pack="vuesax"
2457
+ variant="linear"
2458
+ ></lukso-icon>
2459
+ Center
2460
+ </div>
2461
+ </lukso-dropdown-option>
2462
+ <lukso-dropdown-option
2463
+ ?is-selected=${this.activeFormats.alignment === "right"}
2464
+ @click=${(e) => {
2450
2465
  e.stopPropagation();
2451
2466
  this.restoreFocusAndSelection();
2452
2467
  this.applyAlignment("right");
2453
2468
  this.isAlignmentDropdownOpen = false;
2454
2469
  }}
2455
- size="medium"
2456
- aria-label="Align right"
2457
- >
2458
- <div style="display: flex; align-items: center; gap: 8px;">
2459
- <lukso-icon
2460
- name="textalign-right"
2461
- size="small"
2462
- pack="vuesax"
2463
- variant="linear"
2464
- ></lukso-icon>
2465
- Right
2470
+ size="medium"
2471
+ aria-label="Align right"
2472
+ >
2473
+ <div style="display: flex; align-items: center; gap: 8px;">
2474
+ <lukso-icon
2475
+ name="textalign-right"
2476
+ size="small"
2477
+ pack="vuesax"
2478
+ variant="linear"
2479
+ ></lukso-icon>
2480
+ Right
2481
+ </div>
2482
+ </lukso-dropdown-option>
2483
+ </lukso-dropdown>
2466
2484
  </div>
2467
- </lukso-dropdown-option>
2468
- </lukso-dropdown>
2469
- </div>
2485
+ ` : E}
2470
2486
 
2471
2487
  <!-- Color -->
2472
- <div class=${this.styles().colorMenu()}>
2473
- <lukso-tooltip text="Text color" placement="top">
2474
- <lukso-button
2475
- id=${this.colorTriggerId}
2476
- @click=${(e) => {
2488
+ ${this.toolsState.includes("color") ? x`
2489
+ <div class=${this.styles().colorMenu()}>
2490
+ <lukso-tooltip text="Text color" placement="top">
2491
+ <lukso-button
2492
+ id=${this.colorTriggerId}
2493
+ @click=${(e) => {
2477
2494
  e.stopPropagation();
2478
2495
  this.restoreFocusAndSelection();
2479
2496
  this.isHeadingDropdownOpen = false;
@@ -2490,66 +2507,70 @@ ${indent}${nextNumber}. `;
2490
2507
  }
2491
2508
  this.isColorDropdownOpen = !this.isColorDropdownOpen;
2492
2509
  }}
2493
- aria-expanded=${this.isColorDropdownOpen ? "true" : "false"}
2494
- aria-pressed=${this.activeFormats.color ? "true" : "false"}
2495
- aria-label="Text color"
2496
- variant="secondary"
2497
- size="small"
2498
- custom-class=${this.toolbarButton({
2510
+ aria-expanded=${this.isColorDropdownOpen ? "true" : "false"}
2511
+ aria-pressed=${this.activeFormats.color ? "true" : "false"}
2512
+ aria-label="Text color"
2513
+ variant="secondary"
2514
+ size="small"
2515
+ custom-class=${this.toolbarButton({
2499
2516
  active: this.activeFormats.color
2500
2517
  })}
2501
- is-icon
2502
- >
2503
- <div
2504
- class="size-4 rounded-full"
2505
- style="background-color: ${this.activeFormats.activeColor};"
2506
- ></div>
2507
- </lukso-button>
2508
- </lukso-tooltip>
2509
- <lukso-dropdown
2510
- id="colorDropdown"
2511
- trigger-id=""
2512
- size="medium"
2513
- max-height="300"
2514
- ?is-open=${this.isColorDropdownOpen}
2515
- >
2516
- <div class="grid grid-cols-8 gap-2 p-2 w-[260px]">
2517
- <div class="col-span-8 mb-2 flex items-center justify-between">
2518
- <span class="text-xs text-neutral-60">Text Color</span>
2519
- ${this.activeFormats.color ? x`<button
2520
- class="text-xs text-neutral-60 hover:text-neutral-20 underline"
2521
- @click=${(e) => {
2518
+ is-icon
2519
+ >
2520
+ <div
2521
+ class="size-4 rounded-full"
2522
+ style="background-color: ${this.activeFormats.activeColor};"
2523
+ ></div>
2524
+ </lukso-button>
2525
+ </lukso-tooltip>
2526
+ <lukso-dropdown
2527
+ id="colorDropdown"
2528
+ trigger-id=""
2529
+ size="medium"
2530
+ max-height="300"
2531
+ ?is-open=${this.isColorDropdownOpen}
2532
+ >
2533
+ <div class="grid grid-cols-8 gap-2 p-2 w-[260px]">
2534
+ <div
2535
+ class="col-span-8 mb-2 flex items-center justify-between"
2536
+ >
2537
+ <span class="text-xs text-neutral-60">Text Color</span>
2538
+ ${this.activeFormats.color ? x`<button
2539
+ class="text-xs text-neutral-60 hover:text-neutral-20 underline"
2540
+ @click=${(e) => {
2522
2541
  e.stopPropagation();
2523
2542
  this.clearColor();
2524
2543
  this.isColorDropdownOpen = false;
2525
2544
  }}
2526
- type="button"
2527
- aria-label="Clear color"
2528
- >
2529
- Clear
2530
- </button>` : E}
2531
- </div>
2532
- ${this.colorSamples.map(
2545
+ type="button"
2546
+ aria-label="Clear color"
2547
+ >
2548
+ Clear
2549
+ </button>` : E}
2550
+ </div>
2551
+ ${this.colorSamples.map(
2533
2552
  (color) => x`
2534
- <button
2535
- 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"}"
2536
- style="background-color: ${color}"
2537
- title=${color}
2538
- aria-pressed=${this.activeFormats.activeColor === color ? "true" : "false"}
2539
- aria-label="Color ${color}"
2540
- @click=${(e) => {
2553
+ <button
2554
+ 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"}"
2555
+ style="background-color: ${color}"
2556
+ title=${color}
2557
+ aria-pressed=${this.activeFormats.activeColor === color ? "true" : "false"}
2558
+ aria-label="Color ${color}"
2559
+ @click=${(e) => {
2541
2560
  e.stopPropagation();
2542
2561
  this.selectColor(color);
2543
2562
  this.isColorDropdownOpen = false;
2544
2563
  }}
2545
- ></button>
2546
- `
2564
+ ></button>
2565
+ `
2547
2566
  )}
2548
- </div>
2549
- </lukso-dropdown>
2550
- </div>
2567
+ </div>
2568
+ </lukso-dropdown>
2569
+ </div>
2570
+ ` : E}
2551
2571
 
2552
- <div class=${this.styles().divider()}></div>
2572
+ <!-- Divider -->
2573
+ ${this.toolsState.length > 0 ? x`<div class=${this.styles().divider()}></div>` : E}
2553
2574
  </div>
2554
2575
  `;
2555
2576
  }
@@ -2594,6 +2615,17 @@ ${indent}${nextNumber}. `;
2594
2615
  if (!this.previewTextColor) {
2595
2616
  this.previewTextColor = DEFAULT_PREVIEW_TEXT_COLOR;
2596
2617
  }
2618
+ this.toolsState = this.defaultTools;
2619
+ try {
2620
+ if (this.tools) {
2621
+ this.toolsState = JSON.parse(this.tools);
2622
+ }
2623
+ } catch (error) {
2624
+ console.warn(
2625
+ "Invalid JSON for tools property in lukso-markdown-editor. Using default tools.",
2626
+ error
2627
+ );
2628
+ }
2597
2629
  return x`
2598
2630
  <div class=${wrapper()}>
2599
2631
  ${this.labelTemplate()} ${this.descriptionTemplate()}
@@ -2633,6 +2665,7 @@ ${indent}${nextNumber}. `;
2633
2665
  >
2634
2666
  <lukso-markdown
2635
2667
  value=${this.value}
2668
+ ?strip-html-tags=${this.stripHtmlTags}
2636
2669
  custom-style=${`color: ${this.previewTextColor};`}
2637
2670
  ></lukso-markdown>
2638
2671
  ${this.accessibilityIndicatorTemplate()}
@@ -2695,6 +2728,15 @@ __decorateClass([
2695
2728
  __decorateClass([
2696
2729
  n({ type: String, attribute: "preview-text-color", reflect: true })
2697
2730
  ], LuksoMarkdownEditor.prototype, "previewTextColor", 2);
2731
+ __decorateClass([
2732
+ n({ type: Boolean, attribute: "strip-html-tags" })
2733
+ ], LuksoMarkdownEditor.prototype, "stripHtmlTags", 2);
2734
+ __decorateClass([
2735
+ n({ type: String })
2736
+ ], LuksoMarkdownEditor.prototype, "tools", 2);
2737
+ __decorateClass([
2738
+ r()
2739
+ ], LuksoMarkdownEditor.prototype, "toolsState", 2);
2698
2740
  __decorateClass([
2699
2741
  r()
2700
2742
  ], LuksoMarkdownEditor.prototype, "savedSelectionForPreview", 2);