@itwin/unified-selection 1.6.9-alpha.0 → 1.7.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 (79) hide show
  1. package/CHANGELOG.md +9 -61
  2. package/lib/cjs/unified-selection/CachingHiliteSetProvider.d.ts +3 -3
  3. package/lib/cjs/unified-selection/CachingHiliteSetProvider.d.ts.map +1 -1
  4. package/lib/cjs/unified-selection/CachingHiliteSetProvider.js +2 -2
  5. package/lib/cjs/unified-selection/CachingHiliteSetProvider.js.map +1 -1
  6. package/lib/cjs/unified-selection/EnableUnifiedSelectionSyncWithIModel.d.ts +7 -7
  7. package/lib/cjs/unified-selection/EnableUnifiedSelectionSyncWithIModel.d.ts.map +1 -1
  8. package/lib/cjs/unified-selection/EnableUnifiedSelectionSyncWithIModel.js +19 -12
  9. package/lib/cjs/unified-selection/EnableUnifiedSelectionSyncWithIModel.js.map +1 -1
  10. package/lib/cjs/unified-selection/HiliteSetProvider.d.ts +3 -3
  11. package/lib/cjs/unified-selection/HiliteSetProvider.d.ts.map +1 -1
  12. package/lib/cjs/unified-selection/HiliteSetProvider.js.map +1 -1
  13. package/lib/cjs/unified-selection/IModelHiliteSetProvider.d.ts +3 -4
  14. package/lib/cjs/unified-selection/IModelHiliteSetProvider.d.ts.map +1 -1
  15. package/lib/cjs/unified-selection/IModelHiliteSetProvider.js +2 -1
  16. package/lib/cjs/unified-selection/IModelHiliteSetProvider.js.map +1 -1
  17. package/lib/cjs/unified-selection/Selectable.d.ts +1 -1
  18. package/lib/cjs/unified-selection/Selectable.d.ts.map +1 -1
  19. package/lib/cjs/unified-selection/Selectable.js.map +1 -1
  20. package/lib/cjs/unified-selection/SelectionChangeEvent.d.ts +8 -3
  21. package/lib/cjs/unified-selection/SelectionChangeEvent.d.ts.map +1 -1
  22. package/lib/cjs/unified-selection/SelectionChangeEvent.js.map +1 -1
  23. package/lib/cjs/unified-selection/SelectionScope.d.ts +3 -3
  24. package/lib/cjs/unified-selection/SelectionScope.d.ts.map +1 -1
  25. package/lib/cjs/unified-selection/SelectionScope.js.map +1 -1
  26. package/lib/cjs/unified-selection/SelectionStorage.d.ts +18 -8
  27. package/lib/cjs/unified-selection/SelectionStorage.d.ts.map +1 -1
  28. package/lib/cjs/unified-selection/SelectionStorage.js +1 -1
  29. package/lib/cjs/unified-selection/SelectionStorage.js.map +1 -1
  30. package/lib/cjs/unified-selection/Utils.d.ts +2 -2
  31. package/lib/cjs/unified-selection/Utils.d.ts.map +1 -1
  32. package/lib/cjs/unified-selection/Utils.js.map +1 -1
  33. package/lib/cjs/unified-selection/types/IModel.d.ts +2 -2
  34. package/lib/cjs/unified-selection/types/IModel.d.ts.map +1 -1
  35. package/lib/cjs/unified-selection/types/IModel.js.map +1 -1
  36. package/lib/cjs/unified-selection.d.ts +7 -13
  37. package/lib/cjs/unified-selection.d.ts.map +1 -1
  38. package/lib/cjs/unified-selection.js.map +1 -1
  39. package/lib/esm/unified-selection/CachingHiliteSetProvider.d.ts +3 -3
  40. package/lib/esm/unified-selection/CachingHiliteSetProvider.d.ts.map +1 -1
  41. package/lib/esm/unified-selection/CachingHiliteSetProvider.js +2 -2
  42. package/lib/esm/unified-selection/CachingHiliteSetProvider.js.map +1 -1
  43. package/lib/esm/unified-selection/EnableUnifiedSelectionSyncWithIModel.d.ts +7 -7
  44. package/lib/esm/unified-selection/EnableUnifiedSelectionSyncWithIModel.d.ts.map +1 -1
  45. package/lib/esm/unified-selection/EnableUnifiedSelectionSyncWithIModel.js +19 -12
  46. package/lib/esm/unified-selection/EnableUnifiedSelectionSyncWithIModel.js.map +1 -1
  47. package/lib/esm/unified-selection/HiliteSetProvider.d.ts +3 -3
  48. package/lib/esm/unified-selection/HiliteSetProvider.d.ts.map +1 -1
  49. package/lib/esm/unified-selection/HiliteSetProvider.js +1 -1
  50. package/lib/esm/unified-selection/HiliteSetProvider.js.map +1 -1
  51. package/lib/esm/unified-selection/IModelHiliteSetProvider.d.ts +3 -4
  52. package/lib/esm/unified-selection/IModelHiliteSetProvider.d.ts.map +1 -1
  53. package/lib/esm/unified-selection/IModelHiliteSetProvider.js +2 -1
  54. package/lib/esm/unified-selection/IModelHiliteSetProvider.js.map +1 -1
  55. package/lib/esm/unified-selection/Selectable.d.ts +1 -1
  56. package/lib/esm/unified-selection/Selectable.d.ts.map +1 -1
  57. package/lib/esm/unified-selection/Selectable.js.map +1 -1
  58. package/lib/esm/unified-selection/SelectionChangeEvent.d.ts +8 -3
  59. package/lib/esm/unified-selection/SelectionChangeEvent.d.ts.map +1 -1
  60. package/lib/esm/unified-selection/SelectionChangeEvent.js.map +1 -1
  61. package/lib/esm/unified-selection/SelectionScope.d.ts +3 -3
  62. package/lib/esm/unified-selection/SelectionScope.d.ts.map +1 -1
  63. package/lib/esm/unified-selection/SelectionScope.js.map +1 -1
  64. package/lib/esm/unified-selection/SelectionStorage.d.ts +18 -8
  65. package/lib/esm/unified-selection/SelectionStorage.d.ts.map +1 -1
  66. package/lib/esm/unified-selection/SelectionStorage.js +1 -1
  67. package/lib/esm/unified-selection/SelectionStorage.js.map +1 -1
  68. package/lib/esm/unified-selection/Utils.d.ts +2 -2
  69. package/lib/esm/unified-selection/Utils.d.ts.map +1 -1
  70. package/lib/esm/unified-selection/Utils.js +1 -1
  71. package/lib/esm/unified-selection/Utils.js.map +1 -1
  72. package/lib/esm/unified-selection/types/IModel.d.ts +2 -2
  73. package/lib/esm/unified-selection/types/IModel.d.ts.map +1 -1
  74. package/lib/esm/unified-selection/types/IModel.js.map +1 -1
  75. package/lib/esm/unified-selection.d.ts +7 -13
  76. package/lib/esm/unified-selection.d.ts.map +1 -1
  77. package/lib/esm/unified-selection.js +1 -1
  78. package/lib/esm/unified-selection.js.map +1 -1
  79. package/package.json +13 -21
package/CHANGELOG.md CHANGED
@@ -1,28 +1,26 @@
1
1
  # @itwin/unified-selection
2
2
 
3
- ## 1.6.9-alpha.0
3
+ ## 1.7.0
4
4
 
5
- ### Patch Changes
5
+ ### Minor Changes
6
6
 
7
- - [#1250](https://github.com/iTwin/presentation/pull/1250): React to changes in `@itwin/presentation-shared`.
8
- - Updated dependencies:
9
- - @itwin/presentation-shared@2.0.0-alpha.9
7
+ - [#1285](https://github.com/iTwin/presentation/pull/1285): Make `imodelKey` prop optional when calling `SelectionStorage` methods.
10
8
 
11
- ## 1.6.8
9
+ While the package is designed to work with iModels' selection as the first class citizen, it can be used in other contexts as well. In those cases, the `imodelKey` prop is not relevant and should not be required. This change makes it optional and defaults to an empty string when not supplied.
12
10
 
13
11
  ### Patch Changes
14
12
 
15
- - [#1242](https://github.com/iTwin/presentation/pull/1242): Bump dependencies.
13
+ - [#1286](https://github.com/iTwin/presentation/pull/1286): Bump dependencies.
16
14
  - Updated dependencies:
17
- - @itwin/presentation-shared@1.2.10
15
+ - @itwin/presentation-shared@1.2.11
18
16
 
19
- ## 1.6.8-alpha.0
17
+ ## 1.6.8
20
18
 
21
19
  ### Patch Changes
22
20
 
23
- - [#1229](https://github.com/iTwin/presentation/pull/1229): Version bump
21
+ - [#1242](https://github.com/iTwin/presentation/pull/1242): Bump dependencies.
24
22
  - Updated dependencies:
25
- - @itwin/presentation-shared@2.0.0-alpha.8
23
+ - @itwin/presentation-shared@1.2.10
26
24
 
27
25
  ## 1.6.7
28
26
 
@@ -40,14 +38,6 @@
40
38
  - Updated dependencies:
41
39
  - @itwin/presentation-shared@1.2.8
42
40
 
43
- ## 1.6.6-alpha.0
44
-
45
- ### Patch Changes
46
-
47
- - [#1180](https://github.com/iTwin/presentation/pull/1180): Version bump
48
- - Updated dependencies:
49
- - @itwin/presentation-shared@2.0.0-alpha.6
50
-
51
41
  ## 1.6.5
52
42
 
53
43
  ### Patch Changes
@@ -73,12 +63,6 @@
73
63
  - Updated dependencies:
74
64
  - @itwin/presentation-shared@1.2.5
75
65
 
76
- ## 1.6.3-alpha.0
77
-
78
- ### Patch Changes
79
-
80
- - [#1130](https://github.com/iTwin/presentation/pull/1130): Version bump
81
-
82
66
  ## 1.6.2
83
67
 
84
68
  ### Patch Changes
@@ -87,14 +71,6 @@
87
71
  - Updated dependencies:
88
72
  - @itwin/presentation-shared@1.2.4
89
73
 
90
- ## 1.6.2-alpha.0
91
-
92
- ### Patch Changes
93
-
94
- - [#1112](https://github.com/iTwin/presentation/pull/1112): Version bump
95
- - Updated dependencies:
96
- - @itwin/presentation-shared@2.0.0-alpha.3
97
-
98
74
  ## 1.6.1
99
75
 
100
76
  ### Patch Changes
@@ -127,20 +103,6 @@
127
103
  - Updated dependencies:
128
104
  - @itwin/presentation-shared@1.2.3
129
105
 
130
- ## 1.5.1-alpha.1
131
-
132
- ### Patch Changes
133
-
134
- - [#1042](https://github.com/iTwin/presentation/pull/1042): Version bump
135
- - Updated dependencies:
136
- - @itwin/presentation-shared@2.0.0-alpha.2
137
-
138
- ## 1.5.1-alpha.0
139
-
140
- ### Patch Changes
141
-
142
- - [#1031](https://github.com/iTwin/presentation/pull/1031): Version bump
143
-
144
106
  ## 1.5.0
145
107
 
146
108
  ### Minor Changes
@@ -181,13 +143,6 @@
181
143
  });
182
144
  ```
183
145
 
184
- ## 1.4.3-alpha.0
185
-
186
- ### Patch Changes
187
-
188
- - Updated dependencies:
189
- - @itwin/presentation-shared@2.0.0-alpha.1
190
-
191
146
  ## 1.4.2
192
147
 
193
148
  ### Patch Changes
@@ -196,13 +151,6 @@
196
151
  - Updated dependencies:
197
152
  - @itwin/presentation-shared@1.2.2
198
153
 
199
- ## 1.4.2-alpha.0
200
-
201
- ### Patch Changes
202
-
203
- - Updated dependencies:
204
- - @itwin/presentation-shared@2.0.0-alpha.0
205
-
206
154
  ## 1.4.1
207
155
 
208
156
  ### Patch Changes
@@ -1,7 +1,7 @@
1
1
  import "./DisposePolyfill.js";
2
- import type { ECClassHierarchyInspector, ECSqlQueryExecutor } from "@itwin/presentation-shared";
3
- import type { createHiliteSetProvider, HiliteSet } from "./HiliteSetProvider.js";
4
- import type { SelectionStorage } from "./SelectionStorage.js";
2
+ import { ECClassHierarchyInspector, ECSqlQueryExecutor } from "@itwin/presentation-shared";
3
+ import { createHiliteSetProvider, HiliteSet } from "./HiliteSetProvider.js";
4
+ import { SelectionStorage } from "./SelectionStorage.js";
5
5
  /**
6
6
  * Props for creating a `CachingHiliteSetProvider` instance.
7
7
  * @public
@@ -1 +1 @@
1
- {"version":3,"file":"CachingHiliteSetProvider.d.ts","sourceRoot":"","sources":["../../../src/unified-selection/CachingHiliteSetProvider.ts"],"names":[],"mappings":"AAMA,OAAO,sBAAsB,CAAC;AAI9B,OAAO,KAAK,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChG,OAAO,KAAK,EAAE,uBAAuB,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D;;;;GAIG;AACH,MAAM,WAAW,6BAA6B;IAC5C,8DAA8D;IAC9D,gBAAgB,EAAE,gBAAgB,CAAC;IAEnC,iEAAiE;IACjE,cAAc,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,yBAAyB,GAAG,kBAAkB,CAAC;IAEtF,yHAAyH;IACzH,uBAAuB,CAAC,EAAE,OAAO,uBAAuB,CAAC;CAC1D;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,wBAAwB;IACvC,mEAAmE;IACnE,YAAY,CAAC,KAAK,EAAE;QAClB,mCAAmC;QACnC,SAAS,EAAE,MAAM,CAAC;KACnB,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAAC;IAErC;;;;;OAKG;IACH,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,IAAI,CAAC;IAE9B;;;OAGG;IACH,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;;GAKG;AAEH,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,6BAA6B,GAAG,wBAAwB,GAAG;IAAE,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,CAOhJ"}
1
+ {"version":3,"file":"CachingHiliteSetProvider.d.ts","sourceRoot":"","sources":["../../../src/unified-selection/CachingHiliteSetProvider.ts"],"names":[],"mappings":"AAMA,OAAO,sBAAsB,CAAC;AAE9B,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAC3F,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAE5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD;;;;GAIG;AACH,MAAM,WAAW,6BAA6B;IAC5C,8DAA8D;IAC9D,gBAAgB,EAAE,gBAAgB,CAAC;IAEnC,iEAAiE;IACjE,cAAc,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,yBAAyB,GAAG,kBAAkB,CAAC;IAEtF,yHAAyH;IACzH,uBAAuB,CAAC,EAAE,OAAO,uBAAuB,CAAC;CAC1D;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,wBAAwB;IACvC,mEAAmE;IACnE,YAAY,CAAC,KAAK,EAAE;QAClB,mCAAmC;QACnC,SAAS,EAAE,MAAM,CAAC;KACnB,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAAC;IAErC;;;;;OAKG;IACH,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,IAAI,CAAC;IAE9B;;;OAGG;IACH,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;;GAKG;AAEH,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,6BAA6B,GAAG,wBAAwB,GAAG;IAAE,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,CAOhJ"}
@@ -14,7 +14,7 @@ const IModelHiliteSetProvider_js_1 = require("./IModelHiliteSetProvider.js");
14
14
  * @public
15
15
  * @deprecated in 1.5. Use `createIModelHiliteSetProvider` instead.
16
16
  */
17
- /* c8 ignore start */
17
+ /* v8 ignore start */
18
18
  function createCachingHiliteSetProvider(props) {
19
19
  const provider = (0, IModelHiliteSetProvider_js_1.createIModelHiliteSetProvider)(props);
20
20
  return {
@@ -23,5 +23,5 @@ function createCachingHiliteSetProvider(props) {
23
23
  dispose: () => provider[Symbol.dispose](),
24
24
  };
25
25
  }
26
- /* c8 ignore end */
26
+ /* v8 ignore stop */
27
27
  //# sourceMappingURL=CachingHiliteSetProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CachingHiliteSetProvider.js","sourceRoot":"","sources":["../../../src/unified-selection/CachingHiliteSetProvider.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG,qDAAqD;;AAiErD,wEAOC;AAtED,gCAA8B;AAE9B,6EAA6E;AAsD7E;;;;;GAKG;AACH,qBAAqB;AACrB,SAAgB,8BAA8B,CAAC,KAAoC;IACjF,MAAM,QAAQ,GAAG,IAAA,0DAA6B,EAAC,KAAK,CAAC,CAAC;IACtD,OAAO;QACL,YAAY,EAAE,CAAC,cAAqC,EAAE,EAAE,CAAC,QAAQ,CAAC,mBAAmB,CAAC,cAAc,CAAC;QACrG,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE;QAClD,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE;KAC1C,CAAC;AACJ,CAAC;AACD,mBAAmB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/* eslint-disable @typescript-eslint/no-deprecated */\n\nimport \"./DisposePolyfill.js\";\n\nimport { createIModelHiliteSetProvider } from \"./IModelHiliteSetProvider.js\";\n\nimport type { ECClassHierarchyInspector, ECSqlQueryExecutor } from \"@itwin/presentation-shared\";\nimport type { createHiliteSetProvider, HiliteSet } from \"./HiliteSetProvider.js\";\nimport type { SelectionStorage } from \"./SelectionStorage.js\";\n\n/**\n * Props for creating a `CachingHiliteSetProvider` instance.\n * @public\n * @deprecated in 1.5. Use `IModelHiliteSetProviderProps` instead.\n */\nexport interface CachingHiliteSetProviderProps {\n /** Selection storage to use for retrieving the hilite set. */\n selectionStorage: SelectionStorage;\n\n /** A callback that should return iModel access by iModel key. */\n imodelProvider: (imodelKey: string) => ECClassHierarchyInspector & ECSqlQueryExecutor;\n\n /** An optional hilite set provider factory. If not provided, defaults to `createHiliteSetProvider` from this package. */\n createHiliteSetProvider?: typeof createHiliteSetProvider;\n}\n\n/**\n * Defines return value of `createCachingHiliteSetProvider`.\n *\n * **Warning:** Used in public API as a return value. Not expected to be created / extended by package\n * consumers, may be supplemented with required attributes any time.\n *\n * @see `createCachingHiliteSetProvider`\n * @public\n * @deprecated in 1.5. Use `IModelHiliteSetProvider` instead.\n */\nexport interface CachingHiliteSetProvider {\n /** Get the current hilite set iterator for the specified imodel */\n getHiliteSet(props: {\n /** iModel to get hilite set for */\n imodelKey: string;\n }): AsyncIterableIterator<HiliteSet>;\n\n /**\n * Disposes the cache.\n *\n * Optional to avoid breaking the API. Will be made required when the deprecated\n * `dispose` is removed.\n */\n [Symbol.dispose]?: () => void;\n\n /**\n * Disposes the cache.\n * @deprecated in 1.2. Use `[Symbol.dispose]` instead.\n */\n dispose(): void;\n}\n\n/**\n * Creates a hilite set provider that caches hilite set for current selection for given iModel so any subsequent\n * hilite set requests for the same iModel don't cost until selection in given selection storage changes.\n * @public\n * @deprecated in 1.5. Use `createIModelHiliteSetProvider` instead.\n */\n/* c8 ignore start */\nexport function createCachingHiliteSetProvider(props: CachingHiliteSetProviderProps): CachingHiliteSetProvider & { [Symbol.dispose]: () => void } {\n const provider = createIModelHiliteSetProvider(props);\n return {\n getHiliteSet: (hiliteSetProps: { imodelKey: string }) => provider.getCurrentHiliteSet(hiliteSetProps),\n [Symbol.dispose]: () => provider[Symbol.dispose](),\n dispose: () => provider[Symbol.dispose](),\n };\n}\n/* c8 ignore end */\n"]}
1
+ {"version":3,"file":"CachingHiliteSetProvider.js","sourceRoot":"","sources":["../../../src/unified-selection/CachingHiliteSetProvider.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG,qDAAqD;;AAgErD,wEAOC;AArED,gCAA8B;AAI9B,6EAA6E;AAmD7E;;;;;GAKG;AACH,qBAAqB;AACrB,SAAgB,8BAA8B,CAAC,KAAoC;IACjF,MAAM,QAAQ,GAAG,IAAA,0DAA6B,EAAC,KAAK,CAAC,CAAC;IACtD,OAAO;QACL,YAAY,EAAE,CAAC,cAAqC,EAAE,EAAE,CAAC,QAAQ,CAAC,mBAAmB,CAAC,cAAc,CAAC;QACrG,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE;QAClD,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE;KAC1C,CAAC;AACJ,CAAC;AACD,oBAAoB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/* eslint-disable @typescript-eslint/no-deprecated */\n\nimport \"./DisposePolyfill.js\";\n\nimport { ECClassHierarchyInspector, ECSqlQueryExecutor } from \"@itwin/presentation-shared\";\nimport { createHiliteSetProvider, HiliteSet } from \"./HiliteSetProvider.js\";\nimport { createIModelHiliteSetProvider } from \"./IModelHiliteSetProvider.js\";\nimport { SelectionStorage } from \"./SelectionStorage.js\";\n\n/**\n * Props for creating a `CachingHiliteSetProvider` instance.\n * @public\n * @deprecated in 1.5. Use `IModelHiliteSetProviderProps` instead.\n */\nexport interface CachingHiliteSetProviderProps {\n /** Selection storage to use for retrieving the hilite set. */\n selectionStorage: SelectionStorage;\n\n /** A callback that should return iModel access by iModel key. */\n imodelProvider: (imodelKey: string) => ECClassHierarchyInspector & ECSqlQueryExecutor;\n\n /** An optional hilite set provider factory. If not provided, defaults to `createHiliteSetProvider` from this package. */\n createHiliteSetProvider?: typeof createHiliteSetProvider;\n}\n\n/**\n * Defines return value of `createCachingHiliteSetProvider`.\n *\n * **Warning:** Used in public API as a return value. Not expected to be created / extended by package\n * consumers, may be supplemented with required attributes any time.\n *\n * @see `createCachingHiliteSetProvider`\n * @public\n * @deprecated in 1.5. Use `IModelHiliteSetProvider` instead.\n */\nexport interface CachingHiliteSetProvider {\n /** Get the current hilite set iterator for the specified imodel */\n getHiliteSet(props: {\n /** iModel to get hilite set for */\n imodelKey: string;\n }): AsyncIterableIterator<HiliteSet>;\n\n /**\n * Disposes the cache.\n *\n * Optional to avoid breaking the API. Will be made required when the deprecated\n * `dispose` is removed.\n */\n [Symbol.dispose]?: () => void;\n\n /**\n * Disposes the cache.\n * @deprecated in 1.2. Use `[Symbol.dispose]` instead.\n */\n dispose(): void;\n}\n\n/**\n * Creates a hilite set provider that caches hilite set for current selection for given iModel so any subsequent\n * hilite set requests for the same iModel don't cost until selection in given selection storage changes.\n * @public\n * @deprecated in 1.5. Use `createIModelHiliteSetProvider` instead.\n */\n/* v8 ignore start */\nexport function createCachingHiliteSetProvider(props: CachingHiliteSetProviderProps): CachingHiliteSetProvider & { [Symbol.dispose]: () => void } {\n const provider = createIModelHiliteSetProvider(props);\n return {\n getHiliteSet: (hiliteSetProps: { imodelKey: string }) => provider.getCurrentHiliteSet(hiliteSetProps),\n [Symbol.dispose]: () => provider[Symbol.dispose](),\n dispose: () => provider[Symbol.dispose](),\n };\n}\n/* v8 ignore stop */\n"]}
@@ -1,11 +1,11 @@
1
1
  import "./DisposePolyfill.js";
2
- import type { ECClassHierarchyInspector, ECSqlQueryExecutor } from "@itwin/presentation-shared";
3
- import type { CachingHiliteSetProvider } from "./CachingHiliteSetProvider.js";
4
- import type { HiliteSetProvider } from "./HiliteSetProvider.js";
5
- import type { IModelHiliteSetProvider } from "./IModelHiliteSetProvider.js";
6
- import type { SelectionScope } from "./SelectionScope.js";
7
- import type { SelectionStorage } from "./SelectionStorage.js";
8
- import type { CoreIModelHiliteSet, CoreIModelSelectionSet } from "./types/IModel.js";
2
+ import { ECClassHierarchyInspector, ECSqlQueryExecutor } from "@itwin/presentation-shared";
3
+ import { CachingHiliteSetProvider } from "./CachingHiliteSetProvider.js";
4
+ import { HiliteSetProvider } from "./HiliteSetProvider.js";
5
+ import { IModelHiliteSetProvider } from "./IModelHiliteSetProvider.js";
6
+ import { SelectionScope } from "./SelectionScope.js";
7
+ import { SelectionStorage } from "./SelectionStorage.js";
8
+ import { CoreIModelHiliteSet, CoreIModelSelectionSet } from "./types/IModel.js";
9
9
  /**
10
10
  * Props for `enableUnifiedSelectionSyncWithIModel`.
11
11
  * @public
@@ -1 +1 @@
1
- {"version":3,"file":"EnableUnifiedSelectionSyncWithIModel.d.ts","sourceRoot":"","sources":["../../../src/unified-selection/EnableUnifiedSelectionSyncWithIModel.ts"],"names":[],"mappings":"AAKA,OAAO,sBAAsB,CAAC;AAY9B,OAAO,KAAK,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChG,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,KAAK,EAAa,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAG5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,sBAAsB,EAAkD,MAAM,mBAAmB,CAAC;AAErI;;;GAGG;AACH,MAAM,WAAW,yCAAyC;IACxD;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,YAAY,EAAE,kBAAkB,GAC9B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AAC,aAAa;IAuCrB,OAAO,CAAC,yBAAyB,CAa/B;IAEF,OAAO,CAAC,qBAAqB;IAoB7B,OAAO,CAAC,YAAY;IAwBpB,OAAO,CAAC,eAAe;IAuBvB,OAAO,CAAC,wBAAwB,CAsD9B;CACH"}
1
+ {"version":3,"file":"EnableUnifiedSelectionSyncWithIModel.d.ts","sourceRoot":"","sources":["../../../src/unified-selection/EnableUnifiedSelectionSyncWithIModel.ts"],"names":[],"mappings":"AAKA,OAAO,sBAAsB,CAAC;AAI9B,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAC3F,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAsC,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC/F,OAAO,EAAiC,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAGtG,OAAO,EAAoB,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAA6E,MAAM,mBAAmB,CAAC;AAG3J;;;GAGG;AACH,MAAM,WAAW,yCAAyC;IACxD;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,YAAY,EAAE,kBAAkB,GAC9B,yBAAyB,GAAG;QAC1B,sEAAsE;QACtE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;QACrB,mFAAmF;QACnF,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAAC;QACxC,yFAAyF;QACzF,QAAQ,CAAC,YAAY,EAAE,sBAAsB,CAAC;KAC/C,CAAC;IAEJ;;;OAGG;IACH,gBAAgB,EAAE,gBAAgB,CAAC;IAEnC,uCAAuC;IACvC,mBAAmB,EAAE,MAAM,cAAc,CAAC;IAE1C;;;;;;;OAOG;IACH,uBAAuB,CAAC,EAAE,uBAAuB,CAAC;IAElD;;;;;;;;;;;;;;OAcG;IAEH,wBAAwB,CAAC,EAAE,wBAAwB,GAAG,CAAC,IAAI,CAAC,wBAAwB,EAAE,SAAS,CAAC,GAAG;QAAE,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC,CAAC;CACtI;AAED;;;;GAIG;AACH,wBAAgB,oCAAoC,CAAC,KAAK,EAAE,yCAAyC,GAAG,MAAM,IAAI,CAGjH;AAED;;;;;GAKG;AACH,qBAAa,sBAAsB;;IACjC,OAAO,CAAC,oBAAoB,CAAU;IAEtC,OAAO,CAAC,aAAa,CAA4D;IACjF,OAAO,CAAC,iBAAiB,CAAmB;IAC5C,OAAO,CAAC,wBAAwB,CAAoF;IACpH,OAAO,CAAC,oBAAoB,CAAuB;IAEnD,OAAO,CAAC,YAAY,CAAU;IAC9B,OAAO,CAAC,8BAA8B,CAAK;IAC3C,OAAO,CAAC,qBAAqB,CAAuB;IACpD,OAAO,CAAC,mCAAmC,CAAa;IACxD,OAAO,CAAC,qCAAqC,CAAa;IAC1D,OAAO,CAAC,iCAAiC,CAAa;gBAInC,KAAK,EAAE,yCAAyC,GAAG;QAAE,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;KAAE;IA+CxG,CAAC,MAAM,CAAC,OAAO,CAAC;IAOvB,4GAA4G;IACrG,8BAA8B;;;IAUrC,OAAO,CAAC,aAAa;IAuCrB,OAAO,CAAC,yBAAyB,CAa/B;IAEF,OAAO,CAAC,qBAAqB;IAoB7B,OAAO,CAAC,YAAY;IA2BpB,OAAO,CAAC,eAAe;IA0BvB,OAAO,CAAC,wBAAwB,CAsD9B;CACH"}
@@ -105,25 +105,25 @@ class IModelSelectionHandler {
105
105
  if (props.imodelHiliteSetProvider) {
106
106
  return [props.imodelHiliteSetProvider, () => { }];
107
107
  }
108
- // eslint-disable-next-line @typescript-eslint/no-deprecated
108
+ /* eslint-disable @typescript-eslint/no-deprecated */
109
+ /* v8 ignore else -- @preserve */
109
110
  if (props.cachingHiliteSetProvider) {
110
111
  return [
111
- createIModelHiliteSetProviderFromCachingProvider(
112
- // eslint-disable-next-line @typescript-eslint/no-deprecated
113
- props.cachingHiliteSetProvider, props.hiliteSetProvider ?? (0, HiliteSetProvider_js_1.createHiliteSetProvider)({ imodelAccess: props.imodelAccess })),
112
+ createIModelHiliteSetProviderFromCachingProvider(props.cachingHiliteSetProvider, props.hiliteSetProvider ?? (0, HiliteSetProvider_js_1.createHiliteSetProvider)({ imodelAccess: props.imodelAccess })),
114
113
  // don't need to dispose anything, because our wrapper has no dispose logic, and `cachingHiliteSetProvider` should be disposed
115
114
  // by whoever owns it
116
115
  () => { },
117
116
  ];
118
117
  }
119
- /* c8 ignore start */
118
+ /* eslint-enable @typescript-eslint/no-deprecated */
119
+ /* v8 ignore start */
120
120
  const internalProvider = (0, IModelHiliteSetProvider_js_1.createIModelHiliteSetProvider)({
121
121
  selectionStorage: this._selectionStorage,
122
122
  imodelProvider: () => this._imodelAccess,
123
123
  createHiliteSetProvider: () => props.hiliteSetProvider ?? (0, HiliteSetProvider_js_1.createHiliteSetProvider)({ imodelAccess: props.imodelAccess }),
124
124
  });
125
125
  return [internalProvider, () => (0, Utils_js_1.safeDispose)(internalProvider)];
126
- /* c8 ignore end */
126
+ /* v8 ignore stop */
127
127
  })();
128
128
  this._unregisterIModelSelectionSetListener = this._imodelAccess.selectionSet.onChanged.addListener(this.onIModelSelectionChanged);
129
129
  this._unregisterUnifiedSelectionListener = this._selectionStorage.selectionChangeEvent.addListener(this.onUnifiedSelectionChanged);
@@ -240,12 +240,15 @@ class IModelSelectionHandler {
240
240
  }
241
241
  else {
242
242
  // pre-5.0 core requires adding models and subcategories to hilite set separately
243
+ /* v8 ignore else -- @preserve */
243
244
  if (set.models.length) {
244
245
  this._imodelAccess.hiliteSet.models.addIds(set.models);
245
246
  }
247
+ /* v8 ignore else -- @preserve */
246
248
  if (set.subCategories.length) {
247
249
  this._imodelAccess.hiliteSet.subcategories.addIds(set.subCategories);
248
250
  }
251
+ /* v8 ignore else -- @preserve */
249
252
  if (set.elements.length) {
250
253
  this._imodelAccess.hiliteSet.elements.addIds(set.elements);
251
254
  this._imodelAccess.selectionSet.add(set.elements);
@@ -273,12 +276,15 @@ class IModelSelectionHandler {
273
276
  });
274
277
  }
275
278
  else {
279
+ /* v8 ignore else -- @preserve */
276
280
  if (set.models.length) {
277
281
  this._imodelAccess.hiliteSet.models.deleteIds(set.models);
278
282
  }
283
+ /* v8 ignore else -- @preserve */
279
284
  if (set.subCategories.length) {
280
285
  this._imodelAccess.hiliteSet.subcategories.deleteIds(set.subCategories);
281
286
  }
287
+ /* v8 ignore else -- @preserve */
282
288
  if (set.elements.length) {
283
289
  this._imodelAccess.hiliteSet.elements.deleteIds(set.elements);
284
290
  this._imodelAccess.selectionSet.remove(set.elements);
@@ -309,9 +315,9 @@ class IModelSelectionHandler {
309
315
  scope: this._activeScopeProvider(),
310
316
  componentId: this.#componentId,
311
317
  }))
312
- : /* c8 ignore next */ rxjs_1.EMPTY, ids.models ? (0, rxjs_1.from)(ids.models).pipe((0, rxjs_1.map)((id) => ({ className: "BisCore.Model", id }))) : /* c8 ignore next */ rxjs_1.EMPTY, ids.subcategories
318
+ : /* v8 ignore next */ rxjs_1.EMPTY, ids.models ? (0, rxjs_1.from)(ids.models).pipe((0, rxjs_1.map)((id) => ({ className: "BisCore.Model", id }))) : /* v8 ignore next */ rxjs_1.EMPTY, ids.subcategories
313
319
  ? (0, rxjs_1.from)(ids.subcategories).pipe((0, rxjs_1.map)((id) => ({ className: "BisCore.SubCategory", id })))
314
- : /* c8 ignore next */ rxjs_1.EMPTY);
320
+ : /* v8 ignore next */ rxjs_1.EMPTY);
315
321
  const selectionStorageVersion = this._selectionStorageChangeTracker;
316
322
  const changeSelectionStorageProps = {
317
323
  imodelKey: this._imodelAccess.key,
@@ -345,9 +351,9 @@ exports.IModelSelectionHandler = IModelSelectionHandler;
345
351
  function getSelectionSetChangeIds(event) {
346
352
  switch (event.type) {
347
353
  case IModel_js_1.CoreSelectionSetEventType.Add:
348
- return event.additions ?? (event.added ? { elements: event.added } : /* c8 ignore next */ {});
354
+ return event.additions ?? (event.added ? { elements: event.added } : /* v8 ignore next */ {});
349
355
  case IModel_js_1.CoreSelectionSetEventType.Remove:
350
- return event.removals ?? (event.removed ? { elements: event.removed } : /* c8 ignore next */ {});
356
+ return event.removals ?? (event.removed ? { elements: event.removed } : /* v8 ignore next */ {});
351
357
  case IModel_js_1.CoreSelectionSetEventType.Replace:
352
358
  return "active" in event.set ? event.set.active : { elements: event.set.elements };
353
359
  }
@@ -360,6 +366,7 @@ function getUnifiedSelectionChangeType(coreChangeType) {
360
366
  return "remove";
361
367
  case IModel_js_1.CoreSelectionSetEventType.Replace:
362
368
  return "replace";
369
+ /* v8 ignore next -- @preserve */
363
370
  case IModel_js_1.CoreSelectionSetEventType.Clear:
364
371
  return "clear";
365
372
  }
@@ -367,7 +374,7 @@ function getUnifiedSelectionChangeType(coreChangeType) {
367
374
  function is5xSelectionSet(selectionSet) {
368
375
  return "active" in selectionSet;
369
376
  }
370
- /* c8 ignore start */
377
+ /* v8 ignore start */
371
378
  function createIModelHiliteSetProviderFromCachingProvider(cachingHiliteSetProvider, hiliteSetProvider) {
372
379
  return {
373
380
  getHiliteSetProvider: () => hiliteSetProvider,
@@ -375,5 +382,5 @@ function createIModelHiliteSetProviderFromCachingProvider(cachingHiliteSetProvid
375
382
  [Symbol.dispose]: () => { },
376
383
  };
377
384
  }
378
- /* c8 ignore end */
385
+ /* v8 ignore stop */
379
386
  //# sourceMappingURL=EnableUnifiedSelectionSyncWithIModel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EnableUnifiedSelectionSyncWithIModel.js","sourceRoot":"","sources":["../../../src/unified-selection/EnableUnifiedSelectionSyncWithIModel.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwGhG,oFAGC;AAzGD,gCAA8B;AAE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yB,CAAC,OAAO;YACpC,OAAO,SAAS,CAAC;QACnB,KAAK,qCAAyB,CAAC,KAAK;YAClC,OAAO,OAAO,CAAC;IACnB,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,YAAoC;IAK5D,OAAO,QAAQ,IAAI,YAAY,CAAC;AAClC,CAAC;AAED,qBAAqB;AACrB,SAAS,gDAAgD,CACvD,wBAA4G,EAC5G,iBAAoC;IAEpC,OAAO;QACL,oBAAoB,EAAE,GAAG,EAAE,CAAC,iBAAiB;QAC7C,mBAAmB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,wBAAwB,CAAC,YAAY,CAAC,KAAK,CAAC;QAC5E,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,GAAE,CAAC;KAC3B,CAAC;AACJ,CAAC;AACD,mBAAmB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport \"./DisposePolyfill.js\";\n\nimport { EMPTY, firstValueFrom, from, map, merge, Subject, takeUntil, toArray } from \"rxjs\";\nimport { Guid } from \"@itwin/core-bentley\";\nimport { createHiliteSetProvider } from \"./HiliteSetProvider.js\";\nimport { createIModelHiliteSetProvider } from \"./IModelHiliteSetProvider.js\";\nimport { Selectables } from \"./Selectable.js\";\nimport { computeSelection } from \"./SelectionScope.js\";\nimport { CoreSelectionSetEventType } from \"./types/IModel.js\";\nimport { safeDispose } from \"./Utils.js\";\n\nimport type { GuidString, Id64Arg, Id64Set } from \"@itwin/core-bentley\";\nimport type { ECClassHierarchyInspector, ECSqlQueryExecutor } from \"@itwin/presentation-shared\";\nimport type { CachingHiliteSetProvider } from \"./CachingHiliteSetProvider.js\";\nimport type { HiliteSet, HiliteSetProvider } from \"./HiliteSetProvider.js\";\nimport type { IModelHiliteSetProvider } from \"./IModelHiliteSetProvider.js\";\nimport type { SelectableInstanceKey } from \"./Selectable.js\";\nimport type { StorageSelectionChangeEventArgs, StorageSelectionChangeType } from \"./SelectionChangeEvent.js\";\nimport type { SelectionScope } from \"./SelectionScope.js\";\nimport type { SelectionStorage } from \"./SelectionStorage.js\";\nimport type { CoreIModelHiliteSet, CoreIModelSelectionSet, CoreSelectableIds, CoreSelectionSetEventUnsafe } from \"./types/IModel.js\";\n\n/**\n * Props for `enableUnifiedSelectionSyncWithIModel`.\n * @public\n */\nexport interface EnableUnifiedSelectionSyncWithIModelProps {\n /**\n * Provides access to different iModel's features: query executing, class hierarchy, selection and hilite sets.\n *\n * It's recommended to use `@itwin/presentation-core-interop` to create `key`, `ECSqlQueryExecutor` and `ECSchemaProvider` from\n * [IModelConnection](https://www.itwinjs.org/reference/core-frontend/imodelconnection/imodelconnection/), and map its\n * `hilited` and `selectionSet` attributes like this:\n *\n * ```ts\n * import { createECSqlQueryExecutor, createECSchemaProvider, createIModelKey } from \"@itwin/presentation-core-interop\";\n * import { createCachingECClassHierarchyInspector } from \"@itwin/presentation-shared\";\n * import { IModelConnection } from \"@itwin/core-frontend\";\n *\n * const imodel: IModelConnection = ...\n * const imodelAccess = {\n * ...createECSqlQueryExecutor(imodel),\n * ...createCachingECClassHierarchyInspector({ schemaProvider: createECSchemaProvider(MyAppFrontend.getSchemaContext(imodel)) }),\n * key: createIModelKey(imodel),\n * hiliteSet: imodel.hilited,\n * selectionSet: imodel.selectionSet,\n * };\n * ```\n */\n imodelAccess: ECSqlQueryExecutor &\n ECClassHierarchyInspector & {\n /** Key of the iModel. Generally taken from `IModelConnection.key`. */\n readonly key: string;\n /** The set of currently hilited elements taken from `IModelConnection.hilited`. */\n readonly hiliteSet: CoreIModelHiliteSet;\n /** The set of currently selected elements taken from `IModelConnection.selectionSet`. */\n readonly selectionSet: CoreIModelSelectionSet;\n };\n\n /**\n * Unified selection storage to synchronize IModel's tool selection with. The storage should be shared\n * across all components in the application to ensure unified selection experience.\n */\n selectionStorage: SelectionStorage;\n\n /** Active selection scope provider. */\n activeScopeProvider: () => SelectionScope;\n\n /**\n * An iModel hilite set provider used to retrieve hilite sets for different iModels. If not provided, a new `IModelHiliteSetProvider`\n * will be created for the given iModel using the provided `imodelAccess`.\n * If the consuming application already has a `IModelHiliteSetProvider` defined, it should be provided instead\n * to reuse the cache and avoid creating new providers for each iModel.\n *\n * @see `createIModelHiliteSetProvider`\n */\n imodelHiliteSetProvider?: IModelHiliteSetProvider;\n\n /**\n * A caching hilite set provider used to retrieve hilite sets for an iModel. If not provided, a new `CachingHiliteSetProvider`\n * will be created for the given iModel using the provided `imodelAccess`.\n * If the consuming application already has a `CachingHiliteSetProvider` defined, it should be provided instead\n * to reuse the cache and avoid creating new providers for each iModel.\n *\n * The type is defined in a way that makes it required for provider to have either the deprecated `dispose` or the\n * new `Symbol.dispose` method.\n *\n * **Warning:** When the given `CachingHiliteSetProvider` internally uses a custom `HiliteSetProvider`, the synchronization has\n * no access to it, and thus uses its own, default, `HiliteSetProvider`. As a result, the synchronization may not work as expected.\n * To alleviate this, the `imodelHiliteSetProvider` prop should be used instead.\n *\n * @deprecated in 1.5. Use `imodelHiliteSetProvider` prop instead.\n */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n cachingHiliteSetProvider?: CachingHiliteSetProvider | (Omit<CachingHiliteSetProvider, \"dispose\"> & { [Symbol.dispose]: () => void });\n}\n\n/**\n * Enables synchronization between iModel selection and unified selection.\n * @returns function for disposing the synchronization.\n * @public\n */\nexport function enableUnifiedSelectionSyncWithIModel(props: EnableUnifiedSelectionSyncWithIModelProps): () => void {\n const selectionHandler = new IModelSelectionHandler(props);\n return () => selectionHandler[Symbol.dispose]();\n}\n\n/**\n * A handler that syncs selection between unified selection storage (`SelectionStorage`) and\n * an iModel (`iModel.selectionSet`, `iModel.hilited`).\n *\n * @internal\n */\nexport class IModelSelectionHandler {\n private _selectionSourceName = \"Tool\";\n\n private _imodelAccess: EnableUnifiedSelectionSyncWithIModelProps[\"imodelAccess\"];\n private _selectionStorage: SelectionStorage;\n private _imodelHiliteSetProvider: NonNullable<EnableUnifiedSelectionSyncWithIModelProps[\"imodelHiliteSetProvider\"]>;\n private _activeScopeProvider: () => SelectionScope;\n\n private _isSuspended: boolean;\n private _selectionStorageChangeTracker = 0;\n private _cancelOngoingChanges = new Subject<void>();\n private _unregisterUnifiedSelectionListener: () => void;\n private _unregisterIModelSelectionSetListener: () => void;\n private _disposeInternalHiliteSetProvider: () => void;\n\n #componentId: GuidString;\n\n public constructor(props: EnableUnifiedSelectionSyncWithIModelProps & { hiliteSetProvider?: HiliteSetProvider }) {\n this.#componentId = Guid.createValue();\n this._imodelAccess = props.imodelAccess;\n this._selectionStorage = props.selectionStorage;\n this._activeScopeProvider = props.activeScopeProvider;\n this._isSuspended = false;\n [this._imodelHiliteSetProvider, this._disposeInternalHiliteSetProvider] = (() => {\n if (props.imodelHiliteSetProvider) {\n return [props.imodelHiliteSetProvider, () => {}];\n }\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n if (props.cachingHiliteSetProvider) {\n return [\n createIModelHiliteSetProviderFromCachingProvider(\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n props.cachingHiliteSetProvider,\n props.hiliteSetProvider ?? createHiliteSetProvider({ imodelAccess: props.imodelAccess }),\n ),\n // don't need to dispose anything, because our wrapper has no dispose logic, and `cachingHiliteSetProvider` should be disposed\n // by whoever owns it\n () => {},\n ];\n }\n /* c8 ignore start */\n const internalProvider = createIModelHiliteSetProvider({\n selectionStorage: this._selectionStorage,\n imodelProvider: () => this._imodelAccess,\n createHiliteSetProvider: () => props.hiliteSetProvider ?? createHiliteSetProvider({ imodelAccess: props.imodelAccess }),\n });\n return [internalProvider, () => safeDispose(internalProvider)];\n /* c8 ignore end */\n })();\n\n this._unregisterIModelSelectionSetListener = this._imodelAccess.selectionSet.onChanged.addListener(this.onIModelSelectionChanged);\n this._unregisterUnifiedSelectionListener = this._selectionStorage.selectionChangeEvent.addListener(this.onUnifiedSelectionChanged);\n\n if (!is5xSelectionSet(this._imodelAccess.selectionSet)) {\n // itwinjs-core@4: stop imodel from syncing tool selection with hilited list - we want to manage that sync ourselves\n this._imodelAccess.hiliteSet.wantSyncWithSelectionSet = false;\n }\n\n this.applyCurrentHiliteSet({ activeSelectionAction: \"clearAll\" });\n }\n\n public [Symbol.dispose]() {\n this._cancelOngoingChanges.next();\n this._unregisterIModelSelectionSetListener();\n this._unregisterUnifiedSelectionListener();\n this._disposeInternalHiliteSetProvider();\n }\n\n /** Temporarily suspends tool selection synchronization until the returned disposable object is disposed. */\n public suspendIModelToolSelectionSync() {\n const wasSuspended = this._isSuspended;\n this._isSuspended = true;\n return {\n [Symbol.dispose]: () => {\n this._isSuspended = wasSuspended;\n },\n };\n }\n\n private syncHiliteSet(props: { changeType: StorageSelectionChangeType; selectables: Selectables; source: string }): void {\n const { changeType, selectables, source } = props;\n switch (changeType) {\n case \"clear\":\n return this.applyCurrentHiliteSet({ activeSelectionAction: \"clearAll\" });\n case \"replace\":\n return this.applyCurrentHiliteSet({\n activeSelectionAction:\n source === this._selectionSourceName\n ? is5xSelectionSet(this._imodelAccess.selectionSet)\n ? // with 5x core we don't need to clear anything when event is triggered by a Tool (hilite and selection sets are in sync already)\n \"keep\"\n : // with 4x core we need to clear hilite set, because it's not synced with selection set\n \"clearHilited\"\n : // when event is triggered not by a Tool, we need to clear everything\n \"clearAll\",\n });\n case \"add\":\n return void from(this._imodelHiliteSetProvider.getHiliteSetProvider({ imodelKey: this._imodelAccess.key }).getHiliteSet({ selectables }))\n .pipe(takeUntil(this._cancelOngoingChanges))\n .subscribe({\n next: (set) => {\n this.addHiliteSet(set);\n },\n });\n case \"remove\":\n return void from(this._imodelHiliteSetProvider.getHiliteSetProvider({ imodelKey: this._imodelAccess.key }).getHiliteSet({ selectables }))\n .pipe(takeUntil(this._cancelOngoingChanges))\n .subscribe({\n next: (set) => {\n this.removeHiliteSet(set);\n },\n complete: () => {\n this.applyCurrentHiliteSet({ activeSelectionAction: \"keep\" });\n },\n });\n }\n }\n\n private onUnifiedSelectionChanged = (args: StorageSelectionChangeEventArgs) => {\n // iModels are only interested in top-level selection changes\n if (args.imodelKey !== this._imodelAccess.key || args.level !== 0) {\n return;\n }\n\n // update the selection storage change tracker so we know the selection storage changed\n this._selectionStorageChangeTracker = (this._selectionStorageChangeTracker + 1) % Number.MAX_SAFE_INTEGER;\n\n if (args.changeType === \"replace\" || args.changeType === \"clear\") {\n this._cancelOngoingChanges.next();\n }\n this.syncHiliteSet(args);\n };\n\n private applyCurrentHiliteSet({ activeSelectionAction }: { activeSelectionAction: \"clearAll\" | \"clearHilited\" | \"keep\" }) {\n if (activeSelectionAction !== \"keep\") {\n using _dispose = this.suspendIModelToolSelectionSync();\n if (!is5xSelectionSet(this._imodelAccess.selectionSet)) {\n this._imodelAccess.hiliteSet.clear();\n }\n if (activeSelectionAction === \"clearAll\") {\n this._imodelAccess.selectionSet.emptyAll();\n }\n }\n\n from(this._imodelHiliteSetProvider.getCurrentHiliteSet({ imodelKey: this._imodelAccess.key }))\n .pipe(takeUntil(this._cancelOngoingChanges))\n .subscribe({\n next: (ids) => {\n this.addHiliteSet(ids);\n },\n });\n }\n\n private addHiliteSet(set: HiliteSet) {\n using _dispose = this.suspendIModelToolSelectionSync();\n if (is5xSelectionSet(this._imodelAccess.selectionSet)) {\n // with 5.x core we can simply add the set as a whole\n this._imodelAccess.selectionSet.add({\n models: set.models,\n subcategories: set.subCategories,\n elements: set.elements,\n });\n } else {\n // pre-5.0 core requires adding models and subcategories to hilite set separately\n if (set.models.length) {\n this._imodelAccess.hiliteSet.models.addIds(set.models);\n }\n if (set.subCategories.length) {\n this._imodelAccess.hiliteSet.subcategories.addIds(set.subCategories);\n }\n if (set.elements.length) {\n this._imodelAccess.hiliteSet.elements.addIds(set.elements);\n this._imodelAccess.selectionSet.add(set.elements);\n }\n }\n }\n\n private removeHiliteSet(set: HiliteSet) {\n using _dispose = this.suspendIModelToolSelectionSync();\n if (is5xSelectionSet(this._imodelAccess.selectionSet)) {\n // with 5.x core we can simply remove the set as a whole\n this._imodelAccess.selectionSet.remove({\n models: set.models,\n subcategories: set.subCategories,\n elements: set.elements,\n });\n } else {\n if (set.models.length) {\n this._imodelAccess.hiliteSet.models.deleteIds(set.models);\n }\n if (set.subCategories.length) {\n this._imodelAccess.hiliteSet.subcategories.deleteIds(set.subCategories);\n }\n if (set.elements.length) {\n this._imodelAccess.hiliteSet.elements.deleteIds(set.elements);\n this._imodelAccess.selectionSet.remove(set.elements);\n }\n }\n }\n\n private onIModelSelectionChanged = async (event: CoreSelectionSetEventUnsafe): Promise<void> => {\n if (this._isSuspended) {\n return;\n }\n\n if (CoreSelectionSetEventType.Clear === event.type) {\n this._selectionStorage.clearSelection({ imodelKey: this._imodelAccess.key, source: this._selectionSourceName });\n return;\n }\n\n const ids = getSelectionSetChangeIds(event);\n const scopedSelection = merge(\n ids.elements\n ? from(\n computeSelection({\n queryExecutor: this._imodelAccess,\n elementIds: ids.elements,\n scope: this._activeScopeProvider(),\n componentId: this.#componentId,\n }),\n )\n : /* c8 ignore next */ EMPTY,\n ids.models ? from(ids.models).pipe(map((id): SelectableInstanceKey => ({ className: \"BisCore.Model\", id }))) : /* c8 ignore next */ EMPTY,\n ids.subcategories\n ? from(ids.subcategories).pipe(map((id): SelectableInstanceKey => ({ className: \"BisCore.SubCategory\", id })))\n : /* c8 ignore next */ EMPTY,\n );\n\n const selectionStorageVersion = this._selectionStorageChangeTracker;\n const changeSelectionStorageProps = {\n imodelKey: this._imodelAccess.key,\n source: this._selectionSourceName,\n selectables: await firstValueFrom(scopedSelection.pipe(toArray())),\n };\n try {\n switch (event.type) {\n case CoreSelectionSetEventType.Add:\n return this._selectionStorage.addToSelection(changeSelectionStorageProps);\n case CoreSelectionSetEventType.Remove:\n return this._selectionStorage.removeFromSelection(changeSelectionStorageProps);\n case CoreSelectionSetEventType.Replace:\n return this._selectionStorage.replaceSelection(changeSelectionStorageProps);\n }\n } finally {\n if (this._selectionStorageChangeTracker === selectionStorageVersion) {\n // if the storage wasn't changed while we were processing the selection change, we have to re-sync the\n // hilite set (otherwise it's done by the selection storage change handler)\n this.syncHiliteSet({\n ...changeSelectionStorageProps,\n selectables: Selectables.create(changeSelectionStorageProps.selectables),\n changeType: getUnifiedSelectionChangeType(event.type),\n });\n }\n }\n };\n}\n\nfunction getSelectionSetChangeIds(\n event: Omit<CoreSelectionSetEventUnsafe, \"type\"> & {\n type: CoreSelectionSetEventType.Add | CoreSelectionSetEventType.Remove | CoreSelectionSetEventType.Replace;\n },\n): CoreSelectableIds {\n switch (event.type) {\n case CoreSelectionSetEventType.Add:\n return event.additions ?? (event.added ? { elements: event.added } : /* c8 ignore next */ {});\n case CoreSelectionSetEventType.Remove:\n return event.removals ?? (event.removed ? { elements: event.removed } : /* c8 ignore next */ {});\n case CoreSelectionSetEventType.Replace:\n return \"active\" in event.set ? event.set.active : { elements: event.set.elements };\n }\n}\n\nfunction getUnifiedSelectionChangeType(coreChangeType: CoreSelectionSetEventType): StorageSelectionChangeType {\n switch (coreChangeType) {\n case CoreSelectionSetEventType.Add:\n return \"add\";\n case CoreSelectionSetEventType.Remove:\n return \"remove\";\n case CoreSelectionSetEventType.Replace:\n return \"replace\";\n case CoreSelectionSetEventType.Clear:\n return \"clear\";\n }\n}\n\nfunction is5xSelectionSet(selectionSet: CoreIModelSelectionSet): selectionSet is Omit<CoreIModelSelectionSet, \"add\" | \"remove\"> & {\n readonly active: { [P in keyof CoreSelectableIds]-?: Id64Set };\n add: (ids: Id64Arg | CoreSelectableIds) => boolean;\n remove: (ids: Id64Arg | CoreSelectableIds) => boolean;\n} {\n return \"active\" in selectionSet;\n}\n\n/* c8 ignore start */\nfunction createIModelHiliteSetProviderFromCachingProvider(\n cachingHiliteSetProvider: NonNullable<EnableUnifiedSelectionSyncWithIModelProps[\"cachingHiliteSetProvider\"]>,\n hiliteSetProvider: HiliteSetProvider,\n): IModelHiliteSetProvider {\n return {\n getHiliteSetProvider: () => hiliteSetProvider,\n getCurrentHiliteSet: (props) => cachingHiliteSetProvider.getHiliteSet(props),\n [Symbol.dispose]: () => {},\n };\n}\n/* c8 ignore end */\n"]}
1
+ {"version":3,"file":"EnableUnifiedSelectionSyncWithIModel.js","sourceRoot":"","sources":["../../../src/unified-selection/EnableUnifiedSelectionSyncWithIModel.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiGhG,oFAGC;AAlGD,gCAA8B;AAE9B,+BAA4F;AAC5F,sDAAyE;AAGzE,iEAA+F;AAC/F,6EAAsG;AACtG,mDAAqE;AAErE,2DAAuE;AAEvE,iDAA2J;AAC3J,yCAAyC;AA6EzC;;;;GAIG;AACH,SAAgB,oCAAoC,CAAC,KAAgD;IACnG,MAAM,gBAAgB,GAAG,IAAI,sBAAsB,CAAC,KAAK,CAAC,CAAC;IAC3D,OAAO,GAAG,EAAE,CAAC,gBAAgB,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;AAClD,CAAC;AAED;;;;;GAKG;AACH,MAAa,sBAAsB;IACzB,oBAAoB,GAAG,MAAM,CAAC;IAE9B,aAAa,CAA4D;IACzE,iBAAiB,CAAmB;IACpC,wBAAwB,CAAoF;IAC5G,oBAAoB,CAAuB;IAE3C,YAAY,CAAU;IACtB,8BAA8B,GAAG,CAAC,CAAC;IACnC,qBAAqB,GAAG,IAAI,cAAO,EAAQ,CAAC;IAC5C,mCAAmC,CAAa;IAChD,qCAAqC,CAAa;IAClD,iCAAiC,CAAa;IAEtD,YAAY,CAAa;IAEzB,YAAmB,KAA4F;QAC7G,IAAI,CAAC,YAAY,GAAG,mBAAI,CAAC,WAAW,EAAE,CAAC;QACvC,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,YAAY,CAAC;QACxC,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC,gBAAgB,CAAC;QAChD,IAAI,CAAC,oBAAoB,GAAG,KAAK,CAAC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AAC,CAAC;QACnG,KAAK,qCAAyB,CAAC,OAAO;YACpC,OAAO,QAAQ,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IACvF,CAAC;AACH,CAAC;AAED,SAAS,6BAA6B,CAAC,cAAyC;IAC9E,QAAQ,cAAc,EAAE,CAAC;QACvB,KAAK,qCAAyB,CAAC,GAAG;YAChC,OAAO,KAAK,CAAC;QACf,KAAK,qCAAyB,CAAC,MAAM;YACnC,OAAO,QAAQ,CAAC;QAClB,KAAK,qCAAyB,CAAC,OAAO;YACpC,OAAO,SAAS,CAAC;QACnB,iCAAiC;QACjC,KAAK,qCAAyB,CAAC,KAAK;YAClC,OAAO,OAAO,CAAC;IACnB,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,YAAoC;IAK5D,OAAO,QAAQ,IAAI,YAAY,CAAC;AAClC,CAAC;AAED,qBAAqB;AACrB,SAAS,gDAAgD,CACvD,wBAA4G,EAC5G,iBAAoC;IAEpC,OAAO;QACL,oBAAoB,EAAE,GAAG,EAAE,CAAC,iBAAiB;QAC7C,mBAAmB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,wBAAwB,CAAC,YAAY,CAAC,KAAK,CAAC;QAC5E,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,GAAE,CAAC;KAC3B,CAAC;AACJ,CAAC;AACD,oBAAoB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport \"./DisposePolyfill.js\";\n\nimport { EMPTY, firstValueFrom, from, map, merge, Subject, takeUntil, toArray } from \"rxjs\";\nimport { Guid, GuidString, Id64Arg, Id64Set } from \"@itwin/core-bentley\";\nimport { ECClassHierarchyInspector, ECSqlQueryExecutor } from \"@itwin/presentation-shared\";\nimport { CachingHiliteSetProvider } from \"./CachingHiliteSetProvider.js\";\nimport { createHiliteSetProvider, HiliteSet, HiliteSetProvider } from \"./HiliteSetProvider.js\";\nimport { createIModelHiliteSetProvider, IModelHiliteSetProvider } from \"./IModelHiliteSetProvider.js\";\nimport { SelectableInstanceKey, Selectables } from \"./Selectable.js\";\nimport { StorageSelectionChangeEventArgs, StorageSelectionChangeType } from \"./SelectionChangeEvent.js\";\nimport { computeSelection, SelectionScope } from \"./SelectionScope.js\";\nimport { SelectionStorage } from \"./SelectionStorage.js\";\nimport { CoreIModelHiliteSet, CoreIModelSelectionSet, CoreSelectableIds, CoreSelectionSetEventType, CoreSelectionSetEventUnsafe } from \"./types/IModel.js\";\nimport { safeDispose } from \"./Utils.js\";\n\n/**\n * Props for `enableUnifiedSelectionSyncWithIModel`.\n * @public\n */\nexport interface EnableUnifiedSelectionSyncWithIModelProps {\n /**\n * Provides access to different iModel's features: query executing, class hierarchy, selection and hilite sets.\n *\n * It's recommended to use `@itwin/presentation-core-interop` to create `key`, `ECSqlQueryExecutor` and `ECSchemaProvider` from\n * [IModelConnection](https://www.itwinjs.org/reference/core-frontend/imodelconnection/imodelconnection/), and map its\n * `hilited` and `selectionSet` attributes like this:\n *\n * ```ts\n * import { createECSqlQueryExecutor, createECSchemaProvider, createIModelKey } from \"@itwin/presentation-core-interop\";\n * import { createCachingECClassHierarchyInspector } from \"@itwin/presentation-shared\";\n * import { IModelConnection } from \"@itwin/core-frontend\";\n *\n * const imodel: IModelConnection = ...\n * const imodelAccess = {\n * ...createECSqlQueryExecutor(imodel),\n * ...createCachingECClassHierarchyInspector({ schemaProvider: createECSchemaProvider(MyAppFrontend.getSchemaContext(imodel)) }),\n * key: createIModelKey(imodel),\n * hiliteSet: imodel.hilited,\n * selectionSet: imodel.selectionSet,\n * };\n * ```\n */\n imodelAccess: ECSqlQueryExecutor &\n ECClassHierarchyInspector & {\n /** Key of the iModel. Generally taken from `IModelConnection.key`. */\n readonly key: string;\n /** The set of currently hilited elements taken from `IModelConnection.hilited`. */\n readonly hiliteSet: CoreIModelHiliteSet;\n /** The set of currently selected elements taken from `IModelConnection.selectionSet`. */\n readonly selectionSet: CoreIModelSelectionSet;\n };\n\n /**\n * Unified selection storage to synchronize IModel's tool selection with. The storage should be shared\n * across all components in the application to ensure unified selection experience.\n */\n selectionStorage: SelectionStorage;\n\n /** Active selection scope provider. */\n activeScopeProvider: () => SelectionScope;\n\n /**\n * An iModel hilite set provider used to retrieve hilite sets for different iModels. If not provided, a new `IModelHiliteSetProvider`\n * will be created for the given iModel using the provided `imodelAccess`.\n * If the consuming application already has a `IModelHiliteSetProvider` defined, it should be provided instead\n * to reuse the cache and avoid creating new providers for each iModel.\n *\n * @see `createIModelHiliteSetProvider`\n */\n imodelHiliteSetProvider?: IModelHiliteSetProvider;\n\n /**\n * A caching hilite set provider used to retrieve hilite sets for an iModel. If not provided, a new `CachingHiliteSetProvider`\n * will be created for the given iModel using the provided `imodelAccess`.\n * If the consuming application already has a `CachingHiliteSetProvider` defined, it should be provided instead\n * to reuse the cache and avoid creating new providers for each iModel.\n *\n * The type is defined in a way that makes it required for provider to have either the deprecated `dispose` or the\n * new `Symbol.dispose` method.\n *\n * **Warning:** When the given `CachingHiliteSetProvider` internally uses a custom `HiliteSetProvider`, the synchronization has\n * no access to it, and thus uses its own, default, `HiliteSetProvider`. As a result, the synchronization may not work as expected.\n * To alleviate this, the `imodelHiliteSetProvider` prop should be used instead.\n *\n * @deprecated in 1.5. Use `imodelHiliteSetProvider` prop instead.\n */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n cachingHiliteSetProvider?: CachingHiliteSetProvider | (Omit<CachingHiliteSetProvider, \"dispose\"> & { [Symbol.dispose]: () => void });\n}\n\n/**\n * Enables synchronization between iModel selection and unified selection.\n * @returns function for disposing the synchronization.\n * @public\n */\nexport function enableUnifiedSelectionSyncWithIModel(props: EnableUnifiedSelectionSyncWithIModelProps): () => void {\n const selectionHandler = new IModelSelectionHandler(props);\n return () => selectionHandler[Symbol.dispose]();\n}\n\n/**\n * A handler that syncs selection between unified selection storage (`SelectionStorage`) and\n * an iModel (`iModel.selectionSet`, `iModel.hilited`).\n *\n * @internal\n */\nexport class IModelSelectionHandler {\n private _selectionSourceName = \"Tool\";\n\n private _imodelAccess: EnableUnifiedSelectionSyncWithIModelProps[\"imodelAccess\"];\n private _selectionStorage: SelectionStorage;\n private _imodelHiliteSetProvider: NonNullable<EnableUnifiedSelectionSyncWithIModelProps[\"imodelHiliteSetProvider\"]>;\n private _activeScopeProvider: () => SelectionScope;\n\n private _isSuspended: boolean;\n private _selectionStorageChangeTracker = 0;\n private _cancelOngoingChanges = new Subject<void>();\n private _unregisterUnifiedSelectionListener: () => void;\n private _unregisterIModelSelectionSetListener: () => void;\n private _disposeInternalHiliteSetProvider: () => void;\n\n #componentId: GuidString;\n\n public constructor(props: EnableUnifiedSelectionSyncWithIModelProps & { hiliteSetProvider?: HiliteSetProvider }) {\n this.#componentId = Guid.createValue();\n this._imodelAccess = props.imodelAccess;\n this._selectionStorage = props.selectionStorage;\n this._activeScopeProvider = props.activeScopeProvider;\n this._isSuspended = false;\n [this._imodelHiliteSetProvider, this._disposeInternalHiliteSetProvider] = (() => {\n if (props.imodelHiliteSetProvider) {\n return [props.imodelHiliteSetProvider, () => {}];\n }\n\n /* eslint-disable @typescript-eslint/no-deprecated */\n /* v8 ignore else -- @preserve */\n if (props.cachingHiliteSetProvider) {\n return [\n createIModelHiliteSetProviderFromCachingProvider(\n props.cachingHiliteSetProvider,\n props.hiliteSetProvider ?? createHiliteSetProvider({ imodelAccess: props.imodelAccess }),\n ),\n // don't need to dispose anything, because our wrapper has no dispose logic, and `cachingHiliteSetProvider` should be disposed\n // by whoever owns it\n () => {},\n ];\n }\n /* eslint-enable @typescript-eslint/no-deprecated */\n\n /* v8 ignore start */\n const internalProvider = createIModelHiliteSetProvider({\n selectionStorage: this._selectionStorage,\n imodelProvider: () => this._imodelAccess,\n createHiliteSetProvider: () => props.hiliteSetProvider ?? createHiliteSetProvider({ imodelAccess: props.imodelAccess }),\n });\n return [internalProvider, () => safeDispose(internalProvider)];\n /* v8 ignore stop */\n })();\n\n this._unregisterIModelSelectionSetListener = this._imodelAccess.selectionSet.onChanged.addListener(this.onIModelSelectionChanged);\n this._unregisterUnifiedSelectionListener = this._selectionStorage.selectionChangeEvent.addListener(this.onUnifiedSelectionChanged);\n\n if (!is5xSelectionSet(this._imodelAccess.selectionSet)) {\n // itwinjs-core@4: stop imodel from syncing tool selection with hilited list - we want to manage that sync ourselves\n this._imodelAccess.hiliteSet.wantSyncWithSelectionSet = false;\n }\n\n this.applyCurrentHiliteSet({ activeSelectionAction: \"clearAll\" });\n }\n\n public [Symbol.dispose]() {\n this._cancelOngoingChanges.next();\n this._unregisterIModelSelectionSetListener();\n this._unregisterUnifiedSelectionListener();\n this._disposeInternalHiliteSetProvider();\n }\n\n /** Temporarily suspends tool selection synchronization until the returned disposable object is disposed. */\n public suspendIModelToolSelectionSync() {\n const wasSuspended = this._isSuspended;\n this._isSuspended = true;\n return {\n [Symbol.dispose]: () => {\n this._isSuspended = wasSuspended;\n },\n };\n }\n\n private syncHiliteSet(props: { changeType: StorageSelectionChangeType; selectables: Selectables; source: string }): void {\n const { changeType, selectables, source } = props;\n switch (changeType) {\n case \"clear\":\n return this.applyCurrentHiliteSet({ activeSelectionAction: \"clearAll\" });\n case \"replace\":\n return this.applyCurrentHiliteSet({\n activeSelectionAction:\n source === this._selectionSourceName\n ? is5xSelectionSet(this._imodelAccess.selectionSet)\n ? // with 5x core we don't need to clear anything when event is triggered by a Tool (hilite and selection sets are in sync already)\n \"keep\"\n : // with 4x core we need to clear hilite set, because it's not synced with selection set\n \"clearHilited\"\n : // when event is triggered not by a Tool, we need to clear everything\n \"clearAll\",\n });\n case \"add\":\n return void from(this._imodelHiliteSetProvider.getHiliteSetProvider({ imodelKey: this._imodelAccess.key }).getHiliteSet({ selectables }))\n .pipe(takeUntil(this._cancelOngoingChanges))\n .subscribe({\n next: (set) => {\n this.addHiliteSet(set);\n },\n });\n case \"remove\":\n return void from(this._imodelHiliteSetProvider.getHiliteSetProvider({ imodelKey: this._imodelAccess.key }).getHiliteSet({ selectables }))\n .pipe(takeUntil(this._cancelOngoingChanges))\n .subscribe({\n next: (set) => {\n this.removeHiliteSet(set);\n },\n complete: () => {\n this.applyCurrentHiliteSet({ activeSelectionAction: \"keep\" });\n },\n });\n }\n }\n\n private onUnifiedSelectionChanged = (args: StorageSelectionChangeEventArgs) => {\n // iModels are only interested in top-level selection changes\n if (args.imodelKey !== this._imodelAccess.key || args.level !== 0) {\n return;\n }\n\n // update the selection storage change tracker so we know the selection storage changed\n this._selectionStorageChangeTracker = (this._selectionStorageChangeTracker + 1) % Number.MAX_SAFE_INTEGER;\n\n if (args.changeType === \"replace\" || args.changeType === \"clear\") {\n this._cancelOngoingChanges.next();\n }\n this.syncHiliteSet(args);\n };\n\n private applyCurrentHiliteSet({ activeSelectionAction }: { activeSelectionAction: \"clearAll\" | \"clearHilited\" | \"keep\" }) {\n if (activeSelectionAction !== \"keep\") {\n using _dispose = this.suspendIModelToolSelectionSync();\n if (!is5xSelectionSet(this._imodelAccess.selectionSet)) {\n this._imodelAccess.hiliteSet.clear();\n }\n if (activeSelectionAction === \"clearAll\") {\n this._imodelAccess.selectionSet.emptyAll();\n }\n }\n\n from(this._imodelHiliteSetProvider.getCurrentHiliteSet({ imodelKey: this._imodelAccess.key }))\n .pipe(takeUntil(this._cancelOngoingChanges))\n .subscribe({\n next: (ids) => {\n this.addHiliteSet(ids);\n },\n });\n }\n\n private addHiliteSet(set: HiliteSet) {\n using _dispose = this.suspendIModelToolSelectionSync();\n if (is5xSelectionSet(this._imodelAccess.selectionSet)) {\n // with 5.x core we can simply add the set as a whole\n this._imodelAccess.selectionSet.add({\n models: set.models,\n subcategories: set.subCategories,\n elements: set.elements,\n });\n } else {\n // pre-5.0 core requires adding models and subcategories to hilite set separately\n /* v8 ignore else -- @preserve */\n if (set.models.length) {\n this._imodelAccess.hiliteSet.models.addIds(set.models);\n }\n /* v8 ignore else -- @preserve */\n if (set.subCategories.length) {\n this._imodelAccess.hiliteSet.subcategories.addIds(set.subCategories);\n }\n /* v8 ignore else -- @preserve */\n if (set.elements.length) {\n this._imodelAccess.hiliteSet.elements.addIds(set.elements);\n this._imodelAccess.selectionSet.add(set.elements);\n }\n }\n }\n\n private removeHiliteSet(set: HiliteSet) {\n using _dispose = this.suspendIModelToolSelectionSync();\n if (is5xSelectionSet(this._imodelAccess.selectionSet)) {\n // with 5.x core we can simply remove the set as a whole\n this._imodelAccess.selectionSet.remove({\n models: set.models,\n subcategories: set.subCategories,\n elements: set.elements,\n });\n } else {\n /* v8 ignore else -- @preserve */\n if (set.models.length) {\n this._imodelAccess.hiliteSet.models.deleteIds(set.models);\n }\n /* v8 ignore else -- @preserve */\n if (set.subCategories.length) {\n this._imodelAccess.hiliteSet.subcategories.deleteIds(set.subCategories);\n }\n /* v8 ignore else -- @preserve */\n if (set.elements.length) {\n this._imodelAccess.hiliteSet.elements.deleteIds(set.elements);\n this._imodelAccess.selectionSet.remove(set.elements);\n }\n }\n }\n\n private onIModelSelectionChanged = async (event: CoreSelectionSetEventUnsafe): Promise<void> => {\n if (this._isSuspended) {\n return;\n }\n\n if (CoreSelectionSetEventType.Clear === event.type) {\n this._selectionStorage.clearSelection({ imodelKey: this._imodelAccess.key, source: this._selectionSourceName });\n return;\n }\n\n const ids = getSelectionSetChangeIds(event);\n const scopedSelection = merge(\n ids.elements\n ? from(\n computeSelection({\n queryExecutor: this._imodelAccess,\n elementIds: ids.elements,\n scope: this._activeScopeProvider(),\n componentId: this.#componentId,\n }),\n )\n : /* v8 ignore next */ EMPTY,\n ids.models ? from(ids.models).pipe(map((id): SelectableInstanceKey => ({ className: \"BisCore.Model\", id }))) : /* v8 ignore next */ EMPTY,\n ids.subcategories\n ? from(ids.subcategories).pipe(map((id): SelectableInstanceKey => ({ className: \"BisCore.SubCategory\", id })))\n : /* v8 ignore next */ EMPTY,\n );\n\n const selectionStorageVersion = this._selectionStorageChangeTracker;\n const changeSelectionStorageProps = {\n imodelKey: this._imodelAccess.key,\n source: this._selectionSourceName,\n selectables: await firstValueFrom(scopedSelection.pipe(toArray())),\n };\n try {\n switch (event.type) {\n case CoreSelectionSetEventType.Add:\n return this._selectionStorage.addToSelection(changeSelectionStorageProps);\n case CoreSelectionSetEventType.Remove:\n return this._selectionStorage.removeFromSelection(changeSelectionStorageProps);\n case CoreSelectionSetEventType.Replace:\n return this._selectionStorage.replaceSelection(changeSelectionStorageProps);\n }\n } finally {\n if (this._selectionStorageChangeTracker === selectionStorageVersion) {\n // if the storage wasn't changed while we were processing the selection change, we have to re-sync the\n // hilite set (otherwise it's done by the selection storage change handler)\n this.syncHiliteSet({\n ...changeSelectionStorageProps,\n selectables: Selectables.create(changeSelectionStorageProps.selectables),\n changeType: getUnifiedSelectionChangeType(event.type),\n });\n }\n }\n };\n}\n\nfunction getSelectionSetChangeIds(\n event: Omit<CoreSelectionSetEventUnsafe, \"type\"> & {\n type: CoreSelectionSetEventType.Add | CoreSelectionSetEventType.Remove | CoreSelectionSetEventType.Replace;\n },\n): CoreSelectableIds {\n switch (event.type) {\n case CoreSelectionSetEventType.Add:\n return event.additions ?? (event.added ? { elements: event.added } : /* v8 ignore next */ {});\n case CoreSelectionSetEventType.Remove:\n return event.removals ?? (event.removed ? { elements: event.removed } : /* v8 ignore next */ {});\n case CoreSelectionSetEventType.Replace:\n return \"active\" in event.set ? event.set.active : { elements: event.set.elements };\n }\n}\n\nfunction getUnifiedSelectionChangeType(coreChangeType: CoreSelectionSetEventType): StorageSelectionChangeType {\n switch (coreChangeType) {\n case CoreSelectionSetEventType.Add:\n return \"add\";\n case CoreSelectionSetEventType.Remove:\n return \"remove\";\n case CoreSelectionSetEventType.Replace:\n return \"replace\";\n /* v8 ignore next -- @preserve */\n case CoreSelectionSetEventType.Clear:\n return \"clear\";\n }\n}\n\nfunction is5xSelectionSet(selectionSet: CoreIModelSelectionSet): selectionSet is Omit<CoreIModelSelectionSet, \"add\" | \"remove\"> & {\n readonly active: { [P in keyof CoreSelectableIds]-?: Id64Set };\n add: (ids: Id64Arg | CoreSelectableIds) => boolean;\n remove: (ids: Id64Arg | CoreSelectableIds) => boolean;\n} {\n return \"active\" in selectionSet;\n}\n\n/* v8 ignore start */\nfunction createIModelHiliteSetProviderFromCachingProvider(\n cachingHiliteSetProvider: NonNullable<EnableUnifiedSelectionSyncWithIModelProps[\"cachingHiliteSetProvider\"]>,\n hiliteSetProvider: HiliteSetProvider,\n): IModelHiliteSetProvider {\n return {\n getHiliteSetProvider: () => hiliteSetProvider,\n getCurrentHiliteSet: (props) => cachingHiliteSetProvider.getHiliteSet(props),\n [Symbol.dispose]: () => {},\n };\n}\n/* v8 ignore stop */\n"]}
@@ -1,6 +1,6 @@
1
- import type { Id64String } from "@itwin/core-bentley";
2
- import type { ECClassHierarchyInspector, ECSqlQueryExecutor } from "@itwin/presentation-shared";
3
- import type { Selectables } from "./Selectable.js";
1
+ import { Id64String } from "@itwin/core-bentley";
2
+ import { ECClassHierarchyInspector, ECSqlQueryExecutor } from "@itwin/presentation-shared";
3
+ import { Selectables } from "./Selectable.js";
4
4
  /**
5
5
  * A set of model, subcategory and element ids that can be used for specifying hilite.
6
6
  *
@@ -1 +1 @@
1
- {"version":3,"file":"HiliteSetProvider.d.ts","sourceRoot":"","sources":["../../../src/unified-selection/HiliteSetProvider.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAc,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,KAAK,EAEV,yBAAyB,EAGzB,kBAAkB,EAGnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAyB,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAI1E;;;;;;;;;;GAUG;AACH,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,aAAa,EAAE,UAAU,EAAE,CAAC;IAC5B,QAAQ,EAAE,UAAU,EAAE,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,kGAAkG;IAClG,YAAY,EAAE,yBAAyB,GAAG,kBAAkB,CAAC;CAC9D;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB;IAChC,mEAAmE;IACnE,YAAY,CAAC,KAAK,EAAE;QAAE,WAAW,EAAE,WAAW,CAAA;KAAE,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAAC;CACrF;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,sBAAsB,GAAG,iBAAiB,CAExF"}
1
+ {"version":3,"file":"HiliteSetProvider.d.ts","sourceRoot":"","sources":["../../../src/unified-selection/HiliteSetProvider.ts"],"names":[],"mappings":"AAOA,OAAO,EAAoB,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EACL,yBAAyB,EAGzB,kBAAkB,EAInB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAyB,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAKrE;;;;;;;;;;GAUG;AACH,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,aAAa,EAAE,UAAU,EAAE,CAAC;IAC5B,QAAQ,EAAE,UAAU,EAAE,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,kGAAkG;IAClG,YAAY,EAAE,yBAAyB,GAAG,kBAAkB,CAAC;CAC9D;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB;IAChC,mEAAmE;IACnE,YAAY,CAAC,KAAK,EAAE;QAAE,WAAW,EAAE,WAAW,CAAA;KAAE,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAAC;CACrF;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,sBAAsB,GAAG,iBAAiB,CAExF"}