@caring-dev/react-notion-x 7.8.4 → 7.8.5

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.
@@ -393,6 +393,7 @@ var require_format_number = __commonJS({
393
393
  import {
394
394
  getBlockCollectionId,
395
395
  getBlockParentPage as getBlockParentPage2,
396
+ getBlockValue as getBlockValue9,
396
397
  getTextContent as getTextContent4
397
398
  } from "notion-utils";
398
399
  import React22 from "react";
@@ -411,16 +412,9 @@ import React13 from "react";
411
412
  import "notion-types";
412
413
  import { parsePageId as parsePageId2 } from "notion-utils";
413
414
 
414
- // src/components/header.tsx
415
- import { getPageBreadcrumbs } from "notion-utils";
416
- import React9 from "react";
417
- import { useHotkeys } from "react-hotkeys-hook";
418
-
419
- // src/icons/search-icon.tsx
420
- import "react";
421
-
422
415
  // src/utils.ts
423
416
  import "notion-types";
417
+ import { getBlockValue } from "notion-utils";
424
418
  import { formatDate, formatNotionDateTime, isUrl } from "notion-utils";
425
419
  var cs = (...classes) => classes.filter((a) => !!a).join(" ");
426
420
  var getHashFragmentValue = (url) => {
@@ -463,107 +457,18 @@ var getUrlParams = (url) => {
463
457
  return;
464
458
  };
465
459
 
466
- // src/icons/search-icon.tsx
467
- import { jsx } from "react/jsx-runtime";
468
- function SearchIcon(props) {
469
- const { className, ...rest } = props;
470
- return /* @__PURE__ */ jsx("svg", { className: cs("notion-icon", className), viewBox: "0 0 17 17", ...rest, children: /* @__PURE__ */ jsx("path", { d: "M6.78027 13.6729C8.24805 13.6729 9.60156 13.1982 10.709 12.4072L14.875 16.5732C15.0684 16.7666 15.3232 16.8633 15.5957 16.8633C16.167 16.8633 16.5713 16.4238 16.5713 15.8613C16.5713 15.5977 16.4834 15.3516 16.29 15.1582L12.1504 11.0098C13.0205 9.86719 13.5391 8.45215 13.5391 6.91406C13.5391 3.19629 10.498 0.155273 6.78027 0.155273C3.0625 0.155273 0.0214844 3.19629 0.0214844 6.91406C0.0214844 10.6318 3.0625 13.6729 6.78027 13.6729ZM6.78027 12.2139C3.87988 12.2139 1.48047 9.81445 1.48047 6.91406C1.48047 4.01367 3.87988 1.61426 6.78027 1.61426C9.68066 1.61426 12.0801 4.01367 12.0801 6.91406C12.0801 9.81445 9.68066 12.2139 6.78027 12.2139Z" }) });
471
- }
472
-
473
- // src/components/search-dialog.tsx
474
- var import_lodash = __toESM(require_lodash(), 1);
475
- import { getBlockParentPage, getBlockTitle as getBlockTitle2 } from "notion-utils";
476
- import React8 from "react";
477
-
478
- // src/icons/clear-icon.tsx
479
- import "react";
480
- import { jsx as jsx2 } from "react/jsx-runtime";
481
- function ClearIcon(props) {
482
- const { className, ...rest } = props;
483
- return /* @__PURE__ */ jsx2("svg", { className: cs("notion-icon", className), ...rest, viewBox: "0 0 30 30", children: /* @__PURE__ */ jsx2("path", { d: "M15,0C6.716,0,0,6.716,0,15s6.716,15,15,15s15-6.716,15-15S23.284,0,15,0z M22,20.6L20.6,22L15,16.4L9.4,22L8,20.6l5.6-5.6 L8,9.4L9.4,8l5.6,5.6L20.6,8L22,9.4L16.4,15L22,20.6z" }) });
484
- }
485
-
486
- // src/icons/loading-icon.tsx
487
- import "react";
488
- import { jsx as jsx3, jsxs } from "react/jsx-runtime";
489
- function LoadingIcon(props) {
490
- const { className, ...rest } = props;
491
- return /* @__PURE__ */ jsxs("svg", { className: cs("notion-icon", className), ...rest, viewBox: "0 0 24 24", children: [
492
- /* @__PURE__ */ jsx3("defs", { children: /* @__PURE__ */ jsxs(
493
- "linearGradient",
494
- {
495
- x1: "28.1542969%",
496
- y1: "63.7402344%",
497
- x2: "74.6289062%",
498
- y2: "17.7832031%",
499
- id: "linearGradient-1",
500
- children: [
501
- /* @__PURE__ */ jsx3("stop", { stopColor: "rgba(164, 164, 164, 1)", offset: "0%" }),
502
- /* @__PURE__ */ jsx3(
503
- "stop",
504
- {
505
- stopColor: "rgba(164, 164, 164, 0)",
506
- stopOpacity: "0",
507
- offset: "100%"
508
- }
509
- )
510
- ]
511
- }
512
- ) }),
513
- /* @__PURE__ */ jsx3("g", { id: "Page-1", stroke: "none", strokeWidth: "1", fill: "none", children: /* @__PURE__ */ jsx3("g", { transform: "translate(-236.000000, -286.000000)", children: /* @__PURE__ */ jsxs("g", { transform: "translate(238.000000, 286.000000)", children: [
514
- /* @__PURE__ */ jsx3(
515
- "circle",
516
- {
517
- id: "Oval-2",
518
- stroke: "url(#linearGradient-1)",
519
- strokeWidth: "4",
520
- cx: "10",
521
- cy: "12",
522
- r: "10"
523
- }
524
- ),
525
- /* @__PURE__ */ jsx3(
526
- "path",
527
- {
528
- d: "M10,2 C4.4771525,2 0,6.4771525 0,12",
529
- id: "Oval-2",
530
- stroke: "rgba(164, 164, 164, 1)",
531
- strokeWidth: "4"
532
- }
533
- ),
534
- /* @__PURE__ */ jsx3(
535
- "rect",
536
- {
537
- id: "Rectangle-1",
538
- fill: "rgba(164, 164, 164, 1)",
539
- x: "8",
540
- y: "0",
541
- width: "4",
542
- height: "4",
543
- rx: "8"
544
- }
545
- )
546
- ] }) }) })
547
- ] });
548
- }
549
-
550
- // src/components/page-title.tsx
551
- import "notion-types";
552
- import { getBlockTitle } from "notion-utils";
553
- import React7 from "react";
554
-
555
460
  // src/components/text.tsx
556
461
  import "notion-types";
557
- import { parsePageId } from "notion-utils";
558
- import React6 from "react";
462
+ import { getBlockValue as getBlockValue2, parsePageId } from "notion-utils";
463
+ import React4 from "react";
559
464
 
560
465
  // src/components/eoi.tsx
561
466
  import "notion-types";
562
467
 
563
468
  // src/icons/type-github.tsx
564
- import { jsx as jsx4 } from "react/jsx-runtime";
469
+ import { jsx } from "react/jsx-runtime";
565
470
  function SvgTypeGitHub(props) {
566
- return /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 260 260", ...props, children: /* @__PURE__ */ jsx4("g", { children: /* @__PURE__ */ jsx4(
471
+ return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 260 260", ...props, children: /* @__PURE__ */ jsx("g", { children: /* @__PURE__ */ jsx(
567
472
  "path",
568
473
  {
569
474
  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",
@@ -574,7 +479,7 @@ function SvgTypeGitHub(props) {
574
479
  var type_github_default = SvgTypeGitHub;
575
480
 
576
481
  // src/components/mention-preview-card.tsx
577
- import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
482
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
578
483
  function capitalizeFirstLetter(str) {
579
484
  if (!str) return "";
580
485
  return str.charAt(0).toUpperCase() + str.slice(1);
@@ -586,29 +491,29 @@ function MentionPreviewCard({
586
491
  title,
587
492
  domain
588
493
  }) {
589
- return /* @__PURE__ */ jsxs2("div", { className: "notion-external-subtitle", children: [
590
- externalImage && /* @__PURE__ */ jsxs2("div", { className: "notion-preview-card-domain-warp", children: [
591
- /* @__PURE__ */ jsx5("div", { className: "notion-preview-card-logo", children: externalImage }),
592
- /* @__PURE__ */ jsx5("div", { className: "notion-preview-card-domain", children: capitalizeFirstLetter(domain.split(".")[0]) })
494
+ return /* @__PURE__ */ jsxs("div", { className: "notion-external-subtitle", children: [
495
+ externalImage && /* @__PURE__ */ jsxs("div", { className: "notion-preview-card-domain-warp", children: [
496
+ /* @__PURE__ */ jsx2("div", { className: "notion-preview-card-logo", children: externalImage }),
497
+ /* @__PURE__ */ jsx2("div", { className: "notion-preview-card-domain", children: capitalizeFirstLetter(domain.split(".")[0]) })
593
498
  ] }),
594
- /* @__PURE__ */ jsx5("div", { className: "notion-preview-card-title", children: title }),
595
- owner && /* @__PURE__ */ jsxs2("div", { className: "notion-external-subtitle-item", children: [
596
- /* @__PURE__ */ jsx5("div", { className: "notion-external-subtitle-item-name", children: "Owner" }),
597
- /* @__PURE__ */ jsx5("span", { className: "notion-external-subtitle-item-desc", children: owner })
499
+ /* @__PURE__ */ jsx2("div", { className: "notion-preview-card-title", children: title }),
500
+ owner && /* @__PURE__ */ jsxs("div", { className: "notion-external-subtitle-item", children: [
501
+ /* @__PURE__ */ jsx2("div", { className: "notion-external-subtitle-item-name", children: "Owner" }),
502
+ /* @__PURE__ */ jsx2("span", { className: "notion-external-subtitle-item-desc", children: owner })
598
503
  ] }),
599
- lastUpdated && /* @__PURE__ */ jsxs2("div", { className: "notion-external-subtitle-item", children: [
600
- /* @__PURE__ */ jsx5("div", { className: "notion-external-subtitle-item-name", children: "Updated" }),
601
- /* @__PURE__ */ jsx5("span", { className: "notion-external-subtitle-item-desc", children: lastUpdated })
504
+ lastUpdated && /* @__PURE__ */ jsxs("div", { className: "notion-external-subtitle-item", children: [
505
+ /* @__PURE__ */ jsx2("div", { className: "notion-external-subtitle-item-name", children: "Updated" }),
506
+ /* @__PURE__ */ jsx2("span", { className: "notion-external-subtitle-item-desc", children: lastUpdated })
602
507
  ] }),
603
- domain === "github.com" && /* @__PURE__ */ jsxs2("div", { className: "notion-preview-card-github-shields", children: [
604
- /* @__PURE__ */ jsx5(
508
+ domain === "github.com" && /* @__PURE__ */ jsxs("div", { className: "notion-preview-card-github-shields", children: [
509
+ /* @__PURE__ */ jsx2(
605
510
  "img",
606
511
  {
607
512
  src: `https://img.shields.io/github/stars/${owner}/${title}?logo=github`,
608
513
  alt: ""
609
514
  }
610
515
  ),
611
- /* @__PURE__ */ jsx5(
516
+ /* @__PURE__ */ jsx2(
612
517
  "img",
613
518
  {
614
519
  src: `https://img.shields.io/github/last-commit/${owner}/${title}`,
@@ -620,7 +525,7 @@ function MentionPreviewCard({
620
525
  }
621
526
 
622
527
  // src/components/eoi.tsx
623
- import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
528
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
624
529
  function EOI({
625
530
  block,
626
531
  inline,
@@ -639,7 +544,7 @@ function EOI({
639
544
  let externalImage;
640
545
  switch (domain) {
641
546
  case "github.com":
642
- externalImage = /* @__PURE__ */ jsx6(type_github_default, {});
547
+ externalImage = /* @__PURE__ */ jsx3(type_github_default, {});
643
548
  if (owner) {
644
549
  const parts = owner.split("/");
645
550
  owner = parts.at(-1);
@@ -654,7 +559,7 @@ function EOI({
654
559
  }
655
560
  return null;
656
561
  }
657
- return /* @__PURE__ */ jsxs3(
562
+ return /* @__PURE__ */ jsxs2(
658
563
  components.Link,
659
564
  {
660
565
  target: "_blank",
@@ -666,15 +571,15 @@ function EOI({
666
571
  className
667
572
  ),
668
573
  children: [
669
- externalImage && /* @__PURE__ */ jsx6("div", { className: "notion-external-image", children: externalImage }),
670
- /* @__PURE__ */ jsxs3("div", { className: "notion-external-description", children: [
671
- /* @__PURE__ */ jsx6("div", { className: "notion-external-title", children: title }),
672
- !inline && owner ? /* @__PURE__ */ jsxs3("div", { className: "notion-external-block-desc", children: [
574
+ externalImage && /* @__PURE__ */ jsx3("div", { className: "notion-external-image", children: externalImage }),
575
+ /* @__PURE__ */ jsxs2("div", { className: "notion-external-description", children: [
576
+ /* @__PURE__ */ jsx3("div", { className: "notion-external-title", children: title }),
577
+ !inline && owner ? /* @__PURE__ */ jsxs2("div", { className: "notion-external-block-desc", children: [
673
578
  owner,
674
- lastUpdated && /* @__PURE__ */ jsx6("span", { children: " \u2022 " }),
579
+ lastUpdated && /* @__PURE__ */ jsx3("span", { children: " \u2022 " }),
675
580
  lastUpdated && `Updated ${lastUpdated}`
676
581
  ] }) : null,
677
- inline && (owner || lastUpdated) && /* @__PURE__ */ jsx6(
582
+ inline && (owner || lastUpdated) && /* @__PURE__ */ jsx3(
678
583
  MentionPreviewCard,
679
584
  {
680
585
  title,
@@ -693,26 +598,26 @@ function EOI({
693
598
  // src/components/graceful-image.tsx
694
599
  import "react";
695
600
  import { Img } from "react-image";
696
- import { jsx as jsx7 } from "react/jsx-runtime";
601
+ import { jsx as jsx4 } from "react/jsx-runtime";
697
602
  function GracefulImage(props) {
698
603
  if (isBrowser) {
699
- return /* @__PURE__ */ jsx7(Img, { ...props });
604
+ return /* @__PURE__ */ jsx4(Img, { ...props });
700
605
  } else {
701
- return /* @__PURE__ */ jsx7("img", { ...props });
606
+ return /* @__PURE__ */ jsx4("img", { ...props });
702
607
  }
703
608
  }
704
609
 
705
610
  // src/components/link-mention.tsx
706
611
  import "react";
707
- import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
612
+ import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
708
613
  function LinkMention({ metadata }) {
709
- return /* @__PURE__ */ jsxs4("span", { className: "notion-link-mention", children: [
710
- /* @__PURE__ */ jsx8(LinkMentionInline, { metadata }),
711
- /* @__PURE__ */ jsx8(LinkMentionPreview, { metadata })
614
+ return /* @__PURE__ */ jsxs3("span", { className: "notion-link-mention", children: [
615
+ /* @__PURE__ */ jsx5(LinkMentionInline, { metadata }),
616
+ /* @__PURE__ */ jsx5(LinkMentionPreview, { metadata })
712
617
  ] });
713
618
  }
714
619
  function LinkMentionInline({ metadata }) {
715
- return /* @__PURE__ */ jsxs4(
620
+ return /* @__PURE__ */ jsxs3(
716
621
  "a",
717
622
  {
718
623
  href: metadata.href,
@@ -720,7 +625,7 @@ function LinkMentionInline({ metadata }) {
720
625
  rel: "noopener noreferrer",
721
626
  className: "notion-link-mention-link",
722
627
  children: [
723
- /* @__PURE__ */ jsx8(
628
+ /* @__PURE__ */ jsx5(
724
629
  "img",
725
630
  {
726
631
  className: "notion-link-mention-icon",
@@ -728,15 +633,15 @@ function LinkMentionInline({ metadata }) {
728
633
  alt: metadata.link_provider
729
634
  }
730
635
  ),
731
- metadata.link_provider && /* @__PURE__ */ jsx8("span", { className: "notion-link-mention-provider", children: metadata.link_provider }),
732
- /* @__PURE__ */ jsx8("span", { className: "notion-link-mention-title", children: metadata.title })
636
+ metadata.link_provider && /* @__PURE__ */ jsx5("span", { className: "notion-link-mention-provider", children: metadata.link_provider }),
637
+ /* @__PURE__ */ jsx5("span", { className: "notion-link-mention-title", children: metadata.title })
733
638
  ]
734
639
  }
735
640
  );
736
641
  }
737
642
  function LinkMentionPreview({ metadata }) {
738
- return /* @__PURE__ */ jsx8("div", { className: "notion-link-mention-preview", children: /* @__PURE__ */ jsxs4("article", { className: "notion-link-mention-card", children: [
739
- /* @__PURE__ */ jsx8(
643
+ return /* @__PURE__ */ jsx5("div", { className: "notion-link-mention-preview", children: /* @__PURE__ */ jsxs3("article", { className: "notion-link-mention-card", children: [
644
+ /* @__PURE__ */ jsx5(
740
645
  "img",
741
646
  {
742
647
  className: "notion-link-mention-preview-thumbnail",
@@ -745,11 +650,11 @@ function LinkMentionPreview({ metadata }) {
745
650
  referrerPolicy: "same-origin"
746
651
  }
747
652
  ),
748
- /* @__PURE__ */ jsxs4("div", { className: "notion-link-mention-preview-content", children: [
749
- /* @__PURE__ */ jsx8("p", { className: "notion-link-mention-preview-title", children: metadata.title }),
750
- /* @__PURE__ */ jsx8("p", { className: "notion-link-mention-preview-description", children: metadata.description }),
751
- /* @__PURE__ */ jsxs4("div", { className: "notion-link-mention-preview-footer", children: [
752
- /* @__PURE__ */ jsx8(
653
+ /* @__PURE__ */ jsxs3("div", { className: "notion-link-mention-preview-content", children: [
654
+ /* @__PURE__ */ jsx5("p", { className: "notion-link-mention-preview-title", children: metadata.title }),
655
+ /* @__PURE__ */ jsx5("p", { className: "notion-link-mention-preview-description", children: metadata.description }),
656
+ /* @__PURE__ */ jsxs3("div", { className: "notion-link-mention-preview-footer", children: [
657
+ /* @__PURE__ */ jsx5(
753
658
  "img",
754
659
  {
755
660
  className: "notion-link-mention-preview-icon",
@@ -758,14 +663,63 @@ function LinkMentionPreview({ metadata }) {
758
663
  referrerPolicy: "same-origin"
759
664
  }
760
665
  ),
761
- /* @__PURE__ */ jsx8("span", { className: "notion-link-mention-preview-provider", children: metadata.link_provider })
666
+ /* @__PURE__ */ jsx5("span", { className: "notion-link-mention-preview-provider", children: metadata.link_provider })
762
667
  ] })
763
668
  ] })
764
669
  ] }) });
765
670
  }
766
671
 
672
+ // src/components/page-title.tsx
673
+ import "notion-types";
674
+ import { getBlockTitle } from "notion-utils";
675
+ import React3 from "react";
676
+ import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
677
+ function PageTitleImpl({
678
+ block,
679
+ className,
680
+ defaultIcon,
681
+ ...rest
682
+ }) {
683
+ var _a, _b;
684
+ const { recordMap } = useNotionContext();
685
+ if (!block) return null;
686
+ if (block.type === "collection_view_page" || block.type === "collection_view") {
687
+ const title = getBlockTitle(block, recordMap);
688
+ if (!title) {
689
+ return null;
690
+ }
691
+ const titleDecoration = [[title]];
692
+ return /* @__PURE__ */ jsxs4("span", { className: cs("notion-page-title", className), ...rest, children: [
693
+ /* @__PURE__ */ jsx6(
694
+ PageIcon,
695
+ {
696
+ block,
697
+ defaultIcon,
698
+ className: "notion-page-title-icon"
699
+ }
700
+ ),
701
+ /* @__PURE__ */ jsx6("span", { className: "notion-page-title-text", children: /* @__PURE__ */ jsx6(Text, { value: titleDecoration, block }) })
702
+ ] });
703
+ }
704
+ if (!((_a = block.properties) == null ? void 0 : _a.title)) {
705
+ return null;
706
+ }
707
+ return /* @__PURE__ */ jsxs4("span", { className: cs("notion-page-title", className), ...rest, children: [
708
+ /* @__PURE__ */ jsx6(
709
+ PageIcon,
710
+ {
711
+ block,
712
+ defaultIcon,
713
+ className: "notion-page-title-icon"
714
+ }
715
+ ),
716
+ /* @__PURE__ */ jsx6("span", { className: "notion-page-title-text", children: /* @__PURE__ */ jsx6(Text, { value: (_b = block.properties) == null ? void 0 : _b.title, block }) })
717
+ ] });
718
+ }
719
+ var PageTitle = React3.memo(PageTitleImpl);
720
+
767
721
  // src/components/text.tsx
768
- import { Fragment, jsx as jsx9 } from "react/jsx-runtime";
722
+ import { Fragment, jsx as jsx7 } from "react/jsx-runtime";
769
723
  function Text({
770
724
  value,
771
725
  block,
@@ -773,31 +727,30 @@ function Text({
773
727
  linkProtocol
774
728
  }) {
775
729
  const { components, recordMap, mapPageUrl, mapImageUrl, rootDomain } = useNotionContext();
776
- return /* @__PURE__ */ jsx9(React6.Fragment, { children: value == null ? void 0 : value.map(([text, decorations], index) => {
730
+ return /* @__PURE__ */ jsx7(React4.Fragment, { children: value == null ? void 0 : value.map(([text, decorations], index) => {
777
731
  if (!decorations) {
778
732
  if (text === ",") {
779
- return /* @__PURE__ */ jsx9("span", { style: { padding: "0.5em" } }, index);
733
+ return /* @__PURE__ */ jsx7("span", { style: { padding: "0.5em" } }, index);
780
734
  } else {
781
- return /* @__PURE__ */ jsx9(React6.Fragment, { children: text }, index);
735
+ return /* @__PURE__ */ jsx7(React4.Fragment, { children: text }, index);
782
736
  }
783
737
  }
784
738
  const formatted = decorations.reduce(
785
739
  (element, decorator) => {
786
- var _a, _b, _c, _d, _e;
787
740
  switch (decorator[0]) {
788
741
  case "p": {
789
742
  const blockId = decorator[1];
790
- const linkedBlock = (_a = recordMap.block[blockId]) == null ? void 0 : _a.value;
743
+ const linkedBlock = getBlockValue2(recordMap.block[blockId]);
791
744
  if (!linkedBlock) {
792
745
  console.log('"p" missing block', blockId);
793
746
  return null;
794
747
  }
795
- return /* @__PURE__ */ jsx9(
748
+ return /* @__PURE__ */ jsx7(
796
749
  components.PageLink,
797
750
  {
798
751
  className: "notion-link",
799
752
  href: mapPageUrl(blockId),
800
- children: /* @__PURE__ */ jsx9(PageTitle, { block: linkedBlock })
753
+ children: /* @__PURE__ */ jsx7(PageTitle, { block: linkedBlock })
801
754
  }
802
755
  );
803
756
  }
@@ -806,7 +759,7 @@ function Text({
806
759
  const id = decorator[1][1];
807
760
  switch (linkType) {
808
761
  case "u": {
809
- const user = (_b = recordMap.notion_user[id]) == null ? void 0 : _b.value;
762
+ const user = getBlockValue2(recordMap.notion_user[id]);
810
763
  if (!user) {
811
764
  console.log('"\u2023" missing user', id);
812
765
  return null;
@@ -814,7 +767,7 @@ function Text({
814
767
  const src = mapImageUrl(user.profile_photo, block);
815
768
  if (!src) return null;
816
769
  const name = [user.given_name, user.family_name].filter(Boolean).join(" ");
817
- return /* @__PURE__ */ jsx9(
770
+ return /* @__PURE__ */ jsx7(
818
771
  GracefulImage,
819
772
  {
820
773
  className: "notion-user",
@@ -824,12 +777,12 @@ function Text({
824
777
  );
825
778
  }
826
779
  default: {
827
- const linkedBlock = (_c = recordMap.block[id]) == null ? void 0 : _c.value;
780
+ const linkedBlock = getBlockValue2(recordMap.block[id]);
828
781
  if (!linkedBlock) {
829
782
  console.log('"\u2023" missing block', linkType, id);
830
783
  return null;
831
784
  }
832
- return /* @__PURE__ */ jsx9(
785
+ return /* @__PURE__ */ jsx7(
833
786
  components.PageLink,
834
787
  {
835
788
  className: "notion-link",
@@ -837,26 +790,26 @@ function Text({
837
790
  ...linkProps,
838
791
  target: "_blank",
839
792
  rel: "noopener noreferrer",
840
- children: /* @__PURE__ */ jsx9(PageTitle, { block: linkedBlock })
793
+ children: /* @__PURE__ */ jsx7(PageTitle, { block: linkedBlock })
841
794
  }
842
795
  );
843
796
  }
844
797
  }
845
798
  }
846
799
  case "h":
847
- return /* @__PURE__ */ jsx9("span", { className: `notion-${decorator[1]}`, children: element });
800
+ return /* @__PURE__ */ jsx7("span", { className: `notion-${decorator[1]}`, children: element });
848
801
  case "c":
849
- return /* @__PURE__ */ jsx9("code", { className: "notion-inline-code", children: element });
802
+ return /* @__PURE__ */ jsx7("code", { className: "notion-inline-code", children: element });
850
803
  case "b":
851
- return /* @__PURE__ */ jsx9("b", { children: element });
804
+ return /* @__PURE__ */ jsx7("b", { children: element });
852
805
  case "i":
853
- return /* @__PURE__ */ jsx9("em", { children: element });
806
+ return /* @__PURE__ */ jsx7("em", { children: element });
854
807
  case "s":
855
- return /* @__PURE__ */ jsx9("s", { children: element });
808
+ return /* @__PURE__ */ jsx7("s", { children: element });
856
809
  case "_":
857
- return /* @__PURE__ */ jsx9("span", { className: "notion-inline-underscore", children: element });
810
+ return /* @__PURE__ */ jsx7("span", { className: "notion-inline-underscore", children: element });
858
811
  case "e":
859
- return /* @__PURE__ */ jsx9(components.Equation, { math: decorator[1], inline: true });
812
+ return /* @__PURE__ */ jsx7(components.Equation, { math: decorator[1], inline: true });
860
813
  case "m":
861
814
  return element;
862
815
  //still need to return the base element
@@ -866,7 +819,7 @@ function Text({
866
819
  const id = parsePageId(pathname, { uuid: true });
867
820
  if (rootDomain && v.includes(rootDomain) || id && v[0] === "/") {
868
821
  const href = rootDomain && v.includes(rootDomain) ? v : `${mapPageUrl(id)}${getHashFragmentValue(v)}`;
869
- return /* @__PURE__ */ jsx9(
822
+ return /* @__PURE__ */ jsx7(
870
823
  components.PageLink,
871
824
  {
872
825
  className: "notion-link",
@@ -876,7 +829,7 @@ function Text({
876
829
  }
877
830
  );
878
831
  } else {
879
- return /* @__PURE__ */ jsx9(
832
+ return /* @__PURE__ */ jsx7(
880
833
  components.Link,
881
834
  {
882
835
  className: "notion-link",
@@ -907,7 +860,7 @@ function Text({
907
860
  }
908
861
  case "u": {
909
862
  const userId = decorator[1];
910
- const user = (_d = recordMap.notion_user[userId]) == null ? void 0 : _d.value;
863
+ const user = getBlockValue2(recordMap.notion_user[userId]);
911
864
  if (!user) {
912
865
  console.log("missing user", userId);
913
866
  return null;
@@ -915,16 +868,22 @@ function Text({
915
868
  const src = mapImageUrl(user.profile_photo, block);
916
869
  if (!src) return null;
917
870
  const name = [user.given_name, user.family_name].filter(Boolean).join(" ");
918
- return /* @__PURE__ */ jsx9(GracefulImage, { className: "notion-user", src, alt: name });
871
+ return /* @__PURE__ */ jsx7(GracefulImage, { className: "notion-user", src, alt: name });
919
872
  }
920
873
  case "lm": {
921
874
  const metadata = decorator[1];
922
- return /* @__PURE__ */ jsx9(LinkMention, { metadata });
875
+ return /* @__PURE__ */ jsx7(LinkMention, { metadata });
923
876
  }
924
877
  case "eoi": {
925
878
  const blockId = decorator[1];
926
- const externalObjectInstance = (_e = recordMap.block[blockId]) == null ? void 0 : _e.value;
927
- return /* @__PURE__ */ jsx9(EOI, { block: externalObjectInstance, inline: true });
879
+ const externalObjectInstance = getBlockValue2(
880
+ recordMap.block[blockId]
881
+ );
882
+ if (!externalObjectInstance) {
883
+ console.log('"eoi" missing block', blockId);
884
+ return null;
885
+ }
886
+ return /* @__PURE__ */ jsx7(EOI, { block: externalObjectInstance, inline: true });
928
887
  }
929
888
  case "si":
930
889
  return null;
@@ -935,57 +894,101 @@ function Text({
935
894
  return element;
936
895
  }
937
896
  },
938
- /* @__PURE__ */ jsx9(Fragment, { children: text })
897
+ /* @__PURE__ */ jsx7(Fragment, { children: text })
939
898
  );
940
- return /* @__PURE__ */ jsx9(React6.Fragment, { children: formatted }, index);
899
+ return /* @__PURE__ */ jsx7(React4.Fragment, { children: formatted }, index);
941
900
  }) });
942
901
  }
943
902
 
944
- // src/components/page-title.tsx
903
+ // src/components/header.tsx
904
+ import { getPageBreadcrumbs } from "notion-utils";
905
+ import React9 from "react";
906
+ import { useHotkeys } from "react-hotkeys-hook";
907
+
908
+ // src/icons/search-icon.tsx
909
+ import "react";
910
+ import { jsx as jsx8 } from "react/jsx-runtime";
911
+ function SearchIcon(props) {
912
+ const { className, ...rest } = props;
913
+ return /* @__PURE__ */ jsx8("svg", { className: cs("notion-icon", className), viewBox: "0 0 17 17", ...rest, children: /* @__PURE__ */ jsx8("path", { d: "M6.78027 13.6729C8.24805 13.6729 9.60156 13.1982 10.709 12.4072L14.875 16.5732C15.0684 16.7666 15.3232 16.8633 15.5957 16.8633C16.167 16.8633 16.5713 16.4238 16.5713 15.8613C16.5713 15.5977 16.4834 15.3516 16.29 15.1582L12.1504 11.0098C13.0205 9.86719 13.5391 8.45215 13.5391 6.91406C13.5391 3.19629 10.498 0.155273 6.78027 0.155273C3.0625 0.155273 0.0214844 3.19629 0.0214844 6.91406C0.0214844 10.6318 3.0625 13.6729 6.78027 13.6729ZM6.78027 12.2139C3.87988 12.2139 1.48047 9.81445 1.48047 6.91406C1.48047 4.01367 3.87988 1.61426 6.78027 1.61426C9.68066 1.61426 12.0801 4.01367 12.0801 6.91406C12.0801 9.81445 9.68066 12.2139 6.78027 12.2139Z" }) });
914
+ }
915
+
916
+ // src/components/search-dialog.tsx
917
+ var import_lodash = __toESM(require_lodash(), 1);
918
+ import { getBlockParentPage, getBlockTitle as getBlockTitle2 } from "notion-utils";
919
+ import React8 from "react";
920
+
921
+ // src/icons/clear-icon.tsx
922
+ import "react";
923
+ import { jsx as jsx9 } from "react/jsx-runtime";
924
+ function ClearIcon(props) {
925
+ const { className, ...rest } = props;
926
+ return /* @__PURE__ */ jsx9("svg", { className: cs("notion-icon", className), ...rest, viewBox: "0 0 30 30", children: /* @__PURE__ */ jsx9("path", { d: "M15,0C6.716,0,0,6.716,0,15s6.716,15,15,15s15-6.716,15-15S23.284,0,15,0z M22,20.6L20.6,22L15,16.4L9.4,22L8,20.6l5.6-5.6 L8,9.4L9.4,8l5.6,5.6L20.6,8L22,9.4L16.4,15L22,20.6z" }) });
927
+ }
928
+
929
+ // src/icons/loading-icon.tsx
930
+ import "react";
945
931
  import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
946
- function PageTitleImpl({
947
- block,
948
- className,
949
- defaultIcon,
950
- ...rest
951
- }) {
952
- var _a, _b;
953
- const { recordMap } = useNotionContext();
954
- if (!block) return null;
955
- if (block.type === "collection_view_page" || block.type === "collection_view") {
956
- const title = getBlockTitle(block, recordMap);
957
- if (!title) {
958
- return null;
959
- }
960
- const titleDecoration = [[title]];
961
- return /* @__PURE__ */ jsxs5("span", { className: cs("notion-page-title", className), ...rest, children: [
932
+ function LoadingIcon(props) {
933
+ const { className, ...rest } = props;
934
+ return /* @__PURE__ */ jsxs5("svg", { className: cs("notion-icon", className), ...rest, viewBox: "0 0 24 24", children: [
935
+ /* @__PURE__ */ jsx10("defs", { children: /* @__PURE__ */ jsxs5(
936
+ "linearGradient",
937
+ {
938
+ x1: "28.1542969%",
939
+ y1: "63.7402344%",
940
+ x2: "74.6289062%",
941
+ y2: "17.7832031%",
942
+ id: "linearGradient-1",
943
+ children: [
944
+ /* @__PURE__ */ jsx10("stop", { stopColor: "rgba(164, 164, 164, 1)", offset: "0%" }),
945
+ /* @__PURE__ */ jsx10(
946
+ "stop",
947
+ {
948
+ stopColor: "rgba(164, 164, 164, 0)",
949
+ stopOpacity: "0",
950
+ offset: "100%"
951
+ }
952
+ )
953
+ ]
954
+ }
955
+ ) }),
956
+ /* @__PURE__ */ jsx10("g", { id: "Page-1", stroke: "none", strokeWidth: "1", fill: "none", children: /* @__PURE__ */ jsx10("g", { transform: "translate(-236.000000, -286.000000)", children: /* @__PURE__ */ jsxs5("g", { transform: "translate(238.000000, 286.000000)", children: [
962
957
  /* @__PURE__ */ jsx10(
963
- PageIcon,
958
+ "circle",
964
959
  {
965
- block,
966
- defaultIcon,
967
- className: "notion-page-title-icon"
960
+ id: "Oval-2",
961
+ stroke: "url(#linearGradient-1)",
962
+ strokeWidth: "4",
963
+ cx: "10",
964
+ cy: "12",
965
+ r: "10"
968
966
  }
969
967
  ),
970
- /* @__PURE__ */ jsx10("span", { className: "notion-page-title-text", children: /* @__PURE__ */ jsx10(Text, { value: titleDecoration, block }) })
971
- ] });
972
- }
973
- if (!((_a = block.properties) == null ? void 0 : _a.title)) {
974
- return null;
975
- }
976
- return /* @__PURE__ */ jsxs5("span", { className: cs("notion-page-title", className), ...rest, children: [
977
- /* @__PURE__ */ jsx10(
978
- PageIcon,
979
- {
980
- block,
981
- defaultIcon,
982
- className: "notion-page-title-icon"
983
- }
984
- ),
985
- /* @__PURE__ */ jsx10("span", { className: "notion-page-title-text", children: /* @__PURE__ */ jsx10(Text, { value: (_b = block.properties) == null ? void 0 : _b.title, block }) })
968
+ /* @__PURE__ */ jsx10(
969
+ "path",
970
+ {
971
+ d: "M10,2 C4.4771525,2 0,6.4771525 0,12",
972
+ id: "Oval-2",
973
+ stroke: "rgba(164, 164, 164, 1)",
974
+ strokeWidth: "4"
975
+ }
976
+ ),
977
+ /* @__PURE__ */ jsx10(
978
+ "rect",
979
+ {
980
+ id: "Rectangle-1",
981
+ fill: "rgba(164, 164, 164, 1)",
982
+ x: "8",
983
+ y: "0",
984
+ width: "4",
985
+ height: "4",
986
+ rx: "8"
987
+ }
988
+ )
989
+ ] }) }) })
986
990
  ] });
987
991
  }
988
- var PageTitle = React7.memo(PageTitleImpl);
989
992
 
990
993
  // src/components/search-dialog.tsx
991
994
  import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
@@ -2216,6 +2219,8 @@ var defaultComponents = {
2216
2219
  Checkbox,
2217
2220
  Callout: void 0,
2218
2221
  // use the built-in callout rendering by default
2222
+ Button: void 0,
2223
+ // use the built-in button rendering by default
2219
2224
  Code: dummyComponent("Code"),
2220
2225
  Equation: dummyComponent("Equation"),
2221
2226
  Collection: dummyComponent("Collection"),
@@ -2474,6 +2479,7 @@ function CollectionViewIcon({ type, ...rest }) {
2474
2479
 
2475
2480
  // src/third-party/collection-row.tsx
2476
2481
  import "notion-types";
2482
+ import { getBlockValue as getBlockValue3 } from "notion-utils";
2477
2483
 
2478
2484
  // src/third-party/collection-column-title.tsx
2479
2485
  import "notion-types";
@@ -5243,7 +5249,13 @@ function PropertyImpl(props) {
5243
5249
  case "select":
5244
5250
  // intentional fallthrough
5245
5251
  case "multi_select": {
5246
- const values = (((_c = data == null ? void 0 : data[0]) == null ? void 0 : _c[0]) || "").split(",");
5252
+ const originalValues = (((_c = data == null ? void 0 : data[0]) == null ? void 0 : _c[0]) || "").split(",");
5253
+ const values = originalValues.filter(
5254
+ (value) => {
5255
+ var _a2;
5256
+ return (_a2 = schema.options) == null ? void 0 : _a2.some((option) => value === option.value);
5257
+ }
5258
+ );
5247
5259
  content = values.map((value, index) => {
5248
5260
  var _a2;
5249
5261
  const option = (_a2 = schema.options) == null ? void 0 : _a2.find(
@@ -5341,16 +5353,16 @@ function CollectionRow({
5341
5353
  pageHeader = false,
5342
5354
  className
5343
5355
  }) {
5344
- var _a, _b, _c, _d;
5356
+ var _a, _b, _c;
5345
5357
  const { recordMap } = useNotionContext();
5346
5358
  const collectionId = block.parent_id;
5347
- const collection = (_a = recordMap.collection[collectionId]) == null ? void 0 : _a.value;
5359
+ const collection = getBlockValue3(recordMap.collection[collectionId]);
5348
5360
  const schemas = collection == null ? void 0 : collection.schema;
5349
5361
  if (!collection || !schemas) {
5350
5362
  return null;
5351
5363
  }
5352
5364
  let propertyIds = Object.keys(schemas).filter((id) => id !== "title");
5353
- if ((_b = collection.format) == null ? void 0 : _b.property_visibility) {
5365
+ if ((_a = collection.format) == null ? void 0 : _a.property_visibility) {
5354
5366
  propertyIds = propertyIds.filter(
5355
5367
  (id) => {
5356
5368
  var _a2, _b2, _c2;
@@ -5360,9 +5372,9 @@ function CollectionRow({
5360
5372
  }
5361
5373
  );
5362
5374
  }
5363
- if ((_c = collection.format) == null ? void 0 : _c.collection_page_properties) {
5375
+ if ((_b = collection.format) == null ? void 0 : _b.collection_page_properties) {
5364
5376
  const idToIndex = Object.fromEntries(
5365
- (_d = collection.format) == null ? void 0 : _d.collection_page_properties.map((p, i) => [
5377
+ (_c = collection.format) == null ? void 0 : _c.collection_page_properties.map((p, i) => [
5366
5378
  p.property,
5367
5379
  i
5368
5380
  ])
@@ -5397,6 +5409,7 @@ import React21 from "react";
5397
5409
 
5398
5410
  // src/third-party/collection-view-board.tsx
5399
5411
  import "notion-types";
5412
+ import { getBlockValue as getBlockValue5 } from "notion-utils";
5400
5413
  import React18 from "react";
5401
5414
 
5402
5415
  // src/icons/empty-icon.tsx
@@ -5409,7 +5422,7 @@ function EmptyIcon(props) {
5409
5422
 
5410
5423
  // src/third-party/collection-card.tsx
5411
5424
  import "notion-types";
5412
- import { getTextContent as getTextContent3 } from "notion-utils";
5425
+ import { getBlockValue as getBlockValue4, getTextContent as getTextContent3 } from "notion-utils";
5413
5426
  import { Fragment as Fragment6, jsx as jsx51, jsxs as jsxs14 } from "react/jsx-runtime";
5414
5427
  function CollectionCard({
5415
5428
  collection,
@@ -5421,7 +5434,7 @@ function CollectionCard({
5421
5434
  className,
5422
5435
  ...rest
5423
5436
  }) {
5424
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
5437
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
5425
5438
  const ctx2 = useNotionContext();
5426
5439
  const {
5427
5440
  components,
@@ -5436,16 +5449,21 @@ function CollectionCard({
5436
5449
  const cardCoverPosition = (1 - card_cover_position) * 100;
5437
5450
  if ((cover == null ? void 0 : cover.type) === "page_content") {
5438
5451
  const contentBlockId = (_a = block.content) == null ? void 0 : _a.find((blockId) => {
5439
- var _a2;
5440
- const block2 = (_a2 = recordMap.block[blockId]) == null ? void 0 : _a2.value;
5452
+ const block2 = getBlockValue4(recordMap.block[blockId]);
5441
5453
  return (block2 == null ? void 0 : block2.type) === "image";
5442
5454
  });
5443
5455
  if (contentBlockId) {
5444
- const contentBlock = (_b = recordMap.block[contentBlockId]) == null ? void 0 : _b.value;
5445
- const source = (_g = (_e = (_d = (_c = contentBlock.properties) == null ? void 0 : _c.source) == null ? void 0 : _d[0]) == null ? void 0 : _e[0]) != null ? _g : (_f = contentBlock.format) == null ? void 0 : _f.display_source;
5456
+ const contentBlock = getBlockValue4(
5457
+ recordMap.block[contentBlockId]
5458
+ );
5459
+ if (!contentBlock) {
5460
+ console.log('"page_content" missing block', contentBlockId);
5461
+ return null;
5462
+ }
5463
+ const source = (_f = (_d = (_c = (_b = contentBlock.properties) == null ? void 0 : _b.source) == null ? void 0 : _c[0]) == null ? void 0 : _d[0]) != null ? _f : (_e = contentBlock.format) == null ? void 0 : _e.display_source;
5446
5464
  if (source) {
5447
5465
  const src = mapImageUrl(source, contentBlock);
5448
- const caption = (_j = (_i = (_h = contentBlock.properties) == null ? void 0 : _h.caption) == null ? void 0 : _i[0]) == null ? void 0 : _j[0];
5466
+ const caption = (_i = (_h = (_g = contentBlock.properties) == null ? void 0 : _g.caption) == null ? void 0 : _h[0]) == null ? void 0 : _i[0];
5449
5467
  coverContent = /* @__PURE__ */ jsx51(
5450
5468
  LazyImage,
5451
5469
  {
@@ -5470,7 +5488,7 @@ function CollectionCard({
5470
5488
  LazyImage,
5471
5489
  {
5472
5490
  src: mapImageUrl(page_cover, block),
5473
- alt: getTextContent3((_k = block.properties) == null ? void 0 : _k.title),
5491
+ alt: getTextContent3((_j = block.properties) == null ? void 0 : _j.title),
5474
5492
  style: {
5475
5493
  objectFit: coverAspect,
5476
5494
  objectPosition: `center ${coverPosition2}%`
@@ -5481,8 +5499,8 @@ function CollectionCard({
5481
5499
  } else if ((cover == null ? void 0 : cover.type) === "property") {
5482
5500
  const { property } = cover;
5483
5501
  if (!property) return null;
5484
- const schema = collection.value.schema[property];
5485
- const data = (_l = block.properties) == null ? void 0 : _l[property];
5502
+ const schema = collection.schema[property];
5503
+ const data = (_k = block.properties) == null ? void 0 : _k[property];
5486
5504
  if (schema && data) {
5487
5505
  if (schema.type === "file") {
5488
5506
  const files = data.filter((v) => v.length === 2).map((f) => f.flat().flat());
@@ -5508,10 +5526,10 @@ function CollectionCard({
5508
5526
  let linkProperties = [];
5509
5527
  if (isLinkCollectionToUrlProperty && properties) {
5510
5528
  linkProperties = properties.filter(
5511
- (p) => p.visible && p.property !== "title" && collection.value.schema[p.property]
5529
+ (p) => p.visible && p.property !== "title" && collection.schema[p.property]
5512
5530
  ).filter((p) => {
5513
5531
  if (!block.properties) return false;
5514
- const schema = collection.value.schema[p.property];
5532
+ const schema = collection.schema[p.property];
5515
5533
  return (schema == null ? void 0 : schema.type) === "url";
5516
5534
  }).map((p) => {
5517
5535
  var _a2;
@@ -5528,17 +5546,17 @@ function CollectionCard({
5528
5546
  /* @__PURE__ */ jsx51("div", { className: "notion-collection-card-property", children: /* @__PURE__ */ jsx51(
5529
5547
  Property,
5530
5548
  {
5531
- schema: collection.value.schema.title,
5532
- data: (_m = block == null ? void 0 : block.properties) == null ? void 0 : _m.title,
5549
+ schema: collection.schema.title,
5550
+ data: (_l = block == null ? void 0 : block.properties) == null ? void 0 : _l.title,
5533
5551
  block,
5534
5552
  collection
5535
5553
  }
5536
5554
  ) }),
5537
5555
  properties == null ? void 0 : properties.filter(
5538
- (p) => p.visible && p.property !== "title" && collection.value.schema[p.property]
5556
+ (p) => p.visible && p.property !== "title" && collection.schema[p.property]
5539
5557
  ).map((p) => {
5540
5558
  if (!block.properties || !p.property) return null;
5541
- const schema = collection.value.schema[p.property];
5559
+ const schema = collection.schema[p.property];
5542
5560
  const data = block.properties[p.property];
5543
5561
  return /* @__PURE__ */ jsx51("div", { className: "notion-collection-card-property", children: /* @__PURE__ */ jsx51(
5544
5562
  Property,
@@ -5644,7 +5662,7 @@ function getCollectionGroups(collection, collectionView, collectionData, ...rest
5644
5662
  const queryLabel = isUncategorizedValue ? "uncategorized" : isDateValue ? ((_a2 = value.range) == null ? void 0 : _a2.start_date) || ((_b = value.range) == null ? void 0 : _b.end_date) : (value == null ? void 0 : value.value) || value;
5645
5663
  const collectionGroup = collectionData[`results:${type}:${queryLabel}`];
5646
5664
  let queryValue = !isUncategorizedValue && (isDateValue || (value == null ? void 0 : value.value) || value);
5647
- let schema = collection.value.schema[property];
5665
+ let schema = collection.schema[property];
5648
5666
  if (type === "checkbox" && value) {
5649
5667
  queryValue = "Yes";
5650
5668
  }
@@ -5716,15 +5734,15 @@ function Board({
5716
5734
  collection,
5717
5735
  padding
5718
5736
  }) {
5719
- var _a, _b, _c, _d;
5737
+ var _a, _b, _c, _d, _e;
5720
5738
  const { recordMap } = useNotionContext();
5721
5739
  const {
5722
5740
  board_cover = { type: "none" },
5723
5741
  board_cover_size = "medium",
5724
5742
  board_cover_aspect = "cover"
5725
5743
  } = (collectionView == null ? void 0 : collectionView.format) || {};
5726
- const boardGroups = ((_a = collectionView == null ? void 0 : collectionView.format) == null ? void 0 : _a.board_columns) || ((_b = collectionView == null ? void 0 : collectionView.format) == null ? void 0 : _b.board_groups2) || [];
5727
- const boardGroupBy = (_d = (_c = collectionView == null ? void 0 : collectionView.format) == null ? void 0 : _c.board_columns_by) == null ? void 0 : _d.groupBy;
5744
+ const boardGroups = ((_a = collectionView == null ? void 0 : collectionView.format) == null ? void 0 : _a.board_columns) || ((_b = collectionView == null ? void 0 : collectionView.format) == null ? void 0 : _b.board_columns2) || ((_c = collectionView == null ? void 0 : collectionView.format) == null ? void 0 : _c.board_groups2) || [];
5745
+ const boardGroupBy = (_e = (_d = collectionView == null ? void 0 : collectionView.format) == null ? void 0 : _d.board_columns_by) == null ? void 0 : _e.groupBy;
5728
5746
  const boardStyle = React18.useMemo(
5729
5747
  () => ({
5730
5748
  paddingLeft: padding
@@ -5746,7 +5764,7 @@ function Board({
5746
5764
  return null;
5747
5765
  }
5748
5766
  const group = collectionData.board_columns.results[index];
5749
- const schema = collection.value.schema[p.property];
5767
+ const schema = collection.schema[p.property];
5750
5768
  if (!group || !schema || p.hidden) {
5751
5769
  return null;
5752
5770
  }
@@ -5771,18 +5789,20 @@ function Board({
5771
5789
  }) }) }),
5772
5790
  /* @__PURE__ */ jsx53("div", { className: "notion-board-header-placeholder" }),
5773
5791
  /* @__PURE__ */ jsx53("div", { className: "notion-board-body", children: boardGroups.map((p, index) => {
5774
- var _a2, _b2, _c2, _d2, _e;
5792
+ var _a2, _b2, _c2, _d2, _e2;
5775
5793
  const boardResults = (_a2 = collectionData.board_columns) == null ? void 0 : _a2.results;
5776
5794
  if (!boardResults) return null;
5777
5795
  if (!((_b2 = p == null ? void 0 : p.value) == null ? void 0 : _b2.type)) return null;
5778
- const schema = collection.value.schema[p.property];
5796
+ const schema = collection.schema[p.property];
5779
5797
  const group = collectionData[`results:${(_c2 = p == null ? void 0 : p.value) == null ? void 0 : _c2.type}:${((_d2 = p == null ? void 0 : p.value) == null ? void 0 : _d2.value) || "uncategorized"}`];
5780
5798
  if (!group || !schema || p.hidden) {
5781
5799
  return null;
5782
5800
  }
5783
- return /* @__PURE__ */ jsx53("div", { className: "notion-board-group", children: (_e = group.blockIds) == null ? void 0 : _e.map((blockId) => {
5784
- var _a3, _b3;
5785
- const block = (_a3 = recordMap.block[blockId]) == null ? void 0 : _a3.value;
5801
+ return /* @__PURE__ */ jsx53("div", { className: "notion-board-group", children: (_e2 = group.blockIds) == null ? void 0 : _e2.map((blockId) => {
5802
+ var _a3;
5803
+ const block = getBlockValue5(
5804
+ recordMap.block[blockId]
5805
+ );
5786
5806
  if (!block) return null;
5787
5807
  return /* @__PURE__ */ jsx53(
5788
5808
  CollectionCard,
@@ -5793,7 +5813,7 @@ function Board({
5793
5813
  cover: board_cover,
5794
5814
  coverSize: board_cover_size,
5795
5815
  coverAspect: board_cover_aspect,
5796
- properties: (_b3 = collectionView.format) == null ? void 0 : _b3.board_properties
5816
+ properties: (_a3 = collectionView.format) == null ? void 0 : _a3.board_properties
5797
5817
  },
5798
5818
  blockId
5799
5819
  );
@@ -6400,20 +6420,20 @@ function CollectionViewCalendar({
6400
6420
  var _a2;
6401
6421
  const calendarBy = (_a2 = collectionView == null ? void 0 : collectionView.query2) == null ? void 0 : _a2.calendar_by;
6402
6422
  if (calendarBy) {
6403
- const schema2 = collection.value.schema;
6423
+ const schema2 = collection.schema;
6404
6424
  const propertySchema = schema2[calendarBy];
6405
6425
  if (propertySchema && propertySchema.type === "date") {
6406
6426
  return calendarBy;
6407
6427
  }
6408
6428
  }
6409
- const schema = collection.value.schema;
6429
+ const schema = collection.schema;
6410
6430
  for (const [propertyId, propertySchema] of Object.entries(schema)) {
6411
6431
  if (propertySchema.type === "date") {
6412
6432
  return propertyId;
6413
6433
  }
6414
6434
  }
6415
6435
  return null;
6416
- }, [collection.value.schema, collectionView]);
6436
+ }, [collection.schema, collectionView]);
6417
6437
  const eventsByDate = React20.useMemo(() => {
6418
6438
  var _a2, _b2;
6419
6439
  const eventsMap = /* @__PURE__ */ new Map();
@@ -6558,6 +6578,7 @@ function CollectionViewCalendar({
6558
6578
 
6559
6579
  // src/third-party/collection-view-gallery.tsx
6560
6580
  import "notion-types";
6581
+ import { getBlockValue as getBlockValue6 } from "notion-utils";
6561
6582
  import { jsx as jsx56 } from "react/jsx-runtime";
6562
6583
  var defaultBlockIds2 = [];
6563
6584
  function CollectionViewGallery({
@@ -6611,8 +6632,8 @@ function Gallery({
6611
6632
  `notion-gallery-grid-size-${gallery_cover_size}`
6612
6633
  ),
6613
6634
  children: blockIds == null ? void 0 : blockIds.map((blockId) => {
6614
- var _a, _b;
6615
- const block = (_a = recordMap.block[blockId]) == null ? void 0 : _a.value;
6635
+ var _a;
6636
+ const block = getBlockValue6(recordMap.block[blockId]);
6616
6637
  if (!block) return null;
6617
6638
  return /* @__PURE__ */ jsx56(
6618
6639
  CollectionCard,
@@ -6622,7 +6643,7 @@ function Gallery({
6622
6643
  cover: gallery_cover,
6623
6644
  coverSize: gallery_cover_size,
6624
6645
  coverAspect: gallery_cover_aspect,
6625
- properties: (_b = collectionView.format) == null ? void 0 : _b.gallery_properties
6646
+ properties: (_a = collectionView.format) == null ? void 0 : _a.gallery_properties
6626
6647
  },
6627
6648
  blockId
6628
6649
  );
@@ -6633,6 +6654,7 @@ function Gallery({
6633
6654
 
6634
6655
  // src/third-party/collection-view-list.tsx
6635
6656
  import "notion-types";
6657
+ import { getBlockValue as getBlockValue7 } from "notion-utils";
6636
6658
  import { jsx as jsx57, jsxs as jsxs19 } from "react/jsx-runtime";
6637
6659
  var defaultBlockIds3 = [];
6638
6660
  function CollectionViewList({
@@ -6667,11 +6689,11 @@ function List({
6667
6689
  }) {
6668
6690
  const { components, recordMap, mapPageUrl } = useNotionContext();
6669
6691
  return /* @__PURE__ */ jsx57("div", { className: "notion-list-collection", children: /* @__PURE__ */ jsx57("div", { className: "notion-list-view", children: /* @__PURE__ */ jsx57("div", { className: "notion-list-body", children: blockIds == null ? void 0 : blockIds.map((blockId) => {
6670
- var _a, _b, _c, _d;
6671
- const block = (_a = recordMap.block[blockId]) == null ? void 0 : _a.value;
6692
+ var _a, _b, _c;
6693
+ const block = getBlockValue7(recordMap.block[blockId]);
6672
6694
  if (!block) return null;
6673
- const titleSchema = collection.value.schema.title;
6674
- const titleData = (_b = block == null ? void 0 : block.properties) == null ? void 0 : _b.title;
6695
+ const titleSchema = collection.schema.title;
6696
+ const titleData = (_a = block == null ? void 0 : block.properties) == null ? void 0 : _a.title;
6675
6697
  return /* @__PURE__ */ jsxs19(
6676
6698
  components.PageLink,
6677
6699
  {
@@ -6698,9 +6720,9 @@ function List({
6698
6720
  }
6699
6721
  )
6700
6722
  ] }),
6701
- /* @__PURE__ */ jsx57("div", { className: "notion-list-item-body", children: (_d = (_c = collectionView.format) == null ? void 0 : _c.list_properties) == null ? void 0 : _d.filter((p) => p.visible).map((p) => {
6723
+ /* @__PURE__ */ jsx57("div", { className: "notion-list-item-body", children: (_c = (_b = collectionView.format) == null ? void 0 : _b.list_properties) == null ? void 0 : _c.filter((p) => p.visible).map((p) => {
6702
6724
  var _a2;
6703
- const schema = collection.value.schema[p.property];
6725
+ const schema = collection.schema[p.property];
6704
6726
  const data = block && ((_a2 = block.properties) == null ? void 0 : _a2[p.property]);
6705
6727
  if (!schema) {
6706
6728
  return null;
@@ -6729,6 +6751,9 @@ function List({
6729
6751
  }) }) }) });
6730
6752
  }
6731
6753
 
6754
+ // src/third-party/collection-view-table.tsx
6755
+ import { getBlockValue as getBlockValue8 } from "notion-utils";
6756
+
6732
6757
  // src/third-party/react-use.ts
6733
6758
  import {
6734
6759
  useCallback,
@@ -6933,17 +6958,17 @@ function Table({
6933
6958
  let properties = [];
6934
6959
  if ((_a = collectionView.format) == null ? void 0 : _a.table_properties) {
6935
6960
  properties = collectionView.format.table_properties.filter(
6936
- (p) => p.visible && collection.value.schema[p.property]
6961
+ (p) => p.visible && collection.schema[p.property]
6937
6962
  );
6938
6963
  } else {
6939
6964
  properties = [{ property: "title" }].concat(
6940
- Object.keys(collection.value.schema).filter((p) => p !== "title").map((property) => ({ property }))
6965
+ Object.keys(collection.schema).filter((p) => p !== "title").map((property) => ({ property }))
6941
6966
  );
6942
6967
  }
6943
6968
  return /* @__PURE__ */ jsx58("div", { className: "notion-table", style: tableStyle, children: /* @__PURE__ */ jsx58("div", { className: "notion-table-view", style: tableViewStyle, children: !!properties.length && /* @__PURE__ */ jsxs20(Fragment7, { children: [
6944
6969
  /* @__PURE__ */ jsx58("div", { className: "notion-table-header", children: /* @__PURE__ */ jsx58("div", { className: "notion-table-header-inner", children: properties.map((p) => {
6945
6970
  var _a2;
6946
- const schema = (_a2 = collection.value.schema) == null ? void 0 : _a2[p.property];
6971
+ const schema = (_a2 = collection.schema) == null ? void 0 : _a2[p.property];
6947
6972
  const isTitle = p.property === "title";
6948
6973
  const style = {};
6949
6974
  if (p.width) {
@@ -6964,10 +6989,10 @@ function Table({
6964
6989
  }) }) }),
6965
6990
  /* @__PURE__ */ jsx58("div", { className: "notion-table-header-placeholder" }),
6966
6991
  /* @__PURE__ */ jsx58("div", { className: "notion-table-body", children: blockIds == null ? void 0 : blockIds.map((blockId) => /* @__PURE__ */ jsx58("div", { className: "notion-table-row", children: properties.map((p) => {
6967
- var _a2, _b, _c;
6968
- const schema = (_a2 = collection.value.schema) == null ? void 0 : _a2[p.property];
6969
- const block = (_b = recordMap.block[blockId]) == null ? void 0 : _b.value;
6970
- const data = (_c = block == null ? void 0 : block.properties) == null ? void 0 : _c[p.property];
6992
+ var _a2, _b;
6993
+ const schema = (_a2 = collection.schema) == null ? void 0 : _a2[p.property];
6994
+ const block = getBlockValue8(recordMap.block[blockId]);
6995
+ const data = (_b = block == null ? void 0 : block.properties) == null ? void 0 : _b[p.property];
6971
6996
  const isTitle = p.property === "title";
6972
6997
  const style = {};
6973
6998
  if (p.width) {
@@ -7058,7 +7083,7 @@ function CollectionViewBlock({
7058
7083
  block,
7059
7084
  className
7060
7085
  }) {
7061
- var _a, _b, _c, _d;
7086
+ var _a, _b, _c;
7062
7087
  const { recordMap, showCollectionViewDropdown } = useNotionContext();
7063
7088
  const { view_ids: viewIds } = block;
7064
7089
  const collectionId = getBlockCollectionId(block, recordMap);
@@ -7085,9 +7110,12 @@ function CollectionViewBlock({
7085
7110
  if (isServer2) {
7086
7111
  windowWidth = 1024;
7087
7112
  }
7088
- const collection = (_a = recordMap.collection[collectionId]) == null ? void 0 : _a.value;
7089
- const collectionView = (_b = recordMap.collection_view[collectionViewId]) == null ? void 0 : _b.value;
7090
- const collectionData = (_c = recordMap.collection_query[collectionId]) == null ? void 0 : _c[collectionViewId];
7113
+ const collection = getBlockValue9(recordMap.collection[collectionId]);
7114
+ const collectionView = getBlockValue9(
7115
+ recordMap.collection_view[collectionViewId]
7116
+ );
7117
+ const rawCollectionData = (_a = recordMap.collection_query[collectionId]) == null ? void 0 : _a[collectionViewId];
7118
+ const collectionData = (_b = rawCollectionData == null ? void 0 : rawCollectionData.reducerResults) != null ? _b : rawCollectionData;
7091
7119
  const parentPage = getBlockParentPage2(block, recordMap);
7092
7120
  const { width, padding } = React22.useMemo(() => {
7093
7121
  var _a2;
@@ -7127,7 +7155,7 @@ function CollectionViewBlock({
7127
7155
  return null;
7128
7156
  }
7129
7157
  const title = getTextContent4(collection.name).trim();
7130
- const showTitle = ((_d = block.format) == null ? void 0 : _d.hide_inline_collection_name) !== true;
7158
+ const showTitle = ((_c = block.format) == null ? void 0 : _c.hide_inline_collection_name) !== true;
7131
7159
  if (collection.icon) {
7132
7160
  block.format = {
7133
7161
  ...block.format,
@@ -7174,26 +7202,23 @@ function CollectionViewTabs({
7174
7202
  onChangeView
7175
7203
  }) {
7176
7204
  const { recordMap } = useNotionContext();
7177
- return /* @__PURE__ */ jsx60("div", { className: "notion-collection-view-tabs-row", children: viewIds.map((viewId) => {
7178
- var _a;
7179
- return /* @__PURE__ */ jsx60(
7180
- "button",
7181
- {
7182
- onClick: () => onChangeView(viewId),
7183
- className: cs(
7184
- "notion-collection-view-tabs-content-item",
7185
- collectionViewId === viewId && "notion-collection-view-tabs-content-item-active"
7186
- ),
7187
- children: /* @__PURE__ */ jsx60(
7188
- CollectionViewColumnDesc,
7189
- {
7190
- collectionView: (_a = recordMap.collection_view[viewId]) == null ? void 0 : _a.value
7191
- }
7192
- )
7193
- },
7194
- viewId
7195
- );
7196
- }) });
7205
+ return /* @__PURE__ */ jsx60("div", { className: "notion-collection-view-tabs-row", children: viewIds.map((viewId) => /* @__PURE__ */ jsx60(
7206
+ "button",
7207
+ {
7208
+ onClick: () => onChangeView(viewId),
7209
+ className: cs(
7210
+ "notion-collection-view-tabs-content-item",
7211
+ collectionViewId === viewId && "notion-collection-view-tabs-content-item-active"
7212
+ ),
7213
+ children: /* @__PURE__ */ jsx60(
7214
+ CollectionViewColumnDesc,
7215
+ {
7216
+ collectionView: getBlockValue9(recordMap.collection_view[viewId])
7217
+ }
7218
+ )
7219
+ },
7220
+ viewId
7221
+ )) });
7197
7222
  }
7198
7223
  function CollectionViewColumnDesc({
7199
7224
  collectionView,