@itwin/presentation-frontend 3.2.0-dev.9 → 3.2.2

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 (34) hide show
  1. package/CHANGELOG.md +47 -1
  2. package/lib/cjs/presentation-frontend/selection/ISelectionProvider.d.ts +1 -1
  3. package/lib/cjs/presentation-frontend/selection/ISelectionProvider.js.map +1 -1
  4. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.d.ts +1 -1
  5. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.d.ts.map +1 -1
  6. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.js.map +1 -1
  7. package/lib/cjs/presentation-frontend/selection/SelectionManager.d.ts +16 -16
  8. package/lib/cjs/presentation-frontend/selection/SelectionManager.d.ts.map +1 -1
  9. package/lib/cjs/presentation-frontend/selection/SelectionManager.js +11 -12
  10. package/lib/cjs/presentation-frontend/selection/SelectionManager.js.map +1 -1
  11. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.d.ts +13 -5
  12. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.d.ts.map +1 -1
  13. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js +21 -9
  14. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
  15. package/lib/cjs/presentation-frontend.d.ts +1 -1
  16. package/lib/cjs/presentation-frontend.js +1 -1
  17. package/lib/cjs/presentation-frontend.js.map +1 -1
  18. package/lib/esm/presentation-frontend/selection/ISelectionProvider.d.ts +1 -1
  19. package/lib/esm/presentation-frontend/selection/ISelectionProvider.js.map +1 -1
  20. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.d.ts +1 -1
  21. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.d.ts.map +1 -1
  22. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.js.map +1 -1
  23. package/lib/esm/presentation-frontend/selection/SelectionManager.d.ts +16 -16
  24. package/lib/esm/presentation-frontend/selection/SelectionManager.d.ts.map +1 -1
  25. package/lib/esm/presentation-frontend/selection/SelectionManager.js +12 -13
  26. package/lib/esm/presentation-frontend/selection/SelectionManager.js.map +1 -1
  27. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.d.ts +13 -5
  28. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.d.ts.map +1 -1
  29. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js +19 -8
  30. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
  31. package/lib/esm/presentation-frontend.d.ts +1 -1
  32. package/lib/esm/presentation-frontend.js +1 -1
  33. package/lib/esm/presentation-frontend.js.map +1 -1
  34. package/package.json +16 -17
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { DEFAULT_KEYS_BATCH_SIZE, KeySet } from "@itwin/presentation-common";
9
9
  /**
10
- * A manager that knows available [selection scopes]($docs/presentation/Unified-Selection/index#selection-scopes)
10
+ * A manager that knows available [selection scopes]($docs/presentation/unified-selection/index#selection-scopes)
11
11
  * and can compute logical selection based on element IDs and selection scope.
12
12
  *
13
13
  * @public
@@ -38,7 +38,7 @@ export class SelectionScopesManager {
38
38
  * @param scope Selection scope to apply
39
39
  */
40
40
  async computeSelection(imodel, ids, scope) {
41
- const scopeId = getScopeId(scope);
41
+ const scopeProps = createSelectionScopeProps(scope);
42
42
  // convert ids input to array
43
43
  if (typeof ids === "string")
44
44
  ids = [ids];
@@ -53,23 +53,34 @@ export class SelectionScopesManager {
53
53
  const batchStart = batchSize * batchIndex;
54
54
  const batchEnd = (batchStart + batchSize > ids.length) ? ids.length : (batchStart + batchSize);
55
55
  const batchIds = (0 === batchIndex && ids.length <= batchEnd) ? ids : ids.slice(batchStart, batchEnd);
56
- batchKeyPromises.push(this._rpcRequestsHandler.computeSelection({ imodel: imodel.getRpcProps() }, batchIds, scopeId));
56
+ batchKeyPromises.push(this._rpcRequestsHandler.computeSelection({ imodel: imodel.getRpcProps(), elementIds: batchIds, scope: scopeProps }));
57
57
  }
58
58
  const batchKeys = (await Promise.all(batchKeyPromises)).map(KeySet.fromJSON);
59
59
  batchKeys.forEach((bk) => keys.add(bk));
60
60
  return keys;
61
61
  }
62
62
  }
63
+ /**
64
+ * Normalizes given scope options and returns [[ComputeSelectionScopeProps]] that can be used for
65
+ * calculating selection with scope.
66
+ *
67
+ * @internal
68
+ */
69
+ export function createSelectionScopeProps(scope) {
70
+ if (!scope)
71
+ return { id: "element" };
72
+ if (typeof scope === "string")
73
+ return { id: scope };
74
+ return scope;
75
+ }
63
76
  /**
64
77
  * Determines the scope id
65
78
  * @param scope Selection scope
66
79
  * @public
80
+ * @deprecated This is an internal utility that should've never become public.
67
81
  */
82
+ // istanbul ignore next
68
83
  export function getScopeId(scope) {
69
- if (!scope)
70
- return "element";
71
- if (typeof scope === "string")
72
- return scope;
73
- return scope.id;
84
+ return createSelectionScopeProps(scope).id;
74
85
  }
75
86
  //# sourceMappingURL=SelectionScopesManager.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelectionScopesManager.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionScopesManager.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAIH,OAAO,EAAE,uBAAuB,EAAE,MAAM,EAAsC,MAAM,4BAA4B,CAAC;AAcjH;;;;;GAKG;AACH,MAAM,OAAO,sBAAsB;IAMjC,YAAmB,KAAkC;QACnD,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC,kBAAkB,CAAC;QACpD,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IACpF,CAAC;IAED,wBAAwB;IACxB,IAAW,YAAY,KAAK,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;IAEvD,2CAA2C;IAC3C,IAAW,WAAW,KAAK,OAAO,IAAI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AAC;YAC/F,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,UAAU,IAAI,GAAG,CAAC,MAAM,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;YACtG,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,WAAW,EAAE,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;SACvH;QACD,MAAM,SAAS,GAAG,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC7E,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,KAA0C;IACnE,IAAI,CAAC,KAAK;QACR,OAAO,SAAS,CAAC;IACnB,IAAI,OAAO,KAAK,KAAK,QAAQ;QAC3B,OAAO,KAAK,CAAC;IACf,OAAO,KAAK,CAAC,EAAE,CAAC;AAClB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module UnifiedSelection\r\n */\r\n\r\nimport { Id64Arg } from \"@itwin/core-bentley\";\r\nimport { IModelConnection } from \"@itwin/core-frontend\";\r\nimport { DEFAULT_KEYS_BATCH_SIZE, KeySet, RpcRequestsHandler, SelectionScope } from \"@itwin/presentation-common\";\r\n\r\n/**\r\n * Properties for creating [[SelectionScopesManager]].\r\n * @public\r\n */\r\nexport interface SelectionScopesManagerProps {\r\n /** RPC handler to use for requesting selection scopes */\r\n rpcRequestsHandler: RpcRequestsHandler;\r\n\r\n /** Provider of active locale to use for localizing scopes */\r\n localeProvider?: () => string | undefined;\r\n}\r\n\r\n/**\r\n * A manager that knows available [selection scopes]($docs/presentation/Unified-Selection/index#selection-scopes)\r\n * and can compute logical selection based on element IDs and selection scope.\r\n *\r\n * @public\r\n */\r\nexport class SelectionScopesManager {\r\n\r\n private _rpcRequestsHandler: RpcRequestsHandler;\r\n private _getLocale: () => string | undefined;\r\n private _activeScope: SelectionScope | string | undefined;\r\n\r\n public constructor(props: SelectionScopesManagerProps) {\r\n this._rpcRequestsHandler = props.rpcRequestsHandler;\r\n this._getLocale = props.localeProvider ? props.localeProvider : (() => undefined);\r\n }\r\n\r\n /** Get active locale */\r\n public get activeLocale() { return this._getLocale(); }\r\n\r\n /** The active selection scope or its id */\r\n public get activeScope() { return this._activeScope; }\r\n public set activeScope(scope: SelectionScope | string | undefined) { this._activeScope = scope; }\r\n\r\n /**\r\n * Get available selection scopes.\r\n * @param imodel The iModel to get selection scopes for\r\n * @param locale Optional locale to use when localizing scopes' label and description\r\n */\r\n public async getSelectionScopes(imodel: IModelConnection, locale?: string): Promise<SelectionScope[]> {\r\n if (!locale)\r\n locale = this._getLocale();\r\n return this._rpcRequestsHandler.getSelectionScopes({ imodel: imodel.getRpcProps(), locale });\r\n }\r\n\r\n /**\r\n * Computes keys that need to be added to logical selection based on provided selection scope.\r\n * @param ids Element IDs to compute selection for\r\n * @param scope Selection scope to apply\r\n */\r\n public async computeSelection(imodel: IModelConnection, ids: Id64Arg, scope: SelectionScope | string): Promise<KeySet> {\r\n const scopeId = getScopeId(scope);\r\n\r\n // convert ids input to array\r\n if (typeof ids === \"string\")\r\n ids = [ids];\r\n else if (ids instanceof Set)\r\n ids = [...ids];\r\n\r\n // compute selection in batches to avoid HTTP 413\r\n const keys = new KeySet();\r\n const batchSize = DEFAULT_KEYS_BATCH_SIZE;\r\n const batchesCount = Math.ceil(ids.length / batchSize);\r\n const batchKeyPromises = [];\r\n for (let batchIndex = 0; batchIndex < batchesCount; ++batchIndex) {\r\n const batchStart = batchSize * batchIndex;\r\n const batchEnd = (batchStart + batchSize > ids.length) ? ids.length : (batchStart + batchSize);\r\n const batchIds = (0 === batchIndex && ids.length <= batchEnd) ? ids : ids.slice(batchStart, batchEnd);\r\n batchKeyPromises.push(this._rpcRequestsHandler.computeSelection({ imodel: imodel.getRpcProps() }, batchIds, scopeId));\r\n }\r\n const batchKeys = (await Promise.all(batchKeyPromises)).map(KeySet.fromJSON);\r\n batchKeys.forEach((bk) => keys.add(bk));\r\n return keys;\r\n }\r\n}\r\n\r\n/**\r\n * Determines the scope id\r\n * @param scope Selection scope\r\n * @public\r\n */\r\nexport function getScopeId(scope: SelectionScope | string | undefined): string {\r\n if (!scope)\r\n return \"element\";\r\n if (typeof scope === \"string\")\r\n return scope;\r\n return scope.id;\r\n}\r\n"]}
1
+ {"version":3,"file":"SelectionScopesManager.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionScopesManager.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAIH,OAAO,EAAE,uBAAuB,EAAE,MAAM,EAA2D,MAAM,4BAA4B,CAAC;AActI;;;;;GAKG;AACH,MAAM,OAAO,sBAAsB;IAMjC,YAAmB,KAAkC;QACnD,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC,kBAAkB,CAAC;QACpD,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IACpF,CAAC;IAED,wBAAwB;IACxB,IAAW,YAAY,KAAK,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;IAEvD,2CAA2C;IAC3C,IAAW,WAAW,KAAK,OAAO,IAAI,CAAC,YAAY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/F,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,UAAU,IAAI,GAAG,CAAC,MAAM,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;YACtG,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,WAAW,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;SAC7I;QACD,MAAM,SAAS,GAAG,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC7E,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CAAC,KAAgE;IACxG,IAAI,CAAC,KAAK;QACR,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC;IAC3B,IAAI,OAAO,KAAK,KAAK,QAAQ;QAC3B,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC;IACvB,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;GAKG;AACH,uBAAuB;AACvB,MAAM,UAAU,UAAU,CAAC,KAA0C;IACnE,OAAO,yBAAyB,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;AAC7C,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module UnifiedSelection\r\n */\r\n\r\nimport { Id64Arg } from \"@itwin/core-bentley\";\r\nimport { IModelConnection } from \"@itwin/core-frontend\";\r\nimport { DEFAULT_KEYS_BATCH_SIZE, KeySet, RpcRequestsHandler, SelectionScope, SelectionScopeProps } from \"@itwin/presentation-common\";\r\n\r\n/**\r\n * Properties for creating [[SelectionScopesManager]].\r\n * @public\r\n */\r\nexport interface SelectionScopesManagerProps {\r\n /** RPC handler to use for requesting selection scopes */\r\n rpcRequestsHandler: RpcRequestsHandler;\r\n\r\n /** Provider of active locale to use for localizing scopes */\r\n localeProvider?: () => string | undefined;\r\n}\r\n\r\n/**\r\n * A manager that knows available [selection scopes]($docs/presentation/unified-selection/index#selection-scopes)\r\n * and can compute logical selection based on element IDs and selection scope.\r\n *\r\n * @public\r\n */\r\nexport class SelectionScopesManager {\r\n\r\n private _rpcRequestsHandler: RpcRequestsHandler;\r\n private _getLocale: () => string | undefined;\r\n private _activeScope: SelectionScopeProps | SelectionScope | string | undefined;\r\n\r\n public constructor(props: SelectionScopesManagerProps) {\r\n this._rpcRequestsHandler = props.rpcRequestsHandler;\r\n this._getLocale = props.localeProvider ? props.localeProvider : (() => undefined);\r\n }\r\n\r\n /** Get active locale */\r\n public get activeLocale() { return this._getLocale(); }\r\n\r\n /** The active selection scope or its id */\r\n public get activeScope() { return this._activeScope; }\r\n public set activeScope(scope: SelectionScopeProps | SelectionScope | string | undefined) { this._activeScope = scope; }\r\n\r\n /**\r\n * Get available selection scopes.\r\n * @param imodel The iModel to get selection scopes for\r\n * @param locale Optional locale to use when localizing scopes' label and description\r\n */\r\n public async getSelectionScopes(imodel: IModelConnection, locale?: string): Promise<SelectionScope[]> {\r\n if (!locale)\r\n locale = this._getLocale();\r\n return this._rpcRequestsHandler.getSelectionScopes({ imodel: imodel.getRpcProps(), locale });\r\n }\r\n\r\n /**\r\n * Computes keys that need to be added to logical selection based on provided selection scope.\r\n * @param ids Element IDs to compute selection for\r\n * @param scope Selection scope to apply\r\n */\r\n public async computeSelection(imodel: IModelConnection, ids: Id64Arg, scope: SelectionScopeProps | SelectionScope | string): Promise<KeySet> {\r\n const scopeProps = createSelectionScopeProps(scope);\r\n\r\n // convert ids input to array\r\n if (typeof ids === \"string\")\r\n ids = [ids];\r\n else if (ids instanceof Set)\r\n ids = [...ids];\r\n\r\n // compute selection in batches to avoid HTTP 413\r\n const keys = new KeySet();\r\n const batchSize = DEFAULT_KEYS_BATCH_SIZE;\r\n const batchesCount = Math.ceil(ids.length / batchSize);\r\n const batchKeyPromises = [];\r\n for (let batchIndex = 0; batchIndex < batchesCount; ++batchIndex) {\r\n const batchStart = batchSize * batchIndex;\r\n const batchEnd = (batchStart + batchSize > ids.length) ? ids.length : (batchStart + batchSize);\r\n const batchIds = (0 === batchIndex && ids.length <= batchEnd) ? ids : ids.slice(batchStart, batchEnd);\r\n batchKeyPromises.push(this._rpcRequestsHandler.computeSelection({ imodel: imodel.getRpcProps(), elementIds: batchIds, scope: scopeProps }));\r\n }\r\n const batchKeys = (await Promise.all(batchKeyPromises)).map(KeySet.fromJSON);\r\n batchKeys.forEach((bk) => keys.add(bk));\r\n return keys;\r\n }\r\n}\r\n\r\n/**\r\n * Normalizes given scope options and returns [[ComputeSelectionScopeProps]] that can be used for\r\n * calculating selection with scope.\r\n *\r\n * @internal\r\n */\r\nexport function createSelectionScopeProps(scope: SelectionScopeProps | SelectionScope | string | undefined): SelectionScopeProps {\r\n if (!scope)\r\n return { id: \"element\" };\r\n if (typeof scope === \"string\")\r\n return { id: scope };\r\n return scope;\r\n}\r\n\r\n/**\r\n * Determines the scope id\r\n * @param scope Selection scope\r\n * @public\r\n * @deprecated This is an internal utility that should've never become public.\r\n */\r\n// istanbul ignore next\r\nexport function getScopeId(scope: SelectionScope | string | undefined): string {\r\n return createSelectionScopeProps(scope).id;\r\n}\r\n"]}
@@ -23,7 +23,7 @@ export * from "./presentation-frontend/FrontendLoggerCategory";
23
23
  * @module UnifiedSelection
24
24
  *
25
25
  * @docs-group-description UnifiedSelection
26
- * Types related to [unified selection]($docs/presentation/Unified-Selection/index.md).
26
+ * Types related to [unified selection]($docs/presentation/unified-selection/index.md).
27
27
  */
28
28
  export * from "./presentation-frontend/selection/SelectionChangeEvent";
29
29
  export * from "./presentation-frontend/selection/ISelectionProvider";
@@ -27,7 +27,7 @@ export * from "./presentation-frontend/FrontendLoggerCategory";
27
27
  * @module UnifiedSelection
28
28
  *
29
29
  * @docs-group-description UnifiedSelection
30
- * Types related to [unified selection]($docs/presentation/Unified-Selection/index.md).
30
+ * Types related to [unified selection]($docs/presentation/unified-selection/index.md).
31
31
  */
32
32
  export * from "./presentation-frontend/selection/SelectionChangeEvent";
33
33
  export * from "./presentation-frontend/selection/ISelectionProvider";
@@ -1 +1 @@
1
- {"version":3,"file":"presentation-frontend.js","sourceRoot":"","sources":["../../src/presentation-frontend.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;;;;GAKG;AACH,cAAc,sCAAsC,CAAC;AACrD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,wCAAwC,CAAC;AACvD,cAAc,iDAAiD,CAAC;AAChE,cAAc,uEAAuE,CAAC;AACtF,cAAc,uEAAuE,CAAC;AACtF,cAAc,sCAAsC,CAAC;AACrD,cAAc,qCAAqC,CAAC;AAEpD;;;;;GAKG;AACH,cAAc,gDAAgD,CAAC;AAE/D;;;;;GAKG;AACH,cAAc,wDAAwD,CAAC;AACvE,cAAc,sDAAsD,CAAC;AACrE,cAAc,oDAAoD,CAAC;AACnE,cAAc,0DAA0D,CAAC;AACzE,cAAc,oDAAoD,CAAC;AACnE,cAAc,qDAAqD,CAAC;AACpE,cAAc,mDAAmD,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/**\r\n * @module Core\r\n *\r\n * @docs-group-description Core\r\n * Common types used for retrieving presentation data from iModels.\r\n */\r\nexport * from \"./presentation-frontend/Presentation\";\r\nexport * from \"./presentation-frontend/PresentationManager\";\r\nexport * from \"./presentation-frontend/RulesetManager\";\r\nexport * from \"./presentation-frontend/RulesetVariablesManager\";\r\nexport * from \"./presentation-frontend/favorite-properties/FavoritePropertiesManager\";\r\nexport * from \"./presentation-frontend/favorite-properties/FavoritePropertiesStorage\";\r\nexport * from \"./presentation-frontend/StateTracker\";\r\nexport * from \"./presentation-frontend/Diagnostics\";\r\n\r\n/**\r\n * @module Logging\r\n *\r\n * @docs-group-description Logging\r\n * Types related to logging in this package.\r\n */\r\nexport * from \"./presentation-frontend/FrontendLoggerCategory\";\r\n\r\n/**\r\n * @module UnifiedSelection\r\n *\r\n * @docs-group-description UnifiedSelection\r\n * Types related to [unified selection]($docs/presentation/Unified-Selection/index.md).\r\n */\r\nexport * from \"./presentation-frontend/selection/SelectionChangeEvent\";\r\nexport * from \"./presentation-frontend/selection/ISelectionProvider\";\r\nexport * from \"./presentation-frontend/selection/SelectionManager\";\r\nexport * from \"./presentation-frontend/selection/SelectionScopesManager\";\r\nexport * from \"./presentation-frontend/selection/SelectionHandler\";\r\nexport * from \"./presentation-frontend/selection/HiliteSetProvider\";\r\nexport * from \"./presentation-frontend/selection/SelectionHelper\";\r\n"]}
1
+ {"version":3,"file":"presentation-frontend.js","sourceRoot":"","sources":["../../src/presentation-frontend.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;;;;GAKG;AACH,cAAc,sCAAsC,CAAC;AACrD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,wCAAwC,CAAC;AACvD,cAAc,iDAAiD,CAAC;AAChE,cAAc,uEAAuE,CAAC;AACtF,cAAc,uEAAuE,CAAC;AACtF,cAAc,sCAAsC,CAAC;AACrD,cAAc,qCAAqC,CAAC;AAEpD;;;;;GAKG;AACH,cAAc,gDAAgD,CAAC;AAE/D;;;;;GAKG;AACH,cAAc,wDAAwD,CAAC;AACvE,cAAc,sDAAsD,CAAC;AACrE,cAAc,oDAAoD,CAAC;AACnE,cAAc,0DAA0D,CAAC;AACzE,cAAc,oDAAoD,CAAC;AACnE,cAAc,qDAAqD,CAAC;AACpE,cAAc,mDAAmD,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/**\r\n * @module Core\r\n *\r\n * @docs-group-description Core\r\n * Common types used for retrieving presentation data from iModels.\r\n */\r\nexport * from \"./presentation-frontend/Presentation\";\r\nexport * from \"./presentation-frontend/PresentationManager\";\r\nexport * from \"./presentation-frontend/RulesetManager\";\r\nexport * from \"./presentation-frontend/RulesetVariablesManager\";\r\nexport * from \"./presentation-frontend/favorite-properties/FavoritePropertiesManager\";\r\nexport * from \"./presentation-frontend/favorite-properties/FavoritePropertiesStorage\";\r\nexport * from \"./presentation-frontend/StateTracker\";\r\nexport * from \"./presentation-frontend/Diagnostics\";\r\n\r\n/**\r\n * @module Logging\r\n *\r\n * @docs-group-description Logging\r\n * Types related to logging in this package.\r\n */\r\nexport * from \"./presentation-frontend/FrontendLoggerCategory\";\r\n\r\n/**\r\n * @module UnifiedSelection\r\n *\r\n * @docs-group-description UnifiedSelection\r\n * Types related to [unified selection]($docs/presentation/unified-selection/index.md).\r\n */\r\nexport * from \"./presentation-frontend/selection/SelectionChangeEvent\";\r\nexport * from \"./presentation-frontend/selection/ISelectionProvider\";\r\nexport * from \"./presentation-frontend/selection/SelectionManager\";\r\nexport * from \"./presentation-frontend/selection/SelectionScopesManager\";\r\nexport * from \"./presentation-frontend/selection/SelectionHandler\";\r\nexport * from \"./presentation-frontend/selection/HiliteSetProvider\";\r\nexport * from \"./presentation-frontend/selection/SelectionHelper\";\r\n"]}
package/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "name": "@itwin/presentation-frontend",
3
- "version": "3.2.0-dev.9",
3
+ "version": "3.2.2",
4
4
  "description": "Frontend of iModel.js Presentation library",
5
5
  "main": "lib/cjs/presentation-frontend.js",
6
6
  "module": "lib/esm/presentation-frontend.js",
7
7
  "typings": "lib/cjs/presentation-frontend",
8
- "imodeljsSharedLibrary": true,
9
8
  "license": "MIT",
10
9
  "repository": {
11
10
  "type": "git",
@@ -23,28 +22,28 @@
23
22
  "url": "http://www.bentley.com"
24
23
  },
25
24
  "peerDependencies": {
26
- "@itwin/core-bentley": "^3.2.0-dev.9",
27
- "@itwin/core-common": "^3.2.0-dev.9",
28
- "@itwin/core-frontend": "^3.2.0-dev.9",
29
- "@itwin/core-quantity": "^3.2.0-dev.9",
30
- "@itwin/presentation-common": "^3.2.0-dev.9"
25
+ "@itwin/core-bentley": "^3.2.2",
26
+ "@itwin/core-common": "^3.2.2",
27
+ "@itwin/core-frontend": "^3.2.2",
28
+ "@itwin/core-quantity": "^3.2.2",
29
+ "@itwin/presentation-common": "^3.2.2"
31
30
  },
32
31
  "devDependencies": {
33
- "@itwin/build-tools": "3.2.0-dev.9",
34
- "@itwin/core-bentley": "3.2.0-dev.9",
35
- "@itwin/core-common": "3.2.0-dev.9",
36
- "@itwin/core-frontend": "3.2.0-dev.9",
37
- "@itwin/core-i18n": "3.2.0-dev.9",
38
- "@itwin/core-quantity": "3.2.0-dev.9",
39
- "@itwin/eslint-plugin": "3.2.0-dev.9",
40
- "@itwin/presentation-common": "3.2.0-dev.9",
32
+ "@itwin/build-tools": "3.2.2",
33
+ "@itwin/core-bentley": "3.2.2",
34
+ "@itwin/core-common": "3.2.2",
35
+ "@itwin/core-frontend": "3.2.2",
36
+ "@itwin/core-i18n": "3.2.2",
37
+ "@itwin/core-quantity": "3.2.2",
38
+ "@itwin/eslint-plugin": "3.2.2",
39
+ "@itwin/presentation-common": "3.2.2",
41
40
  "@types/chai": "^4.1.4",
42
41
  "@types/chai-as-promised": "^7",
43
42
  "@types/chai-jest-snapshot": "^1.3.0",
44
43
  "@types/deep-equal": "^1",
45
44
  "@types/faker": "^4.1.0",
46
45
  "@types/mocha": "^8.2.2",
47
- "@types/node": "14.14.31",
46
+ "@types/node": "16.11.7",
48
47
  "@types/sinon": "^9.0.0",
49
48
  "@types/sinon-chai": "^3.2.0",
50
49
  "chai": "^4.1.2",
@@ -55,7 +54,7 @@
55
54
  "deep-equal": "^1",
56
55
  "eslint": "^7.11.0",
57
56
  "faker": "^4.1.0",
58
- "jsdom": "^17.0.0",
57
+ "jsdom": "^19.0.0",
59
58
  "jsdom-global": "3.0.2",
60
59
  "mocha": "^8.3.2",
61
60
  "nyc": "^15.1.0",