derive-dashboards 0.1.1 → 0.3.0

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 (202) hide show
  1. package/README.md +5 -3
  2. package/dist/cache.mjs +2 -1
  3. package/dist/cli/add.mjs +130 -0
  4. package/dist/cli/cli.mjs +14 -12
  5. package/dist/cli/config.mjs +12 -1
  6. package/dist/cli/doctor.mjs +162 -0
  7. package/dist/cli/init.mjs +3 -2
  8. package/dist/cli/json.mjs +21 -0
  9. package/dist/cli/layers.mjs +33 -0
  10. package/dist/core/document/display.d.mts +63 -0
  11. package/dist/core/document/display.mjs +139 -0
  12. package/dist/core/document/layout.mjs +1 -1
  13. package/dist/core/document/view-layout.d.mts +14 -0
  14. package/dist/core/document/view-layout.mjs +157 -0
  15. package/dist/core/engine/filter.mjs +2 -2
  16. package/dist/core/engine/leaf.mjs +9 -4
  17. package/dist/core/engine/members.mjs +1 -1
  18. package/dist/core/engine/version.d.mts +5 -4
  19. package/dist/core/engine/version.mjs +5 -4
  20. package/dist/core/error/codes.d.mts +4 -1
  21. package/dist/core/error/codes.mjs +4 -1
  22. package/dist/core/index.d.mts +12 -8
  23. package/dist/core/index.mjs +11 -7
  24. package/dist/core/model/member.mjs +5 -2
  25. package/dist/core/model/types.d.mts +13 -13
  26. package/dist/core/model/validate/drill.mjs +6 -15
  27. package/dist/core/model/validate/fields.mjs +130 -0
  28. package/dist/core/model/validate/index.mjs +11 -3
  29. package/dist/core/model/validate/known-members.mjs +133 -0
  30. package/dist/core/model/validate/known-nested.mjs +85 -0
  31. package/dist/core/model/validate/known.mjs +94 -0
  32. package/dist/core/model/validate/members.mjs +7 -4
  33. package/dist/core/model/validate/source.mjs +8 -1
  34. package/dist/core/policy/bind-query.d.mts +12 -0
  35. package/dist/core/policy/bind-query.mjs +53 -0
  36. package/dist/core/query/alias.mjs +11 -1
  37. package/dist/core/query/drill/selection.d.mts +7 -2
  38. package/dist/core/query/drill/selection.mjs +18 -15
  39. package/dist/core/query/filter.d.mts +6 -0
  40. package/dist/core/query/picks.d.mts +8 -2
  41. package/dist/core/query/picks.mjs +11 -4
  42. package/dist/core/query/segments.mjs +2 -1
  43. package/dist/core/result/columns.d.mts +10 -1
  44. package/dist/core/result/columns.mjs +27 -5
  45. package/dist/core/result/time-axis.d.mts +23 -0
  46. package/dist/core/result/time-axis.mjs +72 -0
  47. package/dist/core/result/types.d.mts +36 -1
  48. package/dist/core/schema/aliases.d.mts +7 -0
  49. package/dist/core/schema/aliases.mjs +77 -0
  50. package/dist/core/schema/answer-parts.mjs +23 -1
  51. package/dist/core/schema/answers.d.mts +204 -0
  52. package/dist/core/schema/answers.mjs +2 -0
  53. package/dist/core/schema/index.d.mts +3 -2
  54. package/dist/core/schema/index.mjs +3 -2
  55. package/dist/core/schema/query.d.mts +81 -0
  56. package/dist/core/schema/query.mjs +9 -5
  57. package/dist/core/schema/tools.d.mts +2 -0
  58. package/dist/core/schema/tools.mjs +27 -1
  59. package/dist/core/time/bucket.mjs +8 -2
  60. package/dist/core/types/api.d.mts +7 -1
  61. package/dist/core/types/api.mjs +1 -1
  62. package/dist/dashboards.mjs +4 -0
  63. package/dist/drill-change.mjs +1 -1
  64. package/dist/drill-seal.mjs +1 -0
  65. package/dist/editing.mjs +2 -2
  66. package/dist/endpoints/dashboards.mjs +17 -2
  67. package/dist/endpoints/index.d.mts +15 -2
  68. package/dist/endpoints/meta.mjs +10 -1
  69. package/dist/execute.mjs +32 -17
  70. package/dist/handler.mjs +5 -1
  71. package/dist/index.mjs +6 -1
  72. package/dist/llms.txt +22 -0
  73. package/dist/mcp/format.mjs +42 -8
  74. package/dist/mcp/query.mjs +34 -4
  75. package/dist/postgres-store.mjs +1 -0
  76. package/dist/react/Canvas.mjs +28 -5
  77. package/dist/react/Cell.mjs +2 -1
  78. package/dist/react/Dashboard.d.mts +4 -0
  79. package/dist/react/Dashboard.mjs +27 -4
  80. package/dist/react/DashboardList.mjs +22 -22
  81. package/dist/react/DashboardListRow.mjs +49 -0
  82. package/dist/react/Discard.mjs +5 -2
  83. package/dist/react/Editing.mjs +19 -5
  84. package/dist/react/FilterBar.d.mts +7 -9
  85. package/dist/react/Grid.mjs +7 -19
  86. package/dist/react/Header.mjs +1 -1
  87. package/dist/react/History.mjs +5 -0
  88. package/dist/react/ReadFailed.mjs +23 -0
  89. package/dist/react/Spaces.mjs +15 -1
  90. package/dist/react/Tile.d.mts +2 -0
  91. package/dist/react/Tile.mjs +45 -10
  92. package/dist/react/_virtual/_rolldown/runtime.mjs +12 -0
  93. package/dist/react/arrange-steps.mjs +16 -13
  94. package/dist/react/arrange.mjs +10 -3
  95. package/dist/react/builder/Calcs.mjs +35 -11
  96. package/dist/react/builder/FilterEditor.mjs +196 -0
  97. package/dist/react/builder/Filters.mjs +172 -116
  98. package/dist/react/builder/Formula.mjs +82 -0
  99. package/dist/react/builder/Groups.mjs +1 -0
  100. package/dist/react/builder/Preview.mjs +1 -1
  101. package/dist/react/builder/RangeEditor.mjs +184 -0
  102. package/dist/react/builder/Sections.mjs +41 -6
  103. package/dist/react/builder/Time.mjs +138 -60
  104. package/dist/react/builder/Values.mjs +85 -0
  105. package/dist/react/builder/WidgetBuilder.mjs +50 -49
  106. package/dist/react/builder/base.d.mts +5 -0
  107. package/dist/react/builder/base.mjs +33 -8
  108. package/dist/react/builder/calc.mjs +15 -1
  109. package/dist/react/builder/escape.d.mts +1 -0
  110. package/dist/react/builder/escape.mjs +62 -0
  111. package/dist/react/builder/filter-tree.d.mts +9 -0
  112. package/dist/react/builder/filter-tree.mjs +186 -0
  113. package/dist/react/builder/formula-parse.d.mts +18 -0
  114. package/dist/react/builder/formula-parse.mjs +136 -0
  115. package/dist/react/builder/labels.d.mts +1 -1
  116. package/dist/react/builder/state.d.mts +2 -1
  117. package/dist/react/builder/state.mjs +23 -37
  118. package/dist/react/builder/useBuilder.d.mts +12 -1
  119. package/dist/react/builder/useBuilder.mjs +6 -3
  120. package/dist/react/builder/words.d.mts +59 -0
  121. package/dist/react/builder/words.mjs +73 -0
  122. package/dist/react/context.d.mts +15 -1
  123. package/dist/react/context.mjs +9 -3
  124. package/dist/react/drill/Bars.mjs +2 -2
  125. package/dist/react/drill/props.mjs +2 -1
  126. package/dist/react/drill/useDrill.d.mts +1 -1
  127. package/dist/react/drill/words.d.mts +3 -0
  128. package/dist/react/drill/words.mjs +2 -0
  129. package/dist/react/english.mjs +20 -5
  130. package/dist/react/filters/bar.d.mts +12 -0
  131. package/dist/react/filters/bar.mjs +135 -0
  132. package/dist/react/filters/calendar.mjs +193 -0
  133. package/dist/react/filters/chip.mjs +174 -0
  134. package/dist/react/filters/context.d.mts +22 -0
  135. package/dist/react/filters/context.mjs +78 -0
  136. package/dist/react/filters/dates.mjs +89 -0
  137. package/dist/react/filters/days.d.mts +36 -0
  138. package/dist/react/filters/days.mjs +87 -0
  139. package/dist/react/filters/field-step.mjs +81 -0
  140. package/dist/react/filters/hooks.d.mts +34 -0
  141. package/dist/react/filters/hooks.mjs +94 -0
  142. package/dist/react/filters/listbox.mjs +131 -0
  143. package/dist/react/filters/logic.d.mts +59 -0
  144. package/dist/react/filters/logic.mjs +109 -0
  145. package/dist/react/filters/menu-search.mjs +211 -0
  146. package/dist/react/filters/menu.mjs +85 -0
  147. package/dist/react/filters/number.mjs +127 -0
  148. package/dist/react/filters/numbers.d.mts +47 -0
  149. package/dist/react/filters/numbers.mjs +151 -0
  150. package/dist/react/filters/operator.mjs +104 -0
  151. package/dist/react/filters/phone.mjs +104 -0
  152. package/dist/react/filters/popover.d.mts +19 -0
  153. package/dist/react/filters/popover.mjs +153 -0
  154. package/dist/react/filters/rules.d.mts +8 -0
  155. package/dist/react/filters/rules.mjs +55 -0
  156. package/dist/react/filters/sheet.mjs +196 -0
  157. package/dist/react/filters/state.mjs +132 -0
  158. package/dist/react/filters/suggest.d.mts +47 -0
  159. package/dist/react/filters/suggest.mjs +97 -0
  160. package/dist/react/filters/values.mjs +166 -0
  161. package/dist/react/filters/words.d.mts +81 -0
  162. package/dist/react/filters/words.mjs +73 -0
  163. package/dist/react/format.mjs +11 -4
  164. package/dist/react/index.d.mts +15 -6
  165. package/dist/react/index.mjs +10 -4
  166. package/dist/react/messages.d.mts +34 -2
  167. package/dist/react/place.mjs +7 -3
  168. package/dist/react/renderers/index.d.mts +3 -21
  169. package/dist/react/renderers/index.mjs +68 -6
  170. package/dist/react/renderers/list.d.mts +2 -1
  171. package/dist/react/renderers/list.mjs +9 -12
  172. package/dist/react/renderers/props.d.mts +26 -0
  173. package/dist/react/scope.d.mts +4 -0
  174. package/dist/react/scope.mjs +19 -2
  175. package/dist/react/series-slots.d.mts +37 -0
  176. package/dist/react/series-slots.mjs +71 -0
  177. package/dist/react/series.d.mts +39 -9
  178. package/dist/react/series.mjs +144 -47
  179. package/dist/react/theme.css +930 -19
  180. package/dist/react/useBoard.d.mts +2 -0
  181. package/dist/react/useDashboard.d.mts +3 -0
  182. package/dist/react/useDashboard.mjs +6 -0
  183. package/dist/react/view-grid.mjs +16 -0
  184. package/dist/recharts/axes.mjs +28 -0
  185. package/dist/recharts/axis.mjs +84 -0
  186. package/dist/recharts/bar.d.mts +7 -0
  187. package/dist/recharts/bar.mjs +141 -0
  188. package/dist/recharts/charts.d.mts +4 -5
  189. package/dist/recharts/charts.mjs +2 -208
  190. package/dist/recharts/index.d.mts +3 -1
  191. package/dist/recharts/index.mjs +4 -1
  192. package/dist/recharts/line.d.mts +2 -0
  193. package/dist/recharts/line.mjs +112 -0
  194. package/dist/recharts/marks.mjs +47 -18
  195. package/dist/recharts/parts.mjs +103 -0
  196. package/dist/recharts/table.mjs +71 -0
  197. package/dist/records-read.mjs +1 -1
  198. package/dist/registry/filter-bar.json +26 -0
  199. package/dist/skills/derive-dashboards/SKILL.md +69 -0
  200. package/dist/store/apply.mjs +3 -1
  201. package/package.json +6 -2
  202. package/dist/react/FilterBar.mjs +0 -119
@@ -0,0 +1,139 @@
1
+ import { canonical } from "../value/canonical.mjs";
2
+ // src/document/display.ts
3
+ /** Options every widget takes. */
4
+ const SHARED = {
5
+ keepDateRange: "boolean",
6
+ empty: "text"
7
+ };
8
+ const CHART = {
9
+ ...SHARED,
10
+ colors: "colors"
11
+ };
12
+ /** The options of each kind of widget the library draws, and each option's type. */
13
+ const DISPLAY_OPTIONS = {
14
+ number: SHARED,
15
+ table: SHARED,
16
+ list: {
17
+ ...SHARED,
18
+ title: "text",
19
+ subtitle: "texts",
20
+ avatar: "text",
21
+ meta: "text",
22
+ href: "text"
23
+ },
24
+ line: CHART,
25
+ bar: CHART
26
+ };
27
+ /** What each option does, for the builder and for an agent reading a tool definition. */
28
+ const DISPLAY_HELP = {
29
+ keepDateRange: "Keep the widget's own date range over the viewer's and the dashboard's.",
30
+ empty: "What the tile says when its answer has no rows.",
31
+ colors: "A colour per series, by the series' label: any CSS colour.",
32
+ title: "The query entry shown as the row's title.",
33
+ subtitle: "Query entries shown under the title, joined with a dot.",
34
+ avatar: "The query entry whose initials make the row's avatar.",
35
+ meta: "The query entry shown as the number at the end of the row.",
36
+ href: "A link per row, with {entry} replaced by that entry's value: \"/tasks/{id}\"."
37
+ };
38
+ const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
39
+ const isText = (value) => typeof value === "string";
40
+ const TYPES = {
41
+ boolean: {
42
+ fits: (v) => typeof v === "boolean",
43
+ takes: "true or false"
44
+ },
45
+ text: {
46
+ fits: isText,
47
+ takes: "text"
48
+ },
49
+ texts: {
50
+ fits: (v) => Array.isArray(v) && v.every((entry) => isText(entry)),
51
+ takes: "a list of texts"
52
+ },
53
+ colors: {
54
+ fits: (v) => isRecord(v) && Object.values(v).every((color) => isText(color)),
55
+ takes: "a colour for each series label, as text",
56
+ read: (v) => isRecord(v) ? Object.fromEntries(Object.entries(v).filter(([, color]) => isText(color))) : void 0
57
+ }
58
+ };
59
+ /** The part of a stored option a renderer can use: all of it when it is of its type, else what `read` keeps. */
60
+ function usable(type, value) {
61
+ const rule = TYPES[type];
62
+ return rule.fits(value) ? value : rule.read?.(value);
63
+ }
64
+ /** A kind's options by name; none for a kind the library does not draw. */
65
+ function optionsOf(kind) {
66
+ return Object.hasOwn(DISPLAY_OPTIONS, kind) ? DISPLAY_OPTIONS[kind] : void 0;
67
+ }
68
+ /** The options a display sets that are not of their type, by name. */
69
+ function misfits(options, display) {
70
+ return Object.entries(options).filter(([name, type]) => display[name] !== void 0 && !TYPES[type].fits(display[name]));
71
+ }
72
+ /**
73
+ * What is wrong with a widget's display for its kind: each option of the wrong type, at its
74
+ * path. None for a kind the library does not draw, and none for an option it does not know.
75
+ */
76
+ function displayIssues(kind, display, path = []) {
77
+ const options = optionsOf(kind);
78
+ if (display === void 0 || options === void 0) return [];
79
+ if (!isRecord(display)) return [{
80
+ code: "DISPLAY_INVALID",
81
+ message: "display is an object of options.",
82
+ path
83
+ }];
84
+ return misfits(options, display).map(([name, type]) => ({
85
+ code: "DISPLAY_INVALID",
86
+ message: `A ${kind}'s ${name} is ${TYPES[type].takes}.`,
87
+ path: [...path, name]
88
+ }));
89
+ }
90
+ /** Every widget of a document whose display does not fit its kind, at `widgets.<id>.display`. */
91
+ function documentDisplayIssues(doc) {
92
+ return Object.entries(doc.widgets).flatMap(([id, widget]) => displayIssues(widget.kind, widget.display, [
93
+ "widgets",
94
+ id,
95
+ "display"
96
+ ]));
97
+ }
98
+ /**
99
+ * A widget's options as its kind reads them: each option it knows, when it is of its type. A
100
+ * stored option of the wrong type (written before options were checked, or by hand) is left
101
+ * out, never guessed at, so a renderer needs no check of its own; of a map of colours, the
102
+ * colours that are text are kept.
103
+ */
104
+ function displayOf(kind, display) {
105
+ const options = DISPLAY_OPTIONS[kind];
106
+ const given = isRecord(display) ? display : {};
107
+ const read = Object.entries(options).flatMap(([name, type]) => {
108
+ const value = usable(type, given[name]);
109
+ return value === void 0 ? [] : [[name, value]];
110
+ });
111
+ return Object.fromEntries(read);
112
+ }
113
+ /** An option as an object holds it: none when it has no such option, which is not the same as holding null. */
114
+ const held = (display, option) => Object.hasOwn(display, option) ? { is: display[option] ?? null } : null;
115
+ /**
116
+ * What an edit did wrong to a display: each option of the wrong type that the edit set or
117
+ * changed, at `widgets.<id>.display.<option>`. Only what the edit touched is checked: an option
118
+ * stored before options were typed stays as it is, so it never blocks an edit of something
119
+ * else, and replaying a draft's own commands never refuses one that was accepted.
120
+ */
121
+ function editedDisplayIssues(before, after) {
122
+ return Object.entries(after.widgets).flatMap(([id, widget]) => {
123
+ const was = before.widgets[id]?.display;
124
+ const old = isRecord(was) ? was : {};
125
+ const now = widget.display;
126
+ return displayIssues(widget.kind, now, [
127
+ "widgets",
128
+ id,
129
+ "display"
130
+ ]).filter((found) => {
131
+ const option = String(found.path.at(-1));
132
+ const [set, had] = isRecord(now) ? [held(now, option), held(old, option)] : [now, was];
133
+ return canonical(set ?? null) !== canonical(had ?? null);
134
+ });
135
+ });
136
+ }
137
+ /** The options every widget takes, whatever draws it: `keepDateRange` and `empty`. */
138
+ const sharedDisplay = (display) => displayOf("table", display);
139
+ export { DISPLAY_HELP, DISPLAY_OPTIONS, displayIssues, displayOf, documentDisplayIssues, editedDisplayIssues, sharedDisplay };
@@ -225,4 +225,4 @@ function repairLayout(doc) {
225
225
  }]
226
226
  };
227
227
  }
228
- export { GRID_COLUMNS, closeGaps, closeGapsCommands, compact, freeSpot, layoutGaps, packInto, placeItem, repairLayout };
228
+ export { GRID_COLUMNS, closeGaps, closeGapsCommands, compact, freeSpot, layoutGaps, overlaps, packInto, placeItem, repairLayout };
@@ -0,0 +1,14 @@
1
+ import { LayoutItem } from "./types.mjs";
2
+ /** The smallest a tile of this kind can be; a kind the kit does not know gets the number's size. */
3
+ export declare const smallestFor: (kind: string | undefined) => {
4
+ w: number;
5
+ h: number;
6
+ };
7
+ /**
8
+ * The layout as a viewer sees it, whatever was saved: every tile at least the size its kind
9
+ * reads at, nothing overlapping, no empty rows, no gap in the middle of a row, each row using
10
+ * the grid's whole width (its spare columns shared between its tiles), and a tile beside a
11
+ * taller one as tall as it. The saved layout is never changed; an editor draws it as saved.
12
+ * The order of tiles is kept.
13
+ */
14
+ export declare function viewLayout(layout: readonly LayoutItem[], kindOf: (widget: string) => string | undefined): LayoutItem[];
@@ -0,0 +1,157 @@
1
+ import { closeGaps, compact, layoutGaps, overlaps, packInto } from "./layout.mjs";
2
+ // src/document/view-layout.ts
3
+ /** The smallest each kind of tile reads at: a chart needs room for its axes, a table for rows. */
4
+ const SMALLEST = {
5
+ number: {
6
+ w: 2,
7
+ h: 2
8
+ },
9
+ line: {
10
+ w: 4,
11
+ h: 3
12
+ },
13
+ bar: {
14
+ w: 4,
15
+ h: 3
16
+ },
17
+ table: {
18
+ w: 4,
19
+ h: 3
20
+ },
21
+ list: {
22
+ w: 3,
23
+ h: 3
24
+ }
25
+ };
26
+ /** The smallest a tile of this kind can be; a kind the kit does not know gets the number's size. */
27
+ const smallestFor = (kind) => (kind === void 0 ? void 0 : SMALLEST[kind]) ?? {
28
+ w: 2,
29
+ h: 2
30
+ };
31
+ /**
32
+ * The tiles of one row band: items that start on the same row, are the same height and nothing
33
+ * else shares their rows. Their free columns at the right are shared out between them.
34
+ */
35
+ function rowBands(layout) {
36
+ const byRow = /* @__PURE__ */ new Map();
37
+ for (const item of layout) {
38
+ const key = `${String(item.y)}:${String(item.h)}`;
39
+ byRow.set(key, [...byRow.get(key) ?? [], item]);
40
+ }
41
+ return [...byRow.values()].map((band) => band.toSorted((a, b) => a.x - b.x)).filter((band) => {
42
+ const [first] = band;
43
+ if (first === void 0) return false;
44
+ const ids = new Set(band.map((i) => i.widget));
45
+ const rows = {
46
+ ...first,
47
+ x: 0,
48
+ w: 12
49
+ };
50
+ return !layout.some((other) => !ids.has(other.widget) && overlaps(other, rows));
51
+ });
52
+ }
53
+ /** A band's free columns at the right, shared out between its tiles, the leftmost first. */
54
+ function widened(band) {
55
+ const spare = 12 - band.reduce((sum, item) => sum + item.w, 0);
56
+ if (spare <= 0) return [...band];
57
+ const each = Math.floor(spare / band.length);
58
+ const extra = spare % band.length;
59
+ let x = 0;
60
+ return band.map((item, i) => {
61
+ const w = item.w + each + (i < extra ? 1 : 0);
62
+ const at = {
63
+ ...item,
64
+ x,
65
+ w
66
+ };
67
+ x += w;
68
+ return at;
69
+ });
70
+ }
71
+ /** A tile with free columns at its right that nothing else uses grows into them. */
72
+ function grownRight(layout) {
73
+ let current = [...layout];
74
+ for (const item of layout.toSorted((a, b) => a.y - b.y || b.x - a.x)) {
75
+ const at = current.find((i) => i.widget === item.widget);
76
+ if (at === void 0) continue;
77
+ const others = current.filter((i) => i.widget !== item.widget);
78
+ let w = at.w;
79
+ while (at.x + w < 12 && !others.some((o) => overlaps(o, {
80
+ ...at,
81
+ w: w + 1
82
+ }))) w += 1;
83
+ if (w !== at.w) current = current.map((i) => i.widget === at.widget ? {
84
+ ...at,
85
+ w
86
+ } : i);
87
+ }
88
+ return current;
89
+ }
90
+ /** A tile beside a taller one that starts on its row grows down to match it, into free space. */
91
+ function grownDown(layout) {
92
+ let current = [...layout];
93
+ for (const item of layout) {
94
+ const at = current.find((i) => i.widget === item.widget);
95
+ if (at === void 0) continue;
96
+ const bottom = Math.max(...current.filter((i) => i.y === at.y).map((i) => i.y + i.h));
97
+ const others = current.filter((i) => i.widget !== item.widget);
98
+ let h = at.h;
99
+ while (at.y + h < bottom && !others.some((o) => overlaps(o, {
100
+ ...at,
101
+ h: h + 1
102
+ }))) h += 1;
103
+ if (h !== at.h) current = current.map((i) => i.widget === at.widget ? {
104
+ ...at,
105
+ h
106
+ } : i);
107
+ }
108
+ return current;
109
+ }
110
+ /** Each tile, top to bottom, rises into free space above it, so no hole sits over a tile. */
111
+ function risen(layout) {
112
+ let current = [...layout];
113
+ for (const item of layout.toSorted((a, b) => a.y - b.y || a.x - b.x)) {
114
+ const at = current.find((i) => i.widget === item.widget);
115
+ if (at === void 0) continue;
116
+ const others = current.filter((i) => i.widget !== item.widget);
117
+ let y = at.y;
118
+ while (y > 0 && !others.some((o) => overlaps(o, {
119
+ ...at,
120
+ y: y - 1
121
+ }))) y -= 1;
122
+ if (y !== at.y) current = current.map((i) => i.widget === at.widget ? {
123
+ ...at,
124
+ y
125
+ } : i);
126
+ }
127
+ return current;
128
+ }
129
+ /** Holes closed until none is left: closing one can open room beside a tile it passed. */
130
+ function gapless(layout) {
131
+ let current = risen(layout);
132
+ for (let n = 0; n < 48 && layoutGaps(current).length > 0; n += 1) current = risen(closeGaps(current).layout);
133
+ return compact(current);
134
+ }
135
+ /**
136
+ * The layout as a viewer sees it, whatever was saved: every tile at least the size its kind
137
+ * reads at, nothing overlapping, no empty rows, no gap in the middle of a row, each row using
138
+ * the grid's whole width (its spare columns shared between its tiles), and a tile beside a
139
+ * taller one as tall as it. The saved layout is never changed; an editor draws it as saved.
140
+ * The order of tiles is kept.
141
+ */
142
+ function viewLayout(layout, kindOf) {
143
+ const sized = layout.map((item) => {
144
+ const least = smallestFor(kindOf(item.widget));
145
+ return {
146
+ ...item,
147
+ w: Math.max(item.w, least.w),
148
+ h: Math.max(item.h, least.h)
149
+ };
150
+ });
151
+ const closed = gapless(packInto([], sized));
152
+ const bands = new Map(rowBands(closed).flatMap((band) => widened(band).map((item) => [item.widget, item])));
153
+ const filled = gapless(grownDown(grownRight(closed.map((item) => bands.get(item.widget) ?? item))));
154
+ const order = new Map(layout.map((item, i) => [item.widget, i]));
155
+ return filled.toSorted((a, b) => (order.get(a.widget) ?? 0) - (order.get(b.widget) ?? 0));
156
+ }
157
+ export { smallestFor, viewLayout };
@@ -28,7 +28,7 @@ function filterSql(b, scope, filter) {
28
28
  if ("not" in filter) return sql`NOT ${filterSql(b, scope, filter.not)}`;
29
29
  if ("some" in filter) return childSql(b, scope, filter.some, false);
30
30
  if ("none" in filter) return childSql(b, scope, filter.none, true);
31
- return leafSql(b, memberSql(b, scope, filter.member), filter.op, filter.values);
31
+ return leafSql(b, memberSql(b, scope, filter.member), filter);
32
32
  }
33
33
  /** A bound row policy speaks about physical columns. */
34
34
  function policySql(b, alias, filter) {
@@ -40,7 +40,7 @@ function policySql(b, alias, filter) {
40
40
  type: typeOfValues(filter.values),
41
41
  collation: "binary"
42
42
  };
43
- return leafSql(b, operand, filter.op, filter.values);
43
+ return leafSql(b, operand, filter);
44
44
  }
45
45
  /** Through a via: the parent row exists and carries the via's terms. */
46
46
  function viaSql(b, alias, via) {
@@ -74,7 +74,7 @@ function eq(c, x, y, value) {
74
74
  if (c.operand.type !== "string") return beside(c, [...bound(c, value, "over"), ...bound(c, value, "under")], sql`${x} = ${y}`);
75
75
  if (!c.side.plain) {
76
76
  const part = sql`${c.b.dialect.binary(x)} = ${y}`;
77
- if (value === void 0) return part;
77
+ if (value === void 0 || c.broad) return part;
78
78
  return sql`(${part} AND ${c.b.dialect.fold(c.operand.sql)} = ${param(c.b, value, c.operand)})`;
79
79
  }
80
80
  const native = c.operand.native;
@@ -120,16 +120,21 @@ const isNegative = (op) => op in NEGATION_OF;
120
120
  * or of another type is FALSE before any SQL), so it is never unknown; it stands bare, where
121
121
  * an index on the column can answer it.
122
122
  */
123
- function leafSql(b, operand, op, values) {
123
+ function leafSql(b, operand, leaf) {
124
+ const { op, values } = leaf;
124
125
  if (op === "set") return sql`(${operand.sql} IS NOT NULL)`;
125
126
  if (op === "notSet") return sql`(${operand.sql} IS NULL)`;
126
- if (isNegative(op)) return sql`NOT ${leafSql(b, operand, NEGATION_OF[op], values)}`;
127
+ if (isNegative(op)) return sql`NOT ${leafSql(b, operand, {
128
+ ...leaf,
129
+ op: NEGATION_OF[op]
130
+ })}`;
127
131
  const side = columnSide(b, operand, op, values);
128
132
  const test = POSITIVE[op]({
129
133
  b,
130
134
  operand,
131
135
  side,
132
- values
136
+ values,
137
+ broad: leaf.broad === true
133
138
  });
134
139
  return sql`(${operand.sql} IS NOT NULL AND ${test})`;
135
140
  }
@@ -57,7 +57,7 @@ function caseSql(ctx, expr) {
57
57
  sql: left,
58
58
  type: typeOfValues(branch.when.values),
59
59
  collation: "binary"
60
- }, branch.when.op, branch.when.values);
60
+ }, branch.when);
61
61
  return sql`WHEN ${test} THEN ${exprSql(ctx, branch.then)}`;
62
62
  });
63
63
  const otherwise = expr.else === void 0 ? sql`NULL` : exprSql(ctx, expr.else);
@@ -1,7 +1,8 @@
1
1
  /**
2
- * The fingerprint of every source file that can change an answer: everything the engine and
3
- * tile composition import, at any depth. A cache keys its entries by it,
4
- * so an answer cached by older code is never read. `test/engine-version.test.ts` checks it
2
+ * The fingerprint of every core source file that can change an answer: everything the engine,
3
+ * tile composition and the answer's shaping (`result/`) import, at any depth. A cache keys its
4
+ * entries by it, and by the contract version (the answer's schema), so an answer cached by
5
+ * older code, or in an older shape, is never read. `test/engine-version.test.ts` checks it
5
6
  * against the files and prints the new value when they change.
6
7
  */
7
- export declare const ENGINE_VERSION = "c50d674f90366532";
8
+ export declare const ENGINE_VERSION = "39e23974f1075615";
@@ -1,9 +1,10 @@
1
1
  // src/engine/version.ts
2
2
  /**
3
- * The fingerprint of every source file that can change an answer: everything the engine and
4
- * tile composition import, at any depth. A cache keys its entries by it,
5
- * so an answer cached by older code is never read. `test/engine-version.test.ts` checks it
3
+ * The fingerprint of every core source file that can change an answer: everything the engine,
4
+ * tile composition and the answer's shaping (`result/`) import, at any depth. A cache keys its
5
+ * entries by it, and by the contract version (the answer's schema), so an answer cached by
6
+ * older code, or in an older shape, is never read. `test/engine-version.test.ts` checks it
6
7
  * against the files and prints the new value when they change.
7
8
  */
8
- const ENGINE_VERSION = "c50d674f90366532";
9
+ const ENGINE_VERSION = "39e23974f1075615";
9
10
  export { ENGINE_VERSION };
@@ -30,13 +30,14 @@ export declare const MODEL_ISSUES: {
30
30
  readonly JOIN_TARGET_UNKNOWN: "A join targets a source that does not exist.";
31
31
  readonly KEY_MISSING: "A source has no unique key.";
32
32
  readonly MEMBER_NAME_CLASH: "Two members of a source share a name.";
33
+ readonly MODEL_FIELD_UNKNOWN: "The model holds a field the library does not know: a misspelling, or a field of another kind.";
33
34
  readonly MODEL_FILTER_NOT_BOUND: "A filter in the model uses a viewer value or a variable.";
34
35
  readonly MODEL_SHAPE: "A member of the model has a kind, merge or storage that does not exist, or lacks a field its kind needs.";
35
36
  readonly MODEL_VERSION: "The model version is not 1.";
36
37
  readonly NAME_INVALID: "A name is not a letter followed by letters, digits or underscores.";
37
38
  readonly NUMERIC_SCALE: "An exact number's scale is not a whole number from 0 to 38.";
38
39
  readonly OPEN_POLICY_UNACKNOWLEDGED: "A source that allows every row joins a guarded one without acknowledgeOpenPolicy.";
39
- readonly PARTITION_UNKNOWN: "A partition names a dimension that does not exist.";
40
+ readonly PARTITION_UNSUPPORTED: "A snapshot measure (partitionBy) is not computed yet; the model refuses it.";
40
41
  readonly PERCENTILE_MERGE: "A percentile has a merge other than \"none\".";
41
42
  readonly POLICY_COLUMN_MISSING: "A policy leaf has no column.";
42
43
  readonly POLICY_EXISTS_RESERVED: "A policy uses a grant table (exists), which is reserved.";
@@ -135,6 +136,7 @@ export declare const DOCUMENT_REFUSALS: {
135
136
  readonly DOCUMENT_INVALID: "A stored or code-defined dashboard document does not match the document schema.";
136
137
  readonly DOCUMENT_TOO_NEW: "A dashboard document was written by a newer version of the library than this one.";
137
138
  readonly CONTROL_UNKNOWN: "The edit names a control that does not exist.";
139
+ readonly DISPLAY_INVALID: "An edit sets a widget's display option to the wrong type for its kind (a line's colors that is not a map of colours). Named in the issues of EDIT_REFUSED; the reducer itself applies any display, so a draft's stored commands replay.";
138
140
  readonly LOCK_UNKNOWN: "The edit names a lock that does not exist.";
139
141
  readonly TAB_UNKNOWN: "The edit names a tab that does not exist.";
140
142
  readonly TAB_EXISTS: "A tab with that id already exists.";
@@ -168,6 +170,7 @@ export declare const BASE_ERROR_CODES: {
168
170
  QUERY_TIMEOUT: RawError<"QUERY_TIMEOUT">;
169
171
  RETRYABLE: RawError<"RETRYABLE">;
170
172
  INTERNAL: RawError<"INTERNAL">;
173
+ CANCELLED: RawError<"CANCELLED">;
171
174
  NO_HANDLER: RawError<"NO_HANDLER">;
172
175
  DRILL_DENIED: RawError<"DRILL_DENIED">;
173
176
  DRILL_STALE: RawError<"DRILL_STALE">;
@@ -33,13 +33,14 @@ const MODEL_ISSUES = {
33
33
  JOIN_TARGET_UNKNOWN: "A join targets a source that does not exist.",
34
34
  KEY_MISSING: "A source has no unique key.",
35
35
  MEMBER_NAME_CLASH: "Two members of a source share a name.",
36
+ MODEL_FIELD_UNKNOWN: "The model holds a field the library does not know: a misspelling, or a field of another kind.",
36
37
  MODEL_FILTER_NOT_BOUND: "A filter in the model uses a viewer value or a variable.",
37
38
  MODEL_SHAPE: "A member of the model has a kind, merge or storage that does not exist, or lacks a field its kind needs.",
38
39
  MODEL_VERSION: "The model version is not 1.",
39
40
  NAME_INVALID: "A name is not a letter followed by letters, digits or underscores.",
40
41
  NUMERIC_SCALE: "An exact number's scale is not a whole number from 0 to 38.",
41
42
  OPEN_POLICY_UNACKNOWLEDGED: "A source that allows every row joins a guarded one without acknowledgeOpenPolicy.",
42
- PARTITION_UNKNOWN: "A partition names a dimension that does not exist.",
43
+ PARTITION_UNSUPPORTED: "A snapshot measure (partitionBy) is not computed yet; the model refuses it.",
43
44
  PERCENTILE_MERGE: "A percentile has a merge other than \"none\".",
44
45
  POLICY_COLUMN_MISSING: "A policy leaf has no column.",
45
46
  POLICY_EXISTS_RESERVED: "A policy uses a grant table (exists), which is reserved.",
@@ -113,6 +114,7 @@ const DOCUMENT_REFUSALS = {
113
114
  DOCUMENT_INVALID: "A stored or code-defined dashboard document does not match the document schema.",
114
115
  DOCUMENT_TOO_NEW: "A dashboard document was written by a newer version of the library than this one.",
115
116
  CONTROL_UNKNOWN: "The edit names a control that does not exist.",
117
+ DISPLAY_INVALID: "An edit sets a widget's display option to the wrong type for its kind (a line's colors that is not a map of colours). Named in the issues of EDIT_REFUSED; the reducer itself applies any display, so a draft's stored commands replay.",
116
118
  LOCK_UNKNOWN: "The edit names a lock that does not exist.",
117
119
  TAB_UNKNOWN: "The edit names a tab that does not exist.",
118
120
  TAB_EXISTS: "A tab with that id already exists.",
@@ -146,6 +148,7 @@ const BASE_ERROR_CODES = defineErrorCodes({
146
148
  QUERY_TIMEOUT: "The query ran past its deadline.",
147
149
  RETRYABLE: "The request could not complete. Try again.",
148
150
  INTERNAL: "Something went wrong on the server. Its cause is in the host's logs.",
151
+ CANCELLED: "The request was abandoned (the viewer left, or its deadline passed) before it was answered. Its statements were cancelled; nothing is logged.",
149
152
  NO_HANDLER: "No dashboards handler answered at the client's path: mount the handler there or set baseURL.",
150
153
  DRILL_DENIED: "No drill here: the server sets drill: false, the model keeps the source out, the viewer is on a public link, or the host keeps its records back.",
151
154
  DRILL_STALE: "The dashboard changed since the drill was opened. Open it again from the chart.",
@@ -13,39 +13,43 @@ import { DatePart, DimensionDef, EXPR_FUNCTIONS, Expr, ExprCondition, ExprFuncti
13
13
  import { LinearTerm, linearTerms } from "./model/validate/expr.mjs";
14
14
  import { validateModel } from "./model/validate/index.mjs";
15
15
  import { Cuts, Drill, DrillCan, DrillField, DrillOrigin, DrillSemantics, DrillState, DrillStep, DrillView, MAX_DRILL_STEPS, PinnedExecution, Selection } from "./query/drill/types.mjs";
16
- import { viaJoins } from "./model/validate/via.mjs";
16
+ import { ColumnRole, Mark, Receipt, RecordColumn, Result, ResultCell, ResultColumn, ResultRows, TimeAxis, TimeBucket } from "./result/types.mjs";
17
17
  import { Span, inSpan, resolveRange } from "./time/range.mjs";
18
18
  import { NaiveRule, OffsetSegment, offsetSegments, resolveNaive, startOfDate } from "./time/zone.mjs";
19
+ import { viaJoins } from "./model/validate/via.mjs";
19
20
  import { BoundRule, bindFilter, bindPolicy, namedPolicy, viewerValues } from "./policy/bind.mjs";
20
- import { ruleMatches, selectRule } from "./policy/match.mjs";
21
21
  import { Command, CommandBody, CommandId, Display, Doc, LayoutItem, Scope, Tab, TabId, Widget, WidgetId, emptyDoc } from "./document/types.mjs";
22
22
  import { Change, Placement, WidgetPart, changedWidget, diffDocs, markShifted, placementOf, widgetDiff } from "./document/diff.mjs";
23
+ import { DISPLAY_HELP, DISPLAY_OPTIONS, DisplayKind, DisplayOf, displayIssues, displayOf, documentDisplayIssues, editedDisplayIssues, sharedDisplay } from "./document/display.mjs";
23
24
  import { GRID_COLUMNS, Gap, closeGaps, closeGapsCommands, freeSpot, layoutGaps, placeItem, repairLayout } from "./document/layout.mjs";
24
25
  import { Outcome } from "./document/outcome.mjs";
25
26
  import { lockChanged, reduce, reduceAll } from "./document/reduce.mjs";
26
27
  import { Recorded, Replayed, commandWidget, replay } from "./document/replay.mjs";
27
28
  import { readingOrder, stepCommands, stepMoves } from "./document/stacked.mjs";
28
29
  import { EncodeOptions, VIEW_PREFIX, ViewState, encodeView, viewFor, withView } from "./document/view.mjs";
30
+ import { smallestFor, viewLayout } from "./document/view-layout.mjs";
29
31
  import { EXACT_LIMIT, Exact, divideExact, formatExact, parseExact, storedExact } from "./exact/decimal.mjs";
30
32
  import { ExactSum, Operands, rowValue, sumLinear } from "./exact/sum.mjs";
33
+ import { bindQueryViewer, bindViewer } from "./policy/bind-query.mjs";
34
+ import { ruleMatches, selectRule } from "./policy/match.mjs";
31
35
  import { Closure, queryClosure } from "./query/closure.mjs";
32
36
  import { AssertionContext, BoundPolicy, BoundPolicyFilter, ComposeCtx, ComposeDelta, ComposedQuery, CompositionPolicy, DEFAULT_COMPOSITION_POLICY, LockEntry, RequiredEntry, StoredLockEntry } from "./query/compose.mjs";
33
37
  import { ComposedTile, TileInput, composeTile, documentLock, tileInputs } from "./query/compose-tile.mjs";
34
38
  import { AccessParts, effectiveFilter } from "./query/effective.mjs";
35
39
  import { BoundFilter, Leaf, NEGATION_OF, NEGATIVE_OPS, NULL_OPS, NegativeOp, NodeId, NullOp, Op, POSITIVE_OPS, PositiveOp, StoredFilter, ValueLeaf, VariableLeaf, ViewerLeaf, ViewerRef, WireFilter, isBound, isLeaf, stripIds } from "./query/filter.mjs";
36
40
  import { FormulaRef, changeOf, formulaRefs, shareOf } from "./query/formulas.mjs";
37
- import { isDateRange, pickProblem } from "./query/picks.mjs";
41
+ import { isDateRange, isValuePick, pickProblem } from "./query/picks.mjs";
38
42
  import { Alias, QueryReferenceError, toWire } from "./query/to-wire.mjs";
39
43
  import { CalcAlias, Calendar, Cell, Control, ControlId, DateRange, DimensionAlias, DimensionCut, EntryId, ExplicitRange, Format, Formula, FormulaNode, Grain, MeasureAlias, Picks, RefOf, RelativeRange, ResolvedRange, ScopeCoverage, StoredFormulaNode, StoredQuery, TileRef, TypedFilter, TypedQuery, WireQuery } from "./query/types.mjs";
40
- import { memberLabel, recordColumns, resultColumns } from "./result/columns.mjs";
41
- import { isMark, markedRows } from "./result/marks.mjs";
42
- import { ItemLinks, ItemLinksFor, LINK_PART, itemLink, linkTemplateIssues } from "./query/drill/links.mjs";
43
- import { Mark, Receipt, RecordColumn, Result, ResultCell, ResultColumn, ResultRows } from "./result/types.mjs";
44
44
  import "./time/index.mjs";
45
+ import { ItemLinks, ItemLinksFor, LINK_PART, itemLink, linkTemplateIssues } from "./query/drill/links.mjs";
45
46
  import { ApiError, CONTRACT_VERSION, CoreContract, DashboardListResponse, DashboardResponse, DraftResponse, MetaJoin, MetaMember, MetaResponse, PublishResponse, QueryAnswer, QueryLine, RecordsResponse, TileAnswer, TileLine, TileRequest, TileResult, TilesRequest, ValidateResponse, ValuesResponse } from "./types/api.mjs";
46
47
  import { AnswerDrill, ClosedRow, DrillAbilities, DrillAnswer, DrillBody, DrillCrumb, DrillExplanationView, DrillGroupedView, DrillItem, DrillItemsView, DrillOperand, DrillSummary, ItemColumn, SealedAnswer } from "./types/drill-api.mjs";
47
48
  import { CoreApi, CreateDash, Dash, EndpointsByPath, HeadersLike, PluginEndpoints, PluginErrorCodes, ServerCall, ServerCallInput, ServerCalls, UniqueIds } from "./types/infer.mjs";
48
49
  import { CodeDashboard, DashOptions, SecondaryStorage } from "./types/options.mjs";
50
+ import { memberLabel, recordColumns, resultColumns, roleOf } from "./result/columns.mjs";
51
+ import { isMark, markedRows } from "./result/marks.mjs";
52
+ import { timeAxis, withTime } from "./result/time-axis.mjs";
49
53
  import { Field, FieldType, TABLES, TableDef, TableName } from "./store/schema.mjs";
50
54
  import { CATALOG, StoreDialect, TableCheck, createTable, schemaChecks, schemaStatements } from "./store/ddl.mjs";
51
55
  import { comparisonQuery, comparisonSpan, shiftInstant } from "./time/compare.mjs";
@@ -57,4 +61,4 @@ import { Author, DashAdapter, DashboardHead, DashboardReader, DashboardStore, Da
57
61
  import { CanFn, Channel, Principal, Resource, TenantKeysOf, Verb, Viewer, ViewerFor, principalTenant } from "./types/viewer.mjs";
58
62
  import { canonical } from "./value/canonical.mjs";
59
63
  import { fold, foldingPairs } from "./value/casefold.mjs";
60
- export { type AccessParts, type Alias, type AnswerDrill, type ApiError, type AssertionContext, type Author, type Awaitable, BASE_ERROR_CODES, type BoundFilter, type BoundPolicy, type BoundPolicyFilter, type BoundRule, CATALOG, CONTRACT_VERSION, type CalcAlias, type Calendar, type CanFn, type Catalog, type CatalogIssueCode, type Cell, type Change, type Channel, type ClosedRow, type Closure, type CodeDashboard, type Column, type ColumnType, type Command, type CommandBody, type CommandId, type ComposeCtx, type ComposeDelta, type ComposedQuery, type ComposedTile, type CompositionPolicy, type ConnectionId, type Control, type ControlId, type CoreApi, type CoreContract, type CreateDash, type CustomSource, type Cuts, DEFAULT_COMPOSITION_POLICY, DRILL_REASONS, type Dash, type DashAdapter, type DashEndpoint, type DashHook, type DashOptions, type DashPlugin, type DashboardHead, type DashboardListResponse, type DashboardReader, type DashboardResponse, type DashboardStore, type DashboardSummary, type DatePart, type DateRange, type DbSchema, type DimensionAlias, type DimensionCut, type DimensionDef, type DimensionHints, type DimensionId, type DimensionName, type Display, type Doc, type DocumentRefusalCode, type DocumentSlice, type Draft, type DraftResponse, type DraftTarget, type Drill, type DrillAbilities, type DrillAnswer, type DrillBody, type DrillCan, type DrillCrumb, type DrillExplanationView, type DrillField, type DrillGroupedView, type DrillItem, type DrillItemsView, type DrillOperand, type DrillOrigin, type DrillReason, type DrillSemantics, type DrillState, type DrillStep, type DrillSummary, type DrillView, EXACT_LIMIT, EXPR_FUNCTIONS, type EncodeOptions, type EndpointAccess, type EndpointContext, type EndpointsByPath, type EntryId, type Exact, type ExactSum, type Explanation, type ExplicitRange, type Expr, type ExprCondition, type ExprFunction, type Field, type FieldType, type Format, type Formula, type FormulaNode, type FormulaRef, GRID_COLUMNS, type Gap, type Grain, type GroupedRead, type HeadersLike, type HookContext, type HostCell, type HostRows, type IanaZone, type IntrospectingConnection, type IsoInstant, type Issue, type IssueCode, type ItemColumn, type ItemLinks, type ItemLinksFor, type JoinDef, type JoinName, type JoinedDimensionId, LINK_PART, type LayoutItem, type Leaf, type LinearTerm, type LockEntry, MAX_DRILL_STEPS, MICROS_PER_DAY, MICROS_PER_HOUR, MICROS_PER_SECOND, type Mark, type MeasureAlias, type MeasureDef, type MeasureId, type MeasureName, type MemberId, type MemberMeta, type MemberRef, type MetaJoin, type MetaMember, type MetaResponse, type Micros, type Model, ModelError, type ModelIssueCode, type Moment, NEGATION_OF, NEGATIVE_OPS, NULL_OPS, type NaiveRule, type NegativeOp, type NodeId, type Noun, type NullOp, type NumberFormat, type Numeric, type OffsetSegment, type Op, type Operands, type Outcome, type OverlapPart, type OwnDimensionId, POSITIVE_OPS, type PageRequest, type Param, type Picks, type PinnedExecution, type Placement, type PluginEndpoints, type PluginErrorCodes, type PolicyBinding, type PolicyFilter, type PolicyName, type PolicyRule, type PositiveOp, type Preview, type Primitive, type Principal, type PublishResponse, type Published, type QueryAnswer, type QueryConnection, type QueryCtx, type QueryLine, QueryReferenceError, type QueryRefusalCode, type RawError, type RawLevels, type RawResult, type ReadContext, type ReadField, type ReadFilter, type ReadMeasure, type ReadSession, type Receipt, type RecordColumn, type RecordPage, type Recorded, type RecordsHint, type RecordsRead, type RecordsResponse, type RefOf, type Refusal, type Relationship, type RelativeRange, type Replayed, type RequiredEntry, type ResolvedDimension, type ResolvedRange, type Resource, type Result, type ResultCell, type ResultColumn, type ResultRows, type ResultWarningCode, type Row, type RowPolicy, type RunOptions, type RuntimeErrorCode, type SchemaDriver, type Scope, type ScopeCoverage, type SealedAnswer, type SecondaryStorage, type Selection, type SemanticProvider, type ServerCall, type ServerCallInput, type ServerCalls, type SourceDef, type SourceName, type SourceNameOf, type Span, type Sql, type StoreDialect, type StoredFilter, type StoredFormulaNode, type StoredLockEntry, type StoredQuery, type StoredVersion, TABLES, type Tab, type TabId, type TableCheck, type TableDef, type TableName, type Tenant, type TenantBinding, type TenantKey, type TenantKeysOf, type TileAnswer, type TileInput, type TileLine, type TileRef, type TileRequest, type TileResult, type TilesRequest, type TimeStorage, type Token, type Tone, type TypedFilter, type TypedQuery, type UniqueIds, type Unit, type UnpublishedDraft, VIEW_PREFIX, type ValidateResponse, type ValueLeaf, type ValuesResponse, type VariableLeaf, type Verb, type VersionEntry, type ViewState, type Viewer, type ViewerFor, type ViewerLeaf, type ViewerMatch, type ViewerRef, type WeekStart, type Where, type Widget, type WidgetId, type WidgetPart, type WireFilter, type WireQuery, bindFilter, bindPolicy, bucketLabel, bucketLabels, bucketStart, canonical, changeOf, changedWidget, checkCatalog, closeGaps, closeGapsCommands, commandWidget, comparisonQuery, comparisonSpan, composeTile, createDashEndpoint, createTable, defineErrorCodes, defineModel, describeQueries, diffDocs, divideExact, documentLock, effectiveFilter, emptyDoc, encodeView, fold, foldingPairs, formatExact, formatTextTime, formulaRefs, freeSpot, inSpan, isBound, isDateRange, isLeaf, isMark, isZone, itemLink, layoutGaps, linearTerms, linkTemplateIssues, lockChanged, markShifted, markedRows, memberLabel, momentMicros, namedPolicy, nextBucketStart, offsetSegments, parseDate, parseExact, parseMemberId, parseNaiveTime, parseTextTime, pickProblem, placeItem, placementOf, policyBinding, principalTenant, queryClosure, readingOrder, recordColumns, recordDimensions, reduce, reduceAll, repairLayout, replay, resolveDimension, resolveMeasure, resolveNaive, resolveRange, resultColumns, rowValue, ruleMatches, schemaChecks, schemaStatements, selectRule, shareOf, shiftBucket, shiftInstant, startOfDate, stepCommands, stepMoves, storedExact, stripIds, sumLinear, tileInputs, toWire, validateModel, viaJoins, viewFor, viewerValues, widgetDiff, withView };
64
+ export { type AccessParts, type Alias, type AnswerDrill, type ApiError, type AssertionContext, type Author, type Awaitable, BASE_ERROR_CODES, type BoundFilter, type BoundPolicy, type BoundPolicyFilter, type BoundRule, CATALOG, CONTRACT_VERSION, type CalcAlias, type Calendar, type CanFn, type Catalog, type CatalogIssueCode, type Cell, type Change, type Channel, type ClosedRow, type Closure, type CodeDashboard, type Column, type ColumnRole, type ColumnType, type Command, type CommandBody, type CommandId, type ComposeCtx, type ComposeDelta, type ComposedQuery, type ComposedTile, type CompositionPolicy, type ConnectionId, type Control, type ControlId, type CoreApi, type CoreContract, type CreateDash, type CustomSource, type Cuts, DEFAULT_COMPOSITION_POLICY, DISPLAY_HELP, DISPLAY_OPTIONS, DRILL_REASONS, type Dash, type DashAdapter, type DashEndpoint, type DashHook, type DashOptions, type DashPlugin, type DashboardHead, type DashboardListResponse, type DashboardReader, type DashboardResponse, type DashboardStore, type DashboardSummary, type DatePart, type DateRange, type DbSchema, type DimensionAlias, type DimensionCut, type DimensionDef, type DimensionHints, type DimensionId, type DimensionName, type Display, type DisplayKind, type DisplayOf, type Doc, type DocumentRefusalCode, type DocumentSlice, type Draft, type DraftResponse, type DraftTarget, type Drill, type DrillAbilities, type DrillAnswer, type DrillBody, type DrillCan, type DrillCrumb, type DrillExplanationView, type DrillField, type DrillGroupedView, type DrillItem, type DrillItemsView, type DrillOperand, type DrillOrigin, type DrillReason, type DrillSemantics, type DrillState, type DrillStep, type DrillSummary, type DrillView, EXACT_LIMIT, EXPR_FUNCTIONS, type EncodeOptions, type EndpointAccess, type EndpointContext, type EndpointsByPath, type EntryId, type Exact, type ExactSum, type Explanation, type ExplicitRange, type Expr, type ExprCondition, type ExprFunction, type Field, type FieldType, type Format, type Formula, type FormulaNode, type FormulaRef, GRID_COLUMNS, type Gap, type Grain, type GroupedRead, type HeadersLike, type HookContext, type HostCell, type HostRows, type IanaZone, type IntrospectingConnection, type IsoInstant, type Issue, type IssueCode, type ItemColumn, type ItemLinks, type ItemLinksFor, type JoinDef, type JoinName, type JoinedDimensionId, LINK_PART, type LayoutItem, type Leaf, type LinearTerm, type LockEntry, MAX_DRILL_STEPS, MICROS_PER_DAY, MICROS_PER_HOUR, MICROS_PER_SECOND, type Mark, type MeasureAlias, type MeasureDef, type MeasureId, type MeasureName, type MemberId, type MemberMeta, type MemberRef, type MetaJoin, type MetaMember, type MetaResponse, type Micros, type Model, ModelError, type ModelIssueCode, type Moment, NEGATION_OF, NEGATIVE_OPS, NULL_OPS, type NaiveRule, type NegativeOp, type NodeId, type Noun, type NullOp, type NumberFormat, type Numeric, type OffsetSegment, type Op, type Operands, type Outcome, type OverlapPart, type OwnDimensionId, POSITIVE_OPS, type PageRequest, type Param, type Picks, type PinnedExecution, type Placement, type PluginEndpoints, type PluginErrorCodes, type PolicyBinding, type PolicyFilter, type PolicyName, type PolicyRule, type PositiveOp, type Preview, type Primitive, type Principal, type PublishResponse, type Published, type QueryAnswer, type QueryConnection, type QueryCtx, type QueryLine, QueryReferenceError, type QueryRefusalCode, type RawError, type RawLevels, type RawResult, type ReadContext, type ReadField, type ReadFilter, type ReadMeasure, type ReadSession, type Receipt, type RecordColumn, type RecordPage, type Recorded, type RecordsHint, type RecordsRead, type RecordsResponse, type RefOf, type Refusal, type Relationship, type RelativeRange, type Replayed, type RequiredEntry, type ResolvedDimension, type ResolvedRange, type Resource, type Result, type ResultCell, type ResultColumn, type ResultRows, type ResultWarningCode, type Row, type RowPolicy, type RunOptions, type RuntimeErrorCode, type SchemaDriver, type Scope, type ScopeCoverage, type SealedAnswer, type SecondaryStorage, type Selection, type SemanticProvider, type ServerCall, type ServerCallInput, type ServerCalls, type SourceDef, type SourceName, type SourceNameOf, type Span, type Sql, type StoreDialect, type StoredFilter, type StoredFormulaNode, type StoredLockEntry, type StoredQuery, type StoredVersion, TABLES, type Tab, type TabId, type TableCheck, type TableDef, type TableName, type Tenant, type TenantBinding, type TenantKey, type TenantKeysOf, type TileAnswer, type TileInput, type TileLine, type TileRef, type TileRequest, type TileResult, type TilesRequest, type TimeAxis, type TimeBucket, type TimeStorage, type Token, type Tone, type TypedFilter, type TypedQuery, type UniqueIds, type Unit, type UnpublishedDraft, VIEW_PREFIX, type ValidateResponse, type ValueLeaf, type ValuesResponse, type VariableLeaf, type Verb, type VersionEntry, type ViewState, type Viewer, type ViewerFor, type ViewerLeaf, type ViewerMatch, type ViewerRef, type WeekStart, type Where, type Widget, type WidgetId, type WidgetPart, type WireFilter, type WireQuery, bindFilter, bindPolicy, bindQueryViewer, bindViewer, bucketLabel, bucketLabels, bucketStart, canonical, changeOf, changedWidget, checkCatalog, closeGaps, closeGapsCommands, commandWidget, comparisonQuery, comparisonSpan, composeTile, createDashEndpoint, createTable, defineErrorCodes, defineModel, describeQueries, diffDocs, displayIssues, displayOf, divideExact, documentDisplayIssues, documentLock, editedDisplayIssues, effectiveFilter, emptyDoc, encodeView, fold, foldingPairs, formatExact, formatTextTime, formulaRefs, freeSpot, inSpan, isBound, isDateRange, isLeaf, isMark, isValuePick, isZone, itemLink, layoutGaps, linearTerms, linkTemplateIssues, lockChanged, markShifted, markedRows, memberLabel, momentMicros, namedPolicy, nextBucketStart, offsetSegments, parseDate, parseExact, parseMemberId, parseNaiveTime, parseTextTime, pickProblem, placeItem, placementOf, policyBinding, principalTenant, queryClosure, readingOrder, recordColumns, recordDimensions, reduce, reduceAll, repairLayout, replay, resolveDimension, resolveMeasure, resolveNaive, resolveRange, resultColumns, roleOf, rowValue, ruleMatches, schemaChecks, schemaStatements, selectRule, shareOf, sharedDisplay, shiftBucket, shiftInstant, smallestFor, startOfDate, stepCommands, stepMoves, storedExact, stripIds, sumLinear, tileInputs, timeAxis, toWire, validateModel, viaJoins, viewFor, viewLayout, viewerValues, widgetDiff, withTime, withView };
@@ -1,5 +1,6 @@
1
1
  import { BASE_ERROR_CODES, DRILL_REASONS, defineErrorCodes } from "./error/codes.mjs";
2
2
  import { changedWidget, diffDocs, markShifted, placementOf, widgetDiff } from "./document/diff.mjs";
3
+ import { DISPLAY_HELP, DISPLAY_OPTIONS, displayIssues, displayOf, documentDisplayIssues, editedDisplayIssues, sharedDisplay } from "./document/display.mjs";
3
4
  import { GRID_COLUMNS, closeGaps, closeGapsCommands, freeSpot, layoutGaps, placeItem, repairLayout } from "./document/layout.mjs";
4
5
  import { lockChanged, reduce, reduceAll } from "./document/reduce.mjs";
5
6
  import { commandWidget, replay } from "./document/replay.mjs";
@@ -7,6 +8,7 @@ import { readingOrder, stepCommands, stepMoves } from "./document/stacked.mjs";
7
8
  import { emptyDoc } from "./document/types.mjs";
8
9
  import { checkCatalog } from "./model/catalog/check.mjs";
9
10
  import { VIEW_PREFIX, encodeView, viewFor, withView } from "./document/view.mjs";
11
+ import { smallestFor, viewLayout } from "./document/view-layout.mjs";
10
12
  import { describeQueries } from "./model/catalog/queries.mjs";
11
13
  import { EXACT_LIMIT, divideExact, formatExact, parseExact, storedExact } from "./exact/decimal.mjs";
12
14
  import { rowValue, sumLinear } from "./exact/sum.mjs";
@@ -18,30 +20,32 @@ import { linearTerms } from "./model/validate/expr.mjs";
18
20
  import { validateModel } from "./model/validate/index.mjs";
19
21
  import { viaJoins } from "./model/validate/via.mjs";
20
22
  import { bindFilter, bindPolicy, namedPolicy, viewerValues } from "./policy/bind.mjs";
21
- import { ruleMatches, selectRule } from "./policy/match.mjs";
23
+ import { bindQueryViewer, bindViewer } from "./policy/bind-query.mjs";
22
24
  import { isZone, momentMicros } from "./time/temporal.mjs";
25
+ import { ruleMatches, selectRule } from "./policy/match.mjs";
23
26
  import { queryClosure } from "./query/closure.mjs";
24
27
  import { DEFAULT_COMPOSITION_POLICY } from "./query/compose.mjs";
25
28
  import { composeTile, documentLock, tileInputs } from "./query/compose-tile.mjs";
26
29
  import { effectiveFilter } from "./query/effective.mjs";
27
30
  import { NEGATION_OF, NEGATIVE_OPS, NULL_OPS, POSITIVE_OPS, isBound, isLeaf, stripIds } from "./query/filter.mjs";
28
31
  import { changeOf, formulaRefs, shareOf } from "./query/formulas.mjs";
29
- import { isDateRange, pickProblem } from "./query/picks.mjs";
32
+ import { isDateRange, isValuePick, pickProblem } from "./query/picks.mjs";
30
33
  import { QueryReferenceError, toWire } from "./query/to-wire.mjs";
31
34
  import { LINK_PART, itemLink, linkTemplateIssues } from "./query/drill/links.mjs";
32
35
  import { MAX_DRILL_STEPS } from "./query/drill/types.mjs";
33
- import { memberLabel, recordColumns, resultColumns } from "./result/columns.mjs";
34
- import { isMark, markedRows } from "./result/marks.mjs";
35
36
  import { CONTRACT_VERSION } from "./types/api.mjs";
36
- import { TABLES } from "./store/schema.mjs";
37
- import { CATALOG, createTable, schemaChecks, schemaStatements } from "./store/ddl.mjs";
37
+ import { memberLabel, recordColumns, resultColumns, roleOf } from "./result/columns.mjs";
38
+ import { isMark, markedRows } from "./result/marks.mjs";
38
39
  import { MICROS_PER_DAY, MICROS_PER_HOUR, MICROS_PER_SECOND, formatTextTime, parseDate, parseNaiveTime, parseTextTime } from "./time/instant.mjs";
39
40
  import { offsetSegments, resolveNaive, startOfDate } from "./time/zone.mjs";
40
41
  import { bucketLabel, bucketLabels, bucketStart, nextBucketStart, shiftBucket } from "./time/bucket.mjs";
42
+ import { timeAxis, withTime } from "./result/time-axis.mjs";
43
+ import { TABLES } from "./store/schema.mjs";
44
+ import { CATALOG, createTable, schemaChecks, schemaStatements } from "./store/ddl.mjs";
41
45
  import { comparisonQuery, comparisonSpan, shiftInstant } from "./time/compare.mjs";
42
46
  import { inSpan, resolveRange } from "./time/range.mjs";
43
47
  import { createDashEndpoint } from "./types/plugin.mjs";
44
48
  import { principalTenant } from "./types/viewer.mjs";
45
49
  import { canonical } from "./value/canonical.mjs";
46
50
  import { fold, foldingPairs } from "./value/casefold.mjs";
47
- export { BASE_ERROR_CODES, CATALOG, CONTRACT_VERSION, DEFAULT_COMPOSITION_POLICY, DRILL_REASONS, EXACT_LIMIT, EXPR_FUNCTIONS, GRID_COLUMNS, LINK_PART, MAX_DRILL_STEPS, MICROS_PER_DAY, MICROS_PER_HOUR, MICROS_PER_SECOND, ModelError, NEGATION_OF, NEGATIVE_OPS, NULL_OPS, POSITIVE_OPS, QueryReferenceError, TABLES, VIEW_PREFIX, bindFilter, bindPolicy, bucketLabel, bucketLabels, bucketStart, canonical, changeOf, changedWidget, checkCatalog, closeGaps, closeGapsCommands, commandWidget, comparisonQuery, comparisonSpan, composeTile, createDashEndpoint, createTable, defineErrorCodes, defineModel, describeQueries, diffDocs, divideExact, documentLock, effectiveFilter, emptyDoc, encodeView, fold, foldingPairs, formatExact, formatTextTime, formulaRefs, freeSpot, inSpan, isBound, isDateRange, isLeaf, isMark, isZone, itemLink, layoutGaps, linearTerms, linkTemplateIssues, lockChanged, markShifted, markedRows, memberLabel, momentMicros, namedPolicy, nextBucketStart, offsetSegments, parseDate, parseExact, parseMemberId, parseNaiveTime, parseTextTime, pickProblem, placeItem, placementOf, policyBinding, principalTenant, queryClosure, readingOrder, recordColumns, recordDimensions, reduce, reduceAll, repairLayout, replay, resolveDimension, resolveMeasure, resolveNaive, resolveRange, resultColumns, rowValue, ruleMatches, schemaChecks, schemaStatements, selectRule, shareOf, shiftBucket, shiftInstant, startOfDate, stepCommands, stepMoves, storedExact, stripIds, sumLinear, tileInputs, toWire, validateModel, viaJoins, viewFor, viewerValues, widgetDiff, withView };
51
+ export { BASE_ERROR_CODES, CATALOG, CONTRACT_VERSION, DEFAULT_COMPOSITION_POLICY, DISPLAY_HELP, DISPLAY_OPTIONS, DRILL_REASONS, EXACT_LIMIT, EXPR_FUNCTIONS, GRID_COLUMNS, LINK_PART, MAX_DRILL_STEPS, MICROS_PER_DAY, MICROS_PER_HOUR, MICROS_PER_SECOND, ModelError, NEGATION_OF, NEGATIVE_OPS, NULL_OPS, POSITIVE_OPS, QueryReferenceError, TABLES, VIEW_PREFIX, bindFilter, bindPolicy, bindQueryViewer, bindViewer, bucketLabel, bucketLabels, bucketStart, canonical, changeOf, changedWidget, checkCatalog, closeGaps, closeGapsCommands, commandWidget, comparisonQuery, comparisonSpan, composeTile, createDashEndpoint, createTable, defineErrorCodes, defineModel, describeQueries, diffDocs, displayIssues, displayOf, divideExact, documentDisplayIssues, documentLock, editedDisplayIssues, effectiveFilter, emptyDoc, encodeView, fold, foldingPairs, formatExact, formatTextTime, formulaRefs, freeSpot, inSpan, isBound, isDateRange, isLeaf, isMark, isValuePick, isZone, itemLink, layoutGaps, linearTerms, linkTemplateIssues, lockChanged, markShifted, markedRows, memberLabel, momentMicros, namedPolicy, nextBucketStart, offsetSegments, parseDate, parseExact, parseMemberId, parseNaiveTime, parseTextTime, pickProblem, placeItem, placementOf, policyBinding, principalTenant, queryClosure, readingOrder, recordColumns, recordDimensions, reduce, reduceAll, repairLayout, replay, resolveDimension, resolveMeasure, resolveNaive, resolveRange, resultColumns, roleOf, rowValue, ruleMatches, schemaChecks, schemaStatements, selectRule, shareOf, sharedDisplay, shiftBucket, shiftInstant, smallestFor, startOfDate, stepCommands, stepMoves, storedExact, stripIds, sumLinear, tileInputs, timeAxis, toWire, validateModel, viaJoins, viewFor, viewLayout, viewerValues, widgetDiff, withTime, withView };