@tscircuit/core 0.0.789 → 0.0.791
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 +85 -2
- package/dist/index.js +84 -29
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as circuit_json from 'circuit-json';
|
|
2
2
|
import { PcbTraceError, PcbPlacementError, PcbManualEditConflictWarning, PcbViaClearanceError, LayerRef, AnyCircuitElement, Size, AnySourceComponent, PcbTraceRoutePoint, PcbTrace as PcbTrace$1, PcbVia, SchematicPort, SchematicComponent, RouteHintPoint, CircuitJson } from 'circuit-json';
|
|
3
3
|
import * as _tscircuit_props from '@tscircuit/props';
|
|
4
|
-
import { PlatformConfig, subcircuitGroupProps, AutorouterConfig, traceProps, SupplierPartNumbers, CadModelProp, SchematicPortArrangement, groupProps, boardProps, capacitorProps, chipProps, pinoutProps, diodeProps, fuseProps, jumperProps, solderjumperProps, ledProps, powerSourceProps, CommonComponentProps, resistorProps, constraintProps, fabricationNoteRectProps, fabricationNotePathProps, fabricationNoteTextProps, fabricationNoteDimensionProps, pcbNoteLineProps, pcbNoteRectProps, pcbNotePathProps, pcbNoteDimensionProps, footprintProps, subcircuitProps, breakoutProps, breakoutPointProps, holeProps, pcbKeepoutProps, netLabelProps, cadmodelProps, cadassemblyProps, platedHoleProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, silkscreenLineProps, smtPadProps, traceHintProps, viaProps, copperPourProps, cutoutProps, batteryProps, pinHeaderProps, resonatorProps, inductorProps, potentiometerProps, pushButtonProps, crystalProps, transistorProps, mosfetProps, switchProps, SwitchProps, testpointProps, schematicTextProps, schematicLineProps, schematicRectProps, schematicArcProps, schematicCircleProps, schematicBoxProps, schematicTableProps, schematicRowProps, schematicCellProps, symbolProps, analogSimulationProps, voltageProbeProps, CapacitorProps, ChipProps, DiodeProps, ResistorProps, ManualEditEvent, ManualEditsFile, ChipConnections, manual_edits_file } from '@tscircuit/props';
|
|
4
|
+
import { PlatformConfig, subcircuitGroupProps, AutorouterConfig, traceProps, SupplierPartNumbers, CadModelProp, SchematicPortArrangement, groupProps, boardProps, capacitorProps, chipProps, pinoutProps, diodeProps, fuseProps, jumperProps, solderjumperProps, ledProps, powerSourceProps, CommonComponentProps, resistorProps, constraintProps, fabricationNoteRectProps, fabricationNotePathProps, fabricationNoteTextProps, fabricationNoteDimensionProps, pcbNoteLineProps, pcbNoteRectProps, pcbNoteTextProps, pcbNotePathProps, pcbNoteDimensionProps, footprintProps, subcircuitProps, breakoutProps, breakoutPointProps, holeProps, pcbKeepoutProps, netLabelProps, cadmodelProps, cadassemblyProps, platedHoleProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, silkscreenLineProps, smtPadProps, traceHintProps, viaProps, copperPourProps, cutoutProps, batteryProps, pinHeaderProps, resonatorProps, inductorProps, potentiometerProps, pushButtonProps, crystalProps, transistorProps, mosfetProps, switchProps, SwitchProps, testpointProps, schematicTextProps, schematicLineProps, schematicRectProps, schematicArcProps, schematicCircleProps, schematicBoxProps, schematicTableProps, schematicRowProps, schematicCellProps, symbolProps, analogSimulationProps, voltageProbeProps, CapacitorProps, ChipProps, DiodeProps, ResistorProps, ManualEditEvent, ManualEditsFile, ChipConnections, manual_edits_file } from '@tscircuit/props';
|
|
5
5
|
import * as react from 'react';
|
|
6
6
|
import react__default, { ReactElement, DetailedHTMLProps, SVGProps } from 'react';
|
|
7
7
|
export { createElement } from 'react';
|
|
@@ -18060,6 +18060,88 @@ declare class PcbNoteRect extends PrimitiveComponent<typeof pcbNoteRectProps> {
|
|
|
18060
18060
|
};
|
|
18061
18061
|
}
|
|
18062
18062
|
|
|
18063
|
+
declare class PcbNoteText extends PrimitiveComponent<typeof pcbNoteTextProps> {
|
|
18064
|
+
pcb_note_text_id: string | null;
|
|
18065
|
+
isPcbPrimitive: boolean;
|
|
18066
|
+
get config(): {
|
|
18067
|
+
componentName: string;
|
|
18068
|
+
zodProps: zod.ZodObject<{
|
|
18069
|
+
pcbX: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
18070
|
+
pcbY: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
18071
|
+
pcbRotation: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
18072
|
+
pcbPositionAnchor: zod.ZodOptional<zod.ZodString>;
|
|
18073
|
+
layer: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>, zod.ZodObject<{
|
|
18074
|
+
name: zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>;
|
|
18075
|
+
}, "strip", zod.ZodTypeAny, {
|
|
18076
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
18077
|
+
}, {
|
|
18078
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
18079
|
+
}>]>, "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6", "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
|
|
18080
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
18081
|
+
}>>;
|
|
18082
|
+
pcbMarginTop: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
18083
|
+
pcbMarginRight: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
18084
|
+
pcbMarginBottom: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
18085
|
+
pcbMarginLeft: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
18086
|
+
pcbMarginX: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
18087
|
+
pcbMarginY: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
18088
|
+
pcbRelative: zod.ZodOptional<zod.ZodBoolean>;
|
|
18089
|
+
relative: zod.ZodOptional<zod.ZodBoolean>;
|
|
18090
|
+
} & {
|
|
18091
|
+
text: zod.ZodString;
|
|
18092
|
+
anchorAlignment: zod.ZodDefault<zod.ZodEnum<["center", "top_left", "top_right", "bottom_left", "bottom_right"]>>;
|
|
18093
|
+
font: zod.ZodOptional<zod.ZodEnum<["tscircuit2024"]>>;
|
|
18094
|
+
fontSize: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
18095
|
+
color: zod.ZodOptional<zod.ZodString>;
|
|
18096
|
+
}, "strip", zod.ZodTypeAny, {
|
|
18097
|
+
text: string;
|
|
18098
|
+
anchorAlignment: "top_left" | "top_right" | "center" | "bottom_left" | "bottom_right";
|
|
18099
|
+
pcbX?: number | undefined;
|
|
18100
|
+
pcbY?: number | undefined;
|
|
18101
|
+
pcbRotation?: number | undefined;
|
|
18102
|
+
pcbPositionAnchor?: string | undefined;
|
|
18103
|
+
layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | undefined;
|
|
18104
|
+
pcbMarginTop?: number | undefined;
|
|
18105
|
+
pcbMarginRight?: number | undefined;
|
|
18106
|
+
pcbMarginBottom?: number | undefined;
|
|
18107
|
+
pcbMarginLeft?: number | undefined;
|
|
18108
|
+
pcbMarginX?: number | undefined;
|
|
18109
|
+
pcbMarginY?: number | undefined;
|
|
18110
|
+
pcbRelative?: boolean | undefined;
|
|
18111
|
+
relative?: boolean | undefined;
|
|
18112
|
+
color?: string | undefined;
|
|
18113
|
+
font?: "tscircuit2024" | undefined;
|
|
18114
|
+
fontSize?: number | undefined;
|
|
18115
|
+
}, {
|
|
18116
|
+
text: string;
|
|
18117
|
+
pcbX?: string | number | undefined;
|
|
18118
|
+
pcbY?: string | number | undefined;
|
|
18119
|
+
pcbRotation?: string | number | undefined;
|
|
18120
|
+
pcbPositionAnchor?: string | undefined;
|
|
18121
|
+
layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
|
|
18122
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
18123
|
+
} | undefined;
|
|
18124
|
+
pcbMarginTop?: string | number | undefined;
|
|
18125
|
+
pcbMarginRight?: string | number | undefined;
|
|
18126
|
+
pcbMarginBottom?: string | number | undefined;
|
|
18127
|
+
pcbMarginLeft?: string | number | undefined;
|
|
18128
|
+
pcbMarginX?: string | number | undefined;
|
|
18129
|
+
pcbMarginY?: string | number | undefined;
|
|
18130
|
+
pcbRelative?: boolean | undefined;
|
|
18131
|
+
relative?: boolean | undefined;
|
|
18132
|
+
color?: string | undefined;
|
|
18133
|
+
anchorAlignment?: "top_left" | "top_right" | "center" | "bottom_left" | "bottom_right" | undefined;
|
|
18134
|
+
font?: "tscircuit2024" | undefined;
|
|
18135
|
+
fontSize?: string | number | undefined;
|
|
18136
|
+
}>;
|
|
18137
|
+
};
|
|
18138
|
+
doInitialPcbPrimitiveRender(): void;
|
|
18139
|
+
getPcbSize(): {
|
|
18140
|
+
width: number;
|
|
18141
|
+
height: number;
|
|
18142
|
+
};
|
|
18143
|
+
}
|
|
18144
|
+
|
|
18063
18145
|
declare class PcbNotePath extends PrimitiveComponent<typeof pcbNotePathProps> {
|
|
18064
18146
|
pcb_note_path_id: string | null;
|
|
18065
18147
|
isPcbPrimitive: boolean;
|
|
@@ -35976,6 +36058,7 @@ interface TscircuitElements {
|
|
|
35976
36058
|
fabricationnoterect: _tscircuit_props.FabricationNoteRectProps;
|
|
35977
36059
|
pcbnoteline: _tscircuit_props.PcbNoteLineProps;
|
|
35978
36060
|
pcbnoterect: _tscircuit_props.PcbNoteRectProps;
|
|
36061
|
+
pcbnotetext: _tscircuit_props.PcbNoteTextProps;
|
|
35979
36062
|
pcbnotepath: _tscircuit_props.PcbNotePathProps;
|
|
35980
36063
|
pcbnotedimension: _tscircuit_props.PcbNoteDimensionProps;
|
|
35981
36064
|
fabricationnotetext: _tscircuit_props.FabricationNoteTextProps;
|
|
@@ -36011,4 +36094,4 @@ declare module "react/jsx-runtime" {
|
|
|
36011
36094
|
}
|
|
36012
36095
|
}
|
|
36013
36096
|
|
|
36014
|
-
export { AnalogSimulation, type AsyncEffect, type AutorouterCompleteEvent, type AutorouterErrorEvent, type AutorouterEvent, type AutorouterProgressEvent, type AutoroutingEndEvent, type AutoroutingErrorEvent, type AutoroutingProgressEvent, type AutoroutingStartEvent, Battery, Board, Breakout, BreakoutPoint, CadAssembly, CadModel, Capacitor, Chip, Circuit, type ComponentWithPins, Constraint, CopperPour, Crystal, Cutout, type DebugLogOutputEvent, Diode, FabricationNoteDimension, FabricationNotePath, FabricationNoteRect, FabricationNoteText, Footprint, Fuse, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IRenderable, Inductor, Jumper, Keepout, Led, type LocalCacheEngine, Mosfet, Net, NetLabel, NormalComponent, type Obstacle, PcbNoteDimension, PcbNoteLine, PcbNotePath, PcbNoteRect, PcbTrace, PinHeader, type PinLabelSpec, Pinout, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, type RenderPhase, type RenderPhaseFn, type RenderPhaseFunctions, type RenderPhaseStates, Renderable, Resistor, Resonator, RootCircuit, type RootCircuitEventName, SchematicArc, SchematicBox, SchematicCell, SchematicCircle, SchematicLine, SchematicRect, SchematicRow, SchematicTable, SchematicText, type Sel, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteConnection, type SimpleRouteJson, type SimplifiedPcbTrace, SmtPad, SolderJumper, Subcircuit, Switch, SymbolComponent as Symbol, TestPoint, Trace, TraceHint, Transistor, Via, VoltageProbe, VoltageSource, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, createUseComponent, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, normalizePinLabels, orderedRenderPhases, sel, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
|
|
36097
|
+
export { AnalogSimulation, type AsyncEffect, type AutorouterCompleteEvent, type AutorouterErrorEvent, type AutorouterEvent, type AutorouterProgressEvent, type AutoroutingEndEvent, type AutoroutingErrorEvent, type AutoroutingProgressEvent, type AutoroutingStartEvent, Battery, Board, Breakout, BreakoutPoint, CadAssembly, CadModel, Capacitor, Chip, Circuit, type ComponentWithPins, Constraint, CopperPour, Crystal, Cutout, type DebugLogOutputEvent, Diode, FabricationNoteDimension, FabricationNotePath, FabricationNoteRect, FabricationNoteText, Footprint, Fuse, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IRenderable, Inductor, Jumper, Keepout, Led, type LocalCacheEngine, Mosfet, Net, NetLabel, NormalComponent, type Obstacle, PcbNoteDimension, PcbNoteLine, PcbNotePath, PcbNoteRect, PcbNoteText, PcbTrace, PinHeader, type PinLabelSpec, Pinout, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, type RenderPhase, type RenderPhaseFn, type RenderPhaseFunctions, type RenderPhaseStates, Renderable, Resistor, Resonator, RootCircuit, type RootCircuitEventName, SchematicArc, SchematicBox, SchematicCell, SchematicCircle, SchematicLine, SchematicRect, SchematicRow, SchematicTable, SchematicText, type Sel, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteConnection, type SimpleRouteJson, type SimplifiedPcbTrace, SmtPad, SolderJumper, Subcircuit, Switch, SymbolComponent as Symbol, TestPoint, Trace, TraceHint, Transistor, Via, VoltageProbe, VoltageSource, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, createUseComponent, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, normalizePinLabels, orderedRenderPhases, sel, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
|
package/dist/index.js
CHANGED
|
@@ -41,6 +41,7 @@ __export(components_exports, {
|
|
|
41
41
|
PcbNoteLine: () => PcbNoteLine,
|
|
42
42
|
PcbNotePath: () => PcbNotePath,
|
|
43
43
|
PcbNoteRect: () => PcbNoteRect,
|
|
44
|
+
PcbNoteText: () => PcbNoteText,
|
|
44
45
|
PcbTrace: () => PcbTrace,
|
|
45
46
|
PinHeader: () => PinHeader,
|
|
46
47
|
Pinout: () => Pinout,
|
|
@@ -4387,6 +4388,30 @@ var getFileExtension = (filename) => {
|
|
|
4387
4388
|
return extension?.toLowerCase() ?? null;
|
|
4388
4389
|
};
|
|
4389
4390
|
|
|
4391
|
+
// lib/utils/constructAssetUrl.ts
|
|
4392
|
+
var joinUrlPath = (base, path) => {
|
|
4393
|
+
const trimmedBase = base.replace(/\/+$/, "");
|
|
4394
|
+
const trimmedPath = path.replace(/^\/+/, "");
|
|
4395
|
+
return `${trimmedBase}/${trimmedPath}`;
|
|
4396
|
+
};
|
|
4397
|
+
var constructAssetUrl = (targetUrl, baseUrl) => {
|
|
4398
|
+
if (!baseUrl) {
|
|
4399
|
+
return targetUrl;
|
|
4400
|
+
}
|
|
4401
|
+
if (!targetUrl.startsWith("/")) {
|
|
4402
|
+
return targetUrl;
|
|
4403
|
+
}
|
|
4404
|
+
try {
|
|
4405
|
+
const baseUrlObj = new URL(baseUrl);
|
|
4406
|
+
if (baseUrlObj.pathname !== "/" && targetUrl.startsWith(baseUrlObj.pathname)) {
|
|
4407
|
+
return new URL(targetUrl, baseUrlObj.origin).toString();
|
|
4408
|
+
}
|
|
4409
|
+
return joinUrlPath(baseUrl, targetUrl);
|
|
4410
|
+
} catch (error) {
|
|
4411
|
+
return targetUrl;
|
|
4412
|
+
}
|
|
4413
|
+
};
|
|
4414
|
+
|
|
4390
4415
|
// lib/components/primitive-components/CadModel.ts
|
|
4391
4416
|
var rotation = z7.union([z7.number(), z7.string()]);
|
|
4392
4417
|
var rotation3 = z7.object({ x: rotation, y: rotation, z: rotation });
|
|
@@ -4466,9 +4491,13 @@ var CadModel = class extends PrimitiveComponent2 {
|
|
|
4466
4491
|
return p;
|
|
4467
4492
|
}
|
|
4468
4493
|
_addCachebustToModelUrl(url) {
|
|
4469
|
-
if (!url
|
|
4494
|
+
if (!url) return url;
|
|
4495
|
+
const baseUrl = this.root?.platform?.projectBaseUrl;
|
|
4496
|
+
const transformedUrl = constructAssetUrl(url, baseUrl);
|
|
4497
|
+
if (!transformedUrl.includes("modelcdn.tscircuit.com"))
|
|
4498
|
+
return transformedUrl;
|
|
4470
4499
|
const origin = this.root?.getClientOrigin() ?? "";
|
|
4471
|
-
return `${
|
|
4500
|
+
return `${transformedUrl}${transformedUrl.includes("?") ? "&" : "?"}cachebust_origin=${encodeURIComponent(origin)}`;
|
|
4472
4501
|
}
|
|
4473
4502
|
};
|
|
4474
4503
|
|
|
@@ -7071,25 +7100,6 @@ import {
|
|
|
7071
7100
|
circuit_json_footprint_load_error,
|
|
7072
7101
|
external_footprint_load_error
|
|
7073
7102
|
} from "circuit-json";
|
|
7074
|
-
|
|
7075
|
-
// lib/utils/constructAssetUrl.ts
|
|
7076
|
-
var constructAssetUrl = (targetUrl, baseUrl) => {
|
|
7077
|
-
if (!baseUrl) {
|
|
7078
|
-
return targetUrl;
|
|
7079
|
-
}
|
|
7080
|
-
if (!targetUrl.startsWith("/")) {
|
|
7081
|
-
return targetUrl;
|
|
7082
|
-
}
|
|
7083
|
-
try {
|
|
7084
|
-
const base = new URL(baseUrl);
|
|
7085
|
-
const resolved = new URL(targetUrl, base.origin);
|
|
7086
|
-
return resolved.toString();
|
|
7087
|
-
} catch (error) {
|
|
7088
|
-
return targetUrl;
|
|
7089
|
-
}
|
|
7090
|
-
};
|
|
7091
|
-
|
|
7092
|
-
// lib/components/base-components/NormalComponent/NormalComponent_doInitialPcbFootprintStringRender.ts
|
|
7093
7103
|
function NormalComponent_doInitialPcbFootprintStringRender(component, queueAsyncEffect) {
|
|
7094
7104
|
let { footprint } = component.props;
|
|
7095
7105
|
footprint ??= component._getImpliedFootprintString?.();
|
|
@@ -14547,9 +14557,53 @@ var PcbNoteRect = class extends PrimitiveComponent2 {
|
|
|
14547
14557
|
}
|
|
14548
14558
|
};
|
|
14549
14559
|
|
|
14560
|
+
// lib/components/primitive-components/PcbNoteText.ts
|
|
14561
|
+
import { pcbNoteTextProps } from "@tscircuit/props";
|
|
14562
|
+
import { applyToPoint as applyToPoint13 } from "transformation-matrix";
|
|
14563
|
+
var PcbNoteText = class extends PrimitiveComponent2 {
|
|
14564
|
+
pcb_note_text_id = null;
|
|
14565
|
+
isPcbPrimitive = true;
|
|
14566
|
+
get config() {
|
|
14567
|
+
return {
|
|
14568
|
+
componentName: "PcbNoteText",
|
|
14569
|
+
zodProps: pcbNoteTextProps
|
|
14570
|
+
};
|
|
14571
|
+
}
|
|
14572
|
+
doInitialPcbPrimitiveRender() {
|
|
14573
|
+
if (this.root?.pcbDisabled) return;
|
|
14574
|
+
const { db } = this.root;
|
|
14575
|
+
const { _parsedProps: props } = this;
|
|
14576
|
+
const transform = this._computePcbGlobalTransformBeforeLayout();
|
|
14577
|
+
const anchorPosition = applyToPoint13(transform, { x: 0, y: 0 });
|
|
14578
|
+
const subcircuit = this.getSubcircuit();
|
|
14579
|
+
const group = this.getGroup();
|
|
14580
|
+
const pcb_component_id = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id ?? void 0;
|
|
14581
|
+
const pcb_note_text = db.pcb_note_text.insert({
|
|
14582
|
+
pcb_component_id,
|
|
14583
|
+
subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
|
|
14584
|
+
pcb_group_id: group?.pcb_group_id ?? void 0,
|
|
14585
|
+
font: props.font ?? "tscircuit2024",
|
|
14586
|
+
font_size: props.fontSize ?? 1,
|
|
14587
|
+
text: props.text,
|
|
14588
|
+
anchor_position: anchorPosition,
|
|
14589
|
+
anchor_alignment: props.anchorAlignment ?? "center",
|
|
14590
|
+
color: props.color
|
|
14591
|
+
});
|
|
14592
|
+
this.pcb_note_text_id = pcb_note_text.pcb_note_text_id;
|
|
14593
|
+
}
|
|
14594
|
+
getPcbSize() {
|
|
14595
|
+
const { _parsedProps: props } = this;
|
|
14596
|
+
const fontSize = typeof props.fontSize === "string" ? parseFloat(props.fontSize) : props.fontSize ?? 1;
|
|
14597
|
+
const charWidth = fontSize * 0.6;
|
|
14598
|
+
const width = props.text.length * charWidth;
|
|
14599
|
+
const height = fontSize;
|
|
14600
|
+
return { width, height };
|
|
14601
|
+
}
|
|
14602
|
+
};
|
|
14603
|
+
|
|
14550
14604
|
// lib/components/primitive-components/PcbNotePath.ts
|
|
14551
14605
|
import { pcbNotePathProps } from "@tscircuit/props";
|
|
14552
|
-
import { applyToPoint as
|
|
14606
|
+
import { applyToPoint as applyToPoint14 } from "transformation-matrix";
|
|
14553
14607
|
var PcbNotePath = class extends PrimitiveComponent2 {
|
|
14554
14608
|
pcb_note_path_id = null;
|
|
14555
14609
|
isPcbPrimitive = true;
|
|
@@ -14571,7 +14625,7 @@ var PcbNotePath = class extends PrimitiveComponent2 {
|
|
|
14571
14625
|
const { x, y, ...rest } = point;
|
|
14572
14626
|
const numericX = typeof x === "string" ? parseFloat(x) : x;
|
|
14573
14627
|
const numericY = typeof y === "string" ? parseFloat(y) : y;
|
|
14574
|
-
const transformed =
|
|
14628
|
+
const transformed = applyToPoint14(transform, { x: numericX, y: numericY });
|
|
14575
14629
|
return { ...rest, x: transformed.x, y: transformed.y };
|
|
14576
14630
|
});
|
|
14577
14631
|
const pcb_note_path = db.pcb_note_path.insert({
|
|
@@ -14603,7 +14657,7 @@ var PcbNotePath = class extends PrimitiveComponent2 {
|
|
|
14603
14657
|
|
|
14604
14658
|
// lib/components/primitive-components/PcbNoteDimension.ts
|
|
14605
14659
|
import { pcbNoteDimensionProps } from "@tscircuit/props";
|
|
14606
|
-
import { applyToPoint as
|
|
14660
|
+
import { applyToPoint as applyToPoint15 } from "transformation-matrix";
|
|
14607
14661
|
var PcbNoteDimension = class extends PrimitiveComponent2 {
|
|
14608
14662
|
pcb_note_dimension_id = null;
|
|
14609
14663
|
isPcbPrimitive = true;
|
|
@@ -14620,13 +14674,13 @@ var PcbNoteDimension = class extends PrimitiveComponent2 {
|
|
|
14620
14674
|
);
|
|
14621
14675
|
if (!target) {
|
|
14622
14676
|
this.renderError(`PcbNoteDimension could not find selector "${input}"`);
|
|
14623
|
-
return
|
|
14677
|
+
return applyToPoint15(transform, { x: 0, y: 0 });
|
|
14624
14678
|
}
|
|
14625
14679
|
return target._getGlobalPcbPositionBeforeLayout();
|
|
14626
14680
|
}
|
|
14627
14681
|
const numericX = typeof input.x === "string" ? parseFloat(input.x) : input.x;
|
|
14628
14682
|
const numericY = typeof input.y === "string" ? parseFloat(input.y) : input.y;
|
|
14629
|
-
return
|
|
14683
|
+
return applyToPoint15(transform, { x: numericX, y: numericY });
|
|
14630
14684
|
}
|
|
14631
14685
|
doInitialPcbPrimitiveRender() {
|
|
14632
14686
|
if (this.root?.pcbDisabled) return;
|
|
@@ -14787,7 +14841,7 @@ var BreakoutPoint = class extends PrimitiveComponent2 {
|
|
|
14787
14841
|
// lib/components/primitive-components/NetLabel.ts
|
|
14788
14842
|
import { netLabelProps } from "@tscircuit/props";
|
|
14789
14843
|
import {
|
|
14790
|
-
applyToPoint as
|
|
14844
|
+
applyToPoint as applyToPoint16,
|
|
14791
14845
|
identity as identity5,
|
|
14792
14846
|
translate as translate6
|
|
14793
14847
|
} from "transformation-matrix";
|
|
@@ -14838,7 +14892,7 @@ var NetLabel = class extends PrimitiveComponent2 {
|
|
|
14838
14892
|
const connectedPorts = this._getConnectedPorts();
|
|
14839
14893
|
if (connectedPorts.length > 0) {
|
|
14840
14894
|
const portPos = connectedPorts[0]._getGlobalSchematicPositionBeforeLayout();
|
|
14841
|
-
const parentCenter =
|
|
14895
|
+
const parentCenter = applyToPoint16(
|
|
14842
14896
|
this.parent?.computeSchematicGlobalTransform?.() ?? identity5(),
|
|
14843
14897
|
{ x: 0, y: 0 }
|
|
14844
14898
|
);
|
|
@@ -16696,7 +16750,7 @@ import { identity as identity6 } from "transformation-matrix";
|
|
|
16696
16750
|
var package_default = {
|
|
16697
16751
|
name: "@tscircuit/core",
|
|
16698
16752
|
type: "module",
|
|
16699
|
-
version: "0.0.
|
|
16753
|
+
version: "0.0.790",
|
|
16700
16754
|
types: "dist/index.d.ts",
|
|
16701
16755
|
main: "dist/index.js",
|
|
16702
16756
|
module: "dist/index.js",
|
|
@@ -17238,6 +17292,7 @@ export {
|
|
|
17238
17292
|
PcbNoteLine,
|
|
17239
17293
|
PcbNotePath,
|
|
17240
17294
|
PcbNoteRect,
|
|
17295
|
+
PcbNoteText,
|
|
17241
17296
|
PcbTrace,
|
|
17242
17297
|
PinHeader,
|
|
17243
17298
|
Pinout,
|