@pixelium/web-vue 0.0.1-beta → 0.0.2

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 (199) hide show
  1. package/README.md +21 -10
  2. package/README.zh.md +21 -10
  3. package/dist/icon-pa.d.ts +490 -0
  4. package/dist/index.d.ts +1586 -10
  5. package/dist/pixelium-vue-icon-pa.cjs +1 -0
  6. package/dist/pixelium-vue-icon-pa.css +1 -0
  7. package/dist/pixelium-vue-icon-pa.js +10143 -0
  8. package/dist/pixelium-vue-icon-pa.umd.cjs +1 -0
  9. package/dist/pixelium-vue.cjs +12 -1
  10. package/dist/pixelium-vue.css +1 -1
  11. package/dist/pixelium-vue.js +5368 -1093
  12. package/dist/pixelium-vue.umd.cjs +12 -1
  13. package/es/aside/css.js +1 -1
  14. package/es/aside/index.js +60 -13
  15. package/es/auto-complete/css.js +2 -0
  16. package/es/auto-complete/draw.d.ts +2 -0
  17. package/es/auto-complete/draw.js +52 -0
  18. package/es/auto-complete/index.css +123 -0
  19. package/es/auto-complete/index.d.ts +35 -0
  20. package/es/auto-complete/index.js +402 -0
  21. package/es/auto-complete/type.d.ts +192 -0
  22. package/es/button/css.js +1 -1
  23. package/es/button/draw.d.ts +1 -2
  24. package/es/button/draw.js +105 -123
  25. package/es/button/index.css +24 -14
  26. package/es/button/index.js +70 -121
  27. package/es/button-group/css.js +1 -1
  28. package/es/button-group/index.d.ts +0 -1
  29. package/es/button-group/index.js +11 -37
  30. package/es/button-group/type.d.ts +1 -1
  31. package/es/col/css.js +1 -1
  32. package/es/col/index.d.ts +2 -2
  33. package/es/container/css.js +1 -1
  34. package/es/divider/css.js +1 -1
  35. package/es/empty/css.js +2 -0
  36. package/es/empty/index.css +19 -0
  37. package/es/empty/index.d.ts +17 -0
  38. package/es/empty/index.js +73 -0
  39. package/es/empty/type.d.ts +19 -0
  40. package/es/footer/css.js +1 -1
  41. package/es/grid/css.js +1 -1
  42. package/es/grid/index.js +5 -1
  43. package/es/grid-item/css.js +1 -1
  44. package/es/grid-item/index.d.ts +1 -1
  45. package/es/grid-item/index.js +7 -3
  46. package/es/header/css.js +1 -1
  47. package/es/icon/css.js +1 -1
  48. package/es/icon/index.css +0 -3
  49. package/es/icon/index.js +1 -1
  50. package/es/icons/css-pa.js +2 -0
  51. package/es/icons/icon-hn.js +1 -1
  52. package/es/icons/icon-pa.css +9 -0
  53. package/es/icons/icon-pa.d.ts +490 -0
  54. package/es/icons/icon-pa.js +17449 -0
  55. package/es/index.css +22 -8
  56. package/es/index.d.ts +18 -1
  57. package/es/index.js +63 -2
  58. package/es/input/css.js +2 -0
  59. package/es/input/draw.d.ts +2 -0
  60. package/es/input/draw.js +52 -0
  61. package/es/input/index.css +138 -0
  62. package/es/input/index.d.ts +50 -0
  63. package/es/input/index.js +432 -0
  64. package/es/input/type.d.ts +175 -0
  65. package/es/input-group/css.js +2 -0
  66. package/es/input-group/index.css +24 -0
  67. package/es/input-group/index.d.ts +17 -0
  68. package/es/input-group/index.js +40 -0
  69. package/es/input-group/type.d.ts +30 -0
  70. package/es/input-group-label/css.js +2 -0
  71. package/es/input-group-label/draw.d.ts +2 -0
  72. package/es/input-group-label/draw.js +52 -0
  73. package/es/input-group-label/index.css +50 -0
  74. package/es/input-group-label/index.d.ts +16 -0
  75. package/es/input-group-label/index.js +129 -0
  76. package/es/input-group-label/type.d.ts +30 -0
  77. package/es/input-number/css.js +2 -0
  78. package/es/input-number/draw.d.ts +2 -0
  79. package/es/input-number/draw.js +52 -0
  80. package/es/input-number/index.css +161 -0
  81. package/es/input-number/index.d.ts +47 -0
  82. package/es/input-number/index.js +543 -0
  83. package/es/input-number/type.d.ts +183 -0
  84. package/es/input-tag/css.js +2 -0
  85. package/es/input-tag/draw.d.ts +2 -0
  86. package/es/input-tag/draw.js +49 -0
  87. package/es/input-tag/index.css +133 -0
  88. package/es/input-tag/index.d.ts +73 -0
  89. package/es/input-tag/index.js +474 -0
  90. package/es/input-tag/type.d.ts +212 -0
  91. package/es/link/css.js +1 -1
  92. package/es/link/index.css +2 -5
  93. package/es/link/index.js +10 -6
  94. package/es/main/css.js +1 -1
  95. package/es/mask/css.js +2 -0
  96. package/es/mask/index.css +17 -0
  97. package/es/mask/index.d.ts +8 -0
  98. package/es/mask/index.js +117 -0
  99. package/es/mask/type.d.ts +27 -0
  100. package/es/message/css.js +1 -1
  101. package/es/message/index.css +26 -26
  102. package/es/message/index.d.ts +1 -1
  103. package/es/message/index.js +22 -50
  104. package/es/message-box/css.js +1 -1
  105. package/es/message-box/index.js +40 -30
  106. package/es/message-box/message-box-wrapped.d.ts +0 -1
  107. package/es/message-box/message-box-wrapped.js +2 -2
  108. package/es/message-box/message-box.d.ts +2 -1
  109. package/es/message-box/message-box.js +10 -8
  110. package/es/message-box/type.d.ts +14 -4
  111. package/es/option-list/css.js +2 -0
  112. package/es/option-list/index.css +57 -0
  113. package/es/option-list/index.d.ts +38 -0
  114. package/es/option-list/index.js +169 -0
  115. package/es/option-list/type.d.ts +16 -0
  116. package/es/popover/css.js +1 -0
  117. package/es/popover/index.d.ts +203 -0
  118. package/es/popover/index.js +240 -0
  119. package/es/popover/type.d.ts +100 -0
  120. package/es/popup-content/css.js +2 -0
  121. package/es/popup-content/draw.d.ts +6 -0
  122. package/es/popup-content/draw.js +151 -0
  123. package/es/popup-content/index.css +99 -0
  124. package/es/popup-content/index.d.ts +30 -0
  125. package/es/popup-content/index.js +1578 -0
  126. package/es/popup-content/type.d.ts +20 -0
  127. package/es/popup-trigger/css.js +1 -0
  128. package/es/popup-trigger/index.d.ts +22 -0
  129. package/es/popup-trigger/index.js +97 -0
  130. package/es/popup-trigger/type.d.ts +9 -0
  131. package/es/row/css.js +1 -1
  132. package/es/select/css.js +2 -0
  133. package/es/select/draw.d.ts +2 -0
  134. package/es/select/draw.js +52 -0
  135. package/es/select/index.css +152 -0
  136. package/es/select/index.d.ts +44 -0
  137. package/es/select/index.js +674 -0
  138. package/es/select/type.d.ts +252 -0
  139. package/es/share/const/event-bus-key.d.ts +4 -0
  140. package/es/share/const/event-bus-key.js +10 -0
  141. package/es/share/const/index.d.ts +4 -0
  142. package/es/share/const/index.js +11 -2
  143. package/es/share/const/provide-key.d.ts +3 -0
  144. package/es/share/const/provide-key.js +8 -0
  145. package/es/share/hook/use-click-outside-listener.d.ts +4 -0
  146. package/es/share/hook/use-click-outside-listener.js +44 -0
  147. package/es/share/hook/use-composition.d.ts +5 -0
  148. package/es/share/hook/use-composition.js +17 -0
  149. package/es/share/hook/use-controlled-mode.d.ts +6 -0
  150. package/es/share/hook/use-controlled-mode.js +25 -0
  151. package/es/share/hook/use-dark-mode.js +11 -3
  152. package/es/share/hook/use-index-of-children.d.ts +2 -1
  153. package/es/share/hook/use-index-of-children.js +25 -35
  154. package/es/share/hook/use-resize-observer.js +1 -1
  155. package/es/share/hook/use-textarea-height.d.ts +5 -0
  156. package/es/share/hook/use-textarea-height.js +116 -0
  157. package/es/share/hook/use-watch-global-css-var.d.ts +1 -0
  158. package/es/share/hook/use-watch-global-css-var.js +19 -0
  159. package/es/share/hook/use-z-index.d.ts +6 -0
  160. package/es/share/hook/use-z-index.js +32 -0
  161. package/es/share/type/index.d.ts +9 -1
  162. package/es/share/util/color.js +4 -2
  163. package/es/share/util/common.d.ts +5 -0
  164. package/es/share/util/common.js +71 -0
  165. package/es/share/util/event-bus.d.ts +1 -0
  166. package/es/share/util/event-bus.js +20 -0
  167. package/es/share/util/plot.d.ts +15 -2
  168. package/es/share/util/plot.js +200 -30
  169. package/es/share/util/render.d.ts +1 -0
  170. package/es/share/util/render.js +10 -2
  171. package/es/share/util/theme.js +23 -4
  172. package/es/space/css.js +1 -1
  173. package/es/space/index.css +5 -0
  174. package/es/space/index.js +2 -2
  175. package/es/spin/css.js +2 -0
  176. package/es/spin/index.css +66 -0
  177. package/es/spin/index.d.ts +24 -0
  178. package/es/spin/index.js +104 -0
  179. package/es/spin/type.d.ts +54 -0
  180. package/es/tag/css.js +2 -0
  181. package/es/tag/draw.d.ts +6 -0
  182. package/es/tag/draw.js +135 -0
  183. package/es/tag/index.css +372 -0
  184. package/es/tag/index.d.ts +23 -0
  185. package/es/tag/index.js +193 -0
  186. package/es/tag/type.d.ts +58 -0
  187. package/es/textarea/css.js +2 -0
  188. package/es/textarea/draw.d.ts +2 -0
  189. package/es/textarea/draw.js +13 -0
  190. package/es/textarea/index.css +108 -0
  191. package/es/textarea/index.d.ts +49 -0
  192. package/es/textarea/index.js +267 -0
  193. package/es/textarea/type.d.ts +169 -0
  194. package/es/tooltip/css.js +1 -0
  195. package/es/tooltip/index.d.ts +20 -0
  196. package/es/tooltip/index.js +228 -0
  197. package/es/tooltip/type.d.ts +77 -0
  198. package/package.json +17 -3
  199. package/es/icons/{css.js → css-hn.js} +1 -1
@@ -0,0 +1,192 @@
1
+ import type { NumberOrPercentage } from '../share/type';
2
+ import type { GroupOption, Option } from '../share/type';
3
+ export interface AutoCompleteOption extends Option<string> {
4
+ value: string;
5
+ disabled?: boolean;
6
+ }
7
+ export interface AutoCompleteGroupOption extends GroupOption {
8
+ label: string;
9
+ key: string | number | symbol;
10
+ children: (AutoCompleteOption | string)[];
11
+ }
12
+ export type AutoCompleteProps = {
13
+ /**
14
+ * @property {string | null} [modelValue]
15
+ * @version 0.0.2
16
+ */
17
+ modelValue?: string | null;
18
+ /**
19
+ * @property {string | null} [defaultValue]
20
+ * @version 0.0.2
21
+ */
22
+ defaultValue?: string | null;
23
+ /**
24
+ * @property {string} [options]
25
+ * @version 0.0.2
26
+ */
27
+ options?: (string | AutoCompleteOption | AutoCompleteGroupOption)[];
28
+ /**
29
+ * @property {string} [placeholder]
30
+ * @version 0.0.2
31
+ */
32
+ placeholder?: string;
33
+ /**
34
+ * @property {boolean} [disabled=false]
35
+ * @version 0.0.2
36
+ */
37
+ disabled?: boolean;
38
+ /**
39
+ * @property {boolean} [readonly=false]
40
+ * @version 0.0.2
41
+ */
42
+ readonly?: boolean;
43
+ /**
44
+ * @property {boolean} [clearable=false]
45
+ * @version 0.0.2
46
+ */
47
+ clearable?: boolean;
48
+ /**
49
+ * @property {boolean} [loading=false]
50
+ * @version 0.0.2
51
+ */
52
+ loading?: boolean;
53
+ /**
54
+ * @property {boolean} [showPopoverEmpty=false]
55
+ * @version 0.0.2
56
+ */
57
+ showPopoverEmpty?: boolean;
58
+ /**
59
+ * @property {(value: string, optionsFiltered: (string | AutoCompleteOption | AutoCompleteGroupOption)[]) => boolean} [shouldShowPopover]
60
+ * @version 0.0.2
61
+ */
62
+ shouldShowPopover?: (value: string, optionsFiltered: (string | AutoCompleteOption | AutoCompleteGroupOption)[]) => boolean;
63
+ /**
64
+ * @property {(keyword: string, options: (string | AutoCompleteOption | AutoCompleteGroupOption)[]) => (string | AutoCompleteOption | AutoCompleteGroupOption)[]} [filter]
65
+ * @version 0.0.2
66
+ */
67
+ filter?: (keyword: string, options: (string | AutoCompleteOption | AutoCompleteGroupOption)[]) => (string | AutoCompleteOption | AutoCompleteGroupOption)[];
68
+ /**
69
+ * @property {boolean} [append=false]
70
+ * @version 0.0.2
71
+ */
72
+ append?: boolean;
73
+ /**
74
+ * @property {'medium' | 'large' | 'small'} [size='medium']
75
+ * @version 0.0.2
76
+ */
77
+ size?: 'medium' | 'large' | 'small';
78
+ /**
79
+ * @property {'default' | 'round'} [shape='default']
80
+ * @version 0.0.2
81
+ */
82
+ shape?: 'default' | 'round';
83
+ /**
84
+ * @property {NumberOrPercentage | NumberOrPercentage[]} [borderRadius]
85
+ * @version 0.0.2
86
+ */
87
+ borderRadius?: NumberOrPercentage | NumberOrPercentage[];
88
+ /**
89
+ * @property {'success' | 'warning' | 'error' | 'normal'} [status='normal']
90
+ * @version 0.0.2
91
+ */
92
+ status?: 'success' | 'warning' | 'error' | 'normal';
93
+ /**
94
+ * @property {boolean} [autofocus=false]
95
+ * @version 0.0.2
96
+ */
97
+ autofocus?: boolean;
98
+ };
99
+ export type AutoCompleteEvents = {
100
+ /**
101
+ * @event input
102
+ * @param {string} value
103
+ * @param {Event} e
104
+ * @version 0.0.2
105
+ */
106
+ input: [value: string, e: Event];
107
+ /**
108
+ * @event update:modelValue
109
+ * @param {string} value
110
+ * @version 0.0.2
111
+ */
112
+ 'update:modelValue': [value: string];
113
+ /**
114
+ * @event change
115
+ * @param {string} value
116
+ * @param {Event | undefined} e
117
+ * @version 0.0.2
118
+ */
119
+ change: [value: string, e?: Event];
120
+ /**
121
+ * @event clear
122
+ * @param {string} value
123
+ * @version 0.0.2
124
+ */
125
+ clear: [value: string];
126
+ /**
127
+ * @event blur
128
+ * @param {FocusEvent} e
129
+ * @version 0.0.2
130
+ */
131
+ blur: [e: FocusEvent];
132
+ /**
133
+ * @event focus
134
+ * @param {FocusEvent} e
135
+ * @version 0.0.2
136
+ */
137
+ focus: [e: FocusEvent];
138
+ /**
139
+ * @event select
140
+ * @param {string} value
141
+ * @param {string | AutoCompleteOption} option
142
+ * @param {MouseEvent} e
143
+ * @version 0.0.2
144
+ */
145
+ select: [value: string, option: string | AutoCompleteOption, e: MouseEvent];
146
+ };
147
+ export type AutoCompleteSlots = {
148
+ /**
149
+ * @slot prefix
150
+ * @version 0.0.2
151
+ */
152
+ prefix: {};
153
+ /**
154
+ * @slot suffix
155
+ * @version 0.0.2
156
+ */
157
+ suffix: {};
158
+ /**
159
+ * @slot option
160
+ * @param {string | AutoCompleteOption} option
161
+ * @version 0.0.2
162
+ */
163
+ option: {};
164
+ /**
165
+ * @slot group-label
166
+ * @param {AutoCompleteGroupOption} option
167
+ * @version 0.0.2
168
+ */
169
+ 'group-label': {};
170
+ };
171
+ export type AutoCompleteExpose = {
172
+ /**
173
+ * @property {() => void} focus
174
+ * @version 0.0.2
175
+ */
176
+ focus: () => void;
177
+ /**
178
+ * @property {() => void} blur
179
+ * @version 0.0.2
180
+ */
181
+ blur: () => void;
182
+ /**
183
+ * @property {() => void} clear
184
+ * @version 0.0.2
185
+ */
186
+ clear: () => void;
187
+ /**
188
+ * @property {() => void} select
189
+ * @version 0.0.2
190
+ */
191
+ select: () => void;
192
+ };
package/es/button/css.js CHANGED
@@ -1,2 +1,2 @@
1
- import './index.css'
2
1
  import '../index.css'
2
+ import './index.css'
@@ -4,6 +4,5 @@ export declare function getBackgroundColor(disabled: boolean, loading: boolean,
4
4
  export declare function getBorderColor(disabled: boolean, loading: boolean, type: ButtonProps['variant'], theme: ButtonProps['theme'], palette: RgbaColor[] | null, hoverFlag: boolean, activeFlag: boolean): RgbaColor;
5
5
  export declare const drawBorder: (ctx: CanvasRenderingContext2D, width: number, height: number, center: [number, number][], borderRadius: number[], rad: [number, number][], borderColor: RgbaColor, pixelSize: number, type: ButtonProps["variant"], inner: boolean, first: boolean, last: boolean) => void;
6
6
  export declare function getGradientColor(disabled: boolean, loading: boolean, theme: ButtonProps['theme'], palette: RgbaColor[] | null, hoverFlag: boolean, activeFlag: boolean): RgbaColor;
7
- export declare const drawGradient: (ctx: CanvasRenderingContext2D, width: number, height: number, center: [number, number][], borderRadius: number[], rad: [number, number][], pixelSize: number, disabled: boolean, loading: boolean, type: ButtonProps["variant"], theme: ButtonProps["theme"], palette: RgbaColor[] | null, inner: boolean, first: boolean, last: boolean, hoverFlag: boolean, activeFlag: boolean) => void;
8
- export declare const getBorderRadius: (canvas: HTMLCanvasElement, pixelSize: number, borderRadius: ButtonProps["borderRadius"], shape: ButtonProps["shape"], inner: boolean, first: boolean, last: boolean) => number[];
7
+ export declare const drawGradient: (ctx: CanvasRenderingContext2D, width: number, height: number, center: [number, number][], borderRadius: number[], rad: [number, number][], pixelSize: number, disabled: boolean, loading: boolean, theme: ButtonProps["theme"], palette: RgbaColor[] | null, inner: boolean, first: boolean, last: boolean, hoverFlag: boolean, activeFlag: boolean) => void;
9
8
  export declare const getTextColorWithPalette: (palette: RgbaColor[] | null, type: ButtonProps["variant"], disabled: boolean, loading: boolean, hoverFlag: boolean, activeFlag: boolean) => string | undefined;
package/es/button/draw.js CHANGED
@@ -1,7 +1,6 @@
1
- import { $, k } from "../aside/index.js";
2
1
  import { T as TRANSPARENT_RGBA_COLOR_OBJECT } from "../share/const/index.js";
3
2
  import { r as rgbaColor2string, g as getGlobalThemeColor } from "../share/util/color.js";
4
- import { d as drawCircle } from "../share/util/plot.js";
3
+ import { e as calcWhenLeaveBaseline, d as drawCircle } from "../share/util/plot.js";
5
4
  function getBackgroundColor(disabled, loading, type, theme = "primary", palette, hoverFlag, activeFlag) {
6
5
  if (palette) {
7
6
  switch (type) {
@@ -79,7 +78,7 @@ function getBorderColor(disabled, loading, type, theme = "primary", palette, hov
79
78
  if (hoverFlag && !loading) return palette[2];
80
79
  return palette[1];
81
80
  case "outline":
82
- if (disabled) return palette[1];
81
+ if (disabled) return palette[0];
83
82
  if (activeFlag) return palette[6];
84
83
  if (hoverFlag && !loading) return palette[4];
85
84
  return palette[5];
@@ -128,11 +127,19 @@ function getBorderColor(disabled, loading, type, theme = "primary", palette, hov
128
127
  }
129
128
  }
130
129
  const drawBorder = (ctx, width, height, center, borderRadius, rad, borderColor, pixelSize, type, inner, first, last) => {
131
- ctx.fillStyle = `rgba(${borderColor.r}, ${borderColor.g}, ${borderColor.b}, ${borderColor.a / 255})`;
130
+ ctx.fillStyle = rgbaColor2string(borderColor);
132
131
  for (let i = 0; i < 4; i++) {
133
132
  if (borderRadius[i] > pixelSize) {
134
133
  if (i === 1 || i === 2 ? inner && (last || type === "text") || !inner : true) {
135
- drawCircle(ctx, center[i][0], center[i][1], borderRadius[i], rad[i][0], rad[i][1], pixelSize);
134
+ drawCircle(
135
+ ctx,
136
+ center[i][0],
137
+ center[i][1],
138
+ borderRadius[i],
139
+ rad[i][0],
140
+ rad[i][1],
141
+ pixelSize
142
+ );
136
143
  }
137
144
  }
138
145
  }
@@ -140,10 +147,20 @@ const drawBorder = (ctx, width, height, center, borderRadius, rad, borderColor,
140
147
  ctx.fillRect(center[0][0], 0, center[1][0] - center[0][0] + pixelSize, pixelSize);
141
148
  }
142
149
  if (center[2][1] + pixelSize > center[1][1] && (inner && (last || type === "text") || !inner)) {
143
- ctx.fillRect(width - pixelSize, center[1][1], pixelSize, center[2][1] - center[1][1] + pixelSize);
150
+ ctx.fillRect(
151
+ width - pixelSize,
152
+ center[1][1],
153
+ pixelSize,
154
+ center[2][1] - center[1][1] + pixelSize
155
+ );
144
156
  }
145
157
  if (center[3][0] < center[2][0] + pixelSize) {
146
- ctx.fillRect(center[3][0], height - pixelSize, center[2][0] - center[3][0] + pixelSize, pixelSize);
158
+ ctx.fillRect(
159
+ center[3][0],
160
+ height - pixelSize,
161
+ center[2][0] - center[3][0] + pixelSize,
162
+ pixelSize
163
+ );
147
164
  }
148
165
  const flag = inner && !first && type !== "text";
149
166
  if (!flag && center[3][1] + pixelSize > center[0][1]) {
@@ -174,129 +191,95 @@ function getGradientColor(disabled, loading, theme = "primary", palette, hoverFl
174
191
  if (hoverFlag && !loading) return getGlobalThemeColor("neutral", 4);
175
192
  return getGlobalThemeColor("neutral", 3);
176
193
  }
177
- function calcDx(pixelSize, borderRadius) {
178
- return Math.ceil((-6 + Math.sqrt(36 - 48 * pixelSize + 32 * pixelSize * borderRadius)) / (8 * pixelSize)) * pixelSize;
179
- }
180
- const drawGradient = (ctx, width, height, center, borderRadius, rad, pixelSize, disabled, loading, type, theme = "primary", palette, inner, first, last, hoverFlag, activeFlag) => {
181
- const dxBottomRight = calcDx(pixelSize, borderRadius[2]);
182
- const dxBottomLeft = calcDx(pixelSize, borderRadius[3]);
183
- const dxTopRight = calcDx(pixelSize, borderRadius[1]);
184
- const dxTopLeft = calcDx(pixelSize, borderRadius[0]);
185
- const innerFlag = +!(inner && !first && type !== "text");
194
+ const drawGradient = (ctx, width, height, center, borderRadius, rad, pixelSize, disabled, loading, theme = "primary", palette, inner, first, last, hoverFlag, activeFlag) => {
195
+ const dxBottomRight = calcWhenLeaveBaseline(pixelSize, borderRadius[2]);
196
+ const dxBottomLeft = calcWhenLeaveBaseline(pixelSize, borderRadius[3]);
197
+ const dxTopRight = calcWhenLeaveBaseline(pixelSize, borderRadius[1]);
198
+ const dxTopLeft = calcWhenLeaveBaseline(pixelSize, borderRadius[0]);
199
+ const innerFlag = +!(inner && !first);
200
+ const innerAndLastOrNotInner = +!inner || inner && last;
186
201
  if (!activeFlag || disabled) {
187
202
  const barColor = getGradientColor(disabled, loading, theme, palette, hoverFlag, activeFlag);
188
- ctx.fillStyle = `rgba(${barColor.r}, ${barColor.g}, ${barColor.b}, ${barColor.a / 255})`;
189
- for (let i = 1; i < 3; i++) {
190
- borderRadius[i] > pixelSize && drawCircle(ctx, center[i][0] - pixelSize, center[i][1], borderRadius[i], rad[i][0], rad[i][1], pixelSize);
203
+ ctx.fillStyle = rgbaColor2string(barColor);
204
+ if (borderRadius[1] > pixelSize) {
205
+ drawCircle(
206
+ ctx,
207
+ center[1][0] - pixelSize,
208
+ center[1][1],
209
+ borderRadius[1],
210
+ rad[1][0],
211
+ rad[1][1],
212
+ pixelSize
213
+ );
214
+ ctx.globalCompositeOperation = "destination-out";
215
+ ctx.fillRect(center[1][0] - pixelSize, 0, dxTopLeft, pixelSize);
216
+ ctx.globalCompositeOperation = "source-over";
217
+ }
218
+ if (borderRadius[2] > pixelSize) {
219
+ drawCircle(
220
+ ctx,
221
+ center[2][0] - pixelSize,
222
+ center[2][1],
223
+ borderRadius[2],
224
+ rad[2][0],
225
+ rad[2][1],
226
+ pixelSize
227
+ );
228
+ ctx.globalCompositeOperation = "destination-out";
229
+ ctx.fillRect(center[2][0] - pixelSize, height - pixelSize, dxBottomLeft, pixelSize);
230
+ ctx.globalCompositeOperation = "source-over";
191
231
  }
192
- const barLenX = center[2][0] + pixelSize - center[3][0] + dxBottomLeft * innerFlag + dxBottomRight;
193
- barLenX > 0 && ctx.fillRect(center[3][0] - dxBottomLeft * innerFlag, height - pixelSize * 2, barLenX, pixelSize);
232
+ const barLenX = center[2][0] + pixelSize - center[3][0] + dxBottomLeft * innerFlag + dxBottomRight * +innerAndLastOrNotInner - 1 * +!innerAndLastOrNotInner;
233
+ barLenX > 0 && ctx.fillRect(
234
+ center[3][0] - dxBottomLeft * innerFlag,
235
+ height - pixelSize * 2,
236
+ barLenX,
237
+ pixelSize
238
+ );
194
239
  const barLenY = center[2][1] + pixelSize - center[1][1] + dxTopRight + dxBottomRight;
195
- barLenY > 0 && ctx.fillRect(width - pixelSize * 2 - (!last ? +inner * pixelSize * 1 : 0), center[1][1] - dxTopRight, pixelSize, barLenY);
240
+ barLenY > 0 && ctx.fillRect(
241
+ width - pixelSize * 2 - (!last ? +inner * pixelSize * 1 : 0),
242
+ center[1][1] - dxTopRight,
243
+ pixelSize,
244
+ barLenY
245
+ );
196
246
  } else {
197
247
  const barColor = getGradientColor(disabled, loading, theme, palette, hoverFlag, activeFlag);
198
- ctx.fillStyle = `rgba(${barColor.r}, ${barColor.g}, ${barColor.b}, ${barColor.a / 255})`;
199
- borderRadius[0] > pixelSize && drawCircle(ctx, center[0][0] + pixelSize, center[0][1], borderRadius[0], rad[0][0], rad[0][1], pixelSize);
200
- borderRadius[3] > pixelSize && drawCircle(ctx, center[3][0] + pixelSize, center[3][1], borderRadius[3], rad[3][0], rad[3][1], pixelSize);
201
- const barLenX = center[1][0] + pixelSize - center[0][0] + dxTopRight + dxTopLeft * innerFlag;
248
+ ctx.fillStyle = rgbaColor2string(barColor);
249
+ if (borderRadius[0] > pixelSize) {
250
+ drawCircle(
251
+ ctx,
252
+ center[0][0] + pixelSize,
253
+ center[0][1],
254
+ borderRadius[0],
255
+ rad[0][0],
256
+ rad[0][1],
257
+ pixelSize
258
+ );
259
+ ctx.globalCompositeOperation = "destination-out";
260
+ ctx.fillRect(center[0][0] + pixelSize, 0, dxTopRight, pixelSize);
261
+ ctx.globalCompositeOperation = "source-over";
262
+ }
263
+ if (borderRadius[3] > pixelSize) {
264
+ drawCircle(
265
+ ctx,
266
+ center[3][0] + pixelSize,
267
+ center[3][1],
268
+ borderRadius[3],
269
+ rad[3][0],
270
+ rad[3][1],
271
+ pixelSize
272
+ );
273
+ ctx.globalCompositeOperation = "destination-out";
274
+ ctx.fillRect(center[3][0] + pixelSize, height - pixelSize, dxBottomRight, pixelSize);
275
+ ctx.globalCompositeOperation = "source-over";
276
+ }
277
+ const barLenX = center[1][0] + pixelSize - center[0][0] + dxTopRight * +innerAndLastOrNotInner + dxTopLeft * innerFlag - 1 * +!innerAndLastOrNotInner;
202
278
  barLenX > 0 && ctx.fillRect(center[0][0] - dxTopLeft * innerFlag, pixelSize, barLenX, pixelSize);
203
279
  const barLenY = pixelSize + center[3][1] - center[0][1] + dxBottomLeft + dxTopLeft;
204
280
  barLenY > 0 && ctx.fillRect(pixelSize, center[0][1] - dxTopLeft, pixelSize, barLenY);
205
281
  }
206
282
  };
207
- const transformSizeValue = (canvas, value, pixelSize) => {
208
- if (k(value)) {
209
- return Math.max(value, pixelSize);
210
- } else {
211
- return Math.max(canvas.height * parseFloat(value) / 100, pixelSize);
212
- }
213
- };
214
- const fillArr = (val) => Array(4).fill(val);
215
- const getRadiusFromValue = (canvas, value, pixelSize) => {
216
- if (!value) return fillArr(pixelSize);
217
- if (!$(value)) {
218
- return fillArr(transformSizeValue(canvas, value, pixelSize));
219
- }
220
- switch (value.length) {
221
- case 1:
222
- return fillArr(transformSizeValue(canvas, value[0], pixelSize));
223
- case 2: {
224
- const tl = transformSizeValue(canvas, value[0], pixelSize);
225
- const tr = transformSizeValue(canvas, value[1], pixelSize);
226
- return [tl, tr, tl, tr];
227
- }
228
- case 3: {
229
- const tl = transformSizeValue(canvas, value[0], pixelSize);
230
- const br = transformSizeValue(canvas, value[2], pixelSize);
231
- const rest = transformSizeValue(canvas, value[1], pixelSize);
232
- return [tl, rest, br, rest];
233
- }
234
- default:
235
- return value.map((e) => transformSizeValue(canvas, e, pixelSize));
236
- }
237
- };
238
- const getInnerRadius = (canvas, value, pixelSize, first, last) => {
239
- if (!value) return fillArr(pixelSize);
240
- if (!$(value)) {
241
- const v = transformSizeValue(canvas, value, pixelSize);
242
- if (last) return [pixelSize, v, v, pixelSize];
243
- if (first) return [v, pixelSize, pixelSize, v];
244
- return fillArr(pixelSize);
245
- }
246
- switch (value.length) {
247
- case 1:
248
- const v = transformSizeValue(canvas, value[0], pixelSize);
249
- if (last) return [pixelSize, v, v, pixelSize];
250
- if (first) return [v, pixelSize, pixelSize, v];
251
- return fillArr(pixelSize);
252
- case 2: {
253
- const tl = transformSizeValue(canvas, value[0], pixelSize);
254
- const tr = transformSizeValue(canvas, value[1], pixelSize);
255
- if (last) return [pixelSize, tr, tr, pixelSize];
256
- if (first) return [tl, pixelSize, pixelSize, tl];
257
- return fillArr(pixelSize);
258
- }
259
- case 3: {
260
- const tl = transformSizeValue(canvas, value[0], pixelSize);
261
- const br = transformSizeValue(canvas, value[2], pixelSize);
262
- const rest = transformSizeValue(canvas, value[1], pixelSize);
263
- if (last) return [pixelSize, rest, br, pixelSize];
264
- if (first) return [tl, pixelSize, pixelSize, rest];
265
- return fillArr(pixelSize);
266
- }
267
- default:
268
- if (last) return [pixelSize, transformSizeValue(canvas, value[1], pixelSize), transformSizeValue(canvas, value[2], pixelSize), pixelSize];
269
- if (first) return [transformSizeValue(canvas, value[0], pixelSize), pixelSize, pixelSize, transformSizeValue(canvas, value[3], pixelSize)];
270
- return fillArr(pixelSize);
271
- }
272
- };
273
- const getBorderRadius = (canvas, pixelSize, borderRadius, shape, inner, first, last) => {
274
- if (!inner) {
275
- if (borderRadius) {
276
- return getRadiusFromValue(canvas, borderRadius, pixelSize);
277
- }
278
- switch (shape) {
279
- case "round":
280
- case "circle":
281
- return fillArr(transformSizeValue(canvas, "50%", pixelSize));
282
- default:
283
- return fillArr(pixelSize);
284
- }
285
- } else {
286
- if (borderRadius) {
287
- return getInnerRadius(canvas, borderRadius, pixelSize, first, last);
288
- }
289
- switch (shape) {
290
- case "round":
291
- const roundArr = fillArr(transformSizeValue(canvas, "50%", pixelSize));
292
- if (last) return roundArr.map((e, i) => i < 1 || i > 2 ? pixelSize : e);
293
- if (first) return roundArr.map((e, i) => i > 0 && i < 3 ? pixelSize : e);
294
- return fillArr(pixelSize);
295
- default:
296
- return fillArr(pixelSize);
297
- }
298
- }
299
- };
300
283
  const getTextColorWithPalette = (palette, type, disabled, loading, hoverFlag, activeFlag) => {
301
284
  if (!palette || type === "primary") return void 0;
302
285
  if (disabled) {
@@ -317,10 +300,9 @@ const getTextColorWithPalette = (palette, type, disabled, loading, hoverFlag, ac
317
300
  }
318
301
  };
319
302
  export {
320
- getBorderRadius as a,
321
- getBorderColor as b,
322
- drawBorder as c,
303
+ getBorderColor as a,
304
+ drawBorder as b,
305
+ getBackgroundColor as c,
323
306
  drawGradient as d,
324
- getBackgroundColor as e,
325
307
  getTextColorWithPalette as g
326
308
  };
@@ -6,16 +6,24 @@
6
6
  z-index: -1;
7
7
  pointer-events: none;
8
8
  }
9
+ button.px-button {
10
+ font-size: var(--text-size);
11
+ }
9
12
  .px-button {
10
13
  --button-size: var(--px-medium-size);
11
- --padding-x-size: 16px;
14
+ --px-medium-padding-x: var(--px-interval-4);
15
+ --px-large-padding-x: var(--px-interval-5);
16
+ --px-small-padding-x: var(--px-interval-3);
17
+ --padding-x-size: var(--px-medium-padding-x);
12
18
  --text-color: var(--px-neutral-1);
19
+ --text-size: var(--px-medium-font-size);
13
20
  height: var(--button-size);
14
21
  padding-left: var(--padding-x-size);
15
22
  padding-right: var(--padding-x-size);
16
23
  background-color: transparent;
17
24
  border-color: transparent;
18
25
  border-width: var(--px-bit);
26
+ border-style: solid;
19
27
  display: inline-flex;
20
28
  align-items: center;
21
29
  position: relative;
@@ -24,18 +32,21 @@
24
32
  user-select: none;
25
33
  transition: 0.25s;
26
34
  z-index: 0;
35
+ font-size: var(--text-size);
36
+ box-sizing: border-box;
27
37
  }
28
38
  .px-button__inner {
39
+ transition: color 0.25s;
29
40
  padding-right: calc(var(--padding-x-size) + 1px + 1 * var(--px-bit));
30
41
  }
31
- .px-button__inner:last-of-type {
42
+ .px-button__inner:last-child {
32
43
  padding-right: var(--padding-x-size);
33
44
  }
34
45
  .px-button__inner.px-button__text {
35
46
  padding-right: var(--padding-x-size);
36
47
  margin-right: calc(1px + 1 * var(--px-bit));
37
48
  }
38
- .px-button__inner.px-button__text:last-of-type {
49
+ .px-button__inner.px-button__text:last-child {
39
50
  margin-right: 0;
40
51
  }
41
52
  .px-button__circle,
@@ -45,12 +56,14 @@
45
56
  justify-content: center;
46
57
  }
47
58
  .px-button__large {
48
- --padding-x-size: 24px;
59
+ --padding-x-size: var(--px-large-padding-x);
49
60
  --button-size: var(--px-large-size);
61
+ --text-size: var(--px-large-font-size);
50
62
  }
51
63
  .px-button__small {
52
- --padding-x-size: 12px;
64
+ --padding-x-size: var(--px-small-padding-x);
53
65
  --button-size: var(--px-small-size);
66
+ --text-size: var(--px-small-font-size);
54
67
  }
55
68
  .px-button__loading {
56
69
  cursor: auto;
@@ -64,7 +77,7 @@
64
77
  cursor: not-allowed;
65
78
  }
66
79
  .px-button-icon-wrapper {
67
- margin-right: 8px;
80
+ margin-right: var(--px-interval-2);
68
81
  display: flex;
69
82
  align-items: center;
70
83
  }
@@ -72,13 +85,10 @@
72
85
  margin-right: 0;
73
86
  }
74
87
  .px-button-icon {
75
- height: 14px;
76
- width: 14px;
88
+ height: var(--text-size);
89
+ width: var(--text-size);
77
90
  fill: var(--text-color);
78
91
  }
79
- .px-button-icon__loading {
80
- animation: px-icon-spin 1s linear infinite;
81
- }
82
92
  .px-button.px-button__primary:focus-visible {
83
93
  outline-color: var(--px-primary-6);
84
94
  outline-offset: var(--px-bit);
@@ -337,7 +347,7 @@
337
347
  outline-offset: var(--px-bit);
338
348
  }
339
349
  .px-button.px-button__info.px-button__disabled {
340
- --text-color: var(--px-neutral-6);
350
+ --text-color: var(--px-neutral-7);
341
351
  }
342
352
  .px-button.px-button__info.px-button__text,
343
353
  .px-button.px-button__info.px-button__plain,
@@ -347,7 +357,7 @@
347
357
  .px-button.px-button__info.px-button__text.px-button__disabled,
348
358
  .px-button.px-button__info.px-button__plain.px-button__disabled,
349
359
  .px-button.px-button__info.px-button__outline.px-button__disabled {
350
- --text-color: var(--px-neutral-6);
360
+ --text-color: var(--px-neutral-7);
351
361
  }
352
362
  .px-button.px-button__info.px-button__text:active.px-button__disabled,
353
363
  .px-button.px-button__info.px-button__plain:active.px-button__disabled,
@@ -355,7 +365,7 @@
355
365
  .px-button.px-button__info.px-button__text:hover.px-button__disabled,
356
366
  .px-button.px-button__info.px-button__plain:hover.px-button__disabled,
357
367
  .px-button.px-button__info.px-button__outline:hover.px-button__disabled {
358
- --text-color: var(--px-neutral-6);
368
+ --text-color: var(--px-neutral-7);
359
369
  }
360
370
  .px-button.px-button__info.px-button__text:active.px-button__loading,
361
371
  .px-button.px-button__info.px-button__plain:active.px-button__loading,