@texonom/nreact 1.5.1 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/{asset-wrapper-CmbIDPIw.js → asset-wrapper-CaHInqoM.js} +158 -157
- package/build/asset-wrapper-CaHInqoM.js.map +1 -0
- package/build/block.d.ts.map +1 -1
- package/build/components/lazy-image.d.ts +1 -0
- package/build/components/lazy-image.d.ts.map +1 -1
- package/build/index.js +178 -164
- package/build/index.js.map +1 -1
- package/build/third-party/code.js +1 -1
- package/build/third-party/collection.js +1 -1
- package/build/third-party/equation.js +1 -1
- package/package.json +3 -3
- package/build/asset-wrapper-CmbIDPIw.js.map +0 -1
|
@@ -83,36 +83,36 @@ const pe = ({ isChecked: t }) => {
|
|
|
83
83
|
} catch (a) {
|
|
84
84
|
}
|
|
85
85
|
return null;
|
|
86
|
-
}, V = (
|
|
87
|
-
var
|
|
88
|
-
var
|
|
89
|
-
const { recordMap:
|
|
90
|
-
(
|
|
91
|
-
u && (
|
|
86
|
+
}, V = (m) => {
|
|
87
|
+
var p = m, { src: t, alt: a, className: n, style: o, zoomable: u = !1, priority: c = !1, height: r, onError: l } = p, s = b(p, ["src", "alt", "className", "style", "zoomable", "priority", "height", "onError"]);
|
|
88
|
+
var g, y, v;
|
|
89
|
+
const { recordMap: i, zoom: d, previewImages: C, forceCustomImages: h, components: f } = S(), w = e.useRef(d ? d.clone() : null), I = C ? (v = (g = i == null ? void 0 : i.preview_images) == null ? void 0 : g[t]) != null ? v : (y = i == null ? void 0 : i.preview_images) == null ? void 0 : y[ne(t)] : null, x = e.useCallback(
|
|
90
|
+
(k) => {
|
|
91
|
+
u && (k.target.src || k.target.srcset) && w.current && w.current.attach(k.target);
|
|
92
92
|
},
|
|
93
|
-
[
|
|
94
|
-
),
|
|
95
|
-
(
|
|
96
|
-
|
|
93
|
+
[w, u]
|
|
94
|
+
), _ = e.useCallback(
|
|
95
|
+
(k) => {
|
|
96
|
+
w.current && k && w.current.attach(k);
|
|
97
97
|
},
|
|
98
|
-
[
|
|
99
|
-
),
|
|
100
|
-
return
|
|
101
|
-
|
|
98
|
+
[w]
|
|
99
|
+
), N = e.useMemo(() => u ? _ : void 0, [u, _]);
|
|
100
|
+
return I && f.Image ? /* @__PURE__ */ e.createElement(
|
|
101
|
+
f.Image,
|
|
102
102
|
{
|
|
103
103
|
src: t,
|
|
104
104
|
alt: a,
|
|
105
105
|
style: o,
|
|
106
106
|
className: n,
|
|
107
|
-
width:
|
|
108
|
-
height:
|
|
109
|
-
blurDataURL:
|
|
107
|
+
width: I.originalWidth,
|
|
108
|
+
height: I.originalHeight,
|
|
109
|
+
blurDataURL: I.dataURIBase64,
|
|
110
110
|
placeholder: "blur",
|
|
111
111
|
priority: c,
|
|
112
|
-
onLoad:
|
|
112
|
+
onLoad: x
|
|
113
113
|
}
|
|
114
|
-
) :
|
|
115
|
-
|
|
114
|
+
) : f.Image && h ? /* @__PURE__ */ e.createElement(
|
|
115
|
+
f.Image,
|
|
116
116
|
{
|
|
117
117
|
src: t,
|
|
118
118
|
alt: a,
|
|
@@ -121,7 +121,7 @@ const pe = ({ isChecked: t }) => {
|
|
|
121
121
|
width: null,
|
|
122
122
|
height: r || null,
|
|
123
123
|
priority: c,
|
|
124
|
-
onLoad:
|
|
124
|
+
onLoad: x
|
|
125
125
|
}
|
|
126
126
|
) : /* @__PURE__ */ e.createElement(
|
|
127
127
|
"img",
|
|
@@ -130,24 +130,25 @@ const pe = ({ isChecked: t }) => {
|
|
|
130
130
|
style: o,
|
|
131
131
|
src: t,
|
|
132
132
|
alt: a,
|
|
133
|
-
ref:
|
|
133
|
+
ref: N,
|
|
134
134
|
loading: "lazy",
|
|
135
|
-
decoding: "async"
|
|
136
|
-
|
|
135
|
+
decoding: "async",
|
|
136
|
+
onError: l
|
|
137
|
+
}, s)
|
|
137
138
|
);
|
|
138
139
|
}, 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
140
|
var p;
|
|
140
|
-
const { mapImageUrl: c, recordMap: r, darkMode: l } =
|
|
141
|
+
const { mapImageUrl: c, recordMap: r, darkMode: l } = S();
|
|
141
142
|
let s = !1, m = null;
|
|
142
143
|
if (Ce(t)) {
|
|
143
|
-
const i = ((p = ae(t, r)) == null ? void 0 : p.trim()) || u,
|
|
144
|
+
const i = ((p = ae(t, r)) == null ? void 0 : p.trim()) || u, d = F(t, r);
|
|
144
145
|
if (i && re(i)) {
|
|
145
|
-
const
|
|
146
|
-
s = !0, m = /* @__PURE__ */ e.createElement(V, { src:
|
|
146
|
+
const C = c(i, t);
|
|
147
|
+
s = !0, m = /* @__PURE__ */ e.createElement(V, { src: C, alt: d || "page icon", className: `${a || ""} notion-page-icon` });
|
|
147
148
|
} else if (i && i.startsWith("/icons/")) {
|
|
148
|
-
const
|
|
149
|
-
m = /* @__PURE__ */ e.createElement(V, { src:
|
|
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:
|
|
149
|
+
const C = "https://www.notion.so" + i + "?mode=" + (l ? "dark" : "light");
|
|
150
|
+
m = /* @__PURE__ */ e.createElement(V, { src: C, alt: d || "page icon", className: `${a || ""} notion-page-icon` });
|
|
151
|
+
} 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: d || "page icon" }));
|
|
151
152
|
}
|
|
152
153
|
return m ? /* @__PURE__ */ e.createElement(
|
|
153
154
|
"div",
|
|
@@ -176,18 +177,18 @@ function ke(t) {
|
|
|
176
177
|
)));
|
|
177
178
|
}
|
|
178
179
|
const xe = ({ block: t, inline: a, className: n }) => {
|
|
179
|
-
var
|
|
180
|
-
const { components: o } =
|
|
180
|
+
var d, C, h;
|
|
181
|
+
const { components: o } = S(), { original_url: u, attributes: c, domain: r } = (t == null ? void 0 : t.format) || {};
|
|
181
182
|
if (!u || !c) return null;
|
|
182
|
-
const l = (
|
|
183
|
-
let s = (
|
|
184
|
-
const m = (h = c.find((
|
|
183
|
+
const l = (d = c.find((f) => f.id === "title")) == null ? void 0 : d.values[0];
|
|
184
|
+
let s = (C = c.find((f) => f.id === "owner")) == null ? void 0 : C.values[0];
|
|
185
|
+
const m = (h = c.find((f) => f.id === "updated_at")) == null ? void 0 : h.values[0], p = m ? oe(m) : null;
|
|
185
186
|
let i;
|
|
186
187
|
switch (r) {
|
|
187
188
|
case "github.com":
|
|
188
189
|
if (i = /* @__PURE__ */ e.createElement(ke, null), s) {
|
|
189
|
-
const
|
|
190
|
-
s =
|
|
190
|
+
const f = s.split("/");
|
|
191
|
+
s = f[f.length - 1];
|
|
191
192
|
}
|
|
192
193
|
break;
|
|
193
194
|
default:
|
|
@@ -205,40 +206,40 @@ const xe = ({ block: t, inline: a, className: n }) => {
|
|
|
205
206
|
/* @__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
|
);
|
|
207
208
|
}, 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
|
+
const { components: u, recordMap: c, mapPageUrl: r, mapImageUrl: l, rootDomain: s } = S();
|
|
209
210
|
return /* @__PURE__ */ e.createElement(e.Fragment, null, t == null ? void 0 : t.map((m, p) => {
|
|
210
|
-
const [i,
|
|
211
|
-
if (!
|
|
211
|
+
const [i, d] = m;
|
|
212
|
+
if (!d)
|
|
212
213
|
return i === "," ? /* @__PURE__ */ e.createElement("span", { key: p, style: { padding: "0.5em" } }) : /* @__PURE__ */ e.createElement(e.Fragment, { key: p }, i);
|
|
213
|
-
const
|
|
214
|
-
(h,
|
|
215
|
-
var w, I,
|
|
216
|
-
switch (
|
|
214
|
+
const C = d.reduce(
|
|
215
|
+
(h, f) => {
|
|
216
|
+
var w, I, x, _, N;
|
|
217
|
+
switch (f[0]) {
|
|
217
218
|
case "p": {
|
|
218
|
-
const g =
|
|
219
|
+
const g = f[1], y = (w = c.block[g]) == null ? void 0 : w.value;
|
|
219
220
|
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
|
}
|
|
221
222
|
case "‣": {
|
|
222
|
-
const g =
|
|
223
|
+
const g = f[1][0], y = f[1][1];
|
|
223
224
|
switch (g) {
|
|
224
225
|
case "u": {
|
|
225
|
-
const
|
|
226
|
-
if (!
|
|
226
|
+
const v = (I = c.notion_user[y]) == null ? void 0 : I.value;
|
|
227
|
+
if (!v)
|
|
227
228
|
return console.debug('"‣" missing user', y), null;
|
|
228
|
-
const
|
|
229
|
+
const k = [v.given_name, v.family_name].filter(Boolean).join(" "), M = v.email;
|
|
229
230
|
return /* @__PURE__ */ e.createElement(u.Link, E({ className: "notion-link", href: `mailto:${M}` }, n), /* @__PURE__ */ e.createElement(
|
|
230
231
|
A,
|
|
231
232
|
{
|
|
232
233
|
className: "notion-user",
|
|
233
|
-
src: l(
|
|
234
|
-
alt:
|
|
234
|
+
src: l(v.profile_photo, a),
|
|
235
|
+
alt: k,
|
|
235
236
|
style: { display: "inline", marginRight: "0.3em", marginBottom: "0.3em" }
|
|
236
237
|
}
|
|
237
|
-
),
|
|
238
|
+
), k);
|
|
238
239
|
}
|
|
239
240
|
default: {
|
|
240
|
-
const
|
|
241
|
-
return
|
|
241
|
+
const v = (x = c.block[y]) == null ? void 0 : x.value;
|
|
242
|
+
return v ? /* @__PURE__ */ e.createElement(
|
|
242
243
|
u.PageLink,
|
|
243
244
|
P(E({
|
|
244
245
|
className: "notion-link",
|
|
@@ -247,13 +248,13 @@ const xe = ({ block: t, inline: a, className: n }) => {
|
|
|
247
248
|
target: "_blank",
|
|
248
249
|
rel: "noopener noreferrer"
|
|
249
250
|
}),
|
|
250
|
-
/* @__PURE__ */ e.createElement(U, { block:
|
|
251
|
+
/* @__PURE__ */ e.createElement(U, { block: v })
|
|
251
252
|
) : (console.debug('"‣" missing block', g, y), null);
|
|
252
253
|
}
|
|
253
254
|
}
|
|
254
255
|
}
|
|
255
256
|
case "h":
|
|
256
|
-
return /* @__PURE__ */ e.createElement("span", { className: `notion-${
|
|
257
|
+
return /* @__PURE__ */ e.createElement("span", { className: `notion-${f[1]}` }, h);
|
|
257
258
|
case "c":
|
|
258
259
|
return /* @__PURE__ */ e.createElement("code", { className: "notion-inline-code" }, h);
|
|
259
260
|
case "b":
|
|
@@ -265,69 +266,69 @@ const xe = ({ block: t, inline: a, className: n }) => {
|
|
|
265
266
|
case "_":
|
|
266
267
|
return /* @__PURE__ */ e.createElement("span", { className: "notion-inline-underscore" }, h);
|
|
267
268
|
case "e":
|
|
268
|
-
return /* @__PURE__ */ e.createElement(u.Equation, { math:
|
|
269
|
+
return /* @__PURE__ */ e.createElement(u.Equation, { math: f[1], inline: !0 });
|
|
269
270
|
case "m":
|
|
270
271
|
return h;
|
|
271
272
|
//still need to return the base element
|
|
272
273
|
case "a": {
|
|
273
|
-
const g =
|
|
274
|
-
if ((g[0] === "/" || g.includes(s)) &&
|
|
275
|
-
const
|
|
276
|
-
return /* @__PURE__ */ e.createElement(u.PageLink, E({ className: "notion-link", href:
|
|
274
|
+
const g = f[1], y = g.substring(1), v = R(y, { uuid: !0 });
|
|
275
|
+
if ((g[0] === "/" || g.includes(s)) && v) {
|
|
276
|
+
const k = g.includes(s) ? g : `${r(v)}${ge(g)}`;
|
|
277
|
+
return /* @__PURE__ */ e.createElement(u.PageLink, E({ className: "notion-link", href: k }, n), h);
|
|
277
278
|
} else
|
|
278
279
|
return /* @__PURE__ */ e.createElement(
|
|
279
280
|
u.Link,
|
|
280
281
|
E({
|
|
281
282
|
className: "notion-link",
|
|
282
|
-
href: o ? `${o}:${
|
|
283
|
+
href: o ? `${o}:${f[1]}` : f[1]
|
|
283
284
|
}, n),
|
|
284
285
|
h
|
|
285
286
|
);
|
|
286
287
|
}
|
|
287
288
|
// Date
|
|
288
289
|
case "d": {
|
|
289
|
-
const g =
|
|
290
|
+
const g = f[1], y = g == null ? void 0 : g.type;
|
|
290
291
|
if (y === "date") {
|
|
291
|
-
const
|
|
292
|
-
return T(
|
|
292
|
+
const v = g.start_date;
|
|
293
|
+
return T(v);
|
|
293
294
|
} else if (y === "daterange") {
|
|
294
|
-
const
|
|
295
|
-
return `${T(
|
|
295
|
+
const v = g.start_date, k = g.end_date;
|
|
296
|
+
return `${T(v)} → ${T(k)}`;
|
|
296
297
|
} else
|
|
297
298
|
return h;
|
|
298
299
|
}
|
|
299
300
|
// User
|
|
300
301
|
case "u": {
|
|
301
|
-
const g =
|
|
302
|
+
const g = f[1], y = (_ = c.notion_user[g]) == null ? void 0 : _.value;
|
|
302
303
|
if (!y)
|
|
303
304
|
return console.debug("missing user", g), null;
|
|
304
|
-
const
|
|
305
|
-
return /* @__PURE__ */ e.createElement(u.Link, E({ className: "notion-link", href: `mailto:${
|
|
305
|
+
const v = y.name, k = y.email;
|
|
306
|
+
return /* @__PURE__ */ e.createElement(u.Link, E({ className: "notion-link", href: `mailto:${k}` }, n), /* @__PURE__ */ e.createElement(
|
|
306
307
|
A,
|
|
307
308
|
{
|
|
308
309
|
className: "notion-user",
|
|
309
310
|
src: l(y.profile_photo, a),
|
|
310
|
-
alt:
|
|
311
|
+
alt: v,
|
|
311
312
|
style: { display: "inline", marginRight: "0.3em", marginBottom: "0.3em" }
|
|
312
313
|
}
|
|
313
|
-
),
|
|
314
|
+
), v);
|
|
314
315
|
}
|
|
315
316
|
case "eoi": {
|
|
316
|
-
const g =
|
|
317
|
+
const g = f[1], y = (N = c.block[g]) == null ? void 0 : N.value;
|
|
317
318
|
return /* @__PURE__ */ e.createElement(xe, { block: y, inline: !0 });
|
|
318
319
|
}
|
|
319
320
|
default:
|
|
320
|
-
return process.env.NODE_ENV !== "production" && console.debug("unsupported text format",
|
|
321
|
+
return process.env.NODE_ENV !== "production" && console.debug("unsupported text format", f), h;
|
|
321
322
|
}
|
|
322
323
|
},
|
|
323
324
|
/* @__PURE__ */ e.createElement(e.Fragment, null, i)
|
|
324
325
|
);
|
|
325
|
-
return /* @__PURE__ */ e.createElement(e.Fragment, { key: p },
|
|
326
|
+
return /* @__PURE__ */ e.createElement(e.Fragment, { key: p }, C);
|
|
326
327
|
}));
|
|
327
328
|
}, Ie = (u) => {
|
|
328
329
|
var c = u, { block: t, className: a, defaultIcon: n } = c, o = b(c, ["block", "className", "defaultIcon"]);
|
|
329
330
|
var l, s;
|
|
330
|
-
const { recordMap: r } =
|
|
331
|
+
const { recordMap: r } = S();
|
|
331
332
|
if (!t) return null;
|
|
332
333
|
if (t.type === "collection_view_page" || t.type === "collection_view") {
|
|
333
334
|
const m = F(t, r);
|
|
@@ -399,17 +400,17 @@ class be extends e.Component {
|
|
|
399
400
|
else {
|
|
400
401
|
l = E({}, r);
|
|
401
402
|
const p = l.results.map((i) => {
|
|
402
|
-
var h,
|
|
403
|
-
const
|
|
404
|
-
if (!
|
|
405
|
-
const
|
|
406
|
-
if (
|
|
403
|
+
var h, f;
|
|
404
|
+
const d = (h = l.recordMap.block[i.id]) == null ? void 0 : h.value;
|
|
405
|
+
if (!d) return;
|
|
406
|
+
const C = F(d, l.recordMap);
|
|
407
|
+
if (C && (i.title = C, i.block = d, i.recordMap = l.recordMap, i.page = se(d, l.recordMap, {
|
|
407
408
|
inclusive: !0
|
|
408
|
-
}) ||
|
|
409
|
-
return (
|
|
409
|
+
}) || d, !!i.page.id))
|
|
410
|
+
return (f = i.highlight) != null && f.text && (i.highlight.html = i.highlight.text.replace(/<gzkNfoUU>/gi, "<b>").replace(/<\/gzkNfoUU>/gi, "</b>")), i;
|
|
410
411
|
}).filter(Boolean).reduce(
|
|
411
|
-
(i,
|
|
412
|
-
[
|
|
412
|
+
(i, d) => P(E({}, i), {
|
|
413
|
+
[d.page.id]: d
|
|
413
414
|
}),
|
|
414
415
|
{}
|
|
415
416
|
);
|
|
@@ -444,22 +445,22 @@ class be extends e.Component {
|
|
|
444
445
|
ref: this._inputRef,
|
|
445
446
|
onInput: this._onChangeQuery
|
|
446
447
|
}
|
|
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((
|
|
448
|
-
var
|
|
448
|
+
), 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((d) => {
|
|
449
|
+
var C;
|
|
449
450
|
return /* @__PURE__ */ e.createElement(
|
|
450
451
|
m.PageLink,
|
|
451
452
|
{
|
|
452
|
-
key:
|
|
453
|
+
key: d.id,
|
|
453
454
|
className: "result notion-page-link",
|
|
454
|
-
href: i(
|
|
455
|
+
href: i(d.page.id, c.recordMap)
|
|
455
456
|
},
|
|
456
|
-
/* @__PURE__ */ e.createElement(U, { block:
|
|
457
|
-
((
|
|
457
|
+
/* @__PURE__ */ e.createElement(U, { block: d.page, defaultIcon: p }),
|
|
458
|
+
((C = d.highlight) == null ? void 0 : C.html) && /* @__PURE__ */ e.createElement(
|
|
458
459
|
"div",
|
|
459
460
|
{
|
|
460
461
|
className: "notion-search-result-highlight",
|
|
461
462
|
dangerouslySetInnerHTML: {
|
|
462
|
-
__html:
|
|
463
|
+
__html: d.highlight.html
|
|
463
464
|
}
|
|
464
465
|
}
|
|
465
466
|
)
|
|
@@ -470,7 +471,7 @@ class be extends e.Component {
|
|
|
470
471
|
}
|
|
471
472
|
}
|
|
472
473
|
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 } =
|
|
474
|
+
const { recordMap: n, mapPageUrl: o, components: u } = S(), c = e.useMemo(() => {
|
|
474
475
|
const r = ie(n, t.id);
|
|
475
476
|
return a ? [r[0]].filter(Boolean) : r;
|
|
476
477
|
}, [n, t.id, a]);
|
|
@@ -482,13 +483,13 @@ const _e = ({ block: t }) => /* @__PURE__ */ e.createElement("header", { classNa
|
|
|
482
483
|
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
|
}));
|
|
484
485
|
}, Pe = ({ block: t, search: a, title: n = "Search" }) => {
|
|
485
|
-
const { searchNotion: o, rootPageId: u, isShowingSearch: c, onHideSearch: r, rootSpaceId: l } =
|
|
486
|
+
const { searchNotion: o, rootPageId: u, isShowingSearch: c, onHideSearch: r, rootSpaceId: l } = S(), s = a || o, [m, p] = e.useState(c);
|
|
486
487
|
e.useEffect(() => {
|
|
487
488
|
p(c);
|
|
488
489
|
}, [c]);
|
|
489
490
|
const i = e.useCallback(() => {
|
|
490
491
|
p(!0);
|
|
491
|
-
}, []),
|
|
492
|
+
}, []), d = e.useCallback(() => {
|
|
492
493
|
p(!1), r && r();
|
|
493
494
|
}, [r]);
|
|
494
495
|
W("cmd+p", (h) => {
|
|
@@ -496,14 +497,14 @@ const _e = ({ block: t }) => /* @__PURE__ */ e.createElement("header", { classNa
|
|
|
496
497
|
}), W("cmd+k", (h) => {
|
|
497
498
|
i(), h.preventDefault(), h.stopPropagation();
|
|
498
499
|
});
|
|
499
|
-
const
|
|
500
|
-
return /* @__PURE__ */ e.createElement(e.Fragment, null,
|
|
500
|
+
const C = !!s;
|
|
501
|
+
return /* @__PURE__ */ e.createElement(e.Fragment, null, C && /* @__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 && C && /* @__PURE__ */ e.createElement(
|
|
501
502
|
be,
|
|
502
503
|
{
|
|
503
504
|
isOpen: m,
|
|
504
505
|
rootBlockId: u || (t == null ? void 0 : t.id),
|
|
505
506
|
rootSpaceId: l,
|
|
506
|
-
onClose:
|
|
507
|
+
onClose: d,
|
|
507
508
|
searchNotion: s
|
|
508
509
|
}
|
|
509
510
|
));
|
|
@@ -538,8 +539,8 @@ const _e = ({ block: t }) => /* @__PURE__ */ e.createElement("header", { classNa
|
|
|
538
539
|
layout: s
|
|
539
540
|
}, m)
|
|
540
541
|
);
|
|
541
|
-
}, me), $e = (t) => function(
|
|
542
|
-
var h =
|
|
542
|
+
}, me), $e = (t) => function(C) {
|
|
543
|
+
var h = C, {
|
|
543
544
|
href: n,
|
|
544
545
|
as: o,
|
|
545
546
|
passHref: u,
|
|
@@ -550,7 +551,7 @@ const _e = ({ block: t }) => /* @__PURE__ */ e.createElement("header", { classNa
|
|
|
550
551
|
locale: m,
|
|
551
552
|
className: p,
|
|
552
553
|
style: i
|
|
553
|
-
} = h,
|
|
554
|
+
} = h, d = b(h, [
|
|
554
555
|
"href",
|
|
555
556
|
"as",
|
|
556
557
|
"passHref",
|
|
@@ -574,12 +575,12 @@ const _e = ({ block: t }) => /* @__PURE__ */ e.createElement("header", { classNa
|
|
|
574
575
|
locale: m,
|
|
575
576
|
className: p,
|
|
576
577
|
style: i
|
|
577
|
-
},
|
|
578
|
+
}, d)
|
|
578
579
|
);
|
|
579
580
|
}, Be = (t) => /* @__PURE__ */ e.createElement("a", E({ target: "_blank", rel: "noopener noreferrer" }, t)), Re = e.memo(Be), Oe = (n) => {
|
|
580
581
|
var o = n, { href: t } = o, a = b(o, ["href"]);
|
|
581
582
|
var l, s;
|
|
582
|
-
const { recordMap: u, rootSpaceId: c } =
|
|
583
|
+
const { recordMap: u, rootSpaceId: c } = S();
|
|
583
584
|
let r = t;
|
|
584
585
|
if (typeof t == "string" && c) {
|
|
585
586
|
const m = R(t);
|
|
@@ -592,7 +593,7 @@ const _e = ({ block: t }) => /* @__PURE__ */ e.createElement("header", { classNa
|
|
|
592
593
|
}, Te = e.memo(Oe), Ve = (t) => /* @__PURE__ */ e.createElement(Ae, E({}, t)), ze = _e, at = (c) => {
|
|
593
594
|
var r = c, { href: t, rel: a, target: n, title: o } = r, u = b(r, ["href", "rel", "target", "title"]);
|
|
594
595
|
return /* @__PURE__ */ e.createElement("span", E({}, u));
|
|
595
|
-
}, $ = (t) => () => (console.warn(`Warning: using empty component "${t}" (you should override this in NotionRenderer.components)`), null),
|
|
596
|
+
}, $ = (t) => () => (console.warn(`Warning: using empty component "${t}" (you should override this in NotionRenderer.components)`), null), L = (t, a) => a(), X = {
|
|
596
597
|
Image: null,
|
|
597
598
|
// disable custom images by default
|
|
598
599
|
Link: Re,
|
|
@@ -605,21 +606,21 @@ const _e = ({ block: t }) => /* @__PURE__ */ e.createElement("header", { classNa
|
|
|
605
606
|
Collection: $("Collection"),
|
|
606
607
|
Property: void 0,
|
|
607
608
|
// use the built-in property rendering by default
|
|
608
|
-
propertyTextValue:
|
|
609
|
-
propertySelectValue:
|
|
610
|
-
propertyRelationValue:
|
|
611
|
-
propertyFormulaValue:
|
|
612
|
-
propertyTitleValue:
|
|
613
|
-
propertyPersonValue:
|
|
614
|
-
propertyFileValue:
|
|
615
|
-
propertyCheckboxValue:
|
|
616
|
-
propertyUrlValue:
|
|
617
|
-
propertyEmailValue:
|
|
618
|
-
propertyPhoneNumberValue:
|
|
619
|
-
propertyNumberValue:
|
|
620
|
-
propertyLastEditedTimeValue:
|
|
621
|
-
propertyCreatedTimeValue:
|
|
622
|
-
propertyDateValue:
|
|
609
|
+
propertyTextValue: L,
|
|
610
|
+
propertySelectValue: L,
|
|
611
|
+
propertyRelationValue: L,
|
|
612
|
+
propertyFormulaValue: L,
|
|
613
|
+
propertyTitleValue: L,
|
|
614
|
+
propertyPersonValue: L,
|
|
615
|
+
propertyFileValue: L,
|
|
616
|
+
propertyCheckboxValue: L,
|
|
617
|
+
propertyUrlValue: L,
|
|
618
|
+
propertyEmailValue: L,
|
|
619
|
+
propertyPhoneNumberValue: L,
|
|
620
|
+
propertyNumberValue: L,
|
|
621
|
+
propertyLastEditedTimeValue: L,
|
|
622
|
+
propertyCreatedTimeValue: L,
|
|
623
|
+
propertyDateValue: L,
|
|
623
624
|
Pdf: $("Pdf"),
|
|
624
625
|
Tweet: $("Tweet"),
|
|
625
626
|
Modal: $("Modal"),
|
|
@@ -673,10 +674,10 @@ const _e = ({ block: t }) => /* @__PURE__ */ e.createElement("header", { classNa
|
|
|
673
674
|
const m = e.useMemo(() => {
|
|
674
675
|
const i = E({}, t);
|
|
675
676
|
if (i.nextImage && (i.Image = Me(i.nextImage)), i.nextLink) {
|
|
676
|
-
const
|
|
677
|
-
i.nextLink =
|
|
677
|
+
const d = $e(i.nextLink);
|
|
678
|
+
i.nextLink = d, i.PageLink || (i.PageLink = d), i.Link || (i.Link = d);
|
|
678
679
|
}
|
|
679
|
-
for (const
|
|
680
|
+
for (const d of Object.keys(i)) i[d] || delete i[d];
|
|
680
681
|
return i;
|
|
681
682
|
}, [t]), p = e.useMemo(
|
|
682
683
|
() => P(E(E({}, J), r), {
|
|
@@ -689,7 +690,7 @@ const _e = ({ block: t }) => /* @__PURE__ */ e.createElement("header", { classNa
|
|
|
689
690
|
[o, n, m, u, c, r]
|
|
690
691
|
);
|
|
691
692
|
return /* @__PURE__ */ e.createElement(H.Provider, { value: p }, a);
|
|
692
|
-
}, Ue = H.Consumer,
|
|
693
|
+
}, Ue = H.Consumer, S = () => e.useContext(H), Fe = (t) => Object.keys(t).map((a) => `${encodeURIComponent(a)}=${encodeURIComponent(t[a])}`).join("&"), He = ({
|
|
693
694
|
id: t,
|
|
694
695
|
defaultPlay: a = !1,
|
|
695
696
|
mute: n = !1,
|
|
@@ -701,27 +702,27 @@ const _e = ({ block: t }) => /* @__PURE__ */ e.createElement("header", { classNa
|
|
|
701
702
|
style: s,
|
|
702
703
|
className: m
|
|
703
704
|
}) => {
|
|
704
|
-
const p = n || a ? "1" : "0", i = e.useMemo(() => Fe(E({ autoplay: "1", mute: p }, r)), [p, r]),
|
|
705
|
+
const p = n || a ? "1" : "0", i = e.useMemo(() => Fe(E({ autoplay: "1", mute: p }, r)), [p, r]), C = `https://i.ytimg.com/vi/${t}/hqdefault.jpg`, h = "https://www.youtube-nocookie.com", f = `${h}/embed/${t}?${i}`, [w, I] = e.useState(!1), [x, _] = e.useState(a), [N, g] = e.useState(!1), y = e.useCallback(() => {
|
|
705
706
|
w || I(!0);
|
|
706
|
-
}, [w]),
|
|
707
|
-
|
|
708
|
-
}, [
|
|
707
|
+
}, [w]), v = e.useCallback(() => {
|
|
708
|
+
x || _(!0);
|
|
709
|
+
}, [x]), k = e.useCallback(() => {
|
|
709
710
|
g(!0);
|
|
710
711
|
}, []);
|
|
711
|
-
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("link", { rel: "preload", href:
|
|
712
|
+
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("link", { rel: "preload", href: C, 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
713
|
"div",
|
|
713
714
|
{
|
|
714
|
-
onClick:
|
|
715
|
+
onClick: v,
|
|
715
716
|
onPointerOver: y,
|
|
716
717
|
className: `notion-yt-lite
|
|
717
718
|
${N && "notion-yt-loaded"}
|
|
718
|
-
${
|
|
719
|
+
${x && "notion-yt-initialized"}
|
|
719
720
|
${m || ""}`,
|
|
720
721
|
style: s
|
|
721
722
|
},
|
|
722
|
-
/* @__PURE__ */ e.createElement("img", { src:
|
|
723
|
+
/* @__PURE__ */ e.createElement("img", { src: C, className: "notion-yt-thumbnail", loading: o ? "lazy" : void 0, alt: c }),
|
|
723
724
|
/* @__PURE__ */ e.createElement("div", { className: "notion-yt-playbtn" }),
|
|
724
|
-
|
|
725
|
+
x && /* @__PURE__ */ e.createElement(
|
|
725
726
|
"iframe",
|
|
726
727
|
{
|
|
727
728
|
width: "560",
|
|
@@ -730,8 +731,8 @@ const _e = ({ block: t }) => /* @__PURE__ */ e.createElement("header", { classNa
|
|
|
730
731
|
allow: "accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",
|
|
731
732
|
allowFullScreen: !0,
|
|
732
733
|
title: u,
|
|
733
|
-
src:
|
|
734
|
-
onLoad:
|
|
734
|
+
src: f,
|
|
735
|
+
onLoad: k
|
|
735
736
|
}
|
|
736
737
|
)
|
|
737
738
|
));
|
|
@@ -749,8 +750,8 @@ const _e = ({ block: t }) => /* @__PURE__ */ e.createElement("header", { classNa
|
|
|
749
750
|
"codepen",
|
|
750
751
|
"drive"
|
|
751
752
|
], Ze = ({ block: t, zoomable: a = !0, children: n }) => {
|
|
752
|
-
var p, i,
|
|
753
|
-
const { recordMap: o, mapImageUrl: u, components: c } =
|
|
753
|
+
var p, i, d, C, h, f, w, I, x, _;
|
|
754
|
+
const { recordMap: o, mapImageUrl: u, components: c } = S();
|
|
754
755
|
if (!t || !qe.includes(t.type)) return null;
|
|
755
756
|
const r = {
|
|
756
757
|
position: "relative",
|
|
@@ -762,9 +763,9 @@ const _e = ({ block: t }) => /* @__PURE__ */ e.createElement("header", { classNa
|
|
|
762
763
|
flexDirection: "column"
|
|
763
764
|
}, l = {};
|
|
764
765
|
if (t.format) {
|
|
765
|
-
const { block_aspect_ratio: N, block_height: g, block_width: y, block_full_width:
|
|
766
|
-
if (
|
|
767
|
-
|
|
766
|
+
const { block_aspect_ratio: N, block_height: g, block_width: y, block_full_width: v, block_page_width: k, block_preserve_scale: M } = t.format;
|
|
767
|
+
if (v || k)
|
|
768
|
+
v ? 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
769
|
else {
|
|
769
770
|
switch ((p = t.format) == null ? void 0 : p.block_alignment) {
|
|
770
771
|
case "center": {
|
|
@@ -784,7 +785,7 @@ const _e = ({ block: t }) => /* @__PURE__ */ e.createElement("header", { classNa
|
|
|
784
785
|
}
|
|
785
786
|
t.type === "image" ? l.objectFit = "cover" : M && (l.objectFit = "contain");
|
|
786
787
|
}
|
|
787
|
-
let s = ((i = o.signed_urls) == null ? void 0 : i[t.id]) || ((h = (
|
|
788
|
+
let s = ((i = o.signed_urls) == null ? void 0 : i[t.id]) || ((h = (C = (d = t.properties) == null ? void 0 : d.source) == null ? void 0 : C[0]) == null ? void 0 : h[0]), m = null;
|
|
788
789
|
if (!s) return null;
|
|
789
790
|
if (t.type === "tweet") {
|
|
790
791
|
const N = s;
|
|
@@ -809,7 +810,7 @@ const _e = ({ block: t }) => /* @__PURE__ */ e.createElement("header", { classNa
|
|
|
809
810
|
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
811
|
r.paddingBottom = void 0, m = /* @__PURE__ */ e.createElement("video", { playsInline: !0, controls: !0, preload: "metadata", style: l, src: s, title: t.type });
|
|
811
812
|
else {
|
|
812
|
-
let N = ((
|
|
813
|
+
let N = ((f = t.format) == null ? void 0 : f.display_source) || s;
|
|
813
814
|
if (N) {
|
|
814
815
|
const g = t.type === "video" ? ye(N) : null;
|
|
815
816
|
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(
|
|
@@ -839,20 +840,20 @@ const _e = ({ block: t }) => /* @__PURE__ */ e.createElement("header", { classNa
|
|
|
839
840
|
}
|
|
840
841
|
}
|
|
841
842
|
else if (t.type === "image") {
|
|
842
|
-
s.includes("file.notion.so") && (s = (
|
|
843
|
-
const N = u(s, t), y = le((
|
|
843
|
+
s.includes("file.notion.so") && (s = (x = (I = (w = t.properties) == null ? void 0 : w.source) == null ? void 0 : I[0]) == null ? void 0 : x[0]);
|
|
844
|
+
const N = u(s, t), y = le((_ = t.properties) == null ? void 0 : _.caption) || "notion image";
|
|
844
845
|
m = /* @__PURE__ */ e.createElement(V, { src: N, alt: y, zoomable: a, height: r.height, style: l });
|
|
845
846
|
}
|
|
846
847
|
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { style: r }, m, t.type === "image" && n), t.type !== "image" && n);
|
|
847
848
|
}, We = { width: "100%" }, Ae = ({ blockId: t, block: a }) => {
|
|
848
|
-
var m, p, i,
|
|
849
|
-
const n = a, { components: o, mapPageUrl: u, rootDomain: c, zoom: r } =
|
|
849
|
+
var m, p, i, d, C, h;
|
|
850
|
+
const n = a, { components: o, mapPageUrl: u, rootDomain: c, zoom: r } = S();
|
|
850
851
|
let l = !1;
|
|
851
852
|
if (a.type === "image") {
|
|
852
|
-
const
|
|
853
|
-
if (
|
|
854
|
-
const w = R(
|
|
855
|
-
(
|
|
853
|
+
const f = (i = (p = (m = n == null ? void 0 : n.properties) == null ? void 0 : m.caption) == null ? void 0 : p[0]) == null ? void 0 : i[0];
|
|
854
|
+
if (f) {
|
|
855
|
+
const w = R(f, { uuid: !0 });
|
|
856
|
+
(f.charAt(0) === "/" && w || Ge(f)) && (l = !0);
|
|
856
857
|
}
|
|
857
858
|
}
|
|
858
859
|
const s = /* @__PURE__ */ e.createElement(
|
|
@@ -860,19 +861,19 @@ const _e = ({ block: t }) => /* @__PURE__ */ e.createElement("header", { classNa
|
|
|
860
861
|
{
|
|
861
862
|
className: `notion-asset-wrapper
|
|
862
863
|
notion-asset-wrapper-${a.type}
|
|
863
|
-
${(
|
|
864
|
+
${(d = n.format) != null && d.block_full_width ? "notion-asset-wrapper-full" : ""}
|
|
864
865
|
${t}`
|
|
865
866
|
},
|
|
866
|
-
/* @__PURE__ */ e.createElement(Ze, { block: n, zoomable: r && !l }, ((
|
|
867
|
+
/* @__PURE__ */ e.createElement(Ze, { block: n, zoomable: r && !l }, ((C = n == null ? void 0 : n.properties) == null ? void 0 : C.caption) && !l && /* @__PURE__ */ e.createElement("figcaption", { className: "notion-asset-caption" }, /* @__PURE__ */ e.createElement(D, { value: n.properties.caption, block: a })))
|
|
867
868
|
);
|
|
868
869
|
if (l) {
|
|
869
|
-
const
|
|
870
|
+
const f = (h = n == null ? void 0 : n.properties) == null ? void 0 : h.caption[0][0], w = R(f, { uuid: !0 }), I = f.charAt(0) === "/" && w, x = Qe(f);
|
|
870
871
|
return /* @__PURE__ */ e.createElement(
|
|
871
872
|
o.PageLink,
|
|
872
873
|
{
|
|
873
874
|
style: We,
|
|
874
|
-
href: I ? u(w) :
|
|
875
|
-
target:
|
|
875
|
+
href: I ? u(w) : f,
|
|
876
|
+
target: x && x !== c && !f.startsWith("/") ? "blank_" : null
|
|
876
877
|
},
|
|
877
878
|
s
|
|
878
879
|
);
|
|
@@ -916,6 +917,6 @@ export {
|
|
|
916
917
|
Ie as j,
|
|
917
918
|
He as k,
|
|
918
919
|
Ze as l,
|
|
919
|
-
|
|
920
|
+
S as u
|
|
920
921
|
};
|
|
921
|
-
//# sourceMappingURL=asset-wrapper-
|
|
922
|
+
//# sourceMappingURL=asset-wrapper-CaHInqoM.js.map
|