react-semaphor 0.1.560 → 0.1.561

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 (107) hide show
  1. package/dist/analytics-protocol/index.js +353 -349
  2. package/dist/assistant-context/index.js +1 -1
  3. package/dist/assistant-protocol/index.js +5 -5
  4. package/dist/brand-studio/index.js +9 -9
  5. package/dist/briefings/index.js +5 -5
  6. package/dist/chunks/{analytics-base-schemas-CHLxsPfX.js → analytics-base-schemas-CB3oFAXk.js} +199 -171
  7. package/dist/chunks/{assistant-chat-Bu2fFm_I.js → assistant-chat-DiVHY3Hw.js} +27 -28
  8. package/dist/chunks/bookmark-impact-CR09dpkn.js +75 -0
  9. package/dist/chunks/bookmark-state-BusLpkb7.js +743 -0
  10. package/dist/chunks/{braces-Da41xfUd.js → braces-u8VorWJc.js} +1 -1
  11. package/dist/chunks/{comparison-window-caption-4FNkMrzE.js → comparison-window-caption-DDsIWJYT.js} +108 -108
  12. package/dist/chunks/{context-BgPDzLHZ.js → context-TUjw9eqr.js} +1 -1
  13. package/dist/chunks/{custom-visual-inputs-Dz-enUNR.js → custom-visual-inputs-DfolidZ9.js} +1 -1
  14. package/dist/chunks/{dashboard-_MeBuy67.js → dashboard-BRdZBPqr.js} +1 -1
  15. package/dist/chunks/{dashboard-briefing-launcher-CEi4Pr_v.js → dashboard-briefing-launcher-CgvTLndW.js} +161 -162
  16. package/dist/chunks/{dashboard-controls-Bi7fyG-4.js → dashboard-controls-B4vfSzTF.js} +881 -945
  17. package/dist/chunks/{dashboard-json-B1mU_OMa.js → dashboard-json-Y3MF59g7.js} +5 -5
  18. package/dist/chunks/document-dashboard-inputs-CvBbFTUA.js +1718 -0
  19. package/dist/chunks/{edit-dashboard-visual-0CJN31Y3.js → edit-dashboard-visual-DwjZcxj-.js} +6112 -6146
  20. package/dist/chunks/{filter-reach-copy-BF4w4kI2.js → filter-reach-copy-bijwf_-b.js} +1250 -1392
  21. package/dist/chunks/{filter-value-text-CRC-K_l_.js → filter-value-text-DFnhwuEW.js} +3 -3
  22. package/dist/chunks/global-date-filter-utils-BXgCpvQM.js +15142 -0
  23. package/dist/chunks/{index-DtHidOPV.js → index-ClwbY3BL.js} +197 -198
  24. package/dist/chunks/{layout-grid-BvsH4RY2.js → layout-grid-CtvCBfOm.js} +1 -1
  25. package/dist/chunks/{list-filter-Dg0otx5E.js → list-filter-BklYgciR.js} +1 -1
  26. package/dist/chunks/{matrix-analytical-definition-CM18W8w6.js → matrix-analytical-definition-pU51-JmY.js} +4 -4
  27. package/dist/chunks/{matrix-card-HPskLaPy.js → matrix-card-CUorIB7Q.js} +3 -3
  28. package/dist/chunks/{matrix-member-presentation-Bbrfrke4.js → matrix-member-presentation-Df5UgCGN.js} +1 -1
  29. package/dist/chunks/{matrix-operation-contract-WPv4R-H_.js → matrix-operation-contract-BSiGEXVC.js} +255 -248
  30. package/dist/chunks/{metric-comparison-ljMKYZKa.js → metric-comparison-95aC0uEO.js} +6 -6
  31. package/dist/chunks/{model-change-Ccn1zaxl.js → model-change-B5wQhg5G.js} +1 -1
  32. package/dist/chunks/{palette-Bsh376zO.js → palette-DTnMhipt.js} +1 -1
  33. package/dist/chunks/pivot-result-contract-expectations-Bo-86vwS.js +56 -0
  34. package/dist/chunks/{pivot-result-identity-vS9TSh4f.js → pivot-result-identity-olvXJoB9.js} +1 -1
  35. package/dist/chunks/{report-preferences-dialog-BV8L0SeS.js → report-preferences-dialog-C2YUIwKG.js} +14 -14
  36. package/dist/chunks/{report-runtime-context-BZQh9ywy.js → report-runtime-context-DoIUr3MP.js} +2 -2
  37. package/dist/chunks/resolve-dashboard-input-context-q_iiNXE1.js +6503 -0
  38. package/dist/chunks/{save-B5EAsgQF.js → save-DH4RyrnG.js} +1 -1
  39. package/dist/chunks/{saved-dashboard-context-n2Wn11cV.js → saved-dashboard-context-8jqfI7hI.js} +12 -12
  40. package/dist/chunks/{selection-reducer-D0YnaAD9.js → selection-reducer-CV7K4FI6.js} +1 -1
  41. package/dist/chunks/{semaphor-ready-indicator-XLBLOJ2V.js → semaphor-ready-indicator-E2XWyibu.js} +30253 -31076
  42. package/dist/chunks/{shelf-drop-preview-context-DHMa54a-.js → shelf-drop-preview-context-C29EUzDp.js} +7 -7
  43. package/dist/chunks/{source-entity-resolution-dUG5VWRm.js → source-entity-resolution-BXI3nQ5Z.js} +1 -1
  44. package/dist/chunks/{switch-ByxH4M7t.js → switch-balDSHc7.js} +3 -3
  45. package/dist/chunks/{table-export-sheet-C_GdeTYU.js → table-export-sheet-CK8tvh4d.js} +1 -1
  46. package/dist/chunks/temporal-input-presentation-B77JsAzU.js +5002 -0
  47. package/dist/chunks/{token-types-CQtXUVMy.js → token-types-DhYH5YKb.js} +1 -1
  48. package/dist/chunks/{upload-wbR-NVzq.js → upload-Ufj8vjyn.js} +1 -1
  49. package/dist/chunks/{use-create-flow-overlay-state-CEBaLOKC.js → use-create-flow-overlay-state-9WsnzEO5.js} +6 -6
  50. package/dist/chunks/{validators-CXTneCA4.js → validators-BtaCFIEB.js} +37 -37
  51. package/dist/chunks/{zoned-wall-clock-B1n_WjW3.js → zoned-wall-clock-CGLVI40Q.js} +1 -1
  52. package/dist/dashboard/index.js +2 -2
  53. package/dist/dashboard-authoring/index.js +2400 -1856
  54. package/dist/data-app-sdk/index.js +20 -20
  55. package/dist/data-app-sdk-adapters/index.js +3 -3
  56. package/dist/data-app-sdk-validation/index.js +10 -10
  57. package/dist/format-utils/index.js +257 -256
  58. package/dist/index.js +214 -215
  59. package/dist/report-runtime-context/index.js +2 -2
  60. package/dist/style.css +1 -1
  61. package/dist/surfboard/index.js +2 -2
  62. package/dist/types/components/dashboard/summary-number-formatter.d.ts +6 -0
  63. package/dist/types/index.js +50 -51
  64. package/dist/types/lib/formatters/kpi-number-formatter.d.ts +41 -0
  65. package/dist/types/lib/stores/editor-store.d.ts +9 -1
  66. package/dist/types/lib/stores/table-actions.d.ts +0 -2
  67. package/dist/types/shared/analytics-protocol/analytics-base-schemas.d.ts +10 -0
  68. package/dist/types/shared/analytics-protocol/measure-aggregation-profile.d.ts +12 -0
  69. package/dist/types/shared/dashboard-authoring/card-settings/apply-card-settings.d.ts +11 -0
  70. package/dist/types/shared/dashboard-authoring/card-settings/card-display-write.d.ts +52 -0
  71. package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +14 -0
  72. package/dist/types/shared/dashboard-authoring/card-settings/carry-column-settings.d.ts +3 -0
  73. package/dist/types/shared/dashboard-authoring/card-settings/column-format-write.d.ts +8 -0
  74. package/dist/types/shared/dashboard-authoring/card-settings/column-names.d.ts +51 -0
  75. package/dist/types/shared/dashboard-authoring/card-settings/column-sources.d.ts +14 -0
  76. package/dist/types/shared/dashboard-authoring/card-settings/confirm-class.d.ts +9 -0
  77. package/dist/types/shared/dashboard-authoring/card-settings/highlight-inputs.d.ts +19 -0
  78. package/dist/types/shared/dashboard-authoring/card-settings/index.d.ts +15 -0
  79. package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +102 -0
  80. package/dist/types/shared/dashboard-authoring/card-settings/read-card-settings.d.ts +10 -0
  81. package/dist/types/shared/dashboard-authoring/card-settings/resolve-card-highlights.d.ts +14 -0
  82. package/dist/types/shared/dashboard-authoring/card-settings/resolve-card-settings.d.ts +59 -0
  83. package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +40 -0
  84. package/dist/types/shared/dashboard-authoring/card-settings/views.d.ts +28 -0
  85. package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +6 -0
  86. package/dist/types/shared/dashboard-authoring/changes/card-types.d.ts +32 -0
  87. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +539 -22
  88. package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +27 -8
  89. package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-changes.d.ts +25 -1
  90. package/dist/types/shared/dashboard-authoring/conditional-formatting/kpi.d.ts +1 -8
  91. package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +10 -10
  92. package/dist/types/shared/dashboard-authoring/index.d.ts +3 -0
  93. package/dist/types/shared/dashboard-authoring/kpi-figure.d.ts +123 -0
  94. package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +21 -1
  95. package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +10 -4
  96. package/dist/types/shared/dashboard-viewer/bookmark-impact.d.ts +33 -0
  97. package/dist/types/shared/format-utils/formatters/matrix-formatter.d.ts +8 -1
  98. package/dist/types/shared/format-utils/raw-temporal.d.ts +16 -0
  99. package/package.json +2 -2
  100. package/dist/chunks/bookmark-state-BFY9oNmr.js +0 -111
  101. package/dist/chunks/document-dashboard-inputs-CkWfDB8c.js +0 -3010
  102. package/dist/chunks/global-date-filter-utils-D8365uPH.js +0 -12889
  103. package/dist/chunks/pivot-result-contract-expectations-Bl5suy4-.js +0 -1832
  104. package/dist/chunks/raw-temporal-presentation-BHm7s-hz.js +0 -540
  105. package/dist/chunks/resolve-dashboard-input-context-CAMiWvyR.js +0 -5280
  106. package/dist/chunks/table-settings-Imz0FgWi.js +0 -637
  107. package/dist/chunks/temporal-input-presentation-uvNK_tM0.js +0 -3228
@@ -1,5 +1,5 @@
1
- import { a, R as s, D as o } from "../chunks/report-preferences-dialog-BV8L0SeS.js";
2
- import { C as f, E as D } from "../chunks/table-settings-Imz0FgWi.js";
1
+ import { a, R as s, D as o } from "../chunks/report-preferences-dialog-C2YUIwKG.js";
2
+ import { C as f, E as D } from "../chunks/bookmark-state-BusLpkb7.js";
3
3
  export {
4
4
  f as CONTROL_CARD_DEFAULT_VALUE,
5
5
  a as DisplayFormatPreferencesFields,
@@ -1,3 +1,4 @@
1
+ import { KpiNumberFormatter } from '../../lib/formatters/kpi-number-formatter.js';
1
2
  import { TCard } from '../../lib/types/common-types.js';
2
3
  import { ResolvedValueFormatPreferences } from '../../shared/value-format-preferences/index.js';
3
4
  export type SummaryNumberFormatter = {
@@ -5,6 +6,11 @@ export type SummaryNumberFormatter = {
5
6
  formatSigned: (value: number | null) => string;
6
7
  formatPct: (value: number | null) => string;
7
8
  };
9
+ /** A summary's numbers in the KPI value's formats: its formatter and its delta's. */
10
+ export declare function summaryNumberFormatterFrom({ formatter, deltaFormatter, }: {
11
+ formatter: KpiNumberFormatter;
12
+ deltaFormatter: KpiNumberFormatter;
13
+ }): SummaryNumberFormatter;
8
14
  export declare function buildSummaryNumberFormatter({ card, preferences, boundCurrency, }: {
9
15
  card?: TCard;
10
16
  preferences?: ResolvedValueFormatPreferences | null;
@@ -1,9 +1,8 @@
1
- import { C as s, E as r, V as l, i as o, c as i, g as n, f as d, b as m, e as u, d as c, a as E, u as p, s as C, h as T, j as D, q as A, o as I, m as _, n as F, p as S, k as b, l as L, r as f, t as N } from "../chunks/table-settings-Imz0FgWi.js";
2
- import { C as y, D as g, L as h, e as x, g as M, j as O, h as V, k, d as w, b as U, i as B, c as K, n as z, f as v } from "../chunks/validators-CXTneCA4.js";
3
- import { D as q } from "../chunks/token-types-CQtXUVMy.js";
4
- import { B as P, a as Q, p as j, r as W } from "../chunks/bookmark-state-BFY9oNmr.js";
5
- import { r as X, a as H } from "../chunks/pivot-result-identity-vS9TSh4f.js";
6
- import { D as $ } from "../chunks/report-runtime-context-BZQh9ywy.js";
1
+ import { B as s, x as r, C as l, E as o, V as i, j as n, c as d, g as m, f as u, b as c, e as E, d as C, a as T, w as p, v as D, h as A, l as I, u as _, s as F, m as S, n as b, p as L, k as f, o as N, q as R, i as y, r as g, t as h } from "../chunks/bookmark-state-BusLpkb7.js";
2
+ import { C as M, D as O, L as V, e as w, g as k, j as U, h as B, k as K, d as z, b as v, i as Y, c as q, n as G, f as P } from "../chunks/validators-BtaCFIEB.js";
3
+ import { D as j } from "../chunks/token-types-DhYH5YKb.js";
4
+ import { r as J, a as X } from "../chunks/pivot-result-identity-olvXJoB9.js";
5
+ import { D as Z } from "../chunks/report-runtime-context-DoIUr3MP.js";
7
6
  const e = [
8
7
  "concatenate",
9
8
  "conditional-category",
@@ -37,51 +36,51 @@ const e = [
37
36
  "is-blank"
38
37
  ];
39
38
  export {
40
- P as BOOKMARK_STATE_VERSION,
41
- Q as BOOKMARK_VISIBILITIES,
42
- y as CALCULATED_FIELD_ENTITY_MARKER,
39
+ s as BOOKMARK_STATE_VERSION,
40
+ r as BOOKMARK_VISIBILITIES,
41
+ M as CALCULATED_FIELD_ENTITY_MARKER,
43
42
  e as CALCULATED_FIELD_TEMPLATE_IDS,
44
- s as CONTROL_CARD_DEFAULT_VALUE,
45
- g as DATE_FORMAT_VALUES,
46
- $ as DEFAULT_CALENDAR_CONTEXT,
47
- q as DEFAULT_SEMANTIC_DOMAIN_ACCESS,
48
- r as EMPTY_SELECTION,
49
- h as LEGACY_CALCULATED_FIELD_ENTITY_MARKER,
50
- l as VIEWER_LIMITS,
51
- o as VIEWER_TABLE_SETTINGS_VERSION,
52
- i as collectDatasetNamesFromExplorerField,
53
- n as collectDatasetNamesFromFilterGroup,
54
- d as collectExecutionDatasetNamesFromExplorerField,
55
- m as collectPreferredDatasetNamesFromExplorerField,
56
- u as collectQualifiedDatasetNamesFromExplorerField,
57
- c as datasetRefFromSource,
58
- E as dependencyDisplayIdentity,
59
- x as getCalculatedFieldComputeStage,
43
+ l as CONTROL_CARD_DEFAULT_VALUE,
44
+ O as DATE_FORMAT_VALUES,
45
+ Z as DEFAULT_CALENDAR_CONTEXT,
46
+ j as DEFAULT_SEMANTIC_DOMAIN_ACCESS,
47
+ o as EMPTY_SELECTION,
48
+ V as LEGACY_CALCULATED_FIELD_ENTITY_MARKER,
49
+ i as VIEWER_LIMITS,
50
+ n as VIEWER_TABLE_SETTINGS_VERSION,
51
+ d as collectDatasetNamesFromExplorerField,
52
+ m as collectDatasetNamesFromFilterGroup,
53
+ u as collectExecutionDatasetNamesFromExplorerField,
54
+ c as collectPreferredDatasetNamesFromExplorerField,
55
+ E as collectQualifiedDatasetNamesFromExplorerField,
56
+ C as datasetRefFromSource,
57
+ T as dependencyDisplayIdentity,
58
+ w as getCalculatedFieldComputeStage,
60
59
  p as getCustomizableTableCardIds,
61
- M as getFieldRuntimeColumnName,
62
- C as getSortableTableCardIds,
63
- O as hasCalculatedFieldMarker,
64
- V as hasCalculatedFormulaInputs,
65
- k as hasSyntheticCalculatedFieldOwner,
66
- T as humanizeDatasetName,
67
- w as inspectCalculatedField,
68
- U as isCalculatedDimension,
69
- B as isCalculatedMetric,
70
- K as isDerivedField,
71
- D as isEmptyViewerTableSettings,
72
- A as isTableCardCustomizable,
73
- I as isTableCardSortable,
74
- _ as measureJsonBytes,
75
- z as normalizeCalculatedFieldRepresentation,
76
- F as normalizeViewerTableSettings,
77
- j as parseBookmarkState,
78
- S as parseTableColumnId,
79
- b as parseViewerTableSettings,
80
- L as parseViewerTableSettingsMap,
81
- W as readBookmarkState,
82
- f as resolveFieldDatasetDependencies,
83
- X as resolveQueryColumnKeyMapEntry,
84
- H as resolveUniqueQueryColumnKeyMapEntry,
85
- v as shouldDropInheritedCalculationAggregate,
86
- N as toTableColumnId
60
+ k as getFieldRuntimeColumnName,
61
+ D as getSortableTableCardIds,
62
+ U as hasCalculatedFieldMarker,
63
+ B as hasCalculatedFormulaInputs,
64
+ K as hasSyntheticCalculatedFieldOwner,
65
+ A as humanizeDatasetName,
66
+ z as inspectCalculatedField,
67
+ v as isCalculatedDimension,
68
+ Y as isCalculatedMetric,
69
+ q as isDerivedField,
70
+ I as isEmptyViewerTableSettings,
71
+ _ as isTableCardCustomizable,
72
+ F as isTableCardSortable,
73
+ S as measureJsonBytes,
74
+ G as normalizeCalculatedFieldRepresentation,
75
+ b as normalizeViewerTableSettings,
76
+ L as parseBookmarkState,
77
+ f as parseTableColumnId,
78
+ N as parseViewerTableSettings,
79
+ R as parseViewerTableSettingsMap,
80
+ y as readBookmarkState,
81
+ g as resolveFieldDatasetDependencies,
82
+ J as resolveQueryColumnKeyMapEntry,
83
+ X as resolveUniqueQueryColumnKeyMapEntry,
84
+ P as shouldDropInheritedCalculationAggregate,
85
+ h as toTableColumnId
87
86
  };
@@ -0,0 +1,41 @@
1
+ import { KpiColumn } from '../../shared/dashboard-authoring/kpi-figure.js';
2
+ import { CanonicalFormatSpec } from './canonical-format-adapter.js';
3
+ import { TCard, TFormatOptions } from '../types/common-types.js';
4
+ import { ResolvedValueFormatPreferences } from '../../shared/value-format-preferences/index.js';
5
+ export type KpiNumberFormatter = {
6
+ format: (value: number | null) => string;
7
+ formatSigned: (value: number | null) => string;
8
+ supportsComparisonDeltaInheritance: boolean;
9
+ /** The KPI's active format, for the comparison indicator's own fallback text. */
10
+ formatOptions?: TFormatOptions;
11
+ /** The locale the column formats in. */
12
+ locale: string;
13
+ };
14
+ type KpiNumberFormatterInput = {
15
+ card?: TCard;
16
+ /** The column to format: the KPI's value (the KPI value owner's) unless another measure is named. */
17
+ column?: KpiColumn;
18
+ preferences?: ResolvedValueFormatPreferences | null;
19
+ boundCurrency?: string;
20
+ };
21
+ /**
22
+ * A KPI column's format with the viewer's preferences and bound currency
23
+ * applied, and the locale it formats in. For a difference (`numericDelta`):
24
+ * the column's own format only when it is a number or a duration (a date or
25
+ * text format can't show one), else the plain number fallback.
26
+ */
27
+ export declare function resolveKpiFormatContext({ card, column, preferences, boundCurrency, numericDelta, }: KpiNumberFormatterInput & {
28
+ numericDelta?: boolean;
29
+ }): {
30
+ locale: string;
31
+ canonicalPrimaryFormat?: CanonicalFormatSpec;
32
+ };
33
+ /** A KPI column's formatter. */
34
+ export declare function buildKpiNumberFormatter(input: KpiNumberFormatterInput): KpiNumberFormatter;
35
+ /**
36
+ * The formatter a comparison's difference uses: the column's format when it is
37
+ * a number or a duration (a date or text format can't show a difference), else
38
+ * the plain number fallback.
39
+ */
40
+ export declare function buildKpiDeltaNumberFormatter(input: KpiNumberFormatterInput): KpiNumberFormatter;
41
+ export {};
@@ -74,6 +74,13 @@ export type EditorStore = {
74
74
  sqlGen: SqlGen;
75
75
  frame: TFrame;
76
76
  card: TCard;
77
+ /**
78
+ * The card as the editor last loaded it from outside: its open, a frame
79
+ * select, a panel that shows a dashboard or document card. The
80
+ * column-change rule leaves a load alone; it carries edits only (card
81
+ * appearance P2-37).
82
+ */
83
+ loadedCard?: TCard;
77
84
  activeTabCardId?: string | null;
78
85
  showFilters: boolean;
79
86
  applyFilters: boolean;
@@ -126,7 +133,6 @@ type Actions = TableActions & ExplorerActions & {
126
133
  setCardDescription: (description: string) => void;
127
134
  setCardInfo: (info: string) => void;
128
135
  setCardId: (cardId: string) => void;
129
- setCountryLogo: (countryLogoId: string | null) => void;
130
136
  setIsDevMode: (isDevMode: boolean) => void;
131
137
  /**
132
138
  * Switches between dev mode and standard mode with draft preservation.
@@ -195,6 +201,8 @@ type Actions = TableActions & ExplorerActions & {
195
201
  setFilterOnClickColumnIndex: (index: number) => void;
196
202
  setIsSqlRunning: (isSqlRunning: boolean) => void;
197
203
  setCard: (card: TCard) => void;
204
+ /** Shows a card from outside the editor (the dashboard, a document): a load, not an edit of the card it replaces. */
205
+ loadCard: (card: TCard) => void;
198
206
  setFrame: (frame: TFrame) => void;
199
207
  /** Replaces all cards in the frame with new cards. Sets first card as active. */
200
208
  replaceFrameCards: (cards: TCard[]) => void;
@@ -26,8 +26,6 @@ export interface TableActions {
26
26
  showAllColumns: () => void;
27
27
  hideAllColumns: () => void;
28
28
  toggleSelectColumn: (isVisible: boolean) => void;
29
- initializeColumnVisibility: (columnIds: string[]) => void;
30
- updateAllColumnVisibility: (visibility: Record<string, boolean>) => void;
31
29
  }
32
30
  export declare const createTableActions: (set: (fn: (state: EditorStore) => Partial<EditorStore>) => void) => TableActions;
33
31
  export declare const selectColumnSettings: (state: EditorState) => PersistedColumnSettingsMap;
@@ -192,6 +192,16 @@ export declare const semaphorScalarValueFormatInputSchema: z.ZodType<SemaphorSca
192
192
  * model, parses with it.
193
193
  */
194
194
  export declare const semaphorValueFormatSchema: z.ZodType<SemaphorValueFormat>;
195
+ /** Every stored format type (CF-D28). */
196
+ export declare const STORED_VALUE_FORMAT_TYPES: readonly ["number", "currency", "percent", "scientific", "duration", "date", "string", "temporal_bucket"];
197
+ /**
198
+ * The schema that decides one stored format type, so a refusal can name the
199
+ * type's own problem (the union reports only that nothing matched). A format
200
+ * of a type is valid exactly when this schema accepts it.
201
+ */
202
+ export declare function storedValueFormatSchemaFor(type: string): z.ZodTypeAny | undefined;
203
+ /** The fields a stored format of `type` can state, read from its schema: a hint for a refusal, never the check. */
204
+ export declare function storedValueFormatFields(type: string): readonly string[] | undefined;
195
205
  export declare const semaphorSemanticSourceRefSchema: z.ZodObject<{
196
206
  kind: z.ZodLiteral<"semantic">;
197
207
  domainId: z.ZodString;
@@ -1,4 +1,5 @@
1
1
  import { AggregationFunctionKind } from './aggregate-expression.js';
2
+ import { AnalyticsCatalogDataType } from './catalog-field-grounding.js';
2
3
  /** The structural fields of a measure the profile reads. */
3
4
  export type MeasureProfileField = {
4
5
  name?: string;
@@ -61,3 +62,14 @@ export type MeasureAggregationProfile = {
61
62
  * field and its nested `calculatedFormula.inputFields`.
62
63
  */
63
64
  export declare function resolveMeasureAggregationProfile(field: MeasureProfileField): MeasureAggregationProfile;
65
+ /**
66
+ * A measure's result type: what its aggregation makes of its field, through
67
+ * the profile. MIN and MAX keep the field's type; every other aggregate is a
68
+ * number, so a COUNT of a text or date column is a number (Excel exports
69
+ * ledger P2b-12). A measure the profile can't resolve keeps the field's type.
70
+ * The one owner of this job: the canonical result, card settings' format
71
+ * check and the window transforms read it (card appearance ledger P2-16).
72
+ */
73
+ export declare function measureResultDataType(metric: (MeasureProfileField & {
74
+ dataType?: string;
75
+ }) | undefined): AnalyticsCatalogDataType;
@@ -0,0 +1,11 @@
1
+ import { TCard } from '../../../lib/types/common-types.js';
2
+ import { ResolvedCardSettings } from './resolved.js';
3
+ export type DroppedSetting = {
4
+ setting: string;
5
+ reason: string;
6
+ };
7
+ export type AppliedCardSettings = {
8
+ card: TCard;
9
+ dropped: DroppedSetting[];
10
+ };
11
+ export declare function applyCardSettings(card: TCard, settings: ResolvedCardSettings): AppliedCardSettings;
@@ -0,0 +1,52 @@
1
+ import { TChartType } from '../../../lib/charts/types.js';
2
+ import { AxisConfig, TCard, TCardPreferences, TLegendOptions } from '../../../lib/types/common-types.js';
3
+ import { SemaphorValueFormat } from '../../analytics-protocol/contracts.js';
4
+ /** A stored chart variant: its type, and the axis it draws along when that isn't the type's own (SPEC 4.6). */
5
+ export type CardVariant = {
6
+ type: TChartType;
7
+ indexAxis?: 'x' | 'y';
8
+ };
9
+ /** The stored axis configs a change names: `xAxisConfig` is the horizontal axis on screen, `yAxisConfig` the vertical (V-2). */
10
+ export type AxisConfigKey = 'xAxisConfig' | 'yAxisConfig';
11
+ /**
12
+ * A flip between vertical and horizontal (CA-D22): the chart's scales and
13
+ * the stored axis configs swap, so each axis's title and range stay with its
14
+ * role: the value axis's range stays on the value axis.
15
+ */
16
+ export declare function flipChartOrientation(preferences: TCardPreferences | undefined): TCardPreferences;
17
+ /**
18
+ * The axis a chart draws along, as the orientation control sets it. A bar
19
+ * that turns between vertical and horizontal flips its axes (CA-D22); any
20
+ * other chart swaps only its scales, as it always has.
21
+ */
22
+ export declare function writeChartOrientation<T extends Pick<TCard, 'type' | 'preferences'>>(card: T, indexAxis: 'x' | 'y'): T;
23
+ /**
24
+ * A variant within the card's family, set in place (CA-D21): its type, and
25
+ * its axis when it needs one; every other preference is kept. A change that
26
+ * turns the chart flips its axes (CA-D22).
27
+ */
28
+ export declare function writeCardVariant<T extends Pick<TCard, 'type' | 'preferences'>>(card: T, variant: CardVariant): T;
29
+ /** A config table's total row on or off, as the table settings' toggle writes it. */
30
+ export declare function writeTotalsRow(preferences: TCardPreferences | undefined, row: boolean): TCardPreferences;
31
+ /**
32
+ * A chart's data labels shown or hidden, and their own format, onto the
33
+ * stored config filled with the chart's defaults, as the data labels panel
34
+ * writes them: showing sets `enabled` and `display` together (V-5); a null
35
+ * format removes the labels' own, so they follow the measure (CF-D3).
36
+ */
37
+ export declare function writeDataLabels(card: Pick<TCard, 'type' | 'preferences'>, change: {
38
+ show?: boolean;
39
+ format?: SemaphorValueFormat | null;
40
+ }): TCardPreferences;
41
+ /** Legend options merged onto the stored legend, as the legend panel writes them. */
42
+ export declare function writeLegendOptions(preferences: TCardPreferences | undefined, options: TLegendOptions): TCardPreferences;
43
+ /** An axis title's fields, onto the stored title: the axis panel's switch, text and font, and the MCP's title. */
44
+ export declare function withAxisName(config: AxisConfig | undefined, name: Partial<NonNullable<AxisConfig['name']>>): AxisConfig;
45
+ /** An axis range's bounds; null returns a bound to automatic, as the axis panel's empty field does. */
46
+ export declare function withAxisScale(config: AxisConfig | undefined, scale: {
47
+ min?: number | null;
48
+ max?: number | null;
49
+ stepSize?: number | null;
50
+ }): AxisConfig;
51
+ /** One stored axis config replaced, as the axis panel writes it. */
52
+ export declare function writeAxisConfig(preferences: TCardPreferences | undefined, key: AxisConfigKey | 'secondaryYAxisConfig', config: AxisConfig): TCardPreferences;
@@ -0,0 +1,14 @@
1
+ import { TCard } from '../../../lib/types/common-types.js';
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';
4
+ export declare const SETTINGS_BY_KIND: Readonly<Record<CardType, readonly SettingName[]>>;
5
+ export type CardSettingsKind = {
6
+ type: CardType;
7
+ /** The card's result comes from SQL (or Python): columns are named by result key. */
8
+ sql: boolean;
9
+ /** A config table with pivot columns: a measure has a column per pivot value. */
10
+ pivoted: boolean;
11
+ settings: ReadonlySet<SettingName>;
12
+ };
13
+ /** The card's kind and the settings it takes; undefined outside the eight types and their variants. */
14
+ export declare function cardSettingsKind(card: Pick<TCard, 'type' | 'preferences' | 'sql' | 'python' | 'config'>): CardSettingsKind | undefined;
@@ -0,0 +1,3 @@
1
+ import { TCard } from '../../../lib/types/common-types.js';
2
+ /** `after` with its table settings under its columns' new result keys; `after` itself when no key moved. */
3
+ export declare function carryColumnSettings(before: TCard, after: TCard): TCard;
@@ -0,0 +1,8 @@
1
+ import { TCard } from '../../../lib/types/common-types.js';
2
+ import { Field } from '../../../lib/types/explorer-types.js';
3
+ import { SemaphorValueFormat } from '../../analytics-protocol/contracts.js';
4
+ import { CardColumnRef } from '../conditional-formatting/types.js';
5
+ /** A column with this format as its override; none removes the override, so it follows its model (CF-D20). */
6
+ export declare function withFormatOverride<T extends Pick<Field, 'format' | 'formatOrigin'>>(column: T, format: SemaphorValueFormat | undefined): T;
7
+ /** Writes or removes the card's own format for one column, at its stored place. */
8
+ export declare function writeColumnFormat(card: TCard, column: CardColumnRef, format: SemaphorValueFormat | undefined): TCard;
@@ -0,0 +1,51 @@
1
+ import { TCard } from '../../../lib/types/common-types.js';
2
+ import { ColumnKey } from '../changes/card-query-part.js';
3
+ import { CardColumnRef } from '../conditional-formatting/types.js';
4
+ import { CardSettingsKind } from './card-kinds.js';
5
+ import { ColumnSettingsRole } from './views.js';
6
+ import { ChangeDiagnostic } from '../changes/diagnostics.js';
7
+ export type NamedColumn = {
8
+ /** Unique within the card (S-3). */
9
+ name: string;
10
+ /** What formats and rules are keyed by. */
11
+ ref: CardColumnRef;
12
+ /** What labels are written by (`planCardLabels`); absent where a label can't be set. */
13
+ labelKey?: ColumnKey;
14
+ field?: string;
15
+ role: ColumnSettingsRole;
16
+ /** The header as the card shows it. */
17
+ label: string;
18
+ /** The key its result-keyed table settings are stored under; absent where hidden and width don't apply. */
19
+ resultKey?: string;
20
+ /** The label is the model's, not the card's own. */
21
+ labelInherited: boolean;
22
+ /** Tells two columns of one field apart in a name. */
23
+ qualifier?: string;
24
+ /** The type of the values the column shows, which decides the formats it takes: a measure's is its aggregation's result type (`measureResultDataType`). Absent for SQL result columns. */
25
+ dataType?: string;
26
+ /** A grouped date's grain: its formats are temporal buckets at this grain. */
27
+ granularity?: string;
28
+ /**
29
+ * A SQL result column's name: `verified` when a run of the card's query
30
+ * returned it, `inferred` when only a stored setting names it (the outline
31
+ * runs no query). A change may name verified columns only (ledger P2-24).
32
+ */
33
+ sqlName?: 'verified' | 'inferred';
34
+ };
35
+ /** The card's named columns, in card order (SPEC 3.3). */
36
+ export declare function nameCardColumns(card: TCard, kind: CardSettingsKind, sqlResultColumns?: readonly string[]): NamedColumn[];
37
+ /**
38
+ * The column an input names: its name, a disambiguated name, or its field
39
+ * when exactly one column has it (SPEC 3.3). Two matches are refused
40
+ * `column_ambiguous`, none `column_not_found`, each listing the card's names.
41
+ */
42
+ export declare function findNamedColumn(columns: readonly NamedColumn[], said: string, where: {
43
+ path: string;
44
+ cardTitle: string;
45
+ }): {
46
+ ok: true;
47
+ column: NamedColumn;
48
+ } | {
49
+ ok: false;
50
+ problem: ChangeDiagnostic;
51
+ };
@@ -0,0 +1,14 @@
1
+ import { TCard } from '../../../lib/types/common-types.js';
2
+ import { Field } from '../../../lib/types/explorer-types.js';
3
+ import { CardColumnRef } from '../conditional-formatting/types.js';
4
+ export type ColumnSource = {
5
+ domainId: string;
6
+ datasetName: string;
7
+ };
8
+ /** The catalogs a resolve reads, one per source, keyed by `columnSourceKey`. */
9
+ export type ColumnCatalogs = Readonly<Record<string, readonly Field[]>>;
10
+ export declare const columnSourceKey: (source: ColumnSource) => string;
11
+ /** Every distinct semantic source a card's columns come from: the catalogs to load. */
12
+ export declare function cardColumnSources(card: TCard): ColumnSource[];
13
+ /** The catalog field a column comes from, found in its own source's catalog. */
14
+ export declare function catalogFieldOfColumn(card: TCard, ref: CardColumnRef, catalogs: ColumnCatalogs | undefined): Field | undefined;
@@ -0,0 +1,9 @@
1
+ import { DashboardOperation } from '../operations/operation-types.js';
2
+ export type ConfirmClass = 'needed' | 'not_needed';
3
+ /** Counted only, so the class needs no viewer data: one entry per thing a change removes from viewers' saved state. */
4
+ export type ConfirmImpact = readonly unknown[];
5
+ export declare function confirmClassFor(input: {
6
+ operations: readonly DashboardOperation[];
7
+ impact: ConfirmImpact;
8
+ detaches: boolean;
9
+ }): ConfirmClass;
@@ -0,0 +1,19 @@
1
+ import { CardColumnRef, ConditionalRule } from '../conditional-formatting/types.js';
2
+ import { HighlightAddChange, HighlightStyleInput } from './inputs.js';
3
+ import { HighlightView } from './views.js';
4
+ /** A stored rule as the outline shows it, or undefined when part of it has no input word. */
5
+ export declare function readHighlight(rule: ConditionalRule, nameOf: (ref: CardColumnRef) => string | undefined): HighlightView | undefined;
6
+ /** A highlight change's rule, without its op and card. */
7
+ export type HighlightRuleInput = Pick<HighlightAddChange, 'column' | 'apply'> & HighlightStyleInput;
8
+ /**
9
+ * A highlight input as the rule the rule panel writes for the same choices
10
+ * (`createConditionalRule`): on its column, on the table's body, named as
11
+ * the panel names a new rule ("Margin rule 3", the card's third rule), on.
12
+ * A theme color stores the panel's background and text pair; a hex stores a
13
+ * background; a color scale stores backgrounds; a data bar its color, blue
14
+ * when none is given (V-6).
15
+ */
16
+ export declare function highlightRule(input: HighlightRuleInput, column: {
17
+ ref: CardColumnRef;
18
+ label: string;
19
+ }, id: string, index: number): ConditionalRule;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * The one owner of how a card reads and shows (card appearance CA-D2, SPEC 4):
3
+ * the outline, the change resolver, the reducer and the editor's panels read
4
+ * and write a card's settings through it.
5
+ */
6
+ export { readCardSettings } from './read-card-settings.js';
7
+ export { resolveCardSettings, type CardSettingsContext, type CardSettingsRequest, type CardSettingsResolution, } from './resolve-card-settings.js';
8
+ export { applyCardSettings, type AppliedCardSettings, type DroppedSetting } from './apply-card-settings.js';
9
+ export { carryColumnSettings } from './carry-column-settings.js';
10
+ export { confirmClassFor, type ConfirmClass } from './confirm-class.js';
11
+ export { writeColumnFormat, withFormatOverride } from './column-format-write.js';
12
+ export type { ResolvedCardSettings, ResolvedColumnSettings } from './resolved.js';
13
+ export { SETTINGS_BY_KIND, cardSettingsKind, type CardSettingsKind, type SettingName } from './card-kinds.js';
14
+ export type { AxisInput, CardSettingsInput, ColumnSettingsInput, DashboardUpdateChange, FormatInput, FormatPatch, HighlightAddChange, HighlightColor, HighlightCondition, HighlightRemoveChange, HighlightStyleInput, LegendPosition, } from './inputs.js';
15
+ export type { CardSettingsView, ColumnSettingsRole, ColumnSettingsView, HighlightView } from './views.js';
@@ -0,0 +1,102 @@
1
+ import { SemaphorDateValueFormat, SemaphorDurationValueFormat, SemaphorNumericValueFormat, SemaphorValueFormat, TemporalBucketFormat } from '../../analytics-protocol/contracts.js';
2
+ /**
3
+ * CA-D18: a whole stored format (it has `type`), or a patch without `type`,
4
+ * merged onto the column's effective format (CF-D20).
5
+ */
6
+ export type FormatInput = SemaphorValueFormat | FormatPatch;
7
+ export type FormatPatch = {
8
+ type?: never;
9
+ } & Partial<Omit<SemaphorNumericValueFormat, 'type'> & Omit<SemaphorDateValueFormat, 'type'> & Omit<SemaphorDurationValueFormat, 'type'> & Omit<TemporalBucketFormat, 'type'>>;
10
+ export type ColumnSettingsInput = {
11
+ /** The header shown. Null returns it to the model's label. */
12
+ label?: string | null;
13
+ /** Hidden for everyone (CA-D16); it still computes, sorts and filters. */
14
+ hidden?: boolean;
15
+ /** Table column width in pixels; null returns it to automatic. */
16
+ width?: number | null;
17
+ /** Null removes the card's override, so the column follows the model. */
18
+ format?: FormatInput | null;
19
+ /** Read-only facts from the outline, accepted back unchanged (CA-INV-1). */
20
+ field?: string;
21
+ role?: string;
22
+ inherits?: string[];
23
+ };
24
+ export type AxisInput = {
25
+ title?: string | null;
26
+ min?: number | null;
27
+ max?: number | null;
28
+ };
29
+ export type LegendPosition = 'top' | 'bottom' | 'left' | 'right';
30
+ /** Optional fields on `card.add` and `card.update`, beside `type`, `title`, `description`, `query` and `matrix`. */
31
+ export type CardSettingsInput = {
32
+ /** Keyed by column name (SPEC 3.3). */
33
+ columns?: Record<string, ColumnSettingsInput>;
34
+ orientation?: 'vertical' | 'horizontal';
35
+ stack?: 'none' | 'stacked';
36
+ donut?: boolean;
37
+ totals?: {
38
+ row: boolean;
39
+ };
40
+ dataLabels?: {
41
+ show: boolean;
42
+ format?: SemaphorValueFormat | null;
43
+ };
44
+ legend?: {
45
+ show: boolean;
46
+ position?: LegendPosition;
47
+ };
48
+ /** As seen on screen: `x` is `xAxisConfig`, `y` is `yAxisConfig`, on a horizontal bar too. */
49
+ axes?: {
50
+ x?: AxisInput;
51
+ y?: AxisInput;
52
+ };
53
+ };
54
+ /** The filter operators (CA-D11): formatting and filtering share one condition language. */
55
+ export type HighlightCondition = {
56
+ operator: '=' | '!=' | '>' | '>=' | '<' | '<=';
57
+ value: number | string;
58
+ } | {
59
+ operator: 'between';
60
+ values: [number, number];
61
+ } | {
62
+ operator: 'contains';
63
+ value: string;
64
+ } | {
65
+ operator: 'is_null';
66
+ } | {
67
+ top: number;
68
+ } | {
69
+ bottom: number;
70
+ };
71
+ /** A theme name, `red` | `amber` | `green` | `blue` | `gray`, or `#rrggbb` (CA-D11). */
72
+ export type HighlightColor = string;
73
+ export type HighlightStyleInput = {
74
+ when: HighlightCondition;
75
+ color: HighlightColor;
76
+ } | {
77
+ scale: {
78
+ low: HighlightColor;
79
+ high: HighlightColor;
80
+ mid?: HighlightColor;
81
+ };
82
+ } | {
83
+ bars: {
84
+ color?: HighlightColor;
85
+ };
86
+ };
87
+ export type HighlightAddChange = {
88
+ op: 'highlight.add';
89
+ cardId: string;
90
+ column: string;
91
+ apply?: 'cell' | 'row';
92
+ } & HighlightStyleInput;
93
+ export type HighlightRemoveChange = {
94
+ op: 'highlight.remove';
95
+ cardId: string;
96
+ ruleId: string;
97
+ };
98
+ export type DashboardUpdateChange = {
99
+ op: 'dashboard.update';
100
+ title?: string;
101
+ description?: string | null;
102
+ };
@@ -0,0 +1,10 @@
1
+ import { TCard } from '../../../lib/types/common-types.js';
2
+ import { CardSettingsView } from './views.js';
3
+ /** The card's settings as the outline shows them (SPEC 3.2, 4.1). */
4
+ export declare function readCardSettings(card: TCard): CardSettingsView;
5
+ /**
6
+ * Whether a chart draws its data labels: a stored config off only when switched off or hidden (SPEC 3.5,
7
+ * V-5); with none stored, what the chart draws without one (ledger P3-09). The resolver and the sentences
8
+ * compare with this, not with the view's absence.
9
+ */
10
+ export declare function dataLabelsShown(card: Pick<TCard, 'type' | 'preferences'>): boolean;
@@ -0,0 +1,14 @@
1
+ import { TCard } from '../../../lib/types/common-types.js';
2
+ import { ChangeDiagnostic } from '../changes/diagnostics.js';
3
+ import { CardSettingsKind } from './card-kinds.js';
4
+ import { NamedColumn } from './column-names.js';
5
+ import { HighlightRuleInput } from './highlight-inputs.js';
6
+ import { ResolvedCardSettings } from './resolved.js';
7
+ export type HighlightsRequest = {
8
+ add?: HighlightRuleInput[];
9
+ remove?: string[];
10
+ };
11
+ export declare function resolveCardHighlights(card: TCard, kind: CardSettingsKind, named: readonly NamedColumn[], request: HighlightsRequest, context: {
12
+ path: string;
13
+ newId?: () => string;
14
+ }, problems: ChangeDiagnostic[]): ResolvedCardSettings['highlights'];