@vishu1301/script-writing 1.1.6 → 1.1.8

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 CHANGED
@@ -433,7 +433,7 @@ function ScreenplayEditorView({
433
433
  }) }),
434
434
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 shrink-0 relative px-1", children: [
435
435
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-[1px] h-6 bg-zinc-200/80 mx-2 hidden sm:block rounded-full" }),
436
- showPdfImport && /* @__PURE__ */ jsxRuntime.jsx(PdfImporter, { disabled: isLocked, onScriptImported: handleScriptImport, children: /* @__PURE__ */ jsxRuntime.jsx("div", { title: "Import Script", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Upload, { className: "w-[18px] h-[18px]" }) }) }),
436
+ showPdfImport && !isLocked && /* @__PURE__ */ jsxRuntime.jsx(PdfImporter, { disabled: isLocked, onScriptImported: handleScriptImport, children: /* @__PURE__ */ jsxRuntime.jsx("div", { title: "Import Script", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Upload, { className: "w-[18px] h-[18px]" }) }) }),
437
437
  onToggleLock && /* @__PURE__ */ jsxRuntime.jsx(
438
438
  "button",
439
439
  {
@@ -1771,14 +1771,14 @@ var PopcornIcon = ({ isSummarizing }) => /* @__PURE__ */ jsxRuntime.jsxs(
1771
1771
  "path",
1772
1772
  {
1773
1773
  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",
1774
- className: "stroke-yellow-400",
1774
+ stroke: "#facc15",
1775
1775
  strokeWidth: "2"
1776
1776
  }
1777
1777
  ),
1778
- /* @__PURE__ */ jsxRuntime.jsxs("g", { className: "stroke-red-500", strokeWidth: "2", children: [
1778
+ /* @__PURE__ */ jsxRuntime.jsxs("g", { stroke: "#ef4444", strokeWidth: "2", children: [
1779
1779
  /* @__PURE__ */ jsxRuntime.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" }),
1780
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10 22 9 8", className: "stroke-red-500", strokeWidth: "1" }),
1781
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m14 22 1-14", className: "stroke-red-500", strokeWidth: "1" })
1780
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10 22 9 8", strokeWidth: "1" }),
1781
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m14 22 1-14", strokeWidth: "1" })
1782
1782
  ] })
1783
1783
  ]
1784
1784
  }
@@ -1794,15 +1794,31 @@ var SummarizeButton = ({
1794
1794
  disabled: isSummarizing,
1795
1795
  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]"}`,
1796
1796
  children: [
1797
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute inset-0 opacity-0 group-hover:opacity-100 transition duration-700", children: /* @__PURE__ */ jsxRuntime.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]" }) }),
1797
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute inset-0 opacity-0 group-hover:opacity-100 transition duration-700", children: /* @__PURE__ */ jsxRuntime.jsx(
1798
+ "span",
1799
+ {
1800
+ className: "absolute inset-0 blur-3xl opacity-20",
1801
+ style: {
1802
+ backgroundImage: "conic-gradient(from 0deg at 50% 50%, #c084fc, transparent 60%, #fb7185, transparent 90%)",
1803
+ animation: "custom-spin 10s linear infinite"
1804
+ }
1805
+ }
1806
+ ) }),
1798
1807
  /* @__PURE__ */ jsxRuntime.jsx(
1799
1808
  "span",
1800
1809
  {
1801
- 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"}`
1810
+ className: `absolute inset-0 transition-opacity duration-700 ${isSummarizing ? "opacity-100" : "opacity-0"}`,
1811
+ style: {
1812
+ backgroundImage: "radial-gradient(circle at 50% 50%, rgba(139, 92, 246, 0.1), transparent 70%)"
1813
+ }
1802
1814
  }
1803
1815
  ),
1804
1816
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex items-center justify-center gap-4", children: [
1805
1817
  /* @__PURE__ */ jsxRuntime.jsx("style", { children: `
1818
+ @keyframes custom-spin {
1819
+ from { transform: rotate(0deg); }
1820
+ to { transform: rotate(360deg); }
1821
+ }
1806
1822
  @keyframes kernel-pop {
1807
1823
  0% { transform: translate(0, 0) scale(0) rotate(0deg); opacity: 0; }
1808
1824
  10% { opacity: 1; transform: translate(var(--tx1), var(--ty1)) scale(1.3) rotate(45deg); }
@@ -2042,7 +2058,7 @@ function ScriptBreakdownSceneView({
2042
2058
  /* @__PURE__ */ jsxRuntime.jsx(
2043
2059
  "div",
2044
2060
  {
2045
- 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",
2061
+ 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",
2046
2062
  style: {
2047
2063
  fontFamily: COURIER_STACK,
2048
2064
  paddingLeft: "1.5in",
@@ -2124,8 +2140,8 @@ function ScriptBreakdownSceneView({
2124
2140
  const tagToRemove = tags.find(
2125
2141
  (t) => t.block_id === block.id && t.start_index === selectionMenu.startIndex && t.end_index === selectionMenu.endIndex
2126
2142
  );
2127
- if (tagToRemove && tagToRemove.id) {
2128
- removeTag(e, tagToRemove == null ? void 0 : tagToRemove.id);
2143
+ if (tagToRemove) {
2144
+ removeTag(e, tagToRemove.id);
2129
2145
  clearSelection();
2130
2146
  }
2131
2147
  },
@@ -2149,7 +2165,7 @@ function ScriptBreakdownSceneView({
2149
2165
  ))
2150
2166
  }
2151
2167
  ),
2152
- /* @__PURE__ */ jsxRuntime.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: [
2168
+ /* @__PURE__ */ jsxRuntime.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: [
2153
2169
  /* @__PURE__ */ jsxRuntime.jsxs("h3", { className: "text-xs font-extrabold text-slate-800 uppercase tracking-[0.25em] mb-6 flex items-center gap-3 font-sans", children: [
2154
2170
  /* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx(lucideReact.AlignLeft, { className: "w-3.5 h-3.5 text-slate-500" }) }),
2155
2171
  "Scene Brief"
@@ -2288,8 +2304,8 @@ function ScriptBreakdownSceneView({
2288
2304
  ] })
2289
2305
  ] }) });
2290
2306
  }
2291
- function useScriptBreakdownScene(scene_url, fetchOptions, onAISummarize, onTagAdded, onTagRemoved) {
2292
- const [tags, setTags] = react.useState([]);
2307
+ function useScriptBreakdownScene(scene_url, fetchOptions, onAISummarize, onTagAdded, onTagRemoved, preLoadedTags) {
2308
+ const [tags, setTags] = react.useState(preLoadedTags || []);
2293
2309
  const [selectionMenu, setSelectionMenu] = react.useState(null);
2294
2310
  const autoTaggedSceneRef = react.useRef(null);
2295
2311
  const [scene, setScene] = react.useState(null);
@@ -2366,17 +2382,26 @@ function useScriptBreakdownScene(scene_url, fetchOptions, onAISummarize, onTagAd
2366
2382
  if (res.ok) {
2367
2383
  const data = await res.json();
2368
2384
  setIsSummarizing(false);
2369
- const normalData = JSON.parse(data.data);
2370
- const parsedData = Array.isArray(normalData) ? normalData[0] : [];
2371
- const summary = Array.isArray(normalData) ? normalData[1] : "";
2372
- const parsedSummaryData = summary[0];
2373
- setSceneBrief(parsedSummaryData.summarise);
2385
+ let parsedData = [];
2386
+ let parsedSummaryData = {};
2387
+ try {
2388
+ const normalData = JSON.parse(data.data);
2389
+ if (Array.isArray(normalData)) {
2390
+ parsedData = Array.isArray(normalData[0]) ? normalData[0] : [];
2391
+ const summary = Array.isArray(normalData[1]) ? normalData[1] : [];
2392
+ parsedSummaryData = summary[0] || {};
2393
+ }
2394
+ } catch (error2) {
2395
+ console.error("Error parsing AI summary data:", error2);
2396
+ }
2397
+ setSceneBrief(parsedSummaryData.summarise || "");
2374
2398
  const newTags = [];
2375
2399
  parsedData.forEach((aiTag) => {
2376
2400
  if (!aiTag.block_id || !aiTag.category_id || typeof aiTag.start_index !== "number" || typeof aiTag.end_index !== "number") {
2377
2401
  return;
2378
2402
  }
2379
2403
  newTags.push({
2404
+ id: aiTag.id || uuid(),
2380
2405
  block_id: String(aiTag.block_id).startsWith("par") ? String(aiTag.block_id).substring(3) : String(aiTag.block_id),
2381
2406
  category_id: aiTag.category_id,
2382
2407
  name: aiTag.name,