@tscircuit/3d-viewer 0.0.116 → 0.0.117
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 +10 -316
- package/package.json +5 -4
package/dist/index.js
CHANGED
|
@@ -4,13 +4,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var
|
|
8
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
9
|
-
}) : x)(function(x) {
|
|
10
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
12
|
-
});
|
|
13
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
7
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
14
8
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
15
9
|
};
|
|
16
10
|
var __copyProps = (to, from, except, desc) => {
|
|
@@ -13985,308 +13979,6 @@ var require_browser = __commonJS({
|
|
|
13985
13979
|
}
|
|
13986
13980
|
});
|
|
13987
13981
|
|
|
13988
|
-
// node_modules/has-flag/index.js
|
|
13989
|
-
var require_has_flag = __commonJS({
|
|
13990
|
-
"node_modules/has-flag/index.js"(exports, module) {
|
|
13991
|
-
"use strict";
|
|
13992
|
-
module.exports = (flag, argv = process.argv) => {
|
|
13993
|
-
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
13994
|
-
const position = argv.indexOf(prefix + flag);
|
|
13995
|
-
const terminatorPosition = argv.indexOf("--");
|
|
13996
|
-
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
13997
|
-
};
|
|
13998
|
-
}
|
|
13999
|
-
});
|
|
14000
|
-
|
|
14001
|
-
// node_modules/supports-color/index.js
|
|
14002
|
-
var require_supports_color = __commonJS({
|
|
14003
|
-
"node_modules/supports-color/index.js"(exports, module) {
|
|
14004
|
-
"use strict";
|
|
14005
|
-
var os = __require("os");
|
|
14006
|
-
var tty = __require("tty");
|
|
14007
|
-
var hasFlag = require_has_flag();
|
|
14008
|
-
var { env } = process;
|
|
14009
|
-
var forceColor;
|
|
14010
|
-
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
14011
|
-
forceColor = 0;
|
|
14012
|
-
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
14013
|
-
forceColor = 1;
|
|
14014
|
-
}
|
|
14015
|
-
if ("FORCE_COLOR" in env) {
|
|
14016
|
-
if (env.FORCE_COLOR === "true") {
|
|
14017
|
-
forceColor = 1;
|
|
14018
|
-
} else if (env.FORCE_COLOR === "false") {
|
|
14019
|
-
forceColor = 0;
|
|
14020
|
-
} else {
|
|
14021
|
-
forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
|
|
14022
|
-
}
|
|
14023
|
-
}
|
|
14024
|
-
function translateLevel(level) {
|
|
14025
|
-
if (level === 0) {
|
|
14026
|
-
return false;
|
|
14027
|
-
}
|
|
14028
|
-
return {
|
|
14029
|
-
level,
|
|
14030
|
-
hasBasic: true,
|
|
14031
|
-
has256: level >= 2,
|
|
14032
|
-
has16m: level >= 3
|
|
14033
|
-
};
|
|
14034
|
-
}
|
|
14035
|
-
function supportsColor(haveStream, streamIsTTY) {
|
|
14036
|
-
if (forceColor === 0) {
|
|
14037
|
-
return 0;
|
|
14038
|
-
}
|
|
14039
|
-
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
14040
|
-
return 3;
|
|
14041
|
-
}
|
|
14042
|
-
if (hasFlag("color=256")) {
|
|
14043
|
-
return 2;
|
|
14044
|
-
}
|
|
14045
|
-
if (haveStream && !streamIsTTY && forceColor === void 0) {
|
|
14046
|
-
return 0;
|
|
14047
|
-
}
|
|
14048
|
-
const min = forceColor || 0;
|
|
14049
|
-
if (env.TERM === "dumb") {
|
|
14050
|
-
return min;
|
|
14051
|
-
}
|
|
14052
|
-
if (process.platform === "win32") {
|
|
14053
|
-
const osRelease = os.release().split(".");
|
|
14054
|
-
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
14055
|
-
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
14056
|
-
}
|
|
14057
|
-
return 1;
|
|
14058
|
-
}
|
|
14059
|
-
if ("CI" in env) {
|
|
14060
|
-
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
|
14061
|
-
return 1;
|
|
14062
|
-
}
|
|
14063
|
-
return min;
|
|
14064
|
-
}
|
|
14065
|
-
if ("TEAMCITY_VERSION" in env) {
|
|
14066
|
-
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
14067
|
-
}
|
|
14068
|
-
if (env.COLORTERM === "truecolor") {
|
|
14069
|
-
return 3;
|
|
14070
|
-
}
|
|
14071
|
-
if ("TERM_PROGRAM" in env) {
|
|
14072
|
-
const version2 = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
14073
|
-
switch (env.TERM_PROGRAM) {
|
|
14074
|
-
case "iTerm.app":
|
|
14075
|
-
return version2 >= 3 ? 3 : 2;
|
|
14076
|
-
case "Apple_Terminal":
|
|
14077
|
-
return 2;
|
|
14078
|
-
}
|
|
14079
|
-
}
|
|
14080
|
-
if (/-256(color)?$/i.test(env.TERM)) {
|
|
14081
|
-
return 2;
|
|
14082
|
-
}
|
|
14083
|
-
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
14084
|
-
return 1;
|
|
14085
|
-
}
|
|
14086
|
-
if ("COLORTERM" in env) {
|
|
14087
|
-
return 1;
|
|
14088
|
-
}
|
|
14089
|
-
return min;
|
|
14090
|
-
}
|
|
14091
|
-
function getSupportLevel(stream) {
|
|
14092
|
-
const level = supportsColor(stream, stream && stream.isTTY);
|
|
14093
|
-
return translateLevel(level);
|
|
14094
|
-
}
|
|
14095
|
-
module.exports = {
|
|
14096
|
-
supportsColor: getSupportLevel,
|
|
14097
|
-
stdout: translateLevel(supportsColor(true, tty.isatty(1))),
|
|
14098
|
-
stderr: translateLevel(supportsColor(true, tty.isatty(2)))
|
|
14099
|
-
};
|
|
14100
|
-
}
|
|
14101
|
-
});
|
|
14102
|
-
|
|
14103
|
-
// node_modules/debug/src/node.js
|
|
14104
|
-
var require_node = __commonJS({
|
|
14105
|
-
"node_modules/debug/src/node.js"(exports, module) {
|
|
14106
|
-
"use strict";
|
|
14107
|
-
var tty = __require("tty");
|
|
14108
|
-
var util = __require("util");
|
|
14109
|
-
exports.init = init;
|
|
14110
|
-
exports.log = log2;
|
|
14111
|
-
exports.formatArgs = formatArgs;
|
|
14112
|
-
exports.save = save;
|
|
14113
|
-
exports.load = load;
|
|
14114
|
-
exports.useColors = useColors;
|
|
14115
|
-
exports.destroy = util.deprecate(
|
|
14116
|
-
() => {
|
|
14117
|
-
},
|
|
14118
|
-
"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."
|
|
14119
|
-
);
|
|
14120
|
-
exports.colors = [6, 2, 3, 4, 5, 1];
|
|
14121
|
-
try {
|
|
14122
|
-
const supportsColor = require_supports_color();
|
|
14123
|
-
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
|
14124
|
-
exports.colors = [
|
|
14125
|
-
20,
|
|
14126
|
-
21,
|
|
14127
|
-
26,
|
|
14128
|
-
27,
|
|
14129
|
-
32,
|
|
14130
|
-
33,
|
|
14131
|
-
38,
|
|
14132
|
-
39,
|
|
14133
|
-
40,
|
|
14134
|
-
41,
|
|
14135
|
-
42,
|
|
14136
|
-
43,
|
|
14137
|
-
44,
|
|
14138
|
-
45,
|
|
14139
|
-
56,
|
|
14140
|
-
57,
|
|
14141
|
-
62,
|
|
14142
|
-
63,
|
|
14143
|
-
68,
|
|
14144
|
-
69,
|
|
14145
|
-
74,
|
|
14146
|
-
75,
|
|
14147
|
-
76,
|
|
14148
|
-
77,
|
|
14149
|
-
78,
|
|
14150
|
-
79,
|
|
14151
|
-
80,
|
|
14152
|
-
81,
|
|
14153
|
-
92,
|
|
14154
|
-
93,
|
|
14155
|
-
98,
|
|
14156
|
-
99,
|
|
14157
|
-
112,
|
|
14158
|
-
113,
|
|
14159
|
-
128,
|
|
14160
|
-
129,
|
|
14161
|
-
134,
|
|
14162
|
-
135,
|
|
14163
|
-
148,
|
|
14164
|
-
149,
|
|
14165
|
-
160,
|
|
14166
|
-
161,
|
|
14167
|
-
162,
|
|
14168
|
-
163,
|
|
14169
|
-
164,
|
|
14170
|
-
165,
|
|
14171
|
-
166,
|
|
14172
|
-
167,
|
|
14173
|
-
168,
|
|
14174
|
-
169,
|
|
14175
|
-
170,
|
|
14176
|
-
171,
|
|
14177
|
-
172,
|
|
14178
|
-
173,
|
|
14179
|
-
178,
|
|
14180
|
-
179,
|
|
14181
|
-
184,
|
|
14182
|
-
185,
|
|
14183
|
-
196,
|
|
14184
|
-
197,
|
|
14185
|
-
198,
|
|
14186
|
-
199,
|
|
14187
|
-
200,
|
|
14188
|
-
201,
|
|
14189
|
-
202,
|
|
14190
|
-
203,
|
|
14191
|
-
204,
|
|
14192
|
-
205,
|
|
14193
|
-
206,
|
|
14194
|
-
207,
|
|
14195
|
-
208,
|
|
14196
|
-
209,
|
|
14197
|
-
214,
|
|
14198
|
-
215,
|
|
14199
|
-
220,
|
|
14200
|
-
221
|
|
14201
|
-
];
|
|
14202
|
-
}
|
|
14203
|
-
} catch (error) {
|
|
14204
|
-
}
|
|
14205
|
-
exports.inspectOpts = Object.keys(process.env).filter((key) => {
|
|
14206
|
-
return /^debug_/i.test(key);
|
|
14207
|
-
}).reduce((obj, key) => {
|
|
14208
|
-
const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
|
|
14209
|
-
return k.toUpperCase();
|
|
14210
|
-
});
|
|
14211
|
-
let val = process.env[key];
|
|
14212
|
-
if (/^(yes|on|true|enabled)$/i.test(val)) {
|
|
14213
|
-
val = true;
|
|
14214
|
-
} else if (/^(no|off|false|disabled)$/i.test(val)) {
|
|
14215
|
-
val = false;
|
|
14216
|
-
} else if (val === "null") {
|
|
14217
|
-
val = null;
|
|
14218
|
-
} else {
|
|
14219
|
-
val = Number(val);
|
|
14220
|
-
}
|
|
14221
|
-
obj[prop] = val;
|
|
14222
|
-
return obj;
|
|
14223
|
-
}, {});
|
|
14224
|
-
function useColors() {
|
|
14225
|
-
return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
|
|
14226
|
-
}
|
|
14227
|
-
function formatArgs(args) {
|
|
14228
|
-
const { namespace: name, useColors: useColors2 } = this;
|
|
14229
|
-
if (useColors2) {
|
|
14230
|
-
const c = this.color;
|
|
14231
|
-
const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
|
|
14232
|
-
const prefix = ` ${colorCode};1m${name} \x1B[0m`;
|
|
14233
|
-
args[0] = prefix + args[0].split("\n").join("\n" + prefix);
|
|
14234
|
-
args.push(colorCode + "m+" + module.exports.humanize(this.diff) + "\x1B[0m");
|
|
14235
|
-
} else {
|
|
14236
|
-
args[0] = getDate() + name + " " + args[0];
|
|
14237
|
-
}
|
|
14238
|
-
}
|
|
14239
|
-
function getDate() {
|
|
14240
|
-
if (exports.inspectOpts.hideDate) {
|
|
14241
|
-
return "";
|
|
14242
|
-
}
|
|
14243
|
-
return (/* @__PURE__ */ new Date()).toISOString() + " ";
|
|
14244
|
-
}
|
|
14245
|
-
function log2(...args) {
|
|
14246
|
-
return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + "\n");
|
|
14247
|
-
}
|
|
14248
|
-
function save(namespaces) {
|
|
14249
|
-
if (namespaces) {
|
|
14250
|
-
process.env.DEBUG = namespaces;
|
|
14251
|
-
} else {
|
|
14252
|
-
delete process.env.DEBUG;
|
|
14253
|
-
}
|
|
14254
|
-
}
|
|
14255
|
-
function load() {
|
|
14256
|
-
return process.env.DEBUG;
|
|
14257
|
-
}
|
|
14258
|
-
function init(debug) {
|
|
14259
|
-
debug.inspectOpts = {};
|
|
14260
|
-
const keys = Object.keys(exports.inspectOpts);
|
|
14261
|
-
for (let i = 0; i < keys.length; i++) {
|
|
14262
|
-
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
|
14263
|
-
}
|
|
14264
|
-
}
|
|
14265
|
-
module.exports = require_common()(exports);
|
|
14266
|
-
var { formatters } = module.exports;
|
|
14267
|
-
formatters.o = function(v) {
|
|
14268
|
-
this.inspectOpts.colors = this.useColors;
|
|
14269
|
-
return util.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
|
|
14270
|
-
};
|
|
14271
|
-
formatters.O = function(v) {
|
|
14272
|
-
this.inspectOpts.colors = this.useColors;
|
|
14273
|
-
return util.inspect(v, this.inspectOpts);
|
|
14274
|
-
};
|
|
14275
|
-
}
|
|
14276
|
-
});
|
|
14277
|
-
|
|
14278
|
-
// node_modules/debug/src/index.js
|
|
14279
|
-
var require_src2 = __commonJS({
|
|
14280
|
-
"node_modules/debug/src/index.js"(exports, module) {
|
|
14281
|
-
"use strict";
|
|
14282
|
-
if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
|
|
14283
|
-
module.exports = require_browser();
|
|
14284
|
-
} else {
|
|
14285
|
-
module.exports = require_node();
|
|
14286
|
-
}
|
|
14287
|
-
}
|
|
14288
|
-
});
|
|
14289
|
-
|
|
14290
13982
|
// src/hooks/use-convert-children-to-soup.ts
|
|
14291
13983
|
import { Circuit } from "@tscircuit/core";
|
|
14292
13984
|
import { useMemo } from "react";
|
|
@@ -17715,7 +17407,7 @@ import { Canvas, useFrame as useFrame2 } from "@react-three/fiber";
|
|
|
17715
17407
|
// package.json
|
|
17716
17408
|
var package_default = {
|
|
17717
17409
|
name: "@tscircuit/3d-viewer",
|
|
17718
|
-
version: "0.0.
|
|
17410
|
+
version: "0.0.116",
|
|
17719
17411
|
main: "./dist/index.js",
|
|
17720
17412
|
module: "./dist/index.js",
|
|
17721
17413
|
type: "module",
|
|
@@ -17731,14 +17423,15 @@ var package_default = {
|
|
|
17731
17423
|
scripts: {
|
|
17732
17424
|
start: "bun run storybook",
|
|
17733
17425
|
"dev:old": "bunx --bun vite",
|
|
17734
|
-
build: "tsup ./src/index.tsx --format esm --dts",
|
|
17426
|
+
build: "tsup ./src/index.tsx --platform neutral --format esm --dts",
|
|
17735
17427
|
prepublish: "npm run build",
|
|
17736
17428
|
preview: "vite preview",
|
|
17737
17429
|
storybook: "storybook dev -p 6006",
|
|
17738
17430
|
"build-storybook": "storybook build",
|
|
17739
17431
|
"vercel-build": "bun run build-storybook",
|
|
17740
17432
|
format: "biome format . --write",
|
|
17741
|
-
"format:check": "biome format ."
|
|
17433
|
+
"format:check": "biome format .",
|
|
17434
|
+
"test:node-bundle": "node ./scripts/load-bundle-in-node.js"
|
|
17742
17435
|
},
|
|
17743
17436
|
dependencies: {
|
|
17744
17437
|
"@jscad/regl-renderer": "^2.6.12",
|
|
@@ -17751,7 +17444,7 @@ var package_default = {
|
|
|
17751
17444
|
"@tscircuit/soup": "^0.0.69",
|
|
17752
17445
|
"@tscircuit/soup-util": "^0.0.26",
|
|
17753
17446
|
"jscad-electronics": "^0.0.23",
|
|
17754
|
-
"jscad-fiber": "^0.0.
|
|
17447
|
+
"jscad-fiber": "^0.0.77",
|
|
17755
17448
|
"jscad-planner": "^0.0.11",
|
|
17756
17449
|
react: "^18.3.1",
|
|
17757
17450
|
"react-dom": "^18.3.1",
|
|
@@ -18141,7 +17834,7 @@ function MixedStlModel({
|
|
|
18141
17834
|
// src/three-components/JscadModel.tsx
|
|
18142
17835
|
var import_modeling = __toESM(require_src(), 1);
|
|
18143
17836
|
import { executeJscadOperations } from "jscad-planner";
|
|
18144
|
-
import { convertCSGToThreeGeom } from "jscad-fiber";
|
|
17837
|
+
import { convertCSGToThreeGeom } from "jscad-fiber/three";
|
|
18145
17838
|
import * as THREE3 from "three";
|
|
18146
17839
|
import { useMemo as useMemo2 } from "react";
|
|
18147
17840
|
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
@@ -18436,7 +18129,7 @@ var CadViewer = forwardRef2(({ soup, children, autoRotateDisabled }, ref) => {
|
|
|
18436
18129
|
});
|
|
18437
18130
|
|
|
18438
18131
|
// src/convert-circuit-json-to-3d-svg.ts
|
|
18439
|
-
var import_debug = __toESM(
|
|
18132
|
+
var import_debug = __toESM(require_browser(), 1);
|
|
18440
18133
|
import { su as su3 } from "@tscircuit/soup-util";
|
|
18441
18134
|
import * as THREE7 from "three";
|
|
18442
18135
|
import { SVGRenderer } from "three/examples/jsm/renderers/SVGRenderer.js";
|
|
@@ -18484,7 +18177,8 @@ function createGeometryFromPolygons(polygons) {
|
|
|
18484
18177
|
// src/utils/render-component.tsx
|
|
18485
18178
|
var import_modeling2 = __toESM(require_src(), 1);
|
|
18486
18179
|
import { Footprinter3d as Footprinter3d2 } from "jscad-electronics";
|
|
18487
|
-
import { convertCSGToThreeGeom as convertCSGToThreeGeom2
|
|
18180
|
+
import { convertCSGToThreeGeom as convertCSGToThreeGeom2 } from "jscad-fiber/three";
|
|
18181
|
+
import { createJSCADRenderer as createJSCADRenderer2 } from "jscad-fiber";
|
|
18488
18182
|
import { executeJscadOperations as executeJscadOperations2, jscadPlanner as jscadPlanner2 } from "jscad-planner";
|
|
18489
18183
|
import * as THREE6 from "three";
|
|
18490
18184
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/3d-viewer",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.117",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -16,14 +16,15 @@
|
|
|
16
16
|
"scripts": {
|
|
17
17
|
"start": "bun run storybook",
|
|
18
18
|
"dev:old": "bunx --bun vite",
|
|
19
|
-
"build": "tsup ./src/index.tsx --format esm --dts",
|
|
19
|
+
"build": "tsup ./src/index.tsx --platform neutral --format esm --dts",
|
|
20
20
|
"prepublish": "npm run build",
|
|
21
21
|
"preview": "vite preview",
|
|
22
22
|
"storybook": "storybook dev -p 6006",
|
|
23
23
|
"build-storybook": "storybook build",
|
|
24
24
|
"vercel-build": "bun run build-storybook",
|
|
25
25
|
"format": "biome format . --write",
|
|
26
|
-
"format:check": "biome format ."
|
|
26
|
+
"format:check": "biome format .",
|
|
27
|
+
"test:node-bundle": "node ./scripts/load-bundle-in-node.js"
|
|
27
28
|
},
|
|
28
29
|
"dependencies": {
|
|
29
30
|
"@jscad/regl-renderer": "^2.6.12",
|
|
@@ -36,7 +37,7 @@
|
|
|
36
37
|
"@tscircuit/soup": "^0.0.69",
|
|
37
38
|
"@tscircuit/soup-util": "^0.0.26",
|
|
38
39
|
"jscad-electronics": "^0.0.23",
|
|
39
|
-
"jscad-fiber": "^0.0.
|
|
40
|
+
"jscad-fiber": "^0.0.77",
|
|
40
41
|
"jscad-planner": "^0.0.11",
|
|
41
42
|
"react": "^18.3.1",
|
|
42
43
|
"react-dom": "^18.3.1",
|