@tscircuit/3d-viewer 0.0.299 → 0.0.301
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 +11 -10
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -16962,14 +16962,15 @@ function useGlobalObjLoader(url) {
|
|
|
16962
16962
|
const [obj, setObj] = useState(null);
|
|
16963
16963
|
useEffect(() => {
|
|
16964
16964
|
if (!url) return;
|
|
16965
|
+
const cleanUrl = url.replace(/&cachebust_origin=$/, "");
|
|
16965
16966
|
const cache = window.TSCIRCUIT_OBJ_LOADER_CACHE;
|
|
16966
16967
|
let hasUrlChanged = false;
|
|
16967
16968
|
async function loadAndParseObj() {
|
|
16968
16969
|
try {
|
|
16969
|
-
const response = await fetch(
|
|
16970
|
+
const response = await fetch(cleanUrl);
|
|
16970
16971
|
if (!response.ok) {
|
|
16971
16972
|
throw new Error(
|
|
16972
|
-
`Failed to fetch "${
|
|
16973
|
+
`Failed to fetch "${cleanUrl}": ${response.status} ${response.statusText}`
|
|
16973
16974
|
);
|
|
16974
16975
|
}
|
|
16975
16976
|
const text = await response.text();
|
|
@@ -16994,8 +16995,8 @@ function useGlobalObjLoader(url) {
|
|
|
16994
16995
|
}
|
|
16995
16996
|
}
|
|
16996
16997
|
function loadUrl() {
|
|
16997
|
-
if (cache.has(
|
|
16998
|
-
const cacheItem = cache.get(
|
|
16998
|
+
if (cache.has(cleanUrl)) {
|
|
16999
|
+
const cacheItem = cache.get(cleanUrl);
|
|
16999
17000
|
if (cacheItem.result) {
|
|
17000
17001
|
return Promise.resolve(cacheItem.result.clone());
|
|
17001
17002
|
}
|
|
@@ -17008,10 +17009,10 @@ function useGlobalObjLoader(url) {
|
|
|
17008
17009
|
if (result instanceof Error) {
|
|
17009
17010
|
return result;
|
|
17010
17011
|
}
|
|
17011
|
-
cache.set(
|
|
17012
|
+
cache.set(cleanUrl, { ...cache.get(cleanUrl), result });
|
|
17012
17013
|
return result;
|
|
17013
17014
|
});
|
|
17014
|
-
cache.set(
|
|
17015
|
+
cache.set(cleanUrl, { promise, result: null });
|
|
17015
17016
|
return promise;
|
|
17016
17017
|
}
|
|
17017
17018
|
loadUrl().then((result) => {
|
|
@@ -17250,7 +17251,7 @@ var AnyCadComponent = ({
|
|
|
17250
17251
|
position: hoverPosition,
|
|
17251
17252
|
style: {
|
|
17252
17253
|
fontFamily: "sans-serif",
|
|
17253
|
-
transform: "translate3d(
|
|
17254
|
+
transform: "translate3d(1rem, 1rem, 0)",
|
|
17254
17255
|
backgroundColor: "white",
|
|
17255
17256
|
padding: "5px",
|
|
17256
17257
|
borderRadius: "3px",
|
|
@@ -17278,7 +17279,7 @@ import {
|
|
|
17278
17279
|
// package.json
|
|
17279
17280
|
var package_default = {
|
|
17280
17281
|
name: "@tscircuit/3d-viewer",
|
|
17281
|
-
version: "0.0.
|
|
17282
|
+
version: "0.0.300",
|
|
17282
17283
|
main: "./dist/index.js",
|
|
17283
17284
|
module: "./dist/index.js",
|
|
17284
17285
|
type: "module",
|
|
@@ -17310,7 +17311,7 @@ var package_default = {
|
|
|
17310
17311
|
"@react-three/drei": "^9.121.4",
|
|
17311
17312
|
"@react-three/fiber": "^8.17.14",
|
|
17312
17313
|
"@tscircuit/core": "^0.0.454",
|
|
17313
|
-
"@tscircuit/props": "^0.0.
|
|
17314
|
+
"@tscircuit/props": "^0.0.252",
|
|
17314
17315
|
"@tscircuit/soup-util": "^0.0.41",
|
|
17315
17316
|
"jscad-electronics": "^0.0.29",
|
|
17316
17317
|
"jscad-fiber": "^0.0.79",
|
|
@@ -18909,7 +18910,7 @@ var Error3d = ({
|
|
|
18909
18910
|
position: hoverPosition,
|
|
18910
18911
|
style: {
|
|
18911
18912
|
fontFamily: "sans-serif",
|
|
18912
|
-
transform: "translate3d(
|
|
18913
|
+
transform: "translate3d(1rem, 1rem, 0)",
|
|
18913
18914
|
backgroundColor: "white",
|
|
18914
18915
|
padding: "6px",
|
|
18915
18916
|
borderRadius: "4px",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/3d-viewer",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.301",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@react-three/drei": "^9.121.4",
|
|
33
33
|
"@react-three/fiber": "^8.17.14",
|
|
34
34
|
"@tscircuit/core": "^0.0.454",
|
|
35
|
-
"@tscircuit/props": "^0.0.
|
|
35
|
+
"@tscircuit/props": "^0.0.252",
|
|
36
36
|
"@tscircuit/soup-util": "^0.0.41",
|
|
37
37
|
"jscad-electronics": "^0.0.29",
|
|
38
38
|
"jscad-fiber": "^0.0.79",
|