@malloy-publisher/sdk 0.9.16 → 0.10.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 (41) hide show
  1. package/dist/{RenderedResult-5hOs5XnV.cjs.js → RenderedResult-B5f4qOjp.cjs.js} +1 -1
  2. package/dist/{RenderedResult-DxmHGZNQ.es.js → RenderedResult-DiDsN6JE.es.js} +1 -1
  3. package/dist/builder/index.cjs.js +17 -17
  4. package/dist/builder/index.es.js +277 -265
  5. package/dist/components/ReportBuilder/TextTileBody.d.ts +9 -2
  6. package/dist/components/legacy/malloynb/CellRunnerView.d.ts +6 -6
  7. package/dist/hooks/useSettled.d.ts +5 -8
  8. package/dist/hooks/useSettledDraft.d.ts +33 -0
  9. package/dist/index.cjs.js +10 -10
  10. package/dist/index.es.js +3769 -3779
  11. package/dist/useCompiledDocument-C995sQ3j.cjs.js +142 -0
  12. package/dist/{useCompiledDocument-CaYP_OYG.es.js → useCompiledDocument-CRmmbUza.es.js} +5449 -5294
  13. package/dist/utils/malloyLiteral.d.ts +2 -0
  14. package/package.json +11 -16
  15. package/src/components/ReportBuilder/BuilderGrid.tsx +1 -0
  16. package/src/components/ReportBuilder/TextTileBody.tsx +24 -4
  17. package/src/components/ReportBuilder/placement.spec.ts +27 -0
  18. package/src/components/ReportBuilder/placement.ts +8 -4
  19. package/src/components/given/GivenInput.spec.tsx +447 -2
  20. package/src/components/given/GivenInput.tsx +192 -80
  21. package/src/components/given/GivensPanel.spec.tsx +59 -0
  22. package/src/components/given/GivensPanel.tsx +14 -2
  23. package/src/components/legacy/malloynb/CellRunnerView.tsx +6 -6
  24. package/src/hooks/useDimensionFilters.ts +1 -35
  25. package/src/hooks/useDimensionFiltersQuery.ts +2 -36
  26. package/src/hooks/useDimensionalFilterRangeData.ts +1 -35
  27. package/src/hooks/useGivensState.spec.ts +106 -1
  28. package/src/hooks/useGivensState.ts +48 -13
  29. package/src/hooks/useSettled.ts +5 -8
  30. package/src/hooks/useSettledDraft.ts +127 -0
  31. package/src/utils/malloyLiteral.spec.ts +12 -1
  32. package/src/utils/malloyLiteral.ts +32 -0
  33. package/vite.config.ts +0 -2
  34. package/.eslintrc +0 -36
  35. package/dist/components/DOMElement/DOMElement.d.ts +0 -5
  36. package/dist/components/DOMElement/index.d.ts +0 -1
  37. package/dist/components/Package/FileTreeView.d.ts +0 -9
  38. package/dist/useCompiledDocument-zYEfLogf.cjs.js +0 -142
  39. package/src/components/DOMElement/DOMElement.tsx +0 -22
  40. package/src/components/DOMElement/index.ts +0 -4
  41. package/src/components/Package/FileTreeView.tsx +0 -244
@@ -1,7 +1,14 @@
1
1
  import { TextTile } from './document';
2
2
  export declare const TEXT_TILE_PLACEHOLDER = "Write markdown: # heading, **bold**, - list";
3
- /** A text tile as the builder draws it: the reader's prose frame, its markdown edited in place. */
4
- export declare function TextTileBody({ tile, onChange, }: {
3
+ /**
4
+ * A text tile as the builder draws it: the reader's prose frame, its markdown edited in place.
5
+ *
6
+ * `sized`: the tile has a set height (a `rowspan`, or a placed report's rows), so prose taller
7
+ * than it scrolls inside, as the reader scrolls it, rather than running on under the tiles
8
+ * below. Left to flow, the frame is as tall as the prose and nothing clips.
9
+ */
10
+ export declare function TextTileBody({ tile, sized, onChange, }: {
5
11
  tile: TextTile;
12
+ sized?: boolean;
6
13
  onChange: (markdown: string) => void;
7
14
  }): import("react/jsx-runtime").JSX.Element;
@@ -36,12 +36,12 @@ export interface CellReportProps {
36
36
  *
37
37
  * That is every committed change. Under `## autorun=false` a change is
38
38
  * committed on Apply, so reports are batched; otherwise every change is
39
- * committed and typing in a text control reports per keystroke. It does NOT
40
- * run per keystroke: a changed value waits `GIVEN_SETTLE_MS` before
41
- * anything is dispatched, so a burst of typing produces one run. A run that
42
- * does start supersedes and aborts the one before it. The REPORTS are still
43
- * per keystroke, so a host doing something expensive per call should
44
- * debounce.
39
+ * committed. A changed value waits `GIVEN_SETTLE_MS` before anything is
40
+ * dispatched, so a burst of changes produces one run. A run that
41
+ * does start supersedes and aborts the one before it. A text, number, date
42
+ * or slider control commits once it settles, so typed text runs after both
43
+ * waits; the wait here still covers pickers, keyboard slider steps, drill
44
+ * and Reset, which commit at once.
45
45
  *
46
46
  * `managed` names every given this report declares, set or not. A host
47
47
  * writing to a shared query string needs it: `givens` alone says which
@@ -1,13 +1,10 @@
1
1
  /**
2
- * How long a changed parameter has to stay changed before the notebook runs.
2
+ * How long a changed value has to stay changed before it is acted on: a given
3
+ * input commits after it, and the notebook waits it again before running.
3
4
  *
4
- * Aborting the superseded run is not enough on its own: an abort cancels the
5
- * HTTP request, but the cells already dispatched have reached the server and go
6
- * on compiling and running against the customer's warehouse, and their answers
7
- * are then thrown away. So autorun on a text control put one wave of doomed
8
- * queries on that warehouse per keystroke. `origin/main` bounded the load by
9
- * refusing to start a second run at all, which dropped the newest values;
10
- * waiting for the value to settle bounds it without making that trade.
5
+ * Aborting a superseded run is not enough on its own: an abort cancels the
6
+ * HTTP request, but cells already dispatched have reached the server and go on
7
+ * running against the customer's warehouse, and their answers are thrown away.
11
8
  */
12
9
  export declare const GIVEN_SETTLE_MS = 400;
13
10
  /** `value`, once it has stayed the same for `ms`; the first value is returned at once. */
@@ -0,0 +1,33 @@
1
+ import { KeyboardEvent } from 'react';
2
+ /**
3
+ * A control's own copy of a value that is applied the moment it is committed.
4
+ *
5
+ * A draft the reader has edited is the source of truth while the field is
6
+ * focused, so a value echoing back from the URL cannot overwrite keystrokes
7
+ * typed since; a field the reader has not edited follows `committed`. An edited
8
+ * draft commits on blur, on Enter, and once it has settled (not mid-IME
9
+ * composition), each only if it differs from `committed`. A change made while
10
+ * the field is not focused (a calendar pick) commits at once. Mount and an
11
+ * untouched focus never commit.
12
+ *
13
+ * `unset` says `committed` is the empty display of a value that was never
14
+ * set, so an edit that lands back on that display still commits it: the
15
+ * reader emptied the field on purpose.
16
+ */
17
+ export declare function useSettledDraft<T>(committed: T, commit: (draft: T) => void, { same, unset, }?: {
18
+ same?: (a: T, b: T) => boolean;
19
+ unset?: boolean;
20
+ }): {
21
+ draft: T;
22
+ /** Show `next` as typed; applies it now if the field is not focused. */
23
+ change: (next: T) => void;
24
+ /** Drop the draft for `next` without committing, for a clear. */
25
+ reset: (next: T) => void;
26
+ bind: {
27
+ onFocus: () => void;
28
+ onBlur: () => void;
29
+ onKeyDown: (e: KeyboardEvent) => void;
30
+ onCompositionStart: () => void;
31
+ onCompositionEnd: () => void;
32
+ };
33
+ };