@tscircuit/core 0.0.613 → 0.0.614
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/index.d.ts +1 -0
- package/dist/index.js +48 -13
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -967,6 +967,7 @@ declare class NormalComponent<ZodProps extends z.ZodType = any, PortNames extend
|
|
|
967
967
|
initPorts(opts?: {
|
|
968
968
|
additionalAliases?: Record<`pin${number}`, string[]>;
|
|
969
969
|
pinCount?: number;
|
|
970
|
+
ignoreSymbolPorts?: boolean;
|
|
970
971
|
}): void;
|
|
971
972
|
_getImpliedFootprintString(): string | null;
|
|
972
973
|
_isFootprintUrl(s: string): boolean;
|
package/dist/index.js
CHANGED
|
@@ -6192,7 +6192,7 @@ var NormalComponent = class extends PrimitiveComponent2 {
|
|
|
6192
6192
|
}
|
|
6193
6193
|
}
|
|
6194
6194
|
}
|
|
6195
|
-
if (config.schematicSymbolName) {
|
|
6195
|
+
if (config.schematicSymbolName && !opts.ignoreSymbolPorts) {
|
|
6196
6196
|
const sym = symbols2[this._getSchematicSymbolNameOrThrow()];
|
|
6197
6197
|
if (!sym) return;
|
|
6198
6198
|
for (const symPort of sym.ports) {
|
|
@@ -6228,9 +6228,18 @@ var NormalComponent = class extends PrimitiveComponent2 {
|
|
|
6228
6228
|
}
|
|
6229
6229
|
}
|
|
6230
6230
|
}
|
|
6231
|
-
|
|
6232
|
-
|
|
6231
|
+
const requiredPinCount = opts.pinCount ?? this._getPinCount() ?? 0;
|
|
6232
|
+
for (let pn = 1; pn <= requiredPinCount; pn++) {
|
|
6233
6233
|
if (portsToCreate.find((p) => p._parsedProps.pinNumber === pn)) continue;
|
|
6234
|
+
if (!schPortArrangement) {
|
|
6235
|
+
portsToCreate.push(
|
|
6236
|
+
new Port({
|
|
6237
|
+
pinNumber: pn,
|
|
6238
|
+
aliases: opts.additionalAliases?.[`pin${pn}`] ?? []
|
|
6239
|
+
})
|
|
6240
|
+
);
|
|
6241
|
+
continue;
|
|
6242
|
+
}
|
|
6234
6243
|
let explicitlyListedPinNumbersInSchPortArrangement = [
|
|
6235
6244
|
...schPortArrangement.leftSide?.pins ?? [],
|
|
6236
6245
|
...schPortArrangement.rightSide?.pins ?? [],
|
|
@@ -10917,6 +10926,7 @@ var Potentiometer = class extends NormalComponent {
|
|
|
10917
10926
|
|
|
10918
10927
|
// lib/components/normal-components/PushButton.ts
|
|
10919
10928
|
import { pushButtonProps } from "@tscircuit/props";
|
|
10929
|
+
import { symbols as symbols3 } from "schematic-symbols";
|
|
10920
10930
|
var PushButton = class extends NormalComponent {
|
|
10921
10931
|
get config() {
|
|
10922
10932
|
return {
|
|
@@ -10927,19 +10937,44 @@ var PushButton = class extends NormalComponent {
|
|
|
10927
10937
|
};
|
|
10928
10938
|
}
|
|
10929
10939
|
get defaultInternallyConnectedPinNames() {
|
|
10930
|
-
return [
|
|
10931
|
-
["pin1", "pin4"],
|
|
10932
|
-
["pin2", "pin3"]
|
|
10933
|
-
];
|
|
10940
|
+
return [];
|
|
10934
10941
|
}
|
|
10935
10942
|
initPorts() {
|
|
10936
10943
|
super.initPorts({
|
|
10937
|
-
pinCount:
|
|
10938
|
-
|
|
10939
|
-
pin1: ["side1"],
|
|
10940
|
-
pin3: ["side2"]
|
|
10941
|
-
}
|
|
10944
|
+
pinCount: 2,
|
|
10945
|
+
ignoreSymbolPorts: true
|
|
10942
10946
|
});
|
|
10947
|
+
const symbol = symbols3[this._getSchematicSymbolNameOrThrow()];
|
|
10948
|
+
const symPort1 = symbol.ports.find((p) => p.labels.includes("1"));
|
|
10949
|
+
const symPort2 = symbol.ports.find((p) => p.labels.includes("2"));
|
|
10950
|
+
const ports = this.selectAll("port");
|
|
10951
|
+
const pin1Port = ports.find((p) => p.props.pinNumber === 1);
|
|
10952
|
+
const pin2Port = ports.find((p) => p.props.pinNumber === 2);
|
|
10953
|
+
const pin3Port = ports.find((p) => p.props.pinNumber === 3);
|
|
10954
|
+
const pin4Port = ports.find((p) => p.props.pinNumber === 4);
|
|
10955
|
+
const { internallyConnectedPins } = this._parsedProps;
|
|
10956
|
+
pin1Port.schematicSymbolPortDef = symPort1;
|
|
10957
|
+
if (!internallyConnectedPins || internallyConnectedPins.length === 0) {
|
|
10958
|
+
pin2Port.schematicSymbolPortDef = symPort2;
|
|
10959
|
+
}
|
|
10960
|
+
for (const [pn, port] of [
|
|
10961
|
+
[2, pin2Port],
|
|
10962
|
+
[3, pin3Port],
|
|
10963
|
+
[4, pin4Port]
|
|
10964
|
+
]) {
|
|
10965
|
+
const internallyConnectedRow = internallyConnectedPins?.find(
|
|
10966
|
+
([pin1, pin2]) => pin1 === `pin${pn}` || pin2 === `pin${pn}`
|
|
10967
|
+
);
|
|
10968
|
+
if (!internallyConnectedRow) {
|
|
10969
|
+
port.schematicSymbolPortDef = symPort2;
|
|
10970
|
+
break;
|
|
10971
|
+
}
|
|
10972
|
+
const internallyConnectedTo = internallyConnectedRow?.[0] === `pin${pn}` ? internallyConnectedRow[1] : internallyConnectedRow?.[0];
|
|
10973
|
+
if (internallyConnectedTo === "pin1") {
|
|
10974
|
+
continue;
|
|
10975
|
+
}
|
|
10976
|
+
port.schematicSymbolPortDef = symPort2;
|
|
10977
|
+
}
|
|
10943
10978
|
}
|
|
10944
10979
|
doInitialSourceRender() {
|
|
10945
10980
|
const { db } = this.root;
|
|
@@ -11612,7 +11647,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
11612
11647
|
var package_default = {
|
|
11613
11648
|
name: "@tscircuit/core",
|
|
11614
11649
|
type: "module",
|
|
11615
|
-
version: "0.0.
|
|
11650
|
+
version: "0.0.613",
|
|
11616
11651
|
types: "dist/index.d.ts",
|
|
11617
11652
|
main: "dist/index.js",
|
|
11618
11653
|
module: "dist/index.js",
|