From df0669598cbed1b0f0e84e17d28dc5e7fbb0ce04 Mon Sep 17 00:00:00 2001 From: Alexander Rose Date: Sat, 9 May 2026 12:31:11 -0700 Subject: [PATCH 1/5] Add presets option to `ObjectList` param definition --- CHANGELOG.md | 1 + src/mol-plugin-ui/controls/parameters.tsx | 23 ++++++++++++++++++++--- src/mol-util/param-definition.ts | 9 ++++++--- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7dd345ac9..01cf641a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Note that since we don't clearly distinguish between a public and private interf ## [Unreleased] - Fix empty transforms default in `ShapeFromPly` +- Add presets option to `ObjectList` param definition ## [v5.9.0] - 2026-05-03 - Fix edge case when `PluginSpec.animations` is empty diff --git a/src/mol-plugin-ui/controls/parameters.tsx b/src/mol-plugin-ui/controls/parameters.tsx index 4904dc26e..3c87252a7 100644 --- a/src/mol-plugin-ui/controls/parameters.tsx +++ b/src/mol-plugin-ui/controls/parameters.tsx @@ -1414,8 +1414,8 @@ class ObjectListItem extends React.PureComponent, { isExpanded: boolean }> { - state = { isExpanded: false }; +export class ObjectListControl extends React.PureComponent, { isExpanded: boolean, showPresets: boolean }> { + state = { isExpanded: false, showPresets: false }; change(value: any) { this.props.onChange({ name: this.props.name, param: this.props.param, value }); @@ -1459,12 +1459,29 @@ export class ObjectListControl extends React.PureComponent this.setState({ showPresets: !this.state.showPresets }); + + presetItems = memoizeLatest((param: PD.ObjectList) => ActionMenu.createItemsFromSelectOptions(param.presets ?? [])); + + onSelectPreset: ActionMenu.OnSelect = item => { + this.setState({ showPresets: false }); + this.change(item?.value); + }; + render() { const v = this.props.value; const label = this.props.param.label || camelCaseToWords(this.props.name); const value = `${v.length} item${v.length !== 1 ? 's' : ''}`; + const hasPresets = !!this.props.param.presets; + const control = hasPresets + ?
+ + +
+ : ; return <> - {value}} /> + + {hasPresets && this.state.showPresets && } {this.state.isExpanded &&
{this.props.value.map((v, i) => )} diff --git a/src/mol-util/param-definition.ts b/src/mol-util/param-definition.ts index fa99b0585..63c939d95 100644 --- a/src/mol-util/param-definition.ts +++ b/src/mol-util/param-definition.ts @@ -295,10 +295,13 @@ export namespace ParamDefinition { type: 'object-list', element: Params, ctor(): T, - getLabel(t: T): string + getLabel(t: T): string, + presets?: Select['options'] } - export function ObjectList(element: For, getLabel: (e: T) => string, info?: Info & { defaultValue?: T[], ctor?: () => T }): ObjectList> { - return setInfo>>({ type: 'object-list', element: element as any as Params, getLabel, ctor: _defaultObjectListCtor, defaultValue: (info?.defaultValue) || [] }, info); + export function ObjectList(element: For, getLabel: (e: T) => string, info?: Info & { defaultValue?: T[], ctor?: () => T, presets?: Select['options'] }): ObjectList> { + const ret = setInfo>>({ type: 'object-list', element: element as any as Params, getLabel, ctor: _defaultObjectListCtor, defaultValue: (info?.defaultValue) || [] }, info); + if (info?.presets) ret.presets = info.presets as any; + return ret; } function _defaultObjectListCtor(this: ObjectList) { return getDefaultValues(this.element) as any; } From 57a790544c0abfc65d95b9addbe16f25db0c9ad2 Mon Sep 17 00:00:00 2001 From: Alexander Rose Date: Sat, 9 May 2026 12:31:26 -0700 Subject: [PATCH 2/5] Add mesoscale representation preset --- CHANGELOG.md | 1 + src/apps/mesoscale-explorer/data/state.ts | 34 +---------- src/mol-geo/geometry/spheres/spheres.ts | 30 +++++++++- .../structure/representation-preset.ts | 59 ++++++++++++++++++- 4 files changed, 89 insertions(+), 35 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 01cf641a4..7adbced7d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Note that since we don't clearly distinguish between a public and private interf ## [Unreleased] - Fix empty transforms default in `ShapeFromPly` +- Add mesoscale representation preset - Add presets option to `ObjectList` param definition ## [v5.9.0] - 2026-05-03 diff --git a/src/apps/mesoscale-explorer/data/state.ts b/src/apps/mesoscale-explorer/data/state.ts index 40121e4ae..db31d26cd 100644 --- a/src/apps/mesoscale-explorer/data/state.ts +++ b/src/apps/mesoscale-explorer/data/state.ts @@ -22,7 +22,6 @@ import { Hcl } from '../../../mol-util/color/spaces/hcl'; import { StateObjectCell, StateObjectRef, StateSelection } from '../../../mol-state'; import { ShapeRepresentation3D, StructureRepresentation3D } from '../../../mol-plugin-state/transforms/representation'; import { SpacefillRepresentationProvider } from '../../../mol-repr/structure/representation/spacefill'; -import { assertUnreachable } from '../../../mol-util/type-helpers'; import { MesoscaleExplorerState } from '../app'; import { saturate } from '../../../mol-math/interpolate'; import { Material } from '../../../mol-util/material'; @@ -322,38 +321,7 @@ export function getMesoscaleGroupParams(graphicsMode: GraphicsMode): MesoscaleGr export type LodLevels = typeof SpacefillRepresentationProvider.defaultValues['lodLevels'] export function getLodLevels(graphicsMode: Exclude): LodLevels { - switch (graphicsMode) { - case 'performance': - return [ - { minDistance: 1, maxDistance: 300, overlap: 0, stride: 1, scaleBias: 1 }, - { minDistance: 300, maxDistance: 2000, overlap: 0, stride: 40, scaleBias: 3 }, - { minDistance: 2000, maxDistance: 6000, overlap: 0, stride: 150, scaleBias: 3 }, - { minDistance: 6000, maxDistance: 10000000, overlap: 0, stride: 300, scaleBias: 2.5 }, - ]; - case 'balanced': - return [ - { minDistance: 1, maxDistance: 500, overlap: 0, stride: 1, scaleBias: 1 }, - { minDistance: 500, maxDistance: 2000, overlap: 0, stride: 15, scaleBias: 3 }, - { minDistance: 2000, maxDistance: 6000, overlap: 0, stride: 70, scaleBias: 2.7 }, - { minDistance: 6000, maxDistance: 10000000, overlap: 0, stride: 200, scaleBias: 2.5 }, - ]; - case 'quality': - return [ - { minDistance: 1, maxDistance: 1000, overlap: 0, stride: 1, scaleBias: 1 }, - { minDistance: 1000, maxDistance: 4000, overlap: 0, stride: 10, scaleBias: 3 }, - { minDistance: 4000, maxDistance: 10000, overlap: 0, stride: 50, scaleBias: 2.7 }, - { minDistance: 10000, maxDistance: 10000000, overlap: 0, stride: 200, scaleBias: 2.3 }, - ]; - case 'ultra': - return [ - { minDistance: 1, maxDistance: 5000, overlap: 0, stride: 1, scaleBias: 1 }, - { minDistance: 5000, maxDistance: 10000, overlap: 0, stride: 10, scaleBias: 3 }, - { minDistance: 10000, maxDistance: 30000, overlap: 0, stride: 50, scaleBias: 2.5 }, - { minDistance: 30000, maxDistance: 10000000, overlap: 0, stride: 200, scaleBias: 2 }, - ]; - default: - assertUnreachable(graphicsMode); - } + return Spheres.LodLevelsPresets[graphicsMode]; } export type GraphicsMode = 'ultra' | 'quality' | 'balanced' | 'performance' | 'custom'; diff --git a/src/mol-geo/geometry/spheres/spheres.ts b/src/mol-geo/geometry/spheres/spheres.ts index 3d99f4b9a..c948c8701 100644 --- a/src/mol-geo/geometry/spheres/spheres.ts +++ b/src/mol-geo/geometry/spheres/spheres.ts @@ -249,6 +249,33 @@ export namespace Spheres { return lodLevels.map(l => getAdjustedStride(l, sizeFactor)).reverse(); } + export const LodLevelsPresets: { [key in 'performance' | 'balanced' | 'quality' | 'ultra']: LodLevels } = { + performance: [ + { minDistance: 1, maxDistance: 300, overlap: 0, stride: 1, scaleBias: 1 }, + { minDistance: 300, maxDistance: 2000, overlap: 0, stride: 40, scaleBias: 3 }, + { minDistance: 2000, maxDistance: 6000, overlap: 0, stride: 150, scaleBias: 3 }, + { minDistance: 6000, maxDistance: 10000000, overlap: 0, stride: 300, scaleBias: 2.5 }, + ], + balanced: [ + { minDistance: 1, maxDistance: 500, overlap: 0, stride: 1, scaleBias: 1 }, + { minDistance: 500, maxDistance: 2000, overlap: 0, stride: 15, scaleBias: 3 }, + { minDistance: 2000, maxDistance: 6000, overlap: 0, stride: 70, scaleBias: 2.7 }, + { minDistance: 6000, maxDistance: 10000000, overlap: 0, stride: 200, scaleBias: 2.5 }, + ], + quality: [ + { minDistance: 1, maxDistance: 1000, overlap: 0, stride: 1, scaleBias: 1 }, + { minDistance: 1000, maxDistance: 4000, overlap: 0, stride: 10, scaleBias: 3 }, + { minDistance: 4000, maxDistance: 10000, overlap: 0, stride: 50, scaleBias: 2.7 }, + { minDistance: 10000, maxDistance: 10000000, overlap: 0, stride: 200, scaleBias: 2.3 }, + ], + ultra: [ + { minDistance: 1, maxDistance: 5000, overlap: 0, stride: 1, scaleBias: 1 }, + { minDistance: 5000, maxDistance: 10000, overlap: 0, stride: 10, scaleBias: 3 }, + { minDistance: 10000, maxDistance: 30000, overlap: 0, stride: 50, scaleBias: 2.5 }, + { minDistance: 30000, maxDistance: 10000000, overlap: 0, stride: 200, scaleBias: 2 }, + ], + }; + export const Params = { ...BaseGeometry.Params, sizeFactor: PD.Numeric(1, { min: 0, max: 10, step: 0.1 }), @@ -273,7 +300,8 @@ export namespace Spheres { scaleBias: PD.Numeric(3, { min: 0.1, max: 10, step: 0.1 }), }, o => `${o.stride}`, { ...BaseGeometry.CullingLodCategory, - defaultValue: [] as LodLevels + defaultValue: [] as LodLevels, + presets: Object.entries(LodLevelsPresets).map(([k, v]) => [v, k]) }) }; export type Params = typeof Params diff --git a/src/mol-plugin-state/builder/structure/representation-preset.ts b/src/mol-plugin-state/builder/structure/representation-preset.ts index 3173c963a..8ebcd8f55 100644 --- a/src/mol-plugin-state/builder/structure/representation-preset.ts +++ b/src/mol-plugin-state/builder/structure/representation-preset.ts @@ -1,5 +1,5 @@ /** - * Copyright (c) 2019-2025 mol* contributors, licensed under MIT, See LICENSE file for more info. + * Copyright (c) 2019-2026 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author David Sehnal * @author Alexander Rose @@ -26,6 +26,7 @@ import { StructConn } from '../../../mol-model-formats/structure/property/bonds/ import { StructureRepresentationRegistry } from '../../../mol-repr/structure/registry'; import { assertUnreachable } from '../../../mol-util/type-helpers'; import { Vec3 } from '../../../mol-math/linear-algebra/3d/vec3'; +import { Spheres } from '../../../mol-geo/geometry/spheres/spheres'; export interface StructureRepresentationPresetProvider

extends PresetProvider { } export function StructureRepresentationPresetProvider(repr: StructureRepresentationPresetProvider) { return repr; } @@ -495,6 +496,61 @@ const autoLod = StructureRepresentationPresetProvider({ } }); +type MesoscaleGraphicsMode = keyof typeof Spheres.LodLevelsPresets +const MesoscaleGraphicsOptions = PD.arrayToOptions(Object.keys(Spheres.LodLevelsPresets) as MesoscaleGraphicsMode[]); +function getMesoscaleLodLevels(mode: MesoscaleGraphicsMode) { + return Spheres.LodLevelsPresets[mode]; +} + +const mesoscale = StructureRepresentationPresetProvider({ + id: 'preset-structure-representation-mesoscale', + display: { + name: 'Mesoscale', group: 'Miscellaneous', + description: 'Show everything in spacefill representation with instance-granularity and level-of-detail tuned for large particle scenes.' + }, + params: () => ({ + ...CommonParams, + graphics: PD.Select('quality', MesoscaleGraphicsOptions), + }), + async apply(ref, params, plugin) { + const structureCell = StateObjectRef.resolveAndCheck(plugin.state.data, ref); + if (!structureCell) return {}; + + const components = { + all: await presetStaticComponent(plugin, structureCell, 'all'), + }; + + const structure = structureCell.obj!.data; + + const { update, builder, typeParams, color } = reprBuilder(plugin, params, structure); + + const graphics: MesoscaleGraphicsMode = params.graphics ?? 'quality'; + const lodLevels = getMesoscaleLodLevels(graphics); + const approximate = graphics !== 'quality' && graphics !== 'ultra'; + const alphaThickness = graphics === 'performance' ? 15 : 12; + + const representations = { + all: builder.buildRepresentation(update, components.all, { + type: 'spacefill', + typeParams: { + ...typeParams, + instanceGranularity: true, + lodLevels, + approximate, + alphaThickness, + clipPrimitive: true, + }, + color: color || 'entity-id', + }, { tag: 'all' }), + }; + + await update.commit({ revertOnError: true }); + await updateFocusRepr(plugin, structure, params.theme?.focus?.name ?? color, params.theme?.focus?.params); + + return { components, representations }; + } +}); + export function presetStaticComponent(plugin: PluginContext, structure: StateObjectRef, type: StaticStructureComponentType, params?: { label?: string, tags?: string[] }) { return plugin.builders.structure.tryCreateComponentStatic(structure, type, params); } @@ -514,5 +570,6 @@ export const PresetStructureRepresentations = { illustrative, 'molecular-surface': molecularSurface, 'auto-lod': autoLod, + mesoscale, }; export type PresetStructureRepresentations = typeof PresetStructureRepresentations; \ No newline at end of file From 59e16e018726857a1ec4caf6b3033ba7a0a0b612 Mon Sep 17 00:00:00 2001 From: Armando Pellegrini <84039859+armyalpaca@users.noreply.github.com> Date: Sat, 9 May 2026 21:17:38 +0100 Subject: [PATCH 3/5] Fix `State.dispose()` not invoking transformer dispose for live cells (#1826) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `Transformer.Definition.dispose` is documented as "automatically called on deleting an object," but `State.dispose()` only disposed its own event subjects and action manager — it never iterated still-live cells to call their per-transformer dispose. Cells holding GL buffers, mesh data, etc. only had their dispose fired on explicit deletion (e.g. `clear()`), so any consumer that called `plugin.dispose()` without first awaiting `plugin.clear()` retained the callback chain, the GL buffers it points at, and any closures captured by it. In a long-running single-page app where the user navigates between routes that mount/unmount a Mol* viewer, this leaked roughly 25–50 MB of process RSS per cycle even with `plugin.dispose()` correctly called. A 20-cycle E2E mount/unmount harness on a 1AKE structure measured a +541 MB RSS / +266 MB JS-heap delta in the unconditional-`dispose()` case; calling `await plugin.clear()` before `plugin.dispose()` halved the residual leak, confirming the per-cell dispose path was missing on the unconditional `dispose()` route. This change walks the cell tree once (post-order via the existing `StateTree.doPostOrder` helper) and invokes the per-transformer dispose for every still-live cell, swallowing+warning on errors so a single faulty transformer can't prevent siblings from cleaning up. The existing per-cell `dispose` helper is reused for consistency with `updateNode`/`findDeletes` semantics. Tests cover: chained transformers, sibling subtrees, throwing-dispose isolation, and transformers without a dispose definition. Also adds `useDefineForClassFields: false` to the jest esbuild transform so tests can construct `State` (the `TransientTree` parameter property + class field pattern relies on legacy class-field semantics, which `tsc` honors via `target: es2018` but esbuild's default `esnext` target does not). Fixes #1825 Co-authored-by: Armando Pellegrini --- CHANGELOG.md | 1 + package.json | 2 +- src/mol-state/_spec/state.spec.ts | 126 ++++++++++++++++++++++++++++++ src/mol-state/state.ts | 17 ++++ 4 files changed, 145 insertions(+), 1 deletion(-) create mode 100644 src/mol-state/_spec/state.spec.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 7dd345ac9..08b738c03 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Note that since we don't clearly distinguish between a public and private interf ## [Unreleased] - Fix empty transforms default in `ShapeFromPly` +- Fix memory leak in `State.dispose()` not invoking transformer `dispose` callbacks for live cells ## [v5.9.0] - 2026-05-03 - Fix edge case when `PluginSpec.animations` is empty diff --git a/package.json b/package.json index 19c42d62a..39b3071e5 100644 --- a/package.json +++ b/package.json @@ -74,7 +74,7 @@ "js" ], "transform": { - "\\.ts$": "esbuild-jest-transform" + "\\.ts$": ["esbuild-jest-transform", { "tsconfigRaw": "{\"compilerOptions\":{\"useDefineForClassFields\":false}}" }] }, "moduleDirectories": [ "node_modules", diff --git a/src/mol-state/_spec/state.spec.ts b/src/mol-state/_spec/state.spec.ts new file mode 100644 index 000000000..d9a151fa0 --- /dev/null +++ b/src/mol-state/_spec/state.spec.ts @@ -0,0 +1,126 @@ +/** + * Copyright (c) 2026 mol* contributors, licensed under MIT, See LICENSE file for more info. + */ + +import { State, StateObject, StateTransformer } from '../../mol-state'; +import { Task } from '../../mol-task'; + +interface TypeInfo { name: string; typeClass: 'Root' | 'Data' } +const Create = StateObject.factory(); + +class Root extends Create({ name: 'Root', typeClass: 'Root' }) { } +class Leaf extends Create<{ value: number }>({ name: 'Leaf', typeClass: 'Data' }) { } + +const NS = 'state-dispose-spec'; +let counter = 0; + +function leafTransformer(spy: () => void) { + return StateTransformer.create(NS, { + name: `create-leaf-${counter++}`, + from: [Root], + to: [Leaf], + display: { name: 'Create Leaf' }, + params: () => ({} as any), + apply({ params }) { return new Leaf({ value: params.value }); }, + dispose() { spy(); } + }); +} + +function chainedTransformer(spy: () => void) { + return StateTransformer.create(NS, { + name: `chained-leaf-${counter++}`, + from: [Leaf], + to: [Leaf], + display: { name: 'Chained Leaf' }, + apply({ a }) { return new Leaf({ value: a.data.value + 1 }); }, + dispose() { spy(); } + }); +} + +function newState() { + return State.create(new Root({}), { runTask: (t: Task) => t.run() }); +} + +describe('State.dispose', () => { + it('calls transformer.dispose for every live cell', async () => { + const leafSpy = jest.fn(); + const chainSpy = jest.fn(); + const A = leafTransformer(leafSpy); + const B = chainedTransformer(chainSpy); + + const state = newState(); + const builder = state.build(); + builder.toRoot().apply(A as any, { value: 1 }).apply(B as any, {}); + await state.runTask(state.updateTree(builder)); + + // root + 2 transformer outputs. + expect(state.cells.size).toBe(3); + + state.dispose(); + + expect(leafSpy).toHaveBeenCalledTimes(1); + expect(chainSpy).toHaveBeenCalledTimes(1); + }); + + it('disposes all sibling subtrees', async () => { + const spyA = jest.fn(); + const spyB = jest.fn(); + const A = leafTransformer(spyA); + const B = leafTransformer(spyB); + + const state = newState(); + const builder = state.build(); + builder.toRoot().apply(A as any, { value: 1 }); + builder.toRoot().apply(B as any, { value: 2 }); + await state.runTask(state.updateTree(builder)); + + state.dispose(); + + expect(spyA).toHaveBeenCalledTimes(1); + expect(spyB).toHaveBeenCalledTimes(1); + }); + + it('does not throw when a transformer dispose throws', async () => { + const goodSpy = jest.fn(); + const Throwing = StateTransformer.create(NS, { + name: `throwing-leaf-${counter++}`, + from: [Root], + to: [Leaf], + display: { name: 'Throwing Leaf' }, + apply({ params }) { return new Leaf({ value: params.value }); }, + dispose() { throw new Error('boom'); } + }); + const Good = leafTransformer(goodSpy); + + const state = newState(); + const builder = state.build(); + builder.toRoot().apply(Throwing as any, { value: 1 }); + builder.toRoot().apply(Good as any, { value: 2 }); + await state.runTask(state.updateTree(builder)); + + const warn = jest.spyOn(console, 'warn').mockImplementation(() => {}); + try { + expect(() => state.dispose()).not.toThrow(); + } finally { + warn.mockRestore(); + } + expect(goodSpy).toHaveBeenCalledTimes(1); + }); + + it('is a no-op for transformers without a dispose definition', async () => { + const NoDispose = StateTransformer.create(NS, { + name: `no-dispose-${counter++}`, + from: [Root], + to: [Leaf], + display: { name: 'No-dispose Leaf' }, + apply({ params }) { return new Leaf({ value: params.value }); } + }); + + const state = newState(); + const builder = state.build(); + builder.toRoot().apply(NoDispose as any, { value: 1 }); + await state.runTask(state.updateTree(builder)); + + expect(() => state.dispose()).not.toThrow(); + }); +}); diff --git a/src/mol-state/state.ts b/src/mol-state/state.ts index 4c93c74d6..fede7bc2b 100644 --- a/src/mol-state/state.ts +++ b/src/mol-state/state.ts @@ -159,6 +159,23 @@ class State { } dispose() { + // Dispose every still-live cell so transformer dispose callbacks + // (e.g. WebGL/GL buffer cleanup) actually run. Without this, + // calling dispose() on a State that still has cells leaks any + // resources held by transformer dispose callbacks because they + // would only fire on per-cell deletion (see updateNode/findDeletes). + const refs: StateTransform.Ref[] = []; + StateTree.doPostOrder(this._tree, this._tree.root, { refs }, (n, _, s) => { s.refs.push(n.ref); }); + for (let i = refs.length - 1; i >= 0; i--) { + const cell = (this.cells as Map).get(refs[i]); + if (!cell) continue; + try { + dispose(cell.transform, cell.obj, cell.transform.params, cell.cache, this.globalContext); + } catch (e) { + console.warn('Error in transformer dispose during State.dispose', e); + } + } + this.ev.dispose(); this.actions.dispose(); } From 40b6038380392e5aa6c67160e2de5165e7865898 Mon Sep 17 00:00:00 2001 From: Alexander Rose Date: Sat, 9 May 2026 15:43:04 -0700 Subject: [PATCH 4/5] type tweak --- src/mol-util/param-definition.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mol-util/param-definition.ts b/src/mol-util/param-definition.ts index 63c939d95..2447bddae 100644 --- a/src/mol-util/param-definition.ts +++ b/src/mol-util/param-definition.ts @@ -296,9 +296,9 @@ export namespace ParamDefinition { element: Params, ctor(): T, getLabel(t: T): string, - presets?: Select['options'] + presets?: SelectOption } - export function ObjectList(element: For, getLabel: (e: T) => string, info?: Info & { defaultValue?: T[], ctor?: () => T, presets?: Select['options'] }): ObjectList> { + export function ObjectList(element: For, getLabel: (e: T) => string, info?: Info & { defaultValue?: T[], ctor?: () => T, presets?: SelectOption }): ObjectList> { const ret = setInfo>>({ type: 'object-list', element: element as any as Params, getLabel, ctor: _defaultObjectListCtor, defaultValue: (info?.defaultValue) || [] }, info); if (info?.presets) ret.presets = info.presets as any; return ret; From a4962231c862c5a615b215e4e98ae02ebc177ffe Mon Sep 17 00:00:00 2001 From: Alexander Rose Date: Sat, 9 May 2026 15:51:05 -0700 Subject: [PATCH 5/5] revert --- src/mol-util/param-definition.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mol-util/param-definition.ts b/src/mol-util/param-definition.ts index 2447bddae..63c939d95 100644 --- a/src/mol-util/param-definition.ts +++ b/src/mol-util/param-definition.ts @@ -296,9 +296,9 @@ export namespace ParamDefinition { element: Params, ctor(): T, getLabel(t: T): string, - presets?: SelectOption + presets?: Select['options'] } - export function ObjectList(element: For, getLabel: (e: T) => string, info?: Info & { defaultValue?: T[], ctor?: () => T, presets?: SelectOption }): ObjectList> { + export function ObjectList(element: For, getLabel: (e: T) => string, info?: Info & { defaultValue?: T[], ctor?: () => T, presets?: Select['options'] }): ObjectList> { const ret = setInfo>>({ type: 'object-list', element: element as any as Params, getLabel, ctor: _defaultObjectListCtor, defaultValue: (info?.defaultValue) || [] }, info); if (info?.presets) ret.presets = info.presets as any; return ret;