@texonom/nreact 1.4.7 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/build/block.d.ts +20 -20
  2. package/build/components/asset-wrapper.d.ts +6 -6
  3. package/build/components/asset.d.ts +7 -7
  4. package/build/components/audio.d.ts +6 -6
  5. package/build/components/checkbox.d.ts +5 -5
  6. package/build/components/eoi.d.ts +7 -7
  7. package/build/components/file.d.ts +6 -6
  8. package/build/components/google-drive.d.ts +6 -6
  9. package/build/components/graceful-image.d.ts +3 -3
  10. package/build/components/header.d.ts +15 -15
  11. package/build/components/lazy-image.d.ts +13 -13
  12. package/build/components/lite-youtube-embed.d.ts +13 -13
  13. package/build/components/page-aside.d.ts +11 -11
  14. package/build/components/page-icon.d.ts +16 -16
  15. package/build/components/page-title.d.ts +12 -12
  16. package/build/components/search-dialog.d.ts +26 -26
  17. package/build/components/search-dialog.d.ts.map +1 -1
  18. package/build/components/sync-pointer-block.d.ts +6 -6
  19. package/build/components/text.d.ts +19 -19
  20. package/build/context.d.ts +64 -64
  21. package/build/context.d.ts.map +1 -1
  22. package/build/icons/check.d.ts +3 -3
  23. package/build/icons/chevron-down-icon.d.ts +2 -2
  24. package/build/icons/clear-icon.d.ts +2 -2
  25. package/build/icons/collection-view-board.d.ts +3 -3
  26. package/build/icons/collection-view-calendar.d.ts +3 -3
  27. package/build/icons/collection-view-gallery.d.ts +3 -3
  28. package/build/icons/collection-view-icon.d.ts +8 -8
  29. package/build/icons/collection-view-list.d.ts +3 -3
  30. package/build/icons/collection-view-table.d.ts +3 -3
  31. package/build/icons/copy.d.ts +3 -3
  32. package/build/icons/default-page-icon.d.ts +2 -2
  33. package/build/icons/empty-icon.d.ts +2 -2
  34. package/build/icons/file-icon.d.ts +2 -2
  35. package/build/icons/link-icon.d.ts +2 -2
  36. package/build/icons/loading-icon.d.ts +2 -2
  37. package/build/icons/property-icon.d.ts +44 -44
  38. package/build/icons/search-icon.d.ts +2 -2
  39. package/build/icons/type-checkbox.d.ts +3 -3
  40. package/build/icons/type-date.d.ts +3 -3
  41. package/build/icons/type-email.d.ts +3 -3
  42. package/build/icons/type-file.d.ts +3 -3
  43. package/build/icons/type-formula.d.ts +3 -3
  44. package/build/icons/type-github.d.ts +3 -3
  45. package/build/icons/type-multi-select.d.ts +3 -3
  46. package/build/icons/type-number.d.ts +3 -3
  47. package/build/icons/type-person-2.d.ts +3 -3
  48. package/build/icons/type-person.d.ts +3 -3
  49. package/build/icons/type-phone-number.d.ts +3 -3
  50. package/build/icons/type-relation.d.ts +3 -3
  51. package/build/icons/type-select.d.ts +3 -3
  52. package/build/icons/type-text.d.ts +3 -3
  53. package/build/icons/type-timestamp.d.ts +3 -3
  54. package/build/icons/type-title.d.ts +3 -3
  55. package/build/icons/type-url.d.ts +3 -3
  56. package/build/index.d.ts +24 -24
  57. package/build/index.js +1405 -675
  58. package/build/index.js.map +1 -0
  59. package/build/next.d.ts +1 -1
  60. package/build/renderer.d.ts +50 -50
  61. package/build/third-party/code.d.ts +7 -16
  62. package/build/third-party/collection-card.d.ts +3 -3
  63. package/build/third-party/collection-card.d.ts.map +1 -1
  64. package/build/third-party/collection-column-title.d.ts +5 -5
  65. package/build/third-party/collection-group.d.ts +3 -3
  66. package/build/third-party/collection-row.d.ts +7 -7
  67. package/build/third-party/collection-utils.d.ts +2 -2
  68. package/build/third-party/collection-view-board.d.ts +3 -3
  69. package/build/third-party/collection-view-gallery.d.ts +3 -3
  70. package/build/third-party/collection-view-list.d.ts +3 -3
  71. package/build/third-party/collection-view-table.d.ts +3 -3
  72. package/build/third-party/collection-view.d.ts +4 -4
  73. package/build/third-party/collection.d.ts +14 -14
  74. package/build/third-party/equation.d.ts +8 -8
  75. package/build/third-party/eval-formula.d.ts +20 -20
  76. package/build/third-party/modal.d.ts +2 -2
  77. package/build/third-party/pdf.d.ts +4 -4
  78. package/build/third-party/property.d.ts +21 -21
  79. package/build/types.d.ts +93 -93
  80. package/build/utils.d.ts +6 -6
  81. package/package.json +13 -13
  82. package/readme.md +59 -0
  83. package/LICENSE +0 -21
  84. package/README.md +0 -19
  85. package/build/.tsbuildinfo +0 -1
  86. package/build/chunk-2U7I3XVC.js +0 -157
  87. package/build/chunk-72RHNPWF.js +0 -1307
  88. package/build/chunk-C6BUIPAM.js +0 -83
  89. package/build/chunk-FCO7MUK6.js +0 -83
  90. package/build/chunk-H4QYS6CQ.js +0 -1185
  91. package/build/chunk-IMWLLIUB.js +0 -1182
  92. package/build/chunk-P7HX4BAT.js +0 -156
  93. package/build/chunk-VP33CFNB.js +0 -1358
  94. package/build/chunk-YMM43AZ3.js +0 -1207
  95. package/build/dev/chunk-64UJZ76E.js +0 -1308
  96. package/build/dev/chunk-64UJZ76E.js.map +0 -1
  97. package/build/dev/chunk-ABDRHJEI.js +0 -157
  98. package/build/dev/chunk-ABDRHJEI.js.map +0 -1
  99. package/build/dev/chunk-N6EDMIQD.js +0 -1359
  100. package/build/dev/chunk-N6EDMIQD.js.map +0 -1
  101. package/build/dev/chunk-OAIRL2FN.js +0 -84
  102. package/build/dev/chunk-OAIRL2FN.js.map +0 -1
  103. package/build/dev/chunk-P3V5A3W4.js +0 -1183
  104. package/build/dev/chunk-P3V5A3W4.js.map +0 -1
  105. package/build/dev/chunk-PM5CWL6O.js +0 -158
  106. package/build/dev/chunk-PM5CWL6O.js.map +0 -1
  107. package/build/dev/chunk-Q4G2SZRD.js +0 -84
  108. package/build/dev/chunk-Q4G2SZRD.js.map +0 -1
  109. package/build/dev/chunk-SEA7YL2O.js +0 -1308
  110. package/build/dev/chunk-SEA7YL2O.js.map +0 -1
  111. package/build/dev/chunk-SVHGWLRK.js +0 -1208
  112. package/build/dev/chunk-SVHGWLRK.js.map +0 -1
  113. package/build/dev/chunk-ZJAJPWJX.js +0 -1186
  114. package/build/dev/chunk-ZJAJPWJX.js.map +0 -1
  115. package/build/dev/index.js +0 -890
  116. package/build/dev/index.js.map +0 -1
  117. package/build/dev/third-party/code.js +0 -140
  118. package/build/dev/third-party/code.js.map +0 -1
  119. package/build/dev/third-party/collection.js +0 -4382
  120. package/build/dev/third-party/collection.js.map +0 -1
  121. package/build/dev/third-party/equation.js +0 -35
  122. package/build/dev/third-party/equation.js.map +0 -1
  123. package/build/dev/third-party/modal.js +0 -8
  124. package/build/dev/third-party/modal.js.map +0 -1
  125. package/build/dev/third-party/pdf.js +0 -21
  126. package/build/dev/third-party/pdf.js.map +0 -1
  127. package/build/third-party/code.js +0 -139
  128. package/build/third-party/collection.js +0 -4381
  129. package/build/third-party/equation.js +0 -34
  130. package/build/third-party/modal.js +0 -7
  131. package/build/third-party/pdf.js +0 -20
@@ -1,890 +0,0 @@
1
- import {
2
- CollectionColumnTitle,
3
- PropertyIcon,
4
- iconMap
5
- } from "./chunk-ABDRHJEI.js";
6
- import {
7
- Asset,
8
- AssetWrapper,
9
- Breadcrumbs,
10
- Checkbox,
11
- EOI,
12
- GracefulImage,
13
- Header,
14
- LazyImage,
15
- LiteYouTubeEmbed,
16
- NotionContextConsumer,
17
- NotionContextProvider,
18
- PageIcon,
19
- PageIconImpl,
20
- PageTitle,
21
- PageTitleImpl,
22
- Search,
23
- SearchDialog,
24
- Text,
25
- dummyLink,
26
- formatDate,
27
- formatNotionDateTime,
28
- getHashFragmentValue,
29
- getListNumber,
30
- getYoutubeId,
31
- isBrowser,
32
- isUrl,
33
- useNotionContext
34
- } from "./chunk-SVHGWLRK.js";
35
- import {
36
- __commonJS,
37
- __objRest,
38
- __spreadProps,
39
- __spreadValues,
40
- __toESM
41
- } from "./chunk-OAIRL2FN.js";
42
-
43
- // ../../node_modules/.pnpm/lodash.throttle@4.1.1/node_modules/lodash.throttle/index.js
44
- var require_lodash = __commonJS({
45
- "../../node_modules/.pnpm/lodash.throttle@4.1.1/node_modules/lodash.throttle/index.js"(exports, module) {
46
- var FUNC_ERROR_TEXT = "Expected a function";
47
- var NAN = 0 / 0;
48
- var symbolTag = "[object Symbol]";
49
- var reTrim = /^\s+|\s+$/g;
50
- var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
51
- var reIsBinary = /^0b[01]+$/i;
52
- var reIsOctal = /^0o[0-7]+$/i;
53
- var freeParseInt = parseInt;
54
- var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
55
- var freeSelf = typeof self == "object" && self && self.Object === Object && self;
56
- var root = freeGlobal || freeSelf || Function("return this")();
57
- var objectProto = Object.prototype;
58
- var objectToString = objectProto.toString;
59
- var nativeMax = Math.max;
60
- var nativeMin = Math.min;
61
- var now = function() {
62
- return root.Date.now();
63
- };
64
- function debounce(func, wait, options) {
65
- var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
66
- if (typeof func != "function") {
67
- throw new TypeError(FUNC_ERROR_TEXT);
68
- }
69
- wait = toNumber(wait) || 0;
70
- if (isObject(options)) {
71
- leading = !!options.leading;
72
- maxing = "maxWait" in options;
73
- maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
74
- trailing = "trailing" in options ? !!options.trailing : trailing;
75
- }
76
- function invokeFunc(time) {
77
- var args = lastArgs, thisArg = lastThis;
78
- lastArgs = lastThis = void 0;
79
- lastInvokeTime = time;
80
- result = func.apply(thisArg, args);
81
- return result;
82
- }
83
- function leadingEdge(time) {
84
- lastInvokeTime = time;
85
- timerId = setTimeout(timerExpired, wait);
86
- return leading ? invokeFunc(time) : result;
87
- }
88
- function remainingWait(time) {
89
- var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, result2 = wait - timeSinceLastCall;
90
- return maxing ? nativeMin(result2, maxWait - timeSinceLastInvoke) : result2;
91
- }
92
- function shouldInvoke(time) {
93
- var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
94
- return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
95
- }
96
- function timerExpired() {
97
- var time = now();
98
- if (shouldInvoke(time)) {
99
- return trailingEdge(time);
100
- }
101
- timerId = setTimeout(timerExpired, remainingWait(time));
102
- }
103
- function trailingEdge(time) {
104
- timerId = void 0;
105
- if (trailing && lastArgs) {
106
- return invokeFunc(time);
107
- }
108
- lastArgs = lastThis = void 0;
109
- return result;
110
- }
111
- function cancel() {
112
- if (timerId !== void 0) {
113
- clearTimeout(timerId);
114
- }
115
- lastInvokeTime = 0;
116
- lastArgs = lastCallTime = lastThis = timerId = void 0;
117
- }
118
- function flush() {
119
- return timerId === void 0 ? result : trailingEdge(now());
120
- }
121
- function debounced() {
122
- var time = now(), isInvoking = shouldInvoke(time);
123
- lastArgs = arguments;
124
- lastThis = this;
125
- lastCallTime = time;
126
- if (isInvoking) {
127
- if (timerId === void 0) {
128
- return leadingEdge(lastCallTime);
129
- }
130
- if (maxing) {
131
- timerId = setTimeout(timerExpired, wait);
132
- return invokeFunc(lastCallTime);
133
- }
134
- }
135
- if (timerId === void 0) {
136
- timerId = setTimeout(timerExpired, wait);
137
- }
138
- return result;
139
- }
140
- debounced.cancel = cancel;
141
- debounced.flush = flush;
142
- return debounced;
143
- }
144
- function throttle2(func, wait, options) {
145
- var leading = true, trailing = true;
146
- if (typeof func != "function") {
147
- throw new TypeError(FUNC_ERROR_TEXT);
148
- }
149
- if (isObject(options)) {
150
- leading = "leading" in options ? !!options.leading : leading;
151
- trailing = "trailing" in options ? !!options.trailing : trailing;
152
- }
153
- return debounce(func, wait, {
154
- "leading": leading,
155
- "maxWait": wait,
156
- "trailing": trailing
157
- });
158
- }
159
- function isObject(value) {
160
- var type = typeof value;
161
- return !!value && (type == "object" || type == "function");
162
- }
163
- function isObjectLike(value) {
164
- return !!value && typeof value == "object";
165
- }
166
- function isSymbol(value) {
167
- return typeof value == "symbol" || isObjectLike(value) && objectToString.call(value) == symbolTag;
168
- }
169
- function toNumber(value) {
170
- if (typeof value == "number") {
171
- return value;
172
- }
173
- if (isSymbol(value)) {
174
- return NAN;
175
- }
176
- if (isObject(value)) {
177
- var other = typeof value.valueOf == "function" ? value.valueOf() : value;
178
- value = isObject(other) ? other + "" : other;
179
- }
180
- if (typeof value != "string") {
181
- return value === 0 ? value : +value;
182
- }
183
- value = value.replace(reTrim, "");
184
- var isBinary = reIsBinary.test(value);
185
- return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
186
- }
187
- module.exports = throttle2;
188
- }
189
- });
190
-
191
- // src/renderer.tsx
192
- import React9 from "react";
193
- import mediumZoom from "@fisch0920/medium-zoom";
194
-
195
- // src/block.tsx
196
- import React8 from "react";
197
- import {
198
- getBlockCollectionId,
199
- getBlockIcon,
200
- getBlockParentPage,
201
- getPageTableOfContents,
202
- getTextContent,
203
- uuidToId as uuidToId2
204
- } from "@texonom/nutils";
205
-
206
- // src/components/audio.tsx
207
- import React from "react";
208
- var Audio = ({ block, className }) => {
209
- var _a, _b, _c;
210
- const { recordMap } = useNotionContext();
211
- const source = recordMap.signed_urls[block.id] || ((_c = (_b = (_a = block.properties) == null ? void 0 : _a.source) == null ? void 0 : _b[0]) == null ? void 0 : _c[0]);
212
- return /* @__PURE__ */ React.createElement("div", { className: `notion-audio ${className || ""}` }, /* @__PURE__ */ React.createElement("audio", { controls: true, preload: "none", src: source }));
213
- };
214
-
215
- // src/components/file.tsx
216
- import React3 from "react";
217
-
218
- // src/icons/file-icon.tsx
219
- import React2 from "react";
220
- var FileIcon = (props) => {
221
- const _a = props, { className } = _a, rest = __objRest(_a, ["className"]);
222
- return /* @__PURE__ */ React2.createElement("svg", __spreadProps(__spreadValues({ className }, rest), { viewBox: "0 0 30 30" }), /* @__PURE__ */ React2.createElement("path", { d: "M22,8v12c0,3.866-3.134,7-7,7s-7-3.134-7-7V8c0-2.762,2.238-5,5-5s5,2.238,5,5v12c0,1.657-1.343,3-3,3s-3-1.343-3-3V8h-2v12c0,2.762,2.238,5,5,5s5-2.238,5-5V8c0-3.866-3.134-7-7-7S6,4.134,6,8v12c0,4.971,4.029,9,9,9s9-4.029,9-9V8H22z" }));
223
- };
224
-
225
- // src/components/file.tsx
226
- var File = ({ block, className }) => {
227
- var _a, _b, _c, _d, _e;
228
- const { components, recordMap } = useNotionContext();
229
- const source = recordMap.signed_urls[block.id] || ((_c = (_b = (_a = block.properties) == null ? void 0 : _a.source) == null ? void 0 : _b[0]) == null ? void 0 : _c[0]);
230
- return /* @__PURE__ */ React3.createElement("div", { className: `notion-file ${className || ""}` }, /* @__PURE__ */ React3.createElement(components.Link, { className: "notion-file-link", href: source, target: "_blank", rel: "noopener noreferrer" }, /* @__PURE__ */ React3.createElement(FileIcon, { className: "notion-file-icon" }), /* @__PURE__ */ React3.createElement("div", { className: "notion-file-info" }, /* @__PURE__ */ React3.createElement("div", { className: "notion-file-title" }, /* @__PURE__ */ React3.createElement(Text, { value: ((_d = block.properties) == null ? void 0 : _d.title) || [["File"]], block })), ((_e = block.properties) == null ? void 0 : _e.size) && /* @__PURE__ */ React3.createElement("div", { className: "notion-file-size" }, /* @__PURE__ */ React3.createElement(Text, { value: block.properties.size, block })))));
231
- };
232
-
233
- // src/components/google-drive.tsx
234
- import React4 from "react";
235
- var GoogleDrive = ({ block, className }) => {
236
- var _a;
237
- const { components, mapImageUrl } = useNotionContext();
238
- const properties = (_a = block.format) == null ? void 0 : _a.drive_properties;
239
- if (!properties) return null;
240
- let domain;
241
- try {
242
- const url = new URL(properties.url);
243
- domain = url.hostname;
244
- } catch (err) {
245
- }
246
- return /* @__PURE__ */ React4.createElement("div", { className: `notion-google-drive ${className || ""}` }, /* @__PURE__ */ React4.createElement(components.Link, { className: "notion-google-drive-link", href: properties.url, target: "_blank", rel: "noopener noreferrer" }, /* @__PURE__ */ React4.createElement("div", { className: "notion-google-drive-preview" }, /* @__PURE__ */ React4.createElement(
247
- GracefulImage,
248
- {
249
- src: mapImageUrl(properties.thumbnail, block),
250
- alt: properties.title || "Google Drive Document",
251
- loading: "lazy"
252
- }
253
- )), /* @__PURE__ */ React4.createElement("div", { className: "notion-google-drive-body" }, properties.title && /* @__PURE__ */ React4.createElement("div", { className: "notion-google-drive-body-title" }, properties.title), properties.icon && domain && /* @__PURE__ */ React4.createElement("div", { className: "notion-google-drive-body-source" }, properties.icon && /* @__PURE__ */ React4.createElement(
254
- "div",
255
- {
256
- className: "notion-google-drive-body-source-icon",
257
- style: {
258
- backgroundImage: `url(${properties.icon})`
259
- }
260
- }
261
- ), domain && /* @__PURE__ */ React4.createElement("div", { className: "notion-google-drive-body-source-domain" }, domain)))));
262
- };
263
-
264
- // src/components/page-aside.tsx
265
- var import_lodash = __toESM(require_lodash(), 1);
266
- import React5 from "react";
267
- import { uuidToId } from "@texonom/nutils";
268
- var PageAside = ({ toc, activeSection, setActiveSection, pageAside, hasToc, hasAside, className }) => {
269
- const throttleMs = 100;
270
- const actionSectionScrollSpy = React5.useMemo(
271
- () => (0, import_lodash.default)(() => {
272
- const sections = document.getElementsByClassName("notion-h");
273
- let prevBBox = null;
274
- let currentSectionId = activeSection;
275
- for (let i = 0; i < sections.length; ++i) {
276
- const section = sections[i];
277
- if (!section || !(section instanceof Element)) continue;
278
- if (!currentSectionId) currentSectionId = section.getAttribute("data-id");
279
- const bbox = section.getBoundingClientRect();
280
- const prevHeight = prevBBox ? bbox.top - prevBBox.bottom : 0;
281
- const offset = Math.max(150, prevHeight / 4);
282
- if (bbox.top - offset < 0) {
283
- currentSectionId = section.getAttribute("data-id");
284
- prevBBox = bbox;
285
- continue;
286
- }
287
- break;
288
- }
289
- setActiveSection(currentSectionId);
290
- }, throttleMs),
291
- // eslint-disable-next-line react-hooks/exhaustive-deps
292
- [
293
- // explicitly not taking a dependency on activeSection
294
- setActiveSection
295
- ]
296
- );
297
- React5.useEffect(() => {
298
- if (!hasToc) return;
299
- window.addEventListener("scroll", actionSectionScrollSpy);
300
- actionSectionScrollSpy();
301
- return () => {
302
- window.removeEventListener("scroll", actionSectionScrollSpy);
303
- };
304
- }, [hasToc, actionSectionScrollSpy]);
305
- if (!hasAside) return null;
306
- return /* @__PURE__ */ React5.createElement("aside", { className: `notion-aside ${className || ""}` }, hasToc && /* @__PURE__ */ React5.createElement("div", { className: "notion-aside-table-of-contents" }, /* @__PURE__ */ React5.createElement("div", { className: "notion-aside-table-of-contents-header" }, "Table of Contents"), /* @__PURE__ */ React5.createElement("nav", { className: "notion-table-of-contents" }, toc.map((tocItem) => {
307
- const id = uuidToId(tocItem.id);
308
- return /* @__PURE__ */ React5.createElement(
309
- "a",
310
- {
311
- key: id,
312
- href: `#${id}`,
313
- className: `notion-table-of-contents-item
314
- notion-table-of-contents-item-indent-level-${tocItem.indentLevel}
315
- ${activeSection === id && "notion-table-of-contents-active-item"}`
316
- },
317
- /* @__PURE__ */ React5.createElement(
318
- "span",
319
- {
320
- className: "notion-table-of-contents-item-body",
321
- style: {
322
- display: "inline-block",
323
- marginLeft: tocItem.indentLevel * 16
324
- }
325
- },
326
- tocItem.text
327
- )
328
- );
329
- }))), pageAside);
330
- };
331
-
332
- // src/components/sync-pointer-block.tsx
333
- import React6 from "react";
334
- var SyncPointerBlock = ({ block, level }) => {
335
- var _a, _b;
336
- if (!block) {
337
- if (true) console.warn("missing sync pointer block", block.id);
338
- return null;
339
- }
340
- const syncPointerBlock = block;
341
- const referencePointerId = (_b = (_a = syncPointerBlock == null ? void 0 : syncPointerBlock.format) == null ? void 0 : _a.transclusion_reference_pointer) == null ? void 0 : _b.id;
342
- if (!referencePointerId) return null;
343
- return /* @__PURE__ */ React6.createElement(NotionBlockRenderer, { key: referencePointerId, level, blockId: referencePointerId });
344
- };
345
-
346
- // src/icons/link-icon.tsx
347
- import React7 from "react";
348
- var LinkIcon = (props) => {
349
- const _a = props, { className } = _a, rest = __objRest(_a, ["className"]);
350
- return /* @__PURE__ */ React7.createElement("svg", __spreadProps(__spreadValues({ className }, rest), { viewBox: "0 0 16 16", width: "16", height: "16" }), /* @__PURE__ */ React7.createElement(
351
- "path",
352
- {
353
- fillRule: "evenodd",
354
- d: "M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"
355
- }
356
- ));
357
- };
358
-
359
- // src/block.tsx
360
- var tocIndentLevelCache = {};
361
- var pageCoverStyleCache = {};
362
- var Block = (props) => {
363
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q;
364
- const ctx = useNotionContext();
365
- const {
366
- components,
367
- fullPage,
368
- recordMap,
369
- mapPageUrl,
370
- mapImageUrl,
371
- showTableOfContents,
372
- minTableOfContentsItems,
373
- defaultPageIcon,
374
- defaultPageCover,
375
- defaultPageCoverPosition
376
- } = ctx;
377
- const [activeSection, setActiveSection] = React8.useState(null);
378
- const {
379
- block,
380
- children,
381
- level,
382
- className,
383
- bodyClassName,
384
- header,
385
- footer,
386
- pageHeader,
387
- pageFooter,
388
- pageTitle,
389
- pageAside,
390
- pageCover,
391
- hideBlockId,
392
- disableHeader
393
- } = props;
394
- if (!block) return null;
395
- if (level === 0 && block.type === "collection_view") {
396
- const view_block = block;
397
- view_block.type = "collection_view_page";
398
- }
399
- const blockId = hideBlockId ? "notion-block" : `notion-block-${uuidToId2(block.id)}`;
400
- switch (block.type) {
401
- case "collection_view_page":
402
- // fallthrough
403
- case "page":
404
- if (level === 0) {
405
- const {
406
- page_icon = defaultPageIcon,
407
- page_cover = defaultPageCover,
408
- page_cover_position = defaultPageCoverPosition,
409
- page_full_width,
410
- page_small_text
411
- } = block.format || {};
412
- if (fullPage) {
413
- const properties = block.type === "page" ? block.properties : {
414
- title: (_b = (_a = recordMap.collection[getBlockCollectionId(block, recordMap)]) == null ? void 0 : _a.value) == null ? void 0 : _b.name
415
- };
416
- const coverPosition = (1 - (page_cover_position || 0.5)) * 100;
417
- const pageCoverObjectPosition = `center ${coverPosition}%`;
418
- let pageCoverStyle = pageCoverStyleCache[pageCoverObjectPosition];
419
- if (!pageCoverStyle)
420
- pageCoverStyle = pageCoverStyleCache[pageCoverObjectPosition] = {
421
- objectPosition: pageCoverObjectPosition
422
- };
423
- const pageIcon = (_c = getBlockIcon(block, recordMap)) != null ? _c : defaultPageIcon;
424
- const isPageIconUrl = pageIcon && isUrl(pageIcon);
425
- const toc = getPageTableOfContents(block, recordMap);
426
- const hasToc = showTableOfContents && toc.length >= minTableOfContentsItems;
427
- const hasAside = (hasToc || pageAside) && !page_full_width;
428
- const hasPageCover = pageCover || page_cover;
429
- return /* @__PURE__ */ React8.createElement("div", { className: `notion notion-app ${blockId} ${className || ""}` }, /* @__PURE__ */ React8.createElement("div", { className: "notion-viewport" }), /* @__PURE__ */ React8.createElement("div", { className: "notion-frame" }, !disableHeader && /* @__PURE__ */ React8.createElement(components.Header, { block }), header, /* @__PURE__ */ React8.createElement("div", { className: "notion-page-scroller" }, hasPageCover && (pageCover ? pageCover : /* @__PURE__ */ React8.createElement("div", { className: "notion-page-cover-wrapper" }, /* @__PURE__ */ React8.createElement(
430
- LazyImage,
431
- {
432
- src: mapImageUrl(page_cover, block),
433
- alt: getTextContent(properties == null ? void 0 : properties.title),
434
- priority: true,
435
- className: "notion-page-cover",
436
- style: pageCoverStyle
437
- }
438
- ))), /* @__PURE__ */ React8.createElement(
439
- "main",
440
- {
441
- className: `notion-page
442
- ${hasPageCover ? "notion-page-has-cover" : "notion-page-no-cover"}
443
- ${page_icon ? "notion-page-has-icon" : "notion-page-no-icon"}
444
- ${isPageIconUrl ? "notion-page-has-image-icon" : "notion-page-has-text-icon"}
445
- notion-full-page
446
- ${page_full_width && "notion-full-width"}
447
- ${page_small_text && "notion-small-text"}
448
- ${bodyClassName}`
449
- },
450
- page_icon && /* @__PURE__ */ React8.createElement(PageIcon, { block, defaultIcon: defaultPageIcon, inline: false }),
451
- pageHeader,
452
- /* @__PURE__ */ React8.createElement("h1", { className: "notion-title" }, pageTitle != null ? pageTitle : /* @__PURE__ */ React8.createElement(Text, { value: properties == null ? void 0 : properties.title, block })),
453
- (block.type === "collection_view_page" || block.type === "page" && block.parent_table === "collection") && /* @__PURE__ */ React8.createElement(components.Collection, { block, ctx }),
454
- block.type !== "collection_view_page" && /* @__PURE__ */ React8.createElement(
455
- "div",
456
- {
457
- className: `notion-page-content
458
- ${hasAside && "notion-page-content-has-aside"}
459
- ${hasToc && "notion-page-content-has-toc"}`
460
- },
461
- /* @__PURE__ */ React8.createElement("article", { className: "notion-page-content-inner" }, children),
462
- hasAside && /* @__PURE__ */ React8.createElement(
463
- PageAside,
464
- {
465
- toc,
466
- activeSection,
467
- setActiveSection,
468
- hasToc,
469
- hasAside,
470
- pageAside
471
- }
472
- )
473
- ),
474
- pageFooter
475
- ), footer)));
476
- } else {
477
- return /* @__PURE__ */ React8.createElement(
478
- "main",
479
- {
480
- className: `notion
481
- notion-page
482
- ${page_full_width && "notion-full-width"}
483
- ${page_small_text && "notion-small-text"}
484
- ${blockId}
485
- ${className || ""}
486
- ${bodyClassName}`
487
- },
488
- /* @__PURE__ */ React8.createElement("div", { className: "notion-viewport" }),
489
- pageHeader,
490
- (block.type === "collection_view_page" || block.type === "page" && block.parent_table === "collection") && /* @__PURE__ */ React8.createElement(components.Collection, { block, ctx }),
491
- block.type !== "collection_view_page" && children,
492
- pageFooter
493
- );
494
- }
495
- } else {
496
- const blockColor = (_d = block.format) == null ? void 0 : _d.block_color;
497
- return /* @__PURE__ */ React8.createElement(
498
- components.PageLink,
499
- {
500
- className: `notion-page-link ${blockColor && `notion-${blockColor}`} ${blockId}`,
501
- href: mapPageUrl(block.id)
502
- },
503
- /* @__PURE__ */ React8.createElement(PageTitle, { block })
504
- );
505
- }
506
- case "header":
507
- // fallthrough
508
- case "sub_header":
509
- // fallthrough
510
- case "sub_sub_header": {
511
- if (!block.properties) return null;
512
- const blockColor = (_e = block.format) == null ? void 0 : _e.block_color;
513
- const id = uuidToId2(block.id);
514
- const title = getTextContent(block.properties.title) || `Notion Header ${id}`;
515
- let indentLevel = tocIndentLevelCache[block.id];
516
- let indentLevelClass;
517
- if (indentLevel === void 0) {
518
- const page = getBlockParentPage(block, recordMap);
519
- if (page) {
520
- const toc = getPageTableOfContents(page, recordMap);
521
- const tocItem = toc.find((tocItem2) => tocItem2.id === block.id);
522
- if (tocItem) {
523
- indentLevel = tocItem.indentLevel;
524
- tocIndentLevelCache[block.id] = indentLevel;
525
- }
526
- }
527
- }
528
- if (indentLevel !== void 0) indentLevelClass = `notion-h-indent-${indentLevel}`;
529
- const isH1 = block.type === "header";
530
- const isH2 = block.type === "sub_header";
531
- const isH3 = block.type === "sub_sub_header";
532
- const classNameStr = `${isH1 && "notion-h notion-h1"}
533
- ${isH2 && "notion-h notion-h2"}
534
- ${isH3 && "notion-h notion-h3"}
535
- ${blockColor && `notion-${blockColor}`}
536
- ${indentLevelClass},
537
- ${blockId}`;
538
- const innerHeader = /* @__PURE__ */ React8.createElement("span", null, /* @__PURE__ */ React8.createElement("div", { id, className: "notion-header-anchor" }), !((_f = block.format) == null ? void 0 : _f.toggleable) && /* @__PURE__ */ React8.createElement("a", { className: "notion-hash-link", href: `#${id}`, title }, /* @__PURE__ */ React8.createElement(LinkIcon, null)), /* @__PURE__ */ React8.createElement("span", { className: "notion-h-title" }, /* @__PURE__ */ React8.createElement(Text, { value: block.properties.title, block })));
539
- let headerBlock = null;
540
- if (isH1)
541
- headerBlock = /* @__PURE__ */ React8.createElement("h2", { className: classNameStr, "data-id": id }, innerHeader);
542
- else if (isH2)
543
- headerBlock = /* @__PURE__ */ React8.createElement("h3", { className: classNameStr, "data-id": id }, innerHeader);
544
- else
545
- headerBlock = /* @__PURE__ */ React8.createElement("h4", { className: classNameStr, "data-id": id }, innerHeader);
546
- if ((_g = block.format) == null ? void 0 : _g.toggleable)
547
- return /* @__PURE__ */ React8.createElement("details", { className: `notion-toggle ${blockId}` }, /* @__PURE__ */ React8.createElement("summary", null, headerBlock), /* @__PURE__ */ React8.createElement("div", null, children));
548
- else return headerBlock;
549
- }
550
- case "divider":
551
- return /* @__PURE__ */ React8.createElement("hr", { className: `notion-hr ${blockId}` });
552
- case "text": {
553
- if (!block.properties && !((_h = block.content) == null ? void 0 : _h.length)) return /* @__PURE__ */ React8.createElement("div", { className: `notion-blank ${blockId}` }, "\xA0");
554
- const blockColor = (_i = block.format) == null ? void 0 : _i.block_color;
555
- return /* @__PURE__ */ React8.createElement("div", { className: `notion-text ${blockColor && `notion-${blockColor}`} ${blockId}` }, ((_j = block.properties) == null ? void 0 : _j.title) && /* @__PURE__ */ React8.createElement(Text, { value: block.properties.title, block }), children && /* @__PURE__ */ React8.createElement("div", { className: "notion-text-children" }, children));
556
- }
557
- case "bulleted_list":
558
- // fallthrough
559
- case "numbered_list": {
560
- const wrapList = (content, start2) => block.type === "bulleted_list" ? /* @__PURE__ */ React8.createElement("ul", { className: `notion-list notion-list-disc ${blockId}` }, content) : /* @__PURE__ */ React8.createElement("ol", { start: start2, className: `notion-list notion-list-numbered ${blockId}` }, content);
561
- let output = null;
562
- if (block.content)
563
- output = /* @__PURE__ */ React8.createElement(React8.Fragment, null, block.properties && /* @__PURE__ */ React8.createElement("li", null, /* @__PURE__ */ React8.createElement(Text, { value: block.properties.title, block })), wrapList(children));
564
- else
565
- output = block.properties ? /* @__PURE__ */ React8.createElement("li", null, /* @__PURE__ */ React8.createElement(Text, { value: block.properties.title, block })) : null;
566
- const isTopLevel = block.type !== ((_l = (_k = recordMap.block[block.parent_id]) == null ? void 0 : _k.value) == null ? void 0 : _l.type);
567
- const start = getListNumber(block.id, recordMap.block);
568
- return isTopLevel ? wrapList(output, start) : output;
569
- }
570
- case "embed":
571
- return /* @__PURE__ */ React8.createElement(components.Embed, { blockId, block });
572
- case "tweet":
573
- // fallthrough
574
- case "maps":
575
- // fallthrough
576
- case "pdf":
577
- // fallthrough
578
- case "figma":
579
- // fallthrough
580
- case "typeform":
581
- // fallthrough
582
- case "codepen":
583
- // fallthrough
584
- case "excalidraw":
585
- // fallthrough
586
- case "image":
587
- // fallthrough
588
- case "gist":
589
- // fallthrough
590
- case "video":
591
- return /* @__PURE__ */ React8.createElement(AssetWrapper, { blockId, block });
592
- case "drive": {
593
- const properties = (_m = block.format) == null ? void 0 : _m.drive_properties;
594
- if (!properties) {
595
- if ((_n = block.format) == null ? void 0 : _n.display_source)
596
- return /* @__PURE__ */ React8.createElement(AssetWrapper, { blockId, block });
597
- }
598
- return /* @__PURE__ */ React8.createElement(GoogleDrive, { block, className: blockId });
599
- }
600
- case "audio":
601
- return /* @__PURE__ */ React8.createElement(Audio, { block, className: blockId });
602
- case "file":
603
- return /* @__PURE__ */ React8.createElement(File, { block, className: blockId });
604
- case "equation":
605
- return /* @__PURE__ */ React8.createElement(components.Equation, { block, inline: false, className: blockId });
606
- case "code":
607
- return /* @__PURE__ */ React8.createElement(components.Code, { block });
608
- case "column_list":
609
- return /* @__PURE__ */ React8.createElement("div", { className: `notion-row ${blockId}` }, children);
610
- case "column": {
611
- const spacerWidth = `min(32px, 4vw)`;
612
- const ratio = ((_o = block.format) == null ? void 0 : _o.column_ratio) || 0.5;
613
- const parent = (_p = recordMap.block[block.parent_id]) == null ? void 0 : _p.value;
614
- const columns = ((_q = parent == null ? void 0 : parent.content) == null ? void 0 : _q.length) || Math.max(2, Math.ceil(1 / ratio));
615
- const width = `calc((100% - (${columns - 1} * ${spacerWidth})) * ${ratio})`;
616
- const style = { width };
617
- return /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement("div", { className: `notion-column ${blockId}`, style }, children), /* @__PURE__ */ React8.createElement("div", { className: "notion-spacer" }));
618
- }
619
- case "quote": {
620
- if (!block.properties) return null;
621
- const blockColor = (_r = block.format) == null ? void 0 : _r.block_color;
622
- return /* @__PURE__ */ React8.createElement("blockquote", { className: `notion-quote ${blockColor && `notion-${blockColor}`} ${blockId}` }, /* @__PURE__ */ React8.createElement("div", null, /* @__PURE__ */ React8.createElement(Text, { value: block.properties.title, block })), children);
623
- }
624
- case "collection_view":
625
- return /* @__PURE__ */ React8.createElement(components.Collection, { block, className: blockId, ctx });
626
- case "callout":
627
- if (components.Callout) return /* @__PURE__ */ React8.createElement(components.Callout, { block, className: blockId });
628
- else
629
- return /* @__PURE__ */ React8.createElement(
630
- "div",
631
- {
632
- className: `notion-callout ${((_s = block.format) == null ? void 0 : _s.block_color) && `notion-${(_t = block.format) == null ? void 0 : _t.block_color}_co`} ${blockId}`
633
- },
634
- /* @__PURE__ */ React8.createElement(PageIcon, { block }),
635
- /* @__PURE__ */ React8.createElement("div", { className: "notion-callout-text" }, /* @__PURE__ */ React8.createElement(Text, { value: (_u = block.properties) == null ? void 0 : _u.title, block }), children)
636
- );
637
- case "bookmark": {
638
- if (!block.properties) return null;
639
- const link = block.properties.link;
640
- if (!link || !((_v = link[0]) == null ? void 0 : _v[0])) return null;
641
- let title = getTextContent(block.properties.title);
642
- if (!title) title = getTextContent(link);
643
- if (title) {
644
- if (title.startsWith("http"))
645
- try {
646
- const url = new URL(title);
647
- title = url.hostname;
648
- } catch (err) {
649
- }
650
- }
651
- return /* @__PURE__ */ React8.createElement("div", { className: "notion-row" }, /* @__PURE__ */ React8.createElement(
652
- components.Link,
653
- {
654
- target: "_blank",
655
- rel: "noopener noreferrer",
656
- className: `notion-bookmark ${((_w = block.format) == null ? void 0 : _w.block_color) && `notion-${block.format.block_color}`} ${blockId}`,
657
- href: link[0][0]
658
- },
659
- /* @__PURE__ */ React8.createElement("div", null, title && /* @__PURE__ */ React8.createElement("div", { className: "notion-bookmark-title" }, /* @__PURE__ */ React8.createElement(Text, { value: [[title]], block })), ((_x = block.properties) == null ? void 0 : _x.description) && /* @__PURE__ */ React8.createElement("div", { className: "notion-bookmark-description" }, /* @__PURE__ */ React8.createElement(Text, { value: (_y = block.properties) == null ? void 0 : _y.description, block })), /* @__PURE__ */ React8.createElement("div", { className: "notion-bookmark-link" }, ((_z = block.format) == null ? void 0 : _z.bookmark_icon) && /* @__PURE__ */ React8.createElement("div", { className: "notion-bookmark-link-icon" }, /* @__PURE__ */ React8.createElement(LazyImage, { src: mapImageUrl((_A = block.format) == null ? void 0 : _A.bookmark_icon, block), alt: title })), /* @__PURE__ */ React8.createElement("div", { className: "notion-bookmark-link-text" }, /* @__PURE__ */ React8.createElement(Text, { value: link, block })))),
660
- ((_B = block.format) == null ? void 0 : _B.bookmark_cover) && /* @__PURE__ */ React8.createElement("div", { className: "notion-bookmark-image" }, /* @__PURE__ */ React8.createElement(
661
- LazyImage,
662
- {
663
- src: mapImageUrl((_C = block.format) == null ? void 0 : _C.bookmark_cover, block),
664
- alt: getTextContent((_D = block.properties) == null ? void 0 : _D.title),
665
- style: {
666
- objectFit: "cover"
667
- }
668
- }
669
- ))
670
- ));
671
- }
672
- case "toggle":
673
- return /* @__PURE__ */ React8.createElement("details", { className: `notion-toggle ${blockId}` }, /* @__PURE__ */ React8.createElement("summary", null, /* @__PURE__ */ React8.createElement(Text, { value: (_E = block.properties) == null ? void 0 : _E.title, block })), /* @__PURE__ */ React8.createElement("div", null, children));
674
- case "table_of_contents": {
675
- const page = getBlockParentPage(block, recordMap);
676
- if (!page) return null;
677
- const toc = getPageTableOfContents(page, recordMap);
678
- const blockColor = (_F = block.format) == null ? void 0 : _F.block_color;
679
- return /* @__PURE__ */ React8.createElement("div", { className: `notion-table-of-contents ${blockColor && `notion-${blockColor}`} ${blockId}` }, toc.map((tocItem) => /* @__PURE__ */ React8.createElement("a", { key: tocItem.id, href: `#${uuidToId2(tocItem.id)}`, className: "notion-table-of-contents-item" }, /* @__PURE__ */ React8.createElement(
680
- "span",
681
- {
682
- className: "notion-table-of-contents-item-body",
683
- style: {
684
- display: "inline-block",
685
- marginLeft: tocItem.indentLevel * 24
686
- }
687
- },
688
- tocItem.text
689
- ))));
690
- }
691
- case "to_do": {
692
- const isChecked = ((_I = (_H = (_G = block.properties) == null ? void 0 : _G.checked) == null ? void 0 : _H[0]) == null ? void 0 : _I[0]) === "Yes";
693
- return /* @__PURE__ */ React8.createElement("div", { className: `notion-to-do ${blockId}` }, /* @__PURE__ */ React8.createElement("div", { className: "notion-to-do-item" }, /* @__PURE__ */ React8.createElement(components.Checkbox, { blockId, isChecked }), /* @__PURE__ */ React8.createElement("div", { className: `notion-to-do-body ${isChecked && `notion-to-do-checked`}` }, /* @__PURE__ */ React8.createElement(Text, { value: (_J = block.properties) == null ? void 0 : _J.title, block }))), /* @__PURE__ */ React8.createElement("div", { className: "notion-to-do-children" }, children));
694
- }
695
- case "transclusion_container":
696
- return /* @__PURE__ */ React8.createElement("div", { className: `notion-sync-block ${blockId}` }, children);
697
- case "transclusion_reference":
698
- return /* @__PURE__ */ React8.createElement(SyncPointerBlock, __spreadValues({ block, level: level + 1 }, props));
699
- case "alias": {
700
- const blockPointerId = (_L = (_K = block == null ? void 0 : block.format) == null ? void 0 : _K.alias_pointer) == null ? void 0 : _L.id;
701
- const linkedBlock = (_M = recordMap.block[blockPointerId]) == null ? void 0 : _M.value;
702
- if (!linkedBlock) {
703
- console.debug('"alias" missing block', blockPointerId);
704
- return null;
705
- }
706
- return /* @__PURE__ */ React8.createElement(components.PageLink, { className: `notion-page-link ${blockPointerId}}`, href: mapPageUrl(blockPointerId) }, /* @__PURE__ */ React8.createElement(PageTitle, { block: linkedBlock }));
707
- }
708
- case "table":
709
- return /* @__PURE__ */ React8.createElement("table", { className: `notion-simple-table ${blockId}` }, /* @__PURE__ */ React8.createElement("tbody", null, children));
710
- case "table_row": {
711
- const tableBlock = (_N = recordMap.block[block.parent_id]) == null ? void 0 : _N.value;
712
- const order = (_O = tableBlock.format) == null ? void 0 : _O.table_block_column_order;
713
- const formatMap = (_P = tableBlock.format) == null ? void 0 : _P.table_block_column_format;
714
- const backgroundColor = (_Q = block.format) == null ? void 0 : _Q.block_color;
715
- if (!tableBlock || !order) return null;
716
- return /* @__PURE__ */ React8.createElement("tr", { className: `notion-simple-table-row ${backgroundColor && `notion-${backgroundColor}`} ${blockId}` }, order.map((column) => {
717
- var _a2, _b2, _c2;
718
- const color = (_a2 = formatMap == null ? void 0 : formatMap[column]) == null ? void 0 : _a2.color;
719
- return /* @__PURE__ */ React8.createElement(
720
- "td",
721
- {
722
- key: column,
723
- className: color ? `notion-${color}` : "",
724
- style: {
725
- width: ((_b2 = formatMap == null ? void 0 : formatMap[column]) == null ? void 0 : _b2.width) || 120
726
- }
727
- },
728
- /* @__PURE__ */ React8.createElement("div", { className: "notion-simple-table-cell" }, /* @__PURE__ */ React8.createElement(Text, { value: ((_c2 = block.properties) == null ? void 0 : _c2[column]) || [["\u3164"]], block }))
729
- );
730
- }));
731
- }
732
- case "external_object_instance":
733
- return /* @__PURE__ */ React8.createElement(EOI, { block, className: blockId });
734
- default:
735
- if (true)
736
- console.debug("Unsupported type " + block.type, JSON.stringify(block, null, 2));
737
- return /* @__PURE__ */ React8.createElement("div", null);
738
- }
739
- };
740
-
741
- // src/renderer.tsx
742
- var NotionRenderer = (_a) => {
743
- var _b = _a, {
744
- components,
745
- recordMap,
746
- mapPageUrl,
747
- mapImageUrl,
748
- searchNotion,
749
- isShowingSearch,
750
- onHideSearch,
751
- fullPage,
752
- rootPageId,
753
- rootDomain,
754
- rootSpaceId,
755
- darkMode,
756
- previewImages,
757
- forceCustomImages,
758
- showCollectionViewDropdown,
759
- linkTableTitleProperties,
760
- isLinkCollectionToUrlProperty,
761
- isImageZoomable = true,
762
- showTableOfContents,
763
- minTableOfContentsItems,
764
- defaultPageIcon,
765
- defaultPageCover,
766
- defaultPageCoverPosition
767
- } = _b, rest = __objRest(_b, [
768
- "components",
769
- "recordMap",
770
- "mapPageUrl",
771
- "mapImageUrl",
772
- "searchNotion",
773
- "isShowingSearch",
774
- "onHideSearch",
775
- "fullPage",
776
- "rootPageId",
777
- "rootDomain",
778
- "rootSpaceId",
779
- "darkMode",
780
- "previewImages",
781
- "forceCustomImages",
782
- "showCollectionViewDropdown",
783
- "linkTableTitleProperties",
784
- "isLinkCollectionToUrlProperty",
785
- "isImageZoomable",
786
- "showTableOfContents",
787
- "minTableOfContentsItems",
788
- "defaultPageIcon",
789
- "defaultPageCover",
790
- "defaultPageCoverPosition"
791
- ]);
792
- const zoom = React9.useMemo(
793
- () => typeof window !== "undefined" && mediumZoom({
794
- background: "rgba(0, 0, 0, 0.8)",
795
- minZoomScale: 2,
796
- margin: getMediumZoomMargin()
797
- }),
798
- []
799
- );
800
- return /* @__PURE__ */ React9.createElement(
801
- NotionContextProvider,
802
- {
803
- components,
804
- recordMap,
805
- mapPageUrl,
806
- mapImageUrl,
807
- searchNotion,
808
- isShowingSearch,
809
- onHideSearch,
810
- fullPage,
811
- rootPageId,
812
- rootDomain,
813
- rootSpaceId,
814
- darkMode,
815
- previewImages,
816
- forceCustomImages,
817
- showCollectionViewDropdown,
818
- linkTableTitleProperties,
819
- isLinkCollectionToUrlProperty,
820
- showTableOfContents,
821
- minTableOfContentsItems,
822
- defaultPageIcon,
823
- defaultPageCover,
824
- defaultPageCoverPosition,
825
- zoom: isImageZoomable ? zoom : null
826
- },
827
- /* @__PURE__ */ React9.createElement(NotionBlockRenderer, __spreadValues({}, rest))
828
- );
829
- };
830
- var NotionBlockRenderer = (_a) => {
831
- var _b = _a, { level = 0, blockId } = _b, props = __objRest(_b, ["level", "blockId"]);
832
- var _a2, _b2;
833
- const { recordMap } = useNotionContext();
834
- const id = blockId || Object.keys(recordMap.block)[0];
835
- const block = (_a2 = recordMap.block[id]) == null ? void 0 : _a2.value;
836
- if (!block) {
837
- if (true) console.warn("missing block", blockId);
838
- return null;
839
- }
840
- return /* @__PURE__ */ React9.createElement(Block, __spreadValues({ key: id, level, block }, props), (_b2 = block == null ? void 0 : block.content) == null ? void 0 : _b2.map((contentBlockId) => /* @__PURE__ */ React9.createElement(NotionBlockRenderer, __spreadValues({ key: contentBlockId, blockId: contentBlockId, level: level + 1 }, props))));
841
- };
842
- function getMediumZoomMargin() {
843
- const width = window.innerWidth;
844
- if (width < 500) return 8;
845
- else if (width < 800) return 20;
846
- else if (width < 1280) return 30;
847
- else if (width < 1600) return 40;
848
- else if (width < 1920) return 48;
849
- else return 72;
850
- }
851
- export {
852
- Asset,
853
- AssetWrapper,
854
- Audio,
855
- Block,
856
- Breadcrumbs,
857
- Checkbox,
858
- CollectionColumnTitle,
859
- EOI,
860
- File,
861
- GoogleDrive,
862
- GracefulImage,
863
- Header,
864
- LiteYouTubeEmbed,
865
- NotionBlockRenderer,
866
- NotionContextConsumer,
867
- NotionContextProvider,
868
- NotionRenderer,
869
- PageAside,
870
- PageIcon,
871
- PageIconImpl,
872
- PageTitle,
873
- PageTitleImpl,
874
- PropertyIcon,
875
- Search,
876
- SearchDialog,
877
- SyncPointerBlock,
878
- Text,
879
- dummyLink,
880
- formatDate,
881
- formatNotionDateTime,
882
- getHashFragmentValue,
883
- getListNumber,
884
- getYoutubeId,
885
- iconMap,
886
- isBrowser,
887
- isUrl,
888
- useNotionContext
889
- };
890
- //# sourceMappingURL=index.js.map