@vishu1301/script-writing 1.1.9 → 1.2.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/dist/index.cjs +10 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +10 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2304,8 +2304,8 @@ function ScriptBreakdownSceneView({
|
|
|
2304
2304
|
] })
|
|
2305
2305
|
] }) });
|
|
2306
2306
|
}
|
|
2307
|
-
function useScriptBreakdownScene(
|
|
2308
|
-
const [tags, setTags] = react.useState(preLoadedTags || []);
|
|
2307
|
+
function useScriptBreakdownScene(options) {
|
|
2308
|
+
const [tags, setTags] = react.useState(options.preLoadedTags || []);
|
|
2309
2309
|
const [selectionMenu, setSelectionMenu] = react.useState(null);
|
|
2310
2310
|
const autoTaggedSceneRef = react.useRef(null);
|
|
2311
2311
|
const [scene, setScene] = react.useState(null);
|
|
@@ -2320,7 +2320,7 @@ function useScriptBreakdownScene(scene_url, fetchOptions, onAISummarize, onTagAd
|
|
|
2320
2320
|
setIsLoading(true);
|
|
2321
2321
|
const fetchScene = async () => {
|
|
2322
2322
|
try {
|
|
2323
|
-
const response = await fetch(scene_url, fetchOptions);
|
|
2323
|
+
const response = await fetch(options.scene_url, options.fetchOptions);
|
|
2324
2324
|
if (response.ok) {
|
|
2325
2325
|
const text = await response.text();
|
|
2326
2326
|
setScene({ content: text });
|
|
@@ -2377,8 +2377,9 @@ function useScriptBreakdownScene(scene_url, fetchOptions, onAISummarize, onTagAd
|
|
|
2377
2377
|
return [...new Set(chars)];
|
|
2378
2378
|
}, [blocks]);
|
|
2379
2379
|
const handleAISummarize = async () => {
|
|
2380
|
+
var _a;
|
|
2380
2381
|
setIsSummarizing(true);
|
|
2381
|
-
const res = await (onAISummarize == null ? void 0 :
|
|
2382
|
+
const res = await ((_a = options.onAISummarize) == null ? void 0 : _a.call(options, scene.content));
|
|
2382
2383
|
if (res.ok) {
|
|
2383
2384
|
const data = await res.json();
|
|
2384
2385
|
setIsSummarizing(false);
|
|
@@ -2440,11 +2441,10 @@ function useScriptBreakdownScene(scene_url, fetchOptions, onAISummarize, onTagAd
|
|
|
2440
2441
|
setSubLocations((prev) => prev.filter((loc) => loc !== subLocation));
|
|
2441
2442
|
}, []);
|
|
2442
2443
|
react.useEffect(() => {
|
|
2443
|
-
setTags([]);
|
|
2444
2444
|
setSubLocations([]);
|
|
2445
2445
|
setSceneBrief("");
|
|
2446
2446
|
autoTaggedSceneRef.current = null;
|
|
2447
|
-
}, [scene_url]);
|
|
2447
|
+
}, [options.scene_url]);
|
|
2448
2448
|
const clearSelection = react.useCallback(() => {
|
|
2449
2449
|
var _a;
|
|
2450
2450
|
setSelectionMenu(null);
|
|
@@ -2532,6 +2532,7 @@ function useScriptBreakdownScene(scene_url, fetchOptions, onAISummarize, onTagAd
|
|
|
2532
2532
|
}
|
|
2533
2533
|
};
|
|
2534
2534
|
const addTag = async (categoryId) => {
|
|
2535
|
+
var _a;
|
|
2535
2536
|
if (!selectionMenu) return;
|
|
2536
2537
|
const newTag = {
|
|
2537
2538
|
id: uuid(),
|
|
@@ -2549,13 +2550,14 @@ function useScriptBreakdownScene(scene_url, fetchOptions, onAISummarize, onTagAd
|
|
|
2549
2550
|
});
|
|
2550
2551
|
clearSelection();
|
|
2551
2552
|
try {
|
|
2552
|
-
await (onTagAdded == null ? void 0 :
|
|
2553
|
+
await ((_a = options.onTagAdded) == null ? void 0 : _a.call(options, newTag));
|
|
2553
2554
|
} catch (error2) {
|
|
2554
2555
|
console.error("Failed to add tag:", error2);
|
|
2555
2556
|
setTags((prev) => prev.filter((t) => t.id !== newTag.id));
|
|
2556
2557
|
}
|
|
2557
2558
|
};
|
|
2558
2559
|
const removeTag = async (e, id) => {
|
|
2560
|
+
var _a;
|
|
2559
2561
|
e.stopPropagation();
|
|
2560
2562
|
e.preventDefault();
|
|
2561
2563
|
const tagToRemove = tags.find((t) => t.id === id);
|
|
@@ -2563,7 +2565,7 @@ function useScriptBreakdownScene(scene_url, fetchOptions, onAISummarize, onTagAd
|
|
|
2563
2565
|
setTags((prev) => prev.filter((t) => t.id !== id));
|
|
2564
2566
|
clearSelection();
|
|
2565
2567
|
try {
|
|
2566
|
-
await (onTagRemoved == null ? void 0 :
|
|
2568
|
+
await ((_a = options.onTagRemoved) == null ? void 0 : _a.call(options, id));
|
|
2567
2569
|
} catch (error2) {
|
|
2568
2570
|
console.error("Failed to remove tag:", error2);
|
|
2569
2571
|
setTags((prev) => [...prev, tagToRemove]);
|