@golemui/gui-lit 0.16.2 → 1.0.0-rc.0
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.
- package/CHANGELOG.md +20 -0
- package/{abstract-calendar-YDgwwbqe.js → abstract-calendar-BoqKPRmS.js} +51 -34
- package/{accordion.element-ChLmV6QT.js → accordion.element-BIgxl5e9.js} +0 -1
- package/{alert.element-9QFlqjj9.js → alert.element-DPWq9-0F.js} +3 -4
- package/{button.element-DxwYDdu6.js → button.element-3a7rRHbA.js} +42 -38
- package/{calendar-P9DzVryu.js → calendar-DTYKVYc3.js} +2 -2
- package/{calendar.element-O2of7VBr.js → calendar.element-MubSE1bx.js} +11 -12
- package/{checkbox.element-DMmer4Jw.js → checkbox.element-CVskoXEc.js} +0 -1
- package/{currency.element-ybKzwXEh.js → currency.element-YyL4TeL0.js} +0 -1
- package/{date-CG1562vW.js → date-DTYg8sog.js} +12 -13
- package/{date-input-D_Swskk4.js → date-input-BeQvyfln.js} +5 -3
- package/{date-picker.element-CP2_u_ZE.js → date-picker.element-DabW_-0-.js} +14 -9
- package/{date.element-p6aB6OGd.js → date.element-BtVJSIRk.js} +1 -2
- package/{dropdown.element-sbd3T145.js → dropdown.element-DqzC6aXR.js} +1 -2
- package/{flex.element-B0sG0YT1.js → flex.element-DG4Uaj_X.js} +0 -1
- package/{grid.element-Bf5aEjkj.js → grid.element-DCZsh-3J.js} +0 -1
- package/index.js +1243 -1210
- package/index.umd.cjs +136 -116
- package/lib/components/accordion.element.d.ts +1 -1
- package/lib/components/alert.element.d.ts +1 -1
- package/lib/components/button.element.d.ts +1 -1
- package/lib/components/calendar.element.d.ts +1 -1
- package/lib/components/checkbox.element.d.ts +1 -1
- package/lib/components/currency.element.d.ts +1 -1
- package/lib/components/date-picker.element.d.ts +2 -1
- package/lib/components/date.element.d.ts +1 -1
- package/lib/components/dropdown.element.d.ts +1 -1
- package/lib/components/flex.element.d.ts +1 -1
- package/lib/components/grid.element.d.ts +1 -1
- package/lib/components/list.element.d.ts +1 -1
- package/lib/components/markdown-text.element.d.ts +1 -1
- package/lib/components/markdown.element.d.ts +1 -1
- package/lib/components/number.element.d.ts +1 -1
- package/lib/components/password.element.d.ts +1 -1
- package/lib/components/radiogroup.element.d.ts +1 -1
- package/lib/components/range-calendar.element.d.ts +1 -1
- package/lib/components/range-date-input.element.d.ts +1 -1
- package/lib/components/range-date-picker.element.d.ts +1 -1
- package/lib/components/renderer.element.d.ts +1 -1
- package/lib/components/repeater.element.d.ts +1 -1
- package/lib/components/select.element.d.ts +1 -1
- package/lib/components/tabs.element.d.ts +1 -1
- package/lib/components/tags.element.d.ts +1 -1
- package/lib/components/textarea.element.d.ts +1 -1
- package/lib/components/textinput.element.d.ts +1 -1
- package/lib/components/toggle.element.d.ts +1 -1
- package/lib/widget.loaders.d.ts +1 -1
- package/{list-CVDHuXKS.js → list-D1oKnH89.js} +2 -3
- package/{list.element-Bgnx2CN_.js → list.element-Co3V3Cn5.js} +9 -10
- package/{markdown-text.element-C_1OqrGa.js → markdown-text.element-B8TfVLIO.js} +0 -1
- package/{markdown.element-1IF3G5KX.js → markdown.element-CNp4wbg9.js} +109 -106
- package/{number.element-zgd4L5hn.js → number.element-B6TsvHMK.js} +31 -40
- package/{one-of-DifUsEYY.js → one-of-C0ur6b_n.js} +13 -11
- package/package.json +6 -6
- package/{password.element-BT65mDsp.js → password.element-n-R9RbkB.js} +0 -1
- package/{pills-D0yyi-op.js → pills-B66qz_KX.js} +6 -6
- package/{radiogroup.element-DzHLgRh1.js → radiogroup.element-CeQn623u.js} +6 -7
- package/{range-calendar-CZGBBOzO.js → range-calendar-9skwbwlB.js} +4 -7
- package/{range-calendar.element-DQZXvd-L.js → range-calendar.element-QTE6vGNP.js} +1 -2
- package/{range-date-input-CcPYH7P3.js → range-date-input-Uy8134vi.js} +3 -6
- package/{range-date-input.element-v71P-oUp.js → range-date-input.element-Dj29D_OQ.js} +1 -2
- package/{range-date-picker.element-CA-KcQhA.js → range-date-picker.element-BUUKtKkz.js} +2 -3
- package/{renderer.element-DMsheQGi.js → renderer.element-CNyMn2Lu.js} +0 -1
- package/{repeater.element-Ry8HyMfW.js → repeater.element-CtNgB4F5.js} +0 -1
- package/{select.element-CjWqp9dd.js → select.element-jcDF1h-g.js} +10 -11
- package/{tabs.element-VLrtF1j5.js → tabs.element-BvAyI71N.js} +0 -1
- package/{tags.element-ed1_51GA.js → tags.element-CX3vQL8L.js} +2 -5
- package/{textarea.element-BTJLqnnI.js → textarea.element-Cu9ZW3K4.js} +0 -1
- package/{textinput.element-zI0iG-Cq.js → textinput.element-CkXNzMUg.js} +0 -1
- package/{toggle.element-NXRrhALB.js → toggle.element-C1kCw5H8.js} +9 -10
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
import { InputWidgetAdapter as
|
|
2
|
-
import "
|
|
3
|
-
import {
|
|
4
|
-
import { property as l, state as L, customElement as A } from "lit/decorators.js";
|
|
1
|
+
import { InputWidgetAdapter as S, formContext as V, inputContext as T } 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 C } from "lit/decorators.js";
|
|
5
4
|
import { classMap as y } from "lit/directives/class-map.js";
|
|
6
|
-
import { G as
|
|
7
|
-
import { styleMap as
|
|
5
|
+
import { G as I, b as M, c as _ } from "./templates-Dk1jxLwS.js";
|
|
6
|
+
import { styleMap as H } from "lit-html/directives/style-map.js";
|
|
8
7
|
import { ifDefined as x } from "lit/directives/if-defined.js";
|
|
9
8
|
import "./markdown-text-X-BRJT6K.js";
|
|
10
|
-
import { consume as
|
|
9
|
+
import { consume as B, provide as F } from "@lit/context";
|
|
11
10
|
import "rxjs";
|
|
12
|
-
var Z = Object.defineProperty, D = Object.getOwnPropertyDescriptor, r = (t, e, i,
|
|
13
|
-
for (var s =
|
|
14
|
-
(d = t[a]) && (s = (
|
|
15
|
-
return
|
|
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;
|
|
16
15
|
};
|
|
17
|
-
let
|
|
16
|
+
let o = class extends L {
|
|
18
17
|
constructor() {
|
|
19
|
-
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
|
|
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 I(this, {
|
|
20
19
|
getTargets: () => this.querySelectorAll(`textarea[id="${this.uid}"]`),
|
|
21
20
|
getState: () => ({
|
|
22
21
|
uid: this.uid,
|
|
@@ -76,11 +75,11 @@ let n = class extends H {
|
|
|
76
75
|
<span> / ${t.maxLength}</span>
|
|
77
76
|
</div>`;
|
|
78
77
|
}
|
|
79
|
-
const
|
|
78
|
+
const n = {
|
|
80
79
|
"min-height": `${t.minimumHeight}px`
|
|
81
80
|
};
|
|
82
81
|
return u`
|
|
83
|
-
${
|
|
82
|
+
${M(this.uid, t)}
|
|
84
83
|
|
|
85
84
|
<div
|
|
86
85
|
class=${y({
|
|
@@ -118,37 +117,41 @@ let n = class extends H {
|
|
|
118
117
|
</li>
|
|
119
118
|
</ul>
|
|
120
119
|
</nav>
|
|
121
|
-
<textarea
|
|
122
|
-
id=${x(this.uid)}
|
|
123
|
-
class=${y(e)}
|
|
124
|
-
style=${B(o)}
|
|
125
|
-
?required=${t.required}
|
|
126
|
-
?disabled=${t.disabled}
|
|
127
|
-
?readonly=${t.readonly}
|
|
128
|
-
placeholder=${x(t.placeholder)}
|
|
129
|
-
autocomplete=${this.autocomplete || $}
|
|
130
|
-
.value=${this.value || ""}
|
|
131
|
-
@input=${this.valueChanged}
|
|
132
|
-
@keyup=${this.detectFormats}
|
|
133
|
-
@mouseup=${this.detectFormats}
|
|
134
|
-
@blur=${this.onBlur}
|
|
135
|
-
></textarea>
|
|
136
120
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
121
|
+
<div class="gui-markdown__container">
|
|
122
|
+
<textarea
|
|
123
|
+
id=${x(this.uid)}
|
|
124
|
+
class=${y(e)}
|
|
125
|
+
style=${H(n)}
|
|
126
|
+
?required=${t.required}
|
|
127
|
+
?disabled=${t.disabled}
|
|
128
|
+
?readonly=${t.readonly}
|
|
129
|
+
placeholder=${x(t.placeholder)}
|
|
130
|
+
autocomplete=${this.autocomplete || $}
|
|
131
|
+
.value=${this.value || ""}
|
|
132
|
+
@input=${this.valueChanged}
|
|
133
|
+
@keyup=${this.detectFormats}
|
|
134
|
+
@mouseup=${this.detectFormats}
|
|
135
|
+
@blur=${this.onBlur}
|
|
136
|
+
></textarea>
|
|
137
|
+
|
|
138
|
+
${this.splitViewActive ? u`
|
|
139
|
+
<section
|
|
140
|
+
data-cy=${x(this.uid ? `${this.uid}_markdown` : $)}
|
|
141
|
+
class="gui-markdown__preview"
|
|
142
|
+
style=${H(n)}
|
|
143
|
+
>
|
|
144
|
+
<gui-markdown-text
|
|
145
|
+
.md=${this.value || ""}
|
|
146
|
+
.dependencies=${this.dependencies}
|
|
147
|
+
></gui-markdown-text>
|
|
148
|
+
</section>
|
|
149
|
+
` : $}
|
|
150
|
+
</div>
|
|
148
151
|
</div>
|
|
149
152
|
|
|
150
153
|
<div class="gui-markdown--validation">
|
|
151
|
-
<div>${
|
|
154
|
+
<div>${_(this.uid, t)}</div>
|
|
152
155
|
${i}
|
|
153
156
|
</div>
|
|
154
157
|
`;
|
|
@@ -157,7 +160,7 @@ let n = class extends H {
|
|
|
157
160
|
if (!this.autoGrow) return;
|
|
158
161
|
const t = this.querySelector(`textarea[id="${this.uid}"]`);
|
|
159
162
|
if (!t) return;
|
|
160
|
-
const e = window.getComputedStyle(t), i = parseFloat(e.paddingTop),
|
|
163
|
+
const e = window.getComputedStyle(t), i = parseFloat(e.paddingTop), n = parseFloat(e.paddingBottom), s = i + n;
|
|
161
164
|
t.style.height = "auto", t.style.height = `${Math.max(this.minimumHeight ?? 120, t.scrollHeight - s)}px`;
|
|
162
165
|
}
|
|
163
166
|
splitView() {
|
|
@@ -314,9 +317,9 @@ let n = class extends H {
|
|
|
314
317
|
detectFormats() {
|
|
315
318
|
const t = this.querySelector(`textarea[id="${this.uid}"]`);
|
|
316
319
|
if (!t) return;
|
|
317
|
-
const { selectionStart: e, value: i } = t,
|
|
320
|
+
const { selectionStart: e, value: i } = t, n = i.lastIndexOf(`
|
|
318
321
|
`, e - 1) + 1, s = i.indexOf(`
|
|
319
|
-
`, e), a = i.substring(
|
|
322
|
+
`, e), a = i.substring(n, s === -1 ? i.length : s);
|
|
320
323
|
this.activeFormats = {
|
|
321
324
|
heading: /^#{1,6}\s/.test(a),
|
|
322
325
|
bold: this.isInsideInlineFormat(i, e, "**"),
|
|
@@ -329,9 +332,9 @@ let n = class extends H {
|
|
|
329
332
|
};
|
|
330
333
|
}
|
|
331
334
|
isInsideInlineFormat(t, e, i) {
|
|
332
|
-
const
|
|
335
|
+
const n = t.lastIndexOf(`
|
|
333
336
|
`, e - 1) + 1, s = t.indexOf(`
|
|
334
|
-
`, e), a = t.substring(
|
|
337
|
+
`, e), a = t.substring(n, s === -1 ? t.length : s), d = e - n;
|
|
335
338
|
let h = 0;
|
|
336
339
|
for (; h < a.length; ) {
|
|
337
340
|
const g = a.indexOf(i, h);
|
|
@@ -346,8 +349,8 @@ let n = class extends H {
|
|
|
346
349
|
}
|
|
347
350
|
isInsideLink(t, e) {
|
|
348
351
|
const i = t.lastIndexOf(`
|
|
349
|
-
`, e - 1) + 1,
|
|
350
|
-
`, e), s = t.substring(i,
|
|
352
|
+
`, e - 1) + 1, n = t.indexOf(`
|
|
353
|
+
`, e), s = t.substring(i, n === -1 ? t.length : n), a = e - i, d = /\[[^\]]*\]\([^)]*\)/g;
|
|
351
354
|
let h;
|
|
352
355
|
for (; (h = d.exec(s)) !== null; )
|
|
353
356
|
if (a >= h.index && a <= h.index + h[0].length)
|
|
@@ -356,24 +359,24 @@ let n = class extends H {
|
|
|
356
359
|
}
|
|
357
360
|
applyFormat(t, e = "", i = "") {
|
|
358
361
|
return () => {
|
|
359
|
-
const
|
|
360
|
-
if (
|
|
362
|
+
const n = this.querySelector(`textarea[id="${this.uid}"]`);
|
|
363
|
+
if (n) {
|
|
361
364
|
if (i && this.activeFormats[i])
|
|
362
|
-
this.removeFormat(
|
|
365
|
+
this.removeFormat(n, t, e, i);
|
|
363
366
|
else {
|
|
364
|
-
const { selectionStart: s, selectionEnd: a, value: d } =
|
|
365
|
-
|
|
367
|
+
const { selectionStart: s, selectionEnd: a, value: d } = n, h = d.substring(s, a), g = d.substring(0, s), p = d.substring(a);
|
|
368
|
+
n.value = `${g}${t}${h}${e}${p}`, n.selectionStart = s + t.length, n.selectionEnd = s + t.length + h.length;
|
|
366
369
|
}
|
|
367
|
-
|
|
370
|
+
n.focus(), n.dispatchEvent(new Event("input", { bubbles: !0 })), this.detectFormats();
|
|
368
371
|
}
|
|
369
372
|
};
|
|
370
373
|
}
|
|
371
|
-
removeFormat(t, e, i,
|
|
374
|
+
removeFormat(t, e, i, n) {
|
|
372
375
|
const { selectionStart: s, value: a } = t, d = a.lastIndexOf(`
|
|
373
376
|
`, s - 1) + 1, h = a.indexOf(`
|
|
374
377
|
`, s), g = a.substring(d, h === -1 ? a.length : h);
|
|
375
378
|
if (i)
|
|
376
|
-
if (
|
|
379
|
+
if (n === "link") {
|
|
377
380
|
const p = s - d, w = /\[([^\]]*)\]\([^)]*\)/g;
|
|
378
381
|
let c;
|
|
379
382
|
for (; (c = w.exec(g)) !== null; )
|
|
@@ -391,8 +394,8 @@ let n = class extends H {
|
|
|
391
394
|
const v = g.indexOf(i, c + e.length);
|
|
392
395
|
if (v === -1) break;
|
|
393
396
|
if (p >= c && p <= v + i.length) {
|
|
394
|
-
const m = g.substring(c + e.length, v), b = d + c,
|
|
395
|
-
t.value = `${a.substring(0, b)}${m}${a.substring(
|
|
397
|
+
const m = g.substring(c + e.length, v), b = d + c, O = d + v + i.length;
|
|
398
|
+
t.value = `${a.substring(0, b)}${m}${a.substring(O)}`, t.selectionStart = b, t.selectionEnd = b + m.length;
|
|
396
399
|
break;
|
|
397
400
|
}
|
|
398
401
|
w = v + i.length;
|
|
@@ -400,10 +403,10 @@ let n = class extends H {
|
|
|
400
403
|
}
|
|
401
404
|
else {
|
|
402
405
|
let p = e;
|
|
403
|
-
if (
|
|
406
|
+
if (n === "heading") {
|
|
404
407
|
const m = g.match(/^#{1,6}\s/);
|
|
405
408
|
m && (p = m[0]);
|
|
406
|
-
} else if (
|
|
409
|
+
} else if (n === "orderedList") {
|
|
407
410
|
const m = g.match(/^\d+\.\s/);
|
|
408
411
|
m && (p = m[0]);
|
|
409
412
|
}
|
|
@@ -434,106 +437,106 @@ let n = class extends H {
|
|
|
434
437
|
};
|
|
435
438
|
r([
|
|
436
439
|
l({ type: String })
|
|
437
|
-
],
|
|
440
|
+
], o.prototype, "uid", 2);
|
|
438
441
|
r([
|
|
439
442
|
l({ type: String })
|
|
440
|
-
],
|
|
443
|
+
], o.prototype, "label", 2);
|
|
441
444
|
r([
|
|
442
445
|
l({ type: String, attribute: "locale-id" })
|
|
443
|
-
],
|
|
446
|
+
], o.prototype, "localeId", 2);
|
|
444
447
|
r([
|
|
445
448
|
l({ type: Array })
|
|
446
|
-
],
|
|
449
|
+
], o.prototype, "errors", 2);
|
|
447
450
|
r([
|
|
448
451
|
l({ type: Boolean })
|
|
449
|
-
],
|
|
452
|
+
], o.prototype, "touched", 2);
|
|
450
453
|
r([
|
|
451
454
|
l({ type: Boolean })
|
|
452
|
-
],
|
|
455
|
+
], o.prototype, "required", 2);
|
|
453
456
|
r([
|
|
454
457
|
l({ type: Boolean })
|
|
455
|
-
],
|
|
458
|
+
], o.prototype, "disabled", 2);
|
|
456
459
|
r([
|
|
457
460
|
l({ type: Boolean, attribute: "readonly" })
|
|
458
|
-
],
|
|
461
|
+
], o.prototype, "readOnly", 2);
|
|
459
462
|
r([
|
|
460
463
|
l({ type: String })
|
|
461
|
-
],
|
|
464
|
+
], o.prototype, "value", 2);
|
|
462
465
|
r([
|
|
463
466
|
l({ type: String })
|
|
464
|
-
],
|
|
467
|
+
], o.prototype, "hint", 2);
|
|
465
468
|
r([
|
|
466
469
|
l({ type: Array })
|
|
467
|
-
],
|
|
470
|
+
], o.prototype, "tools", 2);
|
|
468
471
|
r([
|
|
469
472
|
l({ type: String })
|
|
470
|
-
],
|
|
473
|
+
], o.prototype, "placeholder", 2);
|
|
471
474
|
r([
|
|
472
475
|
l({ type: String })
|
|
473
|
-
],
|
|
476
|
+
], o.prototype, "autocomplete", 2);
|
|
474
477
|
r([
|
|
475
478
|
l({ type: String, attribute: "countermode" })
|
|
476
|
-
],
|
|
479
|
+
], o.prototype, "counterMode", 2);
|
|
477
480
|
r([
|
|
478
481
|
l({ type: Number, attribute: "minimumheight" })
|
|
479
|
-
],
|
|
482
|
+
], o.prototype, "minimumHeight", 2);
|
|
480
483
|
r([
|
|
481
484
|
l({ type: Boolean, attribute: "autogrow" })
|
|
482
|
-
],
|
|
485
|
+
], o.prototype, "autoGrow", 2);
|
|
483
486
|
r([
|
|
484
487
|
l({ type: Boolean, attribute: "defaultopenpreview" })
|
|
485
|
-
],
|
|
488
|
+
], o.prototype, "defaultOpenPreview", 2);
|
|
486
489
|
r([
|
|
487
490
|
l({ type: Number, attribute: "maxlength" })
|
|
488
|
-
],
|
|
491
|
+
], o.prototype, "maxLength", 2);
|
|
489
492
|
r([
|
|
490
493
|
l({ type: String })
|
|
491
|
-
],
|
|
494
|
+
], o.prototype, "headingTitle", 2);
|
|
492
495
|
r([
|
|
493
496
|
l({ type: String })
|
|
494
|
-
],
|
|
497
|
+
], o.prototype, "boldTitle", 2);
|
|
495
498
|
r([
|
|
496
499
|
l({ type: String })
|
|
497
|
-
],
|
|
500
|
+
], o.prototype, "italicTitle", 2);
|
|
498
501
|
r([
|
|
499
502
|
l({ type: String })
|
|
500
|
-
],
|
|
503
|
+
], o.prototype, "strikethroughTitle", 2);
|
|
501
504
|
r([
|
|
502
505
|
l({ type: String })
|
|
503
|
-
],
|
|
506
|
+
], o.prototype, "quoteTitle", 2);
|
|
504
507
|
r([
|
|
505
508
|
l({ type: String })
|
|
506
|
-
],
|
|
509
|
+
], o.prototype, "linkTitle", 2);
|
|
507
510
|
r([
|
|
508
511
|
l({ type: String })
|
|
509
|
-
],
|
|
512
|
+
], o.prototype, "orderedListTitle", 2);
|
|
510
513
|
r([
|
|
511
514
|
l({ type: String })
|
|
512
|
-
],
|
|
515
|
+
], o.prototype, "unorderedListTitle", 2);
|
|
513
516
|
r([
|
|
514
517
|
l({ type: String })
|
|
515
|
-
],
|
|
518
|
+
], o.prototype, "splitViewTitle", 2);
|
|
516
519
|
r([
|
|
517
520
|
l({ type: Object })
|
|
518
|
-
],
|
|
521
|
+
], o.prototype, "dependencies", 2);
|
|
519
522
|
r([
|
|
520
|
-
|
|
521
|
-
],
|
|
523
|
+
A()
|
|
524
|
+
], o.prototype, "splitViewActive", 2);
|
|
522
525
|
r([
|
|
523
|
-
|
|
524
|
-
],
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
],
|
|
528
|
-
typeof customElements < "u" && !customElements.get("gui-markdown") && customElements.define("gui-markdown",
|
|
529
|
-
var E = Object.defineProperty, q = Object.getOwnPropertyDescriptor, k = (t, e, i,
|
|
530
|
-
for (var s =
|
|
531
|
-
(d = t[a]) && (s = (
|
|
532
|
-
return
|
|
526
|
+
A()
|
|
527
|
+
], o.prototype, "activeFormats", 2);
|
|
528
|
+
o = r([
|
|
529
|
+
C("gui-markdown")
|
|
530
|
+
], o);
|
|
531
|
+
typeof customElements < "u" && !customElements.get("gui-markdown") && customElements.define("gui-markdown", o);
|
|
532
|
+
var E = Object.defineProperty, q = Object.getOwnPropertyDescriptor, k = (t, e, i, n) => {
|
|
533
|
+
for (var s = n > 1 ? void 0 : n ? q(e, i) : e, a = t.length - 1, d; a >= 0; a--)
|
|
534
|
+
(d = t[a]) && (s = (n ? d(e, i, s) : d(s)) || s);
|
|
535
|
+
return n && s && E(e, i, s), s;
|
|
533
536
|
};
|
|
534
|
-
let f = class extends
|
|
537
|
+
let f = class extends L {
|
|
535
538
|
constructor() {
|
|
536
|
-
super(...arguments), this.adapter = new
|
|
539
|
+
super(...arguments), this.adapter = new S(), this.subscriptions = [];
|
|
537
540
|
}
|
|
538
541
|
createRenderRoot() {
|
|
539
542
|
return this;
|
|
@@ -583,14 +586,14 @@ let f = class extends H {
|
|
|
583
586
|
}
|
|
584
587
|
};
|
|
585
588
|
k([
|
|
586
|
-
|
|
589
|
+
B({ context: V }),
|
|
587
590
|
l({ attribute: !1 })
|
|
588
591
|
], f.prototype, "formContext", 2);
|
|
589
592
|
k([
|
|
590
|
-
F({ context:
|
|
593
|
+
F({ context: T })
|
|
591
594
|
], f.prototype, "adapter", 2);
|
|
592
595
|
f = k([
|
|
593
|
-
|
|
596
|
+
C("gui-markdown-input")
|
|
594
597
|
], f);
|
|
595
598
|
export {
|
|
596
599
|
f as MarkdownElement
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import { InputWidgetAdapter as
|
|
2
|
-
import "
|
|
3
|
-
import { LitElement as m, nothing as n, html as c } from "lit";
|
|
1
|
+
import { InputWidgetAdapter as v, formContext as y, inputContext as g } from "@golemui/lit";
|
|
2
|
+
import { LitElement as m, nothing as h, html as c } from "lit";
|
|
4
3
|
import { property as s, customElement as b } from "lit/decorators.js";
|
|
5
|
-
import { G as
|
|
4
|
+
import { G as f, b as w, c as $ } from "./templates-Dk1jxLwS.js";
|
|
6
5
|
import { styleMap as x } from "lit-html/directives/style-map.js";
|
|
7
6
|
import { consume as D, provide as C } from "@lit/context";
|
|
8
7
|
import "rxjs";
|
|
9
|
-
var N = Object.defineProperty,
|
|
10
|
-
for (var u = o > 1 ? void 0 : o ?
|
|
8
|
+
var N = Object.defineProperty, A = Object.getOwnPropertyDescriptor, r = (t, i, e, o) => {
|
|
9
|
+
for (var u = o > 1 ? void 0 : o ? A(i, e) : i, l = t.length - 1, p; l >= 0; l--)
|
|
11
10
|
(p = t[l]) && (u = (o ? p(i, e, u) : p(u)) || u);
|
|
12
11
|
return o && u && N(i, e, u), u;
|
|
13
12
|
};
|
|
14
13
|
let a = class extends m {
|
|
15
14
|
constructor() {
|
|
16
|
-
super(...arguments), this.uid = void 0, this.label = void 0, this.hint = void 0, this.localeId = "en", this.errors = [], this.touched = !1, this.required = !1, this.disabled = !1, this.readOnly = !1, this.value = void 0, this.step = void 0, this.placeholder = void 0, this.autocomplete = void 0, this.minimum = void 0, this.maximum = void 0, this.autoGrow = !1, this.ariaController = new
|
|
15
|
+
super(...arguments), this.uid = void 0, this.label = void 0, this.hint = void 0, this.localeId = "en", this.errors = [], this.touched = !1, this.required = !1, this.disabled = !1, this.readOnly = !1, this.value = void 0, this.step = void 0, this.placeholder = void 0, this.autocomplete = void 0, this.minimum = void 0, this.maximum = void 0, this.autoGrow = !1, this.ariaController = new f(this, {
|
|
17
16
|
getTargets: () => this.querySelectorAll(`input[id="${this.uid}"]`),
|
|
18
17
|
getState: () => ({
|
|
19
18
|
uid: this.uid,
|
|
@@ -60,19 +59,9 @@ let a = class extends m {
|
|
|
60
59
|
autocomplete: this.autocomplete
|
|
61
60
|
};
|
|
62
61
|
return c`
|
|
63
|
-
${
|
|
62
|
+
${w(this.uid, e)}
|
|
64
63
|
|
|
65
64
|
<div class="gui-widget">
|
|
66
|
-
<button
|
|
67
|
-
type="button"
|
|
68
|
-
tabindex="-1"
|
|
69
|
-
class="gui-button gui-number__minus"
|
|
70
|
-
?disabled=${this.value <= this.minimum || this.disabled}
|
|
71
|
-
@click=${this.minus}
|
|
72
|
-
>
|
|
73
|
-
-
|
|
74
|
-
</button>
|
|
75
|
-
|
|
76
65
|
<input
|
|
77
66
|
type="number"
|
|
78
67
|
inputmode="decimal"
|
|
@@ -84,26 +73,28 @@ let a = class extends m {
|
|
|
84
73
|
?required=${this.required}
|
|
85
74
|
?disabled=${this.disabled}
|
|
86
75
|
?readonly=${this.readOnly}
|
|
87
|
-
step=${typeof this.step == "number" ? this.step :
|
|
88
|
-
placeholder=${this.placeholder ||
|
|
89
|
-
autocomplete=${this.autocomplete ||
|
|
76
|
+
step=${typeof this.step == "number" ? this.step : h}
|
|
77
|
+
placeholder=${this.placeholder || h}
|
|
78
|
+
autocomplete=${this.autocomplete || h}
|
|
90
79
|
@input=${this.valueChanged}
|
|
91
80
|
@keydown=${this.keyDown}
|
|
92
81
|
@blur=${this.onBlur}
|
|
93
82
|
/>
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
83
|
+
<span class="gui-number__decoration">
|
|
84
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 256 256">
|
|
85
|
+
<path
|
|
86
|
+
d="M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z"
|
|
87
|
+
></path>
|
|
88
|
+
</svg>
|
|
89
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 256 256">
|
|
90
|
+
<path
|
|
91
|
+
d="M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"
|
|
92
|
+
></path>
|
|
93
|
+
</svg>
|
|
94
|
+
</span>
|
|
104
95
|
</div>
|
|
105
96
|
|
|
106
|
-
${
|
|
97
|
+
${$(this.uid, e)}
|
|
107
98
|
`;
|
|
108
99
|
}
|
|
109
100
|
keyDown(t) {
|
|
@@ -215,14 +206,14 @@ a = r([
|
|
|
215
206
|
b("gui-number")
|
|
216
207
|
], a);
|
|
217
208
|
typeof customElements < "u" && !customElements.get("gui-number") && customElements.define("gui-number", a);
|
|
218
|
-
var
|
|
209
|
+
var E = Object.defineProperty, O = Object.getOwnPropertyDescriptor, n = (t, i, e, o) => {
|
|
219
210
|
for (var u = o > 1 ? void 0 : o ? O(i, e) : i, l = t.length - 1, p; l >= 0; l--)
|
|
220
211
|
(p = t[l]) && (u = (o ? p(i, e, u) : p(u)) || u);
|
|
221
|
-
return o && u &&
|
|
212
|
+
return o && u && E(i, e, u), u;
|
|
222
213
|
};
|
|
223
214
|
let d = class extends m {
|
|
224
215
|
constructor() {
|
|
225
|
-
super(...arguments), this.adapter = new
|
|
216
|
+
super(...arguments), this.adapter = new v(), this.subscriptions = [];
|
|
226
217
|
}
|
|
227
218
|
createRenderRoot() {
|
|
228
219
|
return this;
|
|
@@ -268,14 +259,14 @@ let d = class extends m {
|
|
|
268
259
|
super.disconnectedCallback(), this.adapter.destroy(), this.subscriptions.forEach((t) => t.unsubscribe());
|
|
269
260
|
}
|
|
270
261
|
};
|
|
271
|
-
|
|
272
|
-
D({ context:
|
|
262
|
+
n([
|
|
263
|
+
D({ context: y }),
|
|
273
264
|
s({ attribute: !1 })
|
|
274
265
|
], d.prototype, "formContext", 2);
|
|
275
|
-
|
|
276
|
-
C({ context:
|
|
266
|
+
n([
|
|
267
|
+
C({ context: g })
|
|
277
268
|
], d.prototype, "adapter", 2);
|
|
278
|
-
d =
|
|
269
|
+
d = n([
|
|
279
270
|
b("gui-number-input")
|
|
280
271
|
], d);
|
|
281
272
|
export {
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import "@golemui/core";
|
|
2
|
+
import "./index.js";
|
|
3
|
+
const i = (e) => e !== null && typeof e == "object" && Object.prototype.hasOwnProperty.call(e, "label") && Object.prototype.hasOwnProperty.call(e, "value");
|
|
4
|
+
function s(e) {
|
|
3
5
|
const r = typeof e;
|
|
4
6
|
return r === "string" || r === "number";
|
|
5
7
|
}
|
|
6
8
|
function b(e, r) {
|
|
7
9
|
return r.find((t) => t.value.toString() === e)?.value;
|
|
8
10
|
}
|
|
9
|
-
const
|
|
10
|
-
if (Array.isArray(e) && e.length > 0 && !
|
|
11
|
-
if (
|
|
11
|
+
const O = (e, r) => {
|
|
12
|
+
if (Array.isArray(e) && e.length > 0 && !i(e[0])) {
|
|
13
|
+
if (s(e[0]))
|
|
12
14
|
return e.map((t) => ({
|
|
13
15
|
label: t.toString(),
|
|
14
16
|
value: t
|
|
@@ -32,17 +34,17 @@ function f(e, { labelField: r, valueField: t }) {
|
|
|
32
34
|
const n = e, o = r && Object.prototype.hasOwnProperty.call(n, r) ? r : void 0, a = t && Object.prototype.hasOwnProperty.call(n, t) ? t : void 0;
|
|
33
35
|
if (!o && !a)
|
|
34
36
|
throw new Error("Neither labelField nor valueField exists on the object");
|
|
35
|
-
return (
|
|
36
|
-
if (
|
|
37
|
+
return (l) => {
|
|
38
|
+
if (l === null || typeof l != "object")
|
|
37
39
|
throw new Error("Item is not an object");
|
|
38
|
-
const
|
|
40
|
+
const c = l;
|
|
39
41
|
return {
|
|
40
|
-
label: o ?
|
|
41
|
-
value: a ?
|
|
42
|
+
label: o ? c[o] : "",
|
|
43
|
+
value: a ? c[a] : ""
|
|
42
44
|
};
|
|
43
45
|
};
|
|
44
46
|
}
|
|
45
47
|
export {
|
|
46
48
|
b as i,
|
|
47
|
-
|
|
49
|
+
O as u
|
|
48
50
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@golemui/gui-lit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-rc.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.umd.cjs",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"*.md"
|
|
22
22
|
],
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"@golemui/lit": "0.
|
|
25
|
-
"@golemui/core": "0.
|
|
26
|
-
"@golemui/gui-components": "0.
|
|
27
|
-
"@golemui/gui-shared": "0.
|
|
28
|
-
"@golemui/gui-validators": "0.
|
|
24
|
+
"@golemui/lit": "1.0.0-rc.0",
|
|
25
|
+
"@golemui/core": "1.0.0-rc.0",
|
|
26
|
+
"@golemui/gui-components": "1.0.0-rc.0",
|
|
27
|
+
"@golemui/gui-shared": "1.0.0-rc.0",
|
|
28
|
+
"@golemui/gui-validators": "1.0.0-rc.0",
|
|
29
29
|
"@lit/context": "^1.1.6",
|
|
30
30
|
"lit-html": "^3.3.1",
|
|
31
31
|
"lit": "^3.3.1",
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { InputWidgetAdapter as m, formContext as y, inputContext as P } from "@golemui/lit";
|
|
2
|
-
import "@golemui/gui-shared";
|
|
3
2
|
import { LitElement as w, nothing as n, html as u } from "lit";
|
|
4
3
|
import { property as o, state as g, customElement as b } from "lit/decorators.js";
|
|
5
4
|
import { classMap as v } from "lit/directives/class-map.js";
|
|
@@ -45,8 +45,7 @@ let r = class extends m {
|
|
|
45
45
|
render() {
|
|
46
46
|
const e = this.items.length;
|
|
47
47
|
return e === 0 ? p : d`
|
|
48
|
-
${this.renderStrip()}
|
|
49
|
-
${this.bubble ? this.renderCompact(e) : p}
|
|
48
|
+
${this.renderStrip()} ${this.bubble ? this.renderCompact(e) : p}
|
|
50
49
|
${this.bubble && this._showDropdown ? this.renderDropdown() : p}
|
|
51
50
|
`;
|
|
52
51
|
}
|
|
@@ -135,7 +134,10 @@ let r = class extends m {
|
|
|
135
134
|
t.stopPropagation(), this.emitRemove(e.key, this.items.indexOf(e));
|
|
136
135
|
}}
|
|
137
136
|
>
|
|
138
|
-
${this.removeIcon ? d`<span
|
|
137
|
+
${this.removeIcon ? d`<span
|
|
138
|
+
class=${`gui-widget-icon ${this.removeIcon}`}
|
|
139
|
+
data-icon=${this.removeIcon}
|
|
140
|
+
></span>` : d`<svg
|
|
139
141
|
xmlns="http://www.w3.org/2000/svg"
|
|
140
142
|
width="16"
|
|
141
143
|
height="16"
|
|
@@ -243,9 +245,7 @@ let r = class extends m {
|
|
|
243
245
|
composed: !0
|
|
244
246
|
})
|
|
245
247
|
), requestAnimationFrame(() => {
|
|
246
|
-
this.addOutsideListeners(), this.querySelector(
|
|
247
|
-
".gui-pills__dropdown .gui-pills__pill"
|
|
248
|
-
)?.focus();
|
|
248
|
+
this.addOutsideListeners(), this.querySelector(".gui-pills__dropdown .gui-pills__pill")?.focus();
|
|
249
249
|
}));
|
|
250
250
|
}
|
|
251
251
|
closeDropdown() {
|