react-semaphor 0.1.586 → 0.1.587

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.
Files changed (35) hide show
  1. package/dist/assistant-context/index.js +1 -1
  2. package/dist/briefings/index.js +1 -1
  3. package/dist/chunks/{assistant-chat-BU5gchFy.js → assistant-chat-pfJK-T0b.js} +5 -5
  4. package/dist/chunks/{bookmark-impact-ZPSGncK6.js → bookmark-impact-BSpGQL1M.js} +1 -1
  5. package/dist/chunks/{card-filter-builder-HELJWA4D.js → card-filter-builder-C8PbhHjq.js} +3 -3
  6. package/dist/chunks/{dashboard-BXP-ZxSY.js → dashboard-CVj1oMoW.js} +1 -1
  7. package/dist/chunks/{dashboard-briefing-launcher-BGj42whr.js → dashboard-briefing-launcher-TqA58rKz.js} +6 -6
  8. package/dist/chunks/{dashboard-controls-zvbRp6D2.js → dashboard-controls-DQ8FsxAz.js} +7 -7
  9. package/dist/chunks/{dashboard-json-CykexgqL.js → dashboard-json-DM88pmk2.js} +1 -1
  10. package/dist/chunks/dates-5z3b9Loo.js +136 -0
  11. package/dist/chunks/{edit-dashboard-visual-C82JNxbt.js → edit-dashboard-visual-BpRnU_6G.js} +1946 -1920
  12. package/dist/chunks/{filter-reach-copy-ZERaFKsN.js → filter-reach-copy-0Xp97cLk.js} +31 -31
  13. package/dist/chunks/{index-otMIColV.js → index-D_QSeVKy.js} +1 -1
  14. package/dist/chunks/{report-preferences-dialog-B-CoyS1x.js → report-preferences-dialog-CXKmWyLm.js} +7 -7
  15. package/dist/chunks/{resolve-dashboard-input-context-BTTdKXH0.js → resolve-dashboard-input-context-zEXuitoF.js} +2089 -2076
  16. package/dist/chunks/{saved-dashboard-context-B-rosN4W.js → saved-dashboard-context-Cll5LipJ.js} +2 -2
  17. package/dist/chunks/{semaphor-ready-indicator-Cy1n_04D.js → semaphor-ready-indicator-Bnj3H0Dm.js} +15160 -15091
  18. package/dist/chunks/{shelf-drop-preview-context-Bmz54WYm.js → shelf-drop-preview-context-B8rmn6BD.js} +2 -2
  19. package/dist/chunks/{stored-dashboard-rDJ8sw6J.js → stored-dashboard-CURqJgoa.js} +1 -1
  20. package/dist/chunks/{variable-draft-DvngkRMl.js → variable-draft-DIv-9y6Q.js} +2 -2
  21. package/dist/dashboard/index.js +1 -1
  22. package/dist/dashboard-authoring/index.js +1202 -1191
  23. package/dist/index.js +11 -11
  24. package/dist/surfboard/index.js +1 -1
  25. package/dist/types/lib/types/explorer-types.d.ts +11 -4
  26. package/dist/types/shared/dashboard-authoring/card-settings/card-display-write.d.ts +10 -3
  27. package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +1 -1
  28. package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +5 -2
  29. package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +5 -2
  30. package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +1 -0
  31. package/dist/types/shared/dashboard-authoring/index.d.ts +1 -0
  32. package/dist/types/shared/dashboard-authoring/kpi-figure.d.ts +12 -12
  33. package/dist/types/shared/dashboard-authoring/kpi-trend-rule.d.ts +74 -0
  34. package/package.json +1 -1
  35. package/dist/chunks/dates-CaqZtq01.js +0 -92
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
- import { D as U } from "./chunks/dashboard-BXP-ZxSY.js";
1
+ import { D as U } from "./chunks/dashboard-CVj1oMoW.js";
2
2
  import { C as da, E as pa } from "./chunks/bookmark-state-CL4WEpgB.js";
3
- import { C as V, b as z, c as H, d as W, e as G, f as $ } from "./chunks/report-preferences-dialog-B-CoyS1x.js";
4
- import { g as ha, A as ma, h as ga, a as Ca, R as ba, D as ya } from "./chunks/report-preferences-dialog-B-CoyS1x.js";
3
+ import { C as V, b as z, c as H, d as W, e as G, f as $ } from "./chunks/report-preferences-dialog-CXKmWyLm.js";
4
+ import { g as ha, A as ma, h as ga, a as Ca, R as ba, D as ya } from "./chunks/report-preferences-dialog-CXKmWyLm.js";
5
5
  import { jsx as r, jsxs as b } from "react/jsx-runtime";
6
- import { E as R, F as q, S as K, a as Q, U as Y, c as J, A as X, C as Z, u as I, f as ee, d as ae, V as se, e as P, g as N, h as te, s as re, R as oe } from "./chunks/semaphor-ready-indicator-Cy1n_04D.js";
7
- import { a3 as va, aJ as Ea, aK as Aa, aL as Sa, B as Ta, ai as wa, _ as xa, Y as Fa, X as Ba, aT as _a, v as Ra, t as Pa, M as Na, a7 as La, k as Ia, n as Oa, n as ja, o as Ma, Z as ka, x as Ua, y as Va, T as za, w as Ha, aE as Wa, aG as Ga, aH as $a, aF as qa, av as Ka, ay as Qa, aS as Ya, am as Ja, aD as Xa, af as Za, aN as es, aO as as, aq as ss, az as ts, W as rs, Q as os, O as ns, P as is, z as ls, aW as cs, al as us, aA as ds, aB as ps, au as fs, ax as hs, aR as ms, aQ as gs, aP as Cs, aV as bs, aU as ys, aw as Ds, ak as vs, aj as Es, a6 as As, ao as Ss, aC as Ts, as as ws, ap as xs, ar as Fs, at as Bs, a8 as _s, a9 as Rs, aa as Ps, G as Ns, an as Ls, a4 as Is, a2 as Os, N as js, aM as Ms, r as ks, a0 as Us, ab as Vs, ad as zs, ac as Hs, ae as Ws, q as Gs, L as $s, j as qs, $ as Ks, a1 as Qs, l as Ys, ah as Js, a5 as Xs, ag as Zs, i as et, H as at, p as st, m as tt, I as rt, J as ot, K as nt, aI as it } from "./chunks/semaphor-ready-indicator-Cy1n_04D.js";
6
+ import { E as R, F as q, S as K, a as Q, U as Y, c as J, A as X, C as Z, u as I, f as ee, d as ae, V as se, e as P, g as N, h as te, s as re, R as oe } from "./chunks/semaphor-ready-indicator-Bnj3H0Dm.js";
7
+ import { a3 as va, aJ as Ea, aK as Aa, aL as Sa, B as Ta, ai as wa, _ as xa, Y as Fa, X as Ba, aT as _a, v as Ra, t as Pa, M as Na, a7 as La, k as Ia, n as Oa, n as ja, o as Ma, Z as ka, x as Ua, y as Va, T as za, w as Ha, aE as Wa, aG as Ga, aH as $a, aF as qa, av as Ka, ay as Qa, aS as Ya, am as Ja, aD as Xa, af as Za, aN as es, aO as as, aq as ss, az as ts, W as rs, Q as os, O as ns, P as is, z as ls, aW as cs, al as us, aA as ds, aB as ps, au as fs, ax as hs, aR as ms, aQ as gs, aP as Cs, aV as bs, aU as ys, aw as Ds, ak as vs, aj as Es, a6 as As, ao as Ss, aC as Ts, as as ws, ap as xs, ar as Fs, at as Bs, a8 as _s, a9 as Rs, aa as Ps, G as Ns, an as Ls, a4 as Is, a2 as Os, N as js, aM as Ms, r as ks, a0 as Us, ab as Vs, ad as zs, ac as Hs, ae as Ws, q as Gs, L as $s, j as qs, $ as Ks, a1 as Qs, l as Ys, ah as Js, a5 as Xs, ag as Zs, i as et, H as at, p as st, m as tt, I as rt, J as ot, K as nt, aI as it } from "./chunks/semaphor-ready-indicator-Bnj3H0Dm.js";
8
8
  import * as T from "react";
9
9
  import O, { useMemo as w, useEffect as j } from "react";
10
10
  import { C as ct, D as ut, L as dt, d as pt, g as ft, h as ht, e as mt, f as gt, c as Ct, a as bt, i as yt, b as Dt, n as vt, s as Et } from "./chunks/validators-CJ8Jh0E8.js";
@@ -16,23 +16,23 @@ import "./chunks/analytics-base-schemas-BaIQrEzX.js";
16
16
  import "./value-format-preferences/index.js";
17
17
  import { D as ne } from "./chunks/index-CV_Kzou0.js";
18
18
  import { D as St } from "./chunks/token-types-DEe_FP4l.js";
19
- import { d as wt, A as xt, b as Ft, m as Bt, e as _t, D as Rt, g as Pt, h as Nt, j as Lt, f as It, S as Ot, U as jt, l as Mt, a as kt, V as Ut, W as Vt, i as zt, u as Ht, k as Wt, c as Gt } from "./chunks/dashboard-briefing-launcher-BGj42whr.js";
19
+ import { d as wt, A as xt, b as Ft, m as Bt, e as _t, D as Rt, g as Pt, h as Nt, j as Lt, f as It, S as Ot, U as jt, l as Mt, a as kt, V as Ut, W as Vt, i as zt, u as Ht, k as Wt, c as Gt } from "./chunks/dashboard-briefing-launcher-TqA58rKz.js";
20
20
  import { n as qt, s as Kt, u as Qt } from "./chunks/normalize-dashboard-for-dirty-check-XKgH3GFX.js";
21
21
  import { createRoot as ie } from "react-dom/client";
22
- import "./chunks/shelf-drop-preview-context-Bmz54WYm.js";
22
+ import "./chunks/shelf-drop-preview-context-B8rmn6BD.js";
23
23
  import { c as B } from "./chunks/pickers-DkqmtnTL.js";
24
24
  import { D as Jt } from "./chunks/report-runtime-context-NlOXwyRB.js";
25
25
  import { e as le, f as ce, B as ue, F as de, h as pe, j as fe } from "./chunks/style-sheet-parts-_dGSFzDi.js";
26
- import { B as Zt, v as er, D as ar, C as sr, G as tr, H as rr, A as or, z as nr, E as ir, y as lr, x as cr, w as ur, I as dr, F as pr } from "./chunks/resolve-dashboard-input-context-BTTdKXH0.js";
26
+ import { B as Zt, v as er, D as ar, C as sr, G as tr, H as rr, A as or, z as nr, E as ir, y as lr, x as cr, w as ur, I as dr, F as pr } from "./chunks/resolve-dashboard-input-context-zEXuitoF.js";
27
27
  import { r as hr, a as mr } from "./chunks/pivot-result-identity-Bvs6Uq3v.js";
28
- import { k as he } from "./chunks/stored-dashboard-rDJ8sw6J.js";
28
+ import { k as he } from "./chunks/stored-dashboard-CURqJgoa.js";
29
29
  import "./chunks/schema-C9NPiIru.js";
30
30
  import "./chunks/context-BTLBjQNh.js";
31
31
  import "./chunks/attribution-BvoKvhcj.js";
32
32
  import "react-dom";
33
- import "./chunks/index-otMIColV.js";
33
+ import "./chunks/index-D_QSeVKy.js";
34
34
  import "./chunks/appearance-context-BwBp25ZG.js";
35
- import { I as me } from "./chunks/card-filter-builder-HELJWA4D.js";
35
+ import { I as me } from "./chunks/card-filter-builder-C8PbhHjq.js";
36
36
  import "./chunks/appearance-runtime-provider-BRHYELkC.js";
37
37
  const ge = { cssWidth: 960, cssHeight: 540 };
38
38
  function ra(e) {
@@ -1,4 +1,4 @@
1
- import { a, R as s, D as o } from "../chunks/report-preferences-dialog-B-CoyS1x.js";
1
+ import { a, R as s, D as o } from "../chunks/report-preferences-dialog-CXKmWyLm.js";
2
2
  import { C as f, E as D } from "../chunks/bookmark-state-CL4WEpgB.js";
3
3
  export {
4
4
  f as CONTROL_CARD_DEFAULT_VALUE,
@@ -620,11 +620,18 @@ export interface CardConfig {
620
620
  breakdownDimensions?: GroupByField[];
621
621
  };
622
622
  /**
623
- * A KPI's band (KPI tile layout KL-D29): `trend` shows the value's last
624
- * periods under it, `none` shows nothing; absent, the band follows the
625
- * card's summary and target. Written by `writeKpiBand`.
623
+ * A KPI's Trend switch (KPI trend window KT-D16): `trend` draws the value's
624
+ * trend under it; absent, the band follows the card's summary and target.
625
+ * Written by `writeKpiTrend`.
626
626
  */
627
- kpiBand?: 'trend' | 'none';
627
+ kpiBand?: 'trend';
628
+ /**
629
+ * The grain of a KPI's trend when it has no Trend By (KPI trend window
630
+ * KT-D2): absent is Automatic, picked from the period the KPI counts. A
631
+ * Trend By's own grain wins over it. Read by the server's trend; its writer
632
+ * comes with the editor's Grain control (KT-D12).
633
+ */
634
+ kpiTrendGrain?: 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
628
635
  rowAggregates?: Array<{
629
636
  label?: string;
630
637
  function: AggregateFunction;
@@ -1,3 +1,4 @@
1
+ import { KpiTrendGrain } from '../kpi-trend-rule.js';
1
2
  import { TChartType } from '../../../lib/charts/types.js';
2
3
  import { AxisConfig, TCard, TCardPreferences, TLegendOptions } from '../../../lib/types/common-types.js';
3
4
  import { SemaphorValueFormat } from '../../analytics-protocol/contracts.js';
@@ -30,10 +31,16 @@ export declare function writeChartOrientation<T extends Pick<TCard, 'type' | 'pr
30
31
  */
31
32
  export declare function writeCardVariant<T extends Pick<TCard, 'type' | 'preferences'>>(card: T, variant: CardVariant): T;
32
33
  /**
33
- * A KPI's band (KPI tile layout KL-D29), as the KPI settings' band control
34
- * writes it: `trend` or `none`, or null for Automatic, which stores nothing.
34
+ * A KPI's Trend switch (KPI trend window KT-D16), as the editor's switch and
35
+ * the MCP's `trend` write it: on stores `kpiBand: 'trend'`, off stores nothing.
35
36
  */
36
- export declare function writeKpiBand<T extends Pick<TCard, 'config'>>(card: T, band: 'trend' | 'none' | null): T;
37
+ export declare function writeKpiTrend<T extends Pick<TCard, 'config'>>(card: T, on: boolean): T;
38
+ /**
39
+ * A KPI trend's grain when it has no Trend By (KPI trend window KT-D2,
40
+ * KT-D12), as the editor's Grain control and the MCP's `trendGrain` write it:
41
+ * a grain, or null for Automatic, which stores nothing.
42
+ */
43
+ export declare function writeKpiTrendGrain<T extends Pick<TCard, 'config'>>(card: T, grain: KpiTrendGrain | null): T;
37
44
  /**
38
45
  * A config table's totals (table overall totals OT-D16): the row on or off,
39
46
  * and each named measure's total, keyed by its result alias. Overall is the
@@ -1,6 +1,6 @@
1
1
  import { TCard } from '../../../lib/types/common-types.js';
2
2
  import { CardType } from '../changes/card-types.js';
3
- export type SettingName = 'columns.label' | 'columns.format' | 'columns.hidden' | 'columns.width' | 'orientation' | 'stack' | 'donut' | 'totals' | 'dataLabels' | 'legend' | 'axes' | 'highlights' | 'columns.polarity' | 'comparisonDisplay' | 'inheritComparison' | 'band' | 'seeRecords';
3
+ export type SettingName = 'columns.label' | 'columns.format' | 'columns.hidden' | 'columns.width' | 'orientation' | 'stack' | 'donut' | 'totals' | 'dataLabels' | 'legend' | 'axes' | 'highlights' | 'columns.polarity' | 'comparisonDisplay' | 'inheritComparison' | 'trend' | 'trendGrain' | 'seeRecords';
4
4
  export declare const SETTINGS_BY_KIND: Readonly<Record<CardType, readonly SettingName[]>>;
5
5
  export type CardSettingsKind = {
6
6
  type: CardType;
@@ -1,3 +1,4 @@
1
+ import { KpiTrendGrain } from '../kpi-trend-rule.js';
1
2
  import { MetricComparisonPolarity } from '../../analytics-protocol/metric-comparison.js';
2
3
  import { TableColumnTotal } from '../measure-calculations/table-column-total.js';
3
4
  import { SemaphorDateValueFormat, SemaphorDurationValueFormat, SemaphorNumericValueFormat, SemaphorValueFormat, TemporalBucketFormat } from '../../analytics-protocol/contracts.js';
@@ -74,8 +75,10 @@ export type CardSettingsInput = {
74
75
  comparisonDisplay?: ComparisonDisplayInput;
75
76
  /** false: measures without a comparison of their own ignore the dashboard's; true removes the stored opt-out (RC-D16). */
76
77
  inheritComparison?: boolean;
77
- /** A KPI's band (KPI tile layout KL-D29): `trend` needs a Trend By; `automatic` follows the summary and target. */
78
- band?: 'automatic' | 'trend' | 'none';
78
+ /** A KPI's Trend switch (KPI trend window KT-D16): on draws its trend on the date it counts (KT-D1); off follows the summary and target. */
79
+ trend?: boolean;
80
+ /** A KPI trend's grain when it has no Trend By (KT-D2, KT-D12): `automatic` fits it to the period the KPI counts. */
81
+ trendGrain?: 'automatic' | KpiTrendGrain;
79
82
  /** false: viewers can't open the records behind the card's numbers; true removes the stored opt-out (see-records SR-D4). */
80
83
  seeRecords?: boolean;
81
84
  };
@@ -1,3 +1,4 @@
1
+ import { KpiTrendGrain } from '../kpi-trend-rule.js';
1
2
  import { SemaphorValueFormat } from '../../analytics-protocol/contracts.js';
2
3
  import { CardColumnRef, ConditionalRule } from '../conditional-formatting/types.js';
3
4
  import { AxisConfigKey, CardVariant } from './card-display-write.js';
@@ -51,8 +52,10 @@ export type ResolvedCardSettings = {
51
52
  comparisonDisplay?: ResolvedComparisonDisplay;
52
53
  /** Whether measures without a comparison of their own follow the dashboard's (RC-D16). */
53
54
  inheritComparison?: boolean;
54
- /** A KPI's band (KL-D29); null returns it to Automatic. */
55
- band?: 'trend' | 'none' | null;
55
+ /** A KPI's Trend switch (KT-D16). */
56
+ trend?: boolean;
57
+ /** A KPI trend's grain (KT-D12); null returns it to Automatic. */
58
+ trendGrain?: KpiTrendGrain | null;
56
59
  /** Whether viewers can open the records behind the card's numbers (see-records SR-D4). */
57
60
  seeRecords?: boolean;
58
61
  };
@@ -153,6 +153,7 @@ export declare const CARD_CONFIG_KEY_CLASSES: {
153
153
  readonly detailTableBackup: "presentation";
154
154
  readonly summary: "presentation";
155
155
  readonly kpiBand: "presentation";
156
+ readonly kpiTrendGrain: "presentation";
156
157
  readonly rowAggregates: "presentation";
157
158
  readonly columnAggregates: "presentation";
158
159
  };
@@ -57,6 +57,7 @@ export * from './card-formats/sql-date-pattern.js';
57
57
  export * from './retired-presentation-fields.js';
58
58
  export * from './conditional-formatting/index.js';
59
59
  export * from './kpi-figure.js';
60
+ export * from './kpi-trend-rule.js';
60
61
  export * from './kpi-date-context.js';
61
62
  export * from './see-records/index.js';
62
63
  export * from './card-settings/index.js';
@@ -2,8 +2,8 @@ import { TCard } from '../../lib/types/common-types.js';
2
2
  import { CardConfig, MetricField } from '../../lib/types/explorer-types.js';
3
3
  import { ComparisonMetadataMap } from '../../lib/types/query-types.js';
4
4
  import { MetricComparisonEvaluation, MetricComparisonPolarity } from '../analytics-protocol/index.js';
5
- import { TemporalBucketMetadata } from '../analytics-protocol/contracts.js';
6
5
  import { KpiDateContext } from './kpi-date-context.js';
6
+ import { KpiTrendMetadata, KpiTrendPartial } from './kpi-trend-rule.js';
7
7
  type KpiCard = Pick<TCard, 'sql' | 'config' | 'preferences'>;
8
8
  /**
9
9
  * Which column is the value, by source. The shape reads ids, never formats, so
@@ -74,35 +74,35 @@ export type KpiResultSegment = {
74
74
  metricId: string;
75
75
  /** The period's start as a canonical bucket value: `2026-10-01`, or `2026-10-01T14:00:00` below a day. */
76
76
  bucket: string;
77
- /** The point covers less than its whole period: cut by the value's window, or still running. */
78
- partial?: boolean;
77
+ /** The point covers less than its whole period, and how (KPI trend window KT-D9); absent for a whole period. */
78
+ partial?: KpiTrendPartial;
79
79
  };
80
- /** How many periods a trend shows (KL-D28). */
81
- export declare const KPI_TREND_PERIODS = 12;
82
80
  /** A config KPI's Trend By: its date grouping, the field its comparison and trend run over. */
83
81
  export declare function kpiTrendBy(config: Pick<CardConfig, 'groupByColumns'> | undefined): import('../../components/index.js').GroupByField | undefined;
84
82
  /**
85
83
  * Whether a config KPI shows a trend under its value (KL-D29): the author
86
- * chose Trend and it has a Trend By. The server runs the trend query and the
87
- * tile draws the band on the same answer.
84
+ * chose Trend. It runs on the date the KPI counts on, a Trend By or not (KPI
85
+ * trend window KT-D1): the server runs the trend when that date resolves and
86
+ * the tile draws the band on the same answer.
88
87
  */
89
88
  export declare function kpiShowsTrend(card: Pick<TCard, 'sql' | 'config'>): boolean;
90
89
  export type KpiTrendPoint = {
91
90
  bucket: string;
92
91
  value: number | null;
93
- partial: boolean;
92
+ /** Absent for a whole period (KT-D9). */
93
+ partial?: KpiTrendPartial;
94
94
  };
95
- /** The trend's points, oldest first, and the grain and calendar they are counted in. */
95
+ /** The trend's points, oldest first, and the grain, calendar, grain source and span they are counted in. */
96
96
  export type KpiTrend = {
97
- metadata: TemporalBucketMetadata;
97
+ metadata: KpiTrendMetadata;
98
98
  points: KpiTrendPoint[];
99
99
  };
100
100
  /** The metadata a config KPI response carries beside its rows. */
101
101
  export type KpiResultMetadata = {
102
102
  kpiLayout: KpiLayout;
103
103
  comparisonMetadata?: ComparisonMetadataMap;
104
- /** The trend's grain and calendar, when the response has trend rows (KL-D28). */
105
- trend?: TemporalBucketMetadata;
104
+ /** The trend's grain, calendar, grain source and span, when the card shows a trend (KL-D28, KT-D9). */
105
+ trend?: KpiTrendMetadata;
106
106
  /** Which date it counts, its windows and its compared period (KPI date context KD-D1). */
107
107
  dateContext?: KpiDateContext;
108
108
  };
@@ -0,0 +1,74 @@
1
+ import { CardConfig } from '../../lib/types/explorer-types.js';
2
+ import { TemporalBucketMetadata } from '../analytics-protocol/contracts.js';
3
+ /** A grain a KPI's trend draws in (KT-D2): the Trend By's, the card's or Automatic's. */
4
+ export type KpiTrendGrain = NonNullable<CardConfig['kpiTrendGrain']>;
5
+ export declare const KPI_TREND_GRAINS: readonly KpiTrendGrain[];
6
+ /** How many periods a history or recent span shows (KT-D4, as KL-D28). */
7
+ export declare const KPI_TREND_PERIODS = 12;
8
+ /** The most periods a trend draws; past it the trend runs no query (KT-D8). */
9
+ export declare const KPI_TREND_MAX_POINTS = 400;
10
+ /** Where the trend's grain came from (KT-D2). */
11
+ export type KpiTrendGrainSource = 'trend_by' | 'card' | 'automatic';
12
+ /**
13
+ * What the trend's periods cover (KT-D4): the period the KPI counts, cut into
14
+ * periods (`window`); the 12 periods ending with it when it is one period of
15
+ * the grain (`history`); the 12 ending now when it counts all time (`recent`).
16
+ */
17
+ export type KpiTrendSpan = 'window' | 'history' | 'recent';
18
+ /**
19
+ * A point that covers less than its whole period (KT-D9): still running at the
20
+ * reference time, cut by the counted period's start, or cut by its end.
21
+ */
22
+ export type KpiTrendPartial = 'running' | 'start' | 'end';
23
+ /**
24
+ * The trend's grain and calendar, as every grouped date names its buckets
25
+ * (KPI tile layout ledger H-4), with where the grain came from and what the
26
+ * periods cover. `skipped` says why a trend the card shows has no rows.
27
+ */
28
+ export type KpiTrendMetadata = TemporalBucketMetadata & {
29
+ grainSource: KpiTrendGrainSource;
30
+ span: KpiTrendSpan;
31
+ skipped?: 'too_many_points';
32
+ /**
33
+ * The counted period the periods were cut to (window and history spans):
34
+ * a point cut at its start or end names that date from here (ledger ED-02).
35
+ * Absent for a recent span, which has no counted period.
36
+ */
37
+ window?: {
38
+ startInclusive: string;
39
+ endExclusive: string;
40
+ };
41
+ };
42
+ /**
43
+ * Automatic's grain (KT-D3) from the length of the period the KPI counts:
44
+ * up to 2 days by hour, 62 days by day, 26 weeks by week, 3 years by month,
45
+ * 12 years by quarter, longer by year; with no period, by month. Hour only
46
+ * when the date holds a time (KT-D7); otherwise day is the finest.
47
+ */
48
+ export declare function automaticKpiTrendGrain(window: {
49
+ startInclusive: string;
50
+ endExclusive: string;
51
+ } | undefined, holdsTime: boolean): KpiTrendGrain;
52
+ /**
53
+ * About how many points a grain draws over a counted period, for the editor's
54
+ * Grain menu to disable a grain past the limit (KT-D8, ledger ED-03). An
55
+ * estimate: the server counts the periods exactly and skips past the limit.
56
+ */
57
+ export declare function estimateKpiTrendPoints(window: {
58
+ startInclusive: string;
59
+ endExclusive: string;
60
+ }, grain: KpiTrendGrain): number;
61
+ /** The editor's Trend row under the Date section (KT-D11): what the line draws and where its grain came from. */
62
+ export type KpiTrendRowWords = {
63
+ head: string;
64
+ detail: string;
65
+ };
66
+ /**
67
+ * The Trend row's words, from the response's trend metadata and its point
68
+ * count: "By week · 14 points" over "Aug 6 – Nov 3 · Automatic"; the history
69
+ * and recent spans in words; a skipped trend with its fix. Undefined when the
70
+ * response has no trend metadata (no date: the Date section says why).
71
+ */
72
+ export declare function describeKpiTrendRow(metadata: KpiTrendMetadata | undefined, points: number, options?: {
73
+ now?: Date;
74
+ }): KpiTrendRowWords | undefined;
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.1.586",
8
+ "version": "0.1.587",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",
@@ -1,92 +0,0 @@
1
- import { h as D, d as F, r as b, a as f, e as g } from "./resolve-dashboard-input-context-BTTdKXH0.js";
2
- import { d as h } from "./filter-reach-copy-ZERaFKsN.js";
3
- import "./validators-CJ8Jh0E8.js";
4
- import "./matrix-operation-contract-BM5TveR3.js";
5
- import "./analytics-base-schemas-BaIQrEzX.js";
6
- import "zod";
7
- import "./pivot-result-contract-expectations-Bx_BCu-7.js";
8
- import "../value-format-preferences/index.js";
9
- import { A as y } from "./bookmark-state-CL4WEpgB.js";
10
- import "./schema-C9NPiIru.js";
11
- import "./index-CV_Kzou0.js";
12
- import "./context-BTLBjQNh.js";
13
- import { p as C, r as N } from "./stored-dashboard-rDJ8sw6J.js";
14
- import { g as q } from "./saved-dashboard-context-B-rosN4W.js";
15
- function T(n, e) {
16
- var s;
17
- if (e.status === "blocked" || (s = n.sql) != null && s.trim()) return !1;
18
- const i = new Set(
19
- e.mappingDispositions.flatMap(
20
- (t) => t.status === "apply" ? [t.filterValue.filterId] : []
21
- )
22
- );
23
- return e.cardFilterValues.some((t) => {
24
- const a = e.queryFilterDefinitions.find(
25
- (o) => o.id === t.filterId
26
- );
27
- if (!D(t)) return !1;
28
- if (!(i.has(t.filterId) || (a == null ? void 0 : a.kind) === "global-date"))
29
- return !!(a && w(
30
- [a],
31
- e.resolvedPrimaryDateField,
32
- [t]
33
- ));
34
- const l = F(t);
35
- return !!(l && b({
36
- card: n,
37
- filter: l,
38
- filterValue: t,
39
- effectiveFilterValue: t,
40
- temporalBinding: e.resolvedPrimaryDateField
41
- }).status === "eligible");
42
- });
43
- }
44
- function w(n, e, i) {
45
- if (!e) return !1;
46
- const s = e.qualifiedFieldName, t = e.qualifiedEntityName, a = t && e.name ? `${t}.${e.name}` : s;
47
- return n.some((r) => {
48
- if (!(f(r.dataType || "") === "date")) return !1;
49
- const o = h(r, i), d = o.split("."), u = d[d.length - 1] || o, p = d.length > 1 ? d.slice(0, -1).join(".") : void 0, c = r.qualifiedTableName || p, m = c ? `${c}.${u}` : void 0;
50
- return s ? m ? m === a || m.endsWith(`.${s}`) : u === e.name : m ? m === a : u === e.name;
51
- });
52
- }
53
- function P(n, e) {
54
- const i = (a) => {
55
- const r = a.field;
56
- return r ? e.id && r.id === e.id ? !0 : e.qualifiedFieldName && r.qualifiedFieldName ? r.qualifiedFieldName === e.qualifiedFieldName : r.name === e.name : !1;
57
- }, s = (a) => a.conditions.some((r) => {
58
- var l;
59
- return f(((l = r.field) == null ? void 0 : l.dataType) || "") === "date" && i(r);
60
- }) || a.groups.some(s), t = g(n);
61
- return t ? s(t) : !1;
62
- }
63
- function v(n, e) {
64
- var l, o;
65
- const i = (o = (l = n.config) == null ? void 0 : l.groupByColumns) == null ? void 0 : o.find((d) => f(d.dataType || "") === "date"), s = e.resolvedPrimaryDateField, t = i ? { id: i.id, name: i.name, label: i.label || i.name, qualifiedFieldName: i.qualifiedFieldName } : s ? { name: s.name, label: s.name, qualifiedFieldName: s.qualifiedFieldName } : void 0;
66
- if (!t) return { comparisonDate: null, dateWindow: e.status === "ready" ? "none" : "unknown" };
67
- const a = { name: t.name, label: t.label };
68
- if (P(n, t)) return { comparisonDate: a, dateWindow: "applies" };
69
- if (e.status !== "ready") return { comparisonDate: a, dateWindow: "unknown" };
70
- const r = T(n, { status: "ready", ...e.compiledFilters });
71
- return { comparisonDate: a, dateWindow: r ? "applies" : "none" };
72
- }
73
- function z(n) {
74
- const e = C(n.dashboard), i = y(e).find((r) => r.cardId === n.cardId);
75
- if (!i || i.kind === "documentSectionCard") return { comparisonDate: null, dateWindow: "unknown" };
76
- const { runtimeValues: s, transientContexts: t } = N({ dashboard: e, capture: {}, calendar: n.calendar }), a = q({
77
- dashboard: e,
78
- location: i,
79
- runtimeValues: s,
80
- semanticExecutionPayload: n.semanticExecutionPayload,
81
- calendar: n.calendar,
82
- transientContexts: t
83
- });
84
- return v(
85
- i.card,
86
- (a == null ? void 0 : a.status) === "ready" ? { status: "ready", compiledFilters: a.compiledFilters, resolvedPrimaryDateField: a.resolvedPrimaryDateField } : { status: "blocked", resolvedPrimaryDateField: a == null ? void 0 : a.resolvedPrimaryDateField }
87
- );
88
- }
89
- export {
90
- z as a,
91
- v as r
92
- };