@richardmcquiston01/dashboard-widgets-toolkit 0.15.0 → 0.17.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.d.cts CHANGED
@@ -1,5 +1,5 @@
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-DwJ-vGJg.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, $ 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, aP as ResolvedDetailOptions, R as ResolvedTableControls, aQ as ResolvedWidget, aR as ResolvedWidgetLock, 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, l as WidgetData, bf as WidgetDataOf, bg as WidgetDetailOptions, bh as WidgetEmptyState, a as WidgetFill, bi as WidgetLock, bj as WidgetOption, bk as WidgetProvider, 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';
1
+ import { b as WidgetDefinition, r as PageOptions, C as CloneOptions, f as DashboardLayout, P as PageItem, s as Result, t as WidgetClone, D as DashboardWidget, p as WidgetContext, o as ResolveOptions, q as WidgetProviders, u as WidgetKind, v as WidgetPayload } from './storage-CRBfjiVZ.cjs';
2
+ export { w as AddPageOptions, x as AlertListItem, A as AlertListWidgetData, y as BASE_VIEW_KEY, z as BarListItem, B as BarListWidgetData, E as BooleanOption, F as CachedPayload, H as ChoiceOption, I as CloneItem, J as ColorOption, M as ColumnsOption, Q as ConflictPolicy, U as ConvertViewOptions, V as DATE_RANGE_PRESETS, X as DEFAULT_COMPARISON_LABEL, Y as DEFAULT_CURRENCY, Z as DEFAULT_DETAIL_PAGE_SIZE, _ as DEFAULT_EMPTY_TEXT, $ as DEFAULT_MAX_LAYOUT_BYTES, a0 as DEFAULT_PAGE_KEY, a1 as DEFAULT_PAGE_ROWS, a2 as DETAIL_MODES, a3 as DateRangeOption, a4 as DateRangePreset, a5 as DeltaDirection, a6 as DeltaSentiment, a7 as DetailCell, a8 as DetailColumn, d as DetailData, a9 as DetailMode, aa as DetailPage, ab as DetailProvider, c as DetailProviderOptions, ac as DetailProviders, e as DetailQuery, j as DetailSort, ad as EMPTY_LAYOUT, ae as EmptyWidget, af as EncodingOptions, ag as EnforceLocksOptions, ah as Err, ai as ErrorWidget, aj as FormatOptions, i as GaugeWidgetData, ak as GraphPoint, al as GraphSeries, G as GraphWidgetData, am as GridItem, an as KpiDelta, ao as KpiDeltaOptions, K as KpiWidgetData, ap as LAYOUT_ENVELOPE_VERSION, aq as LayoutItem, ar as LayoutPage, m as LayoutPersistence, as as LayoutPersistenceOptions, at as LayoutSettings, au as LoadedLayout, av as LoadingWidget, L as Locale, aw as MAX_DETAIL_PAGE_SIZE, ax as MAX_GRAPH_SERIES, ay as MAX_PAGE_ROWS, az as MAX_PAGE_TITLE_LENGTH, aA as MAX_PARSED_CLONES, aB as MAX_PARSED_PAGES, aC as MAX_PARSED_SETTINGS, aD as MAX_TEXT_OPTION_LENGTH, aE as MAX_WIDGET_OPTIONS, aF as MAX_WIDGET_TITLE_LENGTH, aG as MAX_WIDGET_VIEWS, aH as MAX_WIDGET_WIDTH, aI as MIN_WIDGET_WIDTH, N as NiceDomain, n as NormalizeOptions, aJ as NormalizeSettingsOptions, aK as NumberOption, aL as OPTION_KEY_PATTERN, aM as Ok, aN as OkWidget, aO as OptionContext, aP as OptionValue, O as OptionValues, aQ as PageRoom, aR as PlacedRow, aS as ProviderOptions, aT as ResolvedDetailOptions, R as ResolvedTableControls, aU as ResolvedWidget, aV as ResolvedWidgetLock, aW as RetryOptions, aX as SaveOptions, aY as SavedLayout, aZ as SettingsItem, a_ as SortDirection, a$ as SortOption, b0 as StorageAdapter, b1 as StorageLogEvent, b2 as StoreErrorCode, b3 as StoreResult, S as StoreScope, b4 as StoredValue, b5 as TableCell, b6 as TableColumn, T as TableWidgetData, b7 as TextOption, k as TextWidgetData, b8 as VALUE_FORMATS, b9 as VIEW_CONVERSIONS, ba as ValueFormat, bb as ViewConversion, bc as ViewsItem, bd as WIDGET_FILLS, be as WIDGET_KINDS, bf as WIDGET_OPTION_TYPES, bg as WIDGET_SIZES, bh as WIDTH_COLUMNS, bi as WidgetCache, l as WidgetData, bj as WidgetDataOf, bk as WidgetDetailOptions, bl as WidgetEmptyState, a as WidgetFill, bm as WidgetLock, bn as WidgetOption, bo as WidgetProvider, h as WidgetSettingsPatch, W as WidgetSize, bp as WidgetStatus, bq as WidgetTableControls, br as WidgetView, g as WidgetViewerSettings, bs as addPage, bt as applyClientOptions, bu as applySettings, bv as applyView, bw as assignPages, bx as baseColumnSpan, by as cacheKeyFor, bz as cleanClones, bA as clearWidgetSettings, bB as cloneNumber, bC as coerceOptionValue, bD as convertView, bE as createLayoutPersistence, bF as defaultDetailQuery, bG as defaultOptionValue, bH as defineWidget, bI as deriveDetailData, bJ as describeUnknownError, bK as effectiveDefinitions, bL as effectiveViewKey, bM as emptyTextFor, bN as emptyWidget, bO as enforceLocks, bP as err, bQ as failedWidget, bR as fillColumnSpans, bS as fillWidthSpans, bT as fillsHeight, bU as fillsWidth, bV as finalizeWidget, bW as findView, bX as fitCount, bY as formatCount, bZ as formatPercentChange, b_ as formatValue, b$ as hasPages, c0 as hasViews, c1 as hiddenWidgets, c2 as hideWidget, c3 as isClientApplied, c4 as isColumnKeyFor, c5 as isFlexible, c6 as isHidden, c7 as isIsoInterval, c8 as isMinimized, c9 as isOptionsLocked, ca as isProviderView, cb as isTitleInUse, cc as isWidgetEmptyState, cd as isWidgetKind, ce as isWidgetVisibleTo, cf as isWidgetWidth, cg as itemWidth, ch as kindLabel, ci as kpiDelta, cj as labelStride, ck as loadViewKey, cl as loadViewKind, cm as loadingWidgets, cn as memoryAdapter, co as minimizeWidget, cp as movePage, cq as moveWidget, cr as moveWidgetBy, cs as moveWidgetDown, ct as moveWidgetToPage, cu as moveWidgetUp, cv as nextPageKey, cw as niceDomain, cx as niceStep, cy as normalizeLayout, cz as normalizeSettings, cA as normalizeTitle, cB as ok, cC as optionValuesFor, cD as optionValuesFromLayout, cE as optionsCacheSuffix, cF as pageLayout, cG as pageList, cH as pageOf, cI as pageRoom, cJ as pageWidgets, cK as parseClones, cL as parseDetailQuery, cM as parseLayout, cN as parseSettings, cO as parseSortValue, cP as percentChange, cQ as placeRows, cR as pruneLayout, cS as queryRows, cT as readOnly, cU as removePage, cV as renamePage, cW as resolveDateRange, cX as resolveDetailOptions, cY as resolveOptionValues, cZ as resolvePageKey, c_ as resolvePayload, c$ as resolveTableControls, d0 as resolveWidget, d1 as resolveWidgetLock, d2 as resolveWidgetUnapplied, d3 as resolveWidgets, d4 as restoreWidget, d5 as sameOptionValues, d6 as serializeClones, d7 as serializeDetailQuery, d8 as serializeLayout, d9 as serializeSettings, da as setWidgetSettings, db as shareOf, dc as showWidget, dd as sortDefinitions, de as sortFromOptions, df as tableDetailData, dg as toggleHidden, dh as toggleMinimized, di as usesWidthColumns, dj as utf8Length, dk as validateDetailData, dl as viewChoices, dm as viewKind, dn as viewNote, dp as viewValuesFromLayout, dq as visibleWidgets, dr as widgetOptionValues, ds as widgetsFor, dt as widthForSize, du as widthRange, dv as widthShareLabel, dw as withClones, dx as withEncoding, dy as withFallback, dz as withLogging, dA as withPageLayout, dB as withPrefix, dC as withReadCache, dD as withRetry } from './storage-CRBfjiVZ.cjs';
3
3
 
4
4
  /**
5
5
  * Maker Toolkit compatibility. Its API (`apps/api/src/widgets`) serves
@@ -33,6 +33,52 @@ interface LegacyWidgetDefinition {
33
33
  */
34
34
  declare function fromLegacyDefinition(legacy: LegacyWidgetDefinition): WidgetDefinition | null;
35
35
 
36
+ /**
37
+ * Making and deleting clones (see `clones.ts`): the layout changes behind a
38
+ * "Duplicate" and a "Delete" control. Inputs are never mutated; a refusal is
39
+ * a `Result` with a specific message, and a no-op returns the same object.
40
+ */
41
+
42
+ /** Options for `duplicateWidget`. */
43
+ interface DuplicateOptions extends PageOptions, CloneOptions {
44
+ }
45
+ /** What `duplicateWidget` returns: the new layout and the clone's key. */
46
+ interface Duplicated {
47
+ readonly layout: DashboardLayout;
48
+ /** The new clone's key, for opening its Options dialog. */
49
+ readonly key: string;
50
+ }
51
+ /** Whether a widget (or the widget a clone copies) may be duplicated. */
52
+ declare function canDuplicate(definitions: readonly PageItem[], key: string, options?: CloneOptions): boolean;
53
+ /** `from#n`, with n one more than the highest number used for that original. */
54
+ declare function nextCloneKey(definitions: readonly {
55
+ readonly key: string;
56
+ }[], layout: {
57
+ readonly clones?: readonly WidgetClone[];
58
+ }, fromKey: string): string;
59
+ /**
60
+ * A title for a clone shown with another view: "Recent Orders Line Chart".
61
+ * Cut to the title limit.
62
+ */
63
+ declare function suggestedViewTitle(title: string, viewLabel: string): string;
64
+ /**
65
+ * Duplicates a widget into a clone placed right after it. The copy starts
66
+ * with the widget's own width, view and option values (not its title, which
67
+ * is "Title (#n)"). Cloning a clone clones the original. Refused for an
68
+ * unknown widget, when the original's `locked.clone` forbids it, and, in a
69
+ * paged layout, when the page has no room for the clone's width.
70
+ *
71
+ * Pass the definitions you render with (clones included, as `withClones`
72
+ * returns them).
73
+ */
74
+ declare function duplicateWidget<T extends PageItem>(definitions: readonly T[], layout: DashboardLayout, key: string, options?: DuplicateOptions): Result<Duplicated>;
75
+ /**
76
+ * Removes a clone from the layout: its entry, its settings, and its place in
77
+ * every order, hidden and minimized list. Originals can't be deleted (hide
78
+ * them), so any other key returns the layout unchanged.
79
+ */
80
+ declare function deleteClone(layout: DashboardLayout, key: string): DashboardLayout;
81
+
36
82
  /**
37
83
  * Loads widgets one by one, after the first render, and reports each result
38
84
  * as it arrives. It is the logic behind the React `useWidgets` hook, kept
@@ -82,6 +128,14 @@ interface WidgetLoader {
82
128
  * values don't change.
83
129
  */
84
130
  setOptions(key: string, chosen: Readonly<Record<string, unknown>>): void;
131
+ /**
132
+ * Sets the view a widget shows (`undefined` or an empty string: its
133
+ * `defaultView`). Only a view the provider supplies loads anything: the
134
+ * provider is called with that view, the card shows loading until it
135
+ * arrives, and an earlier answer for the same view comes back from the
136
+ * cache. Switching among the base and converted views reloads nothing.
137
+ */
138
+ setView(key: string, view: string | undefined): void;
85
139
  /** Aborts everything in flight and ignores any later result. */
86
140
  dispose(): void;
87
141
  }
@@ -178,4 +232,4 @@ declare function validateWidgetData(value: unknown, options?: ValidateWidgetData
178
232
  */
179
233
  declare function validateWidgetDefinition(value: unknown): Result<WidgetDefinition>;
180
234
 
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 };
235
+ export { CloneOptions, DashboardLayout, DashboardWidget, type DuplicateOptions, type Duplicated, type LegacyWidgetDefinition, MAX_REPORTED_PROBLEMS, PageItem, PageOptions, type RefreshOptions, ResolveOptions, Result, THEME_TOKEN_VARIABLES, type ThemeColorKey, type ThemeLengthKey, type ThemeMode, type ThemeOptions, type ThemeTokenKey, type ThemeTokens, type ValidateWidgetDataOptions, WidgetClone, WidgetContext, WidgetDefinition, WidgetKind, type WidgetLoader, type WidgetLoaderOptions, WidgetPayload, WidgetProviders, type WidgetThemeStyles, canDuplicate, createTheme, createWidgetLoader, deleteClone, duplicateWidget, fromLegacyDefinition, isSafeHref, isSafeImageUrl, nextCloneKey, suggestedViewTitle, upgradeLegacyWidgetData, validateWidgetData, validateWidgetDefinition };
package/dist/core.d.ts CHANGED
@@ -1,5 +1,5 @@
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-DwJ-vGJg.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, $ 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, aP as ResolvedDetailOptions, R as ResolvedTableControls, aQ as ResolvedWidget, aR as ResolvedWidgetLock, 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, l as WidgetData, bf as WidgetDataOf, bg as WidgetDetailOptions, bh as WidgetEmptyState, a as WidgetFill, bi as WidgetLock, bj as WidgetOption, bk as WidgetProvider, 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';
1
+ import { b as WidgetDefinition, r as PageOptions, C as CloneOptions, f as DashboardLayout, P as PageItem, s as Result, t as WidgetClone, D as DashboardWidget, p as WidgetContext, o as ResolveOptions, q as WidgetProviders, u as WidgetKind, v as WidgetPayload } from './storage-CRBfjiVZ.js';
2
+ export { w as AddPageOptions, x as AlertListItem, A as AlertListWidgetData, y as BASE_VIEW_KEY, z as BarListItem, B as BarListWidgetData, E as BooleanOption, F as CachedPayload, H as ChoiceOption, I as CloneItem, J as ColorOption, M as ColumnsOption, Q as ConflictPolicy, U as ConvertViewOptions, V as DATE_RANGE_PRESETS, X as DEFAULT_COMPARISON_LABEL, Y as DEFAULT_CURRENCY, Z as DEFAULT_DETAIL_PAGE_SIZE, _ as DEFAULT_EMPTY_TEXT, $ as DEFAULT_MAX_LAYOUT_BYTES, a0 as DEFAULT_PAGE_KEY, a1 as DEFAULT_PAGE_ROWS, a2 as DETAIL_MODES, a3 as DateRangeOption, a4 as DateRangePreset, a5 as DeltaDirection, a6 as DeltaSentiment, a7 as DetailCell, a8 as DetailColumn, d as DetailData, a9 as DetailMode, aa as DetailPage, ab as DetailProvider, c as DetailProviderOptions, ac as DetailProviders, e as DetailQuery, j as DetailSort, ad as EMPTY_LAYOUT, ae as EmptyWidget, af as EncodingOptions, ag as EnforceLocksOptions, ah as Err, ai as ErrorWidget, aj as FormatOptions, i as GaugeWidgetData, ak as GraphPoint, al as GraphSeries, G as GraphWidgetData, am as GridItem, an as KpiDelta, ao as KpiDeltaOptions, K as KpiWidgetData, ap as LAYOUT_ENVELOPE_VERSION, aq as LayoutItem, ar as LayoutPage, m as LayoutPersistence, as as LayoutPersistenceOptions, at as LayoutSettings, au as LoadedLayout, av as LoadingWidget, L as Locale, aw as MAX_DETAIL_PAGE_SIZE, ax as MAX_GRAPH_SERIES, ay as MAX_PAGE_ROWS, az as MAX_PAGE_TITLE_LENGTH, aA as MAX_PARSED_CLONES, aB as MAX_PARSED_PAGES, aC as MAX_PARSED_SETTINGS, aD as MAX_TEXT_OPTION_LENGTH, aE as MAX_WIDGET_OPTIONS, aF as MAX_WIDGET_TITLE_LENGTH, aG as MAX_WIDGET_VIEWS, aH as MAX_WIDGET_WIDTH, aI as MIN_WIDGET_WIDTH, N as NiceDomain, n as NormalizeOptions, aJ as NormalizeSettingsOptions, aK as NumberOption, aL as OPTION_KEY_PATTERN, aM as Ok, aN as OkWidget, aO as OptionContext, aP as OptionValue, O as OptionValues, aQ as PageRoom, aR as PlacedRow, aS as ProviderOptions, aT as ResolvedDetailOptions, R as ResolvedTableControls, aU as ResolvedWidget, aV as ResolvedWidgetLock, aW as RetryOptions, aX as SaveOptions, aY as SavedLayout, aZ as SettingsItem, a_ as SortDirection, a$ as SortOption, b0 as StorageAdapter, b1 as StorageLogEvent, b2 as StoreErrorCode, b3 as StoreResult, S as StoreScope, b4 as StoredValue, b5 as TableCell, b6 as TableColumn, T as TableWidgetData, b7 as TextOption, k as TextWidgetData, b8 as VALUE_FORMATS, b9 as VIEW_CONVERSIONS, ba as ValueFormat, bb as ViewConversion, bc as ViewsItem, bd as WIDGET_FILLS, be as WIDGET_KINDS, bf as WIDGET_OPTION_TYPES, bg as WIDGET_SIZES, bh as WIDTH_COLUMNS, bi as WidgetCache, l as WidgetData, bj as WidgetDataOf, bk as WidgetDetailOptions, bl as WidgetEmptyState, a as WidgetFill, bm as WidgetLock, bn as WidgetOption, bo as WidgetProvider, h as WidgetSettingsPatch, W as WidgetSize, bp as WidgetStatus, bq as WidgetTableControls, br as WidgetView, g as WidgetViewerSettings, bs as addPage, bt as applyClientOptions, bu as applySettings, bv as applyView, bw as assignPages, bx as baseColumnSpan, by as cacheKeyFor, bz as cleanClones, bA as clearWidgetSettings, bB as cloneNumber, bC as coerceOptionValue, bD as convertView, bE as createLayoutPersistence, bF as defaultDetailQuery, bG as defaultOptionValue, bH as defineWidget, bI as deriveDetailData, bJ as describeUnknownError, bK as effectiveDefinitions, bL as effectiveViewKey, bM as emptyTextFor, bN as emptyWidget, bO as enforceLocks, bP as err, bQ as failedWidget, bR as fillColumnSpans, bS as fillWidthSpans, bT as fillsHeight, bU as fillsWidth, bV as finalizeWidget, bW as findView, bX as fitCount, bY as formatCount, bZ as formatPercentChange, b_ as formatValue, b$ as hasPages, c0 as hasViews, c1 as hiddenWidgets, c2 as hideWidget, c3 as isClientApplied, c4 as isColumnKeyFor, c5 as isFlexible, c6 as isHidden, c7 as isIsoInterval, c8 as isMinimized, c9 as isOptionsLocked, ca as isProviderView, cb as isTitleInUse, cc as isWidgetEmptyState, cd as isWidgetKind, ce as isWidgetVisibleTo, cf as isWidgetWidth, cg as itemWidth, ch as kindLabel, ci as kpiDelta, cj as labelStride, ck as loadViewKey, cl as loadViewKind, cm as loadingWidgets, cn as memoryAdapter, co as minimizeWidget, cp as movePage, cq as moveWidget, cr as moveWidgetBy, cs as moveWidgetDown, ct as moveWidgetToPage, cu as moveWidgetUp, cv as nextPageKey, cw as niceDomain, cx as niceStep, cy as normalizeLayout, cz as normalizeSettings, cA as normalizeTitle, cB as ok, cC as optionValuesFor, cD as optionValuesFromLayout, cE as optionsCacheSuffix, cF as pageLayout, cG as pageList, cH as pageOf, cI as pageRoom, cJ as pageWidgets, cK as parseClones, cL as parseDetailQuery, cM as parseLayout, cN as parseSettings, cO as parseSortValue, cP as percentChange, cQ as placeRows, cR as pruneLayout, cS as queryRows, cT as readOnly, cU as removePage, cV as renamePage, cW as resolveDateRange, cX as resolveDetailOptions, cY as resolveOptionValues, cZ as resolvePageKey, c_ as resolvePayload, c$ as resolveTableControls, d0 as resolveWidget, d1 as resolveWidgetLock, d2 as resolveWidgetUnapplied, d3 as resolveWidgets, d4 as restoreWidget, d5 as sameOptionValues, d6 as serializeClones, d7 as serializeDetailQuery, d8 as serializeLayout, d9 as serializeSettings, da as setWidgetSettings, db as shareOf, dc as showWidget, dd as sortDefinitions, de as sortFromOptions, df as tableDetailData, dg as toggleHidden, dh as toggleMinimized, di as usesWidthColumns, dj as utf8Length, dk as validateDetailData, dl as viewChoices, dm as viewKind, dn as viewNote, dp as viewValuesFromLayout, dq as visibleWidgets, dr as widgetOptionValues, ds as widgetsFor, dt as widthForSize, du as widthRange, dv as widthShareLabel, dw as withClones, dx as withEncoding, dy as withFallback, dz as withLogging, dA as withPageLayout, dB as withPrefix, dC as withReadCache, dD as withRetry } from './storage-CRBfjiVZ.js';
3
3
 
4
4
  /**
5
5
  * Maker Toolkit compatibility. Its API (`apps/api/src/widgets`) serves
@@ -33,6 +33,52 @@ interface LegacyWidgetDefinition {
33
33
  */
34
34
  declare function fromLegacyDefinition(legacy: LegacyWidgetDefinition): WidgetDefinition | null;
35
35
 
36
+ /**
37
+ * Making and deleting clones (see `clones.ts`): the layout changes behind a
38
+ * "Duplicate" and a "Delete" control. Inputs are never mutated; a refusal is
39
+ * a `Result` with a specific message, and a no-op returns the same object.
40
+ */
41
+
42
+ /** Options for `duplicateWidget`. */
43
+ interface DuplicateOptions extends PageOptions, CloneOptions {
44
+ }
45
+ /** What `duplicateWidget` returns: the new layout and the clone's key. */
46
+ interface Duplicated {
47
+ readonly layout: DashboardLayout;
48
+ /** The new clone's key, for opening its Options dialog. */
49
+ readonly key: string;
50
+ }
51
+ /** Whether a widget (or the widget a clone copies) may be duplicated. */
52
+ declare function canDuplicate(definitions: readonly PageItem[], key: string, options?: CloneOptions): boolean;
53
+ /** `from#n`, with n one more than the highest number used for that original. */
54
+ declare function nextCloneKey(definitions: readonly {
55
+ readonly key: string;
56
+ }[], layout: {
57
+ readonly clones?: readonly WidgetClone[];
58
+ }, fromKey: string): string;
59
+ /**
60
+ * A title for a clone shown with another view: "Recent Orders Line Chart".
61
+ * Cut to the title limit.
62
+ */
63
+ declare function suggestedViewTitle(title: string, viewLabel: string): string;
64
+ /**
65
+ * Duplicates a widget into a clone placed right after it. The copy starts
66
+ * with the widget's own width, view and option values (not its title, which
67
+ * is "Title (#n)"). Cloning a clone clones the original. Refused for an
68
+ * unknown widget, when the original's `locked.clone` forbids it, and, in a
69
+ * paged layout, when the page has no room for the clone's width.
70
+ *
71
+ * Pass the definitions you render with (clones included, as `withClones`
72
+ * returns them).
73
+ */
74
+ declare function duplicateWidget<T extends PageItem>(definitions: readonly T[], layout: DashboardLayout, key: string, options?: DuplicateOptions): Result<Duplicated>;
75
+ /**
76
+ * Removes a clone from the layout: its entry, its settings, and its place in
77
+ * every order, hidden and minimized list. Originals can't be deleted (hide
78
+ * them), so any other key returns the layout unchanged.
79
+ */
80
+ declare function deleteClone(layout: DashboardLayout, key: string): DashboardLayout;
81
+
36
82
  /**
37
83
  * Loads widgets one by one, after the first render, and reports each result
38
84
  * as it arrives. It is the logic behind the React `useWidgets` hook, kept
@@ -82,6 +128,14 @@ interface WidgetLoader {
82
128
  * values don't change.
83
129
  */
84
130
  setOptions(key: string, chosen: Readonly<Record<string, unknown>>): void;
131
+ /**
132
+ * Sets the view a widget shows (`undefined` or an empty string: its
133
+ * `defaultView`). Only a view the provider supplies loads anything: the
134
+ * provider is called with that view, the card shows loading until it
135
+ * arrives, and an earlier answer for the same view comes back from the
136
+ * cache. Switching among the base and converted views reloads nothing.
137
+ */
138
+ setView(key: string, view: string | undefined): void;
85
139
  /** Aborts everything in flight and ignores any later result. */
86
140
  dispose(): void;
87
141
  }
@@ -178,4 +232,4 @@ declare function validateWidgetData(value: unknown, options?: ValidateWidgetData
178
232
  */
179
233
  declare function validateWidgetDefinition(value: unknown): Result<WidgetDefinition>;
180
234
 
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 };
235
+ export { CloneOptions, DashboardLayout, DashboardWidget, type DuplicateOptions, type Duplicated, type LegacyWidgetDefinition, MAX_REPORTED_PROBLEMS, PageItem, PageOptions, type RefreshOptions, ResolveOptions, Result, THEME_TOKEN_VARIABLES, type ThemeColorKey, type ThemeLengthKey, type ThemeMode, type ThemeOptions, type ThemeTokenKey, type ThemeTokens, type ValidateWidgetDataOptions, WidgetClone, WidgetContext, WidgetDefinition, WidgetKind, type WidgetLoader, type WidgetLoaderOptions, WidgetPayload, WidgetProviders, type WidgetThemeStyles, canDuplicate, createTheme, createWidgetLoader, deleteClone, duplicateWidget, fromLegacyDefinition, isSafeHref, isSafeImageUrl, nextCloneKey, suggestedViewTitle, upgradeLegacyWidgetData, validateWidgetData, validateWidgetDefinition };