@teammodlr/ui-kit 3.0.0-beta.11 → 3.0.0-beta.12
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.
- package/lib/components/colorpicker/ColorPicker.vue.d.ts +0 -1
- package/lib/index.cjs.js +3 -3
- package/lib/index.es.js +2579 -2571
- package/package.json +1 -1
- package/src/components/colorpicker/ColorPicker.vue +6 -9
- package/src/components/colorpicker/examples/basic.vue +8 -17
- package/src/components/messageprovider/MessageProvider.vue +33 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div ref="wrapper" class="m-color-picker">
|
|
3
|
-
<PopoverRoot v-model:open="isOpen"
|
|
3
|
+
<PopoverRoot v-model:open="isOpen">
|
|
4
4
|
<PopoverTrigger as-child>
|
|
5
5
|
<div ref="referenceRef">
|
|
6
6
|
<slot :r="finalColor.r" :g="finalColor.g" :b="finalColor.b" :a="finalColor.a" :hex="hexInput"
|
|
@@ -441,15 +441,13 @@ export default defineComponent({
|
|
|
441
441
|
updateFromHex();
|
|
442
442
|
};
|
|
443
443
|
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
if (wasOpen && !value) {
|
|
444
|
+
watch(isOpen, (open, wasOpen) => {
|
|
445
|
+
console.log('[ColorPicker] isOpen watch:', { wasOpen, open, hexInput: hexInput.value });
|
|
446
|
+
if (wasOpen && !open) {
|
|
447
|
+
console.log('[ColorPicker] Emitting onColorChange:', hexInput.value);
|
|
450
448
|
emit('onColorChange', hexInput.value);
|
|
451
449
|
}
|
|
452
|
-
};
|
|
450
|
+
});
|
|
453
451
|
|
|
454
452
|
|
|
455
453
|
return {
|
|
@@ -485,7 +483,6 @@ export default defineComponent({
|
|
|
485
483
|
transfer,
|
|
486
484
|
canPickColor,
|
|
487
485
|
openEyeDropper,
|
|
488
|
-
handleOpenChange,
|
|
489
486
|
onSliderChangeComplete,
|
|
490
487
|
hexInputUser,
|
|
491
488
|
toggleInherit,
|
|
@@ -12,22 +12,13 @@
|
|
|
12
12
|
</div>
|
|
13
13
|
</template>
|
|
14
14
|
|
|
15
|
-
<script>
|
|
16
|
-
|
|
17
|
-
data() {
|
|
18
|
-
return {
|
|
19
|
-
colorValue: 'rgba(0,0,0,50%)' // Initial color value
|
|
20
|
-
};
|
|
21
|
-
},
|
|
22
|
-
setup() {
|
|
23
|
-
const updateColor = (color) => {
|
|
24
|
-
console.log(color);
|
|
25
|
-
debugger;
|
|
26
|
-
}
|
|
15
|
+
<script setup>
|
|
16
|
+
import { ref } from 'vue';
|
|
27
17
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
18
|
+
const colorValue = ref('rgba(0,0,0,50%)');
|
|
19
|
+
|
|
20
|
+
function updateColor(color) {
|
|
21
|
+
console.log(color);
|
|
22
|
+
colorValue.value = color;
|
|
23
|
+
}
|
|
33
24
|
</script>
|
|
@@ -64,7 +64,7 @@ export default defineComponent({
|
|
|
64
64
|
},
|
|
65
65
|
},
|
|
66
66
|
setup(props) {
|
|
67
|
-
const activeMessages = new Map<string, { stop: () => void; closed: boolean; onClose?: () => void }>();
|
|
67
|
+
const activeMessages = new Map<string, { stop: () => void; closed: boolean; currentId: string; onClose?: () => void }>();
|
|
68
68
|
|
|
69
69
|
const sonnerPosition = computed(() => placementMap[props.placement]);
|
|
70
70
|
|
|
@@ -100,9 +100,9 @@ export default defineComponent({
|
|
|
100
100
|
return timeout ?? props.timeout;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
function
|
|
103
|
+
function createToast(message: PrivateMessageReactive, sonnerId: string) {
|
|
104
104
|
const options: ExternalToast = {
|
|
105
|
-
id:
|
|
105
|
+
id: sonnerId,
|
|
106
106
|
duration: normalizeDuration(message.timeout),
|
|
107
107
|
closeButton: message.closeButton ?? message.closable,
|
|
108
108
|
richColors: message.richColors,
|
|
@@ -111,10 +111,6 @@ export default defineComponent({
|
|
|
111
111
|
onAutoClose: () => closeMessage(message.id, true),
|
|
112
112
|
};
|
|
113
113
|
|
|
114
|
-
if (isUpdate) {
|
|
115
|
-
toast.dismiss(message.id);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
114
|
switch (message.type) {
|
|
119
115
|
case 'success':
|
|
120
116
|
toast.success(message.content, options);
|
|
@@ -137,6 +133,23 @@ export default defineComponent({
|
|
|
137
133
|
}
|
|
138
134
|
}
|
|
139
135
|
|
|
136
|
+
function syncToast(message: PrivateMessageReactive) {
|
|
137
|
+
const active = activeMessages.get(message.id);
|
|
138
|
+
if (!active) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const oldId = active.currentId;
|
|
143
|
+
const newId = Math.random().toString(16).slice(2, 14);
|
|
144
|
+
active.currentId = newId;
|
|
145
|
+
|
|
146
|
+
toast.dismiss(oldId);
|
|
147
|
+
|
|
148
|
+
requestAnimationFrame(() => {
|
|
149
|
+
createToast(message, newId);
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
|
|
140
153
|
function closeMessage(id: string, invokeOnClose: boolean) {
|
|
141
154
|
const active = activeMessages.get(id);
|
|
142
155
|
if (!active || active.closed) {
|
|
@@ -168,20 +181,29 @@ export default defineComponent({
|
|
|
168
181
|
type: options.type,
|
|
169
182
|
onClose: options.onClose,
|
|
170
183
|
destroy: () => {
|
|
184
|
+
const active = activeMessages.get(id);
|
|
185
|
+
const sonnerId = active?.currentId ?? id;
|
|
171
186
|
closeMessage(id, false);
|
|
172
|
-
toast.dismiss(
|
|
187
|
+
toast.dismiss(sonnerId);
|
|
173
188
|
},
|
|
174
189
|
}) as PrivateMessageReactive;
|
|
175
190
|
|
|
191
|
+
const sonnerId = Math.random().toString(16).slice(2, 14);
|
|
192
|
+
activeMessages.set(id, { stop: () => {}, closed: false, currentId: sonnerId, onClose: options.onClose });
|
|
193
|
+
|
|
176
194
|
const stop = watch(
|
|
177
195
|
() => [message.content, message.type, message.timeout, message.closable, message.closeButton, message.richColors, sonnerPosition.value],
|
|
178
|
-
(
|
|
179
|
-
|
|
196
|
+
(_, oldVal) => {
|
|
197
|
+
if (!oldVal) {
|
|
198
|
+
createToast(message, activeMessages.get(id)!.currentId);
|
|
199
|
+
} else {
|
|
200
|
+
syncToast(message);
|
|
201
|
+
}
|
|
180
202
|
},
|
|
181
203
|
{ immediate: true }
|
|
182
204
|
);
|
|
183
205
|
|
|
184
|
-
activeMessages.
|
|
206
|
+
activeMessages.get(id)!.stop = stop;
|
|
185
207
|
|
|
186
208
|
return message;
|
|
187
209
|
}
|