@collabchron/notiq 0.2.0 → 1.0.0
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/LICENSE +21 -0
- package/README.md +230 -39
- package/dist/CodeActionMenuPlugin-EINOY4U4.mjs +15 -0
- package/dist/DynamicBlockComponent-NRQJ4WW4.mjs +161 -0
- package/dist/EquationComponent-CB6DFIHV.mjs +154 -0
- package/dist/ExcalidrawComponent-XW6646OH.mjs +528 -0
- package/dist/ExcalidrawPlugin-ZFHT62IF.mjs +14 -0
- package/dist/ExportPlugin-V2RLM63S.mjs +11 -0
- package/dist/FloatingLinkEditorPlugin-TRTCMSP4.mjs +12 -0
- package/dist/FloatingTextFormatToolbarPlugin-F2GY6LMI.mjs +30 -0
- package/dist/HintComponet-BRL6EAMS.mjs +217 -0
- package/dist/InlineImageComponent-UWIUWBHI.mjs +453 -0
- package/dist/MobileToolbar-BOOZAMQE.mjs +268 -0
- package/dist/SlashCommand-GMT5JI33.mjs +28 -0
- package/dist/StoryBuilderComponent-JGDBM5JU.mjs +562 -0
- package/{src/components/editor/plugins/TableCellActionMenuPlugin/index.tsx → dist/TableCellActionMenuPlugin-PGK2K3VG.mjs} +667 -759
- package/{src/components/editor/plugins/TableHoverActionsPlugin/index.tsx → dist/TableHoverActionsPlugin-GJVE6VRW.mjs} +258 -314
- package/dist/TemplatePlugin-ZD3QEVTI.mjs +9 -0
- package/dist/ToolbarPlugin-7TOZRD2R.mjs +1547 -0
- package/dist/babel-JZ2EV6AX.mjs +7233 -0
- package/dist/background-color-XZTYLGO2.mjs +362 -0
- package/dist/block-format-YJCV2DIY.mjs +15 -0
- package/dist/chunk-2FNEAMSP.mjs +127 -0
- package/dist/chunk-3CPBODXA.mjs +84 -0
- package/dist/chunk-3G37YKTV.mjs +83 -0
- package/dist/chunk-3JVFG7ER.mjs +184 -0
- package/dist/chunk-456TN7IM.mjs +110 -0
- package/dist/chunk-4EXYCTGJ.mjs +27 -0
- package/{src/utils/getSelectedNode.ts → dist/chunk-4HBCVSE6.mjs} +26 -27
- package/dist/chunk-4MEDW3T6.mjs +125 -0
- package/dist/chunk-4VWFVWYP.mjs +36 -0
- package/dist/chunk-5BAKY5KN.mjs +84 -0
- package/dist/chunk-5QSNIVIG.mjs +333 -0
- package/dist/chunk-64Z3FI7T.mjs +37 -0
- package/{src/components/editor/nodes/Stepper/index.tsx → dist/chunk-6RNZQOH2.mjs} +214 -260
- package/dist/chunk-77KXU36M.mjs +64 -0
- package/dist/chunk-77UA6HYR.mjs +165 -0
- package/dist/chunk-7NZAPJ4G.mjs +102 -0
- package/dist/chunk-7VUMHWWL.mjs +152 -0
- package/dist/chunk-AMMKBSST.mjs +1256 -0
- package/dist/chunk-BIU7WTLX.mjs +95 -0
- package/dist/chunk-EGMI62PP.mjs +83 -0
- package/dist/chunk-EHNQD5KO.mjs +88 -0
- package/dist/chunk-FSM26655.mjs +37 -0
- package/{src/components/editor/nodes/Hint/index.tsx → dist/chunk-G53GLEAY.mjs} +158 -190
- package/dist/chunk-GK35L7UY.mjs +28 -0
- package/dist/chunk-GXYD4VZM.mjs +193 -0
- package/dist/chunk-GYIOYVCN.mjs +538 -0
- package/dist/chunk-GZPNVR7L.mjs +157 -0
- package/dist/chunk-JXDPPUJI.mjs +52 -0
- package/dist/chunk-K36V4SIW.mjs +141 -0
- package/dist/chunk-KJ6AJ44Q.mjs +128 -0
- package/dist/chunk-KJV3FAZ7.mjs +142 -0
- package/{src/components/editor/plugins/ImagesPlugin/index.tsx → dist/chunk-LGG4IUIA.mjs} +189 -222
- package/dist/chunk-LQN3CMKV.mjs +1906 -0
- package/dist/chunk-N3WN46VL.mjs +236 -0
- package/dist/chunk-PBD6LMLC.mjs +366 -0
- package/dist/chunk-POGRR73N.mjs +33 -0
- package/{src/components/editor/utils/editorFormatting.ts → dist/chunk-PZSUSXQG.mjs} +238 -282
- package/dist/chunk-QEIFVK5M.mjs +29 -0
- package/dist/chunk-QHIQKMVN.mjs +427 -0
- package/dist/chunk-TCYK7DM7.mjs +36 -0
- package/dist/chunk-TTHQCW5F.mjs +47 -0
- package/dist/chunk-U47ABU5Z.mjs +53 -0
- package/dist/chunk-WDG7J2DY.mjs +116 -0
- package/dist/chunk-WJRHXI2C.mjs +733 -0
- package/dist/chunk-XLER2DHM.mjs +357 -0
- package/dist/chunk-XWC4TK2N.mjs +315 -0
- package/dist/chunk-YHPNOWFH.mjs +15 -0
- package/dist/chunk-YKC3SO4Z.mjs +32 -0
- package/dist/chunk-YMBXLRW5.mjs +374 -0
- package/dist/chunk-YPHOEJ46.mjs +64 -0
- package/dist/chunk-YUDCJRJM.mjs +25 -0
- package/dist/chunk-Z4EWP7BI.mjs +65 -0
- package/dist/chunk-ZB5LZQKC.mjs +191 -0
- package/dist/chunk-ZJRKATOJ.mjs +65 -0
- package/dist/color-BPKOPQKN.mjs +12 -0
- package/dist/estree-XC56IUFX.mjs +4414 -0
- package/dist/font-FEZ3GKSF.mjs +13 -0
- package/dist/font-size-EK775WRH.mjs +15 -0
- package/dist/html-S3ACX7NI.mjs +2738 -0
- package/dist/image-2PJIAYAT.mjs +993 -0
- package/dist/index.d.mts +145 -0
- package/dist/index.d.ts +145 -0
- package/dist/index.js +57855 -0
- package/dist/index.mjs +1790 -0
- package/dist/insert-gif-SAIDYURE.mjs +100 -0
- package/dist/insert-image-U3RJN3OW.mjs +259 -0
- package/dist/insert-node-5P2CRJ7S.mjs +201 -0
- package/dist/insert-poll-HCPM7MO6.mjs +33 -0
- package/dist/insert-table-24XYUS2W.mjs +66 -0
- package/dist/markdown-SNVBOSRA.mjs +3487 -0
- package/dist/poll-component-2R4MDLHS.mjs +303 -0
- package/dist/postcss-ONF3VDIM.mjs +5051 -0
- package/dist/standalone-EOIALU3M.mjs +2373 -0
- package/dist/stepper-FSARL6X6.mjs +304 -0
- package/dist/styles/notiq.css +1149 -0
- package/dist/text-align-VLECWO4H.mjs +118 -0
- package/dist/text-format-BG5WOOPZ.mjs +16 -0
- package/dist/typescript-AMPI6OVS.mjs +13135 -0
- package/package.json +94 -10
- package/src/styles/notiq.css +1149 -0
- package/src/styles/tailwind-plugin.ts +134 -0
- package/components.json +0 -21
- package/eslint.config.mjs +0 -16
- package/next.config.ts +0 -12
- package/postcss.config.mjs +0 -5
- package/public/file.svg +0 -1
- package/public/globe.svg +0 -1
- package/public/images/icons/plus.svg +0 -10
- package/public/next.svg +0 -1
- package/public/vercel.svg +0 -1
- package/public/window.svg +0 -1
- package/src/app/actions.ts +0 -2
- package/src/app/api/ai/route.ts +0 -175
- package/src/app/api/edgestore/[...edgestore]/route.ts +0 -28
- package/src/app/favicon.ico +0 -0
- package/src/app/globals.css +0 -205
- package/src/app/layout.tsx +0 -38
- package/src/app/page.tsx +0 -12
- package/src/components/editor/Core.tsx +0 -220
- package/src/components/editor/hooks/instructions-messages.ts +0 -300
- package/src/components/editor/hooks/use-mobile.ts +0 -19
- package/src/components/editor/hooks/useReport.ts +0 -67
- package/src/components/editor/hooks/useResizeObservert.ts +0 -22
- package/src/components/editor/index.tsx +0 -39
- package/src/components/editor/lexical-on-change.tsx +0 -28
- package/src/components/editor/nodes/CollapsibleNode/CollapsibleContainerNode.ts +0 -92
- package/src/components/editor/nodes/CollapsibleNode/CollapsibleContentNode.ts +0 -65
- package/src/components/editor/nodes/CollapsibleNode/CollapsibleTitleNode.ts +0 -105
- package/src/components/editor/nodes/EquationNode/EquationComponent.tsx +0 -143
- package/src/components/editor/nodes/EquationNode/EquationNode.tsx +0 -170
- package/src/components/editor/nodes/ExcalidrawNode/ExcalidrawComponent.tsx +0 -228
- package/src/components/editor/nodes/ExcalidrawNode/ExcalidrawImage.tsx +0 -137
- package/src/components/editor/nodes/ExcalidrawNode/ImageResizer.tsx +0 -317
- package/src/components/editor/nodes/ExcalidrawNode/index.tsx +0 -204
- package/src/components/editor/nodes/FigmaNode/FigmaNode.tsx +0 -134
- package/src/components/editor/nodes/Hint/HintComponet.tsx +0 -221
- package/src/components/editor/nodes/ImageNode/index.tsx +0 -328
- package/src/components/editor/nodes/InlineImageNode/InlineImageComponent.tsx +0 -383
- package/src/components/editor/nodes/InlineImageNode/InlineImageNode.css +0 -94
- package/src/components/editor/nodes/InlineImageNode/InlineImageNode.tsx +0 -309
- package/src/components/editor/nodes/LayoutNode/LayoutContainerNode.ts +0 -146
- package/src/components/editor/nodes/LayoutNode/LayoutItemNode.ts +0 -79
- package/src/components/editor/nodes/PollNode/index.tsx +0 -204
- package/src/components/editor/nodes/TweetNode/index.tsx +0 -214
- package/src/components/editor/nodes/index.ts +0 -81
- package/src/components/editor/plugins/AutoEmbedPlugin/index.tsx +0 -350
- package/src/components/editor/plugins/AutoLinkPlugin/index.tsx +0 -56
- package/src/components/editor/plugins/CodeActionMenuPlugin/components/CopyButton.tsx +0 -70
- package/src/components/editor/plugins/CodeActionMenuPlugin/components/PrettierButton.tsx +0 -192
- package/src/components/editor/plugins/CodeActionMenuPlugin/index.tsx +0 -217
- package/src/components/editor/plugins/CodeActionMenuPlugin/utils.ts +0 -26
- package/src/components/editor/plugins/CodeHighlightPlugin/index.ts +0 -21
- package/src/components/editor/plugins/CollapsiblePlugin/Collapsible.css +0 -76
- package/src/components/editor/plugins/CollapsiblePlugin/index.ts +0 -228
- package/src/components/editor/plugins/DragDropPastePlugin/index.tsx +0 -44
- package/src/components/editor/plugins/DraggableBlockPlugin/index.tsx +0 -52
- package/src/components/editor/plugins/EquationsPlugin/index.tsx +0 -85
- package/src/components/editor/plugins/ExcalidrawPlugin/index.tsx +0 -98
- package/src/components/editor/plugins/FigmaPlugin/index.tsx +0 -42
- package/src/components/editor/plugins/FloatingLinkEditorPlugin/index.tsx +0 -445
- package/src/components/editor/plugins/FloatingTextFormatToolbarPlugin/index.tsx +0 -275
- package/src/components/editor/plugins/InlineImagePlugin/index.tsx +0 -351
- package/src/components/editor/plugins/LayoutPlugin/index.tsx +0 -238
- package/src/components/editor/plugins/LinkPlugin/index.tsx +0 -36
- package/src/components/editor/plugins/LinkWithMetaData/index.tsx +0 -271
- package/src/components/editor/plugins/MarkdownShortcutPlugin/index.tsx +0 -11
- package/src/components/editor/plugins/MarkdownTransformers/index.tsx +0 -304
- package/src/components/editor/plugins/PollPlugin/index.tsx +0 -49
- package/src/components/editor/plugins/ShortcutsPlugin/index.tsx +0 -180
- package/src/components/editor/plugins/ShortcutsPlugin/shortcuts.ts +0 -253
- package/src/components/editor/plugins/SlashCommand/index.tsx +0 -621
- package/src/components/editor/plugins/SpeechToTextPlugin/index.ts +0 -127
- package/src/components/editor/plugins/TabFocusPlugin/index.ts +0 -58
- package/src/components/editor/plugins/TableCellResizer/index.tsx +0 -438
- package/src/components/editor/plugins/TablePlugin/index.tsx +0 -99
- package/src/components/editor/plugins/ToolbarPlugin/index.tsx +0 -522
- package/src/components/editor/plugins/TwitterPlugin/index.ts +0 -35
- package/src/components/editor/plugins/YouTubeNode/index.tsx +0 -179
- package/src/components/editor/plugins/YouTubePlugin/index.ts +0 -41
- package/src/components/editor/themes/editor-theme.ts +0 -113
- package/src/components/editor/themes/theme.css +0 -377
- package/src/components/editor/utils/ai.ts +0 -291
- package/src/components/editor/utils/canUseDOM.ts +0 -12
- package/src/components/editor/utils/environment.ts +0 -50
- package/src/components/editor/utils/extract-data.ts +0 -166
- package/src/components/editor/utils/getAllLexicalChildren.ts +0 -13
- package/src/components/editor/utils/getDOMRangeRect.ts +0 -27
- package/src/components/editor/utils/getSelectedNode.ts +0 -27
- package/src/components/editor/utils/gif.ts +0 -29
- package/src/components/editor/utils/invariant.ts +0 -15
- package/src/components/editor/utils/setFloatingElemPosition.ts +0 -51
- package/src/components/editor/utils/setFloatingElemPositionForLinkEditor.ts +0 -40
- package/src/components/editor/utils/setNodePlaceholderFromSelection/getNodePlaceholder.ts +0 -51
- package/src/components/editor/utils/setNodePlaceholderFromSelection/setNodePlaceholderFromSelection.ts +0 -15
- package/src/components/editor/utils/setNodePlaceholderFromSelection/setPlaceholderOnSelection.ts +0 -114
- package/src/components/editor/utils/setNodePlaceholderFromSelection/styles.css +0 -6
- package/src/components/editor/utils/url.ts +0 -109
- package/src/components/editor/utils/useLayoutEffect.ts +0 -13
- package/src/components/providers/QueryProvider.tsx +0 -15
- package/src/components/providers/SharedHistoryContext.tsx +0 -28
- package/src/components/providers/ToolbarContext.tsx +0 -123
- package/src/components/providers/theme-provider.tsx +0 -11
- package/src/components/theme/ModeToggle.tsx +0 -40
- package/src/components/ui/FileInput.tsx +0 -40
- package/src/components/ui/Input.css +0 -32
- package/src/components/ui/Select.css +0 -42
- package/src/components/ui/Select.tsx +0 -36
- package/src/components/ui/TextInput.tsx +0 -48
- package/src/components/ui/ai/ai-button.tsx +0 -574
- package/src/components/ui/ai/border.tsx +0 -99
- package/src/components/ui/ai/placeholder-input-vanish.tsx +0 -282
- package/src/components/ui/button.tsx +0 -89
- package/src/components/ui/card.tsx +0 -76
- package/src/components/ui/checkbox.tsx +0 -30
- package/src/components/ui/command.tsx +0 -153
- package/src/components/ui/dialog/Dialog.css +0 -25
- package/src/components/ui/dialog/Dialog.tsx +0 -34
- package/src/components/ui/dialog.tsx +0 -122
- package/src/components/ui/drop-downs/background-color.tsx +0 -183
- package/src/components/ui/drop-downs/block-format.tsx +0 -159
- package/src/components/ui/drop-downs/code.tsx +0 -42
- package/src/components/ui/drop-downs/color.tsx +0 -177
- package/src/components/ui/drop-downs/font-size.tsx +0 -138
- package/src/components/ui/drop-downs/font.tsx +0 -155
- package/src/components/ui/drop-downs/index.tsx +0 -122
- package/src/components/ui/drop-downs/insert-node.tsx +0 -213
- package/src/components/ui/drop-downs/text-align.tsx +0 -123
- package/src/components/ui/drop-downs/text-format.tsx +0 -104
- package/src/components/ui/dropdown-menu.tsx +0 -201
- package/src/components/ui/equation/EquationEditor.css +0 -38
- package/src/components/ui/equation/EquationEditor.tsx +0 -56
- package/src/components/ui/equation/KatexEquationAlterer.css +0 -41
- package/src/components/ui/equation/KatexEquationAlterer.tsx +0 -83
- package/src/components/ui/equation/KatexRenderer.tsx +0 -66
- package/src/components/ui/excalidraw/ExcalidrawModal.css +0 -64
- package/src/components/ui/excalidraw/ExcalidrawModal.tsx +0 -234
- package/src/components/ui/excalidraw/Modal.css +0 -62
- package/src/components/ui/excalidraw/Modal.tsx +0 -110
- package/src/components/ui/hover-card.tsx +0 -29
- package/src/components/ui/image/error-image.tsx +0 -17
- package/src/components/ui/image/file-upload.tsx +0 -240
- package/src/components/ui/image/image-resizer.tsx +0 -297
- package/src/components/ui/image/image-toolbar.tsx +0 -264
- package/src/components/ui/image/index.tsx +0 -408
- package/src/components/ui/image/lazy-image.tsx +0 -68
- package/src/components/ui/image/lazy-video.tsx +0 -71
- package/src/components/ui/input.tsx +0 -22
- package/src/components/ui/models/custom-dialog.tsx +0 -320
- package/src/components/ui/models/insert-gif.tsx +0 -90
- package/src/components/ui/models/insert-image.tsx +0 -52
- package/src/components/ui/models/insert-poll.tsx +0 -29
- package/src/components/ui/models/insert-table.tsx +0 -62
- package/src/components/ui/models/use-model.tsx +0 -91
- package/src/components/ui/poll/poll-component.tsx +0 -304
- package/src/components/ui/popover.tsx +0 -33
- package/src/components/ui/progress.tsx +0 -28
- package/src/components/ui/scroll-area.tsx +0 -48
- package/src/components/ui/separator.tsx +0 -31
- package/src/components/ui/skeleton.tsx +0 -15
- package/src/components/ui/sonner.tsx +0 -31
- package/src/components/ui/stepper/step.tsx +0 -179
- package/src/components/ui/stepper/stepper.tsx +0 -89
- package/src/components/ui/textarea.tsx +0 -22
- package/src/components/ui/toggle.tsx +0 -71
- package/src/components/ui/tooltip.tsx +0 -32
- package/src/components/ui/write/text-format-floting-toolbar.tsx +0 -346
- package/src/lib/edgestore.ts +0 -9
- package/src/lib/pinecone-client.ts +0 -0
- package/src/lib/utils.ts +0 -6
- package/src/utils/docSerialization.ts +0 -77
- package/src/utils/emoji-list.ts +0 -16615
- package/src/utils/getDOMRangeRect.ts +0 -27
- package/src/utils/getThemeSelector.ts +0 -25
- package/src/utils/isMobileWidth.ts +0 -7
- package/src/utils/joinClasses.ts +0 -13
- package/src/utils/setFloatingElemPosition.ts +0 -74
- package/src/utils/setFloatingElemPositionForLinkEditor.ts +0 -46
- package/src/utils/swipe.ts +0 -127
- package/src/utils/url.ts +0 -38
- package/tsconfig.json +0 -27
|
@@ -0,0 +1,562 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
Label,
|
|
4
|
+
Tabs,
|
|
5
|
+
TabsList,
|
|
6
|
+
TabsTrigger
|
|
7
|
+
} from "./chunk-3CPBODXA.mjs";
|
|
8
|
+
import {
|
|
9
|
+
$isStoryBuilderNode
|
|
10
|
+
} from "./chunk-4MEDW3T6.mjs";
|
|
11
|
+
import {
|
|
12
|
+
Badge
|
|
13
|
+
} from "./chunk-FSM26655.mjs";
|
|
14
|
+
import {
|
|
15
|
+
Card,
|
|
16
|
+
CardContent,
|
|
17
|
+
CardHeader,
|
|
18
|
+
CardTitle
|
|
19
|
+
} from "./chunk-3G37YKTV.mjs";
|
|
20
|
+
import {
|
|
21
|
+
Input
|
|
22
|
+
} from "./chunk-POGRR73N.mjs";
|
|
23
|
+
import {
|
|
24
|
+
Dialog,
|
|
25
|
+
DialogContent,
|
|
26
|
+
DialogHeader,
|
|
27
|
+
DialogTitle
|
|
28
|
+
} from "./chunk-WDG7J2DY.mjs";
|
|
29
|
+
import {
|
|
30
|
+
Button
|
|
31
|
+
} from "./chunk-BIU7WTLX.mjs";
|
|
32
|
+
import {
|
|
33
|
+
cn
|
|
34
|
+
} from "./chunk-YHPNOWFH.mjs";
|
|
35
|
+
import {
|
|
36
|
+
__objRest,
|
|
37
|
+
__spreadProps,
|
|
38
|
+
__spreadValues,
|
|
39
|
+
init_react_shim
|
|
40
|
+
} from "./chunk-77KXU36M.mjs";
|
|
41
|
+
|
|
42
|
+
// src/components/editor/nodes/StoryBuilderNode/StoryBuilderComponent.tsx
|
|
43
|
+
init_react_shim();
|
|
44
|
+
import React2, { useState, useCallback, useRef } from "react";
|
|
45
|
+
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
46
|
+
import { $getNodeByKey } from "lexical";
|
|
47
|
+
|
|
48
|
+
// src/components/ui/textarea.tsx
|
|
49
|
+
init_react_shim();
|
|
50
|
+
import * as React from "react";
|
|
51
|
+
var Textarea = React.forwardRef((_a, ref) => {
|
|
52
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
53
|
+
return /* @__PURE__ */ React.createElement(
|
|
54
|
+
"textarea",
|
|
55
|
+
__spreadValues({
|
|
56
|
+
className: cn(
|
|
57
|
+
"flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
58
|
+
className
|
|
59
|
+
),
|
|
60
|
+
ref
|
|
61
|
+
}, props)
|
|
62
|
+
);
|
|
63
|
+
});
|
|
64
|
+
Textarea.displayName = "Textarea";
|
|
65
|
+
|
|
66
|
+
// src/components/editor/nodes/StoryBuilderNode/StoryBuilderComponent.tsx
|
|
67
|
+
import {
|
|
68
|
+
Plus,
|
|
69
|
+
Play,
|
|
70
|
+
Edit3,
|
|
71
|
+
Trash2,
|
|
72
|
+
ArrowRight,
|
|
73
|
+
BookOpen,
|
|
74
|
+
GitBranch,
|
|
75
|
+
Upload,
|
|
76
|
+
Settings,
|
|
77
|
+
Copy,
|
|
78
|
+
Save,
|
|
79
|
+
Share2,
|
|
80
|
+
MapPin,
|
|
81
|
+
Timer,
|
|
82
|
+
Users,
|
|
83
|
+
Target
|
|
84
|
+
} from "lucide-react";
|
|
85
|
+
function StoryBuilderComponent({ nodes, currentNodeId, title, nodeKey }) {
|
|
86
|
+
const [editor] = useLexicalComposerContext();
|
|
87
|
+
const [isPreviewMode, setIsPreviewMode] = useState(false);
|
|
88
|
+
const [previewNodeId, setPreviewNodeId] = useState("");
|
|
89
|
+
const [editingNode, setEditingNode] = useState(null);
|
|
90
|
+
const [storyTitle, setStoryTitle] = useState(title);
|
|
91
|
+
const [showAdvancedEditor, setShowAdvancedEditor] = useState(false);
|
|
92
|
+
const [selectedImage, setSelectedImage] = useState(null);
|
|
93
|
+
const [viewMode, setViewMode] = useState("grid");
|
|
94
|
+
const fileInputRef = useRef(null);
|
|
95
|
+
const moodColors = {
|
|
96
|
+
neutral: { bg: "bg-gray-50", border: "border-gray-200", text: "text-gray-900" },
|
|
97
|
+
happy: { bg: "bg-yellow-50", border: "border-yellow-200", text: "text-yellow-900" },
|
|
98
|
+
sad: { bg: "bg-blue-50", border: "border-blue-200", text: "text-blue-900" },
|
|
99
|
+
mysterious: { bg: "bg-purple-50", border: "border-purple-200", text: "text-purple-900" },
|
|
100
|
+
exciting: { bg: "bg-orange-50", border: "border-orange-200", text: "text-orange-900" },
|
|
101
|
+
dark: { bg: "bg-slate-50", border: "border-slate-200", text: "text-slate-900" }
|
|
102
|
+
};
|
|
103
|
+
const initializeStory = useCallback(() => {
|
|
104
|
+
if (nodes.length === 0) {
|
|
105
|
+
const startNode = {
|
|
106
|
+
id: "start",
|
|
107
|
+
title: "The Beginning",
|
|
108
|
+
content: "Your epic adventure begins here. The world awaits your decisions...",
|
|
109
|
+
choices: [{
|
|
110
|
+
id: "choice1",
|
|
111
|
+
text: "Begin the adventure",
|
|
112
|
+
targetId: "node1",
|
|
113
|
+
consequence: "You step into the unknown",
|
|
114
|
+
icon: "\u{1F680}"
|
|
115
|
+
}],
|
|
116
|
+
isStart: true,
|
|
117
|
+
mood: "exciting",
|
|
118
|
+
estimatedReadTime: 1,
|
|
119
|
+
tags: ["beginning", "adventure"]
|
|
120
|
+
};
|
|
121
|
+
const secondNode = {
|
|
122
|
+
id: "node1",
|
|
123
|
+
title: "Chapter 1: The Journey",
|
|
124
|
+
content: "The adventure continues as you face your first challenge...",
|
|
125
|
+
choices: [],
|
|
126
|
+
isEnd: true,
|
|
127
|
+
mood: "neutral",
|
|
128
|
+
estimatedReadTime: 2,
|
|
129
|
+
tags: ["chapter1", "challenge"]
|
|
130
|
+
};
|
|
131
|
+
updateStoryBuilder({
|
|
132
|
+
nodes: [startNode, secondNode],
|
|
133
|
+
currentNodeId: "start",
|
|
134
|
+
title: storyTitle
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}, [nodes.length, storyTitle]);
|
|
138
|
+
const updateStoryBuilder = useCallback(
|
|
139
|
+
(payload) => {
|
|
140
|
+
editor.update(() => {
|
|
141
|
+
const node = $getNodeByKey(nodeKey);
|
|
142
|
+
if ($isStoryBuilderNode(node)) {
|
|
143
|
+
node.updateStory(payload);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
},
|
|
147
|
+
[editor, nodeKey]
|
|
148
|
+
);
|
|
149
|
+
const addNewNode = useCallback(() => {
|
|
150
|
+
const newNodeId = `node_${Date.now()}`;
|
|
151
|
+
const newNode = {
|
|
152
|
+
id: newNodeId,
|
|
153
|
+
title: "New Chapter",
|
|
154
|
+
content: "Write your story content here...",
|
|
155
|
+
choices: [],
|
|
156
|
+
mood: "neutral",
|
|
157
|
+
estimatedReadTime: 1,
|
|
158
|
+
tags: []
|
|
159
|
+
};
|
|
160
|
+
updateStoryBuilder({
|
|
161
|
+
nodes: [...nodes, newNode],
|
|
162
|
+
currentNodeId,
|
|
163
|
+
title: storyTitle
|
|
164
|
+
});
|
|
165
|
+
}, [nodes, currentNodeId, storyTitle, updateStoryBuilder]);
|
|
166
|
+
const updateNode = useCallback(
|
|
167
|
+
(nodeId, updates) => {
|
|
168
|
+
const updatedNodes = nodes.map((node) => node.id === nodeId ? __spreadValues(__spreadValues({}, node), updates) : node);
|
|
169
|
+
updateStoryBuilder({
|
|
170
|
+
nodes: updatedNodes,
|
|
171
|
+
currentNodeId,
|
|
172
|
+
title: storyTitle
|
|
173
|
+
});
|
|
174
|
+
},
|
|
175
|
+
[nodes, currentNodeId, storyTitle, updateStoryBuilder]
|
|
176
|
+
);
|
|
177
|
+
const deleteNode = useCallback(
|
|
178
|
+
(nodeId) => {
|
|
179
|
+
var _a;
|
|
180
|
+
const filteredNodes = nodes.filter((node) => node.id !== nodeId);
|
|
181
|
+
const cleanedNodes = filteredNodes.map((node) => __spreadProps(__spreadValues({}, node), {
|
|
182
|
+
choices: node.choices.filter((choice) => choice.targetId !== nodeId)
|
|
183
|
+
}));
|
|
184
|
+
updateStoryBuilder({
|
|
185
|
+
nodes: cleanedNodes,
|
|
186
|
+
currentNodeId: currentNodeId === nodeId ? ((_a = cleanedNodes[0]) == null ? void 0 : _a.id) || "" : currentNodeId,
|
|
187
|
+
title: storyTitle
|
|
188
|
+
});
|
|
189
|
+
},
|
|
190
|
+
[nodes, currentNodeId, storyTitle, updateStoryBuilder]
|
|
191
|
+
);
|
|
192
|
+
const addChoice = useCallback(
|
|
193
|
+
(nodeId) => {
|
|
194
|
+
const node = nodes.find((n) => n.id === nodeId);
|
|
195
|
+
if (!node) return;
|
|
196
|
+
const newChoice = {
|
|
197
|
+
id: `choice_${Date.now()}`,
|
|
198
|
+
text: "New choice",
|
|
199
|
+
targetId: "",
|
|
200
|
+
consequence: "Something happens...",
|
|
201
|
+
probabilityWeight: 1,
|
|
202
|
+
icon: "\u2B50"
|
|
203
|
+
};
|
|
204
|
+
updateNode(nodeId, {
|
|
205
|
+
choices: [...node.choices, newChoice]
|
|
206
|
+
});
|
|
207
|
+
},
|
|
208
|
+
[nodes, updateNode]
|
|
209
|
+
);
|
|
210
|
+
const updateChoice = useCallback(
|
|
211
|
+
(nodeId, choiceId, updates) => {
|
|
212
|
+
const node = nodes.find((n) => n.id === nodeId);
|
|
213
|
+
if (!node) return;
|
|
214
|
+
const updatedChoices = node.choices.map((choice) => choice.id === choiceId ? __spreadValues(__spreadValues({}, choice), updates) : choice);
|
|
215
|
+
updateNode(nodeId, { choices: updatedChoices });
|
|
216
|
+
},
|
|
217
|
+
[nodes, updateNode]
|
|
218
|
+
);
|
|
219
|
+
const deleteChoice = useCallback(
|
|
220
|
+
(nodeId, choiceId) => {
|
|
221
|
+
const node = nodes.find((n) => n.id === nodeId);
|
|
222
|
+
if (!node) return;
|
|
223
|
+
const filteredChoices = node.choices.filter((choice) => choice.id !== choiceId);
|
|
224
|
+
updateNode(nodeId, { choices: filteredChoices });
|
|
225
|
+
},
|
|
226
|
+
[nodes, updateNode]
|
|
227
|
+
);
|
|
228
|
+
const handleImageUpload = useCallback((nodeId, file) => {
|
|
229
|
+
const reader = new FileReader();
|
|
230
|
+
reader.onload = (e) => {
|
|
231
|
+
var _a;
|
|
232
|
+
const imageData = (_a = e.target) == null ? void 0 : _a.result;
|
|
233
|
+
updateNode(nodeId, { image: imageData });
|
|
234
|
+
};
|
|
235
|
+
reader.readAsDataURL(file);
|
|
236
|
+
}, [updateNode]);
|
|
237
|
+
const duplicateNode = useCallback((nodeId) => {
|
|
238
|
+
const node = nodes.find((n) => n.id === nodeId);
|
|
239
|
+
if (!node) return;
|
|
240
|
+
const newNodeId = `node_${Date.now()}`;
|
|
241
|
+
const duplicatedNode = __spreadProps(__spreadValues({}, node), {
|
|
242
|
+
id: newNodeId,
|
|
243
|
+
title: `${node.title} (Copy)`,
|
|
244
|
+
choices: node.choices.map((choice) => __spreadProps(__spreadValues({}, choice), {
|
|
245
|
+
id: `choice_${Date.now()}_${Math.random()}`
|
|
246
|
+
}))
|
|
247
|
+
});
|
|
248
|
+
updateStoryBuilder({
|
|
249
|
+
nodes: [...nodes, duplicatedNode],
|
|
250
|
+
currentNodeId,
|
|
251
|
+
title: storyTitle
|
|
252
|
+
});
|
|
253
|
+
}, [nodes, currentNodeId, storyTitle, updateStoryBuilder]);
|
|
254
|
+
const exportStory = useCallback(() => {
|
|
255
|
+
const storyData = {
|
|
256
|
+
title: storyTitle,
|
|
257
|
+
nodes,
|
|
258
|
+
metadata: {
|
|
259
|
+
totalNodes: nodes.length,
|
|
260
|
+
totalChoices: nodes.reduce((sum, node) => sum + node.choices.length, 0),
|
|
261
|
+
estimatedTotalReadTime: nodes.reduce((sum, node) => sum + (node.estimatedReadTime || 1), 0),
|
|
262
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
const blob = new Blob([JSON.stringify(storyData, null, 2)], { type: "application/json" });
|
|
266
|
+
const url = URL.createObjectURL(blob);
|
|
267
|
+
const a = document.createElement("a");
|
|
268
|
+
a.href = url;
|
|
269
|
+
a.download = `${storyTitle.replace(/\s+/g, "_")}_story.json`;
|
|
270
|
+
a.click();
|
|
271
|
+
URL.revokeObjectURL(url);
|
|
272
|
+
}, [storyTitle, nodes]);
|
|
273
|
+
React2.useEffect(() => {
|
|
274
|
+
initializeStory();
|
|
275
|
+
}, [initializeStory]);
|
|
276
|
+
const currentPreviewNode = nodes.find((n) => n.id === previewNodeId);
|
|
277
|
+
if (isPreviewMode) {
|
|
278
|
+
const nodeMood = (currentPreviewNode == null ? void 0 : currentPreviewNode.mood) || "neutral";
|
|
279
|
+
const moodStyle = moodColors[nodeMood];
|
|
280
|
+
return /* @__PURE__ */ React2.createElement(Card, { className: "w-full max-w-5xl mx-auto my-6 shadow-2xl border-0 overflow-hidden" }, /* @__PURE__ */ React2.createElement("div", { className: cn("relative", moodStyle.bg) }, (currentPreviewNode == null ? void 0 : currentPreviewNode.image) && /* @__PURE__ */ React2.createElement("div", { className: "relative h-64 w-full" }, /* @__PURE__ */ React2.createElement(
|
|
281
|
+
"img",
|
|
282
|
+
{
|
|
283
|
+
src: currentPreviewNode.image,
|
|
284
|
+
alt: currentPreviewNode.title,
|
|
285
|
+
className: "w-full h-full object-cover"
|
|
286
|
+
}
|
|
287
|
+
), /* @__PURE__ */ React2.createElement("div", { className: "absolute inset-0 bg-gradient-to-t from-black/50 to-transparent" })), /* @__PURE__ */ React2.createElement(CardHeader, { className: "relative" }, /* @__PURE__ */ React2.createElement("div", { className: "flex items-center justify-between" }, /* @__PURE__ */ React2.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ React2.createElement("div", { className: "p-3 bg-white/20 backdrop-blur-sm rounded-xl" }, /* @__PURE__ */ React2.createElement(Play, { className: "w-6 h-6 text-accent" })), /* @__PURE__ */ React2.createElement("div", null, /* @__PURE__ */ React2.createElement(CardTitle, { className: "text-2xl font-bold bg-gradient-to-r from-accent to-accent/70 bg-clip-text text-transparent" }, storyTitle), /* @__PURE__ */ React2.createElement("p", { className: "text-sm text-muted-foreground flex items-center gap-2 mt-1" }, /* @__PURE__ */ React2.createElement(Timer, { className: "w-4 h-4" }), (currentPreviewNode == null ? void 0 : currentPreviewNode.estimatedReadTime) || 1, " min read"))), /* @__PURE__ */ React2.createElement(Button, { variant: "outline", size: "sm", onClick: () => setIsPreviewMode(false), className: "backdrop-blur-sm bg-white/20" }, /* @__PURE__ */ React2.createElement(Edit3, { className: "w-4 h-4 mr-2" }), "Edit Story")))), /* @__PURE__ */ React2.createElement(CardContent, { className: "p-8" }, currentPreviewNode ? /* @__PURE__ */ React2.createElement("div", { className: "space-y-6" }, /* @__PURE__ */ React2.createElement("div", { className: "prose prose-xl max-w-none" }, /* @__PURE__ */ React2.createElement("h2", { className: "text-3xl font-bold mb-6 text-foreground" }, currentPreviewNode.title), /* @__PURE__ */ React2.createElement("div", { className: "text-lg leading-relaxed text-muted-foreground whitespace-pre-wrap" }, currentPreviewNode.content)), currentPreviewNode.tags && currentPreviewNode.tags.length > 0 && /* @__PURE__ */ React2.createElement("div", { className: "flex flex-wrap gap-2" }, currentPreviewNode.tags.map((tag, index) => /* @__PURE__ */ React2.createElement(Badge, { key: index, variant: "secondary", className: "text-xs" }, "#", tag))), currentPreviewNode.choices.length > 0 && /* @__PURE__ */ React2.createElement("div", { className: "space-y-4 mt-8" }, /* @__PURE__ */ React2.createElement("h3", { className: "font-bold text-xl flex items-center gap-2" }, /* @__PURE__ */ React2.createElement(Target, { className: "w-5 h-5 text-accent" }), "What's your next move?"), /* @__PURE__ */ React2.createElement("div", { className: "grid gap-3" }, currentPreviewNode.choices.map((choice, index) => /* @__PURE__ */ React2.createElement(
|
|
288
|
+
Button,
|
|
289
|
+
{
|
|
290
|
+
key: choice.id,
|
|
291
|
+
variant: "outline",
|
|
292
|
+
className: cn(
|
|
293
|
+
"w-full justify-start text-left h-auto p-6 group transition-all duration-300",
|
|
294
|
+
"hover:shadow-lg hover:scale-[1.02] hover:border-accent/50 hover:bg-accent/5",
|
|
295
|
+
"border-2 border-border/30"
|
|
296
|
+
),
|
|
297
|
+
onClick: () => setPreviewNodeId(choice.targetId),
|
|
298
|
+
disabled: !choice.targetId
|
|
299
|
+
},
|
|
300
|
+
/* @__PURE__ */ React2.createElement("div", { className: "flex items-start gap-4 w-full" }, /* @__PURE__ */ React2.createElement("div", { className: "text-2xl" }, choice.icon || "\u27A4"), /* @__PURE__ */ React2.createElement("div", { className: "flex-1" }, /* @__PURE__ */ React2.createElement("div", { className: "font-semibold text-base group-hover:text-accent transition-colors" }, choice.text), choice.consequence && /* @__PURE__ */ React2.createElement("p", { className: "text-sm text-muted-foreground mt-1 italic" }, "\u2192 ", choice.consequence)), /* @__PURE__ */ React2.createElement(ArrowRight, { className: "w-5 h-5 opacity-0 group-hover:opacity-100 transition-opacity text-accent" }))
|
|
301
|
+
)))), currentPreviewNode.isEnd && /* @__PURE__ */ React2.createElement("div", { className: "text-center py-8 bg-gradient-to-r from-accent/10 to-secondary/10 rounded-2xl" }, /* @__PURE__ */ React2.createElement("div", { className: "text-6xl mb-4" }, "\u{1F3AD}"), /* @__PURE__ */ React2.createElement(Badge, { variant: "secondary", className: "text-lg px-6 py-3 rounded-full" }, "The End"), /* @__PURE__ */ React2.createElement("p", { className: "text-muted-foreground mt-4" }, "Thank you for experiencing this story!"))) : /* @__PURE__ */ React2.createElement("div", { className: "text-center py-12" }, /* @__PURE__ */ React2.createElement("div", { className: "text-8xl mb-6" }, "\u{1F4D6}"), /* @__PURE__ */ React2.createElement("h3", { className: "text-2xl font-bold mb-4" }, "Ready to Begin?"), /* @__PURE__ */ React2.createElement("p", { className: "text-muted-foreground mb-8 text-lg" }, "Select a starting point to experience the story"), /* @__PURE__ */ React2.createElement(
|
|
302
|
+
Button,
|
|
303
|
+
{
|
|
304
|
+
size: "lg",
|
|
305
|
+
className: "px-8 py-4 text-lg",
|
|
306
|
+
onClick: () => {
|
|
307
|
+
const startNode = nodes.find((n) => n.isStart) || nodes[0];
|
|
308
|
+
if (startNode) setPreviewNodeId(startNode.id);
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
/* @__PURE__ */ React2.createElement(Play, { className: "w-5 h-5 mr-2" }),
|
|
312
|
+
"Start Adventure"
|
|
313
|
+
))));
|
|
314
|
+
}
|
|
315
|
+
return /* @__PURE__ */ React2.createElement("div", { className: "w-full max-w-7xl mx-auto my-6" }, /* @__PURE__ */ React2.createElement(Card, { className: "shadow-2xl border-0 overflow-hidden" }, /* @__PURE__ */ React2.createElement(CardHeader, { className: "bg-gradient-to-br from-accent/20 via-accent/10 to-secondary/10 border-b" }, /* @__PURE__ */ React2.createElement("div", { className: "flex items-center justify-between" }, /* @__PURE__ */ React2.createElement("div", { className: "flex items-center gap-4" }, /* @__PURE__ */ React2.createElement("div", { className: "p-3 bg-accent/20 rounded-2xl backdrop-blur-sm" }, /* @__PURE__ */ React2.createElement(GitBranch, { className: "w-8 h-8 text-accent" })), /* @__PURE__ */ React2.createElement("div", { className: "space-y-1" }, /* @__PURE__ */ React2.createElement(
|
|
316
|
+
Input,
|
|
317
|
+
{
|
|
318
|
+
value: storyTitle,
|
|
319
|
+
onChange: (e) => setStoryTitle(e.target.value),
|
|
320
|
+
onBlur: () => updateStoryBuilder({ nodes, currentNodeId, title: storyTitle }),
|
|
321
|
+
className: "text-2xl font-bold bg-transparent border-none p-0 h-auto focus-visible:ring-0 text-foreground",
|
|
322
|
+
placeholder: "Enter your story title..."
|
|
323
|
+
}
|
|
324
|
+
), /* @__PURE__ */ React2.createElement("div", { className: "flex items-center gap-4 text-sm text-muted-foreground" }, /* @__PURE__ */ React2.createElement("span", { className: "flex items-center gap-1" }, /* @__PURE__ */ React2.createElement(BookOpen, { className: "w-4 h-4" }), "Interactive Story Builder"), /* @__PURE__ */ React2.createElement("span", { className: "flex items-center gap-1" }, /* @__PURE__ */ React2.createElement(MapPin, { className: "w-4 h-4" }), nodes.length, " Chapters"), /* @__PURE__ */ React2.createElement("span", { className: "flex items-center gap-1" }, /* @__PURE__ */ React2.createElement(Timer, { className: "w-4 h-4" }), "~", nodes.reduce((sum, node) => sum + (node.estimatedReadTime || 1), 0), " min")))), /* @__PURE__ */ React2.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React2.createElement(Tabs, { value: viewMode, onValueChange: (v) => setViewMode(v), className: "mr-4" }, /* @__PURE__ */ React2.createElement(TabsList, { className: "bg-white/50 backdrop-blur-sm" }, /* @__PURE__ */ React2.createElement(TabsTrigger, { value: "grid" }, "Grid"), /* @__PURE__ */ React2.createElement(TabsTrigger, { value: "list" }, "List"))), /* @__PURE__ */ React2.createElement(Button, { variant: "outline", size: "sm", onClick: exportStory }, /* @__PURE__ */ React2.createElement(Save, { className: "w-4 h-4 mr-2" }), "Export"), /* @__PURE__ */ React2.createElement(
|
|
325
|
+
Button,
|
|
326
|
+
{
|
|
327
|
+
variant: "outline",
|
|
328
|
+
size: "sm",
|
|
329
|
+
onClick: () => {
|
|
330
|
+
const startNode = nodes.find((n) => n.isStart) || nodes[0];
|
|
331
|
+
if (startNode) {
|
|
332
|
+
setPreviewNodeId(startNode.id);
|
|
333
|
+
setIsPreviewMode(true);
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
disabled: nodes.length === 0,
|
|
337
|
+
className: "bg-accent/10 border-accent/30 hover:bg-accent/20"
|
|
338
|
+
},
|
|
339
|
+
/* @__PURE__ */ React2.createElement(Play, { className: "w-4 h-4 mr-2" }),
|
|
340
|
+
"Preview"
|
|
341
|
+
), /* @__PURE__ */ React2.createElement(Button, { size: "sm", onClick: addNewNode, className: "bg-accent hover:bg-accent/90" }, /* @__PURE__ */ React2.createElement(Plus, { className: "w-4 h-4 mr-2" }), "Add Chapter")))), /* @__PURE__ */ React2.createElement(CardContent, { className: "p-6" }, nodes.length === 0 ? /* @__PURE__ */ React2.createElement("div", { className: "text-center py-16" }, /* @__PURE__ */ React2.createElement("div", { className: "text-8xl mb-6" }, "\u2728"), /* @__PURE__ */ React2.createElement("h3", { className: "text-3xl font-bold mb-4" }, "Create Your Interactive Story"), /* @__PURE__ */ React2.createElement("p", { className: "text-muted-foreground text-lg mb-8 max-w-2xl mx-auto" }, "Build immersive, branching narratives where every choice matters. Add images, set moods, and create unforgettable adventures."), /* @__PURE__ */ React2.createElement(Button, { size: "lg", onClick: addNewNode, className: "px-8 py-4 text-lg" }, /* @__PURE__ */ React2.createElement(Plus, { className: "w-5 h-5 mr-2" }), "Start Creating")) : /* @__PURE__ */ React2.createElement("div", { className: cn(
|
|
342
|
+
"gap-6",
|
|
343
|
+
viewMode === "grid" ? "grid md:grid-cols-2" : "space-y-4"
|
|
344
|
+
) }, nodes.map((node) => {
|
|
345
|
+
var _a, _b;
|
|
346
|
+
const nodeMood = node.mood || "neutral";
|
|
347
|
+
const moodStyle = moodColors[nodeMood];
|
|
348
|
+
return /* @__PURE__ */ React2.createElement(
|
|
349
|
+
Card,
|
|
350
|
+
{
|
|
351
|
+
key: node.id,
|
|
352
|
+
className: cn(
|
|
353
|
+
"group relative transition-all duration-300 hover:shadow-xl hover:scale-[1.02] border-2",
|
|
354
|
+
node.isStart && "ring-4 ring-accent/30 shadow-accent/20 shadow-lg",
|
|
355
|
+
editingNode === node.id && "ring-4 ring-secondary/50",
|
|
356
|
+
moodStyle.border,
|
|
357
|
+
"overflow-hidden"
|
|
358
|
+
)
|
|
359
|
+
},
|
|
360
|
+
node.image && /* @__PURE__ */ React2.createElement("div", { className: "relative h-32 w-full" }, /* @__PURE__ */ React2.createElement(
|
|
361
|
+
"img",
|
|
362
|
+
{
|
|
363
|
+
src: node.image,
|
|
364
|
+
alt: node.title,
|
|
365
|
+
className: "w-full h-full object-cover"
|
|
366
|
+
}
|
|
367
|
+
), /* @__PURE__ */ React2.createElement("div", { className: "absolute inset-0 bg-gradient-to-t from-black/30 to-transparent" }), /* @__PURE__ */ React2.createElement(
|
|
368
|
+
Button,
|
|
369
|
+
{
|
|
370
|
+
variant: "ghost",
|
|
371
|
+
size: "sm",
|
|
372
|
+
className: "absolute top-2 right-2 bg-white/20 backdrop-blur-sm hover:bg-white/30",
|
|
373
|
+
onClick: () => updateNode(node.id, { image: void 0 })
|
|
374
|
+
},
|
|
375
|
+
/* @__PURE__ */ React2.createElement(Trash2, { className: "w-3 h-3 text-white" })
|
|
376
|
+
)),
|
|
377
|
+
/* @__PURE__ */ React2.createElement(CardHeader, { className: cn("pb-3", moodStyle.bg) }, /* @__PURE__ */ React2.createElement("div", { className: "flex items-start justify-between" }, /* @__PURE__ */ React2.createElement("div", { className: "flex items-center gap-2 flex-wrap" }, node.isStart && /* @__PURE__ */ React2.createElement(Badge, { className: "bg-accent text-accent-foreground" }, "\u{1F680} Start"), node.isEnd && /* @__PURE__ */ React2.createElement(Badge, { variant: "outline", className: "border-accent/50" }, "\u{1F3AF} End"), (_a = node.tags) == null ? void 0 : _a.map((tag, index) => /* @__PURE__ */ React2.createElement(Badge, { key: index, variant: "secondary", className: "text-xs" }, "#", tag))), /* @__PURE__ */ React2.createElement("div", { className: "flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity" }, /* @__PURE__ */ React2.createElement(
|
|
378
|
+
Button,
|
|
379
|
+
{
|
|
380
|
+
variant: "ghost",
|
|
381
|
+
size: "sm",
|
|
382
|
+
onClick: () => duplicateNode(node.id),
|
|
383
|
+
className: "hover:bg-accent/20"
|
|
384
|
+
},
|
|
385
|
+
/* @__PURE__ */ React2.createElement(Copy, { className: "w-3 h-3" })
|
|
386
|
+
), /* @__PURE__ */ React2.createElement(
|
|
387
|
+
Button,
|
|
388
|
+
{
|
|
389
|
+
variant: "ghost",
|
|
390
|
+
size: "sm",
|
|
391
|
+
onClick: () => setEditingNode(editingNode === node.id ? null : node.id),
|
|
392
|
+
className: "hover:bg-accent/20"
|
|
393
|
+
},
|
|
394
|
+
/* @__PURE__ */ React2.createElement(Edit3, { className: "w-3 h-3" })
|
|
395
|
+
), /* @__PURE__ */ React2.createElement(
|
|
396
|
+
Button,
|
|
397
|
+
{
|
|
398
|
+
variant: "ghost",
|
|
399
|
+
size: "sm",
|
|
400
|
+
onClick: () => deleteNode(node.id),
|
|
401
|
+
className: "text-destructive hover:text-destructive hover:bg-destructive/10"
|
|
402
|
+
},
|
|
403
|
+
/* @__PURE__ */ React2.createElement(Trash2, { className: "w-3 h-3" })
|
|
404
|
+
))), editingNode === node.id ? /* @__PURE__ */ React2.createElement("div", { className: "space-y-3" }, /* @__PURE__ */ React2.createElement(
|
|
405
|
+
Input,
|
|
406
|
+
{
|
|
407
|
+
value: node.title,
|
|
408
|
+
onChange: (e) => updateNode(node.id, { title: e.target.value }),
|
|
409
|
+
className: "font-semibold text-lg",
|
|
410
|
+
placeholder: "Chapter title"
|
|
411
|
+
}
|
|
412
|
+
), /* @__PURE__ */ React2.createElement("div", { className: "grid grid-cols-2 gap-2" }, /* @__PURE__ */ React2.createElement("div", null, /* @__PURE__ */ React2.createElement(Label, { className: "text-xs" }, "Mood"), /* @__PURE__ */ React2.createElement(
|
|
413
|
+
"select",
|
|
414
|
+
{
|
|
415
|
+
value: node.mood || "neutral",
|
|
416
|
+
onChange: (e) => updateNode(node.id, { mood: e.target.value }),
|
|
417
|
+
className: "w-full text-sm border rounded px-2 py-1 bg-background"
|
|
418
|
+
},
|
|
419
|
+
/* @__PURE__ */ React2.createElement("option", { value: "neutral" }, "\u{1F610} Neutral"),
|
|
420
|
+
/* @__PURE__ */ React2.createElement("option", { value: "happy" }, "\u{1F60A} Happy"),
|
|
421
|
+
/* @__PURE__ */ React2.createElement("option", { value: "sad" }, "\u{1F622} Sad"),
|
|
422
|
+
/* @__PURE__ */ React2.createElement("option", { value: "mysterious" }, "\u{1F52E} Mysterious"),
|
|
423
|
+
/* @__PURE__ */ React2.createElement("option", { value: "exciting" }, "\u{1F680} Exciting"),
|
|
424
|
+
/* @__PURE__ */ React2.createElement("option", { value: "dark" }, "\u{1F319} Dark")
|
|
425
|
+
)), /* @__PURE__ */ React2.createElement("div", null, /* @__PURE__ */ React2.createElement(Label, { className: "text-xs" }, "Read Time (min)"), /* @__PURE__ */ React2.createElement(
|
|
426
|
+
Input,
|
|
427
|
+
{
|
|
428
|
+
type: "number",
|
|
429
|
+
value: node.estimatedReadTime || 1,
|
|
430
|
+
onChange: (e) => updateNode(node.id, { estimatedReadTime: parseInt(e.target.value) || 1 }),
|
|
431
|
+
className: "text-sm",
|
|
432
|
+
min: 1
|
|
433
|
+
}
|
|
434
|
+
))), /* @__PURE__ */ React2.createElement("div", null, /* @__PURE__ */ React2.createElement(Label, { className: "text-xs" }, "Tags (comma-separated)"), /* @__PURE__ */ React2.createElement(
|
|
435
|
+
Input,
|
|
436
|
+
{
|
|
437
|
+
value: ((_b = node.tags) == null ? void 0 : _b.join(", ")) || "",
|
|
438
|
+
onChange: (e) => updateNode(node.id, { tags: e.target.value.split(",").map((t) => t.trim()).filter(Boolean) }),
|
|
439
|
+
placeholder: "adventure, fantasy, mystery",
|
|
440
|
+
className: "text-sm"
|
|
441
|
+
}
|
|
442
|
+
))) : /* @__PURE__ */ React2.createElement("div", null, /* @__PURE__ */ React2.createElement(CardTitle, { className: cn("text-xl mb-2", moodStyle.text) }, node.title), /* @__PURE__ */ React2.createElement("div", { className: "flex items-center gap-4 text-xs text-muted-foreground" }, /* @__PURE__ */ React2.createElement("span", { className: "flex items-center gap-1" }, /* @__PURE__ */ React2.createElement(Timer, { className: "w-3 h-3" }), node.estimatedReadTime || 1, "m"), /* @__PURE__ */ React2.createElement("span", { className: "flex items-center gap-1" }, /* @__PURE__ */ React2.createElement(Users, { className: "w-3 h-3" }), node.choices.length, " choices")))),
|
|
443
|
+
/* @__PURE__ */ React2.createElement(CardContent, { className: "space-y-4 p-4" }, editingNode === node.id ? /* @__PURE__ */ React2.createElement(
|
|
444
|
+
Textarea,
|
|
445
|
+
{
|
|
446
|
+
value: node.content,
|
|
447
|
+
onChange: (e) => updateNode(node.id, { content: e.target.value }),
|
|
448
|
+
placeholder: "Write your story content...",
|
|
449
|
+
className: "min-h-[120px] resize-none text-sm"
|
|
450
|
+
}
|
|
451
|
+
) : /* @__PURE__ */ React2.createElement("p", { className: "text-sm text-muted-foreground line-clamp-4 leading-relaxed" }, node.content), /* @__PURE__ */ React2.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React2.createElement("div", { className: "flex items-center justify-between" }, /* @__PURE__ */ React2.createElement(Label, { className: "text-xs font-medium" }, "Scene Image"), /* @__PURE__ */ React2.createElement(
|
|
452
|
+
"input",
|
|
453
|
+
{
|
|
454
|
+
ref: fileInputRef,
|
|
455
|
+
type: "file",
|
|
456
|
+
accept: "image/*",
|
|
457
|
+
onChange: (e) => {
|
|
458
|
+
var _a2;
|
|
459
|
+
const file = (_a2 = e.target.files) == null ? void 0 : _a2[0];
|
|
460
|
+
if (file) handleImageUpload(node.id, file);
|
|
461
|
+
},
|
|
462
|
+
className: "hidden"
|
|
463
|
+
}
|
|
464
|
+
), /* @__PURE__ */ React2.createElement(
|
|
465
|
+
Button,
|
|
466
|
+
{
|
|
467
|
+
variant: "ghost",
|
|
468
|
+
size: "sm",
|
|
469
|
+
onClick: () => {
|
|
470
|
+
var _a2;
|
|
471
|
+
return (_a2 = fileInputRef.current) == null ? void 0 : _a2.click();
|
|
472
|
+
},
|
|
473
|
+
className: "text-xs h-6 px-2"
|
|
474
|
+
},
|
|
475
|
+
/* @__PURE__ */ React2.createElement(Upload, { className: "w-3 h-3 mr-1" }),
|
|
476
|
+
node.image ? "Change" : "Upload"
|
|
477
|
+
))), /* @__PURE__ */ React2.createElement("div", { className: "space-y-3" }, /* @__PURE__ */ React2.createElement("div", { className: "flex items-center justify-between" }, /* @__PURE__ */ React2.createElement("span", { className: "text-sm font-medium flex items-center gap-1" }, /* @__PURE__ */ React2.createElement(GitBranch, { className: "w-3 h-3" }), "Choices (", node.choices.length, ")"), /* @__PURE__ */ React2.createElement(
|
|
478
|
+
Button,
|
|
479
|
+
{
|
|
480
|
+
variant: "ghost",
|
|
481
|
+
size: "sm",
|
|
482
|
+
onClick: () => addChoice(node.id),
|
|
483
|
+
className: "text-xs h-6 px-2 hover:bg-accent/20"
|
|
484
|
+
},
|
|
485
|
+
/* @__PURE__ */ React2.createElement(Plus, { className: "w-3 h-3" })
|
|
486
|
+
)), node.choices.map((choice) => {
|
|
487
|
+
return /* @__PURE__ */ React2.createElement("div", { key: choice.id, className: "space-y-2 p-3 bg-muted/30 rounded-lg border border-border/30" }, /* @__PURE__ */ React2.createElement("div", { className: "flex gap-2 items-start" }, /* @__PURE__ */ React2.createElement(
|
|
488
|
+
Input,
|
|
489
|
+
{
|
|
490
|
+
value: choice.icon || "\u2B50",
|
|
491
|
+
onChange: (e) => updateChoice(node.id, choice.id, { icon: e.target.value }),
|
|
492
|
+
placeholder: "\u{1F3AD}",
|
|
493
|
+
className: "w-12 h-8 text-center text-sm p-1"
|
|
494
|
+
}
|
|
495
|
+
), /* @__PURE__ */ React2.createElement(
|
|
496
|
+
Input,
|
|
497
|
+
{
|
|
498
|
+
value: choice.text,
|
|
499
|
+
onChange: (e) => updateChoice(node.id, choice.id, { text: e.target.value }),
|
|
500
|
+
placeholder: "Choice text",
|
|
501
|
+
className: "flex-1 text-sm h-8"
|
|
502
|
+
}
|
|
503
|
+
), /* @__PURE__ */ React2.createElement(
|
|
504
|
+
"select",
|
|
505
|
+
{
|
|
506
|
+
value: choice.targetId,
|
|
507
|
+
onChange: (e) => updateChoice(node.id, choice.id, { targetId: e.target.value }),
|
|
508
|
+
className: "text-sm border rounded px-2 py-1 bg-background h-8 min-w-[120px]"
|
|
509
|
+
},
|
|
510
|
+
/* @__PURE__ */ React2.createElement("option", { value: "" }, "Select target"),
|
|
511
|
+
nodes.filter((n) => n.id !== node.id).map((n) => /* @__PURE__ */ React2.createElement("option", { key: n.id, value: n.id }, n.title))
|
|
512
|
+
), /* @__PURE__ */ React2.createElement(
|
|
513
|
+
Button,
|
|
514
|
+
{
|
|
515
|
+
variant: "ghost",
|
|
516
|
+
size: "sm",
|
|
517
|
+
onClick: () => deleteChoice(node.id, choice.id),
|
|
518
|
+
className: "text-destructive hover:text-destructive p-1 h-8 w-8"
|
|
519
|
+
},
|
|
520
|
+
/* @__PURE__ */ React2.createElement(Trash2, { className: "w-3 h-3" })
|
|
521
|
+
)), editingNode === node.id && /* @__PURE__ */ React2.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React2.createElement(
|
|
522
|
+
Input,
|
|
523
|
+
{
|
|
524
|
+
value: choice.consequence || "",
|
|
525
|
+
onChange: (e) => updateChoice(node.id, choice.id, { consequence: e.target.value }),
|
|
526
|
+
placeholder: "What happens when this choice is selected?",
|
|
527
|
+
className: "text-xs text-muted-foreground italic"
|
|
528
|
+
}
|
|
529
|
+
), /* @__PURE__ */ React2.createElement("div", { className: "flex gap-2" }, /* @__PURE__ */ React2.createElement(
|
|
530
|
+
Input,
|
|
531
|
+
{
|
|
532
|
+
value: choice.requiredItem || "",
|
|
533
|
+
onChange: (e) => updateChoice(node.id, choice.id, { requiredItem: e.target.value }),
|
|
534
|
+
placeholder: "Required item (optional)",
|
|
535
|
+
className: "text-xs flex-1"
|
|
536
|
+
}
|
|
537
|
+
), /* @__PURE__ */ React2.createElement(
|
|
538
|
+
Input,
|
|
539
|
+
{
|
|
540
|
+
type: "number",
|
|
541
|
+
value: choice.probabilityWeight || 1,
|
|
542
|
+
onChange: (e) => updateChoice(node.id, choice.id, { probabilityWeight: parseInt(e.target.value) || 1 }),
|
|
543
|
+
placeholder: "Weight",
|
|
544
|
+
className: "text-xs w-16",
|
|
545
|
+
min: 1,
|
|
546
|
+
max: 10
|
|
547
|
+
}
|
|
548
|
+
))));
|
|
549
|
+
})))
|
|
550
|
+
);
|
|
551
|
+
})))), /* @__PURE__ */ React2.createElement(Dialog, { open: showAdvancedEditor, onOpenChange: setShowAdvancedEditor }, /* @__PURE__ */ React2.createElement(DialogContent, { className: "max-w-2xl max-h-[80vh] overflow-y-auto" }, /* @__PURE__ */ React2.createElement(DialogHeader, null, /* @__PURE__ */ React2.createElement(DialogTitle, { className: "flex items-center gap-2" }, /* @__PURE__ */ React2.createElement(Settings, { className: "w-5 h-5" }), "Advanced Story Settings")), /* @__PURE__ */ React2.createElement("div", { className: "space-y-6" }, /* @__PURE__ */ React2.createElement("div", { className: "space-y-3" }, /* @__PURE__ */ React2.createElement(Label, null, "Story Metadata"), /* @__PURE__ */ React2.createElement("div", { className: "grid grid-cols-2 gap-3" }, /* @__PURE__ */ React2.createElement("div", null, /* @__PURE__ */ React2.createElement(Label, { className: "text-xs" }, "Total Nodes"), /* @__PURE__ */ React2.createElement(Input, { value: nodes.length, disabled: true, className: "text-sm" })), /* @__PURE__ */ React2.createElement("div", null, /* @__PURE__ */ React2.createElement(Label, { className: "text-xs" }, "Total Choices"), /* @__PURE__ */ React2.createElement(
|
|
552
|
+
Input,
|
|
553
|
+
{
|
|
554
|
+
value: nodes.reduce((sum, node) => sum + node.choices.length, 0),
|
|
555
|
+
disabled: true,
|
|
556
|
+
className: "text-sm"
|
|
557
|
+
}
|
|
558
|
+
)))), /* @__PURE__ */ React2.createElement("div", { className: "space-y-3" }, /* @__PURE__ */ React2.createElement(Label, null, "Story Statistics"), /* @__PURE__ */ React2.createElement("div", { className: "grid grid-cols-3 gap-3" }, /* @__PURE__ */ React2.createElement("div", { className: "p-3 bg-accent/10 rounded-lg text-center" }, /* @__PURE__ */ React2.createElement("div", { className: "text-2xl font-bold text-accent" }, nodes.reduce((sum, node) => sum + (node.estimatedReadTime || 1), 0)), /* @__PURE__ */ React2.createElement("div", { className: "text-xs text-muted-foreground" }, "Total Minutes")), /* @__PURE__ */ React2.createElement("div", { className: "p-3 bg-secondary/10 rounded-lg text-center" }, /* @__PURE__ */ React2.createElement("div", { className: "text-2xl font-bold text-secondary" }, nodes.filter((node) => node.image).length), /* @__PURE__ */ React2.createElement("div", { className: "text-xs text-muted-foreground" }, "With Images")), /* @__PURE__ */ React2.createElement("div", { className: "p-3 bg-primary/10 rounded-lg text-center" }, /* @__PURE__ */ React2.createElement("div", { className: "text-2xl font-bold text-primary" }, new Set(nodes.flatMap((node) => node.tags || [])).size), /* @__PURE__ */ React2.createElement("div", { className: "text-xs text-muted-foreground" }, "Unique Tags")))), /* @__PURE__ */ React2.createElement("div", { className: "space-y-3" }, /* @__PURE__ */ React2.createElement(Label, null, "Export Options"), /* @__PURE__ */ React2.createElement("div", { className: "flex gap-2" }, /* @__PURE__ */ React2.createElement(Button, { onClick: exportStory, className: "flex-1" }, /* @__PURE__ */ React2.createElement(Save, { className: "w-4 h-4 mr-2" }), "Export as JSON"), /* @__PURE__ */ React2.createElement(Button, { variant: "outline", className: "flex-1" }, /* @__PURE__ */ React2.createElement(Share2, { className: "w-4 h-4 mr-2" }), "Share Story"))), /* @__PURE__ */ React2.createElement("div", { className: "space-y-3" }, /* @__PURE__ */ React2.createElement(Label, null, "Story Validation"), /* @__PURE__ */ React2.createElement("div", { className: "space-y-2 text-sm" }, nodes.some((node) => !node.isStart && !nodes.some((n) => n.choices.some((c) => c.targetId === node.id))) && /* @__PURE__ */ React2.createElement("div", { className: "p-2 bg-yellow-50 border border-yellow-200 rounded text-yellow-800" }, "\u26A0\uFE0F Some nodes are unreachable from the start"), nodes.some((node) => node.choices.some((choice) => !choice.targetId)) && /* @__PURE__ */ React2.createElement("div", { className: "p-2 bg-red-50 border border-red-200 rounded text-red-800" }, "\u274C Some choices don't have target nodes"), !nodes.some((node) => node.isStart) && /* @__PURE__ */ React2.createElement("div", { className: "p-2 bg-red-50 border border-red-200 rounded text-red-800" }, "\u274C No starting node defined"), nodes.every((node) => node.choices.length > 0) && /* @__PURE__ */ React2.createElement("div", { className: "p-2 bg-yellow-50 border border-yellow-200 rounded text-yellow-800" }, "\u26A0\uFE0F No ending nodes (all nodes have choices)")))))));
|
|
559
|
+
}
|
|
560
|
+
export {
|
|
561
|
+
StoryBuilderComponent as default
|
|
562
|
+
};
|