@tscircuit/core 0.0.1115 → 0.0.1117
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 +5 -0
- package/dist/index.js +21 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -564,6 +564,11 @@ declare abstract class PrimitiveComponent<ZodProps extends ZodType = any> extend
|
|
|
564
564
|
* like Symbol in the hierarchy.
|
|
565
565
|
*/
|
|
566
566
|
getParentNormalComponent(): any | null;
|
|
567
|
+
/**
|
|
568
|
+
* Replaces text like {NAME}, {REF}, and {REFERENCE} with the
|
|
569
|
+
* reference designator (name) of the parent NormalComponent.
|
|
570
|
+
*/
|
|
571
|
+
protected _resolveText(): string;
|
|
567
572
|
/**
|
|
568
573
|
* Emit a warning when coveredWithSolderMask is true but solderMaskMargin is also set
|
|
569
574
|
*/
|
package/dist/index.js
CHANGED
|
@@ -1509,6 +1509,21 @@ var PrimitiveComponent2 = class extends Renderable {
|
|
|
1509
1509
|
}
|
|
1510
1510
|
return null;
|
|
1511
1511
|
}
|
|
1512
|
+
/**
|
|
1513
|
+
* Replaces text like {NAME}, {REF}, and {REFERENCE} with the
|
|
1514
|
+
* reference designator (name) of the parent NormalComponent.
|
|
1515
|
+
*/
|
|
1516
|
+
_resolveText() {
|
|
1517
|
+
const text = this._parsedProps.text;
|
|
1518
|
+
if (!text) return "";
|
|
1519
|
+
if (!text.includes("{NAME}") && !text.includes("{REF}") && !text.includes("{REFERENCE}")) {
|
|
1520
|
+
return text;
|
|
1521
|
+
}
|
|
1522
|
+
const parentNormalComponent = this.getParentNormalComponent();
|
|
1523
|
+
const refdes = parentNormalComponent?.name;
|
|
1524
|
+
if (!refdes) return text;
|
|
1525
|
+
return text.replace(/\{NAME\}/g, refdes).replace(/\{REF\}/g, refdes).replace(/\{REFERENCE\}/g, refdes);
|
|
1526
|
+
}
|
|
1512
1527
|
/**
|
|
1513
1528
|
* Emit a warning when coveredWithSolderMask is true but solderMaskMargin is also set
|
|
1514
1529
|
*/
|
|
@@ -7274,6 +7289,7 @@ var SilkscreenText = class extends PrimitiveComponent2 {
|
|
|
7274
7289
|
top: props.knockoutPaddingTop ?? uniformPadding,
|
|
7275
7290
|
bottom: props.knockoutPaddingBottom ?? uniformPadding
|
|
7276
7291
|
} : void 0;
|
|
7292
|
+
const text = this._resolveText();
|
|
7277
7293
|
for (const layer of targetLayers) {
|
|
7278
7294
|
const pcb_silkscreen_text = db.pcb_silkscreen_text.insert({
|
|
7279
7295
|
anchor_alignment: props.anchorAlignment,
|
|
@@ -7284,7 +7300,7 @@ var SilkscreenText = class extends PrimitiveComponent2 {
|
|
|
7284
7300
|
font: props.font ?? "tscircuit2024",
|
|
7285
7301
|
font_size: fontSize,
|
|
7286
7302
|
layer: maybeFlipLayer(layer),
|
|
7287
|
-
text: normalizeTextForCircuitJson(
|
|
7303
|
+
text: normalizeTextForCircuitJson(text),
|
|
7288
7304
|
ccw_rotation: rotation4,
|
|
7289
7305
|
pcb_component_id: container.pcb_component_id,
|
|
7290
7306
|
subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
|
|
@@ -7306,7 +7322,7 @@ var SilkscreenText = class extends PrimitiveComponent2 {
|
|
|
7306
7322
|
component: this
|
|
7307
7323
|
});
|
|
7308
7324
|
const fontSize = props.fontSize ?? resolvedPcbSxFontSize ?? this.getInheritedProperty("pcbStyle")?.silkscreenFontSize ?? this._footprinterFontSize ?? 1;
|
|
7309
|
-
const text =
|
|
7325
|
+
const text = this._resolveText();
|
|
7310
7326
|
const textWidth = text.length * fontSize;
|
|
7311
7327
|
const textHeight = fontSize;
|
|
7312
7328
|
return { width: textWidth * fontSize, height: textHeight * fontSize };
|
|
@@ -18658,7 +18674,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
18658
18674
|
var package_default = {
|
|
18659
18675
|
name: "@tscircuit/core",
|
|
18660
18676
|
type: "module",
|
|
18661
|
-
version: "0.0.
|
|
18677
|
+
version: "0.0.1116",
|
|
18662
18678
|
types: "dist/index.d.ts",
|
|
18663
18679
|
main: "dist/index.js",
|
|
18664
18680
|
module: "dist/index.js",
|
|
@@ -23091,10 +23107,11 @@ var SchematicText = class extends PrimitiveComponent2 {
|
|
|
23091
23107
|
const { _parsedProps: props } = this;
|
|
23092
23108
|
const globalPos = this._getGlobalSchematicPositionBeforeLayout();
|
|
23093
23109
|
const schematic_symbol_id = this._getSymbolAncestor()?.schematic_symbol_id;
|
|
23110
|
+
const text = this._resolveText();
|
|
23094
23111
|
const schematic_text = db.schematic_text.insert({
|
|
23095
23112
|
schematic_symbol_id,
|
|
23096
23113
|
anchor: props.anchor ?? "center",
|
|
23097
|
-
text: normalizeTextForCircuitJson(
|
|
23114
|
+
text: normalizeTextForCircuitJson(text),
|
|
23098
23115
|
font_size: props.fontSize,
|
|
23099
23116
|
color: props.color || "#000000",
|
|
23100
23117
|
position: {
|