@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,35 +0,0 @@
1
- import {
2
- useNotionContext
3
- } from "../chunk-SVHGWLRK.js";
4
- import {
5
- __objRest,
6
- __spreadValues
7
- } from "../chunk-OAIRL2FN.js";
8
-
9
- // src/third-party/equation.tsx
10
- import React from "react";
11
- import Katex from "@matejmazur/react-katex";
12
- import { getBlockTitle } from "@texonom/nutils";
13
- var katexSettings = {
14
- throwOnError: false,
15
- strict: false
16
- };
17
- var Equation = (_a) => {
18
- var _b = _a, { block, math, inline = false, className } = _b, rest = __objRest(_b, ["block", "math", "inline", "className"]);
19
- const { recordMap } = useNotionContext();
20
- math = math || getBlockTitle(block, recordMap);
21
- if (!math) return null;
22
- return /* @__PURE__ */ React.createElement(
23
- "span",
24
- {
25
- role: "button",
26
- tabIndex: 0,
27
- className: `notion-equation ${inline ? "notion-equation-inline" : "notion-equation-block"} ${className || ""}`
28
- },
29
- /* @__PURE__ */ React.createElement(Katex, __spreadValues({ math, settings: katexSettings }, rest))
30
- );
31
- };
32
- export {
33
- Equation
34
- };
35
- //# sourceMappingURL=equation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/third-party/equation.tsx"],"sourcesContent":["import React from 'react'\n\nimport Katex from '@matejmazur/react-katex'\nimport { EquationBlock } from '@texonom/ntypes'\nimport { getBlockTitle } from '@texonom/nutils'\n\nimport { useNotionContext } from '../context'\n\nconst katexSettings = {\n throwOnError: false,\n strict: false\n}\n\nexport const Equation: React.FC<{\n block: EquationBlock\n math?: string\n inline?: boolean\n className?: string\n}> = ({ block, math, inline = false, className, ...rest }) => {\n const { recordMap } = useNotionContext()\n math = math || getBlockTitle(block, recordMap)\n if (!math) return null\n\n return (\n <span\n role='button'\n tabIndex={0}\n className={`notion-equation ${inline ? 'notion-equation-inline' : 'notion-equation-block'} ${className || ''}`}>\n <Katex math={math} settings={katexSettings} {...rest} />\n </span>\n )\n}\n"],"mappings":";;;;;;;;;AAAA,OAAO,WAAW;AAElB,OAAO,WAAW;AAElB,SAAS,qBAAqB;AAI9B,IAAM,gBAAgB;AAAA,EACpB,cAAc;AAAA,EACd,QAAQ;AACV;AAEO,IAAM,WAKR,CAAC,OAAwD;AAAxD,eAAE,SAAO,MAAM,SAAS,OAAO,UAlBrC,IAkBM,IAA6C,iBAA7C,IAA6C,CAA3C,SAAO,QAAM,UAAgB;AACnC,QAAM,EAAE,UAAU,IAAI,iBAAiB;AACvC,SAAO,QAAQ,cAAc,OAAO,SAAS;AAC7C,MAAI,CAAC,KAAM,QAAO;AAElB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,UAAU;AAAA,MACV,WAAW,mBAAmB,SAAS,2BAA2B,uBAAuB,IAAI,aAAa,EAAE;AAAA;AAAA,IAC5G,oCAAC,wBAAM,MAAY,UAAU,iBAAmB,KAAM;AAAA,EACxD;AAEJ;","names":[]}
@@ -1,8 +0,0 @@
1
- import "../chunk-OAIRL2FN.js";
2
-
3
- // src/third-party/modal.tsx
4
- import Modal from "react-modal";
5
- export {
6
- Modal
7
- };
8
- //# sourceMappingURL=modal.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/third-party/modal.tsx"],"sourcesContent":["import Modal from 'react-modal'\n\nexport { Modal }\n"],"mappings":";;;AAAA,OAAO,WAAW;","names":[]}
@@ -1,21 +0,0 @@
1
- import {
2
- __objRest,
3
- __spreadValues
4
- } from "../chunk-OAIRL2FN.js";
5
-
6
- // src/third-party/pdf.tsx
7
- import React from "react";
8
- import { Document, Page, pdfjs } from "react-pdf";
9
- pdfjs.GlobalWorkerOptions.workerSrc = `//unpkg.com/pdfjs-dist@${pdfjs.version}/legacy/build/pdf.worker.min.js`;
10
- var Pdf = (_a) => {
11
- var _b = _a, { file } = _b, rest = __objRest(_b, ["file"]);
12
- const [numPages, setNumPages] = React.useState(null);
13
- function onDocumentLoadSuccess({ numPages: numPages2 }) {
14
- setNumPages(numPages2);
15
- }
16
- return /* @__PURE__ */ React.createElement(Document, __spreadValues({ file, onLoadSuccess: onDocumentLoadSuccess }, rest), Array.from(new Array(numPages), (_, index) => /* @__PURE__ */ React.createElement(Page, { key: `page_${index + 1}`, pageNumber: index + 1 })));
17
- };
18
- export {
19
- Pdf
20
- };
21
- //# sourceMappingURL=pdf.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/third-party/pdf.tsx"],"sourcesContent":["import React from 'react'\n\nimport { Document, Page, pdfjs } from 'react-pdf'\n\n// ensure pdfjs can find its worker script regardless of how nreact is bundled\npdfjs.GlobalWorkerOptions.workerSrc = `//unpkg.com/pdfjs-dist@${pdfjs.version}/legacy/build/pdf.worker.min.js`\n\nexport const Pdf: React.FC<{ file: string }> = ({ file, ...rest }) => {\n const [numPages, setNumPages] = React.useState(null)\n\n function onDocumentLoadSuccess({ numPages }) {\n setNumPages(numPages)\n }\n\n return (\n <Document file={file} onLoadSuccess={onDocumentLoadSuccess} {...rest}>\n {Array.from(new Array(numPages), (_, index) => (\n <Page key={`page_${index + 1}`} pageNumber={index + 1} />\n ))}\n </Document>\n )\n}\n"],"mappings":";;;;;;AAAA,OAAO,WAAW;AAElB,SAAS,UAAU,MAAM,aAAa;AAGtC,MAAM,oBAAoB,YAAY,0BAA0B,MAAM,OAAO;AAEtE,IAAM,MAAkC,CAAC,OAAsB;AAAtB,eAAE,OAPlD,IAOgD,IAAW,iBAAX,IAAW,CAAT;AAChD,QAAM,CAAC,UAAU,WAAW,IAAI,MAAM,SAAS,IAAI;AAEnD,WAAS,sBAAsB,EAAE,UAAAA,UAAS,GAAG;AAC3C,gBAAYA,SAAQ;AAAA,EACtB;AAEA,SACE,oCAAC,2BAAS,MAAY,eAAe,yBAA2B,OAC7D,MAAM,KAAK,IAAI,MAAM,QAAQ,GAAG,CAAC,GAAG,UACnC,oCAAC,QAAK,KAAK,QAAQ,QAAQ,CAAC,IAAI,YAAY,QAAQ,GAAG,CACxD,CACH;AAEJ;","names":["numPages"]}
@@ -1,139 +0,0 @@
1
- import {
2
- Text,
3
- useNotionContext
4
- } from "../chunk-YMM43AZ3.js";
5
- import {
6
- __async,
7
- __commonJS,
8
- __spreadValues,
9
- __toESM
10
- } from "../chunk-C6BUIPAM.js";
11
-
12
- // ../../node_modules/.pnpm/clipboard-copy@4.0.1/node_modules/clipboard-copy/index.js
13
- var require_clipboard_copy = __commonJS({
14
- "../../node_modules/.pnpm/clipboard-copy@4.0.1/node_modules/clipboard-copy/index.js"(exports, module) {
15
- module.exports = clipboardCopy;
16
- function makeError() {
17
- return new DOMException("The request is not allowed", "NotAllowedError");
18
- }
19
- function copyClipboardApi(text) {
20
- return __async(this, null, function* () {
21
- if (!navigator.clipboard) {
22
- throw makeError();
23
- }
24
- return navigator.clipboard.writeText(text);
25
- });
26
- }
27
- function copyExecCommand(text) {
28
- return __async(this, null, function* () {
29
- const span = document.createElement("span");
30
- span.textContent = text;
31
- span.style.whiteSpace = "pre";
32
- span.style.webkitUserSelect = "auto";
33
- span.style.userSelect = "all";
34
- document.body.appendChild(span);
35
- const selection = window.getSelection();
36
- const range = window.document.createRange();
37
- selection.removeAllRanges();
38
- range.selectNode(span);
39
- selection.addRange(range);
40
- let success = false;
41
- try {
42
- success = window.document.execCommand("copy");
43
- } finally {
44
- selection.removeAllRanges();
45
- window.document.body.removeChild(span);
46
- }
47
- if (!success) throw makeError();
48
- });
49
- }
50
- function clipboardCopy(text) {
51
- return __async(this, null, function* () {
52
- try {
53
- yield copyClipboardApi(text);
54
- } catch (err) {
55
- try {
56
- yield copyExecCommand(text);
57
- } catch (err2) {
58
- throw err2 || err || makeError();
59
- }
60
- }
61
- });
62
- }
63
- }
64
- });
65
-
66
- // src/third-party/code.tsx
67
- var import_clipboard_copy = __toESM(require_clipboard_copy(), 1);
68
- import React2 from "react";
69
- import { getBlockTitle } from "@texonom/nutils";
70
- import { highlightElement } from "prismjs";
71
- import "prismjs/components/prism-clike.min.js";
72
- import "prismjs/components/prism-css-extras.min.js";
73
- import "prismjs/components/prism-css.min.js";
74
- import "prismjs/components/prism-javascript.min.js";
75
- import "prismjs/components/prism-js-extras.min.js";
76
- import "prismjs/components/prism-json.min.js";
77
- import "prismjs/components/prism-jsx.min.js";
78
- import "prismjs/components/prism-tsx.min.js";
79
- import "prismjs/components/prism-typescript.min.js";
80
-
81
- // src/icons/copy.tsx
82
- import React from "react";
83
- function SvgCopy(props) {
84
- return /* @__PURE__ */ React.createElement("svg", __spreadValues({ fill: "currentColor", viewBox: "0 0 16 16", width: "1em", version: "1.1" }, props), /* @__PURE__ */ React.createElement(
85
- "path",
86
- {
87
- fillRule: "evenodd",
88
- d: "M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"
89
- }
90
- ), /* @__PURE__ */ React.createElement(
91
- "path",
92
- {
93
- fillRule: "evenodd",
94
- d: "M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"
95
- }
96
- ));
97
- }
98
- var copy_default = SvgCopy;
99
-
100
- // src/third-party/code.tsx
101
- var Code = ({ block, defaultLanguage = "typescript", className }) => {
102
- var _a, _b, _c;
103
- const [isCopied, setIsCopied] = React2.useState(false);
104
- const copyTimeout = React2.useRef(null);
105
- const { recordMap } = useNotionContext();
106
- const content = getBlockTitle(block, recordMap);
107
- const language = (((_c = (_b = (_a = block.properties) == null ? void 0 : _a.language) == null ? void 0 : _b[0]) == null ? void 0 : _c[0]) || defaultLanguage).toLowerCase();
108
- const caption = block.properties.caption;
109
- const codeRef = React2.useRef(null);
110
- React2.useEffect(() => {
111
- if (codeRef.current)
112
- try {
113
- highlightElement(codeRef.current);
114
- } catch (err) {
115
- console.warn("prismjs highlight error", err);
116
- }
117
- }, [codeRef]);
118
- const onClickCopyToClipboard = React2.useCallback(() => {
119
- (0, import_clipboard_copy.default)(content);
120
- setIsCopied(true);
121
- if (copyTimeout.current) {
122
- clearTimeout(copyTimeout.current);
123
- copyTimeout.current = null;
124
- }
125
- copyTimeout.current = setTimeout(() => {
126
- setIsCopied(false);
127
- }, 1200);
128
- }, [content, copyTimeout]);
129
- const copyButton = /* @__PURE__ */ React2.createElement("div", { className: "notion-code-copy-button", onClick: onClickCopyToClipboard }, /* @__PURE__ */ React2.createElement(copy_default, null));
130
- return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement("pre", { className: `notion-code ${className || ""}` }, /* @__PURE__ */ React2.createElement("div", { className: "notion-code-copy" }, copyButton, isCopied && /* @__PURE__ */ React2.createElement("div", { className: "notion-code-copy-tooltip" }, /* @__PURE__ */ React2.createElement("div", null, isCopied ? "Copied" : "Copy"))), /* @__PURE__ */ React2.createElement("code", { className: `language-${language}`, ref: codeRef }, content)), caption && /* @__PURE__ */ React2.createElement("figcaption", { className: "notion-asset-caption" }, /* @__PURE__ */ React2.createElement(Text, { value: caption, block })));
131
- };
132
- export {
133
- Code
134
- };
135
- /*! Bundled license information:
136
-
137
- clipboard-copy/index.js:
138
- (*! clipboard-copy. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
139
- */