@vishu1301/script-writing 1.0.2 → 1.0.4

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.js CHANGED
@@ -306,10 +306,10 @@ function ScreenplayEditorView({
306
306
  handleSceneNumberChange
307
307
  }) {
308
308
  const [isRulesOpen, setIsRulesOpen] = useState(false);
309
- const screenplayFont = "'Courier Prime', Courier, monospace";
309
+ const COURIER_STACK = "'Courier Prime', 'Courier', monospace";
310
310
  useEffect(() => {
311
311
  const fontId = "google-font-courier-prime";
312
- const styleId = "screenplay-editor-force-font";
312
+ const styleId = "screenplay-editor-force-v4";
313
313
  if (!document.getElementById(fontId)) {
314
314
  const link = document.createElement("link");
315
315
  link.id = fontId;
@@ -320,70 +320,80 @@ function ScreenplayEditorView({
320
320
  if (!document.getElementById(styleId)) {
321
321
  const style = document.createElement("style");
322
322
  style.id = styleId;
323
- style.textContent = style.textContent = `
324
- [data-screenplay-editor],
325
- [data-screenplay-editor] *,
326
- [data-screenplay-editor] [contenteditable="true"],
327
- .font-screenplay-container,
328
- .font-screenplay-container div,
329
- .font-screenplay-container span {
330
- font-family: 'Courier Prime', Courier, monospace !important;
331
- }
332
- `;
323
+ style.textContent = `
324
+ /* We target by the data-attribute to ensure the highest specificity possible */
325
+ [data-screenplay-editor] *,
326
+ [data-screenplay-editor] div,
327
+ [data-screenplay-editor] span,
328
+ [data-screenplay-editor] [contenteditable="true"] {
329
+ font-family: ${COURIER_STACK} !important;
330
+ -webkit-font-smoothing: antialiased;
331
+ }
332
+ `;
333
333
  document.head.appendChild(style);
334
334
  }
335
- }, [screenplayFont]);
335
+ }, [COURIER_STACK]);
336
336
  return /* @__PURE__ */ jsxs(Fragment, { children: [
337
- /* @__PURE__ */ jsx("div", { className: "sticky top-6 z-50 bg-white backdrop-blur-xl border border-white/10 rounded-full shadow-2xl flex gap-1 max-w-fit p-1.5 mb-12 select-none overflow-x-auto custom-scrollbar", children: blockTypes.map((type) => {
338
- var _a;
339
- const selected = ((_a = blocks.find((b) => b.id === focusedBlockId)) == null ? void 0 : _a.type) === type;
340
- return /* @__PURE__ */ jsxs(
341
- "button",
342
- {
343
- type: "button",
344
- className: `flex items-center gap-2 px-4 py-2.5 rounded-full font-medium text-sm transition-all duration-300 ${selected ? "bg-zinc-900 text-white shadow-sm" : "text-zinc-400 hover:bg-zinc-800/10 hover:text-zinc-800"}`,
345
- onClick: () => handleBlockTypeChange(type),
346
- children: [
347
- /* @__PURE__ */ jsx(
348
- "input",
349
- {
350
- type: "radio",
351
- name: "blockType",
352
- id: `block-type-${type}`,
353
- className: "sr-only",
354
- "aria-label": blockStyles[type].label,
355
- checked: selected,
356
- readOnly: true
357
- }
358
- ),
359
- /* @__PURE__ */ jsxs(
360
- "label",
361
- {
362
- htmlFor: `block-type-${type}`,
363
- className: "flex items-center gap-2 cursor-pointer",
364
- children: [
365
- icons[type],
366
- /* @__PURE__ */ jsx("span", { className: "whitespace-nowrap hidden sm:inline", children: blockStyles[type].label })
367
- ]
368
- }
369
- )
370
- ]
337
+ /* @__PURE__ */ jsx(
338
+ "div",
339
+ {
340
+ className: "sticky top-6 z-50 bg-white backdrop-blur-xl border border-white/10 rounded-full shadow-2xl flex gap-1 p-1.5 mb-12 select-none overflow-x-auto custom-scrollbar",
341
+ style: {
342
+ maxWidth: "1024px"
371
343
  },
372
- type
373
- );
374
- }) }),
344
+ children: blockTypes.map((type) => {
345
+ var _a;
346
+ const selected = ((_a = blocks.find((b) => b.id === focusedBlockId)) == null ? void 0 : _a.type) === type;
347
+ return /* @__PURE__ */ jsxs(
348
+ "button",
349
+ {
350
+ type: "button",
351
+ className: `flex items-center gap-2 px-4 py-2.5 rounded-full font-medium text-sm transition-all duration-300 ${selected ? "bg-zinc-900 text-white shadow-sm" : "text-zinc-400 hover:bg-zinc-800/10 hover:text-zinc-800"}`,
352
+ onClick: () => handleBlockTypeChange(type),
353
+ children: [
354
+ /* @__PURE__ */ jsx(
355
+ "input",
356
+ {
357
+ type: "radio",
358
+ name: "blockType",
359
+ id: `block-type-${type}`,
360
+ className: "sr-only",
361
+ "aria-label": blockStyles[type].label,
362
+ checked: selected,
363
+ readOnly: true
364
+ }
365
+ ),
366
+ /* @__PURE__ */ jsxs(
367
+ "label",
368
+ {
369
+ htmlFor: `block-type-${type}`,
370
+ className: "flex items-center gap-2 cursor-pointer",
371
+ children: [
372
+ icons[type],
373
+ /* @__PURE__ */ jsx("span", { className: "whitespace-nowrap hidden sm:inline", children: blockStyles[type].label })
374
+ ]
375
+ }
376
+ )
377
+ ]
378
+ },
379
+ type
380
+ );
381
+ })
382
+ }
383
+ ),
375
384
  /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-12 w-full items-center pb-24", children: /* @__PURE__ */ jsx(
376
385
  "div",
377
386
  {
378
- 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-[297mm] shrink-0 font-screenplay-container",
387
+ 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-[297mm] shrink-0",
379
388
  style: {
380
- fontFamily: screenplayFont,
389
+ fontFamily: COURIER_STACK,
381
390
  paddingLeft: "1.5in",
382
391
  paddingRight: "1in",
383
392
  paddingTop: "1in",
384
393
  paddingBottom: "1in",
385
394
  lineHeight: "1.2"
386
395
  },
396
+ "data-screenplay-editor": "true",
387
397
  children: blocks.map((block) => {
388
398
  var _a, _b;
389
399
  return /* @__PURE__ */ jsx(