DaZuiZui opened a new pull request, #21709:
URL: https://github.com/apache/echarts/pull/21709

   ## Brief Information
   
   This pull request is in the type of:
   
   - [ ] bug fixing
   - [x] new feature
   - [ ] others
   
   ### What does this PR do?
   
   Exposes a stable toolbox-feature registration API for independently packaged 
ECharts extensions.
   
   ### Fixed issues
   
   - #21693: provides the core extension point required by the proposed 
independent `export-toolbox` package; the exporter package itself remains 
outside ECharts core.
   
   ## Details
   
   ### Before: What was the problem?
   
   Toolbox features are stored in an internal registry. ECharts extensions 
installed with `echarts.use()` cannot access that registry, and the public 
custom-feature path only recognizes option keys prefixed with `my`. As a 
result, an independent package cannot register a first-class feature such as 
`toolbox.feature.exportData` without importing internal modules.
   
   ### After: How does it behave after the fixing?
   
   The extension installer now exposes `registerToolboxFeature(name, ctor)`. 
`ToolboxFeature` and its option/model/constructor types, together with the 
extension installer types, are exported from `echarts/core`.
   
   An external package can now register a feature through the normal extension 
lifecycle:
   
   ```ts
   class ExportDataFeature extends ToolboxFeature<ExportDataFeatureOption> {
       onclick(): void {
           // Delegate to the package's shared programmatic exporter.
       }
   }
   
   const install: EChartsExtensionInstaller = (registers) => {
       registers.registerToolboxFeature('exportData', ExportDataFeature);
   };
   
   echarts.use(install);
   ```
   
   The change adds no exporter implementation or third-party dependency to 
ECharts core. CSV/PDF/XLSX implementations can remain independently packaged 
and tree-shakeable.
   
   ## Document Info
   
   - [ ] This PR doesn't relate to document changes
   - [x] The document should be updated later
   - [ ] The document changes have been made in apache/echarts-doc#xxx
   
   ## Misc
   
   ### Security Checking
   
   - [ ] This PR uses security-sensitive Web APIs.
   
   ### ZRender Changes
   
   - [ ] This PR depends on ZRender changes (ecomfe/zrender#xxx).
   
   ### Related test cases or examples to use the new APIs
   
   - Unit coverage verifies registration through `echarts.use()`.
   - Public DTS coverage verifies subclassing `ToolboxFeature` and calling 
`registerToolboxFeature` from `echarts/core`.
   - `npm run checktype`
   - Targeted Jest and ESLint checks
   - DTS tests with TypeScript 4.7 through 5.9
   
   ### Merging options
   
   - [x] Please squash the commits into a single one when merging.
   
   ### Other information
   
   The matching independent exporter prototype uses explicit `table` / 
`getTable(chart)` data sources and shares one exporter registry between its 
toolbox and programmatic APIs, as described in #21693.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to