@tscircuit/core 0.0.378 → 0.0.379
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 +6 -2
- package/dist/index.js +54 -12
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { createElement } from 'react';
|
|
|
5
5
|
import * as zod from 'zod';
|
|
6
6
|
import { z, ZodType } from 'zod';
|
|
7
7
|
import { symbols, SchSymbol, BaseSymbolName } from 'schematic-symbols';
|
|
8
|
-
import { PcbTraceError, PcbPlacementError,
|
|
8
|
+
import { PcbTraceError, PcbPlacementError, PcbManualEditConflictWarning, LayerRef, AnyCircuitElement, AnySourceComponent, PcbTraceRoutePoint, PcbTrace, PcbVia, RouteHintPoint, CircuitJson } from 'circuit-json';
|
|
9
9
|
import { Matrix } from 'transformation-matrix';
|
|
10
10
|
import { CircuitJsonUtilObjects } from '@tscircuit/circuit-json-util';
|
|
11
11
|
import * as _tscircuit_layout from '@tscircuit/layout';
|
|
@@ -66,7 +66,7 @@ declare abstract class Renderable implements IRenderable {
|
|
|
66
66
|
*/
|
|
67
67
|
runRenderPhase(phase: RenderPhase): void;
|
|
68
68
|
runRenderPhaseForChildren(phase: RenderPhase): void;
|
|
69
|
-
renderError(message: string | Omit<PcbTraceError, "pcb_error_id"> | Omit<PcbPlacementError, "pcb_error_id"> | Omit<
|
|
69
|
+
renderError(message: string | Omit<PcbTraceError, "pcb_error_id"> | Omit<PcbPlacementError, "pcb_error_id"> | Omit<PcbManualEditConflictWarning, "pcb_error_id">): void;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
/**
|
|
@@ -392,6 +392,10 @@ declare abstract class PrimitiveComponent<ZodProps extends ZodType = any> extend
|
|
|
392
392
|
x: number;
|
|
393
393
|
y: number;
|
|
394
394
|
} | null;
|
|
395
|
+
_getSchematicManualPlacementForComponent(component: PrimitiveComponent): {
|
|
396
|
+
x: number;
|
|
397
|
+
y: number;
|
|
398
|
+
} | null;
|
|
395
399
|
_getSchematicGlobalManualPlacementTransform(component: PrimitiveComponent): Matrix | null;
|
|
396
400
|
_getGlobalPcbPositionBeforeLayout(): {
|
|
397
401
|
x: number;
|
package/dist/index.js
CHANGED
|
@@ -53,7 +53,12 @@ __export(components_exports, {
|
|
|
53
53
|
|
|
54
54
|
// lib/components/base-components/NormalComponent/NormalComponent.ts
|
|
55
55
|
import { fp } from "@tscircuit/footprinter";
|
|
56
|
-
import {
|
|
56
|
+
import {
|
|
57
|
+
pcb_manual_edit_conflict_warning,
|
|
58
|
+
point3,
|
|
59
|
+
rotation,
|
|
60
|
+
schematic_manual_edit_conflict_warning
|
|
61
|
+
} from "circuit-json";
|
|
57
62
|
import Debug4 from "debug";
|
|
58
63
|
|
|
59
64
|
// lib/fiber/create-instance-from-react-element.ts
|
|
@@ -1009,6 +1014,23 @@ var PrimitiveComponent2 = class extends Renderable {
|
|
|
1009
1014
|
}
|
|
1010
1015
|
return null;
|
|
1011
1016
|
}
|
|
1017
|
+
_getSchematicManualPlacementForComponent(component) {
|
|
1018
|
+
if (!this.isSubcircuit) return null;
|
|
1019
|
+
const manualEdits = this.props.manualEdits;
|
|
1020
|
+
if (!manualEdits) return null;
|
|
1021
|
+
const placementConfigPositions = manualEdits.schematic_placements;
|
|
1022
|
+
if (!placementConfigPositions) return null;
|
|
1023
|
+
for (const position of placementConfigPositions) {
|
|
1024
|
+
if (isMatchingSelector(component, position.selector) || component.props.name === position.selector) {
|
|
1025
|
+
const center = applyToPoint(
|
|
1026
|
+
this.computeSchematicGlobalTransform(),
|
|
1027
|
+
position.center
|
|
1028
|
+
);
|
|
1029
|
+
return center;
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
return null;
|
|
1033
|
+
}
|
|
1012
1034
|
_getSchematicGlobalManualPlacementTransform(component) {
|
|
1013
1035
|
const manualEdits = this.getSubcircuit()?._parsedProps.manualEdits;
|
|
1014
1036
|
if (!manualEdits) return null;
|
|
@@ -4866,13 +4888,30 @@ var NormalComponent = class extends PrimitiveComponent2 {
|
|
|
4866
4888
|
*/
|
|
4867
4889
|
doInitialSchematicComponentRender() {
|
|
4868
4890
|
if (this.root?.schematicDisabled) return;
|
|
4891
|
+
const { db } = this.root;
|
|
4869
4892
|
const { schematicSymbolName } = this.config;
|
|
4870
4893
|
if (schematicSymbolName) {
|
|
4871
|
-
|
|
4894
|
+
this._doInitialSchematicComponentRenderWithSymbol();
|
|
4895
|
+
} else {
|
|
4896
|
+
const dimensions = this._getSchematicBoxDimensions();
|
|
4897
|
+
if (dimensions) {
|
|
4898
|
+
this._doInitialSchematicComponentRenderWithSchematicBoxDimensions();
|
|
4899
|
+
}
|
|
4872
4900
|
}
|
|
4873
|
-
const
|
|
4874
|
-
if (
|
|
4875
|
-
|
|
4901
|
+
const manualPlacement = this.getSubcircuit()?._getSchematicManualPlacementForComponent(this);
|
|
4902
|
+
if (this.schematic_component_id && this.props.schX !== void 0 && this.props.schY !== void 0 && manualPlacement) {
|
|
4903
|
+
if (!this.schematic_component_id) {
|
|
4904
|
+
return;
|
|
4905
|
+
}
|
|
4906
|
+
const warning = schematic_manual_edit_conflict_warning.parse({
|
|
4907
|
+
type: "schematic_manual_edit_conflict_warning",
|
|
4908
|
+
schematic_manual_edit_conflict_warning_id: `schematic_manual_edit_conflict_${this.source_component_id}`,
|
|
4909
|
+
message: `${this.getString()} has both manual placement and prop coordinates. schX and schY will be used. Remove schX/schY or clear the manual placement.`,
|
|
4910
|
+
schematic_component_id: this.schematic_component_id,
|
|
4911
|
+
source_component_id: this.source_component_id,
|
|
4912
|
+
subcircuit_id: this.getSubcircuit()?.subcircuit_id
|
|
4913
|
+
});
|
|
4914
|
+
db.schematic_manual_edit_conflict_warning.insert(warning);
|
|
4876
4915
|
}
|
|
4877
4916
|
}
|
|
4878
4917
|
_getSchematicSymbolDisplayValue() {
|
|
@@ -4993,12 +5032,15 @@ var NormalComponent = class extends PrimitiveComponent2 {
|
|
|
4993
5032
|
this.pcb_component_id = pcb_component.pcb_component_id;
|
|
4994
5033
|
const manualPlacement = this.getSubcircuit()._getPcbManualPlacementForComponent(this);
|
|
4995
5034
|
if (this.props.pcbX !== void 0 && this.props.pcbY !== void 0 && manualPlacement) {
|
|
4996
|
-
|
|
4997
|
-
type: "
|
|
4998
|
-
|
|
5035
|
+
const warning = pcb_manual_edit_conflict_warning.parse({
|
|
5036
|
+
type: "pcb_manual_edit_conflict_warning",
|
|
5037
|
+
pcb_manual_edit_conflict_warning_id: `pcb_manual_edit_conflict_${this.source_component_id}`,
|
|
5038
|
+
message: `${this.getString()} has both manual placement and prop coordinates. pcbX and pcbY will be used. Remove pcbX/pcbY or clear the manual placement.`,
|
|
4999
5039
|
pcb_component_id: this.pcb_component_id,
|
|
5000
|
-
source_component_id: this.source_component_id
|
|
5040
|
+
source_component_id: this.source_component_id,
|
|
5041
|
+
subcircuit_id: subcircuit.subcircuit_id ?? void 0
|
|
5001
5042
|
});
|
|
5043
|
+
db.pcb_manual_edit_conflict_warning.insert(warning);
|
|
5002
5044
|
}
|
|
5003
5045
|
}
|
|
5004
5046
|
/**
|
|
@@ -7668,7 +7710,7 @@ import { identity as identity4 } from "transformation-matrix";
|
|
|
7668
7710
|
var package_default = {
|
|
7669
7711
|
name: "@tscircuit/core",
|
|
7670
7712
|
type: "module",
|
|
7671
|
-
version: "0.0.
|
|
7713
|
+
version: "0.0.378",
|
|
7672
7714
|
types: "dist/index.d.ts",
|
|
7673
7715
|
main: "dist/index.js",
|
|
7674
7716
|
module: "dist/index.js",
|
|
@@ -7727,11 +7769,11 @@ var package_default = {
|
|
|
7727
7769
|
"@tscircuit/math-utils": "^0.0.14",
|
|
7728
7770
|
"@tscircuit/props": "^0.0.172",
|
|
7729
7771
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
7730
|
-
"circuit-json": "
|
|
7772
|
+
"circuit-json": "0.0.158",
|
|
7731
7773
|
"circuit-json-to-connectivity-map": "^0.0.20",
|
|
7774
|
+
"css-select": "^5.1.0",
|
|
7732
7775
|
"format-si-unit": "^0.0.3",
|
|
7733
7776
|
nanoid: "^5.0.7",
|
|
7734
|
-
"css-select": "^5.1.0",
|
|
7735
7777
|
"performance-now": "^2.1.0",
|
|
7736
7778
|
"react-reconciler": "^0.31.0",
|
|
7737
7779
|
"react-reconciler-18": "npm:react-reconciler@0.29.2",
|
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.379",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -60,11 +60,11 @@
|
|
|
60
60
|
"@tscircuit/math-utils": "^0.0.14",
|
|
61
61
|
"@tscircuit/props": "^0.0.172",
|
|
62
62
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
63
|
-
"circuit-json": "
|
|
63
|
+
"circuit-json": "0.0.158",
|
|
64
64
|
"circuit-json-to-connectivity-map": "^0.0.20",
|
|
65
|
+
"css-select": "^5.1.0",
|
|
65
66
|
"format-si-unit": "^0.0.3",
|
|
66
67
|
"nanoid": "^5.0.7",
|
|
67
|
-
"css-select": "^5.1.0",
|
|
68
68
|
"performance-now": "^2.1.0",
|
|
69
69
|
"react-reconciler": "^0.31.0",
|
|
70
70
|
"react-reconciler-18": "npm:react-reconciler@0.29.2",
|