notion-to-jsx 1.2.0 → 1.2.2
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 +257 -167
- package/dist/index.css.map +1 -1
- package/dist/index.js +42 -72
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +42 -72
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -33,15 +33,15 @@ import React4 from "react";
|
|
|
33
33
|
|
|
34
34
|
// src/components/Renderer/components/RichText/styles.css.ts
|
|
35
35
|
import { createRuntimeFn as _7a4682 } from "@vanilla-extract/recipes/createRuntimeFn";
|
|
36
|
-
var link = "
|
|
37
|
-
var richText = _7a4682({ 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" } }, defaultVariants: {}, compoundVariants: [[{ strikethrough: true, underline: true }, "
|
|
36
|
+
var link = "styles_link__fdf3twq";
|
|
37
|
+
var richText = _7a4682({ 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"]] });
|
|
38
38
|
|
|
39
39
|
// src/components/Renderer/components/RichText/RichTexts.tsx
|
|
40
40
|
import { Fragment, jsx as jsx2 } from "react/jsx-runtime";
|
|
41
41
|
var renderLink = (href, content3) => /* @__PURE__ */ jsx2("a", { href, target: "_blank", rel: "noopener noreferrer", className: link, children: content3 });
|
|
42
42
|
var RichTexts = ({ richTexts }) => {
|
|
43
43
|
return /* @__PURE__ */ jsx2(Fragment, { children: richTexts.map((text, index) => {
|
|
44
|
-
const { bold, italic, strikethrough, underline, code } = text.annotations;
|
|
44
|
+
const { bold, italic, strikethrough, underline, code, color } = text.annotations;
|
|
45
45
|
let content3;
|
|
46
46
|
switch (text.type) {
|
|
47
47
|
case "text": {
|
|
@@ -61,6 +61,28 @@ var RichTexts = ({ richTexts }) => {
|
|
|
61
61
|
content3 = text.plain_text;
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
+
const notionColors = [
|
|
65
|
+
"default",
|
|
66
|
+
"gray",
|
|
67
|
+
"brown",
|
|
68
|
+
"orange",
|
|
69
|
+
"yellow",
|
|
70
|
+
"green",
|
|
71
|
+
"blue",
|
|
72
|
+
"purple",
|
|
73
|
+
"pink",
|
|
74
|
+
"red",
|
|
75
|
+
"gray_background",
|
|
76
|
+
"brown_background",
|
|
77
|
+
"orange_background",
|
|
78
|
+
"yellow_background",
|
|
79
|
+
"green_background",
|
|
80
|
+
"blue_background",
|
|
81
|
+
"purple_background",
|
|
82
|
+
"pink_background",
|
|
83
|
+
"red_background"
|
|
84
|
+
];
|
|
85
|
+
const safeColor = notionColors.includes(color) ? color : void 0;
|
|
64
86
|
return /* @__PURE__ */ jsx2(
|
|
65
87
|
"span",
|
|
66
88
|
{
|
|
@@ -69,7 +91,8 @@ var RichTexts = ({ richTexts }) => {
|
|
|
69
91
|
italic,
|
|
70
92
|
strikethrough,
|
|
71
93
|
underline,
|
|
72
|
-
code
|
|
94
|
+
code,
|
|
95
|
+
color: safeColor
|
|
73
96
|
}),
|
|
74
97
|
children: content3
|
|
75
98
|
},
|
|
@@ -101,10 +124,8 @@ var Image = ({
|
|
|
101
124
|
format
|
|
102
125
|
}) => {
|
|
103
126
|
const [isLoaded, setIsLoaded] = useState(false);
|
|
104
|
-
const [error, setError] = useState(false);
|
|
105
127
|
useEffect(() => {
|
|
106
128
|
setIsLoaded(false);
|
|
107
|
-
setError(false);
|
|
108
129
|
}, [src]);
|
|
109
130
|
return /* @__PURE__ */ jsxs("figure", { className: imageContainer, children: [
|
|
110
131
|
/* @__PURE__ */ jsxs(
|
|
@@ -113,16 +134,16 @@ var Image = ({
|
|
|
113
134
|
className: imageWrapper({
|
|
114
135
|
hasWidth: !!format?.block_width
|
|
115
136
|
}),
|
|
116
|
-
style:
|
|
117
|
-
width: format.block_width > MAX_WIDTH ? "100%" : `${format.block_width}px`
|
|
118
|
-
}
|
|
137
|
+
style: {
|
|
138
|
+
width: format?.block_aspect_ratio && format.block_aspect_ratio < 1 ? `${format.block_aspect_ratio * 100}%` : format?.block_width ? format.block_width > MAX_WIDTH ? "100%" : `${format.block_width}px` : "100%"
|
|
139
|
+
},
|
|
119
140
|
children: [
|
|
120
|
-
!isLoaded &&
|
|
141
|
+
!isLoaded && /* @__PURE__ */ jsx3(
|
|
121
142
|
"div",
|
|
122
143
|
{
|
|
123
144
|
className: placeholder,
|
|
124
145
|
style: {
|
|
125
|
-
width: format?.block_width ? format.block_width > MAX_WIDTH ? "100%" : `${format.block_width}px` : "100%",
|
|
146
|
+
width: format?.block_aspect_ratio && format.block_aspect_ratio < 1 ? `${format.block_aspect_ratio * 100}%` : format?.block_width ? format.block_width > MAX_WIDTH ? "100%" : `${format.block_width}px` : "100%",
|
|
126
147
|
aspectRatio: format?.block_aspect_ratio ? `${format.block_aspect_ratio}` : "auto"
|
|
127
148
|
},
|
|
128
149
|
children: /* @__PURE__ */ jsx3(
|
|
@@ -151,62 +172,6 @@ var Image = ({
|
|
|
151
172
|
)
|
|
152
173
|
}
|
|
153
174
|
),
|
|
154
|
-
error && /* @__PURE__ */ jsxs(
|
|
155
|
-
"div",
|
|
156
|
-
{
|
|
157
|
-
className: placeholder,
|
|
158
|
-
style: {
|
|
159
|
-
width: format?.block_width ? format.block_width > MAX_WIDTH ? "100%" : `${format.block_width}px` : "100%",
|
|
160
|
-
aspectRatio: format?.block_aspect_ratio ? `${format.block_aspect_ratio}` : "auto"
|
|
161
|
-
},
|
|
162
|
-
children: [
|
|
163
|
-
/* @__PURE__ */ jsxs(
|
|
164
|
-
"svg",
|
|
165
|
-
{
|
|
166
|
-
width: "48",
|
|
167
|
-
height: "48",
|
|
168
|
-
viewBox: "0 0 24 24",
|
|
169
|
-
fill: "none",
|
|
170
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
171
|
-
children: [
|
|
172
|
-
/* @__PURE__ */ jsx3(
|
|
173
|
-
"path",
|
|
174
|
-
{
|
|
175
|
-
d: "M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z",
|
|
176
|
-
stroke: "#FF6B6B",
|
|
177
|
-
strokeWidth: "2",
|
|
178
|
-
strokeLinecap: "round",
|
|
179
|
-
strokeLinejoin: "round"
|
|
180
|
-
}
|
|
181
|
-
),
|
|
182
|
-
/* @__PURE__ */ jsx3(
|
|
183
|
-
"path",
|
|
184
|
-
{
|
|
185
|
-
d: "M15 9L9 15",
|
|
186
|
-
stroke: "#FF6B6B",
|
|
187
|
-
strokeWidth: "2",
|
|
188
|
-
strokeLinecap: "round",
|
|
189
|
-
strokeLinejoin: "round"
|
|
190
|
-
}
|
|
191
|
-
),
|
|
192
|
-
/* @__PURE__ */ jsx3(
|
|
193
|
-
"path",
|
|
194
|
-
{
|
|
195
|
-
d: "M9 9L15 15",
|
|
196
|
-
stroke: "#FF6B6B",
|
|
197
|
-
strokeWidth: "2",
|
|
198
|
-
strokeLinecap: "round",
|
|
199
|
-
strokeLinejoin: "round"
|
|
200
|
-
}
|
|
201
|
-
)
|
|
202
|
-
]
|
|
203
|
-
}
|
|
204
|
-
),
|
|
205
|
-
/* @__PURE__ */ jsx3("div", { style: { width: "10px" } }),
|
|
206
|
-
/* @__PURE__ */ jsx3("p", { style: { color: "#FF6B6B", fontSize: "14px" }, children: "Image Load failed" })
|
|
207
|
-
]
|
|
208
|
-
}
|
|
209
|
-
),
|
|
210
175
|
/* @__PURE__ */ jsx3(
|
|
211
176
|
"img",
|
|
212
177
|
{
|
|
@@ -218,7 +183,6 @@ var Image = ({
|
|
|
218
183
|
alt,
|
|
219
184
|
loading: priority ? "eager" : "lazy",
|
|
220
185
|
onLoad: () => setIsLoaded(true),
|
|
221
|
-
onError: () => setError(true),
|
|
222
186
|
width: format?.block_width,
|
|
223
187
|
height: format?.block_height,
|
|
224
188
|
style: format?.block_aspect_ratio ? { aspectRatio: `${format.block_aspect_ratio}` } : void 0
|
|
@@ -906,17 +870,23 @@ var BlockRenderer = ({ block, onFocus, index }) => {
|
|
|
906
870
|
case "table":
|
|
907
871
|
return /* @__PURE__ */ jsx15(Table_default2, { block, tabIndex: blockProps.tabIndex });
|
|
908
872
|
case "toggle":
|
|
909
|
-
return /* @__PURE__ */ jsx15(
|
|
873
|
+
return /* @__PURE__ */ jsx15(
|
|
874
|
+
Toggle_default,
|
|
875
|
+
{
|
|
876
|
+
block,
|
|
877
|
+
tabIndex: blockProps.tabIndex,
|
|
878
|
+
onFocus
|
|
879
|
+
}
|
|
880
|
+
);
|
|
910
881
|
default:
|
|
911
|
-
console.log(`\uC9C0\uC6D0\uB418\uC9C0 \uC54A\uB294 \uBE14\uB85D \uD0C0\uC785: ${block.type}`, block);
|
|
912
882
|
return null;
|
|
913
883
|
}
|
|
914
884
|
};
|
|
915
885
|
var BlockRenderer_default = BlockRenderer;
|
|
916
886
|
|
|
917
887
|
// src/styles/theme.css.ts
|
|
918
|
-
var darkTheme = "
|
|
919
|
-
var lightTheme = "
|
|
888
|
+
var darkTheme = "theme_darkTheme__sq3jkb1n";
|
|
889
|
+
var lightTheme = "theme_lightTheme__sq3jkb1m";
|
|
920
890
|
|
|
921
891
|
// src/components/Title/index.tsx
|
|
922
892
|
import { jsx as jsx16 } from "react/jsx-runtime";
|