@richardmcquiston01/dashboard-widgets-toolkit 0.14.0 → 0.15.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/index.d.cts CHANGED
@@ -1,2 +1,2 @@
1
1
  export { LegacyWidgetDefinition, MAX_REPORTED_PROBLEMS, RefreshOptions, THEME_TOKEN_VARIABLES, ThemeColorKey, ThemeLengthKey, ThemeMode, ThemeOptions, ThemeTokenKey, ThemeTokens, ValidateWidgetDataOptions, WidgetLoader, WidgetLoaderOptions, WidgetThemeStyles, createTheme, createWidgetLoader, fromLegacyDefinition, isSafeHref, isSafeImageUrl, upgradeLegacyWidgetData, validateWidgetData, validateWidgetDefinition } from './core.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, D as DashboardWidget, 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, o as ResolveOptions, aM as ResolvedDetailOptions, R as ResolvedTableControls, aN as ResolvedWidget, aO as ResolvedWidgetLock, r as Result, 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, p as WidgetContext, l as WidgetData, b9 as WidgetDataOf, b as WidgetDefinition, ba as WidgetDetailOptions, bb as WidgetEmptyState, a as WidgetFill, s as WidgetKind, bc as WidgetLock, bd as WidgetOption, t as WidgetPayload, be as WidgetProvider, q as WidgetProviders, 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';
2
+ export { u as AddPageOptions, v as AlertListItem, A as AlertListWidgetData, w as BASE_VIEW_KEY, x as BarListItem, B as BarListWidgetData, y as BooleanOption, C as CachedPayload, z as ChoiceOption, E as ColorOption, F as ColumnsOption, H as ConflictPolicy, I as ConvertViewOptions, J as DATE_RANGE_PRESETS, M as DEFAULT_COMPARISON_LABEL, Q as DEFAULT_CURRENCY, U as DEFAULT_DETAIL_PAGE_SIZE, V as DEFAULT_EMPTY_TEXT, X as DEFAULT_MAX_LAYOUT_BYTES, Y as DEFAULT_PAGE_KEY, Z as DEFAULT_PAGE_ROWS, _ as DETAIL_MODES, f as DashboardLayout, D as DashboardWidget, $ as DateRangeOption, a0 as DateRangePreset, a1 as DeltaDirection, a2 as DeltaSentiment, a3 as DetailCell, a4 as DetailColumn, d as DetailData, a5 as DetailMode, a6 as DetailPage, a7 as DetailProvider, c as DetailProviderOptions, a8 as DetailProviders, e as DetailQuery, j as DetailSort, a9 as EMPTY_LAYOUT, aa as EmptyWidget, ab as EncodingOptions, ac as EnforceLocksOptions, ad as Err, ae as ErrorWidget, af as FormatOptions, i as GaugeWidgetData, ag as GraphPoint, ah as GraphSeries, G as GraphWidgetData, ai as GridItem, aj as KpiDelta, ak as KpiDeltaOptions, K as KpiWidgetData, al as LAYOUT_ENVELOPE_VERSION, am as LayoutItem, an as LayoutPage, m as LayoutPersistence, ao as LayoutPersistenceOptions, ap as LayoutSettings, aq as LoadedLayout, ar as LoadingWidget, L as Locale, as as MAX_DETAIL_PAGE_SIZE, at as MAX_GRAPH_SERIES, au as MAX_PAGE_ROWS, av as MAX_PAGE_TITLE_LENGTH, aw as MAX_PARSED_PAGES, ax as MAX_PARSED_SETTINGS, ay as MAX_TEXT_OPTION_LENGTH, az as MAX_WIDGET_OPTIONS, aA as MAX_WIDGET_TITLE_LENGTH, aB as MAX_WIDGET_VIEWS, aC as MAX_WIDGET_WIDTH, aD as MIN_WIDGET_WIDTH, N as NiceDomain, n as NormalizeOptions, aE as NormalizeSettingsOptions, aF as NumberOption, aG as OPTION_KEY_PATTERN, aH as Ok, aI as OkWidget, aJ as OptionContext, aK as OptionValue, O as OptionValues, P as PageItem, aL as PageOptions, aM as PageRoom, aN as PlacedRow, aO as ProviderOptions, o as ResolveOptions, aP as ResolvedDetailOptions, R as ResolvedTableControls, aQ as ResolvedWidget, aR as ResolvedWidgetLock, r as Result, aS as RetryOptions, aT as SaveOptions, aU as SavedLayout, aV as SettingsItem, aW as SortDirection, aX as SortOption, aY as StorageAdapter, aZ as StorageLogEvent, a_ as StoreErrorCode, a$ as StoreResult, S as StoreScope, b0 as StoredValue, b1 as TableCell, b2 as TableColumn, T as TableWidgetData, b3 as TextOption, k as TextWidgetData, b4 as VALUE_FORMATS, b5 as VIEW_CONVERSIONS, b6 as ValueFormat, b7 as ViewConversion, b8 as ViewsItem, b9 as WIDGET_FILLS, ba as WIDGET_KINDS, bb as WIDGET_OPTION_TYPES, bc as WIDGET_SIZES, bd as WIDTH_COLUMNS, be as WidgetCache, p as WidgetContext, l as WidgetData, bf as WidgetDataOf, b as WidgetDefinition, bg as WidgetDetailOptions, bh as WidgetEmptyState, a as WidgetFill, s as WidgetKind, bi as WidgetLock, bj as WidgetOption, t as WidgetPayload, bk as WidgetProvider, q as WidgetProviders, h as WidgetSettingsPatch, W as WidgetSize, bl as WidgetStatus, bm as WidgetTableControls, bn as WidgetView, g as WidgetViewerSettings, bo as addPage, bp as applyClientOptions, bq as applySettings, br as applyView, bs as assignPages, bt as baseColumnSpan, bu as cacheKeyFor, bv as clearWidgetSettings, bw as coerceOptionValue, bx as convertView, by as createLayoutPersistence, bz as defaultDetailQuery, bA as defaultOptionValue, bB as defineWidget, bC as deriveDetailData, bD as describeUnknownError, bE as effectiveDefinitions, bF as effectiveViewKey, bG as emptyTextFor, bH as emptyWidget, bI as enforceLocks, bJ as err, bK as failedWidget, bL as fillColumnSpans, bM as fillWidthSpans, bN as fillsHeight, bO as fillsWidth, bP as finalizeWidget, bQ as findView, bR as fitCount, bS as formatCount, bT as formatPercentChange, bU as formatValue, bV as hasPages, bW as hasViews, bX as hiddenWidgets, bY as hideWidget, bZ as isClientApplied, b_ as isColumnKeyFor, b$ as isFlexible, c0 as isHidden, c1 as isIsoInterval, c2 as isMinimized, c3 as isOptionsLocked, c4 as isTitleInUse, c5 as isWidgetEmptyState, c6 as isWidgetKind, c7 as isWidgetVisibleTo, c8 as isWidgetWidth, c9 as itemWidth, ca as kindLabel, cb as kpiDelta, cc as labelStride, cd as loadingWidgets, ce as memoryAdapter, cf as minimizeWidget, cg as movePage, ch as moveWidget, ci as moveWidgetBy, cj as moveWidgetDown, ck as moveWidgetToPage, cl as moveWidgetUp, cm as nextPageKey, cn as niceDomain, co as niceStep, cp as normalizeLayout, cq as normalizeSettings, cr as normalizeTitle, cs as ok, ct as optionValuesFor, cu as optionValuesFromLayout, cv as optionsCacheSuffix, cw as pageLayout, cx as pageList, cy as pageOf, cz as pageRoom, cA as pageWidgets, cB as parseDetailQuery, cC as parseLayout, cD as parseSettings, cE as parseSortValue, cF as percentChange, cG as placeRows, cH as pruneLayout, cI as queryRows, cJ as readOnly, cK as removePage, cL as renamePage, cM as resolveDateRange, cN as resolveDetailOptions, cO as resolveOptionValues, cP as resolvePageKey, cQ as resolvePayload, cR as resolveTableControls, cS as resolveWidget, cT as resolveWidgetLock, cU as resolveWidgetUnapplied, cV as resolveWidgets, cW as restoreWidget, cX as sameOptionValues, cY as serializeDetailQuery, cZ as serializeLayout, c_ as serializeSettings, c$ as setWidgetSettings, d0 as shareOf, d1 as showWidget, d2 as sortDefinitions, d3 as sortFromOptions, d4 as tableDetailData, d5 as toggleHidden, d6 as toggleMinimized, d7 as usesWidthColumns, d8 as utf8Length, d9 as validateDetailData, da as viewChoices, db as viewKind, dc as viewNote, dd as visibleWidgets, de as widgetOptionValues, df as widgetsFor, dg as widthForSize, dh as widthRange, di as widthShareLabel, dj as withEncoding, dk as withFallback, dl as withLogging, dm as withPageLayout, dn as withPrefix, dp as withReadCache, dq as withRetry } from './storage-DwJ-vGJg.cjs';
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export { LegacyWidgetDefinition, MAX_REPORTED_PROBLEMS, RefreshOptions, THEME_TOKEN_VARIABLES, ThemeColorKey, ThemeLengthKey, ThemeMode, ThemeOptions, ThemeTokenKey, ThemeTokens, ValidateWidgetDataOptions, WidgetLoader, WidgetLoaderOptions, WidgetThemeStyles, createTheme, createWidgetLoader, fromLegacyDefinition, isSafeHref, isSafeImageUrl, upgradeLegacyWidgetData, validateWidgetData, validateWidgetDefinition } from './core.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, D as DashboardWidget, 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, o as ResolveOptions, aM as ResolvedDetailOptions, R as ResolvedTableControls, aN as ResolvedWidget, aO as ResolvedWidgetLock, r as Result, 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, p as WidgetContext, l as WidgetData, b9 as WidgetDataOf, b as WidgetDefinition, ba as WidgetDetailOptions, bb as WidgetEmptyState, a as WidgetFill, s as WidgetKind, bc as WidgetLock, bd as WidgetOption, t as WidgetPayload, be as WidgetProvider, q as WidgetProviders, 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';
2
+ export { u as AddPageOptions, v as AlertListItem, A as AlertListWidgetData, w as BASE_VIEW_KEY, x as BarListItem, B as BarListWidgetData, y as BooleanOption, C as CachedPayload, z as ChoiceOption, E as ColorOption, F as ColumnsOption, H as ConflictPolicy, I as ConvertViewOptions, J as DATE_RANGE_PRESETS, M as DEFAULT_COMPARISON_LABEL, Q as DEFAULT_CURRENCY, U as DEFAULT_DETAIL_PAGE_SIZE, V as DEFAULT_EMPTY_TEXT, X as DEFAULT_MAX_LAYOUT_BYTES, Y as DEFAULT_PAGE_KEY, Z as DEFAULT_PAGE_ROWS, _ as DETAIL_MODES, f as DashboardLayout, D as DashboardWidget, $ as DateRangeOption, a0 as DateRangePreset, a1 as DeltaDirection, a2 as DeltaSentiment, a3 as DetailCell, a4 as DetailColumn, d as DetailData, a5 as DetailMode, a6 as DetailPage, a7 as DetailProvider, c as DetailProviderOptions, a8 as DetailProviders, e as DetailQuery, j as DetailSort, a9 as EMPTY_LAYOUT, aa as EmptyWidget, ab as EncodingOptions, ac as EnforceLocksOptions, ad as Err, ae as ErrorWidget, af as FormatOptions, i as GaugeWidgetData, ag as GraphPoint, ah as GraphSeries, G as GraphWidgetData, ai as GridItem, aj as KpiDelta, ak as KpiDeltaOptions, K as KpiWidgetData, al as LAYOUT_ENVELOPE_VERSION, am as LayoutItem, an as LayoutPage, m as LayoutPersistence, ao as LayoutPersistenceOptions, ap as LayoutSettings, aq as LoadedLayout, ar as LoadingWidget, L as Locale, as as MAX_DETAIL_PAGE_SIZE, at as MAX_GRAPH_SERIES, au as MAX_PAGE_ROWS, av as MAX_PAGE_TITLE_LENGTH, aw as MAX_PARSED_PAGES, ax as MAX_PARSED_SETTINGS, ay as MAX_TEXT_OPTION_LENGTH, az as MAX_WIDGET_OPTIONS, aA as MAX_WIDGET_TITLE_LENGTH, aB as MAX_WIDGET_VIEWS, aC as MAX_WIDGET_WIDTH, aD as MIN_WIDGET_WIDTH, N as NiceDomain, n as NormalizeOptions, aE as NormalizeSettingsOptions, aF as NumberOption, aG as OPTION_KEY_PATTERN, aH as Ok, aI as OkWidget, aJ as OptionContext, aK as OptionValue, O as OptionValues, P as PageItem, aL as PageOptions, aM as PageRoom, aN as PlacedRow, aO as ProviderOptions, o as ResolveOptions, aP as ResolvedDetailOptions, R as ResolvedTableControls, aQ as ResolvedWidget, aR as ResolvedWidgetLock, r as Result, aS as RetryOptions, aT as SaveOptions, aU as SavedLayout, aV as SettingsItem, aW as SortDirection, aX as SortOption, aY as StorageAdapter, aZ as StorageLogEvent, a_ as StoreErrorCode, a$ as StoreResult, S as StoreScope, b0 as StoredValue, b1 as TableCell, b2 as TableColumn, T as TableWidgetData, b3 as TextOption, k as TextWidgetData, b4 as VALUE_FORMATS, b5 as VIEW_CONVERSIONS, b6 as ValueFormat, b7 as ViewConversion, b8 as ViewsItem, b9 as WIDGET_FILLS, ba as WIDGET_KINDS, bb as WIDGET_OPTION_TYPES, bc as WIDGET_SIZES, bd as WIDTH_COLUMNS, be as WidgetCache, p as WidgetContext, l as WidgetData, bf as WidgetDataOf, b as WidgetDefinition, bg as WidgetDetailOptions, bh as WidgetEmptyState, a as WidgetFill, s as WidgetKind, bi as WidgetLock, bj as WidgetOption, t as WidgetPayload, bk as WidgetProvider, q as WidgetProviders, h as WidgetSettingsPatch, W as WidgetSize, bl as WidgetStatus, bm as WidgetTableControls, bn as WidgetView, g as WidgetViewerSettings, bo as addPage, bp as applyClientOptions, bq as applySettings, br as applyView, bs as assignPages, bt as baseColumnSpan, bu as cacheKeyFor, bv as clearWidgetSettings, bw as coerceOptionValue, bx as convertView, by as createLayoutPersistence, bz as defaultDetailQuery, bA as defaultOptionValue, bB as defineWidget, bC as deriveDetailData, bD as describeUnknownError, bE as effectiveDefinitions, bF as effectiveViewKey, bG as emptyTextFor, bH as emptyWidget, bI as enforceLocks, bJ as err, bK as failedWidget, bL as fillColumnSpans, bM as fillWidthSpans, bN as fillsHeight, bO as fillsWidth, bP as finalizeWidget, bQ as findView, bR as fitCount, bS as formatCount, bT as formatPercentChange, bU as formatValue, bV as hasPages, bW as hasViews, bX as hiddenWidgets, bY as hideWidget, bZ as isClientApplied, b_ as isColumnKeyFor, b$ as isFlexible, c0 as isHidden, c1 as isIsoInterval, c2 as isMinimized, c3 as isOptionsLocked, c4 as isTitleInUse, c5 as isWidgetEmptyState, c6 as isWidgetKind, c7 as isWidgetVisibleTo, c8 as isWidgetWidth, c9 as itemWidth, ca as kindLabel, cb as kpiDelta, cc as labelStride, cd as loadingWidgets, ce as memoryAdapter, cf as minimizeWidget, cg as movePage, ch as moveWidget, ci as moveWidgetBy, cj as moveWidgetDown, ck as moveWidgetToPage, cl as moveWidgetUp, cm as nextPageKey, cn as niceDomain, co as niceStep, cp as normalizeLayout, cq as normalizeSettings, cr as normalizeTitle, cs as ok, ct as optionValuesFor, cu as optionValuesFromLayout, cv as optionsCacheSuffix, cw as pageLayout, cx as pageList, cy as pageOf, cz as pageRoom, cA as pageWidgets, cB as parseDetailQuery, cC as parseLayout, cD as parseSettings, cE as parseSortValue, cF as percentChange, cG as placeRows, cH as pruneLayout, cI as queryRows, cJ as readOnly, cK as removePage, cL as renamePage, cM as resolveDateRange, cN as resolveDetailOptions, cO as resolveOptionValues, cP as resolvePageKey, cQ as resolvePayload, cR as resolveTableControls, cS as resolveWidget, cT as resolveWidgetLock, cU as resolveWidgetUnapplied, cV as resolveWidgets, cW as restoreWidget, cX as sameOptionValues, cY as serializeDetailQuery, cZ as serializeLayout, c_ as serializeSettings, c$ as setWidgetSettings, d0 as shareOf, d1 as showWidget, d2 as sortDefinitions, d3 as sortFromOptions, d4 as tableDetailData, d5 as toggleHidden, d6 as toggleMinimized, d7 as usesWidthColumns, d8 as utf8Length, d9 as validateDetailData, da as viewChoices, db as viewKind, dc as viewNote, dd as visibleWidgets, de as widgetOptionValues, df as widgetsFor, dg as widthForSize, dh as widthRange, di as widthShareLabel, dj as withEncoding, dk as withFallback, dl as withLogging, dm as withPageLayout, dn as withPrefix, dp as withReadCache, dq as withRetry } from './storage-DwJ-vGJg.js';
package/dist/index.js CHANGED
@@ -686,6 +686,263 @@ function placeAndFillRows(items, columns, spanOf) {
686
686
  return { spans, rows };
687
687
  }
688
688
 
689
+ // src/core/views.ts
690
+ var BASE_VIEW_KEY = "base";
691
+ var MAX_WIDGET_VIEWS = 8;
692
+ var VIEW_CONVERSIONS = {
693
+ tableToBarList: { from: "TABLE", to: "BAR_LIST" },
694
+ tableToGraph: { from: "TABLE", to: "GRAPH" },
695
+ barListToTable: { from: "BAR_LIST", to: "TABLE" },
696
+ graphToTable: { from: "GRAPH", to: "TABLE" },
697
+ barListToGraph: { from: "BAR_LIST", to: "GRAPH" }
698
+ };
699
+ var KIND_LABELS = {
700
+ TEXT: "Text",
701
+ KPI: "Number",
702
+ GAUGE: "Gauge",
703
+ TABLE: "Table",
704
+ BAR_LIST: "Bars",
705
+ ALERT_LIST: "List",
706
+ GRAPH: "Chart"
707
+ };
708
+ function kindLabel(kind) {
709
+ return KIND_LABELS[kind];
710
+ }
711
+ function hasViews(item) {
712
+ return item.views !== void 0 && item.views.length > 0;
713
+ }
714
+ function findView(item, key) {
715
+ return item.views?.find((view) => view.key === key);
716
+ }
717
+ function viewChoices(item) {
718
+ if (!hasViews(item)) return [];
719
+ return [
720
+ {
721
+ key: BASE_VIEW_KEY,
722
+ label: item.baseViewLabel ?? kindLabel(item.kind),
723
+ kind: item.kind
724
+ },
725
+ ...(item.views ?? []).map(({ key, label, kind }) => ({
726
+ key,
727
+ label,
728
+ kind
729
+ }))
730
+ ];
731
+ }
732
+ function isKnownView(item, key) {
733
+ return key !== void 0 && (key === BASE_VIEW_KEY || findView(item, key) !== void 0);
734
+ }
735
+ function effectiveViewKey(item, chosen) {
736
+ if (!hasViews(item)) return BASE_VIEW_KEY;
737
+ if (isKnownView(item, chosen)) return chosen;
738
+ if (isKnownView(item, item.defaultView)) return item.defaultView;
739
+ return BASE_VIEW_KEY;
740
+ }
741
+ function viewKind(item, chosen) {
742
+ return findView(item, effectiveViewKey(item, chosen))?.kind ?? item.kind;
743
+ }
744
+ function cellValue2(cell) {
745
+ const value = cell?.value;
746
+ return typeof value === "number" && Number.isFinite(value) ? value : void 0;
747
+ }
748
+ function columnName(table, index) {
749
+ return table.columns[index]?.label ?? `#${index + 1}`;
750
+ }
751
+ function checkColumn(table, index, field, context) {
752
+ if (!Number.isInteger(index) || index < 0 || index >= table.columns.length) {
753
+ return `${context.where}: ${field} column ${index} does not exist (the table has ${table.columns.length} columns, numbered from 0).`;
754
+ }
755
+ return void 0;
756
+ }
757
+ function numericColumn(table, index, context) {
758
+ const numbers = [];
759
+ for (const [rowIndex, row] of table.rows.entries()) {
760
+ const value = cellValue2(row[index]);
761
+ if (value === void 0) {
762
+ return err(
763
+ `${context.where}: row ${rowIndex + 1}, column ${index + 1} ("${columnName(table, index)}") has no numeric value. Add value to the cells.`
764
+ );
765
+ }
766
+ numbers.push(value);
767
+ }
768
+ return ok(numbers);
769
+ }
770
+ function tableToBarList(table, conversion, context) {
771
+ const bad = checkColumn(table, conversion.label, "label", context) ?? checkColumn(table, conversion.value, "value", context);
772
+ if (bad !== void 0) return err(bad);
773
+ const numbers = numericColumn(table, conversion.value, context);
774
+ if (!numbers.ok) return numbers;
775
+ const items = table.rows.map((row, index) => ({
776
+ label: row[conversion.label]?.text ?? "",
777
+ value: numbers.value[index],
778
+ display: row[conversion.value]?.text ?? String(numbers.value[index])
779
+ }));
780
+ return ok({ kind: "BAR_LIST", items });
781
+ }
782
+ function tableToGraph(table, conversion, context) {
783
+ if (conversion.values.length === 0 || conversion.values.length > MAX_GRAPH_SERIES) {
784
+ return err(
785
+ `${context.where}: a chart needs 1 to ${MAX_GRAPH_SERIES} series columns, got ${conversion.values.length}.`
786
+ );
787
+ }
788
+ let bad = checkColumn(
789
+ table,
790
+ conversion.label,
791
+ "label",
792
+ context
793
+ );
794
+ for (const index of conversion.values) {
795
+ bad ??= checkColumn(table, index, "series", context);
796
+ }
797
+ if (bad !== void 0) return err(bad);
798
+ const series = [];
799
+ for (const index of conversion.values) {
800
+ const numbers = numericColumn(table, index, context);
801
+ if (!numbers.ok) return numbers;
802
+ series.push({
803
+ name: columnName(table, index),
804
+ points: table.rows.map((row, rowIndex) => ({
805
+ label: row[conversion.label]?.text ?? "",
806
+ value: numbers.value[rowIndex]
807
+ }))
808
+ });
809
+ }
810
+ return ok({
811
+ kind: "GRAPH",
812
+ series,
813
+ chartType: conversion.chartType,
814
+ valueFormat: conversion.valueFormat ?? "number",
815
+ ...conversion.currency === void 0 ? {} : { currency: conversion.currency },
816
+ xLabel: columnName(table, conversion.label)
817
+ });
818
+ }
819
+ function barListToTable(list, conversion) {
820
+ return ok({
821
+ kind: "TABLE",
822
+ columns: [
823
+ { label: conversion.labelHeading ?? "Name" },
824
+ { label: conversion.valueHeading ?? "Value", numeric: true }
825
+ ],
826
+ rows: list.items.map((item) => [
827
+ { text: item.label },
828
+ { text: item.display ?? String(item.value), value: item.value }
829
+ ])
830
+ });
831
+ }
832
+ function graphToTable(graph, context) {
833
+ const first = graph.series[0];
834
+ if (first === void 0)
835
+ return err(`${context.where}: the chart has no series.`);
836
+ const format = {
837
+ ...graph.currency === void 0 ? {} : { currency: graph.currency },
838
+ ...context.locale === void 0 ? {} : { locale: context.locale }
839
+ };
840
+ return ok({
841
+ kind: "TABLE",
842
+ columns: [
843
+ { label: graph.xLabel ?? "Label" },
844
+ ...graph.series.map((series) => ({ label: series.name, numeric: true }))
845
+ ],
846
+ rows: first.points.map((point, index) => [
847
+ { text: point.label },
848
+ ...graph.series.map((series) => {
849
+ const value = series.points[index]?.value;
850
+ return value === void 0 ? { text: "\u2014" } : { text: formatValue(value, graph.valueFormat, format), value };
851
+ })
852
+ ])
853
+ });
854
+ }
855
+ function barListToGraph(list, conversion) {
856
+ return ok({
857
+ kind: "GRAPH",
858
+ series: [
859
+ {
860
+ name: conversion.seriesName ?? "Value",
861
+ points: list.items.map((item) => ({
862
+ label: item.label,
863
+ value: item.value
864
+ }))
865
+ }
866
+ ],
867
+ chartType: conversion.chartType,
868
+ valueFormat: conversion.valueFormat ?? "number",
869
+ ...conversion.currency === void 0 ? {} : { currency: conversion.currency }
870
+ });
871
+ }
872
+ function convertView(widgetKey, view, data, options = {}) {
873
+ const conversion = view.convert;
874
+ const context = {
875
+ where: `Widget ${JSON.stringify(widgetKey)} view ${JSON.stringify(view.key)}`,
876
+ ...options.locale === void 0 ? {} : { locale: options.locale }
877
+ };
878
+ const expected = VIEW_CONVERSIONS[conversion.type]?.from;
879
+ if (expected === void 0) {
880
+ return err(
881
+ `${context.where}: unknown conversion type ${JSON.stringify(conversion.type)}.`
882
+ );
883
+ }
884
+ if (data.kind !== expected) {
885
+ return err(
886
+ `${context.where}: ${conversion.type} reads a ${expected} payload, but the widget returned ${data.kind}.`
887
+ );
888
+ }
889
+ switch (conversion.type) {
890
+ case "tableToBarList":
891
+ return tableToBarList(data, conversion, context);
892
+ case "tableToGraph":
893
+ return tableToGraph(data, conversion, context);
894
+ case "barListToTable":
895
+ return barListToTable(data, conversion);
896
+ case "graphToTable":
897
+ return graphToTable(data, context);
898
+ case "barListToGraph":
899
+ return barListToGraph(data, conversion);
900
+ }
901
+ }
902
+ function viewNote(view, data) {
903
+ if (data?.kind !== "TABLE") return "";
904
+ const conversion = view.convert;
905
+ let indexes;
906
+ if (conversion.type === "tableToBarList") {
907
+ indexes = [conversion.label, conversion.value];
908
+ } else if (conversion.type === "tableToGraph") {
909
+ indexes = [conversion.label, ...conversion.values];
910
+ } else {
911
+ return "";
912
+ }
913
+ const names = indexes.map(
914
+ (index) => data.columns[index]?.label ?? `#${index + 1}`
915
+ );
916
+ return `Shows ${names.join(", ")} only.`;
917
+ }
918
+ function applyView(widget, chosen, options = {}) {
919
+ const key = effectiveViewKey(widget.definition, chosen);
920
+ const view = findView(widget.definition, key);
921
+ if (view === void 0) return widget;
922
+ const definition = {
923
+ ...widget.definition,
924
+ kind: view.kind
925
+ };
926
+ if (widget.status === "loading") return { ...widget, definition };
927
+ if (widget.status === "empty") return { ...widget, definition };
928
+ if (widget.status === "error") return { ...widget, definition };
929
+ const converted = convertView(
930
+ widget.definition.key,
931
+ view,
932
+ widget.data,
933
+ options
934
+ );
935
+ if (!converted.ok) {
936
+ return {
937
+ definition,
938
+ status: "error",
939
+ error: converted.error,
940
+ ...widget.options === void 0 ? {} : { options: widget.options }
941
+ };
942
+ }
943
+ return { ...widget, definition, data: converted.value };
944
+ }
945
+
689
946
  // src/core/options.ts
690
947
  var DATE_RANGE_PRESETS = [
691
948
  "today",
@@ -991,6 +1248,7 @@ function parseOne(raw) {
991
1248
  const width = raw["width"];
992
1249
  const flexible = raw["flexible"];
993
1250
  const options = raw["options"];
1251
+ const view = raw["view"];
994
1252
  const cleanTitle = typeof title === "string" ? title.trim().slice(0, MAX_WIDGET_TITLE_LENGTH) : "";
995
1253
  const chosen = {};
996
1254
  if (isRecord(options)) {
@@ -1003,7 +1261,8 @@ function parseOne(raw) {
1003
1261
  ...cleanTitle === "" ? {} : { title: cleanTitle },
1004
1262
  ...isWidgetWidth(width) ? { width } : {},
1005
1263
  ...typeof flexible === "boolean" ? { flexible } : {},
1006
- ...Object.keys(chosen).length === 0 ? {} : { options: chosen }
1264
+ ...Object.keys(chosen).length === 0 ? {} : { options: chosen },
1265
+ ...typeof view === "string" && view !== "" && view.length <= 80 ? { view } : {}
1007
1266
  };
1008
1267
  return Object.keys(settings).length === 0 ? void 0 : settings;
1009
1268
  }
@@ -1030,7 +1289,8 @@ function serializeSettings(settings) {
1030
1289
  ...one.title === void 0 ? {} : { title: one.title },
1031
1290
  ...one.width === void 0 ? {} : { width: one.width },
1032
1291
  ...one.flexible === void 0 ? {} : { flexible: one.flexible },
1033
- ...one.options === void 0 || Object.keys(one.options).length === 0 ? {} : { options: { ...one.options } }
1292
+ ...one.options === void 0 || Object.keys(one.options).length === 0 ? {} : { options: { ...one.options } },
1293
+ ...one.view === void 0 ? {} : { view: one.view }
1034
1294
  };
1035
1295
  if (Object.keys(piece).length > 0) out[key] = piece;
1036
1296
  }
@@ -1122,12 +1382,18 @@ function optionValuesFromLayout(definitions, layout, options = {}) {
1122
1382
  }
1123
1383
  function sameSettings(a, b) {
1124
1384
  if (a === b) return true;
1125
- return a?.title === b?.title && a?.width === b?.width && a?.flexible === b?.flexible && sameOptionValues(a?.options ?? {}, b?.options ?? {});
1385
+ return a?.title === b?.title && a?.width === b?.width && a?.flexible === b?.flexible && a?.view === b?.view && sameOptionValues(a?.options ?? {}, b?.options ?? {});
1126
1386
  }
1127
1387
  function setWidgetSettings(layout, key, patch) {
1128
1388
  const before = layout.settings?.[key];
1129
1389
  const draft = { ...before };
1130
- for (const field of ["title", "width", "flexible", "options"]) {
1390
+ for (const field of [
1391
+ "title",
1392
+ "width",
1393
+ "flexible",
1394
+ "options",
1395
+ "view"
1396
+ ]) {
1131
1397
  if (!(field in patch)) continue;
1132
1398
  const value = patch[field];
1133
1399
  if (value === void 0) {
@@ -1153,7 +1419,8 @@ function clearWidgetSettings(layout, key) {
1153
1419
  title: void 0,
1154
1420
  width: void 0,
1155
1421
  flexible: void 0,
1156
- options: void 0
1422
+ options: void 0,
1423
+ view: void 0
1157
1424
  });
1158
1425
  }
1159
1426
  function normalizeTitle(title) {
@@ -1213,7 +1480,8 @@ function normalizeSettings(definitions, layout, options = {}) {
1213
1480
  ...title === void 0 ? {} : { title },
1214
1481
  ...one.width === void 0 ? {} : { width: Math.min(range.max, Math.max(range.min, one.width)) },
1215
1482
  ...one.flexible === void 0 ? {} : { flexible: one.flexible },
1216
- ...Object.keys(chosen).length === 0 ? {} : { options: chosen }
1483
+ ...Object.keys(chosen).length === 0 ? {} : { options: chosen },
1484
+ ...one.view !== void 0 && (one.view === BASE_VIEW_KEY || findView(definition, one.view) !== void 0) ? { view: one.view } : {}
1217
1485
  };
1218
1486
  if (Object.keys(next).length > 0) {
1219
1487
  cleaned[definition.key] = sameSettings(one, next) ? one : next;
@@ -2086,6 +2354,137 @@ function checkOptions(options, kind, problems) {
2086
2354
  );
2087
2355
  });
2088
2356
  }
2357
+ var MAX_VIEW_COLUMN = 1e3;
2358
+ function checkColumnIndex(value, path, problems) {
2359
+ if (typeof value !== "number" || !Number.isInteger(value) || value < 0 || value > MAX_VIEW_COLUMN) {
2360
+ problems.push(
2361
+ `${path} must be a column index (a whole number from 0), got ${typeof value === "number" ? String(value) : describeType2(value)}.`
2362
+ );
2363
+ }
2364
+ }
2365
+ function checkConversion(conversion, path, baseKind, viewKind2, problems) {
2366
+ if (!isRecord2(conversion)) {
2367
+ problems.push(
2368
+ `${path} must be an object with a type, got ${describeType2(conversion)}.`
2369
+ );
2370
+ return;
2371
+ }
2372
+ const type = conversion["type"];
2373
+ const known = typeof type === "string" && Object.hasOwn(VIEW_CONVERSIONS, type) ? VIEW_CONVERSIONS[type] : void 0;
2374
+ if (known === void 0) {
2375
+ problems.push(
2376
+ `${path}.type must be one of ${Object.keys(VIEW_CONVERSIONS).map((name) => `"${name}"`).join(", ")}, got ${describeType2(type)}.`
2377
+ );
2378
+ return;
2379
+ }
2380
+ if (baseKind !== known.from) {
2381
+ problems.push(
2382
+ `${path}.type "${String(type)}" reads a ${known.from} widget, but this one is ${String(baseKind)}.`
2383
+ );
2384
+ }
2385
+ if (viewKind2 !== known.to) {
2386
+ problems.push(
2387
+ `${path}.type "${String(type)}" produces ${known.to}, but the view's kind is ${String(viewKind2)}.`
2388
+ );
2389
+ }
2390
+ switch (type) {
2391
+ case "tableToBarList":
2392
+ checkColumnIndex(conversion["label"], `${path}.label`, problems);
2393
+ checkColumnIndex(conversion["value"], `${path}.value`, problems);
2394
+ break;
2395
+ case "tableToGraph": {
2396
+ checkColumnIndex(conversion["label"], `${path}.label`, problems);
2397
+ const values = conversion["values"];
2398
+ if (!Array.isArray(values) || values.length === 0) {
2399
+ problems.push(`${path}.values must list 1 or more column indexes.`);
2400
+ } else if (values.length > MAX_GRAPH_SERIES) {
2401
+ problems.push(
2402
+ `${path}.values lists ${values.length} series; a chart carries at most ${MAX_GRAPH_SERIES}.`
2403
+ );
2404
+ } else {
2405
+ values.forEach(
2406
+ (index, at) => checkColumnIndex(index, `${path}.values[${at}]`, problems)
2407
+ );
2408
+ }
2409
+ if (conversion["chartType"] !== "bar" && conversion["chartType"] !== "line") {
2410
+ problems.push(`${path}.chartType must be "bar" or "line".`);
2411
+ }
2412
+ break;
2413
+ }
2414
+ case "barListToGraph":
2415
+ if (conversion["chartType"] !== "bar" && conversion["chartType"] !== "line") {
2416
+ problems.push(`${path}.chartType must be "bar" or "line".`);
2417
+ }
2418
+ break;
2419
+ }
2420
+ if (conversion["valueFormat"] !== void 0 && !VALUE_FORMATS.includes(conversion["valueFormat"])) {
2421
+ problems.push(
2422
+ `${path}.valueFormat must be one of ${VALUE_FORMATS.map((f) => `"${f}"`).join(", ")}.`
2423
+ );
2424
+ }
2425
+ }
2426
+ function checkViews(value, problems) {
2427
+ const views = value["views"];
2428
+ const defaultView = value["defaultView"];
2429
+ optionalString(value, "baseViewLabel", "", problems);
2430
+ if (value["baseViewLabel"] === "") {
2431
+ problems.push("baseViewLabel must not be empty.");
2432
+ }
2433
+ const declared = /* @__PURE__ */ new Set([BASE_VIEW_KEY]);
2434
+ if (views !== void 0) {
2435
+ if (!Array.isArray(views)) {
2436
+ problems.push(`views must be an array, got ${describeType2(views)}.`);
2437
+ } else if (views.length > MAX_WIDGET_VIEWS) {
2438
+ problems.push(
2439
+ `views lists ${views.length} views; the most a widget may declare is ${MAX_WIDGET_VIEWS}.`
2440
+ );
2441
+ } else {
2442
+ views.forEach((view, index) => {
2443
+ const path = `views[${index}]`;
2444
+ if (!isRecord2(view)) {
2445
+ problems.push(
2446
+ `${path} must be an object, got ${describeType2(view)}.`
2447
+ );
2448
+ return;
2449
+ }
2450
+ const key = view["key"];
2451
+ if (typeof key !== "string" || key.trim() === "") {
2452
+ problems.push(`${path}.key must be a non-empty string.`);
2453
+ } else if (declared.has(key)) {
2454
+ problems.push(
2455
+ key === BASE_VIEW_KEY ? `${path}.key "${BASE_VIEW_KEY}" is reserved for the widget's own kind.` : `${path}.key "${key}" is used twice.`
2456
+ );
2457
+ } else {
2458
+ declared.add(key);
2459
+ }
2460
+ if (typeof view["label"] !== "string" || view["label"].trim() === "") {
2461
+ problems.push(`${path}.label must be a non-empty string.`);
2462
+ }
2463
+ requireOneOf(view, "kind", WIDGET_KINDS, path, problems);
2464
+ if (view["convert"] === void 0) {
2465
+ problems.push(
2466
+ `${path}.convert is required: views supplied by a provider are not supported yet.`
2467
+ );
2468
+ } else {
2469
+ checkConversion(
2470
+ view["convert"],
2471
+ `${path}.convert`,
2472
+ value["kind"],
2473
+ view["kind"],
2474
+ problems
2475
+ );
2476
+ }
2477
+ });
2478
+ }
2479
+ }
2480
+ if (defaultView !== void 0) {
2481
+ if (typeof defaultView !== "string" || !declared.has(defaultView)) {
2482
+ problems.push(
2483
+ `defaultView must be "${BASE_VIEW_KEY}" or the key of a declared view, got ${typeof defaultView === "string" ? JSON.stringify(defaultView) : describeType2(defaultView)}.`
2484
+ );
2485
+ }
2486
+ }
2487
+ }
2089
2488
  function formatProblems(prefix, problems) {
2090
2489
  const shown = problems.slice(0, MAX_REPORTED_PROBLEMS);
2091
2490
  const more = problems.length - shown.length;
@@ -2162,6 +2561,7 @@ function validateWidgetDefinition(value) {
2162
2561
  checkTableControlsOption(value["tableControls"], value["kind"], problems);
2163
2562
  checkLockedOption(value["locked"], problems);
2164
2563
  checkOptions(value["options"], value["kind"], problems);
2564
+ checkViews(value, problems);
2165
2565
  if (value["page"] !== void 0) {
2166
2566
  if (typeof value["page"] !== "string" || value["page"].trim() === "") {
2167
2567
  problems.push(
@@ -3796,6 +4196,6 @@ function indent(block) {
3796
4196
  return block.split("\n").map((line) => ` ${line}`).join("\n");
3797
4197
  }
3798
4198
 
3799
- export { DATE_RANGE_PRESETS, DEFAULT_COMPARISON_LABEL, DEFAULT_CURRENCY, DEFAULT_DETAIL_PAGE_SIZE, DEFAULT_EMPTY_TEXT, DEFAULT_MAX_LAYOUT_BYTES, DEFAULT_PAGE_KEY, DEFAULT_PAGE_ROWS, DETAIL_MODES, EMPTY_LAYOUT, LAYOUT_ENVELOPE_VERSION, MAX_DETAIL_PAGE_SIZE, MAX_GRAPH_SERIES, MAX_PAGE_ROWS, MAX_PAGE_TITLE_LENGTH, MAX_PARSED_PAGES, MAX_PARSED_SETTINGS, MAX_REPORTED_PROBLEMS, MAX_TEXT_OPTION_LENGTH, MAX_WIDGET_OPTIONS, MAX_WIDGET_TITLE_LENGTH, MAX_WIDGET_WIDTH, MIN_WIDGET_WIDTH, OPTION_KEY_PATTERN, THEME_TOKEN_VARIABLES, VALUE_FORMATS, WIDGET_FILLS, WIDGET_KINDS, WIDGET_OPTION_TYPES, WIDGET_SIZES, WIDTH_COLUMNS, addPage, applyClientOptions, applySettings, assignPages, baseColumnSpan, cacheKeyFor, clearWidgetSettings, coerceOptionValue, createLayoutPersistence, createTheme, createWidgetLoader, defaultDetailQuery, defaultOptionValue, defineWidget, deriveDetailData, describeUnknownError, effectiveDefinitions, emptyTextFor, emptyWidget, enforceLocks, err, failedWidget, fillColumnSpans, fillWidthSpans, fillsHeight, fillsWidth, finalizeWidget, fitCount, formatCount, formatPercentChange, formatValue, fromLegacyDefinition, hasPages, hiddenWidgets, hideWidget, isClientApplied, isColumnKeyFor, isFlexible, isHidden, isIsoInterval, isMinimized, isOptionsLocked, isSafeHref, isSafeImageUrl, isTitleInUse, isWidgetEmptyState, isWidgetKind, isWidgetVisibleTo, isWidgetWidth, itemWidth, kpiDelta, labelStride, loadingWidgets, memoryAdapter, minimizeWidget, movePage, moveWidget, moveWidgetBy, moveWidgetDown, moveWidgetToPage, moveWidgetUp, nextPageKey, niceDomain, niceStep, normalizeLayout, normalizeSettings, normalizeTitle, ok, optionValuesFor, optionValuesFromLayout, optionsCacheSuffix, pageLayout, pageList, pageOf, pageRoom, pageWidgets, parseDetailQuery, parseLayout, parseSettings, parseSortValue, percentChange, placeRows, pruneLayout, queryRows, readOnly, removePage, renamePage, resolveDateRange, resolveDetailOptions, resolveOptionValues, resolvePageKey, resolvePayload, resolveTableControls, resolveWidget, resolveWidgetLock, resolveWidgetUnapplied, resolveWidgets, restoreWidget, sameOptionValues, serializeDetailQuery, serializeLayout, serializeSettings, setWidgetSettings, shareOf, showWidget, sortDefinitions, sortFromOptions, tableDetailData, toggleHidden, toggleMinimized, upgradeLegacyWidgetData, usesWidthColumns, utf8Length, validateDetailData, validateWidgetData, validateWidgetDefinition, visibleWidgets, widgetOptionValues, widgetsFor, widthForSize, widthRange, widthShareLabel, withEncoding, withFallback, withLogging, withPageLayout, withPrefix, withReadCache, withRetry };
4199
+ export { BASE_VIEW_KEY, DATE_RANGE_PRESETS, DEFAULT_COMPARISON_LABEL, DEFAULT_CURRENCY, DEFAULT_DETAIL_PAGE_SIZE, DEFAULT_EMPTY_TEXT, DEFAULT_MAX_LAYOUT_BYTES, DEFAULT_PAGE_KEY, DEFAULT_PAGE_ROWS, DETAIL_MODES, EMPTY_LAYOUT, LAYOUT_ENVELOPE_VERSION, MAX_DETAIL_PAGE_SIZE, MAX_GRAPH_SERIES, MAX_PAGE_ROWS, MAX_PAGE_TITLE_LENGTH, MAX_PARSED_PAGES, MAX_PARSED_SETTINGS, MAX_REPORTED_PROBLEMS, MAX_TEXT_OPTION_LENGTH, MAX_WIDGET_OPTIONS, MAX_WIDGET_TITLE_LENGTH, MAX_WIDGET_VIEWS, MAX_WIDGET_WIDTH, MIN_WIDGET_WIDTH, OPTION_KEY_PATTERN, THEME_TOKEN_VARIABLES, VALUE_FORMATS, VIEW_CONVERSIONS, WIDGET_FILLS, WIDGET_KINDS, WIDGET_OPTION_TYPES, WIDGET_SIZES, WIDTH_COLUMNS, addPage, applyClientOptions, applySettings, applyView, assignPages, baseColumnSpan, cacheKeyFor, clearWidgetSettings, coerceOptionValue, convertView, createLayoutPersistence, createTheme, createWidgetLoader, defaultDetailQuery, defaultOptionValue, defineWidget, deriveDetailData, describeUnknownError, effectiveDefinitions, effectiveViewKey, emptyTextFor, emptyWidget, enforceLocks, err, failedWidget, fillColumnSpans, fillWidthSpans, fillsHeight, fillsWidth, finalizeWidget, findView, fitCount, formatCount, formatPercentChange, formatValue, fromLegacyDefinition, hasPages, hasViews, hiddenWidgets, hideWidget, isClientApplied, isColumnKeyFor, isFlexible, isHidden, isIsoInterval, isMinimized, isOptionsLocked, isSafeHref, isSafeImageUrl, isTitleInUse, isWidgetEmptyState, isWidgetKind, isWidgetVisibleTo, isWidgetWidth, itemWidth, kindLabel, kpiDelta, labelStride, loadingWidgets, memoryAdapter, minimizeWidget, movePage, moveWidget, moveWidgetBy, moveWidgetDown, moveWidgetToPage, moveWidgetUp, nextPageKey, niceDomain, niceStep, normalizeLayout, normalizeSettings, normalizeTitle, ok, optionValuesFor, optionValuesFromLayout, optionsCacheSuffix, pageLayout, pageList, pageOf, pageRoom, pageWidgets, parseDetailQuery, parseLayout, parseSettings, parseSortValue, percentChange, placeRows, pruneLayout, queryRows, readOnly, removePage, renamePage, resolveDateRange, resolveDetailOptions, resolveOptionValues, resolvePageKey, resolvePayload, resolveTableControls, resolveWidget, resolveWidgetLock, resolveWidgetUnapplied, resolveWidgets, restoreWidget, sameOptionValues, serializeDetailQuery, serializeLayout, serializeSettings, setWidgetSettings, shareOf, showWidget, sortDefinitions, sortFromOptions, tableDetailData, toggleHidden, toggleMinimized, upgradeLegacyWidgetData, usesWidthColumns, utf8Length, validateDetailData, validateWidgetData, validateWidgetDefinition, viewChoices, viewKind, viewNote, visibleWidgets, widgetOptionValues, widgetsFor, widthForSize, widthRange, widthShareLabel, withEncoding, withFallback, withLogging, withPageLayout, withPrefix, withReadCache, withRetry };
3800
4200
  //# sourceMappingURL=index.js.map
3801
4201
  //# sourceMappingURL=index.js.map