@tscircuit/core 0.0.1115 → 0.0.1116
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 +18 -2
- 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
|
*/
|
|
@@ -18658,7 +18673,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
18658
18673
|
var package_default = {
|
|
18659
18674
|
name: "@tscircuit/core",
|
|
18660
18675
|
type: "module",
|
|
18661
|
-
version: "0.0.
|
|
18676
|
+
version: "0.0.1115",
|
|
18662
18677
|
types: "dist/index.d.ts",
|
|
18663
18678
|
main: "dist/index.js",
|
|
18664
18679
|
module: "dist/index.js",
|
|
@@ -23091,10 +23106,11 @@ var SchematicText = class extends PrimitiveComponent2 {
|
|
|
23091
23106
|
const { _parsedProps: props } = this;
|
|
23092
23107
|
const globalPos = this._getGlobalSchematicPositionBeforeLayout();
|
|
23093
23108
|
const schematic_symbol_id = this._getSymbolAncestor()?.schematic_symbol_id;
|
|
23109
|
+
const text = this._resolveText();
|
|
23094
23110
|
const schematic_text = db.schematic_text.insert({
|
|
23095
23111
|
schematic_symbol_id,
|
|
23096
23112
|
anchor: props.anchor ?? "center",
|
|
23097
|
-
text: normalizeTextForCircuitJson(
|
|
23113
|
+
text: normalizeTextForCircuitJson(text),
|
|
23098
23114
|
font_size: props.fontSize,
|
|
23099
23115
|
color: props.color || "#000000",
|
|
23100
23116
|
position: {
|