@golemui/gui-lit 1.1.0 → 1.1.1-rc.1

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 (60) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/{button.element-3a7rRHbA.js → button.element-CJay43iR.js} +16 -13
  3. package/{calendar-BuJgwvZx.js → calendar-D31xNsxx.js} +72 -59
  4. package/{calendar.element-M5MPJmap.js → calendar.element-BhFrCsns.js} +22 -20
  5. package/{checkbox.element-CVskoXEc.js → checkbox.element-DAAVB651.js} +49 -49
  6. package/{currency.element-CfFrAtrr.js → currency.element-D8A2ObpM.js} +11 -10
  7. package/{date-Bj9mI3GU.js → date-DBuYpvcO.js} +35 -27
  8. package/{date-input-cJDkNnVw.js → date-input-DLiMreSS.js} +64 -44
  9. package/date-picker.element-DeUQtbLg.js +357 -0
  10. package/{date-time-calendar-BzRfkLKU.js → date-time-calendar-DzU-FtVl.js} +89 -76
  11. package/{date-time-calendar.element-DC4NK0y1.js → date-time-calendar.element-BLBcVsFu.js} +13 -11
  12. package/{date-time-input-BXxsfuyZ.js → date-time-input-DZaz2heD.js} +75 -43
  13. package/{date-time-picker.element-Dy-8cb-_.js → date-time-picker.element-BUbLdV6i.js} +125 -65
  14. package/{date-time.element-Bv4XdzMi.js → date-time.element-B5onfSBG.js} +31 -25
  15. package/{date.element-Consgsbb.js → date.element-BsKhLrEc.js} +22 -19
  16. package/{day-status-0-hJHrI7.js → day-status-CsWStVQV.js} +153 -129
  17. package/{dropdown.element-WsD61Qel.js → dropdown.element-CXpMwJsU.js} +19 -13
  18. package/{errors-QjKhr6mA.js → errors-Byb2dIhK.js} +3 -2
  19. package/index.js +2933 -2336
  20. package/index.umd.cjs +798 -405
  21. package/{list-CrLIL4by.js → list-D730tmGN.js} +115 -116
  22. package/{list.element-DV82YxnJ.js → list.element-eo3DIOrp.js} +2 -2
  23. package/{markdown.element-p-kC47D7.js → markdown.element-FbtwdnAv.js} +310 -218
  24. package/{number.element-CBr47IiY.js → number.element-BEpOCzXy.js} +76 -61
  25. package/package.json +9 -6
  26. package/{part-templates-Db871PS3.js → part-templates-VORbpgs2.js} +132 -118
  27. package/{password.element-n-R9RbkB.js → password.element-CBaB8h5b.js} +19 -17
  28. package/{pill-ranges-DCqDmpkk.js → pill-ranges-DpvWwP-3.js} +12 -12
  29. package/{pills-Be1UrLgq.js → pills-BDMO2NiR.js} +80 -58
  30. package/popup.controller-B33OvX_y.js +86 -0
  31. package/{radiogroup.element-CeQn623u.js → radiogroup.element-KWzBx8mx.js} +55 -51
  32. package/{range-calendar-CKPYeSGt.js → range-calendar-DO_woqcF.js} +101 -87
  33. package/{range-calendar.element-D6KYq18B.js → range-calendar.element-DHLZhpnj.js} +15 -13
  34. package/{range-date-input-D--AqBMv.js → range-date-input-Br7XqQPK.js} +90 -71
  35. package/{range-date-input.element-D4nIXJbw.js → range-date-input.element-BdD4SlB4.js} +15 -12
  36. package/{range-date-picker.element-dhxPAAE6.js → range-date-picker.element-DWRHiAoC.js} +97 -49
  37. package/{range-date-time-calendar-yksWrR7b.js → range-date-time-calendar-B3EMgN1E.js} +150 -136
  38. package/{range-date-time-calendar.element-C00aDefZ.js → range-date-time-calendar.element-Coea6RF4.js} +9 -7
  39. package/{range-date-time-input-B37TUoM3.js → range-date-time-input-Cu-T_nuC.js} +125 -94
  40. package/{range-date-time-input.element-DUnbv4ed.js → range-date-time-input.element-Cti44iuW.js} +31 -25
  41. package/{range-date-time-picker.element-Cbps6s_G.js → range-date-time-picker.element-CDN2RL1y.js} +107 -47
  42. package/{range-time-input-3lhqR1Ku.js → range-time-input-BP9ZL9O8.js} +85 -66
  43. package/{range-time-input.element-dU2iBdmJ.js → range-time-input.element-B7wtHJoQ.js} +14 -11
  44. package/{range-time-picker.element-v6nQsIPw.js → range-time-picker.element-CPIAiQPC.js} +92 -51
  45. package/{repeater.element-CtNgB4F5.js → repeater.element-BM1Keckd.js} +1 -1
  46. package/{select.element-C0V-Bv3L.js → select.element-eepcXTpL.js} +84 -78
  47. package/{tabs.element-BvAyI71N.js → tabs.element-CvcIA8P3.js} +1 -0
  48. package/{tags.element-DvwEpxpK.js → tags.element-CPHgotb0.js} +21 -14
  49. package/templates-Dmr34nwp.js +88 -0
  50. package/{textarea.element-HThYqdR_.js → textarea.element-CiNEy9uq.js} +8 -7
  51. package/{textinput.element-CkXNzMUg.js → textinput.element-AL2Nr768.js} +10 -9
  52. package/{time-input-BOhlBGJZ.js → time-input-5dkSm8UW.js} +67 -47
  53. package/{time-list-Czo48bZm.js → time-list-DLcq8BAp.js} +1 -1
  54. package/{time-picker-bFJ63ky8.js → time-picker-g337F8d0.js} +89 -51
  55. package/{time-picker.element-CYZVXgRS.js → time-picker.element-DLihegjg.js} +23 -19
  56. package/{time.element-fK3oLi49.js → time.element-BneqgMlQ.js} +22 -19
  57. package/{toggle.element-C1kCw5H8.js → toggle.element-Cz91CRdp.js} +44 -43
  58. package/date-picker.element-va_-LGZD.js +0 -312
  59. package/popup.controller-eUDxE6jD.js +0 -71
  60. package/templates-Dk1jxLwS.js +0 -75
@@ -1,21 +1,21 @@
1
- import { InputWidgetAdapter as S, formContext as V, inputContext as _ } from "@golemui/lit";
2
- import { LitElement as L, html as u, nothing as $ } from "lit";
3
- import { property as l, state as A, customElement as O } from "lit/decorators.js";
4
- import { classMap as y } from "lit/directives/class-map.js";
5
- import { G as T, b as I, c as M } from "./templates-Dk1jxLwS.js";
6
- import { styleMap as H } from "lit-html/directives/style-map.js";
1
+ import { InputWidgetAdapter as V, formContext as S, inputContext as C } from "@golemui/lit";
2
+ import { LitElement as k, html as u, nothing as y } from "lit";
3
+ import { property as n, state as H, customElement as A } from "lit/decorators.js";
4
+ import { classMap as $ } from "lit/directives/class-map.js";
5
+ import { G as D, b as F, c as _ } from "./templates-Dmr34nwp.js";
6
+ import { styleMap as T } from "lit-html/directives/style-map.js";
7
7
  import { ifDefined as x } from "lit/directives/if-defined.js";
8
8
  import "./markdown-text-X-BRJT6K.js";
9
- import { consume as B, provide as F } from "@lit/context";
9
+ import { consume as I, provide as B } from "@lit/context";
10
10
  import "rxjs";
11
- var Z = Object.defineProperty, D = Object.getOwnPropertyDescriptor, r = (t, e, i, n) => {
12
- for (var s = n > 1 ? void 0 : n ? D(e, i) : e, a = t.length - 1, d; a >= 0; a--)
13
- (d = t[a]) && (s = (n ? d(e, i, s) : d(s)) || s);
14
- return n && s && Z(e, i, s), s;
11
+ var M = Object.defineProperty, Z = Object.getOwnPropertyDescriptor, o = (t, e, i, r) => {
12
+ for (var a = r > 1 ? void 0 : r ? Z(e, i) : e, s = t.length - 1, d; s >= 0; s--)
13
+ (d = t[s]) && (a = (r ? d(e, i, a) : d(a)) || a);
14
+ return r && a && M(e, i, a), a;
15
15
  };
16
- let o = class extends L {
16
+ let l = class extends k {
17
17
  constructor() {
18
- super(...arguments), this.uid = void 0, this.label = void 0, this.localeId = "en", this.errors = [], this.touched = !1, this.required = !1, this.disabled = !1, this.readOnly = !1, this.value = void 0, this.hint = void 0, this.tools = void 0, this.placeholder = void 0, this.autocomplete = void 0, this.minimumHeight = void 0, this.autoGrow = !1, this.defaultOpenPreview = void 0, this.maxLength = void 0, this.headingTitle = void 0, this.boldTitle = void 0, this.italicTitle = void 0, this.strikethroughTitle = void 0, this.quoteTitle = void 0, this.linkTitle = void 0, this.orderedListTitle = void 0, this.unorderedListTitle = void 0, this.splitViewTitle = void 0, this.dependencies = void 0, this.splitViewActive = !1, this.activeFormats = {}, this.splitViewInitialized = !1, this.ariaController = new T(this, {
18
+ super(...arguments), this.uid = void 0, this.label = void 0, this.localeId = "en", this.errors = [], this.touched = !1, this.required = !1, this.disabled = !1, this.readOnly = !1, this.value = void 0, this.hint = void 0, this.tools = void 0, this.placeholder = void 0, this.autocomplete = void 0, this.minimumHeight = void 0, this.autoGrow = !1, this.defaultOpenPreview = void 0, this.maxLength = void 0, this.headingTitle = void 0, this.boldTitle = void 0, this.italicTitle = void 0, this.strikethroughTitle = void 0, this.quoteTitle = void 0, this.linkTitle = void 0, this.orderedListTitle = void 0, this.unorderedListTitle = void 0, this.splitViewTitle = void 0, this.toolbarAriaLabel = void 0, this.dependencies = void 0, this.splitViewActive = !1, this.activeFormats = {}, this.splitViewInitialized = !1, this.ariaController = new D(this, {
19
19
  getTargets: () => this.querySelectorAll(`textarea[id="${this.uid}"]`),
20
20
  getState: () => ({
21
21
  uid: this.uid,
@@ -24,7 +24,8 @@ let o = class extends L {
24
24
  errors: this.errors,
25
25
  readonly: this.readOnly,
26
26
  disabled: this.disabled,
27
- touched: this.touched
27
+ touched: this.touched,
28
+ required: this.required
28
29
  }
29
30
  })
30
31
  });
@@ -66,40 +67,46 @@ let o = class extends L {
66
67
  };
67
68
  let i = u``;
68
69
  if (t.counterMode && t.maxLength) {
69
- const s = {
70
+ const a = {
70
71
  "gui-markdown--counter": !0,
71
72
  "gui-markdown--counter__error": (t.value?.length ?? 0) > t.maxLength
72
- }, a = t.counterMode === "current" ? u`<span>${t.value?.length ?? 0}</span>` : u`<span>${t.maxLength - (t.value?.length ?? 0)}</span>`;
73
- i = u`<div class=${y(s)}>
74
- ${a}
73
+ }, s = t.counterMode === "current" ? u`<span>${t.value?.length ?? 0}</span>` : u`<span>${t.maxLength - (t.value?.length ?? 0)}</span>`;
74
+ i = u`<div class=${$(a)}>
75
+ ${s}
75
76
  <span> / ${t.maxLength}</span>
76
77
  </div>`;
77
78
  }
78
- const n = {
79
+ const r = {
79
80
  "min-height": `${t.minimumHeight}px`
80
81
  };
81
82
  return u`
82
- ${I(this.uid, t)}
83
+ ${F(this.uid, t)}
83
84
 
84
85
  <div
85
- class=${y({
86
+ class=${$({
86
87
  "gui-widget": !0,
87
88
  "gui-markdown--with-preview": this.splitViewActive
88
89
  })}
89
90
  >
90
- <nav class="gui-markdown__toolbar">
91
- <ul>
91
+ <nav
92
+ class="gui-markdown__toolbar"
93
+ role="toolbar"
94
+ aria-label=${this.toolbarAriaLabel ?? "Text formatting"}
95
+ >
96
+ <ul role="presentation">
92
97
  ${(this.tools ?? ["H", "B", "I", "S", "Q", "L", "|", "OL", "UL"]).map(
93
- (s) => this.renderToolbarItem(s)
98
+ (a) => this.renderToolbarItem(a)
94
99
  )}
95
- <li>
100
+ <li role="presentation">
96
101
  <button
97
102
  type="button"
98
- tabindex="0"
99
- class=${y({
103
+ class=${$({
100
104
  "gui-markdown__toolbar-button": !0,
101
105
  "gui-markdown__toolbar-button--active": this.splitViewActive
102
106
  })}
107
+ ?disabled=${this.disabled}
108
+ aria-label=${this.splitViewTitle ?? "Split View"}
109
+ aria-pressed=${this.splitViewActive ? "true" : "false"}
103
110
  @click=${this.splitView}
104
111
  title=${this.splitViewTitle ?? "Split View"}
105
112
  >
@@ -108,6 +115,7 @@ let o = class extends L {
108
115
  width="20"
109
116
  height="20"
110
117
  viewBox="0 0 256 256"
118
+ aria-hidden="true"
111
119
  >
112
120
  <path
113
121
  d="M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40ZM56,56h64V200H56ZM200,200H136V56h64V200Z"
@@ -121,13 +129,13 @@ let o = class extends L {
121
129
  <div class="gui-markdown__container">
122
130
  <textarea
123
131
  id=${x(this.uid)}
124
- class=${y(e)}
125
- style=${H(n)}
132
+ class=${$(e)}
133
+ style=${T(r)}
126
134
  ?required=${t.required}
127
135
  ?disabled=${t.disabled}
128
136
  ?readonly=${t.readonly}
129
137
  placeholder=${x(t.placeholder)}
130
- autocomplete=${this.autocomplete || $}
138
+ autocomplete=${this.autocomplete || y}
131
139
  .value=${this.value || ""}
132
140
  @input=${this.valueChanged}
133
141
  @keyup=${this.detectFormats}
@@ -137,21 +145,21 @@ let o = class extends L {
137
145
 
138
146
  ${this.splitViewActive ? u`
139
147
  <section
140
- data-cy=${x(this.uid ? `${this.uid}_markdown` : $)}
148
+ data-cy=${x(this.uid ? `${this.uid}_markdown` : y)}
141
149
  class="gui-markdown__preview"
142
- style=${H(n)}
150
+ style=${T(r)}
143
151
  >
144
152
  <gui-markdown-text
145
153
  .md=${this.value || ""}
146
154
  .dependencies=${this.dependencies}
147
155
  ></gui-markdown-text>
148
156
  </section>
149
- ` : $}
157
+ ` : y}
150
158
  </div>
151
159
  </div>
152
160
 
153
161
  <div class="gui-markdown--validation">
154
- <div>${M(this.uid, t)}</div>
162
+ <div>${_(this.uid, t)}</div>
155
163
  ${i}
156
164
  </div>
157
165
  `;
@@ -160,24 +168,32 @@ let o = class extends L {
160
168
  if (!this.autoGrow) return;
161
169
  const t = this.querySelector(`textarea[id="${this.uid}"]`);
162
170
  if (!t) return;
163
- const e = window.getComputedStyle(t), i = parseFloat(e.paddingTop), n = parseFloat(e.paddingBottom), s = i + n;
164
- t.style.height = "auto", t.style.height = `${Math.max(this.minimumHeight ?? 120, t.scrollHeight - s)}px`;
171
+ const e = window.getComputedStyle(t), i = parseFloat(e.paddingTop), r = parseFloat(e.paddingBottom), a = i + r;
172
+ t.style.height = "auto", t.style.height = `${Math.max(this.minimumHeight ?? 120, t.scrollHeight - a)}px`;
165
173
  }
166
174
  splitView() {
167
- this.splitViewActive = !this.splitViewActive;
175
+ this.disabled || (this.splitViewActive = !this.splitViewActive);
168
176
  }
169
177
  renderToolbarItem(t) {
170
178
  switch (t) {
171
179
  case "H":
172
- return u`<li>
180
+ return u`<li role="presentation">
173
181
  <button
174
182
  type="button"
175
- tabindex="0"
176
183
  class=${this.toolbarBtnClass("heading")}
184
+ ?disabled=${this.disabled || this.readOnly}
185
+ aria-label=${this.headingTitle ?? "Heading"}
186
+ aria-pressed=${this.activeFormats.heading ? "true" : "false"}
177
187
  @click=${this.applyFormat("# ", "", "heading")}
178
188
  title=${this.headingTitle ?? "Heading"}
179
189
  >
180
- <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 256 256">
190
+ <svg
191
+ xmlns="http://www.w3.org/2000/svg"
192
+ width="20"
193
+ height="20"
194
+ viewBox="0 0 256 256"
195
+ aria-hidden="true"
196
+ >
181
197
  <path
182
198
  d="M212,56V200a12,12,0,0,1-24,0V140H68v60a12,12,0,0,1-24,0V56a12,12,0,0,1,24,0v60H188V56a12,12,0,0,1,24,0Z"
183
199
  ></path>
@@ -185,15 +201,23 @@ let o = class extends L {
185
201
  </button>
186
202
  </li>`;
187
203
  case "B":
188
- return u`<li>
204
+ return u`<li role="presentation">
189
205
  <button
190
206
  type="button"
191
- tabindex="0"
192
207
  class=${this.toolbarBtnClass("bold")}
208
+ ?disabled=${this.disabled || this.readOnly}
209
+ aria-label=${this.boldTitle ?? "Bold"}
210
+ aria-pressed=${this.activeFormats.bold ? "true" : "false"}
193
211
  @click=${this.applyFormat("**", "**", "bold")}
194
212
  title=${this.boldTitle ?? "Bold"}
195
213
  >
196
- <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 256 256">
214
+ <svg
215
+ xmlns="http://www.w3.org/2000/svg"
216
+ width="20"
217
+ height="20"
218
+ viewBox="0 0 256 256"
219
+ aria-hidden="true"
220
+ >
197
221
  <path
198
222
  d="M185.08,114.46A48,48,0,0,0,148,36H80A12,12,0,0,0,68,48V200a12,12,0,0,0,12,12h80a52,52,0,0,0,25.08-97.54ZM92,60h56a24,24,0,0,1,0,48H92Zm68,128H92V132h68a28,28,0,0,1,0,56Z"
199
223
  ></path>
@@ -201,15 +225,23 @@ let o = class extends L {
201
225
  </button>
202
226
  </li>`;
203
227
  case "I":
204
- return u`<li>
228
+ return u`<li role="presentation">
205
229
  <button
206
230
  type="button"
207
- tabindex="0"
208
231
  class=${this.toolbarBtnClass("italic")}
232
+ ?disabled=${this.disabled || this.readOnly}
233
+ aria-label=${this.italicTitle ?? "Italic"}
234
+ aria-pressed=${this.activeFormats.italic ? "true" : "false"}
209
235
  @click=${this.applyFormat("_", "_", "italic")}
210
236
  title=${this.italicTitle ?? "Italic"}
211
237
  >
212
- <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 256 256">
238
+ <svg
239
+ xmlns="http://www.w3.org/2000/svg"
240
+ width="20"
241
+ height="20"
242
+ viewBox="0 0 256 256"
243
+ aria-hidden="true"
244
+ >
213
245
  <path
214
246
  d="M204,56a12,12,0,0,1-12,12H160.65l-40,120H144a12,12,0,0,1,0,24H64a12,12,0,0,1,0-24H95.35l40-120H112a12,12,0,0,1,0-24h80A12,12,0,0,1,204,56Z"
215
247
  ></path>
@@ -217,15 +249,23 @@ let o = class extends L {
217
249
  </button>
218
250
  </li>`;
219
251
  case "S":
220
- return u`<li>
252
+ return u`<li role="presentation">
221
253
  <button
222
254
  type="button"
223
- tabindex="0"
224
255
  class=${this.toolbarBtnClass("strikethrough")}
256
+ ?disabled=${this.disabled || this.readOnly}
257
+ aria-label=${this.strikethroughTitle ?? "Strikethrough"}
258
+ aria-pressed=${this.activeFormats.strikethrough ? "true" : "false"}
225
259
  @click=${this.applyFormat("~~", "~~", "strikethrough")}
226
260
  title=${this.strikethroughTitle ?? "Strikethrough"}
227
261
  >
228
- <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 256 256">
262
+ <svg
263
+ xmlns="http://www.w3.org/2000/svg"
264
+ width="20"
265
+ height="20"
266
+ viewBox="0 0 256 256"
267
+ aria-hidden="true"
268
+ >
229
269
  <path
230
270
  d="M224,128a8,8,0,0,1-8,8H175.93c9.19,7.11,16.07,17.2,16.07,32,0,13.34-7,25.7-19.75,34.79C160.33,211.31,144.61,216,128,216s-32.33-4.69-44.25-13.21C71,193.7,64,181.34,64,168a8,8,0,0,1,16,0c0,17.35,22,32,48,32s48-14.65,48-32c0-14.85-10.54-23.58-38.77-32H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM76.33,104a8,8,0,0,0,7.61-10.49A17.3,17.3,0,0,1,83.11,88c0-18.24,19.3-32,44.89-32,18.84,0,34.16,7.42,41,19.85a8,8,0,0,0,14-7.7C173.33,50.52,152.77,40,128,40,93.29,40,67.11,60.63,67.11,88a33.73,33.73,0,0,0,1.62,10.49A8,8,0,0,0,76.33,104Z"
231
271
  ></path>
@@ -233,15 +273,23 @@ let o = class extends L {
233
273
  </button>
234
274
  </li>`;
235
275
  case "Q":
236
- return u`<li>
276
+ return u`<li role="presentation">
237
277
  <button
238
278
  type="button"
239
- tabindex="0"
240
279
  class=${this.toolbarBtnClass("quote")}
280
+ ?disabled=${this.disabled || this.readOnly}
281
+ aria-label=${this.quoteTitle ?? "Quote"}
282
+ aria-pressed=${this.activeFormats.quote ? "true" : "false"}
241
283
  @click=${this.applyFormat("> ", "", "quote")}
242
284
  title=${this.quoteTitle ?? "Quote"}
243
285
  >
244
- <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 256 256">
286
+ <svg
287
+ xmlns="http://www.w3.org/2000/svg"
288
+ width="20"
289
+ height="20"
290
+ viewBox="0 0 256 256"
291
+ aria-hidden="true"
292
+ >
245
293
  <path
246
294
  d="M100,52H40A20,20,0,0,0,20,72v64a20,20,0,0,0,20,20H96v4a28,28,0,0,1-28,28,12,12,0,0,0,0,24,52.06,52.06,0,0,0,52-52V72A20,20,0,0,0,100,52Zm-4,80H44V76H96ZM216,52H156a20,20,0,0,0-20,20v64a20,20,0,0,0,20,20h56v4a28,28,0,0,1-28,28,12,12,0,0,0,0,24,52.06,52.06,0,0,0,52-52V72A20,20,0,0,0,216,52Zm-4,80H160V76h52Z"
247
295
  ></path>
@@ -249,15 +297,23 @@ let o = class extends L {
249
297
  </button>
250
298
  </li>`;
251
299
  case "L":
252
- return u`<li>
300
+ return u`<li role="presentation">
253
301
  <button
254
302
  type="button"
255
- tabindex="0"
256
303
  class=${this.toolbarBtnClass("link")}
304
+ ?disabled=${this.disabled || this.readOnly}
305
+ aria-label=${this.linkTitle ?? "Link"}
306
+ aria-pressed=${this.activeFormats.link ? "true" : "false"}
257
307
  @click=${this.applyFormat("[", "](url)", "link")}
258
308
  title=${this.linkTitle ?? "Link"}
259
309
  >
260
- <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 256 256">
310
+ <svg
311
+ xmlns="http://www.w3.org/2000/svg"
312
+ width="20"
313
+ height="20"
314
+ viewBox="0 0 256 256"
315
+ aria-hidden="true"
316
+ >
261
317
  <path
262
318
  d="M117.18,188.74a12,12,0,0,1,0,17l-5.12,5.12A58.26,58.26,0,0,1,70.6,228h0A58.62,58.62,0,0,1,29.14,127.92L63.89,93.17a58.64,58.64,0,0,1,98.56,28.11,12,12,0,1,1-23.37,5.44,34.65,34.65,0,0,0-58.22-16.58L46.11,144.89A34.62,34.62,0,0,0,70.57,204h0a34.41,34.41,0,0,0,24.49-10.14l5.11-5.12A12,12,0,0,1,117.18,188.74ZM226.83,45.17a58.65,58.65,0,0,0-82.93,0l-5.11,5.11a12,12,0,0,0,17,17l5.12-5.12a34.63,34.63,0,1,1,49,49L175.1,145.86A34.39,34.39,0,0,1,150.61,156h0a34.63,34.63,0,0,1-33.69-26.72,12,12,0,0,0-23.38,5.44A58.64,58.64,0,0,0,150.56,180h.05a58.28,58.28,0,0,0,41.47-17.17l34.75-34.75a58.62,58.62,0,0,0,0-82.91Z"
263
319
  ></path>
@@ -265,15 +321,23 @@ let o = class extends L {
265
321
  </button>
266
322
  </li>`;
267
323
  case "OL":
268
- return u`<li>
324
+ return u`<li role="presentation">
269
325
  <button
270
326
  type="button"
271
- tabindex="0"
272
327
  class=${this.toolbarBtnClass("orderedList")}
328
+ ?disabled=${this.disabled || this.readOnly}
329
+ aria-label=${this.orderedListTitle ?? "Ordered List"}
330
+ aria-pressed=${this.activeFormats.orderedList ? "true" : "false"}
273
331
  @click=${this.applyFormat("1. ", "", "orderedList")}
274
332
  title=${this.orderedListTitle ?? "Ordered List"}
275
333
  >
276
- <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 256 256">
334
+ <svg
335
+ xmlns="http://www.w3.org/2000/svg"
336
+ width="20"
337
+ height="20"
338
+ viewBox="0 0 256 256"
339
+ aria-hidden="true"
340
+ >
277
341
  <path
278
342
  d="M228,128a12,12,0,0,1-12,12H116a12,12,0,0,1,0-24H216A12,12,0,0,1,228,128ZM116,76H216a12,12,0,0,0,0-24H116a12,12,0,0,0,0,24ZM216,180H116a12,12,0,0,0,0,24H216a12,12,0,0,0,0-24ZM44,59.31V104a12,12,0,0,0,24,0V40A12,12,0,0,0,50.64,29.27l-16,8a12,12,0,0,0,9.36,22Zm39.73,96.86a27.7,27.7,0,0,0-11.2-18.63A28.89,28.89,0,0,0,32.9,143a27.71,27.71,0,0,0-4.17,7.54,12,12,0,0,0,22.55,8.21,4,4,0,0,1,.58-1,4.78,4.78,0,0,1,6.5-.82,3.82,3.82,0,0,1,1.61,2.6,3.63,3.63,0,0,1-.77,2.77l-.13.17L30.39,200.82A12,12,0,0,0,40,220H72a12,12,0,0,0,0-24H64l14.28-19.11A27.48,27.48,0,0,0,83.73,156.17Z"
279
343
  ></path>
@@ -281,15 +345,23 @@ let o = class extends L {
281
345
  </button>
282
346
  </li>`;
283
347
  case "UL":
284
- return u`<li>
348
+ return u`<li role="presentation">
285
349
  <button
286
350
  type="button"
287
- tabindex="0"
288
351
  class=${this.toolbarBtnClass("unorderedList")}
352
+ ?disabled=${this.disabled || this.readOnly}
353
+ aria-label=${this.unorderedListTitle ?? "Unordered List"}
354
+ aria-pressed=${this.activeFormats.unorderedList ? "true" : "false"}
289
355
  @click=${this.applyFormat("- ", "", "unorderedList")}
290
356
  title=${this.unorderedListTitle ?? "Unordered List"}
291
357
  >
292
- <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 256 256">
358
+ <svg
359
+ xmlns="http://www.w3.org/2000/svg"
360
+ width="20"
361
+ height="20"
362
+ viewBox="0 0 256 256"
363
+ aria-hidden="true"
364
+ >
293
365
  <path
294
366
  d="M76,64A12,12,0,0,1,88,52H216a12,12,0,0,1,0,24H88A12,12,0,0,1,76,64Zm140,52H88a12,12,0,0,0,0,24H216a12,12,0,0,0,0-24Zm0,64H88a12,12,0,0,0,0,24H216a12,12,0,0,0,0-24ZM44,112a16,16,0,1,0,16,16A16,16,0,0,0,44,112Zm0-64A16,16,0,1,0,60,64,16,16,0,0,0,44,48Zm0,128a16,16,0,1,0,16,16A16,16,0,0,0,44,176Z"
295
367
  ></path>
@@ -297,19 +369,25 @@ let o = class extends L {
297
369
  </button>
298
370
  </li>`;
299
371
  case "|":
300
- return u`<li>
372
+ return u`<li role="presentation">
301
373
  <span class="gui-markdown__toolbar-separator">
302
- <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 256 256">
374
+ <svg
375
+ xmlns="http://www.w3.org/2000/svg"
376
+ width="20"
377
+ height="20"
378
+ viewBox="0 0 256 256"
379
+ aria-hidden="true"
380
+ >
303
381
  <path d="M140,24V232a12,12,0,0,1-24,0V24a12,12,0,0,1,24,0Z"></path>
304
382
  </svg>
305
383
  </span>
306
384
  </li>`;
307
385
  default:
308
- return $;
386
+ return y;
309
387
  }
310
388
  }
311
389
  toolbarBtnClass(t) {
312
- return y({
390
+ return $({
313
391
  "gui-markdown__toolbar-button": !0,
314
392
  "gui-markdown__toolbar-button--disabled": this.disabled === !0 || this.readOnly === !0,
315
393
  "gui-markdown__toolbar-button--active": !!t && !!this.activeFormats[t]
@@ -318,29 +396,29 @@ let o = class extends L {
318
396
  detectFormats() {
319
397
  const t = this.querySelector(`textarea[id="${this.uid}"]`);
320
398
  if (!t) return;
321
- const { selectionStart: e, value: i } = t, n = i.lastIndexOf(`
322
- `, e - 1) + 1, s = i.indexOf(`
323
- `, e), a = i.substring(n, s === -1 ? i.length : s);
399
+ const { selectionStart: e, value: i } = t, r = i.lastIndexOf(`
400
+ `, e - 1) + 1, a = i.indexOf(`
401
+ `, e), s = i.substring(r, a === -1 ? i.length : a);
324
402
  this.activeFormats = {
325
- heading: /^#{1,6}\s/.test(a),
403
+ heading: /^#{1,6}\s/.test(s),
326
404
  bold: this.isInsideInlineFormat(i, e, "**"),
327
405
  italic: this.isInsideInlineFormat(i, e, "_"),
328
406
  strikethrough: this.isInsideInlineFormat(i, e, "~~"),
329
- quote: a.startsWith("> "),
407
+ quote: s.startsWith("> "),
330
408
  link: this.isInsideLink(i, e),
331
- orderedList: /^\d+\.\s/.test(a),
332
- unorderedList: a.startsWith("- ")
409
+ orderedList: /^\d+\.\s/.test(s),
410
+ unorderedList: s.startsWith("- ")
333
411
  };
334
412
  }
335
413
  isInsideInlineFormat(t, e, i) {
336
- const n = t.lastIndexOf(`
337
- `, e - 1) + 1, s = t.indexOf(`
338
- `, e), a = t.substring(n, s === -1 ? t.length : s), d = e - n;
414
+ const r = t.lastIndexOf(`
415
+ `, e - 1) + 1, a = t.indexOf(`
416
+ `, e), s = t.substring(r, a === -1 ? t.length : a), d = e - r;
339
417
  let h = 0;
340
- for (; h < a.length; ) {
341
- const g = a.indexOf(i, h);
418
+ for (; h < s.length; ) {
419
+ const g = s.indexOf(i, h);
342
420
  if (g === -1) break;
343
- const p = a.indexOf(i, g + i.length);
421
+ const p = s.indexOf(i, g + i.length);
344
422
  if (p === -1) break;
345
423
  if (d >= g && d <= p + i.length)
346
424
  return !0;
@@ -350,69 +428,70 @@ let o = class extends L {
350
428
  }
351
429
  isInsideLink(t, e) {
352
430
  const i = t.lastIndexOf(`
353
- `, e - 1) + 1, n = t.indexOf(`
354
- `, e), s = t.substring(i, n === -1 ? t.length : n), a = e - i, d = /\[[^\]]*\]\([^)]*\)/g;
431
+ `, e - 1) + 1, r = t.indexOf(`
432
+ `, e), a = t.substring(i, r === -1 ? t.length : r), s = e - i, d = /\[[^\]]*\]\([^)]*\)/g;
355
433
  let h;
356
- for (; (h = d.exec(s)) !== null; )
357
- if (a >= h.index && a <= h.index + h[0].length)
434
+ for (; (h = d.exec(a)) !== null; )
435
+ if (s >= h.index && s <= h.index + h[0].length)
358
436
  return !0;
359
437
  return !1;
360
438
  }
361
439
  applyFormat(t, e = "", i = "") {
362
440
  return () => {
363
- const n = this.querySelector(`textarea[id="${this.uid}"]`);
364
- if (n) {
441
+ if (this.disabled || this.readOnly) return;
442
+ const r = this.querySelector(`textarea[id="${this.uid}"]`);
443
+ if (r) {
365
444
  if (i && this.activeFormats[i])
366
- this.removeFormat(n, t, e, i);
445
+ this.removeFormat(r, t, e, i);
367
446
  else {
368
- const { selectionStart: s, selectionEnd: a, value: d } = n, h = d.substring(s, a), g = d.substring(0, s), p = d.substring(a);
369
- n.value = `${g}${t}${h}${e}${p}`, n.selectionStart = s + t.length, n.selectionEnd = s + t.length + h.length;
447
+ const { selectionStart: a, selectionEnd: s, value: d } = r, h = d.substring(a, s), g = d.substring(0, a), p = d.substring(s);
448
+ r.value = `${g}${t}${h}${e}${p}`, r.selectionStart = a + t.length, r.selectionEnd = a + t.length + h.length;
370
449
  }
371
- n.focus(), n.dispatchEvent(new Event("input", { bubbles: !0 })), this.detectFormats();
450
+ r.focus(), r.dispatchEvent(new Event("input", { bubbles: !0 })), this.detectFormats();
372
451
  }
373
452
  };
374
453
  }
375
- removeFormat(t, e, i, n) {
376
- const { selectionStart: s, value: a } = t, d = a.lastIndexOf(`
377
- `, s - 1) + 1, h = a.indexOf(`
378
- `, s), g = a.substring(d, h === -1 ? a.length : h);
454
+ removeFormat(t, e, i, r) {
455
+ const { selectionStart: a, value: s } = t, d = s.lastIndexOf(`
456
+ `, a - 1) + 1, h = s.indexOf(`
457
+ `, a), g = s.substring(d, h === -1 ? s.length : h);
379
458
  if (i)
380
- if (n === "link") {
381
- const p = s - d, b = /\[([^\]]*)\]\([^)]*\)/g;
459
+ if (r === "link") {
460
+ const p = a - d, v = /\[([^\]]*)\]\([^)]*\)/g;
382
461
  let c;
383
- for (; (c = b.exec(g)) !== null; )
462
+ for (; (c = v.exec(g)) !== null; )
384
463
  if (p >= c.index && p <= c.index + c[0].length) {
385
- const v = c[1], m = d + c.index, w = m + c[0].length;
386
- t.value = `${a.substring(0, m)}${v}${a.substring(w)}`, t.selectionStart = m, t.selectionEnd = m + v.length;
464
+ const b = c[1], m = d + c.index, w = m + c[0].length;
465
+ t.value = `${s.substring(0, m)}${b}${s.substring(w)}`, t.selectionStart = m, t.selectionEnd = m + b.length;
387
466
  break;
388
467
  }
389
468
  } else {
390
- const p = s - d;
391
- let b = 0;
392
- for (; b < g.length; ) {
393
- const c = g.indexOf(e, b);
469
+ const p = a - d;
470
+ let v = 0;
471
+ for (; v < g.length; ) {
472
+ const c = g.indexOf(e, v);
394
473
  if (c === -1) break;
395
- const v = g.indexOf(i, c + e.length);
396
- if (v === -1) break;
397
- if (p >= c && p <= v + i.length) {
398
- const m = g.substring(c + e.length, v), w = d + c, C = d + v + i.length;
399
- t.value = `${a.substring(0, w)}${m}${a.substring(C)}`, t.selectionStart = w, t.selectionEnd = w + m.length;
474
+ const b = g.indexOf(i, c + e.length);
475
+ if (b === -1) break;
476
+ if (p >= c && p <= b + i.length) {
477
+ const m = g.substring(c + e.length, b), w = d + c, O = d + b + i.length;
478
+ t.value = `${s.substring(0, w)}${m}${s.substring(O)}`, t.selectionStart = w, t.selectionEnd = w + m.length;
400
479
  break;
401
480
  }
402
- b = v + i.length;
481
+ v = b + i.length;
403
482
  }
404
483
  }
405
484
  else {
406
485
  let p = e;
407
- if (n === "heading") {
486
+ if (r === "heading") {
408
487
  const m = g.match(/^#{1,6}\s/);
409
488
  m && (p = m[0]);
410
- } else if (n === "orderedList") {
489
+ } else if (r === "orderedList") {
411
490
  const m = g.match(/^\d+\.\s/);
412
491
  m && (p = m[0]);
413
492
  }
414
- const b = a.substring(0, d), c = g.substring(p.length), v = a.substring(h === -1 ? a.length : h);
415
- t.value = `${b}${c}${v}`, t.selectionStart = Math.max(d, s - p.length), t.selectionEnd = t.selectionStart;
493
+ const v = s.substring(0, d), c = g.substring(p.length), b = s.substring(h === -1 ? s.length : h);
494
+ t.value = `${v}${c}${b}`, t.selectionStart = Math.max(d, a - p.length), t.selectionEnd = t.selectionStart;
416
495
  }
417
496
  }
418
497
  valueChanged(t) {
@@ -436,108 +515,111 @@ let o = class extends L {
436
515
  );
437
516
  }
438
517
  };
439
- r([
440
- l({ type: String })
441
- ], o.prototype, "uid", 2);
442
- r([
443
- l({ type: String })
444
- ], o.prototype, "label", 2);
445
- r([
446
- l({ type: String, attribute: "locale-id" })
447
- ], o.prototype, "localeId", 2);
448
- r([
449
- l({ type: Array })
450
- ], o.prototype, "errors", 2);
451
- r([
452
- l({ type: Boolean })
453
- ], o.prototype, "touched", 2);
454
- r([
455
- l({ type: Boolean })
456
- ], o.prototype, "required", 2);
457
- r([
458
- l({ type: Boolean })
459
- ], o.prototype, "disabled", 2);
460
- r([
461
- l({ type: Boolean, attribute: "readonly" })
462
- ], o.prototype, "readOnly", 2);
463
- r([
464
- l({ type: String })
465
- ], o.prototype, "value", 2);
466
- r([
467
- l({ type: String })
468
- ], o.prototype, "hint", 2);
469
- r([
470
- l({ type: Array })
471
- ], o.prototype, "tools", 2);
472
- r([
473
- l({ type: String })
474
- ], o.prototype, "placeholder", 2);
475
- r([
476
- l({ type: String })
477
- ], o.prototype, "autocomplete", 2);
478
- r([
479
- l({ type: String, attribute: "countermode" })
480
- ], o.prototype, "counterMode", 2);
481
- r([
482
- l({ type: Number, attribute: "minimumheight" })
483
- ], o.prototype, "minimumHeight", 2);
484
- r([
485
- l({ type: Boolean, attribute: "autogrow" })
486
- ], o.prototype, "autoGrow", 2);
487
- r([
488
- l({ type: Boolean, attribute: "defaultopenpreview" })
489
- ], o.prototype, "defaultOpenPreview", 2);
490
- r([
491
- l({ type: Number, attribute: "maxlength" })
492
- ], o.prototype, "maxLength", 2);
493
- r([
494
- l({ type: String })
495
- ], o.prototype, "headingTitle", 2);
496
- r([
497
- l({ type: String })
498
- ], o.prototype, "boldTitle", 2);
499
- r([
500
- l({ type: String })
501
- ], o.prototype, "italicTitle", 2);
502
- r([
503
- l({ type: String })
504
- ], o.prototype, "strikethroughTitle", 2);
505
- r([
506
- l({ type: String })
507
- ], o.prototype, "quoteTitle", 2);
508
- r([
509
- l({ type: String })
510
- ], o.prototype, "linkTitle", 2);
511
- r([
512
- l({ type: String })
513
- ], o.prototype, "orderedListTitle", 2);
514
- r([
515
- l({ type: String })
516
- ], o.prototype, "unorderedListTitle", 2);
517
- r([
518
- l({ type: String })
519
- ], o.prototype, "splitViewTitle", 2);
520
- r([
521
- l({ type: Object })
522
- ], o.prototype, "dependencies", 2);
523
- r([
524
- A()
525
- ], o.prototype, "splitViewActive", 2);
526
- r([
527
- A()
528
- ], o.prototype, "activeFormats", 2);
529
- o = r([
530
- O("gui-markdown")
531
- ], o);
532
- typeof customElements < "u" && !customElements.get("gui-markdown") && customElements.define("gui-markdown", o);
533
- var E = Object.defineProperty, q = Object.getOwnPropertyDescriptor, k = (t, e, i, n) => {
534
- for (var s = n > 1 ? void 0 : n ? q(e, i) : e, a = t.length - 1, d; a >= 0; a--)
535
- (d = t[a]) && (s = (n ? d(e, i, s) : d(s)) || s);
536
- return n && s && E(e, i, s), s;
518
+ o([
519
+ n({ type: String })
520
+ ], l.prototype, "uid", 2);
521
+ o([
522
+ n({ type: String })
523
+ ], l.prototype, "label", 2);
524
+ o([
525
+ n({ type: String, attribute: "locale-id" })
526
+ ], l.prototype, "localeId", 2);
527
+ o([
528
+ n({ type: Array })
529
+ ], l.prototype, "errors", 2);
530
+ o([
531
+ n({ type: Boolean })
532
+ ], l.prototype, "touched", 2);
533
+ o([
534
+ n({ type: Boolean })
535
+ ], l.prototype, "required", 2);
536
+ o([
537
+ n({ type: Boolean })
538
+ ], l.prototype, "disabled", 2);
539
+ o([
540
+ n({ type: Boolean, attribute: "readonly" })
541
+ ], l.prototype, "readOnly", 2);
542
+ o([
543
+ n({ type: String })
544
+ ], l.prototype, "value", 2);
545
+ o([
546
+ n({ type: String })
547
+ ], l.prototype, "hint", 2);
548
+ o([
549
+ n({ type: Array })
550
+ ], l.prototype, "tools", 2);
551
+ o([
552
+ n({ type: String })
553
+ ], l.prototype, "placeholder", 2);
554
+ o([
555
+ n({ type: String })
556
+ ], l.prototype, "autocomplete", 2);
557
+ o([
558
+ n({ type: String, attribute: "countermode" })
559
+ ], l.prototype, "counterMode", 2);
560
+ o([
561
+ n({ type: Number, attribute: "minimumheight" })
562
+ ], l.prototype, "minimumHeight", 2);
563
+ o([
564
+ n({ type: Boolean, attribute: "autogrow" })
565
+ ], l.prototype, "autoGrow", 2);
566
+ o([
567
+ n({ type: Boolean, attribute: "defaultopenpreview" })
568
+ ], l.prototype, "defaultOpenPreview", 2);
569
+ o([
570
+ n({ type: Number, attribute: "maxlength" })
571
+ ], l.prototype, "maxLength", 2);
572
+ o([
573
+ n({ type: String })
574
+ ], l.prototype, "headingTitle", 2);
575
+ o([
576
+ n({ type: String })
577
+ ], l.prototype, "boldTitle", 2);
578
+ o([
579
+ n({ type: String })
580
+ ], l.prototype, "italicTitle", 2);
581
+ o([
582
+ n({ type: String })
583
+ ], l.prototype, "strikethroughTitle", 2);
584
+ o([
585
+ n({ type: String })
586
+ ], l.prototype, "quoteTitle", 2);
587
+ o([
588
+ n({ type: String })
589
+ ], l.prototype, "linkTitle", 2);
590
+ o([
591
+ n({ type: String })
592
+ ], l.prototype, "orderedListTitle", 2);
593
+ o([
594
+ n({ type: String })
595
+ ], l.prototype, "unorderedListTitle", 2);
596
+ o([
597
+ n({ type: String })
598
+ ], l.prototype, "splitViewTitle", 2);
599
+ o([
600
+ n({ type: String, attribute: "toolbar-aria-label" })
601
+ ], l.prototype, "toolbarAriaLabel", 2);
602
+ o([
603
+ n({ type: Object })
604
+ ], l.prototype, "dependencies", 2);
605
+ o([
606
+ H()
607
+ ], l.prototype, "splitViewActive", 2);
608
+ o([
609
+ H()
610
+ ], l.prototype, "activeFormats", 2);
611
+ l = o([
612
+ A("gui-markdown")
613
+ ], l);
614
+ typeof customElements < "u" && !customElements.get("gui-markdown") && customElements.define("gui-markdown", l);
615
+ var q = Object.defineProperty, E = Object.getOwnPropertyDescriptor, L = (t, e, i, r) => {
616
+ for (var a = r > 1 ? void 0 : r ? E(e, i) : e, s = t.length - 1, d; s >= 0; s--)
617
+ (d = t[s]) && (a = (r ? d(e, i, a) : d(a)) || a);
618
+ return r && a && q(e, i, a), a;
537
619
  };
538
- let f = class extends L {
620
+ let f = class extends k {
539
621
  constructor() {
540
- super(...arguments), this.adapter = new S(), this.subscriptions = [];
622
+ super(...arguments), this.adapter = new V(), this.subscriptions = [];
541
623
  }
542
624
  createRenderRoot() {
543
625
  return this;
@@ -570,6 +652,16 @@ let f = class extends L {
570
652
  .minimumHeight=${this.adapter.templateData.minimumHeight}
571
653
  .autoGrow=${this.adapter.templateData.autoGrow}
572
654
  .tools=${this.adapter.templateData.tools}
655
+ .headingTitle=${this.adapter.templateData.headingTitle}
656
+ .boldTitle=${this.adapter.templateData.boldTitle}
657
+ .italicTitle=${this.adapter.templateData.italicTitle}
658
+ .strikethroughTitle=${this.adapter.templateData.strikethroughTitle}
659
+ .quoteTitle=${this.adapter.templateData.quoteTitle}
660
+ .linkTitle=${this.adapter.templateData.linkTitle}
661
+ .orderedListTitle=${this.adapter.templateData.orderedListTitle}
662
+ .unorderedListTitle=${this.adapter.templateData.unorderedListTitle}
663
+ .splitViewTitle=${this.adapter.templateData.splitViewTitle}
664
+ .toolbarAriaLabel=${this.adapter.templateData.toolbarAriaLabel}
573
665
  .defaultOpenPreview=${this.adapter.templateData.defaultOpenPreview}
574
666
  .maxLength=${this.adapter.templateData.validator?.maxLength}
575
667
  .dependencies=${this.adapter.templateData.deps}
@@ -586,15 +678,15 @@ let f = class extends L {
586
678
  super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((t) => t.unsubscribe());
587
679
  }
588
680
  };
589
- k([
590
- B({ context: V }),
591
- l({ attribute: !1 })
681
+ L([
682
+ I({ context: S }),
683
+ n({ attribute: !1 })
592
684
  ], f.prototype, "formContext", 2);
593
- k([
594
- F({ context: _ })
685
+ L([
686
+ B({ context: C })
595
687
  ], f.prototype, "adapter", 2);
596
- f = k([
597
- O("gui-markdown-input")
688
+ f = L([
689
+ A("gui-markdown-input")
598
690
  ], f);
599
691
  export {
600
692
  f as MarkdownElement