@texonom/nreact 1.5.0 → 1.5.1
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/_commonjsHelpers-bAxELxBV.js +9 -0
- package/build/_commonjsHelpers-bAxELxBV.js.map +1 -0
- package/build/asset-wrapper-CmbIDPIw.js +921 -0
- package/build/asset-wrapper-CmbIDPIw.js.map +1 -0
- package/build/collection-column-title-l4hmVo49.js +99 -0
- package/build/collection-column-title-l4hmVo49.js.map +1 -0
- package/build/index.js +442 -1385
- package/build/index.js.map +1 -1
- package/build/third-party/code.js +199 -0
- package/build/third-party/code.js.map +1 -0
- package/build/third-party/collection.js +3355 -0
- package/build/third-party/collection.js.map +1 -0
- package/build/third-party/equation.js +44 -0
- package/build/third-party/equation.js.map +1 -0
- package/build/third-party/modal.js +5 -0
- package/build/third-party/modal.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,921 @@
|
|
|
1
|
+
var K = Object.defineProperty, ee = Object.defineProperties;
|
|
2
|
+
var te = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var B = Object.getOwnPropertySymbols;
|
|
4
|
+
var q = Object.prototype.hasOwnProperty, Z = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var j = (t, a, n) => a in t ? K(t, a, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[a] = n, E = (t, a) => {
|
|
6
|
+
for (var n in a || (a = {}))
|
|
7
|
+
q.call(a, n) && j(t, n, a[n]);
|
|
8
|
+
if (B)
|
|
9
|
+
for (var n of B(a))
|
|
10
|
+
Z.call(a, n) && j(t, n, a[n]);
|
|
11
|
+
return t;
|
|
12
|
+
}, P = (t, a) => ee(t, te(a));
|
|
13
|
+
var b = (t, a) => {
|
|
14
|
+
var n = {};
|
|
15
|
+
for (var o in t)
|
|
16
|
+
q.call(t, o) && a.indexOf(o) < 0 && (n[o] = t[o]);
|
|
17
|
+
if (t != null && B)
|
|
18
|
+
for (var o of B(t))
|
|
19
|
+
a.indexOf(o) < 0 && Z.call(t, o) && (n[o] = t[o]);
|
|
20
|
+
return n;
|
|
21
|
+
};
|
|
22
|
+
var O = (t, a, n) => new Promise((o, u) => {
|
|
23
|
+
var c = (s) => {
|
|
24
|
+
try {
|
|
25
|
+
l(n.next(s));
|
|
26
|
+
} catch (m) {
|
|
27
|
+
u(m);
|
|
28
|
+
}
|
|
29
|
+
}, r = (s) => {
|
|
30
|
+
try {
|
|
31
|
+
l(n.throw(s));
|
|
32
|
+
} catch (m) {
|
|
33
|
+
u(m);
|
|
34
|
+
}
|
|
35
|
+
}, l = (s) => s.done ? o(s.value) : Promise.resolve(s.value).then(c, r);
|
|
36
|
+
l((n = n.apply(t, a)).next());
|
|
37
|
+
});
|
|
38
|
+
import e from "react";
|
|
39
|
+
import { normalizeUrl as ne, getBlockIcon as ae, getBlockTitle as F, isUrl as re, formatNotionDateTime as oe, formatDate as T, parsePageId as R, getBlockParentPage as se, getPageBreadcrumbs as ie, defaultMapImageUrl as G, defaultMapPageUrl as Q, getTextContent as le } from "@texonom/nutils";
|
|
40
|
+
import { Img as ce } from "react-image";
|
|
41
|
+
import { useHotkeys as W } from "react-hotkeys-hook";
|
|
42
|
+
import me from "react-fast-compare";
|
|
43
|
+
function ue(t) {
|
|
44
|
+
return /* @__PURE__ */ e.createElement("svg", E({ viewBox: "0 0 14 14" }, t), /* @__PURE__ */ e.createElement("path", { d: "M5.5 12L14 3.5 12.5 2l-7 7-4-4.003L0 6.499z" }));
|
|
45
|
+
}
|
|
46
|
+
const pe = ({ isChecked: t }) => {
|
|
47
|
+
let a = null;
|
|
48
|
+
return t ? a = /* @__PURE__ */ e.createElement("div", { className: "notion-property-checkbox-checked" }, /* @__PURE__ */ e.createElement(ue, null)) : a = /* @__PURE__ */ e.createElement("div", { className: "notion-property-checkbox-unchecked" }), /* @__PURE__ */ e.createElement("span", { className: "notion-property notion-property-checkbox" }, a);
|
|
49
|
+
}, Y = (t) => {
|
|
50
|
+
const o = t, { className: a } = o, n = b(o, ["className"]);
|
|
51
|
+
return /* @__PURE__ */ e.createElement("svg", E({ className: `notion-icon ${a || ""}`, viewBox: "0 0 17 17" }, n), /* @__PURE__ */ e.createElement("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" }));
|
|
52
|
+
}, de = (t) => {
|
|
53
|
+
const o = t, { className: a } = o, n = b(o, ["className"]);
|
|
54
|
+
return /* @__PURE__ */ e.createElement("svg", P(E({ className: a }, n), { viewBox: "0 0 30 30", width: "16" }), /* @__PURE__ */ e.createElement("path", { d: "M16,1H4v28h22V11L16,1z M16,3.828L23.172,11H16V3.828z M24,27H6V3h8v10h10V27z M8,17h14v-2H8V17z M8,21h14v-2H8V21z M8,25h14v-2H8V25z" }));
|
|
55
|
+
}, fe = (t) => {
|
|
56
|
+
const a = [];
|
|
57
|
+
let n, o = -1;
|
|
58
|
+
return Object.keys(t).forEach((u) => {
|
|
59
|
+
var r, l;
|
|
60
|
+
const c = (r = t[u]) == null ? void 0 : r.value;
|
|
61
|
+
c && ((l = c.content) == null || l.forEach((s) => {
|
|
62
|
+
var p, i;
|
|
63
|
+
const m = (i = (p = t[s]) == null ? void 0 : p.value) == null ? void 0 : i.type;
|
|
64
|
+
m && m !== n && (o++, n = m, a[o] = []), o > -1 && a[o].push(s);
|
|
65
|
+
})), n = void 0;
|
|
66
|
+
}), a;
|
|
67
|
+
}, nt = (t, a) => {
|
|
68
|
+
const o = fe(a).find((u) => u.includes(t));
|
|
69
|
+
if (o)
|
|
70
|
+
return o.indexOf(t) + 1;
|
|
71
|
+
}, ge = (t) => t.includes("#") ? t.replace(/^.+(#.+)$/, "$1") : "", he = typeof window != "undefined", Ee = /* @__PURE__ */ new Set([
|
|
72
|
+
"youtu.be",
|
|
73
|
+
"youtube.com",
|
|
74
|
+
"www.youtube.com",
|
|
75
|
+
"youtube-nocookie.com",
|
|
76
|
+
"www.youtube-nocookie.com"
|
|
77
|
+
]), ye = (t) => {
|
|
78
|
+
try {
|
|
79
|
+
const { hostname: a } = new URL(t);
|
|
80
|
+
if (!Ee.has(a)) return null;
|
|
81
|
+
const n = /^.*(youtu\.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/i, o = t.match(n);
|
|
82
|
+
if (o && o[2].length == 11) return o[2];
|
|
83
|
+
} catch (a) {
|
|
84
|
+
}
|
|
85
|
+
return null;
|
|
86
|
+
}, V = (s) => {
|
|
87
|
+
var m = s, { src: t, alt: a, className: n, style: o, zoomable: u = !1, priority: c = !1, height: r } = m, l = b(m, ["src", "alt", "className", "style", "zoomable", "priority", "height"]);
|
|
88
|
+
var N, g, y;
|
|
89
|
+
const { recordMap: p, zoom: i, previewImages: f, forceCustomImages: v, components: h } = _(), d = e.useRef(i ? i.clone() : null), w = f ? (y = (N = p == null ? void 0 : p.preview_images) == null ? void 0 : N[t]) != null ? y : (g = p == null ? void 0 : p.preview_images) == null ? void 0 : g[ne(t)] : null, I = e.useCallback(
|
|
90
|
+
(C) => {
|
|
91
|
+
u && (C.target.src || C.target.srcset) && d.current && d.current.attach(C.target);
|
|
92
|
+
},
|
|
93
|
+
[d, u]
|
|
94
|
+
), k = e.useCallback(
|
|
95
|
+
(C) => {
|
|
96
|
+
d.current && C && d.current.attach(C);
|
|
97
|
+
},
|
|
98
|
+
[d]
|
|
99
|
+
), S = e.useMemo(() => u ? k : void 0, [u, k]);
|
|
100
|
+
return w && h.Image ? /* @__PURE__ */ e.createElement(
|
|
101
|
+
h.Image,
|
|
102
|
+
{
|
|
103
|
+
src: t,
|
|
104
|
+
alt: a,
|
|
105
|
+
style: o,
|
|
106
|
+
className: n,
|
|
107
|
+
width: w.originalWidth,
|
|
108
|
+
height: w.originalHeight,
|
|
109
|
+
blurDataURL: w.dataURIBase64,
|
|
110
|
+
placeholder: "blur",
|
|
111
|
+
priority: c,
|
|
112
|
+
onLoad: I
|
|
113
|
+
}
|
|
114
|
+
) : h.Image && v ? /* @__PURE__ */ e.createElement(
|
|
115
|
+
h.Image,
|
|
116
|
+
{
|
|
117
|
+
src: t,
|
|
118
|
+
alt: a,
|
|
119
|
+
className: n,
|
|
120
|
+
style: o,
|
|
121
|
+
width: null,
|
|
122
|
+
height: r || null,
|
|
123
|
+
priority: c,
|
|
124
|
+
onLoad: I
|
|
125
|
+
}
|
|
126
|
+
) : /* @__PURE__ */ e.createElement(
|
|
127
|
+
"img",
|
|
128
|
+
E({
|
|
129
|
+
className: n,
|
|
130
|
+
style: o,
|
|
131
|
+
src: t,
|
|
132
|
+
alt: a,
|
|
133
|
+
ref: S,
|
|
134
|
+
loading: "lazy",
|
|
135
|
+
decoding: "async"
|
|
136
|
+
}, l)
|
|
137
|
+
);
|
|
138
|
+
}, Ce = (t) => t.type === "page" || t.type === "callout" || t.type === "collection_view" || t.type === "collection_view_page", ve = ({ block: t, className: a, inline: n = !0, hideDefaultIcon: o = !1, defaultIcon: u }) => {
|
|
139
|
+
var p;
|
|
140
|
+
const { mapImageUrl: c, recordMap: r, darkMode: l } = _();
|
|
141
|
+
let s = !1, m = null;
|
|
142
|
+
if (Ce(t)) {
|
|
143
|
+
const i = ((p = ae(t, r)) == null ? void 0 : p.trim()) || u, f = F(t, r);
|
|
144
|
+
if (i && re(i)) {
|
|
145
|
+
const v = c(i, t);
|
|
146
|
+
s = !0, m = /* @__PURE__ */ e.createElement(V, { src: v, alt: f || "page icon", className: `${a || ""} notion-page-icon` });
|
|
147
|
+
} else if (i && i.startsWith("/icons/")) {
|
|
148
|
+
const v = "https://www.notion.so" + i + "?mode=" + (l ? "dark" : "light");
|
|
149
|
+
m = /* @__PURE__ */ e.createElement(V, { src: v, alt: f || "page icon", className: `${a || ""} notion-page-icon` });
|
|
150
|
+
} else i ? (s = !1, m = /* @__PURE__ */ e.createElement("span", { className: `${a || ""} notion-page-icon`, role: "img", "aria-label": i }, i)) : o || (s = !0, m = /* @__PURE__ */ e.createElement(de, { className: `${a || ""} notion-page-icon`, alt: f || "page icon" }));
|
|
151
|
+
}
|
|
152
|
+
return m ? /* @__PURE__ */ e.createElement(
|
|
153
|
+
"div",
|
|
154
|
+
{
|
|
155
|
+
className: `
|
|
156
|
+
${n ? "notion-page-icon-inline" : "notion-page-icon-hero"}
|
|
157
|
+
${s ? "notion-page-icon-image" : "notion-page-icon-span"}
|
|
158
|
+
`
|
|
159
|
+
},
|
|
160
|
+
m
|
|
161
|
+
) : null;
|
|
162
|
+
}, z = e.memo(ve), Ne = (t) => {
|
|
163
|
+
const o = t, { className: a } = o, n = b(o, ["className"]);
|
|
164
|
+
return /* @__PURE__ */ e.createElement("svg", P(E({ className: `notion-icon ${a || ""}` }, n), { viewBox: "0 0 30 30" }), /* @__PURE__ */ e.createElement("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" }));
|
|
165
|
+
}, we = (t) => {
|
|
166
|
+
const o = t, { className: a } = o, n = b(o, ["className"]);
|
|
167
|
+
return /* @__PURE__ */ e.createElement("svg", P(E({ className: `notion-icon ${a || ""}` }, n), { viewBox: "0 0 24 24" }), /* @__PURE__ */ e.createElement("defs", null, /* @__PURE__ */ e.createElement("linearGradient", { x1: "28.1542969%", y1: "63.7402344%", x2: "74.6289062%", y2: "17.7832031%", id: "linearGradient-1" }, /* @__PURE__ */ e.createElement("stop", { stopColor: "rgba(164, 164, 164, 1)", offset: "0%" }), /* @__PURE__ */ e.createElement("stop", { stopColor: "rgba(164, 164, 164, 0)", stopOpacity: "0", offset: "100%" }))), /* @__PURE__ */ e.createElement("g", { id: "Page-1", stroke: "none", strokeWidth: "1", fill: "none" }, /* @__PURE__ */ e.createElement("g", { transform: "translate(-236.000000, -286.000000)" }, /* @__PURE__ */ e.createElement("g", { transform: "translate(238.000000, 286.000000)" }, /* @__PURE__ */ e.createElement("circle", { id: "Oval-2", stroke: "url(#linearGradient-1)", strokeWidth: "4", cx: "10", cy: "12", r: "10" }), /* @__PURE__ */ e.createElement("path", { d: "M10,2 C4.4771525,2 0,6.4771525 0,12", id: "Oval-2", stroke: "rgba(164, 164, 164, 1)", strokeWidth: "4" }), /* @__PURE__ */ e.createElement("rect", { id: "Rectangle-1", fill: "rgba(164, 164, 164, 1)", x: "8", y: "0", width: "4", height: "4", rx: "8" })))));
|
|
168
|
+
};
|
|
169
|
+
function ke(t) {
|
|
170
|
+
return /* @__PURE__ */ e.createElement("svg", E({ viewBox: "0 0 260 260" }, t), /* @__PURE__ */ e.createElement("g", null, /* @__PURE__ */ e.createElement(
|
|
171
|
+
"path",
|
|
172
|
+
{
|
|
173
|
+
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",
|
|
174
|
+
fill: "#161614"
|
|
175
|
+
}
|
|
176
|
+
)));
|
|
177
|
+
}
|
|
178
|
+
const xe = ({ block: t, inline: a, className: n }) => {
|
|
179
|
+
var f, v, h;
|
|
180
|
+
const { components: o } = _(), { original_url: u, attributes: c, domain: r } = (t == null ? void 0 : t.format) || {};
|
|
181
|
+
if (!u || !c) return null;
|
|
182
|
+
const l = (f = c.find((d) => d.id === "title")) == null ? void 0 : f.values[0];
|
|
183
|
+
let s = (v = c.find((d) => d.id === "owner")) == null ? void 0 : v.values[0];
|
|
184
|
+
const m = (h = c.find((d) => d.id === "updated_at")) == null ? void 0 : h.values[0], p = m ? oe(m) : null;
|
|
185
|
+
let i;
|
|
186
|
+
switch (r) {
|
|
187
|
+
case "github.com":
|
|
188
|
+
if (i = /* @__PURE__ */ e.createElement(ke, null), s) {
|
|
189
|
+
const d = s.split("/");
|
|
190
|
+
s = d[d.length - 1];
|
|
191
|
+
}
|
|
192
|
+
break;
|
|
193
|
+
default:
|
|
194
|
+
return process.env.NODE_ENV !== "production" && console.debug(`Unsupported external_object_instance domain "${r}"`, JSON.stringify(t, null, 2)), null;
|
|
195
|
+
}
|
|
196
|
+
return /* @__PURE__ */ e.createElement(
|
|
197
|
+
o.Link,
|
|
198
|
+
{
|
|
199
|
+
target: "_blank",
|
|
200
|
+
rel: "noopener noreferrer",
|
|
201
|
+
href: u,
|
|
202
|
+
className: `notion-external ${a ? "notion-external-mention" : "notion-external-block notion-row"} ${n || ""}`
|
|
203
|
+
},
|
|
204
|
+
i && /* @__PURE__ */ e.createElement("div", { className: "notion-external-image" }, i),
|
|
205
|
+
/* @__PURE__ */ e.createElement("div", { className: "notion-external-description" }, /* @__PURE__ */ e.createElement("div", { className: "notion-external-title" }, l), (s || p) && /* @__PURE__ */ e.createElement("div", { className: "notion-external-subtitle" }, s && /* @__PURE__ */ e.createElement("span", null, s), s && p && /* @__PURE__ */ e.createElement("span", null, " • "), p && /* @__PURE__ */ e.createElement("span", null, "Updated ", p)))
|
|
206
|
+
);
|
|
207
|
+
}, A = (t) => he ? /* @__PURE__ */ e.createElement(ce, E({}, t)) : /* @__PURE__ */ e.createElement("img", E({}, t)), D = ({ value: t, block: a, linkProps: n, linkProtocol: o }) => {
|
|
208
|
+
const { components: u, recordMap: c, mapPageUrl: r, mapImageUrl: l, rootDomain: s } = _();
|
|
209
|
+
return /* @__PURE__ */ e.createElement(e.Fragment, null, t == null ? void 0 : t.map((m, p) => {
|
|
210
|
+
const [i, f] = m;
|
|
211
|
+
if (!f)
|
|
212
|
+
return i === "," ? /* @__PURE__ */ e.createElement("span", { key: p, style: { padding: "0.5em" } }) : /* @__PURE__ */ e.createElement(e.Fragment, { key: p }, i);
|
|
213
|
+
const v = f.reduce(
|
|
214
|
+
(h, d) => {
|
|
215
|
+
var w, I, k, S, N;
|
|
216
|
+
switch (d[0]) {
|
|
217
|
+
case "p": {
|
|
218
|
+
const g = d[1], y = (w = c.block[g]) == null ? void 0 : w.value;
|
|
219
|
+
return y ? /* @__PURE__ */ e.createElement(u.PageLink, { className: "notion-link", href: r(g) }, /* @__PURE__ */ e.createElement(U, { block: y })) : (console.debug('"p" missing block', g), null);
|
|
220
|
+
}
|
|
221
|
+
case "‣": {
|
|
222
|
+
const g = d[1][0], y = d[1][1];
|
|
223
|
+
switch (g) {
|
|
224
|
+
case "u": {
|
|
225
|
+
const C = (I = c.notion_user[y]) == null ? void 0 : I.value;
|
|
226
|
+
if (!C)
|
|
227
|
+
return console.debug('"‣" missing user', y), null;
|
|
228
|
+
const L = [C.given_name, C.family_name].filter(Boolean).join(" "), M = C.email;
|
|
229
|
+
return /* @__PURE__ */ e.createElement(u.Link, E({ className: "notion-link", href: `mailto:${M}` }, n), /* @__PURE__ */ e.createElement(
|
|
230
|
+
A,
|
|
231
|
+
{
|
|
232
|
+
className: "notion-user",
|
|
233
|
+
src: l(C.profile_photo, a),
|
|
234
|
+
alt: L,
|
|
235
|
+
style: { display: "inline", marginRight: "0.3em", marginBottom: "0.3em" }
|
|
236
|
+
}
|
|
237
|
+
), L);
|
|
238
|
+
}
|
|
239
|
+
default: {
|
|
240
|
+
const C = (k = c.block[y]) == null ? void 0 : k.value;
|
|
241
|
+
return C ? /* @__PURE__ */ e.createElement(
|
|
242
|
+
u.PageLink,
|
|
243
|
+
P(E({
|
|
244
|
+
className: "notion-link",
|
|
245
|
+
href: r(y)
|
|
246
|
+
}, n), {
|
|
247
|
+
target: "_blank",
|
|
248
|
+
rel: "noopener noreferrer"
|
|
249
|
+
}),
|
|
250
|
+
/* @__PURE__ */ e.createElement(U, { block: C })
|
|
251
|
+
) : (console.debug('"‣" missing block', g, y), null);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
case "h":
|
|
256
|
+
return /* @__PURE__ */ e.createElement("span", { className: `notion-${d[1]}` }, h);
|
|
257
|
+
case "c":
|
|
258
|
+
return /* @__PURE__ */ e.createElement("code", { className: "notion-inline-code" }, h);
|
|
259
|
+
case "b":
|
|
260
|
+
return /* @__PURE__ */ e.createElement("b", null, h);
|
|
261
|
+
case "i":
|
|
262
|
+
return /* @__PURE__ */ e.createElement("em", null, h);
|
|
263
|
+
case "s":
|
|
264
|
+
return /* @__PURE__ */ e.createElement("s", null, h);
|
|
265
|
+
case "_":
|
|
266
|
+
return /* @__PURE__ */ e.createElement("span", { className: "notion-inline-underscore" }, h);
|
|
267
|
+
case "e":
|
|
268
|
+
return /* @__PURE__ */ e.createElement(u.Equation, { math: d[1], inline: !0 });
|
|
269
|
+
case "m":
|
|
270
|
+
return h;
|
|
271
|
+
//still need to return the base element
|
|
272
|
+
case "a": {
|
|
273
|
+
const g = d[1], y = g.substring(1), C = R(y, { uuid: !0 });
|
|
274
|
+
if ((g[0] === "/" || g.includes(s)) && C) {
|
|
275
|
+
const L = g.includes(s) ? g : `${r(C)}${ge(g)}`;
|
|
276
|
+
return /* @__PURE__ */ e.createElement(u.PageLink, E({ className: "notion-link", href: L }, n), h);
|
|
277
|
+
} else
|
|
278
|
+
return /* @__PURE__ */ e.createElement(
|
|
279
|
+
u.Link,
|
|
280
|
+
E({
|
|
281
|
+
className: "notion-link",
|
|
282
|
+
href: o ? `${o}:${d[1]}` : d[1]
|
|
283
|
+
}, n),
|
|
284
|
+
h
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
// Date
|
|
288
|
+
case "d": {
|
|
289
|
+
const g = d[1], y = g == null ? void 0 : g.type;
|
|
290
|
+
if (y === "date") {
|
|
291
|
+
const C = g.start_date;
|
|
292
|
+
return T(C);
|
|
293
|
+
} else if (y === "daterange") {
|
|
294
|
+
const C = g.start_date, L = g.end_date;
|
|
295
|
+
return `${T(C)} → ${T(L)}`;
|
|
296
|
+
} else
|
|
297
|
+
return h;
|
|
298
|
+
}
|
|
299
|
+
// User
|
|
300
|
+
case "u": {
|
|
301
|
+
const g = d[1], y = (S = c.notion_user[g]) == null ? void 0 : S.value;
|
|
302
|
+
if (!y)
|
|
303
|
+
return console.debug("missing user", g), null;
|
|
304
|
+
const C = y.name, L = y.email;
|
|
305
|
+
return /* @__PURE__ */ e.createElement(u.Link, E({ className: "notion-link", href: `mailto:${L}` }, n), /* @__PURE__ */ e.createElement(
|
|
306
|
+
A,
|
|
307
|
+
{
|
|
308
|
+
className: "notion-user",
|
|
309
|
+
src: l(y.profile_photo, a),
|
|
310
|
+
alt: C,
|
|
311
|
+
style: { display: "inline", marginRight: "0.3em", marginBottom: "0.3em" }
|
|
312
|
+
}
|
|
313
|
+
), C);
|
|
314
|
+
}
|
|
315
|
+
case "eoi": {
|
|
316
|
+
const g = d[1], y = (N = c.block[g]) == null ? void 0 : N.value;
|
|
317
|
+
return /* @__PURE__ */ e.createElement(xe, { block: y, inline: !0 });
|
|
318
|
+
}
|
|
319
|
+
default:
|
|
320
|
+
return process.env.NODE_ENV !== "production" && console.debug("unsupported text format", d), h;
|
|
321
|
+
}
|
|
322
|
+
},
|
|
323
|
+
/* @__PURE__ */ e.createElement(e.Fragment, null, i)
|
|
324
|
+
);
|
|
325
|
+
return /* @__PURE__ */ e.createElement(e.Fragment, { key: p }, v);
|
|
326
|
+
}));
|
|
327
|
+
}, Ie = (u) => {
|
|
328
|
+
var c = u, { block: t, className: a, defaultIcon: n } = c, o = b(c, ["block", "className", "defaultIcon"]);
|
|
329
|
+
var l, s;
|
|
330
|
+
const { recordMap: r } = _();
|
|
331
|
+
if (!t) return null;
|
|
332
|
+
if (t.type === "collection_view_page" || t.type === "collection_view") {
|
|
333
|
+
const m = F(t, r);
|
|
334
|
+
if (!m) return null;
|
|
335
|
+
const p = [[m]];
|
|
336
|
+
return /* @__PURE__ */ e.createElement("span", E({ className: `notion-page-title ${a || ""}` }, o), /* @__PURE__ */ e.createElement(z, { block: t, defaultIcon: n, className: "notion-page-title-icon" }), /* @__PURE__ */ e.createElement("span", { className: "notion-page-title-text" }, /* @__PURE__ */ e.createElement(D, { value: p, block: t })));
|
|
337
|
+
}
|
|
338
|
+
return (l = t.properties) != null && l.title ? /* @__PURE__ */ e.createElement("span", E({ className: `notion-page-title ${a || ""}` }, o), /* @__PURE__ */ e.createElement(z, { block: t, defaultIcon: n, className: "notion-page-title-icon" }), /* @__PURE__ */ e.createElement("span", { className: "notion-page-title-text" }, /* @__PURE__ */ e.createElement(D, { value: (s = t.properties) == null ? void 0 : s.title, block: t }))) : null;
|
|
339
|
+
}, U = e.memo(Ie), Le = (t, a) => {
|
|
340
|
+
let n;
|
|
341
|
+
return (...o) => {
|
|
342
|
+
n && clearTimeout(n), n = setTimeout(() => t(...o), a);
|
|
343
|
+
};
|
|
344
|
+
};
|
|
345
|
+
class be extends e.Component {
|
|
346
|
+
constructor(a) {
|
|
347
|
+
super(a), this.state = {
|
|
348
|
+
isLoading: !1,
|
|
349
|
+
query: "",
|
|
350
|
+
searchResult: null,
|
|
351
|
+
searchError: null
|
|
352
|
+
}, this._onAfterOpen = () => {
|
|
353
|
+
this._inputRef.current && this._inputRef.current.focus();
|
|
354
|
+
}, this._onChangeQuery = (n) => {
|
|
355
|
+
const o = n.target.value;
|
|
356
|
+
if (this.setState({ query: o }), o.trim())
|
|
357
|
+
this._search();
|
|
358
|
+
else {
|
|
359
|
+
this.setState({ isLoading: !1, searchResult: null, searchError: null });
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
}, this._onClearQuery = () => {
|
|
363
|
+
this._onChangeQuery({ target: { value: "" } });
|
|
364
|
+
}, this._warmupSearch = () => O(this, null, function* () {
|
|
365
|
+
const { searchNotion: n, rootBlockId: o, rootSpaceId: u } = this.props;
|
|
366
|
+
yield n({
|
|
367
|
+
query: "",
|
|
368
|
+
spaceId: u,
|
|
369
|
+
filters: {
|
|
370
|
+
ancestors: [o],
|
|
371
|
+
isDeletedOnly: !1,
|
|
372
|
+
excludeTemplates: !0,
|
|
373
|
+
navigableBlockContentOnly: !0,
|
|
374
|
+
requireEditPermissions: !1
|
|
375
|
+
}
|
|
376
|
+
});
|
|
377
|
+
}), this._searchImpl = () => O(this, null, function* () {
|
|
378
|
+
const { searchNotion: n, rootBlockId: o, rootSpaceId: u } = this.props, { query: c } = this.state;
|
|
379
|
+
if (!c.trim()) {
|
|
380
|
+
this.setState({ isLoading: !1, searchResult: null, searchError: null });
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
this.setState({ isLoading: !0 });
|
|
384
|
+
const r = yield n({
|
|
385
|
+
query: c,
|
|
386
|
+
spaceId: u,
|
|
387
|
+
filters: {
|
|
388
|
+
ancestors: [o],
|
|
389
|
+
isDeletedOnly: !1,
|
|
390
|
+
excludeTemplates: !0,
|
|
391
|
+
navigableBlockContentOnly: !0,
|
|
392
|
+
requireEditPermissions: !1
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
console.debug("search", c, r);
|
|
396
|
+
let l = null, s = null;
|
|
397
|
+
if (r.error || r.errorId)
|
|
398
|
+
s = r;
|
|
399
|
+
else {
|
|
400
|
+
l = E({}, r);
|
|
401
|
+
const p = l.results.map((i) => {
|
|
402
|
+
var h, d;
|
|
403
|
+
const f = (h = l.recordMap.block[i.id]) == null ? void 0 : h.value;
|
|
404
|
+
if (!f) return;
|
|
405
|
+
const v = F(f, l.recordMap);
|
|
406
|
+
if (v && (i.title = v, i.block = f, i.recordMap = l.recordMap, i.page = se(f, l.recordMap, {
|
|
407
|
+
inclusive: !0
|
|
408
|
+
}) || f, !!i.page.id))
|
|
409
|
+
return (d = i.highlight) != null && d.text && (i.highlight.html = i.highlight.text.replace(/<gzkNfoUU>/gi, "<b>").replace(/<\/gzkNfoUU>/gi, "</b>")), i;
|
|
410
|
+
}).filter(Boolean).reduce(
|
|
411
|
+
(i, f) => P(E({}, i), {
|
|
412
|
+
[f.page.id]: f
|
|
413
|
+
}),
|
|
414
|
+
{}
|
|
415
|
+
);
|
|
416
|
+
l.results = Object.values(p);
|
|
417
|
+
}
|
|
418
|
+
this.state.query === c && this.setState({ isLoading: !1, searchResult: l, searchError: s });
|
|
419
|
+
}), this._inputRef = e.createRef();
|
|
420
|
+
}
|
|
421
|
+
componentDidMount() {
|
|
422
|
+
this._search = Le(this._searchImpl.bind(this), 500), this._warmupSearch();
|
|
423
|
+
}
|
|
424
|
+
render() {
|
|
425
|
+
const { isOpen: a, onClose: n } = this.props, { isLoading: o, query: u, searchResult: c, searchError: r } = this.state, l = !!u.trim();
|
|
426
|
+
return /* @__PURE__ */ e.createElement(Ue, null, (s) => {
|
|
427
|
+
const { components: m, defaultPageIcon: p, mapPageUrl: i } = s;
|
|
428
|
+
return /* @__PURE__ */ e.createElement(
|
|
429
|
+
m.Modal,
|
|
430
|
+
{
|
|
431
|
+
isOpen: a,
|
|
432
|
+
contentLabel: "Search",
|
|
433
|
+
className: "notion-search",
|
|
434
|
+
overlayClassName: "notion-search-overlay",
|
|
435
|
+
onRequestClose: n,
|
|
436
|
+
onAfterOpen: this._onAfterOpen
|
|
437
|
+
},
|
|
438
|
+
/* @__PURE__ */ e.createElement("div", { className: "quickFindMenu" }, /* @__PURE__ */ e.createElement("div", { className: "searchBar" }, /* @__PURE__ */ e.createElement("div", { className: "inlineIcon" }, o ? /* @__PURE__ */ e.createElement(we, { className: "loadingIcon" }) : /* @__PURE__ */ e.createElement(Y, null)), /* @__PURE__ */ e.createElement(
|
|
439
|
+
"input",
|
|
440
|
+
{
|
|
441
|
+
className: "searchInput",
|
|
442
|
+
placeholder: "Search",
|
|
443
|
+
value: u,
|
|
444
|
+
ref: this._inputRef,
|
|
445
|
+
onInput: this._onChangeQuery
|
|
446
|
+
}
|
|
447
|
+
), u && /* @__PURE__ */ e.createElement("div", { role: "button", className: "clearButton", onClick: this._onClearQuery }, /* @__PURE__ */ e.createElement(Ne, { className: "clearIcon" }))), l && c && /* @__PURE__ */ e.createElement(e.Fragment, null, c.results.length ? /* @__PURE__ */ e.createElement(De, P(E({}, s), { recordMap: c.recordMap }), /* @__PURE__ */ e.createElement("div", { className: "resultsPane" }, c.results.map((f) => {
|
|
448
|
+
var v;
|
|
449
|
+
return /* @__PURE__ */ e.createElement(
|
|
450
|
+
m.PageLink,
|
|
451
|
+
{
|
|
452
|
+
key: f.id,
|
|
453
|
+
className: "result notion-page-link",
|
|
454
|
+
href: i(f.page.id, c.recordMap)
|
|
455
|
+
},
|
|
456
|
+
/* @__PURE__ */ e.createElement(U, { block: f.page, defaultIcon: p }),
|
|
457
|
+
((v = f.highlight) == null ? void 0 : v.html) && /* @__PURE__ */ e.createElement(
|
|
458
|
+
"div",
|
|
459
|
+
{
|
|
460
|
+
className: "notion-search-result-highlight",
|
|
461
|
+
dangerouslySetInnerHTML: {
|
|
462
|
+
__html: f.highlight.html
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
)
|
|
466
|
+
);
|
|
467
|
+
})), /* @__PURE__ */ e.createElement("footer", { className: "resultsFooter" }, /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement("span", { className: "resultsCount" }, c.total), c.total === 1 ? " result" : " results"))) : /* @__PURE__ */ e.createElement("div", { className: "noResultsPane" }, /* @__PURE__ */ e.createElement("div", { className: "noResults" }, "No results"), /* @__PURE__ */ e.createElement("div", { className: "noResultsDetail" }, "Try different search terms"))), l && !c && r && /* @__PURE__ */ e.createElement("div", { className: "noResultsPane" }, /* @__PURE__ */ e.createElement("div", { className: "noResults" }, "Search error")))
|
|
468
|
+
);
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
const _e = ({ block: t }) => /* @__PURE__ */ e.createElement("header", { className: "notion-header" }, /* @__PURE__ */ e.createElement("div", { className: "notion-nav-header" }, /* @__PURE__ */ e.createElement(Se, { block: t }), /* @__PURE__ */ e.createElement(Pe, { block: t }))), Se = ({ block: t, rootOnly: a = !1 }) => {
|
|
473
|
+
const { recordMap: n, mapPageUrl: o, components: u } = _(), c = e.useMemo(() => {
|
|
474
|
+
const r = ie(n, t.id);
|
|
475
|
+
return a ? [r[0]].filter(Boolean) : r;
|
|
476
|
+
}, [n, t.id, a]);
|
|
477
|
+
return /* @__PURE__ */ e.createElement("div", { className: "breadcrumbs", key: "breadcrumbs" }, c.map((r, l) => {
|
|
478
|
+
if (!r) return null;
|
|
479
|
+
const s = {}, m = {
|
|
480
|
+
pageLink: u.PageLink
|
|
481
|
+
};
|
|
482
|
+
return r.active ? m.pageLink = (p) => /* @__PURE__ */ e.createElement("div", E({}, p)) : s.href = o(r.pageId), /* @__PURE__ */ e.createElement(e.Fragment, { key: r.pageId }, /* @__PURE__ */ e.createElement(m.pageLink, E({ className: `breadcrumb ${r.active && "active"}` }, s), r.icon && /* @__PURE__ */ e.createElement(z, { className: "icon", block: r.block }), r.title && /* @__PURE__ */ e.createElement("span", { className: "title" }, r.title)), l < c.length - 1 && /* @__PURE__ */ e.createElement("span", { className: "spacer" }, "/"));
|
|
483
|
+
}));
|
|
484
|
+
}, Pe = ({ block: t, search: a, title: n = "Search" }) => {
|
|
485
|
+
const { searchNotion: o, rootPageId: u, isShowingSearch: c, onHideSearch: r, rootSpaceId: l } = _(), s = a || o, [m, p] = e.useState(c);
|
|
486
|
+
e.useEffect(() => {
|
|
487
|
+
p(c);
|
|
488
|
+
}, [c]);
|
|
489
|
+
const i = e.useCallback(() => {
|
|
490
|
+
p(!0);
|
|
491
|
+
}, []), f = e.useCallback(() => {
|
|
492
|
+
p(!1), r && r();
|
|
493
|
+
}, [r]);
|
|
494
|
+
W("cmd+p", (h) => {
|
|
495
|
+
i(), h.preventDefault(), h.stopPropagation();
|
|
496
|
+
}), W("cmd+k", (h) => {
|
|
497
|
+
i(), h.preventDefault(), h.stopPropagation();
|
|
498
|
+
});
|
|
499
|
+
const v = !!s;
|
|
500
|
+
return /* @__PURE__ */ e.createElement(e.Fragment, null, v && /* @__PURE__ */ e.createElement("div", { role: "button", className: "breadcrumb button notion-search-button", onClick: i }, /* @__PURE__ */ e.createElement(Y, { className: "searchIcon" }), n && /* @__PURE__ */ e.createElement("span", { className: "title" }, n)), m && v && /* @__PURE__ */ e.createElement(
|
|
501
|
+
be,
|
|
502
|
+
{
|
|
503
|
+
isOpen: m,
|
|
504
|
+
rootBlockId: u || (t == null ? void 0 : t.id),
|
|
505
|
+
rootSpaceId: l,
|
|
506
|
+
onClose: f,
|
|
507
|
+
searchNotion: s
|
|
508
|
+
}
|
|
509
|
+
));
|
|
510
|
+
}, Me = (t) => e.memo(function(p) {
|
|
511
|
+
var i = p, {
|
|
512
|
+
src: n,
|
|
513
|
+
alt: o,
|
|
514
|
+
width: u,
|
|
515
|
+
height: c,
|
|
516
|
+
className: r,
|
|
517
|
+
style: l,
|
|
518
|
+
layout: s
|
|
519
|
+
} = i, m = b(i, [
|
|
520
|
+
"src",
|
|
521
|
+
"alt",
|
|
522
|
+
"width",
|
|
523
|
+
"height",
|
|
524
|
+
"className",
|
|
525
|
+
"style",
|
|
526
|
+
"layout"
|
|
527
|
+
]);
|
|
528
|
+
return s || (s = u && c ? "intrinsic" : "fill"), /* @__PURE__ */ e.createElement(
|
|
529
|
+
t,
|
|
530
|
+
E({
|
|
531
|
+
className: r,
|
|
532
|
+
src: n,
|
|
533
|
+
alt: o,
|
|
534
|
+
width: s === "intrinsic" && u,
|
|
535
|
+
height: s === "intrinsic" && c,
|
|
536
|
+
objectFit: l == null ? void 0 : l.objectFit,
|
|
537
|
+
objectPosition: l == null ? void 0 : l.objectPosition,
|
|
538
|
+
layout: s
|
|
539
|
+
}, m)
|
|
540
|
+
);
|
|
541
|
+
}, me), $e = (t) => function(v) {
|
|
542
|
+
var h = v, {
|
|
543
|
+
href: n,
|
|
544
|
+
as: o,
|
|
545
|
+
passHref: u,
|
|
546
|
+
prefetch: c,
|
|
547
|
+
replace: r,
|
|
548
|
+
scroll: l,
|
|
549
|
+
shallow: s,
|
|
550
|
+
locale: m,
|
|
551
|
+
className: p,
|
|
552
|
+
style: i
|
|
553
|
+
} = h, f = b(h, [
|
|
554
|
+
"href",
|
|
555
|
+
"as",
|
|
556
|
+
"passHref",
|
|
557
|
+
"prefetch",
|
|
558
|
+
"replace",
|
|
559
|
+
"scroll",
|
|
560
|
+
"shallow",
|
|
561
|
+
"locale",
|
|
562
|
+
"className",
|
|
563
|
+
"style"
|
|
564
|
+
]);
|
|
565
|
+
return /* @__PURE__ */ e.createElement(
|
|
566
|
+
t,
|
|
567
|
+
E({
|
|
568
|
+
href: n,
|
|
569
|
+
as: o,
|
|
570
|
+
prefetch: c,
|
|
571
|
+
replace: r,
|
|
572
|
+
scroll: l,
|
|
573
|
+
shallow: s,
|
|
574
|
+
locale: m,
|
|
575
|
+
className: p,
|
|
576
|
+
style: i
|
|
577
|
+
}, f)
|
|
578
|
+
);
|
|
579
|
+
}, Be = (t) => /* @__PURE__ */ e.createElement("a", E({ target: "_blank", rel: "noopener noreferrer" }, t)), Re = e.memo(Be), Oe = (n) => {
|
|
580
|
+
var o = n, { href: t } = o, a = b(o, ["href"]);
|
|
581
|
+
var l, s;
|
|
582
|
+
const { recordMap: u, rootSpaceId: c } = _();
|
|
583
|
+
let r = t;
|
|
584
|
+
if (typeof t == "string" && c) {
|
|
585
|
+
const m = R(t);
|
|
586
|
+
if (m) {
|
|
587
|
+
const p = (s = (l = u == null ? void 0 : u.block) == null ? void 0 : l[m]) == null ? void 0 : s.value;
|
|
588
|
+
(!p || p.space_id !== c) && (r = `https://notion.so/${m.replace(/-/g, "")}`);
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
return /* @__PURE__ */ e.createElement("a", E({ href: r }, a));
|
|
592
|
+
}, Te = e.memo(Oe), Ve = (t) => /* @__PURE__ */ e.createElement(Ae, E({}, t)), ze = _e, at = (c) => {
|
|
593
|
+
var r = c, { href: t, rel: a, target: n, title: o } = r, u = b(r, ["href", "rel", "target", "title"]);
|
|
594
|
+
return /* @__PURE__ */ e.createElement("span", E({}, u));
|
|
595
|
+
}, $ = (t) => () => (console.warn(`Warning: using empty component "${t}" (you should override this in NotionRenderer.components)`), null), x = (t, a) => a(), X = {
|
|
596
|
+
Image: null,
|
|
597
|
+
// disable custom images by default
|
|
598
|
+
Link: Re,
|
|
599
|
+
PageLink: Te,
|
|
600
|
+
Checkbox: pe,
|
|
601
|
+
Callout: void 0,
|
|
602
|
+
// use the built-in callout rendering by default
|
|
603
|
+
Code: $("Code"),
|
|
604
|
+
Equation: $("Equation"),
|
|
605
|
+
Collection: $("Collection"),
|
|
606
|
+
Property: void 0,
|
|
607
|
+
// use the built-in property rendering by default
|
|
608
|
+
propertyTextValue: x,
|
|
609
|
+
propertySelectValue: x,
|
|
610
|
+
propertyRelationValue: x,
|
|
611
|
+
propertyFormulaValue: x,
|
|
612
|
+
propertyTitleValue: x,
|
|
613
|
+
propertyPersonValue: x,
|
|
614
|
+
propertyFileValue: x,
|
|
615
|
+
propertyCheckboxValue: x,
|
|
616
|
+
propertyUrlValue: x,
|
|
617
|
+
propertyEmailValue: x,
|
|
618
|
+
propertyPhoneNumberValue: x,
|
|
619
|
+
propertyNumberValue: x,
|
|
620
|
+
propertyLastEditedTimeValue: x,
|
|
621
|
+
propertyCreatedTimeValue: x,
|
|
622
|
+
propertyDateValue: x,
|
|
623
|
+
Pdf: $("Pdf"),
|
|
624
|
+
Tweet: $("Tweet"),
|
|
625
|
+
Modal: $("Modal"),
|
|
626
|
+
Header: ze,
|
|
627
|
+
Embed: Ve
|
|
628
|
+
}, J = {
|
|
629
|
+
recordMap: {
|
|
630
|
+
block: {},
|
|
631
|
+
collection: {},
|
|
632
|
+
collection_view: {},
|
|
633
|
+
collection_query: {},
|
|
634
|
+
notion_user: {},
|
|
635
|
+
signed_urls: {}
|
|
636
|
+
},
|
|
637
|
+
components: X,
|
|
638
|
+
mapPageUrl: Q(),
|
|
639
|
+
mapImageUrl: G,
|
|
640
|
+
searchNotion: null,
|
|
641
|
+
isShowingSearch: !1,
|
|
642
|
+
onHideSearch: null,
|
|
643
|
+
fullPage: !1,
|
|
644
|
+
darkMode: !1,
|
|
645
|
+
previewImages: !1,
|
|
646
|
+
forceCustomImages: !1,
|
|
647
|
+
showCollectionViewDropdown: !0,
|
|
648
|
+
linkTableTitleProperties: !0,
|
|
649
|
+
isLinkCollectionToUrlProperty: !1,
|
|
650
|
+
showTableOfContents: !1,
|
|
651
|
+
minTableOfContentsItems: 3,
|
|
652
|
+
defaultPageIcon: null,
|
|
653
|
+
defaultPageCover: null,
|
|
654
|
+
defaultPageCoverPosition: 0.5,
|
|
655
|
+
zoom: null
|
|
656
|
+
}, H = e.createContext(J), De = (l) => {
|
|
657
|
+
var s = l, {
|
|
658
|
+
components: t = {},
|
|
659
|
+
children: a,
|
|
660
|
+
mapPageUrl: n,
|
|
661
|
+
mapImageUrl: o,
|
|
662
|
+
rootPageId: u,
|
|
663
|
+
rootSpaceId: c
|
|
664
|
+
} = s, r = b(s, [
|
|
665
|
+
"components",
|
|
666
|
+
"children",
|
|
667
|
+
"mapPageUrl",
|
|
668
|
+
"mapImageUrl",
|
|
669
|
+
"rootPageId",
|
|
670
|
+
"rootSpaceId"
|
|
671
|
+
]);
|
|
672
|
+
for (const i of Object.keys(r)) r[i] === void 0 && delete r[i];
|
|
673
|
+
const m = e.useMemo(() => {
|
|
674
|
+
const i = E({}, t);
|
|
675
|
+
if (i.nextImage && (i.Image = Me(i.nextImage)), i.nextLink) {
|
|
676
|
+
const f = $e(i.nextLink);
|
|
677
|
+
i.nextLink = f, i.PageLink || (i.PageLink = f), i.Link || (i.Link = f);
|
|
678
|
+
}
|
|
679
|
+
for (const f of Object.keys(i)) i[f] || delete i[f];
|
|
680
|
+
return i;
|
|
681
|
+
}, [t]), p = e.useMemo(
|
|
682
|
+
() => P(E(E({}, J), r), {
|
|
683
|
+
rootPageId: u,
|
|
684
|
+
rootSpaceId: c,
|
|
685
|
+
mapPageUrl: n != null ? n : Q(u),
|
|
686
|
+
mapImageUrl: o != null ? o : G,
|
|
687
|
+
components: E(E({}, X), m)
|
|
688
|
+
}),
|
|
689
|
+
[o, n, m, u, c, r]
|
|
690
|
+
);
|
|
691
|
+
return /* @__PURE__ */ e.createElement(H.Provider, { value: p }, a);
|
|
692
|
+
}, Ue = H.Consumer, _ = () => e.useContext(H), Fe = (t) => Object.keys(t).map((a) => `${encodeURIComponent(a)}=${encodeURIComponent(t[a])}`).join("&"), He = ({
|
|
693
|
+
id: t,
|
|
694
|
+
defaultPlay: a = !1,
|
|
695
|
+
mute: n = !1,
|
|
696
|
+
lazyImage: o = !1,
|
|
697
|
+
iframeTitle: u = "YouTube video",
|
|
698
|
+
alt: c = "Video preview",
|
|
699
|
+
params: r = {},
|
|
700
|
+
adLinksPreconnect: l = !0,
|
|
701
|
+
style: s,
|
|
702
|
+
className: m
|
|
703
|
+
}) => {
|
|
704
|
+
const p = n || a ? "1" : "0", i = e.useMemo(() => Fe(E({ autoplay: "1", mute: p }, r)), [p, r]), v = `https://i.ytimg.com/vi/${t}/hqdefault.jpg`, h = "https://www.youtube-nocookie.com", d = `${h}/embed/${t}?${i}`, [w, I] = e.useState(!1), [k, S] = e.useState(a), [N, g] = e.useState(!1), y = e.useCallback(() => {
|
|
705
|
+
w || I(!0);
|
|
706
|
+
}, [w]), C = e.useCallback(() => {
|
|
707
|
+
k || S(!0);
|
|
708
|
+
}, [k]), L = e.useCallback(() => {
|
|
709
|
+
g(!0);
|
|
710
|
+
}, []);
|
|
711
|
+
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("link", { rel: "preload", href: v, as: "image" }), w && /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("link", { rel: "preconnect", href: h }), /* @__PURE__ */ e.createElement("link", { rel: "preconnect", href: "https://www.google.com" })), w && l && /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("link", { rel: "preconnect", href: "https://static.doubleclick.net" }), /* @__PURE__ */ e.createElement("link", { rel: "preconnect", href: "https://googleads.g.doubleclick.net" })), /* @__PURE__ */ e.createElement(
|
|
712
|
+
"div",
|
|
713
|
+
{
|
|
714
|
+
onClick: C,
|
|
715
|
+
onPointerOver: y,
|
|
716
|
+
className: `notion-yt-lite
|
|
717
|
+
${N && "notion-yt-loaded"}
|
|
718
|
+
${k && "notion-yt-initialized"}
|
|
719
|
+
${m || ""}`,
|
|
720
|
+
style: s
|
|
721
|
+
},
|
|
722
|
+
/* @__PURE__ */ e.createElement("img", { src: v, className: "notion-yt-thumbnail", loading: o ? "lazy" : void 0, alt: c }),
|
|
723
|
+
/* @__PURE__ */ e.createElement("div", { className: "notion-yt-playbtn" }),
|
|
724
|
+
k && /* @__PURE__ */ e.createElement(
|
|
725
|
+
"iframe",
|
|
726
|
+
{
|
|
727
|
+
width: "560",
|
|
728
|
+
height: "315",
|
|
729
|
+
frameBorder: "0",
|
|
730
|
+
allow: "accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",
|
|
731
|
+
allowFullScreen: !0,
|
|
732
|
+
title: u,
|
|
733
|
+
src: d,
|
|
734
|
+
onLoad: L
|
|
735
|
+
}
|
|
736
|
+
)
|
|
737
|
+
));
|
|
738
|
+
}, je = typeof window == "undefined", qe = [
|
|
739
|
+
"video",
|
|
740
|
+
"image",
|
|
741
|
+
"embed",
|
|
742
|
+
"figma",
|
|
743
|
+
"typeform",
|
|
744
|
+
"excalidraw",
|
|
745
|
+
"maps",
|
|
746
|
+
"tweet",
|
|
747
|
+
"pdf",
|
|
748
|
+
"gist",
|
|
749
|
+
"codepen",
|
|
750
|
+
"drive"
|
|
751
|
+
], Ze = ({ block: t, zoomable: a = !0, children: n }) => {
|
|
752
|
+
var p, i, f, v, h, d, w, I, k, S;
|
|
753
|
+
const { recordMap: o, mapImageUrl: u, components: c } = _();
|
|
754
|
+
if (!t || !qe.includes(t.type)) return null;
|
|
755
|
+
const r = {
|
|
756
|
+
position: "relative",
|
|
757
|
+
display: "flex",
|
|
758
|
+
justifyContent: "center",
|
|
759
|
+
alignSelf: "center",
|
|
760
|
+
width: "100%",
|
|
761
|
+
maxWidth: "100%",
|
|
762
|
+
flexDirection: "column"
|
|
763
|
+
}, l = {};
|
|
764
|
+
if (t.format) {
|
|
765
|
+
const { block_aspect_ratio: N, block_height: g, block_width: y, block_full_width: C, block_page_width: L, block_preserve_scale: M } = t.format;
|
|
766
|
+
if (C || L)
|
|
767
|
+
C ? r.width = "100vw" : r.width = "100%", t.type === "video" ? g ? r.height = g : N ? r.paddingBottom = `${N * 100}%` : M && (r.objectFit = "contain") : N && t.type !== "image" ? r.paddingBottom = `${N * 100}%` : g ? r.height = g : M && (t.type === "image" ? r.height = "100%" : (r.paddingBottom = "75%", r.minHeight = 100));
|
|
768
|
+
else {
|
|
769
|
+
switch ((p = t.format) == null ? void 0 : p.block_alignment) {
|
|
770
|
+
case "center": {
|
|
771
|
+
r.alignSelf = "center";
|
|
772
|
+
break;
|
|
773
|
+
}
|
|
774
|
+
case "left": {
|
|
775
|
+
r.alignSelf = "start";
|
|
776
|
+
break;
|
|
777
|
+
}
|
|
778
|
+
case "right": {
|
|
779
|
+
r.alignSelf = "end";
|
|
780
|
+
break;
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
y && (r.width = y), M && t.type !== "image" ? (r.paddingBottom = "50%", r.minHeight = 100) : g && t.type !== "image" && (r.height = g);
|
|
784
|
+
}
|
|
785
|
+
t.type === "image" ? l.objectFit = "cover" : M && (l.objectFit = "contain");
|
|
786
|
+
}
|
|
787
|
+
let s = ((i = o.signed_urls) == null ? void 0 : i[t.id]) || ((h = (v = (f = t.properties) == null ? void 0 : f.source) == null ? void 0 : v[0]) == null ? void 0 : h[0]), m = null;
|
|
788
|
+
if (!s) return null;
|
|
789
|
+
if (t.type === "tweet") {
|
|
790
|
+
const N = s;
|
|
791
|
+
if (!N) return null;
|
|
792
|
+
const g = N.split("?")[0].split("/").pop();
|
|
793
|
+
if (!g) return null;
|
|
794
|
+
m = /* @__PURE__ */ e.createElement(
|
|
795
|
+
"div",
|
|
796
|
+
{
|
|
797
|
+
style: P(E({}, l), {
|
|
798
|
+
maxWidth: 420,
|
|
799
|
+
width: "100%",
|
|
800
|
+
marginLeft: "auto",
|
|
801
|
+
marginRight: "auto"
|
|
802
|
+
})
|
|
803
|
+
},
|
|
804
|
+
/* @__PURE__ */ e.createElement(c.Tweet, { id: g })
|
|
805
|
+
);
|
|
806
|
+
} else if (t.type === "pdf")
|
|
807
|
+
r.overflow = "auto", r.background = "rgb(226, 226, 226)", r.display = "block", r.padding || (r.padding = "8px 16px"), je || (m = /* @__PURE__ */ e.createElement(c.Pdf, { file: s }));
|
|
808
|
+
else if (t.type === "embed" || t.type === "video" || t.type === "figma" || t.type === "typeform" || t.type === "gist" || t.type === "maps" || t.type === "excalidraw" || t.type === "codepen" || t.type === "drive")
|
|
809
|
+
if (t.type === "video" && s && s.indexOf("youtube") < 0 && s.indexOf("youtu.be") < 0 && s.indexOf("vimeo") < 0 && s.indexOf("wistia") < 0 && s.indexOf("loom") < 0 && s.indexOf("videoask") < 0 && s.indexOf("getcloudapp") < 0)
|
|
810
|
+
r.paddingBottom = void 0, m = /* @__PURE__ */ e.createElement("video", { playsInline: !0, controls: !0, preload: "metadata", style: l, src: s, title: t.type });
|
|
811
|
+
else {
|
|
812
|
+
let N = ((d = t.format) == null ? void 0 : d.display_source) || s;
|
|
813
|
+
if (N) {
|
|
814
|
+
const g = t.type === "video" ? ye(N) : null;
|
|
815
|
+
g ? m = /* @__PURE__ */ e.createElement(He, { id: g, style: l, className: "notion-asset-object-fit" }) : t.type === "gist" ? (N.endsWith(".pibb") || (N = `${N}.pibb`), l.width = "100%", r.paddingBottom = "50%", m = /* @__PURE__ */ e.createElement(
|
|
816
|
+
"iframe",
|
|
817
|
+
{
|
|
818
|
+
style: l,
|
|
819
|
+
className: "notion-asset-object-fit",
|
|
820
|
+
src: N,
|
|
821
|
+
title: "GitHub Gist",
|
|
822
|
+
frameBorder: "0",
|
|
823
|
+
loading: "lazy",
|
|
824
|
+
scrolling: "auto"
|
|
825
|
+
}
|
|
826
|
+
)) : m = /* @__PURE__ */ e.createElement(
|
|
827
|
+
"iframe",
|
|
828
|
+
{
|
|
829
|
+
className: "notion-asset-object-fit",
|
|
830
|
+
style: l,
|
|
831
|
+
src: N,
|
|
832
|
+
title: `iframe ${t.type}`,
|
|
833
|
+
frameBorder: "0",
|
|
834
|
+
allowFullScreen: !0,
|
|
835
|
+
loading: "lazy",
|
|
836
|
+
scrolling: "auto"
|
|
837
|
+
}
|
|
838
|
+
);
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
else if (t.type === "image") {
|
|
842
|
+
s.includes("file.notion.so") && (s = (k = (I = (w = t.properties) == null ? void 0 : w.source) == null ? void 0 : I[0]) == null ? void 0 : k[0]);
|
|
843
|
+
const N = u(s, t), y = le((S = t.properties) == null ? void 0 : S.caption) || "notion image";
|
|
844
|
+
m = /* @__PURE__ */ e.createElement(V, { src: N, alt: y, zoomable: a, height: r.height, style: l });
|
|
845
|
+
}
|
|
846
|
+
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { style: r }, m, t.type === "image" && n), t.type !== "image" && n);
|
|
847
|
+
}, We = { width: "100%" }, Ae = ({ blockId: t, block: a }) => {
|
|
848
|
+
var m, p, i, f, v, h;
|
|
849
|
+
const n = a, { components: o, mapPageUrl: u, rootDomain: c, zoom: r } = _();
|
|
850
|
+
let l = !1;
|
|
851
|
+
if (a.type === "image") {
|
|
852
|
+
const d = (i = (p = (m = n == null ? void 0 : n.properties) == null ? void 0 : m.caption) == null ? void 0 : p[0]) == null ? void 0 : i[0];
|
|
853
|
+
if (d) {
|
|
854
|
+
const w = R(d, { uuid: !0 });
|
|
855
|
+
(d.charAt(0) === "/" && w || Ge(d)) && (l = !0);
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
const s = /* @__PURE__ */ e.createElement(
|
|
859
|
+
"figure",
|
|
860
|
+
{
|
|
861
|
+
className: `notion-asset-wrapper
|
|
862
|
+
notion-asset-wrapper-${a.type}
|
|
863
|
+
${(f = n.format) != null && f.block_full_width ? "notion-asset-wrapper-full" : ""}
|
|
864
|
+
${t}`
|
|
865
|
+
},
|
|
866
|
+
/* @__PURE__ */ e.createElement(Ze, { block: n, zoomable: r && !l }, ((v = n == null ? void 0 : n.properties) == null ? void 0 : v.caption) && !l && /* @__PURE__ */ e.createElement("figcaption", { className: "notion-asset-caption" }, /* @__PURE__ */ e.createElement(D, { value: n.properties.caption, block: a })))
|
|
867
|
+
);
|
|
868
|
+
if (l) {
|
|
869
|
+
const d = (h = n == null ? void 0 : n.properties) == null ? void 0 : h.caption[0][0], w = R(d, { uuid: !0 }), I = d.charAt(0) === "/" && w, k = Qe(d);
|
|
870
|
+
return /* @__PURE__ */ e.createElement(
|
|
871
|
+
o.PageLink,
|
|
872
|
+
{
|
|
873
|
+
style: We,
|
|
874
|
+
href: I ? u(w) : d,
|
|
875
|
+
target: k && k !== c && !d.startsWith("/") ? "blank_" : null
|
|
876
|
+
},
|
|
877
|
+
s
|
|
878
|
+
);
|
|
879
|
+
}
|
|
880
|
+
return s;
|
|
881
|
+
};
|
|
882
|
+
function Ge(t) {
|
|
883
|
+
return !!new RegExp(
|
|
884
|
+
"^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$",
|
|
885
|
+
"i"
|
|
886
|
+
).test(t);
|
|
887
|
+
}
|
|
888
|
+
function Qe(t) {
|
|
889
|
+
try {
|
|
890
|
+
return new URL(t).hostname;
|
|
891
|
+
} catch (a) {
|
|
892
|
+
return "";
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
export {
|
|
896
|
+
Ae as A,
|
|
897
|
+
Se as B,
|
|
898
|
+
pe as C,
|
|
899
|
+
xe as E,
|
|
900
|
+
A as G,
|
|
901
|
+
_e as H,
|
|
902
|
+
V as L,
|
|
903
|
+
De as N,
|
|
904
|
+
U as P,
|
|
905
|
+
Pe as S,
|
|
906
|
+
D as T,
|
|
907
|
+
z as a,
|
|
908
|
+
ge as b,
|
|
909
|
+
ye as c,
|
|
910
|
+
at as d,
|
|
911
|
+
Ue as e,
|
|
912
|
+
ve as f,
|
|
913
|
+
nt as g,
|
|
914
|
+
be as h,
|
|
915
|
+
he as i,
|
|
916
|
+
Ie as j,
|
|
917
|
+
He as k,
|
|
918
|
+
Ze as l,
|
|
919
|
+
_ as u
|
|
920
|
+
};
|
|
921
|
+
//# sourceMappingURL=asset-wrapper-CmbIDPIw.js.map
|