@tscircuit/core 0.0.269 → 0.0.270
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 +10 -0
- package/dist/index.js +17 -4
- package/package.json +6 -5
package/dist/index.d.ts
CHANGED
|
@@ -66,6 +66,16 @@ declare abstract class Renderable implements IRenderable {
|
|
|
66
66
|
renderError(message: string | Omit<PcbTraceError, "pcb_error_id"> | Omit<PcbPlacementError, "pcb_error_id"> | Omit<PcbManualEditConflictError, "pcb_error_id">): void;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
/**
|
|
70
|
+
* This is how we render in React. This can be a confusing part of the codebase,
|
|
71
|
+
* but here are some helpful reference implementations:
|
|
72
|
+
*
|
|
73
|
+
* https://github.com/diegomura/react-pdf/blob/fabecc56727dfb6d590a3fa1e11f50250ecbbea1/packages/reconciler/src/reconciler-31.js
|
|
74
|
+
* https://github.com/pmndrs/react-three-fiber/blob/ec4f00bb61cc4f6e28b3a12b1dca9daa5594f10e/packages/fiber/src/core/renderer.ts
|
|
75
|
+
*
|
|
76
|
+
*
|
|
77
|
+
*/
|
|
78
|
+
|
|
69
79
|
type ReactSubtree = {
|
|
70
80
|
element: ReactElement;
|
|
71
81
|
component: NormalComponent;
|
package/dist/index.js
CHANGED
|
@@ -57,6 +57,7 @@ import Debug4 from "debug";
|
|
|
57
57
|
|
|
58
58
|
// lib/fiber/create-instance-from-react-element.ts
|
|
59
59
|
import ReactReconciler from "react-reconciler";
|
|
60
|
+
import { DefaultEventPriority } from "react-reconciler/constants";
|
|
60
61
|
|
|
61
62
|
// lib/components/base-components/Renderable.ts
|
|
62
63
|
import Debug from "debug";
|
|
@@ -354,9 +355,6 @@ var hostConfig = {
|
|
|
354
355
|
},
|
|
355
356
|
noTimeout: void 0,
|
|
356
357
|
isPrimaryRenderer: false,
|
|
357
|
-
getCurrentEventPriority() {
|
|
358
|
-
throw new Error("Function not implemented.");
|
|
359
|
-
},
|
|
360
358
|
getInstanceFromNode(node) {
|
|
361
359
|
throw new Error("Function not implemented.");
|
|
362
360
|
},
|
|
@@ -375,6 +373,15 @@ var hostConfig = {
|
|
|
375
373
|
detachDeletedInstance: (node) => {
|
|
376
374
|
throw new Error("Function not implemented.");
|
|
377
375
|
},
|
|
376
|
+
// https://github.com/pmndrs/react-three-fiber/pull/2360#discussion_r916356874
|
|
377
|
+
getCurrentEventPriority: () => DefaultEventPriority,
|
|
378
|
+
// @ts-expect-error
|
|
379
|
+
// https://github.com/diegomura/react-pdf/blob/fabecc56727dfb6d590a3fa1e11f50250ecbbea1/packages/reconciler/src/reconciler-31.js#L57
|
|
380
|
+
getCurrentUpdatePriority: () => DefaultEventPriority,
|
|
381
|
+
resolveUpdatePriority: () => DefaultEventPriority,
|
|
382
|
+
setCurrentUpdatePriority: () => {
|
|
383
|
+
},
|
|
384
|
+
maySuspendCommit: () => false,
|
|
378
385
|
supportsHydration: false
|
|
379
386
|
};
|
|
380
387
|
var reconciler = ReactReconciler(hostConfig);
|
|
@@ -392,6 +399,7 @@ var createInstanceFromReactElement = (reactElm) => {
|
|
|
392
399
|
return identity();
|
|
393
400
|
}
|
|
394
401
|
};
|
|
402
|
+
const containerErrors = [];
|
|
395
403
|
const container = reconciler.createContainer(
|
|
396
404
|
// TODO Replace with store like react-three-fiber
|
|
397
405
|
// https://github.com/pmndrs/react-three-fiber/blob/a457290856f57741bf8beef4f6ff9dbf4879c0a5/packages/fiber/src/core/index.tsx#L172
|
|
@@ -405,11 +413,16 @@ var createInstanceFromReactElement = (reactElm) => {
|
|
|
405
413
|
(error) => {
|
|
406
414
|
console.log("Error in createContainer");
|
|
407
415
|
console.error(error);
|
|
416
|
+
containerErrors.push(error);
|
|
408
417
|
},
|
|
409
418
|
null
|
|
410
419
|
);
|
|
411
|
-
reconciler.
|
|
420
|
+
reconciler.updateContainerSync(reactElm, container, null, () => {
|
|
412
421
|
});
|
|
422
|
+
reconciler.flushSyncWork();
|
|
423
|
+
if (containerErrors.length > 0) {
|
|
424
|
+
throw containerErrors[0];
|
|
425
|
+
}
|
|
413
426
|
const rootInstance = reconciler.getPublicRootInstance(
|
|
414
427
|
container
|
|
415
428
|
);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.270",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@types/bun": "latest",
|
|
27
27
|
"@types/debug": "^4.1.12",
|
|
28
28
|
"@types/react": "^19.0.1",
|
|
29
|
-
"@types/react-reconciler": "^0.28.
|
|
29
|
+
"@types/react-reconciler": "^0.28.9",
|
|
30
30
|
"bun-match-svg": "0.0.8",
|
|
31
31
|
"circuit-to-svg": "^0.0.99",
|
|
32
32
|
"debug": "^4.3.6",
|
|
@@ -35,7 +35,9 @@
|
|
|
35
35
|
"looks-same": "^9.0.1",
|
|
36
36
|
"pkg-pr-new": "^0.0.37",
|
|
37
37
|
"ts-expect": "^1.3.0",
|
|
38
|
-
"tsup": "^8.2.4"
|
|
38
|
+
"tsup": "^8.2.4",
|
|
39
|
+
"react": "^19.0.0",
|
|
40
|
+
"react-dom": "^19.0.0"
|
|
39
41
|
},
|
|
40
42
|
"peerDependencies": {
|
|
41
43
|
"typescript": "^5.0.0"
|
|
@@ -53,8 +55,7 @@
|
|
|
53
55
|
"format-si-unit": "^0.0.2",
|
|
54
56
|
"nanoid": "^5.0.7",
|
|
55
57
|
"performance-now": "^2.1.0",
|
|
56
|
-
"react": "^
|
|
57
|
-
"react-reconciler": "^0.29.2",
|
|
58
|
+
"react-reconciler": "^0.31.0",
|
|
58
59
|
"schematic-symbols": "^0.0.113",
|
|
59
60
|
"transformation-matrix": "^2.16.1",
|
|
60
61
|
"zod": "^3.23.8"
|