@itwin/hypermodeling-frontend 5.0.0-dev.8 → 5.0.0-dev.82

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 +46 -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
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":"","sources":["../../src/Tools.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAkB,IAAI,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,gKAAgK;AAChK,SAAS,WAAW,CAAC,GAAuB;IAC1C,IAAI,SAAS,KAAK,GAAG;QACnB,OAAO,SAAS,CAAC;IAEnB,QAAQ,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC;QAC1B,KAAK,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC;QACvB,KAAK,KAAK,CAAC,CAAC,OAAO,KAAK,CAAC;QACzB,KAAK,QAAQ,CAAC,CAAC,OAAO,SAAS,CAAC;QAChC,OAAO,CAAC,CAAC,OAAO,GAAG,CAAC;IACtB,CAAC;AACH,CAAC;AAED,MAAM,iBAAkB,SAAQ,IAAI;IAE3B,MAAM,KAAc,OAAO,KAAK,OAAO,CAA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7C,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,oBAAoB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAkB,IAAI,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,gKAAgK;AAChK,SAAS,WAAW,CAAC,GAAuB;IAC1C,IAAI,SAAS,KAAK,GAAG;QACnB,OAAO,SAAS,CAAC;IAEnB,QAAQ,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC;QAC1B,KAAK,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC;QACvB,KAAK,KAAK,CAAC,CAAC,OAAO,KAAK,CAAC;QACzB,KAAK,QAAQ,CAAC,CAAC,OAAO,SAAS,CAAC;QAChC,OAAO,CAAC,CAAC,OAAO,GAAG,CAAC;IACtB,CAAC;AACH,CAAC;AAED,MAAM,iBAAkB,SAAQ,IAAI;IAC3B,MAAM,CAAU,MAAM,GAAG,eAAe,CAAC;IACzC,MAAM,KAAc,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3C,MAAM,KAAc,OAAO,KAAK,OAAO,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AK,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.8",
3
+ "version": "5.0.0-dev.82",
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.8",
26
- "@itwin/core-common": "^5.0.0-dev.8",
27
- "@itwin/core-frontend": "^5.0.0-dev.8",
28
- "@itwin/core-geometry": "^5.0.0-dev.8"
25
+ "@itwin/core-common": "5.0.0-dev.82",
26
+ "@itwin/core-bentley": "5.0.0-dev.82",
27
+ "@itwin/core-geometry": "5.0.0-dev.82",
28
+ "@itwin/core-frontend": "5.0.0-dev.82"
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/build-tools": "5.0.0-dev.8",
47
- "@itwin/core-bentley": "5.0.0-dev.8",
48
- "@itwin/core-common": "5.0.0-dev.8",
49
- "@itwin/core-frontend": "5.0.0-dev.8",
50
- "@itwin/certa": "5.0.0-dev.8",
51
- "@itwin/core-geometry": "5.0.0-dev.8"
45
+ "webpack": "^5.97.1",
46
+ "@itwin/core-geometry": "5.0.0-dev.82",
47
+ "@itwin/build-tools": "5.0.0-dev.82",
48
+ "@itwin/core-frontend": "5.0.0-dev.82",
49
+ "@itwin/core-bentley": "5.0.0-dev.82",
50
+ "@itwin/certa": "5.0.0-dev.82",
51
+ "@itwin/core-common": "5.0.0-dev.82"
52
52
  },
53
53
  "dependencies": {
54
- "@itwin/appui-abstract": "5.0.0-dev.8"
54
+ "@itwin/appui-abstract": "5.0.0-dev.82"
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",