notion-to-jsx 1.2.9 → 1.2.11

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.mjs CHANGED
@@ -1,12 +1,9 @@
1
1
  // src/components/Renderer/index.tsx
2
- import React6, { useState as useState5, useMemo as useMemo2, useCallback } from "react";
3
-
4
- // src/components/Renderer/styles.css.ts
5
- var container = "styles_container__epva5u0";
2
+ import { useMemo as useMemo2, memo as memo2 } from "react";
6
3
 
7
4
  // src/components/Renderer/components/List/styles.css.ts
8
5
  import { createRuntimeFn as _7a468 } from "@vanilla-extract/recipes/createRuntimeFn";
9
- var list = _7a468({ defaultClassName: "styles_list__es8vim0", variantClassNames: { type: { bulleted: "styles_list_type_bulleted__es8vim1", numbered: "styles_list_type_numbered__es8vim2" } }, defaultVariants: {}, compoundVariants: [] });
6
+ var list = _7a468({ defaultClassName: "styles_list__es8vim0", variantClassNames: { type: { bulleted_list_item: "styles_list_type_bulleted_list_item__es8vim1", numbered_list_item: "styles_list_type_numbered_list_item__es8vim2" } }, defaultVariants: {}, compoundVariants: [] });
10
7
  var listItem = "styles_listItem__es8vim3";
11
8
 
12
9
  // src/components/Renderer/components/List/List.tsx
@@ -29,7 +26,7 @@ var ListItem = ({
29
26
  };
30
27
 
31
28
  // src/components/Renderer/components/MemoizedComponents.tsx
32
- import React3 from "react";
29
+ import { memo } from "react";
33
30
 
34
31
  // src/components/Renderer/components/RichText/styles.css.ts
35
32
  import { createRuntimeFn as _7a4682 } from "@vanilla-extract/recipes/createRuntimeFn";
@@ -462,22 +459,16 @@ var LinkPreview = ({ url }) => {
462
459
  var LinkPreview_default = LinkPreview;
463
460
 
464
461
  // src/components/Renderer/components/MemoizedComponents.tsx
465
- var MemoizedRichText = React3.memo(
466
- RichTexts_default,
467
- (prev, next) => {
468
- return JSON.stringify(prev.richTexts) === JSON.stringify(next.richTexts);
469
- }
470
- );
471
- var MemoizedImage = React3.memo(Image_default, (prev, next) => {
462
+ var MemoizedRichText = memo(RichTexts_default, (prev, next) => {
463
+ return JSON.stringify(prev.richTexts) === JSON.stringify(next.richTexts);
464
+ });
465
+ var MemoizedImage = memo(Image_default, (prev, next) => {
472
466
  return prev.src === next.src && prev.alt === next.alt && JSON.stringify(prev.caption) === JSON.stringify(next.caption);
473
467
  });
474
- var MemoizedBookmark = React3.memo(
475
- Bookmark_default,
476
- (prev, next) => {
477
- return prev.url === next.url;
478
- }
479
- );
480
- var MemoizedLinkPreview = React3.memo(
468
+ var MemoizedBookmark = memo(Bookmark_default, (prev, next) => {
469
+ return prev.url === next.url;
470
+ });
471
+ var MemoizedLinkPreview = memo(
481
472
  LinkPreview_default,
482
473
  (prev, next) => {
483
474
  return prev.url === next.url;
@@ -486,46 +477,46 @@ var MemoizedLinkPreview = React3.memo(
486
477
 
487
478
  // src/components/Renderer/components/List/ListBlocksRenderer.tsx
488
479
  import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
489
- var RecursiveListItem = ({ block, index }) => {
490
- const blockProps = {
491
- tabIndex: 0
492
- };
480
+ var RecursiveListItem = ({ block }) => {
493
481
  const blockType = block.type;
494
- const richTexts = block[blockType]?.rich_text;
495
- return /* @__PURE__ */ jsxs4(ListItem, { ...blockProps, children: [
482
+ let content3;
483
+ if (blockType === "bulleted_list_item") {
484
+ content3 = block.bulleted_list_item;
485
+ } else {
486
+ content3 = block.numbered_list_item;
487
+ }
488
+ const richTexts = content3.rich_text;
489
+ const filteredChildren = block.children?.filter(
490
+ (child) => child.type === blockType
491
+ );
492
+ return /* @__PURE__ */ jsxs4(ListItem, { children: [
496
493
  /* @__PURE__ */ jsx7(MemoizedRichText, { richTexts }),
497
- block.children && block.children.length > 0 && /* @__PURE__ */ jsx7(
498
- RecursiveListGroup,
499
- {
500
- blocks: block.children,
501
- type: blockType.split("_")[0]
502
- }
503
- )
494
+ filteredChildren && filteredChildren.length > 0 && /* @__PURE__ */ jsx7(RecursiveListGroup, { blocks: filteredChildren, type: blockType })
504
495
  ] });
505
496
  };
506
497
  var RecursiveListGroup = ({ blocks, type }) => {
507
498
  if (!blocks || blocks.length === 0) return null;
508
- const listItems = blocks.filter(
509
- (block) => block.type === `${type}_list_item`
510
- );
511
- if (listItems.length === 0) return null;
512
499
  return /* @__PURE__ */ jsx7(
513
500
  List,
514
501
  {
515
- as: type === "numbered" ? "ol" : "ul",
502
+ as: type === "numbered_list_item" ? "ol" : "ul",
516
503
  type,
517
504
  role: "list",
518
- "aria-label": type === "bulleted" ? "Bulleted list" : "Numbered list",
519
- children: listItems.map((block, index) => /* @__PURE__ */ jsx7(RecursiveListItem, { block, index }, block.id))
505
+ "aria-label": type,
506
+ children: blocks.map((block) => /* @__PURE__ */ jsx7(RecursiveListItem, { block }, block.id))
520
507
  }
521
508
  );
522
509
  };
523
- var ListBlocksRenderer = ({ blocks, startIndex, type }) => {
510
+ var ListBlocksRenderer = ({
511
+ blocks,
512
+ startIndex,
513
+ type
514
+ }) => {
524
515
  let consecutiveItems = 0;
525
516
  for (let i = startIndex; i < blocks.length; i++) {
526
517
  const block = blocks[i];
527
518
  if (!block) break;
528
- if (block.type === `${type}_list_item`) {
519
+ if (block.type === type) {
529
520
  consecutiveItems++;
530
521
  } else {
531
522
  break;
@@ -535,18 +526,11 @@ var ListBlocksRenderer = ({ blocks, startIndex, type }) => {
535
526
  return /* @__PURE__ */ jsx7(
536
527
  List,
537
528
  {
538
- as: type === "numbered" ? "ol" : "ul",
529
+ as: type === "numbered_list_item" ? "ol" : "ul",
539
530
  type,
540
531
  role: "list",
541
- "aria-label": type === "bulleted" ? "Bulleted list" : "Numbered list",
542
- children: listItems.map((block, index) => /* @__PURE__ */ jsx7(
543
- RecursiveListItem,
544
- {
545
- block,
546
- index: startIndex + index
547
- },
548
- block.id
549
- ))
532
+ "aria-label": type,
533
+ children: listItems.map((block) => /* @__PURE__ */ jsx7(RecursiveListItem, { block }, block.id))
550
534
  }
551
535
  );
552
536
  };
@@ -637,36 +621,27 @@ var columnListContainer = "styles_columnListContainer__wle6we1";
637
621
 
638
622
  // src/components/Renderer/components/Column/Column.tsx
639
623
  import { jsx as jsx10 } from "react/jsx-runtime";
640
- var Column = ({ block, onFocus }) => {
624
+ var Column = ({ block }) => {
641
625
  if (!block || !block.children) return null;
642
- return /* @__PURE__ */ jsx10("div", { className: columnContainer, children: block.children.map((childBlock, index) => /* @__PURE__ */ jsx10(
643
- BlockRenderer_default,
644
- {
645
- block: childBlock,
646
- onFocus,
647
- index,
648
- isColumn: true
649
- },
650
- childBlock.id
651
- )) });
626
+ return /* @__PURE__ */ jsx10("div", { className: columnContainer, children: block.children.map((childBlock) => /* @__PURE__ */ jsx10(BlockRenderer_default, { block: childBlock, isColumn: true }, childBlock.id)) });
652
627
  };
653
628
  var Column_default = Column;
654
629
 
655
630
  // src/components/Renderer/components/Column/ColumnList.tsx
656
631
  import { jsx as jsx11 } from "react/jsx-runtime";
657
- var ColumnList = ({ block, onFocus }) => {
632
+ var ColumnList = ({ block }) => {
658
633
  if (!block || !block.children) return null;
659
- return /* @__PURE__ */ jsx11("div", { className: columnListContainer, children: block.children.map((column) => /* @__PURE__ */ jsx11(Column_default, { block: column, onFocus }, column.id)) });
634
+ return /* @__PURE__ */ jsx11("div", { className: columnListContainer, children: block.children.map((column) => /* @__PURE__ */ jsx11(Column_default, { block: column }, column.id)) });
660
635
  };
661
636
  var ColumnList_default = ColumnList;
662
637
 
663
638
  // src/components/Renderer/components/Quote/styles.css.ts
664
- var container2 = "styles_container__mra9n0";
639
+ var container = "styles_container__mra9n0";
665
640
 
666
641
  // src/components/Renderer/components/Quote/Quote.tsx
667
642
  import { jsx as jsx12 } from "react/jsx-runtime";
668
643
  var Quote = ({ richTexts, tabIndex }) => {
669
- return /* @__PURE__ */ jsx12("blockquote", { className: container2, tabIndex, children: /* @__PURE__ */ jsx12(MemoizedRichText, { richTexts }) });
644
+ return /* @__PURE__ */ jsx12("blockquote", { className: container, tabIndex, children: /* @__PURE__ */ jsx12(MemoizedRichText, { richTexts }) });
670
645
  };
671
646
  var Quote_default = Quote;
672
647
 
@@ -712,23 +687,18 @@ var TableRow_default = TableRow;
712
687
 
713
688
  // src/components/Renderer/components/Table/Table.tsx
714
689
  import { Fragment as Fragment3, jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
715
- var Table = ({ block, tabIndex = 0 }) => {
690
+ var Table = ({ block }) => {
716
691
  if (!block.table || !block.children) {
717
692
  return null;
718
693
  }
719
694
  const { table_width, has_column_header, has_row_header } = block.table;
720
- const rows = block.children?.filter(
721
- (child) => child.type === "table_row"
722
- ) || [];
723
- return /* @__PURE__ */ jsx14("div", { className: tableContainer, children: /* @__PURE__ */ jsx14("table", { className: table, tabIndex, children: rows.length > 0 && /* @__PURE__ */ jsxs6(Fragment3, { children: [
695
+ const rows = block.children?.filter((child) => child.type === "table_row") || [];
696
+ return /* @__PURE__ */ jsx14("div", { className: tableContainer, children: /* @__PURE__ */ jsx14("table", { className: table, children: rows.length > 0 && /* @__PURE__ */ jsxs6(Fragment3, { children: [
724
697
  has_column_header && rows[0] && /* @__PURE__ */ jsx14("thead", { children: /* @__PURE__ */ jsx14(TableRow_default, { rowBlock: rows[0], cellClassName: headerCell }) }),
725
- /* @__PURE__ */ jsx14("tbody", { children: rows.filter(
726
- (row) => row !== void 0 && row.type === "table_row"
727
- ).map((row, rowIndex) => {
698
+ /* @__PURE__ */ jsx14("tbody", { children: rows.filter((row) => row !== void 0 && row.type === "table_row").map((row, rowIndex) => {
728
699
  if (has_column_header && rowIndex === 0) {
729
700
  return null;
730
701
  }
731
- const actualRowIndex = has_column_header ? rowIndex - 1 : rowIndex;
732
702
  return /* @__PURE__ */ jsx14(
733
703
  TableRow_default,
734
704
  {
@@ -757,7 +727,7 @@ var toggleIconOpen = "styles_toggleIconOpen__p7ue1z3";
757
727
 
758
728
  // src/components/Renderer/components/Toggle/Toggle.tsx
759
729
  import { jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
760
- var Toggle = ({ block, tabIndex = 0, onFocus }) => {
730
+ var Toggle = ({ block }) => {
761
731
  const [isOpen, setIsOpen] = useState3(false);
762
732
  if (!block.toggle || !block.children) {
763
733
  return null;
@@ -778,8 +748,6 @@ var Toggle = ({ block, tabIndex = 0, onFocus }) => {
778
748
  className: toggleHeader,
779
749
  onClick: handleToggle,
780
750
  onKeyDown: handleKeyDown,
781
- tabIndex,
782
- onFocus,
783
751
  role: "button",
784
752
  "aria-expanded": isOpen,
785
753
  children: [
@@ -788,56 +756,94 @@ var Toggle = ({ block, tabIndex = 0, onFocus }) => {
788
756
  ]
789
757
  }
790
758
  ),
791
- isOpen && block.children && /* @__PURE__ */ jsx15("div", { className: toggleContent, children: block.children.map((childBlock, index) => /* @__PURE__ */ jsx15(
792
- BlockRenderer_default,
793
- {
794
- block: childBlock,
795
- index
796
- },
797
- childBlock.id
798
- )) })
759
+ isOpen && block.children && /* @__PURE__ */ jsx15("div", { className: toggleContent, children: block.children.map((childBlock) => /* @__PURE__ */ jsx15(BlockRenderer_default, { block: childBlock }, childBlock.id)) })
799
760
  ] });
800
761
  };
801
762
  var Toggle_default = Toggle;
802
763
 
764
+ // src/components/Renderer/components/Video/styles.css.ts
765
+ var videoCaption = "styles_videoCaption__15b9vkb2";
766
+ var videoContainer = "styles_videoContainer__15b9vkb0";
767
+ var videoPlayer = "styles_videoPlayer__15b9vkb1";
768
+
769
+ // src/components/Renderer/components/Video/Video.tsx
770
+ import { jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
771
+ var Video = ({ block }) => {
772
+ if (block.type !== "video" || !block.video) {
773
+ return null;
774
+ }
775
+ const { type, external, caption: caption2 } = block.video;
776
+ let videoUrl = "";
777
+ if (type === "external") {
778
+ videoUrl = getVideoEmbedUrl(external?.url);
779
+ }
780
+ if (!videoUrl) {
781
+ return /* @__PURE__ */ jsx16("p", { children: "\uBE44\uB514\uC624\uB97C \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4." });
782
+ }
783
+ return /* @__PURE__ */ jsxs8("div", { className: videoContainer, children: [
784
+ videoUrl.includes("youtube.com/embed/") ? /* @__PURE__ */ jsx16(
785
+ "iframe",
786
+ {
787
+ className: videoPlayer,
788
+ src: videoUrl,
789
+ title: "YouTube video player",
790
+ allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
791
+ allowFullScreen: true
792
+ }
793
+ ) : /* @__PURE__ */ jsxs8("p", { children: [
794
+ "\uC678\uBD80 \uBE44\uB514\uC624 \uB9C1\uD06C:",
795
+ " ",
796
+ /* @__PURE__ */ jsx16("a", { href: videoUrl, target: "_blank", rel: "noopener noreferrer", children: videoUrl })
797
+ ] }),
798
+ caption2 && caption2.length > 0 && /* @__PURE__ */ jsx16("figcaption", { className: videoCaption, children: caption2.map((c, i) => /* @__PURE__ */ jsx16("span", { children: c.plain_text }, i)) })
799
+ ] });
800
+ };
801
+ var getVideoEmbedUrl = (url) => {
802
+ if (!url) return "";
803
+ if (url.includes("youtu.be/")) {
804
+ const videoId = url.split("youtu.be/")[1]?.split("?")[0];
805
+ if (videoId) {
806
+ return `https://www.youtube.com/embed/${videoId}`;
807
+ }
808
+ } else if (url.includes("youtube.com/watch?v=")) {
809
+ const videoId = url.split("watch?v=")[1]?.split("&")[0];
810
+ if (videoId) {
811
+ return `https://www.youtube.com/embed/${videoId}`;
812
+ }
813
+ }
814
+ return url;
815
+ };
816
+ var Video_default = Video;
817
+
803
818
  // src/components/Renderer/components/Block/BlockRenderer.tsx
804
- import { jsx as jsx16 } from "react/jsx-runtime";
805
- var BlockRenderer = ({
806
- block,
807
- onFocus,
808
- index,
809
- isColumn = false
810
- }) => {
819
+ import { jsx as jsx17 } from "react/jsx-runtime";
820
+ var BlockRenderer = ({ block, isColumn = false }) => {
811
821
  if (!block) return null;
812
- const blockProps = {
813
- tabIndex: 0,
814
- onFocus
815
- };
816
822
  switch (block.type) {
817
823
  case "link_preview":
818
- return /* @__PURE__ */ jsx16(MemoizedLinkPreview, { url: block.link_preview.url, ...blockProps });
824
+ return /* @__PURE__ */ jsx17(MemoizedLinkPreview, { url: block.link_preview.url });
819
825
  case "paragraph":
820
- return /* @__PURE__ */ jsx16(Paragraph, { ...blockProps, children: /* @__PURE__ */ jsx16(MemoizedRichText, { richTexts: block.paragraph.rich_text }) });
826
+ return /* @__PURE__ */ jsx17(Paragraph, { children: /* @__PURE__ */ jsx17(MemoizedRichText, { richTexts: block.paragraph.rich_text }) });
821
827
  case "heading_1":
822
- return /* @__PURE__ */ jsx16(Heading1, { ...blockProps, children: /* @__PURE__ */ jsx16(MemoizedRichText, { richTexts: block.heading_1.rich_text }) });
828
+ return /* @__PURE__ */ jsx17(Heading1, { children: /* @__PURE__ */ jsx17(MemoizedRichText, { richTexts: block.heading_1.rich_text }) });
823
829
  case "heading_2":
824
- return /* @__PURE__ */ jsx16(Heading2, { ...blockProps, children: /* @__PURE__ */ jsx16(MemoizedRichText, { richTexts: block.heading_2.rich_text }) });
830
+ return /* @__PURE__ */ jsx17(Heading2, { children: /* @__PURE__ */ jsx17(MemoizedRichText, { richTexts: block.heading_2.rich_text }) });
825
831
  case "heading_3":
826
- return /* @__PURE__ */ jsx16(Heading3, { ...blockProps, children: /* @__PURE__ */ jsx16(MemoizedRichText, { richTexts: block.heading_3.rich_text }) });
832
+ return /* @__PURE__ */ jsx17(Heading3, { children: /* @__PURE__ */ jsx17(MemoizedRichText, { richTexts: block.heading_3.rich_text }) });
827
833
  case "code":
828
- return /* @__PURE__ */ jsx16("div", { ...blockProps, children: /* @__PURE__ */ jsx16(
834
+ return /* @__PURE__ */ jsx17("div", { children: /* @__PURE__ */ jsx17(
829
835
  CodeBlock_default,
830
836
  {
831
- code: block.code.rich_text[0].text.content,
837
+ code: block.code.rich_text[0]?.text?.content || "",
832
838
  language: block.code.language,
833
- caption: block.code.caption?.[0]?.plain_text
839
+ caption: block.code.caption
834
840
  }
835
841
  ) });
836
842
  case "image":
837
- return /* @__PURE__ */ jsx16("figure", { ...blockProps, children: /* @__PURE__ */ jsx16(
843
+ return /* @__PURE__ */ jsx17("figure", { children: /* @__PURE__ */ jsx17(
838
844
  MemoizedImage,
839
845
  {
840
- src: block.image.file?.url || block.image.external?.url,
846
+ src: block.image.file?.url || block.image.external?.url || "",
841
847
  alt: block.image.caption?.[0]?.plain_text || "",
842
848
  caption: block.image.caption,
843
849
  format: block.image.format,
@@ -845,7 +851,7 @@ var BlockRenderer = ({
845
851
  }
846
852
  ) });
847
853
  case "bookmark":
848
- return /* @__PURE__ */ jsx16(
854
+ return /* @__PURE__ */ jsx17(
849
855
  MemoizedBookmark,
850
856
  {
851
857
  url: block.bookmark.url,
@@ -853,36 +859,27 @@ var BlockRenderer = ({
853
859
  }
854
860
  );
855
861
  case "column_list":
856
- return /* @__PURE__ */ jsx16(ColumnList_default, { block, onFocus });
862
+ return /* @__PURE__ */ jsx17(ColumnList_default, { block });
857
863
  case "column":
858
864
  return null;
859
865
  case "quote":
860
- return /* @__PURE__ */ jsx16(Quote_default, { richTexts: block.quote.rich_text, ...blockProps });
866
+ return /* @__PURE__ */ jsx17(Quote_default, { richTexts: block.quote.rich_text });
861
867
  case "table":
862
- return /* @__PURE__ */ jsx16(Table_default2, { block, tabIndex: blockProps.tabIndex });
868
+ return /* @__PURE__ */ jsx17(Table_default2, { block });
863
869
  case "toggle":
864
- return /* @__PURE__ */ jsx16(
865
- Toggle_default,
866
- {
867
- block,
868
- tabIndex: blockProps.tabIndex,
869
- onFocus
870
- }
871
- );
870
+ return /* @__PURE__ */ jsx17(Toggle_default, { block });
871
+ case "video":
872
+ return /* @__PURE__ */ jsx17(Video_default, { block });
872
873
  default:
873
874
  return null;
874
875
  }
875
876
  };
876
877
  var BlockRenderer_default = BlockRenderer;
877
878
 
878
- // src/styles/theme.css.ts
879
- var darkTheme = "theme_darkTheme__sq3jkb1n";
880
- var lightTheme = "theme_lightTheme__sq3jkb1m";
881
-
882
879
  // src/components/Title/index.tsx
883
- import { jsx as jsx17 } from "react/jsx-runtime";
880
+ import { jsx as jsx18 } from "react/jsx-runtime";
884
881
  var Title = ({ title: title3 }) => {
885
- return /* @__PURE__ */ jsx17(Heading1, { children: title3 });
882
+ return /* @__PURE__ */ jsx18(Heading1, { children: title3 });
886
883
  };
887
884
  var Title_default = Title;
888
885
 
@@ -896,12 +893,12 @@ var imageStyle2 = _7a4684({ defaultClassName: "styles_imageStyle__p0cp8d4", vari
896
893
  var skeletonWrapper2 = _7a4684({ defaultClassName: "styles_skeletonWrapper__p0cp8d1", variantClassNames: { isLoaded: { true: "styles_skeletonWrapper_isLoaded_true__p0cp8d2", false: "styles_skeletonWrapper_isLoaded_false__p0cp8d3" } }, defaultVariants: { isLoaded: false }, compoundVariants: [] });
897
894
 
898
895
  // src/components/Cover/index.tsx
899
- import { jsx as jsx18, jsxs as jsxs8 } from "react/jsx-runtime";
896
+ import { jsx as jsx19, jsxs as jsxs9 } from "react/jsx-runtime";
900
897
  var Cover = ({ src, alt }) => {
901
898
  const [isLoaded, setIsLoaded] = useState4(false);
902
- return /* @__PURE__ */ jsxs8("div", { className: coverContainer, children: [
903
- /* @__PURE__ */ jsx18("div", { className: skeletonWrapper2({ isLoaded }), children: /* @__PURE__ */ jsx18(Skeleton_default, { variant: "image" }) }),
904
- /* @__PURE__ */ jsx18(
899
+ return /* @__PURE__ */ jsxs9("div", { className: coverContainer, children: [
900
+ /* @__PURE__ */ jsx19("div", { className: skeletonWrapper2({ isLoaded }), children: /* @__PURE__ */ jsx19(Skeleton_default, { variant: "image" }) }),
901
+ /* @__PURE__ */ jsx19(
905
902
  "img",
906
903
  {
907
904
  src,
@@ -915,81 +912,69 @@ var Cover = ({ src, alt }) => {
915
912
  };
916
913
  var Cover_default = Cover;
917
914
 
915
+ // src/components/Renderer/styles.css.ts
916
+ var container2 = "styles_container__epva5u0";
917
+
918
+ // src/styles/theme.css.ts
919
+ var darkTheme = "theme_darkTheme__sq3jkb1n";
920
+ var lightTheme = "theme_lightTheme__sq3jkb1m";
921
+
918
922
  // src/components/Renderer/index.tsx
919
- import { Fragment as Fragment4, jsx as jsx19, jsxs as jsxs9 } from "react/jsx-runtime";
920
- var Renderer = React6.memo(
921
- ({ blocks, isDarkMode = false, title: title3, cover, onBlockFocus }) => {
922
- const theme = isDarkMode ? darkTheme : lightTheme;
923
- const [focusedIndex, setFocusedIndex] = useState5(-1);
924
- const handleBlockFocus = useCallback(
925
- (index) => {
926
- setFocusedIndex(index);
927
- onBlockFocus?.(index);
928
- },
929
- [onBlockFocus]
930
- );
931
- const renderedBlocks = useMemo2(() => {
932
- const result = [];
933
- for (let i = 0; i < blocks.length; i++) {
934
- const block = blocks[i];
935
- if (!block) break;
936
- const handleListItem = (listType) => {
937
- const listItemType = `${listType}_list_item`;
938
- if (block.type === listItemType && (i === 0 || blocks[i - 1]?.type !== listItemType)) {
939
- result.push(
940
- /* @__PURE__ */ jsx19(
941
- ListBlocksRenderer_default,
942
- {
943
- blocks,
944
- startIndex: i,
945
- type: listType
946
- },
947
- block.id
948
- )
949
- );
950
- while (i + 1 < blocks.length && blocks[i + 1] && blocks[i + 1]?.type === listItemType) {
951
- i++;
952
- }
953
- return true;
954
- }
955
- return false;
956
- };
957
- if (handleListItem("bulleted") || handleListItem("numbered")) {
958
- continue;
959
- } else {
923
+ import { Fragment as Fragment4, jsx as jsx20, jsxs as jsxs10 } from "react/jsx-runtime";
924
+ var Renderer = memo2(({ blocks, isDarkMode = false, title: title3, cover }) => {
925
+ const theme = isDarkMode ? darkTheme : lightTheme;
926
+ const renderedBlocks = useMemo2(() => {
927
+ const result = [];
928
+ for (let i = 0; i < blocks.length; i++) {
929
+ const block = blocks[i];
930
+ if (!block) break;
931
+ const handleListItem = (listType) => {
932
+ const listItemType = `${listType}_list_item`;
933
+ if (block.type === listItemType && (i === 0 || blocks[i - 1]?.type !== listItemType)) {
960
934
  result.push(
961
- /* @__PURE__ */ jsx19(
962
- BlockRenderer_default,
935
+ /* @__PURE__ */ jsx20(
936
+ ListBlocksRenderer_default,
963
937
  {
964
- block,
965
- index: i,
966
- onFocus: () => handleBlockFocus(i)
938
+ blocks,
939
+ startIndex: i,
940
+ type: listItemType
967
941
  },
968
942
  block.id
969
943
  )
970
944
  );
945
+ while (i + 1 < blocks.length && blocks[i + 1] && blocks[i + 1]?.type === listItemType) {
946
+ i++;
947
+ }
948
+ return true;
971
949
  }
950
+ return false;
951
+ };
952
+ if (handleListItem("bulleted") || handleListItem("numbered")) {
953
+ continue;
954
+ } else {
955
+ result.push(/* @__PURE__ */ jsx20(BlockRenderer_default, { block }, block.id));
972
956
  }
973
- return result;
974
- }, [blocks, handleBlockFocus]);
975
- return /* @__PURE__ */ jsxs9(Fragment4, { children: [
976
- cover && /* @__PURE__ */ jsx19(Cover_default, { src: cover, alt: title3 || "Notion page content" }),
977
- /* @__PURE__ */ jsxs9(
978
- "article",
979
- {
980
- className: `${theme} ${container}`,
981
- "aria-label": title3 || "Notion page content",
982
- children: [
983
- title3 && /* @__PURE__ */ jsx19(Title_default, { title: title3 }),
984
- renderedBlocks
985
- ]
986
- }
987
- )
988
- ] });
989
- }
990
- );
957
+ }
958
+ return result;
959
+ }, [blocks]);
960
+ return /* @__PURE__ */ jsxs10(Fragment4, { children: [
961
+ cover && /* @__PURE__ */ jsx20(Cover_default, { src: cover, alt: title3 || "Notion page content" }),
962
+ /* @__PURE__ */ jsxs10(
963
+ "article",
964
+ {
965
+ className: `${theme} ${container2}`,
966
+ "aria-label": title3 || "Notion page content",
967
+ children: [
968
+ title3 && /* @__PURE__ */ jsx20(Title_default, { title: title3 }),
969
+ renderedBlocks
970
+ ]
971
+ }
972
+ )
973
+ ] });
974
+ });
991
975
  Renderer.displayName = "Renderer";
976
+ var Renderer_default = Renderer;
992
977
  export {
993
- Renderer
978
+ Renderer_default as Renderer
994
979
  };
995
980
  //# sourceMappingURL=index.mjs.map