@vishu1301/script-writing 1.1.1 → 1.1.3
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/index.cjs +59 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -4
- package/dist/index.d.ts +6 -4
- package/dist/index.js +61 -48
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -51,18 +51,20 @@ declare function useScreenplayEditor(options?: UseScreenplayEditorOptions): {
|
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
type ScreenplayEditorViewProps = ReturnType<typeof useScreenplayEditor> & {
|
|
54
|
+
showPdfImport?: boolean;
|
|
55
|
+
showSaveButton?: boolean;
|
|
56
|
+
showSyncButton?: boolean;
|
|
54
57
|
onSave?: () => void;
|
|
55
58
|
onSaveAsPdf?: () => void;
|
|
56
59
|
onSaveAsSbx?: () => void;
|
|
57
60
|
onSyncWithCloud?: () => void;
|
|
58
61
|
handleSceneNumberChange: (blockId: string, value: string) => void;
|
|
59
62
|
};
|
|
60
|
-
declare function ScreenplayEditorView({ blocks, refs, focusedBlockId, showSuggestions, showExtensionSuggestions, characterExtensions, locations, characters, handleBlockTextChange, handleSceneTypeChange, handleTimeOfDayChange, handleBlockTypeChange, handleSelectCharacterExtension, handleKeyDown, handleFocus, handleBlur, handleScriptImport, onSave, onSaveAsPdf, onSaveAsSbx, onSyncWithCloud, handleSceneNumberChange, }: ScreenplayEditorViewProps): react_jsx_runtime.JSX.Element;
|
|
63
|
+
declare function ScreenplayEditorView({ blocks, refs, focusedBlockId, showSuggestions, showExtensionSuggestions, characterExtensions, locations, characters, showPdfImport, showSaveButton, showSyncButton, handleBlockTextChange, handleSceneTypeChange, handleTimeOfDayChange, handleBlockTypeChange, handleSelectCharacterExtension, handleKeyDown, handleFocus, handleBlur, handleScriptImport, onSave, onSaveAsPdf, onSaveAsSbx, onSyncWithCloud, handleSceneNumberChange, }: ScreenplayEditorViewProps): react_jsx_runtime.JSX.Element;
|
|
61
64
|
|
|
62
65
|
declare const handleSaveAsPdf: (blocks: Block[], sceneNumbers: Record<string, string>, project_name?: string) => void;
|
|
63
66
|
declare const convertBlocksToSbx: (blocks: Block[], sceneNumbers: Record<string, string>) => string;
|
|
64
|
-
declare const
|
|
65
|
-
declare const handleSyncWithCloud: (blocks: Block[], sceneNumbers: Record<string, string>, onSyncWithCloud?: (sbxData: string) => void) => void;
|
|
67
|
+
declare const handleSyncWithCloud: (blocks: Block[], sceneNumbers: Record<string, string>, onSaveAsSbx?: (file: File) => void, project_name?: string) => void;
|
|
66
68
|
|
|
67
69
|
interface ScriptBreakdown {
|
|
68
70
|
scene_number: string;
|
|
@@ -139,4 +141,4 @@ declare function useScriptBreakdownScene(sceneNumber: string): {
|
|
|
139
141
|
setSceneBrief: React$1.Dispatch<React$1.SetStateAction<string>>;
|
|
140
142
|
};
|
|
141
143
|
|
|
142
|
-
export { type Block, type BlockType, CATEGORIES, type ElementCategory, ScreenplayEditorView, type ScriptBreakdown, ScriptBreakdownSceneView, type Tag, type TimeOfDay, blockStyles, blockTypes, convertBlocksToSbx, handleSaveAsPdf,
|
|
144
|
+
export { type Block, type BlockType, CATEGORIES, type ElementCategory, ScreenplayEditorView, type ScriptBreakdown, ScriptBreakdownSceneView, type Tag, type TimeOfDay, blockStyles, blockTypes, convertBlocksToSbx, handleSaveAsPdf, handleSyncWithCloud, icons, timeOfDayOptions, useScreenplayEditor, useScriptBreakdownScene, uuid };
|
package/dist/index.d.ts
CHANGED
|
@@ -51,18 +51,20 @@ declare function useScreenplayEditor(options?: UseScreenplayEditorOptions): {
|
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
type ScreenplayEditorViewProps = ReturnType<typeof useScreenplayEditor> & {
|
|
54
|
+
showPdfImport?: boolean;
|
|
55
|
+
showSaveButton?: boolean;
|
|
56
|
+
showSyncButton?: boolean;
|
|
54
57
|
onSave?: () => void;
|
|
55
58
|
onSaveAsPdf?: () => void;
|
|
56
59
|
onSaveAsSbx?: () => void;
|
|
57
60
|
onSyncWithCloud?: () => void;
|
|
58
61
|
handleSceneNumberChange: (blockId: string, value: string) => void;
|
|
59
62
|
};
|
|
60
|
-
declare function ScreenplayEditorView({ blocks, refs, focusedBlockId, showSuggestions, showExtensionSuggestions, characterExtensions, locations, characters, handleBlockTextChange, handleSceneTypeChange, handleTimeOfDayChange, handleBlockTypeChange, handleSelectCharacterExtension, handleKeyDown, handleFocus, handleBlur, handleScriptImport, onSave, onSaveAsPdf, onSaveAsSbx, onSyncWithCloud, handleSceneNumberChange, }: ScreenplayEditorViewProps): react_jsx_runtime.JSX.Element;
|
|
63
|
+
declare function ScreenplayEditorView({ blocks, refs, focusedBlockId, showSuggestions, showExtensionSuggestions, characterExtensions, locations, characters, showPdfImport, showSaveButton, showSyncButton, handleBlockTextChange, handleSceneTypeChange, handleTimeOfDayChange, handleBlockTypeChange, handleSelectCharacterExtension, handleKeyDown, handleFocus, handleBlur, handleScriptImport, onSave, onSaveAsPdf, onSaveAsSbx, onSyncWithCloud, handleSceneNumberChange, }: ScreenplayEditorViewProps): react_jsx_runtime.JSX.Element;
|
|
61
64
|
|
|
62
65
|
declare const handleSaveAsPdf: (blocks: Block[], sceneNumbers: Record<string, string>, project_name?: string) => void;
|
|
63
66
|
declare const convertBlocksToSbx: (blocks: Block[], sceneNumbers: Record<string, string>) => string;
|
|
64
|
-
declare const
|
|
65
|
-
declare const handleSyncWithCloud: (blocks: Block[], sceneNumbers: Record<string, string>, onSyncWithCloud?: (sbxData: string) => void) => void;
|
|
67
|
+
declare const handleSyncWithCloud: (blocks: Block[], sceneNumbers: Record<string, string>, onSaveAsSbx?: (file: File) => void, project_name?: string) => void;
|
|
66
68
|
|
|
67
69
|
interface ScriptBreakdown {
|
|
68
70
|
scene_number: string;
|
|
@@ -139,4 +141,4 @@ declare function useScriptBreakdownScene(sceneNumber: string): {
|
|
|
139
141
|
setSceneBrief: React$1.Dispatch<React$1.SetStateAction<string>>;
|
|
140
142
|
};
|
|
141
143
|
|
|
142
|
-
export { type Block, type BlockType, CATEGORIES, type ElementCategory, ScreenplayEditorView, type ScriptBreakdown, ScriptBreakdownSceneView, type Tag, type TimeOfDay, blockStyles, blockTypes, convertBlocksToSbx, handleSaveAsPdf,
|
|
144
|
+
export { type Block, type BlockType, CATEGORIES, type ElementCategory, ScreenplayEditorView, type ScriptBreakdown, ScriptBreakdownSceneView, type Tag, type TimeOfDay, blockStyles, blockTypes, convertBlocksToSbx, handleSaveAsPdf, handleSyncWithCloud, icons, timeOfDayOptions, useScreenplayEditor, useScriptBreakdownScene, uuid };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useState,
|
|
1
|
+
import { useState, useRef, useEffect, useMemo, useCallback } from 'react';
|
|
2
2
|
import { ArrowRightLeft, MessageCircle, Brackets, UserRound, Sparkles, Clapperboard, Upload, Save, FileDown, RefreshCcw, Cog, ArrowRight, User, ChevronRight, Loader2, AlignLeft, Tags, Plus, X } from 'lucide-react';
|
|
3
3
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
import * as pdfjs from 'pdfjs-dist';
|
|
@@ -231,7 +231,7 @@ function PdfImporter({ onScriptImported, children }) {
|
|
|
231
231
|
title = await processPage(1);
|
|
232
232
|
}
|
|
233
233
|
let scriptContent = "";
|
|
234
|
-
for (let i =
|
|
234
|
+
for (let i = 1; i <= pdf.numPages; i++) {
|
|
235
235
|
scriptContent += await processPage(i) + "\n\n";
|
|
236
236
|
}
|
|
237
237
|
onScriptImported(title.trim(), scriptContent);
|
|
@@ -290,6 +290,9 @@ function ScreenplayEditorView({
|
|
|
290
290
|
characterExtensions,
|
|
291
291
|
locations,
|
|
292
292
|
characters,
|
|
293
|
+
showPdfImport = false,
|
|
294
|
+
showSaveButton = false,
|
|
295
|
+
showSyncButton = false,
|
|
293
296
|
handleBlockTextChange,
|
|
294
297
|
handleSceneTypeChange,
|
|
295
298
|
handleTimeOfDayChange,
|
|
@@ -306,7 +309,21 @@ function ScreenplayEditorView({
|
|
|
306
309
|
handleSceneNumberChange
|
|
307
310
|
}) {
|
|
308
311
|
const [isRulesOpen, setIsRulesOpen] = useState(false);
|
|
312
|
+
const rulesRef = useRef(null);
|
|
309
313
|
const COURIER_STACK = "'Courier Prime', 'Courier', monospace";
|
|
314
|
+
useEffect(() => {
|
|
315
|
+
const handleClickOutside = (event) => {
|
|
316
|
+
if (rulesRef.current && !rulesRef.current.contains(event.target)) {
|
|
317
|
+
setIsRulesOpen(false);
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
if (isRulesOpen) {
|
|
321
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
322
|
+
}
|
|
323
|
+
return () => {
|
|
324
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
325
|
+
};
|
|
326
|
+
}, [isRulesOpen]);
|
|
310
327
|
useEffect(() => {
|
|
311
328
|
const fontId = "google-font-courier-prime";
|
|
312
329
|
const styleId = "screenplay-editor-force-v4";
|
|
@@ -388,8 +405,8 @@ function ScreenplayEditorView({
|
|
|
388
405
|
}) }),
|
|
389
406
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 shrink-0 relative px-1", children: [
|
|
390
407
|
/* @__PURE__ */ jsx("div", { className: "w-[1px] h-6 bg-zinc-200/80 mx-2 hidden sm:block rounded-full" }),
|
|
391
|
-
/* @__PURE__ */ jsx(PdfImporter, { onScriptImported: handleScriptImport, children: /* @__PURE__ */ jsx("div", { title: "Import Script", children: /* @__PURE__ */ jsx(Upload, { className: "w-[18px] h-[18px]" }) }) }),
|
|
392
|
-
onSave && /* @__PURE__ */ jsx(
|
|
408
|
+
showPdfImport && /* @__PURE__ */ jsx(PdfImporter, { onScriptImported: handleScriptImport, children: /* @__PURE__ */ jsx("div", { title: "Import Script", children: /* @__PURE__ */ jsx(Upload, { className: "w-[18px] h-[18px]" }) }) }),
|
|
409
|
+
onSave && showSaveButton && /* @__PURE__ */ jsx(
|
|
393
410
|
"button",
|
|
394
411
|
{
|
|
395
412
|
onClick: onSave,
|
|
@@ -399,7 +416,7 @@ function ScreenplayEditorView({
|
|
|
399
416
|
children: /* @__PURE__ */ jsx(Save, { className: "w-[18px] h-[18px]" })
|
|
400
417
|
}
|
|
401
418
|
),
|
|
402
|
-
onSaveAsPdf && /* @__PURE__ */ jsx(
|
|
419
|
+
onSaveAsPdf && showSaveButton && /* @__PURE__ */ jsx(
|
|
403
420
|
"button",
|
|
404
421
|
{
|
|
405
422
|
onClick: onSaveAsPdf,
|
|
@@ -409,49 +426,51 @@ function ScreenplayEditorView({
|
|
|
409
426
|
children: /* @__PURE__ */ jsx(FileDown, { className: "w-[18px] h-[18px]" })
|
|
410
427
|
}
|
|
411
428
|
),
|
|
412
|
-
|
|
429
|
+
onSyncWithCloud && showSyncButton && /* @__PURE__ */ jsx(
|
|
413
430
|
"button",
|
|
414
431
|
{
|
|
415
|
-
onClick:
|
|
432
|
+
onClick: onSyncWithCloud,
|
|
416
433
|
className: "flex items-center justify-center w-10 h-10 rounded-full text-zinc-500 hover:bg-zinc-100 hover:text-zinc-900 transition-all duration-200 active:scale-95",
|
|
417
|
-
title: "Sync with Cloud
|
|
418
|
-
"aria-label": "
|
|
434
|
+
title: "Sync with Cloud",
|
|
435
|
+
"aria-label": "Sync with Cloud",
|
|
419
436
|
children: /* @__PURE__ */ jsx(RefreshCcw, { className: "w-[18px] h-[18px]" })
|
|
420
437
|
}
|
|
421
438
|
),
|
|
422
|
-
/* @__PURE__ */
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
/* @__PURE__ */ jsxs("
|
|
434
|
-
/* @__PURE__ */
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
/* @__PURE__ */ jsx("div", { className: "space-y-4", children: /* @__PURE__ */ jsxs("ul", { className: "space-y-2.5", children: [
|
|
438
|
-
/* @__PURE__ */ jsxs("li", { className: "flex items-center justify-between gap-6", children: [
|
|
439
|
-
/* @__PURE__ */ jsx("span", { className: "font-medium text-zinc-600", children: "New Block" }),
|
|
440
|
-
/* @__PURE__ */ jsx("kbd", { className: "px-2 py-1 text-[11px] font-bold text-zinc-700 bg-white border border-zinc-200/80 shadow-[0_2px_4px_rgb(0,0,0,0.02)] rounded-md", children: "Enter" })
|
|
441
|
-
] }),
|
|
442
|
-
/* @__PURE__ */ jsxs("li", { className: "flex items-center justify-between gap-6", children: [
|
|
443
|
-
/* @__PURE__ */ jsx("span", { className: "font-medium text-zinc-600", children: "Delete Block" }),
|
|
444
|
-
/* @__PURE__ */ jsx("kbd", { className: "px-2 py-1 text-[11px] font-bold text-zinc-700 bg-white border border-zinc-200/80 shadow-[0_2px_4px_rgb(0,0,0,0.02)] rounded-md", children: "Backspace" })
|
|
439
|
+
/* @__PURE__ */ jsxs("div", { ref: rulesRef, className: "relative flex items-center", children: [
|
|
440
|
+
/* @__PURE__ */ jsx(
|
|
441
|
+
"button",
|
|
442
|
+
{
|
|
443
|
+
onClick: () => setIsRulesOpen(!isRulesOpen),
|
|
444
|
+
className: `flex items-center justify-center w-10 h-10 rounded-full transition-all duration-200 active:scale-95 ${isRulesOpen ? "bg-zinc-900 text-white shadow-md shadow-zinc-900/20" : "text-zinc-500 hover:bg-zinc-100 hover:text-zinc-900"}`,
|
|
445
|
+
title: "Settings & Shortcuts",
|
|
446
|
+
"aria-label": "Toggle Settings",
|
|
447
|
+
children: /* @__PURE__ */ jsx(Cog, { className: "w-[18px] h-[18px]" })
|
|
448
|
+
}
|
|
449
|
+
),
|
|
450
|
+
isRulesOpen && /* @__PURE__ */ jsxs("div", { className: "absolute top-full mt-2 right-0 bg-white/95 backdrop-blur-3xl rounded-[1.5rem] shadow-[0_20px_60px_-15px_rgba(0,0,0,0.1)] p-5 text-sm text-zinc-700 select-none font-sans overflow-hidden transition-all duration-300 w-72 origin-top-right animate-in fade-in zoom-in-95 z-50", children: [
|
|
451
|
+
/* @__PURE__ */ jsxs("h4", { className: "font-bold text-zinc-900 mb-4 text-sm flex items-center gap-2", children: [
|
|
452
|
+
/* @__PURE__ */ jsx(Cog, { className: "w-4 h-4 text-zinc-400" }),
|
|
453
|
+
"Settings & Shortcuts"
|
|
445
454
|
] }),
|
|
446
|
-
/* @__PURE__ */
|
|
447
|
-
/* @__PURE__ */
|
|
448
|
-
|
|
449
|
-
/* @__PURE__ */ jsx("kbd", { className: "px-2 py-1 text-[11px] font-bold text-zinc-700 bg-white border border-zinc-200/80 shadow-[0_2px_4px_rgb(0,0,0,0.02)] rounded-md", children: "
|
|
450
|
-
|
|
451
|
-
|
|
455
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-4", children: /* @__PURE__ */ jsxs("ul", { className: "space-y-2.5", children: [
|
|
456
|
+
/* @__PURE__ */ jsxs("li", { className: "flex items-center justify-between gap-6", children: [
|
|
457
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium text-zinc-600", children: "New Block" }),
|
|
458
|
+
/* @__PURE__ */ jsx("kbd", { className: "px-2 py-1 text-[11px] font-bold text-zinc-700 bg-white border border-zinc-200/80 shadow-[0_2px_4px_rgb(0,0,0,0.02)] rounded-md", children: "Enter" })
|
|
459
|
+
] }),
|
|
460
|
+
/* @__PURE__ */ jsxs("li", { className: "flex items-center justify-between gap-6", children: [
|
|
461
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium text-zinc-600", children: "Delete Block" }),
|
|
462
|
+
/* @__PURE__ */ jsx("kbd", { className: "px-2 py-1 text-[11px] font-bold text-zinc-700 bg-white border border-zinc-200/80 shadow-[0_2px_4px_rgb(0,0,0,0.02)] rounded-md", children: "Backspace" })
|
|
463
|
+
] }),
|
|
464
|
+
/* @__PURE__ */ jsxs("li", { className: "flex items-center justify-between gap-6", children: [
|
|
465
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium text-zinc-600", children: "Change Type" }),
|
|
466
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
467
|
+
/* @__PURE__ */ jsx("kbd", { className: "px-2 py-1 text-[11px] font-bold text-zinc-700 bg-white border border-zinc-200/80 shadow-[0_2px_4px_rgb(0,0,0,0.02)] rounded-md", children: "Ctrl" }),
|
|
468
|
+
/* @__PURE__ */ jsx("span", { className: "text-zinc-400 font-medium", children: "+" }),
|
|
469
|
+
/* @__PURE__ */ jsx("kbd", { className: "px-2 py-1 text-[11px] font-bold text-zinc-700 bg-white border border-zinc-200/80 shadow-[0_2px_4px_rgb(0,0,0,0.02)] rounded-md", children: "\u2191/\u2193" })
|
|
470
|
+
] })
|
|
452
471
|
] })
|
|
453
|
-
] })
|
|
454
|
-
] })
|
|
472
|
+
] }) })
|
|
473
|
+
] })
|
|
455
474
|
] })
|
|
456
475
|
] })
|
|
457
476
|
]
|
|
@@ -1664,7 +1683,7 @@ var convertBlocksToSbx = (blocks, sceneNumbers) => {
|
|
|
1664
1683
|
return `<div class="${divClass}" id="par${block.id}"${extraAttributes}>${text}</div>`;
|
|
1665
1684
|
}).join("");
|
|
1666
1685
|
};
|
|
1667
|
-
var
|
|
1686
|
+
var handleSyncWithCloud = (blocks, sceneNumbers, onSaveAsSbx, project_name) => {
|
|
1668
1687
|
const sbxData = convertBlocksToSbx(blocks, sceneNumbers);
|
|
1669
1688
|
const blob = new Blob([sbxData], { type: "text/plain" });
|
|
1670
1689
|
if (onSaveAsSbx) {
|
|
@@ -1681,12 +1700,6 @@ var handleSaveAsSbx = (blocks, sceneNumbers, onSaveAsSbx, project_name) => {
|
|
|
1681
1700
|
}
|
|
1682
1701
|
}
|
|
1683
1702
|
};
|
|
1684
|
-
var handleSyncWithCloud = (blocks, sceneNumbers, onSyncWithCloud) => {
|
|
1685
|
-
if (onSyncWithCloud) {
|
|
1686
|
-
const sbxData = convertBlocksToSbx(blocks, sceneNumbers);
|
|
1687
|
-
onSyncWithCloud(sbxData);
|
|
1688
|
-
}
|
|
1689
|
-
};
|
|
1690
1703
|
|
|
1691
1704
|
// app/types/script-breakdown.types.tsx
|
|
1692
1705
|
var CATEGORIES = [
|
|
@@ -2363,6 +2376,6 @@ function useScriptBreakdownScene(sceneNumber) {
|
|
|
2363
2376
|
};
|
|
2364
2377
|
}
|
|
2365
2378
|
|
|
2366
|
-
export { CATEGORIES, ScreenplayEditorView, ScriptBreakdownSceneView, blockStyles, blockTypes, convertBlocksToSbx, handleSaveAsPdf,
|
|
2379
|
+
export { CATEGORIES, ScreenplayEditorView, ScriptBreakdownSceneView, blockStyles, blockTypes, convertBlocksToSbx, handleSaveAsPdf, handleSyncWithCloud, icons, timeOfDayOptions, useScreenplayEditor, useScriptBreakdownScene, uuid };
|
|
2367
2380
|
//# sourceMappingURL=index.js.map
|
|
2368
2381
|
//# sourceMappingURL=index.js.map
|