mtxuilib 0.0.308 → 0.0.310
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/App.cjs +17 -1
- package/dist/MtmButton.cjs +2 -1
- package/dist/NovelEditorLoader.cjs +8 -4
- package/dist/browser/index.min.js +2 -1
- package/dist/common/FullCenter.cjs +2 -1
- package/dist/common/MtImage.cjs +2 -1
- package/dist/common/mtlink.cjs +2 -1
- package/dist/common/table/cells/ExpenderCell.cjs +9 -4
- package/dist/common/table/cells/SelectCell.cjs +8 -4
- package/dist/common/table/cells/Text.cjs +2 -1
- package/dist/common/table/cells/ViewLink.cjs +8 -4
- package/dist/common/table/cells/container/cellWrapper.cjs +2 -1
- package/dist/common/table/cells/number.cjs +2 -1
- package/dist/common/table/cells/string.cjs +2 -1
- package/dist/common/table/data-table-pagination.cjs +89 -51
- package/dist/common/table/data-table-view-options.cjs +32 -22
- package/dist/common/tailwind-indicator.cjs +9 -1
- package/dist/entry-client.cjs +2 -1
- package/dist/entry-server.cjs +2 -1
- package/dist/esm/App.js +17 -1
- package/dist/esm/MtmButton.js +2 -1
- package/dist/esm/NovelEditorLoader.js +8 -4
- package/dist/esm/common/FullCenter.js +2 -1
- package/dist/esm/common/MtImage.js +2 -1
- package/dist/esm/common/mtlink.js +2 -1
- package/dist/esm/common/table/cells/ExpenderCell.js +9 -4
- package/dist/esm/common/table/cells/SelectCell.js +8 -4
- package/dist/esm/common/table/cells/Text.js +2 -1
- package/dist/esm/common/table/cells/ViewLink.js +8 -4
- package/dist/esm/common/table/cells/container/cellWrapper.js +2 -1
- package/dist/esm/common/table/cells/number.js +2 -1
- package/dist/esm/common/table/cells/string.js +2 -1
- package/dist/esm/common/table/data-table-pagination.js +89 -51
- package/dist/esm/common/table/data-table-view-options.js +32 -22
- package/dist/esm/common/tailwind-indicator.js +9 -1
- package/dist/esm/entry-client.js +2 -1
- package/dist/esm/entry-server.js +2 -1
- package/dist/esm/icons/icons.js +41 -31
- package/dist/esm/index.js +2 -1
- package/dist/esm/lib/connectquery/use-transport.js +2 -1
- package/dist/esm/lib/render copy.js +2 -1
- package/dist/esm/lib/render.js +2 -1
- package/dist/esm/store/MtConnectProvider.js +2 -1
- package/dist/esm/store/ReactQueryProvider.js +18 -10
- package/dist/esm/store/StorybookDecorator.js +5 -4
- package/dist/esm/store/appContext.js +28 -18
- package/dist/esm/store/hydrateCore.js +6 -5
- package/dist/esm/store/logger.context.js +3 -2
- package/dist/esm/store/pageMeta.js +5 -1
- package/dist/esm/tailwind.d.cts +88 -1
- package/dist/esm/ui/accordion.js +19 -11
- package/dist/esm/ui/alert copy.js +4 -3
- package/dist/esm/ui/alert-dialog.js +21 -17
- package/dist/esm/ui/alert.js +4 -3
- package/dist/esm/ui/avatar.js +4 -3
- package/dist/esm/ui/badge.js +2 -2
- package/dist/esm/ui/button.js +2 -1
- package/dist/esm/ui/calendar.js +4 -4
- package/dist/esm/ui/card.js +7 -6
- package/dist/esm/ui/checkbox.js +15 -10
- package/dist/esm/ui/command.js +25 -18
- package/dist/esm/ui/context-menu.js +35 -22
- package/dist/esm/ui/dialog.js +30 -17
- package/dist/esm/ui/drawer.js +28 -18
- package/dist/esm/ui/dropdown-menu.js +35 -22
- package/dist/esm/ui/form copy.js +14 -9
- package/dist/esm/ui/form.js +14 -9
- package/dist/esm/ui/hover-card.js +2 -1
- package/dist/esm/ui/input.js +2 -1
- package/dist/esm/ui/label.js +2 -1
- package/dist/esm/ui/menubar.js +37 -24
- package/dist/esm/ui/navigation-menu.js +36 -25
- package/dist/esm/ui/novel/novel/src/components/editor-bubble-item.js +2 -1
- package/dist/esm/ui/novel/novel/src/components/editor-bubble.js +5 -1
- package/dist/esm/ui/novel/novel/src/components/editor-command-item.js +5 -4
- package/dist/esm/ui/novel/novel/src/components/editor-command.js +21 -14
- package/dist/esm/ui/novel/novel/src/components/editor.js +7 -6
- package/dist/esm/ui/novel/novel/src/extensions/image-resizer.js +2 -1
- package/dist/esm/ui/novel/tailwind/advanced-editor.js +58 -35
- package/dist/esm/ui/novel/tailwind/generative/ai-completion-command.js +45 -30
- package/dist/esm/ui/novel/tailwind/generative/ai-selector-commands.js +37 -28
- package/dist/esm/ui/novel/tailwind/generative/ai-selector.js +58 -43
- package/dist/esm/ui/novel/tailwind/generative/generative-menu-switch.js +23 -15
- package/dist/esm/ui/novel/tailwind/selectors/color-selector.js +78 -55
- package/dist/esm/ui/novel/tailwind/selectors/link-selector.js +58 -50
- package/dist/esm/ui/novel/tailwind/selectors/node-selector.js +31 -19
- package/dist/esm/ui/novel/tailwind/selectors/text-buttons.js +13 -12
- package/dist/esm/ui/novel/tailwind/slash-command.js +12 -11
- package/dist/esm/ui/novel/tailwind/ui/button.js +2 -1
- package/dist/esm/ui/novel/tailwind/ui/command.js +25 -18
- package/dist/esm/ui/novel/tailwind/ui/dialog.js +30 -17
- package/dist/esm/ui/novel/tailwind/ui/icons/crazy-spinner.js +6 -1
- package/dist/esm/ui/novel/tailwind/ui/icons/font-default.js +20 -17
- package/dist/esm/ui/novel/tailwind/ui/icons/font-mono.js +20 -17
- package/dist/esm/ui/novel/tailwind/ui/icons/font-serif.js +20 -17
- package/dist/esm/ui/novel/tailwind/ui/icons/github.js +5 -4
- package/dist/esm/ui/novel/tailwind/ui/icons/loading-circle.js +20 -17
- package/dist/esm/ui/novel/tailwind/ui/icons/magic.js +27 -24
- package/dist/esm/ui/novel/tailwind/ui/menu.js +28 -16
- package/dist/esm/ui/novel/tailwind/ui/popover.js +3 -2
- package/dist/esm/ui/novel/tailwind/ui/scroll-area.js +18 -10
- package/dist/esm/ui/novel/tailwind/ui/separator.js +2 -1
- package/dist/esm/ui/pagination.js +32 -19
- package/dist/esm/ui/popover.js +3 -2
- package/dist/esm/ui/progress.js +15 -10
- package/dist/esm/ui/radio-group.js +7 -5
- package/dist/esm/ui/resizable.js +10 -5
- package/dist/esm/ui/scroll-area.js +26 -18
- package/dist/esm/ui/select.js +37 -26
- package/dist/esm/ui/separator.js +2 -1
- package/dist/esm/ui/sheet.js +24 -14
- package/dist/esm/ui/skeleton.js +2 -1
- package/dist/esm/ui/slider.js +12 -5
- package/dist/esm/ui/sonner.js +2 -1
- package/dist/esm/ui/switch.js +12 -11
- package/dist/esm/ui/table.js +10 -9
- package/dist/esm/ui/tabs.js +4 -3
- package/dist/esm/ui/textarea.js +2 -1
- package/dist/esm/ui/toast.js +14 -9
- package/dist/esm/ui/toaster.js +18 -4
- package/dist/esm/ui/toggle.js +2 -1
- package/dist/esm/ui/tooltip.js +2 -1
- package/dist/esm/ui/ui-mt/NavTag.js +5 -4
- package/dist/esm/ui/ui-mt/SimpleModel.js +12 -11
- package/dist/esm/ui/ui-mt/inputField/InputField.js +27 -20
- package/dist/esm/ui/ui-mt/inputField/SingleUploadForm.js +67 -56
- package/dist/esm/ui/ui-mt/inputField/TextArea.js +20 -16
- package/dist/esm/ui/ui-mt/inputField/TextFileInput.js +18 -15
- package/dist/esm/ui/ui-mt/inputField/select/InputSelect.js +35 -27
- package/dist/esm/ui/ui-mt/inputs/SearchInput.js +2 -1
- package/dist/esm/ui/ui-mt/inputs/searchBar.js +12 -8
- package/dist/esm/ui/ui-mt/skeleton/skeleton-card.js +9 -4
- package/dist/esm/ui/ui-mt/skeleton/skeleton2.js +5 -1
- package/dist/esm/ui/ui-mt/skeleton/skeletons.js +9 -1
- package/dist/esm/ui/ui-vamp/alert.js +30 -24
- package/dist/esm/ui/ui-vamp/avatar.js +12 -7
- package/dist/esm/ui/ui-vamp/button.js +2 -1
- package/dist/esm/ui/ui-vamp/card.js +15 -8
- package/dist/esm/ui/ui-vamp/checkbox.js +15 -8
- package/dist/esm/ui/ui-vamp/chip.js +2 -1
- package/dist/esm/ui/ui-vamp/dropdown.js +7 -6
- package/dist/esm/ui/ui-vamp/external-link.js +9 -4
- package/dist/esm/ui/ui-vamp/headline.js +5 -1
- package/dist/esm/ui/ui-vamp/input.js +3 -2
- package/dist/esm/ui/ui-vamp/keyvalue.js +5 -1
- package/dist/esm/ui/ui-vamp/label.js +2 -1
- package/dist/esm/ui/ui-vamp/mobile-nav-button.js +6 -5
- package/dist/esm/ui/ui-vamp/modal.js +17 -13
- package/dist/esm/ui/ui-vamp/pagination.js +57 -35
- package/dist/esm/ui/ui-vamp/scroll-area.js +5 -4
- package/dist/esm/ui/ui-vamp/skeleton.js +2 -2
- package/dist/esm/ui/ui-vamp/stripe-not-connected-modal.js +13 -2
- package/dist/esm/ui/ui-vamp/textarea.js +12 -8
- package/dist/esm/ui/ui-vamp/toggle-group.js +3 -2
- package/dist/icons/icons.cjs +41 -31
- package/dist/index.cjs +2 -1
- package/dist/lib/connectquery/use-transport.cjs +2 -1
- package/dist/lib/render copy.cjs +2 -1
- package/dist/lib/render.cjs +2 -1
- package/dist/store/MtConnectProvider.cjs +2 -1
- package/dist/store/ReactQueryProvider.cjs +18 -10
- package/dist/store/StorybookDecorator.cjs +5 -4
- package/dist/store/appContext.cjs +28 -28
- package/dist/store/hydrateCore.cjs +6 -5
- package/dist/store/logger.context.cjs +3 -2
- package/dist/store/pageMeta.cjs +5 -1
- package/dist/tailwind.cjs +72 -2
- package/dist/tsconfig.type.tsbuildinfo +1 -1
- package/dist/ui/accordion.cjs +19 -11
- package/dist/ui/alert copy.cjs +4 -3
- package/dist/ui/alert-dialog.cjs +21 -17
- package/dist/ui/alert.cjs +4 -3
- package/dist/ui/avatar.cjs +4 -3
- package/dist/ui/badge.cjs +2 -12
- package/dist/ui/button.cjs +2 -1
- package/dist/ui/calendar.cjs +4 -14
- package/dist/ui/card.cjs +7 -6
- package/dist/ui/checkbox.cjs +15 -10
- package/dist/ui/command.cjs +25 -18
- package/dist/ui/context-menu.cjs +35 -22
- package/dist/ui/dialog.cjs +30 -17
- package/dist/ui/drawer.cjs +28 -18
- package/dist/ui/dropdown-menu.cjs +35 -22
- package/dist/ui/form copy.cjs +14 -9
- package/dist/ui/form.cjs +14 -9
- package/dist/ui/hover-card.cjs +2 -1
- package/dist/ui/input.cjs +2 -1
- package/dist/ui/label.cjs +2 -1
- package/dist/ui/menubar.cjs +37 -24
- package/dist/ui/navigation-menu.cjs +36 -25
- package/dist/ui/novel/novel/src/components/editor-bubble-item.cjs +2 -1
- package/dist/ui/novel/novel/src/components/editor-bubble.cjs +5 -1
- package/dist/ui/novel/novel/src/components/editor-command-item.cjs +5 -4
- package/dist/ui/novel/novel/src/components/editor-command.cjs +21 -14
- package/dist/ui/novel/novel/src/components/editor.cjs +7 -6
- package/dist/ui/novel/novel/src/extensions/image-resizer.cjs +2 -1
- package/dist/ui/novel/tailwind/advanced-editor.cjs +58 -35
- package/dist/ui/novel/tailwind/generative/ai-completion-command.cjs +45 -30
- package/dist/ui/novel/tailwind/generative/ai-selector-commands.cjs +37 -28
- package/dist/ui/novel/tailwind/generative/ai-selector.cjs +58 -43
- package/dist/ui/novel/tailwind/generative/generative-menu-switch.cjs +23 -15
- package/dist/ui/novel/tailwind/selectors/color-selector.cjs +78 -55
- package/dist/ui/novel/tailwind/selectors/link-selector.cjs +58 -50
- package/dist/ui/novel/tailwind/selectors/node-selector.cjs +31 -19
- package/dist/ui/novel/tailwind/selectors/text-buttons.cjs +13 -12
- package/dist/ui/novel/tailwind/slash-command.cjs +12 -11
- package/dist/ui/novel/tailwind/ui/button.cjs +2 -1
- package/dist/ui/novel/tailwind/ui/command.cjs +25 -18
- package/dist/ui/novel/tailwind/ui/dialog.cjs +30 -17
- package/dist/ui/novel/tailwind/ui/icons/crazy-spinner.cjs +6 -1
- package/dist/ui/novel/tailwind/ui/icons/font-default.cjs +20 -17
- package/dist/ui/novel/tailwind/ui/icons/font-mono.cjs +20 -17
- package/dist/ui/novel/tailwind/ui/icons/font-serif.cjs +20 -17
- package/dist/ui/novel/tailwind/ui/icons/github.cjs +5 -4
- package/dist/ui/novel/tailwind/ui/icons/loading-circle.cjs +20 -17
- package/dist/ui/novel/tailwind/ui/icons/magic.cjs +27 -24
- package/dist/ui/novel/tailwind/ui/menu.cjs +28 -16
- package/dist/ui/novel/tailwind/ui/popover.cjs +3 -2
- package/dist/ui/novel/tailwind/ui/scroll-area.cjs +18 -10
- package/dist/ui/novel/tailwind/ui/separator.cjs +2 -1
- package/dist/ui/pagination.cjs +32 -19
- package/dist/ui/popover.cjs +3 -2
- package/dist/ui/progress.cjs +15 -10
- package/dist/ui/radio-group.cjs +7 -5
- package/dist/ui/resizable.cjs +10 -5
- package/dist/ui/scroll-area.cjs +26 -18
- package/dist/ui/select.cjs +37 -26
- package/dist/ui/separator.cjs +2 -1
- package/dist/ui/sheet.cjs +24 -14
- package/dist/ui/skeleton.cjs +2 -1
- package/dist/ui/slider.cjs +12 -5
- package/dist/ui/sonner.cjs +2 -1
- package/dist/ui/switch.cjs +12 -11
- package/dist/ui/table.cjs +10 -9
- package/dist/ui/tabs.cjs +4 -3
- package/dist/ui/textarea.cjs +2 -1
- package/dist/ui/toast.cjs +14 -9
- package/dist/ui/toaster.cjs +18 -4
- package/dist/ui/toggle.cjs +2 -1
- package/dist/ui/tooltip.cjs +2 -1
- package/dist/ui/ui-mt/NavTag.cjs +5 -4
- package/dist/ui/ui-mt/SimpleModel.cjs +12 -11
- package/dist/ui/ui-mt/inputField/InputField.cjs +27 -20
- package/dist/ui/ui-mt/inputField/SingleUploadForm.cjs +67 -56
- package/dist/ui/ui-mt/inputField/TextArea.cjs +20 -16
- package/dist/ui/ui-mt/inputField/TextFileInput.cjs +18 -25
- package/dist/ui/ui-mt/inputField/select/InputSelect.cjs +35 -27
- package/dist/ui/ui-mt/inputs/SearchInput.cjs +2 -1
- package/dist/ui/ui-mt/inputs/searchBar.cjs +12 -8
- package/dist/ui/ui-mt/skeleton/skeleton-card.cjs +9 -4
- package/dist/ui/ui-mt/skeleton/skeleton2.cjs +5 -1
- package/dist/ui/ui-mt/skeleton/skeletons.cjs +9 -1
- package/dist/ui/ui-vamp/alert.cjs +30 -24
- package/dist/ui/ui-vamp/avatar.cjs +12 -7
- package/dist/ui/ui-vamp/button.cjs +2 -1
- package/dist/ui/ui-vamp/card.cjs +15 -18
- package/dist/ui/ui-vamp/checkbox.cjs +15 -8
- package/dist/ui/ui-vamp/chip.cjs +2 -1
- package/dist/ui/ui-vamp/dropdown.cjs +7 -6
- package/dist/ui/ui-vamp/external-link.cjs +9 -4
- package/dist/ui/ui-vamp/headline.cjs +5 -1
- package/dist/ui/ui-vamp/input.cjs +3 -2
- package/dist/ui/ui-vamp/keyvalue.cjs +5 -1
- package/dist/ui/ui-vamp/label.cjs +2 -1
- package/dist/ui/ui-vamp/mobile-nav-button.cjs +6 -5
- package/dist/ui/ui-vamp/modal.cjs +17 -13
- package/dist/ui/ui-vamp/pagination.cjs +57 -35
- package/dist/ui/ui-vamp/scroll-area.cjs +5 -4
- package/dist/ui/ui-vamp/skeleton.cjs +2 -12
- package/dist/ui/ui-vamp/stripe-not-connected-modal.cjs +13 -2
- package/dist/ui/ui-vamp/textarea.cjs +12 -8
- package/dist/ui/ui-vamp/toggle-group.cjs +3 -2
- package/package.json +5 -4
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
1
2
|
import { Check, TextQuote, TrashIcon } from "lucide-react";
|
|
2
3
|
import { CommandGroup, CommandItem, CommandSeparator } from "../ui/command";
|
|
3
4
|
import { useEditor } from "../../novel/src/components";
|
|
@@ -9,37 +10,51 @@ const AICompletionCommands = ({
|
|
|
9
10
|
if (!editor) {
|
|
10
11
|
return null;
|
|
11
12
|
}
|
|
12
|
-
return /* @__PURE__ */
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
14
|
+
/* @__PURE__ */ jsxs(CommandGroup, { children: [
|
|
15
|
+
/* @__PURE__ */ jsxs(
|
|
16
|
+
CommandItem,
|
|
17
|
+
{
|
|
18
|
+
className: "gap-2 px-4",
|
|
19
|
+
value: "replace",
|
|
20
|
+
onSelect: () => {
|
|
21
|
+
const selection = editor.view.state.selection;
|
|
22
|
+
editor.chain().focus().insertContentAt(
|
|
23
|
+
{
|
|
24
|
+
from: selection.from,
|
|
25
|
+
to: selection.to
|
|
26
|
+
},
|
|
27
|
+
completion
|
|
28
|
+
).run();
|
|
23
29
|
},
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ jsx(Check, { className: "text-muted-foreground h-4 w-4" }),
|
|
32
|
+
"Replace selection"
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
),
|
|
36
|
+
/* @__PURE__ */ jsxs(
|
|
37
|
+
CommandItem,
|
|
38
|
+
{
|
|
39
|
+
className: "gap-2 px-4",
|
|
40
|
+
value: "insert",
|
|
41
|
+
onSelect: () => {
|
|
42
|
+
const selection = editor.view.state.selection;
|
|
43
|
+
editor.chain().focus().insertContentAt(selection.to + 1, completion).run();
|
|
44
|
+
},
|
|
45
|
+
children: [
|
|
46
|
+
/* @__PURE__ */ jsx(TextQuote, { className: "text-muted-foreground h-4 w-4" }),
|
|
47
|
+
"Insert below"
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
)
|
|
51
|
+
] }),
|
|
52
|
+
/* @__PURE__ */ jsx(CommandSeparator, {}),
|
|
53
|
+
/* @__PURE__ */ jsx(CommandGroup, { children: /* @__PURE__ */ jsxs(CommandItem, { onSelect: onDiscard, value: "thrash", className: "gap-2 px-4", children: [
|
|
54
|
+
/* @__PURE__ */ jsx(TrashIcon, { className: "text-muted-foreground h-4 w-4" }),
|
|
55
|
+
"Discard"
|
|
56
|
+
] }) })
|
|
57
|
+
] });
|
|
43
58
|
};
|
|
44
59
|
var ai_completion_command_default = AICompletionCommands;
|
|
45
60
|
export {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
1
2
|
import {
|
|
2
3
|
ArrowDownWideNarrow,
|
|
3
4
|
CheckCheck,
|
|
@@ -34,35 +35,43 @@ const AISelectorCommands = ({ onSelect }) => {
|
|
|
34
35
|
const { editor } = useEditor();
|
|
35
36
|
if (!editor)
|
|
36
37
|
return null;
|
|
37
|
-
return /* @__PURE__ */
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
39
|
+
/* @__PURE__ */ jsx(CommandGroup, { heading: "Edit or review selection", children: options.map((option) => /* @__PURE__ */ jsxs(
|
|
40
|
+
CommandItem,
|
|
41
|
+
{
|
|
42
|
+
onSelect: (value) => {
|
|
43
|
+
const slice = editor.state.selection.content();
|
|
44
|
+
const text = editor.storage.markdown.serializer.serialize(
|
|
45
|
+
slice.content
|
|
46
|
+
);
|
|
47
|
+
onSelect(text, value);
|
|
48
|
+
},
|
|
49
|
+
className: "flex gap-2 px-4",
|
|
50
|
+
value: option.value,
|
|
51
|
+
children: [
|
|
52
|
+
/* @__PURE__ */ jsx(option.icon, { className: "h-4 w-4 text-purple-500" }),
|
|
53
|
+
option.label
|
|
54
|
+
]
|
|
46
55
|
},
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
)
|
|
56
|
+
option.value
|
|
57
|
+
)) }),
|
|
58
|
+
/* @__PURE__ */ jsx(CommandSeparator, {}),
|
|
59
|
+
/* @__PURE__ */ jsx(CommandGroup, { heading: "Use AI to do more", children: /* @__PURE__ */ jsxs(
|
|
60
|
+
CommandItem,
|
|
61
|
+
{
|
|
62
|
+
onSelect: () => {
|
|
63
|
+
const text = getPrevText(editor, { chars: 5e3 });
|
|
64
|
+
onSelect(text, "continue");
|
|
65
|
+
},
|
|
66
|
+
value: "continue",
|
|
67
|
+
className: "gap-2 px-4",
|
|
68
|
+
children: [
|
|
69
|
+
/* @__PURE__ */ jsx(StepForward, { className: "h-4 w-4 text-purple-500" }),
|
|
70
|
+
"Continue writing"
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
) })
|
|
74
|
+
] });
|
|
66
75
|
};
|
|
67
76
|
var ai_selector_commands_default = AISelectorCommands;
|
|
68
77
|
export {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
3
|
import { useCompletion } from "ai/react";
|
|
3
4
|
import { ArrowUp } from "lucide-react";
|
|
4
5
|
import { useState } from "react";
|
|
@@ -32,49 +33,63 @@ function AISelector({ onOpenChange }) {
|
|
|
32
33
|
const hasCompletion = completion.length > 0;
|
|
33
34
|
if (!editor)
|
|
34
35
|
return null;
|
|
35
|
-
return /* @__PURE__ */
|
|
36
|
-
|
|
37
|
-
{
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
36
|
+
return /* @__PURE__ */ jsxs(Command, { className: "w-[350px]", children: [
|
|
37
|
+
hasCompletion && /* @__PURE__ */ jsx("div", { className: "flex max-h-[400px]", children: /* @__PURE__ */ jsx(ScrollArea, { children: /* @__PURE__ */ jsx("div", { className: "prose prose-sm p-2 px-4", children: /* @__PURE__ */ jsx(Markdown, { children: completion }) }) }) }),
|
|
38
|
+
isLoading && /* @__PURE__ */ jsxs("div", { className: "text-muted-foreground flex h-12 w-full items-center px-4 text-sm font-medium text-purple-500", children: [
|
|
39
|
+
/* @__PURE__ */ jsx(Magic, { className: "mr-2 h-4 w-4 shrink-0 " }),
|
|
40
|
+
"AI is thinking",
|
|
41
|
+
/* @__PURE__ */ jsx("div", { className: "ml-2 mt-1", children: /* @__PURE__ */ jsx(CrazySpinner, {}) })
|
|
42
|
+
] }),
|
|
43
|
+
!isLoading && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
44
|
+
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
45
|
+
/* @__PURE__ */ jsx(
|
|
46
|
+
CommandInput,
|
|
47
|
+
{
|
|
48
|
+
value: inputValue,
|
|
49
|
+
onValueChange: setInputValue,
|
|
50
|
+
autoFocus: true,
|
|
51
|
+
placeholder: hasCompletion ? "Tell AI what to do next" : "Ask AI to edit or generate...",
|
|
52
|
+
onFocus: () => addAIHighlight(editor)
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
/* @__PURE__ */ jsx(
|
|
56
|
+
Button,
|
|
57
|
+
{
|
|
58
|
+
size: "icon",
|
|
59
|
+
className: "absolute right-2 top-1/2 h-6 w-6 -translate-y-1/2 rounded-full bg-purple-500 hover:bg-purple-900",
|
|
60
|
+
onClick: () => {
|
|
61
|
+
if (completion)
|
|
62
|
+
return complete(completion, {
|
|
63
|
+
body: { option: "zap", command: inputValue }
|
|
64
|
+
}).then(() => setInputValue(""));
|
|
65
|
+
const slice = editor.state.selection.content();
|
|
66
|
+
const text = editor.storage.markdown.serializer.serialize(
|
|
67
|
+
slice.content
|
|
68
|
+
);
|
|
69
|
+
complete(text, {
|
|
70
|
+
body: { option: "zap", command: inputValue }
|
|
71
|
+
}).then(() => setInputValue(""));
|
|
72
|
+
},
|
|
73
|
+
children: /* @__PURE__ */ jsx(ArrowUp, { className: "h-4 w-4" })
|
|
74
|
+
}
|
|
75
|
+
)
|
|
76
|
+
] }),
|
|
77
|
+
hasCompletion ? /* @__PURE__ */ jsx(
|
|
78
|
+
AICompletionCommands,
|
|
79
|
+
{
|
|
80
|
+
onDiscard: () => {
|
|
81
|
+
onOpenChange(false);
|
|
82
|
+
},
|
|
83
|
+
completion
|
|
84
|
+
}
|
|
85
|
+
) : /* @__PURE__ */ jsx(
|
|
86
|
+
AISelectorCommands,
|
|
87
|
+
{
|
|
88
|
+
onSelect: (value, option) => complete(value, { body: { option } })
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
] })
|
|
92
|
+
] });
|
|
78
93
|
}
|
|
79
94
|
export {
|
|
80
95
|
AISelector
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
1
2
|
import { Fragment, useEffect } from "react";
|
|
2
3
|
import { removeAIHighlight } from "../../novel/src/extensions";
|
|
3
4
|
import { Button } from "../ui/button";
|
|
@@ -18,7 +19,7 @@ const GenerativeMenuSwitch = ({
|
|
|
18
19
|
}, [open]);
|
|
19
20
|
if (!editor)
|
|
20
21
|
return;
|
|
21
|
-
return /* @__PURE__ */
|
|
22
|
+
return /* @__PURE__ */ jsxs(
|
|
22
23
|
EditorBubble,
|
|
23
24
|
{
|
|
24
25
|
tippyOptions: {
|
|
@@ -27,20 +28,27 @@ const GenerativeMenuSwitch = ({
|
|
|
27
28
|
onOpenChange(false);
|
|
28
29
|
}
|
|
29
30
|
},
|
|
30
|
-
className: "border-muted bg-background flex w-fit max-w-[90vw] overflow-hidden rounded-md border shadow-xl"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
31
|
+
className: "border-muted bg-background flex w-fit max-w-[90vw] overflow-hidden rounded-md border shadow-xl",
|
|
32
|
+
children: [
|
|
33
|
+
open && /* @__PURE__ */ jsx(AISelector, { open, onOpenChange }),
|
|
34
|
+
!open && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
35
|
+
/* @__PURE__ */ jsxs(
|
|
36
|
+
Button,
|
|
37
|
+
{
|
|
38
|
+
className: "gap-1 rounded-none text-purple-500",
|
|
39
|
+
variant: "ghost",
|
|
40
|
+
onClick: () => onOpenChange(true),
|
|
41
|
+
size: "sm",
|
|
42
|
+
children: [
|
|
43
|
+
/* @__PURE__ */ jsx(Magic, { className: "h-5 w-5" }),
|
|
44
|
+
"Ask AI"
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
),
|
|
48
|
+
children
|
|
49
|
+
] })
|
|
50
|
+
]
|
|
51
|
+
}
|
|
44
52
|
);
|
|
45
53
|
};
|
|
46
54
|
var generative_menu_switch_default = GenerativeMenuSwitch;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
1
2
|
import { Check, ChevronDown } from "lucide-react";
|
|
2
3
|
import { Button } from "../ui/button";
|
|
3
4
|
import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover";
|
|
@@ -88,63 +89,85 @@ const ColorSelector = (props) => {
|
|
|
88
89
|
const activeHighlightItem = HIGHLIGHT_COLORS.find(
|
|
89
90
|
({ color }) => editor.isActive("highlight", { color })
|
|
90
91
|
);
|
|
91
|
-
return /* @__PURE__ */
|
|
92
|
-
"
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
style: {
|
|
96
|
-
color: activeColorItem == null ? void 0 : activeColorItem.color,
|
|
97
|
-
backgroundColor: activeHighlightItem == null ? void 0 : activeHighlightItem.color
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
"A"
|
|
101
|
-
), /* @__PURE__ */ React.createElement(ChevronDown, { className: "h-4 w-4" }))), /* @__PURE__ */ React.createElement(
|
|
102
|
-
PopoverContent,
|
|
103
|
-
{
|
|
104
|
-
sideOffset: 5,
|
|
105
|
-
className: "my-1 flex max-h-80 w-48 flex-col overflow-hidden overflow-y-auto rounded border p-1 shadow-xl ",
|
|
106
|
-
align: "start"
|
|
107
|
-
},
|
|
108
|
-
/* @__PURE__ */ React.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ React.createElement("div", { className: "text-muted-foreground my-1 px-2 text-sm font-semibold" }, "Color"), TEXT_COLORS.map(({ name, color }, index) => /* @__PURE__ */ React.createElement(
|
|
109
|
-
EditorBubbleItem,
|
|
110
|
-
{
|
|
111
|
-
key: index,
|
|
112
|
-
onSelect: () => {
|
|
113
|
-
editor.commands.unsetColor();
|
|
114
|
-
name !== "Default" && editor.chain().focus().setColor(color || "").run();
|
|
115
|
-
},
|
|
116
|
-
className: "hover:bg-accent flex cursor-pointer items-center justify-between px-2 py-1 text-sm"
|
|
117
|
-
},
|
|
118
|
-
/* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React.createElement(
|
|
119
|
-
"div",
|
|
92
|
+
return /* @__PURE__ */ jsxs(Popover, { modal: true, open: props.open, onOpenChange: props.onOpenChange, children: [
|
|
93
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { size: "sm", className: "gap-2 rounded-none", variant: "ghost", children: [
|
|
94
|
+
/* @__PURE__ */ jsx(
|
|
95
|
+
"span",
|
|
120
96
|
{
|
|
121
|
-
className: "rounded-sm
|
|
122
|
-
style: {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
97
|
+
className: "rounded-sm px-1",
|
|
98
|
+
style: {
|
|
99
|
+
color: activeColorItem == null ? void 0 : activeColorItem.color,
|
|
100
|
+
backgroundColor: activeHighlightItem == null ? void 0 : activeHighlightItem.color
|
|
101
|
+
},
|
|
102
|
+
children: "A"
|
|
103
|
+
}
|
|
104
|
+
),
|
|
105
|
+
/* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4" })
|
|
106
|
+
] }) }),
|
|
107
|
+
/* @__PURE__ */ jsxs(
|
|
108
|
+
PopoverContent,
|
|
129
109
|
{
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
110
|
+
sideOffset: 5,
|
|
111
|
+
className: "my-1 flex max-h-80 w-48 flex-col overflow-hidden overflow-y-auto rounded border p-1 shadow-xl ",
|
|
112
|
+
align: "start",
|
|
113
|
+
children: [
|
|
114
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
115
|
+
/* @__PURE__ */ jsx("div", { className: "text-muted-foreground my-1 px-2 text-sm font-semibold", children: "Color" }),
|
|
116
|
+
TEXT_COLORS.map(({ name, color }, index) => /* @__PURE__ */ jsx(
|
|
117
|
+
EditorBubbleItem,
|
|
118
|
+
{
|
|
119
|
+
onSelect: () => {
|
|
120
|
+
editor.commands.unsetColor();
|
|
121
|
+
name !== "Default" && editor.chain().focus().setColor(color || "").run();
|
|
122
|
+
},
|
|
123
|
+
className: "hover:bg-accent flex cursor-pointer items-center justify-between px-2 py-1 text-sm",
|
|
124
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
125
|
+
/* @__PURE__ */ jsx(
|
|
126
|
+
"div",
|
|
127
|
+
{
|
|
128
|
+
className: "rounded-sm border px-2 py-px font-medium",
|
|
129
|
+
style: { color },
|
|
130
|
+
children: "A"
|
|
131
|
+
}
|
|
132
|
+
),
|
|
133
|
+
/* @__PURE__ */ jsx("span", { children: name })
|
|
134
|
+
] })
|
|
135
|
+
},
|
|
136
|
+
index
|
|
137
|
+
))
|
|
138
|
+
] }),
|
|
139
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
140
|
+
/* @__PURE__ */ jsx("div", { className: "text-muted-foreground my-1 px-2 text-sm font-semibold", children: "Background" }),
|
|
141
|
+
HIGHLIGHT_COLORS.map(({ name, color }, index) => /* @__PURE__ */ jsxs(
|
|
142
|
+
EditorBubbleItem,
|
|
143
|
+
{
|
|
144
|
+
onSelect: () => {
|
|
145
|
+
editor.commands.unsetHighlight();
|
|
146
|
+
name !== "Default" && editor.commands.setHighlight({ color });
|
|
147
|
+
},
|
|
148
|
+
className: "hover:bg-accent flex cursor-pointer items-center justify-between px-2 py-1 text-sm",
|
|
149
|
+
children: [
|
|
150
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
151
|
+
/* @__PURE__ */ jsx(
|
|
152
|
+
"div",
|
|
153
|
+
{
|
|
154
|
+
className: "rounded-sm border px-2 py-px font-medium",
|
|
155
|
+
style: { backgroundColor: color },
|
|
156
|
+
children: "A"
|
|
157
|
+
}
|
|
158
|
+
),
|
|
159
|
+
/* @__PURE__ */ jsx("span", { children: name })
|
|
160
|
+
] }),
|
|
161
|
+
editor.isActive("highlight", { color }) && /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" })
|
|
162
|
+
]
|
|
163
|
+
},
|
|
164
|
+
index
|
|
165
|
+
))
|
|
166
|
+
] })
|
|
167
|
+
]
|
|
168
|
+
}
|
|
169
|
+
)
|
|
170
|
+
] });
|
|
148
171
|
};
|
|
149
172
|
export {
|
|
150
173
|
ColorSelector
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
1
2
|
import { Popover, PopoverTrigger } from "@radix-ui/react-popover";
|
|
2
3
|
import { Check, Trash } from "lucide-react";
|
|
3
4
|
import {
|
|
@@ -36,59 +37,66 @@ const LinkSelector = ({ open, onOpenChange }) => {
|
|
|
36
37
|
});
|
|
37
38
|
if (!editor)
|
|
38
39
|
return null;
|
|
39
|
-
return /* @__PURE__ */
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
size: "sm",
|
|
43
|
-
variant: "ghost",
|
|
44
|
-
className: "gap-2 rounded-none border-none"
|
|
45
|
-
},
|
|
46
|
-
/* @__PURE__ */ React.createElement("p", { className: "text-base" }, "\u2197"),
|
|
47
|
-
/* @__PURE__ */ React.createElement(
|
|
48
|
-
"p",
|
|
49
|
-
{
|
|
50
|
-
className: cn("underline decoration-stone-400 underline-offset-4", {
|
|
51
|
-
"text-blue-500": editor.isActive("link")
|
|
52
|
-
})
|
|
53
|
-
},
|
|
54
|
-
"Link"
|
|
55
|
-
)
|
|
56
|
-
)), /* @__PURE__ */ React.createElement(PopoverContent, { align: "start", className: "w-60 p-0", sideOffset: 10 }, /* @__PURE__ */ React.createElement(
|
|
57
|
-
"form",
|
|
58
|
-
{
|
|
59
|
-
onSubmit: (e) => {
|
|
60
|
-
const target = e.currentTarget;
|
|
61
|
-
e.preventDefault();
|
|
62
|
-
const input = target[0];
|
|
63
|
-
const url = getUrlFromString(input.value);
|
|
64
|
-
url && editor.chain().focus().setLink({ href: url }).run();
|
|
65
|
-
},
|
|
66
|
-
className: "flex p-1 "
|
|
67
|
-
},
|
|
68
|
-
/* @__PURE__ */ React.createElement(
|
|
69
|
-
"input",
|
|
40
|
+
return /* @__PURE__ */ jsxs(Popover, { modal: true, open, onOpenChange, children: [
|
|
41
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
42
|
+
Button,
|
|
70
43
|
{
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
44
|
+
size: "sm",
|
|
45
|
+
variant: "ghost",
|
|
46
|
+
className: "gap-2 rounded-none border-none",
|
|
47
|
+
children: [
|
|
48
|
+
/* @__PURE__ */ jsx("p", { className: "text-base", children: "\u2197" }),
|
|
49
|
+
/* @__PURE__ */ jsx(
|
|
50
|
+
"p",
|
|
51
|
+
{
|
|
52
|
+
className: cn("underline decoration-stone-400 underline-offset-4", {
|
|
53
|
+
"text-blue-500": editor.isActive("link")
|
|
54
|
+
}),
|
|
55
|
+
children: "Link"
|
|
56
|
+
}
|
|
57
|
+
)
|
|
58
|
+
]
|
|
76
59
|
}
|
|
77
|
-
),
|
|
78
|
-
|
|
79
|
-
|
|
60
|
+
) }),
|
|
61
|
+
/* @__PURE__ */ jsx(PopoverContent, { align: "start", className: "w-60 p-0", sideOffset: 10, children: /* @__PURE__ */ jsxs(
|
|
62
|
+
"form",
|
|
80
63
|
{
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
editor.chain().focus().
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
64
|
+
onSubmit: (e) => {
|
|
65
|
+
const target = e.currentTarget;
|
|
66
|
+
e.preventDefault();
|
|
67
|
+
const input = target[0];
|
|
68
|
+
const url = getUrlFromString(input.value);
|
|
69
|
+
url && editor.chain().focus().setLink({ href: url }).run();
|
|
70
|
+
},
|
|
71
|
+
className: "flex p-1 ",
|
|
72
|
+
children: [
|
|
73
|
+
/* @__PURE__ */ jsx(
|
|
74
|
+
"input",
|
|
75
|
+
{
|
|
76
|
+
ref: inputRef,
|
|
77
|
+
type: "text",
|
|
78
|
+
placeholder: "Paste a link",
|
|
79
|
+
className: "bg-background flex-1 p-1 text-sm outline-none",
|
|
80
|
+
defaultValue: editor.getAttributes("link").href || ""
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
editor.getAttributes("link").href ? /* @__PURE__ */ jsx(
|
|
84
|
+
Button,
|
|
85
|
+
{
|
|
86
|
+
size: "icon",
|
|
87
|
+
variant: "outline",
|
|
88
|
+
type: "button",
|
|
89
|
+
className: "flex h-8 items-center rounded-sm p-1 text-red-600 transition-all hover:bg-red-100 dark:hover:bg-red-800",
|
|
90
|
+
onClick: () => {
|
|
91
|
+
editor.chain().focus().unsetLink().run();
|
|
92
|
+
},
|
|
93
|
+
children: /* @__PURE__ */ jsx(Trash, { className: "h-4 w-4" })
|
|
94
|
+
}
|
|
95
|
+
) : /* @__PURE__ */ jsx(Button, { size: "icon", className: "h-8", children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" }) })
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
) })
|
|
99
|
+
] });
|
|
92
100
|
};
|
|
93
101
|
export {
|
|
94
102
|
LinkSelector,
|