@malloy-publisher/sdk 0.12.0 → 0.12.2

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 (214) hide show
  1. package/README.md +79 -6
  2. package/dist/{RenderedResult-SgDlxzs9.cjs.js → RenderedResult-Cgw4iqev.cjs.js} +1 -1
  3. package/dist/{RenderedResult-D8bCgThO.es.js → RenderedResult-DEjFM1DL.es.js} +2 -2
  4. package/dist/ServerProvider-BRQl_cBo.cjs.js +1 -0
  5. package/dist/{ServerProvider-DBw-thY0.es.js → ServerProvider-RnliA2Ao.es.js} +1084 -723
  6. package/dist/builder/index.cjs.js +1 -1
  7. package/dist/builder/index.es.js +3 -3
  8. package/dist/client/api.d.ts +754 -41
  9. package/dist/client/index.cjs.js +1 -1
  10. package/dist/client/index.es.js +120 -110
  11. package/dist/components/Materializations/MaterializationDetailDialog.d.ts +16 -1
  12. package/dist/components/Model/ExplorerPage.d.ts +9 -0
  13. package/dist/components/Model/Model.d.ts +27 -11
  14. package/dist/components/ModelViewer/AccessChips.d.ts +34 -0
  15. package/dist/components/ModelViewer/EmptyRow.d.ts +23 -0
  16. package/dist/components/ModelViewer/Facts.d.ts +15 -0
  17. package/dist/components/ModelViewer/FieldGroup.d.ts +31 -0
  18. package/dist/components/ModelViewer/FieldRow.d.ts +69 -0
  19. package/dist/components/ModelViewer/GivenFacts.d.ts +21 -0
  20. package/dist/components/ModelViewer/HeaderBar.d.ts +75 -0
  21. package/dist/components/ModelViewer/InlineDoc.d.ts +13 -0
  22. package/dist/components/ModelViewer/ModelGivensSection.d.ts +32 -0
  23. package/dist/components/ModelViewer/ModelSection.d.ts +21 -0
  24. package/dist/components/ModelViewer/ModelViewer.d.ts +91 -0
  25. package/dist/components/ModelViewer/QueriesGroup.d.ts +15 -0
  26. package/dist/components/ModelViewer/RowGlyph.d.ts +27 -0
  27. package/dist/components/ModelViewer/RunResult.d.ts +46 -0
  28. package/dist/components/ModelViewer/SampleValues.d.ts +20 -0
  29. package/dist/components/ModelViewer/SchemaJoin.d.ts +51 -0
  30. package/dist/components/ModelViewer/SchemaView.d.ts +52 -0
  31. package/dist/components/ModelViewer/SegmentIcons.d.ts +70 -0
  32. package/dist/components/ModelViewer/SourcesDropdown.d.ts +53 -0
  33. package/dist/components/ModelViewer/SourcesNav.d.ts +25 -0
  34. package/dist/components/ModelViewer/StatusPill.d.ts +56 -0
  35. package/dist/components/ModelViewer/ValueChip.d.ts +17 -0
  36. package/dist/components/ModelViewer/ViewRow.d.ts +36 -0
  37. package/dist/components/ModelViewer/clickableBox.d.ts +29 -0
  38. package/dist/components/ModelViewer/codeDisplay.d.ts +44 -0
  39. package/dist/components/ModelViewer/docAnnotations.d.ts +90 -0
  40. package/dist/components/ModelViewer/explorerModel.d.ts +12 -0
  41. package/dist/components/ModelViewer/extensions.d.ts +94 -0
  42. package/dist/components/ModelViewer/fieldCode.d.ts +74 -0
  43. package/dist/components/ModelViewer/fieldEntities.d.ts +45 -0
  44. package/dist/components/ModelViewer/fieldExpansion.d.ts +41 -0
  45. package/dist/components/ModelViewer/givenUsage.d.ts +71 -0
  46. package/dist/components/ModelViewer/headerCard.d.ts +31 -0
  47. package/dist/components/ModelViewer/httpStatus.d.ts +4 -0
  48. package/dist/components/ModelViewer/icons.d.ts +31 -0
  49. package/dist/components/ModelViewer/index.d.ts +9 -0
  50. package/dist/components/ModelViewer/joinAccess.d.ts +52 -0
  51. package/dist/components/ModelViewer/malloyRunText.d.ts +22 -0
  52. package/dist/components/ModelViewer/malloyText.d.ts +21 -0
  53. package/dist/components/ModelViewer/modelGivens.d.ts +61 -0
  54. package/dist/components/ModelViewer/modelGivensContext.d.ts +9 -0
  55. package/dist/components/ModelViewer/modelHeaderPresentation.d.ts +28 -0
  56. package/dist/components/ModelViewer/modelTextDeclarations.d.ts +32 -0
  57. package/dist/components/ModelViewer/modelTextParse.d.ts +27 -0
  58. package/dist/components/ModelViewer/namedQueryCode.d.ts +12 -0
  59. package/dist/components/ModelViewer/offSurface.d.ts +54 -0
  60. package/dist/components/ModelViewer/rowLayers.d.ts +30 -0
  61. package/dist/components/ModelViewer/runGate.d.ts +49 -0
  62. package/dist/components/ModelViewer/schemaModel.d.ts +109 -0
  63. package/dist/components/ModelViewer/sectionOpenCommand.d.ts +45 -0
  64. package/dist/components/ModelViewer/sourceAccess.d.ts +67 -0
  65. package/dist/components/ModelViewer/sourceLineage.d.ts +14 -0
  66. package/dist/components/ModelViewer/sourcePicker.d.ts +66 -0
  67. package/dist/components/ModelViewer/surface.d.ts +47 -0
  68. package/dist/components/ModelViewer/text.d.ts +6 -0
  69. package/dist/components/ModelViewer/theme.d.ts +63 -0
  70. package/dist/components/ModelViewer/tokens.d.ts +52 -0
  71. package/dist/components/ModelViewer/ui.d.ts +48 -0
  72. package/dist/components/ModelViewer/useDimensionSamples.d.ts +76 -0
  73. package/dist/components/ModelViewer/useModelSources.d.ts +92 -0
  74. package/dist/components/ModelViewer/useRunQuery.d.ts +115 -0
  75. package/dist/components/ReportBuilder/loadMalloy.d.ts +4 -0
  76. package/dist/components/ServerProvider.d.ts +17 -2
  77. package/dist/components/filter/utils.d.ts +1 -1
  78. package/dist/components/given/GivenInput.d.ts +7 -1
  79. package/dist/components/given/GivensPanel.d.ts +3 -1
  80. package/dist/components/given/filterSummary.d.ts +6 -0
  81. package/dist/components/given/useGivenUrlParams.d.ts +11 -0
  82. package/dist/components/index.d.ts +2 -1
  83. package/dist/components/modelPage.d.ts +36 -0
  84. package/dist/hooks/useDimensionalFilterRangeData.d.ts +9 -0
  85. package/dist/hooks/useSuggestOptions.d.ts +26 -2
  86. package/dist/index.cjs.js +47 -19
  87. package/dist/index.es.js +14137 -9697
  88. package/dist/useCompiledDocument-D88_2cGS.cjs.js +143 -0
  89. package/dist/{useCompiledDocument-CXMPtJkJ.es.js → useCompiledDocument-Dmm6xkom.es.js} +6975 -6893
  90. package/dist/utils/filterCondition.d.ts +14 -0
  91. package/dist/utils/malloyLiteral.d.ts +20 -1
  92. package/package.json +2 -2
  93. package/src/components/Materializations/MaterializationDetailDialog.tsx +33 -7
  94. package/src/components/Materializations/Materializations.tsx +47 -4
  95. package/src/components/Materializations/Materializations.versions.spec.tsx +140 -1
  96. package/src/components/Model/ExplorerPage.tsx +269 -0
  97. package/src/components/Model/Model.tsx +66 -250
  98. package/src/components/Model/ModelExplorer.spec.tsx +64 -1
  99. package/src/components/ModelViewer/AccessChips.tsx +149 -0
  100. package/src/components/ModelViewer/EmptyRow.tsx +71 -0
  101. package/src/components/ModelViewer/Facts.tsx +46 -0
  102. package/src/components/ModelViewer/FieldGroup.tsx +137 -0
  103. package/src/components/ModelViewer/FieldRow.tsx +566 -0
  104. package/src/components/ModelViewer/GivenFacts.tsx +89 -0
  105. package/src/components/ModelViewer/HeaderBar.tsx +362 -0
  106. package/src/components/ModelViewer/InlineDoc.tsx +50 -0
  107. package/src/components/ModelViewer/ModelGivensSection.tsx +142 -0
  108. package/src/components/ModelViewer/ModelSection.tsx +98 -0
  109. package/src/components/ModelViewer/ModelViewer.spec.tsx +937 -0
  110. package/src/components/ModelViewer/ModelViewer.tsx +777 -0
  111. package/src/components/ModelViewer/QueriesGroup.tsx +107 -0
  112. package/src/components/ModelViewer/RowGlyph.tsx +138 -0
  113. package/src/components/ModelViewer/RunResult.tsx +298 -0
  114. package/src/components/ModelViewer/SampleValues.tsx +97 -0
  115. package/src/components/ModelViewer/SchemaJoin.tsx +258 -0
  116. package/src/components/ModelViewer/SchemaView.tsx +222 -0
  117. package/src/components/ModelViewer/SegmentIcons.tsx +129 -0
  118. package/src/components/ModelViewer/SourcesDropdown.tsx +265 -0
  119. package/src/components/ModelViewer/SourcesNav.tsx +75 -0
  120. package/src/components/ModelViewer/StatusPill.tsx +145 -0
  121. package/src/components/ModelViewer/ValueChip.tsx +39 -0
  122. package/src/components/ModelViewer/ViewRow.tsx +274 -0
  123. package/src/components/ModelViewer/clickableBox.ts +59 -0
  124. package/src/components/ModelViewer/codeDisplay.spec.ts +176 -0
  125. package/src/components/ModelViewer/codeDisplay.ts +118 -0
  126. package/src/components/ModelViewer/docAnnotations.spec.ts +181 -0
  127. package/src/components/ModelViewer/docAnnotations.ts +244 -0
  128. package/src/components/ModelViewer/docAnnotations.typeDetail.spec.ts +114 -0
  129. package/src/components/ModelViewer/explorerModel.spec.ts +43 -0
  130. package/src/components/ModelViewer/explorerModel.ts +31 -0
  131. package/src/components/ModelViewer/extensions.tsx +112 -0
  132. package/src/components/ModelViewer/fieldCode.spec.ts +168 -0
  133. package/src/components/ModelViewer/fieldCode.ts +118 -0
  134. package/src/components/ModelViewer/fieldEntities.ts +63 -0
  135. package/src/components/ModelViewer/fieldExpansion.spec.ts +116 -0
  136. package/src/components/ModelViewer/fieldExpansion.ts +95 -0
  137. package/src/components/ModelViewer/givenUsage.spec.ts +304 -0
  138. package/src/components/ModelViewer/givenUsage.ts +325 -0
  139. package/src/components/ModelViewer/headerCard.tsx +102 -0
  140. package/src/components/ModelViewer/httpStatus.ts +15 -0
  141. package/src/components/ModelViewer/icons.tsx +67 -0
  142. package/src/components/ModelViewer/index.ts +26 -0
  143. package/src/components/ModelViewer/joinAccess.spec.ts +95 -0
  144. package/src/components/ModelViewer/joinAccess.ts +54 -0
  145. package/src/components/ModelViewer/malloyRunText.spec.ts +48 -0
  146. package/src/components/ModelViewer/malloyRunText.ts +51 -0
  147. package/src/components/ModelViewer/malloyText.spec.ts +47 -0
  148. package/src/components/ModelViewer/malloyText.ts +77 -0
  149. package/src/components/ModelViewer/modelGivens.ts +228 -0
  150. package/src/components/ModelViewer/modelGivensContext.ts +13 -0
  151. package/src/components/ModelViewer/modelHeaderPresentation.spec.ts +31 -0
  152. package/src/components/ModelViewer/modelHeaderPresentation.ts +41 -0
  153. package/src/components/ModelViewer/modelTextDeclarations.spec.ts +336 -0
  154. package/src/components/ModelViewer/modelTextDeclarations.ts +228 -0
  155. package/src/components/ModelViewer/modelTextParse.ts +112 -0
  156. package/src/components/ModelViewer/namedQueryCode.spec.ts +58 -0
  157. package/src/components/ModelViewer/namedQueryCode.ts +26 -0
  158. package/src/components/ModelViewer/offSurface.tsx +124 -0
  159. package/src/components/ModelViewer/rowLayers.tsx +104 -0
  160. package/src/components/ModelViewer/runGate.spec.ts +219 -0
  161. package/src/components/ModelViewer/runGate.ts +145 -0
  162. package/src/components/ModelViewer/schemaModel.defaultSource.spec.ts +126 -0
  163. package/src/components/ModelViewer/schemaModel.queries.spec.ts +37 -0
  164. package/src/components/ModelViewer/schemaModel.ts +300 -0
  165. package/src/components/ModelViewer/sectionOpenCommand.tsx +125 -0
  166. package/src/components/ModelViewer/sourceAccess.spec.ts +130 -0
  167. package/src/components/ModelViewer/sourceAccess.ts +194 -0
  168. package/src/components/ModelViewer/sourceLineage.spec.ts +73 -0
  169. package/src/components/ModelViewer/sourceLineage.ts +38 -0
  170. package/src/components/ModelViewer/sourcePicker.spec.ts +294 -0
  171. package/src/components/ModelViewer/sourcePicker.ts +162 -0
  172. package/src/components/ModelViewer/surface.ts +51 -0
  173. package/src/components/ModelViewer/text.tsx +33 -0
  174. package/src/components/ModelViewer/theme.spec.ts +38 -0
  175. package/src/components/ModelViewer/theme.ts +58 -0
  176. package/src/components/ModelViewer/tokens.ts +87 -0
  177. package/src/components/ModelViewer/ui.tsx +201 -0
  178. package/src/components/ModelViewer/useDimensionSamples.spec.tsx +139 -0
  179. package/src/components/ModelViewer/useDimensionSamples.ts +220 -0
  180. package/src/components/ModelViewer/useModelSources.spec.ts +110 -0
  181. package/src/components/ModelViewer/useModelSources.ts +238 -0
  182. package/src/components/ModelViewer/useRunQuery.spec.ts +50 -0
  183. package/src/components/ModelViewer/useRunQuery.ts +223 -0
  184. package/src/components/Package/Package.agents.spec.tsx +5 -4
  185. package/src/components/Package/Package.tsx +8 -1
  186. package/src/components/ReportBuilder/emptyStart.spec.ts +8 -0
  187. package/src/components/ReportBuilder/loadMalloy.ts +8 -1
  188. package/src/components/ServerProvider.tsx +29 -3
  189. package/src/components/filter/utils.ts +4 -60
  190. package/src/components/given/FilterButton.tsx +4 -1
  191. package/src/components/given/GivenInput.tsx +8 -0
  192. package/src/components/given/GivensPanel.tsx +6 -1
  193. package/src/components/given/filterSummary.spec.ts +31 -1
  194. package/src/components/given/filterSummary.ts +41 -19
  195. package/src/components/given/useGivenUrlParams.spec.tsx +32 -0
  196. package/src/components/given/useGivenUrlParams.ts +49 -14
  197. package/src/components/index.ts +6 -1
  198. package/src/components/legacy/malloynb/Notebook.spec.tsx +38 -4
  199. package/src/components/legacy/malloynb/NotebookCell.tsx +8 -2
  200. package/src/components/modelPage.spec.ts +79 -0
  201. package/src/components/modelPage.ts +48 -0
  202. package/src/hooks/useDimensionFilters.ts +3 -58
  203. package/src/hooks/useDimensionFiltersQuery.ts +3 -58
  204. package/src/hooks/useDimensionalFilterRangeData.spec.ts +57 -0
  205. package/src/hooks/useDimensionalFilterRangeData.ts +8 -63
  206. package/src/hooks/useSuggestOptions.dom.spec.ts +54 -1
  207. package/src/hooks/useSuggestOptions.spec.ts +71 -0
  208. package/src/hooks/useSuggestOptions.ts +102 -12
  209. package/src/utils/filterCondition.spec.ts +87 -0
  210. package/src/utils/filterCondition.ts +66 -0
  211. package/src/utils/malloyLiteral.spec.ts +53 -1
  212. package/src/utils/malloyLiteral.ts +47 -12
  213. package/dist/ServerProvider-BHfg1Ed6.cjs.js +0 -1
  214. package/dist/useCompiledDocument-D7X_K6YU.cjs.js +0 -142
@@ -0,0 +1,75 @@
1
+ import { ReactNode } from 'react';
2
+ import { SourceAccess } from './sourceAccess';
3
+ /**
4
+ * The model page's header: the source's name as the page's heading, and beside
5
+ * it the source picker ("2 sources ▾", {@link import("./SourcesNav").SourcesNav}),
6
+ * with a host's actions on the right. Then the source's status row (who can
7
+ * query it, whether the package exposes the file, and what a host adds), the
8
+ * model's and the source's docs, and the quiet meta line ("Source · 33 fields ·
9
+ * from …").
10
+ */
11
+ export declare function HeaderBar({
12
+ /** The heading: the source's name, or on a model with only queries the model's name. */
13
+ title,
14
+ /** Beside the heading: the source picker. */
15
+ titleAdornments,
16
+ /** What the title is, leading the meta line: "Source · 43 fields". */
17
+ kindLabel,
18
+ /** The meta line's count, after the kind: "33 fields", or "2 queries" on a model with only queries. */
19
+ meta,
20
+ /** The source's own `#(doc)`, printed under its name. */
21
+ doc,
22
+ /** Where the source comes from, at the end of the meta line. */
23
+ provenance,
24
+ /** Controls on the heading line's right. */
25
+ actions,
26
+ /** A host's chips on the status row, after the viewer's own. */
27
+ status,
28
+ /** The title's heading level: the page's h1 where the viewer is the page,
29
+ * a level down where it is a panel on another page. */
30
+ headingLevel,
31
+ /** The model file's own description, ahead of the source's. */
32
+ modelDoc,
33
+ /** The source's `#(authorize)` / `#(access_filter)` declarations: chips on
34
+ * the status row, and their facts in the card the chips open. */
35
+ access,
36
+ /** Whether the reader can change the model, so the card also shows the
37
+ * rules' Malloy (an editor's vocabulary) beside their words. */
38
+ showRules,
39
+ /** False for a model's own header (no sources, only queries): it has no status row. */
40
+ isSource,
41
+ /** The file is one the package's `index.malloy` leaves out: its Private chip leads the status row. */
42
+ offSurface,
43
+ /** The file is the package's root `index.malloy`, whose sources are the package's public
44
+ * ones: its Public chip sits in the status row where a hidden file's Private does. */
45
+ publicSurface, }: {
46
+ title: ReactNode;
47
+ titleAdornments?: ReactNode;
48
+ kindLabel?: string;
49
+ meta?: ReactNode;
50
+ doc?: string;
51
+ provenance?: ReactNode;
52
+ actions?: ReactNode;
53
+ status?: ReactNode;
54
+ headingLevel?: "h1" | "h2";
55
+ modelDoc?: string;
56
+ access?: SourceAccess;
57
+ showRules?: boolean;
58
+ isSource?: boolean;
59
+ offSurface?: boolean;
60
+ publicSurface?: boolean;
61
+ }): import("react/jsx-runtime").JSX.Element;
62
+ /**
63
+ * A source's doc under its name: at most two lines until the reader asks for the
64
+ * rest, with `backticked` names set as code rather than showing the backticks. A
65
+ * doc is written for the agent as much as the reader and runs long; the header's
66
+ * job is to say what the source is at a glance.
67
+ */
68
+ export declare function SourceDoc({ doc, label, testId, }: {
69
+ doc: string;
70
+ /** What the More / Less button's accessible name calls the text. */
71
+ label?: string;
72
+ testId?: string;
73
+ }): import("react/jsx-runtime").JSX.Element;
74
+ /** `name` spans as code; everything else as written. */
75
+ export declare function withInlineCode(text: string): ReactNode[];
@@ -0,0 +1,13 @@
1
+ import { SxProps, Theme } from '@mui/material';
2
+ /** Whether a one-line description hides part of `doc`: clipped by its ellipsis,
3
+ * or showing only the first of several lines. */
4
+ export declare function isDocCut(el: HTMLElement, doc: string): boolean;
5
+ /**
6
+ * A row's description, printed on the row: its first line, cut to the space it
7
+ * has, with the whole text as a plain title only when some of it is cut off.
8
+ */
9
+ export declare function InlineDoc({ doc, sx, testId, }: {
10
+ doc: string;
11
+ sx?: SxProps<Theme>;
12
+ testId?: string;
13
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,32 @@
1
+ import { GivenValue } from '../../hooks/givenValue';
2
+ import { GivenInfo } from './modelGivens';
3
+ /**
4
+ * The page's Givens section: the givens this source reads, as a page section
5
+ * like its Views and fields (title, "2 givens"), first on the page because they
6
+ * set every run below it. Inside it, the SDK's `GivensPanel` in its `bar`
7
+ * layout, the dashboard's filter bar, so a given is set with the same control,
8
+ * the same "Default: …" line and the same Reset on a model page as on a
9
+ * dashboard. None when the source reads no given. When the page can't tell
10
+ * whether the source reads a given it shows, it says that a value set for it
11
+ * may not apply, rather than offering a control that looks as if it narrows
12
+ * every run.
13
+ */
14
+ export declare function ModelGivensSection({ givens, unknown, inheritedFrom, values, onChange, onReset, environmentName, packageName, modelPath, versionId, declaredTypes, }: {
15
+ /** The givens this source reads (host-filled ones already left out). */
16
+ givens: ReadonlyArray<GivenInfo>;
17
+ /** Names of the givens shown that the page can't tie to the source either
18
+ * way: its model file builds it on an import, a query or a `compose(…)`
19
+ * (scanGivensForSource). */
20
+ unknown?: ReadonlySet<string>;
21
+ /** Given name → the sources it is read by that the page can't open (the
22
+ * model doesn't export them), for the line naming where it comes from. */
23
+ inheritedFrom?: ReadonlyMap<string, string[]>;
24
+ values: Map<string, GivenValue>;
25
+ onChange: (name: string, value: GivenValue) => void;
26
+ onReset: () => void;
27
+ environmentName: string;
28
+ packageName: string;
29
+ modelPath: string;
30
+ versionId?: string;
31
+ declaredTypes: ReadonlyMap<string, string | undefined>;
32
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,21 @@
1
+ import { ReactNode } from 'react';
2
+ /**
3
+ * One kind of thing a source holds (Views, Queries, Measures, Calculations,
4
+ * Dimensions, Joins)
5
+ * as a page section that is always open: the page's own section header (an h2),
6
+ * its Expand all under the title where it has one, then everything in it. No count: every
7
+ * row is on the page, and the line is the section's control's. A source page is read like a
8
+ * notebook, top to bottom, so nothing on it is folded away.
9
+ *
10
+ * <p>`level="h3"` is the same section one step down, inside a join: a joined
11
+ * source's Measures and Dimensions, titled as the page's own, a size smaller.
12
+ */
13
+ export declare function ModelSection({ label, count, level, testId, action, children, }: {
14
+ label: string;
15
+ count: number;
16
+ level?: "h2" | "h3";
17
+ testId?: string;
18
+ /** A control on the line under the title (Expand all), on an h2 section. */
19
+ action?: ReactNode;
20
+ children: ReactNode;
21
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,91 @@
1
+ import { ReactNode } from 'react';
2
+ import { ModelViewerExtensions } from './extensions';
3
+ import { FieldEntity } from './fieldEntities';
4
+ import { QueryRunEvent } from './useRunQuery';
5
+ export interface ModelViewerProps {
6
+ /** The model, as `publisher://environments/{env}/packages/{pkg}/models/{path}`
7
+ * (`encodeResourceUri`), with an optional `versionId`. */
8
+ resourceUri: string;
9
+ /**
10
+ * The source on screen, for a host that keeps it (in its address, say). With
11
+ * it the viewer is controlled: picking a source calls `onSourceChange` and
12
+ * shows what the host passes back. A name the model doesn't expose shows a
13
+ * not-found state naming the sources it does.
14
+ */
15
+ sourceName?: string;
16
+ /** Called with the source a reader picks. */
17
+ onSourceChange?: (sourceName: string) => void;
18
+ /** Which source to open on when uncontrolled; the model's default otherwise. */
19
+ initialSourceName?: string;
20
+ /**
21
+ * Read and run the files and sources the package's `index.malloy` hides, for a
22
+ * reader the server lets edit the package; anyone else is refused. A file read
23
+ * this way is marked Private on its header.
24
+ */
25
+ includeHiddenFilesAndSources?: boolean;
26
+ /** Givens the host fills on every query (`$GROUPS`, say): never a reader's input. */
27
+ hostGivenNames?: ReadonlyArray<string>;
28
+ /**
29
+ * Given values from the host, typically its URL's query parameters
30
+ * (`useGivenUrlParams`), so a link to the page opens with them applied. Read
31
+ * as the page loads and whenever they change beneath it; names the model
32
+ * doesn't declare are ignored. Without it the values live in the viewer.
33
+ */
34
+ givens?: Record<string, string>;
35
+ /**
36
+ * The applied values whenever they change, with every given name the model
37
+ * declares (`managed`, so the host knows which parameters to remove), for a
38
+ * host that keeps them in its URL. Called once the model has loaded.
39
+ */
40
+ onGivensChange?: (givens: Record<string, string>, managed: readonly string[]) => void;
41
+ /** Show the Malloy of a source's access rules beside their words. */
42
+ showAccessRules?: boolean;
43
+ /** The heading level of the source's name: `h1` where the viewer is the page. */
44
+ headingLevel?: "h1" | "h2";
45
+ /** Controls at the right of the source's heading. */
46
+ headerActions?: ReactNode;
47
+ /** A host's chips on the source's status row. */
48
+ renderSourceStatus?: (sourceName: string) => ReactNode;
49
+ /**
50
+ * A host's fuller record of the model's fields (see {@link FieldEntity}):
51
+ * per-field code where the file's text isn't served, inherited columns, join
52
+ * targets and declarations. The viewer reads the model file's text without it.
53
+ */
54
+ entities?: ReadonlyArray<FieldEntity>;
55
+ /** `entities` is still being read: rows hold their code rather than saying there is none. */
56
+ entitiesLoading?: boolean;
57
+ /** `entities` could not be read: a row whose code would come from them says so. */
58
+ entitiesError?: boolean;
59
+ /**
60
+ * A host's descriptions of the columns each source's table passes through
61
+ * (source name → column → text), for a dimension with no `#(doc)` of its
62
+ * own; shown marked as generated.
63
+ */
64
+ columnDescriptions?: ReadonlyMap<string, ReadonlyMap<string, string>>;
65
+ /** Where a join to a source in another model file opens; without it such a join has no arrow. */
66
+ joinHref?: (target: {
67
+ modelPath: string;
68
+ sourceName: string;
69
+ }) => string | undefined;
70
+ /** Labels every run carries (`QueryRequest.queryMetadata`). */
71
+ queryMetadata?: Readonly<Record<string, string>>;
72
+ /** Called once per run that settles. */
73
+ onQueryRun?: (event: QueryRunEvent) => void;
74
+ /** A result larger than this (bytes) is held behind a warning before it renders. */
75
+ maxResultSize?: number;
76
+ /** What a host adds to the rows and runs (see {@link ModelViewerExtensions}). */
77
+ extensions?: ModelViewerExtensions;
78
+ }
79
+ /**
80
+ * A Malloy model, read-only: the selected source's givens, views, the model's
81
+ * named queries, and the source's measures, calculations, dimensions and joins,
82
+ * under a header whose "2 sources ▾" pill switches between the model's sources.
83
+ * Every view and named query runs when opened, and a given's picker reads its
84
+ * options when opened, never on render, so browsing costs nothing; a dimension
85
+ * the model tags `#(index)` lists its common values.
86
+ *
87
+ * Nothing here writes a value into Malloy text. A run is a view or a query by
88
+ * name, every name is quoted (`malloyIdentifier`), and given values travel as
89
+ * the request's `givens`, which the server binds.
90
+ */
91
+ export declare function ModelViewer({ resourceUri, sourceName: controlledSourceName, onSourceChange, initialSourceName, includeHiddenFilesAndSources, hostGivenNames, givens: hostParams, onGivensChange, showAccessRules, headingLevel, headerActions, renderSourceStatus, entities, entitiesLoading, entitiesError, columnDescriptions, joinHref, queryMetadata, onQueryRun, maxResultSize, extensions, }: ModelViewerProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,15 @@
1
+ import { ExplorerQuery } from './schemaModel';
2
+ import { RunContext } from './useRunQuery';
3
+ /**
4
+ * A model's named queries as a section of rows, drawn and run exactly as a
5
+ * source's views are (ViewRow): opening one runs it, under Result | Code. Its
6
+ * code is the `query:` declaration read from the
7
+ * model file; where the file isn't served, Code stays in place, disabled, saying
8
+ * why.
9
+ */
10
+ export declare function QueriesGroup({ queries, sourceText, modelPath, run, }: {
11
+ queries: ReadonlyArray<ExplorerQuery>;
12
+ sourceText?: string;
13
+ modelPath: string;
14
+ run?: RunContext;
15
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,27 @@
1
+ import { Icon } from './icons';
2
+ /**
3
+ * Every kind of row the model page draws, one glyph each: a model's dimensions,
4
+ * measures, calculations, views (and named queries) and joins, and a table's
5
+ * columns, which take a dimension's marks.
6
+ */
7
+ export type RowGlyphKind = "dimension" | "measure" | "calculate" | "column" | "view" | "join";
8
+ /**
9
+ * A field's glyph by its DATA TYPE (text, number, date, timestamp, boolean,
10
+ * list, record), the way a BI tool marks its fields: the glyph says what kind
11
+ * of value it is, and the hue says whether it groups or aggregates. `dataType`
12
+ * is the row's own type detail ("number · integer", "date · month",
13
+ * "array<string>"); an unknown or missing type keeps the role's glyph.
14
+ */
15
+ export declare function fieldTypeGlyph(dataType: string | undefined): Icon | undefined;
16
+ /** One step over the row's 13px name. */
17
+ export declare const ROW_GLYPH_SIZE = 16;
18
+ /**
19
+ * The bare glyph that leads a model-page row: 16px, in its kind's hue (a
20
+ * field's glyph by its data type, `fieldTypeGlyph`). Decorative: the section a
21
+ * row sits in already names its kind, and the row's button names the row, so it
22
+ * is hidden from assistive tech.
23
+ */
24
+ export declare function RowGlyph({ kind, dataType, }: {
25
+ kind: RowGlyphKind;
26
+ dataType?: string;
27
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,46 @@
1
+ import { ReactNode } from 'react';
2
+ import { GivenInfo } from './modelGivens';
3
+ import { RunContext } from './useRunQuery';
4
+ /** A run's result as shown, with the given values it ran under. */
5
+ export interface ShownRun {
6
+ result: string;
7
+ /** The values it ran with, as `givensKeyFor` writes them: under the "values
8
+ * changed" banner these are not the panel's. */
9
+ givensKey: string;
10
+ }
11
+ /** What the body shows: the run's result (Session), or the Malloy definition
12
+ * (Base). The two layer segments a view card switches between. */
13
+ export type RunResultMode = "result" | "code";
14
+ /**
15
+ * The body of an open view's card (ViewRow): the result of running it, or the Malloy
16
+ * that declares it, whichever the card's Result | Code switch picks. Body only —
17
+ * the card above it carries the name and the switch.
18
+ *
19
+ * The run happens the first time the Result mode is shown, never in Code mode:
20
+ * reading a definition must not bill a query. It renders through the SDK's own
21
+ * result container, so a result here and in a report are one thing.
22
+ */
23
+ export declare function RunResult({ run, modelPath, query, sourceName, givens, givensUnknown, mode, renderCode, onShownChange, }: {
24
+ run: RunContext;
25
+ modelPath: string;
26
+ query: string;
27
+ /** The source a view belongs to, for its required-filter check; a named
28
+ * query has none. */
29
+ sourceName?: string;
30
+ /** The givens the run reads, where its source can't say (a named query the
31
+ * model gives no source); else its source's. */
32
+ givens?: ReadonlyArray<GivenInfo>;
33
+ /** With `givens`: those of them the page can't tie to the run either way
34
+ * (scanGivensOfNamedQuery). Without, its source's (`unknownGivensBySource`). */
35
+ givensUnknown?: ReadonlySet<string>;
36
+ /** Which body to show. The switching is the card's job; this renders
37
+ * whichever mode it is told. */
38
+ mode?: RunResultMode;
39
+ /** Renders the Malloy body for the `definition` mode. A function, called
40
+ * only when that body is shown, so a result-mode stage does none of the
41
+ * code-stripping work. */
42
+ renderCode?: () => ReactNode;
43
+ /** Told the result this stage is showing, including one held under the "values
44
+ * changed" banner, so a host's download exports exactly what is on screen. */
45
+ onShownChange?: (shown: ShownRun | undefined) => void;
46
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,20 @@
1
+ import { ExplorerField } from './schemaModel';
2
+ import { SampleValuesFetcher } from './useDimensionSamples';
3
+ import { RunContext } from './useRunQuery';
4
+ /**
5
+ * A dimension's sample values: its most common values, most common first,
6
+ * fetched lazily (see useDimensionSamples). What the dimension MEANS, so its
7
+ * own card on the open row.
8
+ *
9
+ * <p>Mounts only inside an open row, so the fetch is paid for on a reader's
10
+ * click rather than while browsing.
11
+ */
12
+ export declare function SampleValues({ run, fetchSamples, modelPath, sourceName, field, generation, }: {
13
+ run: RunContext;
14
+ fetchSamples?: SampleValuesFetcher;
15
+ modelPath: string;
16
+ sourceName: string;
17
+ field: ExplorerField;
18
+ /** The host build the values come from (see useDimensionSamples). */
19
+ generation?: string;
20
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,51 @@
1
+ import { EntitiesByField } from './fieldEntities';
2
+ import { JoinLink } from './joinAccess';
3
+ import { ExplorerJoin } from './schemaModel';
4
+ import { SourceAccess } from './sourceAccess';
5
+ import { RunContext } from './useRunQuery';
6
+ interface SchemaJoinProps {
7
+ join: ExplorerJoin;
8
+ run?: RunContext;
9
+ modelPath: string;
10
+ sourceName: string;
11
+ /** Whether the joined SOURCE has a page of its own, and where. A package
12
+ * can serve a source only as a join partner (see joinAccess.ts), and the
13
+ * row must not offer a door that isn't there — those say so in words
14
+ * instead. Absent, or `unknown`, → neither arrow nor note: not yet
15
+ * established is not the same as established absent. */
16
+ link?: JoinLink;
17
+ /** The JOINED source's own fields. A joined source is the same source seen
18
+ * from another page, so its fields expand to definitions exactly as they
19
+ * do there. Absent (e.g. the target's model hasn't loaded) → the rows
20
+ * render with nothing to open rather than claiming "no
21
+ * definition". */
22
+ entitiesByName?: EntitiesByField;
23
+ entitiesLoading?: boolean;
24
+ entitiesError?: boolean;
25
+ /** The join's declaration, verbatim from a host's entities
26
+ * ("customer is customers with customer_id"), drawn in the page's code card. */
27
+ code?: string;
28
+ /** The joined source, where it declares an access rule: its Restricted or
29
+ * Row filtered pill rides on this row. */
30
+ target?: {
31
+ sourceName: string;
32
+ access: SourceAccess;
33
+ };
34
+ /** Whether the reader can change the model, so an open join to a gated
35
+ * source warns that its gate does not apply here. */
36
+ showRules?: boolean;
37
+ }
38
+ /**
39
+ * A join as a row of the page, opened and closed as every other row is (RowLine):
40
+ * its name, its field count, its doc, and at the right its relationship and the
41
+ * arrow to the joined source's own page. Open, it shows the joined source's
42
+ * fields — the same sections and rows the source's own use, one level in, framed
43
+ * as one block — with Fields | Code on its line, as an open view's Result | Code,
44
+ * and its declaration in the page's one code card (QueryCode) one click over.
45
+ *
46
+ * Opening is the default gesture (the join is part of this source). Navigating
47
+ * away to the joined source's own page is the deliberate one, so it gets a
48
+ * trailing arrow rather than being armed on the name.
49
+ */
50
+ export declare function SchemaJoin({ join, run, modelPath, sourceName, link, entitiesByName, entitiesLoading, entitiesError, code, target, showRules, }: SchemaJoinProps): import("react/jsx-runtime").JSX.Element;
51
+ export {};
@@ -0,0 +1,52 @@
1
+ import { ReactNode } from 'react';
2
+ import { EntitiesByField } from './fieldEntities';
3
+ import { JoinLink } from './joinAccess';
4
+ import { ExplorerSource } from './schemaModel';
5
+ import { SourceAccess } from './sourceAccess';
6
+ import { RunContext } from './useRunQuery';
7
+ interface SchemaViewProps {
8
+ source: ExplorerSource;
9
+ modelPath: string;
10
+ /** A host's entities for the source (per-field code and provenance), when
11
+ * it passes any. Undefined until loaded, and when there are none. */
12
+ entitiesByName?: EntitiesByField;
13
+ entitiesLoading?: boolean;
14
+ entitiesError?: boolean;
15
+ /** The model file's text, for the code of a field the entities don't carry
16
+ * (all of them, without a host's entities): see `fieldDeclarations`. */
17
+ modelText?: string;
18
+ /** Join name → whether the joined source has a page, and where. */
19
+ joinLinks?: Map<string, JoinLink>;
20
+ /** Join name → the JOINED source's own fields, so a joined source offers
21
+ * the same per-field definitions as it would on its own page. Keyed by
22
+ * join alias because that is what the rendered join is named. */
23
+ joinEntities?: Map<string, EntitiesByField>;
24
+ /** Join name → its declaration, verbatim from the host's entities. */
25
+ joinCodes?: Map<string, string>;
26
+ /** Join name → the joined source's access rules, where it declares any. */
27
+ joinAccess?: ReadonlyMap<string, {
28
+ sourceName: string;
29
+ access: SourceAccess;
30
+ }>;
31
+ /** Whether the reader can change the model (an editor sees the join's
32
+ * gate warning). */
33
+ showRules?: boolean;
34
+ /** A host's descriptions of the base table's columns (column → text), for
35
+ * the dimensions this source inherits rather than defines. */
36
+ columnDescriptions?: ReadonlyMap<string, string>;
37
+ /** Where to run this source's views against the served model. */
38
+ run?: RunContext;
39
+ /** The model's named queries, as their own section after the views: the two
40
+ * are the page's results, so they read together before the fields. */
41
+ queries?: ReactNode;
42
+ /** The givens this source reads, as the page's first section: they set every
43
+ * run below them (ModelGivensSection). */
44
+ givens?: ReactNode;
45
+ }
46
+ /**
47
+ * Single-source browse view, as always-open sections: the givens it reads, the
48
+ * views, the model's queries, the measures, calculations and dimensions, each a
49
+ * row that opens in place, then each join as an expandable row.
50
+ */
51
+ export declare function SchemaView({ source, modelPath, entitiesByName, entitiesLoading, entitiesError, modelText, joinLinks, joinEntities, joinCodes, joinAccess, showRules, columnDescriptions, run, queries, givens, }: SchemaViewProps): import("react/jsx-runtime").JSX.Element;
52
+ export {};
@@ -0,0 +1,70 @@
1
+ import { ReactNode } from 'react';
2
+ export interface SegmentIconOption<T extends string> {
3
+ value: T;
4
+ icon: ReactNode;
5
+ /** The accessible name AND the tooltip — kept equal (ux-design-guide §4). */
6
+ label: string;
7
+ /**
8
+ * Present but not selectable. For a representation this thing HAS but cannot show yet
9
+ * (or at all) — the option keeps its place so the switch does not change width as the
10
+ * data behind it arrives, which is the layout shift that omitting it causes.
11
+ */
12
+ disabled?: boolean;
13
+ /**
14
+ * Why it is disabled, as the tooltip, replacing `label`. A disabled control with no
15
+ * explanation is the failure mode this exists to avoid: the reader can see the option
16
+ * and cannot tell whether it is broken or merely not applicable here.
17
+ */
18
+ disabledReason?: string;
19
+ }
20
+ /**
21
+ * An action icon's button: a switch option's (active when pressed) and an action
22
+ * beside a switch (ActionIconButton) are one look, so a row of them reads as one set.
23
+ * The pressed one sits in a faint fill so the active layer reads at a glance; the
24
+ * rest are quiet.
25
+ */
26
+ export declare function actionIconSx(active: boolean): {
27
+ readonly p: "3px";
28
+ readonly borderRadius: 1;
29
+ readonly color: "text.secondary" | "text.primary";
30
+ readonly bgcolor: "transparent" | "action.selected";
31
+ readonly "&:hover": {
32
+ readonly bgcolor: "action.hover" | "action.selected";
33
+ readonly color: "text.primary";
34
+ };
35
+ readonly "&.Mui-disabled": {
36
+ readonly color: "text.disabled";
37
+ };
38
+ };
39
+ /**
40
+ * A "which layer of this thing am I looking at" switch, drawn as **action
41
+ * icons** rather than labelled chips — the app's one switch of record for
42
+ * choosing a representation of something already named beside it: on an
43
+ * open model row (its layers — Result, Code, Givens, Materialization — through
44
+ * RowLayerSwitch, at the row's line) and over a result. (A whole file's views are not a switch but the first items of
45
+ * its ⋯ — `viewActions`.) Any number of options, one pressed. The caller sizes
46
+ * its own glyphs — 14 on a row.
47
+ *
48
+ * <p>Why icons, not labelled chips: these switches choose a REPRESENTATION of
49
+ * something already named next to them, so words would restate the noun rather
50
+ * than add to it — "Model | Code" under a heading that says `auto_recalls`.
51
+ * The glyphs are
52
+ * the app's own (ContentTypeIcon's mark for each kind of file, the code
53
+ * brackets), so the switch reads as a lens over the named thing instead of
54
+ * chrome beside it.
55
+ *
56
+ * <p>The label is not lost, only moved: every option's `label` is BOTH its
57
+ * tooltip and its accessible name (ux-design-guide §4), so pointer users get
58
+ * the word on hover and screen readers get it unconditionally — and the option
59
+ * stays addressable by name, which is what keeps an icon switch testable. A
60
+ * disabled option keeps its place and swaps both for its `disabledReason`.
61
+ *
62
+ * <p>Group semantics: `role="group"` named by the caller, each option a
63
+ * `role="button"` with `aria-pressed`, so it is one control to a screen reader.
64
+ */
65
+ export declare function SegmentIcons<T extends string>({ value, options, onChange, "aria-label": ariaLabel, }: {
66
+ value: T;
67
+ options: ReadonlyArray<SegmentIconOption<T>>;
68
+ onChange: (value: T) => void;
69
+ "aria-label": string;
70
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,53 @@
1
+ import { ReactNode } from 'react';
2
+ import { SourceAccess } from './sourceAccess';
3
+ import { PickerDescription } from './sourcePicker';
4
+ /** A source as this dropdown needs it: what to show. */
5
+ export interface SourceNavItem {
6
+ name: string;
7
+ /** The row's description, two lines at most: the source's `#(doc)`, else a
8
+ * host's summary, marked as generated (`pickerDescription`). */
9
+ description?: PickerDescription;
10
+ /** Hold the description's line: the source has no doc, and a host's
11
+ * summaries are still being read, so one may arrive. */
12
+ descriptionPending?: boolean;
13
+ /** "16 views · 37 fields · 4 joins" (`sourceMetaLine`), from the compiled model. */
14
+ meta: string;
15
+ /** The source the model opens on, when it has the most views: a quiet token. */
16
+ mostViews?: boolean;
17
+ /** The source's access declarations. A restricted source stays listed (a
18
+ * reader learns it exists, and that it is restricted), marked beside its
19
+ * name. */
20
+ access?: SourceAccess;
21
+ /** A host's chips after the source's name (`describePickerSource`). */
22
+ status?: ReactNode;
23
+ }
24
+ /** The header's line on the package's root `index.malloy`, whose sources are the curated set,
25
+ * when they are listed in its export order. */
26
+ export declare const CURATED_SOURCES_HELP = "This package's curated sources, in the order its index.malloy exports them.";
27
+ /** The same, when the file's export order is unknown (its text withheld): it claims no order. */
28
+ export declare const PUBLIC_SOURCES_HELP = "This package's public sources.";
29
+ /**
30
+ * The sources of a model, as a dropdown hanging off the source picker pill
31
+ * beside the title ({@link import("./SourcesNav").SourcesNav}). A dropdown
32
+ * rather than a resident switcher: a model has a handful of sources and a
33
+ * reader settles into one, so the page stays in view and it closes on a click
34
+ * away.
35
+ *
36
+ * <p>Each row is what a reader needs to choose the source an analysis starts
37
+ * from: its name, its pills (the default's quiet **Most views**, access), two
38
+ * lines of description, and one line of counts, in `orderPickerSources`' order.
39
+ */
40
+ export declare function SourcesDropdown({ anchorEl, onClose, sources, currentName, onPickSource, curated, exportOrdered, }: {
41
+ /** The button this dropdown hangs from; null while closed. */
42
+ anchorEl: HTMLElement | null;
43
+ onClose: () => void;
44
+ sources: ReadonlyArray<SourceNavItem>;
45
+ currentName: string;
46
+ onPickSource: (name: string) => void;
47
+ /** The model is the package's root `index.malloy`: its header says these are the curated set. */
48
+ curated?: boolean;
49
+ /** The curated set is listed in the order its index.malloy exports it, so the header says so. */
50
+ exportOrdered?: boolean;
51
+ }): import("react/jsx-runtime").JSX.Element;
52
+ /** The quiet token on the source a model opens on, when it has the most views. */
53
+ export declare const MOST_VIEWS_LABEL = "Most views";
@@ -0,0 +1,25 @@
1
+ import { SourceNavItem } from './SourcesDropdown';
2
+ /**
3
+ * The model's source picker, beside the source's h1 ({@link import("./HeaderBar").HeaderBar})
4
+ * as the package page's version pill sits beside the package's ("v1.0.1 ▾"): the same
5
+ * `PillButton`, with the same props, so the two read as one family. Its face is the count —
6
+ * "2 sources ▾", or "4 public sources ▾" on the package's root `index.malloy`, whose sources
7
+ * are what the package publishes — and it opens the {@link SourcesDropdown} . The caller draws it only when there is something to switch to:
8
+ * more than one source. A model's named queries are rows on the page (QueriesGroup).
9
+ *
10
+ * <p>Reaching for it (pointer over, focus, a click) calls `onWarm`, which is when the
11
+ * picker's summaries are asked for (§7a).
12
+ */
13
+ export declare function SourcesNav({ sources, currentName, countLabel, onPickSource, curated, exportOrdered, onWarm, }: {
14
+ sources: ReadonlyArray<SourceNavItem>;
15
+ currentName: string;
16
+ /** The pill's face: "2 sources", "4 public sources" (`sourceCountLabel`). */
17
+ countLabel: string;
18
+ onPickSource: (name: string) => void;
19
+ /** The model is the package's root `index.malloy` (see SourcesDropdown). */
20
+ curated?: boolean;
21
+ /** Its sources are listed in the order its index.malloy exports them (see SourcesDropdown). */
22
+ exportOrdered?: boolean;
23
+ /** The reader is reaching for the picker: start what its rows will need. */
24
+ onWarm?: () => void;
25
+ }): import("react/jsx-runtime").JSX.Element;