@inweb/client 25.3.10 → 25.3.12

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.
package/dist/client.js CHANGED
@@ -118,10 +118,27 @@
118
118
  get name() {
119
119
  return this.data.name;
120
120
  }
121
+ /**
122
+ * Model owner type, matches the file extension this is model of the file, or `assembly` for
123
+ * assemblies.
124
+ *
125
+ * @readonly
126
+ */
127
+ get type() {
128
+ return this.file.type;
129
+ }
121
130
  // Reserved for future use.
122
131
  get version() {
123
132
  return this.data.version;
124
133
  }
134
+ /**
135
+ * Returns model list with one item `self`.
136
+ *
137
+ * @async
138
+ */
139
+ getModels() {
140
+ return Promise.resolve([this]);
141
+ }
125
142
  /**
126
143
  * Returns model viewpoint list.
127
144
  *
@@ -3663,7 +3680,7 @@
3663
3680
  .then((data) => ({
3664
3681
  ...data,
3665
3682
  server: data.version,
3666
- client: "25.3.10",
3683
+ client: "25.3.12",
3667
3684
  }));
3668
3685
  }
3669
3686
  /**
@@ -20938,32 +20955,32 @@
20938
20955
  * - {@link GeometryErrorEvent | geometryerror}
20939
20956
  *
20940
20957
  * @async
20941
- * @param model - Model instance to load. If a `File` instance with multiple models is
20942
- * specified, the default model will be loaded. If there is no default model, first
20943
- * availiable model will be loaded.
20958
+ * @param file - File or Assembly or Model instance to load. If a `File` instance with
20959
+ * multiple models is specified, the default model will be loaded. If there is no default
20960
+ * model, first availiable model will be loaded.
20944
20961
  */
20945
- async open(model) {
20946
- var _a, _b;
20962
+ async open(file) {
20947
20963
  if (!this.visualizeJs)
20948
20964
  return this;
20949
20965
  this.cancel();
20950
20966
  this.clear();
20951
- this.emitEvent({ type: "open", model });
20952
- if (model instanceof File$1 || model instanceof Assembly) {
20953
- const models = (_a = (await model.getModels())) !== null && _a !== void 0 ? _a : [];
20954
- model = (_b = models.find((model) => model.default)) !== null && _b !== void 0 ? _b : models[0];
20967
+ this.emitEvent({ type: "open", file, model: file });
20968
+ let model;
20969
+ if (file) {
20970
+ const models = (await file.getModels()) || [];
20971
+ model = models.find((model) => model.default) || models[0];
20955
20972
  }
20956
20973
  if (!model)
20957
20974
  throw new Error("No default model found");
20958
- await this.loadReferences(model);
20959
20975
  const overrideOptions = new Options();
20960
20976
  overrideOptions.data = this.options.data;
20961
- if (model.file.type === ".rcs") {
20977
+ if (file.type === ".rcs") {
20962
20978
  console.log("Partial load mode is forced for RCS file");
20963
20979
  overrideOptions.enablePartialMode = true;
20964
20980
  }
20965
20981
  const loaderFactory = new LoaderFactory();
20966
20982
  const loader = loaderFactory.create(this, model, overrideOptions.data);
20983
+ await this.loadReferences(model);
20967
20984
  await loader.load();
20968
20985
  if (this.visualizeJs) {
20969
20986
  this.applyModelTransformMatrix(model);
@@ -21530,7 +21547,7 @@
21530
21547
  commands("VisualizeJS").registerCommand("zoomToSelected", zoomToSelected);
21531
21548
 
21532
21549
  ///////////////////////////////////////////////////////////////////////////////
21533
- const version = "25.3.10";
21550
+ const version = "25.3.12";
21534
21551
 
21535
21552
  exports.Assembly = Assembly;
21536
21553
  exports.CANVAS_EVENTS = CANVAS_EVENTS;
@@ -21550,7 +21567,11 @@
21550
21567
  exports.Viewer = Viewer;
21551
21568
  exports.VisualizejsViewer = Viewer;
21552
21569
  exports.commands = commands;
21570
+ exports.parseArgs = parseArgs;
21571
+ exports.userFullName = userFullName;
21572
+ exports.userInitials = userInitials;
21553
21573
  exports.version = version;
21574
+ exports.waitFor = waitFor;
21554
21575
 
21555
21576
  Object.defineProperty(exports, '__esModule', { value: true });
21556
21577