@univerjs-pro/engine-chart 1.0.0-beta.0 → 1.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/README.md +9 -0
  2. package/lib/cjs/facade.js +1 -1
  3. package/lib/cjs/index.js +1 -1
  4. package/lib/cjs/locale/ar-SA.js +1 -1
  5. package/lib/cjs/locale/ca-ES.js +1 -1
  6. package/lib/cjs/locale/de-DE.js +1 -1
  7. package/lib/cjs/locale/en-US.js +1 -1
  8. package/lib/cjs/locale/es-ES.js +1 -1
  9. package/lib/cjs/locale/fa-IR.js +1 -1
  10. package/lib/cjs/locale/fr-FR.js +1 -1
  11. package/lib/cjs/locale/id-ID.js +1 -1
  12. package/lib/cjs/locale/it-IT.js +1 -1
  13. package/lib/cjs/locale/ja-JP.js +1 -1
  14. package/lib/cjs/locale/ko-KR.js +1 -1
  15. package/lib/cjs/locale/pl-PL.js +1 -1
  16. package/lib/cjs/locale/pt-BR.js +1 -1
  17. package/lib/cjs/locale/ru-RU.js +1 -1
  18. package/lib/cjs/locale/sk-SK.js +1 -1
  19. package/lib/cjs/locale/vi-VN.js +1 -1
  20. package/lib/cjs/locale/zh-CN.js +1 -1
  21. package/lib/cjs/locale/zh-HK.js +1 -1
  22. package/lib/cjs/locale/zh-TW.js +1 -1
  23. package/lib/es/facade.js +1 -1
  24. package/lib/es/index.js +1 -1
  25. package/lib/es/locale/ar-SA.js +1 -1
  26. package/lib/es/locale/ca-ES.js +1 -1
  27. package/lib/es/locale/de-DE.js +1 -1
  28. package/lib/es/locale/en-US.js +1 -1
  29. package/lib/es/locale/es-ES.js +1 -1
  30. package/lib/es/locale/fa-IR.js +1 -1
  31. package/lib/es/locale/fr-FR.js +1 -1
  32. package/lib/es/locale/id-ID.js +1 -1
  33. package/lib/es/locale/it-IT.js +1 -1
  34. package/lib/es/locale/ja-JP.js +1 -1
  35. package/lib/es/locale/ko-KR.js +1 -1
  36. package/lib/es/locale/pl-PL.js +1 -1
  37. package/lib/es/locale/pt-BR.js +1 -1
  38. package/lib/es/locale/ru-RU.js +1 -1
  39. package/lib/es/locale/sk-SK.js +1 -1
  40. package/lib/es/locale/vi-VN.js +1 -1
  41. package/lib/es/locale/zh-CN.js +1 -1
  42. package/lib/es/locale/zh-HK.js +1 -1
  43. package/lib/es/locale/zh-TW.js +1 -1
  44. package/lib/facade.js +1 -1
  45. package/lib/index.js +1 -1
  46. package/lib/locale/ar-SA.js +1 -1
  47. package/lib/locale/ca-ES.js +1 -1
  48. package/lib/locale/de-DE.js +1 -1
  49. package/lib/locale/en-US.js +1 -1
  50. package/lib/locale/es-ES.js +1 -1
  51. package/lib/locale/fa-IR.js +1 -1
  52. package/lib/locale/fr-FR.js +1 -1
  53. package/lib/locale/id-ID.js +1 -1
  54. package/lib/locale/it-IT.js +1 -1
  55. package/lib/locale/ja-JP.js +1 -1
  56. package/lib/locale/ko-KR.js +1 -1
  57. package/lib/locale/pl-PL.js +1 -1
  58. package/lib/locale/pt-BR.js +1 -1
  59. package/lib/locale/ru-RU.js +1 -1
  60. package/lib/locale/sk-SK.js +1 -1
  61. package/lib/locale/vi-VN.js +1 -1
  62. package/lib/locale/zh-CN.js +1 -1
  63. package/lib/locale/zh-HK.js +1 -1
  64. package/lib/locale/zh-TW.js +1 -1
  65. package/lib/types/chart-builder/chart-builder-adapter.d.ts +1 -3
  66. package/lib/types/chart-builder/chart-builder.d.ts +2 -5
  67. package/lib/types/chart-builder/chart-live-adapter.d.ts +15 -0
  68. package/lib/types/chart-builder/chart-types.d.ts +21 -0
  69. package/lib/types/chart-builder/configuration/cartesian-series.d.ts +1 -0
  70. package/lib/types/chart-builder/configuration/chart-config-group.d.ts +38 -0
  71. package/lib/types/chart-builder/configuration/chart-config-operation.d.ts +1 -38
  72. package/lib/types/chart-builder/configuration/gauge.d.ts +1 -1
  73. package/lib/types/chart-builder/conversion/chart-config-converter.d.ts +24 -11
  74. package/lib/types/chart-builder/conversion/chart-create-config.d.ts +6 -0
  75. package/lib/types/chart-builder/conversion/chart-model-fields.d.ts +20 -0
  76. package/lib/types/chart-builder/conversion/chart-type-converter.d.ts +1 -3
  77. package/lib/types/chart-builder/conversion/describe-chart-model.d.ts +0 -127
  78. package/lib/types/chart-builder/detached-chart-builder-adapter.d.ts +1 -10
  79. package/lib/types/chart-builder/internal/apply-pending-to-description.d.ts +2 -0
  80. package/lib/types/chart-builder/internal/chart-host-config-adapter.d.ts +3 -0
  81. package/lib/types/chart-builder/internal/chart-pending-patch.d.ts +11 -0
  82. package/lib/types/chart-builder/internal/patch-interpreter.d.ts +17 -0
  83. package/lib/types/facade/builders/f-area-chart-builder.d.ts +52 -7
  84. package/lib/types/facade/builders/f-boxplot-chart-builder.d.ts +88 -3
  85. package/lib/types/facade/builders/f-bubble-chart-builder.d.ts +59 -6
  86. package/lib/types/facade/builders/f-candlestick-chart-builder.d.ts +90 -31
  87. package/lib/types/facade/builders/f-chord-chart-builder.d.ts +180 -8
  88. package/lib/types/facade/builders/f-combination-chart-builder.d.ts +55 -10
  89. package/lib/types/facade/builders/f-funnel-chart-builder.d.ts +55 -9
  90. package/lib/types/facade/builders/f-gauge-chart-builder.d.ts +378 -10
  91. package/lib/types/facade/builders/f-heatmap-chart-builder.d.ts +83 -26
  92. package/lib/types/facade/builders/f-histogram-chart-builder.d.ts +142 -16
  93. package/lib/types/facade/builders/f-line-chart-builder.d.ts +51 -6
  94. package/lib/types/facade/builders/f-pareto-chart-builder.d.ts +83 -20
  95. package/lib/types/facade/builders/f-pie-chart-builder.d.ts +131 -47
  96. package/lib/types/facade/builders/f-radar-chart-builder.d.ts +64 -11
  97. package/lib/types/facade/builders/f-relation-chart-builder.d.ts +72 -38
  98. package/lib/types/facade/builders/f-scatter-chart-builder.d.ts +58 -6
  99. package/lib/types/facade/builders/f-sunburst-chart-builder.d.ts +122 -8
  100. package/lib/types/facade/builders/f-treemap-chart-builder.d.ts +115 -13
  101. package/lib/types/facade/builders/f-waterfall-chart-builder.d.ts +87 -53
  102. package/lib/types/facade/builders/f-word-cloud-chart-builder.d.ts +64 -15
  103. package/lib/types/facade/chart-builder-registry.d.ts +4 -4
  104. package/lib/types/facade/chart-builder-type-map.d.ts +35 -32
  105. package/lib/types/facade/chart-host-builder-types.d.ts +2 -21
  106. package/lib/types/facade/create-chart-builder.d.ts +46 -0
  107. package/lib/types/facade/f-axis-chart-builder.d.ts +21 -38
  108. package/lib/types/facade/f-cartesian-chart-builder.d.ts +32 -20
  109. package/lib/types/facade/f-chart-builder-base.d.ts +240 -73
  110. package/lib/types/facade/f-chart.d.ts +686 -0
  111. package/lib/types/facade/f-enum.d.ts +684 -31
  112. package/lib/types/facade/f-univer.d.ts +51 -0
  113. package/lib/types/facade/index.d.ts +7 -9
  114. package/lib/types/facade/internal/category-fields.d.ts +3 -0
  115. package/lib/types/facade/internal/chart-builder-facade-context.d.ts +11 -10
  116. package/lib/types/index.d.ts +28 -17
  117. package/lib/types/models/chart-context/chart-field-selection.d.ts +1 -1
  118. package/lib/types/models/chart-context/resolve-chart-context.d.ts +3 -0
  119. package/lib/types/models/chart-data/chart-field-consumption-validator.d.ts +1 -1
  120. package/lib/types/models/chart-data/internal/category-series-aggregation.d.ts +1 -2
  121. package/lib/types/models/chart-data/internal/data-set-category-spans.d.ts +7 -0
  122. package/lib/types/models/chart-data/internal/multi-level-category-axis.d.ts +10 -0
  123. package/lib/types/models/chart-host/config/chart-config-interpreter.d.ts +13 -0
  124. package/lib/types/models/chart-host/resource/chart-data-source-resolver.d.ts +58 -0
  125. package/lib/types/models/chart-host/resource/chart-resource-repository.d.ts +111 -0
  126. package/lib/types/models/chart-host/resource/chart-resource-serializer.d.ts +2 -1
  127. package/lib/types/models/chart-host/resource/inline-chart-table.d.ts +4 -3
  128. package/lib/types/models/chart-host/resource/persisted-chart-style.d.ts +3 -0
  129. package/lib/types/models/chart-host/resource/resource-ref-chart-data-source.adapter.d.ts +22 -0
  130. package/lib/types/models/chart-host/resource/resource-ref-chart-data-source.provider.d.ts +12 -0
  131. package/lib/types/models/chart-host/static/chart-model-store.d.ts +56 -0
  132. package/lib/types/models/chart-host/static/{static-chart-runtime.d.ts → chart-runtime.d.ts} +6 -5
  133. package/lib/types/models/chart-model/chart-model.d.ts +2 -383
  134. package/lib/types/models/chart-render/axes/chart-runtime-axes.d.ts +2 -2
  135. package/lib/types/models/chart-render/chart-render-input-resolver.d.ts +2 -2
  136. package/lib/types/models/chart-render/converter/category-axis-domain.d.ts +6 -0
  137. package/lib/types/models/chart-render/converter/converters/gauge-chart-converter.d.ts +5 -3
  138. package/lib/types/models/chart-render/converter/echart-text-overflow.d.ts +7 -0
  139. package/lib/types/models/chart-render/converter/render-spec-operators/grid-operator.d.ts +3 -3
  140. package/lib/types/models/chart-render/converter/render-spec-operators/legend-size.d.ts +1 -2
  141. package/lib/types/models/chart-render/converter/render-spec-operators/multi-level-category-axis-grid.operator.d.ts +2 -0
  142. package/lib/types/models/chart-render/converter/render-spec-operators/multi-level-category-axis-layout.d.ts +23 -0
  143. package/lib/types/models/chart-render/converter/render-spec-operators/multi-level-category-axis-overlay.operator.d.ts +12 -0
  144. package/lib/types/models/chart-render/converter/render-spec-operators/series-style-operator/series-style-operator.d.ts +2 -2
  145. package/lib/types/models/chart-render/converter/render-spec-operators/tool-tip-operator.d.ts +3 -13
  146. package/lib/types/models/chart-render/converter/render-spec-operators/tools.d.ts +4 -4
  147. package/lib/types/models/chart-render/converter/render-spec-operators/visual-map-operator.d.ts +4 -0
  148. package/lib/types/models/chart-render/echart-render-model.d.ts +7 -3
  149. package/lib/types/models/chart-render/edit-overlay/chart-element-edit-overlay.d.ts +1 -1
  150. package/lib/types/models/chart-render/edit-overlay/resolve-chart-element-hit-layout.d.ts +1 -1
  151. package/lib/types/models/chart-render/style/chart-runtime-style.d.ts +0 -1
  152. package/lib/types/models/common/constants/default-chart-style.d.ts +53 -53
  153. package/lib/types/models/common/constants/default.d.ts +3 -2
  154. package/lib/types/plugin.d.ts +1 -1
  155. package/lib/types/types.d.ts +46 -6
  156. package/lib/types/util.d.ts +0 -1
  157. package/lib/types/utils/compact.d.ts +6 -0
  158. package/lib/types/utils/device-pixel-ratio.d.ts +1 -0
  159. package/lib/umd/facade.js +1 -1
  160. package/lib/umd/index.js +1 -1
  161. package/lib/umd/locale/ar-SA.js +1 -1
  162. package/lib/umd/locale/ca-ES.js +1 -1
  163. package/lib/umd/locale/de-DE.js +1 -1
  164. package/lib/umd/locale/en-US.js +1 -1
  165. package/lib/umd/locale/es-ES.js +1 -1
  166. package/lib/umd/locale/fa-IR.js +1 -1
  167. package/lib/umd/locale/fr-FR.js +1 -1
  168. package/lib/umd/locale/id-ID.js +1 -1
  169. package/lib/umd/locale/it-IT.js +1 -1
  170. package/lib/umd/locale/ja-JP.js +1 -1
  171. package/lib/umd/locale/ko-KR.js +1 -1
  172. package/lib/umd/locale/pl-PL.js +1 -1
  173. package/lib/umd/locale/pt-BR.js +1 -1
  174. package/lib/umd/locale/ru-RU.js +1 -1
  175. package/lib/umd/locale/sk-SK.js +1 -1
  176. package/lib/umd/locale/vi-VN.js +1 -1
  177. package/lib/umd/locale/zh-CN.js +1 -1
  178. package/lib/umd/locale/zh-HK.js +1 -1
  179. package/lib/umd/locale/zh-TW.js +1 -1
  180. package/package.json +7 -6
  181. package/lib/types/chart-builder/internal/host-builder-runtime.d.ts +0 -3
  182. package/lib/types/chart-builder/internal/merge-description.d.ts +0 -2
  183. package/lib/types/facade/f-chart-base.d.ts +0 -82
  184. package/lib/types/facade/f-charts-base.d.ts +0 -74
  185. package/lib/types/facade/internal/host-builder-composer.d.ts +0 -16
  186. package/lib/types/models/chart-host/resource/static-chart-resource-repository.d.ts +0 -75
  187. package/lib/types/models/chart-host/static/static-chart-model-store.d.ts +0 -43
@@ -0,0 +1,51 @@
1
+ import type { IEchartTheme } from '@univerjs-pro/engine-chart';
2
+ import { FUniver } from '@univerjs/core/facade';
3
+ /** @ignore */
4
+ export interface IFUniverChartMixin {
5
+ /**
6
+ * Registers a Chart theme in this Univer runtime.
7
+ *
8
+ * The theme is shared by Sheet, Slide, Document, and Board Charts. Use the
9
+ * same `name` with a Chart builder's `setTheme()` method to apply it.
10
+ * Registering the same name again replaces the previous theme.
11
+ *
12
+ * @param {string} name The stable name used by Chart builders.
13
+ * @param {IEchartTheme} theme The complete Chart theme definition.
14
+ * @returns {void}
15
+ * @example
16
+ * ```ts
17
+ * import { UniverTheme1 } from '@univerjs-pro/engine-chart';
18
+ *
19
+ * univerAPI.registerTheme('brand', {
20
+ * ...UniverTheme1,
21
+ * themeName: 'brand',
22
+ * theme: {
23
+ * ...UniverTheme1.theme,
24
+ * color: ['#1677ff', '#52c41a', '#faad14'],
25
+ * },
26
+ * });
27
+ *
28
+ * const fWorkbook = univerAPI.getActiveWorkbook();
29
+ * if (!fWorkbook) throw new Error('No active workbook.');
30
+ * const fWorksheet = fWorkbook.getSheetByName('Sheet1');
31
+ * if (!fWorksheet) throw new Error('Worksheet not found.');
32
+ *
33
+ * const chartInfo = fWorksheet
34
+ * .newChart(univerAPI.Enum.ChartTypeString.Column)
35
+ * .setSource('A1:D8')
36
+ * .setTheme('brand')
37
+ * .build();
38
+ *
39
+ * await fWorksheet.insertChart(chartInfo);
40
+ * ```
41
+ */
42
+ registerTheme(name: string, theme: IEchartTheme): void;
43
+ }
44
+ /** @ignore */
45
+ export declare class FUniverChartMixin extends FUniver implements IFUniverChartMixin {
46
+ registerTheme(name: string, theme: IEchartTheme): void;
47
+ }
48
+ declare module '@univerjs/core/facade' {
49
+ interface FUniver extends IFUniverChartMixin {
50
+ }
51
+ }
@@ -1,5 +1,7 @@
1
1
  import './register-builders';
2
2
  import './f-enum';
3
+ import './f-univer';
4
+ export type { IChartLiveAdapter } from '../chart-builder/chart-live-adapter';
3
5
  export { FAreaChartBuilder } from './builders/f-area-chart-builder';
4
6
  export { FBoxplotChartBuilder } from './builders/f-boxplot-chart-builder';
5
7
  export { FBubbleChartBuilder } from './builders/f-bubble-chart-builder';
@@ -20,16 +22,12 @@ export { FSunburstChartBuilder } from './builders/f-sunburst-chart-builder';
20
22
  export { FTreemapChartBuilder } from './builders/f-treemap-chart-builder';
21
23
  export { FWaterfallChartBuilder } from './builders/f-waterfall-chart-builder';
22
24
  export { FWordCloudChartBuilder } from './builders/f-word-cloud-chart-builder';
23
- export { getChartBuilderConstructor } from './chart-builder-registry';
24
- export type { IChartBuilderTypeMap } from './chart-builder-type-map';
25
- export type { HostAnyChartBuilder, HostChartBuilderOf, HostComposedChartBuilder, IHostChartBuilderTypes } from './chart-host-builder-types';
25
+ export type { FAnyChartBuilder, IChartBuilderTypeMap } from './chart-builder-type-map';
26
+ export type { HostComposedChartBuilder } from './chart-host-builder-types';
27
+ export type { FChartInfoBuilder, IChartBuilderExtensionContext } from './create-chart-builder';
28
+ export { createChartBuilder } from './create-chart-builder';
26
29
  export { FAxisChartBuilder } from './f-axis-chart-builder';
27
30
  export { FCartesianChartBuilder } from './f-cartesian-chart-builder';
28
- export { FChartBase } from './f-chart-base';
31
+ export { FChart } from './f-chart';
29
32
  export { FChartBuilderBase } from './f-chart-builder-base';
30
- export { FChartsBase } from './f-charts-base';
31
- export type { IChartBuilderHostTypes } from './f-charts-base';
32
- export { getChartBuilderPendingConfig } from './internal/chart-builder-facade-context';
33
33
  export { CHART_FACADE_RANDOM_ID_LENGTH } from './internal/constants';
34
- export { HostBuilderComposer } from './internal/host-builder-composer';
35
- export type { EngineChartBuilderConstructor } from './internal/host-builder-composer';
@@ -0,0 +1,3 @@
1
+ import type { ChartPendingConfig } from '@univerjs-pro/engine-chart';
2
+ export declare function createSetCategoryFieldsConfig(indexes: readonly number[]): ChartPendingConfig;
3
+ export declare function createClearCategoryFieldsConfig(): ChartPendingConfig;
@@ -1,12 +1,13 @@
1
- import type { ChartBuilder } from '@univerjs-pro/engine-chart';
2
- export type ChartFacadeBuilderConstructor<TFacade = unknown> = new (context: IChartBuilderFacadeContext) => TFacade;
3
- /** Facade-owned wrapping context for one shared chart builder instance. */
4
- export interface IChartBuilderFacadeContext<TBuilder extends ChartBuilder = ChartBuilder> {
1
+ import type { ChartBuilder, ChartTypeString, IChartCreateConfig, IChartInfo } from '@univerjs-pro/engine-chart';
2
+ import type { IChartBuilderTypeMap } from '../chart-builder-type-map';
3
+ export interface IChartBuilderFacadeContext<TBuilder extends ChartBuilder = ChartBuilder, TSource = never[], TDataSource = TSource, TInfo extends IChartInfo<TDataSource> = IChartInfo<TDataSource>> {
5
4
  readonly builder: TBuilder;
6
- wrap<TFacade>(Constructor: ChartFacadeBuilderConstructor<TFacade>): TFacade;
5
+ readonly info: Partial<TInfo>;
6
+ readonly normalizeSource: (source: TSource) => TDataSource;
7
+ readonly createConfig: (builder: TBuilder) => IChartCreateConfig;
8
+ readonly requireSource: boolean;
7
9
  }
8
- export declare const ChartBuilderFacadeContextAccess: unique symbol;
9
- export interface IChartBuilderFacadeContextAccess {
10
- readonly [ChartBuilderFacadeContextAccess]: IChartBuilderFacadeContext;
11
- }
12
- export declare function wrapChartBuilder<TFacade>(builder: ChartBuilder, Constructor: ChartFacadeBuilderConstructor<TFacade>): TFacade;
10
+ export type ChartFacadeBuilderConstructor<TFacade, TSource, TDataSource, TInfo extends IChartInfo<TDataSource>> = new (context: IChartBuilderFacadeContext<ChartBuilder, TSource, TDataSource, TInfo>) => TFacade;
11
+ export declare function wrapChartBuilder<TFacade, TSource = never[], TDataSource = TSource, TInfo extends IChartInfo<TDataSource> = IChartInfo<TDataSource>>(builder: ChartBuilder, Constructor: ChartFacadeBuilderConstructor<TFacade, TSource, TDataSource, TInfo>, context?: Omit<IChartBuilderFacadeContext<ChartBuilder, TSource, TDataSource, TInfo>, 'builder'>): TFacade;
12
+ /** Wraps a core Builder with the concrete Facade selected by its fixed type. */
13
+ export declare function wrapTypedChartBuilder<T extends ChartTypeString, TSource = never[], TDataSource = TSource, TInfo extends IChartInfo<TDataSource> = IChartInfo<TDataSource>>(builder: ChartBuilder, type: T, context?: Omit<IChartBuilderFacadeContext<ChartBuilder, TSource, TDataSource, TInfo>, 'builder'>): IChartBuilderTypeMap<TSource, TDataSource, TInfo>[T];
@@ -3,8 +3,9 @@ export type { IChartBuilderAdapter, } from './chart-builder/chart-builder-adapte
3
3
  export type { ChartColor, ChartLinearGradientInput, IChartGradientPoint, IChartGradientStop, IChartLinearGradient, } from './chart-builder/chart-color';
4
4
  export { CHART_LINEAR_GRADIENT_TYPE, chartLinearGradient, } from './chart-builder/chart-color';
5
5
  export type { ChartDescription, } from './chart-builder/chart-description';
6
+ export type { IChartLiveAdapter } from './chart-builder/chart-live-adapter';
6
7
  export { createChartStarterRows } from './chart-builder/chart-starter-data';
7
- export type { ChartLegendSpec, ChartSeriesSelector, ChartSubtitleSpec, ChartTitleSpec, IChartAggregationSpec, IChartAppearanceSpec, IChartAreaSpec, IChartAxesSpec, IChartAxisBindingDescription, IChartAxisLabelSpec, IChartAxisPointerSpec, IChartAxisSpec, IChartBarSpec, IChartBubbleMappingSpec, IChartBubbleSpec, IChartDescription, IChartFontSpec, IChartFunnelSpec, IChartGaugeTicksPatch, IChartHeatmapLabelSpec, IChartHeatmapSpec, IChartLegendOptions, IChartLineSeriesPatch, IChartMappingSpec, IChartMarkLineLabelSpec, IChartMarkLineSpec, IChartParetoBarLabelStyleSpec, IChartParetoBarStyleSpec, IChartParetoBorderStyleSpec, IChartParetoLineLabelStyleSpec, IChartParetoLineStyleSpec, IChartParetoPointStyleSpec, IChartParetoSpec, IChartPieAggregateSpec, IChartPieCompositeSpec, IChartPieConnectorSpec, IChartPieLabelSpec, IChartPieSecondaryPlotSpec, IChartPieSpec, IChartPlotAreaSpec, IChartRadarSpec, IChartRelationForceSpec, IChartRelationSpec, IChartScatterMappingSpec, IChartSeriesBorderSpec, IChartSeriesDataPointStyleSpec, IChartSeriesDescription, IChartSeriesLabelSpec, IChartSeriesPatch, IChartSeriesPointSpec, IChartSeriesStyleSpec, IChartSliceStyleSpec, IChartSolidSeriesPatch, IChartSolidSeriesStyleSpec, IChartSubtitleOptions, IChartSymbolDataPointStyleSpec, IChartTitleOptions, IChartTrendlineSpec, IChartWaterfallConnectorStyleSpec, IChartWaterfallPointRoleSpec, IChartWaterfallSpec, IChartWordCloudDescription, IChartWordCloudSpec, PieSecondarySplitSpec, } from './chart-builder/chart-types';
8
+ export type { ChartLegendSpec, ChartSeriesSelector, ChartSubtitleSpec, ChartTitleSpec, IChartAggregationSpec, IChartAppearanceSpec, IChartAreaSpec, IChartAxesSpec, IChartAxisBindingDescription, IChartAxisLabelSpec, IChartAxisPointerSpec, IChartAxisSpec, IChartBarSpec, IChartBubbleMappingSpec, IChartBubbleSpec, IChartDescription, IChartFontSpec, IChartFunnelSpec, IChartGaugeTicksPatch, IChartHeatmapLabelSpec, IChartHeatmapSpec, IChartInfo, IChartLegendOptions, IChartLineSeriesPatch, IChartMappingSpec, IChartMarkLineLabelSpec, IChartMarkLineSpec, IChartParetoBarLabelStyleSpec, IChartParetoBarStyleSpec, IChartParetoBorderStyleSpec, IChartParetoLineLabelStyleSpec, IChartParetoLineStyleSpec, IChartParetoPointStyleSpec, IChartParetoSpec, IChartPieAggregateSpec, IChartPieCompositeSpec, IChartPieConnectorSpec, IChartPieLabelSpec, IChartPieSecondaryPlotSpec, IChartPieSpec, IChartPlotAreaSpec, IChartPosition, IChartRadarSpec, IChartRelationForceSpec, IChartRelationSpec, IChartScatterMappingSpec, IChartSeriesBorderSpec, IChartSeriesDataPointStyleSpec, IChartSeriesDescription, IChartSeriesLabelSpec, IChartSeriesPatch, IChartSeriesPointSpec, IChartSeriesStyleSpec, IChartSize, IChartSliceStyleSpec, IChartSolidSeriesPatch, IChartSolidSeriesStyleSpec, IChartSubtitleOptions, IChartSymbolDataPointStyleSpec, IChartTitleOptions, IChartTrendlineSpec, IChartWaterfallConnectorStyleSpec, IChartWaterfallPointRoleSpec, IChartWaterfallSpec, IChartWordCloudDescription, IChartWordCloudSpec, PieSecondarySplitSpec, } from './chart-builder/chart-types';
8
9
  export { AREA_CHART_TYPES, AXIS_CHART_TYPES, CARTESIAN_CHART_TYPES, ChartAxisTickPosition, ChartSeriesTypeString, ChartTypeString, ChartVisualMapType, ChartWaterfallStyleTarget, ChartWordCloudShapeSource, DEFAULT_CHART_TYPE, PieCompositeMarkRole, PieSecondaryPlotType, PieSecondarySplitType, } from './chart-builder/chart-types';
9
10
  export type { ChartPendingConfig, IChartCreateConfig, } from './chart-builder/chart-types';
10
11
  export { ChartAggregationTarget, } from './chart-builder/configuration/aggregation';
@@ -21,7 +22,7 @@ export { clearBar, setBar, } from './chart-builder/configuration/bar';
21
22
  export { clearDojiStyle, clearFallingStyle, clearRisingStyle, resetCandleWidth, setCandleWidth, setDojiStyle, setFallingStyle, setRisingStyle, } from './chart-builder/configuration/candlestick';
22
23
  export type { ChartPublicSeriesSelector, } from './chart-builder/configuration/cartesian-series';
23
24
  export { ChartAllSeriesStyleTarget, ChartSeriesClearTarget, } from './chart-builder/configuration/cartesian-series';
24
- export { clearAllSeriesStyle, clearSeries, setAllSeriesStyle, setSeries, } from './chart-builder/configuration/cartesian-series';
25
+ export { clearAllSeriesOverrides, clearAllSeriesStyle, clearSeries, setAllSeriesStyle, setSeries, } from './chart-builder/configuration/cartesian-series';
25
26
  export type { IChartConfigOperation, } from './chart-builder/configuration/chart-config-operation';
26
27
  export { resetChordEmphasis, resetChordLabel, resetChordLayout, resetChordNode, resetChordRibbon, setChordEmphasis, setChordLabel, setChordLayout, setChordMapping, setChordNode, setChordRibbon, } from './chart-builder/configuration/chord';
27
28
  export { ChartSeriesAxis, } from './chart-builder/configuration/combination';
@@ -51,33 +52,41 @@ export { clearTrendlines, removeTrendline, setTrendline, } from './chart-builder
51
52
  export type { ChartTrendlineSelector, ChartTrendlineValue, } from './chart-builder/configuration/trendline';
52
53
  export { clearWaterfallConnector, clearWaterfallStyle, resetUseSubtotal, resetWaterfallStackType, setUseSubtotal, setWaterfallConnector, setWaterfallPointRoles, setWaterfallStackType, setWaterfallStyle, } from './chart-builder/configuration/waterfall';
53
54
  export { clearMaskImage, resetWordCloudRepeat, resetWordCloudShape, setMaskImage, setWordCloudRepeat, setWordCloudShape, } from './chart-builder/configuration/word-cloud';
54
- export { toChartModelConfig, toCompleteChartModelConfig, } from './chart-builder/conversion/chart-config-converter';
55
+ export type { IResolvedChartModelConfigUpdate, } from './chart-builder/conversion/chart-config-converter';
56
+ export { resolveChartModelConfigUpdate, toChartModelConfig, toChartModelConfigReplacement, } from './chart-builder/conversion/chart-config-converter';
55
57
  export { canonicalizeChartContext, } from './chart-builder/conversion/chart-context-patch';
58
+ export { toChartCreateConfig, toChartCreateConfigSnapshot } from './chart-builder/conversion/chart-create-config';
56
59
  export { chartBitsToType, chartTypeToBits, getChartStackType, withChartStackType, } from './chart-builder/conversion/chart-type-converter';
57
60
  export { describeChartModel, projectChartModelDescription, resolveChartDescriptionMetadata, } from './chart-builder/conversion/describe-chart-model';
58
61
  export { resolveChartModelData, } from './chart-builder/conversion/resolve-chart-model-data';
59
- export { DetachedChartBuilderAdapter, DetachedInlineChartBuilderAdapter, } from './chart-builder/detached-chart-builder-adapter';
60
- export type { IInlineChartBuilderAdapter, IInlineChartHostPatch, } from './chart-builder/internal/host-builder-runtime';
61
- export { InlineChartBuilder, resolveInlineChartDataSet, } from './chart-builder/internal/host-builder-runtime';
62
+ export { DetachedChartBuilderAdapter, } from './chart-builder/detached-chart-builder-adapter';
63
+ export type { IChartHostConfigAdapter, IChartHostPatch, } from './chart-builder/internal/chart-host-config-adapter';
64
+ export { resolveChartDataSetFromValues, } from './chart-builder/internal/chart-host-config-adapter';
62
65
  export type { IChartDataAggregation, IChartTopNSpec } from './chart-data-aggregation';
63
66
  export type { IUniverChartConfig } from './config/config';
64
67
  export { AreaLineStyle, AxisAlignEnum, AxisValueType, BarShape, CategoryType, ChartAttributeBits, ChartAxisDimension, ChartBorderDashType, ChartCandlestickState, ChartChordFocusMode, ChartChordLabelPosition, ChartChordRibbonColorMode, ChartGaugeMode, ChartGaugePointerShape, ChartHistogramBinKind, ChartMarkLineLabelPosition, ChartSemanticAxis, ChartSourceDataTypeEnum, ChartSunburstLabelPosition, ChartTrendlineType, ChartTypeBits, ChartWaterfallPointRole, DataOrientation, HistogramBinningMode, InvalidValueType, IRuntimeAxisPosition, IRuntimeAxisPriority, LabelAlignEnum, LabelContentType, LegendPositionEnum, LinePointShape, ParetoSeriesIndex, ParetoSeriesPart, PieLabelPosition, RadarShape, RelationChartLayoutEnum, SelectModeEnum, SeriesLabelPosition, StackType, TextAlign, TextVerticalAlign, TitlePositionEnum, TreemapParentLabelLayout, WaterfallSeriesTypeEnum, WaterfallStackTypeEnum, WordCloudShapeEnum, } from './enum';
65
- export { generateChartContext } from './models/chart-context/resolve-chart-context';
68
+ export { generateChartContext, reconcileChartContext } from './models/chart-context/resolve-chart-context';
66
69
  export { MAX_HISTOGRAM_BIN_COUNT } from './models/chart-data/internal/histogram-bins';
67
70
  export { PIE_CONNECTOR_COLOR_DEFAULT, PIE_CONNECTOR_DASH_TYPE_DEFAULT, PIE_CONNECTOR_OPACITY_DEFAULT, PIE_CONNECTOR_VISIBLE_DEFAULT, PIE_CONNECTOR_WIDTH_DEFAULT, PIE_PERCENTAGE_SPLIT_LESS_THAN_DEFAULT, PIE_POSITION_SPLIT_COUNT_DEFAULT, PIE_POSITION_SPLIT_COUNT_MIN, PIE_SECONDARY_GAP_WIDTH_DEFAULT, PIE_SECONDARY_GAP_WIDTH_MAX, PIE_SECONDARY_GAP_WIDTH_MIN, PIE_SECONDARY_SIZE_DEFAULT, PIE_SECONDARY_SIZE_MAX, PIE_SECONDARY_SIZE_MIN, PIE_VALUE_SPLIT_LESS_THAN_DEFAULT, } from './models/chart-data/pie-composite/pie-composite-spec';
68
71
  export { CHART_HOST_DEFAULT_BORDER_COLOR, CHART_HOST_DEFAULT_BORDER_RADIUS, CHART_HOST_DEFAULT_BORDER_WIDTH, composeChartHostFrameImage, getChartHostFrameContentRect, resolveChartHostFrameBorder, resolveChartHostFrameStyle, resolveDefaultChartHostFrameStyle, shouldComposeChartHostFrame, } from './models/chart-host/chart-host-style';
69
72
  export type { IResolveChartHostFrameStyleInput, IResolveDefaultChartHostFrameStyleInput, } from './models/chart-host/chart-host-style';
73
+ export { chartConfigInterpreter } from './models/chart-host/config/chart-config-interpreter';
74
+ export type { IChartConfigUpdate } from './models/chart-host/config/chart-config-interpreter';
70
75
  export { chartImageSourceToDataUrl, DataUrlImageChartHost, ImageChartHost, } from './models/chart-host/image-chart-host';
71
76
  export { OffscreenChartHost } from './models/chart-host/offscreen-chart-host';
77
+ export { ChartDataSourceResolver, ChartDataSourceRuntimeStatus, IChartDataSourceResolver, } from './models/chart-host/resource/chart-data-source-resolver';
78
+ export type { IChartDataSourceHandle, IChartDataSourceProvider, IChartDataSourceResolveResult, IChartDataSourceRuntimeState, } from './models/chart-host/resource/chart-data-source-resolver';
79
+ export { CHART_RESOURCE_VERSION, ChartResourceRepository, isInlineChartDataSource, isReferencedChartDataSource, } from './models/chart-host/resource/chart-resource-repository';
80
+ export type { IChartDataSourceInput, IChartResource, IChartResourceContext, IChartResourceDataSource, IChartResourceSnapshot, IChartResourceState, ICreateChartDataSourceOptions, ICreateChartSnapshotOptions, IInlineChartDataSource, IReferencedChartDataSource, IUpdateChartSnapshotPatch, } from './models/chart-host/resource/chart-resource-repository';
72
81
  export { serializeChartResource } from './models/chart-host/resource/chart-resource-serializer';
73
- export { buildInlineChartTableDataSet, parseInlineChartTable, } from './models/chart-host/resource/inline-chart-table';
74
- export type { InlineChartCellValue } from './models/chart-host/resource/inline-chart-table';
75
- export { STATIC_CHART_RESOURCE_VERSION, StaticChartResourceRepository, } from './models/chart-host/resource/static-chart-resource-repository';
76
- export type { ICreateStaticChartDataSourceOptions, ICreateStaticChartSnapshotOptions, IStaticChartContext, IStaticChartInlineDataSource, IStaticChartResource, IStaticChartSnapshot, IStaticChartState, IUpdateStaticChartSnapshotPatch, } from './models/chart-host/resource/static-chart-resource-repository';
77
- export { StaticChartModelStore } from './models/chart-host/static/static-chart-model-store';
78
- export type { IStaticChartModelRuntime } from './models/chart-host/static/static-chart-model-store';
79
- export { createStaticChartRuntime, refreshStaticChartRuntime, } from './models/chart-host/static/static-chart-runtime';
80
- export type { ICreateStaticChartRuntimeOptions, IStaticChartRuntime, IStaticChartRuntimeConfig, } from './models/chart-host/static/static-chart-runtime';
82
+ export { buildChartDataSetFromValues, parseInlineChartTable, } from './models/chart-host/resource/inline-chart-table';
83
+ export type { ChartDataSourceValue } from './models/chart-host/resource/inline-chart-table';
84
+ export { RESOURCE_REF_CHART_DATA_SOURCE_KIND, ResourceRefChartDataSourceAdapter, } from './models/chart-host/resource/resource-ref-chart-data-source.adapter';
85
+ export type { IResourceRefChartDataSourceInput, IResourceRefChartDataSourceReference, } from './models/chart-host/resource/resource-ref-chart-data-source.adapter';
86
+ export { ChartModelStore } from './models/chart-host/static/chart-model-store';
87
+ export type { IChartModelRuntime } from './models/chart-host/static/chart-model-store';
88
+ export { createChartRuntime, refreshChartRuntime, } from './models/chart-host/static/chart-runtime';
89
+ export type { IChartRuntime, IChartRuntimeConfig, ICreateChartRuntimeOptions, } from './models/chart-host/static/chart-runtime';
81
90
  export type { IChartModelInit } from './models/chart-model/chart-model';
82
91
  export { ChartModel } from './models/chart-model/chart-model';
83
92
  export { echartToChartModelInit, isChartModelInit } from './models/chart-model/echart-to-chart-model-init';
@@ -118,9 +127,11 @@ export { toChartDataItem } from './source/chart-data-item';
118
127
  export { ChartDataSource } from './source/chart-source';
119
128
  export { StaticChartSource } from './source/static-chart-source';
120
129
  export type { IChartCandlestickMappingSpec, IChartCandlestickSpec, IChartCandlestickStateStyleSpec, IChartChordEmphasisSpec, IChartChordLabelSpec, IChartChordLayoutSpec, IChartChordMappingSpec, IChartChordNodeStyleSpec, IChartChordRibbonStyleSpec, IChartChordSpec, IChartGaugeAnchorSpec, IChartGaugeAnglesSpec, IChartGaugeAxisLabelSpec, IChartGaugeAxisLineSpec, IChartGaugeAxisTickSpec, IChartGaugeDetailSpec, IChartGaugeFontSpec, IChartGaugePointerSpec, IChartGaugeProgressSpec, IChartGaugeRangeSpec, IChartGaugeScaleSpec, IChartGaugeSpec, IChartGaugeSplitLineSpec, IChartGaugeTitleSpec, IChartHistogramBinningSpec, IChartHistogramDataSpec, IChartHistogramSpec, IChartHistogramStyleSpec, IChartSunburstCenterLabelSpec, IChartSunburstLabelSpec, IChartSunburstSpec, IChartTreemapLabelSpec, IChartTreemapSpec, IChartValueLabelSpec, } from './types';
121
- export { ChartHostRenderMode, ChartImageSourceType } from './types';
122
- export type { ChartDataSourceValues, ChartDirection, ChartElementEventHandler, ChartElementEventType, ChartElementKind, ChartImageSource, ChartRenderRuntimeContext, ChartRuntimeStyle, ChartStyle, DeepNullish, DeepPartial, DimensionDefinitionLoose, IAllSeriesStyle, IAxisOptions, IBarStyle, IChartBubbleStyle, IChartCandlestickData, IChartCandlestickPoint, IChartChordData, IChartChordLink, IChartChordNode, IChartConfig, IChartContext, IChartData, IChartDataCategory, IChartDataSeries, IChartDataSource, IChartElementBounds, IChartElementEvent, IChartElementHit, IChartElementOverlay, IChartGaugeData, IChartGaugeItem, IChartHistogramBin, IChartHistogramData, IChartHost, IChartHostBorderStyle, IChartHostLease, IChartHostRect, IChartHostStyle, IChartInstance, IChartPlotArea, IChartRenderAsImageOptions, IChartRenderInput, IChartRenderInstance, IChartRenderInstanceCreateContext, IChartRenderInstanceSpecInput, IChartRenderInstanceStyleInput, IChartRenderModel, IChartRenderModelImageExportInput, IChartRenderModelImageExportOptions, IChartRenderModelImageExportResult, IChartSnapshot, IChartStyle, IChartSunburstData, IChartSunburstNode, IChartTreemapData, IChartTreemapNode, IDimensionDefinition, IDomChartHost, IGridLineStyle, IImageChartHost, ILabelStyle, ILegendStyle, IPieLabelStyle, IPointStyle, IRelationForceOptions, IRuntimeAxis, ISeriesLabelStyle, ISeriesStyle, ITrendLine, IUniverDataSet, OptionDataValue, RightYAxisOptions, } from './types';
130
+ export { ChartHostRenderMode, ChartImageExportFormat, ChartImageSourceType } from './types';
131
+ export type { ChartDataSourceValues, ChartDirection, ChartElementEventHandler, ChartElementEventType, ChartElementKind, ChartImageSource, ChartRenderRuntimeContext, ChartRuntimeStyle, ChartStyle, DeepNullish, DeepPartial, DimensionDefinitionLoose, IAllSeriesStyle, IAxisOptions, IBarStyle, IChartBubbleStyle, IChartCandlestickData, IChartCandlestickPoint, IChartChordData, IChartChordLink, IChartChordNode, IChartConfig, IChartContext, IChartData, IChartDataCategory, IChartDataCategoryLevel, IChartDataCategorySegment, IChartDataSeries, IChartDataSource, IChartElementBounds, IChartElementEvent, IChartElementHit, IChartElementOverlay, IChartGaugeData, IChartGaugeItem, IChartHistogramBin, IChartHistogramData, IChartHost, IChartHostBorderStyle, IChartHostLease, IChartHostRect, IChartHostStyle, IChartInstance, IChartPlotArea, IChartRenderAsImageOptions, IChartRenderInput, IChartRenderInstance, IChartRenderInstanceCreateContext, IChartRenderInstanceSpecInput, IChartRenderInstanceStyleInput, IChartRenderModel, IChartRenderModelImageExportInput, IChartRenderModelImageExportOptions, IChartRenderModelImageExportResult, IChartSnapshot, IChartStyle, IChartSunburstData, IChartSunburstNode, IChartTreemapData, IChartTreemapNode, IDimensionDefinition, IDomChartHost, IGridLineStyle, IImageChartHost, ILabelStyle, ILegendStyle, IPieLabelStyle, IPointStyle, IRelationForceOptions, IRuntimeAxis, ISeriesLabelStyle, ISeriesStyle, ITrendLine, IUniverDataSet, IUniverDataSetCategorySpan, OptionDataValue, RightYAxisOptions, } from './types';
123
132
  export { chartBitsUtils, chartTypeCanUseTrendLine, mergeChartConfig, } from './util';
133
+ export { omitUndefinedFields, } from './utils/compact';
134
+ export { DEFAULT_CHART_DEVICE_PIXEL_RATIO } from './utils/device-pixel-ratio';
124
135
  export { echarts } from './utils/echarts';
125
136
  export { WordCloudMaskImageOptions, WordCloudResourceConfig } from './word-cloud-resource/word-cloud-resource-config';
126
137
  export { WORD_CLOUD_DEFAULT_OPTION, WORD_CLOUD_SERIES_TYPE } from './wordcloud-chart/adapters/echarts/echarts-options';
@@ -12,7 +12,7 @@ export declare function countChartFieldTypes(field: Array<OptionDataValue | unde
12
12
  strings: number;
13
13
  total: number;
14
14
  };
15
- export declare function classifyChartFields(dataSet: Pick<IUniverDataSet, 'source' | 'sourceType'>): IChartFieldSelection;
15
+ export declare function classifyChartFields(dataSet: Pick<IUniverDataSet, 'source' | 'sourceType' | 'categorySpans'>): IChartFieldSelection;
16
16
  export declare function resolveChartFieldSelectionContext(dataSet: IUniverDataSet, context: IChartContext, initializeSelection?: boolean): IChartContext;
17
17
  /** The single compatibility boundary for the historical scalar snapshot field. */
18
18
  export declare function normalizeChartSnapshotContext(context: IChartSnapshotContext): IChartContext;
@@ -1,2 +1,5 @@
1
+ import type { ChartTypeBits } from '../../enum';
1
2
  import type { IChartContext, IUniverDataSet } from '../../types';
2
3
  export declare function generateChartContext(dataSet: IUniverDataSet, context?: IChartContext, initializeSelection?: boolean): IChartContext;
4
+ /** Preserves a usable field selection and re-infers it when the latest data shape invalidates it. */
5
+ export declare function reconcileChartContext(dataSet: IUniverDataSet, context: IChartContext, chartType: ChartTypeBits): IChartContext;
@@ -1,7 +1,7 @@
1
+ import type { ChartTypeBits } from '../../enum';
1
2
  import type { IUniverDataSet } from '../../types';
2
3
  import type { IChartFieldDiagnostic } from '../common/chart-field-diagnostic';
3
4
  import type { IChartFieldConsumption } from './chart-field-consumption';
4
- import type { ChartTypeBits } from '../../enum';
5
5
  export type ChartFieldValidationResult = {
6
6
  valid: true;
7
7
  } | {
@@ -1,10 +1,9 @@
1
1
  import type { IChartDataAggregation } from '../../../chart-data-aggregation';
2
2
  import type { IUniverDataSet } from '../../../types';
3
- import type { IChartFieldConsumption } from '../chart-field-consumption';
4
3
  /**
5
4
  * Projects category/value rows while preserving source-field indexes.
6
5
  *
7
6
  * This runs after field-consumption validation, so callers continue to own chart-specific
8
7
  * mapping rules and this module owns only ordinary category/value aggregation and ranking.
9
8
  */
10
- export declare function projectCategorySeriesData(dataSet: IUniverDataSet, fieldConsumption: IChartFieldConsumption, dataAggregation: IChartDataAggregation | undefined): IUniverDataSet;
9
+ export declare function projectCategorySeriesData(dataSet: IUniverDataSet, categoryIndexes: readonly number[], seriesIndexes: readonly number[], dataAggregation: IChartDataAggregation | undefined): IUniverDataSet;
@@ -0,0 +1,7 @@
1
+ import type { IUniverDataSet, IUniverDataSetCategorySpan } from '../../../types';
2
+ export interface IDataSetCategorySpanLookup {
3
+ get(fieldIndex: number, itemIndex: number): IUniverDataSetCategorySpan | undefined;
4
+ }
5
+ export declare function createDataSetCategorySpanLookup(dataSet: IUniverDataSet, fieldIndexes: readonly number[], itemCount: number): IDataSetCategorySpanLookup;
6
+ export declare function getDataSetCategorySpan(dataSet: IUniverDataSet, fieldIndex: number, itemIndex: number): IUniverDataSetCategorySpan | undefined;
7
+ export declare function getEffectiveCategoryLabel(dataSet: IUniverDataSet, fieldIndex: number, itemIndex: number, categorySpanLookup?: IDataSetCategorySpanLookup): string;
@@ -0,0 +1,10 @@
1
+ import type { IChartDataCategory, IUniverDataSet } from '../../../types';
2
+ import type { IChartLocaleTexts } from '../../common/chart-locale-texts';
3
+ interface INormalizeMultiLevelCategoryAxisInput {
4
+ dataSet: IUniverDataSet;
5
+ categoryIndexes: number[];
6
+ headers?: string[];
7
+ localeTexts: IChartLocaleTexts;
8
+ }
9
+ export declare function normalizeMultiLevelCategoryAxis(input: INormalizeMultiLevelCategoryAxisInput): IChartDataCategory | undefined;
10
+ export {};
@@ -0,0 +1,13 @@
1
+ import type { IChartDataAggregation } from '../../../chart-data-aggregation';
2
+ import type { ChartStyle, IChartContext } from '../../../types';
3
+ import type { IChartResourceSnapshot } from '../resource/chart-resource-repository';
4
+ export interface IChartConfigUpdate {
5
+ chartType?: IChartResourceSnapshot['chartType'];
6
+ style?: ChartStyle;
7
+ context?: IChartContext;
8
+ dataAggregation?: Partial<IChartDataAggregation>;
9
+ patch?: Partial<Omit<IChartResourceSnapshot, 'id'>>;
10
+ }
11
+ export declare const chartConfigInterpreter: {
12
+ apply(previous: IChartResourceSnapshot, update: IChartConfigUpdate, replaceConfig: boolean): IChartResourceSnapshot | null;
13
+ };
@@ -0,0 +1,58 @@
1
+ import type { IDisposable } from '@univerjs/core';
2
+ import type { Observable } from 'rxjs';
3
+ import type { ChartDataSourceValue } from './inline-chart-table';
4
+ import type { IResourceRefChartDataSourceReference } from './resource-ref-chart-data-source.adapter';
5
+ import { Disposable } from '@univerjs/core';
6
+ export declare enum ChartDataSourceRuntimeStatus {
7
+ LOADING = "loading",
8
+ READY = "ready",
9
+ UNAVAILABLE = "unavailable",
10
+ REFRESH_ERROR = "refresh-error"
11
+ }
12
+ export interface IChartDataSourceResolveResult {
13
+ values: ReadonlyArray<ReadonlyArray<ChartDataSourceValue>>;
14
+ }
15
+ export interface IChartDataSourceProvider {
16
+ readonly kind: IResourceRefChartDataSourceReference['kind'];
17
+ getCacheKey(source: Readonly<IResourceRefChartDataSourceReference>): string;
18
+ resolve(source: Readonly<IResourceRefChartDataSourceReference>, options: {
19
+ signal: AbortSignal;
20
+ }): Promise<IChartDataSourceResolveResult>;
21
+ }
22
+ export interface IChartDataSourceRuntimeState {
23
+ status: ChartDataSourceRuntimeStatus;
24
+ values?: ReadonlyArray<ReadonlyArray<ChartDataSourceValue>>;
25
+ error?: unknown;
26
+ }
27
+ export interface IChartDataSourceHandle extends IDisposable {
28
+ readonly state$: Observable<IChartDataSourceRuntimeState>;
29
+ refresh(): Promise<void>;
30
+ }
31
+ export interface IChartDataSourceResolver {
32
+ registerProvider(provider: IChartDataSourceProvider): IDisposable;
33
+ acquire(source: Readonly<IResourceRefChartDataSourceReference>): IChartDataSourceHandle;
34
+ }
35
+ export declare const IChartDataSourceResolver: import("@wendellhu/redi").IdentifierDecorator<IChartDataSourceResolver>;
36
+ export declare class ChartDataSourceResolver extends Disposable implements IChartDataSourceResolver {
37
+ private readonly _providers;
38
+ private readonly _entries;
39
+ private readonly _handles;
40
+ private _isDisposed;
41
+ registerProvider(provider: IChartDataSourceProvider): IDisposable;
42
+ acquire(source: Readonly<IResourceRefChartDataSourceReference>): IChartDataSourceHandle;
43
+ dispose(): void;
44
+ private _getOrCreateEntry;
45
+ private _attachHandle;
46
+ private _detachHandle;
47
+ private _releaseHandle;
48
+ private _refreshHandle;
49
+ private _startResolve;
50
+ private _resolveEntry;
51
+ private _isCurrentGeneration;
52
+ private _clearPending;
53
+ private _publishEntry;
54
+ private _invalidateProviderEntry;
55
+ private _cancelEntry;
56
+ private _snapshotState;
57
+ private _unavailableState;
58
+ }
@@ -0,0 +1,111 @@
1
+ import type { Observable } from 'rxjs';
2
+ import type { IChartDataAggregation } from '../../../chart-data-aggregation';
3
+ import type { ChartTypeBits } from '../../../enum';
4
+ import type { ChartStyle, IChartContext } from '../../../types';
5
+ import type { ChartDataSourceValue } from './inline-chart-table';
6
+ import type { IResourceRefChartDataSourceReference } from './resource-ref-chart-data-source.adapter';
7
+ import { Disposable } from '@univerjs/core';
8
+ export declare const CHART_RESOURCE_VERSION = 2;
9
+ export interface IInlineChartDataSource<TCell extends ChartDataSourceValue = ChartDataSourceValue> {
10
+ id: string;
11
+ name?: string;
12
+ values: TCell[][];
13
+ }
14
+ export interface IReferencedChartDataSource {
15
+ id: string;
16
+ name?: string;
17
+ source: IResourceRefChartDataSourceReference;
18
+ }
19
+ export type IChartResourceDataSource = IInlineChartDataSource | IReferencedChartDataSource;
20
+ export type IChartDataSourceInput = {
21
+ values: ChartDataSourceValue[][];
22
+ source?: never;
23
+ } | {
24
+ source: IResourceRefChartDataSourceReference;
25
+ values?: never;
26
+ };
27
+ interface IChartDataSourceCandidate {
28
+ values?: ChartDataSourceValue[][];
29
+ source?: IResourceRefChartDataSourceReference;
30
+ }
31
+ export declare function isInlineChartDataSource<T extends IChartDataSourceCandidate>(dataSource: T | null | undefined): dataSource is T & {
32
+ values: ChartDataSourceValue[][];
33
+ source?: never;
34
+ };
35
+ export declare function isReferencedChartDataSource<T extends IChartDataSourceCandidate>(dataSource: T | null | undefined): dataSource is T & {
36
+ source: IResourceRefChartDataSourceReference;
37
+ values?: never;
38
+ };
39
+ export interface IChartResourceContext {
40
+ orient?: 'row' | 'column';
41
+ chartContext?: Partial<IChartContext>;
42
+ }
43
+ export interface IChartResourceState {
44
+ legendSelected?: Record<string, boolean>;
45
+ activePage?: number;
46
+ relationNodePositions?: Record<string, {
47
+ x: number;
48
+ y: number;
49
+ }>;
50
+ }
51
+ export interface IChartResourceSnapshot<TContext = IChartResourceContext, TState = IChartResourceState> {
52
+ id: string;
53
+ dataSourceId: string;
54
+ chartType: ChartTypeBits;
55
+ style?: ChartStyle;
56
+ context?: TContext;
57
+ state?: TState;
58
+ dataAggregation?: IChartDataAggregation;
59
+ }
60
+ export interface IChartResource<TDataSource extends IChartResourceDataSource = IChartResourceDataSource, TChart extends IChartResourceSnapshot<unknown, unknown> = IChartResourceSnapshot> {
61
+ version: typeof CHART_RESOURCE_VERSION;
62
+ dataSources: Record<string, TDataSource>;
63
+ charts: Record<string, TChart>;
64
+ }
65
+ export type ICreateChartDataSourceOptions<TDataSource extends IChartResourceDataSource = IChartResourceDataSource> = TDataSource extends IChartResourceDataSource ? Omit<TDataSource, 'id'> & {
66
+ id?: string;
67
+ } : never;
68
+ export type ICreateChartSnapshotOptions<TChart extends IChartResourceSnapshot<unknown, unknown>> = Omit<TChart, 'id'> & {
69
+ id?: string;
70
+ };
71
+ export type IUpdateChartSnapshotPatch<TChart extends IChartResourceSnapshot<unknown, unknown>> = Partial<Omit<TChart, 'id'>>;
72
+ interface IChartDataSourceRemovedEvent {
73
+ unitId: string;
74
+ dataSourceId: string;
75
+ }
76
+ export declare class ChartResourceRepository<TDataSource extends IChartResourceDataSource = IChartResourceDataSource, TChart extends IChartResourceSnapshot<unknown, unknown> = IChartResourceSnapshot, TResource extends IChartResource<TDataSource, TChart> = IChartResource<TDataSource, TChart>> extends Disposable {
77
+ private readonly _resources;
78
+ private readonly _dataSourceRemoved$;
79
+ readonly dataSourceRemoved$: Observable<IChartDataSourceRemovedEvent>;
80
+ ensureUnitResource(unitId: string): TResource;
81
+ loadUnit(unitId: string, resource: unknown): TResource;
82
+ unloadUnit(unitId: string): void;
83
+ serializeUnit(unitId: string): string;
84
+ getResource(unitId: string): TResource;
85
+ getDataSource(unitId: string, dataSourceId: string): TDataSource | undefined;
86
+ getChart(unitId: string, chartId: string): TChart | undefined;
87
+ createDataSource(unitId: string, options: ICreateChartDataSourceOptions<TDataSource>): TDataSource;
88
+ setDataSource(unitId: string, dataSource: TDataSource): TDataSource;
89
+ updateDataSource(unitId: string, dataSourceId: string, values: ChartDataSourceValue[][], patch?: Partial<Pick<TDataSource, 'name'>>): TDataSource | undefined;
90
+ removeDataSource(unitId: string, dataSourceId: string): boolean;
91
+ createChart(unitId: string, options: ICreateChartSnapshotOptions<TChart>): TChart;
92
+ setChart(unitId: string, chart: TChart): TChart;
93
+ updateChart(unitId: string, chartId: string, patch: IUpdateChartSnapshotPatch<TChart>): TChart | undefined;
94
+ removeChart(unitId: string, chartId: string, options?: {
95
+ cleanupDataSource?: boolean;
96
+ }): TChart | undefined;
97
+ getChartIdsByDataSource(unitId: string, dataSourceId: string): string[];
98
+ getDataSourceSharingCount(unitId: string, dataSourceId: string): number;
99
+ isDataSourceShared(unitId: string, dataSourceId: string): boolean;
100
+ duplicateDataSourceForChart(unitId: string, chartId: string, duplicateDataSourceId?: string): TDataSource | undefined;
101
+ cleanupOrphanedResources(unitId: string): void;
102
+ dispose(): void;
103
+ private _decodeResource;
104
+ private _decodeDataSource;
105
+ private _cloneDataSource;
106
+ private _isResourceEnvelope;
107
+ private _isValues;
108
+ private _normalizeReference;
109
+ private _invalidDataSource;
110
+ }
111
+ export {};
@@ -1,10 +1,11 @@
1
1
  import type { ChartStyle } from '../../../types';
2
2
  interface IChartResourceSnapshot {
3
3
  style?: ChartStyle;
4
+ context?: unknown;
4
5
  }
5
6
  interface IChartResourceEnvelope<TChart extends IChartResourceSnapshot> {
6
7
  charts: Record<string, TChart>;
7
8
  }
8
- /** Serializes a host chart resource while omitting non-canonical empty chart palettes. */
9
+ /** Serializes a host chart resource with authored-only persisted chart styles. */
9
10
  export declare function serializeChartResource<TChart extends IChartResourceSnapshot, TResource extends IChartResourceEnvelope<TChart>>(resource: TResource): string;
10
11
  export {};
@@ -1,4 +1,5 @@
1
+ import type { CellValue } from '@univerjs/core';
1
2
  import type { IUniverDataSet } from '../../../types';
2
- export type InlineChartCellValue = string | number | boolean | null;
3
- export declare function parseInlineChartTable(text: string): InlineChartCellValue[][];
4
- export declare function buildInlineChartTableDataSet(values: readonly (readonly InlineChartCellValue[])[]): IUniverDataSet;
3
+ export type ChartDataSourceValue = CellValue | null;
4
+ export declare function parseInlineChartTable(text: string): ChartDataSourceValue[][];
5
+ export declare function buildChartDataSetFromValues(values: readonly (readonly ChartDataSourceValue[])[]): IUniverDataSet;
@@ -0,0 +1,3 @@
1
+ import type { ChartStyle } from '../../../types';
2
+ /** Projects authored style at the persistence boundary while accepting historical runtime fields. */
3
+ export declare function projectPersistedChartStyle(style: ChartStyle | undefined): ChartStyle | undefined;
@@ -0,0 +1,22 @@
1
+ import type { IResourceRef } from '@univerjs-pro/embed';
2
+ export declare const RESOURCE_REF_CHART_DATA_SOURCE_KIND = "resource-ref";
3
+ export interface IResourceRefChartDataSourceReference {
4
+ readonly kind: typeof RESOURCE_REF_CHART_DATA_SOURCE_KIND;
5
+ readonly ref: IResourceRef;
6
+ }
7
+ export interface IResourceRefChartDataSourceInput extends Omit<IResourceRef, 'file'> {
8
+ readonly file?: IResourceRef['file'];
9
+ }
10
+ interface ICompatibleResourceRefChartDataSourceReference {
11
+ readonly kind: typeof RESOURCE_REF_CHART_DATA_SOURCE_KIND;
12
+ readonly ref: IResourceRefChartDataSourceInput;
13
+ }
14
+ export declare class ResourceRefChartDataSourceAdapter {
15
+ static toReference(ref: IResourceRefChartDataSourceInput): IResourceRefChartDataSourceReference;
16
+ static isReference(reference: unknown): reference is Readonly<IResourceRefChartDataSourceReference>;
17
+ static assertReference(reference: unknown): asserts reference is Readonly<ICompatibleResourceRefChartDataSourceReference>;
18
+ static fromReference(reference: Readonly<ICompatibleResourceRefChartDataSourceReference>): IResourceRef;
19
+ private static _normalizeInput;
20
+ private static _isCompatibleReference;
21
+ }
22
+ export {};
@@ -0,0 +1,12 @@
1
+ import type { IChartDataSourceProvider, IChartDataSourceResolveResult } from './chart-data-source-resolver';
2
+ import type { IResourceRefChartDataSourceReference } from './resource-ref-chart-data-source.adapter';
3
+ import { Injector } from '@univerjs/core';
4
+ export declare class ResourceRefChartDataSourceProvider implements IChartDataSourceProvider {
5
+ private readonly _injector;
6
+ readonly kind = "resource-ref";
7
+ constructor(_injector: Injector);
8
+ getCacheKey(source: IResourceRefChartDataSourceReference): string;
9
+ resolve(source: IResourceRefChartDataSourceReference, options: {
10
+ signal: AbortSignal;
11
+ }): Promise<IChartDataSourceResolveResult>;
12
+ }
@@ -0,0 +1,56 @@
1
+ import type { Injector } from '@univerjs/core';
2
+ import type { Observable } from 'rxjs';
3
+ import type { IChartContext, IUniverDataSet } from '../../../types';
4
+ import type { ChartModel } from '../../chart-model/chart-model';
5
+ import type { IChartDataSourceResolver, IChartDataSourceRuntimeState } from '../resource/chart-data-source-resolver';
6
+ import type { ChartResourceRepository, IChartResource, IChartResourceContext, IChartResourceDataSource, IChartResourceSnapshot } from '../resource/chart-resource-repository';
7
+ import type { ChartDataSourceValue } from '../resource/inline-chart-table';
8
+ import type { IChartRuntime } from './chart-runtime';
9
+ import { Disposable } from '@univerjs/core';
10
+ export interface IChartModelRuntime extends IChartRuntime {
11
+ unitId: string;
12
+ chartId: string;
13
+ dataSourceId: string;
14
+ }
15
+ export declare class ChartModelStore<TDataSource extends IChartResourceDataSource, TChart extends IChartResourceSnapshot<IChartResourceContext, unknown>, TResource extends IChartResource<TDataSource, TChart>, TRuntime extends IChartModelRuntime = IChartModelRuntime> extends Disposable {
16
+ private readonly _resourceRepository;
17
+ private readonly _injector;
18
+ private readonly _buildDataSet;
19
+ private readonly _dataSourceResolver;
20
+ private readonly _activeRuntimeModel$;
21
+ readonly activeRuntimeModel$: Observable<TRuntime | null>;
22
+ get activeRuntimeModel(): TRuntime | null;
23
+ private readonly _activeChartModel$;
24
+ readonly activeChartModel$: Observable<ChartModel<import("../../..").IChartDataSource> | null>;
25
+ get activeChartModel(): ChartModel | null;
26
+ private readonly _runtimeModels;
27
+ private readonly _dataSourceBindings;
28
+ private readonly _chartModelAdded$;
29
+ readonly chartModelAdded$: Observable<TRuntime>;
30
+ private readonly _chartModelRemoved$;
31
+ readonly chartModelRemoved$: Observable<TRuntime>;
32
+ constructor(_resourceRepository: ChartResourceRepository<TDataSource, TChart, TResource>, _injector: Injector, _buildDataSet: (values: ReadonlyArray<ReadonlyArray<ChartDataSourceValue>>) => IUniverDataSet, _dataSourceResolver: IChartDataSourceResolver);
33
+ ensureChartModel(unitId: string, chartId: string): TRuntime | undefined;
34
+ getChartModel(unitId: string, chartId: string): TRuntime | undefined;
35
+ getDataSourceRuntimeState$(unitId: string, chartId: string): Observable<IChartDataSourceRuntimeState> | undefined;
36
+ getDataSourceRuntimeState(unitId: string, chartId: string): IChartDataSourceRuntimeState | undefined;
37
+ refreshChartDataSource(unitId: string, chartId: string): Promise<void>;
38
+ setActiveChartRuntime(runtime: TRuntime | null): void;
39
+ setActiveChartModel(chartModel: ChartModel | null): void;
40
+ setActiveChartById(unitId: string, chartId: string): TRuntime | null;
41
+ generateChartModelContext(unitId: string, chartId: string): IChartContext | undefined;
42
+ refreshChartModel(unitId: string, chartId: string): TRuntime | undefined;
43
+ refreshChartsByDataSource(unitId: string, dataSourceId: string): TRuntime[];
44
+ removeChartModel(unitId: string, chartId: string): boolean;
45
+ removeUnit(unitId: string): void;
46
+ dispose(): void;
47
+ protected _createStoredRuntime(runtime: IChartModelRuntime): TRuntime;
48
+ protected _beforeRuntimeRefresh(_runtime: TRuntime): void;
49
+ private _bindDataSource;
50
+ private _releaseBindingsByDataSource;
51
+ private _releaseHandle;
52
+ private _disposeBinding;
53
+ private _disposeUnitBindings;
54
+ private _disposeRuntime;
55
+ private _getOrCreateUnitMap;
56
+ }