@richardmcquiston01/dashboard-widgets-toolkit 0.12.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.cjs +951 -370
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +57 -3
- package/dist/core.d.ts +57 -3
- package/dist/core.js +933 -371
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +951 -370
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +933 -371
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +836 -60
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +53 -4
- package/dist/react.d.ts +53 -4
- package/dist/react.js +836 -61
- package/dist/react.js.map +1 -1
- package/dist/{storage-VaaysVnZ.d.cts → storage-_Eb8Y98-.d.cts} +144 -3
- package/dist/{storage-VaaysVnZ.d.ts → storage-_Eb8Y98-.d.ts} +144 -3
- package/dist/styles.css +146 -0
- package/package.json +1 -1
package/dist/core.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as WidgetDefinition, D as DashboardWidget,
|
|
2
|
-
export {
|
|
1
|
+
import { b as WidgetDefinition, D as DashboardWidget, p as WidgetContext, o as ResolveOptions, q as WidgetProviders, r as Result, s as WidgetKind, t as WidgetPayload } from './storage-_Eb8Y98-.cjs';
|
|
2
|
+
export { u as AddPageOptions, v as AlertListItem, A as AlertListWidgetData, w as BarListItem, B as BarListWidgetData, x as BooleanOption, C as CachedPayload, y as ChoiceOption, z as ColorOption, E as ColumnsOption, F as ConflictPolicy, H as DATE_RANGE_PRESETS, I as DEFAULT_COMPARISON_LABEL, J as DEFAULT_CURRENCY, M as DEFAULT_DETAIL_PAGE_SIZE, Q as DEFAULT_EMPTY_TEXT, U as DEFAULT_MAX_LAYOUT_BYTES, V as DEFAULT_PAGE_KEY, X as DEFAULT_PAGE_ROWS, Y as DETAIL_MODES, f as DashboardLayout, Z as DateRangeOption, _ as DateRangePreset, $ as DeltaDirection, a0 as DeltaSentiment, a1 as DetailCell, a2 as DetailColumn, d as DetailData, a3 as DetailMode, a4 as DetailPage, a5 as DetailProvider, c as DetailProviderOptions, a6 as DetailProviders, e as DetailQuery, j as DetailSort, a7 as EMPTY_LAYOUT, a8 as EmptyWidget, a9 as EncodingOptions, aa as EnforceLocksOptions, ab as Err, ac as ErrorWidget, ad as FormatOptions, i as GaugeWidgetData, ae as GraphPoint, af as GraphSeries, G as GraphWidgetData, ag as GridItem, ah as KpiDelta, ai as KpiDeltaOptions, K as KpiWidgetData, aj as LAYOUT_ENVELOPE_VERSION, ak as LayoutItem, al as LayoutPage, m as LayoutPersistence, am as LayoutPersistenceOptions, an as LayoutSettings, ao as LoadedLayout, ap as LoadingWidget, L as Locale, aq as MAX_DETAIL_PAGE_SIZE, ar as MAX_GRAPH_SERIES, as as MAX_PAGE_ROWS, at as MAX_PAGE_TITLE_LENGTH, au as MAX_PARSED_PAGES, av as MAX_PARSED_SETTINGS, aw as MAX_TEXT_OPTION_LENGTH, ax as MAX_WIDGET_OPTIONS, ay as MAX_WIDGET_TITLE_LENGTH, az as MAX_WIDGET_WIDTH, aA as MIN_WIDGET_WIDTH, N as NiceDomain, n as NormalizeOptions, aB as NormalizeSettingsOptions, aC as NumberOption, aD as OPTION_KEY_PATTERN, aE as Ok, aF as OkWidget, aG as OptionContext, aH as OptionValue, O as OptionValues, P as PageItem, aI as PageOptions, aJ as PageRoom, aK as PlacedRow, aL as ProviderOptions, aM as ResolvedDetailOptions, R as ResolvedTableControls, aN as ResolvedWidget, aO as ResolvedWidgetLock, aP as RetryOptions, aQ as SaveOptions, aR as SavedLayout, aS as SettingsItem, aT as SortDirection, aU as SortOption, aV as StorageAdapter, aW as StorageLogEvent, aX as StoreErrorCode, aY as StoreResult, S as StoreScope, aZ as StoredValue, a_ as TableCell, a$ as TableColumn, T as TableWidgetData, b0 as TextOption, k as TextWidgetData, b1 as VALUE_FORMATS, b2 as ValueFormat, b3 as WIDGET_FILLS, b4 as WIDGET_KINDS, b5 as WIDGET_OPTION_TYPES, b6 as WIDGET_SIZES, b7 as WIDTH_COLUMNS, b8 as WidgetCache, l as WidgetData, b9 as WidgetDataOf, ba as WidgetDetailOptions, bb as WidgetEmptyState, a as WidgetFill, bc as WidgetLock, bd as WidgetOption, be as WidgetProvider, h as WidgetSettingsPatch, W as WidgetSize, bf as WidgetStatus, bg as WidgetTableControls, g as WidgetViewerSettings, bh as addPage, bi as applyClientOptions, bj as applySettings, bk as assignPages, bl as baseColumnSpan, bm as cacheKeyFor, bn as clearWidgetSettings, bo as coerceOptionValue, bp as createLayoutPersistence, bq as defaultDetailQuery, br as defaultOptionValue, bs as defineWidget, bt as deriveDetailData, bu as describeUnknownError, bv as effectiveDefinitions, bw as emptyTextFor, bx as emptyWidget, by as enforceLocks, bz as err, bA as failedWidget, bB as fillColumnSpans, bC as fillWidthSpans, bD as fillsHeight, bE as fillsWidth, bF as finalizeWidget, bG as fitCount, bH as formatCount, bI as formatPercentChange, bJ as formatValue, bK as hasPages, bL as hiddenWidgets, bM as hideWidget, bN as isClientApplied, bO as isColumnKeyFor, bP as isFlexible, bQ as isHidden, bR as isIsoInterval, bS as isMinimized, bT as isOptionsLocked, bU as isTitleInUse, bV as isWidgetEmptyState, bW as isWidgetKind, bX as isWidgetVisibleTo, bY as isWidgetWidth, bZ as itemWidth, b_ as kpiDelta, b$ as labelStride, c0 as loadingWidgets, c1 as memoryAdapter, c2 as minimizeWidget, c3 as movePage, c4 as moveWidget, c5 as moveWidgetBy, c6 as moveWidgetDown, c7 as moveWidgetToPage, c8 as moveWidgetUp, c9 as nextPageKey, ca as niceDomain, cb as niceStep, cc as normalizeLayout, cd as normalizeSettings, ce as normalizeTitle, cf as ok, cg as optionValuesFor, ch as optionValuesFromLayout, ci as optionsCacheSuffix, cj as pageLayout, ck as pageList, cl as pageOf, cm as pageRoom, cn as pageWidgets, co as parseDetailQuery, cp as parseLayout, cq as parseSettings, cr as parseSortValue, cs as percentChange, ct as placeRows, cu as pruneLayout, cv as queryRows, cw as readOnly, cx as removePage, cy as renamePage, cz as resolveDateRange, cA as resolveDetailOptions, cB as resolveOptionValues, cC as resolvePageKey, cD as resolvePayload, cE as resolveTableControls, cF as resolveWidget, cG as resolveWidgetLock, cH as resolveWidgetUnapplied, cI as resolveWidgets, cJ as restoreWidget, cK as sameOptionValues, cL as serializeDetailQuery, cM as serializeLayout, cN as serializeSettings, cO as setWidgetSettings, cP as shareOf, cQ as showWidget, cR as sortDefinitions, cS as sortFromOptions, cT as tableDetailData, cU as toggleHidden, cV as toggleMinimized, cW as usesWidthColumns, cX as utf8Length, cY as validateDetailData, cZ as visibleWidgets, c_ as widgetOptionValues, c$ as widgetsFor, d0 as widthForSize, d1 as widthRange, d2 as widthShareLabel, d3 as withEncoding, d4 as withFallback, d5 as withLogging, d6 as withPageLayout, d7 as withPrefix, d8 as withReadCache, d9 as withRetry } from './storage-_Eb8Y98-.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Maker Toolkit compatibility. Its API (`apps/api/src/widgets`) serves
|
|
@@ -87,6 +87,60 @@ interface WidgetLoader {
|
|
|
87
87
|
}
|
|
88
88
|
declare function createWidgetLoader<C extends WidgetContext>(options: WidgetLoaderOptions<C>): WidgetLoader;
|
|
89
89
|
|
|
90
|
+
/**
|
|
91
|
+
* Theming: turns a typed token object into scoped CSS for the `--dwt-*` custom
|
|
92
|
+
* properties. Runtime-neutral: it only builds a string, so a Node API, a build
|
|
93
|
+
* script or an SSR server can produce a theme without React or a DOM.
|
|
94
|
+
*
|
|
95
|
+
* The built-in defaults are declared on `.dwt-dashboard` and `.dwt-card`, so a
|
|
96
|
+
* variable set on an ancestor is shadowed. The generated selectors therefore
|
|
97
|
+
* target those two classes beneath a scope and out-rank the built-in dark rules.
|
|
98
|
+
* See docs/design/theming.md.
|
|
99
|
+
*/
|
|
100
|
+
|
|
101
|
+
type ThemeColorKey = 'surface' | 'page' | 'text' | 'textSecondary' | 'textMuted' | 'border' | 'grid' | 'baseline' | 'crosshair' | 'link' | 'focus' | 'good' | 'bad' | 'meterTrack' | 'barTrack' | 'buttonHover';
|
|
102
|
+
type ThemeLengthKey = 'radius' | 'gap' | 'padding' | 'minColumn';
|
|
103
|
+
type ThemeTokenKey = ThemeColorKey | ThemeLengthKey | 'font';
|
|
104
|
+
/** The CSS custom property each token key sets (series are `--dwt-series-N`). */
|
|
105
|
+
declare const THEME_TOKEN_VARIABLES: Readonly<Record<ThemeTokenKey, string>>;
|
|
106
|
+
type ThemeTokens = {
|
|
107
|
+
readonly [Key in ThemeTokenKey]?: string;
|
|
108
|
+
} & {
|
|
109
|
+
/** Chart colors in order; fills `--dwt-series-1` to `--dwt-series-N`. */
|
|
110
|
+
readonly series?: readonly string[];
|
|
111
|
+
};
|
|
112
|
+
interface ThemeOptions {
|
|
113
|
+
/** Lower-case letters, digits and hyphens, starting with a letter. */
|
|
114
|
+
readonly name: string;
|
|
115
|
+
/**
|
|
116
|
+
* Selector of an ancestor of the dashboard. Defaults to
|
|
117
|
+
* `[data-dwt-theme='<name>']`. Letters, digits, `_ - [ ] = . # ' "` and spaces
|
|
118
|
+
* only.
|
|
119
|
+
*/
|
|
120
|
+
readonly scope?: string;
|
|
121
|
+
/** Applied in light and dark mode. */
|
|
122
|
+
readonly base?: ThemeTokens;
|
|
123
|
+
/** Applied in light mode only; wins over `base`. */
|
|
124
|
+
readonly light?: ThemeTokens;
|
|
125
|
+
/** Applied in dark mode only; wins over `base`. */
|
|
126
|
+
readonly dark?: ThemeTokens;
|
|
127
|
+
}
|
|
128
|
+
type ThemeMode = 'base' | 'light' | 'dark';
|
|
129
|
+
interface WidgetThemeStyles {
|
|
130
|
+
readonly name: string;
|
|
131
|
+
readonly scope: string;
|
|
132
|
+
/** For a `<style>` element or the head of a server-rendered page. */
|
|
133
|
+
readonly css: string;
|
|
134
|
+
/** The resolved custom properties per mode, e.g. `{'--dwt-surface': '#fff'}`. */
|
|
135
|
+
readonly variables: Readonly<Record<ThemeMode, Readonly<Record<string, string>>>>;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Builds the CSS for a theme. Tokens left unset keep their built-in value in
|
|
139
|
+
* each mode. Returns an error naming the mode, the token and the value when
|
|
140
|
+
* anything is invalid.
|
|
141
|
+
*/
|
|
142
|
+
declare function createTheme(options: ThemeOptions): Result<WidgetThemeStyles>;
|
|
143
|
+
|
|
90
144
|
/**
|
|
91
145
|
* Link and image URL checks. Payloads often come from an API, so a link is
|
|
92
146
|
* only rendered when it can't run script: http(s), mailto, or a relative
|
|
@@ -124,4 +178,4 @@ declare function validateWidgetData(value: unknown, options?: ValidateWidgetData
|
|
|
124
178
|
*/
|
|
125
179
|
declare function validateWidgetDefinition(value: unknown): Result<WidgetDefinition>;
|
|
126
180
|
|
|
127
|
-
export { DashboardWidget, type LegacyWidgetDefinition, MAX_REPORTED_PROBLEMS, type RefreshOptions, ResolveOptions, Result, type ValidateWidgetDataOptions, WidgetContext, WidgetDefinition, WidgetKind, type WidgetLoader, type WidgetLoaderOptions, WidgetPayload, WidgetProviders, createWidgetLoader, fromLegacyDefinition, isSafeHref, isSafeImageUrl, upgradeLegacyWidgetData, validateWidgetData, validateWidgetDefinition };
|
|
181
|
+
export { DashboardWidget, type LegacyWidgetDefinition, MAX_REPORTED_PROBLEMS, type RefreshOptions, ResolveOptions, Result, THEME_TOKEN_VARIABLES, type ThemeColorKey, type ThemeLengthKey, type ThemeMode, type ThemeOptions, type ThemeTokenKey, type ThemeTokens, type ValidateWidgetDataOptions, WidgetContext, WidgetDefinition, WidgetKind, type WidgetLoader, type WidgetLoaderOptions, WidgetPayload, WidgetProviders, type WidgetThemeStyles, createTheme, createWidgetLoader, fromLegacyDefinition, isSafeHref, isSafeImageUrl, upgradeLegacyWidgetData, validateWidgetData, validateWidgetDefinition };
|
package/dist/core.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as WidgetDefinition, D as DashboardWidget,
|
|
2
|
-
export {
|
|
1
|
+
import { b as WidgetDefinition, D as DashboardWidget, p as WidgetContext, o as ResolveOptions, q as WidgetProviders, r as Result, s as WidgetKind, t as WidgetPayload } from './storage-_Eb8Y98-.js';
|
|
2
|
+
export { u as AddPageOptions, v as AlertListItem, A as AlertListWidgetData, w as BarListItem, B as BarListWidgetData, x as BooleanOption, C as CachedPayload, y as ChoiceOption, z as ColorOption, E as ColumnsOption, F as ConflictPolicy, H as DATE_RANGE_PRESETS, I as DEFAULT_COMPARISON_LABEL, J as DEFAULT_CURRENCY, M as DEFAULT_DETAIL_PAGE_SIZE, Q as DEFAULT_EMPTY_TEXT, U as DEFAULT_MAX_LAYOUT_BYTES, V as DEFAULT_PAGE_KEY, X as DEFAULT_PAGE_ROWS, Y as DETAIL_MODES, f as DashboardLayout, Z as DateRangeOption, _ as DateRangePreset, $ as DeltaDirection, a0 as DeltaSentiment, a1 as DetailCell, a2 as DetailColumn, d as DetailData, a3 as DetailMode, a4 as DetailPage, a5 as DetailProvider, c as DetailProviderOptions, a6 as DetailProviders, e as DetailQuery, j as DetailSort, a7 as EMPTY_LAYOUT, a8 as EmptyWidget, a9 as EncodingOptions, aa as EnforceLocksOptions, ab as Err, ac as ErrorWidget, ad as FormatOptions, i as GaugeWidgetData, ae as GraphPoint, af as GraphSeries, G as GraphWidgetData, ag as GridItem, ah as KpiDelta, ai as KpiDeltaOptions, K as KpiWidgetData, aj as LAYOUT_ENVELOPE_VERSION, ak as LayoutItem, al as LayoutPage, m as LayoutPersistence, am as LayoutPersistenceOptions, an as LayoutSettings, ao as LoadedLayout, ap as LoadingWidget, L as Locale, aq as MAX_DETAIL_PAGE_SIZE, ar as MAX_GRAPH_SERIES, as as MAX_PAGE_ROWS, at as MAX_PAGE_TITLE_LENGTH, au as MAX_PARSED_PAGES, av as MAX_PARSED_SETTINGS, aw as MAX_TEXT_OPTION_LENGTH, ax as MAX_WIDGET_OPTIONS, ay as MAX_WIDGET_TITLE_LENGTH, az as MAX_WIDGET_WIDTH, aA as MIN_WIDGET_WIDTH, N as NiceDomain, n as NormalizeOptions, aB as NormalizeSettingsOptions, aC as NumberOption, aD as OPTION_KEY_PATTERN, aE as Ok, aF as OkWidget, aG as OptionContext, aH as OptionValue, O as OptionValues, P as PageItem, aI as PageOptions, aJ as PageRoom, aK as PlacedRow, aL as ProviderOptions, aM as ResolvedDetailOptions, R as ResolvedTableControls, aN as ResolvedWidget, aO as ResolvedWidgetLock, aP as RetryOptions, aQ as SaveOptions, aR as SavedLayout, aS as SettingsItem, aT as SortDirection, aU as SortOption, aV as StorageAdapter, aW as StorageLogEvent, aX as StoreErrorCode, aY as StoreResult, S as StoreScope, aZ as StoredValue, a_ as TableCell, a$ as TableColumn, T as TableWidgetData, b0 as TextOption, k as TextWidgetData, b1 as VALUE_FORMATS, b2 as ValueFormat, b3 as WIDGET_FILLS, b4 as WIDGET_KINDS, b5 as WIDGET_OPTION_TYPES, b6 as WIDGET_SIZES, b7 as WIDTH_COLUMNS, b8 as WidgetCache, l as WidgetData, b9 as WidgetDataOf, ba as WidgetDetailOptions, bb as WidgetEmptyState, a as WidgetFill, bc as WidgetLock, bd as WidgetOption, be as WidgetProvider, h as WidgetSettingsPatch, W as WidgetSize, bf as WidgetStatus, bg as WidgetTableControls, g as WidgetViewerSettings, bh as addPage, bi as applyClientOptions, bj as applySettings, bk as assignPages, bl as baseColumnSpan, bm as cacheKeyFor, bn as clearWidgetSettings, bo as coerceOptionValue, bp as createLayoutPersistence, bq as defaultDetailQuery, br as defaultOptionValue, bs as defineWidget, bt as deriveDetailData, bu as describeUnknownError, bv as effectiveDefinitions, bw as emptyTextFor, bx as emptyWidget, by as enforceLocks, bz as err, bA as failedWidget, bB as fillColumnSpans, bC as fillWidthSpans, bD as fillsHeight, bE as fillsWidth, bF as finalizeWidget, bG as fitCount, bH as formatCount, bI as formatPercentChange, bJ as formatValue, bK as hasPages, bL as hiddenWidgets, bM as hideWidget, bN as isClientApplied, bO as isColumnKeyFor, bP as isFlexible, bQ as isHidden, bR as isIsoInterval, bS as isMinimized, bT as isOptionsLocked, bU as isTitleInUse, bV as isWidgetEmptyState, bW as isWidgetKind, bX as isWidgetVisibleTo, bY as isWidgetWidth, bZ as itemWidth, b_ as kpiDelta, b$ as labelStride, c0 as loadingWidgets, c1 as memoryAdapter, c2 as minimizeWidget, c3 as movePage, c4 as moveWidget, c5 as moveWidgetBy, c6 as moveWidgetDown, c7 as moveWidgetToPage, c8 as moveWidgetUp, c9 as nextPageKey, ca as niceDomain, cb as niceStep, cc as normalizeLayout, cd as normalizeSettings, ce as normalizeTitle, cf as ok, cg as optionValuesFor, ch as optionValuesFromLayout, ci as optionsCacheSuffix, cj as pageLayout, ck as pageList, cl as pageOf, cm as pageRoom, cn as pageWidgets, co as parseDetailQuery, cp as parseLayout, cq as parseSettings, cr as parseSortValue, cs as percentChange, ct as placeRows, cu as pruneLayout, cv as queryRows, cw as readOnly, cx as removePage, cy as renamePage, cz as resolveDateRange, cA as resolveDetailOptions, cB as resolveOptionValues, cC as resolvePageKey, cD as resolvePayload, cE as resolveTableControls, cF as resolveWidget, cG as resolveWidgetLock, cH as resolveWidgetUnapplied, cI as resolveWidgets, cJ as restoreWidget, cK as sameOptionValues, cL as serializeDetailQuery, cM as serializeLayout, cN as serializeSettings, cO as setWidgetSettings, cP as shareOf, cQ as showWidget, cR as sortDefinitions, cS as sortFromOptions, cT as tableDetailData, cU as toggleHidden, cV as toggleMinimized, cW as usesWidthColumns, cX as utf8Length, cY as validateDetailData, cZ as visibleWidgets, c_ as widgetOptionValues, c$ as widgetsFor, d0 as widthForSize, d1 as widthRange, d2 as widthShareLabel, d3 as withEncoding, d4 as withFallback, d5 as withLogging, d6 as withPageLayout, d7 as withPrefix, d8 as withReadCache, d9 as withRetry } from './storage-_Eb8Y98-.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Maker Toolkit compatibility. Its API (`apps/api/src/widgets`) serves
|
|
@@ -87,6 +87,60 @@ interface WidgetLoader {
|
|
|
87
87
|
}
|
|
88
88
|
declare function createWidgetLoader<C extends WidgetContext>(options: WidgetLoaderOptions<C>): WidgetLoader;
|
|
89
89
|
|
|
90
|
+
/**
|
|
91
|
+
* Theming: turns a typed token object into scoped CSS for the `--dwt-*` custom
|
|
92
|
+
* properties. Runtime-neutral: it only builds a string, so a Node API, a build
|
|
93
|
+
* script or an SSR server can produce a theme without React or a DOM.
|
|
94
|
+
*
|
|
95
|
+
* The built-in defaults are declared on `.dwt-dashboard` and `.dwt-card`, so a
|
|
96
|
+
* variable set on an ancestor is shadowed. The generated selectors therefore
|
|
97
|
+
* target those two classes beneath a scope and out-rank the built-in dark rules.
|
|
98
|
+
* See docs/design/theming.md.
|
|
99
|
+
*/
|
|
100
|
+
|
|
101
|
+
type ThemeColorKey = 'surface' | 'page' | 'text' | 'textSecondary' | 'textMuted' | 'border' | 'grid' | 'baseline' | 'crosshair' | 'link' | 'focus' | 'good' | 'bad' | 'meterTrack' | 'barTrack' | 'buttonHover';
|
|
102
|
+
type ThemeLengthKey = 'radius' | 'gap' | 'padding' | 'minColumn';
|
|
103
|
+
type ThemeTokenKey = ThemeColorKey | ThemeLengthKey | 'font';
|
|
104
|
+
/** The CSS custom property each token key sets (series are `--dwt-series-N`). */
|
|
105
|
+
declare const THEME_TOKEN_VARIABLES: Readonly<Record<ThemeTokenKey, string>>;
|
|
106
|
+
type ThemeTokens = {
|
|
107
|
+
readonly [Key in ThemeTokenKey]?: string;
|
|
108
|
+
} & {
|
|
109
|
+
/** Chart colors in order; fills `--dwt-series-1` to `--dwt-series-N`. */
|
|
110
|
+
readonly series?: readonly string[];
|
|
111
|
+
};
|
|
112
|
+
interface ThemeOptions {
|
|
113
|
+
/** Lower-case letters, digits and hyphens, starting with a letter. */
|
|
114
|
+
readonly name: string;
|
|
115
|
+
/**
|
|
116
|
+
* Selector of an ancestor of the dashboard. Defaults to
|
|
117
|
+
* `[data-dwt-theme='<name>']`. Letters, digits, `_ - [ ] = . # ' "` and spaces
|
|
118
|
+
* only.
|
|
119
|
+
*/
|
|
120
|
+
readonly scope?: string;
|
|
121
|
+
/** Applied in light and dark mode. */
|
|
122
|
+
readonly base?: ThemeTokens;
|
|
123
|
+
/** Applied in light mode only; wins over `base`. */
|
|
124
|
+
readonly light?: ThemeTokens;
|
|
125
|
+
/** Applied in dark mode only; wins over `base`. */
|
|
126
|
+
readonly dark?: ThemeTokens;
|
|
127
|
+
}
|
|
128
|
+
type ThemeMode = 'base' | 'light' | 'dark';
|
|
129
|
+
interface WidgetThemeStyles {
|
|
130
|
+
readonly name: string;
|
|
131
|
+
readonly scope: string;
|
|
132
|
+
/** For a `<style>` element or the head of a server-rendered page. */
|
|
133
|
+
readonly css: string;
|
|
134
|
+
/** The resolved custom properties per mode, e.g. `{'--dwt-surface': '#fff'}`. */
|
|
135
|
+
readonly variables: Readonly<Record<ThemeMode, Readonly<Record<string, string>>>>;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Builds the CSS for a theme. Tokens left unset keep their built-in value in
|
|
139
|
+
* each mode. Returns an error naming the mode, the token and the value when
|
|
140
|
+
* anything is invalid.
|
|
141
|
+
*/
|
|
142
|
+
declare function createTheme(options: ThemeOptions): Result<WidgetThemeStyles>;
|
|
143
|
+
|
|
90
144
|
/**
|
|
91
145
|
* Link and image URL checks. Payloads often come from an API, so a link is
|
|
92
146
|
* only rendered when it can't run script: http(s), mailto, or a relative
|
|
@@ -124,4 +178,4 @@ declare function validateWidgetData(value: unknown, options?: ValidateWidgetData
|
|
|
124
178
|
*/
|
|
125
179
|
declare function validateWidgetDefinition(value: unknown): Result<WidgetDefinition>;
|
|
126
180
|
|
|
127
|
-
export { DashboardWidget, type LegacyWidgetDefinition, MAX_REPORTED_PROBLEMS, type RefreshOptions, ResolveOptions, Result, type ValidateWidgetDataOptions, WidgetContext, WidgetDefinition, WidgetKind, type WidgetLoader, type WidgetLoaderOptions, WidgetPayload, WidgetProviders, createWidgetLoader, fromLegacyDefinition, isSafeHref, isSafeImageUrl, upgradeLegacyWidgetData, validateWidgetData, validateWidgetDefinition };
|
|
181
|
+
export { DashboardWidget, type LegacyWidgetDefinition, MAX_REPORTED_PROBLEMS, type RefreshOptions, ResolveOptions, Result, THEME_TOKEN_VARIABLES, type ThemeColorKey, type ThemeLengthKey, type ThemeMode, type ThemeOptions, type ThemeTokenKey, type ThemeTokens, type ValidateWidgetDataOptions, WidgetContext, WidgetDefinition, WidgetKind, type WidgetLoader, type WidgetLoaderOptions, WidgetPayload, WidgetProviders, type WidgetThemeStyles, createTheme, createWidgetLoader, fromLegacyDefinition, isSafeHref, isSafeImageUrl, upgradeLegacyWidgetData, validateWidgetData, validateWidgetDefinition };
|