x-next 1.4.0 → 1.6.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 (144) hide show
  1. package/AI_USAGE.md +2 -2
  2. package/CHANGELOG.md +71 -0
  3. package/dist/_utils/color.d.ts +53 -0
  4. package/dist/components/color-picker/ColorPicker.d.ts +239 -0
  5. package/dist/components/color-picker/gradient-slider.d.ts +52 -0
  6. package/dist/components/color-picker/index.d.ts +238 -0
  7. package/dist/components/color-picker/panel.d.ts +721 -0
  8. package/dist/components/color-picker/sv-panel.d.ts +48 -0
  9. package/dist/components/date-picker/DatePicker.vue.d.ts +3 -3
  10. package/dist/components/date-picker/index.d.ts +6 -6
  11. package/dist/components/dropdown/Dropdown.vue.d.ts +34 -4
  12. package/dist/components/dropdown/DropdownButton.vue.d.ts +37 -6
  13. package/dist/components/dropdown/DropdownSubmenu.vue.d.ts +34 -4
  14. package/dist/components/dropdown/dropdown-panel.vue.d.ts +30 -0
  15. package/dist/components/dropdown/index.d.ts +212 -29
  16. package/dist/components/form/FormItem.vue.d.ts +3 -3
  17. package/dist/components/form/form-item-label.vue.d.ts +3 -3
  18. package/dist/components/form/index.d.ts +6 -6
  19. package/dist/components/form-select/Select.d.ts +3 -3
  20. package/dist/components/form-select/SelectDropdown.vue.d.ts +30 -0
  21. package/dist/components/form-select/index.d.ts +66 -6
  22. package/dist/components/form-slider/Slider.vue.d.ts +3 -3
  23. package/dist/components/form-slider/index.d.ts +6 -6
  24. package/dist/components/form-slider/slider-button.vue.d.ts +3 -3
  25. package/dist/components/heatmap/Heatmap.d.ts +311 -0
  26. package/dist/components/heatmap/helpers/matrix.d.ts +58 -0
  27. package/dist/components/heatmap/index.d.ts +372 -0
  28. package/dist/components/heatmap/interface.d.ts +57 -0
  29. package/dist/components/image/Image.vue.d.ts +3 -3
  30. package/dist/components/image/ImagePreview.vue.d.ts +3 -3
  31. package/dist/components/image/ImagePreviewAction.d.ts +3 -3
  32. package/dist/components/image/ImagePreviewGroup.vue.d.ts +3 -3
  33. package/dist/components/image/index.d.ts +24 -24
  34. package/dist/components/image/preview-toolbar.vue.d.ts +3 -3
  35. package/dist/components/index.d.ts +2 -0
  36. package/dist/components/menu/sub-menu-pop.vue.d.ts +3 -3
  37. package/dist/components/network/Network.vue.d.ts +1 -1
  38. package/dist/components/network/index.d.ts +3 -3
  39. package/dist/components/network/utils.d.ts +2 -0
  40. package/dist/components/pagination/page-item-ellipsis.vue.d.ts +9 -0
  41. package/dist/components/pagination/page-jumper.vue.d.ts +6 -0
  42. package/dist/components/pagination/page-options.vue.d.ts +6 -6
  43. package/dist/components/popover/Popover.d.ts +1 -1
  44. package/dist/components/popover/index.d.ts +3 -3
  45. package/dist/components/popup/Popup.d.ts +1 -1
  46. package/dist/components/popup/index.d.ts +3 -3
  47. package/dist/components/skeleton/SkeletonShape.vue.d.ts +3 -3
  48. package/dist/components/skeleton/index.d.ts +6 -6
  49. package/dist/components/spin/Spin.d.ts +38 -0
  50. package/dist/components/spin/index.d.ts +30 -0
  51. package/dist/components/steps/context.d.ts +9 -0
  52. package/dist/components/table/Table.d.ts +1 -1
  53. package/dist/components/table/index.d.ts +3 -3
  54. package/dist/components/tabs/TabPane.vue.d.ts +2 -0
  55. package/dist/components/tabs/Tabs.d.ts +1 -1
  56. package/dist/components/tabs/index.d.ts +9 -3
  57. package/dist/components/tabs/interface.d.ts +4 -0
  58. package/dist/components/time-picker/TimePicker.vue.d.ts +3 -3
  59. package/dist/components/time-picker/index.d.ts +6 -6
  60. package/dist/components/tooltip/Tooltip.vue.d.ts +1 -1
  61. package/dist/components/tooltip/index.d.ts +3 -3
  62. package/dist/components/trigger/Trigger.d.ts +1 -1
  63. package/dist/components/trigger/index.d.ts +3 -3
  64. package/dist/components/watermark/Watermark.d.ts +1 -1
  65. package/dist/components/watermark/index.d.ts +3 -3
  66. package/dist/es/_styles/palette-aliases.js +8 -0
  67. package/dist/es/_utils/color.js +73 -0
  68. package/dist/es/components/button/Button.js +2 -2
  69. package/dist/es/components/color-picker/ColorPicker.js +239 -0
  70. package/dist/es/components/color-picker/gradient-slider.js +79 -0
  71. package/dist/es/components/color-picker/index.js +8 -0
  72. package/dist/es/components/color-picker/panel.js +307 -0
  73. package/dist/es/components/color-picker/sv-panel.js +99 -0
  74. package/dist/es/components/dropdown/Dropdown.vue2.js +11 -4
  75. package/dist/es/components/dropdown/DropdownButton.vue.js +8 -7
  76. package/dist/es/components/dropdown/DropdownButton.vue2.js +19 -17
  77. package/dist/es/components/dropdown/DropdownSubmenu.vue.js +18 -17
  78. package/dist/es/components/dropdown/dropdown-panel.vue.js +17 -17
  79. package/dist/es/components/form-input/Input.js +7 -7
  80. package/dist/es/components/form-input/InputPassword.vue2.js +2 -2
  81. package/dist/es/components/form-input/InputSearch.js +2 -2
  82. package/dist/es/components/form-input-number/InputNumber.js +12 -12
  83. package/dist/es/components/heatmap/Heatmap.js +334 -0
  84. package/dist/es/components/heatmap/helpers/matrix.js +106 -0
  85. package/dist/es/components/heatmap/index.js +8 -0
  86. package/dist/es/components/index.js +118 -114
  87. package/dist/es/components/menu/MenuSubMenu.js +50 -36
  88. package/dist/es/components/menu/sub-menu-pop.vue2.js +30 -30
  89. package/dist/es/components/network/Network.vue2.js +72 -72
  90. package/dist/es/components/network/utils.js +44 -35
  91. package/dist/es/components/pagination/Pagination.js +124 -112
  92. package/dist/es/components/pagination/page-item-ellipsis.vue.js +13 -12
  93. package/dist/es/components/pagination/page-item-ellipsis.vue2.js +19 -15
  94. package/dist/es/components/pagination/page-jumper.vue.js +13 -12
  95. package/dist/es/components/pagination/page-jumper.vue2.js +7 -4
  96. package/dist/es/components/pagination/page-options.vue.js +4 -3
  97. package/dist/es/components/pagination/page-options.vue2.js +17 -15
  98. package/dist/es/components/skeleton/Skeleton.vue.js +11 -9
  99. package/dist/es/components/skeleton/SkeletonLine.vue.js +9 -8
  100. package/dist/es/components/skeleton/SkeletonShape.vue.js +8 -7
  101. package/dist/es/components/spin/Spin.js +124 -60
  102. package/dist/es/components/steps/Step.vue2.js +51 -47
  103. package/dist/es/components/steps/Steps.vue2.js +22 -19
  104. package/dist/es/components/table/Table.js +3 -1
  105. package/dist/es/components/tabs/TabPane.vue.js +11 -9
  106. package/dist/es/components/tabs/TabPane.vue2.js +28 -24
  107. package/dist/es/components/tabs/tabs-nav.js +20 -18
  108. package/dist/es/components/tabs/tabs-tab.vue.js +10 -8
  109. package/dist/es/components/trigger/Trigger.js +19 -19
  110. package/dist/es/icons/_self/empty-better.js +25 -8
  111. package/dist/es/index.js +162 -158
  112. package/dist/es/locale/en-US.js +19 -2
  113. package/dist/es/locale/zh-CN.js +19 -2
  114. package/dist/es/style.css +1 -1
  115. package/dist/index.cjs +4 -4
  116. package/dist/index.umd.js +4 -4
  117. package/dist/locale/interface.d.ts +30 -0
  118. package/dist/style/base.css +1 -1
  119. package/dist/style/button.css +1 -1
  120. package/dist/style/color-picker.css +1 -0
  121. package/dist/style/color-picker.js +2 -0
  122. package/dist/style/date-picker.css +1 -1
  123. package/dist/style/dropdown.css +1 -1
  124. package/dist/style/empty.css +1 -1
  125. package/dist/style/form-checkbox.css +1 -1
  126. package/dist/style/form-input-tag.css +1 -1
  127. package/dist/style/form-input.css +1 -1
  128. package/dist/style/form-radio.css +1 -1
  129. package/dist/style/form-textarea.css +1 -1
  130. package/dist/style/form.css +1 -1
  131. package/dist/style/heatmap.css +1 -0
  132. package/dist/style/heatmap.js +2 -0
  133. package/dist/style/image.css +1 -1
  134. package/dist/style/menu.css +1 -1
  135. package/dist/style/pagination.css +1 -1
  136. package/dist/style/skeleton.css +1 -1
  137. package/dist/style/spin.css +1 -1
  138. package/dist/style/steps.css +1 -1
  139. package/dist/style/table.css +1 -1
  140. package/dist/style/tabs.css +1 -1
  141. package/dist/style.css +1 -1
  142. package/dist/types.d.ts +2 -0
  143. package/package.json +3 -2
  144. package/volar.d.ts +2 -0
@@ -1,20 +1,20 @@
1
- import { useLocale as _ } from "../../locale/index.js";
2
- import { defineComponent as E, ref as S, computed as n, watch as U, onMounted as q, onUnmounted as K } from "vue";
3
- import { getClassNameMixin as D } from "../../_utils/config.js";
4
- import { Network as I } from "./utils.js";
5
- const y = {
1
+ import { useLocale as E } from "../../locale/index.js";
2
+ import { defineComponent as U, ref as m, computed as n, watch as K, onMounted as D, onUnmounted as I } from "vue";
3
+ import { getClassNameMixin as O } from "../../_utils/config.js";
4
+ import { Network as $ } from "./utils.js";
5
+ const C = {
6
6
  online: !0,
7
7
  quality: "unknown",
8
8
  source: "manual",
9
9
  reason: "initial",
10
10
  lastCheckedAt: 0
11
- }, O = {
11
+ }, B = {
12
12
  unknown: "network.checking",
13
13
  good: "network.good",
14
14
  medium: "network.fair",
15
15
  poor: "network.poor",
16
16
  offline: "network.offline"
17
- }, $ = ["unknown", "good", "medium", "poor", "offline"], R = E({
17
+ }, F = ["unknown", "good", "medium", "poor", "offline"], Y = U({
18
18
  name: "Network",
19
19
  props: {
20
20
  size: {
@@ -40,7 +40,7 @@ const y = {
40
40
  */
41
41
  status: {
42
42
  type: String,
43
- validator: (e) => $.includes(e)
43
+ validator: (t) => F.includes(t)
44
44
  },
45
45
  /**
46
46
  * @zh 主动探测 URL,需要支持 CORS。
@@ -85,94 +85,94 @@ const y = {
85
85
  }
86
86
  },
87
87
  emits: {
88
- change: (e) => !0,
89
- online: (e) => !0,
90
- offline: (e) => !0,
91
- probe: (e) => !0
88
+ change: (t) => !0,
89
+ online: (t) => !0,
90
+ offline: (t) => !0,
91
+ probe: (t) => !0
92
92
  },
93
- setup(e, { emit: u, expose: C }) {
94
- const a = D("network"), r = S(), l = S(y), s = n(() => e.size === "small" || e.size === "mini" ? 3 : e.size === "medium" ? 4 : 5), c = (t) => ({
95
- ...y,
96
- online: t !== "offline",
97
- quality: t,
93
+ setup(t, { emit: l, expose: x }) {
94
+ const a = O("network"), r = m(), i = m(C), s = n(() => t.size === "small" || t.size === "mini" ? 3 : t.size === "medium" ? 4 : 5), f = (e) => ({
95
+ ...C,
96
+ online: e !== "offline",
97
+ quality: e,
98
98
  source: "manual",
99
99
  lastCheckedAt: Date.now()
100
- }), i = n(() => e.status ? c(e.status) : l.value), { t: d } = _(), v = n(() => d(O[i.value.quality])), x = n(
101
- () => e.ariaLabel || d("network.ariaLabel", { status: v.value })
102
- ), b = (t, o = "--") => t === void 0 ? o : t <= 0 ? "0K/s" : t >= 1024 * 1024 ? `${(t / 1024 / 1024).toFixed(1)}M/s` : `${Math.max(1, Math.round(t / 1024))}K/s`, M = n(() => b(i.value.downloadSpeed)), f = n(() => e.showMetrics), A = (t) => {
103
- const [o, k] = e.signalStrengthColor, m = {
100
+ }), u = n(() => t.status ? f(t.status) : i.value), { t: w } = E(), g = n(() => w(B[u.value.quality])), M = n(
101
+ () => t.ariaLabel || w("network.ariaLabel", { status: g.value })
102
+ ), A = (e, o = "--") => e === void 0 ? o : e <= 0 ? "0K/s" : e >= 1024 * 1024 ? `${(e / 1024 / 1024).toFixed(1)}M/s` : `${Math.max(1, Math.round(e / 1024))}K/s`, T = n(() => A(u.value.downloadSpeed)), d = n(() => t.showMetrics), L = (e) => {
103
+ const [o, h] = t.signalStrengthColor, v = {
104
104
  unknown: "var(--x-network-color-unknown)",
105
105
  good: o || "var(--x-network-color-good)",
106
- medium: e.statusColors.medium || "var(--x-network-color-medium)",
107
- poor: k || "var(--x-network-color-poor)",
106
+ medium: t.statusColors.medium || "var(--x-network-color-medium)",
107
+ poor: h || "var(--x-network-color-poor)",
108
108
  offline: "var(--x-network-color-offline)"
109
109
  };
110
- return e.statusColors[t] || m[t];
111
- }, L = (t) => t === "good" ? s.value : t === "medium" ? Math.max(2, Math.ceil(s.value * 0.6)) : t === "poor" ? Math.max(1, Math.ceil(s.value * 0.4)) : 0, T = n(() => {
112
- const t = L(i.value.quality), o = A(i.value.quality);
113
- return Array.from({ length: s.value }, (k, m) => {
114
- const h = m < t;
110
+ return t.statusColors[e] || v[e];
111
+ }, N = (e) => e === "good" ? s.value : e === "medium" ? Math.max(2, Math.ceil(s.value * 0.6)) : e === "poor" ? Math.max(1, Math.ceil(s.value * 0.4)) : 0, q = n(() => {
112
+ const e = N(u.value.quality), o = L(u.value.quality);
113
+ return Array.from({ length: s.value }, (h, v) => {
114
+ const y = v < e;
115
115
  return {
116
- active: h,
117
- color: h ? o : "var(--x-network-color-inactive)"
116
+ active: y,
117
+ color: y ? o : "var(--x-network-color-inactive)"
118
118
  };
119
119
  });
120
- }), N = (t) => {
121
- if (e.status) return;
122
- const o = l.value.quality;
123
- l.value = t, u("change", t), t.source === "probe" && u("probe", t), o !== "offline" && t.quality === "offline" && u("offline", t), o === "offline" && t.quality !== "offline" && u("online", t);
124
- }, w = () => {
125
- var t;
126
- if ((t = r.value) == null || t.destroy(), r.value = void 0, e.status) {
127
- l.value = c(e.status);
120
+ }), z = (e, o) => e.online === o.online && e.quality === o.quality && e.source === o.source && e.reason === o.reason && e.latency === o.latency && e.downloadSpeed === o.downloadSpeed && e.effectiveType === o.effectiveType, c = m(void 0), _ = (e) => {
121
+ if (t.status) return;
122
+ const o = c.value ?? i.value;
123
+ i.value = e, (!c.value || !z(c.value, e)) && (c.value = e, l("change", e)), e.source === "probe" && l("probe", e), o.quality !== "offline" && e.quality === "offline" && l("offline", e), o.quality === "offline" && e.quality !== "offline" && l("online", e);
124
+ }, k = () => {
125
+ var e;
126
+ if ((e = r.value) == null || e.destroy(), r.value = void 0, t.status) {
127
+ i.value = f(t.status);
128
128
  return;
129
129
  }
130
- r.value = new I(N, {
131
- ping: e.ping,
132
- interval: e.interval,
133
- timeout: e.timeout
134
- }), l.value = r.value.getSnapshot();
135
- }, g = async () => {
136
- var t;
137
- if (e.status) {
138
- const o = c(e.status);
139
- return u("change", o), o;
130
+ r.value = new $(_, {
131
+ ping: t.ping,
132
+ interval: t.interval,
133
+ timeout: t.timeout
134
+ }), i.value = r.value.getSnapshot();
135
+ }, S = async () => {
136
+ var e;
137
+ if (t.status) {
138
+ const o = f(t.status);
139
+ return l("change", o), o;
140
140
  }
141
- return (t = r.value) == null ? void 0 : t.refresh();
141
+ return await ((e = r.value) == null ? void 0 : e.refresh()) ?? i.value;
142
142
  };
143
- U(
144
- () => [e.status, e.ping, e.interval, e.timeout],
143
+ K(
144
+ () => [t.status, t.ping, t.interval, t.timeout],
145
145
  () => {
146
- w();
146
+ k();
147
147
  }
148
- ), q(() => {
149
- w();
150
- }), K(() => {
151
- var t;
152
- (t = r.value) == null || t.destroy(), r.value = void 0;
153
- }), C({ refresh: g });
154
- const z = n(() => [
148
+ ), D(() => {
149
+ k();
150
+ }), I(() => {
151
+ var e;
152
+ (e = r.value) == null || e.destroy(), r.value = void 0;
153
+ }), x({ refresh: S });
154
+ const b = n(() => [
155
155
  a.block,
156
- e.size && a.modifier(e.size),
157
- a.modifier(`status-${i.value.quality}`),
156
+ t.size && a.modifier(t.size),
157
+ a.modifier(`status-${u.value.quality}`),
158
158
  {
159
- [a.is("with-text")]: f.value,
160
- [a.is("with-metrics")]: f.value
159
+ [a.is("with-text")]: d.value,
160
+ [a.is("with-metrics")]: d.value
161
161
  }
162
162
  ]);
163
163
  return {
164
164
  className: a,
165
- cls: z,
166
- lineItems: T,
167
- mergedStatus: i,
168
- statusText: v,
169
- mergedAriaLabel: x,
170
- formattedDownloadSpeed: M,
171
- mergedShowMetrics: f,
172
- refresh: g
165
+ cls: b,
166
+ lineItems: q,
167
+ mergedStatus: u,
168
+ statusText: g,
169
+ mergedAriaLabel: M,
170
+ formattedDownloadSpeed: T,
171
+ mergedShowMetrics: d,
172
+ refresh: S
173
173
  };
174
174
  }
175
175
  });
176
176
  export {
177
- R as default
177
+ Y as default
178
178
  };
@@ -1,60 +1,67 @@
1
- var T = Object.defineProperty;
2
- var C = (n, e, t) => e in n ? T(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var o = (n, e, t) => C(n, typeof e != "symbol" ? e + "" : e, t);
4
- const v = {
1
+ var b = Object.defineProperty;
2
+ var T = (t, e, n) => e in t ? b(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var o = (t, e, n) => T(t, typeof e != "symbol" ? e + "" : e, n);
4
+ const y = {
5
5
  online: !0,
6
6
  quality: "unknown",
7
7
  source: "manual",
8
8
  reason: "initial",
9
9
  lastCheckedAt: 0
10
- }, u = () => Date.now(), d = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), m = () => {
10
+ }, f = () => Date.now(), d = () => typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), m = () => {
11
11
  if (!(typeof navigator > "u"))
12
12
  return navigator.connection;
13
- }, l = () => typeof navigator < "u" && navigator.onLine === !1, k = (n) => {
14
- const { downlink: e = 0, rtt: t = Number.POSITIVE_INFINITY, effectiveType: i } = n;
15
- return i === "slow-2g" || i === "2g" ? "poor" : i === "3g" ? "medium" : e > 2 && t <= 100 ? "good" : e > 1 && t <= 300 ? "medium" : "poor";
16
- }, E = (n) => n < 500 ? "good" : n < 1500 ? "medium" : "poor", w = (n, e) => ({
13
+ }, l = () => typeof navigator < "u" && navigator.onLine === !1, k = (t) => {
14
+ const { effectiveType: e } = t;
15
+ if (e === "slow-2g" || e === "2g") return "poor";
16
+ if (e === "3g") return "medium";
17
+ if (e === "4g") return "good";
18
+ const { downlink: n, rtt: i } = t, r = typeof n == "number" && Number.isFinite(n), h = typeof i == "number" && Number.isFinite(i);
19
+ if (!(!r || !h))
20
+ return n > 2 && i <= 100 ? "good" : n > 1 && i <= 300 ? "medium" : "poor";
21
+ }, q = (t) => t < 500 ? "good" : t < 1500 ? "medium" : "poor", w = (t, e) => ({
17
22
  online: !1,
18
23
  quality: "offline",
19
- source: n,
24
+ source: t,
20
25
  reason: e,
21
- lastCheckedAt: u()
22
- }), c = (n) => {
26
+ lastCheckedAt: f()
27
+ }), c = (t) => {
23
28
  if (typeof navigator > "u")
24
29
  return {
25
30
  online: !0,
26
31
  quality: "unknown",
27
32
  source: "navigator",
28
33
  reason: "unsupported",
29
- lastCheckedAt: u()
34
+ lastCheckedAt: f()
30
35
  };
31
36
  if (l())
32
37
  return w("navigator", "browser-offline");
33
38
  const e = m();
34
39
  return e ? {
35
40
  online: !0,
36
- quality: k(e),
41
+ quality: k(e) ?? "unknown",
37
42
  downlink: e.downlink,
38
43
  rtt: e.rtt,
39
44
  effectiveType: e.effectiveType,
40
45
  source: "connection",
41
- reason: n,
42
- lastCheckedAt: u()
46
+ reason: t,
47
+ lastCheckedAt: f()
43
48
  } : {
44
49
  online: !0,
45
50
  quality: "good",
46
51
  source: "navigator",
47
- reason: n,
48
- lastCheckedAt: u()
52
+ reason: t,
53
+ lastCheckedAt: f()
49
54
  };
50
55
  };
51
56
  class L {
52
- constructor(e, t = {}) {
57
+ constructor(e, n = {}) {
53
58
  o(this, "callback");
54
59
  o(this, "options");
55
60
  o(this, "timer");
56
61
  o(this, "initialTimer");
57
62
  o(this, "connection");
63
+ /** 不支持 addEventListener 时保存 connection.onchange 的原处理器,销毁时归还 */
64
+ o(this, "previousConnectionOnChange");
58
65
  o(this, "controller");
59
66
  o(this, "destroyed", !1);
60
67
  o(this, "pendingRefresh");
@@ -65,51 +72,51 @@ class L {
65
72
  o(this, "handleConnectionChange", () => {
66
73
  this.refresh("connection-change");
67
74
  });
68
- this.callback = e, this.options = t, this.boot();
75
+ this.callback = e, this.options = n, this.boot();
69
76
  }
70
77
  checkNetworkQuality() {
71
78
  return c().quality;
72
79
  }
73
80
  getSnapshot() {
74
- return typeof window > "u" || typeof navigator > "u" ? v : c();
81
+ return typeof window > "u" || typeof navigator > "u" ? y : c();
75
82
  }
76
83
  async refresh(e) {
77
84
  if (this.pendingRefresh) return this.pendingRefresh;
78
- const t = ++this.sequence;
79
- return this.pendingRefresh = this.resolveStatus(e).then((i) => (!this.destroyed && t === this.sequence && this.emitCallback(i), i)).finally(() => {
85
+ const n = ++this.sequence;
86
+ return this.pendingRefresh = this.resolveStatus(e).then((i) => (!this.destroyed && n === this.sequence && this.emitCallback(i), i)).finally(() => {
80
87
  this.pendingRefresh = void 0;
81
88
  }), this.pendingRefresh;
82
89
  }
83
90
  async resolveStatus(e) {
84
- return typeof window > "u" || typeof navigator > "u" ? v : l() ? w("navigator", "browser-offline") : this.options.ping ? this.pingNetworkQuality(this.options.ping, this.options.timeout) : c(e);
91
+ return typeof window > "u" || typeof navigator > "u" ? y : l() ? w("navigator", "browser-offline") : this.options.ping ? this.pingNetworkQuality(this.options.ping, this.options.timeout) : c(e);
85
92
  }
86
- async pingNetworkQuality(e, t = 5e3) {
93
+ async pingNetworkQuality(e, n = 5e3) {
87
94
  var p;
88
95
  const i = d();
89
96
  (p = this.controller) == null || p.abort();
90
97
  const r = typeof AbortController < "u" ? new AbortController() : void 0;
91
98
  this.controller = r;
92
- const f = r ? setTimeout(() => r.abort(), Math.max(t, 1)) : void 0;
99
+ const h = r ? setTimeout(() => r.abort(), Math.max(n, 1)) : void 0;
93
100
  try {
94
101
  const s = await fetch(e, {
95
102
  cache: "no-cache",
96
103
  method: "GET",
97
104
  mode: "cors",
98
105
  signal: r == null ? void 0 : r.signal
99
- }), a = Math.round(d() - i), b = await s.arrayBuffer(), g = Math.round(d() - i), y = b.byteLength || Number(s.headers.get("content-length") || 0), h = y > 0 && g > 0 ? y / g * 1e3 : void 0;
106
+ }), a = Math.round(d() - i), C = await s.arrayBuffer(), g = Math.round(d() - i), v = C.byteLength || Number(s.headers.get("content-length") || 0), u = v > 0 && g > 0 ? v / g * 1e3 : void 0;
100
107
  return s.ok ? {
101
108
  ...c(),
102
- quality: E(a),
109
+ quality: q(a),
103
110
  latency: a,
104
- downloadSpeed: h,
105
- speedSource: h ? "probe" : void 0,
111
+ downloadSpeed: u,
112
+ speedSource: u ? "probe" : void 0,
106
113
  source: "probe"
107
114
  } : {
108
115
  ...c("http-error"),
109
116
  quality: "poor",
110
117
  latency: a,
111
- downloadSpeed: h,
112
- speedSource: h ? "probe" : void 0,
118
+ downloadSpeed: u,
119
+ speedSource: u ? "probe" : void 0,
113
120
  source: "probe",
114
121
  reason: "http-error"
115
122
  };
@@ -123,7 +130,7 @@ class L {
123
130
  reason: a ? "probe-timeout" : "probe-error"
124
131
  };
125
132
  } finally {
126
- f && clearTimeout(f), this.controller === r && (this.controller = void 0);
133
+ h && clearTimeout(h), this.controller === r && (this.controller = void 0);
127
134
  }
128
135
  }
129
136
  boot() {
@@ -131,7 +138,9 @@ class L {
131
138
  return;
132
139
  window.addEventListener("online", this.handleWindowChange), window.addEventListener("offline", this.handleWindowChange);
133
140
  const e = m();
134
- e && (this.connection = e, e.addEventListener ? e.addEventListener("change", this.handleConnectionChange) : e.onchange = this.handleConnectionChange), this.initialTimer = setTimeout(() => {
141
+ e && (this.connection = e, e.addEventListener ? e.addEventListener("change", this.handleConnectionChange) : (this.previousConnectionOnChange = e.onchange, e.onchange = (n) => {
142
+ typeof this.previousConnectionOnChange == "function" && this.previousConnectionOnChange.call(e, n), this.handleConnectionChange();
143
+ })), this.initialTimer = setTimeout(() => {
135
144
  this.refresh();
136
145
  }, 0), this.scheduleNextRefresh();
137
146
  }
@@ -145,7 +154,7 @@ class L {
145
154
  }
146
155
  destroy() {
147
156
  var e;
148
- this.destroyed = !0, this.sequence += 1, (e = this.controller) == null || e.abort(), this.controller = void 0, this.initialTimer && (clearTimeout(this.initialTimer), this.initialTimer = void 0), this.timer && (clearTimeout(this.timer), this.timer = void 0), typeof window < "u" && (window.removeEventListener("online", this.handleWindowChange), window.removeEventListener("offline", this.handleWindowChange)), this.connection && (this.connection.removeEventListener ? this.connection.removeEventListener("change", this.handleConnectionChange) : this.connection.onchange === this.handleConnectionChange && (this.connection.onchange = null), this.connection = void 0);
157
+ this.destroyed = !0, this.sequence += 1, (e = this.controller) == null || e.abort(), this.controller = void 0, this.initialTimer && (clearTimeout(this.initialTimer), this.initialTimer = void 0), this.timer && (clearTimeout(this.timer), this.timer = void 0), typeof window < "u" && (window.removeEventListener("online", this.handleWindowChange), window.removeEventListener("offline", this.handleWindowChange)), this.connection && (this.connection.removeEventListener ? this.connection.removeEventListener("change", this.handleConnectionChange) : this.connection.onchange = this.previousConnectionOnChange ?? null, this.connection = void 0, this.previousConnectionOnChange = void 0);
149
158
  }
150
159
  }
151
160
  export {