notion-to-jsx 1.2.6 → 1.2.8
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.css +111 -24
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +192 -167
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +178 -153
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/components/Renderer/index.tsx
|
|
2
|
-
import React6, { useState as
|
|
2
|
+
import React6, { useState as useState5, useMemo as useMemo2, useCallback } from "react";
|
|
3
3
|
|
|
4
4
|
// src/components/Renderer/styles.css.ts
|
|
5
5
|
var container = "styles_container__epva5u0";
|
|
@@ -47,7 +47,7 @@ var RichTexts = ({ richTexts }) => {
|
|
|
47
47
|
case "text": {
|
|
48
48
|
if (text.text) {
|
|
49
49
|
const { text: textData } = text;
|
|
50
|
-
content3 = textData.link ? renderLink(textData.link, textData.content) : textData.content;
|
|
50
|
+
content3 = textData.link?.url ? renderLink(textData.link.url, textData.content) : textData.content;
|
|
51
51
|
} else {
|
|
52
52
|
content3 = text.plain_text;
|
|
53
53
|
}
|
|
@@ -107,15 +107,88 @@ import { useState } from "react";
|
|
|
107
107
|
|
|
108
108
|
// src/components/Renderer/components/Image/styles.css.ts
|
|
109
109
|
import { createRuntimeFn as _7a4683 } from "@vanilla-extract/recipes/createRuntimeFn";
|
|
110
|
-
var caption = "
|
|
110
|
+
var caption = "styles_caption__2f3ncf7";
|
|
111
111
|
var imageContainer = "styles_imageContainer__2f3ncf0";
|
|
112
|
-
var
|
|
113
|
-
var
|
|
114
|
-
var
|
|
112
|
+
var imageStyle = _7a4683({ defaultClassName: "styles_imageStyle__2f3ncf2", variantClassNames: { loaded: { true: "styles_imageStyle_loaded_true__2f3ncf3", false: "styles_imageStyle_loaded_false__2f3ncf4" }, hasAspectRatio: { true: "styles_imageStyle_hasAspectRatio_true__2f3ncf5", false: "styles_imageStyle_hasAspectRatio_false__2f3ncf6" } }, defaultVariants: { loaded: false, hasAspectRatio: false }, compoundVariants: [] });
|
|
113
|
+
var imageWrapper = "styles_imageWrapper__2f3ncf1";
|
|
114
|
+
var skeletonWrapper = _7a4683({ defaultClassName: "styles_skeletonWrapper__2f3ncf8", variantClassNames: { isLoaded: { true: "styles_skeletonWrapper_isLoaded_true__2f3ncf9", false: "styles_skeletonWrapper_isLoaded_false__2f3ncfa" } }, defaultVariants: { isLoaded: false }, compoundVariants: [] });
|
|
115
|
+
|
|
116
|
+
// src/components/Skeleton/styles.css.ts
|
|
117
|
+
var circle = "styles_circle__a3g8q93";
|
|
118
|
+
var image = "styles_image__a3g8q94";
|
|
119
|
+
var rect = "styles_rect__a3g8q92";
|
|
120
|
+
var skeleton = "styles_skeleton__a3g8q91";
|
|
121
|
+
|
|
122
|
+
// src/components/Skeleton/index.tsx
|
|
123
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
124
|
+
var Skeleton = ({
|
|
125
|
+
variant = "rect",
|
|
126
|
+
width,
|
|
127
|
+
height,
|
|
128
|
+
className
|
|
129
|
+
}) => {
|
|
130
|
+
const getVariantClass = () => {
|
|
131
|
+
switch (variant) {
|
|
132
|
+
case "circle":
|
|
133
|
+
return circle;
|
|
134
|
+
case "image":
|
|
135
|
+
return image;
|
|
136
|
+
case "rect":
|
|
137
|
+
default:
|
|
138
|
+
return rect;
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
return /* @__PURE__ */ jsx3(
|
|
142
|
+
"div",
|
|
143
|
+
{
|
|
144
|
+
className: `${skeleton} ${getVariantClass()} ${className || ""}`,
|
|
145
|
+
style: {
|
|
146
|
+
width: width || void 0,
|
|
147
|
+
height: height || void 0
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
);
|
|
151
|
+
};
|
|
152
|
+
var Skeleton_default = Skeleton;
|
|
115
153
|
|
|
116
154
|
// src/components/Renderer/components/Image/Image.tsx
|
|
117
|
-
import { jsx as
|
|
155
|
+
import { jsx as jsx4, jsxs } from "react/jsx-runtime";
|
|
118
156
|
var MAX_WIDTH = 720;
|
|
157
|
+
var getImageTagStyle = (format) => {
|
|
158
|
+
return format?.block_aspect_ratio ? { aspectRatio: `${format.block_aspect_ratio}` } : void 0;
|
|
159
|
+
};
|
|
160
|
+
var Image = ({
|
|
161
|
+
src,
|
|
162
|
+
alt,
|
|
163
|
+
caption: imageCaption,
|
|
164
|
+
format,
|
|
165
|
+
isColumn = false
|
|
166
|
+
}) => {
|
|
167
|
+
const [isLoaded, setIsLoaded] = useState(false);
|
|
168
|
+
return /* @__PURE__ */ jsxs("div", { className: imageContainer, children: [
|
|
169
|
+
/* @__PURE__ */ jsxs("div", { className: imageWrapper, style: getImageStyles(format, isColumn), children: [
|
|
170
|
+
/* @__PURE__ */ jsx4("div", { className: skeletonWrapper({ isLoaded }), children: /* @__PURE__ */ jsx4(Skeleton_default, { variant: "image" }) }),
|
|
171
|
+
/* @__PURE__ */ jsx4(
|
|
172
|
+
"img",
|
|
173
|
+
{
|
|
174
|
+
className: imageStyle({
|
|
175
|
+
loaded: isLoaded,
|
|
176
|
+
hasAspectRatio: !!format?.block_aspect_ratio
|
|
177
|
+
}),
|
|
178
|
+
src,
|
|
179
|
+
alt,
|
|
180
|
+
loading: "lazy",
|
|
181
|
+
onLoad: () => setIsLoaded(true),
|
|
182
|
+
width: format?.block_width,
|
|
183
|
+
height: format?.block_height,
|
|
184
|
+
style: getImageTagStyle(format)
|
|
185
|
+
}
|
|
186
|
+
)
|
|
187
|
+
] }),
|
|
188
|
+
imageCaption && imageCaption.length > 0 && /* @__PURE__ */ jsx4("figcaption", { className: caption, children: /* @__PURE__ */ jsx4(MemoizedRichText, { richTexts: imageCaption }) })
|
|
189
|
+
] });
|
|
190
|
+
};
|
|
191
|
+
var Image_default = Image;
|
|
119
192
|
var getImageStyles = (format, isColumn = false) => {
|
|
120
193
|
const getWidthStyle = () => {
|
|
121
194
|
if (!isColumn && format?.block_aspect_ratio && format.block_aspect_ratio < 1) {
|
|
@@ -134,73 +207,6 @@ var getImageStyles = (format, isColumn = false) => {
|
|
|
134
207
|
aspectRatio: getAspectRatioStyle()
|
|
135
208
|
};
|
|
136
209
|
};
|
|
137
|
-
var getImageTagStyle = (format) => {
|
|
138
|
-
return format?.block_aspect_ratio ? { aspectRatio: `${format.block_aspect_ratio}` } : void 0;
|
|
139
|
-
};
|
|
140
|
-
var Image = ({
|
|
141
|
-
src,
|
|
142
|
-
alt,
|
|
143
|
-
caption: imageCaption,
|
|
144
|
-
format,
|
|
145
|
-
isColumn = false
|
|
146
|
-
}) => {
|
|
147
|
-
const [isLoaded, setIsLoaded] = useState(false);
|
|
148
|
-
return /* @__PURE__ */ jsxs("div", { className: imageContainer, children: [
|
|
149
|
-
/* @__PURE__ */ jsxs(
|
|
150
|
-
"div",
|
|
151
|
-
{
|
|
152
|
-
className: imageWrapper({
|
|
153
|
-
hasWidth: !!format?.block_width
|
|
154
|
-
}),
|
|
155
|
-
style: getImageStyles(format, isColumn),
|
|
156
|
-
children: [
|
|
157
|
-
!isLoaded && /* @__PURE__ */ jsx3("div", { className: placeholder, style: getImageStyles(format, isColumn), children: /* @__PURE__ */ jsx3(
|
|
158
|
-
"svg",
|
|
159
|
-
{
|
|
160
|
-
width: "38",
|
|
161
|
-
height: "38",
|
|
162
|
-
viewBox: "0 0 38 38",
|
|
163
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
164
|
-
stroke: "#888",
|
|
165
|
-
children: /* @__PURE__ */ jsx3("g", { fill: "none", fillRule: "evenodd", children: /* @__PURE__ */ jsxs("g", { transform: "translate(1 1)", strokeWidth: "2", children: [
|
|
166
|
-
/* @__PURE__ */ jsx3("circle", { strokeOpacity: ".5", cx: "18", cy: "18", r: "18" }),
|
|
167
|
-
/* @__PURE__ */ jsx3("path", { d: "M36 18c0-9.94-8.06-18-18-18", children: /* @__PURE__ */ jsx3(
|
|
168
|
-
"animateTransform",
|
|
169
|
-
{
|
|
170
|
-
attributeName: "transform",
|
|
171
|
-
type: "rotate",
|
|
172
|
-
from: "0 18 18",
|
|
173
|
-
to: "360 18 18",
|
|
174
|
-
dur: "1s",
|
|
175
|
-
repeatCount: "indefinite"
|
|
176
|
-
}
|
|
177
|
-
) })
|
|
178
|
-
] }) })
|
|
179
|
-
}
|
|
180
|
-
) }),
|
|
181
|
-
/* @__PURE__ */ jsx3(
|
|
182
|
-
"img",
|
|
183
|
-
{
|
|
184
|
-
className: styledImage({
|
|
185
|
-
loaded: isLoaded,
|
|
186
|
-
hasAspectRatio: !!format?.block_aspect_ratio
|
|
187
|
-
}),
|
|
188
|
-
src,
|
|
189
|
-
alt,
|
|
190
|
-
loading: "lazy",
|
|
191
|
-
onLoad: () => setIsLoaded(true),
|
|
192
|
-
width: format?.block_width,
|
|
193
|
-
height: format?.block_height,
|
|
194
|
-
style: getImageTagStyle(format)
|
|
195
|
-
}
|
|
196
|
-
)
|
|
197
|
-
]
|
|
198
|
-
}
|
|
199
|
-
),
|
|
200
|
-
imageCaption && imageCaption.length > 0 && /* @__PURE__ */ jsx3("figcaption", { className: caption, children: /* @__PURE__ */ jsx3(MemoizedRichText, { richTexts: imageCaption }) })
|
|
201
|
-
] });
|
|
202
|
-
};
|
|
203
|
-
var Image_default = Image;
|
|
204
210
|
|
|
205
211
|
// src/components/Renderer/components/Bookmark/styles.css.ts
|
|
206
212
|
var card = "styles_card__qrq8yf1";
|
|
@@ -215,20 +221,20 @@ var title = "styles_title__qrq8yf5";
|
|
|
215
221
|
var urlText = "styles_urlText__qrq8yf9";
|
|
216
222
|
|
|
217
223
|
// src/components/Renderer/components/Bookmark/Bookmark.tsx
|
|
218
|
-
import { jsx as
|
|
224
|
+
import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
219
225
|
var Bookmark = ({ url, metadata }) => {
|
|
220
|
-
return /* @__PURE__ */
|
|
226
|
+
return /* @__PURE__ */ jsx5("a", { href: url, target: "_blank", rel: "noopener noreferrer", className: link2, children: /* @__PURE__ */ jsxs2("div", { className: card, children: [
|
|
221
227
|
/* @__PURE__ */ jsxs2("div", { className: content, children: [
|
|
222
228
|
/* @__PURE__ */ jsxs2("div", { children: [
|
|
223
|
-
/* @__PURE__ */
|
|
224
|
-
/* @__PURE__ */
|
|
229
|
+
/* @__PURE__ */ jsx5("h4", { className: title, children: metadata?.title || url }),
|
|
230
|
+
/* @__PURE__ */ jsx5("p", { className: description, children: metadata?.description || "" })
|
|
225
231
|
] }),
|
|
226
232
|
/* @__PURE__ */ jsxs2("div", { className: siteName, children: [
|
|
227
|
-
metadata?.favicon && /* @__PURE__ */
|
|
228
|
-
/* @__PURE__ */
|
|
233
|
+
metadata?.favicon && /* @__PURE__ */ jsx5("img", { src: metadata.favicon, alt: "", className: favicon }),
|
|
234
|
+
/* @__PURE__ */ jsx5("span", { className: urlText, children: metadata?.url || "" })
|
|
229
235
|
] })
|
|
230
236
|
] }),
|
|
231
|
-
metadata?.image && /* @__PURE__ */
|
|
237
|
+
metadata?.image && /* @__PURE__ */ jsx5("div", { className: previewContainer, children: /* @__PURE__ */ jsx5(
|
|
232
238
|
"img",
|
|
233
239
|
{
|
|
234
240
|
className: previewImage,
|
|
@@ -260,7 +266,7 @@ var preview = "styles_preview__o1p3m11";
|
|
|
260
266
|
var title2 = "styles_title__o1p3m15";
|
|
261
267
|
|
|
262
268
|
// src/components/Renderer/components/LinkPreview/LinkPreview.tsx
|
|
263
|
-
import { jsx as
|
|
269
|
+
import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
264
270
|
var fetchGitHubRepoData = async (repoPath) => {
|
|
265
271
|
try {
|
|
266
272
|
const apiUrl = `https://api.github.com/repos/${repoPath}`;
|
|
@@ -407,7 +413,7 @@ var LinkPreview = ({ url }) => {
|
|
|
407
413
|
}, [url]);
|
|
408
414
|
const repoName = repoData?.name || extractRepoPathFromUrl(url)?.split("/")[1] || "Repository";
|
|
409
415
|
const updatedTimeText = repoData?.updated_at ? formatUpdatedTime(repoData.updated_at) : "";
|
|
410
|
-
return /* @__PURE__ */
|
|
416
|
+
return /* @__PURE__ */ jsx6(
|
|
411
417
|
"a",
|
|
412
418
|
{
|
|
413
419
|
href: url,
|
|
@@ -417,7 +423,7 @@ var LinkPreview = ({ url }) => {
|
|
|
417
423
|
children: linkType === "figma" && figmaData ? (
|
|
418
424
|
// Figma 프리뷰 렌더링
|
|
419
425
|
/* @__PURE__ */ jsxs3("div", { className: preview, children: [
|
|
420
|
-
/* @__PURE__ */
|
|
426
|
+
/* @__PURE__ */ jsx6("div", { className: iconContainer, children: /* @__PURE__ */ jsx6(
|
|
421
427
|
"img",
|
|
422
428
|
{
|
|
423
429
|
src: figmaData.thumbnailUrl || "https://static.figma.com/app/icon/1/favicon.svg",
|
|
@@ -426,14 +432,14 @@ var LinkPreview = ({ url }) => {
|
|
|
426
432
|
}
|
|
427
433
|
) }),
|
|
428
434
|
/* @__PURE__ */ jsxs3("div", { className: content2, children: [
|
|
429
|
-
/* @__PURE__ */
|
|
430
|
-
/* @__PURE__ */
|
|
435
|
+
/* @__PURE__ */ jsx6("div", { className: title2, children: figmaData.name }),
|
|
436
|
+
/* @__PURE__ */ jsx6("div", { className: description2, children: "www.figma.com" })
|
|
431
437
|
] })
|
|
432
438
|
] })
|
|
433
439
|
) : linkType === "github" ? (
|
|
434
440
|
// GitHub 프리뷰 렌더링
|
|
435
441
|
/* @__PURE__ */ jsxs3("div", { className: `${preview} ${githubPreview}`, children: [
|
|
436
|
-
/* @__PURE__ */
|
|
442
|
+
/* @__PURE__ */ jsx6("div", { className: iconContainer, children: /* @__PURE__ */ jsx6(
|
|
437
443
|
"img",
|
|
438
444
|
{
|
|
439
445
|
src: repoData?.owner?.avatar_url || "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png",
|
|
@@ -442,13 +448,13 @@ var LinkPreview = ({ url }) => {
|
|
|
442
448
|
}
|
|
443
449
|
) }),
|
|
444
450
|
/* @__PURE__ */ jsxs3("div", { className: `${content2} ${githubContent}`, children: [
|
|
445
|
-
/* @__PURE__ */
|
|
446
|
-
/* @__PURE__ */
|
|
451
|
+
/* @__PURE__ */ jsx6("div", { className: title2, children: repoName }),
|
|
452
|
+
/* @__PURE__ */ jsx6("div", { className: description2, children: loading ? "Loading..." : `${repoName} \u2022 ${updatedTimeText}` })
|
|
447
453
|
] })
|
|
448
454
|
] })
|
|
449
455
|
) : (
|
|
450
456
|
// 기본 링크 프리뷰 렌더링
|
|
451
|
-
/* @__PURE__ */
|
|
457
|
+
/* @__PURE__ */ jsx6("div", { className: preview, children: /* @__PURE__ */ jsx6("div", { className: content2, children: /* @__PURE__ */ jsx6("div", { className: title2, children: url }) }) })
|
|
452
458
|
)
|
|
453
459
|
}
|
|
454
460
|
);
|
|
@@ -479,7 +485,7 @@ var MemoizedLinkPreview = React3.memo(
|
|
|
479
485
|
);
|
|
480
486
|
|
|
481
487
|
// src/components/Renderer/components/List/ListBlocksRenderer.tsx
|
|
482
|
-
import { jsx as
|
|
488
|
+
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
483
489
|
var RecursiveListItem = ({ block, index }) => {
|
|
484
490
|
const blockProps = {
|
|
485
491
|
tabIndex: 0
|
|
@@ -487,8 +493,8 @@ var RecursiveListItem = ({ block, index }) => {
|
|
|
487
493
|
const blockType = block.type;
|
|
488
494
|
const richTexts = block[blockType]?.rich_text;
|
|
489
495
|
return /* @__PURE__ */ jsxs4(ListItem, { ...blockProps, children: [
|
|
490
|
-
/* @__PURE__ */
|
|
491
|
-
block.children && block.children.length > 0 && /* @__PURE__ */
|
|
496
|
+
/* @__PURE__ */ jsx7(MemoizedRichText, { richTexts }),
|
|
497
|
+
block.children && block.children.length > 0 && /* @__PURE__ */ jsx7(
|
|
492
498
|
RecursiveListGroup,
|
|
493
499
|
{
|
|
494
500
|
blocks: block.children,
|
|
@@ -503,14 +509,14 @@ var RecursiveListGroup = ({ blocks, type }) => {
|
|
|
503
509
|
(block) => block.type === `${type}_list_item`
|
|
504
510
|
);
|
|
505
511
|
if (listItems.length === 0) return null;
|
|
506
|
-
return /* @__PURE__ */
|
|
512
|
+
return /* @__PURE__ */ jsx7(
|
|
507
513
|
List,
|
|
508
514
|
{
|
|
509
515
|
as: type === "numbered" ? "ol" : "ul",
|
|
510
516
|
type,
|
|
511
517
|
role: "list",
|
|
512
518
|
"aria-label": type === "bulleted" ? "Bulleted list" : "Numbered list",
|
|
513
|
-
children: listItems.map((block, index) => /* @__PURE__ */
|
|
519
|
+
children: listItems.map((block, index) => /* @__PURE__ */ jsx7(RecursiveListItem, { block, index }, block.id))
|
|
514
520
|
}
|
|
515
521
|
);
|
|
516
522
|
};
|
|
@@ -526,14 +532,14 @@ var ListBlocksRenderer = ({ blocks, startIndex, type }) => {
|
|
|
526
532
|
}
|
|
527
533
|
}
|
|
528
534
|
const listItems = blocks.slice(startIndex, startIndex + consecutiveItems);
|
|
529
|
-
return /* @__PURE__ */
|
|
535
|
+
return /* @__PURE__ */ jsx7(
|
|
530
536
|
List,
|
|
531
537
|
{
|
|
532
538
|
as: type === "numbered" ? "ol" : "ul",
|
|
533
539
|
type,
|
|
534
540
|
role: "list",
|
|
535
541
|
"aria-label": type === "bulleted" ? "Bulleted list" : "Numbered list",
|
|
536
|
-
children: listItems.map((block, index) => /* @__PURE__ */
|
|
542
|
+
children: listItems.map((block, index) => /* @__PURE__ */ jsx7(
|
|
537
543
|
RecursiveListItem,
|
|
538
544
|
{
|
|
539
545
|
block,
|
|
@@ -557,13 +563,13 @@ import Prism from "prismjs";
|
|
|
557
563
|
import "prismjs/components/prism-typescript";
|
|
558
564
|
import "prismjs/components/prism-jsx";
|
|
559
565
|
import "prismjs/components/prism-tsx";
|
|
560
|
-
import { Fragment as Fragment2, jsx as
|
|
566
|
+
import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
561
567
|
if (typeof window !== "undefined") {
|
|
562
568
|
window.Prism = Prism;
|
|
563
569
|
}
|
|
564
570
|
var renderToken = (token, i) => {
|
|
565
571
|
if (typeof token === "string") {
|
|
566
|
-
return /* @__PURE__ */
|
|
572
|
+
return /* @__PURE__ */ jsx8("span", { children: token }, i);
|
|
567
573
|
}
|
|
568
574
|
const content3 = token.content;
|
|
569
575
|
let tokenContent;
|
|
@@ -574,7 +580,7 @@ var renderToken = (token, i) => {
|
|
|
574
580
|
} else {
|
|
575
581
|
tokenContent = content3;
|
|
576
582
|
}
|
|
577
|
-
return /* @__PURE__ */
|
|
583
|
+
return /* @__PURE__ */ jsx8("span", { className: `token ${token.type}`, children: tokenContent }, i);
|
|
578
584
|
};
|
|
579
585
|
var CodeBlock = ({ code, language, caption: caption2 }) => {
|
|
580
586
|
const tokens = useMemo(() => {
|
|
@@ -582,8 +588,8 @@ var CodeBlock = ({ code, language, caption: caption2 }) => {
|
|
|
582
588
|
return Prism.tokenize(code, prismLanguage);
|
|
583
589
|
}, [code, language]);
|
|
584
590
|
return /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
585
|
-
/* @__PURE__ */
|
|
586
|
-
caption2 && /* @__PURE__ */
|
|
591
|
+
/* @__PURE__ */ jsx8("pre", { className: `${codeBlock} language-${language}`, children: /* @__PURE__ */ jsx8("code", { className: `language-${language}`, children: tokens.map((token, i) => renderToken(token, i)) }) }),
|
|
592
|
+
caption2 && /* @__PURE__ */ jsx8("figcaption", { children: /* @__PURE__ */ jsx8(MemoizedRichText, { richTexts: caption2 }) })
|
|
587
593
|
] });
|
|
588
594
|
};
|
|
589
595
|
var CodeBlock_default = CodeBlock;
|
|
@@ -595,34 +601,34 @@ var heading3 = "styles_heading3__90a95g3";
|
|
|
595
601
|
var paragraph = "styles_paragraph__90a95g0";
|
|
596
602
|
|
|
597
603
|
// src/components/Renderer/components/Typography/Typography.tsx
|
|
598
|
-
import { jsx as
|
|
604
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
599
605
|
var Paragraph = ({
|
|
600
606
|
className,
|
|
601
607
|
children,
|
|
602
608
|
...props
|
|
603
609
|
}) => {
|
|
604
|
-
return /* @__PURE__ */
|
|
610
|
+
return /* @__PURE__ */ jsx9("p", { className: paragraph, ...props, children });
|
|
605
611
|
};
|
|
606
612
|
var Heading1 = ({
|
|
607
613
|
className,
|
|
608
614
|
children,
|
|
609
615
|
...props
|
|
610
616
|
}) => {
|
|
611
|
-
return /* @__PURE__ */
|
|
617
|
+
return /* @__PURE__ */ jsx9("h1", { className: heading1, ...props, children });
|
|
612
618
|
};
|
|
613
619
|
var Heading2 = ({
|
|
614
620
|
className,
|
|
615
621
|
children,
|
|
616
622
|
...props
|
|
617
623
|
}) => {
|
|
618
|
-
return /* @__PURE__ */
|
|
624
|
+
return /* @__PURE__ */ jsx9("h2", { className: heading2, ...props, children });
|
|
619
625
|
};
|
|
620
626
|
var Heading3 = ({
|
|
621
627
|
className,
|
|
622
628
|
children,
|
|
623
629
|
...props
|
|
624
630
|
}) => {
|
|
625
|
-
return /* @__PURE__ */
|
|
631
|
+
return /* @__PURE__ */ jsx9("h3", { className: heading3, ...props, children });
|
|
626
632
|
};
|
|
627
633
|
|
|
628
634
|
// src/components/Renderer/components/Column/styles.css.ts
|
|
@@ -630,10 +636,10 @@ var columnContainer = "styles_columnContainer__wle6we0";
|
|
|
630
636
|
var columnListContainer = "styles_columnListContainer__wle6we1";
|
|
631
637
|
|
|
632
638
|
// src/components/Renderer/components/Column/Column.tsx
|
|
633
|
-
import { jsx as
|
|
639
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
634
640
|
var Column = ({ block, onFocus }) => {
|
|
635
641
|
if (!block || !block.children) return null;
|
|
636
|
-
return /* @__PURE__ */
|
|
642
|
+
return /* @__PURE__ */ jsx10("div", { className: columnContainer, children: block.children.map((childBlock, index) => /* @__PURE__ */ jsx10(
|
|
637
643
|
BlockRenderer_default,
|
|
638
644
|
{
|
|
639
645
|
block: childBlock,
|
|
@@ -647,10 +653,10 @@ var Column = ({ block, onFocus }) => {
|
|
|
647
653
|
var Column_default = Column;
|
|
648
654
|
|
|
649
655
|
// src/components/Renderer/components/Column/ColumnList.tsx
|
|
650
|
-
import { jsx as
|
|
656
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
651
657
|
var ColumnList = ({ block, onFocus }) => {
|
|
652
658
|
if (!block || !block.children) return null;
|
|
653
|
-
return /* @__PURE__ */
|
|
659
|
+
return /* @__PURE__ */ jsx11("div", { className: columnListContainer, children: block.children.map((column) => /* @__PURE__ */ jsx11(Column_default, { block: column, onFocus }, column.id)) });
|
|
654
660
|
};
|
|
655
661
|
var ColumnList_default = ColumnList;
|
|
656
662
|
|
|
@@ -658,9 +664,9 @@ var ColumnList_default = ColumnList;
|
|
|
658
664
|
var container2 = "styles_container__mra9n0";
|
|
659
665
|
|
|
660
666
|
// src/components/Renderer/components/Quote/Quote.tsx
|
|
661
|
-
import { jsx as
|
|
667
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
662
668
|
var Quote = ({ richTexts, tabIndex }) => {
|
|
663
|
-
return /* @__PURE__ */
|
|
669
|
+
return /* @__PURE__ */ jsx12("blockquote", { className: container2, tabIndex, children: /* @__PURE__ */ jsx12(MemoizedRichText, { richTexts }) });
|
|
664
670
|
};
|
|
665
671
|
var Quote_default = Quote;
|
|
666
672
|
|
|
@@ -674,7 +680,7 @@ var tableCell = "styles_tableCell__1rvbzfo3";
|
|
|
674
680
|
var tableContainer = "styles_tableContainer__1rvbzfo0";
|
|
675
681
|
|
|
676
682
|
// src/components/Renderer/components/Table/TableRow.tsx
|
|
677
|
-
import { jsx as
|
|
683
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
678
684
|
var TableRow = ({
|
|
679
685
|
rowBlock,
|
|
680
686
|
cellClassName = "",
|
|
@@ -684,7 +690,7 @@ var TableRow = ({
|
|
|
684
690
|
return null;
|
|
685
691
|
}
|
|
686
692
|
const { cells } = rowBlock.table_row;
|
|
687
|
-
return /* @__PURE__ */
|
|
693
|
+
return /* @__PURE__ */ jsx13("tr", { children: cells.map((cell, index) => {
|
|
688
694
|
const isFirstCell = index === 0;
|
|
689
695
|
const isLastCell = index === cells.length - 1;
|
|
690
696
|
const isRowHeader = index === rowHeaderIndex;
|
|
@@ -692,11 +698,11 @@ var TableRow = ({
|
|
|
692
698
|
if (isFirstCell) cellClasses.push(firstCell);
|
|
693
699
|
if (isLastCell) cellClasses.push(lastCell);
|
|
694
700
|
if (isRowHeader) cellClasses.push(hasRowHeader);
|
|
695
|
-
return /* @__PURE__ */
|
|
701
|
+
return /* @__PURE__ */ jsx13(
|
|
696
702
|
"td",
|
|
697
703
|
{
|
|
698
704
|
className: cellClasses.filter(Boolean).join(" "),
|
|
699
|
-
children: /* @__PURE__ */
|
|
705
|
+
children: /* @__PURE__ */ jsx13(MemoizedRichText, { richTexts: cell })
|
|
700
706
|
},
|
|
701
707
|
`${rowBlock.id}-cell-${index}`
|
|
702
708
|
);
|
|
@@ -705,7 +711,7 @@ var TableRow = ({
|
|
|
705
711
|
var TableRow_default = TableRow;
|
|
706
712
|
|
|
707
713
|
// src/components/Renderer/components/Table/Table.tsx
|
|
708
|
-
import { Fragment as Fragment3, jsx as
|
|
714
|
+
import { Fragment as Fragment3, jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
709
715
|
var Table = ({ block, tabIndex = 0 }) => {
|
|
710
716
|
if (!block.table || !block.children) {
|
|
711
717
|
return null;
|
|
@@ -714,16 +720,16 @@ var Table = ({ block, tabIndex = 0 }) => {
|
|
|
714
720
|
const rows = block.children?.filter(
|
|
715
721
|
(child) => child.type === "table_row"
|
|
716
722
|
) || [];
|
|
717
|
-
return /* @__PURE__ */
|
|
718
|
-
has_column_header && rows[0] && /* @__PURE__ */
|
|
719
|
-
/* @__PURE__ */
|
|
723
|
+
return /* @__PURE__ */ jsx14("div", { className: tableContainer, children: /* @__PURE__ */ jsx14("table", { className: table, tabIndex, children: rows.length > 0 && /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
724
|
+
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(
|
|
720
726
|
(row) => row !== void 0 && row.type === "table_row"
|
|
721
727
|
).map((row, rowIndex) => {
|
|
722
728
|
if (has_column_header && rowIndex === 0) {
|
|
723
729
|
return null;
|
|
724
730
|
}
|
|
725
731
|
const actualRowIndex = has_column_header ? rowIndex - 1 : rowIndex;
|
|
726
|
-
return /* @__PURE__ */
|
|
732
|
+
return /* @__PURE__ */ jsx14(
|
|
727
733
|
TableRow_default,
|
|
728
734
|
{
|
|
729
735
|
rowBlock: row,
|
|
@@ -750,7 +756,7 @@ var toggleIcon = "styles_toggleIcon__p7ue1z2";
|
|
|
750
756
|
var toggleIconOpen = "styles_toggleIconOpen__p7ue1z3";
|
|
751
757
|
|
|
752
758
|
// src/components/Renderer/components/Toggle/Toggle.tsx
|
|
753
|
-
import { jsx as
|
|
759
|
+
import { jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
754
760
|
var Toggle = ({ block, tabIndex = 0, onFocus }) => {
|
|
755
761
|
const [isOpen, setIsOpen] = useState3(false);
|
|
756
762
|
if (!block.toggle || !block.children) {
|
|
@@ -777,12 +783,12 @@ var Toggle = ({ block, tabIndex = 0, onFocus }) => {
|
|
|
777
783
|
role: "button",
|
|
778
784
|
"aria-expanded": isOpen,
|
|
779
785
|
children: [
|
|
780
|
-
/* @__PURE__ */
|
|
781
|
-
/* @__PURE__ */
|
|
786
|
+
/* @__PURE__ */ jsx15("span", { className: `${toggleIcon} ${isOpen ? toggleIconOpen : ""}`, children: "\u25B6" }),
|
|
787
|
+
/* @__PURE__ */ jsx15(RichTexts_default, { richTexts: block.toggle.rich_text })
|
|
782
788
|
]
|
|
783
789
|
}
|
|
784
790
|
),
|
|
785
|
-
isOpen && block.children && /* @__PURE__ */
|
|
791
|
+
isOpen && block.children && /* @__PURE__ */ jsx15("div", { className: toggleContent, children: block.children.map((childBlock, index) => /* @__PURE__ */ jsx15(
|
|
786
792
|
BlockRenderer_default,
|
|
787
793
|
{
|
|
788
794
|
block: childBlock,
|
|
@@ -795,7 +801,7 @@ var Toggle = ({ block, tabIndex = 0, onFocus }) => {
|
|
|
795
801
|
var Toggle_default = Toggle;
|
|
796
802
|
|
|
797
803
|
// src/components/Renderer/components/Block/BlockRenderer.tsx
|
|
798
|
-
import { jsx as
|
|
804
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
799
805
|
var BlockRenderer = ({
|
|
800
806
|
block,
|
|
801
807
|
onFocus,
|
|
@@ -809,17 +815,17 @@ var BlockRenderer = ({
|
|
|
809
815
|
};
|
|
810
816
|
switch (block.type) {
|
|
811
817
|
case "link_preview":
|
|
812
|
-
return /* @__PURE__ */
|
|
818
|
+
return /* @__PURE__ */ jsx16(MemoizedLinkPreview, { url: block.link_preview.url, ...blockProps });
|
|
813
819
|
case "paragraph":
|
|
814
|
-
return /* @__PURE__ */
|
|
820
|
+
return /* @__PURE__ */ jsx16(Paragraph, { ...blockProps, children: /* @__PURE__ */ jsx16(MemoizedRichText, { richTexts: block.paragraph.rich_text }) });
|
|
815
821
|
case "heading_1":
|
|
816
|
-
return /* @__PURE__ */
|
|
822
|
+
return /* @__PURE__ */ jsx16(Heading1, { ...blockProps, children: /* @__PURE__ */ jsx16(MemoizedRichText, { richTexts: block.heading_1.rich_text }) });
|
|
817
823
|
case "heading_2":
|
|
818
|
-
return /* @__PURE__ */
|
|
824
|
+
return /* @__PURE__ */ jsx16(Heading2, { ...blockProps, children: /* @__PURE__ */ jsx16(MemoizedRichText, { richTexts: block.heading_2.rich_text }) });
|
|
819
825
|
case "heading_3":
|
|
820
|
-
return /* @__PURE__ */
|
|
826
|
+
return /* @__PURE__ */ jsx16(Heading3, { ...blockProps, children: /* @__PURE__ */ jsx16(MemoizedRichText, { richTexts: block.heading_3.rich_text }) });
|
|
821
827
|
case "code":
|
|
822
|
-
return /* @__PURE__ */
|
|
828
|
+
return /* @__PURE__ */ jsx16("div", { ...blockProps, children: /* @__PURE__ */ jsx16(
|
|
823
829
|
CodeBlock_default,
|
|
824
830
|
{
|
|
825
831
|
code: block.code.rich_text[0].text.content,
|
|
@@ -828,7 +834,7 @@ var BlockRenderer = ({
|
|
|
828
834
|
}
|
|
829
835
|
) });
|
|
830
836
|
case "image":
|
|
831
|
-
return /* @__PURE__ */
|
|
837
|
+
return /* @__PURE__ */ jsx16("figure", { ...blockProps, children: /* @__PURE__ */ jsx16(
|
|
832
838
|
MemoizedImage,
|
|
833
839
|
{
|
|
834
840
|
src: block.image.file?.url || block.image.external?.url,
|
|
@@ -839,7 +845,7 @@ var BlockRenderer = ({
|
|
|
839
845
|
}
|
|
840
846
|
) });
|
|
841
847
|
case "bookmark":
|
|
842
|
-
return /* @__PURE__ */
|
|
848
|
+
return /* @__PURE__ */ jsx16(
|
|
843
849
|
MemoizedBookmark,
|
|
844
850
|
{
|
|
845
851
|
url: block.bookmark.url,
|
|
@@ -847,15 +853,15 @@ var BlockRenderer = ({
|
|
|
847
853
|
}
|
|
848
854
|
);
|
|
849
855
|
case "column_list":
|
|
850
|
-
return /* @__PURE__ */
|
|
856
|
+
return /* @__PURE__ */ jsx16(ColumnList_default, { block, onFocus });
|
|
851
857
|
case "column":
|
|
852
858
|
return null;
|
|
853
859
|
case "quote":
|
|
854
|
-
return /* @__PURE__ */
|
|
860
|
+
return /* @__PURE__ */ jsx16(Quote_default, { richTexts: block.quote.rich_text, ...blockProps });
|
|
855
861
|
case "table":
|
|
856
|
-
return /* @__PURE__ */
|
|
862
|
+
return /* @__PURE__ */ jsx16(Table_default2, { block, tabIndex: blockProps.tabIndex });
|
|
857
863
|
case "toggle":
|
|
858
|
-
return /* @__PURE__ */
|
|
864
|
+
return /* @__PURE__ */ jsx16(
|
|
859
865
|
Toggle_default,
|
|
860
866
|
{
|
|
861
867
|
block,
|
|
@@ -874,28 +880,47 @@ var darkTheme = "theme_darkTheme__sq3jkb1n";
|
|
|
874
880
|
var lightTheme = "theme_lightTheme__sq3jkb1m";
|
|
875
881
|
|
|
876
882
|
// src/components/Title/index.tsx
|
|
877
|
-
import { jsx as
|
|
883
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
878
884
|
var Title = ({ title: title3 }) => {
|
|
879
|
-
return /* @__PURE__ */
|
|
885
|
+
return /* @__PURE__ */ jsx17(Heading1, { children: title3 });
|
|
880
886
|
};
|
|
881
887
|
var Title_default = Title;
|
|
882
888
|
|
|
889
|
+
// src/components/Cover/index.tsx
|
|
890
|
+
import { useState as useState4 } from "react";
|
|
891
|
+
|
|
883
892
|
// src/components/Cover/styles.css.ts
|
|
884
|
-
|
|
893
|
+
import { createRuntimeFn as _7a4684 } from "@vanilla-extract/recipes/createRuntimeFn";
|
|
894
|
+
var coverContainer = "styles_coverContainer__p0cp8d0";
|
|
895
|
+
var imageStyle2 = _7a4684({ defaultClassName: "styles_imageStyle__p0cp8d4", variantClassNames: { isLoaded: { true: "styles_imageStyle_isLoaded_true__p0cp8d5", false: "styles_imageStyle_isLoaded_false__p0cp8d6" } }, defaultVariants: { isLoaded: false }, compoundVariants: [] });
|
|
896
|
+
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: [] });
|
|
885
897
|
|
|
886
898
|
// src/components/Cover/index.tsx
|
|
887
|
-
import { jsx as
|
|
899
|
+
import { jsx as jsx18, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
888
900
|
var Cover = ({ src, alt }) => {
|
|
889
|
-
|
|
901
|
+
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(
|
|
905
|
+
"img",
|
|
906
|
+
{
|
|
907
|
+
src,
|
|
908
|
+
alt,
|
|
909
|
+
className: imageStyle2({ isLoaded }),
|
|
910
|
+
onLoad: () => setIsLoaded(true),
|
|
911
|
+
loading: "lazy"
|
|
912
|
+
}
|
|
913
|
+
)
|
|
914
|
+
] });
|
|
890
915
|
};
|
|
891
916
|
var Cover_default = Cover;
|
|
892
917
|
|
|
893
918
|
// src/components/Renderer/index.tsx
|
|
894
|
-
import { Fragment as Fragment4, jsx as
|
|
919
|
+
import { Fragment as Fragment4, jsx as jsx19, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
895
920
|
var Renderer = React6.memo(
|
|
896
|
-
({ blocks, isDarkMode = false, title: title3, cover
|
|
921
|
+
({ blocks, isDarkMode = false, title: title3, cover, onBlockFocus }) => {
|
|
897
922
|
const theme = isDarkMode ? darkTheme : lightTheme;
|
|
898
|
-
const [focusedIndex, setFocusedIndex] =
|
|
923
|
+
const [focusedIndex, setFocusedIndex] = useState5(-1);
|
|
899
924
|
const handleBlockFocus = useCallback(
|
|
900
925
|
(index) => {
|
|
901
926
|
setFocusedIndex(index);
|
|
@@ -912,7 +937,7 @@ var Renderer = React6.memo(
|
|
|
912
937
|
const listItemType = `${listType}_list_item`;
|
|
913
938
|
if (block.type === listItemType && (i === 0 || blocks[i - 1]?.type !== listItemType)) {
|
|
914
939
|
result.push(
|
|
915
|
-
/* @__PURE__ */
|
|
940
|
+
/* @__PURE__ */ jsx19(
|
|
916
941
|
ListBlocksRenderer_default,
|
|
917
942
|
{
|
|
918
943
|
blocks,
|
|
@@ -933,7 +958,7 @@ var Renderer = React6.memo(
|
|
|
933
958
|
continue;
|
|
934
959
|
} else {
|
|
935
960
|
result.push(
|
|
936
|
-
/* @__PURE__ */
|
|
961
|
+
/* @__PURE__ */ jsx19(
|
|
937
962
|
BlockRenderer_default,
|
|
938
963
|
{
|
|
939
964
|
block,
|
|
@@ -947,15 +972,15 @@ var Renderer = React6.memo(
|
|
|
947
972
|
}
|
|
948
973
|
return result;
|
|
949
974
|
}, [blocks, handleBlockFocus]);
|
|
950
|
-
return /* @__PURE__ */
|
|
951
|
-
|
|
952
|
-
/* @__PURE__ */
|
|
975
|
+
return /* @__PURE__ */ jsxs9(Fragment4, { children: [
|
|
976
|
+
cover && /* @__PURE__ */ jsx19(Cover_default, { src: cover, alt: title3 || "Notion page content" }),
|
|
977
|
+
/* @__PURE__ */ jsxs9(
|
|
953
978
|
"article",
|
|
954
979
|
{
|
|
955
980
|
className: `${theme} ${container}`,
|
|
956
981
|
"aria-label": title3 || "Notion page content",
|
|
957
982
|
children: [
|
|
958
|
-
title3 && /* @__PURE__ */
|
|
983
|
+
title3 && /* @__PURE__ */ jsx19(Title_default, { title: title3 }),
|
|
959
984
|
renderedBlocks
|
|
960
985
|
]
|
|
961
986
|
}
|