@pixelium/web-vue 0.0.1-beta → 0.0.2-fix

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 +5370 -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 +677 -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
package/es/link/index.css CHANGED
@@ -18,9 +18,6 @@
18
18
  width: 14px;
19
19
  fill: var(--text-color);
20
20
  }
21
- .px-link-icon__loading {
22
- animation: px-icon-spin 1s linear infinite;
23
- }
24
21
  .px-link__loading {
25
22
  cursor: auto;
26
23
  }
@@ -169,8 +166,8 @@
169
166
  --text-color: var(--px-neutral-10);
170
167
  }
171
168
  .px-link.px-link__info:hover {
172
- --text-color: var(--px-neutral-7);
169
+ --text-color: var(--px-neutral-8);
173
170
  }
174
171
  .px-link.px-link__info:active {
175
- --text-color: var(--px-neutral-8);
172
+ --text-color: var(--px-neutral-9);
176
173
  }
package/es/link/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import './css.js'
2
2
  import { defineComponent, useSlots, computed, ref, createElementBlock, openBlock, normalizeStyle, normalizeClass, createCommentVNode, renderSlot, unref, createBlock } from "vue";
3
3
  import { p as parseColor, a as generatePalette, r as rgbaColor2string } from "../share/util/color.js";
4
- import { S as SpinnerThirdSolid } from "../button/index.js";
4
+ import { S as SpinnerThirdSolid } from "../auto-complete/index.js";
5
5
  import { u as useDarkMode } from "../share/hook/use-dark-mode.js";
6
6
  const _hoisted_1 = ["href", "target"];
7
7
  const _sfc_main = /* @__PURE__ */ defineComponent({
@@ -46,7 +46,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
46
46
  return rgbaColor2string(palette2[5]);
47
47
  };
48
48
  const textColor = computed(() => {
49
- return getTextColorWithPalette(palette.value, props.disabled, props.loading, hoverFlag.value, activeFlag.value);
49
+ return getTextColorWithPalette(
50
+ palette.value,
51
+ props.disabled,
52
+ props.loading,
53
+ hoverFlag.value,
54
+ activeFlag.value
55
+ );
50
56
  });
51
57
  const clickHandler = (e) => {
52
58
  if (props.disabled || props.loading) {
@@ -83,13 +89,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
83
89
  [
84
90
  props.loading ? (openBlock(), createBlock(unref(SpinnerThirdSolid), {
85
91
  key: 0,
86
- class: normalizeClass(["px-link-icon", {
87
- "px-link-icon__loading": props.loading
88
- }]),
92
+ class: "px-link-icon px-animation__loading",
89
93
  style: normalizeStyle({
90
94
  fill: textColor.value
91
95
  })
92
- }, null, 8, ["class", "style"])) : renderSlot(_ctx.$slots, "icon", { key: 1 })
96
+ }, null, 8, ["style"])) : renderSlot(_ctx.$slots, "icon", { key: 1 })
93
97
  ],
94
98
  2
95
99
  /* CLASS */
package/es/main/css.js CHANGED
@@ -1,2 +1,2 @@
1
- import './index.css'
2
1
  import '../index.css'
2
+ import './index.css'
package/es/mask/css.js ADDED
@@ -0,0 +1,2 @@
1
+ import '../index.css'
2
+ import './index.css'
@@ -0,0 +1,17 @@
1
+ .px-mask {
2
+ width: 100%;
3
+ height: 100%;
4
+ position: absolute;
5
+ border-width: 0;
6
+ top: 0;
7
+ left: 0;
8
+ bottom: 0;
9
+ right: 0;
10
+ }
11
+ .px-mask-canvas {
12
+ position: absolute;
13
+ top: 0;
14
+ left: 0;
15
+ bottom: 0;
16
+ right: 0;
17
+ }
@@ -0,0 +1,8 @@
1
+ import type { MaskProps } from './type';
2
+ declare const _default: import("vue").DefineComponent<MaskProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MaskProps> & Readonly<{}>, {
3
+ zIndex: number;
4
+ step: number;
5
+ grid: boolean;
6
+ lineWidth: number;
7
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
8
+ export default _default;
@@ -0,0 +1,117 @@
1
+ import './css.js'
2
+ import { defineComponent, shallowRef, ref, onMounted, nextTick, watch, createElementBlock, openBlock, normalizeStyle, createCommentVNode } from "vue";
3
+ import { u as useResizeObserver } from "../share/hook/use-resize-observer.js";
4
+ import { a as canvasPreprocess } from "../share/util/plot.js";
5
+ import { u as useWatchGlobalCssVal } from "../share/hook/use-watch-global-css-var.js";
6
+ import { g as getGlobalThemeColor, r as rgbaColor2string } from "../share/util/color.js";
7
+ import { C as COVER_Z_INDEX } from "../share/const/index.js";
8
+ import { u as useDarkMode } from "../share/hook/use-dark-mode.js";
9
+ const _sfc_main = /* @__PURE__ */ defineComponent({
10
+ ...{
11
+ name: "Mask"
12
+ },
13
+ __name: "index",
14
+ props: {
15
+ color: null,
16
+ step: { default: 1 },
17
+ lineWidth: { default: 2 },
18
+ grid: { type: Boolean, default: true },
19
+ zIndex: { default: COVER_Z_INDEX }
20
+ },
21
+ setup(__props) {
22
+ const darkMode = useDarkMode();
23
+ const props = __props;
24
+ const canvasRef = shallowRef(null);
25
+ const wrapperRef = shallowRef(null);
26
+ const calcDefaultBackgroundColor = () => {
27
+ const color = getGlobalThemeColor("neutral", 8);
28
+ color.a = Math.floor(255 * 0.5);
29
+ return rgbaColor2string(color);
30
+ };
31
+ const defaultBackgroundColor = ref(calcDefaultBackgroundColor());
32
+ const drawGrid = () => {
33
+ if (!props.grid) {
34
+ return;
35
+ }
36
+ const preprocessData = canvasPreprocess(wrapperRef, canvasRef);
37
+ if (!preprocessData) {
38
+ return;
39
+ }
40
+ const { ctx, width, height } = preprocessData;
41
+ const lineWidth = props.lineWidth;
42
+ ctx.clearRect(0, 0, width, height);
43
+ ctx.strokeStyle = props.color || defaultBackgroundColor.value;
44
+ ctx.lineWidth = lineWidth;
45
+ const step = Math.max(1, props.step);
46
+ for (let x = 0; x <= width; x += step + lineWidth) {
47
+ ctx.beginPath();
48
+ ctx.moveTo(x, 0);
49
+ ctx.lineTo(x, height);
50
+ ctx.stroke();
51
+ }
52
+ for (let y = 0; y <= height; y += step + lineWidth) {
53
+ ctx.beginPath();
54
+ ctx.moveTo(0, y);
55
+ ctx.lineTo(width, y);
56
+ ctx.stroke();
57
+ }
58
+ };
59
+ onMounted(() => {
60
+ nextTick(() => {
61
+ drawGrid();
62
+ });
63
+ });
64
+ useResizeObserver(wrapperRef, drawGrid);
65
+ useWatchGlobalCssVal(() => {
66
+ drawGrid();
67
+ defaultBackgroundColor.value = calcDefaultBackgroundColor();
68
+ });
69
+ watch(
70
+ [
71
+ darkMode,
72
+ defaultBackgroundColor,
73
+ () => props.grid,
74
+ () => props.color,
75
+ () => props.step,
76
+ () => props.lineWidth
77
+ ],
78
+ () => {
79
+ defaultBackgroundColor.value = calcDefaultBackgroundColor();
80
+ drawGrid();
81
+ }
82
+ );
83
+ return (_ctx, _cache) => {
84
+ return openBlock(), createElementBlock(
85
+ "div",
86
+ {
87
+ class: "pixelium px-mask",
88
+ style: normalizeStyle({
89
+ zIndex: props.zIndex,
90
+ backgroundColor: !props.grid ? props.color || defaultBackgroundColor.value : void 0
91
+ }),
92
+ ref_key: "wrapperRef",
93
+ ref: wrapperRef
94
+ },
95
+ [
96
+ props.grid ? (openBlock(), createElementBlock(
97
+ "canvas",
98
+ {
99
+ key: 0,
100
+ ref_key: "canvasRef",
101
+ ref: canvasRef,
102
+ class: "px-mask-canvas"
103
+ },
104
+ null,
105
+ 512
106
+ /* NEED_PATCH */
107
+ )) : createCommentVNode("v-if", true)
108
+ ],
109
+ 4
110
+ /* STYLE */
111
+ );
112
+ };
113
+ }
114
+ });
115
+ export {
116
+ _sfc_main as _
117
+ };
@@ -0,0 +1,27 @@
1
+ export type MaskProps = {
2
+ /**
3
+ * @property {string} [color]
4
+ * @version 0.0.2
5
+ */
6
+ color?: string;
7
+ /**
8
+ * @property {number} [step=1]
9
+ * @version 0.0.2
10
+ */
11
+ step?: number;
12
+ /**
13
+ * @property {number} [lineWidth=2]
14
+ * @version 0.0.2
15
+ */
16
+ lineWidth?: number;
17
+ /**
18
+ * @property {boolean} [grid=true]
19
+ * @version 0.0.2
20
+ */
21
+ grid?: boolean;
22
+ /**
23
+ * @property {number} [zIndex=20]
24
+ * @version 0.0.2
25
+ */
26
+ zIndex?: number;
27
+ };
package/es/message/css.js CHANGED
@@ -1,2 +1,2 @@
1
- import './index.css'
2
1
  import '../index.css'
2
+ import './index.css'
@@ -39,19 +39,16 @@
39
39
  height: 16px;
40
40
  fill: var(--text-color);
41
41
  }
42
- .px-message-icon-wrapper svg.px-message-icon__loading {
43
- animation: px-icon-spin 1s linear infinite;
44
- }
45
42
  .px-message-close-wrapper {
46
43
  display: flex;
47
44
  align-items: center;
48
45
  flex-shrink: 0;
49
- margin-left: 8px;
46
+ margin-left: var(--px-interval-2);
50
47
  }
51
48
  .px-message-close-wrapper .px-message-icon {
52
49
  cursor: pointer;
53
- width: 10px;
54
- height: 10px;
50
+ width: 1em;
51
+ height: 1em;
55
52
  fill: var(--text-color);
56
53
  transition: 0.25s;
57
54
  }
@@ -59,62 +56,65 @@
59
56
  --text-color: var(--px-sakura-6);
60
57
  }
61
58
  .px-message.px-message__sakura .px-message-close-wrapper > .px-message-icon:hover {
62
- --text-color: var(--px-sakura-5);
59
+ fill: var(--px-sakura-5);
63
60
  }
64
61
  .px-message.px-message__sakura .px-message-close-wrapper > .px-message-icon:active {
65
- --text-color: var(--px-sakura-7);
62
+ fill: var(--px-sakura-7);
66
63
  }
67
64
  .px-message.px-message__success {
68
65
  --text-color: var(--px-success-6);
69
66
  }
70
67
  .px-message.px-message__success .px-message-close-wrapper > .px-message-icon:hover {
71
- --text-color: var(--px-success-5);
68
+ fill: var(--px-success-5);
72
69
  }
73
70
  .px-message.px-message__success .px-message-close-wrapper > .px-message-icon:active {
74
- --text-color: var(--px-success-7);
71
+ fill: var(--px-success-7);
75
72
  }
76
73
  .px-message.px-message__warning {
77
74
  --text-color: var(--px-warning-6);
78
75
  }
79
76
  .px-message.px-message__warning .px-message-close-wrapper > .px-message-icon:hover {
80
- --text-color: var(--px-warning-5);
77
+ fill: var(--px-warning-5);
81
78
  }
82
79
  .px-message.px-message__warning .px-message-close-wrapper > .px-message-icon:active {
83
- --text-color: var(--px-warning-7);
80
+ fill: var(--px-warning-7);
84
81
  }
85
82
  .px-message.px-message__info {
86
83
  --text-color: var(--px-primary-6);
87
84
  }
88
85
  .px-message.px-message__info .px-message-close-wrapper > .px-message-icon:hover {
89
- --text-color: var(--px-primary-5);
86
+ fill: var(--px-primary-5);
90
87
  }
91
88
  .px-message.px-message__info .px-message-close-wrapper > .px-message-icon:active {
92
- --text-color: var(--px-primary-7);
89
+ fill: var(--px-primary-7);
93
90
  }
94
91
  .px-message.px-message__error {
95
92
  --text-color: var(--px-danger-6);
96
93
  }
97
- .px-message.px-message__error .px-message-close-wrapper > .px-message-icon:hover:hover {
98
- --text-color: var(--px-danger-5);
94
+ .px-message.px-message__error .px-message-close-wrapper > .px-message-icon:hover {
95
+ fill: var(--px-danger-5);
99
96
  }
100
- .px-message.px-message__error .px-message-close-wrapper > .px-message-icon:hover:active {
101
- --text-color: var(--px-danger-7);
97
+ .px-message.px-message__error .px-message-close-wrapper > .px-message-icon:active {
98
+ fill: var(--px-danger-7);
102
99
  }
103
100
  .px-message.px-message__loading {
104
101
  --text-color: var(--px-neutral-8);
105
102
  }
106
- .px-message.px-message__loading .px-message-close-wrapper > .px-message-icon:hover:hover {
107
- --text-color: var(--px-neutral-7);
103
+ .px-message.px-message__loading .px-message-close-wrapper > .px-message-icon:hover {
104
+ fill: var(--px-neutral-7);
108
105
  }
109
- .px-message.px-message__loading .px-message-close-wrapper > .px-message-icon:hover:active {
110
- --text-color: var(--px-neutral-9);
106
+ .px-message.px-message__loading .px-message-close-wrapper > .px-message-icon:active {
107
+ fill: var(--px-neutral-9);
111
108
  }
112
109
  .px-message.px-message__normal {
113
110
  --text-color: var(--px-neutral-10);
114
111
  }
115
- .px-message.px-message__normal .px-message-close-wrapper > .px-message-icon:hover:hover {
116
- --text-color: var(--px-neutral-9);
112
+ .px-message.px-message__normal .px-message-close-wrapper > .px-message-icon {
113
+ fill: var(--px-neutral-8);
117
114
  }
118
- .px-message.px-message__normal .px-message-close-wrapper > .px-message-icon:hover:active {
119
- --text-color: var(--px-neutral-8);
115
+ .px-message.px-message__normal .px-message-close-wrapper > .px-message-icon:hover {
116
+ fill: var(--px-neutral-7);
117
+ }
118
+ .px-message.px-message__normal .px-message-close-wrapper > .px-message-icon:active {
119
+ fill: var(--px-neutral-9);
120
120
  }
@@ -8,7 +8,7 @@ declare const _default: import("vue").DefineComponent<MessageProps, {
8
8
  onClose?: ((...args: any[]) => any) | undefined;
9
9
  }>, {
10
10
  type: "info" | "success" | "warning" | "error" | "loading" | "normal" | "sakura";
11
- content: import("../share/type").ValidContent;
11
+ content: import("..").ValidContent;
12
12
  duration: number;
13
13
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
14
  export default _default;
@@ -1,10 +1,12 @@
1
1
  import './css.js'
2
- import { defineComponent, createElementBlock, openBlock, normalizeStyle, createElementVNode, ref, onMounted, onBeforeUnmount, computed, watch, createVNode, Transition } from "vue";
2
+ import { defineComponent, createElementBlock, openBlock, normalizeStyle, createElementVNode, ref, onMounted, onBeforeUnmount, shallowRef, computed, watch, createVNode, Transition } from "vue";
3
3
  import { p as parseColor, a as generatePalette, r as rgbaColor2string, g as getGlobalThemeColor } from "../share/util/color.js";
4
4
  import { u as useDarkMode } from "../share/hook/use-dark-mode.js";
5
5
  import { u as useResizeObserver } from "../share/hook/use-resize-observer.js";
6
- import { S as SpinnerThirdSolid } from "../button/index.js";
6
+ import { S as SpinnerThirdSolid, T as TimesCircleSolid } from "../auto-complete/index.js";
7
7
  import { p } from "../aside/index.js";
8
+ import { u as useWatchGlobalCssVal } from "../share/hook/use-watch-global-css-var.js";
9
+ import { a as canvasPreprocess, c as calcPixelSize } from "../share/util/plot.js";
8
10
  const InfoCircleSolid = /* @__PURE__ */ defineComponent({
9
11
  props: {
10
12
  size: {},
@@ -139,37 +141,6 @@ const CheckCircleSolid = /* @__PURE__ */ defineComponent({
139
141
  };
140
142
  }
141
143
  });
142
- const Times = /* @__PURE__ */ defineComponent({
143
- props: {
144
- size: {},
145
- color: {}
146
- },
147
- setup(__props) {
148
- const props = __props;
149
- return (_ctx, _cache) => {
150
- return openBlock(), createElementBlock(
151
- "svg",
152
- {
153
- class: "px-icon-hn",
154
- style: normalizeStyle({ color: props.color, fontSize: props.size + "px" }),
155
- xmlns: "http://www.w3.org/2000/svg",
156
- viewBox: "0 0 24 24"
157
- },
158
- [..._cache[0] || (_cache[0] = [
159
- createElementVNode(
160
- "path",
161
- { d: "M14 13h1v1h1v1h1v1h1v1h1v1h1v1h1v1h1v1h-1v1h-1v-1h-1v-1h-1v-1h-1v-1h-1v-1h-1v-1h-1v-1h-1v-1h-2v1h-1v1H9v1H8v1H7v1H6v1H5v1H4v1H3v-1H2v-1h1v-1h1v-1h1v-1h1v-1h1v-1h1v-1h1v-1h1v-2H9v-1H8V9H7V8H6V7H5V6H4V5H3V4H2V3h1V2h1v1h1v1h1v1h1v1h1v1h1v1h1v1h1v1h2V9h1V8h1V7h1V6h1V5h1V4h1V3h1V2h1v1h1v1h-1v1h-1v1h-1v1h-1v1h-1v1h-1v1h-1v1h-1z" },
162
- null,
163
- -1
164
- /* CACHED */
165
- )
166
- ])],
167
- 4
168
- /* STYLE */
169
- );
170
- };
171
- }
172
- });
173
144
  const _sfc_main = /* @__PURE__ */ defineComponent({
174
145
  __name: "index",
175
146
  props: {
@@ -227,8 +198,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
227
198
  emits("close", props.id);
228
199
  clearTimer();
229
200
  };
230
- const canvasRef = ref();
231
- const messageRef = ref();
201
+ const canvasRef = shallowRef(null);
202
+ const messageRef = shallowRef(null);
232
203
  const themeMap = (type) => {
233
204
  if (!type) {
234
205
  return "normal";
@@ -273,30 +244,31 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
273
244
  }
274
245
  }
275
246
  const draw = (ctx, width, height, borderColor, pixelSize) => {
276
- ctx.fillStyle = `rgba(${borderColor.r}, ${borderColor.g}, ${borderColor.b}, ${borderColor.a / 255})`;
247
+ ctx.fillStyle = rgbaColor2string(borderColor);
277
248
  ctx.fillRect(pixelSize, 0, width - 2 * pixelSize, pixelSize);
278
249
  ctx.fillRect(width - pixelSize, pixelSize, pixelSize, height - 2 * pixelSize);
279
250
  ctx.fillRect(pixelSize, height - pixelSize, width - 2 * pixelSize, pixelSize);
280
251
  ctx.fillRect(0, pixelSize, pixelSize, height - 2 * pixelSize);
281
252
  const backgroundColor = getGlobalThemeColor("neutral", 1);
282
- ctx.fillStyle = `rgba(${backgroundColor.r}, ${backgroundColor.g}, ${backgroundColor.b}, ${backgroundColor.a / 255})`;
253
+ ctx.fillStyle = rgbaColor2string(backgroundColor);
283
254
  ctx.fillRect(pixelSize, pixelSize, width - 2 * pixelSize, height - 2 * pixelSize);
284
255
  };
285
256
  const drawPixel = () => {
286
- const globalComputedStyle = getComputedStyle(document.documentElement);
287
- const pixelSize = parseInt(globalComputedStyle.getPropertyValue("--px-bit"));
288
- if (!canvasRef.value || !messageRef.value) return;
289
- const ctx = canvasRef.value.getContext("2d", {
290
- willReadFrequently: true
291
- });
292
- const buttonRect = messageRef.value.getBoundingClientRect();
293
- canvasRef.value.width = buttonRect.width;
294
- canvasRef.value.height = buttonRect.height;
295
- if (!ctx) return;
257
+ const preprocessData = canvasPreprocess(messageRef, canvasRef);
258
+ if (!preprocessData) {
259
+ return;
260
+ }
261
+ const {
262
+ ctx,
263
+ width,
264
+ height
265
+ } = preprocessData;
266
+ const pixelSize = calcPixelSize();
296
267
  const borderColor = getBorderColor(props.type, palette.value);
297
- draw(ctx, canvasRef.value.width, canvasRef.value.height, borderColor, pixelSize);
268
+ draw(ctx, width, height, borderColor, pixelSize);
298
269
  };
299
270
  useResizeObserver(messageRef, drawPixel);
271
+ useWatchGlobalCssVal(drawPixel);
300
272
  watch([() => props.type, palette, darkMode], () => {
301
273
  setTimeout(() => {
302
274
  drawPixel();
@@ -342,7 +314,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
342
314
  fill: textColor.value
343
315
  }
344
316
  }, null) : props.type === "loading" && createVNode(SpinnerThirdSolid, {
345
- "class": "px-message-icon px-message-icon__loading",
317
+ "class": "px-message-icon px-animation__loading",
346
318
  "style": {
347
319
  fill: textColor.value
348
320
  }
@@ -353,7 +325,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
353
325
  }
354
326
  }, [p(props.content) ? props.content : props.content()]), props.closable && createVNode("div", {
355
327
  "class": "px-message-close-wrapper"
356
- }, [createVNode(Times, {
328
+ }, [createVNode(TimesCircleSolid, {
357
329
  "class": "px-message-icon",
358
330
  "style": {
359
331
  fill: closeIconColor.value
@@ -1,2 +1,2 @@
1
- import './message-box.css'
2
1
  import '../index.css'
2
+ import './message-box.css'
@@ -1,8 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { ref, createVNode, render } from "vue";
5
- import { M as MESSAGE_Z_INDEX } from "../share/const/index.js";
4
+ import { ref, createVNode, render, nextTick } from "vue";
6
5
  import { _ as _sfc_main } from "./message-box.js";
7
6
  import { p, m } from "../aside/index.js";
8
7
  const urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
@@ -18,11 +17,11 @@ class MessageManager {
18
17
  constructor(options) {
19
18
  __publicField(this, "messages");
20
19
  __publicField(this, "messageBox");
20
+ __publicField(this, "container", null);
21
21
  this.messages = ref([]);
22
22
  this.messageBox = createVNode(_sfc_main, {
23
23
  messages: this.messages.value,
24
- zIndex: options.zIndex,
25
- position: options.position,
24
+ placement: options.placement,
26
25
  onClose: (id2) => {
27
26
  const idx = this.messages.value.findIndex((e) => e.id === id2);
28
27
  if (idx >= 0) {
@@ -32,11 +31,11 @@ class MessageManager {
32
31
  });
33
32
  const root = (p(options.root) ? document.querySelector(options.root) : options.root) || document.body;
34
33
  const id = nanoid();
35
- const container = document.createElement("div");
36
- container.id = id;
37
- container.className = `px-message-box-wrapper`;
38
- root.appendChild(container);
39
- render(this.messageBox, container);
34
+ this.container = document.createElement("div");
35
+ this.container.id = id;
36
+ this.container.className = `px-message-box-wrapper`;
37
+ root.appendChild(this.container);
38
+ render(this.messageBox, this.container);
40
39
  }
41
40
  push(options) {
42
41
  const id = options.id ?? nanoid();
@@ -53,14 +52,24 @@ class MessageManager {
53
52
  clear() {
54
53
  this.messages.value.length = 0;
55
54
  }
55
+ unmount() {
56
+ if (this.container) {
57
+ const container = this.container;
58
+ render(this.messageBox, container);
59
+ nextTick(() => {
60
+ container.remove();
61
+ this.container = null;
62
+ });
63
+ }
64
+ }
56
65
  }
57
66
  const messageManagers = {
58
67
  top: void 0,
59
68
  bottom: void 0,
60
- topLeft: void 0,
61
- topRight: void 0,
62
- bottomLeft: void 0,
63
- bottomRight: void 0
69
+ "top-left": void 0,
70
+ "top-right": void 0,
71
+ "bottom-left": void 0,
72
+ "bottom-right": void 0
64
73
  };
65
74
  const messageCall = (options) => {
66
75
  if (p(options) || m(options)) {
@@ -68,10 +77,9 @@ const messageCall = (options) => {
68
77
  content: options
69
78
  };
70
79
  }
71
- const position = options.position || "top";
72
- const currentManager = messageManagers[position] ? messageManagers[position] : messageManagers[position] = new MessageManager({
73
- position,
74
- zIndex: MESSAGE_Z_INDEX,
80
+ const placement = options.placement || options.position || "top";
81
+ const currentManager = messageManagers[placement] ? messageManagers[placement] : messageManagers[placement] = new MessageManager({
82
+ placement,
75
83
  root: options.root || "body"
76
84
  });
77
85
  const id = currentManager.push({
@@ -88,19 +96,21 @@ const messageCall = (options) => {
88
96
  };
89
97
  };
90
98
  const message = messageCall;
91
- ["info", "success", "warning", "error", "loading", "sakura", "normal"].forEach((key) => {
92
- message[key] = (options) => {
93
- if (p(options) || m(options)) {
94
- options = {
95
- content: options
96
- };
97
- }
98
- return message({
99
- ...options,
100
- type: key
101
- });
102
- };
103
- });
99
+ ["info", "success", "warning", "error", "loading", "sakura", "normal"].forEach(
100
+ (key) => {
101
+ message[key] = (options) => {
102
+ if (p(options) || m(options)) {
103
+ options = {
104
+ content: options
105
+ };
106
+ }
107
+ return message({
108
+ ...options,
109
+ type: key
110
+ });
111
+ };
112
+ }
113
+ );
104
114
  export {
105
115
  message as m,
106
116
  nanoid as n
@@ -5,7 +5,6 @@ type __VLS_Props = MessageBoxProps & {
5
5
  onClose: (id: string | number | symbol) => any;
6
6
  };
7
7
  declare const _default: import("vue").DefineComponent<__VLS_Props, MessageBoxExpose, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
8
- zIndex: number;
9
8
  root: string | HTMLElement;
10
9
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
10
  export default _default;
@@ -1,6 +1,5 @@
1
1
  import { defineComponent, useAttrs, ref, createBlock, openBlock, Teleport, createVNode, mergeProps, unref } from "vue";
2
2
  import { _ as _sfc_main$1 } from "./message-box.js";
3
- import { M as MESSAGE_Z_INDEX } from "../share/const/index.js";
4
3
  const _sfc_main = /* @__PURE__ */ defineComponent({
5
4
  ...{
6
5
  name: "MessageBox"
@@ -8,8 +7,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
8
7
  __name: "message-box-wrapped",
9
8
  props: {
10
9
  messages: null,
10
+ placement: null,
11
11
  position: null,
12
- zIndex: { default: MESSAGE_Z_INDEX },
12
+ zIndex: null,
13
13
  root: { default: "body" },
14
14
  "onUpdate:messages": { type: Function },
15
15
  onClose: { type: Function }
@@ -8,6 +8,7 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, MessageBoxExp
8
8
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
9
9
  onClose?: ((id: string | number | symbol) => any) | undefined;
10
10
  }>, {
11
- zIndex: number;
11
+ placement: "top" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right";
12
+ position: "top" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right";
12
13
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
14
  export default _default;