diff --git a/build/pre-publish.js b/build/pre-publish.js index d64ba18554..c79889742e 100644 --- a/build/pre-publish.js +++ b/build/pre-publish.js @@ -67,10 +67,10 @@ const extensionSrcGlobby = { cwd: ecDir }; const extensionSrcDir = nodePath.resolve(ecDir, 'extension-src'); -const extensionCJSDir = nodePath.resolve(ecDir, 'extension'); -const extensionESMDir = nodePath.resolve(ecDir, 'extension-esm'); +const extensionESMDir = nodePath.resolve(ecDir, 'extension'); const typesDir = nodePath.resolve(ecDir, 'types'); +const esmDir = 'lib'; const compileWorkList = [ @@ -93,7 +93,7 @@ const compileWorkList = [ before: async function () { fsExtra.removeSync(tmpDir); fsExtra.removeSync(nodePath.resolve(ecDir, 'types')); - fsExtra.removeSync(nodePath.resolve(ecDir, 'esm')); + fsExtra.removeSync(nodePath.resolve(ecDir, esmDir)); fsExtra.removeSync(nodePath.resolve(ecDir, 'index.js')); fsExtra.removeSync(nodePath.resolve(ecDir, 'index.blank.js')); fsExtra.removeSync(nodePath.resolve(ecDir, 'index.common.js')); @@ -104,66 +104,18 @@ const compileWorkList = [ fs.renameSync(nodePath.resolve(tmpDir, 'src/echarts.blank.js'), nodePath.resolve(ecDir, 'index.blank.js')); fs.renameSync(nodePath.resolve(tmpDir, 'src/echarts.common.js'), nodePath.resolve(ecDir, 'index.common.js')); fs.renameSync(nodePath.resolve(tmpDir, 'src/echarts.simple.js'), nodePath.resolve(ecDir, 'index.simple.js')); - fs.renameSync(nodePath.resolve(tmpDir, 'src'), nodePath.resolve(ecDir, 'esm')); + fs.renameSync(nodePath.resolve(tmpDir, 'src'), nodePath.resolve(ecDir, esmDir)); - transformRootFolderInEntry(nodePath.resolve(ecDir, 'index.js'), 'esm'); - transformRootFolderInEntry(nodePath.resolve(ecDir, 'index.blank.js'), 'esm'); - transformRootFolderInEntry(nodePath.resolve(ecDir, 'index.common.js'), 'esm'); - transformRootFolderInEntry(nodePath.resolve(ecDir, 'index.simple.js'), 'esm'); + transformRootFolderInEntry(nodePath.resolve(ecDir, 'index.js'), esmDir); + transformRootFolderInEntry(nodePath.resolve(ecDir, 'index.blank.js'), esmDir); + transformRootFolderInEntry(nodePath.resolve(ecDir, 'index.common.js'), esmDir); + transformRootFolderInEntry(nodePath.resolve(ecDir, 'index.simple.js'), esmDir); - await transformDistributionFiles(nodePath.resolve(ecDir, 'esm'), 'esm'); - await transformDistributionFiles(nodePath.resolve(ecDir, 'types'), 'esm'); + await transformDistributionFiles(nodePath.resolve(ecDir, esmDir), esmDir); + await transformDistributionFiles(nodePath.resolve(ecDir, 'types'), esmDir); fsExtra.removeSync(tmpDir); } }, - { - logLabel: 'main ts -> js-cjs', - compilerOptionsOverride: { - module: 'CommonJS', - // `rootDir` Only use to control the output - // directory structure with --outDir. - rootDir: ecDir, - outDir: tmpDir - }, - srcGlobby: mainSrcGlobby, - transformOptions: { - filesGlobby: {patterns: ['**/*.js'], cwd: tmpDir}, - preamble: preamble.js, - transformDEV: true - }, - before: async function () { - fsExtra.removeSync(tmpDir); - fsExtra.removeSync(nodePath.resolve(ecDir, 'lib')); - }, - after: async function () { - fs.renameSync(nodePath.resolve(tmpDir, 'src'), nodePath.resolve(ecDir, 'lib')); - await transformDistributionFiles(nodePath.resolve(ecDir, 'lib'), 'lib'); - - removeESmoduleMark(); - - fsExtra.removeSync(tmpDir); - } - }, - { - logLabel: 'extension ts -> js-cjs', - compilerOptionsOverride: { - module: 'CommonJS', - rootDir: extensionSrcDir, - outDir: extensionCJSDir - }, - srcGlobby: extensionSrcGlobby, - transformOptions: { - filesGlobby: {patterns: ['**/*.js'], cwd: extensionCJSDir}, - preamble: preamble.js, - transformDEV: true - }, - before: async function () { - fsExtra.removeSync(extensionCJSDir); - }, - after: async function () { - await transformDistributionFiles(extensionCJSDir, 'lib'); - } - }, { logLabel: 'extension ts -> js-esm', compilerOptionsOverride: { @@ -181,7 +133,7 @@ const compileWorkList = [ fsExtra.removeSync(extensionESMDir); }, after: async function () { - await transformDistributionFiles(extensionESMDir, 'esm'); + await transformDistributionFiles(extensionESMDir, 'lib'); } } ]; diff --git a/build/template/charts.js b/build/template/charts.js index c46eb33b98..f3d519ba67 100644 --- a/build/template/charts.js +++ b/build/template/charts.js @@ -24,4 +24,4 @@ // import * as LineChart_1 './chart/line/install'; export {LineChart_1 as LineChart}; // Treeshaking in webpack will not work even if we configured sideEffects to false in package.json -export * from './esm/export/charts'; \ No newline at end of file +export * from './lib/export/charts'; \ No newline at end of file diff --git a/build/template/components.js b/build/template/components.js index ace4ccf3bb..74e95af781 100644 --- a/build/template/components.js +++ b/build/template/components.js @@ -17,4 +17,4 @@ * under the License. */ -export * from './esm/export/components'; \ No newline at end of file +export * from './lib/export/components'; \ No newline at end of file diff --git a/build/template/core.js b/build/template/core.js index 4ecbe9968e..203185ec00 100644 --- a/build/template/core.js +++ b/build/template/core.js @@ -17,4 +17,4 @@ * under the License. */ -export * from './esm/export/core'; \ No newline at end of file +export * from './lib/export/core'; \ No newline at end of file diff --git a/build/template/renderers.js b/build/template/renderers.js index bef382475f..39f7004c55 100644 --- a/build/template/renderers.js +++ b/build/template/renderers.js @@ -17,4 +17,4 @@ * under the License. */ -export * from './esm/export/renderers'; \ No newline at end of file +export * from './lib/export/renderers'; \ No newline at end of file diff --git a/package.json b/package.json index b673dcfe5b..aa82a5d6ed 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "canvas", "svg" ], - "main": "lib/echarts.all.js", + "main": "dist/echarts.js", "module": "index.js", "jsdelivr": "dist/echarts.min.js", "types": "index.d.ts", @@ -32,8 +32,10 @@ "index.blank.js", "index.common.js", "index.simple.js", - "esm/chart/*.js", - "esm/components/*.js" + "lib/chart/*.js", + "lib/components/*.js", + "theme/*.js", + "i18n/*.js" ], "scripts": { "prepublish": "node build/build.js --prepublish", diff --git a/src/chart/treemap/TreemapSeries.ts b/src/chart/treemap/TreemapSeries.ts index 90168cc224..67b0081a21 100644 --- a/src/chart/treemap/TreemapSeries.ts +++ b/src/chart/treemap/TreemapSeries.ts @@ -35,7 +35,8 @@ import { OptionName, DecalObject, SeriesLabelOption, - DefaultEmphasisFocus + DefaultEmphasisFocus, + AriaOptionMixin } from '../../util/types'; import GlobalModel from '../../model/Global'; import { LayoutRect } from '../../util/layout'; @@ -535,7 +536,9 @@ function completeTreeValue(dataNode: TreemapSeriesNodeItemOption) { */ function setDefault(levels: TreemapSeriesLevelOption[], ecModel: GlobalModel) { const globalColorList = normalizeToArray(ecModel.get('color')) as ColorString[]; - const globalDecalList = normalizeToArray(ecModel.get(['aria', 'decal', 'decals'])) as DecalObject[]; + const globalDecalList = normalizeToArray( + (ecModel as Model).get(['aria', 'decal', 'decals']) + ) as DecalObject[]; if (!globalColorList) { return; diff --git a/src/component/aria/install.ts b/src/component/aria/install.ts index c1136e76bb..552e81586a 100644 --- a/src/component/aria/install.ts +++ b/src/component/aria/install.ts @@ -20,54 +20,6 @@ import { EChartsExtensionInstallRegisters } from '../../extension'; import ariaVisual from '../../visual/aria'; import ariaPreprocessor from './preprocessor'; -import { DecalObject } from '../../util/types'; - -export interface AriaLabelOption { - enabled?: boolean; - description?: string; - general?: { - withTitle?: string; - withoutTitle?: string; - }; - series?: { - maxCount?: number; - single?: { - prefix?: string; - withName?: string; - withoutName?: string; - }; - multiple?: { - prefix?: string; - withName?: string; - withoutName?: string; - separator?: { - middle?: string; - end?: string; - } - } - }; - data?: { - maxCount?: number; - allData?: string; - partialData?: string; - withName?: string; - withoutName?: string; - separator?: { - middle?: string; - end?: string; - } - } -} - -// Extending is for compating ECharts 4 -export interface AriaOption extends AriaLabelOption { - enabled?: boolean; - label?: AriaLabelOption; - decal?: { - show?: boolean; - decals?: DecalObject | DecalObject[]; - }; -} export function install(registers: EChartsExtensionInstallRegisters) { registers.registerPreprocessor(ariaPreprocessor); diff --git a/src/export/option.ts b/src/export/option.ts index e75074766f..14e967273f 100644 --- a/src/export/option.ts +++ b/src/export/option.ts @@ -79,7 +79,6 @@ import type {ThemeRiverSeriesOption as ThemeRiverSeriesOptionInner} from '../cha import type {SunburstSeriesOption as SunburstSeriesOptionInner} from '../chart/sunburst/SunburstSeries'; import type {CustomSeriesOption as CustomSeriesOptionInner} from '../chart/custom/install'; import type { GraphicComponentLooseOption as GraphicComponentOption } from '../component/graphic/install'; -import type { AriaOption as AriaComponentOption } from '../component/aria/install'; import type { DatasetOption as DatasetComponentOption } from '../component/dataset/install'; import type {ToolboxBrushFeatureOption} from '../component/toolbox/feature/Brush'; @@ -91,7 +90,7 @@ import type {ToolboxSaveAsImageFeatureOption} from '../component/toolbox/feature import type {ToolboxFeatureOption} from '../component/toolbox/featureManager'; -import type { ECBasicOption, SeriesTooltipOption } from '../util/types'; +import type { ECBasicOption, SeriesTooltipOption, AriaOption as AriaComponentOption } from '../util/types'; interface ToolboxComponentOption extends ToolboxOption { feature?: { diff --git a/src/util/types.ts b/src/util/types.ts index eed76f47ca..cd705271d9 100644 --- a/src/util/types.ts +++ b/src/util/types.ts @@ -46,7 +46,6 @@ import { PathStyleProps } from 'zrender/src/graphic/Path'; import { ImageStyleProps } from 'zrender/src/graphic/Image'; import ZRText, { TextStyleProps } from 'zrender/src/graphic/Text'; import { Source } from '../data/Source'; -import { AriaOption } from './../component/aria/install'; @@ -719,6 +718,53 @@ export interface ColorPaletteOptionMixin { colorLayer?: ZRColor[][] } +export interface AriaLabelOption { + enabled?: boolean; + description?: string; + general?: { + withTitle?: string; + withoutTitle?: string; + }; + series?: { + maxCount?: number; + single?: { + prefix?: string; + withName?: string; + withoutName?: string; + }; + multiple?: { + prefix?: string; + withName?: string; + withoutName?: string; + separator?: { + middle?: string; + end?: string; + } + } + }; + data?: { + maxCount?: number; + allData?: string; + partialData?: string; + withName?: string; + withoutName?: string; + separator?: { + middle?: string; + end?: string; + } + } +} + +// Extending is for compating ECharts 4 +export interface AriaOption extends AriaLabelOption { + enabled?: boolean; + label?: AriaLabelOption; + decal?: { + show?: boolean; + decals?: DecalObject | DecalObject[]; + }; +} + export interface AriaOptionMixin { aria?: AriaOption } diff --git a/src/visual/aria.ts b/src/visual/aria.ts index 76fc62c8f7..ead564f492 100644 --- a/src/visual/aria.ts +++ b/src/visual/aria.ts @@ -24,10 +24,9 @@ import GlobalModel from '../model/Global'; import Model from '../model/Model'; import SeriesModel from '../model/Series'; import {makeInner} from '../util/model'; -import {Dictionary, DecalObject, InnerDecalObject} from '../util/types'; +import {Dictionary, DecalObject, InnerDecalObject, AriaOption} from '../util/types'; import {LocaleOption} from '../locale'; import { getDecalFromPalette } from '../model/mixin/palette'; -import type {AriaOption} from '../component/aria/install'; import type {TitleOption} from '../component/title/install'; const DEFAULT_OPTION: AriaOption = {