react-semaphor 0.1.602 → 0.1.604

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 (211) hide show
  1. package/dist/activity/index.js +1 -73
  2. package/dist/analytics-protocol/index.js +1 -1451
  3. package/dist/appearance/index.js +1 -12
  4. package/dist/appearance-runtime/index.js +1 -5
  5. package/dist/assistant-context/index.js +1 -11
  6. package/dist/assistant-protocol/index.js +1 -152
  7. package/dist/brand-studio/index.js +4 -1594
  8. package/dist/briefings/index.js +1 -70
  9. package/dist/chunks/add-to-dashboard-DeHEBEqG.js +12 -0
  10. package/dist/chunks/analytics-base-schemas-BREc5WGv.js +1 -0
  11. package/dist/chunks/appearance-context-BqBZrijL.js +1 -0
  12. package/dist/chunks/appearance-runtime-provider-DmbCrOOG.js +1 -0
  13. package/dist/chunks/applied-constraints-CinevlKD.js +1 -0
  14. package/dist/chunks/assistant-chat-CjYrwVDa.js +56 -0
  15. package/dist/chunks/attribution-BEFSsbNn.js +1 -0
  16. package/dist/chunks/availability-3AIOf6Z-.js +1 -0
  17. package/dist/chunks/bookmark-impact-C89zBLq3.js +1 -0
  18. package/dist/chunks/bookmark-state-69YYnRql.js +1 -0
  19. package/dist/chunks/brand-DCaZyRt6.js +1 -0
  20. package/dist/chunks/card-filter-builder-CTp6RAz1.js +17 -0
  21. package/dist/chunks/column-bands-DwxbZ6UI.js +1 -0
  22. package/dist/chunks/comparison-window-caption-C312mn3s.js +1 -0
  23. package/dist/chunks/context-ALdccLHw.js +2 -0
  24. package/dist/chunks/conversation-JMK2kyTK.js +1 -0
  25. package/dist/chunks/dashboard-BX28ld6s.js +1 -0
  26. package/dist/chunks/dashboard-briefing-launcher-qo7GH4EO.js +37 -0
  27. package/dist/chunks/dashboard-controls-DhRjB7MA.js +42 -0
  28. package/dist/chunks/dashboard-json-9cHzhSjC.js +1 -0
  29. package/dist/chunks/dates-D-KP8G-z.js +1 -0
  30. package/dist/chunks/edit-DEAK0UZo.js +1 -0
  31. package/dist/chunks/edit-dashboard-visual-Duq_QkB_.js +93 -0
  32. package/dist/chunks/export-file-format-B-wQNHIn.js +4 -0
  33. package/dist/chunks/filter-line-CwQrqORc.js +1 -0
  34. package/dist/chunks/filter-reach-preview-gixPFlZj.js +1 -0
  35. package/dist/chunks/filter-value-text-B3tXakhd.js +1 -0
  36. package/dist/chunks/index-B-VF1ogs.js +1 -0
  37. package/dist/chunks/index-BE1DfxNs.js +1 -0
  38. package/dist/chunks/index-DViPGDFj.js +1 -0
  39. package/dist/chunks/layout-grid-BWtlgw0T.js +6 -0
  40. package/dist/chunks/matrix-analytical-definition-CtFqWyCK.js +1 -0
  41. package/dist/chunks/matrix-member-presentation-Q0MCJ-YK.js +1 -0
  42. package/dist/chunks/matrix-operation-contract-D1RC1bfi.js +1 -0
  43. package/dist/chunks/metric-comparison-DEZYXROZ.js +1 -0
  44. package/dist/chunks/normalize-dashboard-for-dirty-check-ILKfqgL3.js +1 -0
  45. package/dist/chunks/paintbrush-BjS3SbrH.js +6 -0
  46. package/dist/chunks/palette-BzC-CGOc.js +6 -0
  47. package/dist/chunks/pickers-DuBrUht0.js +1 -0
  48. package/dist/chunks/pivot-result-contract-expectations-DTQAgr4n.js +1 -0
  49. package/dist/chunks/pivot-result-identity-DTNCB--h.js +1 -0
  50. package/dist/chunks/raw-temporal-value-DeyEhL0S.js +1 -0
  51. package/dist/chunks/rendered-file-BbvwaU6z.js +1 -0
  52. package/dist/chunks/report-preferences-dialog-B_gUmCzG.js +1 -0
  53. package/dist/chunks/report-runtime-context-BWzIHCKK.js +1 -0
  54. package/dist/chunks/resolve-dashboard-input-context-B-TtRqxu.js +8 -0
  55. package/dist/chunks/resolver-AN9ChBfZ.js +1 -0
  56. package/dist/chunks/save-DdFUZcbi.js +6 -0
  57. package/dist/chunks/saved-dashboard-context-BAJ5tWiq.js +1 -0
  58. package/dist/chunks/schema-MC0cQSAb.js +4 -0
  59. package/dist/chunks/selection-filter-compiler-CCoCD25M.js +1 -0
  60. package/dist/chunks/semaphor-ready-indicator-DzjorP3t.js +999 -0
  61. package/dist/chunks/set-DuJfGkbY.js +1 -0
  62. package/dist/chunks/shelf-drop-preview-context-BlLJ5RsT.js +6 -0
  63. package/dist/chunks/stored-dashboard-Ctcpkllg.js +1 -0
  64. package/dist/chunks/style-sheet-parts-BRGt9O05.js +178 -0
  65. package/dist/chunks/table-export-sheet-rC5pKmXg.js +2 -0
  66. package/dist/chunks/token-types-Bj9iMy0w.js +1 -0
  67. package/dist/chunks/validators-CqV3Yka1.js +1 -0
  68. package/dist/chunks/variable-draft-DJrfUyhv.js +1 -0
  69. package/dist/chunks/visual-choice-DgEFfkE-.js +1 -0
  70. package/dist/dashboard/index.js +1 -7
  71. package/dist/dashboard-authoring/index.js +1 -4491
  72. package/dist/format-utils/index.js +1 -424
  73. package/dist/index.js +1 -554
  74. package/dist/layouts/index.js +1 -7
  75. package/dist/live-channel/index.js +1 -124
  76. package/dist/pdf-export-policy/index.js +1 -92
  77. package/dist/pdf-table-layout/index.js +1 -993
  78. package/dist/report-runtime-context/index.js +1 -9
  79. package/dist/shared/index.js +1 -6
  80. package/dist/style.css +1 -1
  81. package/dist/surfboard/index.js +1 -9
  82. package/dist/types/components/ui-custom/date-range-presets.d.ts +8 -0
  83. package/dist/types/index.js +1 -88
  84. package/dist/types/lib/document/document-edits.d.ts +0 -4
  85. package/dist/types/lib/filter-values/build-card-filter-definition.d.ts +32 -0
  86. package/dist/types/lib/query-context/dashboard-filter-mapping-resolution.d.ts +9 -0
  87. package/dist/types/lib/stores/dashboard-store.d.ts +0 -1
  88. package/dist/types/lib/stores/explorer-actions.d.ts +7 -6
  89. package/dist/types/lib/types/common-types.d.ts +0 -2
  90. package/dist/types/lib/types/explorer-types.d.ts +1 -1
  91. package/dist/types/lib/types/semantic-types.d.ts +6 -10
  92. package/dist/types/lib/utils/field-state-calculator.d.ts +7 -19
  93. package/dist/types/shared/analytics-protocol/analytics-base-schemas.d.ts +18 -0
  94. package/dist/types/shared/analytics-protocol/analyze-result-types.d.ts +3 -0
  95. package/dist/types/shared/analytics-protocol/comparison-choices.d.ts +92 -0
  96. package/dist/types/shared/analytics-protocol/comparison-placement.d.ts +30 -0
  97. package/dist/types/shared/analytics-protocol/contracts.d.ts +11 -5
  98. package/dist/types/shared/analytics-protocol/date-window.d.ts +105 -0
  99. package/dist/types/shared/analytics-protocol/filter-field-ownership.d.ts +27 -0
  100. package/dist/types/shared/analytics-protocol/fixtures.d.ts +4 -2
  101. package/dist/types/shared/analytics-protocol/index.d.ts +3 -0
  102. package/dist/types/shared/analytics-protocol/metric-comparison.d.ts +93 -11
  103. package/dist/types/shared/assistant-protocol/context.d.ts +16 -16
  104. package/dist/types/shared/dashboard-authoring/calculations/calculated-column.d.ts +1 -1
  105. package/dist/types/shared/dashboard-authoring/calculations/definition.d.ts +13 -0
  106. package/dist/types/shared/dashboard-authoring/card-data-source/card-base.d.ts +125 -0
  107. package/dist/types/shared/dashboard-authoring/card-data-source/card-field-folders.d.ts +55 -0
  108. package/dist/types/shared/dashboard-authoring/card-data-source/card-joins.d.ts +114 -0
  109. package/dist/types/shared/dashboard-authoring/card-data-source/card-prune.d.ts +12 -0
  110. package/dist/types/shared/dashboard-authoring/card-data-source/filter-field-catalog.d.ts +60 -0
  111. package/dist/types/shared/dashboard-authoring/card-data-source/filter-field-folders.d.ts +132 -0
  112. package/dist/types/shared/dashboard-authoring/card-data-source/index.d.ts +7 -0
  113. package/dist/types/shared/dashboard-authoring/card-data-source/join-reach.d.ts +42 -0
  114. package/dist/types/shared/dashboard-authoring/card-field-places.d.ts +28 -0
  115. package/dist/types/shared/dashboard-authoring/card-settings/card-display-write.d.ts +8 -0
  116. package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +1 -1
  117. package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +2 -1
  118. package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +0 -3
  119. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +21 -358
  120. package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +2 -0
  121. package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +10 -10
  122. package/dist/types/shared/dashboard-authoring/dashboard-variable-card.d.ts +2 -4
  123. package/dist/types/shared/dashboard-authoring/field-folders/field-folders.d.ts +115 -0
  124. package/dist/types/shared/dashboard-authoring/field-folders/index.d.ts +1 -0
  125. package/dist/types/shared/dashboard-authoring/filter-reach-decision.d.ts +11 -0
  126. package/dist/types/shared/dashboard-authoring/index.d.ts +6 -1
  127. package/dist/types/shared/dashboard-authoring/kpi-date-context.d.ts +2 -0
  128. package/dist/types/shared/dashboard-authoring/kpi-figure.d.ts +18 -0
  129. package/dist/types/shared/dashboard-authoring/measure-calculations/comparison.d.ts +8 -7
  130. package/dist/types/shared/dashboard-authoring/measure-calculations/dates.d.ts +11 -1
  131. package/dist/types/shared/dashboard-authoring/measure-calculations/index.d.ts +2 -2
  132. package/dist/types/shared/dashboard-authoring/measure-calculations/options.d.ts +4 -0
  133. package/dist/types/shared/dashboard-authoring/measure-calculations/read.d.ts +18 -1
  134. package/dist/types/shared/dashboard-authoring/measure-calculations/resolve.d.ts +2 -0
  135. package/dist/types/shared/dashboard-authoring/measure-calculations/schemas.d.ts +46 -88
  136. package/dist/types/shared/dashboard-authoring/operations/calculated-field-operations.d.ts +33 -8
  137. package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +0 -2
  138. package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +5 -0
  139. package/dist/types/shared/dashboard-authoring/see-records/result.d.ts +7 -22
  140. package/dist/types/shared/format-utils/comparison-detail.d.ts +34 -0
  141. package/dist/types/shared/format-utils/index.d.ts +1 -0
  142. package/dist/types/shared/format-utils/partial-period.d.ts +4 -2
  143. package/dist/types/shared/temporal/calendar-periods.d.ts +11 -0
  144. package/dist/types/shared/temporal/index.d.ts +2 -0
  145. package/dist/types/shared/temporal/temporal-text.d.ts +33 -0
  146. package/dist/types/shared/temporal/temporal.d.ts +27 -0
  147. package/dist/types/shared/temporal/zoned-wall-clock.d.ts +4 -3
  148. package/dist/usage-events/index.js +1 -285
  149. package/dist/value-format-preferences/index.js +1 -635
  150. package/package.json +6 -2
  151. package/dist/chunks/add-to-dashboard-ClhEIFst.js +0 -291
  152. package/dist/chunks/analytics-base-schemas-DevrgqQb.js +0 -678
  153. package/dist/chunks/appearance-context-BwBp25ZG.js +0 -162
  154. package/dist/chunks/appearance-runtime-provider-BRHYELkC.js +0 -80
  155. package/dist/chunks/applied-constraints-DU-wndZ7.js +0 -47
  156. package/dist/chunks/assistant-chat-BWF3GYip.js +0 -6115
  157. package/dist/chunks/attribution-BvoKvhcj.js +0 -32
  158. package/dist/chunks/availability-Bp5Gfu1I.js +0 -44
  159. package/dist/chunks/bookmark-impact-BF3iRx5a.js +0 -76
  160. package/dist/chunks/bookmark-state-CBSTdW6q.js +0 -1666
  161. package/dist/chunks/brand-BoUV0iHF.js +0 -54
  162. package/dist/chunks/card-filter-builder-B8XHwMY6.js +0 -4069
  163. package/dist/chunks/column-bands-RdM-kjDe.js +0 -47
  164. package/dist/chunks/comparison-window-caption-W83qB4V5.js +0 -741
  165. package/dist/chunks/context-BJoEFgNl.js +0 -369
  166. package/dist/chunks/conversation-sQiWYUOb.js +0 -16
  167. package/dist/chunks/dashboard-DG5EIYYB.js +0 -14
  168. package/dist/chunks/dashboard-briefing-launcher-CBSrhyWZ.js +0 -4875
  169. package/dist/chunks/dashboard-controls-D6ECO4N1.js +0 -2290
  170. package/dist/chunks/dashboard-json-DrJftBSL.js +0 -66
  171. package/dist/chunks/dates-Bz-qM5px.js +0 -164
  172. package/dist/chunks/edit-9df1zOWe.js +0 -226
  173. package/dist/chunks/edit-dashboard-visual-BDYAJIbb.js +0 -18605
  174. package/dist/chunks/export-file-format-C-tJsxsf.js +0 -111
  175. package/dist/chunks/filter-line-BXT6y303.js +0 -703
  176. package/dist/chunks/filter-reach-copy-BukhZmzm.js +0 -5250
  177. package/dist/chunks/filter-value-text-D3-bf3_b.js +0 -153
  178. package/dist/chunks/index-BVKzKl5d.js +0 -90
  179. package/dist/chunks/index-BW0yozjs.js +0 -2795
  180. package/dist/chunks/index-CV_Kzou0.js +0 -595
  181. package/dist/chunks/layout-grid-Ds0diMeY.js +0 -16
  182. package/dist/chunks/matrix-analytical-definition-CgQgVeeI.js +0 -1162
  183. package/dist/chunks/matrix-member-presentation-DSBIIudt.js +0 -258
  184. package/dist/chunks/matrix-operation-contract--DkNCOzd.js +0 -1412
  185. package/dist/chunks/metric-comparison-zMylnIkc.js +0 -541
  186. package/dist/chunks/normalize-dashboard-for-dirty-check-XKgH3GFX.js +0 -119
  187. package/dist/chunks/paintbrush-CX8pao1j.js +0 -27
  188. package/dist/chunks/palette-CuA0HlzF.js +0 -23
  189. package/dist/chunks/pickers-DkqmtnTL.js +0 -2403
  190. package/dist/chunks/pivot-result-contract-expectations-C8KL7hPx.js +0 -5046
  191. package/dist/chunks/pivot-result-identity-C1AOH1PS.js +0 -77
  192. package/dist/chunks/raw-temporal-value-E416F-0L.js +0 -454
  193. package/dist/chunks/rendered-file-D8xEuVVx.js +0 -108
  194. package/dist/chunks/report-preferences-dialog-CbuVNDGi.js +0 -1637
  195. package/dist/chunks/report-runtime-context-E7USjN7E.js +0 -388
  196. package/dist/chunks/resolve-dashboard-input-context-CULCE_hM.js +0 -25172
  197. package/dist/chunks/resolver-DG_tfEpt.js +0 -156
  198. package/dist/chunks/save-BKHlDONy.js +0 -21
  199. package/dist/chunks/saved-dashboard-context-C1WlOx5z.js +0 -632
  200. package/dist/chunks/schema-C9NPiIru.js +0 -2568
  201. package/dist/chunks/selection-filter-compiler-ifT8JCXS.js +0 -131
  202. package/dist/chunks/semaphor-ready-indicator-CBIRcDWs.js +0 -145326
  203. package/dist/chunks/shelf-drop-preview-context-xR69SMA8.js +0 -2466
  204. package/dist/chunks/stored-dashboard-BuM8vnWf.js +0 -4070
  205. package/dist/chunks/style-sheet-parts-Bt9ZNre8.js +0 -8674
  206. package/dist/chunks/table-export-sheet-DVljtHkG.js +0 -949
  207. package/dist/chunks/token-types-D_xKgyVS.js +0 -8
  208. package/dist/chunks/upload-Dll_M7XQ.js +0 -15
  209. package/dist/chunks/validators-ClWHpYql.js +0 -3686
  210. package/dist/chunks/variable-draft-CDGGl53R.js +0 -242
  211. package/dist/chunks/visual-choice-DDfHfHvY.js +0 -172
@@ -0,0 +1,115 @@
1
+ /**
2
+ * Field folders: one dataset's fields in a folder, nested at the key that
3
+ * reaches it (one base per card OB-D5, OB-D20). The one module for every
4
+ * surface that offers fields by dataset: See records' More columns and the
5
+ * card editor's field list. Pure and server-safe: the folder type, where a
6
+ * folder hangs, and the tree walk. Each surface draws its own leaf rows.
7
+ *
8
+ * Lifted from See records related columns (SC-D10, ledger P2-14), whose
9
+ * server assembled where folders hang and whose picker walked the tree.
10
+ */
11
+ /** A folder's field: the column name a reference uses and the words shown. */
12
+ export type FieldFolderColumn = {
13
+ field: string;
14
+ label: string;
15
+ };
16
+ /** One folder: a dataset and the fields offered from it. */
17
+ export type FieldFolder<C extends FieldFolderColumn = FieldFolderColumn> = {
18
+ /** The dataset, as a column reference names it. */
19
+ dataset: string;
20
+ label: string;
21
+ /** The datasets' labels from the base dataset to this one; empty for the base's own folder. */
22
+ path: readonly string[];
23
+ columns: readonly C[];
24
+ /**
25
+ * The folder this one opens from: the dataset one step nearer the base
26
+ * and, when that step joins on one field the parent offers, that field,
27
+ * so the folder stands where the field would. Absent on the base's folder.
28
+ */
29
+ parent?: {
30
+ dataset: string;
31
+ field?: string;
32
+ };
33
+ };
34
+ /** Where a folder could hang, before the folders exist: the nearer dataset and the field names that may stand for its key. */
35
+ export type FolderParentHint = {
36
+ dataset: string;
37
+ fields: readonly string[];
38
+ };
39
+ type JoinKeySide = {
40
+ name?: string;
41
+ expression?: unknown;
42
+ };
43
+ type JoinLike = {
44
+ joinKeyGroups?: readonly {
45
+ operator?: string;
46
+ keys: readonly {
47
+ operator?: string;
48
+ source: JoinKeySide;
49
+ target: JoinKeySide;
50
+ }[];
51
+ }[];
52
+ };
53
+ /** Equality pairs for a single conjunctive predicate. Unknown shapes prove no key. */
54
+ export declare function joinEqualityPairs(join: JoinLike): Array<[string, string]> | undefined;
55
+ /**
56
+ * Where a joined dataset's folder hangs: under the dataset the join comes
57
+ * from, at its key when the join is exactly one `=` pair (OB-D5).
58
+ */
59
+ export declare function folderParentHintFromJoin(join: JoinLike, fromDataset: string): FolderParentHint;
60
+ /**
61
+ * Where a dataset reached through a relationship hangs: under the dataset its
62
+ * last step comes from, at the step's field when it joins on one. `aliases`
63
+ * are other names the same field goes by (its source column).
64
+ */
65
+ export declare function folderParentHintFromStep(nearDataset: string, nearFields: readonly string[], aliases?: readonly string[]): FolderParentHint;
66
+ /**
67
+ * Each folder but the base's gets its parent from its hint: the hinted
68
+ * folder, with the first hinted field that folder offers. A folder whose
69
+ * hinted parent has no folder hangs from the base's folder.
70
+ */
71
+ export declare function withFolderParents<F extends FieldFolder<FieldFolderColumn>>(folders: readonly F[], hints: ReadonlyMap<string, FolderParentHint>): F[];
72
+ export type FieldFolderNode<F extends FieldFolder<FieldFolderColumn>> = {
73
+ kind: 'folder';
74
+ folder: F;
75
+ depth: number;
76
+ open: boolean;
77
+ /** The parent's field this folder stands in place of, when it hangs at one. */
78
+ key?: F['columns'][number];
79
+ /** Drawn only when open. */
80
+ children: FieldFolderNode<F>[];
81
+ } | {
82
+ kind: 'column';
83
+ folder: F;
84
+ column: F['columns'][number];
85
+ depth: number;
86
+ };
87
+ export type FieldFolderTreeOptions<F extends FieldFolder<FieldFolderColumn> = FieldFolder<FieldFolderColumn>> = {
88
+ /** Lowercased, trimmed; a non-empty query opens every folder it matches in. */
89
+ query?: string;
90
+ /**
91
+ * The surface's own match, for a surface that searches by more than the
92
+ * label (the card editor). With `filtering`, folders open and show only
93
+ * what it matches, as a query does.
94
+ */
95
+ match?: (folder: F, column: F['columns'][number]) => boolean;
96
+ filtering?: boolean;
97
+ /** Datasets whose folders are open when there is no query. */
98
+ expanded: readonly string[];
99
+ /**
100
+ * The parent's key field a folder stands at is listed first inside the
101
+ * folder (the card editor: it is a field of the parent the author may
102
+ * place). Off: the folder replaces it (See records: the folder's own key
103
+ * says the same).
104
+ */
105
+ keyInside?: boolean;
106
+ };
107
+ /**
108
+ * The folders as a tree: the roots (folders whose parent isn't offered), each
109
+ * folder's fields in order with a child folder in place of the field it hangs
110
+ * at, then children that hang at no field. A search shows the fields that
111
+ * match (by folder and field label) and opens every folder holding one.
112
+ * A dataset already on the way down is never nested again.
113
+ */
114
+ export declare function fieldFolderTree<F extends FieldFolder<FieldFolderColumn>>(folders: readonly F[], options: FieldFolderTreeOptions<F>): FieldFolderNode<F>[];
115
+ export {};
@@ -0,0 +1 @@
1
+ export * from './field-folders.js';
@@ -0,0 +1,11 @@
1
+ import { NormalizedFilterDashboardInput, TCard } from '../../lib/types/common-types.js';
2
+ import { TFilter } from '../../components/surfboard/filter/types.js';
3
+ import { DashboardFilterCardReachDetail, DashboardRelationshipReachResolver } from '../../lib/query-context/dashboard-filter-mapping-resolution.js';
4
+ /** A filter definition as a dashboard filter reaching every card, the input the decision reads. */
5
+ export declare function filterReachInput(filter: TFilter): NormalizedFilterDashboardInput;
6
+ /** How the filter reaches the card, and whether a reader counts it as reached. */
7
+ export declare function filterReachOnCard(input: NormalizedFilterDashboardInput, card: TCard, options?: {
8
+ relationshipReach?: DashboardRelationshipReachResolver;
9
+ }): DashboardFilterCardReachDetail & {
10
+ reached: boolean;
11
+ };
@@ -67,6 +67,11 @@ export * from './kpi-figure.js';
67
67
  export * from './kpi-trend-rule.js';
68
68
  export * from './kpi-date-context.js';
69
69
  export * from './see-records/index.js';
70
+ export * from './card-data-source/index.js';
71
+ export { filterReachInput, filterReachOnCard } from './filter-reach-decision.js';
72
+ export { buildCardFilterDefinition } from '../../lib/filter-values/build-card-filter-definition.js';
73
+ export * from './field-folders/index.js';
74
+ export * from './card-field-places.js';
70
75
  export * from './card-settings/index.js';
71
76
  export * from './measure-calculations/index.js';
72
77
  export { bookmarkImpactSentence, describeBookmarkImpact, type BookmarkImpactItem, } from '../dashboard-viewer/bookmark-impact.js';
@@ -74,7 +79,7 @@ export { prepareLoadedDashboard } from '../../lib/dashboard-inputs/prepare-loade
74
79
  export { buildFilterInputFromField, buildFilterInputFromDefinition, applyFilterSettingsChange } from '../../lib/dashboard-inputs/filter-settings.js';
75
80
  export { relationshipRouteTarget } from '../../lib/dashboard-inputs/dashboard-filter-value-identity.js';
76
81
  export type { FilterSettingsChange, FilterValueEffect } from '../../lib/dashboard-inputs/filter-settings.js';
77
- export { describeDashboardFilterCardReach, describeDashboardFilterCardReachDetail, type DashboardFilterCardReach, type DashboardFilterCardReachDetail, type DashboardRelationshipReachResolver, } from '../../lib/query-context/dashboard-filter-mapping-resolution.js';
82
+ export { describeDashboardFilterCardReach, describeDashboardFilterCardReachDetail, isFilterCardReached, type DashboardFilterCardReached, type DashboardFilterCardReach, type DashboardFilterCardReachDetail, type DashboardRelationshipReachResolver, } from '../../lib/query-context/dashboard-filter-mapping-resolution.js';
78
83
  export { changeCardType, sharedCardPreferences, type CardTypeChange, type CardTypeChangeOptions, } from '../../lib/utils/card-type-change.js';
79
84
  export { buildSavedEditorCard } from '../../lib/utils/build-saved-editor-card.js';
80
85
  export { getCardDefinition, type AuthoredCardFields } from '../../lib/utils/card-definition.js';
@@ -124,9 +124,11 @@ export type KpiDateContextView = {
124
124
  kind: PeriodComparisonKind;
125
125
  };
126
126
  /** Why the card's period comparison is off, when it is. */
127
+ /** `label`: the comparison's own words when the run names its request ("Same day last week"). */
127
128
  comparisonOff?: {
128
129
  kind: PeriodComparisonKind;
129
130
  reason: ComparisonUnavailableReason;
131
+ label?: string;
130
132
  };
131
133
  /**
132
134
  * Two applied windows narrow each other, so the number counts only their
@@ -55,6 +55,15 @@ export declare const KPI_MEASURES_SHOWN = 3;
55
55
  export declare function resolveKpiLayout(input: {
56
56
  config?: Pick<CardConfig, 'metricColumns' | 'groupByColumns'>;
57
57
  }): KpiLayout;
58
+ /**
59
+ * Whether a KPI compares its first metric with its second ("Other metric",
60
+ * compare-with CW-D29): the one reading of the pair setting. The pair shows
61
+ * only in the measures layout (`resolveKpiLayout`: exactly two metrics, no
62
+ * Trend By, no target) and not on a card saved hidden (CW-D28), so a stored
63
+ * setting the layout doesn't draw reads as no pair. The tile, the editor, the
64
+ * outline and the offer read it (ledger P4-14).
65
+ */
66
+ export declare function comparesMetricPair(card: Pick<TCard, 'type' | 'preferences' | 'config'>): boolean;
58
67
  /**
59
68
  * A config KPI's result rows. Every row names its measure; `current` is a
60
69
  * measure's value and `comparison` its prior or target, in every branch.
@@ -113,6 +122,15 @@ export type KpiComparison = {
113
122
  kind: 'previous_period' | 'previous_year' | 'target';
114
123
  /** "Previous", "Target" or `comparisonPresentation.labelName`. */
115
124
  label: string;
125
+ /**
126
+ * The comparison's own words as the run names it ("same day last week",
127
+ * "previous 7 days"; compare-with 4b), when the author set no label of
128
+ * their own: the tile reads "vs same day last week · 150". Today's saved
129
+ * default label "Previous" counts as none, so it follows the words.
130
+ */
131
+ words?: string;
132
+ /** The measure keeps its own comparison whatever the Date filter says (compare-with CW-D17, CW-D20): the tile shows a pin. */
133
+ pinned: boolean;
116
134
  /** False when the author turned it off (`comparisonPresentation.showComparison`). */
117
135
  shown: boolean;
118
136
  /** From `evaluateMetricComparison`, the only source of a change (KV-D8). */
@@ -2,17 +2,18 @@ import { MetricComparisonConfig } from '../../analytics-protocol/metric-comparis
2
2
  import { ExplicitComparison, MeasureComparison } from './schemas.js';
3
3
  /**
4
4
  * A measure's comparison between its public words and its stored field
5
- * (reports by conversation SPEC §3.2, S-6, S-7): the one mapping. Stored
6
- * minimal, as the editor stores it: `inherit` is no field, and an offset of
7
- * 1, `calendar` and a false `toDate` are absent.
5
+ * (reports by conversation SPEC §3.2, S-6, S-7; compare-with CW-D3, CW-D5):
6
+ * the one mapping. The words are the spec's own (`shift` or `target`); a
7
+ * stored shape from before Compare with is read through the one reader.
8
+ * Stored minimal: `inherit` is no field, and an offset of 1 is absent.
8
9
  */
9
10
  /** The stored comparison for public words; undefined for `inherit` (no field). */
10
11
  export declare function toStoredComparison(comparison: MeasureComparison): MetricComparisonConfig | undefined;
11
12
  /** The public words for a stored comparison, defaults left out; undefined when it has none of its own (`inherit`). */
12
13
  export declare function readStoredComparison(stored: MetricComparisonConfig | undefined): MeasureComparison | undefined;
13
- /** Whether a stated comparison means what the measure stores (equal by resolution, S-7). */
14
- export declare function sameComparison(stated: MeasureComparison, stored: MetricComparisonConfig | undefined): boolean;
15
- /** A comparison of the measure's own: a period, a year or a target (not `inherit` or `off`). */
14
+ /** Whether two comparisons say the same, read in full (`inherit` for none of its own, an offset of 1 for none; S-7). */
15
+ export declare function sameWords(left: MeasureComparison | undefined, right: MeasureComparison | undefined): boolean;
16
+ /** A comparison of the measure's own: a step back or a target (not `inherit` or `off`). */
16
17
  export declare const isExplicitComparison: (comparison: MeasureComparison | undefined) => comparison is ExplicitComparison;
17
- /** "the same period last year", "a target of 1,000,000": what a stored comparison compares with. */
18
+ /** "the previous period", "the same period last year, matching weekdays", "a target of 1,000,000": what a stored comparison compares with. */
18
19
  export declare function comparedWith(comparison: MetricComparisonConfig): string;
@@ -1,6 +1,7 @@
1
1
  import { TCard, TDashboard } from '../../../lib/types/common-types.js';
2
2
  import { SemanticExecutionPayload } from '../../../lib/types/semantic-runtime-types.js';
3
3
  import { CompiledDashboardCardFilters } from '../../../lib/query-context/compile-dashboard-card-filters.js';
4
+ import { ComparisonWindowShape } from '../../analytics-protocol/comparison-choices.js';
4
5
  import { ResolvedPrimaryDateField } from '../../analytics-protocol/contracts.js';
5
6
  import { CalendarContext } from '../../report-runtime-context/index.js';
6
7
  export type ComparisonDates = {
@@ -11,6 +12,14 @@ export type ComparisonDates = {
11
12
  } | null;
12
13
  /** Whether a date window applies to that date: the card's own window on it, or a dashboard date filter that reaches the card. */
13
14
  dateWindow: 'applies' | 'none' | 'unknown';
15
+ /**
16
+ * The shape of the window the comparison steps from, when exactly one range
17
+ * restricts the date after Global Date ownership (`withGlobalDateOwnership`,
18
+ * the run's own rule): a Global Date value replaces the card's own range,
19
+ * every other range intersects, so two ranges leave the window unknown and
20
+ * nothing is judged to overlap (compare-with CW-D16, CW16-R1).
21
+ */
22
+ window?: ComparisonWindowShape;
14
23
  };
15
24
  /**
16
25
  * What `readComparisonDates` reads of a compiled card query: the editor's
@@ -26,7 +35,7 @@ export type ComparisonCompilation = {
26
35
  resolvedPrimaryDateField?: ResolvedPrimaryDateField;
27
36
  };
28
37
  /** The two facts for a card, from its compiled query. */
29
- export declare function readComparisonDates(card: TCard, compiled: ComparisonCompilation): ComparisonDates;
38
+ export declare function readComparisonDates(card: TCard, compiled: ComparisonCompilation, calendar?: CalendarContext | null): ComparisonDates;
30
39
  /**
31
40
  * The same facts as a fresh viewer gets them (SPEC S-9): the dashboard's
32
41
  * default filter values, compiled with this calendar, through the assembly a
@@ -35,6 +44,7 @@ export declare function readComparisonDates(card: TCard, compiled: ComparisonCom
35
44
  */
36
45
  export declare function readDefaultComparisonDates(input: {
37
46
  dashboard: TDashboard;
47
+ /** A card's id, or a data variable's: a variable runs as its projected card at each sheet its text shows on (DV-D32). */
38
48
  cardId: string;
39
49
  semanticExecutionPayload: SemanticExecutionPayload | undefined;
40
50
  calendar: CalendarContext;
@@ -4,8 +4,8 @@
4
4
  * The outline, the change resolver, the reducer, the editor and
5
5
  * semaphor_analyze read and write them through these exports only.
6
6
  */
7
- export { explicitComparisonSchema, measureComparisonSchema, measureTransformSchema, transformOrderSchema, MEASURE_CALCULATION_SUMMARIES, type AnalyzeMeasureCalculations, type ExplicitComparison, type MeasureCalculations, type MeasureComparison, type MeasureTransform, type TransformOrder, } from './schemas.js';
8
- export { toStoredComparison } from './comparison.js';
7
+ export { comparisonShiftSchema, explicitComparisonSchema, MATCH_WEEKDAYS_ONLY_BY_YEARS, measureComparisonSchema, TO_DATE_IS_AUTOMATIC, measureTransformSchema, transformOrderSchema, MEASURE_CALCULATION_SUMMARIES, type AnalyzeMeasureCalculations, type ExplicitComparison, type MeasureCalculations, type MeasureComparison, type MeasureTransform, type TransformOrder, } from './schemas.js';
8
+ export { readStoredComparison, sameWords, toStoredComparison } from './comparison.js';
9
9
  export { readMeasureCalculations, type MeasureCalculationsRead } from './read.js';
10
10
  export { readComparisonDates, readDefaultComparisonDates, type ComparisonCompilation, type ComparisonDates } from './dates.js';
11
11
  export { measureCalculationOptions, transformGroupings, PUBLIC_TRANSFORM_KIND, type CalculationOffer, type CalculationRefusalCode, type MeasureCalculationOptions, type TransformGrouping, } from './options.js';
@@ -60,4 +60,8 @@ export declare function transformGroupings(card: TCard): {
60
60
  groupings: TransformGrouping[];
61
61
  defaultOrder: ColumnKey | null;
62
62
  };
63
+ /** Whether a card's measures show comparisons at all: a type that compares, built from fields (not SQL or Python). */
64
+ export declare function cardTakesComparisons(card: TCard): boolean;
65
+ /** Whether a measure can compare with the other metric: the first of a KPI's two metrics, where the layout draws the pair (`resolveKpiLayout`: no Trend By, no target; CW-D29, ledger P4-14). */
66
+ export declare function metricPairOffered(card: TCard, metric: MetricField): boolean;
63
67
  export declare function measureCalculationOptions(card: TCard, measure: ColumnKey, dates: ComparisonDates): MeasureCalculationOptions;
@@ -1,7 +1,7 @@
1
1
  import { TCard } from '../../../lib/types/common-types.js';
2
2
  import { GroupByField } from '../../../lib/types/explorer-types.js';
3
3
  import { FieldRef } from '../changes/dashboard-change.js';
4
- import { MeasureCalculations } from './schemas.js';
4
+ import { MeasureCalculations, MeasureComparison } from './schemas.js';
5
5
  export type MeasureCalculationsRead =
6
6
  /** Aligned with `config.metricColumns`; `{}` for a measure with none. */
7
7
  {
@@ -13,4 +13,21 @@ export type MeasureCalculationsRead =
13
13
  ok: false;
14
14
  detail: string;
15
15
  };
16
+ /**
17
+ * Each measure's comparison as it shows, aligned with `config.metricColumns`
18
+ * (compare-with CW-D18, CW-D21, CW-D28): its own step or target; `off` when it
19
+ * shows none, including every measure of a card saved with "Show comparison"
20
+ * off and one with none of its own on a card that stopped following;
21
+ * undefined when it follows the Date filter. The one reader decides, so the
22
+ * outline says what the card shows and no card switch is left to read. On a
23
+ * card that shows no comparisons (a pie, SQL) each reads as it is stored.
24
+ */
25
+ export declare function readMeasureComparisons(card: TCard): (MeasureComparison | undefined)[];
26
+ /**
27
+ * Whether a stated comparison changes nothing on this measure: equal to what
28
+ * the outline reads for it, not to what it stores (ledger CW15-03; CW-D21,
29
+ * CW-D28, CW-D29). Following on a card that stopped following, the stored step
30
+ * on a card saved hidden, or the other metric on a hidden pair, is a change.
31
+ */
32
+ export declare function comparisonUnchanged(card: TCard, stated: MeasureComparison, index: number): boolean;
16
33
  export declare function readMeasureCalculations(card: TCard, groupingRef: (grouping: GroupByField) => FieldRef): MeasureCalculationsRead;
@@ -55,6 +55,8 @@ export type ResolvedMeasureCalculations = {
55
55
  };
56
56
  /** What this write replaces, for its sentence (RC-D6, RC-INV-3). */
57
57
  replaces?: 'comparison' | 'transform';
58
+ /** The card compares its first metric with the second (`true`) or no longer does (`false`), compare-with CW-D29. */
59
+ metricPair?: boolean;
58
60
  };
59
61
  /** One `calculations` card update: the measures it changes, in card order. */
60
62
  export type MeasureCalculationsUpdate = {
@@ -1,36 +1,7 @@
1
1
  import { z } from 'zod';
2
- /** A comparison of the measure's own, in the stored spec's names: what `semaphor_analyze` takes. */
3
- export declare const explicitComparisonSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
4
- kind: z.ZodLiteral<"previous_period">;
5
- offsetPeriods: z.ZodOptional<z.ZodNumber>;
6
- alignment: z.ZodOptional<z.ZodEnum<["calendar", "weekday"]>>;
7
- toDate: z.ZodOptional<z.ZodBoolean>;
8
- }, "strict", z.ZodTypeAny, {
9
- kind: "previous_period";
10
- toDate?: boolean | undefined;
11
- alignment?: "calendar" | "weekday" | undefined;
12
- offsetPeriods?: number | undefined;
13
- }, {
14
- kind: "previous_period";
15
- toDate?: boolean | undefined;
16
- alignment?: "calendar" | "weekday" | undefined;
17
- offsetPeriods?: number | undefined;
18
- }>, z.ZodObject<{
19
- kind: z.ZodLiteral<"previous_year">;
20
- offsetYears: z.ZodOptional<z.ZodNumber>;
21
- alignment: z.ZodOptional<z.ZodEnum<["calendar", "weekday"]>>;
22
- toDate: z.ZodOptional<z.ZodBoolean>;
23
- }, "strict", z.ZodTypeAny, {
24
- kind: "previous_year";
25
- toDate?: boolean | undefined;
26
- alignment?: "calendar" | "weekday" | undefined;
27
- offsetYears?: number | undefined;
28
- }, {
29
- kind: "previous_year";
30
- toDate?: boolean | undefined;
31
- alignment?: "calendar" | "weekday" | undefined;
32
- offsetYears?: number | undefined;
33
- }>, z.ZodObject<{
2
+ /** Refused with its reason: every running window is compared to date (compare-with CW-D1, CW-D2). */
3
+ export declare const TO_DATE_IS_AUTOMATIC = "is not a setting: a comparison always matches the elapsed part of a window still running; leave it out";
4
+ declare const targetSchema: z.ZodObject<{
34
5
  kind: z.ZodLiteral<"target">;
35
6
  targetValue: z.ZodNumber;
36
7
  }, "strict", z.ZodTypeAny, {
@@ -39,60 +10,49 @@ export declare const explicitComparisonSchema: z.ZodDiscriminatedUnion<"kind", [
39
10
  }, {
40
11
  kind: "target";
41
12
  targetValue: number;
42
- }>]>;
43
- /** A card measure's comparison: its own, none (`off`), or the dashboard's (`inherit`). */
44
- declare const measureComparisonUnion: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
45
- kind: z.ZodLiteral<"inherit">;
46
- }, "strict", z.ZodTypeAny, {
47
- kind: "inherit";
48
- }, {
49
- kind: "inherit";
50
- }>, z.ZodObject<{
51
- kind: z.ZodLiteral<"off">;
52
- }, "strict", z.ZodTypeAny, {
53
- kind: "off";
54
- }, {
55
- kind: "off";
56
- }>, z.ZodObject<{
57
- kind: z.ZodLiteral<"previous_period">;
58
- offsetPeriods: z.ZodOptional<z.ZodNumber>;
59
- alignment: z.ZodOptional<z.ZodEnum<["calendar", "weekday"]>>;
60
- toDate: z.ZodOptional<z.ZodBoolean>;
61
- }, "strict", z.ZodTypeAny, {
62
- kind: "previous_period";
63
- toDate?: boolean | undefined;
64
- alignment?: "calendar" | "weekday" | undefined;
65
- offsetPeriods?: number | undefined;
66
- }, {
67
- kind: "previous_period";
68
- toDate?: boolean | undefined;
69
- alignment?: "calendar" | "weekday" | undefined;
70
- offsetPeriods?: number | undefined;
71
- }>, z.ZodObject<{
72
- kind: z.ZodLiteral<"previous_year">;
73
- offsetYears: z.ZodOptional<z.ZodNumber>;
74
- alignment: z.ZodOptional<z.ZodEnum<["calendar", "weekday"]>>;
75
- toDate: z.ZodOptional<z.ZodBoolean>;
76
- }, "strict", z.ZodTypeAny, {
77
- kind: "previous_year";
78
- toDate?: boolean | undefined;
79
- alignment?: "calendar" | "weekday" | undefined;
80
- offsetYears?: number | undefined;
81
- }, {
82
- kind: "previous_year";
83
- toDate?: boolean | undefined;
84
- alignment?: "calendar" | "weekday" | undefined;
85
- offsetYears?: number | undefined;
86
- }>, z.ZodObject<{
87
- kind: z.ZodLiteral<"target">;
88
- targetValue: z.ZodNumber;
13
+ }>;
14
+ /** Refused with its reason (compare-with CW-D4). */
15
+ export declare const MATCH_WEEKDAYS_ONLY_BY_YEARS = "matchWeekdays is true only on a step by years (52 weeks a year back)";
16
+ /**
17
+ * A step back (compare-with CW-D3): `unit` 'period' is the window's own
18
+ * length (the previous period), or a calendar unit; `offset` steps.
19
+ */
20
+ declare const shiftSchema: z.ZodObject<{
21
+ kind: z.ZodLiteral<"shift">;
22
+ unit: z.ZodEnum<["period", "day", "week", "month", "quarter", "year"]>;
23
+ offset: z.ZodOptional<z.ZodNumber>;
24
+ matchWeekdays: z.ZodOptional<z.ZodLiteral<true>>;
25
+ toDate: z.ZodOptional<z.ZodNever>;
89
26
  }, "strict", z.ZodTypeAny, {
90
- kind: "target";
91
- targetValue: number;
27
+ kind: "shift";
28
+ unit: "day" | "week" | "month" | "quarter" | "year" | "period";
29
+ toDate?: undefined;
30
+ offset?: number | undefined;
31
+ matchWeekdays?: true | undefined;
92
32
  }, {
93
- kind: "target";
94
- targetValue: number;
95
- }>]>;
33
+ kind: "shift";
34
+ unit: "day" | "week" | "month" | "quarter" | "year" | "period";
35
+ toDate?: undefined;
36
+ offset?: number | undefined;
37
+ matchWeekdays?: true | undefined;
38
+ }>;
39
+ /** A step back alone, as a dashboard date filter's default comparison takes it (IN-08); old words refused with the new ones. */
40
+ export declare const comparisonShiftSchema: z.ZodType<z.infer<typeof shiftSchema>>;
41
+ /** A comparison of the measure's own, in the stored spec's words: a step back or a target. */
42
+ export type ExplicitComparison = z.infer<typeof shiftSchema> | z.infer<typeof targetSchema>;
43
+ /**
44
+ * A card measure's comparison: its own, none (`off`), the dashboard's
45
+ * (`inherit`), or, on the first of a KPI's two metrics, the other metric
46
+ * (`metric`, compare-with CW-D29).
47
+ */
48
+ export type MeasureComparison = {
49
+ kind: 'inherit';
50
+ } | {
51
+ kind: 'off';
52
+ } | {
53
+ kind: 'metric';
54
+ } | ExplicitComparison;
55
+ export declare const explicitComparisonSchema: z.ZodType<ExplicitComparison>;
96
56
  /** The grouping a transform runs along; `field` is written as the query writes that grouping. */
97
57
  export declare const transformOrderSchema: z.ZodObject<{
98
58
  field: z.ZodUnion<[z.ZodString, z.ZodObject<{
@@ -905,8 +865,6 @@ declare const measureTransformUnion: z.ZodDiscriminatedUnion<"kind", [z.ZodObjec
905
865
  } | undefined;
906
866
  })[] | undefined;
907
867
  }>]>;
908
- export type ExplicitComparison = z.infer<typeof explicitComparisonSchema>;
909
- export type MeasureComparison = z.infer<typeof measureComparisonUnion>;
910
868
  export type TransformOrder = z.infer<typeof transformOrderSchema>;
911
869
  export type MeasureTransform = z.infer<typeof measureTransformUnion>;
912
870
  export declare const measureComparisonSchema: z.ZodType<MeasureComparison>;
@@ -917,7 +875,7 @@ export type MeasureCalculations = {
917
875
  /** null only in a card.update: removes the transform. */
918
876
  transform?: MeasureTransform | null;
919
877
  };
920
- /** One semaphor_analyze measure's calculations: no dashboard to inherit, nothing to remove. */
878
+ /** One semaphor_analyze measure's calculations: a card measure's own words (compare-with CW-D24); no dashboard to inherit, nothing to remove. */
921
879
  export type AnalyzeMeasureCalculations = {
922
880
  comparison?: ExplicitComparison;
923
881
  transform?: MeasureTransform;
@@ -928,7 +886,7 @@ export type AnalyzeMeasureCalculations = {
928
886
  * against the definition budget (RC-D1).
929
887
  */
930
888
  export declare const MEASURE_CALCULATION_SUMMARIES: {
931
- readonly comparison: "{ kind: 'inherit' (the dashboard's; default) | 'off' | 'previous_period' | 'previous_year' (offsetPeriods or offsetYears?: n, alignment?: 'calendar' | 'weekday', toDate?: true) | 'target' (targetValue: number) }. Targets on kpi and table. A period or year compares over the card's date grouping (a KPI's Trend By: dateField with timeGrain) or the dataset's primary date.";
889
+ readonly comparison: "{ kind: 'inherit' (follows the Date filter; default) | 'off' (none) | 'shift' (unit: 'period' (its length) | 'day' | 'week' | 'month' | 'quarter' | 'year', offset?: n, matchWeekdays?: true if 'year') | 'target' (targetValue: number) }. Targets on kpi and table. A shift compares over the card's date grouping (a KPI's Trend By: dateField with timeGrain) or the dataset's primary date.";
932
890
  readonly transform: "{ kind: 'running_total' | 'moving_average' (window?: 7, minPeriods?: 1) | 'difference_from_previous' (mode?: 'difference' | 'percent_change') | 'percent_of_total' (scope?: 'grand_total' | 'partition_total' + resetBy, output?: 'percent' | 'fraction'), orderBy?: { field, direction? } (default: first date grouping), resetBy?: [fields] (default: other groupings) }; null removes it. Not beside its own comparison.";
933
891
  };
934
892
  export {};
@@ -70,15 +70,19 @@ export declare function applyCalculatedFieldOperation(dashboard: TDashboard, ope
70
70
  /**
71
71
  * The definitions a dashboard needs for the copies its cards bring (MC-D19):
72
72
  * a dashboard field for every dashboard copy whose identity key the dashboard
73
- * lacks, built from the copy itself (a copy holds its whole formula). In
74
- * release 1 frozen copies are left alone (`frozen: false`); the backfill
75
- * passes `frozen: true` for the frozen copies it doesn't turn into domain
76
- * references. Library visuals store no definitions list.
73
+ * lacks, built from the copy itself (a copy holds its whole formula), and for
74
+ * every dashboard copy inside those formulas (a field another field reads), so
75
+ * an edit to a dependency reaches what reads it. A copy keeps its identity: a
76
+ * copy whose name the dashboard already gives another field (a card pasted
77
+ * from another dashboard) comes in under the next free name (`<name>_2`), its
78
+ * copies renamed with their label and result column kept. Identities are
79
+ * never merged by name or formula: two fields alike in words may read
80
+ * different domains (ledger P6-06). From release 2 a copy without a
81
+ * definition can't be saved (MC-D12). A copied formula without a scope (a
82
+ * frozen copy) is never adopted: converting those is the backfill planner's
83
+ * job. Library visuals store no definitions list.
77
84
  */
78
- export declare function adoptCalculatedFields(dashboard: TDashboard, cards: readonly TCard[], options: {
79
- frozen: boolean;
80
- newId?: () => string;
81
- }): TDashboard;
85
+ export declare function adoptCalculatedFields(dashboard: TDashboard, cards: readonly TCard[]): TDashboard;
82
86
  /**
83
87
  * The operations that turn one dashboard field list into another, by
84
88
  * identity key, in order: removals, changes, then additions. The editor's
@@ -97,6 +101,27 @@ export type CalculatedFieldListIssue = {
97
101
  * used, a role and a data type on each. Reads only the list.
98
102
  */
99
103
  export declare function checkCalculatedFieldList(fields: readonly Field[] | undefined): CalculatedFieldListIssue[];
104
+ /** A card's calculated column a save refuses (release 2, MC-D12), in words safe to show. */
105
+ export type CalculatedColumnIssue = {
106
+ cardId: string;
107
+ cardTitle: string;
108
+ name: string;
109
+ message: string;
110
+ };
111
+ /**
112
+ * Release 2's save refusal (MC-D12): a card's placed calculated column with no
113
+ * definition (`classifyCalculatedColumn` says `no_definition`: a copied
114
+ * formula, a card or sheet field's copy, a dashboard copy whose field is
115
+ * gone), and a card that keeps its own `calculatedFields`. It reads a card's
116
+ * placements only (the walk the backfill used: shelves, their conditions, card
117
+ * filters, inline filters), never its preferences (ledger P5-03). A Matrix card
118
+ * is left alone: its own fields and bindings are its definitions (MC-D15). A
119
+ * typed derived column carries its own definition (`derivedField`) and is
120
+ * accepted (ledger P5-05). Reads only the payload.
121
+ */
122
+ export declare function checkCalculatedColumnDefinitions(dashboard: TDashboard,
123
+ /** The cards to read; the shared traversal's by default. A caller reading a stored shape it doesn't cover passes those cards too. */
124
+ cards?: readonly TCard[]): CalculatedColumnIssue[];
100
125
  /**
101
126
  * Whether operations the open card's edit makes would apply: they are tried
102
127
  * on the dashboard with that card's copies left out (the editor holds its
@@ -74,8 +74,6 @@ export type FrameCommit = {
74
74
  frame: TFrame;
75
75
  /** Other frames on the sheet rewritten during the edit (calculated-field renames), applied with it. */
76
76
  rewrittenFrames?: TFrame[];
77
- /** Sheet calculated fields from the edited frame, persisted on the sheet (sheet scope is retired; existing ones stay editable until release 2). */
78
- sheetCalculatedFields?: Field[];
79
77
  /**
80
78
  * The editor's dashboard-field adds, changes and removals during the edit,
81
79
  * in order, applied through the `calculatedField.*` operations after the
@@ -4,6 +4,7 @@ import { DashboardFilterNotReachedReason, DashboardRelationshipReachResolver } f
4
4
  import { AgentNumberConditionDefault, FilterInputEntry, NumberFilterShowAs } from '../filter-model/index.js';
5
5
  import { AgentTimeWindowRefusal } from '../../analytics-protocol/agent-time-window.js';
6
6
  import { RelativeDateWindow } from '../../analytics-protocol/relative-date/index.js';
7
+ import { ComparisonShiftSpec } from '../../analytics-protocol/metric-comparison.js';
7
8
  import { CalendarContext } from '../../report-runtime-context/index.js';
8
9
  import { FilterValue } from '../changes/dashboard-change.js';
9
10
  /**
@@ -37,6 +38,8 @@ export type OutlineFilter = {
37
38
  * it. It stays while filter.update leaves defaultPeriod out.
38
39
  */
39
40
  defaultPeriodReadOnly?: AgentTimeWindowRefusal;
41
+ /** A date filter's default comparison, a step back, as filter.update takes it (compare-with IN-08). */
42
+ defaultComparison?: ComparisonShiftSpec;
40
43
  /** For a date filter, the picker a viewer gets: one day, one month, or a range. */
41
44
  datePicker?: 'day' | 'month' | 'range';
42
45
  /** "all": every grid sheet. */
@@ -147,6 +150,8 @@ export type OutlinePinnedFilter = {
147
150
  filterId: string;
148
151
  label: string;
149
152
  field: string;
153
+ /** The field's dataset: the card's own, one it joins, or a related one (dashboard filter fields DF-D8). */
154
+ datasetName?: string;
150
155
  } & ReturnType<typeof readLoadedFilterDefault>;
151
156
  export declare function outlinePinnedFilters(card: TCard, calendar?: CalendarContext): OutlinePinnedFilter[];
152
157
  /** Every filter on the dashboard, in the filter model's order. */
@@ -1,6 +1,7 @@
1
1
  import { OperationTemporalState } from '../../analytics-protocol/operation-temporal-state.js';
2
2
  import { RawTemporalValueMetadata, SemaphorResultColumn } from '../../analytics-protocol/contracts.js';
3
3
  import { SeeRecordsColumnRef } from './request.js';
4
+ import { FieldFolder } from '../field-folders/index.js';
4
5
  /** One line per record of the grain dataset, or one line per value of a group column. */
5
6
  export type SeeRecordsShape = 'rows' | 'groups';
6
7
  /**
@@ -28,28 +29,12 @@ export type SeeRecordsColumn = {
28
29
  */
29
30
  rawTemporal?: RawTemporalValueMetadata;
30
31
  };
31
- /** One folder of More columns: a dataset and the fields a list can add from it. */
32
- export type SeeRecordsColumnFolder = {
33
- /** As a column ref names it (`SeeRecordsColumnRef.dataset`). */
34
- dataset: string;
35
- label: string;
36
- /** The datasets' labels from the line's dataset to this one; empty for the line's own. */
37
- path: readonly string[];
38
- columns: readonly {
39
- field: string;
40
- label: string;
41
- }[];
42
- /**
43
- * The folder this one opens from (see-records related columns P2-14): the
44
- * dataset one step nearer the line on its route, and, when that step joins
45
- * on one field the parent offers, that field, so the picker nests the
46
- * folder under it. Absent on the line's own folder.
47
- */
48
- parent?: {
49
- dataset: string;
50
- field?: string;
51
- };
52
- };
32
+ /**
33
+ * One folder of More columns: a dataset and the fields a list can add from it,
34
+ * nested at the key that reaches it. The shared field folder (one base per
35
+ * card OB-D20), the same the card editor's field list draws.
36
+ */
37
+ export type SeeRecordsColumnFolder = FieldFolder;
53
38
  export type SeeRecordsResult = {
54
39
  shape: SeeRecordsShape;
55
40
  /** The listed measure's label, then the click's label when it has one. */