circuitjson-toolkit 1.0.16 → 1.1.0
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/AGENTS.md +15 -0
- package/NOTICE.md +31 -0
- package/README.md +267 -107
- package/docs/api.md +501 -96
- package/docs/capabilities.md +70 -0
- package/docs/migration/behaviors.md +45 -0
- package/docs/migration/parser.md +60 -0
- package/docs/migration/renderers.md +515 -0
- package/docs/migration/root.md +740 -0
- package/docs/migration.md +120 -0
- package/docs/model-format.md +175 -57
- package/docs/provenance.md +206 -0
- package/docs/release-notes-v1.1.0.md +154 -0
- package/docs/testing.md +117 -7
- package/package.json +31 -5
- package/spec/api-baseline-v1.0.17.json +1 -0
- package/spec/baseline-provenance-v1.0.17.json +7 -0
- package/spec/circuitjson-schema-snapshot.json +321 -0
- package/spec/circuitjson-schema-source.json +28 -0
- package/spec/feature-preservation.json +1 -0
- package/spec/library-scope.md +27 -20
- package/src/capabilities.mjs +1 -0
- package/src/core/ArchiveEntryPath.mjs +93 -0
- package/src/core/ArchiveLimits.mjs +31 -0
- package/src/core/ArchiveLimitsValidator.mjs +107 -0
- package/src/core/AsyncInputOwnership.mjs +56 -0
- package/src/core/AttachedValueLimits.mjs +67 -0
- package/src/core/CircuitJsonDiagnosticIndexer.mjs +184 -0
- package/src/core/CircuitJsonDocument.mjs +19 -61
- package/src/core/CircuitJsonElementTypes.mjs +10 -0
- package/src/core/CircuitJsonElementValidator.mjs +98 -847
- package/src/core/CircuitJsonIndexer.mjs +274 -194
- package/src/core/CircuitJsonManufacturingBuilder.mjs +167 -164
- package/src/core/CircuitJsonParser.mjs +75 -13
- package/src/core/CircuitJsonPcbClearanceDiagnostics.mjs +12 -6
- package/src/core/CircuitJsonPcbHolePrimitiveModel.mjs +108 -10
- package/src/core/CircuitJsonPcbPadPrimitiveModel.mjs +1 -1
- package/src/core/CircuitJsonPcbPrimitiveArtwork.mjs +44 -38
- package/src/core/CircuitJsonPcbPrimitiveBuilder.mjs +146 -28
- package/src/core/CircuitJsonPcbPrimitiveFields.mjs +70 -4
- package/src/core/CircuitJsonPcbPrimitiveIndex.mjs +18 -2
- package/src/core/CircuitJsonPcbPrimitiveOverlays.mjs +26 -9
- package/src/core/CircuitJsonPcbZonePrimitiveBuilder.mjs +7 -6
- package/src/core/CircuitJsonSerializedInputAudit.mjs +87 -0
- package/src/core/CircuitJsonSourceMetadata.mjs +5 -1
- package/src/core/CircuitJsonSupportMatrixBuilder.mjs +3 -1
- package/src/core/CircuitJsonToolkitElementSchema.mjs +218 -0
- package/src/core/CircuitJsonUnitParsers.mjs +101 -0
- package/src/core/CircuitJsonUnits.mjs +13 -87
- package/src/core/CircuitJsonUpstreamSchema.mjs +9 -0
- package/src/core/CircuitJsonUpstreamValidator.mjs +418 -0
- package/src/core/CircuitJsonValidationUnits.mjs +6 -0
- package/src/core/ManufacturingService.mjs +323 -0
- package/src/core/Parser.mjs +343 -0
- package/src/core/ParserOptions.mjs +333 -0
- package/src/core/PcbBoundsSelectionModel.mjs +55 -19
- package/src/core/PcbDiagnosticFocusModel.mjs +42 -11
- package/src/core/PcbInteractionIndex.mjs +368 -0
- package/src/core/PcbInteractionPrimitiveModel.mjs +393 -62
- package/src/core/ProjectAsyncInputOwner.mjs +70 -0
- package/src/core/ProjectLoader.mjs +975 -0
- package/src/core/SimulationService.mjs +790 -0
- package/src/core/ToolkitCapabilities.mjs +130 -0
- package/src/core/ZipArchiveInspector.mjs +649 -0
- package/src/core/context/BinaryDataSnapshot.mjs +217 -0
- package/src/core/context/CircuitJsonContextIndexes.mjs +96 -0
- package/src/core/context/CircuitJsonDerivedCache.mjs +114 -0
- package/src/core/context/CircuitJsonDocumentContext.mjs +353 -0
- package/src/core/context/CircuitJsonLegacyModel.mjs +147 -0
- package/src/core/context/CircuitJsonLegacyNormalizer.mjs +847 -0
- package/src/core/context/CircuitJsonMetadataBoundary.mjs +76 -0
- package/src/core/context/CircuitJsonModelFreezeTraversal.mjs +179 -0
- package/src/core/context/CircuitJsonReadOnlyDocument.mjs +920 -0
- package/src/core/context/CircuitJsonSchematicTableNormalizer.mjs +314 -0
- package/src/core/context/CircuitJsonValidationAuthority.mjs +39 -0
- package/src/core/context/CircuitJsonValidationProof.mjs +217 -0
- package/src/core/context/PcbPrimitivePreparation.mjs +198 -0
- package/src/core/context/PcbSpatialIndex.mjs +701 -0
- package/src/core/context/ProtectedExtensionBinaryBoundary.mjs +128 -0
- package/src/core/context/StructuredDataSnapshot.mjs +683 -0
- package/src/core/contracts/DocumentResult.mjs +198 -0
- package/src/core/contracts/ProjectResult.mjs +96 -0
- package/src/core/contracts/RuntimeProxyBoundary.mjs +48 -0
- package/src/core/contracts/ToolkitAsset.mjs +493 -0
- package/src/core/contracts/ToolkitDiagnostic.mjs +38 -0
- package/src/core/contracts/ToolkitError.mjs +176 -0
- package/src/core/contracts/ToolkitProgress.mjs +89 -0
- package/src/core/interaction/CanonicalInteractionOptions.mjs +246 -0
- package/src/core/interaction/PcbInteractionBounds.mjs +167 -0
- package/src/core/query/CircuitTraversal.mjs +343 -0
- package/src/core/query/ComponentGrouping.mjs +275 -0
- package/src/core/query/QueryNetlistBuilder.mjs +306 -0
- package/src/core/query/QueryService.mjs +435 -0
- package/src/core/query/RegexPattern.mjs +75 -0
- package/src/core/rendering/CanonicalBomOrder.mjs +81 -0
- package/src/core/rendering/CanonicalBomRows.mjs +92 -0
- package/src/core/rendering/CanonicalRenderOptions.mjs +498 -0
- package/src/core/rendering/CanonicalSvgDocument.mjs +102 -0
- package/src/core/rendering/PcbRenderPlan.mjs +429 -0
- package/src/core/rendering/SchematicSheetSelector.mjs +335 -0
- package/src/core/scene3d/PcbScene3dBuilder.mjs +906 -0
- package/src/core/scene3d/PcbScene3dPreparator.mjs +47 -0
- package/src/core/scene3d/Scene3dAssetIndex.mjs +284 -0
- package/src/core/scene3d/Scene3dBoardModel.mjs +596 -0
- package/src/core/scene3d/Scene3dDocumentMetadata.mjs +167 -0
- package/src/core/scene3d/Scene3dFreeze.mjs +37 -0
- package/src/core/scene3d/Scene3dIdRegistry.mjs +34 -0
- package/src/core/scene3d/Scene3dInputPreflight.mjs +193 -0
- package/src/core/scene3d/Scene3dMaterials.mjs +58 -0
- package/src/core/scene3d/Scene3dModelReference.mjs +134 -0
- package/src/core/scene3d/Scene3dOptions.mjs +363 -0
- package/src/core/scene3d/SceneAssetResolver.mjs +441 -0
- package/src/core/simulation/SimulationParameterCloner.mjs +543 -0
- package/src/core/worker/ParserWorkerClient.mjs +997 -0
- package/src/core/worker/ToolkitWorkerProtocol.mjs +412 -0
- package/src/core/worker/WorkerRequestData.mjs +623 -0
- package/src/core/worker/WorkerResponseData.mjs +905 -0
- package/src/extensions.mjs +37 -0
- package/src/index.mjs +14 -9
- package/src/interaction.mjs +2 -0
- package/src/manufacturing.mjs +1 -0
- package/src/parser.mjs +12 -2
- package/src/project.mjs +5 -0
- package/src/query.mjs +1 -0
- package/src/renderers.mjs +3 -29
- package/src/scene3d.mjs +3 -0
- package/src/simulation.mjs +1 -0
- package/src/styles/renderers.css +24 -0
- package/src/testing/ToolkitContractFixtures.mjs +124 -0
- package/src/testing/ToolkitLoopbackWorker.mjs +174 -0
- package/src/testing/runToolkitContract.mjs +705 -0
- package/src/testing.mjs +3 -0
- package/src/ui/BomTableRenderer.mjs +304 -0
- package/src/ui/CircuitJsonPcbBoardSvgRenderer.mjs +80 -0
- package/src/ui/CircuitJsonPcbPrimitiveAttributeRenderer.mjs +3 -5
- package/src/ui/CircuitJsonPcbSvgRenderer.mjs +63 -43
- package/src/ui/CircuitJsonPcbViaSvgRenderer.mjs +3 -5
- package/src/ui/CircuitJsonSchematicDebugRenderer.mjs +164 -0
- package/src/ui/CircuitJsonSchematicImageSvgRenderer.mjs +210 -0
- package/src/ui/CircuitJsonSchematicLineRenderer.mjs +86 -0
- package/src/ui/CircuitJsonSchematicSheetSymbolSvgRenderer.mjs +98 -0
- package/src/ui/CircuitJsonSchematicSvgArcPath.mjs +117 -17
- package/src/ui/CircuitJsonSchematicSvgPortMetadata.mjs +67 -20
- package/src/ui/CircuitJsonSchematicSvgPrimitiveAttributes.mjs +45 -9
- package/src/ui/CircuitJsonSchematicSvgRenderer.mjs +151 -148
- package/src/ui/CircuitJsonSchematicTableSvgRenderer.mjs +4 -292
- package/src/ui/PcbSvgRenderer.mjs +41 -0
- package/src/ui/SafeSvgPaint.mjs +26 -0
- package/src/ui/SafeXmlText.mjs +60 -0
- package/src/ui/SchematicGeometryBounds.mjs +540 -0
- package/src/ui/SchematicSvgRenderer.mjs +110 -0
- package/src/ui/SchematicTableGeometry.mjs +319 -0
- package/src/ui/SchematicTextAnchor.mjs +55 -0
- package/src/ui/SchematicTextBounds.mjs +98 -0
- package/src/workers/parser.worker.mjs +59 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export { CircuitJsonBomBuilder } from './core/CircuitJsonBomBuilder.mjs'
|
|
2
|
+
export { CircuitJsonElementValidator } from './core/CircuitJsonElementValidator.mjs'
|
|
3
|
+
export { CircuitJsonManufacturingBuilder } from './core/CircuitJsonManufacturingBuilder.mjs'
|
|
4
|
+
export { CircuitJsonManufacturingDownloadBuilder } from './core/CircuitJsonManufacturingDownloadBuilder.mjs'
|
|
5
|
+
export { CircuitJsonParser } from './core/CircuitJsonParser.mjs'
|
|
6
|
+
export { CircuitJsonPcbClearanceDiagnostics } from './core/CircuitJsonPcbClearanceDiagnostics.mjs'
|
|
7
|
+
export { CircuitJsonPcbCopperGeometry } from './core/CircuitJsonPcbCopperGeometry.mjs'
|
|
8
|
+
export { CircuitJsonPcbDrawingStyle } from './core/CircuitJsonPcbDrawingStyle.mjs'
|
|
9
|
+
export { CircuitJsonPcbHolePrimitiveModel } from './core/CircuitJsonPcbHolePrimitiveModel.mjs'
|
|
10
|
+
export { CircuitJsonPcbNetMetadata } from './core/CircuitJsonPcbNetMetadata.mjs'
|
|
11
|
+
export { CircuitJsonPcbPadPrimitiveModel } from './core/CircuitJsonPcbPadPrimitiveModel.mjs'
|
|
12
|
+
export { CircuitJsonPcbPrimitiveArtwork } from './core/CircuitJsonPcbPrimitiveArtwork.mjs'
|
|
13
|
+
export { CircuitJsonPcbPrimitiveBuilder } from './core/CircuitJsonPcbPrimitiveBuilder.mjs'
|
|
14
|
+
export { CircuitJsonPcbPrimitiveFields } from './core/CircuitJsonPcbPrimitiveFields.mjs'
|
|
15
|
+
export { CircuitJsonPcbPrimitiveGeometry } from './core/CircuitJsonPcbPrimitiveGeometry.mjs'
|
|
16
|
+
export { CircuitJsonPcbPrimitiveGroups } from './core/CircuitJsonPcbPrimitiveGroups.mjs'
|
|
17
|
+
export { CircuitJsonPcbPrimitiveIndex } from './core/CircuitJsonPcbPrimitiveIndex.mjs'
|
|
18
|
+
export { CircuitJsonPcbPrimitiveOverlays } from './core/CircuitJsonPcbPrimitiveOverlays.mjs'
|
|
19
|
+
export { CircuitJsonPcbTraceLengthModel } from './core/CircuitJsonPcbTraceLengthModel.mjs'
|
|
20
|
+
export { CircuitJsonPcbZonePrimitiveBuilder } from './core/CircuitJsonPcbZonePrimitiveBuilder.mjs'
|
|
21
|
+
export { CircuitJsonSourceMetadata } from './core/CircuitJsonSourceMetadata.mjs'
|
|
22
|
+
export { CircuitJsonSupportMatrixBuilder } from './core/CircuitJsonSupportMatrixBuilder.mjs'
|
|
23
|
+
export { PcbBoundsSelectionModel } from './core/PcbBoundsSelectionModel.mjs'
|
|
24
|
+
export { PcbCandidateSelectionModel } from './core/PcbCandidateSelectionModel.mjs'
|
|
25
|
+
export { PcbDiagnosticFocusModel } from './core/PcbDiagnosticFocusModel.mjs'
|
|
26
|
+
export { PcbInteractionPrimitiveModel } from './core/PcbInteractionPrimitiveModel.mjs'
|
|
27
|
+
export { SelectedPartCircuitJsonExportAdapter } from './core/SelectedPartCircuitJsonExportAdapter.mjs'
|
|
28
|
+
export { SpiceCompatibilityPreprocessor } from './core/spice/SpiceCompatibilityPreprocessor.mjs'
|
|
29
|
+
export { SpiceSimulationService } from './core/spice/SpiceSimulationService.mjs'
|
|
30
|
+
export { CircuitJsonPcbPrimitiveAttributeRenderer } from './ui/CircuitJsonPcbPrimitiveAttributeRenderer.mjs'
|
|
31
|
+
export { CircuitJsonPcbSvgRenderer } from './ui/CircuitJsonPcbSvgRenderer.mjs'
|
|
32
|
+
export { CircuitJsonPcbViaSvgRenderer } from './ui/CircuitJsonPcbViaSvgRenderer.mjs'
|
|
33
|
+
export { CircuitJsonSchematicSvgArcPath } from './ui/CircuitJsonSchematicSvgArcPath.mjs'
|
|
34
|
+
export { CircuitJsonSchematicSvgPortMetadata } from './ui/CircuitJsonSchematicSvgPortMetadata.mjs'
|
|
35
|
+
export { CircuitJsonSchematicSvgPrimitiveAttributes } from './ui/CircuitJsonSchematicSvgPrimitiveAttributes.mjs'
|
|
36
|
+
export { CircuitJsonSchematicSvgRenderer } from './ui/CircuitJsonSchematicSvgRenderer.mjs'
|
|
37
|
+
export { CircuitJsonSchematicTableSvgRenderer } from './ui/CircuitJsonSchematicTableSvgRenderer.mjs'
|
package/src/index.mjs
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
export { CircuitJsonDocument } from './core/CircuitJsonDocument.mjs'
|
|
2
|
-
export { CircuitJsonBomBuilder } from './core/CircuitJsonBomBuilder.mjs'
|
|
3
|
-
export { CircuitJsonElementValidator } from './core/CircuitJsonElementValidator.mjs'
|
|
4
2
|
export { CircuitJsonIndexer } from './core/CircuitJsonIndexer.mjs'
|
|
5
|
-
export { CircuitJsonManufacturingBuilder } from './core/CircuitJsonManufacturingBuilder.mjs'
|
|
6
|
-
export { CircuitJsonParser } from './core/CircuitJsonParser.mjs'
|
|
7
|
-
export { CircuitJsonSourceMetadata } from './core/CircuitJsonSourceMetadata.mjs'
|
|
8
|
-
export { CircuitJsonSupportMatrixBuilder } from './core/CircuitJsonSupportMatrixBuilder.mjs'
|
|
9
3
|
export { CircuitJsonUnits } from './core/CircuitJsonUnits.mjs'
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export
|
|
4
|
+
export { Parser } from './core/Parser.mjs'
|
|
5
|
+
export { ProjectLoader } from './core/ProjectLoader.mjs'
|
|
6
|
+
export { CircuitJsonDocumentContext } from './core/context/CircuitJsonDocumentContext.mjs'
|
|
7
|
+
export { PcbInteractionIndex } from './core/PcbInteractionIndex.mjs'
|
|
8
|
+
export { ManufacturingService } from './core/ManufacturingService.mjs'
|
|
9
|
+
export { SimulationService } from './core/SimulationService.mjs'
|
|
10
|
+
export { ToolkitCapabilities } from './core/ToolkitCapabilities.mjs'
|
|
11
|
+
export { ToolkitError } from './core/contracts/ToolkitError.mjs'
|
|
12
|
+
export { QueryService } from './core/query/QueryService.mjs'
|
|
13
|
+
export { PcbScene3dBuilder } from './core/scene3d/PcbScene3dBuilder.mjs'
|
|
14
|
+
export { PcbScene3dPreparator } from './core/scene3d/PcbScene3dPreparator.mjs'
|
|
15
|
+
export { BomTableRenderer } from './ui/BomTableRenderer.mjs'
|
|
16
|
+
export { PcbSvgRenderer } from './ui/PcbSvgRenderer.mjs'
|
|
17
|
+
export { SchematicSvgRenderer } from './ui/SchematicSvgRenderer.mjs'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ManufacturingService } from './core/ManufacturingService.mjs'
|
package/src/parser.mjs
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { Parser } from './core/Parser.mjs'
|
|
2
|
+
export { CircuitJsonDocumentContext } from './core/context/CircuitJsonDocumentContext.mjs'
|
|
3
|
+
export { DocumentResult } from './core/contracts/DocumentResult.mjs'
|
|
4
|
+
export { ToolkitAsset } from './core/contracts/ToolkitAsset.mjs'
|
|
5
|
+
export { ToolkitDiagnostic } from './core/contracts/ToolkitDiagnostic.mjs'
|
|
6
|
+
export { ToolkitError } from './core/contracts/ToolkitError.mjs'
|
|
7
|
+
export { ToolkitProgress } from './core/contracts/ToolkitProgress.mjs'
|
|
8
|
+
export { ParserWorkerClient } from './core/worker/ParserWorkerClient.mjs'
|
|
9
|
+
export {
|
|
10
|
+
TOOLKIT_WORKER_PROTOCOL,
|
|
11
|
+
ToolkitWorkerProtocol
|
|
12
|
+
} from './core/worker/ToolkitWorkerProtocol.mjs'
|
package/src/project.mjs
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ArchiveEntryPath } from './core/ArchiveEntryPath.mjs'
|
|
2
|
+
export { ArchiveLimits } from './core/ArchiveLimits.mjs'
|
|
3
|
+
export { ProjectLoader } from './core/ProjectLoader.mjs'
|
|
4
|
+
export { ZipArchiveInspector } from './core/ZipArchiveInspector.mjs'
|
|
5
|
+
export { ProjectResult } from './core/contracts/ProjectResult.mjs'
|
package/src/query.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { QueryService } from './core/query/QueryService.mjs'
|
package/src/renderers.mjs
CHANGED
|
@@ -1,29 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export { CircuitJsonPcbDrawingStyle } from './core/CircuitJsonPcbDrawingStyle.mjs'
|
|
5
|
-
export { CircuitJsonPcbHolePrimitiveModel } from './core/CircuitJsonPcbHolePrimitiveModel.mjs'
|
|
6
|
-
export { CircuitJsonPcbNetMetadata } from './core/CircuitJsonPcbNetMetadata.mjs'
|
|
7
|
-
export { CircuitJsonPcbPadPrimitiveModel } from './core/CircuitJsonPcbPadPrimitiveModel.mjs'
|
|
8
|
-
export { CircuitJsonPcbPrimitiveArtwork } from './core/CircuitJsonPcbPrimitiveArtwork.mjs'
|
|
9
|
-
export { CircuitJsonPcbPrimitiveBuilder } from './core/CircuitJsonPcbPrimitiveBuilder.mjs'
|
|
10
|
-
export { CircuitJsonPcbPrimitiveFields } from './core/CircuitJsonPcbPrimitiveFields.mjs'
|
|
11
|
-
export { CircuitJsonPcbPrimitiveGeometry } from './core/CircuitJsonPcbPrimitiveGeometry.mjs'
|
|
12
|
-
export { CircuitJsonPcbPrimitiveGroups } from './core/CircuitJsonPcbPrimitiveGroups.mjs'
|
|
13
|
-
export { CircuitJsonPcbPrimitiveIndex } from './core/CircuitJsonPcbPrimitiveIndex.mjs'
|
|
14
|
-
export { CircuitJsonPcbPrimitiveOverlays } from './core/CircuitJsonPcbPrimitiveOverlays.mjs'
|
|
15
|
-
export { CircuitJsonPcbTraceLengthModel } from './core/CircuitJsonPcbTraceLengthModel.mjs'
|
|
16
|
-
export { CircuitJsonPcbZonePrimitiveBuilder } from './core/CircuitJsonPcbZonePrimitiveBuilder.mjs'
|
|
17
|
-
export { PcbBoundsSelectionModel } from './core/PcbBoundsSelectionModel.mjs'
|
|
18
|
-
export { PcbCandidateSelectionModel } from './core/PcbCandidateSelectionModel.mjs'
|
|
19
|
-
export { PcbDiagnosticFocusModel } from './core/PcbDiagnosticFocusModel.mjs'
|
|
20
|
-
export { PcbInteractionPrimitiveModel } from './core/PcbInteractionPrimitiveModel.mjs'
|
|
21
|
-
export { SelectedPartCircuitJsonExportAdapter } from './core/SelectedPartCircuitJsonExportAdapter.mjs'
|
|
22
|
-
export { CircuitJsonPcbPrimitiveAttributeRenderer } from './ui/CircuitJsonPcbPrimitiveAttributeRenderer.mjs'
|
|
23
|
-
export { CircuitJsonPcbSvgRenderer } from './ui/CircuitJsonPcbSvgRenderer.mjs'
|
|
24
|
-
export { CircuitJsonPcbViaSvgRenderer } from './ui/CircuitJsonPcbViaSvgRenderer.mjs'
|
|
25
|
-
export { CircuitJsonSchematicSvgArcPath } from './ui/CircuitJsonSchematicSvgArcPath.mjs'
|
|
26
|
-
export { CircuitJsonSchematicSvgPortMetadata } from './ui/CircuitJsonSchematicSvgPortMetadata.mjs'
|
|
27
|
-
export { CircuitJsonSchematicSvgPrimitiveAttributes } from './ui/CircuitJsonSchematicSvgPrimitiveAttributes.mjs'
|
|
28
|
-
export { CircuitJsonSchematicSvgRenderer } from './ui/CircuitJsonSchematicSvgRenderer.mjs'
|
|
29
|
-
export { CircuitJsonSchematicTableSvgRenderer } from './ui/CircuitJsonSchematicTableSvgRenderer.mjs'
|
|
1
|
+
export { BomTableRenderer } from './ui/BomTableRenderer.mjs'
|
|
2
|
+
export { PcbSvgRenderer } from './ui/PcbSvgRenderer.mjs'
|
|
3
|
+
export { SchematicSvgRenderer } from './ui/SchematicSvgRenderer.mjs'
|
package/src/scene3d.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SimulationService } from './core/SimulationService.mjs'
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.pcb-svg,
|
|
2
|
+
.schematic-svg {
|
|
3
|
+
display: block;
|
|
4
|
+
width: 100%;
|
|
5
|
+
max-width: 100%;
|
|
6
|
+
height: auto;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.pcb-svg text,
|
|
10
|
+
.schematic-svg text {
|
|
11
|
+
font-family: ui-sans-serif, system-ui, sans-serif;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.bom-table {
|
|
15
|
+
width: 100%;
|
|
16
|
+
border-collapse: collapse;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.bom-table th,
|
|
20
|
+
.bom-table td {
|
|
21
|
+
padding: 0.35rem 0.5rem;
|
|
22
|
+
border: 1px solid currentColor;
|
|
23
|
+
text-align: left;
|
|
24
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
const CANONICAL_CLASS_NAMES = Object.freeze([
|
|
2
|
+
'Parser',
|
|
3
|
+
'ProjectLoader',
|
|
4
|
+
'CircuitJsonDocumentContext',
|
|
5
|
+
'PcbSvgRenderer',
|
|
6
|
+
'SchematicSvgRenderer',
|
|
7
|
+
'BomTableRenderer',
|
|
8
|
+
'PcbInteractionIndex',
|
|
9
|
+
'QueryService',
|
|
10
|
+
'ManufacturingService',
|
|
11
|
+
'SimulationService',
|
|
12
|
+
'PcbScene3dBuilder',
|
|
13
|
+
'PcbScene3dPreparator',
|
|
14
|
+
'ToolkitCapabilities',
|
|
15
|
+
'ToolkitError'
|
|
16
|
+
])
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Supplies small source-independent and source-format contract fixtures.
|
|
20
|
+
*/
|
|
21
|
+
export class ToolkitContractFixtures {
|
|
22
|
+
/** @returns {string[]} Exact canonical root class names. */
|
|
23
|
+
static get canonicalClassNames() {
|
|
24
|
+
return [...CANONICAL_CLASS_NAMES]
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** @returns {object[]} Minimal valid CircuitJSON document. */
|
|
28
|
+
static circuitJsonDocument() {
|
|
29
|
+
return []
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** @returns {Record<string, any>} CircuitJSON contract fixture. */
|
|
33
|
+
static circuitJson() {
|
|
34
|
+
return ToolkitContractFixtures.#fixture(
|
|
35
|
+
'circuitjson',
|
|
36
|
+
'contract.json',
|
|
37
|
+
JSON.stringify(ToolkitContractFixtures.circuitJsonDocument())
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** @returns {Record<string, any>} Gerber contract fixture. */
|
|
42
|
+
static gerber() {
|
|
43
|
+
const source = [
|
|
44
|
+
'G04 ECAD toolkit contract fixture*',
|
|
45
|
+
'%FSLAX24Y24*%',
|
|
46
|
+
'%MOMM*%',
|
|
47
|
+
'%ADD10C,1.000*%',
|
|
48
|
+
'D10*',
|
|
49
|
+
'X000000Y000000D03*',
|
|
50
|
+
'M02*'
|
|
51
|
+
].join('\n')
|
|
52
|
+
return ToolkitContractFixtures.#fixture(
|
|
53
|
+
'gerber',
|
|
54
|
+
'contract.gbr',
|
|
55
|
+
source
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** @returns {Record<string, any>} Altium text-project fixture. */
|
|
60
|
+
static altium() {
|
|
61
|
+
const source = [
|
|
62
|
+
'[Design]',
|
|
63
|
+
'Version=1.0',
|
|
64
|
+
'CurrentVariant=',
|
|
65
|
+
'',
|
|
66
|
+
'[Document1]',
|
|
67
|
+
'DocumentPath=contract.PcbDoc',
|
|
68
|
+
'DocumentUniqueId=CONTRACT'
|
|
69
|
+
].join('\r\n')
|
|
70
|
+
return ToolkitContractFixtures.#fixture(
|
|
71
|
+
'altium',
|
|
72
|
+
'contract.PrjPcb',
|
|
73
|
+
source
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** @returns {Record<string, any>} KiCad PCB contract fixture. */
|
|
78
|
+
static kicad() {
|
|
79
|
+
const source = [
|
|
80
|
+
'(kicad_pcb',
|
|
81
|
+
' (version 20240108)',
|
|
82
|
+
' (generator pcbnew)',
|
|
83
|
+
' (general (thickness 1.6))',
|
|
84
|
+
' (paper "A4")',
|
|
85
|
+
' (layers',
|
|
86
|
+
' (0 "F.Cu" signal)',
|
|
87
|
+
' (31 "B.Cu" signal)',
|
|
88
|
+
' (44 "Edge.Cuts" user)',
|
|
89
|
+
' )',
|
|
90
|
+
' (setup (pad_to_mask_clearance 0))',
|
|
91
|
+
')'
|
|
92
|
+
].join('\n')
|
|
93
|
+
return ToolkitContractFixtures.#fixture(
|
|
94
|
+
'kicad',
|
|
95
|
+
'contract.kicad_pcb',
|
|
96
|
+
source
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Builds one complete generic fixture record.
|
|
102
|
+
* @param {string} format Source format.
|
|
103
|
+
* @param {string} fileName Source file name.
|
|
104
|
+
* @param {string} data Source data.
|
|
105
|
+
* @returns {Record<string, any>} Contract fixture.
|
|
106
|
+
*/
|
|
107
|
+
static #fixture(format, fileName, data) {
|
|
108
|
+
return {
|
|
109
|
+
schema: 'ecad-toolkit.contract-fixture.v1',
|
|
110
|
+
format,
|
|
111
|
+
parserInput: { fileName, data },
|
|
112
|
+
unsupportedInput: {
|
|
113
|
+
fileName: `unsupported-${format}.txt`,
|
|
114
|
+
data: 'not an ECAD document'
|
|
115
|
+
},
|
|
116
|
+
projectEntries: [{ name: fileName, data }],
|
|
117
|
+
renderOptions: {
|
|
118
|
+
pcb: { side: 'top', fidelity: 'canonical' },
|
|
119
|
+
pcbBottom: { side: 'bottom', fidelity: 'canonical' },
|
|
120
|
+
schematic: { fidelity: 'canonical' }
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { ToolkitWorkerProtocol } from '../core/worker/ToolkitWorkerProtocol.mjs'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Provides a real protocol loopback for packed cross-toolkit conformance tests.
|
|
5
|
+
*/
|
|
6
|
+
export class ToolkitLoopbackWorker {
|
|
7
|
+
#clientListeners = new Map()
|
|
8
|
+
#installation
|
|
9
|
+
#observations
|
|
10
|
+
#serverListeners = new Map()
|
|
11
|
+
#terminated = false
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Creates one worker-like protocol endpoint for a canonical toolkit.
|
|
15
|
+
* @param {Record<string, any>} toolkit Toolkit namespace.
|
|
16
|
+
* @param {{ parse: number, loadProject: number }} observations Request counts.
|
|
17
|
+
*/
|
|
18
|
+
constructor(toolkit, observations) {
|
|
19
|
+
this.#observations = observations
|
|
20
|
+
const scope = {
|
|
21
|
+
addEventListener: (type, listener) =>
|
|
22
|
+
this.#add(this.#serverListeners, type, listener),
|
|
23
|
+
removeEventListener: (type, listener) =>
|
|
24
|
+
this.#remove(this.#serverListeners, type, listener),
|
|
25
|
+
postMessage: (message, transfer = []) =>
|
|
26
|
+
this.#postToClient(message, transfer),
|
|
27
|
+
reportError: (error) => this.#reportError(error)
|
|
28
|
+
}
|
|
29
|
+
this.#installation = ToolkitWorkerProtocol.install(scope, {
|
|
30
|
+
parse: async (payload, runtime) => {
|
|
31
|
+
observations.parse += 1
|
|
32
|
+
return await toolkit.Parser.parseAsync(payload.input, {
|
|
33
|
+
...(payload.options || {}),
|
|
34
|
+
worker: false,
|
|
35
|
+
signal: runtime.signal,
|
|
36
|
+
onProgress: runtime.onProgress
|
|
37
|
+
})
|
|
38
|
+
},
|
|
39
|
+
loadProject: async (payload, runtime) => {
|
|
40
|
+
observations.loadProject += 1
|
|
41
|
+
return await toolkit.ProjectLoader.loadAsync(payload.entries, {
|
|
42
|
+
...(payload.options || {}),
|
|
43
|
+
worker: false,
|
|
44
|
+
signal: runtime.signal,
|
|
45
|
+
onProgress: runtime.onProgress
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Creates a Worker constructor bound to one toolkit namespace.
|
|
53
|
+
* @param {Record<string, any>} toolkit Toolkit namespace.
|
|
54
|
+
* @param {{ parse: number, loadProject: number }} observations Request counts.
|
|
55
|
+
* @returns {typeof ToolkitLoopbackWorker} Bound worker constructor.
|
|
56
|
+
*/
|
|
57
|
+
static constructorFor(toolkit, observations) {
|
|
58
|
+
return class BoundToolkitLoopbackWorker extends ToolkitLoopbackWorker {
|
|
59
|
+
/** Creates a worker bound to the enclosing toolkit. */
|
|
60
|
+
constructor() {
|
|
61
|
+
super(toolkit, observations)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Adds one client-side worker event listener.
|
|
68
|
+
* @param {string} type Event type.
|
|
69
|
+
* @param {Function} listener Event listener.
|
|
70
|
+
* @returns {void}
|
|
71
|
+
*/
|
|
72
|
+
addEventListener(type, listener) {
|
|
73
|
+
this.#add(this.#clientListeners, type, listener)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Removes one client-side worker event listener.
|
|
78
|
+
* @param {string} type Event type.
|
|
79
|
+
* @param {Function} listener Event listener.
|
|
80
|
+
* @returns {void}
|
|
81
|
+
*/
|
|
82
|
+
removeEventListener(type, listener) {
|
|
83
|
+
this.#remove(this.#clientListeners, type, listener)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Posts one client request through a clone boundary to the protocol server.
|
|
88
|
+
* @param {unknown} message Protocol message.
|
|
89
|
+
* @param {Transferable[]} [transfer] Explicit transfer list.
|
|
90
|
+
* @returns {void}
|
|
91
|
+
*/
|
|
92
|
+
postMessage(message, transfer = []) {
|
|
93
|
+
if (this.#terminated) throw new Error('Loopback worker is terminated.')
|
|
94
|
+
const cloned = structuredClone(message, { transfer })
|
|
95
|
+
queueMicrotask(() =>
|
|
96
|
+
this.#emit(this.#serverListeners, 'message', cloned)
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** Stops the loopback worker and active protocol operations. */
|
|
101
|
+
terminate() {
|
|
102
|
+
if (this.#terminated) return
|
|
103
|
+
this.#terminated = true
|
|
104
|
+
this.#installation.dispose()
|
|
105
|
+
this.#clientListeners.clear()
|
|
106
|
+
this.#serverListeners.clear()
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Adds one listener to an event registry.
|
|
111
|
+
* @param {Map<string, Set<Function>>} registry Event registry.
|
|
112
|
+
* @param {string} type Event type.
|
|
113
|
+
* @param {Function} listener Event listener.
|
|
114
|
+
* @returns {void}
|
|
115
|
+
*/
|
|
116
|
+
#add(registry, type, listener) {
|
|
117
|
+
if (typeof listener !== 'function') return
|
|
118
|
+
if (!registry.has(type)) registry.set(type, new Set())
|
|
119
|
+
registry.get(type).add(listener)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Removes one listener from an event registry.
|
|
124
|
+
* @param {Map<string, Set<Function>>} registry Event registry.
|
|
125
|
+
* @param {string} type Event type.
|
|
126
|
+
* @param {Function} listener Event listener.
|
|
127
|
+
* @returns {void}
|
|
128
|
+
*/
|
|
129
|
+
#remove(registry, type, listener) {
|
|
130
|
+
registry.get(type)?.delete(listener)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Emits one plain worker-like event.
|
|
135
|
+
* @param {Map<string, Set<Function>>} registry Event registry.
|
|
136
|
+
* @param {string} type Event type.
|
|
137
|
+
* @param {unknown} data Event data.
|
|
138
|
+
* @returns {void}
|
|
139
|
+
*/
|
|
140
|
+
#emit(registry, type, data) {
|
|
141
|
+
if (this.#terminated) return
|
|
142
|
+
for (const listener of registry.get(type) || []) {
|
|
143
|
+
listener({ data })
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Posts one protocol response through a clone boundary to the client.
|
|
149
|
+
* @param {unknown} message Protocol response.
|
|
150
|
+
* @param {Transferable[]} transfer Transfer list.
|
|
151
|
+
* @returns {void}
|
|
152
|
+
*/
|
|
153
|
+
#postToClient(message, transfer) {
|
|
154
|
+
if (this.#terminated) return
|
|
155
|
+
const cloned = structuredClone(message, { transfer })
|
|
156
|
+
queueMicrotask(() =>
|
|
157
|
+
this.#emit(this.#clientListeners, 'message', cloned)
|
|
158
|
+
)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Emits one worker error event to the client.
|
|
163
|
+
* @param {unknown} error Worker failure.
|
|
164
|
+
* @returns {void}
|
|
165
|
+
*/
|
|
166
|
+
#reportError(error) {
|
|
167
|
+
if (this.#terminated) return
|
|
168
|
+
queueMicrotask(() => {
|
|
169
|
+
for (const listener of this.#clientListeners.get('error') || []) {
|
|
170
|
+
listener({ error, message: String(error?.message || error) })
|
|
171
|
+
}
|
|
172
|
+
})
|
|
173
|
+
}
|
|
174
|
+
}
|