@itwin/hypermodeling-frontend 5.0.0-dev.10 → 5.0.0-dev.102

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 (36) hide show
  1. package/CHANGELOG.md +56 -1
  2. package/lib/cjs/HyperModeling.js +7 -4
  3. package/lib/cjs/HyperModeling.js.map +1 -1
  4. package/lib/cjs/HyperModelingDecorator.d.ts +1 -1
  5. package/lib/cjs/HyperModelingDecorator.d.ts.map +1 -1
  6. package/lib/cjs/HyperModelingDecorator.js +21 -9
  7. package/lib/cjs/HyperModelingDecorator.js.map +1 -1
  8. package/lib/cjs/PopupToolbar.js +13 -11
  9. package/lib/cjs/PopupToolbar.js.map +1 -1
  10. package/lib/cjs/SectionDrawingLocationState.js +28 -0
  11. package/lib/cjs/SectionDrawingLocationState.js.map +1 -1
  12. package/lib/cjs/SectionGraphicsProvider.d.ts.map +1 -1
  13. package/lib/cjs/SectionGraphicsProvider.js +14 -0
  14. package/lib/cjs/SectionGraphicsProvider.js.map +1 -1
  15. package/lib/cjs/SectionMarkers.js +11 -7
  16. package/lib/cjs/SectionMarkers.js.map +1 -1
  17. package/lib/cjs/Tools.js +4 -4
  18. package/lib/cjs/Tools.js.map +1 -1
  19. package/lib/esm/HyperModeling.js +7 -4
  20. package/lib/esm/HyperModeling.js.map +1 -1
  21. package/lib/esm/HyperModelingDecorator.d.ts +1 -1
  22. package/lib/esm/HyperModelingDecorator.d.ts.map +1 -1
  23. package/lib/esm/HyperModelingDecorator.js +21 -9
  24. package/lib/esm/HyperModelingDecorator.js.map +1 -1
  25. package/lib/esm/PopupToolbar.js +13 -11
  26. package/lib/esm/PopupToolbar.js.map +1 -1
  27. package/lib/esm/SectionDrawingLocationState.js +28 -0
  28. package/lib/esm/SectionDrawingLocationState.js.map +1 -1
  29. package/lib/esm/SectionGraphicsProvider.d.ts.map +1 -1
  30. package/lib/esm/SectionGraphicsProvider.js +14 -0
  31. package/lib/esm/SectionGraphicsProvider.js.map +1 -1
  32. package/lib/esm/SectionMarkers.js +11 -7
  33. package/lib/esm/SectionMarkers.js.map +1 -1
  34. package/lib/esm/Tools.js +4 -4
  35. package/lib/esm/Tools.js.map +1 -1
  36. package/package.json +21 -21
@@ -1 +1 @@
1
- {"version":3,"file":"SectionMarkers.js","sourceRoot":"","sources":["../../src/SectionMarkers.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,OAAO,EAAc,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAiB,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EACL,QAAQ,EAA2C,SAAS,EAAE,WAAW,EAAE,MAAM,EAAe,SAAS,EAAkB,YAAY,GACxI,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,OAAO,aAAc,SAAQ,MAAM;IAYvC;;;;;;OAMG;IACH,YAAmB,KAAkC;QACnD,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,UAAU,CAAC,CAAC;QAfpD,gBAAgB;QACA,sBAAiB,GAAG,IAAI,OAAO,EAAmC,CAAC;QACnF,gBAAgB;QACA,uBAAkB,GAAG,IAAI,OAAO,EAAmC,CAAC;QACpF,gBAAgB;QACR,cAAS,GAAG,KAAK,CAAC;QAWxB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QAEnB,MAAM,IAAI,GAAG,aAAa,CAAC,aAAa,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAC5D,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC;QAC9B,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AO,gBAAiB,SAAQ,SAAwB;IAG5D;;;;OAIG;IACH,YAAmB,QAAwB,EAAE,OAAwB;QACnE,KAAK,CAAC,QAAQ,CAAC,CAAC;QARF,uBAAkB,GAAG,CAAC,CAAC;QASrC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,KAAK,QAAQ,CAAC,MAAM;gBACzC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IAED,6DAA6D;IAC7D,IAAoB,QAAQ;QAC1B,MAAM,CAAC,SAAS,KAAK,KAAK,CAAC,QAAQ,CAAC,CAAC;QACrC,OAAO,KAAK,CAAC,QAAQ,CAAC;IACxB,CAAC;IAED,gBAAgB;IACN,gBAAgB,CAAC,OAA+B;QACxD,OAAO,IAAI,oBAAoB,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAC5H,CAAC;IAED,mGAAmG;IAC5F,cAAc,CAAC,wBAAoC;QACxD,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO;YAC/B,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,wBAAwB;gBAC9C,OAAO,MAAM,CAAC;QAElB,OAAO,SAAS,CAAC;IACnB,CAAC;CACF","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 HyperModeling\r\n */\r\n\r\nimport { assert, BeEvent, Id64String } from \"@itwin/core-bentley\";\r\nimport { Point2d, Point3d, XAndY, XYAndZ } from \"@itwin/core-geometry\";\r\nimport { IModelReadRpcInterface } from \"@itwin/core-common\";\r\nimport {\r\n BeButton, BeButtonEvent, Cluster, DecorateContext, IModelApp, InputSource, Marker, MarkerImage, MarkerSet, ScreenViewport, ViewClipTool,\r\n} from \"@itwin/core-frontend\";\r\nimport { SectionDrawingLocationState } from \"./SectionDrawingLocationState\";\r\nimport { HyperModeling } from \"./HyperModeling\";\r\n\r\nconst markerSize = Point2d.create(40, 40);\r\n\r\n/** A [Marker]($frontend) associated with a [[SectionDrawingLocationState]], displayed as a canvas decoration at the location of the section.\r\n * Clicking on the marker toggles display of the section graphics. Mousing over the marker produces a toolbar with additional interactions.\r\n * @see [[HyperModelingDecorator]] for a [Decorator]($frontend) capable of displaying section markers for each section drawing location.\r\n * @see [[SectionMarkerHandler]] to customize the marker interactions.\r\n * @public\r\n */\r\nexport class SectionMarker extends Marker {\r\n /** The section drawing location state associated with the marker. */\r\n public readonly state: SectionDrawingLocationState;\r\n /** A description displayed as part of the tooltip when this marker is clustered with other markers. */\r\n public readonly description: string;\r\n /** @internal */\r\n public readonly onMouseEnterEvent = new BeEvent<(marker: SectionMarker) => void>();\r\n /** @internal */\r\n public readonly onMouseButtonEvent = new BeEvent<(marker: SectionMarker) => void>();\r\n /** @internal */\r\n private _isActive = false;\r\n\r\n /** Constructor, typically invoked indirectly via [[HyperModelingDecorator]].\r\n * @param state The section drawing location state this marker will represent.\r\n * @param pos The world coordinates at which to display the marker.\r\n * @param description A brief description of this marker, used as part of the tooltip when this marker is part of a cluster.\r\n * @param icon The icon displayed by the marker.\r\n * @param tooltip Optional detailed tooltip displayed on mouse hover. If undefined, the `description` is used instead.\r\n */\r\n public constructor(state: SectionDrawingLocationState) {\r\n super(state.placement.origin.clone(), markerSize);\r\n this.state = state;\r\n\r\n const data = HyperModeling.getMarkerData(state.sectionType);\r\n this.description = data.label;\r\n if (data.image)\r\n this.setImage(data.image);\r\n\r\n this.setScaleFactor({ low: .2, high: 1.4 }); // make size 20% at back of frustum and 140% at front of frustum (if camera is on)\r\n }\r\n\r\n /** @internal */\r\n public get isHilited(): boolean { return this._isHilited; }\r\n\r\n /** Returns true if this is the \"active\" section marker. At most one marker is active at a given time.\r\n * @see [[HyperModelingDecorator.activeMarker]].\r\n * @see [[HyperModelingDecorator.setActiveMarker]].\r\n * @see [[SectionMarkerHandler.toggleMarker]].\r\n */\r\n public get isActive(): boolean {\r\n return this._isActive;\r\n }\r\n\r\n /** @internal */\r\n public setActive(active: boolean): void {\r\n this._isActive = active;\r\n }\r\n\r\n /** @internal */\r\n protected drawActive(ctx: CanvasRenderingContext2D) {\r\n ctx.shadowBlur = 30;\r\n ctx.shadowColor = \"gold\";\r\n return false;\r\n }\r\n\r\n /** @internal */\r\n public override drawDecoration(ctx: CanvasRenderingContext2D): void {\r\n if (!this.isActive || !this.drawActive(ctx))\r\n super.drawDecoration(ctx);\r\n }\r\n\r\n /** @internal */\r\n public override onMouseEnter(ev: BeButtonEvent) {\r\n // Lazily load the tooltip.\r\n if (undefined === this.title) {\r\n IModelReadRpcInterface.getClientForRouting(this.state.iModel.routingContext.token).getToolTipMessage(this.state.iModel.getRpcProps(), this.state.id).then((tooltipMsg) => {\r\n this.title = IModelApp.formatElementToolTip(tooltipMsg);\r\n }).catch((_) => {\r\n this.title = this.description;\r\n });\r\n }\r\n\r\n super.onMouseEnter(ev);\r\n this.onMouseEnterEvent.raiseEvent(this);\r\n }\r\n\r\n /** @internal */\r\n public override onMouseButton(ev: BeButtonEvent): boolean {\r\n if (InputSource.Mouse === ev.inputSource && BeButton.Data === ev.button && ev.isDown && ev.viewport)\r\n this.onMouseButtonEvent.raiseEvent(this);\r\n\r\n return true; // Don't allow clicks to be sent to active tool...\r\n }\r\n\r\n /** @internal */\r\n public override addMarker(context: DecorateContext) {\r\n super.addMarker(context);\r\n if (this.isHilited)\r\n ViewClipTool.drawClip(context, this.state.clip, undefined, { fillClipPlanes: true, hasPrimaryPlane: true });\r\n }\r\n}\r\n\r\n/** A Marker used to show a cluster of section locations.\r\n * @internal\r\n */\r\nexport class SectionMarkerCluster extends Marker {\r\n /** Create a new cluster marker */\r\n constructor(location: XYAndZ, size: XAndY, cluster: Cluster<SectionMarker>, image: MarkerImage | Promise<MarkerImage> | undefined) {\r\n super(location, size);\r\n\r\n this.imageOffset = new Point3d(0, 30);\r\n this.label = cluster.markers.length.toLocaleString();\r\n this.labelColor = \"black\";\r\n this.labelFont = \"bold 14px sans-serif\";\r\n\r\n const maxLen = 10;\r\n let title = \"\";\r\n cluster.markers.forEach((marker, index: number) => {\r\n if (index < maxLen) {\r\n if (title !== \"\")\r\n title += \"<br>\";\r\n title += marker.description;\r\n }\r\n });\r\n\r\n if (cluster.markers.length > maxLen)\r\n title += \"<br>...\";\r\n\r\n const div = document.createElement(\"div\");\r\n div.innerHTML = title;\r\n this.title = div;\r\n if (image)\r\n this.setImage(image);\r\n }\r\n\r\n /** Show the cluster as a white circle with an outline */\r\n public override drawFunc(ctx: CanvasRenderingContext2D): void {\r\n ctx.beginPath();\r\n ctx.strokeStyle = \"#372528\";\r\n ctx.fillStyle = \"white\";\r\n ctx.lineWidth = 5;\r\n ctx.arc(0, 0, 13, 0, Math.PI * 2);\r\n ctx.fill();\r\n ctx.stroke();\r\n }\r\n\r\n public override onMouseButton(_ev: BeButtonEvent): boolean { return true; } // Don't allow clicks to be sent to active tool...\r\n}\r\n\r\n/** A [MarkerSet]($frontend) containing [[SectionMarker]]s identifying [SectionDrawingLocation]($backend)s within a spatial view.\r\n * Typically used indirectly via [[HyperModelingDecorator]].\r\n * @public\r\n */\r\nexport class SectionMarkerSet extends MarkerSet<SectionMarker> {\r\n public override minimumClusterSize = 5;\r\n\r\n /** Constructor\r\n * @param viewport The viewport in which the markers are to be displayed.\r\n * @param markers The markers to be displayed.\r\n * @note Each marker's [[SectionDrawingLocationState]] must be associated with the same [IModelConnection]($frontend) as the viewport; any markers from other iModels will be omitted.\r\n */\r\n public constructor(viewport: ScreenViewport, markers: SectionMarker[]) {\r\n super(viewport);\r\n for (const marker of markers) {\r\n if (marker.state.iModel === viewport.iModel)\r\n this.markers.add(marker);\r\n }\r\n }\r\n\r\n /** The viewport in which the markers are to be displayed. */\r\n public override get viewport(): ScreenViewport {\r\n assert(undefined !== super.viewport);\r\n return super.viewport;\r\n }\r\n\r\n /** @internal */\r\n protected getClusterMarker(cluster: Cluster<SectionMarker>): Marker {\r\n return new SectionMarkerCluster(cluster.getClusterLocation(), cluster.markers[0].size, cluster, cluster.markers[0].image);\r\n }\r\n\r\n /** Find the SectionMarker corresponding to the specified [SectionDrawingLocation]($backend) Id. */\r\n public findMarkerById(sectionDrawingLocationId: Id64String): SectionMarker | undefined {\r\n for (const marker of this.markers)\r\n if (marker.state.id === sectionDrawingLocationId)\r\n return marker;\r\n\r\n return undefined;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"SectionMarkers.js","sourceRoot":"","sources":["../../src/SectionMarkers.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,OAAO,EAAc,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAiB,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EACL,QAAQ,EAA2C,SAAS,EAAE,WAAW,EAAE,MAAM,EAAe,SAAS,EAAkB,YAAY,GACxI,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,OAAO,aAAc,SAAQ,MAAM;IACvC,qEAAqE;IACrD,KAAK,CAA8B;IACnD,uGAAuG;IACvF,WAAW,CAAS;IACpC,gBAAgB;IACA,iBAAiB,GAAG,IAAI,OAAO,EAAmC,CAAC;IACnF,gBAAgB;IACA,kBAAkB,GAA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CAAC,KAAK,CAAC,EAAE,KAAK,wBAAwB;gBAC9C,OAAO,MAAM,CAAC;QAElB,OAAO,SAAS,CAAC;IACnB,CAAC;CACF","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 HyperModeling\r\n */\r\n\r\nimport { assert, BeEvent, Id64String } from \"@itwin/core-bentley\";\r\nimport { Point2d, Point3d, XAndY, XYAndZ } from \"@itwin/core-geometry\";\r\nimport { IModelReadRpcInterface } from \"@itwin/core-common\";\r\nimport {\r\n BeButton, BeButtonEvent, Cluster, DecorateContext, IModelApp, InputSource, Marker, MarkerImage, MarkerSet, ScreenViewport, ViewClipTool,\r\n} from \"@itwin/core-frontend\";\r\nimport { SectionDrawingLocationState } from \"./SectionDrawingLocationState\";\r\nimport { HyperModeling } from \"./HyperModeling\";\r\n\r\nconst markerSize = Point2d.create(40, 40);\r\n\r\n/** A [Marker]($frontend) associated with a [[SectionDrawingLocationState]], displayed as a canvas decoration at the location of the section.\r\n * Clicking on the marker toggles display of the section graphics. Mousing over the marker produces a toolbar with additional interactions.\r\n * @see [[HyperModelingDecorator]] for a [Decorator]($frontend) capable of displaying section markers for each section drawing location.\r\n * @see [[SectionMarkerHandler]] to customize the marker interactions.\r\n * @public\r\n */\r\nexport class SectionMarker extends Marker {\r\n /** The section drawing location state associated with the marker. */\r\n public readonly state: SectionDrawingLocationState;\r\n /** A description displayed as part of the tooltip when this marker is clustered with other markers. */\r\n public readonly description: string;\r\n /** @internal */\r\n public readonly onMouseEnterEvent = new BeEvent<(marker: SectionMarker) => void>();\r\n /** @internal */\r\n public readonly onMouseButtonEvent = new BeEvent<(marker: SectionMarker) => void>();\r\n /** @internal */\r\n private _isActive = false;\r\n\r\n /** Constructor, typically invoked indirectly via [[HyperModelingDecorator]].\r\n * @param state The section drawing location state this marker will represent.\r\n * @param pos The world coordinates at which to display the marker.\r\n * @param description A brief description of this marker, used as part of the tooltip when this marker is part of a cluster.\r\n * @param icon The icon displayed by the marker.\r\n * @param tooltip Optional detailed tooltip displayed on mouse hover. If undefined, the `description` is used instead.\r\n */\r\n public constructor(state: SectionDrawingLocationState) {\r\n super(state.placement.origin.clone(), markerSize);\r\n this.state = state;\r\n\r\n const data = HyperModeling.getMarkerData(state.sectionType);\r\n this.description = data.label;\r\n if (data.image)\r\n this.setImage(data.image);\r\n\r\n this.setScaleFactor({ low: .2, high: 1.4 }); // make size 20% at back of frustum and 140% at front of frustum (if camera is on)\r\n }\r\n\r\n /** @internal */\r\n public get isHilited(): boolean { return this._isHilited; }\r\n\r\n /** Returns true if this is the \"active\" section marker. At most one marker is active at a given time.\r\n * @see [[HyperModelingDecorator.activeMarker]].\r\n * @see [[HyperModelingDecorator.setActiveMarker]].\r\n * @see [[SectionMarkerHandler.toggleMarker]].\r\n */\r\n public get isActive(): boolean {\r\n return this._isActive;\r\n }\r\n\r\n /** @internal */\r\n public setActive(active: boolean): void {\r\n this._isActive = active;\r\n }\r\n\r\n /** @internal */\r\n protected drawActive(ctx: CanvasRenderingContext2D) {\r\n ctx.shadowBlur = 30;\r\n ctx.shadowColor = \"gold\";\r\n return false;\r\n }\r\n\r\n /** @internal */\r\n public override drawDecoration(ctx: CanvasRenderingContext2D): void {\r\n if (!this.isActive || !this.drawActive(ctx))\r\n super.drawDecoration(ctx);\r\n }\r\n\r\n /** @internal */\r\n public override onMouseEnter(ev: BeButtonEvent) {\r\n // Lazily load the tooltip.\r\n if (undefined === this.title) {\r\n IModelReadRpcInterface.getClientForRouting(this.state.iModel.routingContext.token).getToolTipMessage(this.state.iModel.getRpcProps(), this.state.id).then((tooltipMsg) => {\r\n this.title = IModelApp.formatElementToolTip(tooltipMsg);\r\n }).catch((_) => {\r\n this.title = this.description;\r\n });\r\n }\r\n\r\n super.onMouseEnter(ev);\r\n this.onMouseEnterEvent.raiseEvent(this);\r\n }\r\n\r\n /** @internal */\r\n public override onMouseButton(ev: BeButtonEvent): boolean {\r\n if (InputSource.Mouse === ev.inputSource && BeButton.Data === ev.button && ev.isDown && ev.viewport)\r\n this.onMouseButtonEvent.raiseEvent(this);\r\n\r\n return true; // Don't allow clicks to be sent to active tool...\r\n }\r\n\r\n /** @internal */\r\n public override addMarker(context: DecorateContext) {\r\n super.addMarker(context);\r\n if (this.isHilited)\r\n ViewClipTool.drawClip(context, this.state.clip, undefined, { fillClipPlanes: true, hasPrimaryPlane: true });\r\n }\r\n}\r\n\r\n/** A Marker used to show a cluster of section locations.\r\n * @internal\r\n */\r\nexport class SectionMarkerCluster extends Marker {\r\n /** Create a new cluster marker */\r\n constructor(location: XYAndZ, size: XAndY, cluster: Cluster<SectionMarker>, image: MarkerImage | Promise<MarkerImage> | undefined) {\r\n super(location, size);\r\n\r\n this.imageOffset = new Point3d(0, 30);\r\n this.label = cluster.markers.length.toLocaleString();\r\n this.labelColor = \"black\";\r\n this.labelFont = \"bold 14px sans-serif\";\r\n\r\n const maxLen = 10;\r\n let title = \"\";\r\n cluster.markers.forEach((marker, index: number) => {\r\n if (index < maxLen) {\r\n if (title !== \"\")\r\n title += \"<br>\";\r\n title += marker.description;\r\n }\r\n });\r\n\r\n if (cluster.markers.length > maxLen)\r\n title += \"<br>...\";\r\n\r\n const div = document.createElement(\"div\");\r\n div.innerHTML = title;\r\n this.title = div;\r\n if (image)\r\n this.setImage(image);\r\n }\r\n\r\n /** Show the cluster as a white circle with an outline */\r\n public override drawFunc(ctx: CanvasRenderingContext2D): void {\r\n ctx.beginPath();\r\n ctx.strokeStyle = \"#372528\";\r\n ctx.fillStyle = \"white\";\r\n ctx.lineWidth = 5;\r\n ctx.arc(0, 0, 13, 0, Math.PI * 2);\r\n ctx.fill();\r\n ctx.stroke();\r\n }\r\n\r\n public override onMouseButton(_ev: BeButtonEvent): boolean { return true; } // Don't allow clicks to be sent to active tool...\r\n}\r\n\r\n/** A [MarkerSet]($frontend) containing [[SectionMarker]]s identifying [SectionDrawingLocation]($backend)s within a spatial view.\r\n * Typically used indirectly via [[HyperModelingDecorator]].\r\n * @public\r\n */\r\nexport class SectionMarkerSet extends MarkerSet<SectionMarker> {\r\n public override minimumClusterSize = 5;\r\n\r\n /** Constructor\r\n * @param viewport The viewport in which the markers are to be displayed.\r\n * @param markers The markers to be displayed.\r\n * @note Each marker's [[SectionDrawingLocationState]] must be associated with the same [IModelConnection]($frontend) as the viewport; any markers from other iModels will be omitted.\r\n */\r\n public constructor(viewport: ScreenViewport, markers: SectionMarker[]) {\r\n super(viewport);\r\n for (const marker of markers) {\r\n if (marker.state.iModel === viewport.iModel)\r\n this.markers.add(marker);\r\n }\r\n }\r\n\r\n /** The viewport in which the markers are to be displayed. */\r\n public override get viewport(): ScreenViewport {\r\n assert(undefined !== super.viewport);\r\n return super.viewport;\r\n }\r\n\r\n /** @internal */\r\n protected getClusterMarker(cluster: Cluster<SectionMarker>): Marker {\r\n return new SectionMarkerCluster(cluster.getClusterLocation(), cluster.markers[0].size, cluster, cluster.markers[0].image);\r\n }\r\n\r\n /** Find the SectionMarker corresponding to the specified [SectionDrawingLocation]($backend) Id. */\r\n public findMarkerById(sectionDrawingLocationId: Id64String): SectionMarker | undefined {\r\n for (const marker of this.markers)\r\n if (marker.state.id === sectionDrawingLocationId)\r\n return marker;\r\n\r\n return undefined;\r\n }\r\n}\r\n"]}
package/lib/esm/Tools.js CHANGED
@@ -21,6 +21,7 @@ function parseToggle(arg) {
21
21
  }
22
22
  }
23
23
  class HyperModelingTool extends Tool {
24
+ static toolId = "HyperModeling";
24
25
  static get minArgs() { return 0; }
25
26
  static get maxArgs() { return 1; }
26
27
  async run(enable, vp) {
@@ -34,7 +35,6 @@ class HyperModelingTool extends Tool {
34
35
  return typeof enable !== "string" && this.run(enable);
35
36
  }
36
37
  }
37
- HyperModelingTool.toolId = "HyperModeling";
38
38
  /** Configures how section graphics are displayed. These are global settings. If no arguments are supplied, the defaults are restored.
39
39
  * Otherwise, each argument is of the form "name=value" where value is 0 (disable) or 1 (enable). Only the first letter of each argument matters.
40
40
  * - drawings: Whether to display the section drawing graphics. Default: 1.
@@ -43,6 +43,7 @@ HyperModelingTool.toolId = "HyperModeling";
43
43
  * - boundaries: Whether to display clip volumes as boundary shapes for debugging purposes. Default: 0.
44
44
  */
45
45
  class SectionGraphicsConfigTool extends Tool {
46
+ static toolId = "HyperModeling.Graphics.Config";
46
47
  static get minArgs() { return 0; }
47
48
  static get maxArgs() { return 4; }
48
49
  async run(config) {
@@ -87,7 +88,6 @@ class SectionGraphicsConfigTool extends Tool {
87
88
  return this.run(config);
88
89
  }
89
90
  }
90
- SectionGraphicsConfigTool.toolId = "HyperModeling.Graphics.Config";
91
91
  class SectionMarkerConfigTool extends Tool {
92
92
  static get minArgs() { return 0; }
93
93
  static get maxArgs() { return 3; }
@@ -142,12 +142,13 @@ class SectionMarkerConfigTool extends Tool {
142
142
  }
143
143
  }
144
144
  class SectionMarkerDefaultConfigTool extends SectionMarkerConfigTool {
145
+ static toolId = "HyperModeling.Marker.Default.Config";
145
146
  update(config) {
146
147
  HyperModeling.updateConfiguration({ markers: config });
147
148
  }
148
149
  }
149
- SectionMarkerDefaultConfigTool.toolId = "HyperModeling.Marker.Default.Config";
150
150
  class SectionMarkerDecoratorConfigTool extends SectionMarkerConfigTool {
151
+ static toolId = "HyperModeling.Marker.Config";
151
152
  update(config) {
152
153
  const vp = IModelApp.viewManager.selectedView;
153
154
  const decorator = vp ? HyperModelingDecorator.getForViewport(vp) : undefined;
@@ -155,7 +156,6 @@ class SectionMarkerDecoratorConfigTool extends SectionMarkerConfigTool {
155
156
  decorator.updateConfiguration(config);
156
157
  }
157
158
  }
158
- SectionMarkerDecoratorConfigTool.toolId = "HyperModeling.Marker.Config";
159
159
  /** @internal */
160
160
  export function registerTools(namespace) {
161
161
  const register = (tool) => IModelApp.tools.register(tool, namespace);
@@ -1 +1 @@
1
- {"version":3,"file":"Tools.js","sourceRoot":"","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oBAED,MAAM;gBACR,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC1B,CAAC;CACF;AAED,MAAM,8BAA+B,SAAQ,uBAAuB;IAGxD,MAAM,CAAC,MAA2B;QAC1C,aAAa,CAAC,mBAAmB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IACzD,CAAC;;AAJsB,qCAAM,GAAG,qCAAqC,CAAC;AAOxE,MAAM,gCAAiC,SAAQ,uBAAuB;IAG1D,MAAM,CAAC,MAA2B;QAC1C,MAAM,EAAE,GAAG,SAAS,CAAC,WAAW,CAAC,YAAY,CAAC;QAC9C,MAAM,SAAS,GAAG,EAAE,CAAC,CAAC,CAAC,sBAAsB,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC7E,IAAI,SAAS;YACX,SAAS,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;;AAPsB,uCAAM,GAAG,6BAA6B,CAAC;AAUhE,gBAAgB;AAChB,MAAM,UAAU,aAAa,CAAC,SAAiB;IAC7C,MAAM,QAAQ,GAAG,CAAC,IAAiB,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAClF,QAAQ,CAAC,iBAAiB,CAAC,CAAC;IAC5B,QAAQ,CAAC,yBAAyB,CAAC,CAAC;IACpC,QAAQ,CAAC,gCAAgC,CAAC,CAAC;IAC3C,QAAQ,CAAC,8BAA8B,CAAC,CAAC;AAC3C,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 HyperModeling\r\n */\r\n\r\nimport { SectionType } from \"@itwin/core-common\";\r\nimport { IModelApp, ScreenViewport, Tool } from \"@itwin/core-frontend\";\r\nimport { HyperModeling } from \"./HyperModeling\";\r\nimport { SectionGraphicsConfig, SectionMarkerConfig } from \"./HyperModelingConfig\";\r\nimport { HyperModelingDecorator } from \"./HyperModelingDecorator\";\r\n\r\n/** Parses a string case-insensitively returning true for \"ON\", false for \"OFF\", undefined for \"TOGGLE\" or undefined, and the input string for anything else. */\r\nfunction parseToggle(arg: string | undefined): string | boolean | undefined {\r\n if (undefined === arg)\r\n return undefined;\r\n\r\n switch (arg.toLowerCase()) {\r\n case \"on\": return true;\r\n case \"off\": return false;\r\n case \"toggle\": return undefined;\r\n default: return arg;\r\n }\r\n}\r\n\r\nclass HyperModelingTool extends Tool {\r\n public static override toolId = \"HyperModeling\";\r\n public static override get minArgs() { return 0; }\r\n public static override get maxArgs() { return 1; }\r\n\r\n public override async run(enable?: boolean, vp?: ScreenViewport): Promise<boolean> {\r\n vp = vp ?? IModelApp.viewManager.selectedView;\r\n if (vp)\r\n await HyperModeling.startOrStop(vp, enable);\r\n\r\n return true;\r\n }\r\n\r\n public override async parseAndRun(...args: string[]): Promise<boolean> {\r\n const enable = parseToggle(args[0]);\r\n return typeof enable !== \"string\" && this.run(enable);\r\n }\r\n}\r\n\r\ntype Writeable<T> = { -readonly [P in keyof T]: T[P] };\r\n\r\n/** Configures how section graphics are displayed. These are global settings. If no arguments are supplied, the defaults are restored.\r\n * Otherwise, each argument is of the form \"name=value\" where value is 0 (disable) or 1 (enable). Only the first letter of each argument matters.\r\n * - drawings: Whether to display the section drawing graphics. Default: 1.\r\n * - sheets: Whether to display the sheet annotation graphics. Default: 1.\r\n * - clip: Whether to apply clip volumes to the 2d graphics. Default: 1.\r\n * - boundaries: Whether to display clip volumes as boundary shapes for debugging purposes. Default: 0.\r\n */\r\nclass SectionGraphicsConfigTool extends Tool {\r\n public static override toolId = \"HyperModeling.Graphics.Config\";\r\n public static override get minArgs() { return 0; }\r\n public static override get maxArgs() { return 4; }\r\n\r\n public override async run(config?: SectionGraphicsConfig): Promise<boolean> {\r\n if (!config) {\r\n config = {\r\n ignoreClip: false,\r\n debugClipVolumes: false,\r\n hideSectionGraphics: false,\r\n hideSheetAnnotations: false,\r\n };\r\n }\r\n\r\n HyperModeling.updateConfiguration({ graphics: config });\r\n return true;\r\n }\r\n\r\n public override async parseAndRun(...args: string[]): Promise<boolean> {\r\n if (0 === args.length)\r\n return this.run(); // restore defaults...\r\n\r\n const config: Writeable<SectionGraphicsConfig> = {};\r\n for (const arg of args) {\r\n const parts = arg.toLowerCase().split(\"=\");\r\n if (2 !== parts.length)\r\n continue;\r\n\r\n const value = Number.parseInt(parts[1], 10);\r\n if (Number.isNaN(value) || (0 !== value && 1 !== value))\r\n continue;\r\n\r\n const enable = 1 === value;\r\n switch (parts[0][0]) {\r\n case \"d\":\r\n config.hideSectionGraphics = !enable;\r\n break;\r\n case \"s\":\r\n config.hideSheetAnnotations = !enable;\r\n break;\r\n case \"c\":\r\n config.ignoreClip = !enable;\r\n break;\r\n case \"b\":\r\n config.debugClipVolumes = enable;\r\n break;\r\n }\r\n }\r\n\r\n return this.run(config);\r\n }\r\n}\r\n\r\nabstract class SectionMarkerConfigTool extends Tool {\r\n public static override get minArgs() { return 0; }\r\n public static override get maxArgs() { return 3; }\r\n\r\n protected abstract update(config: SectionMarkerConfig): void;\r\n\r\n public override async run(config?: SectionMarkerConfig): Promise<boolean> {\r\n config = config ?? { ignoreModelSelector: false, ignoreCategorySelector: false, hiddenSectionTypes: [] };\r\n this.update(config);\r\n return true;\r\n }\r\n\r\n public override async parseAndRun(...args: string[]): Promise<boolean> {\r\n if (0 === args.length)\r\n return this.run(); // restore defaults...\r\n\r\n const config: Writeable<SectionMarkerConfig> = {};\r\n for (const arg of args) {\r\n const parts = arg.toLowerCase().split(\"=\");\r\n if (2 !== parts.length)\r\n continue;\r\n\r\n const setting = parts[0][0];\r\n switch (setting) {\r\n case \"h\": {\r\n config.hiddenSectionTypes = [];\r\n for (const c of parts[1]) {\r\n switch (c) {\r\n case \"s\":\r\n config.hiddenSectionTypes.push(SectionType.Section);\r\n break;\r\n case \"d\":\r\n config.hiddenSectionTypes.push(SectionType.Detail);\r\n break;\r\n case \"e\":\r\n config.hiddenSectionTypes.push(SectionType.Elevation);\r\n break;\r\n case \"p\":\r\n config.hiddenSectionTypes.push(SectionType.Plan);\r\n break;\r\n }\r\n }\r\n\r\n break;\r\n }\r\n default: {\r\n const intVal = Number.parseInt(parts[1], 10);\r\n if (!Number.isNaN(intVal) && (0 === intVal || 1 === intVal)) {\r\n if (\"c\" === setting)\r\n config.ignoreCategorySelector = 0 === intVal;\r\n else if (\"m\" === setting)\r\n config.ignoreModelSelector = 0 === intVal;\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return this.run(config);\r\n }\r\n}\r\n\r\nclass SectionMarkerDefaultConfigTool extends SectionMarkerConfigTool {\r\n public static override toolId = \"HyperModeling.Marker.Default.Config\";\r\n\r\n protected update(config: SectionMarkerConfig): void {\r\n HyperModeling.updateConfiguration({ markers: config });\r\n }\r\n}\r\n\r\nclass SectionMarkerDecoratorConfigTool extends SectionMarkerConfigTool {\r\n public static override toolId = \"HyperModeling.Marker.Config\";\r\n\r\n protected update(config: SectionMarkerConfig): void {\r\n const vp = IModelApp.viewManager.selectedView;\r\n const decorator = vp ? HyperModelingDecorator.getForViewport(vp) : undefined;\r\n if (decorator)\r\n decorator.updateConfiguration(config);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport function registerTools(namespace: string): void {\r\n const register = (tool: typeof Tool) => IModelApp.tools.register(tool, namespace);\r\n register(HyperModelingTool);\r\n register(SectionGraphicsConfigTool);\r\n register(SectionMarkerDecoratorConfigTool);\r\n register(SectionMarkerDefaultConfigTool);\r\n}\r\n"]}
1
+ {"version":3,"file":"Tools.js","sourceRoot":"","sources":["../../src/Tools.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,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AAC,CAAC;IAC1B,CAAC;CACF;AAED,MAAM,8BAA+B,SAAQ,uBAAuB;IAC3D,MAAM,CAAU,MAAM,GAAG,qCAAqC,CAAC;IAE5D,MAAM,CAAC,MAA2B;QAC1C,aAAa,CAAC,mBAAmB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IACzD,CAAC;;AAGH,MAAM,gCAAiC,SAAQ,uBAAuB;IAC7D,MAAM,CAAU,MAAM,GAAG,6BAA6B,CAAC;IAEpD,MAAM,CAAC,MAA2B;QAC1C,MAAM,EAAE,GAAG,SAAS,CAAC,WAAW,CAAC,YAAY,CAAC;QAC9C,MAAM,SAAS,GAAG,EAAE,CAAC,CAAC,CAAC,sBAAsB,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC7E,IAAI,SAAS;YACX,SAAS,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;;AAGH,gBAAgB;AAChB,MAAM,UAAU,aAAa,CAAC,SAAiB;IAC7C,MAAM,QAAQ,GAAG,CAAC,IAAiB,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAClF,QAAQ,CAAC,iBAAiB,CAAC,CAAC;IAC5B,QAAQ,CAAC,yBAAyB,CAAC,CAAC;IACpC,QAAQ,CAAC,gCAAgC,CAAC,CAAC;IAC3C,QAAQ,CAAC,8BAA8B,CAAC,CAAC;AAC3C,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 HyperModeling\r\n */\r\n\r\nimport { SectionType } from \"@itwin/core-common\";\r\nimport { IModelApp, ScreenViewport, Tool } from \"@itwin/core-frontend\";\r\nimport { HyperModeling } from \"./HyperModeling\";\r\nimport { SectionGraphicsConfig, SectionMarkerConfig } from \"./HyperModelingConfig\";\r\nimport { HyperModelingDecorator } from \"./HyperModelingDecorator\";\r\n\r\n/** Parses a string case-insensitively returning true for \"ON\", false for \"OFF\", undefined for \"TOGGLE\" or undefined, and the input string for anything else. */\r\nfunction parseToggle(arg: string | undefined): string | boolean | undefined {\r\n if (undefined === arg)\r\n return undefined;\r\n\r\n switch (arg.toLowerCase()) {\r\n case \"on\": return true;\r\n case \"off\": return false;\r\n case \"toggle\": return undefined;\r\n default: return arg;\r\n }\r\n}\r\n\r\nclass HyperModelingTool extends Tool {\r\n public static override toolId = \"HyperModeling\";\r\n public static override get minArgs() { return 0; }\r\n public static override get maxArgs() { return 1; }\r\n\r\n public override async run(enable?: boolean, vp?: ScreenViewport): Promise<boolean> {\r\n vp = vp ?? IModelApp.viewManager.selectedView;\r\n if (vp)\r\n await HyperModeling.startOrStop(vp, enable);\r\n\r\n return true;\r\n }\r\n\r\n public override async parseAndRun(...args: string[]): Promise<boolean> {\r\n const enable = parseToggle(args[0]);\r\n return typeof enable !== \"string\" && this.run(enable);\r\n }\r\n}\r\n\r\ntype Writeable<T> = { -readonly [P in keyof T]: T[P] };\r\n\r\n/** Configures how section graphics are displayed. These are global settings. If no arguments are supplied, the defaults are restored.\r\n * Otherwise, each argument is of the form \"name=value\" where value is 0 (disable) or 1 (enable). Only the first letter of each argument matters.\r\n * - drawings: Whether to display the section drawing graphics. Default: 1.\r\n * - sheets: Whether to display the sheet annotation graphics. Default: 1.\r\n * - clip: Whether to apply clip volumes to the 2d graphics. Default: 1.\r\n * - boundaries: Whether to display clip volumes as boundary shapes for debugging purposes. Default: 0.\r\n */\r\nclass SectionGraphicsConfigTool extends Tool {\r\n public static override toolId = \"HyperModeling.Graphics.Config\";\r\n public static override get minArgs() { return 0; }\r\n public static override get maxArgs() { return 4; }\r\n\r\n public override async run(config?: SectionGraphicsConfig): Promise<boolean> {\r\n if (!config) {\r\n config = {\r\n ignoreClip: false,\r\n debugClipVolumes: false,\r\n hideSectionGraphics: false,\r\n hideSheetAnnotations: false,\r\n };\r\n }\r\n\r\n HyperModeling.updateConfiguration({ graphics: config });\r\n return true;\r\n }\r\n\r\n public override async parseAndRun(...args: string[]): Promise<boolean> {\r\n if (0 === args.length)\r\n return this.run(); // restore defaults...\r\n\r\n const config: Writeable<SectionGraphicsConfig> = {};\r\n for (const arg of args) {\r\n const parts = arg.toLowerCase().split(\"=\");\r\n if (2 !== parts.length)\r\n continue;\r\n\r\n const value = Number.parseInt(parts[1], 10);\r\n if (Number.isNaN(value) || (0 !== value && 1 !== value))\r\n continue;\r\n\r\n const enable = 1 === value;\r\n switch (parts[0][0]) {\r\n case \"d\":\r\n config.hideSectionGraphics = !enable;\r\n break;\r\n case \"s\":\r\n config.hideSheetAnnotations = !enable;\r\n break;\r\n case \"c\":\r\n config.ignoreClip = !enable;\r\n break;\r\n case \"b\":\r\n config.debugClipVolumes = enable;\r\n break;\r\n }\r\n }\r\n\r\n return this.run(config);\r\n }\r\n}\r\n\r\nabstract class SectionMarkerConfigTool extends Tool {\r\n public static override get minArgs() { return 0; }\r\n public static override get maxArgs() { return 3; }\r\n\r\n protected abstract update(config: SectionMarkerConfig): void;\r\n\r\n public override async run(config?: SectionMarkerConfig): Promise<boolean> {\r\n config = config ?? { ignoreModelSelector: false, ignoreCategorySelector: false, hiddenSectionTypes: [] };\r\n this.update(config);\r\n return true;\r\n }\r\n\r\n public override async parseAndRun(...args: string[]): Promise<boolean> {\r\n if (0 === args.length)\r\n return this.run(); // restore defaults...\r\n\r\n const config: Writeable<SectionMarkerConfig> = {};\r\n for (const arg of args) {\r\n const parts = arg.toLowerCase().split(\"=\");\r\n if (2 !== parts.length)\r\n continue;\r\n\r\n const setting = parts[0][0];\r\n switch (setting) {\r\n case \"h\": {\r\n config.hiddenSectionTypes = [];\r\n for (const c of parts[1]) {\r\n switch (c) {\r\n case \"s\":\r\n config.hiddenSectionTypes.push(SectionType.Section);\r\n break;\r\n case \"d\":\r\n config.hiddenSectionTypes.push(SectionType.Detail);\r\n break;\r\n case \"e\":\r\n config.hiddenSectionTypes.push(SectionType.Elevation);\r\n break;\r\n case \"p\":\r\n config.hiddenSectionTypes.push(SectionType.Plan);\r\n break;\r\n }\r\n }\r\n\r\n break;\r\n }\r\n default: {\r\n const intVal = Number.parseInt(parts[1], 10);\r\n if (!Number.isNaN(intVal) && (0 === intVal || 1 === intVal)) {\r\n if (\"c\" === setting)\r\n config.ignoreCategorySelector = 0 === intVal;\r\n else if (\"m\" === setting)\r\n config.ignoreModelSelector = 0 === intVal;\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return this.run(config);\r\n }\r\n}\r\n\r\nclass SectionMarkerDefaultConfigTool extends SectionMarkerConfigTool {\r\n public static override toolId = \"HyperModeling.Marker.Default.Config\";\r\n\r\n protected update(config: SectionMarkerConfig): void {\r\n HyperModeling.updateConfiguration({ markers: config });\r\n }\r\n}\r\n\r\nclass SectionMarkerDecoratorConfigTool extends SectionMarkerConfigTool {\r\n public static override toolId = \"HyperModeling.Marker.Config\";\r\n\r\n protected update(config: SectionMarkerConfig): void {\r\n const vp = IModelApp.viewManager.selectedView;\r\n const decorator = vp ? HyperModelingDecorator.getForViewport(vp) : undefined;\r\n if (decorator)\r\n decorator.updateConfiguration(config);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport function registerTools(namespace: string): void {\r\n const register = (tool: typeof Tool) => IModelApp.tools.register(tool, namespace);\r\n register(HyperModelingTool);\r\n register(SectionGraphicsConfigTool);\r\n register(SectionMarkerDecoratorConfigTool);\r\n register(SectionMarkerDefaultConfigTool);\r\n}\r\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/hypermodeling-frontend",
3
- "version": "5.0.0-dev.10",
3
+ "version": "5.0.0-dev.102",
4
4
  "description": "iTwin.js hypermodeling package",
5
5
  "main": "lib/cjs/hypermodeling-frontend.js",
6
6
  "module": "lib/esm/hypermodeling-frontend.js",
@@ -22,36 +22,36 @@
22
22
  "url": "http://www.bentley.com"
23
23
  },
24
24
  "peerDependencies": {
25
- "@itwin/core-bentley": "^5.0.0-dev.10",
26
- "@itwin/core-common": "^5.0.0-dev.10",
27
- "@itwin/core-frontend": "^5.0.0-dev.10",
28
- "@itwin/core-geometry": "^5.0.0-dev.10"
25
+ "@itwin/core-bentley": "5.0.0-dev.102",
26
+ "@itwin/core-common": "5.0.0-dev.102",
27
+ "@itwin/core-geometry": "5.0.0-dev.102",
28
+ "@itwin/core-frontend": "5.0.0-dev.102"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@itwin/eslint-plugin": "5.0.0-dev.1",
32
32
  "@types/chai": "4.3.1",
33
33
  "@types/mocha": "^10.0.6",
34
34
  "babel-loader": "~8.2.5",
35
- "babel-plugin-istanbul": "~6.1.1",
35
+ "babel-plugin-istanbul": "^7.0.0",
36
36
  "chai": "^4.3.10",
37
- "cpx2": "^3.0.0",
37
+ "cpx2": "^8.0.0",
38
38
  "eslint": "^9.13.0",
39
39
  "glob": "^10.3.12",
40
- "mocha": "^10.2.0",
41
- "nyc": "^15.1.0",
42
- "rimraf": "^3.0.2",
43
- "source-map-loader": "^4.0.0",
40
+ "mocha": "^11.1.0",
41
+ "nyc": "^17.1.0",
42
+ "rimraf": "^6.0.1",
43
+ "source-map-loader": "^5.0.0",
44
44
  "typescript": "~5.6.2",
45
- "webpack": "^5.76.0",
46
- "@itwin/core-common": "5.0.0-dev.10",
47
- "@itwin/build-tools": "5.0.0-dev.10",
48
- "@itwin/core-frontend": "5.0.0-dev.10",
49
- "@itwin/core-bentley": "5.0.0-dev.10",
50
- "@itwin/core-geometry": "5.0.0-dev.10",
51
- "@itwin/certa": "5.0.0-dev.10"
45
+ "webpack": "^5.97.1",
46
+ "@itwin/build-tools": "5.0.0-dev.102",
47
+ "@itwin/core-geometry": "5.0.0-dev.102",
48
+ "@itwin/core-common": "5.0.0-dev.102",
49
+ "@itwin/core-bentley": "5.0.0-dev.102",
50
+ "@itwin/core-frontend": "5.0.0-dev.102",
51
+ "@itwin/certa": "5.0.0-dev.102"
52
52
  },
53
53
  "dependencies": {
54
- "@itwin/appui-abstract": "5.0.0-dev.10"
54
+ "@itwin/appui-abstract": "5.0.0-dev.102"
55
55
  },
56
56
  "nyc": {
57
57
  "extends": "./node_modules/@itwin/build-tools/.nycrc"
@@ -59,8 +59,8 @@
59
59
  "scripts": {
60
60
  "build": "npm run -s copy:public && npm run -s build:cjs && npm run -s build:esm",
61
61
  "build:cjs": "tsc 1>&2 --outDir lib/cjs",
62
- "build:esm": "tsc 1>&2 --module ES2020 --outDir lib/esm",
63
- "clean": "rimraf lib .rush/temp/package-deps*.json",
62
+ "build:esm": "tsc 1>&2 --module ES2022 --outDir lib/esm",
63
+ "clean": "rimraf -g lib .rush/temp/package-deps*.json",
64
64
  "copy:public": "cpx \"./src/public/**/*\" ./lib/public",
65
65
  "cover": "npm -s test",
66
66
  "docs": "betools docs --json=../../generated-docs/core/hypermodeling-frontend/file.json --tsIndexFile=./hypermodeling-frontend.ts --onlyJson",