@tscircuit/core 0.0.565 → 0.0.567

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 +16 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -886,10 +886,17 @@ var PrimitiveComponent2 = class extends Renderable {
886
886
  this.parent?.onChildChanged?.(child);
887
887
  }
888
888
  add(component) {
889
- if (Object.keys(component).length === 0) {
890
- if (this.canHaveTextChildren) {
889
+ const textContent = component.__text;
890
+ if (typeof textContent === "string") {
891
+ if (this.canHaveTextChildren || textContent.trim() === "") {
891
892
  return;
892
893
  }
894
+ throw new Error(
895
+ `Invalid JSX Element: Expected a React component but received text "${textContent}"`
896
+ );
897
+ }
898
+ if (Object.keys(component).length === 0) {
899
+ return;
893
900
  }
894
901
  if (this.lowercaseComponentName === "board" && component.lowercaseComponentName === "board") {
895
902
  throw new Error("Nested boards are not supported");
@@ -1241,8 +1248,8 @@ var hostConfig = {
1241
1248
  return createErrorPlaceholderComponent(props, error);
1242
1249
  }
1243
1250
  },
1244
- createTextInstance() {
1245
- return {};
1251
+ createTextInstance(text) {
1252
+ return { __text: text };
1246
1253
  },
1247
1254
  appendInitialChild(parentInstance, child) {
1248
1255
  parentInstance.add(child);
@@ -8835,9 +8842,11 @@ var Diode = class extends NormalComponent {
8835
8842
  get config() {
8836
8843
  const symbolMap = {
8837
8844
  schottky: "schottky_diode",
8838
- avalanche: "avalanche_diode"
8845
+ avalanche: "avalanche_diode",
8846
+ zener: "zener_diode",
8847
+ photodiode: "photodiode"
8839
8848
  };
8840
- const variantSymbol = this.props.schottky ? "schottky" : this.props.avalanche ? "avalanche" : null;
8849
+ const variantSymbol = this.props.schottky ? "schottky" : this.props.avalanche ? "avalanche" : this.props.zener ? "zener" : this.props.photo ? "photodiode" : null;
8841
8850
  return {
8842
8851
  schematicSymbolName: variantSymbol ? symbolMap[variantSymbol] : this.props.symbolName ?? "diode",
8843
8852
  componentName: "Diode",
@@ -10966,7 +10975,7 @@ import { identity as identity5 } from "transformation-matrix";
10966
10975
  var package_default = {
10967
10976
  name: "@tscircuit/core",
10968
10977
  type: "module",
10969
- version: "0.0.564",
10978
+ version: "0.0.566",
10970
10979
  types: "dist/index.d.ts",
10971
10980
  main: "dist/index.js",
10972
10981
  module: "dist/index.js",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.565",
4
+ "version": "0.0.567",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",