@tscircuit/3d-viewer 0.0.566 → 0.0.567
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 +740 -408
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -14432,8 +14432,8 @@ var require_browser = __commonJS({
|
|
|
14432
14432
|
});
|
|
14433
14433
|
|
|
14434
14434
|
// src/CadViewer.tsx
|
|
14435
|
-
import { useState as
|
|
14436
|
-
import * as
|
|
14435
|
+
import { useState as useState37, useCallback as useCallback23, useRef as useRef28, useEffect as useEffect47 } from "react";
|
|
14436
|
+
import * as THREE44 from "three";
|
|
14437
14437
|
|
|
14438
14438
|
// src/CadViewerJscad.tsx
|
|
14439
14439
|
import { su as su11 } from "@tscircuit/circuit-json-util";
|
|
@@ -32321,7 +32321,7 @@ import * as THREE20 from "three";
|
|
|
32321
32321
|
// package.json
|
|
32322
32322
|
var package_default = {
|
|
32323
32323
|
name: "@tscircuit/3d-viewer",
|
|
32324
|
-
version: "0.0.
|
|
32324
|
+
version: "0.0.566",
|
|
32325
32325
|
main: "./dist/index.js",
|
|
32326
32326
|
module: "./dist/index.js",
|
|
32327
32327
|
type: "module",
|
|
@@ -32351,7 +32351,7 @@ var package_default = {
|
|
|
32351
32351
|
"@jscad/regl-renderer": "^2.6.12",
|
|
32352
32352
|
"@jscad/stl-serializer": "^2.1.20",
|
|
32353
32353
|
"circuit-json": "^0.0.421",
|
|
32354
|
-
"circuit-to-canvas": "^0.0.
|
|
32354
|
+
"circuit-to-canvas": "^0.0.110",
|
|
32355
32355
|
"react-hot-toast": "^2.6.0",
|
|
32356
32356
|
three: "^0.165.0",
|
|
32357
32357
|
"three-stdlib": "^2.36.0",
|
|
@@ -35150,7 +35150,7 @@ import { su as su8 } from "@tscircuit/circuit-json-util";
|
|
|
35150
35150
|
import { useEffect as useEffect24, useMemo as useMemo19 } from "react";
|
|
35151
35151
|
|
|
35152
35152
|
// src/textures/create-combined-board-textures.ts
|
|
35153
|
-
import * as
|
|
35153
|
+
import * as THREE34 from "three";
|
|
35154
35154
|
|
|
35155
35155
|
// node_modules/@tscircuit/math-utils/dist/chunk-5N7UJNVK.js
|
|
35156
35156
|
var getBoundsFromPoints = (points) => {
|
|
@@ -35255,7 +35255,7 @@ function createPadTextureForLayer({
|
|
|
35255
35255
|
drill: transparent,
|
|
35256
35256
|
boardOutline: transparent,
|
|
35257
35257
|
substrate: transparent,
|
|
35258
|
-
keepout: transparent,
|
|
35258
|
+
keepout: { top: transparent, bottom: transparent },
|
|
35259
35259
|
fabricationNote: transparent,
|
|
35260
35260
|
courtyard: { top: transparent, bottom: transparent },
|
|
35261
35261
|
silkscreen: { top: transparent, bottom: transparent },
|
|
@@ -35461,7 +35461,7 @@ function createTraceTextureForLayer({
|
|
|
35461
35461
|
drill: transparent,
|
|
35462
35462
|
boardOutline: transparent,
|
|
35463
35463
|
substrate: transparent,
|
|
35464
|
-
keepout: transparent,
|
|
35464
|
+
keepout: { top: transparent, bottom: transparent },
|
|
35465
35465
|
fabricationNote: transparent,
|
|
35466
35466
|
courtyard: { top: transparent, bottom: transparent },
|
|
35467
35467
|
silkscreen: { top: transparent, bottom: transparent },
|
|
@@ -35693,7 +35693,7 @@ function createCopperPourTextureForLayer({
|
|
|
35693
35693
|
drill: transparent,
|
|
35694
35694
|
boardOutline: transparent,
|
|
35695
35695
|
substrate: transparent,
|
|
35696
|
-
keepout: transparent,
|
|
35696
|
+
keepout: { top: transparent, bottom: transparent },
|
|
35697
35697
|
fabricationNote: transparent,
|
|
35698
35698
|
courtyard: { top: transparent, bottom: transparent },
|
|
35699
35699
|
silkscreen: { top: transparent, bottom: transparent },
|
|
@@ -35868,7 +35868,7 @@ var drawFabricationNoteLayer = ({
|
|
|
35868
35868
|
drill: TRANSPARENT,
|
|
35869
35869
|
boardOutline: TRANSPARENT,
|
|
35870
35870
|
substrate: TRANSPARENT,
|
|
35871
|
-
keepout: TRANSPARENT,
|
|
35871
|
+
keepout: { top: TRANSPARENT, bottom: TRANSPARENT },
|
|
35872
35872
|
courtyard: {
|
|
35873
35873
|
top: TRANSPARENT,
|
|
35874
35874
|
bottom: TRANSPARENT
|
|
@@ -35984,12 +35984,11 @@ function createFabricationNoteTextureForLayer({
|
|
|
35984
35984
|
return texture;
|
|
35985
35985
|
}
|
|
35986
35986
|
|
|
35987
|
-
// src/textures/create-
|
|
35987
|
+
// src/textures/create-keepout-texture-for-layer.ts
|
|
35988
35988
|
import * as THREE29 from "three";
|
|
35989
35989
|
|
|
35990
|
-
// src/textures/
|
|
35990
|
+
// src/textures/keepout/keepout-drawing.ts
|
|
35991
35991
|
import { CircuitToCanvasDrawer as CircuitToCanvasDrawer6 } from "circuit-to-canvas";
|
|
35992
|
-
var TRANSPARENT2 = "rgba(0,0,0,0)";
|
|
35993
35992
|
var setDrawerBounds3 = (drawer, bounds) => {
|
|
35994
35993
|
drawer.setCameraBounds({
|
|
35995
35994
|
minX: bounds.minX,
|
|
@@ -35998,6 +35997,92 @@ var setDrawerBounds3 = (drawer, bounds) => {
|
|
|
35998
35997
|
maxY: bounds.maxY
|
|
35999
35998
|
});
|
|
36000
35999
|
};
|
|
36000
|
+
var drawKeepoutLayer = ({
|
|
36001
|
+
ctx,
|
|
36002
|
+
layer,
|
|
36003
|
+
bounds,
|
|
36004
|
+
elements,
|
|
36005
|
+
keepoutColor
|
|
36006
|
+
}) => {
|
|
36007
|
+
const renderLayer = layer === "top" ? "top_copper" : "bottom_copper";
|
|
36008
|
+
const drawer = new CircuitToCanvasDrawer6(ctx);
|
|
36009
|
+
drawer.configure({
|
|
36010
|
+
colorOverrides: {
|
|
36011
|
+
keepout: {
|
|
36012
|
+
top: keepoutColor,
|
|
36013
|
+
bottom: keepoutColor
|
|
36014
|
+
}
|
|
36015
|
+
}
|
|
36016
|
+
});
|
|
36017
|
+
setDrawerBounds3(drawer, bounds);
|
|
36018
|
+
drawer.drawElements(elements, {
|
|
36019
|
+
layers: [renderLayer],
|
|
36020
|
+
drawSoldermask: false,
|
|
36021
|
+
drawSoldermaskTop: false,
|
|
36022
|
+
drawSoldermaskBottom: false
|
|
36023
|
+
});
|
|
36024
|
+
};
|
|
36025
|
+
|
|
36026
|
+
// src/textures/create-keepout-texture-for-layer.ts
|
|
36027
|
+
var isKeepoutOnLayer = (element, layer) => {
|
|
36028
|
+
if (element.type !== "pcb_keepout") return false;
|
|
36029
|
+
if (!("layers" in element) || !Array.isArray(element.layers)) return true;
|
|
36030
|
+
return element.layers.includes(layer);
|
|
36031
|
+
};
|
|
36032
|
+
function createKeepoutTextureForLayer({
|
|
36033
|
+
layer,
|
|
36034
|
+
circuitJson,
|
|
36035
|
+
boardData,
|
|
36036
|
+
traceTextureResolution = TRACE_TEXTURE_RESOLUTION,
|
|
36037
|
+
keepoutColor = layer === "bottom" ? "#4b72d2" : "#d24b4b"
|
|
36038
|
+
}) {
|
|
36039
|
+
const elements = circuitJson.filter(
|
|
36040
|
+
(element) => isKeepoutOnLayer(element, layer)
|
|
36041
|
+
);
|
|
36042
|
+
if (elements.length === 0) return null;
|
|
36043
|
+
const bounds = calculateOutlineBounds(boardData);
|
|
36044
|
+
const canvasWidth = Math.floor(bounds.width * traceTextureResolution);
|
|
36045
|
+
const canvasHeight = Math.floor(bounds.height * traceTextureResolution);
|
|
36046
|
+
if (canvasWidth <= 0 || canvasHeight <= 0) return null;
|
|
36047
|
+
const canvas = document.createElement("canvas");
|
|
36048
|
+
canvas.width = canvasWidth;
|
|
36049
|
+
canvas.height = canvasHeight;
|
|
36050
|
+
const ctx = canvas.getContext("2d");
|
|
36051
|
+
if (!ctx) return null;
|
|
36052
|
+
if (layer === "bottom") {
|
|
36053
|
+
ctx.translate(0, canvasHeight);
|
|
36054
|
+
ctx.scale(1, -1);
|
|
36055
|
+
}
|
|
36056
|
+
drawKeepoutLayer({
|
|
36057
|
+
ctx,
|
|
36058
|
+
layer,
|
|
36059
|
+
bounds,
|
|
36060
|
+
elements,
|
|
36061
|
+
keepoutColor
|
|
36062
|
+
});
|
|
36063
|
+
const texture = new THREE29.CanvasTexture(canvas);
|
|
36064
|
+
texture.generateMipmaps = true;
|
|
36065
|
+
texture.minFilter = THREE29.LinearMipmapLinearFilter;
|
|
36066
|
+
texture.magFilter = THREE29.LinearFilter;
|
|
36067
|
+
texture.anisotropy = 16;
|
|
36068
|
+
texture.needsUpdate = true;
|
|
36069
|
+
return texture;
|
|
36070
|
+
}
|
|
36071
|
+
|
|
36072
|
+
// src/textures/create-pcb-note-texture-for-layer.ts
|
|
36073
|
+
import * as THREE30 from "three";
|
|
36074
|
+
|
|
36075
|
+
// src/textures/pcb-note/pcb-note-drawing.ts
|
|
36076
|
+
import { CircuitToCanvasDrawer as CircuitToCanvasDrawer7 } from "circuit-to-canvas";
|
|
36077
|
+
var TRANSPARENT2 = "rgba(0,0,0,0)";
|
|
36078
|
+
var setDrawerBounds4 = (drawer, bounds) => {
|
|
36079
|
+
drawer.setCameraBounds({
|
|
36080
|
+
minX: bounds.minX,
|
|
36081
|
+
maxX: bounds.maxX,
|
|
36082
|
+
minY: bounds.minY,
|
|
36083
|
+
maxY: bounds.maxY
|
|
36084
|
+
});
|
|
36085
|
+
};
|
|
36001
36086
|
var normalizePcbNoteElement = (element) => {
|
|
36002
36087
|
if (element.type === "pcb_note_line") {
|
|
36003
36088
|
return {
|
|
@@ -36067,7 +36152,7 @@ var drawPcbNoteLayer = ({
|
|
|
36067
36152
|
elements
|
|
36068
36153
|
}) => {
|
|
36069
36154
|
const normalizedElements = elements.map(normalizePcbNoteElement);
|
|
36070
|
-
const drawer = new
|
|
36155
|
+
const drawer = new CircuitToCanvasDrawer7(ctx);
|
|
36071
36156
|
drawer.configure({
|
|
36072
36157
|
colorOverrides: {
|
|
36073
36158
|
copper: {
|
|
@@ -36084,7 +36169,7 @@ var drawPcbNoteLayer = ({
|
|
|
36084
36169
|
drill: TRANSPARENT2,
|
|
36085
36170
|
boardOutline: TRANSPARENT2,
|
|
36086
36171
|
substrate: TRANSPARENT2,
|
|
36087
|
-
keepout: TRANSPARENT2,
|
|
36172
|
+
keepout: { top: TRANSPARENT2, bottom: TRANSPARENT2 },
|
|
36088
36173
|
courtyard: { top: TRANSPARENT2, bottom: TRANSPARENT2 },
|
|
36089
36174
|
soldermask: { top: TRANSPARENT2, bottom: TRANSPARENT2 },
|
|
36090
36175
|
soldermaskWithCopperUnderneath: {
|
|
@@ -36099,7 +36184,7 @@ var drawPcbNoteLayer = ({
|
|
|
36099
36184
|
fabricationNote: TRANSPARENT2
|
|
36100
36185
|
}
|
|
36101
36186
|
});
|
|
36102
|
-
|
|
36187
|
+
setDrawerBounds4(drawer, bounds);
|
|
36103
36188
|
drawer.drawElements(normalizedElements);
|
|
36104
36189
|
};
|
|
36105
36190
|
|
|
@@ -36136,23 +36221,23 @@ function createPcbNoteTextureForLayer({
|
|
|
36136
36221
|
bounds,
|
|
36137
36222
|
elements
|
|
36138
36223
|
});
|
|
36139
|
-
const texture = new
|
|
36224
|
+
const texture = new THREE30.CanvasTexture(canvas);
|
|
36140
36225
|
texture.generateMipmaps = true;
|
|
36141
|
-
texture.minFilter =
|
|
36142
|
-
texture.magFilter =
|
|
36226
|
+
texture.minFilter = THREE30.LinearMipmapLinearFilter;
|
|
36227
|
+
texture.magFilter = THREE30.LinearFilter;
|
|
36143
36228
|
texture.anisotropy = 16;
|
|
36144
36229
|
texture.needsUpdate = true;
|
|
36145
36230
|
return texture;
|
|
36146
36231
|
}
|
|
36147
36232
|
|
|
36148
36233
|
// src/textures/create-silkscreen-texture-for-layer.ts
|
|
36149
|
-
import * as
|
|
36234
|
+
import * as THREE31 from "three";
|
|
36150
36235
|
|
|
36151
36236
|
// src/textures/silkscreen/silkscreen-drawing.ts
|
|
36152
|
-
import { CircuitToCanvasDrawer as
|
|
36237
|
+
import { CircuitToCanvasDrawer as CircuitToCanvasDrawer8 } from "circuit-to-canvas";
|
|
36153
36238
|
var FABRICATION_NOTE_COLOR2 = "rgb(255,243,204)";
|
|
36154
36239
|
var TRANSPARENT3 = "rgba(0,0,0,0)";
|
|
36155
|
-
var
|
|
36240
|
+
var setDrawerBounds5 = (drawer, bounds) => {
|
|
36156
36241
|
drawer.setCameraBounds({
|
|
36157
36242
|
minX: bounds.minX,
|
|
36158
36243
|
maxX: bounds.maxX,
|
|
@@ -36168,7 +36253,7 @@ var drawSilkscreenLayer = ({
|
|
|
36168
36253
|
silkscreenColor
|
|
36169
36254
|
}) => {
|
|
36170
36255
|
const renderLayer = layer === "top" ? "top_silkscreen" : "bottom_silkscreen";
|
|
36171
|
-
const drawer = new
|
|
36256
|
+
const drawer = new CircuitToCanvasDrawer8(ctx);
|
|
36172
36257
|
drawer.configure({
|
|
36173
36258
|
colorOverrides: {
|
|
36174
36259
|
copper: {
|
|
@@ -36188,7 +36273,7 @@ var drawSilkscreenLayer = ({
|
|
|
36188
36273
|
drill: TRANSPARENT3,
|
|
36189
36274
|
boardOutline: TRANSPARENT3,
|
|
36190
36275
|
substrate: TRANSPARENT3,
|
|
36191
|
-
keepout: TRANSPARENT3,
|
|
36276
|
+
keepout: { top: TRANSPARENT3, bottom: TRANSPARENT3 },
|
|
36192
36277
|
courtyard: {
|
|
36193
36278
|
top: TRANSPARENT3,
|
|
36194
36279
|
bottom: TRANSPARENT3
|
|
@@ -36212,7 +36297,7 @@ var drawSilkscreenLayer = ({
|
|
|
36212
36297
|
fabricationNote: FABRICATION_NOTE_COLOR2
|
|
36213
36298
|
}
|
|
36214
36299
|
});
|
|
36215
|
-
|
|
36300
|
+
setDrawerBounds5(drawer, bounds);
|
|
36216
36301
|
drawer.drawElements(elements, {
|
|
36217
36302
|
layers: [renderLayer]
|
|
36218
36303
|
});
|
|
@@ -36255,20 +36340,20 @@ function createSilkscreenTextureForLayer({
|
|
|
36255
36340
|
elements,
|
|
36256
36341
|
silkscreenColor
|
|
36257
36342
|
});
|
|
36258
|
-
const texture = new
|
|
36343
|
+
const texture = new THREE31.CanvasTexture(canvas);
|
|
36259
36344
|
texture.generateMipmaps = true;
|
|
36260
|
-
texture.minFilter =
|
|
36261
|
-
texture.magFilter =
|
|
36345
|
+
texture.minFilter = THREE31.LinearMipmapLinearFilter;
|
|
36346
|
+
texture.magFilter = THREE31.LinearFilter;
|
|
36262
36347
|
texture.anisotropy = 16;
|
|
36263
36348
|
texture.needsUpdate = true;
|
|
36264
36349
|
return texture;
|
|
36265
36350
|
}
|
|
36266
36351
|
|
|
36267
36352
|
// src/textures/create-soldermask-texture-for-layer.ts
|
|
36268
|
-
import * as
|
|
36353
|
+
import * as THREE32 from "three";
|
|
36269
36354
|
|
|
36270
36355
|
// src/textures/soldermask/soldermask-drawing.ts
|
|
36271
|
-
import { CircuitToCanvasDrawer as
|
|
36356
|
+
import { CircuitToCanvasDrawer as CircuitToCanvasDrawer9 } from "circuit-to-canvas";
|
|
36272
36357
|
var toRgb2 = (colorArr) => {
|
|
36273
36358
|
const [r = 0, g = 0, b = 0] = colorArr;
|
|
36274
36359
|
return `rgb(${Math.round(r * 255)}, ${Math.round(g * 255)}, ${Math.round(
|
|
@@ -36287,7 +36372,7 @@ var getSoldermaskPalette = (material) => {
|
|
|
36287
36372
|
transparent: "rgba(0,0,0,0)"
|
|
36288
36373
|
};
|
|
36289
36374
|
};
|
|
36290
|
-
var
|
|
36375
|
+
var setDrawerBounds6 = (drawer, bounds) => {
|
|
36291
36376
|
drawer.setCameraBounds({
|
|
36292
36377
|
minX: bounds.minX,
|
|
36293
36378
|
maxX: bounds.maxX,
|
|
@@ -36304,7 +36389,7 @@ var drawSoldermaskLayer = ({
|
|
|
36304
36389
|
}) => {
|
|
36305
36390
|
const palette = getSoldermaskPalette(boardMaterial);
|
|
36306
36391
|
const copperRenderLayer = layer === "top" ? "top_copper" : "bottom_copper";
|
|
36307
|
-
const drawer = new
|
|
36392
|
+
const drawer = new CircuitToCanvasDrawer9(ctx);
|
|
36308
36393
|
drawer.configure({
|
|
36309
36394
|
colorOverrides: {
|
|
36310
36395
|
copper: {
|
|
@@ -36320,7 +36405,7 @@ var drawSoldermaskLayer = ({
|
|
|
36320
36405
|
drill: palette.transparent,
|
|
36321
36406
|
boardOutline: palette.transparent,
|
|
36322
36407
|
substrate: palette.transparent,
|
|
36323
|
-
keepout: palette.transparent,
|
|
36408
|
+
keepout: { top: palette.transparent, bottom: palette.transparent },
|
|
36324
36409
|
fabricationNote: palette.transparent,
|
|
36325
36410
|
silkscreen: { top: palette.transparent, bottom: palette.transparent },
|
|
36326
36411
|
courtyard: { top: palette.transparent, bottom: palette.transparent },
|
|
@@ -36335,20 +36420,23 @@ var drawSoldermaskLayer = ({
|
|
|
36335
36420
|
}
|
|
36336
36421
|
}
|
|
36337
36422
|
});
|
|
36338
|
-
|
|
36339
|
-
|
|
36423
|
+
setDrawerBounds6(drawer, bounds);
|
|
36424
|
+
const elementsWithoutKeepouts = elements.filter(
|
|
36425
|
+
(element) => element.type !== "pcb_keepout"
|
|
36426
|
+
);
|
|
36427
|
+
drawer.drawElements(elementsWithoutKeepouts, {
|
|
36340
36428
|
layers: [copperRenderLayer],
|
|
36341
36429
|
drawSoldermask: true,
|
|
36342
36430
|
drawSoldermaskTop: layer === "top",
|
|
36343
36431
|
drawSoldermaskBottom: layer === "bottom"
|
|
36344
36432
|
});
|
|
36345
|
-
const uncoveredPours =
|
|
36433
|
+
const uncoveredPours = elementsWithoutKeepouts.filter(
|
|
36346
36434
|
(e) => e.type === "pcb_copper_pour" && e.layer === layer && e.covered_with_solder_mask === false
|
|
36347
36435
|
);
|
|
36348
36436
|
if (uncoveredPours.length > 0) {
|
|
36349
36437
|
ctx.save();
|
|
36350
36438
|
ctx.globalCompositeOperation = "destination-out";
|
|
36351
|
-
const cutoutDrawer = new
|
|
36439
|
+
const cutoutDrawer = new CircuitToCanvasDrawer9(ctx);
|
|
36352
36440
|
cutoutDrawer.configure({
|
|
36353
36441
|
colorOverrides: {
|
|
36354
36442
|
copper: {
|
|
@@ -36363,7 +36451,7 @@ var drawSoldermaskLayer = ({
|
|
|
36363
36451
|
}
|
|
36364
36452
|
}
|
|
36365
36453
|
});
|
|
36366
|
-
|
|
36454
|
+
setDrawerBounds6(cutoutDrawer, bounds);
|
|
36367
36455
|
cutoutDrawer.drawElements(uncoveredPours, { layers: [copperRenderLayer] });
|
|
36368
36456
|
ctx.restore();
|
|
36369
36457
|
}
|
|
@@ -36397,21 +36485,21 @@ function createSoldermaskTextureForLayer({
|
|
|
36397
36485
|
elements,
|
|
36398
36486
|
boardMaterial: boardData.material
|
|
36399
36487
|
});
|
|
36400
|
-
const texture = new
|
|
36488
|
+
const texture = new THREE32.CanvasTexture(canvas);
|
|
36401
36489
|
texture.generateMipmaps = true;
|
|
36402
|
-
texture.minFilter =
|
|
36403
|
-
texture.magFilter =
|
|
36490
|
+
texture.minFilter = THREE32.LinearMipmapLinearFilter;
|
|
36491
|
+
texture.magFilter = THREE32.LinearFilter;
|
|
36404
36492
|
texture.anisotropy = 16;
|
|
36405
36493
|
texture.needsUpdate = true;
|
|
36406
36494
|
return texture;
|
|
36407
36495
|
}
|
|
36408
36496
|
|
|
36409
36497
|
// src/textures/create-through-hole-texture-for-layer.ts
|
|
36410
|
-
import * as
|
|
36498
|
+
import * as THREE33 from "three";
|
|
36411
36499
|
|
|
36412
36500
|
// src/textures/through-hole/through-hole-drawing.ts
|
|
36413
|
-
import { CircuitToCanvasDrawer as
|
|
36414
|
-
var
|
|
36501
|
+
import { CircuitToCanvasDrawer as CircuitToCanvasDrawer10 } from "circuit-to-canvas";
|
|
36502
|
+
var setDrawerBounds7 = (drawer, bounds) => {
|
|
36415
36503
|
drawer.setCameraBounds({
|
|
36416
36504
|
minX: bounds.minX,
|
|
36417
36505
|
maxX: bounds.maxX,
|
|
@@ -36428,7 +36516,7 @@ var drawThroughHoleLayer = ({
|
|
|
36428
36516
|
}) => {
|
|
36429
36517
|
const renderLayer = layer === "top" ? "top_copper" : "bottom_copper";
|
|
36430
36518
|
const transparent = "rgba(0,0,0,0)";
|
|
36431
|
-
const drawer = new
|
|
36519
|
+
const drawer = new CircuitToCanvasDrawer10(ctx);
|
|
36432
36520
|
drawer.configure({
|
|
36433
36521
|
colorOverrides: {
|
|
36434
36522
|
copper: {
|
|
@@ -36444,7 +36532,7 @@ var drawThroughHoleLayer = ({
|
|
|
36444
36532
|
drill: transparent,
|
|
36445
36533
|
boardOutline: transparent,
|
|
36446
36534
|
substrate: transparent,
|
|
36447
|
-
keepout: transparent,
|
|
36535
|
+
keepout: { top: transparent, bottom: transparent },
|
|
36448
36536
|
fabricationNote: transparent,
|
|
36449
36537
|
silkscreen: { top: transparent, bottom: transparent },
|
|
36450
36538
|
courtyard: { top: transparent, bottom: transparent },
|
|
@@ -36459,7 +36547,7 @@ var drawThroughHoleLayer = ({
|
|
|
36459
36547
|
}
|
|
36460
36548
|
}
|
|
36461
36549
|
});
|
|
36462
|
-
|
|
36550
|
+
setDrawerBounds7(drawer, bounds);
|
|
36463
36551
|
drawer.drawElements(elements, {
|
|
36464
36552
|
layers: [renderLayer]
|
|
36465
36553
|
});
|
|
@@ -36500,10 +36588,10 @@ function createThroughHoleTextureForLayer({
|
|
|
36500
36588
|
elements,
|
|
36501
36589
|
copperColor
|
|
36502
36590
|
});
|
|
36503
|
-
const texture = new
|
|
36591
|
+
const texture = new THREE33.CanvasTexture(canvas);
|
|
36504
36592
|
texture.generateMipmaps = true;
|
|
36505
|
-
texture.minFilter =
|
|
36506
|
-
texture.magFilter =
|
|
36593
|
+
texture.minFilter = THREE33.LinearMipmapLinearFilter;
|
|
36594
|
+
texture.magFilter = THREE33.LinearFilter;
|
|
36507
36595
|
texture.anisotropy = 16;
|
|
36508
36596
|
texture.needsUpdate = true;
|
|
36509
36597
|
return texture;
|
|
@@ -36541,10 +36629,10 @@ var createCombinedTexture = ({
|
|
|
36541
36629
|
const image = texture.image;
|
|
36542
36630
|
ctx.drawImage(image, 0, 0, canvasWidth, canvasHeight);
|
|
36543
36631
|
});
|
|
36544
|
-
const combinedTexture = new
|
|
36632
|
+
const combinedTexture = new THREE34.CanvasTexture(canvas);
|
|
36545
36633
|
combinedTexture.generateMipmaps = false;
|
|
36546
|
-
combinedTexture.minFilter =
|
|
36547
|
-
combinedTexture.magFilter =
|
|
36634
|
+
combinedTexture.minFilter = THREE34.LinearFilter;
|
|
36635
|
+
combinedTexture.magFilter = THREE34.LinearFilter;
|
|
36548
36636
|
combinedTexture.premultiplyAlpha = true;
|
|
36549
36637
|
combinedTexture.anisotropy = 16;
|
|
36550
36638
|
combinedTexture.needsUpdate = true;
|
|
@@ -36631,6 +36719,12 @@ function createCombinedBoardTextures({
|
|
|
36631
36719
|
panelData: boardData,
|
|
36632
36720
|
traceTextureResolution
|
|
36633
36721
|
}) : null;
|
|
36722
|
+
const keepoutTexture = createKeepoutTextureForLayer({
|
|
36723
|
+
layer,
|
|
36724
|
+
circuitJson,
|
|
36725
|
+
boardData,
|
|
36726
|
+
traceTextureResolution
|
|
36727
|
+
});
|
|
36634
36728
|
return createCombinedTexture({
|
|
36635
36729
|
textures: [
|
|
36636
36730
|
copperPourTexture,
|
|
@@ -36642,7 +36736,8 @@ function createCombinedBoardTextures({
|
|
|
36642
36736
|
silkscreenTexture,
|
|
36643
36737
|
fabricationNoteTexture,
|
|
36644
36738
|
pcbNoteTexture,
|
|
36645
|
-
panelOutlineTexture
|
|
36739
|
+
panelOutlineTexture,
|
|
36740
|
+
keepoutTexture
|
|
36646
36741
|
],
|
|
36647
36742
|
boardData,
|
|
36648
36743
|
traceTextureResolution
|
|
@@ -36656,7 +36751,7 @@ function createCombinedBoardTextures({
|
|
|
36656
36751
|
}
|
|
36657
36752
|
|
|
36658
36753
|
// src/textures/create-three-texture-meshes.ts
|
|
36659
|
-
import * as
|
|
36754
|
+
import * as THREE35 from "three";
|
|
36660
36755
|
function createTexturePlane(config, boardData) {
|
|
36661
36756
|
const {
|
|
36662
36757
|
texture,
|
|
@@ -36668,15 +36763,15 @@ function createTexturePlane(config, boardData) {
|
|
|
36668
36763
|
} = config;
|
|
36669
36764
|
if (!texture) return null;
|
|
36670
36765
|
const boardOutlineBounds = calculateOutlineBounds(boardData);
|
|
36671
|
-
const planeGeom = new
|
|
36766
|
+
const planeGeom = new THREE35.PlaneGeometry(
|
|
36672
36767
|
boardOutlineBounds.width,
|
|
36673
36768
|
boardOutlineBounds.height
|
|
36674
36769
|
);
|
|
36675
|
-
const material = new
|
|
36770
|
+
const material = new THREE35.MeshBasicMaterial({
|
|
36676
36771
|
map: texture,
|
|
36677
36772
|
transparent: true,
|
|
36678
36773
|
alphaTest: 0.08,
|
|
36679
|
-
side:
|
|
36774
|
+
side: THREE35.FrontSide,
|
|
36680
36775
|
depthWrite: true,
|
|
36681
36776
|
polygonOffset: usePolygonOffset,
|
|
36682
36777
|
polygonOffsetFactor: usePolygonOffset ? -4 : 0,
|
|
@@ -36684,7 +36779,7 @@ function createTexturePlane(config, boardData) {
|
|
|
36684
36779
|
polygonOffsetUnits: usePolygonOffset ? -4 : 0,
|
|
36685
36780
|
opacity: isFaux ? FAUX_BOARD_OPACITY : 1
|
|
36686
36781
|
});
|
|
36687
|
-
const mesh = new
|
|
36782
|
+
const mesh = new THREE35.Mesh(planeGeom, material);
|
|
36688
36783
|
mesh.position.set(
|
|
36689
36784
|
boardOutlineBounds.centerX,
|
|
36690
36785
|
boardOutlineBounds.centerY,
|
|
@@ -36729,7 +36824,7 @@ function createTextureMeshes(textures, boardData, pcbThickness, isFaux = false)
|
|
|
36729
36824
|
}
|
|
36730
36825
|
|
|
36731
36826
|
// src/three-components/JscadBoardTextures.tsx
|
|
36732
|
-
import * as
|
|
36827
|
+
import * as THREE36 from "three";
|
|
36733
36828
|
|
|
36734
36829
|
// src/utils/layer-texture-resolution.ts
|
|
36735
36830
|
var DEFAULT_MAX_TEXTURE_PIXELS = 4e6;
|
|
@@ -36825,7 +36920,7 @@ function JscadBoardTextures({
|
|
|
36825
36920
|
const typedMaterial = material;
|
|
36826
36921
|
for (const prop of textureProps) {
|
|
36827
36922
|
const texture = typedMaterial[prop];
|
|
36828
|
-
if (texture && texture instanceof
|
|
36923
|
+
if (texture && texture instanceof THREE36.Texture) {
|
|
36829
36924
|
texture.dispose();
|
|
36830
36925
|
typedMaterial[prop] = null;
|
|
36831
36926
|
}
|
|
@@ -36835,22 +36930,22 @@ function JscadBoardTextures({
|
|
|
36835
36930
|
const createTexturePlane2 = (texture, zOffset, isBottomLayer, name, usePolygonOffset = false, depthWrite = true, renderOrder = 1) => {
|
|
36836
36931
|
if (!texture) return null;
|
|
36837
36932
|
const boardOutlineBounds = calculateOutlineBounds(boardData);
|
|
36838
|
-
const planeGeom = new
|
|
36933
|
+
const planeGeom = new THREE36.PlaneGeometry(
|
|
36839
36934
|
boardOutlineBounds.width,
|
|
36840
36935
|
boardOutlineBounds.height
|
|
36841
36936
|
);
|
|
36842
|
-
const material = new
|
|
36937
|
+
const material = new THREE36.MeshBasicMaterial({
|
|
36843
36938
|
map: texture,
|
|
36844
36939
|
transparent: true,
|
|
36845
36940
|
alphaTest: 0.08,
|
|
36846
|
-
side:
|
|
36941
|
+
side: THREE36.FrontSide,
|
|
36847
36942
|
depthWrite,
|
|
36848
36943
|
polygonOffset: usePolygonOffset,
|
|
36849
36944
|
polygonOffsetFactor: usePolygonOffset ? -4 : 0,
|
|
36850
36945
|
polygonOffsetUnits: usePolygonOffset ? -4 : 0,
|
|
36851
36946
|
opacity: isFaux ? FAUX_BOARD_OPACITY : 1
|
|
36852
36947
|
});
|
|
36853
|
-
const mesh = new
|
|
36948
|
+
const mesh = new THREE36.Mesh(planeGeom, material);
|
|
36854
36949
|
mesh.position.set(
|
|
36855
36950
|
boardOutlineBounds.centerX,
|
|
36856
36951
|
boardOutlineBounds.centerY,
|
|
@@ -36895,7 +36990,7 @@ function JscadBoardTextures({
|
|
|
36895
36990
|
mesh.geometry.dispose();
|
|
36896
36991
|
if (Array.isArray(mesh.material)) {
|
|
36897
36992
|
mesh.material.forEach((material) => disposeTextureMaterial(material));
|
|
36898
|
-
} else if (mesh.material instanceof
|
|
36993
|
+
} else if (mesh.material instanceof THREE36.Material) {
|
|
36899
36994
|
disposeTextureMaterial(mesh.material);
|
|
36900
36995
|
}
|
|
36901
36996
|
});
|
|
@@ -37128,12 +37223,12 @@ var CadViewerJscad = forwardRef3(
|
|
|
37128
37223
|
// src/CadViewerManifold.tsx
|
|
37129
37224
|
import { su as su17 } from "@tscircuit/circuit-json-util";
|
|
37130
37225
|
import { useEffect as useEffect26, useMemo as useMemo22, useState as useState16 } from "react";
|
|
37131
|
-
import * as
|
|
37226
|
+
import * as THREE43 from "three";
|
|
37132
37227
|
|
|
37133
37228
|
// src/hooks/useManifoldBoardBuilder.ts
|
|
37134
37229
|
import { su as su16 } from "@tscircuit/circuit-json-util";
|
|
37135
37230
|
import { useEffect as useEffect25, useMemo as useMemo21, useRef as useRef9, useState as useState15 } from "react";
|
|
37136
|
-
import * as
|
|
37231
|
+
import * as THREE40 from "three";
|
|
37137
37232
|
|
|
37138
37233
|
// src/utils/manifold/create-manifold-board.ts
|
|
37139
37234
|
var arePointsClockwise2 = (points) => {
|
|
@@ -37482,17 +37577,17 @@ function processNonPlatedHolesForManifold(Manifold, CrossSection, circuitJson, p
|
|
|
37482
37577
|
|
|
37483
37578
|
// src/utils/manifold/process-plated-holes.ts
|
|
37484
37579
|
import { su as su14 } from "@tscircuit/circuit-json-util";
|
|
37485
|
-
import * as
|
|
37580
|
+
import * as THREE38 from "three";
|
|
37486
37581
|
|
|
37487
37582
|
// src/utils/manifold-mesh-to-three-geometry.ts
|
|
37488
|
-
import * as
|
|
37583
|
+
import * as THREE37 from "three";
|
|
37489
37584
|
function manifoldMeshToThreeGeometry(manifoldMesh) {
|
|
37490
|
-
const geometry = new
|
|
37585
|
+
const geometry = new THREE37.BufferGeometry();
|
|
37491
37586
|
geometry.setAttribute(
|
|
37492
37587
|
"position",
|
|
37493
|
-
new
|
|
37588
|
+
new THREE37.Float32BufferAttribute(manifoldMesh.vertProperties, 3)
|
|
37494
37589
|
);
|
|
37495
|
-
geometry.setIndex(new
|
|
37590
|
+
geometry.setIndex(new THREE37.Uint32BufferAttribute(manifoldMesh.triVerts, 1));
|
|
37496
37591
|
if (manifoldMesh.runIndex && manifoldMesh.runIndex.length > 1 && manifoldMesh.runOriginalID) {
|
|
37497
37592
|
for (let i = 0; i < manifoldMesh.runIndex.length - 1; i++) {
|
|
37498
37593
|
const start = manifoldMesh.runIndex[i];
|
|
@@ -37526,7 +37621,7 @@ var createEllipsePoints = (width10, height10, segments) => {
|
|
|
37526
37621
|
}
|
|
37527
37622
|
return points;
|
|
37528
37623
|
};
|
|
37529
|
-
var COPPER_COLOR = new
|
|
37624
|
+
var COPPER_COLOR = new THREE38.Color(...colors.copper);
|
|
37530
37625
|
var PLATED_HOLE_LIP_HEIGHT = 0.05;
|
|
37531
37626
|
var PLATED_HOLE_PAD_THICKNESS = 3e-3;
|
|
37532
37627
|
var PLATED_HOLE_SURFACE_CLEARANCE = 5e-4;
|
|
@@ -38157,7 +38252,7 @@ function processPlatedHolesForManifold(Manifold, CrossSection, circuitJson, pcbT
|
|
|
38157
38252
|
|
|
38158
38253
|
// src/utils/manifold/process-vias.ts
|
|
38159
38254
|
import { su as su15 } from "@tscircuit/circuit-json-util";
|
|
38160
|
-
import * as
|
|
38255
|
+
import * as THREE39 from "three";
|
|
38161
38256
|
|
|
38162
38257
|
// src/utils/via-geoms.ts
|
|
38163
38258
|
function createViaCopper2({
|
|
@@ -38195,7 +38290,7 @@ function createViaCopper2({
|
|
|
38195
38290
|
}
|
|
38196
38291
|
|
|
38197
38292
|
// src/utils/manifold/process-vias.ts
|
|
38198
|
-
var COPPER_COLOR2 = new
|
|
38293
|
+
var COPPER_COLOR2 = new THREE39.Color(...colors.copper);
|
|
38199
38294
|
function processViasForManifold(Manifold, circuitJson, pcbThickness, manifoldInstancesForCleanup, boardClipVolume) {
|
|
38200
38295
|
const viaBoardDrills = [];
|
|
38201
38296
|
const pcbVias = su15(circuitJson).pcb_via.list();
|
|
@@ -38415,7 +38510,7 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson, visibility) => {
|
|
|
38415
38510
|
{
|
|
38416
38511
|
key: "plated-holes-union",
|
|
38417
38512
|
geometry: cutPlatedGeom,
|
|
38418
|
-
color: new
|
|
38513
|
+
color: new THREE40.Color(
|
|
38419
38514
|
colors.copper[0],
|
|
38420
38515
|
colors.copper[1],
|
|
38421
38516
|
colors.copper[2]
|
|
@@ -38445,7 +38540,7 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson, visibility) => {
|
|
|
38445
38540
|
const matColorArray = boardMaterialColors[boardData.material] ?? colors.fr4Tan;
|
|
38446
38541
|
currentGeoms.board = {
|
|
38447
38542
|
geometry: finalBoardGeom,
|
|
38448
|
-
color: new
|
|
38543
|
+
color: new THREE40.Color(
|
|
38449
38544
|
matColorArray[0],
|
|
38450
38545
|
matColorArray[1],
|
|
38451
38546
|
matColorArray[2]
|
|
@@ -38490,11 +38585,11 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson, visibility) => {
|
|
|
38490
38585
|
};
|
|
38491
38586
|
|
|
38492
38587
|
// src/utils/manifold/create-three-geometry-meshes.ts
|
|
38493
|
-
import * as
|
|
38588
|
+
import * as THREE42 from "three";
|
|
38494
38589
|
|
|
38495
38590
|
// src/utils/create-board-material.ts
|
|
38496
|
-
import * as
|
|
38497
|
-
var DEFAULT_SIDE =
|
|
38591
|
+
import * as THREE41 from "three";
|
|
38592
|
+
var DEFAULT_SIDE = THREE41.DoubleSide;
|
|
38498
38593
|
var createBoardMaterial = ({
|
|
38499
38594
|
material,
|
|
38500
38595
|
color,
|
|
@@ -38502,7 +38597,7 @@ var createBoardMaterial = ({
|
|
|
38502
38597
|
isFaux = false
|
|
38503
38598
|
}) => {
|
|
38504
38599
|
if (material === "fr4") {
|
|
38505
|
-
return new
|
|
38600
|
+
return new THREE41.MeshPhysicalMaterial({
|
|
38506
38601
|
color,
|
|
38507
38602
|
side,
|
|
38508
38603
|
metalness: 0,
|
|
@@ -38519,7 +38614,7 @@ var createBoardMaterial = ({
|
|
|
38519
38614
|
polygonOffsetUnits: 1
|
|
38520
38615
|
});
|
|
38521
38616
|
}
|
|
38522
|
-
return new
|
|
38617
|
+
return new THREE41.MeshStandardMaterial({
|
|
38523
38618
|
color,
|
|
38524
38619
|
side,
|
|
38525
38620
|
flatShading: true,
|
|
@@ -38538,12 +38633,12 @@ function createGeometryMeshes(geoms) {
|
|
|
38538
38633
|
const meshes = [];
|
|
38539
38634
|
if (!geoms) return meshes;
|
|
38540
38635
|
if (geoms.board && geoms.board.geometry) {
|
|
38541
|
-
const mesh = new
|
|
38636
|
+
const mesh = new THREE42.Mesh(
|
|
38542
38637
|
geoms.board.geometry,
|
|
38543
38638
|
createBoardMaterial({
|
|
38544
38639
|
material: geoms.board.material,
|
|
38545
38640
|
color: geoms.board.color,
|
|
38546
|
-
side:
|
|
38641
|
+
side: THREE42.DoubleSide,
|
|
38547
38642
|
isFaux: geoms.board.isFaux
|
|
38548
38643
|
})
|
|
38549
38644
|
);
|
|
@@ -38553,11 +38648,11 @@ function createGeometryMeshes(geoms) {
|
|
|
38553
38648
|
const createMeshesFromArray = (geomArray) => {
|
|
38554
38649
|
if (geomArray) {
|
|
38555
38650
|
geomArray.forEach((comp) => {
|
|
38556
|
-
const mesh = new
|
|
38651
|
+
const mesh = new THREE42.Mesh(
|
|
38557
38652
|
comp.geometry,
|
|
38558
|
-
new
|
|
38653
|
+
new THREE42.MeshStandardMaterial({
|
|
38559
38654
|
color: comp.color,
|
|
38560
|
-
side:
|
|
38655
|
+
side: THREE42.DoubleSide,
|
|
38561
38656
|
flatShading: true
|
|
38562
38657
|
// Consistent with board
|
|
38563
38658
|
})
|
|
@@ -38601,7 +38696,7 @@ var BoardMeshes = ({
|
|
|
38601
38696
|
const typedMaterial = material;
|
|
38602
38697
|
for (const prop of textureProps) {
|
|
38603
38698
|
const texture = typedMaterial[prop];
|
|
38604
|
-
if (texture && texture instanceof
|
|
38699
|
+
if (texture && texture instanceof THREE43.Texture) {
|
|
38605
38700
|
texture.dispose();
|
|
38606
38701
|
typedMaterial[prop] = null;
|
|
38607
38702
|
}
|
|
@@ -39244,7 +39339,7 @@ var ToastProvider = ({
|
|
|
39244
39339
|
};
|
|
39245
39340
|
|
|
39246
39341
|
// src/components/ContextMenu.tsx
|
|
39247
|
-
import { useState as
|
|
39342
|
+
import { useState as useState35 } from "react";
|
|
39248
39343
|
|
|
39249
39344
|
// node_modules/@radix-ui/react-dropdown-menu/dist/index.mjs
|
|
39250
39345
|
import * as React43 from "react";
|
|
@@ -39304,6 +39399,7 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
|
39304
39399
|
let defaultContexts = [];
|
|
39305
39400
|
function createContext32(rootComponentName, defaultContext) {
|
|
39306
39401
|
const BaseContext = React13.createContext(defaultContext);
|
|
39402
|
+
BaseContext.displayName = rootComponentName + "Context";
|
|
39307
39403
|
const index2 = defaultContexts.length;
|
|
39308
39404
|
defaultContexts = [...defaultContexts, defaultContext];
|
|
39309
39405
|
const Provider = (props) => {
|
|
@@ -39439,52 +39535,69 @@ import * as ReactDOM2 from "react-dom";
|
|
|
39439
39535
|
|
|
39440
39536
|
// node_modules/@radix-ui/react-slot/dist/index.mjs
|
|
39441
39537
|
import * as React16 from "react";
|
|
39442
|
-
import { Fragment as Fragment22, jsx as jsx21 } from "react/jsx-runtime";
|
|
39443
39538
|
// @__NO_SIDE_EFFECTS__
|
|
39444
39539
|
function createSlot(ownerName) {
|
|
39445
|
-
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
39446
39540
|
const Slot2 = React16.forwardRef((props, forwardedRef) => {
|
|
39447
|
-
|
|
39448
|
-
|
|
39449
|
-
|
|
39450
|
-
|
|
39451
|
-
|
|
39452
|
-
|
|
39453
|
-
|
|
39454
|
-
|
|
39455
|
-
|
|
39456
|
-
|
|
39457
|
-
|
|
39458
|
-
|
|
39459
|
-
|
|
39460
|
-
|
|
39541
|
+
let { children, ...slotProps } = props;
|
|
39542
|
+
let slottableElement = null;
|
|
39543
|
+
let hasSlottable = false;
|
|
39544
|
+
const newChildren = [];
|
|
39545
|
+
if (isLazyComponent(children) && typeof use === "function") {
|
|
39546
|
+
children = use(children._payload);
|
|
39547
|
+
}
|
|
39548
|
+
React16.Children.forEach(children, (maybeSlottable) => {
|
|
39549
|
+
if (isSlottable(maybeSlottable)) {
|
|
39550
|
+
hasSlottable = true;
|
|
39551
|
+
const slottable = maybeSlottable;
|
|
39552
|
+
let child = "child" in slottable.props ? slottable.props.child : slottable.props.children;
|
|
39553
|
+
if (isLazyComponent(child) && typeof use === "function") {
|
|
39554
|
+
child = use(child._payload);
|
|
39555
|
+
}
|
|
39556
|
+
slottableElement = getSlottableElementFromSlottable(slottable, child);
|
|
39557
|
+
newChildren.push(slottableElement?.props?.children);
|
|
39558
|
+
} else {
|
|
39559
|
+
newChildren.push(maybeSlottable);
|
|
39560
|
+
}
|
|
39561
|
+
});
|
|
39562
|
+
if (slottableElement) {
|
|
39563
|
+
slottableElement = React16.cloneElement(slottableElement, void 0, newChildren);
|
|
39564
|
+
} else if (
|
|
39565
|
+
// A `Slottable` was found but it didn't resolve to a single element (e.g.
|
|
39566
|
+
// it wrapped multiple elements, text, or a render-prop `child` that
|
|
39567
|
+
// wasn't an element). Don't fall back to treating the `Slottable` wrapper
|
|
39568
|
+
// itself as the slot target — throw a descriptive error below instead.
|
|
39569
|
+
!hasSlottable && React16.Children.count(children) === 1 && React16.isValidElement(children)
|
|
39570
|
+
) {
|
|
39571
|
+
slottableElement = children;
|
|
39572
|
+
}
|
|
39573
|
+
const slottableElementRef = slottableElement ? getElementRef(slottableElement) : void 0;
|
|
39574
|
+
const composedRef = useComposedRefs(forwardedRef, slottableElementRef);
|
|
39575
|
+
if (!slottableElement) {
|
|
39576
|
+
if (children || children === 0) {
|
|
39577
|
+
throw new Error(
|
|
39578
|
+
hasSlottable ? createSlottableError(ownerName) : createSlotError(ownerName)
|
|
39579
|
+
);
|
|
39580
|
+
}
|
|
39581
|
+
return children;
|
|
39461
39582
|
}
|
|
39462
|
-
|
|
39583
|
+
const mergedProps = mergeProps(slotProps, slottableElement.props ?? {});
|
|
39584
|
+
if (slottableElement.type !== React16.Fragment) {
|
|
39585
|
+
mergedProps.ref = forwardedRef ? composedRef : slottableElementRef;
|
|
39586
|
+
}
|
|
39587
|
+
return React16.cloneElement(slottableElement, mergedProps);
|
|
39463
39588
|
});
|
|
39464
39589
|
Slot2.displayName = `${ownerName}.Slot`;
|
|
39465
39590
|
return Slot2;
|
|
39466
39591
|
}
|
|
39467
|
-
|
|
39468
|
-
|
|
39469
|
-
|
|
39470
|
-
const
|
|
39471
|
-
if (React16.isValidElement(
|
|
39472
|
-
|
|
39473
|
-
|
|
39474
|
-
|
|
39475
|
-
|
|
39476
|
-
}
|
|
39477
|
-
return React16.cloneElement(children, props2);
|
|
39478
|
-
}
|
|
39479
|
-
return React16.Children.count(children) > 1 ? React16.Children.only(null) : null;
|
|
39480
|
-
});
|
|
39481
|
-
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
39482
|
-
return SlotClone;
|
|
39483
|
-
}
|
|
39484
|
-
var SLOTTABLE_IDENTIFIER = /* @__PURE__ */ Symbol("radix.slottable");
|
|
39485
|
-
function isSlottable(child) {
|
|
39486
|
-
return React16.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
39487
|
-
}
|
|
39592
|
+
var SLOTTABLE_IDENTIFIER = /* @__PURE__ */ Symbol.for("radix.slottable");
|
|
39593
|
+
var getSlottableElementFromSlottable = (slottable, child) => {
|
|
39594
|
+
if ("child" in slottable.props) {
|
|
39595
|
+
const child2 = slottable.props.child;
|
|
39596
|
+
if (!React16.isValidElement(child2)) return null;
|
|
39597
|
+
return React16.cloneElement(child2, void 0, slottable.props.children(child2.props.children));
|
|
39598
|
+
}
|
|
39599
|
+
return React16.isValidElement(child) ? child : null;
|
|
39600
|
+
};
|
|
39488
39601
|
function mergeProps(slotProps, childProps) {
|
|
39489
39602
|
const overrideProps = { ...childProps };
|
|
39490
39603
|
for (const propName in childProps) {
|
|
@@ -39522,9 +39635,26 @@ function getElementRef(element) {
|
|
|
39522
39635
|
}
|
|
39523
39636
|
return element.props.ref || element.ref;
|
|
39524
39637
|
}
|
|
39638
|
+
function isSlottable(child) {
|
|
39639
|
+
return React16.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
39640
|
+
}
|
|
39641
|
+
var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
|
|
39642
|
+
function isLazyComponent(element) {
|
|
39643
|
+
return element != null && typeof element === "object" && "$$typeof" in element && element.$$typeof === REACT_LAZY_TYPE && "_payload" in element && isPromiseLike(element._payload);
|
|
39644
|
+
}
|
|
39645
|
+
function isPromiseLike(value) {
|
|
39646
|
+
return typeof value === "object" && value !== null && "then" in value;
|
|
39647
|
+
}
|
|
39648
|
+
var createSlotError = (ownerName) => {
|
|
39649
|
+
return `${ownerName} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`;
|
|
39650
|
+
};
|
|
39651
|
+
var createSlottableError = (ownerName) => {
|
|
39652
|
+
return `${ownerName} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`;
|
|
39653
|
+
};
|
|
39654
|
+
var use = React16[" use ".trim().toString()];
|
|
39525
39655
|
|
|
39526
39656
|
// node_modules/@radix-ui/react-primitive/dist/index.mjs
|
|
39527
|
-
import { jsx as
|
|
39657
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
39528
39658
|
var NODES = [
|
|
39529
39659
|
"a",
|
|
39530
39660
|
"button",
|
|
@@ -39552,7 +39682,7 @@ var Primitive = NODES.reduce((primitive, node) => {
|
|
|
39552
39682
|
if (typeof window !== "undefined") {
|
|
39553
39683
|
window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
|
|
39554
39684
|
}
|
|
39555
|
-
return /* @__PURE__ */
|
|
39685
|
+
return /* @__PURE__ */ jsx21(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
39556
39686
|
});
|
|
39557
39687
|
Node2.displayName = `Primitive.${node}`;
|
|
39558
39688
|
return { ...primitive, [node]: Node2 };
|
|
@@ -39565,10 +39695,10 @@ function dispatchDiscreteCustomEvent(target, event) {
|
|
|
39565
39695
|
import * as React42 from "react";
|
|
39566
39696
|
|
|
39567
39697
|
// node_modules/@radix-ui/react-collection/dist/index.mjs
|
|
39568
|
-
import React18 from "react";
|
|
39698
|
+
import * as React18 from "react";
|
|
39699
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
39700
|
+
import * as React23 from "react";
|
|
39569
39701
|
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
39570
|
-
import React23 from "react";
|
|
39571
|
-
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
39572
39702
|
function createCollection(name) {
|
|
39573
39703
|
const PROVIDER_NAME = name + "CollectionProvider";
|
|
39574
39704
|
const [createCollectionContext, createCollectionScope3] = createContextScope(PROVIDER_NAME);
|
|
@@ -39580,7 +39710,7 @@ function createCollection(name) {
|
|
|
39580
39710
|
const { scope, children } = props;
|
|
39581
39711
|
const ref = React18.useRef(null);
|
|
39582
39712
|
const itemMap = React18.useRef(/* @__PURE__ */ new Map()).current;
|
|
39583
|
-
return /* @__PURE__ */
|
|
39713
|
+
return /* @__PURE__ */ jsx22(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
|
|
39584
39714
|
};
|
|
39585
39715
|
CollectionProvider.displayName = PROVIDER_NAME;
|
|
39586
39716
|
const COLLECTION_SLOT_NAME = name + "CollectionSlot";
|
|
@@ -39590,7 +39720,7 @@ function createCollection(name) {
|
|
|
39590
39720
|
const { scope, children } = props;
|
|
39591
39721
|
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
|
39592
39722
|
const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
|
|
39593
|
-
return /* @__PURE__ */
|
|
39723
|
+
return /* @__PURE__ */ jsx22(CollectionSlotImpl, { ref: composedRefs, children });
|
|
39594
39724
|
}
|
|
39595
39725
|
);
|
|
39596
39726
|
CollectionSlot.displayName = COLLECTION_SLOT_NAME;
|
|
@@ -39607,7 +39737,7 @@ function createCollection(name) {
|
|
|
39607
39737
|
context.itemMap.set(ref, { ref, ...itemData });
|
|
39608
39738
|
return () => void context.itemMap.delete(ref);
|
|
39609
39739
|
});
|
|
39610
|
-
return /* @__PURE__ */
|
|
39740
|
+
return /* @__PURE__ */ jsx22(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
|
|
39611
39741
|
}
|
|
39612
39742
|
);
|
|
39613
39743
|
CollectionItemSlot.displayName = ITEM_SLOT_NAME;
|
|
@@ -39634,7 +39764,7 @@ function createCollection(name) {
|
|
|
39634
39764
|
|
|
39635
39765
|
// node_modules/@radix-ui/react-direction/dist/index.mjs
|
|
39636
39766
|
import * as React19 from "react";
|
|
39637
|
-
import { jsx as
|
|
39767
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
39638
39768
|
var DirectionContext = React19.createContext(void 0);
|
|
39639
39769
|
function useDirection(localDir) {
|
|
39640
39770
|
const globalDir = React19.useContext(DirectionContext);
|
|
@@ -39651,7 +39781,7 @@ function useCallbackRef(callback) {
|
|
|
39651
39781
|
React20.useEffect(() => {
|
|
39652
39782
|
callbackRef.current = callback;
|
|
39653
39783
|
});
|
|
39654
|
-
return React20.useMemo(() => (...args) => callbackRef.current?.(...args), []);
|
|
39784
|
+
return React20.useMemo(() => ((...args) => callbackRef.current?.(...args)), []);
|
|
39655
39785
|
}
|
|
39656
39786
|
|
|
39657
39787
|
// node_modules/@radix-ui/react-use-escape-keydown/dist/index.mjs
|
|
@@ -39670,7 +39800,7 @@ function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.docum
|
|
|
39670
39800
|
}
|
|
39671
39801
|
|
|
39672
39802
|
// node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs
|
|
39673
|
-
import { jsx as
|
|
39803
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
39674
39804
|
var DISMISSABLE_LAYER_NAME = "DismissableLayer";
|
|
39675
39805
|
var CONTEXT_UPDATE = "dismissableLayer.update";
|
|
39676
39806
|
var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
|
|
@@ -39679,12 +39809,19 @@ var originalBodyPointerEvents;
|
|
|
39679
39809
|
var DismissableLayerContext = React24.createContext({
|
|
39680
39810
|
layers: /* @__PURE__ */ new Set(),
|
|
39681
39811
|
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
39682
|
-
branches: /* @__PURE__ */ new Set()
|
|
39812
|
+
branches: /* @__PURE__ */ new Set(),
|
|
39813
|
+
// Outside elements that belong to a layer's own dismiss affordance (eg, a
|
|
39814
|
+
// dialog overlay). Pressing them should dismiss the layer regardless of
|
|
39815
|
+
// whether or not they stop propagation.
|
|
39816
|
+
//
|
|
39817
|
+
// See https://github.com/radix-ui/primitives/issues/3346
|
|
39818
|
+
dismissableSurfaces: /* @__PURE__ */ new Set()
|
|
39683
39819
|
});
|
|
39684
39820
|
var DismissableLayer = React24.forwardRef(
|
|
39685
39821
|
(props, forwardedRef) => {
|
|
39686
39822
|
const {
|
|
39687
39823
|
disableOutsidePointerEvents = false,
|
|
39824
|
+
deferPointerDownOutside = false,
|
|
39688
39825
|
onEscapeKeyDown,
|
|
39689
39826
|
onPointerDownOutside,
|
|
39690
39827
|
onFocusOutside,
|
|
@@ -39703,15 +39840,32 @@ var DismissableLayer = React24.forwardRef(
|
|
|
39703
39840
|
const index2 = node ? layers.indexOf(node) : -1;
|
|
39704
39841
|
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
|
|
39705
39842
|
const isPointerEventsEnabled = index2 >= highestLayerWithOutsidePointerEventsDisabledIndex;
|
|
39706
|
-
const
|
|
39707
|
-
|
|
39708
|
-
|
|
39709
|
-
|
|
39710
|
-
|
|
39711
|
-
|
|
39712
|
-
|
|
39713
|
-
|
|
39843
|
+
const isDeferredPointerDownOutsideRef = React24.useRef(false);
|
|
39844
|
+
const pointerDownOutside = usePointerDownOutside(
|
|
39845
|
+
(event) => {
|
|
39846
|
+
const target = event.target;
|
|
39847
|
+
if (!(target instanceof Node)) {
|
|
39848
|
+
return;
|
|
39849
|
+
}
|
|
39850
|
+
const isPointerDownOnBranch = [...context.branches].some(
|
|
39851
|
+
(branch) => branch.contains(target)
|
|
39852
|
+
);
|
|
39853
|
+
if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
|
|
39854
|
+
onPointerDownOutside?.(event);
|
|
39855
|
+
onInteractOutside?.(event);
|
|
39856
|
+
if (!event.defaultPrevented) onDismiss?.();
|
|
39857
|
+
},
|
|
39858
|
+
{
|
|
39859
|
+
ownerDocument,
|
|
39860
|
+
deferPointerDownOutside,
|
|
39861
|
+
isDeferredPointerDownOutsideRef,
|
|
39862
|
+
dismissableSurfaces: context.dismissableSurfaces
|
|
39863
|
+
}
|
|
39864
|
+
);
|
|
39714
39865
|
const focusOutside = useFocusOutside((event) => {
|
|
39866
|
+
if (deferPointerDownOutside && isDeferredPointerDownOutsideRef.current) {
|
|
39867
|
+
return;
|
|
39868
|
+
}
|
|
39715
39869
|
const target = event.target;
|
|
39716
39870
|
const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
39717
39871
|
if (isFocusInBranch) return;
|
|
@@ -39740,8 +39894,11 @@ var DismissableLayer = React24.forwardRef(
|
|
|
39740
39894
|
context.layers.add(node);
|
|
39741
39895
|
dispatchUpdate();
|
|
39742
39896
|
return () => {
|
|
39743
|
-
if (disableOutsidePointerEvents
|
|
39744
|
-
|
|
39897
|
+
if (disableOutsidePointerEvents) {
|
|
39898
|
+
context.layersWithOutsidePointerEventsDisabled.delete(node);
|
|
39899
|
+
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
39900
|
+
ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
|
|
39901
|
+
}
|
|
39745
39902
|
}
|
|
39746
39903
|
};
|
|
39747
39904
|
}, [node, ownerDocument, disableOutsidePointerEvents, context]);
|
|
@@ -39758,7 +39915,7 @@ var DismissableLayer = React24.forwardRef(
|
|
|
39758
39915
|
document.addEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
39759
39916
|
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
39760
39917
|
}, []);
|
|
39761
|
-
return /* @__PURE__ */
|
|
39918
|
+
return /* @__PURE__ */ jsx25(
|
|
39762
39919
|
Primitive.div,
|
|
39763
39920
|
{
|
|
39764
39921
|
...layerProps,
|
|
@@ -39792,39 +39949,98 @@ var DismissableLayerBranch = React24.forwardRef((props, forwardedRef) => {
|
|
|
39792
39949
|
};
|
|
39793
39950
|
}
|
|
39794
39951
|
}, [context.branches]);
|
|
39795
|
-
return /* @__PURE__ */
|
|
39952
|
+
return /* @__PURE__ */ jsx25(Primitive.div, { ...props, ref: composedRefs });
|
|
39796
39953
|
});
|
|
39797
39954
|
DismissableLayerBranch.displayName = BRANCH_NAME;
|
|
39798
|
-
function usePointerDownOutside(onPointerDownOutside,
|
|
39955
|
+
function usePointerDownOutside(onPointerDownOutside, args) {
|
|
39956
|
+
const {
|
|
39957
|
+
ownerDocument = globalThis?.document,
|
|
39958
|
+
deferPointerDownOutside = false,
|
|
39959
|
+
isDeferredPointerDownOutsideRef,
|
|
39960
|
+
dismissableSurfaces
|
|
39961
|
+
} = args;
|
|
39799
39962
|
const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);
|
|
39800
39963
|
const isPointerInsideReactTreeRef = React24.useRef(false);
|
|
39964
|
+
const isPointerDownOutsideRef = React24.useRef(false);
|
|
39965
|
+
const interceptedOutsideInteractionEventsRef = React24.useRef(/* @__PURE__ */ new Map());
|
|
39801
39966
|
const handleClickRef = React24.useRef(() => {
|
|
39802
39967
|
});
|
|
39803
39968
|
React24.useEffect(() => {
|
|
39969
|
+
function resetOutsideInteraction() {
|
|
39970
|
+
isPointerDownOutsideRef.current = false;
|
|
39971
|
+
isDeferredPointerDownOutsideRef.current = false;
|
|
39972
|
+
interceptedOutsideInteractionEventsRef.current.clear();
|
|
39973
|
+
}
|
|
39974
|
+
function isOutsideInteractionIntercepted() {
|
|
39975
|
+
return Array.from(interceptedOutsideInteractionEventsRef.current.values()).some(Boolean);
|
|
39976
|
+
}
|
|
39977
|
+
function handleInteractionCapture(event) {
|
|
39978
|
+
if (!isPointerDownOutsideRef.current) {
|
|
39979
|
+
return;
|
|
39980
|
+
}
|
|
39981
|
+
const target = event.target;
|
|
39982
|
+
const isDismissableSurface = target instanceof Node && [...dismissableSurfaces].some((surface) => surface.contains(target));
|
|
39983
|
+
if (!isDismissableSurface) {
|
|
39984
|
+
interceptedOutsideInteractionEventsRef.current.set(event.type, true);
|
|
39985
|
+
}
|
|
39986
|
+
if (event.type === "click") {
|
|
39987
|
+
window.setTimeout(() => {
|
|
39988
|
+
if (isPointerDownOutsideRef.current) {
|
|
39989
|
+
handleClickRef.current();
|
|
39990
|
+
}
|
|
39991
|
+
}, 0);
|
|
39992
|
+
}
|
|
39993
|
+
}
|
|
39994
|
+
function handleInteractionBubble(event) {
|
|
39995
|
+
if (isPointerDownOutsideRef.current) {
|
|
39996
|
+
interceptedOutsideInteractionEventsRef.current.set(event.type, false);
|
|
39997
|
+
}
|
|
39998
|
+
}
|
|
39804
39999
|
const handlePointerDown = (event) => {
|
|
39805
40000
|
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
39806
40001
|
let handleAndDispatchPointerDownOutsideEvent2 = function() {
|
|
39807
|
-
|
|
39808
|
-
|
|
39809
|
-
|
|
39810
|
-
|
|
39811
|
-
|
|
39812
|
-
|
|
40002
|
+
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
40003
|
+
const wasOutsideInteractionIntercepted = isOutsideInteractionIntercepted();
|
|
40004
|
+
resetOutsideInteraction();
|
|
40005
|
+
if (!wasOutsideInteractionIntercepted) {
|
|
40006
|
+
handleAndDispatchCustomEvent(
|
|
40007
|
+
POINTER_DOWN_OUTSIDE,
|
|
40008
|
+
handlePointerDownOutside,
|
|
40009
|
+
eventDetail,
|
|
40010
|
+
{ discrete: true }
|
|
40011
|
+
);
|
|
40012
|
+
}
|
|
39813
40013
|
};
|
|
39814
40014
|
var handleAndDispatchPointerDownOutsideEvent = handleAndDispatchPointerDownOutsideEvent2;
|
|
39815
40015
|
const eventDetail = { originalEvent: event };
|
|
39816
|
-
|
|
40016
|
+
isPointerDownOutsideRef.current = true;
|
|
40017
|
+
isDeferredPointerDownOutsideRef.current = deferPointerDownOutside && event.button === 0;
|
|
40018
|
+
interceptedOutsideInteractionEventsRef.current.clear();
|
|
40019
|
+
if (!deferPointerDownOutside || event.button !== 0) {
|
|
40020
|
+
handleAndDispatchPointerDownOutsideEvent2();
|
|
40021
|
+
} else {
|
|
39817
40022
|
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
39818
40023
|
handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
|
|
39819
40024
|
ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
|
|
39820
|
-
} else {
|
|
39821
|
-
handleAndDispatchPointerDownOutsideEvent2();
|
|
39822
40025
|
}
|
|
39823
40026
|
} else {
|
|
39824
40027
|
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
40028
|
+
resetOutsideInteraction();
|
|
39825
40029
|
}
|
|
39826
40030
|
isPointerInsideReactTreeRef.current = false;
|
|
39827
40031
|
};
|
|
40032
|
+
const outsideInteractionEvents = [
|
|
40033
|
+
"pointerup",
|
|
40034
|
+
"mousedown",
|
|
40035
|
+
"mouseup",
|
|
40036
|
+
"touchstart",
|
|
40037
|
+
"touchend",
|
|
40038
|
+
"click"
|
|
40039
|
+
];
|
|
40040
|
+
for (const eventName of outsideInteractionEvents) {
|
|
40041
|
+
ownerDocument.addEventListener(eventName, handleInteractionCapture, true);
|
|
40042
|
+
ownerDocument.addEventListener(eventName, handleInteractionBubble);
|
|
40043
|
+
}
|
|
39828
40044
|
const timerId = window.setTimeout(() => {
|
|
39829
40045
|
ownerDocument.addEventListener("pointerdown", handlePointerDown);
|
|
39830
40046
|
}, 0);
|
|
@@ -39832,8 +40048,18 @@ function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?
|
|
|
39832
40048
|
window.clearTimeout(timerId);
|
|
39833
40049
|
ownerDocument.removeEventListener("pointerdown", handlePointerDown);
|
|
39834
40050
|
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
40051
|
+
for (const eventName of outsideInteractionEvents) {
|
|
40052
|
+
ownerDocument.removeEventListener(eventName, handleInteractionCapture, true);
|
|
40053
|
+
ownerDocument.removeEventListener(eventName, handleInteractionBubble);
|
|
40054
|
+
}
|
|
39835
40055
|
};
|
|
39836
|
-
}, [
|
|
40056
|
+
}, [
|
|
40057
|
+
ownerDocument,
|
|
40058
|
+
handlePointerDownOutside,
|
|
40059
|
+
deferPointerDownOutside,
|
|
40060
|
+
isDeferredPointerDownOutsideRef,
|
|
40061
|
+
dismissableSurfaces
|
|
40062
|
+
]);
|
|
39837
40063
|
return {
|
|
39838
40064
|
// ensures we check React component tree (not just DOM tree)
|
|
39839
40065
|
onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
|
|
@@ -39877,17 +40103,27 @@ function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
|
|
|
39877
40103
|
// node_modules/@radix-ui/react-focus-guards/dist/index.mjs
|
|
39878
40104
|
import * as React25 from "react";
|
|
39879
40105
|
var count = 0;
|
|
40106
|
+
var guards = null;
|
|
39880
40107
|
function useFocusGuards() {
|
|
39881
40108
|
React25.useEffect(() => {
|
|
39882
|
-
|
|
39883
|
-
|
|
39884
|
-
|
|
40109
|
+
if (!guards) {
|
|
40110
|
+
guards = { start: createFocusGuard(), end: createFocusGuard() };
|
|
40111
|
+
}
|
|
40112
|
+
const { start, end } = guards;
|
|
40113
|
+
if (document.body.firstElementChild !== start) {
|
|
40114
|
+
document.body.insertAdjacentElement("afterbegin", start);
|
|
40115
|
+
}
|
|
40116
|
+
if (document.body.lastElementChild !== end) {
|
|
40117
|
+
document.body.insertAdjacentElement("beforeend", end);
|
|
40118
|
+
}
|
|
39885
40119
|
count++;
|
|
39886
40120
|
return () => {
|
|
39887
40121
|
if (count === 1) {
|
|
39888
|
-
|
|
40122
|
+
guards?.start.remove();
|
|
40123
|
+
guards?.end.remove();
|
|
40124
|
+
guards = null;
|
|
39889
40125
|
}
|
|
39890
|
-
count
|
|
40126
|
+
count = Math.max(0, count - 1);
|
|
39891
40127
|
};
|
|
39892
40128
|
}, []);
|
|
39893
40129
|
}
|
|
@@ -39904,7 +40140,7 @@ function createFocusGuard() {
|
|
|
39904
40140
|
|
|
39905
40141
|
// node_modules/@radix-ui/react-focus-scope/dist/index.mjs
|
|
39906
40142
|
import * as React26 from "react";
|
|
39907
|
-
import { jsx as
|
|
40143
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
39908
40144
|
var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
|
|
39909
40145
|
var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
|
|
39910
40146
|
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
|
@@ -40023,7 +40259,7 @@ var FocusScope = React26.forwardRef((props, forwardedRef) => {
|
|
|
40023
40259
|
},
|
|
40024
40260
|
[loop, trapped, focusScope.paused]
|
|
40025
40261
|
);
|
|
40026
|
-
return /* @__PURE__ */
|
|
40262
|
+
return /* @__PURE__ */ jsx26(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
|
|
40027
40263
|
});
|
|
40028
40264
|
FocusScope.displayName = FOCUS_SCOPE_NAME;
|
|
40029
40265
|
function focusFirst(candidates, { select = false } = {}) {
|
|
@@ -42051,11 +42287,11 @@ var arrow3 = (options, deps) => {
|
|
|
42051
42287
|
|
|
42052
42288
|
// node_modules/@radix-ui/react-arrow/dist/index.mjs
|
|
42053
42289
|
import * as React29 from "react";
|
|
42054
|
-
import { jsx as
|
|
42290
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
42055
42291
|
var NAME = "Arrow";
|
|
42056
42292
|
var Arrow = React29.forwardRef((props, forwardedRef) => {
|
|
42057
42293
|
const { children, width: width10 = 10, height: height10 = 5, ...arrowProps } = props;
|
|
42058
|
-
return /* @__PURE__ */
|
|
42294
|
+
return /* @__PURE__ */ jsx27(
|
|
42059
42295
|
Primitive.svg,
|
|
42060
42296
|
{
|
|
42061
42297
|
...arrowProps,
|
|
@@ -42064,7 +42300,7 @@ var Arrow = React29.forwardRef((props, forwardedRef) => {
|
|
|
42064
42300
|
height: height10,
|
|
42065
42301
|
viewBox: "0 0 30 10",
|
|
42066
42302
|
preserveAspectRatio: "none",
|
|
42067
|
-
children: props.asChild ? children : /* @__PURE__ */
|
|
42303
|
+
children: props.asChild ? children : /* @__PURE__ */ jsx27("polygon", { points: "0,0 30,0 15,10" })
|
|
42068
42304
|
}
|
|
42069
42305
|
);
|
|
42070
42306
|
});
|
|
@@ -42109,14 +42345,25 @@ function useSize(element) {
|
|
|
42109
42345
|
}
|
|
42110
42346
|
|
|
42111
42347
|
// node_modules/@radix-ui/react-popper/dist/index.mjs
|
|
42112
|
-
import { jsx as
|
|
42348
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
42113
42349
|
var POPPER_NAME = "Popper";
|
|
42114
42350
|
var [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME);
|
|
42115
42351
|
var [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);
|
|
42116
42352
|
var Popper = (props) => {
|
|
42117
42353
|
const { __scopePopper, children } = props;
|
|
42118
42354
|
const [anchor, setAnchor] = React31.useState(null);
|
|
42119
|
-
|
|
42355
|
+
const [placementState, setPlacementState] = React31.useState(void 0);
|
|
42356
|
+
return /* @__PURE__ */ jsx28(
|
|
42357
|
+
PopperProvider,
|
|
42358
|
+
{
|
|
42359
|
+
scope: __scopePopper,
|
|
42360
|
+
anchor,
|
|
42361
|
+
onAnchorChange: setAnchor,
|
|
42362
|
+
placementState,
|
|
42363
|
+
setPlacementState,
|
|
42364
|
+
children
|
|
42365
|
+
}
|
|
42366
|
+
);
|
|
42120
42367
|
};
|
|
42121
42368
|
Popper.displayName = POPPER_NAME;
|
|
42122
42369
|
var ANCHOR_NAME = "PopperAnchor";
|
|
@@ -42125,16 +42372,40 @@ var PopperAnchor = React31.forwardRef(
|
|
|
42125
42372
|
const { __scopePopper, virtualRef, ...anchorProps } = props;
|
|
42126
42373
|
const context = usePopperContext(ANCHOR_NAME, __scopePopper);
|
|
42127
42374
|
const ref = React31.useRef(null);
|
|
42128
|
-
const
|
|
42375
|
+
const onAnchorChange = context.onAnchorChange;
|
|
42376
|
+
const callbackRef = React31.useCallback(
|
|
42377
|
+
(node) => {
|
|
42378
|
+
ref.current = node;
|
|
42379
|
+
if (node) {
|
|
42380
|
+
onAnchorChange(node);
|
|
42381
|
+
}
|
|
42382
|
+
},
|
|
42383
|
+
[onAnchorChange]
|
|
42384
|
+
);
|
|
42385
|
+
const composedRefs = useComposedRefs(forwardedRef, callbackRef);
|
|
42129
42386
|
const anchorRef = React31.useRef(null);
|
|
42130
42387
|
React31.useEffect(() => {
|
|
42388
|
+
if (!virtualRef) {
|
|
42389
|
+
return;
|
|
42390
|
+
}
|
|
42131
42391
|
const previousAnchor = anchorRef.current;
|
|
42132
|
-
anchorRef.current = virtualRef
|
|
42392
|
+
anchorRef.current = virtualRef.current;
|
|
42133
42393
|
if (previousAnchor !== anchorRef.current) {
|
|
42134
|
-
|
|
42394
|
+
onAnchorChange(anchorRef.current);
|
|
42135
42395
|
}
|
|
42136
42396
|
});
|
|
42137
|
-
|
|
42397
|
+
const sideAndAlign = context.placementState && getSideAndAlignFromPlacement(context.placementState);
|
|
42398
|
+
const placedSide = sideAndAlign?.[0];
|
|
42399
|
+
const placedAlign = sideAndAlign?.[1];
|
|
42400
|
+
return virtualRef ? null : /* @__PURE__ */ jsx28(
|
|
42401
|
+
Primitive.div,
|
|
42402
|
+
{
|
|
42403
|
+
"data-radix-popper-side": placedSide,
|
|
42404
|
+
"data-radix-popper-align": placedAlign,
|
|
42405
|
+
...anchorProps,
|
|
42406
|
+
ref: composedRefs
|
|
42407
|
+
}
|
|
42408
|
+
);
|
|
42138
42409
|
}
|
|
42139
42410
|
);
|
|
42140
42411
|
PopperAnchor.displayName = ANCHOR_NAME;
|
|
@@ -42210,9 +42481,27 @@ var PopperContent = React31.forwardRef(
|
|
|
42210
42481
|
}),
|
|
42211
42482
|
arrow4 && arrow3({ element: arrow4, padding: arrowPadding }),
|
|
42212
42483
|
transformOrigin({ arrowWidth, arrowHeight }),
|
|
42213
|
-
hideWhenDetached && hide3({
|
|
42484
|
+
hideWhenDetached && hide3({
|
|
42485
|
+
strategy: "referenceHidden",
|
|
42486
|
+
...detectOverflowOptions,
|
|
42487
|
+
// `hide` detects whether the anchor (reference) is clipped, so when
|
|
42488
|
+
// no explicit `collisionBoundary` is set we fall back to Floating
|
|
42489
|
+
// UI's default clipping ancestors (e.g. a scrollable menu). This
|
|
42490
|
+
// lets an occluded submenu hide once its anchor scrolls out of view
|
|
42491
|
+
// (#3237). The collision/size middlewares deliberately keep the
|
|
42492
|
+
// viewport-based default to avoid clamping content rendered inside
|
|
42493
|
+
// transformed or overflow-clipping portal containers.
|
|
42494
|
+
boundary: hasExplicitBoundaries ? detectOverflowOptions.boundary : void 0
|
|
42495
|
+
})
|
|
42214
42496
|
]
|
|
42215
42497
|
});
|
|
42498
|
+
const setPlacementState = context.setPlacementState;
|
|
42499
|
+
useLayoutEffect2(() => {
|
|
42500
|
+
setPlacementState(placement);
|
|
42501
|
+
return () => {
|
|
42502
|
+
setPlacementState(void 0);
|
|
42503
|
+
};
|
|
42504
|
+
}, [placement, setPlacementState]);
|
|
42216
42505
|
const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
|
|
42217
42506
|
const handlePlaced = useCallbackRef(onPlaced);
|
|
42218
42507
|
useLayoutEffect2(() => {
|
|
@@ -42227,7 +42516,7 @@ var PopperContent = React31.forwardRef(
|
|
|
42227
42516
|
useLayoutEffect2(() => {
|
|
42228
42517
|
if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
|
|
42229
42518
|
}, [content]);
|
|
42230
|
-
return /* @__PURE__ */
|
|
42519
|
+
return /* @__PURE__ */ jsx28(
|
|
42231
42520
|
"div",
|
|
42232
42521
|
{
|
|
42233
42522
|
ref: refs.setFloating,
|
|
@@ -42238,7 +42527,7 @@ var PopperContent = React31.forwardRef(
|
|
|
42238
42527
|
// keep off the page when measuring
|
|
42239
42528
|
minWidth: "max-content",
|
|
42240
42529
|
zIndex: contentZIndex,
|
|
42241
|
-
|
|
42530
|
+
"--radix-popper-transform-origin": [
|
|
42242
42531
|
middlewareData.transformOrigin?.x,
|
|
42243
42532
|
middlewareData.transformOrigin?.y
|
|
42244
42533
|
].join(" "),
|
|
@@ -42251,16 +42540,17 @@ var PopperContent = React31.forwardRef(
|
|
|
42251
42540
|
}
|
|
42252
42541
|
},
|
|
42253
42542
|
dir: props.dir,
|
|
42254
|
-
children: /* @__PURE__ */
|
|
42543
|
+
children: /* @__PURE__ */ jsx28(
|
|
42255
42544
|
PopperContentProvider,
|
|
42256
42545
|
{
|
|
42257
42546
|
scope: __scopePopper,
|
|
42258
42547
|
placedSide,
|
|
42548
|
+
placedAlign,
|
|
42259
42549
|
onArrowChange: setArrow,
|
|
42260
42550
|
arrowX,
|
|
42261
42551
|
arrowY,
|
|
42262
42552
|
shouldHideArrow: cannotCenterArrow,
|
|
42263
|
-
children: /* @__PURE__ */
|
|
42553
|
+
children: /* @__PURE__ */ jsx28(
|
|
42264
42554
|
Primitive.div,
|
|
42265
42555
|
{
|
|
42266
42556
|
"data-side": placedSide,
|
|
@@ -42297,7 +42587,7 @@ var PopperArrow = React31.forwardRef(function PopperArrow2(props, forwardedRef)
|
|
|
42297
42587
|
// we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
|
|
42298
42588
|
// doesn't report size as we'd expect on SVG elements.
|
|
42299
42589
|
// it reports their bounding box which is effectively the largest path inside the SVG.
|
|
42300
|
-
/* @__PURE__ */
|
|
42590
|
+
/* @__PURE__ */ jsx28(
|
|
42301
42591
|
"span",
|
|
42302
42592
|
{
|
|
42303
42593
|
ref: contentContext.onArrowChange,
|
|
@@ -42320,7 +42610,7 @@ var PopperArrow = React31.forwardRef(function PopperArrow2(props, forwardedRef)
|
|
|
42320
42610
|
}[contentContext.placedSide],
|
|
42321
42611
|
visibility: contentContext.shouldHideArrow ? "hidden" : void 0
|
|
42322
42612
|
},
|
|
42323
|
-
children: /* @__PURE__ */
|
|
42613
|
+
children: /* @__PURE__ */ jsx28(
|
|
42324
42614
|
Root,
|
|
42325
42615
|
{
|
|
42326
42616
|
...arrowProps,
|
|
@@ -42382,15 +42672,15 @@ var Arrow2 = PopperArrow;
|
|
|
42382
42672
|
|
|
42383
42673
|
// node_modules/@radix-ui/react-portal/dist/index.mjs
|
|
42384
42674
|
import * as React32 from "react";
|
|
42385
|
-
import ReactDOM4 from "react-dom";
|
|
42386
|
-
import { jsx as
|
|
42675
|
+
import * as ReactDOM4 from "react-dom";
|
|
42676
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
42387
42677
|
var PORTAL_NAME = "Portal";
|
|
42388
42678
|
var Portal = React32.forwardRef((props, forwardedRef) => {
|
|
42389
42679
|
const { container: containerProp, ...portalProps } = props;
|
|
42390
42680
|
const [mounted, setMounted] = React32.useState(false);
|
|
42391
42681
|
useLayoutEffect2(() => setMounted(true), []);
|
|
42392
42682
|
const container = containerProp || mounted && globalThis?.document?.body;
|
|
42393
|
-
return container ? ReactDOM4.createPortal(/* @__PURE__ */
|
|
42683
|
+
return container ? ReactDOM4.createPortal(/* @__PURE__ */ jsx29(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
|
|
42394
42684
|
});
|
|
42395
42685
|
Portal.displayName = PORTAL_NAME;
|
|
42396
42686
|
|
|
@@ -42407,7 +42697,7 @@ var Presence = (props) => {
|
|
|
42407
42697
|
const { present, children } = props;
|
|
42408
42698
|
const presence = usePresence(present);
|
|
42409
42699
|
const child = typeof children === "function" ? children({ present: presence.isPresent }) : React210.Children.only(children);
|
|
42410
|
-
const ref =
|
|
42700
|
+
const ref = useStableComposedRefs(presence.ref, getElementRef2(child));
|
|
42411
42701
|
const forceMount = typeof children === "function";
|
|
42412
42702
|
return forceMount || presence.isPresent ? React210.cloneElement(child, { ref }) : null;
|
|
42413
42703
|
};
|
|
@@ -42503,6 +42793,40 @@ function usePresence(present) {
|
|
|
42503
42793
|
}, [])
|
|
42504
42794
|
};
|
|
42505
42795
|
}
|
|
42796
|
+
function setRef2(ref, value) {
|
|
42797
|
+
if (typeof ref === "function") {
|
|
42798
|
+
return ref(value);
|
|
42799
|
+
} else if (ref !== null && ref !== void 0) {
|
|
42800
|
+
ref.current = value;
|
|
42801
|
+
}
|
|
42802
|
+
}
|
|
42803
|
+
function useStableComposedRefs(...refs) {
|
|
42804
|
+
const refsRef = React210.useRef(refs);
|
|
42805
|
+
refsRef.current = refs;
|
|
42806
|
+
return React210.useCallback((node) => {
|
|
42807
|
+
const currentRefs = refsRef.current;
|
|
42808
|
+
let hasCleanup = false;
|
|
42809
|
+
const cleanups = currentRefs.map((ref) => {
|
|
42810
|
+
const cleanup = setRef2(ref, node);
|
|
42811
|
+
if (!hasCleanup && typeof cleanup === "function") {
|
|
42812
|
+
hasCleanup = true;
|
|
42813
|
+
}
|
|
42814
|
+
return cleanup;
|
|
42815
|
+
});
|
|
42816
|
+
if (hasCleanup) {
|
|
42817
|
+
return () => {
|
|
42818
|
+
for (let i = 0; i < cleanups.length; i++) {
|
|
42819
|
+
const cleanup = cleanups[i];
|
|
42820
|
+
if (typeof cleanup === "function") {
|
|
42821
|
+
cleanup();
|
|
42822
|
+
} else {
|
|
42823
|
+
setRef2(currentRefs[i], null);
|
|
42824
|
+
}
|
|
42825
|
+
}
|
|
42826
|
+
};
|
|
42827
|
+
}
|
|
42828
|
+
}, []);
|
|
42829
|
+
}
|
|
42506
42830
|
function getAnimationName(styles) {
|
|
42507
42831
|
return styles?.animationName || "none";
|
|
42508
42832
|
}
|
|
@@ -42522,7 +42846,7 @@ function getElementRef2(element) {
|
|
|
42522
42846
|
|
|
42523
42847
|
// node_modules/@radix-ui/react-roving-focus/dist/index.mjs
|
|
42524
42848
|
import * as React34 from "react";
|
|
42525
|
-
import { jsx as
|
|
42849
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
42526
42850
|
var ENTRY_FOCUS = "rovingFocusGroup.onEntryFocus";
|
|
42527
42851
|
var EVENT_OPTIONS2 = { bubbles: false, cancelable: true };
|
|
42528
42852
|
var GROUP_NAME = "RovingFocusGroup";
|
|
@@ -42534,7 +42858,7 @@ var [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContext
|
|
|
42534
42858
|
var [RovingFocusProvider, useRovingFocusContext] = createRovingFocusGroupContext(GROUP_NAME);
|
|
42535
42859
|
var RovingFocusGroup = React34.forwardRef(
|
|
42536
42860
|
(props, forwardedRef) => {
|
|
42537
|
-
return /* @__PURE__ */
|
|
42861
|
+
return /* @__PURE__ */ jsx30(Collection.Provider, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx30(Collection.Slot, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx30(RovingFocusGroupImpl, { ...props, ref: forwardedRef }) }) });
|
|
42538
42862
|
}
|
|
42539
42863
|
);
|
|
42540
42864
|
RovingFocusGroup.displayName = GROUP_NAME;
|
|
@@ -42572,7 +42896,7 @@ var RovingFocusGroupImpl = React34.forwardRef((props, forwardedRef) => {
|
|
|
42572
42896
|
return () => node.removeEventListener(ENTRY_FOCUS, handleEntryFocus);
|
|
42573
42897
|
}
|
|
42574
42898
|
}, [handleEntryFocus]);
|
|
42575
|
-
return /* @__PURE__ */
|
|
42899
|
+
return /* @__PURE__ */ jsx30(
|
|
42576
42900
|
RovingFocusProvider,
|
|
42577
42901
|
{
|
|
42578
42902
|
scope: __scopeRovingFocusGroup,
|
|
@@ -42593,7 +42917,7 @@ var RovingFocusGroupImpl = React34.forwardRef((props, forwardedRef) => {
|
|
|
42593
42917
|
() => setFocusableItemsCount((prevCount) => prevCount - 1),
|
|
42594
42918
|
[]
|
|
42595
42919
|
),
|
|
42596
|
-
children: /* @__PURE__ */
|
|
42920
|
+
children: /* @__PURE__ */ jsx30(
|
|
42597
42921
|
Primitive.div,
|
|
42598
42922
|
{
|
|
42599
42923
|
tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,
|
|
@@ -42651,14 +42975,14 @@ var RovingFocusGroupItem = React34.forwardRef(
|
|
|
42651
42975
|
return () => onFocusableItemRemove();
|
|
42652
42976
|
}
|
|
42653
42977
|
}, [focusable, onFocusableItemAdd, onFocusableItemRemove]);
|
|
42654
|
-
return /* @__PURE__ */
|
|
42978
|
+
return /* @__PURE__ */ jsx30(
|
|
42655
42979
|
Collection.ItemSlot,
|
|
42656
42980
|
{
|
|
42657
42981
|
scope: __scopeRovingFocusGroup,
|
|
42658
42982
|
id,
|
|
42659
42983
|
focusable,
|
|
42660
42984
|
active,
|
|
42661
|
-
children: /* @__PURE__ */
|
|
42985
|
+
children: /* @__PURE__ */ jsx30(
|
|
42662
42986
|
Primitive.span,
|
|
42663
42987
|
{
|
|
42664
42988
|
tabIndex: isCurrentTabStop ? 0 : -1,
|
|
@@ -42909,9 +43233,9 @@ function assignRef(ref, value) {
|
|
|
42909
43233
|
}
|
|
42910
43234
|
|
|
42911
43235
|
// node_modules/use-callback-ref/dist/es2015/useRef.js
|
|
42912
|
-
import { useState as
|
|
43236
|
+
import { useState as useState30 } from "react";
|
|
42913
43237
|
function useCallbackRef2(initialValue, callback) {
|
|
42914
|
-
var ref =
|
|
43238
|
+
var ref = useState30(function() {
|
|
42915
43239
|
return {
|
|
42916
43240
|
// value
|
|
42917
43241
|
value: initialValue,
|
|
@@ -43575,7 +43899,7 @@ ReactRemoveScroll.classNames = RemoveScroll.classNames;
|
|
|
43575
43899
|
var Combination_default = ReactRemoveScroll;
|
|
43576
43900
|
|
|
43577
43901
|
// node_modules/@radix-ui/react-menu/dist/index.mjs
|
|
43578
|
-
import { jsx as
|
|
43902
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
43579
43903
|
var SELECTION_KEYS = ["Enter", " "];
|
|
43580
43904
|
var FIRST_KEYS = ["ArrowDown", "PageUp", "Home"];
|
|
43581
43905
|
var LAST_KEYS = ["ArrowUp", "PageDown", "End"];
|
|
@@ -43620,7 +43944,15 @@ var Menu = (props) => {
|
|
|
43620
43944
|
document.removeEventListener("pointermove", handlePointer, { capture: true });
|
|
43621
43945
|
};
|
|
43622
43946
|
}, []);
|
|
43623
|
-
|
|
43947
|
+
React42.useEffect(() => {
|
|
43948
|
+
if (!open) {
|
|
43949
|
+
return;
|
|
43950
|
+
}
|
|
43951
|
+
const handleBlur = () => handleOpenChange(false);
|
|
43952
|
+
window.addEventListener("blur", handleBlur);
|
|
43953
|
+
return () => window.removeEventListener("blur", handleBlur);
|
|
43954
|
+
}, [open, handleOpenChange]);
|
|
43955
|
+
return /* @__PURE__ */ jsx31(Root2, { ...popperScope, children: /* @__PURE__ */ jsx31(
|
|
43624
43956
|
MenuProvider,
|
|
43625
43957
|
{
|
|
43626
43958
|
scope: __scopeMenu,
|
|
@@ -43628,7 +43960,7 @@ var Menu = (props) => {
|
|
|
43628
43960
|
onOpenChange: handleOpenChange,
|
|
43629
43961
|
content,
|
|
43630
43962
|
onContentChange: setContent,
|
|
43631
|
-
children: /* @__PURE__ */
|
|
43963
|
+
children: /* @__PURE__ */ jsx31(
|
|
43632
43964
|
MenuRootProvider,
|
|
43633
43965
|
{
|
|
43634
43966
|
scope: __scopeMenu,
|
|
@@ -43648,7 +43980,7 @@ var MenuAnchor = React42.forwardRef(
|
|
|
43648
43980
|
(props, forwardedRef) => {
|
|
43649
43981
|
const { __scopeMenu, ...anchorProps } = props;
|
|
43650
43982
|
const popperScope = usePopperScope(__scopeMenu);
|
|
43651
|
-
return /* @__PURE__ */
|
|
43983
|
+
return /* @__PURE__ */ jsx31(Anchor, { ...popperScope, ...anchorProps, ref: forwardedRef });
|
|
43652
43984
|
}
|
|
43653
43985
|
);
|
|
43654
43986
|
MenuAnchor.displayName = ANCHOR_NAME2;
|
|
@@ -43659,7 +43991,7 @@ var [PortalProvider, usePortalContext] = createMenuContext(PORTAL_NAME2, {
|
|
|
43659
43991
|
var MenuPortal = (props) => {
|
|
43660
43992
|
const { __scopeMenu, forceMount, children, container } = props;
|
|
43661
43993
|
const context = useMenuContext(PORTAL_NAME2, __scopeMenu);
|
|
43662
|
-
return /* @__PURE__ */
|
|
43994
|
+
return /* @__PURE__ */ jsx31(PortalProvider, { scope: __scopeMenu, forceMount, children: /* @__PURE__ */ jsx31(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx31(Portal, { asChild: true, container, children }) }) });
|
|
43663
43995
|
};
|
|
43664
43996
|
MenuPortal.displayName = PORTAL_NAME2;
|
|
43665
43997
|
var CONTENT_NAME2 = "MenuContent";
|
|
@@ -43670,7 +44002,7 @@ var MenuContent = React42.forwardRef(
|
|
|
43670
44002
|
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
43671
44003
|
const context = useMenuContext(CONTENT_NAME2, props.__scopeMenu);
|
|
43672
44004
|
const rootContext = useMenuRootContext(CONTENT_NAME2, props.__scopeMenu);
|
|
43673
|
-
return /* @__PURE__ */
|
|
44005
|
+
return /* @__PURE__ */ jsx31(Collection2.Provider, { scope: props.__scopeMenu, children: /* @__PURE__ */ jsx31(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx31(Collection2.Slot, { scope: props.__scopeMenu, children: rootContext.modal ? /* @__PURE__ */ jsx31(MenuRootContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx31(MenuRootContentNonModal, { ...contentProps, ref: forwardedRef }) }) }) });
|
|
43674
44006
|
}
|
|
43675
44007
|
);
|
|
43676
44008
|
var MenuRootContentModal = React42.forwardRef(
|
|
@@ -43682,7 +44014,7 @@ var MenuRootContentModal = React42.forwardRef(
|
|
|
43682
44014
|
const content = ref.current;
|
|
43683
44015
|
if (content) return hideOthers(content);
|
|
43684
44016
|
}, []);
|
|
43685
|
-
return /* @__PURE__ */
|
|
44017
|
+
return /* @__PURE__ */ jsx31(
|
|
43686
44018
|
MenuContentImpl,
|
|
43687
44019
|
{
|
|
43688
44020
|
...props,
|
|
@@ -43702,7 +44034,7 @@ var MenuRootContentModal = React42.forwardRef(
|
|
|
43702
44034
|
);
|
|
43703
44035
|
var MenuRootContentNonModal = React42.forwardRef((props, forwardedRef) => {
|
|
43704
44036
|
const context = useMenuContext(CONTENT_NAME2, props.__scopeMenu);
|
|
43705
|
-
return /* @__PURE__ */
|
|
44037
|
+
return /* @__PURE__ */ jsx31(
|
|
43706
44038
|
MenuContentImpl,
|
|
43707
44039
|
{
|
|
43708
44040
|
...props,
|
|
@@ -43774,7 +44106,7 @@ var MenuContentImpl = React42.forwardRef(
|
|
|
43774
44106
|
const isMovingTowards = pointerDirRef.current === pointerGraceIntentRef.current?.side;
|
|
43775
44107
|
return isMovingTowards && isPointerInGraceArea(event, pointerGraceIntentRef.current?.area);
|
|
43776
44108
|
}, []);
|
|
43777
|
-
return /* @__PURE__ */
|
|
44109
|
+
return /* @__PURE__ */ jsx31(
|
|
43778
44110
|
MenuContentProvider,
|
|
43779
44111
|
{
|
|
43780
44112
|
scope: __scopeMenu,
|
|
@@ -43803,7 +44135,7 @@ var MenuContentImpl = React42.forwardRef(
|
|
|
43803
44135
|
onPointerGraceIntentChange: React42.useCallback((intent) => {
|
|
43804
44136
|
pointerGraceIntentRef.current = intent;
|
|
43805
44137
|
}, []),
|
|
43806
|
-
children: /* @__PURE__ */
|
|
44138
|
+
children: /* @__PURE__ */ jsx31(ScrollLockWrapper, { ...scrollLockWrapperProps, children: /* @__PURE__ */ jsx31(
|
|
43807
44139
|
FocusScope,
|
|
43808
44140
|
{
|
|
43809
44141
|
asChild: true,
|
|
@@ -43813,7 +44145,7 @@ var MenuContentImpl = React42.forwardRef(
|
|
|
43813
44145
|
contentRef.current?.focus({ preventScroll: true });
|
|
43814
44146
|
}),
|
|
43815
44147
|
onUnmountAutoFocus: onCloseAutoFocus,
|
|
43816
|
-
children: /* @__PURE__ */
|
|
44148
|
+
children: /* @__PURE__ */ jsx31(
|
|
43817
44149
|
DismissableLayer,
|
|
43818
44150
|
{
|
|
43819
44151
|
asChild: true,
|
|
@@ -43823,7 +44155,7 @@ var MenuContentImpl = React42.forwardRef(
|
|
|
43823
44155
|
onFocusOutside,
|
|
43824
44156
|
onInteractOutside,
|
|
43825
44157
|
onDismiss,
|
|
43826
|
-
children: /* @__PURE__ */
|
|
44158
|
+
children: /* @__PURE__ */ jsx31(
|
|
43827
44159
|
Root3,
|
|
43828
44160
|
{
|
|
43829
44161
|
asChild: true,
|
|
@@ -43837,7 +44169,7 @@ var MenuContentImpl = React42.forwardRef(
|
|
|
43837
44169
|
if (!rootContext.isUsingKeyboardRef.current) event.preventDefault();
|
|
43838
44170
|
}),
|
|
43839
44171
|
preventScrollOnEntryFocus: true,
|
|
43840
|
-
children: /* @__PURE__ */
|
|
44172
|
+
children: /* @__PURE__ */ jsx31(
|
|
43841
44173
|
Content,
|
|
43842
44174
|
{
|
|
43843
44175
|
role: "menu",
|
|
@@ -43902,7 +44234,7 @@ var GROUP_NAME2 = "MenuGroup";
|
|
|
43902
44234
|
var MenuGroup = React42.forwardRef(
|
|
43903
44235
|
(props, forwardedRef) => {
|
|
43904
44236
|
const { __scopeMenu, ...groupProps } = props;
|
|
43905
|
-
return /* @__PURE__ */
|
|
44237
|
+
return /* @__PURE__ */ jsx31(Primitive.div, { role: "group", ...groupProps, ref: forwardedRef });
|
|
43906
44238
|
}
|
|
43907
44239
|
);
|
|
43908
44240
|
MenuGroup.displayName = GROUP_NAME2;
|
|
@@ -43910,7 +44242,7 @@ var LABEL_NAME = "MenuLabel";
|
|
|
43910
44242
|
var MenuLabel = React42.forwardRef(
|
|
43911
44243
|
(props, forwardedRef) => {
|
|
43912
44244
|
const { __scopeMenu, ...labelProps } = props;
|
|
43913
|
-
return /* @__PURE__ */
|
|
44245
|
+
return /* @__PURE__ */ jsx31(Primitive.div, { ...labelProps, ref: forwardedRef });
|
|
43914
44246
|
}
|
|
43915
44247
|
);
|
|
43916
44248
|
MenuLabel.displayName = LABEL_NAME;
|
|
@@ -43937,7 +44269,7 @@ var MenuItem = React42.forwardRef(
|
|
|
43937
44269
|
}
|
|
43938
44270
|
}
|
|
43939
44271
|
};
|
|
43940
|
-
return /* @__PURE__ */
|
|
44272
|
+
return /* @__PURE__ */ jsx31(
|
|
43941
44273
|
MenuItemImpl,
|
|
43942
44274
|
{
|
|
43943
44275
|
...itemProps,
|
|
@@ -43979,13 +44311,13 @@ var MenuItemImpl = React42.forwardRef(
|
|
|
43979
44311
|
setTextContent((menuItem.textContent ?? "").trim());
|
|
43980
44312
|
}
|
|
43981
44313
|
}, [itemProps.children]);
|
|
43982
|
-
return /* @__PURE__ */
|
|
44314
|
+
return /* @__PURE__ */ jsx31(
|
|
43983
44315
|
Collection2.ItemSlot,
|
|
43984
44316
|
{
|
|
43985
44317
|
scope: __scopeMenu,
|
|
43986
44318
|
disabled,
|
|
43987
44319
|
textValue: textValue ?? textContent,
|
|
43988
|
-
children: /* @__PURE__ */
|
|
44320
|
+
children: /* @__PURE__ */ jsx31(Item, { asChild: true, ...rovingFocusGroupScope, focusable: !disabled, children: /* @__PURE__ */ jsx31(
|
|
43989
44321
|
Primitive.div,
|
|
43990
44322
|
{
|
|
43991
44323
|
role: "menuitem",
|
|
@@ -44024,7 +44356,7 @@ var CHECKBOX_ITEM_NAME = "MenuCheckboxItem";
|
|
|
44024
44356
|
var MenuCheckboxItem = React42.forwardRef(
|
|
44025
44357
|
(props, forwardedRef) => {
|
|
44026
44358
|
const { checked = false, onCheckedChange, ...checkboxItemProps } = props;
|
|
44027
|
-
return /* @__PURE__ */
|
|
44359
|
+
return /* @__PURE__ */ jsx31(ItemIndicatorProvider, { scope: props.__scopeMenu, checked, children: /* @__PURE__ */ jsx31(
|
|
44028
44360
|
MenuItem,
|
|
44029
44361
|
{
|
|
44030
44362
|
role: "menuitemcheckbox",
|
|
@@ -44052,7 +44384,7 @@ var MenuRadioGroup = React42.forwardRef(
|
|
|
44052
44384
|
(props, forwardedRef) => {
|
|
44053
44385
|
const { value, onValueChange, ...groupProps } = props;
|
|
44054
44386
|
const handleValueChange = useCallbackRef(onValueChange);
|
|
44055
|
-
return /* @__PURE__ */
|
|
44387
|
+
return /* @__PURE__ */ jsx31(RadioGroupProvider, { scope: props.__scopeMenu, value, onValueChange: handleValueChange, children: /* @__PURE__ */ jsx31(MenuGroup, { ...groupProps, ref: forwardedRef }) });
|
|
44056
44388
|
}
|
|
44057
44389
|
);
|
|
44058
44390
|
MenuRadioGroup.displayName = RADIO_GROUP_NAME;
|
|
@@ -44062,7 +44394,7 @@ var MenuRadioItem = React42.forwardRef(
|
|
|
44062
44394
|
const { value, ...radioItemProps } = props;
|
|
44063
44395
|
const context = useRadioGroupContext(RADIO_ITEM_NAME, props.__scopeMenu);
|
|
44064
44396
|
const checked = value === context.value;
|
|
44065
|
-
return /* @__PURE__ */
|
|
44397
|
+
return /* @__PURE__ */ jsx31(ItemIndicatorProvider, { scope: props.__scopeMenu, checked, children: /* @__PURE__ */ jsx31(
|
|
44066
44398
|
MenuItem,
|
|
44067
44399
|
{
|
|
44068
44400
|
role: "menuitemradio",
|
|
@@ -44089,11 +44421,11 @@ var MenuItemIndicator = React42.forwardRef(
|
|
|
44089
44421
|
(props, forwardedRef) => {
|
|
44090
44422
|
const { __scopeMenu, forceMount, ...itemIndicatorProps } = props;
|
|
44091
44423
|
const indicatorContext = useItemIndicatorContext(ITEM_INDICATOR_NAME, __scopeMenu);
|
|
44092
|
-
return /* @__PURE__ */
|
|
44424
|
+
return /* @__PURE__ */ jsx31(
|
|
44093
44425
|
Presence,
|
|
44094
44426
|
{
|
|
44095
44427
|
present: forceMount || isIndeterminate(indicatorContext.checked) || indicatorContext.checked === true,
|
|
44096
|
-
children: /* @__PURE__ */
|
|
44428
|
+
children: /* @__PURE__ */ jsx31(
|
|
44097
44429
|
Primitive.span,
|
|
44098
44430
|
{
|
|
44099
44431
|
...itemIndicatorProps,
|
|
@@ -44110,7 +44442,7 @@ var SEPARATOR_NAME = "MenuSeparator";
|
|
|
44110
44442
|
var MenuSeparator = React42.forwardRef(
|
|
44111
44443
|
(props, forwardedRef) => {
|
|
44112
44444
|
const { __scopeMenu, ...separatorProps } = props;
|
|
44113
|
-
return /* @__PURE__ */
|
|
44445
|
+
return /* @__PURE__ */ jsx31(
|
|
44114
44446
|
Primitive.div,
|
|
44115
44447
|
{
|
|
44116
44448
|
role: "separator",
|
|
@@ -44127,7 +44459,7 @@ var MenuArrow = React42.forwardRef(
|
|
|
44127
44459
|
(props, forwardedRef) => {
|
|
44128
44460
|
const { __scopeMenu, ...arrowProps } = props;
|
|
44129
44461
|
const popperScope = usePopperScope(__scopeMenu);
|
|
44130
|
-
return /* @__PURE__ */
|
|
44462
|
+
return /* @__PURE__ */ jsx31(Arrow2, { ...popperScope, ...arrowProps, ref: forwardedRef });
|
|
44131
44463
|
}
|
|
44132
44464
|
);
|
|
44133
44465
|
MenuArrow.displayName = ARROW_NAME2;
|
|
@@ -44144,7 +44476,7 @@ var MenuSub = (props) => {
|
|
|
44144
44476
|
if (parentMenuContext.open === false) handleOpenChange(false);
|
|
44145
44477
|
return () => handleOpenChange(false);
|
|
44146
44478
|
}, [parentMenuContext.open, handleOpenChange]);
|
|
44147
|
-
return /* @__PURE__ */
|
|
44479
|
+
return /* @__PURE__ */ jsx31(Root2, { ...popperScope, children: /* @__PURE__ */ jsx31(
|
|
44148
44480
|
MenuProvider,
|
|
44149
44481
|
{
|
|
44150
44482
|
scope: __scopeMenu,
|
|
@@ -44152,7 +44484,7 @@ var MenuSub = (props) => {
|
|
|
44152
44484
|
onOpenChange: handleOpenChange,
|
|
44153
44485
|
content,
|
|
44154
44486
|
onContentChange: setContent,
|
|
44155
|
-
children: /* @__PURE__ */
|
|
44487
|
+
children: /* @__PURE__ */ jsx31(
|
|
44156
44488
|
MenuSubProvider,
|
|
44157
44489
|
{
|
|
44158
44490
|
scope: __scopeMenu,
|
|
@@ -44189,13 +44521,13 @@ var MenuSubTrigger = React42.forwardRef(
|
|
|
44189
44521
|
onPointerGraceIntentChange(null);
|
|
44190
44522
|
};
|
|
44191
44523
|
}, [pointerGraceTimerRef, onPointerGraceIntentChange]);
|
|
44192
|
-
return /* @__PURE__ */
|
|
44524
|
+
return /* @__PURE__ */ jsx31(MenuAnchor, { asChild: true, ...scope, children: /* @__PURE__ */ jsx31(
|
|
44193
44525
|
MenuItemImpl,
|
|
44194
44526
|
{
|
|
44195
44527
|
id: subContext.triggerId,
|
|
44196
44528
|
"aria-haspopup": "menu",
|
|
44197
44529
|
"aria-expanded": context.open,
|
|
44198
|
-
"aria-controls": subContext.contentId,
|
|
44530
|
+
"aria-controls": context.open ? subContext.contentId : void 0,
|
|
44199
44531
|
"data-state": getOpenState(context.open),
|
|
44200
44532
|
...props,
|
|
44201
44533
|
ref: composeRefs(forwardedRef, subContext.onTriggerChange),
|
|
@@ -44272,20 +44604,20 @@ var SUB_CONTENT_NAME = "MenuSubContent";
|
|
|
44272
44604
|
var MenuSubContent = React42.forwardRef(
|
|
44273
44605
|
(props, forwardedRef) => {
|
|
44274
44606
|
const portalContext = usePortalContext(CONTENT_NAME2, props.__scopeMenu);
|
|
44275
|
-
const { forceMount = portalContext.forceMount, ...subContentProps } = props;
|
|
44607
|
+
const { forceMount = portalContext.forceMount, align = "start", ...subContentProps } = props;
|
|
44276
44608
|
const context = useMenuContext(CONTENT_NAME2, props.__scopeMenu);
|
|
44277
44609
|
const rootContext = useMenuRootContext(CONTENT_NAME2, props.__scopeMenu);
|
|
44278
44610
|
const subContext = useMenuSubContext(SUB_CONTENT_NAME, props.__scopeMenu);
|
|
44279
44611
|
const ref = React42.useRef(null);
|
|
44280
44612
|
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
44281
|
-
return /* @__PURE__ */
|
|
44613
|
+
return /* @__PURE__ */ jsx31(Collection2.Provider, { scope: props.__scopeMenu, children: /* @__PURE__ */ jsx31(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx31(Collection2.Slot, { scope: props.__scopeMenu, children: /* @__PURE__ */ jsx31(
|
|
44282
44614
|
MenuContentImpl,
|
|
44283
44615
|
{
|
|
44284
44616
|
id: subContext.contentId,
|
|
44285
44617
|
"aria-labelledby": subContext.triggerId,
|
|
44286
44618
|
...subContentProps,
|
|
44287
44619
|
ref: composedRefs,
|
|
44288
|
-
align
|
|
44620
|
+
align,
|
|
44289
44621
|
side: rootContext.dir === "rtl" ? "left" : "right",
|
|
44290
44622
|
disableOutsidePointerEvents: false,
|
|
44291
44623
|
disableOutsideScroll: false,
|
|
@@ -44389,7 +44721,7 @@ var SubTrigger = MenuSubTrigger;
|
|
|
44389
44721
|
var SubContent = MenuSubContent;
|
|
44390
44722
|
|
|
44391
44723
|
// node_modules/@radix-ui/react-dropdown-menu/dist/index.mjs
|
|
44392
|
-
import { jsx as
|
|
44724
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
44393
44725
|
var DROPDOWN_MENU_NAME = "DropdownMenu";
|
|
44394
44726
|
var [createDropdownMenuContext, createDropdownMenuScope] = createContextScope(
|
|
44395
44727
|
DROPDOWN_MENU_NAME,
|
|
@@ -44415,7 +44747,7 @@ var DropdownMenu = (props) => {
|
|
|
44415
44747
|
onChange: onOpenChange,
|
|
44416
44748
|
caller: DROPDOWN_MENU_NAME
|
|
44417
44749
|
});
|
|
44418
|
-
return /* @__PURE__ */
|
|
44750
|
+
return /* @__PURE__ */ jsx32(
|
|
44419
44751
|
DropdownMenuProvider,
|
|
44420
44752
|
{
|
|
44421
44753
|
scope: __scopeDropdownMenu,
|
|
@@ -44426,7 +44758,7 @@ var DropdownMenu = (props) => {
|
|
|
44426
44758
|
onOpenChange: setOpen,
|
|
44427
44759
|
onOpenToggle: React43.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
|
|
44428
44760
|
modal,
|
|
44429
|
-
children: /* @__PURE__ */
|
|
44761
|
+
children: /* @__PURE__ */ jsx32(Root32, { ...menuScope, open, onOpenChange: setOpen, dir, modal, children })
|
|
44430
44762
|
}
|
|
44431
44763
|
);
|
|
44432
44764
|
};
|
|
@@ -44437,7 +44769,7 @@ var DropdownMenuTrigger = React43.forwardRef(
|
|
|
44437
44769
|
const { __scopeDropdownMenu, disabled = false, ...triggerProps } = props;
|
|
44438
44770
|
const context = useDropdownMenuContext(TRIGGER_NAME, __scopeDropdownMenu);
|
|
44439
44771
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
44440
|
-
return /* @__PURE__ */
|
|
44772
|
+
return /* @__PURE__ */ jsx32(Anchor2, { asChild: true, ...menuScope, children: /* @__PURE__ */ jsx32(
|
|
44441
44773
|
Primitive.button,
|
|
44442
44774
|
{
|
|
44443
44775
|
type: "button",
|
|
@@ -44471,7 +44803,7 @@ var PORTAL_NAME3 = "DropdownMenuPortal";
|
|
|
44471
44803
|
var DropdownMenuPortal = (props) => {
|
|
44472
44804
|
const { __scopeDropdownMenu, ...portalProps } = props;
|
|
44473
44805
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
44474
|
-
return /* @__PURE__ */
|
|
44806
|
+
return /* @__PURE__ */ jsx32(Portal2, { ...menuScope, ...portalProps });
|
|
44475
44807
|
};
|
|
44476
44808
|
DropdownMenuPortal.displayName = PORTAL_NAME3;
|
|
44477
44809
|
var CONTENT_NAME3 = "DropdownMenuContent";
|
|
@@ -44481,7 +44813,7 @@ var DropdownMenuContent = React43.forwardRef(
|
|
|
44481
44813
|
const context = useDropdownMenuContext(CONTENT_NAME3, __scopeDropdownMenu);
|
|
44482
44814
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
44483
44815
|
const hasInteractedOutsideRef = React43.useRef(false);
|
|
44484
|
-
return /* @__PURE__ */
|
|
44816
|
+
return /* @__PURE__ */ jsx32(
|
|
44485
44817
|
Content2,
|
|
44486
44818
|
{
|
|
44487
44819
|
id: context.contentId,
|
|
@@ -44521,7 +44853,7 @@ var DropdownMenuGroup = React43.forwardRef(
|
|
|
44521
44853
|
(props, forwardedRef) => {
|
|
44522
44854
|
const { __scopeDropdownMenu, ...groupProps } = props;
|
|
44523
44855
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
44524
|
-
return /* @__PURE__ */
|
|
44856
|
+
return /* @__PURE__ */ jsx32(Group6, { ...menuScope, ...groupProps, ref: forwardedRef });
|
|
44525
44857
|
}
|
|
44526
44858
|
);
|
|
44527
44859
|
DropdownMenuGroup.displayName = GROUP_NAME3;
|
|
@@ -44530,7 +44862,7 @@ var DropdownMenuLabel = React43.forwardRef(
|
|
|
44530
44862
|
(props, forwardedRef) => {
|
|
44531
44863
|
const { __scopeDropdownMenu, ...labelProps } = props;
|
|
44532
44864
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
44533
|
-
return /* @__PURE__ */
|
|
44865
|
+
return /* @__PURE__ */ jsx32(Label, { ...menuScope, ...labelProps, ref: forwardedRef });
|
|
44534
44866
|
}
|
|
44535
44867
|
);
|
|
44536
44868
|
DropdownMenuLabel.displayName = LABEL_NAME2;
|
|
@@ -44539,7 +44871,7 @@ var DropdownMenuItem = React43.forwardRef(
|
|
|
44539
44871
|
(props, forwardedRef) => {
|
|
44540
44872
|
const { __scopeDropdownMenu, ...itemProps } = props;
|
|
44541
44873
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
44542
|
-
return /* @__PURE__ */
|
|
44874
|
+
return /* @__PURE__ */ jsx32(Item2, { ...menuScope, ...itemProps, ref: forwardedRef });
|
|
44543
44875
|
}
|
|
44544
44876
|
);
|
|
44545
44877
|
DropdownMenuItem.displayName = ITEM_NAME3;
|
|
@@ -44547,35 +44879,35 @@ var CHECKBOX_ITEM_NAME2 = "DropdownMenuCheckboxItem";
|
|
|
44547
44879
|
var DropdownMenuCheckboxItem = React43.forwardRef((props, forwardedRef) => {
|
|
44548
44880
|
const { __scopeDropdownMenu, ...checkboxItemProps } = props;
|
|
44549
44881
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
44550
|
-
return /* @__PURE__ */
|
|
44882
|
+
return /* @__PURE__ */ jsx32(CheckboxItem, { ...menuScope, ...checkboxItemProps, ref: forwardedRef });
|
|
44551
44883
|
});
|
|
44552
44884
|
DropdownMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME2;
|
|
44553
44885
|
var RADIO_GROUP_NAME2 = "DropdownMenuRadioGroup";
|
|
44554
44886
|
var DropdownMenuRadioGroup = React43.forwardRef((props, forwardedRef) => {
|
|
44555
44887
|
const { __scopeDropdownMenu, ...radioGroupProps } = props;
|
|
44556
44888
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
44557
|
-
return /* @__PURE__ */
|
|
44889
|
+
return /* @__PURE__ */ jsx32(RadioGroup, { ...menuScope, ...radioGroupProps, ref: forwardedRef });
|
|
44558
44890
|
});
|
|
44559
44891
|
DropdownMenuRadioGroup.displayName = RADIO_GROUP_NAME2;
|
|
44560
44892
|
var RADIO_ITEM_NAME2 = "DropdownMenuRadioItem";
|
|
44561
44893
|
var DropdownMenuRadioItem = React43.forwardRef((props, forwardedRef) => {
|
|
44562
44894
|
const { __scopeDropdownMenu, ...radioItemProps } = props;
|
|
44563
44895
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
44564
|
-
return /* @__PURE__ */
|
|
44896
|
+
return /* @__PURE__ */ jsx32(RadioItem, { ...menuScope, ...radioItemProps, ref: forwardedRef });
|
|
44565
44897
|
});
|
|
44566
44898
|
DropdownMenuRadioItem.displayName = RADIO_ITEM_NAME2;
|
|
44567
44899
|
var INDICATOR_NAME = "DropdownMenuItemIndicator";
|
|
44568
44900
|
var DropdownMenuItemIndicator = React43.forwardRef((props, forwardedRef) => {
|
|
44569
44901
|
const { __scopeDropdownMenu, ...itemIndicatorProps } = props;
|
|
44570
44902
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
44571
|
-
return /* @__PURE__ */
|
|
44903
|
+
return /* @__PURE__ */ jsx32(ItemIndicator, { ...menuScope, ...itemIndicatorProps, ref: forwardedRef });
|
|
44572
44904
|
});
|
|
44573
44905
|
DropdownMenuItemIndicator.displayName = INDICATOR_NAME;
|
|
44574
44906
|
var SEPARATOR_NAME2 = "DropdownMenuSeparator";
|
|
44575
44907
|
var DropdownMenuSeparator = React43.forwardRef((props, forwardedRef) => {
|
|
44576
44908
|
const { __scopeDropdownMenu, ...separatorProps } = props;
|
|
44577
44909
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
44578
|
-
return /* @__PURE__ */
|
|
44910
|
+
return /* @__PURE__ */ jsx32(Separator, { ...menuScope, ...separatorProps, ref: forwardedRef });
|
|
44579
44911
|
});
|
|
44580
44912
|
DropdownMenuSeparator.displayName = SEPARATOR_NAME2;
|
|
44581
44913
|
var ARROW_NAME3 = "DropdownMenuArrow";
|
|
@@ -44583,7 +44915,7 @@ var DropdownMenuArrow = React43.forwardRef(
|
|
|
44583
44915
|
(props, forwardedRef) => {
|
|
44584
44916
|
const { __scopeDropdownMenu, ...arrowProps } = props;
|
|
44585
44917
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
44586
|
-
return /* @__PURE__ */
|
|
44918
|
+
return /* @__PURE__ */ jsx32(Arrow22, { ...menuScope, ...arrowProps, ref: forwardedRef });
|
|
44587
44919
|
}
|
|
44588
44920
|
);
|
|
44589
44921
|
DropdownMenuArrow.displayName = ARROW_NAME3;
|
|
@@ -44596,20 +44928,20 @@ var DropdownMenuSub = (props) => {
|
|
|
44596
44928
|
onChange: onOpenChange,
|
|
44597
44929
|
caller: "DropdownMenuSub"
|
|
44598
44930
|
});
|
|
44599
|
-
return /* @__PURE__ */
|
|
44931
|
+
return /* @__PURE__ */ jsx32(Sub, { ...menuScope, open, onOpenChange: setOpen, children });
|
|
44600
44932
|
};
|
|
44601
44933
|
var SUB_TRIGGER_NAME2 = "DropdownMenuSubTrigger";
|
|
44602
44934
|
var DropdownMenuSubTrigger = React43.forwardRef((props, forwardedRef) => {
|
|
44603
44935
|
const { __scopeDropdownMenu, ...subTriggerProps } = props;
|
|
44604
44936
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
44605
|
-
return /* @__PURE__ */
|
|
44937
|
+
return /* @__PURE__ */ jsx32(SubTrigger, { ...menuScope, ...subTriggerProps, ref: forwardedRef });
|
|
44606
44938
|
});
|
|
44607
44939
|
DropdownMenuSubTrigger.displayName = SUB_TRIGGER_NAME2;
|
|
44608
44940
|
var SUB_CONTENT_NAME2 = "DropdownMenuSubContent";
|
|
44609
44941
|
var DropdownMenuSubContent = React43.forwardRef((props, forwardedRef) => {
|
|
44610
44942
|
const { __scopeDropdownMenu, ...subContentProps } = props;
|
|
44611
44943
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
44612
|
-
return /* @__PURE__ */
|
|
44944
|
+
return /* @__PURE__ */ jsx32(
|
|
44613
44945
|
SubContent,
|
|
44614
44946
|
{
|
|
44615
44947
|
...menuScope,
|
|
@@ -44641,11 +44973,11 @@ var SubTrigger2 = DropdownMenuSubTrigger;
|
|
|
44641
44973
|
var SubContent2 = DropdownMenuSubContent;
|
|
44642
44974
|
|
|
44643
44975
|
// src/components/AppearanceMenu.tsx
|
|
44644
|
-
import { useState as
|
|
44976
|
+
import { useState as useState34 } from "react";
|
|
44645
44977
|
|
|
44646
44978
|
// src/components/Icons.tsx
|
|
44647
|
-
import { jsx as
|
|
44648
|
-
var CheckIcon = () => /* @__PURE__ */
|
|
44979
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
44980
|
+
var CheckIcon = () => /* @__PURE__ */ jsx33(
|
|
44649
44981
|
"svg",
|
|
44650
44982
|
{
|
|
44651
44983
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -44657,10 +44989,10 @@ var CheckIcon = () => /* @__PURE__ */ jsx34(
|
|
|
44657
44989
|
strokeWidth: "2",
|
|
44658
44990
|
strokeLinecap: "round",
|
|
44659
44991
|
strokeLinejoin: "round",
|
|
44660
|
-
children: /* @__PURE__ */
|
|
44992
|
+
children: /* @__PURE__ */ jsx33("path", { d: "M20 6 9 17l-5-5" })
|
|
44661
44993
|
}
|
|
44662
44994
|
);
|
|
44663
|
-
var ChevronRightIcon = ({ isOpen }) => /* @__PURE__ */
|
|
44995
|
+
var ChevronRightIcon = ({ isOpen }) => /* @__PURE__ */ jsx33(
|
|
44664
44996
|
"svg",
|
|
44665
44997
|
{
|
|
44666
44998
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -44677,10 +45009,10 @@ var ChevronRightIcon = ({ isOpen }) => /* @__PURE__ */ jsx34(
|
|
|
44677
45009
|
transform: isOpen ? "rotate(90deg)" : "rotate(0deg)",
|
|
44678
45010
|
opacity: 0.6
|
|
44679
45011
|
},
|
|
44680
|
-
children: /* @__PURE__ */
|
|
45012
|
+
children: /* @__PURE__ */ jsx33("path", { d: "m9 18 6-6-6-6" })
|
|
44681
45013
|
}
|
|
44682
45014
|
);
|
|
44683
|
-
var DotIcon = () => /* @__PURE__ */
|
|
45015
|
+
var DotIcon = () => /* @__PURE__ */ jsx33(
|
|
44684
45016
|
"svg",
|
|
44685
45017
|
{
|
|
44686
45018
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -44693,12 +45025,12 @@ var DotIcon = () => /* @__PURE__ */ jsx34(
|
|
|
44693
45025
|
strokeLinecap: "round",
|
|
44694
45026
|
strokeLinejoin: "round",
|
|
44695
45027
|
className: "lucide lucide-dot-icon lucide-dot",
|
|
44696
|
-
children: /* @__PURE__ */
|
|
45028
|
+
children: /* @__PURE__ */ jsx33("circle", { cx: "12.1", cy: "12.1", r: "4.5", fill: "white" })
|
|
44697
45029
|
}
|
|
44698
45030
|
);
|
|
44699
45031
|
|
|
44700
45032
|
// src/components/AppearanceMenu.tsx
|
|
44701
|
-
import { Fragment as Fragment11, jsx as
|
|
45033
|
+
import { Fragment as Fragment11, jsx as jsx34, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
44702
45034
|
var itemStyles = {
|
|
44703
45035
|
padding: "6px 8px",
|
|
44704
45036
|
borderRadius: 6,
|
|
@@ -44747,10 +45079,10 @@ var iconContainerStyles = {
|
|
|
44747
45079
|
};
|
|
44748
45080
|
var AppearanceMenu = () => {
|
|
44749
45081
|
const { visibility, setLayerVisibility } = useLayerVisibility();
|
|
44750
|
-
const [appearanceSubOpen, setAppearanceSubOpen] =
|
|
44751
|
-
const [hoveredItem, setHoveredItem] =
|
|
45082
|
+
const [appearanceSubOpen, setAppearanceSubOpen] = useState34(false);
|
|
45083
|
+
const [hoveredItem, setHoveredItem] = useState34(null);
|
|
44752
45084
|
return /* @__PURE__ */ jsxs8(Fragment11, { children: [
|
|
44753
|
-
/* @__PURE__ */
|
|
45085
|
+
/* @__PURE__ */ jsx34(Separator2, { style: separatorStyles }),
|
|
44754
45086
|
/* @__PURE__ */ jsxs8(Sub2, { onOpenChange: setAppearanceSubOpen, children: [
|
|
44755
45087
|
/* @__PURE__ */ jsxs8(
|
|
44756
45088
|
SubTrigger2,
|
|
@@ -44764,8 +45096,8 @@ var AppearanceMenu = () => {
|
|
|
44764
45096
|
onMouseLeave: () => setHoveredItem(null),
|
|
44765
45097
|
onTouchStart: () => setHoveredItem("appearance"),
|
|
44766
45098
|
children: [
|
|
44767
|
-
/* @__PURE__ */
|
|
44768
|
-
/* @__PURE__ */
|
|
45099
|
+
/* @__PURE__ */ jsx34("span", { style: { flex: 1, display: "flex", alignItems: "center" }, children: "Appearance" }),
|
|
45100
|
+
/* @__PURE__ */ jsx34(
|
|
44769
45101
|
"div",
|
|
44770
45102
|
{
|
|
44771
45103
|
style: {
|
|
@@ -44774,13 +45106,13 @@ var AppearanceMenu = () => {
|
|
|
44774
45106
|
alignItems: "flex-end",
|
|
44775
45107
|
marginBottom: "-5px"
|
|
44776
45108
|
},
|
|
44777
|
-
children: /* @__PURE__ */
|
|
45109
|
+
children: /* @__PURE__ */ jsx34(ChevronRightIcon, { isOpen: appearanceSubOpen })
|
|
44778
45110
|
}
|
|
44779
45111
|
)
|
|
44780
45112
|
]
|
|
44781
45113
|
}
|
|
44782
45114
|
),
|
|
44783
|
-
/* @__PURE__ */
|
|
45115
|
+
/* @__PURE__ */ jsx34(Portal22, { children: /* @__PURE__ */ jsxs8(
|
|
44784
45116
|
SubContent2,
|
|
44785
45117
|
{
|
|
44786
45118
|
style: { ...contentStyles, marginLeft: -2 },
|
|
@@ -44803,8 +45135,8 @@ var AppearanceMenu = () => {
|
|
|
44803
45135
|
onMouseLeave: () => setHoveredItem(null),
|
|
44804
45136
|
onTouchStart: () => setHoveredItem("boardBody"),
|
|
44805
45137
|
children: [
|
|
44806
|
-
/* @__PURE__ */
|
|
44807
|
-
/* @__PURE__ */
|
|
45138
|
+
/* @__PURE__ */ jsx34("span", { style: iconContainerStyles, children: visibility.boardBody && /* @__PURE__ */ jsx34(CheckIcon, {}) }),
|
|
45139
|
+
/* @__PURE__ */ jsx34("span", { style: { display: "flex", alignItems: "center" }, children: "Board Body" })
|
|
44808
45140
|
]
|
|
44809
45141
|
}
|
|
44810
45142
|
),
|
|
@@ -44824,8 +45156,8 @@ var AppearanceMenu = () => {
|
|
|
44824
45156
|
onMouseLeave: () => setHoveredItem(null),
|
|
44825
45157
|
onTouchStart: () => setHoveredItem("topCopper"),
|
|
44826
45158
|
children: [
|
|
44827
|
-
/* @__PURE__ */
|
|
44828
|
-
/* @__PURE__ */
|
|
45159
|
+
/* @__PURE__ */ jsx34("span", { style: iconContainerStyles, children: visibility.topCopper && /* @__PURE__ */ jsx34(CheckIcon, {}) }),
|
|
45160
|
+
/* @__PURE__ */ jsx34("span", { style: { display: "flex", alignItems: "center" }, children: "Top Copper" })
|
|
44829
45161
|
]
|
|
44830
45162
|
}
|
|
44831
45163
|
),
|
|
@@ -44845,8 +45177,8 @@ var AppearanceMenu = () => {
|
|
|
44845
45177
|
onMouseLeave: () => setHoveredItem(null),
|
|
44846
45178
|
onTouchStart: () => setHoveredItem("bottomCopper"),
|
|
44847
45179
|
children: [
|
|
44848
|
-
/* @__PURE__ */
|
|
44849
|
-
/* @__PURE__ */
|
|
45180
|
+
/* @__PURE__ */ jsx34("span", { style: iconContainerStyles, children: visibility.bottomCopper && /* @__PURE__ */ jsx34(CheckIcon, {}) }),
|
|
45181
|
+
/* @__PURE__ */ jsx34("span", { style: { display: "flex", alignItems: "center" }, children: "Bottom Copper" })
|
|
44850
45182
|
]
|
|
44851
45183
|
}
|
|
44852
45184
|
),
|
|
@@ -44866,8 +45198,8 @@ var AppearanceMenu = () => {
|
|
|
44866
45198
|
onMouseLeave: () => setHoveredItem(null),
|
|
44867
45199
|
onTouchStart: () => setHoveredItem("topSilkscreen"),
|
|
44868
45200
|
children: [
|
|
44869
|
-
/* @__PURE__ */
|
|
44870
|
-
/* @__PURE__ */
|
|
45201
|
+
/* @__PURE__ */ jsx34("span", { style: iconContainerStyles, children: visibility.topSilkscreen && /* @__PURE__ */ jsx34(CheckIcon, {}) }),
|
|
45202
|
+
/* @__PURE__ */ jsx34("span", { style: { display: "flex", alignItems: "center" }, children: "Top Silkscreen" })
|
|
44871
45203
|
]
|
|
44872
45204
|
}
|
|
44873
45205
|
),
|
|
@@ -44890,8 +45222,8 @@ var AppearanceMenu = () => {
|
|
|
44890
45222
|
onMouseLeave: () => setHoveredItem(null),
|
|
44891
45223
|
onTouchStart: () => setHoveredItem("bottomSilkscreen"),
|
|
44892
45224
|
children: [
|
|
44893
|
-
/* @__PURE__ */
|
|
44894
|
-
/* @__PURE__ */
|
|
45225
|
+
/* @__PURE__ */ jsx34("span", { style: iconContainerStyles, children: visibility.bottomSilkscreen && /* @__PURE__ */ jsx34(CheckIcon, {}) }),
|
|
45226
|
+
/* @__PURE__ */ jsx34("span", { style: { display: "flex", alignItems: "center" }, children: "Bottom Silkscreen" })
|
|
44895
45227
|
]
|
|
44896
45228
|
}
|
|
44897
45229
|
),
|
|
@@ -44911,8 +45243,8 @@ var AppearanceMenu = () => {
|
|
|
44911
45243
|
onMouseLeave: () => setHoveredItem(null),
|
|
44912
45244
|
onTouchStart: () => setHoveredItem("topMask"),
|
|
44913
45245
|
children: [
|
|
44914
|
-
/* @__PURE__ */
|
|
44915
|
-
/* @__PURE__ */
|
|
45246
|
+
/* @__PURE__ */ jsx34("span", { style: iconContainerStyles, children: visibility.topMask && /* @__PURE__ */ jsx34(CheckIcon, {}) }),
|
|
45247
|
+
/* @__PURE__ */ jsx34("span", { style: { display: "flex", alignItems: "center" }, children: "Top Soldermask" })
|
|
44916
45248
|
]
|
|
44917
45249
|
}
|
|
44918
45250
|
),
|
|
@@ -44932,8 +45264,8 @@ var AppearanceMenu = () => {
|
|
|
44932
45264
|
onMouseLeave: () => setHoveredItem(null),
|
|
44933
45265
|
onTouchStart: () => setHoveredItem("bottomMask"),
|
|
44934
45266
|
children: [
|
|
44935
|
-
/* @__PURE__ */
|
|
44936
|
-
/* @__PURE__ */
|
|
45267
|
+
/* @__PURE__ */ jsx34("span", { style: iconContainerStyles, children: visibility.bottomMask && /* @__PURE__ */ jsx34(CheckIcon, {}) }),
|
|
45268
|
+
/* @__PURE__ */ jsx34("span", { style: { display: "flex", alignItems: "center" }, children: "Bottom Soldermask" })
|
|
44937
45269
|
]
|
|
44938
45270
|
}
|
|
44939
45271
|
),
|
|
@@ -44953,8 +45285,8 @@ var AppearanceMenu = () => {
|
|
|
44953
45285
|
onMouseLeave: () => setHoveredItem(null),
|
|
44954
45286
|
onTouchStart: () => setHoveredItem("pcbNotes"),
|
|
44955
45287
|
children: [
|
|
44956
|
-
/* @__PURE__ */
|
|
44957
|
-
/* @__PURE__ */
|
|
45288
|
+
/* @__PURE__ */ jsx34("span", { style: iconContainerStyles, children: visibility.pcbNotes && /* @__PURE__ */ jsx34(CheckIcon, {}) }),
|
|
45289
|
+
/* @__PURE__ */ jsx34("span", { style: { display: "flex", alignItems: "center" }, children: "PCB Notes" })
|
|
44958
45290
|
]
|
|
44959
45291
|
}
|
|
44960
45292
|
),
|
|
@@ -44974,8 +45306,8 @@ var AppearanceMenu = () => {
|
|
|
44974
45306
|
onMouseLeave: () => setHoveredItem(null),
|
|
44975
45307
|
onTouchStart: () => setHoveredItem("smtModels"),
|
|
44976
45308
|
children: [
|
|
44977
|
-
/* @__PURE__ */
|
|
44978
|
-
/* @__PURE__ */
|
|
45309
|
+
/* @__PURE__ */ jsx34("span", { style: iconContainerStyles, children: visibility.smtModels && /* @__PURE__ */ jsx34(CheckIcon, {}) }),
|
|
45310
|
+
/* @__PURE__ */ jsx34("span", { style: { display: "flex", alignItems: "center" }, children: "Surface Mount Components" })
|
|
44979
45311
|
]
|
|
44980
45312
|
}
|
|
44981
45313
|
),
|
|
@@ -44998,8 +45330,8 @@ var AppearanceMenu = () => {
|
|
|
44998
45330
|
onMouseLeave: () => setHoveredItem(null),
|
|
44999
45331
|
onTouchStart: () => setHoveredItem("throughHoleModels"),
|
|
45000
45332
|
children: [
|
|
45001
|
-
/* @__PURE__ */
|
|
45002
|
-
/* @__PURE__ */
|
|
45333
|
+
/* @__PURE__ */ jsx34("span", { style: iconContainerStyles, children: visibility.throughHoleModels && /* @__PURE__ */ jsx34(CheckIcon, {}) }),
|
|
45334
|
+
/* @__PURE__ */ jsx34("span", { style: { display: "flex", alignItems: "center" }, children: "Through-Hole Components" })
|
|
45003
45335
|
]
|
|
45004
45336
|
}
|
|
45005
45337
|
)
|
|
@@ -45011,7 +45343,7 @@ var AppearanceMenu = () => {
|
|
|
45011
45343
|
};
|
|
45012
45344
|
|
|
45013
45345
|
// src/components/ContextMenu.tsx
|
|
45014
|
-
import { jsx as
|
|
45346
|
+
import { jsx as jsx35, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
45015
45347
|
var cameraOptions = [
|
|
45016
45348
|
"Custom",
|
|
45017
45349
|
"Top Center Angled",
|
|
@@ -45093,9 +45425,9 @@ var ContextMenu = ({
|
|
|
45093
45425
|
onOpenKeyboardShortcuts
|
|
45094
45426
|
}) => {
|
|
45095
45427
|
const { cameraType, setCameraType } = useCameraController();
|
|
45096
|
-
const [cameraSubOpen, setCameraSubOpen] =
|
|
45097
|
-
const [hoveredItem, setHoveredItem] =
|
|
45098
|
-
return /* @__PURE__ */
|
|
45428
|
+
const [cameraSubOpen, setCameraSubOpen] = useState35(false);
|
|
45429
|
+
const [hoveredItem, setHoveredItem] = useState35(null);
|
|
45430
|
+
return /* @__PURE__ */ jsx35(
|
|
45099
45431
|
"div",
|
|
45100
45432
|
{
|
|
45101
45433
|
ref: menuRef,
|
|
@@ -45107,8 +45439,8 @@ var ContextMenu = ({
|
|
|
45107
45439
|
height: 0
|
|
45108
45440
|
},
|
|
45109
45441
|
children: /* @__PURE__ */ jsxs9(Root22, { open: true, modal: false, children: [
|
|
45110
|
-
/* @__PURE__ */
|
|
45111
|
-
/* @__PURE__ */
|
|
45442
|
+
/* @__PURE__ */ jsx35(Trigger, { asChild: true, children: /* @__PURE__ */ jsx35("div", { style: { position: "absolute", width: 1, height: 1 } }) }),
|
|
45443
|
+
/* @__PURE__ */ jsx35(Portal22, { children: /* @__PURE__ */ jsxs9(
|
|
45112
45444
|
Content22,
|
|
45113
45445
|
{
|
|
45114
45446
|
style: contentStyles2,
|
|
@@ -45130,7 +45462,7 @@ var ContextMenu = ({
|
|
|
45130
45462
|
onMouseLeave: () => setHoveredItem(null),
|
|
45131
45463
|
onTouchStart: () => setHoveredItem("camera"),
|
|
45132
45464
|
children: [
|
|
45133
|
-
/* @__PURE__ */
|
|
45465
|
+
/* @__PURE__ */ jsx35(
|
|
45134
45466
|
"span",
|
|
45135
45467
|
{
|
|
45136
45468
|
style: { flex: 1, display: "flex", alignItems: "center" },
|
|
@@ -45147,15 +45479,15 @@ var ContextMenu = ({
|
|
|
45147
45479
|
marginLeft: "auto"
|
|
45148
45480
|
},
|
|
45149
45481
|
children: [
|
|
45150
|
-
/* @__PURE__ */
|
|
45151
|
-
/* @__PURE__ */
|
|
45482
|
+
/* @__PURE__ */ jsx35("span", { style: { opacity: 0.55, fontSize: 13 }, children: cameraPreset }),
|
|
45483
|
+
/* @__PURE__ */ jsx35(ChevronRightIcon, { isOpen: cameraSubOpen })
|
|
45152
45484
|
]
|
|
45153
45485
|
}
|
|
45154
45486
|
)
|
|
45155
45487
|
]
|
|
45156
45488
|
}
|
|
45157
45489
|
),
|
|
45158
|
-
/* @__PURE__ */
|
|
45490
|
+
/* @__PURE__ */ jsx35(Portal22, { children: /* @__PURE__ */ jsx35(
|
|
45159
45491
|
SubContent2,
|
|
45160
45492
|
{
|
|
45161
45493
|
style: { ...contentStyles2, marginLeft: -2 },
|
|
@@ -45177,8 +45509,8 @@ var ContextMenu = ({
|
|
|
45177
45509
|
onMouseLeave: () => setHoveredItem(null),
|
|
45178
45510
|
onTouchStart: () => setHoveredItem(option),
|
|
45179
45511
|
children: [
|
|
45180
|
-
/* @__PURE__ */
|
|
45181
|
-
/* @__PURE__ */
|
|
45512
|
+
/* @__PURE__ */ jsx35("span", { style: iconContainerStyles2, children: cameraPreset === option && /* @__PURE__ */ jsx35(DotIcon, {}) }),
|
|
45513
|
+
/* @__PURE__ */ jsx35("span", { style: { display: "flex", alignItems: "center" }, children: option })
|
|
45182
45514
|
]
|
|
45183
45515
|
},
|
|
45184
45516
|
option
|
|
@@ -45202,8 +45534,8 @@ var ContextMenu = ({
|
|
|
45202
45534
|
onMouseLeave: () => setHoveredItem(null),
|
|
45203
45535
|
onTouchStart: () => setHoveredItem("autorotate"),
|
|
45204
45536
|
children: [
|
|
45205
|
-
/* @__PURE__ */
|
|
45206
|
-
/* @__PURE__ */
|
|
45537
|
+
/* @__PURE__ */ jsx35("span", { style: iconContainerStyles2, children: autoRotate && /* @__PURE__ */ jsx35(CheckIcon, {}) }),
|
|
45538
|
+
/* @__PURE__ */ jsx35("span", { style: { display: "flex", alignItems: "center" }, children: "Auto rotate" })
|
|
45207
45539
|
]
|
|
45208
45540
|
}
|
|
45209
45541
|
),
|
|
@@ -45225,14 +45557,14 @@ var ContextMenu = ({
|
|
|
45225
45557
|
onMouseLeave: () => setHoveredItem(null),
|
|
45226
45558
|
onTouchStart: () => setHoveredItem("cameratype"),
|
|
45227
45559
|
children: [
|
|
45228
|
-
/* @__PURE__ */
|
|
45229
|
-
/* @__PURE__ */
|
|
45560
|
+
/* @__PURE__ */ jsx35("span", { style: iconContainerStyles2, children: cameraType === "orthographic" && /* @__PURE__ */ jsx35(CheckIcon, {}) }),
|
|
45561
|
+
/* @__PURE__ */ jsx35("span", { style: { display: "flex", alignItems: "center" }, children: "Orthographic Camera" })
|
|
45230
45562
|
]
|
|
45231
45563
|
}
|
|
45232
45564
|
),
|
|
45233
|
-
/* @__PURE__ */
|
|
45234
|
-
/* @__PURE__ */
|
|
45235
|
-
/* @__PURE__ */
|
|
45565
|
+
/* @__PURE__ */ jsx35(AppearanceMenu, {}),
|
|
45566
|
+
/* @__PURE__ */ jsx35(Separator2, { style: separatorStyles2 }),
|
|
45567
|
+
/* @__PURE__ */ jsx35(
|
|
45236
45568
|
Item22,
|
|
45237
45569
|
{
|
|
45238
45570
|
style: {
|
|
@@ -45244,10 +45576,10 @@ var ContextMenu = ({
|
|
|
45244
45576
|
onMouseEnter: () => setHoveredItem("download"),
|
|
45245
45577
|
onMouseLeave: () => setHoveredItem(null),
|
|
45246
45578
|
onTouchStart: () => setHoveredItem("download"),
|
|
45247
|
-
children: /* @__PURE__ */
|
|
45579
|
+
children: /* @__PURE__ */ jsx35("span", { style: { display: "flex", alignItems: "center" }, children: "Download GLTF" })
|
|
45248
45580
|
}
|
|
45249
45581
|
),
|
|
45250
|
-
/* @__PURE__ */
|
|
45582
|
+
/* @__PURE__ */ jsx35(Separator2, { style: separatorStyles2 }),
|
|
45251
45583
|
/* @__PURE__ */ jsxs9(
|
|
45252
45584
|
Item22,
|
|
45253
45585
|
{
|
|
@@ -45270,7 +45602,7 @@ var ContextMenu = ({
|
|
|
45270
45602
|
engine === "jscad" ? "Manifold" : "JSCAD",
|
|
45271
45603
|
" Engine"
|
|
45272
45604
|
] }),
|
|
45273
|
-
/* @__PURE__ */
|
|
45605
|
+
/* @__PURE__ */ jsx35(
|
|
45274
45606
|
"div",
|
|
45275
45607
|
{
|
|
45276
45608
|
style: {
|
|
@@ -45284,7 +45616,7 @@ var ContextMenu = ({
|
|
|
45284
45616
|
]
|
|
45285
45617
|
}
|
|
45286
45618
|
),
|
|
45287
|
-
/* @__PURE__ */
|
|
45619
|
+
/* @__PURE__ */ jsx35(Separator2, { style: separatorStyles2 }),
|
|
45288
45620
|
/* @__PURE__ */ jsxs9(
|
|
45289
45621
|
Item22,
|
|
45290
45622
|
{
|
|
@@ -45298,8 +45630,8 @@ var ContextMenu = ({
|
|
|
45298
45630
|
onMouseLeave: () => setHoveredItem(null),
|
|
45299
45631
|
onTouchStart: () => setHoveredItem("shortcuts"),
|
|
45300
45632
|
children: [
|
|
45301
|
-
/* @__PURE__ */
|
|
45302
|
-
/* @__PURE__ */
|
|
45633
|
+
/* @__PURE__ */ jsx35("span", { style: { flex: 1, display: "flex", alignItems: "center" }, children: "Keyboard Shortcuts" }),
|
|
45634
|
+
/* @__PURE__ */ jsx35(
|
|
45303
45635
|
"div",
|
|
45304
45636
|
{
|
|
45305
45637
|
style: {
|
|
@@ -45313,8 +45645,8 @@ var ContextMenu = ({
|
|
|
45313
45645
|
]
|
|
45314
45646
|
}
|
|
45315
45647
|
),
|
|
45316
|
-
/* @__PURE__ */
|
|
45317
|
-
/* @__PURE__ */
|
|
45648
|
+
/* @__PURE__ */ jsx35(Separator2, { style: separatorStyles2 }),
|
|
45649
|
+
/* @__PURE__ */ jsx35(
|
|
45318
45650
|
"div",
|
|
45319
45651
|
{
|
|
45320
45652
|
style: {
|
|
@@ -45352,16 +45684,16 @@ var ContextMenu = ({
|
|
|
45352
45684
|
};
|
|
45353
45685
|
|
|
45354
45686
|
// src/components/KeyboardShortcutsDialog.tsx
|
|
45355
|
-
import { useEffect as
|
|
45356
|
-
import { jsx as
|
|
45687
|
+
import { useEffect as useEffect46, useMemo as useMemo29, useRef as useRef27, useState as useState36 } from "react";
|
|
45688
|
+
import { jsx as jsx36, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
45357
45689
|
var KeyboardShortcutsDialog = ({
|
|
45358
45690
|
open,
|
|
45359
45691
|
onClose
|
|
45360
45692
|
}) => {
|
|
45361
|
-
const [query, setQuery] =
|
|
45362
|
-
const inputRef =
|
|
45693
|
+
const [query, setQuery] = useState36("");
|
|
45694
|
+
const inputRef = useRef27(null);
|
|
45363
45695
|
const hotkeys = useHotkeyRegistry();
|
|
45364
|
-
|
|
45696
|
+
useEffect46(() => {
|
|
45365
45697
|
if (!open) return void 0;
|
|
45366
45698
|
const handleKeyDown = (event) => {
|
|
45367
45699
|
if (event.key === "Escape") {
|
|
@@ -45372,7 +45704,7 @@ var KeyboardShortcutsDialog = ({
|
|
|
45372
45704
|
window.addEventListener("keydown", handleKeyDown);
|
|
45373
45705
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
45374
45706
|
}, [open, onClose]);
|
|
45375
|
-
|
|
45707
|
+
useEffect46(() => {
|
|
45376
45708
|
if (open) {
|
|
45377
45709
|
setTimeout(() => {
|
|
45378
45710
|
inputRef.current?.focus();
|
|
@@ -45392,7 +45724,7 @@ var KeyboardShortcutsDialog = ({
|
|
|
45392
45724
|
if (!open) {
|
|
45393
45725
|
return null;
|
|
45394
45726
|
}
|
|
45395
|
-
return /* @__PURE__ */
|
|
45727
|
+
return /* @__PURE__ */ jsx36(
|
|
45396
45728
|
"div",
|
|
45397
45729
|
{
|
|
45398
45730
|
role: "dialog",
|
|
@@ -45432,7 +45764,7 @@ var KeyboardShortcutsDialog = ({
|
|
|
45432
45764
|
},
|
|
45433
45765
|
children: [
|
|
45434
45766
|
/* @__PURE__ */ jsxs10("div", { style: { display: "flex", justifyContent: "space-between" }, children: [
|
|
45435
|
-
/* @__PURE__ */
|
|
45767
|
+
/* @__PURE__ */ jsx36(
|
|
45436
45768
|
"h2",
|
|
45437
45769
|
{
|
|
45438
45770
|
style: {
|
|
@@ -45444,7 +45776,7 @@ var KeyboardShortcutsDialog = ({
|
|
|
45444
45776
|
children: "Keyboard Shortcuts"
|
|
45445
45777
|
}
|
|
45446
45778
|
),
|
|
45447
|
-
/* @__PURE__ */
|
|
45779
|
+
/* @__PURE__ */ jsx36(
|
|
45448
45780
|
"button",
|
|
45449
45781
|
{
|
|
45450
45782
|
type: "button",
|
|
@@ -45460,7 +45792,7 @@ var KeyboardShortcutsDialog = ({
|
|
|
45460
45792
|
}
|
|
45461
45793
|
)
|
|
45462
45794
|
] }),
|
|
45463
|
-
/* @__PURE__ */
|
|
45795
|
+
/* @__PURE__ */ jsx36(
|
|
45464
45796
|
"input",
|
|
45465
45797
|
{
|
|
45466
45798
|
ref: inputRef,
|
|
@@ -45483,7 +45815,7 @@ var KeyboardShortcutsDialog = ({
|
|
|
45483
45815
|
]
|
|
45484
45816
|
}
|
|
45485
45817
|
),
|
|
45486
|
-
/* @__PURE__ */
|
|
45818
|
+
/* @__PURE__ */ jsx36("div", { style: { overflowY: "auto" }, children: /* @__PURE__ */ jsxs10(
|
|
45487
45819
|
"table",
|
|
45488
45820
|
{
|
|
45489
45821
|
style: {
|
|
@@ -45492,11 +45824,11 @@ var KeyboardShortcutsDialog = ({
|
|
|
45492
45824
|
fontSize: "0.95rem"
|
|
45493
45825
|
},
|
|
45494
45826
|
children: [
|
|
45495
|
-
/* @__PURE__ */
|
|
45496
|
-
/* @__PURE__ */
|
|
45497
|
-
/* @__PURE__ */
|
|
45827
|
+
/* @__PURE__ */ jsx36("thead", { children: /* @__PURE__ */ jsxs10("tr", { style: { textAlign: "left", color: "#a1a1b5" }, children: [
|
|
45828
|
+
/* @__PURE__ */ jsx36("th", { style: { padding: "12px 24px", width: "25%" }, children: "Key" }),
|
|
45829
|
+
/* @__PURE__ */ jsx36("th", { style: { padding: "12px 24px" }, children: "Description" })
|
|
45498
45830
|
] }) }),
|
|
45499
|
-
/* @__PURE__ */
|
|
45831
|
+
/* @__PURE__ */ jsx36("tbody", { children: filteredHotkeys.length === 0 ? /* @__PURE__ */ jsx36("tr", { children: /* @__PURE__ */ jsx36(
|
|
45500
45832
|
"td",
|
|
45501
45833
|
{
|
|
45502
45834
|
colSpan: 2,
|
|
@@ -45508,7 +45840,7 @@ var KeyboardShortcutsDialog = ({
|
|
|
45508
45840
|
{
|
|
45509
45841
|
style: { borderTop: "1px solid rgba(255, 255, 255, 0.05)" },
|
|
45510
45842
|
children: [
|
|
45511
|
-
/* @__PURE__ */
|
|
45843
|
+
/* @__PURE__ */ jsx36("td", { style: { padding: "12px 24px" }, children: /* @__PURE__ */ jsx36(
|
|
45512
45844
|
"span",
|
|
45513
45845
|
{
|
|
45514
45846
|
style: {
|
|
@@ -45526,7 +45858,7 @@ var KeyboardShortcutsDialog = ({
|
|
|
45526
45858
|
children: hotkey.shortcut
|
|
45527
45859
|
}
|
|
45528
45860
|
) }),
|
|
45529
|
-
/* @__PURE__ */
|
|
45861
|
+
/* @__PURE__ */ jsx36("td", { style: { padding: "12px 24px" }, children: hotkey.description })
|
|
45530
45862
|
]
|
|
45531
45863
|
},
|
|
45532
45864
|
hotkey.id
|
|
@@ -45542,8 +45874,8 @@ var KeyboardShortcutsDialog = ({
|
|
|
45542
45874
|
};
|
|
45543
45875
|
|
|
45544
45876
|
// src/CadViewer.tsx
|
|
45545
|
-
import { jsx as
|
|
45546
|
-
var DEFAULT_TARGET = new
|
|
45877
|
+
import { jsx as jsx37, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
45878
|
+
var DEFAULT_TARGET = new THREE44.Vector3(0, 0, 0);
|
|
45547
45879
|
var INITIAL_CAMERA_POSITION = [5, -5, 5];
|
|
45548
45880
|
var readStoredCameraType = () => {
|
|
45549
45881
|
if (typeof window === "undefined") return void 0;
|
|
@@ -45551,25 +45883,25 @@ var readStoredCameraType = () => {
|
|
|
45551
45883
|
return stored === "orthographic" || stored === "perspective" ? stored : void 0;
|
|
45552
45884
|
};
|
|
45553
45885
|
var CadViewerInner = (props) => {
|
|
45554
|
-
const [engine, setEngine] =
|
|
45886
|
+
const [engine, setEngine] = useState37(() => {
|
|
45555
45887
|
const stored = window.localStorage.getItem("cadViewerEngine");
|
|
45556
45888
|
return stored === "jscad" || stored === "manifold" ? stored : "manifold";
|
|
45557
45889
|
});
|
|
45558
|
-
const containerRef =
|
|
45559
|
-
const [isKeyboardShortcutsDialogOpen, setIsKeyboardShortcutsDialogOpen] =
|
|
45560
|
-
const [autoRotate, setAutoRotate] =
|
|
45890
|
+
const containerRef = useRef28(null);
|
|
45891
|
+
const [isKeyboardShortcutsDialogOpen, setIsKeyboardShortcutsDialogOpen] = useState37(false);
|
|
45892
|
+
const [autoRotate, setAutoRotate] = useState37(() => {
|
|
45561
45893
|
const stored = window.localStorage.getItem("cadViewerAutoRotate");
|
|
45562
45894
|
return stored === "false" ? false : true;
|
|
45563
45895
|
});
|
|
45564
|
-
const [autoRotateUserToggled, setAutoRotateUserToggled] =
|
|
45896
|
+
const [autoRotateUserToggled, setAutoRotateUserToggled] = useState37(() => {
|
|
45565
45897
|
const stored = window.localStorage.getItem("cadViewerAutoRotateUserToggled");
|
|
45566
45898
|
return stored === "true";
|
|
45567
45899
|
});
|
|
45568
|
-
const [cameraPreset, setCameraPreset] =
|
|
45900
|
+
const [cameraPreset, setCameraPreset] = useState37("Custom");
|
|
45569
45901
|
const { cameraType, setCameraType } = useCameraController();
|
|
45570
45902
|
const { visibility, setLayerVisibility } = useLayerVisibility();
|
|
45571
45903
|
const { showToast } = useToast();
|
|
45572
|
-
const cameraControllerRef =
|
|
45904
|
+
const cameraControllerRef = useRef28(null);
|
|
45573
45905
|
const externalCameraControllerReady = props.onCameraControllerReady;
|
|
45574
45906
|
const {
|
|
45575
45907
|
menuVisible,
|
|
@@ -45578,12 +45910,12 @@ var CadViewerInner = (props) => {
|
|
|
45578
45910
|
contextMenuEventHandlers,
|
|
45579
45911
|
setMenuVisible
|
|
45580
45912
|
} = useContextMenu({ containerRef });
|
|
45581
|
-
const autoRotateUserToggledRef =
|
|
45913
|
+
const autoRotateUserToggledRef = useRef28(autoRotateUserToggled);
|
|
45582
45914
|
autoRotateUserToggledRef.current = autoRotateUserToggled;
|
|
45583
|
-
const isAnimatingRef =
|
|
45584
|
-
const lastPresetSelectTime =
|
|
45915
|
+
const isAnimatingRef = useRef28(false);
|
|
45916
|
+
const lastPresetSelectTime = useRef28(0);
|
|
45585
45917
|
const PRESET_COOLDOWN = 1e3;
|
|
45586
|
-
const handleUserInteraction =
|
|
45918
|
+
const handleUserInteraction = useCallback23(() => {
|
|
45587
45919
|
if (isAnimatingRef.current || Date.now() - lastPresetSelectTime.current < PRESET_COOLDOWN) {
|
|
45588
45920
|
return;
|
|
45589
45921
|
}
|
|
@@ -45594,15 +45926,15 @@ var CadViewerInner = (props) => {
|
|
|
45594
45926
|
setCameraPreset("Custom");
|
|
45595
45927
|
}
|
|
45596
45928
|
}, [menuVisible]);
|
|
45597
|
-
const toggleAutoRotate =
|
|
45929
|
+
const toggleAutoRotate = useCallback23(() => {
|
|
45598
45930
|
setAutoRotate((prev) => !prev);
|
|
45599
45931
|
setAutoRotateUserToggled(true);
|
|
45600
45932
|
}, []);
|
|
45601
45933
|
const downloadGltf = useGlobalDownloadGltf();
|
|
45602
|
-
const closeMenu =
|
|
45934
|
+
const closeMenu = useCallback23(() => {
|
|
45603
45935
|
setMenuVisible(false);
|
|
45604
45936
|
}, [setMenuVisible]);
|
|
45605
|
-
const handleCameraControllerReady =
|
|
45937
|
+
const handleCameraControllerReady = useCallback23(
|
|
45606
45938
|
(controller) => {
|
|
45607
45939
|
cameraControllerRef.current = controller;
|
|
45608
45940
|
externalCameraControllerReady?.(controller);
|
|
@@ -45676,24 +46008,24 @@ var CadViewerInner = (props) => {
|
|
|
45676
46008
|
description: "Toggle translucent components"
|
|
45677
46009
|
}
|
|
45678
46010
|
);
|
|
45679
|
-
|
|
46011
|
+
useEffect47(() => {
|
|
45680
46012
|
if (containerRef.current) {
|
|
45681
46013
|
registerHotkeyViewer(containerRef.current);
|
|
45682
46014
|
}
|
|
45683
46015
|
}, []);
|
|
45684
|
-
|
|
46016
|
+
useEffect47(() => {
|
|
45685
46017
|
window.localStorage.setItem("cadViewerEngine", engine);
|
|
45686
46018
|
}, [engine]);
|
|
45687
|
-
|
|
46019
|
+
useEffect47(() => {
|
|
45688
46020
|
window.localStorage.setItem("cadViewerAutoRotate", String(autoRotate));
|
|
45689
46021
|
}, [autoRotate]);
|
|
45690
|
-
|
|
46022
|
+
useEffect47(() => {
|
|
45691
46023
|
window.localStorage.setItem(
|
|
45692
46024
|
"cadViewerAutoRotateUserToggled",
|
|
45693
46025
|
String(autoRotateUserToggled)
|
|
45694
46026
|
);
|
|
45695
46027
|
}, [autoRotateUserToggled]);
|
|
45696
|
-
|
|
46028
|
+
useEffect47(() => {
|
|
45697
46029
|
window.localStorage.setItem("cadViewerCameraType", cameraType);
|
|
45698
46030
|
}, [cameraType]);
|
|
45699
46031
|
const viewerKey = props.circuitJson ? JSON.stringify(props.circuitJson) : void 0;
|
|
@@ -45713,7 +46045,7 @@ var CadViewerInner = (props) => {
|
|
|
45713
46045
|
},
|
|
45714
46046
|
...contextMenuEventHandlers,
|
|
45715
46047
|
children: [
|
|
45716
|
-
engine === "jscad" ? /* @__PURE__ */
|
|
46048
|
+
engine === "jscad" ? /* @__PURE__ */ jsx37(
|
|
45717
46049
|
CadViewerJscad,
|
|
45718
46050
|
{
|
|
45719
46051
|
...props,
|
|
@@ -45722,7 +46054,7 @@ var CadViewerInner = (props) => {
|
|
|
45722
46054
|
onUserInteraction: handleUserInteraction,
|
|
45723
46055
|
onCameraControllerReady: handleCameraControllerReady
|
|
45724
46056
|
}
|
|
45725
|
-
) : /* @__PURE__ */
|
|
46057
|
+
) : /* @__PURE__ */ jsx37(
|
|
45726
46058
|
CadViewerManifold_default,
|
|
45727
46059
|
{
|
|
45728
46060
|
...props,
|
|
@@ -45749,11 +46081,11 @@ var CadViewerInner = (props) => {
|
|
|
45749
46081
|
},
|
|
45750
46082
|
children: [
|
|
45751
46083
|
"Engine: ",
|
|
45752
|
-
/* @__PURE__ */
|
|
46084
|
+
/* @__PURE__ */ jsx37("b", { children: engine === "jscad" ? "JSCAD" : "Manifold" })
|
|
45753
46085
|
]
|
|
45754
46086
|
}
|
|
45755
46087
|
),
|
|
45756
|
-
menuVisible && /* @__PURE__ */
|
|
46088
|
+
menuVisible && /* @__PURE__ */ jsx37(
|
|
45757
46089
|
ContextMenu,
|
|
45758
46090
|
{
|
|
45759
46091
|
menuRef,
|
|
@@ -45780,7 +46112,7 @@ var CadViewerInner = (props) => {
|
|
|
45780
46112
|
}
|
|
45781
46113
|
}
|
|
45782
46114
|
),
|
|
45783
|
-
/* @__PURE__ */
|
|
46115
|
+
/* @__PURE__ */ jsx37(
|
|
45784
46116
|
KeyboardShortcutsDialog,
|
|
45785
46117
|
{
|
|
45786
46118
|
open: isKeyboardShortcutsDialogOpen,
|
|
@@ -45793,13 +46125,13 @@ var CadViewerInner = (props) => {
|
|
|
45793
46125
|
);
|
|
45794
46126
|
};
|
|
45795
46127
|
var CadViewer = (props) => {
|
|
45796
|
-
return /* @__PURE__ */
|
|
46128
|
+
return /* @__PURE__ */ jsx37(
|
|
45797
46129
|
CameraControllerProvider,
|
|
45798
46130
|
{
|
|
45799
46131
|
defaultTarget: DEFAULT_TARGET,
|
|
45800
46132
|
initialCameraPosition: INITIAL_CAMERA_POSITION,
|
|
45801
46133
|
initialCameraType: readStoredCameraType(),
|
|
45802
|
-
children: /* @__PURE__ */
|
|
46134
|
+
children: /* @__PURE__ */ jsx37(LayerVisibilityProvider, { children: /* @__PURE__ */ jsx37(ToastProvider, { children: /* @__PURE__ */ jsx37(CadViewerInner, { ...props }) }) })
|
|
45803
46135
|
}
|
|
45804
46136
|
);
|
|
45805
46137
|
};
|
|
@@ -45807,11 +46139,11 @@ var CadViewer = (props) => {
|
|
|
45807
46139
|
// src/convert-circuit-json-to-3d-svg.ts
|
|
45808
46140
|
var import_debug = __toESM(require_browser(), 1);
|
|
45809
46141
|
import { su as su18 } from "@tscircuit/circuit-json-util";
|
|
45810
|
-
import * as
|
|
46142
|
+
import * as THREE48 from "three";
|
|
45811
46143
|
import { SVGRenderer } from "three/examples/jsm/renderers/SVGRenderer.js";
|
|
45812
46144
|
|
|
45813
46145
|
// src/utils/create-geometry-from-polygons.ts
|
|
45814
|
-
import * as
|
|
46146
|
+
import * as THREE45 from "three";
|
|
45815
46147
|
import { BufferGeometry as BufferGeometry4, Float32BufferAttribute as Float32BufferAttribute3 } from "three";
|
|
45816
46148
|
function createGeometryFromPolygons(polygons) {
|
|
45817
46149
|
const geometry = new BufferGeometry4();
|
|
@@ -45825,12 +46157,12 @@ function createGeometryFromPolygons(polygons) {
|
|
|
45825
46157
|
...polygon2.vertices[i + 1]
|
|
45826
46158
|
// Third vertex
|
|
45827
46159
|
);
|
|
45828
|
-
const v1 = new
|
|
45829
|
-
const v2 = new
|
|
45830
|
-
const v3 = new
|
|
45831
|
-
const normal = new
|
|
45832
|
-
new
|
|
45833
|
-
new
|
|
46160
|
+
const v1 = new THREE45.Vector3(...polygon2.vertices[0]);
|
|
46161
|
+
const v2 = new THREE45.Vector3(...polygon2.vertices[i]);
|
|
46162
|
+
const v3 = new THREE45.Vector3(...polygon2.vertices[i + 1]);
|
|
46163
|
+
const normal = new THREE45.Vector3().crossVectors(
|
|
46164
|
+
new THREE45.Vector3().subVectors(v2, v1),
|
|
46165
|
+
new THREE45.Vector3().subVectors(v3, v1)
|
|
45834
46166
|
).normalize();
|
|
45835
46167
|
normals.push(
|
|
45836
46168
|
normal.x,
|
|
@@ -45854,10 +46186,10 @@ function createGeometryFromPolygons(polygons) {
|
|
|
45854
46186
|
var import_modeling2 = __toESM(require_src(), 1);
|
|
45855
46187
|
var import_jscad_planner2 = __toESM(require_dist(), 1);
|
|
45856
46188
|
var jscadModeling2 = __toESM(require_src(), 1);
|
|
45857
|
-
import * as
|
|
46189
|
+
import * as THREE47 from "three";
|
|
45858
46190
|
|
|
45859
46191
|
// src/utils/load-model.ts
|
|
45860
|
-
import * as
|
|
46192
|
+
import * as THREE46 from "three";
|
|
45861
46193
|
import { GLTFLoader as GLTFLoader2 } from "three/examples/jsm/loaders/GLTFLoader.js";
|
|
45862
46194
|
import { OBJLoader as OBJLoader2 } from "three/examples/jsm/loaders/OBJLoader.js";
|
|
45863
46195
|
import { STLLoader as STLLoader2 } from "three/examples/jsm/loaders/STLLoader.js";
|
|
@@ -45865,12 +46197,12 @@ async function load3DModel(url) {
|
|
|
45865
46197
|
if (url.endsWith(".stl")) {
|
|
45866
46198
|
const loader = new STLLoader2();
|
|
45867
46199
|
const geometry = await loader.loadAsync(url);
|
|
45868
|
-
const material = new
|
|
46200
|
+
const material = new THREE46.MeshStandardMaterial({
|
|
45869
46201
|
color: 8947848,
|
|
45870
46202
|
metalness: 0.5,
|
|
45871
46203
|
roughness: 0.5
|
|
45872
46204
|
});
|
|
45873
|
-
return new
|
|
46205
|
+
return new THREE46.Mesh(geometry, material);
|
|
45874
46206
|
}
|
|
45875
46207
|
if (url.endsWith(".obj")) {
|
|
45876
46208
|
const loader = new OBJLoader2();
|
|
@@ -45903,9 +46235,9 @@ async function renderComponent(component, scene) {
|
|
|
45903
46235
|
}
|
|
45904
46236
|
if (component.rotation) {
|
|
45905
46237
|
model.rotation.set(
|
|
45906
|
-
|
|
45907
|
-
|
|
45908
|
-
|
|
46238
|
+
THREE47.MathUtils.degToRad(component.rotation.x ?? 0),
|
|
46239
|
+
THREE47.MathUtils.degToRad(component.rotation.y ?? 0),
|
|
46240
|
+
THREE47.MathUtils.degToRad(component.rotation.z ?? 0)
|
|
45909
46241
|
);
|
|
45910
46242
|
}
|
|
45911
46243
|
scene.add(model);
|
|
@@ -45919,13 +46251,13 @@ async function renderComponent(component, scene) {
|
|
|
45919
46251
|
);
|
|
45920
46252
|
if (jscadObject && (jscadObject.polygons || jscadObject.sides)) {
|
|
45921
46253
|
const threeGeom = convertCSGToThreeGeom(jscadObject);
|
|
45922
|
-
const material2 = new
|
|
46254
|
+
const material2 = new THREE47.MeshStandardMaterial({
|
|
45923
46255
|
color: 8947848,
|
|
45924
46256
|
metalness: 0.5,
|
|
45925
46257
|
roughness: 0.5,
|
|
45926
|
-
side:
|
|
46258
|
+
side: THREE47.DoubleSide
|
|
45927
46259
|
});
|
|
45928
|
-
const mesh2 = new
|
|
46260
|
+
const mesh2 = new THREE47.Mesh(threeGeom, material2);
|
|
45929
46261
|
if (component.position) {
|
|
45930
46262
|
mesh2.position.set(
|
|
45931
46263
|
component.position.x ?? 0,
|
|
@@ -45935,9 +46267,9 @@ async function renderComponent(component, scene) {
|
|
|
45935
46267
|
}
|
|
45936
46268
|
if (component.rotation) {
|
|
45937
46269
|
mesh2.rotation.set(
|
|
45938
|
-
|
|
45939
|
-
|
|
45940
|
-
|
|
46270
|
+
THREE47.MathUtils.degToRad(component.rotation.x ?? 0),
|
|
46271
|
+
THREE47.MathUtils.degToRad(component.rotation.y ?? 0),
|
|
46272
|
+
THREE47.MathUtils.degToRad(component.rotation.z ?? 0)
|
|
45941
46273
|
);
|
|
45942
46274
|
}
|
|
45943
46275
|
scene.add(mesh2);
|
|
@@ -45954,17 +46286,17 @@ async function renderComponent(component, scene) {
|
|
|
45954
46286
|
if (!geom || !geom.polygons && !geom.sides) {
|
|
45955
46287
|
continue;
|
|
45956
46288
|
}
|
|
45957
|
-
const color = new
|
|
46289
|
+
const color = new THREE47.Color(geomInfo.color);
|
|
45958
46290
|
color.convertLinearToSRGB();
|
|
45959
46291
|
const geomWithColor = { ...geom, color: [color.r, color.g, color.b] };
|
|
45960
46292
|
const threeGeom = convertCSGToThreeGeom(geomWithColor);
|
|
45961
|
-
const material2 = new
|
|
46293
|
+
const material2 = new THREE47.MeshStandardMaterial({
|
|
45962
46294
|
vertexColors: true,
|
|
45963
46295
|
metalness: 0.2,
|
|
45964
46296
|
roughness: 0.8,
|
|
45965
|
-
side:
|
|
46297
|
+
side: THREE47.DoubleSide
|
|
45966
46298
|
});
|
|
45967
|
-
const mesh2 = new
|
|
46299
|
+
const mesh2 = new THREE47.Mesh(threeGeom, material2);
|
|
45968
46300
|
if (component.position) {
|
|
45969
46301
|
mesh2.position.set(
|
|
45970
46302
|
component.position.x ?? 0,
|
|
@@ -45974,22 +46306,22 @@ async function renderComponent(component, scene) {
|
|
|
45974
46306
|
}
|
|
45975
46307
|
if (component.rotation) {
|
|
45976
46308
|
mesh2.rotation.set(
|
|
45977
|
-
|
|
45978
|
-
|
|
45979
|
-
|
|
46309
|
+
THREE47.MathUtils.degToRad(component.rotation.x ?? 0),
|
|
46310
|
+
THREE47.MathUtils.degToRad(component.rotation.y ?? 0),
|
|
46311
|
+
THREE47.MathUtils.degToRad(component.rotation.z ?? 0)
|
|
45980
46312
|
);
|
|
45981
46313
|
}
|
|
45982
46314
|
scene.add(mesh2);
|
|
45983
46315
|
}
|
|
45984
46316
|
return;
|
|
45985
46317
|
}
|
|
45986
|
-
const geometry = new
|
|
45987
|
-
const material = new
|
|
46318
|
+
const geometry = new THREE47.BoxGeometry(0.5, 0.5, 0.5);
|
|
46319
|
+
const material = new THREE47.MeshStandardMaterial({
|
|
45988
46320
|
color: 16711680,
|
|
45989
46321
|
transparent: true,
|
|
45990
46322
|
opacity: 0.25
|
|
45991
46323
|
});
|
|
45992
|
-
const mesh = new
|
|
46324
|
+
const mesh = new THREE47.Mesh(geometry, material);
|
|
45993
46325
|
if (component.position) {
|
|
45994
46326
|
mesh.position.set(
|
|
45995
46327
|
component.position.x ?? 0,
|
|
@@ -46010,11 +46342,11 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
|
|
|
46010
46342
|
padding = 20,
|
|
46011
46343
|
zoom = 1.5
|
|
46012
46344
|
} = options;
|
|
46013
|
-
const scene = new
|
|
46345
|
+
const scene = new THREE48.Scene();
|
|
46014
46346
|
const renderer = new SVGRenderer();
|
|
46015
46347
|
renderer.setSize(width10, height10);
|
|
46016
|
-
renderer.setClearColor(new
|
|
46017
|
-
const camera = new
|
|
46348
|
+
renderer.setClearColor(new THREE48.Color(backgroundColor), 1);
|
|
46349
|
+
const camera = new THREE48.OrthographicCamera();
|
|
46018
46350
|
const aspect = width10 / height10;
|
|
46019
46351
|
const frustumSize = 100;
|
|
46020
46352
|
const halfFrustumSize = frustumSize / 2 / zoom;
|
|
@@ -46028,11 +46360,11 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
|
|
|
46028
46360
|
camera.position.set(position.x, position.y, position.z);
|
|
46029
46361
|
camera.up.set(0, 1, 0);
|
|
46030
46362
|
const lookAt = options.camera?.lookAt ?? { x: 0, y: 0, z: 0 };
|
|
46031
|
-
camera.lookAt(new
|
|
46363
|
+
camera.lookAt(new THREE48.Vector3(lookAt.x, lookAt.y, lookAt.z));
|
|
46032
46364
|
camera.updateProjectionMatrix();
|
|
46033
|
-
const ambientLight = new
|
|
46365
|
+
const ambientLight = new THREE48.AmbientLight(16777215, Math.PI / 2);
|
|
46034
46366
|
scene.add(ambientLight);
|
|
46035
|
-
const pointLight = new
|
|
46367
|
+
const pointLight = new THREE48.PointLight(16777215, Math.PI / 4);
|
|
46036
46368
|
pointLight.position.set(-10, -10, 10);
|
|
46037
46369
|
scene.add(pointLight);
|
|
46038
46370
|
const components = su18(circuitJson).cad_component.list();
|
|
@@ -46043,7 +46375,7 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
|
|
|
46043
46375
|
const boardGeom = createSimplifiedBoardGeom(circuitJson);
|
|
46044
46376
|
if (boardGeom) {
|
|
46045
46377
|
const solderMaskColor = colors.fr4SolderMaskGreen;
|
|
46046
|
-
const baseColor = new
|
|
46378
|
+
const baseColor = new THREE48.Color(
|
|
46047
46379
|
solderMaskColor[0],
|
|
46048
46380
|
solderMaskColor[1],
|
|
46049
46381
|
solderMaskColor[2]
|
|
@@ -46055,28 +46387,28 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
|
|
|
46055
46387
|
const material = createBoardMaterial({
|
|
46056
46388
|
material: boardData?.material,
|
|
46057
46389
|
color: baseColor,
|
|
46058
|
-
side:
|
|
46390
|
+
side: THREE48.DoubleSide
|
|
46059
46391
|
});
|
|
46060
|
-
const mesh = new
|
|
46392
|
+
const mesh = new THREE48.Mesh(geometry, material);
|
|
46061
46393
|
scene.add(mesh);
|
|
46062
46394
|
}
|
|
46063
46395
|
}
|
|
46064
|
-
const gridColor = new
|
|
46065
|
-
const gridHelper = new
|
|
46396
|
+
const gridColor = new THREE48.Color(8947848);
|
|
46397
|
+
const gridHelper = new THREE48.GridHelper(100, 100, gridColor, gridColor);
|
|
46066
46398
|
gridHelper.rotation.x = Math.PI / 2;
|
|
46067
46399
|
const materials = Array.isArray(gridHelper.material) ? gridHelper.material : [gridHelper.material];
|
|
46068
46400
|
for (const mat of materials) {
|
|
46069
46401
|
mat.transparent = true;
|
|
46070
46402
|
mat.opacity = 0.3;
|
|
46071
|
-
if (mat instanceof
|
|
46403
|
+
if (mat instanceof THREE48.LineBasicMaterial) {
|
|
46072
46404
|
mat.color = gridColor;
|
|
46073
46405
|
mat.vertexColors = false;
|
|
46074
46406
|
}
|
|
46075
46407
|
}
|
|
46076
46408
|
scene.add(gridHelper);
|
|
46077
|
-
const box = new
|
|
46078
|
-
const center = box.getCenter(new
|
|
46079
|
-
const size4 = box.getSize(new
|
|
46409
|
+
const box = new THREE48.Box3().setFromObject(scene);
|
|
46410
|
+
const center = box.getCenter(new THREE48.Vector3());
|
|
46411
|
+
const size4 = box.getSize(new THREE48.Vector3());
|
|
46080
46412
|
scene.position.sub(center);
|
|
46081
46413
|
const maxDim = Math.max(size4.x, size4.y, size4.z);
|
|
46082
46414
|
if (maxDim > 0) {
|
|
@@ -46094,7 +46426,7 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
|
|
|
46094
46426
|
|
|
46095
46427
|
// src/hooks/exporter/gltf.ts
|
|
46096
46428
|
import { GLTFExporter as GLTFExporter3 } from "three-stdlib";
|
|
46097
|
-
import { useEffect as
|
|
46429
|
+
import { useEffect as useEffect48, useState as useState38, useMemo as useMemo30, useCallback as useCallback24 } from "react";
|
|
46098
46430
|
function useSaveGltfAs(options = {}) {
|
|
46099
46431
|
const parse2 = useParser(options);
|
|
46100
46432
|
const link = useMemo30(() => document.createElement("a"), []);
|
|
@@ -46107,7 +46439,7 @@ function useSaveGltfAs(options = {}) {
|
|
|
46107
46439
|
link.dispatchEvent(new MouseEvent("click"));
|
|
46108
46440
|
URL.revokeObjectURL(url);
|
|
46109
46441
|
};
|
|
46110
|
-
|
|
46442
|
+
useEffect48(
|
|
46111
46443
|
() => () => {
|
|
46112
46444
|
link.remove();
|
|
46113
46445
|
instance = null;
|
|
@@ -46115,20 +46447,20 @@ function useSaveGltfAs(options = {}) {
|
|
|
46115
46447
|
[]
|
|
46116
46448
|
);
|
|
46117
46449
|
let instance;
|
|
46118
|
-
const ref =
|
|
46450
|
+
const ref = useCallback24((obj3D) => {
|
|
46119
46451
|
instance = obj3D;
|
|
46120
46452
|
}, []);
|
|
46121
46453
|
return [ref, saveAs];
|
|
46122
46454
|
}
|
|
46123
46455
|
function useExportGltfUrl(options = {}) {
|
|
46124
46456
|
const parse2 = useParser(options);
|
|
46125
|
-
const [url, setUrl] =
|
|
46126
|
-
const [error, setError] =
|
|
46127
|
-
const ref =
|
|
46457
|
+
const [url, setUrl] = useState38();
|
|
46458
|
+
const [error, setError] = useState38();
|
|
46459
|
+
const ref = useCallback24(
|
|
46128
46460
|
(instance) => parse2(instance).then(setUrl).catch(setError),
|
|
46129
46461
|
[]
|
|
46130
46462
|
);
|
|
46131
|
-
|
|
46463
|
+
useEffect48(() => () => URL.revokeObjectURL(url), [url]);
|
|
46132
46464
|
return [ref, url, error];
|
|
46133
46465
|
}
|
|
46134
46466
|
function useParser(options = {}) {
|