react-semaphor 0.1.543 → 0.1.545

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 (125) hide show
  1. package/dist/activity/index.js +73 -0
  2. package/dist/analytics-protocol/index.js +35 -34
  3. package/dist/assistant-context/index.js +1 -1
  4. package/dist/brand-studio/index.js +2 -2
  5. package/dist/briefings/index.js +56 -52
  6. package/dist/chunks/{class-utils-Df1OVOT1.js → _commonjsHelpers-DimLPMtv.js} +124 -98
  7. package/dist/chunks/{apply-dashboard-operations-CG9S7MGt.js → apply-dashboard-operations-CZEMsx8E.js} +778 -958
  8. package/dist/chunks/{assistant-chat-BFMRUYoB.js → assistant-chat-D7sWTypJ.js} +26 -27
  9. package/dist/chunks/calendar-day-equality-dvoQp1xW.js +410 -0
  10. package/dist/chunks/{comparison-window-caption-Bv18samq.js → comparison-window-caption-D4E6IHPD.js} +462 -456
  11. package/dist/chunks/{custom-visual-inputs-DUtpYZOk.js → custom-visual-inputs-DLCD9Y5V.js} +8 -2
  12. package/dist/chunks/dashboard-B1tMju0u.js +14 -0
  13. package/dist/chunks/dashboard-briefing-launcher-CePgIu0Z.js +3720 -0
  14. package/dist/chunks/{dashboard-controls-UGpjOM2k.js → dashboard-controls-Cq05n3e0.js} +526 -521
  15. package/dist/chunks/{dashboard-json-DG8dz0eX.js → dashboard-json-CoYRPqxx.js} +3 -3
  16. package/dist/chunks/document-dashboard-inputs-BesAHZvB.js +3112 -0
  17. package/dist/chunks/{edit-dashboard-visual-CDpA4y5e.js → edit-dashboard-visual-JPtNfJRb.js} +5628 -5618
  18. package/dist/chunks/export-file-format-C-tJsxsf.js +111 -0
  19. package/dist/chunks/{filter-value-text-CYsVYPuD.js → filter-value-text-ff7osJr7.js} +1 -1
  20. package/dist/chunks/{index-l5LclZvs.js → index-DRWiuqyd.js} +378 -332
  21. package/dist/chunks/{matrix-formatter-BnsTX90d.js → matrix-formatter-DnCyRXJE.js} +13 -13
  22. package/dist/chunks/{numeric-presentation-F_-H6VAw.js → numeric-presentation-7X_IrD58.js} +2572 -2573
  23. package/dist/chunks/{pivot-result-lifecycle-DupbRk-R.js → pivot-result-lifecycle-DM4CyGKs.js} +285 -393
  24. package/dist/chunks/{raw-temporal-presentation-D-azM_98.js → raw-temporal-presentation-C3mUgnEx.js} +2 -2
  25. package/dist/chunks/{zoned-wall-clock-MulfA26h.js → relative-date-label-Bk2j94pA.js} +21 -64
  26. package/dist/chunks/rendered-file-D8xEuVVx.js +108 -0
  27. package/dist/chunks/{report-preferences-dialog-CPwRwEJx.js → report-preferences-dialog-DUtuUL_5.js} +640 -612
  28. package/dist/chunks/resolve-dashboard-input-context-DJ2tICwz.js +9415 -0
  29. package/dist/chunks/{saved-dashboard-context-BKvMfRfC.js → saved-dashboard-context-LrF_kW0l.js} +183 -211
  30. package/dist/chunks/selection-filter-compiler-BKXmyLrS.js +79 -0
  31. package/dist/chunks/{semaphor-ready-indicator-CN2AHm2x.js → semaphor-ready-indicator-BxF96Yhv.js} +46859 -47102
  32. package/dist/chunks/shelf-drop-preview-context-CNaM_Gmh.js +2469 -0
  33. package/dist/chunks/{switch-C3jLxlG0.js → switch-uDtPgQlQ.js} +44 -45
  34. package/dist/chunks/{table-export-sheet-BDRXLLdq.js → table-export-sheet-YzMioA7Y.js} +1 -1
  35. package/dist/chunks/{use-create-flow-overlay-state-BnclfB2k.js → use-create-flow-overlay-state-CjB7ig1o.js} +153 -164
  36. package/dist/chunks/zoned-wall-clock-BkxV9jS2.js +46 -0
  37. package/dist/dashboard/index.js +1 -1
  38. package/dist/dashboard-authoring/index.js +553 -541
  39. package/dist/data-app-sdk/index.js +1 -1
  40. package/dist/format-utils/index.js +241 -227
  41. package/dist/index.js +354 -331
  42. package/dist/style.css +1 -1
  43. package/dist/surfboard/index.js +1 -1
  44. package/dist/types/activity.d.ts +2 -0
  45. package/dist/types/briefings/attachment-outcomes.d.ts +1 -1
  46. package/dist/types/briefings/attachments.d.ts +33 -6
  47. package/dist/types/briefings/index.d.ts +6 -5
  48. package/dist/types/components/activity/activity-bell.d.ts +11 -0
  49. package/dist/types/components/activity/activity-instance.d.ts +50 -0
  50. package/dist/types/components/activity/activity-notices.d.ts +7 -0
  51. package/dist/types/components/activity/activity-provider.d.ts +21 -0
  52. package/dist/types/components/activity/activity-types.d.ts +177 -0
  53. package/dist/types/components/activity/index.d.ts +6 -0
  54. package/dist/types/components/activity/use-activity.d.ts +20 -0
  55. package/dist/types/components/briefings/briefing-author/run-model.d.ts +1 -2
  56. package/dist/types/components/briefings/briefing-author.d.ts +14 -12
  57. package/dist/types/components/briefings/dashboard-briefing-launcher.d.ts +5 -0
  58. package/dist/types/components/briefings/use-briefing-run-detail.d.ts +34 -0
  59. package/dist/types/components/index.d.ts +1 -4
  60. package/dist/types/components/surfboard/filter/types.d.ts +0 -14
  61. package/dist/types/lib/activity-identity.d.ts +21 -0
  62. package/dist/types/lib/api/exports-api.d.ts +4 -4
  63. package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-authoring.d.ts +68 -82
  64. package/dist/types/lib/dashboard-inputs/dashboard-input-target-context.d.ts +0 -8
  65. package/dist/types/lib/dashboard-inputs/dashboard-input-values.d.ts +35 -1
  66. package/dist/types/lib/dashboard-inputs/filter-settings.d.ts +199 -0
  67. package/dist/types/lib/dashboard-inputs/resolve-dashboard-input-context.d.ts +7 -2
  68. package/dist/types/lib/dashboard-inputs/resolve-selection-input.d.ts +1 -1
  69. package/dist/types/lib/dashboard-viewer/captured-runtime-values.d.ts +40 -0
  70. package/dist/types/lib/dashboard-viewer/compatibility-input-storage.d.ts +16 -16
  71. package/dist/types/lib/dashboard-viewer/viewer-state.d.ts +11 -9
  72. package/dist/types/lib/download-pdf.d.ts +75 -1
  73. package/dist/types/lib/hooks/index.d.ts +1 -3
  74. package/dist/types/lib/hooks/use-date-filter.d.ts +5 -0
  75. package/dist/types/lib/hooks/use-text-filter.d.ts +5 -0
  76. package/dist/types/lib/matrix-table/matrix-delivery-policy.d.ts +5 -4
  77. package/dist/types/lib/matrix-table/matrix-delivery.d.ts +4 -0
  78. package/dist/types/lib/query-context/assemble-card-query.d.ts +158 -0
  79. package/dist/types/lib/query-context/build-card-query-context.d.ts +3 -3
  80. package/dist/types/lib/query-context/build-dashboard-card-query-contract.d.ts +15 -6
  81. package/dist/types/lib/query-context/build-dashboard-execution-snapshot.d.ts +11 -13
  82. package/dist/types/lib/query-context/compile-dashboard-card-filters.d.ts +22 -12
  83. package/dist/types/lib/stores/dashboard-store.d.ts +39 -55
  84. package/dist/types/lib/stores/editor-store.d.ts +0 -3
  85. package/dist/types/lib/types/common-types.d.ts +21 -6
  86. package/dist/types/shared/activity/activity-contract.d.ts +84 -0
  87. package/dist/types/shared/activity/index.d.ts +5 -0
  88. package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +4 -11
  89. package/dist/types/shared/dashboard-authoring/card-export-request.d.ts +6 -0
  90. package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +12 -12
  91. package/dist/types/shared/dashboard-authoring/dashboard-filter-mapping-contract.d.ts +7 -0
  92. package/dist/types/shared/dashboard-authoring/dashboard-input-scope.d.ts +92 -0
  93. package/dist/types/shared/dashboard-authoring/filter-model/ad-hoc-filter-values.d.ts +10 -0
  94. package/dist/types/shared/dashboard-authoring/filter-model/filter-definitions.d.ts +29 -0
  95. package/dist/types/shared/dashboard-authoring/filter-model/filter-values.d.ts +58 -0
  96. package/dist/types/shared/dashboard-authoring/filter-model/index.d.ts +7 -0
  97. package/dist/types/shared/dashboard-authoring/filter-model/prototype-document-inputs.d.ts +15 -0
  98. package/dist/types/shared/dashboard-authoring/filter-model/read-dashboard-filter-model.d.ts +78 -0
  99. package/dist/types/shared/dashboard-authoring/filter-model/stored-dashboard.d.ts +18 -0
  100. package/dist/types/shared/dashboard-authoring/filter-model/toolbar-filter-reach.d.ts +23 -0
  101. package/dist/types/shared/dashboard-authoring/index.d.ts +2 -0
  102. package/dist/types/shared/format-utils/export-policy.d.ts +12 -0
  103. package/dist/types/shared/format-utils/exporters/index.d.ts +2 -0
  104. package/dist/types/shared/format-utils/exporters/rendered-file.d.ts +106 -0
  105. package/package.json +6 -2
  106. package/dist/chunks/_commonjsHelpers-BkfeUUK-.js +0 -28
  107. package/dist/chunks/calendar-day-equality-BmJAWduY.js +0 -460
  108. package/dist/chunks/dashboard-B9mKTJoy.js +0 -14
  109. package/dist/chunks/dashboard-briefing-launcher-Bdmry_oG.js +0 -4248
  110. package/dist/chunks/document-dashboard-inputs-OwqCbrVp.js +0 -8087
  111. package/dist/chunks/document-sheet-utils-BTb3VZxV.js +0 -3619
  112. package/dist/chunks/shelf-drop-preview-context-BGl_rxcW.js +0 -2407
  113. package/dist/chunks/sort-target-MT1WK1vX.js +0 -29
  114. package/dist/types/components/briefings/briefing-author/run-ui.d.ts +0 -81
  115. package/dist/types/components/briefings/use-briefing-run-polling.d.ts +0 -34
  116. package/dist/types/components/notifications/export-notification-item.d.ts +0 -24
  117. package/dist/types/components/notifications/export-notification-list.d.ts +0 -8
  118. package/dist/types/components/notifications/index.d.ts +0 -3
  119. package/dist/types/components/notifications/notification-bell.d.ts +0 -13
  120. package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-storage-transition.d.ts +0 -88
  121. package/dist/types/lib/dashboard-inputs/dashboard-input-scope.d.ts +0 -10
  122. package/dist/types/lib/exports/bounded-request.d.ts +0 -12
  123. package/dist/types/lib/hooks/use-export-polling.d.ts +0 -32
  124. package/dist/types/lib/hooks/use-export-recovery.d.ts +0 -11
  125. package/dist/types/lib/stores/export-store.d.ts +0 -62
@@ -1,7 +1,12 @@
1
1
  import { TFilter } from '../../components/surfboard/filter/types.js';
2
- import { DashboardInputScope, ReferencedFilterDashboardInput, TDashboard } from '../types/common-types.js';
3
- import { buildDashboardCardSourceIndex, DashboardFilterCardApplication, DashboardFilterOptionSource, DashboardFilterTarget, DashboardFilterTargetField } from '../../shared/dashboard-authoring/index.js';
4
- import { DashboardFilterOptionPolicy } from './dashboard-filter-mapping-storage-transition.js';
2
+ import { DashboardInputScope, TCard, TDashboard } from '../types/common-types.js';
3
+ import { DashboardFilterApplication, DashboardFilterCardApplication, DashboardFilterTarget, DashboardFilterTargetField } from '../../shared/dashboard-authoring/index.js';
4
+ import { FilterRef, ReachedCard } from '../../shared/dashboard-authoring/filter-model/index.js';
5
+ /**
6
+ * Filter mapping (one filter model M3, SPEC 4.4): the Cards tab of any filter
7
+ * input. `draftDashboardFilterMapping` builds the rows from the cards the
8
+ * input reaches and, with them, exactly what Accept would save. Pure.
9
+ */
5
10
  export type DashboardFilterMappingCandidateCatalog = {
6
11
  status: 'ready';
7
12
  targets: DashboardFilterTarget[];
@@ -18,7 +23,13 @@ export type DashboardFilterMappingDraftDecision = {
18
23
  export type DashboardFilterMappingDraftStatus = 'pendingSource' | 'automatic' | 'suggested' | 'needsMapping' | 'mapped' | 'notApplicable' | 'excluded' | 'invalidMapping' | 'metadataUnavailable';
19
24
  export type DashboardFilterMappingDraftRow = {
20
25
  cardId: string;
26
+ /** The panel reads the title and meta line from it. */
27
+ card: TCard;
21
28
  sheetId: string;
29
+ sheetKind: 'dashboard' | 'document';
30
+ sectionId?: string;
31
+ /** The section's title, for a card in a Document section. */
32
+ sectionTitle?: string;
22
33
  executionKind: 'config' | 'sql' | 'unconfigured';
23
34
  status: DashboardFilterMappingDraftStatus;
24
35
  candidates: DashboardFilterTarget[];
@@ -28,27 +39,28 @@ export type DashboardFilterMappingDraftRow = {
28
39
  guidanceMessage?: string;
29
40
  automaticFieldName?: string;
30
41
  };
31
- export type DashboardFilterMappingDraft = {
32
- filterId: string;
33
- existingInputId?: string;
34
- outerScope: Extract<DashboardInputScope, {
35
- kind: 'allSheets' | 'sheets';
36
- }>;
42
+ export type DashboardFilterMappingGroup = {
43
+ sheetId: string;
44
+ sheetTitle: string;
45
+ sheetKind: 'dashboard' | 'document';
37
46
  rows: DashboardFilterMappingDraftRow[];
38
47
  };
39
- export type DashboardFilterMappingAuthoringIssueCode = 'filterNotFound' | 'mappingNotFound' | 'globalDateUnsupported' | 'conflictingDashboardInput' | 'unsupportedOuterScope' | 'unsupportedRuntimeScope' | 'missingDecision' | 'invalidTarget' | 'metadataUnavailable';
40
- export type DashboardFilterMappingAuthoringIssue = {
41
- code: DashboardFilterMappingAuthoringIssueCode;
48
+ export type DashboardFilterMappingIssueCode = 'inputNotFound' | 'globalDateUnsupported' | 'unsupportedOuterScope' | 'unsupportedRuntimeScope' | 'missingDecision' | 'invalidTarget' | 'metadataUnavailable';
49
+ export type DashboardFilterMappingIssue = {
50
+ code: DashboardFilterMappingIssueCode;
42
51
  message: string;
43
- filterId: string;
52
+ ref: FilterRef;
53
+ /** Set once the ref resolved. */
54
+ inputId?: string;
44
55
  cardId?: string;
45
56
  };
46
- export type DashboardFilterMappingDraftResult = {
57
+ /** What Accept would save, computed with the rows. */
58
+ export type DashboardFilterMappingAcceptance = {
47
59
  ok: true;
48
- draft: DashboardFilterMappingDraft;
60
+ application: DashboardFilterApplication;
49
61
  } | {
50
62
  ok: false;
51
- issues: DashboardFilterMappingAuthoringIssue[];
63
+ issues: DashboardFilterMappingIssue[];
52
64
  };
53
65
  export type DashboardFilterMappingStatusSummary = {
54
66
  coveredCount: number;
@@ -57,65 +69,58 @@ export type DashboardFilterMappingStatusSummary = {
57
69
  invalidCount: number;
58
70
  attentionCount: number;
59
71
  };
60
- /**
61
- * One presentation-neutral projection of authoritative Cards-tab rows.
62
- * Consumers must not independently reinterpret draft statuses when deciding
63
- * whether an author needs to act.
64
- */
65
- export declare function summarizeDashboardFilterMappingRows(rows: DashboardFilterMappingDraftRow[]): DashboardFilterMappingStatusSummary;
66
- export type DashboardFilterMappingAcceptanceResult = {
67
- ok: true;
68
- draft: DashboardFilterMappingDraft;
69
- input: ReferencedFilterDashboardInput;
70
- } | {
71
- ok: false;
72
- draft?: DashboardFilterMappingDraft;
73
- issues: DashboardFilterMappingAuthoringIssue[];
74
- };
75
- export type DashboardFilterMappingDisableResult = {
76
- ok: true;
72
+ export type DashboardFilterMappingDraft = {
77
73
  inputId: string;
78
- } | {
79
- ok: false;
80
- issues: DashboardFilterMappingAuthoringIssue[];
74
+ filterId: string;
75
+ /** The scope the rows were computed with: the staged scope, else the saved one. Accept never changes it (S-5). */
76
+ scope: Exclude<DashboardInputScope, {
77
+ kind: 'documentSections';
78
+ }>;
79
+ /** The cards the rows were built for; the catalogs hook fetches metadata for exactly these. */
80
+ cards: readonly ReachedCard[];
81
+ /** One group per reached tab, in dashboard tab order; rows in `cards` order. */
82
+ groups: DashboardFilterMappingGroup[];
83
+ summary: DashboardFilterMappingStatusSummary;
84
+ acceptance: DashboardFilterMappingAcceptance;
81
85
  };
82
- export type DashboardFilterInputAcceptanceResult = {
86
+ export type DashboardFilterMappingDraftResult = {
83
87
  ok: true;
84
- input: ReferencedFilterDashboardInput;
85
- created: boolean;
88
+ draft: DashboardFilterMappingDraft;
86
89
  } | {
87
90
  ok: false;
88
- issues: DashboardFilterMappingAuthoringIssue[];
91
+ issues: DashboardFilterMappingIssue[];
89
92
  };
90
- export type DashboardFilterMappingAuthoringRequest = {
91
- filterId: string;
93
+ export type DashboardFilterMappingRequest = {
94
+ /** The filter. Chips pass `{ inputId }`, a toolbar filter's compatibility id included. */
95
+ ref: FilterRef;
96
+ /** The dashboard as saved. */
97
+ dashboard: TDashboard;
98
+ /** The definition being edited, if changed. */
99
+ stagedDefinition?: TFilter;
100
+ /** The scope being edited, if changed; otherwise the saved scope, unnarrowed (OF-D8). */
101
+ stagedScope?: DashboardInputScope;
92
102
  candidatesByCardId: Record<string, DashboardFilterMappingCandidateCatalog | undefined>;
93
103
  /** Grounded field that supplies the current filter value. */
94
104
  selectionField?: Pick<DashboardFilterTargetField, 'name' | 'sourceField'> & Partial<Pick<DashboardFilterTargetField, 'source'>>;
95
105
  /**
96
- * Strictly proven identities eligible for Auto. Physical datasets in a
97
- * semantic domain may expose both physical and semantic identities. An
98
- * explicit empty array is authoritative and must not fall back to a
99
- * candidate-only selectionField source.
106
+ * Strictly proven identities eligible for Auto. An explicit empty array is
107
+ * authoritative and must not fall back to a candidate-only selectionField source.
100
108
  */
101
109
  automaticSelectionSources?: DashboardFilterTargetField['source'][];
102
110
  /** Datatype of the raw selection value, which may differ from the label. */
103
111
  selectionDataType?: string;
104
- /**
105
- * Re-check saved targets against selectionField after the author changes
106
- * the raw Option Value identity. Explicit draft decisions still win.
107
- */
112
+ /** Re-check saved targets after the option value field changed. */
108
113
  revalidatePersistedTargets?: boolean;
109
114
  decisionsByCardId?: Record<string, DashboardFilterMappingDraftDecision | undefined>;
110
- /** Staged outer sheet scope. Omit when the author did not edit Scope. */
111
- outerScope?: DashboardFilterMappingDraft['outerScope'];
112
- /** Test seam; production callers use opaque random UUIDs. */
115
+ /** Test seam for new binding ids; production uses opaque random UUIDs. */
113
116
  createId?: () => string;
114
117
  };
115
- export declare function buildDashboardFilterMappingOuterScope(params: {
116
- filter: Pick<TFilter, 'sheetId' | 'applyToSheetIds' | 'excludeSheetIds'>;
117
- dashboard: Pick<TDashboard, 'sheets'>;
118
- }): DashboardFilterMappingDraft['outerScope'];
118
+ /**
119
+ * One presentation-neutral projection of authoritative Cards-tab rows.
120
+ * Consumers must not independently reinterpret draft statuses when deciding
121
+ * whether an author needs to act.
122
+ */
123
+ export declare function summarizeDashboardFilterMappingRows(rows: DashboardFilterMappingDraftRow[]): DashboardFilterMappingStatusSummary;
119
124
  /**
120
125
  * One Cards row for a source-qualified value field that is not a toolbar
121
126
  * filter, such as a field a click carries. It is the same decision chain the
@@ -124,8 +129,11 @@ export declare function buildDashboardFilterMappingOuterScope(params: {
124
129
  * authoring surface. Equality is the only operation a click applies.
125
130
  */
126
131
  export declare function buildDashboardFilterMappingDraftRowForValueField(params: {
127
- card: Parameters<typeof buildDashboardCardSourceIndex>[0];
132
+ card: TCard;
128
133
  sheetId: string;
134
+ sheetKind: 'dashboard' | 'document';
135
+ sectionId?: string;
136
+ sectionTitle?: string;
129
137
  valueField: DashboardFilterTargetField;
130
138
  catalog: DashboardFilterMappingCandidateCatalog | undefined;
131
139
  decision?: DashboardFilterMappingDraftDecision;
@@ -133,27 +141,5 @@ export declare function buildDashboardFilterMappingDraftRowForValueField(params:
133
141
  /** Bindings already accepted elsewhere for this value field, offered as inherited matches. */
134
142
  acceptedTargets?: DashboardFilterTarget[];
135
143
  }): DashboardFilterMappingDraftRow;
136
- /** The reference-backed Input for a dashboard filter, mapped or not. */
137
- export declare function findReferencedDashboardFilterInput(dashboard: Pick<TDashboard, 'inputs'>, filterId: string): ReferencedFilterDashboardInput | undefined;
138
- export declare function acceptDashboardFilterInputDraft(params: {
139
- dashboard: Pick<TDashboard, 'filters' | 'sheets' | 'inputs'>;
140
- updatedFilter: TFilter;
141
- optionSource?: DashboardFilterOptionSource;
142
- /** Option dependency policy to persist; omitted keeps the existing one. */
143
- optionPolicy?: DashboardFilterOptionPolicy;
144
- inputMetadata?: {
145
- variableName?: string;
146
- forceSelection?: boolean;
147
- };
148
- createId?: () => string;
149
- }): DashboardFilterInputAcceptanceResult;
150
- export declare function buildDashboardFilterMappingDraft(params: {
151
- dashboard: Pick<TDashboard, 'filters' | 'sheets' | 'inputs'>;
152
- request: DashboardFilterMappingAuthoringRequest;
153
- }): DashboardFilterMappingDraftResult;
154
- export declare function acceptDashboardFilterMappingDraft(params: {
155
- dashboard: Pick<TDashboard, 'filters' | 'sheets' | 'inputs'>;
156
- request: DashboardFilterMappingAuthoringRequest;
157
- updatedFilter?: TFilter;
158
- }): DashboardFilterMappingAcceptanceResult;
159
- export declare function findMappedDashboardFilterInput(dashboard: Pick<TDashboard, 'inputs'>, filterId: string): ReferencedFilterDashboardInput | undefined;
144
+ /** The one entry point of M3 (SPEC 4.4). Pure. */
145
+ export declare function draftDashboardFilterMapping(request: DashboardFilterMappingRequest): DashboardFilterMappingDraftResult;
@@ -108,12 +108,4 @@ export declare function createExplicitDashboardInputTargetContext(params: {
108
108
  controls?: DashboardInputTargetContext['controls'];
109
109
  target?: NormalizedFilterDashboardInput;
110
110
  }): DashboardInputTargetContext;
111
- /**
112
- * Applicability for option peers. A card-local or section-local target sees
113
- * exactly what applies to it. A sheet-level target additionally sees the
114
- * Inputs local to cards or sections on that sheet, the same rule the toolbar
115
- * uses to decide what a sheet presents, so option narrowing and presentation
116
- * agree on what "on this sheet" means.
117
- */
118
- export declare function doesDashboardInputApplyToTargetScope(input: Pick<NormalizedDashboardInput, 'scope' | 'compatibility'>, scope: DashboardInputTargetScope, sheetLocalCardIds: ReadonlySet<string>): boolean;
119
111
  export declare function describeInput(input: Pick<NormalizedDashboardInput, 'id' | 'label'> & Partial<Pick<NormalizedFilterDashboardInput, 'filter'>>): string;
@@ -18,8 +18,27 @@ export declare function setDashboardInputRuntimeSlot(values: DashboardInputValue
18
18
  */
19
19
  export declare function materializeDashboardInputRuntimeSlot(input: NormalizedDashboardInput, slot: DashboardInputSlot | undefined): DashboardInputSlot | undefined;
20
20
  export declare function removeDashboardInputRuntimeSlot(values: DashboardInputValues, input: Pick<DashboardInput, 'id' | 'runtimeScope'>, target: DashboardInputRuntimeTarget): DashboardInputValues;
21
+ /**
22
+ * Whether a filter input holds an active value on a tab, as its chip shows
23
+ * it: its slot for the tab, the saved default included. The one rule both
24
+ * filter bars (the toolbar and a Document's input bar) count and clear by
25
+ * for Clear all. It reads the slot directly, so a filter scoped to specific
26
+ * cards on the tab counts although it applies to no tab-level target.
27
+ */
28
+ export declare function hasActiveFilterInputValueOnTab(params: {
29
+ dashboard: Pick<TDashboard, 'defaultInputValues' | 'defaultFilterValues'>;
30
+ input: NormalizedDashboardInput;
31
+ runtimeValues?: DashboardInputValues;
32
+ sheetId: string | null | undefined;
33
+ calendar: CalendarContext | null;
34
+ }): boolean;
21
35
  export declare function hydrateAuthoredDashboardInputSlot(params: {
22
- dashboard: Pick<TDashboard, 'defaultInputValues'>;
36
+ /**
37
+ * Saved defaults come from the filter model (SPEC 5.2), so a toolbar
38
+ * filter's `defaultFilterValues` entry counts. A caller with only stored
39
+ * slot defaults may pass just those.
40
+ */
41
+ dashboard: Pick<TDashboard, 'defaultInputValues' | 'defaultFilterValues'>;
23
42
  input: NormalizedDashboardInput;
24
43
  runtimeValues?: DashboardInputValues;
25
44
  target: DashboardInputRuntimeTarget;
@@ -46,3 +65,18 @@ export declare function createFilterDashboardInputSlot(filterValue: TFilterValue
46
65
  export declare function createControlDashboardInputSlot(value: unknown): DashboardInputSlot | undefined;
47
66
  export declare function cloneDashboardInputValues(values: DashboardInputValues | undefined): DashboardInputValues;
48
67
  export declare function compactDashboardInputValues(values: DashboardInputValues): DashboardInputValues;
68
+ /**
69
+ * `over`'s slots win; a slot it does not have keeps `base`'s. A slot of `over`
70
+ * that holds only a comparison choice keeps `base`'s value under it, as the
71
+ * old filter value list and the comparison slot stayed apart. `base` itself
72
+ * when `over` is empty.
73
+ */
74
+ export declare function overlayDashboardInputValues(base: DashboardInputValues, over: DashboardInputValues): DashboardInputValues;
75
+ /** The values without any slot of these inputs, on every target. `values` itself when none is held. */
76
+ export declare function removeDashboardInputSlotsById(values: DashboardInputValues, inputIds: ReadonlySet<string>): DashboardInputValues;
77
+ /**
78
+ * The saved defaults the runtime reads (SPEC 5.2): the filter model's, which
79
+ * hold owned `defaultFilterValues` entries as slots. With no such entry they
80
+ * are the stored slots, read without building the model.
81
+ */
82
+ export declare function savedDefaultInputValues(dashboard: Pick<TDashboard, 'defaultInputValues' | 'defaultFilterValues'>): DashboardInputValues | undefined;
@@ -0,0 +1,199 @@
1
+ import { TFilter, TFilterValue } from '../../components/surfboard/filter/types.js';
2
+ import { DashboardInput, DashboardInputScope, DashboardInputValues, EmbeddedFilterDashboardInput, TDashboard } from '../types/common-types.js';
3
+ import { GlobalDateComparisonSelection } from '../../shared/analytics-protocol/index.js';
4
+ import { CalendarContext } from '../../shared/report-runtime-context/index.js';
5
+ import { DashboardFilterMappingContractIssue, DashboardFilterOptionDependencies, DashboardFilterOptionPopulation, DashboardFilterOptionSource } from '../../shared/dashboard-authoring/index.js';
6
+ import { FilterRef } from '../../shared/dashboard-authoring/filter-model/index.js';
7
+ import { DataSource, Field } from '../types/explorer-types.js';
8
+ import { DashboardFilterMappingDraft, DashboardFilterMappingIssue } from './dashboard-filter-mapping-authoring.js';
9
+ import { DashboardInputRuntimeTarget } from './dashboard-input-values.js';
10
+ import { DefaultsCalendar } from '../utils/filter-default-value-utils.js';
11
+ /**
12
+ * Filter settings (one filter model M4, SPEC 4.5): every settings write of a
13
+ * filter input, in one transaction. `applyFilterSettingsChange` is the pure
14
+ * core (the next dashboard, with saved defaults, and the runtime value
15
+ * effects); the store's `saveFilterSettings` applies both in one write with
16
+ * `applyFilterValueEffects`. Every filter is an input that holds its own
17
+ * definition (Phase 5), so there is one storage row: the input and its slots.
18
+ */
19
+ /** Every authorable setting. `undefined` = unchanged; `null` = remove. */
20
+ export type FilterSettingsChange = {
21
+ /** Column, title, operator, defaults, presentation fields. Reach fields in it are ignored. */
22
+ definition?: TFilter;
23
+ label?: string;
24
+ variableName?: string;
25
+ forceSelection?: boolean;
26
+ requiredAtExecution?: boolean;
27
+ scope?: DashboardInputScope;
28
+ optionSource?: DashboardFilterOptionSource | null;
29
+ optionDependencies?: DashboardFilterOptionDependencies | null;
30
+ optionPopulation?: DashboardFilterOptionPopulation | null;
31
+ /** Save a draft's acceptance, or remove the mapping. */
32
+ mapping?: {
33
+ kind: 'save';
34
+ draft: DashboardFilterMappingDraft;
35
+ } | {
36
+ kind: 'remove';
37
+ };
38
+ /** Value effects the author asked for, at one runtime target. */
39
+ values?: {
40
+ /** The default this target loads changed; its runtime slot resets to the default. */
41
+ defaultChanged?: boolean;
42
+ /** Global Date and date filters: the saved comparison selection (`null` removes it). */
43
+ defaultComparisonSelection?: GlobalDateComparisonSelection | null;
44
+ /** The option value field changed; stored selections no longer mean the same values. */
45
+ selectionIdentityChanged?: boolean;
46
+ target: DashboardInputRuntimeTarget;
47
+ };
48
+ };
49
+ export type FilterSettingsIssue = DashboardFilterMappingIssue | {
50
+ code: 'invalidSettings';
51
+ message: string;
52
+ ref: FilterRef;
53
+ inputId?: string;
54
+ contractIssue?: DashboardFilterMappingContractIssue;
55
+ };
56
+ export type FilterValueEffect = {
57
+ kind: 'resetToDefault';
58
+ inputId: string;
59
+ target: DashboardInputRuntimeTarget;
60
+ filterValue?: TFilterValue;
61
+ } | {
62
+ kind: 'clear';
63
+ inputId: string;
64
+ target: DashboardInputRuntimeTarget;
65
+ } | {
66
+ kind: 'setDefaultComparison';
67
+ inputId: string;
68
+ target: DashboardInputRuntimeTarget;
69
+ }
70
+ /** A scope change: drop the live slot of a target the input no longer reaches. */
71
+ | {
72
+ kind: 'dropTargetSlot';
73
+ inputId: string;
74
+ target: DashboardInputRuntimeTarget;
75
+ };
76
+ export type FilterSettingsChangeResult = {
77
+ ok: true;
78
+ dashboard: TDashboard;
79
+ inputId: string;
80
+ valueEffects: FilterValueEffect[];
81
+ } | {
82
+ ok: false;
83
+ issues: FilterSettingsIssue[];
84
+ };
85
+ export type FilterSettingsSaveResult = {
86
+ ok: true;
87
+ inputId: string;
88
+ } | {
89
+ ok: false;
90
+ issues: FilterSettingsIssue[];
91
+ };
92
+ export type FilterSettingsContext = {
93
+ /** The report calendar defaults resolve in; null only before the report context loads. */
94
+ calendar: CalendarContext | null;
95
+ };
96
+ /** The effective forceSelection for a filter (moved unchanged from the authoring policy). */
97
+ export declare function resolveFilterInputForceSelection(requested: boolean | undefined, filter: TFilter | undefined, timezone?: string): true | undefined;
98
+ /**
99
+ * A new filter from a catalog field (SPEC 4.5): one shared value for every
100
+ * target it reaches (OF-D18), its placement derived from the definition
101
+ * (S-7), and a variable name unique against the existing inputs.
102
+ */
103
+ export declare function buildFilterInputFromField(params: {
104
+ field: Field;
105
+ dataSource?: DataSource | null;
106
+ connectionId?: string;
107
+ connectionType?: string;
108
+ scope: DashboardInputScope;
109
+ existingInputs: readonly DashboardInput[];
110
+ createId?: () => string;
111
+ }): EmbeddedFilterDashboardInput;
112
+ /**
113
+ * A new filter input holding this definition (one filter model Phase 5):
114
+ * every new filter, from a catalog field or the toolbar's field picker, or
115
+ * the Global Date. One shared value for every target it reaches (OF-D18), its
116
+ * placement derived from the definition (S-7), a variable name unique against
117
+ * the existing inputs, and no reach fields (reach is the scope).
118
+ */
119
+ export declare function buildFilterInputFromDefinition(params: {
120
+ filter: TFilter;
121
+ label?: string;
122
+ scope: DashboardInputScope;
123
+ existingInputs: readonly DashboardInput[];
124
+ createId?: () => string;
125
+ }): EmbeddedFilterDashboardInput;
126
+ /** The pure core (SPEC 4.5). Never partially applies. */
127
+ export declare function applyFilterSettingsChange(dashboard: TDashboard, ref: FilterRef, change: FilterSettingsChange, context?: FilterSettingsContext): FilterSettingsChangeResult;
128
+ /**
129
+ * Applies the core's value effects to the store's input values, in the same
130
+ * write as the dashboard (SPEC 4.5 rule 4). `before` is the dashboard the
131
+ * change was made on.
132
+ */
133
+ export declare function applyFilterValueEffects(params: {
134
+ dashboardInputValues: DashboardInputValues;
135
+ effects: readonly FilterValueEffect[];
136
+ before: TDashboard;
137
+ after: TDashboard;
138
+ calendar: CalendarContext | null;
139
+ }): DashboardInputValues;
140
+ export type DashboardFilterStorageState = {
141
+ dashboardInputValues: DashboardInputValues;
142
+ defaultInputValues?: DashboardInputValues;
143
+ };
144
+ export type DashboardFilterAuthoringSettingsUpdate = {
145
+ forceSelection?: boolean;
146
+ /**
147
+ * The caller changed the default its target loads. Filter settings start
148
+ * from the target's saved default (`resolveAuthoredFilterDefaultFields`),
149
+ * which can differ from the definition for a scoped Input or an overlay
150
+ * entry, so they say so; callers that start from the definition leave it
151
+ * unset and the owner compares definitions. Also resets a saved slot that
152
+ * has no backing default.
153
+ */
154
+ defaultValueChanged?: boolean;
155
+ defaultComparisonChanged?: boolean;
156
+ defaultComparisonSelection?: GlobalDateComparisonSelection;
157
+ target?: DashboardInputRuntimeTarget;
158
+ optionSourceChanged?: boolean;
159
+ optionSource?: DashboardFilterOptionSource;
160
+ /** Authored option dependency policy edit; undefined value restores the
161
+ * dashboard default (omitted, meaning All applicable). */
162
+ optionDependenciesChanged?: boolean;
163
+ optionDependencies?: DashboardFilterOptionDependencies;
164
+ optionPopulationChanged?: boolean;
165
+ optionPopulation?: DashboardFilterOptionPopulation;
166
+ /** Raw selection identity changed; the previous runtime value is invalid. */
167
+ selectionIdentityChanged?: boolean;
168
+ };
169
+ /**
170
+ * Callers submit edits; the owner decides whether defaults must be reseeded.
171
+ * A default change (values, date window or mode) writes the target's saved
172
+ * default and live value; the definition, which the caller submits whole,
173
+ * holds the last authored default.
174
+ */
175
+ export declare function resolveFilterAuthoringSettings(previous: TFilter | undefined, filter: TFilter, settings: DashboardFilterAuthoringSettingsUpdate | undefined, target: DashboardInputRuntimeTarget, calendar?: DefaultsCalendar): {
176
+ target: DashboardInputRuntimeTarget;
177
+ defaultValueChanged: boolean;
178
+ defaultFilterValue: TFilterValue | undefined;
179
+ forceSelection?: boolean;
180
+ defaultComparisonChanged?: boolean;
181
+ defaultComparisonSelection?: GlobalDateComparisonSelection;
182
+ optionSourceChanged?: boolean;
183
+ optionSource?: DashboardFilterOptionSource;
184
+ optionDependenciesChanged?: boolean;
185
+ optionDependencies?: DashboardFilterOptionDependencies;
186
+ optionPopulationChanged?: boolean;
187
+ optionPopulation?: DashboardFilterOptionPopulation;
188
+ selectionIdentityChanged?: boolean;
189
+ };
190
+ /**
191
+ * Applies Basic-tab default edits to the same storage transaction that changes
192
+ * mapped participation. This keeps the authoritative filter, mapped input, and
193
+ * its runtime/default slots from becoming observable in mixed states.
194
+ */
195
+ export declare function applyFilterAuthoringSettingsToStorage(params: {
196
+ state: DashboardFilterStorageState;
197
+ input: Pick<DashboardInput, 'id' | 'runtimeScope'>;
198
+ settings?: ReturnType<typeof resolveFilterAuthoringSettings>;
199
+ }): DashboardFilterStorageState;
@@ -3,12 +3,17 @@ import { CardViewStateMap } from '../dashboard-view-state/index.js';
3
3
  import { TFilterValue } from '../../components/surfboard/filter/types.js';
4
4
  import { DashboardInputValues, NormalizedDashboardInput, ResolvedDashboardInput, ResolvedDashboardInputContext, TCard, TDashboard } from '../types/common-types.js';
5
5
  import { DashboardInputRuntimeTarget } from './dashboard-input-values.js';
6
- import { doesDashboardInputApplyToTarget } from './dashboard-input-scope.js';
6
+ import { doesDashboardInputApplyToTarget } from '../../shared/dashboard-authoring/dashboard-input-scope.js';
7
7
  import { TransientInputContext } from './transient-input-context.js';
8
8
  export { doesDashboardInputApplyToTarget };
9
9
  export type DashboardInputRuntimeValues = {
10
10
  dashboardInputValues?: DashboardInputValues;
11
- filterValues?: TFilterValue[];
11
+ /**
12
+ * Runtime-only values no filter defines (chart clicks, summary chips; one
13
+ * filter model SPEC 5.8). Input resolution never reads them; authored filter
14
+ * values are slots.
15
+ */
16
+ adHocFilterValues?: TFilterValue[];
12
17
  controlValues?: Record<string, unknown>;
13
18
  inlineFilterValuesMap?: Record<string, TFilterValue[] | undefined>;
14
19
  cardControlValuesMap?: Record<string, Record<string, unknown>>;
@@ -1,6 +1,6 @@
1
1
  import { SelectionField, SelectionInputValue } from '../../shared/analytics-protocol/selection-contract.js';
2
2
  import { DashboardFilterTarget } from '../../shared/dashboard-authoring/index.js';
3
- import { ScopedDashboardInputTarget } from './dashboard-input-scope.js';
3
+ import { ScopedDashboardInputTarget } from '../../shared/dashboard-authoring/dashboard-input-scope.js';
4
4
  import { NormalizedFilterDashboardInput, SelectionDashboardInput, TCard } from '../types/common-types.js';
5
5
  import { FilterCondition } from '../types/explorer-types.js';
6
6
  export type SelectionSkipReason =
@@ -0,0 +1,40 @@
1
+ import { TFilterValue } from '../../components/surfboard/filter/types.js';
2
+ import { DashboardInputExecutionSnapshot, TDashboard } from '../types/common-types.js';
3
+ import { CalendarContext } from '../../shared/report-runtime-context/index.js';
4
+ import { CardViewStateMap } from '../dashboard-view-state/index.js';
5
+ import { TransientInputContext } from '../dashboard-inputs/transient-input-context.js';
6
+ import { ViewerStoreInputValues } from './compatibility-input-storage.js';
7
+ /** The values a card runs with: the store's input values and its view state. */
8
+ export type CardRuntimeValues = ViewerStoreInputValues & {
9
+ cardViewState: CardViewStateMap;
10
+ };
11
+ /** The stored values one capture opens with (a print view state, a Briefing attachment's settings). */
12
+ export type StoredCaptureValues = {
13
+ filterValues?: readonly TFilterValue[];
14
+ controlValues?: Readonly<Record<string, unknown>>;
15
+ /** Already selected by the caller: for a dashboard PDF, the tab's snapshot from `resolvePrintInputs`. */
16
+ dashboardInputExecutionSnapshot?: DashboardInputExecutionSnapshot;
17
+ };
18
+ /**
19
+ * How a stored capture opens (one filter model SPEC 5.9): a print render, a
20
+ * scheduled card attachment on the server, and, with an empty capture, a
21
+ * fresh viewer (MCP `fromCard`). In order:
22
+ * 1. saved defaults, through hydration (SPEC 5.2);
23
+ * 2. the capture's filter value list as a host overlay (`hostFilterValuesToSlots`);
24
+ * 3. the capture's slot snapshot, replayed exactly (`completeDashboardInputReplacementValues`);
25
+ * 4. the snapshot's drill paths and carried contexts.
26
+ * A listed value whose `filterId` owns no input is an ad-hoc value (SPEC 5.8).
27
+ * The capture crossed storage, so it is read defensively, as before. Control
28
+ * values pass through as overrides; the caller applies the control contract
29
+ * to the dashboard first. Pure and server-safe: the server's
30
+ * `buildSavedCardRequest` calls it.
31
+ */
32
+ export declare function resolveCapturedRuntimeValues(input: {
33
+ dashboard: TDashboard;
34
+ capture: StoredCaptureValues;
35
+ calendar: CalendarContext | undefined;
36
+ }): {
37
+ runtimeValues: CardRuntimeValues;
38
+ controlOverrides: Readonly<Record<string, unknown>> | undefined;
39
+ transientContexts?: readonly TransientInputContext[];
40
+ };
@@ -3,15 +3,17 @@ import { DashboardInputCompatibilityMetadata, DashboardInputValues, TDashboard }
3
3
  import { TFilterValue } from '../../components/surfboard/filter/types.js';
4
4
  /**
5
5
  * The bridge between bookmark slots and the storage compatibility inputs
6
- * still use (TECH-SPEC 12, ledger P2-08). Legacy dashboard filters, controls
7
- * and card inline filters keep their values in `filterValues`, control values
8
- * and inline filter values, where the filter bar, controls and queries read
9
- * them. Reading turns that storage into slots; writing turns a bookmark's
10
- * slots back into it. When those inputs keep their values in slots, this
11
- * file is deleted.
6
+ * still use (TECH-SPEC 12, ledger P2-08). Controls and card inline filters
7
+ * keep their values in control values and inline filter values, where the
8
+ * controls and queries read them. Reading turns that storage into slots;
9
+ * writing turns a bookmark's slots back into it. Every dashboard filter keeps
10
+ * its value in a slot (one filter model Phase 4a), so its slots pass through.
11
+ * When controls and inline filters keep their values in slots, this file is
12
+ * deleted.
12
13
  */
13
14
  export type ViewerRuntimeInputs = {
14
- readonly filterValues: readonly TFilterValue[];
15
+ /** Runtime-only values no filter defines (one filter model SPEC 5.8). */
16
+ readonly adHocFilterValues: readonly TFilterValue[];
15
17
  readonly controlOverrides: Readonly<Record<string, unknown>> | undefined;
16
18
  readonly dashboardInputValues: DashboardInputValues;
17
19
  /** Absent: the cards' inline filter defaults. */
@@ -19,7 +21,7 @@ export type ViewerRuntimeInputs = {
19
21
  };
20
22
  /** The input values the dashboard store holds, which cards run with. */
21
23
  export type ViewerStoreInputValues = {
22
- filterValues: TFilterValue[];
24
+ adHocFilterValues: TFilterValue[];
23
25
  controlValues: Record<string, unknown>;
24
26
  cardControlValuesMap: Record<string, Record<string, unknown>>;
25
27
  dashboardInputValues: DashboardInputValues;
@@ -49,23 +51,21 @@ export declare function materializeViewerInputs(dashboard: TDashboard, runtime:
49
51
  */
50
52
  export declare function materializeViewerRuntimeInputs(dashboard: TDashboard, runtimeValues: Parameters<typeof materializeRuntimeInputs>[1], calendar: CalendarContext | undefined): DashboardInputValues;
51
53
  declare function materializeRuntimeInputs(dashboard: TDashboard, runtimeValues: {
52
- filterValues?: TFilterValue[];
54
+ adHocFilterValues?: TFilterValue[];
53
55
  controlValues?: Record<string, unknown>;
54
56
  cardControlValuesMap?: Record<string, Record<string, unknown>>;
55
57
  dashboardInputValues?: DashboardInputValues;
56
58
  inlineFilterValuesMap?: Record<string, TFilterValue[] | undefined>;
57
59
  }, calendar: CalendarContext | undefined): DashboardInputValues;
58
60
  /**
59
- * A bookmark's slots, split by where each value lives. Authored inputs and
60
- * click selections are runtime slots. Inputs synthesized from legacy dashboard
61
- * filters, controls and card inline filters keep their values where the
62
- * filter bar, controls and queries read them: `filterValues`, control values
63
- * and inline filter values. A comparison choice stays a runtime aspect slot.
61
+ * A bookmark's slots, split by where each value lives. Filter inputs (every
62
+ * dashboard filter included) and click selections are runtime slots.
63
+ * Controls and card inline filters keep their values where the controls and
64
+ * queries read them: control values and inline filter values. A comparison
65
+ * choice stays a runtime aspect slot.
64
66
  */
65
67
  export type BookmarkInputs = {
66
68
  readonly runtime: DashboardInputValues;
67
- /** filterId -> value, or `null` for a default the viewer removed. */
68
- readonly filterValues: ReadonlyMap<string, TFilterValue | null>;
69
69
  readonly controlValues: Readonly<Record<string, unknown>>;
70
70
  /** cardId -> filterId -> value, or `null` for a removed default. */
71
71
  readonly inlineFilterValues: ReadonlyMap<string, ReadonlyMap<string, TFilterValue | null>>;