derive-dashboards 0.7.0 → 0.8.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 (49) hide show
  1. package/README.md +1 -1
  2. package/dist/charts/kinds/area-marks.mjs +20 -19
  3. package/dist/charts/kinds/grid-marks.mjs +8 -10
  4. package/dist/charts/kinds/grid-words.mjs +1 -1
  5. package/dist/charts/kinds/grid.d.mts +1 -1
  6. package/dist/charts/kinds/grid.mjs +3 -2
  7. package/dist/charts/marks/axes.mjs +2 -1
  8. package/dist/charts/marks/x-axis.mjs +3 -2
  9. package/dist/charts/scene/types.d.mts +1 -1
  10. package/dist/charts/theme.d.mts +25 -25
  11. package/dist/charts/theme.mjs +35 -27
  12. package/dist/charts-react/plan-grid.mjs +1 -1
  13. package/dist/core/document/display.d.mts +1 -0
  14. package/dist/core/document/display.mjs +3 -1
  15. package/dist/core/engine/version.d.mts +1 -1
  16. package/dist/core/engine/version.mjs +1 -1
  17. package/dist/core/time/bucket.d.mts +2 -1
  18. package/dist/core/time/bucket.mjs +6 -2
  19. package/dist/core/time/zone.d.mts +6 -1
  20. package/dist/core/time/zone.mjs +11 -2
  21. package/dist/llms.txt +1 -1
  22. package/dist/react/Canvas.mjs +7 -7
  23. package/dist/react/Dashboard.d.mts +6 -0
  24. package/dist/react/Dashboard.mjs +1 -0
  25. package/dist/react/Header.mjs +21 -17
  26. package/dist/react/builder/Time.mjs +1 -1
  27. package/dist/react/builder/words.d.mts +2 -1
  28. package/dist/react/builder/words.mjs +1 -1
  29. package/dist/react/columns.mjs +9 -1
  30. package/dist/react/drill/board.mjs +1 -0
  31. package/dist/react/drill/props.d.mts +2 -1
  32. package/dist/react/drill/props.mjs +8 -5
  33. package/dist/react/english.mjs +6 -6
  34. package/dist/react/format.d.mts +1 -1
  35. package/dist/react/format.mjs +25 -6
  36. package/dist/react/headline.d.mts +9 -0
  37. package/dist/react/headline.mjs +51 -0
  38. package/dist/react/index.d.mts +3 -2
  39. package/dist/react/index.mjs +4 -3
  40. package/dist/react/messages.d.mts +1 -0
  41. package/dist/react/place.mjs +4 -2
  42. package/dist/react/renderers/index.mjs +31 -8
  43. package/dist/react/theme-unlayered.css +1 -1
  44. package/dist/react/theme.css +1 -1
  45. package/dist/recharts/bar.mjs +2 -2
  46. package/dist/recharts/line.mjs +2 -2
  47. package/dist/recharts/parts.mjs +3 -1
  48. package/dist/skills/derive-dashboards/SKILL.md +3 -2
  49. package/package.json +1 -1
@@ -10,6 +10,14 @@ const NUMBER_TYPES = /* @__PURE__ */ new Set([
10
10
  ]);
11
11
  /** Whether a column's cells are numbers: a value, or a group that is a number. They are set to the right and never cut. */
12
12
  const isNumeric = (column) => isValue(column) || NUMBER_TYPES.has(column.type);
13
+ /**
14
+ * Whether a column is a measure or a calc of numbers, asked of what a formatter is given: its
15
+ * role and type alone. A group that is a number (a year, an id) is not one: its text is a name.
16
+ */
17
+ function isNumberValue(column) {
18
+ const role = column?.role ?? (column?.id === void 0 ? void 0 : roleOf({ id: column.id }));
19
+ return (role === "measure" || role === "calc") && NUMBER_TYPES.has(column?.type ?? "");
20
+ }
13
21
  /** Whether a column's type holds numbers. */
14
22
  const isNumberType = (type) => NUMBER_TYPES.has(type);
15
- export { isNumberType, isNumeric, isValue };
23
+ export { isNumberType, isNumberValue, isNumeric, isValue };
@@ -92,6 +92,7 @@ function DrillScope(props) {
92
92
  children: /* @__PURE__ */ jsx("div", {
93
93
  className: "dd-dashboard",
94
94
  "data-editing": board.edit.draft !== void 0,
95
+ "data-tiles": props.tiles,
95
96
  "data-panel": panel !== void 0,
96
97
  "data-drill": panel === void 0 && drilling,
97
98
  children: props.children
@@ -18,7 +18,8 @@ export type DrillMarkProps = {
18
18
  * (`m1`), needed when the answer has more than one.
19
19
  */
20
20
  export type TileDrill = {
21
- props: (row: number | readonly ResultCell[], entry?: string) => DrillMarkProps | undefined;
21
+ /** `written` is how the tile writes the entry's value, when not as `formatCell` does: the mark is named by what is seen. */
22
+ props: (row: number | readonly ResultCell[], entry?: string, written?: string) => DrillMarkProps | undefined;
22
23
  /** Open every measure of a group together, if the server sealed the row. */
23
24
  compare?: (row: Row, view: Extract<DrillView, {
24
25
  by: "comparison";
@@ -3,15 +3,15 @@ import { drillFrom } from "./state.mjs";
3
3
  import { roleOf } from "derive-dashboards/core";
4
4
  // src/drill/props.ts
5
5
  const isLine = (c) => roleOf(c) === "measure" || roleOf(c) === "calc";
6
- /** A mark's name for a screen reader: its groups, then its value. */
7
- function markLabel(answer, row, format, entry) {
6
+ /** A mark's name for a screen reader: its groups, then its value, as the tile writes it. */
7
+ function markLabel(answer, row, format, { entry, written } = {}) {
8
8
  const named = answer.columns.length > 1 ? entry : void 0;
9
9
  const text = answer.columns.map((c, i) => ({
10
10
  c,
11
11
  cell: row[i] ?? null
12
12
  })).filter(({ c }) => named === void 0 || !isLine(c) || c.id === named).map(({ c, cell }) => {
13
13
  if (!isLine(c)) return groupText(cell, c, format);
14
- const value = formatCell(cell, c, format);
14
+ const value = c.id === entry && written !== void 0 ? written : formatCell(cell, c, format);
15
15
  return named !== void 0 && isLine(c) ? `${c.label} ${value}` : value;
16
16
  }).join(", ");
17
17
  return format.messages.drillMark(text);
@@ -78,10 +78,13 @@ function tileDrill(a) {
78
78
  openAll: (entry, view) => {
79
79
  open(void 0, entry ?? (single ? void 0 : firstLine), view ?? ITEMS);
80
80
  },
81
- props: (row, entry) => {
81
+ props: (row, entry, written) => {
82
82
  const cells = typeof row === "number" ? answer.rows[row] : row;
83
83
  if (cells === void 0 || stateOf(row, entry) === void 0) return;
84
- return markProps(markLabel(answer, cells, a.format, entry), () => {
84
+ return markProps(markLabel(answer, cells, a.format, {
85
+ entry,
86
+ written
87
+ }), () => {
85
88
  open(row, entry);
86
89
  });
87
90
  }
@@ -8,8 +8,8 @@ const CHART_NAMES = {
8
8
  line: "a line chart",
9
9
  bar: "a bar chart",
10
10
  area: "an area chart",
11
- multiples: "a set of small charts",
12
- heatmap: "a heat grid",
11
+ multiples: "a small-multiples chart",
12
+ heatmap: "a heatmap",
13
13
  funnel: "a funnel"
14
14
  };
15
15
  /** Every word the built-in components show, in English: the default `messages`. */
@@ -59,7 +59,7 @@ const ENGLISH = {
59
59
  noGroups: "Nothing yet. Add a field to split it.",
60
60
  noFilters: "Every row you can see.",
61
61
  noCalculations: "Share, change or difference.",
62
- allTime: "No breakdown",
62
+ allTime: "Whole period",
63
63
  grains: {
64
64
  hour: "hour",
65
65
  day: "day",
@@ -75,8 +75,8 @@ const ENGLISH = {
75
75
  table: "Table",
76
76
  list: "List",
77
77
  area: "Area",
78
- multiples: "Small charts",
79
- heatmap: "Heat grid",
78
+ multiples: "Small multiples",
79
+ heatmap: "Heatmap",
80
80
  funnel: "Funnel"
81
81
  },
82
82
  topValues: (n) => `top ${n}`,
@@ -120,7 +120,7 @@ const ENGLISH = {
120
120
  bucket: "its period",
121
121
  previous: "previous period"
122
122
  },
123
- removedCalcs: (names) => `Removed ${names.join(", ")}: a change compares the whole range with the one before, so it needs no breakdown and a comparison.`,
123
+ removedCalcs: (names) => `Removed ${names.join(", ")}. To use these calculations, choose Whole period and a period to compare with.`,
124
124
  noMainQuery: (title) => `${title} has no main query, so the builder cannot edit it. Change it where it was made (in code, or by its plugin).`,
125
125
  notDrawn: (labels) => `Not drawn here: ${labels.join(", ")}. Show it as a table to see ${labels.length === 1 ? "it" : "them"}.`,
126
126
  chartTooSmall: "Enlarge the tile to see the chart.",
@@ -7,7 +7,7 @@ import { ResultCell, ResultColumn } from "derive-dashboards/core";
7
7
  */
8
8
  export declare function plotValue(cell: ResultCell): number | null;
9
9
  /** What formatting reads of a column: its type, and a time bucket's grain or a money unit. */
10
- type Shape = Pick<ResultColumn, "type" | "grain" | "unit" | "format" | "signed" | "fraction">;
10
+ export type Shape = Pick<ResultColumn, "id" | "role" | "type" | "grain" | "unit" | "format" | "signed" | "fraction">;
11
11
  /**
12
12
  * A cell as text for a person, in their locale and words. A renderer can pass its own props as
13
13
  * `format`: they carry both.
@@ -1,7 +1,8 @@
1
+ import { isNumberValue } from "./columns.mjs";
1
2
  import { digitsFor, fine, lost, percentDigits, tickDigits } from "./digits.mjs";
2
3
  import { formatBucket, formatInstant, formatInstantAt } from "./format-time.mjs";
3
4
  import { ENGLISH } from "./english.mjs";
4
- import { plainOf, plainText } from "./renderers/exact.mjs";
5
+ import { digitsOf, plainOf, plainText } from "./renderers/exact.mjs";
5
6
  import { isMark } from "derive-dashboards/core";
6
7
  // src/format.ts
7
8
  function currencyOf(unit) {
@@ -34,9 +35,18 @@ function formatCell(cell, column, format = {}) {
34
35
  const { locale, messages = ENGLISH } = format;
35
36
  if (cell === null) return messages.noValue;
36
37
  if (isMark(cell)) return cell.mark === "all" ? messages.total : messages.other;
37
- if (typeof cell === "string") return formatText(cell, column, locale, format.timeZone);
38
38
  if (typeof cell === "boolean") return cell ? messages.drillYes : messages.drillNo;
39
- return numberText(cell, column, locale);
39
+ if (typeof cell !== "string") return numberText(cell, column, locale);
40
+ const sent = numberSent(cell, column);
41
+ if (sent === void 0) return formatText(cell, column, locale, format.timeZone);
42
+ return numberText(sent, column, locale);
43
+ }
44
+ /** Decimal text as a driver may write it: a plus before it, a point with no digit before or after it. */
45
+ const plain = (text) => text.trim().replace(/^\+/u, "").replace(/^(-?)\./u, "$10.").replace(/\.$/u, "");
46
+ /** A value a driver sent as its text, in a measure or a calc of numbers: its digits, to be written as any number is. */
47
+ function numberSent(text, column) {
48
+ const digits = isNumberValue(column) && /\d/u.test(text) ? digitsOf(plain(text)) : void 0;
49
+ return digits === void 0 ? void 0 : { v: digits };
40
50
  }
41
51
  /** Number formats by locale and style: making one costs fifty times a format, and a table or a chart would make one for every cell. */
42
52
  const FORMATS = /* @__PURE__ */ new Map();
@@ -63,7 +73,7 @@ function numberText(cell, column, locale) {
63
73
  currency
64
74
  };
65
75
  if (typeof cell === "number") return numberFormat(locale, {
66
- ...digitsFor(cell, 2),
76
+ ...digitsFor(cell, placesOf(currency, locale)),
67
77
  ...style
68
78
  }).format(cell);
69
79
  return exactText(cell.v, currency, locale);
@@ -118,6 +128,14 @@ function formatText(text, column, locale, timeZone) {
118
128
  if (column?.grain !== void 0) return formatBucket(text, column.grain, locale);
119
129
  return column?.type === "time" ? formatInstant(text, locale, timeZone) : text;
120
130
  }
131
+ /**
132
+ * The places a number with a fraction is written to: two, or its currency's own where that
133
+ * has more, as a dinar has three. A thousandth of a dinar is not rounded away as a cent's part.
134
+ */
135
+ const placesOf = (currency, locale) => currency === void 0 ? 2 : Math.max(2, numberFormat(locale, {
136
+ style: "currency",
137
+ currency
138
+ }).resolvedOptions().maximumFractionDigits ?? 2);
121
139
  /** Decimal text in the viewer's locale, exactly: Intl formats the digits, never a float. */
122
140
  function exactText(text, currency, locale) {
123
141
  const cents = text.split(".")[1] ?? "";
@@ -125,7 +143,8 @@ function exactText(text, currency, locale) {
125
143
  style: "currency",
126
144
  currency
127
145
  };
128
- const places = /^0*$/u.test(cents) ? 0 : currency === void 0 ? Math.min(cents.length, 2) : 2;
146
+ const most = placesOf(currency, locale);
147
+ const places = /^0*$/u.test(cents) ? 0 : currency === void 0 ? Math.min(cents.length, most) : most;
129
148
  const size = Math.abs(weigh({ v: text }));
130
149
  const written = numberFormat(locale, {
131
150
  ...lost(size, places) ? fine(size) : {
@@ -159,4 +178,4 @@ function formatTick(value, column, locale) {
159
178
  ...style
160
179
  }).format(value);
161
180
  }
162
- export { formatBucket, formatCell, formatInstant, formatInstantAt, formatTick, groupText, plotValue, rawCellText };
181
+ export { currencyOf, formatBucket, formatCell, formatInstant, formatInstantAt, formatTick, groupText, numberFormat, numberSent, placesOf, plotValue, rawCellText };
@@ -0,0 +1,9 @@
1
+ import { Shape } from "./format.mjs";
2
+ import { CellFormat } from "./messages.mjs";
3
+ import { ResultCell } from "derive-dashboards/core";
4
+ /**
5
+ * A cell as a tile's headline, the one number it is read by. An amount or a plain number of a
6
+ * thousand or more is written in whole units, rounded: $1,487,340 for 1487340.03. Anything
7
+ * else is written as `formatCell` writes it, which is also how a headline is written in full.
8
+ */
9
+ export declare function formatHeadline(cell: ResultCell, column?: Partial<Shape>, format?: CellFormat): string;
@@ -0,0 +1,51 @@
1
+ import { currencyOf, formatCell, numberFormat, numberSent, placesOf } from "./format.mjs";
2
+ import { compareExact, digitsOf } from "./renderers/exact.mjs";
3
+ // src/headline.ts
4
+ /**
5
+ * From this size a headline is written in whole units: $205.35 reads as an amount, the cents
6
+ * of $1,487,340.03 as noise. It is the least amount two places write as a thousand, so no
7
+ * headline reads "$1,000.00" beside one that reads "$1,000".
8
+ */
9
+ const WHOLE_FROM = "999.995";
10
+ /** A headline's digits when it is written whole: a plain number or an amount of that size, never a percent or a duration. */
11
+ function wholeDigits(cell, column) {
12
+ if (column?.format === "percent" || column?.format === "duration") return void 0;
13
+ const digits = typeof cell === "string" ? numberSent(cell, column)?.v : digitsOf(cell);
14
+ return digits !== void 0 && compareExact(digits.replace("-", ""), WHOLE_FROM) >= 0 ? digits : void 0;
15
+ }
16
+ /**
17
+ * A cell as a tile's headline, the one number it is read by. An amount or a plain number of a
18
+ * thousand or more is written in whole units, rounded: $1,487,340 for 1487340.03. Anything
19
+ * else is written as `formatCell` writes it, which is also how a headline is written in full.
20
+ */
21
+ function formatHeadline(cell, column, format = {}) {
22
+ const currency = currencyOf(column?.unit);
23
+ const digits = placesOf(currency, format.locale) <= 2 ? wholeDigits(cell, column) : void 0;
24
+ if (digits === void 0) return formatFigure(cell, column, format);
25
+ const style = currency === void 0 ? {} : {
26
+ style: "currency",
27
+ currency
28
+ };
29
+ const written = numberFormat(format.locale, {
30
+ minimumFractionDigits: 0,
31
+ maximumFractionDigits: 0,
32
+ ...style
33
+ }).format(digits);
34
+ return signed(written.includes("∞") ? formatCell(cell, column, format) : written, cell, format.locale);
35
+ }
36
+ /**
37
+ * A figure of a number tile as `formatCell` writes it, with a true minus: the headline written
38
+ * in full, the change under it, the second figure. One tile writes one sign.
39
+ */
40
+ const formatFigure = (cell, column, format = {}) => signed(formatCell(cell, column, format), cell, format.locale);
41
+ /**
42
+ * A headline's sign as a true minus, as the change written under it has: at that size a hyphen
43
+ * reads as a dash. The sign is the locale's own, wherever it writes it and with the marks it
44
+ * writes around it, and only a number has one: a text that starts with a hyphen keeps it.
45
+ */
46
+ function signed(written, cell, locale) {
47
+ if (typeof cell === "string" && digitsOf(cell) === void 0) return written;
48
+ const sign = numberFormat(locale, {}).formatToParts(-1).find((part) => part.type === "minusSign")?.value;
49
+ return sign === void 0 ? written : written.replace(sign, sign.replace("-", "−"));
50
+ }
51
+ export { formatFigure, formatHeadline };
@@ -33,14 +33,15 @@ import { downloadCsv } from "./export/download.mjs";
33
33
  import "./FilterBar.mjs";
34
34
  import { formatCell, formatTick, plotValue } from "./format.mjs";
35
35
  import { HistoryPanel, VersionBar } from "./History.mjs";
36
+ import { formatHeadline } from "./headline.mjs";
36
37
  import { CellFormat, ChartKind, Messages } from "./messages.mjs";
37
38
  import { ChangeList, Panel } from "./Panel.mjs";
38
39
  import { ReviewPanel } from "./ReviewPanel.mjs";
39
40
  import { ClientSchemas } from "./read.mjs";
40
41
  import { answerIds } from "./renderers/entries.mjs";
41
42
  import { NumberTile } from "./renderers/index.mjs";
42
- import { ListDisplay, ListTile } from "./renderers/list.mjs";
43
43
  import { formatBucket, formatInstant, formatInstantAt } from "./format-time.mjs";
44
+ import { ListDisplay, ListTile } from "./renderers/list.mjs";
44
45
  import { Moved, Review, useReview } from "./review.mjs";
45
46
  import { ENGLISH_REVIEW, ReviewMessages } from "./review-words.mjs";
46
47
  import { SeriesSlotsContext } from "./scope.mjs";
@@ -63,4 +64,4 @@ export interface Register {}
63
64
  export type Item = Register extends {
64
65
  server: infer S;
65
66
  } ? ItemFor<S> : DrillItem;
66
- export { type Attempt, type Builder, type CellFormat, ChangeList, type ChartKind, type ClientOptions, type ClientSchemas, type Components, Dashboard, type DashboardDrillProps, DashboardList, type DashboardProps, DashboardTile, type DashboardTileProps, type DashboardsClient, DashboardsError, type DashboardsErrorCode, DashboardsProvider, type DashboardsProviderProps, type DashboardsServer, type DraftClosed, type DraftEditor, type DraftStatus, type Drawn, type DrillChange, type DrillController, type DrillEvent, type DrillHistory, type DrillMarkProps, type DrillMessages, type DrillOptions, DrillPanel, type DrillPanelProps, ENGLISH, ENGLISH_DRILL, ENGLISH_FILTERS, ENGLISH_REVIEW, EditBar, FilterBar, type FilterBarOptions, type FilterBarProps, type FilterIcon, type FilterWords, HistoryPanel, type ItemFor, type ItemHelpers, type ItemOptions, type LinkComponent, type LinkProps, type ListDisplay, ListTile, type Messages, type Moved, NumberTile, OTHER_KEY, Panel, type Point, Popover, type Review, type ReviewMessages, ReviewPanel, type Series, type SeriesSlots, SeriesSlotsContext, type SplitSeries, TableTile, Tile, type TileDrill, type TileRenderer, type TileRendererProps, type TypedCall, VersionBar, type ViewChange, WidgetBuilder, type WidgetBuilderProps, WidgetPreview, answerIds, chartColors, createDashboardsClient, csvOf, downloadCsv, drillFrom, exactDigits, exportRows, fieldOf, rules_d_exports as filterRules, formatBucket, formatCell, formatInstant, formatInstantAt, formatTick, lastBucketOpen, plotValue, pointCell, pointText, rowAt, seriesSlots, toSeries, useBoard, useBuilder, useControlValues, useDashboard, useDashboards, useDraft, useDrill, useFilterFields, useReview, useTiles };
67
+ export { type Attempt, type Builder, type CellFormat, ChangeList, type ChartKind, type ClientOptions, type ClientSchemas, type Components, Dashboard, type DashboardDrillProps, DashboardList, type DashboardProps, DashboardTile, type DashboardTileProps, type DashboardsClient, DashboardsError, type DashboardsErrorCode, DashboardsProvider, type DashboardsProviderProps, type DashboardsServer, type DraftClosed, type DraftEditor, type DraftStatus, type Drawn, type DrillChange, type DrillController, type DrillEvent, type DrillHistory, type DrillMarkProps, type DrillMessages, type DrillOptions, DrillPanel, type DrillPanelProps, ENGLISH, ENGLISH_DRILL, ENGLISH_FILTERS, ENGLISH_REVIEW, EditBar, FilterBar, type FilterBarOptions, type FilterBarProps, type FilterIcon, type FilterWords, HistoryPanel, type ItemFor, type ItemHelpers, type ItemOptions, type LinkComponent, type LinkProps, type ListDisplay, ListTile, type Messages, type Moved, NumberTile, OTHER_KEY, Panel, type Point, Popover, type Review, type ReviewMessages, ReviewPanel, type Series, type SeriesSlots, SeriesSlotsContext, type SplitSeries, TableTile, Tile, type TileDrill, type TileRenderer, type TileRendererProps, type TypedCall, VersionBar, type ViewChange, WidgetBuilder, type WidgetBuilderProps, WidgetPreview, answerIds, chartColors, createDashboardsClient, csvOf, downloadCsv, drillFrom, exactDigits, exportRows, fieldOf, rules_d_exports as filterRules, formatBucket, formatCell, formatHeadline, formatInstant, formatInstantAt, formatTick, lastBucketOpen, plotValue, pointCell, pointText, rowAt, seriesSlots, toSeries, useBoard, useBuilder, useControlValues, useDashboard, useDashboards, useDraft, useDrill, useFilterFields, useReview, useTiles };
@@ -14,11 +14,11 @@ import { exactDigits } from "./renderers/exact.mjs";
14
14
  import { drillFrom } from "./drill/state.mjs";
15
15
  import { useDrill } from "./drill/useDrill.mjs";
16
16
  import { ENGLISH_DRILL } from "./drill/words.mjs";
17
- import { TableTile } from "./renderers/table.mjs";
18
17
  import { EditBar } from "./EditBar.mjs";
18
+ import { TableTile } from "./renderers/table.mjs";
19
19
  import { csvOf, exportRows } from "./export/csv.mjs";
20
- import { DashboardsError } from "./errors.mjs";
21
20
  import { downloadCsv } from "./export/download.mjs";
21
+ import { DashboardsError } from "./errors.mjs";
22
22
  import { ENGLISH_FILTERS } from "./filters/words.mjs";
23
23
  import { FilterBar } from "./filters/bar.mjs";
24
24
  import { fieldOf, useControlValues, useFilterFields } from "./filters/hooks.mjs";
@@ -26,6 +26,7 @@ import { rules_exports } from "./filters/rules.mjs";
26
26
  import { Popover } from "./filters/popover.mjs";
27
27
  import { formatCell, formatTick, plotValue } from "./format.mjs";
28
28
  import { HistoryPanel, VersionBar } from "./History.mjs";
29
+ import { formatHeadline } from "./headline.mjs";
29
30
  import { ENGLISH } from "./english.mjs";
30
31
  import { ChangeList, Panel } from "./Panel.mjs";
31
32
  import { ReviewPanel } from "./ReviewPanel.mjs";
@@ -42,4 +43,4 @@ import { Tile } from "./Tile.mjs";
42
43
  import { useBoard } from "./useBoard.mjs";
43
44
  import { useDashboard } from "./useDashboard.mjs";
44
45
  import { useTiles } from "./useTiles.mjs";
45
- export { ChangeList, Dashboard, DashboardList, DashboardTile, DashboardsError, DashboardsProvider, DrillPanel, ENGLISH, ENGLISH_DRILL, ENGLISH_FILTERS, ENGLISH_REVIEW, EditBar, FilterBar, HistoryPanel, ListTile, NumberTile, OTHER_KEY, Panel, Popover, ReviewPanel, SeriesSlotsContext, TableTile, Tile, VersionBar, WidgetBuilder, WidgetPreview, answerIds, chartColors, createDashboardsClient, csvOf, downloadCsv, drillFrom, exactDigits, exportRows, fieldOf, rules_exports as filterRules, formatBucket, formatCell, formatInstant, formatInstantAt, formatTick, lastBucketOpen, plotValue, pointCell, pointText, rowAt, seriesSlots, toSeries, useBoard, useBuilder, useControlValues, useDashboard, useDashboards, useDraft, useDrill, useFilterFields, useReview, useTiles };
46
+ export { ChangeList, Dashboard, DashboardList, DashboardTile, DashboardsError, DashboardsProvider, DrillPanel, ENGLISH, ENGLISH_DRILL, ENGLISH_FILTERS, ENGLISH_REVIEW, EditBar, FilterBar, HistoryPanel, ListTile, NumberTile, OTHER_KEY, Panel, Popover, ReviewPanel, SeriesSlotsContext, TableTile, Tile, VersionBar, WidgetBuilder, WidgetPreview, answerIds, chartColors, createDashboardsClient, csvOf, downloadCsv, drillFrom, exactDigits, exportRows, fieldOf, rules_exports as filterRules, formatBucket, formatCell, formatHeadline, formatInstant, formatInstantAt, formatTick, lastBucketOpen, plotValue, pointCell, pointText, rowAt, seriesSlots, toSeries, useBoard, useBuilder, useControlValues, useDashboard, useDashboards, useDraft, useDrill, useFilterFields, useReview, useTiles };
@@ -68,6 +68,7 @@ export type Messages = ReviewMessages & DrillMessages & BuilderMessages & {
68
68
  noGroups: string;
69
69
  noFilters: string;
70
70
  noCalculations: string;
71
+ /** Time-grain option that keeps the selected date range without splitting it into buckets. */
71
72
  allTime: string;
72
73
  grains: Record<"hour" | "day" | "week" | "month" | "quarter" | "year", string>;
73
74
  kinds: Record<string, string>;
@@ -4,11 +4,13 @@ const overlaps = (a, b) => a.x < b.x + b.w && b.x < a.x + a.w && a.y < b.y + b.h
4
4
  /**
5
5
  * Where a box is drawn on the 12-column CSS grid, as variables the theme places it by: a rule
6
6
  * (the one-column phone layout, or a host's own) can then place it otherwise, which an inline
7
- * grid position would always beat.
7
+ * grid position would always beat. The rows it spans are said alone too, for a rule that
8
+ * sizes it by them.
8
9
  */
9
10
  const placeOf = (box) => ({
10
11
  "--dd-at-column": `${String(box.x + 1)} / span ${String(box.w)}`,
11
- "--dd-at-row": `${String(box.y + 1)} / span ${String(box.h)}`
12
+ "--dd-at-row": `${String(box.y + 1)} / span ${String(box.h)}`,
13
+ "--dd-at-rows": String(box.h)
12
14
  });
13
15
  /** Brings an element into view when asked, without motion if the viewer asked for none. */
14
16
  function useBringIntoView(wanted) {
@@ -1,5 +1,6 @@
1
1
  import { isValue } from "../columns.mjs";
2
2
  import { formatCell } from "../format.mjs";
3
+ import { formatFigure, formatHeadline } from "../headline.mjs";
3
4
  import { answerIds } from "./entries.mjs";
4
5
  import { exactDigits, unitsOf } from "./exact.mjs";
5
6
  import { ListTile } from "./list.mjs";
@@ -56,7 +57,7 @@ function Secondary(props) {
56
57
  children: [
57
58
  /* @__PURE__ */ jsx("span", {
58
59
  className: "dd-number-secondary-value",
59
- children: formatCell(props.row?.[props.at] ?? null, column, props)
60
+ children: formatFigure(props.row?.[props.at] ?? null, column, props)
60
61
  }),
61
62
  " ",
62
63
  column.label
@@ -64,28 +65,50 @@ function Secondary(props) {
64
65
  });
65
66
  }
66
67
  /**
68
+ * How many characters the headline is, for the theme to size it by: a long amount is set
69
+ * smaller so it fits its tile, where a fixed size would cut it off.
70
+ */
71
+ const fitted = (shown) => ({ "--dd-chars": shown.length });
72
+ /**
73
+ * The large number: its row (the total row when there is one, else the first), how it is
74
+ * written in full and how it is written large, and what opens the rows behind it. It is
75
+ * written large in whole units from a thousand up, unless its widget asks for it in full.
76
+ */
77
+ function headlineOf(props, index) {
78
+ const { answer } = props;
79
+ const row = answer.rows.find((cells) => cells.some((cell) => isAll(cell))) ?? answer.rows[0];
80
+ const cell = row?.[index] ?? null;
81
+ const column = answer.columns[index];
82
+ const full = formatCell(cell, column, props);
83
+ const shown = (displayOf("number", props.widget.display).full === true ? formatFigure : formatHeadline)(cell, column, props);
84
+ return {
85
+ row,
86
+ full,
87
+ shown,
88
+ marks: row === void 0 ? void 0 : props.drill?.props(row, column?.id, shown)
89
+ };
90
+ }
91
+ /**
67
92
  * One value, large, from the total row when there is one, else the first row; a change calc (a
68
93
  * signed column) sits under it, then a second figure when the widget names one.
69
94
  */
70
95
  function NumberTile(props) {
71
96
  const { answer } = props;
72
97
  const { index, second, change } = figuresOf(props);
73
- const row = answer.rows.find((cells) => cells.some((cell) => isAll(cell))) ?? answer.rows[0];
74
- const cell = row?.[index] ?? null;
75
- const entry = answer.columns[index]?.id;
76
- const marks = row === void 0 ? void 0 : props.drill?.props(row, entry);
98
+ const { row, full, shown, marks } = headlineOf(props, index);
77
99
  return /* @__PURE__ */ jsxs("div", {
78
100
  className: "dd-number",
79
101
  children: [
80
102
  /* @__PURE__ */ jsx("span", {
81
103
  className: "dd-number-value",
82
- title: formatCell(cell, answer.columns[index], props),
104
+ title: full,
105
+ style: fitted(shown),
83
106
  ...marks,
84
- children: formatCell(cell, answer.columns[index], props)
107
+ children: shown
85
108
  }),
86
109
  change === -1 ? null : /* @__PURE__ */ jsx("span", {
87
110
  className: "dd-number-change",
88
- children: formatCell(row?.[change] ?? null, answer.columns[change], props)
111
+ children: formatFigure(row?.[change] ?? null, answer.columns[change], props)
89
112
  }),
90
113
  /* @__PURE__ */ jsx(Before, {
91
114
  ...props,