@tscircuit/core 0.0.566 → 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 +12 -5
  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);
@@ -10968,7 +10975,7 @@ import { identity as identity5 } from "transformation-matrix";
10968
10975
  var package_default = {
10969
10976
  name: "@tscircuit/core",
10970
10977
  type: "module",
10971
- version: "0.0.565",
10978
+ version: "0.0.566",
10972
10979
  types: "dist/index.d.ts",
10973
10980
  main: "dist/index.js",
10974
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.566",
4
+ "version": "0.0.567",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",