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