@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
package/toggle/toggle.js CHANGED
@@ -1,8 +1,40 @@
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;
1
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
2
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
3
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
4
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
5
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
6
+ var _, done = false;
7
+ for (var i = decorators.length - 1; i >= 0; i--) {
8
+ var context = {};
9
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
10
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
11
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
12
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
13
+ if (kind === "accessor") {
14
+ if (result === void 0) continue;
15
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
16
+ if (_ = accept(result.get)) descriptor.get = _;
17
+ if (_ = accept(result.set)) descriptor.set = _;
18
+ if (_ = accept(result.init)) initializers.unshift(_);
19
+ }
20
+ else if (_ = accept(result)) {
21
+ if (kind === "field") initializers.unshift(_);
22
+ else descriptor[key] = _;
23
+ }
24
+ }
25
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
26
+ done = true;
27
+ };
28
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
29
+ var useValue = arguments.length > 2;
30
+ for (var i = 0; i < initializers.length; i++) {
31
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
32
+ }
33
+ return useValue ? value : void 0;
34
+ };
35
+ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
36
+ if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
37
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
6
38
  };
7
39
  import { css, html, LitElement } from "lit";
8
40
  import { property, state } from "lit/decorators.js";
@@ -43,63 +75,100 @@ const styles = css `
43
75
  * @csspart root - The button element.
44
76
  * @fires pressed-change - Fired when toggled. Detail: { pressed: boolean }
45
77
  */
46
- export class DuiToggle extends LitElement {
47
- static { this.tagName = "dui-toggle"; }
48
- static { this.shadowRootOptions = {
49
- ...LitElement.shadowRootOptions,
50
- delegatesFocus: true,
51
- }; }
52
- static { this.styles = [base, styles]; }
53
- #pressed_accessor_storage = undefined;
54
- get pressed() { return this.#pressed_accessor_storage; }
55
- set pressed(value) { this.#pressed_accessor_storage = value; }
56
- #defaultPressed_accessor_storage = false;
57
- get defaultPressed() { return this.#defaultPressed_accessor_storage; }
58
- set defaultPressed(value) { this.#defaultPressed_accessor_storage = value; }
59
- #disabled_accessor_storage = false;
60
- get disabled() { return this.#disabled_accessor_storage; }
61
- set disabled(value) { this.#disabled_accessor_storage = value; }
62
- #value_accessor_storage = undefined;
63
- get value() { return this.#value_accessor_storage; }
64
- set value(value) { this.#value_accessor_storage = value; }
65
- #internalPressed_accessor_storage = false;
66
- get #internalPressed() { return this.#internalPressed_accessor_storage; }
67
- set #internalPressed(value) { this.#internalPressed_accessor_storage = value; }
68
- #_groupCtx_accessor_storage;
69
- get _groupCtx() { return this.#_groupCtx_accessor_storage; }
70
- set _groupCtx(value) { this.#_groupCtx_accessor_storage = value; }
71
- get #isPressed() {
72
- if (this._groupCtx && this.value !== undefined) {
73
- return this._groupCtx.value.includes(this.value);
78
+ let DuiToggle = (() => {
79
+ let _classSuper = LitElement;
80
+ let _pressed_decorators;
81
+ let _pressed_initializers = [];
82
+ let _pressed_extraInitializers = [];
83
+ let _defaultPressed_decorators;
84
+ let _defaultPressed_initializers = [];
85
+ let _defaultPressed_extraInitializers = [];
86
+ let _disabled_decorators;
87
+ let _disabled_initializers = [];
88
+ let _disabled_extraInitializers = [];
89
+ let _value_decorators;
90
+ let _value_initializers = [];
91
+ let _value_extraInitializers = [];
92
+ let _private_internalPressed_decorators;
93
+ let _private_internalPressed_initializers = [];
94
+ let _private_internalPressed_extraInitializers = [];
95
+ let _private_internalPressed_descriptor;
96
+ let __groupCtx_decorators;
97
+ let __groupCtx_initializers = [];
98
+ let __groupCtx_extraInitializers = [];
99
+ return class DuiToggle extends _classSuper {
100
+ static {
101
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
102
+ _pressed_decorators = [property({ type: Boolean })];
103
+ _defaultPressed_decorators = [property({ type: Boolean, attribute: "default-pressed" })];
104
+ _disabled_decorators = [property({ type: Boolean, reflect: true })];
105
+ _value_decorators = [property()];
106
+ _private_internalPressed_decorators = [state()];
107
+ __groupCtx_decorators = [consume({ context: toggleGroupContext, subscribe: true }), state()];
108
+ __esDecorate(this, null, _pressed_decorators, { kind: "accessor", name: "pressed", static: false, private: false, access: { has: obj => "pressed" in obj, get: obj => obj.pressed, set: (obj, value) => { obj.pressed = value; } }, metadata: _metadata }, _pressed_initializers, _pressed_extraInitializers);
109
+ __esDecorate(this, null, _defaultPressed_decorators, { kind: "accessor", name: "defaultPressed", static: false, private: false, access: { has: obj => "defaultPressed" in obj, get: obj => obj.defaultPressed, set: (obj, value) => { obj.defaultPressed = value; } }, metadata: _metadata }, _defaultPressed_initializers, _defaultPressed_extraInitializers);
110
+ __esDecorate(this, null, _disabled_decorators, { kind: "accessor", name: "disabled", static: false, private: false, access: { has: obj => "disabled" in obj, get: obj => obj.disabled, set: (obj, value) => { obj.disabled = value; } }, metadata: _metadata }, _disabled_initializers, _disabled_extraInitializers);
111
+ __esDecorate(this, null, _value_decorators, { kind: "accessor", name: "value", static: false, private: false, access: { has: obj => "value" in obj, get: obj => obj.value, set: (obj, value) => { obj.value = value; } }, metadata: _metadata }, _value_initializers, _value_extraInitializers);
112
+ __esDecorate(this, _private_internalPressed_descriptor = { get: __setFunctionName(function () { return this.#internalPressed_accessor_storage; }, "#internalPressed", "get"), set: __setFunctionName(function (value) { this.#internalPressed_accessor_storage = value; }, "#internalPressed", "set") }, _private_internalPressed_decorators, { kind: "accessor", name: "#internalPressed", static: false, private: true, access: { has: obj => #internalPressed in obj, get: obj => obj.#internalPressed, set: (obj, value) => { obj.#internalPressed = value; } }, metadata: _metadata }, _private_internalPressed_initializers, _private_internalPressed_extraInitializers);
113
+ __esDecorate(this, null, __groupCtx_decorators, { kind: "accessor", name: "_groupCtx", static: false, private: false, access: { has: obj => "_groupCtx" in obj, get: obj => obj._groupCtx, set: (obj, value) => { obj._groupCtx = value; } }, metadata: _metadata }, __groupCtx_initializers, __groupCtx_extraInitializers);
114
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
74
115
  }
75
- return this.pressed ?? this.#internalPressed;
76
- }
77
- get #isDisabled() {
78
- return this.disabled || (this._groupCtx?.disabled ?? false);
79
- }
80
- connectedCallback() {
81
- super.connectedCallback();
82
- if (this.pressed === undefined && this.defaultPressed) {
83
- this.#internalPressed = true;
116
+ static tagName = "dui-toggle";
117
+ static shadowRootOptions = {
118
+ ...LitElement.shadowRootOptions,
119
+ delegatesFocus: true,
120
+ };
121
+ static styles = [base, styles];
122
+ #pressed_accessor_storage = __runInitializers(this, _pressed_initializers, undefined);
123
+ get pressed() { return this.#pressed_accessor_storage; }
124
+ set pressed(value) { this.#pressed_accessor_storage = value; }
125
+ #defaultPressed_accessor_storage = (__runInitializers(this, _pressed_extraInitializers), __runInitializers(this, _defaultPressed_initializers, false));
126
+ get defaultPressed() { return this.#defaultPressed_accessor_storage; }
127
+ set defaultPressed(value) { this.#defaultPressed_accessor_storage = value; }
128
+ #disabled_accessor_storage = (__runInitializers(this, _defaultPressed_extraInitializers), __runInitializers(this, _disabled_initializers, false));
129
+ get disabled() { return this.#disabled_accessor_storage; }
130
+ set disabled(value) { this.#disabled_accessor_storage = value; }
131
+ #value_accessor_storage = (__runInitializers(this, _disabled_extraInitializers), __runInitializers(this, _value_initializers, undefined));
132
+ get value() { return this.#value_accessor_storage; }
133
+ set value(value) { this.#value_accessor_storage = value; }
134
+ #internalPressed_accessor_storage = (__runInitializers(this, _value_extraInitializers), __runInitializers(this, _private_internalPressed_initializers, false));
135
+ get #internalPressed() { return _private_internalPressed_descriptor.get.call(this); }
136
+ set #internalPressed(value) { return _private_internalPressed_descriptor.set.call(this, value); }
137
+ #_groupCtx_accessor_storage = (__runInitializers(this, _private_internalPressed_extraInitializers), __runInitializers(this, __groupCtx_initializers, void 0));
138
+ get _groupCtx() { return this.#_groupCtx_accessor_storage; }
139
+ set _groupCtx(value) { this.#_groupCtx_accessor_storage = value; }
140
+ get #isPressed() {
141
+ if (this._groupCtx && this.value !== undefined) {
142
+ return this._groupCtx.value.includes(this.value);
143
+ }
144
+ return this.pressed ?? this.#internalPressed;
84
145
  }
85
- }
86
- #handleClick = () => {
87
- if (this.#isDisabled)
88
- return;
89
- if (this._groupCtx && this.value !== undefined) {
90
- this._groupCtx.toggle(this.value);
91
- return;
146
+ get #isDisabled() {
147
+ return this.disabled || (this._groupCtx?.disabled ?? false);
92
148
  }
93
- const newPressed = !this.#isPressed;
94
- if (this.pressed === undefined) {
95
- this.#internalPressed = newPressed;
149
+ connectedCallback() {
150
+ super.connectedCallback();
151
+ if (this.pressed === undefined && this.defaultPressed) {
152
+ this.#internalPressed = true;
153
+ }
96
154
  }
97
- this.dispatchEvent(pressedChangeEvent({ pressed: newPressed }));
98
- };
99
- render() {
100
- const isPressed = this.#isPressed;
101
- const isDisabled = this.#isDisabled;
102
- return html `
155
+ #handleClick = (__runInitializers(this, __groupCtx_extraInitializers), () => {
156
+ if (this.#isDisabled)
157
+ return;
158
+ if (this._groupCtx && this.value !== undefined) {
159
+ this._groupCtx.toggle(this.value);
160
+ return;
161
+ }
162
+ const newPressed = !this.#isPressed;
163
+ if (this.pressed === undefined) {
164
+ this.#internalPressed = newPressed;
165
+ }
166
+ this.dispatchEvent(pressedChangeEvent({ pressed: newPressed }));
167
+ });
168
+ render() {
169
+ const isPressed = this.#isPressed;
170
+ const isDisabled = this.#isDisabled;
171
+ return html `
103
172
  <button
104
173
  part="root"
105
174
  type="button"
@@ -113,21 +182,7 @@ export class DuiToggle extends LitElement {
113
182
  <slot></slot>
114
183
  </button>
115
184
  `;
116
- }
117
- }
118
- __decorate([
119
- property({ type: Boolean })
120
- ], DuiToggle.prototype, "pressed", null);
121
- __decorate([
122
- property({ type: Boolean, attribute: "default-pressed" })
123
- ], DuiToggle.prototype, "defaultPressed", null);
124
- __decorate([
125
- property({ type: Boolean, reflect: true })
126
- ], DuiToggle.prototype, "disabled", null);
127
- __decorate([
128
- property()
129
- ], DuiToggle.prototype, "value", null);
130
- __decorate([
131
- consume({ context: toggleGroupContext, subscribe: true }),
132
- state()
133
- ], DuiToggle.prototype, "_groupCtx", null);
185
+ }
186
+ };
187
+ })();
188
+ export { DuiToggle };
@@ -1,9 +1,37 @@
1
1
  /** Ported from original DUI: deep-future-app/app/client/components/dui/toolbar */
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;
7
35
  };
8
36
  import { css, html, LitElement } from "lit";
9
37
  import { property } from "lit/decorators.js";
@@ -40,23 +68,44 @@ const styles = css `
40
68
  align-items: center;
41
69
  }
42
70
  `;
43
- export class DuiToolbar extends LitElement {
44
- static { this.tagName = "dui-toolbar"; }
45
- static { this.styles = [base, styles]; }
46
- #inset_accessor_storage = false;
47
- /** Adds horizontal and vertical padding. */
48
- get inset() { return this.#inset_accessor_storage; }
49
- set inset(value) { this.#inset_accessor_storage = value; }
50
- #hasButtonLeft_accessor_storage = false;
51
- /** Reduces left inset padding when a button is the first item. */
52
- get hasButtonLeft() { return this.#hasButtonLeft_accessor_storage; }
53
- set hasButtonLeft(value) { this.#hasButtonLeft_accessor_storage = value; }
54
- #hasButtonRight_accessor_storage = false;
55
- /** Reduces right inset padding when a button is the last item. */
56
- get hasButtonRight() { return this.#hasButtonRight_accessor_storage; }
57
- set hasButtonRight(value) { this.#hasButtonRight_accessor_storage = value; }
58
- render() {
59
- return html `
71
+ let DuiToolbar = (() => {
72
+ let _classSuper = LitElement;
73
+ let _inset_decorators;
74
+ let _inset_initializers = [];
75
+ let _inset_extraInitializers = [];
76
+ let _hasButtonLeft_decorators;
77
+ let _hasButtonLeft_initializers = [];
78
+ let _hasButtonLeft_extraInitializers = [];
79
+ let _hasButtonRight_decorators;
80
+ let _hasButtonRight_initializers = [];
81
+ let _hasButtonRight_extraInitializers = [];
82
+ return class DuiToolbar extends _classSuper {
83
+ static {
84
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
85
+ _inset_decorators = [property({ type: Boolean, reflect: true })];
86
+ _hasButtonLeft_decorators = [property({ type: Boolean, reflect: true, attribute: "has-button-left" })];
87
+ _hasButtonRight_decorators = [property({ type: Boolean, reflect: true, attribute: "has-button-right" })];
88
+ __esDecorate(this, null, _inset_decorators, { kind: "accessor", name: "inset", static: false, private: false, access: { has: obj => "inset" in obj, get: obj => obj.inset, set: (obj, value) => { obj.inset = value; } }, metadata: _metadata }, _inset_initializers, _inset_extraInitializers);
89
+ __esDecorate(this, null, _hasButtonLeft_decorators, { kind: "accessor", name: "hasButtonLeft", static: false, private: false, access: { has: obj => "hasButtonLeft" in obj, get: obj => obj.hasButtonLeft, set: (obj, value) => { obj.hasButtonLeft = value; } }, metadata: _metadata }, _hasButtonLeft_initializers, _hasButtonLeft_extraInitializers);
90
+ __esDecorate(this, null, _hasButtonRight_decorators, { kind: "accessor", name: "hasButtonRight", static: false, private: false, access: { has: obj => "hasButtonRight" in obj, get: obj => obj.hasButtonRight, set: (obj, value) => { obj.hasButtonRight = value; } }, metadata: _metadata }, _hasButtonRight_initializers, _hasButtonRight_extraInitializers);
91
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
92
+ }
93
+ static tagName = "dui-toolbar";
94
+ static styles = [base, styles];
95
+ #inset_accessor_storage = __runInitializers(this, _inset_initializers, false);
96
+ /** Adds horizontal and vertical padding. */
97
+ get inset() { return this.#inset_accessor_storage; }
98
+ set inset(value) { this.#inset_accessor_storage = value; }
99
+ #hasButtonLeft_accessor_storage = (__runInitializers(this, _inset_extraInitializers), __runInitializers(this, _hasButtonLeft_initializers, false));
100
+ /** Reduces left inset padding when a button is the first item. */
101
+ get hasButtonLeft() { return this.#hasButtonLeft_accessor_storage; }
102
+ set hasButtonLeft(value) { this.#hasButtonLeft_accessor_storage = value; }
103
+ #hasButtonRight_accessor_storage = (__runInitializers(this, _hasButtonLeft_extraInitializers), __runInitializers(this, _hasButtonRight_initializers, false));
104
+ /** Reduces right inset padding when a button is the last item. */
105
+ get hasButtonRight() { return this.#hasButtonRight_accessor_storage; }
106
+ set hasButtonRight(value) { this.#hasButtonRight_accessor_storage = value; }
107
+ render() {
108
+ return html `
60
109
  <nav part="root" role="toolbar">
61
110
  <div part="left">
62
111
  <slot name="left"></slot>
@@ -69,14 +118,11 @@ export class DuiToolbar extends LitElement {
69
118
  </div>
70
119
  </nav>
71
120
  `;
72
- }
73
- }
74
- __decorate([
75
- property({ type: Boolean, reflect: true })
76
- ], DuiToolbar.prototype, "inset", null);
77
- __decorate([
78
- property({ type: Boolean, reflect: true, attribute: "has-button-left" })
79
- ], DuiToolbar.prototype, "hasButtonLeft", null);
80
- __decorate([
81
- property({ type: Boolean, reflect: true, attribute: "has-button-right" })
82
- ], DuiToolbar.prototype, "hasButtonRight", null);
121
+ }
122
+ constructor() {
123
+ super(...arguments);
124
+ __runInitializers(this, _hasButtonRight_extraInitializers);
125
+ }
126
+ };
127
+ })();
128
+ export { DuiToolbar };
@@ -1,12 +1,44 @@
1
1
  /** Ported from original DUI: deep-future-app/app/client/components/dui/tooltip */
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
- import { property } from "lit/decorators.js";
41
+ import { property, state } from "lit/decorators.js";
10
42
  import { ContextConsumer } from "@lit/context";
11
43
  import { base } from "@deepfuture/dui-core/base";
12
44
  import { tooltipContext } from "./tooltip-context.js";
@@ -67,37 +99,54 @@ const portalPopupStyles = [
67
99
  *
68
100
  * @slot - Tooltip content.
69
101
  */
70
- export class DuiTooltipPopup extends LitElement {
71
- static { this.tagName = "dui-tooltip-popup"; }
72
- static { this.styles = [base, hostStyles]; }
73
- #showArrow_accessor_storage = true;
74
- /** Whether to show an arrow pointing to the trigger. */
75
- get showArrow() { return this.#showArrow_accessor_storage; }
76
- set showArrow(value) { this.#showArrow_accessor_storage = value; }
77
- #side_accessor_storage = "top";
78
- get #side() { return this.#side_accessor_storage; }
79
- set #side(value) { this.#side_accessor_storage = value; }
80
- #ctx = new ContextConsumer(this, {
81
- context: tooltipContext,
82
- subscribe: true,
83
- });
84
- #wasOpen = false;
85
- #portal = new FloatingPortalController(this, {
86
- getAnchor: () => this.#ctx.value?.triggerEl,
87
- matchWidth: false,
88
- placement: "top",
89
- offset: 6,
90
- styles: portalPopupStyles,
91
- contentContainer: ".Content",
92
- onPosition: ({ placement }) => {
93
- const actualSide = placement.split("-")[0];
94
- if (actualSide !== this.#side) {
95
- this.#side = actualSide;
96
- }
97
- },
98
- renderPopup: (portal) => {
99
- const popupId = this.#ctx.value?.popupId ?? "";
100
- return html `
102
+ let DuiTooltipPopup = (() => {
103
+ let _classSuper = LitElement;
104
+ let _showArrow_decorators;
105
+ let _showArrow_initializers = [];
106
+ let _showArrow_extraInitializers = [];
107
+ let _private_side_decorators;
108
+ let _private_side_initializers = [];
109
+ let _private_side_extraInitializers = [];
110
+ let _private_side_descriptor;
111
+ return class DuiTooltipPopup extends _classSuper {
112
+ static {
113
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
114
+ _showArrow_decorators = [property({ type: Boolean, attribute: "show-arrow" })];
115
+ _private_side_decorators = [state()];
116
+ __esDecorate(this, null, _showArrow_decorators, { kind: "accessor", name: "showArrow", static: false, private: false, access: { has: obj => "showArrow" in obj, get: obj => obj.showArrow, set: (obj, value) => { obj.showArrow = value; } }, metadata: _metadata }, _showArrow_initializers, _showArrow_extraInitializers);
117
+ __esDecorate(this, _private_side_descriptor = { get: __setFunctionName(function () { return this.#side_accessor_storage; }, "#side", "get"), set: __setFunctionName(function (value) { this.#side_accessor_storage = value; }, "#side", "set") }, _private_side_decorators, { kind: "accessor", name: "#side", static: false, private: true, access: { has: obj => #side in obj, get: obj => obj.#side, set: (obj, value) => { obj.#side = value; } }, metadata: _metadata }, _private_side_initializers, _private_side_extraInitializers);
118
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
119
+ }
120
+ static tagName = "dui-tooltip-popup";
121
+ static styles = [base, hostStyles];
122
+ #showArrow_accessor_storage = __runInitializers(this, _showArrow_initializers, true);
123
+ /** Whether to show an arrow pointing to the trigger. */
124
+ get showArrow() { return this.#showArrow_accessor_storage; }
125
+ set showArrow(value) { this.#showArrow_accessor_storage = value; }
126
+ #side_accessor_storage = (__runInitializers(this, _showArrow_extraInitializers), __runInitializers(this, _private_side_initializers, "top"));
127
+ get #side() { return _private_side_descriptor.get.call(this); }
128
+ set #side(value) { return _private_side_descriptor.set.call(this, value); }
129
+ #ctx = (__runInitializers(this, _private_side_extraInitializers), new ContextConsumer(this, {
130
+ context: tooltipContext,
131
+ subscribe: true,
132
+ }));
133
+ #wasOpen = false;
134
+ #portal = new FloatingPortalController(this, {
135
+ getAnchor: () => this.#ctx.value?.triggerEl,
136
+ matchWidth: false,
137
+ placement: "top",
138
+ offset: 6,
139
+ styles: portalPopupStyles,
140
+ contentContainer: ".Content",
141
+ onPosition: ({ placement }) => {
142
+ const actualSide = placement.split("-")[0];
143
+ if (actualSide !== this.#side) {
144
+ this.#side = actualSide;
145
+ }
146
+ },
147
+ renderPopup: (portal) => {
148
+ const popupId = this.#ctx.value?.popupId ?? "";
149
+ return html `
101
150
  <div
102
151
  class="Popup"
103
152
  id="${popupId}"
@@ -110,28 +159,27 @@ export class DuiTooltipPopup extends LitElement {
110
159
  ${this.showArrow ? renderArrow(this.#side) : ""}
111
160
  </div>
112
161
  `;
113
- },
114
- });
115
- updated() {
116
- const isOpen = this.#ctx.value?.open ?? false;
117
- if (isOpen && !this.#wasOpen) {
118
- this.#updatePlacement();
119
- this.#portal.open();
162
+ },
163
+ });
164
+ updated() {
165
+ const isOpen = this.#ctx.value?.open ?? false;
166
+ if (isOpen && !this.#wasOpen) {
167
+ this.#updatePlacement();
168
+ this.#portal.open();
169
+ }
170
+ else if (!isOpen && this.#wasOpen) {
171
+ this.#portal.close();
172
+ }
173
+ this.#wasOpen = isOpen;
120
174
  }
121
- else if (!isOpen && this.#wasOpen) {
122
- this.#portal.close();
175
+ #updatePlacement() {
176
+ const side = this.#ctx.value?.side ?? "top";
177
+ this.#portal.placement = side;
178
+ this.#portal.offset = this.#ctx.value?.sideOffset ?? 6;
123
179
  }
124
- this.#wasOpen = isOpen;
125
- }
126
- #updatePlacement() {
127
- const side = this.#ctx.value?.side ?? "top";
128
- this.#portal.placement = side;
129
- this.#portal.offset = this.#ctx.value?.sideOffset ?? 6;
130
- }
131
- render() {
132
- return html `<slot></slot>`;
133
- }
134
- }
135
- __decorate([
136
- property({ type: Boolean, attribute: "show-arrow" })
137
- ], DuiTooltipPopup.prototype, "showArrow", null);
180
+ render() {
181
+ return html `<slot></slot>`;
182
+ }
183
+ };
184
+ })();
185
+ export { DuiTooltipPopup };