@cal.macconnachie/web-components 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,921 +0,0 @@
1
- const k = globalThis, D = k.ShadowRoot && (k.ShadyCSS === void 0 || k.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, L = Symbol(), G = /* @__PURE__ */ new WeakMap();
2
- let ot = class {
3
- constructor(t, e, r) {
4
- if (this._$cssResult$ = !0, r !== L) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
5
- this.cssText = t, this.t = e;
6
- }
7
- get styleSheet() {
8
- let t = this.o;
9
- const e = this.t;
10
- if (D && t === void 0) {
11
- const r = e !== void 0 && e.length === 1;
12
- r && (t = G.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), r && G.set(e, t));
13
- }
14
- return t;
15
- }
16
- toString() {
17
- return this.cssText;
18
- }
19
- };
20
- const dt = (i) => new ot(typeof i == "string" ? i : i + "", void 0, L), pt = (i, ...t) => {
21
- const e = i.length === 1 ? i[0] : t.reduce(((r, s, o) => r + ((n) => {
22
- if (n._$cssResult$ === !0) return n.cssText;
23
- if (typeof n == "number") return n;
24
- throw Error("Value passed to 'css' function must be a 'css' function result: " + n + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
25
- })(s) + i[o + 1]), i[0]);
26
- return new ot(e, i, L);
27
- }, ut = (i, t) => {
28
- if (D) i.adoptedStyleSheets = t.map(((e) => e instanceof CSSStyleSheet ? e : e.styleSheet));
29
- else for (const e of t) {
30
- const r = document.createElement("style"), s = k.litNonce;
31
- s !== void 0 && r.setAttribute("nonce", s), r.textContent = e.cssText, i.appendChild(r);
32
- }
33
- }, J = D ? (i) => i : (i) => i instanceof CSSStyleSheet ? ((t) => {
34
- let e = "";
35
- for (const r of t.cssRules) e += r.cssText;
36
- return dt(e);
37
- })(i) : i;
38
- const { is: $t, defineProperty: mt, getOwnPropertyDescriptor: ft, getOwnPropertyNames: gt, getOwnPropertySymbols: vt, getPrototypeOf: bt } = Object, R = globalThis, Z = R.trustedTypes, _t = Z ? Z.emptyScript : "", yt = R.reactiveElementPolyfillSupport, C = (i, t) => i, H = { toAttribute(i, t) {
39
- switch (t) {
40
- case Boolean:
41
- i = i ? _t : null;
42
- break;
43
- case Object:
44
- case Array:
45
- i = i == null ? i : JSON.stringify(i);
46
- }
47
- return i;
48
- }, fromAttribute(i, t) {
49
- let e = i;
50
- switch (t) {
51
- case Boolean:
52
- e = i !== null;
53
- break;
54
- case Number:
55
- e = i === null ? null : Number(i);
56
- break;
57
- case Object:
58
- case Array:
59
- try {
60
- e = JSON.parse(i);
61
- } catch {
62
- e = null;
63
- }
64
- }
65
- return e;
66
- } }, q = (i, t) => !$t(i, t), Q = { attribute: !0, type: String, converter: H, reflect: !1, useDefault: !1, hasChanged: q };
67
- Symbol.metadata ??= Symbol("metadata"), R.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
68
- let w = class extends HTMLElement {
69
- static addInitializer(t) {
70
- this._$Ei(), (this.l ??= []).push(t);
71
- }
72
- static get observedAttributes() {
73
- return this.finalize(), this._$Eh && [...this._$Eh.keys()];
74
- }
75
- static createProperty(t, e = Q) {
76
- if (e.state && (e.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(t) && ((e = Object.create(e)).wrapped = !0), this.elementProperties.set(t, e), !e.noAccessor) {
77
- const r = Symbol(), s = this.getPropertyDescriptor(t, r, e);
78
- s !== void 0 && mt(this.prototype, t, s);
79
- }
80
- }
81
- static getPropertyDescriptor(t, e, r) {
82
- const { get: s, set: o } = ft(this.prototype, t) ?? { get() {
83
- return this[e];
84
- }, set(n) {
85
- this[e] = n;
86
- } };
87
- return { get: s, set(n) {
88
- const h = s?.call(this);
89
- o?.call(this, n), this.requestUpdate(t, h, r);
90
- }, configurable: !0, enumerable: !0 };
91
- }
92
- static getPropertyOptions(t) {
93
- return this.elementProperties.get(t) ?? Q;
94
- }
95
- static _$Ei() {
96
- if (this.hasOwnProperty(C("elementProperties"))) return;
97
- const t = bt(this);
98
- t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
99
- }
100
- static finalize() {
101
- if (this.hasOwnProperty(C("finalized"))) return;
102
- if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(C("properties"))) {
103
- const e = this.properties, r = [...gt(e), ...vt(e)];
104
- for (const s of r) this.createProperty(s, e[s]);
105
- }
106
- const t = this[Symbol.metadata];
107
- if (t !== null) {
108
- const e = litPropertyMetadata.get(t);
109
- if (e !== void 0) for (const [r, s] of e) this.elementProperties.set(r, s);
110
- }
111
- this._$Eh = /* @__PURE__ */ new Map();
112
- for (const [e, r] of this.elementProperties) {
113
- const s = this._$Eu(e, r);
114
- s !== void 0 && this._$Eh.set(s, e);
115
- }
116
- this.elementStyles = this.finalizeStyles(this.styles);
117
- }
118
- static finalizeStyles(t) {
119
- const e = [];
120
- if (Array.isArray(t)) {
121
- const r = new Set(t.flat(1 / 0).reverse());
122
- for (const s of r) e.unshift(J(s));
123
- } else t !== void 0 && e.push(J(t));
124
- return e;
125
- }
126
- static _$Eu(t, e) {
127
- const r = e.attribute;
128
- return r === !1 ? void 0 : typeof r == "string" ? r : typeof t == "string" ? t.toLowerCase() : void 0;
129
- }
130
- constructor() {
131
- super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
132
- }
133
- _$Ev() {
134
- this._$ES = new Promise(((t) => this.enableUpdating = t)), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach(((t) => t(this)));
135
- }
136
- addController(t) {
137
- (this._$EO ??= /* @__PURE__ */ new Set()).add(t), this.renderRoot !== void 0 && this.isConnected && t.hostConnected?.();
138
- }
139
- removeController(t) {
140
- this._$EO?.delete(t);
141
- }
142
- _$E_() {
143
- const t = /* @__PURE__ */ new Map(), e = this.constructor.elementProperties;
144
- for (const r of e.keys()) this.hasOwnProperty(r) && (t.set(r, this[r]), delete this[r]);
145
- t.size > 0 && (this._$Ep = t);
146
- }
147
- createRenderRoot() {
148
- const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
149
- return ut(t, this.constructor.elementStyles), t;
150
- }
151
- connectedCallback() {
152
- this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach(((t) => t.hostConnected?.()));
153
- }
154
- enableUpdating(t) {
155
- }
156
- disconnectedCallback() {
157
- this._$EO?.forEach(((t) => t.hostDisconnected?.()));
158
- }
159
- attributeChangedCallback(t, e, r) {
160
- this._$AK(t, r);
161
- }
162
- _$ET(t, e) {
163
- const r = this.constructor.elementProperties.get(t), s = this.constructor._$Eu(t, r);
164
- if (s !== void 0 && r.reflect === !0) {
165
- const o = (r.converter?.toAttribute !== void 0 ? r.converter : H).toAttribute(e, r.type);
166
- this._$Em = t, o == null ? this.removeAttribute(s) : this.setAttribute(s, o), this._$Em = null;
167
- }
168
- }
169
- _$AK(t, e) {
170
- const r = this.constructor, s = r._$Eh.get(t);
171
- if (s !== void 0 && this._$Em !== s) {
172
- const o = r.getPropertyOptions(s), n = typeof o.converter == "function" ? { fromAttribute: o.converter } : o.converter?.fromAttribute !== void 0 ? o.converter : H;
173
- this._$Em = s;
174
- const h = n.fromAttribute(e, o.type);
175
- this[s] = h ?? this._$Ej?.get(s) ?? h, this._$Em = null;
176
- }
177
- }
178
- requestUpdate(t, e, r) {
179
- if (t !== void 0) {
180
- const s = this.constructor, o = this[t];
181
- if (r ??= s.getPropertyOptions(t), !((r.hasChanged ?? q)(o, e) || r.useDefault && r.reflect && o === this._$Ej?.get(t) && !this.hasAttribute(s._$Eu(t, r)))) return;
182
- this.C(t, e, r);
183
- }
184
- this.isUpdatePending === !1 && (this._$ES = this._$EP());
185
- }
186
- C(t, e, { useDefault: r, reflect: s, wrapped: o }, n) {
187
- r && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(t) && (this._$Ej.set(t, n ?? e ?? this[t]), o !== !0 || n !== void 0) || (this._$AL.has(t) || (this.hasUpdated || r || (e = void 0), this._$AL.set(t, e)), s === !0 && this._$Em !== t && (this._$Eq ??= /* @__PURE__ */ new Set()).add(t));
188
- }
189
- async _$EP() {
190
- this.isUpdatePending = !0;
191
- try {
192
- await this._$ES;
193
- } catch (e) {
194
- Promise.reject(e);
195
- }
196
- const t = this.scheduleUpdate();
197
- return t != null && await t, !this.isUpdatePending;
198
- }
199
- scheduleUpdate() {
200
- return this.performUpdate();
201
- }
202
- performUpdate() {
203
- if (!this.isUpdatePending) return;
204
- if (!this.hasUpdated) {
205
- if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
206
- for (const [s, o] of this._$Ep) this[s] = o;
207
- this._$Ep = void 0;
208
- }
209
- const r = this.constructor.elementProperties;
210
- if (r.size > 0) for (const [s, o] of r) {
211
- const { wrapped: n } = o, h = this[s];
212
- n !== !0 || this._$AL.has(s) || h === void 0 || this.C(s, void 0, o, h);
213
- }
214
- }
215
- let t = !1;
216
- const e = this._$AL;
217
- try {
218
- t = this.shouldUpdate(e), t ? (this.willUpdate(e), this._$EO?.forEach(((r) => r.hostUpdate?.())), this.update(e)) : this._$EM();
219
- } catch (r) {
220
- throw t = !1, this._$EM(), r;
221
- }
222
- t && this._$AE(e);
223
- }
224
- willUpdate(t) {
225
- }
226
- _$AE(t) {
227
- this._$EO?.forEach(((e) => e.hostUpdated?.())), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(t)), this.updated(t);
228
- }
229
- _$EM() {
230
- this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
231
- }
232
- get updateComplete() {
233
- return this.getUpdateComplete();
234
- }
235
- getUpdateComplete() {
236
- return this._$ES;
237
- }
238
- shouldUpdate(t) {
239
- return !0;
240
- }
241
- update(t) {
242
- this._$Eq &&= this._$Eq.forEach(((e) => this._$ET(e, this[e]))), this._$EM();
243
- }
244
- updated(t) {
245
- }
246
- firstUpdated(t) {
247
- }
248
- };
249
- w.elementStyles = [], w.shadowRootOptions = { mode: "open" }, w[C("elementProperties")] = /* @__PURE__ */ new Map(), w[C("finalized")] = /* @__PURE__ */ new Map(), yt?.({ ReactiveElement: w }), (R.reactiveElementVersions ??= []).push("2.1.1");
250
- const V = globalThis, N = V.trustedTypes, X = N ? N.createPolicy("lit-html", { createHTML: (i) => i }) : void 0, nt = "$lit$", v = `lit$${Math.random().toFixed(9).slice(2)}$`, at = "?" + v, At = `<${at}>`, y = document, T = () => y.createComment(""), z = (i) => i === null || typeof i != "object" && typeof i != "function", W = Array.isArray, xt = (i) => W(i) || typeof i?.[Symbol.iterator] == "function", I = `[
251
- \f\r]`, S = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Y = /-->/g, tt = />/g, b = RegExp(`>|${I}(?:([^\\s"'>=/]+)(${I}*=${I}*(?:[^
252
- \f\r"'\`<>=]|("|')|))|$)`, "g"), et = /'/g, rt = /"/g, ht = /^(?:script|style|textarea|title)$/i, wt = (i) => (t, ...e) => ({ _$litType$: i, strings: t, values: e }), x = wt(1), A = Symbol.for("lit-noChange"), c = Symbol.for("lit-nothing"), st = /* @__PURE__ */ new WeakMap(), _ = y.createTreeWalker(y, 129);
253
- function lt(i, t) {
254
- if (!W(i) || !i.hasOwnProperty("raw")) throw Error("invalid template strings array");
255
- return X !== void 0 ? X.createHTML(t) : t;
256
- }
257
- const Et = (i, t) => {
258
- const e = i.length - 1, r = [];
259
- let s, o = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", n = S;
260
- for (let h = 0; h < e; h++) {
261
- const a = i[h];
262
- let d, p, l = -1, f = 0;
263
- for (; f < a.length && (n.lastIndex = f, p = n.exec(a), p !== null); ) f = n.lastIndex, n === S ? p[1] === "!--" ? n = Y : p[1] !== void 0 ? n = tt : p[2] !== void 0 ? (ht.test(p[2]) && (s = RegExp("</" + p[2], "g")), n = b) : p[3] !== void 0 && (n = b) : n === b ? p[0] === ">" ? (n = s ?? S, l = -1) : p[1] === void 0 ? l = -2 : (l = n.lastIndex - p[2].length, d = p[1], n = p[3] === void 0 ? b : p[3] === '"' ? rt : et) : n === rt || n === et ? n = b : n === Y || n === tt ? n = S : (n = b, s = void 0);
264
- const g = n === b && i[h + 1].startsWith("/>") ? " " : "";
265
- o += n === S ? a + At : l >= 0 ? (r.push(d), a.slice(0, l) + nt + a.slice(l) + v + g) : a + v + (l === -2 ? h : g);
266
- }
267
- return [lt(i, o + (i[e] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), r];
268
- };
269
- class O {
270
- constructor({ strings: t, _$litType$: e }, r) {
271
- let s;
272
- this.parts = [];
273
- let o = 0, n = 0;
274
- const h = t.length - 1, a = this.parts, [d, p] = Et(t, e);
275
- if (this.el = O.createElement(d, r), _.currentNode = this.el.content, e === 2 || e === 3) {
276
- const l = this.el.content.firstChild;
277
- l.replaceWith(...l.childNodes);
278
- }
279
- for (; (s = _.nextNode()) !== null && a.length < h; ) {
280
- if (s.nodeType === 1) {
281
- if (s.hasAttributes()) for (const l of s.getAttributeNames()) if (l.endsWith(nt)) {
282
- const f = p[n++], g = s.getAttribute(l).split(v), M = /([.?@])?(.*)/.exec(f);
283
- a.push({ type: 1, index: o, name: M[2], strings: g, ctor: M[1] === "." ? Ct : M[1] === "?" ? Pt : M[1] === "@" ? Tt : j }), s.removeAttribute(l);
284
- } else l.startsWith(v) && (a.push({ type: 6, index: o }), s.removeAttribute(l));
285
- if (ht.test(s.tagName)) {
286
- const l = s.textContent.split(v), f = l.length - 1;
287
- if (f > 0) {
288
- s.textContent = N ? N.emptyScript : "";
289
- for (let g = 0; g < f; g++) s.append(l[g], T()), _.nextNode(), a.push({ type: 2, index: ++o });
290
- s.append(l[f], T());
291
- }
292
- }
293
- } else if (s.nodeType === 8) if (s.data === at) a.push({ type: 2, index: o });
294
- else {
295
- let l = -1;
296
- for (; (l = s.data.indexOf(v, l + 1)) !== -1; ) a.push({ type: 7, index: o }), l += v.length - 1;
297
- }
298
- o++;
299
- }
300
- }
301
- static createElement(t, e) {
302
- const r = y.createElement("template");
303
- return r.innerHTML = t, r;
304
- }
305
- }
306
- function E(i, t, e = i, r) {
307
- if (t === A) return t;
308
- let s = r !== void 0 ? e._$Co?.[r] : e._$Cl;
309
- const o = z(t) ? void 0 : t._$litDirective$;
310
- return s?.constructor !== o && (s?._$AO?.(!1), o === void 0 ? s = void 0 : (s = new o(i), s._$AT(i, e, r)), r !== void 0 ? (e._$Co ??= [])[r] = s : e._$Cl = s), s !== void 0 && (t = E(i, s._$AS(i, t.values), s, r)), t;
311
- }
312
- class St {
313
- constructor(t, e) {
314
- this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = e;
315
- }
316
- get parentNode() {
317
- return this._$AM.parentNode;
318
- }
319
- get _$AU() {
320
- return this._$AM._$AU;
321
- }
322
- u(t) {
323
- const { el: { content: e }, parts: r } = this._$AD, s = (t?.creationScope ?? y).importNode(e, !0);
324
- _.currentNode = s;
325
- let o = _.nextNode(), n = 0, h = 0, a = r[0];
326
- for (; a !== void 0; ) {
327
- if (n === a.index) {
328
- let d;
329
- a.type === 2 ? d = new U(o, o.nextSibling, this, t) : a.type === 1 ? d = new a.ctor(o, a.name, a.strings, this, t) : a.type === 6 && (d = new zt(o, this, t)), this._$AV.push(d), a = r[++h];
330
- }
331
- n !== a?.index && (o = _.nextNode(), n++);
332
- }
333
- return _.currentNode = y, s;
334
- }
335
- p(t) {
336
- let e = 0;
337
- for (const r of this._$AV) r !== void 0 && (r.strings !== void 0 ? (r._$AI(t, r, e), e += r.strings.length - 2) : r._$AI(t[e])), e++;
338
- }
339
- }
340
- class U {
341
- get _$AU() {
342
- return this._$AM?._$AU ?? this._$Cv;
343
- }
344
- constructor(t, e, r, s) {
345
- this.type = 2, this._$AH = c, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = r, this.options = s, this._$Cv = s?.isConnected ?? !0;
346
- }
347
- get parentNode() {
348
- let t = this._$AA.parentNode;
349
- const e = this._$AM;
350
- return e !== void 0 && t?.nodeType === 11 && (t = e.parentNode), t;
351
- }
352
- get startNode() {
353
- return this._$AA;
354
- }
355
- get endNode() {
356
- return this._$AB;
357
- }
358
- _$AI(t, e = this) {
359
- t = E(this, t, e), z(t) ? t === c || t == null || t === "" ? (this._$AH !== c && this._$AR(), this._$AH = c) : t !== this._$AH && t !== A && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : xt(t) ? this.k(t) : this._(t);
360
- }
361
- O(t) {
362
- return this._$AA.parentNode.insertBefore(t, this._$AB);
363
- }
364
- T(t) {
365
- this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
366
- }
367
- _(t) {
368
- this._$AH !== c && z(this._$AH) ? this._$AA.nextSibling.data = t : this.T(y.createTextNode(t)), this._$AH = t;
369
- }
370
- $(t) {
371
- const { values: e, _$litType$: r } = t, s = typeof r == "number" ? this._$AC(t) : (r.el === void 0 && (r.el = O.createElement(lt(r.h, r.h[0]), this.options)), r);
372
- if (this._$AH?._$AD === s) this._$AH.p(e);
373
- else {
374
- const o = new St(s, this), n = o.u(this.options);
375
- o.p(e), this.T(n), this._$AH = o;
376
- }
377
- }
378
- _$AC(t) {
379
- let e = st.get(t.strings);
380
- return e === void 0 && st.set(t.strings, e = new O(t)), e;
381
- }
382
- k(t) {
383
- W(this._$AH) || (this._$AH = [], this._$AR());
384
- const e = this._$AH;
385
- let r, s = 0;
386
- for (const o of t) s === e.length ? e.push(r = new U(this.O(T()), this.O(T()), this, this.options)) : r = e[s], r._$AI(o), s++;
387
- s < e.length && (this._$AR(r && r._$AB.nextSibling, s), e.length = s);
388
- }
389
- _$AR(t = this._$AA.nextSibling, e) {
390
- for (this._$AP?.(!1, !0, e); t !== this._$AB; ) {
391
- const r = t.nextSibling;
392
- t.remove(), t = r;
393
- }
394
- }
395
- setConnected(t) {
396
- this._$AM === void 0 && (this._$Cv = t, this._$AP?.(t));
397
- }
398
- }
399
- class j {
400
- get tagName() {
401
- return this.element.tagName;
402
- }
403
- get _$AU() {
404
- return this._$AM._$AU;
405
- }
406
- constructor(t, e, r, s, o) {
407
- this.type = 1, this._$AH = c, this._$AN = void 0, this.element = t, this.name = e, this._$AM = s, this.options = o, r.length > 2 || r[0] !== "" || r[1] !== "" ? (this._$AH = Array(r.length - 1).fill(new String()), this.strings = r) : this._$AH = c;
408
- }
409
- _$AI(t, e = this, r, s) {
410
- const o = this.strings;
411
- let n = !1;
412
- if (o === void 0) t = E(this, t, e, 0), n = !z(t) || t !== this._$AH && t !== A, n && (this._$AH = t);
413
- else {
414
- const h = t;
415
- let a, d;
416
- for (t = o[0], a = 0; a < o.length - 1; a++) d = E(this, h[r + a], e, a), d === A && (d = this._$AH[a]), n ||= !z(d) || d !== this._$AH[a], d === c ? t = c : t !== c && (t += (d ?? "") + o[a + 1]), this._$AH[a] = d;
417
- }
418
- n && !s && this.j(t);
419
- }
420
- j(t) {
421
- t === c ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
422
- }
423
- }
424
- class Ct extends j {
425
- constructor() {
426
- super(...arguments), this.type = 3;
427
- }
428
- j(t) {
429
- this.element[this.name] = t === c ? void 0 : t;
430
- }
431
- }
432
- class Pt extends j {
433
- constructor() {
434
- super(...arguments), this.type = 4;
435
- }
436
- j(t) {
437
- this.element.toggleAttribute(this.name, !!t && t !== c);
438
- }
439
- }
440
- class Tt extends j {
441
- constructor(t, e, r, s, o) {
442
- super(t, e, r, s, o), this.type = 5;
443
- }
444
- _$AI(t, e = this) {
445
- if ((t = E(this, t, e, 0) ?? c) === A) return;
446
- const r = this._$AH, s = t === c && r !== c || t.capture !== r.capture || t.once !== r.once || t.passive !== r.passive, o = t !== c && (r === c || s);
447
- s && this.element.removeEventListener(this.name, this, r), o && this.element.addEventListener(this.name, this, t), this._$AH = t;
448
- }
449
- handleEvent(t) {
450
- typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, t) : this._$AH.handleEvent(t);
451
- }
452
- }
453
- class zt {
454
- constructor(t, e, r) {
455
- this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = r;
456
- }
457
- get _$AU() {
458
- return this._$AM._$AU;
459
- }
460
- _$AI(t) {
461
- E(this, t);
462
- }
463
- }
464
- const Ot = V.litHtmlPolyfillSupport;
465
- Ot?.(O, U), (V.litHtmlVersions ??= []).push("3.3.1");
466
- const Ut = (i, t, e) => {
467
- const r = e?.renderBefore ?? t;
468
- let s = r._$litPart$;
469
- if (s === void 0) {
470
- const o = e?.renderBefore ?? null;
471
- r._$litPart$ = s = new U(t.insertBefore(T(), o), o, void 0, e ?? {});
472
- }
473
- return s._$AI(i), s;
474
- };
475
- const K = globalThis;
476
- let P = class extends w {
477
- constructor() {
478
- super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
479
- }
480
- createRenderRoot() {
481
- const t = super.createRenderRoot();
482
- return this.renderOptions.renderBefore ??= t.firstChild, t;
483
- }
484
- update(t) {
485
- const e = this.render();
486
- this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = Ut(e, this.renderRoot, this.renderOptions);
487
- }
488
- connectedCallback() {
489
- super.connectedCallback(), this._$Do?.setConnected(!0);
490
- }
491
- disconnectedCallback() {
492
- super.disconnectedCallback(), this._$Do?.setConnected(!1);
493
- }
494
- render() {
495
- return A;
496
- }
497
- };
498
- P._$litElement$ = !0, P.finalized = !0, K.litElementHydrateSupport?.({ LitElement: P });
499
- const Mt = K.litElementPolyfillSupport;
500
- Mt?.({ LitElement: P });
501
- (K.litElementVersions ??= []).push("4.2.1");
502
- const kt = (i) => (t, e) => {
503
- e !== void 0 ? e.addInitializer((() => {
504
- customElements.define(i, t);
505
- })) : customElements.define(i, t);
506
- };
507
- const Ht = { attribute: !0, type: String, converter: H, reflect: !1, hasChanged: q }, Nt = (i = Ht, t, e) => {
508
- const { kind: r, metadata: s } = e;
509
- let o = globalThis.litPropertyMetadata.get(s);
510
- if (o === void 0 && globalThis.litPropertyMetadata.set(s, o = /* @__PURE__ */ new Map()), r === "setter" && ((i = Object.create(i)).wrapped = !0), o.set(e.name, i), r === "accessor") {
511
- const { name: n } = e;
512
- return { set(h) {
513
- const a = t.get.call(this);
514
- t.set.call(this, h), this.requestUpdate(n, a, i);
515
- }, init(h) {
516
- return h !== void 0 && this.C(n, void 0, i, h), h;
517
- } };
518
- }
519
- if (r === "setter") {
520
- const { name: n } = e;
521
- return function(h) {
522
- const a = this[n];
523
- t.call(this, h), this.requestUpdate(n, a, i);
524
- };
525
- }
526
- throw Error("Unsupported decorator location: " + r);
527
- };
528
- function $(i) {
529
- return (t, e) => typeof e == "object" ? Nt(i, t, e) : ((r, s, o) => {
530
- const n = s.hasOwnProperty(o);
531
- return s.constructor.createProperty(o, r), n ? Object.getOwnPropertyDescriptor(s, o) : void 0;
532
- })(i, t, e);
533
- }
534
- const Rt = (i, t, e) => (e.configurable = !0, e.enumerable = !0, Reflect.decorate && typeof t != "object" && Object.defineProperty(i, t, e), e);
535
- function jt(i, t) {
536
- return (e, r, s) => {
537
- const o = (n) => n.renderRoot?.querySelector(i) ?? null;
538
- return Rt(e, r, { get() {
539
- return o(this);
540
- } });
541
- };
542
- }
543
- const It = { ATTRIBUTE: 1 }, Bt = (i) => (...t) => ({ _$litDirective$: i, values: t });
544
- class Dt {
545
- constructor(t) {
546
- }
547
- get _$AU() {
548
- return this._$AM._$AU;
549
- }
550
- _$AT(t, e, r) {
551
- this._$Ct = t, this._$AM = e, this._$Ci = r;
552
- }
553
- _$AS(t, e) {
554
- return this.update(t, e);
555
- }
556
- update(t, e) {
557
- return this.render(...e);
558
- }
559
- }
560
- const it = Bt(class extends Dt {
561
- constructor(i) {
562
- if (super(i), i.type !== It.ATTRIBUTE || i.name !== "class" || i.strings?.length > 2) throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.");
563
- }
564
- render(i) {
565
- return " " + Object.keys(i).filter(((t) => i[t])).join(" ") + " ";
566
- }
567
- update(i, [t]) {
568
- if (this.st === void 0) {
569
- this.st = /* @__PURE__ */ new Set(), i.strings !== void 0 && (this.nt = new Set(i.strings.join(" ").split(/\s/).filter(((r) => r !== ""))));
570
- for (const r in t) t[r] && !this.nt?.has(r) && this.st.add(r);
571
- return this.render(t);
572
- }
573
- const e = i.element.classList;
574
- for (const r of this.st) r in t || (e.remove(r), this.st.delete(r));
575
- for (const r in t) {
576
- const s = !!t[r];
577
- s === this.st.has(r) || this.nt?.has(r) || (s ? (e.add(r), this.st.add(r)) : (e.remove(r), this.st.delete(r)));
578
- }
579
- return A;
580
- }
581
- });
582
- const B = (i) => i ?? c;
583
- var Lt = Object.defineProperty, ct = (i, t, e, r) => {
584
- for (var s = void 0, o = i.length - 1, n; o >= 0; o--)
585
- (n = i[o]) && (s = n(t, e, s) || s);
586
- return s && Lt(t, e, s), s;
587
- };
588
- class F extends P {
589
- constructor() {
590
- super(...arguments), this.theme = "light", this.storageKey = "theme-preference", this.boundThemeChangeHandler = this.handleGlobalThemeChange.bind(this);
591
- }
592
- connectedCallback() {
593
- super.connectedCallback();
594
- const t = document.documentElement.getAttribute("data-theme"), e = localStorage.getItem(this.storageKey), r = window.matchMedia("(prefers-color-scheme: dark)").matches;
595
- t ? this.theme = t : e ? (this.theme = e, this.applyTheme()) : r ? (this.theme = "dark", this.applyTheme()) : this.applyTheme(), window.addEventListener("theme-changed", this.boundThemeChangeHandler);
596
- }
597
- disconnectedCallback() {
598
- window.removeEventListener("theme-changed", this.boundThemeChangeHandler), super.disconnectedCallback();
599
- }
600
- handleGlobalThemeChange(t) {
601
- const e = t;
602
- e.target !== this && e.detail.theme !== this.theme && (this.theme = e.detail.theme);
603
- }
604
- applyTheme() {
605
- document.documentElement.setAttribute("data-theme", this.theme), localStorage.setItem(this.storageKey, this.theme), this.dispatchEvent(
606
- new CustomEvent("theme-changed", {
607
- detail: { theme: this.theme },
608
- bubbles: !0,
609
- composed: !0
610
- })
611
- );
612
- }
613
- }
614
- ct([
615
- $({ type: String, attribute: "data-theme", reflect: !0 })
616
- ], F.prototype, "theme");
617
- ct([
618
- $({ type: String, attribute: "storage-key" })
619
- ], F.prototype, "storageKey");
620
- var qt = Object.defineProperty, Vt = Object.getOwnPropertyDescriptor, m = (i, t, e, r) => {
621
- for (var s = r > 1 ? void 0 : r ? Vt(t, e) : t, o = i.length - 1, n; o >= 0; o--)
622
- (n = i[o]) && (s = (r ? n(t, e, s) : n(s)) || s);
623
- return r && s && qt(t, e, s), s;
624
- };
625
- let u = class extends F {
626
- constructor() {
627
- super(...arguments), this.value = "", this.required = !1, this.disabled = !1, this.size = "md", this.rows = 4, this.resize = "vertical", this.textareaId = `textarea-${Math.random().toString(36).substr(2, 9)}`;
628
- }
629
- handleInput(i) {
630
- const t = i.target;
631
- this.value = t.value, this.dispatchEvent(
632
- new CustomEvent("input", {
633
- detail: { value: t.value },
634
- bubbles: !0,
635
- composed: !0
636
- })
637
- );
638
- }
639
- handleFocus() {
640
- this.dispatchEvent(
641
- new CustomEvent("focus", {
642
- bubbles: !0,
643
- composed: !0
644
- })
645
- );
646
- }
647
- handleBlur() {
648
- this.dispatchEvent(
649
- new CustomEvent("blur", {
650
- bubbles: !0,
651
- composed: !0
652
- })
653
- );
654
- }
655
- focus() {
656
- this.textareaElement?.focus();
657
- }
658
- render() {
659
- const i = !!this.error, t = this.value.length, e = this.maxlength !== void 0, r = !!(this.maxlength && t > this.maxlength * 0.8), s = !!(this.maxlength && t > this.maxlength), o = {
660
- "base-textarea": !0,
661
- [`base-textarea--${this.size}`]: !0,
662
- [`base-textarea--resize-${this.resize}`]: !0,
663
- "base-textarea--error": i,
664
- "base-textarea--disabled": this.disabled
665
- }, n = {
666
- "character-count": !0,
667
- "character-count--warning": r && !s,
668
- "character-count--error": s
669
- };
670
- return x`
671
- <div class="textarea-group">
672
- ${this.label ? x`
673
- <label for=${this.textareaId} class="textarea-label">
674
- ${this.label}
675
- ${this.required ? x`<span class="required-indicator" aria-label="required">*</span>` : ""}
676
- </label>
677
- ` : ""}
678
-
679
- <div class="textarea-wrapper">
680
- <textarea
681
- id=${this.textareaId}
682
- class=${it(o)}
683
- placeholder=${B(this.placeholder)}
684
- rows=${this.rows}
685
- maxlength=${B(this.maxlength)}
686
- ?disabled=${this.disabled}
687
- ?required=${this.required}
688
- aria-describedby=${B(i ? `${this.textareaId}-error` : void 0)}
689
- aria-invalid=${i}
690
- .value=${this.value}
691
- @input=${this.handleInput}
692
- @blur=${this.handleBlur}
693
- @focus=${this.handleFocus}
694
- ></textarea>
695
-
696
- ${e ? x`
697
- <div class=${it(n)}>
698
- ${t}${this.maxlength ? ` / ${this.maxlength}` : ""}
699
- </div>
700
- ` : ""}
701
- </div>
702
-
703
- ${i ? x`
704
- <div id="${this.textareaId}-error" class="textarea-error" role="alert">
705
- ${this.error}
706
- </div>
707
- ` : this.hint ? x` <div class="textarea-hint">${this.hint}</div> ` : ""}
708
- </div>
709
- `;
710
- }
711
- };
712
- u.styles = pt`
713
- :host {
714
- display: block;
715
- }
716
-
717
- .textarea-group {
718
- display: flex;
719
- flex-direction: column;
720
- gap: var(--space-2);
721
- }
722
-
723
- .textarea-label {
724
- display: flex;
725
- align-items: center;
726
- gap: var(--space-1);
727
- font-size: var(--font-size-sm);
728
- font-weight: var(--font-weight-medium);
729
- color: var(--color-text-primary);
730
- line-height: var(--line-height-tight);
731
- }
732
-
733
- .required-indicator {
734
- color: var(--color-error);
735
- font-weight: var(--font-weight-bold);
736
- }
737
-
738
- .textarea-wrapper {
739
- position: relative;
740
- display: flex;
741
- flex-direction: column;
742
- }
743
-
744
- .base-textarea {
745
- width: 100%;
746
- max-width: 100%;
747
- font-family: var(--font-family-sans);
748
- background-color: var(--color-bg-primary);
749
- border: 1px solid var(--color-border);
750
- border-radius: var(--radius-md);
751
- transition: all var(--transition-fast);
752
- color: var(--color-text-primary);
753
- line-height: var(--line-height-normal);
754
- box-sizing: border-box;
755
- }
756
-
757
- .base-textarea:hover:not(:disabled) {
758
- border-color: var(--color-border-hover);
759
- }
760
-
761
- .base-textarea:focus {
762
- outline: none;
763
- border-color: var(--color-border-focus);
764
- box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
765
- }
766
-
767
- .base-textarea::placeholder {
768
- color: var(--color-text-muted);
769
- }
770
-
771
- /* Autofill animation to prevent flash */
772
- @keyframes autofillBackground {
773
- to {
774
- background-color: var(--color-bg-primary);
775
- color: var(--color-text-primary);
776
- }
777
- }
778
-
779
- /* Autofill styles - completely override browser defaults */
780
- .base-textarea:-webkit-autofill {
781
- -webkit-box-shadow: 0 0 0 1000px var(--color-bg-primary) inset !important;
782
- box-shadow: 0 0 0 1000px var(--color-bg-primary) inset !important;
783
- -webkit-text-fill-color: var(--color-text-primary) !important;
784
- background-color: var(--color-bg-primary) !important;
785
- border-color: var(--color-border) !important;
786
- transition: border-color var(--transition-fast) !important;
787
- animation: autofillBackground 0s forwards;
788
- }
789
-
790
- .base-textarea:-webkit-autofill:hover:not(:disabled) {
791
- -webkit-box-shadow: 0 0 0 1000px var(--color-bg-primary) inset !important;
792
- box-shadow: 0 0 0 1000px var(--color-bg-primary) inset !important;
793
- border-color: var(--color-border-hover) !important;
794
- }
795
-
796
- .base-textarea:-webkit-autofill:focus {
797
- -webkit-box-shadow: 0 0 0 1000px var(--color-bg-primary) inset !important;
798
- box-shadow: 0 0 0 1000px var(--color-bg-primary) inset !important;
799
- border-color: var(--color-border-focus) !important;
800
- box-shadow: 0 0 0 1000px var(--color-bg-primary) inset, 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
801
- }
802
-
803
- /* Sizes */
804
- .base-textarea--sm {
805
- padding: var(--space-2) var(--space-3);
806
- font-size: var(--font-size-sm);
807
- }
808
-
809
- .base-textarea--md {
810
- padding: var(--space-3) var(--space-4);
811
- font-size: var(--font-size-base);
812
- }
813
-
814
- .base-textarea--lg {
815
- padding: var(--space-4) var(--space-5);
816
- font-size: var(--font-size-lg);
817
- }
818
-
819
- /* Resize modes */
820
- .base-textarea--resize-none {
821
- resize: none;
822
- }
823
-
824
- .base-textarea--resize-both {
825
- resize: both;
826
- }
827
-
828
- .base-textarea--resize-horizontal {
829
- resize: horizontal;
830
- }
831
-
832
- .base-textarea--resize-vertical {
833
- resize: vertical;
834
- }
835
-
836
- /* States */
837
- .base-textarea--error {
838
- border-color: var(--color-error);
839
- }
840
-
841
- .base-textarea--error:focus {
842
- border-color: var(--color-error);
843
- box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
844
- }
845
-
846
- .base-textarea--disabled {
847
- opacity: 0.5;
848
- cursor: not-allowed;
849
- background-color: var(--color-bg-muted);
850
- }
851
-
852
- .character-count {
853
- display: flex;
854
- justify-content: flex-end;
855
- font-size: var(--font-size-xs);
856
- color: var(--color-text-muted);
857
- margin-top: var(--space-1);
858
- }
859
-
860
- .character-count--warning {
861
- color: var(--color-warning);
862
- }
863
-
864
- .character-count--error {
865
- color: var(--color-error);
866
- }
867
-
868
- .textarea-error {
869
- font-size: var(--font-size-sm);
870
- color: var(--color-error);
871
- line-height: var(--line-height-tight);
872
- }
873
-
874
- .textarea-hint {
875
- font-size: var(--font-size-sm);
876
- color: var(--color-text-muted);
877
- line-height: var(--line-height-tight);
878
- }
879
- `;
880
- m([
881
- $({ type: String })
882
- ], u.prototype, "value", 2);
883
- m([
884
- $({ type: String })
885
- ], u.prototype, "label", 2);
886
- m([
887
- $({ type: String })
888
- ], u.prototype, "placeholder", 2);
889
- m([
890
- $({ type: Boolean, reflect: !0 })
891
- ], u.prototype, "required", 2);
892
- m([
893
- $({ type: Boolean, reflect: !0 })
894
- ], u.prototype, "disabled", 2);
895
- m([
896
- $({ type: String })
897
- ], u.prototype, "error", 2);
898
- m([
899
- $({ type: String })
900
- ], u.prototype, "hint", 2);
901
- m([
902
- $({ type: String })
903
- ], u.prototype, "size", 2);
904
- m([
905
- $({ type: Number })
906
- ], u.prototype, "rows", 2);
907
- m([
908
- $({ type: Number })
909
- ], u.prototype, "maxlength", 2);
910
- m([
911
- $({ type: String })
912
- ], u.prototype, "resize", 2);
913
- m([
914
- jt("textarea")
915
- ], u.prototype, "textareaElement", 2);
916
- u = m([
917
- kt("base-textarea")
918
- ], u);
919
- export {
920
- u as BaseTextarea
921
- };