@dashspec/renderer 0.1.39 → 0.1.40
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/CHANGELOG.md +14 -0
- package/dist/{chunk-UL6VRMFZ.js → chunk-UK4FBI4D.js} +2 -2
- package/dist/{chunk-UL6VRMFZ.js.map → chunk-UK4FBI4D.js.map} +1 -1
- package/dist/{core-B6Up94OI.d.ts → core-CrM2CTkH.d.ts} +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/index.d.ts +28 -13
- package/dist/index.js +36 -28
- package/dist/index.js.map +1 -1
- package/docs/theming.md +26 -0
- package/package.json +1 -1
|
@@ -7588,7 +7588,7 @@ declare class TransformError extends Error {
|
|
|
7588
7588
|
declare function applyTransform(data: unknown, steps: readonly Step[], root: Scope, opts?: TransformOptions): unknown;
|
|
7589
7589
|
|
|
7590
7590
|
/** This package's version. A test keeps it equal to package.json's; bump both together. */
|
|
7591
|
-
declare const RENDERER_VERSION = "0.1.
|
|
7591
|
+
declare const RENDERER_VERSION = "0.1.40";
|
|
7592
7592
|
/**
|
|
7593
7593
|
* Whether `version` satisfies `range`. Supports what documents need: "1.2.3" (that or newer within the major, like
|
|
7594
7594
|
* "^"), ">=1.2", ">1.2.3", "<2", "<=2.1", "^1.2", "~1.2.3", and several of them separated by spaces (all must hold).
|
package/dist/core.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { f as ACTION_KINDS, g as ACTION_SCHEMAS, h as API_VERSION, i as Action, j as ActionRef, k as Auth, B as BREAKPOINTS, l as BUILT_IN_DATASOURCE_TYPES, C as Callback, m as Connection, n as ConnectionSpec, o as DATE_PRESETS, D as Dashboard, p as DashboardInput, q as DataBinding, r as DataError, s as DataErrorCode, t as Datasource, u as DateRange, v as Display, w as Drill, x as Duration, y as EventHandler, z as EventMap, F as Expression, G as ExpressionError, I as FnProp, a$ as Grid, K as Handler, L as HelperSettings, M as Helpers, H as HttpClient, O as HttpClientInternals, P as Id, J as JsonValue, Q as Layout, U as LayoutItem, V as LoadOptions, X as LoadResult, Y as Metadata, Z as MigrateResult, _ as MigrationError, $ as Modal, a0 as NamedAction, N as NetworkOptions, a1 as Node, a2 as Panel, a3 as PanelControl, a4 as PanelMigration, a6 as Problem, a7 as RENDERER_VERSION, a8 as RESERVED_STATE_KEYS, a9 as RefRoot, aa as Reference, ab as Requires, R as ResolvedRequest, ac as SCHEMA_URL, S as Scope, ad as Severity, ae as Spec, b0 as StatusTone, af as Template, a as TimeSettings, ag as TokenSource, ah as TransformError, ai as TransformOptions, aj as TransformStep, ak as Translations, al as VARIABLE_KINDS, am as ValidateOptions, an as ValidationResult, ao as Variable, ap as WidgetCheck, aq as WidgetMigrations, as as applyTransform, at as buildRequestUrl, au as buildUrl, av as builtInWidgetChecks, aw as collectReferences, ax as compile, ay as createHelpers, az as createHttpClient, aA as dashboardJsonSchema, aB as evaluate, aC as evaluateSafe, aD as expressionReferences, aE as graphqlData, aF as interpolate, aG as interpolateUrl, aH as isCallbackSource, aI as isSafeUrl, aJ as loadDocument, aK as mergeConnections, aL as migrateDocument, aM as parse, aN as parseDuration, aO as placeholders, aP as plantDate, aQ as plantDayStart, aR as resolve, aS as resolveBaseUrl, aT as resolveRequest, aU as safeLink, aV as satisfies, aW as scope, aX as stripStrings, aY as templateReferences, aZ as translator, a_ as validateDocument } from './core-
|
|
1
|
+
export { f as ACTION_KINDS, g as ACTION_SCHEMAS, h as API_VERSION, i as Action, j as ActionRef, k as Auth, B as BREAKPOINTS, l as BUILT_IN_DATASOURCE_TYPES, C as Callback, m as Connection, n as ConnectionSpec, o as DATE_PRESETS, D as Dashboard, p as DashboardInput, q as DataBinding, r as DataError, s as DataErrorCode, t as Datasource, u as DateRange, v as Display, w as Drill, x as Duration, y as EventHandler, z as EventMap, F as Expression, G as ExpressionError, I as FnProp, a$ as Grid, K as Handler, L as HelperSettings, M as Helpers, H as HttpClient, O as HttpClientInternals, P as Id, J as JsonValue, Q as Layout, U as LayoutItem, V as LoadOptions, X as LoadResult, Y as Metadata, Z as MigrateResult, _ as MigrationError, $ as Modal, a0 as NamedAction, N as NetworkOptions, a1 as Node, a2 as Panel, a3 as PanelControl, a4 as PanelMigration, a6 as Problem, a7 as RENDERER_VERSION, a8 as RESERVED_STATE_KEYS, a9 as RefRoot, aa as Reference, ab as Requires, R as ResolvedRequest, ac as SCHEMA_URL, S as Scope, ad as Severity, ae as Spec, b0 as StatusTone, af as Template, a as TimeSettings, ag as TokenSource, ah as TransformError, ai as TransformOptions, aj as TransformStep, ak as Translations, al as VARIABLE_KINDS, am as ValidateOptions, an as ValidationResult, ao as Variable, ap as WidgetCheck, aq as WidgetMigrations, as as applyTransform, at as buildRequestUrl, au as buildUrl, av as builtInWidgetChecks, aw as collectReferences, ax as compile, ay as createHelpers, az as createHttpClient, aA as dashboardJsonSchema, aB as evaluate, aC as evaluateSafe, aD as expressionReferences, aE as graphqlData, aF as interpolate, aG as interpolateUrl, aH as isCallbackSource, aI as isSafeUrl, aJ as loadDocument, aK as mergeConnections, aL as migrateDocument, aM as parse, aN as parseDuration, aO as placeholders, aP as plantDate, aQ as plantDayStart, aR as resolve, aS as resolveBaseUrl, aT as resolveRequest, aU as safeLink, aV as satisfies, aW as scope, aX as stripStrings, aY as templateReferences, aZ as translator, a_ as validateDocument } from './core-CrM2CTkH.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
import 'react';
|
package/dist/core.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as AnyWidgetDefinition, T as TreeState, H as HttpClient, R as ResolvedRequest, a as TimeSettings, D as Dashboard, N as NetworkOptions, J as JsonValue, S as Scope, W as WidgetDefinition, b as SlotDefinition, c as SlotRenderOptions, d as WidgetMeta, e as WidgetProps } from './core-
|
|
2
|
-
export { f as ACTION_KINDS, g as ACTION_SCHEMAS, h as API_VERSION, i as Action, j as ActionRef, k as Auth, B as BREAKPOINTS, l as BUILT_IN_DATASOURCE_TYPES, C as Callback, m as Connection, n as ConnectionSpec, o as DATE_PRESETS, p as DashboardInput, q as DataBinding, r as DataError, s as DataErrorCode, t as Datasource, u as DateRange, v as Display, w as Drill, x as Duration, E as Emit, y as EventHandler, z as EventMap, F as Expression, G as ExpressionError, I as FnProp, K as Handler, L as HelperSettings, M as Helpers, O as HttpClientInternals, P as Id, Q as Layout, U as LayoutItem, V as LoadOptions, X as LoadResult, Y as Metadata, Z as MigrateResult, _ as MigrationError, $ as Modal, a0 as NamedAction, a1 as Node, a2 as Panel, a3 as PanelControl, a4 as PanelMigration, a5 as PanelState, a6 as Problem, a7 as RENDERER_VERSION, a8 as RESERVED_STATE_KEYS, a9 as RefRoot, aa as Reference, ab as Requires, ac as SCHEMA_URL, ad as Severity, ae as Spec, af as Template, ag as TokenSource, ah as TransformError, ai as TransformOptions, aj as TransformStep, ak as Translations, al as VARIABLE_KINDS, am as ValidateOptions, an as ValidationResult, ao as Variable, ap as WidgetCheck, aq as WidgetMigrations, ar as WidgetStore, as as applyTransform, at as buildRequestUrl, au as buildUrl, av as builtInWidgetChecks, aw as collectReferences, ax as compile, ay as createHelpers, az as createHttpClient, aA as dashboardJsonSchema, aB as evaluate, aC as evaluateSafe, aD as expressionReferences, aE as graphqlData, aF as interpolate, aG as interpolateUrl, aH as isCallbackSource, aI as isSafeUrl, aJ as loadDocument, aK as mergeConnections, aL as migrateDocument, aM as parse, aN as parseDuration, aO as placeholders, aP as plantDate, aQ as plantDayStart, aR as resolve, aS as resolveBaseUrl, aT as resolveRequest, aU as safeLink, aV as satisfies, aW as scope, aX as stripStrings, aY as templateReferences, aZ as translator, a_ as validateDocument } from './core-
|
|
1
|
+
import { A as AnyWidgetDefinition, T as TreeState, H as HttpClient, R as ResolvedRequest, a as TimeSettings, D as Dashboard, N as NetworkOptions, J as JsonValue, S as Scope, W as WidgetDefinition, b as SlotDefinition, c as SlotRenderOptions, d as WidgetMeta, e as WidgetProps } from './core-CrM2CTkH.js';
|
|
2
|
+
export { f as ACTION_KINDS, g as ACTION_SCHEMAS, h as API_VERSION, i as Action, j as ActionRef, k as Auth, B as BREAKPOINTS, l as BUILT_IN_DATASOURCE_TYPES, C as Callback, m as Connection, n as ConnectionSpec, o as DATE_PRESETS, p as DashboardInput, q as DataBinding, r as DataError, s as DataErrorCode, t as Datasource, u as DateRange, v as Display, w as Drill, x as Duration, E as Emit, y as EventHandler, z as EventMap, F as Expression, G as ExpressionError, I as FnProp, K as Handler, L as HelperSettings, M as Helpers, O as HttpClientInternals, P as Id, Q as Layout, U as LayoutItem, V as LoadOptions, X as LoadResult, Y as Metadata, Z as MigrateResult, _ as MigrationError, $ as Modal, a0 as NamedAction, a1 as Node, a2 as Panel, a3 as PanelControl, a4 as PanelMigration, a5 as PanelState, a6 as Problem, a7 as RENDERER_VERSION, a8 as RESERVED_STATE_KEYS, a9 as RefRoot, aa as Reference, ab as Requires, ac as SCHEMA_URL, ad as Severity, ae as Spec, af as Template, ag as TokenSource, ah as TransformError, ai as TransformOptions, aj as TransformStep, ak as Translations, al as VARIABLE_KINDS, am as ValidateOptions, an as ValidationResult, ao as Variable, ap as WidgetCheck, aq as WidgetMigrations, ar as WidgetStore, as as applyTransform, at as buildRequestUrl, au as buildUrl, av as builtInWidgetChecks, aw as collectReferences, ax as compile, ay as createHelpers, az as createHttpClient, aA as dashboardJsonSchema, aB as evaluate, aC as evaluateSafe, aD as expressionReferences, aE as graphqlData, aF as interpolate, aG as interpolateUrl, aH as isCallbackSource, aI as isSafeUrl, aJ as loadDocument, aK as mergeConnections, aL as migrateDocument, aM as parse, aN as parseDuration, aO as placeholders, aP as plantDate, aQ as plantDayStart, aR as resolve, aS as resolveBaseUrl, aT as resolveRequest, aU as safeLink, aV as satisfies, aW as scope, aX as stripStrings, aY as templateReferences, aZ as translator, a_ as validateDocument } from './core-CrM2CTkH.js';
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import { CSSProperties, ReactNode, ComponentType } from 'react';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
@@ -99,6 +99,11 @@ type CssDeclarations = CSSProperties & {
|
|
|
99
99
|
/** Turns a `CssRules` object into a CSS string with `&` selectors; unsafe values are dropped. */
|
|
100
100
|
declare function cssRulesToString(rules: CssRules, unsafe: RegExp): string;
|
|
101
101
|
|
|
102
|
+
/** A colour, or one per mode: `{ light: "#0d0d0d", dark: "#f2f2f2" }`. */
|
|
103
|
+
type ModeColor = string | {
|
|
104
|
+
light?: string;
|
|
105
|
+
dark?: string;
|
|
106
|
+
};
|
|
102
107
|
/** A piece of text inside widgets: its font (a theme font), size, weight, line height and colour. */
|
|
103
108
|
interface TextPart {
|
|
104
109
|
font?: "heading" | "body" | "data";
|
|
@@ -107,7 +112,7 @@ interface TextPart {
|
|
|
107
112
|
weight?: number;
|
|
108
113
|
/** px */
|
|
109
114
|
lineHeight?: number;
|
|
110
|
-
color?:
|
|
115
|
+
color?: ModeColor;
|
|
111
116
|
/** px above it (e.g. a subtitle under the title). */
|
|
112
117
|
marginTop?: number;
|
|
113
118
|
/** CSS padding, e.g. "24px 0". */
|
|
@@ -128,7 +133,7 @@ interface PartTokens {
|
|
|
128
133
|
/** The ⓘ next to a title. */
|
|
129
134
|
info?: {
|
|
130
135
|
size?: number;
|
|
131
|
-
color?:
|
|
136
|
+
color?: ModeColor;
|
|
132
137
|
};
|
|
133
138
|
/** KPI and tile labels. */
|
|
134
139
|
label?: TextPart;
|
|
@@ -160,22 +165,22 @@ interface PartTokens {
|
|
|
160
165
|
radius?: number;
|
|
161
166
|
gap?: number;
|
|
162
167
|
spacing?: number;
|
|
163
|
-
border?:
|
|
168
|
+
border?: ModeColor;
|
|
164
169
|
activeLabel?: TextPart;
|
|
165
170
|
};
|
|
166
171
|
/** Tables: cell padding (CSS), row divider colour, totals row and opened-row backgrounds. */
|
|
167
172
|
table?: {
|
|
168
173
|
cellPadding?: string;
|
|
169
|
-
rowBorder?:
|
|
170
|
-
footBackground?:
|
|
174
|
+
rowBorder?: ModeColor;
|
|
175
|
+
footBackground?: ModeColor;
|
|
171
176
|
footWeight?: number;
|
|
172
|
-
openBackground?:
|
|
177
|
+
openBackground?: ModeColor;
|
|
173
178
|
};
|
|
174
179
|
/** The live badge's dot (px) and colours. */
|
|
175
180
|
liveDot?: {
|
|
176
181
|
size?: number;
|
|
177
|
-
color?:
|
|
178
|
-
staleColor?:
|
|
182
|
+
color?: ModeColor;
|
|
183
|
+
staleColor?: ModeColor;
|
|
179
184
|
};
|
|
180
185
|
/** The filter bar: its padding (CSS, e.g. "16px") and corner radius (px). */
|
|
181
186
|
filterBar?: {
|
|
@@ -190,7 +195,7 @@ interface PartTokens {
|
|
|
190
195
|
};
|
|
191
196
|
}
|
|
192
197
|
/** CSS for a theme's `scale.parts`, scoped under `scope`. Empty when the theme sets none. */
|
|
193
|
-
declare function partsCss(theme: Theme, scope: string): string;
|
|
198
|
+
declare function partsCss(theme: Theme, scope: string, mode?: "light" | "dark"): string;
|
|
194
199
|
|
|
195
200
|
/**
|
|
196
201
|
* The DashSpec token contract. Widgets read only these tokens, through `--ds-*` CSS variables,
|
|
@@ -355,6 +360,11 @@ interface WidgetTheme {
|
|
|
355
360
|
* or an object with suggested selectors (`{ "& .ds-kpi-label": { textTransform: "uppercase" } }`).
|
|
356
361
|
*/
|
|
357
362
|
css?: string | CssRules;
|
|
363
|
+
/** Changes for dark mode only, applied after `vars` and `css` (e.g. colours that differ on a dark background). */
|
|
364
|
+
dark?: {
|
|
365
|
+
vars?: Record<string, string>;
|
|
366
|
+
css?: string | CssRules;
|
|
367
|
+
};
|
|
358
368
|
/** Anything else your own widget reads: `useThemeTokens()?.theme.widgets?.["acme.Gauge"]?.settings`. */
|
|
359
369
|
settings?: Record<string, unknown>;
|
|
360
370
|
}
|
|
@@ -421,7 +431,7 @@ declare function themeStylesheet(theme: Theme, selector?: string): string;
|
|
|
421
431
|
* root). `vars` become custom properties on `.ds-panel[data-kind="…"]`; `css` is added with `&` as that panel.
|
|
422
432
|
* Unsafe variable names or values are dropped, and `css` can't close the `<style>` element.
|
|
423
433
|
*/
|
|
424
|
-
declare function widgetThemeCss(theme: Theme, scope: string): string;
|
|
434
|
+
declare function widgetThemeCss(theme: Theme, scope: string, mode?: "light" | "dark"): string;
|
|
425
435
|
|
|
426
436
|
/** DashSpec's neutral default. Brand themes made with `createTheme` start from it. */
|
|
427
437
|
declare const defaultTheme: Theme;
|
|
@@ -1433,6 +1443,11 @@ interface DashboardRendererProps extends NetworkOptions {
|
|
|
1433
1443
|
aliases?: Readonly<Record<string, string>>;
|
|
1434
1444
|
datasourceTypes?: readonly DatasourceType[];
|
|
1435
1445
|
theme?: Theme;
|
|
1446
|
+
/**
|
|
1447
|
+
* Light or dark, decided by the host (e.g. your app's dark-mode switch): "light", "dark" or "auto" (follows the
|
|
1448
|
+
* viewer's system). Wins over the theme's and the document's mode. Every theme has both colour sets.
|
|
1449
|
+
*/
|
|
1450
|
+
colorMode?: "light" | "dark" | "auto";
|
|
1436
1451
|
/**
|
|
1437
1452
|
* Named themes a document can pick with `"display": { "theme": "<name>" }`. "light", "dark" and "auto" stay modes
|
|
1438
1453
|
* of `theme`. Usually registered once on a `DashSpecProvider`.
|
|
@@ -1534,7 +1549,7 @@ declare function PanelFrame({ id, nested }: {
|
|
|
1534
1549
|
}): react_jsx_runtime.JSX.Element;
|
|
1535
1550
|
|
|
1536
1551
|
/** Settings that are the same for every dashboard in an app: set them once on a provider. */
|
|
1537
|
-
type DashSpecSettings = Partial<Pick<DashboardRendererProps, "designSystems" | "widgets" | "ui" | "aliases" | "actions" | "functions" | "datasourceTypes" | "themes" | "theme" | "locale" | "scripts" | "context" | "data" | "connections" | "connectionMap" | "getToken" | "refreshToken" | "trustedOrigins" | "transport" | "fetch" | "pageHost" | "storage" | "maxResponseBytes" | "onRequest" | "onResponse" | "onError" | "onEvent" | "onNavigate" | "onOpenDashboard" | "onToast" | "renderEmpty" | "renderError" | "renderLoading">>;
|
|
1552
|
+
type DashSpecSettings = Partial<Pick<DashboardRendererProps, "designSystems" | "widgets" | "ui" | "aliases" | "actions" | "functions" | "datasourceTypes" | "themes" | "theme" | "colorMode" | "locale" | "scripts" | "context" | "data" | "connections" | "connectionMap" | "getToken" | "refreshToken" | "trustedOrigins" | "transport" | "fetch" | "pageHost" | "storage" | "maxResponseBytes" | "onRequest" | "onResponse" | "onError" | "onEvent" | "onNavigate" | "onOpenDashboard" | "onToast" | "renderEmpty" | "renderError" | "renderLoading">>;
|
|
1538
1553
|
/**
|
|
1539
1554
|
* Registers your components, design systems, themes, actions and network settings once for the whole app; every
|
|
1540
1555
|
* `DashboardRenderer` inside uses them, and a document refers to them by name (`"kind": "acme.Gauge"`,
|
package/dist/index.js
CHANGED
|
@@ -116,7 +116,7 @@ import {
|
|
|
116
116
|
translator,
|
|
117
117
|
validateDocument,
|
|
118
118
|
widgetChecks
|
|
119
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-UK4FBI4D.js";
|
|
120
120
|
import {
|
|
121
121
|
createStateProxy,
|
|
122
122
|
getPath,
|
|
@@ -1858,7 +1858,7 @@ ${Object.entries(vars).filter(([k, v]) => SAFE_NAME.test(k) && !UNSAFE_CSS.test(
|
|
|
1858
1858
|
block(`${selector}[data-ds-theme="dark"]`, themeCssVars(theme, "dark"))
|
|
1859
1859
|
].join("\n\n");
|
|
1860
1860
|
}
|
|
1861
|
-
function widgetThemeCss(theme, scope2) {
|
|
1861
|
+
function widgetThemeCss(theme, scope2, mode = "light") {
|
|
1862
1862
|
const out = [];
|
|
1863
1863
|
for (const [kind, w] of Object.entries(theme.widgets ?? {})) {
|
|
1864
1864
|
const m = /^([A-Za-z][\w.-]*)(?::([A-Za-z][\w-]*))?$/.exec(kind);
|
|
@@ -1869,6 +1869,13 @@ function widgetThemeCss(theme, scope2) {
|
|
|
1869
1869
|
const css = typeof w.css === "object" && w.css !== null ? cssRulesToString(w.css, UNSAFE_CSS) : w.css;
|
|
1870
1870
|
if (typeof css === "string" && css && !/<\/?\s*style/i.test(css))
|
|
1871
1871
|
out.push(css.includes("&") ? css.replaceAll("&", sel) : `${sel} { ${css} }`);
|
|
1872
|
+
if (mode === "dark" && w.dark) {
|
|
1873
|
+
const dv = Object.entries(w.dark.vars ?? {}).filter(([k, v]) => SAFE_NAME.test(k) && !UNSAFE_CSS.test(String(v)));
|
|
1874
|
+
if (dv.length) out.push(`${sel} { ${dv.map(([k, v]) => `${k}: ${v};`).join(" ")} }`);
|
|
1875
|
+
const dc = typeof w.dark.css === "object" && w.dark.css !== null ? cssRulesToString(w.dark.css, UNSAFE_CSS) : w.dark.css;
|
|
1876
|
+
if (typeof dc === "string" && dc && !/<\/?\s*style/i.test(dc))
|
|
1877
|
+
out.push(dc.includes("&") ? dc.replaceAll("&", sel) : `${sel} { ${dc} }`);
|
|
1878
|
+
}
|
|
1872
1879
|
}
|
|
1873
1880
|
return out.join("\n");
|
|
1874
1881
|
}
|
|
@@ -1880,33 +1887,34 @@ var px = (v) => v === void 0 ? void 0 : `${v}px`;
|
|
|
1880
1887
|
function decl(map) {
|
|
1881
1888
|
return Object.entries(map).filter(([, v]) => v !== void 0 && ok(v)).map(([k, v]) => `${k}: ${v};`).join(" ");
|
|
1882
1889
|
}
|
|
1883
|
-
function text(t) {
|
|
1890
|
+
function text(t, c) {
|
|
1884
1891
|
if (!t) return "";
|
|
1885
1892
|
return decl({
|
|
1886
1893
|
"font-family": t.font && ["heading", "body", "data"].includes(t.font) ? `var(--ds-font-${t.font})` : void 0,
|
|
1887
1894
|
"font-size": px(t.size),
|
|
1888
1895
|
"font-weight": t.weight,
|
|
1889
1896
|
"line-height": px(t.lineHeight),
|
|
1890
|
-
color: t.color,
|
|
1897
|
+
color: c(t.color),
|
|
1891
1898
|
"margin-top": px(t.marginTop),
|
|
1892
1899
|
padding: t.padding
|
|
1893
1900
|
});
|
|
1894
1901
|
}
|
|
1895
|
-
function partsCss(theme, scope2) {
|
|
1902
|
+
function partsCss(theme, scope2, mode = "light") {
|
|
1896
1903
|
const p = theme.scale.parts;
|
|
1897
1904
|
if (!p) return "";
|
|
1905
|
+
const c = (v) => v === void 0 || typeof v === "string" ? v : v[mode];
|
|
1898
1906
|
const rules = [
|
|
1899
|
-
[".ds-panel-title", text(p.title)],
|
|
1900
|
-
[".ds-panel-subtitle", text(p.subtitle)],
|
|
1901
|
-
[".ds-panel-meta, .ds-live, .ds-chart-legend, .ds-pager, .ds-kpi-foot, .ds-legend", text(p.meta)],
|
|
1902
|
-
[".ds-info", decl({ "font-size": px(p.info?.size), color: p.info?.color })],
|
|
1903
|
-
[".ds-kpi-label, .ds-tile-label", text(p.label)],
|
|
1904
|
-
[".ds-kpi-value, .ds-tile-value", `${text(p.value)}${p.value ? " letter-spacing: 0;" : ""}`],
|
|
1905
|
-
[".ds-kpi-unit", text(p.unit)],
|
|
1906
|
-
[".ds-kpi-note, .ds-kpi-sub, .ds-tile-caption", text(p.caption)],
|
|
1907
|
-
[".ds-state, .ds-kpi-empty", text(p.empty)],
|
|
1908
|
-
[".ds-table th", text(p.tableHead)],
|
|
1909
|
-
[".ds-table td", text(p.tableCell)],
|
|
1907
|
+
[".ds-panel-title", text(p.title, c)],
|
|
1908
|
+
[".ds-panel-subtitle", text(p.subtitle, c)],
|
|
1909
|
+
[".ds-panel-meta, .ds-live, .ds-chart-legend, .ds-pager, .ds-kpi-foot, .ds-legend", text(p.meta, c)],
|
|
1910
|
+
[".ds-info", decl({ "font-size": px(p.info?.size), color: c(p.info?.color) })],
|
|
1911
|
+
[".ds-kpi-label, .ds-tile-label", text(p.label, c)],
|
|
1912
|
+
[".ds-kpi-value, .ds-tile-value", `${text(p.value, c)}${p.value ? " letter-spacing: 0;" : ""}`],
|
|
1913
|
+
[".ds-kpi-unit", text(p.unit, c)],
|
|
1914
|
+
[".ds-kpi-note, .ds-kpi-sub, .ds-tile-caption", text(p.caption, c)],
|
|
1915
|
+
[".ds-state, .ds-kpi-empty", text(p.empty, c)],
|
|
1916
|
+
[".ds-table th", text(p.tableHead, c)],
|
|
1917
|
+
[".ds-table td", text(p.tableCell, c)],
|
|
1910
1918
|
[".ds-table", p.tableCell?.font ? `font-family: var(--ds-font-${p.tableCell.font});` : ""],
|
|
1911
1919
|
[".ds-panel-head", decl({ "align-items": p.header?.align === "start" ? "flex-start" : p.header?.align })],
|
|
1912
1920
|
['.ds-panel[data-kind="Kpi"]', decl({ padding: px(p.kpiCard?.padding), "border-radius": px(p.kpiCard?.radius) })],
|
|
@@ -1924,32 +1932,32 @@ function partsCss(theme, scope2) {
|
|
|
1924
1932
|
padding: px(p.tile?.padding),
|
|
1925
1933
|
"border-radius": px(p.tile?.radius),
|
|
1926
1934
|
gap: px(p.tile?.gap),
|
|
1927
|
-
"border-color": p.tile?.border
|
|
1935
|
+
"border-color": c(p.tile?.border)
|
|
1928
1936
|
})
|
|
1929
1937
|
],
|
|
1930
1938
|
[".ds-tiles", decl({ "--ds-tiles-gap": px(p.tile?.spacing) })],
|
|
1931
|
-
[".ds-tile[data-active] .ds-tile-label", text(p.tile?.activeLabel)],
|
|
1939
|
+
[".ds-tile[data-active] .ds-tile-label", text(p.tile?.activeLabel, c)],
|
|
1932
1940
|
[
|
|
1933
1941
|
".ds-table th, .ds-table td",
|
|
1934
1942
|
decl({
|
|
1935
1943
|
padding: p.table?.cellPadding,
|
|
1936
|
-
"border-bottom-color": p.table?.rowBorder
|
|
1944
|
+
"border-bottom-color": c(p.table?.rowBorder)
|
|
1937
1945
|
})
|
|
1938
1946
|
],
|
|
1939
1947
|
[
|
|
1940
1948
|
".ds-table tfoot td",
|
|
1941
1949
|
decl({
|
|
1942
|
-
background: p.table?.footBackground,
|
|
1950
|
+
background: c(p.table?.footBackground),
|
|
1943
1951
|
"font-weight": p.table?.footWeight,
|
|
1944
1952
|
"border-top": p.table?.footBackground ? "0" : void 0
|
|
1945
1953
|
})
|
|
1946
1954
|
],
|
|
1947
|
-
[".ds-table tr[data-expanded] > td, .ds-row-detail > td", decl({ background: p.table?.openBackground })],
|
|
1955
|
+
[".ds-table tr[data-expanded] > td, .ds-row-detail > td", decl({ background: c(p.table?.openBackground) })],
|
|
1948
1956
|
[
|
|
1949
1957
|
".ds-live > span",
|
|
1950
|
-
decl({ width: px(p.liveDot?.size), height: px(p.liveDot?.size), background: p.liveDot?.color })
|
|
1958
|
+
decl({ width: px(p.liveDot?.size), height: px(p.liveDot?.size), background: c(p.liveDot?.color) })
|
|
1951
1959
|
],
|
|
1952
|
-
[".ds-live[data-stale] > span", decl({ background: p.liveDot?.staleColor })],
|
|
1960
|
+
[".ds-live[data-stale] > span", decl({ background: c(p.liveDot?.staleColor) })],
|
|
1953
1961
|
[".ds-filters", decl({ padding: p.filterBar?.padding, "border-radius": px(p.filterBar?.radius) })],
|
|
1954
1962
|
[".ds-chart-legend", decl({ gap: px(p.legend?.gap) })],
|
|
1955
1963
|
[
|
|
@@ -1987,8 +1995,8 @@ function ThemeScope({ theme, mode, className, style, children }) {
|
|
|
1987
1995
|
const scopeId = useId();
|
|
1988
1996
|
const widgetCss = useMemo(() => {
|
|
1989
1997
|
const scope2 = `[data-ds-scope="${scopeId}"]`;
|
|
1990
|
-
return [partsCss(theme, scope2), widgetThemeCss(theme, scope2)].filter(Boolean).join("\n");
|
|
1991
|
-
}, [theme, scopeId]);
|
|
1998
|
+
return [partsCss(theme, scope2, resolved), widgetThemeCss(theme, scope2, resolved)].filter(Boolean).join("\n");
|
|
1999
|
+
}, [theme, scopeId, resolved]);
|
|
1992
2000
|
return /* @__PURE__ */ jsx(ThemeContext.Provider, { value: ctx, children: /* @__PURE__ */ jsxs(
|
|
1993
2001
|
"div",
|
|
1994
2002
|
{
|
|
@@ -5763,7 +5771,7 @@ function echartsTheme(theme, mode) {
|
|
|
5763
5771
|
padding: [8, 10],
|
|
5764
5772
|
textStyle: { color: c.chart.tooltipText, fontFamily: family, fontSize: 12 },
|
|
5765
5773
|
extraCssText: `border-radius: ${s.radius.control}px; box-shadow: none; backdrop-filter: blur(8px);`,
|
|
5766
|
-
axisPointer: { shadowStyle: { color: "rgba(
|
|
5774
|
+
axisPointer: { shadowStyle: { color: "rgba(127, 127, 127, 0.15)" } }
|
|
5767
5775
|
},
|
|
5768
5776
|
categoryAxis,
|
|
5769
5777
|
valueAxis,
|
|
@@ -6086,7 +6094,7 @@ function cartesian(data, source, spec, type, h, colors) {
|
|
|
6086
6094
|
out[out.length - 1].markLine = {
|
|
6087
6095
|
symbol: "none",
|
|
6088
6096
|
silent: true,
|
|
6089
|
-
lineStyle: { type: [6, 4], width: 1.5, color: "#666666" },
|
|
6097
|
+
lineStyle: { type: [6, 4], width: 1.5, color: colors?.text ?? "#666666", opacity: 0.6 },
|
|
6090
6098
|
label: { show: false },
|
|
6091
6099
|
data: [spec.horizontal ? { xAxis: avg } : { yAxis: avg }]
|
|
6092
6100
|
};
|
|
@@ -8289,7 +8297,7 @@ var DashboardRenderer = forwardRef(
|
|
|
8289
8297
|
breakpoint: props.breakpoint
|
|
8290
8298
|
}
|
|
8291
8299
|
);
|
|
8292
|
-
return /* @__PURE__ */ jsxs23(ThemeScope, { theme: picked.theme, mode: picked.mode, children: [
|
|
8300
|
+
return /* @__PURE__ */ jsxs23(ThemeScope, { theme: picked.theme, mode: props.colorMode ?? picked.mode, children: [
|
|
8293
8301
|
/* @__PURE__ */ jsx31("style", { dangerouslySetInnerHTML: { __html: RENDERER_CSS } }),
|
|
8294
8302
|
/* @__PURE__ */ jsx31(
|
|
8295
8303
|
Boundary,
|