From d121a11e28a4b23b8f33504ebac1d846bbf89d5b Mon Sep 17 00:00:00 2001
From: Alexander Rose <alexander.rose@weirdbyte.de>
Date: Mon, 22 Feb 2021 21:24:19 -0800
Subject: [PATCH] tweaked structure-element export

- got rid of index.ts for better compatibility
---
 src/mol-model/structure/structure/element.ts  |  2 +-
 .../structure/structure/element/element.ts    | 52 ++----------------
 .../structure/structure/element/index.ts      | 12 -----
 .../structure/structure/element/util.ts       | 54 +++++++++++++++++++
 4 files changed, 60 insertions(+), 60 deletions(-)
 delete mode 100644 src/mol-model/structure/structure/element/index.ts
 create mode 100644 src/mol-model/structure/structure/element/util.ts

diff --git a/src/mol-model/structure/structure/element.ts b/src/mol-model/structure/structure/element.ts
index 10ee83f47..952ef3c80 100644
--- a/src/mol-model/structure/structure/element.ts
+++ b/src/mol-model/structure/structure/element.ts
@@ -5,6 +5,6 @@
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
  */
 
-import * as StructureElement from './element/index';
+import * as StructureElement from './element/element';
 
 export { StructureElement };
\ No newline at end of file
diff --git a/src/mol-model/structure/structure/element/element.ts b/src/mol-model/structure/structure/element/element.ts
index 657d85c98..0911bdb72 100644
--- a/src/mol-model/structure/structure/element/element.ts
+++ b/src/mol-model/structure/structure/element/element.ts
@@ -5,50 +5,8 @@
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
  */
 
-import { SortedArray } from '../../../../mol-data/int';
-import { ElementIndex, ResidueIndex, ChainIndex } from '../../model';
-import { Unit } from '../unit';
-import { Location } from './location';
-import { StructureProperties } from '../properties';
-
-// TODO: when nominal types are available, make this indexed by UnitIndex
-export type Set = SortedArray<ElementIndex>
-
-/** Index into Unit.elements */
-export type UnitIndex = { readonly '@type': 'unit-element-index' } & number
-
-export interface Property<T> { (location: Location): T }
-export interface Predicate extends Property<boolean> { }
-
-export function property<T>(p: Property<T>) { return p; }
-
-function _wrongUnitKind(kind: string) { throw new Error(`Property only available for ${kind} models.`); }
-export function atomicProperty<T>(p: (location: Location<Unit.Atomic>) => T) {
-    return property(l => Unit.isAtomic(l.unit) ? p(l as Location<Unit.Atomic>) : _wrongUnitKind('atomic'));
-}
-
-export function coarseProperty<T>(p: (location: Location<Unit.Spheres | Unit.Gaussians>) => T) {
-    return property(l => Unit.isCoarse(l.unit) ? p(l as Location<Unit.Spheres | Unit.Gaussians>) : _wrongUnitKind('coarse'));
-}
-
-export function residueIndex(e: Location) {
-    if (Unit.isAtomic(e.unit)) {
-        return e.unit.residueIndex[e.element];
-    } else {
-        // TODO: throw error instead?
-        return -1 as ResidueIndex;
-    }
-}
-
-export function chainIndex(e: Location) {
-    if (Unit.isAtomic(e.unit)) {
-        return e.unit.chainIndex[e.element];
-    } else {
-        // TODO: throw error instead?
-        return -1 as ChainIndex;
-    }
-}
-
-export function entityIndex(l: Location) {
-    return StructureProperties.entity.key(l);
-}
\ No newline at end of file
+export * from './location';
+export * from './loci';
+export * from './bundle';
+export * from './stats';
+export * from './util';
\ No newline at end of file
diff --git a/src/mol-model/structure/structure/element/index.ts b/src/mol-model/structure/structure/element/index.ts
deleted file mode 100644
index fe0604e97..000000000
--- a/src/mol-model/structure/structure/element/index.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- * Copyright (c) 2017-2019 mol* contributors, licensed under MIT, See LICENSE file for more info.
- *
- * @author David Sehnal <david.sehnal@gmail.com>
- * @author Alexander Rose <alexander.rose@weirdbyte.de>
- */
-
-export * from './location';
-export * from './loci';
-export * from './bundle';
-export * from './stats';
-export * from './element';
\ No newline at end of file
diff --git a/src/mol-model/structure/structure/element/util.ts b/src/mol-model/structure/structure/element/util.ts
new file mode 100644
index 000000000..657d85c98
--- /dev/null
+++ b/src/mol-model/structure/structure/element/util.ts
@@ -0,0 +1,54 @@
+/**
+ * Copyright (c) 2017-2019 mol* contributors, licensed under MIT, See LICENSE file for more info.
+ *
+ * @author David Sehnal <david.sehnal@gmail.com>
+ * @author Alexander Rose <alexander.rose@weirdbyte.de>
+ */
+
+import { SortedArray } from '../../../../mol-data/int';
+import { ElementIndex, ResidueIndex, ChainIndex } from '../../model';
+import { Unit } from '../unit';
+import { Location } from './location';
+import { StructureProperties } from '../properties';
+
+// TODO: when nominal types are available, make this indexed by UnitIndex
+export type Set = SortedArray<ElementIndex>
+
+/** Index into Unit.elements */
+export type UnitIndex = { readonly '@type': 'unit-element-index' } & number
+
+export interface Property<T> { (location: Location): T }
+export interface Predicate extends Property<boolean> { }
+
+export function property<T>(p: Property<T>) { return p; }
+
+function _wrongUnitKind(kind: string) { throw new Error(`Property only available for ${kind} models.`); }
+export function atomicProperty<T>(p: (location: Location<Unit.Atomic>) => T) {
+    return property(l => Unit.isAtomic(l.unit) ? p(l as Location<Unit.Atomic>) : _wrongUnitKind('atomic'));
+}
+
+export function coarseProperty<T>(p: (location: Location<Unit.Spheres | Unit.Gaussians>) => T) {
+    return property(l => Unit.isCoarse(l.unit) ? p(l as Location<Unit.Spheres | Unit.Gaussians>) : _wrongUnitKind('coarse'));
+}
+
+export function residueIndex(e: Location) {
+    if (Unit.isAtomic(e.unit)) {
+        return e.unit.residueIndex[e.element];
+    } else {
+        // TODO: throw error instead?
+        return -1 as ResidueIndex;
+    }
+}
+
+export function chainIndex(e: Location) {
+    if (Unit.isAtomic(e.unit)) {
+        return e.unit.chainIndex[e.element];
+    } else {
+        // TODO: throw error instead?
+        return -1 as ChainIndex;
+    }
+}
+
+export function entityIndex(l: Location) {
+    return StructureProperties.entity.key(l);
+}
\ No newline at end of file
-- 
GitLab