@deepfuture/dui-components 0.0.1

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 (380) hide show
  1. package/accordion/accordion-context.d.ts +15 -0
  2. package/accordion/accordion-context.js +3 -0
  3. package/accordion/accordion-item.d.ts +22 -0
  4. package/accordion/accordion-item.js +254 -0
  5. package/accordion/accordion.d.ts +20 -0
  6. package/accordion/accordion.js +185 -0
  7. package/accordion/index.d.ts +3 -0
  8. package/accordion/index.js +2 -0
  9. package/accordion/register.d.ts +1 -0
  10. package/accordion/register.js +8 -0
  11. package/alert-dialog/alert-dialog-close.d.ts +15 -0
  12. package/alert-dialog/alert-dialog-close.js +35 -0
  13. package/alert-dialog/alert-dialog-context.d.ts +13 -0
  14. package/alert-dialog/alert-dialog-context.js +3 -0
  15. package/alert-dialog/alert-dialog-popup.d.ts +34 -0
  16. package/alert-dialog/alert-dialog-popup.js +260 -0
  17. package/alert-dialog/alert-dialog-trigger.d.ts +15 -0
  18. package/alert-dialog/alert-dialog-trigger.js +52 -0
  19. package/alert-dialog/alert-dialog.d.ts +30 -0
  20. package/alert-dialog/alert-dialog.js +97 -0
  21. package/alert-dialog/index.d.ts +6 -0
  22. package/alert-dialog/index.js +4 -0
  23. package/alert-dialog/register.d.ts +1 -0
  24. package/alert-dialog/register.js +16 -0
  25. package/all.d.ts +86 -0
  26. package/all.js +191 -0
  27. package/avatar/avatar.d.ts +41 -0
  28. package/avatar/avatar.js +188 -0
  29. package/avatar/index.d.ts +2 -0
  30. package/avatar/index.js +1 -0
  31. package/avatar/register.d.ts +1 -0
  32. package/avatar/register.js +4 -0
  33. package/badge/badge.d.ts +14 -0
  34. package/badge/badge.js +43 -0
  35. package/badge/index.d.ts +2 -0
  36. package/badge/index.js +1 -0
  37. package/badge/register.d.ts +1 -0
  38. package/badge/register.js +4 -0
  39. package/breadcrumb/breadcrumb-ellipsis.d.ts +14 -0
  40. package/breadcrumb/breadcrumb-ellipsis.js +39 -0
  41. package/breadcrumb/breadcrumb-item.d.ts +13 -0
  42. package/breadcrumb/breadcrumb-item.js +31 -0
  43. package/breadcrumb/breadcrumb-link.d.ts +14 -0
  44. package/breadcrumb/breadcrumb-link.js +32 -0
  45. package/breadcrumb/breadcrumb-page.d.ts +13 -0
  46. package/breadcrumb/breadcrumb-page.js +36 -0
  47. package/breadcrumb/breadcrumb-separator.d.ts +14 -0
  48. package/breadcrumb/breadcrumb-separator.js +36 -0
  49. package/breadcrumb/breadcrumb.d.ts +14 -0
  50. package/breadcrumb/breadcrumb.js +38 -0
  51. package/breadcrumb/index.d.ts +6 -0
  52. package/breadcrumb/index.js +6 -0
  53. package/breadcrumb/register.d.ts +1 -0
  54. package/breadcrumb/register.js +14 -0
  55. package/button/button.d.ts +38 -0
  56. package/button/button.js +143 -0
  57. package/button/index.d.ts +2 -0
  58. package/button/index.js +1 -0
  59. package/button/register.d.ts +1 -0
  60. package/button/register.js +4 -0
  61. package/calendar/calendar.d.ts +33 -0
  62. package/calendar/calendar.js +428 -0
  63. package/calendar/index.d.ts +1 -0
  64. package/calendar/index.js +1 -0
  65. package/calendar/register.d.ts +1 -0
  66. package/calendar/register.js +4 -0
  67. package/center/center.d.ts +14 -0
  68. package/center/center.js +37 -0
  69. package/center/index.d.ts +1 -0
  70. package/center/index.js +1 -0
  71. package/center/register.d.ts +1 -0
  72. package/center/register.js +4 -0
  73. package/checkbox/checkbox-group-context.d.ts +11 -0
  74. package/checkbox/checkbox-group-context.js +3 -0
  75. package/checkbox/checkbox-group.d.ts +34 -0
  76. package/checkbox/checkbox-group.js +128 -0
  77. package/checkbox/checkbox.d.ts +46 -0
  78. package/checkbox/checkbox.js +314 -0
  79. package/checkbox/index.d.ts +3 -0
  80. package/checkbox/index.js +2 -0
  81. package/checkbox/register.d.ts +1 -0
  82. package/checkbox/register.js +8 -0
  83. package/collapsible/collapsible.d.ts +22 -0
  84. package/collapsible/collapsible.js +227 -0
  85. package/collapsible/index.d.ts +1 -0
  86. package/collapsible/index.js +1 -0
  87. package/collapsible/register.d.ts +1 -0
  88. package/collapsible/register.js +4 -0
  89. package/combobox/combobox.d.ts +46 -0
  90. package/combobox/combobox.js +524 -0
  91. package/combobox/index.d.ts +2 -0
  92. package/combobox/index.js +1 -0
  93. package/combobox/register.d.ts +1 -0
  94. package/combobox/register.js +4 -0
  95. package/command/command-context.d.ts +30 -0
  96. package/command/command-context.js +3 -0
  97. package/command/command-empty.d.ts +10 -0
  98. package/command/command-empty.js +50 -0
  99. package/command/command-group.d.ts +15 -0
  100. package/command/command-group.js +79 -0
  101. package/command/command-input.d.ts +13 -0
  102. package/command/command-input.js +106 -0
  103. package/command/command-item.d.ts +20 -0
  104. package/command/command-item.js +175 -0
  105. package/command/command-list.d.ts +9 -0
  106. package/command/command-list.js +43 -0
  107. package/command/command-score.d.ts +6 -0
  108. package/command/command-score.js +31 -0
  109. package/command/command-separator.d.ts +7 -0
  110. package/command/command-separator.js +15 -0
  111. package/command/command-shortcut.d.ts +7 -0
  112. package/command/command-shortcut.js +16 -0
  113. package/command/command.d.ts +25 -0
  114. package/command/command.js +278 -0
  115. package/command/index.d.ts +10 -0
  116. package/command/index.js +9 -0
  117. package/command/register.d.ts +1 -0
  118. package/command/register.js +22 -0
  119. package/data-table/data-table.d.ts +59 -0
  120. package/data-table/data-table.js +416 -0
  121. package/data-table/index.d.ts +2 -0
  122. package/data-table/index.js +1 -0
  123. package/data-table/register.d.ts +1 -0
  124. package/data-table/register.js +4 -0
  125. package/dialog/dialog-close.d.ts +15 -0
  126. package/dialog/dialog-close.js +35 -0
  127. package/dialog/dialog-context.d.ts +13 -0
  128. package/dialog/dialog-context.js +3 -0
  129. package/dialog/dialog-popup.d.ts +36 -0
  130. package/dialog/dialog-popup.js +277 -0
  131. package/dialog/dialog-trigger.d.ts +15 -0
  132. package/dialog/dialog-trigger.js +52 -0
  133. package/dialog/dialog.d.ts +30 -0
  134. package/dialog/dialog.js +97 -0
  135. package/dialog/index.d.ts +6 -0
  136. package/dialog/index.js +4 -0
  137. package/dialog/register.d.ts +1 -0
  138. package/dialog/register.js +16 -0
  139. package/dropzone/dropzone.d.ts +74 -0
  140. package/dropzone/dropzone.js +357 -0
  141. package/dropzone/index.d.ts +2 -0
  142. package/dropzone/index.js +1 -0
  143. package/dropzone/register.d.ts +1 -0
  144. package/dropzone/register.js +4 -0
  145. package/field/field-context.d.ts +20 -0
  146. package/field/field-context.js +2 -0
  147. package/field/index.d.ts +2 -0
  148. package/field/index.js +1 -0
  149. package/global.d.ts +189 -0
  150. package/hstack/hstack.d.ts +25 -0
  151. package/hstack/hstack.js +141 -0
  152. package/hstack/index.d.ts +2 -0
  153. package/hstack/index.js +1 -0
  154. package/hstack/register.d.ts +1 -0
  155. package/hstack/register.js +4 -0
  156. package/icon/icon.d.ts +16 -0
  157. package/icon/icon.js +34 -0
  158. package/icon/index.d.ts +1 -0
  159. package/icon/index.js +1 -0
  160. package/icon/register.d.ts +1 -0
  161. package/icon/register.js +4 -0
  162. package/input/index.d.ts +1 -0
  163. package/input/index.js +1 -0
  164. package/input/input.d.ts +47 -0
  165. package/input/input.js +205 -0
  166. package/input/register.d.ts +1 -0
  167. package/input/register.js +4 -0
  168. package/link/index.d.ts +1 -0
  169. package/link/index.js +1 -0
  170. package/link/link.d.ts +27 -0
  171. package/link/link.js +57 -0
  172. package/link/register.d.ts +1 -0
  173. package/link/register.js +4 -0
  174. package/menu/index.d.ts +2 -0
  175. package/menu/index.js +2 -0
  176. package/menu/menu-item.d.ts +17 -0
  177. package/menu/menu-item.js +62 -0
  178. package/menu/menu.d.ts +15 -0
  179. package/menu/menu.js +228 -0
  180. package/menu/register.d.ts +1 -0
  181. package/menu/register.js +8 -0
  182. package/menubar/index.d.ts +2 -0
  183. package/menubar/index.js +1 -0
  184. package/menubar/menubar-context.d.ts +9 -0
  185. package/menubar/menubar-context.js +2 -0
  186. package/menubar/menubar.d.ts +19 -0
  187. package/menubar/menubar.js +130 -0
  188. package/menubar/register.d.ts +1 -0
  189. package/menubar/register.js +4 -0
  190. package/number-field/index.d.ts +1 -0
  191. package/number-field/index.js +1 -0
  192. package/number-field/number-field.d.ts +34 -0
  193. package/number-field/number-field.js +326 -0
  194. package/number-field/register.d.ts +1 -0
  195. package/number-field/register.js +4 -0
  196. package/package.json +217 -0
  197. package/page-inset/index.d.ts +1 -0
  198. package/page-inset/index.js +1 -0
  199. package/page-inset/page-inset.d.ts +28 -0
  200. package/page-inset/page-inset.js +103 -0
  201. package/page-inset/register.d.ts +1 -0
  202. package/page-inset/register.js +4 -0
  203. package/popover/index.d.ts +6 -0
  204. package/popover/index.js +4 -0
  205. package/popover/popover-close.d.ts +13 -0
  206. package/popover/popover-close.js +33 -0
  207. package/popover/popover-context.d.ts +17 -0
  208. package/popover/popover-context.js +3 -0
  209. package/popover/popover-popup.d.ts +20 -0
  210. package/popover/popover-popup.js +176 -0
  211. package/popover/popover-trigger.d.ts +13 -0
  212. package/popover/popover-trigger.js +57 -0
  213. package/popover/popover.d.ts +30 -0
  214. package/popover/popover.js +140 -0
  215. package/popover/register.d.ts +1 -0
  216. package/popover/register.js +16 -0
  217. package/portal/index.d.ts +2 -0
  218. package/portal/index.js +1 -0
  219. package/portal/portal.d.ts +29 -0
  220. package/portal/portal.js +115 -0
  221. package/portal/register.d.ts +1 -0
  222. package/portal/register.js +4 -0
  223. package/preview-card/index.d.ts +5 -0
  224. package/preview-card/index.js +3 -0
  225. package/preview-card/preview-card-context.d.ts +16 -0
  226. package/preview-card/preview-card-context.js +3 -0
  227. package/preview-card/preview-card-popup.d.ts +16 -0
  228. package/preview-card/preview-card-popup.js +167 -0
  229. package/preview-card/preview-card-trigger.d.ts +13 -0
  230. package/preview-card/preview-card-trigger.js +75 -0
  231. package/preview-card/preview-card.d.ts +34 -0
  232. package/preview-card/preview-card.js +164 -0
  233. package/preview-card/register.d.ts +1 -0
  234. package/preview-card/register.js +12 -0
  235. package/progress/index.d.ts +1 -0
  236. package/progress/index.js +1 -0
  237. package/progress/progress.d.ts +19 -0
  238. package/progress/progress.js +94 -0
  239. package/progress/register.d.ts +1 -0
  240. package/progress/register.js +4 -0
  241. package/radio/index.d.ts +3 -0
  242. package/radio/index.js +2 -0
  243. package/radio/radio-group-context.d.ts +11 -0
  244. package/radio/radio-group-context.js +2 -0
  245. package/radio/radio-group.d.ts +37 -0
  246. package/radio/radio-group.js +135 -0
  247. package/radio/radio.d.ts +27 -0
  248. package/radio/radio.js +204 -0
  249. package/radio/register.d.ts +1 -0
  250. package/radio/register.js +8 -0
  251. package/scroll-area/index.d.ts +1 -0
  252. package/scroll-area/index.js +1 -0
  253. package/scroll-area/register.d.ts +1 -0
  254. package/scroll-area/register.js +4 -0
  255. package/scroll-area/scroll-area.d.ts +38 -0
  256. package/scroll-area/scroll-area.js +453 -0
  257. package/select/index.d.ts +2 -0
  258. package/select/index.js +1 -0
  259. package/select/register.d.ts +1 -0
  260. package/select/register.js +4 -0
  261. package/select/select.d.ts +36 -0
  262. package/select/select.js +404 -0
  263. package/separator/index.d.ts +1 -0
  264. package/separator/index.js +1 -0
  265. package/separator/register.d.ts +1 -0
  266. package/separator/register.js +4 -0
  267. package/separator/separator.d.ts +12 -0
  268. package/separator/separator.js +50 -0
  269. package/sidebar/index.d.ts +16 -0
  270. package/sidebar/index.js +13 -0
  271. package/sidebar/register.d.ts +1 -0
  272. package/sidebar/register.js +52 -0
  273. package/sidebar/sidebar-content.d.ts +14 -0
  274. package/sidebar/sidebar-content.js +30 -0
  275. package/sidebar/sidebar-context.d.ts +15 -0
  276. package/sidebar/sidebar-context.js +3 -0
  277. package/sidebar/sidebar-footer.d.ts +12 -0
  278. package/sidebar/sidebar-footer.js +21 -0
  279. package/sidebar/sidebar-group-label.d.ts +17 -0
  280. package/sidebar/sidebar-group-label.js +49 -0
  281. package/sidebar/sidebar-group.d.ts +15 -0
  282. package/sidebar/sidebar-group.js +29 -0
  283. package/sidebar/sidebar-header.d.ts +12 -0
  284. package/sidebar/sidebar-header.js +21 -0
  285. package/sidebar/sidebar-inset.d.ts +15 -0
  286. package/sidebar/sidebar-inset.js +29 -0
  287. package/sidebar/sidebar-menu-button.d.ts +31 -0
  288. package/sidebar/sidebar-menu-button.js +201 -0
  289. package/sidebar/sidebar-menu-item.d.ts +12 -0
  290. package/sidebar/sidebar-menu-item.js +20 -0
  291. package/sidebar/sidebar-menu.d.ts +14 -0
  292. package/sidebar/sidebar-menu.js +30 -0
  293. package/sidebar/sidebar-provider.d.ts +34 -0
  294. package/sidebar/sidebar-provider.js +157 -0
  295. package/sidebar/sidebar-separator.d.ts +12 -0
  296. package/sidebar/sidebar-separator.js +24 -0
  297. package/sidebar/sidebar-trigger.d.ts +16 -0
  298. package/sidebar/sidebar-trigger.js +50 -0
  299. package/sidebar/sidebar.d.ts +21 -0
  300. package/sidebar/sidebar.js +228 -0
  301. package/slider/index.d.ts +1 -0
  302. package/slider/index.js +1 -0
  303. package/slider/register.d.ts +1 -0
  304. package/slider/register.js +4 -0
  305. package/slider/slider.d.ts +37 -0
  306. package/slider/slider.js +268 -0
  307. package/spinner/index.d.ts +1 -0
  308. package/spinner/index.js +1 -0
  309. package/spinner/register.d.ts +1 -0
  310. package/spinner/register.js +4 -0
  311. package/spinner/spinner.d.ts +18 -0
  312. package/spinner/spinner.js +138 -0
  313. package/switch/index.d.ts +1 -0
  314. package/switch/index.js +1 -0
  315. package/switch/register.d.ts +1 -0
  316. package/switch/register.js +4 -0
  317. package/switch/switch.d.ts +29 -0
  318. package/switch/switch.js +201 -0
  319. package/tabs/index.d.ts +6 -0
  320. package/tabs/index.js +5 -0
  321. package/tabs/register.d.ts +1 -0
  322. package/tabs/register.js +10 -0
  323. package/tabs/tab.d.ts +16 -0
  324. package/tabs/tab.js +98 -0
  325. package/tabs/tabs-context.d.ts +8 -0
  326. package/tabs/tabs-context.js +2 -0
  327. package/tabs/tabs-indicator.d.ts +11 -0
  328. package/tabs/tabs-indicator.js +27 -0
  329. package/tabs/tabs-list.d.ts +17 -0
  330. package/tabs/tabs-list.js +85 -0
  331. package/tabs/tabs-panel.d.ts +18 -0
  332. package/tabs/tabs-panel.js +85 -0
  333. package/tabs/tabs.d.ts +24 -0
  334. package/tabs/tabs.js +111 -0
  335. package/textarea/index.d.ts +2 -0
  336. package/textarea/index.js +1 -0
  337. package/textarea/register.d.ts +1 -0
  338. package/textarea/register.js +4 -0
  339. package/textarea/textarea.d.ts +37 -0
  340. package/textarea/textarea.js +170 -0
  341. package/toggle/index.d.ts +3 -0
  342. package/toggle/index.js +2 -0
  343. package/toggle/register.d.ts +1 -0
  344. package/toggle/register.js +8 -0
  345. package/toggle/toggle-group-context.d.ts +9 -0
  346. package/toggle/toggle-group-context.js +2 -0
  347. package/toggle/toggle-group.d.ts +27 -0
  348. package/toggle/toggle-group.js +163 -0
  349. package/toggle/toggle.d.ts +25 -0
  350. package/toggle/toggle.js +124 -0
  351. package/toolbar/index.d.ts +1 -0
  352. package/toolbar/index.js +1 -0
  353. package/toolbar/register.d.ts +1 -0
  354. package/toolbar/register.js +4 -0
  355. package/toolbar/toolbar.d.ts +15 -0
  356. package/toolbar/toolbar.js +89 -0
  357. package/tooltip/index.d.ts +5 -0
  358. package/tooltip/index.js +3 -0
  359. package/tooltip/register.d.ts +1 -0
  360. package/tooltip/register.js +12 -0
  361. package/tooltip/tooltip-context.d.ts +17 -0
  362. package/tooltip/tooltip-context.js +3 -0
  363. package/tooltip/tooltip-popup.d.ts +16 -0
  364. package/tooltip/tooltip-popup.js +162 -0
  365. package/tooltip/tooltip-trigger.d.ts +15 -0
  366. package/tooltip/tooltip-trigger.js +110 -0
  367. package/tooltip/tooltip.d.ts +36 -0
  368. package/tooltip/tooltip.js +176 -0
  369. package/trunc/index.d.ts +1 -0
  370. package/trunc/index.js +1 -0
  371. package/trunc/register.d.ts +1 -0
  372. package/trunc/register.js +4 -0
  373. package/trunc/trunc.d.ts +19 -0
  374. package/trunc/trunc.js +68 -0
  375. package/vstack/index.d.ts +1 -0
  376. package/vstack/index.js +1 -0
  377. package/vstack/register.d.ts +1 -0
  378. package/vstack/register.js +4 -0
  379. package/vstack/vstack.d.ts +17 -0
  380. package/vstack/vstack.js +83 -0
@@ -0,0 +1,268 @@
1
+ /** Ported from original DUI: deep-future-app/app/client/components/dui/slider */
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;
7
+ };
8
+ import { css, html, LitElement } from "lit";
9
+ import { property } from "lit/decorators.js";
10
+ import { base } from "@deepfuture/dui-core/base";
11
+ import { customEvent } from "@deepfuture/dui-core/event";
12
+ export const valueChangeEvent = customEvent("value-change", { bubbles: true, composed: true });
13
+ export const valueCommittedEvent = customEvent("value-committed", { bubbles: true, composed: true });
14
+ const styles = css `
15
+ :host {
16
+ display: block;
17
+ }
18
+
19
+ [part="root"] {
20
+ position: relative;
21
+ display: flex;
22
+ align-items: center;
23
+ width: 100%;
24
+ touch-action: none;
25
+ user-select: none;
26
+ }
27
+
28
+ [part="root"][data-disabled] {
29
+ pointer-events: none;
30
+ }
31
+
32
+ [part="track"] {
33
+ position: relative;
34
+ flex-grow: 1;
35
+ overflow: hidden;
36
+ }
37
+
38
+ [part="indicator"] {
39
+ position: absolute;
40
+ top: 0;
41
+ left: 0;
42
+ height: 100%;
43
+ width: var(--slider-progress, 0%);
44
+ }
45
+
46
+ [part="thumb"] {
47
+ position: absolute;
48
+ left: var(--slider-progress, 0%);
49
+ transform: translateX(-50%);
50
+ cursor: grab;
51
+ outline: none;
52
+ transition-property: left, box-shadow;
53
+ }
54
+
55
+ [part="root"][data-dragging] [part="thumb"] {
56
+ cursor: grabbing;
57
+ }
58
+
59
+ /* Hidden native input for accessibility */
60
+ .native-input {
61
+ position: absolute;
62
+ width: 1px;
63
+ height: 1px;
64
+ padding: 0;
65
+ margin: -1px;
66
+ overflow: hidden;
67
+ clip: rect(0, 0, 0, 0);
68
+ white-space: nowrap;
69
+ border: 0;
70
+ }
71
+ `;
72
+ /**
73
+ * A slider for selecting numeric values within a range.
74
+ *
75
+ * Supports pointer drag, keyboard navigation (arrows, Page Up/Down, Home/End),
76
+ * and a hidden native range input for accessibility.
77
+ */
78
+ export class DuiSlider extends LitElement {
79
+ static { this.tagName = "dui-slider"; }
80
+ static { this.styles = [base, styles]; }
81
+ #value_accessor_storage = 0;
82
+ /** Current value. */
83
+ get value() { return this.#value_accessor_storage; }
84
+ set value(value) { this.#value_accessor_storage = value; }
85
+ #min_accessor_storage = 0;
86
+ /** Minimum value. */
87
+ get min() { return this.#min_accessor_storage; }
88
+ set min(value) { this.#min_accessor_storage = value; }
89
+ #max_accessor_storage = 100;
90
+ /** Maximum value. */
91
+ get max() { return this.#max_accessor_storage; }
92
+ set max(value) { this.#max_accessor_storage = value; }
93
+ #step_accessor_storage = 1;
94
+ /** Step increment. */
95
+ get step() { return this.#step_accessor_storage; }
96
+ set step(value) { this.#step_accessor_storage = value; }
97
+ #disabled_accessor_storage = false;
98
+ /** Whether the slider is disabled. */
99
+ get disabled() { return this.#disabled_accessor_storage; }
100
+ set disabled(value) { this.#disabled_accessor_storage = value; }
101
+ #name_accessor_storage = "";
102
+ /** Name for form submission. */
103
+ get name() { return this.#name_accessor_storage; }
104
+ set name(value) { this.#name_accessor_storage = value; }
105
+ #dragging_accessor_storage = false;
106
+ get #dragging() { return this.#dragging_accessor_storage; }
107
+ set #dragging(value) { this.#dragging_accessor_storage = value; }
108
+ get #progress() {
109
+ const range = this.max - this.min;
110
+ if (range === 0)
111
+ return 0;
112
+ return ((this.value - this.min) / range) * 100;
113
+ }
114
+ #clampValue(value) {
115
+ const stepped = Math.round(value / this.step) * this.step;
116
+ return Math.max(this.min, Math.min(this.max, stepped));
117
+ }
118
+ #getValueFromPosition(clientX) {
119
+ const track = this.shadowRoot?.querySelector("[part='track']");
120
+ if (!track)
121
+ return this.value;
122
+ const rect = track.getBoundingClientRect();
123
+ const percentage = (clientX - rect.left) / rect.width;
124
+ const rawValue = this.min + percentage * (this.max - this.min);
125
+ return this.#clampValue(rawValue);
126
+ }
127
+ #onPointerDown = (event) => {
128
+ if (this.disabled)
129
+ return;
130
+ event.preventDefault();
131
+ this.#dragging = true;
132
+ const newValue = this.#getValueFromPosition(event.clientX);
133
+ if (newValue !== this.value) {
134
+ this.value = newValue;
135
+ this.dispatchEvent(valueChangeEvent({ value: newValue }));
136
+ }
137
+ document.addEventListener("pointermove", this.#onPointerMove);
138
+ document.addEventListener("pointerup", this.#onPointerUp);
139
+ };
140
+ #onPointerMove = (event) => {
141
+ if (!this.#dragging)
142
+ return;
143
+ const newValue = this.#getValueFromPosition(event.clientX);
144
+ if (newValue !== this.value) {
145
+ this.value = newValue;
146
+ this.dispatchEvent(valueChangeEvent({ value: newValue }));
147
+ }
148
+ };
149
+ #onPointerUp = () => {
150
+ if (!this.#dragging)
151
+ return;
152
+ this.#dragging = false;
153
+ this.dispatchEvent(valueCommittedEvent({ value: this.value }));
154
+ document.removeEventListener("pointermove", this.#onPointerMove);
155
+ document.removeEventListener("pointerup", this.#onPointerUp);
156
+ };
157
+ #onKeyDown = (event) => {
158
+ if (this.disabled)
159
+ return;
160
+ let newValue = this.value;
161
+ const largeStep = this.step * 10;
162
+ switch (event.key) {
163
+ case "ArrowRight":
164
+ case "ArrowUp":
165
+ event.preventDefault();
166
+ newValue = this.#clampValue(this.value + this.step);
167
+ break;
168
+ case "ArrowLeft":
169
+ case "ArrowDown":
170
+ event.preventDefault();
171
+ newValue = this.#clampValue(this.value - this.step);
172
+ break;
173
+ case "PageUp":
174
+ event.preventDefault();
175
+ newValue = this.#clampValue(this.value + largeStep);
176
+ break;
177
+ case "PageDown":
178
+ event.preventDefault();
179
+ newValue = this.#clampValue(this.value - largeStep);
180
+ break;
181
+ case "Home":
182
+ event.preventDefault();
183
+ newValue = this.min;
184
+ break;
185
+ case "End":
186
+ event.preventDefault();
187
+ newValue = this.max;
188
+ break;
189
+ default:
190
+ return;
191
+ }
192
+ if (newValue !== this.value) {
193
+ this.value = newValue;
194
+ this.dispatchEvent(valueChangeEvent({ value: newValue }));
195
+ this.dispatchEvent(valueCommittedEvent({ value: newValue }));
196
+ }
197
+ };
198
+ #onNativeInput = (event) => {
199
+ const target = event.target;
200
+ const newValue = parseFloat(target.value);
201
+ if (!isNaN(newValue) && newValue !== this.value) {
202
+ this.value = newValue;
203
+ this.dispatchEvent(valueChangeEvent({ value: newValue }));
204
+ }
205
+ };
206
+ #onNativeChange = () => {
207
+ this.dispatchEvent(valueCommittedEvent({ value: this.value }));
208
+ };
209
+ disconnectedCallback() {
210
+ super.disconnectedCallback();
211
+ document.removeEventListener("pointermove", this.#onPointerMove);
212
+ document.removeEventListener("pointerup", this.#onPointerUp);
213
+ }
214
+ render() {
215
+ return html `
216
+ <div
217
+ part="root"
218
+ role="group"
219
+ ?data-disabled=${this.disabled}
220
+ ?data-dragging=${this.#dragging}
221
+ style="--slider-progress: ${this.#progress}%"
222
+ @pointerdown=${this.#onPointerDown}
223
+ >
224
+ <div part="track">
225
+ <div part="indicator"></div>
226
+ </div>
227
+ <div
228
+ part="thumb"
229
+ tabindex=${this.disabled ? -1 : 0}
230
+ @keydown=${this.#onKeyDown}
231
+ ></div>
232
+ <input
233
+ class="native-input"
234
+ type="range"
235
+ name=${this.name}
236
+ .value=${String(this.value)}
237
+ min=${this.min}
238
+ max=${this.max}
239
+ step=${this.step}
240
+ ?disabled=${this.disabled}
241
+ aria-valuenow=${this.value}
242
+ aria-valuemin=${this.min}
243
+ aria-valuemax=${this.max}
244
+ @input=${this.#onNativeInput}
245
+ @change=${this.#onNativeChange}
246
+ />
247
+ </div>
248
+ `;
249
+ }
250
+ }
251
+ __decorate([
252
+ property({ type: Number })
253
+ ], DuiSlider.prototype, "value", null);
254
+ __decorate([
255
+ property({ type: Number })
256
+ ], DuiSlider.prototype, "min", null);
257
+ __decorate([
258
+ property({ type: Number })
259
+ ], DuiSlider.prototype, "max", null);
260
+ __decorate([
261
+ property({ type: Number })
262
+ ], DuiSlider.prototype, "step", null);
263
+ __decorate([
264
+ property({ type: Boolean, reflect: true })
265
+ ], DuiSlider.prototype, "disabled", null);
266
+ __decorate([
267
+ property()
268
+ ], DuiSlider.prototype, "name", null);
@@ -0,0 +1 @@
1
+ export { DuiSpinner } from "./spinner.js";
@@ -0,0 +1 @@
1
+ export { DuiSpinner } from "./spinner.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import { DuiSpinner } from "./spinner.js";
2
+ if (!customElements.get(DuiSpinner.tagName)) {
3
+ customElements.define(DuiSpinner.tagName, DuiSpinner);
4
+ }
@@ -0,0 +1,18 @@
1
+ /** Ported from original DUI: deep-future-app/app/client/components/dui/spinner */
2
+ import { LitElement, type TemplateResult } from "lit";
3
+ type SpinnerSize = "sm" | "md" | "lg";
4
+ type SpinnerVariant = "pulse" | "lucide-loader" | "lucide-loader-circle";
5
+ /**
6
+ * A loading indicator with multiple animation variants and sizes.
7
+ */
8
+ export declare class DuiSpinner extends LitElement {
9
+ #private;
10
+ static tagName: "dui-spinner";
11
+ static styles: import("lit").CSSResult[];
12
+ /** Size variant: "sm" (24px), "md" (32px), "lg" (44px). */
13
+ accessor size: SpinnerSize;
14
+ /** Animation variant. */
15
+ accessor variant: SpinnerVariant;
16
+ render(): TemplateResult;
17
+ }
18
+ export {};
@@ -0,0 +1,138 @@
1
+ /** Ported from original DUI: deep-future-app/app/client/components/dui/spinner */
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;
7
+ };
8
+ import { css, html, LitElement, svg } from "lit";
9
+ import { property } from "lit/decorators.js";
10
+ import { base } from "@deepfuture/dui-core/base";
11
+ /** Pulsing circle loading animation SVG */
12
+ const pulseSvg = svg `
13
+ <svg
14
+ part="svg"
15
+ viewBox="0 0 44 44"
16
+ xmlns="http://www.w3.org/2000/svg"
17
+ role="img"
18
+ aria-label="Loading"
19
+ >
20
+ <circle cx="22" cy="22" r="8" fill="currentColor">
21
+ <animate
22
+ attributeName="r"
23
+ values="8;14;8"
24
+ dur="1.2s"
25
+ repeatCount="indefinite"
26
+ calcMode="spline"
27
+ keySplines="0.445,0.05,0.55,0.95;0.445,0.05,0.55,0.95"
28
+ keyTimes="0;0.5;1"
29
+ />
30
+ <animate
31
+ attributeName="opacity"
32
+ values="1;0.2;1"
33
+ dur="1.2s"
34
+ repeatCount="indefinite"
35
+ calcMode="spline"
36
+ keySplines="0.445,0.05,0.55,0.95;0.445,0.05,0.55,0.95"
37
+ keyTimes="0;0.5;1"
38
+ />
39
+ </circle>
40
+ </svg>
41
+ `;
42
+ /** Lucide loader icon with rotation animation */
43
+ const lucideLoaderSvg = svg `
44
+ <svg
45
+ part="svg"
46
+ data-rotate
47
+ viewBox="0 0 24 24"
48
+ xmlns="http://www.w3.org/2000/svg"
49
+ fill="none"
50
+ stroke="currentColor"
51
+ stroke-width="2"
52
+ stroke-linecap="round"
53
+ stroke-linejoin="round"
54
+ role="img"
55
+ aria-label="Loading"
56
+ >
57
+ <path d="M12 2v4" />
58
+ <path d="m16.2 7.8 2.9-2.9" />
59
+ <path d="M18 12h4" />
60
+ <path d="m16.2 16.2 2.9 2.9" />
61
+ <path d="M12 18v4" />
62
+ <path d="m4.9 19.1 2.9-2.9" />
63
+ <path d="M2 12h4" />
64
+ <path d="m4.9 4.9 2.9 2.9" />
65
+ </svg>
66
+ `;
67
+ /** Lucide loader circle icon with rotation animation */
68
+ const lucideLoaderCircleSvg = svg `
69
+ <svg
70
+ part="svg"
71
+ data-rotate
72
+ viewBox="0 0 24 24"
73
+ xmlns="http://www.w3.org/2000/svg"
74
+ fill="none"
75
+ stroke="currentColor"
76
+ stroke-width="2"
77
+ stroke-linecap="round"
78
+ stroke-linejoin="round"
79
+ role="img"
80
+ aria-label="Loading"
81
+ >
82
+ <path d="M21 12a9 9 0 1 1-6.219-8.56" />
83
+ </svg>
84
+ `;
85
+ const styles = css `
86
+ :host {
87
+ display: block;
88
+ }
89
+
90
+ [part="svg"] {
91
+ display: block;
92
+ width: 100%;
93
+ height: 100%;
94
+ }
95
+
96
+ [part="svg"][data-rotate] {
97
+ animation: spin 1.25s linear infinite;
98
+ }
99
+
100
+ @keyframes spin {
101
+ from { transform: rotate(0deg); }
102
+ to { transform: rotate(360deg); }
103
+ }
104
+ `;
105
+ /**
106
+ * A loading indicator with multiple animation variants and sizes.
107
+ */
108
+ export class DuiSpinner extends LitElement {
109
+ static { this.tagName = "dui-spinner"; }
110
+ static { this.styles = [base, styles]; }
111
+ #size_accessor_storage = "sm";
112
+ /** Size variant: "sm" (24px), "md" (32px), "lg" (44px). */
113
+ get size() { return this.#size_accessor_storage; }
114
+ set size(value) { this.#size_accessor_storage = value; }
115
+ #variant_accessor_storage = "pulse";
116
+ /** Animation variant. */
117
+ get variant() { return this.#variant_accessor_storage; }
118
+ set variant(value) { this.#variant_accessor_storage = value; }
119
+ #getSvg() {
120
+ switch (this.variant) {
121
+ case "lucide-loader":
122
+ return lucideLoaderSvg;
123
+ case "lucide-loader-circle":
124
+ return lucideLoaderCircleSvg;
125
+ default:
126
+ return pulseSvg;
127
+ }
128
+ }
129
+ render() {
130
+ return html `${this.#getSvg()}`;
131
+ }
132
+ }
133
+ __decorate([
134
+ property({ reflect: true })
135
+ ], DuiSpinner.prototype, "size", null);
136
+ __decorate([
137
+ property({ reflect: true })
138
+ ], DuiSpinner.prototype, "variant", null);
@@ -0,0 +1 @@
1
+ export { DuiSwitch, checkedChangeEvent } from "./switch.js";
@@ -0,0 +1 @@
1
+ export { DuiSwitch, checkedChangeEvent } from "./switch.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import { DuiSwitch } from "./index.js";
2
+ if (!customElements.get(DuiSwitch.tagName)) {
3
+ customElements.define(DuiSwitch.tagName, DuiSwitch);
4
+ }
@@ -0,0 +1,29 @@
1
+ import { LitElement, type TemplateResult } from "lit";
2
+ export declare const checkedChangeEvent: (detail: {
3
+ checked: boolean;
4
+ }) => CustomEvent<{
5
+ checked: boolean;
6
+ }>;
7
+ /**
8
+ * `<dui-switch>` — A toggle switch for binary on/off settings.
9
+ *
10
+ * @csspart root - The switch track container.
11
+ * @csspart thumb - The movable thumb indicator.
12
+ * @fires checked-change - Fired when toggled. Detail: { checked: boolean }
13
+ */
14
+ export declare class DuiSwitch extends LitElement {
15
+ #private;
16
+ static tagName: "dui-switch";
17
+ static styles: import("lit").CSSResult[];
18
+ accessor checked: boolean | undefined;
19
+ accessor defaultChecked: boolean;
20
+ accessor disabled: boolean;
21
+ accessor readOnly: boolean;
22
+ accessor required: boolean;
23
+ accessor name: string | undefined;
24
+ accessor value: string;
25
+ accessor uncheckedValue: string;
26
+ connectedCallback(): void;
27
+ disconnectedCallback(): void;
28
+ render(): TemplateResult;
29
+ }
@@ -0,0 +1,201 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { css, html, LitElement, nothing } from "lit";
8
+ import { property } from "lit/decorators.js";
9
+ import { base } from "@deepfuture/dui-core/base";
10
+ import { customEvent } from "@deepfuture/dui-core/event";
11
+ export const checkedChangeEvent = customEvent("checked-change", { bubbles: true, composed: true });
12
+ /** Structural styles only — layout and behavioral CSS. */
13
+ const styles = css `
14
+ :host {
15
+ display: inline-flex;
16
+ align-items: start;
17
+ cursor: pointer;
18
+ text-align: start;
19
+ }
20
+
21
+ :host([disabled]) {
22
+ cursor: not-allowed;
23
+ }
24
+
25
+ [part="root"] {
26
+ position: relative;
27
+ display: inline-flex;
28
+ flex-shrink: 0;
29
+ align-items: center;
30
+ padding: 0;
31
+ margin-block-end: 0;
32
+ margin-inline: 0;
33
+ border: none;
34
+ cursor: pointer;
35
+ transition-property: background, outline-color, box-shadow, filter, transform;
36
+ }
37
+
38
+ [part="thumb"] {
39
+ position: absolute;
40
+ left: var(--switch-thumb-offset, 0.125rem);
41
+ transition-property: transform, outline-color;
42
+ }
43
+
44
+ [part="root"][data-checked] [part="thumb"] {
45
+ transform: translateX(var(--switch-checked-offset, 0));
46
+ }
47
+
48
+ .HiddenInput {
49
+ position: absolute;
50
+ pointer-events: none;
51
+ opacity: 0;
52
+ margin: 0;
53
+ width: 0;
54
+ height: 0;
55
+ }
56
+ `;
57
+ /**
58
+ * `<dui-switch>` — A toggle switch for binary on/off settings.
59
+ *
60
+ * @csspart root - The switch track container.
61
+ * @csspart thumb - The movable thumb indicator.
62
+ * @fires checked-change - Fired when toggled. Detail: { checked: boolean }
63
+ */
64
+ export class DuiSwitch extends LitElement {
65
+ static { this.tagName = "dui-switch"; }
66
+ static { this.styles = [base, styles]; }
67
+ #checked_accessor_storage = undefined;
68
+ get checked() { return this.#checked_accessor_storage; }
69
+ set checked(value) { this.#checked_accessor_storage = value; }
70
+ #defaultChecked_accessor_storage = false;
71
+ get defaultChecked() { return this.#defaultChecked_accessor_storage; }
72
+ set defaultChecked(value) { this.#defaultChecked_accessor_storage = value; }
73
+ #disabled_accessor_storage = false;
74
+ get disabled() { return this.#disabled_accessor_storage; }
75
+ set disabled(value) { this.#disabled_accessor_storage = value; }
76
+ #readOnly_accessor_storage = false;
77
+ get readOnly() { return this.#readOnly_accessor_storage; }
78
+ set readOnly(value) { this.#readOnly_accessor_storage = value; }
79
+ #required_accessor_storage = false;
80
+ get required() { return this.#required_accessor_storage; }
81
+ set required(value) { this.#required_accessor_storage = value; }
82
+ #name_accessor_storage = undefined;
83
+ get name() { return this.#name_accessor_storage; }
84
+ set name(value) { this.#name_accessor_storage = value; }
85
+ #value_accessor_storage = "on";
86
+ get value() { return this.#value_accessor_storage; }
87
+ set value(value) { this.#value_accessor_storage = value; }
88
+ #uncheckedValue_accessor_storage = "";
89
+ get uncheckedValue() { return this.#uncheckedValue_accessor_storage; }
90
+ set uncheckedValue(value) { this.#uncheckedValue_accessor_storage = value; }
91
+ #internalChecked_accessor_storage = false;
92
+ get #internalChecked() { return this.#internalChecked_accessor_storage; }
93
+ set #internalChecked(value) { this.#internalChecked_accessor_storage = value; }
94
+ #fieldCtx_accessor_storage;
95
+ get #fieldCtx() { return this.#fieldCtx_accessor_storage; }
96
+ set #fieldCtx(value) { this.#fieldCtx_accessor_storage = value; }
97
+ get #isChecked() {
98
+ return this.checked ?? this.#internalChecked;
99
+ }
100
+ get #isDisabled() {
101
+ return this.disabled || (this.#fieldCtx?.disabled ?? false);
102
+ }
103
+ get #isInvalid() {
104
+ return this.#fieldCtx?.invalid ?? false;
105
+ }
106
+ connectedCallback() {
107
+ super.connectedCallback();
108
+ if (this.checked === undefined && this.defaultChecked) {
109
+ this.#internalChecked = true;
110
+ }
111
+ this.addEventListener("click", this.#handleHostClick);
112
+ }
113
+ disconnectedCallback() {
114
+ super.disconnectedCallback();
115
+ this.removeEventListener("click", this.#handleHostClick);
116
+ }
117
+ #handleHostClick = (_e) => {
118
+ this.#handleClick();
119
+ };
120
+ #handleClick = () => {
121
+ if (this.#isDisabled || this.readOnly)
122
+ return;
123
+ const newChecked = !this.#isChecked;
124
+ if (this.checked === undefined) {
125
+ this.#internalChecked = newChecked;
126
+ }
127
+ this.#fieldCtx?.markDirty();
128
+ this.#fieldCtx?.markTouched();
129
+ this.dispatchEvent(checkedChangeEvent({ checked: newChecked }));
130
+ };
131
+ #handleKeyDown = (e) => {
132
+ if (e.key === " " || e.key === "Enter") {
133
+ e.preventDefault();
134
+ this.#handleClick();
135
+ }
136
+ };
137
+ render() {
138
+ const isChecked = this.#isChecked;
139
+ const isDisabled = this.#isDisabled;
140
+ const isInvalid = this.#isInvalid;
141
+ const controlId = this.#fieldCtx?.controlId ?? "";
142
+ return html `
143
+ <span
144
+ part="root"
145
+ role="switch"
146
+ id="${controlId || nothing}"
147
+ aria-checked="${String(isChecked)}"
148
+ aria-disabled="${isDisabled ? "true" : nothing}"
149
+ aria-readonly="${this.readOnly ? "true" : nothing}"
150
+ aria-required="${this.required ? "true" : nothing}"
151
+ aria-invalid="${isInvalid ? "true" : nothing}"
152
+ tabindex="${isDisabled ? nothing : "0"}"
153
+ ?data-checked="${isChecked}"
154
+ ?data-unchecked="${!isChecked}"
155
+ ?data-disabled="${isDisabled}"
156
+ ?data-readonly="${this.readOnly}"
157
+ ?data-required="${this.required}"
158
+ ?data-invalid="${isInvalid}"
159
+ @keydown="${this.#handleKeyDown}"
160
+ >
161
+ <span part="thumb"></span>
162
+ <input
163
+ type="checkbox"
164
+ name="${this.name ?? nothing}"
165
+ value="${isChecked ? this.value : this.uncheckedValue}"
166
+ .checked="${isChecked}"
167
+ ?disabled="${isDisabled}"
168
+ ?required="${this.required}"
169
+ class="HiddenInput"
170
+ aria-hidden="true"
171
+ tabindex="-1"
172
+ />
173
+ </span>
174
+ <slot></slot>
175
+ `;
176
+ }
177
+ }
178
+ __decorate([
179
+ property({ type: Boolean, reflect: true })
180
+ ], DuiSwitch.prototype, "checked", null);
181
+ __decorate([
182
+ property({ type: Boolean, attribute: "default-checked" })
183
+ ], DuiSwitch.prototype, "defaultChecked", null);
184
+ __decorate([
185
+ property({ type: Boolean, reflect: true })
186
+ ], DuiSwitch.prototype, "disabled", null);
187
+ __decorate([
188
+ property({ type: Boolean, reflect: true, attribute: "read-only" })
189
+ ], DuiSwitch.prototype, "readOnly", null);
190
+ __decorate([
191
+ property({ type: Boolean, reflect: true })
192
+ ], DuiSwitch.prototype, "required", null);
193
+ __decorate([
194
+ property()
195
+ ], DuiSwitch.prototype, "name", null);
196
+ __decorate([
197
+ property()
198
+ ], DuiSwitch.prototype, "value", null);
199
+ __decorate([
200
+ property({ attribute: "unchecked-value" })
201
+ ], DuiSwitch.prototype, "uncheckedValue", null);
@@ -0,0 +1,6 @@
1
+ export { DuiTabs, valueChangeEvent } from "./tabs.js";
2
+ export { DuiTabsList } from "./tabs-list.js";
3
+ export { DuiTab } from "./tab.js";
4
+ export { DuiTabsPanel } from "./tabs-panel.js";
5
+ export { DuiTabsIndicator } from "./tabs-indicator.js";
6
+ export type { TabsContext } from "./tabs-context.js";