@opendata-ai/openchart-core 6.11.0 → 6.12.0
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.
- package/dist/index.d.ts +19 -1
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/layout/__tests__/chrome.test.ts +15 -0
- package/src/layout/chrome.ts +6 -4
- package/src/types/layout.ts +8 -0
- package/src/types/spec.ts +10 -0
package/dist/index.d.ts
CHANGED
|
@@ -815,6 +815,8 @@ interface ChartSpec {
|
|
|
815
815
|
theme?: ThemeConfig;
|
|
816
816
|
/** Dark mode behavior. Defaults to "off". */
|
|
817
817
|
darkMode?: DarkMode;
|
|
818
|
+
/** Whether to show the tryOpenData.ai watermark. Defaults to true. */
|
|
819
|
+
watermark?: boolean;
|
|
818
820
|
/** Series names to hide from rendering. Hidden series remain in the legend but are visually dimmed. */
|
|
819
821
|
hiddenSeries?: string[];
|
|
820
822
|
/** Per-series visual overrides, keyed by series name (the color field value). */
|
|
@@ -854,6 +856,8 @@ interface TableSpec {
|
|
|
854
856
|
theme?: ThemeConfig;
|
|
855
857
|
/** Dark mode behavior. */
|
|
856
858
|
darkMode?: DarkMode;
|
|
859
|
+
/** Whether to show the tryOpenData.ai watermark. Defaults to true. */
|
|
860
|
+
watermark?: boolean;
|
|
857
861
|
/** Enable client-side search/filter. */
|
|
858
862
|
search?: boolean;
|
|
859
863
|
/** Pagination configuration. True for defaults, or an object with pageSize. */
|
|
@@ -919,6 +923,8 @@ interface GraphSpec {
|
|
|
919
923
|
theme?: ThemeConfig;
|
|
920
924
|
/** Dark mode behavior. */
|
|
921
925
|
darkMode?: DarkMode;
|
|
926
|
+
/** Whether to show the tryOpenData.ai watermark. Defaults to true. */
|
|
927
|
+
watermark?: boolean;
|
|
922
928
|
}
|
|
923
929
|
/**
|
|
924
930
|
* Resolution strategy for shared resources across layers.
|
|
@@ -965,6 +971,8 @@ interface LayerSpec {
|
|
|
965
971
|
theme?: ThemeConfig;
|
|
966
972
|
/** Dark mode behavior. Defaults to "off". */
|
|
967
973
|
darkMode?: DarkMode;
|
|
974
|
+
/** Whether to show the tryOpenData.ai watermark. Defaults to true. */
|
|
975
|
+
watermark?: boolean;
|
|
968
976
|
/** Resolution strategy for shared scales/axes/legends. */
|
|
969
977
|
resolve?: ResolveConfig;
|
|
970
978
|
/** Hidden series names. */
|
|
@@ -1023,6 +1031,8 @@ interface SankeySpec {
|
|
|
1023
1031
|
theme?: ThemeConfig;
|
|
1024
1032
|
/** Dark mode behavior. Defaults to "off". */
|
|
1025
1033
|
darkMode?: DarkMode;
|
|
1034
|
+
/** Whether to show the tryOpenData.ai watermark. Defaults to true. */
|
|
1035
|
+
watermark?: boolean;
|
|
1026
1036
|
/** Animation configuration for entrance animations. */
|
|
1027
1037
|
animation?: AnimationSpec;
|
|
1028
1038
|
/**
|
|
@@ -2124,6 +2134,8 @@ interface ChartLayout {
|
|
|
2124
2134
|
};
|
|
2125
2135
|
/** Resolved animation config. Present only when animation is enabled. */
|
|
2126
2136
|
animation?: ResolvedAnimation;
|
|
2137
|
+
/** Whether the tryOpenData.ai watermark is enabled. */
|
|
2138
|
+
watermark: boolean;
|
|
2127
2139
|
}
|
|
2128
2140
|
/** A resolved column definition with computed properties. */
|
|
2129
2141
|
interface ResolvedColumn {
|
|
@@ -2284,6 +2296,8 @@ interface TableLayout {
|
|
|
2284
2296
|
theme: ResolvedTheme;
|
|
2285
2297
|
/** Resolved animation config. Present only when animation is enabled. */
|
|
2286
2298
|
animation?: ResolvedAnimation;
|
|
2299
|
+
/** Whether the tryOpenData.ai watermark is enabled. */
|
|
2300
|
+
watermark: boolean;
|
|
2287
2301
|
}
|
|
2288
2302
|
/** A resolved graph node with computed position and visual properties. */
|
|
2289
2303
|
interface GraphNodeLayout {
|
|
@@ -2453,6 +2467,8 @@ interface SankeyLayout {
|
|
|
2453
2467
|
};
|
|
2454
2468
|
/** Resolved animation config. Present only when animation is enabled. */
|
|
2455
2469
|
animation?: ResolvedAnimation;
|
|
2470
|
+
/** Whether the tryOpenData.ai watermark is enabled. */
|
|
2471
|
+
watermark: boolean;
|
|
2456
2472
|
}
|
|
2457
2473
|
/** Function signature for text measurement provided by adapters. */
|
|
2458
2474
|
type MeasureTextFn = (text: string, fontSize: number, fontWeight?: number) => {
|
|
@@ -2480,6 +2496,8 @@ interface CompileOptions {
|
|
|
2480
2496
|
* before calling compile. The engine always receives a resolved boolean.
|
|
2481
2497
|
*/
|
|
2482
2498
|
darkMode?: boolean;
|
|
2499
|
+
/** Whether to show the tryOpenData.ai watermark. Defaults to true. */
|
|
2500
|
+
watermark?: boolean;
|
|
2483
2501
|
/**
|
|
2484
2502
|
* Real text measurement function provided by the adapter.
|
|
2485
2503
|
* Uses a hidden canvas or DOM element for accurate text dimensions.
|
|
@@ -2675,7 +2693,7 @@ declare function resolveTheme(userTheme?: ThemeConfig, base?: Theme): ResolvedTh
|
|
|
2675
2693
|
* @param chromeMode - Chrome display mode: full, compact (title only), or hidden.
|
|
2676
2694
|
* @param padding - Override padding (for scaled padding from dimensions).
|
|
2677
2695
|
*/
|
|
2678
|
-
declare function computeChrome(chrome: Chrome | undefined, theme: ResolvedTheme, width: number, measureText?: MeasureTextFn, chromeMode?: ChromeMode, padding?: number): ResolvedChrome;
|
|
2696
|
+
declare function computeChrome(chrome: Chrome | undefined, theme: ResolvedTheme, width: number, measureText?: MeasureTextFn, chromeMode?: ChromeMode, padding?: number, watermark?: boolean): ResolvedChrome;
|
|
2679
2697
|
|
|
2680
2698
|
/**
|
|
2681
2699
|
* Estimate the rendered width of a text string.
|
package/dist/index.js
CHANGED
|
@@ -1108,7 +1108,7 @@ function estimateLineCount(text, style, maxWidth, _measureText) {
|
|
|
1108
1108
|
}
|
|
1109
1109
|
return lines;
|
|
1110
1110
|
}
|
|
1111
|
-
function computeChrome(chrome, theme, width, measureText, chromeMode = "full", padding) {
|
|
1111
|
+
function computeChrome(chrome, theme, width, measureText, chromeMode = "full", padding, watermark = true) {
|
|
1112
1112
|
if (!chrome || chromeMode === "hidden") {
|
|
1113
1113
|
return { topHeight: 0, bottomHeight: 0 };
|
|
1114
1114
|
}
|
|
@@ -1162,7 +1162,7 @@ function computeChrome(chrome, theme, width, measureText, chromeMode = "full", p
|
|
|
1162
1162
|
const topHeight = hasTopChrome ? topY - pad2 + theme.spacing.chromeToChart - chromeGap : 0;
|
|
1163
1163
|
if (chromeMode === "compact") {
|
|
1164
1164
|
let compactBottom = 0;
|
|
1165
|
-
if (width >= BRAND_MIN_WIDTH) {
|
|
1165
|
+
if (watermark && width >= BRAND_MIN_WIDTH) {
|
|
1166
1166
|
const brandHeight = estimateTextHeight(BRAND_FONT_SIZE, 1);
|
|
1167
1167
|
compactBottom = theme.spacing.chartToFooter + brandHeight + pad2;
|
|
1168
1168
|
}
|
|
@@ -1172,7 +1172,8 @@ function computeChrome(chrome, theme, width, measureText, chromeMode = "full", p
|
|
|
1172
1172
|
...topElements
|
|
1173
1173
|
};
|
|
1174
1174
|
}
|
|
1175
|
-
const
|
|
1175
|
+
const shouldReserveBrandWidth = watermark && width >= BRAND_MIN_WIDTH;
|
|
1176
|
+
const bottomMaxWidth = maxWidth - (shouldReserveBrandWidth ? BRAND_RESERVE_WIDTH : 0);
|
|
1176
1177
|
const bottomElements = {};
|
|
1177
1178
|
let bottomHeight = 0;
|
|
1178
1179
|
const bottomItems = [];
|
|
@@ -1223,7 +1224,7 @@ function computeChrome(chrome, theme, width, measureText, chromeMode = "full", p
|
|
|
1223
1224
|
bottomHeight += height + chromeGap;
|
|
1224
1225
|
}
|
|
1225
1226
|
bottomHeight -= chromeGap;
|
|
1226
|
-
if (width >= BRAND_MIN_WIDTH) {
|
|
1227
|
+
if (watermark && width >= BRAND_MIN_WIDTH) {
|
|
1227
1228
|
const brandHeight = estimateTextHeight(BRAND_FONT_SIZE, 1);
|
|
1228
1229
|
const contentBelowFirstItem = bottomHeight - theme.spacing.chartToFooter;
|
|
1229
1230
|
if (brandHeight > contentBelowFirstItem) {
|
|
@@ -1231,7 +1232,7 @@ function computeChrome(chrome, theme, width, measureText, chromeMode = "full", p
|
|
|
1231
1232
|
}
|
|
1232
1233
|
}
|
|
1233
1234
|
bottomHeight += pad2;
|
|
1234
|
-
} else if (width >= BRAND_MIN_WIDTH) {
|
|
1235
|
+
} else if (watermark && width >= BRAND_MIN_WIDTH) {
|
|
1235
1236
|
const brandHeight = estimateTextHeight(BRAND_FONT_SIZE, 1);
|
|
1236
1237
|
bottomHeight = theme.spacing.chartToFooter + brandHeight + pad2;
|
|
1237
1238
|
}
|