@tscircuit/core 0.0.2170 → 0.0.2171
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 +53 -2
- package/dist/index.js +33 -10
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -3966,7 +3966,7 @@ interface ISymbol {
|
|
|
3966
3966
|
* The computed bounds of the symbol's schematic primitives before any
|
|
3967
3967
|
* resizing is applied.
|
|
3968
3968
|
*/
|
|
3969
|
-
|
|
3969
|
+
schematicSymbolBoundsInSymbolLocalCoordinateSpace?: SchematicSymbolBounds;
|
|
3970
3970
|
/**
|
|
3971
3971
|
* Get the bounds of the symbol's schematic primitives.
|
|
3972
3972
|
* This triggers computation if not already done.
|
|
@@ -195115,24 +195115,75 @@ declare class SymbolComponent extends PrimitiveComponent<typeof symbolProps> imp
|
|
|
195115
195115
|
isPrimitiveContainer: boolean;
|
|
195116
195116
|
schematic_symbol_id?: string;
|
|
195117
195117
|
userCoordinateToResizedSymbolTransformMat?: Matrix;
|
|
195118
|
-
|
|
195118
|
+
schematicSymbolBoundsInSymbolLocalCoordinateSpace?: SchematicSymbolBounds;
|
|
195119
195119
|
get config(): {
|
|
195120
195120
|
componentName: string;
|
|
195121
195121
|
zodProps: zod.ZodObject<{
|
|
195122
195122
|
originalFacingDirection: zod.ZodOptional<zod.ZodDefault<zod.ZodEnum<["up", "down", "left", "right"]>>>;
|
|
195123
195123
|
width: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
195124
195124
|
height: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
195125
|
+
fit: zod.ZodOptional<zod.ZodEnum<["fill", "contain", "stretch"]>>;
|
|
195126
|
+
viewbox: zod.ZodOptional<zod.ZodEffects<zod.ZodEffects<zod.ZodObject<{
|
|
195127
|
+
minX: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
195128
|
+
maxX: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
195129
|
+
minY: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
195130
|
+
maxY: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
195131
|
+
}, "strip", zod.ZodTypeAny, {
|
|
195132
|
+
minX: number;
|
|
195133
|
+
maxX: number;
|
|
195134
|
+
minY: number;
|
|
195135
|
+
maxY: number;
|
|
195136
|
+
}, {
|
|
195137
|
+
minX: string | number;
|
|
195138
|
+
maxX: string | number;
|
|
195139
|
+
minY: string | number;
|
|
195140
|
+
maxY: string | number;
|
|
195141
|
+
}>, {
|
|
195142
|
+
minX: number;
|
|
195143
|
+
maxX: number;
|
|
195144
|
+
minY: number;
|
|
195145
|
+
maxY: number;
|
|
195146
|
+
}, {
|
|
195147
|
+
minX: string | number;
|
|
195148
|
+
maxX: string | number;
|
|
195149
|
+
minY: string | number;
|
|
195150
|
+
maxY: string | number;
|
|
195151
|
+
}>, {
|
|
195152
|
+
minX: number;
|
|
195153
|
+
maxX: number;
|
|
195154
|
+
minY: number;
|
|
195155
|
+
maxY: number;
|
|
195156
|
+
}, {
|
|
195157
|
+
minX: string | number;
|
|
195158
|
+
maxX: string | number;
|
|
195159
|
+
minY: string | number;
|
|
195160
|
+
maxY: string | number;
|
|
195161
|
+
}>>;
|
|
195125
195162
|
name: zod.ZodOptional<zod.ZodString>;
|
|
195126
195163
|
}, "strip", zod.ZodTypeAny, {
|
|
195127
195164
|
width?: number | undefined;
|
|
195128
195165
|
height?: number | undefined;
|
|
195129
195166
|
name?: string | undefined;
|
|
195130
195167
|
originalFacingDirection?: "up" | "down" | "left" | "right" | undefined;
|
|
195168
|
+
fit?: "fill" | "stretch" | "contain" | undefined;
|
|
195169
|
+
viewbox?: {
|
|
195170
|
+
minX: number;
|
|
195171
|
+
maxX: number;
|
|
195172
|
+
minY: number;
|
|
195173
|
+
maxY: number;
|
|
195174
|
+
} | undefined;
|
|
195131
195175
|
}, {
|
|
195132
195176
|
width?: string | number | undefined;
|
|
195133
195177
|
height?: string | number | undefined;
|
|
195134
195178
|
name?: string | undefined;
|
|
195135
195179
|
originalFacingDirection?: "up" | "down" | "left" | "right" | undefined;
|
|
195180
|
+
fit?: "fill" | "stretch" | "contain" | undefined;
|
|
195181
|
+
viewbox?: {
|
|
195182
|
+
minX: string | number;
|
|
195183
|
+
maxX: string | number;
|
|
195184
|
+
minY: string | number;
|
|
195185
|
+
maxY: string | number;
|
|
195186
|
+
} | undefined;
|
|
195136
195187
|
}>;
|
|
195137
195188
|
};
|
|
195138
195189
|
hasExplicitSize(): boolean;
|
package/dist/index.js
CHANGED
|
@@ -14023,7 +14023,7 @@ var SymbolComponent = class extends PrimitiveComponent2 {
|
|
|
14023
14023
|
isPrimitiveContainer = true;
|
|
14024
14024
|
schematic_symbol_id;
|
|
14025
14025
|
userCoordinateToResizedSymbolTransformMat;
|
|
14026
|
-
|
|
14026
|
+
schematicSymbolBoundsInSymbolLocalCoordinateSpace;
|
|
14027
14027
|
get config() {
|
|
14028
14028
|
return {
|
|
14029
14029
|
componentName: "Symbol",
|
|
@@ -14052,11 +14052,11 @@ var SymbolComponent = class extends PrimitiveComponent2 {
|
|
|
14052
14052
|
this.schematic_symbol_id = schematic_symbol.schematic_symbol_id;
|
|
14053
14053
|
}
|
|
14054
14054
|
getSchematicSymbolBounds() {
|
|
14055
|
-
if (this.
|
|
14056
|
-
return this.
|
|
14055
|
+
if (this.schematicSymbolBoundsInSymbolLocalCoordinateSpace) {
|
|
14056
|
+
return this.schematicSymbolBoundsInSymbolLocalCoordinateSpace;
|
|
14057
14057
|
}
|
|
14058
14058
|
this._computeSchematicSymbolBounds();
|
|
14059
|
-
return this.
|
|
14059
|
+
return this.schematicSymbolBoundsInSymbolLocalCoordinateSpace ?? null;
|
|
14060
14060
|
}
|
|
14061
14061
|
getUserCoordinateToResizedSymbolTransform() {
|
|
14062
14062
|
if (!this.hasExplicitSize()) {
|
|
@@ -14071,6 +14071,17 @@ var SymbolComponent = class extends PrimitiveComponent2 {
|
|
|
14071
14071
|
_computeSchematicSymbolBounds() {
|
|
14072
14072
|
if (this.root?.schematicDisabled) return;
|
|
14073
14073
|
const { db: db2 } = this.root;
|
|
14074
|
+
const { viewbox } = this._parsedProps;
|
|
14075
|
+
if (viewbox) {
|
|
14076
|
+
const globalPos = this._getGlobalSchematicPositionBeforeLayout();
|
|
14077
|
+
this.schematicSymbolBoundsInSymbolLocalCoordinateSpace = {
|
|
14078
|
+
minX: globalPos.x + viewbox.minX,
|
|
14079
|
+
maxX: globalPos.x + viewbox.maxX,
|
|
14080
|
+
minY: globalPos.y + viewbox.minY,
|
|
14081
|
+
maxY: globalPos.y + viewbox.maxY
|
|
14082
|
+
};
|
|
14083
|
+
return;
|
|
14084
|
+
}
|
|
14074
14085
|
const schematicElements = [];
|
|
14075
14086
|
for (const child of this.children) {
|
|
14076
14087
|
if (child.componentName === "Port") {
|
|
@@ -14111,7 +14122,7 @@ var SymbolComponent = class extends PrimitiveComponent2 {
|
|
|
14111
14122
|
}
|
|
14112
14123
|
if (schematicElements.length === 0) return;
|
|
14113
14124
|
const bounds = getBoundsForSchematic(schematicElements);
|
|
14114
|
-
this.
|
|
14125
|
+
this.schematicSymbolBoundsInSymbolLocalCoordinateSpace = bounds;
|
|
14115
14126
|
}
|
|
14116
14127
|
_computeUserCoordinateToResizedSymbolTransform() {
|
|
14117
14128
|
const bounds = this.getSchematicSymbolBounds();
|
|
@@ -14125,8 +14136,20 @@ var SymbolComponent = class extends PrimitiveComponent2 {
|
|
|
14125
14136
|
if (currentWidth === 0 && currentHeight === 0) return;
|
|
14126
14137
|
const currentCenterX = (bounds.minX + bounds.maxX) / 2;
|
|
14127
14138
|
const currentCenterY = (bounds.minY + bounds.maxY) / 2;
|
|
14128
|
-
|
|
14129
|
-
|
|
14139
|
+
let scaleX = targetWidth !== void 0 && currentWidth > 0 ? targetWidth / currentWidth : 1;
|
|
14140
|
+
let scaleY = targetHeight !== void 0 && currentHeight > 0 ? targetHeight / currentHeight : 1;
|
|
14141
|
+
if (props.fit === "contain") {
|
|
14142
|
+
const constrainedScales = [];
|
|
14143
|
+
if (targetWidth !== void 0 && currentWidth > 0) {
|
|
14144
|
+
constrainedScales.push(targetWidth / currentWidth);
|
|
14145
|
+
}
|
|
14146
|
+
if (targetHeight !== void 0 && currentHeight > 0) {
|
|
14147
|
+
constrainedScales.push(targetHeight / currentHeight);
|
|
14148
|
+
}
|
|
14149
|
+
const uniformScale = constrainedScales.length ? Math.min(...constrainedScales) : 1;
|
|
14150
|
+
scaleX = uniformScale;
|
|
14151
|
+
scaleY = uniformScale;
|
|
14152
|
+
}
|
|
14130
14153
|
const globalPos = this._getGlobalSchematicPositionBeforeLayout();
|
|
14131
14154
|
this.userCoordinateToResizedSymbolTransformMat = compose7(
|
|
14132
14155
|
translate5(globalPos.x, globalPos.y),
|
|
@@ -119475,7 +119498,7 @@ var RoutingPhasePreparationError = class extends Error {
|
|
|
119475
119498
|
var package_default = {
|
|
119476
119499
|
name: "@tscircuit/core",
|
|
119477
119500
|
type: "module",
|
|
119478
|
-
version: "0.0.
|
|
119501
|
+
version: "0.0.2170",
|
|
119479
119502
|
types: "dist/index.d.ts",
|
|
119480
119503
|
main: "dist/index.js",
|
|
119481
119504
|
module: "dist/index.js",
|
|
@@ -119534,7 +119557,7 @@ var package_default = {
|
|
|
119534
119557
|
"@tscircuit/miniflex": "^0.0.4",
|
|
119535
119558
|
"@tscircuit/modelprinter": "^0.0.18",
|
|
119536
119559
|
"@tscircuit/ngspice-spice-engine": "^0.0.20",
|
|
119537
|
-
"@tscircuit/props": "^0.0.
|
|
119560
|
+
"@tscircuit/props": "^0.0.704",
|
|
119538
119561
|
"@tscircuit/schematic-match-adapt": "^0.0.18",
|
|
119539
119562
|
"@tscircuit/schematic-trace-solver": "https://jscdn.tscircuit.com/@tscircuit/schematic-trace-solver/0.0.230.tgz",
|
|
119540
119563
|
"@tscircuit/solver-utils": "^0.0.16",
|
|
@@ -119618,7 +119641,7 @@ var package_default = {
|
|
|
119618
119641
|
},
|
|
119619
119642
|
overrides: {
|
|
119620
119643
|
"@tscircuit/circuit-json-util": "^0.0.122",
|
|
119621
|
-
"@tscircuit/props": "^0.0.
|
|
119644
|
+
"@tscircuit/props": "^0.0.704",
|
|
119622
119645
|
"circuit-json": "^0.0.528",
|
|
119623
119646
|
"@tscircuit/cableprinter": "^0.0.6"
|
|
119624
119647
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.2171",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"@tscircuit/miniflex": "^0.0.4",
|
|
61
61
|
"@tscircuit/modelprinter": "^0.0.18",
|
|
62
62
|
"@tscircuit/ngspice-spice-engine": "^0.0.20",
|
|
63
|
-
"@tscircuit/props": "^0.0.
|
|
63
|
+
"@tscircuit/props": "^0.0.704",
|
|
64
64
|
"@tscircuit/schematic-match-adapt": "^0.0.18",
|
|
65
65
|
"@tscircuit/schematic-trace-solver": "https://jscdn.tscircuit.com/@tscircuit/schematic-trace-solver/0.0.230.tgz",
|
|
66
66
|
"@tscircuit/solver-utils": "^0.0.16",
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
},
|
|
145
145
|
"overrides": {
|
|
146
146
|
"@tscircuit/circuit-json-util": "^0.0.122",
|
|
147
|
-
"@tscircuit/props": "^0.0.
|
|
147
|
+
"@tscircuit/props": "^0.0.704",
|
|
148
148
|
"circuit-json": "^0.0.528",
|
|
149
149
|
"@tscircuit/cableprinter": "^0.0.6"
|
|
150
150
|
}
|