@webority/ui-elements 0.37.0 → 0.38.0

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 (116) hide show
  1. package/dist/WuiAutocomplete-Comrnbmf.js +13 -0
  2. package/dist/WuiCommandPalette-CKna1GlO.js +2 -0
  3. package/dist/WuiConsentBanner-CFll7vxN.js +201 -0
  4. package/dist/WuiContextMenu-CBy0O4HT.js +1 -0
  5. package/dist/WuiCountrySelect-oLBUHvMM.js +1 -0
  6. package/dist/WuiDatePicker-nB1B3eWW.js +31 -0
  7. package/dist/WuiDateRange-Di5YE9mg.js +25 -0
  8. package/dist/WuiDock-BD2HgMmP.js +1 -0
  9. package/dist/WuiImageCrop-Cr3D2iPo.js +17 -0
  10. package/dist/WuiMultiSelect-BUw-7apM.js +25 -0
  11. package/dist/WuiOtp-BbO_75RB.js +14 -0
  12. package/dist/WuiPhone-GJglNelp.js +15 -0
  13. package/dist/WuiSelect-DvtN4qC2.js +14 -0
  14. package/dist/WuiSlider-Br6V2amU.js +49 -0
  15. package/dist/WuiSortable-Bd7Fz5Ox.js +1 -0
  16. package/dist/WuiTagInput-DzEZooIn.js +6 -0
  17. package/dist/WuiTimePicker-Bolpp93P.js +9 -0
  18. package/dist/WuiTour-DiKZEWeb.js +15 -0
  19. package/dist/WuiTree-SA0QU9AF.js +1 -0
  20. package/dist/WuiWizardStep-DIHxrXn9.js +1 -0
  21. package/dist/anchorOverlay-WcDeH46q.js +1 -0
  22. package/dist/calendarMath-BC2wGCD-.js +1 -0
  23. package/dist/countries-CvmZ2xpG.js +1 -0
  24. package/dist/elementBase-BlsR4tqa.js +1 -0
  25. package/dist/elements/autocomplete.js +1 -6
  26. package/dist/elements/command-palette.js +1 -6
  27. package/dist/elements/consent-banner.js +1 -6
  28. package/dist/elements/context-menu.js +1 -6
  29. package/dist/elements/country-select.js +1 -6
  30. package/dist/elements/date-range.js +1 -6
  31. package/dist/elements/datepicker.js +1 -6
  32. package/dist/elements/dock.js +1 -6
  33. package/dist/elements/image-crop.js +1 -6
  34. package/dist/elements/kanban.js +1 -6
  35. package/dist/elements/multiselect.js +1 -6
  36. package/dist/elements/otp.js +1 -6
  37. package/dist/elements/phone.js +1 -6
  38. package/dist/elements/select.js +1 -6
  39. package/dist/elements/slider.js +1 -6
  40. package/dist/elements/sortable.js +1 -6
  41. package/dist/elements/status-icon.js +1 -6
  42. package/dist/elements/taginput.js +1 -6
  43. package/dist/elements/timepicker.js +1 -6
  44. package/dist/elements/tour.js +1 -6
  45. package/dist/elements/tree.js +1 -6
  46. package/dist/elements/wizard.js +1 -5
  47. package/dist/examples.mobile.json-GS1_MGh9.js +1 -0
  48. package/dist/fileViewerImage-Y9QBn2Rj.js +6 -0
  49. package/dist/fileViewerMedia-CaJaVnjE.js +1 -0
  50. package/dist/fileViewerPdf-BN0zuehw.js +19 -0
  51. package/dist/fileViewerUi-DasgDsU-.js +1 -0
  52. package/dist/focusOrigin-2imUSs-u.js +1 -0
  53. package/dist/formMirror-BgY7zkC3.js +1 -0
  54. package/dist/formatters-BAE__8ye.js +1 -0
  55. package/dist/helpers.js +1 -5
  56. package/dist/iconGlyphs.g-CUm_mfze.js +1 -0
  57. package/dist/kanban-CdELdS3U.js +1 -0
  58. package/dist/listboxKeyNav-DMIvs9d6.js +1 -0
  59. package/dist/max-CNrKnpEj.js +17 -0
  60. package/dist/optionLabel-DsX2fhWs.js +1 -0
  61. package/dist/statusIcons-2X4iGkKL.js +10 -0
  62. package/dist/textMatch-wdY7XLIc.js +1 -0
  63. package/dist/themeTransition-lkmQm8FR.js +1 -0
  64. package/dist/tokenCommit-BKckxgtg.js +2 -0
  65. package/dist/ui-calendar.global.js +1 -1
  66. package/dist/ui-calendar.js +1 -9905
  67. package/dist/ui-chart.js +21 -34563
  68. package/dist/ui-chat-core.js +10 -347
  69. package/dist/ui-chat.js +10 -1066
  70. package/dist/ui-elements.global.js +52 -53
  71. package/dist/ui-elements.js +1 -692
  72. package/dist/ui-file-viewer.js +1 -311
  73. package/dist/ui-rich-text.js +193 -16887
  74. package/dist/wuiHttp-BC8co934.js +1 -0
  75. package/package.json +5 -7
  76. package/dist/WuiAutocomplete-ByxnwJNQ.js +0 -283
  77. package/dist/WuiCommandPalette-CtZ04JxZ.js +0 -130
  78. package/dist/WuiConsentBanner-oVe-jxCO.js +0 -399
  79. package/dist/WuiContextMenu-Bx_U2X3t.js +0 -211
  80. package/dist/WuiCountrySelect-CUAwKnL9.js +0 -28
  81. package/dist/WuiDatePicker-DkNbc-z7.js +0 -325
  82. package/dist/WuiDateRange-BocnVO6L.js +0 -233
  83. package/dist/WuiDock-BSDY9g8Q.js +0 -57
  84. package/dist/WuiImageCrop-1yaAONTk.js +0 -462
  85. package/dist/WuiMultiSelect-BrCGRNCt.js +0 -416
  86. package/dist/WuiOtp-D8-4Pqil.js +0 -128
  87. package/dist/WuiPhone-BvbhiP2r.js +0 -731
  88. package/dist/WuiSelect-BXrpiuXG.js +0 -214
  89. package/dist/WuiSlider-BcU0psYf.js +0 -256
  90. package/dist/WuiSortable-JjJqstSU.js +0 -280
  91. package/dist/WuiTagInput-D1ay3OcL.js +0 -158
  92. package/dist/WuiTimePicker-C7n-VFGt.js +0 -370
  93. package/dist/WuiTour-R5O9l--J.js +0 -205
  94. package/dist/WuiTree-DXP7pGeI.js +0 -393
  95. package/dist/WuiWizardStep-BU5w9_Ds.js +0 -221
  96. package/dist/anchorOverlay-DluGZ8ef.js +0 -23
  97. package/dist/calendarMath-BAF2Jkg_.js +0 -42
  98. package/dist/countries-B-M_LTgS.js +0 -1234
  99. package/dist/elementBase-Bg1xpvup.js +0 -9
  100. package/dist/examples.mobile.json-BMXTGiGC.js +0 -250
  101. package/dist/fileViewerImage-Dky4nQZS.js +0 -185
  102. package/dist/fileViewerMedia-DPk_YcvC.js +0 -133
  103. package/dist/fileViewerPdf-BnIsj-J-.js +0 -15799
  104. package/dist/fileViewerUi-R6hlcShk.js +0 -272
  105. package/dist/formMirror-jGf5M4gk.js +0 -29
  106. package/dist/formatters-DusKbTyV.js +0 -138
  107. package/dist/iconGlyphs.g-Cpg1BUHm.js +0 -215
  108. package/dist/kanban-BIiEMkTK.js +0 -985
  109. package/dist/listboxKeyNav-zts_8d5e.js +0 -36
  110. package/dist/max-BDKx469G.js +0 -14478
  111. package/dist/optionLabel-Dn-I7zyp.js +0 -16
  112. package/dist/statusIcons-C3zjycpa.js +0 -37
  113. package/dist/textMatch-DEUjlkdy.js +0 -27
  114. package/dist/themeTransition-BpCuMnjk.js +0 -589
  115. package/dist/tokenCommit-VWz-2jEf.js +0 -20
  116. package/dist/wuiHttp-oeHs7X_c.js +0 -118
@@ -1,9 +0,0 @@
1
- //#region src/defineElement.js
2
- function e(e, t) {
3
- typeof customElements < "u" && !customElements.get(e) && customElements.define(e, t);
4
- }
5
- //#endregion
6
- //#region src/elementBase.js
7
- var t = typeof HTMLElement > "u" ? class {} : HTMLElement;
8
- //#endregion
9
- export { e as n, t };
@@ -1,250 +0,0 @@
1
- //#region ../../node_modules/.pnpm/libphonenumber-js@1.13.9/node_modules/libphonenumber-js/examples.mobile.json.js
2
- var e = {
3
- AC: "40123",
4
- AD: "312345",
5
- AE: "501234567",
6
- AF: "701234567",
7
- AG: "2684641234",
8
- AI: "2642351234",
9
- AL: "672123456",
10
- AM: "77123456",
11
- AO: "923123456",
12
- AR: "91123456789",
13
- AS: "6847331234",
14
- AT: "664123456",
15
- AU: "412345678",
16
- AW: "5601234",
17
- AX: "412345678",
18
- AZ: "401234567",
19
- BA: "61123456",
20
- BB: "2462501234",
21
- BD: "1812345678",
22
- BE: "450001234",
23
- BF: "70123456",
24
- BG: "43012345",
25
- BH: "36001234",
26
- BI: "79561234",
27
- BJ: "0195123456",
28
- BL: "690001234",
29
- BM: "4413701234",
30
- BN: "7123456",
31
- BO: "71234567",
32
- BQ: "3181234",
33
- BR: "11961234567",
34
- BS: "2423591234",
35
- BT: "17123456",
36
- BW: "71123456",
37
- BY: "294911911",
38
- BZ: "6221234",
39
- CA: "5062345678",
40
- CC: "412345678",
41
- CD: "991234567",
42
- CF: "70012345",
43
- CG: "061234567",
44
- CH: "781234567",
45
- CI: "0123456789",
46
- CK: "71234",
47
- CL: "221234567",
48
- CM: "671234567",
49
- CN: "13123456789",
50
- CO: "3211234567",
51
- CR: "83123456",
52
- CU: "51234567",
53
- CV: "9911234",
54
- CW: "95181234",
55
- CX: "412345678",
56
- CY: "96123456",
57
- CZ: "601123456",
58
- DE: "15123456789",
59
- DJ: "77831001",
60
- DK: "34412345",
61
- DM: "7672251234",
62
- DO: "8092345678",
63
- DZ: "551234567",
64
- EC: "991234567",
65
- EE: "51234567",
66
- EG: "1001234567",
67
- EH: "650123456",
68
- ER: "7123456",
69
- ES: "612345678",
70
- ET: "911234567",
71
- FI: "412345678",
72
- FJ: "7012345",
73
- FK: "51234",
74
- FM: "3501234",
75
- FO: "211234",
76
- FR: "612345678",
77
- GA: "06031234",
78
- GB: "7400123456",
79
- GD: "4734031234",
80
- GE: "555123456",
81
- GF: "694201234",
82
- GG: "7781123456",
83
- GH: "231234567",
84
- GI: "57123456",
85
- GL: "221234",
86
- GM: "3012345",
87
- GN: "601123456",
88
- GP: "690001234",
89
- GQ: "222123456",
90
- GR: "6912345678",
91
- GT: "51234567",
92
- GU: "6713001234",
93
- GW: "955012345",
94
- GY: "6091234",
95
- HK: "51234567",
96
- HN: "91234567",
97
- HR: "921234567",
98
- HT: "34101234",
99
- HU: "201234567",
100
- ID: "812345678",
101
- IE: "850123456",
102
- IL: "502345678",
103
- IM: "7924123456",
104
- IN: "8123456789",
105
- IO: "3801234",
106
- IQ: "7912345678",
107
- IR: "9123456789",
108
- IS: "6111234",
109
- IT: "3123456789",
110
- JE: "7797712345",
111
- JM: "8762101234",
112
- JO: "790123456",
113
- JP: "9012345678",
114
- KE: "712123456",
115
- KG: "700123456",
116
- KH: "91234567",
117
- KI: "72001234",
118
- KM: "3212345",
119
- KN: "8697652917",
120
- KP: "1921234567",
121
- KR: "1020000000",
122
- KW: "50012345",
123
- KY: "3453231234",
124
- KZ: "7710009998",
125
- LA: "2023123456",
126
- LB: "71123456",
127
- LC: "7582845678",
128
- LI: "660234567",
129
- LK: "712345678",
130
- LR: "770123456",
131
- LS: "50123456",
132
- LT: "61234567",
133
- LU: "628123456",
134
- LV: "21234567",
135
- LY: "912345678",
136
- MA: "650123456",
137
- MC: "612345678",
138
- MD: "62112345",
139
- ME: "60123456",
140
- MF: "690001234",
141
- MG: "321234567",
142
- MH: "2351234",
143
- MK: "72345678",
144
- ML: "65012345",
145
- MM: "92123456",
146
- MN: "88123456",
147
- MO: "66123456",
148
- MP: "6702345678",
149
- MQ: "696201234",
150
- MR: "22123456",
151
- MS: "6644923456",
152
- MT: "96961234",
153
- MU: "52512345",
154
- MV: "7712345",
155
- MW: "991234567",
156
- MX: "2221234567",
157
- MY: "123456789",
158
- MZ: "821234567",
159
- NA: "811234567",
160
- NC: "751234",
161
- NE: "93123456",
162
- NF: "381234",
163
- NG: "8021234567",
164
- NI: "81234567",
165
- NL: "612345678",
166
- NO: "40612345",
167
- NP: "9841234567",
168
- NR: "5551234",
169
- NU: "8884012",
170
- NZ: "211234567",
171
- OM: "92123456",
172
- PA: "61234567",
173
- PE: "912345678",
174
- PF: "87123456",
175
- PG: "70123456",
176
- PH: "9051234567",
177
- PK: "3012345678",
178
- PL: "512345678",
179
- PM: "551234",
180
- PR: "7872345678",
181
- PS: "599123456",
182
- PT: "912345678",
183
- PW: "6201234",
184
- PY: "961456789",
185
- QA: "33123456",
186
- RE: "692123456",
187
- RO: "712034567",
188
- RS: "601234567",
189
- RU: "9123456789",
190
- RW: "720123456",
191
- SA: "512345678",
192
- SB: "7421234",
193
- SC: "2510123",
194
- SD: "911231234",
195
- SE: "701234567",
196
- SG: "81234567",
197
- SH: "51234",
198
- SI: "31234567",
199
- SJ: "41234567",
200
- SK: "912123456",
201
- SL: "25123456",
202
- SM: "66661212",
203
- SN: "701234567",
204
- SO: "71123456",
205
- SR: "7412345",
206
- SS: "977123456",
207
- ST: "9812345",
208
- SV: "70123456",
209
- SX: "7215205678",
210
- SY: "944567890",
211
- SZ: "76123456",
212
- TA: "8999",
213
- TC: "6492311234",
214
- TD: "63012345",
215
- TG: "90112345",
216
- TH: "812345678",
217
- TJ: "917123456",
218
- TK: "7290",
219
- TL: "77212345",
220
- TM: "66123456",
221
- TN: "20123456",
222
- TO: "7715123",
223
- TR: "5012345678",
224
- TT: "8682911234",
225
- TV: "901234",
226
- TW: "912345678",
227
- TZ: "621234567",
228
- UA: "501234567",
229
- UG: "712345678",
230
- US: "2015550123",
231
- UY: "94231234",
232
- UZ: "912345678",
233
- VA: "3123456789",
234
- VC: "7844301234",
235
- VE: "4121234567",
236
- VG: "2843001234",
237
- VI: "3406421234",
238
- VN: "912345678",
239
- VU: "5912345",
240
- WF: "821234",
241
- WS: "7212345",
242
- XK: "43201234",
243
- YE: "712345678",
244
- YT: "639012345",
245
- ZA: "711234567",
246
- ZM: "955123456",
247
- ZW: "712345678"
248
- };
249
- //#endregion
250
- export { e as default };
@@ -1,185 +0,0 @@
1
- import { a as e, n as t, t as n } from "./fileViewerUi-R6hlcShk.js";
2
- //#region src/fileViewerImage.js
3
- var r = [
4
- .1,
5
- .25,
6
- .5,
7
- .75,
8
- 1,
9
- 1.5,
10
- 2,
11
- 3,
12
- 4
13
- ], i = [
14
- .25,
15
- .5,
16
- 1,
17
- 2,
18
- 4
19
- ], a = 16, o = 5, s = class {
20
- constructor(e, t) {
21
- this.shell = e, this.source = t, this.zoom = "fit", this.rotation = 0, this.area = {
22
- width: 0,
23
- height: 0
24
- }, this.destroyed = !1;
25
- }
26
- load() {
27
- let e = document.createElement("img");
28
- e.className = "wui-file-viewer-image", e.alt = this.shell.name(), e.decoding = "async", e.draggable = !1, e.addEventListener("load", () => {
29
- this.destroyed || (this.natural = {
30
- width: e.naturalWidth || 300,
31
- height: e.naturalHeight || 150
32
- }, this._build(e), this.shell.loaded({
33
- kind: "image",
34
- pages: 1
35
- }));
36
- }), e.addEventListener("error", () => {
37
- this.destroyed || this.shell.fail(/* @__PURE__ */ Error("The image could not be decoded."));
38
- }), e.src = this.source.src, this.img = e;
39
- }
40
- destroy() {
41
- this.destroyed = !0, this._resizeObserver?.disconnect(), this._onKeyDown && this.shell.host.removeEventListener("keydown", this._onKeyDown), this._printFrame?.remove(), this.img?.removeAttribute("src");
42
- }
43
- _build(e) {
44
- let { center: r, end: a, body: o, host: s } = this.shell;
45
- this.zoomOutButton = n("zoom-out", "Zoom out"), this.zoomOutButton.addEventListener("click", () => this._stepZoom(-1)), this.zoomButton = document.createElement("button"), this.zoomButton.type = "button", this.zoomButton.className = "wui-file-viewer-zoom", t(this.zoomButton, {
46
- label: "Zoom",
47
- items: () => [
48
- ...i.map((e) => ({
49
- key: String(e),
50
- label: `${Math.round(e * 100)}%`,
51
- checked: this.zoom === e
52
- })),
53
- {
54
- key: "fit-divider",
55
- divider: !0
56
- },
57
- {
58
- key: "fit",
59
- label: "Fit",
60
- checked: this.zoom === "fit"
61
- }
62
- ],
63
- onPick: (e) => this._setZoom(e === "fit" ? "fit" : Number(e))
64
- }), this.zoomInButton = n("zoom-in", "Zoom in"), this.zoomInButton.addEventListener("click", () => this._stepZoom(1));
65
- let c = n("rotate-ccw", "Rotate left");
66
- c.addEventListener("click", () => this._rotate(-90));
67
- let l = n("rotate-cw", "Rotate right");
68
- l.addEventListener("click", () => this._rotate(90));
69
- let u = document.createElement("span");
70
- u.className = "wui-file-viewer-divider";
71
- let d = n("printer", "Print");
72
- d.addEventListener("click", () => this.print()), r.append(this.zoomOutButton, this.zoomButton, this.zoomInButton), a.prepend(c, l, u, d), this.scroller = document.createElement("div"), this.scroller.className = "wui-file-viewer-scroll wui-file-viewer-image-scroll wui-scroll", this.scroller.tabIndex = 0, this.scroller.setAttribute("role", "region"), this.scroller.setAttribute("aria-label", "Image"), this.stage = document.createElement("div"), this.stage.className = "wui-file-viewer-image-stage", this.stage.append(e), this.scroller.append(this.stage), o.replaceChildren(this.scroller), this.scroller.addEventListener("pointerdown", (e) => this._panStart(e)), this.scroller.addEventListener("pointermove", (e) => this._panMove(e));
73
- for (let e of [
74
- "pointerup",
75
- "pointercancel",
76
- "lostpointercapture"
77
- ]) this.scroller.addEventListener(e, () => this._panEnd());
78
- this.scroller.addEventListener("wheel", (e) => {
79
- if (!e.ctrlKey && !e.metaKey) return;
80
- e.preventDefault();
81
- let t = performance.now();
82
- t - (this._lastWheelZoom ?? 0) < 120 || (this._lastWheelZoom = t, this._stepZoom(e.deltaY < 0 ? 1 : -1));
83
- }, { passive: !1 }), this._onKeyDown = (e) => this._keyDown(e), s.addEventListener("keydown", this._onKeyDown), this._resizeObserver = new ResizeObserver(() => {
84
- let e = this.scroller.clientWidth, t = this.scroller.clientHeight;
85
- e === this.area.width && t === this.area.height || (this.area = {
86
- width: e,
87
- height: t
88
- }, this._layout());
89
- }), this._resizeObserver.observe(this.scroller), this.area = {
90
- width: this.scroller.clientWidth,
91
- height: this.scroller.clientHeight
92
- }, this._layout();
93
- }
94
- _turned() {
95
- let { width: e, height: t } = this.natural;
96
- return this.rotation % 180 == 0 ? {
97
- width: e,
98
- height: t
99
- } : {
100
- width: t,
101
- height: e
102
- };
103
- }
104
- scale() {
105
- if (typeof this.zoom == "number") return this.zoom;
106
- let { width: e, height: t } = this._turned(), n = Math.min((this.area.width - 2 * a) / e, (this.area.height - 2 * a) / t);
107
- return Math.max(Math.min(1, n), .01);
108
- }
109
- _layout() {
110
- if (!this.stage) return;
111
- let t = this.scale(), n = this._turned();
112
- this.stage.style.width = `${Math.round(n.width * t)}px`, this.stage.style.height = `${Math.round(n.height * t)}px`, this.img.style.width = `${Math.round(this.natural.width * t)}px`, this.img.style.height = `${Math.round(this.natural.height * t)}px`, this.img.style.transform = `translate(-50%, -50%) rotate(${this.rotation}deg)`;
113
- let r = Math.round(t * 100);
114
- this.zoomButton.innerHTML = `${r}%${e("chevron-down", { size: 12 })}`, this.zoomButton.setAttribute("aria-label", `Zoom, ${r}%`), this.zoomOutButton.disabled = this._zoomStep(-1) == null, this.zoomInButton.disabled = this._zoomStep(1) == null;
115
- }
116
- _zoomStep(e) {
117
- let t = this.scale();
118
- return e > 0 ? r.find((e) => e > t + .001) ?? null : [...r].reverse().find((e) => e < t - .001) ?? null;
119
- }
120
- _stepZoom(e) {
121
- let t = this._zoomStep(e);
122
- t != null && this._setZoom(t);
123
- }
124
- _setZoom(e) {
125
- let t = this.scroller, n = (t.scrollLeft + t.clientWidth / 2) / Math.max(t.scrollWidth, 1), r = (t.scrollTop + t.clientHeight / 2) / Math.max(t.scrollHeight, 1);
126
- this.zoom = e, this._layout(), t.scrollLeft = n * t.scrollWidth - t.clientWidth / 2, t.scrollTop = r * t.scrollHeight - t.clientHeight / 2;
127
- }
128
- _rotate(e) {
129
- this.rotation = (this.rotation + e + 360) % 360, this._setZoom(this.zoom);
130
- }
131
- _keyDown(e) {
132
- if (!(e.defaultPrevented || e.altKey || !(e.ctrlKey || e.metaKey))) {
133
- if (e.key === "+" || e.key === "=") this._stepZoom(1);
134
- else if (e.key === "-" || e.key === "_") this._stepZoom(-1);
135
- else if (e.key === "0") this._setZoom("fit");
136
- else return;
137
- e.preventDefault();
138
- }
139
- }
140
- _panStart(e) {
141
- let t = this.scroller;
142
- e.button !== 0 || t.scrollWidth <= t.clientWidth && t.scrollHeight <= t.clientHeight || (this._pan = {
143
- id: e.pointerId,
144
- x: e.clientX,
145
- y: e.clientY,
146
- left: t.scrollLeft,
147
- top: t.scrollTop,
148
- active: !1
149
- });
150
- }
151
- _panMove(e) {
152
- let t = this._pan;
153
- if (!t) return;
154
- let n = e.clientX - t.x, r = e.clientY - t.y;
155
- if (!t.active) {
156
- if (Math.abs(n) < o && Math.abs(r) < o) return;
157
- t.active = !0, this.scroller.setPointerCapture(t.id), this.scroller.classList.add("wui-file-viewer-panning");
158
- }
159
- this.scroller.scrollLeft = t.left - n, this.scroller.scrollTop = t.top - r;
160
- }
161
- _panEnd() {
162
- let e = this._pan;
163
- e?.active && (this.scroller.hasPointerCapture(e.id) && this.scroller.releasePointerCapture(e.id), this.scroller.classList.remove("wui-file-viewer-panning")), this._pan = null;
164
- }
165
- print() {
166
- this._printFrame?.remove();
167
- let e = document.createElement("iframe");
168
- e.className = "wui-file-viewer-print-frame", e.title = "Image for printing", e.tabIndex = -1, e.setAttribute("aria-hidden", "true");
169
- let t = this.rotation % 180 != 0, n = new URL(this.source.src, document.baseURI).href, r = t ? "max-width: 100vh; max-height: 100vw;" : "max-width: 100vw; max-height: 100vh;";
170
- e.srcdoc = `<!doctype html><html><head><title>${c(this.shell.name())}</title><style>
171
- @page { margin: 10mm; }
172
- html, body { margin: 0; height: 100%; }
173
- body { display: flex; align-items: center; justify-content: center; }
174
- img { ${r} transform: rotate(${this.rotation}deg); }
175
- </style></head><body><img src="${c(n)}" alt=""></body></html>`, e.addEventListener("load", () => {
176
- try {
177
- e.contentWindow.focus(), e.contentWindow.print();
178
- } catch (e) {
179
- console.warn("[wui-file-viewer] print failed:", e?.message), window.open(this.source.src, "_blank", "noopener");
180
- }
181
- }, { once: !0 }), this._printFrame = e, document.body.append(e);
182
- }
183
- }, c = (e) => String(e ?? "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
184
- //#endregion
185
- export { s as ImageView };
@@ -1,133 +0,0 @@
1
- import { a as e, i as t, n, r, t as i } from "./fileViewerUi-R6hlcShk.js";
2
- //#region src/fileViewerMedia.js
3
- var a = [
4
- .5,
5
- .75,
6
- 1,
7
- 1.25,
8
- 1.5,
9
- 2
10
- ], o = 5, s = .1;
11
- function c(e) {
12
- if (!Number.isFinite(e) || e < 0) return "0:00";
13
- let t = Math.floor(e), n = Math.floor(t / 3600), r = Math.floor(t % 3600 / 60), i = String(t % 60).padStart(2, "0");
14
- return n ? `${n}:${String(r).padStart(2, "0")}:${i}` : `${r}:${i}`;
15
- }
16
- var l = (e) => e instanceof Element && e.closest("input, textarea, select, button, a, .dropdown-menu"), u = class {
17
- constructor(e, t) {
18
- this.shell = e, this.source = t, this.destroyed = !1;
19
- }
20
- load() {
21
- let { kind: e, src: t, captions: n } = this.source, r = document.createElement(e);
22
- if (r.className = `wui-file-viewer-${e}`, r.preload = "metadata", r.playsInline = !0, e === "video" && n) {
23
- let e = document.createElement("track");
24
- e.kind = "captions", e.label = "Captions", e.srclang = "en", e.src = n, r.append(e);
25
- }
26
- let i = this.shell.prefs;
27
- typeof i.volume == "number" && (r.volume = Math.min(Math.max(i.volume, 0), 1)), r.muted = i.muted === !0, r.addEventListener("loadedmetadata", () => {
28
- this.destroyed || (r.playbackRate = a.includes(i.speed) ? i.speed : 1, this._build(), this.shell.loaded({
29
- kind: e,
30
- pages: 1
31
- }));
32
- }, { once: !0 }), r.addEventListener("error", () => {
33
- this.destroyed || this.shell.fail(/* @__PURE__ */ Error("The file could not be played."));
34
- }), r.src = t, this.media = r;
35
- }
36
- destroy() {
37
- this.destroyed = !0, this._onKeyDown && this.shell.host.removeEventListener("keydown", this._onKeyDown), this.media && (this.media.pause(), this.media.removeAttribute("src"), this.media.load());
38
- }
39
- _build() {
40
- let { body: t, host: r } = this.shell, o = this.media, s = this.source.kind, c = document.createElement("div");
41
- c.className = `wui-file-viewer-player wui-file-viewer-player-${s}`;
42
- let l = document.createElement("div");
43
- if (l.className = "wui-file-viewer-stage", l.tabIndex = 0, l.setAttribute("role", "group"), l.setAttribute("aria-label", s === "video" ? "Video" : "Audio"), s === "audio") {
44
- let t = document.createElement("div");
45
- t.className = "wui-file-viewer-audio-art", t.innerHTML = e("music", { size: 40 }), l.append(t, o);
46
- } else l.append(o), o.addEventListener("click", () => this.togglePlay());
47
- let u = document.createElement("div");
48
- u.className = "wui-file-viewer-controls", this.playButton = i("play", "Play", { size: 18 }), this.playButton.addEventListener("click", () => this.togglePlay()), this.timeNow = document.createElement("span"), this.timeNow.className = "wui-file-viewer-time", this.seek = document.createElement("input"), this.seek.type = "range", this.seek.className = "form-range wui-file-viewer-seek", this.seek.min = "0", this.seek.step = "any", this.seek.setAttribute("aria-label", "Seek"), this.seek.addEventListener("input", () => {
49
- o.currentTime = Number(this.seek.value);
50
- }), this.timeTotal = document.createElement("span"), this.timeTotal.className = "wui-file-viewer-time", this.muteButton = i("volume-high", "Mute", { size: 18 }), this.muteButton.addEventListener("click", () => this._setMuted(!o.muted)), this.volume = document.createElement("input"), this.volume.type = "range", this.volume.className = "form-range wui-file-viewer-volume", this.volume.min = "0", this.volume.max = "1", this.volume.step = "0.05", this.volume.setAttribute("aria-label", "Volume"), this.volume.addEventListener("input", () => this._setVolume(Number(this.volume.value))), this.speedButton = document.createElement("button"), this.speedButton.type = "button", this.speedButton.className = "wui-file-viewer-zoom wui-file-viewer-speed", n(this.speedButton, {
51
- label: "Playback speed",
52
- items: () => a.map((e) => ({
53
- key: String(e),
54
- label: `${e}x`,
55
- checked: o.playbackRate === e
56
- })),
57
- onPick: (e) => this._setSpeed(Number(e))
58
- }), u.append(this.playButton, this.timeNow, this.seek, this.timeTotal, this.muteButton, this.volume, this.speedButton), s === "video" && this.source.captions && (this.captionsButton = i("subtitle", "Show captions", { size: 18 }), this.captionsButton.addEventListener("click", () => this._setCaptions(!this._captionsOn())), u.append(this.captionsButton)), c.append(l, u), t.replaceChildren(c);
59
- for (let e of [
60
- "play",
61
- "pause",
62
- "ended"
63
- ]) o.addEventListener(e, () => this._syncPlay());
64
- o.addEventListener("timeupdate", () => this._syncTime()), o.addEventListener("durationchange", () => this._syncTime()), o.addEventListener("volumechange", () => this._syncVolume()), o.addEventListener("ratechange", () => this._syncSpeed()), this._onKeyDown = (e) => this._keyDown(e), r.addEventListener("keydown", this._onKeyDown), this._syncPlay(), this._syncTime(), this._syncVolume(), this._syncSpeed(), this._syncCaptions();
65
- }
66
- seekTo(e) {
67
- let t = this.media.duration;
68
- this.media.currentTime = Math.min(Math.max(e, 0), Number.isFinite(t) ? t : Infinity);
69
- }
70
- togglePlay() {
71
- this.media.paused || this.media.ended ? this.media.play().catch((e) => {
72
- console.warn("[wui-file-viewer] play refused:", e?.message);
73
- }) : this.media.pause();
74
- }
75
- _setMuted(e) {
76
- this.media.muted = e, !e && this.media.volume === 0 && (this.media.volume = .5), this.shell.savePrefs({
77
- muted: this.media.muted,
78
- volume: this.media.volume
79
- });
80
- }
81
- _setVolume(e) {
82
- this.media.volume = Math.min(Math.max(e, 0), 1), this.media.muted = this.media.volume === 0, this.shell.savePrefs({
83
- muted: this.media.muted,
84
- volume: this.media.volume
85
- });
86
- }
87
- _setSpeed(e) {
88
- this.media.playbackRate = e, this.shell.savePrefs({ speed: e });
89
- }
90
- _captionsOn() {
91
- return this.media.textTracks?.[0]?.mode === "showing";
92
- }
93
- _setCaptions(e) {
94
- let t = this.media.textTracks?.[0];
95
- t && (t.mode = e ? "showing" : "hidden"), this._syncCaptions();
96
- }
97
- _syncPlay() {
98
- let e = !this.media.paused && !this.media.ended;
99
- r(this.playButton, e ? "pause" : "play", 18), t(this.playButton, e ? "Pause" : "Play"), this.shell.host.classList.toggle("wui-file-viewer-playing", e);
100
- }
101
- _syncTime() {
102
- let e = this.media.currentTime, t = this.media.duration;
103
- this.timeNow.textContent = c(e), this.timeTotal.textContent = c(t), this.seek.max = String(Number.isFinite(t) ? t : 0), this.seek.value = String(e), this.seek.setAttribute("aria-valuetext", `${c(e)} of ${c(t)}`);
104
- }
105
- _syncVolume() {
106
- let e = this.media.muted || this.media.volume === 0;
107
- r(this.muteButton, e ? "volume-mute" : "volume-high", 18), t(this.muteButton, e ? "Unmute" : "Mute"), this.volume.value = String(this.media.muted ? 0 : this.media.volume);
108
- }
109
- _syncSpeed() {
110
- let e = `${this.media.playbackRate}x`;
111
- this.speedButton.textContent = e, this.speedButton.setAttribute("aria-label", `Playback speed, ${e}`);
112
- }
113
- _syncCaptions() {
114
- if (!this.captionsButton) return;
115
- let e = this._captionsOn();
116
- this.captionsButton.setAttribute("aria-pressed", String(e)), t(this.captionsButton, e ? "Hide captions" : "Show captions");
117
- }
118
- _keyDown(e) {
119
- if (e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey || l(e.target)) return;
120
- let t = this.media, n = e.key.toLowerCase();
121
- if (n === " " || n === "k") this.togglePlay();
122
- else if (n === "arrowleft") t.currentTime = Math.max(0, t.currentTime - o);
123
- else if (n === "arrowright") t.currentTime = Math.min(t.duration || 0, t.currentTime + o);
124
- else if (n === "arrowup") this._setVolume(t.volume + s);
125
- else if (n === "arrowdown") this._setVolume(t.volume - s);
126
- else if (n === "m") this._setMuted(!t.muted);
127
- else if (n === "c" && this.captionsButton) this._setCaptions(!this._captionsOn());
128
- else return;
129
- e.preventDefault();
130
- }
131
- };
132
- //#endregion
133
- export { u as MediaView };