@jbrowse/core 5.0.0-beta.11 → 5.0.0-beta.13
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.
- package/README.md +97 -75
- package/esm/BaseFeatureWidget/BaseFeatureDetail/Attributes.d.ts +3 -0
- package/esm/BaseFeatureWidget/BaseFeatureDetail/Attributes.js +14 -1
- package/esm/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeatureDetails.d.ts +2 -0
- package/esm/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeatureDetails.js +5 -5
- package/esm/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeaturePanel.js +1 -1
- package/esm/BaseFeatureWidget/SequenceFeatureDetails/dialogs/FeatureSequenceDialog.d.ts +3 -1
- package/esm/BaseFeatureWidget/SequenceFeatureDetails/dialogs/FeatureSequenceDialog.js +2 -2
- package/esm/BaseFeatureWidget/SequenceFeatureDetails/featureTypeUtil.d.ts +2 -1
- package/esm/BaseFeatureWidget/SequenceFeatureDetails/featureTypeUtil.js +7 -14
- package/esm/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/CDNASequence.js +3 -3
- package/esm/BaseFeatureWidget/stateModelFactory.d.ts +7 -0
- package/esm/BaseFeatureWidget/stateModelFactory.js +11 -0
- package/esm/BaseFeatureWidget/types.d.ts +2 -0
- package/esm/PluginManager.d.ts +6 -3
- package/esm/PluginManager.js +6 -3
- package/esm/ReExports/coreModules.generated.js +291 -285
- package/esm/ReExports/coreWorkerModules.generated.js +288 -283
- package/esm/ReExports/list.js +7 -0
- package/esm/TextSearch/TextSearchManager.d.ts +3 -3
- package/esm/TextSearch/TextSearchManager.js +6 -13
- package/esm/configuration/configurationSchema.d.ts +33 -95
- package/esm/configuration/configurationSchema.js +50 -218
- package/esm/configuration/configurationSlot.d.ts +18 -64
- package/esm/configuration/configurationSlot.js +31 -97
- package/esm/configuration/formatDetailsConfigSchema.js +2 -0
- package/esm/configuration/getConf.d.ts +7 -36
- package/esm/configuration/getConf.js +7 -37
- package/esm/configuration/index.d.ts +3 -2
- package/esm/configuration/index.js +2 -1
- package/esm/configuration/partitionAdvanced.d.ts +12 -0
- package/esm/configuration/partitionAdvanced.js +42 -0
- package/esm/configuration/plot.d.ts +6 -0
- package/esm/configuration/plot.js +34 -1
- package/esm/configuration/readConfObject.d.ts +15 -17
- package/esm/configuration/readConfObject.js +19 -50
- package/esm/configuration/schemaTypes.js +5 -1
- package/esm/configuration/snapshotPreprocess.js +1 -3
- package/esm/configuration/types.d.ts +60 -159
- package/esm/pluggableElementTypes/DisplayType.d.ts +7 -0
- package/esm/pluggableElementTypes/DisplayType.js +7 -0
- package/esm/pluggableElementTypes/RpcMethodType.d.ts +7 -0
- package/esm/pluggableElementTypes/RpcMethodType.js +9 -0
- package/esm/pluggableElementTypes/addMenuItems.d.ts +2 -1
- package/esm/pluggableElementTypes/addMenuItems.js +2 -1
- package/esm/pluggableElementTypes/models/BaseDisplayModel.d.ts +3 -2
- package/esm/pluggableElementTypes/models/BaseDisplayModel.js +5 -5
- package/esm/pluggableElementTypes/models/BaseTrackModel.d.ts +2 -4
- package/esm/pluggableElementTypes/models/BaseTrackModel.js +2 -4
- package/esm/pluggableElementTypes/models/baseTrackConfig.js +3 -0
- package/esm/rpc/RpcRegistry.d.ts +2 -1
- package/esm/rpc/byteBudget.d.ts +7 -0
- package/esm/rpc/byteBudget.js +10 -0
- package/esm/rpc/coreRpcMethods.d.ts +1 -1
- package/esm/rpc/coreRpcMethods.js +1 -1
- package/esm/rpc/explainTransferError.js +3 -3
- package/esm/rpc/methods/CoreLoadTrackCode.d.ts +17 -0
- package/esm/rpc/methods/CoreLoadTrackCode.js +24 -0
- package/esm/ui/AppLogo.js +43 -3
- package/esm/ui/buildExtraTrackMenuItems.d.ts +2 -2
- package/esm/ui/colors.d.ts +41 -30
- package/esm/ui/colors.js +81 -44
- package/esm/ui/multiTrackMenuItems.d.ts +2 -2
- package/esm/util/alignedBytes.d.ts +19 -0
- package/esm/util/alignedBytes.js +37 -0
- package/esm/util/analytics.d.ts +5 -6
- package/esm/util/analytics.js +5 -3
- package/esm/util/bezierConnector.js +5 -1
- package/esm/util/categoricalField.d.ts +23 -3
- package/esm/util/categoricalField.js +36 -3
- package/esm/util/cellMatches.js +14 -14
- package/esm/util/cellsStep.d.ts +3 -5
- package/esm/util/cellsStep.js +31 -29
- package/esm/util/color-bits/parse.js +22 -11
- package/esm/util/colorRamp.js +6 -0
- package/esm/util/colorScale.d.ts +9 -2
- package/esm/util/colorScale.js +33 -2
- package/esm/util/colorSchemes.d.ts +4 -2
- package/esm/util/colorSchemes.js +4 -1
- package/esm/util/isoformRank.d.ts +39 -0
- package/esm/util/isoformRank.js +118 -0
- package/esm/util/markEncodingTypes.d.ts +3 -1
- package/esm/util/quantileExtent.d.ts +22 -0
- package/esm/util/quantileExtent.js +24 -1
- package/esm/util/systemColorScheme.d.ts +4 -0
- package/esm/util/systemColorScheme.js +21 -0
- package/esm/util/tabix.d.ts +1 -1
- package/esm/util/tabix.js +1 -1
- package/esm/util/temporaryAssembly.d.ts +2 -2
- package/esm/util/temporaryAssembly.js +2 -3
- package/esm/util/trackConfigDelta.d.ts +1 -1
- package/esm/util/tracks.d.ts +25 -15
- package/esm/util/tracks.js +67 -43
- package/esm/util/types/index.d.ts +15 -7
- package/esm/util/types/index.js +21 -2
- package/esm/util/useRowVirtualScroll.d.ts +1 -0
- package/package.json +7 -4
- package/esm/rpc/methods/CoreLoadAdapterCode.d.ts +0 -13
- package/esm/rpc/methods/CoreLoadAdapterCode.js +0 -16
package/esm/ReExports/list.js
CHANGED
|
@@ -248,6 +248,7 @@ export default [
|
|
|
248
248
|
'@jbrowse/core/ui/SnackbarModel',
|
|
249
249
|
'@jbrowse/core/ui/StackTraceButton',
|
|
250
250
|
'@jbrowse/core/ui/styleTheme',
|
|
251
|
+
'@jbrowse/core/ui/SubmitDialog',
|
|
251
252
|
'@jbrowse/core/ui/SvgColorLegend',
|
|
252
253
|
'@jbrowse/core/ui/theme',
|
|
253
254
|
'@jbrowse/core/ui/useCoalescedPointer',
|
|
@@ -259,6 +260,7 @@ export default [
|
|
|
259
260
|
'@jbrowse/core/util/adapterMetadata',
|
|
260
261
|
'@jbrowse/core/util/addRelativeUris',
|
|
261
262
|
'@jbrowse/core/util/aggregateFieldName',
|
|
263
|
+
'@jbrowse/core/util/alignedBytes',
|
|
262
264
|
'@jbrowse/core/util/analytics',
|
|
263
265
|
'@jbrowse/core/util/animationAllowed',
|
|
264
266
|
'@jbrowse/core/util/assemblyConfigUtils',
|
|
@@ -317,6 +319,7 @@ export default [
|
|
|
317
319
|
'@jbrowse/core/util/io',
|
|
318
320
|
'@jbrowse/core/util/io/RemoteFileWithRangeCache',
|
|
319
321
|
'@jbrowse/core/util/isDataCurrent',
|
|
322
|
+
'@jbrowse/core/util/isoformRank',
|
|
320
323
|
'@jbrowse/core/util/isTextEntryFocused',
|
|
321
324
|
'@jbrowse/core/util/jexl',
|
|
322
325
|
'@jbrowse/core/util/jexlFilters',
|
|
@@ -397,6 +400,7 @@ export default [
|
|
|
397
400
|
'@jbrowse/display-kit/coarseTier',
|
|
398
401
|
'@jbrowse/display-kit/CoarseTierMixin',
|
|
399
402
|
'@jbrowse/display-kit/coarseTierPhase',
|
|
403
|
+
'@jbrowse/display-kit/colorByMenu',
|
|
400
404
|
'@jbrowse/display-kit/colorConfigSchema',
|
|
401
405
|
'@jbrowse/display-kit/ConfigProblemsIndicator',
|
|
402
406
|
'@jbrowse/display-kit/configSchema',
|
|
@@ -434,6 +438,7 @@ export default [
|
|
|
434
438
|
'@jbrowse/display-kit/heightModeConfigSchemaFields',
|
|
435
439
|
'@jbrowse/display-kit/heightModeMenu',
|
|
436
440
|
'@jbrowse/display-kit/HeightModeMixin',
|
|
441
|
+
'@jbrowse/display-kit/heldColorSlots',
|
|
437
442
|
'@jbrowse/display-kit/HiddenGroupsMixin',
|
|
438
443
|
'@jbrowse/display-kit/highlightHost',
|
|
439
444
|
'@jbrowse/display-kit/installClearHoverOnViewportChange',
|
|
@@ -443,6 +448,7 @@ export default [
|
|
|
443
448
|
'@jbrowse/display-kit/KeyedFetchMixin',
|
|
444
449
|
'@jbrowse/display-kit/legendHost',
|
|
445
450
|
'@jbrowse/display-kit/LegendMixin',
|
|
451
|
+
'@jbrowse/display-kit/MarkSvgLayer',
|
|
446
452
|
'@jbrowse/display-kit/MultiRegionDisplayMixin',
|
|
447
453
|
'@jbrowse/display-kit/planRegionFetch',
|
|
448
454
|
'@jbrowse/display-kit/PlotDialog',
|
|
@@ -459,6 +465,7 @@ export default [
|
|
|
459
465
|
'@jbrowse/display-kit/rowsConfigSchema',
|
|
460
466
|
'@jbrowse/display-kit/rpcArgs',
|
|
461
467
|
'@jbrowse/display-kit/SkippedFeaturesIndicator',
|
|
468
|
+
'@jbrowse/display-kit/SolidColorDialog',
|
|
462
469
|
'@jbrowse/display-kit/stableIdentityComputed',
|
|
463
470
|
'@jbrowse/display-kit/StoredHoverMixin',
|
|
464
471
|
'@jbrowse/display-kit/subPixelBinBp',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import QuickLRU from '../util/QuickLRU/index.ts';
|
|
2
2
|
import type PluginManager from '../PluginManager.ts';
|
|
3
|
-
import type { AnyConfigurationModel } from '../configuration/index.ts';
|
|
3
|
+
import type { AnyConfigurationModel, AnyTrackConfig } from '../configuration/index.ts';
|
|
4
4
|
import type { BaseTextSearchAdapter, BaseTextSearchArgs } from '../data_adapters/BaseAdapter/index.ts';
|
|
5
5
|
import type BaseResult from './BaseResults.ts';
|
|
6
6
|
export interface SearchIndex {
|
|
@@ -30,9 +30,9 @@ export default class TextSearchManager {
|
|
|
30
30
|
relevantAdapters(assemblyName: string): AnyConfigurationModel[];
|
|
31
31
|
relevantIndexes(assemblyName: string): SearchIndex[];
|
|
32
32
|
getAdaptersWithAssembly(matches: (names: string[] | undefined) => boolean, confs: AnyConfigurationModel[]): AnyConfigurationModel[];
|
|
33
|
-
getTrackAdaptersWithAssembly(matches: (names: string[] | undefined) => boolean, confs:
|
|
33
|
+
getTrackAdaptersWithAssembly(matches: (names: string[] | undefined) => boolean, confs: AnyTrackConfig[]): {
|
|
34
34
|
conf: AnyConfigurationModel;
|
|
35
|
-
trackId:
|
|
35
|
+
trackId: any;
|
|
36
36
|
}[];
|
|
37
37
|
search(args: BaseTextSearchArgs, assemblyName: string): Promise<BaseResult[]>;
|
|
38
38
|
searchIndexes(args: BaseTextSearchArgs, assemblyName: string): Promise<TextSearchReport>;
|
|
@@ -3,7 +3,7 @@ import { hydrateTrackConfig, readConfObject } from '../configuration/index.js';
|
|
|
3
3
|
import { adapterConfigCacheKey } from '../data_adapters/dataAdapterCache.js';
|
|
4
4
|
import QuickLRU from '../util/QuickLRU/index.js';
|
|
5
5
|
import { checkAbortSignal, isAbortException } from '../util/aborting.js';
|
|
6
|
-
import { allSessionTracks, canonicalAssemblyNames } from '../util/tracks.js';
|
|
6
|
+
import { allSessionTracks, canonicalAssemblyNames, getConfAssemblyNamesOrNone, } from '../util/tracks.js';
|
|
7
7
|
// A misconfigured or unreachable index (a 404 .ix, a config missing
|
|
8
8
|
// ixFilePath) must not take down search as a whole: the remaining indexes, and
|
|
9
9
|
// the refName results the caller merges in afterwards, are still useful. The
|
|
@@ -84,24 +84,17 @@ export default class TextSearchManager {
|
|
|
84
84
|
getTrackAdaptersWithAssembly(matches, confs) {
|
|
85
85
|
return confs
|
|
86
86
|
.filter(conf => {
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
]);
|
|
92
|
-
return (!!readConfObject(conf, ['textSearching', 'textSearchAdapter']) &&
|
|
93
|
-
matches(indexNames?.length
|
|
94
|
-
? indexNames
|
|
95
|
-
: readConfObject(conf, 'assemblyNames')));
|
|
87
|
+
const adapter = conf.textSearching?.textSearchAdapter;
|
|
88
|
+
const indexNames = adapter?.assemblyNames;
|
|
89
|
+
return (!!adapter &&
|
|
90
|
+
matches(indexNames?.length ? indexNames : getConfAssemblyNamesOrNone(conf)));
|
|
96
91
|
})
|
|
97
92
|
.flatMap(track => {
|
|
98
93
|
const live = isStateTreeNode(track)
|
|
99
94
|
? track
|
|
100
95
|
: hydrateTrackConfig(this.pluginManager, track);
|
|
101
96
|
const conf = live?.textSearching.textSearchAdapter;
|
|
102
|
-
return conf
|
|
103
|
-
? [{ conf, trackId: readConfObject(track, 'trackId') }]
|
|
104
|
-
: [];
|
|
97
|
+
return conf ? [{ conf, trackId: track.trackId }] : [];
|
|
105
98
|
});
|
|
106
99
|
}
|
|
107
100
|
async search(args, assemblyName) {
|
|
@@ -6,17 +6,8 @@ import type { AnyConfigurationModel, AnyConfigurationSchemaType, ConfigNodeActio
|
|
|
6
6
|
import type { IAnyType, ISimpleType, IType, ReferenceIdentifier, SnapshotIn, SnapshotOut } from '@jbrowse/mobx-state-tree';
|
|
7
7
|
export type { AnyConfigurationModel, AnyConfigurationSchemaType, } from './types.ts';
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* is the **MST type** `ConfigurationSchema()` returned, hence `IAnyType`.
|
|
12
|
-
*
|
|
13
|
-
* A raw nested `ConfigurationSchemaDefinition` used to be a fourth member here,
|
|
14
|
-
* and it was both dead and load-bearing in the wrong direction: nothing
|
|
15
|
-
* constructs a sub-schema from one (the loop has no branch for it, so it throws
|
|
16
|
-
* "no type set for config slot"), while a plain object of strings and numbers is
|
|
17
|
-
* exactly what a *slot definition* is — so every slot in the repo matched that
|
|
18
|
-
* member instead and was never checked against `ConfigSlotDefinition` at all.
|
|
19
|
-
* `type: 'enum'`, a name this system has never had, compiled for years that way.
|
|
9
|
+
* Each entry is a slot definition, a constant (bare string/number), or a
|
|
10
|
+
* sub-schema: the MST type `ConfigurationSchema()` returned.
|
|
20
11
|
*/
|
|
21
12
|
export interface ConfigurationSchemaDefinition {
|
|
22
13
|
[n: string]: ConfigSlotDefinition | string | number | IAnyType;
|
|
@@ -73,23 +64,13 @@ export interface ConfigurationSchemaOptions<BASE_SCHEMA extends AnyConfiguration
|
|
|
73
64
|
}
|
|
74
65
|
type SchemaHook = (self: any) => any;
|
|
75
66
|
/**
|
|
76
|
-
* Options as
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
* puts the base's members on `self` by the time the subclass's function runs,
|
|
84
|
-
* and what lets the subclass override one by redeclaring its name. Folding to
|
|
85
|
-
* `self => ({...base(self), ...child(self)})` would give neither, and would
|
|
86
|
-
* corrupt `extend` outright (it returns `{actions, views, state}`, so a spread
|
|
87
|
-
* merge drops whichever side declared fewer of the three).
|
|
88
|
-
*
|
|
89
|
-
* `preProcessSnapshot` is the exception and composes into a single function,
|
|
90
|
-
* `child(base(snapshot))`: the base normalizes and migrates first, the subclass
|
|
91
|
-
* refines. It has to stay one function because `preProcessSnapshotWith` runs it
|
|
92
|
-
* straight off the registry, over a partial settings bag as well as a snapshot.
|
|
67
|
+
* Options as stored, with a `baseConfiguration`'s hooks merged in. `actions`,
|
|
68
|
+
* `views` and `extend` stay a chain that MST applies one call per entry, which
|
|
69
|
+
* puts the base's members on `self` before the subclass's function runs and
|
|
70
|
+
* lets the subclass override one by name; a spread merge would give neither,
|
|
71
|
+
* and would drop half of `extend`'s `{actions, views, state}`.
|
|
72
|
+
* `preProcessSnapshot` composes into one function, `child(base(snapshot))`,
|
|
73
|
+
* since `preProcessSnapshotWith` runs it off the registry.
|
|
93
74
|
*/
|
|
94
75
|
export interface MergedConfigurationSchemaOptions<BASE_SCHEMA extends AnyConfigurationSchemaType | undefined, EXPLICIT_IDENTIFIER extends string | undefined> extends Omit<ConfigurationSchemaOptions<BASE_SCHEMA, EXPLICIT_IDENTIFIER>, 'actions' | 'views' | 'extend'> {
|
|
95
76
|
actions?: SchemaHook | SchemaHook[];
|
|
@@ -98,21 +79,16 @@ export interface MergedConfigurationSchemaOptions<BASE_SCHEMA extends AnyConfigu
|
|
|
98
79
|
}
|
|
99
80
|
declare function makeConfigurationSchemaModel<DEFINITION extends ConfigurationSchemaDefinition, OPTIONS extends MergedConfigurationSchemaOptions<any, any>>(modelName: string, schemaDefinition: DEFINITION, options: OPTIONS): import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IModelType<Record<string, any>, ConfigNodeActions, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>, [undefined]>;
|
|
100
81
|
/**
|
|
101
|
-
* DEFINITION is unconstrained
|
|
102
|
-
* `
|
|
103
|
-
*
|
|
104
|
-
* satisfy one would put an index signature straight back into
|
|
105
|
-
* `keyof DEFINITION`. The authoring check lives on `ConfigurationSchema`'s own
|
|
106
|
-
* parameter, where the literal arrives, and on the `extends` clause below.
|
|
82
|
+
* DEFINITION is unconstrained: a constraint would put an index signature back
|
|
83
|
+
* into `keyof DEFINITION`. `ConfigurationSchema`'s own parameter checks the
|
|
84
|
+
* literal where it arrives. ADR-145.
|
|
107
85
|
*/
|
|
108
86
|
export interface ConfigurationSchemaType<out DEFINITION, OPTIONS extends ConfigurationSchemaOptions<any, any>> extends ReturnType<typeof makeConfigurationSchemaModel<DEFINITION & ConfigurationSchemaDefinition, OPTIONS>> {
|
|
109
87
|
/**
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
* out. `TypeWithoutSTN` too, since a wrapper — `types.optional`,
|
|
115
|
-
* `types.stripDefault` — builds its instance from that one.
|
|
88
|
+
* Replaces the factory's `Record<string, any>` props with the definition's,
|
|
89
|
+
* and brands the node with this schema for `ConfigurationSchemaForModel`.
|
|
90
|
+
* `TypeWithoutSTN` is what a `types.optional` or `stripDefault` wrapper builds
|
|
91
|
+
* its instance from.
|
|
116
92
|
*/
|
|
117
93
|
readonly Type: ConfigNodeProps<DEFINITION> & ConfigNodeActions & ConfigNodeBrand<this>;
|
|
118
94
|
readonly TypeWithoutSTN: ConfigNodeProps<DEFINITION> & ConfigNodeActions;
|
|
@@ -133,70 +109,32 @@ export declare function ConfigurationSchema<const DEFINITION extends Configurati
|
|
|
133
109
|
} : unknown), BASE_SCHEMA>, ConfigurationSchemaOptions<BASE_SCHEMA, EXPLICIT_IDENTIFIER, EXPLICITLY_TYPED>>;
|
|
134
110
|
/**
|
|
135
111
|
* #api core/configuration
|
|
136
|
-
* Hydrate a plain track config
|
|
137
|
-
* `type` to find the schema.
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
* `preProcessSnapshot` has not run, and nothing that walks a live node applies
|
|
141
|
-
* to it.
|
|
142
|
-
*
|
|
143
|
-
* Use it where a caller needs the resolved config and may be handed either
|
|
144
|
-
* form. The About dialog's "Copy config" is reached from two menus, and one of
|
|
145
|
-
* them passes a `session.tracks` entry.
|
|
112
|
+
* Hydrate a plain track config, such as a `session.tracks` entry, into a live
|
|
113
|
+
* config node, dispatching on its `type` to find the schema. A plain entry
|
|
114
|
+
* holds only what was authored: a slot at its default is absent and
|
|
115
|
+
* `preProcessSnapshot` has not run.
|
|
146
116
|
*
|
|
147
|
-
* Returns **undefined** when
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
* Shares `TrackConfigurationReference`'s per-PluginManager cache, so hydrating
|
|
153
|
-
* the same entry twice returns the same node, and in an admin session a track
|
|
154
|
-
* opened later resolves to that same node. A non-admin's open track
|
|
155
|
-
* resolves to the session's private working copy (ADR-032), and this function
|
|
156
|
-
* returns the pristine mirror beside it. The two have the same content;
|
|
157
|
-
* `CopyConfigEntryPoints.test.ts` tests both cases.
|
|
117
|
+
* Returns **undefined** when no plugin registered the type or `create` rejects
|
|
118
|
+
* the config, which has never been validated; callers fall back to the plain
|
|
119
|
+
* object. Hydrating one entry twice returns one node. A shown track resolves to
|
|
120
|
+
* the session's working copy instead (ADR-032), which has the same content.
|
|
158
121
|
*/
|
|
159
122
|
export declare function hydrateTrackConfig(pluginManager: PluginManager, config: Record<string, unknown>): AnyConfigurationModel | undefined;
|
|
160
123
|
type ConfigReferenceInstance<SCHEMA extends AnyConfigurationSchemaType> = SCHEMA extends ConfigurationSchemaType<infer D, any> ? IsAny<D> extends true ? any : SCHEMA['Type'] : SCHEMA['Type'];
|
|
161
124
|
/**
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
* `
|
|
166
|
-
*
|
|
167
|
-
* its precise slot value types instead of `any`. The snapshot types stay
|
|
168
|
-
* `id-string | schema-snapshot`, matching the runtime union (`idOrSnapshotUnion`):
|
|
169
|
-
* a saved config serializes to its id string, and both an id string and a full
|
|
170
|
-
* inline snapshot are accepted as input — so views that push string ids or
|
|
171
|
-
* synthesized configs (`CircularView`, `SvInspectorView`) keep type-checking.
|
|
172
|
-
*
|
|
173
|
-
* Built by `Omit`-ing `Type` off `IType` and re-adding it, rather than reusing
|
|
174
|
-
* the runtime `ITypeUnion`: `IType`'s own `Type` is `STNValue<T, this>`, which
|
|
175
|
-
* re-brands `T` with `IStateTreeNode<this>`. Layering that over an already-branded
|
|
176
|
-
* `SCHEMA['Type']` (which carries `IStateTreeNode<SCHEMA>`) double-brands the
|
|
177
|
-
* node, and the two competing `IStateTreeNode<…>` brands defeat the single
|
|
178
|
-
* `infer SCHEMA` in `ConfigurationSchemaForModel` (leaving it `any`). Re-adding a
|
|
179
|
-
* plain `Type` keeps the single brand. See the "Config read type narrowing"
|
|
180
|
-
* section of `packages/core/src/configuration/CLAUDE.md`.
|
|
125
|
+
* The type of a track or display model's `configuration` prop: snapshots are
|
|
126
|
+
* `id | config`, as the runtime union takes, and the instance carries the
|
|
127
|
+
* concrete schema so `getConf(self, slot)` narrows. `Type` is re-added rather
|
|
128
|
+
* than taken from `IType`, whose `STNValue` would brand the node a second time
|
|
129
|
+
* and leave `ConfigurationSchemaForModel` inferring `any`.
|
|
181
130
|
*/
|
|
182
131
|
export type IConfigurationReference<SCHEMA extends AnyConfigurationSchemaType> = Omit<IType<ReferenceIdentifier | SnapshotIn<SCHEMA>, ReferenceIdentifier | SnapshotOut<SCHEMA>, ConfigReferenceInstance<SCHEMA>>, 'Type'> & {
|
|
183
132
|
readonly Type: ConfigReferenceInstance<SCHEMA>;
|
|
184
133
|
};
|
|
185
134
|
/**
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
* Display schemas must declare `explicitIdentifier: 'displayId'` (directly or
|
|
191
|
-
* via `baseConfiguration: baseLinearDisplayConfigSchema`, which merges its
|
|
192
|
-
* options through `preprocessConfigurationSchemaArguments`).
|
|
193
|
-
*
|
|
194
|
-
* The return is annotated `IConfigurationReference<SCHEMATYPE>` (see its doc)
|
|
195
|
-
* so `self.configuration` carries the concrete schema. The three runtime
|
|
196
|
-
* branches produce MST reference/union types over `schemaType` that are
|
|
197
|
-
* assignable to that annotation, so `return ref` needs no cast — and must not
|
|
198
|
-
* get one: a prior `as SCHEMATYPE` was dropped because it narrowed `SnapshotIn`
|
|
199
|
-
* to just the object branch and forced callers pushing string ids to
|
|
200
|
-
* `@ts-expect-error` (see `TrackConfigurationReference`'s note).
|
|
135
|
+
* A reference resolved by the schema's identifier: a `trackId` through the
|
|
136
|
+
* session, a `displayId` through the containing track's `displays`, anything
|
|
137
|
+
* else by MST's own identifier lookup. No `as SCHEMATYPE` on the return: it
|
|
138
|
+
* would narrow `SnapshotIn` to the object branch and refuse a string id.
|
|
201
139
|
*/
|
|
202
140
|
export declare function ConfigurationReference<SCHEMATYPE extends AnyConfigurationSchemaType>(schemaType: SCHEMATYPE): IConfigurationReference<SCHEMATYPE>;
|