@deepfuture/dui-components 0.0.11 → 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 (250) hide show
  1. package/README.md +191 -0
  2. package/_deprecated/center/center.js +2 -2
  3. package/_deprecated/center/index.d.ts +3 -1
  4. package/_deprecated/center/index.js +3 -1
  5. package/_deprecated/hstack/hstack.js +79 -33
  6. package/_deprecated/hstack/index.d.ts +3 -1
  7. package/_deprecated/hstack/index.js +3 -1
  8. package/_deprecated/page-inset/index.d.ts +3 -1
  9. package/_deprecated/page-inset/index.js +3 -1
  10. package/_deprecated/page-inset/page-inset.js +104 -56
  11. package/_deprecated/vstack/index.d.ts +3 -1
  12. package/_deprecated/vstack/index.js +3 -1
  13. package/_deprecated/vstack/vstack.js +61 -19
  14. package/accordion/accordion-item.js +217 -147
  15. package/accordion/accordion.js +214 -149
  16. package/accordion/index.d.ts +5 -2
  17. package/accordion/index.js +5 -2
  18. package/alert-dialog/alert-dialog-close.js +2 -2
  19. package/alert-dialog/alert-dialog-popup.js +230 -166
  20. package/alert-dialog/alert-dialog-trigger.js +2 -2
  21. package/alert-dialog/alert-dialog.js +128 -73
  22. package/alert-dialog/index.d.ts +9 -4
  23. package/alert-dialog/index.js +9 -4
  24. package/avatar/avatar.js +175 -115
  25. package/avatar/index.d.ts +3 -1
  26. package/avatar/index.js +3 -1
  27. package/badge/badge.js +2 -2
  28. package/badge/index.d.ts +3 -1
  29. package/badge/index.js +3 -1
  30. package/breadcrumb/breadcrumb-ellipsis.js +2 -2
  31. package/breadcrumb/breadcrumb-item.js +2 -2
  32. package/breadcrumb/breadcrumb-link.js +2 -2
  33. package/breadcrumb/breadcrumb-page.js +2 -2
  34. package/breadcrumb/breadcrumb-separator.js +2 -2
  35. package/breadcrumb/breadcrumb.js +2 -2
  36. package/breadcrumb/index.d.ts +13 -6
  37. package/breadcrumb/index.js +13 -6
  38. package/button/button.js +109 -65
  39. package/button/index.d.ts +3 -1
  40. package/button/index.js +3 -1
  41. package/calendar/calendar.js +368 -290
  42. package/calendar/index.d.ts +3 -1
  43. package/calendar/index.js +3 -1
  44. package/checkbox/checkbox-group.js +146 -87
  45. package/checkbox/checkbox.js +232 -167
  46. package/checkbox/index.d.ts +5 -2
  47. package/checkbox/index.js +5 -2
  48. package/collapsible/collapsible.js +210 -132
  49. package/collapsible/index.d.ts +3 -1
  50. package/collapsible/index.js +3 -1
  51. package/combobox/combobox.js +318 -252
  52. package/combobox/index.d.ts +3 -1
  53. package/combobox/index.js +3 -1
  54. package/command/command-empty.js +67 -25
  55. package/command/command-group.js +87 -47
  56. package/command/command-input.js +84 -44
  57. package/command/command-item.js +168 -124
  58. package/command/command-list.js +60 -18
  59. package/command/command-separator.js +2 -2
  60. package/command/command-shortcut.js +2 -2
  61. package/command/command.js +297 -232
  62. package/command/index.d.ts +17 -8
  63. package/command/index.js +17 -8
  64. package/data-table/data-table.js +225 -153
  65. package/data-table/index.d.ts +3 -1
  66. package/data-table/index.js +3 -1
  67. package/dialog/dialog-close.js +2 -2
  68. package/dialog/dialog-popup.js +247 -181
  69. package/dialog/dialog-trigger.js +2 -2
  70. package/dialog/dialog.js +128 -73
  71. package/dialog/index.d.ts +9 -4
  72. package/dialog/index.js +9 -4
  73. package/dropzone/dropzone.js +310 -249
  74. package/dropzone/index.d.ts +3 -1
  75. package/dropzone/index.js +3 -1
  76. package/icon/icon.js +2 -2
  77. package/icon/index.d.ts +3 -1
  78. package/icon/index.js +3 -1
  79. package/input/index.d.ts +3 -1
  80. package/input/index.js +3 -1
  81. package/input/input.js +204 -143
  82. package/link/index.d.ts +3 -1
  83. package/link/index.js +3 -1
  84. package/link/link.js +62 -24
  85. package/menu/index.d.ts +5 -2
  86. package/menu/index.js +5 -2
  87. package/menu/menu-item.js +66 -24
  88. package/menu/menu.js +189 -136
  89. package/menubar/index.d.ts +3 -1
  90. package/menubar/index.js +3 -1
  91. package/menubar/menubar.js +142 -91
  92. package/number-field/index.d.ts +3 -1
  93. package/number-field/index.js +3 -1
  94. package/number-field/number-field.js +277 -204
  95. package/package.json +5 -4
  96. package/popover/index.d.ts +9 -4
  97. package/popover/index.js +9 -4
  98. package/popover/popover-close.js +2 -2
  99. package/popover/popover-popup.js +126 -76
  100. package/popover/popover-trigger.js +2 -2
  101. package/popover/popover.js +181 -120
  102. package/portal/index.d.ts +3 -1
  103. package/portal/index.js +3 -1
  104. package/portal/portal.js +128 -86
  105. package/preview-card/index.d.ts +7 -3
  106. package/preview-card/index.js +7 -3
  107. package/preview-card/preview-card-popup.js +114 -66
  108. package/preview-card/preview-card-trigger.js +2 -2
  109. package/preview-card/preview-card.js +211 -142
  110. package/progress/index.d.ts +3 -1
  111. package/progress/index.js +3 -1
  112. package/progress/progress.js +91 -45
  113. package/radio/index.d.ts +5 -2
  114. package/radio/index.js +5 -2
  115. package/radio/radio-group.js +153 -90
  116. package/radio/radio.js +137 -94
  117. package/scroll-area/index.d.ts +3 -1
  118. package/scroll-area/index.js +3 -1
  119. package/scroll-area/scroll-area.js +382 -276
  120. package/select/index.d.ts +3 -1
  121. package/select/index.js +3 -1
  122. package/select/select.js +260 -203
  123. package/separator/index.d.ts +3 -1
  124. package/separator/index.js +3 -1
  125. package/separator/separator.js +60 -18
  126. package/sidebar/index.d.ts +27 -13
  127. package/sidebar/index.js +32 -13
  128. package/sidebar/sidebar-content.js +2 -2
  129. package/sidebar/sidebar-footer.js +2 -2
  130. package/sidebar/sidebar-group-label.js +2 -2
  131. package/sidebar/sidebar-group.js +2 -2
  132. package/sidebar/sidebar-header.js +2 -2
  133. package/sidebar/sidebar-inset.js +2 -2
  134. package/sidebar/sidebar-menu-button.js +118 -74
  135. package/sidebar/sidebar-menu-item.js +2 -2
  136. package/sidebar/sidebar-menu.js +2 -2
  137. package/sidebar/sidebar-provider.js +202 -129
  138. package/sidebar/sidebar-separator.js +2 -2
  139. package/sidebar/sidebar-trigger.js +2 -2
  140. package/sidebar/sidebar.js +150 -85
  141. package/slider/index.d.ts +3 -1
  142. package/slider/index.js +3 -1
  143. package/slider/slider.js +217 -159
  144. package/spinner/index.d.ts +3 -1
  145. package/spinner/index.js +3 -1
  146. package/spinner/spinner.js +70 -28
  147. package/switch/index.d.ts +3 -1
  148. package/switch/index.js +3 -1
  149. package/switch/switch.js +174 -111
  150. package/tabs/index.d.ts +11 -5
  151. package/tabs/index.js +11 -5
  152. package/tabs/tab.js +89 -47
  153. package/tabs/tabs-indicator.js +2 -2
  154. package/tabs/tabs-list.js +92 -54
  155. package/tabs/tabs-panel.js +90 -44
  156. package/tabs/tabs.js +130 -71
  157. package/textarea/index.d.ts +3 -1
  158. package/textarea/index.js +3 -1
  159. package/textarea/textarea.js +153 -95
  160. package/toggle/index.d.ts +5 -2
  161. package/toggle/index.js +5 -2
  162. package/toggle/toggle-group.js +184 -125
  163. package/toggle/toggle.js +131 -76
  164. package/toolbar/index.d.ts +3 -1
  165. package/toolbar/index.js +3 -1
  166. package/toolbar/toolbar.js +79 -33
  167. package/tooltip/index.d.ts +7 -3
  168. package/tooltip/index.js +7 -3
  169. package/tooltip/tooltip-popup.js +108 -60
  170. package/tooltip/tooltip-trigger.js +93 -55
  171. package/tooltip/tooltip.js +225 -154
  172. package/trunc/index.d.ts +3 -1
  173. package/trunc/index.js +3 -1
  174. package/trunc/trunc.js +78 -34
  175. package/accordion/register.d.ts +0 -1
  176. package/accordion/register.js +0 -8
  177. package/alert-dialog/register.d.ts +0 -1
  178. package/alert-dialog/register.js +0 -16
  179. package/avatar/register.d.ts +0 -1
  180. package/avatar/register.js +0 -4
  181. package/badge/register.d.ts +0 -1
  182. package/badge/register.js +0 -4
  183. package/breadcrumb/register.d.ts +0 -1
  184. package/breadcrumb/register.js +0 -14
  185. package/button/register.d.ts +0 -1
  186. package/button/register.js +0 -4
  187. package/calendar/register.d.ts +0 -1
  188. package/calendar/register.js +0 -4
  189. package/checkbox/register.d.ts +0 -1
  190. package/checkbox/register.js +0 -8
  191. package/collapsible/register.d.ts +0 -1
  192. package/collapsible/register.js +0 -4
  193. package/combobox/register.d.ts +0 -1
  194. package/combobox/register.js +0 -4
  195. package/command/register.d.ts +0 -1
  196. package/command/register.js +0 -22
  197. package/data-table/register.d.ts +0 -1
  198. package/data-table/register.js +0 -4
  199. package/dialog/register.d.ts +0 -1
  200. package/dialog/register.js +0 -16
  201. package/dropzone/register.d.ts +0 -1
  202. package/dropzone/register.js +0 -4
  203. package/icon/register.d.ts +0 -1
  204. package/icon/register.js +0 -4
  205. package/input/register.d.ts +0 -1
  206. package/input/register.js +0 -4
  207. package/link/register.d.ts +0 -1
  208. package/link/register.js +0 -4
  209. package/menu/register.d.ts +0 -1
  210. package/menu/register.js +0 -8
  211. package/menubar/register.d.ts +0 -1
  212. package/menubar/register.js +0 -4
  213. package/number-field/register.d.ts +0 -1
  214. package/number-field/register.js +0 -4
  215. package/popover/register.d.ts +0 -1
  216. package/popover/register.js +0 -16
  217. package/portal/register.d.ts +0 -1
  218. package/portal/register.js +0 -4
  219. package/preview-card/register.d.ts +0 -1
  220. package/preview-card/register.js +0 -12
  221. package/progress/register.d.ts +0 -1
  222. package/progress/register.js +0 -4
  223. package/radio/register.d.ts +0 -1
  224. package/radio/register.js +0 -8
  225. package/scroll-area/register.d.ts +0 -1
  226. package/scroll-area/register.js +0 -4
  227. package/select/register.d.ts +0 -1
  228. package/select/register.js +0 -4
  229. package/separator/register.d.ts +0 -1
  230. package/separator/register.js +0 -4
  231. package/sidebar/register.d.ts +0 -1
  232. package/sidebar/register.js +0 -52
  233. package/slider/register.d.ts +0 -1
  234. package/slider/register.js +0 -4
  235. package/spinner/register.d.ts +0 -1
  236. package/spinner/register.js +0 -4
  237. package/switch/register.d.ts +0 -1
  238. package/switch/register.js +0 -4
  239. package/tabs/register.d.ts +0 -1
  240. package/tabs/register.js +0 -10
  241. package/textarea/register.d.ts +0 -1
  242. package/textarea/register.js +0 -4
  243. package/toggle/register.d.ts +0 -1
  244. package/toggle/register.js +0 -8
  245. package/toolbar/register.d.ts +0 -1
  246. package/toolbar/register.js +0 -4
  247. package/tooltip/register.d.ts +0 -1
  248. package/tooltip/register.js +0 -12
  249. package/trunc/register.d.ts +0 -1
  250. package/trunc/register.js +0 -4
package/portal/portal.js CHANGED
@@ -1,9 +1,37 @@
1
1
  /** Ported from original DUI: deep-future-app/app/client/components/dui/portal */
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";
@@ -25,91 +53,105 @@ const styles = css `
25
53
  * @attr {string} target - CSS selector for the destination container (default: "body").
26
54
  * @attr {"shadow" | "document"} target-root - Where to resolve the target selector.
27
55
  */
28
- export class DuiPortal extends LitElement {
29
- static { this.tagName = "dui-portal"; }
30
- static { this.styles = [styles]; }
31
- #target_accessor_storage = "body";
32
- /** CSS selector for the destination container. */
33
- get target() { return this.#target_accessor_storage; }
34
- set target(value) { this.#target_accessor_storage = value; }
35
- #targetRoot_accessor_storage = "document";
36
- /** Where to resolve the target selector: "document" (default) or "shadow". */
37
- get targetRoot() { return this.#targetRoot_accessor_storage; }
38
- set targetRoot(value) { this.#targetRoot_accessor_storage = value; }
39
- #targetElement_accessor_storage;
40
- /** Direct element reference for cross-shadow-root targets. Takes precedence over `target` selector. */
41
- get targetElement() { return this.#targetElement_accessor_storage; }
42
- set targetElement(value) { this.#targetElement_accessor_storage = value; }
43
- #container = undefined;
44
- #movedNodes = new Set();
45
- #isMoving = false;
46
- #queryTarget() {
47
- const root = getRootDocument(this, {
48
- composed: this.targetRoot === "document",
49
- });
50
- return root?.querySelector(this.target) ?? undefined;
51
- }
52
- connectedCallback() {
53
- super.connectedCallback();
54
- this.#container = this.targetElement ?? this.#queryTarget();
55
- if (this.#container && this.childNodes.length > 0) {
56
- this.#moveChildrenToTarget();
56
+ let DuiPortal = (() => {
57
+ let _classSuper = LitElement;
58
+ let _target_decorators;
59
+ let _target_initializers = [];
60
+ let _target_extraInitializers = [];
61
+ let _targetRoot_decorators;
62
+ let _targetRoot_initializers = [];
63
+ let _targetRoot_extraInitializers = [];
64
+ let _targetElement_decorators;
65
+ let _targetElement_initializers = [];
66
+ let _targetElement_extraInitializers = [];
67
+ return class DuiPortal extends _classSuper {
68
+ static {
69
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
70
+ _target_decorators = [property({ type: String })];
71
+ _targetRoot_decorators = [property({ type: String, attribute: "target-root", reflect: true })];
72
+ _targetElement_decorators = [property({ attribute: false })];
73
+ __esDecorate(this, null, _target_decorators, { kind: "accessor", name: "target", static: false, private: false, access: { has: obj => "target" in obj, get: obj => obj.target, set: (obj, value) => { obj.target = value; } }, metadata: _metadata }, _target_initializers, _target_extraInitializers);
74
+ __esDecorate(this, null, _targetRoot_decorators, { kind: "accessor", name: "targetRoot", static: false, private: false, access: { has: obj => "targetRoot" in obj, get: obj => obj.targetRoot, set: (obj, value) => { obj.targetRoot = value; } }, metadata: _metadata }, _targetRoot_initializers, _targetRoot_extraInitializers);
75
+ __esDecorate(this, null, _targetElement_decorators, { kind: "accessor", name: "targetElement", static: false, private: false, access: { has: obj => "targetElement" in obj, get: obj => obj.targetElement, set: (obj, value) => { obj.targetElement = value; } }, metadata: _metadata }, _targetElement_initializers, _targetElement_extraInitializers);
76
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
57
77
  }
58
- }
59
- disconnectedCallback() {
60
- super.disconnectedCallback();
61
- this.#detach();
62
- }
63
- updated(changed) {
64
- if (changed.has("target") ||
65
- changed.has("targetRoot") ||
66
- changed.has("targetElement")) {
78
+ static tagName = "dui-portal";
79
+ static styles = [styles];
80
+ #target_accessor_storage = __runInitializers(this, _target_initializers, "body");
81
+ /** CSS selector for the destination container. */
82
+ get target() { return this.#target_accessor_storage; }
83
+ set target(value) { this.#target_accessor_storage = value; }
84
+ #targetRoot_accessor_storage = (__runInitializers(this, _target_extraInitializers), __runInitializers(this, _targetRoot_initializers, "document"));
85
+ /** Where to resolve the target selector: "document" (default) or "shadow". */
86
+ get targetRoot() { return this.#targetRoot_accessor_storage; }
87
+ set targetRoot(value) { this.#targetRoot_accessor_storage = value; }
88
+ #targetElement_accessor_storage = (__runInitializers(this, _targetRoot_extraInitializers), __runInitializers(this, _targetElement_initializers, void 0));
89
+ /** Direct element reference for cross-shadow-root targets. Takes precedence over `target` selector. */
90
+ get targetElement() { return this.#targetElement_accessor_storage; }
91
+ set targetElement(value) { this.#targetElement_accessor_storage = value; }
92
+ #container = (__runInitializers(this, _targetElement_extraInitializers), undefined);
93
+ #movedNodes = new Set();
94
+ #isMoving = false;
95
+ #queryTarget() {
96
+ const root = getRootDocument(this, {
97
+ composed: this.targetRoot === "document",
98
+ });
99
+ return root?.querySelector(this.target) ?? undefined;
100
+ }
101
+ connectedCallback() {
102
+ super.connectedCallback();
103
+ this.#container = this.targetElement ?? this.#queryTarget();
104
+ if (this.#container && this.childNodes.length > 0) {
105
+ this.#moveChildrenToTarget();
106
+ }
107
+ }
108
+ disconnectedCallback() {
109
+ super.disconnectedCallback();
67
110
  this.#detach();
68
- this.#attach();
69
111
  }
70
- }
71
- #attach() {
72
- this.#container = this.targetElement ?? this.#queryTarget();
73
- this.#moveChildrenToTarget();
74
- }
75
- #detach() {
76
- if (this.#movedNodes.size === 0)
77
- return;
78
- this.#isMoving = true;
79
- for (const node of this.#movedNodes) {
80
- this.append(node);
112
+ updated(changed) {
113
+ if (changed.has("target") ||
114
+ changed.has("targetRoot") ||
115
+ changed.has("targetElement")) {
116
+ this.#detach();
117
+ this.#attach();
118
+ }
81
119
  }
82
- this.#movedNodes.clear();
83
- this.#isMoving = false;
84
- this.#container = undefined;
85
- }
86
- #moveChildrenToTarget() {
87
- if (!this.#container) {
88
- throw new Error(`Portal target does not exist: ${this.target}`);
120
+ #attach() {
121
+ this.#container = this.targetElement ?? this.#queryTarget();
122
+ this.#moveChildrenToTarget();
89
123
  }
90
- this.#isMoving = true;
91
- const nodes = Array.from(this.childNodes);
92
- for (const node of nodes) {
93
- this.#container.appendChild(node);
94
- this.#movedNodes.add(node);
124
+ #detach() {
125
+ if (this.#movedNodes.size === 0)
126
+ return;
127
+ this.#isMoving = true;
128
+ for (const node of this.#movedNodes) {
129
+ this.append(node);
130
+ }
131
+ this.#movedNodes.clear();
132
+ this.#isMoving = false;
133
+ this.#container = undefined;
134
+ }
135
+ #moveChildrenToTarget() {
136
+ if (!this.#container) {
137
+ throw new Error(`Portal target does not exist: ${this.target}`);
138
+ }
139
+ this.#isMoving = true;
140
+ const nodes = Array.from(this.childNodes);
141
+ for (const node of nodes) {
142
+ this.#container.appendChild(node);
143
+ this.#movedNodes.add(node);
144
+ }
145
+ this.#isMoving = false;
146
+ }
147
+ #handleSlotChange = () => {
148
+ if (this.#isMoving || !this.#container)
149
+ return;
150
+ this.#moveChildrenToTarget();
151
+ };
152
+ render() {
153
+ return html `<slot @slotchange=${this.#handleSlotChange}></slot>`;
95
154
  }
96
- this.#isMoving = false;
97
- }
98
- #handleSlotChange = () => {
99
- if (this.#isMoving || !this.#container)
100
- return;
101
- this.#moveChildrenToTarget();
102
155
  };
103
- render() {
104
- return html `<slot @slotchange=${this.#handleSlotChange}></slot>`;
105
- }
106
- }
107
- __decorate([
108
- property({ type: String })
109
- ], DuiPortal.prototype, "target", null);
110
- __decorate([
111
- property({ type: String, attribute: "target-root", reflect: true })
112
- ], DuiPortal.prototype, "targetRoot", null);
113
- __decorate([
114
- property({ attribute: false })
115
- ], DuiPortal.prototype, "targetElement", null);
156
+ })();
157
+ export { DuiPortal };
@@ -1,5 +1,9 @@
1
- export { DuiPreviewCard, openChangeEvent } from "./preview-card.js";
1
+ import { DuiPreviewCard, openChangeEvent } from "./preview-card.js";
2
+ export { DuiPreviewCard, openChangeEvent };
2
3
  export type { PreviewCardOpenChangeDetail } from "./preview-card.js";
3
- export { DuiPreviewCardTrigger } from "./preview-card-trigger.js";
4
- export { DuiPreviewCardPopup } from "./preview-card-popup.js";
4
+ import { DuiPreviewCardTrigger } from "./preview-card-trigger.js";
5
+ export { DuiPreviewCardTrigger };
6
+ import { DuiPreviewCardPopup } from "./preview-card-popup.js";
7
+ export { DuiPreviewCardPopup };
5
8
  export type { PreviewCardContext, PreviewCardSide } from "./preview-card-context.js";
9
+ export declare const previewCardFamily: (typeof DuiPreviewCard | typeof DuiPreviewCardTrigger | typeof DuiPreviewCardPopup)[];
@@ -1,3 +1,7 @@
1
- export { DuiPreviewCard, openChangeEvent } from "./preview-card.js";
2
- export { DuiPreviewCardTrigger } from "./preview-card-trigger.js";
3
- export { DuiPreviewCardPopup } from "./preview-card-popup.js";
1
+ import { DuiPreviewCard, openChangeEvent } from "./preview-card.js";
2
+ export { DuiPreviewCard, openChangeEvent };
3
+ import { DuiPreviewCardTrigger } from "./preview-card-trigger.js";
4
+ export { DuiPreviewCardTrigger };
5
+ import { DuiPreviewCardPopup } from "./preview-card-popup.js";
6
+ export { DuiPreviewCardPopup };
7
+ export const previewCardFamily = [DuiPreviewCard, DuiPreviewCardTrigger, DuiPreviewCardPopup];
@@ -1,12 +1,44 @@
1
1
  /** Ported from original DUI: deep-future-app/app/client/components/dui/preview-card */
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 { previewCardContext } from "./preview-card-context.js";
@@ -67,37 +99,54 @@ const portalPopupStyles = [
67
99
  *
68
100
  * @slot - Preview card content.
69
101
  */
70
- export class DuiPreviewCardPopup extends LitElement {
71
- static { this.tagName = "dui-preview-card-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: previewCardContext,
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: 8,
90
- styles: portalPopupStyles,
91
- contentContainer: ".PreviewCardContent",
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 DuiPreviewCardPopup = (() => {
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 DuiPreviewCardPopup 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-preview-card-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: previewCardContext,
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: 8,
139
+ styles: portalPopupStyles,
140
+ contentContainer: ".PreviewCardContent",
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}"
@@ -112,34 +161,33 @@ export class DuiPreviewCardPopup extends LitElement {
112
161
  ${this.showArrow ? renderArrow(this.#side) : ""}
113
162
  </div>
114
163
  `;
115
- },
116
- });
117
- #handleMouseEnter = () => {
118
- this.#ctx.value?.openPreviewCard();
119
- };
120
- #handleMouseLeave = () => {
121
- this.#ctx.value?.closePreviewCard();
122
- };
123
- updated() {
124
- const isOpen = this.#ctx.value?.open ?? false;
125
- if (isOpen && !this.#wasOpen) {
126
- this.#updatePlacement();
127
- this.#portal.open();
164
+ },
165
+ });
166
+ #handleMouseEnter = () => {
167
+ this.#ctx.value?.openPreviewCard();
168
+ };
169
+ #handleMouseLeave = () => {
170
+ this.#ctx.value?.closePreviewCard();
171
+ };
172
+ updated() {
173
+ const isOpen = this.#ctx.value?.open ?? false;
174
+ if (isOpen && !this.#wasOpen) {
175
+ this.#updatePlacement();
176
+ this.#portal.open();
177
+ }
178
+ else if (!isOpen && this.#wasOpen) {
179
+ this.#portal.close();
180
+ }
181
+ this.#wasOpen = isOpen;
128
182
  }
129
- else if (!isOpen && this.#wasOpen) {
130
- this.#portal.close();
183
+ #updatePlacement() {
184
+ const side = this.#ctx.value?.side ?? "top";
185
+ this.#portal.placement = side;
186
+ this.#portal.offset = this.#ctx.value?.sideOffset ?? 8;
131
187
  }
132
- this.#wasOpen = isOpen;
133
- }
134
- #updatePlacement() {
135
- const side = this.#ctx.value?.side ?? "top";
136
- this.#portal.placement = side;
137
- this.#portal.offset = this.#ctx.value?.sideOffset ?? 8;
138
- }
139
- render() {
140
- return html `<slot></slot>`;
141
- }
142
- }
143
- __decorate([
144
- property({ type: Boolean, attribute: "show-arrow" })
145
- ], DuiPreviewCardPopup.prototype, "showArrow", null);
188
+ render() {
189
+ return html `<slot></slot>`;
190
+ }
191
+ };
192
+ })();
193
+ export { DuiPreviewCardPopup };
@@ -19,8 +19,8 @@ const componentStyles = css `
19
19
  * @slot - Content that triggers the preview card.
20
20
  */
21
21
  export class DuiPreviewCardTrigger extends LitElement {
22
- static { this.tagName = "dui-preview-card-trigger"; }
23
- static { this.styles = [base, hostStyles, componentStyles]; }
22
+ static tagName = "dui-preview-card-trigger";
23
+ static styles = [base, hostStyles, componentStyles];
24
24
  #ctx = new ContextConsumer(this, {
25
25
  context: previewCardContext,
26
26
  subscribe: true,