@texonom/nreact 1.3.0 → 1.4.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 (78) hide show
  1. package/build/.tsbuildinfo +1 -1
  2. package/build/{chunk-HJGIONX2.js → chunk-72RHNPWF.js} +56 -107
  3. package/build/{chunk-LB5ZQ7L5.js → chunk-P7HX4BAT.js} +2 -3
  4. package/build/dev/{chunk-NVAEYUJK.js → chunk-64UJZ76E.js} +57 -108
  5. package/build/dev/{chunk-NVAEYUJK.js.map → chunk-64UJZ76E.js.map} +1 -1
  6. package/build/dev/{chunk-CWNFRR32.js → chunk-ABDRHJEI.js} +3 -4
  7. package/build/dev/{chunk-CWNFRR32.js.map → chunk-ABDRHJEI.js.map} +1 -1
  8. package/build/dev/{chunk-JX5CEG3A.js → chunk-OAIRL2FN.js} +1 -1
  9. package/build/dev/{chunk-4XJBBVRZ.js → chunk-SEA7YL2O.js} +57 -108
  10. package/build/dev/chunk-SEA7YL2O.js.map +1 -0
  11. package/build/dev/index.js +42 -55
  12. package/build/dev/index.js.map +1 -1
  13. package/build/dev/third-party/code.js +3 -4
  14. package/build/dev/third-party/code.js.map +1 -1
  15. package/build/dev/third-party/collection.js +137 -113
  16. package/build/dev/third-party/collection.js.map +1 -1
  17. package/build/dev/third-party/equation.js +3 -4
  18. package/build/dev/third-party/equation.js.map +1 -1
  19. package/build/dev/third-party/modal.js +1 -1
  20. package/build/dev/third-party/pdf.js +1 -1
  21. package/build/index.js +42 -55
  22. package/build/next.d.ts.map +1 -1
  23. package/build/third-party/code.js +3 -4
  24. package/build/third-party/collection.js +137 -113
  25. package/build/third-party/equation.js +3 -4
  26. package/build/third-party/modal.js +1 -1
  27. package/build/third-party/pdf.js +1 -1
  28. package/build/utils.d.ts.map +1 -1
  29. package/package.json +13 -13
  30. package/build/chunk-26XPY26R.js +0 -1364
  31. package/build/chunk-3GUXT4PT.js +0 -1386
  32. package/build/chunk-3R4ITV3N.js +0 -1358
  33. package/build/chunk-626ANHMX.js +0 -4519
  34. package/build/chunk-BYOAK6PN.js +0 -1362
  35. package/build/chunk-E7SOYYOP.js +0 -1364
  36. package/build/chunk-GDUEQGYI.js +0 -1373
  37. package/build/chunk-INDII3MG.js +0 -1346
  38. package/build/chunk-LAZZ76RR.js +0 -142
  39. package/build/chunk-NH6F5YHO.js +0 -90
  40. package/build/chunk-THLNCQWF.js +0 -1364
  41. package/build/chunk-YEVPS76Z.js +0 -1355
  42. package/build/dev/chunk-2LHADYU7.js +0 -1365
  43. package/build/dev/chunk-2LHADYU7.js.map +0 -1
  44. package/build/dev/chunk-4XJBBVRZ.js.map +0 -1
  45. package/build/dev/chunk-5DDQTDIS.js +0 -1365
  46. package/build/dev/chunk-5DDQTDIS.js.map +0 -1
  47. package/build/dev/chunk-73CYHEZ6.js +0 -1374
  48. package/build/dev/chunk-73CYHEZ6.js.map +0 -1
  49. package/build/dev/chunk-7R2ZX3WF.js +0 -1359
  50. package/build/dev/chunk-7R2ZX3WF.js.map +0 -1
  51. package/build/dev/chunk-CRSVOVI5.js +0 -1387
  52. package/build/dev/chunk-CRSVOVI5.js.map +0 -1
  53. package/build/dev/chunk-EDEWD2W7.js +0 -1363
  54. package/build/dev/chunk-EDEWD2W7.js.map +0 -1
  55. package/build/dev/chunk-O5ZUWUSN.js +0 -158
  56. package/build/dev/chunk-O5ZUWUSN.js.map +0 -1
  57. package/build/dev/chunk-QAD7OWKG.js +0 -91
  58. package/build/dev/chunk-QAD7OWKG.js.map +0 -1
  59. package/build/dev/chunk-QHYYIFZL.js +0 -1365
  60. package/build/dev/chunk-QHYYIFZL.js.map +0 -1
  61. package/build/dev/chunk-QN4Z7A2J.js +0 -1359
  62. package/build/dev/chunk-QN4Z7A2J.js.map +0 -1
  63. package/build/dev/chunk-RO7JTBZN.js +0 -1356
  64. package/build/dev/chunk-RO7JTBZN.js.map +0 -1
  65. package/build/dev/chunk-UE6LH4B3.js +0 -1347
  66. package/build/dev/chunk-UE6LH4B3.js.map +0 -1
  67. package/build/dev/chunk-VHTSGS2P.js +0 -1365
  68. package/build/dev/chunk-VHTSGS2P.js.map +0 -1
  69. package/build/dev/chunk-VZCA75U7.js +0 -143
  70. package/build/dev/chunk-VZCA75U7.js.map +0 -1
  71. package/build/dev/chunk-XJQFUGEP.js +0 -4520
  72. package/build/dev/chunk-XJQFUGEP.js.map +0 -1
  73. package/build/map-image-url.d.ts +0 -3
  74. package/build/map-image-url.d.ts.map +0 -1
  75. package/build/map-page-url.d.ts +0 -2
  76. package/build/map-page-url.d.ts.map +0 -1
  77. /package/build/{chunk-723T62SD.js → chunk-C6BUIPAM.js} +0 -0
  78. /package/build/dev/{chunk-JX5CEG3A.js.map → chunk-OAIRL2FN.js.map} +0 -0
@@ -1,142 +0,0 @@
1
- import {
2
- Text,
3
- cs,
4
- useNotionContext
5
- } from "./chunk-INDII3MG.js";
6
- import {
7
- __async,
8
- __commonJS,
9
- __spreadValues,
10
- __toESM
11
- } from "./chunk-723T62SD.js";
12
-
13
- // ../../node_modules/.pnpm/clipboard-copy@4.0.1/node_modules/clipboard-copy/index.js
14
- var require_clipboard_copy = __commonJS({
15
- "../../node_modules/.pnpm/clipboard-copy@4.0.1/node_modules/clipboard-copy/index.js"(exports, module) {
16
- module.exports = clipboardCopy;
17
- function makeError() {
18
- return new DOMException("The request is not allowed", "NotAllowedError");
19
- }
20
- function copyClipboardApi(text) {
21
- return __async(this, null, function* () {
22
- if (!navigator.clipboard) {
23
- throw makeError();
24
- }
25
- return navigator.clipboard.writeText(text);
26
- });
27
- }
28
- function copyExecCommand(text) {
29
- return __async(this, null, function* () {
30
- const span = document.createElement("span");
31
- span.textContent = text;
32
- span.style.whiteSpace = "pre";
33
- span.style.webkitUserSelect = "auto";
34
- span.style.userSelect = "all";
35
- document.body.appendChild(span);
36
- const selection = window.getSelection();
37
- const range = window.document.createRange();
38
- selection.removeAllRanges();
39
- range.selectNode(span);
40
- selection.addRange(range);
41
- let success = false;
42
- try {
43
- success = window.document.execCommand("copy");
44
- } finally {
45
- selection.removeAllRanges();
46
- window.document.body.removeChild(span);
47
- }
48
- if (!success)
49
- throw makeError();
50
- });
51
- }
52
- function clipboardCopy(text) {
53
- return __async(this, null, function* () {
54
- try {
55
- yield copyClipboardApi(text);
56
- } catch (err) {
57
- try {
58
- yield copyExecCommand(text);
59
- } catch (err2) {
60
- throw err2 || err || makeError();
61
- }
62
- }
63
- });
64
- }
65
- }
66
- });
67
-
68
- // src/third-party/code.tsx
69
- var import_clipboard_copy = __toESM(require_clipboard_copy(), 1);
70
- import React2 from "react";
71
- import { getBlockTitle } from "@texonom/nutils";
72
- import { highlightElement } from "prismjs";
73
- import "prismjs/components/prism-clike.min.js";
74
- import "prismjs/components/prism-css-extras.min.js";
75
- import "prismjs/components/prism-css.min.js";
76
- import "prismjs/components/prism-javascript.min.js";
77
- import "prismjs/components/prism-js-extras.min.js";
78
- import "prismjs/components/prism-json.min.js";
79
- import "prismjs/components/prism-jsx.min.js";
80
- import "prismjs/components/prism-tsx.min.js";
81
- import "prismjs/components/prism-typescript.min.js";
82
-
83
- // src/icons/copy.tsx
84
- import React from "react";
85
- function SvgCopy(props) {
86
- return /* @__PURE__ */ React.createElement("svg", __spreadValues({ fill: "currentColor", viewBox: "0 0 16 16", width: "1em", version: "1.1" }, props), /* @__PURE__ */ React.createElement(
87
- "path",
88
- {
89
- fillRule: "evenodd",
90
- 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"
91
- }
92
- ), /* @__PURE__ */ React.createElement(
93
- "path",
94
- {
95
- fillRule: "evenodd",
96
- 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"
97
- }
98
- ));
99
- }
100
- var copy_default = SvgCopy;
101
-
102
- // src/third-party/code.tsx
103
- var Code = ({ block, defaultLanguage = "typescript", className }) => {
104
- var _a, _b, _c;
105
- const [isCopied, setIsCopied] = React2.useState(false);
106
- const copyTimeout = React2.useRef();
107
- const { recordMap } = useNotionContext();
108
- const content = getBlockTitle(block, recordMap);
109
- const language = (((_c = (_b = (_a = block.properties) == null ? void 0 : _a.language) == null ? void 0 : _b[0]) == null ? void 0 : _c[0]) || defaultLanguage).toLowerCase();
110
- const caption = block.properties.caption;
111
- const codeRef = React2.useRef();
112
- React2.useEffect(() => {
113
- if (codeRef.current)
114
- try {
115
- highlightElement(codeRef.current);
116
- } catch (err) {
117
- console.warn("prismjs highlight error", err);
118
- }
119
- }, [codeRef]);
120
- const onClickCopyToClipboard = React2.useCallback(() => {
121
- (0, import_clipboard_copy.default)(content);
122
- setIsCopied(true);
123
- if (copyTimeout.current) {
124
- clearTimeout(copyTimeout.current);
125
- copyTimeout.current = null;
126
- }
127
- copyTimeout.current = setTimeout(() => {
128
- setIsCopied(false);
129
- }, 1200);
130
- }, [content, copyTimeout]);
131
- const copyButton = /* @__PURE__ */ React2.createElement("div", { className: "notion-code-copy-button", onClick: onClickCopyToClipboard }, /* @__PURE__ */ React2.createElement(copy_default, null));
132
- return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement("pre", { className: cs("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 })));
133
- };
134
-
135
- export {
136
- Code
137
- };
138
- /*! Bundled license information:
139
-
140
- clipboard-copy/index.js:
141
- (*! clipboard-copy. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
142
- */
@@ -1,90 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
- var __getProtoOf = Object.getPrototypeOf;
9
- var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
- var __spreadValues = (a, b) => {
13
- for (var prop in b || (b = {}))
14
- if (__hasOwnProp.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- if (__getOwnPropSymbols)
17
- for (var prop of __getOwnPropSymbols(b)) {
18
- if (__propIsEnum.call(b, prop))
19
- __defNormalProp(a, prop, b[prop]);
20
- }
21
- return a;
22
- };
23
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
- var __objRest = (source, exclude) => {
25
- var target = {};
26
- for (var prop in source)
27
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
28
- target[prop] = source[prop];
29
- if (source != null && __getOwnPropSymbols)
30
- for (var prop of __getOwnPropSymbols(source)) {
31
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
32
- target[prop] = source[prop];
33
- }
34
- return target;
35
- };
36
- var __commonJS = (cb, mod) => function __require() {
37
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
38
- };
39
- var __export = (target, all) => {
40
- for (var name in all)
41
- __defProp(target, name, { get: all[name], enumerable: true });
42
- };
43
- var __copyProps = (to, from, except, desc) => {
44
- if (from && typeof from === "object" || typeof from === "function") {
45
- for (let key of __getOwnPropNames(from))
46
- if (!__hasOwnProp.call(to, key) && key !== except)
47
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
48
- }
49
- return to;
50
- };
51
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
52
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
53
- // If the importer is in node compatibility mode or this is not an ESM
54
- // file that has been converted to a CommonJS file using a Babel-
55
- // compatible transform (i.e. "__esModule" has not been set), then set
56
- // "default" to the CommonJS "module.exports" for node compatibility.
57
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
58
- mod
59
- ));
60
- var __async = (__this, __arguments, generator) => {
61
- return new Promise((resolve, reject) => {
62
- var fulfilled = (value) => {
63
- try {
64
- step(generator.next(value));
65
- } catch (e) {
66
- reject(e);
67
- }
68
- };
69
- var rejected = (value) => {
70
- try {
71
- step(generator.throw(value));
72
- } catch (e) {
73
- reject(e);
74
- }
75
- };
76
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
77
- step((generator = generator.apply(__this, __arguments)).next());
78
- });
79
- };
80
-
81
- export {
82
- __spreadValues,
83
- __spreadProps,
84
- __objRest,
85
- __commonJS,
86
- __export,
87
- __reExport,
88
- __toESM,
89
- __async
90
- };