x-next 1.5.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 (128) hide show
  1. package/AI_USAGE.md +2 -2
  2. package/CHANGELOG.md +36 -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 +35 -5
  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 +209 -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/table/Table.d.ts +1 -1
  52. package/dist/components/table/index.d.ts +3 -3
  53. package/dist/components/tabs/Tabs.d.ts +1 -1
  54. package/dist/components/tabs/index.d.ts +3 -3
  55. package/dist/components/time-picker/TimePicker.vue.d.ts +3 -3
  56. package/dist/components/time-picker/index.d.ts +6 -6
  57. package/dist/components/tooltip/Tooltip.vue.d.ts +1 -1
  58. package/dist/components/tooltip/index.d.ts +3 -3
  59. package/dist/components/trigger/Trigger.d.ts +1 -1
  60. package/dist/components/trigger/index.d.ts +3 -3
  61. package/dist/components/watermark/Watermark.d.ts +1 -1
  62. package/dist/components/watermark/index.d.ts +3 -3
  63. package/dist/es/_styles/palette-aliases.js +8 -0
  64. package/dist/es/_utils/color.js +73 -0
  65. package/dist/es/components/button/Button.js +2 -2
  66. package/dist/es/components/color-picker/ColorPicker.js +239 -0
  67. package/dist/es/components/color-picker/gradient-slider.js +79 -0
  68. package/dist/es/components/color-picker/index.js +8 -0
  69. package/dist/es/components/color-picker/panel.js +307 -0
  70. package/dist/es/components/color-picker/sv-panel.js +99 -0
  71. package/dist/es/components/dropdown/dropdown-panel.vue.js +17 -17
  72. package/dist/es/components/form-input/Input.js +7 -7
  73. package/dist/es/components/form-input/InputPassword.vue2.js +2 -2
  74. package/dist/es/components/form-input/InputSearch.js +2 -2
  75. package/dist/es/components/form-input-number/InputNumber.js +12 -12
  76. package/dist/es/components/heatmap/Heatmap.js +334 -0
  77. package/dist/es/components/heatmap/helpers/matrix.js +106 -0
  78. package/dist/es/components/heatmap/index.js +8 -0
  79. package/dist/es/components/index.js +118 -114
  80. package/dist/es/components/menu/sub-menu-pop.vue2.js +12 -12
  81. package/dist/es/components/network/Network.vue2.js +72 -72
  82. package/dist/es/components/network/utils.js +44 -35
  83. package/dist/es/components/pagination/Pagination.js +113 -104
  84. package/dist/es/components/pagination/page-item-ellipsis.vue.js +13 -12
  85. package/dist/es/components/pagination/page-item-ellipsis.vue2.js +19 -15
  86. package/dist/es/components/pagination/page-jumper.vue.js +13 -12
  87. package/dist/es/components/pagination/page-jumper.vue2.js +7 -4
  88. package/dist/es/components/pagination/page-options.vue.js +4 -3
  89. package/dist/es/components/pagination/page-options.vue2.js +17 -15
  90. package/dist/es/components/skeleton/Skeleton.vue.js +11 -9
  91. package/dist/es/components/skeleton/SkeletonLine.vue.js +9 -8
  92. package/dist/es/components/skeleton/SkeletonShape.vue.js +8 -7
  93. package/dist/es/components/spin/Spin.js +124 -60
  94. package/dist/es/components/table/Table.js +3 -1
  95. package/dist/es/components/trigger/Trigger.js +19 -19
  96. package/dist/es/icons/_self/empty-better.js +25 -8
  97. package/dist/es/index.js +162 -158
  98. package/dist/es/locale/en-US.js +17 -1
  99. package/dist/es/locale/zh-CN.js +17 -1
  100. package/dist/es/style.css +1 -1
  101. package/dist/index.cjs +4 -4
  102. package/dist/index.umd.js +4 -4
  103. package/dist/locale/interface.d.ts +28 -0
  104. package/dist/style/base.css +1 -1
  105. package/dist/style/button.css +1 -1
  106. package/dist/style/color-picker.css +1 -0
  107. package/dist/style/color-picker.js +2 -0
  108. package/dist/style/date-picker.css +1 -1
  109. package/dist/style/empty.css +1 -1
  110. package/dist/style/form-checkbox.css +1 -1
  111. package/dist/style/form-input-tag.css +1 -1
  112. package/dist/style/form-input.css +1 -1
  113. package/dist/style/form-radio.css +1 -1
  114. package/dist/style/form-textarea.css +1 -1
  115. package/dist/style/form.css +1 -1
  116. package/dist/style/heatmap.css +1 -0
  117. package/dist/style/heatmap.js +2 -0
  118. package/dist/style/image.css +1 -1
  119. package/dist/style/menu.css +1 -1
  120. package/dist/style/pagination.css +1 -1
  121. package/dist/style/skeleton.css +1 -1
  122. package/dist/style/spin.css +1 -1
  123. package/dist/style/steps.css +1 -1
  124. package/dist/style/table.css +1 -1
  125. package/dist/style.css +1 -1
  126. package/dist/types.d.ts +2 -0
  127. package/package.json +1 -1
  128. package/volar.d.ts +2 -0
@@ -4,159 +4,163 @@ import { ConfigProvider as x } from "./config-provider/index.js";
4
4
  import { Dialog as n } from "./dialog/index.js";
5
5
  import { Drawer as u } from "./drawer/index.js";
6
6
  import { Dropdown as c, DropdownButton as d, DropdownGroup as T, DropdownOption as S, DropdownSubmenu as g } from "./dropdown/index.js";
7
- import { Empty as P } from "./empty/index.js";
8
- import { DatePicker as b, MonthPicker as s, QuarterPicker as w, RangePicker as L, WeekPicker as D, YearPicker as y } from "./date-picker/index.js";
7
+ import { Empty as I } from "./empty/index.js";
8
+ import { DatePicker as b, MonthPicker as s, QuarterPicker as w, RangePicker as L, WeekPicker as C, YearPicker as D } from "./date-picker/index.js";
9
9
  import { Form as G, FormItem as h } from "./form/index.js";
10
10
  import { Checkbox as M, CheckboxGroup as R } from "./form-checkbox/index.js";
11
11
  import { Input as B, InputGroup as E, InputPassword as _, InputSearch as N } from "./form-input/index.js";
12
12
  import { InputNumber as j } from "./form-input-number/index.js";
13
- import { InputTag as K } from "./form-input-tag/index.js";
14
- import { Radio as H, RadioGroup as z } from "./form-radio/index.js";
13
+ import { InputTag as H } from "./form-input-tag/index.js";
14
+ import { Radio as W, RadioGroup as z } from "./form-radio/index.js";
15
15
  import { Select as U, SelectDropdown as Y, SelectOption as Z, SelectOptionGroup as q } from "./form-select/index.js";
16
16
  import { Slider as V } from "./form-slider/index.js";
17
17
  import { Switch as $ } from "./form-switch/index.js";
18
18
  import { Textarea as ro } from "./form-textarea/index.js";
19
- import { Draggable as to } from "./draggable/index.js";
20
- import { Col as mo, Grid as fo, GridItem as xo, Row as ao } from "./grid/index.js";
21
- import { Image as io, ImagePreview as uo, ImagePreviewAction as lo, ImagePreviewGroup as co } from "./image/index.js";
22
- import { Layout as So, LayoutContent as go, LayoutFooter as Io, LayoutHeader as Po, LayoutSidebar as ko } from "./layout/index.js";
23
- import { Link as so } from "./link/index.js";
24
- import { Menu as Lo, MenuItem as Do, MenuItemGroup as yo, MenuSubMenu as Co } from "./menu/index.js";
25
- import { Message as ho } from "./message/index.js";
26
- import { Network as Mo } from "./network/index.js";
27
- import { Notification as Ao } from "./notification/index.js";
28
- import { Pagination as Eo } from "./pagination/index.js";
29
- import { Popconfirm as No } from "./popconfirm/index.js";
30
- import { Popover as jo } from "./popover/index.js";
31
- import { Popup as Ko } from "./popup/index.js";
32
- import { Progress as Ho } from "./progress/index.js";
33
- import { Rate as Qo } from "./rate/index.js";
34
- import { ResizeBox as Yo } from "./resize-box/index.js";
35
- import { Scrollbar as qo } from "./scrollbar-v2/index.js";
36
- import { Skeleton as Vo, SkeletonLine as Xo, SkeletonShape as $o } from "./skeleton/index.js";
37
- import { Space as rr } from "./space/index.js";
38
- import { Spin as tr } from "./spin/index.js";
39
- import { Step as mr, Steps as fr } from "./steps/index.js";
40
- import { Table as ar, TableColumn as nr } from "./table/index.js";
41
- import { TabPane as ur, Tabs as lr } from "./tabs/index.js";
42
- import { Tag as dr } from "./tag/index.js";
43
- import { TimePicker as Sr } from "./time-picker/index.js";
44
- import { TimeRangeSelector as Ir } from "./time-range-selector/index.js";
45
- import { Timeline as kr } from "./timeline/index.js";
46
- import { TimelineItem as sr } from "./timeline-item/index.js";
47
- import { Tooltip as Lr } from "./tooltip/index.js";
48
- import { TrendChart as yr } from "./trend-chart/index.js";
49
- import { Trigger as Gr } from "./trigger/index.js";
50
- import { Watermark as vr } from "./watermark/index.js";
51
- import { TABLE_LOCALE_EN_US as Rr, TABLE_LOCALE_ZH_CN as Ar, formatLocaleText as Br } from "./table/locale.js";
52
- import { default as _r } from "./table/table-tbody.js";
53
- import { default as Or } from "./table/table-td.js";
54
- import { default as Fr } from "./table/table-th.js";
55
- import { default as Wr } from "./table/table-thead.js";
56
- import { default as zr } from "./table/table-tr.js";
57
- import { configProviderInjectionKey as Ur } from "./config-provider/context.js";
58
- import { formInjectionKey as Zr, formItemInjectionKey as qr } from "./form/context.js";
59
- import { vDraggable as Vr } from "./draggable/directive.js";
60
- import { vWatermark as $r } from "./watermark/directive.js";
19
+ import { ColorPicker as to } from "./color-picker/index.js";
20
+ import { Draggable as mo } from "./draggable/index.js";
21
+ import { Col as xo, Grid as ao, GridItem as no, Row as io } from "./grid/index.js";
22
+ import { Heatmap as lo } from "./heatmap/index.js";
23
+ import { Image as To, ImagePreview as So, ImagePreviewAction as go, ImagePreviewGroup as Po } from "./image/index.js";
24
+ import { Layout as ko, LayoutContent as bo, LayoutFooter as so, LayoutHeader as wo, LayoutSidebar as Lo } from "./layout/index.js";
25
+ import { Link as Do } from "./link/index.js";
26
+ import { Menu as Go, MenuItem as ho, MenuItemGroup as vo, MenuSubMenu as Mo } from "./menu/index.js";
27
+ import { Message as Ao } from "./message/index.js";
28
+ import { Network as Eo } from "./network/index.js";
29
+ import { Notification as No } from "./notification/index.js";
30
+ import { Pagination as jo } from "./pagination/index.js";
31
+ import { Popconfirm as Ho } from "./popconfirm/index.js";
32
+ import { Popover as Wo } from "./popover/index.js";
33
+ import { Popup as Qo } from "./popup/index.js";
34
+ import { Progress as Yo } from "./progress/index.js";
35
+ import { Rate as qo } from "./rate/index.js";
36
+ import { ResizeBox as Vo } from "./resize-box/index.js";
37
+ import { Scrollbar as $o } from "./scrollbar-v2/index.js";
38
+ import { Skeleton as rr, SkeletonLine as er, SkeletonShape as tr } from "./skeleton/index.js";
39
+ import { Space as mr } from "./space/index.js";
40
+ import { Spin as xr } from "./spin/index.js";
41
+ import { Step as nr, Steps as ir } from "./steps/index.js";
42
+ import { Table as lr, TableColumn as cr } from "./table/index.js";
43
+ import { TabPane as Tr, Tabs as Sr } from "./tabs/index.js";
44
+ import { Tag as Pr } from "./tag/index.js";
45
+ import { TimePicker as kr } from "./time-picker/index.js";
46
+ import { TimeRangeSelector as sr } from "./time-range-selector/index.js";
47
+ import { Timeline as Lr } from "./timeline/index.js";
48
+ import { TimelineItem as Dr } from "./timeline-item/index.js";
49
+ import { Tooltip as Gr } from "./tooltip/index.js";
50
+ import { TrendChart as vr } from "./trend-chart/index.js";
51
+ import { Trigger as Rr } from "./trigger/index.js";
52
+ import { Watermark as Br } from "./watermark/index.js";
53
+ import { TABLE_LOCALE_EN_US as _r, TABLE_LOCALE_ZH_CN as Nr, formatLocaleText as Or } from "./table/locale.js";
54
+ import { default as Fr } from "./table/table-tbody.js";
55
+ import { default as Kr } from "./table/table-td.js";
56
+ import { default as zr } from "./table/table-th.js";
57
+ import { default as Ur } from "./table/table-thead.js";
58
+ import { default as Zr } from "./table/table-tr.js";
59
+ import { configProviderInjectionKey as Jr } from "./config-provider/context.js";
60
+ import { formInjectionKey as Xr, formItemInjectionKey as $r } from "./form/context.js";
61
+ import { vDraggable as re } from "./draggable/directive.js";
62
+ import { vWatermark as te } from "./watermark/directive.js";
61
63
  export {
62
64
  e as Alert,
63
65
  p as Button,
64
66
  m as ButtonGroup,
65
67
  M as Checkbox,
66
68
  R as CheckboxGroup,
67
- mo as Col,
69
+ xo as Col,
70
+ to as ColorPicker,
68
71
  x as ConfigProvider,
69
72
  b as DatePicker,
70
73
  n as Dialog,
71
- to as Draggable,
74
+ mo as Draggable,
72
75
  u as Drawer,
73
76
  c as Dropdown,
74
77
  d as DropdownButton,
75
78
  T as DropdownGroup,
76
79
  S as DropdownOption,
77
80
  g as DropdownSubmenu,
78
- P as Empty,
81
+ I as Empty,
79
82
  G as Form,
80
83
  h as FormItem,
81
- fo as Grid,
82
- xo as GridItem,
83
- io as Image,
84
- uo as ImagePreview,
85
- lo as ImagePreviewAction,
86
- co as ImagePreviewGroup,
84
+ ao as Grid,
85
+ no as GridItem,
86
+ lo as Heatmap,
87
+ To as Image,
88
+ So as ImagePreview,
89
+ go as ImagePreviewAction,
90
+ Po as ImagePreviewGroup,
87
91
  B as Input,
88
92
  E as InputGroup,
89
93
  j as InputNumber,
90
94
  _ as InputPassword,
91
95
  N as InputSearch,
92
- K as InputTag,
93
- So as Layout,
94
- go as LayoutContent,
95
- Io as LayoutFooter,
96
- Po as LayoutHeader,
97
- ko as LayoutSidebar,
98
- so as Link,
99
- Lo as Menu,
100
- Do as MenuItem,
101
- yo as MenuItemGroup,
102
- Co as MenuSubMenu,
103
- ho as Message,
96
+ H as InputTag,
97
+ ko as Layout,
98
+ bo as LayoutContent,
99
+ so as LayoutFooter,
100
+ wo as LayoutHeader,
101
+ Lo as LayoutSidebar,
102
+ Do as Link,
103
+ Go as Menu,
104
+ ho as MenuItem,
105
+ vo as MenuItemGroup,
106
+ Mo as MenuSubMenu,
107
+ Ao as Message,
104
108
  s as MonthPicker,
105
- Mo as Network,
106
- Ao as Notification,
107
- Eo as Pagination,
108
- No as Popconfirm,
109
- jo as Popover,
110
- Ko as Popup,
111
- Ho as Progress,
109
+ Eo as Network,
110
+ No as Notification,
111
+ jo as Pagination,
112
+ Ho as Popconfirm,
113
+ Wo as Popover,
114
+ Qo as Popup,
115
+ Yo as Progress,
112
116
  w as QuarterPicker,
113
- H as Radio,
117
+ W as Radio,
114
118
  z as RadioGroup,
115
119
  L as RangePicker,
116
- Qo as Rate,
117
- Yo as ResizeBox,
118
- ao as Row,
119
- qo as Scrollbar,
120
+ qo as Rate,
121
+ Vo as ResizeBox,
122
+ io as Row,
123
+ $o as Scrollbar,
120
124
  U as Select,
121
125
  Y as SelectDropdown,
122
126
  Z as SelectOption,
123
127
  q as SelectOptionGroup,
124
- Vo as Skeleton,
125
- Xo as SkeletonLine,
126
- $o as SkeletonShape,
128
+ rr as Skeleton,
129
+ er as SkeletonLine,
130
+ tr as SkeletonShape,
127
131
  V as Slider,
128
- rr as Space,
129
- tr as Spin,
130
- mr as Step,
131
- fr as Steps,
132
+ mr as Space,
133
+ xr as Spin,
134
+ nr as Step,
135
+ ir as Steps,
132
136
  $ as Switch,
133
- Rr as TABLE_LOCALE_EN_US,
134
- Ar as TABLE_LOCALE_ZH_CN,
135
- ur as TabPane,
136
- ar as Table,
137
- nr as TableColumn,
138
- lr as Tabs,
139
- dr as Tag,
140
- _r as Tbody,
141
- Or as Td,
137
+ _r as TABLE_LOCALE_EN_US,
138
+ Nr as TABLE_LOCALE_ZH_CN,
139
+ Tr as TabPane,
140
+ lr as Table,
141
+ cr as TableColumn,
142
+ Sr as Tabs,
143
+ Pr as Tag,
144
+ Fr as Tbody,
145
+ Kr as Td,
142
146
  ro as Textarea,
143
- Fr as Th,
144
- Wr as Thead,
145
- Sr as TimePicker,
146
- Ir as TimeRangeSelector,
147
- kr as Timeline,
148
- sr as TimelineItem,
149
- Lr as Tooltip,
150
- zr as Tr,
151
- yr as TrendChart,
152
- Gr as Trigger,
153
- vr as Watermark,
154
- D as WeekPicker,
155
- y as YearPicker,
156
- Ur as configProviderInjectionKey,
157
- Zr as formInjectionKey,
158
- qr as formItemInjectionKey,
159
- Br as formatLocaleText,
160
- Vr as vDraggable,
161
- $r as vWatermark
147
+ zr as Th,
148
+ Ur as Thead,
149
+ kr as TimePicker,
150
+ sr as TimeRangeSelector,
151
+ Lr as Timeline,
152
+ Dr as TimelineItem,
153
+ Gr as Tooltip,
154
+ Zr as Tr,
155
+ vr as TrendChart,
156
+ Rr as Trigger,
157
+ Br as Watermark,
158
+ C as WeekPicker,
159
+ D as YearPicker,
160
+ Jr as configProviderInjectionKey,
161
+ Xr as formInjectionKey,
162
+ $r as formItemInjectionKey,
163
+ Or as formatLocaleText,
164
+ re as vDraggable,
165
+ te as vWatermark
162
166
  };
@@ -40,16 +40,16 @@ const Q = S({
40
40
  }
41
41
  },
42
42
  setup(s) {
43
- const { key: l } = N(), { level: a } = _(), { selectable: u, disabled: p, isChildrenSelected: C, popupMaxHeight: x } = B(s), t = V(), { onSubMenuClick: r, onMenuItemClick: n } = t, m = o(() => t.prefixCls), c = o(() => t.mode), f = o(() => t.selectedKeys || []), i = o(() => `${m.value}-pop`), v = o(
44
- () => u.value && f.value.includes(l.value) || C.value
43
+ const { key: l } = N(), { level: a } = _(), { selectable: u, disabled: p, isChildrenSelected: C, popupMaxHeight: x } = B(s), t = V(), { onSubMenuClick: r, onMenuItemClick: n } = t, m = o(() => t.prefixCls), f = o(() => t.mode), v = o(() => t.selectedKeys || []), i = o(() => `${m.value}-pop`), d = o(
44
+ () => u.value && v.value.includes(l.value) || C.value
45
45
  ), M = o(() => [
46
46
  `${i.value}`,
47
47
  `${i.value}-header`,
48
48
  {
49
- [`${m.value}-selected`]: v.value
49
+ [`${m.value}-selected`]: d.value
50
50
  }
51
- ]), h = o(() => c.value === "horizontal" && !t.inTrigger), d = P(!1), g = (e) => {
52
- d.value = e;
51
+ ]), h = o(() => f.value === "horizontal" && !t.inTrigger), g = P(!1), c = (e) => {
52
+ g.value = e;
53
53
  }, y = w("trigger"), k = o(() => {
54
54
  var e;
55
55
  return [
@@ -63,14 +63,14 @@ const Q = S({
63
63
  }), b = o(() => I(t.triggerProps || {}, ["class"]));
64
64
  return {
65
65
  menuPrefixCls: m,
66
- mode: c,
66
+ mode: f,
67
67
  level: a,
68
68
  classNames: M,
69
- isSelected: v,
69
+ isSelected: d,
70
70
  disabled: p,
71
- selectedKeys: f,
71
+ selectedKeys: v,
72
72
  needPopOnBottom: h,
73
- popVisible: d,
73
+ popVisible: g,
74
74
  className: y,
75
75
  triggerClassNames: k,
76
76
  triggerProps: b,
@@ -83,13 +83,13 @@ const Q = S({
83
83
  p.value || s._internalSkipCollect || (r && r(l.value, a.value), u.value && n && n(l.value));
84
84
  },
85
85
  onKeydown: (e) => {
86
- p.value || s._internalSkipCollect || (e.key === "Enter" || e.key === " ") && (e.preventDefault(), r && r(l.value, a.value), u.value && n && n(l.value));
86
+ p.value || s._internalSkipCollect || (e.key === "Enter" || e.key === " ") && (e.preventDefault(), r && r(l.value, a.value), c(!0), u.value && n && n(l.value));
87
87
  },
88
88
  onMenuItemClick: (e) => {
89
- n && n(e), g(!1);
89
+ n && n(e), c(!1);
90
90
  },
91
91
  onVisibleChange: (e) => {
92
- g(e);
92
+ c(e);
93
93
  }
94
94
  };
95
95
  }
@@ -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
  };