@texonom/nreact 1.6.5 → 1.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/asset-wrapper-BjCXzGmC.js.map +1 -1
- package/build/block.d.ts +0 -1
- package/build/block.d.ts.map +1 -1
- package/build/components/editable-text.d.ts +34 -10
- package/build/components/editable-text.d.ts.map +1 -1
- package/build/context.d.ts +0 -2
- package/build/context.d.ts.map +1 -1
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +363 -202
- package/build/index.js.map +1 -1
- package/build/renderer.d.ts +0 -2
- package/build/renderer.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/styles.css +2 -12
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["throttle","__toESM","Checkbox","formatNotionDateTime","isBrowser","getYoutubeId","isUrl","formatDate","getListNumber","GracefulImage","NotionContextProvider","PageIconImpl","Breadcrumbs","SearchDialog","Text","NotionContextConsumer","_objectSpread2","_objectWithoutProperties","Header","PageTitle","Asset","dummyLink","LiteYouTubeEmbed","useNotionContext","AssetWrapper","Search","EOI","getHashFragmentValue","LazyImage","PageIcon","PropertyIcon","iconMap","CollectionColumnTitle","React","mediumZoom","Audio","_block$properties","source","recordMap","block","className","_excluded$2","FileIcon","props","rest","File","_block$properties2","_block$properties3","components","GoogleDrive","_block$format","properties","domain","err","mapImageUrl","import_lodash_throttle","__commonJSMin","FUNC_ERROR_TEXT","NAN","reTrim","reIsBadHex","reIsBinary","reIsOctal","freeParseInt","freeGlobal","freeSelf","root","objectToString","nativeMax","nativeMin","now","debounce","lastArgs","lastThis","maxWait","result","timerId","lastCallTime","lastInvokeTime","leading","maxing","trailing","func","toNumber","wait","isObject","options","invokeFunc","args","thisArg","time","leadingEdge","timerExpired","remainingWait","timeSinceLastCall","timeSinceLastInvoke","shouldInvoke","trailingEdge","cancel","flush","debounced","isInvoking","throttle","\"leading\"","\"maxWait\"","\"trailing\"","type","value","isObjectLike","isSymbol","other","isBinary","PageAside","actionSectionScrollSpy","sections","prevBBox","currentSectionId","activeSection","i","section","bbox","prevHeight","offset","setActiveSection","hasToc","hasAside","toc","id","uuidToId","tocItem","pageAside","SyncPointerBlock","_syncPointerBlock$for","syncPointerBlock","referencePointerId","NotionBlockRenderer","EditableText","_block$properties$tit","ref","text","getTextContent","reported","node","next","event","onChangeBlock","_excluded$1","LinkIcon","tocIndentLevelCache","pageCoverStyleCache","Block","ctx","level","view_block","blockId","hideBlockId","renderTitle","editable","isEditableBlock","defaultPageIcon","defaultPageCover","defaultPageCoverPosition","fullPage","_recordMap$collection","_getBlockIcon","getBlockCollectionId","pageCoverObjectPosition","page_cover_position","pageCoverStyle","pageIcon","getBlockIcon","isPageIconUrl","getPageTableOfContents","showTableOfContents","minTableOfContentsItems","page_full_width","hasPageCover","pageCover","page_cover","disableHeader","header","page_icon","page_small_text","bodyClassName","pageHeader","pageTitle","pageBody","children","pageFooter","footer","blockColor","mapPageUrl","_block$format2","_block$format3","_block$format4","title","indentLevel","indentLevelClass","page","getBlockParentPage","isH1","isH2","isH3","classNameStr","innerHeader","headerBlock","_block$content","_block$format5","_recordMap$block$bloc","wrapList","content","output","isTopLevel","start","_block$format6","_block$format7","_block$format8","_recordMap$block$bloc2","_parent$content","ratio","parent","style","_block$format9","_block$format10","_block$format11","_link$","_block$format12","_block$properties4","_block$format13","_block$format14","_block$format15","_block$format16","_block$properties5","link","_block$properties6","_block$format17","_block$properties7","_block$properties8","isChecked","_block$format18","_recordMap$block$bloc3","blockPointerId","linkedBlock","_recordMap$block$bloc4","_tableBlock$format","_tableBlock$format2","_block$format19","tableBlock","order","formatMap","backgroundColor","_formatMap$column","_formatMap$column2","_block$properties9","color","column","_excluded","_excluded2","NotionRenderer","_ref","zoom","getMediumZoomMargin","isImageZoomable","_recordMap$block$id","_ref2","contentBlockId","width","PageTitleImpl"],"sources":["../src/components/audio.tsx","../src/icons/file-icon.tsx","../src/components/file.tsx","../src/components/google-drive.tsx","../../../node_modules/.pnpm/lodash.throttle@4.1.1/node_modules/lodash.throttle/index.js","../src/components/page-aside.tsx","../src/components/sync-pointer-block.tsx","../src/components/editable-text.tsx","../src/icons/link-icon.tsx","../src/block.tsx","../src/renderer.tsx"],"sourcesContent":["import React from 'react'\n\nimport { AudioBlock } from '@texonom/ntypes'\n\nimport { useNotionContext } from '../context'\n\nexport const Audio: React.FC<{\n block: AudioBlock\n className?: string\n}> = ({ block, className }) => {\n const { recordMap } = useNotionContext()\n const source = recordMap.signed_urls[block.id] || block.properties?.source?.[0]?.[0]\n\n return (\n <div className={`notion-audio ${className || ''}`}>\n <audio controls preload='none' src={source} />\n </div>\n )\n}\n","import React from 'react'\n\nexport const FileIcon = props => {\n const { className, ...rest } = props\n return (\n <svg className={className} {...rest} viewBox='0 0 30 30'>\n <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'></path>\n </svg>\n )\n}\n","import React from 'react'\n\nimport { FileBlock } from '@texonom/ntypes'\n\nimport { useNotionContext } from '../context'\nimport { FileIcon } from '../icons/file-icon'\nimport { Text } from './text'\n\nexport const File: React.FC<{\n block: FileBlock\n className?: string\n}> = ({ block, className }) => {\n const { components, recordMap } = useNotionContext()\n const source = recordMap.signed_urls[block.id] || block.properties?.source?.[0]?.[0]\n\n return (\n <div className={`notion-file ${className || ''}`}>\n <components.Link className='notion-file-link' href={source} target='_blank' rel='noopener noreferrer'>\n <FileIcon className='notion-file-icon' />\n\n <div className='notion-file-info'>\n <div className='notion-file-title'>\n <Text value={block.properties?.title || [['File']]} block={block} />\n </div>\n\n {block.properties?.size && (\n <div className='notion-file-size'>\n <Text value={block.properties.size} block={block} />\n </div>\n )}\n </div>\n </components.Link>\n </div>\n )\n}\n","import React from 'react'\n\nimport { GoogleDriveBlock } from '@texonom/ntypes'\n\nimport { useNotionContext } from '../context'\nimport { GracefulImage } from './graceful-image'\n\nexport const GoogleDrive: React.FC<{\n block: GoogleDriveBlock\n className?: string\n}> = ({ block, className }) => {\n const { components, mapImageUrl } = useNotionContext()\n const properties = block.format?.drive_properties\n if (!properties) return null\n let domain\n\n try {\n const url = new URL(properties.url)\n domain = url.hostname\n } catch (err) {\n // ignore invalid urls for robustness\n }\n\n return (\n <div className={`notion-google-drive ${className || ''}`}>\n <components.Link className='notion-google-drive-link' href={properties.url} target='_blank' rel='noopener noreferrer'>\n <div className='notion-google-drive-preview'>\n <GracefulImage\n src={mapImageUrl(properties.thumbnail, block)}\n alt={properties.title || 'Google Drive Document'}\n loading='lazy'\n />\n </div>\n\n <div className='notion-google-drive-body'>\n {properties.title && <div className='notion-google-drive-body-title'>{properties.title}</div>}\n\n {/* TODO: re-add last modified time with alternative to timeago.js */}\n {/* {properties.modified_time && (\n <div className='notion-google-drive-body-modified-time'>\n Last modified{' '}\n {properties.user_name ? `by ${properties.user_name} ` : ''}\n {timeago(properties.modified_time)}\n </div>\n )} */}\n\n {properties.icon && domain && (\n <div className='notion-google-drive-body-source'>\n {properties.icon && (\n <div\n className='notion-google-drive-body-source-icon'\n style={{\n backgroundImage: `url(${properties.icon})`\n }}\n />\n )}\n\n {domain && <div className='notion-google-drive-body-source-domain'>{domain}</div>}\n </div>\n )}\n </div>\n </components.Link>\n </div>\n )\n}\n","/**\n * lodash (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors <https://jquery.org/>\n * Released under MIT license <https://lodash.com/license>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/** Used to match leading and trailing whitespace. */\nvar reTrim = /^\\s+|\\s+$/g;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n result = wait - timeSinceLastCall;\n\n return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\n/**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide `options` to indicate whether `func`\n * should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return the\n * result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the throttled function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=true]\n * Specify invoking on the leading edge of the timeout.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // Avoid excessively updating the position while scrolling.\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.\n * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n * jQuery(element).on('click', throttled);\n *\n * // Cancel the trailing throttled invocation.\n * jQuery(window).on('popstate', throttled.cancel);\n */\nfunction throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, {\n 'leading': leading,\n 'maxWait': wait,\n 'trailing': trailing\n });\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && objectToString.call(value) == symbolTag);\n}\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = value.replace(reTrim, '');\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = throttle;\n","import React from 'react'\n\nimport throttle from 'lodash.throttle'\nimport { TableOfContentsEntry, uuidToId } from '@texonom/nutils'\n\nexport const PageAside: React.FC<{\n toc: Array<TableOfContentsEntry>\n activeSection: string | null\n setActiveSection: (activeSection: string | null) => unknown\n hasToc: boolean\n hasAside: boolean\n pageAside?: React.ReactNode\n className?: string\n}> = ({ toc, activeSection, setActiveSection, pageAside, hasToc, hasAside, className }) => {\n const throttleMs = 100\n const actionSectionScrollSpy = React.useMemo(\n () =>\n throttle(() => {\n const sections = document.getElementsByClassName('notion-h')\n\n let prevBBox: DOMRect = null\n let currentSectionId = activeSection\n\n for (let i = 0; i < sections.length; ++i) {\n const section = sections[i]\n if (!section || !(section instanceof Element)) continue\n\n if (!currentSectionId) currentSectionId = section.getAttribute('data-id')\n\n const bbox = section.getBoundingClientRect()\n const prevHeight = prevBBox ? bbox.top - prevBBox.bottom : 0\n const offset = Math.max(150, prevHeight / 4)\n\n // GetBoundingClientRect returns values relative to the viewport\n if (bbox.top - offset < 0) {\n currentSectionId = section.getAttribute('data-id')\n\n prevBBox = bbox\n continue\n }\n\n // No need to continue loop, if last element has been detected\n break\n }\n\n setActiveSection(currentSectionId)\n }, throttleMs),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n // explicitly not taking a dependency on activeSection\n setActiveSection\n ]\n )\n\n React.useEffect(() => {\n if (!hasToc) return\n\n window.addEventListener('scroll', actionSectionScrollSpy)\n\n actionSectionScrollSpy()\n\n return () => {\n window.removeEventListener('scroll', actionSectionScrollSpy)\n }\n }, [hasToc, actionSectionScrollSpy])\n\n if (!hasAside) return null\n\n return (\n <aside className={`notion-aside ${className || ''}`}>\n {hasToc && (\n <div className='notion-aside-table-of-contents'>\n <div className='notion-aside-table-of-contents-header'>Table of Contents</div>\n\n <nav className='notion-table-of-contents'>\n {toc.map(tocItem => {\n const id = uuidToId(tocItem.id)\n\n return (\n <a\n key={id}\n href={`#${id}`}\n className={`notion-table-of-contents-item\n notion-table-of-contents-item-indent-level-${tocItem.indentLevel}\n ${activeSection === id && 'notion-table-of-contents-active-item'}`}>\n <span\n className='notion-table-of-contents-item-body'\n style={{\n display: 'inline-block',\n marginLeft: tocItem.indentLevel * 16\n }}>\n {tocItem.text}\n </span>\n </a>\n )\n })}\n </nav>\n </div>\n )}\n\n {pageAside}\n </aside>\n )\n}\n","import React from 'react'\n\nimport { NotionBlockRenderer } from '../renderer'\n\nimport type { Block as BlockType, SyncPointerBlock as SyncPointerBlockType } from '@texonom/ntypes'\n\nexport const SyncPointerBlock: React.FC<{\n block: BlockType\n level: number\n}> = ({ block, level }) => {\n if (!block) {\n if (process.env.NODE_ENV !== 'production') console.warn('missing sync pointer block', block.id)\n\n return null\n }\n\n const syncPointerBlock = block as SyncPointerBlockType\n const referencePointerId = syncPointerBlock?.format?.transclusion_reference_pointer?.id\n\n if (!referencePointerId) return null\n\n return <NotionBlockRenderer key={referencePointerId} level={level} blockId={referencePointerId} />\n}\n","import React from 'react'\n\nimport { getTextContent } from '@texonom/nutils'\n\nimport { useNotionContext } from '../context'\n\nimport type { Block } from '@texonom/ntypes'\n\n/**\n * A text block the owner can edit in place.\n *\n * Rendered only in edit mode (`ctx.editable`) and only where nutils'\n * `isEditableBlock` allows, which is plain titles: the editor edits plain text,\n * so a formatted title stays read-only rather than lose what it does not show. The\n * public render path keeps using `<Text>`, so a page nobody edits is\n * byte-identical to before. The node is uncontrolled: React never reconciles\n * it, so the caret is never reset while someone is typing. On blur the plain\n * text is handed to `onChangeBlock`, which the host persists — this package\n * stays a renderer and never writes anything itself.\n */\nexport const EditableText: React.FC<{ block: Block }> = ({ block }) => {\n const { onChangeBlock } = useNotionContext()\n const ref = React.useRef<HTMLSpanElement>(null)\n const text = getTextContent(block.properties?.title ?? [])\n // The last value written into the node or reported to the host, not the value\n // at mount: an edit and a later undo back to the original are both changes.\n const reported = React.useRef<string | null>(null)\n\n React.useEffect(() => {\n // On mount, and again when the title moves under the editor — the host\n // dropped an edit — but never into a focused node, where it would reset the\n // caret mid-word. innerText, not textContent, so a soft line break survives\n // the round trip as `\\n` instead of collapsing the lines together.\n const node = ref.current\n if (!node || text === reported.current || node === document.activeElement) return\n node.innerText = text\n reported.current = text\n }, [text])\n\n return (\n <span\n ref={ref}\n className='notion-text-editable'\n role='textbox'\n aria-multiline='true'\n contentEditable\n suppressContentEditableWarning\n spellCheck\n onBlur={event => {\n // contentEditable leaves a trailing break behind after editing; it is\n // not content, and keeping it would report an edit nobody made.\n const next = event.currentTarget.innerText.replace(/\\n+$/, '')\n if (next === reported.current) return\n reported.current = next\n onChangeBlock?.(block.id, next)\n }}\n />\n )\n}\n","import React from 'react'\n\nexport const LinkIcon = props => {\n const { className, ...rest } = props\n return (\n <svg className={className} {...rest} viewBox='0 0 16 16' width='16' height='16'>\n <path\n fillRule='evenodd'\n 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'\n />\n </svg>\n )\n}\n","import React from 'react'\n\nimport {\n getBlockCollectionId,\n getBlockIcon,\n getBlockParentPage,\n getPageTableOfContents,\n getTextContent,\n isEditableBlock,\n uuidToId\n} from '@texonom/nutils'\n\nimport { AssetWrapper } from './components/asset-wrapper'\nimport { Audio } from './components/audio'\nimport { EOI } from './components/eoi'\nimport { File } from './components/file'\nimport { GoogleDrive } from './components/google-drive'\nimport { LazyImage } from './components/lazy-image'\nimport { PageAside } from './components/page-aside'\nimport { PageIcon } from './components/page-icon'\nimport { PageTitle } from './components/page-title'\nimport { SyncPointerBlock } from './components/sync-pointer-block'\nimport { Text } from './components/text'\nimport { EditableText } from './components/editable-text'\nimport { useNotionContext } from './context'\nimport { LinkIcon } from './icons/link-icon'\nimport { getListNumber, isUrl } from './utils'\n\nimport type {\n Block as BlockType,\n PageBlock,\n GoogleDriveBlock,\n AudioBlock,\n FileBlock,\n EquationBlock,\n CollectionViewPageBlock,\n CodeBlock,\n TableBlock\n} from '@texonom/ntypes'\ninterface BlockProps {\n block: BlockType\n level: number\n\n className?: string\n bodyClassName?: string\n\n header?: React.ReactNode\n footer?: React.ReactNode\n pageHeader?: React.ReactNode\n pageFooter?: React.ReactNode\n pageTitle?: React.ReactNode\n pageAside?: React.ReactNode\n pageCover?: React.ReactNode\n pageBody?: React.ReactNode\n\n hideBlockId?: boolean\n disableHeader?: boolean\n\n children?: React.ReactNode\n}\n\n// TODO: use react state instead of a global for this\nconst tocIndentLevelCache: {\n [blockId: string]: number\n} = {}\n\nconst pageCoverStyleCache: Record<string, object> = {}\n\nexport const Block: React.FC<BlockProps> = props => {\n const ctx = useNotionContext()\n const {\n components,\n fullPage,\n recordMap,\n mapPageUrl,\n mapImageUrl,\n showTableOfContents,\n minTableOfContentsItems,\n defaultPageIcon,\n defaultPageCover,\n defaultPageCoverPosition,\n editable\n } = ctx\n\n const [activeSection, setActiveSection] = React.useState(null)\n\n const {\n block,\n children,\n level,\n className,\n bodyClassName,\n header,\n footer,\n pageHeader,\n pageFooter,\n pageTitle,\n pageAside,\n pageCover,\n pageBody,\n hideBlockId,\n disableHeader\n } = props\n\n if (!block) return null\n\n // ugly hack to make viewing raw collection views work properly\n // e.g., 6d886ca87ab94c21a16e3b82b43a57fb\n if (level === 0 && block.type === 'collection_view') {\n const view_block = block as unknown as CollectionViewPageBlock\n view_block.type = 'collection_view_page'\n }\n\n const blockId = hideBlockId ? 'notion-block' : `notion-block-${uuidToId(block.id)}`\n\n // Edit mode swaps a plain title for an editable one. A formatted title keeps its\n // read-only render: the editor works in plain text, and saving it would drop\n // the bold, links and mentions it does not show.\n const renderTitle = () =>\n editable && isEditableBlock(block) ? (\n <EditableText block={block} />\n ) : (\n <Text value={block.properties.title} block={block} />\n )\n\n switch (block.type) {\n case 'collection_view_page':\n // fallthrough\n case 'page':\n if (level === 0) {\n const {\n page_icon = defaultPageIcon,\n page_cover = defaultPageCover,\n page_cover_position = defaultPageCoverPosition,\n page_full_width,\n page_small_text\n } = block.format || {}\n\n if (fullPage) {\n const properties =\n block.type === 'page'\n ? block.properties\n : {\n title: recordMap.collection[getBlockCollectionId(block, recordMap)]?.value?.name\n }\n\n const coverPosition = (1 - (page_cover_position || 0.5)) * 100\n const pageCoverObjectPosition = `center ${coverPosition}%`\n let pageCoverStyle = pageCoverStyleCache[pageCoverObjectPosition]\n if (!pageCoverStyle)\n pageCoverStyle = pageCoverStyleCache[pageCoverObjectPosition] = {\n objectPosition: pageCoverObjectPosition\n }\n\n const pageIcon = getBlockIcon(block, recordMap) ?? defaultPageIcon\n const isPageIconUrl = pageIcon && isUrl(pageIcon)\n\n const toc = getPageTableOfContents(block as PageBlock, recordMap)\n\n const hasToc = showTableOfContents && toc.length >= minTableOfContentsItems\n const hasAside = (hasToc || pageAside) && !page_full_width\n const hasPageCover = pageCover || page_cover\n\n return (\n <div className={`notion notion-app ${blockId} ${className || ''}`}>\n <div className='notion-viewport' />\n\n <div className='notion-frame'>\n {!disableHeader && <components.Header block={block} />}\n {header}\n\n <div className='notion-page-scroller'>\n {hasPageCover &&\n (pageCover ? (\n pageCover\n ) : (\n <div className='notion-page-cover-wrapper'>\n <LazyImage\n src={mapImageUrl(page_cover, block)}\n alt={getTextContent(properties?.title)}\n priority={true}\n className='notion-page-cover'\n style={pageCoverStyle}\n />\n </div>\n ))}\n\n <main\n className={`notion-page\n ${hasPageCover ? 'notion-page-has-cover' : 'notion-page-no-cover'}\n ${page_icon ? 'notion-page-has-icon' : 'notion-page-no-icon'}\n ${isPageIconUrl ? 'notion-page-has-image-icon' : 'notion-page-has-text-icon'}\n notion-full-page\n ${page_full_width && 'notion-full-width'}\n ${page_small_text && 'notion-small-text'}\n ${bodyClassName}`}>\n {page_icon && <PageIcon block={block} defaultIcon={defaultPageIcon} inline={false} />}\n\n {pageHeader}\n\n <h1 className='notion-title'>{pageTitle ?? <Text value={properties?.title} block={block} />}</h1>\n\n {(block.type === 'collection_view_page' ||\n (block.type === 'page' && block.parent_table === 'collection')) && (\n <components.Collection block={block} ctx={ctx} />\n )}\n\n {block.type !== 'collection_view_page' && (\n <div\n className={`notion-page-content\n ${hasAside && 'notion-page-content-has-aside'}\n ${hasToc && 'notion-page-content-has-toc'}`}>\n <article className='notion-page-content-inner'>{pageBody ?? children}</article>\n\n {hasAside && (\n <PageAside\n toc={toc}\n activeSection={activeSection}\n setActiveSection={setActiveSection}\n hasToc={hasToc}\n hasAside={hasAside}\n pageAside={pageAside}\n />\n )}\n </div>\n )}\n\n {pageFooter}\n </main>\n\n {footer}\n </div>\n </div>\n </div>\n )\n } else {\n return (\n <main\n className={`notion\n notion-page\n ${page_full_width && 'notion-full-width'}\n ${page_small_text && 'notion-small-text'}\n ${blockId}\n ${className || ''}\n ${bodyClassName}`}>\n <div className='notion-viewport' />\n\n {pageHeader}\n\n {(block.type === 'collection_view_page' || (block.type === 'page' && block.parent_table === 'collection')) && (\n <components.Collection block={block} ctx={ctx} />\n )}\n\n {block.type !== 'collection_view_page' && (pageBody ?? children)}\n\n {pageFooter}\n </main>\n )\n }\n } else {\n const blockColor = block.format?.block_color\n\n return (\n <components.PageLink\n className={`notion-page-link ${blockColor && `notion-${blockColor}`} ${blockId}`}\n href={mapPageUrl(block.id)}>\n <PageTitle block={block} />\n </components.PageLink>\n )\n }\n\n case 'header':\n // fallthrough\n case 'sub_header':\n // fallthrough\n case 'sub_sub_header': {\n if (!block.properties) return null\n\n const blockColor = block.format?.block_color\n const id = uuidToId(block.id)\n const title = getTextContent(block.properties.title) || `Notion Header ${id}`\n\n // we use a cache here because constructing the ToC is non-trivial\n let indentLevel = tocIndentLevelCache[block.id]\n let indentLevelClass: string\n\n if (indentLevel === undefined) {\n const page = getBlockParentPage(block, recordMap)\n\n if (page) {\n const toc = getPageTableOfContents(page, recordMap)\n const tocItem = toc.find(tocItem => tocItem.id === block.id)\n\n if (tocItem) {\n indentLevel = tocItem.indentLevel\n tocIndentLevelCache[block.id] = indentLevel\n }\n }\n }\n\n if (indentLevel !== undefined) indentLevelClass = `notion-h-indent-${indentLevel}`\n\n const isH1 = block.type === 'header'\n const isH2 = block.type === 'sub_header'\n const isH3 = block.type === 'sub_sub_header'\n\n const classNameStr = `${isH1 && 'notion-h notion-h1'}\n ${isH2 && 'notion-h notion-h2'}\n ${isH3 && 'notion-h notion-h3'}\n ${blockColor && `notion-${blockColor}`}\n ${indentLevelClass},\n ${blockId}`\n\n const innerHeader = (\n <span>\n <div id={id} className='notion-header-anchor' />\n {!block.format?.toggleable && (\n <a className='notion-hash-link' href={`#${id}`} title={title}>\n <LinkIcon />\n </a>\n )}\n\n <span className='notion-h-title'>{renderTitle()}</span>\n </span>\n )\n let headerBlock = null\n\n //page title takes the h1 so all header blocks are greater\n if (isH1)\n headerBlock = (\n <h2 className={classNameStr} data-id={id}>\n {innerHeader}\n </h2>\n )\n else if (isH2)\n headerBlock = (\n <h3 className={classNameStr} data-id={id}>\n {innerHeader}\n </h3>\n )\n else\n headerBlock = (\n <h4 className={classNameStr} data-id={id}>\n {innerHeader}\n </h4>\n )\n\n if (block.format?.toggleable)\n return (\n <details className={`notion-toggle ${blockId}`}>\n <summary>{headerBlock}</summary>\n <div>{children}</div>\n </details>\n )\n else return headerBlock\n }\n\n case 'divider':\n return <hr className={`notion-hr ${blockId}`} />\n\n case 'text': {\n if (!block.properties && !block.content?.length) return <div className={`notion-blank ${blockId}`}> </div>\n\n const blockColor = block.format?.block_color\n\n return (\n <div className={`notion-text ${blockColor && `notion-${blockColor}`} ${blockId}`}>\n {block.properties?.title && renderTitle()}\n\n {children && <div className='notion-text-children'>{children}</div>}\n </div>\n )\n }\n\n case 'bulleted_list':\n // fallthrough\n case 'numbered_list': {\n const wrapList = (content: React.ReactNode, start?: number) =>\n block.type === 'bulleted_list' ? (\n <ul className={`notion-list notion-list-disc ${blockId}`}>{content}</ul>\n ) : (\n <ol start={start} className={`notion-list notion-list-numbered ${blockId}`}>\n {content}\n </ol>\n )\n\n let output: React.JSX.Element | null = null\n\n if (block.content)\n output = (\n <>\n {block.properties && <li>{renderTitle()}</li>}\n {wrapList(children)}\n </>\n )\n else output = block.properties ? <li>{renderTitle()}</li> : null\n\n const isTopLevel = block.type !== recordMap.block[block.parent_id]?.value?.type\n const start = getListNumber(block.id, recordMap.block)\n\n return isTopLevel ? wrapList(output, start) : output\n }\n\n case 'embed':\n return <components.Embed blockId={blockId} block={block} />\n case 'tweet':\n // fallthrough\n case 'maps':\n // fallthrough\n case 'pdf':\n // fallthrough\n case 'figma':\n // fallthrough\n case 'typeform':\n // fallthrough\n case 'codepen':\n // fallthrough\n case 'excalidraw':\n // fallthrough\n case 'image':\n // fallthrough\n case 'gist':\n // fallthrough\n case 'video':\n return <AssetWrapper blockId={blockId} block={block} />\n\n case 'drive': {\n const properties = block.format?.drive_properties\n if (!properties)\n if (block.format?.display_source)\n //check if this drive actually needs to be embeded ex. google sheets.\n return <AssetWrapper blockId={blockId} block={block} />\n\n return <GoogleDrive block={block as GoogleDriveBlock} className={blockId} />\n }\n\n case 'audio':\n return <Audio block={block as AudioBlock} className={blockId} />\n\n case 'file':\n return <File block={block as FileBlock} className={blockId} />\n\n case 'equation':\n return <components.Equation block={block as EquationBlock} inline={false} className={blockId} />\n\n case 'code':\n return <components.Code block={block as CodeBlock} />\n\n case 'column_list':\n return <div className={`notion-row ${blockId}`}>{children}</div>\n\n case 'column': {\n // note: notion uses 46px\n const spacerWidth = `min(32px, 4vw)`\n const ratio = block.format?.column_ratio || 0.5\n const parent = recordMap.block[block.parent_id]?.value\n const columns = parent?.content?.length || Math.max(2, Math.ceil(1.0 / ratio))\n\n const width = `calc((100% - (${columns - 1} * ${spacerWidth})) * ${ratio})`\n const style = { width }\n\n return (\n <>\n <div className={`notion-column ${blockId}`} style={style}>\n {children}\n </div>\n\n <div className='notion-spacer' />\n </>\n )\n }\n\n case 'quote': {\n if (!block.properties) return null\n\n const blockColor = block.format?.block_color\n\n return (\n <blockquote className={`notion-quote ${blockColor && `notion-${blockColor}`} ${blockId}`}>\n <div>\n <Text value={block.properties.title} block={block} />\n </div>\n {children}\n </blockquote>\n )\n }\n\n case 'collection_view':\n return <components.Collection block={block} className={blockId} ctx={ctx} />\n\n case 'callout':\n if (components.Callout) return <components.Callout block={block} className={blockId} />\n else\n return (\n <div\n className={`notion-callout ${block.format?.block_color && `notion-${block.format?.block_color}_co`} ${blockId}`}>\n <PageIcon block={block} />\n\n <div className='notion-callout-text'>\n <Text value={block.properties?.title} block={block} />\n {children}\n </div>\n </div>\n )\n\n case 'bookmark': {\n if (!block.properties) return null\n\n const link = block.properties.link\n if (!link || !link[0]?.[0]) return null\n\n let title = getTextContent(block.properties.title)\n if (!title) title = getTextContent(link)\n\n if (title)\n if (title.startsWith('http'))\n try {\n const url = new URL(title)\n title = url.hostname\n } catch (err) {\n // ignore invalid links\n }\n\n return (\n <div className='notion-row'>\n <components.Link\n target='_blank'\n rel='noopener noreferrer'\n className={`notion-bookmark ${block.format?.block_color ? `notion-${block.format.block_color}` : ''} ${blockId}`}\n href={link[0][0]}>\n <div>\n {title && (\n <div className='notion-bookmark-title'>\n <Text value={[[title]]} block={block} />\n </div>\n )}\n\n {block.properties?.description && (\n <div className='notion-bookmark-description'>\n <Text value={block.properties?.description} block={block} />\n </div>\n )}\n\n <div className='notion-bookmark-link'>\n {block.format?.bookmark_icon && (\n <div className='notion-bookmark-link-icon'>\n <LazyImage\n src={mapImageUrl(block.format?.bookmark_icon, block)}\n alt={title}\n onError={e => {\n const parent = e.currentTarget.closest('.notion-bookmark-link-icon') as HTMLElement\n if (parent) parent.style.display = 'none'\n }}\n />\n </div>\n )}\n\n <div className='notion-bookmark-link-text'>\n <Text value={link} block={block} />\n </div>\n </div>\n </div>\n\n {block.format?.bookmark_cover && (\n <div className='notion-bookmark-image'>\n <LazyImage\n // YouTube stores `maxresdefault.jpg` covers that 404 for videos lacking a\n // max-res still (logging a console error and hiding the thumbnail). The\n // `hqdefault.jpg` variant always exists, so prefer it for ytimg covers.\n src={mapImageUrl(block.format?.bookmark_cover, block).replace(\n /(\\/\\/i\\.ytimg\\.com\\/.*?)maxresdefault/,\n '$1hqdefault'\n )}\n alt={getTextContent(block.properties?.title)}\n style={{\n objectFit: 'cover'\n }}\n onError={e => {\n const parent = e.currentTarget.closest('.notion-bookmark-image') as HTMLElement\n if (parent) parent.style.display = 'none'\n }}\n />\n </div>\n )}\n </components.Link>\n </div>\n )\n }\n\n case 'toggle':\n return (\n <details className={`notion-toggle ${blockId}`}>\n <summary>\n <Text value={block.properties?.title} block={block} />\n </summary>\n\n <div>{children}</div>\n </details>\n )\n\n case 'table_of_contents': {\n const page = getBlockParentPage(block, recordMap)\n if (!page) return null\n\n const toc = getPageTableOfContents(page, recordMap)\n const blockColor = block.format?.block_color\n\n return (\n <div className={`notion-table-of-contents ${blockColor && `notion-${blockColor}`} ${blockId}`}>\n {toc.map(tocItem => (\n <a key={tocItem.id} href={`#${uuidToId(tocItem.id)}`} className='notion-table-of-contents-item'>\n <span\n className='notion-table-of-contents-item-body'\n style={{\n display: 'inline-block',\n marginLeft: tocItem.indentLevel * 24\n }}>\n {tocItem.text}\n </span>\n </a>\n ))}\n </div>\n )\n }\n\n case 'to_do': {\n const isChecked = block.properties?.checked?.[0]?.[0] === 'Yes'\n\n return (\n <div className={`notion-to-do ${blockId}`}>\n <div className='notion-to-do-item'>\n <components.Checkbox blockId={blockId} isChecked={isChecked} />\n\n <div className={`notion-to-do-body ${isChecked && `notion-to-do-checked`}`}>\n <Text value={block.properties?.title} block={block} />\n </div>\n </div>\n\n <div className='notion-to-do-children'>{children}</div>\n </div>\n )\n }\n\n case 'transclusion_container':\n return <div className={`notion-sync-block ${blockId}`}>{children}</div>\n\n case 'transclusion_reference':\n return <SyncPointerBlock block={block} level={level + 1} {...props} />\n\n case 'alias': {\n const blockPointerId = block?.format?.alias_pointer?.id\n const linkedBlock = recordMap.block[blockPointerId]?.value\n if (!linkedBlock) {\n console.debug('\"alias\" missing block', blockPointerId)\n return null\n }\n\n return (\n <components.PageLink className={`notion-page-link ${blockPointerId}}`} href={mapPageUrl(blockPointerId)}>\n <PageTitle block={linkedBlock} />\n </components.PageLink>\n )\n }\n\n case 'table':\n return (\n <table className={`notion-simple-table ${blockId}`}>\n <tbody>{children}</tbody>\n </table>\n )\n\n case 'table_row': {\n const tableBlock = recordMap.block[block.parent_id]?.value as TableBlock\n const order = tableBlock.format?.table_block_column_order\n const formatMap = tableBlock.format?.table_block_column_format\n const backgroundColor = block.format?.block_color\n\n if (!tableBlock || !order) return null\n\n return (\n <tr className={`notion-simple-table-row ${backgroundColor && `notion-${backgroundColor}`} ${blockId}`}>\n {order.map(column => {\n const color = formatMap?.[column]?.color\n\n return (\n <td\n key={column}\n className={color ? `notion-${color}` : ''}\n style={{\n width: formatMap?.[column]?.width || 120\n }}>\n <div className='notion-simple-table-cell'>\n <Text value={block.properties?.[column] || [['ㅤ']]} block={block} />\n </div>\n </td>\n )\n })}\n </tr>\n )\n }\n\n case 'external_object_instance':\n return <EOI block={block} className={blockId} />\n\n default:\n if (process.env.NODE_ENV !== 'production')\n console.debug('Unsupported type ' + (block as BlockType).type, JSON.stringify(block, null, 2))\n\n return <div />\n }\n}\n","import React from 'react'\n\nimport mediumZoom from '@fisch0920/medium-zoom'\nimport type { ExtendedRecordMap } from '@texonom/ntypes'\n\nimport { Block } from './block'\nimport { NotionContextProvider, useNotionContext } from './context'\nimport { MapImageUrlFn, MapPageUrlFn, NotionComponents, SearchNotionFn } from './types'\n\nexport const NotionRenderer: React.FC<{\n recordMap: ExtendedRecordMap\n components?: Partial<NotionComponents>\n\n mapPageUrl?: MapPageUrlFn\n mapImageUrl?: MapImageUrlFn\n searchNotion?: SearchNotionFn\n isShowingSearch?: boolean\n onHideSearch?: () => void\n\n rootPageId?: string\n rootDomain?: string\n rootSpaceId?: string\n\n // set fullPage to false to render page content only\n // this will remove the header, cover image, and footer\n fullPage?: boolean\n\n darkMode?: boolean\n previewImages?: boolean\n forceCustomImages?: boolean\n showCollectionViewDropdown?: boolean\n linkTableTitleProperties?: boolean\n isLinkCollectionToUrlProperty?: boolean\n isImageZoomable?: boolean\n\n // Owner edit mode. Off by default; the host turns it on and persists onChangeBlock.\n editable?: boolean\n onChangeBlock?: (blockId: string, title: string) => void\n\n showTableOfContents?: boolean\n minTableOfContentsItems?: number\n\n defaultPageIcon?: string\n defaultPageCover?: string\n defaultPageCoverPosition?: number\n\n className?: string\n bodyClassName?: string\n\n header?: React.ReactNode\n footer?: React.ReactNode\n pageHeader?: React.ReactNode\n pageFooter?: React.ReactNode\n pageTitle?: React.ReactNode\n pageAside?: React.ReactNode\n pageCover?: React.ReactNode\n // Drawn in place of the page's content blocks, under the same cover, title and\n // table of contents: how a host swaps the body for an editor.\n pageBody?: React.ReactNode\n\n blockId?: string\n hideBlockId?: boolean\n disableHeader?: boolean\n}> = ({\n components,\n recordMap,\n mapPageUrl,\n mapImageUrl,\n searchNotion,\n isShowingSearch,\n onHideSearch,\n fullPage,\n rootPageId,\n rootDomain,\n rootSpaceId,\n darkMode,\n previewImages,\n forceCustomImages,\n showCollectionViewDropdown,\n linkTableTitleProperties,\n isLinkCollectionToUrlProperty,\n isImageZoomable = true,\n showTableOfContents,\n minTableOfContentsItems,\n defaultPageIcon,\n defaultPageCover,\n defaultPageCoverPosition,\n editable,\n onChangeBlock,\n ...rest\n}) => {\n const zoom = React.useMemo(\n () =>\n typeof window !== 'undefined' &&\n mediumZoom({\n background: 'rgba(0, 0, 0, 0.8)',\n minZoomScale: 2.0,\n margin: getMediumZoomMargin()\n }),\n []\n )\n\n return (\n <NotionContextProvider\n components={components}\n recordMap={recordMap}\n mapPageUrl={mapPageUrl}\n mapImageUrl={mapImageUrl}\n searchNotion={searchNotion}\n isShowingSearch={isShowingSearch}\n onHideSearch={onHideSearch}\n fullPage={fullPage}\n rootPageId={rootPageId}\n rootDomain={rootDomain}\n rootSpaceId={rootSpaceId}\n darkMode={darkMode}\n previewImages={previewImages}\n forceCustomImages={forceCustomImages}\n showCollectionViewDropdown={showCollectionViewDropdown}\n linkTableTitleProperties={linkTableTitleProperties}\n isLinkCollectionToUrlProperty={isLinkCollectionToUrlProperty}\n showTableOfContents={showTableOfContents}\n minTableOfContentsItems={minTableOfContentsItems}\n defaultPageIcon={defaultPageIcon}\n defaultPageCover={defaultPageCover}\n defaultPageCoverPosition={defaultPageCoverPosition}\n editable={editable}\n onChangeBlock={onChangeBlock}\n zoom={isImageZoomable ? zoom : null}>\n <NotionBlockRenderer {...rest} />\n </NotionContextProvider>\n )\n}\n\nexport const NotionBlockRenderer: React.FC<{\n className?: string\n bodyClassName?: string\n header?: React.ReactNode\n footer?: React.ReactNode\n disableHeader?: boolean\n\n blockId?: string\n hideBlockId?: boolean\n level?: number\n}> = ({ level = 0, blockId, ...props }) => {\n const { recordMap } = useNotionContext()\n const id = blockId || Object.keys(recordMap.block)[0]\n const block = recordMap.block[id]?.value\n\n if (!block) {\n if (process.env.NODE_ENV !== 'production') console.warn('missing block', blockId)\n\n return null\n }\n\n return (\n <Block key={id} level={level} block={block} {...props}>\n {block?.content?.map(contentBlockId => (\n <NotionBlockRenderer key={contentBlockId} blockId={contentBlockId} level={level + 1} {...props} />\n ))}\n </Block>\n )\n}\n\nfunction getMediumZoomMargin() {\n const width = window.innerWidth\n\n if (width < 500) return 8\n else if (width < 800) return 20\n else if (width < 1280) return 30\n else if (width < 1600) return 40\n else if (width < 1920) return 48\n else return 72\n}\n"],"ignoreList":[4],"mappings":";;;;;;;AAMA,IAAamC,MAGP,EAAE,UAAO,mBAAgB;;CAC7B,IAAM,EAAE,iBAAcZ,EAAiB,GACjCc,IAASC,EAAU,YAAYC,EAAM,SAAA,IAAOA,EAAM,eAAA,SAAA,IAAAH,EAAY,WAAA,SAAA,IAAAA,EAAS,OAAA,OAAA,KAAA,IAAAA,EAAK;CAElF,OACE,kBAAA,cAAC,OAAD,EAAK,WAAW,gBAAgBI,KAAa,KAExC,GADH,kBAAA,cAAC,SAAD;EAAO,UAAA;EAAS,SAAQ;EAAO,KAAKH;CAAS,CAAA,CAC1C;AAET,GCfUI,IAAA,CAAA,WAAA,GADGC,KAAW,MAAS;CAC/B,IAAM,EAAE,iBAAAC,GAAcC,IAAA3B,EAAS0B,GAAAF,CAAA;CAC/B,OACE,kBAAA,cAAC,OAAAzB,EAAAA,EAAA,EAAe,aAAA,GAAe4B,CAAA,GAAA,CAAA,GAAA,EAAM,SAAQ,YAAA,CAExC,GADH,kBAAA,cAAC,QAAD,EAAM,GAAE,qOAA2O,CAAA,CAChP;AAET,GCDaC,MAGP,EAAE,UAAO,mBAAgB;;CAC7B,IAAM,EAAE,eAAY,iBAActB,EAAiB,GAC7Cc,IAASC,EAAU,YAAYC,EAAM,SAAA,IAAOA,EAAM,eAAA,SAAA,IAAAH,EAAY,WAAA,SAAA,IAA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AAS2G,IAAsB;CAC7B,IAAMK,IAAQ,OAAO;CAOhB,OALDA,IAAQ,MAAY,IACfA,IAAQ,MAAY,KACpBA,IAAQ,OAAa,KACrBA,IAAQ,OAAa,KACrBA,IAAQ,OAAa,KAClB;AACd"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["throttle","__toESM","Checkbox","formatNotionDateTime","isBrowser","getYoutubeId","isUrl","formatDate","getListNumber","GracefulImage","NotionContextProvider","PageIconImpl","Breadcrumbs","SearchDialog","Text","NotionContextConsumer","_objectSpread2","_objectWithoutProperties","Header","PageTitle","Asset","dummyLink","LiteYouTubeEmbed","useNotionContext","AssetWrapper","Search","EOI","getHashFragmentValue","LazyImage","PageIcon","PropertyIcon","iconMap","CollectionColumnTitle","React","mediumZoom","Audio","_block$properties","source","recordMap","block","className","_excluded$2","FileIcon","props","rest","File","_block$properties2","_block$properties3","components","GoogleDrive","_block$format","properties","domain","err","mapImageUrl","import_lodash_throttle","__commonJSMin","FUNC_ERROR_TEXT","NAN","reTrim","reIsBadHex","reIsBinary","reIsOctal","freeParseInt","freeGlobal","freeSelf","root","objectToString","nativeMax","nativeMin","now","debounce","lastArgs","lastThis","maxWait","result","timerId","lastCallTime","lastInvokeTime","leading","maxing","trailing","func","toNumber","wait","isObject","options","invokeFunc","args","thisArg","time","leadingEdge","timerExpired","remainingWait","timeSinceLastCall","timeSinceLastInvoke","shouldInvoke","trailingEdge","cancel","flush","debounced","isInvoking","throttle","\"leading\"","\"maxWait\"","\"trailing\"","type","value","isObjectLike","isSymbol","other","isBinary","PageAside","actionSectionScrollSpy","sections","prevBBox","currentSectionId","activeSection","i","section","bbox","prevHeight","offset","setActiveSection","hasToc","hasAside","toc","id","uuidToId","tocItem","pageAside","SyncPointerBlock","_syncPointerBlock$for","syncPointerBlock","referencePointerId","NotionBlockRenderer","READABLE","isWorkspaceLink","rootDomain","parsePageId","isTitleIsland","text","formats","segment","format","Segments","holdsLine","title","index","EditableText","_block$properties$tit","_block$content","json","ref","drawn","_ref$current","content","version","COLORS","colorOf","formatOf","element","href","name","color","islandOf","node","placeholderOf","leaf","readTitle","runs","placeholder","push","previous","walk","island","own","inner","child","run","unitsOf","units","lengthOf","unit","indexIn","titleOffset","_ref","total","range","titlePosition","remaining","last","length","selectTitle","start","selection","from","to","end","_excluded$1","LinkIcon","tocIndentLevelCache","pageCoverStyleCache","Block","ctx","level","view_block","blockId","hideBlockId","inPlace","editable","isEditableInPlace","renderTitle","defaultPageIcon","defaultPageCover","defaultPageCoverPosition","fullPage","_recordMap$collection","_getBlockIcon","getBlockCollectionId","pageCoverObjectPosition","page_cover_position","pageCoverStyle","pageIcon","getBlockIcon","isPageIconUrl","getPageTableOfContents","showTableOfContents","minTableOfContentsItems","page_full_width","hasPageCover","pageCover","page_cover","disableHeader","header","getTextContent","page_icon","page_small_text","bodyClassName","pageHeader","pageTitle","children","pageFooter","footer","blockColor","mapPageUrl","_block$format2","_block$format3","_block$format4","indentLevel","indentLevelClass","page","getBlockParentPage","isH1","isH2","isH3","classNameStr","innerHeader","headerBlock","_block$format5","blank","_recordMap$block$bloc","wrapList","output","isTopLevel","_block$format6","_block$format7","_block$format8","_recordMap$block$bloc2","_parent$content","ratio","parent","style","_block$format9","_block$format10","_block$format11","_link$","_block$format12","_block$properties4","_block$properties5","_block$format13","_block$format14","_block$format15","_block$format16","_block$properties6","link","_block$format17","_block$properties7","isChecked","_block$format18","_recordMap$block$bloc3","blockPointerId","linkedBlock","_recordMap$block$bloc4","_tableBlock$format","_tableBlock$format2","_block$format19","tableBlock","order","formatMap","backgroundColor","_formatMap$column","_formatMap$column2","_block$properties8","column","_excluded","_excluded2","NotionRenderer","zoom","getMediumZoomMargin","isImageZoomable","_recordMap$block$id","_ref2","contentBlockId","width","PageTitleImpl"],"sources":["../src/components/audio.tsx","../src/icons/file-icon.tsx","../src/components/file.tsx","../src/components/google-drive.tsx","../../../node_modules/.pnpm/lodash.throttle@4.1.1/node_modules/lodash.throttle/index.js","../src/components/page-aside.tsx","../src/components/sync-pointer-block.tsx","../src/components/editable-text.tsx","../src/icons/link-icon.tsx","../src/block.tsx","../src/renderer.tsx"],"sourcesContent":["import React from 'react'\n\nimport { AudioBlock } from '@texonom/ntypes'\n\nimport { useNotionContext } from '../context'\n\nexport const Audio: React.FC<{\n block: AudioBlock\n className?: string\n}> = ({ block, className }) => {\n const { recordMap } = useNotionContext()\n const source = recordMap.signed_urls[block.id] || block.properties?.source?.[0]?.[0]\n\n return (\n <div className={`notion-audio ${className || ''}`}>\n <audio controls preload='none' src={source} />\n </div>\n )\n}\n","import React from 'react'\n\nexport const FileIcon = props => {\n const { className, ...rest } = props\n return (\n <svg className={className} {...rest} viewBox='0 0 30 30'>\n <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'></path>\n </svg>\n )\n}\n","import React from 'react'\n\nimport { FileBlock } from '@texonom/ntypes'\n\nimport { useNotionContext } from '../context'\nimport { FileIcon } from '../icons/file-icon'\nimport { Text } from './text'\n\nexport const File: React.FC<{\n block: FileBlock\n className?: string\n}> = ({ block, className }) => {\n const { components, recordMap } = useNotionContext()\n const source = recordMap.signed_urls[block.id] || block.properties?.source?.[0]?.[0]\n\n return (\n <div className={`notion-file ${className || ''}`}>\n <components.Link className='notion-file-link' href={source} target='_blank' rel='noopener noreferrer'>\n <FileIcon className='notion-file-icon' />\n\n <div className='notion-file-info'>\n <div className='notion-file-title'>\n <Text value={block.properties?.title || [['File']]} block={block} />\n </div>\n\n {block.properties?.size && (\n <div className='notion-file-size'>\n <Text value={block.properties.size} block={block} />\n </div>\n )}\n </div>\n </components.Link>\n </div>\n )\n}\n","import React from 'react'\n\nimport { GoogleDriveBlock } from '@texonom/ntypes'\n\nimport { useNotionContext } from '../context'\nimport { GracefulImage } from './graceful-image'\n\nexport const GoogleDrive: React.FC<{\n block: GoogleDriveBlock\n className?: string\n}> = ({ block, className }) => {\n const { components, mapImageUrl } = useNotionContext()\n const properties = block.format?.drive_properties\n if (!properties) return null\n let domain\n\n try {\n const url = new URL(properties.url)\n domain = url.hostname\n } catch (err) {\n // ignore invalid urls for robustness\n }\n\n return (\n <div className={`notion-google-drive ${className || ''}`}>\n <components.Link className='notion-google-drive-link' href={properties.url} target='_blank' rel='noopener noreferrer'>\n <div className='notion-google-drive-preview'>\n <GracefulImage\n src={mapImageUrl(properties.thumbnail, block)}\n alt={properties.title || 'Google Drive Document'}\n loading='lazy'\n />\n </div>\n\n <div className='notion-google-drive-body'>\n {properties.title && <div className='notion-google-drive-body-title'>{properties.title}</div>}\n\n {/* TODO: re-add last modified time with alternative to timeago.js */}\n {/* {properties.modified_time && (\n <div className='notion-google-drive-body-modified-time'>\n Last modified{' '}\n {properties.user_name ? `by ${properties.user_name} ` : ''}\n {timeago(properties.modified_time)}\n </div>\n )} */}\n\n {properties.icon && domain && (\n <div className='notion-google-drive-body-source'>\n {properties.icon && (\n <div\n className='notion-google-drive-body-source-icon'\n style={{\n backgroundImage: `url(${properties.icon})`\n }}\n />\n )}\n\n {domain && <div className='notion-google-drive-body-source-domain'>{domain}</div>}\n </div>\n )}\n </div>\n </components.Link>\n </div>\n )\n}\n","/**\n * lodash (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors <https://jquery.org/>\n * Released under MIT license <https://lodash.com/license>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/** Used to match leading and trailing whitespace. */\nvar reTrim = /^\\s+|\\s+$/g;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n result = wait - timeSinceLastCall;\n\n return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\n/**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide `options` to indicate whether `func`\n * should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return the\n * result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the throttled function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=true]\n * Specify invoking on the leading edge of the timeout.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // Avoid excessively updating the position while scrolling.\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.\n * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n * jQuery(element).on('click', throttled);\n *\n * // Cancel the trailing throttled invocation.\n * jQuery(window).on('popstate', throttled.cancel);\n */\nfunction throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, {\n 'leading': leading,\n 'maxWait': wait,\n 'trailing': trailing\n });\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && objectToString.call(value) == symbolTag);\n}\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = value.replace(reTrim, '');\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = throttle;\n","import React from 'react'\n\nimport throttle from 'lodash.throttle'\nimport { TableOfContentsEntry, uuidToId } from '@texonom/nutils'\n\nexport const PageAside: React.FC<{\n toc: Array<TableOfContentsEntry>\n activeSection: string | null\n setActiveSection: (activeSection: string | null) => unknown\n hasToc: boolean\n hasAside: boolean\n pageAside?: React.ReactNode\n className?: string\n}> = ({ toc, activeSection, setActiveSection, pageAside, hasToc, hasAside, className }) => {\n const throttleMs = 100\n const actionSectionScrollSpy = React.useMemo(\n () =>\n throttle(() => {\n const sections = document.getElementsByClassName('notion-h')\n\n let prevBBox: DOMRect = null\n let currentSectionId = activeSection\n\n for (let i = 0; i < sections.length; ++i) {\n const section = sections[i]\n if (!section || !(section instanceof Element)) continue\n\n if (!currentSectionId) currentSectionId = section.getAttribute('data-id')\n\n const bbox = section.getBoundingClientRect()\n const prevHeight = prevBBox ? bbox.top - prevBBox.bottom : 0\n const offset = Math.max(150, prevHeight / 4)\n\n // GetBoundingClientRect returns values relative to the viewport\n if (bbox.top - offset < 0) {\n currentSectionId = section.getAttribute('data-id')\n\n prevBBox = bbox\n continue\n }\n\n // No need to continue loop, if last element has been detected\n break\n }\n\n setActiveSection(currentSectionId)\n }, throttleMs),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n // explicitly not taking a dependency on activeSection\n setActiveSection\n ]\n )\n\n React.useEffect(() => {\n if (!hasToc) return\n\n window.addEventListener('scroll', actionSectionScrollSpy)\n\n actionSectionScrollSpy()\n\n return () => {\n window.removeEventListener('scroll', actionSectionScrollSpy)\n }\n }, [hasToc, actionSectionScrollSpy])\n\n if (!hasAside) return null\n\n return (\n <aside className={`notion-aside ${className || ''}`}>\n {hasToc && (\n <div className='notion-aside-table-of-contents'>\n <div className='notion-aside-table-of-contents-header'>Table of Contents</div>\n\n <nav className='notion-table-of-contents'>\n {toc.map(tocItem => {\n const id = uuidToId(tocItem.id)\n\n return (\n <a\n key={id}\n href={`#${id}`}\n className={`notion-table-of-contents-item\n notion-table-of-contents-item-indent-level-${tocItem.indentLevel}\n ${activeSection === id && 'notion-table-of-contents-active-item'}`}>\n <span\n className='notion-table-of-contents-item-body'\n style={{\n display: 'inline-block',\n marginLeft: tocItem.indentLevel * 16\n }}>\n {tocItem.text}\n </span>\n </a>\n )\n })}\n </nav>\n </div>\n )}\n\n {pageAside}\n </aside>\n )\n}\n","import React from 'react'\n\nimport { NotionBlockRenderer } from '../renderer'\n\nimport type { Block as BlockType, SyncPointerBlock as SyncPointerBlockType } from '@texonom/ntypes'\n\nexport const SyncPointerBlock: React.FC<{\n block: BlockType\n level: number\n}> = ({ block, level }) => {\n if (!block) {\n if (process.env.NODE_ENV !== 'production') console.warn('missing sync pointer block', block.id)\n\n return null\n }\n\n const syncPointerBlock = block as SyncPointerBlockType\n const referencePointerId = syncPointerBlock?.format?.transclusion_reference_pointer?.id\n\n if (!referencePointerId) return null\n\n return <NotionBlockRenderer key={referencePointerId} level={level} blockId={referencePointerId} />\n}\n","import React from 'react'\n\nimport { parsePageId } from '@texonom/nutils'\n\nimport { useNotionContext } from '../context'\nimport { Text } from './text'\n\nimport type { Block, Decoration } from '@texonom/ntypes'\n\ntype Format = NonNullable<Decoration[1]>[number]\n\n/** Formats `Text` draws as elements the editor reads straight back: on/off styles and a colour. */\nconst READABLE: ReadonlySet<string> = new Set(['b', 'i', 's', 'c', '_', 'h'])\n\n/** A link `Text` draws under a rewritten href; reading that href back would make it a different link. */\nconst isWorkspaceLink = (value: string, rootDomain?: string) =>\n (value[0] === '/' || (!!rootDomain && value.includes(rootDomain))) && !!parsePageId(value.substring(1), { uuid: true })\n\n/**\n * Whether a piece of a title is kept whole while the owner types: a mention, an\n * equation, a link into the workspace, the lone comma `Text` draws as a gap.\n * It is drawn by `Text` like the rest, inside an element the caret cannot\n * enter, and read back exactly as it was.\n */\nexport function isTitleIsland(segment: Decoration, rootDomain?: string): boolean {\n const [text, formats] = segment\n if (!formats || formats.length === 0) return text === ','\n return !formats.every(\n format =>\n READABLE.has(format[0]) ||\n (format[0] === 'a' && typeof format[1] === 'string' && !isWorkspaceLink(format[1], rootDomain))\n )\n}\n\nconst Segments: React.FC<{ title: Decoration[]; block: Block; holdsLine: boolean }> = ({ title, block, holdsLine }) => {\n const { rootDomain } = useNotionContext()\n if (holdsLine) return <br />\n return (\n <>\n {title.map((segment, index) =>\n isTitleIsland(segment, rootDomain) ? (\n <span key={index} contentEditable={false} data-segment={JSON.stringify(segment)}>\n <Text value={[segment]} block={block} />\n </span>\n ) : (\n <Text key={index} value={[segment]} block={block} />\n )\n )}\n </>\n )\n}\n\n/**\n * A block title the owner types into where it stands.\n *\n * Drawn by `Text`, segment by segment, so the page looks the same with editing\n * on as off: the only additions are this span and the wrappers around kept\n * pieces, and neither draws anything. React never reconciles the inside, so\n * while the owner types the browser owns the DOM, and neither the caret nor an\n * IME composition is ever reset. The host reads the text back with\n * `readTitle`, writes what it read into `data-title` and hands that title back;\n * a title equal to `data-title` is already on screen and nothing is redrawn.\n * Any other title, an undo or a change made in Notion, redraws it from scratch.\n */\nexport const EditableText: React.FC<{ block: Block }> = ({ block }) => {\n const title = (block.properties?.title ?? []) as Decoration[]\n // An empty title draws nothing, as it does read-only, unless its line is held\n // open anyway: an empty text block's , or a block the host has just made\n // with an empty title for the caret to stand in.\n const holdsLine =\n title.length === 0 &&\n ((block.type === 'text' && !block.properties && !block.content?.length) || Array.isArray(block.properties?.title))\n const json = JSON.stringify(title)\n const ref = React.useRef<HTMLSpanElement>(null)\n const drawn = React.useRef({ json, version: 0 })\n if (drawn.current.json !== json) {\n const onScreen = ref.current?.getAttribute('data-title') === json\n drawn.current = { json, version: onScreen ? drawn.current.version : drawn.current.version + 1 }\n }\n const { version } = drawn.current\n // Keyed on the version alone: the same element back means React leaves the typed DOM alone.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const content = React.useMemo(() => <Segments title={title} block={block} holdsLine={holdsLine} />, [version])\n\n return (\n <span\n key={version}\n ref={ref}\n className='notion-text-editable'\n data-block-id={block.id}\n data-title={json}\n contentEditable\n suppressContentEditableWarning\n spellCheck>\n {content}\n </span>\n )\n}\n\n/** Notion's colour names, as `Text` puts them in a class: `notion-red`, `notion-red_background`. */\nconst COLORS: ReadonlySet<string> = new Set([\n 'default',\n 'gray',\n 'brown',\n 'orange',\n 'yellow',\n 'teal',\n 'green',\n 'blue',\n 'purple',\n 'pink',\n 'red'\n])\n\nconst colorOf = (className: string): string | undefined => {\n if (!className.startsWith('notion-')) return undefined\n const value = className.slice('notion-'.length)\n return COLORS.has(value.replace(/_background$/, '')) ? value : undefined\n}\n\n/** The format an element stands for, as `Text` draws them. */\nfunction formatOf(element: HTMLElement): Format | undefined {\n switch (element.tagName) {\n case 'B':\n case 'STRONG':\n return ['b']\n case 'EM':\n case 'I':\n return ['i']\n case 'S':\n case 'STRIKE':\n case 'DEL':\n return ['s']\n case 'CODE':\n return ['c']\n case 'U':\n return ['_']\n case 'A': {\n const href = element.getAttribute('href')\n return href ? ['a', href] : undefined\n }\n case 'SPAN': {\n if (element.classList.contains('notion-inline-underscore')) return ['_']\n for (const name of Array.from(element.classList)) {\n const color = colorOf(name)\n if (color) return ['h', color] as Format\n }\n return undefined\n }\n default:\n return undefined\n }\n}\n\nconst islandOf = (node: Node): HTMLElement | undefined =>\n node.nodeType === Node.ELEMENT_NODE && (node as HTMLElement).dataset.segment !== undefined\n ? (node as HTMLElement)\n : undefined\n\n/** The last leaf in a title. A line break there only holds the line open for the caret: it is not text. */\nfunction placeholderOf(root: HTMLElement): Node | undefined {\n let leaf: Node = root\n while (leaf.lastChild && !islandOf(leaf)) leaf = leaf.lastChild\n return leaf !== root && leaf.nodeName === 'BR' ? leaf : undefined\n}\n\ntype Run = { text: string; formats: Format[] } | { island: Decoration }\n\n/**\n * A title read back out of an `EditableText`, in Notion's shape: runs of text\n * with the formats around them, and kept pieces exactly as they were drawn.\n */\nexport function readTitle(root: HTMLElement): Decoration[] {\n const runs: Run[] = []\n const placeholder = placeholderOf(root)\n const push = (text: string, formats: Format[]) => {\n if (!text) return\n const previous = runs[runs.length - 1]\n if (previous && 'text' in previous && JSON.stringify(previous.formats) === JSON.stringify(formats)) previous.text += text\n else runs.push({ text, formats })\n }\n const walk = (node: Node, formats: Format[]) => {\n if (node.nodeType === Node.TEXT_NODE) {\n push((node as Text).data.replace(/ /g, ' '), formats)\n return\n }\n const island = islandOf(node)\n if (island) {\n runs.push({ island: JSON.parse(island.dataset.segment!) as Decoration })\n return\n }\n if (node.nodeType !== Node.ELEMENT_NODE) return\n const element = node as HTMLElement\n if (element.tagName === 'BR') {\n if (element !== placeholder) push('\\n', formats)\n return\n }\n // A line the browser wrapped in a block of its own starts with a line break.\n if ((element.tagName === 'DIV' || element.tagName === 'P') && element.previousSibling) push('\\n', formats)\n const own = formatOf(element)\n const inner = own ? [...formats, own] : formats\n for (const child of Array.from(element.childNodes)) walk(child, inner)\n }\n for (const child of Array.from(root.childNodes)) walk(child, [])\n // Notion stores a segment's formats innermost first; the walk met them outermost first.\n return runs.map(run =>\n 'island' in run\n ? run.island\n : run.formats.length > 0\n ? ([run.text, [...run.formats].reverse()] as Decoration)\n : ([run.text] as Decoration)\n )\n}\n\n/** Text nodes, islands and line breaks, in order: the pieces a title's characters live in. */\nfunction unitsOf(root: HTMLElement): Node[] {\n const units: Node[] = []\n const walk = (node: Node) => {\n if (node.nodeType === Node.TEXT_NODE || islandOf(node) || node.nodeName === 'BR') units.push(node)\n else if (node.nodeType === Node.ELEMENT_NODE) for (const child of Array.from(node.childNodes)) walk(child)\n }\n for (const child of Array.from(root.childNodes)) walk(child)\n return units\n}\n\n/** How many of the title's characters a piece holds: an island its text, a line break one, the placeholder none. */\nfunction lengthOf(unit: Node, placeholder: Node | undefined): number {\n if (unit.nodeType === Node.TEXT_NODE) return (unit as Text).data.length\n const island = islandOf(unit)\n if (island) return (JSON.parse(island.dataset.segment!) as Decoration)[0].length\n return unit === placeholder ? 0 : 1\n}\n\nconst indexIn = (node: Node) => Array.prototype.indexOf.call(node.parentNode!.childNodes, node) as number\n\n/**\n * Where a DOM position falls in a title, counted in the title's characters.\n * A position inside an island counts as just past it: the caret cannot stand in one.\n */\nexport function titleOffset(root: HTMLElement, node: Node, offset: number): number {\n const island = (node.nodeType === Node.ELEMENT_NODE ? (node as HTMLElement) : node.parentElement)?.closest(\n '[data-segment]'\n )\n if (island && island !== root && root.contains(island)) {\n node = island.parentNode!\n offset = indexIn(island) + 1\n }\n const placeholder = placeholderOf(root)\n let total = 0\n for (const unit of unitsOf(root)) {\n if (unit === node) return total + Math.min(offset, lengthOf(unit, placeholder))\n const range = root.ownerDocument.createRange()\n range.selectNode(unit)\n const past = range.comparePoint(node, offset) > 0 || (node === range.endContainer && offset === range.endOffset)\n if (!past) return total\n total += lengthOf(unit, placeholder)\n }\n return total\n}\n\n/** The DOM position for a character offset in a title; just past an island when the offset meets one. */\nexport function titlePosition(root: HTMLElement, offset: number): { node: Node; offset: number } {\n const placeholder = placeholderOf(root)\n let remaining = Math.max(0, offset)\n let last: Node | undefined\n for (const unit of unitsOf(root)) {\n const length = lengthOf(unit, placeholder)\n if (unit.nodeType === Node.TEXT_NODE) {\n if (remaining <= length) return { node: unit, offset: remaining }\n } else if (remaining === 0) return { node: unit.parentNode!, offset: indexIn(unit) }\n remaining -= length\n if (unit !== placeholder) last = unit\n }\n if (last) return { node: last.parentNode!, offset: indexIn(last) + 1 }\n return { node: root, offset: 0 }\n}\n\n/** Select a range of a title's characters; with no end, place the caret. */\nexport function selectTitle(root: HTMLElement, start: number, end = start) {\n const selection = root.ownerDocument.getSelection()\n if (!selection) return\n const from = titlePosition(root, start)\n const to = end === start ? from : titlePosition(root, end)\n const range = root.ownerDocument.createRange()\n range.setStart(from.node, from.offset)\n range.setEnd(to.node, to.offset)\n selection.removeAllRanges()\n selection.addRange(range)\n}\n","import React from 'react'\n\nexport const LinkIcon = props => {\n const { className, ...rest } = props\n return (\n <svg className={className} {...rest} viewBox='0 0 16 16' width='16' height='16'>\n <path\n fillRule='evenodd'\n 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'\n />\n </svg>\n )\n}\n","import React from 'react'\n\nimport {\n getBlockCollectionId,\n getBlockIcon,\n getBlockParentPage,\n getPageTableOfContents,\n getTextContent,\n isEditableInPlace,\n uuidToId\n} from '@texonom/nutils'\n\nimport { AssetWrapper } from './components/asset-wrapper'\nimport { Audio } from './components/audio'\nimport { EOI } from './components/eoi'\nimport { File } from './components/file'\nimport { GoogleDrive } from './components/google-drive'\nimport { LazyImage } from './components/lazy-image'\nimport { PageAside } from './components/page-aside'\nimport { PageIcon } from './components/page-icon'\nimport { PageTitle } from './components/page-title'\nimport { SyncPointerBlock } from './components/sync-pointer-block'\nimport { Text } from './components/text'\nimport { EditableText } from './components/editable-text'\nimport { useNotionContext } from './context'\nimport { LinkIcon } from './icons/link-icon'\nimport { getListNumber, isUrl } from './utils'\n\nimport type {\n Block as BlockType,\n PageBlock,\n GoogleDriveBlock,\n AudioBlock,\n FileBlock,\n EquationBlock,\n CollectionViewPageBlock,\n CodeBlock,\n TableBlock\n} from '@texonom/ntypes'\ninterface BlockProps {\n block: BlockType\n level: number\n\n className?: string\n bodyClassName?: string\n\n header?: React.ReactNode\n footer?: React.ReactNode\n pageHeader?: React.ReactNode\n pageFooter?: React.ReactNode\n pageTitle?: React.ReactNode\n pageAside?: React.ReactNode\n pageCover?: React.ReactNode\n\n hideBlockId?: boolean\n disableHeader?: boolean\n\n children?: React.ReactNode\n}\n\n// TODO: use react state instead of a global for this\nconst tocIndentLevelCache: {\n [blockId: string]: number\n} = {}\n\nconst pageCoverStyleCache: Record<string, object> = {}\n\nexport const Block: React.FC<BlockProps> = props => {\n const ctx = useNotionContext()\n const {\n components,\n fullPage,\n recordMap,\n mapPageUrl,\n mapImageUrl,\n showTableOfContents,\n minTableOfContentsItems,\n defaultPageIcon,\n defaultPageCover,\n defaultPageCoverPosition,\n editable\n } = ctx\n\n const [activeSection, setActiveSection] = React.useState(null)\n\n const {\n block,\n children,\n level,\n className,\n bodyClassName,\n header,\n footer,\n pageHeader,\n pageFooter,\n pageTitle,\n pageAside,\n pageCover,\n hideBlockId,\n disableHeader\n } = props\n\n if (!block) return null\n\n // ugly hack to make viewing raw collection views work properly\n // e.g., 6d886ca87ab94c21a16e3b82b43a57fb\n if (level === 0 && block.type === 'collection_view') {\n const view_block = block as unknown as CollectionViewPageBlock\n view_block.type = 'collection_view_page'\n }\n\n const blockId = hideBlockId ? 'notion-block' : `notion-block-${uuidToId(block.id)}`\n\n // Edit mode draws the title for typing into, looking exactly as it does read-only.\n // A title holding something the save cannot write back stays read-only.\n const inPlace = editable && isEditableInPlace(block)\n const renderTitle = () =>\n inPlace ? <EditableText block={block} /> : <Text value={block.properties?.title} block={block} />\n\n switch (block.type) {\n case 'collection_view_page':\n // fallthrough\n case 'page':\n if (level === 0) {\n const {\n page_icon = defaultPageIcon,\n page_cover = defaultPageCover,\n page_cover_position = defaultPageCoverPosition,\n page_full_width,\n page_small_text\n } = block.format || {}\n\n if (fullPage) {\n const properties =\n block.type === 'page'\n ? block.properties\n : {\n title: recordMap.collection[getBlockCollectionId(block, recordMap)]?.value?.name\n }\n\n const coverPosition = (1 - (page_cover_position || 0.5)) * 100\n const pageCoverObjectPosition = `center ${coverPosition}%`\n let pageCoverStyle = pageCoverStyleCache[pageCoverObjectPosition]\n if (!pageCoverStyle)\n pageCoverStyle = pageCoverStyleCache[pageCoverObjectPosition] = {\n objectPosition: pageCoverObjectPosition\n }\n\n const pageIcon = getBlockIcon(block, recordMap) ?? defaultPageIcon\n const isPageIconUrl = pageIcon && isUrl(pageIcon)\n\n const toc = getPageTableOfContents(block as PageBlock, recordMap)\n\n const hasToc = showTableOfContents && toc.length >= minTableOfContentsItems\n const hasAside = (hasToc || pageAside) && !page_full_width\n const hasPageCover = pageCover || page_cover\n\n return (\n <div className={`notion notion-app ${blockId} ${className || ''}`}>\n <div className='notion-viewport' />\n\n <div className='notion-frame'>\n {!disableHeader && <components.Header block={block} />}\n {header}\n\n <div className='notion-page-scroller'>\n {hasPageCover &&\n (pageCover ? (\n pageCover\n ) : (\n <div className='notion-page-cover-wrapper'>\n <LazyImage\n src={mapImageUrl(page_cover, block)}\n alt={getTextContent(properties?.title)}\n priority={true}\n className='notion-page-cover'\n style={pageCoverStyle}\n />\n </div>\n ))}\n\n <main\n className={`notion-page\n ${hasPageCover ? 'notion-page-has-cover' : 'notion-page-no-cover'}\n ${page_icon ? 'notion-page-has-icon' : 'notion-page-no-icon'}\n ${isPageIconUrl ? 'notion-page-has-image-icon' : 'notion-page-has-text-icon'}\n notion-full-page\n ${page_full_width && 'notion-full-width'}\n ${page_small_text && 'notion-small-text'}\n ${bodyClassName}`}>\n {page_icon && <PageIcon block={block} defaultIcon={defaultPageIcon} inline={false} />}\n\n {pageHeader}\n\n <h1 className='notion-title'>{pageTitle ?? <Text value={properties?.title} block={block} />}</h1>\n\n {(block.type === 'collection_view_page' ||\n (block.type === 'page' && block.parent_table === 'collection')) && (\n <components.Collection block={block} ctx={ctx} />\n )}\n\n {block.type !== 'collection_view_page' && (\n <div\n className={`notion-page-content\n ${hasAside && 'notion-page-content-has-aside'}\n ${hasToc && 'notion-page-content-has-toc'}`}>\n <article className='notion-page-content-inner'>{children}</article>\n\n {hasAside && (\n <PageAside\n toc={toc}\n activeSection={activeSection}\n setActiveSection={setActiveSection}\n hasToc={hasToc}\n hasAside={hasAside}\n pageAside={pageAside}\n />\n )}\n </div>\n )}\n\n {pageFooter}\n </main>\n\n {footer}\n </div>\n </div>\n </div>\n )\n } else {\n return (\n <main\n className={`notion\n notion-page\n ${page_full_width && 'notion-full-width'}\n ${page_small_text && 'notion-small-text'}\n ${blockId}\n ${className || ''}\n ${bodyClassName}`}>\n <div className='notion-viewport' />\n\n {pageHeader}\n\n {(block.type === 'collection_view_page' || (block.type === 'page' && block.parent_table === 'collection')) && (\n <components.Collection block={block} ctx={ctx} />\n )}\n\n {block.type !== 'collection_view_page' && children}\n\n {pageFooter}\n </main>\n )\n }\n } else {\n const blockColor = block.format?.block_color\n\n return (\n <components.PageLink\n className={`notion-page-link ${blockColor && `notion-${blockColor}`} ${blockId}`}\n href={mapPageUrl(block.id)}>\n <PageTitle block={block} />\n </components.PageLink>\n )\n }\n\n case 'header':\n // fallthrough\n case 'sub_header':\n // fallthrough\n case 'sub_sub_header': {\n if (!block.properties) return null\n\n const blockColor = block.format?.block_color\n const id = uuidToId(block.id)\n const title = getTextContent(block.properties.title) || `Notion Header ${id}`\n\n // we use a cache here because constructing the ToC is non-trivial\n let indentLevel = tocIndentLevelCache[block.id]\n let indentLevelClass: string\n\n if (indentLevel === undefined) {\n const page = getBlockParentPage(block, recordMap)\n\n if (page) {\n const toc = getPageTableOfContents(page, recordMap)\n const tocItem = toc.find(tocItem => tocItem.id === block.id)\n\n if (tocItem) {\n indentLevel = tocItem.indentLevel\n tocIndentLevelCache[block.id] = indentLevel\n }\n }\n }\n\n if (indentLevel !== undefined) indentLevelClass = `notion-h-indent-${indentLevel}`\n\n const isH1 = block.type === 'header'\n const isH2 = block.type === 'sub_header'\n const isH3 = block.type === 'sub_sub_header'\n\n const classNameStr = `${isH1 && 'notion-h notion-h1'}\n ${isH2 && 'notion-h notion-h2'}\n ${isH3 && 'notion-h notion-h3'}\n ${blockColor && `notion-${blockColor}`}\n ${indentLevelClass},\n ${blockId}`\n\n const innerHeader = (\n <span>\n <div id={id} className='notion-header-anchor' />\n {!block.format?.toggleable && (\n <a className='notion-hash-link' href={`#${id}`} title={title}>\n <LinkIcon />\n </a>\n )}\n\n <span className='notion-h-title'>{renderTitle()}</span>\n </span>\n )\n let headerBlock = null\n\n //page title takes the h1 so all header blocks are greater\n if (isH1)\n headerBlock = (\n <h2 className={classNameStr} data-id={id}>\n {innerHeader}\n </h2>\n )\n else if (isH2)\n headerBlock = (\n <h3 className={classNameStr} data-id={id}>\n {innerHeader}\n </h3>\n )\n else\n headerBlock = (\n <h4 className={classNameStr} data-id={id}>\n {innerHeader}\n </h4>\n )\n\n if (block.format?.toggleable)\n return (\n <details className={`notion-toggle ${blockId}`}>\n <summary>{headerBlock}</summary>\n <div>{children}</div>\n </details>\n )\n else return headerBlock\n }\n\n case 'divider':\n return <hr className={`notion-hr ${blockId}`} />\n\n case 'text': {\n const blank = !block.properties && !block.content?.length\n const blockColor = block.format?.block_color\n const className = blank ? `notion-blank ${blockId}` : `notion-text ${blockColor && `notion-${blockColor}`} ${blockId}`\n\n // An empty line is typed into like any other; the element stays the same\n // as it gains its first letter, so the caret does not move.\n if (inPlace)\n return (\n <div className={className}>\n {renderTitle()}\n {children && <div className='notion-text-children'>{children}</div>}\n </div>\n )\n\n if (blank) return <div className={className}> </div>\n\n return (\n <div className={className}>\n {block.properties?.title && renderTitle()}\n\n {children && <div className='notion-text-children'>{children}</div>}\n </div>\n )\n }\n\n case 'bulleted_list':\n // fallthrough\n case 'numbered_list': {\n const wrapList = (content: React.ReactNode, start?: number) =>\n block.type === 'bulleted_list' ? (\n <ul className={`notion-list notion-list-disc ${blockId}`}>{content}</ul>\n ) : (\n <ol start={start} className={`notion-list notion-list-numbered ${blockId}`}>\n {content}\n </ol>\n )\n\n let output: React.JSX.Element | null = null\n\n if (block.content)\n output = (\n <>\n {block.properties && <li data-block-id={editable ? block.id : undefined}>{renderTitle()}</li>}\n {wrapList(children)}\n </>\n )\n // In edit mode the item says which block it is: a list item has no element of its own otherwise.\n else output = block.properties ? <li data-block-id={editable ? block.id : undefined}>{renderTitle()}</li> : null\n\n const isTopLevel = block.type !== recordMap.block[block.parent_id]?.value?.type\n const start = getListNumber(block.id, recordMap.block)\n\n return isTopLevel ? wrapList(output, start) : output\n }\n\n case 'embed':\n return <components.Embed blockId={blockId} block={block} />\n case 'tweet':\n // fallthrough\n case 'maps':\n // fallthrough\n case 'pdf':\n // fallthrough\n case 'figma':\n // fallthrough\n case 'typeform':\n // fallthrough\n case 'codepen':\n // fallthrough\n case 'excalidraw':\n // fallthrough\n case 'image':\n // fallthrough\n case 'gist':\n // fallthrough\n case 'video':\n return <AssetWrapper blockId={blockId} block={block} />\n\n case 'drive': {\n const properties = block.format?.drive_properties\n if (!properties)\n if (block.format?.display_source)\n //check if this drive actually needs to be embeded ex. google sheets.\n return <AssetWrapper blockId={blockId} block={block} />\n\n return <GoogleDrive block={block as GoogleDriveBlock} className={blockId} />\n }\n\n case 'audio':\n return <Audio block={block as AudioBlock} className={blockId} />\n\n case 'file':\n return <File block={block as FileBlock} className={blockId} />\n\n case 'equation':\n return <components.Equation block={block as EquationBlock} inline={false} className={blockId} />\n\n case 'code':\n return <components.Code block={block as CodeBlock} />\n\n case 'column_list':\n return <div className={`notion-row ${blockId}`}>{children}</div>\n\n case 'column': {\n // note: notion uses 46px\n const spacerWidth = `min(32px, 4vw)`\n const ratio = block.format?.column_ratio || 0.5\n const parent = recordMap.block[block.parent_id]?.value\n const columns = parent?.content?.length || Math.max(2, Math.ceil(1.0 / ratio))\n\n const width = `calc((100% - (${columns - 1} * ${spacerWidth})) * ${ratio})`\n const style = { width }\n\n return (\n <>\n <div className={`notion-column ${blockId}`} style={style}>\n {children}\n </div>\n\n <div className='notion-spacer' />\n </>\n )\n }\n\n case 'quote': {\n if (!block.properties) return null\n\n const blockColor = block.format?.block_color\n\n return (\n <blockquote className={`notion-quote ${blockColor && `notion-${blockColor}`} ${blockId}`}>\n <div>{renderTitle()}</div>\n {children}\n </blockquote>\n )\n }\n\n case 'collection_view':\n return <components.Collection block={block} className={blockId} ctx={ctx} />\n\n case 'callout':\n if (components.Callout) return <components.Callout block={block} className={blockId} />\n else\n return (\n <div\n className={`notion-callout ${block.format?.block_color && `notion-${block.format?.block_color}_co`} ${blockId}`}>\n <PageIcon block={block} />\n\n <div className='notion-callout-text'>\n <Text value={block.properties?.title} block={block} />\n {children}\n </div>\n </div>\n )\n\n case 'bookmark': {\n if (!block.properties) return null\n\n const link = block.properties.link\n if (!link || !link[0]?.[0]) return null\n\n let title = getTextContent(block.properties.title)\n if (!title) title = getTextContent(link)\n\n if (title)\n if (title.startsWith('http'))\n try {\n const url = new URL(title)\n title = url.hostname\n } catch (err) {\n // ignore invalid links\n }\n\n return (\n <div className='notion-row'>\n <components.Link\n target='_blank'\n rel='noopener noreferrer'\n className={`notion-bookmark ${block.format?.block_color ? `notion-${block.format.block_color}` : ''} ${blockId}`}\n href={link[0][0]}>\n <div>\n {title && (\n <div className='notion-bookmark-title'>\n <Text value={[[title]]} block={block} />\n </div>\n )}\n\n {block.properties?.description && (\n <div className='notion-bookmark-description'>\n <Text value={block.properties?.description} block={block} />\n </div>\n )}\n\n <div className='notion-bookmark-link'>\n {block.format?.bookmark_icon && (\n <div className='notion-bookmark-link-icon'>\n <LazyImage\n src={mapImageUrl(block.format?.bookmark_icon, block)}\n alt={title}\n onError={e => {\n const parent = e.currentTarget.closest('.notion-bookmark-link-icon') as HTMLElement\n if (parent) parent.style.display = 'none'\n }}\n />\n </div>\n )}\n\n <div className='notion-bookmark-link-text'>\n <Text value={link} block={block} />\n </div>\n </div>\n </div>\n\n {block.format?.bookmark_cover && (\n <div className='notion-bookmark-image'>\n <LazyImage\n // YouTube stores `maxresdefault.jpg` covers that 404 for videos lacking a\n // max-res still (logging a console error and hiding the thumbnail). The\n // `hqdefault.jpg` variant always exists, so prefer it for ytimg covers.\n src={mapImageUrl(block.format?.bookmark_cover, block).replace(\n /(\\/\\/i\\.ytimg\\.com\\/.*?)maxresdefault/,\n '$1hqdefault'\n )}\n alt={getTextContent(block.properties?.title)}\n style={{\n objectFit: 'cover'\n }}\n onError={e => {\n const parent = e.currentTarget.closest('.notion-bookmark-image') as HTMLElement\n if (parent) parent.style.display = 'none'\n }}\n />\n </div>\n )}\n </components.Link>\n </div>\n )\n }\n\n case 'toggle':\n return (\n <details className={`notion-toggle ${blockId}`}>\n <summary>{renderTitle()}</summary>\n\n <div>{children}</div>\n </details>\n )\n\n case 'table_of_contents': {\n const page = getBlockParentPage(block, recordMap)\n if (!page) return null\n\n const toc = getPageTableOfContents(page, recordMap)\n const blockColor = block.format?.block_color\n\n return (\n <div className={`notion-table-of-contents ${blockColor && `notion-${blockColor}`} ${blockId}`}>\n {toc.map(tocItem => (\n <a key={tocItem.id} href={`#${uuidToId(tocItem.id)}`} className='notion-table-of-contents-item'>\n <span\n className='notion-table-of-contents-item-body'\n style={{\n display: 'inline-block',\n marginLeft: tocItem.indentLevel * 24\n }}>\n {tocItem.text}\n </span>\n </a>\n ))}\n </div>\n )\n }\n\n case 'to_do': {\n const isChecked = block.properties?.checked?.[0]?.[0] === 'Yes'\n\n return (\n <div className={`notion-to-do ${blockId}`}>\n <div className='notion-to-do-item'>\n <components.Checkbox blockId={blockId} isChecked={isChecked} />\n\n <div className={`notion-to-do-body ${isChecked && `notion-to-do-checked`}`}>{renderTitle()}</div>\n </div>\n\n <div className='notion-to-do-children'>{children}</div>\n </div>\n )\n }\n\n case 'transclusion_container':\n return <div className={`notion-sync-block ${blockId}`}>{children}</div>\n\n case 'transclusion_reference':\n return <SyncPointerBlock block={block} level={level + 1} {...props} />\n\n case 'alias': {\n const blockPointerId = block?.format?.alias_pointer?.id\n const linkedBlock = recordMap.block[blockPointerId]?.value\n if (!linkedBlock) {\n console.debug('\"alias\" missing block', blockPointerId)\n return null\n }\n\n return (\n <components.PageLink className={`notion-page-link ${blockPointerId}}`} href={mapPageUrl(blockPointerId)}>\n <PageTitle block={linkedBlock} />\n </components.PageLink>\n )\n }\n\n case 'table':\n return (\n <table className={`notion-simple-table ${blockId}`}>\n <tbody>{children}</tbody>\n </table>\n )\n\n case 'table_row': {\n const tableBlock = recordMap.block[block.parent_id]?.value as TableBlock\n const order = tableBlock.format?.table_block_column_order\n const formatMap = tableBlock.format?.table_block_column_format\n const backgroundColor = block.format?.block_color\n\n if (!tableBlock || !order) return null\n\n return (\n <tr className={`notion-simple-table-row ${backgroundColor && `notion-${backgroundColor}`} ${blockId}`}>\n {order.map(column => {\n const color = formatMap?.[column]?.color\n\n return (\n <td\n key={column}\n className={color ? `notion-${color}` : ''}\n style={{\n width: formatMap?.[column]?.width || 120\n }}>\n <div className='notion-simple-table-cell'>\n <Text value={block.properties?.[column] || [['ㅤ']]} block={block} />\n </div>\n </td>\n )\n })}\n </tr>\n )\n }\n\n case 'external_object_instance':\n return <EOI block={block} className={blockId} />\n\n default:\n if (process.env.NODE_ENV !== 'production')\n console.debug('Unsupported type ' + (block as BlockType).type, JSON.stringify(block, null, 2))\n\n return <div />\n }\n}\n","import React from 'react'\n\nimport mediumZoom from '@fisch0920/medium-zoom'\nimport type { ExtendedRecordMap } from '@texonom/ntypes'\n\nimport { Block } from './block'\nimport { NotionContextProvider, useNotionContext } from './context'\nimport { MapImageUrlFn, MapPageUrlFn, NotionComponents, SearchNotionFn } from './types'\n\nexport const NotionRenderer: React.FC<{\n recordMap: ExtendedRecordMap\n components?: Partial<NotionComponents>\n\n mapPageUrl?: MapPageUrlFn\n mapImageUrl?: MapImageUrlFn\n searchNotion?: SearchNotionFn\n isShowingSearch?: boolean\n onHideSearch?: () => void\n\n rootPageId?: string\n rootDomain?: string\n rootSpaceId?: string\n\n // set fullPage to false to render page content only\n // this will remove the header, cover image, and footer\n fullPage?: boolean\n\n darkMode?: boolean\n previewImages?: boolean\n forceCustomImages?: boolean\n showCollectionViewDropdown?: boolean\n linkTableTitleProperties?: boolean\n isLinkCollectionToUrlProperty?: boolean\n isImageZoomable?: boolean\n\n // Owner edit mode: titles drawn for typing into where they stand. Off by default.\n editable?: boolean\n\n showTableOfContents?: boolean\n minTableOfContentsItems?: number\n\n defaultPageIcon?: string\n defaultPageCover?: string\n defaultPageCoverPosition?: number\n\n className?: string\n bodyClassName?: string\n\n header?: React.ReactNode\n footer?: React.ReactNode\n pageHeader?: React.ReactNode\n pageFooter?: React.ReactNode\n pageTitle?: React.ReactNode\n pageAside?: React.ReactNode\n pageCover?: React.ReactNode\n\n blockId?: string\n hideBlockId?: boolean\n disableHeader?: boolean\n}> = ({\n components,\n recordMap,\n mapPageUrl,\n mapImageUrl,\n searchNotion,\n isShowingSearch,\n onHideSearch,\n fullPage,\n rootPageId,\n rootDomain,\n rootSpaceId,\n darkMode,\n previewImages,\n forceCustomImages,\n showCollectionViewDropdown,\n linkTableTitleProperties,\n isLinkCollectionToUrlProperty,\n isImageZoomable = true,\n showTableOfContents,\n minTableOfContentsItems,\n defaultPageIcon,\n defaultPageCover,\n defaultPageCoverPosition,\n editable,\n ...rest\n}) => {\n const zoom = React.useMemo(\n () =>\n typeof window !== 'undefined' &&\n mediumZoom({\n background: 'rgba(0, 0, 0, 0.8)',\n minZoomScale: 2.0,\n margin: getMediumZoomMargin()\n }),\n []\n )\n\n return (\n <NotionContextProvider\n components={components}\n recordMap={recordMap}\n mapPageUrl={mapPageUrl}\n mapImageUrl={mapImageUrl}\n searchNotion={searchNotion}\n isShowingSearch={isShowingSearch}\n onHideSearch={onHideSearch}\n fullPage={fullPage}\n rootPageId={rootPageId}\n rootDomain={rootDomain}\n rootSpaceId={rootSpaceId}\n darkMode={darkMode}\n previewImages={previewImages}\n forceCustomImages={forceCustomImages}\n showCollectionViewDropdown={showCollectionViewDropdown}\n linkTableTitleProperties={linkTableTitleProperties}\n isLinkCollectionToUrlProperty={isLinkCollectionToUrlProperty}\n showTableOfContents={showTableOfContents}\n minTableOfContentsItems={minTableOfContentsItems}\n defaultPageIcon={defaultPageIcon}\n defaultPageCover={defaultPageCover}\n defaultPageCoverPosition={defaultPageCoverPosition}\n editable={editable}\n zoom={isImageZoomable ? zoom : null}>\n <NotionBlockRenderer {...rest} />\n </NotionContextProvider>\n )\n}\n\nexport const NotionBlockRenderer: React.FC<{\n className?: string\n bodyClassName?: string\n header?: React.ReactNode\n footer?: React.ReactNode\n disableHeader?: boolean\n\n blockId?: string\n hideBlockId?: boolean\n level?: number\n}> = ({ level = 0, blockId, ...props }) => {\n const { recordMap } = useNotionContext()\n const id = blockId || Object.keys(recordMap.block)[0]\n const block = recordMap.block[id]?.value\n\n if (!block) {\n if (process.env.NODE_ENV !== 'production') console.warn('missing block', blockId)\n\n return null\n }\n\n return (\n <Block key={id} level={level} block={block} {...props}>\n {block?.content?.map(contentBlockId => (\n <NotionBlockRenderer key={contentBlockId} blockId={contentBlockId} level={level + 1} {...props} />\n ))}\n </Block>\n )\n}\n\nfunction getMediumZoomMargin() {\n const width = window.innerWidth\n\n if (width < 500) return 8\n else if (width < 800) return 20\n else if (width < 1280) return 30\n else if (width < 1600) return 40\n else if (width < 1920) return 48\n else return 72\n}\n"],"ignoreList":[4],"mappings":";;;;;;;AAMA,IAAamC,MAGP,EAAE,UAAO,mBAAgB;;CAC7B,IAAM,EAAE,iBAAcZ,EAAiB,GACjCc,IAASC,EAAU,YAAYC,EAAM,SAAA,IAAOA,EAAM,eAAA,SAAA,IAAAH,EAAY,WAAA,SAAA,IAAAA,EAAS,OAAA,OAAA,KAAA,IAAAA,EAAK;CAElF,OACE,kBAAA,cAAC,OA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AE,iBAAc3R,EAAiB,GACjCwG,IAAKgF,KAAW,OAAO,KAAKzK,EAAU,KAAK,CAAC,CAAC,IAC7CC,KAAA,IAAQD,EAAU,MAAMyF,OAAA,OAAA,KAAA,IAAAwL,EAAK;CAQnC,OANKhR,IAOH,kBAAA,cAACoK,GAAA3L,EAAA;EAAM,KAAK+G;EAAW;EAAc;CAAW,GAAApF,CAIzC,GAAAJ,KAAA,SAAA,IAHJA,EAAO,YAAA,OAAA,KAAA,IAAAgH,EAAS,KAAI,MACnB,kBAAA,cAAChB,GAAAvH,EAAA;EAAoB,KAAKyS;EAAgB,SAASA;EAAgB,OAAO5G,IAAQ;CAAO,GAAAlK,CAAQ,CAAA,CAClG,CACI,KAVP,QAAA,IAAA,aAA6B,gBAAc,QAAQ,KAAK,iBAAiBoK,CAAO,GAEzE;AAUX;AAEA,SAASsG,KAAsB;CAC7B,IAAMK,IAAQ,OAAO;CAOhB,OALDA,IAAQ,MAAY,IACfA,IAAQ,MAAY,KACpBA,IAAQ,OAAa,KACrBA,IAAQ,OAAa,KACrBA,IAAQ,OAAa,KAClB;AACd"}
|
package/build/renderer.d.ts
CHANGED
|
@@ -21,7 +21,6 @@ export declare const NotionRenderer: React.FC<{
|
|
|
21
21
|
isLinkCollectionToUrlProperty?: boolean;
|
|
22
22
|
isImageZoomable?: boolean;
|
|
23
23
|
editable?: boolean;
|
|
24
|
-
onChangeBlock?: (blockId: string, title: string) => void;
|
|
25
24
|
showTableOfContents?: boolean;
|
|
26
25
|
minTableOfContentsItems?: number;
|
|
27
26
|
defaultPageIcon?: string;
|
|
@@ -36,7 +35,6 @@ export declare const NotionRenderer: React.FC<{
|
|
|
36
35
|
pageTitle?: React.ReactNode;
|
|
37
36
|
pageAside?: React.ReactNode;
|
|
38
37
|
pageCover?: React.ReactNode;
|
|
39
|
-
pageBody?: React.ReactNode;
|
|
40
38
|
blockId?: string;
|
|
41
39
|
hideBlockId?: boolean;
|
|
42
40
|
disableHeader?: boolean;
|
package/build/renderer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../src/renderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAIxD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAEvF,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC;IACpC,SAAS,EAAE,iBAAiB,CAAA;IAC5B,UAAU,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAEtC,UAAU,CAAC,EAAE,YAAY,CAAA;IACzB,WAAW,CAAC,EAAE,aAAa,CAAA;IAC3B,YAAY,CAAC,EAAE,cAAc,CAAA;IAC7B,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAA;IAEzB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;IAIpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,0BAA0B,CAAC,EAAE,OAAO,CAAA;IACpC,wBAAwB,CAAC,EAAE,OAAO,CAAA;IAClC,6BAA6B,CAAC,EAAE,OAAO,CAAA;IACvC,eAAe,CAAC,EAAE,OAAO,CAAA;IAGzB,QAAQ,CAAC,EAAE,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../src/renderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,KAAK,EAAE,iB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M,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACxB,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC5B,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC5B,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC3B,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC3B,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAE3B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB,CAmEA,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACxB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACxB,aAAa,CAAC,EAAE,OAAO,CAAA;IAEvB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAkBA,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@texonom/nreact",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Fast and accurate React renderer for Notion.",
|
|
6
6
|
"repository": {
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"@fisch0920/medium-zoom": "^1.0.7",
|
|
25
25
|
"@matejmazur/react-katex": "^3.1.3",
|
|
26
26
|
"katex": "^0.19.0",
|
|
27
|
-
"@texonom/ntypes": "^1.6.
|
|
28
|
-
"@texonom/nutils": "^1.6.
|
|
27
|
+
"@texonom/ntypes": "^1.6.6",
|
|
28
|
+
"@texonom/nutils": "^1.6.6",
|
|
29
29
|
"prismjs": "^1.30.0",
|
|
30
30
|
"react-fast-compare": "^3.2.2",
|
|
31
31
|
"react-hotkeys-hook": "^5.3.3",
|
package/src/styles.css
CHANGED
|
@@ -2810,18 +2810,8 @@ svg.notion-page-icon {
|
|
|
2810
2810
|
cursor: pointer;
|
|
2811
2811
|
}
|
|
2812
2812
|
|
|
2813
|
-
/* Edit mode: a title
|
|
2814
|
-
|
|
2813
|
+
/* Edit mode: a title being typed into looks exactly as it does read-only, so
|
|
2814
|
+
the browser's focus ring is the one thing to take away. */
|
|
2815
2815
|
.notion-text-editable {
|
|
2816
2816
|
outline: none;
|
|
2817
|
-
border-radius: 3px;
|
|
2818
|
-
cursor: text;
|
|
2819
|
-
}
|
|
2820
|
-
|
|
2821
|
-
.notion-text-editable:hover {
|
|
2822
|
-
background: var(--notion-gray_background_co);
|
|
2823
|
-
}
|
|
2824
|
-
|
|
2825
|
-
.notion-text-editable:focus {
|
|
2826
|
-
background: var(--notion-gray_background);
|
|
2827
2817
|
}
|