react-semaphor 0.1.585 → 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 (49) hide show
  1. package/dist/analytics-protocol/index.js +102 -100
  2. package/dist/assistant-context/index.js +1 -1
  3. package/dist/briefings/index.js +1 -1
  4. package/dist/chunks/{assistant-chat-BdbLmAnK.js → assistant-chat-pfJK-T0b.js} +6 -6
  5. package/dist/chunks/{bookmark-impact-BhT3k379.js → bookmark-impact-BSpGQL1M.js} +1 -1
  6. package/dist/chunks/{card-filter-builder-CEcKF6Fw.js → card-filter-builder-C8PbhHjq.js} +165 -165
  7. package/dist/chunks/{dashboard-MPku_x1M.js → dashboard-CVj1oMoW.js} +1 -1
  8. package/dist/chunks/{dashboard-briefing-launcher-CkFNlkr1.js → dashboard-briefing-launcher-TqA58rKz.js} +7 -7
  9. package/dist/chunks/{dashboard-controls-Clt4ovXS.js → dashboard-controls-DQ8FsxAz.js} +7 -7
  10. package/dist/chunks/{dashboard-json-DSmXazIg.js → dashboard-json-DM88pmk2.js} +1 -1
  11. package/dist/chunks/dates-5z3b9Loo.js +136 -0
  12. package/dist/chunks/{edit-dashboard-visual-Dn2ECRbX.js → edit-dashboard-visual-BpRnU_6G.js} +2291 -2265
  13. package/dist/chunks/{filter-reach-copy-CmJpPa4G.js → filter-reach-copy-0Xp97cLk.js} +879 -862
  14. package/dist/chunks/{index-0WYn6RMz.js → index-D_QSeVKy.js} +1 -1
  15. package/dist/chunks/{matrix-analytical-definition-QjBgUYhP.js → matrix-analytical-definition-DOVSFFuf.js} +179 -169
  16. package/dist/chunks/{report-preferences-dialog-BRaeufEi.js → report-preferences-dialog-CXKmWyLm.js} +7 -7
  17. package/dist/chunks/{resolve-dashboard-input-context-Cn9jumxl.js → resolve-dashboard-input-context-zEXuitoF.js} +10328 -10237
  18. package/dist/chunks/{saved-dashboard-context-CfqkUMzR.js → saved-dashboard-context-Cll5LipJ.js} +75 -72
  19. package/dist/chunks/{semaphor-ready-indicator-D6WjdTGl.js → semaphor-ready-indicator-Bnj3H0Dm.js} +23983 -23726
  20. package/dist/chunks/{shelf-drop-preview-context-Bbbrr9u4.js → shelf-drop-preview-context-B8rmn6BD.js} +2 -2
  21. package/dist/chunks/{stored-dashboard-sPkTjxYf.js → stored-dashboard-CURqJgoa.js} +600 -595
  22. package/dist/chunks/{variable-draft-D1RotIEG.js → variable-draft-DIv-9y6Q.js} +3 -3
  23. package/dist/chunks/{visual-choice-JiJ-_3bi.js → visual-choice-BBPizkRo.js} +74 -72
  24. package/dist/dashboard/index.js +1 -1
  25. package/dist/dashboard-authoring/index.js +1201 -1182
  26. package/dist/index.js +11 -11
  27. package/dist/style.css +1 -1
  28. package/dist/surfboard/index.js +1 -1
  29. package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-authoring.d.ts +86 -3
  30. package/dist/types/lib/dashboard-inputs/resolve-selection-input.d.ts +49 -27
  31. package/dist/types/lib/query-context/compile-dashboard-card-filters.d.ts +7 -0
  32. package/dist/types/lib/query-context/dashboard-filter-mapping-resolution.d.ts +30 -2
  33. package/dist/types/lib/types/explorer-types.d.ts +11 -4
  34. package/dist/types/shared/analytics-protocol/click-reach-filter-id.d.ts +9 -0
  35. package/dist/types/shared/analytics-protocol/filter-field-ownership.d.ts +3 -1
  36. package/dist/types/shared/analytics-protocol/index.d.ts +1 -0
  37. package/dist/types/shared/dashboard-authoring/card-settings/card-display-write.d.ts +10 -3
  38. package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +1 -1
  39. package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +5 -2
  40. package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +5 -2
  41. package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +1 -0
  42. package/dist/types/shared/dashboard-authoring/click-to-filter-card-decision.d.ts +102 -0
  43. package/dist/types/shared/dashboard-authoring/filter-reach-copy.d.ts +13 -1
  44. package/dist/types/shared/dashboard-authoring/index.d.ts +2 -0
  45. package/dist/types/shared/dashboard-authoring/kpi-figure.d.ts +12 -12
  46. package/dist/types/shared/dashboard-authoring/kpi-trend-rule.d.ts +74 -0
  47. package/dist/types/shared/dashboard-authoring/semantic-auto-join-card.d.ts +13 -0
  48. package/package.json +2 -2
  49. package/dist/chunks/dates-CYZW9owO.js +0 -92
@@ -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;
@@ -1,5 +1,6 @@
1
1
  import { TFilterValue } from '../../components/surfboard/filter/types.js';
2
2
  import { TCard } from '../../lib/types/common-types.js';
3
+ import { DashboardCardFilterSourceInventory } from './dashboard-card-source-index.js';
3
4
  /**
4
5
  * Where relationship filter reach runs (relationship filter reach RF-D18): a
5
6
  * card on a semantic domain with no explicit join plan. The join plan is read
@@ -20,3 +21,15 @@ export declare function filterValueSemanticDataset(value: Pick<TFilterValue, 'fi
20
21
  domainId: string;
21
22
  datasetName: string;
22
23
  } | undefined;
24
+ /**
25
+ * Row 7r (relationship filter reach): a dataset reaches a card through its
26
+ * domain's relationships when the card is a semantic auto-join config card in
27
+ * that dataset's domain and executes no source of that dataset. The browser
28
+ * only decides to send a value; the server decides the route. A toolbar
29
+ * filter asks it with its value's dataset (`decideDashboardFilterCardTarget`),
30
+ * a click with the clicked field's (click relationship reach CR-D14).
31
+ */
32
+ export declare function cardReachesDatasetThroughRelationships(card: Parameters<typeof isSemanticAutoJoinCard>[0], dataset: {
33
+ domainId: string;
34
+ datasetName: string;
35
+ } | undefined, sourceIndex: DashboardCardFilterSourceInventory): boolean;
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.1.585",
8
+ "version": "0.1.587",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",
@@ -117,7 +117,7 @@
117
117
  "build": "node scripts/build.mjs",
118
118
  "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
119
119
  "lint:regressions": "node scripts/lint-regressions.mjs",
120
- "check:guards": "node scripts/card-config-consumers.mjs && node scripts/components-entry-imports.mjs && node scripts/types-entry-imports.mjs && node scripts/card-query-assembly-imports.mjs && node scripts/matrix-conversion-imports.mjs && node scripts/legacy-table-type-references.mjs && node scripts/assistant-chat-imports.mjs && node scripts/filter-model-reads.mjs && node scripts/kpi-figure-reads.mjs && node scripts/layout-engine.mjs && node scripts/text-variable-refs.mjs && node scripts/data-variable-derivation.mjs && node scripts/variable-name-allocation.mjs && node scripts/unreached-modules.mjs && node scripts/dashboard-style-reads.mjs",
120
+ "check:guards": "node scripts/card-config-consumers.mjs && node scripts/components-entry-imports.mjs && node scripts/types-entry-imports.mjs && node scripts/card-query-assembly-imports.mjs && node scripts/matrix-conversion-imports.mjs && node scripts/legacy-table-type-references.mjs && node scripts/assistant-chat-imports.mjs && node scripts/filter-model-reads.mjs && node scripts/kpi-figure-reads.mjs && node scripts/layout-engine.mjs && node scripts/text-variable-refs.mjs && node scripts/data-variable-derivation.mjs && node scripts/variable-name-allocation.mjs && node scripts/unreached-modules.mjs && node scripts/dashboard-style-reads.mjs && node scripts/host-color-variables.mjs",
121
121
  "preview": "vite preview",
122
122
  "test": "vitest run",
123
123
  "test:changed": "vitest run --changed",
@@ -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-Cn9jumxl.js";
2
- import { d as h } from "./filter-reach-copy-CmJpPa4G.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-sPkTjxYf.js";
14
- import { g as q } from "./saved-dashboard-context-CfqkUMzR.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
- };