@youcan/celeste 0.6.30 → 0.6.32
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 +483 -264
- package/dist/cjs/alert.js +2 -2
- package/dist/cjs/chunks/index.js +229 -2
- package/dist/cjs/chunks/index2.js +1457 -0
- package/dist/cjs/chunks/index3.js +16457 -0
- package/dist/cjs/chunks/sonner.js +1154 -0
- package/dist/cjs/config.js +136 -0
- package/dist/cjs/extra-settings.js +155 -0
- package/dist/cjs/index.js +75 -0
- package/dist/cjs/label.js +2 -2
- package/dist/cjs/link-bubble.js +228 -0
- package/dist/cjs/link-button.js +2 -2
- package/dist/cjs/rich-editor.js +4996 -0
- package/dist/cjs/select-icon.js +2 -2
- package/dist/cjs/sonner-alert.js +41 -0
- package/dist/cjs/sonner.js +3 -0
- package/dist/cjs/text-input-affix.js +2 -2
- package/dist/cjs/types.js +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/rich-editor/config.d.ts +33 -0
- package/dist/components/rich-editor/extra-settings.d.ts +6 -0
- package/dist/components/rich-editor/index.d.ts +2 -0
- package/dist/components/rich-editor/link-bubble.d.ts +11 -0
- package/dist/components/rich-editor/rich-editor.d.ts +55 -0
- package/dist/components/rich-editor/types.d.ts +19 -0
- package/dist/components/sonner/index.d.ts +4 -0
- package/dist/components/sonner/sonner-alert.d.ts +13 -0
- package/dist/components/sonner/sonner.d.ts +5 -0
- package/dist/es/alert.js +2 -2
- package/dist/es/checkbox-label.js +1 -1
- package/dist/es/chunks/index.js +277 -50
- package/dist/es/chunks/index2.js +1457 -0
- package/dist/es/chunks/index3.js +16458 -0
- package/dist/es/chunks/sonner.js +1155 -0
- package/dist/es/combobox-group.js +1 -1
- package/dist/es/combobox-input.js +1 -1
- package/dist/es/combobox-item.js +1 -1
- package/dist/es/combobox-list.js +1 -1
- package/dist/es/combobox-root.js +1 -1
- package/dist/es/combobox-separator.js +1 -1
- package/dist/es/combobox-trigger.js +1 -1
- package/dist/es/command-group.js +1 -1
- package/dist/es/command-input.js +1 -1
- package/dist/es/command-item.js +1 -1
- package/dist/es/command-list.js +1 -1
- package/dist/es/command-root.js +1 -1
- package/dist/es/command-separator.js +1 -1
- package/dist/es/config.js +136 -0
- package/dist/es/dropdown-menu-group.js +1 -1
- package/dist/es/dropdown-menu-item.js +1 -1
- package/dist/es/dropdown-menu-label.js +1 -1
- package/dist/es/dropdown-menu-separator.js +1 -1
- package/dist/es/dropdown-menu-trigger.js +1 -1
- package/dist/es/dropdown-menu.js +1 -1
- package/dist/es/dropdown.js +1 -1
- package/dist/es/extra-settings.js +156 -0
- package/dist/es/index.js +94 -19
- package/dist/es/label.js +3 -3
- package/dist/es/link-bubble.js +229 -0
- package/dist/es/link-button.js +2 -2
- package/dist/es/modal-content.js +1 -1
- package/dist/es/modal-header.js +1 -1
- package/dist/es/popover-content.js +1 -1
- package/dist/es/popover-trigger.js +1 -1
- package/dist/es/rich-editor.js +4997 -0
- package/dist/es/scroll-bar.js +1 -1
- package/dist/es/segmented-control-item.js +1 -1
- package/dist/es/segmented-control.js +1 -1
- package/dist/es/select-content.js +1 -1
- package/dist/es/select-icon.js +2 -2
- package/dist/es/select-item.js +1 -1
- package/dist/es/select-trigger.js +1 -1
- package/dist/es/select-value.js +1 -1
- package/dist/es/sonner-alert.js +42 -0
- package/dist/es/sonner.js +4 -0
- package/dist/es/tab-menu-content.js +1 -1
- package/dist/es/tab-menu-item.js +1 -1
- package/dist/es/tab-menu-list.js +1 -1
- package/dist/es/tab-menu.js +1 -1
- package/dist/es/text-input-affix.js +2 -2
- package/dist/es/tooltip.js +1 -1
- package/dist/es/types.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/sonner.d.ts +19 -0
- package/package.json +15 -4
- package/src/components/index.ts +2 -0
- package/src/components/rich-editor/config.ts +150 -0
- package/src/components/rich-editor/extra-settings.vue +151 -0
- package/src/components/rich-editor/index.ts +2 -0
- package/src/components/rich-editor/link-bubble.vue +288 -0
- package/src/components/rich-editor/rich-editor.vue +428 -0
- package/src/components/rich-editor/stories/rich-editor.stories.ts +87 -0
- package/src/components/rich-editor/types.ts +21 -0
- package/src/components/sonner/index.ts +5 -0
- package/src/components/sonner/sonner-alert.vue +54 -0
- package/src/components/sonner/sonner.vue +13 -0
- package/src/components/sonner/stories/sonner.stories.ts +194 -0
- package/src/index.ts +1 -0
- package/src/utils/index.ts +3 -0
- package/src/utils/sonner.ts +72 -0
package/dist/es/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Alert from "./alert.js";
|
|
2
2
|
import Badge from "./badge.js";
|
|
3
3
|
import statusBadge from "./status-badge.js";
|
|
4
4
|
import Button from "./button.js";
|
|
5
5
|
import CompactButton from "./compact-button.js";
|
|
6
6
|
import fancyButton from "./fancy-button.js";
|
|
7
|
-
import
|
|
7
|
+
import LinkButton from "./link-button.js";
|
|
8
8
|
import socialButton from "./social-button.js";
|
|
9
9
|
import checkboxLabel from "./checkbox-label.js";
|
|
10
10
|
import { _ as _sfc_main } from "./chunks/checkbox.vue_vue_type_style_index_0_lang.js";
|
|
@@ -33,7 +33,7 @@ import { _ as _sfc_main$4 } from "./chunks/dropdown-menu-sub.js";
|
|
|
33
33
|
import dropdownMenuTrigger from "./dropdown-menu-trigger.js";
|
|
34
34
|
import dropdownMenu from "./dropdown-menu.js";
|
|
35
35
|
import hintText from "./hint-text.js";
|
|
36
|
-
import
|
|
36
|
+
import Label from "./label.js";
|
|
37
37
|
import modalBody from "./modal-body.js";
|
|
38
38
|
import { _ as _sfc_main$8 } from "./chunks/modal-close.js";
|
|
39
39
|
import modalContent from "./modal-content.js";
|
|
@@ -44,12 +44,13 @@ import { _ as _sfc_main$7 } from "./chunks/modal.js";
|
|
|
44
44
|
import PopoverContent from "./popover-content.js";
|
|
45
45
|
import PopoverTrigger from "./popover-trigger.js";
|
|
46
46
|
import { _ as _sfc_main$a } from "./chunks/popover.js";
|
|
47
|
+
import richEditor from "./rich-editor.js";
|
|
47
48
|
import { _ as _sfc_main$b } from "./chunks/scroll-area.js";
|
|
48
49
|
import segmentedControlItem from "./segmented-control-item.js";
|
|
49
50
|
import segmentedControl from "./segmented-control.js";
|
|
50
51
|
import SelectContent from "./select-content.js";
|
|
51
52
|
import { _ as _sfc_main$d } from "./chunks/select-group.js";
|
|
52
|
-
import
|
|
53
|
+
import SelectIcon from "./select-icon.js";
|
|
53
54
|
import SelectItem from "./select-item.js";
|
|
54
55
|
import selectLabel from "./select-label.js";
|
|
55
56
|
import selectSeparator from "./select-separator.js";
|
|
@@ -57,19 +58,24 @@ import SelectTrigger from "./select-trigger.js";
|
|
|
57
58
|
import SelectValue from "./select-value.js";
|
|
58
59
|
import { _ as _sfc_main$c } from "./chunks/select.js";
|
|
59
60
|
import { _ as _sfc_main$e } from "./chunks/slider.vue_vue_type_style_index_0_lang.js";
|
|
60
|
-
import
|
|
61
|
+
import SonnerAlert from "./sonner-alert.js";
|
|
62
|
+
import { _ as _sfc_main$f, t as toast$1 } from "./chunks/sonner.js";
|
|
63
|
+
import { _ as _sfc_main$g } from "./chunks/switch.vue_vue_type_style_index_0_lang.js";
|
|
61
64
|
import tabMenuContent from "./tab-menu-content.js";
|
|
62
65
|
import tabMenuItem from "./tab-menu-item.js";
|
|
63
66
|
import tabMenuList from "./tab-menu-list.js";
|
|
64
67
|
import tabMenu from "./tab-menu.js";
|
|
65
|
-
import
|
|
68
|
+
import TextInputAffix from "./text-input-affix.js";
|
|
66
69
|
import TextInputButton from "./text-input-button.js";
|
|
67
70
|
import TextInput from "./text-input.js";
|
|
68
71
|
import textarea from "./textarea.js";
|
|
69
72
|
import Tooltip from "./tooltip.js";
|
|
73
|
+
import { COLOR_NUMBER_VALIDATION_PATTERN, DEFAULT_SWATCH, HEX_VALIDATION_PATTERN, bumpColorValue, clamp, getAbsolutePosition, getColorConstraints, getFractionDigit, getPageXYFromEvent, getScrollXY, resolveArrowDirection, truncColorValue } from "./color.js";
|
|
74
|
+
import { uid } from "./crypto.js";
|
|
75
|
+
import { markRaw } from "vue";
|
|
70
76
|
const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
71
77
|
__proto__: null,
|
|
72
|
-
Alert
|
|
78
|
+
Alert,
|
|
73
79
|
Badge,
|
|
74
80
|
Button,
|
|
75
81
|
Checkbox: _sfc_main,
|
|
@@ -101,8 +107,8 @@ const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
|
|
|
101
107
|
DropdownMenuTrigger: dropdownMenuTrigger,
|
|
102
108
|
FancyButton: fancyButton,
|
|
103
109
|
HintText: hintText,
|
|
104
|
-
Label
|
|
105
|
-
LinkButton
|
|
110
|
+
Label,
|
|
111
|
+
LinkButton,
|
|
106
112
|
Modal: _sfc_main$7,
|
|
107
113
|
ModalBody: modalBody,
|
|
108
114
|
ModalClose: _sfc_main$8,
|
|
@@ -113,13 +119,14 @@ const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
|
|
|
113
119
|
Popover: _sfc_main$a,
|
|
114
120
|
PopoverContent,
|
|
115
121
|
PopoverTrigger,
|
|
122
|
+
RichEditor: richEditor,
|
|
116
123
|
ScrollArea: _sfc_main$b,
|
|
117
124
|
SegmentedControl: segmentedControl,
|
|
118
125
|
SegmentedControlItem: segmentedControlItem,
|
|
119
126
|
Select: _sfc_main$c,
|
|
120
127
|
SelectContent,
|
|
121
128
|
SelectGroup: _sfc_main$d,
|
|
122
|
-
SelectIcon
|
|
129
|
+
SelectIcon,
|
|
123
130
|
SelectItem,
|
|
124
131
|
SelectLabel: selectLabel,
|
|
125
132
|
SelectSeparator: selectSeparator,
|
|
@@ -127,18 +134,69 @@ const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
|
|
|
127
134
|
SelectValue,
|
|
128
135
|
Slider: _sfc_main$e,
|
|
129
136
|
SocialButton: socialButton,
|
|
137
|
+
Sonner: _sfc_main$f,
|
|
138
|
+
SonnerAlert,
|
|
130
139
|
StatusBadge: statusBadge,
|
|
131
|
-
Switch: _sfc_main$
|
|
140
|
+
Switch: _sfc_main$g,
|
|
132
141
|
TabMenu: tabMenu,
|
|
133
142
|
TabMenuContent: tabMenuContent,
|
|
134
143
|
TabMenuItem: tabMenuItem,
|
|
135
144
|
TabMenuList: tabMenuList,
|
|
136
145
|
TextInput,
|
|
137
|
-
TextInputAffix
|
|
146
|
+
TextInputAffix,
|
|
138
147
|
TextInputButton,
|
|
139
148
|
Textarea: textarea,
|
|
140
149
|
Tooltip
|
|
141
150
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
151
|
+
function createToast(title, data) {
|
|
152
|
+
const {
|
|
153
|
+
state = "success",
|
|
154
|
+
variant = "stroke",
|
|
155
|
+
size = "lg",
|
|
156
|
+
dismissable = true,
|
|
157
|
+
...externalToastProps
|
|
158
|
+
} = data || {};
|
|
159
|
+
let toastId;
|
|
160
|
+
const dismissToast = () => {
|
|
161
|
+
toast$1.dismiss(toastId);
|
|
162
|
+
};
|
|
163
|
+
toastId = toast$1.custom(markRaw(SonnerAlert), {
|
|
164
|
+
...externalToastProps,
|
|
165
|
+
componentProps: {
|
|
166
|
+
title,
|
|
167
|
+
description: data == null ? void 0 : data.description,
|
|
168
|
+
state,
|
|
169
|
+
variant,
|
|
170
|
+
size,
|
|
171
|
+
dismissable,
|
|
172
|
+
onDismiss: dismissToast
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
return toastId;
|
|
176
|
+
}
|
|
177
|
+
const toast = Object.assign(createToast, {
|
|
178
|
+
success: (title, data) => {
|
|
179
|
+
return createToast(title, { ...data, state: "success" });
|
|
180
|
+
},
|
|
181
|
+
error: (title, data) => {
|
|
182
|
+
return createToast(title, { ...data, state: "error" });
|
|
183
|
+
},
|
|
184
|
+
warning: (title, data) => {
|
|
185
|
+
return createToast(title, { ...data, state: "warning" });
|
|
186
|
+
},
|
|
187
|
+
info: (title, data) => {
|
|
188
|
+
return createToast(title, { ...data, state: "information" });
|
|
189
|
+
},
|
|
190
|
+
feature: (title, data) => {
|
|
191
|
+
return createToast(title, { ...data, state: "feature" });
|
|
192
|
+
},
|
|
193
|
+
dismiss: (id) => {
|
|
194
|
+
toast$1.dismiss(id);
|
|
195
|
+
},
|
|
196
|
+
loading: (title, data) => {
|
|
197
|
+
return toast$1.loading(title, data);
|
|
198
|
+
}
|
|
199
|
+
});
|
|
142
200
|
const Celeste = {
|
|
143
201
|
install(vue) {
|
|
144
202
|
Object.entries(components).forEach(([name, component]) => {
|
|
@@ -147,9 +205,10 @@ const Celeste = {
|
|
|
147
205
|
}
|
|
148
206
|
};
|
|
149
207
|
export {
|
|
150
|
-
|
|
208
|
+
Alert,
|
|
151
209
|
Badge,
|
|
152
210
|
Button,
|
|
211
|
+
COLOR_NUMBER_VALIDATION_PATTERN,
|
|
153
212
|
Celeste,
|
|
154
213
|
_sfc_main as Checkbox,
|
|
155
214
|
checkboxLabel as CheckboxLabel,
|
|
@@ -166,6 +225,7 @@ export {
|
|
|
166
225
|
CompactButton,
|
|
167
226
|
_sfc_main$2 as ContentDivider,
|
|
168
227
|
contextMenuItem as ContextMenuItem,
|
|
228
|
+
DEFAULT_SWATCH,
|
|
169
229
|
dropdown as Dropdown,
|
|
170
230
|
DropdownItem,
|
|
171
231
|
dropdownMenu as DropdownMenu,
|
|
@@ -179,9 +239,10 @@ export {
|
|
|
179
239
|
_sfc_main$6 as DropdownMenuSubTrigger,
|
|
180
240
|
dropdownMenuTrigger as DropdownMenuTrigger,
|
|
181
241
|
fancyButton as FancyButton,
|
|
242
|
+
HEX_VALIDATION_PATTERN,
|
|
182
243
|
hintText as HintText,
|
|
183
|
-
|
|
184
|
-
|
|
244
|
+
Label,
|
|
245
|
+
LinkButton,
|
|
185
246
|
_sfc_main$7 as Modal,
|
|
186
247
|
modalBody as ModalBody,
|
|
187
248
|
_sfc_main$8 as ModalClose,
|
|
@@ -192,13 +253,14 @@ export {
|
|
|
192
253
|
_sfc_main$a as Popover,
|
|
193
254
|
PopoverContent,
|
|
194
255
|
PopoverTrigger,
|
|
256
|
+
richEditor as RichEditor,
|
|
195
257
|
_sfc_main$b as ScrollArea,
|
|
196
258
|
segmentedControl as SegmentedControl,
|
|
197
259
|
segmentedControlItem as SegmentedControlItem,
|
|
198
260
|
_sfc_main$c as Select,
|
|
199
261
|
SelectContent,
|
|
200
262
|
_sfc_main$d as SelectGroup,
|
|
201
|
-
|
|
263
|
+
SelectIcon,
|
|
202
264
|
SelectItem,
|
|
203
265
|
selectLabel as SelectLabel,
|
|
204
266
|
selectSeparator as SelectSeparator,
|
|
@@ -206,15 +268,28 @@ export {
|
|
|
206
268
|
SelectValue,
|
|
207
269
|
_sfc_main$e as Slider,
|
|
208
270
|
socialButton as SocialButton,
|
|
271
|
+
_sfc_main$f as Sonner,
|
|
272
|
+
SonnerAlert,
|
|
209
273
|
statusBadge as StatusBadge,
|
|
210
|
-
_sfc_main$
|
|
274
|
+
_sfc_main$g as Switch,
|
|
211
275
|
tabMenu as TabMenu,
|
|
212
276
|
tabMenuContent as TabMenuContent,
|
|
213
277
|
tabMenuItem as TabMenuItem,
|
|
214
278
|
tabMenuList as TabMenuList,
|
|
215
279
|
TextInput,
|
|
216
|
-
|
|
280
|
+
TextInputAffix,
|
|
217
281
|
TextInputButton,
|
|
218
282
|
textarea as Textarea,
|
|
219
|
-
Tooltip
|
|
283
|
+
Tooltip,
|
|
284
|
+
bumpColorValue,
|
|
285
|
+
clamp,
|
|
286
|
+
getAbsolutePosition,
|
|
287
|
+
getColorConstraints,
|
|
288
|
+
getFractionDigit,
|
|
289
|
+
getPageXYFromEvent,
|
|
290
|
+
getScrollXY,
|
|
291
|
+
resolveArrowDirection,
|
|
292
|
+
toast,
|
|
293
|
+
truncColorValue,
|
|
294
|
+
uid
|
|
220
295
|
};
|
package/dist/es/label.js
CHANGED
|
@@ -2,7 +2,7 @@ import { defineComponent, openBlock, createBlock, unref, mergeProps, withCtx, re
|
|
|
2
2
|
import Tooltip from "./tooltip.js";
|
|
3
3
|
import { useDelegatedProps } from "./use-delegated-props.js";
|
|
4
4
|
import { c as clsx } from "./chunks/clsx.js";
|
|
5
|
-
import {
|
|
5
|
+
import { S as Oh } from "./chunks/index.js";
|
|
6
6
|
import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
|
|
7
7
|
const _hoisted_1 = {
|
|
8
8
|
key: 0,
|
|
@@ -50,7 +50,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
});
|
|
53
|
-
const
|
|
53
|
+
const Label = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-4768213c"]]);
|
|
54
54
|
export {
|
|
55
|
-
|
|
55
|
+
Label as default
|
|
56
56
|
};
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { defineComponent, defineAsyncComponent, ref, computed, onMounted, onUnmounted, openBlock, createBlock, unref, withCtx, createElementBlock, createElementVNode, createVNode, withKeys, createTextVNode, toDisplayString, createCommentVNode } from "vue";
|
|
2
|
+
import Button from "./button.js";
|
|
3
|
+
import CompactButton from "./compact-button.js";
|
|
4
|
+
import LinkButton from "./link-button.js";
|
|
5
|
+
import Label from "./label.js";
|
|
6
|
+
import { _ as _sfc_main$1 } from "./chunks/switch.vue_vue_type_style_index_0_lang.js";
|
|
7
|
+
import TextInputAffix from "./text-input-affix.js";
|
|
8
|
+
import TextInput from "./text-input.js";
|
|
9
|
+
import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
|
|
10
|
+
const _hoisted_1 = {
|
|
11
|
+
key: 0,
|
|
12
|
+
class: "set-mode"
|
|
13
|
+
};
|
|
14
|
+
const _hoisted_2 = { class: "set-link" };
|
|
15
|
+
const _hoisted_3 = { class: "switch-button-box" };
|
|
16
|
+
const _hoisted_4 = {
|
|
17
|
+
key: 1,
|
|
18
|
+
class: "edit-mode"
|
|
19
|
+
};
|
|
20
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
21
|
+
__name: "link-bubble",
|
|
22
|
+
props: {
|
|
23
|
+
editor: {},
|
|
24
|
+
showSetLinkFromToolbar: { type: Boolean }
|
|
25
|
+
},
|
|
26
|
+
emits: ["set-link-closed"],
|
|
27
|
+
setup(__props, { emit: __emit }) {
|
|
28
|
+
const props = __props;
|
|
29
|
+
const emit = __emit;
|
|
30
|
+
const BubbleMenu = defineAsyncComponent(
|
|
31
|
+
() => import("./chunks/index2.js").then((m) => m.BubbleMenu)
|
|
32
|
+
);
|
|
33
|
+
const href = ref("");
|
|
34
|
+
const openInNewTab = ref(false);
|
|
35
|
+
const editing = ref(false);
|
|
36
|
+
const isTextSelected = () => props.editor.state.selection.from !== props.editor.state.selection.to;
|
|
37
|
+
const showBubble = computed(() => {
|
|
38
|
+
return editing.value || props.editor.isActive("link") || props.showSetLinkFromToolbar && isTextSelected();
|
|
39
|
+
});
|
|
40
|
+
function startEdit() {
|
|
41
|
+
editing.value = true;
|
|
42
|
+
const attrs = props.editor.getAttributes("link");
|
|
43
|
+
href.value = attrs.href || "";
|
|
44
|
+
openInNewTab.value = attrs.target === "_blank";
|
|
45
|
+
}
|
|
46
|
+
function removeLink() {
|
|
47
|
+
props.editor.chain().focus().unsetLink().run();
|
|
48
|
+
reset();
|
|
49
|
+
}
|
|
50
|
+
function reset() {
|
|
51
|
+
editing.value = false;
|
|
52
|
+
href.value = "";
|
|
53
|
+
openInNewTab.value = false;
|
|
54
|
+
emit("set-link-closed");
|
|
55
|
+
}
|
|
56
|
+
function truncateMiddleUrl(str) {
|
|
57
|
+
const maxLength = 40;
|
|
58
|
+
if (str.length <= maxLength) {
|
|
59
|
+
return str;
|
|
60
|
+
}
|
|
61
|
+
const startChars = Math.ceil((maxLength - 3) / 2);
|
|
62
|
+
const endChars = Math.floor((maxLength - 3) / 2);
|
|
63
|
+
return `${str.slice(0, startChars)}...${str.slice(-endChars)}`;
|
|
64
|
+
}
|
|
65
|
+
function isAllowedUri() {
|
|
66
|
+
const url = href.value.trim();
|
|
67
|
+
if (!url || url.includes(" ")) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
if (url.startsWith("/")) {
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
if (url.startsWith("./") || url.startsWith("../")) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
const allowedProtocols = /^(?:https?:|mailto:)/i;
|
|
77
|
+
const disallowedProtocols = /^(?:javascript:|data:)/i;
|
|
78
|
+
if (disallowedProtocols.test(url)) {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
if (allowedProtocols.test(url)) {
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
const isValidUrl = computed(() => isAllowedUri());
|
|
87
|
+
function applyLink() {
|
|
88
|
+
if (!href.value || !isValidUrl.value) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
props.editor.chain().focus().extendMarkRange("link").setLink({
|
|
92
|
+
href: href.value,
|
|
93
|
+
target: openInNewTab.value ? "_blank" : null
|
|
94
|
+
}).run();
|
|
95
|
+
reset();
|
|
96
|
+
}
|
|
97
|
+
const bubbleRef = ref(null);
|
|
98
|
+
function handleClickOutside(event) {
|
|
99
|
+
const target = event.target;
|
|
100
|
+
if (!bubbleRef.value) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (bubbleRef.value && bubbleRef.value.contains(target)) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (target.closest(".i-celeste-link")) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
emit("set-link-closed");
|
|
110
|
+
}
|
|
111
|
+
onMounted(() => {
|
|
112
|
+
props.editor.on("selectionUpdate", () => {
|
|
113
|
+
if (props.editor.isActive("link") || props.showSetLinkFromToolbar) {
|
|
114
|
+
const attrs = props.editor.getAttributes("link");
|
|
115
|
+
href.value = attrs.href || "";
|
|
116
|
+
openInNewTab.value = attrs.target === "_blank";
|
|
117
|
+
} else {
|
|
118
|
+
reset();
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
document.addEventListener("click", handleClickOutside);
|
|
122
|
+
});
|
|
123
|
+
onUnmounted(() => {
|
|
124
|
+
document.removeEventListener("click", handleClickOutside);
|
|
125
|
+
});
|
|
126
|
+
return (_ctx, _cache) => {
|
|
127
|
+
return openBlock(), createBlock(unref(BubbleMenu), {
|
|
128
|
+
"should-show": () => true,
|
|
129
|
+
editor: _ctx.editor,
|
|
130
|
+
options: {
|
|
131
|
+
placement: "bottom",
|
|
132
|
+
offset: {
|
|
133
|
+
mainAxis: 0,
|
|
134
|
+
crossAxis: 12
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}, {
|
|
138
|
+
default: withCtx(() => [
|
|
139
|
+
showBubble.value ? (openBlock(), createElementBlock("div", {
|
|
140
|
+
key: 0,
|
|
141
|
+
ref_key: "bubbleRef",
|
|
142
|
+
ref: bubbleRef,
|
|
143
|
+
class: "link-bubble"
|
|
144
|
+
}, [
|
|
145
|
+
editing.value || props.showSetLinkFromToolbar && isTextSelected() ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
146
|
+
createElementVNode("div", _hoisted_2, [
|
|
147
|
+
createVNode(TextInput, {
|
|
148
|
+
modelValue: href.value,
|
|
149
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => href.value = $event),
|
|
150
|
+
type: "url",
|
|
151
|
+
size: "xs",
|
|
152
|
+
placeholder: "Paste or type a link",
|
|
153
|
+
class: "link-input",
|
|
154
|
+
onKeydown: [
|
|
155
|
+
withKeys(applyLink, ["enter"]),
|
|
156
|
+
withKeys(reset, ["esc"])
|
|
157
|
+
]
|
|
158
|
+
}, {
|
|
159
|
+
leadingNode: withCtx(() => [
|
|
160
|
+
createVNode(TextInputAffix, null, {
|
|
161
|
+
default: withCtx(() => _cache[2] || (_cache[2] = [
|
|
162
|
+
createElementVNode("i", { class: "i-celeste-link" }, null, -1)
|
|
163
|
+
])),
|
|
164
|
+
_: 1
|
|
165
|
+
})
|
|
166
|
+
]),
|
|
167
|
+
_: 1
|
|
168
|
+
}, 8, ["modelValue"]),
|
|
169
|
+
createVNode(Button, {
|
|
170
|
+
intent: "neutral",
|
|
171
|
+
size: "xs",
|
|
172
|
+
variant: "stroke",
|
|
173
|
+
disabled: !isValidUrl.value,
|
|
174
|
+
onClick: applyLink
|
|
175
|
+
}, {
|
|
176
|
+
default: withCtx(() => _cache[3] || (_cache[3] = [
|
|
177
|
+
createTextVNode(" Set link ")
|
|
178
|
+
])),
|
|
179
|
+
_: 1
|
|
180
|
+
}, 8, ["disabled"])
|
|
181
|
+
]),
|
|
182
|
+
createElementVNode("div", _hoisted_3, [
|
|
183
|
+
createVNode(Label, { for: "open-in-new-tab" }, {
|
|
184
|
+
default: withCtx(() => _cache[4] || (_cache[4] = [
|
|
185
|
+
createTextVNode(" Open in new tab ")
|
|
186
|
+
])),
|
|
187
|
+
_: 1
|
|
188
|
+
}),
|
|
189
|
+
createVNode(_sfc_main$1, {
|
|
190
|
+
id: "open-in-new-tab",
|
|
191
|
+
checked: openInNewTab.value,
|
|
192
|
+
"onUpdate:checked": _cache[1] || (_cache[1] = ($event) => openInNewTab.value = $event)
|
|
193
|
+
}, null, 8, ["checked"])
|
|
194
|
+
])
|
|
195
|
+
])) : props.editor.isActive("link") ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
196
|
+
createVNode(LinkButton, {
|
|
197
|
+
href: _ctx.editor.getAttributes("link").href,
|
|
198
|
+
target: _ctx.editor.getAttributes("link").target
|
|
199
|
+
}, {
|
|
200
|
+
default: withCtx(() => [
|
|
201
|
+
createTextVNode(toDisplayString(truncateMiddleUrl(_ctx.editor.getAttributes("link").href)), 1)
|
|
202
|
+
]),
|
|
203
|
+
_: 1
|
|
204
|
+
}, 8, ["href", "target"]),
|
|
205
|
+
_cache[5] || (_cache[5] = createElementVNode("div", { class: "divider" }, null, -1)),
|
|
206
|
+
createVNode(CompactButton, {
|
|
207
|
+
icon: "i-celeste-edit-line",
|
|
208
|
+
size: "lg",
|
|
209
|
+
variant: "ghost",
|
|
210
|
+
onClick: startEdit
|
|
211
|
+
}),
|
|
212
|
+
createVNode(CompactButton, {
|
|
213
|
+
icon: "i-celeste-delete-bin-line",
|
|
214
|
+
size: "lg",
|
|
215
|
+
variant: "ghost",
|
|
216
|
+
onClick: removeLink
|
|
217
|
+
})
|
|
218
|
+
])) : createCommentVNode("", true)
|
|
219
|
+
], 512)) : createCommentVNode("", true)
|
|
220
|
+
]),
|
|
221
|
+
_: 1
|
|
222
|
+
}, 8, ["editor"]);
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
const LinkBubble = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-c63c1d92"]]);
|
|
227
|
+
export {
|
|
228
|
+
LinkBubble as default
|
|
229
|
+
};
|
package/dist/es/link-button.js
CHANGED
|
@@ -39,7 +39,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
|
-
const
|
|
42
|
+
const LinkButton = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-82b3b1ab"]]);
|
|
43
43
|
export {
|
|
44
|
-
|
|
44
|
+
LinkButton as default
|
|
45
45
|
};
|
package/dist/es/modal-content.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent, openBlock, createBlock, unref, withCtx, createVNode, Transition, mergeProps, renderSlot } from "vue";
|
|
2
2
|
import { useDelegatedProps } from "./use-delegated-props.js";
|
|
3
3
|
import { c as clsx } from "./chunks/clsx.js";
|
|
4
|
-
import { x as xe,
|
|
4
|
+
import { x as xe, aa as Dv, ab as Eu, ac as xu } from "./chunks/index.js";
|
|
5
5
|
import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
|
|
6
6
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
7
7
|
__name: "modal-content",
|
package/dist/es/modal-header.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent, openBlock, createElementBlock, normalizeClass, unref, createElementVNode, createCommentVNode, createBlock, withCtx, toDisplayString, createVNode } from "vue";
|
|
2
2
|
import CompactButton from "./compact-button.js";
|
|
3
3
|
import { c as clsx } from "./chunks/clsx.js";
|
|
4
|
-
import {
|
|
4
|
+
import { ad as Pu, ae as Du, a as Gl } from "./chunks/index.js";
|
|
5
5
|
import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
|
|
6
6
|
const _hoisted_1 = ["data-dismissible", "data-alignment", "data-type"];
|
|
7
7
|
const _hoisted_2 = {
|
|
@@ -2,7 +2,7 @@ import { defineComponent, openBlock, createBlock, unref, withCtx, createVNode, m
|
|
|
2
2
|
import CompactButton from "./compact-button.js";
|
|
3
3
|
import { useDelegatedProps } from "./use-delegated-props.js";
|
|
4
4
|
import { c as clsx } from "./chunks/clsx.js";
|
|
5
|
-
import { x as xe,
|
|
5
|
+
import { x as xe, af as bs, ag as ws, ah as _s, ai as xs } from "./chunks/index.js";
|
|
6
6
|
import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
|
|
7
7
|
const _hoisted_1 = ["data-icon-size"];
|
|
8
8
|
const _hoisted_2 = { class: "celeste-popover-title" };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent, openBlock, createBlock, unref, mergeProps, withCtx, renderSlot } from "vue";
|
|
2
|
-
import {
|
|
2
|
+
import { aj as gs } from "./chunks/index.js";
|
|
3
3
|
import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
|
|
4
4
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
5
|
__name: "popover-trigger",
|