@tscircuit/cli 0.1.321 → 0.1.322
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/main.js +447 -384
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -57993,7 +57993,7 @@ var require_dist7 = __commonJS((exports2, module2) => {
|
|
|
57993
57993
|
});
|
|
57994
57994
|
};
|
|
57995
57995
|
traverse(program3, []);
|
|
57996
|
-
return allCommandPaths.filter((
|
|
57996
|
+
return allCommandPaths.filter((path22) => path22 !== "");
|
|
57997
57997
|
};
|
|
57998
57998
|
var normalizeCommandName = (s) => s.replace(/_/g, "-").toLowerCase();
|
|
57999
57999
|
var getCommandFromPath = (program3, commandPathAndPositionalArgs) => {
|
|
@@ -58001,7 +58001,7 @@ var require_dist7 = __commonJS((exports2, module2) => {
|
|
|
58001
58001
|
return commandPath.reduce((curr, nextCommandName) => !curr ? null : curr.commands.find((c) => normalizeCommandName(c.name()) === normalizeCommandName(nextCommandName)), program3);
|
|
58002
58002
|
};
|
|
58003
58003
|
var getCommandPathOnly = (program3, commandPathAndPositionalArgs) => {
|
|
58004
|
-
const allLeafCommandPaths = getAllLeafCommandPaths(program3).map((
|
|
58004
|
+
const allLeafCommandPaths = getAllLeafCommandPaths(program3).map((path22) => normalizeCommandName(path22));
|
|
58005
58005
|
const commandPath = [];
|
|
58006
58006
|
for (const elm of commandPathAndPositionalArgs) {
|
|
58007
58007
|
if (elm.startsWith("-"))
|
|
@@ -61162,8 +61162,8 @@ var require_utils6 = __commonJS((exports2) => {
|
|
|
61162
61162
|
var result = transform[inputType][outputType](input);
|
|
61163
61163
|
return result;
|
|
61164
61164
|
};
|
|
61165
|
-
exports2.resolve = function(
|
|
61166
|
-
var parts =
|
|
61165
|
+
exports2.resolve = function(path22) {
|
|
61166
|
+
var parts = path22.split("/");
|
|
61167
61167
|
var result = [];
|
|
61168
61168
|
for (var index = 0;index < parts.length; index++) {
|
|
61169
61169
|
var part = parts[index];
|
|
@@ -66613,18 +66613,18 @@ var require_object = __commonJS((exports2, module2) => {
|
|
|
66613
66613
|
var object = new ZipObject(name, zipObjectContent, o);
|
|
66614
66614
|
this.files[name] = object;
|
|
66615
66615
|
};
|
|
66616
|
-
var parentFolder = function(
|
|
66617
|
-
if (
|
|
66618
|
-
|
|
66616
|
+
var parentFolder = function(path22) {
|
|
66617
|
+
if (path22.slice(-1) === "/") {
|
|
66618
|
+
path22 = path22.substring(0, path22.length - 1);
|
|
66619
66619
|
}
|
|
66620
|
-
var lastSlash =
|
|
66621
|
-
return lastSlash > 0 ?
|
|
66620
|
+
var lastSlash = path22.lastIndexOf("/");
|
|
66621
|
+
return lastSlash > 0 ? path22.substring(0, lastSlash) : "";
|
|
66622
66622
|
};
|
|
66623
|
-
var forceTrailingSlash = function(
|
|
66624
|
-
if (
|
|
66625
|
-
|
|
66623
|
+
var forceTrailingSlash = function(path22) {
|
|
66624
|
+
if (path22.slice(-1) !== "/") {
|
|
66625
|
+
path22 += "/";
|
|
66626
66626
|
}
|
|
66627
|
-
return
|
|
66627
|
+
return path22;
|
|
66628
66628
|
};
|
|
66629
66629
|
var folderAdd = function(name, createFolders) {
|
|
66630
66630
|
createFolders = typeof createFolders !== "undefined" ? createFolders : defaults.createFolders;
|
|
@@ -71529,11 +71529,16 @@ import * as path9 from "node:path";
|
|
|
71529
71529
|
import { z } from "zod";
|
|
71530
71530
|
var projectConfigSchema = z.object({
|
|
71531
71531
|
mainEntrypoint: z.string().optional(),
|
|
71532
|
-
ignoredFiles: z.array(z.string()).optional()
|
|
71532
|
+
ignoredFiles: z.array(z.string()).optional(),
|
|
71533
|
+
includeBoardFiles: z.array(z.string()).optional()
|
|
71533
71534
|
});
|
|
71534
71535
|
|
|
71535
71536
|
// lib/project-config/index.ts
|
|
71536
71537
|
var CONFIG_FILENAME = "tscircuit.config.json";
|
|
71538
|
+
var DEFAULT_BOARD_FILE_PATTERNS = [
|
|
71539
|
+
"**/*.board.tsx",
|
|
71540
|
+
"**/*.circuit.tsx"
|
|
71541
|
+
];
|
|
71537
71542
|
var loadProjectConfig = (projectDir = process.cwd()) => {
|
|
71538
71543
|
const configPath = path9.join(projectDir, CONFIG_FILENAME);
|
|
71539
71544
|
if (!fs6.existsSync(configPath)) {
|
|
@@ -71548,6 +71553,14 @@ var loadProjectConfig = (projectDir = process.cwd()) => {
|
|
|
71548
71553
|
return null;
|
|
71549
71554
|
}
|
|
71550
71555
|
};
|
|
71556
|
+
var getBoardFilePatterns = (projectDir = process.cwd()) => {
|
|
71557
|
+
const config = loadProjectConfig(projectDir);
|
|
71558
|
+
const patterns = config?.includeBoardFiles?.filter((pattern) => pattern.trim());
|
|
71559
|
+
if (patterns && patterns.length > 0) {
|
|
71560
|
+
return patterns;
|
|
71561
|
+
}
|
|
71562
|
+
return DEFAULT_BOARD_FILE_PATTERNS;
|
|
71563
|
+
};
|
|
71551
71564
|
var saveProjectConfig = (config, projectDir = process.cwd()) => {
|
|
71552
71565
|
const configPath = path9.join(projectDir, CONFIG_FILENAME);
|
|
71553
71566
|
try {
|
|
@@ -72180,7 +72193,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
|
|
|
72180
72193
|
import { execSync as execSync2 } from "node:child_process";
|
|
72181
72194
|
var import_semver2 = __toESM2(require_semver2(), 1);
|
|
72182
72195
|
// package.json
|
|
72183
|
-
var version = "0.1.
|
|
72196
|
+
var version = "0.1.321";
|
|
72184
72197
|
var package_default = {
|
|
72185
72198
|
name: "@tscircuit/cli",
|
|
72186
72199
|
version,
|
|
@@ -72441,9 +72454,9 @@ export default () => (
|
|
|
72441
72454
|
};
|
|
72442
72455
|
|
|
72443
72456
|
// cli/dev/register.ts
|
|
72444
|
-
import * as
|
|
72457
|
+
import * as fs20 from "node:fs";
|
|
72445
72458
|
import * as net from "node:net";
|
|
72446
|
-
import * as
|
|
72459
|
+
import * as path20 from "node:path";
|
|
72447
72460
|
|
|
72448
72461
|
// lib/dependency-analysis/installNodeModuleTypesForSnippet.ts
|
|
72449
72462
|
import * as fs8 from "node:fs";
|
|
@@ -77071,13 +77084,73 @@ var getVersion = () => {
|
|
|
77071
77084
|
return import_semver4.default.inc(package_default.version, "patch") ?? package_default.version;
|
|
77072
77085
|
};
|
|
77073
77086
|
|
|
77087
|
+
// lib/shared/find-board-files.ts
|
|
77088
|
+
import fs19 from "node:fs";
|
|
77089
|
+
import path19 from "node:path";
|
|
77090
|
+
var isSubPath = (maybeChild, maybeParent) => {
|
|
77091
|
+
const relative5 = path19.relative(maybeParent, maybeChild);
|
|
77092
|
+
return relative5 === "" || !relative5.startsWith("..") && !path19.isAbsolute(relative5);
|
|
77093
|
+
};
|
|
77094
|
+
var findBoardFiles = ({
|
|
77095
|
+
projectDir = process.cwd(),
|
|
77096
|
+
ignore = DEFAULT_IGNORED_PATTERNS,
|
|
77097
|
+
filePaths = []
|
|
77098
|
+
} = {}) => {
|
|
77099
|
+
const resolvedProjectDir = path19.resolve(projectDir);
|
|
77100
|
+
const boardFilePatterns = getBoardFilePatterns(resolvedProjectDir);
|
|
77101
|
+
const relativeBoardFiles = globbySync(boardFilePatterns, {
|
|
77102
|
+
cwd: resolvedProjectDir,
|
|
77103
|
+
ignore
|
|
77104
|
+
});
|
|
77105
|
+
const absoluteBoardFiles = relativeBoardFiles.map((f) => path19.join(resolvedProjectDir, f));
|
|
77106
|
+
const boardFileSet = new Set;
|
|
77107
|
+
const resolvedPaths = filePaths.map((f) => path19.resolve(resolvedProjectDir, f));
|
|
77108
|
+
if (resolvedPaths.length > 0) {
|
|
77109
|
+
for (const targetPath of resolvedPaths) {
|
|
77110
|
+
if (!fs19.existsSync(targetPath)) {
|
|
77111
|
+
continue;
|
|
77112
|
+
}
|
|
77113
|
+
const stat4 = fs19.statSync(targetPath);
|
|
77114
|
+
if (stat4.isDirectory()) {
|
|
77115
|
+
const resolvedDir = path19.resolve(targetPath);
|
|
77116
|
+
if (isSubPath(resolvedDir, resolvedProjectDir)) {
|
|
77117
|
+
for (const boardFile of absoluteBoardFiles) {
|
|
77118
|
+
if (isSubPath(boardFile, resolvedDir)) {
|
|
77119
|
+
boardFileSet.add(boardFile);
|
|
77120
|
+
}
|
|
77121
|
+
}
|
|
77122
|
+
} else {
|
|
77123
|
+
const externalMatches = globbySync(boardFilePatterns, {
|
|
77124
|
+
cwd: resolvedDir,
|
|
77125
|
+
ignore
|
|
77126
|
+
}).map((f) => path19.join(resolvedDir, f));
|
|
77127
|
+
for (const match of externalMatches) {
|
|
77128
|
+
boardFileSet.add(match);
|
|
77129
|
+
}
|
|
77130
|
+
}
|
|
77131
|
+
} else {
|
|
77132
|
+
boardFileSet.add(targetPath);
|
|
77133
|
+
}
|
|
77134
|
+
}
|
|
77135
|
+
} else {
|
|
77136
|
+
for (const boardFile of absoluteBoardFiles) {
|
|
77137
|
+
boardFileSet.add(boardFile);
|
|
77138
|
+
}
|
|
77139
|
+
}
|
|
77140
|
+
return Array.from(boardFileSet).sort((a, b) => a.localeCompare(b));
|
|
77141
|
+
};
|
|
77142
|
+
|
|
77074
77143
|
// cli/dev/register.ts
|
|
77075
77144
|
var findSelectableTsxFiles = (projectDir) => {
|
|
77145
|
+
const boardFiles = findBoardFiles({ projectDir }).filter((file) => fs20.existsSync(file)).sort();
|
|
77146
|
+
if (boardFiles.length > 0) {
|
|
77147
|
+
return boardFiles;
|
|
77148
|
+
}
|
|
77076
77149
|
const files = globbySync(["**/*.tsx", "**/*.ts"], {
|
|
77077
77150
|
cwd: projectDir,
|
|
77078
77151
|
ignore: DEFAULT_IGNORED_PATTERNS
|
|
77079
77152
|
});
|
|
77080
|
-
return files.map((file) =>
|
|
77153
|
+
return files.map((file) => path20.resolve(projectDir, file)).filter((file) => fs20.existsSync(file)).sort();
|
|
77081
77154
|
};
|
|
77082
77155
|
var registerDev = (program3) => {
|
|
77083
77156
|
program3.command("dev").description("Start development server for a package").argument("[file]", "Path to the package file").option("-p, --port <number>", "Port to run server on", "3020").action(async (file, options) => {
|
|
@@ -77099,7 +77172,7 @@ var registerDev = (program3) => {
|
|
|
77099
77172
|
}
|
|
77100
77173
|
let absolutePath;
|
|
77101
77174
|
if (file) {
|
|
77102
|
-
absolutePath =
|
|
77175
|
+
absolutePath = path20.resolve(file);
|
|
77103
77176
|
if (!absolutePath.endsWith(".tsx") && !absolutePath.endsWith(".ts")) {
|
|
77104
77177
|
console.error("Error: Only .tsx files are supported");
|
|
77105
77178
|
return;
|
|
@@ -77108,7 +77181,7 @@ var registerDev = (program3) => {
|
|
|
77108
77181
|
const entrypointPath = await getEntrypoint({
|
|
77109
77182
|
onError: () => {}
|
|
77110
77183
|
});
|
|
77111
|
-
if (entrypointPath &&
|
|
77184
|
+
if (entrypointPath && fs20.existsSync(entrypointPath)) {
|
|
77112
77185
|
absolutePath = entrypointPath;
|
|
77113
77186
|
console.log("Found entrypoint at:", entrypointPath);
|
|
77114
77187
|
} else {
|
|
@@ -77118,7 +77191,7 @@ var registerDev = (program3) => {
|
|
|
77118
77191
|
return;
|
|
77119
77192
|
}
|
|
77120
77193
|
absolutePath = availableFiles[0];
|
|
77121
|
-
console.log("Selected file:",
|
|
77194
|
+
console.log("Selected file:", path20.relative(process.cwd(), absolutePath));
|
|
77122
77195
|
}
|
|
77123
77196
|
}
|
|
77124
77197
|
try {
|
|
@@ -77274,8 +77347,8 @@ var registerConfigPrint = (program3) => {
|
|
|
77274
77347
|
};
|
|
77275
77348
|
|
|
77276
77349
|
// cli/clone/register.ts
|
|
77277
|
-
import * as
|
|
77278
|
-
import * as
|
|
77350
|
+
import * as fs21 from "node:fs";
|
|
77351
|
+
import * as path21 from "node:path";
|
|
77279
77352
|
var registerClone = (program3) => {
|
|
77280
77353
|
program3.command("clone").description("Clone a package from the registry").argument("<package>", "Package to clone (e.g. author/packageName or https://tscircuit.com/author/packageName)").option("-a, --include-author", "Include author name in the directory path").action(async (packagePath, options) => {
|
|
77281
77354
|
const urlMatch = packagePath.match(/^https:\/\/tscircuit\.com\/([^\/]+)\/([^\/]+)\/?$/i);
|
|
@@ -77295,13 +77368,13 @@ var registerClone = (program3) => {
|
|
|
77295
77368
|
const [, author, packageName] = match;
|
|
77296
77369
|
console.log(`Cloning ${author}/${packageName}...`);
|
|
77297
77370
|
const userSettingToIncludeAuthor = options.includeAuthor || cliConfig.get("alwaysCloneWithAuthorName");
|
|
77298
|
-
const dirPath = userSettingToIncludeAuthor ?
|
|
77299
|
-
if (
|
|
77371
|
+
const dirPath = userSettingToIncludeAuthor ? path21.resolve(`${author}.${packageName}`) : path21.resolve(packageName);
|
|
77372
|
+
if (fs21.existsSync(dirPath)) {
|
|
77300
77373
|
const prompts2 = await Promise.resolve().then(() => __toESM2(require_prompts3(), 1));
|
|
77301
77374
|
const response = await prompts2.default({
|
|
77302
77375
|
type: "select",
|
|
77303
77376
|
name: "action",
|
|
77304
|
-
message: `Directory "${
|
|
77377
|
+
message: `Directory "${path21.basename(dirPath)}" already exists. What would you like to do?`,
|
|
77305
77378
|
choices: [
|
|
77306
77379
|
{ title: "Merge files into existing directory", value: "merge" },
|
|
77307
77380
|
{
|
|
@@ -77316,7 +77389,7 @@ var registerClone = (program3) => {
|
|
|
77316
77389
|
process.exit(0);
|
|
77317
77390
|
}
|
|
77318
77391
|
if (response.action === "delete") {
|
|
77319
|
-
|
|
77392
|
+
fs21.rmSync(dirPath, { recursive: true, force: true });
|
|
77320
77393
|
console.log(`Deleted existing directory: ${dirPath}`);
|
|
77321
77394
|
} else if (response.action === "merge") {
|
|
77322
77395
|
console.log(`Merging files into existing directory: ${dirPath}`);
|
|
@@ -77341,13 +77414,13 @@ var registerClone = (program3) => {
|
|
|
77341
77414
|
console.error("Failed to fetch package files:", error instanceof Error ? error.message : error);
|
|
77342
77415
|
process.exit(1);
|
|
77343
77416
|
}
|
|
77344
|
-
|
|
77417
|
+
fs21.mkdirSync(dirPath, { recursive: true });
|
|
77345
77418
|
for (const fileInfo of packageFileList.package_files) {
|
|
77346
77419
|
const filePath = fileInfo.file_path.replace(/^\/|dist\//g, "");
|
|
77347
77420
|
if (!filePath)
|
|
77348
77421
|
continue;
|
|
77349
|
-
const fullPath =
|
|
77350
|
-
|
|
77422
|
+
const fullPath = path21.join(dirPath, filePath);
|
|
77423
|
+
fs21.mkdirSync(path21.dirname(fullPath), { recursive: true });
|
|
77351
77424
|
try {
|
|
77352
77425
|
const fileContent = await ky2.get("package_files/get", {
|
|
77353
77426
|
searchParams: {
|
|
@@ -77356,15 +77429,15 @@ var registerClone = (program3) => {
|
|
|
77356
77429
|
file_path: fileInfo.file_path
|
|
77357
77430
|
}
|
|
77358
77431
|
}).json();
|
|
77359
|
-
|
|
77432
|
+
fs21.writeFileSync(fullPath, fileContent.package_file.content_text);
|
|
77360
77433
|
} catch (error) {
|
|
77361
77434
|
console.warn(`Skipping ${filePath} due to error:`, error instanceof Error ? error.message : error);
|
|
77362
77435
|
}
|
|
77363
77436
|
}
|
|
77364
|
-
|
|
77437
|
+
fs21.writeFileSync(path21.join(dirPath, ".npmrc"), "@tsci:registry=https://npm.tscircuit.com");
|
|
77365
77438
|
generateTsConfig(dirPath);
|
|
77366
77439
|
setupTsciProject(dirPath);
|
|
77367
|
-
const relativeDirPath =
|
|
77440
|
+
const relativeDirPath = path21.relative(originalCwd, dirPath);
|
|
77368
77441
|
console.log(kleur_default.green(`
|
|
77369
77442
|
Successfully cloned to:`));
|
|
77370
77443
|
console.log(` ${dirPath}/
|
|
@@ -77380,8 +77453,8 @@ Successfully cloned to:`));
|
|
|
77380
77453
|
var import_perfect_cli = __toESM2(require_dist7(), 1);
|
|
77381
77454
|
|
|
77382
77455
|
// lib/shared/export-snippet.ts
|
|
77383
|
-
import
|
|
77384
|
-
import
|
|
77456
|
+
import fs23 from "node:fs";
|
|
77457
|
+
import path23 from "node:path";
|
|
77385
77458
|
import { promisify as promisify3 } from "node:util";
|
|
77386
77459
|
|
|
77387
77460
|
// node_modules/circuit-json-to-readable-netlist/dist/index.js
|
|
@@ -78560,9 +78633,9 @@ var stringifyDsnJson = (dsnJson) => {
|
|
|
78560
78633
|
const stringifyCoordinates = (coordinates) => {
|
|
78561
78634
|
return coordinates.join(" ");
|
|
78562
78635
|
};
|
|
78563
|
-
const stringifyPath = (
|
|
78636
|
+
const stringifyPath = (path22, level) => {
|
|
78564
78637
|
const padding = indent.repeat(level);
|
|
78565
|
-
return `${padding}(path ${
|
|
78638
|
+
return `${padding}(path ${path22.layer} ${path22.width} ${stringifyCoordinates(path22.coordinates)})`;
|
|
78566
78639
|
};
|
|
78567
78640
|
result += `(pcb ${dsnJson.filename ? dsnJson.filename : "./converted_dsn.dsn"}
|
|
78568
78641
|
`;
|
|
@@ -81742,8 +81815,8 @@ var SymbolInstancesProject = class _SymbolInstancesProject extends SxClass {
|
|
|
81742
81815
|
}
|
|
81743
81816
|
getString() {
|
|
81744
81817
|
const lines = [`(project ${quoteSExprString(this.name)}`];
|
|
81745
|
-
for (const
|
|
81746
|
-
lines.push(
|
|
81818
|
+
for (const path22 of this.paths) {
|
|
81819
|
+
lines.push(path22.getStringIndented());
|
|
81747
81820
|
}
|
|
81748
81821
|
lines.push(")");
|
|
81749
81822
|
return lines.join(`
|
|
@@ -81765,11 +81838,11 @@ var SymbolInstancePath = class _SymbolInstancePath extends SxClass {
|
|
|
81765
81838
|
static fromSexprPrimitives(primitiveSexprs) {
|
|
81766
81839
|
const [pathPrimitive, ...rest] = primitiveSexprs;
|
|
81767
81840
|
const value = toStringValue(pathPrimitive) ?? "";
|
|
81768
|
-
const
|
|
81841
|
+
const path22 = new _SymbolInstancePath(value);
|
|
81769
81842
|
const { propertyMap } = SxClass.parsePrimitivesToClassProperties(rest, this.token);
|
|
81770
|
-
|
|
81771
|
-
|
|
81772
|
-
return
|
|
81843
|
+
path22._sxReference = propertyMap.reference;
|
|
81844
|
+
path22._sxUnit = propertyMap.unit;
|
|
81845
|
+
return path22;
|
|
81773
81846
|
}
|
|
81774
81847
|
get reference() {
|
|
81775
81848
|
return this._sxReference?.value;
|
|
@@ -82816,8 +82889,8 @@ var SheetInstancesRootPath = class _SheetInstancesRootPath extends SxClass {
|
|
|
82816
82889
|
if (value === undefined) {
|
|
82817
82890
|
throw new Error("sheet_instances path requires a string identifier");
|
|
82818
82891
|
}
|
|
82819
|
-
const
|
|
82820
|
-
|
|
82892
|
+
const path22 = new _SheetInstancesRootPath;
|
|
82893
|
+
path22._value = value;
|
|
82821
82894
|
const { propertyMap, arrayPropertyMap } = SxClass.parsePrimitivesToClassProperties(rest, "sheet_instances_path");
|
|
82822
82895
|
const unsupportedSingularTokens = Object.keys(propertyMap).filter((token) => !SUPPORTED_ARRAY_TOKENS2.has(token));
|
|
82823
82896
|
if (unsupportedSingularTokens.length > 0) {
|
|
@@ -82831,8 +82904,8 @@ var SheetInstancesRootPath = class _SheetInstancesRootPath extends SxClass {
|
|
|
82831
82904
|
if (!pages.length && propertyMap.page) {
|
|
82832
82905
|
pages.push(propertyMap.page);
|
|
82833
82906
|
}
|
|
82834
|
-
|
|
82835
|
-
return
|
|
82907
|
+
path22._pages = pages;
|
|
82908
|
+
return path22;
|
|
82836
82909
|
}
|
|
82837
82910
|
get value() {
|
|
82838
82911
|
return this._value;
|
|
@@ -82980,8 +83053,8 @@ var SheetInstancesProject = class _SheetInstancesProject extends SxClass {
|
|
|
82980
83053
|
}
|
|
82981
83054
|
getString() {
|
|
82982
83055
|
const lines = [`(project ${quoteSExprString(this.name)}`];
|
|
82983
|
-
for (const
|
|
82984
|
-
lines.push(
|
|
83056
|
+
for (const path22 of this.paths) {
|
|
83057
|
+
lines.push(path22.getStringIndented());
|
|
82985
83058
|
}
|
|
82986
83059
|
lines.push(")");
|
|
82987
83060
|
return lines.join(`
|
|
@@ -83005,10 +83078,10 @@ var SheetInstancePath = class _SheetInstancePath extends SxClass {
|
|
|
83005
83078
|
if (value === undefined) {
|
|
83006
83079
|
throw new Error("sheet instance path value must be a string");
|
|
83007
83080
|
}
|
|
83008
|
-
const
|
|
83081
|
+
const path22 = new _SheetInstancePath(value);
|
|
83009
83082
|
const { arrayPropertyMap } = SxClass.parsePrimitivesToClassProperties(rest, "sheet_path");
|
|
83010
|
-
|
|
83011
|
-
return
|
|
83083
|
+
path22.pages = arrayPropertyMap.page ?? [];
|
|
83084
|
+
return path22;
|
|
83012
83085
|
}
|
|
83013
83086
|
getChildren() {
|
|
83014
83087
|
return [...this.pages];
|
|
@@ -88246,20 +88319,20 @@ var FootprintModel = class _FootprintModel extends SxClass {
|
|
|
88246
88319
|
_offset;
|
|
88247
88320
|
_scale;
|
|
88248
88321
|
_rotate;
|
|
88249
|
-
constructor(
|
|
88322
|
+
constructor(path22) {
|
|
88250
88323
|
super();
|
|
88251
|
-
this._path =
|
|
88324
|
+
this._path = path22;
|
|
88252
88325
|
}
|
|
88253
88326
|
static fromSexprPrimitives(primitiveSexprs) {
|
|
88254
88327
|
if (primitiveSexprs.length === 0) {
|
|
88255
88328
|
throw new Error("model requires a path argument");
|
|
88256
88329
|
}
|
|
88257
88330
|
const [rawPath, ...rest] = primitiveSexprs;
|
|
88258
|
-
const
|
|
88259
|
-
if (
|
|
88331
|
+
const path22 = toStringValue(rawPath);
|
|
88332
|
+
if (path22 === undefined) {
|
|
88260
88333
|
throw new Error("model path must be a string value");
|
|
88261
88334
|
}
|
|
88262
|
-
const model = new _FootprintModel(
|
|
88335
|
+
const model = new _FootprintModel(path22);
|
|
88263
88336
|
for (const primitive of rest) {
|
|
88264
88337
|
if (!Array.isArray(primitive) || primitive.length === 0) {
|
|
88265
88338
|
throw new Error(`model encountered invalid child expression: ${JSON.stringify(primitive)}`);
|
|
@@ -92944,10 +93017,10 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
|
|
|
92944
93017
|
}
|
|
92945
93018
|
const instances = new SymbolInstances;
|
|
92946
93019
|
const project = new SymbolInstancesProject("");
|
|
92947
|
-
const
|
|
92948
|
-
|
|
92949
|
-
|
|
92950
|
-
project.paths.push(
|
|
93020
|
+
const path22 = new SymbolInstancePath(`/${kicadSch?.uuid?.value || ""}`);
|
|
93021
|
+
path22.reference = reference;
|
|
93022
|
+
path22.unit = 1;
|
|
93023
|
+
project.paths.push(path22);
|
|
92951
93024
|
instances.projects.push(project);
|
|
92952
93025
|
symbol._sxInstances = instances;
|
|
92953
93026
|
symbols3.push(symbol);
|
|
@@ -93155,11 +93228,11 @@ var AddSheetInstancesStage = class extends ConverterStage {
|
|
|
93155
93228
|
throw new Error("KicadSch instance not initialized in context");
|
|
93156
93229
|
}
|
|
93157
93230
|
const sheetInstances = new SheetInstances;
|
|
93158
|
-
const
|
|
93159
|
-
|
|
93231
|
+
const path22 = new SheetInstancesRootPath;
|
|
93232
|
+
path22.value = "/";
|
|
93160
93233
|
const page = new SheetInstancesRootPage("1");
|
|
93161
|
-
|
|
93162
|
-
sheetInstances.paths = [
|
|
93234
|
+
path22.pages = [page];
|
|
93235
|
+
sheetInstances.paths = [path22];
|
|
93163
93236
|
kicadSch.sheetInstances = sheetInstances;
|
|
93164
93237
|
kicadSch.embeddedFonts = new EmbeddedFonts(false);
|
|
93165
93238
|
this.finished = true;
|
|
@@ -93514,12 +93587,12 @@ var AddGraphicsStage = class extends ConverterStage {
|
|
|
93514
93587
|
throw new Error("PCB transformation matrix not initialized in context");
|
|
93515
93588
|
}
|
|
93516
93589
|
const pcbSilkscreenPaths = this.ctx.db.pcb_silkscreen_path?.list() || [];
|
|
93517
|
-
for (const
|
|
93518
|
-
if (!
|
|
93590
|
+
for (const path22 of pcbSilkscreenPaths) {
|
|
93591
|
+
if (!path22.route || path22.route.length < 2)
|
|
93519
93592
|
continue;
|
|
93520
|
-
for (let i = 0;i <
|
|
93521
|
-
const startPoint =
|
|
93522
|
-
const endPoint =
|
|
93593
|
+
for (let i = 0;i < path22.route.length - 1; i++) {
|
|
93594
|
+
const startPoint = path22.route[i];
|
|
93595
|
+
const endPoint = path22.route[i + 1];
|
|
93523
93596
|
if (!startPoint || !endPoint)
|
|
93524
93597
|
continue;
|
|
93525
93598
|
const transformedStart = applyToPoint62(c2kMatPcb, {
|
|
@@ -93534,12 +93607,12 @@ var AddGraphicsStage = class extends ConverterStage {
|
|
|
93534
93607
|
top: "F.SilkS",
|
|
93535
93608
|
bottom: "B.SilkS"
|
|
93536
93609
|
};
|
|
93537
|
-
const kicadLayer = layerMap[
|
|
93610
|
+
const kicadLayer = layerMap[path22.layer] || path22.layer || "F.SilkS";
|
|
93538
93611
|
const grLine = new GrLine({
|
|
93539
93612
|
start: { x: transformedStart.x, y: transformedStart.y },
|
|
93540
93613
|
end: { x: transformedEnd.x, y: transformedEnd.y },
|
|
93541
93614
|
layer: kicadLayer,
|
|
93542
|
-
width:
|
|
93615
|
+
width: path22.stroke_width || 0.15
|
|
93543
93616
|
});
|
|
93544
93617
|
const graphicLines = kicadPcb.graphicLines;
|
|
93545
93618
|
graphicLines.push(grLine);
|
|
@@ -93647,9 +93720,9 @@ var import_jszip = __toESM2(require_lib4(), 1);
|
|
|
93647
93720
|
|
|
93648
93721
|
// lib/shared/generate-circuit-json.tsx
|
|
93649
93722
|
var import_make_vfs2 = __toESM2(require_dist8(), 1);
|
|
93650
|
-
import
|
|
93723
|
+
import path22 from "node:path/posix";
|
|
93651
93724
|
import { relative as relative8 } from "node:path";
|
|
93652
|
-
import
|
|
93725
|
+
import fs22 from "node:fs";
|
|
93653
93726
|
import Debug11 from "debug";
|
|
93654
93727
|
|
|
93655
93728
|
// lib/utils/abbreviate-stringify-object.ts
|
|
@@ -93708,11 +93781,11 @@ async function generateCircuitJson({
|
|
|
93708
93781
|
const runner = new userLandTscircuit.RootCircuit({
|
|
93709
93782
|
platform: platformConfig
|
|
93710
93783
|
});
|
|
93711
|
-
const projectDir =
|
|
93784
|
+
const projectDir = path22.dirname(filePath);
|
|
93712
93785
|
const resolvedOutputDir = outputDir || projectDir;
|
|
93713
93786
|
const relativeComponentPath = relative8(projectDir, filePath);
|
|
93714
|
-
const baseFileName = outputFileName ||
|
|
93715
|
-
const outputPath =
|
|
93787
|
+
const baseFileName = outputFileName || path22.basename(filePath).replace(/\.[^.]+$/, "");
|
|
93788
|
+
const outputPath = path22.join(resolvedOutputDir, `${baseFileName}.circuit.json`);
|
|
93716
93789
|
debug11(`Project directory: ${projectDir}`);
|
|
93717
93790
|
debug11(`Relative component path: ${relativeComponentPath}`);
|
|
93718
93791
|
debug11(`Output path: ${outputPath}`);
|
|
@@ -93728,7 +93801,7 @@ async function generateCircuitJson({
|
|
|
93728
93801
|
return false;
|
|
93729
93802
|
if (filePath2.match(/^\.[^\/]/))
|
|
93730
93803
|
return false;
|
|
93731
|
-
if (!ALLOWED_FILE_EXTENSIONS.includes(
|
|
93804
|
+
if (!ALLOWED_FILE_EXTENSIONS.includes(path22.extname(filePath2)))
|
|
93732
93805
|
return false;
|
|
93733
93806
|
return true;
|
|
93734
93807
|
},
|
|
@@ -93736,7 +93809,7 @@ async function generateCircuitJson({
|
|
|
93736
93809
|
})
|
|
93737
93810
|
};
|
|
93738
93811
|
debug11(`fsMap: ${abbreviateStringifyObject(fsMap)}`);
|
|
93739
|
-
const resolvedFilePath =
|
|
93812
|
+
const resolvedFilePath = path22.resolve(process.cwd(), filePath);
|
|
93740
93813
|
const MainComponent = await import(resolvedFilePath);
|
|
93741
93814
|
const Component = MainComponent.default || (Object.keys(MainComponent).find((k) => k[0] === k[0].toUpperCase()) !== undefined ? MainComponent[Object.keys(MainComponent).find((k) => k[0] === k[0].toUpperCase())] : undefined);
|
|
93742
93815
|
if (!Component) {
|
|
@@ -93747,7 +93820,7 @@ async function generateCircuitJson({
|
|
|
93747
93820
|
const circuitJson = await runner.getCircuitJson();
|
|
93748
93821
|
if (saveToFile) {
|
|
93749
93822
|
debug11(`Saving circuit JSON to ${outputPath}`);
|
|
93750
|
-
|
|
93823
|
+
fs22.writeFileSync(outputPath, JSON.stringify(circuitJson, null, 2));
|
|
93751
93824
|
}
|
|
93752
93825
|
return {
|
|
93753
93826
|
circuitJson,
|
|
@@ -93756,7 +93829,7 @@ async function generateCircuitJson({
|
|
|
93756
93829
|
}
|
|
93757
93830
|
|
|
93758
93831
|
// lib/shared/export-snippet.ts
|
|
93759
|
-
var writeFileAsync = promisify3(
|
|
93832
|
+
var writeFileAsync = promisify3(fs23.writeFile);
|
|
93760
93833
|
var ALLOWED_FORMATS = [
|
|
93761
93834
|
"json",
|
|
93762
93835
|
"circuit-json",
|
|
@@ -93799,10 +93872,10 @@ var exportSnippet = async ({
|
|
|
93799
93872
|
onError(`Invalid format: ${format}`);
|
|
93800
93873
|
return onExit(1);
|
|
93801
93874
|
}
|
|
93802
|
-
const projectDir =
|
|
93803
|
-
const outputBaseName =
|
|
93875
|
+
const projectDir = path23.dirname(filePath);
|
|
93876
|
+
const outputBaseName = path23.basename(filePath).replace(/\.[^.]+$/, "");
|
|
93804
93877
|
const outputFileName = `${outputBaseName}${OUTPUT_EXTENSIONS[format]}`;
|
|
93805
|
-
const outputDestination =
|
|
93878
|
+
const outputDestination = path23.join(projectDir, outputPath ?? outputFileName);
|
|
93806
93879
|
const circuitData = await generateCircuitJson({
|
|
93807
93880
|
filePath,
|
|
93808
93881
|
saveToFile: format === "circuit-json",
|
|
@@ -93986,12 +94059,12 @@ var getSpiceWithPaddedSim = (circuitJson, options) => {
|
|
|
93986
94059
|
};
|
|
93987
94060
|
|
|
93988
94061
|
// lib/eecircuit-engine/run-simulation.ts
|
|
93989
|
-
import { promises as
|
|
93990
|
-
import
|
|
94062
|
+
import { promises as fs24, existsSync as existsSync9 } from "node:fs";
|
|
94063
|
+
import path24 from "node:path";
|
|
93991
94064
|
import os3 from "node:os";
|
|
93992
94065
|
var sim = null;
|
|
93993
94066
|
var fetchSimulation = async () => {
|
|
93994
|
-
const tempFilePath =
|
|
94067
|
+
const tempFilePath = path24.join(os3.tmpdir(), "eecircuit-engine-1.5.2.mjs");
|
|
93995
94068
|
if (!existsSync9(tempFilePath)) {
|
|
93996
94069
|
const url = "https://cdn.jsdelivr.net/npm/eecircuit-engine@1.5.2/+esm";
|
|
93997
94070
|
const response = await fetch(url);
|
|
@@ -93999,7 +94072,7 @@ var fetchSimulation = async () => {
|
|
|
93999
94072
|
throw new Error(`Failed to fetch eecircuit-engine from ${url}: ${response.statusText}`);
|
|
94000
94073
|
}
|
|
94001
94074
|
const scriptContent = await response.text();
|
|
94002
|
-
await
|
|
94075
|
+
await fs24.writeFile(tempFilePath, scriptContent);
|
|
94003
94076
|
}
|
|
94004
94077
|
const module2 = await import(tempFilePath);
|
|
94005
94078
|
return module2.Simulation;
|
|
@@ -94088,8 +94161,8 @@ var resultToCsv = (result) => {
|
|
|
94088
94161
|
};
|
|
94089
94162
|
|
|
94090
94163
|
// cli/export/register.ts
|
|
94091
|
-
import
|
|
94092
|
-
import { promises as
|
|
94164
|
+
import path25 from "node:path";
|
|
94165
|
+
import { promises as fs25 } from "node:fs";
|
|
94093
94166
|
var registerExport = (program3) => {
|
|
94094
94167
|
program3.command("export").description("Export tscircuit code to various formats").argument("<file>", "Path to the package file").option("-f, --format <format>", "Output format").option("-o, --output <path>", "Output file path").option("--disable-parts-engine", "Disable the parts engine").action(async (file, options) => {
|
|
94095
94168
|
const formatOption = options.format ?? "json";
|
|
@@ -94101,12 +94174,12 @@ var registerExport = (program3) => {
|
|
|
94101
94174
|
});
|
|
94102
94175
|
if (circuitJson) {
|
|
94103
94176
|
const spiceString = getSpiceWithPaddedSim(circuitJson);
|
|
94104
|
-
const outputSpicePath = options.output ??
|
|
94105
|
-
await
|
|
94177
|
+
const outputSpicePath = options.output ?? path25.join(path25.dirname(file), `${path25.basename(file, path25.extname(file))}.spice.cir`);
|
|
94178
|
+
await fs25.writeFile(outputSpicePath, spiceString);
|
|
94106
94179
|
const { result } = await runSimulation(spiceString);
|
|
94107
94180
|
const csvContent = resultToCsv(result);
|
|
94108
94181
|
const outputCsvPath = outputSpicePath.replace(/\.spice\.cir$/, ".csv");
|
|
94109
|
-
await
|
|
94182
|
+
await fs25.writeFile(outputCsvPath, csvContent);
|
|
94110
94183
|
console.log(`Exported to ${outputSpicePath} and ${outputCsvPath} (simulation results)!`);
|
|
94111
94184
|
}
|
|
94112
94185
|
return;
|
|
@@ -94337,14 +94410,14 @@ class KeyStore {
|
|
|
94337
94410
|
}
|
|
94338
94411
|
}
|
|
94339
94412
|
function createKey(key) {
|
|
94340
|
-
let
|
|
94413
|
+
let path26 = null;
|
|
94341
94414
|
let id = null;
|
|
94342
94415
|
let src = null;
|
|
94343
94416
|
let weight = 1;
|
|
94344
94417
|
let getFn = null;
|
|
94345
94418
|
if (isString2(key) || isArray(key)) {
|
|
94346
94419
|
src = key;
|
|
94347
|
-
|
|
94420
|
+
path26 = createKeyPath(key);
|
|
94348
94421
|
id = createKeyId(key);
|
|
94349
94422
|
} else {
|
|
94350
94423
|
if (!hasOwn.call(key, "name")) {
|
|
@@ -94358,11 +94431,11 @@ function createKey(key) {
|
|
|
94358
94431
|
throw new Error(INVALID_KEY_WEIGHT_VALUE(name));
|
|
94359
94432
|
}
|
|
94360
94433
|
}
|
|
94361
|
-
|
|
94434
|
+
path26 = createKeyPath(name);
|
|
94362
94435
|
id = createKeyId(name);
|
|
94363
94436
|
getFn = key.getFn;
|
|
94364
94437
|
}
|
|
94365
|
-
return { path:
|
|
94438
|
+
return { path: path26, id, weight, src, getFn };
|
|
94366
94439
|
}
|
|
94367
94440
|
function createKeyPath(key) {
|
|
94368
94441
|
return isArray(key) ? key : key.split(".");
|
|
@@ -94370,34 +94443,34 @@ function createKeyPath(key) {
|
|
|
94370
94443
|
function createKeyId(key) {
|
|
94371
94444
|
return isArray(key) ? key.join(".") : key;
|
|
94372
94445
|
}
|
|
94373
|
-
function get(obj,
|
|
94446
|
+
function get(obj, path26) {
|
|
94374
94447
|
let list = [];
|
|
94375
94448
|
let arr = false;
|
|
94376
|
-
const deepGet = (obj2,
|
|
94449
|
+
const deepGet = (obj2, path27, index) => {
|
|
94377
94450
|
if (!isDefined(obj2)) {
|
|
94378
94451
|
return;
|
|
94379
94452
|
}
|
|
94380
|
-
if (!
|
|
94453
|
+
if (!path27[index]) {
|
|
94381
94454
|
list.push(obj2);
|
|
94382
94455
|
} else {
|
|
94383
|
-
let key =
|
|
94456
|
+
let key = path27[index];
|
|
94384
94457
|
const value = obj2[key];
|
|
94385
94458
|
if (!isDefined(value)) {
|
|
94386
94459
|
return;
|
|
94387
94460
|
}
|
|
94388
|
-
if (index ===
|
|
94461
|
+
if (index === path27.length - 1 && (isString2(value) || isNumber(value) || isBoolean(value))) {
|
|
94389
94462
|
list.push(toString(value));
|
|
94390
94463
|
} else if (isArray(value)) {
|
|
94391
94464
|
arr = true;
|
|
94392
94465
|
for (let i = 0, len = value.length;i < len; i += 1) {
|
|
94393
|
-
deepGet(value[i],
|
|
94466
|
+
deepGet(value[i], path27, index + 1);
|
|
94394
94467
|
}
|
|
94395
|
-
} else if (
|
|
94396
|
-
deepGet(value,
|
|
94468
|
+
} else if (path27.length) {
|
|
94469
|
+
deepGet(value, path27, index + 1);
|
|
94397
94470
|
}
|
|
94398
94471
|
}
|
|
94399
94472
|
};
|
|
94400
|
-
deepGet(obj, isString2(
|
|
94473
|
+
deepGet(obj, isString2(path26) ? path26.split(".") : path26, 0);
|
|
94401
94474
|
return arr ? list : list[0];
|
|
94402
94475
|
}
|
|
94403
94476
|
var MatchOptions = {
|
|
@@ -95589,8 +95662,8 @@ var registerSearch = (program3) => {
|
|
|
95589
95662
|
}
|
|
95590
95663
|
if (kicadResults.length) {
|
|
95591
95664
|
console.log(kleur_default.bold().underline(`Found ${kicadResults.length} footprint(s) from KiCad:`));
|
|
95592
|
-
kicadResults.forEach((
|
|
95593
|
-
console.log(`${(idx + 1).toString().padStart(2, " ")}. kicad:${
|
|
95665
|
+
kicadResults.forEach((path26, idx) => {
|
|
95666
|
+
console.log(`${(idx + 1).toString().padStart(2, " ")}. kicad:${path26.replace(".kicad_mod", "").replace(".pretty", "")}`);
|
|
95594
95667
|
});
|
|
95595
95668
|
}
|
|
95596
95669
|
if (!onlyKicad && results.packages.length) {
|
|
@@ -100768,7 +100841,7 @@ var { paths: Ad, bounds: ss, refblocks: Pd } = xs;
|
|
|
100768
100841
|
var U = e({ primitives: [...Object.values(Ad)], ports: [{ ...Pd.left1, labels: ["1"] }], center: { x: ss.centerX, y: ss.centerY } }).rotateRightFacingSymbol("right").labelPort("left1", ["1"]).build();
|
|
100769
100842
|
var ms = r(U, "down");
|
|
100770
100843
|
var ns = r(U, "left");
|
|
100771
|
-
var
|
|
100844
|
+
var fs26 = r(U, "up");
|
|
100772
100845
|
var g = { paths: { path11: { type: "path", points: [{ x: -0.39, y: 0 }, { x: 0.06, y: -0.01 }], color: "primary", fill: false }, "path40-0": { type: "path", points: [{ x: 0.07, y: 0.27 }, { x: 0.07, y: -0.28 }], color: "primary", fill: false }, "path40-0-5": { type: "path", points: [{ x: 0.28, y: 0.24 }, { x: 0.08, y: 0.11 }], color: "primary", fill: false }, "path40-0-5-0": { type: "path", points: [{ x: 0.29, y: -0.24 }, { x: 0.09, y: -0.11 }], color: "primary", fill: false }, "path12-1-5": { type: "path", points: [{ x: 0.29, y: 0.25 }, { x: 0.29, y: 0.54 }], color: "primary", fill: false }, "path12-1-5-3": { type: "path", points: [{ x: 0.29, y: -0.54 }, { x: 0.29, y: -0.25 }], color: "primary", fill: false }, path15: { type: "path", points: [{ x: 0.19, y: -0.1 }, { x: 0.12, y: -0.2 }, { x: 0.22, y: -0.2 }, { x: 0.19, y: -0.1 }], color: "primary", fill: true } }, texts: { top1: { type: "text", text: "{REF}", x: -0.08, y: 0.36 }, bottom1: { type: "text", text: "{VAL}", x: -0.07, y: -0.41 } }, refblocks: { top1: { x: 0.29, y: 0.55 }, bottom1: { x: 0.29, y: -0.55 }, left1: { x: -0.4, y: 0 } }, bounds: { minX: -0.43, maxX: 0.43, minY: -0.58, maxY: 0.58, width: 0.85, height: 1.16, centerX: 0, centerY: 0 }, circles: { "path1-0": { type: "circle", x: 0.14, y: 0, radius: 0.29, color: "primary", fill: false } } };
|
|
100773
100846
|
var { paths: Fd, texts: XA, bounds: e0, refblocks: Mo, circles: Rd } = g;
|
|
100774
100847
|
var hs = e({ primitives: [...Object.values(Fd), ...Object.values(Rd), { type: "text", text: "{REF}", x: -0.1, y: 0.3094553499999995 }, { type: "text", text: "{VAL}", x: -0.1, y: -0.3094553499999995 }], ports: [{ ...Mo.top1, labels: ["1", "collector"] }, { ...Mo.bottom1, labels: ["2", "emitter"] }, { ...Mo.left1, labels: ["3", "base"] }], size: { width: e0.width, height: e0.height }, center: { x: e0.centerX, y: e0.centerY } }).rotateRightFacingSymbol("right").changeTextAnchor("{REF}", "middle_right").changeTextAnchor("{VAL}", "middle_right").build();
|
|
@@ -101337,7 +101410,7 @@ var mb = Cl.primitives.find((t3) => t3.type === "text" && t3.text === "{VAL}");
|
|
|
101337
101410
|
sb.anchor = "middle_left";
|
|
101338
101411
|
mb.anchor = "middle_right";
|
|
101339
101412
|
var B1 = Cl;
|
|
101340
|
-
var q1 = { ac_voltmeter_down: Ul, ac_voltmeter_horz: Wl, ac_voltmeter_left: Zl, ac_voltmeter_right: Kl, ac_voltmeter_up: ep, ac_voltmeter_vert: op, avalanche_diode_down: lp, avalanche_diode_horz: pp, avalanche_diode_left: yp, avalanche_diode_right: xp, avalanche_diode_up: mp, avalanche_diode_vert: fp, backward_diode_down: cp, backward_diode_left: Dt, backward_diode_right: _p, backward_diode_up: gp, battery_horz: Wt, battery_vert: Ap, boxresistor_down: Fp, boxresistor_left: Ep, boxresistor_right: Lp, boxresistor_small_down: jp, boxresistor_small_left: zp, boxresistor_small_right: Jp, boxresistor_small_up: Mp, boxresistor_up: Ip, bridged_ground_down: Dp, bridged_ground_left: Wp, bridged_ground_right: te, bridged_ground_up: Qp, capacitor_down: ta, capacitor_left: ea, capacitor_polarized_down: oa, capacitor_polarized_left: ia, capacitor_polarized_right: pa, capacitor_polarized_up: ya, capacitor_right: xa, capacitor_up: ma, constant_current_diode_down: fa, constant_current_diode_horz: ha, constant_current_diode_left: da, constant_current_diode_right: ba, constant_current_diode_up: ga, constant_current_diode_vert: va, crystal_4pin_down: wa, crystal_4pin_left: Aa, crystal_4pin_right: Pa, crystal_4pin_up: Sa, crystal_down: Ra, crystal_left: Ta, crystal_right: Ea, crystal_up: Xa, darlington_pair_transistor_down: La, darlington_pair_transistor_horz: Va, darlington_pair_transistor_left: ja, darlington_pair_transistor_right: ka, darlington_pair_transistor_up: za, darlington_pair_transistor_vert: Oa, dc_ammeter_horz: wt, dc_ammeter_vert: Ca, dc_voltmeter_down: Ia, dc_voltmeter_horz: qa, dc_voltmeter_left: Ua, dc_voltmeter_right: Wa, dc_voltmeter_up: Za, dc_voltmeter_vert: Ka, diac_down: ty, diac_horz: ey, diac_left: ry, diac_right: oy, diac_up: iy, diac_vert: ly, diode_down: ay, diode_left: yy, diode_right: $2, diode_up: xy, dpdt_normally_closed_switch_down: my, dpdt_normally_closed_switch_left: ny, dpdt_normally_closed_switch_right: M, dpdt_normally_closed_switch_up: fy, dpdt_switch_down: cy, dpdt_switch_left: dy, dpdt_switch_right: C, dpdt_switch_up: by, dpst_normally_closed_switch_down: gy, dpst_normally_closed_switch_left: uy, dpst_normally_closed_switch_right: N, dpst_normally_closed_switch_up: vy, dpst_switch_down: Ay, dpst_switch_left: Py, dpst_switch_right: I, dpst_switch_up: Sy, ferrite_bead_down: Ry, ferrite_bead_left: Ty, ferrite_bead_right: Fe, ferrite_bead_up: Se, filled_diode_down: Yy, filled_diode_horz: Ly, filled_diode_left: jy, filled_diode_right: zy, filled_diode_up: Jy, filled_diode_vert: My, frequency_meter_horz: At2, frequency_meter_vert: By, fuse_horz: ke, fuse_vert: Uy, ground_down: Gy, ground_horz: Wy, ground_left: Hy, ground_right: Zy, ground_up: Qy, ground_vert: Ky2, ground2_down: ex, ground2_left: ox, ground2_right: lx, ground2_up: ax, gunn_diode_horz: yx, gunn_diode_vert: xx, icled_down: mx, icled_left: nx, icled_right: q, icled_up: fx, igbt_transistor_horz: ze, igbt_transistor_vert: dx, illuminated_push_button_normally_open_horz: Oe, illuminated_push_button_normally_open_vert: ux, inductor_down: Px, inductor_left: Sx, inductor_right: _t, inductor_up: $e, laser_diode_down: Fx, laser_diode_left: Rx, laser_diode_right: D, laser_diode_up: Tx, led_down: Lx, led_left: Vx, led_right: gt, led_up: Ce, light_dependent_resistor_horz: Ie, light_dependent_resistor_vert: $x, mosfet_depletion_normally_on_horz: qe, mosfet_depletion_normally_on_vert: Ix, mushroom_head_normally_open_momentary_horz: Ue, mushroom_head_normally_open_momentary_vert: Ux, n_channel_d_mosfet_transistor_horz: He, n_channel_d_mosfet_transistor_vert: Qx, n_channel_e_mosfet_transistor_horz: Qe, n_channel_e_mosfet_transistor_vert: os4, njfet_transistor_horz: t0, njfet_transistor_vert: ys, not_connected_down: ms, not_connected_left: ns, not_connected_right: U, not_connected_up:
|
|
101413
|
+
var q1 = { ac_voltmeter_down: Ul, ac_voltmeter_horz: Wl, ac_voltmeter_left: Zl, ac_voltmeter_right: Kl, ac_voltmeter_up: ep, ac_voltmeter_vert: op, avalanche_diode_down: lp, avalanche_diode_horz: pp, avalanche_diode_left: yp, avalanche_diode_right: xp, avalanche_diode_up: mp, avalanche_diode_vert: fp, backward_diode_down: cp, backward_diode_left: Dt, backward_diode_right: _p, backward_diode_up: gp, battery_horz: Wt, battery_vert: Ap, boxresistor_down: Fp, boxresistor_left: Ep, boxresistor_right: Lp, boxresistor_small_down: jp, boxresistor_small_left: zp, boxresistor_small_right: Jp, boxresistor_small_up: Mp, boxresistor_up: Ip, bridged_ground_down: Dp, bridged_ground_left: Wp, bridged_ground_right: te, bridged_ground_up: Qp, capacitor_down: ta, capacitor_left: ea, capacitor_polarized_down: oa, capacitor_polarized_left: ia, capacitor_polarized_right: pa, capacitor_polarized_up: ya, capacitor_right: xa, capacitor_up: ma, constant_current_diode_down: fa, constant_current_diode_horz: ha, constant_current_diode_left: da, constant_current_diode_right: ba, constant_current_diode_up: ga, constant_current_diode_vert: va, crystal_4pin_down: wa, crystal_4pin_left: Aa, crystal_4pin_right: Pa, crystal_4pin_up: Sa, crystal_down: Ra, crystal_left: Ta, crystal_right: Ea, crystal_up: Xa, darlington_pair_transistor_down: La, darlington_pair_transistor_horz: Va, darlington_pair_transistor_left: ja, darlington_pair_transistor_right: ka, darlington_pair_transistor_up: za, darlington_pair_transistor_vert: Oa, dc_ammeter_horz: wt, dc_ammeter_vert: Ca, dc_voltmeter_down: Ia, dc_voltmeter_horz: qa, dc_voltmeter_left: Ua, dc_voltmeter_right: Wa, dc_voltmeter_up: Za, dc_voltmeter_vert: Ka, diac_down: ty, diac_horz: ey, diac_left: ry, diac_right: oy, diac_up: iy, diac_vert: ly, diode_down: ay, diode_left: yy, diode_right: $2, diode_up: xy, dpdt_normally_closed_switch_down: my, dpdt_normally_closed_switch_left: ny, dpdt_normally_closed_switch_right: M, dpdt_normally_closed_switch_up: fy, dpdt_switch_down: cy, dpdt_switch_left: dy, dpdt_switch_right: C, dpdt_switch_up: by, dpst_normally_closed_switch_down: gy, dpst_normally_closed_switch_left: uy, dpst_normally_closed_switch_right: N, dpst_normally_closed_switch_up: vy, dpst_switch_down: Ay, dpst_switch_left: Py, dpst_switch_right: I, dpst_switch_up: Sy, ferrite_bead_down: Ry, ferrite_bead_left: Ty, ferrite_bead_right: Fe, ferrite_bead_up: Se, filled_diode_down: Yy, filled_diode_horz: Ly, filled_diode_left: jy, filled_diode_right: zy, filled_diode_up: Jy, filled_diode_vert: My, frequency_meter_horz: At2, frequency_meter_vert: By, fuse_horz: ke, fuse_vert: Uy, ground_down: Gy, ground_horz: Wy, ground_left: Hy, ground_right: Zy, ground_up: Qy, ground_vert: Ky2, ground2_down: ex, ground2_left: ox, ground2_right: lx, ground2_up: ax, gunn_diode_horz: yx, gunn_diode_vert: xx, icled_down: mx, icled_left: nx, icled_right: q, icled_up: fx, igbt_transistor_horz: ze, igbt_transistor_vert: dx, illuminated_push_button_normally_open_horz: Oe, illuminated_push_button_normally_open_vert: ux, inductor_down: Px, inductor_left: Sx, inductor_right: _t, inductor_up: $e, laser_diode_down: Fx, laser_diode_left: Rx, laser_diode_right: D, laser_diode_up: Tx, led_down: Lx, led_left: Vx, led_right: gt, led_up: Ce, light_dependent_resistor_horz: Ie, light_dependent_resistor_vert: $x, mosfet_depletion_normally_on_horz: qe, mosfet_depletion_normally_on_vert: Ix, mushroom_head_normally_open_momentary_horz: Ue, mushroom_head_normally_open_momentary_vert: Ux, n_channel_d_mosfet_transistor_horz: He, n_channel_d_mosfet_transistor_vert: Qx, n_channel_e_mosfet_transistor_horz: Qe, n_channel_e_mosfet_transistor_vert: os4, njfet_transistor_horz: t0, njfet_transistor_vert: ys, not_connected_down: ms, not_connected_left: ns, not_connected_right: U, not_connected_up: fs26, npn_bipolar_transistor_down: hs, npn_bipolar_transistor_horz: cs, npn_bipolar_transistor_left: ds, npn_bipolar_transistor_right: bs, npn_bipolar_transistor_up: _s, npn_bipolar_transistor_vert: gs, opamp_no_power_down: vs, opamp_no_power_left: ws, opamp_no_power_right: G, opamp_no_power_up: As, opamp_with_power_down: Ss, opamp_with_power_left: Fs, opamp_with_power_right: W, opamp_with_power_up: Rs, p_channel_d_mosfet_transistor_horz: a0, p_channel_d_mosfet_transistor_vert: Ls, p_channel_e_mosfet_transistor_horz: x0, p_channel_e_mosfet_transistor_vert: Os, photodiode_horz: s0, photodiode_vert: Cs, pjfet_transistor_horz: n0, pjfet_transistor_vert: Ds, pnp_bipolar_transistor_down: Us, pnp_bipolar_transistor_horz: Gs, pnp_bipolar_transistor_left: Ws, pnp_bipolar_transistor_right: Hs, pnp_bipolar_transistor_up: Zs, pnp_bipolar_transistor_vert: Qs, potentiometer_horz: g0, potentiometer_vert: rm, potentiometer2_down: pm, potentiometer2_left: am, potentiometer2_right: H, potentiometer2_up: ym, potentiometer3_down: xm, potentiometer3_left: sm, potentiometer3_right: mm, potentiometer3_up: nm, power_factor_meter_horz: S0, power_factor_meter_vert: dm, push_button_normally_closed_momentary_horz: R0, push_button_normally_closed_momentary_vert: um, push_button_normally_open_momentary_horz: E0, push_button_normally_open_momentary_vert: Pm, rectifier_diode_horz: L0, rectifier_diode_vert: Rm, resistor_down: Em, resistor_left: Xm, resistor_right: Vm, resistor_up: km, resonator_down: Om, resonator_horz: M0, resonator_left: Jm, resonator_right: K, resonator_up: $m, resonator_vert: Mm, schottky_diode_down: Nm, schottky_diode_left: Im, schottky_diode_right: tt, schottky_diode_up: Bm, silicon_controlled_rectifier_horz: C0, silicon_controlled_rectifier_vert: Um, solderjumper2_bridged12_down: Gm, solderjumper2_bridged12_left: Wm, solderjumper2_bridged12_right: Hm, solderjumper2_bridged12_up: Zm, solderjumper2_down: Qm, solderjumper2_left: Km, solderjumper2_right: tn, solderjumper2_up: en, solderjumper3_bridged12_down: rn, solderjumper3_bridged12_left: on2, solderjumper3_bridged12_right: ln, solderjumper3_bridged12_up: pn, solderjumper3_bridged123_down: an, solderjumper3_bridged123_left: yn, solderjumper3_bridged123_right: xn, solderjumper3_bridged123_up: sn, solderjumper3_bridged23_down: mn, solderjumper3_bridged23_left: nn, solderjumper3_bridged23_right: fn, solderjumper3_bridged23_up: hn, solderjumper3_down: cn, solderjumper3_left: dn, solderjumper3_right: bn, solderjumper3_up: _n, spdt_normally_closed_switch_down: un, spdt_normally_closed_switch_left: vn, spdt_normally_closed_switch_right: at, spdt_normally_closed_switch_up: wn, spdt_switch_down: Pn, spdt_switch_left: Sn, spdt_switch_right: yt, spdt_switch_up: Fn, spst_normally_closed_switch_down: Rn, spst_normally_closed_switch_left: Tn, spst_normally_closed_switch_right: xt, spst_normally_closed_switch_up: En, spst_switch_down: Yn, spst_switch_left: Xn, spst_switch_right: st, spst_switch_up: Ln, square_wave_down: Vn, square_wave_left: jn, square_wave_right: kn, square_wave_up: zn, step_recovery_diode_horz: N0, step_recovery_diode_vert: On, tachometer_horz: Tt, tachometer_vert: Cn, testpoint_down: Bn, testpoint_left: qn, testpoint_right: nt, testpoint_up: Gn, tilted_ground_down: Hn, tilted_ground_left: Zn, tilted_ground_right: ut, tilted_ground_up: B0, triac_horz: q0, triac_vert: t1, tunnel_diode_horz: U0, tunnel_diode_vert: i1, unijunction_transistor_horz: W0, unijunction_transistor_vert: s1, usbc: n1, var_meter_horz: Z0, var_meter_vert: c1, varactor_diode_horz: K0, varactor_diode_vert: g1, varistor_horz: er, varistor_vert: A1, varmeter_horz: Et, varmeter_vert: R1, vcc_down: T1, vcc_left: E1, vcc_right: Y1, vcc_up: X1, volt_meter_horz: or, volt_meter_vert: L1, watt_hour_meter_horz: Yt, watt_hour_meter_vert: z1, wattmeter_horz: Xt, wattmeter_vert: M1, zener_diode_horz: ar, zener_diode_vert: B1 };
|
|
101341
101414
|
var Y$ = Object.fromEntries(Object.keys(q1).map((t3) => [t3, t3]));
|
|
101342
101415
|
function doesLineIntersectLine([a12, a22], [b12, b22], {
|
|
101343
101416
|
lineThickness = 0
|
|
@@ -103367,11 +103440,11 @@ var require_react_reconciler_development = __commonJS2({
|
|
|
103367
103440
|
fiber = fiber.next, id2--;
|
|
103368
103441
|
return fiber;
|
|
103369
103442
|
}
|
|
103370
|
-
function copyWithSetImpl(obj,
|
|
103371
|
-
if (index >=
|
|
103443
|
+
function copyWithSetImpl(obj, path26, index, value) {
|
|
103444
|
+
if (index >= path26.length)
|
|
103372
103445
|
return value;
|
|
103373
|
-
var key =
|
|
103374
|
-
updated[key] = copyWithSetImpl(obj[key],
|
|
103446
|
+
var key = path26[index], updated = isArrayImpl(obj) ? obj.slice() : assign2({}, obj);
|
|
103447
|
+
updated[key] = copyWithSetImpl(obj[key], path26, index + 1, value);
|
|
103375
103448
|
return updated;
|
|
103376
103449
|
}
|
|
103377
103450
|
function copyWithRename(obj, oldPath, newPath) {
|
|
@@ -103391,11 +103464,11 @@ var require_react_reconciler_development = __commonJS2({
|
|
|
103391
103464
|
index + 1 === oldPath.length ? (updated[newPath[index]] = updated[oldKey], isArrayImpl(updated) ? updated.splice(oldKey, 1) : delete updated[oldKey]) : updated[oldKey] = copyWithRenameImpl(obj[oldKey], oldPath, newPath, index + 1);
|
|
103392
103465
|
return updated;
|
|
103393
103466
|
}
|
|
103394
|
-
function copyWithDeleteImpl(obj,
|
|
103395
|
-
var key =
|
|
103396
|
-
if (index + 1 ===
|
|
103467
|
+
function copyWithDeleteImpl(obj, path26, index) {
|
|
103468
|
+
var key = path26[index], updated = isArrayImpl(obj) ? obj.slice() : assign2({}, obj);
|
|
103469
|
+
if (index + 1 === path26.length)
|
|
103397
103470
|
return isArrayImpl(updated) ? updated.splice(key, 1) : delete updated[key], updated;
|
|
103398
|
-
updated[key] = copyWithDeleteImpl(obj[key],
|
|
103471
|
+
updated[key] = copyWithDeleteImpl(obj[key], path26, index + 1);
|
|
103399
103472
|
return updated;
|
|
103400
103473
|
}
|
|
103401
103474
|
function shouldSuspendImpl() {
|
|
@@ -112426,29 +112499,29 @@ Check the top-level render call using <` + componentName2 + ">.");
|
|
|
112426
112499
|
var didWarnAboutNestedUpdates = false;
|
|
112427
112500
|
var didWarnAboutFindNodeInStrictMode = {};
|
|
112428
112501
|
var overrideHookState = null, overrideHookStateDeletePath = null, overrideHookStateRenamePath = null, overrideProps = null, overridePropsDeletePath = null, overridePropsRenamePath = null, scheduleUpdate = null, setErrorHandler = null, setSuspenseHandler = null;
|
|
112429
|
-
overrideHookState = function(fiber, id2,
|
|
112502
|
+
overrideHookState = function(fiber, id2, path26, value) {
|
|
112430
112503
|
id2 = findHook(fiber, id2);
|
|
112431
|
-
id2 !== null && (
|
|
112504
|
+
id2 !== null && (path26 = copyWithSetImpl(id2.memoizedState, path26, 0, value), id2.memoizedState = path26, id2.baseState = path26, fiber.memoizedProps = assign2({}, fiber.memoizedProps), path26 = enqueueConcurrentRenderForLane(fiber, 2), path26 !== null && scheduleUpdateOnFiber(path26, fiber, 2));
|
|
112432
112505
|
};
|
|
112433
|
-
overrideHookStateDeletePath = function(fiber, id2,
|
|
112506
|
+
overrideHookStateDeletePath = function(fiber, id2, path26) {
|
|
112434
112507
|
id2 = findHook(fiber, id2);
|
|
112435
|
-
id2 !== null && (
|
|
112508
|
+
id2 !== null && (path26 = copyWithDeleteImpl(id2.memoizedState, path26, 0), id2.memoizedState = path26, id2.baseState = path26, fiber.memoizedProps = assign2({}, fiber.memoizedProps), path26 = enqueueConcurrentRenderForLane(fiber, 2), path26 !== null && scheduleUpdateOnFiber(path26, fiber, 2));
|
|
112436
112509
|
};
|
|
112437
112510
|
overrideHookStateRenamePath = function(fiber, id2, oldPath, newPath) {
|
|
112438
112511
|
id2 = findHook(fiber, id2);
|
|
112439
112512
|
id2 !== null && (oldPath = copyWithRename(id2.memoizedState, oldPath, newPath), id2.memoizedState = oldPath, id2.baseState = oldPath, fiber.memoizedProps = assign2({}, fiber.memoizedProps), oldPath = enqueueConcurrentRenderForLane(fiber, 2), oldPath !== null && scheduleUpdateOnFiber(oldPath, fiber, 2));
|
|
112440
112513
|
};
|
|
112441
|
-
overrideProps = function(fiber,
|
|
112442
|
-
fiber.pendingProps = copyWithSetImpl(fiber.memoizedProps,
|
|
112514
|
+
overrideProps = function(fiber, path26, value) {
|
|
112515
|
+
fiber.pendingProps = copyWithSetImpl(fiber.memoizedProps, path26, 0, value);
|
|
112443
112516
|
fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps);
|
|
112444
|
-
|
|
112445
|
-
|
|
112517
|
+
path26 = enqueueConcurrentRenderForLane(fiber, 2);
|
|
112518
|
+
path26 !== null && scheduleUpdateOnFiber(path26, fiber, 2);
|
|
112446
112519
|
};
|
|
112447
|
-
overridePropsDeletePath = function(fiber,
|
|
112448
|
-
fiber.pendingProps = copyWithDeleteImpl(fiber.memoizedProps,
|
|
112520
|
+
overridePropsDeletePath = function(fiber, path26) {
|
|
112521
|
+
fiber.pendingProps = copyWithDeleteImpl(fiber.memoizedProps, path26, 0);
|
|
112449
112522
|
fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps);
|
|
112450
|
-
|
|
112451
|
-
|
|
112523
|
+
path26 = enqueueConcurrentRenderForLane(fiber, 2);
|
|
112524
|
+
path26 !== null && scheduleUpdateOnFiber(path26, fiber, 2);
|
|
112452
112525
|
};
|
|
112453
112526
|
overridePropsRenamePath = function(fiber, oldPath, newPath) {
|
|
112454
112527
|
fiber.pendingProps = copyWithRename(fiber.memoizedProps, oldPath, newPath);
|
|
@@ -127785,10 +127858,10 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
127785
127858
|
var setErrorHandler = null;
|
|
127786
127859
|
var setSuspenseHandler = null;
|
|
127787
127860
|
{
|
|
127788
|
-
var copyWithDeleteImpl = function(obj,
|
|
127789
|
-
var key =
|
|
127861
|
+
var copyWithDeleteImpl = function(obj, path26, index2) {
|
|
127862
|
+
var key = path26[index2];
|
|
127790
127863
|
var updated = isArray2(obj) ? obj.slice() : assign2({}, obj);
|
|
127791
|
-
if (index2 + 1 ===
|
|
127864
|
+
if (index2 + 1 === path26.length) {
|
|
127792
127865
|
if (isArray2(updated)) {
|
|
127793
127866
|
updated.splice(key, 1);
|
|
127794
127867
|
} else {
|
|
@@ -127796,11 +127869,11 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
127796
127869
|
}
|
|
127797
127870
|
return updated;
|
|
127798
127871
|
}
|
|
127799
|
-
updated[key] = copyWithDeleteImpl(obj[key],
|
|
127872
|
+
updated[key] = copyWithDeleteImpl(obj[key], path26, index2 + 1);
|
|
127800
127873
|
return updated;
|
|
127801
127874
|
};
|
|
127802
|
-
var copyWithDelete = function(obj,
|
|
127803
|
-
return copyWithDeleteImpl(obj,
|
|
127875
|
+
var copyWithDelete = function(obj, path26) {
|
|
127876
|
+
return copyWithDeleteImpl(obj, path26, 0);
|
|
127804
127877
|
};
|
|
127805
127878
|
var copyWithRenameImpl = function(obj, oldPath, newPath, index2) {
|
|
127806
127879
|
var oldKey = oldPath[index2];
|
|
@@ -127832,17 +127905,17 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
127832
127905
|
}
|
|
127833
127906
|
return copyWithRenameImpl(obj, oldPath, newPath, 0);
|
|
127834
127907
|
};
|
|
127835
|
-
var copyWithSetImpl = function(obj,
|
|
127836
|
-
if (index2 >=
|
|
127908
|
+
var copyWithSetImpl = function(obj, path26, index2, value) {
|
|
127909
|
+
if (index2 >= path26.length) {
|
|
127837
127910
|
return value;
|
|
127838
127911
|
}
|
|
127839
|
-
var key =
|
|
127912
|
+
var key = path26[index2];
|
|
127840
127913
|
var updated = isArray2(obj) ? obj.slice() : assign2({}, obj);
|
|
127841
|
-
updated[key] = copyWithSetImpl(obj[key],
|
|
127914
|
+
updated[key] = copyWithSetImpl(obj[key], path26, index2 + 1, value);
|
|
127842
127915
|
return updated;
|
|
127843
127916
|
};
|
|
127844
|
-
var copyWithSet = function(obj,
|
|
127845
|
-
return copyWithSetImpl(obj,
|
|
127917
|
+
var copyWithSet = function(obj, path26, value) {
|
|
127918
|
+
return copyWithSetImpl(obj, path26, 0, value);
|
|
127846
127919
|
};
|
|
127847
127920
|
var findHook = function(fiber, id2) {
|
|
127848
127921
|
var currentHook2 = fiber.memoizedState;
|
|
@@ -127852,10 +127925,10 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
127852
127925
|
}
|
|
127853
127926
|
return currentHook2;
|
|
127854
127927
|
};
|
|
127855
|
-
overrideHookState = function(fiber, id2,
|
|
127928
|
+
overrideHookState = function(fiber, id2, path26, value) {
|
|
127856
127929
|
var hook = findHook(fiber, id2);
|
|
127857
127930
|
if (hook !== null) {
|
|
127858
|
-
var newState = copyWithSet(hook.memoizedState,
|
|
127931
|
+
var newState = copyWithSet(hook.memoizedState, path26, value);
|
|
127859
127932
|
hook.memoizedState = newState;
|
|
127860
127933
|
hook.baseState = newState;
|
|
127861
127934
|
fiber.memoizedProps = assign2({}, fiber.memoizedProps);
|
|
@@ -127865,10 +127938,10 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
127865
127938
|
}
|
|
127866
127939
|
}
|
|
127867
127940
|
};
|
|
127868
|
-
overrideHookStateDeletePath = function(fiber, id2,
|
|
127941
|
+
overrideHookStateDeletePath = function(fiber, id2, path26) {
|
|
127869
127942
|
var hook = findHook(fiber, id2);
|
|
127870
127943
|
if (hook !== null) {
|
|
127871
|
-
var newState = copyWithDelete(hook.memoizedState,
|
|
127944
|
+
var newState = copyWithDelete(hook.memoizedState, path26);
|
|
127872
127945
|
hook.memoizedState = newState;
|
|
127873
127946
|
hook.baseState = newState;
|
|
127874
127947
|
fiber.memoizedProps = assign2({}, fiber.memoizedProps);
|
|
@@ -127891,8 +127964,8 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
127891
127964
|
}
|
|
127892
127965
|
}
|
|
127893
127966
|
};
|
|
127894
|
-
overrideProps = function(fiber,
|
|
127895
|
-
fiber.pendingProps = copyWithSet(fiber.memoizedProps,
|
|
127967
|
+
overrideProps = function(fiber, path26, value) {
|
|
127968
|
+
fiber.pendingProps = copyWithSet(fiber.memoizedProps, path26, value);
|
|
127896
127969
|
if (fiber.alternate) {
|
|
127897
127970
|
fiber.alternate.pendingProps = fiber.pendingProps;
|
|
127898
127971
|
}
|
|
@@ -127901,8 +127974,8 @@ Check the render method of %s.`, getComponentNameFromFiber(current2) || "Unknown
|
|
|
127901
127974
|
scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp);
|
|
127902
127975
|
}
|
|
127903
127976
|
};
|
|
127904
|
-
overridePropsDeletePath = function(fiber,
|
|
127905
|
-
fiber.pendingProps = copyWithDelete(fiber.memoizedProps,
|
|
127977
|
+
overridePropsDeletePath = function(fiber, path26) {
|
|
127978
|
+
fiber.pendingProps = copyWithDelete(fiber.memoizedProps, path26);
|
|
127906
127979
|
if (fiber.alternate) {
|
|
127907
127980
|
fiber.alternate.pendingProps = fiber.pendingProps;
|
|
127908
127981
|
}
|
|
@@ -133953,7 +134026,7 @@ var parsePin = (pinString) => {
|
|
|
133953
134026
|
const colorMatch = pinString.match(/#[0-9A-F]{6}/);
|
|
133954
134027
|
const labelColor = colorMatch ? colorMatch[0] : "";
|
|
133955
134028
|
const pathMatch = pinString.match(/\^\^([^~]+)/);
|
|
133956
|
-
const
|
|
134029
|
+
const path26 = pathMatch ? pathMatch[1] : "";
|
|
133957
134030
|
const arrowMatch = pinString.match(/\^\^0~(.+)$/);
|
|
133958
134031
|
const arrow = arrowMatch ? arrowMatch[1] : "";
|
|
133959
134032
|
const r3 = Number.parseFloat(rotation2);
|
|
@@ -133967,7 +134040,7 @@ var parsePin = (pinString) => {
|
|
|
133967
134040
|
rotation: Number.isNaN(r3) ? 0 : r3,
|
|
133968
134041
|
label,
|
|
133969
134042
|
labelColor,
|
|
133970
|
-
path:
|
|
134043
|
+
path: path26,
|
|
133971
134044
|
arrow
|
|
133972
134045
|
};
|
|
133973
134046
|
};
|
|
@@ -134407,15 +134480,15 @@ function generateArcFromSweep(startX, startY, endX, endY, radius, largeArcFlag,
|
|
|
134407
134480
|
}
|
|
134408
134481
|
}
|
|
134409
134482
|
const numPoints = Math.max(2, Math.ceil(Math.abs(endAngle - startAngle) * radius));
|
|
134410
|
-
const
|
|
134483
|
+
const path26 = [];
|
|
134411
134484
|
for (let i = 0;i <= numPoints; i++) {
|
|
134412
134485
|
const t3 = i / numPoints;
|
|
134413
134486
|
const angle2 = startAngle + t3 * (endAngle - startAngle);
|
|
134414
134487
|
const x = centerX + radius * Math.cos(angle2);
|
|
134415
134488
|
const y = centerY + radius * Math.sin(angle2);
|
|
134416
|
-
|
|
134489
|
+
path26.push({ x, y });
|
|
134417
134490
|
}
|
|
134418
|
-
return
|
|
134491
|
+
return path26;
|
|
134419
134492
|
}
|
|
134420
134493
|
var __defProp4 = Object.defineProperty;
|
|
134421
134494
|
var __export22 = (target, all) => {
|
|
@@ -135833,7 +135906,7 @@ var platedHoleWithRectPad = (pn2, x, y, holeDiameter, rectPadWidth, rectPadHeigh
|
|
|
135833
135906
|
};
|
|
135834
135907
|
};
|
|
135835
135908
|
var silkscreenPin = ({
|
|
135836
|
-
fs:
|
|
135909
|
+
fs: fs27,
|
|
135837
135910
|
pn: pn2,
|
|
135838
135911
|
anchor_x,
|
|
135839
135912
|
anchor_y,
|
|
@@ -135876,7 +135949,7 @@ var silkscreenPin = ({
|
|
|
135876
135949
|
type: "pcb_silkscreen_text",
|
|
135877
135950
|
pcb_silkscreen_text_id: "silkscreen_text_1",
|
|
135878
135951
|
font: "tscircuit2024",
|
|
135879
|
-
font_size:
|
|
135952
|
+
font_size: fs27,
|
|
135880
135953
|
pcb_component_id: "pcb_component_1",
|
|
135881
135954
|
text: `{PIN${pn2}}`,
|
|
135882
135955
|
layer,
|
|
@@ -143492,17 +143565,17 @@ var ObstacleList = class {
|
|
|
143492
143565
|
return obstacles;
|
|
143493
143566
|
}
|
|
143494
143567
|
};
|
|
143495
|
-
function removePathLoops(
|
|
143496
|
-
if (
|
|
143497
|
-
return
|
|
143498
|
-
const result = [{ ...
|
|
143499
|
-
let currentLayer =
|
|
143500
|
-
for (let i = 1;i <
|
|
143501
|
-
const currentSegment = { start:
|
|
143502
|
-
const isVia =
|
|
143503
|
-
if (
|
|
143504
|
-
result.push({ ...
|
|
143505
|
-
currentLayer =
|
|
143568
|
+
function removePathLoops(path26) {
|
|
143569
|
+
if (path26.length < 4)
|
|
143570
|
+
return path26;
|
|
143571
|
+
const result = [{ ...path26[0] }];
|
|
143572
|
+
let currentLayer = path26[0].layer;
|
|
143573
|
+
for (let i = 1;i < path26.length; i++) {
|
|
143574
|
+
const currentSegment = { start: path26[i - 1], end: path26[i] };
|
|
143575
|
+
const isVia = path26[i].route_type === "via" || path26[i - 1].route_type === "via";
|
|
143576
|
+
if (path26[i].layer !== currentLayer || isVia) {
|
|
143577
|
+
result.push({ ...path26[i] });
|
|
143578
|
+
currentLayer = path26[i].layer;
|
|
143506
143579
|
continue;
|
|
143507
143580
|
}
|
|
143508
143581
|
let intersectionFound = false;
|
|
@@ -143531,8 +143604,8 @@ function removePathLoops(path25) {
|
|
|
143531
143604
|
result.push(intersectionPoint);
|
|
143532
143605
|
}
|
|
143533
143606
|
const lastPoint = result[result.length - 1];
|
|
143534
|
-
if (lastPoint.x !==
|
|
143535
|
-
result.push(
|
|
143607
|
+
if (lastPoint.x !== path26[i].x || lastPoint.y !== path26[i].y) {
|
|
143608
|
+
result.push(path26[i]);
|
|
143536
143609
|
}
|
|
143537
143610
|
}
|
|
143538
143611
|
return result;
|
|
@@ -144021,10 +144094,10 @@ var GeneralizedAstarAutorouter = class {
|
|
|
144021
144094
|
});
|
|
144022
144095
|
}
|
|
144023
144096
|
if (current2.parent) {
|
|
144024
|
-
const
|
|
144097
|
+
const path26 = [];
|
|
144025
144098
|
let p = current2;
|
|
144026
144099
|
while (p) {
|
|
144027
|
-
|
|
144100
|
+
path26.unshift(p);
|
|
144028
144101
|
p = p.parent;
|
|
144029
144102
|
}
|
|
144030
144103
|
debugSolution.push({
|
|
@@ -144032,7 +144105,7 @@ var GeneralizedAstarAutorouter = class {
|
|
|
144032
144105
|
pcb_component_id: "",
|
|
144033
144106
|
pcb_fabrication_note_path_id: `note_path_${current2.x}_${current2.y}`,
|
|
144034
144107
|
layer: "top",
|
|
144035
|
-
route:
|
|
144108
|
+
route: path26,
|
|
144036
144109
|
stroke_width: 0.01
|
|
144037
144110
|
});
|
|
144038
144111
|
}
|
|
@@ -148954,13 +149027,13 @@ var RBush = class {
|
|
|
148954
149027
|
return this;
|
|
148955
149028
|
let node = this.data;
|
|
148956
149029
|
const bbox = this.toBBox(item);
|
|
148957
|
-
const
|
|
149030
|
+
const path26 = [];
|
|
148958
149031
|
const indexes = [];
|
|
148959
149032
|
let i, parent, goingUp;
|
|
148960
|
-
while (node ||
|
|
149033
|
+
while (node || path26.length) {
|
|
148961
149034
|
if (!node) {
|
|
148962
|
-
node =
|
|
148963
|
-
parent =
|
|
149035
|
+
node = path26.pop();
|
|
149036
|
+
parent = path26[path26.length - 1];
|
|
148964
149037
|
i = indexes.pop();
|
|
148965
149038
|
goingUp = true;
|
|
148966
149039
|
}
|
|
@@ -148968,13 +149041,13 @@ var RBush = class {
|
|
|
148968
149041
|
const index = findItem(item, node.children, equalsFn);
|
|
148969
149042
|
if (index !== -1) {
|
|
148970
149043
|
node.children.splice(index, 1);
|
|
148971
|
-
|
|
148972
|
-
this._condense(
|
|
149044
|
+
path26.push(node);
|
|
149045
|
+
this._condense(path26);
|
|
148973
149046
|
return this;
|
|
148974
149047
|
}
|
|
148975
149048
|
}
|
|
148976
149049
|
if (!goingUp && !node.leaf && contains(node, bbox)) {
|
|
148977
|
-
|
|
149050
|
+
path26.push(node);
|
|
148978
149051
|
indexes.push(i);
|
|
148979
149052
|
i = 0;
|
|
148980
149053
|
parent = node;
|
|
@@ -149045,10 +149118,10 @@ var RBush = class {
|
|
|
149045
149118
|
calcBBox(node, this.toBBox);
|
|
149046
149119
|
return node;
|
|
149047
149120
|
}
|
|
149048
|
-
_chooseSubtree(bbox, node, level,
|
|
149121
|
+
_chooseSubtree(bbox, node, level, path26) {
|
|
149049
149122
|
while (true) {
|
|
149050
|
-
|
|
149051
|
-
if (node.leaf ||
|
|
149123
|
+
path26.push(node);
|
|
149124
|
+
if (node.leaf || path26.length - 1 === level)
|
|
149052
149125
|
break;
|
|
149053
149126
|
let minArea = Infinity;
|
|
149054
149127
|
let minEnlargement = Infinity;
|
|
@@ -149157,21 +149230,21 @@ var RBush = class {
|
|
|
149157
149230
|
}
|
|
149158
149231
|
return margin;
|
|
149159
149232
|
}
|
|
149160
|
-
_adjustParentBBoxes(bbox,
|
|
149233
|
+
_adjustParentBBoxes(bbox, path26, level) {
|
|
149161
149234
|
for (let i = level;i >= 0; i--) {
|
|
149162
|
-
extend(
|
|
149235
|
+
extend(path26[i], bbox);
|
|
149163
149236
|
}
|
|
149164
149237
|
}
|
|
149165
|
-
_condense(
|
|
149166
|
-
for (let i =
|
|
149167
|
-
if (
|
|
149238
|
+
_condense(path26) {
|
|
149239
|
+
for (let i = path26.length - 1, siblings;i >= 0; i--) {
|
|
149240
|
+
if (path26[i].children.length === 0) {
|
|
149168
149241
|
if (i > 0) {
|
|
149169
|
-
siblings =
|
|
149170
|
-
siblings.splice(siblings.indexOf(
|
|
149242
|
+
siblings = path26[i - 1].children;
|
|
149243
|
+
siblings.splice(siblings.indexOf(path26[i]), 1);
|
|
149171
149244
|
} else
|
|
149172
149245
|
this.clear();
|
|
149173
149246
|
} else
|
|
149174
|
-
calcBBox(
|
|
149247
|
+
calcBBox(path26[i], this.toBBox);
|
|
149175
149248
|
}
|
|
149176
149249
|
}
|
|
149177
149250
|
};
|
|
@@ -150316,7 +150389,7 @@ var CapacityEdgeToPortSegmentSolver = class extends BaseSolver {
|
|
|
150316
150389
|
this.capacityPaths = capacityPaths;
|
|
150317
150390
|
this.colorMap = colorMap ?? {};
|
|
150318
150391
|
this.unprocessedNodeIds = [
|
|
150319
|
-
...new Set(capacityPaths.flatMap((
|
|
150392
|
+
...new Set(capacityPaths.flatMap((path26) => path26.nodeIds))
|
|
150320
150393
|
];
|
|
150321
150394
|
this.nodePortSegments = /* @__PURE__ */ new Map;
|
|
150322
150395
|
}
|
|
@@ -150327,17 +150400,17 @@ var CapacityEdgeToPortSegmentSolver = class extends BaseSolver {
|
|
|
150327
150400
|
return;
|
|
150328
150401
|
}
|
|
150329
150402
|
const pathsGoingThroughNode = [];
|
|
150330
|
-
for (const
|
|
150331
|
-
const indexOfNodeInPath =
|
|
150403
|
+
for (const path26 of this.capacityPaths) {
|
|
150404
|
+
const indexOfNodeInPath = path26.nodeIds.indexOf(nodeId);
|
|
150332
150405
|
if (indexOfNodeInPath !== -1) {
|
|
150333
|
-
pathsGoingThroughNode.push({ path:
|
|
150406
|
+
pathsGoingThroughNode.push({ path: path26, indexOfNodeInPath });
|
|
150334
150407
|
}
|
|
150335
150408
|
}
|
|
150336
150409
|
const node = this.nodeMap.get(nodeId);
|
|
150337
150410
|
const nodePortSegments = [];
|
|
150338
|
-
for (const { path:
|
|
150339
|
-
const entryNodeId =
|
|
150340
|
-
const exitNodeId =
|
|
150411
|
+
for (const { path: path26, indexOfNodeInPath } of pathsGoingThroughNode) {
|
|
150412
|
+
const entryNodeId = path26.nodeIds[indexOfNodeInPath - 1];
|
|
150413
|
+
const exitNodeId = path26.nodeIds[indexOfNodeInPath + 1];
|
|
150341
150414
|
for (const adjNodeId of [entryNodeId, exitNodeId]) {
|
|
150342
150415
|
const adjNode = this.nodeMap.get(adjNodeId);
|
|
150343
150416
|
if (!adjNode)
|
|
@@ -150350,7 +150423,7 @@ var CapacityEdgeToPortSegmentSolver = class extends BaseSolver {
|
|
|
150350
150423
|
capacityMeshNodeId: nodeId,
|
|
150351
150424
|
start: segment2.start,
|
|
150352
150425
|
end: segment2.end,
|
|
150353
|
-
connectionNames: [
|
|
150426
|
+
connectionNames: [path26.connectionName],
|
|
150354
150427
|
availableZ: mutuallyAvailableZ
|
|
150355
150428
|
};
|
|
150356
150429
|
nodePortSegments.push(portSegment);
|
|
@@ -151156,37 +151229,37 @@ var SingleHighDensityRouteSolver = class extends BaseSolver {
|
|
|
151156
151229
|
return neighbors;
|
|
151157
151230
|
}
|
|
151158
151231
|
getNodePath(node) {
|
|
151159
|
-
const
|
|
151232
|
+
const path26 = [];
|
|
151160
151233
|
while (node) {
|
|
151161
|
-
|
|
151234
|
+
path26.push(node);
|
|
151162
151235
|
node = node.parent;
|
|
151163
151236
|
}
|
|
151164
|
-
return
|
|
151237
|
+
return path26;
|
|
151165
151238
|
}
|
|
151166
151239
|
getViasInNodePath(node) {
|
|
151167
|
-
const
|
|
151240
|
+
const path26 = this.getNodePath(node);
|
|
151168
151241
|
const vias = [];
|
|
151169
|
-
for (let i = 0;i <
|
|
151170
|
-
if (
|
|
151171
|
-
vias.push({ x:
|
|
151242
|
+
for (let i = 0;i < path26.length - 1; i++) {
|
|
151243
|
+
if (path26[i].z !== path26[i + 1].z) {
|
|
151244
|
+
vias.push({ x: path26[i].x, y: path26[i].y });
|
|
151172
151245
|
}
|
|
151173
151246
|
}
|
|
151174
151247
|
return vias;
|
|
151175
151248
|
}
|
|
151176
151249
|
setSolvedPath(node) {
|
|
151177
|
-
const
|
|
151178
|
-
|
|
151250
|
+
const path26 = this.getNodePath(node);
|
|
151251
|
+
path26.reverse();
|
|
151179
151252
|
const vias = [];
|
|
151180
|
-
for (let i = 0;i <
|
|
151181
|
-
if (
|
|
151182
|
-
vias.push({ x:
|
|
151253
|
+
for (let i = 0;i < path26.length - 1; i++) {
|
|
151254
|
+
if (path26[i].z !== path26[i + 1].z) {
|
|
151255
|
+
vias.push({ x: path26[i].x, y: path26[i].y });
|
|
151183
151256
|
}
|
|
151184
151257
|
}
|
|
151185
151258
|
this.solvedPath = {
|
|
151186
151259
|
connectionName: this.connectionName,
|
|
151187
151260
|
traceThickness: this.traceThickness,
|
|
151188
151261
|
viaDiameter: this.viaDiameter,
|
|
151189
|
-
route:
|
|
151262
|
+
route: path26.map((node2) => ({ x: node2.x, y: node2.y, z: node2.z })).concat([this.B]),
|
|
151190
151263
|
vias
|
|
151191
151264
|
};
|
|
151192
151265
|
}
|
|
@@ -151925,14 +151998,14 @@ function computeDumbbellPaths({
|
|
|
151925
151998
|
const u3 = (dx2 * d1y - dy2 * d1x) / det;
|
|
151926
151999
|
return t3 > 0 && t3 < 1 && u3 > 0 && u3 < 1;
|
|
151927
152000
|
};
|
|
151928
|
-
const doPathsIntersect = (path1,
|
|
152001
|
+
const doPathsIntersect = (path1, path26) => {
|
|
151929
152002
|
const segments1 = [];
|
|
151930
152003
|
for (let i = 0;i < path1.length - 1; i++) {
|
|
151931
152004
|
segments1.push({ start: path1[i], end: path1[i + 1] });
|
|
151932
152005
|
}
|
|
151933
152006
|
const segments2 = [];
|
|
151934
|
-
for (let i = 0;i <
|
|
151935
|
-
segments2.push({ start:
|
|
152007
|
+
for (let i = 0;i < path26.length - 1; i++) {
|
|
152008
|
+
segments2.push({ start: path26[i], end: path26[i + 1] });
|
|
151936
152009
|
}
|
|
151937
152010
|
for (const seg1 of segments1) {
|
|
151938
152011
|
for (const seg2 of segments2) {
|
|
@@ -151994,12 +152067,12 @@ function computeDumbbellPaths({
|
|
|
151994
152067
|
specialType: circleCenter === A3 ? "A" : "B"
|
|
151995
152068
|
};
|
|
151996
152069
|
};
|
|
151997
|
-
const subdivideOptimalPath = (
|
|
151998
|
-
if (
|
|
151999
|
-
return
|
|
152000
|
-
const result = [
|
|
152001
|
-
for (let i = 0;i <
|
|
152002
|
-
const segment2 = { start:
|
|
152070
|
+
const subdivideOptimalPath = (path26, numSubdivisions) => {
|
|
152071
|
+
if (path26.length < 2)
|
|
152072
|
+
return path26;
|
|
152073
|
+
const result = [path26[0]];
|
|
152074
|
+
for (let i = 0;i < path26.length - 1; i++) {
|
|
152075
|
+
const segment2 = { start: path26[i], end: path26[i + 1] };
|
|
152003
152076
|
const segmentMidpoint = {
|
|
152004
152077
|
x: (segment2.start.x + segment2.end.x) / 2,
|
|
152005
152078
|
y: (segment2.start.y + segment2.end.y) / 2
|
|
@@ -152061,7 +152134,7 @@ function computeDumbbellPaths({
|
|
|
152061
152134
|
}
|
|
152062
152135
|
subdivisionPoints.forEach((p) => result.push(p));
|
|
152063
152136
|
}
|
|
152064
|
-
result.push(
|
|
152137
|
+
result.push(path26[i + 1]);
|
|
152065
152138
|
}
|
|
152066
152139
|
if (result.length > 1) {
|
|
152067
152140
|
const filteredResult = [result[0]];
|
|
@@ -152296,13 +152369,13 @@ function computeDumbbellPaths({
|
|
|
152296
152369
|
].map((l, index) => ({ ...l, index }));
|
|
152297
152370
|
};
|
|
152298
152371
|
const subdivideJLinePath = (jLine, oppositePoint, r3, m2, numSubdivisions) => {
|
|
152299
|
-
const
|
|
152300
|
-
if (
|
|
152301
|
-
return
|
|
152372
|
+
const path26 = jLine.points;
|
|
152373
|
+
if (path26.length < 2)
|
|
152374
|
+
return path26;
|
|
152302
152375
|
const minDistThreshold = r3 + m2;
|
|
152303
|
-
const result = [
|
|
152304
|
-
for (let i = 0;i <
|
|
152305
|
-
const segment2 = { start:
|
|
152376
|
+
const result = [path26[0]];
|
|
152377
|
+
for (let i = 0;i < path26.length - 1; i++) {
|
|
152378
|
+
const segment2 = { start: path26[i], end: path26[i + 1] };
|
|
152306
152379
|
const distToOpposite = pointToSegmentDistance22(oppositePoint, segment2.start, segment2.end);
|
|
152307
152380
|
if (distToOpposite < minDistThreshold) {
|
|
152308
152381
|
const closestPt = closestPointOnSegment(segment2, oppositePoint);
|
|
@@ -152352,18 +152425,18 @@ function computeDumbbellPaths({
|
|
|
152352
152425
|
const paths = getPaths();
|
|
152353
152426
|
const validPaths = [];
|
|
152354
152427
|
for (let i = 0;i < paths.length; i++) {
|
|
152355
|
-
const
|
|
152356
|
-
const firstSeg = { start:
|
|
152428
|
+
const path27 = paths[i];
|
|
152429
|
+
const firstSeg = { start: path27[0], end: path27[1] };
|
|
152357
152430
|
const lastSeg = {
|
|
152358
|
-
start:
|
|
152359
|
-
end:
|
|
152431
|
+
start: path27[path27.length - 2],
|
|
152432
|
+
end: path27[path27.length - 1]
|
|
152360
152433
|
};
|
|
152361
|
-
const midSeg = { start:
|
|
152434
|
+
const midSeg = { start: path27[3], end: path27[4] };
|
|
152362
152435
|
if (!intersect2(firstSeg, lastSeg) && !intersect2(firstSeg, midSeg) && !intersect2(lastSeg, midSeg)) {
|
|
152363
152436
|
validPaths.push({
|
|
152364
152437
|
index: i + 1,
|
|
152365
|
-
path:
|
|
152366
|
-
length: pathLength(
|
|
152438
|
+
path: path27,
|
|
152439
|
+
length: pathLength(path27)
|
|
152367
152440
|
});
|
|
152368
152441
|
}
|
|
152369
152442
|
}
|
|
@@ -152371,26 +152444,26 @@ function computeDumbbellPaths({
|
|
|
152371
152444
|
return { index: 0, path: [] };
|
|
152372
152445
|
}
|
|
152373
152446
|
const optimalPath2 = validPaths.sort((a, b3) => a.length - b3.length)[0];
|
|
152374
|
-
const
|
|
152375
|
-
const firstPoint =
|
|
152376
|
-
const dist3 = distance3(firstPoint,
|
|
152377
|
-
const dist4 = distance3(firstPoint,
|
|
152447
|
+
const path26 = [...optimalPath2.path];
|
|
152448
|
+
const firstPoint = path26[0];
|
|
152449
|
+
const dist3 = distance3(firstPoint, path26[2]);
|
|
152450
|
+
const dist4 = distance3(firstPoint, path26[3]);
|
|
152378
152451
|
const closerIdx = dist3 < dist4 ? 2 : 3;
|
|
152379
|
-
if (dist3 < distance3(firstPoint,
|
|
152380
|
-
|
|
152452
|
+
if (dist3 < distance3(firstPoint, path26[1]) || dist4 < distance3(firstPoint, path26[1])) {
|
|
152453
|
+
path26.splice(1, closerIdx - 1);
|
|
152381
152454
|
}
|
|
152382
|
-
const lastPoint =
|
|
152383
|
-
const distM3 = distance3(lastPoint,
|
|
152384
|
-
const distM4 = distance3(lastPoint,
|
|
152385
|
-
const closerLastIdx = distM3 < distM4 ?
|
|
152386
|
-
if (distM3 < distance3(lastPoint,
|
|
152387
|
-
|
|
152455
|
+
const lastPoint = path26[path26.length - 1];
|
|
152456
|
+
const distM3 = distance3(lastPoint, path26[path26.length - 3]);
|
|
152457
|
+
const distM4 = distance3(lastPoint, path26[path26.length - 4]);
|
|
152458
|
+
const closerLastIdx = distM3 < distM4 ? path26.length - 3 : path26.length - 4;
|
|
152459
|
+
if (distM3 < distance3(lastPoint, path26[path26.length - 2]) || distM4 < distance3(lastPoint, path26[path26.length - 2])) {
|
|
152460
|
+
path26.splice(closerLastIdx + 1, path26.length - closerLastIdx - 2);
|
|
152388
152461
|
}
|
|
152389
152462
|
return {
|
|
152390
152463
|
index: optimalPath2.index,
|
|
152391
|
-
path:
|
|
152392
|
-
startsAt:
|
|
152393
|
-
goesTo:
|
|
152464
|
+
path: path26,
|
|
152465
|
+
startsAt: path26[0] === C2 ? "C" : "D",
|
|
152466
|
+
goesTo: path26[path26.length - 1] === C2 ? "C" : "D"
|
|
152394
152467
|
};
|
|
152395
152468
|
};
|
|
152396
152469
|
const optimalPath = findOptimalPath();
|
|
@@ -153810,9 +153883,9 @@ var ViaPossibilitiesSolver2 = class extends BaseSolver {
|
|
|
153810
153883
|
let closestIntersection = null;
|
|
153811
153884
|
let intersectedSegmentZ = null;
|
|
153812
153885
|
const checkIntersectionsWithPathMap = (pathMap) => {
|
|
153813
|
-
for (const
|
|
153814
|
-
for (let i = 0;i <
|
|
153815
|
-
const segment2 = [
|
|
153886
|
+
for (const path26 of pathMap.values()) {
|
|
153887
|
+
for (let i = 0;i < path26.length - 1; i++) {
|
|
153888
|
+
const segment2 = [path26[i], path26[i + 1]];
|
|
153816
153889
|
if (segment2[0].x === segment2[1].x && segment2[0].y === segment2[1].y) {
|
|
153817
153890
|
continue;
|
|
153818
153891
|
}
|
|
@@ -153942,11 +154015,11 @@ var ViaPossibilitiesSolver2 = class extends BaseSolver {
|
|
|
153942
154015
|
});
|
|
153943
154016
|
}
|
|
153944
154017
|
const drawPath = (pathMap, labelPrefix) => {
|
|
153945
|
-
for (const [connectionName,
|
|
154018
|
+
for (const [connectionName, path26] of pathMap.entries()) {
|
|
153946
154019
|
const color = colorMap[connectionName] ?? "black";
|
|
153947
|
-
for (let i = 0;i <
|
|
153948
|
-
const p12 =
|
|
153949
|
-
const p2 =
|
|
154020
|
+
for (let i = 0;i < path26.length - 1; i++) {
|
|
154021
|
+
const p12 = path26[i];
|
|
154022
|
+
const p2 = path26[i + 1];
|
|
153950
154023
|
if (p12.x === p2.x && p12.y === p2.y && p12.z !== p2.z) {
|
|
153951
154024
|
graphics.circles.push({
|
|
153952
154025
|
center: { x: p12.x, y: p12.y },
|
|
@@ -154544,10 +154617,10 @@ function detectMultiConnectionClosedFacesWithoutVias(polyLines, bounds) {
|
|
|
154544
154617
|
const allSegments = [];
|
|
154545
154618
|
const viaPoints = /* @__PURE__ */ new Map;
|
|
154546
154619
|
for (const polyLine of polyLines) {
|
|
154547
|
-
const
|
|
154548
|
-
for (let i = 0;i <
|
|
154549
|
-
const p12 =
|
|
154550
|
-
const p2 =
|
|
154620
|
+
const path26 = [polyLine.start, ...polyLine.mPoints, polyLine.end];
|
|
154621
|
+
for (let i = 0;i < path26.length - 1; i++) {
|
|
154622
|
+
const p12 = path26[i];
|
|
154623
|
+
const p2 = path26[i + 1];
|
|
154551
154624
|
const layer = p12.z2;
|
|
154552
154625
|
allSegments.push({
|
|
154553
154626
|
start: { x: p12.x, y: p12.y },
|
|
@@ -154565,7 +154638,7 @@ function detectMultiConnectionClosedFacesWithoutVias(polyLines, bounds) {
|
|
|
154565
154638
|
}
|
|
154566
154639
|
}
|
|
154567
154640
|
}
|
|
154568
|
-
const lastPoint =
|
|
154641
|
+
const lastPoint = path26[path26.length - 1];
|
|
154569
154642
|
if (lastPoint.z1 !== lastPoint.z2) {
|
|
154570
154643
|
const key = pointKey2(lastPoint);
|
|
154571
154644
|
if (!viaPoints.has(key)) {
|
|
@@ -154864,14 +154937,14 @@ var MultiHeadPolyLineIntraNodeSolver = class extends BaseSolver {
|
|
|
154864
154937
|
const polyLineVias = [];
|
|
154865
154938
|
for (let i = 0;i < polyLines.length; i++) {
|
|
154866
154939
|
const polyLine = polyLines[i];
|
|
154867
|
-
const
|
|
154940
|
+
const path26 = [polyLine.start, ...polyLine.mPoints, polyLine.end];
|
|
154868
154941
|
const segmentsByLayer = new Map(this.availableZ.map((z852) => [z852, []]));
|
|
154869
|
-
for (let i22 = 0;i22 <
|
|
154870
|
-
const segment2 = [
|
|
154942
|
+
for (let i22 = 0;i22 < path26.length - 1; i22++) {
|
|
154943
|
+
const segment2 = [path26[i22], path26[i22 + 1]];
|
|
154871
154944
|
segmentsByLayer.get(segment2[0].z2).push(segment2);
|
|
154872
154945
|
}
|
|
154873
154946
|
polyLineSegmentsByLayer.push(segmentsByLayer);
|
|
154874
|
-
polyLineVias.push(
|
|
154947
|
+
polyLineVias.push(path26.filter((p) => p.z1 !== p.z2));
|
|
154875
154948
|
}
|
|
154876
154949
|
for (let i = 0;i < polyLines.length; i++) {
|
|
154877
154950
|
const path1SegmentsByLayer = polyLineSegmentsByLayer[i];
|
|
@@ -156300,7 +156373,7 @@ var HighDensitySolver = class extends BaseSolver {
|
|
|
156300
156373
|
if (this.failedSolvers.length > 0) {
|
|
156301
156374
|
this.solved = false;
|
|
156302
156375
|
this.failed = true;
|
|
156303
|
-
this.error = `Failed to solve ${this.failedSolvers.length} nodes, ${this.failedSolvers.slice(0, 5).map((
|
|
156376
|
+
this.error = `Failed to solve ${this.failedSolvers.length} nodes, ${this.failedSolvers.slice(0, 5).map((fs27) => fs27.nodeWithPortPoints.capacityMeshNodeId)}. err0: ${this.failedSolvers[0].error}.`;
|
|
156304
156377
|
return;
|
|
156305
156378
|
}
|
|
156306
156379
|
this.solved = true;
|
|
@@ -159081,13 +159154,13 @@ var CapacityPathingSolver = class extends BaseSolver {
|
|
|
159081
159154
|
return this.getDistanceBetweenNodes(node, endGoal);
|
|
159082
159155
|
}
|
|
159083
159156
|
getBacktrackedPath(candidate) {
|
|
159084
|
-
const
|
|
159157
|
+
const path26 = [];
|
|
159085
159158
|
let currentCandidate = candidate;
|
|
159086
159159
|
while (currentCandidate) {
|
|
159087
|
-
|
|
159160
|
+
path26.push(currentCandidate.node);
|
|
159088
159161
|
currentCandidate = currentCandidate.prevCandidate;
|
|
159089
159162
|
}
|
|
159090
|
-
return
|
|
159163
|
+
return path26;
|
|
159091
159164
|
}
|
|
159092
159165
|
getNeighboringNodes(node) {
|
|
159093
159166
|
return this.nodeEdgeMap.get(node.capacityMeshNodeId).flatMap((edge) => edge.nodeIds.filter((n3) => n3 !== node.capacityMeshNodeId)).map((n3) => this.nodeMap.get(n3));
|
|
@@ -159095,12 +159168,12 @@ var CapacityPathingSolver = class extends BaseSolver {
|
|
|
159095
159168
|
getCapacityPaths() {
|
|
159096
159169
|
const capacityPaths = [];
|
|
159097
159170
|
for (const connection of this.connectionsWithNodes) {
|
|
159098
|
-
const
|
|
159099
|
-
if (
|
|
159171
|
+
const path26 = connection.path;
|
|
159172
|
+
if (path26) {
|
|
159100
159173
|
capacityPaths.push({
|
|
159101
159174
|
capacityPathId: connection.connection.name,
|
|
159102
159175
|
connectionName: connection.connection.name,
|
|
159103
|
-
nodeIds:
|
|
159176
|
+
nodeIds: path26.map((node) => node.capacityMeshNodeId)
|
|
159104
159177
|
});
|
|
159105
159178
|
}
|
|
159106
159179
|
}
|
|
@@ -159785,10 +159858,10 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
|
|
|
159785
159858
|
return this.getDistanceBetweenNodes(node, endGoal) + this.getNodeCapacityPenalty(node);
|
|
159786
159859
|
}
|
|
159787
159860
|
getBacktrackedPath(candidate) {
|
|
159788
|
-
const
|
|
159861
|
+
const path26 = [];
|
|
159789
159862
|
let currentCandidate = candidate;
|
|
159790
159863
|
while (currentCandidate) {
|
|
159791
|
-
|
|
159864
|
+
path26.push(currentCandidate.node);
|
|
159792
159865
|
if (this.nodeMap.has(currentCandidate.node.capacityMeshNodeId)) {
|
|
159793
159866
|
currentCandidate = currentCandidate.prevCandidate;
|
|
159794
159867
|
} else {
|
|
@@ -159796,7 +159869,7 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
|
|
|
159796
159869
|
break;
|
|
159797
159870
|
}
|
|
159798
159871
|
}
|
|
159799
|
-
return
|
|
159872
|
+
return path26.reverse();
|
|
159800
159873
|
}
|
|
159801
159874
|
getNeighboringNodes(node) {
|
|
159802
159875
|
if (!this.nodeMap.has(node.capacityMeshNodeId))
|
|
@@ -159811,8 +159884,8 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
|
|
|
159811
159884
|
doesNodeHaveCapacityForTrace(node, prevNode) {
|
|
159812
159885
|
return true;
|
|
159813
159886
|
}
|
|
159814
|
-
reduceCapacityAlongPath(
|
|
159815
|
-
for (const pathNode of
|
|
159887
|
+
reduceCapacityAlongPath(path26) {
|
|
159888
|
+
for (const pathNode of path26) {
|
|
159816
159889
|
if (this.usedNodeCapacityMap.has(pathNode.capacityMeshNodeId)) {
|
|
159817
159890
|
const nodeId = pathNode.capacityMeshNodeId;
|
|
159818
159891
|
const nodeInSection = this.nodeMap.get(nodeId);
|
|
@@ -159941,9 +160014,9 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
|
|
|
159941
160014
|
this.queuedNodes = null;
|
|
159942
160015
|
}
|
|
159943
160016
|
_handleGoalReached(currentCandidate, currentTerminal, endNode) {
|
|
159944
|
-
const
|
|
159945
|
-
currentTerminal.path =
|
|
159946
|
-
this.reduceCapacityAlongPath(
|
|
160017
|
+
const path26 = this.getBacktrackedPath(currentCandidate);
|
|
160018
|
+
currentTerminal.path = path26;
|
|
160019
|
+
this.reduceCapacityAlongPath(path26);
|
|
159947
160020
|
this.currentConnectionIndex++;
|
|
159948
160021
|
this.candidates = null;
|
|
159949
160022
|
this.visitedNodes = null;
|
|
@@ -159992,10 +160065,10 @@ var CapacityPathingSingleSectionSolver = class extends BaseSolver {
|
|
|
159992
160065
|
const connectionColor = this.colorMap[connectionName] ?? "purple";
|
|
159993
160066
|
topCandidates.forEach((candidate, index) => {
|
|
159994
160067
|
const opacity = 0.8 * (1 - index / 5);
|
|
159995
|
-
const
|
|
159996
|
-
if (
|
|
160068
|
+
const path26 = this.getBacktrackedPath(candidate);
|
|
160069
|
+
if (path26.length > 0) {
|
|
159997
160070
|
baseGraphics.lines.push({
|
|
159998
|
-
points:
|
|
160071
|
+
points: path26.map(({ center: { x, y } }) => ({ x, y })),
|
|
159999
160072
|
strokeColor: safeTransparentize(connectionColor, 1 - opacity),
|
|
160000
160073
|
strokeWidth: 0.05
|
|
160001
160074
|
});
|
|
@@ -160684,12 +160757,12 @@ var CapacityPathingMultiSectionSolver = class extends BaseSolver {
|
|
|
160684
160757
|
getCapacityPaths() {
|
|
160685
160758
|
const capacityPaths = [];
|
|
160686
160759
|
for (const connection of this.connectionsWithNodes) {
|
|
160687
|
-
const
|
|
160688
|
-
if (
|
|
160760
|
+
const path26 = connection.path;
|
|
160761
|
+
if (path26) {
|
|
160689
160762
|
capacityPaths.push({
|
|
160690
160763
|
capacityPathId: connection.connection.name,
|
|
160691
160764
|
connectionName: connection.connection.name,
|
|
160692
|
-
nodeIds:
|
|
160765
|
+
nodeIds: path26.map((node) => node.capacityMeshNodeId)
|
|
160693
160766
|
});
|
|
160694
160767
|
}
|
|
160695
160768
|
}
|
|
@@ -161710,22 +161783,22 @@ var SingleSimplifiedPathSolver5 = class extends SingleSimplifiedPathSolver {
|
|
|
161710
161783
|
return null;
|
|
161711
161784
|
}
|
|
161712
161785
|
const possiblePaths = calculate45DegreePaths({ x: start.x, y: start.y }, { x: end.x, y: end.y });
|
|
161713
|
-
for (const
|
|
161714
|
-
const fullPath =
|
|
161786
|
+
for (const path26 of possiblePaths) {
|
|
161787
|
+
const fullPath = path26.map((p) => ({ x: p.x, y: p.y, z: start.z }));
|
|
161715
161788
|
if (this.isValidPath(fullPath)) {
|
|
161716
161789
|
return fullPath;
|
|
161717
161790
|
}
|
|
161718
161791
|
}
|
|
161719
161792
|
return null;
|
|
161720
161793
|
}
|
|
161721
|
-
addPathToResult(
|
|
161722
|
-
if (
|
|
161794
|
+
addPathToResult(path26) {
|
|
161795
|
+
if (path26.length === 0)
|
|
161723
161796
|
return;
|
|
161724
|
-
for (let i = 0;i <
|
|
161725
|
-
if (i === 0 && this.newRoute.length > 0 && this.arePointsEqual(this.newRoute[this.newRoute.length - 1],
|
|
161797
|
+
for (let i = 0;i < path26.length; i++) {
|
|
161798
|
+
if (i === 0 && this.newRoute.length > 0 && this.arePointsEqual(this.newRoute[this.newRoute.length - 1], path26[i])) {
|
|
161726
161799
|
continue;
|
|
161727
161800
|
}
|
|
161728
|
-
this.newRoute.push(
|
|
161801
|
+
this.newRoute.push(path26[i]);
|
|
161729
161802
|
}
|
|
161730
161803
|
this.currentStepSize = this.maxStepSize;
|
|
161731
161804
|
}
|
|
@@ -189132,7 +189205,7 @@ var Trace_doInitialSchematicTraceRender = (trace) => {
|
|
|
189132
189205
|
for (let i = 0;i < portsWithPosition.length - 1; i++) {
|
|
189133
189206
|
const start = portsWithPosition[i];
|
|
189134
189207
|
const end = portsWithPosition[i + 1];
|
|
189135
|
-
const
|
|
189208
|
+
const path26 = calculateElbow({
|
|
189136
189209
|
x: start.position.x,
|
|
189137
189210
|
y: start.position.y,
|
|
189138
189211
|
facingDirection: convertFacingDirectionToElbowDirection(start.facingDirection)
|
|
@@ -189141,8 +189214,8 @@ var Trace_doInitialSchematicTraceRender = (trace) => {
|
|
|
189141
189214
|
y: end.position.y,
|
|
189142
189215
|
facingDirection: convertFacingDirectionToElbowDirection(end.facingDirection)
|
|
189143
189216
|
});
|
|
189144
|
-
for (let j4 = 0;j4 <
|
|
189145
|
-
elbowEdges.push({ from:
|
|
189217
|
+
for (let j4 = 0;j4 < path26.length - 1; j4++) {
|
|
189218
|
+
elbowEdges.push({ from: path26[j4], to: path26[j4 + 1] });
|
|
189146
189219
|
}
|
|
189147
189220
|
}
|
|
189148
189221
|
const doesSegmentIntersectRect = (edge, rect) => {
|
|
@@ -195330,8 +195403,8 @@ react/cjs/react-jsx-runtime.development.js:
|
|
|
195330
195403
|
*/
|
|
195331
195404
|
|
|
195332
195405
|
// lib/import/import-component-from-jlcpcb.ts
|
|
195333
|
-
import
|
|
195334
|
-
import
|
|
195406
|
+
import fs27 from "node:fs/promises";
|
|
195407
|
+
import path26 from "node:path";
|
|
195335
195408
|
var importComponentFromJlcpcb = async (jlcpcbPartNumber, projectDir = process.cwd()) => {
|
|
195336
195409
|
const component = await fetchEasyEDAComponent(jlcpcbPartNumber);
|
|
195337
195410
|
const tsx = await convertRawEasyToTsx(component);
|
|
@@ -195339,10 +195412,10 @@ var importComponentFromJlcpcb = async (jlcpcbPartNumber, projectDir = process.cw
|
|
|
195339
195412
|
if (!fileName) {
|
|
195340
195413
|
throw new Error("Could not determine file name of converted component");
|
|
195341
195414
|
}
|
|
195342
|
-
const importsDir =
|
|
195343
|
-
await
|
|
195344
|
-
const filePath =
|
|
195345
|
-
await
|
|
195415
|
+
const importsDir = path26.join(projectDir, "imports");
|
|
195416
|
+
await fs27.mkdir(importsDir, { recursive: true });
|
|
195417
|
+
const filePath = path26.join(importsDir, `${fileName}.tsx`);
|
|
195418
|
+
await fs27.writeFile(filePath, tsx);
|
|
195346
195419
|
return { filePath };
|
|
195347
195420
|
};
|
|
195348
195421
|
|
|
@@ -195443,12 +195516,12 @@ var registerRemove = (program3) => {
|
|
|
195443
195516
|
};
|
|
195444
195517
|
|
|
195445
195518
|
// cli/build/register.ts
|
|
195446
|
-
import
|
|
195447
|
-
import
|
|
195519
|
+
import path30 from "node:path";
|
|
195520
|
+
import fs31 from "node:fs";
|
|
195448
195521
|
|
|
195449
195522
|
// cli/build/build-file.ts
|
|
195450
|
-
import
|
|
195451
|
-
import
|
|
195523
|
+
import path27 from "node:path";
|
|
195524
|
+
import fs28 from "node:fs";
|
|
195452
195525
|
|
|
195453
195526
|
// lib/shared/circuit-json-diagnostics.ts
|
|
195454
195527
|
function analyzeCircuitJson(circuitJson) {
|
|
@@ -195480,9 +195553,9 @@ var buildFile = async (input, output, projectDir, options) => {
|
|
|
195480
195553
|
filePath: input,
|
|
195481
195554
|
platformConfig: options?.platformConfig
|
|
195482
195555
|
});
|
|
195483
|
-
|
|
195484
|
-
|
|
195485
|
-
console.log(`Circuit JSON written to ${
|
|
195556
|
+
fs28.mkdirSync(path27.dirname(output), { recursive: true });
|
|
195557
|
+
fs28.writeFileSync(output, JSON.stringify(result.circuitJson, null, 2));
|
|
195558
|
+
console.log(`Circuit JSON written to ${path27.relative(projectDir, output)}`);
|
|
195486
195559
|
const { errors, warnings } = analyzeCircuitJson(result.circuitJson);
|
|
195487
195560
|
if (!options?.ignoreWarnings) {
|
|
195488
195561
|
for (const warn of warnings) {
|
|
@@ -195510,22 +195583,19 @@ var buildFile = async (input, output, projectDir, options) => {
|
|
|
195510
195583
|
};
|
|
195511
195584
|
|
|
195512
195585
|
// cli/build/get-build-entrypoints.ts
|
|
195513
|
-
import
|
|
195514
|
-
import
|
|
195586
|
+
import fs29 from "node:fs";
|
|
195587
|
+
import path28 from "node:path";
|
|
195515
195588
|
async function getBuildEntrypoints({
|
|
195516
195589
|
fileOrDir,
|
|
195517
195590
|
rootDir = process.cwd()
|
|
195518
195591
|
}) {
|
|
195519
|
-
const resolvedRoot =
|
|
195592
|
+
const resolvedRoot = path28.resolve(rootDir);
|
|
195520
195593
|
const buildFromProjectDir = async (projectDir2) => {
|
|
195521
|
-
const files =
|
|
195522
|
-
cwd: projectDir2,
|
|
195523
|
-
ignore: DEFAULT_IGNORED_PATTERNS
|
|
195524
|
-
});
|
|
195594
|
+
const files = findBoardFiles({ projectDir: projectDir2 });
|
|
195525
195595
|
if (files.length > 0) {
|
|
195526
195596
|
return {
|
|
195527
195597
|
projectDir: projectDir2,
|
|
195528
|
-
circuitFiles: files
|
|
195598
|
+
circuitFiles: files
|
|
195529
195599
|
};
|
|
195530
195600
|
}
|
|
195531
195601
|
const mainEntrypoint = await getEntrypoint({
|
|
@@ -195550,12 +195620,12 @@ async function getBuildEntrypoints({
|
|
|
195550
195620
|
};
|
|
195551
195621
|
};
|
|
195552
195622
|
if (fileOrDir) {
|
|
195553
|
-
const resolved =
|
|
195554
|
-
if (
|
|
195623
|
+
const resolved = path28.resolve(resolvedRoot, fileOrDir);
|
|
195624
|
+
if (fs29.existsSync(resolved) && fs29.statSync(resolved).isDirectory()) {
|
|
195555
195625
|
const projectDir2 = resolved;
|
|
195556
195626
|
return buildFromProjectDir(projectDir2);
|
|
195557
195627
|
}
|
|
195558
|
-
return { projectDir:
|
|
195628
|
+
return { projectDir: path28.dirname(resolved), circuitFiles: [resolved] };
|
|
195559
195629
|
}
|
|
195560
195630
|
const projectDir = resolvedRoot;
|
|
195561
195631
|
return buildFromProjectDir(projectDir);
|
|
@@ -195590,8 +195660,8 @@ ${scriptBlock} <script src="https://cdn.tailwindcss.com"></script>
|
|
|
195590
195660
|
};
|
|
195591
195661
|
|
|
195592
195662
|
// cli/build/build-preview-images.ts
|
|
195593
|
-
import
|
|
195594
|
-
import
|
|
195663
|
+
import fs30 from "node:fs";
|
|
195664
|
+
import path29 from "node:path";
|
|
195595
195665
|
import {
|
|
195596
195666
|
convertCircuitJsonToPcbSvg as convertCircuitJsonToPcbSvg2,
|
|
195597
195667
|
convertCircuitJsonToSchematicSvg as convertCircuitJsonToSchematicSvg2
|
|
@@ -195604,10 +195674,10 @@ var buildPreviewImages = async ({
|
|
|
195604
195674
|
mainEntrypoint
|
|
195605
195675
|
}) => {
|
|
195606
195676
|
const successfulBuilds = builtFiles.filter((file) => file.ok);
|
|
195607
|
-
const normalizedMainEntrypoint = mainEntrypoint ?
|
|
195677
|
+
const normalizedMainEntrypoint = mainEntrypoint ? path29.resolve(mainEntrypoint) : undefined;
|
|
195608
195678
|
const previewBuild = (() => {
|
|
195609
195679
|
if (normalizedMainEntrypoint) {
|
|
195610
|
-
const match = successfulBuilds.find((built) =>
|
|
195680
|
+
const match = successfulBuilds.find((built) => path29.resolve(built.sourcePath) === normalizedMainEntrypoint);
|
|
195611
195681
|
if (match)
|
|
195612
195682
|
return match;
|
|
195613
195683
|
}
|
|
@@ -195618,7 +195688,7 @@ var buildPreviewImages = async ({
|
|
|
195618
195688
|
return;
|
|
195619
195689
|
}
|
|
195620
195690
|
try {
|
|
195621
|
-
const circuitJsonRaw =
|
|
195691
|
+
const circuitJsonRaw = fs30.readFileSync(previewBuild.outputPath, "utf-8");
|
|
195622
195692
|
const circuitJson = JSON.parse(circuitJsonRaw);
|
|
195623
195693
|
console.log("Generating PCB SVG...");
|
|
195624
195694
|
const pcbSvg = convertCircuitJsonToPcbSvg2(circuitJson);
|
|
@@ -195636,11 +195706,11 @@ var buildPreviewImages = async ({
|
|
|
195636
195706
|
camPos: [10, 10, 10],
|
|
195637
195707
|
lookAt: [0, 0, 0]
|
|
195638
195708
|
});
|
|
195639
|
-
|
|
195709
|
+
fs30.writeFileSync(path29.join(distDir, "pcb.svg"), pcbSvg, "utf-8");
|
|
195640
195710
|
console.log("Written pcb.svg");
|
|
195641
|
-
|
|
195711
|
+
fs30.writeFileSync(path29.join(distDir, "schematic.svg"), schematicSvg, "utf-8");
|
|
195642
195712
|
console.log("Written schematic.svg");
|
|
195643
|
-
|
|
195713
|
+
fs30.writeFileSync(path29.join(distDir, "3d.png"), Buffer.from(pngBuffer));
|
|
195644
195714
|
console.log("Written 3d.png");
|
|
195645
195715
|
} catch (error) {
|
|
195646
195716
|
console.error("Failed to generate preview images:", error);
|
|
@@ -195665,17 +195735,17 @@ var registerBuild = (program3) => {
|
|
|
195665
195735
|
}
|
|
195666
195736
|
return config;
|
|
195667
195737
|
})();
|
|
195668
|
-
const distDir =
|
|
195669
|
-
|
|
195738
|
+
const distDir = path30.join(projectDir, "dist");
|
|
195739
|
+
fs31.mkdirSync(distDir, { recursive: true });
|
|
195670
195740
|
console.log(`Building ${circuitFiles.length} file(s)...`);
|
|
195671
195741
|
let hasErrors = false;
|
|
195672
195742
|
const staticFileReferences = [];
|
|
195673
195743
|
const builtFiles = [];
|
|
195674
195744
|
for (const filePath of circuitFiles) {
|
|
195675
|
-
const relative9 =
|
|
195745
|
+
const relative9 = path30.relative(projectDir, filePath);
|
|
195676
195746
|
console.log(`Building ${relative9}...`);
|
|
195677
195747
|
const outputDirName = relative9.replace(/(\.board|\.circuit)?\.tsx$/, "");
|
|
195678
|
-
const outputPath =
|
|
195748
|
+
const outputPath = path30.join(distDir, outputDirName, "circuit.json");
|
|
195679
195749
|
const ok = await buildFile(filePath, outputPath, projectDir, {
|
|
195680
195750
|
ignoreErrors: options?.ignoreErrors,
|
|
195681
195751
|
ignoreWarnings: options?.ignoreWarnings,
|
|
@@ -195689,9 +195759,9 @@ var registerBuild = (program3) => {
|
|
|
195689
195759
|
if (!ok) {
|
|
195690
195760
|
hasErrors = true;
|
|
195691
195761
|
} else if (options?.site) {
|
|
195692
|
-
const normalizedSourcePath = relative9.split(
|
|
195693
|
-
const relativeOutputPath =
|
|
195694
|
-
const normalizedOutputPath = relativeOutputPath.split(
|
|
195762
|
+
const normalizedSourcePath = relative9.split(path30.sep).join("/");
|
|
195763
|
+
const relativeOutputPath = path30.join(outputDirName, "circuit.json");
|
|
195764
|
+
const normalizedOutputPath = relativeOutputPath.split(path30.sep).join("/");
|
|
195695
195765
|
staticFileReferences.push({
|
|
195696
195766
|
filePath: normalizedSourcePath,
|
|
195697
195767
|
fileStaticAssetUrl: `./${normalizedOutputPath}`
|
|
@@ -195714,8 +195784,8 @@ var registerBuild = (program3) => {
|
|
|
195714
195784
|
files: staticFileReferences,
|
|
195715
195785
|
standaloneScriptSrc: "./standalone.min.js"
|
|
195716
195786
|
});
|
|
195717
|
-
|
|
195718
|
-
|
|
195787
|
+
fs31.writeFileSync(path30.join(distDir, "index.html"), indexHtml);
|
|
195788
|
+
fs31.writeFileSync(path30.join(distDir, "standalone.min.js"), standalone_min_default);
|
|
195719
195789
|
}
|
|
195720
195790
|
console.log("Build complete!");
|
|
195721
195791
|
process.exit(0);
|
|
@@ -195723,8 +195793,8 @@ var registerBuild = (program3) => {
|
|
|
195723
195793
|
};
|
|
195724
195794
|
|
|
195725
195795
|
// lib/shared/snapshot-project.ts
|
|
195726
|
-
import
|
|
195727
|
-
import
|
|
195796
|
+
import fs33 from "node:fs";
|
|
195797
|
+
import path31 from "node:path";
|
|
195728
195798
|
import looksSame2 from "looks-same";
|
|
195729
195799
|
import {
|
|
195730
195800
|
convertCircuitJsonToPcbSvg as convertCircuitJsonToPcbSvg3,
|
|
@@ -195735,7 +195805,7 @@ import { renderGLTFToPNGBufferFromGLBBuffer as renderGLTFToPNGBufferFromGLBBuffe
|
|
|
195735
195805
|
|
|
195736
195806
|
// lib/shared/compare-images.ts
|
|
195737
195807
|
import looksSame from "looks-same";
|
|
195738
|
-
import
|
|
195808
|
+
import fs32 from "node:fs/promises";
|
|
195739
195809
|
var compareAndCreateDiff = async (buffer1, buffer2, diffPath) => {
|
|
195740
195810
|
const { equal: equal2 } = await looksSame(buffer1, buffer2, {
|
|
195741
195811
|
strict: false,
|
|
@@ -195751,7 +195821,7 @@ var compareAndCreateDiff = async (buffer1, buffer2, diffPath) => {
|
|
|
195751
195821
|
tolerance: 2
|
|
195752
195822
|
});
|
|
195753
195823
|
} else {
|
|
195754
|
-
await
|
|
195824
|
+
await fs32.writeFile(diffPath, buffer2);
|
|
195755
195825
|
}
|
|
195756
195826
|
}
|
|
195757
195827
|
return { equal: equal2 };
|
|
@@ -195776,19 +195846,12 @@ var snapshotProject = async ({
|
|
|
195776
195846
|
...DEFAULT_IGNORED_PATTERNS,
|
|
195777
195847
|
...ignored.map(normalizeIgnorePattern)
|
|
195778
195848
|
];
|
|
195779
|
-
const resolvedPaths = filePaths.map((f) =>
|
|
195780
|
-
const boardFiles =
|
|
195781
|
-
|
|
195782
|
-
|
|
195783
|
-
|
|
195784
|
-
|
|
195785
|
-
}).map((f) => path30.join(p, f));
|
|
195786
|
-
}
|
|
195787
|
-
return [p];
|
|
195788
|
-
}) : globbySync(["**/*.board.tsx", "**/*.circuit.tsx"], {
|
|
195789
|
-
cwd: projectDir,
|
|
195790
|
-
ignore
|
|
195791
|
-
}).map((f) => path30.join(projectDir, f));
|
|
195849
|
+
const resolvedPaths = filePaths.map((f) => path31.resolve(projectDir, f));
|
|
195850
|
+
const boardFiles = findBoardFiles({
|
|
195851
|
+
projectDir,
|
|
195852
|
+
ignore,
|
|
195853
|
+
filePaths: resolvedPaths
|
|
195854
|
+
});
|
|
195792
195855
|
if (boardFiles.length === 0) {
|
|
195793
195856
|
console.log("No entrypoint found. Run 'tsci init' to bootstrap a project or specify a file with 'tsci snapshot <file>'");
|
|
195794
195857
|
return onExit(0);
|
|
@@ -195815,9 +195878,9 @@ var snapshotProject = async ({
|
|
|
195815
195878
|
lookAt: [0, 0, 0]
|
|
195816
195879
|
});
|
|
195817
195880
|
}
|
|
195818
|
-
const snapDir =
|
|
195819
|
-
|
|
195820
|
-
const base =
|
|
195881
|
+
const snapDir = path31.join(path31.dirname(file), "__snapshots__");
|
|
195882
|
+
fs33.mkdirSync(snapDir, { recursive: true });
|
|
195883
|
+
const base = path31.basename(file).replace(/\.tsx$/, "");
|
|
195821
195884
|
const snapshots = [];
|
|
195822
195885
|
if (pcbOnly || !schematicOnly) {
|
|
195823
195886
|
snapshots.push({ type: "pcb", content: pcbSvg, isBinary: false });
|
|
@@ -195835,31 +195898,31 @@ var snapshotProject = async ({
|
|
|
195835
195898
|
for (const snapshot of snapshots) {
|
|
195836
195899
|
const { type } = snapshot;
|
|
195837
195900
|
const is3d = type === "3d";
|
|
195838
|
-
const snapPath =
|
|
195839
|
-
const existing =
|
|
195901
|
+
const snapPath = path31.join(snapDir, `${base}-${type}.snap.${is3d ? "png" : "svg"}`);
|
|
195902
|
+
const existing = fs33.existsSync(snapPath);
|
|
195840
195903
|
const newContentBuffer = snapshot.isBinary ? snapshot.content : Buffer.from(snapshot.content, "utf8");
|
|
195841
195904
|
const newContentForFile = snapshot.content;
|
|
195842
195905
|
if (!existing) {
|
|
195843
|
-
|
|
195844
|
-
console.log("✅", kleur_default.gray(
|
|
195906
|
+
fs33.writeFileSync(snapPath, newContentForFile);
|
|
195907
|
+
console.log("✅", kleur_default.gray(path31.relative(projectDir, snapPath)));
|
|
195845
195908
|
didUpdate = true;
|
|
195846
195909
|
continue;
|
|
195847
195910
|
}
|
|
195848
|
-
const oldContentBuffer =
|
|
195911
|
+
const oldContentBuffer = fs33.readFileSync(snapPath);
|
|
195849
195912
|
const diffPath = snapPath.replace(is3d ? ".snap.png" : ".snap.svg", is3d ? ".diff.png" : ".diff.svg");
|
|
195850
195913
|
const { equal: equal2 } = await compareAndCreateDiff(oldContentBuffer, newContentBuffer, diffPath);
|
|
195851
195914
|
if (update) {
|
|
195852
195915
|
if (!forceUpdate && equal2) {
|
|
195853
|
-
console.log("✅", kleur_default.gray(
|
|
195916
|
+
console.log("✅", kleur_default.gray(path31.relative(projectDir, snapPath)));
|
|
195854
195917
|
} else {
|
|
195855
|
-
|
|
195856
|
-
console.log("✅", kleur_default.gray(
|
|
195918
|
+
fs33.writeFileSync(snapPath, newContentForFile);
|
|
195919
|
+
console.log("✅", kleur_default.gray(path31.relative(projectDir, snapPath)));
|
|
195857
195920
|
didUpdate = true;
|
|
195858
195921
|
}
|
|
195859
195922
|
} else if (!equal2) {
|
|
195860
195923
|
mismatches.push(`${snapPath} (diff: ${diffPath})`);
|
|
195861
195924
|
} else {
|
|
195862
|
-
console.log("✅", kleur_default.gray(
|
|
195925
|
+
console.log("✅", kleur_default.gray(path31.relative(projectDir, snapPath)));
|
|
195863
195926
|
}
|
|
195864
195927
|
}
|
|
195865
195928
|
}
|
|
@@ -195898,22 +195961,22 @@ var registerSnapshot = (program3) => {
|
|
|
195898
195961
|
};
|
|
195899
195962
|
|
|
195900
195963
|
// lib/shared/setup-github-actions.ts
|
|
195901
|
-
import
|
|
195902
|
-
import
|
|
195964
|
+
import fs34 from "node:fs";
|
|
195965
|
+
import path32 from "node:path";
|
|
195903
195966
|
var setupGithubActions = (projectDir = process.cwd()) => {
|
|
195904
195967
|
const findGitRoot = (startDir) => {
|
|
195905
|
-
let dir =
|
|
195906
|
-
while (dir !==
|
|
195907
|
-
if (
|
|
195968
|
+
let dir = path32.resolve(startDir);
|
|
195969
|
+
while (dir !== path32.parse(dir).root) {
|
|
195970
|
+
if (fs34.existsSync(path32.join(dir, ".git"))) {
|
|
195908
195971
|
return dir;
|
|
195909
195972
|
}
|
|
195910
|
-
dir =
|
|
195973
|
+
dir = path32.dirname(dir);
|
|
195911
195974
|
}
|
|
195912
195975
|
return null;
|
|
195913
195976
|
};
|
|
195914
195977
|
const gitRoot = findGitRoot(projectDir) ?? projectDir;
|
|
195915
|
-
const workflowsDir =
|
|
195916
|
-
|
|
195978
|
+
const workflowsDir = path32.join(gitRoot, ".github", "workflows");
|
|
195979
|
+
fs34.mkdirSync(workflowsDir, { recursive: true });
|
|
195917
195980
|
const buildWorkflow = `name: tscircuit Build
|
|
195918
195981
|
|
|
195919
195982
|
on:
|
|
@@ -195952,8 +196015,8 @@ jobs:
|
|
|
195952
196015
|
- run: bun install
|
|
195953
196016
|
- run: bunx tsci snapshot
|
|
195954
196017
|
`;
|
|
195955
|
-
writeFileIfNotExists(
|
|
195956
|
-
writeFileIfNotExists(
|
|
196018
|
+
writeFileIfNotExists(path32.join(workflowsDir, "tscircuit-build.yml"), buildWorkflow);
|
|
196019
|
+
writeFileIfNotExists(path32.join(workflowsDir, "tscircuit-snapshot.yml"), snapshotWorkflow);
|
|
195957
196020
|
};
|
|
195958
196021
|
|
|
195959
196022
|
// cli/setup/register.ts
|
|
@@ -195979,8 +196042,8 @@ var registerSetup = (program3) => {
|
|
|
195979
196042
|
};
|
|
195980
196043
|
|
|
195981
196044
|
// cli/convert/register.ts
|
|
195982
|
-
import
|
|
195983
|
-
import
|
|
196045
|
+
import fs35 from "node:fs/promises";
|
|
196046
|
+
import path33 from "node:path";
|
|
195984
196047
|
import { parseKicadModToCircuitJson } from "kicad-component-converter";
|
|
195985
196048
|
|
|
195986
196049
|
// node_modules/@tscircuit/mm/dist/index.js
|
|
@@ -196100,15 +196163,15 @@ var convertCircuitJsonToTscircuit = (circuitJson, opts) => {
|
|
|
196100
196163
|
var registerConvert = (program3) => {
|
|
196101
196164
|
program3.command("convert").description("Convert a .kicad_mod footprint to a tscircuit component").argument("<file>", "Path to the .kicad_mod file").option("-o, --output <path>", "Output TSX file path").option("-n, --name <component>", "Component name for export").action(async (file, options) => {
|
|
196102
196165
|
try {
|
|
196103
|
-
const inputPath =
|
|
196104
|
-
const modContent = await
|
|
196166
|
+
const inputPath = path33.resolve(file);
|
|
196167
|
+
const modContent = await fs35.readFile(inputPath, "utf-8");
|
|
196105
196168
|
const circuitJson = await parseKicadModToCircuitJson(modContent);
|
|
196106
|
-
const componentName = options.name ??
|
|
196169
|
+
const componentName = options.name ?? path33.basename(inputPath, ".kicad_mod");
|
|
196107
196170
|
const tsx = convertCircuitJsonToTscircuit(circuitJson, {
|
|
196108
196171
|
componentName
|
|
196109
196172
|
});
|
|
196110
|
-
const outputPath = options.output ?
|
|
196111
|
-
await
|
|
196173
|
+
const outputPath = options.output ? path33.resolve(options.output) : path33.join(path33.dirname(inputPath), `${componentName}.tsx`);
|
|
196174
|
+
await fs35.writeFile(outputPath, tsx);
|
|
196112
196175
|
console.log(kleur_default.green(`Converted ${outputPath}`));
|
|
196113
196176
|
} catch (error) {
|
|
196114
196177
|
console.error(kleur_default.red("Failed to convert footprint:"), error instanceof Error ? error.message : error);
|