@texonom/nreact 1.2.0-alpha.0 → 1.2.0
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/LICENSE +21 -0
- package/build/.tsbuildinfo +1 -1
- package/build/{chunk-EFF4TR4V.js → chunk-BYOAK6PN.js} +198 -214
- package/build/{chunk-IJMVEYBL.js → chunk-GDUEQGYI.js} +110 -119
- package/build/{chunk-WMTRTLMM.js → chunk-INDII3MG.js} +180 -213
- package/build/chunk-NH6F5YHO.js +90 -0
- package/build/context.d.ts +1 -1
- package/build/context.d.ts.map +1 -1
- package/build/dev/{chunk-4S3OR5EE.js → chunk-73CYHEZ6.js} +111 -120
- package/build/dev/chunk-73CYHEZ6.js.map +1 -0
- package/build/dev/chunk-EDEWD2W7.js +1363 -0
- package/build/dev/chunk-EDEWD2W7.js.map +1 -0
- package/build/dev/chunk-QAD7OWKG.js +91 -0
- package/build/dev/chunk-QAD7OWKG.js.map +1 -0
- package/build/dev/{chunk-V6MTXIEX.js → chunk-UE6LH4B3.js} +181 -214
- package/build/dev/chunk-UE6LH4B3.js.map +1 -0
- package/build/dev/index.js +1 -5
- package/build/dev/index.js.map +1 -1
- package/build/dev/third-party/code.js +1 -1
- package/build/dev/third-party/collection.js +1 -1
- package/build/dev/third-party/equation.js +1 -1
- package/build/index.js +1 -5
- package/build/renderer.d.ts +1 -1
- package/build/renderer.d.ts.map +1 -1
- package/build/third-party/code.js +1 -1
- package/build/third-party/collection.js +1 -1
- package/build/third-party/equation.js +1 -1
- package/build/utils.d.ts +0 -2
- package/build/utils.d.ts.map +1 -1
- package/package.json +5 -5
- package/build/chunk-J2H2ZFWX.js +0 -1378
- package/build/chunk-N3C4YBY7.js +0 -1378
- package/build/dev/chunk-4S3OR5EE.js.map +0 -1
- package/build/dev/chunk-IV2TXVUO.js +0 -1379
- package/build/dev/chunk-IV2TXVUO.js.map +0 -1
- package/build/dev/chunk-OFKPUFNR.js +0 -1379
- package/build/dev/chunk-OFKPUFNR.js.map +0 -1
- package/build/dev/chunk-V6MTXIEX.js.map +0 -1
- package/build/dev/chunk-XOMF4TSV.js +0 -1379
- package/build/dev/chunk-XOMF4TSV.js.map +0 -1
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__async,
|
|
3
3
|
__commonJS,
|
|
4
|
+
__export,
|
|
4
5
|
__objRest,
|
|
6
|
+
__reExport,
|
|
5
7
|
__spreadProps,
|
|
6
8
|
__spreadValues,
|
|
7
9
|
__toESM
|
|
8
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-NH6F5YHO.js";
|
|
9
11
|
|
|
10
12
|
// ../../node_modules/.pnpm/lodash.throttle@4.1.1/node_modules/lodash.throttle/index.js
|
|
11
13
|
var require_lodash = __commonJS({
|
|
@@ -155,47 +157,41 @@ var require_lodash = __commonJS({
|
|
|
155
157
|
}
|
|
156
158
|
});
|
|
157
159
|
|
|
158
|
-
// src/
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
const u = new URL(url);
|
|
168
|
-
if (u.pathname.startsWith("/secure.notion-static.com") && u.hostname.endsWith(".amazonaws.com")) {
|
|
169
|
-
if (u.searchParams.has("X-Amz-Credential") && u.searchParams.has("X-Amz-Signature") && u.searchParams.has("X-Amz-Algorithm"))
|
|
170
|
-
return url;
|
|
171
|
-
}
|
|
172
|
-
} catch (e) {
|
|
173
|
-
}
|
|
174
|
-
if (url.startsWith("/images"))
|
|
175
|
-
url = `https://www.notion.so${url}`;
|
|
176
|
-
url = `https://www.notion.so${url.startsWith("/image") ? url : `/image/${encodeURIComponent(url)}`}`;
|
|
177
|
-
const notionImageUrlV2 = new URL(url);
|
|
178
|
-
let table = block.parent_table === "space" ? "block" : block.parent_table;
|
|
179
|
-
if (table === "collection" || table === "team")
|
|
180
|
-
table = "block";
|
|
181
|
-
notionImageUrlV2.searchParams.set("table", table);
|
|
182
|
-
notionImageUrlV2.searchParams.set("id", block.id);
|
|
183
|
-
notionImageUrlV2.searchParams.set("cache", "v2");
|
|
184
|
-
url = notionImageUrlV2.toString();
|
|
185
|
-
return url;
|
|
186
|
-
};
|
|
160
|
+
// src/components/checkbox.tsx
|
|
161
|
+
import React2 from "react";
|
|
162
|
+
|
|
163
|
+
// src/icons/check.tsx
|
|
164
|
+
import React from "react";
|
|
165
|
+
function SvgCheck(props) {
|
|
166
|
+
return /* @__PURE__ */ React.createElement("svg", __spreadValues({ viewBox: "0 0 14 14" }, props), /* @__PURE__ */ React.createElement("path", { d: "M5.5 12L14 3.5 12.5 2l-7 7-4-4.003L0 6.499z" }));
|
|
167
|
+
}
|
|
168
|
+
var check_default = SvgCheck;
|
|
187
169
|
|
|
188
|
-
// src/
|
|
189
|
-
var
|
|
190
|
-
|
|
191
|
-
if (
|
|
192
|
-
|
|
170
|
+
// src/components/checkbox.tsx
|
|
171
|
+
var Checkbox = ({ isChecked }) => {
|
|
172
|
+
let content = null;
|
|
173
|
+
if (isChecked)
|
|
174
|
+
content = /* @__PURE__ */ React2.createElement("div", { className: "notion-property-checkbox-checked" }, /* @__PURE__ */ React2.createElement(check_default, null));
|
|
193
175
|
else
|
|
194
|
-
|
|
176
|
+
content = /* @__PURE__ */ React2.createElement("div", { className: "notion-property-checkbox-unchecked" });
|
|
177
|
+
return /* @__PURE__ */ React2.createElement("span", { className: "notion-property notion-property-checkbox" }, content);
|
|
195
178
|
};
|
|
196
179
|
|
|
197
180
|
// src/utils.ts
|
|
181
|
+
var utils_exports = {};
|
|
182
|
+
__export(utils_exports, {
|
|
183
|
+
cs: () => cs,
|
|
184
|
+
formatDate: () => formatDate,
|
|
185
|
+
formatNotionDateTime: () => formatNotionDateTime,
|
|
186
|
+
getHashFragmentValue: () => getHashFragmentValue,
|
|
187
|
+
getListNumber: () => getListNumber,
|
|
188
|
+
getYoutubeId: () => getYoutubeId,
|
|
189
|
+
isBrowser: () => isBrowser,
|
|
190
|
+
isUrl: () => isUrl
|
|
191
|
+
});
|
|
192
|
+
__reExport(utils_exports, map_image_url_star);
|
|
198
193
|
import { isUrl, formatDate, formatNotionDateTime } from "@texonom/nutils";
|
|
194
|
+
import * as map_image_url_star from "@texonom/nutils/src/map-image-url";
|
|
199
195
|
var cs = (...classes) => classes.filter((a) => !!a).join(" ");
|
|
200
196
|
var groupBlockContent = (blockMap) => {
|
|
201
197
|
const output = [];
|
|
@@ -258,25 +254,26 @@ import { getBlockIcon, getBlockTitle as getBlockTitle3 } from "@texonom/nutils";
|
|
|
258
254
|
|
|
259
255
|
// src/context.tsx
|
|
260
256
|
import React18 from "react";
|
|
257
|
+
import { defaultMapImageUrl, defaultMapPageUrl } from "@texonom/nutils";
|
|
261
258
|
|
|
262
259
|
// src/components/asset-wrapper.tsx
|
|
263
|
-
import
|
|
260
|
+
import React11 from "react";
|
|
264
261
|
import { parsePageId as parsePageId2 } from "@texonom/nutils";
|
|
265
262
|
|
|
266
263
|
// src/components/asset.tsx
|
|
267
|
-
import
|
|
264
|
+
import React5 from "react";
|
|
268
265
|
import { getTextContent } from "@texonom/nutils";
|
|
269
266
|
|
|
270
267
|
// src/components/lazy-image.tsx
|
|
271
|
-
import
|
|
268
|
+
import React3 from "react";
|
|
272
269
|
import { normalizeUrl } from "@texonom/nutils";
|
|
273
270
|
var LazyImage = (_a) => {
|
|
274
271
|
var _b = _a, { src, alt, className, style, zoomable = false, priority = false, height } = _b, rest = __objRest(_b, ["src", "alt", "className", "style", "zoomable", "priority", "height"]);
|
|
275
272
|
var _a2, _b2, _c;
|
|
276
273
|
const { recordMap, zoom, previewImages, forceCustomImages, components } = useNotionContext();
|
|
277
|
-
const zoomRef =
|
|
274
|
+
const zoomRef = React3.useRef(zoom ? zoom.clone() : null);
|
|
278
275
|
const previewImage = previewImages ? (_c = (_a2 = recordMap == null ? void 0 : recordMap.preview_images) == null ? void 0 : _a2[src]) != null ? _c : (_b2 = recordMap == null ? void 0 : recordMap.preview_images) == null ? void 0 : _b2[normalizeUrl(src)] : null;
|
|
279
|
-
const onLoad =
|
|
276
|
+
const onLoad = React3.useCallback(
|
|
280
277
|
(e) => {
|
|
281
278
|
if (zoomable && (e.target.src || e.target.srcset)) {
|
|
282
279
|
if (zoomRef.current)
|
|
@@ -285,16 +282,16 @@ var LazyImage = (_a) => {
|
|
|
285
282
|
},
|
|
286
283
|
[zoomRef, zoomable]
|
|
287
284
|
);
|
|
288
|
-
const attachZoom =
|
|
285
|
+
const attachZoom = React3.useCallback(
|
|
289
286
|
(image) => {
|
|
290
287
|
if (zoomRef.current && image)
|
|
291
288
|
zoomRef.current.attach(image);
|
|
292
289
|
},
|
|
293
290
|
[zoomRef]
|
|
294
291
|
);
|
|
295
|
-
const attachZoomRef =
|
|
292
|
+
const attachZoomRef = React3.useMemo(() => zoomable ? attachZoom : void 0, [zoomable, attachZoom]);
|
|
296
293
|
if (previewImage && components.Image) {
|
|
297
|
-
return /* @__PURE__ */
|
|
294
|
+
return /* @__PURE__ */ React3.createElement(
|
|
298
295
|
components.Image,
|
|
299
296
|
{
|
|
300
297
|
src,
|
|
@@ -311,7 +308,7 @@ var LazyImage = (_a) => {
|
|
|
311
308
|
);
|
|
312
309
|
} else {
|
|
313
310
|
if (components.Image && forceCustomImages)
|
|
314
|
-
return /* @__PURE__ */
|
|
311
|
+
return /* @__PURE__ */ React3.createElement(
|
|
315
312
|
components.Image,
|
|
316
313
|
{
|
|
317
314
|
src,
|
|
@@ -324,7 +321,7 @@ var LazyImage = (_a) => {
|
|
|
324
321
|
onLoad
|
|
325
322
|
}
|
|
326
323
|
);
|
|
327
|
-
return /* @__PURE__ */
|
|
324
|
+
return /* @__PURE__ */ React3.createElement(
|
|
328
325
|
"img",
|
|
329
326
|
__spreadValues({
|
|
330
327
|
className,
|
|
@@ -340,7 +337,7 @@ var LazyImage = (_a) => {
|
|
|
340
337
|
};
|
|
341
338
|
|
|
342
339
|
// src/components/lite-youtube-embed.tsx
|
|
343
|
-
import
|
|
340
|
+
import React4 from "react";
|
|
344
341
|
var qs = (params) => {
|
|
345
342
|
return Object.keys(params).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`).join("&");
|
|
346
343
|
};
|
|
@@ -357,28 +354,28 @@ var LiteYouTubeEmbed = ({
|
|
|
357
354
|
className
|
|
358
355
|
}) => {
|
|
359
356
|
const muteParam = mute || defaultPlay ? "1" : "0";
|
|
360
|
-
const queryString =
|
|
357
|
+
const queryString = React4.useMemo(() => qs(__spreadValues({ autoplay: "1", mute: muteParam }, params)), [muteParam, params]);
|
|
361
358
|
const resolution = "hqdefault";
|
|
362
359
|
const posterUrl = `https://i.ytimg.com/vi/${id}/${resolution}.jpg`;
|
|
363
360
|
const ytUrl = "https://www.youtube-nocookie.com";
|
|
364
361
|
const iframeSrc = `${ytUrl}/embed/${id}?${queryString}`;
|
|
365
|
-
const [isPreconnected, setIsPreconnected] =
|
|
366
|
-
const [iframeInitialized, setIframeInitialized] =
|
|
367
|
-
const [isIframeLoaded, setIsIframeLoaded] =
|
|
368
|
-
const warmConnections =
|
|
362
|
+
const [isPreconnected, setIsPreconnected] = React4.useState(false);
|
|
363
|
+
const [iframeInitialized, setIframeInitialized] = React4.useState(defaultPlay);
|
|
364
|
+
const [isIframeLoaded, setIsIframeLoaded] = React4.useState(false);
|
|
365
|
+
const warmConnections = React4.useCallback(() => {
|
|
369
366
|
if (isPreconnected)
|
|
370
367
|
return;
|
|
371
368
|
setIsPreconnected(true);
|
|
372
369
|
}, [isPreconnected]);
|
|
373
|
-
const onLoadIframe =
|
|
370
|
+
const onLoadIframe = React4.useCallback(() => {
|
|
374
371
|
if (iframeInitialized)
|
|
375
372
|
return;
|
|
376
373
|
setIframeInitialized(true);
|
|
377
374
|
}, [iframeInitialized]);
|
|
378
|
-
const onIframeLoaded =
|
|
375
|
+
const onIframeLoaded = React4.useCallback(() => {
|
|
379
376
|
setIsIframeLoaded(true);
|
|
380
377
|
}, []);
|
|
381
|
-
return /* @__PURE__ */
|
|
378
|
+
return /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement("link", { rel: "preload", href: posterUrl, as: "image" }), isPreconnected && /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement("link", { rel: "preconnect", href: ytUrl }), /* @__PURE__ */ React4.createElement("link", { rel: "preconnect", href: "https://www.google.com" })), isPreconnected && adLinksPreconnect && /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement("link", { rel: "preconnect", href: "https://static.doubleclick.net" }), /* @__PURE__ */ React4.createElement("link", { rel: "preconnect", href: "https://googleads.g.doubleclick.net" })), /* @__PURE__ */ React4.createElement(
|
|
382
379
|
"div",
|
|
383
380
|
{
|
|
384
381
|
onClick: onLoadIframe,
|
|
@@ -391,9 +388,9 @@ var LiteYouTubeEmbed = ({
|
|
|
391
388
|
),
|
|
392
389
|
style
|
|
393
390
|
},
|
|
394
|
-
/* @__PURE__ */
|
|
395
|
-
/* @__PURE__ */
|
|
396
|
-
iframeInitialized && /* @__PURE__ */
|
|
391
|
+
/* @__PURE__ */ React4.createElement("img", { src: posterUrl, className: "notion-yt-thumbnail", loading: lazyImage ? "lazy" : void 0, alt }),
|
|
392
|
+
/* @__PURE__ */ React4.createElement("div", { className: "notion-yt-playbtn" }),
|
|
393
|
+
iframeInitialized && /* @__PURE__ */ React4.createElement(
|
|
397
394
|
"iframe",
|
|
398
395
|
{
|
|
399
396
|
width: "560",
|
|
@@ -507,7 +504,7 @@ var Asset = ({ block, zoomable = true, children }) => {
|
|
|
507
504
|
const id = src.split("?")[0].split("/").pop();
|
|
508
505
|
if (!id)
|
|
509
506
|
return null;
|
|
510
|
-
content = /* @__PURE__ */
|
|
507
|
+
content = /* @__PURE__ */ React5.createElement(
|
|
511
508
|
"div",
|
|
512
509
|
{
|
|
513
510
|
style: __spreadProps(__spreadValues({}, assetStyle), {
|
|
@@ -517,7 +514,7 @@ var Asset = ({ block, zoomable = true, children }) => {
|
|
|
517
514
|
marginRight: "auto"
|
|
518
515
|
})
|
|
519
516
|
},
|
|
520
|
-
/* @__PURE__ */
|
|
517
|
+
/* @__PURE__ */ React5.createElement(components.Tweet, { id })
|
|
521
518
|
);
|
|
522
519
|
} else if (block.type === "pdf") {
|
|
523
520
|
style.overflow = "auto";
|
|
@@ -526,23 +523,23 @@ var Asset = ({ block, zoomable = true, children }) => {
|
|
|
526
523
|
if (!style.padding)
|
|
527
524
|
style.padding = "8px 16px";
|
|
528
525
|
if (!isServer)
|
|
529
|
-
content = /* @__PURE__ */
|
|
526
|
+
content = /* @__PURE__ */ React5.createElement(components.Pdf, { file: source });
|
|
530
527
|
} else if (block.type === "embed" || block.type === "video" || block.type === "figma" || block.type === "typeform" || block.type === "gist" || block.type === "maps" || block.type === "excalidraw" || block.type === "codepen" || block.type === "drive") {
|
|
531
528
|
if (block.type === "video" && source && source.indexOf("youtube") < 0 && source.indexOf("youtu.be") < 0 && source.indexOf("vimeo") < 0 && source.indexOf("wistia") < 0 && source.indexOf("loom") < 0 && source.indexOf("videoask") < 0 && source.indexOf("getcloudapp") < 0) {
|
|
532
529
|
style.paddingBottom = void 0;
|
|
533
|
-
content = /* @__PURE__ */
|
|
530
|
+
content = /* @__PURE__ */ React5.createElement("video", { playsInline: true, controls: true, preload: "metadata", style: assetStyle, src: source, title: block.type });
|
|
534
531
|
} else {
|
|
535
532
|
let src = ((_f = block.format) == null ? void 0 : _f.display_source) || source;
|
|
536
533
|
if (src) {
|
|
537
534
|
const youtubeVideoId = block.type === "video" ? getYoutubeId(src) : null;
|
|
538
535
|
if (youtubeVideoId) {
|
|
539
|
-
content = /* @__PURE__ */
|
|
536
|
+
content = /* @__PURE__ */ React5.createElement(LiteYouTubeEmbed, { id: youtubeVideoId, style: assetStyle, className: "notion-asset-object-fit" });
|
|
540
537
|
} else if (block.type === "gist") {
|
|
541
538
|
if (!src.endsWith(".pibb"))
|
|
542
539
|
src = `${src}.pibb`;
|
|
543
540
|
assetStyle.width = "100%";
|
|
544
541
|
style.paddingBottom = "50%";
|
|
545
|
-
content = /* @__PURE__ */
|
|
542
|
+
content = /* @__PURE__ */ React5.createElement(
|
|
546
543
|
"iframe",
|
|
547
544
|
{
|
|
548
545
|
style: assetStyle,
|
|
@@ -555,7 +552,7 @@ var Asset = ({ block, zoomable = true, children }) => {
|
|
|
555
552
|
}
|
|
556
553
|
);
|
|
557
554
|
} else {
|
|
558
|
-
content = /* @__PURE__ */
|
|
555
|
+
content = /* @__PURE__ */ React5.createElement(
|
|
559
556
|
"iframe",
|
|
560
557
|
{
|
|
561
558
|
className: "notion-asset-object-fit",
|
|
@@ -577,22 +574,22 @@ var Asset = ({ block, zoomable = true, children }) => {
|
|
|
577
574
|
const src = mapImageUrl(source, block);
|
|
578
575
|
const caption = getTextContent((_j = block.properties) == null ? void 0 : _j.caption);
|
|
579
576
|
const alt = caption || "notion image";
|
|
580
|
-
content = /* @__PURE__ */
|
|
577
|
+
content = /* @__PURE__ */ React5.createElement(LazyImage, { src, alt, zoomable, height: style.height, style: assetStyle });
|
|
581
578
|
}
|
|
582
|
-
return /* @__PURE__ */
|
|
579
|
+
return /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement("div", { style }, content, block.type === "image" && children), block.type !== "image" && children);
|
|
583
580
|
};
|
|
584
581
|
|
|
585
582
|
// src/components/text.tsx
|
|
586
|
-
import
|
|
583
|
+
import React10 from "react";
|
|
587
584
|
import { parsePageId } from "@texonom/nutils";
|
|
588
585
|
|
|
589
586
|
// src/components/eoi.tsx
|
|
590
|
-
import
|
|
587
|
+
import React7 from "react";
|
|
591
588
|
|
|
592
589
|
// src/icons/type-github.tsx
|
|
593
|
-
import
|
|
590
|
+
import React6 from "react";
|
|
594
591
|
function SvgTypeGitHub(props) {
|
|
595
|
-
return /* @__PURE__ */
|
|
592
|
+
return /* @__PURE__ */ React6.createElement("svg", __spreadValues({ viewBox: "0 0 260 260" }, props), /* @__PURE__ */ React6.createElement("g", null, /* @__PURE__ */ React6.createElement(
|
|
596
593
|
"path",
|
|
597
594
|
{
|
|
598
595
|
d: "M128.00106,0 C57.3172926,0 0,57.3066942 0,128.00106 C0,184.555281 36.6761997,232.535542 87.534937,249.460899 C93.9320223,250.645779 96.280588,246.684165 96.280588,243.303333 C96.280588,240.251045 96.1618878,230.167899 96.106777,219.472176 C60.4967585,227.215235 52.9826207,204.369712 52.9826207,204.369712 C47.1599584,189.574598 38.770408,185.640538 38.770408,185.640538 C27.1568785,177.696113 39.6458206,177.859325 39.6458206,177.859325 C52.4993419,178.762293 59.267365,191.04987 59.267365,191.04987 C70.6837675,210.618423 89.2115753,204.961093 96.5158685,201.690482 C97.6647155,193.417512 100.981959,187.77078 104.642583,184.574357 C76.211799,181.33766 46.324819,170.362144 46.324819,121.315702 C46.324819,107.340889 51.3250588,95.9223682 59.5132437,86.9583937 C58.1842268,83.7344152 53.8029229,70.715562 60.7532354,53.0843636 C60.7532354,53.0843636 71.5019501,49.6441813 95.9626412,66.2049595 C106.172967,63.368876 117.123047,61.9465949 128.00106,61.8978432 C138.879073,61.9465949 149.837632,63.368876 160.067033,66.2049595 C184.49805,49.6441813 195.231926,53.0843636 195.231926,53.0843636 C202.199197,70.715562 197.815773,83.7344152 196.486756,86.9583937 C204.694018,95.9223682 209.660343,107.340889 209.660343,121.315702 C209.660343,170.478725 179.716133,181.303747 151.213281,184.472614 C155.80443,188.444828 159.895342,196.234518 159.895342,208.176593 C159.895342,225.303317 159.746968,239.087361 159.746968,243.303333 C159.746968,246.709601 162.05102,250.70089 168.53925,249.443941 C219.370432,232.499507 256,184.536204 256,128.00106 C256,57.3066942 198.691187,0 128.00106,0 Z M47.9405593,182.340212 C47.6586465,182.976105 46.6581745,183.166873 45.7467277,182.730227 C44.8183235,182.312656 44.2968914,181.445722 44.5978808,180.80771 C44.8734344,180.152739 45.876026,179.97045 46.8023103,180.409216 C47.7328342,180.826786 48.2627451,181.702199 47.9405593,182.340212 Z M54.2367892,187.958254 C53.6263318,188.524199 52.4329723,188.261363 51.6232682,187.366874 C50.7860088,186.474504 50.6291553,185.281144 51.2480912,184.70672 C51.8776254,184.140775 53.0349512,184.405731 53.8743302,185.298101 C54.7115892,186.201069 54.8748019,187.38595 54.2367892,187.958254 Z M58.5562413,195.146347 C57.7719732,195.691096 56.4895886,195.180261 55.6968417,194.042013 C54.9125733,192.903764 54.9125733,191.538713 55.713799,190.991845 C56.5086651,190.444977 57.7719732,190.936735 58.5753181,192.066505 C59.3574669,193.22383 59.3574669,194.58888 58.5562413,195.146347 Z M65.8613592,203.471174 C65.1597571,204.244846 63.6654083,204.03712 62.5716717,202.981538 C61.4524999,201.94927 61.1409122,200.484596 61.8446341,199.710926 C62.5547146,198.935137 64.0575422,199.15346 65.1597571,200.200564 C66.2704506,201.230712 66.6095936,202.705984 65.8613592,203.471174 Z M75.3025151,206.281542 C74.9930474,207.284134 73.553809,207.739857 72.1039724,207.313809 C70.6562556,206.875043 69.7087748,205.700761 70.0012857,204.687571 C70.302275,203.678621 71.7478721,203.20382 73.2083069,203.659543 C74.6539041,204.09619 75.6035048,205.261994 75.3025151,206.281542 Z M86.046947,207.473627 C86.0829806,208.529209 84.8535871,209.404622 83.3316829,209.4237 C81.8013,209.457614 80.563428,208.603398 80.5464708,207.564772 C80.5464708,206.498591 81.7483088,205.631657 83.2786917,205.606221 C84.8005962,205.576546 86.046947,206.424403 86.046947,207.473627 Z M96.6021471,207.069023 C96.7844366,208.099171 95.7267341,209.156872 94.215428,209.438785 C92.7295577,209.710099 91.3539086,209.074206 91.1652603,208.052538 C90.9808515,206.996955 92.0576306,205.939253 93.5413813,205.66582 C95.054807,205.402984 96.4092596,206.021919 96.6021471,207.069023 Z",
|
|
@@ -616,7 +613,7 @@ var EOI = ({ block, inline, className }) => {
|
|
|
616
613
|
let externalImage;
|
|
617
614
|
switch (domain) {
|
|
618
615
|
case "github.com":
|
|
619
|
-
externalImage = /* @__PURE__ */
|
|
616
|
+
externalImage = /* @__PURE__ */ React7.createElement(type_github_default, null);
|
|
620
617
|
if (owner) {
|
|
621
618
|
const parts = owner.split("/");
|
|
622
619
|
owner = parts[parts.length - 1];
|
|
@@ -627,7 +624,7 @@ var EOI = ({ block, inline, className }) => {
|
|
|
627
624
|
console.debug(`Unsupported external_object_instance domain "${domain}"`, JSON.stringify(block, null, 2));
|
|
628
625
|
return null;
|
|
629
626
|
}
|
|
630
|
-
return /* @__PURE__ */
|
|
627
|
+
return /* @__PURE__ */ React7.createElement(
|
|
631
628
|
components.Link,
|
|
632
629
|
{
|
|
633
630
|
target: "_blank",
|
|
@@ -635,23 +632,23 @@ var EOI = ({ block, inline, className }) => {
|
|
|
635
632
|
href: original_url,
|
|
636
633
|
className: cs("notion-external", inline ? "notion-external-mention" : "notion-external-block notion-row", className)
|
|
637
634
|
},
|
|
638
|
-
externalImage && /* @__PURE__ */
|
|
639
|
-
/* @__PURE__ */
|
|
635
|
+
externalImage && /* @__PURE__ */ React7.createElement("div", { className: "notion-external-image" }, externalImage),
|
|
636
|
+
/* @__PURE__ */ React7.createElement("div", { className: "notion-external-description" }, /* @__PURE__ */ React7.createElement("div", { className: "notion-external-title" }, title), (owner || lastUpdated) && /* @__PURE__ */ React7.createElement("div", { className: "notion-external-subtitle" }, owner && /* @__PURE__ */ React7.createElement("span", null, owner), owner && lastUpdated && /* @__PURE__ */ React7.createElement("span", null, " \u2022 "), lastUpdated && /* @__PURE__ */ React7.createElement("span", null, "Updated ", lastUpdated)))
|
|
640
637
|
);
|
|
641
638
|
};
|
|
642
639
|
|
|
643
640
|
// src/components/graceful-image.tsx
|
|
644
|
-
import
|
|
641
|
+
import React8 from "react";
|
|
645
642
|
import { Img } from "react-image";
|
|
646
643
|
var GracefulImage = (props) => {
|
|
647
644
|
if (isBrowser)
|
|
648
|
-
return /* @__PURE__ */
|
|
645
|
+
return /* @__PURE__ */ React8.createElement(Img, __spreadValues({}, props));
|
|
649
646
|
else
|
|
650
|
-
return /* @__PURE__ */
|
|
647
|
+
return /* @__PURE__ */ React8.createElement("img", __spreadValues({}, props));
|
|
651
648
|
};
|
|
652
649
|
|
|
653
650
|
// src/components/page-title.tsx
|
|
654
|
-
import
|
|
651
|
+
import React9 from "react";
|
|
655
652
|
import { getBlockTitle } from "@texonom/nutils";
|
|
656
653
|
var PageTitleImpl = (_a) => {
|
|
657
654
|
var _b = _a, { block, className, defaultIcon } = _b, rest = __objRest(_b, ["block", "className", "defaultIcon"]);
|
|
@@ -664,138 +661,142 @@ var PageTitleImpl = (_a) => {
|
|
|
664
661
|
if (!title)
|
|
665
662
|
return null;
|
|
666
663
|
const titleDecoration = [[title]];
|
|
667
|
-
return /* @__PURE__ */
|
|
664
|
+
return /* @__PURE__ */ React9.createElement("span", __spreadValues({ className: cs("notion-page-title", className) }, rest), /* @__PURE__ */ React9.createElement(PageIcon, { block, defaultIcon, className: "notion-page-title-icon" }), /* @__PURE__ */ React9.createElement("span", { className: "notion-page-title-text" }, /* @__PURE__ */ React9.createElement(Text, { value: titleDecoration, block })));
|
|
668
665
|
}
|
|
669
666
|
if (!((_a2 = block.properties) == null ? void 0 : _a2.title))
|
|
670
667
|
return null;
|
|
671
|
-
return /* @__PURE__ */
|
|
668
|
+
return /* @__PURE__ */ React9.createElement("span", __spreadValues({ className: cs("notion-page-title", className) }, rest), /* @__PURE__ */ React9.createElement(PageIcon, { block, defaultIcon, className: "notion-page-title-icon" }), /* @__PURE__ */ React9.createElement("span", { className: "notion-page-title-text" }, /* @__PURE__ */ React9.createElement(Text, { value: (_b2 = block.properties) == null ? void 0 : _b2.title, block })));
|
|
672
669
|
};
|
|
673
|
-
var PageTitle =
|
|
670
|
+
var PageTitle = React9.memo(PageTitleImpl);
|
|
674
671
|
|
|
675
672
|
// src/components/text.tsx
|
|
676
673
|
var Text = ({ value, block, linkProps, linkProtocol }) => {
|
|
677
674
|
const { components, recordMap, mapPageUrl, mapImageUrl, rootDomain } = useNotionContext();
|
|
678
|
-
return /* @__PURE__ */
|
|
675
|
+
return /* @__PURE__ */ React10.createElement(React10.Fragment, null, value == null ? void 0 : value.map((deco, index) => {
|
|
676
|
+
const [text, decorations] = deco;
|
|
679
677
|
if (!decorations)
|
|
680
678
|
if (text === ",")
|
|
681
|
-
return /* @__PURE__ */
|
|
679
|
+
return /* @__PURE__ */ React10.createElement("span", { key: index, style: { padding: "0.5em" } });
|
|
682
680
|
else
|
|
683
|
-
return /* @__PURE__ */
|
|
684
|
-
const formatted = decorations.reduce(
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
681
|
+
return /* @__PURE__ */ React10.createElement(React10.Fragment, { key: index }, text);
|
|
682
|
+
const formatted = decorations.reduce(
|
|
683
|
+
(element, decorator) => {
|
|
684
|
+
var _a, _b, _c, _d, _e;
|
|
685
|
+
switch (decorator[0]) {
|
|
686
|
+
case "p": {
|
|
687
|
+
const blockId = decorator[1];
|
|
688
|
+
const linkedBlock = (_a = recordMap.block[blockId]) == null ? void 0 : _a.value;
|
|
689
|
+
if (!linkedBlock) {
|
|
690
|
+
console.debug('"p" missing block', blockId);
|
|
691
|
+
return null;
|
|
692
|
+
}
|
|
693
|
+
return /* @__PURE__ */ React10.createElement(components.PageLink, { className: "notion-link", href: mapPageUrl(blockId) }, /* @__PURE__ */ React10.createElement(PageTitle, { block: linkedBlock }));
|
|
693
694
|
}
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
695
|
+
case "\u2023": {
|
|
696
|
+
const linkType = decorator[1][0];
|
|
697
|
+
const id = decorator[1][1];
|
|
698
|
+
switch (linkType) {
|
|
699
|
+
case "u": {
|
|
700
|
+
const user = (_b = recordMap.notion_user[id]) == null ? void 0 : _b.value;
|
|
701
|
+
if (!user) {
|
|
702
|
+
console.debug('"\u2023" missing user', id);
|
|
703
|
+
return null;
|
|
704
|
+
}
|
|
705
|
+
const name = [user.given_name, user.family_name].filter(Boolean).join(" ");
|
|
706
|
+
return /* @__PURE__ */ React10.createElement(GracefulImage, { className: "notion-user", src: mapImageUrl(user.profile_photo, block), alt: name });
|
|
705
707
|
}
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
708
|
+
default: {
|
|
709
|
+
const linkedBlock = (_c = recordMap.block[id]) == null ? void 0 : _c.value;
|
|
710
|
+
if (!linkedBlock) {
|
|
711
|
+
console.debug('"\u2023" missing block', linkType, id);
|
|
712
|
+
return null;
|
|
713
|
+
}
|
|
714
|
+
return /* @__PURE__ */ React10.createElement(
|
|
715
|
+
components.PageLink,
|
|
716
|
+
__spreadProps(__spreadValues({
|
|
717
|
+
className: "notion-link",
|
|
718
|
+
href: mapPageUrl(id)
|
|
719
|
+
}, linkProps), {
|
|
720
|
+
target: "_blank",
|
|
721
|
+
rel: "noopener noreferrer"
|
|
722
|
+
}),
|
|
723
|
+
/* @__PURE__ */ React10.createElement(PageTitle, { block: linkedBlock })
|
|
724
|
+
);
|
|
714
725
|
}
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
case "h":
|
|
729
|
+
return /* @__PURE__ */ React10.createElement("span", { className: `notion-${decorator[1]}` }, element);
|
|
730
|
+
case "c":
|
|
731
|
+
return /* @__PURE__ */ React10.createElement("code", { className: "notion-inline-code" }, element);
|
|
732
|
+
case "b":
|
|
733
|
+
return /* @__PURE__ */ React10.createElement("b", null, element);
|
|
734
|
+
case "i":
|
|
735
|
+
return /* @__PURE__ */ React10.createElement("em", null, element);
|
|
736
|
+
case "s":
|
|
737
|
+
return /* @__PURE__ */ React10.createElement("s", null, element);
|
|
738
|
+
case "_":
|
|
739
|
+
return /* @__PURE__ */ React10.createElement("span", { className: "notion-inline-underscore" }, element);
|
|
740
|
+
case "e":
|
|
741
|
+
return /* @__PURE__ */ React10.createElement(components.Equation, { math: decorator[1], inline: true });
|
|
742
|
+
case "m":
|
|
743
|
+
return element;
|
|
744
|
+
case "a": {
|
|
745
|
+
const v = decorator[1];
|
|
746
|
+
const pathname = v.substring(1);
|
|
747
|
+
const id = parsePageId(pathname, { uuid: true });
|
|
748
|
+
if ((v[0] === "/" || v.includes(rootDomain)) && id) {
|
|
749
|
+
const href = v.includes(rootDomain) ? v : `${mapPageUrl(id)}${getHashFragmentValue(v)}`;
|
|
750
|
+
return /* @__PURE__ */ React10.createElement(components.PageLink, __spreadValues({ className: "notion-link", href }, linkProps), element);
|
|
751
|
+
} else {
|
|
752
|
+
return /* @__PURE__ */ React10.createElement(
|
|
753
|
+
components.Link,
|
|
754
|
+
__spreadValues({
|
|
718
755
|
className: "notion-link",
|
|
719
|
-
href:
|
|
720
|
-
}, linkProps),
|
|
721
|
-
|
|
722
|
-
rel: "noopener noreferrer"
|
|
723
|
-
}),
|
|
724
|
-
/* @__PURE__ */ React8.createElement(PageTitle, { block: linkedBlock })
|
|
756
|
+
href: linkProtocol ? `${linkProtocol}:${decorator[1]}` : decorator[1]
|
|
757
|
+
}, linkProps),
|
|
758
|
+
element
|
|
725
759
|
);
|
|
726
760
|
}
|
|
727
761
|
}
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
case "e":
|
|
742
|
-
return /* @__PURE__ */ React8.createElement(components.Equation, { math: decorator[1], inline: true });
|
|
743
|
-
case "m":
|
|
744
|
-
return element;
|
|
745
|
-
case "a": {
|
|
746
|
-
const v = decorator[1];
|
|
747
|
-
const pathname = v.substring(1);
|
|
748
|
-
const id = parsePageId(pathname, { uuid: true });
|
|
749
|
-
if ((v[0] === "/" || v.includes(rootDomain)) && id) {
|
|
750
|
-
const href = v.includes(rootDomain) ? v : `${mapPageUrl(id)}${getHashFragmentValue(v)}`;
|
|
751
|
-
return /* @__PURE__ */ React8.createElement(components.PageLink, __spreadValues({ className: "notion-link", href }, linkProps), element);
|
|
752
|
-
} else {
|
|
753
|
-
return /* @__PURE__ */ React8.createElement(
|
|
754
|
-
components.Link,
|
|
755
|
-
__spreadValues({
|
|
756
|
-
className: "notion-link",
|
|
757
|
-
href: linkProtocol ? `${linkProtocol}:${decorator[1]}` : decorator[1]
|
|
758
|
-
}, linkProps),
|
|
759
|
-
element
|
|
760
|
-
);
|
|
762
|
+
case "d": {
|
|
763
|
+
const v = decorator[1];
|
|
764
|
+
const type = v == null ? void 0 : v.type;
|
|
765
|
+
if (type === "date") {
|
|
766
|
+
const startDate = v.start_date;
|
|
767
|
+
return formatDate(startDate);
|
|
768
|
+
} else if (type === "daterange") {
|
|
769
|
+
const startDate = v.start_date;
|
|
770
|
+
const endDate = v.end_date;
|
|
771
|
+
return `${formatDate(startDate)} \u2192 ${formatDate(endDate)}`;
|
|
772
|
+
} else {
|
|
773
|
+
return element;
|
|
774
|
+
}
|
|
761
775
|
}
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
const endDate = v.end_date;
|
|
772
|
-
return `${formatDate(startDate)} \u2192 ${formatDate(endDate)}`;
|
|
773
|
-
} else {
|
|
774
|
-
return element;
|
|
776
|
+
case "u": {
|
|
777
|
+
const userId = decorator[1];
|
|
778
|
+
const user = (_d = recordMap.notion_user[userId]) == null ? void 0 : _d.value;
|
|
779
|
+
if (!user) {
|
|
780
|
+
console.debug("missing user", userId);
|
|
781
|
+
return null;
|
|
782
|
+
}
|
|
783
|
+
const name = [user.given_name, user.family_name].filter(Boolean).join(" ");
|
|
784
|
+
return /* @__PURE__ */ React10.createElement(GracefulImage, { className: "notion-user", src: mapImageUrl(user.profile_photo, block), alt: name });
|
|
775
785
|
}
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
if (!user) {
|
|
781
|
-
console.debug("missing user", userId);
|
|
782
|
-
return null;
|
|
786
|
+
case "eoi": {
|
|
787
|
+
const blockId = decorator[1];
|
|
788
|
+
const externalObjectInstance = (_e = recordMap.block[blockId]) == null ? void 0 : _e.value;
|
|
789
|
+
return /* @__PURE__ */ React10.createElement(EOI, { block: externalObjectInstance, inline: true });
|
|
783
790
|
}
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
const blockId = decorator[1];
|
|
789
|
-
const externalObjectInstance = (_e = recordMap.block[blockId]) == null ? void 0 : _e.value;
|
|
790
|
-
return /* @__PURE__ */ React8.createElement(EOI, { block: externalObjectInstance, inline: true });
|
|
791
|
+
default:
|
|
792
|
+
if (true)
|
|
793
|
+
console.debug("unsupported text format", decorator);
|
|
794
|
+
return element;
|
|
791
795
|
}
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
}
|
|
797
|
-
}, /* @__PURE__ */ React8.createElement(React8.Fragment, null, text));
|
|
798
|
-
return /* @__PURE__ */ React8.createElement(React8.Fragment, { key: index }, formatted);
|
|
796
|
+
},
|
|
797
|
+
/* @__PURE__ */ React10.createElement(React10.Fragment, null, text)
|
|
798
|
+
);
|
|
799
|
+
return /* @__PURE__ */ React10.createElement(React10.Fragment, { key: index }, formatted);
|
|
799
800
|
}));
|
|
800
801
|
};
|
|
801
802
|
|
|
@@ -815,7 +816,7 @@ var AssetWrapper = ({ blockId, block }) => {
|
|
|
815
816
|
isURL = true;
|
|
816
817
|
}
|
|
817
818
|
}
|
|
818
|
-
const figure = /* @__PURE__ */
|
|
819
|
+
const figure = /* @__PURE__ */ React11.createElement(
|
|
819
820
|
"figure",
|
|
820
821
|
{
|
|
821
822
|
className: cs(
|
|
@@ -825,14 +826,14 @@ var AssetWrapper = ({ blockId, block }) => {
|
|
|
825
826
|
blockId
|
|
826
827
|
)
|
|
827
828
|
},
|
|
828
|
-
/* @__PURE__ */
|
|
829
|
+
/* @__PURE__ */ React11.createElement(Asset, { block: value, zoomable: zoom && !isURL }, ((_e = value == null ? void 0 : value.properties) == null ? void 0 : _e.caption) && !isURL && /* @__PURE__ */ React11.createElement("figcaption", { className: "notion-asset-caption" }, /* @__PURE__ */ React11.createElement(Text, { value: value.properties.caption, block })))
|
|
829
830
|
);
|
|
830
831
|
if (isURL) {
|
|
831
832
|
const caption = (_f = value == null ? void 0 : value.properties) == null ? void 0 : _f.caption[0][0];
|
|
832
833
|
const id = parsePageId2(caption, { uuid: true });
|
|
833
834
|
const isPage = caption.charAt(0) === "/" && id;
|
|
834
835
|
const captionHostname = extractHostname(caption);
|
|
835
|
-
return /* @__PURE__ */
|
|
836
|
+
return /* @__PURE__ */ React11.createElement(
|
|
836
837
|
components.PageLink,
|
|
837
838
|
{
|
|
838
839
|
style: urlStyle,
|
|
@@ -860,26 +861,6 @@ function extractHostname(url) {
|
|
|
860
861
|
}
|
|
861
862
|
}
|
|
862
863
|
|
|
863
|
-
// src/components/checkbox.tsx
|
|
864
|
-
import React11 from "react";
|
|
865
|
-
|
|
866
|
-
// src/icons/check.tsx
|
|
867
|
-
import React10 from "react";
|
|
868
|
-
function SvgCheck(props) {
|
|
869
|
-
return /* @__PURE__ */ React10.createElement("svg", __spreadValues({ viewBox: "0 0 14 14" }, props), /* @__PURE__ */ React10.createElement("path", { d: "M5.5 12L14 3.5 12.5 2l-7 7-4-4.003L0 6.499z" }));
|
|
870
|
-
}
|
|
871
|
-
var check_default = SvgCheck;
|
|
872
|
-
|
|
873
|
-
// src/components/checkbox.tsx
|
|
874
|
-
var Checkbox = ({ isChecked }) => {
|
|
875
|
-
let content = null;
|
|
876
|
-
if (isChecked)
|
|
877
|
-
content = /* @__PURE__ */ React11.createElement("div", { className: "notion-property-checkbox-checked" }, /* @__PURE__ */ React11.createElement(check_default, null));
|
|
878
|
-
else
|
|
879
|
-
content = /* @__PURE__ */ React11.createElement("div", { className: "notion-property-checkbox-unchecked" });
|
|
880
|
-
return /* @__PURE__ */ React11.createElement("span", { className: "notion-property notion-property-checkbox" }, content);
|
|
881
|
-
};
|
|
882
|
-
|
|
883
864
|
// src/components/header.tsx
|
|
884
865
|
import React16 from "react";
|
|
885
866
|
import { getPageBreadcrumbs } from "@texonom/nutils";
|
|
@@ -1349,13 +1330,12 @@ var PageIcon = React20.memo(PageIconImpl);
|
|
|
1349
1330
|
|
|
1350
1331
|
export {
|
|
1351
1332
|
Checkbox,
|
|
1352
|
-
defaultMapImageUrl,
|
|
1353
|
-
defaultMapPageUrl,
|
|
1354
1333
|
cs,
|
|
1355
1334
|
getListNumber,
|
|
1356
1335
|
getHashFragmentValue,
|
|
1357
1336
|
isBrowser,
|
|
1358
1337
|
getYoutubeId,
|
|
1338
|
+
utils_exports,
|
|
1359
1339
|
isUrl,
|
|
1360
1340
|
formatDate,
|
|
1361
1341
|
formatNotionDateTime,
|
|
@@ -1366,7 +1346,9 @@ export {
|
|
|
1366
1346
|
EOI,
|
|
1367
1347
|
GracefulImage,
|
|
1368
1348
|
Text,
|
|
1349
|
+
PageTitleImpl,
|
|
1369
1350
|
PageTitle,
|
|
1351
|
+
SearchDialog,
|
|
1370
1352
|
Header,
|
|
1371
1353
|
Breadcrumbs,
|
|
1372
1354
|
Search,
|
|
@@ -1374,5 +1356,7 @@ export {
|
|
|
1374
1356
|
NotionContextProvider,
|
|
1375
1357
|
NotionContextConsumer,
|
|
1376
1358
|
useNotionContext,
|
|
1359
|
+
LiteYouTubeEmbed,
|
|
1360
|
+
Asset,
|
|
1377
1361
|
AssetWrapper
|
|
1378
1362
|
};
|