@dashspec/renderer 0.1.6 → 0.1.7

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.
@@ -7481,7 +7481,7 @@ declare class TransformError extends Error {
7481
7481
  declare function applyTransform(data: unknown, steps: readonly Step[], root: Scope, opts?: TransformOptions): unknown;
7482
7482
 
7483
7483
  /** This package's version. A test keeps it equal to package.json's; bump both together. */
7484
- declare const RENDERER_VERSION = "0.1.6";
7484
+ declare const RENDERER_VERSION = "0.1.7";
7485
7485
  /**
7486
7486
  * Whether `version` satisfies `range`. Supports what documents need: "1.2.3" (that or newer within the major, like
7487
7487
  * "^"), ">=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-BnA2w3yb.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-D93t3WCk.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-U4JCC3MX.js";
84
+ } from "./chunk-RJI35HZD.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-BnA2w3yb.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-BnA2w3yb.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-D93t3WCk.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-D93t3WCk.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';
@@ -216,8 +216,19 @@ interface ScaleTokens {
216
216
  fontSize?: number;
217
217
  };
218
218
  }
219
+ /** Per-widget styling in a theme, by widget kind (built-in like "Kpi" or your own like "acme.Gauge"). */
220
+ interface WidgetTheme {
221
+ /** CSS custom properties on every panel of this kind: any `--ds-*` token, or your own variables. */
222
+ vars?: Record<string, string>;
223
+ /** Extra CSS for panels of this kind; `&` is the panel, e.g. `"& .ds-kpi-label { text-transform: uppercase; }"`. */
224
+ css?: string;
225
+ /** Anything else your own widget reads: `useThemeTokens()?.theme.widgets?.["acme.Gauge"]?.settings`. */
226
+ settings?: Record<string, unknown>;
227
+ }
219
228
  interface Theme {
220
229
  name: string;
230
+ /** Per-widget overrides and settings, by widget kind. */
231
+ widgets?: Record<string, WidgetTheme>;
221
232
  /** `auto` follows the viewer's system setting. */
222
233
  mode: ThemeMode | "auto";
223
234
  scale: ScaleTokens;
@@ -253,6 +264,8 @@ interface ThemeInput {
253
264
  scale?: DeepPartial<ScaleTokens>;
254
265
  light?: DeepPartial<ColorTokens>;
255
266
  dark?: DeepPartial<ColorTokens>;
267
+ /** Per-widget overrides and settings, by widget kind (built-in or your own); merged over `extends`. */
268
+ widgets?: Record<string, WidgetTheme>;
256
269
  }
257
270
  /** Deep merge for plain objects; arrays and primitives replace. Never mutates. */
258
271
  declare function mergeDeep<T>(base: T, patch: DeepPartial<NoInfer<T>> | undefined): T;
@@ -270,6 +283,12 @@ declare function themeCssVars(theme: Theme, mode: ThemeMode): Record<string, str
270
283
  * value could break out of the declaration (a host theme built from user input) are left out.
271
284
  */
272
285
  declare function themeStylesheet(theme: Theme, selector?: string): string;
286
+ /**
287
+ * The CSS for a theme's per-widget overrides (`theme.widgets`), scoped under `scope` (a selector for one dashboard
288
+ * root). `vars` become custom properties on `.ds-panel[data-kind="…"]`; `css` is added with `&` as that panel.
289
+ * Unsafe variable names or values are dropped, and `css` can't close the `<style>` element.
290
+ */
291
+ declare function widgetThemeCss(theme: Theme, scope: string): string;
273
292
 
274
293
  /** DashSpec's neutral default. Brand themes made with `createTheme` start from it. */
275
294
  declare const defaultTheme: Theme;
@@ -1480,4 +1499,4 @@ declare function lazyWidget<S extends z.ZodTypeAny>(def: Omit<WidgetDefinition<S
1480
1499
  fallback?: ReactNode;
1481
1500
  }): WidgetDefinition<S>;
1482
1501
 
1483
- export { AnyWidgetDefinition, BAR, BAR_ICONS, type Breakpoint, CallbackApi, type ColorTokens, ControlField, type DashEvent, DashSpecProvider, type DashSpecSettings, Dashboard, DashboardContext, type DashboardHandle, DashboardRenderer, type DashboardRendererProps, type DashboardRuntime, type DatasourceType, DateControl, DateRangeControl, type DeepPartial, type DesignSystem, 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 WrapOptions, builtInWidgets, checkWidget, combineDesignSystems, createDashboardRuntime, createTheme, createWidgetRegistry, defaultTheme, defineDesignSystem, defineWidget, echartsTheme, layoutsForView, lazyWidget, mergeDeep, panelRows, presetRange, resolveMode, themeCssVars, themeStylesheet, timeSettingsFor, useDashSpecSettings, useDashboard, useDashboardActions, useDashboardState, useNodeScope, useThemeTokens, useTree, widgetChecks, wrapComponent };
1502
+ export { AnyWidgetDefinition, BAR, BAR_ICONS, type Breakpoint, CallbackApi, type ColorTokens, ControlField, type DashEvent, DashSpecProvider, type DashSpecSettings, Dashboard, DashboardContext, type DashboardHandle, DashboardRenderer, type DashboardRendererProps, type DashboardRuntime, type DatasourceType, DateControl, DateRangeControl, type DeepPartial, type DesignSystem, 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, defaultTheme, defineDesignSystem, defineWidget, echartsTheme, layoutsForView, lazyWidget, mergeDeep, panelRows, presetRange, resolveMode, themeCssVars, themeStylesheet, timeSettingsFor, useDashSpecSettings, useDashboard, useDashboardActions, useDashboardState, useNodeScope, useThemeTokens, useTree, widgetChecks, widgetThemeCss, wrapComponent };