@huaqiu/dsh-hardware-ui 0.7.17 → 0.7.18

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/lib/client.js CHANGED
@@ -319,7 +319,7 @@ window.__ModuleLoader__.load({
319
319
  if (destination === "schematic" || destination === "pcb" || destination === "bom" || destination === "3d") return "kicad";
320
320
  }
321
321
  //#endregion
322
- //#region ../../node_modules/.pnpm/@huaqiu+kicad-sexpr-parser@0.1.2/node_modules/@huaqiu/kicad-sexpr-parser/dist/index.mjs
322
+ //#region ../../node_modules/.pnpm/@huaqiu+kicad-sexpr-parser@0.1.3/node_modules/@huaqiu/kicad-sexpr-parser/dist/index.mjs
323
323
  var __defProp$2 = Object.defineProperty;
324
324
  var __defProps = Object.defineProperties;
325
325
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
@@ -2095,7 +2095,7 @@ ${indent})`;
2095
2095
  USLedger: [431.8, 279.4]
2096
2096
  };
2097
2097
  //#endregion
2098
- //#region ../../node_modules/.pnpm/@huaqiu+kicad-sexpr-parser@0.1.1/node_modules/@huaqiu/kicad-sexpr-parser/dist/index.mjs
2098
+ //#region ../../node_modules/.pnpm/@huaqiu+kicad-sexpr-parser@0.1.2/node_modules/@huaqiu/kicad-sexpr-parser/dist/index.mjs
2099
2099
  var __defProp$1 = Object.defineProperty;
2100
2100
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
2101
2101
  var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
@@ -2664,7 +2664,7 @@ Context: ${error_context(input, i)}`);
2664
2664
  USLedger: [431.8, 279.4]
2665
2665
  };
2666
2666
  //#endregion
2667
- //#region ../../node_modules/.pnpm/@huaqiu+ecad-renderer@0.2.5/node_modules/@huaqiu/ecad-renderer/dist/index.js
2667
+ //#region ../../node_modules/.pnpm/@huaqiu+ecad-renderer@0.2.6/node_modules/@huaqiu/ecad-renderer/dist/index.js
2668
2668
  var __create = Object.create;
2669
2669
  var __defProp = Object.defineProperty;
2670
2670
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -7939,9 +7939,9 @@ while (n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3]
7939
7939
  this.drawings = [];
7940
7940
  if (data.drawings) {
7941
7941
  for (const d of data.drawings) if ("pts" in d && d.pts) this.drawings.push(new Polyline2(d, this));
7942
- else if ("mid" in d && d.mid || "radius" in d && d.radius) this.drawings.push(new Arc3(d, this));
7943
- else if ("start" in d && d.start) this.drawings.push(new Rectangle(d, this));
7944
7942
  else if ("center" in d && d.center) this.drawings.push(new Circle2(d, this));
7943
+ else if ("start" in d && d.start && ("mid" in d && d.mid || "radius" in d && d.radius)) this.drawings.push(new Arc3(d, this));
7944
+ else if ("start" in d && d.start) this.drawings.push(new Rectangle(d, this));
7945
7945
  else if ("text" in d && d.text) this.drawings.push(new LibText(d, this));
7946
7946
  else if ("size" in d && d.size) this.drawings.push(new TextBox(d, this));
7947
7947
  else if ("pts" in d && d.pts) this.drawings.push(new Bezier(d, this));
@@ -8132,6 +8132,7 @@ while (n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3]
8132
8132
  this.uuid = data.uuid;
8133
8133
  this.properties = new Map(data.properties?.map((p) => [p.name, new Property(p, this)]));
8134
8134
  this.pins = data.pins?.map((p) => new PinInstance(p, this)) ?? [];
8135
+ if (this.pins.length === 0) this.pins = this.#pins_from_lib_symbol();
8135
8136
  this.default_instance = data.default_instance;
8136
8137
  for (const project of data.instances?.projects ?? []) for (const path of project?.paths ?? []) {
8137
8138
  const inst = new SchematicSymbolInstance();
@@ -8204,6 +8205,29 @@ while (n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3]
8204
8205
  return true;
8205
8206
  });
8206
8207
  }
8208
+ /**
8209
+ * Derive pins from the library symbol (including its unit/body-style
8210
+ * child symbols) when the instance doesn't record any.
8211
+ */
8212
+ #pins_from_lib_symbol() {
8213
+ const lib = this.parent.lib_symbols?.by_name(this.lib_name ?? this.lib_id);
8214
+ if (!lib) return [];
8215
+ const style = this.convert ?? 1;
8216
+ const definitions = [];
8217
+ const collect = (symbol) => {
8218
+ definitions.push(...symbol.pins);
8219
+ for (const child of symbol.children) if (child.style == 0 || child.style == style) collect(child);
8220
+ };
8221
+ collect(lib);
8222
+ return definitions.filter((def) => {
8223
+ const unit = def.unit;
8224
+ return !this.unit || !unit || this.unit == unit;
8225
+ }).map((def) => new PinInstance({
8226
+ number: def.number.text,
8227
+ uuid: `${this.uuid}:${def.number.text}`,
8228
+ alternate: ""
8229
+ }, this));
8230
+ }
8207
8231
  resolve_text_var(name) {
8208
8232
  if (this.properties.has(name)) return this.properties.get(name)?.shown_text;
8209
8233
  switch (name) {