@webstrail/ui-library 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +524 -519
  2. package/dist/UIProvider-C3ae0nQV.cjs +2 -0
  3. package/dist/UIProvider-C3ae0nQV.cjs.map +1 -0
  4. package/dist/UIProvider-CHECrDaZ.js +466 -0
  5. package/dist/UIProvider-CHECrDaZ.js.map +1 -0
  6. package/dist/core/config/globalConfig.d.ts +54 -0
  7. package/dist/core/config/index.d.ts +1 -0
  8. package/dist/core/index.d.ts +4 -0
  9. package/dist/core/theme/defaultTheme.d.ts +7 -0
  10. package/dist/core/theme/deriveTokens.d.ts +16 -0
  11. package/dist/core/theme/index.d.ts +2 -0
  12. package/dist/core/types/common.d.ts +32 -0
  13. package/dist/core/types/config.d.ts +70 -0
  14. package/dist/core/types/index.d.ts +3 -0
  15. package/dist/core/types/tokens.d.ts +65 -0
  16. package/dist/core/utils/styles.d.ts +19 -0
  17. package/dist/core.cjs +2 -0
  18. package/dist/core.cjs.map +1 -0
  19. package/dist/core.js +344 -0
  20. package/dist/core.js.map +1 -0
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.ts +6 -4
  24. package/dist/index.js +817 -1248
  25. package/dist/index.js.map +1 -1
  26. package/dist/react/components/Button/Button.d.ts +2 -0
  27. package/dist/react/components/Button/Button.types.d.ts +52 -0
  28. package/dist/react/components/Button/index.d.ts +2 -0
  29. package/dist/react/index.d.ts +6 -0
  30. package/dist/react.cjs +2 -0
  31. package/dist/react.cjs.map +1 -0
  32. package/dist/react.js +9 -0
  33. package/dist/react.js.map +1 -0
  34. package/dist/style.css +1 -1
  35. package/dist/web-components/button/button.element.d.ts +59 -0
  36. package/dist/web-components/button/button.styles.d.ts +1 -0
  37. package/dist/web-components/button/button.types.d.ts +21 -0
  38. package/dist/web-components/button/index.d.ts +3 -0
  39. package/dist/web-components/index.d.ts +1 -0
  40. package/dist/web-components.cjs +269 -0
  41. package/dist/web-components.cjs.map +1 -0
  42. package/dist/web-components.js +503 -0
  43. package/dist/web-components.js.map +1 -0
  44. package/package.json +120 -104
@@ -0,0 +1,503 @@
1
+ var p = Object.defineProperty;
2
+ var g = (a, i, t) => i in a ? p(a, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[i] = t;
3
+ var n = (a, i, t) => g(a, typeof i != "symbol" ? i + "" : i, t);
4
+ import { subscribeWebstrailConfig as v, getWebstrailConfig as d, normalizeButtonSize as u, resolveEffectiveButtonConfig as m } from "./core.js";
5
+ const f = `
6
+ :host {
7
+ display: inline-block;
8
+ vertical-align: middle;
9
+ box-sizing: border-box;
10
+ font-family: var(
11
+ --wb-button-font-family,
12
+ var(
13
+ --wui-button-font-family,
14
+ var(
15
+ --wui-font-family,
16
+ system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif
17
+ )
18
+ )
19
+ );
20
+ outline: none;
21
+ }
22
+
23
+ :host([full-width]),
24
+ :host([fullwidth]) {
25
+ display: block;
26
+ width: 100%;
27
+ }
28
+
29
+ :host([hidden]) {
30
+ display: none !important;
31
+ }
32
+
33
+ *, *::before, *::after {
34
+ box-sizing: border-box;
35
+ }
36
+
37
+ .button {
38
+ display: inline-flex;
39
+ align-items: center;
40
+ justify-content: center;
41
+ gap: 8px;
42
+ position: relative;
43
+ font-family: inherit;
44
+ font-size: var(--wb-button-font-size, var(--wui-button-font-size, 14px));
45
+ font-weight: var(--wb-button-font-weight, var(--wui-button-font-weight, 500));
46
+ line-height: 1;
47
+ text-decoration: none;
48
+ white-space: nowrap;
49
+ vertical-align: middle;
50
+ cursor: pointer;
51
+ user-select: none;
52
+ border: 1px solid transparent;
53
+ border-radius: var(--wb-button-radius, var(--wb-button-border-radius, var(--wui-button-border-radius, 8px)));
54
+ padding: var(--wb-button-padding, var(--wui-button-padding, 0 16px));
55
+ height: var(--wb-button-height, var(--wui-button-height, 40px));
56
+ transition: var(--wb-button-transition, var(--wui-button-transition, all 0.15s ease-in-out));
57
+ outline: none;
58
+ width: 100%;
59
+ }
60
+
61
+ :host(:not([full-width]):not([fullwidth])) .button {
62
+ width: auto;
63
+ }
64
+
65
+ .button:focus-visible {
66
+ box-shadow: var(--wb-button-focus-shadow, var(--wui-button-focus-shadow, 0 0 0 3px var(--wb-button-focus-ring, var(--wui-button-focus-ring-color, rgba(36, 145, 235, 0.35)))));
67
+ }
68
+
69
+ /* Sizes */
70
+ .sizeSmall {
71
+ height: var(--wb-button-height-sm, 32px);
72
+ padding: var(--wb-button-padding-sm, 0 12px);
73
+ font-size: var(--wb-button-font-size-sm, 12px);
74
+ gap: 6px;
75
+ }
76
+
77
+ .sizeMedium {
78
+ height: var(--wb-button-height, var(--wui-button-height, 40px));
79
+ padding: var(--wb-button-padding, var(--wui-button-padding, 0 16px));
80
+ font-size: var(--wb-button-font-size, var(--wui-button-font-size, 14px));
81
+ gap: 8px;
82
+ }
83
+
84
+ .sizeLarge {
85
+ height: var(--wb-button-height-lg, 48px);
86
+ padding: var(--wb-button-padding-lg, 0 24px);
87
+ font-size: var(--wb-button-font-size-lg, 16px);
88
+ gap: 10px;
89
+ }
90
+
91
+ /* Variants */
92
+ .variantPrimary {
93
+ background-color: var(--wb-button-primary, var(--wb-button-background-color, var(--wui-button-background-color, #2491eb)));
94
+ color: var(--wb-button-text-color, var(--wui-button-text-color, #ffffff));
95
+ border-color: var(--wb-button-border-color, var(--wui-button-border-color, transparent));
96
+ }
97
+
98
+ .variantPrimary:hover:not(:disabled):not(.loading) {
99
+ background-color: var(
100
+ --wb-button-hover-background-color,
101
+ var(
102
+ --wui-button-hover-background-color,
103
+ color-mix(in srgb, var(--wb-button-primary, var(--wb-button-background-color, var(--wui-button-background-color, #2491eb))) 88%, #000000)
104
+ )
105
+ );
106
+ color: var(--wb-button-hover-text-color, var(--wui-button-hover-text-color, #ffffff));
107
+ }
108
+
109
+ .variantPrimary:active:not(:disabled):not(.loading) {
110
+ background-color: var(
111
+ --wb-button-active-background-color,
112
+ var(
113
+ --wui-button-active-background-color,
114
+ color-mix(in srgb, var(--wb-button-primary, var(--wb-button-background-color, var(--wui-button-background-color, #2491eb))) 78%, #000000)
115
+ )
116
+ );
117
+ }
118
+
119
+ .variantSecondary {
120
+ background-color: var(--wb-button-secondary, var(--wb-button-secondary-background-color, #406993));
121
+ color: #ffffff;
122
+ border-color: transparent;
123
+ }
124
+
125
+ .variantSecondary:hover:not(:disabled):not(.loading) {
126
+ background-color: var(--wb-button-secondary-hover-background-color, #345679);
127
+ }
128
+
129
+ .variantSecondary:active:not(:disabled):not(.loading) {
130
+ background-color: var(--wb-button-secondary-active-background-color, #284460);
131
+ }
132
+
133
+ .variantOutline {
134
+ background-color: transparent;
135
+ color: var(
136
+ --wb-button-outline-color,
137
+ var(
138
+ --wui-button-outline-color,
139
+ var(--wb-button-primary, var(--wb-button-background-color, var(--wui-button-background-color, var(--wui-color-primary, #2491eb))))
140
+ )
141
+ );
142
+ border: 1.5px solid
143
+ var(
144
+ --wb-button-outline-border-color,
145
+ var(
146
+ --wui-button-outline-border-color,
147
+ var(--wb-button-primary, var(--wb-button-background-color, var(--wui-button-background-color, var(--wui-color-primary, #2491eb))))
148
+ )
149
+ );
150
+ }
151
+
152
+ .variantOutline:hover:not(:disabled):not(.loading) {
153
+ background-color: var(
154
+ --wb-button-outline-hover-background-color,
155
+ var(
156
+ --wui-button-outline-hover-background-color,
157
+ color-mix(in srgb, var(--wb-button-primary, var(--wb-button-background-color, var(--wui-button-background-color, #2491eb))) 10%, transparent)
158
+ )
159
+ );
160
+ }
161
+
162
+ .variantOutline:active:not(:disabled):not(.loading) {
163
+ background-color: color-mix(
164
+ in srgb,
165
+ var(--wb-button-primary, var(--wb-button-background-color, var(--wui-button-background-color, #2491eb))) 18%,
166
+ transparent
167
+ );
168
+ }
169
+
170
+ .variantGhost {
171
+ background-color: transparent;
172
+ color: var(
173
+ --wb-button-ghost-color,
174
+ var(
175
+ --wui-button-ghost-color,
176
+ var(--wb-button-primary, var(--wb-button-background-color, var(--wui-button-background-color, var(--wui-color-primary, #2491eb))))
177
+ )
178
+ );
179
+ border-color: transparent;
180
+ }
181
+
182
+ .variantGhost:hover:not(:disabled):not(.loading) {
183
+ background-color: var(
184
+ --wb-button-ghost-hover-background-color,
185
+ var(
186
+ --wui-button-ghost-hover-background-color,
187
+ color-mix(in srgb, var(--wb-button-primary, var(--wb-button-background-color, var(--wui-button-background-color, #2491eb))) 10%, transparent)
188
+ )
189
+ );
190
+ }
191
+
192
+ .variantGhost:active:not(:disabled):not(.loading) {
193
+ background-color: color-mix(
194
+ in srgb,
195
+ var(--wb-button-primary, var(--wb-button-background-color, var(--wui-button-background-color, #2491eb))) 18%,
196
+ transparent
197
+ );
198
+ }
199
+
200
+ .variantDanger {
201
+ background-color: var(--wb-button-danger, #dc2626);
202
+ color: #ffffff;
203
+ border-color: transparent;
204
+ }
205
+
206
+ .variantDanger:hover:not(:disabled):not(.loading) {
207
+ background-color: var(--wb-button-danger-hover, #b91c1c);
208
+ }
209
+
210
+ .variantDanger:active:not(:disabled):not(.loading) {
211
+ background-color: var(--wb-button-danger-active, #991b1b);
212
+ }
213
+
214
+ /* Full Width */
215
+ .fullWidth {
216
+ width: 100%;
217
+ }
218
+
219
+ /* Disabled */
220
+ .disabled,
221
+ .button:disabled {
222
+ cursor: not-allowed;
223
+ opacity: 0.65;
224
+ background-color: var(--wb-button-disabled-background-color, var(--wui-button-disabled-background-color, #f3f4f6));
225
+ color: var(--wb-button-disabled-text-color, var(--wui-button-disabled-text-color, #9ca3af));
226
+ border-color: var(--wb-button-disabled-border-color, var(--wui-button-disabled-border-color, #e5e7eb));
227
+ box-shadow: none;
228
+ }
229
+
230
+ /* Loading */
231
+ .loading {
232
+ cursor: wait;
233
+ pointer-events: none;
234
+ }
235
+
236
+ /* Spinner */
237
+ .spinner {
238
+ display: inline-block;
239
+ width: 1em;
240
+ height: 1em;
241
+ border: 2px solid currentColor;
242
+ border-right-color: transparent;
243
+ border-radius: 50%;
244
+ animation: spin 0.75s linear infinite;
245
+ }
246
+
247
+ .icon {
248
+ display: inline-flex;
249
+ align-items: center;
250
+ justify-content: center;
251
+ flex-shrink: 0;
252
+ font-size: 1.1em;
253
+ }
254
+
255
+ .label {
256
+ display: inline-flex;
257
+ align-items: center;
258
+ }
259
+
260
+ .hidden {
261
+ display: none !important;
262
+ }
263
+
264
+ @keyframes spin {
265
+ from {
266
+ transform: rotate(0deg);
267
+ }
268
+ to {
269
+ transform: rotate(360deg);
270
+ }
271
+ }
272
+ `;
273
+ class b extends HTMLElement {
274
+ constructor() {
275
+ super();
276
+ n(this, "_internals");
277
+ n(this, "_buttonElement");
278
+ n(this, "_spinnerElement");
279
+ n(this, "_startIconWrapper");
280
+ n(this, "_startIconSlot");
281
+ n(this, "_endIconWrapper");
282
+ n(this, "_endIconSlot");
283
+ n(this, "_labelWrapper");
284
+ n(this, "_defaultSlot");
285
+ n(this, "_unsubscribeConfig");
286
+ n(this, "_stylesObj");
287
+ if (typeof this.attachInternals == "function")
288
+ try {
289
+ this._internals = this.attachInternals();
290
+ } catch {
291
+ }
292
+ const t = this.attachShadow({ mode: "open", delegatesFocus: !0 }), e = document.createElement("style");
293
+ e.textContent = f, t.appendChild(e), this._buttonElement = document.createElement("button"), this._buttonElement.setAttribute("part", "button"), this._buttonElement.className = "button", this._spinnerElement = document.createElement("span"), this._spinnerElement.setAttribute("part", "spinner"), this._spinnerElement.className = "spinner hidden", this._spinnerElement.setAttribute("aria-hidden", "true"), this._buttonElement.appendChild(this._spinnerElement), this._startIconWrapper = document.createElement("span"), this._startIconWrapper.setAttribute("part", "start-icon"), this._startIconWrapper.className = "icon hidden", this._startIconSlot = document.createElement("slot"), this._startIconSlot.name = "start-icon", this._startIconWrapper.appendChild(this._startIconSlot), this._buttonElement.appendChild(this._startIconWrapper), this._labelWrapper = document.createElement("span"), this._labelWrapper.setAttribute("part", "label"), this._labelWrapper.className = "label", this._defaultSlot = document.createElement("slot"), this._labelWrapper.appendChild(this._defaultSlot), this._buttonElement.appendChild(this._labelWrapper), this._endIconWrapper = document.createElement("span"), this._endIconWrapper.setAttribute("part", "end-icon"), this._endIconWrapper.className = "icon hidden", this._endIconSlot = document.createElement("slot"), this._endIconSlot.name = "end-icon", this._endIconWrapper.appendChild(this._endIconSlot), this._buttonElement.appendChild(this._endIconWrapper), t.appendChild(this._buttonElement), this._startIconSlot.addEventListener("slotchange", () => this._handleSlotChange()), this._endIconSlot.addEventListener("slotchange", () => this._handleSlotChange()), this._buttonElement.addEventListener("click", (o) => this._handleInternalClick(o)), this.addEventListener(
294
+ "click",
295
+ (o) => {
296
+ (this.disabled || this.loading) && (o.preventDefault(), o.stopImmediatePropagation());
297
+ },
298
+ !0
299
+ ), this.addEventListener("keydown", (o) => {
300
+ (o.key === "Enter" || o.key === " ") && (this.disabled || this.loading) && (o.preventDefault(), o.stopImmediatePropagation());
301
+ });
302
+ }
303
+ static get observedAttributes() {
304
+ return [
305
+ "variant",
306
+ "size",
307
+ "disabled",
308
+ "loading",
309
+ "loading-text",
310
+ "loadingtext",
311
+ "label",
312
+ "full-width",
313
+ "fullwidth",
314
+ "type",
315
+ "styles"
316
+ ];
317
+ }
318
+ connectedCallback() {
319
+ this._unsubscribeConfig = v(() => {
320
+ this._render();
321
+ }), this._handleSlotChange(), this._render();
322
+ }
323
+ disconnectedCallback() {
324
+ this._unsubscribeConfig && (this._unsubscribeConfig(), this._unsubscribeConfig = void 0);
325
+ }
326
+ attributeChangedCallback(t, e, o) {
327
+ e !== o && this._render();
328
+ }
329
+ /* ------------------- Properties (Getters / Setters) ------------------- */
330
+ get variant() {
331
+ const t = this.getAttribute("variant");
332
+ return t || d().components.button.variant || "primary";
333
+ }
334
+ set variant(t) {
335
+ t ? this.setAttribute("variant", t) : this.removeAttribute("variant");
336
+ }
337
+ get size() {
338
+ const t = this.getAttribute("size");
339
+ return t ? u(t) : u(d().components.button.size);
340
+ }
341
+ set size(t) {
342
+ t ? this.setAttribute("size", t) : this.removeAttribute("size");
343
+ }
344
+ get disabled() {
345
+ return this.hasAttribute("disabled");
346
+ }
347
+ set disabled(t) {
348
+ t ? this.setAttribute("disabled", "") : this.removeAttribute("disabled");
349
+ }
350
+ get loading() {
351
+ return this.hasAttribute("loading");
352
+ }
353
+ set loading(t) {
354
+ t ? this.setAttribute("loading", "") : this.removeAttribute("loading");
355
+ }
356
+ get loadingText() {
357
+ return this.getAttribute("loading-text") || this.getAttribute("loadingtext");
358
+ }
359
+ set loadingText(t) {
360
+ t != null ? this.setAttribute("loading-text", t) : (this.removeAttribute("loading-text"), this.removeAttribute("loadingtext"));
361
+ }
362
+ get label() {
363
+ return this.getAttribute("label");
364
+ }
365
+ set label(t) {
366
+ t != null ? this.setAttribute("label", t) : this.removeAttribute("label");
367
+ }
368
+ get fullWidth() {
369
+ return this.hasAttribute("full-width") || this.hasAttribute("fullwidth");
370
+ }
371
+ set fullWidth(t) {
372
+ t ? this.setAttribute("full-width", "") : (this.removeAttribute("full-width"), this.removeAttribute("fullwidth"));
373
+ }
374
+ get type() {
375
+ const t = this.getAttribute("type");
376
+ return t === "submit" || t === "reset" ? t : "button";
377
+ }
378
+ set type(t) {
379
+ this.setAttribute("type", t);
380
+ }
381
+ get styles() {
382
+ if (this._stylesObj) return this._stylesObj;
383
+ const t = this.getAttribute("styles");
384
+ if (t)
385
+ try {
386
+ return JSON.parse(t);
387
+ } catch {
388
+ return;
389
+ }
390
+ }
391
+ set styles(t) {
392
+ if (typeof t == "object" && t !== null)
393
+ this._stylesObj = t, this.setAttribute("styles", JSON.stringify(t));
394
+ else if (typeof t == "string") {
395
+ try {
396
+ this._stylesObj = JSON.parse(t);
397
+ } catch {
398
+ this._stylesObj = void 0;
399
+ }
400
+ this.setAttribute("styles", t);
401
+ } else
402
+ this._stylesObj = void 0, this.removeAttribute("styles");
403
+ }
404
+ /**
405
+ * Reference to inner button for focus/blur integration.
406
+ */
407
+ get button() {
408
+ return this._buttonElement;
409
+ }
410
+ focus(t) {
411
+ var e;
412
+ (e = this._buttonElement) == null || e.focus(t);
413
+ }
414
+ blur() {
415
+ var t;
416
+ (t = this._buttonElement) == null || t.blur();
417
+ }
418
+ /* ------------------- Slot Change Detection ------------------- */
419
+ _handleSlotChange() {
420
+ const e = this._startIconSlot.assignedNodes({ flatten: !0 }).filter(
421
+ (r) => r.nodeType === Node.ELEMENT_NODE || r.textContent && r.textContent.trim().length > 0
422
+ ).length > 0, l = this._endIconSlot.assignedNodes({ flatten: !0 }).filter(
423
+ (r) => r.nodeType === Node.ELEMENT_NODE || r.textContent && r.textContent.trim().length > 0
424
+ ).length > 0;
425
+ !this.loading && e ? this._startIconWrapper.classList.remove("hidden") : this._startIconWrapper.classList.add("hidden"), !this.loading && l ? this._endIconWrapper.classList.remove("hidden") : this._endIconWrapper.classList.add("hidden");
426
+ }
427
+ /* ------------------- Event & Form Handling ------------------- */
428
+ _handleInternalClick(t) {
429
+ if (this.disabled || this.loading) {
430
+ t.preventDefault(), t.stopImmediatePropagation();
431
+ return;
432
+ }
433
+ const e = new CustomEvent("wb-click", {
434
+ bubbles: !0,
435
+ composed: !0,
436
+ cancelable: !0,
437
+ detail: {
438
+ originalEvent: t,
439
+ target: this,
440
+ variant: this.variant,
441
+ size: this.size
442
+ }
443
+ });
444
+ if (!this.dispatchEvent(e)) {
445
+ t.preventDefault();
446
+ return;
447
+ }
448
+ this.type === "submit" ? this._submitAssociatedForm() : this.type === "reset" && this._resetAssociatedForm();
449
+ }
450
+ _submitAssociatedForm() {
451
+ var e;
452
+ const t = ((e = this._internals) == null ? void 0 : e.form) || this.closest("form");
453
+ if (t)
454
+ if (typeof t.requestSubmit == "function")
455
+ t.requestSubmit();
456
+ else {
457
+ const o = document.createElement("button");
458
+ o.type = "submit", o.style.display = "none", t.appendChild(o), o.click(), t.removeChild(o);
459
+ }
460
+ }
461
+ _resetAssociatedForm() {
462
+ var e;
463
+ const t = ((e = this._internals) == null ? void 0 : e.form) || this.closest("form");
464
+ t && t.reset();
465
+ }
466
+ /* ------------------- Render Method ------------------- */
467
+ _render() {
468
+ const t = m({
469
+ variant: this.getAttribute("variant") || void 0,
470
+ size: this.getAttribute("size") || void 0,
471
+ fullWidth: this.fullWidth,
472
+ styles: this.styles
473
+ }), e = this.disabled || this.loading;
474
+ for (const [c, h] of Object.entries(t.cssVars))
475
+ this.style.setProperty(c, h);
476
+ const l = {
477
+ small: "sizeSmall",
478
+ medium: "sizeMedium",
479
+ large: "sizeLarge",
480
+ sm: "sizeSmall",
481
+ md: "sizeMedium",
482
+ lg: "sizeLarge"
483
+ }[t.size] || "sizeMedium", r = {
484
+ primary: "variantPrimary",
485
+ secondary: "variantSecondary",
486
+ outline: "variantOutline",
487
+ ghost: "variantGhost",
488
+ danger: "variantDanger"
489
+ }[t.variant] || "variantPrimary", s = ["button", l, r];
490
+ t.fullWidth && s.push("fullWidth"), e && s.push("disabled"), this.loading && s.push("loading"), this._buttonElement.className = s.join(" "), this._buttonElement.type = this.type, this._buttonElement.disabled = e, this.loading ? this._buttonElement.setAttribute("aria-busy", "true") : this._buttonElement.removeAttribute("aria-busy"), e ? this._buttonElement.setAttribute("aria-disabled", "true") : this._buttonElement.removeAttribute("aria-disabled"), this.loading ? (this._spinnerElement.classList.remove("hidden"), this._startIconWrapper.classList.add("hidden"), this._endIconWrapper.classList.add("hidden")) : (this._spinnerElement.classList.add("hidden"), this._handleSlotChange()), this.loading && this.loadingText ? this._labelWrapper.textContent = this.loadingText : this.label !== null && this.label !== void 0 ? this._labelWrapper.textContent = this.label : this._labelWrapper.firstChild !== this._defaultSlot && this._labelWrapper.replaceChildren(this._defaultSlot);
491
+ }
492
+ }
493
+ n(b, "formAssociated", !0);
494
+ function y() {
495
+ typeof customElements < "u" && !customElements.get("wb-button") && customElements.define("wb-button", b);
496
+ }
497
+ typeof customElements < "u" && !customElements.get("wb-button") && customElements.define("wb-button", b);
498
+ export {
499
+ b as WbButton,
500
+ f as buttonStyles,
501
+ y as registerWbButton
502
+ };
503
+ //# sourceMappingURL=web-components.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-components.js","sources":["../src/web-components/button/button.styles.ts","../src/web-components/button/button.element.ts"],"sourcesContent":["export const buttonStyles = `\n:host {\n display: inline-block;\n vertical-align: middle;\n box-sizing: border-box;\n font-family: var(\n --wb-button-font-family,\n var(\n --wui-button-font-family,\n var(\n --wui-font-family,\n system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif\n )\n )\n );\n outline: none;\n}\n\n:host([full-width]),\n:host([fullwidth]) {\n display: block;\n width: 100%;\n}\n\n:host([hidden]) {\n display: none !important;\n}\n\n*, *::before, *::after {\n box-sizing: border-box;\n}\n\n.button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n position: relative;\n font-family: inherit;\n font-size: var(--wb-button-font-size, var(--wui-button-font-size, 14px));\n font-weight: var(--wb-button-font-weight, var(--wui-button-font-weight, 500));\n line-height: 1;\n text-decoration: none;\n white-space: nowrap;\n vertical-align: middle;\n cursor: pointer;\n user-select: none;\n border: 1px solid transparent;\n border-radius: var(--wb-button-radius, var(--wb-button-border-radius, var(--wui-button-border-radius, 8px)));\n padding: var(--wb-button-padding, var(--wui-button-padding, 0 16px));\n height: var(--wb-button-height, var(--wui-button-height, 40px));\n transition: var(--wb-button-transition, var(--wui-button-transition, all 0.15s ease-in-out));\n outline: none;\n width: 100%;\n}\n\n:host(:not([full-width]):not([fullwidth])) .button {\n width: auto;\n}\n\n.button:focus-visible {\n box-shadow: var(--wb-button-focus-shadow, var(--wui-button-focus-shadow, 0 0 0 3px var(--wb-button-focus-ring, var(--wui-button-focus-ring-color, rgba(36, 145, 235, 0.35)))));\n}\n\n/* Sizes */\n.sizeSmall {\n height: var(--wb-button-height-sm, 32px);\n padding: var(--wb-button-padding-sm, 0 12px);\n font-size: var(--wb-button-font-size-sm, 12px);\n gap: 6px;\n}\n\n.sizeMedium {\n height: var(--wb-button-height, var(--wui-button-height, 40px));\n padding: var(--wb-button-padding, var(--wui-button-padding, 0 16px));\n font-size: var(--wb-button-font-size, var(--wui-button-font-size, 14px));\n gap: 8px;\n}\n\n.sizeLarge {\n height: var(--wb-button-height-lg, 48px);\n padding: var(--wb-button-padding-lg, 0 24px);\n font-size: var(--wb-button-font-size-lg, 16px);\n gap: 10px;\n}\n\n/* Variants */\n.variantPrimary {\n background-color: var(--wb-button-primary, var(--wb-button-background-color, var(--wui-button-background-color, #2491eb)));\n color: var(--wb-button-text-color, var(--wui-button-text-color, #ffffff));\n border-color: var(--wb-button-border-color, var(--wui-button-border-color, transparent));\n}\n\n.variantPrimary:hover:not(:disabled):not(.loading) {\n background-color: var(\n --wb-button-hover-background-color,\n var(\n --wui-button-hover-background-color,\n color-mix(in srgb, var(--wb-button-primary, var(--wb-button-background-color, var(--wui-button-background-color, #2491eb))) 88%, #000000)\n )\n );\n color: var(--wb-button-hover-text-color, var(--wui-button-hover-text-color, #ffffff));\n}\n\n.variantPrimary:active:not(:disabled):not(.loading) {\n background-color: var(\n --wb-button-active-background-color,\n var(\n --wui-button-active-background-color,\n color-mix(in srgb, var(--wb-button-primary, var(--wb-button-background-color, var(--wui-button-background-color, #2491eb))) 78%, #000000)\n )\n );\n}\n\n.variantSecondary {\n background-color: var(--wb-button-secondary, var(--wb-button-secondary-background-color, #406993));\n color: #ffffff;\n border-color: transparent;\n}\n\n.variantSecondary:hover:not(:disabled):not(.loading) {\n background-color: var(--wb-button-secondary-hover-background-color, #345679);\n}\n\n.variantSecondary:active:not(:disabled):not(.loading) {\n background-color: var(--wb-button-secondary-active-background-color, #284460);\n}\n\n.variantOutline {\n background-color: transparent;\n color: var(\n --wb-button-outline-color,\n var(\n --wui-button-outline-color,\n var(--wb-button-primary, var(--wb-button-background-color, var(--wui-button-background-color, var(--wui-color-primary, #2491eb))))\n )\n );\n border: 1.5px solid\n var(\n --wb-button-outline-border-color,\n var(\n --wui-button-outline-border-color,\n var(--wb-button-primary, var(--wb-button-background-color, var(--wui-button-background-color, var(--wui-color-primary, #2491eb))))\n )\n );\n}\n\n.variantOutline:hover:not(:disabled):not(.loading) {\n background-color: var(\n --wb-button-outline-hover-background-color,\n var(\n --wui-button-outline-hover-background-color,\n color-mix(in srgb, var(--wb-button-primary, var(--wb-button-background-color, var(--wui-button-background-color, #2491eb))) 10%, transparent)\n )\n );\n}\n\n.variantOutline:active:not(:disabled):not(.loading) {\n background-color: color-mix(\n in srgb,\n var(--wb-button-primary, var(--wb-button-background-color, var(--wui-button-background-color, #2491eb))) 18%,\n transparent\n );\n}\n\n.variantGhost {\n background-color: transparent;\n color: var(\n --wb-button-ghost-color,\n var(\n --wui-button-ghost-color,\n var(--wb-button-primary, var(--wb-button-background-color, var(--wui-button-background-color, var(--wui-color-primary, #2491eb))))\n )\n );\n border-color: transparent;\n}\n\n.variantGhost:hover:not(:disabled):not(.loading) {\n background-color: var(\n --wb-button-ghost-hover-background-color,\n var(\n --wui-button-ghost-hover-background-color,\n color-mix(in srgb, var(--wb-button-primary, var(--wb-button-background-color, var(--wui-button-background-color, #2491eb))) 10%, transparent)\n )\n );\n}\n\n.variantGhost:active:not(:disabled):not(.loading) {\n background-color: color-mix(\n in srgb,\n var(--wb-button-primary, var(--wb-button-background-color, var(--wui-button-background-color, #2491eb))) 18%,\n transparent\n );\n}\n\n.variantDanger {\n background-color: var(--wb-button-danger, #dc2626);\n color: #ffffff;\n border-color: transparent;\n}\n\n.variantDanger:hover:not(:disabled):not(.loading) {\n background-color: var(--wb-button-danger-hover, #b91c1c);\n}\n\n.variantDanger:active:not(:disabled):not(.loading) {\n background-color: var(--wb-button-danger-active, #991b1b);\n}\n\n/* Full Width */\n.fullWidth {\n width: 100%;\n}\n\n/* Disabled */\n.disabled,\n.button:disabled {\n cursor: not-allowed;\n opacity: 0.65;\n background-color: var(--wb-button-disabled-background-color, var(--wui-button-disabled-background-color, #f3f4f6));\n color: var(--wb-button-disabled-text-color, var(--wui-button-disabled-text-color, #9ca3af));\n border-color: var(--wb-button-disabled-border-color, var(--wui-button-disabled-border-color, #e5e7eb));\n box-shadow: none;\n}\n\n/* Loading */\n.loading {\n cursor: wait;\n pointer-events: none;\n}\n\n/* Spinner */\n.spinner {\n display: inline-block;\n width: 1em;\n height: 1em;\n border: 2px solid currentColor;\n border-right-color: transparent;\n border-radius: 50%;\n animation: spin 0.75s linear infinite;\n}\n\n.icon {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n font-size: 1.1em;\n}\n\n.label {\n display: inline-flex;\n align-items: center;\n}\n\n.hidden {\n display: none !important;\n}\n\n@keyframes spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}\n`;\n","import {\n normalizeButtonSize,\n type ButtonSize,\n type ButtonType,\n type ButtonVariant,\n type ComponentSize,\n} from '../../core/types/common';\nimport type { ButtonStyles } from '../../core/types/tokens';\nimport {\n getWebstrailConfig,\n resolveEffectiveButtonConfig,\n subscribeWebstrailConfig,\n} from '../../core/config/globalConfig';\nimport { buttonStyles } from './button.styles';\nimport type { WbClickEventDetail } from './button.types';\n\nexport class WbButton extends HTMLElement {\n static readonly formAssociated = true;\n\n private _internals?: ElementInternals;\n private _buttonElement!: HTMLButtonElement;\n private _spinnerElement!: HTMLElement;\n private _startIconWrapper!: HTMLElement;\n private _startIconSlot!: HTMLSlotElement;\n private _endIconWrapper!: HTMLElement;\n private _endIconSlot!: HTMLSlotElement;\n private _labelWrapper!: HTMLElement;\n private _defaultSlot!: HTMLSlotElement;\n private _unsubscribeConfig?: () => void;\n\n private _stylesObj?: ButtonStyles;\n\n static get observedAttributes(): string[] {\n return [\n 'variant',\n 'size',\n 'disabled',\n 'loading',\n 'loading-text',\n 'loadingtext',\n 'label',\n 'full-width',\n 'fullwidth',\n 'type',\n 'styles',\n ];\n }\n\n constructor() {\n super();\n\n if (typeof this.attachInternals === 'function') {\n try {\n this._internals = this.attachInternals();\n } catch {\n // ElementInternals may throw if not registered with formAssociated\n }\n }\n\n const shadow = this.attachShadow({ mode: 'open', delegatesFocus: true });\n\n // Inject styles\n const styleEl = document.createElement('style');\n styleEl.textContent = buttonStyles;\n shadow.appendChild(styleEl);\n\n // Build DOM structure\n this._buttonElement = document.createElement('button');\n this._buttonElement.setAttribute('part', 'button');\n this._buttonElement.className = 'button';\n\n // Spinner\n this._spinnerElement = document.createElement('span');\n this._spinnerElement.setAttribute('part', 'spinner');\n this._spinnerElement.className = 'spinner hidden';\n this._spinnerElement.setAttribute('aria-hidden', 'true');\n this._buttonElement.appendChild(this._spinnerElement);\n\n // Start icon wrapper and slot\n this._startIconWrapper = document.createElement('span');\n this._startIconWrapper.setAttribute('part', 'start-icon');\n this._startIconWrapper.className = 'icon hidden';\n this._startIconSlot = document.createElement('slot');\n this._startIconSlot.name = 'start-icon';\n this._startIconWrapper.appendChild(this._startIconSlot);\n this._buttonElement.appendChild(this._startIconWrapper);\n\n // Label / Children slot\n this._labelWrapper = document.createElement('span');\n this._labelWrapper.setAttribute('part', 'label');\n this._labelWrapper.className = 'label';\n this._defaultSlot = document.createElement('slot');\n this._labelWrapper.appendChild(this._defaultSlot);\n this._buttonElement.appendChild(this._labelWrapper);\n\n // End icon wrapper and slot\n this._endIconWrapper = document.createElement('span');\n this._endIconWrapper.setAttribute('part', 'end-icon');\n this._endIconWrapper.className = 'icon hidden';\n this._endIconSlot = document.createElement('slot');\n this._endIconSlot.name = 'end-icon';\n this._endIconWrapper.appendChild(this._endIconSlot);\n this._buttonElement.appendChild(this._endIconWrapper);\n\n shadow.appendChild(this._buttonElement);\n\n // Listen to slot changes to toggle icon wrapper visibility\n this._startIconSlot.addEventListener('slotchange', () => this._handleSlotChange());\n this._endIconSlot.addEventListener('slotchange', () => this._handleSlotChange());\n\n // Internal click handler\n this._buttonElement.addEventListener('click', (e) => this._handleInternalClick(e));\n\n // Capture click on host to suppress native click propagation when disabled or loading\n this.addEventListener(\n 'click',\n (e) => {\n if (this.disabled || this.loading) {\n e.preventDefault();\n e.stopImmediatePropagation();\n }\n },\n true\n );\n\n // Keyboard support for Enter / Space\n this.addEventListener('keydown', (e: KeyboardEvent) => {\n if (e.key === 'Enter' || e.key === ' ') {\n if (this.disabled || this.loading) {\n e.preventDefault();\n e.stopImmediatePropagation();\n }\n }\n });\n }\n\n connectedCallback(): void {\n // Subscribe to global configuration changes\n this._unsubscribeConfig = subscribeWebstrailConfig(() => {\n this._render();\n });\n\n this._handleSlotChange();\n this._render();\n }\n\n disconnectedCallback(): void {\n if (this._unsubscribeConfig) {\n this._unsubscribeConfig();\n this._unsubscribeConfig = undefined;\n }\n }\n\n attributeChangedCallback(_name: string, oldValue: string | null, newValue: string | null): void {\n if (oldValue === newValue) return;\n this._render();\n }\n\n /* ------------------- Properties (Getters / Setters) ------------------- */\n\n get variant(): ButtonVariant {\n const attr = this.getAttribute('variant');\n if (attr) return attr as ButtonVariant;\n return getWebstrailConfig().components.button.variant || 'primary';\n }\n\n set variant(value: ButtonVariant) {\n if (value) {\n this.setAttribute('variant', value);\n } else {\n this.removeAttribute('variant');\n }\n }\n\n get size(): ComponentSize {\n const attr = this.getAttribute('size');\n if (attr) return normalizeButtonSize(attr);\n return normalizeButtonSize(getWebstrailConfig().components.button.size);\n }\n\n set size(value: ButtonSize) {\n if (value) {\n this.setAttribute('size', value);\n } else {\n this.removeAttribute('size');\n }\n }\n\n get disabled(): boolean {\n return this.hasAttribute('disabled');\n }\n\n set disabled(value: boolean) {\n if (value) {\n this.setAttribute('disabled', '');\n } else {\n this.removeAttribute('disabled');\n }\n }\n\n get loading(): boolean {\n return this.hasAttribute('loading');\n }\n\n set loading(value: boolean) {\n if (value) {\n this.setAttribute('loading', '');\n } else {\n this.removeAttribute('loading');\n }\n }\n\n get loadingText(): string | null {\n return this.getAttribute('loading-text') || this.getAttribute('loadingtext');\n }\n\n set loadingText(value: string | null) {\n if (value !== null && value !== undefined) {\n this.setAttribute('loading-text', value);\n } else {\n this.removeAttribute('loading-text');\n this.removeAttribute('loadingtext');\n }\n }\n\n get label(): string | null {\n return this.getAttribute('label');\n }\n\n set label(value: string | null) {\n if (value !== null && value !== undefined) {\n this.setAttribute('label', value);\n } else {\n this.removeAttribute('label');\n }\n }\n\n get fullWidth(): boolean {\n return this.hasAttribute('full-width') || this.hasAttribute('fullwidth');\n }\n\n set fullWidth(value: boolean) {\n if (value) {\n this.setAttribute('full-width', '');\n } else {\n this.removeAttribute('full-width');\n this.removeAttribute('fullwidth');\n }\n }\n\n get type(): ButtonType {\n const attr = this.getAttribute('type');\n if (attr === 'submit' || attr === 'reset') return attr;\n return 'button';\n }\n\n set type(value: ButtonType) {\n this.setAttribute('type', value);\n }\n\n get styles(): ButtonStyles | undefined {\n if (this._stylesObj) return this._stylesObj;\n const attr = this.getAttribute('styles');\n if (attr) {\n try {\n return JSON.parse(attr) as ButtonStyles;\n } catch {\n return undefined;\n }\n }\n return undefined;\n }\n\n set styles(value: ButtonStyles | string | undefined) {\n if (typeof value === 'object' && value !== null) {\n this._stylesObj = value;\n this.setAttribute('styles', JSON.stringify(value));\n } else if (typeof value === 'string') {\n try {\n this._stylesObj = JSON.parse(value);\n } catch {\n this._stylesObj = undefined;\n }\n this.setAttribute('styles', value);\n } else {\n this._stylesObj = undefined;\n this.removeAttribute('styles');\n }\n }\n\n /**\n * Reference to inner button for focus/blur integration.\n */\n get button(): HTMLButtonElement {\n return this._buttonElement;\n }\n\n override focus(options?: FocusOptions): void {\n this._buttonElement?.focus(options);\n }\n\n override blur(): void {\n this._buttonElement?.blur();\n }\n\n /* ------------------- Slot Change Detection ------------------- */\n\n private _handleSlotChange(): void {\n const startNodes = this._startIconSlot\n .assignedNodes({ flatten: true })\n .filter(\n (n) =>\n n.nodeType === Node.ELEMENT_NODE || (n.textContent && n.textContent.trim().length > 0)\n );\n const hasStartIcon = startNodes.length > 0;\n\n const endNodes = this._endIconSlot\n .assignedNodes({ flatten: true })\n .filter(\n (n) =>\n n.nodeType === Node.ELEMENT_NODE || (n.textContent && n.textContent.trim().length > 0)\n );\n const hasEndIcon = endNodes.length > 0;\n\n if (!this.loading && hasStartIcon) {\n this._startIconWrapper.classList.remove('hidden');\n } else {\n this._startIconWrapper.classList.add('hidden');\n }\n\n if (!this.loading && hasEndIcon) {\n this._endIconWrapper.classList.remove('hidden');\n } else {\n this._endIconWrapper.classList.add('hidden');\n }\n }\n\n /* ------------------- Event & Form Handling ------------------- */\n\n private _handleInternalClick(event: MouseEvent): void {\n if (this.disabled || this.loading) {\n event.preventDefault();\n event.stopImmediatePropagation();\n return;\n }\n\n // Dispatch custom wb-click event\n const wbClickEvent = new CustomEvent<WbClickEventDetail>('wb-click', {\n bubbles: true,\n composed: true,\n cancelable: true,\n detail: {\n originalEvent: event,\n target: this,\n variant: this.variant,\n size: this.size,\n },\n });\n\n const notCancelled = this.dispatchEvent(wbClickEvent);\n\n if (!notCancelled) {\n event.preventDefault();\n return;\n }\n\n // Form submission / reset handling\n if (this.type === 'submit') {\n this._submitAssociatedForm();\n } else if (this.type === 'reset') {\n this._resetAssociatedForm();\n }\n }\n\n private _submitAssociatedForm(): void {\n const form = this._internals?.form || this.closest('form');\n if (!form) return;\n\n if (typeof form.requestSubmit === 'function') {\n form.requestSubmit();\n } else {\n const submitBtn = document.createElement('button');\n submitBtn.type = 'submit';\n submitBtn.style.display = 'none';\n form.appendChild(submitBtn);\n submitBtn.click();\n form.removeChild(submitBtn);\n }\n }\n\n private _resetAssociatedForm(): void {\n const form = this._internals?.form || this.closest('form');\n if (form) {\n form.reset();\n }\n }\n\n /* ------------------- Render Method ------------------- */\n\n private _render(): void {\n const effective = resolveEffectiveButtonConfig({\n variant: this.getAttribute('variant') || undefined,\n size: this.getAttribute('size') || undefined,\n fullWidth: this.fullWidth,\n styles: this.styles,\n });\n\n const isActuallyDisabled = this.disabled || this.loading;\n\n // Apply resolved CSS variables to host element\n for (const [varName, varVal] of Object.entries(effective.cssVars)) {\n this.style.setProperty(varName, varVal);\n }\n\n // Size class\n const sizeMap: Record<string, string> = {\n small: 'sizeSmall',\n medium: 'sizeMedium',\n large: 'sizeLarge',\n sm: 'sizeSmall',\n md: 'sizeMedium',\n lg: 'sizeLarge',\n };\n const sizeClassName = sizeMap[effective.size] || 'sizeMedium';\n\n // Variant class\n const variantClassName =\n {\n primary: 'variantPrimary',\n secondary: 'variantSecondary',\n outline: 'variantOutline',\n ghost: 'variantGhost',\n danger: 'variantDanger',\n }[effective.variant] || 'variantPrimary';\n\n // Build class list for inner button\n const classes = ['button', sizeClassName, variantClassName];\n if (effective.fullWidth) classes.push('fullWidth');\n if (isActuallyDisabled) classes.push('disabled');\n if (this.loading) classes.push('loading');\n\n this._buttonElement.className = classes.join(' ');\n this._buttonElement.type = this.type;\n this._buttonElement.disabled = isActuallyDisabled;\n\n // Accessibility attributes\n if (this.loading) {\n this._buttonElement.setAttribute('aria-busy', 'true');\n } else {\n this._buttonElement.removeAttribute('aria-busy');\n }\n\n if (isActuallyDisabled) {\n this._buttonElement.setAttribute('aria-disabled', 'true');\n } else {\n this._buttonElement.removeAttribute('aria-disabled');\n }\n\n // Spinner vs start icon\n if (this.loading) {\n this._spinnerElement.classList.remove('hidden');\n this._startIconWrapper.classList.add('hidden');\n this._endIconWrapper.classList.add('hidden');\n } else {\n this._spinnerElement.classList.add('hidden');\n this._handleSlotChange();\n }\n\n // Label / Loading text / Children\n if (this.loading && this.loadingText) {\n this._labelWrapper.textContent = this.loadingText;\n } else if (this.label !== null && this.label !== undefined) {\n this._labelWrapper.textContent = this.label;\n } else {\n // Slotted default content\n if (this._labelWrapper.firstChild !== this._defaultSlot) {\n this._labelWrapper.replaceChildren(this._defaultSlot);\n }\n }\n }\n}\n\n/**\n * Registers the 'wb-button' custom element if not already registered.\n */\nexport function registerWbButton(): void {\n if (typeof customElements !== 'undefined' && !customElements.get('wb-button')) {\n customElements.define('wb-button', WbButton);\n }\n}\n\n// Auto-register in browser environment\nif (typeof customElements !== 'undefined' && !customElements.get('wb-button')) {\n customElements.define('wb-button', WbButton);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'wb-button': WbButton;\n }\n}\n"],"names":["buttonStyles","WbButton","__publicField","shadow","styleEl","e","subscribeWebstrailConfig","_name","oldValue","newValue","attr","getWebstrailConfig","value","normalizeButtonSize","options","_a","hasStartIcon","n","hasEndIcon","event","wbClickEvent","form","submitBtn","effective","resolveEffectiveButtonConfig","isActuallyDisabled","varName","varVal","sizeClassName","variantClassName","classes","registerWbButton"],"mappings":";;;;AAAO,MAAMA,IAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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