@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.cjs CHANGED
@@ -331,10 +331,10 @@ function ScreenplayEditorView({
331
331
  handleSceneNumberChange
332
332
  }) {
333
333
  const [isRulesOpen, setIsRulesOpen] = react.useState(false);
334
- const screenplayFont = "'Courier Prime', Courier, monospace";
334
+ const COURIER_STACK = "'Courier Prime', 'Courier', monospace";
335
335
  react.useEffect(() => {
336
336
  const fontId = "google-font-courier-prime";
337
- const styleId = "screenplay-editor-force-font";
337
+ const styleId = "screenplay-editor-force-v4";
338
338
  if (!document.getElementById(fontId)) {
339
339
  const link = document.createElement("link");
340
340
  link.id = fontId;
@@ -345,70 +345,80 @@ function ScreenplayEditorView({
345
345
  if (!document.getElementById(styleId)) {
346
346
  const style = document.createElement("style");
347
347
  style.id = styleId;
348
- style.textContent = style.textContent = `
349
- [data-screenplay-editor],
350
- [data-screenplay-editor] *,
351
- [data-screenplay-editor] [contenteditable="true"],
352
- .font-screenplay-container,
353
- .font-screenplay-container div,
354
- .font-screenplay-container span {
355
- font-family: 'Courier Prime', Courier, monospace !important;
356
- }
357
- `;
348
+ style.textContent = `
349
+ /* We target by the data-attribute to ensure the highest specificity possible */
350
+ [data-screenplay-editor] *,
351
+ [data-screenplay-editor] div,
352
+ [data-screenplay-editor] span,
353
+ [data-screenplay-editor] [contenteditable="true"] {
354
+ font-family: ${COURIER_STACK} !important;
355
+ -webkit-font-smoothing: antialiased;
356
+ }
357
+ `;
358
358
  document.head.appendChild(style);
359
359
  }
360
- }, [screenplayFont]);
360
+ }, [COURIER_STACK]);
361
361
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
362
- /* @__PURE__ */ jsxRuntime.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) => {
363
- var _a;
364
- const selected = ((_a = blocks.find((b) => b.id === focusedBlockId)) == null ? void 0 : _a.type) === type;
365
- return /* @__PURE__ */ jsxRuntime.jsxs(
366
- "button",
367
- {
368
- type: "button",
369
- 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"}`,
370
- onClick: () => handleBlockTypeChange(type),
371
- children: [
372
- /* @__PURE__ */ jsxRuntime.jsx(
373
- "input",
374
- {
375
- type: "radio",
376
- name: "blockType",
377
- id: `block-type-${type}`,
378
- className: "sr-only",
379
- "aria-label": blockStyles[type].label,
380
- checked: selected,
381
- readOnly: true
382
- }
383
- ),
384
- /* @__PURE__ */ jsxRuntime.jsxs(
385
- "label",
386
- {
387
- htmlFor: `block-type-${type}`,
388
- className: "flex items-center gap-2 cursor-pointer",
389
- children: [
390
- icons[type],
391
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "whitespace-nowrap hidden sm:inline", children: blockStyles[type].label })
392
- ]
393
- }
394
- )
395
- ]
362
+ /* @__PURE__ */ jsxRuntime.jsx(
363
+ "div",
364
+ {
365
+ 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",
366
+ style: {
367
+ maxWidth: "1024px"
396
368
  },
397
- type
398
- );
399
- }) }),
369
+ children: blockTypes.map((type) => {
370
+ var _a;
371
+ const selected = ((_a = blocks.find((b) => b.id === focusedBlockId)) == null ? void 0 : _a.type) === type;
372
+ return /* @__PURE__ */ jsxRuntime.jsxs(
373
+ "button",
374
+ {
375
+ type: "button",
376
+ 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"}`,
377
+ onClick: () => handleBlockTypeChange(type),
378
+ children: [
379
+ /* @__PURE__ */ jsxRuntime.jsx(
380
+ "input",
381
+ {
382
+ type: "radio",
383
+ name: "blockType",
384
+ id: `block-type-${type}`,
385
+ className: "sr-only",
386
+ "aria-label": blockStyles[type].label,
387
+ checked: selected,
388
+ readOnly: true
389
+ }
390
+ ),
391
+ /* @__PURE__ */ jsxRuntime.jsxs(
392
+ "label",
393
+ {
394
+ htmlFor: `block-type-${type}`,
395
+ className: "flex items-center gap-2 cursor-pointer",
396
+ children: [
397
+ icons[type],
398
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "whitespace-nowrap hidden sm:inline", children: blockStyles[type].label })
399
+ ]
400
+ }
401
+ )
402
+ ]
403
+ },
404
+ type
405
+ );
406
+ })
407
+ }
408
+ ),
400
409
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-12 w-full items-center pb-24", children: /* @__PURE__ */ jsxRuntime.jsx(
401
410
  "div",
402
411
  {
403
- 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",
412
+ 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",
404
413
  style: {
405
- fontFamily: screenplayFont,
414
+ fontFamily: COURIER_STACK,
406
415
  paddingLeft: "1.5in",
407
416
  paddingRight: "1in",
408
417
  paddingTop: "1in",
409
418
  paddingBottom: "1in",
410
419
  lineHeight: "1.2"
411
420
  },
421
+ "data-screenplay-editor": "true",
412
422
  children: blocks.map((block) => {
413
423
  var _a, _b;
414
424
  return /* @__PURE__ */ jsxRuntime.jsx(