react-semaphor 0.1.544 → 0.1.546

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 (179) hide show
  1. package/dist/analytics-protocol/index.js +405 -441
  2. package/dist/assistant-context/index.js +1 -1
  3. package/dist/assistant-protocol/index.js +100 -76
  4. package/dist/brand-studio/index.js +5 -5
  5. package/dist/briefings/index.js +55 -52
  6. package/dist/chunks/{class-utils-Df1OVOT1.js → _commonjsHelpers-DimLPMtv.js} +124 -98
  7. package/dist/chunks/{add-to-dashboard-BuAqfA2Y.js → add-to-dashboard-BQRAAnc3.js} +55 -33
  8. package/dist/chunks/{analytics-base-schemas-BFAoRlkU.js → analytics-base-schemas-BKs3flFS.js} +2 -2
  9. package/dist/chunks/{assistant-chat-BNLkCDml.js → assistant-chat-BPXhulAx.js} +2792 -2562
  10. package/dist/chunks/{bookmark-state-CXw7lZ50.js → bookmark-state-C4vetoa0.js} +7 -8
  11. package/dist/chunks/column-catalog-BYnochWQ.js +3363 -0
  12. package/dist/chunks/comparison-window-caption-C2xF-eWw.js +1433 -0
  13. package/dist/chunks/{context-ClREvqCZ.js → context-BerEBuFR.js} +11 -6
  14. package/dist/chunks/custom-visual-inputs-CkJW9pBS.js +295 -0
  15. package/dist/chunks/{dashboard-g5a4DKWq.js → dashboard-C3CoKbGY.js} +1 -1
  16. package/dist/chunks/dashboard-briefing-launcher-Be4h-7My.js +3734 -0
  17. package/dist/chunks/dashboard-controls-bxPrlSyp.js +2307 -0
  18. package/dist/chunks/{dashboard-json-7qT9jmfL.js → dashboard-json-BrjxIiRt.js} +6 -6
  19. package/dist/chunks/document-dashboard-inputs-CRVHpIHp.js +3010 -0
  20. package/dist/chunks/{edit-dashboard-visual-BfJwnRIZ.js → edit-dashboard-visual-DYYYDjY6.js} +5986 -6063
  21. package/dist/chunks/{filter-value-text-CYsVYPuD.js → filter-value-text-Ddf55Ku1.js} +8 -8
  22. package/dist/chunks/global-date-filter-utils-9d6m9-FE.js +11859 -0
  23. package/dist/chunks/index-CtoK1Lgu.js +586 -0
  24. package/dist/chunks/{index-DkAyQvC6.js → index-DkQkMKa1.js} +385 -339
  25. package/dist/chunks/list-filter-DsaTbM3J.js +15 -0
  26. package/dist/chunks/matrix-analytical-definition-B9vW-osb.js +717 -0
  27. package/dist/chunks/{matrix-card-DjwWcCo8.js → matrix-card-LiMEipvq.js} +3 -3
  28. package/dist/chunks/{matrix-formatter-CxJLkztA.js → matrix-formatter-DWEeC0_c.js} +55 -55
  29. package/dist/chunks/{matrix-member-presentation-CQGdVks6.js → matrix-member-presentation-DqzG-UhQ.js} +1 -1
  30. package/dist/chunks/{matrix-operation-contract-8OIO4gob.js → matrix-operation-contract-D6vYkZK4.js} +72 -72
  31. package/dist/chunks/{metric-comparison-DEwi9uc2.js → metric-comparison-zpGw4lD6.js} +2 -2
  32. package/dist/chunks/normalize-dashboard-for-dirty-check-XKgH3GFX.js +119 -0
  33. package/dist/chunks/{pivot-header-presentation-DHcx1XGQ.js → pivot-header-presentation-CQnIDtUv.js} +1 -1
  34. package/dist/chunks/{pivot-result-identity-DJhXXcns.js → pivot-result-identity-C-Q1j1Wb.js} +1 -1
  35. package/dist/chunks/{pivot-result-lifecycle-DM4CyGKs.js → pivot-result-lifecycle-pwq3b7LC.js} +571 -380
  36. package/dist/chunks/{raw-temporal-contract-C51YG48G.js → raw-temporal-contract-WuXA8jBP.js} +1 -1
  37. package/dist/chunks/{raw-temporal-presentation-CLiVi90c.js → raw-temporal-presentation-CBzrDOjM.js} +8 -8
  38. package/dist/chunks/rendered-file-D8xEuVVx.js +108 -0
  39. package/dist/chunks/{report-preferences-dialog-Df7VpRVW.js → report-preferences-dialog-4QEZWe5U.js} +637 -610
  40. package/dist/chunks/{report-runtime-context-Dq8XyODK.js → report-runtime-context-hWiTCzFV.js} +2 -2
  41. package/dist/chunks/resolve-dashboard-input-context-UpK_LBpL.js +5677 -0
  42. package/dist/chunks/{saved-dashboard-context-B-mQ--nV.js → saved-dashboard-context-D_I3Lxk0.js} +184 -212
  43. package/dist/chunks/selection-filter-compiler-BKXmyLrS.js +79 -0
  44. package/dist/chunks/{selection-reducer-Dj_8xD69.js → selection-reducer-CJzkTZio.js} +15 -15
  45. package/dist/chunks/{semaphor-ready-indicator-DDAxk8us.js → semaphor-ready-indicator-4zpRHE-X.js} +56832 -59068
  46. package/dist/chunks/{shelf-drop-preview-context-BSRPwaED.js → shelf-drop-preview-context-Cfw7TRAx.js} +890 -871
  47. package/dist/chunks/{source-entity-resolution-BYn9giz3.js → source-entity-resolution-BIGRvtbG.js} +13 -13
  48. package/dist/chunks/{switch-C3jLxlG0.js → switch-CEBOR4n7.js} +47 -48
  49. package/dist/chunks/{table-export-sheet-CPfGAQ9X.js → table-export-sheet-4X9mAG3V.js} +1 -1
  50. package/dist/chunks/table-settings-CunhoDUi.js +605 -0
  51. package/dist/chunks/{temporal-bucket-D7NBrrtL.js → temporal-bucket-CQOSbv9-.js} +26 -26
  52. package/dist/chunks/{token-types-DBbZVQsm.js → token-types-BMqRmT-C.js} +1 -1
  53. package/dist/chunks/{use-create-flow-overlay-state-BxzFviM-.js → use-create-flow-overlay-state-DZBZiiD-.js} +83 -83
  54. package/dist/chunks/{validators-DMHTpf7a.js → validators-C-aOQlTB.js} +713 -658
  55. package/dist/dashboard/index.js +2 -2
  56. package/dist/dashboard-authoring/index.js +1800 -1135
  57. package/dist/data-app-sdk/index.js +6 -6
  58. package/dist/data-app-sdk-adapters/index.js +3 -3
  59. package/dist/data-app-sdk-validation/index.js +14 -14
  60. package/dist/format-utils/index.js +198 -187
  61. package/dist/index.js +359 -325
  62. package/dist/layouts/index.js +5 -242
  63. package/dist/report-runtime-context/index.js +2 -2
  64. package/dist/shared/index.js +4 -5
  65. package/dist/style.css +1 -1
  66. package/dist/surfboard/index.js +2 -2
  67. package/dist/types/briefings/attachment-outcomes.d.ts +1 -1
  68. package/dist/types/briefings/attachments.d.ts +33 -6
  69. package/dist/types/briefings/index.d.ts +6 -5
  70. package/dist/types/components/index.d.ts +2 -0
  71. package/dist/types/components/surfboard/arrange-layout-button.d.ts +8 -0
  72. package/dist/types/components/surfboard/filter/types.d.ts +0 -14
  73. package/dist/types/components/surfboard/screen-size-preview-button.d.ts +7 -0
  74. package/dist/types/index.js +6 -6
  75. package/dist/types/lib/charts/table-chart-types.d.ts +4 -0
  76. package/dist/types/lib/charts/types.d.ts +2 -2
  77. package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-authoring.d.ts +68 -82
  78. package/dist/types/lib/dashboard-inputs/dashboard-input-target-context.d.ts +0 -8
  79. package/dist/types/lib/dashboard-inputs/dashboard-input-values.d.ts +41 -1
  80. package/dist/types/lib/dashboard-inputs/filter-settings.d.ts +201 -0
  81. package/dist/types/lib/dashboard-inputs/prepare-loaded-dashboard.d.ts +15 -0
  82. package/dist/types/lib/dashboard-inputs/resolve-dashboard-input-context.d.ts +7 -2
  83. package/dist/types/lib/dashboard-inputs/resolve-selection-input.d.ts +1 -1
  84. package/dist/types/lib/dashboard-viewer/captured-runtime-values.d.ts +40 -0
  85. package/dist/types/lib/dashboard-viewer/compatibility-input-storage.d.ts +16 -16
  86. package/dist/types/lib/dashboard-viewer/viewer-state.d.ts +11 -9
  87. package/dist/types/lib/download-pdf.d.ts +75 -1
  88. package/dist/types/lib/hooks/use-date-filter.d.ts +5 -0
  89. package/dist/types/lib/hooks/use-text-filter.d.ts +5 -0
  90. package/dist/types/lib/matrix-table/matrix-delivery-policy.d.ts +5 -4
  91. package/dist/types/lib/matrix-table/matrix-editor.d.ts +52 -0
  92. package/dist/types/lib/query-context/assemble-card-query.d.ts +158 -0
  93. package/dist/types/lib/query-context/build-card-query-context.d.ts +3 -3
  94. package/dist/types/lib/query-context/build-dashboard-card-query-contract.d.ts +15 -6
  95. package/dist/types/lib/query-context/build-dashboard-execution-snapshot.d.ts +11 -13
  96. package/dist/types/lib/query-context/compile-dashboard-card-filters.d.ts +22 -12
  97. package/dist/types/lib/query-context/dashboard-filter-mapping-resolution.d.ts +69 -0
  98. package/dist/types/lib/stores/dashboard-store.d.ts +159 -56
  99. package/dist/types/lib/stores/editor-store.d.ts +0 -3
  100. package/dist/types/lib/types/common-types.d.ts +29 -6
  101. package/dist/types/lib/types/explorer-types.d.ts +10 -0
  102. package/dist/types/lib/types/semantic-types.d.ts +84 -0
  103. package/dist/types/lib/utils/build-saved-editor-card.d.ts +20 -0
  104. package/dist/types/lib/utils/card-type-change.d.ts +16 -0
  105. package/dist/types/lib/utils/field-availability-context.d.ts +25 -0
  106. package/dist/types/lib/utils/field-placement.d.ts +96 -0
  107. package/dist/types/lib/utils/field-state-calculator.d.ts +161 -0
  108. package/dist/types/lib/utils/qualified-entity-name.d.ts +2 -0
  109. package/dist/types/shared/analytics-protocol/field-provenance.d.ts +89 -0
  110. package/dist/types/shared/analytics-protocol/index.d.ts +2 -0
  111. package/dist/types/shared/analytics-protocol/query-policies.d.ts +52 -0
  112. package/dist/types/shared/analytics-protocol/time-window-schema.d.ts +1 -1
  113. package/dist/types/shared/analytics-protocol/time-window.d.ts +40 -1
  114. package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +8 -12
  115. package/dist/types/shared/assistant-protocol/answer-text.d.ts +20 -0
  116. package/dist/types/shared/assistant-protocol/context.d.ts +21 -21
  117. package/dist/types/shared/assistant-protocol/index.d.ts +1 -0
  118. package/dist/types/shared/assistant-protocol/limits.d.ts +6 -1
  119. package/dist/types/shared/assistant-protocol/parts.d.ts +43 -3
  120. package/dist/types/shared/assistant-protocol/request.d.ts +14 -2
  121. package/dist/types/shared/dashboard-authoring/calculated-field-identity.d.ts +3 -0
  122. package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +487 -0
  123. package/dist/types/shared/dashboard-authoring/changes/card-types.d.ts +34 -0
  124. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +7886 -0
  125. package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +43 -0
  126. package/dist/types/shared/dashboard-authoring/changes/read-card-query.d.ts +54 -0
  127. package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-changes.d.ts +89 -0
  128. package/dist/types/shared/dashboard-authoring/column-catalog.d.ts +32 -0
  129. package/dist/types/shared/dashboard-authoring/contracts.d.ts +0 -55
  130. package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +16 -6
  131. package/dist/types/shared/dashboard-authoring/dashboard-card-source-index.d.ts +9 -1
  132. package/dist/types/shared/dashboard-authoring/dashboard-filter-mapping-contract.d.ts +7 -0
  133. package/dist/types/shared/dashboard-authoring/dashboard-input-scope.d.ts +118 -0
  134. package/dist/types/shared/dashboard-authoring/filter-applicability.d.ts +75 -0
  135. package/dist/types/shared/dashboard-authoring/filter-model/ad-hoc-filter-values.d.ts +10 -0
  136. package/dist/types/shared/dashboard-authoring/filter-model/filter-definitions.d.ts +29 -0
  137. package/dist/types/shared/dashboard-authoring/filter-model/filter-values.d.ts +58 -0
  138. package/dist/types/shared/dashboard-authoring/filter-model/index.d.ts +7 -0
  139. package/dist/types/shared/dashboard-authoring/filter-model/prototype-document-inputs.d.ts +15 -0
  140. package/dist/types/shared/dashboard-authoring/filter-model/read-dashboard-filter-model.d.ts +78 -0
  141. package/dist/types/shared/dashboard-authoring/filter-model/stored-dashboard.d.ts +18 -0
  142. package/dist/types/shared/dashboard-authoring/filter-model/toolbar-filter-reach.d.ts +23 -0
  143. package/dist/types/shared/dashboard-authoring/index.d.ts +20 -2
  144. package/dist/types/shared/dashboard-authoring/operations/apply-dashboard-operations.d.ts +10 -37
  145. package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +189 -0
  146. package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +94 -0
  147. package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +78 -0
  148. package/dist/types/shared/dashboard-authoring/validators.d.ts +1 -2
  149. package/dist/types/shared/format-utils/exporters/index.d.ts +2 -0
  150. package/dist/types/shared/format-utils/exporters/rendered-file.d.ts +106 -0
  151. package/dist/types/shared/layouts/engine/grid.d.ts +25 -0
  152. package/dist/types/shared/layouts/engine/index.d.ts +4 -0
  153. package/dist/types/shared/layouts/engine/sheet-layout.d.ts +7 -0
  154. package/dist/types/shared/layouts/engine/types.d.ts +125 -0
  155. package/dist/types/shared/layouts/index.d.ts +1 -2
  156. package/package.json +2 -2
  157. package/dist/chunks/_commonjsHelpers-BkfeUUK-.js +0 -28
  158. package/dist/chunks/apply-dashboard-operations-Bz4n1Lq6.js +0 -2260
  159. package/dist/chunks/calendar-day-equality-BmJAWduY.js +0 -460
  160. package/dist/chunks/comparison-window-caption-BTkrN3W4.js +0 -1623
  161. package/dist/chunks/custom-visual-inputs-DUtpYZOk.js +0 -323
  162. package/dist/chunks/dashboard-briefing-launcher-DQ_8O_e2.js +0 -3725
  163. package/dist/chunks/dashboard-controls-8RyBTQUO.js +0 -2315
  164. package/dist/chunks/dashboard-filter-value-compatibility-CwQ_iSNb.js +0 -108
  165. package/dist/chunks/document-dashboard-inputs-BC6p-ESg.js +0 -8087
  166. package/dist/chunks/document-sheet-utils-Duo9uLoH.js +0 -3619
  167. package/dist/chunks/matrix-analytical-definition-C7Gb0e12.js +0 -117
  168. package/dist/chunks/normalize-dashboard-for-dirty-check-Bk3VYv_q.js +0 -67
  169. package/dist/chunks/numeric-presentation-DESvLiu9.js +0 -5227
  170. package/dist/chunks/sort-target-MT1WK1vX.js +0 -29
  171. package/dist/chunks/stable-serialize-CfqXeiBP.js +0 -6
  172. package/dist/chunks/table-settings-CLZocegs.js +0 -501
  173. package/dist/chunks/use-debounced-dirty-check-BwAbnX_5.js +0 -59
  174. package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-storage-transition.d.ts +0 -88
  175. package/dist/types/lib/dashboard-inputs/dashboard-input-scope.d.ts +0 -10
  176. package/dist/types/shared/dashboard-authoring/change-compiler.d.ts +0 -7
  177. package/dist/types/shared/dashboard-authoring/layout-compiler.d.ts +0 -2
  178. package/dist/types/shared/layouts/create-frame-layouts.d.ts +0 -27
  179. package/dist/types/shared/layouts/frame-layouts.d.ts +0 -23
@@ -4,21 +4,21 @@ import { TableColumnEditResult } from '../dashboard-viewer/table-view-edit.js';
4
4
  import { Bookmark } from '../../shared/dashboard-viewer/index.js';
5
5
  import { DashboardViewerState } from '../dashboard-viewer/viewer-store-state.js';
6
6
  import { ViewerStateClient } from '../dashboard-viewer/viewer-state-client.js';
7
- import { AuthToken, TBaseQuery, Breakpoint, ControlDefinition, CustomCard, StyleProps, TCard, TDashboard, TEvent, TFrame, TSheet, TStyle, CacheConfig, FilterLayoutSettings, DocumentDefinition, DashboardInput, DashboardInputSlot, DashboardInputValues, DashboardLifecycleEvent } from '../types/common-types.js';
7
+ import { AuthToken, TBaseQuery, Breakpoint, ControlDefinition, CustomCard, StyleProps, TCard, TDashboard, TEvent, TFrame, TSheet, TStyle, CacheConfig, FilterLayoutSettings, DocumentDefinition, DashboardInput, DashboardInputScope, DashboardInputSlot, DashboardInputValues, DashboardLifecycleEvent } from '../types/common-types.js';
8
8
  import { TFilter, TFilterValue } from '../../components/surfboard/filter/types.js';
9
9
  import { TransientInputContext } from '../dashboard-inputs/transient-input-context.js';
10
10
  import { MissingPrintInputs } from '../print/print-inputs.js';
11
11
  import { default as ReactGridLayout } from 'react-grid-layout';
12
- import { DashboardFramePlacement } from '../../shared/dashboard-authoring/operations/apply-dashboard-operations.js';
12
+ import { CustomizableBreakpoint, EditableBreakpoint, FramePlacement, GridEditBreakpoint, LayoutItem } from '../../shared/layouts/index.js';
13
+ import { DashboardOperation, OperationContext } from '../../shared/dashboard-authoring/operations/apply-dashboard-operations.js';
13
14
  import { FilterGroup, Field } from '../types/explorer-types.js';
14
15
  import { DashboardControlsModelOptions } from '../controls/control-authoring-types.js';
15
16
  import { SemanticExecutionPayload } from '../types/semantic-runtime-types.js';
16
17
  import { DocumentPanelTarget } from '../document/document-panel-target.js';
17
18
  import { DocumentEdit, DocumentEditResult } from '../document/document-edits.js';
19
+ import { FilterSettingsChange, FilterSettingsSaveResult } from '../dashboard-inputs/filter-settings.js';
20
+ import { FilterRef } from '../../shared/dashboard-authoring/filter-model/index.js';
18
21
  import { DashboardInputRuntimeTarget } from '../dashboard-inputs/dashboard-input-values.js';
19
- import { DashboardFilterMappingAuthoringIssue, DashboardFilterInputAcceptanceResult, DashboardFilterMappingAcceptanceResult, DashboardFilterMappingAuthoringRequest, DashboardFilterMappingDisableResult } from '../dashboard-inputs/dashboard-filter-mapping-authoring.js';
20
- import { DashboardFilterOptionSource } from '../../shared/dashboard-authoring/index.js';
21
- import { DashboardFilterAuthoringSettingsUpdate } from '../dashboard-inputs/dashboard-filter-mapping-storage-transition.js';
22
22
  import { GlobalDateComparisonSelection } from '../../shared/analytics-protocol/index.js';
23
23
  import { CalendarPreferencesResponse, ReportRuntimeContext, ResolvedCalendarPreferenceSources } from '../../shared/report-runtime-context/index.js';
24
24
  import { ResolvedValueFormatPreferenceSources, ResolvedValueFormatPreferences } from '../../shared/value-format-preferences/index.js';
@@ -27,35 +27,86 @@ import { CardViewStateMap, DrillStep } from '../dashboard-view-state/index.js';
27
27
  import { DashboardCardPaginationState } from '../dashboard-pagination/dashboard-card-pagination.js';
28
28
  export declare function mergeSemanticExecutionPayloadIntoTarget(target: SemanticExecutionPayload, incoming?: SemanticExecutionPayload): void;
29
29
  type AddFrameOptions = {
30
- /** Default `end`; beside a frame is how a duplicate lands next to its original. */
31
- placement?: DashboardFramePlacement;
30
+ /** By intent; absent: placed by kind (RL-D12). A duplicate passes `{ position: { beside: originalId } }`. */
31
+ placement?: FramePlacement;
32
32
  semanticExecutionPayload?: SemanticExecutionPayload;
33
33
  };
34
- export type FilterDashboardInputDefinitionUpdateMetadata = {
35
- variableName?: string;
36
- label?: string;
37
- forceSelection?: boolean;
38
- exports?: DashboardInput['exports'];
39
- /**
40
- * Option source, dependency and population edits for an embedded Input,
41
- * persisted through the same contract validation as mapped dashboard
42
- * filters. Presentations that bind an embedded Input (the document input
43
- * bar) carry these; dashboard-filter references persist through
44
- * `acceptDashboardFilterInput` and `acceptDashboardFilterMapping` instead.
45
- */
46
- optionSettings?: DashboardFilterAuthoringSettingsUpdate;
34
+ /**
35
+ * A proposal the assistant applied in this edit session (analytics agent
36
+ * Plan 1, spec 8.1, D7-20): the document before and after it, for Undo.
37
+ */
38
+ export type AppliedProposal = {
39
+ proposalId: string;
40
+ before: TDashboard;
41
+ beforePayload: SemanticExecutionPayload;
42
+ after: TDashboard;
43
+ };
44
+ export type ApplyProposalInput = {
45
+ proposalId: string;
46
+ operations: DashboardOperation[];
47
+ /** The context the proposal was resolved with: its pinned calendar. */
48
+ context: OperationContext;
49
+ /** The exact document the proposal was built from (D7-19). */
50
+ basedOn: TDashboard;
51
+ /** Metadata loaded for cards the loaded metadata doesn't cover. */
52
+ semanticExecutionPayload?: SemanticExecutionPayload;
53
+ };
54
+ export type ApplyProposalRefusal = {
55
+ ok: false;
56
+ reason: 'dashboard_changed' | 'not_editable' | 'refused' | 'previous_not_applied';
57
+ message: string;
58
+ };
59
+ export type ApplyProposalResult = {
60
+ ok: true;
61
+ after: TDashboard;
62
+ } | ApplyProposalRefusal;
63
+ export type UndoProposalResult = {
64
+ ok: true;
65
+ } | {
66
+ ok: false;
67
+ reason: 'changed_since' | 'not_found' | 'not_editable';
68
+ };
69
+ /** Arrange from the toolbar (responsive layouts SPEC §6.4, RL-D13). */
70
+ export type ArrangeSheetResult = {
71
+ ok: true;
72
+ } | {
73
+ ok: false;
74
+ reason: 'not_editable' | 'not_a_grid';
47
75
  };
48
- export type FilterDashboardInputDefinitionUpdateResult = {
76
+ export type UndoArrangeResult = {
49
77
  ok: true;
50
78
  } | {
51
79
  ok: false;
52
- issues: DashboardFilterMappingAuthoringIssue[];
80
+ reason: 'changed_since' | 'not_found';
81
+ };
82
+ /** The last toolbar Arrange: `after` is the store's own document, so Undo can tell whether anything changed since (RL-INV-7). */
83
+ export type LastArrange = {
84
+ sheetId: string;
85
+ before: TDashboard;
86
+ after: TDashboard;
87
+ };
88
+ /** The words for a proposal the dashboard could not take, for the viewer. */
89
+ export declare const PROPOSAL_REFUSALS: {
90
+ readonly dashboard_changed: "Not applied: the dashboard changed while I was answering.";
91
+ readonly not_editable: "Not applied: close the editor and ask again.";
92
+ readonly no_save: "Not applied: changes to this dashboard can't be saved here.";
93
+ /** A change built on one that wasn't applied here: nothing to build on (P7-46). */
94
+ readonly previous_not_applied: "Not applied: the change before it wasn't applied.";
53
95
  };
54
96
  export type DashboardStore = {
55
97
  isDownloadingPdf?: boolean;
56
98
  isSessionExpired: boolean;
57
99
  authToken?: AuthToken;
100
+ /** The breakpoint the sheet grid renders: from the container width in view mode, `layoutEditBreakpoint` while editing, `lg` in print (responsive layouts SPEC §6.3). semaphor-app's BreakpointIndicator reads it. */
58
101
  currentBreakpoint: Breakpoint;
102
+ /** The breakpoint the editor edits (RL-D11). Reset to `lg` on dashboard load and on leaving edit mode. */
103
+ layoutEditBreakpoint: EditableBreakpoint;
104
+ /**
105
+ * A screen size shown look-only, or Laptop or Small phone while editing
106
+ * (responsive layouts RL-D18, RL-D19). null: no preview. Never saved; cleared
107
+ * on load, on entering or leaving edit mode, and when an editable size is chosen.
108
+ */
109
+ layoutPreviewBreakpoint: Breakpoint | null;
59
110
  theme?: 'light' | 'dark' | 'system';
60
111
  themeStyle?: StyleProps;
61
112
  filteringCards?: TCard[];
@@ -73,11 +124,6 @@ export type DashboardStore = {
73
124
  * draft-only until the editor Save path applies the current frame.
74
125
  */
75
126
  visualEditPendingFrameRewrites: Record<string, TFrame[]>;
76
- /**
77
- * Pending dashboard-filter metadata rewrites produced while visual editing.
78
- * These stay draft-only until the editor Save path applies the current frame.
79
- */
80
- visualEditPendingFilterRewrites: Record<string, TFilter[]>;
81
127
  /**
82
128
  * Pending dashboard-scoped calculated-field rewrites produced while visual
83
129
  * editing. These stay draft-only until the editor Save path applies the
@@ -96,10 +142,23 @@ export type DashboardStore = {
96
142
  dashboard: TDashboard;
97
143
  semanticExecutionPayload: SemanticExecutionPayload;
98
144
  } | null;
145
+ /**
146
+ * The assistant's proposals applied in this edit session, oldest first
147
+ * (analytics agent Plan 1, spec 8.1, D7-20). Leaving edit mode, and every
148
+ * replacement of the document but a proposal's own Undo, clears them.
149
+ */
150
+ appliedProposals: AppliedProposal[];
151
+ /** The last toolbar Arrange, for its Undo. Cleared by any dashboard load, leaving edit mode, or a successful undo (responsive layouts SPEC §6.4). */
152
+ lastArrange?: LastArrange;
99
153
  isVisualEditing: boolean;
100
154
  showDashboardJSON: boolean;
101
155
  showFilters: boolean;
102
- filterValues?: TFilterValue[];
156
+ /**
157
+ * Runtime-only values no filter defines: chart clicks on SQL charts and
158
+ * summary chips (one filter model SPEC 5.8). Never saved. Authored filter
159
+ * values are `dashboardInputValues` slots.
160
+ */
161
+ adHocFilterValues: TFilterValue[];
103
162
  /** Runtime-only inline filter values, keyed by cardId. Not persisted with dashboard. */
104
163
  inlineFilterValuesMap: Record<string, TFilterValue[]>;
105
164
  /** Runtime-only dashboard control values keyed by globally unique controlId. */
@@ -179,20 +238,25 @@ type Actions = {
179
238
  setGlobalStyle: (style: TStyle) => void;
180
239
  setDashboardInputs: (inputs: DashboardInput[]) => void;
181
240
  upsertDashboardInput: (input: DashboardInput) => void;
182
- updateFilterDashboardInputDefinition: (inputId: string, filter: TFilter, metadata?: FilterDashboardInputDefinitionUpdateMetadata) => FilterDashboardInputDefinitionUpdateResult;
183
- acceptDashboardFilterInput: (updatedFilter: TFilter, optionSource: DashboardFilterOptionSource | undefined, settings?: DashboardFilterAuthoringSettingsUpdate, inputMetadata?: {
184
- variableName?: string;
185
- }) => DashboardFilterInputAcceptanceResult;
186
241
  /**
187
- * Saves filter settings for a dashboard filter no Input owns: the
188
- * definition, and through the default-storage owner its live value and
189
- * saved overlay entry when the default changed (FM-D9). A comparison
190
- * default keeps its own action (`setDefaultDashboardInputComparisonSelection`).
242
+ * Every settings write of a filter (one filter model M4, SPEC 4.5): the
243
+ * definition, label, variable name, keep selection, required, scope, option
244
+ * settings, mapping and value effects, in one write. Nothing is written
245
+ * when the change is refused.
191
246
  */
192
- acceptOrdinaryDashboardFilter: (updatedFilter: TFilter, settings?: Pick<DashboardFilterAuthoringSettingsUpdate, 'defaultValueChanged' | 'selectionIdentityChanged' | 'target'>) => void;
193
- acceptDashboardFilterMapping: (request: DashboardFilterMappingAuthoringRequest, updatedFilter?: TFilter, settings?: DashboardFilterAuthoringSettingsUpdate) => DashboardFilterMappingAcceptanceResult;
194
- disableDashboardFilterMapping: (filterId: string, updatedFilter?: TFilter, settings?: DashboardFilterAuthoringSettingsUpdate) => DashboardFilterMappingDisableResult;
247
+ saveFilterSettings: (ref: FilterRef, change: FilterSettingsChange) => FilterSettingsSaveResult;
195
248
  removeDashboardInput: (inputId: string) => void;
249
+ /**
250
+ * Adds a new filter as an input holding this definition, reaching `scope`
251
+ * (one filter model Phase 5: every filter is an input). One Global Date per
252
+ * dashboard: a second is refused. Returns the new input's id.
253
+ */
254
+ addFilterInput: (filter: TFilter, scope: DashboardInputScope) => string | undefined;
255
+ /**
256
+ * Removes a filter, whichever input holds it, with its saved and runtime
257
+ * values (one filter model SP-9; from Phase 5 every filter is an input).
258
+ */
259
+ removeFilterInput: (ref: FilterRef) => void;
196
260
  reorderDashboardInputs: (orderedInputIds: string[]) => void;
197
261
  setDefaultDashboardInputValues: (values: DashboardInputValues | undefined) => void;
198
262
  setDefaultDashboardInputComparisonSelection: (input: Pick<DashboardInput, 'id' | 'runtimeScope'>, target: DashboardInputRuntimeTarget, selection: GlobalDateComparisonSelection | undefined) => void;
@@ -228,7 +292,14 @@ type Actions = {
228
292
  dashboardInputGeneratedAt?: string;
229
293
  reportContext?: ReportRuntimeContext;
230
294
  }) => void;
295
+ /**
296
+ * Loads a dashboard. `filterValues` is a host overlay (one filter model M5):
297
+ * each filter's value becomes its input's slot, under any slots in
298
+ * `options.dashboardInputValues`; a value no filter defines is ad-hoc.
299
+ */
231
300
  setDashboardWithFilterValues: (dashboard: TDashboard, filterValues: TFilterValue[], runtimeOverrides?: Record<string, unknown>, options?: {
301
+ /** Ad-hoc values to load (SPEC 5.8). */
302
+ adHocFilterValues?: TFilterValue[];
232
303
  selectedSheetId?: string | null;
233
304
  semanticExecutionPayload?: SemanticExecutionPayload;
234
305
  dashboardInputValues?: DashboardInputValues;
@@ -282,7 +353,20 @@ type Actions = {
282
353
  clearDocumentInputRuntime: (sheetId?: string) => void;
283
354
  setSelectedSheetId: (sheetId: string | null) => void;
284
355
  setSheetLayout: (sheetId: string, layout: ReactGridLayout.Layout[]) => void;
285
- setSheetLayouts: (sheetId: string, layouts: ReactGridLayout.Layouts) => void;
356
+ /** The grid's items at the edited breakpoint after a drag or resize stop, through the layout engine (`grid_edited`). */
357
+ editSheetLayout: (sheetId: string, breakpoint: GridEditBreakpoint, items: LayoutItem[]) => void;
358
+ /** Shows a screen size look-only, or ends the preview with null (RL-D19). */
359
+ setLayoutPreviewBreakpoint: (breakpoint: Breakpoint | null) => void;
360
+ /** The screen size the editor edits: Desktop, Tablet or Phone (RL-D11). */
361
+ setLayoutEditBreakpoint: (breakpoint: EditableBreakpoint) => void;
362
+ /** "Back to automatic" for a customized Tablet or Phone layout, through the layout engine (`reset_to_automatic`). */
363
+ resetSheetLayout: (sheetId: string, breakpoint: CustomizableBreakpoint) => void;
364
+ /** Arrange from the toolbar: the `layout.arrange` operation, with edit mode on and an undo record (RL-D13, RL-INV-7). */
365
+ arrangeSheet: (sheetId: string, options?: {
366
+ keepOrder?: boolean;
367
+ }) => ArrangeSheetResult;
368
+ /** Restores the dashboard from before the last toolbar Arrange while it is still what the Arrange left. */
369
+ undoArrange: () => UndoArrangeResult;
286
370
  setSelectedCardId: (sheetId: string, cardId: string | null) => void;
287
371
  setSelectedFrameId: (frameId: string) => void;
288
372
  clearSelectedFrameId: () => void;
@@ -290,7 +374,7 @@ type Actions = {
290
374
  setCardInfo: (cardId: string, info: string) => void;
291
375
  setCardSql: (sheetId: string, cardId: string, sql: string) => void;
292
376
  setCardPython: (cardId: string, pythonCode: string) => void;
293
- setCardDescription: (sheetId: string, cardId: string, description: string, preferences?: TCard['preferences']) => void;
377
+ setCardDescription: (sheetId: string, cardId: string, description: string) => void;
294
378
  setCardKpiOptions: (sheetId: string, cardId: string, kpiOptions: Record<string, any>) => void;
295
379
  updateCardFilters: (cardId: string, filters: FilterGroup | undefined) => void;
296
380
  clearCardFilters: (cardId: string) => void;
@@ -310,37 +394,40 @@ type Actions = {
310
394
  clearAllInlineFilterValues: () => void;
311
395
  setInlineFilterValuesMap: (map: Record<string, TFilterValue[]>) => void;
312
396
  setCardInlineFilterDefaultValues: (sheetId: string, cardId: string, filterId: string, defaultValues: (string | number)[] | undefined) => void;
313
- addFrame: (sheetId: string, frame: TFrame, positionOrOptions?: 'start' | 'end' | AddFrameOptions) => void;
397
+ addFrame: (sheetId: string, frame: TFrame, options?: AddFrameOptions) => void;
314
398
  updateFrame: (sheetId: string, frame: TFrame, options?: {
315
399
  semanticExecutionPayload?: SemanticExecutionPayload;
316
400
  }) => void;
317
401
  updateSheetCalculatedFields: (sheetId: string, calculatedFields: Field[]) => void;
318
402
  updateDashboardCalculatedFields: (calculatedFields: Field[]) => void;
319
403
  setVisualEditPendingFrameRewrites: (sheetId: string, frames: TFrame[]) => void;
320
- setVisualEditPendingFilterRewrites: (sheetId: string, filters: TFilter[]) => void;
321
404
  clearVisualEditPendingFrameRewrites: (sheetId?: string) => void;
322
- clearVisualEditPendingFilterRewrites: (sheetId?: string) => void;
323
405
  updateCard: (sheetId: string, card: TCard) => void;
324
406
  updateFrameCard?: (sheetId: string, frameId: string, card: TCard) => void;
325
407
  updateCurrentDashboardCard: (card: TCard) => void;
326
408
  removeFrame: (sheetId: string, frameId: string) => void;
327
409
  removeCard: (sheetId: string, card: TCard) => void;
328
410
  setIsDashboardEditing: (editing: boolean) => void;
411
+ /**
412
+ * Applies an assistant proposal to the dashboard on screen (spec 8.1,
413
+ * D7-18, D7-27): only while the dashboard is still `basedOn`, checked and
414
+ * written in one step, with edit mode on and an undo record. Callers go
415
+ * through `useApplyProposal`, which loads the metadata first.
416
+ */
417
+ applyProposal: (input: ApplyProposalInput) => ApplyProposalResult;
418
+ /** Undoes the newest applied proposal while the dashboard is still what it left (D7-20). */
419
+ undoProposal: (proposalId: string) => UndoProposalResult;
329
420
  setShowDashboardJSON: (show: boolean) => void;
330
421
  setIsVisualEditing: (editing: boolean) => void;
331
422
  setShowFilters: (show: boolean) => void;
332
423
  setFilterLayout: (settings: Partial<FilterLayoutSettings>) => void;
333
- addFilter: (filter: TFilter) => void;
334
- removeFilter: (filterId: string) => void;
335
- reorderFilters: (orderedFilterIds: string[]) => void;
336
- updateFilter: (filter: TFilter) => void;
337
- updateFilterId: (filterId: string, newId: string) => void;
338
- setFilterDefaultValues: (filterId: string, defaultValues: (string | number)[] | undefined) => void;
339
- setFilterValues: (filterValues: TFilterValue[] | undefined) => void;
340
- addOrUpdateFilterValue: (filterValue: TFilterValue) => void;
341
- addOrUpdateFilterValues: (filterValues: TFilterValue[]) => void;
342
- removeFilterValues: (filterId: string) => void;
343
- replaceFilterValue: (filterValue: TFilterValue) => void;
424
+ /** Adds or replaces ad-hoc values by `filterId`; a value with no values removes its entry. */
425
+ addOrUpdateAdHocFilterValues: (filterValues: TFilterValue[]) => void;
426
+ /** Removes every ad-hoc value whose id starts with the prefix: everything one chart added (SPEC 5.8). */
427
+ removeAdHocFilterValues: (idPrefix: string) => void;
428
+ clearAdHocFilterValues: () => void;
429
+ /** Clears every filter's value on every target, and every ad-hoc value (a card popover's Clear all). */
430
+ clearAllFilterValues: () => void;
344
431
  setStyle: (style: TStyle) => void;
345
432
  getStyle: () => TStyle | undefined;
346
433
  setOnSaveFunction: (onSaveFunction: (dashboard: TDashboard) => void) => void;
@@ -358,7 +445,6 @@ type Actions = {
358
445
  getCardSheet: (cardId: string) => TSheet | undefined;
359
446
  getSelectedSheetLayout: () => ReactGridLayout.Layout[] | undefined;
360
447
  getSelectedSheetLayouts: () => ReactGridLayout.Layouts | undefined;
361
- handleDataPointClickAction: (card: TCard, dataPoint: any) => void;
362
448
  addBaseQuery: (baseQuery: TBaseQuery) => void;
363
449
  removeBaseQuery: (baseQueryId: string) => void;
364
450
  setBaseQueries: (baseQueries: TBaseQuery[]) => void;
@@ -451,6 +537,23 @@ export type ViewerRequestToken = {
451
537
  * editing turned on, else the dashboard as it is now. Both toolbars' "before
452
538
  * editing" capture reads this.
453
539
  */
540
+ /**
541
+ * Whether a toolbar that owns the edit session (the package's or the app's)
542
+ * is mounted: each registers its unsaved-changes check while mounted. Where
543
+ * none is, there is no Save, so nothing changes the dashboard (D7-32).
544
+ */
545
+ export declare function selectHasEditingToolbar(state: Pick<DashboardStore, 'checkUnsavedDashboardChanges'>): boolean;
546
+ /**
547
+ * Where an applied proposal stands for its block (spec 8.1, D7-20):
548
+ * `undoable` while it is the newest and the dashboard is still what it left,
549
+ * `older` with a newer one after it while the dashboard is still what the
550
+ * newest left, `changed_since` for every record after the person's own edit
551
+ * (their change may have undone this one, P7-36), `none` when its record is
552
+ * gone.
553
+ */
554
+ export type ProposalRecordState = 'undoable' | 'older' | 'changed_since' | 'none';
555
+ export declare function selectProposalRecordState(state: Pick<DashboardStore, 'appliedProposals' | 'dashboard'>, proposalId: string): ProposalRecordState;
556
+ export declare function selectProposalUndoable(state: Pick<DashboardStore, 'appliedProposals' | 'dashboard'>, proposalId: string): boolean;
454
557
  export declare function selectEditSessionStart(state: Pick<DashboardStore, 'editingStartedWith' | 'dashboard' | 'semanticExecutionPayload'>): {
455
558
  dashboard: TDashboard;
456
559
  semanticExecutionPayload: SemanticExecutionPayload;
@@ -33,7 +33,6 @@ export type EditorContext = {
33
33
  documentFilterValues?: TFilterValue[];
34
34
  documentControlDefinitions?: ControlDefinition[];
35
35
  documentControlValues?: Record<string, unknown>;
36
- missingRequiredInputLabels?: string[];
37
36
  };
38
37
  /**
39
38
  * Factory function to create empty KPI card configuration
@@ -71,7 +70,6 @@ export type EditorStore = {
71
70
  activeTabCardId?: string | null;
72
71
  showFilters: boolean;
73
72
  applyFilters: boolean;
74
- filterValues?: TFilterValue[];
75
73
  inlineFilterValuesMap: Record<string, TFilterValue[]>;
76
74
  queryResultColumns: string[];
77
75
  queryResultColumnKeyMap?: QueryColumnKeyMap;
@@ -183,7 +181,6 @@ type Actions = TableActions & ExplorerActions & {
183
181
  setCardConfig: (config: CardConfig | undefined) => void;
184
182
  setShowFilters: (showFilters: boolean) => void;
185
183
  setApplyFilters: (applyFilters: boolean) => void;
186
- setFilterValues: (filterValues: TFilterValue[]) => void;
187
184
  setInlineFilterValuesMap: (map: Record<string, TFilterValue[]>) => void;
188
185
  setCardInlineFilterValue: (cardId: string, filterValue: TFilterValue) => void;
189
186
  removeCardInlineFilterValue: (cardId: string, filterId: string) => void;
@@ -138,6 +138,14 @@ export type VisualDisplayPreferences = {
138
138
  * exactly as today (report attachment delivery RA-D11).
139
139
  */
140
140
  delivery?: 'strict';
141
+ /**
142
+ * An emailed card image (PNG exports PN-D13): the card is drawn at the size
143
+ * its saved layout has on a dashboard this many CSS pixels wide, by the
144
+ * dashboard grid's own geometry. Read by `Visual` only.
145
+ */
146
+ imageLayout?: {
147
+ dashboardWidth: number;
148
+ };
141
149
  /**
142
150
  * Override specific UI elements visibility
143
151
  * These overrides take precedence over the mode presets
@@ -161,12 +169,6 @@ export type VisualDisplayPreferences = {
161
169
  * Filter layout settings for controlling how dashboard filters are displayed
162
170
  */
163
171
  export type FilterLayoutSettings = {
164
- /**
165
- * Display mode for filters
166
- * - 'canvas': Filters displayed as draggable/resizable cards on the dashboard canvas (default)
167
- * - 'toolbar': Filters displayed in a compact horizontal toolbar below dashboard controls
168
- */
169
- displayMode?: 'canvas' | 'toolbar';
170
172
  /**
171
173
  * Whether the toolbar should wrap filters to multiple lines
172
174
  * - false: Horizontal scroll when filters overflow (default)
@@ -313,6 +315,8 @@ export type AuthToken = {
313
315
  refreshToken?: string;
314
316
  };
315
317
  export type Breakpoint = 'lg' | 'md' | 'sm' | 'xs' | 'xxs';
318
+ /** The breakpoints a person may customize on purpose: Tablet and Phone (responsive layouts RL-D14). */
319
+ export type CustomizableBreakpoint = Extract<Breakpoint, 'sm' | 'xs'>;
316
320
  type FilterOnClick = {
317
321
  expression?: string;
318
322
  columnIndex: number;
@@ -931,14 +935,27 @@ export type ControlBinding = {
931
935
  mapping: Record<string, string>;
932
936
  } | CurrencyPresentationBinding;
933
937
  export type DashboardInput = FilterDashboardInput | ControlDashboardInput;
938
+ /**
939
+ * Which tabs and cards an input reaches. The one owner of reach; read it only
940
+ * through the scope rule (`doesDashboardInputApplyToTarget`,
941
+ * `isDashboardInputOnTab` in react-semaphor `dashboard-authoring`).
942
+ */
934
943
  export type DashboardInputScope = {
935
944
  kind: 'allSheets';
945
+ /** Omitted = tabs of both kinds. */
936
946
  sheetKinds?: Array<'dashboard' | 'document'>;
947
+ /** Every allowed tab except these. A tab added later is included. */
948
+ exceptSheetIds?: string[];
949
+ /** Every card on the reached tabs except these. A card added later is included. */
950
+ exceptCardIds?: string[];
937
951
  } | {
938
952
  kind: 'sheets';
953
+ /** May be empty: the input reaches nothing. */
939
954
  sheetIds: string[];
955
+ exceptCardIds?: string[];
940
956
  } | {
941
957
  kind: 'cards';
958
+ /** May be empty: the input reaches nothing. */
942
959
  cardIds: string[];
943
960
  } | {
944
961
  kind: 'documentSections';
@@ -1506,6 +1523,12 @@ export type TSheet = {
1506
1523
  description?: string;
1507
1524
  layout?: ReactGridLayout.Layout[];
1508
1525
  layouts?: ReactGridLayout.Layouts;
1526
+ /**
1527
+ * The breakpoints edited on purpose (responsive layouts RL-D3); every other
1528
+ * breakpoint but `lg` is derived from `lg` by the layout engine
1529
+ * (`src/shared/layouts`). Absent on a sheet the engine has never written.
1530
+ */
1531
+ customizedBreakpoints?: CustomizableBreakpoint[];
1509
1532
  cards?: TCard[];
1510
1533
  frames?: TFrame[];
1511
1534
  calculatedFields?: Field[];
@@ -212,6 +212,14 @@ export interface MetricField extends Field {
212
212
  * pre-aggregated metric input.
213
213
  */
214
214
  isPreAggregated?: boolean;
215
+ /**
216
+ * The governed compiler's aggregate provenance, saved with every card it
217
+ * compiles (semaphor-app `buildMetricField`): the semantic model's
218
+ * aggregate, the one applied, and where it came from.
219
+ */
220
+ semanticAggregate?: AggregateFunction;
221
+ effectiveAggregate?: AggregateFunction;
222
+ aggregateSource?: 'semantic_model' | 'caller_override' | 'default_sum';
215
223
  comparison?: MetricComparisonConfig;
216
224
  comparisonPolarity?: MetricComparisonPolarity;
217
225
  /** Governed runtime annotation. When present, authoring polarity is read-only. */
@@ -478,6 +486,8 @@ export interface FilterCondition {
478
486
  * it was saved.
479
487
  */
480
488
  latestValue?: true;
489
+ /** Set when the governed compiler added the latest-value condition by a snapshot dataset's policy (no stated window), not someone's choice: a read leaves it unstated and a recompile adds it again. */
490
+ latestValuePolicy?: 'snapshot';
481
491
  }
482
492
  export interface FilterGroup {
483
493
  id: string;
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Joinability types: the response of GET /api/v1/domains/[domainId]/joinability,
3
+ * used by field draggability states in the query builder.
4
+ *
5
+ * The domain template contract (datasets, fields, metrics, relationships) has one
6
+ * owner, semaphor-app (`src/lib/semantic/template/contract.ts`); it is not copied
7
+ * here. If a react-semaphor consumer ever needs template types, move the contract
8
+ * into react-semaphor's shared contracts and have the app import it, rather than
9
+ * copy it (domain template 2.1, ledger P2-20).
10
+ */
11
+ /**
12
+ * Joinability map for a semantic domain
13
+ *
14
+ * Maps each dataset to the datasets it can join with, including both direct (1-hop)
15
+ * and indirect (2-hop) joins. This is a lightweight topology representation used by
16
+ * the frontend for UX feedback (field draggability states).
17
+ *
18
+ * The backend generates this from the full relationship definitions and serves it
19
+ * via GET /api/v1/domains/[domainId]/joinability
20
+ */
21
+ export interface JoinabilityMap {
22
+ [datasetName: string]: {
23
+ /**
24
+ * Datasets that can be joined directly (1-hop)
25
+ * Example: orders.canJoinTo = ['customers', 'products']
26
+ */
27
+ canJoinTo: string[];
28
+ /**
29
+ * Datasets that require multi-hop joins (2-hop)
30
+ * Key: target dataset name
31
+ * Value: array of intermediate datasets to traverse
32
+ *
33
+ * Example: orders.indirectJoins = { countries: ['stores'] }
34
+ * Means: orders → stores → countries
35
+ */
36
+ indirectJoins: {
37
+ [targetDataset: string]: string[];
38
+ };
39
+ /**
40
+ * Datasets related by an ACTIVE relationship that is not set to join
41
+ * automatically. The query engine will not auto-join these; the user
42
+ * has to enable automatic join on the relationship or configure the
43
+ * join on the chart. Drives the "Requires setup" field state.
44
+ * Optional: older servers omit it.
45
+ */
46
+ manualJoins?: string[];
47
+ /**
48
+ * Direct neighbours connected by MORE THAN ONE active auto-join
49
+ * relationship, with the count. The engine picks by join priority,
50
+ * so this is informational ("Multiple relationships; highest
51
+ * priority is used"), never blocking. Optional.
52
+ */
53
+ ambiguousJoins?: {
54
+ [targetDataset: string]: number;
55
+ };
56
+ /**
57
+ * Cardinality of the direct auto-join, from THIS dataset's side.
58
+ * `one_to_many` means one row here matches many rows there, so an
59
+ * aggregate over this dataset's values joined to that dataset may
60
+ * repeat. `unknown` when the relationship has no authored cardinality
61
+ * (the planner refuses repeat-sensitive measures across it).
62
+ * Informational; drives a warning, never a block. Optional.
63
+ */
64
+ cardinality?: {
65
+ [targetDataset: string]: 'one_to_one' | 'one_to_many' | 'many_to_one' | 'many_to_many' | 'unknown';
66
+ };
67
+ };
68
+ }
69
+ /**
70
+ * Response from the joinability map API
71
+ */
72
+ export interface JoinabilityMapResponse {
73
+ /** Lightweight joinability map for field state calculation */
74
+ joinabilityMap: JoinabilityMap;
75
+ /** Minimal dataset information */
76
+ datasets: Array<{
77
+ name: string;
78
+ label: string;
79
+ type: string;
80
+ table?: string | null;
81
+ catalog?: string | null;
82
+ schema?: string | null;
83
+ }>;
84
+ }
@@ -0,0 +1,20 @@
1
+ import { TCard } from '../types/common-types.js';
2
+ type BuildSavedEditorCardOptions = {
3
+ isDevMode: boolean;
4
+ cardSql?: string;
5
+ selectedSchemaName?: string;
6
+ selectedDatabaseName?: string;
7
+ selectedTableName?: string;
8
+ selectedConnectionId?: string;
9
+ remoteChartSettings?: unknown;
10
+ stripConfig: (config: TCard['config']) => TCard['config'];
11
+ };
12
+ /**
13
+ * The card the editor saves. The editor's picker selection (database,
14
+ * schema, table, data model) is not written onto the card: a card's source is
15
+ * its `dataSource`, so Done with no change leaves the card as it was
16
+ * (MCP dashboard editing ledger V-50, V-58). A stored card's older copies of
17
+ * the picker stay as they are, read by nothing at run time.
18
+ */
19
+ export declare function buildSavedEditorCard(card: TCard, { isDevMode, cardSql, selectedSchemaName, selectedDatabaseName, selectedTableName, selectedConnectionId, remoteChartSettings, stripConfig, }: BuildSavedEditorCardOptions): TCard;
20
+ export {};
@@ -8,6 +8,11 @@ export type CardTypeChangeOptions = {
8
8
  catalogLoading?: boolean;
9
9
  /** A plugin visual chosen as `custom`. */
10
10
  customVisual?: TCustomCardPreferences;
11
+ /**
12
+ * Mints the ids the conversion needs (Matrix field instances), in order.
13
+ * Default `crypto.randomUUID`; a replayed change passes its stored ids (DE-D54).
14
+ */
15
+ createId?: () => string;
11
16
  };
12
17
  export type CardTypeChange = {
13
18
  status: 'refused';
@@ -19,6 +24,8 @@ export type CardTypeChange = {
19
24
  card: TCard;
20
25
  /** Labels of authored parts the new type could not keep. */
21
26
  leftOut: readonly string[];
27
+ /** Chart-scoped preference keys the new type drops (DE-D43). */
28
+ droppedPreferences: readonly (keyof TCardPreferences)[];
22
29
  crossedMatrixBoundary: boolean;
23
30
  forcesSqlMode: boolean;
24
31
  };
@@ -28,3 +35,12 @@ export type CardTypeChange = {
28
35
  * the editor store applies the result.
29
36
  */
30
37
  export declare function changeCardType(card: TCard, type: TCard['type'], options?: CardTypeChangeOptions): CardTypeChange;
38
+ /**
39
+ * A type change as a person makes it in the editor (MCP dashboard editing
40
+ * DE-D51, ledger P2-01): the chart picker is `changeCardType`; between table
41
+ * kinds the table editor's tabs are `switchTableType`. A detail table is
42
+ * reached only through the tabs, so a change into or out of one goes through
43
+ * a table, as the editor's two steps do. The dashboard reducer's `retype`
44
+ * calls this; the editor keeps calling each half from its own control.
45
+ */
46
+ export declare function changeCardTypeAsEditor(card: TCard, type: TCard['type'], options?: CardTypeChangeOptions): CardTypeChange;
@@ -0,0 +1,25 @@
1
+ import { TCard } from '../types/common-types.js';
2
+ import { AutoJoinMetadata } from '../types/query-types.js';
3
+ import { JoinabilityMapResponse } from '../types/semantic-types.js';
4
+ import { FieldStateContext } from './field-state-calculator.js';
5
+ /**
6
+ * Everything `calculateFieldState` needs about a visual, except the
7
+ * selected fields (which differ per call). Built by ONE function so the
8
+ * field list, the click gate, the drop gate, and the matrix editor judge
9
+ * the same card from the same facts: the same join plan (the authored
10
+ * one, which is also right for matrix cards), the same auto-resolved
11
+ * base, the same relationship map, aliases, labels, mode, and data-source
12
+ * anchor. A caller that assembles these by hand will eventually disagree
13
+ * with the others; do not.
14
+ */
15
+ export type FieldAvailabilityContext = Omit<FieldStateContext, 'selectedFields'> & {
16
+ /** The semantic domain the card reads, when any. */
17
+ semanticDomainId?: string;
18
+ };
19
+ export declare function buildFieldAvailabilityContext(input: {
20
+ card: Pick<TCard, 'type' | 'config' | 'dataSource'> | null | undefined;
21
+ joinabilityData?: JoinabilityMapResponse | null;
22
+ autoJoinMetadata?: AutoJoinMetadata;
23
+ /** Labels the caller knows from elsewhere (entity groups); catalog labels win. */
24
+ extraDatasetLabels?: Record<string, string>;
25
+ }): FieldAvailabilityContext;