notion-to-jsx 1.2.8 → 1.2.10

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
@@ -30,19 +30,16 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
- Renderer: () => Renderer
33
+ Renderer: () => Renderer_default
34
34
  });
35
35
  module.exports = __toCommonJS(index_exports);
36
36
 
37
37
  // src/components/Renderer/index.tsx
38
- var import_react7 = __toESM(require("react"));
39
-
40
- // src/components/Renderer/styles.css.ts
41
- var container = "styles_container__epva5u0";
38
+ var import_react7 = require("react");
42
39
 
43
40
  // src/components/Renderer/components/List/styles.css.ts
44
41
  var import_createRuntimeFn = require("@vanilla-extract/recipes/createRuntimeFn");
45
- var list = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "styles_list__es8vim0", variantClassNames: { type: { bulleted: "styles_list_type_bulleted__es8vim1", numbered: "styles_list_type_numbered__es8vim2" } }, defaultVariants: {}, compoundVariants: [] });
42
+ var list = (0, import_createRuntimeFn.createRuntimeFn)({ 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: [] });
46
43
  var listItem = "styles_listItem__es8vim3";
47
44
 
48
45
  // src/components/Renderer/components/List/List.tsx
@@ -65,12 +62,12 @@ var ListItem = ({
65
62
  };
66
63
 
67
64
  // src/components/Renderer/components/MemoizedComponents.tsx
68
- var import_react3 = __toESM(require("react"));
65
+ var import_react3 = require("react");
69
66
 
70
67
  // src/components/Renderer/components/RichText/styles.css.ts
71
68
  var import_createRuntimeFn2 = require("@vanilla-extract/recipes/createRuntimeFn");
72
69
  var link = "styles_link__fdf3twq";
73
- var richText = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "styles_richText__fdf3tw0", variantClassNames: { bold: { true: "styles_richText_bold_true__fdf3tw1" }, italic: { true: "styles_richText_italic_true__fdf3tw2" }, strikethrough: { true: "styles_richText_strikethrough_true__fdf3tw3" }, underline: { true: "styles_richText_underline_true__fdf3tw4" }, code: { true: "styles_richText_code_true__fdf3tw5" }, color: { "default": "styles_richText_color_default__fdf3tw6", gray: "styles_richText_color_gray__fdf3tw7", brown: "styles_richText_color_brown__fdf3tw8", orange: "styles_richText_color_orange__fdf3tw9", yellow: "styles_richText_color_yellow__fdf3twa", green: "styles_richText_color_green__fdf3twb", blue: "styles_richText_color_blue__fdf3twc", purple: "styles_richText_color_purple__fdf3twd", pink: "styles_richText_color_pink__fdf3twe", red: "styles_richText_color_red__fdf3twf", gray_background: "styles_richText_color_gray_background__fdf3twg", brown_background: "styles_richText_color_brown_background__fdf3twh", orange_background: "styles_richText_color_orange_background__fdf3twi", yellow_background: "styles_richText_color_yellow_background__fdf3twj", green_background: "styles_richText_color_green_background__fdf3twk", blue_background: "styles_richText_color_blue_background__fdf3twl", purple_background: "styles_richText_color_purple_background__fdf3twm", pink_background: "styles_richText_color_pink_background__fdf3twn", red_background: "styles_richText_color_red_background__fdf3two" } }, defaultVariants: {}, compoundVariants: [[{ strikethrough: true, underline: true }, "styles_richText_compound_0__fdf3twp"]] });
70
+ var richText = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "styles__fdf3tw0", variantClassNames: { bold: { true: "styles_richText_bold_true__fdf3tw1" }, italic: { true: "styles_richText_italic_true__fdf3tw2" }, strikethrough: { true: "styles_richText_strikethrough_true__fdf3tw3" }, underline: { true: "styles_richText_underline_true__fdf3tw4" }, code: { true: "styles_richText_code_true__fdf3tw5" }, color: { "default": "styles_richText_color_default__fdf3tw6", gray: "styles_richText_color_gray__fdf3tw7", brown: "styles_richText_color_brown__fdf3tw8", orange: "styles_richText_color_orange__fdf3tw9", yellow: "styles_richText_color_yellow__fdf3twa", green: "styles_richText_color_green__fdf3twb", blue: "styles_richText_color_blue__fdf3twc", purple: "styles_richText_color_purple__fdf3twd", pink: "styles_richText_color_pink__fdf3twe", red: "styles_richText_color_red__fdf3twf", gray_background: "styles_richText_color_gray_background__fdf3twg", brown_background: "styles_richText_color_brown_background__fdf3twh", orange_background: "styles_richText_color_orange_background__fdf3twi", yellow_background: "styles_richText_color_yellow_background__fdf3twj", green_background: "styles_richText_color_green_background__fdf3twk", blue_background: "styles_richText_color_blue_background__fdf3twl", purple_background: "styles_richText_color_purple_background__fdf3twm", pink_background: "styles_richText_color_pink_background__fdf3twn", red_background: "styles_richText_color_red_background__fdf3two" } }, defaultVariants: {}, compoundVariants: [[{ strikethrough: true, underline: true }, "styles_richText_compound_0__fdf3twp"]] });
74
71
 
75
72
  // src/components/Renderer/components/RichText/RichTexts.tsx
76
73
  var import_jsx_runtime2 = require("react/jsx-runtime");
@@ -498,22 +495,16 @@ var LinkPreview = ({ url }) => {
498
495
  var LinkPreview_default = LinkPreview;
499
496
 
500
497
  // src/components/Renderer/components/MemoizedComponents.tsx
501
- var MemoizedRichText = import_react3.default.memo(
502
- RichTexts_default,
503
- (prev, next) => {
504
- return JSON.stringify(prev.richTexts) === JSON.stringify(next.richTexts);
505
- }
506
- );
507
- var MemoizedImage = import_react3.default.memo(Image_default, (prev, next) => {
498
+ var MemoizedRichText = (0, import_react3.memo)(RichTexts_default, (prev, next) => {
499
+ return JSON.stringify(prev.richTexts) === JSON.stringify(next.richTexts);
500
+ });
501
+ var MemoizedImage = (0, import_react3.memo)(Image_default, (prev, next) => {
508
502
  return prev.src === next.src && prev.alt === next.alt && JSON.stringify(prev.caption) === JSON.stringify(next.caption);
509
503
  });
510
- var MemoizedBookmark = import_react3.default.memo(
511
- Bookmark_default,
512
- (prev, next) => {
513
- return prev.url === next.url;
514
- }
515
- );
516
- var MemoizedLinkPreview = import_react3.default.memo(
504
+ var MemoizedBookmark = (0, import_react3.memo)(Bookmark_default, (prev, next) => {
505
+ return prev.url === next.url;
506
+ });
507
+ var MemoizedLinkPreview = (0, import_react3.memo)(
517
508
  LinkPreview_default,
518
509
  (prev, next) => {
519
510
  return prev.url === next.url;
@@ -522,46 +513,46 @@ var MemoizedLinkPreview = import_react3.default.memo(
522
513
 
523
514
  // src/components/Renderer/components/List/ListBlocksRenderer.tsx
524
515
  var import_jsx_runtime7 = require("react/jsx-runtime");
525
- var RecursiveListItem = ({ block, index }) => {
526
- const blockProps = {
527
- tabIndex: 0
528
- };
516
+ var RecursiveListItem = ({ block }) => {
529
517
  const blockType = block.type;
530
- const richTexts = block[blockType]?.rich_text;
531
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(ListItem, { ...blockProps, children: [
518
+ let content3;
519
+ if (blockType === "bulleted_list_item") {
520
+ content3 = block.bulleted_list_item;
521
+ } else {
522
+ content3 = block.numbered_list_item;
523
+ }
524
+ const richTexts = content3.rich_text;
525
+ const filteredChildren = block.children?.filter(
526
+ (child) => child.type === blockType
527
+ );
528
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(ListItem, { children: [
532
529
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MemoizedRichText, { richTexts }),
533
- block.children && block.children.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
534
- RecursiveListGroup,
535
- {
536
- blocks: block.children,
537
- type: blockType.split("_")[0]
538
- }
539
- )
530
+ filteredChildren && filteredChildren.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(RecursiveListGroup, { blocks: filteredChildren, type: blockType })
540
531
  ] });
541
532
  };
542
533
  var RecursiveListGroup = ({ blocks, type }) => {
543
534
  if (!blocks || blocks.length === 0) return null;
544
- const listItems = blocks.filter(
545
- (block) => block.type === `${type}_list_item`
546
- );
547
- if (listItems.length === 0) return null;
548
535
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
549
536
  List,
550
537
  {
551
- as: type === "numbered" ? "ol" : "ul",
538
+ as: type === "numbered_list_item" ? "ol" : "ul",
552
539
  type,
553
540
  role: "list",
554
- "aria-label": type === "bulleted" ? "Bulleted list" : "Numbered list",
555
- children: listItems.map((block, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(RecursiveListItem, { block, index }, block.id))
541
+ "aria-label": type,
542
+ children: blocks.map((block) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(RecursiveListItem, { block }, block.id))
556
543
  }
557
544
  );
558
545
  };
559
- var ListBlocksRenderer = ({ blocks, startIndex, type }) => {
546
+ var ListBlocksRenderer = ({
547
+ blocks,
548
+ startIndex,
549
+ type
550
+ }) => {
560
551
  let consecutiveItems = 0;
561
552
  for (let i = startIndex; i < blocks.length; i++) {
562
553
  const block = blocks[i];
563
554
  if (!block) break;
564
- if (block.type === `${type}_list_item`) {
555
+ if (block.type === type) {
565
556
  consecutiveItems++;
566
557
  } else {
567
558
  break;
@@ -571,18 +562,11 @@ var ListBlocksRenderer = ({ blocks, startIndex, type }) => {
571
562
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
572
563
  List,
573
564
  {
574
- as: type === "numbered" ? "ol" : "ul",
565
+ as: type === "numbered_list_item" ? "ol" : "ul",
575
566
  type,
576
567
  role: "list",
577
- "aria-label": type === "bulleted" ? "Bulleted list" : "Numbered list",
578
- children: listItems.map((block, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
579
- RecursiveListItem,
580
- {
581
- block,
582
- index: startIndex + index
583
- },
584
- block.id
585
- ))
568
+ "aria-label": type,
569
+ children: listItems.map((block) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(RecursiveListItem, { block }, block.id))
586
570
  }
587
571
  );
588
572
  };
@@ -673,36 +657,27 @@ var columnListContainer = "styles_columnListContainer__wle6we1";
673
657
 
674
658
  // src/components/Renderer/components/Column/Column.tsx
675
659
  var import_jsx_runtime10 = require("react/jsx-runtime");
676
- var Column = ({ block, onFocus }) => {
660
+ var Column = ({ block }) => {
677
661
  if (!block || !block.children) return null;
678
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: columnContainer, children: block.children.map((childBlock, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
679
- BlockRenderer_default,
680
- {
681
- block: childBlock,
682
- onFocus,
683
- index,
684
- isColumn: true
685
- },
686
- childBlock.id
687
- )) });
662
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: columnContainer, children: block.children.map((childBlock) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(BlockRenderer_default, { block: childBlock, isColumn: true }, childBlock.id)) });
688
663
  };
689
664
  var Column_default = Column;
690
665
 
691
666
  // src/components/Renderer/components/Column/ColumnList.tsx
692
667
  var import_jsx_runtime11 = require("react/jsx-runtime");
693
- var ColumnList = ({ block, onFocus }) => {
668
+ var ColumnList = ({ block }) => {
694
669
  if (!block || !block.children) return null;
695
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: columnListContainer, children: block.children.map((column) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Column_default, { block: column, onFocus }, column.id)) });
670
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: columnListContainer, children: block.children.map((column) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Column_default, { block: column }, column.id)) });
696
671
  };
697
672
  var ColumnList_default = ColumnList;
698
673
 
699
674
  // src/components/Renderer/components/Quote/styles.css.ts
700
- var container2 = "styles_container__mra9n0";
675
+ var container = "styles_container__mra9n0";
701
676
 
702
677
  // src/components/Renderer/components/Quote/Quote.tsx
703
678
  var import_jsx_runtime12 = require("react/jsx-runtime");
704
679
  var Quote = ({ richTexts, tabIndex }) => {
705
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("blockquote", { className: container2, tabIndex, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MemoizedRichText, { richTexts }) });
680
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("blockquote", { className: container, tabIndex, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MemoizedRichText, { richTexts }) });
706
681
  };
707
682
  var Quote_default = Quote;
708
683
 
@@ -748,23 +723,18 @@ var TableRow_default = TableRow;
748
723
 
749
724
  // src/components/Renderer/components/Table/Table.tsx
750
725
  var import_jsx_runtime14 = require("react/jsx-runtime");
751
- var Table = ({ block, tabIndex = 0 }) => {
726
+ var Table = ({ block }) => {
752
727
  if (!block.table || !block.children) {
753
728
  return null;
754
729
  }
755
730
  const { table_width, has_column_header, has_row_header } = block.table;
756
- const rows = block.children?.filter(
757
- (child) => child.type === "table_row"
758
- ) || [];
759
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: tableContainer, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("table", { className: table, tabIndex, children: rows.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
731
+ const rows = block.children?.filter((child) => child.type === "table_row") || [];
732
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: tableContainer, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("table", { className: table, children: rows.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
760
733
  has_column_header && rows[0] && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TableRow_default, { rowBlock: rows[0], cellClassName: headerCell }) }),
761
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tbody", { children: rows.filter(
762
- (row) => row !== void 0 && row.type === "table_row"
763
- ).map((row, rowIndex) => {
734
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tbody", { children: rows.filter((row) => row !== void 0 && row.type === "table_row").map((row, rowIndex) => {
764
735
  if (has_column_header && rowIndex === 0) {
765
736
  return null;
766
737
  }
767
- const actualRowIndex = has_column_header ? rowIndex - 1 : rowIndex;
768
738
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
769
739
  TableRow_default,
770
740
  {
@@ -793,7 +763,7 @@ var toggleIconOpen = "styles_toggleIconOpen__p7ue1z3";
793
763
 
794
764
  // src/components/Renderer/components/Toggle/Toggle.tsx
795
765
  var import_jsx_runtime15 = require("react/jsx-runtime");
796
- var Toggle = ({ block, tabIndex = 0, onFocus }) => {
766
+ var Toggle = ({ block }) => {
797
767
  const [isOpen, setIsOpen] = (0, import_react5.useState)(false);
798
768
  if (!block.toggle || !block.children) {
799
769
  return null;
@@ -814,8 +784,6 @@ var Toggle = ({ block, tabIndex = 0, onFocus }) => {
814
784
  className: toggleHeader,
815
785
  onClick: handleToggle,
816
786
  onKeyDown: handleKeyDown,
817
- tabIndex,
818
- onFocus,
819
787
  role: "button",
820
788
  "aria-expanded": isOpen,
821
789
  children: [
@@ -824,56 +792,40 @@ var Toggle = ({ block, tabIndex = 0, onFocus }) => {
824
792
  ]
825
793
  }
826
794
  ),
827
- isOpen && block.children && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: toggleContent, children: block.children.map((childBlock, index) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
828
- BlockRenderer_default,
829
- {
830
- block: childBlock,
831
- index
832
- },
833
- childBlock.id
834
- )) })
795
+ isOpen && block.children && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: toggleContent, children: block.children.map((childBlock) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(BlockRenderer_default, { block: childBlock }, childBlock.id)) })
835
796
  ] });
836
797
  };
837
798
  var Toggle_default = Toggle;
838
799
 
839
800
  // src/components/Renderer/components/Block/BlockRenderer.tsx
840
801
  var import_jsx_runtime16 = require("react/jsx-runtime");
841
- var BlockRenderer = ({
842
- block,
843
- onFocus,
844
- index,
845
- isColumn = false
846
- }) => {
802
+ var BlockRenderer = ({ block, isColumn = false }) => {
847
803
  if (!block) return null;
848
- const blockProps = {
849
- tabIndex: 0,
850
- onFocus
851
- };
852
804
  switch (block.type) {
853
805
  case "link_preview":
854
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(MemoizedLinkPreview, { url: block.link_preview.url, ...blockProps });
806
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(MemoizedLinkPreview, { url: block.link_preview.url });
855
807
  case "paragraph":
856
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Paragraph, { ...blockProps, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(MemoizedRichText, { richTexts: block.paragraph.rich_text }) });
808
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Paragraph, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(MemoizedRichText, { richTexts: block.paragraph.rich_text }) });
857
809
  case "heading_1":
858
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Heading1, { ...blockProps, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(MemoizedRichText, { richTexts: block.heading_1.rich_text }) });
810
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Heading1, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(MemoizedRichText, { richTexts: block.heading_1.rich_text }) });
859
811
  case "heading_2":
860
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Heading2, { ...blockProps, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(MemoizedRichText, { richTexts: block.heading_2.rich_text }) });
812
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Heading2, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(MemoizedRichText, { richTexts: block.heading_2.rich_text }) });
861
813
  case "heading_3":
862
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Heading3, { ...blockProps, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(MemoizedRichText, { richTexts: block.heading_3.rich_text }) });
814
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Heading3, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(MemoizedRichText, { richTexts: block.heading_3.rich_text }) });
863
815
  case "code":
864
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { ...blockProps, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
816
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
865
817
  CodeBlock_default,
866
818
  {
867
- code: block.code.rich_text[0].text.content,
819
+ code: block.code.rich_text[0]?.text?.content || "",
868
820
  language: block.code.language,
869
- caption: block.code.caption?.[0]?.plain_text
821
+ caption: block.code.caption
870
822
  }
871
823
  ) });
872
824
  case "image":
873
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("figure", { ...blockProps, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
825
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("figure", { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
874
826
  MemoizedImage,
875
827
  {
876
- src: block.image.file?.url || block.image.external?.url,
828
+ src: block.image.file?.url || block.image.external?.url || "",
877
829
  alt: block.image.caption?.[0]?.plain_text || "",
878
830
  caption: block.image.caption,
879
831
  format: block.image.format,
@@ -889,32 +841,21 @@ var BlockRenderer = ({
889
841
  }
890
842
  );
891
843
  case "column_list":
892
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ColumnList_default, { block, onFocus });
844
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ColumnList_default, { block });
893
845
  case "column":
894
846
  return null;
895
847
  case "quote":
896
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Quote_default, { richTexts: block.quote.rich_text, ...blockProps });
848
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Quote_default, { richTexts: block.quote.rich_text });
897
849
  case "table":
898
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Table_default2, { block, tabIndex: blockProps.tabIndex });
850
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Table_default2, { block });
899
851
  case "toggle":
900
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
901
- Toggle_default,
902
- {
903
- block,
904
- tabIndex: blockProps.tabIndex,
905
- onFocus
906
- }
907
- );
852
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Toggle_default, { block });
908
853
  default:
909
854
  return null;
910
855
  }
911
856
  };
912
857
  var BlockRenderer_default = BlockRenderer;
913
858
 
914
- // src/styles/theme.css.ts
915
- var darkTheme = "theme_darkTheme__sq3jkb1n";
916
- var lightTheme = "theme_lightTheme__sq3jkb1m";
917
-
918
859
  // src/components/Title/index.tsx
919
860
  var import_jsx_runtime17 = require("react/jsx-runtime");
920
861
  var Title = ({ title: title3 }) => {
@@ -951,80 +892,68 @@ var Cover = ({ src, alt }) => {
951
892
  };
952
893
  var Cover_default = Cover;
953
894
 
895
+ // src/components/Renderer/styles.css.ts
896
+ var container2 = "styles_container__epva5u0";
897
+
898
+ // src/styles/theme.css.ts
899
+ var darkTheme = "theme_darkTheme__sq3jkb1n";
900
+ var lightTheme = "theme_lightTheme__sq3jkb1m";
901
+
954
902
  // src/components/Renderer/index.tsx
955
903
  var import_jsx_runtime19 = require("react/jsx-runtime");
956
- var Renderer = import_react7.default.memo(
957
- ({ blocks, isDarkMode = false, title: title3, cover, onBlockFocus }) => {
958
- const theme = isDarkMode ? darkTheme : lightTheme;
959
- const [focusedIndex, setFocusedIndex] = (0, import_react7.useState)(-1);
960
- const handleBlockFocus = (0, import_react7.useCallback)(
961
- (index) => {
962
- setFocusedIndex(index);
963
- onBlockFocus?.(index);
964
- },
965
- [onBlockFocus]
966
- );
967
- const renderedBlocks = (0, import_react7.useMemo)(() => {
968
- const result = [];
969
- for (let i = 0; i < blocks.length; i++) {
970
- const block = blocks[i];
971
- if (!block) break;
972
- const handleListItem = (listType) => {
973
- const listItemType = `${listType}_list_item`;
974
- if (block.type === listItemType && (i === 0 || blocks[i - 1]?.type !== listItemType)) {
975
- result.push(
976
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
977
- ListBlocksRenderer_default,
978
- {
979
- blocks,
980
- startIndex: i,
981
- type: listType
982
- },
983
- block.id
984
- )
985
- );
986
- while (i + 1 < blocks.length && blocks[i + 1] && blocks[i + 1]?.type === listItemType) {
987
- i++;
988
- }
989
- return true;
990
- }
991
- return false;
992
- };
993
- if (handleListItem("bulleted") || handleListItem("numbered")) {
994
- continue;
995
- } else {
904
+ var Renderer = (0, import_react7.memo)(({ blocks, isDarkMode = false, title: title3, cover }) => {
905
+ const theme = isDarkMode ? darkTheme : lightTheme;
906
+ const renderedBlocks = (0, import_react7.useMemo)(() => {
907
+ const result = [];
908
+ for (let i = 0; i < blocks.length; i++) {
909
+ const block = blocks[i];
910
+ if (!block) break;
911
+ const handleListItem = (listType) => {
912
+ const listItemType = `${listType}_list_item`;
913
+ if (block.type === listItemType && (i === 0 || blocks[i - 1]?.type !== listItemType)) {
996
914
  result.push(
997
915
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
998
- BlockRenderer_default,
916
+ ListBlocksRenderer_default,
999
917
  {
1000
- block,
1001
- index: i,
1002
- onFocus: () => handleBlockFocus(i)
918
+ blocks,
919
+ startIndex: i,
920
+ type: listItemType
1003
921
  },
1004
922
  block.id
1005
923
  )
1006
924
  );
925
+ while (i + 1 < blocks.length && blocks[i + 1] && blocks[i + 1]?.type === listItemType) {
926
+ i++;
927
+ }
928
+ return true;
1007
929
  }
930
+ return false;
931
+ };
932
+ if (handleListItem("bulleted") || handleListItem("numbered")) {
933
+ continue;
934
+ } else {
935
+ result.push(/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(BlockRenderer_default, { block }, block.id));
1008
936
  }
1009
- return result;
1010
- }, [blocks, handleBlockFocus]);
1011
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
1012
- cover && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Cover_default, { src: cover, alt: title3 || "Notion page content" }),
1013
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
1014
- "article",
1015
- {
1016
- className: `${theme} ${container}`,
1017
- "aria-label": title3 || "Notion page content",
1018
- children: [
1019
- title3 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Title_default, { title: title3 }),
1020
- renderedBlocks
1021
- ]
1022
- }
1023
- )
1024
- ] });
1025
- }
1026
- );
937
+ }
938
+ return result;
939
+ }, [blocks]);
940
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
941
+ cover && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Cover_default, { src: cover, alt: title3 || "Notion page content" }),
942
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
943
+ "article",
944
+ {
945
+ className: `${theme} ${container2}`,
946
+ "aria-label": title3 || "Notion page content",
947
+ children: [
948
+ title3 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Title_default, { title: title3 }),
949
+ renderedBlocks
950
+ ]
951
+ }
952
+ )
953
+ ] });
954
+ });
1027
955
  Renderer.displayName = "Renderer";
956
+ var Renderer_default = Renderer;
1028
957
  // Annotate the CommonJS export names for ESM import in node:
1029
958
  0 && (module.exports = {
1030
959
  Renderer