@texonom/nreact 1.3.0-rc.4 → 1.3.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.
- package/build/.tsbuildinfo +1 -1
- package/build/block.d.ts.map +1 -1
- package/build/chunk-2U7I3XVC.js +157 -0
- package/build/chunk-FCO7MUK6.js +83 -0
- package/build/chunk-VP33CFNB.js +1358 -0
- package/build/dev/chunk-N6EDMIQD.js +1359 -0
- package/build/dev/chunk-N6EDMIQD.js.map +1 -0
- package/build/dev/chunk-PM5CWL6O.js +158 -0
- package/build/dev/chunk-PM5CWL6O.js.map +1 -0
- package/build/dev/chunk-Q4G2SZRD.js +84 -0
- package/build/dev/chunk-Q4G2SZRD.js.map +1 -0
- package/build/dev/chunk-QN4Z7A2J.js +1359 -0
- package/build/dev/chunk-QN4Z7A2J.js.map +1 -0
- package/build/dev/index.js +4 -6
- package/build/dev/index.js.map +1 -1
- package/build/dev/third-party/code.js +2 -2
- package/build/dev/third-party/code.js.map +1 -1
- package/build/dev/third-party/collection.js +3 -3
- package/build/dev/third-party/collection.js.map +1 -1
- package/build/dev/third-party/equation.js +2 -2
- package/build/dev/third-party/equation.js.map +1 -1
- package/build/dev/third-party/modal.js +1 -1
- package/build/dev/third-party/pdf.js +1 -1
- package/build/dev/third-party/pdf.js.map +1 -1
- package/build/icons/clear-icon.d.ts.map +1 -1
- package/build/icons/loading-icon.d.ts.map +1 -1
- package/build/icons/search-icon.d.ts.map +1 -1
- package/build/index.js +4 -6
- package/build/third-party/code.js +2 -2
- package/build/third-party/collection.js +3 -3
- package/build/third-party/equation.js +2 -2
- package/build/third-party/modal.js +1 -1
- package/build/third-party/pdf.js +1 -1
- package/package.json +9 -9
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Text,
|
|
3
3
|
useNotionContext
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-N6EDMIQD.js";
|
|
5
5
|
import {
|
|
6
6
|
__async,
|
|
7
7
|
__commonJS,
|
|
8
8
|
__spreadValues,
|
|
9
9
|
__toESM
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-Q4G2SZRD.js";
|
|
11
11
|
|
|
12
12
|
// ../../node_modules/.pnpm/clipboard-copy@4.0.1/node_modules/clipboard-copy/index.js
|
|
13
13
|
var require_clipboard_copy = __commonJS({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../node_modules/.pnpm/clipboard-copy@4.0.1/node_modules/clipboard-copy/index.js","../../../src/third-party/code.tsx","../../../src/icons/copy.tsx"],"sourcesContent":["/*! clipboard-copy. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */\n/* global DOMException */\n\nmodule.exports = clipboardCopy\n\nfunction makeError () {\n return new DOMException('The request is not allowed', 'NotAllowedError')\n}\n\nasync function copyClipboardApi (text) {\n // Use the Async Clipboard API when available. Requires a secure browsing\n // context (i.e. HTTPS)\n if (!navigator.clipboard) {\n throw makeError()\n }\n return navigator.clipboard.writeText(text)\n}\n\nasync function copyExecCommand (text) {\n // Put the text to copy into a <span>\n const span = document.createElement('span')\n span.textContent = text\n\n // Preserve consecutive spaces and newlines\n span.style.whiteSpace = 'pre'\n span.style.webkitUserSelect = 'auto'\n span.style.userSelect = 'all'\n\n // Add the <span> to the page\n document.body.appendChild(span)\n\n // Make a selection object representing the range of text selected by the user\n const selection = window.getSelection()\n const range = window.document.createRange()\n selection.removeAllRanges()\n range.selectNode(span)\n selection.addRange(range)\n\n // Copy text to the clipboard\n let success = false\n try {\n success = window.document.execCommand('copy')\n } finally {\n // Cleanup\n selection.removeAllRanges()\n window.document.body.removeChild(span)\n }\n\n if (!success) throw makeError()\n}\n\nasync function clipboardCopy (text) {\n try {\n await copyClipboardApi(text)\n } catch (err) {\n // ...Otherwise, use document.execCommand() fallback\n try {\n await copyExecCommand(text)\n } catch (err2) {\n throw (err2 || err || makeError())\n }\n }\n}\n","import React from 'react'\n\nimport copyToClipboard from 'clipboard-copy'\nimport { CodeBlock } from '@texonom/ntypes'\nimport { getBlockTitle } from '@texonom/nutils'\nimport { highlightElement } from 'prismjs'\nimport 'prismjs/components/prism-clike.min.js'\nimport 'prismjs/components/prism-css-extras.min.js'\nimport 'prismjs/components/prism-css.min.js'\nimport 'prismjs/components/prism-javascript.min.js'\nimport 'prismjs/components/prism-js-extras.min.js'\nimport 'prismjs/components/prism-json.min.js'\nimport 'prismjs/components/prism-jsx.min.js'\nimport 'prismjs/components/prism-tsx.min.js'\nimport 'prismjs/components/prism-typescript.min.js'\n\nimport { Text } from '../components/text'\nimport { useNotionContext } from '../context'\nimport CopyIcon from '../icons/copy'\n\nexport const Code: React.FC<{\n block: CodeBlock\n defaultLanguage?: string\n className?: string\n}> = ({ block, defaultLanguage = 'typescript', className }) => {\n const [isCopied, setIsCopied] = React.useState(false)\n const copyTimeout = React.useRef<number>()\n const { recordMap } = useNotionContext()\n const content = getBlockTitle(block, recordMap)\n const language = (block.properties?.language?.[0]?.[0] || defaultLanguage).toLowerCase()\n const caption = block.properties.caption\n\n const codeRef = React.useRef()\n React.useEffect(() => {\n if (codeRef.current)\n try {\n highlightElement(codeRef.current)\n } catch (err) {\n console.warn('prismjs highlight error', err)\n }\n }, [codeRef])\n\n const onClickCopyToClipboard = React.useCallback(() => {\n copyToClipboard(content)\n setIsCopied(true)\n\n if (copyTimeout.current) {\n clearTimeout(copyTimeout.current)\n copyTimeout.current = null\n }\n\n copyTimeout.current = setTimeout(() => {\n setIsCopied(false)\n }, 1200) as unknown as number\n }, [content, copyTimeout])\n\n const copyButton = (\n <div className='notion-code-copy-button' onClick={onClickCopyToClipboard}>\n <CopyIcon />\n </div>\n )\n\n return (\n <>\n <pre className={`notion-code ${className || ''}`}>\n <div className='notion-code-copy'>\n {copyButton}\n\n {isCopied && (\n <div className='notion-code-copy-tooltip'>\n <div>{isCopied ? 'Copied' : 'Copy'}</div>\n </div>\n )}\n </div>\n\n <code className={`language-${language}`} ref={codeRef}>\n {content}\n </code>\n </pre>\n\n {caption && (\n <figcaption className='notion-asset-caption'>\n <Text value={caption} block={block} />\n </figcaption>\n )}\n </>\n )\n}\n","import React from 'react'\n\nfunction SvgCopy(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg fill='currentColor' viewBox='0 0 16 16' width='1em' version='1.1' {...props}>\n <path\n fillRule='evenodd'\n 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'\n />\n <path\n fillRule='evenodd'\n 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'\n />\n </svg>\n )\n}\n\nexport default SvgCopy\n"],"mappings":";;;;;;;;;;;;AAAA;AAAA;AAGA,WAAO,UAAU;AAEjB,aAAS,YAAa;AACpB,aAAO,IAAI,aAAa,8BAA8B,iBAAiB;AAAA,IACzE;AAEA,aAAe,iBAAkB,MAAM;AAAA;AAGrC,YAAI,CAAC,UAAU,WAAW;AACxB,gBAAM,UAAU;AAAA,QAClB;AACA,eAAO,UAAU,UAAU,UAAU,IAAI;AAAA,MAC3C;AAAA;AAEA,aAAe,gBAAiB,MAAM;AAAA;AAEpC,cAAM,OAAO,SAAS,cAAc,MAAM;AAC1C,aAAK,cAAc;AAGnB,aAAK,MAAM,aAAa;AACxB,aAAK,MAAM,mBAAmB;AAC9B,aAAK,MAAM,aAAa;AAGxB,iBAAS,KAAK,YAAY,IAAI;AAG9B,cAAM,YAAY,OAAO,aAAa;AACtC,cAAM,QAAQ,OAAO,SAAS,YAAY;AAC1C,kBAAU,gBAAgB;AAC1B,cAAM,WAAW,IAAI;AACrB,kBAAU,SAAS,KAAK;AAGxB,YAAI,UAAU;AACd,YAAI;AACF,oBAAU,OAAO,SAAS,YAAY,MAAM;AAAA,QAC9C,UAAE;AAEA,oBAAU,gBAAgB;AAC1B,iBAAO,SAAS,KAAK,YAAY,IAAI;AAAA,QACvC;AAEA,YAAI,CAAC;AAAS,gBAAM,UAAU;AAAA,MAChC;AAAA;AAEA,aAAe,cAAe,MAAM;AAAA;AAClC,YAAI;AACF,gBAAM,iBAAiB,IAAI;AAAA,QAC7B,SAAS,
|
|
1
|
+
{"version":3,"sources":["../../../../../node_modules/.pnpm/clipboard-copy@4.0.1/node_modules/clipboard-copy/index.js","../../../src/third-party/code.tsx","../../../src/icons/copy.tsx"],"sourcesContent":["/*! clipboard-copy. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */\n/* global DOMException */\n\nmodule.exports = clipboardCopy\n\nfunction makeError () {\n return new DOMException('The request is not allowed', 'NotAllowedError')\n}\n\nasync function copyClipboardApi (text) {\n // Use the Async Clipboard API when available. Requires a secure browsing\n // context (i.e. HTTPS)\n if (!navigator.clipboard) {\n throw makeError()\n }\n return navigator.clipboard.writeText(text)\n}\n\nasync function copyExecCommand (text) {\n // Put the text to copy into a <span>\n const span = document.createElement('span')\n span.textContent = text\n\n // Preserve consecutive spaces and newlines\n span.style.whiteSpace = 'pre'\n span.style.webkitUserSelect = 'auto'\n span.style.userSelect = 'all'\n\n // Add the <span> to the page\n document.body.appendChild(span)\n\n // Make a selection object representing the range of text selected by the user\n const selection = window.getSelection()\n const range = window.document.createRange()\n selection.removeAllRanges()\n range.selectNode(span)\n selection.addRange(range)\n\n // Copy text to the clipboard\n let success = false\n try {\n success = window.document.execCommand('copy')\n } finally {\n // Cleanup\n selection.removeAllRanges()\n window.document.body.removeChild(span)\n }\n\n if (!success) throw makeError()\n}\n\nasync function clipboardCopy (text) {\n try {\n await copyClipboardApi(text)\n } catch (err) {\n // ...Otherwise, use document.execCommand() fallback\n try {\n await copyExecCommand(text)\n } catch (err2) {\n throw (err2 || err || makeError())\n }\n }\n}\n","import React from 'react'\n\nimport copyToClipboard from 'clipboard-copy'\nimport { CodeBlock } from '@texonom/ntypes'\nimport { getBlockTitle } from '@texonom/nutils'\nimport { highlightElement } from 'prismjs'\nimport 'prismjs/components/prism-clike.min.js'\nimport 'prismjs/components/prism-css-extras.min.js'\nimport 'prismjs/components/prism-css.min.js'\nimport 'prismjs/components/prism-javascript.min.js'\nimport 'prismjs/components/prism-js-extras.min.js'\nimport 'prismjs/components/prism-json.min.js'\nimport 'prismjs/components/prism-jsx.min.js'\nimport 'prismjs/components/prism-tsx.min.js'\nimport 'prismjs/components/prism-typescript.min.js'\n\nimport { Text } from '../components/text'\nimport { useNotionContext } from '../context'\nimport CopyIcon from '../icons/copy'\n\nexport const Code: React.FC<{\n block: CodeBlock\n defaultLanguage?: string\n className?: string\n}> = ({ block, defaultLanguage = 'typescript', className }) => {\n const [isCopied, setIsCopied] = React.useState(false)\n const copyTimeout = React.useRef<number>()\n const { recordMap } = useNotionContext()\n const content = getBlockTitle(block, recordMap)\n const language = (block.properties?.language?.[0]?.[0] || defaultLanguage).toLowerCase()\n const caption = block.properties.caption\n\n const codeRef = React.useRef()\n React.useEffect(() => {\n if (codeRef.current)\n try {\n highlightElement(codeRef.current)\n } catch (err) {\n console.warn('prismjs highlight error', err)\n }\n }, [codeRef])\n\n const onClickCopyToClipboard = React.useCallback(() => {\n copyToClipboard(content)\n setIsCopied(true)\n\n if (copyTimeout.current) {\n clearTimeout(copyTimeout.current)\n copyTimeout.current = null\n }\n\n copyTimeout.current = setTimeout(() => {\n setIsCopied(false)\n }, 1200) as unknown as number\n }, [content, copyTimeout])\n\n const copyButton = (\n <div className='notion-code-copy-button' onClick={onClickCopyToClipboard}>\n <CopyIcon />\n </div>\n )\n\n return (\n <>\n <pre className={`notion-code ${className || ''}`}>\n <div className='notion-code-copy'>\n {copyButton}\n\n {isCopied && (\n <div className='notion-code-copy-tooltip'>\n <div>{isCopied ? 'Copied' : 'Copy'}</div>\n </div>\n )}\n </div>\n\n <code className={`language-${language}`} ref={codeRef}>\n {content}\n </code>\n </pre>\n\n {caption && (\n <figcaption className='notion-asset-caption'>\n <Text value={caption} block={block} />\n </figcaption>\n )}\n </>\n )\n}\n","import React from 'react'\n\nfunction SvgCopy(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg fill='currentColor' viewBox='0 0 16 16' width='1em' version='1.1' {...props}>\n <path\n fillRule='evenodd'\n 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'\n />\n <path\n fillRule='evenodd'\n 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'\n />\n </svg>\n )\n}\n\nexport default SvgCopy\n"],"mappings":";;;;;;;;;;;;AAAA;AAAA;AAGA,WAAO,UAAU;AAEjB,aAAS,YAAa;AACpB,aAAO,IAAI,aAAa,8BAA8B,iBAAiB;AAAA,IACzE;AAEA,aAAe,iBAAkB,MAAM;AAAA;AAGrC,YAAI,CAAC,UAAU,WAAW;AACxB,gBAAM,UAAU;AAAA,QAClB;AACA,eAAO,UAAU,UAAU,UAAU,IAAI;AAAA,MAC3C;AAAA;AAEA,aAAe,gBAAiB,MAAM;AAAA;AAEpC,cAAM,OAAO,SAAS,cAAc,MAAM;AAC1C,aAAK,cAAc;AAGnB,aAAK,MAAM,aAAa;AACxB,aAAK,MAAM,mBAAm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gBAAAA,OAAA,cAAC,gBAAW,WAAU,0BACpB,gBAAAA,OAAA,cAAC,QAAK,OAAO,SAAS,OAAc,CACtC,CAEJ;AAEJ;","names":["React","React","copyToClipboard"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CollectionColumnTitle
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-PM5CWL6O.js";
|
|
4
4
|
import {
|
|
5
5
|
Checkbox,
|
|
6
6
|
GracefulImage,
|
|
@@ -12,14 +12,14 @@ import {
|
|
|
12
12
|
dummyLink,
|
|
13
13
|
formatDate,
|
|
14
14
|
useNotionContext
|
|
15
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-N6EDMIQD.js";
|
|
16
16
|
import {
|
|
17
17
|
__commonJS,
|
|
18
18
|
__objRest,
|
|
19
19
|
__spreadProps,
|
|
20
20
|
__spreadValues,
|
|
21
21
|
__toESM
|
|
22
|
-
} from "../chunk-
|
|
22
|
+
} from "../chunk-Q4G2SZRD.js";
|
|
23
23
|
|
|
24
24
|
// ../../node_modules/.pnpm/@babel+runtime@7.21.5/node_modules/@babel/runtime/helpers/interopRequireDefault.js
|
|
25
25
|
var require_interopRequireDefault = __commonJS({
|