react-semaphor 0.1.558 → 0.1.560

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 (139) hide show
  1. package/dist/analytics-protocol/index.js +368 -358
  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 +630 -0
  7. package/dist/chunks/{assistant-chat-BCWoP6Rf.js → assistant-chat-Bu2fFm_I.js} +206 -207
  8. package/dist/chunks/{bookmark-state-PjQpxbG7.js → bookmark-state-BFY9oNmr.js} +3 -3
  9. package/dist/chunks/{braces-D5Ucy7q1.js → braces-Da41xfUd.js} +1 -1
  10. package/dist/chunks/{comparison-window-caption-Dc7BaCMz.js → comparison-window-caption-4FNkMrzE.js} +213 -213
  11. package/dist/chunks/{context-DVy4HOU0.js → context-BgPDzLHZ.js} +1 -1
  12. package/dist/chunks/{custom-visual-inputs-B-DLRGrV.js → custom-visual-inputs-Dz-enUNR.js} +1 -1
  13. package/dist/chunks/{dashboard-wK6Bai4V.js → dashboard-_MeBuy67.js} +1 -1
  14. package/dist/chunks/{dashboard-briefing-launcher-Coqghdn6.js → dashboard-briefing-launcher-CEi4Pr_v.js} +1152 -1166
  15. package/dist/chunks/{dashboard-controls-BYWSM2RM.js → dashboard-controls-Bi7fyG-4.js} +98 -98
  16. package/dist/chunks/{dashboard-json-pPTB5gj0.js → dashboard-json-B1mU_OMa.js} +5 -5
  17. package/dist/chunks/{document-dashboard-inputs-PY_7Xm55.js → document-dashboard-inputs-CkWfDB8c.js} +64 -64
  18. package/dist/chunks/{edit-dashboard-visual-BODxuUeq.js → edit-dashboard-visual-0CJN31Y3.js} +8274 -8514
  19. package/dist/chunks/filter-reach-copy-BF4w4kI2.js +3738 -0
  20. package/dist/chunks/{filter-value-text-CUBpotVN.js → filter-value-text-CRC-K_l_.js} +3 -3
  21. package/dist/chunks/{global-date-filter-utils-BsFqnnbA.js → global-date-filter-utils-D8365uPH.js} +4088 -3416
  22. package/dist/chunks/{index-DP_wQl0v.js → index-DtHidOPV.js} +579 -604
  23. package/dist/chunks/{layout-grid-CkoXmv0L.js → layout-grid-BvsH4RY2.js} +1 -1
  24. package/dist/chunks/{list-filter-B4i25kuc.js → list-filter-Dg0otx5E.js} +1 -1
  25. package/dist/chunks/{matrix-analytical-definition-4GTUDheD.js → matrix-analytical-definition-CM18W8w6.js} +41 -41
  26. package/dist/chunks/{matrix-card-fS_4O7zA.js → matrix-card-HPskLaPy.js} +3 -3
  27. package/dist/chunks/{matrix-member-presentation-Dj7HaAHC.js → matrix-member-presentation-Bbrfrke4.js} +1 -1
  28. package/dist/chunks/{matrix-operation-contract-CpgLZ7E5.js → matrix-operation-contract-WPv4R-H_.js} +130 -130
  29. package/dist/chunks/{metric-comparison-C8LY7GG5.js → metric-comparison-ljMKYZKa.js} +2 -2
  30. package/dist/chunks/{model-change-CJEj3ZD6.js → model-change-Ccn1zaxl.js} +1 -1
  31. package/dist/chunks/{palette-stlpjVk4.js → palette-Bsh376zO.js} +1 -1
  32. package/dist/chunks/{pivot-result-contract-expectations-DMk-mKhG.js → pivot-result-contract-expectations-Bl5suy4-.js} +602 -696
  33. package/dist/chunks/{pivot-result-identity-CrQ54Xbj.js → pivot-result-identity-vS9TSh4f.js} +1 -1
  34. package/dist/chunks/{raw-temporal-presentation-BI2z2LlB.js → raw-temporal-presentation-BHm7s-hz.js} +230 -274
  35. package/dist/chunks/{report-preferences-dialog-Dc-YyVwf.js → report-preferences-dialog-BV8L0SeS.js} +55 -55
  36. package/dist/chunks/{report-runtime-context-CohdtiMg.js → report-runtime-context-BZQh9ywy.js} +2 -2
  37. package/dist/chunks/{resolve-dashboard-input-context-BZYI1hB0.js → resolve-dashboard-input-context-CAMiWvyR.js} +2021 -2239
  38. package/dist/chunks/{save-C1dgxgAu.js → save-B5EAsgQF.js} +1 -1
  39. package/dist/chunks/{saved-dashboard-context-CIBoMq46.js → saved-dashboard-context-n2Wn11cV.js} +57 -57
  40. package/dist/chunks/{selection-reducer-_d6aKJnj.js → selection-reducer-D0YnaAD9.js} +1 -1
  41. package/dist/chunks/{semaphor-ready-indicator-ERTLU7B4.js → semaphor-ready-indicator-XLBLOJ2V.js} +38446 -39176
  42. package/dist/chunks/{shelf-drop-preview-context-fEnx6iL_.js → shelf-drop-preview-context-DHMa54a-.js} +570 -570
  43. package/dist/chunks/source-entity-resolution-dUG5VWRm.js +607 -0
  44. package/dist/chunks/{switch-BqUan2mN.js → switch-ByxH4M7t.js} +3 -3
  45. package/dist/chunks/{table-export-sheet-CTCTA_bd.js → table-export-sheet-C_GdeTYU.js} +1 -1
  46. package/dist/chunks/{table-settings-DF1gdVQR.js → table-settings-Imz0FgWi.js} +8 -8
  47. package/dist/chunks/{temporal-input-presentation-DoSniQj1.js → temporal-input-presentation-uvNK_tM0.js} +1109 -820
  48. package/dist/chunks/{token-types-DFyLflLY.js → token-types-CQtXUVMy.js} +1 -1
  49. package/dist/chunks/{upload-DcoyjkRV.js → upload-wbR-NVzq.js} +1 -1
  50. package/dist/chunks/{use-create-flow-overlay-state-xhb9YFg-.js → use-create-flow-overlay-state-CEBaLOKC.js} +6 -6
  51. package/dist/chunks/validators-CXTneCA4.js +3453 -0
  52. package/dist/chunks/{zoned-wall-clock-E35Frf9v.js → zoned-wall-clock-B1n_WjW3.js} +1 -1
  53. package/dist/dashboard/index.js +2 -2
  54. package/dist/dashboard-authoring/index.js +2207 -1496
  55. package/dist/data-app-sdk/index.js +20 -20
  56. package/dist/data-app-sdk-adapters/index.js +3 -3
  57. package/dist/data-app-sdk-validation/index.js +6 -6
  58. package/dist/format-utils/index.js +181 -176
  59. package/dist/index.js +22 -22
  60. package/dist/report-runtime-context/index.js +2 -2
  61. package/dist/style.css +1 -1
  62. package/dist/surfboard/index.js +2 -2
  63. package/dist/types/components/editor/editor-aside/utils.d.ts +1 -1
  64. package/dist/types/components/visual/data-table/types/data-table.d.ts +5 -20
  65. package/dist/types/index.js +6 -6
  66. package/dist/types/lib/formatters/canonical-format-adapter.d.ts +2 -29
  67. package/dist/types/lib/formatters/raw-temporal-presentation.d.ts +0 -2
  68. package/dist/types/lib/formatters/table-column-settings.d.ts +47 -0
  69. package/dist/types/lib/matrix-table/matrix-card-adapter.d.ts +10 -188
  70. package/dist/types/lib/matrix-table/matrix-delivery-policy.d.ts +1 -1
  71. package/dist/types/lib/matrix-table/matrix-delivery.d.ts +16 -372
  72. package/dist/types/lib/stores/dashboard-store.d.ts +0 -1
  73. package/dist/types/lib/stores/editor-store.d.ts +39 -9
  74. package/dist/types/lib/stores/table-actions.d.ts +9 -3
  75. package/dist/types/lib/table-formatting/index.d.ts +0 -2
  76. package/dist/types/lib/table-formatting/table-conditional-formatting-range-source.d.ts +3 -2
  77. package/dist/types/lib/table-formatting/table-conditional-formatting-range.d.ts +3 -2
  78. package/dist/types/lib/table-formatting/table-formatting-normalize.d.ts +1 -2
  79. package/dist/types/lib/table-formatting/table-formatting-render-model.d.ts +9 -0
  80. package/dist/types/lib/table-formatting/table-formatting-types.d.ts +5 -95
  81. package/dist/types/lib/table-formatting/table-presentation-fields.d.ts +35 -0
  82. package/dist/types/lib/types/common-types.d.ts +40 -47
  83. package/dist/types/lib/types/explorer-types.d.ts +13 -44
  84. package/dist/types/lib/utils/card-config-utils.d.ts +9 -1
  85. package/dist/types/lib/utils/card-definition.d.ts +9 -187
  86. package/dist/types/shared/analytics-protocol/analytics-base-schemas.d.ts +159 -513
  87. package/dist/types/shared/analytics-protocol/contracts.d.ts +32 -9
  88. package/dist/types/shared/analytics-protocol/execution-input-schemas.d.ts +108 -980
  89. package/dist/types/shared/analytics-protocol/field-validation.d.ts +1 -0
  90. package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +281 -4624
  91. package/dist/types/shared/analytics-protocol/matrix-operation-contract.d.ts +20 -20
  92. package/dist/types/shared/analytics-protocol/matrix-operation-request.d.ts +18 -18
  93. package/dist/types/shared/analytics-protocol/matrix-path-contract.d.ts +40 -40
  94. package/dist/types/shared/analytics-protocol/matrix-window-contract.d.ts +3 -203
  95. package/dist/types/shared/analytics-protocol/scalar-value.d.ts +8 -8
  96. package/dist/types/shared/analytics-protocol/source-capabilities.d.ts +21 -0
  97. package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +8 -0
  98. package/dist/types/shared/assistant-protocol/context.d.ts +69 -69
  99. package/dist/types/shared/dashboard-authoring/canonical-result-keys.d.ts +13 -0
  100. package/dist/types/shared/dashboard-authoring/card-export-request.d.ts +4 -1
  101. package/dist/types/shared/dashboard-authoring/card-formats/sql-date-pattern.d.ts +10 -0
  102. package/dist/types/shared/dashboard-authoring/card-formats/upgrade-card-formats.d.ts +57 -0
  103. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +24 -24
  104. package/dist/types/shared/dashboard-authoring/conditional-formatting/editable.d.ts +14 -0
  105. package/dist/types/shared/dashboard-authoring/conditional-formatting/evaluate.d.ts +16 -0
  106. package/dist/types/shared/dashboard-authoring/conditional-formatting/index.d.ts +9 -0
  107. package/dist/types/shared/dashboard-authoring/conditional-formatting/kpi.d.ts +14 -0
  108. package/dist/types/shared/dashboard-authoring/conditional-formatting/resolve-card-column-ref.d.ts +17 -0
  109. package/dist/types/shared/dashboard-authoring/conditional-formatting/retain.d.ts +14 -0
  110. package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +4499 -0
  111. package/dist/types/shared/dashboard-authoring/conditional-formatting/store.d.ts +12 -0
  112. package/dist/types/shared/dashboard-authoring/conditional-formatting/types.d.ts +151 -0
  113. package/dist/types/shared/dashboard-authoring/conditional-formatting/upgrade.d.ts +35 -0
  114. package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +62 -62
  115. package/dist/types/shared/dashboard-authoring/dashboard-card-source-index.d.ts +2 -0
  116. package/dist/types/shared/dashboard-authoring/index.d.ts +5 -0
  117. package/dist/types/shared/dashboard-authoring/legacy-table-routing.d.ts +4 -2
  118. package/dist/types/shared/dashboard-authoring/matrix-authoring.d.ts +4 -5
  119. package/dist/types/shared/dashboard-authoring/matrix-delivery.d.ts +24 -736
  120. package/dist/types/shared/dashboard-authoring/retired-presentation-fields.d.ts +31 -0
  121. package/dist/types/shared/dashboard-authoring/upgrade-card-presentation.d.ts +14 -0
  122. package/dist/types/shared/format-utils/formatters/matrix-formatter.d.ts +5 -1
  123. package/dist/types/shared/format-utils/formatters/number-formatter.d.ts +16 -0
  124. package/dist/types/shared/format-utils/index.d.ts +2 -0
  125. package/dist/types/shared/format-utils/matrix-export-presentation.d.ts +10 -366
  126. package/dist/types/shared/format-utils/raw-temporal.d.ts +15 -1
  127. package/dist/types/shared/format-utils/resolve-column-format.d.ts +43 -0
  128. package/dist/types/shared/format-utils/retired-format-adapters.d.ts +68 -0
  129. package/dist/types/shared/format-utils/semantic-format.d.ts +5 -1
  130. package/dist/types/shared/format-utils/stored-value-format.d.ts +16 -0
  131. package/dist/types/shared/format-utils/types/format-types.d.ts +10 -12
  132. package/package.json +1 -1
  133. package/dist/chunks/analytics-base-schemas-BUFUoO6G.js +0 -472
  134. package/dist/chunks/editor-draft-sync-BN5qYHPF.js +0 -15
  135. package/dist/chunks/filter-reach-copy-BvJH9JO-.js +0 -3411
  136. package/dist/chunks/source-entity-resolution-DXW1HpKf.js +0 -816
  137. package/dist/chunks/validators-hmfNNQz8.js +0 -3595
  138. package/dist/types/lib/table-formatting/table-conditional-formatting-evaluator.d.ts +0 -9
  139. package/dist/types/lib/table-formatting/table-formatting-validation.d.ts +0 -12
@@ -1,3 +1,2 @@
1
- import { TableBaseFormatting, TableConditionalFormatting } from './table-formatting-types.js';
1
+ import { TableBaseFormatting } from './table-formatting-types.js';
2
2
  export declare function normalizeTableBaseFormatting(input: unknown): TableBaseFormatting;
3
- export declare function normalizeConditionalFormatting(input: unknown): TableConditionalFormatting;
@@ -2,9 +2,18 @@ import { ConditionalFormatColumn, ConditionalFormattingRenderContext, TableForma
2
2
  import { TablePreferences } from '../../components/visual/data-table/types/data-table.js';
3
3
  import { TCard } from '../types/common-types.js';
4
4
  import { QueryColumnKeyMap } from '../types/explorer-types.js';
5
+ import { SemaphorResultColumn } from '../../shared/analytics-protocol/contracts.js';
6
+ /**
7
+ * A table's base formatting and the card's rules resolved to the rows' result
8
+ * keys (conditional formatting store CR-D7): rules come from the card store,
9
+ * `preferences.conditionalFormatting`, and name columns by identity. Tables
10
+ * and detail tables run rules (CR-D6).
11
+ */
5
12
  export declare function buildTableFormattingRenderModel(args: {
6
13
  card?: TCard;
7
14
  columnKeyMap?: QueryColumnKeyMap;
15
+ /** The result's columns; their `pivotIdentity` resolves pivot references. */
16
+ resultColumns?: readonly SemaphorResultColumn[];
8
17
  tableKind: TableKind;
9
18
  renderContext: ConditionalFormattingRenderContext;
10
19
  columns: ConditionalFormatColumn[];
@@ -1,7 +1,7 @@
1
1
  import { CSSProperties } from 'react';
2
2
  import { ExactNumericValue } from '../../shared/analytics-protocol/scalar-value.js';
3
- import { MatrixAxis, MatrixPath } from '../../shared/analytics-protocol/matrix-path-contract.js';
4
- import { ColumnSettings, ColumnSettingsMap, TablePreferences } from '../../components/visual/data-table/types/data-table.js';
3
+ import { ColumnSettings, TablePreferences } from '../../components/visual/data-table/types/data-table.js';
4
+ import { ConditionalStyle, ResolvedConditionalRule } from '../../shared/dashboard-authoring/conditional-formatting/types.js';
5
5
  export type TableFormattingVersion = 1;
6
6
  export type TableKind = 'table' | 'detailTable' | 'matrixTable';
7
7
  export type TablePart = 'body' | 'header' | 'footer' | 'subtotal' | 'grandTotal';
@@ -42,95 +42,6 @@ export type TableBaseFormatting = {
42
42
  footer?: TableBaseStyle;
43
43
  }>;
44
44
  };
45
- export type ConditionalFormatTarget = {
46
- /** Scope resolved by the Matrix adapter before invoking the ordinary evaluator. */
47
- matrix?: {
48
- axis: MatrixAxis;
49
- levelId?: string;
50
- oppositePath?: Array<MatrixPath[number]>;
51
- };
52
- level: 'cell' | 'row';
53
- columnIds?: string[];
54
- conditionColumnId?: string;
55
- applyToColumnIds?: string[];
56
- tableParts?: TablePart[];
57
- rowRoles?: string[];
58
- depth?: number;
59
- includeTotals?: boolean;
60
- includeSubtotals?: boolean;
61
- };
62
- export type ConditionalFormatStyle = {
63
- backgroundColor?: string;
64
- textColor?: string;
65
- fontWeight?: 'normal' | 'medium' | 'semibold' | 'bold';
66
- italic?: boolean;
67
- textDecoration?: 'none' | 'underline' | 'line-through';
68
- icon?: 'arrowUp' | 'arrowDown' | 'warning' | 'check' | 'x';
69
- dataBar?: {
70
- color: string;
71
- showValue: boolean;
72
- };
73
- };
74
- export type ComparisonOperator = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte';
75
- export type ConditionalFormatCondition = {
76
- kind: 'comparison';
77
- columnId: string;
78
- operator: ComparisonOperator;
79
- value: unknown;
80
- } | {
81
- kind: 'between';
82
- columnId: string;
83
- min: unknown;
84
- max: unknown;
85
- inclusive?: boolean;
86
- } | {
87
- kind: 'blank';
88
- columnId: string;
89
- isBlank: boolean;
90
- } | {
91
- kind: 'contains';
92
- columnId: string;
93
- value: string;
94
- caseSensitive?: boolean;
95
- exact?: boolean;
96
- } | {
97
- kind: 'topBottom';
98
- columnId: string;
99
- direction: 'top' | 'bottom';
100
- count: number;
101
- } | {
102
- kind: 'colorScale';
103
- columnId: string;
104
- range: 'auto' | 'manual';
105
- min?: number;
106
- mid?: number;
107
- max?: number;
108
- colors: {
109
- min: string;
110
- mid?: string;
111
- max: string;
112
- };
113
- } | {
114
- kind: 'dataBar';
115
- columnId: string;
116
- range: 'auto' | 'manual';
117
- min?: number;
118
- max?: number;
119
- color: string;
120
- showValue?: boolean;
121
- };
122
- export type ConditionalFormatRule = {
123
- id: string;
124
- name?: string;
125
- enabled?: boolean;
126
- target: ConditionalFormatTarget;
127
- condition: ConditionalFormatCondition;
128
- style?: ConditionalFormatStyle;
129
- };
130
- export type TableConditionalFormatting = {
131
- version: TableFormattingVersion;
132
- rules: ConditionalFormatRule[];
133
- };
134
45
  export type TableFormattingMetadata = {
135
46
  ranges?: Record<string, {
136
47
  min: number | null;
@@ -188,7 +99,7 @@ export type ConditionalFormattingOverlay = {
188
99
  showValue: boolean;
189
100
  } | {
190
101
  kind: 'icon';
191
- icon: NonNullable<ConditionalFormatStyle['icon']>;
102
+ icon: NonNullable<ConditionalStyle['icon']>;
192
103
  };
193
104
  export type ConditionalFormattingResult = {
194
105
  cellStyle?: TableResolvedBaseStyle;
@@ -211,10 +122,9 @@ export type TableFormattingRenderModel = {
211
122
  rows: Array<Record<string, unknown>>;
212
123
  fullRows?: Array<Record<string, unknown>>;
213
124
  baseFormatting: TableBaseFormatting;
214
- conditionalFormatting: TableConditionalFormatting;
215
- columnSettingsByColumnId: ColumnSettingsMap;
125
+ /** The card's rules, resolved to the rows' result keys. */
126
+ conditionalRules: ResolvedConditionalRule[];
216
127
  rangePlan: RangeResolutionPlan;
217
128
  range: ConditionalFormattingRange;
218
129
  };
219
130
  export declare const EMPTY_TABLE_BASE_FORMATTING: TableBaseFormatting;
220
- export declare const EMPTY_TABLE_CONDITIONAL_FORMATTING: TableConditionalFormatting;
@@ -0,0 +1,35 @@
1
+ import { TCard } from '../types/common-types.js';
2
+ import { GroupByField, DetailField, MetricField, QueryColumnKeyMap, QueryColumnKeyRole } from '../types/explorer-types.js';
3
+ import { SemaphorPivotResultColumnIdentity } from '../../shared/analytics-protocol/index.js';
4
+ type PresentationField = GroupByField | DetailField | MetricField;
5
+ export type TableFieldLookup = {
6
+ columnId?: string;
7
+ columnIds?: string[];
8
+ metricId?: string;
9
+ metricAlias?: string;
10
+ fieldId?: string;
11
+ fieldRole?: QueryColumnKeyRole;
12
+ columnKeyMap?: QueryColumnKeyMap;
13
+ };
14
+ type TableResultColumns = readonly {
15
+ key: string;
16
+ pivotIdentity?: SemaphorPivotResultColumnIdentity;
17
+ }[];
18
+ /**
19
+ * How a table's column names its card field, for every reader and writer of
20
+ * its settings: the result's key map, and for one pivot value's column its
21
+ * measure (`pivotIdentity`), whose one format every pivot value shows
22
+ * (column formats CF-D23, ledger P5-29).
23
+ */
24
+ export declare function tableColumnFieldLookup(card: Pick<TCard, 'type'> | undefined, columnId: string, result: {
25
+ columnKeyMap?: QueryColumnKeyMap;
26
+ resultColumns?: TableResultColumns;
27
+ }): TableFieldLookup & {
28
+ columnId: string;
29
+ };
30
+ /** True when the field authors a format for numeric values (numeric or duration). */
31
+ export declare function hasNumericFieldFormat(field: Pick<PresentationField, 'format'> | undefined): boolean;
32
+ /** Resolve identity before presentation. A supplied map is authoritative; names
33
+ * and labels are only a unique-match adapter for results without bindings. */
34
+ export declare function resolveTablePresentationField(card: TCard | undefined, lookup: TableFieldLookup): PresentationField | undefined;
35
+ export {};
@@ -4,8 +4,8 @@ import { FontSpec } from 'chart.js';
4
4
  import { TChartType } from '../charts/types.js';
5
5
  import { QueryConfig } from './query-types.js';
6
6
  import { TablePreferences } from '../../components/visual/data-table/types/data-table.js';
7
- import { CalculatedFieldFormula, CardConfig, Field, FormatSpec, AggregateFunction, GroupByField, MetricField, PaginationConfig, DateFormatValue, EntityType, TimeGranularity, DataSource } from './explorer-types.js';
8
- import { ComparisonPresentationSpec, GlobalDateComparisonSelection, MetricComparisonPolarity, SemaphorDerivedFieldDefinition, TemporalBucketFormat } from '../../shared/analytics-protocol/index.js';
7
+ import { CalculatedFieldFormula, CardConfig, Field, AggregateFunction, GroupByField, MetricField, PaginationConfig, DateFormatValue, EntityType, TimeGranularity, DataSource } from './explorer-types.js';
8
+ import { ComparisonPresentationSpec, GlobalDateComparisonSelection, MetricComparisonPolarity, SemaphorDerivedFieldDefinition, SemaphorValueFormat, TemporalBucketFormat } from '../../shared/analytics-protocol/index.js';
9
9
  import { DashboardFilterApplication, DashboardFilterOptionSource, DashboardFilterOptionDependencies, DashboardFilterOptionPopulation } from '../../shared/dashboard-authoring/dashboard-filter-mapping-types.js';
10
10
  import { ClickToFilterSettings, LinkedClickToFilterOverrides } from '../../shared/dashboard-authoring/click-to-filter-settings.js';
11
11
  import { SelectionInputValue } from '../../shared/analytics-protocol/selection-contract.js';
@@ -17,6 +17,7 @@ import { SemanticExecutionPayload } from './semantic-runtime-types.js';
17
17
  import { ReportRuntimeContext } from '../../shared/report-runtime-context/index.js';
18
18
  import { LiveScreenPort } from '../../shared/live-channel/index.js';
19
19
  import { CsvEncoding } from '../../shared/format-utils/exporters/csv-utils.js';
20
+ import { DateCanonicalFormat } from '../../shared/format-utils/types/index.js';
20
21
  import { PresentationExecutionSnapshot, TemporalInputPresentation } from '../../shared/format-utils/index.js';
21
22
  import { JSX } from 'react';
22
23
  export type { DashboardFilterApplication, DashboardFilterBoundCardApplication, DashboardFilterCardApplication, DashboardFilterExcludedCardApplication, DashboardFilterTarget, DashboardFilterTargetField, DashboardFilterTargetSource, DashboardFilterOptionSource, } from '../../shared/dashboard-authoring/dashboard-filter-mapping-types.js';
@@ -59,7 +60,7 @@ export type TDataColumn = {
59
60
  aggregateOrigin?: import('./explorer-types.js').Field['aggregateOrigin'];
60
61
  labelOrigin?: import('./explorer-types.js').Field['labelOrigin'];
61
62
  formatOrigin?: import('./explorer-types.js').Field['formatOrigin'];
62
- format?: FormatSpec;
63
+ format?: import('../../shared/analytics-protocol/index.js').SemaphorValueFormat;
63
64
  granularity?: TimeGranularity;
64
65
  sourceField?: string;
65
66
  aggregate?: AggregateFunction;
@@ -336,7 +337,6 @@ export type NumberOptions = {
336
337
  locale: string;
337
338
  currency?: string;
338
339
  options: Intl.NumberFormatOptions;
339
- colorRanges?: ColorRange[];
340
340
  };
341
341
  export type DateOptions = {
342
342
  locale: string;
@@ -430,9 +430,14 @@ export type TFormatOptions = {
430
430
  useSuffix?: boolean;
431
431
  useGrouping?: boolean;
432
432
  negativeInParentheses?: boolean;
433
+ /** Whether a sign shows (column formats CF-D16). */
434
+ signDisplay?: 'auto' | 'always' | 'exceptZero' | 'never';
433
435
  multiplyBy?: number;
434
436
  percentValueMode?: 'fraction' | 'whole';
435
437
  dateFormat?: string;
438
+ /** `dateFormat`'s token set, as stored; absent means Semaphor tokens. */
439
+ dateDialect?: DateCanonicalFormat['dialect'];
440
+ datePreset?: DateCanonicalFormat['preset'];
436
441
  timezone?: string;
437
442
  sourceTimezone?: string;
438
443
  relative?: boolean;
@@ -443,9 +448,8 @@ export type TFormatOptions = {
443
448
  durationMaxUnits?: number;
444
449
  };
445
450
  export type TTooltipFormatConfig = {
446
- formatMode?: 'inherit' | 'override';
447
- /** @deprecated Use formatMode */
448
- mode?: 'inherit' | 'override';
451
+ /** The tooltip's own format; absent means the column's format (column formats CF-D3). */
452
+ valueFormat?: SemaphorValueFormat;
449
453
  formatOptions?: TFormatOptions;
450
454
  };
451
455
  export type TBulletRangeLabels = 'poor' | 'satisfactory' | 'good';
@@ -583,13 +587,20 @@ export type TBubbleScatterConfig = {
583
587
  };
584
588
  export type TDataLabelsConfig = {
585
589
  enabled?: boolean;
590
+ /** This surface's own format; absent means the column's format (column formats CF-D3). */
591
+ valueFormat?: SemaphorValueFormat;
586
592
  position?: 'center' | 'top' | 'bottom' | 'left' | 'right' | 'auto' | 'custom';
587
593
  anchor?: 'center' | 'start' | 'end';
588
594
  align?: 'center' | 'start' | 'end' | 'top' | 'bottom' | number;
589
595
  display?: 'auto' | boolean;
590
- formatMode?: 'inherit' | 'override';
591
- /** @deprecated Use formatMode + formatOptions.type */
596
+ /**
597
+ * A series' own labels only (per-series settings, which this type also
598
+ * describes; outside the column formats plan). The card's
599
+ * `dataLabelsConfig` stores `valueFormat`, and a saved `format` or
600
+ * `formatOptions` there is refused (column formats CF-D8).
601
+ */
592
602
  format?: 'auto' | 'number' | 'currency' | 'percent' | 'date' | 'scientific' | 'duration' | 'none';
603
+ /** A series' own labels only, with `format`. */
593
604
  formatOptions?: TFormatOptions;
594
605
  font?: {
595
606
  size?: number;
@@ -637,21 +648,6 @@ export type TChartOptions = {
637
648
  };
638
649
  treemapColorMode?: 'branch' | 'category';
639
650
  };
640
- export type NumberAxisFormat = {
641
- decimalPlaces?: number;
642
- minimumFractionDigits?: number;
643
- maximumFractionDigits?: number;
644
- suffix?: string;
645
- currency?: string;
646
- locale?: string;
647
- useGrouping?: boolean;
648
- percentValueMode?: 'fraction' | 'whole';
649
- };
650
- export type ColorRange = {
651
- start: number;
652
- end: number;
653
- color: string;
654
- };
655
651
  export type ColorConfig = {
656
652
  segments: Record<string, string>;
657
653
  };
@@ -670,16 +666,34 @@ export type AxisConfig = {
670
666
  enabled: boolean;
671
667
  rotation?: 'auto' | 0 | 45 | 90 | -45 | -90;
672
668
  };
673
- formatMode?: 'inherit' | 'override';
674
- formatOptions?: TFormatOptions;
669
+ /** This axis's own format; absent means the measures' format (column formats CF-D3). */
670
+ valueFormat?: SemaphorValueFormat;
675
671
  scale?: {
676
672
  min?: number | 'auto';
677
673
  max?: number | 'auto';
678
674
  stepSize?: number | 'auto';
679
675
  };
680
676
  };
677
+ /** A SQL or Python card's settings for one result column (column formats CF-D2). */
678
+ export type SqlColumnPresentation = {
679
+ format?: SemaphorValueFormat;
680
+ };
681
+ /**
682
+ * A SQL KPI's value column: the first numeric result column, with the second
683
+ * as its prior, so it is positional (column formats CF-D24).
684
+ */
685
+ export type SqlKpiValuePresentation = {
686
+ format?: SemaphorValueFormat;
687
+ comparisonPolarity?: MetricComparisonPolarity;
688
+ };
681
689
  export type TCardPreferences = {
682
690
  comparisonPresentation?: ComparisonPresentationSpec;
691
+ /** A SQL or Python card's column settings, by result key. */
692
+ sqlColumns?: Record<string, SqlColumnPresentation>;
693
+ /** A SQL KPI's value format and polarity. */
694
+ sqlKpiValue?: SqlKpiValuePresentation;
695
+ /** The card's conditional formatting rules, for every card kind that has them (conditional formatting store CR-D2). */
696
+ conditionalFormatting?: import('../../shared/dashboard-authoring/conditional-formatting/types.js').CardConditionalFormatting;
683
697
  /** Absence means eligible metrics inherit the Global Date comparison. */
684
698
  inheritGlobalComparison?: false;
685
699
  /** Separate two-metric KPI feature; defaults to false. */
@@ -689,23 +703,8 @@ export type TCardPreferences = {
689
703
  filterOnClickField?: string;
690
704
  filterOnClickColumnIndex?: number;
691
705
  sortChart?: 'asc' | 'desc' | 'none';
692
- formatNumber?: {
693
- decimalPlaces?: number;
694
- minimumFractionDigits?: number;
695
- maximumFractionDigits?: number;
696
- currency?: string;
697
- locale?: string;
698
- suffix?: string;
699
- prefix?: string;
700
- useGrouping?: boolean;
701
- percentValueMode?: 'fraction' | 'whole';
702
- enabled?: boolean | string;
703
- colorRanges?: ColorRange[];
704
- };
705
- numberAxisFormat?: NumberAxisFormat;
706
706
  datasetOptions?: TDatasetOptions[];
707
707
  chartOptions?: TChartOptions;
708
- columnSettings?: TColumnSetting<DisplayDataType>[];
709
708
  colorConfig?: ColorConfig;
710
709
  xAxisConfig?: AxisConfig;
711
710
  yAxisConfig?: AxisConfig;
@@ -748,12 +747,6 @@ export type TCardPreferences = {
748
747
  kpiVisualOptions?: {
749
748
  countryLogoId?: string;
750
749
  valueAlignment?: 'left' | 'center';
751
- formatOptions?: TFormatOptions;
752
- /**
753
- * Presentation-only polarity for a query-backed KPI's manually returned
754
- * current/prior value pair. Governed KPIs use per-metric polarity instead.
755
- */
756
- queryComparisonPolarity?: MetricComparisonPolarity;
757
750
  };
758
751
  displayOptions?: {
759
752
  showFilterInfo?: boolean;
@@ -1,5 +1,5 @@
1
1
  import { TimeDrillStep } from './interaction-types.js';
2
- import { SemaphorDerivedFieldDefinition, MatrixConfig, SemaphorSourceRef, SemaphorResultColumn, SemaphorPivotValue, SemaphorTimeGrain, SemanticGroupedTemporalInput, TemporalBucketMetadata, TemporalBucketFormat, MetricComparisonConfig, MetricComparisonPolarity } from '../../shared/analytics-protocol/index.js';
2
+ import { SemaphorDerivedFieldDefinition, MatrixConfig, SemaphorSourceRef, SemaphorResultColumn, SemaphorPivotValue, SemaphorTimeGrain, SemanticGroupedTemporalInput, TemporalBucketMetadata, TemporalBucketFormat, SemaphorScalarValueFormat, SemaphorValueFormat, MetricComparisonConfig, MetricComparisonPolarity, SemaphorConnectionType } from '../../shared/analytics-protocol/index.js';
3
3
  import { FlatTableExportTotalsBehavior, FlatTableExportTotalsRequest, QueryColumnKeyMap as SharedQueryColumnKeyMap } from '../../shared/format-utils/index.js';
4
4
  import { CardQuerySourceRowEvidence, TemporalResultOwner } from '../../shared/dashboard-authoring/index.js';
5
5
  import { RelativeDateFilter } from '../../shared/analytics-protocol/relative-date-filter.js';
@@ -33,7 +33,8 @@ export type SemanticTemporalPresentation = {
33
33
  granularity: SemaphorTimeGrain;
34
34
  format: TemporalBucketFormat;
35
35
  };
36
- export type ConnectionType = 'GoogleSheets' | 'FileUpload' | 'MySQL' | 'MSSQL' | 'PostgreSQL' | 'BigQuery' | 'Redshift' | 'Snowflake' | 'S3' | 'clickhouse' | 'API' | 'none';
36
+ /** The connection types a saved data source names (one list, `SEMAPHOR_CONNECTION_TYPES`). */
37
+ export type ConnectionType = SemaphorConnectionType;
37
38
  export type Dialect = 'mysql' | 'postgres' | 'bigquery' | 'redshift' | 'snowflake' | 'clickhouse' | 'duckdb' | 'mssql';
38
39
  export interface Field {
39
40
  /**
@@ -77,7 +78,13 @@ export interface Field {
77
78
  nativeDataType?: string;
78
79
  description?: string;
79
80
  qualifiedEntityName?: string;
81
+ /**
82
+ * Request only: the SQL date pattern `withSqlDatePattern` derives from
83
+ * `format` for the query builder. Never stored or read for presentation
84
+ * (column formats CF-D4, CF-D10); a saved one is refused.
85
+ */
80
86
  dateFormat?: DateFormatValue;
87
+ /** Request only, with `dateFormat: 'custom'`. */
81
88
  customFormat?: string;
82
89
  granularity?: TimeGranularity;
83
90
  entityId: string;
@@ -95,7 +102,7 @@ export interface Field {
95
102
  * runtime artifacts rather than semantic-domain definitions.
96
103
  */
97
104
  derivedField?: SemaphorDerivedFieldDefinition;
98
- format?: FormatSpec;
105
+ format?: SemaphorValueFormat;
99
106
  /**
100
107
  * Source-level temporal presentation keeps the semantic grain that authored
101
108
  * the format. The card's mutable `granularity` remains the active query
@@ -280,7 +287,7 @@ export interface DomainCalculatedMetric {
280
287
  expression: string;
281
288
  inputs: Record<string, InputReference>;
282
289
  metricType?: 'base' | 'derived' | 'calculated';
283
- format?: ScalarFormatSpec;
290
+ format?: SemaphorScalarValueFormat;
284
291
  tags?: string[];
285
292
  isCertified?: boolean;
286
293
  aggregationStrategy?: AggregationStrategy;
@@ -310,44 +317,6 @@ export type DimensionInputReference = {
310
317
  } | {
311
318
  dimension: string;
312
319
  };
313
- export type FormatSpec = {
314
- type: 'number' | 'currency' | 'percent' | 'percentage' | 'scientific';
315
- locale?: string;
316
- minimumFractionDigits?: number;
317
- maximumFractionDigits?: number;
318
- useGrouping?: boolean;
319
- prefix?: string;
320
- suffix?: string;
321
- negativeStyle?: 'minus' | 'parentheses';
322
- compact?: boolean;
323
- scale?: number;
324
- currency?: string;
325
- percentValueMode?: 'fraction' | 'whole';
326
- } | {
327
- type: 'date';
328
- locale?: string;
329
- pattern?: string;
330
- relative?: boolean;
331
- timezone?: string;
332
- sourceTimezone?: string;
333
- prefix?: string;
334
- suffix?: string;
335
- } | {
336
- type: 'duration';
337
- inputUnit?: 'millisecond' | 'second' | 'minute' | 'hour' | 'day';
338
- outputStyle?: 'compact' | 'digital' | 'long';
339
- largestUnit?: 'millisecond' | 'second' | 'minute' | 'hour' | 'day';
340
- smallestUnit?: 'millisecond' | 'second' | 'minute' | 'hour' | 'day';
341
- maxUnits?: number;
342
- prefix?: string;
343
- suffix?: string;
344
- negativeStyle?: 'minus' | 'parentheses';
345
- } | {
346
- type: 'string';
347
- prefix?: string;
348
- suffix?: string;
349
- } | TemporalBucketFormat;
350
- export type ScalarFormatSpec = Exclude<FormatSpec, TemporalBucketFormat>;
351
320
  export type AggregationStrategy = 'default' | 'symmetric_aggregate' | 'aggregate_then_join' | 'weighted';
352
321
  /**
353
322
  * IMPORTANT: Why we store qualifiedFieldNames as strings instead of Field objects
@@ -452,8 +421,6 @@ export interface PivotByField extends Field {
452
421
  */
453
422
  export interface DetailField extends Omit<Field, 'role' | 'granularity'> {
454
423
  role: 'detail';
455
- dateFormat?: DateFormatValue;
456
- customFormat?: string;
457
424
  /**
458
425
  * Optional SQL expression for calculated detail fields.
459
426
  */
@@ -728,6 +695,8 @@ export interface QueryExecutionResponse extends CardQuerySourceRowEvidence {
728
695
  pivotSchema?: any;
729
696
  pagination?: PaginationMetadata;
730
697
  columnKeyMap?: QueryColumnKeyMap;
698
+ /** The live model format of each config column that has one, by card field id (column formats CF-D23). */
699
+ modelFormats?: Record<string, SemaphorValueFormat>;
731
700
  tableTotalsByColumnId?: Record<string, string | number | null>;
732
701
  documentTableTotalsBaseSql?: string;
733
702
  metadata?: any;
@@ -2,6 +2,14 @@ import { CardConfig, DataSource, Field, FilterGroup, JoinPlan } from '../types/e
2
2
  import { TCard } from '../types/common-types.js';
3
3
  /** Matrix acquisition requires its structured definition, never an authored SQL query. */
4
4
  export declare function supportsSqlEditor(cardType: TCard['type']): boolean;
5
+ /**
6
+ * Whether a stored card opens in SQL mode: it holds SQL or Python and its
7
+ * type takes them. A card stored with both modes opens in SQL mode, as it
8
+ * runs (editor modes across tabs EM-5).
9
+ */
10
+ export declare function cardOpensInDevMode(card: Pick<TCard, 'type' | 'sql' | 'python'>): boolean;
11
+ /** A card stored with both modes, as cards were before each tab kept its mode: it opens, and saves, in SQL mode. */
12
+ export declare function cardHoldsBothModes(card: Pick<TCard, 'type' | 'sql' | 'python' | 'config'>): boolean;
5
13
  export declare function hasEditorResultsView(cardType: TCard['type']): boolean;
6
14
  export declare function hasEditorInfoView(cardType: TCard['type']): boolean;
7
15
  /** The deprecated table types every saved card of which loads as Matrix (pivot-aggregate-to-matrix). */
@@ -25,7 +33,7 @@ export declare function isLegacyTableCard<T extends {
25
33
  * The problem-area codes (PA-n) are the shapes a later rule will translate;
26
34
  * display differences are never gaps (PM-D15).
27
35
  */
28
- export type CardTypeChangeGapCode = 'calculated_metric_per_row' | 'calculated_metric_without_stage' | 'calculated_field_card_scope' | 'calculated_field_dashboard_scope' | 'source_field_renamed' | 'join_not_carried' | 'metric_parameters' | 'unknown_field_property' | 'calculated_level_without_inputs' | 'field_not_resolvable' | 'filter_not_accepted' | 'control_binding' | 'no_shelf_fields' | 'matrix_definition_incomplete' | 'detail_columns' | 'matrix_field_not_on_shelves' | 'not_in_detail_table';
36
+ export type CardTypeChangeGapCode = 'calculated_metric_per_row' | 'calculated_metric_without_stage' | 'calculated_field_card_scope' | 'calculated_field_dashboard_scope' | 'source_field_renamed' | 'join_not_carried' | 'metric_parameters' | 'unknown_field_property' | 'calculated_level_without_inputs' | 'field_not_resolvable' | 'filter_not_accepted' | 'control_binding' | 'no_shelf_fields' | 'matrix_definition_incomplete' | 'connection_type_unresolved' | 'detail_columns' | 'matrix_field_not_on_shelves' | 'not_in_detail_table';
29
37
  export type CardTypeChangeGap = {
30
38
  code: CardTypeChangeGapCode;
31
39
  label: string;