@youcan/celeste 0.6.71 → 0.6.73
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/dist/celeste.css +7 -6
- package/dist/cjs/alert.js +32 -32
- package/dist/cjs/badge.js +12 -12
- package/dist/cjs/button.js +6 -6
- package/dist/cjs/checkbox-card.js +33 -33
- package/dist/cjs/checkbox-label.js +31 -31
- package/dist/cjs/chunks/alpha-slider.js +12 -12
- package/dist/cjs/chunks/checkbox.js +7 -7
- package/dist/cjs/chunks/collapsible-content.js +6 -6
- package/dist/cjs/chunks/collapsible-trigger.js +5 -5
- package/dist/cjs/chunks/collapsible.js +6 -6
- package/dist/cjs/chunks/combobox-anchor.js +8 -8
- package/dist/cjs/chunks/content-divider.vue_vue_type_style_index_0_lang.js +15 -15
- package/dist/cjs/chunks/counter-input.js +13 -13
- package/dist/cjs/chunks/dropdown-menu-sub.js +6 -6
- package/dist/cjs/chunks/index.js +2289 -2292
- package/dist/cjs/chunks/index2.js +14 -14
- package/dist/cjs/chunks/index3.js +28 -28
- package/dist/cjs/chunks/index4.js +96 -125
- package/dist/cjs/chunks/index5.js +3381 -4086
- package/dist/cjs/chunks/modal-close.js +5 -5
- package/dist/cjs/chunks/modal-trigger.js +5 -5
- package/dist/cjs/chunks/modal.js +6 -6
- package/dist/cjs/chunks/pagination-first.js +9 -9
- package/dist/cjs/chunks/pagination-item.js +6 -6
- package/dist/cjs/chunks/pagination-last.js +9 -9
- package/dist/cjs/chunks/pagination-next.js +9 -9
- package/dist/cjs/chunks/pagination-previous.js +9 -9
- package/dist/cjs/chunks/popover.js +6 -6
- package/dist/cjs/chunks/radio-group-item.js +7 -7
- package/dist/cjs/chunks/radio-group.js +8 -8
- package/dist/cjs/chunks/rich-editor.vue_vue_type_style_index_0_scoped_dbc85b1a_lang.js +45 -742
- package/dist/cjs/chunks/scroll-area.js +11 -11
- package/dist/cjs/chunks/select-group.js +5 -5
- package/dist/cjs/chunks/select.js +7 -7
- package/dist/cjs/chunks/sheet-trigger.js +5 -5
- package/dist/cjs/chunks/sheet.js +6 -6
- package/dist/cjs/chunks/sidebar-content.js +5 -5
- package/dist/cjs/chunks/sidebar-element.js +6 -6
- package/dist/cjs/chunks/sidebar-footer.js +5 -5
- package/dist/cjs/chunks/sidebar-group-label.js +6 -6
- package/dist/cjs/chunks/sidebar-group.js +5 -5
- package/dist/cjs/chunks/sidebar-header.js +5 -5
- package/dist/cjs/chunks/sidebar-menu-action.js +6 -6
- package/dist/cjs/chunks/sidebar-menu-badge.js +4 -4
- package/dist/cjs/chunks/sidebar-menu-button.js +7 -7
- package/dist/cjs/chunks/sidebar-menu-item.js +5 -5
- package/dist/cjs/chunks/sidebar-menu-sub-button.js +6 -6
- package/dist/cjs/chunks/sidebar-menu-sub-item.js +5 -5
- package/dist/cjs/chunks/sidebar-menu-sub.js +5 -5
- package/dist/cjs/chunks/sidebar-menu.js +5 -5
- package/dist/cjs/chunks/sidebar-provider.vue_vue_type_style_index_0_lang.js +9 -9
- package/dist/cjs/chunks/sidebar-separator.vue_vue_type_style_index_0_lang.js +4 -4
- package/dist/cjs/chunks/sidebar.js +21 -21
- package/dist/cjs/chunks/slider.js +11 -11
- package/dist/cjs/chunks/sonner.js +146 -214
- package/dist/cjs/chunks/switch.js +7 -7
- package/dist/cjs/chunks/tinycolor.js +2 -2
- package/dist/cjs/chunks/tooltip-provider.js +5 -5
- package/dist/cjs/chunks/tooltip-root.js +7 -7
- package/dist/cjs/chunks/tooltip-trigger.js +6 -6
- package/dist/cjs/chunks/tooltip.js +12 -12
- package/dist/cjs/color-area.js +16 -16
- package/dist/cjs/color-picker.js +102 -102
- package/dist/cjs/color-swatch.js +11 -11
- package/dist/cjs/combobox-empty.js +7 -7
- package/dist/cjs/combobox-group.js +11 -11
- package/dist/cjs/combobox-input.js +12 -12
- package/dist/cjs/combobox-item.js +24 -24
- package/dist/cjs/combobox-list.js +12 -12
- package/dist/cjs/combobox-root.js +6 -7
- package/dist/cjs/combobox-separator.js +7 -7
- package/dist/cjs/combobox-trigger.js +8 -8
- package/dist/cjs/combobox.js +53 -54
- package/dist/cjs/command-group.js +10 -10
- package/dist/cjs/command-input.js +8 -8
- package/dist/cjs/command-item.js +7 -7
- package/dist/cjs/command-list.js +8 -8
- package/dist/cjs/command-root.js +7 -8
- package/dist/cjs/command-separator.js +7 -7
- package/dist/cjs/compact-button.js +7 -7
- package/dist/cjs/config.js +2 -2
- package/dist/cjs/digit-input-group.js +7 -7
- package/dist/cjs/digit-input-slot.js +5 -5
- package/dist/cjs/digit-input.js +7 -7
- package/dist/cjs/dropdown-menu-content.js +9 -9
- package/dist/cjs/dropdown-menu-group.js +5 -5
- package/dist/cjs/dropdown-menu-item.js +14 -14
- package/dist/cjs/dropdown-menu-label.js +7 -7
- package/dist/cjs/dropdown-menu-separator.js +4 -4
- package/dist/cjs/dropdown-menu-sub-content.js +9 -9
- package/dist/cjs/dropdown-menu-sub-trigger.js +12 -12
- package/dist/cjs/dropdown-menu-trigger.js +6 -6
- package/dist/cjs/dropdown-menu.js +7 -7
- package/dist/cjs/extra-settings.js +21 -21
- package/dist/cjs/fancy-button.js +6 -6
- package/dist/cjs/file-upload-area.js +22 -22
- package/dist/cjs/hint-text.js +8 -8
- package/dist/cjs/hue-slider.js +15 -15
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/label.js +13 -13
- package/dist/cjs/link-bubble.js +40 -40
- package/dist/cjs/link-button.js +6 -6
- package/dist/cjs/modal-body.js +5 -5
- package/dist/cjs/modal-content.js +12 -12
- package/dist/cjs/modal-footer.js +5 -5
- package/dist/cjs/modal-header.js +22 -22
- package/dist/cjs/pagination-content.js +6 -6
- package/dist/cjs/pagination-ellipsis.js +8 -8
- package/dist/cjs/pagination.js +14 -14
- package/dist/cjs/popover-content.js +30 -30
- package/dist/cjs/popover-trigger.js +5 -5
- package/dist/cjs/progress-bar.js +19 -19
- package/dist/cjs/progress-circle.js +20 -20
- package/dist/cjs/radio-group-card.js +33 -33
- package/dist/cjs/radio-group-label.js +31 -31
- package/dist/cjs/rich-editor.js +76 -76
- package/dist/cjs/scroll-bar.js +7 -7
- package/dist/cjs/segmented-control-item.js +8 -6
- package/dist/cjs/segmented-control.js +8 -8
- package/dist/cjs/select-content.js +11 -11
- package/dist/cjs/select-icon.js +5 -5
- package/dist/cjs/select-item.js +11 -11
- package/dist/cjs/select-label.js +6 -6
- package/dist/cjs/select-separator.js +4 -4
- package/dist/cjs/select-trigger.js +9 -9
- package/dist/cjs/select-value.js +6 -6
- package/dist/cjs/sheet-close.js +6 -6
- package/dist/cjs/sheet-content.js +14 -14
- package/dist/cjs/sheet-description.js +7 -7
- package/dist/cjs/sheet-footer.js +6 -6
- package/dist/cjs/sheet-header.js +5 -5
- package/dist/cjs/sheet-title.js +7 -7
- package/dist/cjs/sidebar-group-content.js +5 -5
- package/dist/cjs/sidebar-trigger.js +7 -7
- package/dist/cjs/social-button.js +8 -8
- package/dist/cjs/sonner-alert.js +8 -8
- package/dist/cjs/status-badge.js +8 -8
- package/dist/cjs/tab-menu-content.js +7 -7
- package/dist/cjs/tab-menu-item.js +11 -11
- package/dist/cjs/tab-menu-list.js +6 -6
- package/dist/cjs/tab-menu.js +6 -6
- package/dist/cjs/table-body.js +5 -5
- package/dist/cjs/table-caption.js +5 -5
- package/dist/cjs/table-cell.js +5 -5
- package/dist/cjs/table-empty.js +9 -9
- package/dist/cjs/table-footer.js +5 -5
- package/dist/cjs/table-head.js +5 -5
- package/dist/cjs/table-header.js +5 -5
- package/dist/cjs/table-row.js +8 -8
- package/dist/cjs/table.js +6 -6
- package/dist/cjs/tag.js +10 -10
- package/dist/cjs/text-input-affix.js +5 -5
- package/dist/cjs/text-input-button.js +6 -6
- package/dist/cjs/text-input.js +31 -31
- package/dist/cjs/textarea.js +9 -9
- package/dist/cjs/tooltip-content.js +20 -20
- package/dist/cjs/use-color-model.js +2 -2
- package/dist/cjs/use-delegated-props.js +2 -2
- package/dist/cjs/use-sidebar.js +1 -1
- package/dist/cjs/use-user-select.js +4 -4
- package/dist/components/color-picker/alpha-slider.d.ts +1 -1
- package/dist/components/color-picker/color-area.d.ts +1 -1
- package/dist/components/color-picker/hue-slider.d.ts +1 -1
- package/dist/components/file-upload/file-upload-area.d.ts +2 -4
- package/dist/components/rich-editor/link-bubble.d.ts +1 -3
- package/dist/es/alert.js +1 -1
- package/dist/es/badge.js +1 -1
- package/dist/es/button.js +2 -2
- package/dist/es/checkbox-card.js +3 -3
- package/dist/es/checkbox-label.js +3 -3
- package/dist/es/chunks/alpha-slider.js +1 -1
- package/dist/es/chunks/checkbox.js +5 -5
- package/dist/es/chunks/collapsible-content.js +3 -3
- package/dist/es/chunks/collapsible-trigger.js +3 -3
- package/dist/es/chunks/collapsible.js +4 -4
- package/dist/es/chunks/combobox-anchor.js +4 -4
- package/dist/es/chunks/content-divider.vue_vue_type_style_index_0_lang.js +3 -3
- package/dist/es/chunks/counter-input.js +7 -7
- package/dist/es/chunks/dropdown-menu-sub.js +4 -4
- package/dist/es/chunks/index.js +1153 -1156
- package/dist/es/chunks/index2.js +3 -3
- package/dist/es/chunks/index3.js +2 -2
- package/dist/es/chunks/index4.js +90 -119
- package/dist/es/chunks/index5.js +3394 -4099
- package/dist/es/chunks/modal-close.js +3 -3
- package/dist/es/chunks/modal-trigger.js +3 -3
- package/dist/es/chunks/modal.js +4 -4
- package/dist/es/chunks/pagination-first.js +4 -4
- package/dist/es/chunks/pagination-item.js +3 -3
- package/dist/es/chunks/pagination-last.js +4 -4
- package/dist/es/chunks/pagination-next.js +4 -4
- package/dist/es/chunks/pagination-previous.js +4 -4
- package/dist/es/chunks/popover.js +4 -4
- package/dist/es/chunks/radio-group-item.js +5 -5
- package/dist/es/chunks/radio-group.js +4 -4
- package/dist/es/chunks/rich-editor.vue_vue_type_style_index_0_scoped_dbc85b1a_lang.js +46 -743
- package/dist/es/chunks/scroll-area.js +5 -5
- package/dist/es/chunks/select-group.js +3 -3
- package/dist/es/chunks/select.js +4 -4
- package/dist/es/chunks/sheet-trigger.js +3 -3
- package/dist/es/chunks/sheet.js +4 -4
- package/dist/es/chunks/sidebar-content.js +1 -1
- package/dist/es/chunks/sidebar-element.js +2 -2
- package/dist/es/chunks/sidebar-footer.js +1 -1
- package/dist/es/chunks/sidebar-group-label.js +2 -2
- package/dist/es/chunks/sidebar-group.js +1 -1
- package/dist/es/chunks/sidebar-header.js +1 -1
- package/dist/es/chunks/sidebar-menu-action.js +2 -2
- package/dist/es/chunks/sidebar-menu-badge.js +1 -1
- package/dist/es/chunks/sidebar-menu-button.js +2 -2
- package/dist/es/chunks/sidebar-menu-item.js +1 -1
- package/dist/es/chunks/sidebar-menu-sub-button.js +2 -2
- package/dist/es/chunks/sidebar-menu-sub-item.js +1 -1
- package/dist/es/chunks/sidebar-menu-sub.js +1 -1
- package/dist/es/chunks/sidebar-menu.js +1 -1
- package/dist/es/chunks/sidebar-provider.vue_vue_type_style_index_0_lang.js +3 -3
- package/dist/es/chunks/sidebar-separator.vue_vue_type_style_index_0_lang.js +1 -1
- package/dist/es/chunks/sidebar.js +1 -1
- package/dist/es/chunks/slider.js +7 -7
- package/dist/es/chunks/sonner.js +29 -97
- package/dist/es/chunks/switch.js +5 -5
- package/dist/es/chunks/tinycolor.js +2 -2
- package/dist/es/chunks/tooltip-provider.js +3 -3
- package/dist/es/chunks/tooltip-root.js +4 -4
- package/dist/es/chunks/tooltip-trigger.js +4 -4
- package/dist/es/chunks/tooltip.js +3 -3
- package/dist/es/color-area.js +2 -2
- package/dist/es/color-picker.js +5 -5
- package/dist/es/color-swatch.js +1 -1
- package/dist/es/combobox-empty.js +3 -3
- package/dist/es/combobox-group.js +4 -4
- package/dist/es/combobox-input.js +3 -3
- package/dist/es/combobox-item.js +4 -4
- package/dist/es/combobox-list.js +6 -6
- package/dist/es/combobox-root.js +4 -5
- package/dist/es/combobox-separator.js +3 -3
- package/dist/es/combobox-trigger.js +4 -4
- package/dist/es/combobox.js +3 -4
- package/dist/es/command-group.js +4 -4
- package/dist/es/command-input.js +4 -4
- package/dist/es/command-item.js +4 -4
- package/dist/es/command-list.js +4 -4
- package/dist/es/command-root.js +4 -5
- package/dist/es/command-separator.js +3 -3
- package/dist/es/compact-button.js +2 -2
- package/dist/es/digit-input-group.js +3 -3
- package/dist/es/digit-input-slot.js +4 -4
- package/dist/es/digit-input.js +4 -4
- package/dist/es/dropdown-menu-content.js +5 -5
- package/dist/es/dropdown-menu-group.js +3 -3
- package/dist/es/dropdown-menu-item.js +4 -4
- package/dist/es/dropdown-menu-label.js +4 -4
- package/dist/es/dropdown-menu-separator.js +3 -3
- package/dist/es/dropdown-menu-sub-content.js +5 -5
- package/dist/es/dropdown-menu-sub-trigger.js +4 -4
- package/dist/es/dropdown-menu-trigger.js +4 -4
- package/dist/es/dropdown-menu.js +4 -4
- package/dist/es/extra-settings.js +1 -1
- package/dist/es/fancy-button.js +2 -2
- package/dist/es/file-upload-area.js +1 -1
- package/dist/es/hint-text.js +1 -1
- package/dist/es/hue-slider.js +3 -3
- package/dist/es/index.js +3 -3
- package/dist/es/label.js +3 -3
- package/dist/es/link-bubble.js +1 -1
- package/dist/es/link-button.js +2 -2
- package/dist/es/modal-body.js +1 -1
- package/dist/es/modal-content.js +6 -6
- package/dist/es/modal-footer.js +1 -1
- package/dist/es/modal-header.js +5 -5
- package/dist/es/pagination-content.js +3 -3
- package/dist/es/pagination-ellipsis.js +3 -3
- package/dist/es/pagination.js +4 -4
- package/dist/es/popover-content.js +7 -7
- package/dist/es/popover-trigger.js +3 -3
- package/dist/es/progress-bar.js +4 -4
- package/dist/es/progress-circle.js +4 -4
- package/dist/es/radio-group-card.js +3 -3
- package/dist/es/radio-group-label.js +3 -3
- package/dist/es/rich-editor.js +4 -4
- package/dist/es/scroll-bar.js +4 -4
- package/dist/es/segmented-control-item.js +5 -3
- package/dist/es/segmented-control.js +4 -4
- package/dist/es/select-content.js +6 -6
- package/dist/es/select-icon.js +1 -1
- package/dist/es/select-item.js +5 -5
- package/dist/es/select-label.js +3 -3
- package/dist/es/select-separator.js +3 -3
- package/dist/es/select-trigger.js +4 -4
- package/dist/es/select-value.js +3 -3
- package/dist/es/sheet-close.js +3 -3
- package/dist/es/sheet-content.js +7 -7
- package/dist/es/sheet-description.js +3 -3
- package/dist/es/sheet-footer.js +1 -1
- package/dist/es/sheet-header.js +1 -1
- package/dist/es/sheet-title.js +3 -3
- package/dist/es/sidebar-group-content.js +1 -1
- package/dist/es/sidebar-trigger.js +1 -1
- package/dist/es/social-button.js +2 -2
- package/dist/es/sonner-alert.js +1 -1
- package/dist/es/status-badge.js +1 -1
- package/dist/es/tab-menu-content.js +3 -3
- package/dist/es/tab-menu-item.js +4 -4
- package/dist/es/tab-menu-list.js +3 -3
- package/dist/es/tab-menu.js +4 -4
- package/dist/es/table-body.js +1 -1
- package/dist/es/table-caption.js +1 -1
- package/dist/es/table-cell.js +1 -1
- package/dist/es/table-empty.js +1 -1
- package/dist/es/table-footer.js +1 -1
- package/dist/es/table-head.js +1 -1
- package/dist/es/table-header.js +1 -1
- package/dist/es/table-row.js +1 -1
- package/dist/es/table.js +1 -1
- package/dist/es/tag.js +2 -2
- package/dist/es/text-input-affix.js +1 -1
- package/dist/es/text-input-button.js +1 -1
- package/dist/es/text-input.js +2 -2
- package/dist/es/textarea.js +1 -1
- package/dist/es/tooltip-content.js +6 -6
- package/dist/es/use-sidebar.js +2 -2
- package/package.json +3 -3
- package/src/components/slider/slider.vue +3 -3
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const
|
|
2
|
+
const Mo = require("vue");
|
|
3
3
|
function tryOnScopeDispose(fn) {
|
|
4
|
-
if (
|
|
5
|
-
|
|
4
|
+
if (Mo.getCurrentScope()) {
|
|
5
|
+
Mo.onScopeDispose(fn);
|
|
6
6
|
return true;
|
|
7
7
|
}
|
|
8
8
|
return false;
|
|
@@ -11,22 +11,22 @@ const localProvidedStateMap = /* @__PURE__ */ new WeakMap();
|
|
|
11
11
|
const injectLocal = /* @__NO_SIDE_EFFECTS__ */ (...args) => {
|
|
12
12
|
var _a;
|
|
13
13
|
const key = args[0];
|
|
14
|
-
const instance = (_a =
|
|
15
|
-
if (instance == null && !
|
|
14
|
+
const instance = (_a = Mo.getCurrentInstance()) == null ? void 0 : _a.proxy;
|
|
15
|
+
if (instance == null && !Mo.hasInjectionContext())
|
|
16
16
|
throw new Error("injectLocal must be called in setup");
|
|
17
17
|
if (instance && localProvidedStateMap.has(instance) && key in localProvidedStateMap.get(instance))
|
|
18
18
|
return localProvidedStateMap.get(instance)[key];
|
|
19
|
-
return
|
|
19
|
+
return Mo.inject(...args);
|
|
20
20
|
};
|
|
21
21
|
function toReactive(objectRef) {
|
|
22
|
-
if (!
|
|
23
|
-
return
|
|
22
|
+
if (!Mo.isRef(objectRef))
|
|
23
|
+
return Mo.reactive(objectRef);
|
|
24
24
|
const proxy = new Proxy({}, {
|
|
25
25
|
get(_, p, receiver) {
|
|
26
|
-
return
|
|
26
|
+
return Mo.unref(Reflect.get(objectRef.value, p, receiver));
|
|
27
27
|
},
|
|
28
28
|
set(_, p, value) {
|
|
29
|
-
if (
|
|
29
|
+
if (Mo.isRef(objectRef.value[p]) && !Mo.isRef(value))
|
|
30
30
|
objectRef.value[p].value = value;
|
|
31
31
|
else
|
|
32
32
|
objectRef.value[p] = value;
|
|
@@ -48,15 +48,15 @@ function toReactive(objectRef) {
|
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
|
-
return
|
|
51
|
+
return Mo.reactive(proxy);
|
|
52
52
|
}
|
|
53
53
|
function reactiveComputed(fn) {
|
|
54
|
-
return toReactive(
|
|
54
|
+
return toReactive(Mo.computed(fn));
|
|
55
55
|
}
|
|
56
56
|
function reactiveOmit(obj, ...keys) {
|
|
57
57
|
const flatKeys = keys.flat();
|
|
58
58
|
const predicate = flatKeys[0];
|
|
59
|
-
return reactiveComputed(() => typeof predicate === "function" ? Object.fromEntries(Object.entries(
|
|
59
|
+
return reactiveComputed(() => typeof predicate === "function" ? Object.fromEntries(Object.entries(Mo.toRefs(obj)).filter(([k, v]) => !predicate(Mo.toValue(v), k))) : Object.fromEntries(Object.entries(Mo.toRefs(obj)).filter((e) => !flatKeys.includes(e[0]))));
|
|
60
60
|
}
|
|
61
61
|
const isClient = typeof window !== "undefined" && typeof document !== "undefined";
|
|
62
62
|
typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
|
|
@@ -70,7 +70,7 @@ function toArray(value) {
|
|
|
70
70
|
return Array.isArray(value) ? value : [value];
|
|
71
71
|
}
|
|
72
72
|
function watchImmediate(source, cb, options) {
|
|
73
|
-
return
|
|
73
|
+
return Mo.watch(
|
|
74
74
|
source,
|
|
75
75
|
cb,
|
|
76
76
|
{
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const index = require("./index2.js");
|
|
3
|
-
const
|
|
3
|
+
const Mo = require("vue");
|
|
4
4
|
const defaultWindow = index.isClient ? window : void 0;
|
|
5
5
|
const defaultDocument = index.isClient ? window.document : void 0;
|
|
6
6
|
function unrefElement(elRef) {
|
|
7
7
|
var _a;
|
|
8
|
-
const plain =
|
|
8
|
+
const plain = Mo.toValue(elRef);
|
|
9
9
|
return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
|
|
10
10
|
}
|
|
11
11
|
function useEventListener(...args) {
|
|
@@ -18,8 +18,8 @@ function useEventListener(...args) {
|
|
|
18
18
|
el.addEventListener(event, listener, options);
|
|
19
19
|
return () => el.removeEventListener(event, listener, options);
|
|
20
20
|
};
|
|
21
|
-
const firstParamTargets =
|
|
22
|
-
const test = index.toArray(
|
|
21
|
+
const firstParamTargets = Mo.computed(() => {
|
|
22
|
+
const test = index.toArray(Mo.toValue(args[0])).filter((e) => e != null);
|
|
23
23
|
return test.every((e) => typeof e !== "string") ? test : void 0;
|
|
24
24
|
});
|
|
25
25
|
const stopWatch = index.watchImmediate(
|
|
@@ -27,10 +27,10 @@ function useEventListener(...args) {
|
|
|
27
27
|
var _a, _b;
|
|
28
28
|
return [
|
|
29
29
|
(_b = (_a = firstParamTargets.value) == null ? void 0 : _a.map((e) => unrefElement(e))) != null ? _b : [defaultWindow].filter((e) => e != null),
|
|
30
|
-
index.toArray(
|
|
31
|
-
index.toArray(
|
|
30
|
+
index.toArray(Mo.toValue(firstParamTargets.value ? args[1] : args[0])),
|
|
31
|
+
index.toArray(Mo.unref(firstParamTargets.value ? args[2] : args[1])),
|
|
32
32
|
// @ts-expect-error - TypeScript gets the correct types, but somehow still complains
|
|
33
|
-
|
|
33
|
+
Mo.toValue(firstParamTargets.value ? args[3] : args[2])
|
|
34
34
|
];
|
|
35
35
|
},
|
|
36
36
|
([raw_targets, raw_events, raw_listeners, raw_options]) => {
|
|
@@ -57,10 +57,10 @@ function useEventListener(...args) {
|
|
|
57
57
|
}
|
|
58
58
|
// @__NO_SIDE_EFFECTS__
|
|
59
59
|
function useMounted() {
|
|
60
|
-
const isMounted =
|
|
61
|
-
const instance =
|
|
60
|
+
const isMounted = Mo.shallowRef(false);
|
|
61
|
+
const instance = Mo.getCurrentInstance();
|
|
62
62
|
if (instance) {
|
|
63
|
-
|
|
63
|
+
Mo.onMounted(() => {
|
|
64
64
|
isMounted.value = true;
|
|
65
65
|
}, instance);
|
|
66
66
|
}
|
|
@@ -69,7 +69,7 @@ function useMounted() {
|
|
|
69
69
|
// @__NO_SIDE_EFFECTS__
|
|
70
70
|
function useSupported(callback) {
|
|
71
71
|
const isMounted = /* @__PURE__ */ useMounted();
|
|
72
|
-
return
|
|
72
|
+
return Mo.computed(() => {
|
|
73
73
|
isMounted.value;
|
|
74
74
|
return Boolean(callback());
|
|
75
75
|
});
|
|
@@ -77,22 +77,22 @@ function useSupported(callback) {
|
|
|
77
77
|
const ssrWidthSymbol = Symbol("vueuse-ssr-width");
|
|
78
78
|
// @__NO_SIDE_EFFECTS__
|
|
79
79
|
function useSSRWidth() {
|
|
80
|
-
const ssrWidth =
|
|
80
|
+
const ssrWidth = Mo.hasInjectionContext() ? index.injectLocal(ssrWidthSymbol, null) : null;
|
|
81
81
|
return typeof ssrWidth === "number" ? ssrWidth : void 0;
|
|
82
82
|
}
|
|
83
83
|
function useMediaQuery(query, options = {}) {
|
|
84
84
|
const { window: window2 = defaultWindow, ssrWidth = /* @__PURE__ */ useSSRWidth() } = options;
|
|
85
85
|
const isSupported = /* @__PURE__ */ useSupported(() => window2 && "matchMedia" in window2 && typeof window2.matchMedia === "function");
|
|
86
|
-
const ssrSupport =
|
|
87
|
-
const mediaQuery =
|
|
88
|
-
const matches =
|
|
86
|
+
const ssrSupport = Mo.shallowRef(typeof ssrWidth === "number");
|
|
87
|
+
const mediaQuery = Mo.shallowRef();
|
|
88
|
+
const matches = Mo.shallowRef(false);
|
|
89
89
|
const handler = (event) => {
|
|
90
90
|
matches.value = event.matches;
|
|
91
91
|
};
|
|
92
|
-
|
|
92
|
+
Mo.watchEffect(() => {
|
|
93
93
|
if (ssrSupport.value) {
|
|
94
94
|
ssrSupport.value = !isSupported.value;
|
|
95
|
-
const queryStrings =
|
|
95
|
+
const queryStrings = Mo.toValue(query).split(",");
|
|
96
96
|
matches.value = queryStrings.some((queryString) => {
|
|
97
97
|
const not = queryString.includes("not all");
|
|
98
98
|
const minWidth = queryString.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
|
|
@@ -110,19 +110,19 @@ function useMediaQuery(query, options = {}) {
|
|
|
110
110
|
}
|
|
111
111
|
if (!isSupported.value)
|
|
112
112
|
return;
|
|
113
|
-
mediaQuery.value = window2.matchMedia(
|
|
113
|
+
mediaQuery.value = window2.matchMedia(Mo.toValue(query));
|
|
114
114
|
matches.value = mediaQuery.value.matches;
|
|
115
115
|
});
|
|
116
116
|
useEventListener(mediaQuery, "change", handler, { passive: true });
|
|
117
|
-
return
|
|
117
|
+
return Mo.computed(() => matches.value);
|
|
118
118
|
}
|
|
119
119
|
function cloneFnJSON(source) {
|
|
120
120
|
return JSON.parse(JSON.stringify(source));
|
|
121
121
|
}
|
|
122
122
|
function useDropZone(target, options = {}) {
|
|
123
123
|
var _a, _b;
|
|
124
|
-
const isOverDropZone =
|
|
125
|
-
const files =
|
|
124
|
+
const isOverDropZone = Mo.shallowRef(false);
|
|
125
|
+
const files = Mo.shallowRef(null);
|
|
126
126
|
let counter = 0;
|
|
127
127
|
let isValid = true;
|
|
128
128
|
if (index.isClient) {
|
|
@@ -135,7 +135,7 @@ function useDropZone(target, options = {}) {
|
|
|
135
135
|
return list.length === 0 ? null : multiple ? list : [list[0]];
|
|
136
136
|
};
|
|
137
137
|
const checkDataTypes = (types) => {
|
|
138
|
-
const dataTypes =
|
|
138
|
+
const dataTypes = Mo.unref(_options.dataTypes);
|
|
139
139
|
if (typeof dataTypes === "function")
|
|
140
140
|
return dataTypes(types);
|
|
141
141
|
if (!(dataTypes == null ? void 0 : dataTypes.length))
|
|
@@ -217,7 +217,7 @@ function useVModel(props, key, emit, options = {}) {
|
|
|
217
217
|
defaultValue,
|
|
218
218
|
shouldEmit
|
|
219
219
|
} = options;
|
|
220
|
-
const vm =
|
|
220
|
+
const vm = Mo.getCurrentInstance();
|
|
221
221
|
const _emit = emit || (vm == null ? void 0 : vm.emit) || ((_a = vm == null ? void 0 : vm.$emit) == null ? void 0 : _a.bind(vm)) || ((_c = (_b = vm == null ? void 0 : vm.proxy) == null ? void 0 : _b.$emit) == null ? void 0 : _c.bind(vm == null ? void 0 : vm.proxy));
|
|
222
222
|
let event = eventName;
|
|
223
223
|
event = event || `update:${key.toString()}`;
|
|
@@ -233,19 +233,19 @@ function useVModel(props, key, emit, options = {}) {
|
|
|
233
233
|
};
|
|
234
234
|
if (passive) {
|
|
235
235
|
const initialValue = getValue();
|
|
236
|
-
const proxy =
|
|
236
|
+
const proxy = Mo.ref(initialValue);
|
|
237
237
|
let isUpdating = false;
|
|
238
|
-
|
|
238
|
+
Mo.watch(
|
|
239
239
|
() => props[key],
|
|
240
240
|
(v) => {
|
|
241
241
|
if (!isUpdating) {
|
|
242
242
|
isUpdating = true;
|
|
243
243
|
proxy.value = cloneFn(v);
|
|
244
|
-
|
|
244
|
+
Mo.nextTick(() => isUpdating = false);
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
247
|
);
|
|
248
|
-
|
|
248
|
+
Mo.watch(
|
|
249
249
|
proxy,
|
|
250
250
|
(v) => {
|
|
251
251
|
if (!isUpdating && (v !== props[key] || deep))
|
|
@@ -255,7 +255,7 @@ function useVModel(props, key, emit, options = {}) {
|
|
|
255
255
|
);
|
|
256
256
|
return proxy;
|
|
257
257
|
} else {
|
|
258
|
-
return
|
|
258
|
+
return Mo.computed({
|
|
259
259
|
get() {
|
|
260
260
|
return getValue();
|
|
261
261
|
},
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const index$1 = require("./index.js");
|
|
4
3
|
const index = require("./index5.js");
|
|
5
|
-
const
|
|
4
|
+
const index$1 = require("./index.js");
|
|
5
|
+
const Mo = require("vue");
|
|
6
6
|
var readFromCache;
|
|
7
7
|
var addToCache;
|
|
8
8
|
if (typeof WeakMap != "undefined") {
|
|
@@ -825,13 +825,10 @@ var BubbleMenuView = class {
|
|
|
825
825
|
updateDelay = 250,
|
|
826
826
|
resizeDelay = 60,
|
|
827
827
|
shouldShow,
|
|
828
|
-
appendTo,
|
|
829
|
-
getReferencedVirtualElement,
|
|
830
828
|
options
|
|
831
829
|
}) {
|
|
832
830
|
this.preventHide = false;
|
|
833
831
|
this.isVisible = false;
|
|
834
|
-
this.scrollTarget = window;
|
|
835
832
|
this.floatingUIOptions = {
|
|
836
833
|
strategy: "absolute",
|
|
837
834
|
placement: "top",
|
|
@@ -877,16 +874,12 @@ var BubbleMenuView = class {
|
|
|
877
874
|
setTimeout(() => this.update(this.editor.view));
|
|
878
875
|
};
|
|
879
876
|
this.blurHandler = ({ event }) => {
|
|
880
|
-
var
|
|
881
|
-
if (this.editor.isDestroyed) {
|
|
882
|
-
this.destroy();
|
|
883
|
-
return;
|
|
884
|
-
}
|
|
877
|
+
var _a;
|
|
885
878
|
if (this.preventHide) {
|
|
886
879
|
this.preventHide = false;
|
|
887
880
|
return;
|
|
888
881
|
}
|
|
889
|
-
if ((event == null ? void 0 : event.relatedTarget) && ((
|
|
882
|
+
if ((event == null ? void 0 : event.relatedTarget) && ((_a = this.element.parentNode) == null ? void 0 : _a.contains(event.relatedTarget))) {
|
|
890
883
|
return;
|
|
891
884
|
}
|
|
892
885
|
if ((event == null ? void 0 : event.relatedTarget) === this.editor.view.dom) {
|
|
@@ -921,21 +914,11 @@ var BubbleMenuView = class {
|
|
|
921
914
|
this.updatePosition();
|
|
922
915
|
this.show();
|
|
923
916
|
};
|
|
924
|
-
this.transactionHandler = ({ transaction: tr }) => {
|
|
925
|
-
const meta = tr.getMeta("bubbleMenu");
|
|
926
|
-
if (meta === "updatePosition") {
|
|
927
|
-
this.updatePosition();
|
|
928
|
-
}
|
|
929
|
-
};
|
|
930
|
-
var _a;
|
|
931
917
|
this.editor = editor;
|
|
932
918
|
this.element = element;
|
|
933
919
|
this.view = view;
|
|
934
920
|
this.updateDelay = updateDelay;
|
|
935
921
|
this.resizeDelay = resizeDelay;
|
|
936
|
-
this.appendTo = appendTo;
|
|
937
|
-
this.scrollTarget = (_a = options == null ? void 0 : options.scrollTarget) != null ? _a : window;
|
|
938
|
-
this.getReferencedVirtualElement = getReferencedVirtualElement;
|
|
939
922
|
this.floatingUIOptions = {
|
|
940
923
|
...this.floatingUIOptions,
|
|
941
924
|
...options
|
|
@@ -948,13 +931,10 @@ var BubbleMenuView = class {
|
|
|
948
931
|
this.view.dom.addEventListener("dragstart", this.dragstartHandler);
|
|
949
932
|
this.editor.on("focus", this.focusHandler);
|
|
950
933
|
this.editor.on("blur", this.blurHandler);
|
|
951
|
-
this.editor.on("transaction", this.transactionHandler);
|
|
952
934
|
window.addEventListener("resize", this.resizeHandler);
|
|
953
|
-
this.scrollTarget.addEventListener("scroll", this.resizeHandler);
|
|
954
935
|
this.update(view, view.state);
|
|
955
936
|
if (this.getShouldShow()) {
|
|
956
937
|
this.show();
|
|
957
|
-
this.updatePosition();
|
|
958
938
|
}
|
|
959
939
|
}
|
|
960
940
|
get middlewares() {
|
|
@@ -995,31 +975,13 @@ var BubbleMenuView = class {
|
|
|
995
975
|
}
|
|
996
976
|
return middlewares;
|
|
997
977
|
}
|
|
998
|
-
|
|
999
|
-
var _a;
|
|
978
|
+
updatePosition() {
|
|
1000
979
|
const { selection } = this.editor.state;
|
|
1001
|
-
const referencedVirtualElement = (_a = this.getReferencedVirtualElement) == null ? void 0 : _a.call(this);
|
|
1002
|
-
if (referencedVirtualElement) {
|
|
1003
|
-
return referencedVirtualElement;
|
|
1004
|
-
}
|
|
1005
980
|
const domRect = index.posToDOMRect(this.view, selection.from, selection.to);
|
|
1006
981
|
let virtualElement = {
|
|
1007
982
|
getBoundingClientRect: () => domRect,
|
|
1008
983
|
getClientRects: () => [domRect]
|
|
1009
984
|
};
|
|
1010
|
-
if (selection instanceof index.NodeSelection) {
|
|
1011
|
-
let node = this.view.nodeDOM(selection.from);
|
|
1012
|
-
const nodeViewWrapper = node.dataset.nodeViewWrapper ? node : node.querySelector("[data-node-view-wrapper]");
|
|
1013
|
-
if (nodeViewWrapper) {
|
|
1014
|
-
node = nodeViewWrapper;
|
|
1015
|
-
}
|
|
1016
|
-
if (node) {
|
|
1017
|
-
virtualElement = {
|
|
1018
|
-
getBoundingClientRect: () => node.getBoundingClientRect(),
|
|
1019
|
-
getClientRects: () => [node.getBoundingClientRect()]
|
|
1020
|
-
};
|
|
1021
|
-
}
|
|
1022
|
-
}
|
|
1023
985
|
if (selection instanceof CellSelection) {
|
|
1024
986
|
const { $anchorCell, $headCell } = selection;
|
|
1025
987
|
const from = $anchorCell ? $anchorCell.pos : $headCell.pos;
|
|
@@ -1038,13 +1000,6 @@ var BubbleMenuView = class {
|
|
|
1038
1000
|
getClientRects: () => [clientRect]
|
|
1039
1001
|
};
|
|
1040
1002
|
}
|
|
1041
|
-
return virtualElement;
|
|
1042
|
-
}
|
|
1043
|
-
updatePosition() {
|
|
1044
|
-
const virtualElement = this.virtualElement;
|
|
1045
|
-
if (!virtualElement) {
|
|
1046
|
-
return;
|
|
1047
|
-
}
|
|
1048
1003
|
index$1.computePosition(virtualElement, this.element, {
|
|
1049
1004
|
placement: this.floatingUIOptions.placement,
|
|
1050
1005
|
strategy: this.floatingUIOptions.strategy,
|
|
@@ -1086,7 +1041,7 @@ var BubbleMenuView = class {
|
|
|
1086
1041
|
from,
|
|
1087
1042
|
to
|
|
1088
1043
|
});
|
|
1089
|
-
return shouldShow
|
|
1044
|
+
return shouldShow;
|
|
1090
1045
|
}
|
|
1091
1046
|
show() {
|
|
1092
1047
|
var _a;
|
|
@@ -1095,8 +1050,7 @@ var BubbleMenuView = class {
|
|
|
1095
1050
|
}
|
|
1096
1051
|
this.element.style.visibility = "visible";
|
|
1097
1052
|
this.element.style.opacity = "1";
|
|
1098
|
-
|
|
1099
|
-
(_a = appendToElement != null ? appendToElement : this.view.dom.parentElement) == null ? void 0 : _a.appendChild(this.element);
|
|
1053
|
+
(_a = this.view.dom.parentElement) == null ? void 0 : _a.appendChild(this.element);
|
|
1100
1054
|
if (this.floatingUIOptions.onShow) {
|
|
1101
1055
|
this.floatingUIOptions.onShow();
|
|
1102
1056
|
}
|
|
@@ -1119,10 +1073,8 @@ var BubbleMenuView = class {
|
|
|
1119
1073
|
this.element.removeEventListener("mousedown", this.mousedownHandler, { capture: true });
|
|
1120
1074
|
this.view.dom.removeEventListener("dragstart", this.dragstartHandler);
|
|
1121
1075
|
window.removeEventListener("resize", this.resizeHandler);
|
|
1122
|
-
this.scrollTarget.removeEventListener("scroll", this.resizeHandler);
|
|
1123
1076
|
this.editor.off("focus", this.focusHandler);
|
|
1124
1077
|
this.editor.off("blur", this.blurHandler);
|
|
1125
|
-
this.editor.off("transaction", this.transactionHandler);
|
|
1126
1078
|
if (this.floatingUIOptions.onDestroy) {
|
|
1127
1079
|
this.floatingUIOptions.onDestroy();
|
|
1128
1080
|
}
|
|
@@ -1134,9 +1086,34 @@ var BubbleMenuPlugin = (options) => {
|
|
|
1134
1086
|
view: (view) => new BubbleMenuView({ view, ...options })
|
|
1135
1087
|
});
|
|
1136
1088
|
};
|
|
1137
|
-
|
|
1089
|
+
index.Extension.create({
|
|
1090
|
+
name: "bubbleMenu",
|
|
1091
|
+
addOptions() {
|
|
1092
|
+
return {
|
|
1093
|
+
element: null,
|
|
1094
|
+
pluginKey: "bubbleMenu",
|
|
1095
|
+
updateDelay: void 0,
|
|
1096
|
+
shouldShow: null
|
|
1097
|
+
};
|
|
1098
|
+
},
|
|
1099
|
+
addProseMirrorPlugins() {
|
|
1100
|
+
if (!this.options.element) {
|
|
1101
|
+
return [];
|
|
1102
|
+
}
|
|
1103
|
+
return [
|
|
1104
|
+
BubbleMenuPlugin({
|
|
1105
|
+
pluginKey: this.options.pluginKey,
|
|
1106
|
+
editor: this.editor,
|
|
1107
|
+
element: this.options.element,
|
|
1108
|
+
updateDelay: this.options.updateDelay,
|
|
1109
|
+
options: this.options.options,
|
|
1110
|
+
shouldShow: this.options.shouldShow
|
|
1111
|
+
})
|
|
1112
|
+
];
|
|
1113
|
+
}
|
|
1114
|
+
});
|
|
1115
|
+
var BubbleMenu2 = Mo.defineComponent({
|
|
1138
1116
|
name: "BubbleMenu",
|
|
1139
|
-
inheritAttrs: false,
|
|
1140
1117
|
props: {
|
|
1141
1118
|
pluginKey: {
|
|
1142
1119
|
type: [String, Object],
|
|
@@ -1158,67 +1135,45 @@ var BubbleMenu = No.defineComponent({
|
|
|
1158
1135
|
type: Object,
|
|
1159
1136
|
default: () => ({})
|
|
1160
1137
|
},
|
|
1161
|
-
appendTo: {
|
|
1162
|
-
type: Object,
|
|
1163
|
-
default: void 0
|
|
1164
|
-
},
|
|
1165
1138
|
shouldShow: {
|
|
1166
1139
|
type: Function,
|
|
1167
1140
|
default: null
|
|
1168
|
-
},
|
|
1169
|
-
getReferencedVirtualElement: {
|
|
1170
|
-
type: Function,
|
|
1171
|
-
default: void 0
|
|
1172
1141
|
}
|
|
1173
1142
|
},
|
|
1174
|
-
setup(props, { slots
|
|
1175
|
-
const root =
|
|
1176
|
-
|
|
1177
|
-
const {
|
|
1178
|
-
|
|
1179
|
-
options,
|
|
1180
|
-
pluginKey,
|
|
1181
|
-
resizeDelay,
|
|
1182
|
-
appendTo,
|
|
1183
|
-
shouldShow,
|
|
1184
|
-
getReferencedVirtualElement,
|
|
1185
|
-
updateDelay
|
|
1186
|
-
} = props;
|
|
1187
|
-
const el = root.value;
|
|
1188
|
-
if (!el) {
|
|
1143
|
+
setup(props, { slots }) {
|
|
1144
|
+
const root = Mo.ref(null);
|
|
1145
|
+
Mo.onMounted(() => {
|
|
1146
|
+
const { editor, options, pluginKey, resizeDelay, shouldShow, updateDelay } = props;
|
|
1147
|
+
if (!root.value) {
|
|
1189
1148
|
return;
|
|
1190
1149
|
}
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
updateDelay
|
|
1206
|
-
})
|
|
1207
|
-
);
|
|
1208
|
-
});
|
|
1150
|
+
root.value.style.visibility = "hidden";
|
|
1151
|
+
root.value.style.position = "absolute";
|
|
1152
|
+
root.value.remove();
|
|
1153
|
+
editor.registerPlugin(
|
|
1154
|
+
BubbleMenuPlugin({
|
|
1155
|
+
editor,
|
|
1156
|
+
element: root.value,
|
|
1157
|
+
options,
|
|
1158
|
+
pluginKey,
|
|
1159
|
+
resizeDelay,
|
|
1160
|
+
shouldShow,
|
|
1161
|
+
updateDelay
|
|
1162
|
+
})
|
|
1163
|
+
);
|
|
1209
1164
|
});
|
|
1210
|
-
|
|
1165
|
+
Mo.onBeforeUnmount(() => {
|
|
1211
1166
|
const { pluginKey, editor } = props;
|
|
1212
1167
|
editor.unregisterPlugin(pluginKey);
|
|
1213
1168
|
});
|
|
1214
1169
|
return () => {
|
|
1215
1170
|
var _a;
|
|
1216
|
-
return
|
|
1171
|
+
return Mo.h(Mo.Teleport, { to: "body" }, Mo.h("div", { ref: root }, (_a = slots.default) == null ? void 0 : _a.call(slots)));
|
|
1217
1172
|
};
|
|
1218
1173
|
}
|
|
1219
1174
|
});
|
|
1220
1175
|
var FloatingMenuView = class {
|
|
1221
|
-
constructor({ editor, element, view, options,
|
|
1176
|
+
constructor({ editor, element, view, options, shouldShow }) {
|
|
1222
1177
|
this.preventHide = false;
|
|
1223
1178
|
this.isVisible = false;
|
|
1224
1179
|
this.shouldShow = ({ view: view2, state }) => {
|
|
@@ -1280,7 +1235,6 @@ var FloatingMenuView = class {
|
|
|
1280
1235
|
this.editor = editor;
|
|
1281
1236
|
this.element = element;
|
|
1282
1237
|
this.view = view;
|
|
1283
|
-
this.appendTo = appendTo;
|
|
1284
1238
|
this.floatingUIOptions = {
|
|
1285
1239
|
...this.floatingUIOptions,
|
|
1286
1240
|
...options
|
|
@@ -1295,7 +1249,6 @@ var FloatingMenuView = class {
|
|
|
1295
1249
|
this.update(view, view.state);
|
|
1296
1250
|
if (this.getShouldShow()) {
|
|
1297
1251
|
this.show();
|
|
1298
|
-
this.updatePosition();
|
|
1299
1252
|
}
|
|
1300
1253
|
}
|
|
1301
1254
|
getTextContent(node) {
|
|
@@ -1389,8 +1342,7 @@ var FloatingMenuView = class {
|
|
|
1389
1342
|
}
|
|
1390
1343
|
this.element.style.visibility = "visible";
|
|
1391
1344
|
this.element.style.opacity = "1";
|
|
1392
|
-
|
|
1393
|
-
(_a = appendToElement != null ? appendToElement : this.view.dom.parentElement) == null ? void 0 : _a.appendChild(this.element);
|
|
1345
|
+
(_a = this.view.dom.parentElement) == null ? void 0 : _a.appendChild(this.element);
|
|
1394
1346
|
if (this.floatingUIOptions.onShow) {
|
|
1395
1347
|
this.floatingUIOptions.onShow();
|
|
1396
1348
|
}
|
|
@@ -1424,9 +1376,33 @@ var FloatingMenuPlugin = (options) => {
|
|
|
1424
1376
|
view: (view) => new FloatingMenuView({ view, ...options })
|
|
1425
1377
|
});
|
|
1426
1378
|
};
|
|
1427
|
-
|
|
1379
|
+
index.Extension.create({
|
|
1380
|
+
name: "floatingMenu",
|
|
1381
|
+
addOptions() {
|
|
1382
|
+
return {
|
|
1383
|
+
element: null,
|
|
1384
|
+
options: {},
|
|
1385
|
+
pluginKey: "floatingMenu",
|
|
1386
|
+
shouldShow: null
|
|
1387
|
+
};
|
|
1388
|
+
},
|
|
1389
|
+
addProseMirrorPlugins() {
|
|
1390
|
+
if (!this.options.element) {
|
|
1391
|
+
return [];
|
|
1392
|
+
}
|
|
1393
|
+
return [
|
|
1394
|
+
FloatingMenuPlugin({
|
|
1395
|
+
pluginKey: this.options.pluginKey,
|
|
1396
|
+
editor: this.editor,
|
|
1397
|
+
element: this.options.element,
|
|
1398
|
+
options: this.options.options,
|
|
1399
|
+
shouldShow: this.options.shouldShow
|
|
1400
|
+
})
|
|
1401
|
+
];
|
|
1402
|
+
}
|
|
1403
|
+
});
|
|
1404
|
+
var FloatingMenu2 = Mo.defineComponent({
|
|
1428
1405
|
name: "FloatingMenu",
|
|
1429
|
-
inheritAttrs: false,
|
|
1430
1406
|
props: {
|
|
1431
1407
|
pluginKey: {
|
|
1432
1408
|
// TODO: TypeScript breaks :(
|
|
@@ -1442,45 +1418,40 @@ No.defineComponent({
|
|
|
1442
1418
|
type: Object,
|
|
1443
1419
|
default: () => ({})
|
|
1444
1420
|
},
|
|
1445
|
-
appendTo: {
|
|
1446
|
-
type: Object,
|
|
1447
|
-
default: void 0
|
|
1448
|
-
},
|
|
1449
1421
|
shouldShow: {
|
|
1450
1422
|
type: Function,
|
|
1451
1423
|
default: null
|
|
1452
1424
|
}
|
|
1453
1425
|
},
|
|
1454
|
-
setup(props, { slots
|
|
1455
|
-
const root =
|
|
1456
|
-
|
|
1457
|
-
const { pluginKey, editor, options,
|
|
1458
|
-
|
|
1459
|
-
if (!el) {
|
|
1426
|
+
setup(props, { slots }) {
|
|
1427
|
+
const root = Mo.ref(null);
|
|
1428
|
+
Mo.onMounted(() => {
|
|
1429
|
+
const { pluginKey, editor, options, shouldShow } = props;
|
|
1430
|
+
if (!root.value) {
|
|
1460
1431
|
return;
|
|
1461
1432
|
}
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1433
|
+
root.value.style.visibility = "hidden";
|
|
1434
|
+
root.value.style.position = "absolute";
|
|
1435
|
+
root.value.remove();
|
|
1465
1436
|
editor.registerPlugin(
|
|
1466
1437
|
FloatingMenuPlugin({
|
|
1467
1438
|
pluginKey,
|
|
1468
1439
|
editor,
|
|
1469
|
-
element:
|
|
1440
|
+
element: root.value,
|
|
1470
1441
|
options,
|
|
1471
|
-
appendTo,
|
|
1472
1442
|
shouldShow
|
|
1473
1443
|
})
|
|
1474
1444
|
);
|
|
1475
1445
|
});
|
|
1476
|
-
|
|
1446
|
+
Mo.onBeforeUnmount(() => {
|
|
1477
1447
|
const { pluginKey, editor } = props;
|
|
1478
1448
|
editor.unregisterPlugin(pluginKey);
|
|
1479
1449
|
});
|
|
1480
1450
|
return () => {
|
|
1481
1451
|
var _a;
|
|
1482
|
-
return
|
|
1452
|
+
return Mo.h(Mo.Teleport, { to: "body" }, Mo.h("div", { ref: root }, (_a = slots.default) == null ? void 0 : _a.call(slots)));
|
|
1483
1453
|
};
|
|
1484
1454
|
}
|
|
1485
1455
|
});
|
|
1486
|
-
exports.BubbleMenu =
|
|
1456
|
+
exports.BubbleMenu = BubbleMenu2;
|
|
1457
|
+
exports.FloatingMenu = FloatingMenu2;
|