@vishu1301/script-writing 1.3.9 → 1.4.1
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 +32 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +32 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -235,7 +235,7 @@ interface UseShotBreakdownOptions {
|
|
|
235
235
|
onShotRemoved?: (shotId: string) => any;
|
|
236
236
|
onShotUpdated?: (shotId: string, detail: Shot) => any;
|
|
237
237
|
onProductionInitialized?: (cameras: Camera[], type: string) => any;
|
|
238
|
-
|
|
238
|
+
preloadedShots?: Shot[];
|
|
239
239
|
preloadedCameras?: Camera[];
|
|
240
240
|
preloadedSceneType?: string;
|
|
241
241
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -235,7 +235,7 @@ interface UseShotBreakdownOptions {
|
|
|
235
235
|
onShotRemoved?: (shotId: string) => any;
|
|
236
236
|
onShotUpdated?: (shotId: string, detail: Shot) => any;
|
|
237
237
|
onProductionInitialized?: (cameras: Camera[], type: string) => any;
|
|
238
|
-
|
|
238
|
+
preloadedShots?: Shot[];
|
|
239
239
|
preloadedCameras?: Camera[];
|
|
240
240
|
preloadedSceneType?: string;
|
|
241
241
|
}
|
package/dist/index.js
CHANGED
|
@@ -2797,9 +2797,7 @@ function useScriptBreakdownScene(options) {
|
|
|
2797
2797
|
await ((_d = options.onTagUpdated) == null ? void 0 : _d.call(options, id, categoryId || null, details));
|
|
2798
2798
|
} catch (error2) {
|
|
2799
2799
|
console.error("Failed to update tag:", error2);
|
|
2800
|
-
setTags(
|
|
2801
|
-
(prev) => prev.map((t) => t.id === id ? tagToUpdate : t)
|
|
2802
|
-
);
|
|
2800
|
+
setTags((prev) => prev.map((t) => t.id === id ? tagToUpdate : t));
|
|
2803
2801
|
}
|
|
2804
2802
|
};
|
|
2805
2803
|
return {
|
|
@@ -4446,7 +4444,7 @@ function ShotBreakdownView({
|
|
|
4446
4444
|
);
|
|
4447
4445
|
}
|
|
4448
4446
|
function useShotBreakdownScene(options) {
|
|
4449
|
-
const [shots, setShots] = useState(options.
|
|
4447
|
+
const [shots, setShots] = useState(options.preloadedShots || []);
|
|
4450
4448
|
const [cameras, setCameras] = useState(
|
|
4451
4449
|
options.preloadedCameras || []
|
|
4452
4450
|
);
|
|
@@ -4458,6 +4456,34 @@ function useShotBreakdownScene(options) {
|
|
|
4458
4456
|
const [error, setError] = useState(false);
|
|
4459
4457
|
const [selectionMenu, setSelectionMenu] = useState(null);
|
|
4460
4458
|
const menuRef = useRef(null);
|
|
4459
|
+
useEffect(() => {
|
|
4460
|
+
if (options.preloadedShots && options.preloadedShots.length > 0) {
|
|
4461
|
+
setShots((prev) => {
|
|
4462
|
+
if (JSON.stringify(prev) === JSON.stringify(options.preloadedShots)) {
|
|
4463
|
+
return prev;
|
|
4464
|
+
}
|
|
4465
|
+
return options.preloadedShots || [];
|
|
4466
|
+
});
|
|
4467
|
+
}
|
|
4468
|
+
}, [options.preloadedShots]);
|
|
4469
|
+
useEffect(() => {
|
|
4470
|
+
if (options.preloadedCameras && options.preloadedCameras.length > 0) {
|
|
4471
|
+
setCameras((prev) => {
|
|
4472
|
+
if (JSON.stringify(prev) === JSON.stringify(options.preloadedCameras)) {
|
|
4473
|
+
return prev;
|
|
4474
|
+
}
|
|
4475
|
+
return options.preloadedCameras || [];
|
|
4476
|
+
});
|
|
4477
|
+
}
|
|
4478
|
+
}, [options.preloadedCameras]);
|
|
4479
|
+
useEffect(() => {
|
|
4480
|
+
if (options.preloadedSceneType) {
|
|
4481
|
+
setSceneType((prev) => {
|
|
4482
|
+
if (prev === options.preloadedSceneType) return prev;
|
|
4483
|
+
return options.preloadedSceneType || "";
|
|
4484
|
+
});
|
|
4485
|
+
}
|
|
4486
|
+
}, [options.preloadedSceneType]);
|
|
4461
4487
|
useEffect(() => {
|
|
4462
4488
|
setIsLoading(true);
|
|
4463
4489
|
const fetchScene = async () => {
|
|
@@ -4598,10 +4624,10 @@ function useShotBreakdownScene(options) {
|
|
|
4598
4624
|
}
|
|
4599
4625
|
const result = (_a = options.onProductionInitialized) == null ? void 0 : _a.call(options, newCameras, type);
|
|
4600
4626
|
if (result instanceof Promise) {
|
|
4627
|
+
setCameras(newCameras);
|
|
4628
|
+
setSceneType(type);
|
|
4601
4629
|
await result;
|
|
4602
4630
|
}
|
|
4603
|
-
setCameras(newCameras);
|
|
4604
|
-
setSceneType(type);
|
|
4605
4631
|
return result;
|
|
4606
4632
|
};
|
|
4607
4633
|
const addShot = (shotDetails) => {
|