react-semaphor 0.1.603 → 0.1.604

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/dist/activity/index.js +1 -73
  2. package/dist/analytics-protocol/index.js +1 -1491
  3. package/dist/appearance/index.js +1 -12
  4. package/dist/appearance-runtime/index.js +1 -5
  5. package/dist/assistant-context/index.js +1 -11
  6. package/dist/assistant-protocol/index.js +1 -152
  7. package/dist/brand-studio/index.js +4 -1594
  8. package/dist/briefings/index.js +1 -70
  9. package/dist/chunks/add-to-dashboard-DeHEBEqG.js +12 -0
  10. package/dist/chunks/analytics-base-schemas-BREc5WGv.js +1 -0
  11. package/dist/chunks/appearance-context-BqBZrijL.js +1 -0
  12. package/dist/chunks/appearance-runtime-provider-DmbCrOOG.js +1 -0
  13. package/dist/chunks/applied-constraints-CinevlKD.js +1 -0
  14. package/dist/chunks/assistant-chat-CjYrwVDa.js +56 -0
  15. package/dist/chunks/attribution-BEFSsbNn.js +1 -0
  16. package/dist/chunks/availability-3AIOf6Z-.js +1 -0
  17. package/dist/chunks/bookmark-impact-C89zBLq3.js +1 -0
  18. package/dist/chunks/bookmark-state-69YYnRql.js +1 -0
  19. package/dist/chunks/brand-DCaZyRt6.js +1 -0
  20. package/dist/chunks/card-filter-builder-CTp6RAz1.js +17 -0
  21. package/dist/chunks/column-bands-DwxbZ6UI.js +1 -0
  22. package/dist/chunks/comparison-window-caption-C312mn3s.js +1 -0
  23. package/dist/chunks/context-ALdccLHw.js +2 -0
  24. package/dist/chunks/conversation-JMK2kyTK.js +1 -0
  25. package/dist/chunks/dashboard-BX28ld6s.js +1 -0
  26. package/dist/chunks/dashboard-briefing-launcher-qo7GH4EO.js +37 -0
  27. package/dist/chunks/dashboard-controls-DhRjB7MA.js +42 -0
  28. package/dist/chunks/dashboard-json-9cHzhSjC.js +1 -0
  29. package/dist/chunks/dates-D-KP8G-z.js +1 -0
  30. package/dist/chunks/edit-DEAK0UZo.js +1 -0
  31. package/dist/chunks/edit-dashboard-visual-Duq_QkB_.js +93 -0
  32. package/dist/chunks/export-file-format-B-wQNHIn.js +4 -0
  33. package/dist/chunks/filter-line-CwQrqORc.js +1 -0
  34. package/dist/chunks/filter-reach-preview-gixPFlZj.js +1 -0
  35. package/dist/chunks/filter-value-text-B3tXakhd.js +1 -0
  36. package/dist/chunks/index-B-VF1ogs.js +1 -0
  37. package/dist/chunks/index-BE1DfxNs.js +1 -0
  38. package/dist/chunks/index-DViPGDFj.js +1 -0
  39. package/dist/chunks/layout-grid-BWtlgw0T.js +6 -0
  40. package/dist/chunks/matrix-analytical-definition-CtFqWyCK.js +1 -0
  41. package/dist/chunks/matrix-member-presentation-Q0MCJ-YK.js +1 -0
  42. package/dist/chunks/matrix-operation-contract-D1RC1bfi.js +1 -0
  43. package/dist/chunks/metric-comparison-DEZYXROZ.js +1 -0
  44. package/dist/chunks/normalize-dashboard-for-dirty-check-ILKfqgL3.js +1 -0
  45. package/dist/chunks/paintbrush-BjS3SbrH.js +6 -0
  46. package/dist/chunks/palette-BzC-CGOc.js +6 -0
  47. package/dist/chunks/pickers-DuBrUht0.js +1 -0
  48. package/dist/chunks/pivot-result-contract-expectations-DTQAgr4n.js +1 -0
  49. package/dist/chunks/pivot-result-identity-DTNCB--h.js +1 -0
  50. package/dist/chunks/raw-temporal-value-DeyEhL0S.js +1 -0
  51. package/dist/chunks/rendered-file-BbvwaU6z.js +1 -0
  52. package/dist/chunks/report-preferences-dialog-B_gUmCzG.js +1 -0
  53. package/dist/chunks/report-runtime-context-BWzIHCKK.js +1 -0
  54. package/dist/chunks/resolve-dashboard-input-context-B-TtRqxu.js +8 -0
  55. package/dist/chunks/resolver-AN9ChBfZ.js +1 -0
  56. package/dist/chunks/save-DdFUZcbi.js +6 -0
  57. package/dist/chunks/saved-dashboard-context-BAJ5tWiq.js +1 -0
  58. package/dist/chunks/schema-MC0cQSAb.js +4 -0
  59. package/dist/chunks/selection-filter-compiler-CCoCD25M.js +1 -0
  60. package/dist/chunks/semaphor-ready-indicator-DzjorP3t.js +999 -0
  61. package/dist/chunks/set-DuJfGkbY.js +1 -0
  62. package/dist/chunks/shelf-drop-preview-context-BlLJ5RsT.js +6 -0
  63. package/dist/chunks/stored-dashboard-Ctcpkllg.js +1 -0
  64. package/dist/chunks/style-sheet-parts-BRGt9O05.js +178 -0
  65. package/dist/chunks/table-export-sheet-rC5pKmXg.js +2 -0
  66. package/dist/chunks/token-types-Bj9iMy0w.js +1 -0
  67. package/dist/chunks/validators-CqV3Yka1.js +1 -0
  68. package/dist/chunks/variable-draft-DJrfUyhv.js +1 -0
  69. package/dist/chunks/visual-choice-DgEFfkE-.js +1 -0
  70. package/dist/dashboard/index.js +1 -7
  71. package/dist/dashboard-authoring/index.js +1 -4614
  72. package/dist/format-utils/index.js +1 -425
  73. package/dist/index.js +1 -554
  74. package/dist/layouts/index.js +1 -7
  75. package/dist/live-channel/index.js +1 -124
  76. package/dist/pdf-export-policy/index.js +1 -92
  77. package/dist/pdf-table-layout/index.js +1 -993
  78. package/dist/report-runtime-context/index.js +1 -9
  79. package/dist/shared/index.js +1 -6
  80. package/dist/style.css +1 -1
  81. package/dist/surfboard/index.js +1 -9
  82. package/dist/types/index.js +1 -88
  83. package/dist/types/lib/filter-values/build-card-filter-definition.d.ts +32 -0
  84. package/dist/types/lib/query-context/dashboard-filter-mapping-resolution.d.ts +9 -0
  85. package/dist/types/lib/stores/explorer-actions.d.ts +7 -6
  86. package/dist/types/lib/types/semantic-types.d.ts +6 -10
  87. package/dist/types/lib/utils/field-state-calculator.d.ts +7 -19
  88. package/dist/types/shared/dashboard-authoring/calculations/definition.d.ts +13 -0
  89. package/dist/types/shared/dashboard-authoring/card-data-source/card-base.d.ts +125 -0
  90. package/dist/types/shared/dashboard-authoring/card-data-source/card-field-folders.d.ts +55 -0
  91. package/dist/types/shared/dashboard-authoring/card-data-source/card-joins.d.ts +114 -0
  92. package/dist/types/shared/dashboard-authoring/card-data-source/card-prune.d.ts +12 -0
  93. package/dist/types/shared/dashboard-authoring/card-data-source/filter-field-catalog.d.ts +60 -0
  94. package/dist/types/shared/dashboard-authoring/card-data-source/filter-field-folders.d.ts +132 -0
  95. package/dist/types/shared/dashboard-authoring/card-data-source/index.d.ts +7 -0
  96. package/dist/types/shared/dashboard-authoring/card-data-source/join-reach.d.ts +42 -0
  97. package/dist/types/shared/dashboard-authoring/card-field-places.d.ts +28 -0
  98. package/dist/types/shared/dashboard-authoring/field-folders/field-folders.d.ts +115 -0
  99. package/dist/types/shared/dashboard-authoring/field-folders/index.d.ts +1 -0
  100. package/dist/types/shared/dashboard-authoring/filter-reach-decision.d.ts +11 -0
  101. package/dist/types/shared/dashboard-authoring/index.d.ts +6 -1
  102. package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +2 -0
  103. package/dist/types/shared/dashboard-authoring/see-records/result.d.ts +7 -22
  104. package/dist/usage-events/index.js +1 -285
  105. package/dist/value-format-preferences/index.js +1 -635
  106. package/package.json +4 -1
  107. package/dist/chunks/add-to-dashboard-CFF-wFU-.js +0 -291
  108. package/dist/chunks/analytics-base-schemas-DsUh5Q3C.js +0 -680
  109. package/dist/chunks/appearance-context-BwBp25ZG.js +0 -162
  110. package/dist/chunks/appearance-runtime-provider-BRHYELkC.js +0 -80
  111. package/dist/chunks/applied-constraints-DU-wndZ7.js +0 -47
  112. package/dist/chunks/assistant-chat-B6hNQI1t.js +0 -6115
  113. package/dist/chunks/attribution-BvoKvhcj.js +0 -32
  114. package/dist/chunks/availability-Bp5Gfu1I.js +0 -44
  115. package/dist/chunks/bookmark-impact-Ba2PLcGp.js +0 -76
  116. package/dist/chunks/bookmark-state-n7AaNzR_.js +0 -1667
  117. package/dist/chunks/brand-BoUV0iHF.js +0 -54
  118. package/dist/chunks/card-filter-builder-Y22HizVx.js +0 -4069
  119. package/dist/chunks/column-bands-RdM-kjDe.js +0 -47
  120. package/dist/chunks/comparison-window-caption-Ck2TIbnR.js +0 -741
  121. package/dist/chunks/context-UCQ7sere.js +0 -369
  122. package/dist/chunks/conversation-sQiWYUOb.js +0 -16
  123. package/dist/chunks/dashboard-BghI99oY.js +0 -14
  124. package/dist/chunks/dashboard-briefing-launcher-DtBAnGiH.js +0 -4875
  125. package/dist/chunks/dashboard-controls-CtFXlyjV.js +0 -2290
  126. package/dist/chunks/dashboard-json-DfGBUtCd.js +0 -66
  127. package/dist/chunks/dates-BnrXF4bb.js +0 -185
  128. package/dist/chunks/edit-9df1zOWe.js +0 -226
  129. package/dist/chunks/edit-dashboard-visual-oxt3x1wb.js +0 -18397
  130. package/dist/chunks/export-file-format-C-tJsxsf.js +0 -111
  131. package/dist/chunks/filter-line-Cy5YYqRL.js +0 -703
  132. package/dist/chunks/filter-reach-copy-CE_ZX147.js +0 -5111
  133. package/dist/chunks/filter-value-text-fWvSDwkl.js +0 -153
  134. package/dist/chunks/index-BVKzKl5d.js +0 -90
  135. package/dist/chunks/index-CV_Kzou0.js +0 -595
  136. package/dist/chunks/index-D5rxbtS4.js +0 -2795
  137. package/dist/chunks/layout-grid-9LndRoLa.js +0 -16
  138. package/dist/chunks/matrix-analytical-definition-CCp48UCw.js +0 -1233
  139. package/dist/chunks/matrix-member-presentation-zNehruXR.js +0 -391
  140. package/dist/chunks/matrix-operation-contract-DPBj69D8.js +0 -1413
  141. package/dist/chunks/metric-comparison-B0FR-Q8I.js +0 -600
  142. package/dist/chunks/normalize-dashboard-for-dirty-check-XKgH3GFX.js +0 -119
  143. package/dist/chunks/paintbrush-58FQYY-y.js +0 -27
  144. package/dist/chunks/palette-Be62Tkoa.js +0 -23
  145. package/dist/chunks/pickers-DkqmtnTL.js +0 -2403
  146. package/dist/chunks/pivot-result-contract-expectations-BYqAmG9n.js +0 -5092
  147. package/dist/chunks/pivot-result-identity-CAP4--iq.js +0 -77
  148. package/dist/chunks/raw-temporal-value-Dg_MTFF7.js +0 -3778
  149. package/dist/chunks/rendered-file-D8xEuVVx.js +0 -108
  150. package/dist/chunks/report-preferences-dialog-uJp9GBTM.js +0 -1651
  151. package/dist/chunks/report-runtime-context-c77_KF9v.js +0 -388
  152. package/dist/chunks/resolve-dashboard-input-context-Rtl1ffmE.js +0 -25324
  153. package/dist/chunks/resolver-DG_tfEpt.js +0 -156
  154. package/dist/chunks/save-C5A0JnEV.js +0 -21
  155. package/dist/chunks/saved-dashboard-context-tcyTU8jm.js +0 -618
  156. package/dist/chunks/schema-C9NPiIru.js +0 -2568
  157. package/dist/chunks/selection-filter-compiler-DNijjI5y.js +0 -150
  158. package/dist/chunks/semaphor-ready-indicator-FBvunj6S.js +0 -145603
  159. package/dist/chunks/shelf-drop-preview-context-QKStrcK9.js +0 -2466
  160. package/dist/chunks/stored-dashboard-CHozcAY9.js +0 -4075
  161. package/dist/chunks/style-sheet-parts-CDCG-8Ej.js +0 -8681
  162. package/dist/chunks/table-export-sheet-ZFIvs6Sj.js +0 -949
  163. package/dist/chunks/token-types-XbM6QByy.js +0 -8
  164. package/dist/chunks/upload-H15d7uHK.js +0 -15
  165. package/dist/chunks/validators-Baf3VIf5.js +0 -3686
  166. package/dist/chunks/variable-draft-C2y8Jp6Z.js +0 -242
  167. package/dist/chunks/visual-choice-DDfHfHvY.js +0 -172
@@ -0,0 +1,132 @@
1
+ import { TCard } from '../../../lib/types/common-types.js';
2
+ import { DataSource, DatabaseEntityReference, Field } from '../../../lib/types/explorer-types.js';
3
+ type Entity = DatabaseEntityReference;
4
+ /** How one card is reached from a folder's dataset. */
5
+ export type FilterFolderCard = {
6
+ cardId: string;
7
+ title: string;
8
+ /** The card's base, as the folder list names it. */
9
+ baseLabel: string;
10
+ /** The key fields on the card's side, nearest step first; empty on the base itself. */
11
+ keys: readonly string[];
12
+ /** Reached through one of the card's own joins. */
13
+ throughJoin?: boolean;
14
+ /** The folder's dataset or table is the card's base. */
15
+ onBase?: boolean;
16
+ };
17
+ export type FilterFieldFolder = {
18
+ /** Stable identity: the domain and dataset, or the table's connection and qualified name. */
19
+ key: string;
20
+ label: string;
21
+ /** The source the folder's fields are read from and a filter on them stores (DF-D5). */
22
+ source: Entity;
23
+ domainId?: string;
24
+ /** A direct table: no domain relationships. */
25
+ direct: boolean;
26
+ section: 'onSheet' | 'related';
27
+ cards: readonly FilterFolderCard[];
28
+ /** Chosen from Browse all data: listed whether or not it reaches a card (DF-D6). */
29
+ picked?: boolean;
30
+ };
31
+ /** A card as the per-card read takes it: what decides a filter's reach on it, a draft included. */
32
+ export type FilterFieldReachCard = Pick<TCard, 'id' | 'title' | 'type' | 'dataSource' | 'config' | 'sql'>;
33
+ /**
34
+ * A calculated field a filter picker would offer, decided per card by the
35
+ * same decision as a dataset (review P8-01): the field as the catalog has it
36
+ * and the source a filter on it would store.
37
+ */
38
+ export type FilterFieldReachCandidate = {
39
+ key: string;
40
+ field: Field;
41
+ source: DataSource;
42
+ };
43
+ export type FilterFieldReachRequest = {
44
+ cards: FilterFieldReachCard[];
45
+ fields?: FilterFieldReachCandidate[];
46
+ };
47
+ /** A domain dataset a filter can be on, and each card a filter on it reaches. */
48
+ export type FilterFieldReachDataset = {
49
+ domainId: string;
50
+ name: string;
51
+ label: string;
52
+ type?: string;
53
+ table?: string | null;
54
+ schema?: string | null;
55
+ catalog?: string | null;
56
+ cards: Array<{
57
+ cardId: string;
58
+ /** Reached through a relationship route: the key fields on the card's side, nearest step first (labels). */
59
+ keys?: string[];
60
+ }>;
61
+ };
62
+ /** The per-card read's answer (DF-D2): each dataset's cards, and each candidate field's (DF-D11). */
63
+ export type FilterFieldReachResponse = {
64
+ datasets: FilterFieldReachDataset[];
65
+ fields?: Array<{
66
+ key: string;
67
+ cards: string[];
68
+ }>;
69
+ };
70
+ /**
71
+ * A card as the per-card read decides it, with only what decides it: its
72
+ * domain read the one way every surface reads it
73
+ * (`getDataSourceSemanticDomainId`: the source's, else the one its datasets
74
+ * name) and stated on its source, so a new visual whose domain sits on its
75
+ * dataset is decided like any other (review P8-02). The browser builds the
76
+ * request with it and the server reads every card through it again.
77
+ */
78
+ export declare function filterFieldReachCard(card: FilterFieldReachCard): FilterFieldReachCard;
79
+ /**
80
+ * The cards the per-card read decides: every card with a base. Datasets are
81
+ * decided on a domain's cards; a candidate field on every card (a table
82
+ * card's own calculations included).
83
+ */
84
+ export declare function filterFieldReachCards(cards: readonly TCard[]): FilterFieldReachCard[];
85
+ /** Reads a `/api/v1/filter-fields/reach` body; anything malformed is no answer. */
86
+ export declare function readFilterFieldReachResponse(body: unknown): FilterFieldReachResponse | undefined;
87
+ export type FilterFieldFoldersInput = {
88
+ /** The cards a filter added here can reach: a sheet's, a Document's, or one card's. */
89
+ cards: readonly TCard[];
90
+ /** The server's per-card decision on the domains' datasets, once it answers; before, no dataset folder. */
91
+ reach: FilterFieldReachResponse | undefined;
92
+ /** The server's decision on each table folder (`filterFieldTables`), by folder key: the cards it reaches. */
93
+ tableReach?: ReadonlyMap<string, readonly string[]>;
94
+ };
95
+ /**
96
+ * A folder's identity for a source: a domain dataset by its domain and name,
97
+ * a table by its connection and qualified name. The folders and a source
98
+ * picked from Browse all data compare by it (review P6-03).
99
+ */
100
+ export declare function filterFolderKey(source: Entity): string;
101
+ /** A card with a source a filter can reach: its base. */
102
+ export declare function filterableCards(cards: readonly TCard[]): TCard[];
103
+ /**
104
+ * The tables the cards' table cards read, each once: the table folders a
105
+ * picker may list. Whether each reaches a card is the server's decision
106
+ * (`tableReach`); this only names the candidates and their sources.
107
+ */
108
+ export declare function filterFieldTables(cards: readonly TCard[]): FilterFieldFolder[];
109
+ /** The folders, On this sheet first, then Related; most cards reached first, then most built on it, then by label. */
110
+ export declare function filterFieldFolders(input: FilterFieldFoldersInput): FilterFieldFolder[];
111
+ /**
112
+ * The data source a filter added from a folder stores (DF-D5): the folder's
113
+ * own dataset on its domain, or its own table; never another card's source.
114
+ */
115
+ export declare function filterFolderDataSource(folder: Pick<FilterFieldFolder, 'source' | 'domainId' | 'direct'>): DataSource;
116
+ /** "6 cards", or "4 of 6 cards": a folder header's reach (DF-D4). */
117
+ export declare function filterReachCount(folder: Pick<FilterFieldFolder, 'cards'>, total: number): string;
118
+ /**
119
+ * The reach line under the list for a highlighted folder or field (DF-D4):
120
+ * the cards it filters, grouped by base with the keys it goes through, and
121
+ * the cards it leaves unfiltered; for a direct table, how to reach one.
122
+ */
123
+ export declare function filterReachLine(input: {
124
+ folder: FilterFieldFolder;
125
+ /** Every card a filter here could reach (the sheet's or the Document's). */
126
+ cards: readonly Pick<TCard, 'id' | 'title'>[];
127
+ /** The highlighted field's label, when a field is highlighted. */
128
+ fieldLabel?: string;
129
+ /** A key field's label on the card's base. */
130
+ keyLabel?: (baseLabel: string, field: string) => string;
131
+ }): string;
132
+ export {};
@@ -0,0 +1,7 @@
1
+ export * from './join-reach.js';
2
+ export * from './card-field-folders.js';
3
+ export * from './card-base.js';
4
+ export * from './card-joins.js';
5
+ export * from './card-prune.js';
6
+ export * from './filter-field-folders.js';
7
+ export * from './filter-field-catalog.js';
@@ -0,0 +1,42 @@
1
+ /**
2
+ * What a semantic dataset reaches, as a card's query would join it (one base
3
+ * per card OB-D15). Served beside the joinability map by
4
+ * GET /api/v1/domains/[domainId]/joinability and built by the app's reach
5
+ * module (`relatedDatasetsFrom`, rule `card`), so the editor has no path
6
+ * finder of its own. The field list puts each reached dataset in a folder at
7
+ * the key its last step joins on (OB-D5).
8
+ */
9
+ /** One relationship crossed on the way, from the dataset nearer the base to the next. */
10
+ export interface JoinReachStep {
11
+ from: string;
12
+ to: string;
13
+ relationshipId?: string;
14
+ relationshipName?: string;
15
+ /** The relationship's fields on `from`'s side, in key order. One field: the folder stands at it. */
16
+ nearFields: string[];
17
+ /** The relationship's fields on `to`'s side, in the same order (a Needs setup join starts from them). */
18
+ farFields: string[];
19
+ /**
20
+ * The step lands on `to`'s whole primary key, so the near field refers to
21
+ * a `to` row ("Customer ID" → Customer): the folder may take the key's name.
22
+ */
23
+ towardKey?: true;
24
+ }
25
+ export interface JoinReach {
26
+ dataset: string;
27
+ steps: JoinReachStep[];
28
+ /**
29
+ * Reached only through an active relationship that doesn't join
30
+ * automatically (OB-D9): a Needs setup folder. One step.
31
+ */
32
+ needsSetup?: true;
33
+ /**
34
+ * Reached in two hops through more than one dataset: which way the query
35
+ * joins it depends on what else the card reads, so its folder stands at
36
+ * the base's top level, after the base's fields, never under one route
37
+ * (ledger P1-05).
38
+ */
39
+ alternateRoutes?: true;
40
+ }
41
+ /** Per base dataset, the datasets it reaches, nearest first. */
42
+ export type JoinReachMap = Record<string, JoinReach[]>;
@@ -0,0 +1,28 @@
1
+ import { TCard } from '../../lib/types/common-types.js';
2
+ import { Field } from '../../lib/types/explorer-types.js';
3
+ export declare const CARD_FIELD_SHELVES: readonly ["metricColumns", "groupByColumns", "detailColumns", "sortByColumns", "pivotByColumns"];
4
+ /**
5
+ * The Detail table backup's shelves: the Table shelves a Detail table keeps
6
+ * to restore when it switches back (`table-type-switch.ts`). Its fields are
7
+ * the card's too, so the walk covers them (ledger P8-02).
8
+ */
9
+ export declare const DETAIL_BACKUP_SHELVES: readonly ["metricColumns", "groupByColumns", "sortByColumns", "pivotByColumns"];
10
+ /**
11
+ * A card config's shelves, emptied, with the Detail table backup: what Clear
12
+ * fields writes (one base per card, ledger P7-12, P8-02). Filters stay.
13
+ */
14
+ export declare function clearedCardShelves(): Record<(typeof CARD_FIELD_SHELVES)[number], []> & {
15
+ detailTableBackup: undefined;
16
+ };
17
+ export type CardFieldPlace = 'column' | 'filter';
18
+ /**
19
+ * `onRemoved`: the writer removes sources from the card (a base switch,
20
+ * Remove join, Start over): a column one of whose own conditions (an
21
+ * attribute filter) can't be kept goes with it, rather than change meaning
22
+ * quietly, and is reported for the writer to list (ledger P8-07). Without it
23
+ * (calculated field edits, whose own rule drops the condition and keeps the
24
+ * measure), the condition alone goes.
25
+ */
26
+ export declare function mapCardFieldPlaces(card: TCard, map: (field: Field, place: CardFieldPlace) => Field | null, onRemoved?: (column: Field) => void): TCard;
27
+ /** Each field the card holds, once per place. */
28
+ export declare function cardFieldsInPlaces(card: TCard): Field[];
@@ -0,0 +1,115 @@
1
+ /**
2
+ * Field folders: one dataset's fields in a folder, nested at the key that
3
+ * reaches it (one base per card OB-D5, OB-D20). The one module for every
4
+ * surface that offers fields by dataset: See records' More columns and the
5
+ * card editor's field list. Pure and server-safe: the folder type, where a
6
+ * folder hangs, and the tree walk. Each surface draws its own leaf rows.
7
+ *
8
+ * Lifted from See records related columns (SC-D10, ledger P2-14), whose
9
+ * server assembled where folders hang and whose picker walked the tree.
10
+ */
11
+ /** A folder's field: the column name a reference uses and the words shown. */
12
+ export type FieldFolderColumn = {
13
+ field: string;
14
+ label: string;
15
+ };
16
+ /** One folder: a dataset and the fields offered from it. */
17
+ export type FieldFolder<C extends FieldFolderColumn = FieldFolderColumn> = {
18
+ /** The dataset, as a column reference names it. */
19
+ dataset: string;
20
+ label: string;
21
+ /** The datasets' labels from the base dataset to this one; empty for the base's own folder. */
22
+ path: readonly string[];
23
+ columns: readonly C[];
24
+ /**
25
+ * The folder this one opens from: the dataset one step nearer the base
26
+ * and, when that step joins on one field the parent offers, that field,
27
+ * so the folder stands where the field would. Absent on the base's folder.
28
+ */
29
+ parent?: {
30
+ dataset: string;
31
+ field?: string;
32
+ };
33
+ };
34
+ /** Where a folder could hang, before the folders exist: the nearer dataset and the field names that may stand for its key. */
35
+ export type FolderParentHint = {
36
+ dataset: string;
37
+ fields: readonly string[];
38
+ };
39
+ type JoinKeySide = {
40
+ name?: string;
41
+ expression?: unknown;
42
+ };
43
+ type JoinLike = {
44
+ joinKeyGroups?: readonly {
45
+ operator?: string;
46
+ keys: readonly {
47
+ operator?: string;
48
+ source: JoinKeySide;
49
+ target: JoinKeySide;
50
+ }[];
51
+ }[];
52
+ };
53
+ /** Equality pairs for a single conjunctive predicate. Unknown shapes prove no key. */
54
+ export declare function joinEqualityPairs(join: JoinLike): Array<[string, string]> | undefined;
55
+ /**
56
+ * Where a joined dataset's folder hangs: under the dataset the join comes
57
+ * from, at its key when the join is exactly one `=` pair (OB-D5).
58
+ */
59
+ export declare function folderParentHintFromJoin(join: JoinLike, fromDataset: string): FolderParentHint;
60
+ /**
61
+ * Where a dataset reached through a relationship hangs: under the dataset its
62
+ * last step comes from, at the step's field when it joins on one. `aliases`
63
+ * are other names the same field goes by (its source column).
64
+ */
65
+ export declare function folderParentHintFromStep(nearDataset: string, nearFields: readonly string[], aliases?: readonly string[]): FolderParentHint;
66
+ /**
67
+ * Each folder but the base's gets its parent from its hint: the hinted
68
+ * folder, with the first hinted field that folder offers. A folder whose
69
+ * hinted parent has no folder hangs from the base's folder.
70
+ */
71
+ export declare function withFolderParents<F extends FieldFolder<FieldFolderColumn>>(folders: readonly F[], hints: ReadonlyMap<string, FolderParentHint>): F[];
72
+ export type FieldFolderNode<F extends FieldFolder<FieldFolderColumn>> = {
73
+ kind: 'folder';
74
+ folder: F;
75
+ depth: number;
76
+ open: boolean;
77
+ /** The parent's field this folder stands in place of, when it hangs at one. */
78
+ key?: F['columns'][number];
79
+ /** Drawn only when open. */
80
+ children: FieldFolderNode<F>[];
81
+ } | {
82
+ kind: 'column';
83
+ folder: F;
84
+ column: F['columns'][number];
85
+ depth: number;
86
+ };
87
+ export type FieldFolderTreeOptions<F extends FieldFolder<FieldFolderColumn> = FieldFolder<FieldFolderColumn>> = {
88
+ /** Lowercased, trimmed; a non-empty query opens every folder it matches in. */
89
+ query?: string;
90
+ /**
91
+ * The surface's own match, for a surface that searches by more than the
92
+ * label (the card editor). With `filtering`, folders open and show only
93
+ * what it matches, as a query does.
94
+ */
95
+ match?: (folder: F, column: F['columns'][number]) => boolean;
96
+ filtering?: boolean;
97
+ /** Datasets whose folders are open when there is no query. */
98
+ expanded: readonly string[];
99
+ /**
100
+ * The parent's key field a folder stands at is listed first inside the
101
+ * folder (the card editor: it is a field of the parent the author may
102
+ * place). Off: the folder replaces it (See records: the folder's own key
103
+ * says the same).
104
+ */
105
+ keyInside?: boolean;
106
+ };
107
+ /**
108
+ * The folders as a tree: the roots (folders whose parent isn't offered), each
109
+ * folder's fields in order with a child folder in place of the field it hangs
110
+ * at, then children that hang at no field. A search shows the fields that
111
+ * match (by folder and field label) and opens every folder holding one.
112
+ * A dataset already on the way down is never nested again.
113
+ */
114
+ export declare function fieldFolderTree<F extends FieldFolder<FieldFolderColumn>>(folders: readonly F[], options: FieldFolderTreeOptions<F>): FieldFolderNode<F>[];
115
+ export {};
@@ -0,0 +1 @@
1
+ export * from './field-folders.js';
@@ -0,0 +1,11 @@
1
+ import { NormalizedFilterDashboardInput, TCard } from '../../lib/types/common-types.js';
2
+ import { TFilter } from '../../components/surfboard/filter/types.js';
3
+ import { DashboardFilterCardReachDetail, DashboardRelationshipReachResolver } from '../../lib/query-context/dashboard-filter-mapping-resolution.js';
4
+ /** A filter definition as a dashboard filter reaching every card, the input the decision reads. */
5
+ export declare function filterReachInput(filter: TFilter): NormalizedFilterDashboardInput;
6
+ /** How the filter reaches the card, and whether a reader counts it as reached. */
7
+ export declare function filterReachOnCard(input: NormalizedFilterDashboardInput, card: TCard, options?: {
8
+ relationshipReach?: DashboardRelationshipReachResolver;
9
+ }): DashboardFilterCardReachDetail & {
10
+ reached: boolean;
11
+ };
@@ -67,6 +67,11 @@ export * from './kpi-figure.js';
67
67
  export * from './kpi-trend-rule.js';
68
68
  export * from './kpi-date-context.js';
69
69
  export * from './see-records/index.js';
70
+ export * from './card-data-source/index.js';
71
+ export { filterReachInput, filterReachOnCard } from './filter-reach-decision.js';
72
+ export { buildCardFilterDefinition } from '../../lib/filter-values/build-card-filter-definition.js';
73
+ export * from './field-folders/index.js';
74
+ export * from './card-field-places.js';
70
75
  export * from './card-settings/index.js';
71
76
  export * from './measure-calculations/index.js';
72
77
  export { bookmarkImpactSentence, describeBookmarkImpact, type BookmarkImpactItem, } from '../dashboard-viewer/bookmark-impact.js';
@@ -74,7 +79,7 @@ export { prepareLoadedDashboard } from '../../lib/dashboard-inputs/prepare-loade
74
79
  export { buildFilterInputFromField, buildFilterInputFromDefinition, applyFilterSettingsChange } from '../../lib/dashboard-inputs/filter-settings.js';
75
80
  export { relationshipRouteTarget } from '../../lib/dashboard-inputs/dashboard-filter-value-identity.js';
76
81
  export type { FilterSettingsChange, FilterValueEffect } from '../../lib/dashboard-inputs/filter-settings.js';
77
- export { describeDashboardFilterCardReach, describeDashboardFilterCardReachDetail, type DashboardFilterCardReach, type DashboardFilterCardReachDetail, type DashboardRelationshipReachResolver, } from '../../lib/query-context/dashboard-filter-mapping-resolution.js';
82
+ export { describeDashboardFilterCardReach, describeDashboardFilterCardReachDetail, isFilterCardReached, type DashboardFilterCardReached, type DashboardFilterCardReach, type DashboardFilterCardReachDetail, type DashboardRelationshipReachResolver, } from '../../lib/query-context/dashboard-filter-mapping-resolution.js';
78
83
  export { changeCardType, sharedCardPreferences, type CardTypeChange, type CardTypeChangeOptions, } from '../../lib/utils/card-type-change.js';
79
84
  export { buildSavedEditorCard } from '../../lib/utils/build-saved-editor-card.js';
80
85
  export { getCardDefinition, type AuthoredCardFields } from '../../lib/utils/card-definition.js';
@@ -150,6 +150,8 @@ export type OutlinePinnedFilter = {
150
150
  filterId: string;
151
151
  label: string;
152
152
  field: string;
153
+ /** The field's dataset: the card's own, one it joins, or a related one (dashboard filter fields DF-D8). */
154
+ datasetName?: string;
153
155
  } & ReturnType<typeof readLoadedFilterDefault>;
154
156
  export declare function outlinePinnedFilters(card: TCard, calendar?: CalendarContext): OutlinePinnedFilter[];
155
157
  /** Every filter on the dashboard, in the filter model's order. */
@@ -1,6 +1,7 @@
1
1
  import { OperationTemporalState } from '../../analytics-protocol/operation-temporal-state.js';
2
2
  import { RawTemporalValueMetadata, SemaphorResultColumn } from '../../analytics-protocol/contracts.js';
3
3
  import { SeeRecordsColumnRef } from './request.js';
4
+ import { FieldFolder } from '../field-folders/index.js';
4
5
  /** One line per record of the grain dataset, or one line per value of a group column. */
5
6
  export type SeeRecordsShape = 'rows' | 'groups';
6
7
  /**
@@ -28,28 +29,12 @@ export type SeeRecordsColumn = {
28
29
  */
29
30
  rawTemporal?: RawTemporalValueMetadata;
30
31
  };
31
- /** One folder of More columns: a dataset and the fields a list can add from it. */
32
- export type SeeRecordsColumnFolder = {
33
- /** As a column ref names it (`SeeRecordsColumnRef.dataset`). */
34
- dataset: string;
35
- label: string;
36
- /** The datasets' labels from the line's dataset to this one; empty for the line's own. */
37
- path: readonly string[];
38
- columns: readonly {
39
- field: string;
40
- label: string;
41
- }[];
42
- /**
43
- * The folder this one opens from (see-records related columns P2-14): the
44
- * dataset one step nearer the line on its route, and, when that step joins
45
- * on one field the parent offers, that field, so the picker nests the
46
- * folder under it. Absent on the line's own folder.
47
- */
48
- parent?: {
49
- dataset: string;
50
- field?: string;
51
- };
52
- };
32
+ /**
33
+ * One folder of More columns: a dataset and the fields a list can add from it,
34
+ * nested at the key that reaches it. The shared field folder (one base per
35
+ * card OB-D20), the same the card editor's field list draws.
36
+ */
37
+ export type SeeRecordsColumnFolder = FieldFolder;
53
38
  export type SeeRecordsResult = {
54
39
  shape: SeeRecordsShape;
55
40
  /** The listed measure's label, then the click's label when it has one. */