@genome-spy/app 0.74.0 → 0.76.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 (66) hide show
  1. package/dist/AbortablePromiseCache-beUIcZcW.js +96 -0
  2. package/dist/agentApi-CzdacisO.js +25226 -0
  3. package/dist/agentApi.es.js +9460 -0
  4. package/dist/agentShared.es.js +4742 -0
  5. package/dist/{blosc-oa0DlI6G.js → blosc-BX4BJ8sR.js} +1 -1
  6. package/dist/componentStyles-CIXoKEp0.js +2182 -0
  7. package/dist/dialog.es.js +377 -0
  8. package/dist/{esm-n0auOe11.js → esm-BH0wx5y-.js} +1 -1
  9. package/dist/esm-BLfLaJtE.js +121 -0
  10. package/dist/{esm-D-WfYOx7.js → esm-BWsx1OJ2.js} +25 -25
  11. package/dist/{browser-Dvlo92rx.js → esm-BY4T8YoD.js} +38 -22
  12. package/dist/esm-CZvS2Ldm.js +155 -0
  13. package/dist/esm-CdIesJ1z.js +461 -0
  14. package/dist/{esm-DCCYNvaz.js → esm-Cr7pLUfG.js} +50 -50
  15. package/dist/esm-D-y0Ce1M.js +573 -0
  16. package/dist/esm-DHOMWRoL.js +1426 -0
  17. package/dist/{esm-Cmo4qEPr.js → esm-DJUb6vy0.js} +5 -5
  18. package/dist/esm-DPS6pYKF.js +1248 -0
  19. package/dist/esm-DRZ5LLNH.js +142 -0
  20. package/dist/esm-DjF6pKy5.js +369 -0
  21. package/dist/esm-PDPkTR1_.js +1015 -0
  22. package/dist/esm-s_SlArJ8.js +298 -0
  23. package/dist/index.es.js +7910 -28759
  24. package/dist/index.js +1135 -736
  25. package/dist/lit-ymUSmGBw.js +510 -0
  26. package/dist/{lz4-jZ0zyLBa.js → lz4-BSYl80V8.js} +1 -1
  27. package/dist/parquetRead-m8-8_SpH.js +1609 -0
  28. package/dist/schema.json +665 -97
  29. package/dist/style.css +1 -1
  30. package/dist/viewUtils-C5htqZCm.js +14147 -0
  31. package/dist/{zstd-C6ksIG9r.js → zstd-BAfRM3IH.js} +1 -1
  32. package/package.json +30 -5
  33. package/src/agentApi/index.d.ts +123 -0
  34. package/src/agentShared/index.d.ts +97 -0
  35. package/src/agentShared/types.d.ts +8 -0
  36. package/src/appTypes.d.ts +75 -0
  37. package/src/bookmark/databaseSchema.d.ts +33 -0
  38. package/src/charts/boxplotTypes.d.ts +15 -0
  39. package/src/charts/sampleAttributePlotTypes.d.ts +149 -0
  40. package/src/coreSpecAugmentation.d.ts +29 -0
  41. package/src/dialog/index.d.ts +5 -0
  42. package/src/embedTypes.d.ts +9 -0
  43. package/src/index.d.ts +16 -0
  44. package/src/sampleView/sampleViewTypes.d.ts +174 -0
  45. package/src/sampleView/state/payloadTypes.d.ts +400 -0
  46. package/src/sampleView/state/sampleState.d.ts +76 -0
  47. package/src/sampleView/types.d.ts +125 -0
  48. package/src/spec/appSpec.d.ts +54 -0
  49. package/src/spec/sampleView.d.ts +487 -0
  50. package/src/spec/view.d.ts +124 -0
  51. package/src/state/paramProvenanceTypes.d.ts +215 -0
  52. package/src/state/selectionExpansionTypes.d.ts +77 -0
  53. package/src/state.d.ts +97 -0
  54. package/src/types/lz-string.d.ts +24 -0
  55. package/src/types/vega-loader.d.ts +1 -0
  56. package/src/utils/colorScaleSummary.d.ts +15 -0
  57. package/src/utils/statistics/fieldSummary.d.ts +49 -0
  58. package/src/vite-env.d.ts +6 -0
  59. package/LICENSE +0 -21
  60. /package/dist/{AbortablePromiseCache-3gHJdF3E.js → AbortablePromiseCache-BDH1cqFl.js} +0 -0
  61. /package/dist/{chunk-INHXZS53-fPMmEwMt.js → chunk-INHXZS53-DwEV9sMh.js} +0 -0
  62. /package/dist/{esm-BygJiwh0.js → esm-BL9SNSnj.js} +0 -0
  63. /package/dist/{esm-B8-vSu-c.js → esm-BwW--bVV.js} +0 -0
  64. /package/dist/{esm-CGX-qz1d.js → esm-Bz_92nH0.js} +0 -0
  65. /package/dist/{esm-CuMSzCHy.js → esm-D2_c7lXY.js} +0 -0
  66. /package/dist/{parquetRead-CJe1UPsz.js → parquetRead-BuEN-6yG.js} +0 -0
@@ -1,4 +1,4 @@
1
- import { t as e } from "./chunk-INHXZS53-fPMmEwMt.js";
1
+ import { t as e } from "./chunk-INHXZS53-DwEV9sMh.js";
2
2
  //#region ../../node_modules/numcodecs/dist/zstd.js
3
3
  var t = (typeof document < "u" && document.currentScript?.src, function(e = {}) {
4
4
  var t, n = e, r, i, a = new Promise((e, t) => {
package/package.json CHANGED
@@ -8,24 +8,46 @@
8
8
  "contributors": [],
9
9
  "license": "MIT",
10
10
  "homepage": "https://genomespy.app/",
11
- "version": "0.74.0",
11
+ "version": "0.76.0",
12
12
  "main": "dist/index.js",
13
13
  "module": "dist/index.es.js",
14
14
  "type": "module",
15
+ "types": "src/index.d.ts",
15
16
  "exports": {
16
17
  ".": {
18
+ "types": "./src/index.d.ts",
19
+ "development": "./src/index.js",
17
20
  "import": "./dist/index.es.js",
18
21
  "default": "./dist/index.js"
19
22
  },
23
+ "./agentApi": {
24
+ "types": "./src/agentApi/index.d.ts",
25
+ "development": "./src/agentApi/index.js",
26
+ "import": "./dist/agentApi.es.js",
27
+ "default": "./dist/agentApi.es.js"
28
+ },
29
+ "./agentShared": {
30
+ "types": "./src/agentShared/index.d.ts",
31
+ "development": "./src/agentShared/index.js",
32
+ "import": "./dist/agentShared.es.js",
33
+ "default": "./dist/agentShared.es.js"
34
+ },
20
35
  "./browser": {
21
36
  "import": "./dist/index.es.js",
22
37
  "default": "./dist/index.js"
23
38
  },
39
+ "./dialog": {
40
+ "types": "./src/dialog/index.d.ts",
41
+ "development": "./src/dialog/index.js",
42
+ "import": "./dist/dialog.es.js",
43
+ "default": "./dist/dialog.es.js"
44
+ },
24
45
  "./schema.json": "./dist/schema.json",
25
46
  "./style.css": "./dist/style.css"
26
47
  },
27
48
  "files": [
28
- "dist/"
49
+ "dist/",
50
+ "src/**/*.d.ts"
29
51
  ],
30
52
  "repository": {
31
53
  "type": "git",
@@ -34,7 +56,7 @@
34
56
  },
35
57
  "scripts": {
36
58
  "dev": "node dev-server.mjs",
37
- "build": "rm -rf dist && mkdir -p dist && vite build && npm run build:schema",
59
+ "build": "rm -rf dist && mkdir -p dist && vite build && vite build --config vite.agent-subpaths.config.js && npm run build:schema",
38
60
  "build:schema": "mkdir -p dist && ts-json-schema-generator --path 'src/spec/*.d.ts' --type AppRootSpec > dist/schema.json",
39
61
  "test:tsc": "npm run test:tsc:src && npm run test:tsc:tests",
40
62
  "test:tsc:src": "tsc -p tsconfig.json --noEmit",
@@ -48,7 +70,7 @@
48
70
  "@fortawesome/fontawesome-free": "^6.4.2",
49
71
  "@fortawesome/fontawesome-svg-core": "^6.4.2",
50
72
  "@fortawesome/free-solid-svg-icons": "^6.4.2",
51
- "@genome-spy/core": "^0.74.0",
73
+ "@genome-spy/core": "^0.76.0",
52
74
  "@reduxjs/toolkit": "^2.11.0",
53
75
  "d3-color": "^3.1.0",
54
76
  "idb": "^7.1.1",
@@ -59,5 +81,8 @@
59
81
  "redux-undo": "^1.0.1",
60
82
  "zarrita": "^0.6.1"
61
83
  },
62
- "gitHead": "7648d8c8670e288486f20bd7fe73509c4844cd83"
84
+ "devDependencies": {
85
+ "@genome-spy/app-agent": "^0.76.0"
86
+ },
87
+ "gitHead": "34d821cf5e864972afaa65a3290719e2fdb209c2"
63
88
  }
@@ -0,0 +1,123 @@
1
+ /**
2
+ * `agentApi` exposes App internals to the agent and plugin surfaces only.
3
+ * Do not add App code here that the rest of App should depend on.
4
+ *
5
+ * `AgentApi` is the centralized handle for host state, provenance, and view
6
+ * mutations that the extracted agent package may use.
7
+ */
8
+ import type { Action } from "@reduxjs/toolkit";
9
+ import type {
10
+ ActionInfo,
11
+ AttributeIdentifier,
12
+ AttributeInfo,
13
+ AppRootSpec,
14
+ AppState,
15
+ ProvenanceAction,
16
+ SampleHierarchy,
17
+ ViewSelector,
18
+ } from "../agentShared/index.d.ts";
19
+ import type {
20
+ SampleAttributePlot,
21
+ SampleAttributePlotRequest,
22
+ SampleAttributePlotType,
23
+ } from "../charts/sampleAttributePlotTypes.d.ts";
24
+ import type { ScaleResolutionApi } from "@genome-spy/core/types/scaleResolutionApi.js";
25
+ import type UnitView from "@genome-spy/core/view/unitView.js";
26
+ export interface AgentApi {
27
+ /**
28
+ * Returns the current sample hierarchy used by the agent context.
29
+ */
30
+ getSampleHierarchy(): SampleHierarchy | undefined;
31
+
32
+ getAttributeInfo(attribute: AttributeIdentifier): AttributeInfo | undefined;
33
+
34
+ /**
35
+ * Resolves live selection-backed intervals inside an attribute identifier to
36
+ * literal intervals for formatting and durable features.
37
+ */
38
+ materializeAttributeIdentifier(
39
+ attribute: AttributeIdentifier
40
+ ): AttributeIdentifier;
41
+
42
+ /**
43
+ * Returns the current SampleView-scoped param config.
44
+ *
45
+ * TODO(app): Make this unscoped and accept a `ParamSelector` once the
46
+ * agent boundary no longer needs the SampleView-local lookup.
47
+ */
48
+ getSampleViewScopedParamConfig(
49
+ paramName: string
50
+ ): { description?: string } | undefined;
51
+
52
+ getSearchableViews(): UnitView[];
53
+
54
+ getViewRoot(): import("@genome-spy/core/view/view.js").default | undefined;
55
+
56
+ /**
57
+ * Returns the current focus view for tree normalization and expansion.
58
+ * This is typically the current sample view.
59
+ */
60
+ getFocusedView():
61
+ | import("@genome-spy/core/view/view.js").default
62
+ | undefined;
63
+
64
+ /**
65
+ * Returns the root spec used to summarize the top-level visualization.
66
+ */
67
+ getRootSpec(): AppRootSpec;
68
+
69
+ getNamedScaleResolutions(): Map<string, ScaleResolutionApi>;
70
+
71
+ resolveViewSelector(
72
+ selector: ViewSelector
73
+ ): import("@genome-spy/core/view/view.js").default | undefined;
74
+
75
+ getSelectionFeatureFieldValues(
76
+ viewSelector: ViewSelector,
77
+ selectionSelector: import("@genome-spy/core/view/viewSelectors.js").ParamSelector,
78
+ field: string
79
+ ): unknown[] | undefined;
80
+
81
+ /**
82
+ * Returns the provenance actions currently available to the agent.
83
+ */
84
+ getActionHistory(): ProvenanceAction[];
85
+
86
+ getActionInfo(action: Action): ActionInfo | undefined;
87
+
88
+ /**
89
+ * Submits a prepared set of actions to the app intent pipeline.
90
+ */
91
+ submitIntentActions(
92
+ actions: Action[],
93
+ options?: { submissionKind?: "agent" | "bookmark" | "user" }
94
+ ): Promise<void>;
95
+
96
+ /**
97
+ * Returns the current provenance state used by selection and timeline tools.
98
+ */
99
+ getPresentProvenanceState(): AppState["provenance"]["present"] | undefined;
100
+
101
+ buildSampleAttributePlot(
102
+ request: SampleAttributePlotRequest
103
+ ): Promise<SampleAttributePlot | undefined>;
104
+
105
+ setViewVisibility(selector: ViewSelector, visibility: boolean): void;
106
+
107
+ jumpToProvenanceState(provenanceId: string): boolean;
108
+
109
+ jumpToInitialProvenanceState(): boolean;
110
+ }
111
+
112
+ export type {
113
+ SampleAttributePlot,
114
+ SampleAttributePlotRequest,
115
+ SampleAttributePlotType,
116
+ };
117
+
118
+ export declare function embedRenderablePlot(
119
+ container: HTMLElement,
120
+ plot: SampleAttributePlot
121
+ ): Promise<import("@genome-spy/core/types/embedApi.js").EmbedResult>;
122
+
123
+ export declare function createAgentApi(app: any): AgentApi;
@@ -0,0 +1,97 @@
1
+ /**
2
+ * `agentShared` exposes App internals to the agent and plugin surfaces only.
3
+ * Do not add App code here that the rest of App should depend on.
4
+ *
5
+ * Shared helper surface for agent-facing utilities used by the App and the
6
+ * future extracted agent package.
7
+ *
8
+ * Host state and mutation access stays on `AgentApi`.
9
+ */
10
+ export { makeViewSelectorKey } from "../viewSettingsUtils.js";
11
+ export { formatScopedParamName } from "../viewScopeUtils.js";
12
+ export { serializeBookmarkableParamValue } from "../state/paramValueSerialization.js";
13
+ export { isBaselineAction } from "../state/provenanceBaseline.js";
14
+ export {
15
+ createSelectionAggregationCandidateId,
16
+ getContextMenuFieldInfos,
17
+ } from "../sampleView/selectionAggregationCandidates.js";
18
+ export { buildSelectionAggregationAttributeIdentifier } from "../sampleView/selectionAggregationAttributes.js";
19
+ export { formatAggregationExpression } from "../sampleView/attributeAggregation/aggregationOps.js";
20
+ export { default as templateResultToString } from "../utils/templateResultToString.js";
21
+ export { faStyles, formStyles } from "../components/generic/componentStyles.js";
22
+ export { default as safeMarkdown } from "../utils/safeMarkdown.js";
23
+ export {
24
+ addValueColors,
25
+ getConcreteColorScale,
26
+ } from "../utils/colorScaleSummary.js";
27
+ export {
28
+ buildCategoricalCountsSummary,
29
+ buildCategoricalFieldSummary,
30
+ buildQuantitativeFieldSummary,
31
+ buildTopCategorySummary,
32
+ } from "../utils/statistics/fieldSummary.js";
33
+ export type { ParamSelector, ViewSelector } from "./types.d.ts";
34
+ export type {
35
+ AggregationOp,
36
+ AttributeIdentifier,
37
+ AttributeIdentifierType,
38
+ AttributeInfo,
39
+ AttributeEnsureContext,
40
+ AttributeValuesScope,
41
+ AggregationSpec,
42
+ Interval,
43
+ IntervalPoint,
44
+ } from "../sampleView/types.d.ts";
45
+ export type { AppRootSpec } from "../spec/appSpec.d.ts";
46
+ export type { ActionInfo, ProvenanceAction } from "../state/provenance.js";
47
+ export type { AppState } from "../state/setupStore.js";
48
+ export type {
49
+ BaseGroup,
50
+ Group,
51
+ GroupGroup,
52
+ GroupMetadata,
53
+ Metadatum,
54
+ Metadata,
55
+ Sample,
56
+ SampleGroup,
57
+ SampleHierarchy,
58
+ SampleId,
59
+ SampleMetadata,
60
+ } from "../sampleView/state/sampleState.d.ts";
61
+ export type {
62
+ ExpandPointSelectionActionPayload,
63
+ ParamOrigin,
64
+ ParamProvenanceEntry,
65
+ ParamProvenanceState,
66
+ ParamValue,
67
+ ParamValueInterval,
68
+ ParamValueLiteral,
69
+ ParamValuePoint,
70
+ ParamValuePointExpand,
71
+ PointExpandMatcher,
72
+ PointExpandOrigin,
73
+ } from "../state/paramProvenanceTypes.d.ts";
74
+ export type {
75
+ IntervalCarrier,
76
+ IntervalReference,
77
+ IntervalSpecifier,
78
+ LocusSpecifier,
79
+ FeatureFilter,
80
+ SelectionIntervalSource,
81
+ ViewAttributeSpecifier,
82
+ ViewRef,
83
+ } from "../sampleView/sampleViewTypes.d.ts";
84
+ export type * from "../sampleView/state/payloadTypes.d.ts";
85
+ export type {
86
+ SampleAttributeDef,
87
+ SampleAttributeType,
88
+ } from "../spec/sampleView.d.ts";
89
+
90
+ type SupportedActionType =
91
+ | `sampleView/${import("../sampleView/state/sampleSlice.js").SampleActionType}`
92
+ | `paramProvenance/${keyof typeof import("../state/paramProvenanceSlice.js").paramProvenanceSlice.actions}`
93
+ | `viewSettings/${keyof typeof import("../viewSettingsSlice.js").viewSettingsSlice.actions}`;
94
+
95
+ export declare function getActionCreator(
96
+ actionType: SupportedActionType
97
+ ): (payload: any) => import("@reduxjs/toolkit").PayloadAction<any>;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * `agentShared` exposes App internals to the agent and plugin surfaces only.
3
+ * Do not add App code here that the rest of App should depend on.
4
+ */
5
+ export type {
6
+ ParamSelector,
7
+ ViewSelector,
8
+ } from "@genome-spy/core/view/viewUtilTypes.d.ts";
@@ -0,0 +1,75 @@
1
+ import { BookmarkEntry } from "./bookmark/databaseSchema.js";
2
+ import { EmbedResult } from "@genome-spy/core/types/embedApi.js";
3
+ import type { IconDefinition } from "@fortawesome/fontawesome-svg-core";
4
+
5
+ export type UrlHash = Partial<BookmarkEntry>;
6
+
7
+ export type AppEmbedOptions =
8
+ import("@genome-spy/core/types/embedApi.js").EmbedOptions & {
9
+ showInspectorButton?: boolean;
10
+ plugins?: AppPlugin[];
11
+ };
12
+
13
+ export interface ToolbarButtonSpec {
14
+ title: string;
15
+ icon: IconDefinition;
16
+ onClick: () => void | Promise<void>;
17
+ }
18
+
19
+ export interface AppUiHost {
20
+ registerToolbarButton(button: ToolbarButtonSpec): () => void;
21
+ registerToolbarMenuItem(
22
+ item: import("./utils/ui/contextMenu.js").MenuItem
23
+ ): () => void;
24
+ registerSidePanel?(panel: SidePanelSpec): SidePanelHandle;
25
+ }
26
+
27
+ export interface SidePanelSpec {
28
+ id: string;
29
+ element: HTMLElement;
30
+ preferredWidth?: string;
31
+ }
32
+
33
+ export interface SidePanelHandle {
34
+ show(): void;
35
+ hide(): void;
36
+ toggle(): boolean;
37
+ isVisible(): boolean;
38
+ dispose(): void;
39
+ }
40
+
41
+ export interface AppPluginHost {
42
+ readonly ui: AppUiHost;
43
+ getAgentApi(): Promise<import("./agentApi/index.js").AgentApi>;
44
+ }
45
+
46
+ export interface AppPlugin {
47
+ name?: string;
48
+ install(
49
+ host: AppPluginHost
50
+ ): void | (() => void) | Promise<void | (() => void)>;
51
+ }
52
+
53
+ export interface AppUiRegistry extends AppUiHost, EventTarget {
54
+ readonly toolbarButtons: Set<ToolbarButtonSpec>;
55
+ readonly toolbarMenuItems: Set<
56
+ import("./utils/ui/contextMenu.js").MenuItem
57
+ >;
58
+ attachAppShell(appShell: HTMLElement): void;
59
+ registerSidePanel(panel: SidePanelSpec): SidePanelHandle;
60
+ }
61
+
62
+ export type AppEmbedFunction = (
63
+ el: HTMLElement | string,
64
+ spec: import("./spec/appSpec.js").AppRootSpec | string,
65
+ options?: AppEmbedOptions
66
+ ) => EmbedResult;
67
+
68
+ export interface DependencyQueryDetails {
69
+ /** Name of the queried dependency */
70
+ name: string;
71
+ /** Callback that will set the dependency. */
72
+ setter: (dependency: any) => void;
73
+ }
74
+
75
+ export type DependencyQueryEvent = CustomEvent<DependencyQueryDetails>;
@@ -0,0 +1,33 @@
1
+ import { DBSchema } from "idb";
2
+ import { ChromosomalLocus } from "@genome-spy/core/genome/genome.js";
3
+ import { ViewSettingsPayload } from "../state.js";
4
+ import { Action } from "../state/provenance.js";
5
+
6
+ export interface BookmarkEntry {
7
+ name: string;
8
+ timestamp?: number;
9
+
10
+ notes?: string;
11
+
12
+ /**
13
+ * Provenance
14
+ */
15
+ actions?: Action[];
16
+
17
+ /**
18
+ * Domains of scales that are both zoomable and named
19
+ */
20
+ scaleDomains?: Record<string, number[] | ChromosomalLocus[]>;
21
+
22
+ /**
23
+ * Settings such as view visibilities
24
+ */
25
+ viewSettings?: ViewSettingsPayload;
26
+ }
27
+
28
+ export interface BookmarkDB extends DBSchema {
29
+ bookmarks: {
30
+ value: BookmarkEntry;
31
+ key: string;
32
+ };
33
+ }
@@ -0,0 +1,15 @@
1
+ import { boxplotStats } from "../utils/statistics/boxplot.js";
2
+
3
+ export type Scalar = import("@genome-spy/core/spec/channel.js").Scalar;
4
+
5
+ export type BoxplotStatistics = NonNullable<
6
+ ReturnType<typeof boxplotStats>["statistics"]
7
+ >;
8
+
9
+ export type BoxplotStatsRow = BoxplotStatistics & Record<string, Scalar>;
10
+
11
+ export type BoxplotOutlierRow = Record<string, any>;
12
+
13
+ export type BoxplotFieldKey = "groupField" | "valueField" | "sampleField";
14
+
15
+ export type BoxplotFieldNames = Record<BoxplotFieldKey, string>;
@@ -0,0 +1,149 @@
1
+ import type { RootSpec } from "@genome-spy/core/spec/root.js";
2
+ import type { AttributeIdentifier } from "../sampleView/types.d.ts";
3
+ import type { AttributeInfo } from "../sampleView/types.js";
4
+ import type { SampleHierarchy } from "../sampleView/state/sampleState.js";
5
+ import type CompositeAttributeInfoSource from "../sampleView/compositeAttributeInfoSource.js";
6
+
7
+ export type SampleAttributePlotType = "barplot" | "boxplot" | "scatterplot";
8
+
9
+ export interface RenderablePlotNamedData {
10
+ name: string;
11
+ rows: Record<string, any>[];
12
+ }
13
+
14
+ export interface SampleAttributePlotSummary {
15
+ groupCount: number;
16
+ sampleCount: number;
17
+ plottedCount: number;
18
+ }
19
+
20
+ export interface CategoryCountsPlotCharacterization {
21
+ kind: "category_counts";
22
+ encoding: {
23
+ x: {
24
+ role: "current_sample_groups" | "plotted_attribute";
25
+ title: string;
26
+ };
27
+ y: {
28
+ role: "count";
29
+ title: "count";
30
+ };
31
+ color?: {
32
+ role: "plotted_attribute";
33
+ title: string;
34
+ };
35
+ };
36
+ nonMissingCount: number;
37
+ missingCount: number;
38
+ distinctCount: number;
39
+ categories: Array<{
40
+ value: unknown;
41
+ count: number;
42
+ share: number;
43
+ color?: string;
44
+ }>;
45
+ groups?: Array<{
46
+ title: string;
47
+ sampleCount: number;
48
+ nonMissingCount: number;
49
+ missingCount: number;
50
+ topCategory?: { value: unknown; count: number; share: number };
51
+ }>;
52
+ }
53
+
54
+ export interface AttributeDistributionPlotCharacterization {
55
+ kind: "quantitative_distribution";
56
+ groups: Array<{
57
+ title: string;
58
+ sampleCount: number;
59
+ nonMissingCount: number;
60
+ missingCount: number;
61
+ min?: number;
62
+ q1?: number;
63
+ median?: number;
64
+ q3?: number;
65
+ max?: number;
66
+ iqr?: number;
67
+ outlierCount: number;
68
+ }>;
69
+ highestMedianGroup?: string;
70
+ lowestMedianGroup?: string;
71
+ largestMedianDifference?: number;
72
+ }
73
+
74
+ export interface AttributeRelationshipPlotCharacterization {
75
+ kind: "quantitative_relationship";
76
+ axisMapping: Array<{
77
+ axis: "x" | "y";
78
+ attributeIndex: number;
79
+ title: string;
80
+ }>;
81
+ missingPairCount: number;
82
+ x: { min?: number; max?: number };
83
+ y: { min?: number; max?: number };
84
+ correlation?: {
85
+ method: "pearson";
86
+ r: number;
87
+ };
88
+ groups?: Array<{
89
+ title: string;
90
+ plottedPointCount: number;
91
+ color?: string;
92
+ }>;
93
+ }
94
+
95
+ export type SampleAttributePlotCharacterization =
96
+ | CategoryCountsPlotCharacterization
97
+ | AttributeDistributionPlotCharacterization
98
+ | AttributeRelationshipPlotCharacterization;
99
+
100
+ export interface SampleAttributePlot {
101
+ kind: "sample_attribute_plot";
102
+ plotType: SampleAttributePlotType;
103
+ title: string;
104
+ spec: RootSpec;
105
+ namedData: RenderablePlotNamedData[];
106
+ filename: string;
107
+ summary: SampleAttributePlotSummary;
108
+ characterization: SampleAttributePlotCharacterization;
109
+ }
110
+
111
+ export interface HierarchyBarplotRequest {
112
+ attributeInfo: AttributeInfo;
113
+ sampleHierarchy: SampleHierarchy;
114
+ attributeInfoSource: CompositeAttributeInfoSource;
115
+ }
116
+
117
+ export interface HierarchyBoxplotRequest {
118
+ attributeInfo: AttributeInfo;
119
+ sampleHierarchy: SampleHierarchy;
120
+ attributeInfoSource: CompositeAttributeInfoSource;
121
+ }
122
+
123
+ export interface HierarchyScatterplotRequest {
124
+ xAttributeInfo: AttributeInfo;
125
+ yAttributeInfo: AttributeInfo;
126
+ sampleHierarchy: SampleHierarchy;
127
+ attributeInfoSource: CompositeAttributeInfoSource;
128
+ colorScaleDomain?: string[];
129
+ colorScaleRange?: string[];
130
+ }
131
+
132
+ export type SampleAttributePlotRequest =
133
+ | {
134
+ plotType: "bar";
135
+ attribute: AttributeIdentifier;
136
+ attributeLabel?: string;
137
+ }
138
+ | {
139
+ plotType: "boxplot";
140
+ attribute: AttributeIdentifier;
141
+ attributeLabel?: string;
142
+ }
143
+ | {
144
+ plotType: "scatterplot";
145
+ xAttribute: AttributeIdentifier;
146
+ yAttribute: AttributeIdentifier;
147
+ xAttributeLabel?: string;
148
+ yAttributeLabel?: string;
149
+ };
@@ -0,0 +1,29 @@
1
+ import { SampleSpec } from "@genome-spy/app/spec/sampleView.js";
2
+
3
+ // App-specific compile-time augmentation for core spec types.
4
+ // This file exists only to make app code type-compatible with core classes
5
+ // that are typed against @genome-spy/core/spec/view.js.
6
+ //
7
+ // Important:
8
+ // - This is not runtime behavior; declaration files do not emit JS.
9
+ // - Core schema generation is isolated through CoreRootSpec, so these app-only
10
+ // extensions do not leak into @genome-spy/core/dist/schema.json.
11
+ declare module "@genome-spy/core/spec/view.js" {
12
+ // App-only property. Required so aggregateSamples is accepted in app code
13
+ // that still references core UnitSpec / LayerSpec types.
14
+ interface UnitSpec {
15
+ aggregateSamples?: (UnitSpec | LayerSpec)[];
16
+ }
17
+
18
+ // Same as above for layer specs.
19
+ interface LayerSpec {
20
+ aggregateSamples?: (UnitSpec | LayerSpec)[];
21
+ }
22
+
23
+ // Hook declared by core. App attaches SampleSpec here so core ViewSpec /
24
+ // ContainerSpec are widened when app is type-checked.
25
+ // eslint-disable-next-line no-unused-vars
26
+ interface ViewSpecExtensions {
27
+ sample: SampleSpec;
28
+ }
29
+ }
@@ -0,0 +1,5 @@
1
+ export {
2
+ default as BaseDialog,
3
+ showDialog,
4
+ } from "../components/generic/baseDialog.js";
5
+ export { showMessageDialog } from "../components/generic/messageDialog.js";
@@ -0,0 +1,9 @@
1
+ import { EmbedResult } from "@genome-spy/core/types/embedApi.js";
2
+
3
+ export type AppEmbedOptions = import("./appTypes.js").AppEmbedOptions;
4
+
5
+ export type AppEmbedFunction = (
6
+ el: HTMLElement | string,
7
+ spec: import("./spec/appSpec.js").AppRootSpec | string,
8
+ options?: AppEmbedOptions
9
+ ) => EmbedResult;
package/src/index.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ import type { AppEmbedFunction } from "./embedTypes.d.ts";
2
+
3
+ export { GenomeSpy, GenomeSpyApp, icon, html } from "./index.js";
4
+ export * from "./agentApi/index.js";
5
+ export * from "./agentShared/index.js";
6
+ export { BaseDialog, showDialog, showMessageDialog } from "./dialog/index.js";
7
+
8
+ export declare const embed: AppEmbedFunction;
9
+ export type * from "./appTypes.d.ts";
10
+ export type * from "./sampleView/types.d.ts";
11
+ export type * from "./sampleView/state/sampleState.d.ts";
12
+ export type * from "./sampleView/state/payloadTypes.d.ts";
13
+ export type {
14
+ SampleAttributeDef,
15
+ SampleAttributeType,
16
+ } from "./spec/sampleView.d.ts";