@youcan/celeste 0.6.30 → 0.6.31

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 (99) hide show
  1. package/dist/celeste.css +293 -74
  2. package/dist/cjs/alert.js +2 -2
  3. package/dist/cjs/chunks/index.js +229 -2
  4. package/dist/cjs/chunks/index2.js +1457 -0
  5. package/dist/cjs/chunks/index3.js +16457 -0
  6. package/dist/cjs/chunks/sonner.js +1153 -0
  7. package/dist/cjs/config.js +136 -0
  8. package/dist/cjs/extra-settings.js +155 -0
  9. package/dist/cjs/index.js +9 -0
  10. package/dist/cjs/label.js +2 -2
  11. package/dist/cjs/link-bubble.js +228 -0
  12. package/dist/cjs/link-button.js +2 -2
  13. package/dist/cjs/rich-editor.js +4996 -0
  14. package/dist/cjs/select-icon.js +2 -2
  15. package/dist/cjs/sonner-alert.js +41 -0
  16. package/dist/cjs/sonner.js +3 -0
  17. package/dist/cjs/text-input-affix.js +2 -2
  18. package/dist/cjs/types.js +1 -0
  19. package/dist/components/index.d.ts +2 -0
  20. package/dist/components/rich-editor/config.d.ts +33 -0
  21. package/dist/components/rich-editor/extra-settings.d.ts +6 -0
  22. package/dist/components/rich-editor/index.d.ts +2 -0
  23. package/dist/components/rich-editor/link-bubble.d.ts +11 -0
  24. package/dist/components/rich-editor/rich-editor.d.ts +55 -0
  25. package/dist/components/rich-editor/types.d.ts +19 -0
  26. package/dist/components/sonner/index.d.ts +4 -0
  27. package/dist/components/sonner/sonner-alert.d.ts +13 -0
  28. package/dist/components/sonner/sonner.d.ts +5 -0
  29. package/dist/es/alert.js +2 -2
  30. package/dist/es/checkbox-label.js +1 -1
  31. package/dist/es/chunks/index.js +277 -50
  32. package/dist/es/chunks/index2.js +1457 -0
  33. package/dist/es/chunks/index3.js +16458 -0
  34. package/dist/es/chunks/sonner.js +1154 -0
  35. package/dist/es/combobox-group.js +1 -1
  36. package/dist/es/combobox-input.js +1 -1
  37. package/dist/es/combobox-item.js +1 -1
  38. package/dist/es/combobox-list.js +1 -1
  39. package/dist/es/combobox-root.js +1 -1
  40. package/dist/es/combobox-separator.js +1 -1
  41. package/dist/es/combobox-trigger.js +1 -1
  42. package/dist/es/command-group.js +1 -1
  43. package/dist/es/command-input.js +1 -1
  44. package/dist/es/command-item.js +1 -1
  45. package/dist/es/command-list.js +1 -1
  46. package/dist/es/command-root.js +1 -1
  47. package/dist/es/command-separator.js +1 -1
  48. package/dist/es/config.js +136 -0
  49. package/dist/es/dropdown-menu-group.js +1 -1
  50. package/dist/es/dropdown-menu-item.js +1 -1
  51. package/dist/es/dropdown-menu-label.js +1 -1
  52. package/dist/es/dropdown-menu-separator.js +1 -1
  53. package/dist/es/dropdown-menu-trigger.js +1 -1
  54. package/dist/es/dropdown-menu.js +1 -1
  55. package/dist/es/dropdown.js +1 -1
  56. package/dist/es/extra-settings.js +156 -0
  57. package/dist/es/index.js +27 -18
  58. package/dist/es/label.js +3 -3
  59. package/dist/es/link-bubble.js +229 -0
  60. package/dist/es/link-button.js +2 -2
  61. package/dist/es/modal-content.js +1 -1
  62. package/dist/es/modal-header.js +1 -1
  63. package/dist/es/popover-content.js +1 -1
  64. package/dist/es/popover-trigger.js +1 -1
  65. package/dist/es/rich-editor.js +4997 -0
  66. package/dist/es/scroll-bar.js +1 -1
  67. package/dist/es/segmented-control-item.js +1 -1
  68. package/dist/es/segmented-control.js +1 -1
  69. package/dist/es/select-content.js +1 -1
  70. package/dist/es/select-icon.js +2 -2
  71. package/dist/es/select-item.js +1 -1
  72. package/dist/es/select-trigger.js +1 -1
  73. package/dist/es/select-value.js +1 -1
  74. package/dist/es/sonner-alert.js +42 -0
  75. package/dist/es/sonner.js +4 -0
  76. package/dist/es/tab-menu-content.js +1 -1
  77. package/dist/es/tab-menu-item.js +1 -1
  78. package/dist/es/tab-menu-list.js +1 -1
  79. package/dist/es/tab-menu.js +1 -1
  80. package/dist/es/text-input-affix.js +2 -2
  81. package/dist/es/tooltip.js +1 -1
  82. package/dist/es/types.js +1 -0
  83. package/dist/utils/index.d.ts +3 -0
  84. package/dist/utils/sonner.d.ts +19 -0
  85. package/package.json +15 -4
  86. package/src/components/index.ts +2 -0
  87. package/src/components/rich-editor/config.ts +150 -0
  88. package/src/components/rich-editor/extra-settings.vue +151 -0
  89. package/src/components/rich-editor/index.ts +2 -0
  90. package/src/components/rich-editor/link-bubble.vue +288 -0
  91. package/src/components/rich-editor/rich-editor.vue +428 -0
  92. package/src/components/rich-editor/stories/rich-editor.stories.ts +87 -0
  93. package/src/components/rich-editor/types.ts +21 -0
  94. package/src/components/sonner/index.ts +5 -0
  95. package/src/components/sonner/sonner-alert.vue +54 -0
  96. package/src/components/sonner/sonner.vue +13 -0
  97. package/src/components/sonner/stories/sonner.stories.ts +194 -0
  98. package/src/utils/index.ts +3 -0
  99. package/src/utils/sonner.ts +72 -0
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, computed, openBlock, createBlock, unref, mergeProps, withCtx, createTextVNode, toDisplayString, createCommentVNode, renderSlot } from "vue";
2
2
  import { c as clsx } from "./chunks/clsx.js";
3
- import { D as qv, Y as Yv } from "./chunks/index.js";
3
+ import { T as qv, Y as Yv } from "./chunks/index.js";
4
4
  import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
5
5
  const _sfc_main = /* @__PURE__ */ defineComponent({
6
6
  __name: "combobox-group",
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, mergeModels, useModel, computed, openBlock, createBlock, unref, mergeProps, withCtx, createVNode, createElementVNode } from "vue";
2
2
  import { c as clsx } from "./chunks/clsx.js";
3
- import { E as Wv } from "./chunks/index.js";
3
+ import { U as Wv } from "./chunks/index.js";
4
4
  import TextInput from "./text-input.js";
5
5
  import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
6
6
  const _sfc_main = /* @__PURE__ */ defineComponent({
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, computed, openBlock, createBlock, unref, mergeProps, withCtx, createElementVNode, normalizeClass, createCommentVNode, createElementBlock, renderSlot, toDisplayString } from "vue";
2
2
  import { c as clsx } from "./chunks/clsx.js";
3
- import { x as xe, H as Qv } from "./chunks/index.js";
3
+ import { x as xe, X as Qv } from "./chunks/index.js";
4
4
  import { _ as _sfc_main$1 } from "./chunks/checkbox.vue_vue_type_style_index_0_lang.js";
5
5
  import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
6
6
  const _hoisted_1 = ["aria-disabled"];
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, computed, openBlock, createBlock, unref, withCtx, createVNode, mergeProps, renderSlot } from "vue";
2
2
  import { c as clsx } from "./chunks/clsx.js";
3
- import { x as xe, I as nm, X as Xv, J as Jv } from "./chunks/index.js";
3
+ import { x as xe, _ as nm, $ as Xv, a0 as Jv } from "./chunks/index.js";
4
4
  import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
5
5
  const _sfc_main = /* @__PURE__ */ defineComponent({
6
6
  __name: "combobox-list",
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, openBlock, createBlock, unref, mergeProps, withCtx, renderSlot } from "vue";
2
- import { x as xe, L as Hv } from "./chunks/index.js";
2
+ import { x as xe, a1 as Hv } 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: "combobox-root",
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, computed, openBlock, createBlock, unref, mergeProps, withCtx, renderSlot } from "vue";
2
2
  import { c as clsx } from "./chunks/clsx.js";
3
- import { P as tm } from "./chunks/index.js";
3
+ import { a2 as tm } from "./chunks/index.js";
4
4
  import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
5
5
  const _sfc_main = /* @__PURE__ */ defineComponent({
6
6
  __name: "combobox-separator",
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, computed, openBlock, createBlock, unref, mergeProps, withCtx, renderSlot } from "vue";
2
2
  import { c as clsx } from "./chunks/clsx.js";
3
- import { A as At, U as Uv } from "./chunks/index.js";
3
+ import { A as At, a3 as Uv } from "./chunks/index.js";
4
4
  import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
5
5
  const _sfc_main = /* @__PURE__ */ defineComponent({
6
6
  __name: "combobox-trigger",
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, computed, openBlock, createBlock, unref, mergeProps, withCtx, createTextVNode, toDisplayString, createCommentVNode, renderSlot } from "vue";
2
- import { D as qv, Y as Yv } from "./chunks/index.js";
2
+ import { T as qv, Y as Yv } 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: "command-group",
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, computed, openBlock, createElementBlock, createElementVNode, createVNode, unref, mergeProps } from "vue";
2
2
  import { c as clsx } from "./chunks/clsx.js";
3
- import { A as At, E as Wv } from "./chunks/index.js";
3
+ import { A as At, U as Wv } from "./chunks/index.js";
4
4
  import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
5
5
  const _hoisted_1 = {
6
6
  class: "celeste-command-input",
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, computed, openBlock, createBlock, unref, mergeProps, withCtx, renderSlot } from "vue";
2
- import { x as xe, H as Qv } from "./chunks/index.js";
2
+ import { x as xe, X as Qv } from "./chunks/index.js";
3
3
  const _sfc_main = /* @__PURE__ */ defineComponent({
4
4
  __name: "command-item",
5
5
  props: {
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, computed, openBlock, createBlock, unref, mergeProps, withCtx, createElementVNode, renderSlot } from "vue";
2
- import { x as xe, X as Xv } from "./chunks/index.js";
2
+ import { x as xe, $ as Xv } from "./chunks/index.js";
3
3
  const _hoisted_1 = { role: "presentation" };
4
4
  const _sfc_main = /* @__PURE__ */ defineComponent({
5
5
  __name: "command-list",
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, computed, openBlock, createBlock, unref, mergeProps, withCtx, renderSlot } from "vue";
2
- import { x as xe, L as Hv } from "./chunks/index.js";
2
+ import { x as xe, a1 as Hv } from "./chunks/index.js";
3
3
  const _sfc_main = /* @__PURE__ */ defineComponent({
4
4
  __name: "command-root",
5
5
  props: {
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, computed, openBlock, createBlock, unref, mergeProps, withCtx, renderSlot } from "vue";
2
2
  import { c as clsx } from "./chunks/clsx.js";
3
- import { P as tm } from "./chunks/index.js";
3
+ import { a2 as tm } from "./chunks/index.js";
4
4
  import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
5
5
  const _sfc_main = /* @__PURE__ */ defineComponent({
6
6
  __name: "command-separator",
@@ -0,0 +1,136 @@
1
+ import { ref } from "vue";
2
+ const fullToolbar = ref([
3
+ {
4
+ slug: "heading",
5
+ name: "Text styles",
6
+ children: [
7
+ { option: "p", name: "Normal text", active: "paragraph" },
8
+ { option: "1", name: "Heading 1", active: { level: 1 } },
9
+ { option: "2", name: "Heading 2", active: { level: 2 } },
10
+ { option: "3", name: "Heading 3", active: { level: 3 } },
11
+ { option: "4", name: "Heading 4", active: { level: 4 } },
12
+ { option: "5", name: "Heading 5", active: { level: 5 } },
13
+ { option: "6", name: "Heading 6", active: { level: 6 } }
14
+ ]
15
+ },
16
+ { type: "divider" },
17
+ {
18
+ slug: "fontSize",
19
+ name: "Font size",
20
+ children: [
21
+ { option: "8px", name: "8", active: { fontSize: "8px" } },
22
+ { option: "10px", name: "10", active: { fontSize: "10px" } },
23
+ { option: "12px", name: "12", active: { fontSize: "12px" } },
24
+ { option: "14px", name: "14", active: { fontSize: "14px" } },
25
+ { option: "16px", name: "16", active: { fontSize: "16px" } },
26
+ { option: "18px", name: "18", active: { fontSize: "18px" } },
27
+ { option: "24px", name: "24", active: { fontSize: "24px" } },
28
+ { option: "30px", name: "30", active: { fontSize: "30px" } },
29
+ { option: "36px", name: "36", active: { fontSize: "36px" } },
30
+ { option: "48px", name: "48", active: { fontSize: "48px" } },
31
+ { option: "60px", name: "60", active: { fontSize: "60px" } },
32
+ { option: "72px", name: "72", active: { fontSize: "72px" } },
33
+ { option: "96px", name: "96", active: { fontSize: "96px" } }
34
+ ]
35
+ },
36
+ { type: "divider" },
37
+ {
38
+ slug: "color",
39
+ name: "Text color",
40
+ children: [
41
+ { option: "#000000", name: "Black", icon: "i-celeste-circle-fill", active: { color: "#000000" } },
42
+ { option: "#7B7B7B", name: "Gray", icon: "i-celeste-circle-fill", active: { color: "#7B7B7B" } },
43
+ { option: "#335CFF", name: "Blue", icon: "i-celeste-circle-fill", active: { color: "#335CFF" } },
44
+ { option: "#FA7319", name: "Orange", icon: "i-celeste-circle-fill", active: { color: "#FA7319" } },
45
+ { option: "#7D52F4", name: "Purple", icon: "i-celeste-circle-fill", active: { color: "#7D52F4" } },
46
+ { option: "#47C2FF", name: "Sky", icon: "i-celeste-circle-fill", active: { color: "#47C2FF" } }
47
+ ]
48
+ },
49
+ { type: "divider" },
50
+ { slug: "bold", name: "Bold", icon: "i-celeste-bold", active: "bold" },
51
+ { slug: "italic", name: "Italic", icon: "i-celeste-italic", active: "italic" },
52
+ { slug: "underline", name: "Underline", icon: "i-celeste-underline", active: "underline" },
53
+ { slug: "strike", name: "Strike", icon: "i-celeste-strikethrough", active: "strike" },
54
+ { type: "divider" },
55
+ { slug: "bulletList", name: "Bulleted list", icon: "i-celeste-list-unordered", active: "bulletList" },
56
+ { slug: "orderedList", name: "Numbered list", icon: "i-celeste-list-ordered", active: "orderedList" },
57
+ { type: "divider" },
58
+ {
59
+ slug: "align",
60
+ name: "Text alignment",
61
+ children: [
62
+ { option: "left", name: "Left align", icon: "i-celeste-align-left", active: { textAlign: "left" } },
63
+ { option: "center", name: "Center align", icon: "i-celeste-align-center", active: { textAlign: "center" } },
64
+ { option: "right", name: "Right align", icon: "i-celeste-align-right", active: { textAlign: "right" } },
65
+ { option: "justify", name: "Justify", icon: "i-celeste-align-justify", active: { textAlign: "justify" } }
66
+ ]
67
+ },
68
+ { type: "divider" },
69
+ { slug: "link", name: "Insert Link", icon: "i-celeste-link", active: "link" },
70
+ { type: "divider" },
71
+ { slug: "undo", name: "Undo", icon: "i-celeste-arrow-go-back-line", active: "undo" },
72
+ { slug: "redo", name: "Redo", icon: "i-celeste-arrow-go-forward-line", active: "redo" },
73
+ { slug: "clear", name: "Clear style", icon: "i-celeste-format-clear", active: "clear" }
74
+ ]);
75
+ function onActionClick(editor, slug, option = null, showLinkBubble) {
76
+ var _a;
77
+ const chain = editor.chain().focus();
78
+ if (!chain) {
79
+ return;
80
+ }
81
+ const actionTriggers = {
82
+ heading: () => {
83
+ if (!option) {
84
+ return;
85
+ }
86
+ if (option === "p") {
87
+ chain.setParagraph().run();
88
+ } else {
89
+ const headingLevel = Number(option);
90
+ chain.toggleHeading({ level: headingLevel }).run();
91
+ }
92
+ },
93
+ fontSize: () => {
94
+ editor.chain().focus().setFontSize(option ?? "16px").run();
95
+ },
96
+ color: () => {
97
+ editor.chain().focus().setColor(option ?? "#000000").run();
98
+ },
99
+ bold: () => chain.toggleBold().run(),
100
+ italic: () => chain.toggleItalic().run(),
101
+ underline: () => chain.toggleUnderline().run(),
102
+ strike: () => chain.toggleStrike().run(),
103
+ bulletList: () => chain.toggleBulletList().run(),
104
+ orderedList: () => chain.toggleOrderedList().run(),
105
+ align: () => chain.setTextAlign(option ?? "left").run(),
106
+ link: () => {
107
+ if (showLinkBubble) {
108
+ showLinkBubble();
109
+ }
110
+ },
111
+ undo: () => chain.undo().run(),
112
+ redo: () => chain.redo().run(),
113
+ clear: () => chain.clearNodes().unsetAllMarks().run()
114
+ };
115
+ (_a = actionTriggers[slug]) == null ? void 0 : _a.call(actionTriggers);
116
+ }
117
+ function selectedOption(editor, children) {
118
+ if (!Array.isArray(children)) {
119
+ return "";
120
+ }
121
+ for (const child of children) {
122
+ if (Object.prototype.hasOwnProperty.call(child.active, "fontSize")) {
123
+ const currentFontSize = editor.getAttributes("textStyle").fontSize || "16px";
124
+ return currentFontSize;
125
+ }
126
+ if (editor.isActive(child.active)) {
127
+ return child.option;
128
+ }
129
+ }
130
+ return children[0].option;
131
+ }
132
+ export {
133
+ fullToolbar,
134
+ onActionClick,
135
+ selectedOption
136
+ };
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, openBlock, createBlock, unref, mergeProps, withCtx, renderSlot } from "vue";
2
- import { R as fh } from "./chunks/index.js";
2
+ import { a4 as fh } 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: "dropdown-menu-group",
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, openBlock, createBlock, unref, mergeProps, withCtx, createElementVNode, renderSlot, toDisplayString, createElementBlock, createCommentVNode } from "vue";
2
2
  import { useDelegatedProps } from "./use-delegated-props.js";
3
3
  import { c as clsx } from "./chunks/clsx.js";
4
- import { A as At, S as ch } from "./chunks/index.js";
4
+ import { A as At, a5 as ch } from "./chunks/index.js";
5
5
  import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
6
6
  const _hoisted_1 = { class: "celeste-dropdown-menu-item-prefix" };
7
7
  const _hoisted_2 = { class: "celeste-dropdown-menu-item-body" };
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, openBlock, createBlock, unref, mergeProps, withCtx, renderSlot } from "vue";
2
2
  import { useDelegatedProps } from "./use-delegated-props.js";
3
3
  import { c as clsx } from "./chunks/clsx.js";
4
- import { A as At, T as hh } from "./chunks/index.js";
4
+ import { A as At, a6 as hh } 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: "dropdown-menu-label",
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, openBlock, createBlock, unref, mergeProps } from "vue";
2
2
  import { useDelegatedProps } from "./use-delegated-props.js";
3
3
  import { c as clsx } from "./chunks/clsx.js";
4
- import { _ as ph } from "./chunks/index.js";
4
+ import { a7 as ph } 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: "dropdown-menu-separator",
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, openBlock, createBlock, unref, mergeProps, withCtx, renderSlot } from "vue";
2
- import { A as At, $ as rh } from "./chunks/index.js";
2
+ import { A as At, a8 as rh } 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: "dropdown-menu-trigger",
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, ref, openBlock, createBlock, unref, mergeProps, withCtx, renderSlot } from "vue";
2
2
  import { useDelegatedProps } from "./use-delegated-props.js";
3
- import { a0 as sh } from "./chunks/index.js";
3
+ import { a9 as sh } from "./chunks/index.js";
4
4
  import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
5
5
  const _sfc_main = /* @__PURE__ */ defineComponent({
6
6
  __name: "dropdown-menu",
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, mergeModels, useModel, ref, computed, watch, openBlock, createElementBlock, withKeys, createVNode, unref, withCtx, normalizeClass, createElementVNode, createCommentVNode, renderSlot, normalizeProps, guardReactiveProps, toDisplayString, createBlock, createSlots, Fragment, renderList } from "vue";
2
2
  import { c as clsx } from "./chunks/clsx.js";
3
- import { L as Hv, j as jv, U as Uv, X as Xv, J as Jv, P as tm, Z as Zv, D as qv, H as Qv } from "./chunks/index.js";
3
+ import { a1 as Hv, j as jv, a3 as Uv, $ as Xv, a0 as Jv, a2 as tm, Z as Zv, T as qv, X as Qv } from "./chunks/index.js";
4
4
  import Badge from "./badge.js";
5
5
  import TextInput from "./text-input.js";
6
6
  import DropdownItem from "./dropdown-item.js";
@@ -0,0 +1,156 @@
1
+ import { defineComponent, ref, openBlock, createElementBlock, createVNode, withCtx, Fragment, renderList, createElementVNode, normalizeClass, toDisplayString } from "vue";
2
+ import CompactButton from "./compact-button.js";
3
+ import SelectContent from "./select-content.js";
4
+ import SelectIcon from "./select-icon.js";
5
+ import SelectItem from "./select-item.js";
6
+ import SelectTrigger from "./select-trigger.js";
7
+ import { _ as _sfc_main$1 } from "./chunks/select.js";
8
+ import Tooltip from "./tooltip.js";
9
+ import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
10
+ const _hoisted_1 = { class: "show-more-wrapper" };
11
+ const _sfc_main = /* @__PURE__ */ defineComponent({
12
+ __name: "extra-settings",
13
+ props: {
14
+ editor: {}
15
+ },
16
+ setup(__props) {
17
+ const props = __props;
18
+ const defaultValue = ref("");
19
+ const extraSettings = [
20
+ {
21
+ name: "Copy",
22
+ icon: "i-celeste-file-copy-line"
23
+ },
24
+ {
25
+ name: "Cut",
26
+ icon: "i-celeste-scissors-line"
27
+ },
28
+ {
29
+ name: "Delete",
30
+ icon: "i-celeste-delete-bin-4-line"
31
+ },
32
+ {
33
+ name: "Duplicate",
34
+ icon: "i-celeste-add-circle-line"
35
+ }
36
+ ];
37
+ function selectedText(editor) {
38
+ const { from, to } = editor.state.selection;
39
+ const text = editor.state.doc.textBetween(from, to, "\n");
40
+ return text || null;
41
+ }
42
+ async function copySelectionToClipboard(editor) {
43
+ const text = selectedText(editor);
44
+ if (!text) {
45
+ return;
46
+ }
47
+ try {
48
+ if (!window.isSecureContext) {
49
+ throw new Error("Clipboard API is not available in insecure contexts");
50
+ }
51
+ const copyText = await navigator.clipboard.writeText(text);
52
+ return copyText;
53
+ } catch (error) {
54
+ console.error(error);
55
+ }
56
+ }
57
+ async function cutSelection(editor) {
58
+ await copySelectionToClipboard(editor);
59
+ deleteSelection(editor);
60
+ }
61
+ function deleteSelection(editor) {
62
+ return editor.commands.deleteSelection();
63
+ }
64
+ function duplicateSelection(editor) {
65
+ const { to } = editor.state.selection;
66
+ const text = selectedText(editor);
67
+ if (!text) {
68
+ return;
69
+ }
70
+ return editor.commands.insertContentAt(to, text);
71
+ }
72
+ function clearSelectedValue() {
73
+ defaultValue.value = "";
74
+ }
75
+ function onActionClick(name, editor) {
76
+ switch (name) {
77
+ case "Copy":
78
+ copySelectionToClipboard(editor);
79
+ break;
80
+ case "Cut":
81
+ cutSelection(editor);
82
+ break;
83
+ case "Delete":
84
+ deleteSelection(editor);
85
+ break;
86
+ case "Duplicate":
87
+ duplicateSelection(editor);
88
+ break;
89
+ }
90
+ }
91
+ return (_ctx, _cache) => {
92
+ return openBlock(), createElementBlock("div", _hoisted_1, [
93
+ createVNode(_sfc_main$1, {
94
+ modelValue: defaultValue.value,
95
+ "onUpdate:modelValue": [
96
+ _cache[0] || (_cache[0] = ($event) => defaultValue.value = $event),
97
+ _cache[1] || (_cache[1] = ($event) => onActionClick($event, props.editor))
98
+ ],
99
+ "onUpdate:open": clearSelectedValue
100
+ }, {
101
+ default: withCtx(() => [
102
+ createVNode(SelectTrigger, { variant: "inline" }, {
103
+ default: withCtx(() => [
104
+ createVNode(Tooltip, {
105
+ title: "Extra settings",
106
+ variant: "dark"
107
+ }, {
108
+ default: withCtx(() => [
109
+ createVNode(CompactButton, {
110
+ icon: "i-celeste-more-2-line",
111
+ variant: "ghost"
112
+ })
113
+ ]),
114
+ _: 1
115
+ })
116
+ ]),
117
+ _: 1
118
+ }),
119
+ createVNode(SelectContent, {
120
+ align: "end",
121
+ width: "fit"
122
+ }, {
123
+ default: withCtx(() => [
124
+ (openBlock(), createElementBlock(Fragment, null, renderList(extraSettings, (item, index) => {
125
+ return createVNode(SelectItem, {
126
+ key: index,
127
+ value: item.name
128
+ }, {
129
+ default: withCtx(() => [
130
+ createVNode(SelectIcon, null, {
131
+ default: withCtx(() => [
132
+ createElementVNode("i", {
133
+ class: normalizeClass(item.icon)
134
+ }, null, 2)
135
+ ]),
136
+ _: 2
137
+ }, 1024),
138
+ createElementVNode("span", null, toDisplayString(item.name), 1)
139
+ ]),
140
+ _: 2
141
+ }, 1032, ["value"]);
142
+ }), 64))
143
+ ]),
144
+ _: 1
145
+ })
146
+ ]),
147
+ _: 1
148
+ }, 8, ["modelValue"])
149
+ ]);
150
+ };
151
+ }
152
+ });
153
+ const ExtraSettings = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-49d51443"]]);
154
+ export {
155
+ ExtraSettings as default
156
+ };
package/dist/es/index.js CHANGED
@@ -1,10 +1,10 @@
1
- import alert from "./alert.js";
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 linkButton from "./link-button.js";
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 label from "./label.js";
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 selectIcon from "./select-icon.js";
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,21 @@ 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 { _ as _sfc_main$f } from "./chunks/switch.vue_vue_type_style_index_0_lang.js";
61
+ import sonnerAlert from "./sonner-alert.js";
62
+ import { _ as _sfc_main$f } 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 textInputAffix from "./text-input-affix.js";
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";
70
73
  const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
71
74
  __proto__: null,
72
- Alert: alert,
75
+ Alert,
73
76
  Badge,
74
77
  Button,
75
78
  Checkbox: _sfc_main,
@@ -101,8 +104,8 @@ const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
101
104
  DropdownMenuTrigger: dropdownMenuTrigger,
102
105
  FancyButton: fancyButton,
103
106
  HintText: hintText,
104
- Label: label,
105
- LinkButton: linkButton,
107
+ Label,
108
+ LinkButton,
106
109
  Modal: _sfc_main$7,
107
110
  ModalBody: modalBody,
108
111
  ModalClose: _sfc_main$8,
@@ -113,13 +116,14 @@ const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
113
116
  Popover: _sfc_main$a,
114
117
  PopoverContent,
115
118
  PopoverTrigger,
119
+ RichEditor: richEditor,
116
120
  ScrollArea: _sfc_main$b,
117
121
  SegmentedControl: segmentedControl,
118
122
  SegmentedControlItem: segmentedControlItem,
119
123
  Select: _sfc_main$c,
120
124
  SelectContent,
121
125
  SelectGroup: _sfc_main$d,
122
- SelectIcon: selectIcon,
126
+ SelectIcon,
123
127
  SelectItem,
124
128
  SelectLabel: selectLabel,
125
129
  SelectSeparator: selectSeparator,
@@ -127,14 +131,16 @@ const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
127
131
  SelectValue,
128
132
  Slider: _sfc_main$e,
129
133
  SocialButton: socialButton,
134
+ Sonner: _sfc_main$f,
135
+ SonnerAlert: sonnerAlert,
130
136
  StatusBadge: statusBadge,
131
- Switch: _sfc_main$f,
137
+ Switch: _sfc_main$g,
132
138
  TabMenu: tabMenu,
133
139
  TabMenuContent: tabMenuContent,
134
140
  TabMenuItem: tabMenuItem,
135
141
  TabMenuList: tabMenuList,
136
142
  TextInput,
137
- TextInputAffix: textInputAffix,
143
+ TextInputAffix,
138
144
  TextInputButton,
139
145
  Textarea: textarea,
140
146
  Tooltip
@@ -147,7 +153,7 @@ const Celeste = {
147
153
  }
148
154
  };
149
155
  export {
150
- alert as Alert,
156
+ Alert,
151
157
  Badge,
152
158
  Button,
153
159
  Celeste,
@@ -180,8 +186,8 @@ export {
180
186
  dropdownMenuTrigger as DropdownMenuTrigger,
181
187
  fancyButton as FancyButton,
182
188
  hintText as HintText,
183
- label as Label,
184
- linkButton as LinkButton,
189
+ Label,
190
+ LinkButton,
185
191
  _sfc_main$7 as Modal,
186
192
  modalBody as ModalBody,
187
193
  _sfc_main$8 as ModalClose,
@@ -192,13 +198,14 @@ export {
192
198
  _sfc_main$a as Popover,
193
199
  PopoverContent,
194
200
  PopoverTrigger,
201
+ richEditor as RichEditor,
195
202
  _sfc_main$b as ScrollArea,
196
203
  segmentedControl as SegmentedControl,
197
204
  segmentedControlItem as SegmentedControlItem,
198
205
  _sfc_main$c as Select,
199
206
  SelectContent,
200
207
  _sfc_main$d as SelectGroup,
201
- selectIcon as SelectIcon,
208
+ SelectIcon,
202
209
  SelectItem,
203
210
  selectLabel as SelectLabel,
204
211
  selectSeparator as SelectSeparator,
@@ -206,14 +213,16 @@ export {
206
213
  SelectValue,
207
214
  _sfc_main$e as Slider,
208
215
  socialButton as SocialButton,
216
+ _sfc_main$f as Sonner,
217
+ sonnerAlert as SonnerAlert,
209
218
  statusBadge as StatusBadge,
210
- _sfc_main$f as Switch,
219
+ _sfc_main$g as Switch,
211
220
  tabMenu as TabMenu,
212
221
  tabMenuContent as TabMenuContent,
213
222
  tabMenuItem as TabMenuItem,
214
223
  tabMenuList as TabMenuList,
215
224
  TextInput,
216
- textInputAffix as TextInputAffix,
225
+ TextInputAffix,
217
226
  TextInputButton,
218
227
  textarea as Textarea,
219
228
  Tooltip
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 { B as Oh } from "./chunks/index.js";
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 label = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-4768213c"]]);
53
+ const Label = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-4768213c"]]);
54
54
  export {
55
- label as default
55
+ Label as default
56
56
  };