notion-to-jsx 1.2.10 → 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
@@ -761,23 +761,77 @@ var Toggle = ({ block }) => {
761
761
  };
762
762
  var Toggle_default = Toggle;
763
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
+
764
818
  // src/components/Renderer/components/Block/BlockRenderer.tsx
765
- import { jsx as jsx16 } from "react/jsx-runtime";
819
+ import { jsx as jsx17 } from "react/jsx-runtime";
766
820
  var BlockRenderer = ({ block, isColumn = false }) => {
767
821
  if (!block) return null;
768
822
  switch (block.type) {
769
823
  case "link_preview":
770
- return /* @__PURE__ */ jsx16(MemoizedLinkPreview, { url: block.link_preview.url });
824
+ return /* @__PURE__ */ jsx17(MemoizedLinkPreview, { url: block.link_preview.url });
771
825
  case "paragraph":
772
- return /* @__PURE__ */ jsx16(Paragraph, { children: /* @__PURE__ */ jsx16(MemoizedRichText, { richTexts: block.paragraph.rich_text }) });
826
+ return /* @__PURE__ */ jsx17(Paragraph, { children: /* @__PURE__ */ jsx17(MemoizedRichText, { richTexts: block.paragraph.rich_text }) });
773
827
  case "heading_1":
774
- return /* @__PURE__ */ jsx16(Heading1, { 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 }) });
775
829
  case "heading_2":
776
- return /* @__PURE__ */ jsx16(Heading2, { 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 }) });
777
831
  case "heading_3":
778
- return /* @__PURE__ */ jsx16(Heading3, { 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 }) });
779
833
  case "code":
780
- return /* @__PURE__ */ jsx16("div", { children: /* @__PURE__ */ jsx16(
834
+ return /* @__PURE__ */ jsx17("div", { children: /* @__PURE__ */ jsx17(
781
835
  CodeBlock_default,
782
836
  {
783
837
  code: block.code.rich_text[0]?.text?.content || "",
@@ -786,7 +840,7 @@ var BlockRenderer = ({ block, isColumn = false }) => {
786
840
  }
787
841
  ) });
788
842
  case "image":
789
- return /* @__PURE__ */ jsx16("figure", { children: /* @__PURE__ */ jsx16(
843
+ return /* @__PURE__ */ jsx17("figure", { children: /* @__PURE__ */ jsx17(
790
844
  MemoizedImage,
791
845
  {
792
846
  src: block.image.file?.url || block.image.external?.url || "",
@@ -797,7 +851,7 @@ var BlockRenderer = ({ block, isColumn = false }) => {
797
851
  }
798
852
  ) });
799
853
  case "bookmark":
800
- return /* @__PURE__ */ jsx16(
854
+ return /* @__PURE__ */ jsx17(
801
855
  MemoizedBookmark,
802
856
  {
803
857
  url: block.bookmark.url,
@@ -805,15 +859,17 @@ var BlockRenderer = ({ block, isColumn = false }) => {
805
859
  }
806
860
  );
807
861
  case "column_list":
808
- return /* @__PURE__ */ jsx16(ColumnList_default, { block });
862
+ return /* @__PURE__ */ jsx17(ColumnList_default, { block });
809
863
  case "column":
810
864
  return null;
811
865
  case "quote":
812
- return /* @__PURE__ */ jsx16(Quote_default, { richTexts: block.quote.rich_text });
866
+ return /* @__PURE__ */ jsx17(Quote_default, { richTexts: block.quote.rich_text });
813
867
  case "table":
814
- return /* @__PURE__ */ jsx16(Table_default2, { block });
868
+ return /* @__PURE__ */ jsx17(Table_default2, { block });
815
869
  case "toggle":
816
- return /* @__PURE__ */ jsx16(Toggle_default, { block });
870
+ return /* @__PURE__ */ jsx17(Toggle_default, { block });
871
+ case "video":
872
+ return /* @__PURE__ */ jsx17(Video_default, { block });
817
873
  default:
818
874
  return null;
819
875
  }
@@ -821,9 +877,9 @@ var BlockRenderer = ({ block, isColumn = false }) => {
821
877
  var BlockRenderer_default = BlockRenderer;
822
878
 
823
879
  // src/components/Title/index.tsx
824
- import { jsx as jsx17 } from "react/jsx-runtime";
880
+ import { jsx as jsx18 } from "react/jsx-runtime";
825
881
  var Title = ({ title: title3 }) => {
826
- return /* @__PURE__ */ jsx17(Heading1, { children: title3 });
882
+ return /* @__PURE__ */ jsx18(Heading1, { children: title3 });
827
883
  };
828
884
  var Title_default = Title;
829
885
 
@@ -837,12 +893,12 @@ var imageStyle2 = _7a4684({ defaultClassName: "styles_imageStyle__p0cp8d4", vari
837
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: [] });
838
894
 
839
895
  // src/components/Cover/index.tsx
840
- import { jsx as jsx18, jsxs as jsxs8 } from "react/jsx-runtime";
896
+ import { jsx as jsx19, jsxs as jsxs9 } from "react/jsx-runtime";
841
897
  var Cover = ({ src, alt }) => {
842
898
  const [isLoaded, setIsLoaded] = useState4(false);
843
- return /* @__PURE__ */ jsxs8("div", { className: coverContainer, children: [
844
- /* @__PURE__ */ jsx18("div", { className: skeletonWrapper2({ isLoaded }), children: /* @__PURE__ */ jsx18(Skeleton_default, { variant: "image" }) }),
845
- /* @__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(
846
902
  "img",
847
903
  {
848
904
  src,
@@ -864,7 +920,7 @@ var darkTheme = "theme_darkTheme__sq3jkb1n";
864
920
  var lightTheme = "theme_lightTheme__sq3jkb1m";
865
921
 
866
922
  // src/components/Renderer/index.tsx
867
- import { Fragment as Fragment4, jsx as jsx19, jsxs as jsxs9 } from "react/jsx-runtime";
923
+ import { Fragment as Fragment4, jsx as jsx20, jsxs as jsxs10 } from "react/jsx-runtime";
868
924
  var Renderer = memo2(({ blocks, isDarkMode = false, title: title3, cover }) => {
869
925
  const theme = isDarkMode ? darkTheme : lightTheme;
870
926
  const renderedBlocks = useMemo2(() => {
@@ -876,7 +932,7 @@ var Renderer = memo2(({ blocks, isDarkMode = false, title: title3, cover }) => {
876
932
  const listItemType = `${listType}_list_item`;
877
933
  if (block.type === listItemType && (i === 0 || blocks[i - 1]?.type !== listItemType)) {
878
934
  result.push(
879
- /* @__PURE__ */ jsx19(
935
+ /* @__PURE__ */ jsx20(
880
936
  ListBlocksRenderer_default,
881
937
  {
882
938
  blocks,
@@ -896,20 +952,20 @@ var Renderer = memo2(({ blocks, isDarkMode = false, title: title3, cover }) => {
896
952
  if (handleListItem("bulleted") || handleListItem("numbered")) {
897
953
  continue;
898
954
  } else {
899
- result.push(/* @__PURE__ */ jsx19(BlockRenderer_default, { block }, block.id));
955
+ result.push(/* @__PURE__ */ jsx20(BlockRenderer_default, { block }, block.id));
900
956
  }
901
957
  }
902
958
  return result;
903
959
  }, [blocks]);
904
- return /* @__PURE__ */ jsxs9(Fragment4, { children: [
905
- cover && /* @__PURE__ */ jsx19(Cover_default, { src: cover, alt: title3 || "Notion page content" }),
906
- /* @__PURE__ */ jsxs9(
960
+ return /* @__PURE__ */ jsxs10(Fragment4, { children: [
961
+ cover && /* @__PURE__ */ jsx20(Cover_default, { src: cover, alt: title3 || "Notion page content" }),
962
+ /* @__PURE__ */ jsxs10(
907
963
  "article",
908
964
  {
909
965
  className: `${theme} ${container2}`,
910
966
  "aria-label": title3 || "Notion page content",
911
967
  children: [
912
- title3 && /* @__PURE__ */ jsx19(Title_default, { title: title3 }),
968
+ title3 && /* @__PURE__ */ jsx20(Title_default, { title: title3 }),
913
969
  renderedBlocks
914
970
  ]
915
971
  }