@texonom/nreact 1.3.1 → 1.4.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/build/.tsbuildinfo +1 -1
- package/build/{chunk-HJGIONX2.js → chunk-72RHNPWF.js} +56 -107
- package/build/{chunk-LB5ZQ7L5.js → chunk-P7HX4BAT.js} +2 -3
- package/build/dev/{chunk-NVAEYUJK.js → chunk-64UJZ76E.js} +57 -108
- package/build/dev/{chunk-NVAEYUJK.js.map → chunk-64UJZ76E.js.map} +1 -1
- package/build/dev/{chunk-CWNFRR32.js → chunk-ABDRHJEI.js} +3 -4
- package/build/dev/{chunk-CWNFRR32.js.map → chunk-ABDRHJEI.js.map} +1 -1
- package/build/dev/{chunk-JX5CEG3A.js → chunk-OAIRL2FN.js} +1 -1
- package/build/dev/{chunk-4XJBBVRZ.js → chunk-SEA7YL2O.js} +57 -108
- package/build/dev/chunk-SEA7YL2O.js.map +1 -0
- package/build/dev/index.js +42 -55
- package/build/dev/index.js.map +1 -1
- package/build/dev/third-party/code.js +3 -4
- package/build/dev/third-party/code.js.map +1 -1
- package/build/dev/third-party/collection.js +137 -113
- package/build/dev/third-party/collection.js.map +1 -1
- package/build/dev/third-party/equation.js +3 -4
- package/build/dev/third-party/equation.js.map +1 -1
- package/build/dev/third-party/modal.js +1 -1
- package/build/dev/third-party/pdf.js +1 -1
- package/build/index.js +42 -55
- package/build/next.d.ts.map +1 -1
- package/build/third-party/code.js +3 -4
- package/build/third-party/collection.js +137 -113
- package/build/third-party/equation.js +3 -4
- package/build/third-party/modal.js +1 -1
- package/build/third-party/pdf.js +1 -1
- package/build/utils.d.ts.map +1 -1
- package/package.json +12 -12
- package/build/chunk-26XPY26R.js +0 -1364
- package/build/chunk-3GUXT4PT.js +0 -1386
- package/build/chunk-3R4ITV3N.js +0 -1358
- package/build/chunk-626ANHMX.js +0 -4519
- package/build/chunk-BYOAK6PN.js +0 -1362
- package/build/chunk-E7SOYYOP.js +0 -1364
- package/build/chunk-GDUEQGYI.js +0 -1373
- package/build/chunk-INDII3MG.js +0 -1346
- package/build/chunk-LAZZ76RR.js +0 -142
- package/build/chunk-NH6F5YHO.js +0 -90
- package/build/chunk-THLNCQWF.js +0 -1364
- package/build/chunk-YEVPS76Z.js +0 -1355
- package/build/dev/chunk-2LHADYU7.js +0 -1365
- package/build/dev/chunk-2LHADYU7.js.map +0 -1
- package/build/dev/chunk-4XJBBVRZ.js.map +0 -1
- package/build/dev/chunk-5DDQTDIS.js +0 -1365
- package/build/dev/chunk-5DDQTDIS.js.map +0 -1
- package/build/dev/chunk-73CYHEZ6.js +0 -1374
- package/build/dev/chunk-73CYHEZ6.js.map +0 -1
- package/build/dev/chunk-7R2ZX3WF.js +0 -1359
- package/build/dev/chunk-7R2ZX3WF.js.map +0 -1
- package/build/dev/chunk-CRSVOVI5.js +0 -1387
- package/build/dev/chunk-CRSVOVI5.js.map +0 -1
- package/build/dev/chunk-EDEWD2W7.js +0 -1363
- package/build/dev/chunk-EDEWD2W7.js.map +0 -1
- package/build/dev/chunk-O5ZUWUSN.js +0 -158
- package/build/dev/chunk-O5ZUWUSN.js.map +0 -1
- package/build/dev/chunk-QAD7OWKG.js +0 -91
- package/build/dev/chunk-QAD7OWKG.js.map +0 -1
- package/build/dev/chunk-QHYYIFZL.js +0 -1365
- package/build/dev/chunk-QHYYIFZL.js.map +0 -1
- package/build/dev/chunk-QN4Z7A2J.js +0 -1359
- package/build/dev/chunk-QN4Z7A2J.js.map +0 -1
- package/build/dev/chunk-RO7JTBZN.js +0 -1356
- package/build/dev/chunk-RO7JTBZN.js.map +0 -1
- package/build/dev/chunk-UE6LH4B3.js +0 -1347
- package/build/dev/chunk-UE6LH4B3.js.map +0 -1
- package/build/dev/chunk-VHTSGS2P.js +0 -1365
- package/build/dev/chunk-VHTSGS2P.js.map +0 -1
- package/build/dev/chunk-VZCA75U7.js +0 -143
- package/build/dev/chunk-VZCA75U7.js.map +0 -1
- package/build/dev/chunk-XJQFUGEP.js +0 -4520
- package/build/dev/chunk-XJQFUGEP.js.map +0 -1
- package/build/map-image-url.d.ts +0 -3
- package/build/map-image-url.d.ts.map +0 -1
- package/build/map-page-url.d.ts +0 -2
- package/build/map-page-url.d.ts.map +0 -1
- /package/build/{chunk-723T62SD.js → chunk-C6BUIPAM.js} +0 -0
- /package/build/dev/{chunk-JX5CEG3A.js.map → chunk-OAIRL2FN.js.map} +0 -0
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
__spreadProps,
|
|
6
6
|
__spreadValues,
|
|
7
7
|
__toESM
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-C6BUIPAM.js";
|
|
9
9
|
|
|
10
10
|
// ../../node_modules/.pnpm/lodash.throttle@4.1.1/node_modules/lodash.throttle/index.js
|
|
11
11
|
var require_lodash = __commonJS({
|
|
@@ -170,8 +170,7 @@ var Checkbox = ({ isChecked }) => {
|
|
|
170
170
|
let content = null;
|
|
171
171
|
if (isChecked)
|
|
172
172
|
content = /* @__PURE__ */ React2.createElement("div", { className: "notion-property-checkbox-checked" }, /* @__PURE__ */ React2.createElement(check_default, null));
|
|
173
|
-
else
|
|
174
|
-
content = /* @__PURE__ */ React2.createElement("div", { className: "notion-property-checkbox-unchecked" });
|
|
173
|
+
else content = /* @__PURE__ */ React2.createElement("div", { className: "notion-property-checkbox-unchecked" });
|
|
175
174
|
return /* @__PURE__ */ React2.createElement("span", { className: "notion-property notion-property-checkbox" }, content);
|
|
176
175
|
};
|
|
177
176
|
|
|
@@ -193,8 +192,7 @@ var groupBlockContent = (blockMap) => {
|
|
|
193
192
|
lastType = blockType;
|
|
194
193
|
output[index] = [];
|
|
195
194
|
}
|
|
196
|
-
if (index > -1)
|
|
197
|
-
output[index].push(blockId);
|
|
195
|
+
if (index > -1) output[index].push(blockId);
|
|
198
196
|
});
|
|
199
197
|
lastType = void 0;
|
|
200
198
|
});
|
|
@@ -203,8 +201,7 @@ var groupBlockContent = (blockMap) => {
|
|
|
203
201
|
var getListNumber = (blockId, blockMap) => {
|
|
204
202
|
const groups = groupBlockContent(blockMap);
|
|
205
203
|
const group = groups.find((g) => g.includes(blockId));
|
|
206
|
-
if (!group)
|
|
207
|
-
return;
|
|
204
|
+
if (!group) return;
|
|
208
205
|
return group.indexOf(blockId) + 1;
|
|
209
206
|
};
|
|
210
207
|
var getHashFragmentValue = (url) => {
|
|
@@ -221,12 +218,10 @@ var youtubeDomains = /* @__PURE__ */ new Set([
|
|
|
221
218
|
var getYoutubeId = (url) => {
|
|
222
219
|
try {
|
|
223
220
|
const { hostname } = new URL(url);
|
|
224
|
-
if (!youtubeDomains.has(hostname))
|
|
225
|
-
return null;
|
|
221
|
+
if (!youtubeDomains.has(hostname)) return null;
|
|
226
222
|
const regExp = /^.*(youtu\.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/i;
|
|
227
223
|
const match = url.match(regExp);
|
|
228
|
-
if (match && match[2].length == 11)
|
|
229
|
-
return match[2];
|
|
224
|
+
if (match && match[2].length == 11) return match[2];
|
|
230
225
|
} catch (e) {
|
|
231
226
|
}
|
|
232
227
|
return null;
|
|
@@ -260,16 +255,14 @@ var LazyImage = (_a) => {
|
|
|
260
255
|
const onLoad = React3.useCallback(
|
|
261
256
|
(e) => {
|
|
262
257
|
if (zoomable && (e.target.src || e.target.srcset)) {
|
|
263
|
-
if (zoomRef.current)
|
|
264
|
-
zoomRef.current.attach(e.target);
|
|
258
|
+
if (zoomRef.current) zoomRef.current.attach(e.target);
|
|
265
259
|
}
|
|
266
260
|
},
|
|
267
261
|
[zoomRef, zoomable]
|
|
268
262
|
);
|
|
269
263
|
const attachZoom = React3.useCallback(
|
|
270
264
|
(image) => {
|
|
271
|
-
if (zoomRef.current && image)
|
|
272
|
-
zoomRef.current.attach(image);
|
|
265
|
+
if (zoomRef.current && image) zoomRef.current.attach(image);
|
|
273
266
|
},
|
|
274
267
|
[zoomRef]
|
|
275
268
|
);
|
|
@@ -347,13 +340,11 @@ var LiteYouTubeEmbed = ({
|
|
|
347
340
|
const [iframeInitialized, setIframeInitialized] = React4.useState(defaultPlay);
|
|
348
341
|
const [isIframeLoaded, setIsIframeLoaded] = React4.useState(false);
|
|
349
342
|
const warmConnections = React4.useCallback(() => {
|
|
350
|
-
if (isPreconnected)
|
|
351
|
-
return;
|
|
343
|
+
if (isPreconnected) return;
|
|
352
344
|
setIsPreconnected(true);
|
|
353
345
|
}, [isPreconnected]);
|
|
354
346
|
const onLoadIframe = React4.useCallback(() => {
|
|
355
|
-
if (iframeInitialized)
|
|
356
|
-
return;
|
|
347
|
+
if (iframeInitialized) return;
|
|
357
348
|
setIframeInitialized(true);
|
|
358
349
|
}, [iframeInitialized]);
|
|
359
350
|
const onIframeLoaded = React4.useCallback(() => {
|
|
@@ -407,8 +398,7 @@ var supportedAssetTypes = [
|
|
|
407
398
|
var Asset = ({ block, zoomable = true, children }) => {
|
|
408
399
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
409
400
|
const { recordMap, mapImageUrl, components } = useNotionContext();
|
|
410
|
-
if (!block || !supportedAssetTypes.includes(block.type))
|
|
411
|
-
return null;
|
|
401
|
+
if (!block || !supportedAssetTypes.includes(block.type)) return null;
|
|
412
402
|
const style = {
|
|
413
403
|
position: "relative",
|
|
414
404
|
display: "flex",
|
|
@@ -422,17 +412,12 @@ var Asset = ({ block, zoomable = true, children }) => {
|
|
|
422
412
|
if (block.format) {
|
|
423
413
|
const { block_aspect_ratio, block_height, block_width, block_full_width, block_page_width, block_preserve_scale } = block.format;
|
|
424
414
|
if (block_full_width || block_page_width) {
|
|
425
|
-
if (block_full_width)
|
|
426
|
-
|
|
427
|
-
else
|
|
428
|
-
style.width = "100%";
|
|
415
|
+
if (block_full_width) style.width = "100vw";
|
|
416
|
+
else style.width = "100%";
|
|
429
417
|
if (block.type === "video") {
|
|
430
|
-
if (block_height)
|
|
431
|
-
|
|
432
|
-
else if (
|
|
433
|
-
style.paddingBottom = `${block_aspect_ratio * 100}%`;
|
|
434
|
-
else if (block_preserve_scale)
|
|
435
|
-
style.objectFit = "contain";
|
|
418
|
+
if (block_height) style.height = block_height;
|
|
419
|
+
else if (block_aspect_ratio) style.paddingBottom = `${block_aspect_ratio * 100}%`;
|
|
420
|
+
else if (block_preserve_scale) style.objectFit = "contain";
|
|
436
421
|
} else if (block_aspect_ratio && block.type !== "image") {
|
|
437
422
|
style.paddingBottom = `${block_aspect_ratio * 100}%`;
|
|
438
423
|
} else if (block_height) {
|
|
@@ -460,32 +445,25 @@ var Asset = ({ block, zoomable = true, children }) => {
|
|
|
460
445
|
break;
|
|
461
446
|
}
|
|
462
447
|
}
|
|
463
|
-
if (block_width)
|
|
464
|
-
style.width = block_width;
|
|
448
|
+
if (block_width) style.width = block_width;
|
|
465
449
|
if (block_preserve_scale && block.type !== "image") {
|
|
466
450
|
style.paddingBottom = "50%";
|
|
467
451
|
style.minHeight = 100;
|
|
468
452
|
} else {
|
|
469
|
-
if (block_height && block.type !== "image")
|
|
470
|
-
style.height = block_height;
|
|
453
|
+
if (block_height && block.type !== "image") style.height = block_height;
|
|
471
454
|
}
|
|
472
455
|
}
|
|
473
|
-
if (block.type === "image")
|
|
474
|
-
|
|
475
|
-
else if (block_preserve_scale)
|
|
476
|
-
assetStyle.objectFit = "contain";
|
|
456
|
+
if (block.type === "image") assetStyle.objectFit = "cover";
|
|
457
|
+
else if (block_preserve_scale) assetStyle.objectFit = "contain";
|
|
477
458
|
}
|
|
478
459
|
let source = ((_b = recordMap.signed_urls) == null ? void 0 : _b[block.id]) || ((_e = (_d = (_c = block.properties) == null ? void 0 : _c.source) == null ? void 0 : _d[0]) == null ? void 0 : _e[0]);
|
|
479
460
|
let content = null;
|
|
480
|
-
if (!source)
|
|
481
|
-
return null;
|
|
461
|
+
if (!source) return null;
|
|
482
462
|
if (block.type === "tweet") {
|
|
483
463
|
const src = source;
|
|
484
|
-
if (!src)
|
|
485
|
-
return null;
|
|
464
|
+
if (!src) return null;
|
|
486
465
|
const id = src.split("?")[0].split("/").pop();
|
|
487
|
-
if (!id)
|
|
488
|
-
return null;
|
|
466
|
+
if (!id) return null;
|
|
489
467
|
content = /* @__PURE__ */ React5.createElement(
|
|
490
468
|
"div",
|
|
491
469
|
{
|
|
@@ -502,10 +480,8 @@ var Asset = ({ block, zoomable = true, children }) => {
|
|
|
502
480
|
style.overflow = "auto";
|
|
503
481
|
style.background = "rgb(226, 226, 226)";
|
|
504
482
|
style.display = "block";
|
|
505
|
-
if (!style.padding)
|
|
506
|
-
|
|
507
|
-
if (!isServer)
|
|
508
|
-
content = /* @__PURE__ */ React5.createElement(components.Pdf, { file: source });
|
|
483
|
+
if (!style.padding) style.padding = "8px 16px";
|
|
484
|
+
if (!isServer) content = /* @__PURE__ */ React5.createElement(components.Pdf, { file: source });
|
|
509
485
|
} 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") {
|
|
510
486
|
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) {
|
|
511
487
|
style.paddingBottom = void 0;
|
|
@@ -517,8 +493,7 @@ var Asset = ({ block, zoomable = true, children }) => {
|
|
|
517
493
|
if (youtubeVideoId) {
|
|
518
494
|
content = /* @__PURE__ */ React5.createElement(LiteYouTubeEmbed, { id: youtubeVideoId, style: assetStyle, className: "notion-asset-object-fit" });
|
|
519
495
|
} else if (block.type === "gist") {
|
|
520
|
-
if (!src.endsWith(".pibb"))
|
|
521
|
-
src = `${src}.pibb`;
|
|
496
|
+
if (!src.endsWith(".pibb")) src = `${src}.pibb`;
|
|
522
497
|
assetStyle.width = "100%";
|
|
523
498
|
style.paddingBottom = "50%";
|
|
524
499
|
content = /* @__PURE__ */ React5.createElement(
|
|
@@ -551,8 +526,7 @@ var Asset = ({ block, zoomable = true, children }) => {
|
|
|
551
526
|
}
|
|
552
527
|
}
|
|
553
528
|
} else if (block.type === "image") {
|
|
554
|
-
if (source.includes("file.notion.so"))
|
|
555
|
-
source = (_i = (_h = (_g = block.properties) == null ? void 0 : _g.source) == null ? void 0 : _h[0]) == null ? void 0 : _i[0];
|
|
529
|
+
if (source.includes("file.notion.so")) source = (_i = (_h = (_g = block.properties) == null ? void 0 : _g.source) == null ? void 0 : _h[0]) == null ? void 0 : _i[0];
|
|
556
530
|
const src = mapImageUrl(source, block);
|
|
557
531
|
const caption = getTextContent((_j = block.properties) == null ? void 0 : _j.caption);
|
|
558
532
|
const alt = caption || "notion image";
|
|
@@ -586,8 +560,7 @@ var EOI = ({ block, inline, className }) => {
|
|
|
586
560
|
var _a, _b, _c;
|
|
587
561
|
const { components } = useNotionContext();
|
|
588
562
|
const { original_url, attributes, domain } = (block == null ? void 0 : block.format) || {};
|
|
589
|
-
if (!original_url || !attributes)
|
|
590
|
-
return null;
|
|
563
|
+
if (!original_url || !attributes) return null;
|
|
591
564
|
const title = (_a = attributes.find((attr) => attr.id === "title")) == null ? void 0 : _a.values[0];
|
|
592
565
|
let owner = (_b = attributes.find((attr) => attr.id === "owner")) == null ? void 0 : _b.values[0];
|
|
593
566
|
const lastUpdatedAt = (_c = attributes.find((attr) => attr.id === "updated_at")) == null ? void 0 : _c.values[0];
|
|
@@ -623,10 +596,8 @@ var EOI = ({ block, inline, className }) => {
|
|
|
623
596
|
import React8 from "react";
|
|
624
597
|
import { Img } from "react-image";
|
|
625
598
|
var GracefulImage = (props) => {
|
|
626
|
-
if (isBrowser)
|
|
627
|
-
|
|
628
|
-
else
|
|
629
|
-
return /* @__PURE__ */ React8.createElement("img", __spreadValues({}, props));
|
|
599
|
+
if (isBrowser) return /* @__PURE__ */ React8.createElement(Img, __spreadValues({}, props));
|
|
600
|
+
else return /* @__PURE__ */ React8.createElement("img", __spreadValues({}, props));
|
|
630
601
|
};
|
|
631
602
|
|
|
632
603
|
// src/components/page-title.tsx
|
|
@@ -636,17 +607,14 @@ var PageTitleImpl = (_a) => {
|
|
|
636
607
|
var _b = _a, { block, className, defaultIcon } = _b, rest = __objRest(_b, ["block", "className", "defaultIcon"]);
|
|
637
608
|
var _a2, _b2;
|
|
638
609
|
const { recordMap } = useNotionContext();
|
|
639
|
-
if (!block)
|
|
640
|
-
return null;
|
|
610
|
+
if (!block) return null;
|
|
641
611
|
if (block.type === "collection_view_page" || block.type === "collection_view") {
|
|
642
612
|
const title = getBlockTitle(block, recordMap);
|
|
643
|
-
if (!title)
|
|
644
|
-
return null;
|
|
613
|
+
if (!title) return null;
|
|
645
614
|
const titleDecoration = [[title]];
|
|
646
615
|
return /* @__PURE__ */ React9.createElement("span", __spreadValues({ className: `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 })));
|
|
647
616
|
}
|
|
648
|
-
if (!((_a2 = block.properties) == null ? void 0 : _a2.title))
|
|
649
|
-
return null;
|
|
617
|
+
if (!((_a2 = block.properties) == null ? void 0 : _a2.title)) return null;
|
|
650
618
|
return /* @__PURE__ */ React9.createElement("span", __spreadValues({ className: `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 })));
|
|
651
619
|
};
|
|
652
620
|
var PageTitle = React9.memo(PageTitleImpl);
|
|
@@ -657,10 +625,8 @@ var Text = ({ value, block, linkProps, linkProtocol }) => {
|
|
|
657
625
|
return /* @__PURE__ */ React10.createElement(React10.Fragment, null, value == null ? void 0 : value.map((deco, index) => {
|
|
658
626
|
const [text, decorations] = deco;
|
|
659
627
|
if (!decorations)
|
|
660
|
-
if (text === ",")
|
|
661
|
-
|
|
662
|
-
else
|
|
663
|
-
return /* @__PURE__ */ React10.createElement(React10.Fragment, { key: index }, text);
|
|
628
|
+
if (text === ",") return /* @__PURE__ */ React10.createElement("span", { key: index, style: { padding: "0.5em" } });
|
|
629
|
+
else return /* @__PURE__ */ React10.createElement(React10.Fragment, { key: index }, text);
|
|
664
630
|
const formatted = decorations.reduce(
|
|
665
631
|
(element, decorator) => {
|
|
666
632
|
var _a, _b, _c, _d, _e;
|
|
@@ -732,6 +698,7 @@ var Text = ({ value, block, linkProps, linkProtocol }) => {
|
|
|
732
698
|
return /* @__PURE__ */ React10.createElement(components.Equation, { math: decorator[1], inline: true });
|
|
733
699
|
case "m":
|
|
734
700
|
return element;
|
|
701
|
+
//still need to return the base element
|
|
735
702
|
case "a": {
|
|
736
703
|
const v = decorator[1];
|
|
737
704
|
const pathname = v.substring(1);
|
|
@@ -750,6 +717,7 @@ var Text = ({ value, block, linkProps, linkProtocol }) => {
|
|
|
750
717
|
);
|
|
751
718
|
}
|
|
752
719
|
}
|
|
720
|
+
// Date
|
|
753
721
|
case "d": {
|
|
754
722
|
const v = decorator[1];
|
|
755
723
|
const type = v == null ? void 0 : v.type;
|
|
@@ -764,6 +732,7 @@ var Text = ({ value, block, linkProps, linkProtocol }) => {
|
|
|
764
732
|
return element;
|
|
765
733
|
}
|
|
766
734
|
}
|
|
735
|
+
// User
|
|
767
736
|
case "u": {
|
|
768
737
|
const userId = decorator[1];
|
|
769
738
|
const user = (_d = recordMap.notion_user[userId]) == null ? void 0 : _d.value;
|
|
@@ -789,8 +758,7 @@ var Text = ({ value, block, linkProps, linkProtocol }) => {
|
|
|
789
758
|
return /* @__PURE__ */ React10.createElement(EOI, { block: externalObjectInstance, inline: true });
|
|
790
759
|
}
|
|
791
760
|
default:
|
|
792
|
-
if (true)
|
|
793
|
-
console.debug("unsupported text format", decorator);
|
|
761
|
+
if (true) console.debug("unsupported text format", decorator);
|
|
794
762
|
return element;
|
|
795
763
|
}
|
|
796
764
|
},
|
|
@@ -812,8 +780,7 @@ var AssetWrapper = ({ blockId, block }) => {
|
|
|
812
780
|
if (caption) {
|
|
813
781
|
const id = parsePageId2(caption, { uuid: true });
|
|
814
782
|
const isPage = caption.charAt(0) === "/" && id;
|
|
815
|
-
if (isPage || isValidURL(caption))
|
|
816
|
-
isURL = true;
|
|
783
|
+
if (isPage || isValidURL(caption)) isURL = true;
|
|
817
784
|
}
|
|
818
785
|
}
|
|
819
786
|
const figure = /* @__PURE__ */ React11.createElement(
|
|
@@ -901,8 +868,7 @@ var SearchDialog = class extends React15.Component {
|
|
|
901
868
|
searchError: null
|
|
902
869
|
};
|
|
903
870
|
this._onAfterOpen = () => {
|
|
904
|
-
if (this._inputRef.current)
|
|
905
|
-
this._inputRef.current.focus();
|
|
871
|
+
if (this._inputRef.current) this._inputRef.current.focus();
|
|
906
872
|
};
|
|
907
873
|
this._onChangeQuery = (e) => {
|
|
908
874
|
const query = e.target.value;
|
|
@@ -946,19 +912,16 @@ var SearchDialog = class extends React15.Component {
|
|
|
946
912
|
const results = searchResult.results.map((result2) => {
|
|
947
913
|
var _a, _b;
|
|
948
914
|
const block = (_a = searchResult.recordMap.block[result2.id]) == null ? void 0 : _a.value;
|
|
949
|
-
if (!block)
|
|
950
|
-
return;
|
|
915
|
+
if (!block) return;
|
|
951
916
|
const title = getBlockTitle2(block, searchResult.recordMap);
|
|
952
|
-
if (!title)
|
|
953
|
-
return;
|
|
917
|
+
if (!title) return;
|
|
954
918
|
result2.title = title;
|
|
955
919
|
result2.block = block;
|
|
956
920
|
result2.recordMap = searchResult.recordMap;
|
|
957
921
|
result2.page = getBlockParentPage(block, searchResult.recordMap, {
|
|
958
922
|
inclusive: true
|
|
959
923
|
}) || block;
|
|
960
|
-
if (!result2.page.id)
|
|
961
|
-
return;
|
|
924
|
+
if (!result2.page.id) return;
|
|
962
925
|
if ((_b = result2.highlight) == null ? void 0 : _b.text)
|
|
963
926
|
result2.highlight.html = result2.highlight.text.replace(/<gzkNfoUU>/gi, "<b>").replace(/<\/gzkNfoUU>/gi, "</b>");
|
|
964
927
|
return result2;
|
|
@@ -971,8 +934,7 @@ var SearchDialog = class extends React15.Component {
|
|
|
971
934
|
);
|
|
972
935
|
searchResult.results = Object.values(searchResultsMap);
|
|
973
936
|
}
|
|
974
|
-
if (this.state.query === query)
|
|
975
|
-
this.setState({ isLoading: false, searchResult, searchError });
|
|
937
|
+
if (this.state.query === query) this.setState({ isLoading: false, searchResult, searchError });
|
|
976
938
|
});
|
|
977
939
|
this._inputRef = React15.createRef();
|
|
978
940
|
}
|
|
@@ -1039,21 +1001,17 @@ var Breadcrumbs = ({ block, rootOnly = false }) => {
|
|
|
1039
1001
|
const { recordMap, mapPageUrl, components } = useNotionContext();
|
|
1040
1002
|
const breadcrumbs = React16.useMemo(() => {
|
|
1041
1003
|
const breadcrumbs2 = getPageBreadcrumbs(recordMap, block.id);
|
|
1042
|
-
if (rootOnly)
|
|
1043
|
-
return [breadcrumbs2[0]].filter(Boolean);
|
|
1004
|
+
if (rootOnly) return [breadcrumbs2[0]].filter(Boolean);
|
|
1044
1005
|
return breadcrumbs2;
|
|
1045
1006
|
}, [recordMap, block.id, rootOnly]);
|
|
1046
1007
|
return /* @__PURE__ */ React16.createElement("div", { className: "breadcrumbs", key: "breadcrumbs" }, breadcrumbs.map((breadcrumb, index) => {
|
|
1047
|
-
if (!breadcrumb)
|
|
1048
|
-
return null;
|
|
1008
|
+
if (!breadcrumb) return null;
|
|
1049
1009
|
const pageLinkProps = {};
|
|
1050
1010
|
const componentMap = {
|
|
1051
1011
|
pageLink: components.PageLink
|
|
1052
1012
|
};
|
|
1053
|
-
if (breadcrumb.active)
|
|
1054
|
-
|
|
1055
|
-
else
|
|
1056
|
-
pageLinkProps.href = mapPageUrl(breadcrumb.pageId);
|
|
1013
|
+
if (breadcrumb.active) componentMap.pageLink = (props) => /* @__PURE__ */ React16.createElement("div", __spreadValues({}, props));
|
|
1014
|
+
else pageLinkProps.href = mapPageUrl(breadcrumb.pageId);
|
|
1057
1015
|
return /* @__PURE__ */ React16.createElement(React16.Fragment, { key: breadcrumb.pageId }, /* @__PURE__ */ React16.createElement(componentMap.pageLink, __spreadValues({ className: `breadcrumb ${breadcrumb.active && "active"}` }, pageLinkProps), breadcrumb.icon && /* @__PURE__ */ React16.createElement(PageIcon, { className: "icon", block: breadcrumb.block }), breadcrumb.title && /* @__PURE__ */ React16.createElement("span", { className: "title" }, breadcrumb.title)), index < breadcrumbs.length - 1 && /* @__PURE__ */ React16.createElement("span", { className: "spacer" }, "/"));
|
|
1058
1016
|
}));
|
|
1059
1017
|
};
|
|
@@ -1069,8 +1027,7 @@ var Search = ({ block, search, title = "Search" }) => {
|
|
|
1069
1027
|
}, []);
|
|
1070
1028
|
const onCloseSearch = React16.useCallback(() => {
|
|
1071
1029
|
setIsSearchOpen(false);
|
|
1072
|
-
if (onHideSearch)
|
|
1073
|
-
onHideSearch();
|
|
1030
|
+
if (onHideSearch) onHideSearch();
|
|
1074
1031
|
}, [onHideSearch]);
|
|
1075
1032
|
useHotkeys("cmd+p", (event) => {
|
|
1076
1033
|
onOpenSearch();
|
|
@@ -1116,8 +1073,7 @@ var wrapNextImage = (NextImage) => {
|
|
|
1116
1073
|
"style",
|
|
1117
1074
|
"layout"
|
|
1118
1075
|
]);
|
|
1119
|
-
if (!layout)
|
|
1120
|
-
layout = width && height ? "intrinsic" : "fill";
|
|
1076
|
+
if (!layout) layout = width && height ? "intrinsic" : "fill";
|
|
1121
1077
|
return /* @__PURE__ */ React17.createElement(
|
|
1122
1078
|
NextImage,
|
|
1123
1079
|
__spreadValues({
|
|
@@ -1245,20 +1201,14 @@ var NotionContextProvider = (_a) => {
|
|
|
1245
1201
|
"mapImageUrl",
|
|
1246
1202
|
"rootPageId"
|
|
1247
1203
|
]);
|
|
1248
|
-
for (const key of Object.keys(rest))
|
|
1249
|
-
if (rest[key] === void 0)
|
|
1250
|
-
delete rest[key];
|
|
1204
|
+
for (const key of Object.keys(rest)) if (rest[key] === void 0) delete rest[key];
|
|
1251
1205
|
const wrappedThemeComponents = React18.useMemo(
|
|
1252
1206
|
() => __spreadValues({}, themeComponents),
|
|
1253
1207
|
[themeComponents]
|
|
1254
1208
|
);
|
|
1255
|
-
if (wrappedThemeComponents.nextImage)
|
|
1256
|
-
|
|
1257
|
-
if (wrappedThemeComponents
|
|
1258
|
-
wrappedThemeComponents.nextLink = wrapNextLink(themeComponents.nextLink);
|
|
1259
|
-
for (const key of Object.keys(wrappedThemeComponents))
|
|
1260
|
-
if (!wrappedThemeComponents[key])
|
|
1261
|
-
delete wrappedThemeComponents[key];
|
|
1209
|
+
if (wrappedThemeComponents.nextImage) wrappedThemeComponents.Image = wrapNextImage(themeComponents.nextImage);
|
|
1210
|
+
if (wrappedThemeComponents.nextLink) wrappedThemeComponents.nextLink = wrapNextLink(themeComponents.nextLink);
|
|
1211
|
+
for (const key of Object.keys(wrappedThemeComponents)) if (!wrappedThemeComponents[key]) delete wrappedThemeComponents[key];
|
|
1262
1212
|
const value = React18.useMemo(
|
|
1263
1213
|
() => __spreadProps(__spreadValues(__spreadValues({}, defaultNotionContext), rest), {
|
|
1264
1214
|
rootPageId,
|
|
@@ -1311,8 +1261,7 @@ var PageIconImpl = ({ block, className, inline = true, hideDefaultIcon = false,
|
|
|
1311
1261
|
content = /* @__PURE__ */ React20.createElement("span", { className: `${className || ""} notion-page-icon`, role: "img", "aria-label": icon }, icon);
|
|
1312
1262
|
}
|
|
1313
1263
|
}
|
|
1314
|
-
if (!content)
|
|
1315
|
-
return null;
|
|
1264
|
+
if (!content) return null;
|
|
1316
1265
|
return /* @__PURE__ */ React20.createElement(
|
|
1317
1266
|
"div",
|
|
1318
1267
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__objRest,
|
|
3
3
|
__spreadValues
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-C6BUIPAM.js";
|
|
5
5
|
|
|
6
6
|
// src/icons/type-checkbox.tsx
|
|
7
7
|
import React from "react";
|
|
@@ -139,8 +139,7 @@ var iconMap = {
|
|
|
139
139
|
var PropertyIcon = (_a) => {
|
|
140
140
|
var _b = _a, { type } = _b, rest = __objRest(_b, ["type"]);
|
|
141
141
|
const icon = iconMap[type];
|
|
142
|
-
if (!icon)
|
|
143
|
-
return null;
|
|
142
|
+
if (!icon) return null;
|
|
144
143
|
return icon(rest);
|
|
145
144
|
};
|
|
146
145
|
|