@antv/gpt-vis 1.3.0 → 1.3.1

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.
@@ -1,8 +1,12 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ import { THEME_PRESETS } from "./presets";
3
+
2
4
  /** Keep the override layers in order; each renderer expands only its own tokens. */
3
5
  export function resolveTheme(type, theme, localStyle) {
4
6
  var _spec$tokens, _spec$baseTheme, _ref, _tokens$category, _spec$charts;
5
- var spec = _typeof(theme) === 'object' ? theme : undefined;
7
+ var spec = _typeof(theme) === 'object' ? theme : THEME_PRESETS.find(function (preset) {
8
+ return preset.id === theme;
9
+ });
6
10
  var tokens = (_spec$tokens = spec === null || spec === void 0 ? void 0 : spec.tokens) !== null && _spec$tokens !== void 0 ? _spec$tokens : {};
7
11
  var name = (_spec$baseTheme = spec === null || spec === void 0 ? void 0 : spec.baseTheme) !== null && _spec$baseTheme !== void 0 ? _spec$baseTheme : typeof theme === 'string' ? theme : 'default';
8
12
  var baseTheme = name === 'dark' || name === 'academy' ? name : 'light';
@@ -89,7 +89,7 @@ var adaptTableCellStyle = function adaptTableCellStyle(style) {
89
89
  /** Translate one table border contract to outer and row-separator DOM styles. */
90
90
  var adaptTableBorderStyle = function adaptTableBorderStyle(style) {
91
91
  var _style$width, _style$style, _style$color;
92
- if (!style) return {
92
+ if (!style || Object.keys(style).length === 0) return {
93
93
  table: {},
94
94
  cell: {}
95
95
  };
@@ -1,7 +1,7 @@
1
- import type { ThemeSpec } from './theme';
2
- export type { ChartType, ThemeSpec, ThemeStyle, ThemeTokens } from './theme';
1
+ import type { BuiltinThemeName, ThemeSpec } from './theme';
2
+ export type { BuiltinThemeName, ChartType, ThemeSpec, ThemeStyle, ThemeTokens } from './theme';
3
3
  /** Built-in visualization themes supported by GPT-Vis. */
4
- export type VisualizationTheme = 'default' | 'light' | 'dark' | 'academy' | ThemeSpec;
4
+ export type VisualizationTheme = BuiltinThemeName | ThemeSpec;
5
5
  /** Common construction options shared by every visualization. */
6
6
  export interface VisualizationOptions {
7
7
  container: string | HTMLElement;
@@ -1,4 +1,6 @@
1
1
  export type ChartType = 'area' | 'bar' | 'boxplot' | 'column' | 'dual-axes' | 'fishbone-diagram' | 'flow-diagram' | 'funnel' | 'histogram' | 'indented-tree' | 'line' | 'liquid' | 'mindmap' | 'network-graph' | 'organization-chart' | 'pie' | 'radar' | 'sankey' | 'scatter' | 'summary' | 'table' | 'treemap' | 'venn' | 'violin' | 'waterfall' | 'word-cloud';
2
+ /** Stable names accepted by the constructor, chart JSON, and visualization Syntax. */
3
+ export type BuiltinThemeName = 'default' | 'light' | 'dark' | 'academy' | 'gpt-vis' | 'midnight' | 'paper' | 'product' | 'neon-circuit' | 'terra-print' | 'mono-signal' | 'candy-pop' | 'pop' | 'bauhaus';
2
4
  /** Reusable visual theme. Local chart config takes precedence over this spec. */
3
5
  export interface ThemeSpec {
4
6
  /** Stable identifier; does not register a theme name. */
@@ -19,7 +19,7 @@ var CELL_PADDING = 16; // 8px * 2
19
19
  var MIN_WIDTH_MULTIPLIER = 1.1;
20
20
 
21
21
  // CSS styles for the table component
22
- var TABLE_STYLES = "\n .".concat(SCOPE_ID, " {\n font-family: ").concat(FONT_FAMILY, ";\n overflow: auto;\n height: 100%;\n padding: 16px;\n }\n\n .").concat(SCOPE_ID, " .table-heading {\n margin-bottom: 12px;\n }\n\n .").concat(SCOPE_ID, " .table-title {\n font-size: 16px;\n font-weight: 500;\n color: #1d2129;\n }\n\n .").concat(SCOPE_ID, " .table-subtitle {\n margin-top: 4px;\n font-size: 12px;\n color: #667085;\n }\n\n .").concat(SCOPE_ID, " .table-empty {\n padding: 20px;\n text-align: center;\n color: #999;\n }\n\n .").concat(SCOPE_ID, " table {\n border-collapse: separate;\n border-spacing: 0;\n background: #fff;\n border-radius: 8px;\n overflow: hidden;\n }\n\n .").concat(SCOPE_ID, " th,\n .").concat(SCOPE_ID, " td {\n border-bottom: 1px solid #f0f0f0;\n padding: 8px;\n text-align: left;\n font-size: 14px;\n color: #333;\n white-space: nowrap;\n }\n\n .").concat(SCOPE_ID, " th {\n background: #f5f5f5;\n font-weight: 600;\n color: #000000e0;\n position: relative;\n }\n\n .").concat(SCOPE_ID, " th:not(:last-child)::after {\n content: '';\n position: absolute;\n top: 25%;\n right: 0;\n width: 1px;\n height: 50%;\n background: #e0e0e0;\n }\n\n .").concat(SCOPE_ID, " tr {\n transition: background 0.2s;\n }\n\n .").concat(SCOPE_ID, " tbody tr:hover {\n background: #f5f5f5;\n cursor: pointer;\n }\n\n .").concat(SCOPE_ID, "[data-theme=\"dark\"] {\n background: #000;\n }\n\n .").concat(SCOPE_ID, "[data-theme=\"dark\"] .table-title {\n color: #ffffffd9;\n }\n\n .").concat(SCOPE_ID, "[data-theme=\"dark\"] .table-subtitle {\n color: #ffffffa6;\n }\n\n .").concat(SCOPE_ID, "[data-theme=\"dark\"] table {\n background: #141414;\n }\n\n .").concat(SCOPE_ID, "[data-theme=\"dark\"] th,\n .").concat(SCOPE_ID, "[data-theme=\"dark\"] td {\n border-bottom: 1px solid #303030;\n color: #ffffffd9;\n }\n\n .").concat(SCOPE_ID, "[data-theme=\"dark\"] th {\n background: #1f1f1f;\n color: #ffffffa6;\n }\n\n .").concat(SCOPE_ID, "[data-theme=\"dark\"] th:not(:last-child)::after {\n background: #303030;\n }\n\n .").concat(SCOPE_ID, "[data-theme=\"dark\"] tbody tr:hover {\n background: #1f1f1f;\n }\n");
22
+ var TABLE_STYLES = "\n .".concat(SCOPE_ID, " {\n font-family: ").concat(FONT_FAMILY, ";\n line-height: normal;\n overflow-wrap: normal;\n overflow: auto;\n height: 100%;\n padding: 16px;\n }\n\n .").concat(SCOPE_ID, " .table-heading {\n margin-bottom: 12px;\n }\n\n .").concat(SCOPE_ID, " .table-title {\n font-size: 16px;\n font-weight: 500;\n color: #1d2129;\n }\n\n .").concat(SCOPE_ID, " .table-subtitle {\n margin-top: 4px;\n font-size: 12px;\n color: #667085;\n }\n\n .").concat(SCOPE_ID, " .table-empty {\n padding: 20px;\n text-align: center;\n color: #999;\n }\n\n .").concat(SCOPE_ID, " table {\n border-collapse: separate;\n border-spacing: 0;\n background: #fff;\n border-radius: 8px;\n overflow: hidden;\n }\n\n .").concat(SCOPE_ID, " th,\n .").concat(SCOPE_ID, " td {\n border-bottom: 1px solid #f0f0f0;\n padding: 8px;\n text-align: left;\n font-size: 14px;\n color: #333;\n white-space: nowrap;\n }\n\n .").concat(SCOPE_ID, " th {\n background: #f5f5f5;\n font-weight: 600;\n color: #000000e0;\n position: relative;\n }\n\n .").concat(SCOPE_ID, " th:not(:last-child)::after {\n content: '';\n position: absolute;\n top: 25%;\n right: 0;\n width: 1px;\n height: 50%;\n background: #e0e0e0;\n }\n\n .").concat(SCOPE_ID, " tr {\n transition: background 0.2s;\n }\n\n .").concat(SCOPE_ID, " tbody tr:hover {\n background: #f5f5f5;\n cursor: pointer;\n }\n\n .").concat(SCOPE_ID, "[data-theme=\"dark\"] {\n background: #000;\n }\n\n .").concat(SCOPE_ID, "[data-theme=\"dark\"] .table-title {\n color: #ffffffd9;\n }\n\n .").concat(SCOPE_ID, "[data-theme=\"dark\"] .table-subtitle {\n color: #ffffffa6;\n }\n\n .").concat(SCOPE_ID, "[data-theme=\"dark\"] table {\n background: #141414;\n }\n\n .").concat(SCOPE_ID, "[data-theme=\"dark\"] th,\n .").concat(SCOPE_ID, "[data-theme=\"dark\"] td {\n border-bottom: 1px solid #303030;\n color: #ffffffd9;\n }\n\n .").concat(SCOPE_ID, "[data-theme=\"dark\"] th {\n background: #1f1f1f;\n color: #ffffffa6;\n }\n\n .").concat(SCOPE_ID, "[data-theme=\"dark\"] th:not(:last-child)::after {\n background: #303030;\n }\n\n .").concat(SCOPE_ID, "[data-theme=\"dark\"] tbody tr:hover {\n background: #1f1f1f;\n }\n");
23
23
 
24
24
  /**
25
25
  * Calculate the minimum width needed for a table based on its data.