@tscircuit/core 0.0.98 → 0.0.99

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.
Files changed (3) hide show
  1. package/dist/index.d.ts +48 -48
  2. package/dist/index.js +840 -830
  3. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -1,53 +1,13 @@
1
+ import { ReactElement } from 'react';
1
2
  import * as zod from 'zod';
2
3
  import { ZodType, z } from 'zod';
3
- import { LayerRef, AnyCircuitElement, PcbTraceError, PcbPlacementError, AnySourceComponent, RouteHintPoint } from 'circuit-json';
4
+ import { SchSymbol, BaseSymbolName } from 'schematic-symbols';
5
+ import { PcbTraceError, PcbPlacementError, LayerRef, AnyCircuitElement, AnySourceComponent, RouteHintPoint } from 'circuit-json';
4
6
  import { SoupUtilObjects } from '@tscircuit/soup-util';
5
- import { ReactElement } from 'react';
6
7
  import { Matrix } from 'transformation-matrix';
7
- import { SchSymbol, BaseSymbolName } from 'schematic-symbols';
8
8
  import * as Props from '@tscircuit/props';
9
9
  import { traceProps, groupProps, boardProps, footprintProps, smtPadProps, resistorProps, ledProps, diodeProps, capacitorProps, traceHintProps, chipProps, jumperProps, silkscreenPathProps, platedHoleProps, constraintProps, holeProps, silkscreenTextProps, pcbKeepoutProps, fabricationNoteTextProps, fabricationNotePathProps } from '@tscircuit/props';
10
10
 
11
- declare class Circuit {
12
- firstChild: PrimitiveComponent | null;
13
- children: PrimitiveComponent[];
14
- db: SoupUtilObjects;
15
- root: Circuit | null;
16
- isRoot: boolean;
17
- _hasRenderedAtleastOnce: boolean;
18
- constructor();
19
- add(componentOrElm: PrimitiveComponent | ReactElement): void;
20
- /**
21
- * Get the main board for this Circuit.
22
- */
23
- _getBoard(): PrimitiveComponent & {
24
- boardThickness: number;
25
- allLayers: LayerRef[];
26
- };
27
- _guessRootComponent(): void;
28
- render(): void;
29
- getSoup(): AnyCircuitElement[];
30
- getCircuitJson(): AnyCircuitElement[];
31
- getSvg(options: {
32
- view: "pcb";
33
- layer?: string;
34
- }): Promise<string>;
35
- preview(previewNameOrOpts: string | {
36
- previewName: string;
37
- tscircuitApiKey?: string;
38
- }): Promise<void>;
39
- computeSchematicGlobalTransform(): Matrix;
40
- _computePcbGlobalTransformBeforeLayout(): Matrix;
41
- selectAll(selector: string): PrimitiveComponent[];
42
- selectOne(selector: string, opts?: {
43
- type?: "component" | "port";
44
- }): PrimitiveComponent | null;
45
- }
46
- /**
47
- * @deprecated
48
- */
49
- declare const Project: typeof Circuit;
50
-
51
11
  declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "InitializePortsFromChildren", "CreateNetsFromProps", "CreateTracesFromProps", "CreateTraceHintsFromProps", "SourceRender", "SourceParentAttachment", "PortDiscovery", "PortMatching", "SourceTraceRender", "SchematicComponentRender", "SchematicLayout", "SchematicPortRender", "SchematicTraceRender", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbLayout", "PcbTraceRender", "PcbTraceHintRender", "PcbRouteNetIslands", "PcbComponentSizeCalculation", "CadModelRender"];
52
12
  type RenderPhase = (typeof orderedRenderPhases)[number];
53
13
  type RenderPhaseFn<K extends RenderPhase = RenderPhase> = `doInitial${K}` | `update${K}` | `remove${K}`;
@@ -88,6 +48,51 @@ declare abstract class Renderable implements IRenderable {
88
48
  renderError(message: string | Omit<PcbTraceError, "pcb_error_id"> | Omit<PcbPlacementError, "pcb_error_id">): void;
89
49
  }
90
50
 
51
+ type ReactSubtree = {
52
+ element: ReactElement;
53
+ component: NormalComponent;
54
+ };
55
+
56
+ declare class Circuit {
57
+ firstChild: PrimitiveComponent | null;
58
+ children: PrimitiveComponent[];
59
+ db: SoupUtilObjects;
60
+ root: Circuit | null;
61
+ isRoot: boolean;
62
+ _hasRenderedAtleastOnce: boolean;
63
+ constructor();
64
+ add(componentOrElm: PrimitiveComponent | ReactElement): void;
65
+ /**
66
+ * Get the main board for this Circuit.
67
+ */
68
+ _getBoard(): PrimitiveComponent & {
69
+ boardThickness: number;
70
+ allLayers: LayerRef[];
71
+ };
72
+ _guessRootComponent(): void;
73
+ render(): void;
74
+ getSoup(): AnyCircuitElement[];
75
+ getCircuitJson(): AnyCircuitElement[];
76
+ getSvg(options: {
77
+ view: "pcb";
78
+ layer?: string;
79
+ }): Promise<string>;
80
+ preview(previewNameOrOpts: string | {
81
+ previewName: string;
82
+ tscircuitApiKey?: string;
83
+ }): Promise<void>;
84
+ computeSchematicGlobalTransform(): Matrix;
85
+ _computePcbGlobalTransformBeforeLayout(): Matrix;
86
+ selectAll(selector: string): PrimitiveComponent[];
87
+ selectOne(selector: string, opts?: {
88
+ type?: "component" | "port";
89
+ }): PrimitiveComponent | null;
90
+ }
91
+ /**
92
+ * @deprecated
93
+ */
94
+ declare const Project: typeof Circuit;
95
+
91
96
  interface BaseComponentConfig {
92
97
  componentName: string;
93
98
  schematicSymbolName?: BaseSymbolName | null;
@@ -614,11 +619,6 @@ declare class Port extends PrimitiveComponent<typeof portProps> {
614
619
  _hasMatchedPcbPrimitive(): boolean;
615
620
  }
616
621
 
617
- type ReactSubtree = {
618
- element: ReactElement;
619
- component: NormalComponent;
620
- };
621
-
622
622
  type PortMap<T extends string> = {
623
623
  [K in T]: Port;
624
624
  };