@deepfuture/dui-components 0.0.12 → 0.0.13

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 (89) hide show
  1. package/_deprecated/center/center.js +2 -2
  2. package/_deprecated/hstack/hstack.js +79 -33
  3. package/_deprecated/page-inset/page-inset.js +104 -56
  4. package/_deprecated/vstack/vstack.js +61 -19
  5. package/accordion/accordion-item.js +217 -147
  6. package/accordion/accordion.js +214 -149
  7. package/alert-dialog/alert-dialog-close.js +2 -2
  8. package/alert-dialog/alert-dialog-popup.js +230 -166
  9. package/alert-dialog/alert-dialog-trigger.js +2 -2
  10. package/alert-dialog/alert-dialog.js +128 -73
  11. package/avatar/avatar.js +175 -115
  12. package/badge/badge.js +2 -2
  13. package/breadcrumb/breadcrumb-ellipsis.js +2 -2
  14. package/breadcrumb/breadcrumb-item.js +2 -2
  15. package/breadcrumb/breadcrumb-link.js +2 -2
  16. package/breadcrumb/breadcrumb-page.js +2 -2
  17. package/breadcrumb/breadcrumb-separator.js +2 -2
  18. package/breadcrumb/breadcrumb.js +2 -2
  19. package/button/button.js +109 -65
  20. package/calendar/calendar.js +368 -290
  21. package/checkbox/checkbox-group.js +146 -87
  22. package/checkbox/checkbox.js +232 -167
  23. package/collapsible/collapsible.js +210 -132
  24. package/combobox/combobox.js +318 -252
  25. package/command/command-empty.js +67 -25
  26. package/command/command-group.js +87 -47
  27. package/command/command-input.js +84 -44
  28. package/command/command-item.js +168 -124
  29. package/command/command-list.js +60 -18
  30. package/command/command-separator.js +2 -2
  31. package/command/command-shortcut.js +2 -2
  32. package/command/command.js +297 -232
  33. package/data-table/data-table.js +225 -153
  34. package/dialog/dialog-close.js +2 -2
  35. package/dialog/dialog-popup.js +247 -181
  36. package/dialog/dialog-trigger.js +2 -2
  37. package/dialog/dialog.js +128 -73
  38. package/dropzone/dropzone.js +310 -249
  39. package/icon/icon.js +2 -2
  40. package/input/input.js +204 -143
  41. package/link/link.js +62 -24
  42. package/menu/menu-item.js +66 -24
  43. package/menu/menu.js +189 -136
  44. package/menubar/menubar.js +142 -91
  45. package/number-field/number-field.js +277 -204
  46. package/package.json +2 -2
  47. package/popover/popover-close.js +2 -2
  48. package/popover/popover-popup.js +126 -76
  49. package/popover/popover-trigger.js +2 -2
  50. package/popover/popover.js +181 -120
  51. package/portal/portal.js +128 -86
  52. package/preview-card/preview-card-popup.js +114 -66
  53. package/preview-card/preview-card-trigger.js +2 -2
  54. package/preview-card/preview-card.js +211 -142
  55. package/progress/progress.js +91 -45
  56. package/radio/radio-group.js +153 -90
  57. package/radio/radio.js +137 -94
  58. package/scroll-area/scroll-area.js +382 -283
  59. package/select/select.js +260 -203
  60. package/separator/separator.js +60 -18
  61. package/sidebar/sidebar-content.js +2 -2
  62. package/sidebar/sidebar-footer.js +2 -2
  63. package/sidebar/sidebar-group-label.js +2 -2
  64. package/sidebar/sidebar-group.js +2 -2
  65. package/sidebar/sidebar-header.js +2 -2
  66. package/sidebar/sidebar-inset.js +2 -2
  67. package/sidebar/sidebar-menu-button.js +118 -74
  68. package/sidebar/sidebar-menu-item.js +2 -2
  69. package/sidebar/sidebar-menu.js +2 -2
  70. package/sidebar/sidebar-provider.js +202 -129
  71. package/sidebar/sidebar-separator.js +2 -2
  72. package/sidebar/sidebar-trigger.js +2 -2
  73. package/sidebar/sidebar.js +150 -85
  74. package/slider/slider.js +217 -159
  75. package/spinner/spinner.js +70 -28
  76. package/switch/switch.js +174 -111
  77. package/tabs/tab.js +89 -47
  78. package/tabs/tabs-indicator.js +2 -2
  79. package/tabs/tabs-list.js +92 -54
  80. package/tabs/tabs-panel.js +90 -44
  81. package/tabs/tabs.js +130 -71
  82. package/textarea/textarea.js +153 -95
  83. package/toggle/toggle-group.js +184 -125
  84. package/toggle/toggle.js +131 -76
  85. package/toolbar/toolbar.js +79 -33
  86. package/tooltip/tooltip-popup.js +108 -60
  87. package/tooltip/tooltip-trigger.js +93 -55
  88. package/tooltip/tooltip.js +225 -154
  89. package/trunc/trunc.js +78 -34
@@ -1,9 +1,41 @@
1
1
  /** Ported from original DUI: deep-future-app/app/client/components/dui/alert-dialog */
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- 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;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
2
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
3
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
4
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
5
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
6
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
7
+ var _, done = false;
8
+ for (var i = decorators.length - 1; i >= 0; i--) {
9
+ var context = {};
10
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
11
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
12
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
13
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
14
+ if (kind === "accessor") {
15
+ if (result === void 0) continue;
16
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
17
+ if (_ = accept(result.get)) descriptor.get = _;
18
+ if (_ = accept(result.set)) descriptor.set = _;
19
+ if (_ = accept(result.init)) initializers.unshift(_);
20
+ }
21
+ else if (_ = accept(result)) {
22
+ if (kind === "field") initializers.unshift(_);
23
+ else descriptor[key] = _;
24
+ }
25
+ }
26
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
27
+ done = true;
28
+ };
29
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
30
+ var useValue = arguments.length > 2;
31
+ for (var i = 0; i < initializers.length; i++) {
32
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
33
+ }
34
+ return useValue ? value : void 0;
35
+ };
36
+ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
37
+ if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
38
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
7
39
  };
8
40
  import { css, html, LitElement } from "lit";
9
41
  import { property, state } from "lit/decorators.js";
@@ -29,75 +61,98 @@ const hostStyles = css `
29
61
  * @slot - Default slot for trigger, popup, and other alert dialog parts.
30
62
  * @fires open-change - Fired when the dialog opens or closes. Detail: { open: boolean }
31
63
  */
32
- export class DuiAlertDialog extends LitElement {
33
- static { this.tagName = "dui-alert-dialog"; }
34
- static { this.styles = [base, hostStyles]; }
35
- #open_accessor_storage = undefined;
36
- /** Controls the dialog open state (controlled mode). */
37
- get open() { return this.#open_accessor_storage; }
38
- set open(value) { this.#open_accessor_storage = value; }
39
- #defaultOpen_accessor_storage = false;
40
- /** Initial open state for uncontrolled mode. */
41
- get defaultOpen() { return this.#defaultOpen_accessor_storage; }
42
- set defaultOpen(value) { this.#defaultOpen_accessor_storage = value; }
43
- #internalOpen_accessor_storage = false;
44
- get #internalOpen() { return this.#internalOpen_accessor_storage; }
45
- set #internalOpen(value) { this.#internalOpen_accessor_storage = value; }
46
- #instanceId = crypto.randomUUID().slice(0, 8);
47
- #dialogId = `dui-alert-dialog-${this.#instanceId}`;
48
- #triggerId = `dui-alert-trigger-${this.#instanceId}`;
49
- #titleId = `dui-alert-title-${this.#instanceId}`;
50
- #descriptionId = `dui-alert-desc-${this.#instanceId}`;
51
- get #isOpen() {
52
- return this.open ?? this.#internalOpen;
53
- }
54
- #openDialog = () => {
55
- if (this.open === undefined) {
56
- this.#internalOpen = true;
64
+ let DuiAlertDialog = (() => {
65
+ let _classSuper = LitElement;
66
+ let _open_decorators;
67
+ let _open_initializers = [];
68
+ let _open_extraInitializers = [];
69
+ let _defaultOpen_decorators;
70
+ let _defaultOpen_initializers = [];
71
+ let _defaultOpen_extraInitializers = [];
72
+ let _private_internalOpen_decorators;
73
+ let _private_internalOpen_initializers = [];
74
+ let _private_internalOpen_extraInitializers = [];
75
+ let _private_internalOpen_descriptor;
76
+ let __ctx_decorators;
77
+ let __ctx_initializers = [];
78
+ let __ctx_extraInitializers = [];
79
+ return class DuiAlertDialog extends _classSuper {
80
+ static {
81
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
82
+ _open_decorators = [property({ type: Boolean, reflect: true })];
83
+ _defaultOpen_decorators = [property({ type: Boolean, attribute: "default-open" })];
84
+ _private_internalOpen_decorators = [state()];
85
+ __ctx_decorators = [provide({ context: alertDialogContext }), state()];
86
+ __esDecorate(this, null, _open_decorators, { kind: "accessor", name: "open", static: false, private: false, access: { has: obj => "open" in obj, get: obj => obj.open, set: (obj, value) => { obj.open = value; } }, metadata: _metadata }, _open_initializers, _open_extraInitializers);
87
+ __esDecorate(this, null, _defaultOpen_decorators, { kind: "accessor", name: "defaultOpen", static: false, private: false, access: { has: obj => "defaultOpen" in obj, get: obj => obj.defaultOpen, set: (obj, value) => { obj.defaultOpen = value; } }, metadata: _metadata }, _defaultOpen_initializers, _defaultOpen_extraInitializers);
88
+ __esDecorate(this, _private_internalOpen_descriptor = { get: __setFunctionName(function () { return this.#internalOpen_accessor_storage; }, "#internalOpen", "get"), set: __setFunctionName(function (value) { this.#internalOpen_accessor_storage = value; }, "#internalOpen", "set") }, _private_internalOpen_decorators, { kind: "accessor", name: "#internalOpen", static: false, private: true, access: { has: obj => #internalOpen in obj, get: obj => obj.#internalOpen, set: (obj, value) => { obj.#internalOpen = value; } }, metadata: _metadata }, _private_internalOpen_initializers, _private_internalOpen_extraInitializers);
89
+ __esDecorate(this, null, __ctx_decorators, { kind: "accessor", name: "_ctx", static: false, private: false, access: { has: obj => "_ctx" in obj, get: obj => obj._ctx, set: (obj, value) => { obj._ctx = value; } }, metadata: _metadata }, __ctx_initializers, __ctx_extraInitializers);
90
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
57
91
  }
58
- this.dispatchEvent(openChangeEvent({ open: true }));
59
- };
60
- #closeDialog = () => {
61
- if (this.open === undefined) {
62
- this.#internalOpen = false;
92
+ static tagName = "dui-alert-dialog";
93
+ static styles = [base, hostStyles];
94
+ #open_accessor_storage = __runInitializers(this, _open_initializers, undefined);
95
+ /** Controls the dialog open state (controlled mode). */
96
+ get open() { return this.#open_accessor_storage; }
97
+ set open(value) { this.#open_accessor_storage = value; }
98
+ #defaultOpen_accessor_storage = (__runInitializers(this, _open_extraInitializers), __runInitializers(this, _defaultOpen_initializers, false));
99
+ /** Initial open state for uncontrolled mode. */
100
+ get defaultOpen() { return this.#defaultOpen_accessor_storage; }
101
+ set defaultOpen(value) { this.#defaultOpen_accessor_storage = value; }
102
+ #internalOpen_accessor_storage = (__runInitializers(this, _defaultOpen_extraInitializers), __runInitializers(this, _private_internalOpen_initializers, false));
103
+ get #internalOpen() { return _private_internalOpen_descriptor.get.call(this); }
104
+ set #internalOpen(value) { return _private_internalOpen_descriptor.set.call(this, value); }
105
+ #instanceId = (__runInitializers(this, _private_internalOpen_extraInitializers), crypto.randomUUID().slice(0, 8));
106
+ #dialogId = `dui-alert-dialog-${this.#instanceId}`;
107
+ #triggerId = `dui-alert-trigger-${this.#instanceId}`;
108
+ #titleId = `dui-alert-title-${this.#instanceId}`;
109
+ #descriptionId = `dui-alert-desc-${this.#instanceId}`;
110
+ get #isOpen() {
111
+ return this.open ?? this.#internalOpen;
63
112
  }
64
- this.dispatchEvent(openChangeEvent({ open: false }));
65
- };
66
- #_ctx_accessor_storage = this.#buildContext();
67
- get _ctx() { return this.#_ctx_accessor_storage; }
68
- set _ctx(value) { this.#_ctx_accessor_storage = value; }
69
- #buildContext() {
70
- return {
71
- open: this.#isOpen,
72
- dialogId: this.#dialogId,
73
- triggerId: this.#triggerId,
74
- titleId: this.#titleId,
75
- descriptionId: this.#descriptionId,
76
- openDialog: this.#openDialog,
77
- closeDialog: this.#closeDialog,
113
+ #openDialog = () => {
114
+ if (this.open === undefined) {
115
+ this.#internalOpen = true;
116
+ }
117
+ this.dispatchEvent(openChangeEvent({ open: true }));
78
118
  };
79
- }
80
- connectedCallback() {
81
- super.connectedCallback();
82
- if (this.open === undefined && this.defaultOpen) {
83
- this.#internalOpen = true;
119
+ #closeDialog = () => {
120
+ if (this.open === undefined) {
121
+ this.#internalOpen = false;
122
+ }
123
+ this.dispatchEvent(openChangeEvent({ open: false }));
124
+ };
125
+ #_ctx_accessor_storage = __runInitializers(this, __ctx_initializers, this.#buildContext());
126
+ get _ctx() { return this.#_ctx_accessor_storage; }
127
+ set _ctx(value) { this.#_ctx_accessor_storage = value; }
128
+ #buildContext() {
129
+ return {
130
+ open: this.#isOpen,
131
+ dialogId: this.#dialogId,
132
+ triggerId: this.#triggerId,
133
+ titleId: this.#titleId,
134
+ descriptionId: this.#descriptionId,
135
+ openDialog: this.#openDialog,
136
+ closeDialog: this.#closeDialog,
137
+ };
84
138
  }
85
- this._ctx = this.#buildContext();
86
- }
87
- willUpdate() {
88
- this._ctx = this.#buildContext();
89
- }
90
- render() {
91
- return html `<slot></slot>`;
92
- }
93
- }
94
- __decorate([
95
- property({ type: Boolean, reflect: true })
96
- ], DuiAlertDialog.prototype, "open", null);
97
- __decorate([
98
- property({ type: Boolean, attribute: "default-open" })
99
- ], DuiAlertDialog.prototype, "defaultOpen", null);
100
- __decorate([
101
- provide({ context: alertDialogContext }),
102
- state()
103
- ], DuiAlertDialog.prototype, "_ctx", null);
139
+ connectedCallback() {
140
+ super.connectedCallback();
141
+ if (this.open === undefined && this.defaultOpen) {
142
+ this.#internalOpen = true;
143
+ }
144
+ this._ctx = this.#buildContext();
145
+ }
146
+ willUpdate() {
147
+ this._ctx = this.#buildContext();
148
+ }
149
+ render() {
150
+ return html `<slot></slot>`;
151
+ }
152
+ constructor() {
153
+ super(...arguments);
154
+ __runInitializers(this, __ctx_extraInitializers);
155
+ }
156
+ };
157
+ })();
158
+ export { DuiAlertDialog };
package/avatar/avatar.js CHANGED
@@ -1,12 +1,44 @@
1
1
  /** Ported from original DUI: deep-future-app/app/client/components/dui/avatar */
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- 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;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
2
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
3
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
4
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
5
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
6
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
7
+ var _, done = false;
8
+ for (var i = decorators.length - 1; i >= 0; i--) {
9
+ var context = {};
10
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
11
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
12
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
13
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
14
+ if (kind === "accessor") {
15
+ if (result === void 0) continue;
16
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
17
+ if (_ = accept(result.get)) descriptor.get = _;
18
+ if (_ = accept(result.set)) descriptor.set = _;
19
+ if (_ = accept(result.init)) initializers.unshift(_);
20
+ }
21
+ else if (_ = accept(result)) {
22
+ if (kind === "field") initializers.unshift(_);
23
+ else descriptor[key] = _;
24
+ }
25
+ }
26
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
27
+ done = true;
28
+ };
29
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
30
+ var useValue = arguments.length > 2;
31
+ for (var i = 0; i < initializers.length; i++) {
32
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
33
+ }
34
+ return useValue ? value : void 0;
35
+ };
36
+ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
37
+ if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
38
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
7
39
  };
8
40
  import { css, html, LitElement, nothing, } from "lit";
9
- import { property } from "lit/decorators.js";
41
+ import { property, state } from "lit/decorators.js";
10
42
  import { base } from "@deepfuture/dui-core/base";
11
43
  import { customEvent } from "@deepfuture/dui-core/event";
12
44
  export const loadingStatusChangeEvent = customEvent("loading-status-change", { bubbles: true, composed: true });
@@ -55,134 +87,162 @@ const styles = css `
55
87
  * @cssprop --avatar-size - Avatar dimensions (width and height). Default: var(--space-12).
56
88
  * @fires loading-status-change - Fired when the image loading status changes. Detail: { status }
57
89
  */
58
- export class DuiAvatar extends LitElement {
59
- static { this.tagName = "dui-avatar"; }
60
- static { this.styles = [base, styles]; }
61
- #src_accessor_storage = undefined;
62
- /** Image URL for the avatar. */
63
- get src() { return this.#src_accessor_storage; }
64
- set src(value) { this.#src_accessor_storage = value; }
65
- #alt_accessor_storage = "";
66
- /** Alt text for the avatar image. */
67
- get alt() { return this.#alt_accessor_storage; }
68
- set alt(value) { this.#alt_accessor_storage = value; }
69
- #fallbackDelay_accessor_storage = undefined;
70
- /** Milliseconds to wait before showing fallback content. */
71
- get fallbackDelay() { return this.#fallbackDelay_accessor_storage; }
72
- set fallbackDelay(value) { this.#fallbackDelay_accessor_storage = value; }
73
- #size_accessor_storage = undefined;
74
- /**
75
- * Avatar size as a CSS length value (e.g. `"var(--space-8)"`, `"2rem"`).
76
- * When set, overrides `--avatar-size` on the host.
77
- */
78
- get size() { return this.#size_accessor_storage; }
79
- set size(value) { this.#size_accessor_storage = value; }
80
- #imageStatus_accessor_storage = "idle";
81
- get #imageStatus() { return this.#imageStatus_accessor_storage; }
82
- set #imageStatus(value) { this.#imageStatus_accessor_storage = value; }
83
- #delayPassed_accessor_storage = false;
84
- get #delayPassed() { return this.#delayPassed_accessor_storage; }
85
- set #delayPassed(value) { this.#delayPassed_accessor_storage = value; }
86
- #probeImage;
87
- #delayTimer;
88
- #setImageStatus(status) {
89
- this.#imageStatus = status;
90
- this.dispatchEvent(loadingStatusChangeEvent({ status }));
91
- }
92
- #startProbe() {
93
- this.#cleanupProbe();
94
- if (!this.src) {
95
- this.#setImageStatus("error");
96
- return;
90
+ let DuiAvatar = (() => {
91
+ let _classSuper = LitElement;
92
+ let _src_decorators;
93
+ let _src_initializers = [];
94
+ let _src_extraInitializers = [];
95
+ let _alt_decorators;
96
+ let _alt_initializers = [];
97
+ let _alt_extraInitializers = [];
98
+ let _fallbackDelay_decorators;
99
+ let _fallbackDelay_initializers = [];
100
+ let _fallbackDelay_extraInitializers = [];
101
+ let _size_decorators;
102
+ let _size_initializers = [];
103
+ let _size_extraInitializers = [];
104
+ let _private_imageStatus_decorators;
105
+ let _private_imageStatus_initializers = [];
106
+ let _private_imageStatus_extraInitializers = [];
107
+ let _private_imageStatus_descriptor;
108
+ let _private_delayPassed_decorators;
109
+ let _private_delayPassed_initializers = [];
110
+ let _private_delayPassed_extraInitializers = [];
111
+ let _private_delayPassed_descriptor;
112
+ return class DuiAvatar extends _classSuper {
113
+ static {
114
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
115
+ _src_decorators = [property()];
116
+ _alt_decorators = [property()];
117
+ _fallbackDelay_decorators = [property({ type: Number, attribute: "fallback-delay" })];
118
+ _size_decorators = [property({ reflect: true })];
119
+ _private_imageStatus_decorators = [state()];
120
+ _private_delayPassed_decorators = [state()];
121
+ __esDecorate(this, null, _src_decorators, { kind: "accessor", name: "src", static: false, private: false, access: { has: obj => "src" in obj, get: obj => obj.src, set: (obj, value) => { obj.src = value; } }, metadata: _metadata }, _src_initializers, _src_extraInitializers);
122
+ __esDecorate(this, null, _alt_decorators, { kind: "accessor", name: "alt", static: false, private: false, access: { has: obj => "alt" in obj, get: obj => obj.alt, set: (obj, value) => { obj.alt = value; } }, metadata: _metadata }, _alt_initializers, _alt_extraInitializers);
123
+ __esDecorate(this, null, _fallbackDelay_decorators, { kind: "accessor", name: "fallbackDelay", static: false, private: false, access: { has: obj => "fallbackDelay" in obj, get: obj => obj.fallbackDelay, set: (obj, value) => { obj.fallbackDelay = value; } }, metadata: _metadata }, _fallbackDelay_initializers, _fallbackDelay_extraInitializers);
124
+ __esDecorate(this, null, _size_decorators, { kind: "accessor", name: "size", static: false, private: false, access: { has: obj => "size" in obj, get: obj => obj.size, set: (obj, value) => { obj.size = value; } }, metadata: _metadata }, _size_initializers, _size_extraInitializers);
125
+ __esDecorate(this, _private_imageStatus_descriptor = { get: __setFunctionName(function () { return this.#imageStatus_accessor_storage; }, "#imageStatus", "get"), set: __setFunctionName(function (value) { this.#imageStatus_accessor_storage = value; }, "#imageStatus", "set") }, _private_imageStatus_decorators, { kind: "accessor", name: "#imageStatus", static: false, private: true, access: { has: obj => #imageStatus in obj, get: obj => obj.#imageStatus, set: (obj, value) => { obj.#imageStatus = value; } }, metadata: _metadata }, _private_imageStatus_initializers, _private_imageStatus_extraInitializers);
126
+ __esDecorate(this, _private_delayPassed_descriptor = { get: __setFunctionName(function () { return this.#delayPassed_accessor_storage; }, "#delayPassed", "get"), set: __setFunctionName(function (value) { this.#delayPassed_accessor_storage = value; }, "#delayPassed", "set") }, _private_delayPassed_decorators, { kind: "accessor", name: "#delayPassed", static: false, private: true, access: { has: obj => #delayPassed in obj, get: obj => obj.#delayPassed, set: (obj, value) => { obj.#delayPassed = value; } }, metadata: _metadata }, _private_delayPassed_initializers, _private_delayPassed_extraInitializers);
127
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
97
128
  }
98
- this.#setImageStatus("loading");
99
- const img = new Image();
100
- img.onload = () => this.#setImageStatus("loaded");
101
- img.onerror = () => this.#setImageStatus("error");
102
- img.src = this.src;
103
- this.#probeImage = img;
104
- }
105
- #cleanupProbe() {
106
- if (this.#probeImage) {
107
- this.#probeImage.onload = null;
108
- this.#probeImage.onerror = null;
109
- this.#probeImage = undefined;
129
+ static tagName = "dui-avatar";
130
+ static styles = [base, styles];
131
+ #src_accessor_storage = __runInitializers(this, _src_initializers, undefined);
132
+ /** Image URL for the avatar. */
133
+ get src() { return this.#src_accessor_storage; }
134
+ set src(value) { this.#src_accessor_storage = value; }
135
+ #alt_accessor_storage = (__runInitializers(this, _src_extraInitializers), __runInitializers(this, _alt_initializers, ""));
136
+ /** Alt text for the avatar image. */
137
+ get alt() { return this.#alt_accessor_storage; }
138
+ set alt(value) { this.#alt_accessor_storage = value; }
139
+ #fallbackDelay_accessor_storage = (__runInitializers(this, _alt_extraInitializers), __runInitializers(this, _fallbackDelay_initializers, undefined));
140
+ /** Milliseconds to wait before showing fallback content. */
141
+ get fallbackDelay() { return this.#fallbackDelay_accessor_storage; }
142
+ set fallbackDelay(value) { this.#fallbackDelay_accessor_storage = value; }
143
+ #size_accessor_storage = (__runInitializers(this, _fallbackDelay_extraInitializers), __runInitializers(this, _size_initializers, undefined));
144
+ /**
145
+ * Avatar size as a CSS length value (e.g. `"var(--space-8)"`, `"2rem"`).
146
+ * When set, overrides `--avatar-size` on the host.
147
+ */
148
+ get size() { return this.#size_accessor_storage; }
149
+ set size(value) { this.#size_accessor_storage = value; }
150
+ #imageStatus_accessor_storage = (__runInitializers(this, _size_extraInitializers), __runInitializers(this, _private_imageStatus_initializers, "idle"));
151
+ get #imageStatus() { return _private_imageStatus_descriptor.get.call(this); }
152
+ set #imageStatus(value) { return _private_imageStatus_descriptor.set.call(this, value); }
153
+ #delayPassed_accessor_storage = (__runInitializers(this, _private_imageStatus_extraInitializers), __runInitializers(this, _private_delayPassed_initializers, false));
154
+ get #delayPassed() { return _private_delayPassed_descriptor.get.call(this); }
155
+ set #delayPassed(value) { return _private_delayPassed_descriptor.set.call(this, value); }
156
+ #probeImage = __runInitializers(this, _private_delayPassed_extraInitializers);
157
+ #delayTimer;
158
+ #setImageStatus(status) {
159
+ this.#imageStatus = status;
160
+ this.dispatchEvent(loadingStatusChangeEvent({ status }));
110
161
  }
111
- }
112
- #startDelay() {
113
- this.#clearDelay();
114
- if (this.fallbackDelay === undefined || this.fallbackDelay <= 0) {
115
- this.#delayPassed = true;
116
- return;
162
+ #startProbe() {
163
+ this.#cleanupProbe();
164
+ if (!this.src) {
165
+ this.#setImageStatus("error");
166
+ return;
167
+ }
168
+ this.#setImageStatus("loading");
169
+ const img = new Image();
170
+ img.onload = () => this.#setImageStatus("loaded");
171
+ img.onerror = () => this.#setImageStatus("error");
172
+ img.src = this.src;
173
+ this.#probeImage = img;
117
174
  }
118
- this.#delayPassed = false;
119
- this.#delayTimer = setTimeout(() => {
120
- this.#delayPassed = true;
121
- }, this.fallbackDelay);
122
- }
123
- #clearDelay() {
124
- if (this.#delayTimer !== undefined) {
125
- clearTimeout(this.#delayTimer);
126
- this.#delayTimer = undefined;
175
+ #cleanupProbe() {
176
+ if (this.#probeImage) {
177
+ this.#probeImage.onload = null;
178
+ this.#probeImage.onerror = null;
179
+ this.#probeImage = undefined;
180
+ }
127
181
  }
128
- }
129
- connectedCallback() {
130
- super.connectedCallback();
131
- this.#startDelay();
132
- this.#startProbe();
133
- }
134
- disconnectedCallback() {
135
- super.disconnectedCallback();
136
- this.#cleanupProbe();
137
- this.#clearDelay();
138
- }
139
- willUpdate(changed) {
140
- if (changed.has("size")) {
141
- if (this.size) {
142
- this.style.setProperty("--avatar-size", this.size);
182
+ #startDelay() {
183
+ this.#clearDelay();
184
+ if (this.fallbackDelay === undefined || this.fallbackDelay <= 0) {
185
+ this.#delayPassed = true;
186
+ return;
143
187
  }
144
- else {
145
- this.style.removeProperty("--avatar-size");
188
+ this.#delayPassed = false;
189
+ this.#delayTimer = setTimeout(() => {
190
+ this.#delayPassed = true;
191
+ }, this.fallbackDelay);
192
+ }
193
+ #clearDelay() {
194
+ if (this.#delayTimer !== undefined) {
195
+ clearTimeout(this.#delayTimer);
196
+ this.#delayTimer = undefined;
146
197
  }
147
198
  }
148
- if (changed.has("src")) {
199
+ connectedCallback() {
200
+ super.connectedCallback();
201
+ this.#startDelay();
149
202
  this.#startProbe();
150
203
  }
151
- if (changed.has("fallbackDelay")) {
152
- this.#startDelay();
204
+ disconnectedCallback() {
205
+ super.disconnectedCallback();
206
+ this.#cleanupProbe();
207
+ this.#clearDelay();
153
208
  }
154
- }
155
- render() {
156
- const showImage = this.src && this.#imageStatus === "loaded";
157
- const showFallback = !showImage && this.#delayPassed;
158
- return html `
209
+ willUpdate(changed) {
210
+ if (changed.has("size")) {
211
+ if (this.size) {
212
+ this.style.setProperty("--avatar-size", this.size);
213
+ }
214
+ else {
215
+ this.style.removeProperty("--avatar-size");
216
+ }
217
+ }
218
+ if (changed.has("src")) {
219
+ this.#startProbe();
220
+ }
221
+ if (changed.has("fallbackDelay")) {
222
+ this.#startDelay();
223
+ }
224
+ }
225
+ render() {
226
+ const showImage = this.src && this.#imageStatus === "loaded";
227
+ const showFallback = !showImage && this.#delayPassed;
228
+ return html `
159
229
  <span part="root">
160
230
  ${showImage
161
- ? html `
231
+ ? html `
162
232
  <img
163
233
  part="image"
164
234
  src="${this.src}"
165
235
  alt="${this.alt}"
166
236
  />
167
237
  `
168
- : showFallback
169
- ? html `
238
+ : showFallback
239
+ ? html `
170
240
  <span part="fallback"><slot></slot></span>
171
241
  `
172
- : nothing}
242
+ : nothing}
173
243
  </span>
174
244
  `;
175
- }
176
- }
177
- __decorate([
178
- property()
179
- ], DuiAvatar.prototype, "src", null);
180
- __decorate([
181
- property()
182
- ], DuiAvatar.prototype, "alt", null);
183
- __decorate([
184
- property({ type: Number, attribute: "fallback-delay" })
185
- ], DuiAvatar.prototype, "fallbackDelay", null);
186
- __decorate([
187
- property({ reflect: true })
188
- ], DuiAvatar.prototype, "size", null);
245
+ }
246
+ };
247
+ })();
248
+ export { DuiAvatar };
package/badge/badge.js CHANGED
@@ -18,8 +18,8 @@ const styles = css `
18
18
  * @csspart root - The badge span element.
19
19
  */
20
20
  export class DuiBadge extends LitElement {
21
- static { this.tagName = "dui-badge"; }
22
- static { this.styles = [base, styles]; }
21
+ static tagName = "dui-badge";
22
+ static styles = [base, styles];
23
23
  render() {
24
24
  return html `
25
25
  <span part="root">
@@ -23,8 +23,8 @@ const styles = css `
23
23
  * @csspart root - The `<span>` element (presentational, aria-hidden).
24
24
  */
25
25
  export class DuiBreadcrumbEllipsis extends LitElement {
26
- static { this.tagName = "dui-breadcrumb-ellipsis"; }
27
- static { this.styles = [base, styles]; }
26
+ static tagName = "dui-breadcrumb-ellipsis";
27
+ static styles = [base, styles];
28
28
  render() {
29
29
  return html `
30
30
  <span
@@ -19,8 +19,8 @@ const styles = css `
19
19
  * @csspart root - The `<li>` element.
20
20
  */
21
21
  export class DuiBreadcrumbItem extends LitElement {
22
- static { this.tagName = "dui-breadcrumb-item"; }
23
- static { this.styles = [base, styles]; }
22
+ static tagName = "dui-breadcrumb-item";
23
+ static styles = [base, styles];
24
24
  render() {
25
25
  return html `
26
26
  <li part="root">
@@ -20,8 +20,8 @@ const styles = css `
20
20
  * @csspart root - The wrapper `<span>` element.
21
21
  */
22
22
  export class DuiBreadcrumbLink extends LitElement {
23
- static { this.tagName = "dui-breadcrumb-link"; }
24
- static { this.styles = [base, styles]; }
23
+ static tagName = "dui-breadcrumb-link";
24
+ static styles = [base, styles];
25
25
  render() {
26
26
  return html `
27
27
  <span part="root">
@@ -19,8 +19,8 @@ const styles = css `
19
19
  * @csspart root - The `<span>` element with `aria-current="page"`.
20
20
  */
21
21
  export class DuiBreadcrumbPage extends LitElement {
22
- static { this.tagName = "dui-breadcrumb-page"; }
23
- static { this.styles = [base, styles]; }
22
+ static tagName = "dui-breadcrumb-page";
23
+ static styles = [base, styles];
24
24
  render() {
25
25
  return html `
26
26
  <span
@@ -20,8 +20,8 @@ const styles = css `
20
20
  * @csspart root - The `<li>` element (presentational, aria-hidden).
21
21
  */
22
22
  export class DuiBreadcrumbSeparator extends LitElement {
23
- static { this.tagName = "dui-breadcrumb-separator"; }
24
- static { this.styles = [base, styles]; }
23
+ static tagName = "dui-breadcrumb-separator";
24
+ static styles = [base, styles];
25
25
  render() {
26
26
  return html `
27
27
  <li
@@ -24,8 +24,8 @@ const styles = css `
24
24
  * @csspart root - The `<ol>` element.
25
25
  */
26
26
  export class DuiBreadcrumb extends LitElement {
27
- static { this.tagName = "dui-breadcrumb"; }
28
- static { this.styles = [base, styles]; }
27
+ static tagName = "dui-breadcrumb";
28
+ static styles = [base, styles];
29
29
  render() {
30
30
  return html `
31
31
  <nav aria-label="breadcrumb">