react-semaphor 0.1.561 → 0.1.562

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 (138) hide show
  1. package/dist/analytics-protocol/index.js +452 -429
  2. package/dist/assistant-context/index.js +1 -1
  3. package/dist/assistant-protocol/index.js +5 -5
  4. package/dist/brand-studio/index.js +9 -9
  5. package/dist/briefings/index.js +5 -5
  6. package/dist/chunks/{analytics-base-schemas-CB3oFAXk.js → analytics-base-schemas-BaIQrEzX.js} +139 -134
  7. package/dist/chunks/{assistant-chat-DiVHY3Hw.js → assistant-chat-R_yT8xH4.js} +104 -104
  8. package/dist/chunks/{bookmark-impact-CR09dpkn.js → bookmark-impact-D4Kl4amw.js} +2 -2
  9. package/dist/chunks/{bookmark-state-BusLpkb7.js → bookmark-state-CWeoGbrx.js} +25 -25
  10. package/dist/chunks/{braces-u8VorWJc.js → braces-DzgoQC64.js} +1 -1
  11. package/dist/chunks/{comparison-window-caption-DDsIWJYT.js → comparison-window-caption-D1EUXzaR.js} +562 -437
  12. package/dist/chunks/{context-TUjw9eqr.js → context-R31TSL5V.js} +1 -1
  13. package/dist/chunks/{dashboard-BRdZBPqr.js → dashboard-Bp1y5oun.js} +1 -1
  14. package/dist/chunks/{dashboard-briefing-launcher-CgvTLndW.js → dashboard-briefing-launcher-S5FB3aUW.js} +155 -154
  15. package/dist/chunks/{dashboard-controls-B4vfSzTF.js → dashboard-controls-CfC_6Ztn.js} +970 -968
  16. package/dist/chunks/{dashboard-json-Y3MF59g7.js → dashboard-json-gYZT7ZQY.js} +5 -5
  17. package/dist/chunks/dates-DFY7Gfss.js +91 -0
  18. package/dist/chunks/{edit-dashboard-visual-DwjZcxj-.js → edit-dashboard-visual-u7OI_g8Q.js} +4636 -4681
  19. package/dist/chunks/{filter-reach-copy-bijwf_-b.js → filter-reach-copy-CvV7W5dd.js} +1470 -1101
  20. package/dist/chunks/{filter-value-text-DFnhwuEW.js → filter-value-text-CPwFkrMz.js} +11 -10
  21. package/dist/chunks/{global-date-filter-utils-BXgCpvQM.js → global-date-filter-utils-N1kcsOFE.js} +8997 -7417
  22. package/dist/chunks/{index-ClwbY3BL.js → index-CNGkfUp4.js} +91 -85
  23. package/dist/chunks/{layout-grid-CtvCBfOm.js → layout-grid-BM65viQh.js} +1 -1
  24. package/dist/chunks/{list-filter-BklYgciR.js → list-filter-BoeLBfL3.js} +1 -1
  25. package/dist/chunks/{matrix-analytical-definition-pU51-JmY.js → matrix-analytical-definition-hEucouWM.js} +4 -4
  26. package/dist/chunks/{matrix-card-CUorIB7Q.js → matrix-card-CCh9JjP1.js} +3 -3
  27. package/dist/chunks/{matrix-member-presentation-Df5UgCGN.js → matrix-member-presentation-DsAUbuoL.js} +1 -1
  28. package/dist/chunks/{matrix-operation-contract-BSiGEXVC.js → matrix-operation-contract-DsLdFdSa.js} +339 -330
  29. package/dist/chunks/{metric-comparison-95aC0uEO.js → metric-comparison-Bnso1cm1.js} +2 -2
  30. package/dist/chunks/{model-change-B5wQhg5G.js → model-change-T1cRkh3m.js} +1 -1
  31. package/dist/chunks/{palette-DTnMhipt.js → palette-p1XSJFgB.js} +1 -1
  32. package/dist/chunks/{pivot-result-contract-expectations-Bo-86vwS.js → pivot-result-contract-expectations-B53jqszr.js} +5 -5
  33. package/dist/chunks/{pivot-result-identity-olvXJoB9.js → pivot-result-identity-Dq5jm-EC.js} +1 -1
  34. package/dist/chunks/{zoned-wall-clock-CGLVI40Q.js → raw-temporal-value-Bqz8wc7L.js} +97 -46
  35. package/dist/chunks/{report-preferences-dialog-C2YUIwKG.js → report-preferences-dialog-C4RAR8u5.js} +68 -63
  36. package/dist/chunks/{report-runtime-context-DoIUr3MP.js → report-runtime-context-BITkNSDa.js} +2 -2
  37. package/dist/chunks/{resolve-dashboard-input-context-q_iiNXE1.js → resolve-dashboard-input-context-DaDrZGuA.js} +3455 -1744
  38. package/dist/chunks/{save-DH4RyrnG.js → save-CHV1B1fL.js} +1 -1
  39. package/dist/chunks/{saved-dashboard-context-8jqfI7hI.js → saved-dashboard-context-DFYBrE6O.js} +94 -95
  40. package/dist/chunks/{selection-filter-compiler-BKXmyLrS.js → selection-filter-compiler-CUDRnUxc.js} +19 -18
  41. package/dist/chunks/{selection-reducer-CV7K4FI6.js → selection-reducer-Bz5aywT4.js} +1 -1
  42. package/dist/chunks/{semaphor-ready-indicator-E2XWyibu.js → semaphor-ready-indicator-Cfuafnem.js} +37067 -38400
  43. package/dist/chunks/{shelf-drop-preview-context-C29EUzDp.js → shelf-drop-preview-context-BR2GEYog.js} +81 -82
  44. package/dist/chunks/{source-entity-resolution-BXI3nQ5Z.js → source-entity-resolution-DdDVXFB8.js} +6 -6
  45. package/dist/chunks/{switch-balDSHc7.js → switch-BW4yXSYs.js} +3 -3
  46. package/dist/chunks/{table-export-sheet-CK8tvh4d.js → table-export-sheet-bSXxGn-v.js} +1 -1
  47. package/dist/chunks/{temporal-input-presentation-B77JsAzU.js → temporal-input-presentation-sk9gqLi6.js} +699 -741
  48. package/dist/chunks/{token-types-DhYH5YKb.js → token-types-BUK06hU2.js} +1 -1
  49. package/dist/chunks/{upload-Ufj8vjyn.js → upload-BnmuyPqW.js} +1 -1
  50. package/dist/chunks/{use-create-flow-overlay-state-9WsnzEO5.js → use-create-flow-overlay-state-DyzhWvRJ.js} +6 -6
  51. package/dist/chunks/{validators-BtaCFIEB.js → validators-BIM0FE31.js} +764 -885
  52. package/dist/dashboard/index.js +2 -2
  53. package/dist/dashboard-authoring/index.js +2278 -3030
  54. package/dist/data-app-sdk/index.js +43 -43
  55. package/dist/data-app-sdk-adapters/index.js +3 -3
  56. package/dist/data-app-sdk-validation/index.js +22 -22
  57. package/dist/format-utils/index.js +215 -209
  58. package/dist/index.js +225 -224
  59. package/dist/report-runtime-context/index.js +2 -2
  60. package/dist/style.css +1 -1
  61. package/dist/surfboard/index.js +2 -2
  62. package/dist/types/briefings/attachment-outcomes.d.ts +1 -1
  63. package/dist/types/components/dashboard/dashboard-create-dialog.d.ts +23 -0
  64. package/dist/types/components/index.d.ts +1 -2
  65. package/dist/types/components/surfboard/filter/types.d.ts +3 -1
  66. package/dist/types/index.js +5 -5
  67. package/dist/types/lib/formatters/raw-temporal-presentation.d.ts +59 -2
  68. package/dist/types/lib/interactions/get-click-context-from-matrix.d.ts +5 -0
  69. package/dist/types/lib/interactions/get-click-context-from-table.d.ts +45 -0
  70. package/dist/types/lib/print/print-inputs.d.ts +2 -1
  71. package/dist/types/lib/query-context/assemble-card-query.d.ts +2 -0
  72. package/dist/types/lib/query-context/build-dashboard-execution-snapshot.d.ts +5 -0
  73. package/dist/types/lib/selection/selection-from-click-context.d.ts +41 -0
  74. package/dist/types/lib/types/common-types.d.ts +6 -0
  75. package/dist/types/lib/types/explorer-types.d.ts +7 -1
  76. package/dist/types/lib/types/interaction-types.d.ts +3 -1
  77. package/dist/types/lib/types/token-types.d.ts +0 -1
  78. package/dist/types/shared/analytics-protocol/analytics-base-schemas.d.ts +3 -1
  79. package/dist/types/shared/analytics-protocol/contracts.d.ts +9 -40
  80. package/dist/types/shared/analytics-protocol/selection-contract.d.ts +12 -2
  81. package/dist/types/shared/analytics-protocol/validators.d.ts +1 -2
  82. package/dist/types/shared/assistant-protocol/context.d.ts +8 -8
  83. package/dist/types/shared/dashboard-authoring/card-formats/sql-date-pattern.d.ts +7 -1
  84. package/dist/types/shared/dashboard-authoring/card-settings/card-display-write.d.ts +24 -0
  85. package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +1 -1
  86. package/dist/types/shared/dashboard-authoring/card-settings/column-polarity-write.d.ts +5 -0
  87. package/dist/types/shared/dashboard-authoring/card-settings/index.d.ts +4 -2
  88. package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +15 -0
  89. package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +12 -1
  90. package/dist/types/shared/dashboard-authoring/card-settings/views.d.ts +5 -3
  91. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +3230 -4658
  92. package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +24 -2
  93. package/dist/types/shared/dashboard-authoring/changes/field-ref.d.ts +91 -0
  94. package/dist/types/shared/dashboard-authoring/changes/read-card-query.d.ts +7 -0
  95. package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-changes.d.ts +27 -1
  96. package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-create.d.ts +26 -0
  97. package/dist/types/shared/dashboard-authoring/click-to-filter-settings.d.ts +2 -1
  98. package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +10 -10
  99. package/dist/types/shared/dashboard-authoring/detail-date-presentation.d.ts +9 -0
  100. package/dist/types/shared/dashboard-authoring/index.d.ts +8 -6
  101. package/dist/types/shared/dashboard-authoring/measure-calculations/apply.d.ts +8 -0
  102. package/dist/types/shared/dashboard-authoring/measure-calculations/comparison.d.ts +16 -0
  103. package/dist/types/shared/dashboard-authoring/measure-calculations/dates.d.ts +41 -0
  104. package/dist/types/shared/dashboard-authoring/measure-calculations/index.d.ts +17 -0
  105. package/dist/types/shared/dashboard-authoring/measure-calculations/options.d.ts +63 -0
  106. package/dist/types/shared/dashboard-authoring/measure-calculations/read.d.ts +16 -0
  107. package/dist/types/shared/dashboard-authoring/measure-calculations/resolve.d.ts +79 -0
  108. package/dist/types/shared/dashboard-authoring/measure-calculations/schemas.d.ts +934 -0
  109. package/dist/types/shared/dashboard-authoring/measure-calculations/sentences.d.ts +4 -0
  110. package/dist/types/shared/dashboard-authoring/measure-calculations/set.d.ts +11 -0
  111. package/dist/types/shared/dashboard-authoring/measure-calculations/transform.d.ts +63 -0
  112. package/dist/types/shared/dashboard-authoring/measure-calculations/window-transforms.d.ts +60 -0
  113. package/dist/types/shared/dashboard-authoring/new-card.d.ts +12 -1
  114. package/dist/types/shared/dashboard-authoring/operations/apply-dashboard-operations.d.ts +2 -1
  115. package/dist/types/shared/dashboard-authoring/operations/operation-sentences.d.ts +46 -0
  116. package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +52 -2
  117. package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +13 -1
  118. package/dist/types/shared/dashboard-authoring/text-card-words/blocks.d.ts +58 -0
  119. package/dist/types/shared/dashboard-authoring/text-card-words/index.d.ts +55 -0
  120. package/dist/types/shared/dashboard-authoring/text-card-words/rich-content.d.ts +18 -0
  121. package/dist/types/shared/format-utils/document-print.d.ts +82 -0
  122. package/dist/types/shared/format-utils/index.d.ts +1 -0
  123. package/dist/types/shared/format-utils/raw-temporal.d.ts +2 -7
  124. package/dist/types/shared/temporal/index.d.ts +1 -0
  125. package/dist/types/shared/temporal/raw-temporal-equality.d.ts +19 -0
  126. package/dist/types/shared/temporal/raw-temporal-value.d.ts +29 -0
  127. package/dist/types/shared/temporal/zoned-wall-clock.d.ts +6 -0
  128. package/package.json +1 -1
  129. package/dist/chunks/custom-visual-inputs-DfolidZ9.js +0 -292
  130. package/dist/chunks/document-dashboard-inputs-CvBbFTUA.js +0 -1718
  131. package/dist/types/components/dashboard/ai-dashboard-create-dialog.d.ts +0 -38
  132. package/dist/types/components/dashboard/dashboard-create-template.d.ts +0 -10
  133. package/dist/types/lib/hooks/use-dashboard-authoring.d.ts +0 -49
  134. package/dist/types/shared/dashboard-authoring/artifact-compiler.d.ts +0 -6
  135. package/dist/types/shared/dashboard-authoring/contracts.d.ts +0 -106
  136. package/dist/types/shared/dashboard-authoring/protocol-adapter.d.ts +0 -7
  137. package/dist/types/shared/dashboard-authoring/source-matching.d.ts +0 -34
  138. package/dist/types/shared/dashboard-authoring/validators.d.ts +0 -2
@@ -0,0 +1,4 @@
1
+ import { TCard } from '../../../lib/types/common-types.js';
2
+ import { SentenceClause } from '../operations/operation-sentences.js';
3
+ import { MeasureCalculationsUpdate } from './resolve.js';
4
+ export declare function describeMeasureCalculations(before: TCard, update: MeasureCalculationsUpdate): SentenceClause[];
@@ -0,0 +1,11 @@
1
+ import { TCard } from '../../../lib/types/common-types.js';
2
+ import { ChangeDiagnostic } from '../changes/diagnostics.js';
3
+ import { MeasureCalculationContext, StatedMeasureCalculations } from './resolve.js';
4
+ export declare function setMeasureCalculations(card: TCard, stated: readonly StatedMeasureCalculations[], context: MeasureCalculationContext): {
5
+ ok: true;
6
+ card: TCard;
7
+ warnings: ChangeDiagnostic[];
8
+ } | {
9
+ ok: false;
10
+ problems: ChangeDiagnostic[];
11
+ };
@@ -0,0 +1,63 @@
1
+ import { TCard } from '../../../lib/types/common-types.js';
2
+ import { CardConfig, GroupByField, WindowTransform } from '../../../lib/types/explorer-types.js';
3
+ import { FieldRef } from '../changes/dashboard-change.js';
4
+ import { ColumnKey } from '../changes/card-query-part.js';
5
+ import { MeasureTransform } from './schemas.js';
6
+ import { ResolvedMetricWindowTransform } from './window-transforms.js';
7
+ /** A WindowTransform whose groupings are named by key, not id (SPEC §4). */
8
+ export type KeyedWindowTransform = Omit<WindowTransform, 'orderBy' | 'partitionByFieldIds'> & {
9
+ orderBy?: {
10
+ grouping: ColumnKey;
11
+ direction: 'asc' | 'desc';
12
+ };
13
+ partitionBy: ColumnKey[];
14
+ };
15
+ /** The kinds that run along an order (all but a percent of total). */
16
+ export declare const ORDERED_KINDS: ReadonlySet<MeasureTransform['kind']>;
17
+ /**
18
+ * The stored form for public words, groupings already matched to keys: the
19
+ * order (a percent of total has none) and the partitions (omitted: every
20
+ * grouping other than the order; a percent of the grand total: none).
21
+ */
22
+ export declare function toKeyedTransform(transform: MeasureTransform, groupings: {
23
+ order: ColumnKey | undefined;
24
+ resetBy: ColumnKey[] | undefined;
25
+ all: readonly ColumnKey[];
26
+ }): KeyedWindowTransform;
27
+ /** A keyed transform with the card's grouping ids filled in; undefined when a named grouping isn't on the card. */
28
+ export declare function toStoredTransform(keyed: KeyedWindowTransform, groupings: readonly GroupByField[]): WindowTransform | undefined;
29
+ /** The server's resolution of a measure's transform on a card, or undefined when it can't be resolved. */
30
+ export declare function resolveMeasureTransform(config: CardConfig, cardType: string, metricId: string): ResolvedMetricWindowTransform | undefined;
31
+ /**
32
+ * Whether a stated transform means what a measure stores (S-7): both resolved
33
+ * by the server's check on the card, equal but for the measure id.
34
+ */
35
+ export declare function sameTransform(card: TCard, metricIndex: number, stated: WindowTransform | undefined): boolean;
36
+ /**
37
+ * A stored table calculation as its controls hold it: the public words, the
38
+ * grouping it runs along and the ones it starts over for by id, and its
39
+ * direction even when its order grouping is gone.
40
+ */
41
+ export type StoredTransformRead = {
42
+ transform: MeasureTransform;
43
+ /** The id of the grouping it runs along, when that grouping is on the card. */
44
+ order?: string;
45
+ direction?: 'asc' | 'desc';
46
+ /** The ids of the groupings it starts over for, those still on the card; absent when it takes the default. */
47
+ resetBy?: string[];
48
+ };
49
+ /**
50
+ * The one reading of a stored table calculation, total (ledger P3-12): the
51
+ * server's resolution where the calculation runs (every default filled in),
52
+ * else the stored fields as they are, so a calculation a shelf change broke
53
+ * keeps its settings while it is repaired. Groupings no longer on the card are
54
+ * left out. Undefined only without a calculation, or with a function the
55
+ * server doesn't know.
56
+ */
57
+ export declare function readTransform(card: TCard, metricId: string, groupingRef: (grouping: GroupByField) => FieldRef): StoredTransformRead | undefined;
58
+ /**
59
+ * The public words for a stored transform, every field present (SPEC "How the
60
+ * outline reads them"): `readTransform` where the server's check resolves it;
61
+ * undefined where it can't, so the card stays not editable through the MCP.
62
+ */
63
+ export declare function readStoredTransform(card: TCard, metricId: string, groupingRef: (grouping: GroupByField) => FieldRef): MeasureTransform | undefined;
@@ -0,0 +1,60 @@
1
+ import { CardConfig, WindowFunction } from '../../../lib/types/explorer-types.js';
2
+ export declare const WINDOW_ERROR_CODES: {
3
+ readonly INVALID_WINDOW_TRANSFORM: "INVALID_WINDOW_TRANSFORM";
4
+ readonly WINDOW_REQUIRES_GROUP_BY: "WINDOW_REQUIRES_GROUP_BY";
5
+ readonly WINDOW_ORDER_FIELD_INVALID: "WINDOW_ORDER_FIELD_INVALID";
6
+ readonly WINDOW_NUMERIC_METRIC_REQUIRED: "WINDOW_NUMERIC_METRIC_REQUIRED";
7
+ readonly WINDOW_COMPARISON_CONFLICT: "WINDOW_COMPARISON_CONFLICT";
8
+ readonly WINDOW_UNSUPPORTED_CARD_TYPE: "WINDOW_UNSUPPORTED_CARD_TYPE";
9
+ };
10
+ export type WindowErrorCode = (typeof WINDOW_ERROR_CODES)[keyof typeof WINDOW_ERROR_CODES];
11
+ export declare const WINDOW_WARNING_CODES: {
12
+ readonly WINDOW_NON_DATE_ORDER: "WINDOW_NON_DATE_ORDER";
13
+ readonly WINDOW_DIRECTION_NORMALIZED_ASC: "WINDOW_DIRECTION_NORMALIZED_ASC";
14
+ };
15
+ export type WindowWarningCode = (typeof WINDOW_WARNING_CODES)[keyof typeof WINDOW_WARNING_CODES];
16
+ export interface WindowValidationError {
17
+ code: WindowErrorCode;
18
+ message: string;
19
+ metricId?: string;
20
+ }
21
+ interface ResolvedWindowTransformBase {
22
+ metricId: string;
23
+ function: WindowFunction;
24
+ partitionByFieldIds: string[];
25
+ }
26
+ export interface ResolvedRunningTotalTransform extends ResolvedWindowTransformBase {
27
+ function: 'running_total';
28
+ orderByFieldId: string;
29
+ orderByDirection: 'asc' | 'desc';
30
+ frame: 'unbounded_preceding';
31
+ }
32
+ export interface ResolvedMovingAverageTransform extends ResolvedWindowTransformBase {
33
+ function: 'moving_average';
34
+ orderByFieldId: string;
35
+ orderByDirection: 'asc' | 'desc';
36
+ windowSize: number;
37
+ minPeriods: number;
38
+ }
39
+ export interface ResolvedPreviousPeriodDeltaTransform extends ResolvedWindowTransformBase {
40
+ function: 'previous_period_delta';
41
+ orderByFieldId: string;
42
+ orderByDirection: 'asc' | 'desc';
43
+ mode: 'absolute' | 'percent';
44
+ }
45
+ export interface ResolvedPercentOfTotalTransform extends ResolvedWindowTransformBase {
46
+ function: 'percent_of_total';
47
+ scope: 'grand_total' | 'partition_total';
48
+ output: 'fraction' | 'percent';
49
+ }
50
+ export type ResolvedMetricWindowTransform = ResolvedRunningTotalTransform | ResolvedMovingAverageTransform | ResolvedPreviousPeriodDeltaTransform | ResolvedPercentOfTotalTransform;
51
+ export interface WindowValidationResult {
52
+ errors: WindowValidationError[];
53
+ warnings: WindowWarningCode[];
54
+ resolvedTransforms: ResolvedMetricWindowTransform[];
55
+ }
56
+ export declare function validateAndResolveWindowTransforms({ cardConfig, cardType, }: {
57
+ cardConfig: CardConfig;
58
+ cardType?: string;
59
+ }): WindowValidationResult;
60
+ export {};
@@ -1,4 +1,4 @@
1
- import { TCard } from '../../lib/types/common-types.js';
1
+ import { TCard, TextCardRichContent } from '../../lib/types/common-types.js';
2
2
  /**
3
3
  * The type a card starts as before anyone picks one: a table shows any mix of
4
4
  * fields, where a chart needs a specific shape (P4-11). Clear returns a card
@@ -8,3 +8,14 @@ export declare const NEW_CARD_TYPE = "table";
8
8
  export type NewCardInput = Pick<TCard, 'id' | 'title'> & Partial<Pick<TCard, 'description' | 'tabTitle' | 'connectionId' | 'dataSource' | 'preferences'>>;
9
9
  /** The one assembly of an empty card; callers pass their differences in. */
10
10
  export declare function createNewCard({ preferences, ...input }: NewCardInput): TCard;
11
+ /**
12
+ * A text card a change adds (building a report SPEC §3): its words as rich
13
+ * text and nothing else, so it never renders as dynamic text. A description
14
+ * is its subtitle when it shows in tabs.
15
+ */
16
+ export declare function createTextCard(input: {
17
+ id: string;
18
+ title: string;
19
+ description?: string;
20
+ richContent: TextCardRichContent;
21
+ }): TCard;
@@ -7,7 +7,8 @@ export type { CardUpdate, CreatedEntity, DashboardOperation, DashboardOperationR
7
7
  * saved document for these edits: the editor stores, the change resolver's
8
8
  * dry run and the server's apply all call it. It writes only the document; it
9
9
  * returns what it created, one plain sentence per change, and the runtime
10
- * effects a live editor applies to its own state (DE-D49). It never mints ids
10
+ * effects a live editor applies to its own state (DE-D49), and the existing
11
+ * cards it changed (`touched`, watch page P1-20). It never mints ids
11
12
  * and never reads the clock (S-INV-1).
12
13
  */
13
14
  export declare function applyDashboardOperations(dashboard: TDashboard, operations: readonly DashboardOperation[], context: OperationContext): DashboardOperationResult;
@@ -0,0 +1,46 @@
1
+ import { TCardPreferences } from '../../../lib/types/common-types.js';
2
+ /**
3
+ * The plain sentences the reducer returns for what it did (MCP dashboard
4
+ * editing SPEC 3.8). The reducer writes one clause per thing that changed;
5
+ * the clauses of one public change join into one sentence, in the order
6
+ * type, query, rename, description, columns, display, highlight, detached. Sentences never name the
7
+ * product.
8
+ */
9
+ export type ClauseKind = 'add' | 'remove' | 'type' | 'query' | 'calculation' | 'rename' | 'description' | 'columns' | 'display' | 'highlight' | 'dashboard' | 'sheet' | 'detached' | 'commit' | 'filter' | 'layout';
10
+ export type SentenceClause = {
11
+ kind: ClauseKind;
12
+ /** How the clause reads when it opens the sentence. */
13
+ lead: string;
14
+ /** How it reads after another clause of the same change. */
15
+ follow: string;
16
+ };
17
+ export declare function joinClauses(clauses: readonly SentenceClause[]): string;
18
+ export declare const quoted: (text: string | undefined) => string;
19
+ /** The short type name a new card's sentence carries: "(bar)", "(detail table)", "(KPI)". */
20
+ export declare function cardTypeShortName(chartType: string | undefined): string;
21
+ /** "x axis settings", "tooltip settings": a dropped chart preference as a person reads it. */
22
+ export declare function preferenceLabel(key: keyof TCardPreferences | string): string;
23
+ export declare function listPhrase(items: readonly string[]): string;
24
+ export declare const clauses: {
25
+ added(title: string | undefined, chartType: string, sheet: string, detail?: string, place?: string): SentenceClause;
26
+ /** Arrange (responsive layouts SPEC §6.5). */
27
+ arranged(sheet: string, keepOrder: boolean, empty: boolean): SentenceClause;
28
+ removed(title: string | undefined, sheet: string): SentenceClause;
29
+ renamed(previous: string | undefined, next: string): SentenceClause;
30
+ described(title: string | undefined, removed: boolean): SentenceClause;
31
+ retyped(title: string | undefined, chartType: string, dropped: readonly string[]): SentenceClause;
32
+ /** A column's label returned to the model's (card appearance CA-D5). */
33
+ labelReturned(title: string | undefined, from: string | undefined, to: string): SentenceClause;
34
+ /** Each relabelled column by the label it showed, so the person approving sees which one (card appearance CA-D13). */
35
+ relabeled(title: string | undefined, labels: ReadonlyArray<{
36
+ from: string | undefined;
37
+ to: string;
38
+ }>): SentenceClause;
39
+ queried(title: string | undefined, detail: string): SentenceClause;
40
+ /** Rules whose column a change removes (conditional formatting store CR-D5). */
41
+ droppedRules(title: string | undefined, names: readonly string[]): SentenceClause;
42
+ detached(title: string | undefined): SentenceClause;
43
+ detachedTile(): SentenceClause;
44
+ committed(title: string | undefined): SentenceClause;
45
+ plain(kind: ClauseKind, text: string): SentenceClause;
46
+ };
@@ -1,5 +1,6 @@
1
- import { EmbeddedFilterDashboardInput, TDashboard, TFrame } from '../../../lib/types/common-types.js';
1
+ import { EmbeddedFilterDashboardInput, TDashboard, TFrame, TextCardRichContent } from '../../../lib/types/common-types.js';
2
2
  import { ResolvedCardSettings } from '../card-settings/resolved.js';
3
+ import { MeasureCalculationsUpdate } from '../measure-calculations/resolve.js';
3
4
  import { FilterSettingsChange, FilterValueEffect } from '../../../lib/dashboard-inputs/filter-settings.js';
4
5
  import { DashboardFilterBoundCardApplication } from '../dashboard-filter-mapping-types.js';
5
6
  import { Field } from '../../../lib/types/explorer-types.js';
@@ -46,6 +47,21 @@ export type CardUpdate =
46
47
  | {
47
48
  kind: 'settings';
48
49
  settings: ResolvedCardSettings;
50
+ }
51
+ /** A measure's comparison and transform, resolved by the measure calculations owner (reports by conversation RC-D11, SPEC §4). */
52
+ | {
53
+ kind: 'calculations';
54
+ calculations: MeasureCalculationsUpdate;
55
+ }
56
+ /**
57
+ * A text card's words as rich text, resolved by the words owner (building a
58
+ * report SPEC §3): the older runs go, and the older words in `description`
59
+ * too when `clearsLegacy` (BR-D12).
60
+ */
61
+ | {
62
+ kind: 'text';
63
+ richContent: TextCardRichContent;
64
+ clearsLegacy: boolean;
49
65
  };
50
66
  /** Everything the editor's "Done", Save & Apply and Apply Local commit persists, as one operation (DE-D13). */
51
67
  export type FrameCommit = {
@@ -117,6 +133,31 @@ export type DashboardOperation = ({
117
133
  op: 'dashboard.update';
118
134
  title?: string;
119
135
  description?: string | null;
136
+ }
137
+ /** A sheet at the end, its id from the resolver (building a report SPEC §4.1); the editor adds Document sheets too. */
138
+ | {
139
+ op: 'sheet.add';
140
+ sheet: {
141
+ id: string;
142
+ title: string;
143
+ kind?: 'document';
144
+ };
145
+ } | {
146
+ op: 'sheet.update';
147
+ sheetId: string;
148
+ title: string;
149
+ }
150
+ /** Cards in one spot as tabs, the first named shown (building a report SPEC §4.3). */
151
+ | {
152
+ op: 'layout.tabs';
153
+ sheetId: string;
154
+ cardIds: string[];
155
+ }
156
+ /** A tab in a spot of its own beside its tabs; the new spot's id from the resolver (S-2). */
157
+ | {
158
+ op: 'layout.untab';
159
+ cardId: string;
160
+ newFrameId: string;
120
161
  }) & {
121
162
  /** Set by the resolver: the public change this operation came from. Descriptions group by it. */
122
163
  changeIndex?: number;
@@ -126,7 +167,7 @@ export type OperationContext = {
126
167
  calendar: CalendarContext | null;
127
168
  };
128
169
  export type CreatedEntity = {
129
- kind: 'card' | 'filter';
170
+ kind: 'card' | 'filter' | 'sheet';
130
171
  id: string;
131
172
  title: string;
132
173
  changeIndex?: number;
@@ -167,6 +208,8 @@ export type DashboardRuntimeEffect =
167
208
  inputId: string;
168
209
  };
169
210
  export type OperationFailureCode = 'sheet_not_found'
211
+ /** A sheet with that id is already on the dashboard (building a report SPEC §4.2). */
212
+ | 'sheet_id_taken'
170
213
  /** A document sheet places cards through its document, not its grid. */
171
214
  | 'sheet_not_a_grid' | 'frame_id_taken' | 'frame_not_found' | 'card_not_found' | 'filter_not_found' | 'filter_id_taken'
172
215
  /** The filter settings or mapping fail the input contract; `details.issues` has the core's issues. */
@@ -187,6 +230,13 @@ export type DashboardOperationResult = {
187
230
  ok: true;
188
231
  dashboard: TDashboard;
189
232
  created: CreatedEntity[];
233
+ /**
234
+ * The existing cards the operations changed in place, in order, each once
235
+ * (watch page P1-20): a live editor shows the person the first one. A
236
+ * removed card isn't listed, nor are changes to no card (filters, sheets,
237
+ * the dashboard's title, arranging).
238
+ */
239
+ touched: string[];
190
240
  /** One plain sentence per public change (or per operation without a changeIndex). */
191
241
  descriptions: OperationDescription[];
192
242
  runtimeEffects: DashboardRuntimeEffect[];
@@ -1,6 +1,7 @@
1
1
  import { DashboardRelationshipReachResolver } from '../../../lib/query-context/dashboard-filter-mapping-resolution.js';
2
2
  import { TDashboard } from '../../../lib/types/common-types.js';
3
3
  import { FrameWidth } from '../../layouts/index.js';
4
+ import { TextBlocks } from '../text-card-words/index.js';
4
5
  import { CardTypeProperties } from '../changes/card-types.js';
5
6
  import { CardSettingsView } from '../card-settings/views.js';
6
7
  import { NotEditableReason, OutlineCardSource } from '../changes/read-card-query.js';
@@ -50,7 +51,7 @@ export type OutlineCard = ({
50
51
  matrix?: MatrixColumns;
51
52
  } & CardTypeProperties &
52
53
  /** How the card reads and shows, in the shape a change takes; absent when the outline is truncated (card appearance SPEC 3.2). */
53
- Partial<CardSettingsView>) | ({
54
+ Partial<CardSettingsView>) | OutlineTextCard | ({
54
55
  cardId: string;
55
56
  title: string;
56
57
  type: string;
@@ -63,6 +64,17 @@ Partial<CardSettingsView>) | ({
63
64
  detail?: string;
64
65
  };
65
66
  } & CardTypeProperties);
67
+ /** A text card's words, in the subset a change takes (building a report SPEC §2.3, read by the words owner, S-10). */
68
+ export type OutlineTextCard = {
69
+ cardId: string;
70
+ title: string;
71
+ type: 'text';
72
+ editable: true;
73
+ text: TextBlocks;
74
+ /** In the editor's words: what the stored words hold that the blocks can't state; kept as stored (BR-INV-7). */
75
+ editorOnly?: string[];
76
+ linkedVisualId?: string;
77
+ };
66
78
  export type OutlineSheet = {
67
79
  sheetId: string;
68
80
  title: string;
@@ -0,0 +1,58 @@
1
+ /**
2
+ * A text card's words as a change and the outline give them (building a
3
+ * report SPEC §2.4, BR-D11 as revised by OQ-1): blocks shaped like the
4
+ * stored rich text, with shorter names. Text is taken literally: nothing is
5
+ * parsed or printed, so `**` in a run is two asterisks.
6
+ */
7
+ /** Plain text, or one run of text or a variable with its emphasis and link. */
8
+ export type TextRun = string | {
9
+ text?: string;
10
+ variable?: string;
11
+ bold?: boolean;
12
+ italic?: boolean;
13
+ link?: string;
14
+ };
15
+ export type TextBlock = {
16
+ type: 'heading';
17
+ level: 1 | 2;
18
+ content: TextRun[];
19
+ } | {
20
+ type: 'paragraph';
21
+ content: TextRun[];
22
+ } | {
23
+ type: 'list';
24
+ style: 'bulleted' | 'numbered';
25
+ items: TextRun[][];
26
+ };
27
+ /** At most 200 blocks and 10,000 characters of text (SPEC §2.2). */
28
+ export type TextBlocks = TextBlock[];
29
+ /** A run as an object: exactly one of `text` or `variable`, only the flags that are on. */
30
+ export type TextRunObject = {
31
+ text?: string;
32
+ variable?: string;
33
+ bold?: true;
34
+ italic?: true;
35
+ link?: string;
36
+ };
37
+ /**
38
+ * A run as an object. A string is plain text; a run naming a variable is
39
+ * that variable (`name` alone is `name.label`); `false` flags are dropped.
40
+ */
41
+ export declare function runObject(run: TextRun): TextRunObject;
42
+ /**
43
+ * Runs in their one form (SPEC §2.4): empty text dropped, neighbouring text
44
+ * of one emphasis and link joined, and a run with no emphasis or link a
45
+ * string.
46
+ */
47
+ export declare function oneFormRuns(runs: readonly TextRun[]): TextRun[];
48
+ /** Blocks in their one form: what the outline reads, and what a change is compared and stored as. */
49
+ export declare function oneForm(blocks: readonly TextBlock[]): TextBlocks;
50
+ /** A block's runs, with each one's path under the block's own. */
51
+ export declare function blockRuns(block: TextBlock, at: string): Array<{
52
+ run: TextRun;
53
+ path: string;
54
+ }>;
55
+ /** The characters of text in the blocks (variables count none). */
56
+ export declare function textLength(blocks: readonly TextBlock[]): number;
57
+ /** The first words of a text card, for the sentence that adds it. */
58
+ export declare function blocksExcerpt(blocks: readonly TextBlock[], length?: number): string;
@@ -0,0 +1,55 @@
1
+ import { TCard, TDashboard, TextCardRichContent } from '../../../lib/types/common-types.js';
2
+ import { ChangeDiagnostic } from '../changes/diagnostics.js';
3
+ import { TextBlocks } from './blocks.js';
4
+ export { hasTextCardRichWords, isTextCardRichContent, sanitizeTextCardUrl } from './rich-content.js';
5
+ export type { TextBlock, TextBlocks, TextRun } from './blocks.js';
6
+ /**
7
+ * The one reader and writer of a text card's words for a change (building a
8
+ * report S-10, BR-D11, BR-D12, SPEC §5.3, §5.4): the outline reads them here,
9
+ * and the resolver resolves a change to them here. The words are blocks
10
+ * shaped like the stored rich text (SPEC §2.4), read and written field by
11
+ * field; variables are the card's own (S-9); a change keeps every block it
12
+ * leaves as it reads (S-8). Pure: no DOM, no Markdown package (V-7).
13
+ */
14
+ export type TextCardWordsForm = 'rich' | 'legacy_runs' | 'legacy_html' | 'empty';
15
+ export type TextCardWordsRead = {
16
+ editable: true;
17
+ form: TextCardWordsForm;
18
+ text: TextBlocks;
19
+ editorOnly: string[];
20
+ } | {
21
+ editable: false;
22
+ form: 'dynamic';
23
+ message: string;
24
+ };
25
+ export declare const DYNAMIC_TEXT_MESSAGE = "Its words come from a query. Change it in the editor.";
26
+ /** At most this many characters of text in a change (SPEC §2.2). */
27
+ export declare const MAX_TEXT_WORDS = 10000;
28
+ type Inputs = TDashboard['inputs'];
29
+ export declare function readTextCardWords(card: TCard, inputs: Inputs): TextCardWordsRead;
30
+ export type TextWordsResolution = {
31
+ ok: true;
32
+ unchanged: true;
33
+ } | {
34
+ ok: true;
35
+ unchanged: false;
36
+ richContent: TextCardRichContent;
37
+ clearsLegacy: boolean;
38
+ } | {
39
+ ok: false;
40
+ problems: ChangeDiagnostic[];
41
+ };
42
+ export declare function resolveTextCardWords(request: {
43
+ text: TextBlocks;
44
+ card?: TCard;
45
+ inputs: Inputs;
46
+ path: string;
47
+ /**
48
+ * Store an older card's words as rich text even when they come back as
49
+ * read: a change that makes its description the subtitle needs the words
50
+ * out of it first (BR-D12).
51
+ */
52
+ storeAsRichText?: boolean;
53
+ }): TextWordsResolution;
54
+ /** The first words of rich content, for the sentence that adds or changes a card. */
55
+ export declare function textCardExcerpt(content: TextCardRichContent | undefined, inputs?: Inputs): string;
@@ -0,0 +1,18 @@
1
+ import { TextCardRichContent } from '../../../lib/types/common-types.js';
2
+ /**
3
+ * A text card's stored rich content (`preferences.textVisualOptions.richContent`):
4
+ * the shape check and the link rule, pure and server-safe, so the renderer
5
+ * (`src/lib/dashboard-inputs/text-card-rich-content.ts`), the editor and the
6
+ * words owner (building a report SPEC §1) read them from one place.
7
+ */
8
+ export declare function isTextCardRichContent(value: unknown): value is TextCardRichContent;
9
+ /** Whether the content holds any words: a paragraph of only spacing holds none (V-8). */
10
+ export declare function hasTextCardRichWords(value: unknown): boolean;
11
+ /**
12
+ * The editor's link rule. Mirrors the DOMPurify default URL policy: http(s),
13
+ * mailto, tel, relative and protocol-relative; a bare host gets https;
14
+ * javascript:, data:, file: and anything else are dropped. Returns the URL
15
+ * to link, or '' to drop the link and keep its words.
16
+ */
17
+ export declare function sanitizeTextCardUrl(rawUrl: string): string;
18
+ export declare function isDashboardInputExportKey(value: unknown): value is 'label' | 'value' | 'start' | 'end' | 'range';
@@ -0,0 +1,82 @@
1
+ /**
2
+ * The Document print contract (Document PDF reliability C1 to C4): what a
3
+ * printing Document tells the PDF worker, read by the package, the app and
4
+ * the worker alike. Pure: no React, no stores. The worker bundles it into its
5
+ * own adapter (`semaphor-report-scheduler/scripts/document-print-entry.mjs`).
6
+ */
7
+ /**
8
+ * The one page-fit rule (DPR-D13): a page overflows when
9
+ * `Math.ceil(scroll) - Math.ceil(client)` exceeds this on either axis. React's
10
+ * fit check and the worker's last check read the same constant.
11
+ */
12
+ export declare const DOCUMENT_PAGE_FIT_TOLERANCE_PX = 1;
13
+ declare const DOCUMENT_PRINT_LAYOUT_STAGES: readonly ["loading", "measuring", "checking", "laidOut"];
14
+ /** Where a printing Document's layout is (C4). A failure is not a stage: it travels as a code (C1). */
15
+ export type DocumentPrintLayoutStage = (typeof DOCUMENT_PRINT_LAYOUT_STAGES)[number];
16
+ /** The page stack's `data-document-print-layout`, in print only (C4). */
17
+ export type DocumentPrintLayout = {
18
+ stage: DocumentPrintLayoutStage;
19
+ /** Defined row heights across the paginated sections. */
20
+ measuredRowCount: number;
21
+ /** Null while any paginated section has no settled count. */
22
+ totalRowCount: number | null;
23
+ /** The final plan's page count; null before `checking`. */
24
+ pageCount: number | null;
25
+ };
26
+ /** Every reason a Document cannot print (C1). Lowercase, as the page and the worker report them. */
27
+ export declare const DOCUMENT_PRINT_FAILURE_CODES: readonly ["document_matrix_too_large", "document_matrix_unavailable", "document_matrix_too_wide", "document_kpi_value_overflow", "print_inputs_not_captured", "document_section_setup", "document_input_missing", "document_section_query_failed", "document_table_completeness_unverified", "document_row_limit_exceeded", "document_section_render_failed", "document_page_overflow", "document_sheet_not_found", "document_print_timed_out"];
28
+ export type DocumentPrintFailureCode = (typeof DOCUMENT_PRINT_FAILURE_CODES)[number];
29
+ export declare function isDocumentPrintFailureCode(value: unknown): value is DocumentPrintFailureCode;
30
+ /**
31
+ * What a failure says beyond its code (C3): ids, counts, geometry, the stage
32
+ * and authored labels, never row values, SQL, server text or URLs (DPR-INV-7).
33
+ * The bounds keep the serialized facts under 1 KB.
34
+ */
35
+ export type DocumentPrintFailureFacts = {
36
+ /** At most 64 characters. */
37
+ sectionId?: string;
38
+ /** Authored, trimmed, at most 120 characters. */
39
+ sectionTitle?: string;
40
+ /** 1-based. */
41
+ pageNumber?: number;
42
+ /** 0 or more. */
43
+ rowCount?: number;
44
+ /** More than 0. */
45
+ rowLimit?: number;
46
+ /** Authored labels, at most 3, each at most 80 characters. */
47
+ inputLabels?: string[];
48
+ overflowAxis?: 'height' | 'width';
49
+ /** Logs and the author's detail only. */
50
+ overflowPx?: number;
51
+ matrixLimit?: 'rows' | 'bytes';
52
+ /** W1 only: where the layout was when the deadline passed. */
53
+ layoutStage?: DocumentPrintLayoutStage | 'noPageStack' | 'unknown';
54
+ /** W1 only. */
55
+ loadingSectionCount?: number;
56
+ /** W1 only. */
57
+ measuredRowCount?: number;
58
+ /** W1 only. */
59
+ totalRowCount?: number;
60
+ /** W1 only. */
61
+ pageCount?: number;
62
+ };
63
+ /** What a source passes to the attribute writer (C1). */
64
+ export type DocumentPrintFailure = {
65
+ code: DocumentPrintFailureCode;
66
+ facts: DocumentPrintFailureFacts;
67
+ };
68
+ /**
69
+ * The one facts parser (C3): reads the attribute's JSON (or an object), drops
70
+ * unknown fields, wrong types and out-of-range values, and truncates strings
71
+ * to their limits. Every reader parses with it; every writer writes its output.
72
+ */
73
+ export declare function readDocumentPrintFailureFacts(value: unknown): DocumentPrintFailureFacts;
74
+ /**
75
+ * Internal English for logs and the author-only delivery detail, built from
76
+ * the code and facts only (C1), so no server error text, SQL or row value can
77
+ * reach it. Customers read the app's catalog line instead (C2).
78
+ */
79
+ export declare function describeDocumentPrintFailure(failure: DocumentPrintFailure): string;
80
+ /** Reads the attribute value (or an already parsed object); undefined when absent or malformed. */
81
+ export declare function readDocumentPrintLayout(value: unknown): DocumentPrintLayout | undefined;
82
+ export {};
@@ -24,6 +24,7 @@ export { fromSemanticFormat } from './semantic-format.js';
24
24
  export type * from './table-structure.js';
25
25
  export * from './pdf-export-policy.js';
26
26
  export * from './pdf-delivery.js';
27
+ export * from './document-print.js';
27
28
  export * from './numeric-presentation.js';
28
29
  export { pickColumnFormat, resolveColumnFormat, withLiveModelFormats, type ColumnFormatSource, type FormatSurface, type ModelFormats, type ResolvedColumnFormat, } from './resolve-column-format.js';
29
30
  export * from './presentation-execution.js';
@@ -4,6 +4,8 @@ import { RawDatePreset, RawTemporalValueKind, RawTemporalValueMetadata } from '.
4
4
  import { parseRawTemporalValueMetadata, validateRawTemporalResultColumn } from '../analytics-protocol/raw-temporal-contract.js';
5
5
  import { LocaleStyle, ResolvedValueFormatPreferences } from '../value-format-preferences/index.js';
6
6
  import { RawTemporalFormat, RawTemporalPatternDialect } from './types/format-types.js';
7
+ import { classifyTemporalLiteral } from '../temporal/raw-temporal-value.js';
8
+ export { classifyTemporalLiteral };
7
9
  export type { RawTemporalFormat, RawTemporalPatternDialect };
8
10
  /**
9
11
  * A stored raw date format's presentation (column formats CF-D4, CF-D16): its
@@ -86,13 +88,6 @@ export declare function resolveRawTemporalFormat(input: {
86
88
  preferences: ResolvedValueFormatPreferences;
87
89
  calendar: Pick<CalendarContext, 'tz'>;
88
90
  }): ResolvedRawTemporalFormat;
89
- /**
90
- * What a temporal literal is by its text alone: a calendar date, a wall-clock
91
- * date-time with no zone, or an instant with a zone or offset. Undefined for
92
- * any other text. Readers keep a date and a wall date-time as written; only an
93
- * instant names a moment.
94
- */
95
- export declare function classifyTemporalLiteral(value: string): RawTemporalValueKind | undefined;
96
91
  export declare function classifyDeclaredSqlTemporalColumn(input: {
97
92
  columnKey: string;
98
93
  values: readonly (string | null)[];
@@ -3,4 +3,5 @@ export * from './calendar-periods.js';
3
3
  export * from './relative-date.js';
4
4
  export * from './time-window-periods.js';
5
5
  export * from './calendar-day-equality.js';
6
+ export * from './raw-temporal-equality.js';
6
7
  export * from './temporal-parity-fixtures.js';
@@ -0,0 +1,19 @@
1
+ /** An `=` or `!=` on a raw date-time selection, as the instants its value names. */
2
+ export type RawTemporalEquality = {
3
+ operation: '=' | '!=';
4
+ /** Earliest first; each to the millisecond. */
5
+ instants: Date[];
6
+ };
7
+ /**
8
+ * The instants a raw date-time selection's `=` or `!=` names, or null: one
9
+ * value, a `raw_temporal` selection of a date-time, and text the raw-date
10
+ * formatter reads as that kind (a wall clock with no offset, or an instant
11
+ * with one). Anything else (a date, another operator, a value the formatter
12
+ * refuses) is null, and the caller compares as it would without the
13
+ * selection.
14
+ */
15
+ export declare function readRawTemporalEquality(predicate: {
16
+ operation: unknown;
17
+ values: unknown;
18
+ rawTemporal?: unknown;
19
+ }): RawTemporalEquality | null;