@vishu1301/script-writing 1.1.7 → 1.1.9

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.d.cts CHANGED
@@ -107,7 +107,7 @@ declare function ScriptBreakdownSceneView({ blocks, characters, isLoading, scene
107
107
  } | null;
108
108
  handleMouseUp: () => void;
109
109
  addTag: (c: ElementCategory) => void;
110
- removeTag: (e: React__default.MouseEvent, id: string) => void;
110
+ removeTag: (e: React__default.MouseEvent, id?: string) => void;
111
111
  clearSelection: () => void;
112
112
  menuPlacement: "top" | "bottom";
113
113
  menuRef: React__default.RefObject<HTMLDivElement | null>;
package/dist/index.d.ts CHANGED
@@ -107,7 +107,7 @@ declare function ScriptBreakdownSceneView({ blocks, characters, isLoading, scene
107
107
  } | null;
108
108
  handleMouseUp: () => void;
109
109
  addTag: (c: ElementCategory) => void;
110
- removeTag: (e: React__default.MouseEvent, id: string) => void;
110
+ removeTag: (e: React__default.MouseEvent, id?: string) => void;
111
111
  clearSelection: () => void;
112
112
  menuPlacement: "top" | "bottom";
113
113
  menuRef: React__default.RefObject<HTMLDivElement | null>;
package/dist/index.js CHANGED
@@ -408,7 +408,7 @@ function ScreenplayEditorView({
408
408
  }) }),
409
409
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 shrink-0 relative px-1", children: [
410
410
  /* @__PURE__ */ jsx("div", { className: "w-[1px] h-6 bg-zinc-200/80 mx-2 hidden sm:block rounded-full" }),
411
- showPdfImport && /* @__PURE__ */ jsx(PdfImporter, { disabled: isLocked, onScriptImported: handleScriptImport, children: /* @__PURE__ */ jsx("div", { title: "Import Script", children: /* @__PURE__ */ jsx(Upload, { className: "w-[18px] h-[18px]" }) }) }),
411
+ showPdfImport && !isLocked && /* @__PURE__ */ jsx(PdfImporter, { disabled: isLocked, onScriptImported: handleScriptImport, children: /* @__PURE__ */ jsx("div", { title: "Import Script", children: /* @__PURE__ */ jsx(Upload, { className: "w-[18px] h-[18px]" }) }) }),
412
412
  onToggleLock && /* @__PURE__ */ jsx(
413
413
  "button",
414
414
  {
@@ -1746,14 +1746,14 @@ var PopcornIcon = ({ isSummarizing }) => /* @__PURE__ */ jsxs(
1746
1746
  "path",
1747
1747
  {
1748
1748
  d: "M18 8a2 2 0 0 0 0-4 2 2 0 0 0-4 0 2 2 0 0 0-4 0 2 2 0 0 0-4 0 2 2 0 0 0 0 4",
1749
- className: "stroke-yellow-400",
1749
+ stroke: "#facc15",
1750
1750
  strokeWidth: "2"
1751
1751
  }
1752
1752
  ),
1753
- /* @__PURE__ */ jsxs("g", { className: "stroke-red-500", strokeWidth: "2", children: [
1753
+ /* @__PURE__ */ jsxs("g", { stroke: "#ef4444", strokeWidth: "2", children: [
1754
1754
  /* @__PURE__ */ jsx("path", { d: "M20 8c.5 0 .9.4.8 1l-2.6 12c-.1.5-.7 1-1.2 1H7c-.6 0-1.1-.4-1.2-1L3.2 9c-.1-.6.3-1 .8-1Z" }),
1755
- /* @__PURE__ */ jsx("path", { d: "M10 22 9 8", className: "stroke-red-500", strokeWidth: "1" }),
1756
- /* @__PURE__ */ jsx("path", { d: "m14 22 1-14", className: "stroke-red-500", strokeWidth: "1" })
1755
+ /* @__PURE__ */ jsx("path", { d: "M10 22 9 8", strokeWidth: "1" }),
1756
+ /* @__PURE__ */ jsx("path", { d: "m14 22 1-14", strokeWidth: "1" })
1757
1757
  ] })
1758
1758
  ]
1759
1759
  }
@@ -1769,15 +1769,31 @@ var SummarizeButton = ({
1769
1769
  disabled: isSummarizing,
1770
1770
  className: `group relative w-full py-4 px-8 rounded-[3rem] transition-all duration-500 ease-[cubic-bezier(0.22,1,0.36,1)] border ${isSummarizing ? "bg-zinc-100 border-zinc-300 opacity-100 cursor-wait shadow-inner" : "bg-gradient-to-b from-white via-zinc-50 to-zinc-100 border-white/70 shadow-[0_10px_30px_-10px_rgba(0,0,0,0.12),inset_0_1px_0_rgba(255,255,255,0.8)] hover:shadow-[0_20px_50px_-15px_rgba(139,92,246,0.3)] hover:-translate-y-[2px] active:scale-[0.98]"}`,
1771
1771
  children: [
1772
- /* @__PURE__ */ jsx("span", { className: "absolute inset-0 opacity-0 group-hover:opacity-100 transition duration-700", children: /* @__PURE__ */ jsx("span", { className: "absolute inset-0 bg-[conic-gradient(from_0deg_at_50%_50%,#c084fc,transparent_60%,#fb7185,transparent_90%)] blur-3xl opacity-20 animate-[spin_10s_linear_infinite]" }) }),
1772
+ /* @__PURE__ */ jsx("span", { className: "absolute inset-0 opacity-0 group-hover:opacity-100 transition duration-700", children: /* @__PURE__ */ jsx(
1773
+ "span",
1774
+ {
1775
+ className: "absolute inset-0 blur-3xl opacity-20",
1776
+ style: {
1777
+ backgroundImage: "conic-gradient(from 0deg at 50% 50%, #c084fc, transparent 60%, #fb7185, transparent 90%)",
1778
+ animation: "custom-spin 10s linear infinite"
1779
+ }
1780
+ }
1781
+ ) }),
1773
1782
  /* @__PURE__ */ jsx(
1774
1783
  "span",
1775
1784
  {
1776
- className: `absolute inset-0 transition-opacity duration-700 bg-[radial-gradient(circle_at_50%_50%,rgba(139,92,246,0.1),transparent_70%)] ${isSummarizing ? "opacity-100" : "opacity-0"}`
1785
+ className: `absolute inset-0 transition-opacity duration-700 ${isSummarizing ? "opacity-100" : "opacity-0"}`,
1786
+ style: {
1787
+ backgroundImage: "radial-gradient(circle at 50% 50%, rgba(139, 92, 246, 0.1), transparent 70%)"
1788
+ }
1777
1789
  }
1778
1790
  ),
1779
1791
  /* @__PURE__ */ jsxs("div", { className: "relative flex items-center justify-center gap-4", children: [
1780
1792
  /* @__PURE__ */ jsx("style", { children: `
1793
+ @keyframes custom-spin {
1794
+ from { transform: rotate(0deg); }
1795
+ to { transform: rotate(360deg); }
1796
+ }
1781
1797
  @keyframes kernel-pop {
1782
1798
  0% { transform: translate(0, 0) scale(0) rotate(0deg); opacity: 0; }
1783
1799
  10% { opacity: 1; transform: translate(var(--tx1), var(--ty1)) scale(1.3) rotate(45deg); }
@@ -2017,7 +2033,7 @@ function ScriptBreakdownSceneView({
2017
2033
  /* @__PURE__ */ jsx(
2018
2034
  "div",
2019
2035
  {
2020
- className: "relative bg-[#fdfdfc] shadow-2xl shadow-zinc-300/60 border border-zinc-100 rounded-sm md:rounded-md pl-[1.5in] py-[1in] pr-[1in] flex flex-col w-[210mm] min-h-auto shrink-0",
2036
+ className: "relative bg-[#fdfdfc] shadow-md shadow-zinc-300/60 border border-zinc-100 rounded-sm md:rounded-md pl-[1.5in] py-[1in] pr-[1in] flex flex-col w-[210mm] min-h-auto shrink-0",
2021
2037
  style: {
2022
2038
  fontFamily: COURIER_STACK,
2023
2039
  paddingLeft: "1.5in",
@@ -2099,8 +2115,8 @@ function ScriptBreakdownSceneView({
2099
2115
  const tagToRemove = tags.find(
2100
2116
  (t) => t.block_id === block.id && t.start_index === selectionMenu.startIndex && t.end_index === selectionMenu.endIndex
2101
2117
  );
2102
- if (tagToRemove && tagToRemove.id) {
2103
- removeTag(e, tagToRemove == null ? void 0 : tagToRemove.id);
2118
+ if (tagToRemove) {
2119
+ removeTag(e, tagToRemove.id);
2104
2120
  clearSelection();
2105
2121
  }
2106
2122
  },
@@ -2124,7 +2140,7 @@ function ScriptBreakdownSceneView({
2124
2140
  ))
2125
2141
  }
2126
2142
  ),
2127
- /* @__PURE__ */ jsxs("div", { className: "relative bg-[#fdfdfc] shadow-2xl shadow-zinc-300/60 border border-zinc-100 rounded-sm md:rounded-md flex flex-col w-[210mm] shrink-0 p-8 md:p-12 lg:p-16", children: [
2143
+ /* @__PURE__ */ jsxs("div", { className: "relative bg-[#fdfdfc] shadow-md shadow-zinc-300/60 border border-zinc-100 rounded-sm md:rounded-md flex flex-col w-[210mm] shrink-0 p-8 md:p-12 lg:p-16", children: [
2128
2144
  /* @__PURE__ */ jsxs("h3", { className: "text-xs font-extrabold text-slate-800 uppercase tracking-[0.25em] mb-6 flex items-center gap-3 font-sans", children: [
2129
2145
  /* @__PURE__ */ jsx("span", { className: "flex items-center justify-center w-8 h-8 rounded-full bg-slate-100/80 shadow-inner border border-slate-200/50", children: /* @__PURE__ */ jsx(AlignLeft, { className: "w-3.5 h-3.5 text-slate-500" }) }),
2130
2146
  "Scene Brief"
@@ -2341,17 +2357,26 @@ function useScriptBreakdownScene(scene_url, fetchOptions, onAISummarize, onTagAd
2341
2357
  if (res.ok) {
2342
2358
  const data = await res.json();
2343
2359
  setIsSummarizing(false);
2344
- const normalData = JSON.parse(data.data);
2345
- const parsedData = Array.isArray(normalData) ? normalData[0] : [];
2346
- const summary = Array.isArray(normalData) ? normalData[1] : "";
2347
- const parsedSummaryData = summary[0];
2348
- setSceneBrief(parsedSummaryData.summarise);
2360
+ let parsedData = [];
2361
+ let parsedSummaryData = {};
2362
+ try {
2363
+ const normalData = JSON.parse(data.data);
2364
+ if (Array.isArray(normalData)) {
2365
+ parsedData = Array.isArray(normalData[0]) ? normalData[0] : [];
2366
+ const summary = Array.isArray(normalData[1]) ? normalData[1] : [];
2367
+ parsedSummaryData = summary[0] || {};
2368
+ }
2369
+ } catch (error2) {
2370
+ console.error("Error parsing AI summary data:", error2);
2371
+ }
2372
+ setSceneBrief(parsedSummaryData.summarise || "");
2349
2373
  const newTags = [];
2350
2374
  parsedData.forEach((aiTag) => {
2351
2375
  if (!aiTag.block_id || !aiTag.category_id || typeof aiTag.start_index !== "number" || typeof aiTag.end_index !== "number") {
2352
2376
  return;
2353
2377
  }
2354
2378
  newTags.push({
2379
+ id: aiTag.id || uuid(),
2355
2380
  block_id: String(aiTag.block_id).startsWith("par") ? String(aiTag.block_id).substring(3) : String(aiTag.block_id),
2356
2381
  category_id: aiTag.category_id,
2357
2382
  name: aiTag.name,
@@ -2395,40 +2420,6 @@ function useScriptBreakdownScene(scene_url, fetchOptions, onAISummarize, onTagAd
2395
2420
  setSceneBrief("");
2396
2421
  autoTaggedSceneRef.current = null;
2397
2422
  }, [scene_url]);
2398
- useEffect(() => {
2399
- if (blocks.length > 0 && characters.length > 0 && autoTaggedSceneRef.current !== scene) {
2400
- const autoTags = [];
2401
- const escapeRegExp = (string) => string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
2402
- const sortedChars = [...characters].sort((a, b) => b.length - a.length);
2403
- blocks.forEach((block) => {
2404
- sortedChars.forEach((char) => {
2405
- const escapedChar = escapeRegExp(char);
2406
- const regex = new RegExp(`\\b${escapedChar}\\b`, "gi");
2407
- let match;
2408
- while ((match = regex.exec(block.text)) !== null) {
2409
- const isOverlapping = autoTags.some(
2410
- (t) => t.block_id === block.id && match.index + char.length > t.start_index && match.index < t.end_index
2411
- );
2412
- if (!isOverlapping) {
2413
- autoTags.push({
2414
- id: uuid(),
2415
- block_id: block.id,
2416
- category_id: "CAST",
2417
- name: block.text.substring(
2418
- match.index,
2419
- match.index + char.length
2420
- ),
2421
- start_index: match.index,
2422
- end_index: match.index + char.length
2423
- });
2424
- }
2425
- }
2426
- });
2427
- });
2428
- setTags(autoTags);
2429
- autoTaggedSceneRef.current = scene;
2430
- }
2431
- }, [blocks, characters, scene]);
2432
2423
  const clearSelection = useCallback(() => {
2433
2424
  var _a;
2434
2425
  setSelectionMenu(null);