@itwin/unified-selection 1.8.6 → 2.0.0-alpha.1

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 (125) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +1 -1
  3. package/lib/{cjs/unified-selection → unified-selection}/CachingHiliteSetProvider.d.ts +4 -4
  4. package/lib/unified-selection/CachingHiliteSetProvider.d.ts.map +1 -0
  5. package/lib/unified-selection/CachingHiliteSetProvider.js.map +1 -0
  6. package/lib/unified-selection/DisposePolyfill.d.ts.map +1 -0
  7. package/lib/unified-selection/DisposePolyfill.js.map +1 -0
  8. package/lib/{cjs/unified-selection → unified-selection}/EnableUnifiedSelectionSyncWithIModel.d.ts +9 -10
  9. package/lib/unified-selection/EnableUnifiedSelectionSyncWithIModel.d.ts.map +1 -0
  10. package/lib/{esm/unified-selection → unified-selection}/EnableUnifiedSelectionSyncWithIModel.js +1 -1
  11. package/lib/unified-selection/EnableUnifiedSelectionSyncWithIModel.js.map +1 -0
  12. package/lib/{cjs/unified-selection → unified-selection}/HiliteSetProvider.d.ts +4 -4
  13. package/lib/unified-selection/HiliteSetProvider.d.ts.map +1 -0
  14. package/lib/{esm/unified-selection → unified-selection}/HiliteSetProvider.js +2 -2
  15. package/lib/unified-selection/HiliteSetProvider.js.map +1 -0
  16. package/lib/{esm/unified-selection → unified-selection}/IModelHiliteSetProvider.d.ts +5 -4
  17. package/lib/unified-selection/IModelHiliteSetProvider.d.ts.map +1 -0
  18. package/lib/unified-selection/IModelHiliteSetProvider.js.map +1 -0
  19. package/lib/{esm/unified-selection → unified-selection}/Selectable.d.ts +1 -1
  20. package/lib/unified-selection/Selectable.d.ts.map +1 -0
  21. package/lib/unified-selection/Selectable.js.map +1 -0
  22. package/lib/{cjs/unified-selection → unified-selection}/SelectionChangeEvent.d.ts +2 -2
  23. package/lib/unified-selection/SelectionChangeEvent.d.ts.map +1 -0
  24. package/lib/unified-selection/SelectionChangeEvent.js.map +1 -0
  25. package/lib/{cjs/unified-selection → unified-selection}/SelectionScope.d.ts +3 -3
  26. package/lib/unified-selection/SelectionScope.d.ts.map +1 -0
  27. package/lib/unified-selection/SelectionScope.js.map +1 -0
  28. package/lib/{esm/unified-selection → unified-selection}/SelectionStorage.d.ts +4 -3
  29. package/lib/unified-selection/SelectionStorage.d.ts.map +1 -0
  30. package/lib/unified-selection/SelectionStorage.js.map +1 -0
  31. package/lib/{esm/unified-selection → unified-selection}/Utils.d.ts +3 -3
  32. package/lib/unified-selection/Utils.d.ts.map +1 -0
  33. package/lib/{esm/unified-selection → unified-selection}/Utils.js +1 -1
  34. package/lib/unified-selection/Utils.js.map +1 -0
  35. package/lib/{esm/unified-selection → unified-selection}/types/IModel.d.ts +2 -2
  36. package/lib/unified-selection/types/IModel.d.ts.map +1 -0
  37. package/lib/unified-selection/types/IModel.js.map +1 -0
  38. package/lib/unified-selection.d.ts +16 -0
  39. package/lib/unified-selection.d.ts.map +1 -0
  40. package/lib/{esm/unified-selection.js → unified-selection.js} +2 -3
  41. package/lib/unified-selection.js.map +1 -0
  42. package/package.json +9 -12
  43. package/lib/cjs/package.json +0 -1
  44. package/lib/cjs/unified-selection/CachingHiliteSetProvider.d.ts.map +0 -1
  45. package/lib/cjs/unified-selection/CachingHiliteSetProvider.js +0 -27
  46. package/lib/cjs/unified-selection/CachingHiliteSetProvider.js.map +0 -1
  47. package/lib/cjs/unified-selection/DisposePolyfill.d.ts +0 -1
  48. package/lib/cjs/unified-selection/DisposePolyfill.d.ts.map +0 -1
  49. package/lib/cjs/unified-selection/DisposePolyfill.js +0 -11
  50. package/lib/cjs/unified-selection/DisposePolyfill.js.map +0 -1
  51. package/lib/cjs/unified-selection/EnableUnifiedSelectionSyncWithIModel.d.ts.map +0 -1
  52. package/lib/cjs/unified-selection/EnableUnifiedSelectionSyncWithIModel.js +0 -392
  53. package/lib/cjs/unified-selection/EnableUnifiedSelectionSyncWithIModel.js.map +0 -1
  54. package/lib/cjs/unified-selection/HiliteSetProvider.d.ts.map +0 -1
  55. package/lib/cjs/unified-selection/HiliteSetProvider.js +0 -382
  56. package/lib/cjs/unified-selection/HiliteSetProvider.js.map +0 -1
  57. package/lib/cjs/unified-selection/IModelHiliteSetProvider.d.ts +0 -51
  58. package/lib/cjs/unified-selection/IModelHiliteSetProvider.d.ts.map +0 -1
  59. package/lib/cjs/unified-selection/IModelHiliteSetProvider.js +0 -66
  60. package/lib/cjs/unified-selection/IModelHiliteSetProvider.js.map +0 -1
  61. package/lib/cjs/unified-selection/Selectable.d.ts +0 -150
  62. package/lib/cjs/unified-selection/Selectable.d.ts.map +0 -1
  63. package/lib/cjs/unified-selection/Selectable.js +0 -238
  64. package/lib/cjs/unified-selection/Selectable.js.map +0 -1
  65. package/lib/cjs/unified-selection/SelectionChangeEvent.d.ts.map +0 -1
  66. package/lib/cjs/unified-selection/SelectionChangeEvent.js +0 -7
  67. package/lib/cjs/unified-selection/SelectionChangeEvent.js.map +0 -1
  68. package/lib/cjs/unified-selection/SelectionScope.d.ts.map +0 -1
  69. package/lib/cjs/unified-selection/SelectionScope.js +0 -252
  70. package/lib/cjs/unified-selection/SelectionScope.js.map +0 -1
  71. package/lib/cjs/unified-selection/SelectionStorage.d.ts +0 -105
  72. package/lib/cjs/unified-selection/SelectionStorage.d.ts.map +0 -1
  73. package/lib/cjs/unified-selection/SelectionStorage.js +0 -153
  74. package/lib/cjs/unified-selection/SelectionStorage.js.map +0 -1
  75. package/lib/cjs/unified-selection/Utils.d.ts +0 -39
  76. package/lib/cjs/unified-selection/Utils.d.ts.map +0 -1
  77. package/lib/cjs/unified-selection/Utils.js +0 -82
  78. package/lib/cjs/unified-selection/Utils.js.map +0 -1
  79. package/lib/cjs/unified-selection/types/IModel.d.ts +0 -133
  80. package/lib/cjs/unified-selection/types/IModel.d.ts.map +0 -1
  81. package/lib/cjs/unified-selection/types/IModel.js +0 -24
  82. package/lib/cjs/unified-selection/types/IModel.js.map +0 -1
  83. package/lib/cjs/unified-selection.d.ts +0 -10
  84. package/lib/cjs/unified-selection.d.ts.map +0 -1
  85. package/lib/cjs/unified-selection.js +0 -27
  86. package/lib/cjs/unified-selection.js.map +0 -1
  87. package/lib/esm/unified-selection/CachingHiliteSetProvider.d.ts +0 -56
  88. package/lib/esm/unified-selection/CachingHiliteSetProvider.d.ts.map +0 -1
  89. package/lib/esm/unified-selection/CachingHiliteSetProvider.js.map +0 -1
  90. package/lib/esm/unified-selection/DisposePolyfill.d.ts.map +0 -1
  91. package/lib/esm/unified-selection/DisposePolyfill.js.map +0 -1
  92. package/lib/esm/unified-selection/EnableUnifiedSelectionSyncWithIModel.d.ts +0 -119
  93. package/lib/esm/unified-selection/EnableUnifiedSelectionSyncWithIModel.d.ts.map +0 -1
  94. package/lib/esm/unified-selection/EnableUnifiedSelectionSyncWithIModel.js.map +0 -1
  95. package/lib/esm/unified-selection/HiliteSetProvider.d.ts +0 -48
  96. package/lib/esm/unified-selection/HiliteSetProvider.d.ts.map +0 -1
  97. package/lib/esm/unified-selection/HiliteSetProvider.js.map +0 -1
  98. package/lib/esm/unified-selection/IModelHiliteSetProvider.d.ts.map +0 -1
  99. package/lib/esm/unified-selection/IModelHiliteSetProvider.js.map +0 -1
  100. package/lib/esm/unified-selection/Selectable.d.ts.map +0 -1
  101. package/lib/esm/unified-selection/Selectable.js.map +0 -1
  102. package/lib/esm/unified-selection/SelectionChangeEvent.d.ts +0 -60
  103. package/lib/esm/unified-selection/SelectionChangeEvent.d.ts.map +0 -1
  104. package/lib/esm/unified-selection/SelectionChangeEvent.js.map +0 -1
  105. package/lib/esm/unified-selection/SelectionScope.d.ts +0 -54
  106. package/lib/esm/unified-selection/SelectionScope.d.ts.map +0 -1
  107. package/lib/esm/unified-selection/SelectionScope.js.map +0 -1
  108. package/lib/esm/unified-selection/SelectionStorage.d.ts.map +0 -1
  109. package/lib/esm/unified-selection/SelectionStorage.js.map +0 -1
  110. package/lib/esm/unified-selection/Utils.d.ts.map +0 -1
  111. package/lib/esm/unified-selection/Utils.js.map +0 -1
  112. package/lib/esm/unified-selection/types/IModel.d.ts.map +0 -1
  113. package/lib/esm/unified-selection/types/IModel.js.map +0 -1
  114. package/lib/esm/unified-selection.d.ts +0 -10
  115. package/lib/esm/unified-selection.d.ts.map +0 -1
  116. package/lib/esm/unified-selection.js.map +0 -1
  117. /package/lib/{esm/unified-selection → unified-selection}/CachingHiliteSetProvider.js +0 -0
  118. /package/lib/{esm/unified-selection → unified-selection}/DisposePolyfill.d.ts +0 -0
  119. /package/lib/{esm/unified-selection → unified-selection}/DisposePolyfill.js +0 -0
  120. /package/lib/{esm/unified-selection → unified-selection}/IModelHiliteSetProvider.js +0 -0
  121. /package/lib/{esm/unified-selection → unified-selection}/Selectable.js +0 -0
  122. /package/lib/{esm/unified-selection → unified-selection}/SelectionChangeEvent.js +0 -0
  123. /package/lib/{esm/unified-selection → unified-selection}/SelectionScope.js +0 -0
  124. /package/lib/{esm/unified-selection → unified-selection}/SelectionStorage.js +0 -0
  125. /package/lib/{esm/unified-selection → unified-selection}/types/IModel.js +0 -0
@@ -1,82 +0,0 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.formIdBindings = formIdBindings;
8
- exports.genericExecuteQuery = genericExecuteQuery;
9
- exports.releaseMainThreadOnItemsCount = releaseMainThreadOnItemsCount;
10
- exports.safeDispose = safeDispose;
11
- require("./DisposePolyfill.js");
12
- const rxjs_1 = require("rxjs");
13
- const core_bentley_1 = require("@itwin/core-bentley");
14
- const presentation_shared_1 = require("@itwin/presentation-shared");
15
- /**
16
- * Forms ECSql bindings from given ID's.
17
- * @internal
18
- */
19
- function formIdBindings(property, ids, bindings) {
20
- const count = core_bentley_1.Id64.sizeOf(ids);
21
- if (count > 1000) {
22
- bindings.push({ type: "idset", value: ids instanceof Set ? [...ids] : ids });
23
- return `InVirtualSet(?, ${property})`;
24
- }
25
- if (count === 0) {
26
- return `FALSE`;
27
- }
28
- let bindingsClause = "";
29
- ids.forEach((id) => {
30
- bindings.push({ type: "id", value: id });
31
- if (bindingsClause.length > 0) {
32
- bindingsClause += ",";
33
- }
34
- bindingsClause += "?";
35
- });
36
- return `${property} IN (${bindingsClause})`;
37
- }
38
- /**
39
- * Executes given ECSql query and extracts data from rows. Additionally handles main thread releasing.
40
- * @internal
41
- */
42
- async function* genericExecuteQuery({ queryExecutor, parseQueryRow, query, config, }) {
43
- const releaseMainThread = (0, presentation_shared_1.createMainThreadReleaseOnTimePassedHandler)();
44
- const reader = queryExecutor.createQueryReader(query, config);
45
- for await (const row of reader) {
46
- yield parseQueryRow(row);
47
- await releaseMainThread();
48
- }
49
- }
50
- /**
51
- * Emits a certain amount of values, then releases the main thread for other timers to use.
52
- * @internal
53
- */
54
- function releaseMainThreadOnItemsCount(elementCount) {
55
- return (obs) => {
56
- return obs.pipe((0, rxjs_1.bufferCount)(elementCount), (0, rxjs_1.concatMap)((buff, i) => {
57
- const out = (0, rxjs_1.of)(buff);
58
- if (i === 0 && buff.length < elementCount) {
59
- return out;
60
- }
61
- return out.pipe((0, rxjs_1.delay)(0));
62
- }), (0, rxjs_1.concatAll)());
63
- };
64
- }
65
- /**
66
- * A helper that disposes the given object, if it's disposable.
67
- *
68
- * The first option is to dispose using the deprecated `dispose` method if it exists on the object.
69
- * If not, we use the new `Symbol.dispose` method. If that doesn't exist either, the object is
70
- * considered as non-disposable and nothing is done with it.
71
- *
72
- * @internal
73
- */
74
- function safeDispose(disposable) {
75
- if ("dispose" in disposable) {
76
- disposable.dispose();
77
- }
78
- else if (Symbol.dispose in disposable) {
79
- disposable[Symbol.dispose]();
80
- }
81
- }
82
- //# sourceMappingURL=Utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../src/unified-selection/Utils.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E,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QAC/B,MAAM,aAAa,CAAC,GAAG,CAAC,CAAC;QACzB,MAAM,iBAAiB,EAAE,CAAC;IAC5B,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,uCAAiD,YAAoB;IACnE,OAAO,CAAC,GAAkB,EAAiB,EAAE;QAC3C,OAAO,GAAG,CAAC,IAAI,CACb,IAAA,kBAAW,EAAC,YAAY,CAAC,EACzB,IAAA,gBAAS,EAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;YACpB,MAAM,GAAG,GAAG,IAAA,SAAE,EAAC,IAAI,CAAC,CAAC;YACrB,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,MAAM,GAAG,YAAY,EAAE,CAAC;gBAC1C,OAAO,GAAG,CAAC;YACb,CAAC;YACD,OAAO,GAAG,CAAC,IAAI,CAAC,IAAA,YAAK,EAAC,CAAC,CAAC,CAAC,CAAC;QAC5B,CAAC,CAAC,EACF,IAAA,gBAAS,GAAE,CACZ,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,qBAA4B,UAA2E;IACrG,IAAI,SAAS,IAAI,UAAU,EAAE,CAAC;QAC5B,UAAU,CAAC,OAAO,EAAE,CAAC;IACvB,CAAC;SAAM,IAAI,MAAM,CAAC,OAAO,IAAI,UAAU,EAAE,CAAC;QACxC,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;IAC/B,CAAC;AACH,CAAC","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 { bufferCount, concatAll, concatMap, delay, Observable, of } from \"rxjs\";\nimport { Id64, Id64Array, Id64Set } from \"@itwin/core-bentley\";\nimport {\n createMainThreadReleaseOnTimePassedHandler,\n ECSqlBinding,\n ECSqlQueryDef,\n ECSqlQueryExecutor,\n ECSqlQueryReaderOptions,\n ECSqlQueryRow,\n} from \"@itwin/presentation-shared\";\n\n/**\n * Forms ECSql bindings from given ID's.\n * @internal\n */\nexport function formIdBindings(property: string, ids: Id64Array | Id64Set, bindings: ECSqlBinding[]): string {\n const count = Id64.sizeOf(ids);\n if (count > 1000) {\n bindings.push({ type: \"idset\", value: ids instanceof Set ? [...ids] : ids });\n return `InVirtualSet(?, ${property})`;\n }\n\n if (count === 0) {\n return `FALSE`;\n }\n\n let bindingsClause = \"\";\n ids.forEach((id) => {\n bindings.push({ type: \"id\", value: id });\n if (bindingsClause.length > 0) {\n bindingsClause += \",\";\n }\n bindingsClause += \"?\";\n });\n return `${property} IN (${bindingsClause})`;\n}\n\n/**\n * Executes given ECSql query and extracts data from rows. Additionally handles main thread releasing.\n * @internal\n */\nexport async function* genericExecuteQuery<T>({\n queryExecutor,\n parseQueryRow,\n query,\n config,\n}: {\n queryExecutor: ECSqlQueryExecutor;\n query: ECSqlQueryDef;\n parseQueryRow: (row: ECSqlQueryRow) => T;\n config?: ECSqlQueryReaderOptions;\n}): AsyncIterableIterator<T> {\n const releaseMainThread = createMainThreadReleaseOnTimePassedHandler();\n const reader = queryExecutor.createQueryReader(query, config);\n for await (const row of reader) {\n yield parseQueryRow(row);\n await releaseMainThread();\n }\n}\n\n/**\n * Emits a certain amount of values, then releases the main thread for other timers to use.\n * @internal\n */\nexport function releaseMainThreadOnItemsCount<T>(elementCount: number) {\n return (obs: Observable<T>): Observable<T> => {\n return obs.pipe(\n bufferCount(elementCount),\n concatMap((buff, i) => {\n const out = of(buff);\n if (i === 0 && buff.length < elementCount) {\n return out;\n }\n return out.pipe(delay(0));\n }),\n concatAll(),\n );\n };\n}\n\n/**\n * A helper that disposes the given object, if it's disposable.\n *\n * The first option is to dispose using the deprecated `dispose` method if it exists on the object.\n * If not, we use the new `Symbol.dispose` method. If that doesn't exist either, the object is\n * considered as non-disposable and nothing is done with it.\n *\n * @internal\n */\nexport function safeDispose(disposable: {} | { [Symbol.dispose]: () => void } | { dispose: () => void }) {\n if (\"dispose\" in disposable) {\n disposable.dispose();\n } else if (Symbol.dispose in disposable) {\n disposable[Symbol.dispose]();\n }\n}\n"]}
@@ -1,133 +0,0 @@
1
- import { Id64Arg, Id64Set } from "@itwin/core-bentley";
2
- import { Event } from "@itwin/presentation-shared";
3
- /**
4
- * A collection of geometric element, model and subcategory ids that can be added to
5
- * a [[SelectionSet]] or [[HiliteSet]].
6
- *
7
- * **Warning:** This type was added to `@itwin/core-frontend` in 5.0.
8
- *
9
- * @see https://www.itwinjs.org/reference/core-frontend/selectionset/selectableids/
10
- * @public
11
- */
12
- export interface CoreSelectableIds {
13
- elements?: Id64Arg;
14
- models?: Id64Arg;
15
- subcategories?: Id64Arg;
16
- }
17
- /**
18
- * Identifies the type of changes made to the `CoreIModelSelectionSet` to produce a `CoreSelectionSetEvent`.
19
- * @see https://www.itwinjs.org/reference/core-frontend/selectionset/selectionseteventtype/
20
- * @internal
21
- */
22
- export declare enum CoreSelectionSetEventType {
23
- /** Elements have been added to the set. */
24
- Add = 0,
25
- /** Elements have been removed from the set. */
26
- Remove = 1,
27
- /** Some elements have been added to the set and others have been removed. */
28
- Replace = 2,
29
- /** All elements are about to be removed from the set. */
30
- Clear = 3
31
- }
32
- /**
33
- * Payload sent to `CoreIModelSelectionSet.onChanged` event listeners to describe how the contents of the set have changed.
34
- * @see https://www.itwinjs.org/reference/core-frontend/selectionset/selectionsetevent/
35
- * @public
36
- */
37
- export interface CoreSelectionSetEventUnsafe {
38
- /**
39
- * The type of operation that produced this event.
40
- *
41
- * Actually, this should be `CoreSelectionSetEventType`, however we can't use it here because in TS two identical enums with
42
- * different names aren't equal, so [`SelectionSetEventType `](https://www.itwinjs.org/reference/core-frontend/selectionset/selectionseteventtype/)
43
- * doesn't map to `CoreSelectionSetEventType` as far as TS is concerned. Due to this reason, this interface is marked as `unsafe`.
44
- */
45
- type: number;
46
- /** The element Ids added to the set. */
47
- added?: Id64Arg;
48
- /**
49
- * A collection of geometric element, model and subcategory ids that have been removed from selection set.
50
- *
51
- * **Warning:** This property was added to `@itwin/core-frontend` in 5.0.
52
- */
53
- additions?: CoreSelectableIds;
54
- /** The element Ids removed from the set. */
55
- removed?: Id64Arg;
56
- /**
57
- * A collection of geometric element, model and subcategory ids that have been added to selection set.
58
- *
59
- * **Warning:** This property was added to `@itwin/core-frontend` in 5.0.
60
- */
61
- removals?: CoreSelectableIds;
62
- /** The affected `CoreIModelSelectionSet`. */
63
- set: CoreIModelSelectionSet;
64
- }
65
- /**
66
- * A set of *currently selected* elements in an iModel.
67
- * @see https://www.itwinjs.org/reference/core-frontend/selectionset/
68
- * @public
69
- */
70
- export type CoreIModelSelectionSet = {
71
- /** Event called whenever elements are added or removed from this SelectionSet. */
72
- onChanged: Event<(ev: CoreSelectionSetEventUnsafe) => void>;
73
- /** The IDs of the selected elements. */
74
- readonly elements: Set<string>;
75
- /** Clear current selection set. */
76
- emptyAll(): void;
77
- } & ({
78
- /** Add one or more Ids to the current selection set. */
79
- add(elem: Id64Arg): boolean;
80
- /** Remove one or more Ids from the current selection set. */
81
- remove(elem: Id64Arg): boolean;
82
- } | {
83
- /**
84
- * Get the active selection as a collection of geometric element, model and subcategory ids.
85
- */
86
- readonly active: {
87
- [P in keyof CoreSelectableIds]-?: Id64Set;
88
- };
89
- /**
90
- * Adds a collection of geometric element, model and subcategory ids to this selection set.
91
- *
92
- * The overload was added only in 5.0 `@itwin/core-frontend`. The `active` property can be used
93
- * to check if this `overload` is available.
94
- */
95
- add: (ids: Id64Arg | CoreSelectableIds) => boolean;
96
- /**
97
- * Adds a collection of geometric element, model and subcategory ids to this selection set.
98
- *
99
- * The overload was added only in 5.0 `@itwin/core-frontend`. The `active` property can be used
100
- * to check if this `overload` is available.
101
- */
102
- remove: (ids: Id64Arg | CoreSelectableIds) => boolean;
103
- });
104
- /**
105
- * A set if ID's optimized for performance-critical code which represents large sets of ID's as pairs of 32-bit integers.
106
- * @see https://www.itwinjs.org/reference/core-bentley/ids/id64/id64.uint32set/
107
- * @public
108
- */
109
- interface Uint32Set {
110
- /** Add any number of Ids to the set. */
111
- addIds(ids: Id64Arg): void;
112
- /** Remove any number of Ids from the set. */
113
- deleteIds(ids: Id64Arg): void;
114
- }
115
- /**
116
- * A set of *hilited* elements in an iModel, by element id.
117
- * @see https://www.itwinjs.org/reference/core-frontend/selectionset/hiliteset/
118
- * @public
119
- */
120
- export interface CoreIModelHiliteSet {
121
- /** Control whether the hilited elements should be synchronized with the contents of `CoreIModelSelectionSet`.*/
122
- wantSyncWithSelectionSet: boolean;
123
- /** The set of hilited elements. */
124
- readonly elements: Uint32Set;
125
- /** The set of hilited subcategories. */
126
- readonly subcategories: Uint32Set;
127
- /** The set of hilited models. */
128
- readonly models: Uint32Set;
129
- /** Remove all elements from the hilited set. */
130
- clear(): void;
131
- }
132
- export {};
133
- //# sourceMappingURL=IModel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IModel.d.ts","sourceRoot":"","sources":["../../../../src/unified-selection/types/IModel.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAEnD;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;;GAIG;AACH,oBAAY,yBAAyB;IACnC,2CAA2C;IAC3C,GAAG,IAAA;IACH,+CAA+C;IAC/C,MAAM,IAAA;IACN,6EAA6E;IAC7E,OAAO,IAAA;IACP,yDAAyD;IACzD,KAAK,IAAA;CACN;AAED;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;;;;;OAMG;IACH,IAAI,EAAE,MAAM,CAAC;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C,gHAAgH;IAChH,wBAAwB,EAAE,OAAO,CAAC;IAClC,mCAAmC;IACnC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC7B,wCAAwC;IACxC,QAAQ,CAAC,aAAa,EAAE,SAAS,CAAC;IAClC,iCAAiC;IACjC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,gDAAgD;IAChD,KAAK,IAAI,IAAI,CAAC;CACf"}
@@ -1,24 +0,0 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.CoreSelectionSetEventType = void 0;
8
- /**
9
- * Identifies the type of changes made to the `CoreIModelSelectionSet` to produce a `CoreSelectionSetEvent`.
10
- * @see https://www.itwinjs.org/reference/core-frontend/selectionset/selectionseteventtype/
11
- * @internal
12
- */
13
- var CoreSelectionSetEventType;
14
- (function (CoreSelectionSetEventType) {
15
- /** Elements have been added to the set. */
16
- CoreSelectionSetEventType[CoreSelectionSetEventType["Add"] = 0] = "Add";
17
- /** Elements have been removed from the set. */
18
- CoreSelectionSetEventType[CoreSelectionSetEventType["Remove"] = 1] = "Remove";
19
- /** Some elements have been added to the set and others have been removed. */
20
- CoreSelectionSetEventType[CoreSelectionSetEventType["Replace"] = 2] = "Replace";
21
- /** All elements are about to be removed from the set. */
22
- CoreSelectionSetEventType[CoreSelectionSetEventType["Clear"] = 3] = "Clear";
23
- })(CoreSelectionSetEventType || (exports.CoreSelectionSetEventType = CoreSelectionSetEventType = {}));
24
- //# sourceMappingURL=IModel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IModel.js","sourceRoot":"","sources":["../../../../src/unified-selection/types/IModel.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAoBhG;;;;GAIG;AACH,IAAY,yBASX;AATD,WAAY,yBAAyB;IACnC,2CAA2C;IAC3C,uEAAG,CAAA;IACH,+CAA+C;IAC/C,6EAAM,CAAA;IACN,6EAA6E;IAC7E,+EAAO,CAAA;IACP,yDAAyD;IACzD,2EAAK,CAAA;AACP,CAAC,EATW,yBAAyB,aAAzB,yBAAyB,GAAzB,yBAAyB,QASpC","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 { Id64Arg, Id64Set } from \"@itwin/core-bentley\";\nimport { Event } from \"@itwin/presentation-shared\";\n\n/**\n * A collection of geometric element, model and subcategory ids that can be added to\n * a [[SelectionSet]] or [[HiliteSet]].\n *\n * **Warning:** This type was added to `@itwin/core-frontend` in 5.0.\n *\n * @see https://www.itwinjs.org/reference/core-frontend/selectionset/selectableids/\n * @public\n */\nexport interface CoreSelectableIds {\n elements?: Id64Arg;\n models?: Id64Arg;\n subcategories?: Id64Arg;\n}\n\n/**\n * Identifies the type of changes made to the `CoreIModelSelectionSet` to produce a `CoreSelectionSetEvent`.\n * @see https://www.itwinjs.org/reference/core-frontend/selectionset/selectionseteventtype/\n * @internal\n */\nexport enum CoreSelectionSetEventType {\n /** Elements have been added to the set. */\n Add,\n /** Elements have been removed from the set. */\n Remove,\n /** Some elements have been added to the set and others have been removed. */\n Replace,\n /** All elements are about to be removed from the set. */\n Clear,\n}\n\n/**\n * Payload sent to `CoreIModelSelectionSet.onChanged` event listeners to describe how the contents of the set have changed.\n * @see https://www.itwinjs.org/reference/core-frontend/selectionset/selectionsetevent/\n * @public\n */\nexport interface CoreSelectionSetEventUnsafe {\n /**\n * The type of operation that produced this event.\n *\n * Actually, this should be `CoreSelectionSetEventType`, however we can't use it here because in TS two identical enums with\n * different names aren't equal, so [`SelectionSetEventType `](https://www.itwinjs.org/reference/core-frontend/selectionset/selectionseteventtype/)\n * doesn't map to `CoreSelectionSetEventType` as far as TS is concerned. Due to this reason, this interface is marked as `unsafe`.\n */\n type: number;\n /** The element Ids added to the set. */\n added?: Id64Arg;\n /**\n * A collection of geometric element, model and subcategory ids that have been removed from selection set.\n *\n * **Warning:** This property was added to `@itwin/core-frontend` in 5.0.\n */\n additions?: CoreSelectableIds;\n /** The element Ids removed from the set. */\n removed?: Id64Arg;\n /**\n * A collection of geometric element, model and subcategory ids that have been added to selection set.\n *\n * **Warning:** This property was added to `@itwin/core-frontend` in 5.0.\n */\n removals?: CoreSelectableIds;\n /** The affected `CoreIModelSelectionSet`. */\n set: CoreIModelSelectionSet;\n}\n\n/**\n * A set of *currently selected* elements in an iModel.\n * @see https://www.itwinjs.org/reference/core-frontend/selectionset/\n * @public\n */\nexport type CoreIModelSelectionSet = {\n /** Event called whenever elements are added or removed from this SelectionSet. */\n onChanged: Event<(ev: CoreSelectionSetEventUnsafe) => void>;\n /** The IDs of the selected elements. */\n readonly elements: Set<string>;\n /** Clear current selection set. */\n emptyAll(): void;\n} & (\n | {\n /** Add one or more Ids to the current selection set. */\n add(elem: Id64Arg): boolean;\n /** Remove one or more Ids from the current selection set. */\n remove(elem: Id64Arg): boolean;\n }\n | {\n /**\n * Get the active selection as a collection of geometric element, model and subcategory ids.\n */\n readonly active: { [P in keyof CoreSelectableIds]-?: Id64Set };\n\n /**\n * Adds a collection of geometric element, model and subcategory ids to this selection set.\n *\n * The overload was added only in 5.0 `@itwin/core-frontend`. The `active` property can be used\n * to check if this `overload` is available.\n */\n add: (ids: Id64Arg | CoreSelectableIds) => boolean;\n\n /**\n * Adds a collection of geometric element, model and subcategory ids to this selection set.\n *\n * The overload was added only in 5.0 `@itwin/core-frontend`. The `active` property can be used\n * to check if this `overload` is available.\n */\n remove: (ids: Id64Arg | CoreSelectableIds) => boolean;\n }\n);\n\n/**\n * A set if ID's optimized for performance-critical code which represents large sets of ID's as pairs of 32-bit integers.\n * @see https://www.itwinjs.org/reference/core-bentley/ids/id64/id64.uint32set/\n * @public\n */\ninterface Uint32Set {\n /** Add any number of Ids to the set. */\n addIds(ids: Id64Arg): void;\n /** Remove any number of Ids from the set. */\n deleteIds(ids: Id64Arg): void;\n}\n\n/**\n * A set of *hilited* elements in an iModel, by element id.\n * @see https://www.itwinjs.org/reference/core-frontend/selectionset/hiliteset/\n * @public\n */\nexport interface CoreIModelHiliteSet {\n /** Control whether the hilited elements should be synchronized with the contents of `CoreIModelSelectionSet`.*/\n wantSyncWithSelectionSet: boolean;\n /** The set of hilited elements. */\n readonly elements: Uint32Set;\n /** The set of hilited subcategories. */\n readonly subcategories: Uint32Set;\n /** The set of hilited models. */\n readonly models: Uint32Set;\n /** Remove all elements from the hilited set. */\n clear(): void;\n}\n"]}
@@ -1,10 +0,0 @@
1
- export { TRANSIENT_ELEMENT_CLASSNAME, CustomSelectable, Selectable, SelectableIdentifier, SelectableInstanceKey, Selectables, } from "./unified-selection/Selectable.js";
2
- export { SelectionStorage, createStorage } from "./unified-selection/SelectionStorage.js";
3
- export { createHiliteSetProvider, HiliteSet, HiliteSetProvider } from "./unified-selection/HiliteSetProvider.js";
4
- export { createCachingHiliteSetProvider, CachingHiliteSetProvider, } from "./unified-selection/CachingHiliteSetProvider.js";
5
- export { createIModelHiliteSetProvider, IModelHiliteSetProvider } from "./unified-selection/IModelHiliteSetProvider.js";
6
- export { computeSelection, SelectionScope } from "./unified-selection/SelectionScope.js";
7
- export { enableUnifiedSelectionSyncWithIModel } from "./unified-selection/EnableUnifiedSelectionSyncWithIModel.js";
8
- export { StorageSelectionChangeType, StorageSelectionChangeEventArgs, StorageSelectionChangesListener, } from "./unified-selection/SelectionChangeEvent.js";
9
- export { CLEAR_SELECTION_STORAGE_SOURCE } from "./unified-selection/SelectionStorage.js";
10
- //# sourceMappingURL=unified-selection.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"unified-selection.d.ts","sourceRoot":"","sources":["../../src/unified-selection.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,2BAA2B,EAC3B,gBAAgB,EAChB,UAAU,EACV,oBAAoB,EACpB,qBAAqB,EACrB,WAAW,GACZ,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAC1F,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AACjH,OAAO,EAEL,8BAA8B,EAE9B,wBAAwB,GACzB,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAE,6BAA6B,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAC;AACxH,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACzF,OAAO,EAAE,oCAAoC,EAAE,MAAM,6DAA6D,CAAC;AACnH,OAAO,EACL,0BAA0B,EAC1B,+BAA+B,EAC/B,+BAA+B,GAChC,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,8BAA8B,EAAE,MAAM,yCAAyC,CAAC"}
@@ -1,27 +0,0 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.CLEAR_SELECTION_STORAGE_SOURCE = exports.enableUnifiedSelectionSyncWithIModel = exports.computeSelection = exports.createIModelHiliteSetProvider = exports.createCachingHiliteSetProvider = exports.createHiliteSetProvider = exports.createStorage = exports.Selectables = exports.Selectable = exports.TRANSIENT_ELEMENT_CLASSNAME = void 0;
8
- var Selectable_js_1 = require("./unified-selection/Selectable.js");
9
- Object.defineProperty(exports, "TRANSIENT_ELEMENT_CLASSNAME", { enumerable: true, get: function () { return Selectable_js_1.TRANSIENT_ELEMENT_CLASSNAME; } });
10
- Object.defineProperty(exports, "Selectable", { enumerable: true, get: function () { return Selectable_js_1.Selectable; } });
11
- Object.defineProperty(exports, "Selectables", { enumerable: true, get: function () { return Selectable_js_1.Selectables; } });
12
- var SelectionStorage_js_1 = require("./unified-selection/SelectionStorage.js");
13
- Object.defineProperty(exports, "createStorage", { enumerable: true, get: function () { return SelectionStorage_js_1.createStorage; } });
14
- var HiliteSetProvider_js_1 = require("./unified-selection/HiliteSetProvider.js");
15
- Object.defineProperty(exports, "createHiliteSetProvider", { enumerable: true, get: function () { return HiliteSetProvider_js_1.createHiliteSetProvider; } });
16
- var CachingHiliteSetProvider_js_1 = require("./unified-selection/CachingHiliteSetProvider.js");
17
- // eslint-disable-next-line @typescript-eslint/no-deprecated
18
- Object.defineProperty(exports, "createCachingHiliteSetProvider", { enumerable: true, get: function () { return CachingHiliteSetProvider_js_1.createCachingHiliteSetProvider; } });
19
- var IModelHiliteSetProvider_js_1 = require("./unified-selection/IModelHiliteSetProvider.js");
20
- Object.defineProperty(exports, "createIModelHiliteSetProvider", { enumerable: true, get: function () { return IModelHiliteSetProvider_js_1.createIModelHiliteSetProvider; } });
21
- var SelectionScope_js_1 = require("./unified-selection/SelectionScope.js");
22
- Object.defineProperty(exports, "computeSelection", { enumerable: true, get: function () { return SelectionScope_js_1.computeSelection; } });
23
- var EnableUnifiedSelectionSyncWithIModel_js_1 = require("./unified-selection/EnableUnifiedSelectionSyncWithIModel.js");
24
- Object.defineProperty(exports, "enableUnifiedSelectionSyncWithIModel", { enumerable: true, get: function () { return EnableUnifiedSelectionSyncWithIModel_js_1.enableUnifiedSelectionSyncWithIModel; } });
25
- var SelectionStorage_js_2 = require("./unified-selection/SelectionStorage.js");
26
- Object.defineProperty(exports, "CLEAR_SELECTION_STORAGE_SOURCE", { enumerable: true, get: function () { return SelectionStorage_js_2.CLEAR_SELECTION_STORAGE_SOURCE; } });
27
- //# sourceMappingURL=unified-selection.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"unified-selection.js","sourceRoot":"","sources":["../../src/unified-selection.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,mEAO2C;AANzC,4HAAA,2BAA2B,OAAA;AAE3B,2GAAA,UAAU,OAAA;AAGV,4GAAA,WAAW,OAAA;AAEb,+EAA0F;AAA/D,oHAAA,aAAa,OAAA;AACxC,iFAAiH;AAAxG,+HAAA,uBAAuB,OAAA;AAChC,+FAKyD;AAJvD,4DAA4D;AAC5D,6IAAA,8BAA8B,OAAA;AAIhC,6FAAwH;AAA/G,2IAAA,6BAA6B,OAAA;AACtC,2EAAyF;AAAhF,qHAAA,gBAAgB,OAAA;AACzB,uHAAmH;AAA1G,+JAAA,oCAAoC,OAAA;AAM7C,+EAAyF;AAAhF,qIAAA,8BAA8B,OAAA","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\nexport {\n TRANSIENT_ELEMENT_CLASSNAME,\n CustomSelectable,\n Selectable,\n SelectableIdentifier,\n SelectableInstanceKey,\n Selectables,\n} from \"./unified-selection/Selectable.js\";\nexport { SelectionStorage, createStorage } from \"./unified-selection/SelectionStorage.js\";\nexport { createHiliteSetProvider, HiliteSet, HiliteSetProvider } from \"./unified-selection/HiliteSetProvider.js\";\nexport {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n createCachingHiliteSetProvider,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n CachingHiliteSetProvider,\n} from \"./unified-selection/CachingHiliteSetProvider.js\";\nexport { createIModelHiliteSetProvider, IModelHiliteSetProvider } from \"./unified-selection/IModelHiliteSetProvider.js\";\nexport { computeSelection, SelectionScope } from \"./unified-selection/SelectionScope.js\";\nexport { enableUnifiedSelectionSyncWithIModel } from \"./unified-selection/EnableUnifiedSelectionSyncWithIModel.js\";\nexport {\n StorageSelectionChangeType,\n StorageSelectionChangeEventArgs,\n StorageSelectionChangesListener,\n} from \"./unified-selection/SelectionChangeEvent.js\";\nexport { CLEAR_SELECTION_STORAGE_SOURCE } from \"./unified-selection/SelectionStorage.js\";\n"]}
@@ -1,56 +0,0 @@
1
- import "./DisposePolyfill.js";
2
- import { ECClassHierarchyInspector, ECSqlQueryExecutor } from "@itwin/presentation-shared";
3
- import { createHiliteSetProvider, HiliteSet } from "./HiliteSetProvider.js";
4
- import { SelectionStorage } from "./SelectionStorage.js";
5
- /**
6
- * Props for creating a `CachingHiliteSetProvider` instance.
7
- * @public
8
- * @deprecated in 1.5. Use `IModelHiliteSetProviderProps` instead.
9
- */
10
- export interface CachingHiliteSetProviderProps {
11
- /** Selection storage to use for retrieving the hilite set. */
12
- selectionStorage: SelectionStorage;
13
- /** A callback that should return iModel access by iModel key. */
14
- imodelProvider: (imodelKey: string) => ECClassHierarchyInspector & ECSqlQueryExecutor;
15
- /** An optional hilite set provider factory. If not provided, defaults to `createHiliteSetProvider` from this package. */
16
- createHiliteSetProvider?: typeof createHiliteSetProvider;
17
- }
18
- /**
19
- * Defines return value of `createCachingHiliteSetProvider`.
20
- *
21
- * **Warning:** Used in public API as a return value. Not expected to be created / extended by package
22
- * consumers, may be supplemented with required attributes any time.
23
- *
24
- * @see `createCachingHiliteSetProvider`
25
- * @public
26
- * @deprecated in 1.5. Use `IModelHiliteSetProvider` instead.
27
- */
28
- export interface CachingHiliteSetProvider {
29
- /** Get the current hilite set iterator for the specified imodel */
30
- getHiliteSet(props: {
31
- /** iModel to get hilite set for */
32
- imodelKey: string;
33
- }): AsyncIterableIterator<HiliteSet>;
34
- /**
35
- * Disposes the cache.
36
- *
37
- * Optional to avoid breaking the API. Will be made required when the deprecated
38
- * `dispose` is removed.
39
- */
40
- [Symbol.dispose]?: () => void;
41
- /**
42
- * Disposes the cache.
43
- * @deprecated in 1.2. Use `[Symbol.dispose]` instead.
44
- */
45
- dispose(): void;
46
- }
47
- /**
48
- * Creates a hilite set provider that caches hilite set for current selection for given iModel so any subsequent
49
- * hilite set requests for the same iModel don't cost until selection in given selection storage changes.
50
- * @public
51
- * @deprecated in 1.5. Use `createIModelHiliteSetProvider` instead.
52
- */
53
- export declare function createCachingHiliteSetProvider(props: CachingHiliteSetProviderProps): CachingHiliteSetProvider & {
54
- [Symbol.dispose]: () => void;
55
- };
56
- //# sourceMappingURL=CachingHiliteSetProvider.d.ts.map
@@ -1 +0,0 @@
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,CAC5C,KAAK,EAAE,6BAA6B,GACnC,wBAAwB,GAAG;IAAE,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,CAO7D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"CachingHiliteSetProvider.js","sourceRoot":"","sources":["../../../src/unified-selection/CachingHiliteSetProvider.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,qDAAqD;AAErD,OAAO,sBAAsB,CAAC;AAI9B,OAAO,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AAmD7E;;;;;GAKG;AACH,qBAAqB;AACrB,MAAM,UAAU,8BAA8B,CAC5C,KAAoC;IAEpC,MAAM,QAAQ,GAAG,6BAA6B,CAAC,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(\n props: CachingHiliteSetProviderProps,\n): 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 +0,0 @@
1
- {"version":3,"file":"DisposePolyfill.d.ts","sourceRoot":"","sources":["../../../src/unified-selection/DisposePolyfill.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"DisposePolyfill.js","sourceRoot":"","sources":["../../../src/unified-selection/DisposePolyfill.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG;;GAEG;AACF,MAAc,CAAC,OAAO,KAAK,MAAM,CAAC,gBAAgB,CAAC,CAAC;AACpD,MAAc,CAAC,YAAY,KAAK,MAAM,CAAC,qBAAqB,CAAC,CAAC","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\n/**\n * Polyfill for upcoming resource management feature: https://github.com/tc39/proposal-explicit-resource-management\n */\n(Symbol as any).dispose ??= Symbol(\"Symbol.dispose\");\n(Symbol as any).asyncDispose ??= Symbol(\"Symbol.asyncDispose\");\n"]}
@@ -1,119 +0,0 @@
1
- import "./DisposePolyfill.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
- /**
10
- * Props for `enableUnifiedSelectionSyncWithIModel`.
11
- * @public
12
- */
13
- export interface EnableUnifiedSelectionSyncWithIModelProps {
14
- /**
15
- * Provides access to different iModel's features: query executing, class hierarchy, selection and hilite sets.
16
- *
17
- * It's recommended to use `@itwin/presentation-core-interop` to create `key`, `ECSqlQueryExecutor` and `ECSchemaProvider` from
18
- * [IModelConnection](https://www.itwinjs.org/reference/core-frontend/imodelconnection/imodelconnection/), and map its
19
- * `hilited` and `selectionSet` attributes like this:
20
- *
21
- * ```ts
22
- * import { createECSqlQueryExecutor, createECSchemaProvider, createIModelKey } from "@itwin/presentation-core-interop";
23
- * import { createCachingECClassHierarchyInspector } from "@itwin/presentation-shared";
24
- * import { IModelConnection } from "@itwin/core-frontend";
25
- *
26
- * const imodel: IModelConnection = ...
27
- * const imodelAccess = {
28
- * ...createECSqlQueryExecutor(imodel),
29
- * ...createCachingECClassHierarchyInspector({ schemaProvider: createECSchemaProvider(MyAppFrontend.getSchemaContext(imodel)) }),
30
- * key: createIModelKey(imodel),
31
- * hiliteSet: imodel.hilited,
32
- * selectionSet: imodel.selectionSet,
33
- * };
34
- * ```
35
- */
36
- imodelAccess: ECSqlQueryExecutor & ECClassHierarchyInspector & {
37
- /** Key of the iModel. Generally taken from `IModelConnection.key`. */
38
- readonly key: string;
39
- /** The set of currently hilited elements taken from `IModelConnection.hilited`. */
40
- readonly hiliteSet: CoreIModelHiliteSet;
41
- /** The set of currently selected elements taken from `IModelConnection.selectionSet`. */
42
- readonly selectionSet: CoreIModelSelectionSet;
43
- };
44
- /**
45
- * Unified selection storage to synchronize IModel's tool selection with. The storage should be shared
46
- * across all components in the application to ensure unified selection experience.
47
- */
48
- selectionStorage: SelectionStorage;
49
- /** Active selection scope provider. */
50
- activeScopeProvider: () => SelectionScope;
51
- /**
52
- * An iModel hilite set provider used to retrieve hilite sets for different iModels. If not provided, a new `IModelHiliteSetProvider`
53
- * will be created for the given iModel using the provided `imodelAccess`.
54
- * If the consuming application already has a `IModelHiliteSetProvider` defined, it should be provided instead
55
- * to reuse the cache and avoid creating new providers for each iModel.
56
- *
57
- * @see `createIModelHiliteSetProvider`
58
- */
59
- imodelHiliteSetProvider?: IModelHiliteSetProvider;
60
- /**
61
- * A caching hilite set provider used to retrieve hilite sets for an iModel. If not provided, a new `CachingHiliteSetProvider`
62
- * will be created for the given iModel using the provided `imodelAccess`.
63
- * If the consuming application already has a `CachingHiliteSetProvider` defined, it should be provided instead
64
- * to reuse the cache and avoid creating new providers for each iModel.
65
- *
66
- * The type is defined in a way that makes it required for provider to have either the deprecated `dispose` or the
67
- * new `Symbol.dispose` method.
68
- *
69
- * **Warning:** When the given `CachingHiliteSetProvider` internally uses a custom `HiliteSetProvider`, the synchronization has
70
- * no access to it, and thus uses its own, default, `HiliteSetProvider`. As a result, the synchronization may not work as expected.
71
- * To alleviate this, the `imodelHiliteSetProvider` prop should be used instead.
72
- *
73
- * @deprecated in 1.5. Use `imodelHiliteSetProvider` prop instead.
74
- */
75
- cachingHiliteSetProvider?: CachingHiliteSetProvider | (Omit<CachingHiliteSetProvider, "dispose"> & {
76
- [Symbol.dispose]: () => void;
77
- });
78
- }
79
- /**
80
- * Enables synchronization between iModel selection and unified selection.
81
- * @returns function for disposing the synchronization.
82
- * @public
83
- */
84
- export declare function enableUnifiedSelectionSyncWithIModel(props: EnableUnifiedSelectionSyncWithIModelProps): () => void;
85
- /**
86
- * A handler that syncs selection between unified selection storage (`SelectionStorage`) and
87
- * an iModel (`iModel.selectionSet`, `iModel.hilited`).
88
- *
89
- * @internal
90
- */
91
- export declare class IModelSelectionHandler {
92
- #private;
93
- private _selectionSourceName;
94
- private _imodelAccess;
95
- private _selectionStorage;
96
- private _imodelHiliteSetProvider;
97
- private _activeScopeProvider;
98
- private _isSuspended;
99
- private _selectionStorageChangeTracker;
100
- private _cancelOngoingChanges;
101
- private _unregisterUnifiedSelectionListener;
102
- private _unregisterIModelSelectionSetListener;
103
- private _disposeInternalHiliteSetProvider;
104
- constructor(props: EnableUnifiedSelectionSyncWithIModelProps & {
105
- hiliteSetProvider?: HiliteSetProvider;
106
- });
107
- [Symbol.dispose](): void;
108
- /** Temporarily suspends tool selection synchronization until the returned disposable object is disposed. */
109
- suspendIModelToolSelectionSync(): {
110
- [Symbol.dispose]: () => void;
111
- };
112
- private syncHiliteSet;
113
- private onUnifiedSelectionChanged;
114
- private applyCurrentHiliteSet;
115
- private addHiliteSet;
116
- private removeHiliteSet;
117
- private onIModelSelectionChanged;
118
- }
119
- //# sourceMappingURL=EnableUnifiedSelectionSyncWithIModel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EnableUnifiedSelectionSyncWithIModel.d.ts","sourceRoot":"","sources":["../../../src/unified-selection/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,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;IAItD,YAAmB,KAAK,EAAE,yCAAyC,GAAG;QAAE,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;KAAE,EAkD9G;IAEM,CAAC,MAAM,CAAC,OAAO,CAAC,SAKtB;IAED,4GAA4G;IACrG,8BAA8B;;MAQpC;IAED,OAAO,CAAC,aAAa;IAmDrB,OAAO,CAAC,yBAAyB,CAa/B;IAEF,OAAO,CAAC,qBAAqB;IAwB7B,OAAO,CAAC,YAAY;IA2BpB,OAAO,CAAC,eAAe;IA0BvB,OAAO,CAAC,wBAAwB,CAwD9B;CACH"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"EnableUnifiedSelectionSyncWithIModel.js","sourceRoot":"","sources":["../../../src/unified-selection/EnableUnifiedSelectionSyncWithIModel.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEhG,OAAO,sBAAsB,CAAC;AAE9B,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC5F,OAAO,EAAE,IAAI,EAAgC,MAAM,qBAAqB,CAAC;AAGzE,OAAO,EAAE,uBAAuB,EAA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,cAAyC;IAC9E,QAAQ,cAAc,EAAE,CAAC;QACvB,KAAK,yBAAyB,CAAC,GAAG;YAChC,OAAO,KAAK,CAAC;QACf,KAAK,yBAAyB,CAAC,MAAM;YACnC,OAAO,QAAQ,CAAC;QAClB,KAAK,yBAAyB,CAAC,OAAO;YACpC,OAAO,SAAS,CAAC;QACnB,iCAAiC;QACjC,KAAK,yBAAyB,CAAC,KAAK;YAClC,OAAO,OAAO,CAAC;IACnB,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CACvB,YAAoC;IAMpC,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 {\n CoreIModelHiliteSet,\n CoreIModelSelectionSet,\n CoreSelectableIds,\n CoreSelectionSetEventType,\n CoreSelectionSetEventUnsafe,\n} 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 cachingHiliteSetProvider?:\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n | CachingHiliteSetProvider\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n | (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: () =>\n 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(\n this.onIModelSelectionChanged,\n );\n this._unregisterUnifiedSelectionListener = this._selectionStorage.selectionChangeEvent.addListener(\n this.onUnifiedSelectionChanged,\n );\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: {\n changeType: StorageSelectionChangeType;\n selectables: Selectables;\n source: string;\n }): 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(\n this._imodelHiliteSetProvider\n .getHiliteSetProvider({ imodelKey: this._imodelAccess.key })\n .getHiliteSet({ selectables }),\n )\n .pipe(takeUntil(this._cancelOngoingChanges))\n .subscribe({\n next: (set) => {\n this.addHiliteSet(set);\n },\n });\n case \"remove\":\n return void from(\n this._imodelHiliteSetProvider\n .getHiliteSetProvider({ imodelKey: this._imodelAccess.key })\n .getHiliteSet({ selectables }),\n )\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({\n activeSelectionAction,\n }: {\n activeSelectionAction: \"clearAll\" | \"clearHilited\" | \"keep\";\n }) {\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\n ? from(ids.models).pipe(map((id): SelectableInstanceKey => ({ className: \"BisCore.Model\", id })))\n : /* 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(\n selectionSet: CoreIModelSelectionSet,\n): 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"]}