@openfin/core 31.74.27 → 31.74.28
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/package.json +1 -1
- package/src/OpenFin.d.ts +20 -2
- package/src/api/platform/Instance.d.ts +1 -1
- package/src/api/platform/Instance.js +1 -1
- package/src/api/platform/layout/Factory.js +10 -1
- package/src/api/platform/layout/Instance.d.ts +6 -0
- package/src/api/platform/layout/Instance.js +26 -1
- package/src/api/platform/layout/controllers/layout-content-cache.d.ts +9 -0
- package/src/api/platform/layout/controllers/layout-content-cache.js +54 -0
- package/src/api/platform/layout/controllers/layout-entities-controller.d.ts +116 -0
- package/src/api/platform/layout/controllers/layout-entities-controller.js +256 -0
- package/src/api/platform/layout/entities/layout-entities.d.ts +134 -0
- package/src/api/platform/layout/entities/layout-entities.js +204 -0
- package/src/api/platform/layout/entities/shapes.d.ts +6 -0
- package/src/api/platform/layout/entities/shapes.js +2 -0
- package/src/api/platform/layout/layout.constants.d.ts +1 -0
- package/src/api/platform/layout/layout.constants.js +4 -0
- package/src/api/platform/layout/shapes.d.ts +3 -0
- package/src/api/platform/layout/utils/layout-traversal.d.ts +3 -0
- package/src/api/platform/layout/utils/layout-traversal.js +65 -0
- package/src/api/view/Instance.d.ts +8 -2
- package/src/api/view/Instance.js +37 -4
- package/src/util/channel-api-relay.d.ts +13 -0
- package/src/util/channel-api-relay.js +37 -0
- package/src/util/lazy.d.ts +16 -0
- package/src/util/lazy.js +26 -0
- package/src/util/reversible-map.d.ts +11 -0
- package/src/util/reversible-map.js +49 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReversibleMap = void 0;
|
|
4
|
+
class ReversibleMap {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.valueToKey = new Map();
|
|
7
|
+
this.keyToValue = new Map();
|
|
8
|
+
this.setUnique = (key, value) => {
|
|
9
|
+
if (this.hasKey(key) || this.hasValue(value)) {
|
|
10
|
+
throw new Error('Key or value already in the map.');
|
|
11
|
+
}
|
|
12
|
+
this.keyToValue.set(key, value);
|
|
13
|
+
this.valueToKey.set(value, key);
|
|
14
|
+
};
|
|
15
|
+
this.getKey = (value) => {
|
|
16
|
+
const existingKey = this.valueToKey.get(value);
|
|
17
|
+
if (!existingKey) {
|
|
18
|
+
throw new Error('Value not found in the map.');
|
|
19
|
+
}
|
|
20
|
+
return existingKey;
|
|
21
|
+
};
|
|
22
|
+
this.deleteKey = (key) => {
|
|
23
|
+
const value = this.getValue(key);
|
|
24
|
+
this.keyToValue.delete(key);
|
|
25
|
+
this.valueToKey.delete(value);
|
|
26
|
+
return value;
|
|
27
|
+
};
|
|
28
|
+
this.deleteValue = (value) => {
|
|
29
|
+
const key = this.getKey(value);
|
|
30
|
+
this.keyToValue.delete(key);
|
|
31
|
+
this.valueToKey.delete(value);
|
|
32
|
+
return key;
|
|
33
|
+
};
|
|
34
|
+
this.hasKey = (key) => {
|
|
35
|
+
return this.keyToValue.has(key);
|
|
36
|
+
};
|
|
37
|
+
this.hasValue = (value) => {
|
|
38
|
+
return this.valueToKey.has(value);
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
getValue(key) {
|
|
42
|
+
const item = this.keyToValue.get(key);
|
|
43
|
+
if (!item) {
|
|
44
|
+
throw new Error('Key not found in the map.');
|
|
45
|
+
}
|
|
46
|
+
return item;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.ReversibleMap = ReversibleMap;
|