@tscircuit/core 0.0.270 → 0.0.271

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 CHANGED
@@ -971,6 +971,7 @@ declare class Board extends Group<typeof boardProps> {
971
971
  }, {
972
972
  name: z.ZodOptional<z.ZodString>;
973
973
  children: z.ZodOptional<z.ZodAny>;
974
+ key: z.ZodOptional<z.ZodAny>;
974
975
  }>, {
975
976
  layout: z.ZodOptional<z.ZodType<_tscircuit_layout.LayoutBuilder, z.ZodTypeDef, _tscircuit_layout.LayoutBuilder>>;
976
977
  manualEdits: z.ZodOptional<z.ZodObject<{
@@ -1186,6 +1187,7 @@ declare class Board extends Group<typeof boardProps> {
1186
1187
  schRotation?: number | undefined;
1187
1188
  layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | undefined;
1188
1189
  footprint?: _tscircuit_props.Footprint | undefined;
1190
+ key?: any;
1189
1191
  name?: string | undefined;
1190
1192
  children?: any;
1191
1193
  width?: number | undefined;
@@ -1249,6 +1251,7 @@ declare class Board extends Group<typeof boardProps> {
1249
1251
  name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
1250
1252
  } | undefined;
1251
1253
  footprint?: _tscircuit_props.Footprint | undefined;
1254
+ key?: any;
1252
1255
  name?: string | undefined;
1253
1256
  children?: any;
1254
1257
  width?: string | number | undefined;
@@ -9898,6 +9901,20 @@ declare const getSimpleRouteJsonFromCircuitJson: ({ circuitJson, minTraceWidth,
9898
9901
  minTraceWidth?: number;
9899
9902
  }) => SimpleRouteJson;
9900
9903
 
9904
+ type RenderEvent = {
9905
+ type: string;
9906
+ renderId: string;
9907
+ createdAt: number;
9908
+ };
9909
+ /**
9910
+ * Given a list of render events, return a map of how much time was spent in each
9911
+ * render phase.
9912
+ *
9913
+ * To get the time spent in each phase, you have to find the end event for each
9914
+ * start event and subtract the createdAt of the start event from the createdAt
9915
+ */
9916
+ declare const getPhaseTimingsFromRenderEvents: (renderEvents: RenderEvent[]) => Record<string, number>;
9917
+
9901
9918
  interface TscircuitElements {
9902
9919
  resistor: _tscircuit_props.ResistorProps;
9903
9920
  capacitor: _tscircuit_props.CapacitorProps;
@@ -9960,4 +9977,4 @@ declare module "react/jsx-runtime" {
9960
9977
  }
9961
9978
  }
9962
9979
 
9963
- export { type AsyncEffect, Battery, Board, Capacitor, Chip, Circuit, type ComponentWithPins, Constraint, Crystal, Diode, FabricationNotePath, FabricationNoteText, Footprint, Group, Hole, type IRenderable, Inductor, Jumper, Keepout, Led, Mosfet, Net, NetAlias, NormalComponent, PinHeader, type PinLabelSpec, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, type RenderPhase, type RenderPhaseFn, type RenderPhaseFunctions, type RenderPhaseStates, Renderable, Resistor, Resonator, RootCircuit, type RootCircuitEventName, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, SmtPad, Subcircuit, Trace, TraceHint, Transistor, Via, applyEditEventsToManualEditsFile, createUseComponent, getSimpleRouteJsonFromCircuitJson, orderedRenderPhases, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
9980
+ export { type AsyncEffect, Battery, Board, Capacitor, Chip, Circuit, type ComponentWithPins, Constraint, Crystal, Diode, FabricationNotePath, FabricationNoteText, Footprint, Group, Hole, type IRenderable, Inductor, Jumper, Keepout, Led, Mosfet, Net, NetAlias, NormalComponent, PinHeader, type PinLabelSpec, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, type RenderPhase, type RenderPhaseFn, type RenderPhaseFunctions, type RenderPhaseStates, Renderable, Resistor, Resonator, RootCircuit, type RootCircuitEventName, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, SmtPad, Subcircuit, Trace, TraceHint, Transistor, Via, applyEditEventsToManualEditsFile, createUseComponent, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, orderedRenderPhases, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
package/dist/index.js CHANGED
@@ -6654,6 +6654,31 @@ var getSimpleRouteJsonFromCircuitJson = ({
6654
6654
  };
6655
6655
  };
6656
6656
 
6657
+ // lib/utils/render-events/getPhaseTimingsFromRenderEvents.ts
6658
+ var getPhaseTimingsFromRenderEvents = (renderEvents) => {
6659
+ const phaseTimings = {};
6660
+ if (!renderEvents) return phaseTimings;
6661
+ for (const renderPhase of orderedRenderPhases) {
6662
+ phaseTimings[renderPhase] = 0;
6663
+ }
6664
+ const startEvents = /* @__PURE__ */ new Map();
6665
+ for (const event of renderEvents) {
6666
+ const [, , phase, eventType] = event.type.split(":");
6667
+ if (eventType === "start") {
6668
+ startEvents.set(`${phase}:${event.renderId}`, event);
6669
+ continue;
6670
+ }
6671
+ if (eventType === "end") {
6672
+ const startEvent = startEvents.get(`${phase}:${event.renderId}`);
6673
+ if (startEvent) {
6674
+ const duration = event.createdAt - startEvent.createdAt;
6675
+ phaseTimings[phase] = (phaseTimings[phase] || 0) + duration;
6676
+ }
6677
+ }
6678
+ }
6679
+ return phaseTimings;
6680
+ };
6681
+
6657
6682
  // lib/index.ts
6658
6683
  import { createElement } from "react";
6659
6684
 
@@ -6710,6 +6735,7 @@ export {
6710
6735
  applyEditEventsToManualEditsFile,
6711
6736
  createElement,
6712
6737
  createUseComponent,
6738
+ getPhaseTimingsFromRenderEvents,
6713
6739
  getSimpleRouteJsonFromCircuitJson,
6714
6740
  orderedRenderPhases,
6715
6741
  useCapacitor,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.270",
4
+ "version": "0.0.271",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -16,7 +16,10 @@
16
16
  "build": "tsup-node index.ts --format esm --dts",
17
17
  "format": "biome format . --write",
18
18
  "measure-bundle": "howfat -r table .",
19
- "pkg-pr-new-release": "bunx pkg-pr-new publish --comment=off --peerDeps"
19
+ "pkg-pr-new-release": "bunx pkg-pr-new publish --comment=off --peerDeps",
20
+ "build:benchmarking": "bun build --experimental-html ./benchmarking/website/index.html --outdir ./benchmarking-dist",
21
+ "build:benchmarking:watch": "chokidar \"./{benchmarking,lib}/**/*.{ts,tsx}\" -c 'bun build --experimental-html ./benchmarking/website/index.html --outdir ./benchmarking-dist'",
22
+ "start:benchmarking": "concurrently \"bun run build:benchmarking:watch\" \"live-server ./benchmarking-dist\""
20
23
  },
21
24
  "devDependencies": {
22
25
  "@biomejs/biome": "^1.8.3",
@@ -26,18 +29,22 @@
26
29
  "@types/bun": "latest",
27
30
  "@types/debug": "^4.1.12",
28
31
  "@types/react": "^19.0.1",
32
+ "@types/react-dom": "^19.0.2",
29
33
  "@types/react-reconciler": "^0.28.9",
30
34
  "bun-match-svg": "0.0.8",
35
+ "chokidar-cli": "^3.0.0",
31
36
  "circuit-to-svg": "^0.0.99",
37
+ "concurrently": "^9.1.2",
32
38
  "debug": "^4.3.6",
33
39
  "graphics-debug": "^0.0.4",
34
40
  "howfat": "^0.3.8",
41
+ "live-server": "^1.2.2",
35
42
  "looks-same": "^9.0.1",
36
43
  "pkg-pr-new": "^0.0.37",
37
- "ts-expect": "^1.3.0",
38
- "tsup": "^8.2.4",
39
44
  "react": "^19.0.0",
40
- "react-dom": "^19.0.0"
45
+ "react-dom": "^19.0.0",
46
+ "ts-expect": "^1.3.0",
47
+ "tsup": "^8.2.4"
41
48
  },
42
49
  "peerDependencies": {
43
50
  "typescript": "^5.0.0"
@@ -46,8 +53,8 @@
46
53
  "@lume/kiwi": "^0.4.3",
47
54
  "@tscircuit/footprinter": "^0.0.97",
48
55
  "@tscircuit/infgrid-ijump-astar": "^0.0.33",
49
- "@tscircuit/math-utils": "^0.0.5",
50
- "@tscircuit/props": "^0.0.129",
56
+ "@tscircuit/math-utils": "^0.0.9",
57
+ "@tscircuit/props": "^0.0.130",
51
58
  "@tscircuit/schematic-autolayout": "^0.0.6",
52
59
  "@tscircuit/soup-util": "^0.0.41",
53
60
  "circuit-json": "^0.0.128",