@tscircuit/runframe 0.0.1615 → 0.0.1617

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.
@@ -1730,7 +1730,7 @@ var useErrorTelemetry = ({
1730
1730
  };
1731
1731
 
1732
1732
  // package.json
1733
- var version = "0.0.1614";
1733
+ var version = "0.0.1616";
1734
1734
  var package_default = {
1735
1735
  name: "@tscircuit/runframe",
1736
1736
  main: "dist/preview.js",
@@ -3803,6 +3803,17 @@ var exportLbrn = async ({
3803
3803
  }
3804
3804
  };
3805
3805
 
3806
+ // lib/utils/sanitizeFileName.ts
3807
+ var sanitizeFileName = (name) => {
3808
+ let sanitized = name.trim().replace(/[\\/:*?"<>|]/g, "_").replace(/[\x00-\x1f]/g, "").replace(/^\.+/, "").replace(/\.+$/, "").replace(/\s+/g, " ").replace(/_+/g, "_");
3809
+ const reserved = /^(con|prn|aux|nul|com[0-9]|lpt[0-9])$/i;
3810
+ if (reserved.test(sanitized)) {
3811
+ sanitized = `_${sanitized}`;
3812
+ }
3813
+ sanitized = sanitized.slice(0, 200);
3814
+ return sanitized || "untitled";
3815
+ };
3816
+
3806
3817
  // lib/optional-features/exporting/export-and-download.ts
3807
3818
  var availableExports = [
3808
3819
  { extension: "json", name: "Circuit JSON" },
@@ -3821,8 +3832,9 @@ var availableExports = [
3821
3832
  var exportAndDownload = async ({
3822
3833
  exportName,
3823
3834
  circuitJson,
3824
- projectName
3835
+ projectName: rawProjectName
3825
3836
  }) => {
3837
+ const projectName = sanitizeFileName(rawProjectName);
3826
3838
  if (exportName === "Fabrication Files") {
3827
3839
  exportFabricationFiles({ circuitJson, projectName });
3828
3840
  return;
@@ -5209,7 +5221,10 @@ var FileMenuLeftHeader = (props) => {
5209
5221
  exportAndDownload({
5210
5222
  exportName: exp.name,
5211
5223
  circuitJson,
5212
- projectName
5224
+ projectName: projectName?.replace(
5225
+ /\.(board|circuit)$/,
5226
+ ""
5227
+ )
5213
5228
  });
5214
5229
  },
5215
5230
  disabled: isExporting,
package/dist/preview.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  linkify,
9
9
  useOrderDialog,
10
10
  useOrderDialogCli
11
- } from "./chunk-2VAVACE5.js";
11
+ } from "./chunk-MAZDFHZX.js";
12
12
  export {
13
13
  BomTable,
14
14
  CadViewer,
package/dist/runner.js CHANGED
@@ -34,7 +34,7 @@ import {
34
34
  useRunFrameStore,
35
35
  useRunnerStore,
36
36
  useStyles
37
- } from "./chunk-2VAVACE5.js";
37
+ } from "./chunk-MAZDFHZX.js";
38
38
 
39
39
  // lib/components/RunFrame/RunFrame.tsx
40
40
  import { createCircuitWebWorker } from "@tscircuit/eval/worker";