@tscircuit/core 0.0.789 → 0.0.790
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +31 -22
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4387,6 +4387,30 @@ var getFileExtension = (filename) => {
|
|
|
4387
4387
|
return extension?.toLowerCase() ?? null;
|
|
4388
4388
|
};
|
|
4389
4389
|
|
|
4390
|
+
// lib/utils/constructAssetUrl.ts
|
|
4391
|
+
var joinUrlPath = (base, path) => {
|
|
4392
|
+
const trimmedBase = base.replace(/\/+$/, "");
|
|
4393
|
+
const trimmedPath = path.replace(/^\/+/, "");
|
|
4394
|
+
return `${trimmedBase}/${trimmedPath}`;
|
|
4395
|
+
};
|
|
4396
|
+
var constructAssetUrl = (targetUrl, baseUrl) => {
|
|
4397
|
+
if (!baseUrl) {
|
|
4398
|
+
return targetUrl;
|
|
4399
|
+
}
|
|
4400
|
+
if (!targetUrl.startsWith("/")) {
|
|
4401
|
+
return targetUrl;
|
|
4402
|
+
}
|
|
4403
|
+
try {
|
|
4404
|
+
const baseUrlObj = new URL(baseUrl);
|
|
4405
|
+
if (baseUrlObj.pathname !== "/" && targetUrl.startsWith(baseUrlObj.pathname)) {
|
|
4406
|
+
return new URL(targetUrl, baseUrlObj.origin).toString();
|
|
4407
|
+
}
|
|
4408
|
+
return joinUrlPath(baseUrl, targetUrl);
|
|
4409
|
+
} catch (error) {
|
|
4410
|
+
return targetUrl;
|
|
4411
|
+
}
|
|
4412
|
+
};
|
|
4413
|
+
|
|
4390
4414
|
// lib/components/primitive-components/CadModel.ts
|
|
4391
4415
|
var rotation = z7.union([z7.number(), z7.string()]);
|
|
4392
4416
|
var rotation3 = z7.object({ x: rotation, y: rotation, z: rotation });
|
|
@@ -4466,9 +4490,13 @@ var CadModel = class extends PrimitiveComponent2 {
|
|
|
4466
4490
|
return p;
|
|
4467
4491
|
}
|
|
4468
4492
|
_addCachebustToModelUrl(url) {
|
|
4469
|
-
if (!url
|
|
4493
|
+
if (!url) return url;
|
|
4494
|
+
const baseUrl = this.root?.platform?.projectBaseUrl;
|
|
4495
|
+
const transformedUrl = constructAssetUrl(url, baseUrl);
|
|
4496
|
+
if (!transformedUrl.includes("modelcdn.tscircuit.com"))
|
|
4497
|
+
return transformedUrl;
|
|
4470
4498
|
const origin = this.root?.getClientOrigin() ?? "";
|
|
4471
|
-
return `${
|
|
4499
|
+
return `${transformedUrl}${transformedUrl.includes("?") ? "&" : "?"}cachebust_origin=${encodeURIComponent(origin)}`;
|
|
4472
4500
|
}
|
|
4473
4501
|
};
|
|
4474
4502
|
|
|
@@ -7071,25 +7099,6 @@ import {
|
|
|
7071
7099
|
circuit_json_footprint_load_error,
|
|
7072
7100
|
external_footprint_load_error
|
|
7073
7101
|
} from "circuit-json";
|
|
7074
|
-
|
|
7075
|
-
// lib/utils/constructAssetUrl.ts
|
|
7076
|
-
var constructAssetUrl = (targetUrl, baseUrl) => {
|
|
7077
|
-
if (!baseUrl) {
|
|
7078
|
-
return targetUrl;
|
|
7079
|
-
}
|
|
7080
|
-
if (!targetUrl.startsWith("/")) {
|
|
7081
|
-
return targetUrl;
|
|
7082
|
-
}
|
|
7083
|
-
try {
|
|
7084
|
-
const base = new URL(baseUrl);
|
|
7085
|
-
const resolved = new URL(targetUrl, base.origin);
|
|
7086
|
-
return resolved.toString();
|
|
7087
|
-
} catch (error) {
|
|
7088
|
-
return targetUrl;
|
|
7089
|
-
}
|
|
7090
|
-
};
|
|
7091
|
-
|
|
7092
|
-
// lib/components/base-components/NormalComponent/NormalComponent_doInitialPcbFootprintStringRender.ts
|
|
7093
7102
|
function NormalComponent_doInitialPcbFootprintStringRender(component, queueAsyncEffect) {
|
|
7094
7103
|
let { footprint } = component.props;
|
|
7095
7104
|
footprint ??= component._getImpliedFootprintString?.();
|
|
@@ -16696,7 +16705,7 @@ import { identity as identity6 } from "transformation-matrix";
|
|
|
16696
16705
|
var package_default = {
|
|
16697
16706
|
name: "@tscircuit/core",
|
|
16698
16707
|
type: "module",
|
|
16699
|
-
version: "0.0.
|
|
16708
|
+
version: "0.0.789",
|
|
16700
16709
|
types: "dist/index.d.ts",
|
|
16701
16710
|
main: "dist/index.js",
|
|
16702
16711
|
module: "dist/index.js",
|