@gct-paas/core-web 0.1.4-dev.8 → 0.1.4-dev.9

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 (118) hide show
  1. package/dist/index-BghCpvxN.js +76 -0
  2. package/dist/index-PLrMc0gl.cjs +76 -0
  3. package/dist/index-oVPMi6Ep.js +29160 -0
  4. package/dist/index.esm.min.mjs +34 -24962
  5. package/dist/index.min.cjs +1 -67
  6. package/dist/index.min.css +1 -1
  7. package/dist/index.system.min.js +1 -67
  8. package/dist/monaco-editor-B8X-ou0h.js +20245 -0
  9. package/dist/monaco-editor-Bdgpd_KL.cjs +19 -0
  10. package/dist/monaco-editor-NIWDtQNB.js +19 -0
  11. package/es/_virtual/_plugin-vue_export-helper.mjs +9 -0
  12. package/es/components/app-modal/app-modal-component.css +149 -0
  13. package/es/components/app-modal/app-modal-component.d.ts +26 -0
  14. package/es/components/app-modal/app-modal-component.mjs +140 -0
  15. package/es/components/base-button/base-button.css +74 -0
  16. package/es/components/base-button/base-button.vue.d.ts +173 -0
  17. package/es/components/base-button/base-button.vue.mjs +7 -0
  18. package/es/components/base-button/base-button.vue3.mjs +179 -0
  19. package/es/components/basic-button/basic-button.css +25 -0
  20. package/es/components/basic-button/basic-button.vue.d.ts +100 -0
  21. package/es/components/basic-button/basic-button.vue.mjs +7 -0
  22. package/es/components/basic-button/basic-button.vue3.mjs +130 -0
  23. package/es/components/code-editor/code-editor.d.ts +1 -1
  24. package/es/components/index.d.ts +10 -1
  25. package/es/components/index.mjs +22 -0
  26. package/es/components/layout/flex-container/flex-container.mjs +94 -0
  27. package/es/components/layout/flex-item/flex-item.mjs +55 -0
  28. package/es/components/layout/grid-container/grid-container.mjs +51 -0
  29. package/es/components/layout/view-container/view-container.mjs +38 -0
  30. package/es/components/svg-icon/svg-icon.css +73 -0
  31. package/es/components/svg-icon/svg-icon.vue.d.ts +40 -0
  32. package/es/components/svg-icon/svg-icon.vue.mjs +50 -0
  33. package/es/components/svg-icon/svg-icon.vue3.mjs +6 -0
  34. package/es/create-app-vue.d.ts +9 -0
  35. package/es/create-app-vue.mjs +17 -0
  36. package/es/directives/drag-resize.d.ts +4 -0
  37. package/es/directives/drag-resize.mjs +42 -0
  38. package/es/directives/index.d.ts +8 -0
  39. package/es/directives/index.mjs +9 -0
  40. package/es/directives/target-loading.d.ts +4 -0
  41. package/es/directives/target-loading.mjs +40 -0
  42. package/es/hooks/index.d.ts +1 -0
  43. package/es/hooks/useDragLine.d.ts +6 -0
  44. package/es/hooks/useDragLine.mjs +79 -0
  45. package/es/index.d.ts +5 -4
  46. package/es/index.mjs +29 -13
  47. package/es/modules/code-editor/index.d.ts +163 -0
  48. package/es/modules/code-editor/index.mjs +8 -0
  49. package/es/modules/code-editor/monaco-editor.css +49 -0
  50. package/es/modules/code-editor/monaco-editor.vue.d.ts +143 -0
  51. package/es/modules/code-editor/monaco-editor.vue.mjs +7 -0
  52. package/es/modules/code-editor/monaco-editor.vue2.mjs +440 -0
  53. package/es/modules/code-editor/useEditorConsole.d.ts +54 -0
  54. package/es/modules/code-editor/useEditorConsole.mjs +194 -0
  55. package/es/modules/code-editor/useMonacoEditor.d.ts +26 -0
  56. package/es/modules/code-editor/useMonacoEditor.mjs +26 -0
  57. package/es/modules/color-picker/index.d.ts +2 -0
  58. package/es/modules/color-picker/src/ColorPicker.css +16 -0
  59. package/es/modules/color-picker/src/ColorPicker.vue.d.ts +49 -0
  60. package/es/modules/color-picker/src/ColorPicker.vue.mjs +8 -0
  61. package/es/modules/color-picker/src/ColorPicker.vue2.mjs +545 -0
  62. package/es/modules/color-picker/src/ColorPicker2.css +156 -0
  63. package/es/modules/gct-dnd/constants/index.d.ts +7 -9
  64. package/es/modules/gct-dnd/constants/index.mjs +18 -7
  65. package/es/modules/global-modal/index.d.ts +5 -0
  66. package/es/modules/global-modal/index.mjs +16 -0
  67. package/es/modules/global-modal/src/BasicModal.vue.d.ts +518 -0
  68. package/es/modules/global-modal/src/BasicModal.vue.mjs +221 -0
  69. package/es/modules/global-modal/src/BasicModal.vue2.mjs +5 -0
  70. package/es/modules/global-modal/src/components/GlboalModal.d.ts +251 -0
  71. package/es/modules/global-modal/src/components/GlboalModal.mjs +40 -0
  72. package/es/modules/global-modal/src/components/ModalClose.css +95 -0
  73. package/es/modules/global-modal/src/components/ModalClose.vue.d.ts +27 -0
  74. package/es/modules/global-modal/src/components/ModalClose.vue.mjs +79 -0
  75. package/es/modules/global-modal/src/components/ModalClose.vue3.mjs +6 -0
  76. package/es/modules/global-modal/src/components/ModalFooter.vue.d.ts +270 -0
  77. package/es/modules/global-modal/src/components/ModalFooter.vue.mjs +44 -0
  78. package/es/modules/global-modal/src/components/ModalFooter.vue2.mjs +5 -0
  79. package/es/modules/global-modal/src/components/ModalHeader.vue.d.ts +17 -0
  80. package/es/modules/global-modal/src/components/ModalHeader.vue.mjs +11 -0
  81. package/es/modules/global-modal/src/components/ModalHeader.vue2.mjs +13 -0
  82. package/es/modules/global-modal/src/components/ModalWrapper.vue.d.ts +95 -0
  83. package/es/modules/global-modal/src/components/ModalWrapper.vue.mjs +26 -0
  84. package/es/modules/global-modal/src/components/ModalWrapper.vue2.mjs +136 -0
  85. package/es/modules/global-modal/src/hooks/useModal.d.ts +6 -0
  86. package/es/modules/global-modal/src/hooks/useModal.mjs +120 -0
  87. package/es/modules/global-modal/src/hooks/useModalContext.d.ts +5 -0
  88. package/es/modules/global-modal/src/hooks/useModalContext.mjs +11 -0
  89. package/es/modules/global-modal/src/hooks/useModalDrag.d.ts +7 -0
  90. package/es/modules/global-modal/src/hooks/useModalDrag.mjs +82 -0
  91. package/es/modules/global-modal/src/hooks/useModalFullScreen.d.ts +11 -0
  92. package/es/modules/global-modal/src/hooks/useModalFullScreen.mjs +16 -0
  93. package/es/modules/global-modal/src/index.css +153 -0
  94. package/es/modules/global-modal/src/props.d.ts +156 -0
  95. package/es/modules/global-modal/src/props.mjs +57 -0
  96. package/es/modules/global-modal/src/typing.d.ts +174 -0
  97. package/es/modules/target-loading/index.d.ts +4 -0
  98. package/es/modules/target-loading/src/createLoading.d.ts +13 -0
  99. package/es/modules/target-loading/src/createLoading.mjs +57 -0
  100. package/es/modules/target-loading/src/target-loading.css +18 -0
  101. package/es/modules/target-loading/src/target-loading.vue.d.ts +57 -0
  102. package/es/modules/target-loading/src/target-loading.vue.mjs +52 -0
  103. package/es/modules/target-loading/src/target-loading.vue3.mjs +7 -0
  104. package/es/modules/target-loading/src/typing.d.ts +9 -0
  105. package/es/modules/target-loading/src/useLoading.d.ts +9 -0
  106. package/es/setup-app.d.ts +1 -0
  107. package/es/setup-app.mjs +4 -0
  108. package/es/types/index.d.ts +190 -0
  109. package/es/utils/index.d.ts +4 -1
  110. package/es/utils/message-util/message-util.d.ts +7 -0
  111. package/es/utils/message-util/message-util.mjs +26 -0
  112. package/es/utils/monaco-loader/monaco-loader.d.ts +59 -0
  113. package/es/utils/monaco-loader/monaco-loader.mjs +88 -0
  114. package/es/utils/overlay-controller/overlay-controller.d.ts +18 -0
  115. package/es/utils/overlay-controller/overlay-controller.mjs +23 -0
  116. package/es/widgets/gct-edit-form/gct-edit-form.d.ts +1 -1
  117. package/es/widgets/gct-form/gct-form-collapse/gct-form-collapse.d.ts +1 -1
  118. package/package.json +14 -6
@@ -0,0 +1,26 @@
1
+ export declare const Theme: {
2
+ readonly VS: "vs";
3
+ readonly BLACK: "hc-black";
4
+ readonly DARK: "vs-dark";
5
+ };
6
+ export type Theme = (typeof Theme)[keyof typeof Theme];
7
+ export declare const Lang: {
8
+ readonly JS: "javascript";
9
+ readonly SQL: "sql";
10
+ readonly PWSH: "powershell";
11
+ readonly JAVA: "java";
12
+ readonly C_SHARP: "csharp";
13
+ readonly JSON: "json";
14
+ };
15
+ export type Lang = (typeof Lang)[keyof typeof Lang];
16
+ export declare class Prop {
17
+ value?: string | null;
18
+ /** 标题 */
19
+ title?: string;
20
+ /** 语言 */
21
+ language?: string;
22
+ /** 官方自带三种主题:vs、hc-black、vs-dark */
23
+ theme?: Theme;
24
+ /** 是否只读 */
25
+ readonly?: boolean;
26
+ }
@@ -0,0 +1,26 @@
1
+ const Theme = {
2
+ VS: "vs",
3
+ BLACK: "hc-black",
4
+ DARK: "vs-dark"
5
+ };
6
+ const Lang = {
7
+ JS: "javascript",
8
+ SQL: "sql",
9
+ PWSH: "powershell",
10
+ JAVA: "java",
11
+ C_SHARP: "csharp",
12
+ JSON: "json"
13
+ };
14
+ class Prop {
15
+ value;
16
+ /** 标题 */
17
+ title;
18
+ /** 语言 */
19
+ language;
20
+ /** 官方自带三种主题:vs、hc-black、vs-dark */
21
+ theme;
22
+ /** 是否只读 */
23
+ readonly;
24
+ }
25
+
26
+ export { Lang, Prop, Theme };
@@ -0,0 +1,2 @@
1
+ import { default as ColorPicker } from './src/ColorPicker.vue';
2
+ export { ColorPicker };
@@ -0,0 +1,16 @@
1
+ .component[data-v-7bfd9ca3] {
2
+ display: inline-block;
3
+ position: relative;
4
+ outline: none;
5
+ font-size: 14px;
6
+ text-align: left;
7
+ cursor: pointer;
8
+ }
9
+ .component .box[data-v-7bfd9ca3] {
10
+ display: flex;
11
+ align-items: center;
12
+ border: 1px solid var(--gct-color-text-1);
13
+ border-radius: 4px;
14
+ background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAWElEQVRIiWM8fubkfwYygKWJOSM5+mCAhRLNoxaPWjxq8ajFoxbTyeL/DAfJ0Xjs3Cl7Siwmu4Yht1aDgZEYx6MWj1o8avGoxaMWD3qLya5X//4nqx6HAQC7RBGFzolqTAAAAABJRU5ErkJggg==');
15
+ background-size: 10px 10px;
16
+ }
@@ -0,0 +1,49 @@
1
+ interface RgbaType {
2
+ r: number;
3
+ g: number;
4
+ b: number;
5
+ a: number;
6
+ }
7
+ interface PropsType {
8
+ color?: string | RgbaType;
9
+ preset?: string[];
10
+ width?: number;
11
+ useTrigger?: boolean;
12
+ placement?: string;
13
+ }
14
+ declare function __VLS_template(): {
15
+ attrs: Partial<{}>;
16
+ slots: {
17
+ trigger?(_: {}): any;
18
+ icon?(_: {}): any;
19
+ };
20
+ refs: {
21
+ saturationRef: HTMLDivElement;
22
+ hueSliderRef: HTMLDivElement;
23
+ alphaSliderRef: HTMLDivElement;
24
+ };
25
+ rootEl: any;
26
+ };
27
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
28
+ declare const __VLS_component: import('vue').DefineComponent<PropsType, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
29
+ "update:color": (...args: any[]) => void;
30
+ }, string, import('vue').PublicProps, Readonly<PropsType> & Readonly<{
31
+ "onUpdate:color"?: ((...args: any[]) => any) | undefined;
32
+ }>, {
33
+ width: number;
34
+ placement: string;
35
+ color: string | RgbaType;
36
+ preset: string[];
37
+ useTrigger: boolean;
38
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
39
+ saturationRef: HTMLDivElement;
40
+ hueSliderRef: HTMLDivElement;
41
+ alphaSliderRef: HTMLDivElement;
42
+ }, any>;
43
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
44
+ export default _default;
45
+ type __VLS_WithTemplateSlots<T, S> = T & {
46
+ new (): {
47
+ $slots: S;
48
+ };
49
+ };
@@ -0,0 +1,8 @@
1
+ import _sfc_main from './ColorPicker.vue2.mjs';
2
+ import './ColorPicker2.css';import './ColorPicker.css';/* empty css */
3
+ /* empty css */
4
+ import _export_sfc from '../../../_virtual/_plugin-vue_export-helper.mjs';
5
+
6
+ const ColorPicker = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-7bfd9ca3"]]);
7
+
8
+ export { ColorPicker as default };
@@ -0,0 +1,545 @@
1
+ import { defineComponent, ref, watch, onMounted, computed, resolveComponent, openBlock, createBlock, withCtx, renderSlot, createElementBlock, createElementVNode, normalizeStyle, Fragment, renderList } from 'vue';
2
+
3
+ const _hoisted_1 = {
4
+ key: 1,
5
+ class: "component"
6
+ };
7
+ const _hoisted_2 = { class: "box" };
8
+ const _hoisted_3 = { style: {
9
+ borderRadius: "4px"
10
+ } };
11
+ const _hoisted_4 = { class: "color-picker-middle" };
12
+ const _hoisted_5 = { style: { "flex": "auto" } };
13
+ const _hoisted_6 = { class: "color-picker-diamond" };
14
+ const _hoisted_7 = { class: "color-picker-value" };
15
+ const _hoisted_8 = { class: "hex" };
16
+ const _hoisted_9 = ["value"];
17
+ const _hoisted_10 = { class: "rgba-r" };
18
+ const _hoisted_11 = ["value"];
19
+ const _hoisted_12 = { class: "rgba-g" };
20
+ const _hoisted_13 = ["value"];
21
+ const _hoisted_14 = { class: "rgba-b" };
22
+ const _hoisted_15 = ["value"];
23
+ const _hoisted_16 = { class: "rgba-a" };
24
+ const _hoisted_17 = ["value"];
25
+ const _hoisted_18 = { class: "presetColor" };
26
+ const _hoisted_19 = { class: "preset" };
27
+ const _hoisted_20 = ["onClick"];
28
+ const _sfc_main = /* @__PURE__ */ defineComponent({
29
+ ...{
30
+ name: "ColorPicker"
31
+ },
32
+ __name: "ColorPicker",
33
+ props: {
34
+ color: { default: () => "#FFFFFF00" },
35
+ preset: { default: () => [
36
+ "#D0021B",
37
+ "#F5A623",
38
+ "#F8E71C",
39
+ "#8B572A",
40
+ "#7ED321",
41
+ "#417505",
42
+ "#BD10E0",
43
+ "#9013FE",
44
+ "#4A90E2",
45
+ "#50E3C2",
46
+ "#B8E986",
47
+ "#000000",
48
+ "#4A4A4A",
49
+ "#9B9B9B",
50
+ "#FFFFFF"
51
+ ] },
52
+ width: { default: 240 },
53
+ useTrigger: { type: Boolean, default: false },
54
+ placement: { default: "bottomLeft" }
55
+ },
56
+ emits: ["update:color"],
57
+ setup(__props, { emit: __emit }) {
58
+ const props = __props;
59
+ const emit = __emit;
60
+ const saturationRef = ref();
61
+ const hueSliderRef = ref();
62
+ const alphaSliderRef = ref();
63
+ const pointStyle = ref("");
64
+ const hueSliderStyle = ref("left: 0;");
65
+ const alphaSliderStyle = ref("left: calc(100% - 6px);");
66
+ const hue = ref(0);
67
+ const saturation = ref(1);
68
+ const value = ref(1);
69
+ const red = ref(255);
70
+ const green = ref(0);
71
+ const blue = ref(0);
72
+ const alpha = ref(1);
73
+ watch(
74
+ () => props.color,
75
+ () => {
76
+ const { r: r2, g: g2, b: b2, a: a2 } = parseColor(props.color || "#FFFFFF00");
77
+ red.value = r2;
78
+ green.value = g2;
79
+ blue.value = b2;
80
+ alpha.value = a2;
81
+ }
82
+ );
83
+ const { r, g, b, a } = parseColor(props.color || "#FFFFFF00");
84
+ red.value = r;
85
+ green.value = g;
86
+ blue.value = b;
87
+ alpha.value = a;
88
+ onMounted(() => {
89
+ const { h, s, v } = rgb2hsv(red.value, green.value, blue.value);
90
+ hue.value = h;
91
+ saturation.value = s;
92
+ value.value = v;
93
+ pointStyle.value = `top: ${100 - v * 100}%;left: ${s * 100}%;`;
94
+ hueSliderStyle.value = `left: ${hue.value / 360 * 100}%;`;
95
+ alphaSliderStyle.value = `left: ${alpha.value >= 1 ? "calc(100% - 6px)" : alpha.value * 100 + "%"};`;
96
+ });
97
+ const colorObj = computed(() => {
98
+ const r2 = red.value;
99
+ const g2 = green.value;
100
+ const b2 = blue.value;
101
+ const a2 = alpha.value;
102
+ const h = hue.value;
103
+ const s = saturation.value;
104
+ const v = value.value;
105
+ return {
106
+ rgb: `rgba(${r2},${g2},${b2})`,
107
+ rgba: `rgba(${r2},${g2},${b2},${a2})`,
108
+ hex6: rgba2hex(r2, g2, b2),
109
+ hex8: rgba2hex(r2, g2, b2, a2),
110
+ hsv: `hsv(${h},${s},${v})`,
111
+ hsl: ``
112
+ };
113
+ });
114
+ watch(
115
+ () => colorObj.value.hex8,
116
+ () => {
117
+ emit(
118
+ "update:color",
119
+ {
120
+ r: red.value,
121
+ g: green.value,
122
+ b: blue.value,
123
+ a: alpha.value
124
+ },
125
+ colorObj.value.hex8
126
+ );
127
+ const { h, s, v } = rgb2hsv(red.value, green.value, blue.value);
128
+ hue.value = h;
129
+ saturation.value = s;
130
+ value.value = v;
131
+ pointStyle.value = `top: ${100 - v * 100}%;left: ${s * 100}%;`;
132
+ hueSliderStyle.value = `left: ${hue.value / 360 * 100}%;`;
133
+ }
134
+ // {
135
+ // immediate: true,
136
+ // },
137
+ );
138
+ function hexChange(e) {
139
+ const v = e.target.value;
140
+ if (/^#?([0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(v)) {
141
+ let { r: r2, g: g2, b: b2, a: a2 } = hex2rgba(v);
142
+ red.value = r2;
143
+ green.value = g2;
144
+ blue.value = b2;
145
+ alpha.value = a2;
146
+ }
147
+ }
148
+ function redChange(e) {
149
+ const v = e.target.value;
150
+ if (v !== "") {
151
+ const num = parseInt(v);
152
+ num > 255 && (red.value = 255);
153
+ num < 0 && (red.value = 0);
154
+ num >= 0 && num <= 255 && (red.value = num);
155
+ }
156
+ }
157
+ function greenChange(e) {
158
+ const v = e.target.value;
159
+ if (v !== "") {
160
+ const num = parseInt(v);
161
+ num > 255 && (green.value = 255);
162
+ num < 0 && (green.value = 0);
163
+ num >= 0 && num <= 255 && (green.value = num);
164
+ }
165
+ }
166
+ function blueChange(e) {
167
+ const v = e.target.value;
168
+ if (v !== "") {
169
+ const num = parseInt(v);
170
+ num > 255 && (blue.value = 255);
171
+ num < 0 && (blue.value = 0);
172
+ num >= 0 && num <= 255 && (blue.value = num);
173
+ }
174
+ }
175
+ function alphaChange(e) {
176
+ const v = e.target.value;
177
+ if (v !== "") {
178
+ const num = parseFloat(v);
179
+ alpha.value = num;
180
+ num > 1 && (alpha.value = 1);
181
+ num < 0 && (alpha.value = 0);
182
+ num >= 0 && num <= 1 && (alpha.value = num);
183
+ }
184
+ }
185
+ function presetChange(item) {
186
+ if (/^#?([0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(item)) {
187
+ let { r: r2, g: g2, b: b2, a: a2 } = hex2rgba(item);
188
+ red.value = r2;
189
+ green.value = g2;
190
+ blue.value = b2;
191
+ alpha.value = a2;
192
+ alphaSliderStyle.value = `left: calc(100% - 6px);`;
193
+ alpha.value = 1;
194
+ }
195
+ }
196
+ function handleChangeSV(e) {
197
+ if (!saturationRef.value) return;
198
+ const w = saturationRef.value.clientWidth;
199
+ const h = saturationRef.value.clientHeight;
200
+ let x = e.pageX - saturationRef.value.getBoundingClientRect().left;
201
+ let y = e.pageY - saturationRef.value.getBoundingClientRect().top;
202
+ x = x < w && x > 0 ? x : x > w ? w : 0;
203
+ y = y < h && y > 0 ? y : y > h ? h : 0;
204
+ saturation.value = Math.floor(x / w * 100 + 0.5) / 100;
205
+ value.value = Math.floor((1 - y / h) * 100 + 0.5) / 100;
206
+ const { r: r2, g: g2, b: b2 } = hsv2rgb(hue.value, saturation.value, value.value);
207
+ red.value = r2;
208
+ green.value = g2;
209
+ blue.value = b2;
210
+ pointStyle.value = `top: ${y}px;left: ${x}px;`;
211
+ }
212
+ function mousedownSV(e) {
213
+ handleChangeSV(e);
214
+ window.addEventListener("mousemove", handleChangeSV);
215
+ window.addEventListener("mouseup", mouseupSV);
216
+ alphaSliderStyle.value = `left: calc(100% - 6px);`;
217
+ alpha.value = 1;
218
+ }
219
+ function mouseupSV() {
220
+ window.removeEventListener("mousemove", handleChangeSV);
221
+ window.removeEventListener("mouseup", mouseupSV);
222
+ }
223
+ function handleChangeHue(e) {
224
+ let w = hueSliderRef.value.clientWidth;
225
+ let x = e.pageX - saturationRef.value.getBoundingClientRect().left;
226
+ x = x < w && x > 0 ? x : x > w ? w : 0;
227
+ hue.value = Math.floor(x / w * 360 + 0.5);
228
+ let { r: r2, g: g2, b: b2 } = hsv2rgb(hue.value, saturation.value, value.value);
229
+ red.value = r2;
230
+ green.value = g2;
231
+ blue.value = b2;
232
+ hueSliderStyle.value = `left: ${x >= w - 6 ? w - 6 : x}px;`;
233
+ }
234
+ function mousedownHue(e) {
235
+ handleChangeHue(e);
236
+ window.addEventListener("mousemove", handleChangeHue);
237
+ window.addEventListener("mouseup", mouseupHue);
238
+ }
239
+ function mouseupHue() {
240
+ window.removeEventListener("mousemove", handleChangeHue);
241
+ window.removeEventListener("mouseup", mouseupHue);
242
+ }
243
+ function handleChangeAlpha(e) {
244
+ let w = alphaSliderRef.value.clientWidth;
245
+ let x = e.pageX - saturationRef.value.getBoundingClientRect().left;
246
+ x = x < w && x > 0 ? x : x > w ? w : 0;
247
+ alpha.value = Math.floor(x / w * 100 + 0.5) / 100;
248
+ alphaSliderStyle.value = `left: ${x >= w - 6 ? w - 6 : x}px;`;
249
+ }
250
+ function mousedownAlpha(e) {
251
+ handleChangeAlpha(e);
252
+ window.addEventListener("mousemove", handleChangeAlpha);
253
+ window.addEventListener("mouseup", mouseupAlpha);
254
+ }
255
+ function mouseupAlpha() {
256
+ window.removeEventListener("mousemove", handleChangeAlpha);
257
+ window.removeEventListener("mouseup", mouseupAlpha);
258
+ }
259
+ function parseColor(color) {
260
+ if (color) {
261
+ let r2, g2, b2, a2;
262
+ if (typeof color === "string") {
263
+ if (/^#?([0-9a-fA-F]{6}|[0-9a-fA-F]{8}|[0-9a-fA-F]{3}|[0-9a-fA-F]{4})$/.test(
264
+ color
265
+ )) {
266
+ return hex2rgba(color);
267
+ }
268
+ return parseRGBA(color);
269
+ } else {
270
+ r2 = color.r > 255 ? 255 : color.r < 0 ? 0 : color.r;
271
+ g2 = color.g > 255 ? 255 : color.g < 0 ? 0 : color.g;
272
+ b2 = color.b > 255 ? 255 : color.b < 0 ? 0 : color.b;
273
+ a2 = color.a > 1 ? 1 : color.a < 0 ? 0 : color.a;
274
+ return { r: r2, g: g2, b: b2, a: a2 };
275
+ }
276
+ } else {
277
+ return { r: 0, g: 0, b: 0, a: 1 };
278
+ }
279
+ }
280
+ function hsv2rgb(h, s, v) {
281
+ h === 360 && (h = 0);
282
+ let i = Math.floor(h / 60) % 6;
283
+ let f = h / 60 - i;
284
+ let p = v * (1 - s);
285
+ let q = v * (1 - s * f);
286
+ let t = v * (1 - s * (1 - f));
287
+ let r2 = 0, g2 = 0, b2 = 0;
288
+ if (i === 0) {
289
+ r2 = v;
290
+ g2 = t;
291
+ b2 = p;
292
+ } else if (i === 1) {
293
+ r2 = q;
294
+ g2 = v;
295
+ b2 = p;
296
+ } else if (i === 2) {
297
+ r2 = p;
298
+ g2 = v;
299
+ b2 = t;
300
+ } else if (i === 3) {
301
+ r2 = p;
302
+ g2 = q;
303
+ b2 = v;
304
+ } else if (i === 4) {
305
+ r2 = t;
306
+ g2 = p;
307
+ b2 = v;
308
+ } else if (i === 5) {
309
+ r2 = v;
310
+ g2 = p;
311
+ b2 = q;
312
+ }
313
+ r2 = Math.floor(r2 * 255 + 0.5);
314
+ g2 = Math.floor(g2 * 255 + 0.5);
315
+ b2 = Math.floor(b2 * 255 + 0.5);
316
+ return { r: r2, g: g2, b: b2 };
317
+ }
318
+ function rgb2hsv(r2, g2, b2) {
319
+ let r1 = r2 / 255;
320
+ let g1 = g2 / 255;
321
+ let b1 = b2 / 255;
322
+ let cmax = Math.max(r1, g1, b1);
323
+ let cmin = Math.min(r1, g1, b1);
324
+ let d = cmax - cmin;
325
+ let h = 0, s, v;
326
+ if (d === 0) {
327
+ h = 0;
328
+ } else if (cmax === r1) {
329
+ h = (60 * (g1 - b1) / d + 360) % 360;
330
+ } else if (cmax === g1) {
331
+ h = 60 * ((b1 - r1) / d + 2);
332
+ } else if (cmax === b1) {
333
+ h = 60 * ((r1 - g1) / d + 4);
334
+ }
335
+ if (cmax === 0) {
336
+ s = 0;
337
+ } else {
338
+ s = d / cmax;
339
+ }
340
+ v = cmax;
341
+ h = Math.floor(h + 0.5);
342
+ s = Math.floor(s * 100 + 0.5) / 100;
343
+ v = Math.floor(v * 100 + 0.5) / 100;
344
+ return { h, s, v };
345
+ }
346
+ function rgba2hex(r2, g2, b2, a2 = 1) {
347
+ r2 = parseInt(r2);
348
+ let r1 = r2.toString(16).length !== 2 ? "0" + r2.toString(16) : r2.toString(16);
349
+ g2 = parseInt(g2);
350
+ let g1 = g2.toString(16).length !== 2 ? "0" + g2.toString(16) : g2.toString(16);
351
+ b2 = parseInt(b2);
352
+ let b1 = b2.toString(16).length !== 2 ? "0" + b2.toString(16) : b2.toString(16);
353
+ a2 = parseFloat(a2);
354
+ let a1 = "";
355
+ if (a2 !== 1) {
356
+ let temp = Math.floor(256 * a2);
357
+ a1 = temp.toString(16).length !== 2 ? "0" + temp.toString(16) : temp.toString(16);
358
+ }
359
+ return `#${r1}${g1}${b1}${a1}`.toUpperCase();
360
+ }
361
+ function hex2rgba(s) {
362
+ if (/^#?[0-9a-fA-F]{3}$/.test(s)) {
363
+ let b2 = s.substring(s.length - 1, s.length);
364
+ let g2 = s.substring(s.length - 2, s.length - 1);
365
+ let r2 = s.substring(s.length - 3, s.length - 2);
366
+ return hex2rgba(`${r2 + r2}${g2 + g2}${b2 + b2}`);
367
+ }
368
+ if (/^#?[0-9a-fA-F]{4}$/.test(s)) {
369
+ let a2 = s.substring(s.length - 1, s.length);
370
+ let b2 = s.substring(s.length - 2, s.length - 1);
371
+ let g2 = s.substring(s.length - 3, s.length - 2);
372
+ let r2 = s.substring(s.length - 4, s.length - 3);
373
+ return hex2rgba(`${r2 + r2}${g2 + g2}${b2 + b2}${a2 + a2}`);
374
+ }
375
+ if (/^#?[0-9a-fA-F]{6}$/.test(s)) {
376
+ let b2 = parseInt("0x" + s.substring(s.length - 2, s.length));
377
+ let g2 = parseInt("0x" + s.substring(s.length - 4, s.length - 2));
378
+ let r2 = parseInt("0x" + s.substring(s.length - 6, s.length - 4));
379
+ return { r: r2, g: g2, b: b2, a: 1 };
380
+ }
381
+ if (/^#?[0-9a-fA-F]{8}$/.test(s)) {
382
+ let a2 = parseInt("0x" + s.substring(s.length - 2, s.length));
383
+ a2 = a2 / 255;
384
+ let b2 = parseInt("0x" + s.substring(s.length - 4, s.length - 2));
385
+ let g2 = parseInt("0x" + s.substring(s.length - 6, s.length - 4));
386
+ let r2 = parseInt("0x" + s.substring(s.length - 8, s.length - 6));
387
+ return { r: r2, g: g2, b: b2, a: a2 };
388
+ }
389
+ }
390
+ function parseRGBA(colorString) {
391
+ const rgbaRegex = /^rgba?\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})(?:,\s*([\d.]+))?\)$/;
392
+ const match = colorString.match(rgbaRegex);
393
+ if (match) {
394
+ const alpha2 = match[4] ? parseFloat(match[4]) : 1;
395
+ return {
396
+ r: parseInt(match[1], 10),
397
+ g: parseInt(match[2], 10),
398
+ b: parseInt(match[3], 10),
399
+ a: alpha2
400
+ };
401
+ } else {
402
+ throw new Error("Invalid RGBA string");
403
+ }
404
+ }
405
+ return (_ctx, _cache) => {
406
+ const _component_a_popover = resolveComponent("a-popover");
407
+ return openBlock(), createBlock(_component_a_popover, {
408
+ placement: __props.placement,
409
+ trigger: "click",
410
+ "overlay-class-name": "color-picker__popover"
411
+ }, {
412
+ content: withCtx(() => [
413
+ createElementVNode("div", {
414
+ class: "color-picker",
415
+ style: normalizeStyle({ "--w": __props.width + "px" })
416
+ }, [
417
+ createElementVNode("div", {
418
+ ref_key: "saturationRef",
419
+ ref: saturationRef,
420
+ class: "color-picker-saturation",
421
+ onMousedown: mousedownSV
422
+ }, [
423
+ createElementVNode("div", {
424
+ style: normalizeStyle(`background-color: hsl(${hue.value}, 100%, 50%);`)
425
+ }, [
426
+ createElementVNode("div", {
427
+ class: "point",
428
+ style: normalizeStyle(pointStyle.value)
429
+ }, null, 4)
430
+ ], 4),
431
+ _cache[0] || (_cache[0] = createElementVNode("div", { class: "color-picker-saturation-t" }, null, -1)),
432
+ _cache[1] || (_cache[1] = createElementVNode("div", { class: "color-picker-saturation-h" }, null, -1))
433
+ ], 544),
434
+ createElementVNode("div", _hoisted_4, [
435
+ createElementVNode("div", _hoisted_5, [
436
+ createElementVNode("div", {
437
+ ref_key: "hueSliderRef",
438
+ ref: hueSliderRef,
439
+ class: "hue-slider",
440
+ onMousedown: mousedownHue
441
+ }, [
442
+ createElementVNode("div", {
443
+ class: "slider",
444
+ style: normalizeStyle(hueSliderStyle.value)
445
+ }, null, 4)
446
+ ], 544),
447
+ createElementVNode("div", {
448
+ ref_key: "alphaSliderRef",
449
+ ref: alphaSliderRef,
450
+ class: "alpha-slider",
451
+ onMousedown: mousedownAlpha
452
+ }, [
453
+ createElementVNode("div", {
454
+ class: "slider",
455
+ style: normalizeStyle(alphaSliderStyle.value)
456
+ }, null, 4),
457
+ createElementVNode("div", {
458
+ style: normalizeStyle(`background: linear-gradient(to right, rgba(0,0,0,0), ${colorObj.value.rgb});width: 100%;height: 100%`)
459
+ }, null, 4)
460
+ ], 544)
461
+ ]),
462
+ createElementVNode("div", _hoisted_6, [
463
+ createElementVNode("div", {
464
+ style: normalizeStyle(`background-color: ${colorObj.value.rgba};width: 100%;height: 100%;box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15), inset 0 0 4px rgba(0, 0, 0, .25);`)
465
+ }, null, 4)
466
+ ])
467
+ ]),
468
+ createElementVNode("div", _hoisted_7, [
469
+ createElementVNode("div", _hoisted_8, [
470
+ createElementVNode("label", null, [
471
+ createElementVNode("input", {
472
+ value: colorObj.value.hex8,
473
+ spellcheck: "false",
474
+ onInput: hexChange
475
+ }, null, 40, _hoisted_9)
476
+ ]),
477
+ _cache[2] || (_cache[2] = createElementVNode("p", null, "Hex", -1))
478
+ ]),
479
+ createElementVNode("div", _hoisted_10, [
480
+ createElementVNode("label", null, [
481
+ createElementVNode("input", {
482
+ value: red.value,
483
+ onInput: redChange
484
+ }, null, 40, _hoisted_11)
485
+ ]),
486
+ _cache[3] || (_cache[3] = createElementVNode("p", null, "R", -1))
487
+ ]),
488
+ createElementVNode("div", _hoisted_12, [
489
+ createElementVNode("label", null, [
490
+ createElementVNode("input", {
491
+ value: green.value,
492
+ onInput: greenChange
493
+ }, null, 40, _hoisted_13)
494
+ ]),
495
+ _cache[4] || (_cache[4] = createElementVNode("p", null, "G", -1))
496
+ ]),
497
+ createElementVNode("div", _hoisted_14, [
498
+ createElementVNode("label", null, [
499
+ createElementVNode("input", {
500
+ value: blue.value,
501
+ onInput: blueChange
502
+ }, null, 40, _hoisted_15)
503
+ ]),
504
+ _cache[5] || (_cache[5] = createElementVNode("p", null, "B", -1))
505
+ ]),
506
+ createElementVNode("div", _hoisted_16, [
507
+ createElementVNode("label", null, [
508
+ createElementVNode("input", {
509
+ value: alpha.value,
510
+ onInput: alphaChange
511
+ }, null, 40, _hoisted_17)
512
+ ]),
513
+ _cache[6] || (_cache[6] = createElementVNode("p", null, "A", -1))
514
+ ])
515
+ ]),
516
+ createElementVNode("div", _hoisted_18, [
517
+ _cache[7] || (_cache[7] = createElementVNode("div", { class: "title" }, "推荐颜色", -1)),
518
+ createElementVNode("ul", _hoisted_19, [
519
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.preset, (item) => {
520
+ return openBlock(), createElementBlock("li", {
521
+ key: item,
522
+ style: normalizeStyle(`background-color: ${item}`),
523
+ onClick: ($event) => presetChange(item)
524
+ }, null, 12, _hoisted_20);
525
+ }), 128))
526
+ ])
527
+ ])
528
+ ], 4)
529
+ ]),
530
+ default: withCtx(() => [
531
+ __props.useTrigger ? renderSlot(_ctx.$slots, "trigger", { key: 0 }, void 0, true) : (openBlock(), createElementBlock("div", _hoisted_1, [
532
+ createElementVNode("div", _hoisted_2, [
533
+ createElementVNode("div", _hoisted_3, [
534
+ renderSlot(_ctx.$slots, "icon", {}, void 0, true)
535
+ ])
536
+ ])
537
+ ]))
538
+ ]),
539
+ _: 3
540
+ }, 8, ["placement"]);
541
+ };
542
+ }
543
+ });
544
+
545
+ export { _sfc_main as default };