@dashspec/renderer 0.1.37 → 0.1.39

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.
@@ -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.37";
7591
+ declare const RENDERER_VERSION = "0.1.39";
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-CMrDMelI.js';
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-B6Up94OI.js';
2
2
  import 'zod';
3
3
  import 'react';
package/dist/core.js CHANGED
@@ -81,7 +81,7 @@ import {
81
81
  templateReferences,
82
82
  translator,
83
83
  validateDocument
84
- } from "./chunk-7II42B2U.js";
84
+ } from "./chunk-UL6VRMFZ.js";
85
85
  export {
86
86
  ACTION_KINDS,
87
87
  ACTION_SCHEMAS,
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-CMrDMelI.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-CMrDMelI.js';
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-B6Up94OI.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-B6Up94OI.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,99 @@ 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 piece of text inside widgets: its font (a theme font), size, weight, line height and colour. */
103
+ interface TextPart {
104
+ font?: "heading" | "body" | "data";
105
+ /** px */
106
+ size?: number;
107
+ weight?: number;
108
+ /** px */
109
+ lineHeight?: number;
110
+ color?: string;
111
+ /** px above it (e.g. a subtitle under the title). */
112
+ marginTop?: number;
113
+ /** CSS padding, e.g. "24px 0". */
114
+ padding?: string;
115
+ }
116
+ /**
117
+ * The look of the parts every widget shares, as values. Each one is optional: a part the theme leaves out keeps
118
+ * DashSpec's own look, so `parts` only ever changes what it names. No class names: the renderer knows which elements
119
+ * each part is.
120
+ */
121
+ interface PartTokens {
122
+ /** Panel titles. */
123
+ title?: TextPart;
124
+ /** The line under a title (`subtitle`). */
125
+ subtitle?: TextPart;
126
+ /** Side text in a header and footers: `meta`, the live badge, chart legends, table pagers, KPI footers. */
127
+ meta?: TextPart;
128
+ /** The ⓘ next to a title. */
129
+ info?: {
130
+ size?: number;
131
+ color?: string;
132
+ };
133
+ /** KPI and tile labels. */
134
+ label?: TextPart;
135
+ /** KPI and tile values. */
136
+ value?: TextPart;
137
+ /** The unit after a KPI value. */
138
+ unit?: TextPart;
139
+ /** Notes under KPI values and tile captions. */
140
+ caption?: TextPart;
141
+ /** Empty, no-data and loading messages. */
142
+ empty?: TextPart;
143
+ /** Table header cells and body cells. */
144
+ tableHead?: TextPart;
145
+ tableCell?: TextPart;
146
+ /** Panel header: side text centred on the title, or on its first line ("start", useful with a subtitle). */
147
+ header?: {
148
+ align?: "center" | "start";
149
+ };
150
+ /** KPI cards: padding, corner radius, gap and minimum height (px). */
151
+ kpiCard?: {
152
+ padding?: number;
153
+ radius?: number;
154
+ gap?: number;
155
+ minHeight?: number;
156
+ };
157
+ /** Tiles: padding, radius, gap inside and between tiles (px), border colour, and the selected tile's label. */
158
+ tile?: {
159
+ padding?: number;
160
+ radius?: number;
161
+ gap?: number;
162
+ spacing?: number;
163
+ border?: string;
164
+ activeLabel?: TextPart;
165
+ };
166
+ /** Tables: cell padding (CSS), row divider colour, totals row and opened-row backgrounds. */
167
+ table?: {
168
+ cellPadding?: string;
169
+ rowBorder?: string;
170
+ footBackground?: string;
171
+ footWeight?: number;
172
+ openBackground?: string;
173
+ };
174
+ /** The live badge's dot (px) and colours. */
175
+ liveDot?: {
176
+ size?: number;
177
+ color?: string;
178
+ staleColor?: string;
179
+ };
180
+ /** The filter bar: its padding (CSS, e.g. "16px") and corner radius (px). */
181
+ filterBar?: {
182
+ padding?: string;
183
+ radius?: number;
184
+ };
185
+ /** Chart legends: gap between items, swatch size and radius (px). */
186
+ legend?: {
187
+ gap?: number;
188
+ swatch?: number;
189
+ swatchRadius?: number;
190
+ };
191
+ }
192
+ /** 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;
194
+
102
195
  /**
103
196
  * The DashSpec token contract. Widgets read only these tokens, through `--ds-*` CSS variables,
104
197
  * never a UI library's theme. Colours change per mode; everything else is shared by both modes.
@@ -238,6 +331,8 @@ interface ScaleTokens {
238
331
  fontSize?: number;
239
332
  };
240
333
  /** Filter controls, menus and buttons: text size (px, default 13), the stepper arrows' background (default the selection colour) and the filter bar icon size (px). */
334
+ /** The look of parts every widget shares (titles, labels, values, tiles, tables…), as values. */
335
+ parts?: PartTokens;
241
336
  control?: {
242
337
  fontSize?: number;
243
338
  stepBackground?: string;
@@ -1553,4 +1648,4 @@ declare function lazyWidget<S extends z.ZodTypeAny>(def: Omit<WidgetDefinition<S
1553
1648
  fallback?: ReactNode;
1554
1649
  }): WidgetDefinition<S>;
1555
1650
 
1556
- export { AnyWidgetDefinition, BAR, BAR_ICONS, type Breakpoint, CallbackApi, type ColorTokens, ControlField, type CssDeclarations, type CssRules, DS_CLASSES, type DashEvent, DashSpecProvider, type DashSpecSettings, Dashboard, DashboardContext, type DashboardHandle, DashboardRenderer, type DashboardRendererProps, type DashboardRuntime, type DatasourceType, DateControl, DateRangeControl, type DeepPartial, type DesignSystem, type DsClass, type DsSelector, FilterBar, Grid, type GridChangeItem, type HostHooks, HttpClient, JsonValue, type LayoutSpec, ModalHost, MultiSelectControl, NetworkOptions, type NodeScope, type Option, PanelFrame, RENDERER_CSS, ResolvedRequest, type RuntimeOptions, type ScaleTokens, Scope, ScriptMode, ScriptRunner, SelectControl, Slot, SlotDefinition, type SourceState, type StatusColors, type StatusTone, type Theme, ThemeContext, type ThemeInput, type ThemeMode, ThemeScope, type ThemeScopeProps, TimeSettings, type Tree, type TypeRole, type UIChipsProps, type UIComponents, type UICustomFilterProps, type UIDateProps, type UIDateRangeProps, type UIFilterBarProps, type UIFilterDef, type UIMultiSelectProps, type UISearchProps, type UISelectProps, type UIStateProps, type UIToggleProps, WidgetDefinition, WidgetMeta, WidgetProps, type WidgetRegistry, type WidgetTheme, type WrapOptions, builtInWidgets, checkWidget, combineDesignSystems, createDashboardRuntime, createTheme, createWidgetRegistry, cssRulesToString, defaultTheme, defineDesignSystem, defineWidget, echartsTheme, layoutsForView, lazyWidget, mergeDeep, panelRows, presetRange, resolveMode, themeCssVars, themeStylesheet, timeSettingsFor, useDashSpecSettings, useDashboard, useDashboardActions, useDashboardState, useNodeScope, useThemeTokens, useTree, widgetChecks, widgetThemeCss, wrapComponent };
1651
+ export { AnyWidgetDefinition, BAR, BAR_ICONS, type Breakpoint, CallbackApi, type ColorTokens, ControlField, type CssDeclarations, type CssRules, DS_CLASSES, type DashEvent, DashSpecProvider, type DashSpecSettings, Dashboard, DashboardContext, type DashboardHandle, DashboardRenderer, type DashboardRendererProps, type DashboardRuntime, type DatasourceType, DateControl, DateRangeControl, type DeepPartial, type DesignSystem, type DsClass, type DsSelector, FilterBar, Grid, type GridChangeItem, type HostHooks, HttpClient, JsonValue, type LayoutSpec, ModalHost, MultiSelectControl, NetworkOptions, type NodeScope, type Option, PanelFrame, type PartTokens, RENDERER_CSS, ResolvedRequest, type RuntimeOptions, type ScaleTokens, Scope, ScriptMode, ScriptRunner, SelectControl, Slot, SlotDefinition, type SourceState, type StatusColors, type StatusTone, type TextPart, type Theme, ThemeContext, type ThemeInput, type ThemeMode, ThemeScope, type ThemeScopeProps, TimeSettings, type Tree, type TypeRole, type UIChipsProps, type UIComponents, type UICustomFilterProps, type UIDateProps, type UIDateRangeProps, type UIFilterBarProps, type UIFilterDef, type UIMultiSelectProps, type UISearchProps, type UISelectProps, type UIStateProps, type UIToggleProps, WidgetDefinition, WidgetMeta, WidgetProps, type WidgetRegistry, type WidgetTheme, type WrapOptions, builtInWidgets, checkWidget, combineDesignSystems, createDashboardRuntime, createTheme, createWidgetRegistry, cssRulesToString, defaultTheme, defineDesignSystem, defineWidget, echartsTheme, layoutsForView, lazyWidget, mergeDeep, panelRows, partsCss, presetRange, resolveMode, themeCssVars, themeStylesheet, timeSettingsFor, useDashSpecSettings, useDashboard, useDashboardActions, useDashboardState, useNodeScope, useThemeTokens, useTree, widgetChecks, widgetThemeCss, wrapComponent };
package/dist/index.js CHANGED
@@ -116,7 +116,7 @@ import {
116
116
  translator,
117
117
  validateDocument,
118
118
  widgetChecks
119
- } from "./chunk-7II42B2U.js";
119
+ } from "./chunk-UL6VRMFZ.js";
120
120
  import {
121
121
  createStateProxy,
122
122
  getPath,
@@ -979,12 +979,12 @@ function createDataEngine(deps) {
979
979
  if (isHidden()) return schedule(id);
980
980
  if (refresh.whenVisible && !visible.has(id)) return schedule(id);
981
981
  if (typeof refresh.when === "string") {
982
- let ok = false;
982
+ let ok2 = false;
983
983
  try {
984
- ok = Boolean(evaluate(refresh.when, rootScope(deps.getTree(), deps.helpers)));
984
+ ok2 = Boolean(evaluate(refresh.when, rootScope(deps.getTree(), deps.helpers)));
985
985
  } catch {
986
986
  }
987
- if (!ok) return schedule(id);
987
+ if (!ok2) return schedule(id);
988
988
  }
989
989
  if (running.has(id)) return schedule(id);
990
990
  forced.add(id);
@@ -1755,10 +1755,10 @@ var UNITLESS = /* @__PURE__ */ new Set([
1755
1755
  ]);
1756
1756
  function cssRulesToString(rules, unsafe) {
1757
1757
  const out = [];
1758
- for (const [selector, decl] of Object.entries(rules)) {
1759
- if (!decl || typeof decl !== "object" || /[{};<>]/.test(selector)) continue;
1758
+ for (const [selector, decl2] of Object.entries(rules)) {
1759
+ if (!decl2 || typeof decl2 !== "object" || /[{};<>]/.test(selector)) continue;
1760
1760
  const sel = selector.includes("&") ? selector : `& ${selector}`;
1761
- const body = Object.entries(decl).filter(([, v]) => (typeof v === "string" || typeof v === "number") && !unsafe.test(String(v))).map(([k, v]) => {
1761
+ const body = Object.entries(decl2).filter(([, v]) => (typeof v === "string" || typeof v === "number") && !unsafe.test(String(v))).map(([k, v]) => {
1762
1762
  const prop = k.startsWith("--") ? k : k.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`);
1763
1763
  const val = typeof v === "number" && v !== 0 && !k.startsWith("--") && !UNITLESS.has(k) ? `${v}px` : String(v);
1764
1764
  return `${prop}: ${val};`;
@@ -1873,6 +1873,95 @@ function widgetThemeCss(theme, scope2) {
1873
1873
  return out.join("\n");
1874
1874
  }
1875
1875
 
1876
+ // src/theme/parts.ts
1877
+ var SAFE = /^[^;{}<>\\\n\r]*$/;
1878
+ var ok = (v) => typeof v === "number" && Number.isFinite(v) || typeof v === "string" && SAFE.test(v);
1879
+ var px = (v) => v === void 0 ? void 0 : `${v}px`;
1880
+ function decl(map) {
1881
+ return Object.entries(map).filter(([, v]) => v !== void 0 && ok(v)).map(([k, v]) => `${k}: ${v};`).join(" ");
1882
+ }
1883
+ function text(t) {
1884
+ if (!t) return "";
1885
+ return decl({
1886
+ "font-family": t.font && ["heading", "body", "data"].includes(t.font) ? `var(--ds-font-${t.font})` : void 0,
1887
+ "font-size": px(t.size),
1888
+ "font-weight": t.weight,
1889
+ "line-height": px(t.lineHeight),
1890
+ color: t.color,
1891
+ "margin-top": px(t.marginTop),
1892
+ padding: t.padding
1893
+ });
1894
+ }
1895
+ function partsCss(theme, scope2) {
1896
+ const p = theme.scale.parts;
1897
+ if (!p) return "";
1898
+ 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)],
1910
+ [".ds-table", p.tableCell?.font ? `font-family: var(--ds-font-${p.tableCell.font});` : ""],
1911
+ [".ds-panel-head", decl({ "align-items": p.header?.align === "start" ? "flex-start" : p.header?.align })],
1912
+ ['.ds-panel[data-kind="Kpi"]', decl({ padding: px(p.kpiCard?.padding), "border-radius": px(p.kpiCard?.radius) })],
1913
+ [
1914
+ '.ds-panel[data-kind="Kpi"] .ds-kpi',
1915
+ decl({
1916
+ gap: px(p.kpiCard?.gap),
1917
+ // The minimum is on the content so a grid can still stretch the card to its row.
1918
+ "min-height": p.kpiCard?.minHeight !== void 0 ? px(p.kpiCard.minHeight - 2 * (p.kpiCard.padding ?? 0)) : void 0
1919
+ })
1920
+ ],
1921
+ [
1922
+ ".ds-tile",
1923
+ decl({
1924
+ padding: px(p.tile?.padding),
1925
+ "border-radius": px(p.tile?.radius),
1926
+ gap: px(p.tile?.gap),
1927
+ "border-color": p.tile?.border
1928
+ })
1929
+ ],
1930
+ [".ds-tiles", decl({ "--ds-tiles-gap": px(p.tile?.spacing) })],
1931
+ [".ds-tile[data-active] .ds-tile-label", text(p.tile?.activeLabel)],
1932
+ [
1933
+ ".ds-table th, .ds-table td",
1934
+ decl({
1935
+ padding: p.table?.cellPadding,
1936
+ "border-bottom-color": p.table?.rowBorder
1937
+ })
1938
+ ],
1939
+ [
1940
+ ".ds-table tfoot td",
1941
+ decl({
1942
+ background: p.table?.footBackground,
1943
+ "font-weight": p.table?.footWeight,
1944
+ "border-top": p.table?.footBackground ? "0" : void 0
1945
+ })
1946
+ ],
1947
+ [".ds-table tr[data-expanded] > td, .ds-row-detail > td", decl({ background: p.table?.openBackground })],
1948
+ [
1949
+ ".ds-live > span",
1950
+ decl({ width: px(p.liveDot?.size), height: px(p.liveDot?.size), background: p.liveDot?.color })
1951
+ ],
1952
+ [".ds-live[data-stale] > span", decl({ background: p.liveDot?.staleColor })],
1953
+ [".ds-filters", decl({ padding: p.filterBar?.padding, "border-radius": px(p.filterBar?.radius) })],
1954
+ [".ds-chart-legend", decl({ gap: px(p.legend?.gap) })],
1955
+ [
1956
+ ".ds-chart-legend .ds-swatch, .ds-legend .ds-dot",
1957
+ decl({ width: px(p.legend?.swatch), height: px(p.legend?.swatch), "border-radius": px(p.legend?.swatchRadius) })
1958
+ ]
1959
+ ];
1960
+ return rules.filter(([, body]) => body).map(
1961
+ ([sel, body]) => `${sel.split(", ").map((s) => `${scope2} ${s}`).join(", ")} { ${body} }`
1962
+ ).join("\n");
1963
+ }
1964
+
1876
1965
  // src/theme/ThemeScope.tsx
1877
1966
  import { jsx, jsxs } from "react/jsx-runtime";
1878
1967
  var DARK_QUERY = "(prefers-color-scheme: dark)";
@@ -1896,7 +1985,10 @@ function ThemeScope({ theme, mode, className, style, children }) {
1896
1985
  const vars = useMemo(() => themeCssVars(theme, resolved), [theme, resolved]);
1897
1986
  const ctx = useMemo(() => ({ theme, mode: resolved }), [theme, resolved]);
1898
1987
  const scopeId = useId();
1899
- const widgetCss = useMemo(() => widgetThemeCss(theme, `[data-ds-scope="${scopeId}"]`), [theme, scopeId]);
1988
+ const widgetCss = useMemo(() => {
1989
+ const scope2 = `[data-ds-scope="${scopeId}"]`;
1990
+ return [partsCss(theme, scope2), widgetThemeCss(theme, scope2)].filter(Boolean).join("\n");
1991
+ }, [theme, scopeId]);
1900
1992
  return /* @__PURE__ */ jsx(ThemeContext.Provider, { value: ctx, children: /* @__PURE__ */ jsxs(
1901
1993
  "div",
1902
1994
  {
@@ -2235,8 +2327,8 @@ import "zod";
2235
2327
  // src/widgets/shared/Markdown.tsx
2236
2328
  import { Fragment } from "react";
2237
2329
  import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
2238
- function Markdown({ text, onAction }) {
2239
- const blocks = text.replace(/\r\n/g, "\n").split(/\n{2,}/);
2330
+ function Markdown({ text: text2, onAction }) {
2331
+ const blocks = text2.replace(/\r\n/g, "\n").split(/\n{2,}/);
2240
2332
  return /* @__PURE__ */ jsx5(Fragment2, { children: blocks.map((b, i) => {
2241
2333
  const lines = b.split("\n");
2242
2334
  const key = `${i}-${b.slice(0, 12)}`;
@@ -2257,8 +2349,8 @@ function Markdown({ text, onAction }) {
2257
2349
  }) });
2258
2350
  }
2259
2351
  var META = /[\\`*_[\]()#+\-.!>|~:]/g;
2260
- function escapeMarkdown(text) {
2261
- return text.replace(/\r?\n|\r/g, " ").replace(META, "\\$&");
2352
+ function escapeMarkdown(text2) {
2353
+ return text2.replace(/\r?\n|\r/g, " ").replace(META, "\\$&");
2262
2354
  }
2263
2355
  var unescapeMd = (s) => s.replace(/\\([!-/:-@[-`{-~])/g, "$1");
2264
2356
  function inline(s, onAction) {
@@ -2673,13 +2765,13 @@ function MultiSelectControl({
2673
2765
  const id = useId2();
2674
2766
  const chosen = Array.isArray(value) ? value : [];
2675
2767
  const names = options.filter((o) => chosen.includes(o.value)).map((o) => o.label);
2676
- const text = chosen.length === 0 ? emptyLabel : names.length <= 2 ? names.join(", ") : `${chosen.length} selected`;
2768
+ const text2 = chosen.length === 0 ? emptyLabel : names.length <= 2 ? names.join(", ") : `${chosen.length} selected`;
2677
2769
  return /* @__PURE__ */ jsxs5("div", { className: "ds-dd", ref: p.root, "data-block": block || void 0, "data-plain": plain || void 0, children: [
2678
2770
  /* @__PURE__ */ jsx7(
2679
2771
  PillTrigger,
2680
2772
  {
2681
2773
  label,
2682
- value: text,
2774
+ value: text2,
2683
2775
  open: p.open,
2684
2776
  onClick: () => p.setOpen(!p.open),
2685
2777
  triggerRef: p.trigger,
@@ -3099,7 +3191,7 @@ function ControlField({
3099
3191
  const r = v === "today" ? runtime.helpers.today() : interpolate(v, rootScope(runtime.getTree(), runtime.helpers));
3100
3192
  return typeof r === "number" ? new Date(r).toISOString().slice(0, 10) : r || void 0;
3101
3193
  };
3102
- const [text, setText] = useState2(typeof value === "string" ? value : "");
3194
+ const [text2, setText] = useState2(typeof value === "string" ? value : "");
3103
3195
  const timer = useRef3(void 0);
3104
3196
  useEffect2(() => setText(typeof value === "string" ? value : ""), [value]);
3105
3197
  useEffect2(() => () => clearTimeout(timer.current), []);
@@ -3110,7 +3202,7 @@ function ControlField({
3110
3202
  value,
3111
3203
  onChange,
3112
3204
  options,
3113
- text,
3205
+ text: text2,
3114
3206
  setText: (v) => {
3115
3207
  setText(v);
3116
3208
  clearTimeout(timer.current);
@@ -3219,7 +3311,7 @@ function ControlField({
3219
3311
  type: "search",
3220
3312
  "aria-label": label ?? String(def.name),
3221
3313
  placeholder: def.placeholder ?? label ?? "Search",
3222
- value: text,
3314
+ value: text2,
3223
3315
  onChange: (e) => {
3224
3316
  setText(e.target.value);
3225
3317
  clearTimeout(timer.current);
@@ -3703,7 +3795,7 @@ import "zod";
3703
3795
  import { useEffect as useEffect3, useLayoutEffect as useLayoutEffect2, useRef as useRef4, useState as useState3 } from "react";
3704
3796
  import { createPortal as createPortal2 } from "react-dom";
3705
3797
  import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
3706
- function InfoTip({ text }) {
3798
+ function InfoTip({ text: text2 }) {
3707
3799
  const ref = useRef4(null);
3708
3800
  const tip = useRef4(null);
3709
3801
  const [open, setOpen] = useState3(false);
@@ -3747,7 +3839,7 @@ function InfoTip({ text }) {
3747
3839
  ref,
3748
3840
  type: "button",
3749
3841
  className: "ds-info",
3750
- "aria-label": text,
3842
+ "aria-label": text2,
3751
3843
  onClick: (e) => e.stopPropagation(),
3752
3844
  onMouseEnter: show,
3753
3845
  onMouseLeave: hide,
@@ -3773,7 +3865,7 @@ function InfoTip({ text }) {
3773
3865
  visibility: pos ? "visible" : "hidden",
3774
3866
  ["--ds-tip-arrow"]: `${pos?.arrow ?? 0}px`
3775
3867
  },
3776
- children: text
3868
+ children: text2
3777
3869
  }
3778
3870
  ),
3779
3871
  root
@@ -3994,11 +4086,11 @@ function markPart(frame, node) {
3994
4086
  for (const n of root?.querySelectorAll(".ds-part-selected") ?? []) n.classList.remove("ds-part-selected");
3995
4087
  node?.classList.add("ds-part-selected");
3996
4088
  }
3997
- function liveLabel(text, at, h) {
4089
+ function liveLabel(text2, at, h) {
3998
4090
  const ago = at ? h.fmt.ago(at) : "\u2026";
3999
- if (typeof text !== "string") return `Live, updated ${ago}`;
4091
+ if (typeof text2 !== "string") return `Live, updated ${ago}`;
4000
4092
  const time = at ? h.fmt.date(at, { hour: "2-digit", minute: "2-digit", hour12: false }) : "\u2026";
4001
- return text.replaceAll("{time}", time).replaceAll("{ago}", ago);
4093
+ return text2.replaceAll("{time}", time).replaceAll("{ago}", ago);
4002
4094
  }
4003
4095
  function panelStyle(s) {
4004
4096
  if (!s) return void 0;
@@ -4456,11 +4548,11 @@ function loadingText(messages) {
4456
4548
  const v = messages?.loading;
4457
4549
  return v === void 0 || v === null || v === "" ? void 0 : String(v);
4458
4550
  }
4459
- function LoadingState({ text }) {
4460
- if (!text) return /* @__PURE__ */ jsx14("div", { className: "ds-skeleton", "aria-busy": "true", "aria-label": "Loading" });
4551
+ function LoadingState({ text: text2 }) {
4552
+ if (!text2) return /* @__PURE__ */ jsx14("div", { className: "ds-skeleton", "aria-busy": "true", "aria-label": "Loading" });
4461
4553
  return /* @__PURE__ */ jsxs10("output", { className: "ds-loading", "aria-busy": "true", children: [
4462
4554
  /* @__PURE__ */ jsx14("div", { className: "ds-skeleton", "aria-hidden": "true" }),
4463
- /* @__PURE__ */ jsx14("span", { className: "ds-loading-text", children: text })
4555
+ /* @__PURE__ */ jsx14("span", { className: "ds-loading-text", children: text2 })
4464
4556
  ] });
4465
4557
  }
4466
4558
 
@@ -4791,11 +4883,11 @@ var Status = defineWidget({
4791
4883
  const row = asRows(data)[0] ?? {};
4792
4884
  const state = String(field(row, spec.state) ?? "unknown");
4793
4885
  const t = spec.text ? spec.tone ?? "info" : spec.stateMap?.[state] ?? spec.tone ?? "neutral";
4794
- const text = spec.text ?? spec.labels?.[state] ?? state.charAt(0).toUpperCase() + state.slice(1);
4886
+ const text2 = spec.text ?? spec.labels?.[state] ?? state.charAt(0).toUpperCase() + state.slice(1);
4795
4887
  return /* @__PURE__ */ jsxs15("button", { type: "button", className: "ds-status", onClick: () => emit("click", "status", { datum: row, value: state }), children: [
4796
4888
  /* @__PURE__ */ jsxs15("span", { className: "ds-pill", style: { background: tone(t).bg, color: tone(t).fg, borderColor: tone(t).border }, children: [
4797
4889
  /* @__PURE__ */ jsx19("span", { className: "ds-dot", style: { background: tone(t).solid }, "aria-hidden": "true" }),
4798
- text
4890
+ text2
4799
4891
  ] }),
4800
4892
  spec.label && /* @__PURE__ */ jsx19("span", { className: "ds-status-label", children: String(field(row, spec.label) ?? "") })
4801
4893
  ] });
@@ -4828,13 +4920,13 @@ function Chips({
4828
4920
  }) {
4829
4921
  if (!chips?.length) return null;
4830
4922
  const shown = chips.filter((c) => c.when === void 0 || Boolean(evalOver(c.when, vars, helpers))).map((c) => {
4831
- let text = "";
4923
+ let text2 = "";
4832
4924
  try {
4833
4925
  const v = interpolate(c.text, scope(vars, helpers));
4834
- text = v === null || v === void 0 ? "" : String(v);
4926
+ text2 = v === null || v === void 0 ? "" : String(v);
4835
4927
  } catch {
4836
4928
  }
4837
- return { text, tone: toneOf(c.tone, vars, helpers) ?? "neutral" };
4929
+ return { text: text2, tone: toneOf(c.tone, vars, helpers) ?? "neutral" };
4838
4930
  }).filter((c) => c.text);
4839
4931
  if (shown.length === 0) return null;
4840
4932
  return /* @__PURE__ */ jsx20("span", { className: "ds-chips", children: shown.map((c, i) => (
@@ -5002,8 +5094,8 @@ var Table = defineWidget({
5002
5094
  const cell = (c, row) => {
5003
5095
  const v = field(row, c.key);
5004
5096
  if (c.type === "badge") {
5005
- const text = c.template ? tpl(c.template, row) : v === null || v === void 0 || v === "" ? "" : String(v);
5006
- if (!text) return c.empty ? /* @__PURE__ */ jsx21("span", { className: "ds-cell-empty", children: c.empty }) : "";
5097
+ const text2 = c.template ? tpl(c.template, row) : v === null || v === void 0 || v === "" ? "" : String(v);
5098
+ if (!text2) return c.empty ? /* @__PURE__ */ jsx21("span", { className: "ds-cell-empty", children: c.empty }) : "";
5007
5099
  let t = c.map?.[String(v)] ?? "neutral";
5008
5100
  if (c.tone) {
5009
5101
  try {
@@ -5013,7 +5105,7 @@ var Table = defineWidget({
5013
5105
  } catch {
5014
5106
  }
5015
5107
  }
5016
- return /* @__PURE__ */ jsx21("span", { className: "ds-chip", "data-tone": t, children: text });
5108
+ return /* @__PURE__ */ jsx21("span", { className: "ds-chip", "data-tone": t, children: text2 });
5017
5109
  }
5018
5110
  if (c.template) return tpl(c.template, row) || (c.empty ? /* @__PURE__ */ jsx21("span", { className: "ds-cell-empty", children: c.empty }) : "");
5019
5111
  if (c.list !== void 0) {
@@ -6657,10 +6749,10 @@ function Grid({
6657
6749
  const target2 = el.firstElementChild;
6658
6750
  if (target2?.querySelector('[aria-busy="true"]')) return;
6659
6751
  el.setAttribute("data-measuring", "");
6660
- const px = target2?.offsetHeight ?? 0;
6752
+ const px2 = target2?.offsetHeight ?? 0;
6661
6753
  el.removeAttribute("data-measuring");
6662
- if (!px) return;
6663
- const rows = exact ? Math.ceil(px) + gap : Math.ceil((px + gap) / (rowHeight + gap));
6754
+ if (!px2) return;
6755
+ const rows = exact ? Math.ceil(px2) + gap : Math.ceil((px2 + gap) / (rowHeight + gap));
6664
6756
  setFitRows((r) => {
6665
6757
  const cur = r[panel];
6666
6758
  if (cur === rows) return r;
@@ -6980,7 +7072,7 @@ function TourButton({ steps }) {
6980
7072
  const titleId = useId5();
6981
7073
  const textId = useId5();
6982
7074
  const step = at === null ? void 0 : steps[at];
6983
- const text = useTree(
7075
+ const text2 = useTree(
6984
7076
  useCallback7(
6985
7077
  (t) => {
6986
7078
  if (!step) return null;
@@ -7058,8 +7150,8 @@ function TourButton({ steps }) {
7058
7150
  open: true,
7059
7151
  ref: dialog,
7060
7152
  className: "ds-tour",
7061
- "aria-labelledby": text?.title ? titleId : void 0,
7062
- "aria-label": text?.title ? void 0 : "Tour",
7153
+ "aria-labelledby": text2?.title ? titleId : void 0,
7154
+ "aria-label": text2?.title ? void 0 : "Tour",
7063
7155
  "aria-describedby": textId,
7064
7156
  tabIndex: -1,
7065
7157
  style: pos ? { top: pos.top, left: pos.left } : { visibility: "hidden" },
@@ -7071,14 +7163,14 @@ function TourButton({ steps }) {
7071
7163
  },
7072
7164
  children: [
7073
7165
  /* @__PURE__ */ jsxs22("div", { className: "ds-tour-head", children: [
7074
- text?.title && /* @__PURE__ */ jsx30("h3", { className: "ds-tour-title", id: titleId, children: text.title }),
7166
+ text2?.title && /* @__PURE__ */ jsx30("h3", { className: "ds-tour-title", id: titleId, children: text2.title }),
7075
7167
  /* @__PURE__ */ jsxs22("span", { className: "ds-tour-count", children: [
7076
7168
  at + 1,
7077
7169
  " / ",
7078
7170
  steps.length
7079
7171
  ] })
7080
7172
  ] }),
7081
- /* @__PURE__ */ jsx30("p", { className: "ds-tour-text", id: textId, "aria-live": "polite", children: text?.text }),
7173
+ /* @__PURE__ */ jsx30("p", { className: "ds-tour-text", id: textId, "aria-live": "polite", children: text2?.text }),
7082
7174
  /* @__PURE__ */ jsxs22("div", { className: "ds-tour-foot", children: [
7083
7175
  /* @__PURE__ */ jsx30("button", { type: "button", className: "ds-tour-skip", onClick: close, children: "Close" }),
7084
7176
  /* @__PURE__ */ jsx30("span", { className: "ds-filters-spacer" }),
@@ -8240,7 +8332,7 @@ function DashboardBody({
8240
8332
  useCallback9(
8241
8333
  (t) => {
8242
8334
  const sc = rootScope(t, runtime.helpers);
8243
- const text = (v) => {
8335
+ const text2 = (v) => {
8244
8336
  if (!v) return void 0;
8245
8337
  try {
8246
8338
  return String(interpolate(v, sc) ?? "");
@@ -8250,9 +8342,9 @@ function DashboardBody({
8250
8342
  };
8251
8343
  return {
8252
8344
  view: t.view,
8253
- title: text(doc.spec.display.title),
8254
- description: text(doc.spec.display.description),
8255
- synced: text(doc.spec.display.syncedLabel)
8345
+ title: text2(doc.spec.display.title),
8346
+ description: text2(doc.spec.display.description),
8347
+ synced: text2(doc.spec.display.syncedLabel)
8256
8348
  };
8257
8349
  },
8258
8350
  [runtime, doc]
@@ -8290,14 +8382,14 @@ function DashboardBody({
8290
8382
  flowStyle: (id, height) => {
8291
8383
  const panel = doc.spec.panels[id];
8292
8384
  const st = panel?.style;
8293
- const px = (v) => typeof v === "number" ? `${v}px` : v;
8385
+ const px2 = (v) => typeof v === "number" ? `${v}px` : v;
8294
8386
  return {
8295
8387
  flex: st?.flex ?? "1 1 100%",
8296
8388
  // Charts and images size themselves to the card, so their card keeps its grid height; anything
8297
8389
  // else grows to fit its content.
8298
8390
  ...panel && !CONTENT_SIZED.has(panel.kind) ? { height } : {},
8299
- ...st?.minWidth !== void 0 ? { minWidth: px(st.minWidth) } : {},
8300
- ...st?.maxWidth !== void 0 ? { maxWidth: px(st.maxWidth) } : {}
8391
+ ...st?.minWidth !== void 0 ? { minWidth: px2(st.minWidth) } : {},
8392
+ ...st?.maxWidth !== void 0 ? { maxWidth: px2(st.maxWidth) } : {}
8301
8393
  };
8302
8394
  },
8303
8395
  view: head.view,
@@ -8478,6 +8570,7 @@ export {
8478
8570
  panelRows,
8479
8571
  parse,
8480
8572
  parseDuration,
8573
+ partsCss,
8481
8574
  placeholders,
8482
8575
  plantDate,
8483
8576
  plantDayStart,