mtxuilib 0.0.261 → 0.0.263
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/NovelEditor.cjs +28 -0
- package/dist/browser/index.min.js +3 -2670
- package/dist/{types/src/index.d.ts → esm/NovelEditor.d.ts} +0 -1
- package/dist/esm/NovelEditor.js +6 -0
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -4
- package/dist/esm/tailwind.d.cts +2 -0
- package/dist/esm/tsconfig.type.tsbuildinfo +1 -0
- package/dist/index.cjs +2 -6
- package/dist/tailwind.cjs +3 -0
- package/package.json +26 -11
- package/dist/.next/types/app/layout.d.ts +0 -9
- package/dist/.next/types/app/page.d.ts +0 -9
- package/dist/editor.iife.js +0 -114970
- package/dist/editor.umd.js +0 -114971
- package/dist/src/App.d.ts +0 -5
- package/dist/src/MtmButton.d.ts +0 -2
- package/dist/src/NovelEditorLoader.d.ts +0 -2
- package/dist/src/icons/icons.d.ts +0 -125
- package/dist/src/index.d.ts +0 -3
- package/dist/src/lib/clientlib/domutils.d.ts +0 -15
- package/dist/src/lib/hash.d.ts +0 -6
- package/dist/src/lib/http/mthttp.d.ts +0 -8
- package/dist/src/lib/http/response-cache.test.d.ts +0 -4
- package/dist/src/lib/mtmclient/mtm/conf/conf-ConfService_connectquery.d.ts +0 -68
- package/dist/src/lib/mtmclient/mtm/conf/conf_connect.d.ts +0 -56
- package/dist/src/lib/mtmclient/mtm/conf/conf_pb.d.ts +0 -1231
- package/dist/src/lib/mtmclient/mtm/dash/dashpb/dash-DashService_connectquery.d.ts +0 -68
- package/dist/src/lib/mtmclient/mtm/dash/dashpb/dash_connect.d.ts +0 -56
- package/dist/src/lib/mtmclient/mtm/dash/dashpb/dash_pb.d.ts +0 -304
- package/dist/src/lib/mtmclient/mtm/mtbot/mtbotpb/bot-BotService_connectquery.d.ts +0 -46
- package/dist/src/lib/mtmclient/mtm/mtbot/mtbotpb/bot_connect.d.ts +0 -42
- package/dist/src/lib/mtmclient/mtm/mtbot/mtbotpb/bot_pb.d.ts +0 -487
- package/dist/src/lib/mtmclient/mtm/mtjob/mtjobpb/job-JobService_connectquery.d.ts +0 -72
- package/dist/src/lib/mtmclient/mtm/mtjob/mtjobpb/job_connect.d.ts +0 -60
- package/dist/src/lib/mtmclient/mtm/mtjob/mtjobpb/job_pb.d.ts +0 -366
- package/dist/src/lib/mtmclient/mtm/mtps/mtpspb/mtps-PsService_connectquery.d.ts +0 -67
- package/dist/src/lib/mtmclient/mtm/mtps/mtpspb/mtps_connect.d.ts +0 -57
- package/dist/src/lib/mtmclient/mtm/mtps/mtpspb/mtps_pb.d.ts +0 -259
- package/dist/src/lib/mtmclient/mtm/sp/sppb/sp-SpService_connectquery.d.ts +0 -284
- package/dist/src/lib/mtmclient/mtm/sp/sppb/sp_connect.d.ts +0 -208
- package/dist/src/lib/mtmclient/mtm/sp/sppb/sp_pb.d.ts +0 -1360
- package/dist/src/lib/mtmclient/mtm/sppb/ai-AiService_connectquery.d.ts +0 -32
- package/dist/src/lib/mtmclient/mtm/sppb/ai_connect.d.ts +0 -32
- package/dist/src/lib/mtmclient/mtm/sppb/ai_pb.d.ts +0 -76
- package/dist/src/lib/mtmclient/mtm/sppb/auth-AuthService_connectquery.d.ts +0 -128
- package/dist/src/lib/mtmclient/mtm/sppb/auth_connect.d.ts +0 -100
- package/dist/src/lib/mtmclient/mtm/sppb/auth_pb.d.ts +0 -479
- package/dist/src/lib/mtmclient/mtm/sppb/av-AvService_connectquery.d.ts +0 -68
- package/dist/src/lib/mtmclient/mtm/sppb/av_connect.d.ts +0 -56
- package/dist/src/lib/mtmclient/mtm/sppb/av_pb.d.ts +0 -137
- package/dist/src/lib/mtmclient/mtm/sppb/backend-Backend_connectquery.d.ts +0 -32
- package/dist/src/lib/mtmclient/mtm/sppb/backend_connect.d.ts +0 -32
- package/dist/src/lib/mtmclient/mtm/sppb/backend_pb.d.ts +0 -114
- package/dist/src/lib/mtmclient/mtm/sppb/blocks_pb.d.ts +0 -125
- package/dist/src/lib/mtmclient/mtm/sppb/blog-BlogService_connectquery.d.ts +0 -233
- package/dist/src/lib/mtmclient/mtm/sppb/blog_connect.d.ts +0 -175
- package/dist/src/lib/mtmclient/mtm/sppb/blog_pb.d.ts +0 -836
- package/dist/src/lib/mtmclient/mtm/sppb/common_pb.d.ts +0 -668
- package/dist/src/lib/mtmclient/mtm/sppb/cx-CxService_connectquery.d.ts +0 -185
- package/dist/src/lib/mtmclient/mtm/sppb/cx_connect.d.ts +0 -143
- package/dist/src/lib/mtmclient/mtm/sppb/cx_pb.d.ts +0 -790
- package/dist/src/lib/mtmclient/mtm/sppb/events_pb.d.ts +0 -440
- package/dist/src/lib/mtmclient/mtm/sppb/mtm-MtmService_connectquery.d.ts +0 -119
- package/dist/src/lib/mtmclient/mtm/sppb/mtm_connect.d.ts +0 -95
- package/dist/src/lib/mtmclient/mtm/sppb/mtm_pb.d.ts +0 -751
- package/dist/src/lib/mtmclient/mtm/sppb/mtmgh_pb.d.ts +0 -74
- package/dist/src/lib/mtmclient/mtm/sppb/site-SiteService_connectquery.d.ts +0 -166
- package/dist/src/lib/mtmclient/mtm/sppb/site_connect.d.ts +0 -126
- package/dist/src/lib/mtmclient/mtm/sppb/site_pb.d.ts +0 -474
- package/dist/src/lib/queue.d.ts +0 -12
- package/dist/src/lib/render.d.ts +0 -7
- package/dist/src/lib/url/routeHelper.d.ts +0 -14
- package/dist/src/lib/url/urlMatcher.d.ts +0 -42
- package/dist/src/lib/url/urlMatcher.spec.d.ts +0 -2
- package/dist/src/lib/utils.d.ts +0 -46
- package/dist/src/tailwind.d.cts +0 -4
- package/dist/src/ui/alert-dialog.d.ts +0 -20
- package/dist/src/ui/badge.d.ts +0 -10
- package/dist/src/ui/button.d.ts +0 -11
- package/dist/src/ui/calendar.d.ts +0 -8
- package/dist/src/ui/command.d.ts +0 -51
- package/dist/src/ui/context-menu.d.ts +0 -27
- package/dist/src/ui/dialog.d.ts +0 -19
- package/dist/src/ui/drawer.d.ts +0 -24
- package/dist/src/ui/dropdown-menu.d.ts +0 -27
- package/dist/src/ui/form.d.ts +0 -24
- package/dist/src/ui/menubar.d.ts +0 -31
- package/dist/src/ui/novel/novel/src/components/editor-command-item.d.ts +0 -21
- package/dist/src/ui/novel/novel/src/extensions/ai-highlight.d.ts +0 -31
- package/dist/src/ui/novel/novel/src/extensions/custom-keymap.d.ts +0 -13
- package/dist/src/ui/novel/novel/src/extensions/drag-and-drop.d.ts +0 -9
- package/dist/src/ui/novel/tailwind/advanced-editor.d.ts +0 -2
- package/dist/src/ui/novel/tailwind/generative/ai-completion-command.d.ts +0 -6
- package/dist/src/ui/novel/tailwind/generative/ai-selector-commands.d.ts +0 -6
- package/dist/src/ui/novel/tailwind/generative/ai-selector.d.ts +0 -7
- package/dist/src/ui/novel/tailwind/generative/generative-menu-switch.d.ts +0 -8
- package/dist/src/ui/novel/tailwind/selectors/color-selector.d.ts +0 -9
- package/dist/src/ui/novel/tailwind/selectors/link-selector.d.ts +0 -9
- package/dist/src/ui/novel/tailwind/selectors/node-selector.d.ts +0 -15
- package/dist/src/ui/novel/tailwind/selectors/text-buttons.d.ts +0 -2
- package/dist/src/ui/novel/tailwind/ui/button.d.ts +0 -11
- package/dist/src/ui/novel/tailwind/ui/command.d.ts +0 -51
- package/dist/src/ui/novel/tailwind/ui/dialog.d.ts +0 -19
- package/dist/src/ui/novel/tailwind/ui/icons/crazy-spinner.d.ts +0 -3
- package/dist/src/ui/novel/tailwind/ui/icons/font-default.d.ts +0 -4
- package/dist/src/ui/novel/tailwind/ui/icons/font-mono.d.ts +0 -4
- package/dist/src/ui/novel/tailwind/ui/icons/font-serif.d.ts +0 -4
- package/dist/src/ui/novel/tailwind/ui/icons/github.d.ts +0 -4
- package/dist/src/ui/novel/tailwind/ui/icons/loading-circle.d.ts +0 -4
- package/dist/src/ui/novel/tailwind/ui/icons/magic.d.ts +0 -4
- package/dist/src/ui/novel/tailwind/ui/menu.d.ts +0 -2
- package/dist/src/ui/pagination.d.ts +0 -29
- package/dist/src/ui/resizable.d.ts +0 -35
- package/dist/src/ui/sheet.d.ts +0 -25
- package/dist/src/ui/skeleton.d.ts +0 -4
- package/dist/src/ui/sonner.d.ts +0 -5
- package/dist/src/ui/toaster.d.ts +0 -7
- package/dist/src/ui/use-toast.d.ts +0 -49
- package/dist/types/.next/types/app/layout.d.ts +0 -9
- package/dist/types/.next/types/app/page.d.ts +0 -9
- package/dist/types/app/layout.d.ts +0 -8
- package/dist/types/app/page.d.ts +0 -6
- package/dist/types/src/consts.d.ts +0 -25
- package/dist/types/src/entry-client.d.ts +0 -1
- package/dist/types/src/entry-server.d.ts +0 -3
- package/dist/types/src/lib/clientlib/clientSideLib.d.ts +0 -4
- package/dist/types/src/lib/clientlib/clientlib.d.ts +0 -2
- package/dist/types/src/lib/clientlib/query.d.ts +0 -0
- package/dist/types/src/lib/dyn-script.d.ts +0 -1
- package/dist/types/src/lib/errors.d.ts +0 -4
- package/dist/types/src/lib/font.d.ts +0 -2
- package/dist/types/src/lib/http/fetchMiddleWithCache.d.ts +0 -2
- package/dist/types/src/lib/http/fetchMiddleWithUrlProxy.d.ts +0 -2
- package/dist/types/src/lib/mt-logger.d.ts +0 -12
- package/dist/types/src/lib/mtmFetcher.d.ts +0 -12
- package/dist/types/src/lib/mtmclient/descriptions/mtm/conf/conf.d.ts +0 -0
- package/dist/types/src/lib/mtmclient/descriptions/mtm/dash/dashpb/dash.d.ts +0 -0
- package/dist/types/src/lib/mtmclient/descriptions/mtm/mtbot/mtbotpb/bot.d.ts +0 -0
- package/dist/types/src/lib/mtmclient/descriptions/mtm/mtjob/mtjobpb/job.d.ts +0 -0
- package/dist/types/src/lib/mtmclient/descriptions/mtm/mtps/mtpspb/mtps.d.ts +0 -0
- package/dist/types/src/lib/mtmclient/descriptions/mtm/sp/sppb/sp.d.ts +0 -0
- package/dist/types/src/lib/mtmclient/descriptions/mtm/sppb/ai.d.ts +0 -0
- package/dist/types/src/lib/mtmclient/descriptions/mtm/sppb/auth.d.ts +0 -0
- package/dist/types/src/lib/mtmclient/descriptions/mtm/sppb/av.d.ts +0 -0
- package/dist/types/src/lib/mtmclient/descriptions/mtm/sppb/backend.d.ts +0 -0
- package/dist/types/src/lib/mtmclient/descriptions/mtm/sppb/blocks.d.ts +0 -0
- package/dist/types/src/lib/mtmclient/descriptions/mtm/sppb/blog.d.ts +0 -0
- package/dist/types/src/lib/mtmclient/descriptions/mtm/sppb/common.d.ts +0 -0
- package/dist/types/src/lib/mtmclient/descriptions/mtm/sppb/cx.d.ts +0 -0
- package/dist/types/src/lib/mtmclient/descriptions/mtm/sppb/events.d.ts +0 -0
- package/dist/types/src/lib/mtmclient/descriptions/mtm/sppb/mtm.d.ts +0 -0
- package/dist/types/src/lib/mtmclient/descriptions/mtm/sppb/mtmgh.d.ts +0 -0
- package/dist/types/src/lib/mtmclient/descriptions/mtm/sppb/site.d.ts +0 -0
- package/dist/types/src/lib/mtmservices.d.ts +0 -3
- package/dist/types/src/lib/service-worker.d.ts +0 -5
- package/dist/types/src/lib/sscore.d.ts +0 -3
- package/dist/types/src/lib/sslib/github-file.d.ts +0 -8
- package/dist/types/src/lib/sslib/mtmcore.d.ts +0 -5
- package/dist/types/src/lib/url/routeHelper.spec.d.ts +0 -1
- package/dist/types/src/lib/url/url.d.ts +0 -2
- package/dist/types/src/lib/useScript.d.ts +0 -3
- package/dist/types/src/tailwind.d.cts +0 -4
- package/dist/types/src/ui/accordion.d.ts +0 -7
- package/dist/types/src/ui/alert.d.ts +0 -9
- package/dist/types/src/ui/aspect-ratio.d.ts +0 -4
- package/dist/types/src/ui/avatar.d.ts +0 -6
- package/dist/types/src/ui/card.d.ts +0 -9
- package/dist/types/src/ui/checkbox.d.ts +0 -4
- package/dist/types/src/ui/collapsible.d.ts +0 -6
- package/dist/types/src/ui/hover-card.d.ts +0 -6
- package/dist/types/src/ui/input.d.ts +0 -5
- package/dist/types/src/ui/label.d.ts +0 -5
- package/dist/types/src/ui/navigation-menu.d.ts +0 -12
- package/dist/types/src/ui/novel/content.d.ts +0 -131
- package/dist/types/src/ui/novel/novel/src/components/editor-bubble-item.d.ts +0 -10
- package/dist/types/src/ui/novel/novel/src/components/editor-bubble.d.ts +0 -7
- package/dist/types/src/ui/novel/novel/src/components/editor-command.d.ts +0 -30
- package/dist/types/src/ui/novel/novel/src/components/editor.d.ts +0 -21
- package/dist/types/src/ui/novel/novel/src/components/index.d.ts +0 -8
- package/dist/types/src/ui/novel/novel/src/extensions/image-resizer.d.ts +0 -2
- package/dist/types/src/ui/novel/novel/src/extensions/index.d.ts +0 -15
- package/dist/types/src/ui/novel/novel/src/extensions/slash-command.d.ts +0 -31
- package/dist/types/src/ui/novel/novel/src/extensions/updated-image.d.ts +0 -2
- package/dist/types/src/ui/novel/novel/src/plugins/index.d.ts +0 -1
- package/dist/types/src/ui/novel/novel/src/plugins/upload-images.d.ts +0 -13
- package/dist/types/src/ui/novel/novel/src/utils/atoms.d.ts +0 -5
- package/dist/types/src/ui/novel/novel/src/utils/store.d.ts +0 -47
- package/dist/types/src/ui/novel/novel/src/utils/utils.d.ts +0 -7
- package/dist/types/src/ui/novel/tailwind/extensions.d.ts +0 -1
- package/dist/types/src/ui/novel/tailwind/image-upload.d.ts +0 -1
- package/dist/types/src/ui/novel/tailwind/slash-command.d.ts +0 -2
- package/dist/types/src/ui/novel/tailwind/ui/icons/index.d.ts +0 -4
- package/dist/types/src/ui/novel/tailwind/ui/popover.d.ts +0 -6
- package/dist/types/src/ui/novel/tailwind/ui/scroll-area.d.ts +0 -5
- package/dist/types/src/ui/novel/tailwind/ui/separator.d.ts +0 -4
- package/dist/types/src/ui/popover.d.ts +0 -6
- package/dist/types/src/ui/progress.d.ts +0 -4
- package/dist/types/src/ui/radio-group.d.ts +0 -5
- package/dist/types/src/ui/scroll-area.d.ts +0 -5
- package/dist/types/src/ui/select.d.ts +0 -11
- package/dist/types/src/ui/separator.d.ts +0 -4
- package/dist/types/src/ui/slider.d.ts +0 -4
- package/dist/types/src/ui/switch.d.ts +0 -4
- package/dist/types/src/ui/table.d.ts +0 -11
- package/dist/types/src/ui/tabs.d.ts +0 -7
- package/dist/types/src/ui/textarea.d.ts +0 -5
- package/dist/types/src/ui/toast.d.ts +0 -15
- package/dist/types/src/ui/toggle.d.ts +0 -12
- package/dist/types/src/ui/tooltip.d.ts +0 -7
- package/dist/types/tsconfig.type.tsbuildinfo +0 -1
- /package/dist/{types/src → esm}/App.d.ts +0 -0
- /package/dist/{types/src → esm}/MtmButton.d.ts +0 -0
- /package/dist/{types/src → esm}/NovelEditorLoader.d.ts +0 -0
- /package/dist/{src → esm}/consts.d.ts +0 -0
- /package/dist/{src → esm}/entry-client.d.ts +0 -0
- /package/dist/{src → esm}/entry-server.d.ts +0 -0
- /package/dist/{types/src → esm}/icons/icons.d.ts +0 -0
- /package/dist/{src → esm}/lib/clientlib/clientSideLib.d.ts +0 -0
- /package/dist/{src → esm}/lib/clientlib/clientlib.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/clientlib/domutils.d.ts +0 -0
- /package/dist/{src → esm}/lib/clientlib/query.d.ts +0 -0
- /package/dist/{src → esm}/lib/dyn-script.d.ts +0 -0
- /package/dist/{src → esm}/lib/errors.d.ts +0 -0
- /package/dist/{src → esm}/lib/font.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/hash.d.ts +0 -0
- /package/dist/{src → esm}/lib/http/fetchMiddleWithCache.d.ts +0 -0
- /package/dist/{src → esm}/lib/http/fetchMiddleWithUrlProxy.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/http/mthttp.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/http/response-cache.test.d.ts +0 -0
- /package/dist/{src → esm}/lib/mt-logger.d.ts +0 -0
- /package/dist/{src → esm}/lib/mtmFetcher.d.ts +0 -0
- /package/dist/{src → esm}/lib/mtmclient/descriptions/mtm/conf/conf.d.ts +0 -0
- /package/dist/{src → esm}/lib/mtmclient/descriptions/mtm/dash/dashpb/dash.d.ts +0 -0
- /package/dist/{src → esm}/lib/mtmclient/descriptions/mtm/mtbot/mtbotpb/bot.d.ts +0 -0
- /package/dist/{src → esm}/lib/mtmclient/descriptions/mtm/mtjob/mtjobpb/job.d.ts +0 -0
- /package/dist/{src → esm}/lib/mtmclient/descriptions/mtm/mtps/mtpspb/mtps.d.ts +0 -0
- /package/dist/{src → esm}/lib/mtmclient/descriptions/mtm/sp/sppb/sp.d.ts +0 -0
- /package/dist/{src → esm}/lib/mtmclient/descriptions/mtm/sppb/ai.d.ts +0 -0
- /package/dist/{src → esm}/lib/mtmclient/descriptions/mtm/sppb/auth.d.ts +0 -0
- /package/dist/{src → esm}/lib/mtmclient/descriptions/mtm/sppb/av.d.ts +0 -0
- /package/dist/{src → esm}/lib/mtmclient/descriptions/mtm/sppb/backend.d.ts +0 -0
- /package/dist/{src → esm}/lib/mtmclient/descriptions/mtm/sppb/blocks.d.ts +0 -0
- /package/dist/{src → esm}/lib/mtmclient/descriptions/mtm/sppb/blog.d.ts +0 -0
- /package/dist/{src → esm}/lib/mtmclient/descriptions/mtm/sppb/common.d.ts +0 -0
- /package/dist/{src → esm}/lib/mtmclient/descriptions/mtm/sppb/cx.d.ts +0 -0
- /package/dist/{src → esm}/lib/mtmclient/descriptions/mtm/sppb/events.d.ts +0 -0
- /package/dist/{src → esm}/lib/mtmclient/descriptions/mtm/sppb/mtm.d.ts +0 -0
- /package/dist/{src → esm}/lib/mtmclient/descriptions/mtm/sppb/mtmgh.d.ts +0 -0
- /package/dist/{src → esm}/lib/mtmclient/descriptions/mtm/sppb/site.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/conf/conf-ConfService_connectquery.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/conf/conf_connect.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/conf/conf_pb.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/dash/dashpb/dash-DashService_connectquery.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/dash/dashpb/dash_connect.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/dash/dashpb/dash_pb.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/mtbot/mtbotpb/bot-BotService_connectquery.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/mtbot/mtbotpb/bot_connect.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/mtbot/mtbotpb/bot_pb.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/mtjob/mtjobpb/job-JobService_connectquery.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/mtjob/mtjobpb/job_connect.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/mtjob/mtjobpb/job_pb.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/mtps/mtpspb/mtps-PsService_connectquery.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/mtps/mtpspb/mtps_connect.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/mtps/mtpspb/mtps_pb.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/sp/sppb/sp-SpService_connectquery.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/sp/sppb/sp_connect.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/sp/sppb/sp_pb.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/sppb/ai-AiService_connectquery.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/sppb/ai_connect.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/sppb/ai_pb.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/sppb/auth-AuthService_connectquery.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/sppb/auth_connect.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/sppb/auth_pb.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/sppb/av-AvService_connectquery.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/sppb/av_connect.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/sppb/av_pb.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/sppb/backend-Backend_connectquery.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/sppb/backend_connect.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/sppb/backend_pb.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/sppb/blocks_pb.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/sppb/blog-BlogService_connectquery.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/sppb/blog_connect.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/sppb/blog_pb.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/sppb/common_pb.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/sppb/cx-CxService_connectquery.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/sppb/cx_connect.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/sppb/cx_pb.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/sppb/events_pb.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/sppb/mtm-MtmService_connectquery.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/sppb/mtm_connect.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/sppb/mtm_pb.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/sppb/mtmgh_pb.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/sppb/site-SiteService_connectquery.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/sppb/site_connect.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/mtmclient/mtm/sppb/site_pb.d.ts +0 -0
- /package/dist/{src → esm}/lib/mtmservices.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/queue.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/render.d.ts +0 -0
- /package/dist/{src → esm}/lib/service-worker.d.ts +0 -0
- /package/dist/{src → esm}/lib/sscore.d.ts +0 -0
- /package/dist/{src → esm}/lib/sslib/github-file.d.ts +0 -0
- /package/dist/{src → esm}/lib/sslib/mtmcore.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/url/routeHelper.d.ts +0 -0
- /package/dist/{src → esm}/lib/url/routeHelper.spec.d.ts +0 -0
- /package/dist/{src → esm}/lib/url/url.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/url/urlMatcher.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/url/urlMatcher.spec.d.ts +0 -0
- /package/dist/{src → esm}/lib/useScript.d.ts +0 -0
- /package/dist/{types/src → esm}/lib/utils.d.ts +0 -0
- /package/dist/{src → esm}/ui/accordion.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/alert-dialog.d.ts +0 -0
- /package/dist/{src → esm}/ui/alert.d.ts +0 -0
- /package/dist/{src → esm}/ui/aspect-ratio.d.ts +0 -0
- /package/dist/{src → esm}/ui/avatar.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/badge.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/button.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/calendar.d.ts +0 -0
- /package/dist/{src → esm}/ui/card.d.ts +0 -0
- /package/dist/{src → esm}/ui/checkbox.d.ts +0 -0
- /package/dist/{src → esm}/ui/collapsible.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/command.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/context-menu.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/dialog.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/drawer.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/dropdown-menu.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/form.d.ts +0 -0
- /package/dist/{src → esm}/ui/hover-card.d.ts +0 -0
- /package/dist/{src → esm}/ui/input.d.ts +0 -0
- /package/dist/{src → esm}/ui/label.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/menubar.d.ts +0 -0
- /package/dist/{src → esm}/ui/navigation-menu.d.ts +0 -0
- /package/dist/{src → esm}/ui/novel/content.d.ts +0 -0
- /package/dist/{src → esm}/ui/novel/novel/src/components/editor-bubble-item.d.ts +0 -0
- /package/dist/{src → esm}/ui/novel/novel/src/components/editor-bubble.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/novel/novel/src/components/editor-command-item.d.ts +0 -0
- /package/dist/{src → esm}/ui/novel/novel/src/components/editor-command.d.ts +0 -0
- /package/dist/{src → esm}/ui/novel/novel/src/components/editor.d.ts +0 -0
- /package/dist/{src → esm}/ui/novel/novel/src/components/index.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/novel/novel/src/extensions/ai-highlight.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/novel/novel/src/extensions/custom-keymap.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/novel/novel/src/extensions/drag-and-drop.d.ts +0 -0
- /package/dist/{src → esm}/ui/novel/novel/src/extensions/image-resizer.d.ts +0 -0
- /package/dist/{src → esm}/ui/novel/novel/src/extensions/index.d.ts +0 -0
- /package/dist/{src → esm}/ui/novel/novel/src/extensions/slash-command.d.ts +0 -0
- /package/dist/{src → esm}/ui/novel/novel/src/extensions/updated-image.d.ts +0 -0
- /package/dist/{src → esm}/ui/novel/novel/src/plugins/index.d.ts +0 -0
- /package/dist/{src → esm}/ui/novel/novel/src/plugins/upload-images.d.ts +0 -0
- /package/dist/{src → esm}/ui/novel/novel/src/utils/atoms.d.ts +0 -0
- /package/dist/{src → esm}/ui/novel/novel/src/utils/store.d.ts +0 -0
- /package/dist/{src → esm}/ui/novel/novel/src/utils/utils.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/novel/tailwind/advanced-editor.d.ts +0 -0
- /package/dist/{src → esm}/ui/novel/tailwind/extensions.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/novel/tailwind/generative/ai-completion-command.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/novel/tailwind/generative/ai-selector-commands.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/novel/tailwind/generative/ai-selector.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/novel/tailwind/generative/generative-menu-switch.d.ts +0 -0
- /package/dist/{src → esm}/ui/novel/tailwind/image-upload.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/novel/tailwind/selectors/color-selector.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/novel/tailwind/selectors/link-selector.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/novel/tailwind/selectors/node-selector.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/novel/tailwind/selectors/text-buttons.d.ts +0 -0
- /package/dist/{src → esm}/ui/novel/tailwind/slash-command.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/novel/tailwind/ui/button.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/novel/tailwind/ui/command.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/novel/tailwind/ui/dialog.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/novel/tailwind/ui/icons/crazy-spinner.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/novel/tailwind/ui/icons/font-default.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/novel/tailwind/ui/icons/font-mono.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/novel/tailwind/ui/icons/font-serif.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/novel/tailwind/ui/icons/github.d.ts +0 -0
- /package/dist/{src → esm}/ui/novel/tailwind/ui/icons/index.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/novel/tailwind/ui/icons/loading-circle.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/novel/tailwind/ui/icons/magic.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/novel/tailwind/ui/menu.d.ts +0 -0
- /package/dist/{src → esm}/ui/novel/tailwind/ui/popover.d.ts +0 -0
- /package/dist/{src → esm}/ui/novel/tailwind/ui/scroll-area.d.ts +0 -0
- /package/dist/{src → esm}/ui/novel/tailwind/ui/separator.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/pagination.d.ts +0 -0
- /package/dist/{src → esm}/ui/popover.d.ts +0 -0
- /package/dist/{src → esm}/ui/progress.d.ts +0 -0
- /package/dist/{src → esm}/ui/radio-group.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/resizable.d.ts +0 -0
- /package/dist/{src → esm}/ui/scroll-area.d.ts +0 -0
- /package/dist/{src → esm}/ui/select.d.ts +0 -0
- /package/dist/{src → esm}/ui/separator.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/sheet.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/skeleton.d.ts +0 -0
- /package/dist/{src → esm}/ui/slider.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/sonner.d.ts +0 -0
- /package/dist/{src → esm}/ui/switch.d.ts +0 -0
- /package/dist/{src → esm}/ui/table.d.ts +0 -0
- /package/dist/{src → esm}/ui/tabs.d.ts +0 -0
- /package/dist/{src → esm}/ui/textarea.d.ts +0 -0
- /package/dist/{src → esm}/ui/toast.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/toaster.d.ts +0 -0
- /package/dist/{src → esm}/ui/toggle.d.ts +0 -0
- /package/dist/{src → esm}/ui/tooltip.d.ts +0 -0
- /package/dist/{types/src → esm}/ui/use-toast.d.ts +0 -0
|
@@ -1,2675 +1,8 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
var __objRest = (source, exclude) => {
|
|
21
|
-
var target = {};
|
|
22
|
-
for (var prop in source)
|
|
23
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
-
target[prop] = source[prop];
|
|
25
|
-
if (source != null && __getOwnPropSymbols)
|
|
26
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
}
|
|
30
|
-
return target;
|
|
31
|
-
};
|
|
32
|
-
var __async = (__this, __arguments, generator) => {
|
|
33
|
-
return new Promise((resolve, reject) => {
|
|
34
|
-
var fulfilled = (value) => {
|
|
35
|
-
try {
|
|
36
|
-
step(generator.next(value));
|
|
37
|
-
} catch (e) {
|
|
38
|
-
reject(e);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
var rejected = (value) => {
|
|
42
|
-
try {
|
|
43
|
-
step(generator.throw(value));
|
|
44
|
-
} catch (e) {
|
|
45
|
-
reject(e);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
49
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
// src/ui/novel/tailwind/advanced-editor.tsx
|
|
54
|
-
import { useEffect as useEffect5, useState as useState2 } from "react";
|
|
55
|
-
import { useDebouncedCallback } from "use-debounce";
|
|
56
|
-
|
|
57
|
-
// src/ui/novel/tailwind/extensions.ts
|
|
58
|
-
import { cx } from "class-variance-authority";
|
|
59
|
-
|
|
60
|
-
// src/ui/novel/novel/src/extensions/index.ts
|
|
61
|
-
import StarterKit from "@tiptap/starter-kit";
|
|
62
|
-
import HorizontalRule from "@tiptap/extension-horizontal-rule";
|
|
63
|
-
import TiptapLink from "@tiptap/extension-link";
|
|
64
|
-
import TiptapImage from "@tiptap/extension-image";
|
|
65
|
-
import Placeholder from "@tiptap/extension-placeholder";
|
|
66
|
-
import TiptapUnderline from "@tiptap/extension-underline";
|
|
67
|
-
import TextStyle from "@tiptap/extension-text-style";
|
|
68
|
-
import { Color } from "@tiptap/extension-color";
|
|
69
|
-
import { TaskItem } from "@tiptap/extension-task-item";
|
|
70
|
-
import { TaskList } from "@tiptap/extension-task-list";
|
|
71
|
-
import { InputRule } from "@tiptap/core";
|
|
72
|
-
import { Markdown } from "tiptap-markdown";
|
|
73
|
-
import Highlight from "@tiptap/extension-highlight";
|
|
74
|
-
|
|
75
|
-
// src/ui/novel/novel/src/extensions/updated-image.ts
|
|
76
|
-
import Image2 from "@tiptap/extension-image";
|
|
77
|
-
var UpdatedImage = Image2.extend({
|
|
78
|
-
name: "image",
|
|
79
|
-
addAttributes() {
|
|
80
|
-
var _a;
|
|
81
|
-
return __spreadProps(__spreadValues({}, (_a = this.parent) == null ? void 0 : _a.call(this)), {
|
|
82
|
-
width: {
|
|
83
|
-
default: null
|
|
84
|
-
},
|
|
85
|
-
height: {
|
|
86
|
-
default: null
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
var updated_image_default = UpdatedImage;
|
|
92
|
-
|
|
93
|
-
// src/ui/novel/novel/src/extensions/custom-keymap.ts
|
|
94
|
-
import { Extension } from "@tiptap/core";
|
|
95
|
-
var CustomKeymap = Extension.create({
|
|
96
|
-
name: "CustomKeymap",
|
|
97
|
-
addCommands() {
|
|
98
|
-
return {
|
|
99
|
-
selectTextWithinNodeBoundaries: () => ({ editor, commands }) => {
|
|
100
|
-
const { state } = editor;
|
|
101
|
-
const { tr } = state;
|
|
102
|
-
const startNodePos = tr.selection.$from.start();
|
|
103
|
-
const endNodePos = tr.selection.$to.end();
|
|
104
|
-
return commands.setTextSelection({
|
|
105
|
-
from: startNodePos,
|
|
106
|
-
to: endNodePos
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
},
|
|
111
|
-
addKeyboardShortcuts() {
|
|
112
|
-
return {
|
|
113
|
-
"Mod-a": ({ editor }) => {
|
|
114
|
-
const { state } = editor;
|
|
115
|
-
const { tr } = state;
|
|
116
|
-
const startSelectionPos = tr.selection.from;
|
|
117
|
-
const endSelectionPos = tr.selection.to;
|
|
118
|
-
const startNodePos = tr.selection.$from.start();
|
|
119
|
-
const endNodePos = tr.selection.$to.end();
|
|
120
|
-
const isCurrentTextSelectionNotExtendedToNodeBoundaries = startSelectionPos > startNodePos || endSelectionPos < endNodePos;
|
|
121
|
-
if (isCurrentTextSelectionNotExtendedToNodeBoundaries) {
|
|
122
|
-
editor.chain().selectTextWithinNodeBoundaries().run();
|
|
123
|
-
return true;
|
|
124
|
-
}
|
|
125
|
-
return false;
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
var custom_keymap_default = CustomKeymap;
|
|
131
|
-
|
|
132
|
-
// src/ui/novel/novel/src/extensions/drag-and-drop.tsx
|
|
133
|
-
import { Extension as Extension2 } from "@tiptap/core";
|
|
134
|
-
import { NodeSelection, Plugin } from "@tiptap/pm/state";
|
|
135
|
-
import { __serializeForClipboard } from "@tiptap/pm/view";
|
|
136
|
-
function absoluteRect(node) {
|
|
137
|
-
const data = node.getBoundingClientRect();
|
|
138
|
-
const modal = node.closest('[role="dialog"]');
|
|
139
|
-
if (modal && window.getComputedStyle(modal).transform !== "none") {
|
|
140
|
-
const modalRect = modal.getBoundingClientRect();
|
|
141
|
-
return {
|
|
142
|
-
top: data.top - modalRect.top,
|
|
143
|
-
left: data.left - modalRect.left,
|
|
144
|
-
width: data.width
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
return {
|
|
148
|
-
top: data.top,
|
|
149
|
-
left: data.left,
|
|
150
|
-
width: data.width
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
function nodeDOMAtCoords(coords) {
|
|
154
|
-
return document.elementsFromPoint(coords.x, coords.y).find(
|
|
155
|
-
(elem) => {
|
|
156
|
-
var _a, _b;
|
|
157
|
-
return ((_b = (_a = elem.parentElement) == null ? void 0 : _a.matches) == null ? void 0 : _b.call(_a, ".ProseMirror")) || elem.matches(
|
|
158
|
-
[
|
|
159
|
-
"li",
|
|
160
|
-
"p:not(:first-child)",
|
|
161
|
-
"pre",
|
|
162
|
-
"blockquote",
|
|
163
|
-
"h1, h2, h3, h4, h5, h6"
|
|
164
|
-
].join(", ")
|
|
165
|
-
);
|
|
166
|
-
}
|
|
167
|
-
);
|
|
168
|
-
}
|
|
169
|
-
function nodePosAtDOM(node, view, options2) {
|
|
170
|
-
var _a;
|
|
171
|
-
const boundingRect = node.getBoundingClientRect();
|
|
172
|
-
return (_a = view.posAtCoords({
|
|
173
|
-
left: boundingRect.left + 50 + options2.dragHandleWidth,
|
|
174
|
-
top: boundingRect.top + 1
|
|
175
|
-
})) == null ? void 0 : _a.inside;
|
|
176
|
-
}
|
|
177
|
-
function DragHandle(options2) {
|
|
178
|
-
function handleDragStart(event, view) {
|
|
179
|
-
view.focus();
|
|
180
|
-
if (!event.dataTransfer)
|
|
181
|
-
return;
|
|
182
|
-
const node = nodeDOMAtCoords({
|
|
183
|
-
x: event.clientX + 50 + options2.dragHandleWidth,
|
|
184
|
-
y: event.clientY
|
|
185
|
-
});
|
|
186
|
-
if (!(node instanceof Element))
|
|
187
|
-
return;
|
|
188
|
-
const nodePos = nodePosAtDOM(node, view, options2);
|
|
189
|
-
if (nodePos == null || nodePos < 0)
|
|
190
|
-
return;
|
|
191
|
-
view.dispatch(
|
|
192
|
-
view.state.tr.setSelection(NodeSelection.create(view.state.doc, nodePos))
|
|
193
|
-
);
|
|
194
|
-
const slice = view.state.selection.content();
|
|
195
|
-
const { dom, text } = __serializeForClipboard(view, slice);
|
|
196
|
-
event.dataTransfer.clearData();
|
|
197
|
-
event.dataTransfer.setData("text/html", dom.innerHTML);
|
|
198
|
-
event.dataTransfer.setData("text/plain", text);
|
|
199
|
-
event.dataTransfer.effectAllowed = "copyMove";
|
|
200
|
-
event.dataTransfer.setDragImage(node, 0, 0);
|
|
201
|
-
view.dragging = { slice, move: event.ctrlKey };
|
|
202
|
-
}
|
|
203
|
-
function handleClick(event, view) {
|
|
204
|
-
view.focus();
|
|
205
|
-
view.dom.classList.remove("dragging");
|
|
206
|
-
const node = nodeDOMAtCoords({
|
|
207
|
-
x: event.clientX + 50 + options2.dragHandleWidth,
|
|
208
|
-
y: event.clientY
|
|
209
|
-
});
|
|
210
|
-
if (!(node instanceof Element))
|
|
211
|
-
return;
|
|
212
|
-
const nodePos = nodePosAtDOM(node, view, options2);
|
|
213
|
-
if (!nodePos)
|
|
214
|
-
return;
|
|
215
|
-
view.dispatch(
|
|
216
|
-
view.state.tr.setSelection(NodeSelection.create(view.state.doc, nodePos))
|
|
217
|
-
);
|
|
218
|
-
}
|
|
219
|
-
let dragHandleElement = null;
|
|
220
|
-
function hideDragHandle() {
|
|
221
|
-
if (dragHandleElement) {
|
|
222
|
-
dragHandleElement.classList.add("hide");
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
function showDragHandle() {
|
|
226
|
-
if (dragHandleElement) {
|
|
227
|
-
dragHandleElement.classList.remove("hide");
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
return new Plugin({
|
|
231
|
-
view: (view) => {
|
|
232
|
-
var _a, _b;
|
|
233
|
-
dragHandleElement = document.createElement("div");
|
|
234
|
-
dragHandleElement.draggable = true;
|
|
235
|
-
dragHandleElement.dataset.dragHandle = "";
|
|
236
|
-
dragHandleElement.classList.add("drag-handle");
|
|
237
|
-
dragHandleElement.addEventListener("dragstart", (e) => {
|
|
238
|
-
handleDragStart(e, view);
|
|
239
|
-
});
|
|
240
|
-
dragHandleElement.addEventListener("click", (e) => {
|
|
241
|
-
handleClick(e, view);
|
|
242
|
-
});
|
|
243
|
-
hideDragHandle();
|
|
244
|
-
(_b = (_a = view == null ? void 0 : view.dom) == null ? void 0 : _a.parentElement) == null ? void 0 : _b.appendChild(dragHandleElement);
|
|
245
|
-
return {
|
|
246
|
-
destroy: () => {
|
|
247
|
-
var _a2;
|
|
248
|
-
(_a2 = dragHandleElement == null ? void 0 : dragHandleElement.remove) == null ? void 0 : _a2.call(dragHandleElement);
|
|
249
|
-
dragHandleElement = null;
|
|
250
|
-
}
|
|
251
|
-
};
|
|
252
|
-
},
|
|
253
|
-
props: {
|
|
254
|
-
handleDOMEvents: {
|
|
255
|
-
mousemove: (view, event) => {
|
|
256
|
-
if (!view.editable) {
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
const node = nodeDOMAtCoords({
|
|
260
|
-
x: event.clientX + 50 + options2.dragHandleWidth,
|
|
261
|
-
y: event.clientY
|
|
262
|
-
});
|
|
263
|
-
if (!(node instanceof Element) || node.matches("ul, ol")) {
|
|
264
|
-
hideDragHandle();
|
|
265
|
-
return;
|
|
266
|
-
}
|
|
267
|
-
const compStyle = window.getComputedStyle(node);
|
|
268
|
-
const lineHeight = parseInt(compStyle.lineHeight, 10);
|
|
269
|
-
const paddingTop = parseInt(compStyle.paddingTop, 10);
|
|
270
|
-
const rect = absoluteRect(node);
|
|
271
|
-
rect.top += (lineHeight - 24) / 2;
|
|
272
|
-
rect.top += paddingTop;
|
|
273
|
-
if (node.matches("ul:not([data-type=taskList]) li, ol li")) {
|
|
274
|
-
rect.left -= options2.dragHandleWidth;
|
|
275
|
-
}
|
|
276
|
-
rect.width = options2.dragHandleWidth;
|
|
277
|
-
if (!dragHandleElement)
|
|
278
|
-
return;
|
|
279
|
-
dragHandleElement.style.left = `${rect.left - rect.width}px`;
|
|
280
|
-
dragHandleElement.style.top = `${rect.top}px`;
|
|
281
|
-
showDragHandle();
|
|
282
|
-
},
|
|
283
|
-
keydown: () => {
|
|
284
|
-
hideDragHandle();
|
|
285
|
-
},
|
|
286
|
-
mousewheel: () => {
|
|
287
|
-
hideDragHandle();
|
|
288
|
-
},
|
|
289
|
-
// dragging class is used for CSS
|
|
290
|
-
dragstart: (view) => {
|
|
291
|
-
view.dom.classList.add("dragging");
|
|
292
|
-
},
|
|
293
|
-
drop: (view) => {
|
|
294
|
-
view.dom.classList.remove("dragging");
|
|
295
|
-
hideDragHandle();
|
|
296
|
-
},
|
|
297
|
-
dragend: (view) => {
|
|
298
|
-
view.dom.classList.remove("dragging");
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
var DragAndDrop = Extension2.create({
|
|
305
|
-
name: "dragAndDrop",
|
|
306
|
-
addProseMirrorPlugins() {
|
|
307
|
-
return [
|
|
308
|
-
DragHandle({
|
|
309
|
-
dragHandleWidth: 24
|
|
310
|
-
})
|
|
311
|
-
];
|
|
312
|
-
}
|
|
313
|
-
});
|
|
314
|
-
var drag_and_drop_default = DragAndDrop;
|
|
315
|
-
|
|
316
|
-
// src/ui/novel/novel/src/extensions/image-resizer.tsx
|
|
317
|
-
import Moveable from "react-moveable";
|
|
318
|
-
import { useCurrentEditor } from "@tiptap/react";
|
|
319
|
-
import { jsx } from "react/jsx-runtime";
|
|
320
|
-
var ImageResizer = () => {
|
|
321
|
-
const { editor } = useCurrentEditor();
|
|
322
|
-
if (!(editor == null ? void 0 : editor.isActive("image")))
|
|
323
|
-
return null;
|
|
324
|
-
const updateMediaSize = () => {
|
|
325
|
-
const imageInfo = document.querySelector(
|
|
326
|
-
".ProseMirror-selectednode"
|
|
327
|
-
);
|
|
328
|
-
if (imageInfo) {
|
|
329
|
-
const selection = editor.state.selection;
|
|
330
|
-
const setImage = editor.commands.setImage;
|
|
331
|
-
setImage({
|
|
332
|
-
src: imageInfo.src,
|
|
333
|
-
width: Number(imageInfo.style.width.replace("px", "")),
|
|
334
|
-
height: Number(imageInfo.style.height.replace("px", ""))
|
|
335
|
-
});
|
|
336
|
-
editor.commands.setNodeSelection(selection.from);
|
|
337
|
-
}
|
|
338
|
-
};
|
|
339
|
-
return /* @__PURE__ */ jsx(
|
|
340
|
-
Moveable,
|
|
341
|
-
{
|
|
342
|
-
target: document.querySelector(".ProseMirror-selectednode"),
|
|
343
|
-
container: null,
|
|
344
|
-
origin: false,
|
|
345
|
-
edge: false,
|
|
346
|
-
throttleDrag: 0,
|
|
347
|
-
keepRatio: true,
|
|
348
|
-
resizable: true,
|
|
349
|
-
throttleResize: 0,
|
|
350
|
-
onResize: ({
|
|
351
|
-
target,
|
|
352
|
-
width,
|
|
353
|
-
height,
|
|
354
|
-
// dist,
|
|
355
|
-
delta
|
|
356
|
-
}) => {
|
|
357
|
-
delta[0] && (target.style.width = `${width}px`);
|
|
358
|
-
delta[1] && (target.style.height = `${height}px`);
|
|
359
|
-
},
|
|
360
|
-
onResizeEnd: () => {
|
|
361
|
-
updateMediaSize();
|
|
362
|
-
},
|
|
363
|
-
scalable: true,
|
|
364
|
-
throttleScale: 0,
|
|
365
|
-
renderDirections: ["w", "e"],
|
|
366
|
-
onScale: ({
|
|
367
|
-
target,
|
|
368
|
-
// scale,
|
|
369
|
-
// dist,
|
|
370
|
-
// delta,
|
|
371
|
-
transform
|
|
372
|
-
}) => {
|
|
373
|
-
target.style.transform = transform;
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
);
|
|
377
|
-
};
|
|
378
|
-
|
|
379
|
-
// src/ui/novel/novel/src/extensions/ai-highlight.ts
|
|
380
|
-
import {
|
|
381
|
-
Mark,
|
|
382
|
-
markInputRule,
|
|
383
|
-
markPasteRule,
|
|
384
|
-
mergeAttributes
|
|
385
|
-
} from "@tiptap/core";
|
|
386
|
-
var inputRegex = /(?:^|\s)((?:==)((?:[^~=]+))(?:==))$/;
|
|
387
|
-
var pasteRegex = /(?:^|\s)((?:==)((?:[^~=]+))(?:==))/g;
|
|
388
|
-
var AIHighlight = Mark.create({
|
|
389
|
-
name: "ai-highlight",
|
|
390
|
-
addOptions() {
|
|
391
|
-
return {
|
|
392
|
-
HTMLAttributes: {}
|
|
393
|
-
};
|
|
394
|
-
},
|
|
395
|
-
addAttributes() {
|
|
396
|
-
return {
|
|
397
|
-
color: {
|
|
398
|
-
default: null,
|
|
399
|
-
parseHTML: (element) => element.getAttribute("data-color") || element.style.backgroundColor,
|
|
400
|
-
renderHTML: (attributes) => {
|
|
401
|
-
if (!attributes.color) {
|
|
402
|
-
return {};
|
|
403
|
-
}
|
|
404
|
-
return {
|
|
405
|
-
"data-color": attributes.color,
|
|
406
|
-
style: `background-color: ${attributes.color}; color: inherit`
|
|
407
|
-
};
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
};
|
|
411
|
-
},
|
|
412
|
-
parseHTML() {
|
|
413
|
-
return [
|
|
414
|
-
{
|
|
415
|
-
tag: "mark"
|
|
416
|
-
}
|
|
417
|
-
];
|
|
418
|
-
},
|
|
419
|
-
renderHTML({ HTMLAttributes }) {
|
|
420
|
-
return [
|
|
421
|
-
"mark",
|
|
422
|
-
mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
|
|
423
|
-
0
|
|
424
|
-
];
|
|
425
|
-
},
|
|
426
|
-
addCommands() {
|
|
427
|
-
return {
|
|
428
|
-
setAIHighlight: (attributes) => ({ commands }) => {
|
|
429
|
-
return commands.setMark(this.name, attributes);
|
|
430
|
-
},
|
|
431
|
-
toggleAIHighlight: (attributes) => ({ commands }) => {
|
|
432
|
-
return commands.toggleMark(this.name, attributes);
|
|
433
|
-
},
|
|
434
|
-
unsetAIHighlight: () => ({ commands }) => {
|
|
435
|
-
return commands.unsetMark(this.name);
|
|
436
|
-
}
|
|
437
|
-
};
|
|
438
|
-
},
|
|
439
|
-
addKeyboardShortcuts() {
|
|
440
|
-
return {
|
|
441
|
-
"Mod-Shift-h": () => this.editor.commands.toggleAIHighlight()
|
|
442
|
-
};
|
|
443
|
-
},
|
|
444
|
-
addInputRules() {
|
|
445
|
-
return [
|
|
446
|
-
markInputRule({
|
|
447
|
-
find: inputRegex,
|
|
448
|
-
type: this.type
|
|
449
|
-
})
|
|
450
|
-
];
|
|
451
|
-
},
|
|
452
|
-
addPasteRules() {
|
|
453
|
-
return [
|
|
454
|
-
markPasteRule({
|
|
455
|
-
find: pasteRegex,
|
|
456
|
-
type: this.type
|
|
457
|
-
})
|
|
458
|
-
];
|
|
459
|
-
}
|
|
460
|
-
});
|
|
461
|
-
var removeAIHighlight = (editor) => {
|
|
462
|
-
const tr = editor.state.tr;
|
|
463
|
-
tr.removeMark(
|
|
464
|
-
0,
|
|
465
|
-
editor.state.doc.nodeSize - 2,
|
|
466
|
-
editor.state.schema.marks["ai-highlight"]
|
|
467
|
-
);
|
|
468
|
-
editor.view.dispatch(tr);
|
|
469
|
-
};
|
|
470
|
-
var addAIHighlight = (editor, color) => {
|
|
471
|
-
editor.chain().setAIHighlight({ color: color != null ? color : "#c1ecf970" }).run();
|
|
472
|
-
};
|
|
473
|
-
|
|
474
|
-
// src/ui/novel/novel/src/extensions/slash-command.tsx
|
|
475
|
-
import { Extension as Extension3 } from "@tiptap/core";
|
|
476
|
-
import Suggestion from "@tiptap/suggestion";
|
|
477
|
-
import { ReactRenderer } from "@tiptap/react";
|
|
478
|
-
import tippy from "tippy.js";
|
|
479
|
-
|
|
480
|
-
// src/ui/novel/novel/src/components/editor-command.tsx
|
|
481
|
-
import { Command } from "cmdk";
|
|
482
|
-
import { useAtom, useSetAtom } from "jotai";
|
|
483
|
-
import { createContext, forwardRef, useEffect } from "react";
|
|
484
|
-
|
|
485
|
-
// src/ui/novel/novel/src/utils/atoms.ts
|
|
486
|
-
import { atom } from "jotai";
|
|
487
|
-
var queryAtom = atom("");
|
|
488
|
-
var rangeAtom = atom(null);
|
|
489
|
-
|
|
490
|
-
// src/ui/novel/novel/src/utils/store.ts
|
|
491
|
-
import { createStore } from "jotai";
|
|
492
|
-
var novelStore = createStore();
|
|
493
|
-
|
|
494
|
-
// src/ui/novel/novel/src/components/editor-command.tsx
|
|
495
|
-
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
496
|
-
var EditorCommandTunnelContext = createContext(
|
|
497
|
-
{}
|
|
498
|
-
);
|
|
499
|
-
var EditorCommandOut = ({
|
|
500
|
-
query,
|
|
501
|
-
range
|
|
502
|
-
}) => {
|
|
503
|
-
const setQuery = useSetAtom(queryAtom, { store: novelStore });
|
|
504
|
-
const setRange = useSetAtom(rangeAtom, { store: novelStore });
|
|
505
|
-
useEffect(() => {
|
|
506
|
-
setQuery(query);
|
|
507
|
-
}, [query, setQuery]);
|
|
508
|
-
useEffect(() => {
|
|
509
|
-
setRange(range);
|
|
510
|
-
}, [range, setRange]);
|
|
511
|
-
useEffect(() => {
|
|
512
|
-
const navigationKeys = ["ArrowUp", "ArrowDown", "Enter"];
|
|
513
|
-
const onKeyDown = (e) => {
|
|
514
|
-
if (navigationKeys.includes(e.key)) {
|
|
515
|
-
e.preventDefault();
|
|
516
|
-
const commandRef = document.querySelector("#slash-command");
|
|
517
|
-
if (commandRef)
|
|
518
|
-
commandRef.dispatchEvent(
|
|
519
|
-
new KeyboardEvent("keydown", {
|
|
520
|
-
key: e.key,
|
|
521
|
-
cancelable: true,
|
|
522
|
-
bubbles: true
|
|
523
|
-
})
|
|
524
|
-
);
|
|
525
|
-
return false;
|
|
526
|
-
}
|
|
527
|
-
};
|
|
528
|
-
document.addEventListener("keydown", onKeyDown);
|
|
529
|
-
return () => {
|
|
530
|
-
document.removeEventListener("keydown", onKeyDown);
|
|
531
|
-
};
|
|
532
|
-
}, []);
|
|
533
|
-
return /* @__PURE__ */ jsx2(EditorCommandTunnelContext.Consumer, { children: (tunnelInstance) => /* @__PURE__ */ jsx2(tunnelInstance.Out, {}) });
|
|
534
|
-
};
|
|
535
|
-
var EditorCommand = forwardRef((_a, ref) => {
|
|
536
|
-
var _b = _a, { children, className } = _b, rest = __objRest(_b, ["children", "className"]);
|
|
537
|
-
const [query, setQuery] = useAtom(queryAtom);
|
|
538
|
-
return /* @__PURE__ */ jsx2(EditorCommandTunnelContext.Consumer, { children: (tunnelInstance) => /* @__PURE__ */ jsx2(tunnelInstance.In, { children: /* @__PURE__ */ jsxs(
|
|
539
|
-
Command,
|
|
540
|
-
__spreadProps(__spreadValues({
|
|
541
|
-
ref,
|
|
542
|
-
onKeyDown: (e) => {
|
|
543
|
-
e.stopPropagation();
|
|
544
|
-
},
|
|
545
|
-
id: "slash-command",
|
|
546
|
-
className
|
|
547
|
-
}, rest), {
|
|
548
|
-
children: [
|
|
549
|
-
/* @__PURE__ */ jsx2(
|
|
550
|
-
Command.Input,
|
|
551
|
-
{
|
|
552
|
-
value: query,
|
|
553
|
-
onValueChange: setQuery,
|
|
554
|
-
style: { display: "none" }
|
|
555
|
-
}
|
|
556
|
-
),
|
|
557
|
-
children
|
|
558
|
-
]
|
|
559
|
-
})
|
|
560
|
-
) }) });
|
|
561
|
-
});
|
|
562
|
-
var EditorCommandList = Command.List;
|
|
563
|
-
EditorCommand.displayName = "EditorCommand";
|
|
564
|
-
|
|
565
|
-
// src/ui/novel/novel/src/extensions/slash-command.tsx
|
|
566
|
-
var Command2 = Extension3.create({
|
|
567
|
-
name: "slash-command",
|
|
568
|
-
addOptions() {
|
|
569
|
-
return {
|
|
570
|
-
suggestion: {
|
|
571
|
-
char: "/",
|
|
572
|
-
command: ({
|
|
573
|
-
editor,
|
|
574
|
-
range,
|
|
575
|
-
props
|
|
576
|
-
}) => {
|
|
577
|
-
props.command({ editor, range });
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
};
|
|
581
|
-
},
|
|
582
|
-
addProseMirrorPlugins() {
|
|
583
|
-
return [
|
|
584
|
-
Suggestion(__spreadValues({
|
|
585
|
-
editor: this.editor
|
|
586
|
-
}, this.options.suggestion))
|
|
587
|
-
];
|
|
588
|
-
}
|
|
589
|
-
});
|
|
590
|
-
var renderItems = () => {
|
|
591
|
-
let component = null;
|
|
592
|
-
let popup = null;
|
|
593
|
-
return {
|
|
594
|
-
onStart: (props) => {
|
|
595
|
-
component = new ReactRenderer(EditorCommandOut, {
|
|
596
|
-
props,
|
|
597
|
-
editor: props.editor
|
|
598
|
-
});
|
|
599
|
-
const { selection } = props.editor.state;
|
|
600
|
-
const parentNode = selection.$from.node(selection.$from.depth);
|
|
601
|
-
const blockType = parentNode.type.name;
|
|
602
|
-
if (blockType === "codeBlock") {
|
|
603
|
-
return false;
|
|
604
|
-
}
|
|
605
|
-
popup = tippy("body", {
|
|
606
|
-
getReferenceClientRect: props.clientRect,
|
|
607
|
-
appendTo: () => document.body,
|
|
608
|
-
content: component.element,
|
|
609
|
-
showOnCreate: true,
|
|
610
|
-
interactive: true,
|
|
611
|
-
trigger: "manual",
|
|
612
|
-
placement: "bottom-start"
|
|
613
|
-
});
|
|
614
|
-
},
|
|
615
|
-
onUpdate: (props) => {
|
|
616
|
-
component == null ? void 0 : component.updateProps(props);
|
|
617
|
-
popup && popup[0].setProps({
|
|
618
|
-
getReferenceClientRect: props.clientRect
|
|
619
|
-
});
|
|
620
|
-
},
|
|
621
|
-
onKeyDown: (props) => {
|
|
622
|
-
var _a;
|
|
623
|
-
if (props.event.key === "Escape") {
|
|
624
|
-
popup == null ? void 0 : popup[0].hide();
|
|
625
|
-
return true;
|
|
626
|
-
}
|
|
627
|
-
return (_a = component == null ? void 0 : component.ref) == null ? void 0 : _a.onKeyDown(props);
|
|
628
|
-
},
|
|
629
|
-
onExit: () => {
|
|
630
|
-
popup == null ? void 0 : popup[0].destroy();
|
|
631
|
-
component == null ? void 0 : component.destroy();
|
|
632
|
-
}
|
|
633
|
-
};
|
|
634
|
-
};
|
|
635
|
-
var createSuggestionItems = (items2) => items2;
|
|
636
|
-
var handleCommandNavigation = (event) => {
|
|
637
|
-
if (["ArrowUp", "ArrowDown", "Enter"].includes(event.key)) {
|
|
638
|
-
const slashCommand2 = document.querySelector("#slash-command");
|
|
639
|
-
if (slashCommand2) {
|
|
640
|
-
return true;
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
};
|
|
644
|
-
|
|
645
|
-
// src/ui/novel/novel/src/utils/utils.ts
|
|
646
|
-
var getPrevText = (editor, {
|
|
647
|
-
// chars,
|
|
648
|
-
// offset = 0,
|
|
649
|
-
}) => {
|
|
650
|
-
return editor.storage.markdown.getMarkdown();
|
|
651
|
-
};
|
|
652
|
-
|
|
653
|
-
// src/ui/novel/novel/src/extensions/index.ts
|
|
654
|
-
var PlaceholderExtension = Placeholder.configure({
|
|
655
|
-
placeholder: ({ node }) => {
|
|
656
|
-
if (node.type.name === "heading") {
|
|
657
|
-
return `Heading ${node.attrs.level}`;
|
|
658
|
-
}
|
|
659
|
-
return "Press '/' for commands";
|
|
660
|
-
},
|
|
661
|
-
includeChildren: true
|
|
662
|
-
});
|
|
663
|
-
var simpleExtensions = [
|
|
664
|
-
TiptapUnderline,
|
|
665
|
-
TextStyle,
|
|
666
|
-
Color,
|
|
667
|
-
Highlight.configure({
|
|
668
|
-
multicolor: true
|
|
669
|
-
}),
|
|
670
|
-
Markdown.configure({
|
|
671
|
-
html: false,
|
|
672
|
-
transformCopiedText: true
|
|
673
|
-
}),
|
|
674
|
-
custom_keymap_default,
|
|
675
|
-
drag_and_drop_default
|
|
676
|
-
];
|
|
677
|
-
var Horizontal = HorizontalRule.extend({
|
|
678
|
-
addInputRules() {
|
|
679
|
-
return [
|
|
680
|
-
new InputRule({
|
|
681
|
-
find: /^(?:---|—-|___\s|\*\*\*\s)$/u,
|
|
682
|
-
handler: ({ state, range }) => {
|
|
683
|
-
const attributes = {};
|
|
684
|
-
const { tr } = state;
|
|
685
|
-
const start = range.from;
|
|
686
|
-
let end = range.to;
|
|
687
|
-
tr.insert(start - 1, this.type.create(attributes)).delete(
|
|
688
|
-
tr.mapping.map(start),
|
|
689
|
-
tr.mapping.map(end)
|
|
690
|
-
);
|
|
691
|
-
}
|
|
692
|
-
})
|
|
693
|
-
];
|
|
694
|
-
}
|
|
695
|
-
});
|
|
696
|
-
|
|
697
|
-
// src/ui/novel/novel/src/plugins/upload-images.tsx
|
|
698
|
-
import { Plugin as Plugin2, PluginKey } from "@tiptap/pm/state";
|
|
699
|
-
import { Decoration, DecorationSet } from "@tiptap/pm/view";
|
|
700
|
-
var uploadKey = new PluginKey("upload-image");
|
|
701
|
-
var UploadImagesPlugin = ({ imageClass }) => new Plugin2({
|
|
702
|
-
key: uploadKey,
|
|
703
|
-
state: {
|
|
704
|
-
init() {
|
|
705
|
-
return DecorationSet.empty;
|
|
706
|
-
},
|
|
707
|
-
apply(tr, set) {
|
|
708
|
-
set = set.map(tr.mapping, tr.doc);
|
|
709
|
-
const action = tr.getMeta(this);
|
|
710
|
-
if (action && action.add) {
|
|
711
|
-
const { id, pos, src } = action.add;
|
|
712
|
-
const placeholder2 = document.createElement("div");
|
|
713
|
-
placeholder2.setAttribute("class", "img-placeholder");
|
|
714
|
-
const image = document.createElement("img");
|
|
715
|
-
image.setAttribute("class", imageClass);
|
|
716
|
-
image.src = src;
|
|
717
|
-
placeholder2.appendChild(image);
|
|
718
|
-
const deco = Decoration.widget(pos + 1, placeholder2, {
|
|
719
|
-
id
|
|
720
|
-
});
|
|
721
|
-
set = set.add(tr.doc, [deco]);
|
|
722
|
-
} else if (action && action.remove) {
|
|
723
|
-
set = set.remove(
|
|
724
|
-
set.find(
|
|
725
|
-
void 0,
|
|
726
|
-
void 0,
|
|
727
|
-
(spec) => spec.id == action.remove.id
|
|
728
|
-
)
|
|
729
|
-
);
|
|
730
|
-
}
|
|
731
|
-
return set;
|
|
732
|
-
}
|
|
733
|
-
},
|
|
734
|
-
props: {
|
|
735
|
-
decorations(state) {
|
|
736
|
-
return this.getState(state);
|
|
737
|
-
}
|
|
738
|
-
}
|
|
739
|
-
});
|
|
740
|
-
function findPlaceholder(state, id) {
|
|
741
|
-
var _a;
|
|
742
|
-
const decos = uploadKey.getState(state);
|
|
743
|
-
const found = decos.find(void 0, void 0, (spec) => spec.id == id);
|
|
744
|
-
return found.length ? (_a = found[0]) == null ? void 0 : _a.from : null;
|
|
745
|
-
}
|
|
746
|
-
var createImageUpload = ({ validateFn, onUpload: onUpload2 }) => (file, view, pos) => {
|
|
747
|
-
const id = {};
|
|
748
|
-
const tr = view.state.tr;
|
|
749
|
-
if (!tr.selection.empty)
|
|
750
|
-
tr.deleteSelection();
|
|
751
|
-
const reader = new FileReader();
|
|
752
|
-
reader.readAsDataURL(file);
|
|
753
|
-
reader.onload = () => {
|
|
754
|
-
tr.setMeta(uploadKey, {
|
|
755
|
-
add: {
|
|
756
|
-
id,
|
|
757
|
-
pos,
|
|
758
|
-
src: reader.result
|
|
759
|
-
}
|
|
760
|
-
});
|
|
761
|
-
view.dispatch(tr);
|
|
762
|
-
};
|
|
763
|
-
onUpload2(file).then((src) => {
|
|
764
|
-
var _a;
|
|
765
|
-
const { schema } = view.state;
|
|
766
|
-
let pos2 = findPlaceholder(view.state, id);
|
|
767
|
-
if (pos2 == null)
|
|
768
|
-
return;
|
|
769
|
-
const imageSrc = typeof src === "object" ? reader.result : src;
|
|
770
|
-
const node = (_a = schema.nodes.image) == null ? void 0 : _a.create({ src: imageSrc });
|
|
771
|
-
if (!node)
|
|
772
|
-
return;
|
|
773
|
-
const transaction = view.state.tr.replaceWith(pos2, pos2, node).setMeta(uploadKey, { remove: { id } });
|
|
774
|
-
view.dispatch(transaction);
|
|
775
|
-
});
|
|
776
|
-
};
|
|
777
|
-
var handleImagePaste = (view, event, uploadFn2) => {
|
|
778
|
-
var _a;
|
|
779
|
-
if ((_a = event.clipboardData) == null ? void 0 : _a.files.length) {
|
|
780
|
-
event.preventDefault();
|
|
781
|
-
const [file] = Array.from(event.clipboardData.files);
|
|
782
|
-
const pos = view.state.selection.from;
|
|
783
|
-
if (file)
|
|
784
|
-
uploadFn2(file, view, pos);
|
|
785
|
-
return true;
|
|
786
|
-
}
|
|
787
|
-
return false;
|
|
788
|
-
};
|
|
789
|
-
var handleImageDrop = (view, event, moved, uploadFn2) => {
|
|
790
|
-
var _a, _b;
|
|
791
|
-
if (!moved && ((_a = event.dataTransfer) == null ? void 0 : _a.files.length)) {
|
|
792
|
-
event.preventDefault();
|
|
793
|
-
const [file] = Array.from(event.dataTransfer.files);
|
|
794
|
-
const coordinates = view.posAtCoords({
|
|
795
|
-
left: event.clientX,
|
|
796
|
-
top: event.clientY
|
|
797
|
-
});
|
|
798
|
-
if (file)
|
|
799
|
-
uploadFn2(file, view, (_b = coordinates == null ? void 0 : coordinates.pos) != null ? _b : 0 - 1);
|
|
800
|
-
return true;
|
|
801
|
-
}
|
|
802
|
-
return false;
|
|
803
|
-
};
|
|
804
|
-
|
|
805
|
-
// src/ui/novel/tailwind/extensions.ts
|
|
806
|
-
var aiHighlight = AIHighlight;
|
|
807
|
-
var placeholder = PlaceholderExtension;
|
|
808
|
-
var tiptapLink = TiptapLink.configure({
|
|
809
|
-
HTMLAttributes: {
|
|
810
|
-
class: cx(
|
|
811
|
-
"text-muted-foreground underline underline-offset-[3px] hover:text-primary transition-colors cursor-pointer"
|
|
812
|
-
)
|
|
813
|
-
}
|
|
814
|
-
});
|
|
815
|
-
var tiptapImage = TiptapImage.extend({
|
|
816
|
-
addProseMirrorPlugins() {
|
|
817
|
-
return [
|
|
818
|
-
UploadImagesPlugin({
|
|
819
|
-
imageClass: cx("opacity-40 rounded-lg border border-stone-200")
|
|
820
|
-
})
|
|
821
|
-
];
|
|
822
|
-
}
|
|
823
|
-
}).configure({
|
|
824
|
-
allowBase64: true,
|
|
825
|
-
HTMLAttributes: {
|
|
826
|
-
class: cx("rounded-lg border border-muted")
|
|
827
|
-
}
|
|
828
|
-
});
|
|
829
|
-
var updatedImage = updated_image_default.configure({
|
|
830
|
-
HTMLAttributes: {
|
|
831
|
-
class: cx("rounded-lg border border-muted")
|
|
832
|
-
}
|
|
833
|
-
});
|
|
834
|
-
var taskList = TaskList.configure({
|
|
835
|
-
HTMLAttributes: {
|
|
836
|
-
class: cx("not-prose pl-2 ")
|
|
837
|
-
}
|
|
838
|
-
});
|
|
839
|
-
var taskItem = TaskItem.configure({
|
|
840
|
-
HTMLAttributes: {
|
|
841
|
-
class: cx("flex gap-2 items-start my-4")
|
|
842
|
-
},
|
|
843
|
-
nested: true
|
|
844
|
-
});
|
|
845
|
-
var horizontalRule = Horizontal.configure({
|
|
846
|
-
HTMLAttributes: {
|
|
847
|
-
class: cx("mt-4 mb-6 border-t border-muted-foreground")
|
|
848
|
-
}
|
|
849
|
-
});
|
|
850
|
-
var starterKit = StarterKit.configure({
|
|
851
|
-
bulletList: {
|
|
852
|
-
HTMLAttributes: {
|
|
853
|
-
class: cx("list-disc list-outside leading-3 -mt-2")
|
|
854
|
-
}
|
|
855
|
-
},
|
|
856
|
-
orderedList: {
|
|
857
|
-
HTMLAttributes: {
|
|
858
|
-
class: cx("list-decimal list-outside leading-3 -mt-2")
|
|
859
|
-
}
|
|
860
|
-
},
|
|
861
|
-
listItem: {
|
|
862
|
-
HTMLAttributes: {
|
|
863
|
-
class: cx("leading-normal -mb-2")
|
|
864
|
-
}
|
|
865
|
-
},
|
|
866
|
-
blockquote: {
|
|
867
|
-
HTMLAttributes: {
|
|
868
|
-
class: cx("border-l-4 border-primary")
|
|
869
|
-
}
|
|
870
|
-
},
|
|
871
|
-
codeBlock: {
|
|
872
|
-
HTMLAttributes: {
|
|
873
|
-
class: cx(
|
|
874
|
-
"rounded-md bg-muted text-muted-foreground border p-5 font-mono font-medium"
|
|
875
|
-
)
|
|
876
|
-
}
|
|
877
|
-
},
|
|
878
|
-
code: {
|
|
879
|
-
HTMLAttributes: {
|
|
880
|
-
class: cx("rounded-md bg-muted px-1.5 py-1 font-mono font-medium"),
|
|
881
|
-
spellcheck: "false"
|
|
882
|
-
}
|
|
883
|
-
},
|
|
884
|
-
horizontalRule: false,
|
|
885
|
-
dropcursor: {
|
|
886
|
-
color: "#DBEAFE",
|
|
887
|
-
width: 4
|
|
888
|
-
},
|
|
889
|
-
gapcursor: false
|
|
890
|
-
});
|
|
891
|
-
var defaultExtensions = [
|
|
892
|
-
starterKit,
|
|
893
|
-
placeholder,
|
|
894
|
-
tiptapLink,
|
|
895
|
-
tiptapImage,
|
|
896
|
-
updatedImage,
|
|
897
|
-
taskList,
|
|
898
|
-
taskItem,
|
|
899
|
-
horizontalRule,
|
|
900
|
-
aiHighlight
|
|
901
|
-
];
|
|
902
|
-
|
|
903
|
-
// src/ui/novel/tailwind/selectors/color-selector.tsx
|
|
904
|
-
import { Check, ChevronDown } from "lucide-react";
|
|
905
|
-
|
|
906
|
-
// src/ui/novel/tailwind/ui/button.tsx
|
|
907
|
-
import { Slot } from "@radix-ui/react-slot";
|
|
908
|
-
import { cva } from "class-variance-authority";
|
|
909
|
-
import * as React from "react";
|
|
910
|
-
|
|
911
|
-
// src/lib/utils.ts
|
|
912
|
-
import { clsx } from "clsx";
|
|
913
|
-
import { isNumber, isString } from "lodash";
|
|
914
|
-
import stableHash from "stable-hash";
|
|
915
|
-
import { twMerge } from "tailwind-merge";
|
|
916
|
-
function cn(...inputs) {
|
|
917
|
-
return twMerge(clsx(inputs));
|
|
918
|
-
}
|
|
919
|
-
|
|
920
|
-
// src/ui/novel/tailwind/ui/button.tsx
|
|
921
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
922
|
-
var buttonVariants = cva(
|
|
923
|
-
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
924
|
-
{
|
|
925
|
-
variants: {
|
|
926
|
-
variant: {
|
|
927
|
-
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
928
|
-
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
929
|
-
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
930
|
-
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
931
|
-
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
932
|
-
link: "text-primary underline-offset-4 hover:underline"
|
|
933
|
-
},
|
|
934
|
-
size: {
|
|
935
|
-
default: "h-10 px-4 py-2",
|
|
936
|
-
sm: "h-9 rounded-md px-3",
|
|
937
|
-
lg: "h-11 rounded-md px-8",
|
|
938
|
-
icon: "h-10 w-10"
|
|
939
|
-
}
|
|
940
|
-
},
|
|
941
|
-
defaultVariants: {
|
|
942
|
-
variant: "default",
|
|
943
|
-
size: "default"
|
|
944
|
-
}
|
|
945
|
-
}
|
|
946
|
-
);
|
|
947
|
-
var Button = React.forwardRef(
|
|
948
|
-
(_a, ref) => {
|
|
949
|
-
var _b = _a, { className, variant, size, asChild = false } = _b, props = __objRest(_b, ["className", "variant", "size", "asChild"]);
|
|
950
|
-
const Comp = asChild ? Slot : "button";
|
|
951
|
-
return /* @__PURE__ */ jsx3(
|
|
952
|
-
Comp,
|
|
953
|
-
__spreadValues({
|
|
954
|
-
className: cn(buttonVariants({ variant, size, className })),
|
|
955
|
-
ref
|
|
956
|
-
}, props)
|
|
957
|
-
);
|
|
958
|
-
}
|
|
959
|
-
);
|
|
960
|
-
Button.displayName = "Button";
|
|
961
|
-
|
|
962
|
-
// src/ui/novel/tailwind/ui/popover.tsx
|
|
963
|
-
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
964
|
-
import * as React2 from "react";
|
|
965
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
966
|
-
var Popover = PopoverPrimitive.Root;
|
|
967
|
-
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
968
|
-
var PopoverContent = React2.forwardRef((_a, ref) => {
|
|
969
|
-
var _b = _a, { className, align = "center", sideOffset = 4 } = _b, props = __objRest(_b, ["className", "align", "sideOffset"]);
|
|
970
|
-
return /* @__PURE__ */ jsx4(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx4(
|
|
971
|
-
PopoverPrimitive.Content,
|
|
972
|
-
__spreadValues({
|
|
973
|
-
ref,
|
|
974
|
-
align,
|
|
975
|
-
sideOffset,
|
|
976
|
-
className: cn(
|
|
977
|
-
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 rounded-md border p-4 shadow-md outline-none",
|
|
978
|
-
className
|
|
979
|
-
)
|
|
980
|
-
}, props)
|
|
981
|
-
) });
|
|
982
|
-
});
|
|
983
|
-
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
984
|
-
|
|
985
|
-
// src/ui/novel/novel/src/components/index.ts
|
|
986
|
-
import { useCurrentEditor as useCurrentEditor5 } from "@tiptap/react";
|
|
987
|
-
|
|
988
|
-
// src/ui/novel/novel/src/components/editor.tsx
|
|
989
|
-
import { useMemo, useRef, forwardRef as forwardRef4 } from "react";
|
|
990
|
-
import { EditorProvider } from "@tiptap/react";
|
|
991
|
-
import { Provider } from "jotai";
|
|
992
|
-
import tunnel from "tunnel-rat";
|
|
993
|
-
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
994
|
-
var EditorRoot = ({ children }) => {
|
|
995
|
-
const tunnelInstance = useRef(tunnel()).current;
|
|
996
|
-
return /* @__PURE__ */ jsx5(Provider, { store: novelStore, children: /* @__PURE__ */ jsx5(EditorCommandTunnelContext.Provider, { value: tunnelInstance, children }) });
|
|
997
|
-
};
|
|
998
|
-
var EditorContent = forwardRef4(
|
|
999
|
-
(_a, ref) => {
|
|
1000
|
-
var _b = _a, { className, children, initialContent } = _b, rest = __objRest(_b, ["className", "children", "initialContent"]);
|
|
1001
|
-
const extensions2 = useMemo(() => {
|
|
1002
|
-
var _a2;
|
|
1003
|
-
return [...simpleExtensions, ...(_a2 = rest.extensions) != null ? _a2 : []];
|
|
1004
|
-
}, [rest.extensions]);
|
|
1005
|
-
return /* @__PURE__ */ jsx5("div", { ref, className, children: /* @__PURE__ */ jsx5(
|
|
1006
|
-
EditorProvider,
|
|
1007
|
-
__spreadProps(__spreadValues({}, rest), {
|
|
1008
|
-
content: initialContent,
|
|
1009
|
-
extensions: extensions2,
|
|
1010
|
-
children
|
|
1011
|
-
})
|
|
1012
|
-
) });
|
|
1013
|
-
}
|
|
1014
|
-
);
|
|
1015
|
-
EditorContent.displayName = "EditorContent";
|
|
1016
|
-
|
|
1017
|
-
// src/ui/novel/novel/src/components/editor-bubble.tsx
|
|
1018
|
-
import { BubbleMenu, isNodeSelection, useCurrentEditor as useCurrentEditor2 } from "@tiptap/react";
|
|
1019
|
-
import { useMemo as useMemo2, useRef as useRef2, useEffect as useEffect2, forwardRef as forwardRef5 } from "react";
|
|
1020
|
-
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
1021
|
-
var EditorBubble = forwardRef5(
|
|
1022
|
-
(_a, ref) => {
|
|
1023
|
-
var _b = _a, { children, tippyOptions } = _b, rest = __objRest(_b, ["children", "tippyOptions"]);
|
|
1024
|
-
const { editor: currentEditor } = useCurrentEditor2();
|
|
1025
|
-
const instanceRef = useRef2(null);
|
|
1026
|
-
useEffect2(() => {
|
|
1027
|
-
var _a2;
|
|
1028
|
-
if (!instanceRef.current || !(tippyOptions == null ? void 0 : tippyOptions.placement))
|
|
1029
|
-
return;
|
|
1030
|
-
instanceRef.current.setProps({ placement: tippyOptions.placement });
|
|
1031
|
-
(_a2 = instanceRef.current.popperInstance) == null ? void 0 : _a2.update();
|
|
1032
|
-
}, [tippyOptions == null ? void 0 : tippyOptions.placement]);
|
|
1033
|
-
const bubbleMenuProps = useMemo2(() => {
|
|
1034
|
-
const shouldShow = ({ editor, state }) => {
|
|
1035
|
-
const { selection } = state;
|
|
1036
|
-
const { empty } = selection;
|
|
1037
|
-
if (!editor.isEditable || editor.isActive("image") || empty || isNodeSelection(selection)) {
|
|
1038
|
-
return false;
|
|
1039
|
-
}
|
|
1040
|
-
return true;
|
|
1041
|
-
};
|
|
1042
|
-
return __spreadValues({
|
|
1043
|
-
shouldShow,
|
|
1044
|
-
tippyOptions: __spreadValues({
|
|
1045
|
-
onCreate: (val) => {
|
|
1046
|
-
instanceRef.current = val;
|
|
1047
|
-
},
|
|
1048
|
-
moveTransition: "transform 0.15s ease-out"
|
|
1049
|
-
}, tippyOptions)
|
|
1050
|
-
}, rest);
|
|
1051
|
-
}, [rest, tippyOptions]);
|
|
1052
|
-
if (!currentEditor)
|
|
1053
|
-
return null;
|
|
1054
|
-
return (
|
|
1055
|
-
// We need to add this because of https://github.com/ueberdosis/tiptap/issues/2658
|
|
1056
|
-
/* @__PURE__ */ jsx6("div", { ref, children: /* @__PURE__ */ jsx6(BubbleMenu, __spreadProps(__spreadValues({ editor: currentEditor }, bubbleMenuProps), { children })) })
|
|
1057
|
-
);
|
|
1058
|
-
}
|
|
1059
|
-
);
|
|
1060
|
-
EditorBubble.displayName = "EditorBubble";
|
|
1061
|
-
|
|
1062
|
-
// src/ui/novel/novel/src/components/editor-bubble-item.tsx
|
|
1063
|
-
import { forwardRef as forwardRef6 } from "react";
|
|
1064
|
-
import { Slot as Slot2 } from "@radix-ui/react-slot";
|
|
1065
|
-
import { useCurrentEditor as useCurrentEditor3 } from "@tiptap/react";
|
|
1066
|
-
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1067
|
-
var EditorBubbleItem = forwardRef6((_a, ref) => {
|
|
1068
|
-
var _b = _a, { children, asChild, onSelect } = _b, rest = __objRest(_b, ["children", "asChild", "onSelect"]);
|
|
1069
|
-
const { editor } = useCurrentEditor3();
|
|
1070
|
-
const Comp = asChild ? Slot2 : "div";
|
|
1071
|
-
if (!editor)
|
|
1072
|
-
return null;
|
|
1073
|
-
return /* @__PURE__ */ jsx7(Comp, __spreadProps(__spreadValues({ ref }, rest), { onClick: () => onSelect == null ? void 0 : onSelect(editor), children }));
|
|
1074
|
-
});
|
|
1075
|
-
EditorBubbleItem.displayName = "EditorBubbleItem";
|
|
1076
|
-
|
|
1077
|
-
// src/ui/novel/novel/src/components/editor-command-item.tsx
|
|
1078
|
-
import { forwardRef as forwardRef7 } from "react";
|
|
1079
|
-
import { CommandEmpty, CommandItem } from "cmdk";
|
|
1080
|
-
import { useCurrentEditor as useCurrentEditor4 } from "@tiptap/react";
|
|
1081
|
-
import { useAtomValue } from "jotai";
|
|
1082
|
-
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1083
|
-
var EditorCommandItem = forwardRef7((_a, ref) => {
|
|
1084
|
-
var _b = _a, { children, onCommand } = _b, rest = __objRest(_b, ["children", "onCommand"]);
|
|
1085
|
-
const { editor } = useCurrentEditor4();
|
|
1086
|
-
const range = useAtomValue(rangeAtom);
|
|
1087
|
-
if (!editor || !range)
|
|
1088
|
-
return null;
|
|
1089
|
-
return /* @__PURE__ */ jsx8(
|
|
1090
|
-
CommandItem,
|
|
1091
|
-
__spreadProps(__spreadValues({
|
|
1092
|
-
ref
|
|
1093
|
-
}, rest), {
|
|
1094
|
-
onSelect: () => onCommand({ editor, range }),
|
|
1095
|
-
children
|
|
1096
|
-
})
|
|
1097
|
-
);
|
|
1098
|
-
});
|
|
1099
|
-
EditorCommandItem.displayName = "EditorCommandItem";
|
|
1100
|
-
var EditorCommandEmpty = CommandEmpty;
|
|
1101
|
-
|
|
1102
|
-
// src/ui/novel/tailwind/selectors/color-selector.tsx
|
|
1103
|
-
import { jsx as jsx9, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1104
|
-
var TEXT_COLORS = [
|
|
1105
|
-
{
|
|
1106
|
-
name: "Default",
|
|
1107
|
-
color: "var(--novel-black)"
|
|
1108
|
-
},
|
|
1109
|
-
{
|
|
1110
|
-
name: "Purple",
|
|
1111
|
-
color: "#9333EA"
|
|
1112
|
-
},
|
|
1113
|
-
{
|
|
1114
|
-
name: "Red",
|
|
1115
|
-
color: "#E00000"
|
|
1116
|
-
},
|
|
1117
|
-
{
|
|
1118
|
-
name: "Yellow",
|
|
1119
|
-
color: "#EAB308"
|
|
1120
|
-
},
|
|
1121
|
-
{
|
|
1122
|
-
name: "Blue",
|
|
1123
|
-
color: "#2563EB"
|
|
1124
|
-
},
|
|
1125
|
-
{
|
|
1126
|
-
name: "Green",
|
|
1127
|
-
color: "#008A00"
|
|
1128
|
-
},
|
|
1129
|
-
{
|
|
1130
|
-
name: "Orange",
|
|
1131
|
-
color: "#FFA500"
|
|
1132
|
-
},
|
|
1133
|
-
{
|
|
1134
|
-
name: "Pink",
|
|
1135
|
-
color: "#BA4081"
|
|
1136
|
-
},
|
|
1137
|
-
{
|
|
1138
|
-
name: "Gray",
|
|
1139
|
-
color: "#A8A29E"
|
|
1140
|
-
}
|
|
1141
|
-
];
|
|
1142
|
-
var HIGHLIGHT_COLORS = [
|
|
1143
|
-
{
|
|
1144
|
-
name: "Default",
|
|
1145
|
-
color: "var(--novel-highlight-default)"
|
|
1146
|
-
},
|
|
1147
|
-
{
|
|
1148
|
-
name: "Purple",
|
|
1149
|
-
color: "var(--novel-highlight-purple)"
|
|
1150
|
-
},
|
|
1151
|
-
{
|
|
1152
|
-
name: "Red",
|
|
1153
|
-
color: "var(--novel-highlight-red)"
|
|
1154
|
-
},
|
|
1155
|
-
{
|
|
1156
|
-
name: "Yellow",
|
|
1157
|
-
color: "var(--novel-highlight-yellow)"
|
|
1158
|
-
},
|
|
1159
|
-
{
|
|
1160
|
-
name: "Blue",
|
|
1161
|
-
color: "var(--novel-highlight-blue)"
|
|
1162
|
-
},
|
|
1163
|
-
{
|
|
1164
|
-
name: "Green",
|
|
1165
|
-
color: "var(--novel-highlight-green)"
|
|
1166
|
-
},
|
|
1167
|
-
{
|
|
1168
|
-
name: "Orange",
|
|
1169
|
-
color: "var(--novel-highlight-orange)"
|
|
1170
|
-
},
|
|
1171
|
-
{
|
|
1172
|
-
name: "Pink",
|
|
1173
|
-
color: "var(--novel-highlight-pink)"
|
|
1174
|
-
},
|
|
1175
|
-
{
|
|
1176
|
-
name: "Gray",
|
|
1177
|
-
color: "var(--novel-highlight-gray)"
|
|
1178
|
-
}
|
|
1179
|
-
];
|
|
1180
|
-
var ColorSelector = (props) => {
|
|
1181
|
-
const { editor } = useCurrentEditor5();
|
|
1182
|
-
if (!editor)
|
|
1183
|
-
return null;
|
|
1184
|
-
const activeColorItem = TEXT_COLORS.find(
|
|
1185
|
-
({ color }) => editor.isActive("textStyle", { color })
|
|
1186
|
-
);
|
|
1187
|
-
const activeHighlightItem = HIGHLIGHT_COLORS.find(
|
|
1188
|
-
({ color }) => editor.isActive("highlight", { color })
|
|
1189
|
-
);
|
|
1190
|
-
return /* @__PURE__ */ jsxs2(Popover, { modal: true, open: props.open, onOpenChange: props.onOpenChange, children: [
|
|
1191
|
-
/* @__PURE__ */ jsx9(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs2(Button, { size: "sm", className: "gap-2 rounded-none", variant: "ghost", children: [
|
|
1192
|
-
/* @__PURE__ */ jsx9(
|
|
1193
|
-
"span",
|
|
1194
|
-
{
|
|
1195
|
-
className: "rounded-sm px-1",
|
|
1196
|
-
style: {
|
|
1197
|
-
color: activeColorItem == null ? void 0 : activeColorItem.color,
|
|
1198
|
-
backgroundColor: activeHighlightItem == null ? void 0 : activeHighlightItem.color
|
|
1199
|
-
},
|
|
1200
|
-
children: "A"
|
|
1201
|
-
}
|
|
1202
|
-
),
|
|
1203
|
-
/* @__PURE__ */ jsx9(ChevronDown, { className: "h-4 w-4" })
|
|
1204
|
-
] }) }),
|
|
1205
|
-
/* @__PURE__ */ jsxs2(
|
|
1206
|
-
PopoverContent,
|
|
1207
|
-
{
|
|
1208
|
-
sideOffset: 5,
|
|
1209
|
-
className: "my-1 flex max-h-80 w-48 flex-col overflow-hidden overflow-y-auto rounded border p-1 shadow-xl ",
|
|
1210
|
-
align: "start",
|
|
1211
|
-
children: [
|
|
1212
|
-
/* @__PURE__ */ jsxs2("div", { className: "flex flex-col", children: [
|
|
1213
|
-
/* @__PURE__ */ jsx9("div", { className: "text-muted-foreground my-1 px-2 text-sm font-semibold", children: "Color" }),
|
|
1214
|
-
TEXT_COLORS.map(({ name, color }, index) => /* @__PURE__ */ jsx9(
|
|
1215
|
-
EditorBubbleItem,
|
|
1216
|
-
{
|
|
1217
|
-
onSelect: () => {
|
|
1218
|
-
editor.commands.unsetColor();
|
|
1219
|
-
name !== "Default" && editor.chain().focus().setColor(color || "").run();
|
|
1220
|
-
},
|
|
1221
|
-
className: "hover:bg-accent flex cursor-pointer items-center justify-between px-2 py-1 text-sm",
|
|
1222
|
-
children: /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2", children: [
|
|
1223
|
-
/* @__PURE__ */ jsx9(
|
|
1224
|
-
"div",
|
|
1225
|
-
{
|
|
1226
|
-
className: "rounded-sm border px-2 py-px font-medium",
|
|
1227
|
-
style: { color },
|
|
1228
|
-
children: "A"
|
|
1229
|
-
}
|
|
1230
|
-
),
|
|
1231
|
-
/* @__PURE__ */ jsx9("span", { children: name })
|
|
1232
|
-
] })
|
|
1233
|
-
},
|
|
1234
|
-
index
|
|
1235
|
-
))
|
|
1236
|
-
] }),
|
|
1237
|
-
/* @__PURE__ */ jsxs2("div", { children: [
|
|
1238
|
-
/* @__PURE__ */ jsx9("div", { className: "text-muted-foreground my-1 px-2 text-sm font-semibold", children: "Background" }),
|
|
1239
|
-
HIGHLIGHT_COLORS.map(({ name, color }, index) => /* @__PURE__ */ jsxs2(
|
|
1240
|
-
EditorBubbleItem,
|
|
1241
|
-
{
|
|
1242
|
-
onSelect: () => {
|
|
1243
|
-
editor.commands.unsetHighlight();
|
|
1244
|
-
name !== "Default" && editor.commands.setHighlight({ color });
|
|
1245
|
-
},
|
|
1246
|
-
className: "hover:bg-accent flex cursor-pointer items-center justify-between px-2 py-1 text-sm",
|
|
1247
|
-
children: [
|
|
1248
|
-
/* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2", children: [
|
|
1249
|
-
/* @__PURE__ */ jsx9(
|
|
1250
|
-
"div",
|
|
1251
|
-
{
|
|
1252
|
-
className: "rounded-sm border px-2 py-px font-medium",
|
|
1253
|
-
style: { backgroundColor: color },
|
|
1254
|
-
children: "A"
|
|
1255
|
-
}
|
|
1256
|
-
),
|
|
1257
|
-
/* @__PURE__ */ jsx9("span", { children: name })
|
|
1258
|
-
] }),
|
|
1259
|
-
editor.isActive("highlight", { color }) && /* @__PURE__ */ jsx9(Check, { className: "h-4 w-4" })
|
|
1260
|
-
]
|
|
1261
|
-
},
|
|
1262
|
-
index
|
|
1263
|
-
))
|
|
1264
|
-
] })
|
|
1265
|
-
]
|
|
1266
|
-
}
|
|
1267
|
-
)
|
|
1268
|
-
] });
|
|
1269
|
-
};
|
|
1270
|
-
|
|
1271
|
-
// src/ui/novel/tailwind/selectors/link-selector.tsx
|
|
1272
|
-
import { Popover as Popover2, PopoverTrigger as PopoverTrigger2 } from "@radix-ui/react-popover";
|
|
1273
|
-
import { Check as Check2, Trash } from "lucide-react";
|
|
1274
|
-
import {
|
|
1275
|
-
useEffect as useEffect3,
|
|
1276
|
-
useRef as useRef3
|
|
1277
|
-
} from "react";
|
|
1278
|
-
import { jsx as jsx10, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1279
|
-
function isValidUrl(url) {
|
|
1280
|
-
try {
|
|
1281
|
-
new URL(url);
|
|
1282
|
-
return true;
|
|
1283
|
-
} catch (e) {
|
|
1284
|
-
return false;
|
|
1285
|
-
}
|
|
1286
|
-
}
|
|
1287
|
-
function getUrlFromString(str) {
|
|
1288
|
-
if (isValidUrl(str))
|
|
1289
|
-
return str;
|
|
1290
|
-
try {
|
|
1291
|
-
if (str.includes(".") && !str.includes(" ")) {
|
|
1292
|
-
return new URL(`https://${str}`).toString();
|
|
1293
|
-
}
|
|
1294
|
-
} catch (e) {
|
|
1295
|
-
return null;
|
|
1296
|
-
}
|
|
1297
|
-
}
|
|
1298
|
-
var LinkSelector = ({ open, onOpenChange }) => {
|
|
1299
|
-
const inputRef = useRef3(null);
|
|
1300
|
-
const { editor } = useCurrentEditor5();
|
|
1301
|
-
useEffect3(() => {
|
|
1302
|
-
var _a;
|
|
1303
|
-
inputRef.current && ((_a = inputRef.current) == null ? void 0 : _a.focus());
|
|
1304
|
-
});
|
|
1305
|
-
if (!editor)
|
|
1306
|
-
return null;
|
|
1307
|
-
return /* @__PURE__ */ jsxs3(Popover2, { modal: true, open, onOpenChange, children: [
|
|
1308
|
-
/* @__PURE__ */ jsx10(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsxs3(
|
|
1309
|
-
Button,
|
|
1310
|
-
{
|
|
1311
|
-
size: "sm",
|
|
1312
|
-
variant: "ghost",
|
|
1313
|
-
className: "gap-2 rounded-none border-none",
|
|
1314
|
-
children: [
|
|
1315
|
-
/* @__PURE__ */ jsx10("p", { className: "text-base", children: "\u2197" }),
|
|
1316
|
-
/* @__PURE__ */ jsx10(
|
|
1317
|
-
"p",
|
|
1318
|
-
{
|
|
1319
|
-
className: cn("underline decoration-stone-400 underline-offset-4", {
|
|
1320
|
-
"text-blue-500": editor.isActive("link")
|
|
1321
|
-
}),
|
|
1322
|
-
children: "Link"
|
|
1323
|
-
}
|
|
1324
|
-
)
|
|
1325
|
-
]
|
|
1326
|
-
}
|
|
1327
|
-
) }),
|
|
1328
|
-
/* @__PURE__ */ jsx10(PopoverContent, { align: "start", className: "w-60 p-0", sideOffset: 10, children: /* @__PURE__ */ jsxs3(
|
|
1329
|
-
"form",
|
|
1330
|
-
{
|
|
1331
|
-
onSubmit: (e) => {
|
|
1332
|
-
const target = e.currentTarget;
|
|
1333
|
-
e.preventDefault();
|
|
1334
|
-
const input = target[0];
|
|
1335
|
-
const url = getUrlFromString(input.value);
|
|
1336
|
-
url && editor.chain().focus().setLink({ href: url }).run();
|
|
1337
|
-
},
|
|
1338
|
-
className: "flex p-1 ",
|
|
1339
|
-
children: [
|
|
1340
|
-
/* @__PURE__ */ jsx10(
|
|
1341
|
-
"input",
|
|
1342
|
-
{
|
|
1343
|
-
ref: inputRef,
|
|
1344
|
-
type: "text",
|
|
1345
|
-
placeholder: "Paste a link",
|
|
1346
|
-
className: "bg-background flex-1 p-1 text-sm outline-none",
|
|
1347
|
-
defaultValue: editor.getAttributes("link").href || ""
|
|
1348
|
-
}
|
|
1349
|
-
),
|
|
1350
|
-
editor.getAttributes("link").href ? /* @__PURE__ */ jsx10(
|
|
1351
|
-
Button,
|
|
1352
|
-
{
|
|
1353
|
-
size: "icon",
|
|
1354
|
-
variant: "outline",
|
|
1355
|
-
type: "button",
|
|
1356
|
-
className: "flex h-8 items-center rounded-sm p-1 text-red-600 transition-all hover:bg-red-100 dark:hover:bg-red-800",
|
|
1357
|
-
onClick: () => {
|
|
1358
|
-
editor.chain().focus().unsetLink().run();
|
|
1359
|
-
},
|
|
1360
|
-
children: /* @__PURE__ */ jsx10(Trash, { className: "h-4 w-4" })
|
|
1361
|
-
}
|
|
1362
|
-
) : /* @__PURE__ */ jsx10(Button, { size: "icon", className: "h-8", children: /* @__PURE__ */ jsx10(Check2, { className: "h-4 w-4" }) })
|
|
1363
|
-
]
|
|
1364
|
-
}
|
|
1365
|
-
) })
|
|
1366
|
-
] });
|
|
1367
|
-
};
|
|
1368
|
-
|
|
1369
|
-
// src/ui/novel/tailwind/selectors/node-selector.tsx
|
|
1370
|
-
import {
|
|
1371
|
-
Check as Check3,
|
|
1372
|
-
CheckSquare,
|
|
1373
|
-
ChevronDown as ChevronDown2,
|
|
1374
|
-
Code,
|
|
1375
|
-
Heading1,
|
|
1376
|
-
Heading2,
|
|
1377
|
-
Heading3,
|
|
1378
|
-
ListOrdered,
|
|
1379
|
-
TextIcon,
|
|
1380
|
-
TextQuote
|
|
1381
|
-
} from "lucide-react";
|
|
1382
|
-
import { Popover as Popover3 } from "@radix-ui/react-popover";
|
|
1383
|
-
import { jsx as jsx11, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1384
|
-
var items = [
|
|
1385
|
-
{
|
|
1386
|
-
name: "Text",
|
|
1387
|
-
icon: TextIcon,
|
|
1388
|
-
command: (editor) => editor.chain().focus().clearNodes().run(),
|
|
1389
|
-
// I feel like there has to be a more efficient way to do this – feel free to PR if you know how!
|
|
1390
|
-
isActive: (editor) => editor.isActive("paragraph") && !editor.isActive("bulletList") && !editor.isActive("orderedList")
|
|
1391
|
-
},
|
|
1392
|
-
{
|
|
1393
|
-
name: "Heading 1",
|
|
1394
|
-
icon: Heading1,
|
|
1395
|
-
command: (editor) => editor.chain().focus().clearNodes().toggleHeading({ level: 1 }).run(),
|
|
1396
|
-
isActive: (editor) => editor.isActive("heading", { level: 1 })
|
|
1397
|
-
},
|
|
1398
|
-
{
|
|
1399
|
-
name: "Heading 2",
|
|
1400
|
-
icon: Heading2,
|
|
1401
|
-
command: (editor) => editor.chain().focus().clearNodes().toggleHeading({ level: 2 }).run(),
|
|
1402
|
-
isActive: (editor) => editor.isActive("heading", { level: 2 })
|
|
1403
|
-
},
|
|
1404
|
-
{
|
|
1405
|
-
name: "Heading 3",
|
|
1406
|
-
icon: Heading3,
|
|
1407
|
-
command: (editor) => editor.chain().focus().clearNodes().toggleHeading({ level: 3 }).run(),
|
|
1408
|
-
isActive: (editor) => editor.isActive("heading", { level: 3 })
|
|
1409
|
-
},
|
|
1410
|
-
{
|
|
1411
|
-
name: "To-do List",
|
|
1412
|
-
icon: CheckSquare,
|
|
1413
|
-
command: (editor) => editor.chain().focus().clearNodes().toggleTaskList().run(),
|
|
1414
|
-
isActive: (editor) => editor.isActive("taskItem")
|
|
1415
|
-
},
|
|
1416
|
-
{
|
|
1417
|
-
name: "Bullet List",
|
|
1418
|
-
icon: ListOrdered,
|
|
1419
|
-
command: (editor) => editor.chain().focus().clearNodes().toggleBulletList().run(),
|
|
1420
|
-
isActive: (editor) => editor.isActive("bulletList")
|
|
1421
|
-
},
|
|
1422
|
-
{
|
|
1423
|
-
name: "Numbered List",
|
|
1424
|
-
icon: ListOrdered,
|
|
1425
|
-
command: (editor) => editor.chain().focus().clearNodes().toggleOrderedList().run(),
|
|
1426
|
-
isActive: (editor) => editor.isActive("orderedList")
|
|
1427
|
-
},
|
|
1428
|
-
{
|
|
1429
|
-
name: "Quote",
|
|
1430
|
-
icon: TextQuote,
|
|
1431
|
-
command: (editor) => editor.chain().focus().clearNodes().toggleBlockquote().run(),
|
|
1432
|
-
isActive: (editor) => editor.isActive("blockquote")
|
|
1433
|
-
},
|
|
1434
|
-
{
|
|
1435
|
-
name: "Code",
|
|
1436
|
-
icon: Code,
|
|
1437
|
-
command: (editor) => editor.chain().focus().clearNodes().toggleCodeBlock().run(),
|
|
1438
|
-
isActive: (editor) => editor.isActive("codeBlock")
|
|
1439
|
-
}
|
|
1440
|
-
];
|
|
1441
|
-
var NodeSelector = ({ open, onOpenChange }) => {
|
|
1442
|
-
var _a;
|
|
1443
|
-
const { editor } = useCurrentEditor5();
|
|
1444
|
-
if (!editor)
|
|
1445
|
-
return null;
|
|
1446
|
-
const activeItem = (_a = items.filter((item) => item.isActive(editor)).pop()) != null ? _a : {
|
|
1447
|
-
name: "Multiple"
|
|
1448
|
-
};
|
|
1449
|
-
return /* @__PURE__ */ jsxs4(Popover3, { modal: true, open, onOpenChange, children: [
|
|
1450
|
-
/* @__PURE__ */ jsx11(
|
|
1451
|
-
PopoverTrigger,
|
|
1452
|
-
{
|
|
1453
|
-
asChild: true,
|
|
1454
|
-
className: "hover:bg-accent gap-2 rounded-none border-none focus:ring-0",
|
|
1455
|
-
children: /* @__PURE__ */ jsxs4(Button, { size: "sm", variant: "ghost", className: "gap-2", children: [
|
|
1456
|
-
/* @__PURE__ */ jsx11("span", { className: "whitespace-nowrap text-sm", children: activeItem.name }),
|
|
1457
|
-
/* @__PURE__ */ jsx11(ChevronDown2, { className: "h-4 w-4" })
|
|
1458
|
-
] })
|
|
1459
|
-
}
|
|
1460
|
-
),
|
|
1461
|
-
/* @__PURE__ */ jsx11(PopoverContent, { sideOffset: 5, align: "start", className: "w-48 p-1", children: items.map((item, index) => /* @__PURE__ */ jsxs4(
|
|
1462
|
-
EditorBubbleItem,
|
|
1463
|
-
{
|
|
1464
|
-
onSelect: (editor2) => {
|
|
1465
|
-
item.command(editor2);
|
|
1466
|
-
onOpenChange(false);
|
|
1467
|
-
},
|
|
1468
|
-
className: "hover:bg-accent flex cursor-pointer items-center justify-between rounded-sm px-2 py-1 text-sm",
|
|
1469
|
-
children: [
|
|
1470
|
-
/* @__PURE__ */ jsxs4("div", { className: "flex items-center space-x-2", children: [
|
|
1471
|
-
/* @__PURE__ */ jsx11("div", { className: "rounded-sm border p-1", children: /* @__PURE__ */ jsx11(item.icon, { className: "h-3 w-3" }) }),
|
|
1472
|
-
/* @__PURE__ */ jsx11("span", { children: item.name })
|
|
1473
|
-
] }),
|
|
1474
|
-
activeItem.name === item.name && /* @__PURE__ */ jsx11(Check3, { className: "h-4 w-4" })
|
|
1475
|
-
]
|
|
1476
|
-
},
|
|
1477
|
-
index
|
|
1478
|
-
)) })
|
|
1479
|
-
] });
|
|
1480
|
-
};
|
|
1481
|
-
|
|
1482
|
-
// src/ui/novel/tailwind/ui/separator.tsx
|
|
1483
|
-
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
1484
|
-
import * as React3 from "react";
|
|
1485
|
-
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
1486
|
-
var Separator = React3.forwardRef(
|
|
1487
|
-
(_a, ref) => {
|
|
1488
|
-
var _b = _a, { className, orientation = "horizontal", decorative = true } = _b, props = __objRest(_b, ["className", "orientation", "decorative"]);
|
|
1489
|
-
return /* @__PURE__ */ jsx12(
|
|
1490
|
-
SeparatorPrimitive.Root,
|
|
1491
|
-
__spreadValues({
|
|
1492
|
-
ref,
|
|
1493
|
-
decorative,
|
|
1494
|
-
orientation,
|
|
1495
|
-
className: cn(
|
|
1496
|
-
"bg-border shrink-0",
|
|
1497
|
-
orientation === "horizontal" ? "h-px w-full" : " w-px",
|
|
1498
|
-
className
|
|
1499
|
-
)
|
|
1500
|
-
}, props)
|
|
1501
|
-
);
|
|
1502
|
-
}
|
|
1503
|
-
);
|
|
1504
|
-
Separator.displayName = SeparatorPrimitive.Root.displayName;
|
|
1505
|
-
|
|
1506
|
-
// src/ui/novel/content.ts
|
|
1507
|
-
var defaultEditorContent = {
|
|
1508
|
-
type: "doc",
|
|
1509
|
-
content: [
|
|
1510
|
-
{
|
|
1511
|
-
type: "heading",
|
|
1512
|
-
attrs: { level: 2 },
|
|
1513
|
-
content: [{ type: "text", text: "Introducing Novel" }]
|
|
1514
|
-
},
|
|
1515
|
-
{
|
|
1516
|
-
type: "paragraph",
|
|
1517
|
-
content: [
|
|
1518
|
-
{
|
|
1519
|
-
type: "text",
|
|
1520
|
-
marks: [
|
|
1521
|
-
{
|
|
1522
|
-
type: "link",
|
|
1523
|
-
attrs: {
|
|
1524
|
-
href: "https://github.com/steven-tey/novel",
|
|
1525
|
-
target: "_blank"
|
|
1526
|
-
}
|
|
1527
|
-
}
|
|
1528
|
-
],
|
|
1529
|
-
text: "Novel"
|
|
1530
|
-
},
|
|
1531
|
-
{
|
|
1532
|
-
type: "text",
|
|
1533
|
-
text: " is a Notion-style WYSIWYG editor with AI-powered autocompletion. Built with "
|
|
1534
|
-
},
|
|
1535
|
-
{
|
|
1536
|
-
type: "text",
|
|
1537
|
-
marks: [
|
|
1538
|
-
{
|
|
1539
|
-
type: "link",
|
|
1540
|
-
attrs: {
|
|
1541
|
-
href: "https://tiptap.dev/",
|
|
1542
|
-
target: "_blank"
|
|
1543
|
-
}
|
|
1544
|
-
}
|
|
1545
|
-
],
|
|
1546
|
-
text: "Tiptap"
|
|
1547
|
-
},
|
|
1548
|
-
{ type: "text", text: " + " },
|
|
1549
|
-
{
|
|
1550
|
-
type: "text",
|
|
1551
|
-
marks: [
|
|
1552
|
-
{
|
|
1553
|
-
type: "link",
|
|
1554
|
-
attrs: {
|
|
1555
|
-
href: "https://sdk.vercel.ai/docs",
|
|
1556
|
-
target: "_blank"
|
|
1557
|
-
}
|
|
1558
|
-
}
|
|
1559
|
-
],
|
|
1560
|
-
text: "Vercel AI SDK"
|
|
1561
|
-
},
|
|
1562
|
-
{ type: "text", text: "." }
|
|
1563
|
-
]
|
|
1564
|
-
},
|
|
1565
|
-
{
|
|
1566
|
-
type: "heading",
|
|
1567
|
-
attrs: { level: 3 },
|
|
1568
|
-
content: [{ type: "text", text: "Installation" }]
|
|
1569
|
-
},
|
|
1570
|
-
{
|
|
1571
|
-
type: "codeBlock",
|
|
1572
|
-
attrs: { language: null },
|
|
1573
|
-
content: [{ type: "text", text: "npm i novel" }]
|
|
1574
|
-
},
|
|
1575
|
-
{
|
|
1576
|
-
type: "heading",
|
|
1577
|
-
attrs: { level: 3 },
|
|
1578
|
-
content: [{ type: "text", text: "Usage" }]
|
|
1579
|
-
},
|
|
1580
|
-
{
|
|
1581
|
-
type: "codeBlock",
|
|
1582
|
-
attrs: { language: null },
|
|
1583
|
-
content: [
|
|
1584
|
-
{
|
|
1585
|
-
type: "text",
|
|
1586
|
-
text: 'import { Editor } from "novel";\n\nexport default function App() {\n return (\n <Editor />\n )\n}'
|
|
1587
|
-
}
|
|
1588
|
-
]
|
|
1589
|
-
},
|
|
1590
|
-
{
|
|
1591
|
-
type: "heading",
|
|
1592
|
-
attrs: { level: 3 },
|
|
1593
|
-
content: [{ type: "text", text: "Features" }]
|
|
1594
|
-
},
|
|
1595
|
-
{
|
|
1596
|
-
type: "orderedList",
|
|
1597
|
-
attrs: { tight: true, start: 1 },
|
|
1598
|
-
content: [
|
|
1599
|
-
{
|
|
1600
|
-
type: "listItem",
|
|
1601
|
-
content: [
|
|
1602
|
-
{
|
|
1603
|
-
type: "paragraph",
|
|
1604
|
-
content: [{ type: "text", text: "Slash menu & bubble menu" }]
|
|
1605
|
-
}
|
|
1606
|
-
]
|
|
1607
|
-
},
|
|
1608
|
-
{
|
|
1609
|
-
type: "listItem",
|
|
1610
|
-
content: [
|
|
1611
|
-
{
|
|
1612
|
-
type: "paragraph",
|
|
1613
|
-
content: [
|
|
1614
|
-
{ type: "text", text: "AI autocomplete (type " },
|
|
1615
|
-
{ type: "text", marks: [{ type: "code" }], text: "++" },
|
|
1616
|
-
{
|
|
1617
|
-
type: "text",
|
|
1618
|
-
text: " to activate, or select from slash menu)"
|
|
1619
|
-
}
|
|
1620
|
-
]
|
|
1621
|
-
}
|
|
1622
|
-
]
|
|
1623
|
-
},
|
|
1624
|
-
{
|
|
1625
|
-
type: "listItem",
|
|
1626
|
-
content: [
|
|
1627
|
-
{
|
|
1628
|
-
type: "paragraph",
|
|
1629
|
-
content: [
|
|
1630
|
-
{
|
|
1631
|
-
type: "text",
|
|
1632
|
-
text: "Image uploads (drag & drop / copy & paste, or select from slash menu) "
|
|
1633
|
-
}
|
|
1634
|
-
]
|
|
1635
|
-
}
|
|
1636
|
-
]
|
|
1637
|
-
}
|
|
1638
|
-
]
|
|
1639
|
-
},
|
|
1640
|
-
{
|
|
1641
|
-
type: "image",
|
|
1642
|
-
attrs: {
|
|
1643
|
-
src: "https://public.blob.vercel-storage.com/pJrjXbdONOnAeZAZ/banner-2wQk82qTwyVgvlhTW21GIkWgqPGD2C.png",
|
|
1644
|
-
alt: "banner.png",
|
|
1645
|
-
title: "banner.png",
|
|
1646
|
-
width: null,
|
|
1647
|
-
height: null
|
|
1648
|
-
}
|
|
1649
|
-
},
|
|
1650
|
-
{ type: "horizontalRule" },
|
|
1651
|
-
{
|
|
1652
|
-
type: "heading",
|
|
1653
|
-
attrs: { level: 3 },
|
|
1654
|
-
content: [{ type: "text", text: "Learn more" }]
|
|
1655
|
-
},
|
|
1656
|
-
{
|
|
1657
|
-
type: "taskList",
|
|
1658
|
-
content: [
|
|
1659
|
-
{
|
|
1660
|
-
type: "taskItem",
|
|
1661
|
-
attrs: { checked: false },
|
|
1662
|
-
content: [
|
|
1663
|
-
{
|
|
1664
|
-
type: "paragraph",
|
|
1665
|
-
content: [
|
|
1666
|
-
{ type: "text", text: "Star us on " },
|
|
1667
|
-
{
|
|
1668
|
-
type: "text",
|
|
1669
|
-
marks: [
|
|
1670
|
-
{
|
|
1671
|
-
type: "link",
|
|
1672
|
-
attrs: {
|
|
1673
|
-
href: "https://github.com/steven-tey/novel",
|
|
1674
|
-
target: "_blank"
|
|
1675
|
-
}
|
|
1676
|
-
}
|
|
1677
|
-
],
|
|
1678
|
-
text: "GitHub"
|
|
1679
|
-
}
|
|
1680
|
-
]
|
|
1681
|
-
}
|
|
1682
|
-
]
|
|
1683
|
-
},
|
|
1684
|
-
{
|
|
1685
|
-
type: "taskItem",
|
|
1686
|
-
attrs: { checked: false },
|
|
1687
|
-
content: [
|
|
1688
|
-
{
|
|
1689
|
-
type: "paragraph",
|
|
1690
|
-
content: [
|
|
1691
|
-
{ type: "text", text: "Install the " },
|
|
1692
|
-
{
|
|
1693
|
-
type: "text",
|
|
1694
|
-
marks: [
|
|
1695
|
-
{
|
|
1696
|
-
type: "link",
|
|
1697
|
-
attrs: {
|
|
1698
|
-
href: "https://www.npmjs.com/package/novel",
|
|
1699
|
-
target: "_blank"
|
|
1700
|
-
}
|
|
1701
|
-
}
|
|
1702
|
-
],
|
|
1703
|
-
text: "NPM package"
|
|
1704
|
-
}
|
|
1705
|
-
]
|
|
1706
|
-
}
|
|
1707
|
-
]
|
|
1708
|
-
},
|
|
1709
|
-
{
|
|
1710
|
-
type: "taskItem",
|
|
1711
|
-
attrs: { checked: false },
|
|
1712
|
-
content: [
|
|
1713
|
-
{
|
|
1714
|
-
type: "paragraph",
|
|
1715
|
-
content: [
|
|
1716
|
-
{
|
|
1717
|
-
type: "text",
|
|
1718
|
-
marks: [
|
|
1719
|
-
{
|
|
1720
|
-
type: "link",
|
|
1721
|
-
attrs: {
|
|
1722
|
-
href: "https://vercel.com/templates/next.js/novel",
|
|
1723
|
-
target: "_blank"
|
|
1724
|
-
}
|
|
1725
|
-
}
|
|
1726
|
-
],
|
|
1727
|
-
text: "Deploy your own"
|
|
1728
|
-
},
|
|
1729
|
-
{ type: "text", text: " to Vercel" }
|
|
1730
|
-
]
|
|
1731
|
-
}
|
|
1732
|
-
]
|
|
1733
|
-
}
|
|
1734
|
-
]
|
|
1735
|
-
}
|
|
1736
|
-
]
|
|
1737
|
-
};
|
|
1738
|
-
|
|
1739
|
-
// src/ui/novel/tailwind/generative/generative-menu-switch.tsx
|
|
1740
|
-
import { Fragment as Fragment4, useEffect as useEffect4 } from "react";
|
|
1741
|
-
|
|
1742
|
-
// src/ui/novel/tailwind/ui/icons/magic.tsx
|
|
1743
|
-
import { jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1744
|
-
function Magic({ className }) {
|
|
1745
|
-
return /* @__PURE__ */ jsxs5(
|
|
1746
|
-
"svg",
|
|
1747
|
-
{
|
|
1748
|
-
width: "469",
|
|
1749
|
-
height: "469",
|
|
1750
|
-
viewBox: "0 0 469 469",
|
|
1751
|
-
fill: "none",
|
|
1752
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1753
|
-
shapeRendering: "geometricPrecision",
|
|
1754
|
-
stroke: "currentColor",
|
|
1755
|
-
strokeLinecap: "round",
|
|
1756
|
-
strokeLinejoin: "round",
|
|
1757
|
-
strokeWidth: "1.5",
|
|
1758
|
-
className,
|
|
1759
|
-
children: [
|
|
1760
|
-
/* @__PURE__ */ jsx13(
|
|
1761
|
-
"path",
|
|
1762
|
-
{
|
|
1763
|
-
d: "M237.092 62.3004L266.754 71.4198C267.156 71.5285 267.51 71.765 267.765 72.0934C268.02 72.4218 268.161 72.8243 268.166 73.2399C268.172 73.6555 268.042 74.0616 267.796 74.3967C267.55 74.7318 267.201 74.9777 266.803 75.097L237.141 84.3145C236.84 84.4058 236.566 84.5699 236.344 84.7922C236.121 85.0146 235.957 85.2883 235.866 85.5893L226.747 115.252C226.638 115.653 226.401 116.008 226.073 116.263C225.745 116.517 225.342 116.658 224.926 116.664C224.511 116.669 224.105 116.539 223.77 116.293C223.435 116.047 223.189 115.699 223.069 115.301L213.852 85.6383C213.761 85.3374 213.597 85.0636 213.374 84.8412C213.152 84.6189 212.878 84.4548 212.577 84.3635L182.914 75.2441C182.513 75.1354 182.158 74.8989 181.904 74.5705C181.649 74.2421 181.508 73.8396 181.503 73.424C181.497 73.0084 181.627 72.6023 181.873 72.2672C182.119 71.9321 182.467 71.6863 182.865 71.5669L212.528 62.3494C212.829 62.2582 213.103 62.0941 213.325 61.8717C213.547 61.6494 213.712 61.3756 213.803 61.0747L222.922 31.4121C223.031 31.0109 223.267 30.656 223.596 30.4013C223.924 30.1465 224.327 30.0057 224.742 30.0002C225.158 29.9946 225.564 30.1247 225.899 30.3706C226.234 30.6165 226.48 30.9649 226.599 31.363L235.817 61.0257C235.908 61.3266 236.072 61.6003 236.295 61.8227C236.517 62.0451 236.791 62.2091 237.092 62.3004Z",
|
|
1764
|
-
fill: "currentColor"
|
|
1765
|
-
}
|
|
1766
|
-
),
|
|
1767
|
-
/* @__PURE__ */ jsx13(
|
|
1768
|
-
"path",
|
|
1769
|
-
{
|
|
1770
|
-
d: "M155.948 155.848L202.771 168.939C203.449 169.131 204.045 169.539 204.47 170.101C204.895 170.663 205.125 171.348 205.125 172.052C205.125 172.757 204.895 173.442 204.47 174.004C204.045 174.566 203.449 174.974 202.771 175.166L155.899 188.06C155.361 188.209 154.87 188.496 154.475 188.891C154.079 189.286 153.793 189.777 153.644 190.316L140.553 237.138C140.361 237.816 139.953 238.413 139.391 238.838C138.829 239.262 138.144 239.492 137.44 239.492C136.735 239.492 136.05 239.262 135.488 238.838C134.927 238.413 134.519 237.816 134.327 237.138L121.432 190.267C121.283 189.728 120.997 189.237 120.601 188.842C120.206 188.446 119.715 188.16 119.177 188.011L72.3537 174.92C71.676 174.728 71.0795 174.32 70.6547 173.759C70.2299 173.197 70 172.512 70 171.807C70 171.103 70.2299 170.418 70.6547 169.856C71.0795 169.294 71.676 168.886 72.3537 168.694L119.226 155.799C119.764 155.65 120.255 155.364 120.65 154.969C121.046 154.573 121.332 154.082 121.481 153.544L134.572 106.721C134.764 106.043 135.172 105.447 135.734 105.022C136.295 104.597 136.981 104.367 137.685 104.367C138.389 104.367 139.075 104.597 139.637 105.022C140.198 105.447 140.606 106.043 140.798 106.721L153.693 153.593C153.842 154.131 154.128 154.622 154.524 155.018C154.919 155.413 155.41 155.699 155.948 155.848Z",
|
|
1771
|
-
fill: "currentColor"
|
|
1772
|
-
}
|
|
1773
|
-
),
|
|
1774
|
-
/* @__PURE__ */ jsx13(
|
|
1775
|
-
"path",
|
|
1776
|
-
{
|
|
1777
|
-
d: "M386.827 289.992C404.33 292.149 403.84 305.828 386.876 307.299C346.623 310.829 298.869 316.271 282.199 360.005C274.844 379.192 269.942 403.2 267.49 432.029C267.427 432.846 267.211 433.626 266.856 434.319C266.501 435.012 266.015 435.602 265.431 436.05C254.988 444.041 251.212 434.186 250.183 425.606C239.2 332.353 214.588 316.909 124.668 306.122C123.892 306.031 123.151 305.767 122.504 305.35C121.857 304.933 121.322 304.375 120.942 303.72C116.399 295.679 119.324 291.038 129.718 289.796C224.688 278.47 236.062 262.83 250.183 169.331C252.177 156.355 257.259 154.083 265.431 162.516C266.51 163.593 267.202 165.099 267.392 166.782C279.257 258.564 293.328 278.617 386.827 289.992Z",
|
|
1778
|
-
fill: "currentColor"
|
|
1779
|
-
}
|
|
1780
|
-
)
|
|
1781
|
-
]
|
|
1782
|
-
}
|
|
1783
|
-
);
|
|
1784
|
-
}
|
|
1785
|
-
|
|
1786
|
-
// src/ui/novel/tailwind/generative/ai-selector.tsx
|
|
1787
|
-
import { useCompletion } from "ai/react";
|
|
1788
|
-
import { ArrowUp } from "lucide-react";
|
|
1789
|
-
import { useState } from "react";
|
|
1790
|
-
import Markdown2 from "react-markdown";
|
|
1791
|
-
import { toast } from "sonner";
|
|
1792
|
-
|
|
1793
|
-
// src/ui/novel/tailwind/ui/command.tsx
|
|
1794
|
-
import { DialogContent as DialogContent2 } from "@radix-ui/react-dialog";
|
|
1795
|
-
import { Command as CommandPrimitive } from "cmdk";
|
|
1796
|
-
import * as React5 from "react";
|
|
1797
|
-
|
|
1798
|
-
// src/ui/novel/tailwind/ui/dialog.tsx
|
|
1799
|
-
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
1800
|
-
import { X } from "lucide-react";
|
|
1801
|
-
import * as React4 from "react";
|
|
1802
|
-
import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1803
|
-
var DialogPortal = DialogPrimitive.Portal;
|
|
1804
|
-
var DialogOverlay = React4.forwardRef((_a, ref) => {
|
|
1805
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1806
|
-
return /* @__PURE__ */ jsx14(
|
|
1807
|
-
DialogPrimitive.Overlay,
|
|
1808
|
-
__spreadValues({
|
|
1809
|
-
ref,
|
|
1810
|
-
className: cn(
|
|
1811
|
-
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80",
|
|
1812
|
-
className
|
|
1813
|
-
)
|
|
1814
|
-
}, props)
|
|
1815
|
-
);
|
|
1816
|
-
});
|
|
1817
|
-
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
1818
|
-
var DialogContent = React4.forwardRef((_a, ref) => {
|
|
1819
|
-
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
1820
|
-
return /* @__PURE__ */ jsxs6(DialogPortal, { children: [
|
|
1821
|
-
/* @__PURE__ */ jsx14(DialogOverlay, {}),
|
|
1822
|
-
/* @__PURE__ */ jsxs6(
|
|
1823
|
-
DialogPrimitive.Content,
|
|
1824
|
-
__spreadProps(__spreadValues({
|
|
1825
|
-
ref,
|
|
1826
|
-
className: cn(
|
|
1827
|
-
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border p-6 shadow-lg duration-200 sm:rounded-lg",
|
|
1828
|
-
className
|
|
1829
|
-
)
|
|
1830
|
-
}, props), {
|
|
1831
|
-
children: [
|
|
1832
|
-
children,
|
|
1833
|
-
/* @__PURE__ */ jsxs6(DialogPrimitive.Close, { className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:pointer-events-none", children: [
|
|
1834
|
-
/* @__PURE__ */ jsx14(X, { className: "h-4 w-4" }),
|
|
1835
|
-
/* @__PURE__ */ jsx14("span", { className: "sr-only", children: "Close" })
|
|
1836
|
-
] })
|
|
1837
|
-
]
|
|
1838
|
-
})
|
|
1839
|
-
)
|
|
1840
|
-
] });
|
|
1841
|
-
});
|
|
1842
|
-
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
1843
|
-
var DialogHeader = (_a) => {
|
|
1844
|
-
var _b = _a, {
|
|
1845
|
-
className
|
|
1846
|
-
} = _b, props = __objRest(_b, [
|
|
1847
|
-
"className"
|
|
1848
|
-
]);
|
|
1849
|
-
return /* @__PURE__ */ jsx14(
|
|
1850
|
-
"div",
|
|
1851
|
-
__spreadValues({
|
|
1852
|
-
className: cn(
|
|
1853
|
-
"flex flex-col space-y-1.5 text-center sm:text-left",
|
|
1854
|
-
className
|
|
1855
|
-
)
|
|
1856
|
-
}, props)
|
|
1857
|
-
);
|
|
1858
|
-
};
|
|
1859
|
-
DialogHeader.displayName = "DialogHeader";
|
|
1860
|
-
var DialogFooter = (_a) => {
|
|
1861
|
-
var _b = _a, {
|
|
1862
|
-
className
|
|
1863
|
-
} = _b, props = __objRest(_b, [
|
|
1864
|
-
"className"
|
|
1865
|
-
]);
|
|
1866
|
-
return /* @__PURE__ */ jsx14(
|
|
1867
|
-
"div",
|
|
1868
|
-
__spreadValues({
|
|
1869
|
-
className: cn(
|
|
1870
|
-
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
|
1871
|
-
className
|
|
1872
|
-
)
|
|
1873
|
-
}, props)
|
|
1874
|
-
);
|
|
1875
|
-
};
|
|
1876
|
-
DialogFooter.displayName = "DialogFooter";
|
|
1877
|
-
var DialogTitle = React4.forwardRef((_a, ref) => {
|
|
1878
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1879
|
-
return /* @__PURE__ */ jsx14(
|
|
1880
|
-
DialogPrimitive.Title,
|
|
1881
|
-
__spreadValues({
|
|
1882
|
-
ref,
|
|
1883
|
-
className: cn(
|
|
1884
|
-
"text-lg font-semibold leading-none tracking-tight",
|
|
1885
|
-
className
|
|
1886
|
-
)
|
|
1887
|
-
}, props)
|
|
1888
|
-
);
|
|
1889
|
-
});
|
|
1890
|
-
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
1891
|
-
var DialogDescription = React4.forwardRef((_a, ref) => {
|
|
1892
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1893
|
-
return /* @__PURE__ */ jsx14(
|
|
1894
|
-
DialogPrimitive.Description,
|
|
1895
|
-
__spreadValues({
|
|
1896
|
-
ref,
|
|
1897
|
-
className: cn("text-muted-foreground text-sm", className)
|
|
1898
|
-
}, props)
|
|
1899
|
-
);
|
|
1900
|
-
});
|
|
1901
|
-
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
1902
|
-
|
|
1903
|
-
// src/ui/novel/tailwind/ui/command.tsx
|
|
1904
|
-
import { jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1905
|
-
var Command3 = React5.forwardRef((_a, ref) => {
|
|
1906
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1907
|
-
return /* @__PURE__ */ jsx15(
|
|
1908
|
-
CommandPrimitive,
|
|
1909
|
-
__spreadValues({
|
|
1910
|
-
ref,
|
|
1911
|
-
className: cn(
|
|
1912
|
-
"bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",
|
|
1913
|
-
className
|
|
1914
|
-
)
|
|
1915
|
-
}, props)
|
|
1916
|
-
);
|
|
1917
|
-
});
|
|
1918
|
-
Command3.displayName = CommandPrimitive.displayName;
|
|
1919
|
-
var CommandInput = React5.forwardRef((_a, ref) => {
|
|
1920
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1921
|
-
return /* @__PURE__ */ jsxs7("div", { className: "flex items-center border-b px-4", "cmdk-input-wrapper": "", children: [
|
|
1922
|
-
/* @__PURE__ */ jsx15(Magic, { className: "mr-2 h-4 w-4 shrink-0 text-purple-500 " }),
|
|
1923
|
-
/* @__PURE__ */ jsx15(
|
|
1924
|
-
CommandPrimitive.Input,
|
|
1925
|
-
__spreadValues({
|
|
1926
|
-
ref,
|
|
1927
|
-
className: cn(
|
|
1928
|
-
"placeholder:text-muted-foreground flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
1929
|
-
className
|
|
1930
|
-
)
|
|
1931
|
-
}, props)
|
|
1932
|
-
)
|
|
1933
|
-
] });
|
|
1934
|
-
});
|
|
1935
|
-
CommandInput.displayName = CommandPrimitive.Input.displayName;
|
|
1936
|
-
var CommandList = React5.forwardRef((_a, ref) => {
|
|
1937
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1938
|
-
return /* @__PURE__ */ jsx15(
|
|
1939
|
-
CommandPrimitive.List,
|
|
1940
|
-
__spreadValues({
|
|
1941
|
-
ref,
|
|
1942
|
-
className: cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className)
|
|
1943
|
-
}, props)
|
|
1944
|
-
);
|
|
1945
|
-
});
|
|
1946
|
-
CommandList.displayName = CommandPrimitive.List.displayName;
|
|
1947
|
-
var CommandEmpty2 = React5.forwardRef((props, ref) => /* @__PURE__ */ jsx15(
|
|
1948
|
-
CommandPrimitive.Empty,
|
|
1949
|
-
__spreadValues({
|
|
1950
|
-
ref,
|
|
1951
|
-
className: "py-6 text-center text-sm"
|
|
1952
|
-
}, props)
|
|
1953
|
-
));
|
|
1954
|
-
CommandEmpty2.displayName = CommandPrimitive.Empty.displayName;
|
|
1955
|
-
var CommandGroup = React5.forwardRef((_a, ref) => {
|
|
1956
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1957
|
-
return /* @__PURE__ */ jsx15(
|
|
1958
|
-
CommandPrimitive.Group,
|
|
1959
|
-
__spreadValues({
|
|
1960
|
-
ref,
|
|
1961
|
-
className: cn(
|
|
1962
|
-
"text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",
|
|
1963
|
-
className
|
|
1964
|
-
)
|
|
1965
|
-
}, props)
|
|
1966
|
-
);
|
|
1967
|
-
});
|
|
1968
|
-
CommandGroup.displayName = CommandPrimitive.Group.displayName;
|
|
1969
|
-
var CommandSeparator = React5.forwardRef((_a, ref) => {
|
|
1970
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1971
|
-
return /* @__PURE__ */ jsx15(
|
|
1972
|
-
CommandPrimitive.Separator,
|
|
1973
|
-
__spreadValues({
|
|
1974
|
-
ref,
|
|
1975
|
-
className: cn("bg-border -mx-1 h-px", className)
|
|
1976
|
-
}, props)
|
|
1977
|
-
);
|
|
1978
|
-
});
|
|
1979
|
-
CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
|
|
1980
|
-
var CommandItem2 = React5.forwardRef((_a, ref) => {
|
|
1981
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1982
|
-
return /* @__PURE__ */ jsx15(
|
|
1983
|
-
CommandPrimitive.Item,
|
|
1984
|
-
__spreadValues({
|
|
1985
|
-
ref,
|
|
1986
|
-
className: cn(
|
|
1987
|
-
"aria-selected:bg-accent aria-selected:text-accent-foreground relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
1988
|
-
className
|
|
1989
|
-
)
|
|
1990
|
-
}, props)
|
|
1991
|
-
);
|
|
1992
|
-
});
|
|
1993
|
-
CommandItem2.displayName = CommandPrimitive.Item.displayName;
|
|
1994
|
-
var CommandShortcut = (_a) => {
|
|
1995
|
-
var _b = _a, {
|
|
1996
|
-
className
|
|
1997
|
-
} = _b, props = __objRest(_b, [
|
|
1998
|
-
"className"
|
|
1999
|
-
]);
|
|
2000
|
-
return /* @__PURE__ */ jsx15(
|
|
2001
|
-
"span",
|
|
2002
|
-
__spreadValues({
|
|
2003
|
-
className: cn(
|
|
2004
|
-
"text-muted-foreground ml-auto text-xs tracking-widest",
|
|
2005
|
-
className
|
|
2006
|
-
)
|
|
2007
|
-
}, props)
|
|
2008
|
-
);
|
|
2009
|
-
};
|
|
2010
|
-
CommandShortcut.displayName = "CommandShortcut";
|
|
2011
|
-
|
|
2012
|
-
// src/ui/novel/tailwind/ui/icons/crazy-spinner.tsx
|
|
2013
|
-
import { jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2014
|
-
var CrazySpinner = () => {
|
|
2015
|
-
return /* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-center gap-0.5", children: [
|
|
2016
|
-
/* @__PURE__ */ jsx16("div", { className: "h-1.5 w-1.5 animate-bounce rounded-full bg-purple-500 [animation-delay:-0.3s]" }),
|
|
2017
|
-
/* @__PURE__ */ jsx16("div", { className: "h-1.5 w-1.5 animate-bounce rounded-full bg-purple-500 [animation-delay:-0.15s]" }),
|
|
2018
|
-
/* @__PURE__ */ jsx16("div", { className: "h-1.5 w-1.5 animate-bounce rounded-full bg-purple-500" })
|
|
2019
|
-
] });
|
|
2020
|
-
};
|
|
2021
|
-
var crazy_spinner_default = CrazySpinner;
|
|
2022
|
-
|
|
2023
|
-
// src/ui/novel/tailwind/ui/scroll-area.tsx
|
|
2024
|
-
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
|
|
2025
|
-
import * as React6 from "react";
|
|
2026
|
-
import { jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2027
|
-
var ScrollArea = React6.forwardRef((_a, ref) => {
|
|
2028
|
-
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
2029
|
-
return /* @__PURE__ */ jsxs9(
|
|
2030
|
-
ScrollAreaPrimitive.Root,
|
|
2031
|
-
__spreadProps(__spreadValues({
|
|
2032
|
-
ref,
|
|
2033
|
-
className: cn("relative overflow-hidden", className)
|
|
2034
|
-
}, props), {
|
|
2035
|
-
children: [
|
|
2036
|
-
/* @__PURE__ */ jsx17(ScrollAreaPrimitive.Viewport, { className: "h-full w-full rounded-[inherit]", children }),
|
|
2037
|
-
/* @__PURE__ */ jsx17(ScrollBar, {}),
|
|
2038
|
-
/* @__PURE__ */ jsx17(ScrollAreaPrimitive.Corner, {})
|
|
2039
|
-
]
|
|
2040
|
-
})
|
|
2041
|
-
);
|
|
2042
|
-
});
|
|
2043
|
-
ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
|
|
2044
|
-
var ScrollBar = React6.forwardRef((_a, ref) => {
|
|
2045
|
-
var _b = _a, { className, orientation = "vertical" } = _b, props = __objRest(_b, ["className", "orientation"]);
|
|
2046
|
-
return /* @__PURE__ */ jsx17(
|
|
2047
|
-
ScrollAreaPrimitive.ScrollAreaScrollbar,
|
|
2048
|
-
__spreadProps(__spreadValues({
|
|
2049
|
-
ref,
|
|
2050
|
-
orientation,
|
|
2051
|
-
className: cn(
|
|
2052
|
-
"flex touch-none select-none transition-colors",
|
|
2053
|
-
orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent p-px",
|
|
2054
|
-
orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-px",
|
|
2055
|
-
className
|
|
2056
|
-
)
|
|
2057
|
-
}, props), {
|
|
2058
|
-
children: /* @__PURE__ */ jsx17(ScrollAreaPrimitive.ScrollAreaThumb, { className: "bg-border relative flex-1 rounded-full" })
|
|
2059
|
-
})
|
|
2060
|
-
);
|
|
2061
|
-
});
|
|
2062
|
-
ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
|
|
2063
|
-
|
|
2064
|
-
// src/ui/novel/tailwind/generative/ai-completion-command.tsx
|
|
2065
|
-
import { Check as Check4, TextQuote as TextQuote2, TrashIcon } from "lucide-react";
|
|
2066
|
-
import { Fragment, jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2067
|
-
var AICompletionCommands = ({
|
|
2068
|
-
completion,
|
|
2069
|
-
onDiscard
|
|
2070
|
-
}) => {
|
|
2071
|
-
const { editor } = useCurrentEditor5();
|
|
2072
|
-
if (!editor) {
|
|
2073
|
-
return null;
|
|
2074
|
-
}
|
|
2075
|
-
return /* @__PURE__ */ jsxs10(Fragment, { children: [
|
|
2076
|
-
/* @__PURE__ */ jsxs10(CommandGroup, { children: [
|
|
2077
|
-
/* @__PURE__ */ jsxs10(
|
|
2078
|
-
CommandItem2,
|
|
2079
|
-
{
|
|
2080
|
-
className: "gap-2 px-4",
|
|
2081
|
-
value: "replace",
|
|
2082
|
-
onSelect: () => {
|
|
2083
|
-
const selection = editor.view.state.selection;
|
|
2084
|
-
editor.chain().focus().insertContentAt(
|
|
2085
|
-
{
|
|
2086
|
-
from: selection.from,
|
|
2087
|
-
to: selection.to
|
|
2088
|
-
},
|
|
2089
|
-
completion
|
|
2090
|
-
).run();
|
|
2091
|
-
},
|
|
2092
|
-
children: [
|
|
2093
|
-
/* @__PURE__ */ jsx18(Check4, { className: "text-muted-foreground h-4 w-4" }),
|
|
2094
|
-
"Replace selection"
|
|
2095
|
-
]
|
|
2096
|
-
}
|
|
2097
|
-
),
|
|
2098
|
-
/* @__PURE__ */ jsxs10(
|
|
2099
|
-
CommandItem2,
|
|
2100
|
-
{
|
|
2101
|
-
className: "gap-2 px-4",
|
|
2102
|
-
value: "insert",
|
|
2103
|
-
onSelect: () => {
|
|
2104
|
-
const selection = editor.view.state.selection;
|
|
2105
|
-
editor.chain().focus().insertContentAt(selection.to + 1, completion).run();
|
|
2106
|
-
},
|
|
2107
|
-
children: [
|
|
2108
|
-
/* @__PURE__ */ jsx18(TextQuote2, { className: "text-muted-foreground h-4 w-4" }),
|
|
2109
|
-
"Insert below"
|
|
2110
|
-
]
|
|
2111
|
-
}
|
|
2112
|
-
)
|
|
2113
|
-
] }),
|
|
2114
|
-
/* @__PURE__ */ jsx18(CommandSeparator, {}),
|
|
2115
|
-
/* @__PURE__ */ jsx18(CommandGroup, { children: /* @__PURE__ */ jsxs10(CommandItem2, { onSelect: onDiscard, value: "thrash", className: "gap-2 px-4", children: [
|
|
2116
|
-
/* @__PURE__ */ jsx18(TrashIcon, { className: "text-muted-foreground h-4 w-4" }),
|
|
2117
|
-
"Discard"
|
|
2118
|
-
] }) })
|
|
2119
|
-
] });
|
|
2120
|
-
};
|
|
2121
|
-
var ai_completion_command_default = AICompletionCommands;
|
|
2122
|
-
|
|
2123
|
-
// src/ui/novel/tailwind/generative/ai-selector-commands.tsx
|
|
2124
|
-
import {
|
|
2125
|
-
ArrowDownWideNarrow,
|
|
2126
|
-
CheckCheck,
|
|
2127
|
-
RefreshCcwDot,
|
|
2128
|
-
StepForward,
|
|
2129
|
-
WrapText
|
|
2130
|
-
} from "lucide-react";
|
|
2131
|
-
import { Fragment as Fragment2, jsx as jsx19, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2132
|
-
var options = [
|
|
2133
|
-
{
|
|
2134
|
-
value: "improve",
|
|
2135
|
-
label: "Improve writing",
|
|
2136
|
-
icon: RefreshCcwDot
|
|
2137
|
-
},
|
|
2138
|
-
{
|
|
2139
|
-
value: "fix",
|
|
2140
|
-
label: "Fix grammar",
|
|
2141
|
-
icon: CheckCheck
|
|
2142
|
-
},
|
|
2143
|
-
{
|
|
2144
|
-
value: "shorter",
|
|
2145
|
-
label: "Make shorter",
|
|
2146
|
-
icon: ArrowDownWideNarrow
|
|
2147
|
-
},
|
|
2148
|
-
{
|
|
2149
|
-
value: "longer",
|
|
2150
|
-
label: "Make longer",
|
|
2151
|
-
icon: WrapText
|
|
2152
|
-
}
|
|
2153
|
-
];
|
|
2154
|
-
var AISelectorCommands = ({ onSelect }) => {
|
|
2155
|
-
const { editor } = useCurrentEditor5();
|
|
2156
|
-
if (!editor)
|
|
2157
|
-
return null;
|
|
2158
|
-
return /* @__PURE__ */ jsxs11(Fragment2, { children: [
|
|
2159
|
-
/* @__PURE__ */ jsx19(CommandGroup, { heading: "Edit or review selection", children: options.map((option) => /* @__PURE__ */ jsxs11(
|
|
2160
|
-
CommandItem2,
|
|
2161
|
-
{
|
|
2162
|
-
onSelect: (value) => {
|
|
2163
|
-
const slice = editor.state.selection.content();
|
|
2164
|
-
const text = editor.storage.markdown.serializer.serialize(
|
|
2165
|
-
slice.content
|
|
2166
|
-
);
|
|
2167
|
-
onSelect(text, value);
|
|
2168
|
-
},
|
|
2169
|
-
className: "flex gap-2 px-4",
|
|
2170
|
-
value: option.value,
|
|
2171
|
-
children: [
|
|
2172
|
-
/* @__PURE__ */ jsx19(option.icon, { className: "h-4 w-4 text-purple-500" }),
|
|
2173
|
-
option.label
|
|
2174
|
-
]
|
|
2175
|
-
},
|
|
2176
|
-
option.value
|
|
2177
|
-
)) }),
|
|
2178
|
-
/* @__PURE__ */ jsx19(CommandSeparator, {}),
|
|
2179
|
-
/* @__PURE__ */ jsx19(CommandGroup, { heading: "Use AI to do more", children: /* @__PURE__ */ jsxs11(
|
|
2180
|
-
CommandItem2,
|
|
2181
|
-
{
|
|
2182
|
-
onSelect: () => {
|
|
2183
|
-
const text = getPrevText(editor, { chars: 5e3 });
|
|
2184
|
-
onSelect(text, "continue");
|
|
2185
|
-
},
|
|
2186
|
-
value: "continue",
|
|
2187
|
-
className: "gap-2 px-4",
|
|
2188
|
-
children: [
|
|
2189
|
-
/* @__PURE__ */ jsx19(StepForward, { className: "h-4 w-4 text-purple-500" }),
|
|
2190
|
-
"Continue writing"
|
|
2191
|
-
]
|
|
2192
|
-
}
|
|
2193
|
-
) })
|
|
2194
|
-
] });
|
|
2195
|
-
};
|
|
2196
|
-
var ai_selector_commands_default = AISelectorCommands;
|
|
2197
|
-
|
|
2198
|
-
// src/ui/novel/tailwind/generative/ai-selector.tsx
|
|
2199
|
-
import { Fragment as Fragment3, jsx as jsx20, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2200
|
-
function AISelector({ onOpenChange }) {
|
|
2201
|
-
const { editor } = useCurrentEditor5();
|
|
2202
|
-
const [inputValue, setInputValue] = useState("");
|
|
2203
|
-
const { completion, complete, isLoading } = useCompletion({
|
|
2204
|
-
// id: "novel",
|
|
2205
|
-
api: "/api/generate",
|
|
2206
|
-
onResponse: (response) => {
|
|
2207
|
-
if (response.status === 429) {
|
|
2208
|
-
toast.error("You have reached your request limit for the day.");
|
|
2209
|
-
return;
|
|
2210
|
-
}
|
|
2211
|
-
},
|
|
2212
|
-
onError: (e) => {
|
|
2213
|
-
toast.error(e.message);
|
|
2214
|
-
}
|
|
2215
|
-
});
|
|
2216
|
-
const hasCompletion = completion.length > 0;
|
|
2217
|
-
if (!editor)
|
|
2218
|
-
return null;
|
|
2219
|
-
return /* @__PURE__ */ jsxs12(Command3, { className: "w-[350px]", children: [
|
|
2220
|
-
hasCompletion && /* @__PURE__ */ jsx20("div", { className: "flex max-h-[400px]", children: /* @__PURE__ */ jsx20(ScrollArea, { children: /* @__PURE__ */ jsx20("div", { className: "prose prose-sm p-2 px-4", children: /* @__PURE__ */ jsx20(Markdown2, { children: completion }) }) }) }),
|
|
2221
|
-
isLoading && /* @__PURE__ */ jsxs12("div", { className: "text-muted-foreground flex h-12 w-full items-center px-4 text-sm font-medium text-purple-500", children: [
|
|
2222
|
-
/* @__PURE__ */ jsx20(Magic, { className: "mr-2 h-4 w-4 shrink-0 " }),
|
|
2223
|
-
"AI is thinking",
|
|
2224
|
-
/* @__PURE__ */ jsx20("div", { className: "ml-2 mt-1", children: /* @__PURE__ */ jsx20(crazy_spinner_default, {}) })
|
|
2225
|
-
] }),
|
|
2226
|
-
!isLoading && /* @__PURE__ */ jsxs12(Fragment3, { children: [
|
|
2227
|
-
/* @__PURE__ */ jsxs12("div", { className: "relative", children: [
|
|
2228
|
-
/* @__PURE__ */ jsx20(
|
|
2229
|
-
CommandInput,
|
|
2230
|
-
{
|
|
2231
|
-
value: inputValue,
|
|
2232
|
-
onValueChange: setInputValue,
|
|
2233
|
-
autoFocus: true,
|
|
2234
|
-
placeholder: hasCompletion ? "Tell AI what to do next" : "Ask AI to edit or generate...",
|
|
2235
|
-
onFocus: () => addAIHighlight(editor)
|
|
2236
|
-
}
|
|
2237
|
-
),
|
|
2238
|
-
/* @__PURE__ */ jsx20(
|
|
2239
|
-
Button,
|
|
2240
|
-
{
|
|
2241
|
-
size: "icon",
|
|
2242
|
-
className: "absolute right-2 top-1/2 h-6 w-6 -translate-y-1/2 rounded-full bg-purple-500 hover:bg-purple-900",
|
|
2243
|
-
onClick: () => {
|
|
2244
|
-
if (completion)
|
|
2245
|
-
return complete(completion, {
|
|
2246
|
-
body: { option: "zap", command: inputValue }
|
|
2247
|
-
}).then(() => setInputValue(""));
|
|
2248
|
-
const slice = editor.state.selection.content();
|
|
2249
|
-
const text = editor.storage.markdown.serializer.serialize(
|
|
2250
|
-
slice.content
|
|
2251
|
-
);
|
|
2252
|
-
complete(text, {
|
|
2253
|
-
body: { option: "zap", command: inputValue }
|
|
2254
|
-
}).then(() => setInputValue(""));
|
|
2255
|
-
},
|
|
2256
|
-
children: /* @__PURE__ */ jsx20(ArrowUp, { className: "h-4 w-4" })
|
|
2257
|
-
}
|
|
2258
|
-
)
|
|
2259
|
-
] }),
|
|
2260
|
-
hasCompletion ? /* @__PURE__ */ jsx20(
|
|
2261
|
-
ai_completion_command_default,
|
|
2262
|
-
{
|
|
2263
|
-
onDiscard: () => {
|
|
2264
|
-
onOpenChange(false);
|
|
2265
|
-
},
|
|
2266
|
-
completion
|
|
2267
|
-
}
|
|
2268
|
-
) : /* @__PURE__ */ jsx20(
|
|
2269
|
-
ai_selector_commands_default,
|
|
2270
|
-
{
|
|
2271
|
-
onSelect: (value, option) => complete(value, { body: { option } })
|
|
2272
|
-
}
|
|
2273
|
-
)
|
|
2274
|
-
] })
|
|
2275
|
-
] });
|
|
2276
|
-
}
|
|
2277
|
-
|
|
2278
|
-
// src/ui/novel/tailwind/generative/generative-menu-switch.tsx
|
|
2279
|
-
import { jsx as jsx21, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2280
|
-
var GenerativeMenuSwitch = ({
|
|
2281
|
-
children,
|
|
2282
|
-
open,
|
|
2283
|
-
onOpenChange
|
|
2284
|
-
}) => {
|
|
2285
|
-
const { editor } = useCurrentEditor5();
|
|
2286
|
-
useEffect4(() => {
|
|
2287
|
-
if (editor) {
|
|
2288
|
-
if (!open)
|
|
2289
|
-
removeAIHighlight(editor);
|
|
2290
|
-
}
|
|
2291
|
-
}, [open]);
|
|
2292
|
-
if (!editor)
|
|
2293
|
-
return;
|
|
2294
|
-
return /* @__PURE__ */ jsxs13(
|
|
2295
|
-
EditorBubble,
|
|
2296
|
-
{
|
|
2297
|
-
tippyOptions: {
|
|
2298
|
-
placement: open ? "bottom-start" : "top",
|
|
2299
|
-
onHidden: () => {
|
|
2300
|
-
onOpenChange(false);
|
|
2301
|
-
}
|
|
2302
|
-
},
|
|
2303
|
-
className: "border-muted bg-background flex w-fit max-w-[90vw] overflow-hidden rounded-md border shadow-xl",
|
|
2304
|
-
children: [
|
|
2305
|
-
open && /* @__PURE__ */ jsx21(AISelector, { open, onOpenChange }),
|
|
2306
|
-
!open && /* @__PURE__ */ jsxs13(Fragment4, { children: [
|
|
2307
|
-
/* @__PURE__ */ jsxs13(
|
|
2308
|
-
Button,
|
|
2309
|
-
{
|
|
2310
|
-
className: "gap-1 rounded-none text-purple-500",
|
|
2311
|
-
variant: "ghost",
|
|
2312
|
-
onClick: () => onOpenChange(true),
|
|
2313
|
-
size: "sm",
|
|
2314
|
-
children: [
|
|
2315
|
-
/* @__PURE__ */ jsx21(Magic, { className: "h-5 w-5" }),
|
|
2316
|
-
"Ask AI"
|
|
2317
|
-
]
|
|
2318
|
-
}
|
|
2319
|
-
),
|
|
2320
|
-
children
|
|
2321
|
-
] })
|
|
2322
|
-
]
|
|
2323
|
-
}
|
|
2324
|
-
);
|
|
2325
|
-
};
|
|
2326
|
-
var generative_menu_switch_default = GenerativeMenuSwitch;
|
|
2327
|
-
|
|
2328
|
-
// src/ui/novel/tailwind/image-upload.ts
|
|
2329
|
-
import { toast as toast2 } from "sonner";
|
|
2330
|
-
var onUpload = (file) => {
|
|
2331
|
-
const promise = fetch("/api/upload", {
|
|
2332
|
-
method: "POST",
|
|
2333
|
-
headers: {
|
|
2334
|
-
"content-type": (file == null ? void 0 : file.type) || "application/octet-stream",
|
|
2335
|
-
"x-vercel-filename": (file == null ? void 0 : file.name) || "image.png"
|
|
2336
|
-
},
|
|
2337
|
-
body: file
|
|
2338
|
-
});
|
|
2339
|
-
return new Promise((resolve) => {
|
|
2340
|
-
toast2.promise(
|
|
2341
|
-
promise.then((res) => __async(void 0, null, function* () {
|
|
2342
|
-
if (res.status === 200) {
|
|
2343
|
-
const { url } = yield res.json();
|
|
2344
|
-
const image = new Image();
|
|
2345
|
-
image.src = url;
|
|
2346
|
-
image.onload = () => {
|
|
2347
|
-
resolve(url);
|
|
2348
|
-
};
|
|
2349
|
-
} else if (res.status === 401) {
|
|
2350
|
-
resolve(file);
|
|
2351
|
-
throw new Error(
|
|
2352
|
-
"`BLOB_READ_WRITE_TOKEN` environment variable not found, reading image locally instead."
|
|
2353
|
-
);
|
|
2354
|
-
} else {
|
|
2355
|
-
throw new Error(`Error uploading image. Please try again.`);
|
|
2356
|
-
}
|
|
2357
|
-
})),
|
|
2358
|
-
{
|
|
2359
|
-
loading: "Uploading image...",
|
|
2360
|
-
success: "Image uploaded successfully.",
|
|
2361
|
-
error: (e) => e.message
|
|
2362
|
-
}
|
|
2363
|
-
);
|
|
2364
|
-
});
|
|
2365
|
-
};
|
|
2366
|
-
var uploadFn = createImageUpload({
|
|
2367
|
-
onUpload,
|
|
2368
|
-
validateFn: (file) => {
|
|
2369
|
-
if (!file.type.includes("image/")) {
|
|
2370
|
-
toast2.error("File type not supported.");
|
|
2371
|
-
return false;
|
|
2372
|
-
} else if (file.size / 1024 / 1024 > 20) {
|
|
2373
|
-
toast2.error("File size too big (max 20MB).");
|
|
2374
|
-
return false;
|
|
2375
|
-
}
|
|
2376
|
-
return true;
|
|
2377
|
-
}
|
|
2378
|
-
});
|
|
2379
|
-
|
|
2380
|
-
// src/ui/novel/tailwind/selectors/text-buttons.tsx
|
|
2381
|
-
import {
|
|
2382
|
-
BoldIcon,
|
|
2383
|
-
CodeIcon,
|
|
2384
|
-
ItalicIcon,
|
|
2385
|
-
StrikethroughIcon
|
|
2386
|
-
} from "lucide-react";
|
|
2387
|
-
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
2388
|
-
var TextButtons = () => {
|
|
2389
|
-
const { editor } = useCurrentEditor5();
|
|
2390
|
-
if (!editor)
|
|
2391
|
-
return null;
|
|
2392
|
-
if (editor == null)
|
|
2393
|
-
return null;
|
|
2394
|
-
const items2 = [
|
|
2395
|
-
{
|
|
2396
|
-
name: "bold",
|
|
2397
|
-
isActive: (editor2) => editor2.isActive("bold"),
|
|
2398
|
-
command: (editor2) => editor2.chain().focus().toggleBold().run(),
|
|
2399
|
-
icon: BoldIcon
|
|
2400
|
-
},
|
|
2401
|
-
{
|
|
2402
|
-
name: "italic",
|
|
2403
|
-
isActive: (editor2) => editor2.isActive("italic"),
|
|
2404
|
-
command: (editor2) => editor2.chain().focus().toggleItalic().run(),
|
|
2405
|
-
icon: ItalicIcon
|
|
2406
|
-
},
|
|
2407
|
-
// {
|
|
2408
|
-
// name: "underline",
|
|
2409
|
-
// isActive: (editor) => editor!.isActive("underline"),
|
|
2410
|
-
// command: (editor) => editor!.chain().focus().toggleUnderline().run(),
|
|
2411
|
-
// icon: UnderlineIcon,
|
|
2412
|
-
// },
|
|
2413
|
-
{
|
|
2414
|
-
name: "strike",
|
|
2415
|
-
isActive: (editor2) => editor2.isActive("strike"),
|
|
2416
|
-
command: (editor2) => editor2.chain().focus().toggleStrike().run(),
|
|
2417
|
-
icon: StrikethroughIcon
|
|
2418
|
-
},
|
|
2419
|
-
{
|
|
2420
|
-
name: "code",
|
|
2421
|
-
isActive: (editor2) => editor2.isActive("code"),
|
|
2422
|
-
command: (editor2) => editor2.chain().focus().toggleCode().run(),
|
|
2423
|
-
icon: CodeIcon
|
|
2424
|
-
}
|
|
2425
|
-
];
|
|
2426
|
-
return /* @__PURE__ */ jsx22("div", { className: "flex", children: items2.map((item, index) => /* @__PURE__ */ jsx22(
|
|
2427
|
-
EditorBubbleItem,
|
|
2428
|
-
{
|
|
2429
|
-
onSelect: (editor2) => {
|
|
2430
|
-
item.command(editor2);
|
|
2431
|
-
},
|
|
2432
|
-
children: /* @__PURE__ */ jsx22(Button, { size: "sm", className: "rounded-none", variant: "ghost", children: /* @__PURE__ */ jsx22(
|
|
2433
|
-
item.icon,
|
|
2434
|
-
{
|
|
2435
|
-
className: cn("h-4 w-4", {
|
|
2436
|
-
"text-blue-500": item.isActive(editor)
|
|
2437
|
-
})
|
|
2438
|
-
}
|
|
2439
|
-
) })
|
|
2440
|
-
},
|
|
2441
|
-
index
|
|
2442
|
-
)) });
|
|
2443
|
-
};
|
|
2444
|
-
|
|
2445
|
-
// src/ui/novel/tailwind/slash-command.tsx
|
|
2446
|
-
import {
|
|
2447
|
-
CheckSquare as CheckSquare2,
|
|
2448
|
-
Code as Code2,
|
|
2449
|
-
Heading1 as Heading12,
|
|
2450
|
-
Heading2 as Heading22,
|
|
2451
|
-
Heading3 as Heading32,
|
|
2452
|
-
ImageIcon,
|
|
2453
|
-
List,
|
|
2454
|
-
ListOrdered as ListOrdered2,
|
|
2455
|
-
MessageSquarePlus,
|
|
2456
|
-
Text,
|
|
2457
|
-
TextQuote as TextQuote3
|
|
2458
|
-
} from "lucide-react";
|
|
2459
|
-
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
2460
|
-
var suggestionItems = createSuggestionItems([
|
|
2461
|
-
{
|
|
2462
|
-
title: "Send Feedback",
|
|
2463
|
-
description: "Let us know how we can improve.",
|
|
2464
|
-
icon: /* @__PURE__ */ jsx23(MessageSquarePlus, { size: 18 }),
|
|
2465
|
-
command: ({ editor, range }) => {
|
|
2466
|
-
editor.chain().focus().deleteRange(range).run();
|
|
2467
|
-
window.open("/feedback", "_blank");
|
|
2468
|
-
}
|
|
2469
|
-
},
|
|
2470
|
-
{
|
|
2471
|
-
title: "Text",
|
|
2472
|
-
description: "Just start typing with plain text.",
|
|
2473
|
-
searchTerms: ["p", "paragraph"],
|
|
2474
|
-
icon: /* @__PURE__ */ jsx23(Text, { size: 18 }),
|
|
2475
|
-
command: ({ editor, range }) => {
|
|
2476
|
-
editor.chain().focus().deleteRange(range).toggleNode("paragraph", "paragraph").run();
|
|
2477
|
-
}
|
|
2478
|
-
},
|
|
2479
|
-
{
|
|
2480
|
-
title: "To-do List",
|
|
2481
|
-
description: "Track tasks with a to-do list.",
|
|
2482
|
-
searchTerms: ["todo", "task", "list", "check", "checkbox"],
|
|
2483
|
-
icon: /* @__PURE__ */ jsx23(CheckSquare2, { size: 18 }),
|
|
2484
|
-
command: ({ editor, range }) => {
|
|
2485
|
-
editor.chain().focus().deleteRange(range).toggleTaskList().run();
|
|
2486
|
-
}
|
|
2487
|
-
},
|
|
2488
|
-
{
|
|
2489
|
-
title: "Heading 1",
|
|
2490
|
-
description: "Big section heading.",
|
|
2491
|
-
searchTerms: ["title", "big", "large"],
|
|
2492
|
-
icon: /* @__PURE__ */ jsx23(Heading12, { size: 18 }),
|
|
2493
|
-
command: ({ editor, range }) => {
|
|
2494
|
-
editor.chain().focus().deleteRange(range).setNode("heading", { level: 1 }).run();
|
|
2495
|
-
}
|
|
2496
|
-
},
|
|
2497
|
-
{
|
|
2498
|
-
title: "Heading 2",
|
|
2499
|
-
description: "Medium section heading.",
|
|
2500
|
-
searchTerms: ["subtitle", "medium"],
|
|
2501
|
-
icon: /* @__PURE__ */ jsx23(Heading22, { size: 18 }),
|
|
2502
|
-
command: ({ editor, range }) => {
|
|
2503
|
-
editor.chain().focus().deleteRange(range).setNode("heading", { level: 2 }).run();
|
|
2504
|
-
}
|
|
2505
|
-
},
|
|
2506
|
-
{
|
|
2507
|
-
title: "Heading 3",
|
|
2508
|
-
description: "Small section heading.",
|
|
2509
|
-
searchTerms: ["subtitle", "small"],
|
|
2510
|
-
icon: /* @__PURE__ */ jsx23(Heading32, { size: 18 }),
|
|
2511
|
-
command: ({ editor, range }) => {
|
|
2512
|
-
editor.chain().focus().deleteRange(range).setNode("heading", { level: 3 }).run();
|
|
2513
|
-
}
|
|
2514
|
-
},
|
|
2515
|
-
{
|
|
2516
|
-
title: "Bullet List",
|
|
2517
|
-
description: "Create a simple bullet list.",
|
|
2518
|
-
searchTerms: ["unordered", "point"],
|
|
2519
|
-
icon: /* @__PURE__ */ jsx23(List, { size: 18 }),
|
|
2520
|
-
command: ({ editor, range }) => {
|
|
2521
|
-
editor.chain().focus().deleteRange(range).toggleBulletList().run();
|
|
2522
|
-
}
|
|
2523
|
-
},
|
|
2524
|
-
{
|
|
2525
|
-
title: "Numbered List",
|
|
2526
|
-
description: "Create a list with numbering.",
|
|
2527
|
-
searchTerms: ["ordered"],
|
|
2528
|
-
icon: /* @__PURE__ */ jsx23(ListOrdered2, { size: 18 }),
|
|
2529
|
-
command: ({ editor, range }) => {
|
|
2530
|
-
editor.chain().focus().deleteRange(range).toggleOrderedList().run();
|
|
2531
|
-
}
|
|
2532
|
-
},
|
|
2533
|
-
{
|
|
2534
|
-
title: "Quote",
|
|
2535
|
-
description: "Capture a quote.",
|
|
2536
|
-
searchTerms: ["blockquote"],
|
|
2537
|
-
icon: /* @__PURE__ */ jsx23(TextQuote3, { size: 18 }),
|
|
2538
|
-
command: ({ editor, range }) => editor.chain().focus().deleteRange(range).toggleNode("paragraph", "paragraph").toggleBlockquote().run()
|
|
2539
|
-
},
|
|
2540
|
-
{
|
|
2541
|
-
title: "Code",
|
|
2542
|
-
description: "Capture a code snippet.",
|
|
2543
|
-
searchTerms: ["codeblock"],
|
|
2544
|
-
icon: /* @__PURE__ */ jsx23(Code2, { size: 18 }),
|
|
2545
|
-
command: ({ editor, range }) => editor.chain().focus().deleteRange(range).toggleCodeBlock().run()
|
|
2546
|
-
},
|
|
2547
|
-
{
|
|
2548
|
-
title: "Image",
|
|
2549
|
-
description: "Upload an image from your computer.",
|
|
2550
|
-
searchTerms: ["photo", "picture", "media"],
|
|
2551
|
-
icon: /* @__PURE__ */ jsx23(ImageIcon, { size: 18 }),
|
|
2552
|
-
command: ({ editor, range }) => {
|
|
2553
|
-
editor.chain().focus().deleteRange(range).run();
|
|
2554
|
-
const input = document.createElement("input");
|
|
2555
|
-
input.type = "file";
|
|
2556
|
-
input.accept = "image/*";
|
|
2557
|
-
input.onchange = () => __async(void 0, null, function* () {
|
|
2558
|
-
var _a;
|
|
2559
|
-
if ((_a = input.files) == null ? void 0 : _a.length) {
|
|
2560
|
-
const file = input.files[0];
|
|
2561
|
-
const pos = editor.view.state.selection.from;
|
|
2562
|
-
uploadFn(file, editor.view, pos);
|
|
2563
|
-
}
|
|
2564
|
-
});
|
|
2565
|
-
input.click();
|
|
2566
|
-
}
|
|
2567
|
-
}
|
|
2568
|
-
]);
|
|
2569
|
-
var slashCommand = Command2.configure({
|
|
2570
|
-
suggestion: {
|
|
2571
|
-
items: () => suggestionItems,
|
|
2572
|
-
render: renderItems
|
|
2573
|
-
}
|
|
2574
|
-
});
|
|
2575
|
-
|
|
2576
|
-
// src/ui/novel/tailwind/advanced-editor.tsx
|
|
2577
|
-
import { jsx as jsx24, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2578
|
-
var extensions = [...defaultExtensions, slashCommand];
|
|
2579
|
-
var TailwindAdvancedEditor = () => {
|
|
2580
|
-
const [initialContent, setInitialContent] = useState2(
|
|
2581
|
-
null
|
|
2582
|
-
);
|
|
2583
|
-
const [saveStatus, setSaveStatus] = useState2("Saved");
|
|
2584
|
-
const [openNode, setOpenNode] = useState2(false);
|
|
2585
|
-
const [openColor, setOpenColor] = useState2(false);
|
|
2586
|
-
const [openLink, setOpenLink] = useState2(false);
|
|
2587
|
-
const [openAI, setOpenAI] = useState2(false);
|
|
2588
|
-
const debouncedUpdates = useDebouncedCallback(
|
|
2589
|
-
(editor) => __async(void 0, null, function* () {
|
|
2590
|
-
const json = editor.getJSON();
|
|
2591
|
-
window.localStorage.setItem("novel-content", JSON.stringify(json));
|
|
2592
|
-
setSaveStatus("Saved");
|
|
2593
|
-
}),
|
|
2594
|
-
500
|
|
2595
|
-
);
|
|
2596
|
-
useEffect5(() => {
|
|
2597
|
-
const content = window.localStorage.getItem("novel-content");
|
|
2598
|
-
if (content)
|
|
2599
|
-
setInitialContent(JSON.parse(content));
|
|
2600
|
-
else
|
|
2601
|
-
setInitialContent(defaultEditorContent);
|
|
2602
|
-
}, []);
|
|
2603
|
-
if (!initialContent)
|
|
2604
|
-
return null;
|
|
2605
|
-
return /* @__PURE__ */ jsxs14("div", { className: "relative w-full max-w-screen-lg", children: [
|
|
2606
|
-
/* @__PURE__ */ jsx24("div", { className: "bg-accent text-muted-foreground absolute right-5 top-5 z-10 mb-5 rounded-lg px-2 py-1 text-sm", children: saveStatus }),
|
|
2607
|
-
/* @__PURE__ */ jsx24(EditorRoot, { children: /* @__PURE__ */ jsxs14(
|
|
2608
|
-
EditorContent,
|
|
2609
|
-
{
|
|
2610
|
-
initialContent,
|
|
2611
|
-
extensions,
|
|
2612
|
-
className: "border-muted bg-background relative min-h-[500px] w-full max-w-screen-lg sm:mb-[calc(20vh)] sm:rounded-lg sm:border sm:shadow-lg",
|
|
2613
|
-
editorProps: {
|
|
2614
|
-
handleDOMEvents: {
|
|
2615
|
-
keydown: (_view, event) => handleCommandNavigation(event)
|
|
2616
|
-
},
|
|
2617
|
-
handlePaste: (view, event) => handleImagePaste(view, event, uploadFn),
|
|
2618
|
-
handleDrop: (view, event, _slice, moved) => handleImageDrop(view, event, moved, uploadFn),
|
|
2619
|
-
attributes: {
|
|
2620
|
-
class: `prose prose-lg dark:prose-invert prose-headings:font-title font-default focus:outline-none max-w-full`
|
|
2621
|
-
}
|
|
2622
|
-
},
|
|
2623
|
-
onUpdate: ({ editor }) => {
|
|
2624
|
-
debouncedUpdates(editor);
|
|
2625
|
-
setSaveStatus("Unsaved");
|
|
2626
|
-
},
|
|
2627
|
-
slotAfter: /* @__PURE__ */ jsx24(ImageResizer, {}),
|
|
2628
|
-
children: [
|
|
2629
|
-
/* @__PURE__ */ jsxs14(EditorCommand, { className: "border-muted bg-background z-50 h-auto max-h-[330px] overflow-y-auto rounded-md border px-1 py-2 shadow-md transition-all", children: [
|
|
2630
|
-
/* @__PURE__ */ jsx24(EditorCommandEmpty, { className: "text-muted-foreground px-2", children: "No results" }),
|
|
2631
|
-
/* @__PURE__ */ jsx24(EditorCommandList, { children: suggestionItems.map((item) => /* @__PURE__ */ jsxs14(
|
|
2632
|
-
EditorCommandItem,
|
|
2633
|
-
{
|
|
2634
|
-
value: item.title,
|
|
2635
|
-
onCommand: (val) => {
|
|
2636
|
-
item.command && item.command(val);
|
|
2637
|
-
},
|
|
2638
|
-
className: `hover:bg-accent aria-selected:bg-accent flex w-full items-center space-x-2 rounded-md px-2 py-1 text-left text-sm `,
|
|
2639
|
-
children: [
|
|
2640
|
-
/* @__PURE__ */ jsx24("div", { className: "border-muted bg-background flex h-10 w-10 items-center justify-center rounded-md border", children: item.icon }),
|
|
2641
|
-
/* @__PURE__ */ jsxs14("div", { children: [
|
|
2642
|
-
/* @__PURE__ */ jsx24("p", { className: "font-medium", children: item.title }),
|
|
2643
|
-
/* @__PURE__ */ jsx24("p", { className: "text-muted-foreground text-xs", children: item.description })
|
|
2644
|
-
] })
|
|
2645
|
-
]
|
|
2646
|
-
},
|
|
2647
|
-
item.title
|
|
2648
|
-
)) })
|
|
2649
|
-
] }),
|
|
2650
|
-
/* @__PURE__ */ jsxs14(generative_menu_switch_default, { open: openAI, onOpenChange: setOpenAI, children: [
|
|
2651
|
-
/* @__PURE__ */ jsx24(Separator, { orientation: "vertical" }),
|
|
2652
|
-
/* @__PURE__ */ jsx24(NodeSelector, { open: openNode, onOpenChange: setOpenNode }),
|
|
2653
|
-
/* @__PURE__ */ jsx24(Separator, { orientation: "vertical" }),
|
|
2654
|
-
/* @__PURE__ */ jsx24(LinkSelector, { open: openLink, onOpenChange: setOpenLink }),
|
|
2655
|
-
/* @__PURE__ */ jsx24(Separator, { orientation: "vertical" }),
|
|
2656
|
-
/* @__PURE__ */ jsx24(TextButtons, {}),
|
|
2657
|
-
/* @__PURE__ */ jsx24(Separator, { orientation: "vertical" }),
|
|
2658
|
-
/* @__PURE__ */ jsx24(ColorSelector, { open: openColor, onOpenChange: setOpenColor })
|
|
2659
|
-
] })
|
|
2660
|
-
]
|
|
2661
|
-
}
|
|
2662
|
-
) })
|
|
2663
|
-
] });
|
|
2664
|
-
};
|
|
2665
|
-
|
|
2666
1
|
// src/index.tsx
|
|
2667
|
-
import { Fragment
|
|
2
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2668
3
|
var LajiComp = () => {
|
|
2669
|
-
return /* @__PURE__ */
|
|
4
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("button", { children: "laji button" }) });
|
|
2670
5
|
};
|
|
2671
|
-
var NovelEditor = TailwindAdvancedEditor;
|
|
2672
6
|
export {
|
|
2673
|
-
LajiComp
|
|
2674
|
-
NovelEditor
|
|
7
|
+
LajiComp
|
|
2675
8
|
};
|