From b84de1a515600d2ead1c2b5f6db949e7bf6ab923 Mon Sep 17 00:00:00 2001 From: vben Date: Fri, 16 Oct 2020 22:28:44 +0800 Subject: [PATCH] fix: fix npm script --- build/plugin/gzip/compress.ts | 4 ++-- build/script/cli.ts | 8 ++++---- build/script/preserve.ts | 2 ++ package.json | 2 +- src/components/Transition/src/ExpandTransition.ts | 12 +++++------- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/build/plugin/gzip/compress.ts b/build/plugin/gzip/compress.ts index a9d64bc5..cddc1c93 100644 --- a/build/plugin/gzip/compress.ts +++ b/build/plugin/gzip/compress.ts @@ -1,8 +1,8 @@ import { gzip } from 'zlib'; import { readFileSync, writeFileSync } from 'fs'; import { GzipPluginOptions } from './types'; -import viteConfig from '../../vite.config'; -import { readAllFile, getCwdPath, isBuildGzip, isSiteMode } from '../utils'; +import viteConfig from '../../../vite.config'; +import { readAllFile, getCwdPath, isBuildGzip, isSiteMode } from '../../utils'; export function startGzip( fileContent: string | Buffer, diff --git a/build/script/cli.ts b/build/script/cli.ts index 17f5b84b..c6287283 100644 --- a/build/script/cli.ts +++ b/build/script/cli.ts @@ -6,7 +6,7 @@ import { argv } from 'yargs'; import { runChangeLog } from './changelog'; import { runPostInstall } from './postinstall'; import { runPreview } from './preview'; -import { runPreserve } from './preserve'; +// import { runPreserve } from './preserve'; import { runBuild } from './build'; const task = (argv._ || [])[0]; @@ -23,9 +23,9 @@ switch (task) { runBuild(); break; - case 'preserve': - runPreserve(); - break; + // case 'preserve': + // runPreserve(); + // break; case 'postinstall': runPostInstall(); diff --git a/build/script/preserve.ts b/build/script/preserve.ts index cd4beaef..fa6a0c69 100644 --- a/build/script/preserve.ts +++ b/build/script/preserve.ts @@ -69,3 +69,5 @@ export async function runPreserve() { } catch (error) {} } } + +runPreserve(); diff --git a/package.json b/package.json index 884aa2bf..5a8db3fd 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "2.0.0-rc.1", "scripts": { "bootstrap": "yarn install", - "serve": "node ./build/jsc.ts preserve && cross-env NODE_ENV=development vite", + "serve": "cross-env ts-node --files -P ./build/tsconfig.json ./build/script/preserve && cross-env NODE_ENV=development vite", "build": "node ./build/jsc.ts build", "build:site": "cross-env SITE=true npm run build ", "build:no-cache": "yarn clean:cache && npm run build", diff --git a/src/components/Transition/src/ExpandTransition.ts b/src/components/Transition/src/ExpandTransition.ts index 6771c7a0..6b7e8126 100644 --- a/src/components/Transition/src/ExpandTransition.ts +++ b/src/components/Transition/src/ExpandTransition.ts @@ -33,14 +33,14 @@ export default function (expandedParentClass = '', x = false) { enter(el: HTMLExpandElement) { const initialStyle = el._initialStyle; - const offset = `${el[offsetProperty]}px`; el.style.setProperty('transition', 'none', 'important'); - el.style.visibility = 'hidden'; - el.style.visibility = initialStyle.visibility!; + // Hide overflow to account for collapsed margins in the calculated height el.style.overflow = 'hidden'; + const offset = `${el[offsetProperty]}px`; + el.style[sizeProperty] = '0'; - /* eslint-disable-next-line */ + void el.offsetHeight; // force reflow el.style.transition = initialStyle.transition; @@ -48,9 +48,7 @@ export default function (expandedParentClass = '', x = false) { if (expandedParentClass && el._parent) { el._parent.classList.add(expandedParentClass); } - console.log('======================'); - console.log(sizeProperty, offset); - console.log('======================'); + requestAnimationFrame(() => { el.style[sizeProperty] = offset; }); -- GitLab