Match-id-89183a3ae32ba8b7c4fa124ee6a963ebc130fbb4
This commit is contained in:
commit
068b2af4dc
|
@ -1,3 +1,6 @@
|
||||||
|
## 0.0.21 (2022-09-20)
|
||||||
|
- **core**: #85 所有事件中发生的多次更新都合并执行
|
||||||
|
-
|
||||||
## 0.0.20 (2022-09-14)
|
## 0.0.20 (2022-09-14)
|
||||||
- **core**: #81 fix Memo场景路径错误
|
- **core**: #81 fix Memo场景路径错误
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"horizon"
|
"horizon"
|
||||||
],
|
],
|
||||||
"version": "0.0.20",
|
"version": "0.0.21",
|
||||||
"homepage": "",
|
"homepage": "",
|
||||||
"bugs": "",
|
"bugs": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
|
|
|
@ -7,7 +7,7 @@ import {
|
||||||
} from './EventHub';
|
} from './EventHub';
|
||||||
import { isDocument } from '../dom/utils/Common';
|
import { isDocument } from '../dom/utils/Common';
|
||||||
import { getNearestVNode, getNonDelegatedListenerMap } from '../dom/DOMInternalKeys';
|
import { getNearestVNode, getNonDelegatedListenerMap } from '../dom/DOMInternalKeys';
|
||||||
import { runDiscreteUpdates } from '../renderer/TreeBuilder';
|
import { asyncUpdates, runDiscreteUpdates } from '../renderer/TreeBuilder';
|
||||||
import { handleEventMain } from './HorizonEventMain';
|
import { handleEventMain } from './HorizonEventMain';
|
||||||
import { decorateNativeEvent } from './EventWrapper';
|
import { decorateNativeEvent } from './EventWrapper';
|
||||||
import { VNode } from '../renderer/vnode/VNode';
|
import { VNode } from '../renderer/vnode/VNode';
|
||||||
|
@ -98,7 +98,9 @@ function isCaptureEvent(horizonEventName) {
|
||||||
function getWrapperListener(horizonEventName, nativeEvtName, targetElement, listener) {
|
function getWrapperListener(horizonEventName, nativeEvtName, targetElement, listener) {
|
||||||
return event => {
|
return event => {
|
||||||
const customEvent = decorateNativeEvent(horizonEventName, nativeEvtName, event);
|
const customEvent = decorateNativeEvent(horizonEventName, nativeEvtName, event);
|
||||||
listener(customEvent);
|
asyncUpdates(() => {
|
||||||
|
listener(customEvent);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ export const horizonEventToNativeMap = new Map([
|
||||||
['onFocus', ['focusin']],
|
['onFocus', ['focusin']],
|
||||||
['onBlur', ['focusout']],
|
['onBlur', ['focusout']],
|
||||||
['onInput', ['input']],
|
['onInput', ['input']],
|
||||||
|
['onWheel', ['wheel']],
|
||||||
['onMouseOut', ['mouseout']],
|
['onMouseOut', ['mouseout']],
|
||||||
['onMouseOver', ['mouseover']],
|
['onMouseOver', ['mouseover']],
|
||||||
['onPointerOut', ['pointerout']],
|
['onPointerOut', ['pointerout']],
|
||||||
|
@ -41,6 +42,7 @@ export const horizonEventToNativeMap = new Map([
|
||||||
]);
|
]);
|
||||||
export const NativeEventToHorizonMap = {
|
export const NativeEventToHorizonMap = {
|
||||||
click: 'click',
|
click: 'click',
|
||||||
|
wheel: 'wheel',
|
||||||
dblclick: 'doubleClick',
|
dblclick: 'doubleClick',
|
||||||
contextmenu: 'contextMenu',
|
contextmenu: 'contextMenu',
|
||||||
dragend: 'dragEnd',
|
dragend: 'dragEnd',
|
||||||
|
|
|
@ -7,9 +7,9 @@
|
||||||
"lint": "eslint . --ext .ts",
|
"lint": "eslint . --ext .ts",
|
||||||
"build": "rollup --config ./scripts/rollup/rollup.config.js",
|
"build": "rollup --config ./scripts/rollup/rollup.config.js",
|
||||||
"build:watch": "rollup --watch --config ./scripts/rollup/rollup.config.js",
|
"build:watch": "rollup --watch --config ./scripts/rollup/rollup.config.js",
|
||||||
"build-3rdLib": "node ./scripts/gen3rdLib.js",
|
"build:3rdLib": "node ./scripts/gen3rdLib.js build:3rdLib",
|
||||||
"build-3rdLib-dev": "npm run build & node ./scripts/gen3rdLib.js --dev",
|
"build:3rdLib-dev": "npm run build & node ./scripts/gen3rdLib.js build:3rdLib-dev",
|
||||||
"build-horizon3rdLib-dev": "npm run build & node ./scripts/gen3rdLib.js --dev --type horizon",
|
"build:horizon3rdLib-dev": "npm run build & node ./scripts/gen3rdLib.js build:horizon3rdLib-dev",
|
||||||
"build-types": "tsc -p ./libs/horizon/index.ts --emitDeclarationOnly --declaration --declarationDir ./build/horizon/@types --skipLibCheck",
|
"build-types": "tsc -p ./libs/horizon/index.ts --emitDeclarationOnly --declaration --declarationDir ./build/horizon/@types --skipLibCheck",
|
||||||
"debug-test": "yarn test --debug",
|
"debug-test": "yarn test --debug",
|
||||||
"test": "jest --config=jest.config.js",
|
"test": "jest --config=jest.config.js",
|
||||||
|
|
|
@ -1,44 +1,24 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
const ejs = require('ejs');
|
|
||||||
const fs = require('fs');
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const chalk = require('chalk');
|
const fs = require('fs');
|
||||||
const console = require('console');
|
const childProcess = require('child_process');
|
||||||
const rimRaf = require('rimRaf');
|
|
||||||
const argv = require('minimist')(process.argv.slice(2));
|
|
||||||
|
|
||||||
const libPathPrefix = '../build';
|
const horizonEcoPath = path.resolve(__dirname, '../../horizon-ecosystem');
|
||||||
const suffix = argv.dev ? 'development.js' : 'production.js';
|
if (!fs.existsSync(horizonEcoPath)) {
|
||||||
const template = argv.type === 'horizon' ? 'horizon3rdTemplate.ejs' : 'template.ejs';
|
throw Error('horizon-ecosystem not found, put horizon-core and horizon-ecosystem in same folder plz!');
|
||||||
const templatePath = path.resolve(__dirname, `./${template}`);
|
|
||||||
if (!fs.existsSync(templatePath)) {
|
|
||||||
console.log(chalk.yellow('Failed: Template file not exist'));
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
const readLib = lib => {
|
|
||||||
const libName = lib.split('.')[0];
|
|
||||||
const libPath = path.resolve(__dirname, `${libPathPrefix}/${libName}/umd/${lib}`);
|
|
||||||
if (fs.existsSync(libPath)) {
|
|
||||||
return fs.readFileSync(libPath, 'utf-8');
|
|
||||||
} else {
|
|
||||||
console.log(chalk.red(`Error: "${libPath}" 文件不存在\n先运行 npm run build`));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
ejs.renderFile(
|
const cmd = process.argv[2];
|
||||||
path.resolve(__dirname, `./${template}`),
|
childProcess.exec(
|
||||||
|
`npm run ${cmd}`,
|
||||||
{
|
{
|
||||||
Horizon: readLib(`horizon.${suffix}`),
|
cwd: horizonEcoPath,
|
||||||
},
|
},
|
||||||
null,
|
function (error, stdout) {
|
||||||
function(err, result) {
|
if (error) {
|
||||||
const common3rdLibPath = path.resolve(__dirname, `${libPathPrefix}/horizonCommon3rdlib.min.js`);
|
console.log(`Error: ${error}`);
|
||||||
rimRaf(common3rdLibPath, e => {
|
} else {
|
||||||
if (e) {
|
console.log(`STDOUT: ${stdout}`);
|
||||||
console.log(e);
|
}
|
||||||
}
|
|
||||||
fs.writeFileSync(common3rdLibPath, result);
|
|
||||||
console.log(chalk.green(`成功生成: ${common3rdLibPath}`));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue