@tscircuit/core 0.0.895 → 0.0.897

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 (2) hide show
  1. package/dist/index.js +17 -12
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -274,7 +274,10 @@ ${error.stack}`
274
274
  return this.constructor.name;
275
275
  }
276
276
  _hasIncompleteAsyncEffects() {
277
- return this._asyncEffects.some((effect) => !effect.complete);
277
+ if (this._asyncEffects.some((effect) => !effect.complete)) return true;
278
+ return this.children.some(
279
+ (child) => typeof child._hasIncompleteAsyncEffects === "function" ? child._hasIncompleteAsyncEffects() : false
280
+ );
278
281
  }
279
282
  _hasIncompleteAsyncEffectsInSubtreeForPhase(phase) {
280
283
  for (const e of this._asyncEffects) {
@@ -3133,6 +3136,13 @@ var Hole = class extends PrimitiveComponent2 {
3133
3136
  // lib/components/primitive-components/SilkscreenText.ts
3134
3137
  import { silkscreenTextProps } from "@tscircuit/props";
3135
3138
  import { decomposeTSR as decomposeTSR3 } from "transformation-matrix";
3139
+
3140
+ // lib/utils/normalizeTextForCircuitJson.ts
3141
+ function normalizeTextForCircuitJson(text) {
3142
+ return text.replace(/\\n/g, "\n");
3143
+ }
3144
+
3145
+ // lib/components/primitive-components/SilkscreenText.ts
3136
3146
  var SilkscreenText = class extends PrimitiveComponent2 {
3137
3147
  isPcbPrimitive = true;
3138
3148
  get config() {
@@ -3174,7 +3184,7 @@ var SilkscreenText = class extends PrimitiveComponent2 {
3174
3184
  font: props.font ?? "tscircuit2024",
3175
3185
  font_size: fontSize,
3176
3186
  layer: maybeFlipLayer(layer),
3177
- text: props.text ?? "",
3187
+ text: normalizeTextForCircuitJson(props.text ?? ""),
3178
3188
  ccw_rotation: rotation4,
3179
3189
  pcb_component_id: container.pcb_component_id,
3180
3190
  subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
@@ -16918,7 +16928,7 @@ var FabricationNoteText = class extends PrimitiveComponent2 {
16918
16928
  font_size: props.fontSize ?? 1,
16919
16929
  layer: "top",
16920
16930
  color: props.color,
16921
- text: props.text ?? "",
16931
+ text: normalizeTextForCircuitJson(props.text ?? ""),
16922
16932
  pcb_component_id: container.pcb_component_id,
16923
16933
  subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
16924
16934
  pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
@@ -17137,7 +17147,7 @@ var PcbNoteText = class extends PrimitiveComponent2 {
17137
17147
  pcb_group_id: group?.pcb_group_id ?? void 0,
17138
17148
  font: props.font ?? "tscircuit2024",
17139
17149
  font_size: props.fontSize ?? 1,
17140
- text: props.text,
17150
+ text: normalizeTextForCircuitJson(props.text),
17141
17151
  anchor_position: anchorPosition,
17142
17152
  anchor_alignment: props.anchorAlignment ?? "center",
17143
17153
  color: props.color
@@ -18538,7 +18548,7 @@ var SchematicText = class extends PrimitiveComponent2 {
18538
18548
  const globalPos = this._getGlobalSchematicPositionBeforeLayout();
18539
18549
  db.schematic_text.insert({
18540
18550
  anchor: props.anchor ?? "center",
18541
- text: props.text,
18551
+ text: normalizeTextForCircuitJson(props.text),
18542
18552
  font_size: props.fontSize,
18543
18553
  color: props.color || "#000000",
18544
18554
  position: {
@@ -19224,7 +19234,7 @@ import { identity as identity6 } from "transformation-matrix";
19224
19234
  var package_default = {
19225
19235
  name: "@tscircuit/core",
19226
19236
  type: "module",
19227
- version: "0.0.894",
19237
+ version: "0.0.896",
19228
19238
  types: "dist/index.d.ts",
19229
19239
  main: "dist/index.js",
19230
19240
  module: "dist/index.js",
@@ -19468,12 +19478,7 @@ var RootCircuit = class {
19468
19478
  this.emit("renderComplete");
19469
19479
  }
19470
19480
  _hasIncompleteAsyncEffects() {
19471
- return this.children.some((child) => {
19472
- if (child._hasIncompleteAsyncEffects()) return true;
19473
- return child.children.some(
19474
- (grandchild) => grandchild._hasIncompleteAsyncEffects()
19475
- );
19476
- });
19481
+ return this.children.some((child) => child._hasIncompleteAsyncEffects());
19477
19482
  }
19478
19483
  getCircuitJson() {
19479
19484
  if (!this._hasRenderedAtleastOnce) this.render();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.895",
4
+ "version": "0.0.897",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",