@dashspec/renderer 0.1.5 → 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.
- package/CHANGELOG.md +25 -1
- package/dist/{chunk-7J6WHLG6.js → chunk-RJI35HZD.js} +2 -2
- package/dist/{chunk-7J6WHLG6.js.map → chunk-RJI35HZD.js.map} +1 -1
- package/dist/{core-B5SCwhPB.d.ts → core-D93t3WCk.d.ts} +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/index.d.ts +58 -3
- package/dist/index.js +243 -169
- package/dist/index.js.map +1 -1
- package/docs/design-systems.md +37 -0
- package/docs/theming.md +22 -0
- package/package.json +1 -1
|
@@ -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.
|
|
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-
|
|
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
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-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;
|
|
@@ -491,6 +510,36 @@ interface UIStateProps {
|
|
|
491
510
|
panel: string;
|
|
492
511
|
message?: string | undefined;
|
|
493
512
|
}
|
|
513
|
+
/** One filter as a custom filter bar sees it: the definition from the document, as written. */
|
|
514
|
+
interface UIFilterDef {
|
|
515
|
+
name: string;
|
|
516
|
+
kind: string;
|
|
517
|
+
label?: string;
|
|
518
|
+
/** The whole `spec.variables` entry (options, presets, default, maxDays, stepper…). */
|
|
519
|
+
config: Record<string, unknown>;
|
|
520
|
+
}
|
|
521
|
+
/** What a custom filter bar (`ui.FilterBar`) receives. */
|
|
522
|
+
interface UIFilterBarProps {
|
|
523
|
+
/** The filters the bar shows now: not hidden, not placed on the canvas, `visibleWhen` true. */
|
|
524
|
+
filters: UIFilterDef[];
|
|
525
|
+
/** Every filter's current value, by name. */
|
|
526
|
+
values: Record<string, unknown>;
|
|
527
|
+
/** Set one filter; every datasource and widget reading it reacts. */
|
|
528
|
+
setFilter: (name: string, value: unknown) => void;
|
|
529
|
+
/** Back to every filter's default. */
|
|
530
|
+
reset: () => void;
|
|
531
|
+
/** True when every filter is at its default. */
|
|
532
|
+
isDefault: boolean;
|
|
533
|
+
/** The dashboard's views (from `layouts`), the current one, and a setter. */
|
|
534
|
+
views: {
|
|
535
|
+
name: string;
|
|
536
|
+
label: string;
|
|
537
|
+
}[];
|
|
538
|
+
view: string | null;
|
|
539
|
+
setView: (view: string) => void;
|
|
540
|
+
/** DashSpec's own control for one filter (with your design system's controls), to reuse inside your bar. */
|
|
541
|
+
renderControl: (name: string) => ReactNode;
|
|
542
|
+
}
|
|
494
543
|
/**
|
|
495
544
|
* Controls DashSpec draws itself (filters, panel controls, empty / error / loading states). A design system can
|
|
496
545
|
* replace any of them; the rest stay DashSpec's own. Each receives the props above and nothing else.
|
|
@@ -506,6 +555,12 @@ interface UIComponents {
|
|
|
506
555
|
EmptyState?: ComponentType<UIStateProps>;
|
|
507
556
|
ErrorState?: ComponentType<UIStateProps>;
|
|
508
557
|
Loading?: ComponentType<UIStateProps>;
|
|
558
|
+
/**
|
|
559
|
+
* Your own whole filter bar, in place of DashSpec's: any layout and design. It gets every filter the bar would
|
|
560
|
+
* show, their values, setters and the views; `renderControl(name)` draws DashSpec's own control for one filter
|
|
561
|
+
* where you want to reuse it. Widgets react to its changes like to the built-in bar.
|
|
562
|
+
*/
|
|
563
|
+
FilterBar?: ComponentType<UIFilterBarProps>;
|
|
509
564
|
/** Controls for your own filter kinds, by namespaced kind: { "acme.ShiftPicker": ShiftPicker }. */
|
|
510
565
|
filters?: Record<string, ComponentType<UICustomFilterProps>>;
|
|
511
566
|
}
|
|
@@ -1444,4 +1499,4 @@ declare function lazyWidget<S extends z.ZodTypeAny>(def: Omit<WidgetDefinition<S
|
|
|
1444
1499
|
fallback?: ReactNode;
|
|
1445
1500
|
}): WidgetDefinition<S>;
|
|
1446
1501
|
|
|
1447
|
-
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 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 };
|