From 0683d58243a226b066d5231d9a0040185bd08398 Mon Sep 17 00:00:00 2001 From: Bob Ippolito Date: Wed, 28 Aug 2024 09:22:10 -0700 Subject: [PATCH 1/3] [lexical-table] Bug Fix: Add @lexical/clipboard as a direct dependency of @lexical/table (#6571) --- packages/lexical-table/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/lexical-table/package.json b/packages/lexical-table/package.json index 01676f90f01..fb990dbe15c 100644 --- a/packages/lexical-table/package.json +++ b/packages/lexical-table/package.json @@ -12,6 +12,7 @@ "main": "LexicalTable.js", "types": "index.d.ts", "dependencies": { + "@lexical/clipboard": "0.17.1", "@lexical/utils": "0.17.1", "lexical": "0.17.1" }, From cd934aff7d81d6a9b1cf92a616864800b697e964 Mon Sep 17 00:00:00 2001 From: Sherry Date: Thu, 29 Aug 2024 02:09:00 +0800 Subject: [PATCH 2/3] [lexical-react] menu positioning: Unrevert PR6510 but with gating (#6566) --- .../lexical-react/src/shared/LexicalMenu.ts | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/packages/lexical-react/src/shared/LexicalMenu.ts b/packages/lexical-react/src/shared/LexicalMenu.ts index 590e5cfdc57..42877233258 100644 --- a/packages/lexical-react/src/shared/LexicalMenu.ts +++ b/packages/lexical-react/src/shared/LexicalMenu.ts @@ -482,6 +482,7 @@ export function useMenuAnchorRef( setResolution: (r: MenuResolution | null) => void, className?: string, parent: HTMLElement = document.body, + shouldIncludePageYOffset__EXPERIMENTAL: boolean = true, ): MutableRefObject { const [editor] = useLexicalComposerContext(); const anchorElementRef = useRef(document.createElement('div')); @@ -495,7 +496,10 @@ export function useMenuAnchorRef( const {left, top, width, height} = resolution.getRect(); const anchorHeight = anchorElementRef.current.offsetHeight; // use to position under anchor containerDiv.style.top = `${ - top + window.pageYOffset + anchorHeight + 3 + top + + anchorHeight + + 3 + + (shouldIncludePageYOffset__EXPERIMENTAL ? window.pageYOffset : 0) }px`; containerDiv.style.left = `${left + window.pageXOffset}px`; containerDiv.style.height = `${height}px`; @@ -519,7 +523,10 @@ export function useMenuAnchorRef( top - rootElementRect.top > menuHeight + height ) { containerDiv.style.top = `${ - top - menuHeight + window.pageYOffset - height + top - + menuHeight - + height + + (shouldIncludePageYOffset__EXPERIMENTAL ? window.pageYOffset : 0) }px`; } } @@ -538,7 +545,13 @@ export function useMenuAnchorRef( anchorElementRef.current = containerDiv; rootElement.setAttribute('aria-controls', 'typeahead-menu'); } - }, [editor, resolution, className, parent]); + }, [ + editor, + resolution, + shouldIncludePageYOffset__EXPERIMENTAL, + className, + parent, + ]); useEffect(() => { const rootElement = editor.getRootElement(); From 1f778da76afbd991121712c0f2f9cf6087ecc8d9 Mon Sep 17 00:00:00 2001 From: Bob Ippolito Date: Wed, 28 Aug 2024 12:41:29 -0700 Subject: [PATCH 3/3] [*] Feature: Check undeclared dependencies in build (#6574) --- packages/lexical-yjs/package.json | 1 + scripts/build.js | 36 ++++++++++++++++++++++++++----- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/packages/lexical-yjs/package.json b/packages/lexical-yjs/package.json index 9a246dd5a57..4b861b7c8fd 100644 --- a/packages/lexical-yjs/package.json +++ b/packages/lexical-yjs/package.json @@ -16,6 +16,7 @@ "types": "index.d.ts", "dependencies": { "@lexical/offset": "0.17.1", + "@lexical/selection": "0.17.1", "lexical": "0.17.1" }, "peerDependencies": { diff --git a/scripts/build.js b/scripts/build.js index 14bc48af584..ec1b6c470f7 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -47,13 +47,16 @@ const closureOptions = { warning_level: 'QUIET', }; +const modulePackageMappings = Object.fromEntries( + packagesManager.getPublicPackages().flatMap((pkg) => { + const pkgName = pkg.getNpmName(); + return pkg.getExportedNpmModuleNames().map((npm) => [npm, pkgName]); + }), +); + const wwwMappings = { ...Object.fromEntries( - packagesManager - .getPublicPackages() - .flatMap((pkg) => - pkg.getExportedNpmModuleNames().map((npm) => [npm, npmToWwwName(npm)]), - ), + Object.keys(modulePackageMappings).map((npm) => [npm, npmToWwwName(npm)]), ), 'prismjs/components/prism-c': 'prism-c', 'prismjs/components/prism-clike': 'prism-clike', @@ -126,6 +129,7 @@ function getExtension(format) { * @param {boolean} isProd * @param {'cjs'|'esm'} format * @param {string} version + * @param {import('./shared/PackageMetadata').PackageMetadata} pkg * @returns {Promise>} the exports of the built module */ async function build( @@ -136,10 +140,30 @@ async function build( isProd, format, version, + pkg, ) { const extensions = ['.js', '.jsx', '.ts', '.tsx']; const inputOptions = { external(modulePath, src) { + const modulePkgName = modulePackageMappings[modulePath]; + if ( + typeof modulePkgName === 'string' && + !( + modulePkgName in pkg.packageJson.dependencies || + modulePkgName === pkg.getNpmName() + ) + ) { + console.error( + `Error: ${path.relative( + '.', + src, + )} has an undeclared dependency in its import of ${modulePath}.\nAdd the following to the dependencies in ${path.relative( + '.', + pkg.resolve('package.json'), + )}: "${modulePkgName}": "${version}"`, + ); + process.exit(1); + } return ( monorepoExternalsSet.has(modulePath) || thirdPartyExternalsRegExp.test(modulePath) @@ -422,6 +446,7 @@ async function buildAll() { isProduction, format, version, + pkg, ); if (isRelease) { @@ -436,6 +461,7 @@ async function buildAll() { false, format, version, + pkg, ); buildForkModules(outputPath, outputFileName, format, exports); }