@knapsack/sandbox-components 4.68.14--canary.4532.73337f0.0 → 4.68.14--canary.4623.e51dcc2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,890 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i5 = decorators.length - 1, decorator; i5 >= 0; i5--)
6
+ if (decorator = decorators[i5])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result)
9
+ __defProp(target, key, result);
10
+ return result;
11
+ };
12
+
13
+ // ../../../../node_modules/.pnpm/@lit+reactive-element@1.6.3/node_modules/@lit/reactive-element/css-tag.js
14
+ var t = window;
15
+ var e = t.ShadowRoot && (void 0 === t.ShadyCSS || t.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype;
16
+ var s = Symbol();
17
+ var n = /* @__PURE__ */ new WeakMap();
18
+ var o = class {
19
+ constructor(t4, e7, n7) {
20
+ if (this._$cssResult$ = true, n7 !== s)
21
+ throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
22
+ this.cssText = t4, this.t = e7;
23
+ }
24
+ get styleSheet() {
25
+ let t4 = this.o;
26
+ const s5 = this.t;
27
+ if (e && void 0 === t4) {
28
+ const e7 = void 0 !== s5 && 1 === s5.length;
29
+ e7 && (t4 = n.get(s5)), void 0 === t4 && ((this.o = t4 = new CSSStyleSheet()).replaceSync(this.cssText), e7 && n.set(s5, t4));
30
+ }
31
+ return t4;
32
+ }
33
+ toString() {
34
+ return this.cssText;
35
+ }
36
+ };
37
+ var r = (t4) => new o("string" == typeof t4 ? t4 : t4 + "", void 0, s);
38
+ var i = (t4, ...e7) => {
39
+ const n7 = 1 === t4.length ? t4[0] : e7.reduce((e8, s5, n8) => e8 + ((t5) => {
40
+ if (true === t5._$cssResult$)
41
+ return t5.cssText;
42
+ if ("number" == typeof t5)
43
+ return t5;
44
+ throw Error("Value passed to 'css' function must be a 'css' function result: " + t5 + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
45
+ })(s5) + t4[n8 + 1], t4[0]);
46
+ return new o(n7, t4, s);
47
+ };
48
+ var S = (s5, n7) => {
49
+ e ? s5.adoptedStyleSheets = n7.map((t4) => t4 instanceof CSSStyleSheet ? t4 : t4.styleSheet) : n7.forEach((e7) => {
50
+ const n8 = document.createElement("style"), o7 = t.litNonce;
51
+ void 0 !== o7 && n8.setAttribute("nonce", o7), n8.textContent = e7.cssText, s5.appendChild(n8);
52
+ });
53
+ };
54
+ var c = e ? (t4) => t4 : (t4) => t4 instanceof CSSStyleSheet ? ((t5) => {
55
+ let e7 = "";
56
+ for (const s5 of t5.cssRules)
57
+ e7 += s5.cssText;
58
+ return r(e7);
59
+ })(t4) : t4;
60
+
61
+ // ../../../../node_modules/.pnpm/@lit+reactive-element@1.6.3/node_modules/@lit/reactive-element/reactive-element.js
62
+ var s2;
63
+ var e2 = window;
64
+ var r2 = e2.trustedTypes;
65
+ var h = r2 ? r2.emptyScript : "";
66
+ var o2 = e2.reactiveElementPolyfillSupport;
67
+ var n2 = { toAttribute(t4, i5) {
68
+ switch (i5) {
69
+ case Boolean:
70
+ t4 = t4 ? h : null;
71
+ break;
72
+ case Object:
73
+ case Array:
74
+ t4 = null == t4 ? t4 : JSON.stringify(t4);
75
+ }
76
+ return t4;
77
+ }, fromAttribute(t4, i5) {
78
+ let s5 = t4;
79
+ switch (i5) {
80
+ case Boolean:
81
+ s5 = null !== t4;
82
+ break;
83
+ case Number:
84
+ s5 = null === t4 ? null : Number(t4);
85
+ break;
86
+ case Object:
87
+ case Array:
88
+ try {
89
+ s5 = JSON.parse(t4);
90
+ } catch (t5) {
91
+ s5 = null;
92
+ }
93
+ }
94
+ return s5;
95
+ } };
96
+ var a = (t4, i5) => i5 !== t4 && (i5 == i5 || t4 == t4);
97
+ var l = { attribute: true, type: String, converter: n2, reflect: false, hasChanged: a };
98
+ var d = "finalized";
99
+ var u = class extends HTMLElement {
100
+ constructor() {
101
+ super(), this._$Ei = /* @__PURE__ */ new Map(), this.isUpdatePending = false, this.hasUpdated = false, this._$El = null, this._$Eu();
102
+ }
103
+ static addInitializer(t4) {
104
+ var i5;
105
+ this.finalize(), (null !== (i5 = this.h) && void 0 !== i5 ? i5 : this.h = []).push(t4);
106
+ }
107
+ static get observedAttributes() {
108
+ this.finalize();
109
+ const t4 = [];
110
+ return this.elementProperties.forEach((i5, s5) => {
111
+ const e7 = this._$Ep(s5, i5);
112
+ void 0 !== e7 && (this._$Ev.set(e7, s5), t4.push(e7));
113
+ }), t4;
114
+ }
115
+ static createProperty(t4, i5 = l) {
116
+ if (i5.state && (i5.attribute = false), this.finalize(), this.elementProperties.set(t4, i5), !i5.noAccessor && !this.prototype.hasOwnProperty(t4)) {
117
+ const s5 = "symbol" == typeof t4 ? Symbol() : "__" + t4, e7 = this.getPropertyDescriptor(t4, s5, i5);
118
+ void 0 !== e7 && Object.defineProperty(this.prototype, t4, e7);
119
+ }
120
+ }
121
+ static getPropertyDescriptor(t4, i5, s5) {
122
+ return { get() {
123
+ return this[i5];
124
+ }, set(e7) {
125
+ const r4 = this[t4];
126
+ this[i5] = e7, this.requestUpdate(t4, r4, s5);
127
+ }, configurable: true, enumerable: true };
128
+ }
129
+ static getPropertyOptions(t4) {
130
+ return this.elementProperties.get(t4) || l;
131
+ }
132
+ static finalize() {
133
+ if (this.hasOwnProperty(d))
134
+ return false;
135
+ this[d] = true;
136
+ const t4 = Object.getPrototypeOf(this);
137
+ if (t4.finalize(), void 0 !== t4.h && (this.h = [...t4.h]), this.elementProperties = new Map(t4.elementProperties), this._$Ev = /* @__PURE__ */ new Map(), this.hasOwnProperty("properties")) {
138
+ const t5 = this.properties, i5 = [...Object.getOwnPropertyNames(t5), ...Object.getOwnPropertySymbols(t5)];
139
+ for (const s5 of i5)
140
+ this.createProperty(s5, t5[s5]);
141
+ }
142
+ return this.elementStyles = this.finalizeStyles(this.styles), true;
143
+ }
144
+ static finalizeStyles(i5) {
145
+ const s5 = [];
146
+ if (Array.isArray(i5)) {
147
+ const e7 = new Set(i5.flat(1 / 0).reverse());
148
+ for (const i6 of e7)
149
+ s5.unshift(c(i6));
150
+ } else
151
+ void 0 !== i5 && s5.push(c(i5));
152
+ return s5;
153
+ }
154
+ static _$Ep(t4, i5) {
155
+ const s5 = i5.attribute;
156
+ return false === s5 ? void 0 : "string" == typeof s5 ? s5 : "string" == typeof t4 ? t4.toLowerCase() : void 0;
157
+ }
158
+ _$Eu() {
159
+ var t4;
160
+ this._$E_ = new Promise((t5) => this.enableUpdating = t5), this._$AL = /* @__PURE__ */ new Map(), this._$Eg(), this.requestUpdate(), null === (t4 = this.constructor.h) || void 0 === t4 || t4.forEach((t5) => t5(this));
161
+ }
162
+ addController(t4) {
163
+ var i5, s5;
164
+ (null !== (i5 = this._$ES) && void 0 !== i5 ? i5 : this._$ES = []).push(t4), void 0 !== this.renderRoot && this.isConnected && (null === (s5 = t4.hostConnected) || void 0 === s5 || s5.call(t4));
165
+ }
166
+ removeController(t4) {
167
+ var i5;
168
+ null === (i5 = this._$ES) || void 0 === i5 || i5.splice(this._$ES.indexOf(t4) >>> 0, 1);
169
+ }
170
+ _$Eg() {
171
+ this.constructor.elementProperties.forEach((t4, i5) => {
172
+ this.hasOwnProperty(i5) && (this._$Ei.set(i5, this[i5]), delete this[i5]);
173
+ });
174
+ }
175
+ createRenderRoot() {
176
+ var t4;
177
+ const s5 = null !== (t4 = this.shadowRoot) && void 0 !== t4 ? t4 : this.attachShadow(this.constructor.shadowRootOptions);
178
+ return S(s5, this.constructor.elementStyles), s5;
179
+ }
180
+ connectedCallback() {
181
+ var t4;
182
+ void 0 === this.renderRoot && (this.renderRoot = this.createRenderRoot()), this.enableUpdating(true), null === (t4 = this._$ES) || void 0 === t4 || t4.forEach((t5) => {
183
+ var i5;
184
+ return null === (i5 = t5.hostConnected) || void 0 === i5 ? void 0 : i5.call(t5);
185
+ });
186
+ }
187
+ enableUpdating(t4) {
188
+ }
189
+ disconnectedCallback() {
190
+ var t4;
191
+ null === (t4 = this._$ES) || void 0 === t4 || t4.forEach((t5) => {
192
+ var i5;
193
+ return null === (i5 = t5.hostDisconnected) || void 0 === i5 ? void 0 : i5.call(t5);
194
+ });
195
+ }
196
+ attributeChangedCallback(t4, i5, s5) {
197
+ this._$AK(t4, s5);
198
+ }
199
+ _$EO(t4, i5, s5 = l) {
200
+ var e7;
201
+ const r4 = this.constructor._$Ep(t4, s5);
202
+ if (void 0 !== r4 && true === s5.reflect) {
203
+ const h3 = (void 0 !== (null === (e7 = s5.converter) || void 0 === e7 ? void 0 : e7.toAttribute) ? s5.converter : n2).toAttribute(i5, s5.type);
204
+ this._$El = t4, null == h3 ? this.removeAttribute(r4) : this.setAttribute(r4, h3), this._$El = null;
205
+ }
206
+ }
207
+ _$AK(t4, i5) {
208
+ var s5;
209
+ const e7 = this.constructor, r4 = e7._$Ev.get(t4);
210
+ if (void 0 !== r4 && this._$El !== r4) {
211
+ const t5 = e7.getPropertyOptions(r4), h3 = "function" == typeof t5.converter ? { fromAttribute: t5.converter } : void 0 !== (null === (s5 = t5.converter) || void 0 === s5 ? void 0 : s5.fromAttribute) ? t5.converter : n2;
212
+ this._$El = r4, this[r4] = h3.fromAttribute(i5, t5.type), this._$El = null;
213
+ }
214
+ }
215
+ requestUpdate(t4, i5, s5) {
216
+ let e7 = true;
217
+ void 0 !== t4 && (((s5 = s5 || this.constructor.getPropertyOptions(t4)).hasChanged || a)(this[t4], i5) ? (this._$AL.has(t4) || this._$AL.set(t4, i5), true === s5.reflect && this._$El !== t4 && (void 0 === this._$EC && (this._$EC = /* @__PURE__ */ new Map()), this._$EC.set(t4, s5))) : e7 = false), !this.isUpdatePending && e7 && (this._$E_ = this._$Ej());
218
+ }
219
+ async _$Ej() {
220
+ this.isUpdatePending = true;
221
+ try {
222
+ await this._$E_;
223
+ } catch (t5) {
224
+ Promise.reject(t5);
225
+ }
226
+ const t4 = this.scheduleUpdate();
227
+ return null != t4 && await t4, !this.isUpdatePending;
228
+ }
229
+ scheduleUpdate() {
230
+ return this.performUpdate();
231
+ }
232
+ performUpdate() {
233
+ var t4;
234
+ if (!this.isUpdatePending)
235
+ return;
236
+ this.hasUpdated, this._$Ei && (this._$Ei.forEach((t5, i6) => this[i6] = t5), this._$Ei = void 0);
237
+ let i5 = false;
238
+ const s5 = this._$AL;
239
+ try {
240
+ i5 = this.shouldUpdate(s5), i5 ? (this.willUpdate(s5), null === (t4 = this._$ES) || void 0 === t4 || t4.forEach((t5) => {
241
+ var i6;
242
+ return null === (i6 = t5.hostUpdate) || void 0 === i6 ? void 0 : i6.call(t5);
243
+ }), this.update(s5)) : this._$Ek();
244
+ } catch (t5) {
245
+ throw i5 = false, this._$Ek(), t5;
246
+ }
247
+ i5 && this._$AE(s5);
248
+ }
249
+ willUpdate(t4) {
250
+ }
251
+ _$AE(t4) {
252
+ var i5;
253
+ null === (i5 = this._$ES) || void 0 === i5 || i5.forEach((t5) => {
254
+ var i6;
255
+ return null === (i6 = t5.hostUpdated) || void 0 === i6 ? void 0 : i6.call(t5);
256
+ }), this.hasUpdated || (this.hasUpdated = true, this.firstUpdated(t4)), this.updated(t4);
257
+ }
258
+ _$Ek() {
259
+ this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = false;
260
+ }
261
+ get updateComplete() {
262
+ return this.getUpdateComplete();
263
+ }
264
+ getUpdateComplete() {
265
+ return this._$E_;
266
+ }
267
+ shouldUpdate(t4) {
268
+ return true;
269
+ }
270
+ update(t4) {
271
+ void 0 !== this._$EC && (this._$EC.forEach((t5, i5) => this._$EO(i5, this[i5], t5)), this._$EC = void 0), this._$Ek();
272
+ }
273
+ updated(t4) {
274
+ }
275
+ firstUpdated(t4) {
276
+ }
277
+ };
278
+ u[d] = true, u.elementProperties = /* @__PURE__ */ new Map(), u.elementStyles = [], u.shadowRootOptions = { mode: "open" }, null == o2 || o2({ ReactiveElement: u }), (null !== (s2 = e2.reactiveElementVersions) && void 0 !== s2 ? s2 : e2.reactiveElementVersions = []).push("1.6.3");
279
+
280
+ // ../../../../node_modules/.pnpm/lit-html@2.8.0/node_modules/lit-html/lit-html.js
281
+ var t2;
282
+ var i2 = window;
283
+ var s3 = i2.trustedTypes;
284
+ var e3 = s3 ? s3.createPolicy("lit-html", { createHTML: (t4) => t4 }) : void 0;
285
+ var o3 = "$lit$";
286
+ var n3 = `lit$${(Math.random() + "").slice(9)}$`;
287
+ var l2 = "?" + n3;
288
+ var h2 = `<${l2}>`;
289
+ var r3 = document;
290
+ var u2 = () => r3.createComment("");
291
+ var d2 = (t4) => null === t4 || "object" != typeof t4 && "function" != typeof t4;
292
+ var c2 = Array.isArray;
293
+ var v = (t4) => c2(t4) || "function" == typeof (null == t4 ? void 0 : t4[Symbol.iterator]);
294
+ var a2 = "[ \n\f\r]";
295
+ var f = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g;
296
+ var _ = /-->/g;
297
+ var m = />/g;
298
+ var p = RegExp(`>|${a2}(?:([^\\s"'>=/]+)(${a2}*=${a2}*(?:[^
299
+ \f\r"'\`<>=]|("|')|))|$)`, "g");
300
+ var g = /'/g;
301
+ var $ = /"/g;
302
+ var y = /^(?:script|style|textarea|title)$/i;
303
+ var w = (t4) => (i5, ...s5) => ({ _$litType$: t4, strings: i5, values: s5 });
304
+ var x = w(1);
305
+ var b = w(2);
306
+ var T = Symbol.for("lit-noChange");
307
+ var A = Symbol.for("lit-nothing");
308
+ var E = /* @__PURE__ */ new WeakMap();
309
+ var C = r3.createTreeWalker(r3, 129, null, false);
310
+ function P(t4, i5) {
311
+ if (!Array.isArray(t4) || !t4.hasOwnProperty("raw"))
312
+ throw Error("invalid template strings array");
313
+ return void 0 !== e3 ? e3.createHTML(i5) : i5;
314
+ }
315
+ var V = (t4, i5) => {
316
+ const s5 = t4.length - 1, e7 = [];
317
+ let l5, r4 = 2 === i5 ? "<svg>" : "", u3 = f;
318
+ for (let i6 = 0; i6 < s5; i6++) {
319
+ const s6 = t4[i6];
320
+ let d3, c3, v2 = -1, a3 = 0;
321
+ for (; a3 < s6.length && (u3.lastIndex = a3, c3 = u3.exec(s6), null !== c3); )
322
+ a3 = u3.lastIndex, u3 === f ? "!--" === c3[1] ? u3 = _ : void 0 !== c3[1] ? u3 = m : void 0 !== c3[2] ? (y.test(c3[2]) && (l5 = RegExp("</" + c3[2], "g")), u3 = p) : void 0 !== c3[3] && (u3 = p) : u3 === p ? ">" === c3[0] ? (u3 = null != l5 ? l5 : f, v2 = -1) : void 0 === c3[1] ? v2 = -2 : (v2 = u3.lastIndex - c3[2].length, d3 = c3[1], u3 = void 0 === c3[3] ? p : '"' === c3[3] ? $ : g) : u3 === $ || u3 === g ? u3 = p : u3 === _ || u3 === m ? u3 = f : (u3 = p, l5 = void 0);
323
+ const w2 = u3 === p && t4[i6 + 1].startsWith("/>") ? " " : "";
324
+ r4 += u3 === f ? s6 + h2 : v2 >= 0 ? (e7.push(d3), s6.slice(0, v2) + o3 + s6.slice(v2) + n3 + w2) : s6 + n3 + (-2 === v2 ? (e7.push(void 0), i6) : w2);
325
+ }
326
+ return [P(t4, r4 + (t4[s5] || "<?>") + (2 === i5 ? "</svg>" : "")), e7];
327
+ };
328
+ var N = class _N {
329
+ constructor({ strings: t4, _$litType$: i5 }, e7) {
330
+ let h3;
331
+ this.parts = [];
332
+ let r4 = 0, d3 = 0;
333
+ const c3 = t4.length - 1, v2 = this.parts, [a3, f2] = V(t4, i5);
334
+ if (this.el = _N.createElement(a3, e7), C.currentNode = this.el.content, 2 === i5) {
335
+ const t5 = this.el.content, i6 = t5.firstChild;
336
+ i6.remove(), t5.append(...i6.childNodes);
337
+ }
338
+ for (; null !== (h3 = C.nextNode()) && v2.length < c3; ) {
339
+ if (1 === h3.nodeType) {
340
+ if (h3.hasAttributes()) {
341
+ const t5 = [];
342
+ for (const i6 of h3.getAttributeNames())
343
+ if (i6.endsWith(o3) || i6.startsWith(n3)) {
344
+ const s5 = f2[d3++];
345
+ if (t5.push(i6), void 0 !== s5) {
346
+ const t6 = h3.getAttribute(s5.toLowerCase() + o3).split(n3), i7 = /([.?@])?(.*)/.exec(s5);
347
+ v2.push({ type: 1, index: r4, name: i7[2], strings: t6, ctor: "." === i7[1] ? H : "?" === i7[1] ? L : "@" === i7[1] ? z : k });
348
+ } else
349
+ v2.push({ type: 6, index: r4 });
350
+ }
351
+ for (const i6 of t5)
352
+ h3.removeAttribute(i6);
353
+ }
354
+ if (y.test(h3.tagName)) {
355
+ const t5 = h3.textContent.split(n3), i6 = t5.length - 1;
356
+ if (i6 > 0) {
357
+ h3.textContent = s3 ? s3.emptyScript : "";
358
+ for (let s5 = 0; s5 < i6; s5++)
359
+ h3.append(t5[s5], u2()), C.nextNode(), v2.push({ type: 2, index: ++r4 });
360
+ h3.append(t5[i6], u2());
361
+ }
362
+ }
363
+ } else if (8 === h3.nodeType)
364
+ if (h3.data === l2)
365
+ v2.push({ type: 2, index: r4 });
366
+ else {
367
+ let t5 = -1;
368
+ for (; -1 !== (t5 = h3.data.indexOf(n3, t5 + 1)); )
369
+ v2.push({ type: 7, index: r4 }), t5 += n3.length - 1;
370
+ }
371
+ r4++;
372
+ }
373
+ }
374
+ static createElement(t4, i5) {
375
+ const s5 = r3.createElement("template");
376
+ return s5.innerHTML = t4, s5;
377
+ }
378
+ };
379
+ function S2(t4, i5, s5 = t4, e7) {
380
+ var o7, n7, l5, h3;
381
+ if (i5 === T)
382
+ return i5;
383
+ let r4 = void 0 !== e7 ? null === (o7 = s5._$Co) || void 0 === o7 ? void 0 : o7[e7] : s5._$Cl;
384
+ const u3 = d2(i5) ? void 0 : i5._$litDirective$;
385
+ return (null == r4 ? void 0 : r4.constructor) !== u3 && (null === (n7 = null == r4 ? void 0 : r4._$AO) || void 0 === n7 || n7.call(r4, false), void 0 === u3 ? r4 = void 0 : (r4 = new u3(t4), r4._$AT(t4, s5, e7)), void 0 !== e7 ? (null !== (l5 = (h3 = s5)._$Co) && void 0 !== l5 ? l5 : h3._$Co = [])[e7] = r4 : s5._$Cl = r4), void 0 !== r4 && (i5 = S2(t4, r4._$AS(t4, i5.values), r4, e7)), i5;
386
+ }
387
+ var M = class {
388
+ constructor(t4, i5) {
389
+ this._$AV = [], this._$AN = void 0, this._$AD = t4, this._$AM = i5;
390
+ }
391
+ get parentNode() {
392
+ return this._$AM.parentNode;
393
+ }
394
+ get _$AU() {
395
+ return this._$AM._$AU;
396
+ }
397
+ u(t4) {
398
+ var i5;
399
+ const { el: { content: s5 }, parts: e7 } = this._$AD, o7 = (null !== (i5 = null == t4 ? void 0 : t4.creationScope) && void 0 !== i5 ? i5 : r3).importNode(s5, true);
400
+ C.currentNode = o7;
401
+ let n7 = C.nextNode(), l5 = 0, h3 = 0, u3 = e7[0];
402
+ for (; void 0 !== u3; ) {
403
+ if (l5 === u3.index) {
404
+ let i6;
405
+ 2 === u3.type ? i6 = new R(n7, n7.nextSibling, this, t4) : 1 === u3.type ? i6 = new u3.ctor(n7, u3.name, u3.strings, this, t4) : 6 === u3.type && (i6 = new Z(n7, this, t4)), this._$AV.push(i6), u3 = e7[++h3];
406
+ }
407
+ l5 !== (null == u3 ? void 0 : u3.index) && (n7 = C.nextNode(), l5++);
408
+ }
409
+ return C.currentNode = r3, o7;
410
+ }
411
+ v(t4) {
412
+ let i5 = 0;
413
+ for (const s5 of this._$AV)
414
+ void 0 !== s5 && (void 0 !== s5.strings ? (s5._$AI(t4, s5, i5), i5 += s5.strings.length - 2) : s5._$AI(t4[i5])), i5++;
415
+ }
416
+ };
417
+ var R = class _R {
418
+ constructor(t4, i5, s5, e7) {
419
+ var o7;
420
+ this.type = 2, this._$AH = A, this._$AN = void 0, this._$AA = t4, this._$AB = i5, this._$AM = s5, this.options = e7, this._$Cp = null === (o7 = null == e7 ? void 0 : e7.isConnected) || void 0 === o7 || o7;
421
+ }
422
+ get _$AU() {
423
+ var t4, i5;
424
+ return null !== (i5 = null === (t4 = this._$AM) || void 0 === t4 ? void 0 : t4._$AU) && void 0 !== i5 ? i5 : this._$Cp;
425
+ }
426
+ get parentNode() {
427
+ let t4 = this._$AA.parentNode;
428
+ const i5 = this._$AM;
429
+ return void 0 !== i5 && 11 === (null == t4 ? void 0 : t4.nodeType) && (t4 = i5.parentNode), t4;
430
+ }
431
+ get startNode() {
432
+ return this._$AA;
433
+ }
434
+ get endNode() {
435
+ return this._$AB;
436
+ }
437
+ _$AI(t4, i5 = this) {
438
+ t4 = S2(this, t4, i5), d2(t4) ? t4 === A || null == t4 || "" === t4 ? (this._$AH !== A && this._$AR(), this._$AH = A) : t4 !== this._$AH && t4 !== T && this._(t4) : void 0 !== t4._$litType$ ? this.g(t4) : void 0 !== t4.nodeType ? this.$(t4) : v(t4) ? this.T(t4) : this._(t4);
439
+ }
440
+ k(t4) {
441
+ return this._$AA.parentNode.insertBefore(t4, this._$AB);
442
+ }
443
+ $(t4) {
444
+ this._$AH !== t4 && (this._$AR(), this._$AH = this.k(t4));
445
+ }
446
+ _(t4) {
447
+ this._$AH !== A && d2(this._$AH) ? this._$AA.nextSibling.data = t4 : this.$(r3.createTextNode(t4)), this._$AH = t4;
448
+ }
449
+ g(t4) {
450
+ var i5;
451
+ const { values: s5, _$litType$: e7 } = t4, o7 = "number" == typeof e7 ? this._$AC(t4) : (void 0 === e7.el && (e7.el = N.createElement(P(e7.h, e7.h[0]), this.options)), e7);
452
+ if ((null === (i5 = this._$AH) || void 0 === i5 ? void 0 : i5._$AD) === o7)
453
+ this._$AH.v(s5);
454
+ else {
455
+ const t5 = new M(o7, this), i6 = t5.u(this.options);
456
+ t5.v(s5), this.$(i6), this._$AH = t5;
457
+ }
458
+ }
459
+ _$AC(t4) {
460
+ let i5 = E.get(t4.strings);
461
+ return void 0 === i5 && E.set(t4.strings, i5 = new N(t4)), i5;
462
+ }
463
+ T(t4) {
464
+ c2(this._$AH) || (this._$AH = [], this._$AR());
465
+ const i5 = this._$AH;
466
+ let s5, e7 = 0;
467
+ for (const o7 of t4)
468
+ e7 === i5.length ? i5.push(s5 = new _R(this.k(u2()), this.k(u2()), this, this.options)) : s5 = i5[e7], s5._$AI(o7), e7++;
469
+ e7 < i5.length && (this._$AR(s5 && s5._$AB.nextSibling, e7), i5.length = e7);
470
+ }
471
+ _$AR(t4 = this._$AA.nextSibling, i5) {
472
+ var s5;
473
+ for (null === (s5 = this._$AP) || void 0 === s5 || s5.call(this, false, true, i5); t4 && t4 !== this._$AB; ) {
474
+ const i6 = t4.nextSibling;
475
+ t4.remove(), t4 = i6;
476
+ }
477
+ }
478
+ setConnected(t4) {
479
+ var i5;
480
+ void 0 === this._$AM && (this._$Cp = t4, null === (i5 = this._$AP) || void 0 === i5 || i5.call(this, t4));
481
+ }
482
+ };
483
+ var k = class {
484
+ constructor(t4, i5, s5, e7, o7) {
485
+ this.type = 1, this._$AH = A, this._$AN = void 0, this.element = t4, this.name = i5, this._$AM = e7, this.options = o7, s5.length > 2 || "" !== s5[0] || "" !== s5[1] ? (this._$AH = Array(s5.length - 1).fill(new String()), this.strings = s5) : this._$AH = A;
486
+ }
487
+ get tagName() {
488
+ return this.element.tagName;
489
+ }
490
+ get _$AU() {
491
+ return this._$AM._$AU;
492
+ }
493
+ _$AI(t4, i5 = this, s5, e7) {
494
+ const o7 = this.strings;
495
+ let n7 = false;
496
+ if (void 0 === o7)
497
+ t4 = S2(this, t4, i5, 0), n7 = !d2(t4) || t4 !== this._$AH && t4 !== T, n7 && (this._$AH = t4);
498
+ else {
499
+ const e8 = t4;
500
+ let l5, h3;
501
+ for (t4 = o7[0], l5 = 0; l5 < o7.length - 1; l5++)
502
+ h3 = S2(this, e8[s5 + l5], i5, l5), h3 === T && (h3 = this._$AH[l5]), n7 || (n7 = !d2(h3) || h3 !== this._$AH[l5]), h3 === A ? t4 = A : t4 !== A && (t4 += (null != h3 ? h3 : "") + o7[l5 + 1]), this._$AH[l5] = h3;
503
+ }
504
+ n7 && !e7 && this.j(t4);
505
+ }
506
+ j(t4) {
507
+ t4 === A ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, null != t4 ? t4 : "");
508
+ }
509
+ };
510
+ var H = class extends k {
511
+ constructor() {
512
+ super(...arguments), this.type = 3;
513
+ }
514
+ j(t4) {
515
+ this.element[this.name] = t4 === A ? void 0 : t4;
516
+ }
517
+ };
518
+ var I = s3 ? s3.emptyScript : "";
519
+ var L = class extends k {
520
+ constructor() {
521
+ super(...arguments), this.type = 4;
522
+ }
523
+ j(t4) {
524
+ t4 && t4 !== A ? this.element.setAttribute(this.name, I) : this.element.removeAttribute(this.name);
525
+ }
526
+ };
527
+ var z = class extends k {
528
+ constructor(t4, i5, s5, e7, o7) {
529
+ super(t4, i5, s5, e7, o7), this.type = 5;
530
+ }
531
+ _$AI(t4, i5 = this) {
532
+ var s5;
533
+ if ((t4 = null !== (s5 = S2(this, t4, i5, 0)) && void 0 !== s5 ? s5 : A) === T)
534
+ return;
535
+ const e7 = this._$AH, o7 = t4 === A && e7 !== A || t4.capture !== e7.capture || t4.once !== e7.once || t4.passive !== e7.passive, n7 = t4 !== A && (e7 === A || o7);
536
+ o7 && this.element.removeEventListener(this.name, this, e7), n7 && this.element.addEventListener(this.name, this, t4), this._$AH = t4;
537
+ }
538
+ handleEvent(t4) {
539
+ var i5, s5;
540
+ "function" == typeof this._$AH ? this._$AH.call(null !== (s5 = null === (i5 = this.options) || void 0 === i5 ? void 0 : i5.host) && void 0 !== s5 ? s5 : this.element, t4) : this._$AH.handleEvent(t4);
541
+ }
542
+ };
543
+ var Z = class {
544
+ constructor(t4, i5, s5) {
545
+ this.element = t4, this.type = 6, this._$AN = void 0, this._$AM = i5, this.options = s5;
546
+ }
547
+ get _$AU() {
548
+ return this._$AM._$AU;
549
+ }
550
+ _$AI(t4) {
551
+ S2(this, t4);
552
+ }
553
+ };
554
+ var B = i2.litHtmlPolyfillSupport;
555
+ null == B || B(N, R), (null !== (t2 = i2.litHtmlVersions) && void 0 !== t2 ? t2 : i2.litHtmlVersions = []).push("2.8.0");
556
+ var D = (t4, i5, s5) => {
557
+ var e7, o7;
558
+ const n7 = null !== (e7 = null == s5 ? void 0 : s5.renderBefore) && void 0 !== e7 ? e7 : i5;
559
+ let l5 = n7._$litPart$;
560
+ if (void 0 === l5) {
561
+ const t5 = null !== (o7 = null == s5 ? void 0 : s5.renderBefore) && void 0 !== o7 ? o7 : null;
562
+ n7._$litPart$ = l5 = new R(i5.insertBefore(u2(), t5), t5, void 0, null != s5 ? s5 : {});
563
+ }
564
+ return l5._$AI(t4), l5;
565
+ };
566
+
567
+ // ../../../../node_modules/.pnpm/lit-element@3.3.3/node_modules/lit-element/lit-element.js
568
+ var l3;
569
+ var o4;
570
+ var s4 = class extends u {
571
+ constructor() {
572
+ super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
573
+ }
574
+ createRenderRoot() {
575
+ var t4, e7;
576
+ const i5 = super.createRenderRoot();
577
+ return null !== (t4 = (e7 = this.renderOptions).renderBefore) && void 0 !== t4 || (e7.renderBefore = i5.firstChild), i5;
578
+ }
579
+ update(t4) {
580
+ const i5 = this.render();
581
+ this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t4), this._$Do = D(i5, this.renderRoot, this.renderOptions);
582
+ }
583
+ connectedCallback() {
584
+ var t4;
585
+ super.connectedCallback(), null === (t4 = this._$Do) || void 0 === t4 || t4.setConnected(true);
586
+ }
587
+ disconnectedCallback() {
588
+ var t4;
589
+ super.disconnectedCallback(), null === (t4 = this._$Do) || void 0 === t4 || t4.setConnected(false);
590
+ }
591
+ render() {
592
+ return T;
593
+ }
594
+ };
595
+ s4.finalized = true, s4._$litElement$ = true, null === (l3 = globalThis.litElementHydrateSupport) || void 0 === l3 || l3.call(globalThis, { LitElement: s4 });
596
+ var n4 = globalThis.litElementPolyfillSupport;
597
+ null == n4 || n4({ LitElement: s4 });
598
+ (null !== (o4 = globalThis.litElementVersions) && void 0 !== o4 ? o4 : globalThis.litElementVersions = []).push("3.3.3");
599
+
600
+ // ../../../../node_modules/.pnpm/lit-html@2.8.0/node_modules/lit-html/directive.js
601
+ var t3 = { ATTRIBUTE: 1, CHILD: 2, PROPERTY: 3, BOOLEAN_ATTRIBUTE: 4, EVENT: 5, ELEMENT: 6 };
602
+ var e4 = (t4) => (...e7) => ({ _$litDirective$: t4, values: e7 });
603
+ var i3 = class {
604
+ constructor(t4) {
605
+ }
606
+ get _$AU() {
607
+ return this._$AM._$AU;
608
+ }
609
+ _$AT(t4, e7, i5) {
610
+ this._$Ct = t4, this._$AM = e7, this._$Ci = i5;
611
+ }
612
+ _$AS(t4, e7) {
613
+ return this.update(t4, e7);
614
+ }
615
+ update(t4, e7) {
616
+ return this.render(...e7);
617
+ }
618
+ };
619
+
620
+ // ../../../../node_modules/.pnpm/lit-html@2.8.0/node_modules/lit-html/directives/class-map.js
621
+ var o5 = e4(class extends i3 {
622
+ constructor(t4) {
623
+ var i5;
624
+ if (super(t4), t4.type !== t3.ATTRIBUTE || "class" !== t4.name || (null === (i5 = t4.strings) || void 0 === i5 ? void 0 : i5.length) > 2)
625
+ throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.");
626
+ }
627
+ render(t4) {
628
+ return " " + Object.keys(t4).filter((i5) => t4[i5]).join(" ") + " ";
629
+ }
630
+ update(i5, [s5]) {
631
+ var r4, o7;
632
+ if (void 0 === this.it) {
633
+ this.it = /* @__PURE__ */ new Set(), void 0 !== i5.strings && (this.nt = new Set(i5.strings.join(" ").split(/\s/).filter((t4) => "" !== t4)));
634
+ for (const t4 in s5)
635
+ s5[t4] && !(null === (r4 = this.nt) || void 0 === r4 ? void 0 : r4.has(t4)) && this.it.add(t4);
636
+ return this.render(s5);
637
+ }
638
+ const e7 = i5.element.classList;
639
+ this.it.forEach((t4) => {
640
+ t4 in s5 || (e7.remove(t4), this.it.delete(t4));
641
+ });
642
+ for (const t4 in s5) {
643
+ const i6 = !!s5[t4];
644
+ i6 === this.it.has(t4) || (null === (o7 = this.nt) || void 0 === o7 ? void 0 : o7.has(t4)) || (i6 ? (e7.add(t4), this.it.add(t4)) : (e7.remove(t4), this.it.delete(t4)));
645
+ }
646
+ return T;
647
+ }
648
+ });
649
+
650
+ // ../../../../node_modules/.pnpm/@lit+reactive-element@1.6.3/node_modules/@lit/reactive-element/decorators/property.js
651
+ var i4 = (i5, e7) => "method" === e7.kind && e7.descriptor && !("value" in e7.descriptor) ? { ...e7, finisher(n7) {
652
+ n7.createProperty(e7.key, i5);
653
+ } } : { kind: "field", key: Symbol(), placement: "own", descriptor: {}, originalKey: e7.key, initializer() {
654
+ "function" == typeof e7.initializer && (this[e7.key] = e7.initializer.call(this));
655
+ }, finisher(n7) {
656
+ n7.createProperty(e7.key, i5);
657
+ } };
658
+ var e5 = (i5, e7, n7) => {
659
+ e7.constructor.createProperty(n7, i5);
660
+ };
661
+ function n5(n7) {
662
+ return (t4, o7) => void 0 !== o7 ? e5(n7, t4, o7) : i4(n7, t4);
663
+ }
664
+
665
+ // ../../../../node_modules/.pnpm/@lit+reactive-element@1.6.3/node_modules/@lit/reactive-element/decorators/query-assigned-elements.js
666
+ var n6;
667
+ var e6 = null != (null === (n6 = window.HTMLSlotElement) || void 0 === n6 ? void 0 : n6.prototype.assignedElements) ? (o7, n7) => o7.assignedElements(n7) : (o7, n7) => o7.assignedNodes(n7).filter((o8) => o8.nodeType === Node.ELEMENT_NODE);
668
+
669
+ // src/web-components/button.ts
670
+ var SimpleButton = class extends s4 {
671
+ constructor() {
672
+ super(...arguments);
673
+ this.label = "Click me";
674
+ this.size = "medium";
675
+ this.type = "filled";
676
+ }
677
+ _handleClick() {
678
+ console.log("Button clicked!");
679
+ this.dispatchEvent(new CustomEvent("button-click"));
680
+ }
681
+ render() {
682
+ const classes = {
683
+ button: true,
684
+ [`button--size-${this.size}`]: true,
685
+ [`button--type-${this.type}`]: true
686
+ };
687
+ return x`
688
+ <button @click=${this._handleClick} class=${o5(classes)}>
689
+ ${this.label}
690
+ </button>
691
+ `;
692
+ }
693
+ };
694
+ SimpleButton.shadowRootOptions = {
695
+ ...s4.shadowRootOptions,
696
+ mode: "open"
697
+ };
698
+ SimpleButton.styles = i`
699
+ .button {
700
+ border-radius: 4px;
701
+ border-radius: var(--radius-small);
702
+ border: 1px solid #7a34ed;
703
+ border: 1px solid var(--brand-color);
704
+ font-family: Inter;
705
+ font-family: var(--brand-font-family);
706
+ font-weight: 600;
707
+ transition: all 0.3s ease;
708
+ }
709
+
710
+ .button--size-small {
711
+ font-size: 12px;
712
+ padding-top: 4px;
713
+ padding-bottom: 4px;
714
+ padding-top: var(--spacing-xsmall);
715
+ padding-bottom: var(--spacing-xsmall);
716
+ padding-left: 12px;
717
+ padding-right: 12px;
718
+ padding-left: var(--spacing-medium);
719
+ padding-right: var(--spacing-medium);
720
+ }
721
+
722
+ .button--size-medium {
723
+ font-size: 14px;
724
+ padding-top: 8px;
725
+ padding-bottom: 8px;
726
+ padding-top: var(--spacing-small);
727
+ padding-bottom: var(--spacing-small);
728
+ padding-left: 16px;
729
+ padding-right: 16px;
730
+ padding-left: var(--spacing-large);
731
+ padding-right: var(--spacing-large);
732
+ }
733
+
734
+ .button--size-large {
735
+ font-size: 16px;
736
+ padding-top: 12px;
737
+ padding-bottom: 12px;
738
+ padding-top: var(--spacing-medium);
739
+ padding-bottom: var(--spacing-medium);
740
+ padding-left: 24px;
741
+ padding-right: 24px;
742
+ padding-left: var(--spacing-xlarge);
743
+ padding-right: var(--spacing-xlarge);
744
+ }
745
+
746
+ .button--type-outlined {
747
+ background-color: #ffffff;
748
+ background-color: var(--color-white);
749
+ color: #7a34ed;
750
+ color: var(--brand-color);
751
+ }
752
+
753
+ .button--type-filled {
754
+ background-color: #7a34ed;
755
+ background-color: var(--brand-color);
756
+ color: #ffffff;
757
+ color: var(--color-white);
758
+ }
759
+ `;
760
+ __decorateClass([
761
+ n5({ type: String })
762
+ ], SimpleButton.prototype, "label", 2);
763
+ __decorateClass([
764
+ n5({ type: String })
765
+ ], SimpleButton.prototype, "size", 2);
766
+ __decorateClass([
767
+ n5({ type: String })
768
+ ], SimpleButton.prototype, "type", 2);
769
+ customElements.define("simple-button", SimpleButton);
770
+ /*! Bundled license information:
771
+
772
+ @lit/reactive-element/css-tag.js:
773
+ (**
774
+ * @license
775
+ * Copyright 2019 Google LLC
776
+ * SPDX-License-Identifier: BSD-3-Clause
777
+ *)
778
+
779
+ @lit/reactive-element/reactive-element.js:
780
+ (**
781
+ * @license
782
+ * Copyright 2017 Google LLC
783
+ * SPDX-License-Identifier: BSD-3-Clause
784
+ *)
785
+
786
+ lit-html/lit-html.js:
787
+ (**
788
+ * @license
789
+ * Copyright 2017 Google LLC
790
+ * SPDX-License-Identifier: BSD-3-Clause
791
+ *)
792
+
793
+ lit-element/lit-element.js:
794
+ (**
795
+ * @license
796
+ * Copyright 2017 Google LLC
797
+ * SPDX-License-Identifier: BSD-3-Clause
798
+ *)
799
+
800
+ lit-html/is-server.js:
801
+ (**
802
+ * @license
803
+ * Copyright 2022 Google LLC
804
+ * SPDX-License-Identifier: BSD-3-Clause
805
+ *)
806
+
807
+ lit-html/directive.js:
808
+ (**
809
+ * @license
810
+ * Copyright 2017 Google LLC
811
+ * SPDX-License-Identifier: BSD-3-Clause
812
+ *)
813
+
814
+ lit-html/directives/class-map.js:
815
+ (**
816
+ * @license
817
+ * Copyright 2018 Google LLC
818
+ * SPDX-License-Identifier: BSD-3-Clause
819
+ *)
820
+
821
+ @lit/reactive-element/decorators/custom-element.js:
822
+ (**
823
+ * @license
824
+ * Copyright 2017 Google LLC
825
+ * SPDX-License-Identifier: BSD-3-Clause
826
+ *)
827
+
828
+ @lit/reactive-element/decorators/property.js:
829
+ (**
830
+ * @license
831
+ * Copyright 2017 Google LLC
832
+ * SPDX-License-Identifier: BSD-3-Clause
833
+ *)
834
+
835
+ @lit/reactive-element/decorators/state.js:
836
+ (**
837
+ * @license
838
+ * Copyright 2017 Google LLC
839
+ * SPDX-License-Identifier: BSD-3-Clause
840
+ *)
841
+
842
+ @lit/reactive-element/decorators/base.js:
843
+ (**
844
+ * @license
845
+ * Copyright 2017 Google LLC
846
+ * SPDX-License-Identifier: BSD-3-Clause
847
+ *)
848
+
849
+ @lit/reactive-element/decorators/event-options.js:
850
+ (**
851
+ * @license
852
+ * Copyright 2017 Google LLC
853
+ * SPDX-License-Identifier: BSD-3-Clause
854
+ *)
855
+
856
+ @lit/reactive-element/decorators/query.js:
857
+ (**
858
+ * @license
859
+ * Copyright 2017 Google LLC
860
+ * SPDX-License-Identifier: BSD-3-Clause
861
+ *)
862
+
863
+ @lit/reactive-element/decorators/query-all.js:
864
+ (**
865
+ * @license
866
+ * Copyright 2017 Google LLC
867
+ * SPDX-License-Identifier: BSD-3-Clause
868
+ *)
869
+
870
+ @lit/reactive-element/decorators/query-async.js:
871
+ (**
872
+ * @license
873
+ * Copyright 2017 Google LLC
874
+ * SPDX-License-Identifier: BSD-3-Clause
875
+ *)
876
+
877
+ @lit/reactive-element/decorators/query-assigned-elements.js:
878
+ (**
879
+ * @license
880
+ * Copyright 2021 Google LLC
881
+ * SPDX-License-Identifier: BSD-3-Clause
882
+ *)
883
+
884
+ @lit/reactive-element/decorators/query-assigned-nodes.js:
885
+ (**
886
+ * @license
887
+ * Copyright 2017 Google LLC
888
+ * SPDX-License-Identifier: BSD-3-Clause
889
+ *)
890
+ */
@@ -1,2 +1,16 @@
1
- export {};
1
+ import { LitElement } from 'lit';
2
+ export declare class SimpleButton extends LitElement {
3
+ static shadowRootOptions: {
4
+ mode: "open";
5
+ delegatesFocus?: boolean;
6
+ serializable?: boolean;
7
+ slotAssignment?: SlotAssignmentMode;
8
+ };
9
+ label: string;
10
+ size: 'small' | 'medium' | 'large';
11
+ type: 'filled' | 'outlined';
12
+ static styles: import("lit").CSSResult;
13
+ _handleClick(): void;
14
+ render(): import("lit").TemplateResult<1>;
15
+ }
2
16
  //# sourceMappingURL=button.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/web-components/button.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/web-components/button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAI5C,qBAAa,YAAa,SAAQ,UAAU;IAC1C,MAAM,CAAC,iBAAiB;;;;;MAGwB;IAGhD,KAAK,SAAc;IAGnB,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAY;IAG9C,IAAI,EAAE,QAAQ,GAAG,UAAU,CAAY;IAEvC,MAAM,CAAC,MAAM,0BA6DX;IAEF,YAAY;IAKZ,MAAM;CAaP"}
@@ -1,41 +1,116 @@
1
- class MyButton extends HTMLElement {
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { LitElement, css, html } from 'lit';
11
+ import { classMap } from 'lit/directives/class-map.js';
12
+ import { property } from 'lit/decorators.js';
13
+ export class SimpleButton extends LitElement {
2
14
  constructor() {
3
- super();
4
- this.buttonText = this.querySelector('slot')
5
- .assignedNodes()[0]
6
- .textContent.trim();
7
- this.button = document.createElement('button');
8
- this.button.id = 'my-button';
9
- this.button.setAttribute('part', 'my-button');
10
- this.button.textContent = this.buttonText;
11
- this.button.addEventListener('click', this.handleClick.bind(this));
12
- // Apply the styles to the button
13
- this.applyStyles(this.button);
14
- // Append the button to the shadow DOM
15
- this.attachShadow({ mode: 'open' }).appendChild(this.button);
16
- }
17
- handleClick() {
15
+ super(...arguments);
16
+ this.label = 'Click me';
17
+ this.size = 'medium';
18
+ this.type = 'filled';
19
+ }
20
+ _handleClick() {
18
21
  console.log('Button clicked!');
22
+ this.dispatchEvent(new CustomEvent('button-click'));
19
23
  }
20
- applyStyles(element) {
21
- const style = document.createElement('style');
22
- style.textContent = `
23
- #my-button {
24
- background-color: #4CAF50;
25
- border: none;
26
- color: white;
27
- padding: 15px 32px;
28
- text-align: center;
29
- text-decoration: none;
30
- display: inline-block;
31
- font-size: 16px;
32
- margin: 4px 2px;
33
- cursor: pointer;
34
- }
24
+ render() {
25
+ const classes = {
26
+ button: true,
27
+ [`button--size-${this.size}`]: true,
28
+ [`button--type-${this.type}`]: true,
29
+ };
30
+ return html `
31
+ <button @click=${this._handleClick} class=${classMap(classes)}>
32
+ ${this.label}
33
+ </button>
35
34
  `;
36
- element.shadowRoot.appendChild(style);
37
35
  }
38
36
  }
39
- customElements.define('my-button', MyButton);
40
- export {};
37
+ SimpleButton.shadowRootOptions = {
38
+ ...LitElement.shadowRootOptions,
39
+ mode: 'open',
40
+ };
41
+ SimpleButton.styles = css `
42
+ .button {
43
+ border-radius: 4px;
44
+ border-radius: var(--radius-small);
45
+ border: 1px solid #7a34ed;
46
+ border: 1px solid var(--brand-color);
47
+ font-family: Inter;
48
+ font-family: var(--brand-font-family);
49
+ font-weight: 600;
50
+ transition: all 0.3s ease;
51
+ }
52
+
53
+ .button--size-small {
54
+ font-size: 12px;
55
+ padding-top: 4px;
56
+ padding-bottom: 4px;
57
+ padding-top: var(--spacing-xsmall);
58
+ padding-bottom: var(--spacing-xsmall);
59
+ padding-left: 12px;
60
+ padding-right: 12px;
61
+ padding-left: var(--spacing-medium);
62
+ padding-right: var(--spacing-medium);
63
+ }
64
+
65
+ .button--size-medium {
66
+ font-size: 14px;
67
+ padding-top: 8px;
68
+ padding-bottom: 8px;
69
+ padding-top: var(--spacing-small);
70
+ padding-bottom: var(--spacing-small);
71
+ padding-left: 16px;
72
+ padding-right: 16px;
73
+ padding-left: var(--spacing-large);
74
+ padding-right: var(--spacing-large);
75
+ }
76
+
77
+ .button--size-large {
78
+ font-size: 16px;
79
+ padding-top: 12px;
80
+ padding-bottom: 12px;
81
+ padding-top: var(--spacing-medium);
82
+ padding-bottom: var(--spacing-medium);
83
+ padding-left: 24px;
84
+ padding-right: 24px;
85
+ padding-left: var(--spacing-xlarge);
86
+ padding-right: var(--spacing-xlarge);
87
+ }
88
+
89
+ .button--type-outlined {
90
+ background-color: #ffffff;
91
+ background-color: var(--color-white);
92
+ color: #7a34ed;
93
+ color: var(--brand-color);
94
+ }
95
+
96
+ .button--type-filled {
97
+ background-color: #7a34ed;
98
+ background-color: var(--brand-color);
99
+ color: #ffffff;
100
+ color: var(--color-white);
101
+ }
102
+ `;
103
+ __decorate([
104
+ property({ type: String }),
105
+ __metadata("design:type", Object)
106
+ ], SimpleButton.prototype, "label", void 0);
107
+ __decorate([
108
+ property({ type: String }),
109
+ __metadata("design:type", String)
110
+ ], SimpleButton.prototype, "size", void 0);
111
+ __decorate([
112
+ property({ type: String }),
113
+ __metadata("design:type", String)
114
+ ], SimpleButton.prototype, "type", void 0);
115
+ customElements.define('simple-button', SimpleButton);
41
116
  //# sourceMappingURL=button.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"button.js","sourceRoot":"","sources":["../../src/web-components/button.ts"],"names":[],"mappings":"AAAA,MAAM,QAAS,SAAQ,WAAW;IAGhC;QACE,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;aACzC,aAAa,EAAE,CAAC,CAAC,CAAC;aAClB,WAAW,CAAC,IAAI,EAAE,CAAC;QAEtB,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAC/C,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,WAAW,CAAC;QAC7B,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QAC9C,IAAI,CAAC,MAAM,CAAC,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC;QAC1C,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAEnE,iCAAiC;QACjC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAE9B,sCAAsC;QACtC,IAAI,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC/D,CAAC;IAED,WAAW;QACT,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACjC,CAAC;IAED,WAAW,CAAC,OAAoB;QAC9B,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAC9C,KAAK,CAAC,WAAW,GAAG;;;;;;;;;;;;;KAanB,CAAC;QACF,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC;CACF;AAED,cAAc,CAAC,MAAM,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC"}
1
+ {"version":3,"file":"button.js","sourceRoot":"","sources":["../../src/web-components/button.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,MAAM,OAAO,YAAa,SAAQ,UAAU;IAA5C;;QAOE,UAAK,GAAG,UAAU,CAAC;QAGnB,SAAI,GAAiC,QAAQ,CAAC;QAG9C,SAAI,GAA0B,QAAQ,CAAC;IAmFzC,CAAC;IAlBC,YAAY;QACV,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QAC/B,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC;IACtD,CAAC;IAED,MAAM;QACJ,MAAM,OAAO,GAAG;YACd,MAAM,EAAE,IAAI;YACZ,CAAC,gBAAgB,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI;YACnC,CAAC,gBAAgB,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI;SACpC,CAAC;QAEF,OAAO,IAAI,CAAA;uBACQ,IAAI,CAAC,YAAY,UAAU,QAAQ,CAAC,OAAO,CAAC;UACzD,IAAI,CAAC,KAAK;;KAEf,CAAC;IACJ,CAAC;;AA9FM,8BAAiB,GAAG;IACzB,GAAG,UAAU,CAAC,iBAAiB;IAC/B,IAAI,EAAE,MAAM;CACiC,AAHvB,CAGwB;AAWzC,mBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DlB,AA7DY,CA6DX;AArEF;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;2CACR;AAGnB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;0CACmB;AAG9C;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;0CACY;AAqFzC,cAAc,CAAC,MAAM,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@knapsack/sandbox-components",
3
3
  "description": "",
4
- "version": "4.68.14--canary.4532.73337f0.0",
4
+ "version": "4.68.14--canary.4623.e51dcc2.0",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  "./css": "./dist/css/ks-sandbox-styles.css",
@@ -17,14 +17,18 @@
17
17
  "./vue/*": "./src/vue/*",
18
18
  "./web-components": {
19
19
  "types": "./dist/web-components/index.d.ts",
20
- "default": "./dist/web-components/index.js"
20
+ "default": "./dist/web-components/bundle.js"
21
21
  }
22
22
  },
23
- "sideEffects": false,
23
+ "sideEffects": [
24
+ "./src/web-components/*"
25
+ ],
24
26
  "scripts": {
25
27
  "build": "run-p build:*",
26
28
  "build:css": "postcss ./src/css/index.css --output ./dist/css/ks-sandbox-styles.css",
27
29
  "build:ts": "tsc",
30
+ "build:wc": "esbuild --bundle --outfile=./dist/web-components/bundle.js --format=esm --platform=browser --target=es2020 --loader:.js=jsx --loader:.svg=file --loader:.png=file --loader:.json=json ./src/web-components/index.ts",
31
+ "build:wc:type-info": "npx web-component-analyzer src/web-components --outFile dist/web-components/custom-elements.json",
28
32
  "clean": "rm -rf ./dist",
29
33
  "lint": "eslint ./",
30
34
  "start": "run-p watch:*",
@@ -32,18 +36,21 @@
32
36
  "watch:ts": "npm run build:ts -- --watch --preserveWatchOutput"
33
37
  },
34
38
  "dependencies": {
39
+ "@webcomponents/custom-elements": "^1.6.0",
35
40
  "clsx": "^2.1.1",
41
+ "lit": "^2.7.0",
36
42
  "react": "^18.3.1",
37
43
  "vue": "^3.4.27"
38
44
  },
39
45
  "devDependencies": {
40
- "@knapsack/eslint-config-starter": "4.68.14--canary.4532.73337f0.0",
41
- "@knapsack/postcss-config-starter": "4.68.14--canary.4532.73337f0.0",
42
- "@knapsack/prettier-config": "4.68.14--canary.4532.73337f0.0",
43
- "@knapsack/sandbox-tokens": "4.68.14--canary.4532.73337f0.0",
44
- "@knapsack/typescript-config-starter": "4.68.14--canary.4532.73337f0.0",
46
+ "@knapsack/eslint-config-starter": "4.68.14--canary.4623.e51dcc2.0",
47
+ "@knapsack/postcss-config-starter": "4.68.14--canary.4623.e51dcc2.0",
48
+ "@knapsack/prettier-config": "4.68.14--canary.4623.e51dcc2.0",
49
+ "@knapsack/sandbox-tokens": "4.68.14--canary.4623.e51dcc2.0",
50
+ "@knapsack/typescript-config-starter": "4.68.14--canary.4623.e51dcc2.0",
45
51
  "@types/node": "^20.16.1",
46
52
  "@types/react": "^18.3.3",
53
+ "esbuild": "^0.20.2",
47
54
  "eslint": "^8.57.0",
48
55
  "npm-run-all2": "^5.0.2",
49
56
  "postcss-cli": "^9.1.0",
@@ -59,5 +66,5 @@
59
66
  "directory": "apps/ui/libs/sandbox-components",
60
67
  "type": "git"
61
68
  },
62
- "gitHead": "73337f05d70f64e83c732d6a0d06c087f2b24688"
69
+ "gitHead": "e51dcc2edbf13b5685c98e0951680e69505d4bb7"
63
70
  }
@@ -1,48 +1,103 @@
1
- class MyButton extends HTMLElement {
2
- buttonText: string;
3
- button: HTMLButtonElement;
4
- constructor() {
5
- super();
6
-
7
- this.buttonText = this.querySelector('slot')
8
- .assignedNodes()[0]
9
- .textContent.trim();
10
-
11
- this.button = document.createElement('button');
12
- this.button.id = 'my-button';
13
- this.button.setAttribute('part', 'my-button');
14
- this.button.textContent = this.buttonText;
15
- this.button.addEventListener('click', this.handleClick.bind(this));
16
-
17
- // Apply the styles to the button
18
- this.applyStyles(this.button);
19
-
20
- // Append the button to the shadow DOM
21
- this.attachShadow({ mode: 'open' }).appendChild(this.button);
22
- }
1
+ import { LitElement, css, html } from 'lit';
2
+ import { classMap } from 'lit/directives/class-map.js';
3
+ import { property } from 'lit/decorators.js';
4
+
5
+ export class SimpleButton extends LitElement {
6
+ static shadowRootOptions = {
7
+ ...LitElement.shadowRootOptions,
8
+ mode: 'open',
9
+ } satisfies typeof LitElement.shadowRootOptions;
10
+
11
+ @property({ type: String })
12
+ label = 'Click me';
13
+
14
+ @property({ type: String })
15
+ size: 'small' | 'medium' | 'large' = 'medium';
16
+
17
+ @property({ type: String })
18
+ type: 'filled' | 'outlined' = 'filled';
19
+
20
+ static styles = css`
21
+ .button {
22
+ border-radius: 4px;
23
+ border-radius: var(--radius-small);
24
+ border: 1px solid #7a34ed;
25
+ border: 1px solid var(--brand-color);
26
+ font-family: Inter;
27
+ font-family: var(--brand-font-family);
28
+ font-weight: 600;
29
+ transition: all 0.3s ease;
30
+ }
23
31
 
24
- handleClick() {
32
+ .button--size-small {
33
+ font-size: 12px;
34
+ padding-top: 4px;
35
+ padding-bottom: 4px;
36
+ padding-top: var(--spacing-xsmall);
37
+ padding-bottom: var(--spacing-xsmall);
38
+ padding-left: 12px;
39
+ padding-right: 12px;
40
+ padding-left: var(--spacing-medium);
41
+ padding-right: var(--spacing-medium);
42
+ }
43
+
44
+ .button--size-medium {
45
+ font-size: 14px;
46
+ padding-top: 8px;
47
+ padding-bottom: 8px;
48
+ padding-top: var(--spacing-small);
49
+ padding-bottom: var(--spacing-small);
50
+ padding-left: 16px;
51
+ padding-right: 16px;
52
+ padding-left: var(--spacing-large);
53
+ padding-right: var(--spacing-large);
54
+ }
55
+
56
+ .button--size-large {
57
+ font-size: 16px;
58
+ padding-top: 12px;
59
+ padding-bottom: 12px;
60
+ padding-top: var(--spacing-medium);
61
+ padding-bottom: var(--spacing-medium);
62
+ padding-left: 24px;
63
+ padding-right: 24px;
64
+ padding-left: var(--spacing-xlarge);
65
+ padding-right: var(--spacing-xlarge);
66
+ }
67
+
68
+ .button--type-outlined {
69
+ background-color: #ffffff;
70
+ background-color: var(--color-white);
71
+ color: #7a34ed;
72
+ color: var(--brand-color);
73
+ }
74
+
75
+ .button--type-filled {
76
+ background-color: #7a34ed;
77
+ background-color: var(--brand-color);
78
+ color: #ffffff;
79
+ color: var(--color-white);
80
+ }
81
+ `;
82
+
83
+ _handleClick() {
25
84
  console.log('Button clicked!');
85
+ this.dispatchEvent(new CustomEvent('button-click'));
26
86
  }
27
87
 
28
- applyStyles(element: HTMLElement) {
29
- const style = document.createElement('style');
30
- style.textContent = `
31
- #my-button {
32
- background-color: #4CAF50;
33
- border: none;
34
- color: white;
35
- padding: 15px 32px;
36
- text-align: center;
37
- text-decoration: none;
38
- display: inline-block;
39
- font-size: 16px;
40
- margin: 4px 2px;
41
- cursor: pointer;
42
- }
88
+ render() {
89
+ const classes = {
90
+ button: true,
91
+ [`button--size-${this.size}`]: true,
92
+ [`button--type-${this.type}`]: true,
93
+ };
94
+
95
+ return html`
96
+ <button @click=${this._handleClick} class=${classMap(classes)}>
97
+ ${this.label}
98
+ </button>
43
99
  `;
44
- element.shadowRoot.appendChild(style);
45
100
  }
46
101
  }
47
102
 
48
- customElements.define('my-button', MyButton);
103
+ customElements.define('simple-button', SimpleButton);
package/tsconfig.json CHANGED
@@ -3,7 +3,10 @@
3
3
  "compilerOptions": {
4
4
  "noImplicitAny": true,
5
5
  "lib": ["es2020", "dom"],
6
- "outDir": "./dist"
6
+ "outDir": "./dist",
7
+ "emitDecoratorMetadata": true,
8
+ "experimentalDecorators": true,
9
+ "useDefineForClassFields": false
7
10
  },
8
11
  "include": ["./src"]
9
12
  }